From: support Date: Tue, 14 Feb 2023 08:37:45 +0000 (+0000) Subject: Built motion from commit 5293bb2a.|2.6.30 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=e027b470bba882c702cf701934f3f05451ec404f;p=motion2.git Built motion from commit 5293bb2a.|2.6.30 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 9a95581..a900386 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-02-13T16:04:51.691Z", + "time": "2023-02-14T08:27:09.575Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index cf23d3d..bffab35 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-02-13T16:04:51.691Z", + "time": "2023-02-14T08:27:09.575Z", "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 d58ea56..15a80f4 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 _0x3ff5=['contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x4c1adc,_0x5cc1aa){var _0x5354f=function(_0x590c68){while(--_0x590c68){_0x4c1adc['push'](_0x4c1adc['shift']());}};_0x5354f(++_0x5cc1aa);}(_0x3ff5,0x1e1));var _0x53ff=function(_0x2d2a1b,_0x6debdf){_0x2d2a1b=_0x2d2a1b-0x0;var _0x1d006d=_0x3ff5[_0x2d2a1b];return _0x1d006d;};'use strict';var Sequelize=require(_0x53ff('0x0'));module[_0x53ff('0x1')]={'name':{'type':Sequelize[_0x53ff('0x2')],'get':function(_0x33360f){return this[_0x53ff('0x3')](_0x53ff('0x4'));}},'action':{'type':Sequelize[_0x53ff('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x53ff('0x6'),_0x53ff('0x7'),'motionbar',_0x53ff('0x8'),_0x53ff('0x9'),'browser',_0x53ff('0xa'),_0x53ff('0xb')]],'msg':_0x53ff('0xc')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x53ff('0xd')},'data3':{'type':Sequelize[_0x53ff('0x5')](0x1000),'comment':_0x53ff('0xe')},'data4':{'type':Sequelize[_0x53ff('0x5')](0x1000),'comments':_0x53ff('0xf')},'data5':{'type':Sequelize[_0x53ff('0x5')](0x1000),'comments':_0x53ff('0x10')},'data6':{'type':Sequelize[_0x53ff('0x5')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x53ff('0x11')],'comments':_0x53ff('0x12')}}; \ No newline at end of file +var _0x62fb=['action','STRING','contactManager','integration','motionbar','jscripty','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','sequelize','VIRTUAL','getDataValue'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x62fb,0x1cd));var _0xb62f=function(_0x4846a7,_0x10fe39){_0x4846a7=_0x4846a7-0x0;var _0x10634e=_0x62fb[_0x4846a7];return _0x10634e;};'use strict';var Sequelize=require(_0xb62f('0x0'));module['exports']={'name':{'type':Sequelize[_0xb62f('0x1')],'get':function(_0x42c7b4){return this[_0xb62f('0x2')](_0xb62f('0x3'));}},'action':{'type':Sequelize[_0xb62f('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xb62f('0x5'),_0xb62f('0x6'),_0xb62f('0x7'),_0xb62f('0x8'),'urlForward',_0xb62f('0x9'),_0xb62f('0xa'),_0xb62f('0xb')]],'msg':_0xb62f('0xc')}},'comment':_0xb62f('0xc')},'data1':{'type':Sequelize[_0xb62f('0x4')](0x1000),'comment':_0xb62f('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xb62f('0x4')](0x1000),'comment':_0xb62f('0xe')},'data4':{'type':Sequelize[_0xb62f('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xb62f('0xf')},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize['TEXT'],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 21eb421..64321d2 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 _0xa96e=['end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','body','Action','find','params','catch','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x3fa8ee,_0x3b350d){var _0x36a857=function(_0x289c6c){while(--_0x289c6c){_0x3fa8ee['push'](_0x3fa8ee['shift']());}};_0x36a857(++_0x3b350d);}(_0xa96e,0x1ec));var _0xea96=function(_0x2c1256,_0x4c378d){_0x2c1256=_0x2c1256-0x0;var _0x5adf91=_0xa96e[_0x2c1256];return _0x5adf91;};'use strict';var emlformat=require(_0xea96('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xea96('0x1'));var moment=require(_0xea96('0x2'));var BPromise=require(_0xea96('0x3'));var Mustache=require(_0xea96('0x4'));var util=require(_0xea96('0x5'));var path=require(_0xea96('0x6'));var sox=require(_0xea96('0x7'));var csv=require(_0xea96('0x8'));var ejs=require(_0xea96('0x9'));var fs=require('fs');var fs_extra=require(_0xea96('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xea96('0xb'));var deskjs=require(_0xea96('0xc'));var toCsv=require(_0xea96('0x8'));var querystring=require(_0xea96('0xd'));var Papa=require(_0xea96('0xe'));var Redis=require('ioredis');var authService=require(_0xea96('0xf'));var qs=require(_0xea96('0x10'));var as=require(_0xea96('0x11'));var hardwareService=require(_0xea96('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xea96('0x13'));var config=require(_0xea96('0x14'));var licenseUtil=require(_0xea96('0x15'));var db=require(_0xea96('0x16'))['db'];function respondWithStatusCode(_0x8fc5c4,_0x180ead){_0x180ead=_0x180ead||0xcc;return function(_0x3e98ff){if(_0x3e98ff){return _0x8fc5c4[_0xea96('0x17')](_0x180ead);}return _0x8fc5c4[_0xea96('0x18')](_0x180ead)[_0xea96('0x19')]();};}function respondWithResult(_0x4313ed,_0x283dce){_0x283dce=_0x283dce||0xc8;return function(_0x5d8726){if(_0x5d8726){return _0x4313ed[_0xea96('0x18')](_0x283dce)[_0xea96('0x1a')](_0x5d8726);}};}function respondWithFilteredResult(_0x3c0152,_0x1855dc){return function(_0x3c6457){if(_0x3c6457){var _0xac9642=typeof _0x1855dc['offset']===_0xea96('0x1b')&&typeof _0x1855dc[_0xea96('0x1c')]==='undefined';var _0x97987c=_0x3c6457[_0xea96('0x1d')];var _0x2d7686=_0xac9642?0x0:_0x1855dc[_0xea96('0x1e')];var _0xd728a7=_0xac9642?_0x3c6457[_0xea96('0x1d')]:_0x1855dc['offset']+_0x1855dc[_0xea96('0x1c')];var _0x4ed66f;if(_0xd728a7>=_0x97987c){_0xd728a7=_0x97987c;_0x4ed66f=0xc8;}else{_0x4ed66f=0xce;}_0x3c0152[_0xea96('0x18')](_0x4ed66f);return _0x3c0152[_0xea96('0x1f')](_0xea96('0x20'),_0x2d7686+'-'+_0xd728a7+'/'+_0x97987c)[_0xea96('0x1a')](_0x3c6457);}return null;};}function patchUpdates(_0x15d95a){return function(_0x4eb4cd){try{jsonpatch[_0xea96('0x21')](_0x4eb4cd,_0x15d95a,!![]);}catch(_0x37ddc3){return BPromise[_0xea96('0x22')](_0x37ddc3);}return _0x4eb4cd[_0xea96('0x23')]();};}function saveUpdates(_0x3fa639,_0x486692){return function(_0x31b3ac){if(_0x31b3ac){return _0x31b3ac[_0xea96('0x24')](_0x3fa639)[_0xea96('0x25')](function(_0x2a4e4c){return _0x2a4e4c;});}return null;};}function removeEntity(_0x3a93e6,_0x348030){return function(_0x328918){if(_0x328918){return _0x328918[_0xea96('0x26')]()[_0xea96('0x25')](function(){_0x3a93e6[_0xea96('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x178f5a,_0x1a46f6){return function(_0x327a67){if(!_0x327a67){_0x178f5a[_0xea96('0x17')](0x194);}return _0x327a67;};}function handleError(_0x4c494a,_0x2773c6){_0x2773c6=_0x2773c6||0x1f4;return function(_0x5f1d4a){logger['error'](_0x5f1d4a[_0xea96('0x27')]);if(_0x5f1d4a[_0xea96('0x28')]){delete _0x5f1d4a['name'];}_0x4c494a['status'](_0x2773c6)[_0xea96('0x29')](_0x5f1d4a);};}exports[_0xea96('0x24')]=function(_0x2e334f,_0x332282){if(_0x2e334f['body']['id']){delete _0x2e334f[_0xea96('0x2a')]['id'];}return db[_0xea96('0x2b')][_0xea96('0x2c')]({'where':{'id':_0x2e334f[_0xea96('0x2d')]['id']}})[_0xea96('0x25')](handleEntityNotFound(_0x332282,null))[_0xea96('0x25')](saveUpdates(_0x2e334f['body'],null))[_0xea96('0x25')](respondWithResult(_0x332282,null))[_0xea96('0x2e')](handleError(_0x332282,null));};exports[_0xea96('0x26')]=function(_0x304bd4,_0x18a5f5){return db['Action'][_0xea96('0x2c')]({'where':{'id':_0x304bd4[_0xea96('0x2d')]['id']}})[_0xea96('0x25')](handleEntityNotFound(_0x18a5f5,null))['then'](removeEntity(_0x18a5f5,null))[_0xea96('0x2e')](handleError(_0x18a5f5,null));}; \ No newline at end of file +var _0x7090=['end','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','then','error','name','send','update','body','Action','find','catch','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x143ce6,_0x46e089){var _0x33ed64=function(_0x5a6856){while(--_0x5a6856){_0x143ce6['push'](_0x143ce6['shift']());}};_0x33ed64(++_0x46e089);}(_0x7090,0x69));var _0x0709=function(_0x20845e,_0x211e78){_0x20845e=_0x20845e-0x0;var _0x28cf2b=_0x7090[_0x20845e];return _0x28cf2b;};'use strict';var emlformat=require(_0x0709('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0709('0x1'));var rp=require(_0x0709('0x2'));var moment=require(_0x0709('0x3'));var BPromise=require(_0x0709('0x4'));var Mustache=require(_0x0709('0x5'));var util=require('util');var path=require(_0x0709('0x6'));var sox=require('sox');var csv=require(_0x0709('0x7'));var ejs=require(_0x0709('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0709('0x9'));var crypto=require(_0x0709('0xa'));var jsforce=require(_0x0709('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0709('0x7'));var querystring=require(_0x0709('0xc'));var Papa=require('papaparse');var Redis=require(_0x0709('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x0709('0xe'));var as=require(_0x0709('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0709('0x10'))(_0x0709('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0709('0x12'));var db=require(_0x0709('0x13'))['db'];function respondWithStatusCode(_0x55e18e,_0x4c6a52){_0x4c6a52=_0x4c6a52||0xcc;return function(_0x3af667){if(_0x3af667){return _0x55e18e[_0x0709('0x14')](_0x4c6a52);}return _0x55e18e['status'](_0x4c6a52)[_0x0709('0x15')]();};}function respondWithResult(_0x44a0f8,_0x217c03){_0x217c03=_0x217c03||0xc8;return function(_0x34b35a){if(_0x34b35a){return _0x44a0f8[_0x0709('0x16')](_0x217c03)[_0x0709('0x17')](_0x34b35a);}};}function respondWithFilteredResult(_0x31e6e6,_0x36deb5){return function(_0x43b9b3){if(_0x43b9b3){var _0x437755=typeof _0x36deb5['offset']===_0x0709('0x18')&&typeof _0x36deb5['limit']===_0x0709('0x18');var _0xefc44c=_0x43b9b3[_0x0709('0x19')];var _0x34b847=_0x437755?0x0:_0x36deb5[_0x0709('0x1a')];var _0x254870=_0x437755?_0x43b9b3[_0x0709('0x19')]:_0x36deb5['offset']+_0x36deb5['limit'];var _0x409566;if(_0x254870>=_0xefc44c){_0x254870=_0xefc44c;_0x409566=0xc8;}else{_0x409566=0xce;}_0x31e6e6[_0x0709('0x16')](_0x409566);return _0x31e6e6[_0x0709('0x1b')](_0x0709('0x1c'),_0x34b847+'-'+_0x254870+'/'+_0xefc44c)[_0x0709('0x17')](_0x43b9b3);}return null;};}function patchUpdates(_0x2bdbae){return function(_0x3626ef){try{jsonpatch[_0x0709('0x1d')](_0x3626ef,_0x2bdbae,!![]);}catch(_0x4b22f3){return BPromise[_0x0709('0x1e')](_0x4b22f3);}return _0x3626ef[_0x0709('0x1f')]();};}function saveUpdates(_0x1a50ab,_0x53eb57){return function(_0x2ac90b){if(_0x2ac90b){return _0x2ac90b['update'](_0x1a50ab)[_0x0709('0x20')](function(_0x10e4fd){return _0x10e4fd;});}return null;};}function removeEntity(_0x37a13a,_0x537bbb){return function(_0x4a8a45){if(_0x4a8a45){return _0x4a8a45['destroy']()[_0x0709('0x20')](function(){_0x37a13a[_0x0709('0x16')](0xcc)[_0x0709('0x15')]();});}};}function handleEntityNotFound(_0x4cbdf3,_0x1ffa65){return function(_0x5b9b81){if(!_0x5b9b81){_0x4cbdf3[_0x0709('0x14')](0x194);}return _0x5b9b81;};}function handleError(_0x1ac7fe,_0x32daeb){_0x32daeb=_0x32daeb||0x1f4;return function(_0x2e680c){logger[_0x0709('0x21')](_0x2e680c['stack']);if(_0x2e680c['name']){delete _0x2e680c[_0x0709('0x22')];}_0x1ac7fe['status'](_0x32daeb)[_0x0709('0x23')](_0x2e680c);};}exports[_0x0709('0x24')]=function(_0x27dd67,_0x15c3b9){if(_0x27dd67['body']['id']){delete _0x27dd67[_0x0709('0x25')]['id'];}return db[_0x0709('0x26')][_0x0709('0x27')]({'where':{'id':_0x27dd67['params']['id']}})['then'](handleEntityNotFound(_0x15c3b9,null))[_0x0709('0x20')](saveUpdates(_0x27dd67['body'],null))[_0x0709('0x20')](respondWithResult(_0x15c3b9,null))[_0x0709('0x28')](handleError(_0x15c3b9,null));};exports[_0x0709('0x29')]=function(_0x5aa065,_0x3b80b7){return db['Action'][_0x0709('0x27')]({'where':{'id':_0x5aa065['params']['id']}})['then'](handleEntityNotFound(_0x3b80b7,null))['then'](removeEntity(_0x3b80b7,null))[_0x0709('0x28')](handleError(_0x3b80b7,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 6a3efa7..8a5f01f 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 _0x8a85=['tools_actions','util','api','moment','path','rimraf','../../config/environment','./action.attributes','exports','define','Action'];(function(_0x1927e6,_0x533110){var _0x167b6d=function(_0x175ff1){while(--_0x175ff1){_0x1927e6['push'](_0x1927e6['shift']());}};_0x167b6d(++_0x533110);}(_0x8a85,0x64));var _0x58a8=function(_0x18a9c7,_0x482d37){_0x18a9c7=_0x18a9c7-0x0;var _0x15c561=_0x8a85[_0x18a9c7];return _0x15c561;};'use strict';var _=require('lodash');var util=require(_0x58a8('0x0'));var logger=require('../../config/logger')(_0x58a8('0x1'));var moment=require(_0x58a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x58a8('0x3'));var rimraf=require(_0x58a8('0x4'));var config=require(_0x58a8('0x5'));var attributes=require(_0x58a8('0x6'));module[_0x58a8('0x7')]=function(_0x4fedae,_0x5f37a6){return _0x4fedae[_0x58a8('0x8')](_0x58a8('0x9'),attributes,{'tableName':_0x58a8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdfaa=['../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x229d5a,_0x6d3d74){var _0x3d0574=function(_0x1ced06){while(--_0x1ced06){_0x229d5a['push'](_0x229d5a['shift']());}};_0x3d0574(++_0x6d3d74);}(_0xdfaa,0x1c6));var _0xadfa=function(_0xd2b9e,_0x410a4d){_0xd2b9e=_0xd2b9e-0x0;var _0x496ed6=_0xdfaa[_0xd2b9e];return _0x496ed6;};'use strict';var _=require(_0xadfa('0x0'));var util=require(_0xadfa('0x1'));var logger=require(_0xadfa('0x2'))('api');var moment=require(_0xadfa('0x3'));var BPromise=require(_0xadfa('0x4'));var rp=require(_0xadfa('0x5'));var fs=require('fs');var path=require(_0xadfa('0x6'));var rimraf=require(_0xadfa('0x7'));var config=require(_0xadfa('0x8'));var attributes=require(_0xadfa('0x9'));module[_0xadfa('0xa')]=function(_0x1c639a,_0x6d86f){return _0x1c639a[_0xadfa('0xb')](_0xadfa('0xc'),attributes,{'tableName':_0xadfa('0xd'),'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 57a3c74..cbcc9ee 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 _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2ae298,_0xe595ff){_0x2ae298=_0x2ae298-0x0;var _0x2fb54e=_0x1cb9[_0x2ae298];return _0x2fb54e;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Action,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file +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(_0x1b1730,_0x220ccc){var _0x1fad11=function(_0x52a28e){while(--_0x52a28e){_0x1b1730['push'](_0x1b1730['shift']());}};_0x1fad11(++_0x220ccc);}(_0x5fc3,0xa8));var _0x35fc=function(_0x389832,_0x10a4a9){_0x389832=_0x389832-0x0;var _0x59429e=_0x5fc3[_0x389832];return _0x59429e;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Action,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index b4601d2..7f784f8 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 _0xeb18=['../../components/interaction/service','../../config/environment','put','/:id','update','delete','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x5d8631,_0x44944b){var _0x34c15e=function(_0x4448f8){while(--_0x4448f8){_0x5d8631['push'](_0x5d8631['shift']());}};_0x34c15e(++_0x44944b);}(_0xeb18,0x14c));var _0x8eb1=function(_0x5d0402,_0x482822){_0x5d0402=_0x5d0402-0x0;var _0x349ebd=_0xeb18[_0x5d0402];return _0x349ebd;};'use strict';var multer=require(_0x8eb1('0x0'));var util=require(_0x8eb1('0x1'));var path=require(_0x8eb1('0x2'));var timeout=require(_0x8eb1('0x3'));var express=require(_0x8eb1('0x4'));var router=express[_0x8eb1('0x5')]();var fs_extra=require(_0x8eb1('0x6'));var auth=require(_0x8eb1('0x7'));var interaction=require(_0x8eb1('0x8'));var config=require(_0x8eb1('0x9'));var controller=require('./action.controller');router[_0x8eb1('0xa')](_0x8eb1('0xb'),auth['isAuthenticated'](),controller[_0x8eb1('0xc')]);router[_0x8eb1('0xd')](_0x8eb1('0xb'),auth[_0x8eb1('0xe')](),controller[_0x8eb1('0xf')]);module[_0x8eb1('0x10')]=router; \ No newline at end of file +var _0x2cc7=['/:id','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','isAuthenticated','update','delete'];(function(_0x210f26,_0x1455da){var _0x5a368c=function(_0x8c6c02){while(--_0x8c6c02){_0x210f26['push'](_0x210f26['shift']());}};_0x5a368c(++_0x1455da);}(_0x2cc7,0xa8));var _0x72cc=function(_0x30b40c,_0x1e6324){_0x30b40c=_0x30b40c-0x0;var _0xd6f652=_0x2cc7[_0x30b40c];return _0xd6f652;};'use strict';var multer=require(_0x72cc('0x0'));var util=require('util');var path=require(_0x72cc('0x1'));var timeout=require(_0x72cc('0x2'));var express=require('express');var router=express[_0x72cc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x72cc('0x4'));var interaction=require(_0x72cc('0x5'));var config=require(_0x72cc('0x6'));var controller=require(_0x72cc('0x7'));router[_0x72cc('0x8')]('/:id',auth[_0x72cc('0x9')](),controller[_0x72cc('0xa')]);router[_0x72cc('0xb')](_0x72cc('0xc'),auth[_0x72cc('0x9')](),controller[_0x72cc('0xd')]);module[_0x72cc('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 4dfb417..a865871 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 _0xd8fb=['TEXT','sequelize','exports','STRING'];(function(_0x3f26af,_0x52193a){var _0x350819=function(_0x3f000a){while(--_0x3f000a){_0x3f26af['push'](_0x3f26af['shift']());}};_0x350819(++_0x52193a);}(_0xd8fb,0x99));var _0xbd8f=function(_0x390fe1,_0x251c8a){_0x390fe1=_0x390fe1-0x0;var _0x19dfb4=_0xd8fb[_0x390fe1];return _0x19dfb4;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'name':{'type':Sequelize[_0xbd8f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbd8f('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbd8f('0x3')]}}; \ No newline at end of file +var _0xeff8=['STRING','TEXT','sequelize','exports'];(function(_0x5c37e8,_0x4abedf){var _0x26024d=function(_0x41e396){while(--_0x41e396){_0x5c37e8['push'](_0x5c37e8['shift']());}};_0x26024d(++_0x4abedf);}(_0xeff8,0x186));var _0x8eff=function(_0x365be9,_0x3c88b9){_0x365be9=_0x365be9-0x0;var _0x185c12=_0xeff8[_0x365be9];return _0x185c12;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eff('0x2')]},'parent':{'type':Sequelize[_0x8eff('0x2')]},'table':{'type':Sequelize[_0x8eff('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x8eff('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 8e571e4..7844ba2 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 _0x787c=['QueryTypes','SELECT','join','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','value','getFields','replace','groupBy','alias','%s.%s\x20=\x20%s.%s','output','web','fullPath','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','run','runReport','AnalyticMetric','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','CustomReports','UserProfileResource','error','stack','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','rules','length','operator','group','field','condition','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','metric','function','format','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','toString','sequelize'];(function(_0x525164,_0x10c689){var _0x569d92=function(_0x21f5b5){while(--_0x21f5b5){_0x525164['push'](_0x525164['shift']());}};_0x569d92(++_0x10c689);}(_0x787c,0x172));var _0xc787=function(_0x3863f4,_0x105e10){_0x3863f4=_0x3863f4-0x0;var _0x58f1e7=_0x787c[_0x3863f4];return _0x58f1e7;};'use strict';var emlformat=require(_0xc787('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc787('0x1'));var jsonpatch=require(_0xc787('0x2'));var rp=require(_0xc787('0x3'));var moment=require(_0xc787('0x4'));var BPromise=require(_0xc787('0x5'));var Mustache=require(_0xc787('0x6'));var util=require(_0xc787('0x7'));var path=require(_0xc787('0x8'));var sox=require(_0xc787('0x9'));var csv=require(_0xc787('0xa'));var ejs=require(_0xc787('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc787('0xc'));var squel=require(_0xc787('0xd'));var crypto=require(_0xc787('0xe'));var jsforce=require(_0xc787('0xf'));var deskjs=require(_0xc787('0x10'));var toCsv=require(_0xc787('0xa'));var querystring=require('querystring');var Papa=require(_0xc787('0x11'));var Redis=require('ioredis');var authService=require(_0xc787('0x12'));var qs=require(_0xc787('0x13'));var as=require(_0xc787('0x14'));var hardwareService=require(_0xc787('0x15'));var logger=require(_0xc787('0x16'))(_0xc787('0x17'));var utils=require(_0xc787('0x18'));var config=require(_0xc787('0x19'));var licenseUtil=require(_0xc787('0x1a'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x529ce2,_0x2a873b){_0x2a873b=_0x2a873b||0xcc;return function(_0x2ad770){if(_0x2ad770){return _0x529ce2[_0xc787('0x1b')](_0x2a873b);}return _0x529ce2[_0xc787('0x1c')](_0x2a873b)[_0xc787('0x1d')]();};}function respondWithResult(_0x358023,_0x58ad26){_0x58ad26=_0x58ad26||0xc8;return function(_0x3b2bb0){if(_0x3b2bb0){return _0x358023[_0xc787('0x1c')](_0x58ad26)[_0xc787('0x1e')](_0x3b2bb0);}};}function respondWithFilteredResult(_0x21ccef,_0xa02e86){return function(_0x34bc46){if(_0x34bc46){var _0x3c2178=typeof _0xa02e86['offset']===_0xc787('0x1f')&&typeof _0xa02e86[_0xc787('0x20')]==='undefined';var _0x15f1df=_0x34bc46[_0xc787('0x21')];var _0x4b4a54=_0x3c2178?0x0:_0xa02e86[_0xc787('0x22')];var _0x451a34=_0x3c2178?_0x34bc46['count']:_0xa02e86[_0xc787('0x22')]+_0xa02e86[_0xc787('0x20')];var _0x1ea5da;if(_0x451a34>=_0x15f1df){_0x451a34=_0x15f1df;_0x1ea5da=0xc8;}else{_0x1ea5da=0xce;}_0x21ccef['status'](_0x1ea5da);return _0x21ccef[_0xc787('0x23')](_0xc787('0x24'),_0x4b4a54+'-'+_0x451a34+'/'+_0x15f1df)[_0xc787('0x1e')](_0x34bc46);}return null;};}function patchUpdates(_0x29ac60){return function(_0x26cfa5){try{jsonpatch['apply'](_0x26cfa5,_0x29ac60,!![]);}catch(_0x4d453d){return BPromise[_0xc787('0x25')](_0x4d453d);}return _0x26cfa5[_0xc787('0x26')]();};}function saveUpdates(_0x41d9a6,_0xdbd38f){return function(_0x2cc23a){if(_0x2cc23a){return _0x2cc23a[_0xc787('0x27')](_0x41d9a6)[_0xc787('0x28')](function(_0x154003){return _0x154003;});}return null;};}function removeEntity(_0x3964a2,_0x483932){return function(_0x3162d4){if(_0x3162d4){return _0x3162d4[_0xc787('0x29')]()[_0xc787('0x28')](function(){var _0x197a4b=_0x3162d4['get']({'plain':!![]});var _0x781d0b=_0xc787('0x2a');return db[_0xc787('0x2b')][_0xc787('0x29')]({'where':{'type':_0x781d0b,'resourceId':_0x197a4b['id']}})['then'](function(){return _0x3162d4;});})['then'](function(){_0x3964a2[_0xc787('0x1c')](0xcc)[_0xc787('0x1d')]();});}};}function handleEntityNotFound(_0x2b5f10,_0x331644){return function(_0x51b957){if(!_0x51b957){_0x2b5f10['sendStatus'](0x194);}return _0x51b957;};}function handleError(_0x5f03b4,_0x41affc){_0x41affc=_0x41affc||0x1f4;return function(_0x863d6d){logger[_0xc787('0x2c')](_0x863d6d[_0xc787('0x2d')]);if(_0x863d6d[_0xc787('0x2e')]){delete _0x863d6d[_0xc787('0x2e')];}_0x5f03b4[_0xc787('0x1c')](_0x41affc)['send'](_0x863d6d);};}exports[_0xc787('0x2f')]=function(_0x50f138,_0x37a01d){var _0x3a091a={},_0x5c1425={},_0x3f5af6={'count':0x0,'rows':[]};var _0x12cb93=_[_0xc787('0x30')](db[_0xc787('0x31')][_0xc787('0x32')],function(_0x148e31){return{'name':_0x148e31[_0xc787('0x33')],'type':_0x148e31[_0xc787('0x34')]['key']};});_0x5c1425[_0xc787('0x35')]=_[_0xc787('0x30')](_0x12cb93,_0xc787('0x2e'));_0x5c1425['query']=_['keys'](_0x50f138[_0xc787('0x36')]);_0x5c1425[_0xc787('0x37')]=_[_0xc787('0x38')](_0x5c1425[_0xc787('0x35')],_0x5c1425[_0xc787('0x36')]);_0x3a091a[_0xc787('0x39')]=_[_0xc787('0x38')](_0x5c1425[_0xc787('0x35')],qs[_0xc787('0x3a')](_0x50f138['query'][_0xc787('0x3a')]));_0x3a091a[_0xc787('0x39')]=_0x3a091a['attributes']['length']?_0x3a091a[_0xc787('0x39')]:_0x5c1425[_0xc787('0x35')];if(!_0x50f138['query'][_0xc787('0x3b')]('nolimit')){_0x3a091a['limit']=qs[_0xc787('0x20')](_0x50f138[_0xc787('0x36')][_0xc787('0x20')]);_0x3a091a[_0xc787('0x22')]=qs[_0xc787('0x22')](_0x50f138[_0xc787('0x36')][_0xc787('0x22')]);}_0x3a091a[_0xc787('0x3c')]=qs[_0xc787('0x3d')](_0x50f138[_0xc787('0x36')]['sort']);_0x3a091a[_0xc787('0x3e')]=qs[_0xc787('0x37')](_['pick'](_0x50f138['query'],_0x5c1425[_0xc787('0x37')]),_0x12cb93);if(_0x50f138['query'][_0xc787('0x3f')]){_0x3a091a[_0xc787('0x3e')]=_[_0xc787('0x40')](_0x3a091a[_0xc787('0x3e')],{'$or':_[_0xc787('0x30')](_0x12cb93,function(_0x4fc73d){if(_0x4fc73d[_0xc787('0x34')]!==_0xc787('0x41')){var _0xfe2b93={};_0xfe2b93[_0x4fc73d[_0xc787('0x2e')]]={'$like':'%'+_0x50f138['query']['filter']+'%'};return _0xfe2b93;}})});}_0x3a091a=_[_0xc787('0x40')]({},_0x3a091a,_0x50f138[_0xc787('0x42')]);var _0x1133c8={'where':_0x3a091a[_0xc787('0x3e')]};return db[_0xc787('0x31')][_0xc787('0x21')](_0x1133c8)['then'](function(_0x2735c2){_0x3f5af6[_0xc787('0x21')]=_0x2735c2;if(_0x50f138[_0xc787('0x36')][_0xc787('0x43')]){_0x3a091a[_0xc787('0x44')]=[{'all':!![]}];}return db[_0xc787('0x31')][_0xc787('0x45')](_0x3a091a);})[_0xc787('0x28')](function(_0x47127){_0x3f5af6['rows']=_0x47127;return _0x3f5af6;})['then'](respondWithFilteredResult(_0x37a01d,_0x3a091a))[_0xc787('0x46')](handleError(_0x37a01d,null));};exports[_0xc787('0x47')]=function(_0x2351af,_0xb60a87){var _0xe9cef4={'raw':![],'where':{'id':_0x2351af[_0xc787('0x48')]['id']}},_0x3dad06={};_0x3dad06[_0xc787('0x35')]=_[_0xc787('0x49')](db[_0xc787('0x31')][_0xc787('0x32')]);_0x3dad06[_0xc787('0x36')]=_['keys'](_0x2351af[_0xc787('0x36')]);_0x3dad06[_0xc787('0x37')]=_[_0xc787('0x38')](_0x3dad06[_0xc787('0x35')],_0x3dad06[_0xc787('0x36')]);_0xe9cef4[_0xc787('0x39')]=_[_0xc787('0x38')](_0x3dad06['model'],qs[_0xc787('0x3a')](_0x2351af[_0xc787('0x36')]['fields']));_0xe9cef4[_0xc787('0x39')]=_0xe9cef4[_0xc787('0x39')]['length']?_0xe9cef4[_0xc787('0x39')]:_0x3dad06[_0xc787('0x35')];if(_0x2351af[_0xc787('0x36')][_0xc787('0x43')]){_0xe9cef4[_0xc787('0x44')]=[{'all':!![]}];}_0xe9cef4=_[_0xc787('0x40')]({},_0xe9cef4,_0x2351af[_0xc787('0x42')]);return db[_0xc787('0x31')]['find'](_0xe9cef4)[_0xc787('0x28')](handleEntityNotFound(_0xb60a87,null))['then'](respondWithResult(_0xb60a87,null))[_0xc787('0x46')](handleError(_0xb60a87,null));};exports['create']=function(_0x46f414,_0x264d5f){return db['AnalyticCustomReport'][_0xc787('0x4a')](_0x46f414['body'],{})[_0xc787('0x28')](function(_0x516f42){var _0x4309ff=_0x46f414[_0xc787('0x4b')]['get']({'plain':!![]});if(!_0x4309ff)throw new Error(_0xc787('0x4c'));if(_0x4309ff[_0xc787('0x4d')]==='user'){var _0x1f5a78=_0x516f42['get']({'plain':!![]});var _0x59ba29='Reports';return db[_0xc787('0x4e')][_0xc787('0x4f')]({'where':{'name':_0x59ba29,'userProfileId':_0x4309ff[_0xc787('0x50')]},'raw':!![]})[_0xc787('0x28')](function(_0x4765f9){if(_0x4765f9&&_0x4765f9[_0xc787('0x51')]===0x0){return db[_0xc787('0x2b')][_0xc787('0x4a')]({'name':_0x1f5a78[_0xc787('0x2e')],'resourceId':_0x1f5a78['id'],'type':'CustomReports','sectionId':_0x4765f9['id']},{})[_0xc787('0x28')](function(){return _0x516f42;});}else{return _0x516f42;}})[_0xc787('0x46')](function(_0xb58225){logger[_0xc787('0x2c')](_0xc787('0x52'),_0xb58225);throw _0xb58225;});}return _0x516f42;})[_0xc787('0x28')](respondWithResult(_0x264d5f,0xc9))[_0xc787('0x46')](handleError(_0x264d5f,null));};exports[_0xc787('0x27')]=function(_0x5d8e18,_0x5b2de6){if(_0x5d8e18['body']['id']){delete _0x5d8e18[_0xc787('0x53')]['id'];}return db['AnalyticCustomReport'][_0xc787('0x4f')]({'where':{'id':_0x5d8e18[_0xc787('0x48')]['id']}})[_0xc787('0x28')](handleEntityNotFound(_0x5b2de6,null))['then'](saveUpdates(_0x5d8e18['body'],null))[_0xc787('0x28')](respondWithResult(_0x5b2de6,null))[_0xc787('0x46')](handleError(_0x5b2de6,null));};exports['destroy']=function(_0x53eb83,_0x13f7ec){return db[_0xc787('0x31')][_0xc787('0x4f')]({'where':{'id':_0x53eb83[_0xc787('0x48')]['id']}})[_0xc787('0x28')](handleEntityNotFound(_0x13f7ec,null))[_0xc787('0x28')](removeEntity(_0x13f7ec,null))['catch'](handleError(_0x13f7ec,null));};exports[_0xc787('0x54')]=function(_0x346eac,_0x33be3b){var _0x5b0413=0xa;var _0x482c61=['join',_0xc787('0x55'),_0xc787('0x56'),_0xc787('0x57')];var _0xc1a16a={'SUM':_0xc787('0x58'),'COUNT':_0xc787('0x59'),'COUNT DISTINCT':_0xc787('0x5a'),'MAX':_0xc787('0x5b'),'MIN':'MIN(%s)','AVG':_0xc787('0x5c'),'GROUP_CONCAT':_0xc787('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc787('0x5e')};var _0x189c36={'SEC_TO_TIME':_0xc787('0x5f'),'DATE':'DATE(%s)','HOUR':_0xc787('0x60'),'ROUND':_0xc787('0x61'),'UNIX_TIMESTAMP':_0xc787('0x62')};var _0x5aac43=function(_0x578bce){return!_[_0xc787('0x63')]([_0xc787('0x64'),'IS\x20NOT\x20NULL',_0xc787('0x65'),'IS\x20NOT\x20EMPTY'],_0x578bce);};var _0x171c19=function(_0x2993e0){if(!_0x2993e0||!_0x2993e0[_0xc787('0x66')][_0xc787('0x67')]){return'';}for(var _0xfe4b85='(',_0x164956=0x0;_0x164956<_0x2993e0[_0xc787('0x66')][_0xc787('0x67')];_0x164956+=0x1){_0x164956>0x0&&(_0xfe4b85+='\x20'+_0x2993e0[_0xc787('0x68')]+'\x20');_0xfe4b85+=_0x2993e0[_0xc787('0x66')][_0x164956][_0xc787('0x69')]?_0x171c19(_0x2993e0[_0xc787('0x66')][_0x164956][_0xc787('0x69')]):_0x2993e0[_0xc787('0x66')][_0x164956][_0xc787('0x6a')]+'\x20'+_0x2993e0[_0xc787('0x66')][_0x164956][_0xc787('0x6b')]+(_0x5aac43(_0x2993e0['rules'][_0x164956][_0xc787('0x6b')])?'\x20'+_0x2993e0[_0xc787('0x66')][_0x164956]['value']:'');}return _0xfe4b85+')';};var _0x489ca2={'where':{'id':_0x346eac[_0xc787('0x48')]['id']}},_0x1aea8d,_0x4ff0ed,_0x4b477f,_0x3783c7,_0x9f727c;_0x489ca2=_['merge']({},_0x489ca2,_0x346eac[_0xc787('0x42')]);return db[_0xc787('0x31')]['find'](_0x489ca2)[_0xc787('0x28')](function(_0x490f2c){if(_0x490f2c){_0x1aea8d=_0x490f2c;return _0x490f2c['getFields']();}return null;})['then'](function(_0x284660){if(_0x284660){if(!_0x284660[_0xc787('0x67')]){throw new db[(_0xc787('0x6c'))][(_0xc787('0x6d'))](_0xc787('0x6e'),0x193);}_0x4ff0ed=_0x284660;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xc787('0x28')](function(_0x504a26){if(_0x504a26){_0x4b477f=_[_0xc787('0x6f')](_0x504a26,'id');var _0x43017b;var _0x2e71b9=squel[_0xc787('0x70')]();_0x2e71b9[_0xc787('0x71')](_0x1aea8d[_0xc787('0x72')]);for(var _0xb77360=0x0;_0xb77360<_0x4ff0ed['length'];_0xb77360+=0x1){_0x43017b=_0x4ff0ed[_0xb77360][_0xc787('0x73')]?_0x4b477f[_0x4ff0ed[_0xb77360][_0xc787('0x73')]][_0xc787('0x74')]:_0x4ff0ed[_0xb77360][_0xc787('0x6a')];_0x43017b=_0x4ff0ed[_0xb77360][_0xc787('0x75')]?_['replace'](_0xc1a16a[_0x4ff0ed[_0xb77360][_0xc787('0x75')]],'%s',_0x43017b):_0x43017b;_0x43017b=_0x4ff0ed[_0xb77360]['format']?_['replace'](_0x189c36[_0x4ff0ed[_0xb77360][_0xc787('0x76')]],'%s',_0x43017b):_0x43017b;if(_0x4ff0ed[_0xb77360]['groupBy']){_0x2e71b9[_0xc787('0x69')](_0x43017b);}_0x4ff0ed[_0xb77360][_0xc787('0x77')]&&_0x2e71b9[_0xc787('0x3c')](_0x43017b,_0x4ff0ed[_0xb77360][_0xc787('0x77')]===_0xc787('0x78')?![]:!![]);_0x2e71b9[_0xc787('0x6a')](_0x43017b,_0x4ff0ed[_0xb77360]['alias']||_0x43017b);}if(_0x1aea8d['joins']){_0x1aea8d[_0xc787('0x79')]=JSON[_0xc787('0x7a')](_0x1aea8d[_0xc787('0x79')]);for(var _0x32038d=0x0;_0x32038d<_0x1aea8d[_0xc787('0x79')][_0xc787('0x67')];_0x32038d+=0x1){if(_0x1aea8d[_0xc787('0x79')][_0x32038d][_0xc787('0x34')]&&_[_0xc787('0x63')](_0x482c61,_0x1aea8d['joins'][_0x32038d]['type'])&&_0x1aea8d[_0xc787('0x79')][_0x32038d][_0xc787('0x7b')]&&_0x1aea8d[_0xc787('0x79')][_0x32038d][_0xc787('0x7c')]&&_0x1aea8d[_0xc787('0x79')][_0x32038d][_0xc787('0x7d')]){_0x2e71b9[_0x1aea8d[_0xc787('0x79')][_0x32038d][_0xc787('0x34')]](_0x1aea8d[_0xc787('0x79')][_0x32038d][_0xc787('0x7c')],null,util[_0xc787('0x76')]('%s.%s\x20=\x20%s.%s',_0x1aea8d[_0xc787('0x72')],_0x1aea8d[_0xc787('0x79')][_0x32038d][_0xc787('0x7b')],_0x1aea8d[_0xc787('0x79')][_0x32038d][_0xc787('0x7c')],_0x1aea8d[_0xc787('0x79')][_0x32038d][_0xc787('0x7d')]));}}}if(_0x1aea8d['conditions']){_0x1aea8d[_0xc787('0x7e')]=JSON[_0xc787('0x7a')](_0x1aea8d['conditions']);_0x2e71b9[_0xc787('0x3e')](_0x171c19(_0x1aea8d[_0xc787('0x7e')][_0xc787('0x69')]));}_0x9f727c=_0x2e71b9[_0xc787('0x7f')]();_0x2e71b9['limit'](_0x5b0413);_0x2e71b9[_0xc787('0x22')](0x0);logger[_0xc787('0x80')]('Limited\x20Query:',_0x2e71b9[_0xc787('0x81')]());return dbH[_0xc787('0x82')]['query'](_0x2e71b9[_0xc787('0x81')](),{'type':dbH[_0xc787('0x82')][_0xc787('0x83')][_0xc787('0x84')]});}})[_0xc787('0x28')](respondWithResult(_0x33be3b,null))[_0xc787('0x46')](handleError(_0x33be3b,null));};function runReport(_0x599840,_0xbfd301,_0x41d326){var _0x3af98c=_0xbfd301[_0xc787('0x2e')];var _0x2819d7=0xa;var _0x1799f6=[_0xc787('0x85'),_0xc787('0x55'),'right_join',_0xc787('0x57')];var _0xbebf20={'SUM':_0xc787('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc787('0x5a'),'MAX':_0xc787('0x5b'),'MIN':_0xc787('0x86'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xc787('0x5d'),'GROUP_CONCAT ASC':_0xc787('0x87'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x42ce8d={'SEC_TO_TIME':_0xc787('0x5f'),'DATE':_0xc787('0x88'),'HOUR':_0xc787('0x60'),'ROUND':_0xc787('0x61'),'UNIX_TIMESTAMP':_0xc787('0x62')};var _0x1a24f7=function(_0x36a93b){return!_[_0xc787('0x63')]([_0xc787('0x64'),_0xc787('0x89'),_0xc787('0x65'),_0xc787('0x8a')],_0x36a93b);};var _0x125824=function(_0x4888be){if(!_0x4888be||!_0x4888be['rules']['length']){return'';}for(var _0xfc66d8='(',_0x1e0d16=0x0;_0x1e0d16<_0x4888be['rules'][_0xc787('0x67')];_0x1e0d16+=0x1){_0x1e0d16>0x0&&(_0xfc66d8+='\x20'+_0x4888be[_0xc787('0x68')]+'\x20');_0xfc66d8+=_0x4888be[_0xc787('0x66')][_0x1e0d16]['group']?_0x125824(_0x4888be[_0xc787('0x66')][_0x1e0d16][_0xc787('0x69')]):_0x4888be[_0xc787('0x66')][_0x1e0d16][_0xc787('0x6a')]+'\x20'+_0x4888be[_0xc787('0x66')][_0x1e0d16][_0xc787('0x6b')]+(_0x1a24f7(_0x4888be['rules'][_0x1e0d16]['condition'])?'\x20'+_0x4888be['rules'][_0x1e0d16][_0xc787('0x8b')]:'');}return _0xfc66d8+')';};var _0x1c970f={'where':{'id':_0x599840['id']}},_0x5cb4fa,_0x2a20d8,_0x34f46c,_0xcdca5a,_0x18d4be;_0x1c970f=_[_0xc787('0x40')]({},_0x1c970f,_0x41d326);return db['AnalyticCustomReport']['find'](_0x1c970f)[_0xc787('0x28')](function(_0x3eda0f){if(_0x3eda0f){_0x5cb4fa=_0x3eda0f;return _0x3eda0f[_0xc787('0x8c')]();}return null;})['then'](function(_0x37dcee){if(_0x37dcee){if(!_0x37dcee[_0xc787('0x67')]){throw new db[(_0xc787('0x6c'))][(_0xc787('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2a20d8=_0x37dcee;return db['AnalyticMetric'][_0xc787('0x45')]({'raw':!![]});}return null;})['then'](function(_0x34059a){if(_0x34059a){_0x34f46c=_[_0xc787('0x6f')](_0x34059a,'id');var _0x57c572;var _0x4fe5e5=squel[_0xc787('0x70')]();_0x4fe5e5[_0xc787('0x71')](_0x5cb4fa[_0xc787('0x72')]);for(var _0x47e245=0x0;_0x47e245<_0x2a20d8[_0xc787('0x67')];_0x47e245+=0x1){_0x57c572=_0x2a20d8[_0x47e245][_0xc787('0x73')]?_0x34f46c[_0x2a20d8[_0x47e245][_0xc787('0x73')]][_0xc787('0x74')]:_0x2a20d8[_0x47e245][_0xc787('0x6a')];_0x57c572=_0x2a20d8[_0x47e245]['function']?_[_0xc787('0x8d')](_0xbebf20[_0x2a20d8[_0x47e245]['function']],'%s',_0x57c572):_0x57c572;_0x57c572=_0x2a20d8[_0x47e245][_0xc787('0x76')]?_[_0xc787('0x8d')](_0x42ce8d[_0x2a20d8[_0x47e245][_0xc787('0x76')]],'%s',_0x57c572):_0x57c572;if(_0x2a20d8[_0x47e245][_0xc787('0x8e')]){_0x4fe5e5['group'](_0x57c572);}_0x2a20d8[_0x47e245][_0xc787('0x77')]&&_0x4fe5e5[_0xc787('0x3c')](_0x57c572,_0x2a20d8[_0x47e245]['orderBy']==='DESC'?![]:!![]);_0x4fe5e5[_0xc787('0x6a')](_0x57c572,_0x2a20d8[_0x47e245][_0xc787('0x8f')]||_0x57c572);}if(_0x5cb4fa[_0xc787('0x79')]){_0x5cb4fa['joins']=JSON[_0xc787('0x7a')](_0x5cb4fa[_0xc787('0x79')]);for(var _0x401672=0x0;_0x401672<_0x5cb4fa['joins'][_0xc787('0x67')];_0x401672+=0x1){if(_0x5cb4fa[_0xc787('0x79')][_0x401672][_0xc787('0x34')]&&_['includes'](_0x1799f6,_0x5cb4fa['joins'][_0x401672][_0xc787('0x34')])&&_0x5cb4fa['joins'][_0x401672][_0xc787('0x7b')]&&_0x5cb4fa[_0xc787('0x79')][_0x401672]['foreignTable']&&_0x5cb4fa['joins'][_0x401672]['foreignKey']){_0x4fe5e5[_0x5cb4fa['joins'][_0x401672][_0xc787('0x34')]](_0x5cb4fa[_0xc787('0x79')][_0x401672][_0xc787('0x7c')],null,util[_0xc787('0x76')](_0xc787('0x90'),_0x5cb4fa['table'],_0x5cb4fa[_0xc787('0x79')][_0x401672][_0xc787('0x7b')],_0x5cb4fa[_0xc787('0x79')][_0x401672][_0xc787('0x7c')],_0x5cb4fa['joins'][_0x401672][_0xc787('0x7d')]));}}}if(_0x5cb4fa[_0xc787('0x7e')]){_0x5cb4fa['conditions']=JSON['parse'](_0x5cb4fa['conditions']);_0x4fe5e5[_0xc787('0x3e')](_0x125824(_0x5cb4fa[_0xc787('0x7e')]['group']));}_0x18d4be=_0x4fe5e5['clone']();_0x4fe5e5[_0xc787('0x20')](_0x2819d7);_0x4fe5e5[_0xc787('0x22')](0x0);return;}})['then'](function(){if(_0xbfd301[_0xc787('0x91')]===_0xc787('0x92')){return null;}var _0x32626d=_[_0xc787('0x40')](_0xbfd301,{'name':_0xbfd301[_0xc787('0x93')]||_0xbfd301['name']||_0x5cb4fa['name'],'basename':_0x3af98c,'savename':util[_0xc787('0x76')]('%s-%s.%s',_0xbfd301[_0xc787('0x2e')]||_0x5cb4fa[_0xc787('0x2e')],require(_0xc787('0x94'))[_0xc787('0x95')](0x4),_0xbfd301[_0xc787('0x91')]||_0xc787('0x96')),'reportId':_0x5cb4fa['id'],'reportType':_0xc787('0x97')});return db['AnalyticExtractedReport'][_0xc787('0x4a')](_0x32626d,{'raw':!![]});})['then'](function(_0xcb47e0){if(_0x5cb4fa[_0xc787('0x72')]===_0xc787('0x98')){_0x18d4be['where'](_0x5cb4fa[_0xc787('0x72')]+_0xc787('0x99'),_0xbfd301[_0xc787('0x9a')],_0xbfd301[_0xc787('0x9b')]);}else{_0x18d4be['where'](_0x5cb4fa['table']+_0xc787('0x9c'),_0xbfd301[_0xc787('0x9a')],_0xbfd301['endDate']);}if(_0xcb47e0){logger['info'](_0xc787('0x9d'),_0x18d4be['toString']());require(_0xc787('0x9e'))[_0xc787('0x9f')](path[_0xc787('0x85')](__dirname,_0xc787('0xa0'),_0xcb47e0[_0xc787('0x91')]),[_0xcb47e0['id'],_0x18d4be[_0xc787('0x81')](),path['join'](__dirname,_0xc787('0xa1'),_0xcb47e0[_0xc787('0xa2')]),_0x3af98c]);return _0xcb47e0;}else{var _0xb7cd5c=squel[_0xc787('0x70')]();_0xb7cd5c[_0xc787('0x71')]('('+_0x18d4be[_0xc787('0x81')]()+')','countTable');_0xb7cd5c[_0xc787('0x6a')](_0xc787('0xa3'),_0xc787('0x21'));_0x18d4be[_0xc787('0x20')](_0xbfd301[_0xc787('0x20')]||_0x2819d7);_0x18d4be[_0xc787('0x22')](_0xbfd301[_0xc787('0x22')]||0x0);return dbH['sequelize'][_0xc787('0x36')](_0xb7cd5c[_0xc787('0x81')](),{'type':dbH['sequelize'][_0xc787('0x83')][_0xc787('0x84')]})[_0xc787('0x28')](function(_0x16e2cc){if(!_0x16e2cc[_0xc787('0x67')]){_0xcdca5a=0x0;}else{_0xcdca5a=_0x16e2cc[0x0][_0xc787('0x21')]||0x0;}return dbH[_0xc787('0x82')][_0xc787('0x36')](_0x18d4be[_0xc787('0x81')](),{'type':dbH[_0xc787('0x82')][_0xc787('0x83')][_0xc787('0x84')]});})[_0xc787('0x28')](function(_0x4944ee){return{'rows':_0x4944ee||[],'count':_0xcdca5a};});}});}exports[_0xc787('0xa4')]=function(_0x1b6502,_0x2e547a){return runReport(_0x1b6502[_0xc787('0x48')],_0x1b6502[_0xc787('0x36')],_0x1b6502[_0xc787('0x42')])[_0xc787('0x28')](respondWithResult(_0x2e547a,null))[_0xc787('0x46')](handleError(_0x2e547a,null));};exports[_0xc787('0xa5')]=runReport;exports['query']=function(_0x4088fb,_0x4a6270){var _0x1fc2a2=0xa;var _0x3ece42=['join',_0xc787('0x55'),_0xc787('0x56'),_0xc787('0x57')];var _0x5d45db={'SUM':_0xc787('0x58'),'COUNT':_0xc787('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc787('0x5b'),'MIN':_0xc787('0x86'),'AVG':_0xc787('0x5c'),'GROUP_CONCAT':_0xc787('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2d8bd7={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xc787('0x88'),'HOUR':_0xc787('0x60'),'ROUND':_0xc787('0x61'),'UNIX_TIMESTAMP':_0xc787('0x62')};var _0x30a968=function(_0x269dab){return!_[_0xc787('0x63')]([_0xc787('0x64'),'IS\x20NOT\x20NULL',_0xc787('0x65'),'IS\x20NOT\x20EMPTY'],_0x269dab);};var _0x5110b0=function(_0xf9c084){if(!_0xf9c084||!_0xf9c084[_0xc787('0x66')][_0xc787('0x67')]){return'';}for(var _0x178fc8='(',_0x22f3bc=0x0;_0x22f3bc<_0xf9c084[_0xc787('0x66')][_0xc787('0x67')];_0x22f3bc+=0x1){_0x22f3bc>0x0&&(_0x178fc8+='\x20'+_0xf9c084[_0xc787('0x68')]+'\x20');_0x178fc8+=_0xf9c084[_0xc787('0x66')][_0x22f3bc][_0xc787('0x69')]?_0x5110b0(_0xf9c084['rules'][_0x22f3bc][_0xc787('0x69')]):_0xf9c084[_0xc787('0x66')][_0x22f3bc][_0xc787('0x6a')]+'\x20'+_0xf9c084[_0xc787('0x66')][_0x22f3bc][_0xc787('0x6b')]+(_0x30a968(_0xf9c084['rules'][_0x22f3bc][_0xc787('0x6b')])?'\x20'+_0xf9c084[_0xc787('0x66')][_0x22f3bc][_0xc787('0x8b')]:'');}return _0x178fc8+')';};var _0x39fd94={'where':{'id':_0x4088fb['params']['id']}},_0x14d6aa,_0x49c7be,_0x5cb65b,_0x4168a3,_0x24da30;_0x39fd94=_[_0xc787('0x40')]({},_0x39fd94,_0x4088fb[_0xc787('0x42')]);return db['AnalyticCustomReport']['find'](_0x39fd94)[_0xc787('0x28')](function(_0x34f090){if(_0x34f090){_0x14d6aa=_0x34f090;return _0x34f090[_0xc787('0x8c')]();}return null;})[_0xc787('0x28')](function(_0x24e6ae){if(_0x24e6ae){if(!_0x24e6ae['length']){throw new db[(_0xc787('0x6c'))][(_0xc787('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x49c7be=_0x24e6ae;return db[_0xc787('0xa6')][_0xc787('0x45')]({'raw':!![]});}return null;})['then'](function(_0x51f630){if(_0x51f630){_0x5cb65b=_[_0xc787('0x6f')](_0x51f630,'id');var _0x36c5af;var _0xf1937d=squel[_0xc787('0x70')]();_0xf1937d[_0xc787('0x71')](_0x14d6aa[_0xc787('0x72')]);for(var _0x3893c0=0x0;_0x3893c0<_0x49c7be[_0xc787('0x67')];_0x3893c0+=0x1){_0x36c5af=_0x49c7be[_0x3893c0][_0xc787('0x73')]?_0x5cb65b[_0x49c7be[_0x3893c0][_0xc787('0x73')]][_0xc787('0x74')]:_0x49c7be[_0x3893c0][_0xc787('0x6a')];_0x36c5af=_0x49c7be[_0x3893c0][_0xc787('0x75')]?_[_0xc787('0x8d')](_0x5d45db[_0x49c7be[_0x3893c0]['function']],'%s',_0x36c5af):_0x36c5af;_0x36c5af=_0x49c7be[_0x3893c0][_0xc787('0x76')]?_['replace'](_0x2d8bd7[_0x49c7be[_0x3893c0][_0xc787('0x76')]],'%s',_0x36c5af):_0x36c5af;if(_0x49c7be[_0x3893c0][_0xc787('0x8e')]){_0xf1937d['group'](_0x36c5af);}_0x49c7be[_0x3893c0][_0xc787('0x77')]&&_0xf1937d['order'](_0x36c5af,_0x49c7be[_0x3893c0][_0xc787('0x77')]==='DESC'?![]:!![]);_0xf1937d[_0xc787('0x6a')](_0x36c5af,_0x49c7be[_0x3893c0]['alias']||_0x36c5af);}if(_0x14d6aa[_0xc787('0x79')]){_0x14d6aa[_0xc787('0x79')]=JSON[_0xc787('0x7a')](_0x14d6aa[_0xc787('0x79')]);for(var _0xeebe16=0x0;_0xeebe16<_0x14d6aa[_0xc787('0x79')][_0xc787('0x67')];_0xeebe16+=0x1){if(_0x14d6aa['joins'][_0xeebe16][_0xc787('0x34')]&&_[_0xc787('0x63')](_0x3ece42,_0x14d6aa[_0xc787('0x79')][_0xeebe16]['type'])&&_0x14d6aa[_0xc787('0x79')][_0xeebe16][_0xc787('0x7b')]&&_0x14d6aa[_0xc787('0x79')][_0xeebe16][_0xc787('0x7c')]&&_0x14d6aa[_0xc787('0x79')][_0xeebe16]['foreignKey']){_0xf1937d[_0x14d6aa[_0xc787('0x79')][_0xeebe16]['type']](_0x14d6aa['joins'][_0xeebe16][_0xc787('0x7c')],null,util['format'](_0xc787('0x90'),_0x14d6aa[_0xc787('0x72')],_0x14d6aa[_0xc787('0x79')][_0xeebe16]['parentKey'],_0x14d6aa[_0xc787('0x79')][_0xeebe16]['foreignTable'],_0x14d6aa[_0xc787('0x79')][_0xeebe16][_0xc787('0x7d')]));}}}if(_0x14d6aa[_0xc787('0x7e')]){_0x14d6aa['conditions']=JSON[_0xc787('0x7a')](_0x14d6aa['conditions']);_0xf1937d[_0xc787('0x3e')](_0x5110b0(_0x14d6aa[_0xc787('0x7e')][_0xc787('0x69')]));}_0x24da30=_0xf1937d[_0xc787('0x7f')]();_0xf1937d[_0xc787('0x20')](_0x1fc2a2);_0xf1937d[_0xc787('0x22')](0x0);logger[_0xc787('0x80')]('Limited\x20Query:',_0xf1937d[_0xc787('0x81')]());return dbH[_0xc787('0x82')][_0xc787('0x36')](_0xf1937d[_0xc787('0x81')](),{'type':dbH[_0xc787('0x82')][_0xc787('0x83')]['SELECT']});}})[_0xc787('0x28')](function(){return{'sql':_0x24da30[_0xc787('0x81')]()};})[_0xc787('0x28')](respondWithResult(_0x4a6270,null))[_0xc787('0x46')](handleError(_0x4a6270,null));}; \ No newline at end of file +var _0xbce4=['key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','AnalyticCustomReport','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','field','function','format','replace','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','ROUND(%s)','ValidationErrorItem','table','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','IS\x20NOT\x20NULL','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','fieldName','type'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xbce4,0x76));var _0x4bce=function(_0x21d83c,_0x2901d4){_0x21d83c=_0x21d83c-0x0;var _0x414b48=_0xbce4[_0x21d83c];return _0x414b48;};'use strict';var emlformat=require(_0x4bce('0x0'));var rimraf=require(_0x4bce('0x1'));var zipdir=require(_0x4bce('0x2'));var jsonpatch=require(_0x4bce('0x3'));var rp=require(_0x4bce('0x4'));var moment=require('moment');var BPromise=require(_0x4bce('0x5'));var Mustache=require(_0x4bce('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4bce('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4bce('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4bce('0x9'));var deskjs=require(_0x4bce('0xa'));var toCsv=require(_0x4bce('0xb'));var querystring=require('querystring');var Papa=require(_0x4bce('0xc'));var Redis=require(_0x4bce('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4bce('0xe'));var as=require(_0x4bce('0xf'));var hardwareService=require(_0x4bce('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x4bce('0x11'));var config=require(_0x4bce('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x4bce('0x13')];function respondWithStatusCode(_0x910d5c,_0x50e16c){_0x50e16c=_0x50e16c||0xcc;return function(_0xc448c2){if(_0xc448c2){return _0x910d5c[_0x4bce('0x14')](_0x50e16c);}return _0x910d5c[_0x4bce('0x15')](_0x50e16c)[_0x4bce('0x16')]();};}function respondWithResult(_0x526614,_0x281266){_0x281266=_0x281266||0xc8;return function(_0x2afeb9){if(_0x2afeb9){return _0x526614[_0x4bce('0x15')](_0x281266)[_0x4bce('0x17')](_0x2afeb9);}};}function respondWithFilteredResult(_0x25d0dd,_0x55efa8){return function(_0x4bf792){if(_0x4bf792){var _0x482518=typeof _0x55efa8[_0x4bce('0x18')]===_0x4bce('0x19')&&typeof _0x55efa8[_0x4bce('0x1a')]===_0x4bce('0x19');var _0x7627ef=_0x4bf792[_0x4bce('0x1b')];var _0x332cca=_0x482518?0x0:_0x55efa8[_0x4bce('0x18')];var _0xc04bbd=_0x482518?_0x4bf792['count']:_0x55efa8[_0x4bce('0x18')]+_0x55efa8['limit'];var _0x1a853a;if(_0xc04bbd>=_0x7627ef){_0xc04bbd=_0x7627ef;_0x1a853a=0xc8;}else{_0x1a853a=0xce;}_0x25d0dd['status'](_0x1a853a);return _0x25d0dd[_0x4bce('0x1c')]('Content-Range',_0x332cca+'-'+_0xc04bbd+'/'+_0x7627ef)[_0x4bce('0x17')](_0x4bf792);}return null;};}function patchUpdates(_0x1b72ac){return function(_0x5101d9){try{jsonpatch[_0x4bce('0x1d')](_0x5101d9,_0x1b72ac,!![]);}catch(_0x521eb5){return BPromise[_0x4bce('0x1e')](_0x521eb5);}return _0x5101d9[_0x4bce('0x1f')]();};}function saveUpdates(_0x493386,_0x1b1e63){return function(_0x59a644){if(_0x59a644){return _0x59a644[_0x4bce('0x20')](_0x493386)[_0x4bce('0x21')](function(_0x21675a){return _0x21675a;});}return null;};}function removeEntity(_0x13aab1,_0x50c4cf){return function(_0x294c29){if(_0x294c29){return _0x294c29[_0x4bce('0x22')]()['then'](function(){var _0x3dab68=_0x294c29[_0x4bce('0x23')]({'plain':!![]});var _0x14468f='CustomReports';return db[_0x4bce('0x24')][_0x4bce('0x22')]({'where':{'type':_0x14468f,'resourceId':_0x3dab68['id']}})[_0x4bce('0x21')](function(){return _0x294c29;});})[_0x4bce('0x21')](function(){_0x13aab1[_0x4bce('0x15')](0xcc)[_0x4bce('0x16')]();});}};}function handleEntityNotFound(_0x11c2eb,_0x3b70bf){return function(_0x28b030){if(!_0x28b030){_0x11c2eb[_0x4bce('0x14')](0x194);}return _0x28b030;};}function handleError(_0x1102e0,_0x3a8e18){_0x3a8e18=_0x3a8e18||0x1f4;return function(_0x193e2d){logger[_0x4bce('0x25')](_0x193e2d[_0x4bce('0x26')]);if(_0x193e2d[_0x4bce('0x27')]){delete _0x193e2d['name'];}_0x1102e0[_0x4bce('0x15')](_0x3a8e18)[_0x4bce('0x28')](_0x193e2d);};}exports['index']=function(_0x1c843b,_0x5047ef){var _0x127197={},_0x2e249f={},_0x21b3f={'count':0x0,'rows':[]};var _0x26d2ee=_[_0x4bce('0x29')](db['AnalyticCustomReport']['rawAttributes'],function(_0x3f29f2){return{'name':_0x3f29f2[_0x4bce('0x2a')],'type':_0x3f29f2[_0x4bce('0x2b')][_0x4bce('0x2c')]};});_0x2e249f[_0x4bce('0x2d')]=_[_0x4bce('0x29')](_0x26d2ee,_0x4bce('0x27'));_0x2e249f[_0x4bce('0x2e')]=_[_0x4bce('0x2f')](_0x1c843b[_0x4bce('0x2e')]);_0x2e249f[_0x4bce('0x30')]=_[_0x4bce('0x31')](_0x2e249f[_0x4bce('0x2d')],_0x2e249f[_0x4bce('0x2e')]);_0x127197[_0x4bce('0x32')]=_[_0x4bce('0x31')](_0x2e249f['model'],qs[_0x4bce('0x33')](_0x1c843b[_0x4bce('0x2e')][_0x4bce('0x33')]));_0x127197[_0x4bce('0x32')]=_0x127197[_0x4bce('0x32')][_0x4bce('0x34')]?_0x127197[_0x4bce('0x32')]:_0x2e249f['model'];if(!_0x1c843b[_0x4bce('0x2e')]['hasOwnProperty']('nolimit')){_0x127197['limit']=qs[_0x4bce('0x1a')](_0x1c843b[_0x4bce('0x2e')][_0x4bce('0x1a')]);_0x127197[_0x4bce('0x18')]=qs[_0x4bce('0x18')](_0x1c843b[_0x4bce('0x2e')][_0x4bce('0x18')]);}_0x127197[_0x4bce('0x35')]=qs[_0x4bce('0x36')](_0x1c843b[_0x4bce('0x2e')][_0x4bce('0x36')]);_0x127197[_0x4bce('0x37')]=qs[_0x4bce('0x30')](_[_0x4bce('0x38')](_0x1c843b[_0x4bce('0x2e')],_0x2e249f['filters']),_0x26d2ee);if(_0x1c843b['query']['filter']){_0x127197['where']=_[_0x4bce('0x39')](_0x127197[_0x4bce('0x37')],{'$or':_[_0x4bce('0x29')](_0x26d2ee,function(_0x28b83d){if(_0x28b83d[_0x4bce('0x2b')]!==_0x4bce('0x3a')){var _0x4061cf={};_0x4061cf[_0x28b83d[_0x4bce('0x27')]]={'$like':'%'+_0x1c843b[_0x4bce('0x2e')][_0x4bce('0x3b')]+'%'};return _0x4061cf;}})});}_0x127197=_[_0x4bce('0x39')]({},_0x127197,_0x1c843b[_0x4bce('0x3c')]);var _0x2e0446={'where':_0x127197[_0x4bce('0x37')]};return db[_0x4bce('0x3d')][_0x4bce('0x1b')](_0x2e0446)[_0x4bce('0x21')](function(_0x3bd8dd){_0x21b3f[_0x4bce('0x1b')]=_0x3bd8dd;if(_0x1c843b[_0x4bce('0x2e')][_0x4bce('0x3e')]){_0x127197[_0x4bce('0x3f')]=[{'all':!![]}];}return db[_0x4bce('0x3d')][_0x4bce('0x40')](_0x127197);})[_0x4bce('0x21')](function(_0x37f958){_0x21b3f['rows']=_0x37f958;return _0x21b3f;})['then'](respondWithFilteredResult(_0x5047ef,_0x127197))[_0x4bce('0x41')](handleError(_0x5047ef,null));};exports[_0x4bce('0x42')]=function(_0x570049,_0x2fa25c){var _0x4ec547={'raw':![],'where':{'id':_0x570049[_0x4bce('0x43')]['id']}},_0x2dbe3f={};_0x2dbe3f[_0x4bce('0x2d')]=_[_0x4bce('0x2f')](db[_0x4bce('0x3d')][_0x4bce('0x44')]);_0x2dbe3f['query']=_[_0x4bce('0x2f')](_0x570049[_0x4bce('0x2e')]);_0x2dbe3f[_0x4bce('0x30')]=_[_0x4bce('0x31')](_0x2dbe3f[_0x4bce('0x2d')],_0x2dbe3f[_0x4bce('0x2e')]);_0x4ec547[_0x4bce('0x32')]=_[_0x4bce('0x31')](_0x2dbe3f[_0x4bce('0x2d')],qs[_0x4bce('0x33')](_0x570049[_0x4bce('0x2e')][_0x4bce('0x33')]));_0x4ec547[_0x4bce('0x32')]=_0x4ec547['attributes'][_0x4bce('0x34')]?_0x4ec547[_0x4bce('0x32')]:_0x2dbe3f[_0x4bce('0x2d')];if(_0x570049[_0x4bce('0x2e')][_0x4bce('0x3e')]){_0x4ec547[_0x4bce('0x3f')]=[{'all':!![]}];}_0x4ec547=_['merge']({},_0x4ec547,_0x570049[_0x4bce('0x3c')]);return db['AnalyticCustomReport']['find'](_0x4ec547)[_0x4bce('0x21')](handleEntityNotFound(_0x2fa25c,null))[_0x4bce('0x21')](respondWithResult(_0x2fa25c,null))[_0x4bce('0x41')](handleError(_0x2fa25c,null));};exports[_0x4bce('0x45')]=function(_0x20f25b,_0x40ffcc){return db[_0x4bce('0x3d')][_0x4bce('0x45')](_0x20f25b[_0x4bce('0x46')],{})[_0x4bce('0x21')](function(_0x19075c){var _0x1d4993=_0x20f25b[_0x4bce('0x47')]['get']({'plain':!![]});if(!_0x1d4993)throw new Error(_0x4bce('0x48'));if(_0x1d4993[_0x4bce('0x49')]===_0x4bce('0x47')){var _0x44e206=_0x19075c[_0x4bce('0x23')]({'plain':!![]});var _0x509947=_0x4bce('0x4a');return db[_0x4bce('0x4b')][_0x4bce('0x4c')]({'where':{'name':_0x509947,'userProfileId':_0x1d4993[_0x4bce('0x4d')]},'raw':!![]})[_0x4bce('0x21')](function(_0x8c373f){if(_0x8c373f&&_0x8c373f[_0x4bce('0x4e')]===0x0){return db[_0x4bce('0x24')][_0x4bce('0x45')]({'name':_0x44e206[_0x4bce('0x27')],'resourceId':_0x44e206['id'],'type':_0x4bce('0x4f'),'sectionId':_0x8c373f['id']},{})[_0x4bce('0x21')](function(){return _0x19075c;});}else{return _0x19075c;}})[_0x4bce('0x41')](function(_0x41a05b){logger[_0x4bce('0x25')](_0x4bce('0x50'),_0x41a05b);throw _0x41a05b;});}return _0x19075c;})[_0x4bce('0x21')](respondWithResult(_0x40ffcc,0xc9))[_0x4bce('0x41')](handleError(_0x40ffcc,null));};exports['update']=function(_0x8baed6,_0x1644e9){if(_0x8baed6[_0x4bce('0x46')]['id']){delete _0x8baed6[_0x4bce('0x46')]['id'];}return db[_0x4bce('0x3d')][_0x4bce('0x4c')]({'where':{'id':_0x8baed6[_0x4bce('0x43')]['id']}})[_0x4bce('0x21')](handleEntityNotFound(_0x1644e9,null))[_0x4bce('0x21')](saveUpdates(_0x8baed6[_0x4bce('0x46')],null))[_0x4bce('0x21')](respondWithResult(_0x1644e9,null))['catch'](handleError(_0x1644e9,null));};exports[_0x4bce('0x22')]=function(_0x3ca74d,_0x2a8bb7){return db[_0x4bce('0x3d')][_0x4bce('0x4c')]({'where':{'id':_0x3ca74d[_0x4bce('0x43')]['id']}})[_0x4bce('0x21')](handleEntityNotFound(_0x2a8bb7,null))[_0x4bce('0x21')](removeEntity(_0x2a8bb7,null))[_0x4bce('0x41')](handleError(_0x2a8bb7,null));};exports['preview']=function(_0x5d5e20,_0x5c3cbf){var _0x19a3b3=0xa;var _0x5335af=[_0x4bce('0x51'),_0x4bce('0x52'),_0x4bce('0x53'),_0x4bce('0x54')];var _0x5f336f={'SUM':_0x4bce('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4bce('0x56'),'MAX':_0x4bce('0x57'),'MIN':_0x4bce('0x58'),'AVG':_0x4bce('0x59'),'GROUP_CONCAT':_0x4bce('0x5a'),'GROUP_CONCAT ASC':_0x4bce('0x5b'),'GROUP_CONCAT DESC':_0x4bce('0x5c')};var _0x2e9e3d={'SEC_TO_TIME':_0x4bce('0x5d'),'DATE':_0x4bce('0x5e'),'HOUR':_0x4bce('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4bce('0x60')};var _0x17fb99=function(_0x200113){return!_[_0x4bce('0x61')]([_0x4bce('0x62'),'IS\x20NOT\x20NULL',_0x4bce('0x63'),_0x4bce('0x64')],_0x200113);};var _0xe51977=function(_0x4ac33b){if(!_0x4ac33b||!_0x4ac33b[_0x4bce('0x65')][_0x4bce('0x34')]){return'';}for(var _0x2323ba='(',_0x5e62ae=0x0;_0x5e62ae<_0x4ac33b['rules'][_0x4bce('0x34')];_0x5e62ae+=0x1){_0x5e62ae>0x0&&(_0x2323ba+='\x20'+_0x4ac33b[_0x4bce('0x66')]+'\x20');_0x2323ba+=_0x4ac33b[_0x4bce('0x65')][_0x5e62ae][_0x4bce('0x67')]?_0xe51977(_0x4ac33b[_0x4bce('0x65')][_0x5e62ae]['group']):_0x4ac33b[_0x4bce('0x65')][_0x5e62ae]['field']+'\x20'+_0x4ac33b[_0x4bce('0x65')][_0x5e62ae][_0x4bce('0x68')]+(_0x17fb99(_0x4ac33b['rules'][_0x5e62ae]['condition'])?'\x20'+_0x4ac33b[_0x4bce('0x65')][_0x5e62ae][_0x4bce('0x69')]:'');}return _0x2323ba+')';};var _0x43f496={'where':{'id':_0x5d5e20[_0x4bce('0x43')]['id']}},_0xce4518,_0x1ce19a,_0x1546c5,_0x106920,_0x32f626;_0x43f496=_[_0x4bce('0x39')]({},_0x43f496,_0x5d5e20[_0x4bce('0x3c')]);return db[_0x4bce('0x3d')][_0x4bce('0x4c')](_0x43f496)[_0x4bce('0x21')](function(_0xb8cbcf){if(_0xb8cbcf){_0xce4518=_0xb8cbcf;return _0xb8cbcf[_0x4bce('0x6a')]();}return null;})[_0x4bce('0x21')](function(_0x1dc282){if(_0x1dc282){if(!_0x1dc282['length']){throw new db[(_0x4bce('0x6b'))]['ValidationErrorItem'](_0x4bce('0x6c'),0x193);}_0x1ce19a=_0x1dc282;return db[_0x4bce('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x4bce('0x21')](function(_0x75c1c5){if(_0x75c1c5){_0x1546c5=_[_0x4bce('0x6e')](_0x75c1c5,'id');var _0x5990c9;var _0x2b829d=squel[_0x4bce('0x6f')]();_0x2b829d[_0x4bce('0x70')](_0xce4518['table']);for(var _0x2fd96b=0x0;_0x2fd96b<_0x1ce19a[_0x4bce('0x34')];_0x2fd96b+=0x1){_0x5990c9=_0x1ce19a[_0x2fd96b][_0x4bce('0x71')]?_0x1546c5[_0x1ce19a[_0x2fd96b]['MetricId']][_0x4bce('0x72')]:_0x1ce19a[_0x2fd96b][_0x4bce('0x73')];_0x5990c9=_0x1ce19a[_0x2fd96b]['function']?_['replace'](_0x5f336f[_0x1ce19a[_0x2fd96b][_0x4bce('0x74')]],'%s',_0x5990c9):_0x5990c9;_0x5990c9=_0x1ce19a[_0x2fd96b][_0x4bce('0x75')]?_[_0x4bce('0x76')](_0x2e9e3d[_0x1ce19a[_0x2fd96b]['format']],'%s',_0x5990c9):_0x5990c9;if(_0x1ce19a[_0x2fd96b][_0x4bce('0x77')]){_0x2b829d[_0x4bce('0x67')](_0x5990c9);}_0x1ce19a[_0x2fd96b][_0x4bce('0x78')]&&_0x2b829d[_0x4bce('0x35')](_0x5990c9,_0x1ce19a[_0x2fd96b][_0x4bce('0x78')]===_0x4bce('0x79')?![]:!![]);_0x2b829d['field'](_0x5990c9,_0x1ce19a[_0x2fd96b][_0x4bce('0x7a')]||_0x5990c9);}if(_0xce4518[_0x4bce('0x7b')]){_0xce4518[_0x4bce('0x7b')]=JSON[_0x4bce('0x7c')](_0xce4518['joins']);for(var _0xdb9bff=0x0;_0xdb9bff<_0xce4518[_0x4bce('0x7b')][_0x4bce('0x34')];_0xdb9bff+=0x1){if(_0xce4518[_0x4bce('0x7b')][_0xdb9bff][_0x4bce('0x2b')]&&_['includes'](_0x5335af,_0xce4518[_0x4bce('0x7b')][_0xdb9bff]['type'])&&_0xce4518[_0x4bce('0x7b')][_0xdb9bff][_0x4bce('0x7d')]&&_0xce4518[_0x4bce('0x7b')][_0xdb9bff][_0x4bce('0x7e')]&&_0xce4518[_0x4bce('0x7b')][_0xdb9bff]['foreignKey']){_0x2b829d[_0xce4518[_0x4bce('0x7b')][_0xdb9bff][_0x4bce('0x2b')]](_0xce4518[_0x4bce('0x7b')][_0xdb9bff][_0x4bce('0x7e')],null,util[_0x4bce('0x75')](_0x4bce('0x7f'),_0xce4518['table'],_0xce4518[_0x4bce('0x7b')][_0xdb9bff][_0x4bce('0x7d')],_0xce4518[_0x4bce('0x7b')][_0xdb9bff]['foreignTable'],_0xce4518[_0x4bce('0x7b')][_0xdb9bff][_0x4bce('0x80')]));}}}if(_0xce4518[_0x4bce('0x81')]){_0xce4518['conditions']=JSON[_0x4bce('0x7c')](_0xce4518[_0x4bce('0x81')]);_0x2b829d[_0x4bce('0x37')](_0xe51977(_0xce4518['conditions'][_0x4bce('0x67')]));}_0x32f626=_0x2b829d[_0x4bce('0x82')]();_0x2b829d[_0x4bce('0x1a')](_0x19a3b3);_0x2b829d[_0x4bce('0x18')](0x0);logger['debug'](_0x4bce('0x83'),_0x2b829d[_0x4bce('0x84')]());return dbH[_0x4bce('0x85')][_0x4bce('0x2e')](_0x2b829d['toString'](),{'type':dbH[_0x4bce('0x85')][_0x4bce('0x86')][_0x4bce('0x87')]});}})[_0x4bce('0x21')](respondWithResult(_0x5c3cbf,null))[_0x4bce('0x41')](handleError(_0x5c3cbf,null));};function runReport(_0x5b6985,_0x69f29d,_0x40d8bd){var _0x52c5d3=_0x69f29d['name'];var _0x4a069e=0xa;var _0x57c436=['join',_0x4bce('0x52'),_0x4bce('0x53'),_0x4bce('0x54')];var _0x57fc4c={'SUM':_0x4bce('0x55'),'COUNT':_0x4bce('0x88'),'COUNT DISTINCT':_0x4bce('0x56'),'MAX':_0x4bce('0x57'),'MIN':_0x4bce('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4bce('0x5a'),'GROUP_CONCAT ASC':_0x4bce('0x5b'),'GROUP_CONCAT DESC':_0x4bce('0x5c')};var _0x57db78={'SEC_TO_TIME':_0x4bce('0x5d'),'DATE':_0x4bce('0x5e'),'HOUR':_0x4bce('0x5f'),'ROUND':_0x4bce('0x89'),'UNIX_TIMESTAMP':_0x4bce('0x60')};var _0xaeb4cd=function(_0x3a488f){return!_[_0x4bce('0x61')]([_0x4bce('0x62'),'IS\x20NOT\x20NULL',_0x4bce('0x63'),'IS\x20NOT\x20EMPTY'],_0x3a488f);};var _0x677047=function(_0x3be4a6){if(!_0x3be4a6||!_0x3be4a6['rules'][_0x4bce('0x34')]){return'';}for(var _0x1351cb='(',_0x517ef4=0x0;_0x517ef4<_0x3be4a6[_0x4bce('0x65')][_0x4bce('0x34')];_0x517ef4+=0x1){_0x517ef4>0x0&&(_0x1351cb+='\x20'+_0x3be4a6[_0x4bce('0x66')]+'\x20');_0x1351cb+=_0x3be4a6['rules'][_0x517ef4][_0x4bce('0x67')]?_0x677047(_0x3be4a6[_0x4bce('0x65')][_0x517ef4][_0x4bce('0x67')]):_0x3be4a6[_0x4bce('0x65')][_0x517ef4][_0x4bce('0x73')]+'\x20'+_0x3be4a6[_0x4bce('0x65')][_0x517ef4][_0x4bce('0x68')]+(_0xaeb4cd(_0x3be4a6['rules'][_0x517ef4][_0x4bce('0x68')])?'\x20'+_0x3be4a6['rules'][_0x517ef4][_0x4bce('0x69')]:'');}return _0x1351cb+')';};var _0x2cf8a0={'where':{'id':_0x5b6985['id']}},_0x3bdbd5,_0x3eb645,_0x262525,_0xec6b3a,_0x448a71;_0x2cf8a0=_['merge']({},_0x2cf8a0,_0x40d8bd);return db[_0x4bce('0x3d')][_0x4bce('0x4c')](_0x2cf8a0)[_0x4bce('0x21')](function(_0x67631e){if(_0x67631e){_0x3bdbd5=_0x67631e;return _0x67631e[_0x4bce('0x6a')]();}return null;})['then'](function(_0x379f9e){if(_0x379f9e){if(!_0x379f9e['length']){throw new db['Sequelize'][(_0x4bce('0x8a'))](_0x4bce('0x6c'),0x193);}_0x3eb645=_0x379f9e;return db['AnalyticMetric'][_0x4bce('0x40')]({'raw':!![]});}return null;})[_0x4bce('0x21')](function(_0x17953a){if(_0x17953a){_0x262525=_[_0x4bce('0x6e')](_0x17953a,'id');var _0x5eb332;var _0x2acb14=squel[_0x4bce('0x6f')]();_0x2acb14['from'](_0x3bdbd5[_0x4bce('0x8b')]);for(var _0x14998a=0x0;_0x14998a<_0x3eb645['length'];_0x14998a+=0x1){_0x5eb332=_0x3eb645[_0x14998a][_0x4bce('0x71')]?_0x262525[_0x3eb645[_0x14998a]['MetricId']]['metric']:_0x3eb645[_0x14998a][_0x4bce('0x73')];_0x5eb332=_0x3eb645[_0x14998a][_0x4bce('0x74')]?_['replace'](_0x57fc4c[_0x3eb645[_0x14998a][_0x4bce('0x74')]],'%s',_0x5eb332):_0x5eb332;_0x5eb332=_0x3eb645[_0x14998a][_0x4bce('0x75')]?_[_0x4bce('0x76')](_0x57db78[_0x3eb645[_0x14998a]['format']],'%s',_0x5eb332):_0x5eb332;if(_0x3eb645[_0x14998a][_0x4bce('0x77')]){_0x2acb14[_0x4bce('0x67')](_0x5eb332);}_0x3eb645[_0x14998a][_0x4bce('0x78')]&&_0x2acb14[_0x4bce('0x35')](_0x5eb332,_0x3eb645[_0x14998a][_0x4bce('0x78')]==='DESC'?![]:!![]);_0x2acb14[_0x4bce('0x73')](_0x5eb332,_0x3eb645[_0x14998a]['alias']||_0x5eb332);}if(_0x3bdbd5[_0x4bce('0x7b')]){_0x3bdbd5[_0x4bce('0x7b')]=JSON[_0x4bce('0x7c')](_0x3bdbd5[_0x4bce('0x7b')]);for(var _0x57eab3=0x0;_0x57eab3<_0x3bdbd5[_0x4bce('0x7b')]['length'];_0x57eab3+=0x1){if(_0x3bdbd5[_0x4bce('0x7b')][_0x57eab3][_0x4bce('0x2b')]&&_[_0x4bce('0x61')](_0x57c436,_0x3bdbd5[_0x4bce('0x7b')][_0x57eab3]['type'])&&_0x3bdbd5['joins'][_0x57eab3][_0x4bce('0x7d')]&&_0x3bdbd5['joins'][_0x57eab3]['foreignTable']&&_0x3bdbd5[_0x4bce('0x7b')][_0x57eab3][_0x4bce('0x80')]){_0x2acb14[_0x3bdbd5['joins'][_0x57eab3][_0x4bce('0x2b')]](_0x3bdbd5[_0x4bce('0x7b')][_0x57eab3][_0x4bce('0x7e')],null,util[_0x4bce('0x75')]('%s.%s\x20=\x20%s.%s',_0x3bdbd5['table'],_0x3bdbd5[_0x4bce('0x7b')][_0x57eab3][_0x4bce('0x7d')],_0x3bdbd5[_0x4bce('0x7b')][_0x57eab3][_0x4bce('0x7e')],_0x3bdbd5['joins'][_0x57eab3]['foreignKey']));}}}if(_0x3bdbd5['conditions']){_0x3bdbd5[_0x4bce('0x81')]=JSON[_0x4bce('0x7c')](_0x3bdbd5[_0x4bce('0x81')]);_0x2acb14[_0x4bce('0x37')](_0x677047(_0x3bdbd5['conditions'][_0x4bce('0x67')]));}_0x448a71=_0x2acb14['clone']();_0x2acb14[_0x4bce('0x1a')](_0x4a069e);_0x2acb14[_0x4bce('0x18')](0x0);return;}})[_0x4bce('0x21')](function(){if(_0x69f29d[_0x4bce('0x8c')]==='web'){return null;}var _0x3a275a=_['merge'](_0x69f29d,{'name':_0x69f29d[_0x4bce('0x8d')]||_0x69f29d[_0x4bce('0x27')]||_0x3bdbd5['name'],'basename':_0x52c5d3,'savename':util['format'](_0x4bce('0x8e'),_0x69f29d[_0x4bce('0x27')]||_0x3bdbd5[_0x4bce('0x27')],require(_0x4bce('0x8f'))[_0x4bce('0x90')](0x4),_0x69f29d[_0x4bce('0x8c')]||_0x4bce('0x91')),'reportId':_0x3bdbd5['id'],'reportType':_0x4bce('0x92')});return db[_0x4bce('0x93')]['create'](_0x3a275a,{'raw':!![]});})['then'](function(_0x2f0af8){if(_0x3bdbd5[_0x4bce('0x8b')]===_0x4bce('0x94')){_0x448a71[_0x4bce('0x37')](_0x3bdbd5[_0x4bce('0x8b')]+_0x4bce('0x95'),_0x69f29d[_0x4bce('0x96')],_0x69f29d[_0x4bce('0x97')]);}else{_0x448a71[_0x4bce('0x37')](_0x3bdbd5[_0x4bce('0x8b')]+_0x4bce('0x98'),_0x69f29d[_0x4bce('0x96')],_0x69f29d[_0x4bce('0x97')]);}if(_0x2f0af8){logger[_0x4bce('0x99')]('Run\x20Query:',_0x448a71['toString']());require(_0x4bce('0x9a'))['fork'](path[_0x4bce('0x51')](__dirname,_0x4bce('0x9b'),_0x2f0af8[_0x4bce('0x8c')]),[_0x2f0af8['id'],_0x448a71[_0x4bce('0x84')](),path[_0x4bce('0x51')](__dirname,_0x4bce('0x9c'),_0x2f0af8[_0x4bce('0x9d')]),_0x52c5d3]);return _0x2f0af8;}else{var _0x308979=squel[_0x4bce('0x6f')]();_0x308979[_0x4bce('0x70')]('('+_0x448a71[_0x4bce('0x84')]()+')',_0x4bce('0x9e'));_0x308979[_0x4bce('0x73')](_0x4bce('0x9f'),'count');_0x448a71[_0x4bce('0x1a')](_0x69f29d[_0x4bce('0x1a')]||_0x4a069e);_0x448a71[_0x4bce('0x18')](_0x69f29d[_0x4bce('0x18')]||0x0);return dbH[_0x4bce('0x85')][_0x4bce('0x2e')](_0x308979['toString'](),{'type':dbH[_0x4bce('0x85')][_0x4bce('0x86')]['SELECT']})[_0x4bce('0x21')](function(_0x168b67){if(!_0x168b67[_0x4bce('0x34')]){_0xec6b3a=0x0;}else{_0xec6b3a=_0x168b67[0x0][_0x4bce('0x1b')]||0x0;}return dbH['sequelize'][_0x4bce('0x2e')](_0x448a71[_0x4bce('0x84')](),{'type':dbH['sequelize'][_0x4bce('0x86')][_0x4bce('0x87')]});})[_0x4bce('0x21')](function(_0x589613){return{'rows':_0x589613||[],'count':_0xec6b3a};});}});}exports['run']=function(_0xf590b1,_0x2d94f7){return runReport(_0xf590b1[_0x4bce('0x43')],_0xf590b1['query'],_0xf590b1[_0x4bce('0x3c')])[_0x4bce('0x21')](respondWithResult(_0x2d94f7,null))['catch'](handleError(_0x2d94f7,null));};exports[_0x4bce('0xa0')]=runReport;exports[_0x4bce('0x2e')]=function(_0x43b334,_0x177167){var _0x2f346c=0xa;var _0x3dc540=[_0x4bce('0x51'),'left_join',_0x4bce('0x53'),'cross_join'];var _0x44a957={'SUM':_0x4bce('0x55'),'COUNT':_0x4bce('0x88'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x4bce('0x58'),'AVG':_0x4bce('0x59'),'GROUP_CONCAT':_0x4bce('0x5a'),'GROUP_CONCAT ASC':_0x4bce('0x5b'),'GROUP_CONCAT DESC':_0x4bce('0x5c')};var _0x327c64={'SEC_TO_TIME':_0x4bce('0x5d'),'DATE':_0x4bce('0x5e'),'HOUR':_0x4bce('0x5f'),'ROUND':_0x4bce('0x89'),'UNIX_TIMESTAMP':_0x4bce('0x60')};var _0x64f6de=function(_0x3cfd89){return!_[_0x4bce('0x61')]([_0x4bce('0x62'),_0x4bce('0xa1'),_0x4bce('0x63'),'IS\x20NOT\x20EMPTY'],_0x3cfd89);};var _0x30a83a=function(_0xd3f16){if(!_0xd3f16||!_0xd3f16[_0x4bce('0x65')][_0x4bce('0x34')]){return'';}for(var _0x50d18f='(',_0x290bb9=0x0;_0x290bb9<_0xd3f16['rules'][_0x4bce('0x34')];_0x290bb9+=0x1){_0x290bb9>0x0&&(_0x50d18f+='\x20'+_0xd3f16[_0x4bce('0x66')]+'\x20');_0x50d18f+=_0xd3f16[_0x4bce('0x65')][_0x290bb9]['group']?_0x30a83a(_0xd3f16[_0x4bce('0x65')][_0x290bb9][_0x4bce('0x67')]):_0xd3f16[_0x4bce('0x65')][_0x290bb9]['field']+'\x20'+_0xd3f16[_0x4bce('0x65')][_0x290bb9][_0x4bce('0x68')]+(_0x64f6de(_0xd3f16[_0x4bce('0x65')][_0x290bb9][_0x4bce('0x68')])?'\x20'+_0xd3f16[_0x4bce('0x65')][_0x290bb9]['value']:'');}return _0x50d18f+')';};var _0x4f6211={'where':{'id':_0x43b334['params']['id']}},_0x5ea2a5,_0x30889b,_0x1eb78c,_0x3b9172,_0x3846d1;_0x4f6211=_[_0x4bce('0x39')]({},_0x4f6211,_0x43b334['options']);return db[_0x4bce('0x3d')]['find'](_0x4f6211)[_0x4bce('0x21')](function(_0x84daaf){if(_0x84daaf){_0x5ea2a5=_0x84daaf;return _0x84daaf[_0x4bce('0x6a')]();}return null;})['then'](function(_0x59f827){if(_0x59f827){if(!_0x59f827[_0x4bce('0x34')]){throw new db['Sequelize'][(_0x4bce('0x8a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x30889b=_0x59f827;return db[_0x4bce('0x6d')][_0x4bce('0x40')]({'raw':!![]});}return null;})['then'](function(_0x9f396a){if(_0x9f396a){_0x1eb78c=_[_0x4bce('0x6e')](_0x9f396a,'id');var _0x3a3cd6;var _0x3916a3=squel[_0x4bce('0x6f')]();_0x3916a3['from'](_0x5ea2a5['table']);for(var _0x153dc8=0x0;_0x153dc8<_0x30889b['length'];_0x153dc8+=0x1){_0x3a3cd6=_0x30889b[_0x153dc8][_0x4bce('0x71')]?_0x1eb78c[_0x30889b[_0x153dc8][_0x4bce('0x71')]][_0x4bce('0x72')]:_0x30889b[_0x153dc8][_0x4bce('0x73')];_0x3a3cd6=_0x30889b[_0x153dc8][_0x4bce('0x74')]?_[_0x4bce('0x76')](_0x44a957[_0x30889b[_0x153dc8]['function']],'%s',_0x3a3cd6):_0x3a3cd6;_0x3a3cd6=_0x30889b[_0x153dc8][_0x4bce('0x75')]?_[_0x4bce('0x76')](_0x327c64[_0x30889b[_0x153dc8][_0x4bce('0x75')]],'%s',_0x3a3cd6):_0x3a3cd6;if(_0x30889b[_0x153dc8][_0x4bce('0x77')]){_0x3916a3['group'](_0x3a3cd6);}_0x30889b[_0x153dc8][_0x4bce('0x78')]&&_0x3916a3['order'](_0x3a3cd6,_0x30889b[_0x153dc8]['orderBy']===_0x4bce('0x79')?![]:!![]);_0x3916a3[_0x4bce('0x73')](_0x3a3cd6,_0x30889b[_0x153dc8]['alias']||_0x3a3cd6);}if(_0x5ea2a5['joins']){_0x5ea2a5[_0x4bce('0x7b')]=JSON['parse'](_0x5ea2a5['joins']);for(var _0x5e606b=0x0;_0x5e606b<_0x5ea2a5[_0x4bce('0x7b')]['length'];_0x5e606b+=0x1){if(_0x5ea2a5[_0x4bce('0x7b')][_0x5e606b]['type']&&_[_0x4bce('0x61')](_0x3dc540,_0x5ea2a5[_0x4bce('0x7b')][_0x5e606b][_0x4bce('0x2b')])&&_0x5ea2a5[_0x4bce('0x7b')][_0x5e606b]['parentKey']&&_0x5ea2a5[_0x4bce('0x7b')][_0x5e606b][_0x4bce('0x7e')]&&_0x5ea2a5[_0x4bce('0x7b')][_0x5e606b][_0x4bce('0x80')]){_0x3916a3[_0x5ea2a5[_0x4bce('0x7b')][_0x5e606b][_0x4bce('0x2b')]](_0x5ea2a5[_0x4bce('0x7b')][_0x5e606b][_0x4bce('0x7e')],null,util[_0x4bce('0x75')](_0x4bce('0x7f'),_0x5ea2a5[_0x4bce('0x8b')],_0x5ea2a5[_0x4bce('0x7b')][_0x5e606b][_0x4bce('0x7d')],_0x5ea2a5['joins'][_0x5e606b][_0x4bce('0x7e')],_0x5ea2a5[_0x4bce('0x7b')][_0x5e606b][_0x4bce('0x80')]));}}}if(_0x5ea2a5[_0x4bce('0x81')]){_0x5ea2a5['conditions']=JSON[_0x4bce('0x7c')](_0x5ea2a5[_0x4bce('0x81')]);_0x3916a3[_0x4bce('0x37')](_0x30a83a(_0x5ea2a5[_0x4bce('0x81')][_0x4bce('0x67')]));}_0x3846d1=_0x3916a3[_0x4bce('0x82')]();_0x3916a3[_0x4bce('0x1a')](_0x2f346c);_0x3916a3['offset'](0x0);logger['debug'](_0x4bce('0x83'),_0x3916a3['toString']());return dbH['sequelize']['query'](_0x3916a3[_0x4bce('0x84')](),{'type':dbH[_0x4bce('0x85')][_0x4bce('0x86')][_0x4bce('0x87')]});}})[_0x4bce('0x21')](function(){return{'sql':_0x3846d1[_0x4bce('0x84')]()};})[_0x4bce('0x21')](respondWithResult(_0x177167,null))[_0x4bce('0x41')](handleError(_0x177167,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index f226669..ec7a78b 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 _0xfc34=['define','analytics_custom_reports','lodash','util','api','bluebird','rimraf','../../config/environment','exports'];(function(_0x25e3d3,_0x1d2882){var _0x42ad83=function(_0x5f3010){while(--_0x5f3010){_0x25e3d3['push'](_0x25e3d3['shift']());}};_0x42ad83(++_0x1d2882);}(_0xfc34,0xad));var _0x4fc3=function(_0x41b8f9,_0x2e5a01){_0x41b8f9=_0x41b8f9-0x0;var _0x5145d1=_0xfc34[_0x41b8f9];return _0x5145d1;};'use strict';var _=require(_0x4fc3('0x0'));var util=require(_0x4fc3('0x1'));var logger=require('../../config/logger')(_0x4fc3('0x2'));var moment=require('moment');var BPromise=require(_0x4fc3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4fc3('0x4'));var config=require(_0x4fc3('0x5'));var attributes=require('./analyticCustomReport.attributes');module[_0x4fc3('0x6')]=function(_0x95678d,_0x2eea8a){return _0x95678d[_0x4fc3('0x7')]('AnalyticCustomReport',attributes,{'tableName':_0x4fc3('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54e4=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util'];(function(_0x3c73ad,_0x464b2c){var _0x54cdae=function(_0x22828a){while(--_0x22828a){_0x3c73ad['push'](_0x3c73ad['shift']());}};_0x54cdae(++_0x464b2c);}(_0x54e4,0x148));var _0x454e=function(_0x380f48,_0x141b3d){_0x380f48=_0x380f48-0x0;var _0x5f1056=_0x54e4[_0x380f48];return _0x5f1056;};'use strict';var _=require(_0x454e('0x0'));var util=require(_0x454e('0x1'));var logger=require(_0x454e('0x2'))(_0x454e('0x3'));var moment=require(_0x454e('0x4'));var BPromise=require(_0x454e('0x5'));var rp=require(_0x454e('0x6'));var fs=require('fs');var path=require(_0x454e('0x7'));var rimraf=require(_0x454e('0x8'));var config=require(_0x454e('0x9'));var attributes=require(_0x454e('0xa'));module[_0x454e('0xb')]=function(_0x138a6b,_0x307ef1){return _0x138a6b[_0x454e('0xc')](_0x454e('0xd'),attributes,{'tableName':_0x454e('0xe'),'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 033d76c..7f55b39 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 _0x3311=['request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticCustomReport,\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(_0x51606,_0x59cf50){var _0x2e7525=function(_0x4aa3e4){while(--_0x4aa3e4){_0x51606['push'](_0x51606['shift']());}};_0x2e7525(++_0x59cf50);}(_0x3311,0x128));var _0x1331=function(_0x328659,_0x5600f7){_0x328659=_0x328659-0x0;var _0xb33a95=_0x3311[_0x328659];return _0xb33a95;};'use strict';var _=require(_0x1331('0x0'));var util=require(_0x1331('0x1'));var moment=require(_0x1331('0x2'));var BPromise=require(_0x1331('0x3'));var rs=require(_0x1331('0x4'));var fs=require('fs');var Redis=require(_0x1331('0x5'));var db=require(_0x1331('0x6'))['db'];var utils=require(_0x1331('0x7'));var logger=require(_0x1331('0x8'))(_0x1331('0x9'));var config=require('../../config/environment');var jayson=require(_0x1331('0xa'));var client=jayson[_0x1331('0xb')][_0x1331('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x434f3b,_0x18b06a,_0x2f5f14){return new BPromise(function(_0x3fb5cb,_0x28fc3f){return client[_0x1331('0xd')](_0x434f3b,_0x2f5f14)[_0x1331('0xe')](function(_0x50b341){logger[_0x1331('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x18b06a,_0x1331('0x10'));logger['debug'](_0x1331('0x11'),_0x18b06a,'request\x20sent',JSON[_0x1331('0x12')](_0x50b341));if(_0x50b341[_0x1331('0x13')]){if(_0x50b341[_0x1331('0x13')]['code']===0x1f4){logger['error'](_0x1331('0x14'),_0x18b06a,_0x50b341[_0x1331('0x13')][_0x1331('0x15')]);return _0x28fc3f(_0x50b341[_0x1331('0x13')][_0x1331('0x15')]);}logger[_0x1331('0x13')](_0x1331('0x14'),_0x18b06a,_0x50b341['error'][_0x1331('0x15')]);return _0x3fb5cb(_0x50b341['error'][_0x1331('0x15')]);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x18b06a,_0x1331('0x10'));_0x3fb5cb(_0x50b341[_0x1331('0x16')]['message']);}})[_0x1331('0x17')](function(_0xdb9ea5){logger[_0x1331('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x18b06a,_0xdb9ea5);_0x28fc3f(_0xdb9ea5);});});} \ No newline at end of file +var _0x18f2=['jayson/promise','client','http','request','then','info','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','AnalyticCustomReport,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x18f2,0x10d));var _0x218f=function(_0x3b72c3,_0x5194dc){_0x3b72c3=_0x3b72c3-0x0;var _0x103b68=_0x18f2[_0x3b72c3];return _0x103b68;};'use strict';var _=require(_0x218f('0x0'));var util=require(_0x218f('0x1'));var moment=require(_0x218f('0x2'));var BPromise=require('bluebird');var rs=require(_0x218f('0x3'));var fs=require('fs');var Redis=require(_0x218f('0x4'));var db=require(_0x218f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x218f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x218f('0x7'));var client=jayson[_0x218f('0x8')][_0x218f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x572755,_0x1658a4,_0x57119b){return new BPromise(function(_0x5d33e8,_0x2f4ff3){return client[_0x218f('0xa')](_0x572755,_0x57119b)[_0x218f('0xb')](function(_0x59b514){logger[_0x218f('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1658a4,'request\x20sent');logger[_0x218f('0xd')](_0x218f('0xe'),_0x1658a4,_0x218f('0xf'),JSON[_0x218f('0x10')](_0x59b514));if(_0x59b514[_0x218f('0x11')]){if(_0x59b514[_0x218f('0x11')][_0x218f('0x12')]===0x1f4){logger[_0x218f('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1658a4,_0x59b514[_0x218f('0x11')][_0x218f('0x13')]);return _0x2f4ff3(_0x59b514[_0x218f('0x11')]['message']);}logger[_0x218f('0x11')](_0x218f('0x14'),_0x1658a4,_0x59b514[_0x218f('0x11')][_0x218f('0x13')]);return _0x5d33e8(_0x59b514[_0x218f('0x11')][_0x218f('0x13')]);}else{logger[_0x218f('0xc')](_0x218f('0x14'),_0x1658a4,'request\x20sent');_0x5d33e8(_0x59b514[_0x218f('0x15')][_0x218f('0x13')]);}})[_0x218f('0x16')](function(_0x3be502){logger[_0x218f('0x11')](_0x218f('0x14'),_0x1658a4,_0x3be502);_0x2f4ff3(_0x3be502);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index cf98d53..6d02f4c 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 _0x6194=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/preview','preview','/:id/run','run','/:id/query','post','create','put','update','delete','destroy'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x6194,0x191));var _0x4619=function(_0x4db0d0,_0x432908){_0x4db0d0=_0x4db0d0-0x0;var _0x3b688a=_0x6194[_0x4db0d0];return _0x3b688a;};'use strict';var multer=require(_0x4619('0x0'));var util=require(_0x4619('0x1'));var path=require(_0x4619('0x2'));var timeout=require(_0x4619('0x3'));var express=require(_0x4619('0x4'));var router=express[_0x4619('0x5')]();var fs_extra=require(_0x4619('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4619('0x7'));var config=require(_0x4619('0x8'));var controller=require('./analyticCustomReport.controller');router[_0x4619('0x9')]('/',auth['isAuthenticated'](),controller[_0x4619('0xa')]);router['get'](_0x4619('0xb'),auth[_0x4619('0xc')](),controller['show']);router[_0x4619('0x9')](_0x4619('0xd'),auth[_0x4619('0xc')](),controller[_0x4619('0xe')]);router['get'](_0x4619('0xf'),auth['isAuthenticated'](),controller[_0x4619('0x10')]);router[_0x4619('0x9')](_0x4619('0x11'),auth[_0x4619('0xc')](),controller['query']);router[_0x4619('0x12')]('/',auth[_0x4619('0xc')](),controller[_0x4619('0x13')]);router[_0x4619('0x14')](_0x4619('0xb'),auth['isAuthenticated'](),controller[_0x4619('0x15')]);router[_0x4619('0x16')](_0x4619('0xb'),auth[_0x4619('0xc')](),controller[_0x4619('0x17')]);module[_0x4619('0x18')]=router; \ No newline at end of file +var _0x73ec=['show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id'];(function(_0x4e69d1,_0x437faf){var _0x357689=function(_0xf778a7){while(--_0xf778a7){_0x4e69d1['push'](_0x4e69d1['shift']());}};_0x357689(++_0x437faf);}(_0x73ec,0x1a2));var _0xc73e=function(_0x5af94a,_0x204822){_0x5af94a=_0x5af94a-0x0;var _0x4a5254=_0x73ec[_0x5af94a];return _0x4a5254;};'use strict';var multer=require(_0xc73e('0x0'));var util=require(_0xc73e('0x1'));var path=require(_0xc73e('0x2'));var timeout=require(_0xc73e('0x3'));var express=require(_0xc73e('0x4'));var router=express[_0xc73e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc73e('0x6'));var interaction=require(_0xc73e('0x7'));var config=require(_0xc73e('0x8'));var controller=require(_0xc73e('0x9'));router[_0xc73e('0xa')]('/',auth[_0xc73e('0xb')](),controller[_0xc73e('0xc')]);router['get'](_0xc73e('0xd'),auth['isAuthenticated'](),controller[_0xc73e('0xe')]);router[_0xc73e('0xa')](_0xc73e('0xf'),auth[_0xc73e('0xb')](),controller[_0xc73e('0x10')]);router['get'](_0xc73e('0x11'),auth[_0xc73e('0xb')](),controller[_0xc73e('0x12')]);router[_0xc73e('0xa')](_0xc73e('0x13'),auth[_0xc73e('0xb')](),controller[_0xc73e('0x14')]);router[_0xc73e('0x15')]('/',auth['isAuthenticated'](),controller[_0xc73e('0x16')]);router['put'](_0xc73e('0xd'),auth['isAuthenticated'](),controller[_0xc73e('0x17')]);router[_0xc73e('0x18')](_0xc73e('0xd'),auth[_0xc73e('0xb')](),controller[_0xc73e('0x19')]);module[_0xc73e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 984a0f6..7ac020b 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 _0xabce=['exports','STRING','TEXT','sequelize'];(function(_0x2dfb83,_0x3ae366){var _0x29dd15=function(_0x800e33){while(--_0x800e33){_0x2dfb83['push'](_0x2dfb83['shift']());}};_0x29dd15(++_0x3ae366);}(_0xabce,0x103));var _0xeabc=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xabce[_0x220dbb];return _0x2b77de;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'name':{'type':Sequelize[_0xeabc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xeabc('0x2')]},'parent':{'type':Sequelize[_0xeabc('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xeabc('0x3')]}}; \ No newline at end of file +var _0xe14b=['exports','STRING','TEXT','sequelize'];(function(_0x13af96,_0x229847){var _0x2627b8=function(_0x349826){while(--_0x349826){_0x13af96['push'](_0x13af96['shift']());}};_0x2627b8(++_0x229847);}(_0xe14b,0x93));var _0xbe14=function(_0x4b2d14,_0x198792){_0x4b2d14=_0x4b2d14-0x0;var _0xabf1bf=_0xe14b[_0x4b2d14];return _0xabf1bf;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xbe14('0x2')]},'table':{'type':Sequelize[_0xbe14('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbe14('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index f2db3b5..fe43649 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 _0xdbf5=['includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','function','replace','format','groupBy','orderBy','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','debug','Limited\x20Query:','toString','SELECT','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','IS\x20EMPTY','ValidationErrorItem','metric','DESC','clone','output','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','cdr','startDate','endDate','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','sequelize','QueryTypes','run','Sequelize','rimraf','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/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','end','status','json','limit','undefined','count','set','Content-Range','reject','save','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','catch','update','join','left_join','right_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x533ea7,_0x559b2e){_0x533ea7=_0x533ea7-0x0;var _0x30f9af=_0xdbf5[_0x533ea7];return _0x30f9af;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];var dbH=require(_0x5dbf('0x16'))[_0x5dbf('0x17')];function respondWithStatusCode(_0x1453a9,_0x7cb848){_0x7cb848=_0x7cb848||0xcc;return function(_0x14493a){if(_0x14493a){return _0x1453a9['sendStatus'](_0x7cb848);}return _0x1453a9['status'](_0x7cb848)[_0x5dbf('0x18')]();};}function respondWithResult(_0x3480c8,_0x48e7fd){_0x48e7fd=_0x48e7fd||0xc8;return function(_0x19624e){if(_0x19624e){return _0x3480c8[_0x5dbf('0x19')](_0x48e7fd)[_0x5dbf('0x1a')](_0x19624e);}};}function respondWithFilteredResult(_0x2dfa44,_0x181816){return function(_0x472eb9){if(_0x472eb9){var _0x2d32cc=typeof _0x181816['offset']==='undefined'&&typeof _0x181816[_0x5dbf('0x1b')]===_0x5dbf('0x1c');var _0x39c7aa=_0x472eb9[_0x5dbf('0x1d')];var _0x20c2b0=_0x2d32cc?0x0:_0x181816['offset'];var _0x11cd00=_0x2d32cc?_0x472eb9['count']:_0x181816['offset']+_0x181816['limit'];var _0x23d1e7;if(_0x11cd00>=_0x39c7aa){_0x11cd00=_0x39c7aa;_0x23d1e7=0xc8;}else{_0x23d1e7=0xce;}_0x2dfa44[_0x5dbf('0x19')](_0x23d1e7);return _0x2dfa44[_0x5dbf('0x1e')](_0x5dbf('0x1f'),_0x20c2b0+'-'+_0x11cd00+'/'+_0x39c7aa)[_0x5dbf('0x1a')](_0x472eb9);}return null;};}function patchUpdates(_0x5b2518){return function(_0x2764ea){try{jsonpatch['apply'](_0x2764ea,_0x5b2518,!![]);}catch(_0xb68f92){return BPromise[_0x5dbf('0x20')](_0xb68f92);}return _0x2764ea[_0x5dbf('0x21')]();};}function saveUpdates(_0x43a612,_0x3b763c){return function(_0x2f154e){if(_0x2f154e){return _0x2f154e['update'](_0x43a612)[_0x5dbf('0x22')](function(_0x3e3a2d){return _0x3e3a2d;});}return null;};}function removeEntity(_0x2d3e1b,_0x2079fc){return function(_0x2763ec){if(_0x2763ec){return _0x2763ec[_0x5dbf('0x23')]()[_0x5dbf('0x22')](function(){var _0x20ab1b=_0x2763ec[_0x5dbf('0x24')]({'plain':!![]});var _0x15a790=_0x5dbf('0x25');return db[_0x5dbf('0x26')][_0x5dbf('0x23')]({'where':{'type':_0x15a790,'resourceId':_0x20ab1b['id']}})[_0x5dbf('0x22')](function(){return _0x2763ec;});})[_0x5dbf('0x22')](function(){_0x2d3e1b[_0x5dbf('0x19')](0xcc)[_0x5dbf('0x18')]();});}};}function handleEntityNotFound(_0x3f8341,_0x159e61){return function(_0x22ec42){if(!_0x22ec42){_0x3f8341[_0x5dbf('0x27')](0x194);}return _0x22ec42;};}function handleError(_0x471027,_0x21cd00){_0x21cd00=_0x21cd00||0x1f4;return function(_0x5768b7){logger[_0x5dbf('0x28')](_0x5768b7[_0x5dbf('0x29')]);if(_0x5768b7[_0x5dbf('0x2a')]){delete _0x5768b7[_0x5dbf('0x2a')];}_0x471027[_0x5dbf('0x19')](_0x21cd00)[_0x5dbf('0x2b')](_0x5768b7);};}exports[_0x5dbf('0x2c')]=function(_0x31d57a,_0x406ce6){var _0x273b63={},_0x294dd7={},_0x50a307={'count':0x0,'rows':[]};var _0x4c1587=_[_0x5dbf('0x2d')](db[_0x5dbf('0x2e')][_0x5dbf('0x2f')],function(_0x3b73ad){return{'name':_0x3b73ad[_0x5dbf('0x30')],'type':_0x3b73ad['type']['key']};});_0x294dd7[_0x5dbf('0x31')]=_[_0x5dbf('0x2d')](_0x4c1587,'name');_0x294dd7[_0x5dbf('0x32')]=_[_0x5dbf('0x33')](_0x31d57a[_0x5dbf('0x32')]);_0x294dd7[_0x5dbf('0x34')]=_[_0x5dbf('0x35')](_0x294dd7['model'],_0x294dd7[_0x5dbf('0x32')]);_0x273b63[_0x5dbf('0x36')]=_[_0x5dbf('0x35')](_0x294dd7[_0x5dbf('0x31')],qs[_0x5dbf('0x37')](_0x31d57a['query'][_0x5dbf('0x37')]));_0x273b63[_0x5dbf('0x36')]=_0x273b63[_0x5dbf('0x36')][_0x5dbf('0x38')]?_0x273b63['attributes']:_0x294dd7[_0x5dbf('0x31')];if(!_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x39')](_0x5dbf('0x3a'))){_0x273b63[_0x5dbf('0x1b')]=qs[_0x5dbf('0x1b')](_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x1b')]);_0x273b63[_0x5dbf('0x3b')]=qs[_0x5dbf('0x3b')](_0x31d57a[_0x5dbf('0x32')]['offset']);}_0x273b63[_0x5dbf('0x3c')]=qs[_0x5dbf('0x3d')](_0x31d57a[_0x5dbf('0x32')]['sort']);_0x273b63[_0x5dbf('0x3e')]=qs[_0x5dbf('0x34')](_[_0x5dbf('0x3f')](_0x31d57a['query'],_0x294dd7[_0x5dbf('0x34')]),_0x4c1587);if(_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x40')]){_0x273b63['where']=_[_0x5dbf('0x41')](_0x273b63[_0x5dbf('0x3e')],{'$or':_[_0x5dbf('0x2d')](_0x4c1587,function(_0x260c9f){if(_0x260c9f[_0x5dbf('0x42')]!==_0x5dbf('0x43')){var _0x321ae3={};_0x321ae3[_0x260c9f[_0x5dbf('0x2a')]]={'$like':'%'+_0x31d57a['query']['filter']+'%'};return _0x321ae3;}})});}_0x273b63=_['merge']({},_0x273b63,_0x31d57a['options']);var _0x28b28f={'where':_0x273b63[_0x5dbf('0x3e')]};return db['AnalyticDefaultReport'][_0x5dbf('0x1d')](_0x28b28f)[_0x5dbf('0x22')](function(_0x5a60e8){_0x50a307[_0x5dbf('0x1d')]=_0x5a60e8;if(_0x31d57a[_0x5dbf('0x32')][_0x5dbf('0x44')]){_0x273b63[_0x5dbf('0x45')]=[{'all':!![]}];}return db[_0x5dbf('0x2e')][_0x5dbf('0x46')](_0x273b63);})[_0x5dbf('0x22')](function(_0x1c020a){_0x50a307[_0x5dbf('0x47')]=_0x1c020a;return _0x50a307;})[_0x5dbf('0x22')](respondWithFilteredResult(_0x406ce6,_0x273b63))['catch'](handleError(_0x406ce6,null));};exports[_0x5dbf('0x48')]=function(_0x22f958,_0xec1d28){var _0x50880d={'raw':!![],'where':{'id':_0x22f958[_0x5dbf('0x49')]['id']}},_0x16b0ff={};_0x16b0ff[_0x5dbf('0x31')]=_[_0x5dbf('0x33')](db['AnalyticDefaultReport'][_0x5dbf('0x2f')]);_0x16b0ff['query']=_[_0x5dbf('0x33')](_0x22f958[_0x5dbf('0x32')]);_0x16b0ff[_0x5dbf('0x34')]=_[_0x5dbf('0x35')](_0x16b0ff['model'],_0x16b0ff['query']);_0x50880d[_0x5dbf('0x36')]=_[_0x5dbf('0x35')](_0x16b0ff[_0x5dbf('0x31')],qs['fields'](_0x22f958[_0x5dbf('0x32')]['fields']));_0x50880d['attributes']=_0x50880d['attributes']['length']?_0x50880d[_0x5dbf('0x36')]:_0x16b0ff[_0x5dbf('0x31')];if(_0x22f958['query'][_0x5dbf('0x44')]){_0x50880d[_0x5dbf('0x45')]=[{'all':!![]}];}_0x50880d=_['merge']({},_0x50880d,_0x22f958[_0x5dbf('0x4a')]);return db[_0x5dbf('0x2e')]['find'](_0x50880d)[_0x5dbf('0x22')](handleEntityNotFound(_0xec1d28,null))['then'](respondWithResult(_0xec1d28,null))['catch'](handleError(_0xec1d28,null));};exports[_0x5dbf('0x4b')]=function(_0x2a3d30,_0x17a1c0){return db['AnalyticDefaultReport']['create'](_0x2a3d30[_0x5dbf('0x4c')],{})[_0x5dbf('0x22')](function(_0x21f477){var _0x307a00=_0x2a3d30[_0x5dbf('0x4d')][_0x5dbf('0x24')]({'plain':!![]});if(!_0x307a00)throw new Error(_0x5dbf('0x4e'));if(_0x307a00[_0x5dbf('0x4f')]==='user'){var _0x3f38a0=_0x21f477[_0x5dbf('0x24')]({'plain':!![]});var _0x2927a3=_0x5dbf('0x50');return db[_0x5dbf('0x51')][_0x5dbf('0x52')]({'where':{'name':_0x2927a3,'userProfileId':_0x307a00[_0x5dbf('0x53')]},'raw':!![]})['then'](function(_0x1b0b13){if(_0x1b0b13&&_0x1b0b13['autoAssociation']===0x0){return db[_0x5dbf('0x26')][_0x5dbf('0x4b')]({'name':_0x3f38a0[_0x5dbf('0x2a')],'resourceId':_0x3f38a0['id'],'type':_0x5dbf('0x25'),'sectionId':_0x1b0b13['id']},{})[_0x5dbf('0x22')](function(){return _0x21f477;});}else{return _0x21f477;}})[_0x5dbf('0x54')](function(_0x353d0f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x353d0f);throw _0x353d0f;});}return _0x21f477;})['then'](respondWithResult(_0x17a1c0,0xc9))[_0x5dbf('0x54')](handleError(_0x17a1c0,null));};exports[_0x5dbf('0x55')]=function(_0x36a787,_0x56c8b2){if(_0x36a787['body']['id']){delete _0x36a787[_0x5dbf('0x4c')]['id'];}return db[_0x5dbf('0x2e')][_0x5dbf('0x52')]({'where':{'id':_0x36a787['params']['id']}})[_0x5dbf('0x22')](handleEntityNotFound(_0x56c8b2,null))['then'](saveUpdates(_0x36a787[_0x5dbf('0x4c')],null))[_0x5dbf('0x22')](respondWithResult(_0x56c8b2,null))[_0x5dbf('0x54')](handleError(_0x56c8b2,null));};exports['destroy']=function(_0x55fd51,_0x1b316d){return db[_0x5dbf('0x2e')][_0x5dbf('0x52')]({'where':{'id':_0x55fd51[_0x5dbf('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b316d,null))[_0x5dbf('0x22')](removeEntity(_0x1b316d,null))[_0x5dbf('0x54')](handleError(_0x1b316d,null));};exports['preview']=function(_0x5485f3,_0x19ec03){var _0x14bdb1=0xa;var _0x197e8c=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),'cross_join'];var _0x4107f1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5dbf('0x59'),'MIN':'MIN(%s)','AVG':_0x5dbf('0x5a'),'GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':_0x5dbf('0x5c'),'GROUP_CONCAT DESC':_0x5dbf('0x5d')};var _0x461ffb={'SEC_TO_TIME':_0x5dbf('0x5e'),'DATE':_0x5dbf('0x5f'),'HOUR':_0x5dbf('0x60'),'ROUND':_0x5dbf('0x61'),'UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x3a84c2=function(_0x2ca889){return!_[_0x5dbf('0x63')]([_0x5dbf('0x64'),_0x5dbf('0x65'),'IS\x20EMPTY',_0x5dbf('0x66')],_0x2ca889);};var _0x553be4=function(_0xb0a9bf){if(!_0xb0a9bf||!_0xb0a9bf[_0x5dbf('0x67')][_0x5dbf('0x38')]){return'';}for(var _0x110224='(',_0x5a975a=0x0;_0x5a975a<_0xb0a9bf[_0x5dbf('0x67')][_0x5dbf('0x38')];_0x5a975a+=0x1){_0x5a975a>0x0&&(_0x110224+='\x20'+_0xb0a9bf[_0x5dbf('0x68')]+'\x20');_0x110224+=_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x69')]?_0x553be4(_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a]['group']):_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6a')]+'\x20'+_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6b')]+(_0x3a84c2(_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6b')])?'\x20'+_0xb0a9bf[_0x5dbf('0x67')][_0x5a975a][_0x5dbf('0x6c')]:'');}return _0x110224+')';};var _0x12d69b={'where':{'id':_0x5485f3[_0x5dbf('0x49')]['id']}},_0x3b53da,_0x13c8ab,_0x2997a8,_0x5d7a37,_0x52109d;_0x12d69b=_[_0x5dbf('0x41')]({},_0x12d69b,_0x5485f3[_0x5dbf('0x4a')]);return db[_0x5dbf('0x2e')][_0x5dbf('0x52')](_0x12d69b)[_0x5dbf('0x22')](function(_0x1b42cf){if(_0x1b42cf){_0x3b53da=_0x1b42cf;return _0x1b42cf[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x57c568){if(_0x57c568){if(!_0x57c568['length']){throw new db['Sequelize']['ValidationErrorItem'](_0x5dbf('0x6e'),0x193);}_0x13c8ab=_0x57c568;return db[_0x5dbf('0x6f')][_0x5dbf('0x46')]({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x29c4d9){if(_0x29c4d9){_0x2997a8=_[_0x5dbf('0x70')](_0x29c4d9,'id');var _0x5331ff;var _0x5bb990=squel[_0x5dbf('0x71')]();_0x5bb990[_0x5dbf('0x72')](_0x3b53da['table']);for(var _0x1728b9=0x0;_0x1728b9<_0x13c8ab[_0x5dbf('0x38')];_0x1728b9+=0x1){_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x73')]?_0x2997a8[_0x13c8ab[_0x1728b9][_0x5dbf('0x73')]]['metric']:_0x13c8ab[_0x1728b9][_0x5dbf('0x6a')];_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x4107f1[_0x13c8ab[_0x1728b9][_0x5dbf('0x74')]],'%s',_0x5331ff):_0x5331ff;_0x5331ff=_0x13c8ab[_0x1728b9][_0x5dbf('0x76')]?_['replace'](_0x461ffb[_0x13c8ab[_0x1728b9][_0x5dbf('0x76')]],'%s',_0x5331ff):_0x5331ff;if(_0x13c8ab[_0x1728b9][_0x5dbf('0x77')]){_0x5bb990[_0x5dbf('0x69')](_0x5331ff);}_0x13c8ab[_0x1728b9][_0x5dbf('0x78')]&&_0x5bb990['order'](_0x5331ff,_0x13c8ab[_0x1728b9][_0x5dbf('0x78')]==='DESC'?![]:!![]);_0x5bb990[_0x5dbf('0x6a')](_0x5331ff,_0x13c8ab[_0x1728b9][_0x5dbf('0x79')]||_0x5331ff);}if(_0x3b53da[_0x5dbf('0x7a')]){_0x3b53da['joins']=JSON[_0x5dbf('0x7b')](_0x3b53da[_0x5dbf('0x7a')]);for(var _0x4166ce=0x0;_0x4166ce<_0x3b53da[_0x5dbf('0x7a')]['length'];_0x4166ce+=0x1){if(_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x197e8c,_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')])&&_0x3b53da[_0x5dbf('0x7a')][_0x4166ce]['parentKey']&&_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')]&&_0x3b53da['joins'][_0x4166ce][_0x5dbf('0x7d')]){_0x5bb990[_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x42')]](_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')],null,util[_0x5dbf('0x76')](_0x5dbf('0x7e'),_0x3b53da[_0x5dbf('0x7f')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x80')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7c')],_0x3b53da[_0x5dbf('0x7a')][_0x4166ce][_0x5dbf('0x7d')]));}}}if(_0x3b53da[_0x5dbf('0x81')]){_0x3b53da[_0x5dbf('0x81')]=JSON['parse'](_0x3b53da[_0x5dbf('0x81')]);_0x5bb990[_0x5dbf('0x3e')](_0x553be4(_0x3b53da[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0x52109d=_0x5bb990['clone']();_0x5bb990[_0x5dbf('0x1b')](_0x14bdb1);_0x5bb990[_0x5dbf('0x3b')](0x0);logger[_0x5dbf('0x82')](_0x5dbf('0x83'),_0x5bb990[_0x5dbf('0x84')]());return dbH['sequelize'][_0x5dbf('0x32')](_0x5bb990[_0x5dbf('0x84')](),{'type':dbH['sequelize']['QueryTypes'][_0x5dbf('0x85')]});}})[_0x5dbf('0x22')](respondWithResult(_0x19ec03,null))[_0x5dbf('0x54')](handleError(_0x19ec03,null));};function runReport(_0x8ca7de,_0x14b21b,_0x23ec75){var _0x22339b=_0x14b21b['name'];var _0x310078=0xa;var _0x3b01c0=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),_0x5dbf('0x86')];var _0x4cceb1={'SUM':_0x5dbf('0x87'),'COUNT':_0x5dbf('0x88'),'COUNT DISTINCT':_0x5dbf('0x89'),'MAX':_0x5dbf('0x59'),'MIN':_0x5dbf('0x8a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5924d2={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5dbf('0x5f'),'HOUR':_0x5dbf('0x60'),'ROUND':_0x5dbf('0x61'),'UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x4333db=function(_0x4cb92d){return!_['includes']([_0x5dbf('0x64'),'IS\x20NOT\x20NULL',_0x5dbf('0x8b'),_0x5dbf('0x66')],_0x4cb92d);};var _0x541241=function(_0x3c7eaa){if(!_0x3c7eaa||!_0x3c7eaa['rules'][_0x5dbf('0x38')]){return'';}for(var _0x24d90a='(',_0xa3e94f=0x0;_0xa3e94f<_0x3c7eaa[_0x5dbf('0x67')][_0x5dbf('0x38')];_0xa3e94f+=0x1){_0xa3e94f>0x0&&(_0x24d90a+='\x20'+_0x3c7eaa['operator']+'\x20');_0x24d90a+=_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x69')]?_0x541241(_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x69')]):_0x3c7eaa['rules'][_0xa3e94f][_0x5dbf('0x6a')]+'\x20'+_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6b')]+(_0x4333db(_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6b')])?'\x20'+_0x3c7eaa[_0x5dbf('0x67')][_0xa3e94f][_0x5dbf('0x6c')]:'');}return _0x24d90a+')';};var _0x334f63={'where':{'id':_0x8ca7de['id']}},_0x5ac29f,_0x533fdd,_0x5bf068,_0x1bd06b,_0x274497;_0x334f63=_['merge']({},_0x334f63,_0x23ec75);return db['AnalyticDefaultReport']['find'](_0x334f63)[_0x5dbf('0x22')](function(_0x20bda9){if(_0x20bda9){_0x5ac29f=_0x20bda9;return _0x20bda9[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x12757d){if(_0x12757d){if(!_0x12757d[_0x5dbf('0x38')]){throw new db['Sequelize'][(_0x5dbf('0x8c'))](_0x5dbf('0x6e'),0x193);}_0x533fdd=_0x12757d;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x5722b3){if(_0x5722b3){_0x5bf068=_['keyBy'](_0x5722b3,'id');var _0x3a27c4;var _0x3620d2=squel[_0x5dbf('0x71')]();_0x3620d2['from'](_0x5ac29f[_0x5dbf('0x7f')]);for(var _0x447259=0x0;_0x447259<_0x533fdd['length'];_0x447259+=0x1){_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x73')]?_0x5bf068[_0x533fdd[_0x447259][_0x5dbf('0x73')]][_0x5dbf('0x8d')]:_0x533fdd[_0x447259][_0x5dbf('0x6a')];_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x4cceb1[_0x533fdd[_0x447259][_0x5dbf('0x74')]],'%s',_0x3a27c4):_0x3a27c4;_0x3a27c4=_0x533fdd[_0x447259][_0x5dbf('0x76')]?_['replace'](_0x5924d2[_0x533fdd[_0x447259]['format']],'%s',_0x3a27c4):_0x3a27c4;if(_0x533fdd[_0x447259]['groupBy']){_0x3620d2[_0x5dbf('0x69')](_0x3a27c4);}_0x533fdd[_0x447259][_0x5dbf('0x78')]&&_0x3620d2[_0x5dbf('0x3c')](_0x3a27c4,_0x533fdd[_0x447259][_0x5dbf('0x78')]===_0x5dbf('0x8e')?![]:!![]);_0x3620d2[_0x5dbf('0x6a')](_0x3a27c4,_0x533fdd[_0x447259][_0x5dbf('0x79')]||_0x3a27c4);}if(_0x5ac29f[_0x5dbf('0x7a')]){_0x5ac29f[_0x5dbf('0x7a')]=JSON[_0x5dbf('0x7b')](_0x5ac29f['joins']);for(var _0x2ded2b=0x0;_0x2ded2b<_0x5ac29f[_0x5dbf('0x7a')][_0x5dbf('0x38')];_0x2ded2b+=0x1){if(_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x3b01c0,_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x42')])&&_0x5ac29f['joins'][_0x2ded2b]['parentKey']&&_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b]['foreignTable']&&_0x5ac29f['joins'][_0x2ded2b][_0x5dbf('0x7d')]){_0x3620d2[_0x5ac29f['joins'][_0x2ded2b]['type']](_0x5ac29f['joins'][_0x2ded2b]['foreignTable'],null,util[_0x5dbf('0x76')]('%s.%s\x20=\x20%s.%s',_0x5ac29f[_0x5dbf('0x7f')],_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x80')],_0x5ac29f['joins'][_0x2ded2b][_0x5dbf('0x7c')],_0x5ac29f[_0x5dbf('0x7a')][_0x2ded2b][_0x5dbf('0x7d')]));}}}if(_0x5ac29f['conditions']){_0x5ac29f[_0x5dbf('0x81')]=JSON[_0x5dbf('0x7b')](_0x5ac29f[_0x5dbf('0x81')]);_0x3620d2['where'](_0x541241(_0x5ac29f[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0x274497=_0x3620d2[_0x5dbf('0x8f')]();_0x3620d2['limit'](_0x310078);_0x3620d2[_0x5dbf('0x3b')](0x0);return;}})[_0x5dbf('0x22')](function(){if(_0x14b21b[_0x5dbf('0x90')]==='web'){return null;}var _0x48a8c5=_['merge'](_0x14b21b,{'name':_0x14b21b[_0x5dbf('0x91')]||_0x14b21b[_0x5dbf('0x2a')]||_0x5ac29f[_0x5dbf('0x2a')],'basename':_0x22339b,'savename':util[_0x5dbf('0x76')](_0x5dbf('0x92'),_0x14b21b[_0x5dbf('0x2a')]||_0x5ac29f['name'],require(_0x5dbf('0x93'))[_0x5dbf('0x94')](0x4),_0x14b21b[_0x5dbf('0x90')]||'csv'),'reportId':_0x5ac29f['id'],'reportType':_0x5dbf('0x95')});return db[_0x5dbf('0x96')][_0x5dbf('0x4b')](_0x48a8c5,{'raw':!![]});})[_0x5dbf('0x22')](function(_0x2afbd4){if(_0x5ac29f[_0x5dbf('0x7f')]===_0x5dbf('0x97')){_0x274497['where'](_0x5ac29f[_0x5dbf('0x7f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x14b21b[_0x5dbf('0x98')],_0x14b21b[_0x5dbf('0x99')]);}else{_0x274497[_0x5dbf('0x3e')](_0x5ac29f['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x14b21b['startDate'],_0x14b21b[_0x5dbf('0x99')]);}if(_0x2afbd4){logger[_0x5dbf('0x9a')]('Run\x20Query:',_0x274497[_0x5dbf('0x84')]());require('child_process')[_0x5dbf('0x9b')](path[_0x5dbf('0x56')](__dirname,_0x5dbf('0x9c'),_0x2afbd4['output']),[_0x2afbd4['id'],_0x274497[_0x5dbf('0x84')](),path[_0x5dbf('0x56')](__dirname,_0x5dbf('0x9d'),_0x2afbd4[_0x5dbf('0x9e')]),_0x22339b]);return _0x2afbd4;}else{var _0x4bc5af=squel[_0x5dbf('0x71')]();_0x4bc5af[_0x5dbf('0x72')]('('+_0x274497['toString']()+')',_0x5dbf('0x9f'));_0x4bc5af['field'](_0x5dbf('0xa0'),_0x5dbf('0x1d'));_0x274497[_0x5dbf('0x1b')](_0x14b21b['limit']||_0x310078);_0x274497[_0x5dbf('0x3b')](_0x14b21b[_0x5dbf('0x3b')]||0x0);return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x4bc5af[_0x5dbf('0x84')](),{'type':dbH[_0x5dbf('0xa1')]['QueryTypes'][_0x5dbf('0x85')]})['then'](function(_0x6cfb82){if(!_0x6cfb82[_0x5dbf('0x38')]){_0x1bd06b=0x0;}else{_0x1bd06b=_0x6cfb82[0x0][_0x5dbf('0x1d')]||0x0;}return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x274497[_0x5dbf('0x84')](),{'type':dbH['sequelize'][_0x5dbf('0xa2')][_0x5dbf('0x85')]});})[_0x5dbf('0x22')](function(_0x4d68f6){return{'rows':_0x4d68f6||[],'count':_0x1bd06b};});}});}exports[_0x5dbf('0xa3')]=function(_0x47ac95,_0x51b241){return runReport(_0x47ac95[_0x5dbf('0x49')],_0x47ac95[_0x5dbf('0x32')],_0x47ac95[_0x5dbf('0x4a')])[_0x5dbf('0x22')](respondWithResult(_0x51b241,null))[_0x5dbf('0x54')](handleError(_0x51b241,null));};exports['runReport']=runReport;exports['query']=function(_0x4f38a0,_0x144300){var _0x1da1e3=0xa;var _0x25e681=[_0x5dbf('0x56'),_0x5dbf('0x57'),_0x5dbf('0x58'),_0x5dbf('0x86')];var _0x236754={'SUM':'SUM(%s)','COUNT':_0x5dbf('0x88'),'COUNT DISTINCT':_0x5dbf('0x89'),'MAX':_0x5dbf('0x59'),'MIN':_0x5dbf('0x8a'),'AVG':_0x5dbf('0x5a'),'GROUP_CONCAT':_0x5dbf('0x5b'),'GROUP_CONCAT ASC':_0x5dbf('0x5c'),'GROUP_CONCAT DESC':_0x5dbf('0x5d')};var _0x191a16={'SEC_TO_TIME':_0x5dbf('0x5e'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5dbf('0x62')};var _0x51b0df=function(_0x48ea8a){return!_['includes']([_0x5dbf('0x64'),_0x5dbf('0x65'),_0x5dbf('0x8b'),_0x5dbf('0x66')],_0x48ea8a);};var _0x3de263=function(_0x4f8dde){if(!_0x4f8dde||!_0x4f8dde[_0x5dbf('0x67')][_0x5dbf('0x38')]){return'';}for(var _0x19effa='(',_0x29177e=0x0;_0x29177e<_0x4f8dde[_0x5dbf('0x67')]['length'];_0x29177e+=0x1){_0x29177e>0x0&&(_0x19effa+='\x20'+_0x4f8dde[_0x5dbf('0x68')]+'\x20');_0x19effa+=_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x69')]?_0x3de263(_0x4f8dde[_0x5dbf('0x67')][_0x29177e]['group']):_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6a')]+'\x20'+_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6b')]+(_0x51b0df(_0x4f8dde[_0x5dbf('0x67')][_0x29177e][_0x5dbf('0x6b')])?'\x20'+_0x4f8dde[_0x5dbf('0x67')][_0x29177e]['value']:'');}return _0x19effa+')';};var _0x4899ac={'where':{'id':_0x4f38a0['params']['id']}},_0x51864c,_0x4562a4,_0x240304,_0x5df275,_0xc588a2;_0x4899ac=_[_0x5dbf('0x41')]({},_0x4899ac,_0x4f38a0['options']);return db[_0x5dbf('0x2e')][_0x5dbf('0x52')](_0x4899ac)[_0x5dbf('0x22')](function(_0x2eafe0){if(_0x2eafe0){_0x51864c=_0x2eafe0;return _0x2eafe0[_0x5dbf('0x6d')]();}return null;})[_0x5dbf('0x22')](function(_0x414859){if(_0x414859){if(!_0x414859['length']){throw new db[(_0x5dbf('0xa4'))][(_0x5dbf('0x8c'))](_0x5dbf('0x6e'),0x193);}_0x4562a4=_0x414859;return db[_0x5dbf('0x6f')][_0x5dbf('0x46')]({'raw':!![]});}return null;})[_0x5dbf('0x22')](function(_0x153401){if(_0x153401){_0x240304=_[_0x5dbf('0x70')](_0x153401,'id');var _0xbe0ca0;var _0x521c72=squel[_0x5dbf('0x71')]();_0x521c72[_0x5dbf('0x72')](_0x51864c[_0x5dbf('0x7f')]);for(var _0x6b4262=0x0;_0x6b4262<_0x4562a4[_0x5dbf('0x38')];_0x6b4262+=0x1){_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x73')]?_0x240304[_0x4562a4[_0x6b4262][_0x5dbf('0x73')]][_0x5dbf('0x8d')]:_0x4562a4[_0x6b4262][_0x5dbf('0x6a')];_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x74')]?_[_0x5dbf('0x75')](_0x236754[_0x4562a4[_0x6b4262][_0x5dbf('0x74')]],'%s',_0xbe0ca0):_0xbe0ca0;_0xbe0ca0=_0x4562a4[_0x6b4262][_0x5dbf('0x76')]?_[_0x5dbf('0x75')](_0x191a16[_0x4562a4[_0x6b4262][_0x5dbf('0x76')]],'%s',_0xbe0ca0):_0xbe0ca0;if(_0x4562a4[_0x6b4262][_0x5dbf('0x77')]){_0x521c72[_0x5dbf('0x69')](_0xbe0ca0);}_0x4562a4[_0x6b4262][_0x5dbf('0x78')]&&_0x521c72[_0x5dbf('0x3c')](_0xbe0ca0,_0x4562a4[_0x6b4262]['orderBy']===_0x5dbf('0x8e')?![]:!![]);_0x521c72['field'](_0xbe0ca0,_0x4562a4[_0x6b4262][_0x5dbf('0x79')]||_0xbe0ca0);}if(_0x51864c['joins']){_0x51864c[_0x5dbf('0x7a')]=JSON['parse'](_0x51864c[_0x5dbf('0x7a')]);for(var _0x417869=0x0;_0x417869<_0x51864c[_0x5dbf('0x7a')]['length'];_0x417869+=0x1){if(_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x42')]&&_[_0x5dbf('0x63')](_0x25e681,_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x42')])&&_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x80')]&&_0x51864c['joins'][_0x417869][_0x5dbf('0x7c')]&&_0x51864c[_0x5dbf('0x7a')][_0x417869]['foreignKey']){_0x521c72[_0x51864c[_0x5dbf('0x7a')][_0x417869]['type']](_0x51864c['joins'][_0x417869][_0x5dbf('0x7c')],null,util[_0x5dbf('0x76')]('%s.%s\x20=\x20%s.%s',_0x51864c[_0x5dbf('0x7f')],_0x51864c['joins'][_0x417869]['parentKey'],_0x51864c[_0x5dbf('0x7a')][_0x417869]['foreignTable'],_0x51864c[_0x5dbf('0x7a')][_0x417869][_0x5dbf('0x7d')]));}}}if(_0x51864c[_0x5dbf('0x81')]){_0x51864c[_0x5dbf('0x81')]=JSON[_0x5dbf('0x7b')](_0x51864c[_0x5dbf('0x81')]);_0x521c72[_0x5dbf('0x3e')](_0x3de263(_0x51864c[_0x5dbf('0x81')][_0x5dbf('0x69')]));}_0xc588a2=_0x521c72[_0x5dbf('0x8f')]();_0x521c72[_0x5dbf('0x1b')](_0x1da1e3);_0x521c72[_0x5dbf('0x3b')](0x0);logger[_0x5dbf('0x82')]('Limited\x20Query:',_0x521c72[_0x5dbf('0x84')]());return dbH[_0x5dbf('0xa1')][_0x5dbf('0x32')](_0x521c72[_0x5dbf('0x84')](),{'type':dbH[_0x5dbf('0xa1')][_0x5dbf('0xa2')]['SELECT']});}})[_0x5dbf('0x22')](function(){return{'sql':_0xc588a2[_0x5dbf('0x84')]()};})[_0x5dbf('0x22')](respondWithResult(_0x144300,null))[_0x5dbf('0x54')](handleError(_0x144300,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(_0x45ba0c,_0x58f598){var _0x4db9b1=function(_0x72c1b3){while(--_0x72c1b3){_0x45ba0c['push'](_0x45ba0c['shift']());}};_0x4db9b1(++_0x58f598);}(_0x5fab,0x177));var _0xb5fa=function(_0x56c70f,_0x4e4493){_0x56c70f=_0x56c70f-0x0;var _0x3812ed=_0x5fab[_0x56c70f];return _0x3812ed;};'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 76d78c3..d83d146 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 _0x9da7=['path','rimraf','../../config/environment','./analyticDefaultReport.attributes','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0x9da7,0x1d9));var _0x79da=function(_0x53a7a8,_0xed2bff){_0x53a7a8=_0x53a7a8-0x0;var _0x555f71=_0x9da7[_0x53a7a8];return _0x555f71;};'use strict';var _=require(_0x79da('0x0'));var util=require(_0x79da('0x1'));var logger=require(_0x79da('0x2'))(_0x79da('0x3'));var moment=require(_0x79da('0x4'));var BPromise=require(_0x79da('0x5'));var rp=require(_0x79da('0x6'));var fs=require('fs');var path=require(_0x79da('0x7'));var rimraf=require(_0x79da('0x8'));var config=require(_0x79da('0x9'));var attributes=require(_0x79da('0xa'));module['exports']=function(_0x269671,_0x56ed69){return _0x269671['define']('AnalyticDefaultReport',attributes,{'tableName':_0x79da('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce3e=['request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','lodash','util','api','bluebird'];(function(_0x19d24c,_0x62bc50){var _0x2fae8d=function(_0x419856){while(--_0x419856){_0x19d24c['push'](_0x19d24c['shift']());}};_0x2fae8d(++_0x62bc50);}(_0xce3e,0xc8));var _0xece3=function(_0x3f1cf2,_0x389edd){_0x3f1cf2=_0x3f1cf2-0x0;var _0x3533d4=_0xce3e[_0x3f1cf2];return _0x3533d4;};'use strict';var _=require(_0xece3('0x0'));var util=require(_0xece3('0x1'));var logger=require('../../config/logger')(_0xece3('0x2'));var moment=require('moment');var BPromise=require(_0xece3('0x3'));var rp=require(_0xece3('0x4'));var fs=require('fs');var path=require(_0xece3('0x5'));var rimraf=require(_0xece3('0x6'));var config=require(_0xece3('0x7'));var attributes=require(_0xece3('0x8'));module[_0xece3('0x9')]=function(_0x10a3fd,_0x3f69d8){return _0x10a3fd['define'](_0xece3('0xa'),attributes,{'tableName':_0xece3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 56ea46e..a83f532 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 _0x3e7b=['client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x38a7a2,_0x3264ad){var _0x115dfd=function(_0x2f88ee){while(--_0x2f88ee){_0x38a7a2['push'](_0x38a7a2['shift']());}};_0x115dfd(++_0x3264ad);}(_0x3e7b,0x1b2));var _0xb3e7=function(_0x584033,_0x18311f){_0x584033=_0x584033-0x0;var _0x5ac9ff=_0x3e7b[_0x584033];return _0x5ac9ff;};'use strict';var _=require('lodash');var util=require(_0xb3e7('0x0'));var moment=require(_0xb3e7('0x1'));var BPromise=require(_0xb3e7('0x2'));var rs=require(_0xb3e7('0x3'));var fs=require('fs');var Redis=require(_0xb3e7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb3e7('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb3e7('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c0cdf,_0x2c231a,_0x3f5892){return new BPromise(function(_0x4c5d81,_0x27f16e){return client[_0xb3e7('0x7')](_0x5c0cdf,_0x3f5892)[_0xb3e7('0x8')](function(_0x5e8a3e){logger[_0xb3e7('0x9')](_0xb3e7('0xa'),_0x2c231a,'request\x20sent');logger[_0xb3e7('0xb')](_0xb3e7('0xc'),_0x2c231a,_0xb3e7('0xd'),JSON[_0xb3e7('0xe')](_0x5e8a3e));if(_0x5e8a3e[_0xb3e7('0xf')]){if(_0x5e8a3e['error'][_0xb3e7('0x10')]===0x1f4){logger[_0xb3e7('0xf')](_0xb3e7('0xa'),_0x2c231a,_0x5e8a3e[_0xb3e7('0xf')][_0xb3e7('0x11')]);return _0x27f16e(_0x5e8a3e[_0xb3e7('0xf')][_0xb3e7('0x11')]);}logger['error'](_0xb3e7('0xa'),_0x2c231a,_0x5e8a3e[_0xb3e7('0xf')][_0xb3e7('0x11')]);return _0x4c5d81(_0x5e8a3e[_0xb3e7('0xf')]['message']);}else{logger[_0xb3e7('0x9')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2c231a,'request\x20sent');_0x4c5d81(_0x5e8a3e[_0xb3e7('0x12')]['message']);}})[_0xb3e7('0x13')](function(_0x481691){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x2c231a,_0x481691);_0x27f16e(_0x481691);});});} \ No newline at end of file +var _0x3b69=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../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','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x2c59f4,_0x56ea84){var _0x11a482=function(_0x3560c8){while(--_0x3560c8){_0x2c59f4['push'](_0x2c59f4['shift']());}};_0x11a482(++_0x56ea84);}(_0x3b69,0x94));var _0x93b6=function(_0x5f4cff,_0x3ca7d2){_0x5f4cff=_0x5f4cff-0x0;var _0x55d323=_0x3b69[_0x5f4cff];return _0x55d323;};'use strict';var _=require(_0x93b6('0x0'));var util=require('util');var moment=require(_0x93b6('0x1'));var BPromise=require(_0x93b6('0x2'));var rs=require(_0x93b6('0x3'));var fs=require('fs');var Redis=require(_0x93b6('0x4'));var db=require(_0x93b6('0x5'))['db'];var utils=require(_0x93b6('0x6'));var logger=require(_0x93b6('0x7'))(_0x93b6('0x8'));var config=require(_0x93b6('0x9'));var jayson=require(_0x93b6('0xa'));var client=jayson[_0x93b6('0xb')][_0x93b6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1a81a4,_0x260df1,_0x30c188){return new BPromise(function(_0x1368d1,_0x67e7df){return client['request'](_0x1a81a4,_0x30c188)[_0x93b6('0xd')](function(_0x482de3){logger[_0x93b6('0xe')](_0x93b6('0xf'),_0x260df1,_0x93b6('0x10'));logger[_0x93b6('0x11')](_0x93b6('0x12'),_0x260df1,'request\x20sent',JSON[_0x93b6('0x13')](_0x482de3));if(_0x482de3[_0x93b6('0x14')]){if(_0x482de3[_0x93b6('0x14')][_0x93b6('0x15')]===0x1f4){logger[_0x93b6('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x260df1,_0x482de3['error'][_0x93b6('0x16')]);return _0x67e7df(_0x482de3[_0x93b6('0x14')][_0x93b6('0x16')]);}logger[_0x93b6('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x260df1,_0x482de3[_0x93b6('0x14')][_0x93b6('0x16')]);return _0x1368d1(_0x482de3[_0x93b6('0x14')][_0x93b6('0x16')]);}else{logger['info'](_0x93b6('0xf'),_0x260df1,'request\x20sent');_0x1368d1(_0x482de3[_0x93b6('0x17')][_0x93b6('0x16')]);}})[_0x93b6('0x18')](function(_0x5f78a2){logger['error'](_0x93b6('0xf'),_0x260df1,_0x5f78a2);_0x67e7df(_0x5f78a2);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 3dddb1b..9c6b013 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 _0x36c2=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','/:id','show','/:id/preview','preview','/:id/run','isAuthenticated','run','/:id/query','query','create','put','update','destroy','exports','multer','util','connect-timeout'];(function(_0x3f787e,_0x951303){var _0x26242d=function(_0x58622a){while(--_0x58622a){_0x3f787e['push'](_0x3f787e['shift']());}};_0x26242d(++_0x951303);}(_0x36c2,0xac));var _0x236c=function(_0xeb8110,_0x37fa09){_0xeb8110=_0xeb8110-0x0;var _0x3ebeba=_0x36c2[_0xeb8110];return _0x3ebeba;};'use strict';var multer=require(_0x236c('0x0'));var util=require(_0x236c('0x1'));var path=require('path');var timeout=require(_0x236c('0x2'));var express=require(_0x236c('0x3'));var router=express['Router']();var fs_extra=require(_0x236c('0x4'));var auth=require(_0x236c('0x5'));var interaction=require(_0x236c('0x6'));var config=require(_0x236c('0x7'));var controller=require(_0x236c('0x8'));router[_0x236c('0x9')]('/',auth['isAuthenticated'](),controller[_0x236c('0xa')]);router[_0x236c('0x9')](_0x236c('0xb'),auth['isAuthenticated'](),controller[_0x236c('0xc')]);router[_0x236c('0x9')](_0x236c('0xd'),auth['isAuthenticated'](),controller[_0x236c('0xe')]);router[_0x236c('0x9')](_0x236c('0xf'),auth[_0x236c('0x10')](),controller[_0x236c('0x11')]);router[_0x236c('0x9')](_0x236c('0x12'),auth[_0x236c('0x10')](),controller[_0x236c('0x13')]);router['post']('/',auth[_0x236c('0x10')](),controller[_0x236c('0x14')]);router[_0x236c('0x15')]('/:id',auth[_0x236c('0x10')](),controller[_0x236c('0x16')]);router['delete'](_0x236c('0xb'),auth[_0x236c('0x10')](),controller[_0x236c('0x17')]);module[_0x236c('0x18')]=router; \ No newline at end of file +var _0x8fbd=['show','/:id/preview','preview','get','/:id/run','run','/:id/query','query','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','index','isAuthenticated'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x8fbd,0x13b));var _0xd8fb=function(_0x47cbab,_0x27590e){_0x47cbab=_0x47cbab-0x0;var _0x1c7f79=_0x8fbd[_0x47cbab];return _0x1c7f79;};'use strict';var multer=require('multer');var util=require(_0xd8fb('0x0'));var path=require(_0xd8fb('0x1'));var timeout=require(_0xd8fb('0x2'));var express=require(_0xd8fb('0x3'));var router=express[_0xd8fb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd8fb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd8fb('0x6'));var controller=require(_0xd8fb('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd8fb('0x8')]);router['get']('/:id',auth[_0xd8fb('0x9')](),controller[_0xd8fb('0xa')]);router['get'](_0xd8fb('0xb'),auth[_0xd8fb('0x9')](),controller[_0xd8fb('0xc')]);router[_0xd8fb('0xd')](_0xd8fb('0xe'),auth['isAuthenticated'](),controller[_0xd8fb('0xf')]);router['get'](_0xd8fb('0x10'),auth['isAuthenticated'](),controller[_0xd8fb('0x11')]);router['post']('/',auth[_0xd8fb('0x9')](),controller[_0xd8fb('0x12')]);router[_0xd8fb('0x13')](_0xd8fb('0x14'),auth[_0xd8fb('0x9')](),controller[_0xd8fb('0x15')]);router[_0xd8fb('0x16')](_0xd8fb('0x14'),auth['isAuthenticated'](),controller[_0xd8fb('0x17')]);module[_0xd8fb('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 660aa2e..ebfba58 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 _0xec50=['pdf','xlsx','csv','DATE','Loading','manual','INTEGER','UNSIGNED','moment','STRING','ENUM'];(function(_0x480cce,_0x4e605e){var _0x9eefaa=function(_0x59a825){while(--_0x59a825){_0x480cce['push'](_0x480cce['shift']());}};_0x9eefaa(++_0x4e605e);}(_0xec50,0xfa));var _0x0ec5=function(_0xb3b452,_0x582e8e){_0xb3b452=_0xb3b452-0x0;var _0x238983=_0xec50[_0xb3b452];return _0x238983;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0ec5('0x0'));module['exports']={'name':{'type':Sequelize[_0x0ec5('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0x0ec5('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x0ec5('0x2')]('csv',_0x0ec5('0x3'),_0x0ec5('0x4')),'allowNull':![],'defaultValue':_0x0ec5('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x0ec5('0x6')]},'status':{'type':Sequelize[_0x0ec5('0x1')],'defaultValue':_0x0ec5('0x7')},'type':{'type':Sequelize[_0x0ec5('0x2')](_0x0ec5('0x8'),'scheduled'),'allowNull':![],'defaultValue':_0x0ec5('0x8')},'reportId':{'type':Sequelize[_0x0ec5('0x9')](0xb)[_0x0ec5('0xa')]},'reportType':{'type':Sequelize[_0x0ec5('0x1')]}}; \ No newline at end of file +var _0x126b=['DATE','manual','UNSIGNED','moment','exports','STRING','ENUM','csv','pdf','xlsx'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x126b,0x14d));var _0xb126=function(_0x20b997,_0x3bf796){_0x20b997=_0x20b997-0x0;var _0x5772d1=_0x126b[_0x20b997];return _0x5772d1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb126('0x0'));module[_0xb126('0x1')]={'name':{'type':Sequelize[_0xb126('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xb126('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xb126('0x3')](_0xb126('0x4'),_0xb126('0x5'),_0xb126('0x6')),'allowNull':![],'defaultValue':_0xb126('0x4')},'savename':{'type':Sequelize[_0xb126('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xb126('0x7')]},'endDate':{'type':Sequelize[_0xb126('0x7')]},'status':{'type':Sequelize[_0xb126('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xb126('0x3')](_0xb126('0x8'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xb126('0x9')]},'reportType':{'type':Sequelize[_0xb126('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 568260c..8ce1bcf 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 _0xb8cd=['toLowerCase','rimraf','fast-json-patch','request-promise','moment','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','reject','update','then','get','ExtractedReports','destroy','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','AnalyticExtractedReport','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','sendStatus','join'];(function(_0xb3a900,_0x34f642){var _0x28b197=function(_0x10d868){while(--_0x10d868){_0xb3a900['push'](_0xb3a900['shift']());}};_0x28b197(++_0x34f642);}(_0xb8cd,0x127));var _0xdb8c=function(_0x7c2035,_0x13334){_0x7c2035=_0x7c2035-0x0;var _0x50f5c1=_0xb8cd[_0x7c2035];return _0x50f5c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdb8c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb8c('0x1'));var rp=require(_0xdb8c('0x2'));var moment=require(_0xdb8c('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdb8c('0x4'));var path=require('path');var sox=require(_0xdb8c('0x5'));var csv=require(_0xdb8c('0x6'));var ejs=require(_0xdb8c('0x7'));var fs=require('fs');var fs_extra=require(_0xdb8c('0x8'));var _=require(_0xdb8c('0x9'));var squel=require(_0xdb8c('0xa'));var crypto=require(_0xdb8c('0xb'));var jsforce=require(_0xdb8c('0xc'));var deskjs=require(_0xdb8c('0xd'));var toCsv=require(_0xdb8c('0x6'));var querystring=require(_0xdb8c('0xe'));var Papa=require(_0xdb8c('0xf'));var Redis=require(_0xdb8c('0x10'));var authService=require(_0xdb8c('0x11'));var qs=require(_0xdb8c('0x12'));var as=require(_0xdb8c('0x13'));var hardwareService=require(_0xdb8c('0x14'));var logger=require(_0xdb8c('0x15'))(_0xdb8c('0x16'));var utils=require(_0xdb8c('0x17'));var config=require(_0xdb8c('0x18'));var licenseUtil=require(_0xdb8c('0x19'));var db=require(_0xdb8c('0x1a'))['db'];function respondWithStatusCode(_0x1eb79e,_0x39581d){_0x39581d=_0x39581d||0xcc;return function(_0x2270e0){if(_0x2270e0){return _0x1eb79e['sendStatus'](_0x39581d);}return _0x1eb79e[_0xdb8c('0x1b')](_0x39581d)[_0xdb8c('0x1c')]();};}function respondWithResult(_0x19b539,_0x2671ed){_0x2671ed=_0x2671ed||0xc8;return function(_0xd96450){if(_0xd96450){return _0x19b539[_0xdb8c('0x1b')](_0x2671ed)[_0xdb8c('0x1d')](_0xd96450);}};}function respondWithFilteredResult(_0x431aae,_0x18e767){return function(_0x377223){if(_0x377223){var _0x4b2bed=typeof _0x18e767[_0xdb8c('0x1e')]===_0xdb8c('0x1f')&&typeof _0x18e767['limit']===_0xdb8c('0x1f');var _0x16ac5d=_0x377223[_0xdb8c('0x20')];var _0x5142ee=_0x4b2bed?0x0:_0x18e767[_0xdb8c('0x1e')];var _0x4ee461=_0x4b2bed?_0x377223[_0xdb8c('0x20')]:_0x18e767[_0xdb8c('0x1e')]+_0x18e767[_0xdb8c('0x21')];var _0x5c846f;if(_0x4ee461>=_0x16ac5d){_0x4ee461=_0x16ac5d;_0x5c846f=0xc8;}else{_0x5c846f=0xce;}_0x431aae[_0xdb8c('0x1b')](_0x5c846f);return _0x431aae['set'](_0xdb8c('0x22'),_0x5142ee+'-'+_0x4ee461+'/'+_0x16ac5d)[_0xdb8c('0x1d')](_0x377223);}return null;};}function patchUpdates(_0x1233ed){return function(_0x51f3d2){try{jsonpatch['apply'](_0x51f3d2,_0x1233ed,!![]);}catch(_0x4e1911){return BPromise[_0xdb8c('0x23')](_0x4e1911);}return _0x51f3d2['save']();};}function saveUpdates(_0x57e690,_0x36a0d3){return function(_0x40071f){if(_0x40071f){return _0x40071f[_0xdb8c('0x24')](_0x57e690)['then'](function(_0x1919f4){return _0x1919f4;});}return null;};}function removeEntity(_0x316efd,_0x42073b){return function(_0x5e7351){if(_0x5e7351){return _0x5e7351['destroy']()[_0xdb8c('0x25')](function(){var _0x4b9d62=_0x5e7351[_0xdb8c('0x26')]({'plain':!![]});var _0x30f978=_0xdb8c('0x27');return db['UserProfileResource'][_0xdb8c('0x28')]({'where':{'type':_0x30f978,'resourceId':_0x4b9d62['id']}})[_0xdb8c('0x25')](function(){return _0x5e7351;});})[_0xdb8c('0x25')](function(){_0x316efd[_0xdb8c('0x1b')](0xcc)[_0xdb8c('0x1c')]();});}};}function handleEntityNotFound(_0x31f55b,_0x28285e){return function(_0x527df3){if(!_0x527df3){_0x31f55b['sendStatus'](0x194);}return _0x527df3;};}function handleError(_0x2eda61,_0x24fff6){_0x24fff6=_0x24fff6||0x1f4;return function(_0x3e4487){logger['error'](_0x3e4487[_0xdb8c('0x29')]);if(_0x3e4487[_0xdb8c('0x2a')]){delete _0x3e4487['name'];}_0x2eda61[_0xdb8c('0x1b')](_0x24fff6)[_0xdb8c('0x2b')](_0x3e4487);};}exports[_0xdb8c('0x2c')]=function(_0x4af801,_0x629e90){var _0x11c6a3={},_0x44fdb1={},_0x56ebd6={'count':0x0,'rows':[]};var _0x39cd5a=_[_0xdb8c('0x2d')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x209ffa){return{'name':_0x209ffa[_0xdb8c('0x2e')],'type':_0x209ffa[_0xdb8c('0x2f')][_0xdb8c('0x30')]};});_0x44fdb1[_0xdb8c('0x31')]=_[_0xdb8c('0x2d')](_0x39cd5a,'name');_0x44fdb1[_0xdb8c('0x32')]=_[_0xdb8c('0x33')](_0x4af801['query']);_0x44fdb1['filters']=_[_0xdb8c('0x34')](_0x44fdb1['model'],_0x44fdb1[_0xdb8c('0x32')]);_0x11c6a3[_0xdb8c('0x35')]=_['intersection'](_0x44fdb1['model'],qs[_0xdb8c('0x36')](_0x4af801['query'][_0xdb8c('0x36')]));_0x11c6a3['attributes']=_0x11c6a3[_0xdb8c('0x35')]['length']?_0x11c6a3['attributes']:_0x44fdb1['model'];if(!_0x4af801[_0xdb8c('0x32')][_0xdb8c('0x37')](_0xdb8c('0x38'))){_0x11c6a3[_0xdb8c('0x21')]=qs[_0xdb8c('0x21')](_0x4af801[_0xdb8c('0x32')][_0xdb8c('0x21')]);_0x11c6a3['offset']=qs[_0xdb8c('0x1e')](_0x4af801[_0xdb8c('0x32')]['offset']);}_0x11c6a3[_0xdb8c('0x39')]=qs[_0xdb8c('0x3a')](_0x4af801[_0xdb8c('0x32')]['sort']);_0x11c6a3[_0xdb8c('0x3b')]=qs[_0xdb8c('0x3c')](_[_0xdb8c('0x3d')](_0x4af801[_0xdb8c('0x32')],_0x44fdb1[_0xdb8c('0x3c')]),_0x39cd5a);if(_0x4af801[_0xdb8c('0x32')][_0xdb8c('0x3e')]){_0x11c6a3['where']=_[_0xdb8c('0x3f')](_0x11c6a3['where'],{'$or':_[_0xdb8c('0x2d')](_0x39cd5a,function(_0x4e1952){if(_0x4e1952[_0xdb8c('0x2f')]!==_0xdb8c('0x40')){var _0x4870fe={};_0x4870fe[_0x4e1952[_0xdb8c('0x2a')]]={'$like':'%'+_0x4af801[_0xdb8c('0x32')][_0xdb8c('0x3e')]+'%'};return _0x4870fe;}})});}_0x11c6a3=_['merge']({},_0x11c6a3,_0x4af801[_0xdb8c('0x41')]);var _0x1f633b={'where':_0x11c6a3[_0xdb8c('0x3b')]};return db[_0xdb8c('0x42')][_0xdb8c('0x20')](_0x1f633b)['then'](function(_0x19aaae){_0x56ebd6[_0xdb8c('0x20')]=_0x19aaae;if(_0x4af801[_0xdb8c('0x32')][_0xdb8c('0x43')]){_0x11c6a3[_0xdb8c('0x44')]=[{'all':!![]}];}return db[_0xdb8c('0x42')]['findAll'](_0x11c6a3);})[_0xdb8c('0x25')](function(_0xd3576c){_0x56ebd6[_0xdb8c('0x45')]=_0xd3576c;return _0x56ebd6;})[_0xdb8c('0x25')](respondWithFilteredResult(_0x629e90,_0x11c6a3))[_0xdb8c('0x46')](handleError(_0x629e90,null));};exports[_0xdb8c('0x47')]=function(_0x44af89,_0x4b0243){var _0x55fdb7={'raw':!![],'where':{'id':_0x44af89[_0xdb8c('0x48')]['id']}},_0x2bc4e2={};_0x2bc4e2[_0xdb8c('0x31')]=_['keys'](db[_0xdb8c('0x42')][_0xdb8c('0x49')]);_0x2bc4e2[_0xdb8c('0x32')]=_[_0xdb8c('0x33')](_0x44af89['query']);_0x2bc4e2[_0xdb8c('0x3c')]=_['intersection'](_0x2bc4e2['model'],_0x2bc4e2[_0xdb8c('0x32')]);_0x55fdb7[_0xdb8c('0x35')]=_[_0xdb8c('0x34')](_0x2bc4e2[_0xdb8c('0x31')],qs[_0xdb8c('0x36')](_0x44af89['query'][_0xdb8c('0x36')]));_0x55fdb7[_0xdb8c('0x35')]=_0x55fdb7['attributes'][_0xdb8c('0x4a')]?_0x55fdb7[_0xdb8c('0x35')]:_0x2bc4e2[_0xdb8c('0x31')];if(_0x44af89['query']['includeAll']){_0x55fdb7[_0xdb8c('0x44')]=[{'all':!![]}];}_0x55fdb7=_['merge']({},_0x55fdb7,_0x44af89[_0xdb8c('0x41')]);return db[_0xdb8c('0x42')][_0xdb8c('0x4b')](_0x55fdb7)['then'](handleEntityNotFound(_0x4b0243,null))['then'](respondWithResult(_0x4b0243,null))[_0xdb8c('0x46')](handleError(_0x4b0243,null));};exports[_0xdb8c('0x4c')]=function(_0x2fcde8,_0x51e322){return db[_0xdb8c('0x42')][_0xdb8c('0x4c')](_0x2fcde8[_0xdb8c('0x4d')],{})['then'](function(_0x83dbcd){var _0x11976f=_0x2fcde8[_0xdb8c('0x4e')]['get']({'plain':!![]});if(!_0x11976f)throw new Error(_0xdb8c('0x4f'));if(_0x11976f[_0xdb8c('0x50')]===_0xdb8c('0x4e')){var _0x39ea45=_0x83dbcd[_0xdb8c('0x26')]({'plain':!![]});var _0x2fa015='ExtractedReports';return db[_0xdb8c('0x51')][_0xdb8c('0x4b')]({'where':{'name':_0x2fa015,'userProfileId':_0x11976f['userProfileId']},'raw':!![]})[_0xdb8c('0x25')](function(_0x3c2f9b){if(_0x3c2f9b&&_0x3c2f9b[_0xdb8c('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x39ea45[_0xdb8c('0x2a')],'resourceId':_0x39ea45['id'],'type':_0x3c2f9b[_0xdb8c('0x2a')],'sectionId':_0x3c2f9b['id']},{})[_0xdb8c('0x25')](function(){return _0x83dbcd;});}else{return _0x83dbcd;}})[_0xdb8c('0x46')](function(_0xa1810){logger[_0xdb8c('0x53')](_0xdb8c('0x54'),_0xa1810);throw _0xa1810;});}return _0x83dbcd;})[_0xdb8c('0x25')](respondWithResult(_0x51e322,0xc9))[_0xdb8c('0x46')](handleError(_0x51e322,null));};exports[_0xdb8c('0x24')]=function(_0x4c3424,_0x47efef){if(_0x4c3424[_0xdb8c('0x4d')]['id']){delete _0x4c3424[_0xdb8c('0x4d')]['id'];}return db['AnalyticExtractedReport'][_0xdb8c('0x4b')]({'where':{'id':_0x4c3424[_0xdb8c('0x48')]['id']}})[_0xdb8c('0x25')](handleEntityNotFound(_0x47efef,null))['then'](saveUpdates(_0x4c3424['body'],null))[_0xdb8c('0x25')](respondWithResult(_0x47efef,null))[_0xdb8c('0x46')](handleError(_0x47efef,null));};exports[_0xdb8c('0x28')]=function(_0x231929,_0x5dc9b9){return db[_0xdb8c('0x42')][_0xdb8c('0x4b')]({'where':{'id':_0x231929[_0xdb8c('0x48')]['id']}})['then'](handleEntityNotFound(_0x5dc9b9,null))[_0xdb8c('0x25')](removeEntity(_0x5dc9b9,null))[_0xdb8c('0x46')](handleError(_0x5dc9b9,null));};exports[_0xdb8c('0x55')]=function(_0x96bf88,_0x92c1df,_0x66083f){return db[_0xdb8c('0x42')][_0xdb8c('0x4b')]({'where':{'id':_0x96bf88[_0xdb8c('0x48')]['id']},'attributes':['name',_0xdb8c('0x56'),_0xdb8c('0x57'),_0xdb8c('0x58')],'raw':!![]})[_0xdb8c('0x25')](handleEntityNotFound(_0x92c1df,null))[_0xdb8c('0x25')](function(_0x21028f){if(_0x21028f){if(!fs[_0xdb8c('0x59')](path['join'](config[_0xdb8c('0x5a')],_0xdb8c('0x5b'),_0x21028f[_0xdb8c('0x57')]))){throw new db[(_0xdb8c('0x5c'))]['ValidationError'](_0xdb8c('0x5d'));}if(_0x96bf88[_0xdb8c('0x32')][_0xdb8c('0x5e')]){return _0x92c1df[_0xdb8c('0x5f')](0xc8);}return _0x92c1df[_0xdb8c('0x55')](path[_0xdb8c('0x60')](config[_0xdb8c('0x5a')],'server/files/reports',_0x21028f[_0xdb8c('0x57')]),util['format']('%s.%s',_0x21028f['basename']||_0x21028f['name'],_0x21028f[_0xdb8c('0x58')][_0xdb8c('0x61')]()));}})[_0xdb8c('0x46')](handleError(_0x92c1df,null));}; \ No newline at end of file +var _0x163b=['download','savename','output','join','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','toLowerCase','eml-format','fast-json-patch','request-promise','moment','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','then','get','ExtractedReports','destroy','error','send','index','map','AnalyticExtractedReport','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','findAll','show','params','rawAttributes','include','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x163b,0xc3));var _0xb163=function(_0x40d995,_0x32d2ea){_0x40d995=_0x40d995-0x0;var _0x5bff95=_0x163b[_0x40d995];return _0x5bff95;};'use strict';var emlformat=require(_0xb163('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb163('0x1'));var rp=require(_0xb163('0x2'));var moment=require(_0xb163('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb163('0x4'));var path=require(_0xb163('0x5'));var sox=require(_0xb163('0x6'));var csv=require(_0xb163('0x7'));var ejs=require(_0xb163('0x8'));var fs=require('fs');var fs_extra=require(_0xb163('0x9'));var _=require(_0xb163('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb163('0xb'));var deskjs=require(_0xb163('0xc'));var toCsv=require(_0xb163('0x7'));var querystring=require(_0xb163('0xd'));var Papa=require(_0xb163('0xe'));var Redis=require(_0xb163('0xf'));var authService=require(_0xb163('0x10'));var qs=require(_0xb163('0x11'));var as=require(_0xb163('0x12'));var hardwareService=require(_0xb163('0x13'));var logger=require(_0xb163('0x14'))(_0xb163('0x15'));var utils=require(_0xb163('0x16'));var config=require(_0xb163('0x17'));var licenseUtil=require(_0xb163('0x18'));var db=require(_0xb163('0x19'))['db'];function respondWithStatusCode(_0x4e1637,_0x4a25a7){_0x4a25a7=_0x4a25a7||0xcc;return function(_0x5a91e5){if(_0x5a91e5){return _0x4e1637[_0xb163('0x1a')](_0x4a25a7);}return _0x4e1637[_0xb163('0x1b')](_0x4a25a7)[_0xb163('0x1c')]();};}function respondWithResult(_0x46af40,_0x1b3e3f){_0x1b3e3f=_0x1b3e3f||0xc8;return function(_0x354566){if(_0x354566){return _0x46af40['status'](_0x1b3e3f)['json'](_0x354566);}};}function respondWithFilteredResult(_0x1f6e91,_0x25aa3d){return function(_0x46b062){if(_0x46b062){var _0x1a487f=typeof _0x25aa3d['offset']===_0xb163('0x1d')&&typeof _0x25aa3d[_0xb163('0x1e')]===_0xb163('0x1d');var _0x156424=_0x46b062[_0xb163('0x1f')];var _0x3be265=_0x1a487f?0x0:_0x25aa3d[_0xb163('0x20')];var _0x54dc8b=_0x1a487f?_0x46b062['count']:_0x25aa3d[_0xb163('0x20')]+_0x25aa3d[_0xb163('0x1e')];var _0x48de28;if(_0x54dc8b>=_0x156424){_0x54dc8b=_0x156424;_0x48de28=0xc8;}else{_0x48de28=0xce;}_0x1f6e91[_0xb163('0x1b')](_0x48de28);return _0x1f6e91['set'](_0xb163('0x21'),_0x3be265+'-'+_0x54dc8b+'/'+_0x156424)[_0xb163('0x22')](_0x46b062);}return null;};}function patchUpdates(_0x3503c6){return function(_0xea413f){try{jsonpatch['apply'](_0xea413f,_0x3503c6,!![]);}catch(_0x473b47){return BPromise[_0xb163('0x23')](_0x473b47);}return _0xea413f[_0xb163('0x24')]();};}function saveUpdates(_0x2d3572,_0x10f179){return function(_0x3ce51a){if(_0x3ce51a){return _0x3ce51a['update'](_0x2d3572)[_0xb163('0x25')](function(_0x15462d){return _0x15462d;});}return null;};}function removeEntity(_0x5148d9,_0x847112){return function(_0x5e505d){if(_0x5e505d){return _0x5e505d['destroy']()['then'](function(){var _0x3f4e55=_0x5e505d[_0xb163('0x26')]({'plain':!![]});var _0x59464a=_0xb163('0x27');return db['UserProfileResource'][_0xb163('0x28')]({'where':{'type':_0x59464a,'resourceId':_0x3f4e55['id']}})[_0xb163('0x25')](function(){return _0x5e505d;});})[_0xb163('0x25')](function(){_0x5148d9[_0xb163('0x1b')](0xcc)[_0xb163('0x1c')]();});}};}function handleEntityNotFound(_0x17a88c,_0x466f6d){return function(_0x220bb2){if(!_0x220bb2){_0x17a88c[_0xb163('0x1a')](0x194);}return _0x220bb2;};}function handleError(_0x40a96f,_0x37c63f){_0x37c63f=_0x37c63f||0x1f4;return function(_0x1d552f){logger[_0xb163('0x29')](_0x1d552f['stack']);if(_0x1d552f['name']){delete _0x1d552f['name'];}_0x40a96f[_0xb163('0x1b')](_0x37c63f)[_0xb163('0x2a')](_0x1d552f);};}exports[_0xb163('0x2b')]=function(_0x17bfe,_0x3eb442){var _0x1fc517={},_0x545768={},_0x147d3c={'count':0x0,'rows':[]};var _0x4c1a40=_[_0xb163('0x2c')](db[_0xb163('0x2d')]['rawAttributes'],function(_0x1fcaad){return{'name':_0x1fcaad['fieldName'],'type':_0x1fcaad[_0xb163('0x2e')][_0xb163('0x2f')]};});_0x545768[_0xb163('0x30')]=_['map'](_0x4c1a40,_0xb163('0x31'));_0x545768[_0xb163('0x32')]=_[_0xb163('0x33')](_0x17bfe[_0xb163('0x32')]);_0x545768[_0xb163('0x34')]=_[_0xb163('0x35')](_0x545768[_0xb163('0x30')],_0x545768[_0xb163('0x32')]);_0x1fc517[_0xb163('0x36')]=_[_0xb163('0x35')](_0x545768[_0xb163('0x30')],qs[_0xb163('0x37')](_0x17bfe['query'][_0xb163('0x37')]));_0x1fc517[_0xb163('0x36')]=_0x1fc517[_0xb163('0x36')][_0xb163('0x38')]?_0x1fc517[_0xb163('0x36')]:_0x545768[_0xb163('0x30')];if(!_0x17bfe[_0xb163('0x32')][_0xb163('0x39')]('nolimit')){_0x1fc517[_0xb163('0x1e')]=qs[_0xb163('0x1e')](_0x17bfe['query']['limit']);_0x1fc517[_0xb163('0x20')]=qs[_0xb163('0x20')](_0x17bfe[_0xb163('0x32')][_0xb163('0x20')]);}_0x1fc517[_0xb163('0x3a')]=qs[_0xb163('0x3b')](_0x17bfe[_0xb163('0x32')]['sort']);_0x1fc517[_0xb163('0x3c')]=qs[_0xb163('0x34')](_['pick'](_0x17bfe[_0xb163('0x32')],_0x545768[_0xb163('0x34')]),_0x4c1a40);if(_0x17bfe[_0xb163('0x32')][_0xb163('0x3d')]){_0x1fc517['where']=_['merge'](_0x1fc517[_0xb163('0x3c')],{'$or':_['map'](_0x4c1a40,function(_0x9fbe00){if(_0x9fbe00[_0xb163('0x2e')]!==_0xb163('0x3e')){var _0xacc259={};_0xacc259[_0x9fbe00['name']]={'$like':'%'+_0x17bfe[_0xb163('0x32')][_0xb163('0x3d')]+'%'};return _0xacc259;}})});}_0x1fc517=_[_0xb163('0x3f')]({},_0x1fc517,_0x17bfe['options']);var _0x57b861={'where':_0x1fc517[_0xb163('0x3c')]};return db[_0xb163('0x2d')][_0xb163('0x1f')](_0x57b861)[_0xb163('0x25')](function(_0x5dea70){_0x147d3c[_0xb163('0x1f')]=_0x5dea70;if(_0x17bfe[_0xb163('0x32')][_0xb163('0x40')]){_0x1fc517['include']=[{'all':!![]}];}return db[_0xb163('0x2d')][_0xb163('0x41')](_0x1fc517);})[_0xb163('0x25')](function(_0x1e3301){_0x147d3c['rows']=_0x1e3301;return _0x147d3c;})[_0xb163('0x25')](respondWithFilteredResult(_0x3eb442,_0x1fc517))['catch'](handleError(_0x3eb442,null));};exports[_0xb163('0x42')]=function(_0x1409c0,_0x389604){var _0x464234={'raw':!![],'where':{'id':_0x1409c0[_0xb163('0x43')]['id']}},_0x2f2552={};_0x2f2552[_0xb163('0x30')]=_[_0xb163('0x33')](db[_0xb163('0x2d')][_0xb163('0x44')]);_0x2f2552['query']=_[_0xb163('0x33')](_0x1409c0[_0xb163('0x32')]);_0x2f2552[_0xb163('0x34')]=_['intersection'](_0x2f2552['model'],_0x2f2552['query']);_0x464234['attributes']=_[_0xb163('0x35')](_0x2f2552[_0xb163('0x30')],qs[_0xb163('0x37')](_0x1409c0[_0xb163('0x32')][_0xb163('0x37')]));_0x464234[_0xb163('0x36')]=_0x464234[_0xb163('0x36')][_0xb163('0x38')]?_0x464234[_0xb163('0x36')]:_0x2f2552[_0xb163('0x30')];if(_0x1409c0['query'][_0xb163('0x40')]){_0x464234[_0xb163('0x45')]=[{'all':!![]}];}_0x464234=_['merge']({},_0x464234,_0x1409c0['options']);return db['AnalyticExtractedReport'][_0xb163('0x46')](_0x464234)[_0xb163('0x25')](handleEntityNotFound(_0x389604,null))[_0xb163('0x25')](respondWithResult(_0x389604,null))[_0xb163('0x47')](handleError(_0x389604,null));};exports[_0xb163('0x48')]=function(_0x33a20c,_0x186ee1){return db[_0xb163('0x2d')]['create'](_0x33a20c['body'],{})[_0xb163('0x25')](function(_0x44a7da){var _0x2288ea=_0x33a20c[_0xb163('0x49')][_0xb163('0x26')]({'plain':!![]});if(!_0x2288ea)throw new Error(_0xb163('0x4a'));if(_0x2288ea['role']==='user'){var _0x11209e=_0x44a7da['get']({'plain':!![]});var _0x964727=_0xb163('0x27');return db['UserProfileSection'][_0xb163('0x46')]({'where':{'name':_0x964727,'userProfileId':_0x2288ea[_0xb163('0x4b')]},'raw':!![]})['then'](function(_0x94d7e2){if(_0x94d7e2&&_0x94d7e2[_0xb163('0x4c')]===0x0){return db[_0xb163('0x4d')][_0xb163('0x48')]({'name':_0x11209e[_0xb163('0x31')],'resourceId':_0x11209e['id'],'type':_0x94d7e2['name'],'sectionId':_0x94d7e2['id']},{})['then'](function(){return _0x44a7da;});}else{return _0x44a7da;}})['catch'](function(_0x42cdb8){logger[_0xb163('0x29')](_0xb163('0x4e'),_0x42cdb8);throw _0x42cdb8;});}return _0x44a7da;})['then'](respondWithResult(_0x186ee1,0xc9))[_0xb163('0x47')](handleError(_0x186ee1,null));};exports[_0xb163('0x4f')]=function(_0x52750b,_0x23779e){if(_0x52750b[_0xb163('0x50')]['id']){delete _0x52750b[_0xb163('0x50')]['id'];}return db[_0xb163('0x2d')][_0xb163('0x46')]({'where':{'id':_0x52750b[_0xb163('0x43')]['id']}})['then'](handleEntityNotFound(_0x23779e,null))[_0xb163('0x25')](saveUpdates(_0x52750b[_0xb163('0x50')],null))[_0xb163('0x25')](respondWithResult(_0x23779e,null))[_0xb163('0x47')](handleError(_0x23779e,null));};exports['destroy']=function(_0x17e821,_0x45ca23){return db['AnalyticExtractedReport'][_0xb163('0x46')]({'where':{'id':_0x17e821['params']['id']}})[_0xb163('0x25')](handleEntityNotFound(_0x45ca23,null))[_0xb163('0x25')](removeEntity(_0x45ca23,null))[_0xb163('0x47')](handleError(_0x45ca23,null));};exports[_0xb163('0x51')]=function(_0x4526f3,_0x530f69,_0x223660){return db[_0xb163('0x2d')][_0xb163('0x46')]({'where':{'id':_0x4526f3['params']['id']},'attributes':[_0xb163('0x31'),'basename',_0xb163('0x52'),_0xb163('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x530f69,null))['then'](function(_0x3fc51d){if(_0x3fc51d){if(!fs['existsSync'](path[_0xb163('0x54')](config[_0xb163('0x55')],_0xb163('0x56'),_0x3fc51d[_0xb163('0x52')]))){throw new db[(_0xb163('0x57'))]['ValidationError'](_0xb163('0x58'));}if(_0x4526f3[_0xb163('0x32')][_0xb163('0x59')]){return _0x530f69[_0xb163('0x1a')](0xc8);}return _0x530f69[_0xb163('0x51')](path[_0xb163('0x54')](config[_0xb163('0x55')],_0xb163('0x56'),_0x3fc51d['savename']),util['format'](_0xb163('0x5a'),_0x3fc51d['basename']||_0x3fc51d[_0xb163('0x31')],_0x3fc51d[_0xb163('0x53')][_0xb163('0x5b')]()));}})['catch'](handleError(_0x530f69,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 0375cbe..00cb0ce 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 _0x42d0=['rimraf','../../config/environment','exports','define','AnalyticExtractedReport','analytics_extracted_reports','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2625ac,_0x3148d2){var _0x5260d6=function(_0x1db396){while(--_0x1db396){_0x2625ac['push'](_0x2625ac['shift']());}};_0x5260d6(++_0x3148d2);}(_0x42d0,0x14a));var _0x042d=function(_0x57b432,_0x1589a0){_0x57b432=_0x57b432-0x0;var _0x2edf2a=_0x42d0[_0x57b432];return _0x2edf2a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x042d('0x0'))(_0x042d('0x1'));var moment=require(_0x042d('0x2'));var BPromise=require(_0x042d('0x3'));var rp=require(_0x042d('0x4'));var fs=require('fs');var path=require(_0x042d('0x5'));var rimraf=require(_0x042d('0x6'));var config=require(_0x042d('0x7'));var attributes=require('./analyticExtractedReport.attributes');module[_0x042d('0x8')]=function(_0x44ca12,_0x2599fa){return _0x44ca12[_0x042d('0x9')](_0x042d('0xa'),attributes,{'tableName':_0x042d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8279=['request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','moment'];(function(_0x4bd882,_0x350341){var _0x2f0513=function(_0x1da504){while(--_0x1da504){_0x4bd882['push'](_0x4bd882['shift']());}};_0x2f0513(++_0x350341);}(_0x8279,0x1a8));var _0x9827=function(_0x3e7851,_0x1ae1c1){_0x3e7851=_0x3e7851-0x0;var _0x2266bf=_0x8279[_0x3e7851];return _0x2266bf;};'use strict';var _=require(_0x9827('0x0'));var util=require(_0x9827('0x1'));var logger=require(_0x9827('0x2'))(_0x9827('0x3'));var moment=require(_0x9827('0x4'));var BPromise=require('bluebird');var rp=require(_0x9827('0x5'));var fs=require('fs');var path=require(_0x9827('0x6'));var rimraf=require(_0x9827('0x7'));var config=require(_0x9827('0x8'));var attributes=require(_0x9827('0x9'));module[_0x9827('0xa')]=function(_0x387267,_0x1e4df8){return _0x387267['define'](_0x9827('0xb'),attributes,{'tableName':_0x9827('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 68cb294..f919075 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 _0x29b1=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','info','message','catch','lodash','util','moment'];(function(_0x4ab617,_0x3ca08f){var _0x42fdd6=function(_0x282ec8){while(--_0x282ec8){_0x4ab617['push'](_0x4ab617['shift']());}};_0x42fdd6(++_0x3ca08f);}(_0x29b1,0x16d));var _0x129b=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x29b1[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x129b('0x0'));var util=require(_0x129b('0x1'));var moment=require(_0x129b('0x2'));var BPromise=require(_0x129b('0x3'));var rs=require(_0x129b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x129b('0x5'))['db'];var utils=require(_0x129b('0x6'));var logger=require(_0x129b('0x7'))(_0x129b('0x8'));var config=require(_0x129b('0x9'));var jayson=require(_0x129b('0xa'));var client=jayson[_0x129b('0xb')][_0x129b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5ce8f9,_0x3ef769,_0x5ac368){return new BPromise(function(_0x2c99a1,_0x1e29d6){return client['request'](_0x5ce8f9,_0x5ac368)[_0x129b('0xd')](function(_0x1abf45){logger['info'](_0x129b('0xe'),_0x3ef769,'request\x20sent');logger[_0x129b('0xf')](_0x129b('0x10'),_0x3ef769,_0x129b('0x11'),JSON['stringify'](_0x1abf45));if(_0x1abf45[_0x129b('0x12')]){if(_0x1abf45[_0x129b('0x12')][_0x129b('0x13')]===0x1f4){logger[_0x129b('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3ef769,_0x1abf45['error']['message']);return _0x1e29d6(_0x1abf45[_0x129b('0x12')]['message']);}logger[_0x129b('0x12')](_0x129b('0xe'),_0x3ef769,_0x1abf45[_0x129b('0x12')]['message']);return _0x2c99a1(_0x1abf45[_0x129b('0x12')]['message']);}else{logger[_0x129b('0x14')](_0x129b('0xe'),_0x3ef769,_0x129b('0x11'));_0x2c99a1(_0x1abf45['result'][_0x129b('0x15')]);}})[_0x129b('0x16')](function(_0x1364f8){logger[_0x129b('0x12')](_0x129b('0xe'),_0x3ef769,_0x1364f8);_0x1e29d6(_0x1364f8);});});} \ No newline at end of file +var _0x4bf4=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring'];(function(_0x539a0a,_0x379a9e){var _0x181e7c=function(_0x33e594){while(--_0x33e594){_0x539a0a['push'](_0x539a0a['shift']());}};_0x181e7c(++_0x379a9e);}(_0x4bf4,0x187));var _0x44bf=function(_0x504108,_0x51ae00){_0x504108=_0x504108-0x0;var _0x1b779d=_0x4bf4[_0x504108];return _0x1b779d;};'use strict';var _=require(_0x44bf('0x0'));var util=require(_0x44bf('0x1'));var moment=require(_0x44bf('0x2'));var BPromise=require(_0x44bf('0x3'));var rs=require(_0x44bf('0x4'));var fs=require('fs');var Redis=require(_0x44bf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x44bf('0x6'));var logger=require(_0x44bf('0x7'))(_0x44bf('0x8'));var config=require('../../config/environment');var jayson=require(_0x44bf('0x9'));var client=jayson[_0x44bf('0xa')][_0x44bf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x294b60,_0x5c91cf,_0x517306){return new BPromise(function(_0x243241,_0x41598e){return client[_0x44bf('0xc')](_0x294b60,_0x517306)['then'](function(_0x440fa3){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x5c91cf,_0x44bf('0xd'));logger[_0x44bf('0xe')](_0x44bf('0xf'),_0x5c91cf,_0x44bf('0xd'),JSON['stringify'](_0x440fa3));if(_0x440fa3['error']){if(_0x440fa3[_0x44bf('0x10')][_0x44bf('0x11')]===0x1f4){logger[_0x44bf('0x10')](_0x44bf('0x12'),_0x5c91cf,_0x440fa3[_0x44bf('0x10')][_0x44bf('0x13')]);return _0x41598e(_0x440fa3[_0x44bf('0x10')][_0x44bf('0x13')]);}logger[_0x44bf('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x5c91cf,_0x440fa3['error']['message']);return _0x243241(_0x440fa3['error'][_0x44bf('0x13')]);}else{logger[_0x44bf('0x14')](_0x44bf('0x12'),_0x5c91cf,_0x44bf('0xd'));_0x243241(_0x440fa3[_0x44bf('0x15')][_0x44bf('0x13')]);}})['catch'](function(_0x1d2742){logger[_0x44bf('0x10')](_0x44bf('0x12'),_0x5c91cf,_0x1d2742);_0x41598e(_0x1d2742);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 01f983d..c7a022e 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 _0x7773=['post','put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','/:id','show','/:id/download','isAuthenticated','download'];(function(_0x4c4632,_0x3cfae1){var _0x2d6500=function(_0x339072){while(--_0x339072){_0x4c4632['push'](_0x4c4632['shift']());}};_0x2d6500(++_0x3cfae1);}(_0x7773,0x15b));var _0x3777=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x7773[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0x3777('0x0'));var util=require('util');var path=require(_0x3777('0x1'));var timeout=require(_0x3777('0x2'));var express=require('express');var router=express[_0x3777('0x3')]();var fs_extra=require(_0x3777('0x4'));var auth=require(_0x3777('0x5'));var interaction=require(_0x3777('0x6'));var config=require('../../config/environment');var controller=require(_0x3777('0x7'));router[_0x3777('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3777('0x8')](_0x3777('0x9'),auth['isAuthenticated'](),controller[_0x3777('0xa')]);router[_0x3777('0x8')](_0x3777('0xb'),auth[_0x3777('0xc')](),controller[_0x3777('0xd')]);router[_0x3777('0xe')]('/',auth[_0x3777('0xc')](),controller['create']);router[_0x3777('0xf')](_0x3777('0x9'),auth[_0x3777('0xc')](),controller['update']);router[_0x3777('0x10')](_0x3777('0x9'),auth[_0x3777('0xc')](),controller[_0x3777('0x11')]);module[_0x3777('0x12')]=router; \ No newline at end of file +var _0x7348=['../../config/environment','./analyticExtractedReport.controller','get','/:id','isAuthenticated','show','download','post','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2ad068,_0x379abc){var _0x5babb6=function(_0x43ab8b){while(--_0x43ab8b){_0x2ad068['push'](_0x2ad068['shift']());}};_0x5babb6(++_0x379abc);}(_0x7348,0x64));var _0x8734=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7348[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x8734('0x0'));var util=require(_0x8734('0x1'));var path=require(_0x8734('0x2'));var timeout=require(_0x8734('0x3'));var express=require(_0x8734('0x4'));var router=express[_0x8734('0x5')]();var fs_extra=require(_0x8734('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8734('0x7'));var config=require(_0x8734('0x8'));var controller=require(_0x8734('0x9'));router[_0x8734('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8734('0xa')](_0x8734('0xb'),auth[_0x8734('0xc')](),controller[_0x8734('0xd')]);router[_0x8734('0xa')]('/:id/download',auth[_0x8734('0xc')](),controller[_0x8734('0xe')]);router[_0x8734('0xf')]('/',auth[_0x8734('0xc')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x8734('0x10')]);router['delete'](_0x8734('0xb'),auth[_0x8734('0xc')](),controller[_0x8734('0x11')]);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 f7c42c6..7ba81e6 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 _0x6bd8=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x6bd8,0x77));var _0x86bd=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x6bd8[_0x474bc0];return _0x4b24cf;};'use strict';var Sequelize=require(_0x86bd('0x0'));module[_0x86bd('0x1')]={'field':{'type':Sequelize[_0x86bd('0x2')]},'alias':{'type':Sequelize[_0x86bd('0x3')]},'function':{'type':Sequelize[_0x86bd('0x3')]},'format':{'type':Sequelize[_0x86bd('0x3')]},'groupBy':{'type':Sequelize[_0x86bd('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xecf0=['TEXT','STRING','BOOLEAN'];(function(_0x46085d,_0x20ee72){var _0x499629=function(_0x152721){while(--_0x152721){_0x46085d['push'](_0x46085d['shift']());}};_0x499629(++_0x20ee72);}(_0xecf0,0x96));var _0x0ecf=function(_0x1444c4,_0x1eeefd){_0x1444c4=_0x1444c4-0x0;var _0x33c549=_0xecf0[_0x1444c4];return _0x33c549;};'use strict';var Sequelize=require('sequelize');module['exports']={'field':{'type':Sequelize[_0x0ecf('0x0')]},'alias':{'type':Sequelize[_0x0ecf('0x1')]},'function':{'type':Sequelize[_0x0ecf('0x1')]},'format':{'type':Sequelize[_0x0ecf('0x1')]},'groupBy':{'type':Sequelize[_0x0ecf('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x0ecf('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index eb82dad..ae433a3 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 _0x231a=['zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','AnalyticFieldReport','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','map','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','length','options','find','create','body','bulkCreate','update','ids','transaction','CustomReportId','eml-format'];(function(_0x5a5c11,_0x358f6b){var _0x5d6ba7=function(_0x272c72){while(--_0x272c72){_0x5a5c11['push'](_0x5a5c11['shift']());}};_0x5d6ba7(++_0x358f6b);}(_0x231a,0x13f));var _0xa231=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x231a[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xa231('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa231('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa231('0x2'));var moment=require(_0xa231('0x3'));var BPromise=require(_0xa231('0x4'));var Mustache=require(_0xa231('0x5'));var util=require('util');var path=require(_0xa231('0x6'));var sox=require(_0xa231('0x7'));var csv=require(_0xa231('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa231('0x9'));var squel=require('squel');var crypto=require(_0xa231('0xa'));var jsforce=require(_0xa231('0xb'));var deskjs=require(_0xa231('0xc'));var toCsv=require(_0xa231('0x8'));var querystring=require(_0xa231('0xd'));var Papa=require(_0xa231('0xe'));var Redis=require(_0xa231('0xf'));var authService=require(_0xa231('0x10'));var qs=require(_0xa231('0x11'));var as=require(_0xa231('0x12'));var hardwareService=require(_0xa231('0x13'));var logger=require(_0xa231('0x14'))('api');var utils=require(_0xa231('0x15'));var config=require(_0xa231('0x16'));var licenseUtil=require(_0xa231('0x17'));var db=require(_0xa231('0x18'))['db'];function respondWithStatusCode(_0x428baa,_0x47bb8c){_0x47bb8c=_0x47bb8c||0xcc;return function(_0x3bfbc2){if(_0x3bfbc2){return _0x428baa[_0xa231('0x19')](_0x47bb8c);}return _0x428baa[_0xa231('0x1a')](_0x47bb8c)[_0xa231('0x1b')]();};}function respondWithResult(_0x2c73a8,_0x151f58){_0x151f58=_0x151f58||0xc8;return function(_0x632119){if(_0x632119){return _0x2c73a8['status'](_0x151f58)[_0xa231('0x1c')](_0x632119);}};}function respondWithFilteredResult(_0x1547c6,_0x1fba6a){return function(_0x57b02f){if(_0x57b02f){var _0x5f2d02=typeof _0x1fba6a[_0xa231('0x1d')]===_0xa231('0x1e')&&typeof _0x1fba6a['limit']===_0xa231('0x1e');var _0x4e4bc0=_0x57b02f[_0xa231('0x1f')];var _0xaa813c=_0x5f2d02?0x0:_0x1fba6a[_0xa231('0x1d')];var _0x463558=_0x5f2d02?_0x57b02f[_0xa231('0x1f')]:_0x1fba6a[_0xa231('0x1d')]+_0x1fba6a[_0xa231('0x20')];var _0x5a9eb5;if(_0x463558>=_0x4e4bc0){_0x463558=_0x4e4bc0;_0x5a9eb5=0xc8;}else{_0x5a9eb5=0xce;}_0x1547c6[_0xa231('0x1a')](_0x5a9eb5);return _0x1547c6[_0xa231('0x21')](_0xa231('0x22'),_0xaa813c+'-'+_0x463558+'/'+_0x4e4bc0)[_0xa231('0x1c')](_0x57b02f);}return null;};}function patchUpdates(_0x112aba){return function(_0x526ab1){try{jsonpatch[_0xa231('0x23')](_0x526ab1,_0x112aba,!![]);}catch(_0x5e723f){return BPromise[_0xa231('0x24')](_0x5e723f);}return _0x526ab1[_0xa231('0x25')]();};}function saveUpdates(_0x4dc970,_0x39301b){return function(_0x3c3b3b){if(_0x3c3b3b){return _0x3c3b3b['update'](_0x4dc970)[_0xa231('0x26')](function(_0x52abc1){return _0x52abc1;});}return null;};}function removeEntity(_0x190bb0,_0x410256){return function(_0x5522ac){if(_0x5522ac){return _0x5522ac[_0xa231('0x27')]()['then'](function(){_0x190bb0['status'](0xcc)[_0xa231('0x1b')]();});}};}function handleEntityNotFound(_0x1a3b8d,_0x53ff42){return function(_0x1f20a8){if(!_0x1f20a8){_0x1a3b8d[_0xa231('0x19')](0x194);}return _0x1f20a8;};}function handleError(_0x2286e9,_0x57fa2a){_0x57fa2a=_0x57fa2a||0x1f4;return function(_0x12bac0){logger[_0xa231('0x28')](_0x12bac0[_0xa231('0x29')]);if(_0x12bac0[_0xa231('0x2a')]){delete _0x12bac0['name'];}_0x2286e9[_0xa231('0x1a')](_0x57fa2a)['send'](_0x12bac0);};}exports[_0xa231('0x2b')]=function(_0x389594,_0x224625){var _0x232671={},_0x19cc76={},_0x2c3f4f={'count':0x0,'rows':[]};var _0x20f812=_['map'](db[_0xa231('0x2c')]['rawAttributes'],function(_0x5a382c){return{'name':_0x5a382c['fieldName'],'type':_0x5a382c['type'][_0xa231('0x2d')]};});_0x19cc76[_0xa231('0x2e')]=_['map'](_0x20f812,_0xa231('0x2a'));_0x19cc76[_0xa231('0x2f')]=_[_0xa231('0x30')](_0x389594[_0xa231('0x2f')]);_0x19cc76[_0xa231('0x31')]=_[_0xa231('0x32')](_0x19cc76[_0xa231('0x2e')],_0x19cc76[_0xa231('0x2f')]);_0x232671[_0xa231('0x33')]=_[_0xa231('0x32')](_0x19cc76[_0xa231('0x2e')],qs['fields'](_0x389594['query'][_0xa231('0x34')]));_0x232671[_0xa231('0x33')]=_0x232671[_0xa231('0x33')]['length']?_0x232671[_0xa231('0x33')]:_0x19cc76[_0xa231('0x2e')];if(!_0x389594['query'][_0xa231('0x35')](_0xa231('0x36'))){_0x232671[_0xa231('0x20')]=qs['limit'](_0x389594[_0xa231('0x2f')][_0xa231('0x20')]);_0x232671[_0xa231('0x1d')]=qs[_0xa231('0x1d')](_0x389594['query'][_0xa231('0x1d')]);}_0x232671[_0xa231('0x37')]=qs['sort'](_0x389594['query']['sort']);_0x232671[_0xa231('0x38')]=qs[_0xa231('0x31')](_[_0xa231('0x39')](_0x389594['query'],_0x19cc76['filters']),_0x20f812);if(_0x389594[_0xa231('0x2f')][_0xa231('0x3a')]){_0x232671[_0xa231('0x38')]=_[_0xa231('0x3b')](_0x232671['where'],{'$or':_[_0xa231('0x3c')](_0x20f812,function(_0x847a68){if(_0x847a68[_0xa231('0x3d')]!==_0xa231('0x3e')){var _0x578676={};_0x578676[_0x847a68[_0xa231('0x2a')]]={'$like':'%'+_0x389594[_0xa231('0x2f')][_0xa231('0x3a')]+'%'};return _0x578676;}})});}_0x232671=_['merge']({},_0x232671,_0x389594['options']);var _0xd51c57={'where':_0x232671['where']};return db[_0xa231('0x2c')][_0xa231('0x1f')](_0xd51c57)[_0xa231('0x26')](function(_0x10a63a){_0x2c3f4f['count']=_0x10a63a;if(_0x389594[_0xa231('0x2f')][_0xa231('0x3f')]){_0x232671[_0xa231('0x40')]=[{'all':!![]}];}return db[_0xa231('0x2c')][_0xa231('0x41')](_0x232671);})[_0xa231('0x26')](function(_0x239818){_0x2c3f4f[_0xa231('0x42')]=_0x239818;return _0x2c3f4f;})[_0xa231('0x26')](respondWithFilteredResult(_0x224625,_0x232671))[_0xa231('0x43')](handleError(_0x224625,null));};exports['show']=function(_0x320671,_0x14eb41){var _0x2b872c={'raw':![],'where':{'id':_0x320671[_0xa231('0x44')]['id']}},_0x1bbe23={};_0x1bbe23[_0xa231('0x2e')]=_['keys'](db[_0xa231('0x2c')][_0xa231('0x45')]);_0x1bbe23[_0xa231('0x2f')]=_['keys'](_0x320671['query']);_0x1bbe23[_0xa231('0x31')]=_[_0xa231('0x32')](_0x1bbe23[_0xa231('0x2e')],_0x1bbe23[_0xa231('0x2f')]);_0x2b872c[_0xa231('0x33')]=_[_0xa231('0x32')](_0x1bbe23[_0xa231('0x2e')],qs['fields'](_0x320671[_0xa231('0x2f')][_0xa231('0x34')]));_0x2b872c['attributes']=_0x2b872c['attributes'][_0xa231('0x46')]?_0x2b872c[_0xa231('0x33')]:_0x1bbe23[_0xa231('0x2e')];if(_0x320671[_0xa231('0x2f')][_0xa231('0x3f')]){_0x2b872c[_0xa231('0x40')]=[{'all':!![]}];}_0x2b872c=_[_0xa231('0x3b')]({},_0x2b872c,_0x320671[_0xa231('0x47')]);return db[_0xa231('0x2c')][_0xa231('0x48')](_0x2b872c)[_0xa231('0x26')](handleEntityNotFound(_0x14eb41,null))[_0xa231('0x26')](respondWithResult(_0x14eb41,null))['catch'](handleError(_0x14eb41,null));};exports['create']=function(_0x5cded8,_0x4d0f54){return db[_0xa231('0x2c')][_0xa231('0x49')](_0x5cded8[_0xa231('0x4a')],{})['then'](respondWithResult(_0x4d0f54,0xc9))[_0xa231('0x43')](handleError(_0x4d0f54,null));};exports[_0xa231('0x4b')]=function(_0x2e6c81,_0x3ab142){return db[_0xa231('0x2c')]['bulkCreate'](_0x2e6c81['body'],{'raw':![],'individualHooks':!![]})[_0xa231('0x26')](respondWithResult(_0x3ab142,0xc9))['catch'](handleError(_0x3ab142,null));};exports[_0xa231('0x4c')]=function(_0x375e7f,_0x233d81){if(_0x375e7f[_0xa231('0x4a')]['id']){delete _0x375e7f['body']['id'];}return db[_0xa231('0x2c')][_0xa231('0x48')]({'where':{'id':_0x375e7f['params']['id']}})[_0xa231('0x26')](handleEntityNotFound(_0x233d81,null))[_0xa231('0x26')](saveUpdates(_0x375e7f[_0xa231('0x4a')],null))[_0xa231('0x26')](respondWithResult(_0x233d81,null))[_0xa231('0x43')](handleError(_0x233d81,null));};exports[_0xa231('0x27')]=function(_0x1f5d3c,_0x161e6c){return db[_0xa231('0x2c')]['find']({'where':{'id':_0x1f5d3c['params']['id']}})[_0xa231('0x26')](handleEntityNotFound(_0x161e6c,null))[_0xa231('0x26')](removeEntity(_0x161e6c,null))['catch'](handleError(_0x161e6c,null));};exports['bulkDestroy']=function(_0x2e2a48,_0x4728c1){return db[_0xa231('0x2c')][_0xa231('0x27')]({'where':{'id':_0x2e2a48[_0xa231('0x2f')][_0xa231('0x4d')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4728c1,0xcc))[_0xa231('0x43')](handleError(_0x4728c1,null));};exports['addFields']=function(_0x2f8e1d,_0x4b3976,_0x224dd2){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x2f8e1d[_0xa231('0x44')]['id']}})['then'](handleEntityNotFound(_0x4b3976,null))[_0xa231('0x26')](function(_0x1d5841){if(_0x1d5841){return db['sequelize'][_0xa231('0x4e')](function(_0x1a2a57){return db[_0xa231('0x2c')]['destroy']({'where':{'CustomReportId':_0x2f8e1d[_0xa231('0x44')]['id']},'transaction':_0x1a2a57})[_0xa231('0x26')](function(_0x5e5504){var _0x134b09=_[_0xa231('0x3c')](_0x2f8e1d[_0xa231('0x4a')],function(_0x39ca8a){delete _0x39ca8a['id'];_0x39ca8a[_0xa231('0x4f')]=_0x2f8e1d[_0xa231('0x44')]['id'];return _0x39ca8a;});return db[_0xa231('0x2c')][_0xa231('0x4b')](_0x134b09,{'transaction':_0x1a2a57});});})[_0xa231('0x26')](function(){return db['AnalyticFieldReport'][_0xa231('0x41')]({'where':{'CustomReportId':_0x2f8e1d[_0xa231('0x44')]['id']}});});}})[_0xa231('0x26')](respondWithResult(_0x4b3976,null))['catch'](handleError(_0x4b3976,null));}; \ No newline at end of file +var _0xf8b9=['query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','options','AnalyticFieldReport','include','rows','catch','show','params','length','includeAll','find','create','body','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','bulkCreate','findAll','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','rawAttributes','type','key','model','map'];(function(_0x123fa1,_0xdc2246){var _0x3cce9c=function(_0x19da16){while(--_0x19da16){_0x123fa1['push'](_0x123fa1['shift']());}};_0x3cce9c(++_0xdc2246);}(_0xf8b9,0x11a));var _0x9f8b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf8b9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9f8b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9f8b('0x1'));var BPromise=require(_0x9f8b('0x2'));var Mustache=require(_0x9f8b('0x3'));var util=require(_0x9f8b('0x4'));var path=require(_0x9f8b('0x5'));var sox=require(_0x9f8b('0x6'));var csv=require(_0x9f8b('0x7'));var ejs=require(_0x9f8b('0x8'));var fs=require('fs');var fs_extra=require(_0x9f8b('0x9'));var _=require(_0x9f8b('0xa'));var squel=require('squel');var crypto=require(_0x9f8b('0xb'));var jsforce=require(_0x9f8b('0xc'));var deskjs=require(_0x9f8b('0xd'));var toCsv=require(_0x9f8b('0x7'));var querystring=require('querystring');var Papa=require(_0x9f8b('0xe'));var Redis=require(_0x9f8b('0xf'));var authService=require(_0x9f8b('0x10'));var qs=require(_0x9f8b('0x11'));var as=require(_0x9f8b('0x12'));var hardwareService=require(_0x9f8b('0x13'));var logger=require(_0x9f8b('0x14'))(_0x9f8b('0x15'));var utils=require(_0x9f8b('0x16'));var config=require(_0x9f8b('0x17'));var licenseUtil=require(_0x9f8b('0x18'));var db=require(_0x9f8b('0x19'))['db'];function respondWithStatusCode(_0x508e14,_0x57dd09){_0x57dd09=_0x57dd09||0xcc;return function(_0x3d978f){if(_0x3d978f){return _0x508e14[_0x9f8b('0x1a')](_0x57dd09);}return _0x508e14[_0x9f8b('0x1b')](_0x57dd09)[_0x9f8b('0x1c')]();};}function respondWithResult(_0x41e8de,_0x266ed6){_0x266ed6=_0x266ed6||0xc8;return function(_0x310aa3){if(_0x310aa3){return _0x41e8de[_0x9f8b('0x1b')](_0x266ed6)[_0x9f8b('0x1d')](_0x310aa3);}};}function respondWithFilteredResult(_0x11fec6,_0x5c6660){return function(_0x502381){if(_0x502381){var _0x135526=typeof _0x5c6660[_0x9f8b('0x1e')]===_0x9f8b('0x1f')&&typeof _0x5c6660[_0x9f8b('0x20')]==='undefined';var _0x3e3bcf=_0x502381['count'];var _0x10a7d0=_0x135526?0x0:_0x5c6660[_0x9f8b('0x1e')];var _0x2a58eb=_0x135526?_0x502381[_0x9f8b('0x21')]:_0x5c6660[_0x9f8b('0x1e')]+_0x5c6660[_0x9f8b('0x20')];var _0x591cc9;if(_0x2a58eb>=_0x3e3bcf){_0x2a58eb=_0x3e3bcf;_0x591cc9=0xc8;}else{_0x591cc9=0xce;}_0x11fec6[_0x9f8b('0x1b')](_0x591cc9);return _0x11fec6[_0x9f8b('0x22')](_0x9f8b('0x23'),_0x10a7d0+'-'+_0x2a58eb+'/'+_0x3e3bcf)['json'](_0x502381);}return null;};}function patchUpdates(_0x382950){return function(_0x217b94){try{jsonpatch[_0x9f8b('0x24')](_0x217b94,_0x382950,!![]);}catch(_0x532c13){return BPromise['reject'](_0x532c13);}return _0x217b94[_0x9f8b('0x25')]();};}function saveUpdates(_0x3ad66e,_0x433418){return function(_0x4d3110){if(_0x4d3110){return _0x4d3110[_0x9f8b('0x26')](_0x3ad66e)[_0x9f8b('0x27')](function(_0x26565f){return _0x26565f;});}return null;};}function removeEntity(_0x54ea91,_0x103396){return function(_0x27c08e){if(_0x27c08e){return _0x27c08e[_0x9f8b('0x28')]()[_0x9f8b('0x27')](function(){_0x54ea91[_0x9f8b('0x1b')](0xcc)[_0x9f8b('0x1c')]();});}};}function handleEntityNotFound(_0x269bc0,_0x503a0d){return function(_0x1cac91){if(!_0x1cac91){_0x269bc0[_0x9f8b('0x1a')](0x194);}return _0x1cac91;};}function handleError(_0x3d959f,_0x503f64){_0x503f64=_0x503f64||0x1f4;return function(_0x4f53b3){logger[_0x9f8b('0x29')](_0x4f53b3['stack']);if(_0x4f53b3[_0x9f8b('0x2a')]){delete _0x4f53b3['name'];}_0x3d959f['status'](_0x503f64)[_0x9f8b('0x2b')](_0x4f53b3);};}exports[_0x9f8b('0x2c')]=function(_0x21be23,_0x94cd8e){var _0x29a8a5={},_0xd10922={},_0x34ad2b={'count':0x0,'rows':[]};var _0xa594f5=_['map'](db['AnalyticFieldReport'][_0x9f8b('0x2d')],function(_0x4c9cad){return{'name':_0x4c9cad['fieldName'],'type':_0x4c9cad[_0x9f8b('0x2e')][_0x9f8b('0x2f')]};});_0xd10922[_0x9f8b('0x30')]=_[_0x9f8b('0x31')](_0xa594f5,_0x9f8b('0x2a'));_0xd10922[_0x9f8b('0x32')]=_[_0x9f8b('0x33')](_0x21be23[_0x9f8b('0x32')]);_0xd10922[_0x9f8b('0x34')]=_[_0x9f8b('0x35')](_0xd10922[_0x9f8b('0x30')],_0xd10922[_0x9f8b('0x32')]);_0x29a8a5['attributes']=_[_0x9f8b('0x35')](_0xd10922[_0x9f8b('0x30')],qs[_0x9f8b('0x36')](_0x21be23[_0x9f8b('0x32')]['fields']));_0x29a8a5['attributes']=_0x29a8a5[_0x9f8b('0x37')]['length']?_0x29a8a5[_0x9f8b('0x37')]:_0xd10922[_0x9f8b('0x30')];if(!_0x21be23[_0x9f8b('0x32')]['hasOwnProperty'](_0x9f8b('0x38'))){_0x29a8a5['limit']=qs['limit'](_0x21be23[_0x9f8b('0x32')][_0x9f8b('0x20')]);_0x29a8a5[_0x9f8b('0x1e')]=qs[_0x9f8b('0x1e')](_0x21be23['query'][_0x9f8b('0x1e')]);}_0x29a8a5[_0x9f8b('0x39')]=qs[_0x9f8b('0x3a')](_0x21be23[_0x9f8b('0x32')][_0x9f8b('0x3a')]);_0x29a8a5[_0x9f8b('0x3b')]=qs[_0x9f8b('0x34')](_['pick'](_0x21be23[_0x9f8b('0x32')],_0xd10922['filters']),_0xa594f5);if(_0x21be23[_0x9f8b('0x32')][_0x9f8b('0x3c')]){_0x29a8a5['where']=_[_0x9f8b('0x3d')](_0x29a8a5[_0x9f8b('0x3b')],{'$or':_[_0x9f8b('0x31')](_0xa594f5,function(_0x74be4f){if(_0x74be4f[_0x9f8b('0x2e')]!==_0x9f8b('0x3e')){var _0x56205c={};_0x56205c[_0x74be4f[_0x9f8b('0x2a')]]={'$like':'%'+_0x21be23[_0x9f8b('0x32')][_0x9f8b('0x3c')]+'%'};return _0x56205c;}})});}_0x29a8a5=_[_0x9f8b('0x3d')]({},_0x29a8a5,_0x21be23[_0x9f8b('0x3f')]);var _0x137eb9={'where':_0x29a8a5['where']};return db[_0x9f8b('0x40')]['count'](_0x137eb9)[_0x9f8b('0x27')](function(_0x2410e5){_0x34ad2b['count']=_0x2410e5;if(_0x21be23[_0x9f8b('0x32')]['includeAll']){_0x29a8a5[_0x9f8b('0x41')]=[{'all':!![]}];}return db[_0x9f8b('0x40')]['findAll'](_0x29a8a5);})[_0x9f8b('0x27')](function(_0x2fed4c){_0x34ad2b[_0x9f8b('0x42')]=_0x2fed4c;return _0x34ad2b;})[_0x9f8b('0x27')](respondWithFilteredResult(_0x94cd8e,_0x29a8a5))[_0x9f8b('0x43')](handleError(_0x94cd8e,null));};exports[_0x9f8b('0x44')]=function(_0x37e0c0,_0x1211c6){var _0x347f22={'raw':![],'where':{'id':_0x37e0c0[_0x9f8b('0x45')]['id']}},_0x430d10={};_0x430d10['model']=_[_0x9f8b('0x33')](db['AnalyticFieldReport'][_0x9f8b('0x2d')]);_0x430d10[_0x9f8b('0x32')]=_[_0x9f8b('0x33')](_0x37e0c0[_0x9f8b('0x32')]);_0x430d10[_0x9f8b('0x34')]=_[_0x9f8b('0x35')](_0x430d10[_0x9f8b('0x30')],_0x430d10[_0x9f8b('0x32')]);_0x347f22[_0x9f8b('0x37')]=_['intersection'](_0x430d10[_0x9f8b('0x30')],qs[_0x9f8b('0x36')](_0x37e0c0[_0x9f8b('0x32')][_0x9f8b('0x36')]));_0x347f22[_0x9f8b('0x37')]=_0x347f22['attributes'][_0x9f8b('0x46')]?_0x347f22[_0x9f8b('0x37')]:_0x430d10[_0x9f8b('0x30')];if(_0x37e0c0[_0x9f8b('0x32')][_0x9f8b('0x47')]){_0x347f22[_0x9f8b('0x41')]=[{'all':!![]}];}_0x347f22=_[_0x9f8b('0x3d')]({},_0x347f22,_0x37e0c0[_0x9f8b('0x3f')]);return db['AnalyticFieldReport'][_0x9f8b('0x48')](_0x347f22)[_0x9f8b('0x27')](handleEntityNotFound(_0x1211c6,null))[_0x9f8b('0x27')](respondWithResult(_0x1211c6,null))[_0x9f8b('0x43')](handleError(_0x1211c6,null));};exports[_0x9f8b('0x49')]=function(_0x3029e3,_0x20c2fd){return db[_0x9f8b('0x40')][_0x9f8b('0x49')](_0x3029e3[_0x9f8b('0x4a')],{})[_0x9f8b('0x27')](respondWithResult(_0x20c2fd,0xc9))[_0x9f8b('0x43')](handleError(_0x20c2fd,null));};exports['bulkCreate']=function(_0x114c59,_0x27b687){return db[_0x9f8b('0x40')]['bulkCreate'](_0x114c59['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x27b687,0xc9))[_0x9f8b('0x43')](handleError(_0x27b687,null));};exports[_0x9f8b('0x26')]=function(_0x2c13cb,_0x385fc2){if(_0x2c13cb[_0x9f8b('0x4a')]['id']){delete _0x2c13cb[_0x9f8b('0x4a')]['id'];}return db[_0x9f8b('0x40')][_0x9f8b('0x48')]({'where':{'id':_0x2c13cb['params']['id']}})[_0x9f8b('0x27')](handleEntityNotFound(_0x385fc2,null))[_0x9f8b('0x27')](saveUpdates(_0x2c13cb['body'],null))[_0x9f8b('0x27')](respondWithResult(_0x385fc2,null))[_0x9f8b('0x43')](handleError(_0x385fc2,null));};exports[_0x9f8b('0x28')]=function(_0x4e1e6c,_0x32072d){return db[_0x9f8b('0x40')]['find']({'where':{'id':_0x4e1e6c[_0x9f8b('0x45')]['id']}})[_0x9f8b('0x27')](handleEntityNotFound(_0x32072d,null))[_0x9f8b('0x27')](removeEntity(_0x32072d,null))['catch'](handleError(_0x32072d,null));};exports[_0x9f8b('0x4b')]=function(_0x1e6603,_0x2d313b){return db[_0x9f8b('0x40')]['destroy']({'where':{'id':_0x1e6603['query'][_0x9f8b('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x9f8b('0x27')](respondWithResult(_0x2d313b,0xcc))[_0x9f8b('0x43')](handleError(_0x2d313b,null));};exports[_0x9f8b('0x4d')]=function(_0x3dea1d,_0x1cbb59,_0x4587b9){return db[_0x9f8b('0x4e')]['findOne']({'where':{'id':_0x3dea1d[_0x9f8b('0x45')]['id']}})[_0x9f8b('0x27')](handleEntityNotFound(_0x1cbb59,null))[_0x9f8b('0x27')](function(_0x482cea){if(_0x482cea){return db[_0x9f8b('0x4f')][_0x9f8b('0x50')](function(_0x17f94e){return db[_0x9f8b('0x40')]['destroy']({'where':{'CustomReportId':_0x3dea1d[_0x9f8b('0x45')]['id']},'transaction':_0x17f94e})['then'](function(_0x325d1b){var _0x299c87=_[_0x9f8b('0x31')](_0x3dea1d[_0x9f8b('0x4a')],function(_0x153261){delete _0x153261['id'];_0x153261['CustomReportId']=_0x3dea1d['params']['id'];return _0x153261;});return db[_0x9f8b('0x40')][_0x9f8b('0x51')](_0x299c87,{'transaction':_0x17f94e});});})[_0x9f8b('0x27')](function(){return db[_0x9f8b('0x40')][_0x9f8b('0x52')]({'where':{'CustomReportId':_0x3dea1d['params']['id']}});});}})[_0x9f8b('0x27')](respondWithResult(_0x1cbb59,null))[_0x9f8b('0x43')](handleError(_0x1cbb59,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 8eba15b..da2a664 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 _0xd357=['./analyticFieldReport.attributes','exports','analytics_report_fields','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x478c8a,_0x9afc92){var _0x3b6b3e=function(_0x37634e){while(--_0x37634e){_0x478c8a['push'](_0x478c8a['shift']());}};_0x3b6b3e(++_0x9afc92);}(_0xd357,0x66));var _0x7d35=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd357[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x7d35('0x0'));var util=require(_0x7d35('0x1'));var logger=require(_0x7d35('0x2'))(_0x7d35('0x3'));var moment=require('moment');var BPromise=require(_0x7d35('0x4'));var rp=require(_0x7d35('0x5'));var fs=require('fs');var path=require(_0x7d35('0x6'));var rimraf=require('rimraf');var config=require(_0x7d35('0x7'));var attributes=require(_0x7d35('0x8'));module[_0x7d35('0x9')]=function(_0x1f8612,_0x1538e6){return _0x1f8612['define']('AnalyticFieldReport',attributes,{'tableName':_0x7d35('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe800=['../../config/logger','moment','bluebird','rimraf','../../config/environment','exports','analytics_report_fields','lodash','util'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xe800,0x193));var _0x0e80=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xe800[_0xa8883];return _0x479426;};'use strict';var _=require(_0x0e80('0x0'));var util=require(_0x0e80('0x1'));var logger=require(_0x0e80('0x2'))('api');var moment=require(_0x0e80('0x3'));var BPromise=require(_0x0e80('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0e80('0x5'));var config=require(_0x0e80('0x6'));var attributes=require('./analyticFieldReport.attributes');module[_0x0e80('0x7')]=function(_0x1a77b4,_0xb89f6f){return _0x1a77b4['define']('AnalyticFieldReport',attributes,{'tableName':_0x0e80('0x8'),'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 bbb225c..961a7cd 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 _0x3001=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x14d896,_0x53578b){var _0x28679a=function(_0x14921f){while(--_0x14921f){_0x14d896['push'](_0x14d896['shift']());}};_0x28679a(++_0x53578b);}(_0x3001,0x176));var _0x1300=function(_0x3c8f21,_0x3e9631){_0x3c8f21=_0x3c8f21-0x0;var _0x16ffb9=_0x3001[_0x3c8f21];return _0x16ffb9;};'use strict';var _=require(_0x1300('0x0'));var util=require(_0x1300('0x1'));var moment=require('moment');var BPromise=require(_0x1300('0x2'));var rs=require(_0x1300('0x3'));var fs=require('fs');var Redis=require(_0x1300('0x4'));var db=require(_0x1300('0x5'))['db'];var utils=require(_0x1300('0x6'));var logger=require(_0x1300('0x7'))('rpc');var config=require(_0x1300('0x8'));var jayson=require(_0x1300('0x9'));var client=jayson[_0x1300('0xa')][_0x1300('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e8abd,_0x5bcd36,_0x3558ee){return new BPromise(function(_0x1ad955,_0x19ba4b){return client[_0x1300('0xc')](_0x2e8abd,_0x3558ee)[_0x1300('0xd')](function(_0x118ad3){logger[_0x1300('0xe')](_0x1300('0xf'),_0x5bcd36,_0x1300('0x10'));logger[_0x1300('0x11')](_0x1300('0x12'),_0x5bcd36,_0x1300('0x10'),JSON['stringify'](_0x118ad3));if(_0x118ad3[_0x1300('0x13')]){if(_0x118ad3[_0x1300('0x13')]['code']===0x1f4){logger['error'](_0x1300('0xf'),_0x5bcd36,_0x118ad3['error'][_0x1300('0x14')]);return _0x19ba4b(_0x118ad3['error'][_0x1300('0x14')]);}logger[_0x1300('0x13')](_0x1300('0xf'),_0x5bcd36,_0x118ad3[_0x1300('0x13')]['message']);return _0x1ad955(_0x118ad3[_0x1300('0x13')][_0x1300('0x14')]);}else{logger[_0x1300('0xe')](_0x1300('0xf'),_0x5bcd36,'request\x20sent');_0x1ad955(_0x118ad3[_0x1300('0x15')][_0x1300('0x14')]);}})['catch'](function(_0x81b0fc){logger[_0x1300('0x13')](_0x1300('0xf'),_0x5bcd36,_0x81b0fc);_0x19ba4b(_0x81b0fc);});});} \ No newline at end of file +var _0x30eb=['request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','AnalyticFieldReport,\x20%s,\x20%s'];(function(_0x7334fc,_0x56beef){var _0x4c096c=function(_0x4940d1){while(--_0x4940d1){_0x7334fc['push'](_0x7334fc['shift']());}};_0x4c096c(++_0x56beef);}(_0x30eb,0xce));var _0xb30e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x30eb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb30e('0x0'));var util=require(_0xb30e('0x1'));var moment=require(_0xb30e('0x2'));var BPromise=require(_0xb30e('0x3'));var rs=require(_0xb30e('0x4'));var fs=require('fs');var Redis=require(_0xb30e('0x5'));var db=require(_0xb30e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb30e('0x7'))(_0xb30e('0x8'));var config=require(_0xb30e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb30e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x342910,_0x158fa0,_0x49802f){return new BPromise(function(_0x1b769e,_0x1c6bba){return client[_0xb30e('0xb')](_0x342910,_0x49802f)[_0xb30e('0xc')](function(_0xf80c00){logger['info'](_0xb30e('0xd'),_0x158fa0,_0xb30e('0xe'));logger[_0xb30e('0xf')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x158fa0,_0xb30e('0xe'),JSON[_0xb30e('0x10')](_0xf80c00));if(_0xf80c00[_0xb30e('0x11')]){if(_0xf80c00[_0xb30e('0x11')][_0xb30e('0x12')]===0x1f4){logger[_0xb30e('0x11')](_0xb30e('0xd'),_0x158fa0,_0xf80c00['error'][_0xb30e('0x13')]);return _0x1c6bba(_0xf80c00[_0xb30e('0x11')][_0xb30e('0x13')]);}logger[_0xb30e('0x11')](_0xb30e('0xd'),_0x158fa0,_0xf80c00[_0xb30e('0x11')][_0xb30e('0x13')]);return _0x1b769e(_0xf80c00[_0xb30e('0x11')]['message']);}else{logger[_0xb30e('0x14')](_0xb30e('0xd'),_0x158fa0,_0xb30e('0xe'));_0x1b769e(_0xf80c00[_0xb30e('0x15')][_0xb30e('0x13')]);}})['catch'](function(_0xc5afe7){logger[_0xb30e('0x11')](_0xb30e('0xd'),_0x158fa0,_0xc5afe7);_0x1c6bba(_0xc5afe7);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 6f58945..f7f494a 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(_0x517d72,_0xd5a53){var _0x17c037=function(_0x35c116){while(--_0x35c116){_0x517d72['push'](_0x517d72['shift']());}};_0x17c037(++_0xd5a53);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x2e6840,_0x450b55){var _0x232853=function(_0x75383f){while(--_0x75383f){_0x2e6840['push'](_0x2e6840['shift']());}};_0x232853(++_0x450b55);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 5a74430..303a5e9 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 _0x21f8=['STRING','name','TEXT','sequelize','exports'];(function(_0x44606e,_0x2bf244){var _0xe68388=function(_0x488a30){while(--_0x488a30){_0x44606e['push'](_0x44606e['shift']());}};_0xe68388(++_0x2bf244);}(_0x21f8,0x71));var _0x821f=function(_0x466af7,_0x2f7551){_0x466af7=_0x466af7-0x0;var _0x348c96=_0x21f8[_0x466af7];return _0x348c96;};'use strict';var Sequelize=require(_0x821f('0x0'));module[_0x821f('0x1')]={'name':{'type':Sequelize[_0x821f('0x2')],'allowNull':![],'unique':_0x821f('0x3')},'table':{'type':Sequelize[_0x821f('0x2')]},'metric':{'type':Sequelize[_0x821f('0x4')]},'description':{'type':Sequelize[_0x821f('0x2')]}}; \ No newline at end of file +var _0xc3b7=['exports','STRING','name','TEXT'];(function(_0x2a5f59,_0x5172d1){var _0x31ffb2=function(_0x1a5d81){while(--_0x1a5d81){_0x2a5f59['push'](_0x2a5f59['shift']());}};_0x31ffb2(++_0x5172d1);}(_0xc3b7,0xb4));var _0x7c3b=function(_0x1d21a3,_0x419f71){_0x1d21a3=_0x1d21a3-0x0;var _0x2b6136=_0xc3b7[_0x1d21a3];return _0x2b6136;};'use strict';var Sequelize=require('sequelize');module[_0x7c3b('0x0')]={'name':{'type':Sequelize[_0x7c3b('0x1')],'allowNull':![],'unique':_0x7c3b('0x2')},'table':{'type':Sequelize[_0x7c3b('0x1')]},'metric':{'type':Sequelize[_0x7c3b('0x3')]},'description':{'type':Sequelize[_0x7c3b('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index ed3c5c7..836b727 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 _0x46ed=['where','pick','filter','merge','map','type','options','count','includeAll','include','findAll','rows','params','keys','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','set','Content-Range','json','apply','reject','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x3beff9,_0x536707){var _0x458844=function(_0x28a5a9){while(--_0x28a5a9){_0x3beff9['push'](_0x3beff9['shift']());}};_0x458844(++_0x536707);}(_0x46ed,0x168));var _0xd46e=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x46ed[_0x599f41];return _0x2e4d58;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=typeof _0x44a620[_0xd46e('0x1c')]==='undefined'&&typeof _0x44a620[_0xd46e('0x1d')]===_0xd46e('0x1e');var _0x3583a5=_0x417402['count'];var _0x5ddd04=_0x3d72ce?0x0:_0x44a620[_0xd46e('0x1c')];var _0x1bd574=_0x3d72ce?_0x417402['count']:_0x44a620['offset']+_0x44a620[_0xd46e('0x1d')];var _0x2f2571;if(_0x1bd574>=_0x3583a5){_0x1bd574=_0x3583a5;_0x2f2571=0xc8;}else{_0x2f2571=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x2f2571);return _0x3b6d25[_0xd46e('0x1f')](_0xd46e('0x20'),_0x5ddd04+'-'+_0x1bd574+'/'+_0x3583a5)[_0xd46e('0x21')](_0x417402);}return null;};}function patchUpdates(_0x3b5fa4){return function(_0x327b7e){try{jsonpatch[_0xd46e('0x22')](_0x327b7e,_0x3b5fa4,!![]);}catch(_0x3c7e91){return BPromise[_0xd46e('0x23')](_0x3c7e91);}return _0x327b7e['save']();};}function saveUpdates(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')](_0x259072)[_0xd46e('0x25')](function(_0xc1af7f){return _0xc1af7f;});}return null;};}function removeEntity(_0x33c2e0,_0x8a1be){return function(_0x62dea5){if(_0x62dea5){return _0x62dea5['destroy']()[_0xd46e('0x25')](function(){var _0x5424e5=_0x62dea5['get']({'plain':!![]});var _0x371054=_0xd46e('0x26');return db[_0xd46e('0x27')][_0xd46e('0x28')]({'where':{'type':_0x371054,'resourceId':_0x5424e5['id']}})[_0xd46e('0x25')](function(){return _0x62dea5;});})[_0xd46e('0x25')](function(){_0x33c2e0[_0xd46e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45d789,_0x3c301a){return function(_0xddbce9){if(!_0xddbce9){_0x45d789[_0xd46e('0x1a')](0x194);}return _0xddbce9;};}function handleError(_0x96f15c,_0x16e941){_0x16e941=_0x16e941||0x1f4;return function(_0x58aeef){logger[_0xd46e('0x29')](_0x58aeef[_0xd46e('0x2a')]);if(_0x58aeef[_0xd46e('0x2b')]){delete _0x58aeef[_0xd46e('0x2b')];}_0x96f15c[_0xd46e('0x1b')](_0x16e941)[_0xd46e('0x2c')](_0x58aeef);};}exports[_0xd46e('0x2d')]=function(_0x2c5ec7,_0x18f060){var _0x45ea47={},_0x2ff785={},_0x504324={'count':0x0,'rows':[]};var _0x2f4a1b=_['map'](db[_0xd46e('0x2e')][_0xd46e('0x2f')],function(_0x4f5718){return{'name':_0x4f5718[_0xd46e('0x30')],'type':_0x4f5718['type'][_0xd46e('0x31')]};});_0x2ff785[_0xd46e('0x32')]=_['map'](_0x2f4a1b,_0xd46e('0x2b'));_0x2ff785[_0xd46e('0x33')]=_['keys'](_0x2c5ec7[_0xd46e('0x33')]);_0x2ff785[_0xd46e('0x34')]=_[_0xd46e('0x35')](_0x2ff785['model'],_0x2ff785['query']);_0x45ea47[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x2ff785[_0xd46e('0x32')],qs[_0xd46e('0x37')](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x37')]));_0x45ea47[_0xd46e('0x36')]=_0x45ea47[_0xd46e('0x36')]['length']?_0x45ea47[_0xd46e('0x36')]:_0x2ff785[_0xd46e('0x32')];if(!_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x38')](_0xd46e('0x39'))){_0x45ea47[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x2c5ec7['query'][_0xd46e('0x1d')]);_0x45ea47[_0xd46e('0x1c')]=qs['offset'](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x1c')]);}_0x45ea47[_0xd46e('0x3a')]=qs[_0xd46e('0x3b')](_0x2c5ec7['query'][_0xd46e('0x3b')]);_0x45ea47[_0xd46e('0x3c')]=qs[_0xd46e('0x34')](_[_0xd46e('0x3d')](_0x2c5ec7[_0xd46e('0x33')],_0x2ff785[_0xd46e('0x34')]),_0x2f4a1b);if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x3e')]){_0x45ea47['where']=_[_0xd46e('0x3f')](_0x45ea47[_0xd46e('0x3c')],{'$or':_[_0xd46e('0x40')](_0x2f4a1b,function(_0x25657a){if(_0x25657a[_0xd46e('0x41')]!=='VIRTUAL'){var _0x964c66={};_0x964c66[_0x25657a['name']]={'$like':'%'+_0x2c5ec7['query']['filter']+'%'};return _0x964c66;}})});}_0x45ea47=_['merge']({},_0x45ea47,_0x2c5ec7[_0xd46e('0x42')]);var _0x54949f={'where':_0x45ea47[_0xd46e('0x3c')]};return db[_0xd46e('0x2e')]['count'](_0x54949f)[_0xd46e('0x25')](function(_0x4114e6){_0x504324[_0xd46e('0x43')]=_0x4114e6;if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x44')]){_0x45ea47[_0xd46e('0x45')]=[{'all':!![]}];}return db[_0xd46e('0x2e')][_0xd46e('0x46')](_0x45ea47);})[_0xd46e('0x25')](function(_0xec367d){_0x504324[_0xd46e('0x47')]=_0xec367d;return _0x504324;})['then'](respondWithFilteredResult(_0x18f060,_0x45ea47))['catch'](handleError(_0x18f060,null));};exports['show']=function(_0x2b4a5a,_0x4e1d94){var _0x168d35={'raw':!![],'where':{'id':_0x2b4a5a[_0xd46e('0x48')]['id']}},_0x272f5f={};_0x272f5f[_0xd46e('0x32')]=_[_0xd46e('0x49')](db[_0xd46e('0x2e')][_0xd46e('0x2f')]);_0x272f5f[_0xd46e('0x33')]=_['keys'](_0x2b4a5a[_0xd46e('0x33')]);_0x272f5f['filters']=_[_0xd46e('0x35')](_0x272f5f[_0xd46e('0x32')],_0x272f5f[_0xd46e('0x33')]);_0x168d35[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x272f5f['model'],qs[_0xd46e('0x37')](_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x37')]));_0x168d35[_0xd46e('0x36')]=_0x168d35[_0xd46e('0x36')]['length']?_0x168d35[_0xd46e('0x36')]:_0x272f5f[_0xd46e('0x32')];if(_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x44')]){_0x168d35[_0xd46e('0x45')]=[{'all':!![]}];}_0x168d35=_['merge']({},_0x168d35,_0x2b4a5a[_0xd46e('0x42')]);return db[_0xd46e('0x2e')][_0xd46e('0x4a')](_0x168d35)[_0xd46e('0x25')](handleEntityNotFound(_0x4e1d94,null))[_0xd46e('0x25')](respondWithResult(_0x4e1d94,null))[_0xd46e('0x4b')](handleError(_0x4e1d94,null));};exports[_0xd46e('0x4c')]=function(_0x440dcc,_0x5188f6){return db[_0xd46e('0x2e')][_0xd46e('0x4c')](_0x440dcc[_0xd46e('0x4d')],{})[_0xd46e('0x25')](function(_0x1f1941){var _0x4e84c8=_0x440dcc['user'][_0xd46e('0x4e')]({'plain':!![]});if(!_0x4e84c8)throw new Error(_0xd46e('0x4f'));if(_0x4e84c8[_0xd46e('0x50')]==='user'){var _0x479711=_0x1f1941[_0xd46e('0x4e')]({'plain':!![]});var _0x9d8638='Metrics';return db[_0xd46e('0x51')][_0xd46e('0x4a')]({'where':{'name':_0x9d8638,'userProfileId':_0x4e84c8[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x25')](function(_0x1bd8a5){if(_0x1bd8a5&&_0x1bd8a5[_0xd46e('0x53')]===0x0){return db[_0xd46e('0x27')][_0xd46e('0x4c')]({'name':_0x479711['name'],'resourceId':_0x479711['id'],'type':_0x1bd8a5[_0xd46e('0x2b')],'sectionId':_0x1bd8a5['id']},{})[_0xd46e('0x25')](function(){return _0x1f1941;});}else{return _0x1f1941;}})[_0xd46e('0x4b')](function(_0x63ee74){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x63ee74);throw _0x63ee74;});}return _0x1f1941;})[_0xd46e('0x25')](respondWithResult(_0x5188f6,0xc9))['catch'](handleError(_0x5188f6,null));};exports[_0xd46e('0x24')]=function(_0x2af20b,_0x393cb9){if(_0x2af20b[_0xd46e('0x4d')]['id']){delete _0x2af20b[_0xd46e('0x4d')]['id'];}return db[_0xd46e('0x2e')]['find']({'where':{'id':_0x2af20b[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x393cb9,null))[_0xd46e('0x25')](saveUpdates(_0x2af20b['body'],null))[_0xd46e('0x25')](respondWithResult(_0x393cb9,null))[_0xd46e('0x4b')](handleError(_0x393cb9,null));};exports[_0xd46e('0x28')]=function(_0x2042d4,_0x1886e6){return db[_0xd46e('0x2e')][_0xd46e('0x4a')]({'where':{'id':_0x2042d4[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x1886e6,null))[_0xd46e('0x25')](removeEntity(_0x1886e6,null))[_0xd46e('0x4b')](handleError(_0x1886e6,null));}; \ No newline at end of file +var _0x1cb9=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','show','params','keys','length','find','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x49f56f,_0x2bf8ec){_0x49f56f=_0x49f56f-0x0;var _0x155a01=_0x1cb9[_0x49f56f];return _0x155a01;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){var _0x7ad361=_0x2447e7[_0x91cb('0x27')]({'plain':!![]});var _0x423c4f=_0x91cb('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x423c4f,'resourceId':_0x7ad361['id']}})[_0x91cb('0x25')](function(){return _0x2447e7;});})['then'](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x318031,_0x5595c5){return function(_0x9b26a6){if(!_0x9b26a6){_0x318031['sendStatus'](0x194);}return _0x9b26a6;};}function handleError(_0x4572f6,_0x308e8c){_0x308e8c=_0x308e8c||0x1f4;return function(_0x3b3ee6){logger[_0x91cb('0x29')](_0x3b3ee6[_0x91cb('0x2a')]);if(_0x3b3ee6['name']){delete _0x3b3ee6[_0x91cb('0x2b')];}_0x4572f6['status'](_0x308e8c)[_0x91cb('0x2c')](_0x3b3ee6);};}exports[_0x91cb('0x2d')]=function(_0x445fe1,_0x4944bd){var _0x775c25={},_0x146e1f={},_0x25bbf9={'count':0x0,'rows':[]};var _0x361e4c=_[_0x91cb('0x2e')](db[_0x91cb('0x2f')][_0x91cb('0x30')],function(_0x3bbde3){return{'name':_0x3bbde3[_0x91cb('0x31')],'type':_0x3bbde3['type'][_0x91cb('0x32')]};});_0x146e1f[_0x91cb('0x33')]=_[_0x91cb('0x2e')](_0x361e4c,_0x91cb('0x2b'));_0x146e1f[_0x91cb('0x34')]=_['keys'](_0x445fe1[_0x91cb('0x34')]);_0x146e1f[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x146e1f[_0x91cb('0x33')],_0x146e1f[_0x91cb('0x34')]);_0x775c25['attributes']=_[_0x91cb('0x36')](_0x146e1f['model'],qs['fields'](_0x445fe1['query'][_0x91cb('0x37')]));_0x775c25['attributes']=_0x775c25[_0x91cb('0x38')]['length']?_0x775c25['attributes']:_0x146e1f[_0x91cb('0x33')];if(!_0x445fe1[_0x91cb('0x34')][_0x91cb('0x39')](_0x91cb('0x3a'))){_0x775c25[_0x91cb('0x1d')]=qs['limit'](_0x445fe1[_0x91cb('0x34')][_0x91cb('0x1d')]);_0x775c25[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x445fe1['query']['offset']);}_0x775c25[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_0x445fe1['query'][_0x91cb('0x3c')]);_0x775c25[_0x91cb('0x3d')]=qs['filters'](_[_0x91cb('0x3e')](_0x445fe1[_0x91cb('0x34')],_0x146e1f['filters']),_0x361e4c);if(_0x445fe1[_0x91cb('0x34')]['filter']){_0x775c25[_0x91cb('0x3d')]=_[_0x91cb('0x3f')](_0x775c25[_0x91cb('0x3d')],{'$or':_[_0x91cb('0x2e')](_0x361e4c,function(_0x51d0ea){if(_0x51d0ea[_0x91cb('0x40')]!=='VIRTUAL'){var _0xa90111={};_0xa90111[_0x51d0ea[_0x91cb('0x2b')]]={'$like':'%'+_0x445fe1['query'][_0x91cb('0x41')]+'%'};return _0xa90111;}})});}_0x775c25=_['merge']({},_0x775c25,_0x445fe1[_0x91cb('0x42')]);var _0x2eac87={'where':_0x775c25[_0x91cb('0x3d')]};return db[_0x91cb('0x2f')]['count'](_0x2eac87)[_0x91cb('0x25')](function(_0x5af0e6){_0x25bbf9[_0x91cb('0x1e')]=_0x5af0e6;if(_0x445fe1[_0x91cb('0x34')][_0x91cb('0x43')]){_0x775c25[_0x91cb('0x44')]=[{'all':!![]}];}return db[_0x91cb('0x2f')][_0x91cb('0x45')](_0x775c25);})[_0x91cb('0x25')](function(_0x3cc4c1){_0x25bbf9['rows']=_0x3cc4c1;return _0x25bbf9;})[_0x91cb('0x25')](respondWithFilteredResult(_0x4944bd,_0x775c25))['catch'](handleError(_0x4944bd,null));};exports[_0x91cb('0x46')]=function(_0x5537a0,_0x335879){var _0x52e82c={'raw':!![],'where':{'id':_0x5537a0[_0x91cb('0x47')]['id']}},_0x138f48={};_0x138f48[_0x91cb('0x33')]=_[_0x91cb('0x48')](db['AnalyticMetric'][_0x91cb('0x30')]);_0x138f48[_0x91cb('0x34')]=_['keys'](_0x5537a0[_0x91cb('0x34')]);_0x138f48[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],_0x138f48[_0x91cb('0x34')]);_0x52e82c[_0x91cb('0x38')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],qs[_0x91cb('0x37')](_0x5537a0['query'][_0x91cb('0x37')]));_0x52e82c[_0x91cb('0x38')]=_0x52e82c[_0x91cb('0x38')][_0x91cb('0x49')]?_0x52e82c[_0x91cb('0x38')]:_0x138f48[_0x91cb('0x33')];if(_0x5537a0[_0x91cb('0x34')][_0x91cb('0x43')]){_0x52e82c['include']=[{'all':!![]}];}_0x52e82c=_[_0x91cb('0x3f')]({},_0x52e82c,_0x5537a0[_0x91cb('0x42')]);return db[_0x91cb('0x2f')][_0x91cb('0x4a')](_0x52e82c)['then'](handleEntityNotFound(_0x335879,null))[_0x91cb('0x25')](respondWithResult(_0x335879,null))[_0x91cb('0x4b')](handleError(_0x335879,null));};exports['create']=function(_0x212473,_0x47cdb7){return db[_0x91cb('0x2f')]['create'](_0x212473['body'],{})['then'](function(_0x98245b){var _0xff3d11=_0x212473[_0x91cb('0x4c')][_0x91cb('0x27')]({'plain':!![]});if(!_0xff3d11)throw new Error(_0x91cb('0x4d'));if(_0xff3d11['role']==='user'){var _0x1d26b8=_0x98245b[_0x91cb('0x27')]({'plain':!![]});var _0x140994=_0x91cb('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x140994,'userProfileId':_0xff3d11['userProfileId']},'raw':!![]})[_0x91cb('0x25')](function(_0x490417){if(_0x490417&&_0x490417[_0x91cb('0x4e')]===0x0){return db['UserProfileResource'][_0x91cb('0x4f')]({'name':_0x1d26b8[_0x91cb('0x2b')],'resourceId':_0x1d26b8['id'],'type':_0x490417[_0x91cb('0x2b')],'sectionId':_0x490417['id']},{})[_0x91cb('0x25')](function(){return _0x98245b;});}else{return _0x98245b;}})[_0x91cb('0x4b')](function(_0x362532){logger[_0x91cb('0x29')](_0x91cb('0x50'),_0x362532);throw _0x362532;});}return _0x98245b;})[_0x91cb('0x25')](respondWithResult(_0x47cdb7,0xc9))[_0x91cb('0x4b')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x24')]=function(_0x5752ed,_0x1e445a){if(_0x5752ed[_0x91cb('0x51')]['id']){delete _0x5752ed['body']['id'];}return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x5752ed['params']['id']}})[_0x91cb('0x25')](handleEntityNotFound(_0x1e445a,null))[_0x91cb('0x25')](saveUpdates(_0x5752ed[_0x91cb('0x51')],null))[_0x91cb('0x25')](respondWithResult(_0x1e445a,null))[_0x91cb('0x4b')](handleError(_0x1e445a,null));};exports[_0x91cb('0x26')]=function(_0x1d4b96,_0x274fff){return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x1d4b96[_0x91cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x274fff,null))[_0x91cb('0x25')](removeEntity(_0x274fff,null))['catch'](handleError(_0x274fff,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index e749805..2237544 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 _0x44e8=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash'];(function(_0x9c8c83,_0x16ebdd){var _0x4636ac=function(_0x5bacfc){while(--_0x5bacfc){_0x9c8c83['push'](_0x9c8c83['shift']());}};_0x4636ac(++_0x16ebdd);}(_0x44e8,0xd7));var _0x844e=function(_0x5ac847,_0x30f119){_0x5ac847=_0x5ac847-0x0;var _0x2d5b0c=_0x44e8[_0x5ac847];return _0x2d5b0c;};'use strict';var _=require(_0x844e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x844e('0x1'));var moment=require(_0x844e('0x2'));var BPromise=require(_0x844e('0x3'));var rp=require(_0x844e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x844e('0x5'));var config=require(_0x844e('0x6'));var attributes=require(_0x844e('0x7'));module[_0x844e('0x8')]=function(_0x5c8f67,_0x2f6539){return _0x5c8f67[_0x844e('0x9')](_0x844e('0xa'),attributes,{'tableName':_0x844e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0272=['request-promise','path','rimraf','exports','lodash','util','api','moment','bluebird'];(function(_0x1ac77b,_0x10ee7a){var _0x161584=function(_0x5a810d){while(--_0x5a810d){_0x1ac77b['push'](_0x1ac77b['shift']());}};_0x161584(++_0x10ee7a);}(_0x0272,0x15a));var _0x2027=function(_0x1b6ae2,_0x4f2f15){_0x1b6ae2=_0x1b6ae2-0x0;var _0xccb53f=_0x0272[_0x1b6ae2];return _0xccb53f;};'use strict';var _=require(_0x2027('0x0'));var util=require(_0x2027('0x1'));var logger=require('../../config/logger')(_0x2027('0x2'));var moment=require(_0x2027('0x3'));var BPromise=require(_0x2027('0x4'));var rp=require(_0x2027('0x5'));var fs=require('fs');var path=require(_0x2027('0x6'));var rimraf=require(_0x2027('0x7'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0x2027('0x8')]=function(_0x1ea303,_0x2deefc){return _0x1ea303['define']('AnalyticMetric',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 c209306..df33abc 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 _0xae32=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5a1cc9,_0x28f54d){var _0x471761=function(_0xda51c0){while(--_0xda51c0){_0x5a1cc9['push'](_0x5a1cc9['shift']());}};_0x471761(++_0x28f54d);}(_0xae32,0x14a));var _0x2ae3=function(_0x1e13a9,_0x56b389){_0x1e13a9=_0x1e13a9-0x0;var _0x37b7b4=_0xae32[_0x1e13a9];return _0x37b7b4;};'use strict';var _=require(_0x2ae3('0x0'));var util=require(_0x2ae3('0x1'));var moment=require(_0x2ae3('0x2'));var BPromise=require(_0x2ae3('0x3'));var rs=require(_0x2ae3('0x4'));var fs=require('fs');var Redis=require(_0x2ae3('0x5'));var db=require(_0x2ae3('0x6'))['db'];var utils=require(_0x2ae3('0x7'));var logger=require('../../config/logger')(_0x2ae3('0x8'));var config=require('../../config/environment');var jayson=require(_0x2ae3('0x9'));var client=jayson[_0x2ae3('0xa')][_0x2ae3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1188fc,_0x5b69d6,_0x10ce52){return new BPromise(function(_0x51391d,_0x43cd40){return client[_0x2ae3('0xc')](_0x1188fc,_0x10ce52)[_0x2ae3('0xd')](function(_0x436d61){logger['info'](_0x2ae3('0xe'),_0x5b69d6,_0x2ae3('0xf'));logger['debug'](_0x2ae3('0x10'),_0x5b69d6,_0x2ae3('0xf'),JSON[_0x2ae3('0x11')](_0x436d61));if(_0x436d61['error']){if(_0x436d61[_0x2ae3('0x12')][_0x2ae3('0x13')]===0x1f4){logger[_0x2ae3('0x12')](_0x2ae3('0xe'),_0x5b69d6,_0x436d61['error'][_0x2ae3('0x14')]);return _0x43cd40(_0x436d61[_0x2ae3('0x12')][_0x2ae3('0x14')]);}logger[_0x2ae3('0x12')](_0x2ae3('0xe'),_0x5b69d6,_0x436d61[_0x2ae3('0x12')]['message']);return _0x51391d(_0x436d61[_0x2ae3('0x12')]['message']);}else{logger[_0x2ae3('0x15')]('AnalyticMetric,\x20%s,\x20%s',_0x5b69d6,_0x2ae3('0xf'));_0x51391d(_0x436d61[_0x2ae3('0x16')][_0x2ae3('0x14')]);}})[_0x2ae3('0x17')](function(_0x1dc019){logger[_0x2ae3('0x12')](_0x2ae3('0xe'),_0x5b69d6,_0x1dc019);_0x43cd40(_0x1dc019);});});} \ No newline at end of file +var _0xce84=['randomstring','ioredis','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3dc1d8,_0x47221a){var _0x33f5fb=function(_0x356b98){while(--_0x356b98){_0x3dc1d8['push'](_0x3dc1d8['shift']());}};_0x33f5fb(++_0x47221a);}(_0xce84,0x1e0));var _0x4ce8=function(_0x895a8,_0x543b1a){_0x895a8=_0x895a8-0x0;var _0x3e6c30=_0xce84[_0x895a8];return _0x3e6c30;};'use strict';var _=require(_0x4ce8('0x0'));var util=require(_0x4ce8('0x1'));var moment=require(_0x4ce8('0x2'));var BPromise=require(_0x4ce8('0x3'));var rs=require(_0x4ce8('0x4'));var fs=require('fs');var Redis=require(_0x4ce8('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4ce8('0x6'));var jayson=require(_0x4ce8('0x7'));var client=jayson[_0x4ce8('0x8')][_0x4ce8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ed3d9,_0x586a71,_0x4ff769){return new BPromise(function(_0x1491a1,_0x8c9d28){return client[_0x4ce8('0xa')](_0x3ed3d9,_0x4ff769)[_0x4ce8('0xb')](function(_0x1c7ec5){logger[_0x4ce8('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x586a71,_0x4ce8('0xd'));logger[_0x4ce8('0xe')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x586a71,_0x4ce8('0xd'),JSON[_0x4ce8('0xf')](_0x1c7ec5));if(_0x1c7ec5[_0x4ce8('0x10')]){if(_0x1c7ec5[_0x4ce8('0x10')][_0x4ce8('0x11')]===0x1f4){logger['error'](_0x4ce8('0x12'),_0x586a71,_0x1c7ec5[_0x4ce8('0x10')][_0x4ce8('0x13')]);return _0x8c9d28(_0x1c7ec5['error']['message']);}logger[_0x4ce8('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x586a71,_0x1c7ec5[_0x4ce8('0x10')][_0x4ce8('0x13')]);return _0x1491a1(_0x1c7ec5[_0x4ce8('0x10')][_0x4ce8('0x13')]);}else{logger[_0x4ce8('0xc')](_0x4ce8('0x12'),_0x586a71,_0x4ce8('0xd'));_0x1491a1(_0x1c7ec5[_0x4ce8('0x14')][_0x4ce8('0x13')]);}})[_0x4ce8('0x15')](function(_0x12aa0a){logger['error'](_0x4ce8('0x12'),_0x586a71,_0x12aa0a);_0x8c9d28(_0x12aa0a);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 1bb64c6..a6d3614 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 _0x29b1=['./analyticMetric.controller','get','isAuthenticated','show','create','/:id','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x29b1,0x13b));var _0x129b=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x29b1[_0x50007c];return _0x5c1ec7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x129b('0x0'));var timeout=require(_0x129b('0x1'));var express=require(_0x129b('0x2'));var router=express[_0x129b('0x3')]();var fs_extra=require(_0x129b('0x4'));var auth=require(_0x129b('0x5'));var interaction=require(_0x129b('0x6'));var config=require(_0x129b('0x7'));var controller=require(_0x129b('0x8'));router[_0x129b('0x9')]('/',auth[_0x129b('0xa')](),controller['index']);router[_0x129b('0x9')]('/:id',auth[_0x129b('0xa')](),controller[_0x129b('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x129b('0xc')]);router['put'](_0x129b('0xd'),auth[_0x129b('0xa')](),controller[_0x129b('0xe')]);router[_0x129b('0xf')](_0x129b('0xd'),auth[_0x129b('0xa')](),controller['destroy']);module[_0x129b('0x10')]=router; \ No newline at end of file +var _0xea44=['put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x37c9e,_0x5bb916){var _0x124e0b=function(_0x473869){while(--_0x473869){_0x37c9e['push'](_0x37c9e['shift']());}};_0x124e0b(++_0x5bb916);}(_0xea44,0x1a5));var _0x4ea4=function(_0x3c7b6c,_0x49ff86){_0x3c7b6c=_0x3c7b6c-0x0;var _0x128fe2=_0xea44[_0x3c7b6c];return _0x128fe2;};'use strict';var multer=require(_0x4ea4('0x0'));var util=require(_0x4ea4('0x1'));var path=require(_0x4ea4('0x2'));var timeout=require(_0x4ea4('0x3'));var express=require('express');var router=express[_0x4ea4('0x4')]();var fs_extra=require(_0x4ea4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4ea4('0x6'));var config=require(_0x4ea4('0x7'));var controller=require(_0x4ea4('0x8'));router[_0x4ea4('0x9')]('/',auth['isAuthenticated'](),controller[_0x4ea4('0xa')]);router[_0x4ea4('0x9')](_0x4ea4('0xb'),auth[_0x4ea4('0xc')](),controller[_0x4ea4('0xd')]);router[_0x4ea4('0xe')]('/',auth[_0x4ea4('0xc')](),controller[_0x4ea4('0xf')]);router[_0x4ea4('0x10')]('/:id',auth[_0x4ea4('0xc')](),controller['update']);router['delete'](_0x4ea4('0xb'),auth['isAuthenticated'](),controller[_0x4ea4('0x11')]);module[_0x4ea4('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 1f9d4ac..842f1df 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 _0xcb18=['TEXT'];(function(_0x2d1971,_0x20b764){var _0x4d7759=function(_0x56a550){while(--_0x56a550){_0x2d1971['push'](_0x2d1971['shift']());}};_0x4d7759(++_0x20b764);}(_0xcb18,0x159));var _0x8cb1=function(_0x2a8762,_0x438905){_0x2a8762=_0x2a8762-0x0;var _0xa10688=_0xcb18[_0x2a8762];return _0xa10688;};'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize[_0x8cb1('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x0e6b=['sequelize','TEXT'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x0e6b,0xf0));var _0xb0e6=function(_0x1e2080,_0x53283b){_0x1e2080=_0x1e2080-0x0;var _0x260111=_0x0e6b[_0x1e2080];return _0x260111;};'use strict';var Sequelize=require(_0xb0e6('0x0'));module['exports']={'tree':{'type':Sequelize[_0xb0e6('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 38ab29f..048449b 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 _0x54ac=['params','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','type','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','options','include','AnalyticTreeReport','findAll','rows','keys','includeAll','find','catch','create','body'];(function(_0x3d3dea,_0x52a739){var _0x3856d7=function(_0x41e7d9){while(--_0x41e7d9){_0x3d3dea['push'](_0x3d3dea['shift']());}};_0x3856d7(++_0x52a739);}(_0x54ac,0x119));var _0xc54a=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x54ac[_0x468b0f];return _0x3e74d9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc54a('0x0'));var zipdir=require(_0xc54a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc54a('0x2'));var moment=require(_0xc54a('0x3'));var BPromise=require(_0xc54a('0x4'));var Mustache=require(_0xc54a('0x5'));var util=require(_0xc54a('0x6'));var path=require(_0xc54a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc54a('0x8'));var _=require(_0xc54a('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc54a('0xa'));var deskjs=require(_0xc54a('0xb'));var toCsv=require(_0xc54a('0xc'));var querystring=require(_0xc54a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc54a('0xe'));var as=require(_0xc54a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc54a('0x10'))(_0xc54a('0x11'));var utils=require(_0xc54a('0x12'));var config=require(_0xc54a('0x13'));var licenseUtil=require(_0xc54a('0x14'));var db=require(_0xc54a('0x15'))['db'];function respondWithStatusCode(_0x4878a6,_0x11ca9a){_0x11ca9a=_0x11ca9a||0xcc;return function(_0x29ec97){if(_0x29ec97){return _0x4878a6[_0xc54a('0x16')](_0x11ca9a);}return _0x4878a6[_0xc54a('0x17')](_0x11ca9a)[_0xc54a('0x18')]();};}function respondWithResult(_0x28caad,_0x36b744){_0x36b744=_0x36b744||0xc8;return function(_0x3d9b84){if(_0x3d9b84){return _0x28caad[_0xc54a('0x17')](_0x36b744)[_0xc54a('0x19')](_0x3d9b84);}};}function respondWithFilteredResult(_0x5b4ca1,_0x57b9cb){return function(_0x296c68){if(_0x296c68){var _0x5366b4=typeof _0x57b9cb['offset']===_0xc54a('0x1a')&&typeof _0x57b9cb[_0xc54a('0x1b')]===_0xc54a('0x1a');var _0x56a26b=_0x296c68['count'];var _0x4a20a0=_0x5366b4?0x0:_0x57b9cb[_0xc54a('0x1c')];var _0x5ec213=_0x5366b4?_0x296c68[_0xc54a('0x1d')]:_0x57b9cb[_0xc54a('0x1c')]+_0x57b9cb['limit'];var _0x4737b1;if(_0x5ec213>=_0x56a26b){_0x5ec213=_0x56a26b;_0x4737b1=0xc8;}else{_0x4737b1=0xce;}_0x5b4ca1['status'](_0x4737b1);return _0x5b4ca1[_0xc54a('0x1e')](_0xc54a('0x1f'),_0x4a20a0+'-'+_0x5ec213+'/'+_0x56a26b)[_0xc54a('0x19')](_0x296c68);}return null;};}function patchUpdates(_0x4b6ef7){return function(_0x5b5219){try{jsonpatch[_0xc54a('0x20')](_0x5b5219,_0x4b6ef7,!![]);}catch(_0x1909e1){return BPromise[_0xc54a('0x21')](_0x1909e1);}return _0x5b5219[_0xc54a('0x22')]();};}function saveUpdates(_0x32732a,_0x57da65){return function(_0x4dd545){if(_0x4dd545){return _0x4dd545[_0xc54a('0x23')](_0x32732a)['then'](function(_0x5ada58){return _0x5ada58;});}return null;};}function removeEntity(_0x5db9e3,_0x207761){return function(_0x5a053c){if(_0x5a053c){return _0x5a053c[_0xc54a('0x24')]()[_0xc54a('0x25')](function(){_0x5db9e3[_0xc54a('0x17')](0xcc)[_0xc54a('0x18')]();});}};}function handleEntityNotFound(_0x17c760,_0x2758a7){return function(_0x49c270){if(!_0x49c270){_0x17c760['sendStatus'](0x194);}return _0x49c270;};}function handleError(_0x54ed4a,_0x73d946){_0x73d946=_0x73d946||0x1f4;return function(_0x8c6ee7){logger[_0xc54a('0x26')](_0x8c6ee7['stack']);if(_0x8c6ee7['name']){delete _0x8c6ee7[_0xc54a('0x27')];}_0x54ed4a['status'](_0x73d946)[_0xc54a('0x28')](_0x8c6ee7);};}exports[_0xc54a('0x29')]=function(_0x17ceec,_0x57f309){var _0x29e947={},_0x78408f={},_0x5c14ce={'count':0x0,'rows':[]};var _0x2ba50a=_['map'](db['AnalyticTreeReport']['rawAttributes'],function(_0xe38342){return{'name':_0xe38342['fieldName'],'type':_0xe38342[_0xc54a('0x2a')]['key']};});_0x78408f[_0xc54a('0x2b')]=_[_0xc54a('0x2c')](_0x2ba50a,_0xc54a('0x27'));_0x78408f[_0xc54a('0x2d')]=_['keys'](_0x17ceec[_0xc54a('0x2d')]);_0x78408f['filters']=_[_0xc54a('0x2e')](_0x78408f[_0xc54a('0x2b')],_0x78408f['query']);_0x29e947['attributes']=_['intersection'](_0x78408f[_0xc54a('0x2b')],qs[_0xc54a('0x2f')](_0x17ceec[_0xc54a('0x2d')][_0xc54a('0x2f')]));_0x29e947[_0xc54a('0x30')]=_0x29e947[_0xc54a('0x30')][_0xc54a('0x31')]?_0x29e947[_0xc54a('0x30')]:_0x78408f[_0xc54a('0x2b')];if(!_0x17ceec[_0xc54a('0x2d')][_0xc54a('0x32')](_0xc54a('0x33'))){_0x29e947[_0xc54a('0x1b')]=qs['limit'](_0x17ceec['query'][_0xc54a('0x1b')]);_0x29e947[_0xc54a('0x1c')]=qs[_0xc54a('0x1c')](_0x17ceec['query'][_0xc54a('0x1c')]);}_0x29e947[_0xc54a('0x34')]=qs['sort'](_0x17ceec[_0xc54a('0x2d')][_0xc54a('0x35')]);_0x29e947[_0xc54a('0x36')]=qs['filters'](_[_0xc54a('0x37')](_0x17ceec['query'],_0x78408f[_0xc54a('0x38')]),_0x2ba50a);if(_0x17ceec['query'][_0xc54a('0x39')]){_0x29e947[_0xc54a('0x36')]=_['merge'](_0x29e947[_0xc54a('0x36')],{'$or':_[_0xc54a('0x2c')](_0x2ba50a,function(_0x1c90b7){if(_0x1c90b7['type']!=='VIRTUAL'){var _0x2e7dc4={};_0x2e7dc4[_0x1c90b7[_0xc54a('0x27')]]={'$like':'%'+_0x17ceec[_0xc54a('0x2d')][_0xc54a('0x39')]+'%'};return _0x2e7dc4;}})});}_0x29e947=_['merge']({},_0x29e947,_0x17ceec[_0xc54a('0x3a')]);var _0x3e665a={'where':_0x29e947['where']};return db['AnalyticTreeReport']['count'](_0x3e665a)['then'](function(_0x2725ba){_0x5c14ce['count']=_0x2725ba;if(_0x17ceec['query']['includeAll']){_0x29e947[_0xc54a('0x3b')]=[{'all':!![]}];}return db[_0xc54a('0x3c')][_0xc54a('0x3d')](_0x29e947);})[_0xc54a('0x25')](function(_0x3fb4bc){_0x5c14ce[_0xc54a('0x3e')]=_0x3fb4bc;return _0x5c14ce;})[_0xc54a('0x25')](respondWithFilteredResult(_0x57f309,_0x29e947))['catch'](handleError(_0x57f309,null));};exports['show']=function(_0x567bbe,_0x1bef8a){var _0xfa60d3={'raw':!![],'where':{'id':_0x567bbe['params']['id']}},_0x4c2544={};_0x4c2544[_0xc54a('0x2b')]=_['keys'](db['AnalyticTreeReport']['rawAttributes']);_0x4c2544[_0xc54a('0x2d')]=_[_0xc54a('0x3f')](_0x567bbe['query']);_0x4c2544['filters']=_['intersection'](_0x4c2544[_0xc54a('0x2b')],_0x4c2544[_0xc54a('0x2d')]);_0xfa60d3[_0xc54a('0x30')]=_[_0xc54a('0x2e')](_0x4c2544['model'],qs['fields'](_0x567bbe[_0xc54a('0x2d')][_0xc54a('0x2f')]));_0xfa60d3['attributes']=_0xfa60d3[_0xc54a('0x30')]['length']?_0xfa60d3['attributes']:_0x4c2544[_0xc54a('0x2b')];if(_0x567bbe[_0xc54a('0x2d')][_0xc54a('0x40')]){_0xfa60d3[_0xc54a('0x3b')]=[{'all':!![]}];}_0xfa60d3=_['merge']({},_0xfa60d3,_0x567bbe['options']);return db[_0xc54a('0x3c')][_0xc54a('0x41')](_0xfa60d3)['then'](handleEntityNotFound(_0x1bef8a,null))[_0xc54a('0x25')](respondWithResult(_0x1bef8a,null))[_0xc54a('0x42')](handleError(_0x1bef8a,null));};exports[_0xc54a('0x43')]=function(_0x3af2c2,_0x50e520){return db['AnalyticTreeReport'][_0xc54a('0x43')](_0x3af2c2['body'],{})[_0xc54a('0x25')](respondWithResult(_0x50e520,0xc9))[_0xc54a('0x42')](handleError(_0x50e520,null));};exports[_0xc54a('0x23')]=function(_0x3eb462,_0x17d58c){if(_0x3eb462[_0xc54a('0x44')]['id']){delete _0x3eb462[_0xc54a('0x44')]['id'];}return db['AnalyticTreeReport'][_0xc54a('0x41')]({'where':{'id':_0x3eb462['params']['id']}})['then'](handleEntityNotFound(_0x17d58c,null))[_0xc54a('0x25')](saveUpdates(_0x3eb462[_0xc54a('0x44')],null))['then'](respondWithResult(_0x17d58c,null))[_0xc54a('0x42')](handleError(_0x17d58c,null));};exports[_0xc54a('0x24')]=function(_0x2f8e63,_0x270260){return db[_0xc54a('0x3c')][_0xc54a('0x41')]({'where':{'id':_0x2f8e63[_0xc54a('0x45')]['id']}})[_0xc54a('0x25')](handleEntityNotFound(_0x270260,null))[_0xc54a('0x25')](removeEntity(_0x270260,null))[_0xc54a('0x42')](handleError(_0x270260,null));}; \ No newline at end of file +var _0xf9cf=['params','keys','rawAttributes','length','options','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','end','offset','limit','count','Content-Range','json','apply','reject','save','then','error','stack','name','send','index','map','AnalyticTreeReport','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch'];(function(_0x3afb5c,_0x54e263){var _0x5c4e71=function(_0x40b6e5){while(--_0x40b6e5){_0x3afb5c['push'](_0x3afb5c['shift']());}};_0x5c4e71(++_0x54e263);}(_0xf9cf,0x97));var _0xff9c=function(_0x192877,_0x24e072){_0x192877=_0x192877-0x0;var _0x372899=_0xf9cf[_0x192877];return _0x372899;};'use strict';var emlformat=require(_0xff9c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff9c('0x1'));var jsonpatch=require(_0xff9c('0x2'));var rp=require(_0xff9c('0x3'));var moment=require(_0xff9c('0x4'));var BPromise=require(_0xff9c('0x5'));var Mustache=require(_0xff9c('0x6'));var util=require('util');var path=require(_0xff9c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xff9c('0x8'));var _=require(_0xff9c('0x9'));var squel=require(_0xff9c('0xa'));var crypto=require(_0xff9c('0xb'));var jsforce=require(_0xff9c('0xc'));var deskjs=require(_0xff9c('0xd'));var toCsv=require(_0xff9c('0xe'));var querystring=require(_0xff9c('0xf'));var Papa=require('papaparse');var Redis=require(_0xff9c('0x10'));var authService=require(_0xff9c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff9c('0x12'));var logger=require(_0xff9c('0x13'))('api');var utils=require(_0xff9c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xff9c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x571096,_0x3ae66f){_0x3ae66f=_0x3ae66f||0xcc;return function(_0x42bddb){if(_0x42bddb){return _0x571096['sendStatus'](_0x3ae66f);}return _0x571096[_0xff9c('0x16')](_0x3ae66f)[_0xff9c('0x17')]();};}function respondWithResult(_0x58a1f9,_0x4663c8){_0x4663c8=_0x4663c8||0xc8;return function(_0x579145){if(_0x579145){return _0x58a1f9[_0xff9c('0x16')](_0x4663c8)['json'](_0x579145);}};}function respondWithFilteredResult(_0x4ecd40,_0x5e5c6d){return function(_0x3b6337){if(_0x3b6337){var _0x259f48=typeof _0x5e5c6d[_0xff9c('0x18')]==='undefined'&&typeof _0x5e5c6d[_0xff9c('0x19')]==='undefined';var _0x4b5e36=_0x3b6337['count'];var _0x22b6cf=_0x259f48?0x0:_0x5e5c6d[_0xff9c('0x18')];var _0x563a74=_0x259f48?_0x3b6337[_0xff9c('0x1a')]:_0x5e5c6d[_0xff9c('0x18')]+_0x5e5c6d[_0xff9c('0x19')];var _0x374b6c;if(_0x563a74>=_0x4b5e36){_0x563a74=_0x4b5e36;_0x374b6c=0xc8;}else{_0x374b6c=0xce;}_0x4ecd40['status'](_0x374b6c);return _0x4ecd40['set'](_0xff9c('0x1b'),_0x22b6cf+'-'+_0x563a74+'/'+_0x4b5e36)[_0xff9c('0x1c')](_0x3b6337);}return null;};}function patchUpdates(_0x45930c){return function(_0x243c40){try{jsonpatch[_0xff9c('0x1d')](_0x243c40,_0x45930c,!![]);}catch(_0x4e8d51){return BPromise[_0xff9c('0x1e')](_0x4e8d51);}return _0x243c40[_0xff9c('0x1f')]();};}function saveUpdates(_0x32e25c,_0x311552){return function(_0x1e3187){if(_0x1e3187){return _0x1e3187['update'](_0x32e25c)['then'](function(_0x2b621b){return _0x2b621b;});}return null;};}function removeEntity(_0x4b51f3,_0x1356c1){return function(_0x9495e8){if(_0x9495e8){return _0x9495e8['destroy']()[_0xff9c('0x20')](function(){_0x4b51f3[_0xff9c('0x16')](0xcc)[_0xff9c('0x17')]();});}};}function handleEntityNotFound(_0x43f2a4,_0x572b4b){return function(_0x129b63){if(!_0x129b63){_0x43f2a4['sendStatus'](0x194);}return _0x129b63;};}function handleError(_0x4b9ed2,_0x59fe96){_0x59fe96=_0x59fe96||0x1f4;return function(_0x46283e){logger[_0xff9c('0x21')](_0x46283e[_0xff9c('0x22')]);if(_0x46283e[_0xff9c('0x23')]){delete _0x46283e[_0xff9c('0x23')];}_0x4b9ed2['status'](_0x59fe96)[_0xff9c('0x24')](_0x46283e);};}exports[_0xff9c('0x25')]=function(_0x279344,_0x11627e){var _0x28c1d5={},_0x4a1b82={},_0x3a8d62={'count':0x0,'rows':[]};var _0x2eb674=_[_0xff9c('0x26')](db[_0xff9c('0x27')]['rawAttributes'],function(_0x1f2e48){return{'name':_0x1f2e48['fieldName'],'type':_0x1f2e48[_0xff9c('0x28')][_0xff9c('0x29')]};});_0x4a1b82[_0xff9c('0x2a')]=_[_0xff9c('0x26')](_0x2eb674,_0xff9c('0x23'));_0x4a1b82[_0xff9c('0x2b')]=_['keys'](_0x279344[_0xff9c('0x2b')]);_0x4a1b82[_0xff9c('0x2c')]=_[_0xff9c('0x2d')](_0x4a1b82[_0xff9c('0x2a')],_0x4a1b82['query']);_0x28c1d5[_0xff9c('0x2e')]=_[_0xff9c('0x2d')](_0x4a1b82[_0xff9c('0x2a')],qs[_0xff9c('0x2f')](_0x279344[_0xff9c('0x2b')][_0xff9c('0x2f')]));_0x28c1d5[_0xff9c('0x2e')]=_0x28c1d5[_0xff9c('0x2e')]['length']?_0x28c1d5[_0xff9c('0x2e')]:_0x4a1b82[_0xff9c('0x2a')];if(!_0x279344['query'][_0xff9c('0x30')](_0xff9c('0x31'))){_0x28c1d5[_0xff9c('0x19')]=qs[_0xff9c('0x19')](_0x279344[_0xff9c('0x2b')][_0xff9c('0x19')]);_0x28c1d5[_0xff9c('0x18')]=qs[_0xff9c('0x18')](_0x279344['query'][_0xff9c('0x18')]);}_0x28c1d5[_0xff9c('0x32')]=qs[_0xff9c('0x33')](_0x279344[_0xff9c('0x2b')][_0xff9c('0x33')]);_0x28c1d5['where']=qs[_0xff9c('0x2c')](_[_0xff9c('0x34')](_0x279344[_0xff9c('0x2b')],_0x4a1b82[_0xff9c('0x2c')]),_0x2eb674);if(_0x279344['query'][_0xff9c('0x35')]){_0x28c1d5[_0xff9c('0x36')]=_[_0xff9c('0x37')](_0x28c1d5[_0xff9c('0x36')],{'$or':_[_0xff9c('0x26')](_0x2eb674,function(_0x471ecd){if(_0x471ecd['type']!==_0xff9c('0x38')){var _0x54c0bf={};_0x54c0bf[_0x471ecd[_0xff9c('0x23')]]={'$like':'%'+_0x279344[_0xff9c('0x2b')][_0xff9c('0x35')]+'%'};return _0x54c0bf;}})});}_0x28c1d5=_['merge']({},_0x28c1d5,_0x279344['options']);var _0x5ac599={'where':_0x28c1d5['where']};return db[_0xff9c('0x27')]['count'](_0x5ac599)[_0xff9c('0x20')](function(_0x323c98){_0x3a8d62[_0xff9c('0x1a')]=_0x323c98;if(_0x279344[_0xff9c('0x2b')][_0xff9c('0x39')]){_0x28c1d5[_0xff9c('0x3a')]=[{'all':!![]}];}return db[_0xff9c('0x27')][_0xff9c('0x3b')](_0x28c1d5);})[_0xff9c('0x20')](function(_0x4ee004){_0x3a8d62[_0xff9c('0x3c')]=_0x4ee004;return _0x3a8d62;})['then'](respondWithFilteredResult(_0x11627e,_0x28c1d5))[_0xff9c('0x3d')](handleError(_0x11627e,null));};exports['show']=function(_0x32e1d7,_0x2a5312){var _0x51d1f6={'raw':!![],'where':{'id':_0x32e1d7[_0xff9c('0x3e')]['id']}},_0x1365e4={};_0x1365e4[_0xff9c('0x2a')]=_[_0xff9c('0x3f')](db[_0xff9c('0x27')][_0xff9c('0x40')]);_0x1365e4[_0xff9c('0x2b')]=_[_0xff9c('0x3f')](_0x32e1d7[_0xff9c('0x2b')]);_0x1365e4[_0xff9c('0x2c')]=_[_0xff9c('0x2d')](_0x1365e4[_0xff9c('0x2a')],_0x1365e4[_0xff9c('0x2b')]);_0x51d1f6[_0xff9c('0x2e')]=_[_0xff9c('0x2d')](_0x1365e4[_0xff9c('0x2a')],qs[_0xff9c('0x2f')](_0x32e1d7[_0xff9c('0x2b')][_0xff9c('0x2f')]));_0x51d1f6[_0xff9c('0x2e')]=_0x51d1f6[_0xff9c('0x2e')][_0xff9c('0x41')]?_0x51d1f6[_0xff9c('0x2e')]:_0x1365e4[_0xff9c('0x2a')];if(_0x32e1d7[_0xff9c('0x2b')]['includeAll']){_0x51d1f6['include']=[{'all':!![]}];}_0x51d1f6=_[_0xff9c('0x37')]({},_0x51d1f6,_0x32e1d7[_0xff9c('0x42')]);return db['AnalyticTreeReport'][_0xff9c('0x43')](_0x51d1f6)[_0xff9c('0x20')](handleEntityNotFound(_0x2a5312,null))[_0xff9c('0x20')](respondWithResult(_0x2a5312,null))[_0xff9c('0x3d')](handleError(_0x2a5312,null));};exports[_0xff9c('0x44')]=function(_0x375783,_0x726b59){return db[_0xff9c('0x27')]['create'](_0x375783[_0xff9c('0x45')],{})['then'](respondWithResult(_0x726b59,0xc9))[_0xff9c('0x3d')](handleError(_0x726b59,null));};exports['update']=function(_0x54713e,_0x276ea7){if(_0x54713e['body']['id']){delete _0x54713e['body']['id'];}return db[_0xff9c('0x27')]['find']({'where':{'id':_0x54713e[_0xff9c('0x3e')]['id']}})[_0xff9c('0x20')](handleEntityNotFound(_0x276ea7,null))[_0xff9c('0x20')](saveUpdates(_0x54713e[_0xff9c('0x45')],null))[_0xff9c('0x20')](respondWithResult(_0x276ea7,null))[_0xff9c('0x3d')](handleError(_0x276ea7,null));};exports[_0xff9c('0x46')]=function(_0x4dd80b,_0x39e8e6){return db['AnalyticTreeReport']['find']({'where':{'id':_0x4dd80b[_0xff9c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x39e8e6,null))[_0xff9c('0x20')](removeEntity(_0x39e8e6,null))['catch'](handleError(_0x39e8e6,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 236745c..676236f 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 _0xf6ea=['request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','bluebird'];(function(_0x572f1e,_0x40c5b9){var _0x29af7e=function(_0x24fc92){while(--_0x24fc92){_0x572f1e['push'](_0x572f1e['shift']());}};_0x29af7e(++_0x40c5b9);}(_0xf6ea,0x11d));var _0xaf6e=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xf6ea[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xaf6e('0x0'));var util=require(_0xaf6e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xaf6e('0x2'));var rp=require(_0xaf6e('0x3'));var fs=require('fs');var path=require(_0xaf6e('0x4'));var rimraf=require(_0xaf6e('0x5'));var config=require(_0xaf6e('0x6'));var attributes=require(_0xaf6e('0x7'));module[_0xaf6e('0x8')]=function(_0x4de464,_0x4fa289){return _0x4de464[_0xaf6e('0x9')](_0xaf6e('0xa'),attributes,{'tableName':_0xaf6e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdff9=['AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define'];(function(_0x4a6b64,_0xacb69e){var _0x86fbc2=function(_0x63fd46){while(--_0x63fd46){_0x4a6b64['push'](_0x4a6b64['shift']());}};_0x86fbc2(++_0xacb69e);}(_0xdff9,0x161));var _0x9dff=function(_0x2c50e5,_0x1ca730){_0x2c50e5=_0x2c50e5-0x0;var _0x4b03bd=_0xdff9[_0x2c50e5];return _0x4b03bd;};'use strict';var _=require(_0x9dff('0x0'));var util=require(_0x9dff('0x1'));var logger=require(_0x9dff('0x2'))(_0x9dff('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9dff('0x4'));var fs=require('fs');var path=require(_0x9dff('0x5'));var rimraf=require(_0x9dff('0x6'));var config=require(_0x9dff('0x7'));var attributes=require(_0x9dff('0x8'));module[_0x9dff('0x9')]=function(_0x190235,_0x40e14d){return _0x190235[_0x9dff('0xa')](_0x9dff('0xb'),attributes,{'tableName':_0x9dff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 758864e..38cc2c0 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x4aca28,_0x4ab42c){var _0x1946a0=function(_0x42c5cd){while(--_0x42c5cd){_0x4aca28['push'](_0x4aca28['shift']());}};_0x1946a0(++_0x4ab42c);}(_0x2ef3,0xba));var _0x32ef=function(_0x3ed5f9,_0xfdb707){_0x3ed5f9=_0x3ed5f9-0x0;var _0x339ab7=_0x2ef3[_0x3ed5f9];return _0x339ab7;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x877d14,_0x2a1398){var _0x4d7bfe=function(_0x46de1f){while(--_0x46de1f){_0x877d14['push'](_0x877d14['shift']());}};_0x4d7bfe(++_0x2a1398);}(_0x5f2f,0x73));var _0xf5f2=function(_0x37e92b,_0x3527c0){_0x37e92b=_0x37e92b-0x0;var _0x390677=_0x5f2f[_0x37e92b];return _0x390677;};'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')]('AnalyticTreeReport,\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/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 77c0297..bb418dc 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 _0xe5b4=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','isAuthenticated','create','put','delete','exports'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xe5b4,0x160));var _0x4e5b=function(_0x552a6f,_0x52a7cc){_0x552a6f=_0x552a6f-0x0;var _0x471bc5=_0xe5b4[_0x552a6f];return _0x471bc5;};'use strict';var multer=require('multer');var util=require(_0x4e5b('0x0'));var path=require('path');var timeout=require(_0x4e5b('0x1'));var express=require('express');var router=express[_0x4e5b('0x2')]();var fs_extra=require(_0x4e5b('0x3'));var auth=require(_0x4e5b('0x4'));var interaction=require(_0x4e5b('0x5'));var config=require(_0x4e5b('0x6'));var controller=require('./analyticTreeReport.controller');router[_0x4e5b('0x7')]('/',auth['isAuthenticated'](),controller[_0x4e5b('0x8')]);router['get'](_0x4e5b('0x9'),auth['isAuthenticated'](),controller[_0x4e5b('0xa')]);router['post']('/',auth[_0x4e5b('0xb')](),controller[_0x4e5b('0xc')]);router[_0x4e5b('0xd')](_0x4e5b('0x9'),auth[_0x4e5b('0xb')](),controller['update']);router[_0x4e5b('0xe')](_0x4e5b('0x9'),auth[_0x4e5b('0xb')](),controller['destroy']);module[_0x4e5b('0xf')]=router; \ No newline at end of file +var _0xff1c=['isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get'];(function(_0xbc44f7,_0x49ce4b){var _0x1f42ca=function(_0x594267){while(--_0x594267){_0xbc44f7['push'](_0xbc44f7['shift']());}};_0x1f42ca(++_0x49ce4b);}(_0xff1c,0xa2));var _0xcff1=function(_0xed72a2,_0xdacfed){_0xed72a2=_0xed72a2-0x0;var _0x5b0bd6=_0xff1c[_0xed72a2];return _0x5b0bd6;};'use strict';var multer=require(_0xcff1('0x0'));var util=require(_0xcff1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcff1('0x2')]();var fs_extra=require(_0xcff1('0x3'));var auth=require(_0xcff1('0x4'));var interaction=require(_0xcff1('0x5'));var config=require(_0xcff1('0x6'));var controller=require(_0xcff1('0x7'));router[_0xcff1('0x8')]('/',auth[_0xcff1('0x9')](),controller['index']);router[_0xcff1('0x8')]('/:id',auth[_0xcff1('0x9')](),controller[_0xcff1('0xa')]);router[_0xcff1('0xb')]('/',auth[_0xcff1('0x9')](),controller[_0xcff1('0xc')]);router[_0xcff1('0xd')](_0xcff1('0xe'),auth[_0xcff1('0x9')](),controller[_0xcff1('0xf')]);router[_0xcff1('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xcff1('0x11')]);module[_0xcff1('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index e5618ca..ccfda7a 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 _0xc73e=['sequelize','exports','STRING'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc73e,0x1e9));var _0xec73=function(_0x5268a8,_0x7def5a){_0x5268a8=_0x5268a8-0x0;var _0x169642=_0xc73e[_0x5268a8];return _0x169642;};'use strict';var Sequelize=require(_0xec73('0x0'));module[_0xec73('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xec73('0x2')]},'type':{'type':Sequelize[_0xec73('0x2')]}}; \ No newline at end of file +var _0x121d=['sequelize','exports','STRING'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x121d,0xea));var _0xd121=function(_0x1b5c68,_0x56d052){_0x1b5c68=_0x1b5c68-0x0;var _0x2bd7d1=_0x121d[_0x1b5c68];return _0x2bd7d1;};'use strict';var Sequelize=require(_0xd121('0x0'));module[_0xd121('0x1')]={'name':{'type':Sequelize[_0xd121('0x2')]},'basename':{'type':Sequelize[_0xd121('0x2')]},'type':{'type':Sequelize[_0xd121('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 3ffa6ce..fea02ab 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 _0x5e6b=['map','VIRTUAL','filter','merge','options','then','includeAll','include','findAll','rows','catch','show','params','find','clone','rawAttributes','omit','updatedAt','body','create','update','file','originalname','basename','filename','download','ChatOfflineMessageId','join','root','offline-chat/','eml-format','rimraf','zip-dir','request-promise','util','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','count','set','apply','reject','save','destroy','name','index','Attachment','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick'];(function(_0xf86d34,_0x3c700a){var _0x5275d1=function(_0x271e19){while(--_0x271e19){_0xf86d34['push'](_0xf86d34['shift']());}};_0x5275d1(++_0x3c700a);}(_0x5e6b,0xc6));var _0xb5e6=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0x5e6b[_0x50e593];return _0x3821d0;};'use strict';var emlformat=require(_0xb5e6('0x0'));var rimraf=require(_0xb5e6('0x1'));var zipdir=require(_0xb5e6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb5e6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb5e6('0x4'));var path=require(_0xb5e6('0x5'));var sox=require(_0xb5e6('0x6'));var csv=require('to-csv');var ejs=require(_0xb5e6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5e6('0x8'));var crypto=require(_0xb5e6('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb5e6('0xa'));var toCsv=require(_0xb5e6('0xb'));var querystring=require(_0xb5e6('0xc'));var Papa=require(_0xb5e6('0xd'));var Redis=require(_0xb5e6('0xe'));var authService=require(_0xb5e6('0xf'));var qs=require(_0xb5e6('0x10'));var as=require(_0xb5e6('0x11'));var hardwareService=require(_0xb5e6('0x12'));var logger=require(_0xb5e6('0x13'))(_0xb5e6('0x14'));var utils=require(_0xb5e6('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb5e6('0x16'))['db'];function respondWithStatusCode(_0x2f7392,_0x7a62ad){_0x7a62ad=_0x7a62ad||0xcc;return function(_0xcabad4){if(_0xcabad4){return _0x2f7392['sendStatus'](_0x7a62ad);}return _0x2f7392[_0xb5e6('0x17')](_0x7a62ad)[_0xb5e6('0x18')]();};}function respondWithResult(_0x276202,_0x1a72d4){_0x1a72d4=_0x1a72d4||0xc8;return function(_0x1a1e5f){if(_0x1a1e5f){return _0x276202[_0xb5e6('0x17')](_0x1a72d4)[_0xb5e6('0x19')](_0x1a1e5f);}};}function respondWithFilteredResult(_0x3006c6,_0x5ee348){return function(_0x534654){if(_0x534654){var _0x454462=typeof _0x5ee348[_0xb5e6('0x1a')]==='undefined'&&typeof _0x5ee348['limit']==='undefined';var _0x54caed=_0x534654[_0xb5e6('0x1b')];var _0x214b7d=_0x454462?0x0:_0x5ee348['offset'];var _0xa2559c=_0x454462?_0x534654[_0xb5e6('0x1b')]:_0x5ee348[_0xb5e6('0x1a')]+_0x5ee348['limit'];var _0x2c7723;if(_0xa2559c>=_0x54caed){_0xa2559c=_0x54caed;_0x2c7723=0xc8;}else{_0x2c7723=0xce;}_0x3006c6[_0xb5e6('0x17')](_0x2c7723);return _0x3006c6[_0xb5e6('0x1c')]('Content-Range',_0x214b7d+'-'+_0xa2559c+'/'+_0x54caed)[_0xb5e6('0x19')](_0x534654);}return null;};}function patchUpdates(_0x1da250){return function(_0x29ad79){try{jsonpatch[_0xb5e6('0x1d')](_0x29ad79,_0x1da250,!![]);}catch(_0x2a0e7b){return BPromise[_0xb5e6('0x1e')](_0x2a0e7b);}return _0x29ad79[_0xb5e6('0x1f')]();};}function saveUpdates(_0x27133c,_0x38c179){return function(_0x5c1d94){if(_0x5c1d94){return _0x5c1d94['update'](_0x27133c)['then'](function(_0x5cdb1c){return _0x5cdb1c;});}return null;};}function removeEntity(_0x30100c,_0x25b5c5){return function(_0x6dc7a1){if(_0x6dc7a1){return _0x6dc7a1[_0xb5e6('0x20')]()['then'](function(){_0x30100c[_0xb5e6('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c5c0b,_0x2ab494){return function(_0x6e3f93){if(!_0x6e3f93){_0x1c5c0b['sendStatus'](0x194);}return _0x6e3f93;};}function handleError(_0x43764e,_0x3547aa){_0x3547aa=_0x3547aa||0x1f4;return function(_0x38fb4e){logger['error'](_0x38fb4e['stack']);if(_0x38fb4e[_0xb5e6('0x21')]){delete _0x38fb4e[_0xb5e6('0x21')];}_0x43764e[_0xb5e6('0x17')](_0x3547aa)['send'](_0x38fb4e);};}exports[_0xb5e6('0x22')]=function(_0x337ec5,_0x3f2f9e){var _0x1cca6d={},_0x33776c={},_0x1cc414={'count':0x0,'rows':[]};var _0x429a57=_['map'](db[_0xb5e6('0x23')]['rawAttributes'],function(_0x217fac){return{'name':_0x217fac[_0xb5e6('0x24')],'type':_0x217fac[_0xb5e6('0x25')][_0xb5e6('0x26')]};});_0x33776c[_0xb5e6('0x27')]=_['map'](_0x429a57,'name');_0x33776c[_0xb5e6('0x28')]=_[_0xb5e6('0x29')](_0x337ec5[_0xb5e6('0x28')]);_0x33776c[_0xb5e6('0x2a')]=_[_0xb5e6('0x2b')](_0x33776c[_0xb5e6('0x27')],_0x33776c['query']);_0x1cca6d[_0xb5e6('0x2c')]=_[_0xb5e6('0x2b')](_0x33776c[_0xb5e6('0x27')],qs[_0xb5e6('0x2d')](_0x337ec5[_0xb5e6('0x28')][_0xb5e6('0x2d')]));_0x1cca6d['attributes']=_0x1cca6d[_0xb5e6('0x2c')][_0xb5e6('0x2e')]?_0x1cca6d[_0xb5e6('0x2c')]:_0x33776c[_0xb5e6('0x27')];if(!_0x337ec5[_0xb5e6('0x28')][_0xb5e6('0x2f')](_0xb5e6('0x30'))){_0x1cca6d[_0xb5e6('0x31')]=qs[_0xb5e6('0x31')](_0x337ec5[_0xb5e6('0x28')]['limit']);_0x1cca6d[_0xb5e6('0x1a')]=qs[_0xb5e6('0x1a')](_0x337ec5[_0xb5e6('0x28')][_0xb5e6('0x1a')]);}_0x1cca6d[_0xb5e6('0x32')]=qs[_0xb5e6('0x33')](_0x337ec5[_0xb5e6('0x28')][_0xb5e6('0x33')]);_0x1cca6d[_0xb5e6('0x34')]=qs['filters'](_[_0xb5e6('0x35')](_0x337ec5[_0xb5e6('0x28')],_0x33776c['filters']),_0x429a57);if(_0x337ec5[_0xb5e6('0x28')]['filter']){_0x1cca6d[_0xb5e6('0x34')]=_['merge'](_0x1cca6d['where'],{'$or':_[_0xb5e6('0x36')](_0x429a57,function(_0x340712){if(_0x340712[_0xb5e6('0x25')]!==_0xb5e6('0x37')){var _0x4d6280={};_0x4d6280[_0x340712['name']]={'$like':'%'+_0x337ec5[_0xb5e6('0x28')][_0xb5e6('0x38')]+'%'};return _0x4d6280;}})});}_0x1cca6d=_[_0xb5e6('0x39')]({},_0x1cca6d,_0x337ec5[_0xb5e6('0x3a')]);var _0x40dda0={'where':_0x1cca6d['where']};return db[_0xb5e6('0x23')][_0xb5e6('0x1b')](_0x40dda0)[_0xb5e6('0x3b')](function(_0x168782){_0x1cc414[_0xb5e6('0x1b')]=_0x168782;if(_0x337ec5['query'][_0xb5e6('0x3c')]){_0x1cca6d[_0xb5e6('0x3d')]=[{'all':!![]}];}return db['Attachment'][_0xb5e6('0x3e')](_0x1cca6d);})[_0xb5e6('0x3b')](function(_0x16152a){_0x1cc414[_0xb5e6('0x3f')]=_0x16152a;return _0x1cc414;})[_0xb5e6('0x3b')](respondWithFilteredResult(_0x3f2f9e,_0x1cca6d))[_0xb5e6('0x40')](handleError(_0x3f2f9e,null));};exports[_0xb5e6('0x41')]=function(_0x4f9b29,_0x391c94){var _0x9e780c={'raw':!![],'where':{'id':_0x4f9b29[_0xb5e6('0x42')]['id']}},_0x506997={};_0x506997[_0xb5e6('0x27')]=_[_0xb5e6('0x29')](db['Attachment']['rawAttributes']);_0x506997['query']=_[_0xb5e6('0x29')](_0x4f9b29[_0xb5e6('0x28')]);_0x506997[_0xb5e6('0x2a')]=_[_0xb5e6('0x2b')](_0x506997[_0xb5e6('0x27')],_0x506997[_0xb5e6('0x28')]);_0x9e780c[_0xb5e6('0x2c')]=_[_0xb5e6('0x2b')](_0x506997[_0xb5e6('0x27')],qs[_0xb5e6('0x2d')](_0x4f9b29[_0xb5e6('0x28')][_0xb5e6('0x2d')]));_0x9e780c['attributes']=_0x9e780c[_0xb5e6('0x2c')]['length']?_0x9e780c[_0xb5e6('0x2c')]:_0x506997[_0xb5e6('0x27')];if(_0x4f9b29[_0xb5e6('0x28')][_0xb5e6('0x3c')]){_0x9e780c[_0xb5e6('0x3d')]=[{'all':!![]}];}_0x9e780c=_[_0xb5e6('0x39')]({},_0x9e780c,_0x4f9b29[_0xb5e6('0x3a')]);return db[_0xb5e6('0x23')][_0xb5e6('0x43')](_0x9e780c)[_0xb5e6('0x3b')](handleEntityNotFound(_0x391c94,null))[_0xb5e6('0x3b')](respondWithResult(_0x391c94,null))[_0xb5e6('0x40')](handleError(_0x391c94,null));};exports[_0xb5e6('0x44')]=function(_0x150705,_0x528682){var _0x326b20={'where':{'id':_0x150705[_0xb5e6('0x42')]['id']}},_0x40696f={};_0x40696f[_0xb5e6('0x27')]=_['keys'](db[_0xb5e6('0x23')][_0xb5e6('0x45')]);_0x326b20['attributes']=_[_0xb5e6('0x2b')](_0x40696f['model'],qs['fields'](_0x150705[_0xb5e6('0x28')][_0xb5e6('0x2d')]));_0x326b20[_0xb5e6('0x2c')]=_0x326b20[_0xb5e6('0x2c')][_0xb5e6('0x2e')]?_0x326b20['attributes']:_0x40696f['model'];if(_0x150705['query'][_0xb5e6('0x3c')]){_0x326b20[_0xb5e6('0x3d')]=[{'all':!![]}];}_0x326b20=_['merge']({},_0x326b20,_0x150705[_0xb5e6('0x3a')]);return db[_0xb5e6('0x23')][_0xb5e6('0x43')](_0x326b20)[_0xb5e6('0x3b')](handleEntityNotFound(_0x528682,null))[_0xb5e6('0x3b')](function(_0x3482e4){if(_0x3482e4){var _0x4e2bf2=_0x3482e4['get']({'plain':!![]});_0x4e2bf2=qs[_0xb5e6('0x46')](_0x4e2bf2,['id','createdAt',_0xb5e6('0x47')]);_0x150705[_0xb5e6('0x48')]=_['omit'](_0x150705['body'],['id','createdAt',_0xb5e6('0x47')]);return db[_0xb5e6('0x23')][_0xb5e6('0x49')](_[_0xb5e6('0x39')](_0x4e2bf2,_0x150705[_0xb5e6('0x48')]),{'include':_0x150705[_0xb5e6('0x28')][_0xb5e6('0x3c')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x528682,0xc9))[_0xb5e6('0x40')](handleError(_0x528682,null));};exports[_0xb5e6('0x4a')]=function(_0x50ac2d,_0x44de6d){if(_0x50ac2d[_0xb5e6('0x48')]['id']){delete _0x50ac2d[_0xb5e6('0x48')]['id'];}return db[_0xb5e6('0x23')][_0xb5e6('0x43')]({'where':{'id':_0x50ac2d['params']['id']}})[_0xb5e6('0x3b')](handleEntityNotFound(_0x44de6d,null))['then'](saveUpdates(_0x50ac2d['body'],null))[_0xb5e6('0x3b')](respondWithResult(_0x44de6d,null))[_0xb5e6('0x40')](handleError(_0x44de6d,null));};exports['destroy']=function(_0x5b392d,_0x2e3cd8){return db[_0xb5e6('0x23')][_0xb5e6('0x43')]({'where':{'id':_0x5b392d[_0xb5e6('0x42')]['id']}})[_0xb5e6('0x3b')](handleEntityNotFound(_0x2e3cd8,null))[_0xb5e6('0x3b')](removeEntity(_0x2e3cd8,null))['catch'](handleError(_0x2e3cd8,null));};exports[_0xb5e6('0x49')]=function(_0x4fae8b,_0x1d7fed,_0x3677fe){_0x4fae8b[_0xb5e6('0x48')][_0xb5e6('0x21')]=_0x4fae8b[_0xb5e6('0x4b')][_0xb5e6('0x4c')];_0x4fae8b[_0xb5e6('0x48')][_0xb5e6('0x4d')]=_0x4fae8b['file'][_0xb5e6('0x4e')];_0x4fae8b[_0xb5e6('0x48')]['type']=_0x4fae8b[_0xb5e6('0x4b')]['mimetype'];return db[_0xb5e6('0x23')]['create'](_0x4fae8b[_0xb5e6('0x48')])[_0xb5e6('0x3b')](respondWithResult(_0x1d7fed,0xc9))['catch'](handleError(_0x1d7fed,null));};exports[_0xb5e6('0x4f')]=function(_0x1ee718,_0x40d5df,_0x5835b3){return db[_0xb5e6('0x23')]['findOne']({'where':{'id':_0x1ee718[_0xb5e6('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x40d5df,null))[_0xb5e6('0x3b')](function(_0x57d60a){if(_0x57d60a){var _0x36309b=_0x57d60a[_0xb5e6('0x50')]!==null;var _0x487ec4=path[_0xb5e6('0x51')](config[_0xb5e6('0x52')],'server/files/attachments/');if(_0x36309b){_0x487ec4=path[_0xb5e6('0x51')](_0x487ec4,_0xb5e6('0x53'));}var _0x23b7ef=path[_0xb5e6('0x51')](_0x487ec4,_0x57d60a['basename']);return _0x40d5df[_0xb5e6('0x4f')](_0x23b7ef);}})[_0xb5e6('0x40')](handleError(_0x40d5df,null));}; \ No newline at end of file +var _0x497b=['sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','clone','get','omit','createdAt','updatedAt','body','destroy','create','file','originalname','mimetype','findOne','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','name','send','map','Attachment','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order'];(function(_0xe585ca,_0x375ae0){var _0x1917ec=function(_0x45f32f){while(--_0x45f32f){_0xe585ca['push'](_0xe585ca['shift']());}};_0x1917ec(++_0x375ae0);}(_0x497b,0x124));var _0xb497=function(_0x1ccfd1,_0x4c2ff2){_0x1ccfd1=_0x1ccfd1-0x0;var _0x53474f=_0x497b[_0x1ccfd1];return _0x53474f;};'use strict';var emlformat=require(_0xb497('0x0'));var rimraf=require(_0xb497('0x1'));var zipdir=require(_0xb497('0x2'));var jsonpatch=require(_0xb497('0x3'));var rp=require(_0xb497('0x4'));var moment=require(_0xb497('0x5'));var BPromise=require(_0xb497('0x6'));var Mustache=require(_0xb497('0x7'));var util=require(_0xb497('0x8'));var path=require(_0xb497('0x9'));var sox=require(_0xb497('0xa'));var csv=require('to-csv');var ejs=require(_0xb497('0xb'));var fs=require('fs');var fs_extra=require(_0xb497('0xc'));var _=require('lodash');var squel=require(_0xb497('0xd'));var crypto=require(_0xb497('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb497('0xf'));var querystring=require('querystring');var Papa=require(_0xb497('0x10'));var Redis=require(_0xb497('0x11'));var authService=require(_0xb497('0x12'));var qs=require(_0xb497('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb497('0x14'));var logger=require(_0xb497('0x15'))(_0xb497('0x16'));var utils=require(_0xb497('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb497('0x18'));var db=require(_0xb497('0x19'))['db'];function respondWithStatusCode(_0x2a34c1,_0x30d788){_0x30d788=_0x30d788||0xcc;return function(_0x105fb1){if(_0x105fb1){return _0x2a34c1[_0xb497('0x1a')](_0x30d788);}return _0x2a34c1[_0xb497('0x1b')](_0x30d788)[_0xb497('0x1c')]();};}function respondWithResult(_0x2cf884,_0x40082e){_0x40082e=_0x40082e||0xc8;return function(_0x4bbb36){if(_0x4bbb36){return _0x2cf884[_0xb497('0x1b')](_0x40082e)[_0xb497('0x1d')](_0x4bbb36);}};}function respondWithFilteredResult(_0x2e9edf,_0x3b518e){return function(_0x49acde){if(_0x49acde){var _0x47c545=typeof _0x3b518e[_0xb497('0x1e')]==='undefined'&&typeof _0x3b518e[_0xb497('0x1f')]===_0xb497('0x20');var _0x216fb0=_0x49acde[_0xb497('0x21')];var _0x2ae301=_0x47c545?0x0:_0x3b518e[_0xb497('0x1e')];var _0x4d0e0c=_0x47c545?_0x49acde['count']:_0x3b518e['offset']+_0x3b518e[_0xb497('0x1f')];var _0x5a46a;if(_0x4d0e0c>=_0x216fb0){_0x4d0e0c=_0x216fb0;_0x5a46a=0xc8;}else{_0x5a46a=0xce;}_0x2e9edf['status'](_0x5a46a);return _0x2e9edf[_0xb497('0x22')](_0xb497('0x23'),_0x2ae301+'-'+_0x4d0e0c+'/'+_0x216fb0)[_0xb497('0x1d')](_0x49acde);}return null;};}function patchUpdates(_0x34e37a){return function(_0x301a0a){try{jsonpatch['apply'](_0x301a0a,_0x34e37a,!![]);}catch(_0x524bef){return BPromise['reject'](_0x524bef);}return _0x301a0a[_0xb497('0x24')]();};}function saveUpdates(_0x445008,_0x493665){return function(_0x280390){if(_0x280390){return _0x280390[_0xb497('0x25')](_0x445008)[_0xb497('0x26')](function(_0x350d8b){return _0x350d8b;});}return null;};}function removeEntity(_0x53fefb,_0x329bda){return function(_0x21f5cf){if(_0x21f5cf){return _0x21f5cf['destroy']()[_0xb497('0x26')](function(){_0x53fefb[_0xb497('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a85cb,_0x367840){return function(_0x23f525){if(!_0x23f525){_0x1a85cb['sendStatus'](0x194);}return _0x23f525;};}function handleError(_0x2029a7,_0x132736){_0x132736=_0x132736||0x1f4;return function(_0x27301f){logger['error'](_0x27301f['stack']);if(_0x27301f[_0xb497('0x27')]){delete _0x27301f[_0xb497('0x27')];}_0x2029a7[_0xb497('0x1b')](_0x132736)[_0xb497('0x28')](_0x27301f);};}exports['index']=function(_0x1859a1,_0x8883ee){var _0x3a97ba={},_0x288282={},_0x5d181f={'count':0x0,'rows':[]};var _0x1e48cb=_[_0xb497('0x29')](db[_0xb497('0x2a')]['rawAttributes'],function(_0x2b0584){return{'name':_0x2b0584[_0xb497('0x2b')],'type':_0x2b0584[_0xb497('0x2c')][_0xb497('0x2d')]};});_0x288282['model']=_['map'](_0x1e48cb,_0xb497('0x27'));_0x288282[_0xb497('0x2e')]=_[_0xb497('0x2f')](_0x1859a1[_0xb497('0x2e')]);_0x288282[_0xb497('0x30')]=_[_0xb497('0x31')](_0x288282[_0xb497('0x32')],_0x288282[_0xb497('0x2e')]);_0x3a97ba[_0xb497('0x33')]=_['intersection'](_0x288282['model'],qs[_0xb497('0x34')](_0x1859a1[_0xb497('0x2e')][_0xb497('0x34')]));_0x3a97ba[_0xb497('0x33')]=_0x3a97ba[_0xb497('0x33')][_0xb497('0x35')]?_0x3a97ba[_0xb497('0x33')]:_0x288282['model'];if(!_0x1859a1[_0xb497('0x2e')]['hasOwnProperty'](_0xb497('0x36'))){_0x3a97ba['limit']=qs[_0xb497('0x1f')](_0x1859a1['query'][_0xb497('0x1f')]);_0x3a97ba['offset']=qs[_0xb497('0x1e')](_0x1859a1[_0xb497('0x2e')]['offset']);}_0x3a97ba[_0xb497('0x37')]=qs[_0xb497('0x38')](_0x1859a1['query'][_0xb497('0x38')]);_0x3a97ba[_0xb497('0x39')]=qs['filters'](_[_0xb497('0x3a')](_0x1859a1[_0xb497('0x2e')],_0x288282[_0xb497('0x30')]),_0x1e48cb);if(_0x1859a1[_0xb497('0x2e')]['filter']){_0x3a97ba[_0xb497('0x39')]=_[_0xb497('0x3b')](_0x3a97ba[_0xb497('0x39')],{'$or':_[_0xb497('0x29')](_0x1e48cb,function(_0x33692c){if(_0x33692c['type']!=='VIRTUAL'){var _0x1ff649={};_0x1ff649[_0x33692c[_0xb497('0x27')]]={'$like':'%'+_0x1859a1['query'][_0xb497('0x3c')]+'%'};return _0x1ff649;}})});}_0x3a97ba=_[_0xb497('0x3b')]({},_0x3a97ba,_0x1859a1[_0xb497('0x3d')]);var _0x2ed72a={'where':_0x3a97ba['where']};return db[_0xb497('0x2a')][_0xb497('0x21')](_0x2ed72a)['then'](function(_0x4ee727){_0x5d181f[_0xb497('0x21')]=_0x4ee727;if(_0x1859a1['query'][_0xb497('0x3e')]){_0x3a97ba[_0xb497('0x3f')]=[{'all':!![]}];}return db[_0xb497('0x2a')][_0xb497('0x40')](_0x3a97ba);})['then'](function(_0x3f7f1c){_0x5d181f[_0xb497('0x41')]=_0x3f7f1c;return _0x5d181f;})['then'](respondWithFilteredResult(_0x8883ee,_0x3a97ba))[_0xb497('0x42')](handleError(_0x8883ee,null));};exports[_0xb497('0x43')]=function(_0x35b03b,_0x33db60){var _0x344e43={'raw':!![],'where':{'id':_0x35b03b[_0xb497('0x44')]['id']}},_0x1d68d3={};_0x1d68d3[_0xb497('0x32')]=_[_0xb497('0x2f')](db[_0xb497('0x2a')][_0xb497('0x45')]);_0x1d68d3['query']=_['keys'](_0x35b03b[_0xb497('0x2e')]);_0x1d68d3[_0xb497('0x30')]=_[_0xb497('0x31')](_0x1d68d3[_0xb497('0x32')],_0x1d68d3[_0xb497('0x2e')]);_0x344e43['attributes']=_[_0xb497('0x31')](_0x1d68d3[_0xb497('0x32')],qs[_0xb497('0x34')](_0x35b03b[_0xb497('0x2e')][_0xb497('0x34')]));_0x344e43[_0xb497('0x33')]=_0x344e43[_0xb497('0x33')][_0xb497('0x35')]?_0x344e43[_0xb497('0x33')]:_0x1d68d3[_0xb497('0x32')];if(_0x35b03b[_0xb497('0x2e')]['includeAll']){_0x344e43['include']=[{'all':!![]}];}_0x344e43=_['merge']({},_0x344e43,_0x35b03b['options']);return db[_0xb497('0x2a')]['find'](_0x344e43)[_0xb497('0x26')](handleEntityNotFound(_0x33db60,null))['then'](respondWithResult(_0x33db60,null))[_0xb497('0x42')](handleError(_0x33db60,null));};exports[_0xb497('0x46')]=function(_0x1b720f,_0x527f5e){var _0x1edf99={'where':{'id':_0x1b720f[_0xb497('0x44')]['id']}},_0xb4325b={};_0xb4325b[_0xb497('0x32')]=_[_0xb497('0x2f')](db['Attachment'][_0xb497('0x45')]);_0x1edf99[_0xb497('0x33')]=_[_0xb497('0x31')](_0xb4325b[_0xb497('0x32')],qs[_0xb497('0x34')](_0x1b720f[_0xb497('0x2e')][_0xb497('0x34')]));_0x1edf99[_0xb497('0x33')]=_0x1edf99[_0xb497('0x33')][_0xb497('0x35')]?_0x1edf99[_0xb497('0x33')]:_0xb4325b[_0xb497('0x32')];if(_0x1b720f['query']['includeAll']){_0x1edf99[_0xb497('0x3f')]=[{'all':!![]}];}_0x1edf99=_[_0xb497('0x3b')]({},_0x1edf99,_0x1b720f['options']);return db[_0xb497('0x2a')]['find'](_0x1edf99)['then'](handleEntityNotFound(_0x527f5e,null))[_0xb497('0x26')](function(_0x33dd45){if(_0x33dd45){var _0x590ab6=_0x33dd45[_0xb497('0x47')]({'plain':!![]});_0x590ab6=qs[_0xb497('0x48')](_0x590ab6,['id',_0xb497('0x49'),_0xb497('0x4a')]);_0x1b720f[_0xb497('0x4b')]=_[_0xb497('0x48')](_0x1b720f[_0xb497('0x4b')],['id','createdAt','updatedAt']);return db[_0xb497('0x2a')]['create'](_['merge'](_0x590ab6,_0x1b720f[_0xb497('0x4b')]),{'include':_0x1b720f[_0xb497('0x2e')][_0xb497('0x3e')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x527f5e,0xc9))[_0xb497('0x42')](handleError(_0x527f5e,null));};exports[_0xb497('0x25')]=function(_0x4bd5cb,_0x24f8b6){if(_0x4bd5cb[_0xb497('0x4b')]['id']){delete _0x4bd5cb[_0xb497('0x4b')]['id'];}return db[_0xb497('0x2a')]['find']({'where':{'id':_0x4bd5cb[_0xb497('0x44')]['id']}})['then'](handleEntityNotFound(_0x24f8b6,null))['then'](saveUpdates(_0x4bd5cb[_0xb497('0x4b')],null))[_0xb497('0x26')](respondWithResult(_0x24f8b6,null))[_0xb497('0x42')](handleError(_0x24f8b6,null));};exports[_0xb497('0x4c')]=function(_0x2c68e2,_0x49d0b2){return db[_0xb497('0x2a')]['find']({'where':{'id':_0x2c68e2[_0xb497('0x44')]['id']}})[_0xb497('0x26')](handleEntityNotFound(_0x49d0b2,null))[_0xb497('0x26')](removeEntity(_0x49d0b2,null))[_0xb497('0x42')](handleError(_0x49d0b2,null));};exports[_0xb497('0x4d')]=function(_0x3399c3,_0x2d245e,_0x101665){_0x3399c3['body'][_0xb497('0x27')]=_0x3399c3[_0xb497('0x4e')][_0xb497('0x4f')];_0x3399c3['body']['basename']=_0x3399c3[_0xb497('0x4e')]['filename'];_0x3399c3[_0xb497('0x4b')][_0xb497('0x2c')]=_0x3399c3['file'][_0xb497('0x50')];return db[_0xb497('0x2a')][_0xb497('0x4d')](_0x3399c3['body'])['then'](respondWithResult(_0x2d245e,0xc9))['catch'](handleError(_0x2d245e,null));};exports['download']=function(_0x5ef223,_0xf4a8d8,_0x5d2e32){return db[_0xb497('0x2a')][_0xb497('0x51')]({'where':{'id':_0x5ef223[_0xb497('0x44')]['id']},'raw':!![]})[_0xb497('0x26')](handleEntityNotFound(_0xf4a8d8,null))[_0xb497('0x26')](function(_0x5a22bd){if(_0x5a22bd){var _0x2afacb=_0x5a22bd[_0xb497('0x52')]!==null;var _0x20e4a8=path[_0xb497('0x53')](config['root'],_0xb497('0x54'));if(_0x2afacb){_0x20e4a8=path[_0xb497('0x53')](_0x20e4a8,_0xb497('0x55'));}var _0x4e4f96=path['join'](_0x20e4a8,_0x5a22bd[_0xb497('0x56')]);return _0xf4a8d8['download'](_0x4e4f96);}})['catch'](handleError(_0xf4a8d8,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 5601df1..4ac053b 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 _0x6cc9=['./attachment.attributes','exports','define','Attachment','attachments','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4237dc,_0x171899){var _0x35ed7f=function(_0x3c6e62){while(--_0x3c6e62){_0x4237dc['push'](_0x4237dc['shift']());}};_0x35ed7f(++_0x171899);}(_0x6cc9,0x164));var _0x96cc=function(_0x116576,_0x4952a6){_0x116576=_0x116576-0x0;var _0x420119=_0x6cc9[_0x116576];return _0x420119;};'use strict';var _=require('lodash');var util=require(_0x96cc('0x0'));var logger=require(_0x96cc('0x1'))(_0x96cc('0x2'));var moment=require(_0x96cc('0x3'));var BPromise=require(_0x96cc('0x4'));var rp=require(_0x96cc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x96cc('0x6'));var config=require(_0x96cc('0x7'));var attributes=require(_0x96cc('0x8'));module[_0x96cc('0x9')]=function(_0x2ad3b2,_0x4c9af7){return _0x2ad3b2[_0x96cc('0xa')](_0x96cc('0xb'),attributes,{'tableName':_0x96cc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1c4=['path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','../../config/logger','api','moment','bluebird'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe1c4,0x1f4));var _0x4e1c=function(_0x1ccf6d,_0x1d7da6){_0x1ccf6d=_0x1ccf6d-0x0;var _0x23722d=_0xe1c4[_0x1ccf6d];return _0x23722d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4e1c('0x0'))(_0x4e1c('0x1'));var moment=require(_0x4e1c('0x2'));var BPromise=require(_0x4e1c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e1c('0x4'));var rimraf=require(_0x4e1c('0x5'));var config=require(_0x4e1c('0x6'));var attributes=require(_0x4e1c('0x7'));module[_0x4e1c('0x8')]=function(_0x45d7e7,_0x14e57c){return _0x45d7e7[_0x4e1c('0x9')](_0x4e1c('0xa'),attributes,{'tableName':_0x4e1c('0xb'),'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 5b97d92..bf0edfd 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 _0x1b73=['jayson/promise','client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateAttachment','Attachment','create','options','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x1b73,0x1d5));var _0x31b7=function(_0x52331d,_0x16189c){_0x52331d=_0x52331d-0x0;var _0x52d4ab=_0x1b73[_0x52331d];return _0x52d4ab;};'use strict';var _=require('lodash');var util=require(_0x31b7('0x0'));var moment=require(_0x31b7('0x1'));var BPromise=require(_0x31b7('0x2'));var rs=require(_0x31b7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31b7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x31b7('0x5'))(_0x31b7('0x6'));var config=require('../../config/environment');var jayson=require(_0x31b7('0x7'));var client=jayson[_0x31b7('0x8')][_0x31b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x502838,_0x445dbe,_0x1a730f){return new BPromise(function(_0x86ef8e,_0x19b92a){return client[_0x31b7('0xa')](_0x502838,_0x1a730f)[_0x31b7('0xb')](function(_0x3d2b41){logger['info'](_0x31b7('0xc'),_0x445dbe,_0x31b7('0xd'));logger[_0x31b7('0xe')](_0x31b7('0xf'),_0x445dbe,_0x31b7('0xd'),JSON[_0x31b7('0x10')](_0x3d2b41));if(_0x3d2b41[_0x31b7('0x11')]){if(_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x12')]===0x1f4){logger[_0x31b7('0x11')]('Attachment,\x20%s,\x20%s',_0x445dbe,_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x13')]);return _0x19b92a(_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x13')]);}logger[_0x31b7('0x11')](_0x31b7('0xc'),_0x445dbe,_0x3d2b41[_0x31b7('0x11')][_0x31b7('0x13')]);return _0x86ef8e(_0x3d2b41[_0x31b7('0x11')]['message']);}else{logger[_0x31b7('0x14')]('Attachment,\x20%s,\x20%s',_0x445dbe,_0x31b7('0xd'));_0x86ef8e(_0x3d2b41[_0x31b7('0x15')]['message']);}})[_0x31b7('0x16')](function(_0x3c71ae){logger[_0x31b7('0x11')](_0x31b7('0xc'),_0x445dbe,_0x3c71ae);_0x19b92a(_0x3c71ae);});});}exports[_0x31b7('0x17')]=function(_0x5f3245){var _0x223f9f=this;return new Promise(function(_0x437eba,_0x1dc28c){return db[_0x31b7('0x18')][_0x31b7('0x19')](_0x5f3245['body'],{'raw':_0x5f3245[_0x31b7('0x1a')]?_0x5f3245[_0x31b7('0x1a')][_0x31b7('0x1b')]===undefined?!![]:![]:!![]})[_0x31b7('0xb')](function(_0x5b56bc){logger[_0x31b7('0x14')](_0x31b7('0x17'),_0x5f3245);logger[_0x31b7('0xe')](_0x31b7('0x17'),_0x5f3245,JSON['stringify'](_0x5b56bc));_0x437eba(_0x5b56bc);})[_0x31b7('0x16')](function(_0x20cb03){logger[_0x31b7('0x11')](_0x31b7('0x17'),_0x20cb03[_0x31b7('0x13')],_0x5f3245);_0x1dc28c(_0x223f9f[_0x31b7('0x11')](0x1f4,_0x20cb03[_0x31b7('0x13')]));});});}; \ No newline at end of file +var _0xa0bc=['options','raw','debug','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateAttachment','create','body'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xca0b('0x0'));var moment=require(_0xca0b('0x1'));var BPromise=require('bluebird');var rs=require(_0xca0b('0x2'));var fs=require('fs');var Redis=require(_0xca0b('0x3'));var db=require(_0xca0b('0x4'))['db'];var utils=require(_0xca0b('0x5'));var logger=require(_0xca0b('0x6'))(_0xca0b('0x7'));var config=require(_0xca0b('0x8'));var jayson=require(_0xca0b('0x9'));var client=jayson[_0xca0b('0xa')][_0xca0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbe64c7,_0x30202d,_0xa506a4){return new BPromise(function(_0x19acc2,_0x55a1de){return client[_0xca0b('0xc')](_0xbe64c7,_0xa506a4)[_0xca0b('0xd')](function(_0x3e3909){logger[_0xca0b('0xe')](_0xca0b('0xf'),_0x30202d,_0xca0b('0x10'));logger['debug'](_0xca0b('0x11'),_0x30202d,_0xca0b('0x10'),JSON[_0xca0b('0x12')](_0x3e3909));if(_0x3e3909[_0xca0b('0x13')]){if(_0x3e3909[_0xca0b('0x13')][_0xca0b('0x14')]===0x1f4){logger[_0xca0b('0x13')](_0xca0b('0xf'),_0x30202d,_0x3e3909[_0xca0b('0x13')][_0xca0b('0x15')]);return _0x55a1de(_0x3e3909['error'][_0xca0b('0x15')]);}logger[_0xca0b('0x13')](_0xca0b('0xf'),_0x30202d,_0x3e3909['error'][_0xca0b('0x15')]);return _0x19acc2(_0x3e3909[_0xca0b('0x13')][_0xca0b('0x15')]);}else{logger[_0xca0b('0xe')](_0xca0b('0xf'),_0x30202d,_0xca0b('0x10'));_0x19acc2(_0x3e3909['result'][_0xca0b('0x15')]);}})[_0xca0b('0x16')](function(_0x4d9b16){logger[_0xca0b('0x13')]('Attachment,\x20%s,\x20%s',_0x30202d,_0x4d9b16);_0x55a1de(_0x4d9b16);});});}exports[_0xca0b('0x17')]=function(_0x5050b7){var _0x236503=this;return new Promise(function(_0x32eff7,_0x97be82){return db['Attachment'][_0xca0b('0x18')](_0x5050b7[_0xca0b('0x19')],{'raw':_0x5050b7['options']?_0x5050b7[_0xca0b('0x1a')][_0xca0b('0x1b')]===undefined?!![]:![]:!![]})[_0xca0b('0xd')](function(_0x59bda9){logger[_0xca0b('0xe')](_0xca0b('0x17'),_0x5050b7);logger[_0xca0b('0x1c')](_0xca0b('0x17'),_0x5050b7,JSON[_0xca0b('0x12')](_0x59bda9));_0x32eff7(_0x59bda9);})[_0xca0b('0x16')](function(_0x49e695){logger[_0xca0b('0x13')](_0xca0b('0x17'),_0x49e695[_0xca0b('0x15')],_0x5050b7);_0x97be82(_0x236503['error'](0x1f4,_0x49e695['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index c9f5eb7..b5a867a 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 _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(_0x5db046,_0x39fc8d){_0x5db046=_0x5db046-0x0;var _0x85f38f=_0xdb28[_0x5db046];return _0x85f38f;};'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 +var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0xef81f1,_0x560ecf){var _0x55b993=function(_0x3f2d3f){while(--_0x3f2d3f){_0xef81f1['push'](_0xef81f1['shift']());}};_0x55b993(++_0x560ecf);}(_0xb10b,0x12a));var _0xbb10=function(_0x1cc2a9,_0x2c5885){_0x1cc2a9=_0x1cc2a9-0x0;var _0xdcc257=_0xb10b[_0x1cc2a9];return _0xdcc257;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index d2cae63..8db2dbd 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ae5=['../../config/environment','../../config/logger','activedirectory','undefined','baseDN','url','authenticate','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','role','disabled','blocked','blockedAt','online','admin','user','name','domain','add','minutes','clearBlockUser','getLicense','catch','status','send','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport','Strategy','moment','bluebird','util','../../mysqldb','../../components/auth/service'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x4ae5,0x189));var _0x54ae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4ae5[_0x14add3];return _0x4a174f;};'use strict';var passport=require(_0x54ae('0x0'));var LocalStrategy=require('passport-local')[_0x54ae('0x1')];var moment=require(_0x54ae('0x2'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x54ae('0x3'));var util=require(_0x54ae('0x4'));var db=require(_0x54ae('0x5'))['db'];var authService=require(_0x54ae('0x6'));var utils=require('../../config/utils');var config=require(_0x54ae('0x7'));var logger=require(_0x54ae('0x8'))('api');function isActiveDirectoryConfigured(_0x5128cd){var _0x58f013=![];if(typeof _0x5128cd[_0x54ae('0x9')]!==_0x54ae('0xa')){_0x58f013=_0x5128cd['activedirectory'][_0x54ae('0xb')]&&_0x5128cd[_0x54ae('0x9')][_0x54ae('0xc')]&&_0x5128cd[_0x54ae('0x9')]['domain'];}return _0x58f013;}function adAuthenticate(_0x800d3a,_0x1cc265,_0x5c647f){return new BPromise(function(_0x1833a1,_0x1c3c1c){try{var _0x331b4f=new ActiveDirectory(_0x800d3a);_0x331b4f[_0x54ae('0xd')](_0x1cc265,_0x5c647f,function(_0x6648b4,_0x4295ee){if(_0x6648b4){logger[_0x54ae('0xe')]('Error\x20authenticate\x20%s:\x20%s',_0x1cc265,util[_0x54ae('0xf')](_0x6648b4,{'showHidden':![],'depth':null}));_0x1c3c1c(_0x54ae('0x10'));}else if(!_0x4295ee){logger[_0x54ae('0xe')](_0x54ae('0x11'),_0x1cc265);_0x1c3c1c(_0x54ae('0x10'));}else{_0x1833a1(_0x4295ee);}});}catch(_0x291a41){_0x1c3c1c(_0x291a41);}});}function ActiveDirectoryAuthenticate(_0x1ff66d,_0x584354,_0x158570,_0x47fd6c){var _0x96e1f,_0x5214dc;if(!isActiveDirectoryConfigured(config)){logger[_0x54ae('0xe')](_0x54ae('0x12'),_0x584354);return _0x47fd6c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x54ae('0x13')][_0x54ae('0x14')]({'where':{'id':0x1},'attributes':[_0x54ae('0x15'),_0x54ae('0x16')],'raw':!![]})[_0x54ae('0x17')](function(_0x47e490){_0x96e1f=_0x47e490;if(!_0x96e1f['adSsoEnabled']){logger[_0x54ae('0xe')](_0x54ae('0x18'),_0x584354);throw new Error(_0x54ae('0x10'));}return _0x1ff66d[_0x54ae('0x14')]({'attributes':['id','name',_0x54ae('0x19'),_0x54ae('0x1a'),_0x54ae('0x1b'),_0x54ae('0x1c'),_0x54ae('0x1d'),_0x54ae('0x1e'),_0x54ae('0x1f')],'where':{'name':_0x584354,'role':{'$or':[_0x54ae('0x20'),_0x54ae('0x21'),'agent']},'adSsoEnabled':!![]}});})[_0x54ae('0x17')](function(_0x5e2593){if(!_0x5e2593||_0x5e2593&&_0x5e2593[_0x54ae('0x22')]!==_0x584354){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x5214dc=_0x5e2593;var _0x38d92e=_0x5214dc[_0x54ae('0x22')]+'@'+config[_0x54ae('0x9')][_0x54ae('0x23')];return adAuthenticate(config['activedirectory'],_0x38d92e,_0x158570);})['then'](function(_0x527e92){if(_0x5214dc[_0x54ae('0x1c')]){throw new Error(_0x54ae('0x10'));}if(_0x96e1f[_0x54ae('0x16')]>0x0){if(_0x5214dc[_0x54ae('0x1d')]){if(moment(_0x5214dc[_0x54ae('0x1e')])[_0x54ae('0x24')](_0x96e1f['blockDuration'],_0x54ae('0x25'))>moment()){throw new Error(_0x54ae('0x10'));}return utils[_0x54ae('0x26')](_0x5214dc,0x0,![],null)[_0x54ae('0x17')](function(){return utils['getLicense'](_0x5214dc);})['then'](function(){return _0x47fd6c(null,_0x5214dc);});}else{return utils[_0x54ae('0x27')](_0x5214dc)[_0x54ae('0x17')](function(){return _0x47fd6c(null,_0x5214dc);});}}else{return utils[_0x54ae('0x27')](_0x5214dc)[_0x54ae('0x17')](function(){return _0x47fd6c(null,_0x5214dc);});}})[_0x54ae('0x28')](function(_0x295cb1){return _0x47fd6c(null,![],_0x295cb1);});}function handleError(_0x179635,_0x50dfd6,_0x40d6b8){return _0x179635[_0x54ae('0x29')](_0x50dfd6||0x1f4)[_0x54ae('0x2a')]({'message':_0x40d6b8?_0x40d6b8['message']||_0x40d6b8:''});}exports[_0x54ae('0x2b')]=function(_0x630ae,_0x4acc4e,_0x148b74){passport[_0x54ae('0xd')](_0x54ae('0x2c'),function(_0x437bf2,_0x1a316d,_0x184612){var _0x2d4be3=_0x437bf2||_0x184612;if(_0x2d4be3){return handleError(_0x4acc4e,0x191,_0x2d4be3);}if(!_0x1a316d){return handleError(_0x4acc4e,0x194,{'message':_0x54ae('0x2d')});}else{var _0x1497e6={'payload':{'id':_0x1a316d['id'],'role':_0x1a316d[_0x54ae('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0x54ae('0x2e')](_0x1497e6)[_0x54ae('0x17')](function(_0x53271a){_0x4acc4e[_0x54ae('0x2f')]({'id':_0x1a316d['id'],'token':_0x53271a,'statusCall':'','isAlreadyLogged':_0x1a316d[_0x54ae('0x1f')]});});}})(_0x630ae,_0x4acc4e,_0x148b74);};passport[_0x54ae('0x30')](_0x54ae('0x2c'),new LocalStrategy({'usernameField':_0x54ae('0x22'),'passwordField':_0x54ae('0x19')},function(_0xce0ba9,_0x394514,_0x57bd57){return ActiveDirectoryAuthenticate(db[_0x54ae('0x31')],_0xce0ba9,_0x394514,_0x57bd57);})); \ No newline at end of file +var _0x561d=['url','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','online','admin','agent','domain','add','minutes','getLicense','catch','status','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','ad-login','User','passport','passport-local','Strategy','moment','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN'];(function(_0x444be1,_0x3156e1){var _0x51732b=function(_0x2c37a8){while(--_0x2c37a8){_0x444be1['push'](_0x444be1['shift']());}};_0x51732b(++_0x3156e1);}(_0x561d,0x1f1));var _0xd561=function(_0x27aa68,_0x5dab72){_0x27aa68=_0x27aa68-0x0;var _0x413916=_0x561d[_0x27aa68];return _0x413916;};'use strict';var passport=require(_0xd561('0x0'));var LocalStrategy=require(_0xd561('0x1'))[_0xd561('0x2')];var moment=require(_0xd561('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require('bluebird');var util=require(_0xd561('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0xd561('0x5'));var utils=require(_0xd561('0x6'));var config=require(_0xd561('0x7'));var logger=require(_0xd561('0x8'))(_0xd561('0x9'));function isActiveDirectoryConfigured(_0x55ae30){var _0x416c2f=![];if(typeof _0x55ae30[_0xd561('0xa')]!==_0xd561('0xb')){_0x416c2f=_0x55ae30[_0xd561('0xa')][_0xd561('0xc')]&&_0x55ae30[_0xd561('0xa')][_0xd561('0xd')]&&_0x55ae30[_0xd561('0xa')]['domain'];}return _0x416c2f;}function adAuthenticate(_0x127fd5,_0x3be1c9,_0x344ddc){return new BPromise(function(_0x46ca60,_0x2de7d7){try{var _0x5efe80=new ActiveDirectory(_0x127fd5);_0x5efe80[_0xd561('0xe')](_0x3be1c9,_0x344ddc,function(_0x1e4c11,_0xba9c38){if(_0x1e4c11){logger[_0xd561('0xf')](_0xd561('0x10'),_0x3be1c9,util[_0xd561('0x11')](_0x1e4c11,{'showHidden':![],'depth':null}));_0x2de7d7(_0xd561('0x12'));}else if(!_0xba9c38){logger['error'](_0xd561('0x13'),_0x3be1c9);_0x2de7d7('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x46ca60(_0xba9c38);}});}catch(_0x5029ce){_0x2de7d7(_0x5029ce);}});}function ActiveDirectoryAuthenticate(_0x2f1e45,_0x590612,_0x3a6fab,_0xd1de65){var _0x3b84eb,_0x303ca1;if(!isActiveDirectoryConfigured(config)){logger['error'](_0xd561('0x14'),_0x590612);return _0xd1de65(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xd561('0x15')][_0xd561('0x16')]({'where':{'id':0x1},'attributes':[_0xd561('0x17'),_0xd561('0x18')],'raw':!![]})[_0xd561('0x19')](function(_0x17a7d3){_0x3b84eb=_0x17a7d3;if(!_0x3b84eb['adSsoEnabled']){logger[_0xd561('0xf')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x590612);throw new Error(_0xd561('0x12'));}return _0x2f1e45[_0xd561('0x16')]({'attributes':['id',_0xd561('0x1a'),_0xd561('0x1b'),_0xd561('0x1c'),_0xd561('0x1d'),_0xd561('0x1e'),_0xd561('0x1f'),_0xd561('0x20'),_0xd561('0x21')],'where':{'name':_0x590612,'role':{'$or':[_0xd561('0x22'),'user',_0xd561('0x23')]},'adSsoEnabled':!![]}});})['then'](function(_0x4e6c53){if(!_0x4e6c53||_0x4e6c53&&_0x4e6c53[_0xd561('0x1a')]!==_0x590612){throw new Error(_0xd561('0x12'));}_0x303ca1=_0x4e6c53;var _0x19fc12=_0x303ca1[_0xd561('0x1a')]+'@'+config[_0xd561('0xa')][_0xd561('0x24')];return adAuthenticate(config['activedirectory'],_0x19fc12,_0x3a6fab);})[_0xd561('0x19')](function(_0x1ac6d9){if(_0x303ca1[_0xd561('0x1e')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x3b84eb['blockDuration']>0x0){if(_0x303ca1[_0xd561('0x1f')]){if(moment(_0x303ca1[_0xd561('0x20')])[_0xd561('0x25')](_0x3b84eb[_0xd561('0x18')],_0xd561('0x26'))>moment()){throw new Error(_0xd561('0x12'));}return utils['clearBlockUser'](_0x303ca1,0x0,![],null)[_0xd561('0x19')](function(){return utils[_0xd561('0x27')](_0x303ca1);})[_0xd561('0x19')](function(){return _0xd1de65(null,_0x303ca1);});}else{return utils['getLicense'](_0x303ca1)['then'](function(){return _0xd1de65(null,_0x303ca1);});}}else{return utils['getLicense'](_0x303ca1)[_0xd561('0x19')](function(){return _0xd1de65(null,_0x303ca1);});}})[_0xd561('0x28')](function(_0x450bec){return _0xd1de65(null,![],_0x450bec);});}function handleError(_0x22bc68,_0x4eab84,_0x1c6a2f){return _0x22bc68[_0xd561('0x29')](_0x4eab84||0x1f4)[_0xd561('0x2a')]({'message':_0x1c6a2f?_0x1c6a2f[_0xd561('0x2b')]||_0x1c6a2f:''});}exports[_0xd561('0x2c')]=function(_0x3384bf,_0x1d489c,_0x20212c){passport['authenticate']('ad-login',function(_0x30fc32,_0x71784c,_0x3605a0){var _0x433586=_0x30fc32||_0x3605a0;if(_0x433586){return handleError(_0x1d489c,0x191,_0x433586);}if(!_0x71784c){return handleError(_0x1d489c,0x194,{'message':_0xd561('0x2d')});}else{var _0x45de16={'payload':{'id':_0x71784c['id'],'role':_0x71784c[_0xd561('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0xd561('0x2e')](_0x45de16)['then'](function(_0x541310){_0x1d489c[_0xd561('0x2f')]({'id':_0x71784c['id'],'token':_0x541310,'statusCall':'','isAlreadyLogged':_0x71784c[_0xd561('0x21')]});});}})(_0x3384bf,_0x1d489c,_0x20212c);};passport[_0xd561('0x30')](_0xd561('0x31'),new LocalStrategy({'usernameField':_0xd561('0x1a'),'passwordField':_0xd561('0x1b')},function(_0x26722c,_0x2648e1,_0x16018b){return ActiveDirectoryAuthenticate(db[_0xd561('0x32')],_0x26722c,_0x2648e1,_0x16018b);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 1708565..3796de4 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6351=['login','exports','express','Router'];(function(_0x530ab8,_0x26f687){var _0x1e1b83=function(_0x3a7aeb){while(--_0x3a7aeb){_0x530ab8['push'](_0x530ab8['shift']());}};_0x1e1b83(++_0x26f687);}(_0x6351,0x116));var _0x1635=function(_0x3d7a9f,_0x24e0f1){_0x3d7a9f=_0x3d7a9f-0x0;var _0x13f5f1=_0x6351[_0x3d7a9f];return _0x13f5f1;};'use strict';var express=require(_0x1635('0x0'));var router=express[_0x1635('0x1')]();var controller=require('./authActiveDirectory.controller');router['post']('/',controller[_0x1635('0x2')]);module[_0x1635('0x3')]=router; \ No newline at end of file +var _0x9368=['login','Router','./authActiveDirectory.controller','post'];(function(_0x8895d0,_0xbf13d2){var _0x3cf809=function(_0x38bc46){while(--_0x38bc46){_0x8895d0['push'](_0x8895d0['shift']());}};_0x3cf809(++_0xbf13d2);}(_0x9368,0x99));var _0x8936=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x9368[_0x476bf4];return _0x788ffe;};'use strict';var express=require('express');var router=express[_0x8936('0x0')]();var controller=require(_0x8936('0x1'));router[_0x8936('0x2')]('/',controller[_0x8936('0x3')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index bb2794c..01e9433 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 _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x7a54,0x106));var _0x47a5=function(_0x325ed5,_0x261957){_0x325ed5=_0x325ed5-0x0;var _0x11e678=_0x7a54[_0x325ed5];return _0x11e678;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x36bb8b,_0x34ff2a){var _0x15aba9=function(_0x166e16){while(--_0x166e16){_0x36bb8b['push'](_0x36bb8b['shift']());}};_0x15aba9(++_0x34ff2a);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 8ace6f6..6f2a490 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 _0x973f=['get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service'];(function(_0x35c2fc,_0xabea37){var _0x4727fd=function(_0x4eccfe){while(--_0x4eccfe){_0x35c2fc['push'](_0x35c2fc['shift']());}};_0x4727fd(++_0xabea37);}(_0x973f,0x13f));var _0xf973=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x973f[_0x45d55e];return _0x29812a;};'use strict';var express=require(_0xf973('0x0'));var passport=require(_0xf973('0x1'));var router=express[_0xf973('0x2')]();var controller=require(_0xf973('0x3'));var userController=require(_0xf973('0x4'));var authService=require(_0xf973('0x5'));router[_0xf973('0x6')]('/',controller[_0xf973('0x7')]);router[_0xf973('0x6')](_0xf973('0x8'),controller[_0xf973('0x9')],authService[_0xf973('0xa')],userController[_0xf973('0x7')],authService[_0xf973('0xb')]);module[_0xf973('0xc')]=router; \ No newline at end of file +var _0xb41e=['setTokenCookie','express','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware'];(function(_0x438efa,_0x5818ba){var _0x989dcb=function(_0x2ca6e7){while(--_0x2ca6e7){_0x438efa['push'](_0x438efa['shift']());}};_0x989dcb(++_0x5818ba);}(_0xb41e,0x1f0));var _0xeb41=function(_0x2acbb3,_0x29e1b4){_0x2acbb3=_0x2acbb3-0x0;var _0x5c0cc7=_0xb41e[_0x2acbb3];return _0x5c0cc7;};'use strict';var express=require(_0xeb41('0x0'));var passport=require('passport');var router=express[_0xeb41('0x1')]();var controller=require(_0xeb41('0x2'));var userController=require(_0xeb41('0x3'));var authService=require(_0xeb41('0x4'));router[_0xeb41('0x5')]('/',controller[_0xeb41('0x6')]);router['get'](_0xeb41('0x7'),controller[_0xeb41('0x8')],authService[_0xeb41('0x9')],userController[_0xeb41('0x6')],authService[_0xeb41('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 32a992c..4e83f76 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 _0xd0d8=['token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','validatePasswordHistory','password','previousPasswords','resetPasswordExpires','Password\x20reset!','use','util','Strategy','jayson/promise','lodash','randomstring','moment','../../config/utils','http','Setting','findOne','blockDuration','then','name','salt','disabled','blocked','blockedAt','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','clearBlockUser','add','getLicense','catch','MailAccount','find','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','email','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','minutes','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'];(function(_0x1b8996,_0x1f04fb){var _0x31d7c1=function(_0x2d970b){while(--_0x2d970b){_0x1b8996['push'](_0x1b8996['shift']());}};_0x31d7c1(++_0x1f04fb);}(_0xd0d8,0xa7));var _0x8d0d=function(_0x3b3489,_0x1da252){_0x3b3489=_0x3b3489-0x0;var _0x2a70a3=_0xd0d8[_0x3b3489];return _0x2a70a3;};'use strict';var util=require(_0x8d0d('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')[_0x8d0d('0x1')];var jayson=require(_0x8d0d('0x2'));var _=require(_0x8d0d('0x3'));var rs=require(_0x8d0d('0x4'));var moment=require(_0x8d0d('0x5'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0x8d0d('0x6'));var client=jayson['client'][_0x8d0d('0x7')]({'port':0x232b});function localAuthenticate(_0x495669,_0x49d4e7,_0x572398,_0x24d3ef){var _0x24bbe5,_0x23bda4;return db[_0x8d0d('0x8')][_0x8d0d('0x9')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x8d0d('0xa')],'raw':!![]})[_0x8d0d('0xb')](function(_0x440958){_0x24bbe5=_0x440958;return _0x495669[_0x8d0d('0x9')]({'attributes':['id',_0x8d0d('0xc'),'password',_0x8d0d('0xd'),'role',_0x8d0d('0xe'),_0x8d0d('0xf'),_0x8d0d('0x10'),_0x8d0d('0x11')],'where':{'name':_0x49d4e7,'role':{'$or':[_0x8d0d('0x12'),_0x8d0d('0x13'),'agent']}}});})[_0x8d0d('0xb')](function(_0x253241){if(!_0x253241||_0x253241&&_0x253241[_0x8d0d('0xc')]!==_0x49d4e7){throw new Error(_0x8d0d('0x14'));}else{_0x23bda4=_0x253241;return _0x23bda4;}})['then'](function(){_0x23bda4[_0x8d0d('0x15')](_0x572398,function(_0x85cbe3,_0x3a5ac4){var _0x3593d6=_0x23bda4[_0x8d0d('0x11')]+0x1;if(_0x85cbe3){return _0x24d3ef(_0x85cbe3);}else if(!_0x3a5ac4){if(_0x23bda4[_0x8d0d('0xe')]){return _0x24d3ef(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x24bbe5[_0x8d0d('0x16')]>0x0){if(_0x23bda4[_0x8d0d('0xf')]){if(_0x24bbe5[_0x8d0d('0xa')]>0x0){if(moment(_0x23bda4[_0x8d0d('0x10')])['add'](_0x24bbe5[_0x8d0d('0xa')],'minutes')>moment()){return _0x24d3ef(null,![],{'message':_0x8d0d('0x14')});}else{return utils[_0x8d0d('0x17')](_0x23bda4,_0x3593d6,![],null)[_0x8d0d('0xb')](function(){return _0x24d3ef(null,![],{'message':_0x8d0d('0x14')});});}}else{return _0x24d3ef(null,![],{'message':_0x8d0d('0x14')});}}else{if(_0x3593d6>=_0x24bbe5['allowedLoginAttempts']){return utils[_0x8d0d('0x17')](_0x23bda4,0x0,!![],moment())[_0x8d0d('0xb')](function(){return _0x24d3ef(null,![],{'message':_0x8d0d('0x14')});});}else{return utils['clearBlockUser'](_0x23bda4,_0x3593d6,![],null)['then'](function(){return _0x24d3ef(null,![],{'message':_0x8d0d('0x14')});});}}}else{return _0x24d3ef(null,![],{'message':_0x8d0d('0x14')});}}else{if(_0x23bda4[_0x8d0d('0xe')]){return _0x24d3ef(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x24bbe5[_0x8d0d('0x16')]>0x0){if(_0x23bda4[_0x8d0d('0xf')]){if(_0x24bbe5['blockDuration']>0x0){if(moment(_0x23bda4[_0x8d0d('0x10')])[_0x8d0d('0x18')](_0x24bbe5[_0x8d0d('0xa')],'minutes')>moment()){return _0x24d3ef(null,![],{'message':_0x8d0d('0x14')});}else{return utils[_0x8d0d('0x17')](_0x23bda4,0x0,![],null)[_0x8d0d('0xb')](function(){return utils['getLicense'](_0x23bda4);})[_0x8d0d('0xb')](function(){return _0x24d3ef(null,_0x23bda4);});}}else{return _0x24d3ef(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x8d0d('0x17')](_0x23bda4,0x0,![],null)[_0x8d0d('0xb')](function(){return utils[_0x8d0d('0x19')](_0x23bda4);})[_0x8d0d('0xb')](function(){return _0x24d3ef(null,_0x23bda4);})[_0x8d0d('0x1a')](function(_0x22cea0){return _0x24d3ef(null,![],_0x22cea0);});}}else{if(_0x23bda4[_0x8d0d('0xf')]){return _0x24d3ef(null,![],{'message':_0x8d0d('0x14')});}else{return utils[_0x8d0d('0x19')](_0x23bda4)[_0x8d0d('0xb')](function(){return _0x24d3ef(null,_0x23bda4);});}}}});})[_0x8d0d('0x1a')](function(_0xa2e4c8){return _0x24d3ef(null,![],_0xa2e4c8);});}function sendServiceMail(_0x1076a1){return db[_0x8d0d('0x1b')][_0x8d0d('0x1c')]({'where':{'service':!![]},'attributes':['id',_0x8d0d('0xc'),'email'],'include':[{'model':db[_0x8d0d('0x1d')],'as':_0x8d0d('0x1e'),'include':[{'model':db['CloudProvider'],'as':_0x8d0d('0x1f')}]}]})['then'](function(_0x3f7d81){if(!_0x3f7d81){throw new Error(_0x8d0d('0x20'));}var _0x341574=_0x3f7d81['getSmtpOptions']();var _0x1143c5={'account':_0x341574,'message':_[_0x8d0d('0x21')]({'from':util[_0x8d0d('0x22')](_0x8d0d('0x23'),_0x3f7d81[_0x8d0d('0xc')],_0x3f7d81[_0x8d0d('0x24')]||_0x3f7d81[_0x8d0d('0x1e')]['user'])},_0x1076a1)};return client[_0x8d0d('0x25')]('SendMail',_0x1143c5);})[_0x8d0d('0xb')](function(_0x2fd00b){if(_0x2fd00b[_0x8d0d('0x26')]){throw new Error(util['format'](_0x8d0d('0x27'),_0x2fd00b[_0x8d0d('0x26')]['message']||JSON[_0x8d0d('0x28')](_0x2fd00b[_0x8d0d('0x26')])));}return!![];});}function handleError(_0x319729,_0x225134,_0x8c223d){return _0x319729[_0x8d0d('0x29')](_0x225134||0x1f4)[_0x8d0d('0x2a')]({'message':_0x8c223d?_0x8c223d[_0x8d0d('0x2b')]||_0x8c223d:''});}exports['login']=function(_0x48d0ef,_0x21c375,_0x2736e2){passport['authenticate'](_0x8d0d('0x2c'),function(_0x1b83af,_0x2fb727,_0x1bb747){var _0xb6ea8b=_0x1b83af||_0x1bb747;if(_0xb6ea8b){return handleError(_0x21c375,0x191,_0xb6ea8b);}if(!_0x2fb727){return handleError(_0x21c375,0x194,{'message':_0x8d0d('0x2d')});}else{var _0x27ccac={'payload':{'id':_0x2fb727['id'],'role':_0x2fb727[_0x8d0d('0x2e')]},'options':{'expiresIn':0x15180}};return authService[_0x8d0d('0x2f')](_0x27ccac)['then'](function(_0x58f3d9){_0x21c375[_0x8d0d('0x30')]({'id':_0x2fb727['id'],'token':_0x58f3d9,'statusCall':'','isAlreadyLogged':_0x2fb727[_0x8d0d('0x31')]});});}})(_0x48d0ef,_0x21c375,_0x2736e2);};exports[_0x8d0d('0x32')]=function(_0x49e0e5,_0x1d988b){if(!_0x49e0e5[_0x8d0d('0x33')][_0x8d0d('0x24')]){return handleError(_0x1d988b,0x1f4,{'message':_0x8d0d('0x34')});}var _0x395840=rs['generate']();_0x49e0e5[_0x8d0d('0x33')][_0x8d0d('0x24')]=_0x49e0e5['body']['email'][_0x8d0d('0x35')]()[_0x8d0d('0x36')]();var _0x2314dc;return db[_0x8d0d('0x8')][_0x8d0d('0x9')]({'where':{'id':0x1},'attributes':[_0x8d0d('0x16'),_0x8d0d('0xa')],'raw':!![]})['then'](function(_0x6867c2){_0x2314dc=_0x6867c2;return db[_0x8d0d('0x37')]['find']({'where':{'email':_0x49e0e5[_0x8d0d('0x33')][_0x8d0d('0x24')]}});})['then'](function(_0x58561b){if(!_0x58561b){throw new Error(_0x8d0d('0x38'));}if(_0x58561b[_0x8d0d('0xe')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x58561b['blocked']){if(moment(_0x58561b[_0x8d0d('0x10')])[_0x8d0d('0x18')](_0x2314dc['blockDuration'],_0x8d0d('0x39'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x58561b[_0x8d0d('0xf')]=![];_0x58561b[_0x8d0d('0x10')]=null;}}_0x58561b[_0x8d0d('0x3a')]=_0x395840;_0x58561b['resetPasswordExpires']=Date[_0x8d0d('0x3b')]()+0x36ee80;return _0x58561b[_0x8d0d('0x3c')]();})[_0x8d0d('0xb')](function(){return sendServiceMail({'to':_0x49e0e5['body'][_0x8d0d('0x24')],'subject':_0x8d0d('0x3d'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x8d0d('0x3e')+'https://'+_0x49e0e5[_0x8d0d('0x3f')][_0x8d0d('0x40')]+_0x8d0d('0x41')+_0x395840+'\x0a\x0a'+_0x8d0d('0x42')});})[_0x8d0d('0xb')](function(){_0x1d988b[_0x8d0d('0x29')](0xc8)[_0x8d0d('0x2a')]({'message':'Reset\x20Email\x20sent!'});})[_0x8d0d('0x1a')](function(_0x377242){return handleError(_0x1d988b,0x1f4,_0x377242);});};exports['reset']=function(_0xe72824,_0x3c882b){return db[_0x8d0d('0x37')][_0x8d0d('0x1c')]({'where':{'resetPasswordToken':_0xe72824['params'][_0x8d0d('0x43')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x8d0d('0xb')](function(_0x4f9ac9){if(!_0x4f9ac9){throw new Error(_0x8d0d('0x44'));}return db[_0x8d0d('0x8')]['findOne']({'attributes':['id',_0x8d0d('0x45'),_0x8d0d('0x46'),'passwordHistoryLimit']})[_0x8d0d('0xb')](function(_0x3f2c79){if(_0x3f2c79['securePassword'])authService[_0x8d0d('0x47')](_0xe72824['body']['password']);if(!_0x3f2c79[_0x8d0d('0x46')]||!_0x4f9ac9['previousPasswords'])return _0x4f9ac9;authService[_0x8d0d('0x48')](_0xe72824[_0x8d0d('0x33')][_0x8d0d('0x49')],_0x4f9ac9[_0x8d0d('0x4a')],_0x3f2c79['passwordHistoryLimit']);return _0x4f9ac9;})[_0x8d0d('0xb')](function(){_0x4f9ac9[_0x8d0d('0x49')]=_0xe72824[_0x8d0d('0x33')][_0x8d0d('0x49')];_0x4f9ac9['resetPasswordToken']=null;_0x4f9ac9[_0x8d0d('0x4b')]=null;return _0x4f9ac9[_0x8d0d('0x3c')]();});})[_0x8d0d('0xb')](function(){_0x3c882b[_0x8d0d('0x29')](0xc8)[_0x8d0d('0x2a')]({'message':_0x8d0d('0x4c')});})['catch'](function(_0x54663c){return handleError(_0x3c882b,0x1f4,_0x54663c);});};passport[_0x8d0d('0x4d')]('local-login',new LocalStrategy({'usernameField':_0x8d0d('0xc'),'passwordField':_0x8d0d('0x49')},function(_0x34967f,_0x5e7361,_0x1c93b1){return localAuthenticate(db[_0x8d0d('0x37')],_0x34967f,_0x5e7361,_0x1c93b1);})); \ No newline at end of file +var _0xbe25=['MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','email','generate','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','add','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','validatePasswordHistory','previousPasswords','save','Password\x20reset!','util','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','minutes','clearBlockUser','getLicense','catch','MailAccount','find'];(function(_0x4687df,_0x12099c){var _0x32eaef=function(_0x2387db){while(--_0x2387db){_0x4687df['push'](_0x4687df['shift']());}};_0x32eaef(++_0x12099c);}(_0xbe25,0x79));var _0x5be2=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xbe25[_0x3070dc];return _0x431489;};'use strict';var util=require(_0x5be2('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')['Strategy'];var jayson=require('jayson/promise');var _=require(_0x5be2('0x1'));var rs=require(_0x5be2('0x2'));var moment=require('moment');var db=require(_0x5be2('0x3'))['db'];var authService=require(_0x5be2('0x4'));var utils=require(_0x5be2('0x5'));var client=jayson[_0x5be2('0x6')][_0x5be2('0x7')]({'port':0x232b});function localAuthenticate(_0x1ea416,_0x4b4a38,_0x497412,_0x4eeb7f){var _0x130171,_0x166558;return db[_0x5be2('0x8')]['findOne']({'where':{'id':0x1},'attributes':[_0x5be2('0x9'),_0x5be2('0xa')],'raw':!![]})[_0x5be2('0xb')](function(_0x2cbfeb){_0x130171=_0x2cbfeb;return _0x1ea416[_0x5be2('0xc')]({'attributes':['id',_0x5be2('0xd'),'password',_0x5be2('0xe'),_0x5be2('0xf'),_0x5be2('0x10'),_0x5be2('0x11'),_0x5be2('0x12'),_0x5be2('0x13')],'where':{'name':_0x4b4a38,'role':{'$or':[_0x5be2('0x14'),_0x5be2('0x15'),_0x5be2('0x16')]}}});})['then'](function(_0x3b43a6){if(!_0x3b43a6||_0x3b43a6&&_0x3b43a6[_0x5be2('0xd')]!==_0x4b4a38){throw new Error(_0x5be2('0x17'));}else{_0x166558=_0x3b43a6;return _0x166558;}})[_0x5be2('0xb')](function(){_0x166558[_0x5be2('0x18')](_0x497412,function(_0x34a7ca,_0x2aa90c){var _0x1a5f69=_0x166558[_0x5be2('0x13')]+0x1;if(_0x34a7ca){return _0x4eeb7f(_0x34a7ca);}else if(!_0x2aa90c){if(_0x166558[_0x5be2('0x10')]){return _0x4eeb7f(null,![],{'message':_0x5be2('0x17')});}else if(_0x130171[_0x5be2('0x9')]>0x0){if(_0x166558[_0x5be2('0x11')]){if(_0x130171[_0x5be2('0xa')]>0x0){if(moment(_0x166558[_0x5be2('0x12')])['add'](_0x130171[_0x5be2('0xa')],_0x5be2('0x19'))>moment()){return _0x4eeb7f(null,![],{'message':_0x5be2('0x17')});}else{return utils[_0x5be2('0x1a')](_0x166558,_0x1a5f69,![],null)[_0x5be2('0xb')](function(){return _0x4eeb7f(null,![],{'message':_0x5be2('0x17')});});}}else{return _0x4eeb7f(null,![],{'message':_0x5be2('0x17')});}}else{if(_0x1a5f69>=_0x130171[_0x5be2('0x9')]){return utils[_0x5be2('0x1a')](_0x166558,0x0,!![],moment())[_0x5be2('0xb')](function(){return _0x4eeb7f(null,![],{'message':_0x5be2('0x17')});});}else{return utils[_0x5be2('0x1a')](_0x166558,_0x1a5f69,![],null)[_0x5be2('0xb')](function(){return _0x4eeb7f(null,![],{'message':_0x5be2('0x17')});});}}}else{return _0x4eeb7f(null,![],{'message':_0x5be2('0x17')});}}else{if(_0x166558[_0x5be2('0x10')]){return _0x4eeb7f(null,![],{'message':_0x5be2('0x17')});}else if(_0x130171[_0x5be2('0x9')]>0x0){if(_0x166558[_0x5be2('0x11')]){if(_0x130171[_0x5be2('0xa')]>0x0){if(moment(_0x166558[_0x5be2('0x12')])['add'](_0x130171[_0x5be2('0xa')],_0x5be2('0x19'))>moment()){return _0x4eeb7f(null,![],{'message':_0x5be2('0x17')});}else{return utils[_0x5be2('0x1a')](_0x166558,0x0,![],null)[_0x5be2('0xb')](function(){return utils[_0x5be2('0x1b')](_0x166558);})['then'](function(){return _0x4eeb7f(null,_0x166558);});}}else{return _0x4eeb7f(null,![],{'message':_0x5be2('0x17')});}}else{return utils[_0x5be2('0x1a')](_0x166558,0x0,![],null)[_0x5be2('0xb')](function(){return utils[_0x5be2('0x1b')](_0x166558);})['then'](function(){return _0x4eeb7f(null,_0x166558);})[_0x5be2('0x1c')](function(_0x5da0d1){return _0x4eeb7f(null,![],_0x5da0d1);});}}else{if(_0x166558[_0x5be2('0x11')]){return _0x4eeb7f(null,![],{'message':_0x5be2('0x17')});}else{return utils[_0x5be2('0x1b')](_0x166558)[_0x5be2('0xb')](function(){return _0x4eeb7f(null,_0x166558);});}}}});})[_0x5be2('0x1c')](function(_0x2c9ae9){return _0x4eeb7f(null,![],_0x2c9ae9);});}function sendServiceMail(_0x2ebf6b){return db[_0x5be2('0x1d')][_0x5be2('0x1e')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0x5be2('0x1f')],'as':'Smtp','include':[{'model':db[_0x5be2('0x20')],'as':'CloudProvider'}]}]})[_0x5be2('0xb')](function(_0x40ccce){if(!_0x40ccce){throw new Error(_0x5be2('0x21'));}var _0x41b7e0=_0x40ccce[_0x5be2('0x22')]();var _0x23d1ca={'account':_0x41b7e0,'message':_['merge']({'from':util[_0x5be2('0x23')](_0x5be2('0x24'),_0x40ccce[_0x5be2('0xd')],_0x40ccce['email']||_0x40ccce['Smtp'][_0x5be2('0x15')])},_0x2ebf6b)};return client[_0x5be2('0x25')](_0x5be2('0x26'),_0x23d1ca);})['then'](function(_0x695d17){if(_0x695d17[_0x5be2('0x27')]){throw new Error(util[_0x5be2('0x23')](_0x5be2('0x28'),_0x695d17[_0x5be2('0x27')][_0x5be2('0x29')]||JSON[_0x5be2('0x2a')](_0x695d17[_0x5be2('0x27')])));}return!![];});}function handleError(_0x1207b5,_0x1fb51f,_0x26eb7f){return _0x1207b5[_0x5be2('0x2b')](_0x1fb51f||0x1f4)['send']({'message':_0x26eb7f?_0x26eb7f[_0x5be2('0x29')]||_0x26eb7f:''});}exports[_0x5be2('0x2c')]=function(_0x4e5c99,_0x2fa0d9,_0x4a004b){passport[_0x5be2('0x18')](_0x5be2('0x2d'),function(_0x1e483d,_0x121e73,_0x2b0efa){var _0x33c516=_0x1e483d||_0x2b0efa;if(_0x33c516){return handleError(_0x2fa0d9,0x191,_0x33c516);}if(!_0x121e73){return handleError(_0x2fa0d9,0x194,{'message':_0x5be2('0x2e')});}else{var _0x26f870={'payload':{'id':_0x121e73['id'],'role':_0x121e73[_0x5be2('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x5be2('0x2f')](_0x26f870)[_0x5be2('0xb')](function(_0x4c667a){_0x2fa0d9[_0x5be2('0x30')]({'id':_0x121e73['id'],'token':_0x4c667a,'statusCall':'','isAlreadyLogged':_0x121e73[_0x5be2('0x31')]});});}})(_0x4e5c99,_0x2fa0d9,_0x4a004b);};exports['forgot']=function(_0x705605,_0xcf0ca){if(!_0x705605['body'][_0x5be2('0x32')]){return handleError(_0xcf0ca,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x21f7c2=rs[_0x5be2('0x33')]();_0x705605[_0x5be2('0x34')][_0x5be2('0x32')]=_0x705605['body'][_0x5be2('0x32')][_0x5be2('0x35')]()[_0x5be2('0x36')]();var _0x1b314e;return db[_0x5be2('0x8')]['findOne']({'where':{'id':0x1},'attributes':[_0x5be2('0x9'),_0x5be2('0xa')],'raw':!![]})[_0x5be2('0xb')](function(_0x3b742e){_0x1b314e=_0x3b742e;return db[_0x5be2('0x37')][_0x5be2('0x1e')]({'where':{'email':_0x705605[_0x5be2('0x34')][_0x5be2('0x32')]}});})[_0x5be2('0xb')](function(_0x388142){if(!_0x388142){throw new Error(_0x5be2('0x38'));}if(_0x388142['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x388142[_0x5be2('0x11')]){if(moment(_0x388142[_0x5be2('0x12')])[_0x5be2('0x39')](_0x1b314e[_0x5be2('0xa')],_0x5be2('0x19'))>moment()){throw new Error(_0x5be2('0x3a'));}else{_0x388142[_0x5be2('0x11')]=![];_0x388142[_0x5be2('0x12')]=null;}}_0x388142[_0x5be2('0x3b')]=_0x21f7c2;_0x388142[_0x5be2('0x3c')]=Date[_0x5be2('0x3d')]()+0x36ee80;return _0x388142['save']();})[_0x5be2('0xb')](function(){return sendServiceMail({'to':_0x705605['body'][_0x5be2('0x32')],'subject':_0x5be2('0x3e'),'text':'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://'+_0x705605['headers']['host']+'/reset/'+_0x21f7c2+'\x0a\x0a'+_0x5be2('0x3f')});})[_0x5be2('0xb')](function(){_0xcf0ca[_0x5be2('0x2b')](0xc8)[_0x5be2('0x40')]({'message':'Reset\x20Email\x20sent!'});})[_0x5be2('0x1c')](function(_0x4d16a1){return handleError(_0xcf0ca,0x1f4,_0x4d16a1);});};exports[_0x5be2('0x41')]=function(_0x5b86d1,_0x3cf6fe){return db[_0x5be2('0x37')]['find']({'where':{'resetPasswordToken':_0x5b86d1[_0x5be2('0x42')]['token'],'resetPasswordExpires':{'$gt':Date[_0x5be2('0x3d')]()}}})[_0x5be2('0xb')](function(_0x109361){if(!_0x109361){throw new Error(_0x5be2('0x43'));}return db['Setting'][_0x5be2('0xc')]({'attributes':['id','securePassword',_0x5be2('0x44'),_0x5be2('0x45')]})[_0x5be2('0xb')](function(_0xd0a180){if(_0xd0a180['securePassword'])authService[_0x5be2('0x46')](_0x5b86d1[_0x5be2('0x34')][_0x5be2('0x47')]);if(!_0xd0a180['enforcePasswordHistory']||!_0x109361['previousPasswords'])return _0x109361;authService[_0x5be2('0x48')](_0x5b86d1[_0x5be2('0x34')][_0x5be2('0x47')],_0x109361[_0x5be2('0x49')],_0xd0a180['passwordHistoryLimit']);return _0x109361;})[_0x5be2('0xb')](function(){_0x109361[_0x5be2('0x47')]=_0x5b86d1[_0x5be2('0x34')]['password'];_0x109361[_0x5be2('0x3b')]=null;_0x109361[_0x5be2('0x3c')]=null;return _0x109361[_0x5be2('0x4a')]();});})[_0x5be2('0xb')](function(){_0x3cf6fe[_0x5be2('0x2b')](0xc8)['send']({'message':_0x5be2('0x4b')});})[_0x5be2('0x1c')](function(_0x14efdf){return handleError(_0x3cf6fe,0x1f4,_0x14efdf);});};passport['use'](_0x5be2('0x2d'),new LocalStrategy({'usernameField':_0x5be2('0xd'),'passwordField':_0x5be2('0x47')},function(_0x504b8b,_0x4e009c,_0x1a97e6){return localAuthenticate(db[_0x5be2('0x37')],_0x504b8b,_0x4e009c,_0x1a97e6);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index a775e84..1c889ef 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 _0xd802=['exports','express','Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token'];(function(_0x1007b3,_0x344f7f){var _0x7cf215=function(_0x5e25a0){while(--_0x5e25a0){_0x1007b3['push'](_0x1007b3['shift']());}};_0x7cf215(++_0x344f7f);}(_0xd802,0x14e));var _0x2d80=function(_0x2b305c,_0x5ae303){_0x2b305c=_0x2b305c-0x0;var _0x5d8c85=_0xd802[_0x2b305c];return _0x5d8c85;};'use strict';var express=require(_0x2d80('0x0'));var router=express[_0x2d80('0x1')]();var controller=require(_0x2d80('0x2'));router[_0x2d80('0x3')]('/',controller[_0x2d80('0x4')]);router['post'](_0x2d80('0x5'),controller[_0x2d80('0x6')]);router['post'](_0x2d80('0x7'),controller['reset']);module[_0x2d80('0x8')]=router; \ No newline at end of file +var _0xc52e=['/forgot','/reset/:token','reset','exports','express','Router','post'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc52e,0x146));var _0xec52=function(_0x5d93a4,_0x10fca8){_0x5d93a4=_0x5d93a4-0x0;var _0x17b491=_0xc52e[_0x5d93a4];return _0x17b491;};'use strict';var express=require(_0xec52('0x0'));var router=express[_0xec52('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller['login']);router[_0xec52('0x2')](_0xec52('0x3'),controller['forgot']);router[_0xec52('0x2')](_0xec52('0x4'),controller[_0xec52('0x5')]);module[_0xec52('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 f6e59c0..9f1b9ef 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 _0xe3ba=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe3ba,0x1f0));var _0xae3b=function(_0x142020,_0x1f7233){_0x142020=_0x142020-0x0;var _0x40da8f=_0xe3ba[_0x142020];return _0x40da8f;};'use strict';var Sequelize=require(_0xae3b('0x0'));module[_0xae3b('0x1')]={'name':{'type':Sequelize[_0xae3b('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xae3b('0x2')]},'description':{'type':Sequelize[_0xae3b('0x2')]},'status':{'type':Sequelize[_0xae3b('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xae3b('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x205e=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x211b3c,_0x183a2e){var _0x5effcb=function(_0x359802){while(--_0x359802){_0x211b3c['push'](_0x211b3c['shift']());}};_0x5effcb(++_0x183a2e);}(_0x205e,0x67));var _0xe205=function(_0x553cb2,_0x2e568){_0x553cb2=_0x553cb2-0x0;var _0x2b115d=_0x205e[_0x553cb2];return _0x2b115d;};'use strict';var Sequelize=require(_0xe205('0x0'));module[_0xe205('0x1')]={'name':{'type':Sequelize[_0xe205('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xe205('0x2')]},'description':{'type':Sequelize[_0xe205('0x2')]},'status':{'type':Sequelize[_0xe205('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xe205('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index a83122a..3a12e91 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 _0x8a58=['map','Automation','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','type','include','findAll','catch','show','params','rawAttributes','includeAll','create','body','find','addConditions','Condition','ids','omit','getConditions','where','addActions','Action','getActions','findOne','options','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','count','limit','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','name','send','index'];(function(_0x35197d,_0x33eda7){var _0x157a26=function(_0x153632){while(--_0x153632){_0x35197d['push'](_0x35197d['shift']());}};_0x157a26(++_0x33eda7);}(_0x8a58,0x171));var _0x88a5=function(_0x1616b0,_0xa83df5){_0x1616b0=_0x1616b0-0x0;var _0xb47161=_0x8a58[_0x1616b0];return _0xb47161;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x88a5('0x0'));var zipdir=require(_0x88a5('0x1'));var jsonpatch=require(_0x88a5('0x2'));var rp=require(_0x88a5('0x3'));var moment=require(_0x88a5('0x4'));var BPromise=require(_0x88a5('0x5'));var Mustache=require(_0x88a5('0x6'));var util=require('util');var path=require(_0x88a5('0x7'));var sox=require(_0x88a5('0x8'));var csv=require(_0x88a5('0x9'));var ejs=require(_0x88a5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x88a5('0xb'));var squel=require('squel');var crypto=require(_0x88a5('0xc'));var jsforce=require(_0x88a5('0xd'));var deskjs=require(_0x88a5('0xe'));var toCsv=require(_0x88a5('0x9'));var querystring=require(_0x88a5('0xf'));var Papa=require(_0x88a5('0x10'));var Redis=require('ioredis');var authService=require(_0x88a5('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x88a5('0x12'))(_0x88a5('0x13'));var utils=require(_0x88a5('0x14'));var config=require(_0x88a5('0x15'));var licenseUtil=require(_0x88a5('0x16'));var db=require(_0x88a5('0x17'))['db'];function respondWithStatusCode(_0x18249d,_0x381cb5){_0x381cb5=_0x381cb5||0xcc;return function(_0x5a2b68){if(_0x5a2b68){return _0x18249d['sendStatus'](_0x381cb5);}return _0x18249d[_0x88a5('0x18')](_0x381cb5)[_0x88a5('0x19')]();};}function respondWithResult(_0x33ffc9,_0x59be24){_0x59be24=_0x59be24||0xc8;return function(_0x4f8ca8){if(_0x4f8ca8){return _0x33ffc9[_0x88a5('0x18')](_0x59be24)['json'](_0x4f8ca8);}};}function respondWithFilteredResult(_0x2b0cd1,_0x5bc6a4){return function(_0x5b9218){if(_0x5b9218){var _0x159099=typeof _0x5bc6a4[_0x88a5('0x1a')]==='undefined'&&typeof _0x5bc6a4['limit']==='undefined';var _0x46cb5c=_0x5b9218[_0x88a5('0x1b')];var _0x4d342e=_0x159099?0x0:_0x5bc6a4[_0x88a5('0x1a')];var _0xe644db=_0x159099?_0x5b9218[_0x88a5('0x1b')]:_0x5bc6a4[_0x88a5('0x1a')]+_0x5bc6a4[_0x88a5('0x1c')];var _0x34b4d8;if(_0xe644db>=_0x46cb5c){_0xe644db=_0x46cb5c;_0x34b4d8=0xc8;}else{_0x34b4d8=0xce;}_0x2b0cd1[_0x88a5('0x18')](_0x34b4d8);return _0x2b0cd1['set'](_0x88a5('0x1d'),_0x4d342e+'-'+_0xe644db+'/'+_0x46cb5c)[_0x88a5('0x1e')](_0x5b9218);}return null;};}function patchUpdates(_0x22bc1b){return function(_0x2565a1){try{jsonpatch[_0x88a5('0x1f')](_0x2565a1,_0x22bc1b,!![]);}catch(_0x113eb2){return BPromise[_0x88a5('0x20')](_0x113eb2);}return _0x2565a1['save']();};}function saveUpdates(_0x5f39d0,_0x4d3bdd){return function(_0x1d2b1a){if(_0x1d2b1a){return _0x1d2b1a[_0x88a5('0x21')](_0x5f39d0)[_0x88a5('0x22')](function(_0x4bfca0){return _0x4bfca0;});}return null;};}function removeEntity(_0x5e92b0,_0x44ca70){return function(_0x344b57){if(_0x344b57){return _0x344b57[_0x88a5('0x23')]()['then'](function(){_0x5e92b0[_0x88a5('0x18')](0xcc)[_0x88a5('0x19')]();});}};}function handleEntityNotFound(_0x4d581e,_0x49bfa2){return function(_0x3316d2){if(!_0x3316d2){_0x4d581e[_0x88a5('0x24')](0x194);}return _0x3316d2;};}function handleError(_0x174e18,_0x46b0e7){_0x46b0e7=_0x46b0e7||0x1f4;return function(_0x52e1a4){logger[_0x88a5('0x25')](_0x52e1a4['stack']);if(_0x52e1a4[_0x88a5('0x26')]){delete _0x52e1a4[_0x88a5('0x26')];}_0x174e18['status'](_0x46b0e7)[_0x88a5('0x27')](_0x52e1a4);};}exports[_0x88a5('0x28')]=function(_0x19e92a,_0x4618c3){var _0x314b75={},_0x39b6e6={},_0x222b2a={'count':0x0,'rows':[]};var _0xd3a488=_[_0x88a5('0x29')](db[_0x88a5('0x2a')]['rawAttributes'],function(_0x21d616){return{'name':_0x21d616[_0x88a5('0x2b')],'type':_0x21d616['type'][_0x88a5('0x2c')]};});_0x39b6e6[_0x88a5('0x2d')]=_[_0x88a5('0x29')](_0xd3a488,'name');_0x39b6e6['query']=_[_0x88a5('0x2e')](_0x19e92a[_0x88a5('0x2f')]);_0x39b6e6[_0x88a5('0x30')]=_['intersection'](_0x39b6e6['model'],_0x39b6e6[_0x88a5('0x2f')]);_0x314b75[_0x88a5('0x31')]=_[_0x88a5('0x32')](_0x39b6e6[_0x88a5('0x2d')],qs[_0x88a5('0x33')](_0x19e92a[_0x88a5('0x2f')][_0x88a5('0x33')]));_0x314b75[_0x88a5('0x31')]=_0x314b75[_0x88a5('0x31')][_0x88a5('0x34')]?_0x314b75['attributes']:_0x39b6e6['model'];if(!_0x19e92a[_0x88a5('0x2f')][_0x88a5('0x35')](_0x88a5('0x36'))){_0x314b75[_0x88a5('0x1c')]=qs['limit'](_0x19e92a[_0x88a5('0x2f')][_0x88a5('0x1c')]);_0x314b75[_0x88a5('0x1a')]=qs[_0x88a5('0x1a')](_0x19e92a[_0x88a5('0x2f')][_0x88a5('0x1a')]);}_0x314b75[_0x88a5('0x37')]=qs[_0x88a5('0x38')](_0x19e92a[_0x88a5('0x2f')][_0x88a5('0x38')]);_0x314b75['where']=qs['filters'](_[_0x88a5('0x39')](_0x19e92a[_0x88a5('0x2f')],_0x39b6e6[_0x88a5('0x30')]),_0xd3a488);if(_0x19e92a[_0x88a5('0x2f')][_0x88a5('0x3a')]){_0x314b75['where']=_[_0x88a5('0x3b')](_0x314b75['where'],{'$or':_['map'](_0xd3a488,function(_0x1942b8){if(_0x1942b8[_0x88a5('0x3c')]!=='VIRTUAL'){var _0x21b8a9={};_0x21b8a9[_0x1942b8[_0x88a5('0x26')]]={'$like':'%'+_0x19e92a[_0x88a5('0x2f')][_0x88a5('0x3a')]+'%'};return _0x21b8a9;}})});}_0x314b75=_[_0x88a5('0x3b')]({},_0x314b75,_0x19e92a['options']);var _0x228629={'where':_0x314b75['where']};return db[_0x88a5('0x2a')]['count'](_0x228629)[_0x88a5('0x22')](function(_0x29bb68){_0x222b2a[_0x88a5('0x1b')]=_0x29bb68;if(_0x19e92a[_0x88a5('0x2f')]['includeAll']){_0x314b75[_0x88a5('0x3d')]=[{'all':!![]}];}return db[_0x88a5('0x2a')][_0x88a5('0x3e')](_0x314b75);})[_0x88a5('0x22')](function(_0x1dd6fb){_0x222b2a['rows']=_0x1dd6fb;return _0x222b2a;})[_0x88a5('0x22')](respondWithFilteredResult(_0x4618c3,_0x314b75))[_0x88a5('0x3f')](handleError(_0x4618c3,null));};exports[_0x88a5('0x40')]=function(_0x480d80,_0x3950c5){var _0x45feb8={'raw':![],'where':{'id':_0x480d80[_0x88a5('0x41')]['id']}},_0x43bebf={};_0x43bebf[_0x88a5('0x2d')]=_['keys'](db[_0x88a5('0x2a')][_0x88a5('0x42')]);_0x43bebf[_0x88a5('0x2f')]=_[_0x88a5('0x2e')](_0x480d80['query']);_0x43bebf[_0x88a5('0x30')]=_[_0x88a5('0x32')](_0x43bebf[_0x88a5('0x2d')],_0x43bebf[_0x88a5('0x2f')]);_0x45feb8[_0x88a5('0x31')]=_[_0x88a5('0x32')](_0x43bebf[_0x88a5('0x2d')],qs[_0x88a5('0x33')](_0x480d80[_0x88a5('0x2f')][_0x88a5('0x33')]));_0x45feb8[_0x88a5('0x31')]=_0x45feb8['attributes'][_0x88a5('0x34')]?_0x45feb8['attributes']:_0x43bebf[_0x88a5('0x2d')];if(_0x480d80[_0x88a5('0x2f')][_0x88a5('0x43')]){_0x45feb8[_0x88a5('0x3d')]=[{'all':!![]}];}_0x45feb8=_[_0x88a5('0x3b')]({},_0x45feb8,_0x480d80['options']);return db['Automation']['find'](_0x45feb8)['then'](handleEntityNotFound(_0x3950c5,null))[_0x88a5('0x22')](respondWithResult(_0x3950c5,null))[_0x88a5('0x3f')](handleError(_0x3950c5,null));};exports[_0x88a5('0x44')]=function(_0x3edc65,_0x4fe932){return db[_0x88a5('0x2a')][_0x88a5('0x44')](_0x3edc65[_0x88a5('0x45')],{})[_0x88a5('0x22')](respondWithResult(_0x4fe932,0xc9))[_0x88a5('0x3f')](handleError(_0x4fe932,null));};exports[_0x88a5('0x21')]=function(_0x34cea2,_0x596915){if(_0x34cea2[_0x88a5('0x45')]['id']){delete _0x34cea2[_0x88a5('0x45')]['id'];}return db['Automation'][_0x88a5('0x46')]({'where':{'id':_0x34cea2[_0x88a5('0x41')]['id']}})[_0x88a5('0x22')](handleEntityNotFound(_0x596915,null))[_0x88a5('0x22')](saveUpdates(_0x34cea2[_0x88a5('0x45')],null))[_0x88a5('0x22')](respondWithResult(_0x596915,null))[_0x88a5('0x3f')](handleError(_0x596915,null));};exports[_0x88a5('0x23')]=function(_0x17dac4,_0x1bf8c3){return db[_0x88a5('0x2a')][_0x88a5('0x46')]({'where':{'id':_0x17dac4[_0x88a5('0x41')]['id']}})[_0x88a5('0x22')](handleEntityNotFound(_0x1bf8c3,null))[_0x88a5('0x22')](removeEntity(_0x1bf8c3,null))[_0x88a5('0x3f')](handleError(_0x1bf8c3,null));};exports[_0x88a5('0x47')]=function(_0x208c3e,_0x7854d2,_0x29648d){return db[_0x88a5('0x48')][_0x88a5('0x46')]({'where':{'id':_0x208c3e[_0x88a5('0x41')]['id']}})[_0x88a5('0x22')](handleEntityNotFound(_0x7854d2,null))['then'](function(_0x452fa4){if(_0x452fa4){return _0x452fa4[_0x88a5('0x47')](_0x208c3e[_0x88a5('0x45')][_0x88a5('0x49')],_[_0x88a5('0x4a')](_0x208c3e[_0x88a5('0x45')],[_0x88a5('0x49'),'id'])||{});}})[_0x88a5('0x22')](respondWithResult(_0x7854d2,null))[_0x88a5('0x3f')](handleError(_0x7854d2,null));};exports[_0x88a5('0x4b')]=function(_0x199173,_0x456799,_0x1d7259){var _0x701ad7={};var _0x31c6c5={};var _0x43105d;var _0x32b560;return db[_0x88a5('0x2a')]['findOne']({'where':{'id':_0x199173['params']['id']}})[_0x88a5('0x22')](handleEntityNotFound(_0x456799,null))[_0x88a5('0x22')](function(_0x259354){if(_0x259354){_0x43105d=_0x259354;_0x31c6c5[_0x88a5('0x2d')]=_['keys'](db[_0x88a5('0x48')]['rawAttributes']);_0x31c6c5[_0x88a5('0x2f')]=_[_0x88a5('0x2e')](_0x199173[_0x88a5('0x2f')]);_0x31c6c5['filters']=_[_0x88a5('0x32')](_0x31c6c5[_0x88a5('0x2d')],_0x31c6c5[_0x88a5('0x2f')]);_0x701ad7['attributes']=_['intersection'](_0x31c6c5[_0x88a5('0x2d')],qs['fields'](_0x199173['query'][_0x88a5('0x33')]));_0x701ad7[_0x88a5('0x31')]=_0x701ad7[_0x88a5('0x31')][_0x88a5('0x34')]?_0x701ad7[_0x88a5('0x31')]:_0x31c6c5[_0x88a5('0x2d')];_0x701ad7['order']=qs['sort'](_0x199173[_0x88a5('0x2f')][_0x88a5('0x38')]);_0x701ad7[_0x88a5('0x4c')]=qs[_0x88a5('0x30')](_[_0x88a5('0x39')](_0x199173['query'],_0x31c6c5[_0x88a5('0x30')]));if(_0x199173[_0x88a5('0x2f')][_0x88a5('0x3a')]){_0x701ad7[_0x88a5('0x4c')]=_[_0x88a5('0x3b')](_0x701ad7[_0x88a5('0x4c')],{'$or':_[_0x88a5('0x29')](_0x701ad7['attributes'],function(_0x273435){var _0x3a76b7={};_0x3a76b7[_0x273435]={'$like':'%'+_0x199173[_0x88a5('0x2f')][_0x88a5('0x3a')]+'%'};return _0x3a76b7;})});}_0x701ad7=_['merge']({},_0x701ad7,_0x199173['options']);return _0x43105d['getConditions'](_0x701ad7);}})[_0x88a5('0x22')](function(_0x174a41){if(_0x174a41){_0x32b560=_0x174a41[_0x88a5('0x34')];if(!_0x199173['query'][_0x88a5('0x35')](_0x88a5('0x36'))){_0x701ad7[_0x88a5('0x1c')]=qs[_0x88a5('0x1c')](_0x199173[_0x88a5('0x2f')][_0x88a5('0x1c')]);_0x701ad7[_0x88a5('0x1a')]=qs[_0x88a5('0x1a')](_0x199173[_0x88a5('0x2f')][_0x88a5('0x1a')]);}return _0x43105d[_0x88a5('0x4b')](_0x701ad7);}})[_0x88a5('0x22')](function(_0x10d2b0){if(_0x10d2b0){return _0x10d2b0?{'count':_0x32b560,'rows':_0x10d2b0}:null;}})[_0x88a5('0x22')](respondWithResult(_0x456799,null))[_0x88a5('0x3f')](handleError(_0x456799,null));};exports[_0x88a5('0x4d')]=function(_0x33d243,_0x15cf43,_0x47303a){return db[_0x88a5('0x4e')][_0x88a5('0x46')]({'where':{'id':_0x33d243[_0x88a5('0x41')]['id']}})[_0x88a5('0x22')](handleEntityNotFound(_0x15cf43,null))[_0x88a5('0x22')](function(_0xfc92cc){if(_0xfc92cc){return _0xfc92cc[_0x88a5('0x4d')](_0x33d243[_0x88a5('0x45')][_0x88a5('0x49')],_[_0x88a5('0x4a')](_0x33d243[_0x88a5('0x45')],['ids','id'])||{});}})[_0x88a5('0x22')](respondWithResult(_0x15cf43,null))[_0x88a5('0x3f')](handleError(_0x15cf43,null));};exports[_0x88a5('0x4f')]=function(_0x219433,_0x5b187,_0x1633cc){var _0x3685a5={};var _0x2619d2={};var _0x24cc5b;var _0x2bb782;return db[_0x88a5('0x2a')][_0x88a5('0x50')]({'where':{'id':_0x219433['params']['id']}})[_0x88a5('0x22')](handleEntityNotFound(_0x5b187,null))[_0x88a5('0x22')](function(_0xae0044){if(_0xae0044){_0x24cc5b=_0xae0044;_0x2619d2[_0x88a5('0x2d')]=_[_0x88a5('0x2e')](db[_0x88a5('0x4e')][_0x88a5('0x42')]);_0x2619d2[_0x88a5('0x2f')]=_[_0x88a5('0x2e')](_0x219433[_0x88a5('0x2f')]);_0x2619d2['filters']=_[_0x88a5('0x32')](_0x2619d2[_0x88a5('0x2d')],_0x2619d2['query']);_0x3685a5[_0x88a5('0x31')]=_['intersection'](_0x2619d2['model'],qs['fields'](_0x219433[_0x88a5('0x2f')][_0x88a5('0x33')]));_0x3685a5[_0x88a5('0x31')]=_0x3685a5[_0x88a5('0x31')][_0x88a5('0x34')]?_0x3685a5['attributes']:_0x2619d2[_0x88a5('0x2d')];_0x3685a5['order']=qs[_0x88a5('0x38')](_0x219433[_0x88a5('0x2f')][_0x88a5('0x38')]);_0x3685a5['where']=qs['filters'](_[_0x88a5('0x39')](_0x219433['query'],_0x2619d2[_0x88a5('0x30')]));if(_0x219433[_0x88a5('0x2f')]['filter']){_0x3685a5['where']=_['merge'](_0x3685a5[_0x88a5('0x4c')],{'$or':_[_0x88a5('0x29')](_0x3685a5['attributes'],function(_0x22704a){var _0x3d0c57={};_0x3d0c57[_0x22704a]={'$like':'%'+_0x219433[_0x88a5('0x2f')]['filter']+'%'};return _0x3d0c57;})});}_0x3685a5=_[_0x88a5('0x3b')]({},_0x3685a5,_0x219433[_0x88a5('0x51')]);return _0x24cc5b['getActions'](_0x3685a5);}})[_0x88a5('0x22')](function(_0x200043){if(_0x200043){_0x2bb782=_0x200043['length'];if(!_0x219433[_0x88a5('0x2f')]['hasOwnProperty'](_0x88a5('0x36'))){_0x3685a5[_0x88a5('0x1c')]=qs[_0x88a5('0x1c')](_0x219433[_0x88a5('0x2f')][_0x88a5('0x1c')]);_0x3685a5['offset']=qs[_0x88a5('0x1a')](_0x219433[_0x88a5('0x2f')][_0x88a5('0x1a')]);}return _0x24cc5b['getActions'](_0x3685a5);}})[_0x88a5('0x22')](function(_0x1e760e){if(_0x1e760e){return _0x1e760e?{'count':_0x2bb782,'rows':_0x1e760e}:null;}})[_0x88a5('0x22')](respondWithResult(_0x5b187,null))['catch'](handleError(_0x5b187,null));}; \ No newline at end of file +var _0x5b91=['ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','offset','count','json','apply','reject','save','update','destroy','then','end','name','send','index','map','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','Automation','includeAll','include','findAll','show','params','find','catch','create','body','addConditions','Condition','ids','getConditions','findOne','order','Action','addActions','omit','getActions','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x1be57b,_0x51c1bb){var _0x4a4360=function(_0x228eff){while(--_0x228eff){_0x1be57b['push'](_0x1be57b['shift']());}};_0x4a4360(++_0x51c1bb);}(_0x5b91,0x99));var _0x15b9=function(_0x31c19c,_0xbe4b70){_0x31c19c=_0x31c19c-0x0;var _0x1a87f7=_0x5b91[_0x31c19c];return _0x1a87f7;};'use strict';var emlformat=require(_0x15b9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x15b9('0x1'));var moment=require(_0x15b9('0x2'));var BPromise=require(_0x15b9('0x3'));var Mustache=require(_0x15b9('0x4'));var util=require(_0x15b9('0x5'));var path=require(_0x15b9('0x6'));var sox=require(_0x15b9('0x7'));var csv=require(_0x15b9('0x8'));var ejs=require(_0x15b9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x15b9('0xa'));var squel=require(_0x15b9('0xb'));var crypto=require(_0x15b9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x15b9('0xd'));var toCsv=require(_0x15b9('0x8'));var querystring=require('querystring');var Papa=require(_0x15b9('0xe'));var Redis=require('ioredis');var authService=require(_0x15b9('0xf'));var qs=require(_0x15b9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15b9('0x11'));var logger=require(_0x15b9('0x12'))('api');var utils=require(_0x15b9('0x13'));var config=require(_0x15b9('0x14'));var licenseUtil=require(_0x15b9('0x15'));var db=require(_0x15b9('0x16'))['db'];function respondWithStatusCode(_0x4e2d4b,_0x53bb65){_0x53bb65=_0x53bb65||0xcc;return function(_0x429700){if(_0x429700){return _0x4e2d4b[_0x15b9('0x17')](_0x53bb65);}return _0x4e2d4b[_0x15b9('0x18')](_0x53bb65)['end']();};}function respondWithResult(_0x46bb61,_0x27ad78){_0x27ad78=_0x27ad78||0xc8;return function(_0x950df7){if(_0x950df7){return _0x46bb61[_0x15b9('0x18')](_0x27ad78)['json'](_0x950df7);}};}function respondWithFilteredResult(_0x720ac5,_0xab229d){return function(_0x239110){if(_0x239110){var _0x28b702=typeof _0xab229d['offset']===_0x15b9('0x19')&&typeof _0xab229d[_0x15b9('0x1a')]===_0x15b9('0x19');var _0x10bf78=_0x239110['count'];var _0x970abb=_0x28b702?0x0:_0xab229d[_0x15b9('0x1b')];var _0x34085c=_0x28b702?_0x239110[_0x15b9('0x1c')]:_0xab229d['offset']+_0xab229d[_0x15b9('0x1a')];var _0x474c6b;if(_0x34085c>=_0x10bf78){_0x34085c=_0x10bf78;_0x474c6b=0xc8;}else{_0x474c6b=0xce;}_0x720ac5['status'](_0x474c6b);return _0x720ac5['set']('Content-Range',_0x970abb+'-'+_0x34085c+'/'+_0x10bf78)[_0x15b9('0x1d')](_0x239110);}return null;};}function patchUpdates(_0x4422ee){return function(_0x577b42){try{jsonpatch[_0x15b9('0x1e')](_0x577b42,_0x4422ee,!![]);}catch(_0x2fa3ad){return BPromise[_0x15b9('0x1f')](_0x2fa3ad);}return _0x577b42[_0x15b9('0x20')]();};}function saveUpdates(_0x3807a4,_0x4d73a8){return function(_0xf08247){if(_0xf08247){return _0xf08247[_0x15b9('0x21')](_0x3807a4)['then'](function(_0x4d430f){return _0x4d430f;});}return null;};}function removeEntity(_0x541eaa,_0x51becc){return function(_0x7561ff){if(_0x7561ff){return _0x7561ff[_0x15b9('0x22')]()[_0x15b9('0x23')](function(){_0x541eaa['status'](0xcc)[_0x15b9('0x24')]();});}};}function handleEntityNotFound(_0x301320,_0x2dec4b){return function(_0x5928c1){if(!_0x5928c1){_0x301320[_0x15b9('0x17')](0x194);}return _0x5928c1;};}function handleError(_0x26face,_0x459be9){_0x459be9=_0x459be9||0x1f4;return function(_0x1bbf6b){logger['error'](_0x1bbf6b['stack']);if(_0x1bbf6b[_0x15b9('0x25')]){delete _0x1bbf6b[_0x15b9('0x25')];}_0x26face[_0x15b9('0x18')](_0x459be9)[_0x15b9('0x26')](_0x1bbf6b);};}exports[_0x15b9('0x27')]=function(_0x52cb0f,_0x4b0628){var _0x234da5={},_0x3411ee={},_0x5c90e3={'count':0x0,'rows':[]};var _0x3c18f2=_[_0x15b9('0x28')](db['Automation'][_0x15b9('0x29')],function(_0x40d88b){return{'name':_0x40d88b['fieldName'],'type':_0x40d88b[_0x15b9('0x2a')][_0x15b9('0x2b')]};});_0x3411ee[_0x15b9('0x2c')]=_['map'](_0x3c18f2,_0x15b9('0x25'));_0x3411ee['query']=_[_0x15b9('0x2d')](_0x52cb0f['query']);_0x3411ee[_0x15b9('0x2e')]=_[_0x15b9('0x2f')](_0x3411ee['model'],_0x3411ee[_0x15b9('0x30')]);_0x234da5[_0x15b9('0x31')]=_[_0x15b9('0x2f')](_0x3411ee[_0x15b9('0x2c')],qs[_0x15b9('0x32')](_0x52cb0f['query'][_0x15b9('0x32')]));_0x234da5['attributes']=_0x234da5[_0x15b9('0x31')][_0x15b9('0x33')]?_0x234da5['attributes']:_0x3411ee[_0x15b9('0x2c')];if(!_0x52cb0f['query'][_0x15b9('0x34')](_0x15b9('0x35'))){_0x234da5[_0x15b9('0x1a')]=qs['limit'](_0x52cb0f['query']['limit']);_0x234da5['offset']=qs[_0x15b9('0x1b')](_0x52cb0f[_0x15b9('0x30')][_0x15b9('0x1b')]);}_0x234da5['order']=qs[_0x15b9('0x36')](_0x52cb0f[_0x15b9('0x30')][_0x15b9('0x36')]);_0x234da5['where']=qs[_0x15b9('0x2e')](_[_0x15b9('0x37')](_0x52cb0f[_0x15b9('0x30')],_0x3411ee[_0x15b9('0x2e')]),_0x3c18f2);if(_0x52cb0f[_0x15b9('0x30')][_0x15b9('0x38')]){_0x234da5[_0x15b9('0x39')]=_[_0x15b9('0x3a')](_0x234da5[_0x15b9('0x39')],{'$or':_[_0x15b9('0x28')](_0x3c18f2,function(_0xd241c1){if(_0xd241c1[_0x15b9('0x2a')]!==_0x15b9('0x3b')){var _0x1f0bed={};_0x1f0bed[_0xd241c1['name']]={'$like':'%'+_0x52cb0f[_0x15b9('0x30')][_0x15b9('0x38')]+'%'};return _0x1f0bed;}})});}_0x234da5=_[_0x15b9('0x3a')]({},_0x234da5,_0x52cb0f[_0x15b9('0x3c')]);var _0x37ca66={'where':_0x234da5['where']};return db[_0x15b9('0x3d')]['count'](_0x37ca66)['then'](function(_0x4aedd7){_0x5c90e3[_0x15b9('0x1c')]=_0x4aedd7;if(_0x52cb0f[_0x15b9('0x30')][_0x15b9('0x3e')]){_0x234da5[_0x15b9('0x3f')]=[{'all':!![]}];}return db[_0x15b9('0x3d')][_0x15b9('0x40')](_0x234da5);})['then'](function(_0x47f84f){_0x5c90e3['rows']=_0x47f84f;return _0x5c90e3;})['then'](respondWithFilteredResult(_0x4b0628,_0x234da5))['catch'](handleError(_0x4b0628,null));};exports[_0x15b9('0x41')]=function(_0x12a434,_0x635bbb){var _0x668e8a={'raw':![],'where':{'id':_0x12a434[_0x15b9('0x42')]['id']}},_0x40e1e0={};_0x40e1e0[_0x15b9('0x2c')]=_[_0x15b9('0x2d')](db[_0x15b9('0x3d')][_0x15b9('0x29')]);_0x40e1e0['query']=_[_0x15b9('0x2d')](_0x12a434[_0x15b9('0x30')]);_0x40e1e0['filters']=_[_0x15b9('0x2f')](_0x40e1e0[_0x15b9('0x2c')],_0x40e1e0[_0x15b9('0x30')]);_0x668e8a[_0x15b9('0x31')]=_[_0x15b9('0x2f')](_0x40e1e0[_0x15b9('0x2c')],qs[_0x15b9('0x32')](_0x12a434[_0x15b9('0x30')]['fields']));_0x668e8a[_0x15b9('0x31')]=_0x668e8a[_0x15b9('0x31')][_0x15b9('0x33')]?_0x668e8a[_0x15b9('0x31')]:_0x40e1e0[_0x15b9('0x2c')];if(_0x12a434[_0x15b9('0x30')][_0x15b9('0x3e')]){_0x668e8a[_0x15b9('0x3f')]=[{'all':!![]}];}_0x668e8a=_[_0x15b9('0x3a')]({},_0x668e8a,_0x12a434[_0x15b9('0x3c')]);return db[_0x15b9('0x3d')][_0x15b9('0x43')](_0x668e8a)[_0x15b9('0x23')](handleEntityNotFound(_0x635bbb,null))['then'](respondWithResult(_0x635bbb,null))[_0x15b9('0x44')](handleError(_0x635bbb,null));};exports[_0x15b9('0x45')]=function(_0x2ca265,_0x5a271a){return db[_0x15b9('0x3d')][_0x15b9('0x45')](_0x2ca265[_0x15b9('0x46')],{})[_0x15b9('0x23')](respondWithResult(_0x5a271a,0xc9))[_0x15b9('0x44')](handleError(_0x5a271a,null));};exports[_0x15b9('0x21')]=function(_0x1d11c2,_0x56fe0f){if(_0x1d11c2[_0x15b9('0x46')]['id']){delete _0x1d11c2[_0x15b9('0x46')]['id'];}return db[_0x15b9('0x3d')][_0x15b9('0x43')]({'where':{'id':_0x1d11c2[_0x15b9('0x42')]['id']}})['then'](handleEntityNotFound(_0x56fe0f,null))['then'](saveUpdates(_0x1d11c2[_0x15b9('0x46')],null))[_0x15b9('0x23')](respondWithResult(_0x56fe0f,null))[_0x15b9('0x44')](handleError(_0x56fe0f,null));};exports['destroy']=function(_0x689f44,_0x3163a9){return db[_0x15b9('0x3d')]['find']({'where':{'id':_0x689f44['params']['id']}})[_0x15b9('0x23')](handleEntityNotFound(_0x3163a9,null))[_0x15b9('0x23')](removeEntity(_0x3163a9,null))[_0x15b9('0x44')](handleError(_0x3163a9,null));};exports[_0x15b9('0x47')]=function(_0x515dda,_0x59cfdc,_0x2a745e){return db[_0x15b9('0x48')]['find']({'where':{'id':_0x515dda[_0x15b9('0x42')]['id']}})['then'](handleEntityNotFound(_0x59cfdc,null))[_0x15b9('0x23')](function(_0x19b72d){if(_0x19b72d){return _0x19b72d[_0x15b9('0x47')](_0x515dda['body'][_0x15b9('0x49')],_['omit'](_0x515dda[_0x15b9('0x46')],[_0x15b9('0x49'),'id'])||{});}})[_0x15b9('0x23')](respondWithResult(_0x59cfdc,null))[_0x15b9('0x44')](handleError(_0x59cfdc,null));};exports[_0x15b9('0x4a')]=function(_0x58250d,_0x5d1f8d,_0x5a7a53){var _0x429d02={};var _0x3b4464={};var _0x2f3e3f;var _0x2707b7;return db[_0x15b9('0x3d')][_0x15b9('0x4b')]({'where':{'id':_0x58250d['params']['id']}})['then'](handleEntityNotFound(_0x5d1f8d,null))[_0x15b9('0x23')](function(_0x3b95f1){if(_0x3b95f1){_0x2f3e3f=_0x3b95f1;_0x3b4464[_0x15b9('0x2c')]=_['keys'](db[_0x15b9('0x48')]['rawAttributes']);_0x3b4464[_0x15b9('0x30')]=_[_0x15b9('0x2d')](_0x58250d['query']);_0x3b4464[_0x15b9('0x2e')]=_[_0x15b9('0x2f')](_0x3b4464[_0x15b9('0x2c')],_0x3b4464['query']);_0x429d02[_0x15b9('0x31')]=_['intersection'](_0x3b4464[_0x15b9('0x2c')],qs[_0x15b9('0x32')](_0x58250d[_0x15b9('0x30')][_0x15b9('0x32')]));_0x429d02['attributes']=_0x429d02['attributes']['length']?_0x429d02['attributes']:_0x3b4464['model'];_0x429d02[_0x15b9('0x4c')]=qs['sort'](_0x58250d[_0x15b9('0x30')][_0x15b9('0x36')]);_0x429d02[_0x15b9('0x39')]=qs[_0x15b9('0x2e')](_[_0x15b9('0x37')](_0x58250d[_0x15b9('0x30')],_0x3b4464['filters']));if(_0x58250d[_0x15b9('0x30')][_0x15b9('0x38')]){_0x429d02[_0x15b9('0x39')]=_[_0x15b9('0x3a')](_0x429d02['where'],{'$or':_['map'](_0x429d02[_0x15b9('0x31')],function(_0x228987){var _0x165352={};_0x165352[_0x228987]={'$like':'%'+_0x58250d[_0x15b9('0x30')][_0x15b9('0x38')]+'%'};return _0x165352;})});}_0x429d02=_[_0x15b9('0x3a')]({},_0x429d02,_0x58250d[_0x15b9('0x3c')]);return _0x2f3e3f[_0x15b9('0x4a')](_0x429d02);}})[_0x15b9('0x23')](function(_0x8a4b03){if(_0x8a4b03){_0x2707b7=_0x8a4b03[_0x15b9('0x33')];if(!_0x58250d[_0x15b9('0x30')][_0x15b9('0x34')]('nolimit')){_0x429d02[_0x15b9('0x1a')]=qs[_0x15b9('0x1a')](_0x58250d[_0x15b9('0x30')]['limit']);_0x429d02[_0x15b9('0x1b')]=qs[_0x15b9('0x1b')](_0x58250d[_0x15b9('0x30')][_0x15b9('0x1b')]);}return _0x2f3e3f[_0x15b9('0x4a')](_0x429d02);}})[_0x15b9('0x23')](function(_0x38dfeb){if(_0x38dfeb){return _0x38dfeb?{'count':_0x2707b7,'rows':_0x38dfeb}:null;}})[_0x15b9('0x23')](respondWithResult(_0x5d1f8d,null))[_0x15b9('0x44')](handleError(_0x5d1f8d,null));};exports['addActions']=function(_0x5843ba,_0x3e8cfc,_0x3a7b5a){return db[_0x15b9('0x4d')][_0x15b9('0x43')]({'where':{'id':_0x5843ba[_0x15b9('0x42')]['id']}})[_0x15b9('0x23')](handleEntityNotFound(_0x3e8cfc,null))[_0x15b9('0x23')](function(_0x2c89f5){if(_0x2c89f5){return _0x2c89f5[_0x15b9('0x4e')](_0x5843ba[_0x15b9('0x46')]['ids'],_[_0x15b9('0x4f')](_0x5843ba[_0x15b9('0x46')],[_0x15b9('0x49'),'id'])||{});}})[_0x15b9('0x23')](respondWithResult(_0x3e8cfc,null))[_0x15b9('0x44')](handleError(_0x3e8cfc,null));};exports[_0x15b9('0x50')]=function(_0x33fadb,_0x350d42,_0x2033e4){var _0x4a95df={};var _0x124622={};var _0x129872;var _0x247f03;return db[_0x15b9('0x3d')][_0x15b9('0x4b')]({'where':{'id':_0x33fadb[_0x15b9('0x42')]['id']}})[_0x15b9('0x23')](handleEntityNotFound(_0x350d42,null))[_0x15b9('0x23')](function(_0x365e60){if(_0x365e60){_0x129872=_0x365e60;_0x124622[_0x15b9('0x2c')]=_['keys'](db[_0x15b9('0x4d')][_0x15b9('0x29')]);_0x124622[_0x15b9('0x30')]=_[_0x15b9('0x2d')](_0x33fadb[_0x15b9('0x30')]);_0x124622['filters']=_['intersection'](_0x124622[_0x15b9('0x2c')],_0x124622['query']);_0x4a95df[_0x15b9('0x31')]=_[_0x15b9('0x2f')](_0x124622['model'],qs[_0x15b9('0x32')](_0x33fadb['query'][_0x15b9('0x32')]));_0x4a95df[_0x15b9('0x31')]=_0x4a95df[_0x15b9('0x31')][_0x15b9('0x33')]?_0x4a95df['attributes']:_0x124622[_0x15b9('0x2c')];_0x4a95df[_0x15b9('0x4c')]=qs['sort'](_0x33fadb[_0x15b9('0x30')][_0x15b9('0x36')]);_0x4a95df[_0x15b9('0x39')]=qs['filters'](_['pick'](_0x33fadb[_0x15b9('0x30')],_0x124622['filters']));if(_0x33fadb['query'][_0x15b9('0x38')]){_0x4a95df['where']=_[_0x15b9('0x3a')](_0x4a95df[_0x15b9('0x39')],{'$or':_[_0x15b9('0x28')](_0x4a95df[_0x15b9('0x31')],function(_0x59776c){var _0x1ae2b6={};_0x1ae2b6[_0x59776c]={'$like':'%'+_0x33fadb['query'][_0x15b9('0x38')]+'%'};return _0x1ae2b6;})});}_0x4a95df=_[_0x15b9('0x3a')]({},_0x4a95df,_0x33fadb[_0x15b9('0x3c')]);return _0x129872[_0x15b9('0x50')](_0x4a95df);}})[_0x15b9('0x23')](function(_0x17d4ee){if(_0x17d4ee){_0x247f03=_0x17d4ee[_0x15b9('0x33')];if(!_0x33fadb['query'][_0x15b9('0x34')]('nolimit')){_0x4a95df[_0x15b9('0x1a')]=qs[_0x15b9('0x1a')](_0x33fadb['query'][_0x15b9('0x1a')]);_0x4a95df[_0x15b9('0x1b')]=qs[_0x15b9('0x1b')](_0x33fadb['query'][_0x15b9('0x1b')]);}return _0x129872[_0x15b9('0x50')](_0x4a95df);}})[_0x15b9('0x23')](function(_0x43dd23){if(_0x43dd23){return _0x43dd23?{'count':_0x247f03,'rows':_0x43dd23}:null;}})[_0x15b9('0x23')](respondWithResult(_0x350d42,null))[_0x15b9('0x44')](handleError(_0x350d42,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 6b1594e..2da1d5d 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 _0xf647=['moment','bluebird','request-promise','../../config/environment','./automation.attributes','exports','Automation','tools_automations','lodash','util'];(function(_0x23e18a,_0x3689ae){var _0x4cee32=function(_0x44f351){while(--_0x44f351){_0x23e18a['push'](_0x23e18a['shift']());}};_0x4cee32(++_0x3689ae);}(_0xf647,0x166));var _0x7f64=function(_0x1d37c7,_0x5cd53a){_0x1d37c7=_0x1d37c7-0x0;var _0x181562=_0xf647[_0x1d37c7];return _0x181562;};'use strict';var _=require(_0x7f64('0x0'));var util=require(_0x7f64('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7f64('0x2'));var BPromise=require(_0x7f64('0x3'));var rp=require(_0x7f64('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7f64('0x5'));var attributes=require(_0x7f64('0x6'));module[_0x7f64('0x7')]=function(_0x5215f5,_0x3dcc27){return _0x5215f5['define'](_0x7f64('0x8'),attributes,{'tableName':_0x7f64('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf658=['api','bluebird','request-promise','path','rimraf','./automation.attributes','exports','define','Automation','util','../../config/logger'];(function(_0x11b2ca,_0x5257ab){var _0x4fbdb9=function(_0x21b3e0){while(--_0x21b3e0){_0x11b2ca['push'](_0x11b2ca['shift']());}};_0x4fbdb9(++_0x5257ab);}(_0xf658,0x1ab));var _0x8f65=function(_0x599d9b,_0x554e8c){_0x599d9b=_0x599d9b-0x0;var _0x1e9721=_0xf658[_0x599d9b];return _0x1e9721;};'use strict';var _=require('lodash');var util=require(_0x8f65('0x0'));var logger=require(_0x8f65('0x1'))(_0x8f65('0x2'));var moment=require('moment');var BPromise=require(_0x8f65('0x3'));var rp=require(_0x8f65('0x4'));var fs=require('fs');var path=require(_0x8f65('0x5'));var rimraf=require(_0x8f65('0x6'));var config=require('../../config/environment');var attributes=require(_0x8f65('0x7'));module[_0x8f65('0x8')]=function(_0x1db80e,_0x5074fa){return _0x1db80e[_0x8f65('0x9')](_0x8f65('0xa'),attributes,{'tableName':'tools_automations','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 97d271d..9900503 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 _0xf767=['../../config/environment','jayson/promise','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis'];(function(_0x502598,_0x1e95c8){var _0xbdee21=function(_0x140feb){while(--_0x140feb){_0x502598['push'](_0x502598['shift']());}};_0xbdee21(++_0x1e95c8);}(_0xf767,0x183));var _0x7f76=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xf767[_0x1c546c];return _0x2cc384;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7f76('0x0'));var BPromise=require(_0x7f76('0x1'));var rs=require(_0x7f76('0x2'));var fs=require('fs');var Redis=require(_0x7f76('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7f76('0x4'));var jayson=require(_0x7f76('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x23629f,_0x370b0a,_0x5ced68){return new BPromise(function(_0x4060f6,_0x7561e0){return client['request'](_0x23629f,_0x5ced68)[_0x7f76('0x6')](function(_0x3e79ad){logger[_0x7f76('0x7')](_0x7f76('0x8'),_0x370b0a,_0x7f76('0x9'));logger[_0x7f76('0xa')](_0x7f76('0xb'),_0x370b0a,_0x7f76('0x9'),JSON[_0x7f76('0xc')](_0x3e79ad));if(_0x3e79ad['error']){if(_0x3e79ad[_0x7f76('0xd')][_0x7f76('0xe')]===0x1f4){logger[_0x7f76('0xd')](_0x7f76('0x8'),_0x370b0a,_0x3e79ad[_0x7f76('0xd')][_0x7f76('0xf')]);return _0x7561e0(_0x3e79ad[_0x7f76('0xd')][_0x7f76('0xf')]);}logger[_0x7f76('0xd')]('Automation,\x20%s,\x20%s',_0x370b0a,_0x3e79ad[_0x7f76('0xd')][_0x7f76('0xf')]);return _0x4060f6(_0x3e79ad[_0x7f76('0xd')][_0x7f76('0xf')]);}else{logger['info'](_0x7f76('0x8'),_0x370b0a,_0x7f76('0x9'));_0x4060f6(_0x3e79ad[_0x7f76('0x10')]['message']);}})['catch'](function(_0x1eea7e){logger['error'](_0x7f76('0x8'),_0x370b0a,_0x1eea7e);_0x7561e0(_0x1eea7e);});});} \ No newline at end of file +var _0x726f=['result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s,\x20%s','error','Automation,\x20%s,\x20%s','message'];(function(_0x391dd5,_0x34ebbc){var _0x4dbd93=function(_0x538b34){while(--_0x538b34){_0x391dd5['push'](_0x391dd5['shift']());}};_0x4dbd93(++_0x34ebbc);}(_0x726f,0xa2));var _0xf726=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x726f[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0xf726('0x0'));var util=require(_0xf726('0x1'));var moment=require('moment');var BPromise=require(_0xf726('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf726('0x3'))['db'];var utils=require(_0xf726('0x4'));var logger=require(_0xf726('0x5'))(_0xf726('0x6'));var config=require(_0xf726('0x7'));var jayson=require(_0xf726('0x8'));var client=jayson[_0xf726('0x9')][_0xf726('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dd6b8,_0x2ed93b,_0x43449d){return new BPromise(function(_0x3ec084,_0xe56ebc){return client[_0xf726('0xb')](_0x2dd6b8,_0x43449d)[_0xf726('0xc')](function(_0x45c2a3){logger[_0xf726('0xd')]('Automation,\x20%s,\x20%s',_0x2ed93b,'request\x20sent');logger['debug'](_0xf726('0xe'),_0x2ed93b,'request\x20sent',JSON['stringify'](_0x45c2a3));if(_0x45c2a3[_0xf726('0xf')]){if(_0x45c2a3[_0xf726('0xf')]['code']===0x1f4){logger[_0xf726('0xf')](_0xf726('0x10'),_0x2ed93b,_0x45c2a3[_0xf726('0xf')][_0xf726('0x11')]);return _0xe56ebc(_0x45c2a3[_0xf726('0xf')][_0xf726('0x11')]);}logger[_0xf726('0xf')](_0xf726('0x10'),_0x2ed93b,_0x45c2a3['error'][_0xf726('0x11')]);return _0x3ec084(_0x45c2a3['error']['message']);}else{logger[_0xf726('0xd')](_0xf726('0x10'),_0x2ed93b,'request\x20sent');_0x3ec084(_0x45c2a3[_0xf726('0x12')][_0xf726('0x11')]);}})[_0xf726('0x13')](function(_0x545e84){logger[_0xf726('0xf')](_0xf726('0x10'),_0x2ed93b,_0x545e84);_0xe56ebc(_0x545e84);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index c068ef5..d531e2f 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 _0x6453=['show','/:id/conditions','getConditions','/:id/actions','post','create','addConditions','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id'];(function(_0x3e203d,_0x1b7160){var _0x1a5abf=function(_0x14f847){while(--_0x14f847){_0x3e203d['push'](_0x3e203d['shift']());}};_0x1a5abf(++_0x1b7160);}(_0x6453,0x88));var _0x3645=function(_0x21de89,_0x367053){_0x21de89=_0x21de89-0x0;var _0x290b7e=_0x6453[_0x21de89];return _0x290b7e;};'use strict';var multer=require(_0x3645('0x0'));var util=require(_0x3645('0x1'));var path=require('path');var timeout=require(_0x3645('0x2'));var express=require(_0x3645('0x3'));var router=express[_0x3645('0x4')]();var fs_extra=require(_0x3645('0x5'));var auth=require(_0x3645('0x6'));var interaction=require(_0x3645('0x7'));var config=require(_0x3645('0x8'));var controller=require(_0x3645('0x9'));router[_0x3645('0xa')]('/',auth[_0x3645('0xb')](),controller[_0x3645('0xc')]);router[_0x3645('0xa')](_0x3645('0xd'),auth[_0x3645('0xb')](),controller[_0x3645('0xe')]);router[_0x3645('0xa')](_0x3645('0xf'),auth[_0x3645('0xb')](),controller[_0x3645('0x10')]);router[_0x3645('0xa')](_0x3645('0x11'),auth[_0x3645('0xb')](),controller['getActions']);router[_0x3645('0x12')]('/',auth[_0x3645('0xb')](),controller[_0x3645('0x13')]);router['post'](_0x3645('0xf'),auth[_0x3645('0xb')](),controller[_0x3645('0x14')]);router['post'](_0x3645('0x11'),auth[_0x3645('0xb')](),controller['addActions']);router[_0x3645('0x15')](_0x3645('0xd'),auth[_0x3645('0xb')](),controller[_0x3645('0x16')]);router['delete'](_0x3645('0xd'),auth[_0x3645('0xb')](),controller[_0x3645('0x17')]);module[_0x3645('0x18')]=router; \ No newline at end of file +var _0x34ab=['exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','show','getConditions','/:id/actions','getActions','create','post','/:id/conditions','addConditions','put','update','delete'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x34ab,0xf1));var _0xb34a=function(_0x44afa4,_0x5be27b){_0x44afa4=_0x44afa4-0x0;var _0xcad289=_0x34ab[_0x44afa4];return _0xcad289;};'use strict';var multer=require(_0xb34a('0x0'));var util=require(_0xb34a('0x1'));var path=require(_0xb34a('0x2'));var timeout=require(_0xb34a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb34a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb34a('0x5'));var config=require(_0xb34a('0x6'));var controller=require(_0xb34a('0x7'));router['get']('/',auth[_0xb34a('0x8')](),controller[_0xb34a('0x9')]);router[_0xb34a('0xa')](_0xb34a('0xb'),auth[_0xb34a('0x8')](),controller[_0xb34a('0xc')]);router[_0xb34a('0xa')]('/:id/conditions',auth[_0xb34a('0x8')](),controller[_0xb34a('0xd')]);router['get'](_0xb34a('0xe'),auth[_0xb34a('0x8')](),controller[_0xb34a('0xf')]);router['post']('/',auth[_0xb34a('0x8')](),controller[_0xb34a('0x10')]);router[_0xb34a('0x11')](_0xb34a('0x12'),auth[_0xb34a('0x8')](),controller[_0xb34a('0x13')]);router[_0xb34a('0x11')](_0xb34a('0xe'),auth[_0xb34a('0x8')](),controller['addActions']);router[_0xb34a('0x14')]('/:id',auth[_0xb34a('0x8')](),controller[_0xb34a('0x15')]);router[_0xb34a('0x16')](_0xb34a('0xb'),auth[_0xb34a('0x8')](),controller['destroy']);module[_0xb34a('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 3bf8392..4a4ea1a 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 _0xaaa7=['Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','Max\x20200\x20calls.','INTEGER','UNSIGNED','#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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','never','onlyIfOpen','always'];(function(_0x8bbdd1,_0xe21b5d){var _0x235909=function(_0x5bfbf2){while(--_0x5bfbf2){_0x8bbdd1['push'](_0x8bbdd1['shift']());}};_0x235909(++_0xe21b5d);}(_0xaaa7,0x104));var _0x7aaa=function(_0x13ae66,_0x473920){_0x13ae66=_0x13ae66-0x0;var _0x538a98=_0xaaa7[_0x13ae66];return _0x538a98;};'use strict';var Sequelize=require(_0x7aaa('0x0'));module[_0x7aaa('0x1')]={'name':{'type':Sequelize[_0x7aaa('0x2')],'unique':_0x7aaa('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x7aaa('0x4')),'allowNull':![],'defaultValue':_0x7aaa('0x4')},'description':{'type':Sequelize[_0x7aaa('0x2')]},'active':{'type':Sequelize[_0x7aaa('0x5')],'defaultValue':0x0,'comment':_0x7aaa('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x7aaa('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x7aaa('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x7aaa('0x8')](0x3)[_0x7aaa('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x7aaa('0x8')](0x3)[_0x7aaa('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7aaa('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7aaa('0x8')](0x5)[_0x7aaa('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7aaa('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x7aaa('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7aaa('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7aaa('0x9')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x7aaa('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7aaa('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x7aaa('0x8')](0x3)[_0x7aaa('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7aaa('0xe')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x7aaa('0x2')],'defaultValue':_0x7aaa('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x7aaa('0x10')]('always',_0x7aaa('0x11'),_0x7aaa('0x12')),'defaultValue':_0x7aaa('0x13')},'dialAMDActive':{'type':Sequelize[_0x7aaa('0x5')],'defaultValue':0x0,'comment':_0x7aaa('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x7aaa('0x8')](0x9)[_0x7aaa('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x7aaa('0x8')](0x9)[_0x7aaa('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7aaa('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x7aaa('0x8')](0x9)[_0x7aaa('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7aaa('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x7aaa('0x8')](0x9)[_0x7aaa('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7aaa('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x7aaa('0x8')](0x9)[_0x7aaa('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7aaa('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7aaa('0x8')](0x9)[_0x7aaa('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7aaa('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7aaa('0x8')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7aaa('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7aaa('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7aaa('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7aaa('0x8')](0x9)[_0x7aaa('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7aaa('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7aaa('0x10')](_0x7aaa('0x1d'),_0x7aaa('0x1e')),'defaultValue':_0x7aaa('0x1d')},'dialPrefix':{'type':Sequelize[_0x7aaa('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7aaa('0x8')](0x3)[_0x7aaa('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7aaa('0x1f')},'dialCutDigit':{'type':Sequelize[_0x7aaa('0x8')](0x3)[_0x7aaa('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7aaa('0x20')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x7aaa('0x8')](0x3)[_0x7aaa('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7aaa('0x21')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7aaa('0x8')](0x5)[_0x7aaa('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x7aaa('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x7aaa('0x8')](0x5)[_0x7aaa('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x7aaa('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7aaa('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x7aaa('0x8')](0x5)[_0x7aaa('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7aaa('0x23')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7aaa('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7aaa('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x7aaa('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7aaa('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7aaa('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7aaa('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7aaa('0x8')](0x5)[_0x7aaa('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7aaa('0x27')}}; \ No newline at end of file +var _0x0b4b=['#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x4d4677,_0x24cbb0){var _0x3bd054=function(_0x250deb){while(--_0x250deb){_0x4d4677['push'](_0x4d4677['shift']());}};_0x3bd054(++_0x24cbb0);}(_0x0b4b,0x16a));var _0xb0b4=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x0b4b[_0x363ef8];return _0x148822;};'use strict';var Sequelize=require(_0xb0b4('0x0'));module['exports']={'name':{'type':Sequelize[_0xb0b4('0x1')],'unique':_0xb0b4('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xb0b4('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xb0b4('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xb0b4('0x4')},'limitCalls':{'type':Sequelize[_0xb0b4('0x5')](0x4)[_0xb0b4('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xb0b4('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0xb0b4('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xb0b4('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xb0b4('0x5')](0x3)[_0xb0b4('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb0b4('0x8')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb0b4('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb0b4('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb0b4('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb0b4('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xb0b4('0x5')](0x3)[_0xb0b4('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xb0b4('0x5')](0x5)[_0xb0b4('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb0b4('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xb0b4('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb0b4('0x5')](0x5)[_0xb0b4('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xb0b4('0x5')](0x3)[_0xb0b4('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xb0b4('0xd')},'dialTimezone':{'type':Sequelize[_0xb0b4('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xb0b4('0x1')],'defaultValue':_0xb0b4('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xb0b4('0xf')](_0xb0b4('0x10'),_0xb0b4('0x11'),_0xb0b4('0x12')),'defaultValue':_0xb0b4('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xb0b4('0x5')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xb0b4('0x13')},'dialAMDGreeting':{'type':Sequelize[_0xb0b4('0x5')](0x9)[_0xb0b4('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xb0b4('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xb0b4('0x5')](0x9)[_0xb0b4('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xb0b4('0x5')](0x9)[_0xb0b4('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb0b4('0x15')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xb0b4('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xb0b4('0x5')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xb0b4('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xb0b4('0x5')](0x5)[_0xb0b4('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xb0b4('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xb0b4('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xb0b4('0xf')](_0xb0b4('0x18'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xb0b4('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xb0b4('0x5')](0x3)[_0xb0b4('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb0b4('0x19')},'dialCutDigit':{'type':Sequelize[_0xb0b4('0x5')](0x3)[_0xb0b4('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb0b4('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xb0b4('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb0b4('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xb0b4('0x5')](0x5)[_0xb0b4('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb0b4('0x1c')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb0b4('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb0b4('0x1d')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb0b4('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb0b4('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xb0b4('0x5')](0x3)[_0xb0b4('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb0b4('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xb0b4('0x5')](0x5)[_0xb0b4('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb0b4('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0xb0b4('0x5')](0x3)[_0xb0b4('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xb0b4('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb0b4('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xb0b4('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb0b4('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xb0b4('0x5')](0x5)[_0xb0b4('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb0b4('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 2f90e91..358d58f 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 _0x3eae=['Campaign','rawAttributes','type','key','map','name','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','rows','show','params','length','catch','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','create','include','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','CampaignId','getHopperHistories','findOne','CmHopperHistory','findAll','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','field','NOW()','CmListId','toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','h.id','ci.item','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','removeBlackLists','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','IvrCampaigns','UserProfileResource','error','stack','index'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x3eae,0x66));var _0xe3ea=function(_0xf35bc1,_0x510803){_0xf35bc1=_0xf35bc1-0x0;var _0xa6b162=_0x3eae[_0xf35bc1];return _0xa6b162;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe3ea('0x0'));var jsonpatch=require(_0xe3ea('0x1'));var rp=require('request-promise');var moment=require(_0xe3ea('0x2'));var BPromise=require(_0xe3ea('0x3'));var Mustache=require(_0xe3ea('0x4'));var util=require('util');var path=require('path');var sox=require(_0xe3ea('0x5'));var csv=require(_0xe3ea('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe3ea('0x7'));var _=require(_0xe3ea('0x8'));var squel=require('squel');var crypto=require(_0xe3ea('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe3ea('0xa'));var toCsv=require(_0xe3ea('0x6'));var querystring=require(_0xe3ea('0xb'));var Papa=require('papaparse');var Redis=require(_0xe3ea('0xc'));var authService=require(_0xe3ea('0xd'));var qs=require(_0xe3ea('0xe'));var as=require(_0xe3ea('0xf'));var hardwareService=require(_0xe3ea('0x10'));var logger=require(_0xe3ea('0x11'))(_0xe3ea('0x12'));var utils=require(_0xe3ea('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe3ea('0x14'))['db'];function respondWithStatusCode(_0x6a9294,_0x36c2dd){_0x36c2dd=_0x36c2dd||0xcc;return function(_0x247139){if(_0x247139){return _0x6a9294[_0xe3ea('0x15')](_0x36c2dd);}return _0x6a9294[_0xe3ea('0x16')](_0x36c2dd)[_0xe3ea('0x17')]();};}function respondWithResult(_0x2b36ec,_0x31357a){_0x31357a=_0x31357a||0xc8;return function(_0x11f560){if(_0x11f560){return _0x2b36ec[_0xe3ea('0x16')](_0x31357a)[_0xe3ea('0x18')](_0x11f560);}};}function respondWithFilteredResult(_0x445775,_0x492c29){return function(_0x3c3700){if(_0x3c3700){var _0x2a086a=typeof _0x492c29[_0xe3ea('0x19')]===_0xe3ea('0x1a')&&typeof _0x492c29[_0xe3ea('0x1b')]===_0xe3ea('0x1a');var _0x466d2d=_0x3c3700[_0xe3ea('0x1c')];var _0x33f6f8=_0x2a086a?0x0:_0x492c29[_0xe3ea('0x19')];var _0x3575be=_0x2a086a?_0x3c3700[_0xe3ea('0x1c')]:_0x492c29[_0xe3ea('0x19')]+_0x492c29[_0xe3ea('0x1b')];var _0x2a397b;if(_0x3575be>=_0x466d2d){_0x3575be=_0x466d2d;_0x2a397b=0xc8;}else{_0x2a397b=0xce;}_0x445775[_0xe3ea('0x16')](_0x2a397b);return _0x445775[_0xe3ea('0x1d')](_0xe3ea('0x1e'),_0x33f6f8+'-'+_0x3575be+'/'+_0x466d2d)[_0xe3ea('0x18')](_0x3c3700);}return null;};}function patchUpdates(_0x29e32e){return function(_0xd61c1c){try{jsonpatch[_0xe3ea('0x1f')](_0xd61c1c,_0x29e32e,!![]);}catch(_0xca5a4f){return BPromise[_0xe3ea('0x20')](_0xca5a4f);}return _0xd61c1c[_0xe3ea('0x21')]();};}function saveUpdates(_0x4a537d,_0x5ed42a){return function(_0x4f0e9e){if(_0x4f0e9e){return _0x4f0e9e[_0xe3ea('0x22')](_0x4a537d)['then'](function(_0x5050eb){return _0x5050eb;});}return null;};}function removeEntity(_0x350d8e,_0x19dd53){return function(_0x4cda82){if(_0x4cda82){return _0x4cda82[_0xe3ea('0x23')]()[_0xe3ea('0x24')](function(){var _0x594ba1=_0x4cda82[_0xe3ea('0x25')]({'plain':!![]});var _0x4bb839=_0xe3ea('0x26');return db[_0xe3ea('0x27')][_0xe3ea('0x23')]({'where':{'type':_0x4bb839,'resourceId':_0x594ba1['id']}})['then'](function(){return _0x4cda82;});})[_0xe3ea('0x24')](function(){_0x350d8e[_0xe3ea('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x522a3f,_0x5518d3){return function(_0x5bd356){if(!_0x5bd356){_0x522a3f['sendStatus'](0x194);}return _0x5bd356;};}function handleError(_0x5f1eff,_0x3accb1){_0x3accb1=_0x3accb1||0x1f4;return function(_0x3e7c9f){logger[_0xe3ea('0x28')](_0x3e7c9f[_0xe3ea('0x29')]);if(_0x3e7c9f['name']){delete _0x3e7c9f['name'];}_0x5f1eff[_0xe3ea('0x16')](_0x3accb1)['send'](_0x3e7c9f);};}exports[_0xe3ea('0x2a')]=function(_0x2b1c07,_0x73a56e){var _0x51bdd4={},_0x5c8a68={},_0x7b9638={'count':0x0,'rows':[]};var _0x10f778=_['map'](db[_0xe3ea('0x2b')][_0xe3ea('0x2c')],function(_0x3ee500){return{'name':_0x3ee500['fieldName'],'type':_0x3ee500[_0xe3ea('0x2d')][_0xe3ea('0x2e')]};});_0x5c8a68['model']=_[_0xe3ea('0x2f')](_0x10f778,_0xe3ea('0x30'));_0x5c8a68[_0xe3ea('0x31')]=_[_0xe3ea('0x32')](_0x2b1c07[_0xe3ea('0x31')]);_0x5c8a68[_0xe3ea('0x33')]=_[_0xe3ea('0x34')](_0x5c8a68[_0xe3ea('0x35')],_0x5c8a68[_0xe3ea('0x31')]);_0x51bdd4['attributes']=_['intersection'](_0x5c8a68[_0xe3ea('0x35')],qs[_0xe3ea('0x36')](_0x2b1c07[_0xe3ea('0x31')][_0xe3ea('0x36')]));_0x51bdd4[_0xe3ea('0x37')]=_0x51bdd4[_0xe3ea('0x37')]['length']?_0x51bdd4['attributes']:_0x5c8a68[_0xe3ea('0x35')];if(!_0x2b1c07[_0xe3ea('0x31')][_0xe3ea('0x38')](_0xe3ea('0x39'))){_0x51bdd4[_0xe3ea('0x1b')]=qs[_0xe3ea('0x1b')](_0x2b1c07[_0xe3ea('0x31')][_0xe3ea('0x1b')]);_0x51bdd4[_0xe3ea('0x19')]=qs[_0xe3ea('0x19')](_0x2b1c07['query'][_0xe3ea('0x19')]);}_0x51bdd4[_0xe3ea('0x3a')]=qs[_0xe3ea('0x3b')](_0x2b1c07['query']['sort']);_0x51bdd4['where']=qs[_0xe3ea('0x33')](_[_0xe3ea('0x3c')](_0x2b1c07['query'],_0x5c8a68[_0xe3ea('0x33')]),_0x10f778);if(_0x2b1c07[_0xe3ea('0x31')][_0xe3ea('0x3d')]){_0x51bdd4['where']=_[_0xe3ea('0x3e')](_0x51bdd4[_0xe3ea('0x3f')],{'$or':_[_0xe3ea('0x2f')](_0x10f778,function(_0x3a3b6c){if(_0x3a3b6c['type']!==_0xe3ea('0x40')){var _0x320c24={};_0x320c24[_0x3a3b6c[_0xe3ea('0x30')]]={'$like':'%'+_0x2b1c07['query'][_0xe3ea('0x3d')]+'%'};return _0x320c24;}})});}_0x51bdd4=_[_0xe3ea('0x3e')]({},_0x51bdd4,_0x2b1c07[_0xe3ea('0x41')]);var _0x252d3f={'where':_0x51bdd4[_0xe3ea('0x3f')]};return db[_0xe3ea('0x2b')]['count'](_0x252d3f)[_0xe3ea('0x24')](function(_0x50bc87){_0x7b9638[_0xe3ea('0x1c')]=_0x50bc87;if(_0x2b1c07[_0xe3ea('0x31')][_0xe3ea('0x42')]){_0x51bdd4['include']=[{'all':!![]}];}return db[_0xe3ea('0x2b')]['findAll'](_0x51bdd4);})[_0xe3ea('0x24')](function(_0x142057){_0x7b9638[_0xe3ea('0x43')]=_0x142057;return _0x7b9638;})['then'](respondWithFilteredResult(_0x73a56e,_0x51bdd4))['catch'](handleError(_0x73a56e,null));};exports[_0xe3ea('0x44')]=function(_0x5ccd6d,_0x185cc7){var _0x50a9ca={'raw':![],'where':{'id':_0x5ccd6d[_0xe3ea('0x45')]['id']}},_0xea2469={};_0xea2469[_0xe3ea('0x35')]=_[_0xe3ea('0x32')](db[_0xe3ea('0x2b')][_0xe3ea('0x2c')]);_0xea2469['query']=_[_0xe3ea('0x32')](_0x5ccd6d[_0xe3ea('0x31')]);_0xea2469[_0xe3ea('0x33')]=_[_0xe3ea('0x34')](_0xea2469[_0xe3ea('0x35')],_0xea2469['query']);_0x50a9ca[_0xe3ea('0x37')]=_[_0xe3ea('0x34')](_0xea2469[_0xe3ea('0x35')],qs[_0xe3ea('0x36')](_0x5ccd6d[_0xe3ea('0x31')]['fields']));_0x50a9ca[_0xe3ea('0x37')]=_0x50a9ca['attributes'][_0xe3ea('0x46')]?_0x50a9ca['attributes']:_0xea2469[_0xe3ea('0x35')];if(_0x5ccd6d[_0xe3ea('0x31')]['includeAll']){_0x50a9ca['include']=[{'all':!![]}];}_0x50a9ca=_[_0xe3ea('0x3e')]({},_0x50a9ca,_0x5ccd6d['options']);return db['Campaign']['find'](_0x50a9ca)[_0xe3ea('0x24')](handleEntityNotFound(_0x185cc7,null))[_0xe3ea('0x24')](respondWithResult(_0x185cc7,null))[_0xe3ea('0x47')](handleError(_0x185cc7,null));};exports['create']=function(_0x7b894,_0x134f3f){return db[_0xe3ea('0x2b')]['create'](_0x7b894[_0xe3ea('0x48')],{})['then'](function(_0x358a60){var _0x39bfb9=_0x7b894[_0xe3ea('0x49')][_0xe3ea('0x25')]({'plain':!![]});if(!_0x39bfb9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39bfb9[_0xe3ea('0x4a')]===_0xe3ea('0x49')){var _0x38cbbe=_0x358a60[_0xe3ea('0x25')]({'plain':!![]});var _0x59fafd=_0xe3ea('0x26');return db[_0xe3ea('0x4b')][_0xe3ea('0x4c')]({'where':{'name':_0x59fafd,'userProfileId':_0x39bfb9[_0xe3ea('0x4d')]},'raw':!![]})[_0xe3ea('0x24')](function(_0x59b4af){if(_0x59b4af&&_0x59b4af[_0xe3ea('0x4e')]===0x0){return db[_0xe3ea('0x27')][_0xe3ea('0x4f')]({'name':_0x38cbbe['name'],'resourceId':_0x38cbbe['id'],'type':_0x59b4af['name'],'sectionId':_0x59b4af['id']},{})[_0xe3ea('0x24')](function(){return _0x358a60;});}else{return _0x358a60;}})['catch'](function(_0x237c74){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x237c74);throw _0x237c74;});}return _0x358a60;})[_0xe3ea('0x24')](respondWithResult(_0x134f3f,0xc9))[_0xe3ea('0x47')](handleError(_0x134f3f,null));};exports['clone']=function(_0x1372c2,_0x1bb758){var _0x36b256={'where':{'id':_0x1372c2[_0xe3ea('0x45')]['id']}},_0x2b706c={};_0x2b706c[_0xe3ea('0x35')]=_[_0xe3ea('0x32')](db[_0xe3ea('0x2b')][_0xe3ea('0x2c')]);_0x36b256[_0xe3ea('0x37')]=_[_0xe3ea('0x34')](_0x2b706c[_0xe3ea('0x35')],qs[_0xe3ea('0x36')](_0x1372c2[_0xe3ea('0x31')][_0xe3ea('0x36')]));_0x36b256[_0xe3ea('0x37')]=_0x36b256[_0xe3ea('0x37')][_0xe3ea('0x46')]?_0x36b256['attributes']:_0x2b706c[_0xe3ea('0x35')];if(_0x1372c2['query'][_0xe3ea('0x42')]){_0x36b256[_0xe3ea('0x50')]=[{'all':!![]}];}_0x36b256=_[_0xe3ea('0x3e')]({},_0x36b256,_0x1372c2[_0xe3ea('0x41')]);return db[_0xe3ea('0x2b')]['find'](_0x36b256)[_0xe3ea('0x24')](handleEntityNotFound(_0x1bb758,null))[_0xe3ea('0x24')](function(_0x271718){if(_0x271718){var _0xf366af=_0x271718['get']({'plain':!![]});_0xf366af=qs[_0xe3ea('0x51')](_0xf366af,['id','createdAt',_0xe3ea('0x52')]);_0x1372c2['body']=_['omit'](_0x1372c2[_0xe3ea('0x48')],['id',_0xe3ea('0x53'),_0xe3ea('0x52')]);return db['Campaign'][_0xe3ea('0x4f')](_[_0xe3ea('0x3e')](_0xf366af,_0x1372c2[_0xe3ea('0x48')]),{'include':_0x1372c2[_0xe3ea('0x31')]['includeAll']?[{'all':!![]}]:undefined})[_0xe3ea('0x24')](function(_0xb736ba){var _0x4cc0bf=_0x1372c2['user'][_0xe3ea('0x25')]({'plain':!![]});if(!_0x4cc0bf)throw new Error(_0xe3ea('0x54'));if(_0x4cc0bf[_0xe3ea('0x4a')]===_0xe3ea('0x49')){var _0xcc3a95=_0xb736ba[_0xe3ea('0x25')]({'plain':!![]});var _0x1a2936=_0xe3ea('0x26');return db[_0xe3ea('0x4b')][_0xe3ea('0x4c')]({'where':{'name':_0x1a2936,'userProfileId':_0x4cc0bf[_0xe3ea('0x4d')]},'raw':!![]})[_0xe3ea('0x24')](function(_0x3e262f){if(_0x3e262f&&_0x3e262f['autoAssociation']===0x0){return db[_0xe3ea('0x27')][_0xe3ea('0x4f')]({'name':_0xcc3a95[_0xe3ea('0x30')],'resourceId':_0xcc3a95['id'],'type':_0x3e262f['name'],'sectionId':_0x3e262f['id']},{})['then'](function(){return _0xb736ba;});}else{return _0xb736ba;}})['catch'](function(_0x3e0f3a){logger['error'](_0xe3ea('0x55'),_0x3e0f3a);throw _0x3e0f3a;});}return _0xb736ba;});}})[_0xe3ea('0x24')](respondWithResult(_0x1bb758,0xc9))['catch'](handleError(_0x1bb758,null));};exports[_0xe3ea('0x22')]=function(_0x4f52f8,_0x1a2b90){if(_0x4f52f8['body']['id']){delete _0x4f52f8[_0xe3ea('0x48')]['id'];}return db['Campaign']['find']({'where':{'id':_0x4f52f8[_0xe3ea('0x45')]['id']}})[_0xe3ea('0x24')](handleEntityNotFound(_0x1a2b90,null))[_0xe3ea('0x24')](saveUpdates(_0x4f52f8[_0xe3ea('0x48')],null))[_0xe3ea('0x24')](respondWithResult(_0x1a2b90,null))[_0xe3ea('0x47')](handleError(_0x1a2b90,null));};exports[_0xe3ea('0x23')]=function(_0x23d8a1,_0x2765db){return db[_0xe3ea('0x2b')][_0xe3ea('0x4c')]({'where':{'id':_0x23d8a1[_0xe3ea('0x45')]['id']}})[_0xe3ea('0x24')](handleEntityNotFound(_0x2765db,null))[_0xe3ea('0x24')](removeEntity(_0x2765db,null))[_0xe3ea('0x47')](handleError(_0x2765db,null));};exports[_0xe3ea('0x56')]=function(_0x8e36b7,_0x2612e8,_0x26ee66){var _0x4d6179={'raw':!![],'where':{}};var _0x3efc1f={};var _0xde7504={'count':0x0,'rows':[]};return db[_0xe3ea('0x2b')]['findOne']({'where':{'id':_0x8e36b7[_0xe3ea('0x45')]['id']}})[_0xe3ea('0x24')](handleEntityNotFound(_0x2612e8,null))[_0xe3ea('0x24')](function(_0x333d39){if(_0x333d39){_0x3efc1f[_0xe3ea('0x35')]=_[_0xe3ea('0x32')](db[_0xe3ea('0x57')]['rawAttributes']);_0x3efc1f[_0xe3ea('0x31')]=_[_0xe3ea('0x32')](_0x8e36b7['query']);_0x3efc1f[_0xe3ea('0x33')]=_['intersection'](_0x3efc1f[_0xe3ea('0x35')],_0x3efc1f[_0xe3ea('0x31')]);_0x4d6179[_0xe3ea('0x37')]=_[_0xe3ea('0x34')](_0x3efc1f[_0xe3ea('0x35')],qs[_0xe3ea('0x36')](_0x8e36b7['query']['fields']));_0x4d6179['attributes']=_0x4d6179[_0xe3ea('0x37')]['length']?_0x4d6179['attributes']:_0x3efc1f[_0xe3ea('0x35')];if(!_0x8e36b7['query']['hasOwnProperty'](_0xe3ea('0x39'))){_0x4d6179['limit']=qs[_0xe3ea('0x1b')](_0x8e36b7['query']['limit']);_0x4d6179[_0xe3ea('0x19')]=qs[_0xe3ea('0x19')](_0x8e36b7[_0xe3ea('0x31')][_0xe3ea('0x19')]);}_0x4d6179['order']=qs[_0xe3ea('0x3b')](_0x8e36b7[_0xe3ea('0x31')]['sort']);_0x4d6179[_0xe3ea('0x3f')]=qs[_0xe3ea('0x33')](_[_0xe3ea('0x3c')](_0x8e36b7['query'],_0x3efc1f[_0xe3ea('0x33')]));_0x4d6179[_0xe3ea('0x3f')][_0xe3ea('0x58')]=_0x333d39['id'];if(_0x8e36b7['query'][_0xe3ea('0x3d')]){_0x4d6179[_0xe3ea('0x3f')]=_[_0xe3ea('0x3e')](_0x4d6179[_0xe3ea('0x3f')],{'$or':_['map'](_0x4d6179[_0xe3ea('0x37')],function(_0x3c5c72){var _0x3af108={};_0x3af108[_0x3c5c72]={'$like':'%'+_0x8e36b7[_0xe3ea('0x31')]['filter']+'%'};return _0x3af108;})});}_0x4d6179=_['merge']({},_0x4d6179,_0x8e36b7[_0xe3ea('0x41')]);return db[_0xe3ea('0x57')][_0xe3ea('0x1c')]({'where':_0x4d6179[_0xe3ea('0x3f')]})[_0xe3ea('0x24')](function(_0x1d02b2){_0xde7504[_0xe3ea('0x1c')]=_0x1d02b2;if(_0x8e36b7[_0xe3ea('0x31')][_0xe3ea('0x42')]){_0x4d6179[_0xe3ea('0x50')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x4d6179);})[_0xe3ea('0x24')](function(_0x4b84c2){_0xde7504[_0xe3ea('0x43')]=_0x4b84c2;return _0xde7504;});}})[_0xe3ea('0x24')](respondWithFilteredResult(_0x2612e8,_0x4d6179))[_0xe3ea('0x47')](handleError(_0x2612e8,null));};exports[_0xe3ea('0x59')]=function(_0x10ad9f,_0x44a258,_0x8a925b){var _0xf02e07={'raw':!![],'where':{}};var _0x43e0fa={};var _0x3b7ae1={'count':0x0,'rows':[]};return db[_0xe3ea('0x2b')][_0xe3ea('0x5a')]({'where':{'id':_0x10ad9f[_0xe3ea('0x45')]['id']}})[_0xe3ea('0x24')](handleEntityNotFound(_0x44a258,null))['then'](function(_0x10e01a){if(_0x10e01a){_0x43e0fa[_0xe3ea('0x35')]=_['keys'](db[_0xe3ea('0x5b')]['rawAttributes']);_0x43e0fa[_0xe3ea('0x31')]=_['keys'](_0x10ad9f['query']);_0x43e0fa[_0xe3ea('0x33')]=_[_0xe3ea('0x34')](_0x43e0fa['model'],_0x43e0fa['query']);_0xf02e07[_0xe3ea('0x37')]=_[_0xe3ea('0x34')](_0x43e0fa[_0xe3ea('0x35')],qs['fields'](_0x10ad9f[_0xe3ea('0x31')][_0xe3ea('0x36')]));_0xf02e07['attributes']=_0xf02e07['attributes'][_0xe3ea('0x46')]?_0xf02e07[_0xe3ea('0x37')]:_0x43e0fa[_0xe3ea('0x35')];if(!_0x10ad9f[_0xe3ea('0x31')][_0xe3ea('0x38')](_0xe3ea('0x39'))){_0xf02e07[_0xe3ea('0x1b')]=qs[_0xe3ea('0x1b')](_0x10ad9f['query'][_0xe3ea('0x1b')]);_0xf02e07[_0xe3ea('0x19')]=qs[_0xe3ea('0x19')](_0x10ad9f['query']['offset']);}_0xf02e07[_0xe3ea('0x3a')]=qs['sort'](_0x10ad9f['query'][_0xe3ea('0x3b')]);_0xf02e07[_0xe3ea('0x3f')]=qs[_0xe3ea('0x33')](_[_0xe3ea('0x3c')](_0x10ad9f['query'],_0x43e0fa[_0xe3ea('0x33')]));_0xf02e07[_0xe3ea('0x3f')][_0xe3ea('0x58')]=_0x10e01a['id'];if(_0x10ad9f['query']['filter']){_0xf02e07['where']=_[_0xe3ea('0x3e')](_0xf02e07[_0xe3ea('0x3f')],{'$or':_[_0xe3ea('0x2f')](_0xf02e07[_0xe3ea('0x37')],function(_0x2d7bf9){var _0x5befaa={};_0x5befaa[_0x2d7bf9]={'$like':'%'+_0x10ad9f[_0xe3ea('0x31')][_0xe3ea('0x3d')]+'%'};return _0x5befaa;})});}_0xf02e07=_[_0xe3ea('0x3e')]({},_0xf02e07,_0x10ad9f[_0xe3ea('0x41')]);return db[_0xe3ea('0x5b')][_0xe3ea('0x1c')]({'where':_0xf02e07['where']})[_0xe3ea('0x24')](function(_0x49b1b4){_0x3b7ae1[_0xe3ea('0x1c')]=_0x49b1b4;if(_0x10ad9f[_0xe3ea('0x31')][_0xe3ea('0x42')]){_0xf02e07[_0xe3ea('0x50')]=[{'all':!![]}];}return db[_0xe3ea('0x5b')][_0xe3ea('0x5c')](_0xf02e07);})['then'](function(_0x55744e){_0x3b7ae1[_0xe3ea('0x43')]=_0x55744e;return _0x3b7ae1;});}})['then'](respondWithFilteredResult(_0x44a258,_0xf02e07))[_0xe3ea('0x47')](handleError(_0x44a258,null));};exports[_0xe3ea('0x5d')]=function(_0xa87fee,_0x140209,_0x202ba3){var _0x5bb631={'raw':!![],'where':{}};var _0x98cfd5={};var _0x177452={'count':0x0,'rows':[]};return db[_0xe3ea('0x2b')][_0xe3ea('0x5a')]({'where':{'id':_0xa87fee[_0xe3ea('0x45')]['id']}})['then'](handleEntityNotFound(_0x140209,null))[_0xe3ea('0x24')](function(_0x15b989){if(_0x15b989){_0x98cfd5[_0xe3ea('0x35')]=_[_0xe3ea('0x32')](db[_0xe3ea('0x5e')][_0xe3ea('0x2c')]);_0x98cfd5[_0xe3ea('0x31')]=_[_0xe3ea('0x32')](_0xa87fee[_0xe3ea('0x31')]);_0x98cfd5[_0xe3ea('0x33')]=_[_0xe3ea('0x34')](_0x98cfd5[_0xe3ea('0x35')],_0x98cfd5[_0xe3ea('0x31')]);_0x5bb631[_0xe3ea('0x37')]=_[_0xe3ea('0x34')](_0x98cfd5[_0xe3ea('0x35')],qs[_0xe3ea('0x36')](_0xa87fee[_0xe3ea('0x31')]['fields']));_0x5bb631[_0xe3ea('0x37')]=_0x5bb631['attributes'][_0xe3ea('0x46')]?_0x5bb631['attributes']:_0x98cfd5[_0xe3ea('0x35')];if(!_0xa87fee[_0xe3ea('0x31')][_0xe3ea('0x38')](_0xe3ea('0x39'))){_0x5bb631[_0xe3ea('0x1b')]=qs[_0xe3ea('0x1b')](_0xa87fee[_0xe3ea('0x31')][_0xe3ea('0x1b')]);_0x5bb631[_0xe3ea('0x19')]=qs[_0xe3ea('0x19')](_0xa87fee['query'][_0xe3ea('0x19')]);}_0x5bb631[_0xe3ea('0x3a')]=qs['sort'](_0xa87fee[_0xe3ea('0x31')][_0xe3ea('0x3b')]);_0x5bb631[_0xe3ea('0x3f')]=qs[_0xe3ea('0x33')](_['pick'](_0xa87fee[_0xe3ea('0x31')],_0x98cfd5['filters']));_0x5bb631[_0xe3ea('0x3f')][_0xe3ea('0x58')]=_0x15b989['id'];if(_0xa87fee['query'][_0xe3ea('0x3d')]){_0x5bb631[_0xe3ea('0x3f')]=_[_0xe3ea('0x3e')](_0x5bb631[_0xe3ea('0x3f')],{'$or':_['map'](_0x5bb631[_0xe3ea('0x37')],function(_0x16a009){var _0x374d15={};_0x374d15[_0x16a009]={'$like':'%'+_0xa87fee[_0xe3ea('0x31')][_0xe3ea('0x3d')]+'%'};return _0x374d15;})});}_0x5bb631=_['merge']({},_0x5bb631,_0xa87fee[_0xe3ea('0x41')]);return db[_0xe3ea('0x5e')][_0xe3ea('0x1c')]({'where':_0x5bb631[_0xe3ea('0x3f')]})[_0xe3ea('0x24')](function(_0xc50af9){_0x177452[_0xe3ea('0x1c')]=_0xc50af9;if(_0xa87fee[_0xe3ea('0x31')][_0xe3ea('0x42')]){_0x5bb631[_0xe3ea('0x50')]=[{'all':!![]}];}return db[_0xe3ea('0x5e')][_0xe3ea('0x5c')](_0x5bb631);})[_0xe3ea('0x24')](function(_0x26f9b2){_0x177452[_0xe3ea('0x43')]=_0x26f9b2;return _0x177452;});}})[_0xe3ea('0x24')](respondWithFilteredResult(_0x140209,_0x5bb631))['catch'](handleError(_0x140209,null));};exports['getHopperBlacks']=function(_0x1e7805,_0x434f8b,_0x289c92){var _0xd8f008={'raw':!![],'where':{}};var _0x2a6341={};var _0x1bf86a={'count':0x0,'rows':[]};return db[_0xe3ea('0x2b')][_0xe3ea('0x5a')]({'where':{'id':_0x1e7805[_0xe3ea('0x45')]['id']}})[_0xe3ea('0x24')](handleEntityNotFound(_0x434f8b,null))[_0xe3ea('0x24')](function(_0x2ca236){if(_0x2ca236){_0x2a6341[_0xe3ea('0x35')]=_['keys'](db[_0xe3ea('0x5f')][_0xe3ea('0x2c')]);_0x2a6341[_0xe3ea('0x31')]=_[_0xe3ea('0x32')](_0x1e7805['query']);_0x2a6341[_0xe3ea('0x33')]=_['intersection'](_0x2a6341[_0xe3ea('0x35')],_0x2a6341[_0xe3ea('0x31')]);_0xd8f008['attributes']=_[_0xe3ea('0x34')](_0x2a6341[_0xe3ea('0x35')],qs[_0xe3ea('0x36')](_0x1e7805['query'][_0xe3ea('0x36')]));_0xd8f008['attributes']=_0xd8f008[_0xe3ea('0x37')][_0xe3ea('0x46')]?_0xd8f008[_0xe3ea('0x37')]:_0x2a6341[_0xe3ea('0x35')];if(!_0x1e7805['query'][_0xe3ea('0x38')](_0xe3ea('0x39'))){_0xd8f008['limit']=qs[_0xe3ea('0x1b')](_0x1e7805['query'][_0xe3ea('0x1b')]);_0xd8f008[_0xe3ea('0x19')]=qs['offset'](_0x1e7805[_0xe3ea('0x31')][_0xe3ea('0x19')]);}_0xd8f008[_0xe3ea('0x3a')]=qs[_0xe3ea('0x3b')](_0x1e7805[_0xe3ea('0x31')][_0xe3ea('0x3b')]);_0xd8f008[_0xe3ea('0x3f')]=qs[_0xe3ea('0x33')](_[_0xe3ea('0x3c')](_0x1e7805[_0xe3ea('0x31')],_0x2a6341[_0xe3ea('0x33')]));_0xd8f008['where'][_0xe3ea('0x58')]=_0x2ca236['id'];if(_0x1e7805['query']['filter']){_0xd8f008['where']=_[_0xe3ea('0x3e')](_0xd8f008[_0xe3ea('0x3f')],{'$or':_['map'](_0xd8f008[_0xe3ea('0x37')],function(_0x244cbc){var _0x386d90={};_0x386d90[_0x244cbc]={'$like':'%'+_0x1e7805[_0xe3ea('0x31')][_0xe3ea('0x3d')]+'%'};return _0x386d90;})});}_0xd8f008=_[_0xe3ea('0x3e')]({},_0xd8f008,_0x1e7805[_0xe3ea('0x41')]);return db[_0xe3ea('0x5f')]['count']({'where':_0xd8f008[_0xe3ea('0x3f')]})[_0xe3ea('0x24')](function(_0x930ff3){_0x1bf86a[_0xe3ea('0x1c')]=_0x930ff3;if(_0x1e7805[_0xe3ea('0x31')]['includeAll']){_0xd8f008['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0xe3ea('0x5c')](_0xd8f008);})[_0xe3ea('0x24')](function(_0xb6fc35){_0x1bf86a['rows']=_0xb6fc35;return _0x1bf86a;});}})[_0xe3ea('0x24')](respondWithFilteredResult(_0x434f8b,_0xd8f008))[_0xe3ea('0x47')](handleError(_0x434f8b,null));};exports[_0xe3ea('0x60')]=function(_0x5df445,_0x1fb091,_0x4ef61e){var _0x4a3c97={};var _0x364b91={};var _0x2d7782;var _0x462c34;return db[_0xe3ea('0x2b')][_0xe3ea('0x5a')]({'where':{'id':_0x5df445[_0xe3ea('0x45')]['id']}})[_0xe3ea('0x24')](handleEntityNotFound(_0x1fb091,null))[_0xe3ea('0x24')](function(_0x50ea71){if(_0x50ea71){_0x2d7782=_0x50ea71;_0x364b91[_0xe3ea('0x35')]=_[_0xe3ea('0x32')](db[_0xe3ea('0x61')]['rawAttributes']);_0x364b91[_0xe3ea('0x31')]=_[_0xe3ea('0x32')](_0x5df445[_0xe3ea('0x31')]);_0x364b91[_0xe3ea('0x33')]=_[_0xe3ea('0x34')](_0x364b91['model'],_0x364b91[_0xe3ea('0x31')]);_0x4a3c97[_0xe3ea('0x37')]=_['intersection'](_0x364b91[_0xe3ea('0x35')],qs[_0xe3ea('0x36')](_0x5df445[_0xe3ea('0x31')][_0xe3ea('0x36')]));_0x4a3c97['attributes']=_0x4a3c97['attributes'][_0xe3ea('0x46')]?_0x4a3c97['attributes']:_0x364b91[_0xe3ea('0x35')];_0x4a3c97[_0xe3ea('0x3a')]=qs[_0xe3ea('0x3b')](_0x5df445['query']['sort']);_0x4a3c97['where']=qs[_0xe3ea('0x33')](_[_0xe3ea('0x3c')](_0x5df445['query'],_0x364b91['filters']));if(_0x5df445['query'][_0xe3ea('0x3d')]){_0x4a3c97[_0xe3ea('0x3f')]=_[_0xe3ea('0x3e')](_0x4a3c97[_0xe3ea('0x3f')],{'$or':_[_0xe3ea('0x2f')](_0x4a3c97[_0xe3ea('0x37')],function(_0x3f7119){var _0x1b233f={};_0x1b233f[_0x3f7119]={'$like':'%'+_0x5df445[_0xe3ea('0x31')][_0xe3ea('0x3d')]+'%'};return _0x1b233f;})});}_0x4a3c97=_[_0xe3ea('0x3e')]({},_0x4a3c97,_0x5df445['options']);return _0x2d7782[_0xe3ea('0x60')](_0x4a3c97);}})['then'](function(_0x52e753){if(_0x52e753){_0x462c34=_0x52e753[_0xe3ea('0x46')];if(!_0x5df445[_0xe3ea('0x31')]['hasOwnProperty'](_0xe3ea('0x39'))){_0x4a3c97[_0xe3ea('0x1b')]=qs[_0xe3ea('0x1b')](_0x5df445[_0xe3ea('0x31')][_0xe3ea('0x1b')]);_0x4a3c97[_0xe3ea('0x19')]=qs[_0xe3ea('0x19')](_0x5df445['query'][_0xe3ea('0x19')]);}return _0x2d7782[_0xe3ea('0x60')](_0x4a3c97);}})[_0xe3ea('0x24')](function(_0x5a20e0){if(_0x5a20e0){return _0x5a20e0?{'count':_0x462c34,'rows':_0x5a20e0}:null;}})[_0xe3ea('0x24')](respondWithResult(_0x1fb091,null))[_0xe3ea('0x47')](handleError(_0x1fb091,null));};exports[_0xe3ea('0x62')]=function(_0x37460d,_0x31ebe3,_0x50ad6f){var _0x1976b1,_0x3b3b78;var _0x213354=[];var _0x60b1c6=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db[_0xe3ea('0x2b')][_0xe3ea('0x4c')]({'where':{'id':_0x37460d[_0xe3ea('0x45')]['id']}})[_0xe3ea('0x24')](handleEntityNotFound(_0x31ebe3,null))[_0xe3ea('0x24')](function(_0x5d90a6){if(_0x5d90a6){_0x3b3b78=_0x5d90a6;return _0x5d90a6[_0xe3ea('0x62')](_0x37460d[_0xe3ea('0x48')][_0xe3ea('0x63')],_[_0xe3ea('0x51')](_0x37460d[_0xe3ea('0x48')],[_0xe3ea('0x63'),'id'])||{});}return null;})[_0xe3ea('0x64')](function(_0xf666){var _0x5bcbb5;var _0x4d47fe;_0x1976b1=_0xf666||[];var _0x4e290c=[];if(_0xf666){for(var _0x436fc8=0x0;_0x436fc8<_0xf666['length'];_0x436fc8+=0x1){var _0x4d049d=_0xf666[_0x436fc8]['get']({'plain':!![]});_0x3b3b78['dialCheckDuplicateType']=_0x37460d['body'][_0xe3ea('0x65')]?_0x37460d[_0xe3ea('0x48')][_0xe3ea('0x65')]:_0x3b3b78[_0xe3ea('0x65')];switch(_0x3b3b78['dialCheckDuplicateType']){case _0xe3ea('0x66'):_0x5bcbb5=squel[_0xe3ea('0x67')]()[_0xe3ea('0x68')](_0xe3ea('0x69'))[_0xe3ea('0x6a')]([_0xe3ea('0x6b'),_0xe3ea('0x6c'),_0xe3ea('0x6d'),'ListId',_0xe3ea('0x58'),_0xe3ea('0x53'),_0xe3ea('0x52')],squel['select']()['field'](_0xe3ea('0x6b'),_0xe3ea('0x6b'))[_0xe3ea('0x6e')](_0xe3ea('0x6f'),_0xe3ea('0x6c'))[_0xe3ea('0x6e')]('id',_0xe3ea('0x6d'))[_0xe3ea('0x6e')](_0x4d049d[_0xe3ea('0x70')][_0xe3ea('0x71')](),_0xe3ea('0x72'))[_0xe3ea('0x6e')](_0x37460d[_0xe3ea('0x45')]['id']['toString'](),_0xe3ea('0x58'))['field']('\x27'+_0x60b1c6+'\x27',_0xe3ea('0x53'))[_0xe3ea('0x6e')]('\x27'+_0x60b1c6+'\x27',_0xe3ea('0x52'))[_0xe3ea('0x73')](_0xe3ea('0x74'))['where'](_0xe3ea('0x75'))[_0xe3ea('0x3f')]('ListId\x20=\x20?',_0x4d049d['CmListId'][_0xe3ea('0x71')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xe3ea('0x3f')](_0xe3ea('0x76'),squel[_0xe3ea('0x77')]()['field'](_0xe3ea('0x78'))['from'](_0xe3ea('0x79'))[_0xe3ea('0x3f')](_0xe3ea('0x7a'),_0x37460d[_0xe3ea('0x45')]['id'][_0xe3ea('0x71')]()))[_0xe3ea('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe3ea('0x77')]()[_0xe3ea('0x6e')]('COALESCE(phone,\x27\x27)')['from'](_0xe3ea('0x69'))[_0xe3ea('0x3f')](_0xe3ea('0x7a'),_0x37460d[_0xe3ea('0x45')]['id']['toString']())))['toString']();break;case _0xe3ea('0x7b'):_0x5bcbb5=squel['insert']()[_0xe3ea('0x68')](_0xe3ea('0x69'))[_0xe3ea('0x6a')]([_0xe3ea('0x6b'),_0xe3ea('0x6c'),'ContactId',_0xe3ea('0x72'),_0xe3ea('0x58'),_0xe3ea('0x53'),'updatedAt'],squel[_0xe3ea('0x77')]()[_0xe3ea('0x6e')](_0xe3ea('0x6b'),_0xe3ea('0x6b'))['field'](_0xe3ea('0x6f'),_0xe3ea('0x6c'))[_0xe3ea('0x6e')]('id',_0xe3ea('0x6d'))['field'](_0x4d049d[_0xe3ea('0x70')][_0xe3ea('0x71')](),_0xe3ea('0x72'))['field'](_0x37460d[_0xe3ea('0x45')]['id'][_0xe3ea('0x71')](),'CampaignId')[_0xe3ea('0x6e')]('\x27'+_0x60b1c6+'\x27',_0xe3ea('0x53'))[_0xe3ea('0x6e')]('\x27'+_0x60b1c6+'\x27',_0xe3ea('0x52'))[_0xe3ea('0x73')]('cm_contacts')[_0xe3ea('0x3f')](_0xe3ea('0x75'))[_0xe3ea('0x3f')](_0xe3ea('0x7c'),_0x4d049d[_0xe3ea('0x70')][_0xe3ea('0x71')]())[_0xe3ea('0x3f')](_0xe3ea('0x7d'))[_0xe3ea('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xe3ea('0x6e')](_0xe3ea('0x7e'))[_0xe3ea('0x73')](_0xe3ea('0x69'))['where'](_0xe3ea('0x7a'),_0x37460d[_0xe3ea('0x45')]['id'][_0xe3ea('0x71')]())))[_0xe3ea('0x71')]();break;default:_0x5bcbb5=squel[_0xe3ea('0x67')]()[_0xe3ea('0x68')](_0xe3ea('0x69'))[_0xe3ea('0x6a')](['phone',_0xe3ea('0x6c'),_0xe3ea('0x6d'),_0xe3ea('0x72'),_0xe3ea('0x58'),_0xe3ea('0x53'),'updatedAt'],squel['select']()[_0xe3ea('0x6e')](_0xe3ea('0x6b'),'phone')[_0xe3ea('0x6e')](_0xe3ea('0x6f'),_0xe3ea('0x6c'))['field']('id',_0xe3ea('0x6d'))['field'](_0x4d049d[_0xe3ea('0x70')][_0xe3ea('0x71')](),_0xe3ea('0x72'))[_0xe3ea('0x6e')](_0x37460d[_0xe3ea('0x45')]['id']['toString'](),_0xe3ea('0x58'))[_0xe3ea('0x6e')]('\x27'+_0x60b1c6+'\x27',_0xe3ea('0x53'))[_0xe3ea('0x6e')]('\x27'+_0x60b1c6+'\x27',_0xe3ea('0x52'))[_0xe3ea('0x73')](_0xe3ea('0x74'))['where'](_0xe3ea('0x75'))[_0xe3ea('0x3f')]('ListId\x20=\x20?',_0x4d049d[_0xe3ea('0x70')][_0xe3ea('0x71')]())['where'](_0xe3ea('0x7d')))[_0xe3ea('0x71')]();}_0x4d47fe=squel[_0xe3ea('0x67')]()[_0xe3ea('0x68')]('cm_hopper_additional_phones')['fromQuery'](['cmHopperId','scheduledAt',_0xe3ea('0x6b'),'OrderBy',_0xe3ea('0x53'),_0xe3ea('0x52')],squel['select']()['field'](_0xe3ea('0x7f'),'id')[_0xe3ea('0x6e')](_0xe3ea('0x6f'),'scheduledAt')[_0xe3ea('0x6e')](_0xe3ea('0x80'),_0xe3ea('0x6b'))[_0xe3ea('0x6e')]('ci.OrderBY','OrderBy')[_0xe3ea('0x6e')]('\x27'+_0x60b1c6+'\x27','createdAt')['field']('\x27'+_0x60b1c6+'\x27',_0xe3ea('0x52'))[_0xe3ea('0x73')](_0xe3ea('0x81'),'ci')[_0xe3ea('0x82')](_0xe3ea('0x69'),'h',_0xe3ea('0x83'))[_0xe3ea('0x3f')](_0xe3ea('0x84'),_0x4d049d[_0xe3ea('0x70')]['toString']())[_0xe3ea('0x3f')](_0xe3ea('0x85'),_0x37460d['params']['id'][_0xe3ea('0x71')]())[_0xe3ea('0x3f')](_0xe3ea('0x86'),_0x60b1c6))[_0xe3ea('0x71')]();_0x4e290c[_0xe3ea('0x87')](db[_0xe3ea('0x88')][_0xe3ea('0x31')](_0x5bcbb5));_0x213354[_0xe3ea('0x87')](db[_0xe3ea('0x88')]['query'](_0x4d47fe));}return BPromise[_0xe3ea('0x89')](_0x4e290c);}})[_0xe3ea('0x24')](function(){return BPromise[_0xe3ea('0x89')](_0x213354);})['then'](function(){return _0x1976b1;})['then'](respondWithResult(_0x31ebe3,null))[_0xe3ea('0x47')](handleError(_0x31ebe3,null));};exports[_0xe3ea('0x8a')]=function(_0xea359a,_0x3f3898,_0x21cacb){return db[_0xe3ea('0x2b')][_0xe3ea('0x4c')]({'where':{'id':_0xea359a[_0xe3ea('0x45')]['id']}})['then'](handleEntityNotFound(_0x3f3898,null))[_0xe3ea('0x24')](function(_0x429f99){if(_0x429f99){return _0x429f99[_0xe3ea('0x8a')](_0xea359a[_0xe3ea('0x31')][_0xe3ea('0x63')]);}})[_0xe3ea('0x24')](function(_0x3cf978){if(_0x3cf978){return db[_0xe3ea('0x57')][_0xe3ea('0x23')]({'where':{'ListId':_0xea359a[_0xe3ea('0x31')][_0xe3ea('0x63')],'CampaignId':_0xea359a['params']['id']}})[_0xe3ea('0x24')](function(){return _0x3cf978;});}})[_0xe3ea('0x24')](respondWithStatusCode(_0x3f3898,null))[_0xe3ea('0x47')](handleError(_0x3f3898,null));};exports[_0xe3ea('0x8b')]=function(_0xebff0e,_0x261e81,_0x1a324c){var _0x2c01e4={};var _0x14f238={};var _0x248eaf;var _0x382bb3;return db[_0xe3ea('0x2b')][_0xe3ea('0x5a')]({'where':{'id':_0xebff0e['params']['id']}})[_0xe3ea('0x24')](handleEntityNotFound(_0x261e81,null))[_0xe3ea('0x24')](function(_0x43daa3){if(_0x43daa3){_0x248eaf=_0x43daa3;_0x14f238[_0xe3ea('0x35')]=_['keys'](db[_0xe3ea('0x61')][_0xe3ea('0x2c')]);_0x14f238[_0xe3ea('0x31')]=_[_0xe3ea('0x32')](_0xebff0e['query']);_0x14f238[_0xe3ea('0x33')]=_[_0xe3ea('0x34')](_0x14f238['model'],_0x14f238[_0xe3ea('0x31')]);_0x2c01e4[_0xe3ea('0x37')]=_['intersection'](_0x14f238['model'],qs[_0xe3ea('0x36')](_0xebff0e['query'][_0xe3ea('0x36')]));_0x2c01e4[_0xe3ea('0x37')]=_0x2c01e4[_0xe3ea('0x37')][_0xe3ea('0x46')]?_0x2c01e4['attributes']:_0x14f238['model'];_0x2c01e4[_0xe3ea('0x3a')]=qs[_0xe3ea('0x3b')](_0xebff0e[_0xe3ea('0x31')][_0xe3ea('0x3b')]);_0x2c01e4[_0xe3ea('0x3f')]=qs[_0xe3ea('0x33')](_[_0xe3ea('0x3c')](_0xebff0e[_0xe3ea('0x31')],_0x14f238[_0xe3ea('0x33')]));if(_0xebff0e[_0xe3ea('0x31')][_0xe3ea('0x3d')]){_0x2c01e4['where']=_[_0xe3ea('0x3e')](_0x2c01e4[_0xe3ea('0x3f')],{'$or':_[_0xe3ea('0x2f')](_0x2c01e4[_0xe3ea('0x37')],function(_0x438f72){var _0x3884d7={};_0x3884d7[_0x438f72]={'$like':'%'+_0xebff0e[_0xe3ea('0x31')][_0xe3ea('0x3d')]+'%'};return _0x3884d7;})});}_0x2c01e4=_[_0xe3ea('0x3e')]({},_0x2c01e4,_0xebff0e[_0xe3ea('0x41')]);return _0x248eaf[_0xe3ea('0x8b')](_0x2c01e4);}})[_0xe3ea('0x24')](function(_0x4f81dc){if(_0x4f81dc){_0x382bb3=_0x4f81dc['length'];if(!_0xebff0e[_0xe3ea('0x31')]['hasOwnProperty'](_0xe3ea('0x39'))){_0x2c01e4[_0xe3ea('0x1b')]=qs[_0xe3ea('0x1b')](_0xebff0e[_0xe3ea('0x31')][_0xe3ea('0x1b')]);_0x2c01e4['offset']=qs[_0xe3ea('0x19')](_0xebff0e['query']['offset']);}return _0x248eaf[_0xe3ea('0x8b')](_0x2c01e4);}})[_0xe3ea('0x24')](function(_0x23b4f3){if(_0x23b4f3){return _0x23b4f3?{'count':_0x382bb3,'rows':_0x23b4f3}:null;}})[_0xe3ea('0x24')](respondWithResult(_0x261e81,null))[_0xe3ea('0x47')](handleError(_0x261e81,null));};exports[_0xe3ea('0x8c')]=function(_0x781e37,_0x41ccfa,_0x1e777f){var _0x138376,_0x45057e;var _0x119ad3=[];var _0x283e99=moment()[_0xe3ea('0x8d')](_0xe3ea('0x8e'));return db[_0xe3ea('0x2b')][_0xe3ea('0x4c')]({'where':{'id':_0x781e37['params']['id']}})[_0xe3ea('0x24')](handleEntityNotFound(_0x41ccfa,null))[_0xe3ea('0x24')](function(_0x173591){if(_0x173591){_0x45057e=_0x173591;return _0x173591['addBlackLists'](_0x781e37['body'][_0xe3ea('0x63')],_[_0xe3ea('0x51')](_0x781e37[_0xe3ea('0x48')],[_0xe3ea('0x63'),'id'])||{});}return null;})['spread'](function(_0x253d92){var _0x5aa476;var _0x175447;_0x138376=_0x253d92||[];var _0x3555f2=[];if(_0x253d92){for(var _0x5e2f7b=0x0;_0x5e2f7b<_0x253d92[_0xe3ea('0x46')];_0x5e2f7b+=0x1){var _0x12b9d2=_0x253d92[_0x5e2f7b][_0xe3ea('0x25')]({'plain':!![]});_0x5aa476=squel['insert']()[_0xe3ea('0x68')](_0xe3ea('0x8f'))[_0xe3ea('0x6a')]([_0xe3ea('0x6b'),_0xe3ea('0x6d'),_0xe3ea('0x72'),_0xe3ea('0x58'),_0xe3ea('0x53'),_0xe3ea('0x52')],squel[_0xe3ea('0x77')]()[_0xe3ea('0x6e')]('phone',_0xe3ea('0x6b'))[_0xe3ea('0x6e')]('id','ContactId')[_0xe3ea('0x6e')](_0x12b9d2[_0xe3ea('0x70')]['toString'](),'ListId')[_0xe3ea('0x6e')](_0x781e37[_0xe3ea('0x45')]['id'][_0xe3ea('0x71')](),_0xe3ea('0x58'))['field'](_0xe3ea('0x6f'),'createdAt')[_0xe3ea('0x6e')](_0xe3ea('0x6f'),_0xe3ea('0x52'))[_0xe3ea('0x73')](_0xe3ea('0x74'))[_0xe3ea('0x3f')](_0xe3ea('0x75'))[_0xe3ea('0x3f')](_0xe3ea('0x7c'),_0x12b9d2[_0xe3ea('0x70')][_0xe3ea('0x71')]())['where'](_0xe3ea('0x7d')))[_0xe3ea('0x71')]();_0x3555f2[_0xe3ea('0x87')](db[_0xe3ea('0x88')][_0xe3ea('0x31')](_0x5aa476));}return BPromise[_0xe3ea('0x89')](_0x3555f2);}})[_0xe3ea('0x24')](function(){return _0x138376;})[_0xe3ea('0x24')](respondWithResult(_0x41ccfa,null))['catch'](handleError(_0x41ccfa,null));};exports[_0xe3ea('0x90')]=function(_0x10968c,_0x2a5311,_0xd55366){return db['Campaign'][_0xe3ea('0x4c')]({'where':{'id':_0x10968c[_0xe3ea('0x45')]['id']}})[_0xe3ea('0x24')](handleEntityNotFound(_0x2a5311,null))[_0xe3ea('0x24')](function(_0x41832f){if(_0x41832f){return _0x41832f[_0xe3ea('0x90')](_0x10968c[_0xe3ea('0x31')][_0xe3ea('0x63')]);}})[_0xe3ea('0x24')](function(_0x3da549){if(_0x3da549){return db[_0xe3ea('0x5f')][_0xe3ea('0x23')]({'where':{'ListId':_0x10968c[_0xe3ea('0x31')]['ids'],'CampaignId':_0x10968c['params']['id']}})[_0xe3ea('0x24')](function(){return _0x3da549;});}})['then'](respondWithStatusCode(_0x2a5311,null))[_0xe3ea('0x47')](handleError(_0x2a5311,null));}; \ No newline at end of file +var _0x6623=['hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','catch','params','includeAll','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','omit','createdAt','updatedAt','role','UserProfileSection','destroy','getHoppers','findOne','CmHopper','nolimit','CampaignId','findAll','rows','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','ListId','select','field','phone','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','insert','scheduledAt','ContactId','NOW()','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','map','Campaign','rawAttributes','type','key','model','query','keys','intersection','attributes','fields'];(function(_0x5dbc62,_0x33dc1e){var _0x37f5f8=function(_0xde34d7){while(--_0xde34d7){_0x5dbc62['push'](_0x5dbc62['shift']());}};_0x37f5f8(++_0x33dc1e);}(_0x6623,0x189));var _0x3662=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x6623[_0x20c9b2];return _0x2c6030;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3662('0x0'));var zipdir=require(_0x3662('0x1'));var jsonpatch=require(_0x3662('0x2'));var rp=require(_0x3662('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3662('0x4'));var util=require(_0x3662('0x5'));var path=require(_0x3662('0x6'));var sox=require(_0x3662('0x7'));var csv=require(_0x3662('0x8'));var ejs=require(_0x3662('0x9'));var fs=require('fs');var fs_extra=require(_0x3662('0xa'));var _=require(_0x3662('0xb'));var squel=require(_0x3662('0xc'));var crypto=require('crypto');var jsforce=require(_0x3662('0xd'));var deskjs=require(_0x3662('0xe'));var toCsv=require(_0x3662('0x8'));var querystring=require(_0x3662('0xf'));var Papa=require('papaparse');var Redis=require(_0x3662('0x10'));var authService=require(_0x3662('0x11'));var qs=require(_0x3662('0x12'));var as=require(_0x3662('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3662('0x14'))(_0x3662('0x15'));var utils=require(_0x3662('0x16'));var config=require(_0x3662('0x17'));var licenseUtil=require(_0x3662('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x103af7,_0x1cb650){_0x1cb650=_0x1cb650||0xcc;return function(_0x175741){if(_0x175741){return _0x103af7[_0x3662('0x19')](_0x1cb650);}return _0x103af7[_0x3662('0x1a')](_0x1cb650)[_0x3662('0x1b')]();};}function respondWithResult(_0x37df24,_0x260a2f){_0x260a2f=_0x260a2f||0xc8;return function(_0x371002){if(_0x371002){return _0x37df24[_0x3662('0x1a')](_0x260a2f)[_0x3662('0x1c')](_0x371002);}};}function respondWithFilteredResult(_0x55e908,_0x5ee56e){return function(_0x21cf90){if(_0x21cf90){var _0x550f90=typeof _0x5ee56e[_0x3662('0x1d')]===_0x3662('0x1e')&&typeof _0x5ee56e[_0x3662('0x1f')]==='undefined';var _0x315176=_0x21cf90['count'];var _0x2b5cc1=_0x550f90?0x0:_0x5ee56e['offset'];var _0x276d72=_0x550f90?_0x21cf90[_0x3662('0x20')]:_0x5ee56e[_0x3662('0x1d')]+_0x5ee56e[_0x3662('0x1f')];var _0x117c71;if(_0x276d72>=_0x315176){_0x276d72=_0x315176;_0x117c71=0xc8;}else{_0x117c71=0xce;}_0x55e908[_0x3662('0x1a')](_0x117c71);return _0x55e908['set'](_0x3662('0x21'),_0x2b5cc1+'-'+_0x276d72+'/'+_0x315176)[_0x3662('0x1c')](_0x21cf90);}return null;};}function patchUpdates(_0x43eeb6){return function(_0x4e9daf){try{jsonpatch['apply'](_0x4e9daf,_0x43eeb6,!![]);}catch(_0x162e84){return BPromise[_0x3662('0x22')](_0x162e84);}return _0x4e9daf[_0x3662('0x23')]();};}function saveUpdates(_0x3ff917,_0x51dacc){return function(_0x8c8fe8){if(_0x8c8fe8){return _0x8c8fe8[_0x3662('0x24')](_0x3ff917)[_0x3662('0x25')](function(_0x391f85){return _0x391f85;});}return null;};}function removeEntity(_0x72fa0f,_0x5eb0b4){return function(_0x3a82e8){if(_0x3a82e8){return _0x3a82e8['destroy']()[_0x3662('0x25')](function(){var _0x49084a=_0x3a82e8[_0x3662('0x26')]({'plain':!![]});var _0x441cfc=_0x3662('0x27');return db[_0x3662('0x28')]['destroy']({'where':{'type':_0x441cfc,'resourceId':_0x49084a['id']}})[_0x3662('0x25')](function(){return _0x3a82e8;});})[_0x3662('0x25')](function(){_0x72fa0f[_0x3662('0x1a')](0xcc)[_0x3662('0x1b')]();});}};}function handleEntityNotFound(_0x1e690e,_0x37e6d0){return function(_0x866d1e){if(!_0x866d1e){_0x1e690e[_0x3662('0x19')](0x194);}return _0x866d1e;};}function handleError(_0x987f40,_0xd31735){_0xd31735=_0xd31735||0x1f4;return function(_0x5ed766){logger[_0x3662('0x29')](_0x5ed766[_0x3662('0x2a')]);if(_0x5ed766['name']){delete _0x5ed766[_0x3662('0x2b')];}_0x987f40['status'](_0xd31735)[_0x3662('0x2c')](_0x5ed766);};}exports[_0x3662('0x2d')]=function(_0x4e7715,_0x2b6e35){var _0x4b91aa={},_0x3c7fc7={},_0x2eaddb={'count':0x0,'rows':[]};var _0x1f955a=_[_0x3662('0x2e')](db[_0x3662('0x2f')][_0x3662('0x30')],function(_0x1ae64b){return{'name':_0x1ae64b['fieldName'],'type':_0x1ae64b[_0x3662('0x31')][_0x3662('0x32')]};});_0x3c7fc7[_0x3662('0x33')]=_[_0x3662('0x2e')](_0x1f955a,'name');_0x3c7fc7[_0x3662('0x34')]=_[_0x3662('0x35')](_0x4e7715['query']);_0x3c7fc7['filters']=_[_0x3662('0x36')](_0x3c7fc7[_0x3662('0x33')],_0x3c7fc7[_0x3662('0x34')]);_0x4b91aa[_0x3662('0x37')]=_['intersection'](_0x3c7fc7[_0x3662('0x33')],qs[_0x3662('0x38')](_0x4e7715[_0x3662('0x34')]['fields']));_0x4b91aa['attributes']=_0x4b91aa['attributes']['length']?_0x4b91aa['attributes']:_0x3c7fc7[_0x3662('0x33')];if(!_0x4e7715['query'][_0x3662('0x39')]('nolimit')){_0x4b91aa[_0x3662('0x1f')]=qs[_0x3662('0x1f')](_0x4e7715[_0x3662('0x34')][_0x3662('0x1f')]);_0x4b91aa[_0x3662('0x1d')]=qs[_0x3662('0x1d')](_0x4e7715[_0x3662('0x34')][_0x3662('0x1d')]);}_0x4b91aa[_0x3662('0x3a')]=qs[_0x3662('0x3b')](_0x4e7715[_0x3662('0x34')]['sort']);_0x4b91aa[_0x3662('0x3c')]=qs['filters'](_[_0x3662('0x3d')](_0x4e7715[_0x3662('0x34')],_0x3c7fc7[_0x3662('0x3e')]),_0x1f955a);if(_0x4e7715[_0x3662('0x34')][_0x3662('0x3f')]){_0x4b91aa[_0x3662('0x3c')]=_[_0x3662('0x40')](_0x4b91aa['where'],{'$or':_[_0x3662('0x2e')](_0x1f955a,function(_0x35601a){if(_0x35601a[_0x3662('0x31')]!==_0x3662('0x41')){var _0x2a1656={};_0x2a1656[_0x35601a[_0x3662('0x2b')]]={'$like':'%'+_0x4e7715[_0x3662('0x34')][_0x3662('0x3f')]+'%'};return _0x2a1656;}})});}_0x4b91aa=_[_0x3662('0x40')]({},_0x4b91aa,_0x4e7715[_0x3662('0x42')]);var _0x3448c8={'where':_0x4b91aa[_0x3662('0x3c')]};return db[_0x3662('0x2f')][_0x3662('0x20')](_0x3448c8)['then'](function(_0x525cd1){_0x2eaddb[_0x3662('0x20')]=_0x525cd1;if(_0x4e7715[_0x3662('0x34')]['includeAll']){_0x4b91aa[_0x3662('0x43')]=[{'all':!![]}];}return db[_0x3662('0x2f')]['findAll'](_0x4b91aa);})[_0x3662('0x25')](function(_0x3acfeb){_0x2eaddb['rows']=_0x3acfeb;return _0x2eaddb;})[_0x3662('0x25')](respondWithFilteredResult(_0x2b6e35,_0x4b91aa))[_0x3662('0x44')](handleError(_0x2b6e35,null));};exports['show']=function(_0x17cf2a,_0x3cfa42){var _0x4b7a16={'raw':![],'where':{'id':_0x17cf2a[_0x3662('0x45')]['id']}},_0x222b4c={};_0x222b4c['model']=_[_0x3662('0x35')](db['Campaign'][_0x3662('0x30')]);_0x222b4c[_0x3662('0x34')]=_[_0x3662('0x35')](_0x17cf2a[_0x3662('0x34')]);_0x222b4c[_0x3662('0x3e')]=_[_0x3662('0x36')](_0x222b4c[_0x3662('0x33')],_0x222b4c[_0x3662('0x34')]);_0x4b7a16[_0x3662('0x37')]=_['intersection'](_0x222b4c['model'],qs[_0x3662('0x38')](_0x17cf2a[_0x3662('0x34')][_0x3662('0x38')]));_0x4b7a16[_0x3662('0x37')]=_0x4b7a16[_0x3662('0x37')]['length']?_0x4b7a16[_0x3662('0x37')]:_0x222b4c[_0x3662('0x33')];if(_0x17cf2a['query'][_0x3662('0x46')]){_0x4b7a16[_0x3662('0x43')]=[{'all':!![]}];}_0x4b7a16=_[_0x3662('0x40')]({},_0x4b7a16,_0x17cf2a['options']);return db['Campaign'][_0x3662('0x47')](_0x4b7a16)['then'](handleEntityNotFound(_0x3cfa42,null))['then'](respondWithResult(_0x3cfa42,null))[_0x3662('0x44')](handleError(_0x3cfa42,null));};exports['create']=function(_0xd2691,_0x515355){return db[_0x3662('0x2f')]['create'](_0xd2691[_0x3662('0x48')],{})[_0x3662('0x25')](function(_0x2b70ec){var _0x3352ae=_0xd2691[_0x3662('0x49')][_0x3662('0x26')]({'plain':!![]});if(!_0x3352ae)throw new Error(_0x3662('0x4a'));if(_0x3352ae['role']==='user'){var _0x7bada1=_0x2b70ec[_0x3662('0x26')]({'plain':!![]});var _0x4202cc='IvrCampaigns';return db['UserProfileSection'][_0x3662('0x47')]({'where':{'name':_0x4202cc,'userProfileId':_0x3352ae[_0x3662('0x4b')]},'raw':!![]})[_0x3662('0x25')](function(_0x2760a8){if(_0x2760a8&&_0x2760a8[_0x3662('0x4c')]===0x0){return db[_0x3662('0x28')][_0x3662('0x4d')]({'name':_0x7bada1['name'],'resourceId':_0x7bada1['id'],'type':_0x2760a8[_0x3662('0x2b')],'sectionId':_0x2760a8['id']},{})[_0x3662('0x25')](function(){return _0x2b70ec;});}else{return _0x2b70ec;}})['catch'](function(_0x139de3){logger['error'](_0x3662('0x4e'),_0x139de3);throw _0x139de3;});}return _0x2b70ec;})[_0x3662('0x25')](respondWithResult(_0x515355,0xc9))['catch'](handleError(_0x515355,null));};exports[_0x3662('0x4f')]=function(_0x5a13b2,_0x4722ae){var _0x515350={'where':{'id':_0x5a13b2['params']['id']}},_0x1ea570={};_0x1ea570[_0x3662('0x33')]=_['keys'](db[_0x3662('0x2f')][_0x3662('0x30')]);_0x515350['attributes']=_['intersection'](_0x1ea570[_0x3662('0x33')],qs[_0x3662('0x38')](_0x5a13b2['query'][_0x3662('0x38')]));_0x515350[_0x3662('0x37')]=_0x515350[_0x3662('0x37')][_0x3662('0x50')]?_0x515350[_0x3662('0x37')]:_0x1ea570[_0x3662('0x33')];if(_0x5a13b2[_0x3662('0x34')]['includeAll']){_0x515350[_0x3662('0x43')]=[{'all':!![]}];}_0x515350=_[_0x3662('0x40')]({},_0x515350,_0x5a13b2['options']);return db[_0x3662('0x2f')][_0x3662('0x47')](_0x515350)[_0x3662('0x25')](handleEntityNotFound(_0x4722ae,null))[_0x3662('0x25')](function(_0x56f076){if(_0x56f076){var _0x3a60ee=_0x56f076[_0x3662('0x26')]({'plain':!![]});_0x3a60ee=qs[_0x3662('0x51')](_0x3a60ee,['id',_0x3662('0x52'),_0x3662('0x53')]);_0x5a13b2[_0x3662('0x48')]=_['omit'](_0x5a13b2['body'],['id','createdAt',_0x3662('0x53')]);return db[_0x3662('0x2f')]['create'](_[_0x3662('0x40')](_0x3a60ee,_0x5a13b2[_0x3662('0x48')]),{'include':_0x5a13b2[_0x3662('0x34')][_0x3662('0x46')]?[{'all':!![]}]:undefined})[_0x3662('0x25')](function(_0x566c3a){var _0x57a89e=_0x5a13b2['user']['get']({'plain':!![]});if(!_0x57a89e)throw new Error(_0x3662('0x4a'));if(_0x57a89e[_0x3662('0x54')]===_0x3662('0x49')){var _0x41c30a=_0x566c3a[_0x3662('0x26')]({'plain':!![]});var _0xce3f05=_0x3662('0x27');return db[_0x3662('0x55')][_0x3662('0x47')]({'where':{'name':_0xce3f05,'userProfileId':_0x57a89e[_0x3662('0x4b')]},'raw':!![]})[_0x3662('0x25')](function(_0xdff2cb){if(_0xdff2cb&&_0xdff2cb[_0x3662('0x4c')]===0x0){return db[_0x3662('0x28')][_0x3662('0x4d')]({'name':_0x41c30a[_0x3662('0x2b')],'resourceId':_0x41c30a['id'],'type':_0xdff2cb[_0x3662('0x2b')],'sectionId':_0xdff2cb['id']},{})[_0x3662('0x25')](function(){return _0x566c3a;});}else{return _0x566c3a;}})['catch'](function(_0xe1abe3){logger[_0x3662('0x29')](_0x3662('0x4e'),_0xe1abe3);throw _0xe1abe3;});}return _0x566c3a;});}})[_0x3662('0x25')](respondWithResult(_0x4722ae,0xc9))['catch'](handleError(_0x4722ae,null));};exports[_0x3662('0x24')]=function(_0x551c0a,_0x2472b3){if(_0x551c0a[_0x3662('0x48')]['id']){delete _0x551c0a[_0x3662('0x48')]['id'];}return db[_0x3662('0x2f')][_0x3662('0x47')]({'where':{'id':_0x551c0a[_0x3662('0x45')]['id']}})[_0x3662('0x25')](handleEntityNotFound(_0x2472b3,null))[_0x3662('0x25')](saveUpdates(_0x551c0a[_0x3662('0x48')],null))[_0x3662('0x25')](respondWithResult(_0x2472b3,null))[_0x3662('0x44')](handleError(_0x2472b3,null));};exports[_0x3662('0x56')]=function(_0x2e0006,_0x523f9d){return db[_0x3662('0x2f')][_0x3662('0x47')]({'where':{'id':_0x2e0006[_0x3662('0x45')]['id']}})[_0x3662('0x25')](handleEntityNotFound(_0x523f9d,null))[_0x3662('0x25')](removeEntity(_0x523f9d,null))['catch'](handleError(_0x523f9d,null));};exports[_0x3662('0x57')]=function(_0x1e0dcb,_0x5895e6,_0x3feb18){var _0x529842={'raw':!![],'where':{}};var _0x2ee32c={};var _0x10f080={'count':0x0,'rows':[]};return db[_0x3662('0x2f')][_0x3662('0x58')]({'where':{'id':_0x1e0dcb[_0x3662('0x45')]['id']}})['then'](handleEntityNotFound(_0x5895e6,null))[_0x3662('0x25')](function(_0x3101b5){if(_0x3101b5){_0x2ee32c[_0x3662('0x33')]=_['keys'](db[_0x3662('0x59')]['rawAttributes']);_0x2ee32c[_0x3662('0x34')]=_[_0x3662('0x35')](_0x1e0dcb['query']);_0x2ee32c[_0x3662('0x3e')]=_[_0x3662('0x36')](_0x2ee32c[_0x3662('0x33')],_0x2ee32c[_0x3662('0x34')]);_0x529842[_0x3662('0x37')]=_['intersection'](_0x2ee32c[_0x3662('0x33')],qs[_0x3662('0x38')](_0x1e0dcb[_0x3662('0x34')][_0x3662('0x38')]));_0x529842[_0x3662('0x37')]=_0x529842[_0x3662('0x37')][_0x3662('0x50')]?_0x529842[_0x3662('0x37')]:_0x2ee32c[_0x3662('0x33')];if(!_0x1e0dcb['query']['hasOwnProperty'](_0x3662('0x5a'))){_0x529842[_0x3662('0x1f')]=qs[_0x3662('0x1f')](_0x1e0dcb['query'][_0x3662('0x1f')]);_0x529842[_0x3662('0x1d')]=qs[_0x3662('0x1d')](_0x1e0dcb[_0x3662('0x34')][_0x3662('0x1d')]);}_0x529842[_0x3662('0x3a')]=qs['sort'](_0x1e0dcb[_0x3662('0x34')][_0x3662('0x3b')]);_0x529842[_0x3662('0x3c')]=qs[_0x3662('0x3e')](_[_0x3662('0x3d')](_0x1e0dcb[_0x3662('0x34')],_0x2ee32c['filters']));_0x529842['where'][_0x3662('0x5b')]=_0x3101b5['id'];if(_0x1e0dcb[_0x3662('0x34')]['filter']){_0x529842['where']=_[_0x3662('0x40')](_0x529842[_0x3662('0x3c')],{'$or':_[_0x3662('0x2e')](_0x529842['attributes'],function(_0x368c23){var _0x1e4582={};_0x1e4582[_0x368c23]={'$like':'%'+_0x1e0dcb['query'][_0x3662('0x3f')]+'%'};return _0x1e4582;})});}_0x529842=_[_0x3662('0x40')]({},_0x529842,_0x1e0dcb[_0x3662('0x42')]);return db[_0x3662('0x59')][_0x3662('0x20')]({'where':_0x529842[_0x3662('0x3c')]})[_0x3662('0x25')](function(_0x3fb3fe){_0x10f080[_0x3662('0x20')]=_0x3fb3fe;if(_0x1e0dcb[_0x3662('0x34')]['includeAll']){_0x529842[_0x3662('0x43')]=[{'all':!![]}];}return db[_0x3662('0x59')][_0x3662('0x5c')](_0x529842);})[_0x3662('0x25')](function(_0x508a2f){_0x10f080[_0x3662('0x5d')]=_0x508a2f;return _0x10f080;});}})['then'](respondWithFilteredResult(_0x5895e6,_0x529842))[_0x3662('0x44')](handleError(_0x5895e6,null));};exports[_0x3662('0x5e')]=function(_0x1bf6bd,_0x58bb88,_0x5a902f){var _0x2c5e27={'raw':!![],'where':{}};var _0x3e7d6a={};var _0x21a2e5={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x1bf6bd[_0x3662('0x45')]['id']}})[_0x3662('0x25')](handleEntityNotFound(_0x58bb88,null))['then'](function(_0x4b1108){if(_0x4b1108){_0x3e7d6a[_0x3662('0x33')]=_[_0x3662('0x35')](db[_0x3662('0x5f')][_0x3662('0x30')]);_0x3e7d6a[_0x3662('0x34')]=_[_0x3662('0x35')](_0x1bf6bd['query']);_0x3e7d6a[_0x3662('0x3e')]=_[_0x3662('0x36')](_0x3e7d6a['model'],_0x3e7d6a[_0x3662('0x34')]);_0x2c5e27[_0x3662('0x37')]=_[_0x3662('0x36')](_0x3e7d6a[_0x3662('0x33')],qs['fields'](_0x1bf6bd['query'][_0x3662('0x38')]));_0x2c5e27[_0x3662('0x37')]=_0x2c5e27[_0x3662('0x37')][_0x3662('0x50')]?_0x2c5e27[_0x3662('0x37')]:_0x3e7d6a[_0x3662('0x33')];if(!_0x1bf6bd['query'][_0x3662('0x39')](_0x3662('0x5a'))){_0x2c5e27[_0x3662('0x1f')]=qs[_0x3662('0x1f')](_0x1bf6bd[_0x3662('0x34')][_0x3662('0x1f')]);_0x2c5e27[_0x3662('0x1d')]=qs[_0x3662('0x1d')](_0x1bf6bd[_0x3662('0x34')][_0x3662('0x1d')]);}_0x2c5e27[_0x3662('0x3a')]=qs[_0x3662('0x3b')](_0x1bf6bd[_0x3662('0x34')][_0x3662('0x3b')]);_0x2c5e27['where']=qs['filters'](_[_0x3662('0x3d')](_0x1bf6bd['query'],_0x3e7d6a[_0x3662('0x3e')]));_0x2c5e27[_0x3662('0x3c')][_0x3662('0x5b')]=_0x4b1108['id'];if(_0x1bf6bd[_0x3662('0x34')][_0x3662('0x3f')]){_0x2c5e27[_0x3662('0x3c')]=_[_0x3662('0x40')](_0x2c5e27[_0x3662('0x3c')],{'$or':_[_0x3662('0x2e')](_0x2c5e27[_0x3662('0x37')],function(_0x325d04){var _0x13054c={};_0x13054c[_0x325d04]={'$like':'%'+_0x1bf6bd[_0x3662('0x34')][_0x3662('0x3f')]+'%'};return _0x13054c;})});}_0x2c5e27=_[_0x3662('0x40')]({},_0x2c5e27,_0x1bf6bd[_0x3662('0x42')]);return db[_0x3662('0x5f')]['count']({'where':_0x2c5e27[_0x3662('0x3c')]})[_0x3662('0x25')](function(_0x1c50a5){_0x21a2e5[_0x3662('0x20')]=_0x1c50a5;if(_0x1bf6bd[_0x3662('0x34')][_0x3662('0x46')]){_0x2c5e27[_0x3662('0x43')]=[{'all':!![]}];}return db[_0x3662('0x5f')]['findAll'](_0x2c5e27);})[_0x3662('0x25')](function(_0x1131f4){_0x21a2e5[_0x3662('0x5d')]=_0x1131f4;return _0x21a2e5;});}})['then'](respondWithFilteredResult(_0x58bb88,_0x2c5e27))[_0x3662('0x44')](handleError(_0x58bb88,null));};exports['getHopperFinals']=function(_0x29b418,_0x94aea3,_0xa98143){var _0x3bf90d={'raw':!![],'where':{}};var _0x3b5ed4={};var _0x5c1479={'count':0x0,'rows':[]};return db['Campaign'][_0x3662('0x58')]({'where':{'id':_0x29b418['params']['id']}})[_0x3662('0x25')](handleEntityNotFound(_0x94aea3,null))['then'](function(_0x1b32e0){if(_0x1b32e0){_0x3b5ed4[_0x3662('0x33')]=_[_0x3662('0x35')](db[_0x3662('0x60')][_0x3662('0x30')]);_0x3b5ed4[_0x3662('0x34')]=_[_0x3662('0x35')](_0x29b418[_0x3662('0x34')]);_0x3b5ed4[_0x3662('0x3e')]=_[_0x3662('0x36')](_0x3b5ed4[_0x3662('0x33')],_0x3b5ed4[_0x3662('0x34')]);_0x3bf90d[_0x3662('0x37')]=_[_0x3662('0x36')](_0x3b5ed4[_0x3662('0x33')],qs[_0x3662('0x38')](_0x29b418[_0x3662('0x34')]['fields']));_0x3bf90d[_0x3662('0x37')]=_0x3bf90d[_0x3662('0x37')]['length']?_0x3bf90d[_0x3662('0x37')]:_0x3b5ed4[_0x3662('0x33')];if(!_0x29b418[_0x3662('0x34')][_0x3662('0x39')]('nolimit')){_0x3bf90d[_0x3662('0x1f')]=qs[_0x3662('0x1f')](_0x29b418[_0x3662('0x34')][_0x3662('0x1f')]);_0x3bf90d[_0x3662('0x1d')]=qs[_0x3662('0x1d')](_0x29b418[_0x3662('0x34')][_0x3662('0x1d')]);}_0x3bf90d[_0x3662('0x3a')]=qs[_0x3662('0x3b')](_0x29b418[_0x3662('0x34')][_0x3662('0x3b')]);_0x3bf90d['where']=qs[_0x3662('0x3e')](_[_0x3662('0x3d')](_0x29b418['query'],_0x3b5ed4[_0x3662('0x3e')]));_0x3bf90d[_0x3662('0x3c')]['CampaignId']=_0x1b32e0['id'];if(_0x29b418['query'][_0x3662('0x3f')]){_0x3bf90d[_0x3662('0x3c')]=_[_0x3662('0x40')](_0x3bf90d[_0x3662('0x3c')],{'$or':_[_0x3662('0x2e')](_0x3bf90d[_0x3662('0x37')],function(_0x3d7b5a){var _0x4c76a0={};_0x4c76a0[_0x3d7b5a]={'$like':'%'+_0x29b418[_0x3662('0x34')][_0x3662('0x3f')]+'%'};return _0x4c76a0;})});}_0x3bf90d=_[_0x3662('0x40')]({},_0x3bf90d,_0x29b418[_0x3662('0x42')]);return db[_0x3662('0x60')][_0x3662('0x20')]({'where':_0x3bf90d['where']})[_0x3662('0x25')](function(_0x2708db){_0x5c1479[_0x3662('0x20')]=_0x2708db;if(_0x29b418[_0x3662('0x34')]['includeAll']){_0x3bf90d[_0x3662('0x43')]=[{'all':!![]}];}return db[_0x3662('0x60')][_0x3662('0x5c')](_0x3bf90d);})[_0x3662('0x25')](function(_0x2174d6){_0x5c1479['rows']=_0x2174d6;return _0x5c1479;});}})['then'](respondWithFilteredResult(_0x94aea3,_0x3bf90d))[_0x3662('0x44')](handleError(_0x94aea3,null));};exports[_0x3662('0x61')]=function(_0x302c74,_0x1556fb,_0x2ffc11){var _0x4aac66={'raw':!![],'where':{}};var _0xd2e92c={};var _0x1ac8c3={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x302c74[_0x3662('0x45')]['id']}})[_0x3662('0x25')](handleEntityNotFound(_0x1556fb,null))[_0x3662('0x25')](function(_0x25cf5b){if(_0x25cf5b){_0xd2e92c[_0x3662('0x33')]=_[_0x3662('0x35')](db[_0x3662('0x62')][_0x3662('0x30')]);_0xd2e92c['query']=_['keys'](_0x302c74[_0x3662('0x34')]);_0xd2e92c['filters']=_[_0x3662('0x36')](_0xd2e92c[_0x3662('0x33')],_0xd2e92c['query']);_0x4aac66[_0x3662('0x37')]=_[_0x3662('0x36')](_0xd2e92c['model'],qs[_0x3662('0x38')](_0x302c74[_0x3662('0x34')]['fields']));_0x4aac66[_0x3662('0x37')]=_0x4aac66[_0x3662('0x37')][_0x3662('0x50')]?_0x4aac66[_0x3662('0x37')]:_0xd2e92c[_0x3662('0x33')];if(!_0x302c74[_0x3662('0x34')]['hasOwnProperty'](_0x3662('0x5a'))){_0x4aac66[_0x3662('0x1f')]=qs[_0x3662('0x1f')](_0x302c74[_0x3662('0x34')][_0x3662('0x1f')]);_0x4aac66[_0x3662('0x1d')]=qs['offset'](_0x302c74['query'][_0x3662('0x1d')]);}_0x4aac66[_0x3662('0x3a')]=qs['sort'](_0x302c74[_0x3662('0x34')][_0x3662('0x3b')]);_0x4aac66[_0x3662('0x3c')]=qs['filters'](_[_0x3662('0x3d')](_0x302c74[_0x3662('0x34')],_0xd2e92c[_0x3662('0x3e')]));_0x4aac66['where'][_0x3662('0x5b')]=_0x25cf5b['id'];if(_0x302c74[_0x3662('0x34')]['filter']){_0x4aac66[_0x3662('0x3c')]=_[_0x3662('0x40')](_0x4aac66[_0x3662('0x3c')],{'$or':_[_0x3662('0x2e')](_0x4aac66['attributes'],function(_0xec6c7a){var _0x2ec337={};_0x2ec337[_0xec6c7a]={'$like':'%'+_0x302c74[_0x3662('0x34')]['filter']+'%'};return _0x2ec337;})});}_0x4aac66=_[_0x3662('0x40')]({},_0x4aac66,_0x302c74[_0x3662('0x42')]);return db[_0x3662('0x62')][_0x3662('0x20')]({'where':_0x4aac66[_0x3662('0x3c')]})[_0x3662('0x25')](function(_0x1ab78c){_0x1ac8c3[_0x3662('0x20')]=_0x1ab78c;if(_0x302c74[_0x3662('0x34')][_0x3662('0x46')]){_0x4aac66['include']=[{'all':!![]}];}return db[_0x3662('0x62')][_0x3662('0x5c')](_0x4aac66);})['then'](function(_0x1bd24d){_0x1ac8c3[_0x3662('0x5d')]=_0x1bd24d;return _0x1ac8c3;});}})['then'](respondWithFilteredResult(_0x1556fb,_0x4aac66))[_0x3662('0x44')](handleError(_0x1556fb,null));};exports[_0x3662('0x63')]=function(_0xed7bbc,_0x27bb17,_0x42a053){var _0x5e958c={};var _0x58492a={};var _0xc0489;var _0x238cc5;return db[_0x3662('0x2f')][_0x3662('0x58')]({'where':{'id':_0xed7bbc[_0x3662('0x45')]['id']}})[_0x3662('0x25')](handleEntityNotFound(_0x27bb17,null))[_0x3662('0x25')](function(_0x368d1f){if(_0x368d1f){_0xc0489=_0x368d1f;_0x58492a[_0x3662('0x33')]=_[_0x3662('0x35')](db[_0x3662('0x64')]['rawAttributes']);_0x58492a[_0x3662('0x34')]=_[_0x3662('0x35')](_0xed7bbc[_0x3662('0x34')]);_0x58492a[_0x3662('0x3e')]=_[_0x3662('0x36')](_0x58492a[_0x3662('0x33')],_0x58492a['query']);_0x5e958c[_0x3662('0x37')]=_[_0x3662('0x36')](_0x58492a[_0x3662('0x33')],qs[_0x3662('0x38')](_0xed7bbc[_0x3662('0x34')]['fields']));_0x5e958c[_0x3662('0x37')]=_0x5e958c[_0x3662('0x37')]['length']?_0x5e958c['attributes']:_0x58492a['model'];_0x5e958c[_0x3662('0x3a')]=qs[_0x3662('0x3b')](_0xed7bbc[_0x3662('0x34')][_0x3662('0x3b')]);_0x5e958c[_0x3662('0x3c')]=qs[_0x3662('0x3e')](_[_0x3662('0x3d')](_0xed7bbc['query'],_0x58492a[_0x3662('0x3e')]));if(_0xed7bbc['query'][_0x3662('0x3f')]){_0x5e958c['where']=_[_0x3662('0x40')](_0x5e958c[_0x3662('0x3c')],{'$or':_['map'](_0x5e958c[_0x3662('0x37')],function(_0x486e64){var _0x482d6e={};_0x482d6e[_0x486e64]={'$like':'%'+_0xed7bbc[_0x3662('0x34')][_0x3662('0x3f')]+'%'};return _0x482d6e;})});}_0x5e958c=_['merge']({},_0x5e958c,_0xed7bbc[_0x3662('0x42')]);return _0xc0489[_0x3662('0x63')](_0x5e958c);}})['then'](function(_0x1b32bd){if(_0x1b32bd){_0x238cc5=_0x1b32bd[_0x3662('0x50')];if(!_0xed7bbc['query'][_0x3662('0x39')](_0x3662('0x5a'))){_0x5e958c[_0x3662('0x1f')]=qs['limit'](_0xed7bbc[_0x3662('0x34')][_0x3662('0x1f')]);_0x5e958c['offset']=qs[_0x3662('0x1d')](_0xed7bbc[_0x3662('0x34')][_0x3662('0x1d')]);}return _0xc0489[_0x3662('0x63')](_0x5e958c);}})[_0x3662('0x25')](function(_0x268bc9){if(_0x268bc9){return _0x268bc9?{'count':_0x238cc5,'rows':_0x268bc9}:null;}})[_0x3662('0x25')](respondWithResult(_0x27bb17,null))['catch'](handleError(_0x27bb17,null));};exports[_0x3662('0x65')]=function(_0x41aec4,_0x4e1185,_0x278428){var _0x1423e9,_0x5bf91d;var _0x6ff429=[];var _0xa48eab=moment()[_0x3662('0x66')](_0x3662('0x67'));return db[_0x3662('0x2f')][_0x3662('0x47')]({'where':{'id':_0x41aec4['params']['id']}})['then'](handleEntityNotFound(_0x4e1185,null))[_0x3662('0x25')](function(_0x3dfa57){if(_0x3dfa57){_0x5bf91d=_0x3dfa57;return _0x3dfa57[_0x3662('0x65')](_0x41aec4[_0x3662('0x48')][_0x3662('0x68')],_[_0x3662('0x51')](_0x41aec4[_0x3662('0x48')],[_0x3662('0x68'),'id'])||{});}return null;})[_0x3662('0x69')](function(_0x2d9fca){var _0x58b950;var _0x2b3eac;_0x1423e9=_0x2d9fca||[];var _0x49a166=[];if(_0x2d9fca){for(var _0x4e2944=0x0;_0x4e2944<_0x2d9fca[_0x3662('0x50')];_0x4e2944+=0x1){var _0x297a02=_0x2d9fca[_0x4e2944]['get']({'plain':!![]});_0x5bf91d[_0x3662('0x6a')]=_0x41aec4[_0x3662('0x48')][_0x3662('0x6a')]?_0x41aec4[_0x3662('0x48')]['dialCheckDuplicateType']:_0x5bf91d['dialCheckDuplicateType'];switch(_0x5bf91d[_0x3662('0x6a')]){case _0x3662('0x6b'):_0x58b950=squel['insert']()[_0x3662('0x6c')](_0x3662('0x6d'))[_0x3662('0x6e')](['phone','scheduledAt','ContactId',_0x3662('0x6f'),_0x3662('0x5b'),_0x3662('0x52'),'updatedAt'],squel[_0x3662('0x70')]()[_0x3662('0x71')](_0x3662('0x72'),_0x3662('0x72'))[_0x3662('0x71')]('NOW()','scheduledAt')[_0x3662('0x71')]('id','ContactId')[_0x3662('0x71')](_0x297a02[_0x3662('0x73')][_0x3662('0x74')](),_0x3662('0x6f'))['field'](_0x41aec4[_0x3662('0x45')]['id']['toString'](),_0x3662('0x5b'))['field']('\x27'+_0xa48eab+'\x27',_0x3662('0x52'))[_0x3662('0x71')]('\x27'+_0xa48eab+'\x27',_0x3662('0x53'))[_0x3662('0x75')](_0x3662('0x76'))[_0x3662('0x3c')](_0x3662('0x77'))['where'](_0x3662('0x78'),_0x297a02[_0x3662('0x73')]['toString']())[_0x3662('0x3c')](_0x3662('0x79'))[_0x3662('0x3c')](_0x3662('0x7a'),squel[_0x3662('0x70')]()[_0x3662('0x71')](_0x3662('0x7b'))[_0x3662('0x75')](_0x3662('0x7c'))[_0x3662('0x3c')](_0x3662('0x7d'),_0x41aec4[_0x3662('0x45')]['id'][_0x3662('0x74')]()))[_0x3662('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3662('0x70')]()[_0x3662('0x71')]('COALESCE(phone,\x27\x27)')['from'](_0x3662('0x6d'))[_0x3662('0x3c')](_0x3662('0x7d'),_0x41aec4[_0x3662('0x45')]['id'][_0x3662('0x74')]())))['toString']();break;case _0x3662('0x7e'):_0x58b950=squel[_0x3662('0x7f')]()[_0x3662('0x6c')](_0x3662('0x6d'))[_0x3662('0x6e')]([_0x3662('0x72'),_0x3662('0x80'),_0x3662('0x81'),'ListId',_0x3662('0x5b'),'createdAt',_0x3662('0x53')],squel[_0x3662('0x70')]()[_0x3662('0x71')](_0x3662('0x72'),_0x3662('0x72'))[_0x3662('0x71')](_0x3662('0x82'),_0x3662('0x80'))[_0x3662('0x71')]('id',_0x3662('0x81'))[_0x3662('0x71')](_0x297a02['CmListId'][_0x3662('0x74')](),_0x3662('0x6f'))[_0x3662('0x71')](_0x41aec4['params']['id']['toString'](),_0x3662('0x5b'))[_0x3662('0x71')]('\x27'+_0xa48eab+'\x27',_0x3662('0x52'))[_0x3662('0x71')]('\x27'+_0xa48eab+'\x27','updatedAt')[_0x3662('0x75')]('cm_contacts')['where'](_0x3662('0x77'))['where']('ListId\x20=\x20?',_0x297a02[_0x3662('0x73')]['toString']())[_0x3662('0x3c')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x3662('0x70')]()['field']('COALESCE(phone,\x27\x27)')[_0x3662('0x75')](_0x3662('0x6d'))[_0x3662('0x3c')]('CampaignId\x20=\x20?',_0x41aec4['params']['id'][_0x3662('0x74')]())))[_0x3662('0x74')]();break;default:_0x58b950=squel[_0x3662('0x7f')]()['into'](_0x3662('0x6d'))[_0x3662('0x6e')]([_0x3662('0x72'),_0x3662('0x80'),_0x3662('0x81'),_0x3662('0x6f'),_0x3662('0x5b'),_0x3662('0x52'),_0x3662('0x53')],squel['select']()[_0x3662('0x71')](_0x3662('0x72'),'phone')[_0x3662('0x71')](_0x3662('0x82'),_0x3662('0x80'))[_0x3662('0x71')]('id',_0x3662('0x81'))[_0x3662('0x71')](_0x297a02[_0x3662('0x73')][_0x3662('0x74')](),_0x3662('0x6f'))[_0x3662('0x71')](_0x41aec4[_0x3662('0x45')]['id'][_0x3662('0x74')](),_0x3662('0x5b'))[_0x3662('0x71')]('\x27'+_0xa48eab+'\x27',_0x3662('0x52'))[_0x3662('0x71')]('\x27'+_0xa48eab+'\x27','updatedAt')['from'](_0x3662('0x76'))[_0x3662('0x3c')]('deletedAt\x20IS\x20NULL')[_0x3662('0x3c')]('ListId\x20=\x20?',_0x297a02['CmListId'][_0x3662('0x74')]())[_0x3662('0x3c')](_0x3662('0x79')))['toString']();}_0x2b3eac=squel[_0x3662('0x7f')]()[_0x3662('0x6c')](_0x3662('0x83'))[_0x3662('0x6e')]([_0x3662('0x84'),_0x3662('0x80'),_0x3662('0x72'),_0x3662('0x85'),'createdAt',_0x3662('0x53')],squel[_0x3662('0x70')]()[_0x3662('0x71')](_0x3662('0x86'),'id')[_0x3662('0x71')]('NOW()','scheduledAt')['field'](_0x3662('0x87'),_0x3662('0x72'))[_0x3662('0x71')]('ci.OrderBY',_0x3662('0x85'))[_0x3662('0x71')]('\x27'+_0xa48eab+'\x27','createdAt')['field']('\x27'+_0xa48eab+'\x27',_0x3662('0x53'))[_0x3662('0x75')](_0x3662('0x88'),'ci')[_0x3662('0x89')](_0x3662('0x6d'),'h',_0x3662('0x8a'))[_0x3662('0x3c')](_0x3662('0x8b'),_0x297a02[_0x3662('0x73')][_0x3662('0x74')]())['where'](_0x3662('0x8c'),_0x41aec4['params']['id'][_0x3662('0x74')]())[_0x3662('0x3c')](_0x3662('0x8d'),_0xa48eab))[_0x3662('0x74')]();_0x49a166['push'](db['sequelize']['query'](_0x58b950));_0x6ff429[_0x3662('0x8e')](db[_0x3662('0x8f')][_0x3662('0x34')](_0x2b3eac));}return BPromise[_0x3662('0x90')](_0x49a166);}})[_0x3662('0x25')](function(){return BPromise[_0x3662('0x90')](_0x6ff429);})['then'](function(){return _0x1423e9;})['then'](respondWithResult(_0x4e1185,null))[_0x3662('0x44')](handleError(_0x4e1185,null));};exports[_0x3662('0x91')]=function(_0x1b4863,_0x4c6952,_0xc948d8){return db[_0x3662('0x2f')][_0x3662('0x47')]({'where':{'id':_0x1b4863['params']['id']}})[_0x3662('0x25')](handleEntityNotFound(_0x4c6952,null))[_0x3662('0x25')](function(_0x520675){if(_0x520675){return _0x520675[_0x3662('0x91')](_0x1b4863[_0x3662('0x34')][_0x3662('0x68')]);}})[_0x3662('0x25')](function(_0x6fa251){if(_0x6fa251){return db[_0x3662('0x59')][_0x3662('0x56')]({'where':{'ListId':_0x1b4863[_0x3662('0x34')][_0x3662('0x68')],'CampaignId':_0x1b4863[_0x3662('0x45')]['id']}})[_0x3662('0x25')](function(){return _0x6fa251;});}})['then'](respondWithStatusCode(_0x4c6952,null))[_0x3662('0x44')](handleError(_0x4c6952,null));};exports[_0x3662('0x92')]=function(_0x22f444,_0x2109d6,_0x2d92f3){var _0x13fc6c={};var _0x57708a={};var _0x2e80ae;var _0x244193;return db[_0x3662('0x2f')]['findOne']({'where':{'id':_0x22f444[_0x3662('0x45')]['id']}})[_0x3662('0x25')](handleEntityNotFound(_0x2109d6,null))[_0x3662('0x25')](function(_0x1f985c){if(_0x1f985c){_0x2e80ae=_0x1f985c;_0x57708a[_0x3662('0x33')]=_[_0x3662('0x35')](db[_0x3662('0x64')][_0x3662('0x30')]);_0x57708a['query']=_['keys'](_0x22f444[_0x3662('0x34')]);_0x57708a[_0x3662('0x3e')]=_[_0x3662('0x36')](_0x57708a['model'],_0x57708a[_0x3662('0x34')]);_0x13fc6c['attributes']=_['intersection'](_0x57708a[_0x3662('0x33')],qs['fields'](_0x22f444[_0x3662('0x34')]['fields']));_0x13fc6c[_0x3662('0x37')]=_0x13fc6c[_0x3662('0x37')][_0x3662('0x50')]?_0x13fc6c[_0x3662('0x37')]:_0x57708a[_0x3662('0x33')];_0x13fc6c[_0x3662('0x3a')]=qs[_0x3662('0x3b')](_0x22f444[_0x3662('0x34')][_0x3662('0x3b')]);_0x13fc6c[_0x3662('0x3c')]=qs[_0x3662('0x3e')](_[_0x3662('0x3d')](_0x22f444['query'],_0x57708a['filters']));if(_0x22f444[_0x3662('0x34')]['filter']){_0x13fc6c['where']=_[_0x3662('0x40')](_0x13fc6c[_0x3662('0x3c')],{'$or':_[_0x3662('0x2e')](_0x13fc6c[_0x3662('0x37')],function(_0x4d1d23){var _0xc8d041={};_0xc8d041[_0x4d1d23]={'$like':'%'+_0x22f444[_0x3662('0x34')][_0x3662('0x3f')]+'%'};return _0xc8d041;})});}_0x13fc6c=_['merge']({},_0x13fc6c,_0x22f444[_0x3662('0x42')]);return _0x2e80ae['getBlackLists'](_0x13fc6c);}})[_0x3662('0x25')](function(_0x5751b5){if(_0x5751b5){_0x244193=_0x5751b5[_0x3662('0x50')];if(!_0x22f444[_0x3662('0x34')][_0x3662('0x39')](_0x3662('0x5a'))){_0x13fc6c['limit']=qs[_0x3662('0x1f')](_0x22f444[_0x3662('0x34')][_0x3662('0x1f')]);_0x13fc6c[_0x3662('0x1d')]=qs[_0x3662('0x1d')](_0x22f444[_0x3662('0x34')][_0x3662('0x1d')]);}return _0x2e80ae['getBlackLists'](_0x13fc6c);}})[_0x3662('0x25')](function(_0x493512){if(_0x493512){return _0x493512?{'count':_0x244193,'rows':_0x493512}:null;}})[_0x3662('0x25')](respondWithResult(_0x2109d6,null))[_0x3662('0x44')](handleError(_0x2109d6,null));};exports['addBlackLists']=function(_0x1c42b7,_0x3f5cee,_0x70280e){var _0x17c310,_0x14491f;var _0x7e3450=[];var _0x463747=moment()[_0x3662('0x66')](_0x3662('0x67'));return db['Campaign'][_0x3662('0x47')]({'where':{'id':_0x1c42b7['params']['id']}})[_0x3662('0x25')](handleEntityNotFound(_0x3f5cee,null))[_0x3662('0x25')](function(_0x550c78){if(_0x550c78){_0x14491f=_0x550c78;return _0x550c78[_0x3662('0x93')](_0x1c42b7['body']['ids'],_['omit'](_0x1c42b7[_0x3662('0x48')],[_0x3662('0x68'),'id'])||{});}return null;})[_0x3662('0x69')](function(_0x297800){var _0x4d2727;var _0x22151f;_0x17c310=_0x297800||[];var _0x244404=[];if(_0x297800){for(var _0x526ead=0x0;_0x526ead<_0x297800[_0x3662('0x50')];_0x526ead+=0x1){var _0x51fe2b=_0x297800[_0x526ead][_0x3662('0x26')]({'plain':!![]});_0x4d2727=squel[_0x3662('0x7f')]()[_0x3662('0x6c')](_0x3662('0x94'))[_0x3662('0x6e')]([_0x3662('0x72'),_0x3662('0x81'),_0x3662('0x6f'),_0x3662('0x5b'),'createdAt',_0x3662('0x53')],squel[_0x3662('0x70')]()[_0x3662('0x71')](_0x3662('0x72'),_0x3662('0x72'))[_0x3662('0x71')]('id',_0x3662('0x81'))['field'](_0x51fe2b[_0x3662('0x73')]['toString'](),'ListId')[_0x3662('0x71')](_0x1c42b7[_0x3662('0x45')]['id'][_0x3662('0x74')](),_0x3662('0x5b'))[_0x3662('0x71')](_0x3662('0x82'),_0x3662('0x52'))[_0x3662('0x71')](_0x3662('0x82'),'updatedAt')[_0x3662('0x75')](_0x3662('0x76'))['where'](_0x3662('0x77'))[_0x3662('0x3c')](_0x3662('0x78'),_0x51fe2b[_0x3662('0x73')][_0x3662('0x74')]())[_0x3662('0x3c')](_0x3662('0x79')))[_0x3662('0x74')]();_0x244404[_0x3662('0x8e')](db[_0x3662('0x8f')][_0x3662('0x34')](_0x4d2727));}return BPromise['all'](_0x244404);}})[_0x3662('0x25')](function(){return _0x17c310;})[_0x3662('0x25')](respondWithResult(_0x3f5cee,null))[_0x3662('0x44')](handleError(_0x3f5cee,null));};exports[_0x3662('0x95')]=function(_0x248f54,_0x5567a4,_0x1db37d){return db[_0x3662('0x2f')][_0x3662('0x47')]({'where':{'id':_0x248f54['params']['id']}})[_0x3662('0x25')](handleEntityNotFound(_0x5567a4,null))['then'](function(_0x5f5677){if(_0x5f5677){return _0x5f5677[_0x3662('0x95')](_0x248f54['query'][_0x3662('0x68')]);}})[_0x3662('0x25')](function(_0x2451b9){if(_0x2451b9){return db[_0x3662('0x62')][_0x3662('0x56')]({'where':{'ListId':_0x248f54[_0x3662('0x34')][_0x3662('0x68')],'CampaignId':_0x248f54[_0x3662('0x45')]['id']}})[_0x3662('0x25')](function(){return _0x2451b9;});}})['then'](respondWithStatusCode(_0x5567a4,null))[_0x3662('0x44')](handleError(_0x5567a4,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 75a0419..35b882a 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_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':'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 379cad7..ad78ae5 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 _0x9086=['model','then','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x332755,_0x52b4dd){var _0x170bcf=function(_0x1a1410){while(--_0x1a1410){_0x332755['push'](_0x332755['shift']());}};_0x170bcf(++_0x52b4dd);}(_0x9086,0x10b));var _0x6908=function(_0x3f29bc,_0x102fa1){_0x3f29bc=_0x3f29bc-0x0;var _0x253de9=_0x9086[_0x3f29bc];return _0x253de9;};'use strict';var _=require(_0x6908('0x0'));var util=require(_0x6908('0x1'));var moment=require('moment');var BPromise=require(_0x6908('0x2'));var rs=require(_0x6908('0x3'));var fs=require('fs');var Redis=require(_0x6908('0x4'));var db=require(_0x6908('0x5'))['db'];var utils=require(_0x6908('0x6'));var logger=require(_0x6908('0x7'))('rpc');var config=require(_0x6908('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6908('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e8ff0,_0xd81571,_0x2049a1){return new BPromise(function(_0x2ce577,_0x56df93){return client[_0x6908('0xa')](_0x4e8ff0,_0x2049a1)['then'](function(_0x1efa71){logger['info'](_0x6908('0xb'),_0xd81571,_0x6908('0xc'));logger[_0x6908('0xd')](_0x6908('0xe'),_0xd81571,_0x6908('0xc'),JSON['stringify'](_0x1efa71));if(_0x1efa71[_0x6908('0xf')]){if(_0x1efa71[_0x6908('0xf')][_0x6908('0x10')]===0x1f4){logger[_0x6908('0xf')](_0x6908('0xb'),_0xd81571,_0x1efa71[_0x6908('0xf')][_0x6908('0x11')]);return _0x56df93(_0x1efa71[_0x6908('0xf')][_0x6908('0x11')]);}logger['error'](_0x6908('0xb'),_0xd81571,_0x1efa71['error'][_0x6908('0x11')]);return _0x2ce577(_0x1efa71[_0x6908('0xf')]['message']);}else{logger[_0x6908('0x12')](_0x6908('0xb'),_0xd81571,_0x6908('0xc'));_0x2ce577(_0x1efa71[_0x6908('0x13')][_0x6908('0x11')]);}})['catch'](function(_0x538ad1){logger[_0x6908('0xf')](_0x6908('0xb'),_0xd81571,_0x538ad1);_0x56df93(_0x538ad1);});});}exports[_0x6908('0x14')]=function(_0x4e8ea3){var _0x3418ee=this;return new Promise(function(_0x5e8253,_0x3b175d){return db[_0x6908('0x15')][_0x6908('0x16')]({'raw':_0x4e8ea3['options']?_0x4e8ea3[_0x6908('0x17')][_0x6908('0x18')]===undefined?!![]:![]:!![],'where':_0x4e8ea3['options']?_0x4e8ea3[_0x6908('0x17')][_0x6908('0x19')]||null:null,'attributes':_0x4e8ea3[_0x6908('0x17')]?_0x4e8ea3[_0x6908('0x17')][_0x6908('0x1a')]||null:null,'limit':_0x4e8ea3[_0x6908('0x17')]?_0x4e8ea3[_0x6908('0x17')][_0x6908('0x1b')]||null:null,'include':_0x4e8ea3[_0x6908('0x17')]?_0x4e8ea3[_0x6908('0x17')][_0x6908('0x1c')]?_[_0x6908('0x1d')](_0x4e8ea3[_0x6908('0x17')][_0x6908('0x1c')],function(_0x312231){return{'model':db[_0x312231[_0x6908('0x1e')]],'as':_0x312231['as'],'attributes':_0x312231[_0x6908('0x1a')],'include':_0x312231[_0x6908('0x1c')]?_[_0x6908('0x1d')](_0x312231['include'],function(_0x363dc6){return{'model':db[_0x363dc6[_0x6908('0x1e')]],'as':_0x363dc6['as'],'attributes':_0x363dc6['attributes'],'include':_0x363dc6[_0x6908('0x1c')]?_['map'](_0x363dc6['include'],function(_0xb8c62){return{'model':db[_0xb8c62[_0x6908('0x1e')]],'as':_0xb8c62['as'],'attributes':_0xb8c62[_0x6908('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6908('0x1f')](function(_0x362ce7){logger[_0x6908('0x12')](_0x6908('0x14'),_0x4e8ea3);logger[_0x6908('0xd')](_0x6908('0x14'),_0x4e8ea3,JSON['stringify'](_0x362ce7));_0x5e8253(_0x362ce7);})[_0x6908('0x20')](function(_0x315234){logger[_0x6908('0xf')](_0x6908('0x14'),_0x315234['message'],_0x4e8ea3);_0x3b175d(_0x3418ee['error'](0x1f4,_0x315234[_0x6908('0x11')]));});});}; \ No newline at end of file +var _0x8d97=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','map','include','model','util','moment'];(function(_0x1cc060,_0x1afbdc){var _0x5c7e10=function(_0x15e8d6){while(--_0x15e8d6){_0x1cc060['push'](_0x1cc060['shift']());}};_0x5c7e10(++_0x1afbdc);}(_0x8d97,0x82));var _0x78d9=function(_0x2e44d3,_0x570fed){_0x2e44d3=_0x2e44d3-0x0;var _0x123a84=_0x8d97[_0x2e44d3];return _0x123a84;};'use strict';var _=require('lodash');var util=require(_0x78d9('0x0'));var moment=require(_0x78d9('0x1'));var BPromise=require('bluebird');var rs=require(_0x78d9('0x2'));var fs=require('fs');var Redis=require(_0x78d9('0x3'));var db=require(_0x78d9('0x4'))['db'];var utils=require(_0x78d9('0x5'));var logger=require(_0x78d9('0x6'))('rpc');var config=require(_0x78d9('0x7'));var jayson=require(_0x78d9('0x8'));var client=jayson[_0x78d9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d1934,_0x5b9602,_0x2a2cdb){return new BPromise(function(_0x3b3709,_0x36b8f5){return client[_0x78d9('0xa')](_0x4d1934,_0x2a2cdb)[_0x78d9('0xb')](function(_0x14ca4e){logger['info'](_0x78d9('0xc'),_0x5b9602,_0x78d9('0xd'));logger[_0x78d9('0xe')]('Campaign,\x20%s,\x20%s,\x20%s',_0x5b9602,'request\x20sent',JSON[_0x78d9('0xf')](_0x14ca4e));if(_0x14ca4e[_0x78d9('0x10')]){if(_0x14ca4e[_0x78d9('0x10')][_0x78d9('0x11')]===0x1f4){logger[_0x78d9('0x10')](_0x78d9('0xc'),_0x5b9602,_0x14ca4e['error'][_0x78d9('0x12')]);return _0x36b8f5(_0x14ca4e[_0x78d9('0x10')][_0x78d9('0x12')]);}logger[_0x78d9('0x10')](_0x78d9('0xc'),_0x5b9602,_0x14ca4e[_0x78d9('0x10')][_0x78d9('0x12')]);return _0x3b3709(_0x14ca4e[_0x78d9('0x10')][_0x78d9('0x12')]);}else{logger[_0x78d9('0x13')](_0x78d9('0xc'),_0x5b9602,_0x78d9('0xd'));_0x3b3709(_0x14ca4e[_0x78d9('0x14')][_0x78d9('0x12')]);}})[_0x78d9('0x15')](function(_0x156981){logger[_0x78d9('0x10')]('Campaign,\x20%s,\x20%s',_0x5b9602,_0x156981);_0x36b8f5(_0x156981);});});}exports[_0x78d9('0x16')]=function(_0x3b4dde){var _0x36f1e4=this;return new Promise(function(_0x8d0153,_0x43ea59){return db[_0x78d9('0x17')][_0x78d9('0x18')]({'raw':_0x3b4dde[_0x78d9('0x19')]?_0x3b4dde[_0x78d9('0x19')][_0x78d9('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b4dde[_0x78d9('0x19')]?_0x3b4dde[_0x78d9('0x19')][_0x78d9('0x1b')]||null:null,'attributes':_0x3b4dde[_0x78d9('0x19')]?_0x3b4dde[_0x78d9('0x19')][_0x78d9('0x1c')]||null:null,'limit':_0x3b4dde['options']?_0x3b4dde[_0x78d9('0x19')][_0x78d9('0x1d')]||null:null,'include':_0x3b4dde[_0x78d9('0x19')]?_0x3b4dde[_0x78d9('0x19')]['include']?_[_0x78d9('0x1e')](_0x3b4dde[_0x78d9('0x19')][_0x78d9('0x1f')],function(_0x51549d){return{'model':db[_0x51549d['model']],'as':_0x51549d['as'],'attributes':_0x51549d[_0x78d9('0x1c')],'include':_0x51549d['include']?_['map'](_0x51549d['include'],function(_0x28b7e1){return{'model':db[_0x28b7e1[_0x78d9('0x20')]],'as':_0x28b7e1['as'],'attributes':_0x28b7e1[_0x78d9('0x1c')],'include':_0x28b7e1[_0x78d9('0x1f')]?_[_0x78d9('0x1e')](_0x28b7e1[_0x78d9('0x1f')],function(_0x4e87cf){return{'model':db[_0x4e87cf[_0x78d9('0x20')]],'as':_0x4e87cf['as'],'attributes':_0x4e87cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x78d9('0xb')](function(_0x3d9a53){logger[_0x78d9('0x13')]('GetCampaign',_0x3b4dde);logger[_0x78d9('0xe')](_0x78d9('0x16'),_0x3b4dde,JSON['stringify'](_0x3d9a53));_0x8d0153(_0x3d9a53);})['catch'](function(_0x55617c){logger['error'](_0x78d9('0x16'),_0x55617c[_0x78d9('0x12')],_0x3b4dde);_0x43ea59(_0x36f1e4[_0x78d9('0x10')](0x1f4,_0x55617c[_0x78d9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index b53f0ee..f213c4c 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 _0x0c4c=['create','/:id/clone','clone','addLists','put','/:id','destroy','removeLists','delete','removeBlackLists','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/lists','getLists','/:id/blacklists','getBlackLists','post'];(function(_0x54cc48,_0x394001){var _0x5d0ab8=function(_0xc4c08c){while(--_0xc4c08c){_0x54cc48['push'](_0x54cc48['shift']());}};_0x5d0ab8(++_0x394001);}(_0x0c4c,0x102));var _0xc0c4=function(_0x20d65b,_0x536a6b){_0x20d65b=_0x20d65b-0x0;var _0x47c591=_0x0c4c[_0x20d65b];return _0x47c591;};'use strict';var multer=require(_0xc0c4('0x0'));var util=require(_0xc0c4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc0c4('0x2'));var router=express[_0xc0c4('0x3')]();var fs_extra=require(_0xc0c4('0x4'));var auth=require(_0xc0c4('0x5'));var interaction=require(_0xc0c4('0x6'));var config=require(_0xc0c4('0x7'));var controller=require(_0xc0c4('0x8'));router[_0xc0c4('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xc0c4('0xa')](),controller[_0xc0c4('0xb')]);router[_0xc0c4('0x9')](_0xc0c4('0xc'),auth[_0xc0c4('0xa')](),controller['getHoppers']);router[_0xc0c4('0x9')](_0xc0c4('0xd'),auth[_0xc0c4('0xa')](),controller[_0xc0c4('0xe')]);router[_0xc0c4('0x9')](_0xc0c4('0xf'),auth[_0xc0c4('0xa')](),controller['getHopperFinals']);router[_0xc0c4('0x9')]('/:id/hopper_black',auth[_0xc0c4('0xa')](),controller['getHopperBlacks']);router['get'](_0xc0c4('0x10'),auth[_0xc0c4('0xa')](),controller[_0xc0c4('0x11')]);router[_0xc0c4('0x9')](_0xc0c4('0x12'),auth[_0xc0c4('0xa')](),controller[_0xc0c4('0x13')]);router[_0xc0c4('0x14')]('/',auth[_0xc0c4('0xa')](),controller[_0xc0c4('0x15')]);router[_0xc0c4('0x14')](_0xc0c4('0x16'),auth[_0xc0c4('0xa')](),controller[_0xc0c4('0x17')]);router[_0xc0c4('0x14')](_0xc0c4('0x10'),auth[_0xc0c4('0xa')](),controller[_0xc0c4('0x18')]);router[_0xc0c4('0x14')](_0xc0c4('0x12'),auth['isAuthenticated'](),controller['addBlackLists']);router[_0xc0c4('0x19')](_0xc0c4('0x1a'),auth[_0xc0c4('0xa')](),controller['update']);router['delete']('/:id',auth[_0xc0c4('0xa')](),controller[_0xc0c4('0x1b')]);router['delete'](_0xc0c4('0x10'),auth[_0xc0c4('0xa')](),controller[_0xc0c4('0x1c')]);router[_0xc0c4('0x1d')](_0xc0c4('0x12'),auth[_0xc0c4('0xa')](),controller[_0xc0c4('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x605e=['connect-timeout','express','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','index','show','get','/:id/hoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addBlackLists','put','/:id','update','delete','destroy','/:id/lists','removeLists','removeBlackLists','exports','multer','util'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x605e,0x1b8));var _0xe605=function(_0x496166,_0x4ec1a0){_0x496166=_0x496166-0x0;var _0x36d05f=_0x605e[_0x496166];return _0x36d05f;};'use strict';var multer=require(_0xe605('0x0'));var util=require(_0xe605('0x1'));var path=require('path');var timeout=require(_0xe605('0x2'));var express=require(_0xe605('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe605('0x4'));var config=require(_0xe605('0x5'));var controller=require(_0xe605('0x6'));router['get']('/',auth[_0xe605('0x7')](),controller[_0xe605('0x8')]);router['get']('/:id',auth[_0xe605('0x7')](),controller[_0xe605('0x9')]);router[_0xe605('0xa')](_0xe605('0xb'),auth[_0xe605('0x7')](),controller['getHoppers']);router[_0xe605('0xa')](_0xe605('0xc'),auth[_0xe605('0x7')](),controller[_0xe605('0xd')]);router[_0xe605('0xa')]('/:id/hopper_finals',auth[_0xe605('0x7')](),controller[_0xe605('0xe')]);router[_0xe605('0xa')](_0xe605('0xf'),auth[_0xe605('0x7')](),controller[_0xe605('0x10')]);router[_0xe605('0xa')]('/:id/lists',auth[_0xe605('0x7')](),controller[_0xe605('0x11')]);router[_0xe605('0xa')](_0xe605('0x12'),auth[_0xe605('0x7')](),controller[_0xe605('0x13')]);router['post']('/',auth[_0xe605('0x7')](),controller[_0xe605('0x14')]);router[_0xe605('0x15')](_0xe605('0x16'),auth[_0xe605('0x7')](),controller[_0xe605('0x17')]);router[_0xe605('0x15')]('/:id/lists',auth[_0xe605('0x7')](),controller['addLists']);router['post']('/:id/blacklists',auth[_0xe605('0x7')](),controller[_0xe605('0x18')]);router[_0xe605('0x19')](_0xe605('0x1a'),auth[_0xe605('0x7')](),controller[_0xe605('0x1b')]);router[_0xe605('0x1c')]('/:id',auth[_0xe605('0x7')](),controller[_0xe605('0x1d')]);router[_0xe605('0x1c')](_0xe605('0x1e'),auth['isAuthenticated'](),controller[_0xe605('0x1f')]);router[_0xe605('0x1c')](_0xe605('0x12'),auth['isAuthenticated'](),controller[_0xe605('0x20')]);module[_0xe605('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 7af844c..ed3bf0c 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 _0x1ad6=['STRING','TEXT','VIRTUAL','getDataValue','sequelize'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x1ad6,0x19e));var _0x61ad=function(_0x438d19,_0x155268){_0x438d19=_0x438d19-0x0;var _0x17b4b0=_0x1ad6[_0x438d19];return _0x17b4b0;};'use strict';var Sequelize=require(_0x61ad('0x0'));module['exports']={'key':{'type':Sequelize[_0x61ad('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x61ad('0x2')],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0x61ad('0x1')]},'name':{'type':Sequelize[_0x61ad('0x3')],'get':function(){return this[_0x61ad('0x4')]('key');}}}; \ No newline at end of file +var _0x8cb6=['medium','VIRTUAL','getDataValue','sequelize','exports','TEXT'];(function(_0xb74c89,_0x246040){var _0xe4ccef=function(_0x12b652){while(--_0x12b652){_0xb74c89['push'](_0xb74c89['shift']());}};_0xe4ccef(++_0x246040);}(_0x8cb6,0xff));var _0x68cb=function(_0x32aa68,_0x102e89){_0x32aa68=_0x32aa68-0x0;var _0x292133=_0x8cb6[_0x32aa68];return _0x292133;};'use strict';var Sequelize=require(_0x68cb('0x0'));module[_0x68cb('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x68cb('0x2')],'length':_0x68cb('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x68cb('0x4')],'get':function(){return this[_0x68cb('0x5')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index a4741e7..35116e7 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 _0x04dc=['fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','CannedAnswers','UserProfileResource','end','error','stack','name','send','index','map','CannedAnswer','fieldName','type','key','model','query','keys','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','options','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','bluebird','util','path','sox','to-csv'];(function(_0x40cc36,_0x4d81e6){var _0x3151b5=function(_0x7610a5){while(--_0x7610a5){_0x40cc36['push'](_0x40cc36['shift']());}};_0x3151b5(++_0x4d81e6);}(_0x04dc,0xae));var _0xc04d=function(_0x20edd4,_0x7c30f2){_0x20edd4=_0x20edd4-0x0;var _0xc4a1e4=_0x04dc[_0x20edd4];return _0xc4a1e4;};'use strict';var emlformat=require(_0xc04d('0x0'));var rimraf=require(_0xc04d('0x1'));var zipdir=require(_0xc04d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc04d('0x3'));var Mustache=require('mustache');var util=require(_0xc04d('0x4'));var path=require(_0xc04d('0x5'));var sox=require(_0xc04d('0x6'));var csv=require(_0xc04d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc04d('0x8'));var _=require(_0xc04d('0x9'));var squel=require(_0xc04d('0xa'));var crypto=require('crypto');var jsforce=require(_0xc04d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc04d('0x7'));var querystring=require('querystring');var Papa=require(_0xc04d('0xc'));var Redis=require(_0xc04d('0xd'));var authService=require(_0xc04d('0xe'));var qs=require(_0xc04d('0xf'));var as=require(_0xc04d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc04d('0x11'))(_0xc04d('0x12'));var utils=require(_0xc04d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc04d('0x14'));var db=require(_0xc04d('0x15'))['db'];function respondWithStatusCode(_0x1001d6,_0x55087e){_0x55087e=_0x55087e||0xcc;return function(_0x33fc40){if(_0x33fc40){return _0x1001d6[_0xc04d('0x16')](_0x55087e);}return _0x1001d6[_0xc04d('0x17')](_0x55087e)['end']();};}function respondWithResult(_0x2f689c,_0x5e6bb7){_0x5e6bb7=_0x5e6bb7||0xc8;return function(_0x1df2ea){if(_0x1df2ea){return _0x2f689c[_0xc04d('0x17')](_0x5e6bb7)[_0xc04d('0x18')](_0x1df2ea);}};}function respondWithFilteredResult(_0x4e9ae4,_0x2faaa5){return function(_0x24d2c9){if(_0x24d2c9){var _0x544f10=typeof _0x2faaa5[_0xc04d('0x19')]===_0xc04d('0x1a')&&typeof _0x2faaa5[_0xc04d('0x1b')]===_0xc04d('0x1a');var _0x3bd218=_0x24d2c9[_0xc04d('0x1c')];var _0x34ea61=_0x544f10?0x0:_0x2faaa5[_0xc04d('0x19')];var _0x5c292b=_0x544f10?_0x24d2c9[_0xc04d('0x1c')]:_0x2faaa5['offset']+_0x2faaa5[_0xc04d('0x1b')];var _0x583b94;if(_0x5c292b>=_0x3bd218){_0x5c292b=_0x3bd218;_0x583b94=0xc8;}else{_0x583b94=0xce;}_0x4e9ae4[_0xc04d('0x17')](_0x583b94);return _0x4e9ae4['set'](_0xc04d('0x1d'),_0x34ea61+'-'+_0x5c292b+'/'+_0x3bd218)[_0xc04d('0x18')](_0x24d2c9);}return null;};}function patchUpdates(_0x1437ff){return function(_0x144d2d){try{jsonpatch[_0xc04d('0x1e')](_0x144d2d,_0x1437ff,!![]);}catch(_0x49b750){return BPromise[_0xc04d('0x1f')](_0x49b750);}return _0x144d2d[_0xc04d('0x20')]();};}function saveUpdates(_0x2ff31a,_0x171de9){return function(_0x37c452){if(_0x37c452){return _0x37c452[_0xc04d('0x21')](_0x2ff31a)[_0xc04d('0x22')](function(_0x40f822){return _0x40f822;});}return null;};}function removeEntity(_0x1cacbc,_0x3b29ff){return function(_0x52bc55){if(_0x52bc55){return _0x52bc55[_0xc04d('0x23')]()[_0xc04d('0x22')](function(){var _0x5cd04d=_0x52bc55['get']({'plain':!![]});var _0x114f58=_0xc04d('0x24');return db[_0xc04d('0x25')][_0xc04d('0x23')]({'where':{'type':_0x114f58,'resourceId':_0x5cd04d['id']}})[_0xc04d('0x22')](function(){return _0x52bc55;});})['then'](function(){_0x1cacbc[_0xc04d('0x17')](0xcc)[_0xc04d('0x26')]();});}};}function handleEntityNotFound(_0x5e81a6,_0x10c025){return function(_0x9d8cea){if(!_0x9d8cea){_0x5e81a6['sendStatus'](0x194);}return _0x9d8cea;};}function handleError(_0x1e27f1,_0x1e5104){_0x1e5104=_0x1e5104||0x1f4;return function(_0x40675d){logger[_0xc04d('0x27')](_0x40675d[_0xc04d('0x28')]);if(_0x40675d[_0xc04d('0x29')]){delete _0x40675d['name'];}_0x1e27f1[_0xc04d('0x17')](_0x1e5104)[_0xc04d('0x2a')](_0x40675d);};}exports[_0xc04d('0x2b')]=function(_0x323715,_0x2ab22d){var _0x3850f6={},_0x13df2a={},_0x14ca83={'count':0x0,'rows':[]};var _0xa8678c=_[_0xc04d('0x2c')](db[_0xc04d('0x2d')]['rawAttributes'],function(_0x323035){return{'name':_0x323035[_0xc04d('0x2e')],'type':_0x323035[_0xc04d('0x2f')][_0xc04d('0x30')]};});_0x13df2a[_0xc04d('0x31')]=_[_0xc04d('0x2c')](_0xa8678c,_0xc04d('0x29'));_0x13df2a[_0xc04d('0x32')]=_[_0xc04d('0x33')](_0x323715[_0xc04d('0x32')]);_0x13df2a['filters']=_['intersection'](_0x13df2a[_0xc04d('0x31')],_0x13df2a[_0xc04d('0x32')]);_0x3850f6[_0xc04d('0x34')]=_[_0xc04d('0x35')](_0x13df2a['model'],qs['fields'](_0x323715[_0xc04d('0x32')]['fields']));_0x3850f6['attributes']=_0x3850f6[_0xc04d('0x34')][_0xc04d('0x36')]?_0x3850f6[_0xc04d('0x34')]:_0x13df2a['model'];if(!_0x323715[_0xc04d('0x32')][_0xc04d('0x37')](_0xc04d('0x38'))){_0x3850f6[_0xc04d('0x1b')]=qs[_0xc04d('0x1b')](_0x323715[_0xc04d('0x32')][_0xc04d('0x1b')]);_0x3850f6[_0xc04d('0x19')]=qs['offset'](_0x323715[_0xc04d('0x32')][_0xc04d('0x19')]);}_0x3850f6[_0xc04d('0x39')]=qs[_0xc04d('0x3a')](_0x323715[_0xc04d('0x32')][_0xc04d('0x3a')]);_0x3850f6['where']=qs[_0xc04d('0x3b')](_[_0xc04d('0x3c')](_0x323715[_0xc04d('0x32')],_0x13df2a['filters']),_0xa8678c);if(_0x323715[_0xc04d('0x32')]['filter']){_0x3850f6[_0xc04d('0x3d')]=_['merge'](_0x3850f6['where'],{'$or':[{'key':{'$like':'%'+_0x323715[_0xc04d('0x32')][_0xc04d('0x3e')]+'%'}},{'value':{'$like':'%'+_0x323715[_0xc04d('0x32')][_0xc04d('0x3e')]+'%'}}]});}_0x3850f6=_[_0xc04d('0x3f')]({},_0x3850f6,_0x323715['options']);var _0x413032={'where':_0x3850f6[_0xc04d('0x3d')]};return db['CannedAnswer']['count'](_0x413032)['then'](function(_0xf34210){_0x14ca83['count']=_0xf34210;if(_0x323715[_0xc04d('0x32')][_0xc04d('0x40')]){_0x3850f6[_0xc04d('0x41')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc04d('0x42')](_0x3850f6);})[_0xc04d('0x22')](function(_0x4bfbb9){_0x14ca83[_0xc04d('0x43')]=_0x4bfbb9;return _0x14ca83;})['then'](respondWithFilteredResult(_0x2ab22d,_0x3850f6))[_0xc04d('0x44')](handleError(_0x2ab22d,null));};exports[_0xc04d('0x45')]=function(_0x178110,_0x35e5c3){var _0xb85c7f={'raw':!![],'where':{'id':_0x178110[_0xc04d('0x46')]['id']}},_0x40ccb4={};_0x40ccb4[_0xc04d('0x31')]=_[_0xc04d('0x33')](db[_0xc04d('0x2d')][_0xc04d('0x47')]);_0x40ccb4[_0xc04d('0x32')]=_[_0xc04d('0x33')](_0x178110[_0xc04d('0x32')]);_0x40ccb4['filters']=_[_0xc04d('0x35')](_0x40ccb4['model'],_0x40ccb4['query']);_0xb85c7f['attributes']=_[_0xc04d('0x35')](_0x40ccb4[_0xc04d('0x31')],qs[_0xc04d('0x48')](_0x178110[_0xc04d('0x32')][_0xc04d('0x48')]));_0xb85c7f[_0xc04d('0x34')]=_0xb85c7f[_0xc04d('0x34')]['length']?_0xb85c7f['attributes']:_0x40ccb4[_0xc04d('0x31')];if(_0x178110[_0xc04d('0x32')][_0xc04d('0x40')]){_0xb85c7f['include']=[{'all':!![]}];}_0xb85c7f=_['merge']({},_0xb85c7f,_0x178110[_0xc04d('0x49')]);return db[_0xc04d('0x2d')][_0xc04d('0x4a')](_0xb85c7f)['then'](handleEntityNotFound(_0x35e5c3,null))[_0xc04d('0x22')](respondWithResult(_0x35e5c3,null))['catch'](handleError(_0x35e5c3,null));};exports[_0xc04d('0x21')]=function(_0x27e61f,_0x336478){if(_0x27e61f[_0xc04d('0x4b')]['id']){delete _0x27e61f['body']['id'];}return db[_0xc04d('0x2d')][_0xc04d('0x4a')]({'where':{'id':_0x27e61f[_0xc04d('0x46')]['id']}})[_0xc04d('0x22')](handleEntityNotFound(_0x336478,null))[_0xc04d('0x22')](saveUpdates(_0x27e61f['body'],null))[_0xc04d('0x22')](respondWithResult(_0x336478,null))[_0xc04d('0x44')](handleError(_0x336478,null));};exports[_0xc04d('0x23')]=function(_0x273a9a,_0x45467c){return db[_0xc04d('0x2d')][_0xc04d('0x4a')]({'where':{'id':_0x273a9a[_0xc04d('0x46')]['id']}})[_0xc04d('0x22')](handleEntityNotFound(_0x45467c,null))['then'](removeEntity(_0x45467c,null))['catch'](handleError(_0x45467c,null));};exports[_0xc04d('0x4c')]=function(_0x3a2bb6,_0x1ef8bb){var _0x4df2ad={'key':_0x3a2bb6[_0xc04d('0x4b')]['key']};if(_0x3a2bb6[_0xc04d('0x4b')][_0xc04d('0x4d')]){_0x4df2ad[_0xc04d('0x4d')]=_0x3a2bb6[_0xc04d('0x4b')][_0xc04d('0x4d')];}else if(_0x3a2bb6[_0xc04d('0x4b')][_0xc04d('0x4e')]){_0x4df2ad[_0xc04d('0x4e')]=_0x3a2bb6[_0xc04d('0x4b')][_0xc04d('0x4e')];}else if(_0x3a2bb6['body'][_0xc04d('0x4f')]){_0x4df2ad[_0xc04d('0x4f')]=_0x3a2bb6['body'][_0xc04d('0x4f')];}else if(_0x3a2bb6[_0xc04d('0x4b')][_0xc04d('0x50')]){_0x4df2ad[_0xc04d('0x50')]=_0x3a2bb6[_0xc04d('0x4b')][_0xc04d('0x50')];}return db[_0xc04d('0x2d')][_0xc04d('0x4a')]({'where':_0x4df2ad})[_0xc04d('0x22')](function(_0x48d436){if(_0x48d436){throw new db[(_0xc04d('0x51'))]['ValidationError'](_0xc04d('0x52'));}return db['CannedAnswer'][_0xc04d('0x4c')](_0x3a2bb6[_0xc04d('0x4b')]);})[_0xc04d('0x22')](function(_0xffc3a8){var _0x30075a=_0x3a2bb6[_0xc04d('0x53')][_0xc04d('0x54')]({'plain':!![]});if(!_0x30075a)throw new Error(_0xc04d('0x55'));if(_0x30075a[_0xc04d('0x56')]===_0xc04d('0x53')){var _0x157829=_0xffc3a8[_0xc04d('0x54')]({'plain':!![]});return db[_0xc04d('0x57')][_0xc04d('0x4a')]({'where':{'name':_0xc04d('0x24'),'userProfileId':_0x30075a[_0xc04d('0x58')]},'raw':!![]})[_0xc04d('0x22')](function(_0x2f2330){if(_0x2f2330&&_0x2f2330[_0xc04d('0x59')]===0x0){return db[_0xc04d('0x25')][_0xc04d('0x4c')]({'name':_0x157829[_0xc04d('0x29')],'resourceId':_0x157829['id'],'type':_0x2f2330['name'],'sectionId':_0x2f2330['id']},{})[_0xc04d('0x22')](function(){return _0xffc3a8;});}else{return _0xffc3a8;}})[_0xc04d('0x44')](function(_0x2a8088){logger[_0xc04d('0x27')](_0xc04d('0x5a'),_0x2a8088);throw _0x2a8088;});}return _0xffc3a8;})[_0xc04d('0x22')](respondWithResult(_0x1ef8bb,0xc9))[_0xc04d('0x44')](handleError(_0x1ef8bb,null));}; \ No newline at end of file +var _0x5043=['util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','name','send','map','CannedAnswer','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','rawAttributes','options','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x43e2f6,_0x40d666){var _0x59b26d=function(_0x43360d){while(--_0x43360d){_0x43e2f6['push'](_0x43e2f6['shift']());}};_0x59b26d(++_0x40d666);}(_0x5043,0x108));var _0x3504=function(_0x5e9587,_0xac1c87){_0x5e9587=_0x5e9587-0x0;var _0x1c7d40=_0x5043[_0x5e9587];return _0x1c7d40;};'use strict';var emlformat=require(_0x3504('0x0'));var rimraf=require(_0x3504('0x1'));var zipdir=require(_0x3504('0x2'));var jsonpatch=require(_0x3504('0x3'));var rp=require('request-promise');var moment=require(_0x3504('0x4'));var BPromise=require(_0x3504('0x5'));var Mustache=require('mustache');var util=require(_0x3504('0x6'));var path=require(_0x3504('0x7'));var sox=require(_0x3504('0x8'));var csv=require(_0x3504('0x9'));var ejs=require(_0x3504('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3504('0xb'));var squel=require(_0x3504('0xc'));var crypto=require(_0x3504('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3504('0xe'));var Papa=require('papaparse');var Redis=require(_0x3504('0xf'));var authService=require(_0x3504('0x10'));var qs=require(_0x3504('0x11'));var as=require(_0x3504('0x12'));var hardwareService=require(_0x3504('0x13'));var logger=require(_0x3504('0x14'))(_0x3504('0x15'));var utils=require(_0x3504('0x16'));var config=require(_0x3504('0x17'));var licenseUtil=require(_0x3504('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x236eb7,_0x432730){_0x432730=_0x432730||0xcc;return function(_0xb757ff){if(_0xb757ff){return _0x236eb7[_0x3504('0x19')](_0x432730);}return _0x236eb7[_0x3504('0x1a')](_0x432730)[_0x3504('0x1b')]();};}function respondWithResult(_0x496368,_0x6472a2){_0x6472a2=_0x6472a2||0xc8;return function(_0x356d0e){if(_0x356d0e){return _0x496368['status'](_0x6472a2)[_0x3504('0x1c')](_0x356d0e);}};}function respondWithFilteredResult(_0x39a6eb,_0xc2a402){return function(_0x2b7241){if(_0x2b7241){var _0x15e147=typeof _0xc2a402[_0x3504('0x1d')]===_0x3504('0x1e')&&typeof _0xc2a402[_0x3504('0x1f')]===_0x3504('0x1e');var _0x5e84d8=_0x2b7241[_0x3504('0x20')];var _0x127602=_0x15e147?0x0:_0xc2a402[_0x3504('0x1d')];var _0x15cd0f=_0x15e147?_0x2b7241[_0x3504('0x20')]:_0xc2a402['offset']+_0xc2a402[_0x3504('0x1f')];var _0x1cc5d1;if(_0x15cd0f>=_0x5e84d8){_0x15cd0f=_0x5e84d8;_0x1cc5d1=0xc8;}else{_0x1cc5d1=0xce;}_0x39a6eb[_0x3504('0x1a')](_0x1cc5d1);return _0x39a6eb[_0x3504('0x21')](_0x3504('0x22'),_0x127602+'-'+_0x15cd0f+'/'+_0x5e84d8)['json'](_0x2b7241);}return null;};}function patchUpdates(_0x1d72e3){return function(_0x28dc9a){try{jsonpatch[_0x3504('0x23')](_0x28dc9a,_0x1d72e3,!![]);}catch(_0x51a27b){return BPromise[_0x3504('0x24')](_0x51a27b);}return _0x28dc9a[_0x3504('0x25')]();};}function saveUpdates(_0x153bb5,_0x18a501){return function(_0x19daf2){if(_0x19daf2){return _0x19daf2[_0x3504('0x26')](_0x153bb5)[_0x3504('0x27')](function(_0x5032b5){return _0x5032b5;});}return null;};}function removeEntity(_0x579dbd,_0x49f8a8){return function(_0xa1c06f){if(_0xa1c06f){return _0xa1c06f[_0x3504('0x28')]()[_0x3504('0x27')](function(){var _0x5dbf0b=_0xa1c06f[_0x3504('0x29')]({'plain':!![]});var _0x30f1fc=_0x3504('0x2a');return db[_0x3504('0x2b')]['destroy']({'where':{'type':_0x30f1fc,'resourceId':_0x5dbf0b['id']}})[_0x3504('0x27')](function(){return _0xa1c06f;});})[_0x3504('0x27')](function(){_0x579dbd[_0x3504('0x1a')](0xcc)[_0x3504('0x1b')]();});}};}function handleEntityNotFound(_0x39162e,_0x304790){return function(_0x3bad8e){if(!_0x3bad8e){_0x39162e[_0x3504('0x19')](0x194);}return _0x3bad8e;};}function handleError(_0x35823b,_0x402e02){_0x402e02=_0x402e02||0x1f4;return function(_0x5c058c){logger[_0x3504('0x2c')](_0x5c058c['stack']);if(_0x5c058c[_0x3504('0x2d')]){delete _0x5c058c[_0x3504('0x2d')];}_0x35823b[_0x3504('0x1a')](_0x402e02)[_0x3504('0x2e')](_0x5c058c);};}exports['index']=function(_0x282e0c,_0x58fa48){var _0x5b5119={},_0x279da9={},_0x10b746={'count':0x0,'rows':[]};var _0xe29ac2=_[_0x3504('0x2f')](db[_0x3504('0x30')]['rawAttributes'],function(_0x4d11fd){return{'name':_0x4d11fd['fieldName'],'type':_0x4d11fd[_0x3504('0x31')][_0x3504('0x32')]};});_0x279da9[_0x3504('0x33')]=_[_0x3504('0x2f')](_0xe29ac2,_0x3504('0x2d'));_0x279da9[_0x3504('0x34')]=_[_0x3504('0x35')](_0x282e0c[_0x3504('0x34')]);_0x279da9[_0x3504('0x36')]=_[_0x3504('0x37')](_0x279da9[_0x3504('0x33')],_0x279da9[_0x3504('0x34')]);_0x5b5119['attributes']=_[_0x3504('0x37')](_0x279da9[_0x3504('0x33')],qs['fields'](_0x282e0c['query'][_0x3504('0x38')]));_0x5b5119[_0x3504('0x39')]=_0x5b5119[_0x3504('0x39')][_0x3504('0x3a')]?_0x5b5119[_0x3504('0x39')]:_0x279da9[_0x3504('0x33')];if(!_0x282e0c['query'][_0x3504('0x3b')]('nolimit')){_0x5b5119['limit']=qs[_0x3504('0x1f')](_0x282e0c['query'][_0x3504('0x1f')]);_0x5b5119[_0x3504('0x1d')]=qs['offset'](_0x282e0c['query'][_0x3504('0x1d')]);}_0x5b5119[_0x3504('0x3c')]=qs[_0x3504('0x3d')](_0x282e0c['query'][_0x3504('0x3d')]);_0x5b5119[_0x3504('0x3e')]=qs[_0x3504('0x36')](_[_0x3504('0x3f')](_0x282e0c[_0x3504('0x34')],_0x279da9[_0x3504('0x36')]),_0xe29ac2);if(_0x282e0c[_0x3504('0x34')][_0x3504('0x40')]){_0x5b5119['where']=_[_0x3504('0x41')](_0x5b5119[_0x3504('0x3e')],{'$or':[{'key':{'$like':'%'+_0x282e0c[_0x3504('0x34')][_0x3504('0x40')]+'%'}},{'value':{'$like':'%'+_0x282e0c['query'][_0x3504('0x40')]+'%'}}]});}_0x5b5119=_[_0x3504('0x41')]({},_0x5b5119,_0x282e0c['options']);var _0x1f1bff={'where':_0x5b5119['where']};return db['CannedAnswer'][_0x3504('0x20')](_0x1f1bff)[_0x3504('0x27')](function(_0x3dab4c){_0x10b746['count']=_0x3dab4c;if(_0x282e0c['query'][_0x3504('0x42')]){_0x5b5119[_0x3504('0x43')]=[{'all':!![]}];}return db[_0x3504('0x30')]['findAll'](_0x5b5119);})[_0x3504('0x27')](function(_0x59f1fb){_0x10b746[_0x3504('0x44')]=_0x59f1fb;return _0x10b746;})[_0x3504('0x27')](respondWithFilteredResult(_0x58fa48,_0x5b5119))[_0x3504('0x45')](handleError(_0x58fa48,null));};exports[_0x3504('0x46')]=function(_0x13c04f,_0x53b0bf){var _0x5874fb={'raw':!![],'where':{'id':_0x13c04f['params']['id']}},_0x397cb1={};_0x397cb1[_0x3504('0x33')]=_[_0x3504('0x35')](db[_0x3504('0x30')][_0x3504('0x47')]);_0x397cb1['query']=_[_0x3504('0x35')](_0x13c04f['query']);_0x397cb1['filters']=_['intersection'](_0x397cb1['model'],_0x397cb1[_0x3504('0x34')]);_0x5874fb[_0x3504('0x39')]=_[_0x3504('0x37')](_0x397cb1[_0x3504('0x33')],qs[_0x3504('0x38')](_0x13c04f[_0x3504('0x34')][_0x3504('0x38')]));_0x5874fb[_0x3504('0x39')]=_0x5874fb['attributes'][_0x3504('0x3a')]?_0x5874fb[_0x3504('0x39')]:_0x397cb1[_0x3504('0x33')];if(_0x13c04f[_0x3504('0x34')][_0x3504('0x42')]){_0x5874fb['include']=[{'all':!![]}];}_0x5874fb=_[_0x3504('0x41')]({},_0x5874fb,_0x13c04f[_0x3504('0x48')]);return db[_0x3504('0x30')][_0x3504('0x49')](_0x5874fb)[_0x3504('0x27')](handleEntityNotFound(_0x53b0bf,null))[_0x3504('0x27')](respondWithResult(_0x53b0bf,null))[_0x3504('0x45')](handleError(_0x53b0bf,null));};exports['update']=function(_0x1242cb,_0x2bbfdc){if(_0x1242cb[_0x3504('0x4a')]['id']){delete _0x1242cb[_0x3504('0x4a')]['id'];}return db[_0x3504('0x30')][_0x3504('0x49')]({'where':{'id':_0x1242cb[_0x3504('0x4b')]['id']}})[_0x3504('0x27')](handleEntityNotFound(_0x2bbfdc,null))[_0x3504('0x27')](saveUpdates(_0x1242cb[_0x3504('0x4a')],null))[_0x3504('0x27')](respondWithResult(_0x2bbfdc,null))[_0x3504('0x45')](handleError(_0x2bbfdc,null));};exports[_0x3504('0x28')]=function(_0xdd9ffc,_0x5ef83d){return db[_0x3504('0x30')]['find']({'where':{'id':_0xdd9ffc[_0x3504('0x4b')]['id']}})[_0x3504('0x27')](handleEntityNotFound(_0x5ef83d,null))['then'](removeEntity(_0x5ef83d,null))[_0x3504('0x45')](handleError(_0x5ef83d,null));};exports[_0x3504('0x4c')]=function(_0x4433fc,_0x21cfb7){var _0x5aac1c={'key':_0x4433fc['body'][_0x3504('0x32')]};if(_0x4433fc['body'][_0x3504('0x4d')]){_0x5aac1c[_0x3504('0x4d')]=_0x4433fc[_0x3504('0x4a')][_0x3504('0x4d')];}else if(_0x4433fc[_0x3504('0x4a')][_0x3504('0x4e')]){_0x5aac1c[_0x3504('0x4e')]=_0x4433fc[_0x3504('0x4a')][_0x3504('0x4e')];}else if(_0x4433fc[_0x3504('0x4a')][_0x3504('0x4f')]){_0x5aac1c[_0x3504('0x4f')]=_0x4433fc[_0x3504('0x4a')][_0x3504('0x4f')];}else if(_0x4433fc[_0x3504('0x4a')][_0x3504('0x50')]){_0x5aac1c[_0x3504('0x50')]=_0x4433fc[_0x3504('0x4a')][_0x3504('0x50')];}return db['CannedAnswer']['find']({'where':_0x5aac1c})[_0x3504('0x27')](function(_0x48a8c4){if(_0x48a8c4){throw new db[(_0x3504('0x51'))][(_0x3504('0x52'))](_0x3504('0x53'));}return db[_0x3504('0x30')][_0x3504('0x4c')](_0x4433fc[_0x3504('0x4a')]);})[_0x3504('0x27')](function(_0x2e4fdd){var _0xcfc241=_0x4433fc[_0x3504('0x54')][_0x3504('0x29')]({'plain':!![]});if(!_0xcfc241)throw new Error(_0x3504('0x55'));if(_0xcfc241[_0x3504('0x56')]===_0x3504('0x54')){var _0x46bc47=_0x2e4fdd[_0x3504('0x29')]({'plain':!![]});return db[_0x3504('0x57')][_0x3504('0x49')]({'where':{'name':_0x3504('0x2a'),'userProfileId':_0xcfc241[_0x3504('0x58')]},'raw':!![]})[_0x3504('0x27')](function(_0x2744ec){if(_0x2744ec&&_0x2744ec[_0x3504('0x59')]===0x0){return db[_0x3504('0x2b')][_0x3504('0x4c')]({'name':_0x46bc47[_0x3504('0x2d')],'resourceId':_0x46bc47['id'],'type':_0x2744ec['name'],'sectionId':_0x2744ec['id']},{})[_0x3504('0x27')](function(){return _0x2e4fdd;});}else{return _0x2e4fdd;}})['catch'](function(_0x4cf9d5){logger[_0x3504('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4cf9d5);throw _0x4cf9d5;});}return _0x2e4fdd;})['then'](respondWithResult(_0x21cfb7,0xc9))[_0x3504('0x45')](handleError(_0x21cfb7,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index b5cf7b2..8eede87 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 _0x35b7=['moment','request-promise','path','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x579d08,_0x17f245){var _0x12fac2=function(_0x36ea16){while(--_0x36ea16){_0x579d08['push'](_0x579d08['shift']());}};_0x12fac2(++_0x17f245);}(_0x35b7,0x185));var _0x735b=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x35b7[_0x17406a];return _0x1501ff;};'use strict';var _=require(_0x735b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x735b('0x1'));var BPromise=require('bluebird');var rp=require(_0x735b('0x2'));var fs=require('fs');var path=require(_0x735b('0x3'));var rimraf=require('rimraf');var config=require(_0x735b('0x4'));var attributes=require(_0x735b('0x5'));module['exports']=function(_0x887f47,_0x2986f1){return _0x887f47[_0x735b('0x6')](_0x735b('0x7'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x735b('0x8'),'collate':_0x735b('0x9')});}; \ No newline at end of file +var _0x9058=['../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3948c3,_0x2299eb){var _0x34d877=function(_0x5028bd){while(--_0x5028bd){_0x3948c3['push'](_0x3948c3['shift']());}};_0x34d877(++_0x2299eb);}(_0x9058,0x17e));var _0x8905=function(_0x58a03e,_0x5b3f89){_0x58a03e=_0x58a03e-0x0;var _0x41e782=_0x9058[_0x58a03e];return _0x41e782;};'use strict';var _=require(_0x8905('0x0'));var util=require('util');var logger=require(_0x8905('0x1'))(_0x8905('0x2'));var moment=require(_0x8905('0x3'));var BPromise=require(_0x8905('0x4'));var rp=require(_0x8905('0x5'));var fs=require('fs');var path=require(_0x8905('0x6'));var rimraf=require(_0x8905('0x7'));var config=require(_0x8905('0x8'));var attributes=require(_0x8905('0x9'));module[_0x8905('0xa')]=function(_0x4f16b3,_0x136991){return _0x4f16b3[_0x8905('0xb')](_0x8905('0xc'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8905('0xd'),'collate':_0x8905('0xe')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index e2d8e0e..1413831 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(_0x5a87c7,_0x5c07a5){var _0x4cdcd1=function(_0xd7e7bf){while(--_0xd7e7bf){_0x5a87c7['push'](_0x5a87c7['shift']());}};_0x4cdcd1(++_0x5c07a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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(_0x2678f0,_0x444b62){var _0x5aec26=function(_0x19dbf7){while(--_0x19dbf7){_0x2678f0['push'](_0x2678f0['shift']());}};_0x5aec26(++_0x444b62);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 ee986c6..81565b7 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 _0xe19b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x144f53,_0x263ef1){var _0x14c19d=function(_0x436d0e){while(--_0x436d0e){_0x144f53['push'](_0x144f53['shift']());}};_0x14c19d(++_0x263ef1);}(_0xe19b,0x7b));var _0xbe19=function(_0x3b61f4,_0x217bdb){_0x3b61f4=_0x3b61f4-0x0;var _0x2361bd=_0xe19b[_0x3b61f4];return _0x2361bd;};'use strict';var multer=require(_0xbe19('0x0'));var util=require('util');var path=require(_0xbe19('0x1'));var timeout=require(_0xbe19('0x2'));var express=require(_0xbe19('0x3'));var router=express[_0xbe19('0x4')]();var fs_extra=require(_0xbe19('0x5'));var auth=require(_0xbe19('0x6'));var interaction=require(_0xbe19('0x7'));var config=require(_0xbe19('0x8'));var controller=require(_0xbe19('0x9'));router['get']('/',auth[_0xbe19('0xa')](),controller[_0xbe19('0xb')]);router[_0xbe19('0xc')](_0xbe19('0xd'),auth[_0xbe19('0xa')](),controller['show']);router[_0xbe19('0xe')]('/',auth[_0xbe19('0xa')](),controller[_0xbe19('0xf')]);router[_0xbe19('0x10')](_0xbe19('0xd'),auth[_0xbe19('0xa')](),controller[_0xbe19('0x11')]);router[_0xbe19('0x12')](_0xbe19('0xd'),auth['isAuthenticated'](),controller[_0xbe19('0x13')]);module[_0xbe19('0x14')]=router; \ No newline at end of file +var _0x2157=['get','isAuthenticated','/:id','show','post','create','put','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller'];(function(_0x54f048,_0x474311){var _0x249fd8=function(_0x5bf786){while(--_0x5bf786){_0x54f048['push'](_0x54f048['shift']());}};_0x249fd8(++_0x474311);}(_0x2157,0x178));var _0x7215=function(_0x1bac98,_0x576397){_0x1bac98=_0x1bac98-0x0;var _0x2f6fff=_0x2157[_0x1bac98];return _0x2f6fff;};'use strict';var multer=require(_0x7215('0x0'));var util=require(_0x7215('0x1'));var path=require(_0x7215('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7215('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7215('0x4'));var interaction=require(_0x7215('0x5'));var config=require(_0x7215('0x6'));var controller=require(_0x7215('0x7'));router[_0x7215('0x8')]('/',auth[_0x7215('0x9')](),controller['index']);router[_0x7215('0x8')](_0x7215('0xa'),auth[_0x7215('0x9')](),controller[_0x7215('0xb')]);router[_0x7215('0xc')]('/',auth['isAuthenticated'](),controller[_0x7215('0xd')]);router[_0x7215('0xe')](_0x7215('0xa'),auth[_0x7215('0x9')](),controller['update']);router['delete'](_0x7215('0xa'),auth[_0x7215('0x9')](),controller['destroy']);module[_0x7215('0xf')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 36ed192..e9bcb8e 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 _0x9cff=['STRING','INTEGER','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x55fa03,_0xcb96c2){var _0x2cd7cd=function(_0x56611f){while(--_0x56611f){_0x55fa03['push'](_0x55fa03['shift']());}};_0x2cd7cd(++_0xcb96c2);}(_0x9cff,0x1b0));var _0xf9cf=function(_0x1a41c4,_0x115c55){_0x1a41c4=_0x1a41c4-0x0;var _0x307f6e=_0x9cff[_0x1a41c4];return _0x307f6e;};'use strict';var Sequelize=require('sequelize');module[_0xf9cf('0x0')]={'calldate':{'type':Sequelize[_0xf9cf('0x1')],'allowNull':![],'defaultValue':_0xf9cf('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xf9cf('0x3')]},'dst':{'type':Sequelize[_0xf9cf('0x3')]},'dcontext':{'type':Sequelize[_0xf9cf('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xf9cf('0x3')]},'lastapp':{'type':Sequelize[_0xf9cf('0x3')]},'lastdata':{'type':Sequelize[_0xf9cf('0x3')]},'duration':{'type':Sequelize[_0xf9cf('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xf9cf('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf9cf('0x3')]},'amaflags':{'type':Sequelize[_0xf9cf('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xf9cf('0x3')]},'userfield':{'type':Sequelize[_0xf9cf('0x3')]},'uniqueid':{'type':Sequelize[_0xf9cf('0x3')]},'linkedid':{'type':Sequelize[_0xf9cf('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xf9cf('0x3')]},'type':{'type':Sequelize[_0xf9cf('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd6fd=['INTEGER','sequelize','exports','STRING'];(function(_0x5afe7b,_0x332fab){var _0x8253c7=function(_0x33bcd1){while(--_0x33bcd1){_0x5afe7b['push'](_0x5afe7b['shift']());}};_0x8253c7(++_0x332fab);}(_0xd6fd,0x7d));var _0xdd6f=function(_0x679fa1,_0x3614fa){_0x679fa1=_0x679fa1-0x0;var _0x3463b9=_0xd6fd[_0x679fa1];return _0x3463b9;};'use strict';var Sequelize=require(_0xdd6f('0x0'));module[_0xdd6f('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xdd6f('0x2')]},'dst':{'type':Sequelize[_0xdd6f('0x2')]},'dcontext':{'type':Sequelize[_0xdd6f('0x2')]},'channel':{'type':Sequelize[_0xdd6f('0x2')]},'dstchannel':{'type':Sequelize[_0xdd6f('0x2')]},'lastapp':{'type':Sequelize[_0xdd6f('0x2')]},'lastdata':{'type':Sequelize[_0xdd6f('0x2')]},'duration':{'type':Sequelize[_0xdd6f('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xdd6f('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xdd6f('0x2')]},'amaflags':{'type':Sequelize[_0xdd6f('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xdd6f('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xdd6f('0x2')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xdd6f('0x2')]},'type':{'type':Sequelize[_0xdd6f('0x2')]},'tag':{'type':Sequelize[_0xdd6f('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index cad90cd..ec8d3af 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 _0xef17=['key','map','intersection','model','attributes','fields','length','query','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','include','findAll','rows','catch','show','keys','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','sendStatus','status','end','offset','json','apply','reject','save','then','destroy','error','stack','name','send','index','Cdr','rawAttributes','fieldName'];(function(_0x5160c6,_0x10c4e5){var _0x171411=function(_0x5e8acd){while(--_0x5e8acd){_0x5160c6['push'](_0x5160c6['shift']());}};_0x171411(++_0x10c4e5);}(_0xef17,0x136));var _0x7ef1=function(_0x733c9d,_0x4b013e){_0x733c9d=_0x733c9d-0x0;var _0x16508c=_0xef17[_0x733c9d];return _0x16508c;};'use strict';var emlformat=require(_0x7ef1('0x0'));var rimraf=require(_0x7ef1('0x1'));var zipdir=require(_0x7ef1('0x2'));var jsonpatch=require(_0x7ef1('0x3'));var rp=require(_0x7ef1('0x4'));var moment=require(_0x7ef1('0x5'));var BPromise=require(_0x7ef1('0x6'));var Mustache=require(_0x7ef1('0x7'));var util=require(_0x7ef1('0x8'));var path=require('path');var sox=require(_0x7ef1('0x9'));var csv=require('to-csv');var ejs=require(_0x7ef1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7ef1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7ef1('0xc'));var deskjs=require(_0x7ef1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7ef1('0xe'));var Papa=require(_0x7ef1('0xf'));var Redis=require(_0x7ef1('0x10'));var authService=require(_0x7ef1('0x11'));var qs=require(_0x7ef1('0x12'));var as=require(_0x7ef1('0x13'));var hardwareService=require(_0x7ef1('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x7ef1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x122c8a,_0x51e226){_0x51e226=_0x51e226||0xcc;return function(_0x36ddf9){if(_0x36ddf9){return _0x122c8a[_0x7ef1('0x16')](_0x51e226);}return _0x122c8a[_0x7ef1('0x17')](_0x51e226)[_0x7ef1('0x18')]();};}function respondWithResult(_0x39ea9c,_0x317125){_0x317125=_0x317125||0xc8;return function(_0x26e9fb){if(_0x26e9fb){return _0x39ea9c[_0x7ef1('0x17')](_0x317125)['json'](_0x26e9fb);}};}function respondWithFilteredResult(_0x4de80f,_0x267f0e){return function(_0x5d0499){if(_0x5d0499){var _0x20b843=typeof _0x267f0e[_0x7ef1('0x19')]==='undefined'&&typeof _0x267f0e['limit']==='undefined';var _0x300645=_0x5d0499['count'];var _0x3a5835=_0x20b843?0x0:_0x267f0e['offset'];var _0x5a7b2b=_0x20b843?_0x5d0499['count']:_0x267f0e[_0x7ef1('0x19')]+_0x267f0e['limit'];var _0x38c5a7;if(_0x5a7b2b>=_0x300645){_0x5a7b2b=_0x300645;_0x38c5a7=0xc8;}else{_0x38c5a7=0xce;}_0x4de80f[_0x7ef1('0x17')](_0x38c5a7);return _0x4de80f['set']('Content-Range',_0x3a5835+'-'+_0x5a7b2b+'/'+_0x300645)[_0x7ef1('0x1a')](_0x5d0499);}return null;};}function patchUpdates(_0x5490b9){return function(_0x458459){try{jsonpatch[_0x7ef1('0x1b')](_0x458459,_0x5490b9,!![]);}catch(_0x2f8164){return BPromise[_0x7ef1('0x1c')](_0x2f8164);}return _0x458459[_0x7ef1('0x1d')]();};}function saveUpdates(_0xf24942,_0x20887b){return function(_0xd71594){if(_0xd71594){return _0xd71594['update'](_0xf24942)[_0x7ef1('0x1e')](function(_0x3b118f){return _0x3b118f;});}return null;};}function removeEntity(_0x3f26fb,_0x3324d4){return function(_0x31b5bf){if(_0x31b5bf){return _0x31b5bf[_0x7ef1('0x1f')]()[_0x7ef1('0x1e')](function(){_0x3f26fb[_0x7ef1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b1ace,_0x33e008){return function(_0x12ef5a){if(!_0x12ef5a){_0x4b1ace[_0x7ef1('0x16')](0x194);}return _0x12ef5a;};}function handleError(_0xcfce5e,_0x19c2c2){_0x19c2c2=_0x19c2c2||0x1f4;return function(_0x4cfa16){logger[_0x7ef1('0x20')](_0x4cfa16[_0x7ef1('0x21')]);if(_0x4cfa16[_0x7ef1('0x22')]){delete _0x4cfa16[_0x7ef1('0x22')];}_0xcfce5e[_0x7ef1('0x17')](_0x19c2c2)[_0x7ef1('0x23')](_0x4cfa16);};}exports[_0x7ef1('0x24')]=function(_0x58e7ee,_0x2e8f1b){var _0x4b0380={},_0x3306b0={},_0x2546bf={'count':0x0,'rows':[]};var _0x4b5fde=_['map'](db[_0x7ef1('0x25')][_0x7ef1('0x26')],function(_0x5ab3a5){return{'name':_0x5ab3a5[_0x7ef1('0x27')],'type':_0x5ab3a5['type'][_0x7ef1('0x28')]};});_0x3306b0['model']=_[_0x7ef1('0x29')](_0x4b5fde,_0x7ef1('0x22'));_0x3306b0['query']=_['keys'](_0x58e7ee['query']);_0x3306b0['filters']=_[_0x7ef1('0x2a')](_0x3306b0[_0x7ef1('0x2b')],_0x3306b0['query']);_0x4b0380[_0x7ef1('0x2c')]=_['intersection'](_0x3306b0['model'],qs[_0x7ef1('0x2d')](_0x58e7ee['query'][_0x7ef1('0x2d')]));_0x4b0380[_0x7ef1('0x2c')]=_0x4b0380[_0x7ef1('0x2c')][_0x7ef1('0x2e')]?_0x4b0380['attributes']:_0x3306b0[_0x7ef1('0x2b')];if(!_0x58e7ee[_0x7ef1('0x2f')]['hasOwnProperty']('nolimit')){_0x4b0380['limit']=qs['limit'](_0x58e7ee[_0x7ef1('0x2f')]['limit']);_0x4b0380[_0x7ef1('0x19')]=qs[_0x7ef1('0x19')](_0x58e7ee[_0x7ef1('0x2f')][_0x7ef1('0x19')]);}_0x4b0380[_0x7ef1('0x30')]=qs[_0x7ef1('0x31')](_0x58e7ee[_0x7ef1('0x2f')][_0x7ef1('0x31')]);_0x4b0380[_0x7ef1('0x32')]=qs[_0x7ef1('0x33')](_[_0x7ef1('0x34')](_0x58e7ee['query'],_0x3306b0[_0x7ef1('0x33')]),_0x4b5fde);if(_0x58e7ee[_0x7ef1('0x2f')]['filter']){_0x4b0380[_0x7ef1('0x32')]=_[_0x7ef1('0x35')](_0x4b0380[_0x7ef1('0x32')],{'$or':_[_0x7ef1('0x29')](_0x4b5fde,function(_0x8ef5b3){if(_0x8ef5b3['type']!==_0x7ef1('0x36')){var _0x1ccbfb={};_0x1ccbfb[_0x8ef5b3[_0x7ef1('0x22')]]={'$like':'%'+_0x58e7ee[_0x7ef1('0x2f')][_0x7ef1('0x37')]+'%'};return _0x1ccbfb;}})});}_0x4b0380=_[_0x7ef1('0x35')]({},_0x4b0380,_0x58e7ee[_0x7ef1('0x38')]);var _0x238aa7={'where':_0x4b0380[_0x7ef1('0x32')]};return db[_0x7ef1('0x25')][_0x7ef1('0x39')](_0x238aa7)[_0x7ef1('0x1e')](function(_0x2da912){_0x2546bf[_0x7ef1('0x39')]=_0x2da912;if(_0x58e7ee[_0x7ef1('0x2f')]['includeAll']){_0x4b0380[_0x7ef1('0x3a')]=[{'all':!![]}];}return db[_0x7ef1('0x25')][_0x7ef1('0x3b')](_0x4b0380);})[_0x7ef1('0x1e')](function(_0x3889d7){_0x2546bf[_0x7ef1('0x3c')]=_0x3889d7;return _0x2546bf;})[_0x7ef1('0x1e')](respondWithFilteredResult(_0x2e8f1b,_0x4b0380))[_0x7ef1('0x3d')](handleError(_0x2e8f1b,null));};exports[_0x7ef1('0x3e')]=function(_0x1cff0b,_0x3e5ecd){var _0x374bf5={'raw':!![],'where':{'id':_0x1cff0b['params']['id']}},_0x2fb6c4={};_0x2fb6c4[_0x7ef1('0x2b')]=_[_0x7ef1('0x3f')](db[_0x7ef1('0x25')][_0x7ef1('0x26')]);_0x2fb6c4[_0x7ef1('0x2f')]=_[_0x7ef1('0x3f')](_0x1cff0b['query']);_0x2fb6c4[_0x7ef1('0x33')]=_[_0x7ef1('0x2a')](_0x2fb6c4[_0x7ef1('0x2b')],_0x2fb6c4[_0x7ef1('0x2f')]);_0x374bf5[_0x7ef1('0x2c')]=_[_0x7ef1('0x2a')](_0x2fb6c4['model'],qs[_0x7ef1('0x2d')](_0x1cff0b[_0x7ef1('0x2f')][_0x7ef1('0x2d')]));_0x374bf5[_0x7ef1('0x2c')]=_0x374bf5['attributes'][_0x7ef1('0x2e')]?_0x374bf5['attributes']:_0x2fb6c4['model'];if(_0x1cff0b[_0x7ef1('0x2f')]['includeAll']){_0x374bf5[_0x7ef1('0x3a')]=[{'all':!![]}];}_0x374bf5=_['merge']({},_0x374bf5,_0x1cff0b[_0x7ef1('0x38')]);return db[_0x7ef1('0x25')][_0x7ef1('0x40')](_0x374bf5)[_0x7ef1('0x1e')](handleEntityNotFound(_0x3e5ecd,null))[_0x7ef1('0x1e')](respondWithResult(_0x3e5ecd,null))[_0x7ef1('0x3d')](handleError(_0x3e5ecd,null));};exports[_0x7ef1('0x41')]=function(_0x106096,_0x49e089){return db['Cdr'][_0x7ef1('0x41')](_0x106096[_0x7ef1('0x42')],{})['then'](respondWithResult(_0x49e089,0xc9))[_0x7ef1('0x3d')](handleError(_0x49e089,null));};exports[_0x7ef1('0x43')]=function(_0xd06ca9,_0x5ce876){if(_0xd06ca9['body']['id']){delete _0xd06ca9[_0x7ef1('0x42')]['id'];}return db['Cdr']['find']({'where':{'id':_0xd06ca9[_0x7ef1('0x44')]['id']}})[_0x7ef1('0x1e')](handleEntityNotFound(_0x5ce876,null))[_0x7ef1('0x1e')](saveUpdates(_0xd06ca9[_0x7ef1('0x42')],null))[_0x7ef1('0x1e')](respondWithResult(_0x5ce876,null))['catch'](handleError(_0x5ce876,null));};exports[_0x7ef1('0x1f')]=function(_0x4e425b,_0x350dde){return db['Cdr'][_0x7ef1('0x40')]({'where':{'id':_0x4e425b['params']['id']}})['then'](handleEntityNotFound(_0x350dde,null))[_0x7ef1('0x1e')](removeEntity(_0x350dde,null))['catch'](handleError(_0x350dde,null));};exports[_0x7ef1('0x45')]=function(_0x30a4ce,_0x54a0bb){return db[_0x7ef1('0x25')][_0x7ef1('0x45')]()[_0x7ef1('0x1e')](respondWithResult(_0x54a0bb,null))['catch'](handleError(_0x54a0bb,null));}; \ No newline at end of file +var _0x0618=['catch','show','intersection','options','create','body','update','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','end','stack','name','send','map','Cdr','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','then','rows'];(function(_0x409d51,_0x1f0de6){var _0x13eb4b=function(_0x374388){while(--_0x374388){_0x409d51['push'](_0x409d51['shift']());}};_0x13eb4b(++_0x1f0de6);}(_0x0618,0x1c6));var _0x8061=function(_0x56c445,_0x3b5b87){_0x56c445=_0x56c445-0x0;var _0x5d729a=_0x0618[_0x56c445];return _0x5d729a;};'use strict';var emlformat=require(_0x8061('0x0'));var rimraf=require(_0x8061('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8061('0x2'));var rp=require(_0x8061('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8061('0x4'));var util=require(_0x8061('0x5'));var path=require(_0x8061('0x6'));var sox=require(_0x8061('0x7'));var csv=require(_0x8061('0x8'));var ejs=require(_0x8061('0x9'));var fs=require('fs');var fs_extra=require(_0x8061('0xa'));var _=require(_0x8061('0xb'));var squel=require(_0x8061('0xc'));var crypto=require(_0x8061('0xd'));var jsforce=require(_0x8061('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8061('0x8'));var querystring=require('querystring');var Papa=require(_0x8061('0xf'));var Redis=require(_0x8061('0x10'));var authService=require(_0x8061('0x11'));var qs=require(_0x8061('0x12'));var as=require(_0x8061('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8061('0x14'));var utils=require(_0x8061('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8061('0x16'))['db'];function respondWithStatusCode(_0x141707,_0x724e64){_0x724e64=_0x724e64||0xcc;return function(_0x3537f0){if(_0x3537f0){return _0x141707[_0x8061('0x17')](_0x724e64);}return _0x141707[_0x8061('0x18')](_0x724e64)['end']();};}function respondWithResult(_0x4df59c,_0x19ea89){_0x19ea89=_0x19ea89||0xc8;return function(_0x4da339){if(_0x4da339){return _0x4df59c[_0x8061('0x18')](_0x19ea89)[_0x8061('0x19')](_0x4da339);}};}function respondWithFilteredResult(_0x567988,_0x483af8){return function(_0x460dfd){if(_0x460dfd){var _0x3264ff=typeof _0x483af8[_0x8061('0x1a')]===_0x8061('0x1b')&&typeof _0x483af8[_0x8061('0x1c')]===_0x8061('0x1b');var _0x280f9b=_0x460dfd[_0x8061('0x1d')];var _0x2b0eab=_0x3264ff?0x0:_0x483af8[_0x8061('0x1a')];var _0x14230e=_0x3264ff?_0x460dfd[_0x8061('0x1d')]:_0x483af8[_0x8061('0x1a')]+_0x483af8['limit'];var _0x4d254d;if(_0x14230e>=_0x280f9b){_0x14230e=_0x280f9b;_0x4d254d=0xc8;}else{_0x4d254d=0xce;}_0x567988[_0x8061('0x18')](_0x4d254d);return _0x567988[_0x8061('0x1e')](_0x8061('0x1f'),_0x2b0eab+'-'+_0x14230e+'/'+_0x280f9b)['json'](_0x460dfd);}return null;};}function patchUpdates(_0x53f869){return function(_0x36ccd5){try{jsonpatch[_0x8061('0x20')](_0x36ccd5,_0x53f869,!![]);}catch(_0x2bc509){return BPromise[_0x8061('0x21')](_0x2bc509);}return _0x36ccd5['save']();};}function saveUpdates(_0x49f708,_0x1cd5ed){return function(_0x12e73d){if(_0x12e73d){return _0x12e73d['update'](_0x49f708)['then'](function(_0x3dbaea){return _0x3dbaea;});}return null;};}function removeEntity(_0x554faa,_0x535cc9){return function(_0x37bff0){if(_0x37bff0){return _0x37bff0[_0x8061('0x22')]()['then'](function(){_0x554faa['status'](0xcc)[_0x8061('0x23')]();});}};}function handleEntityNotFound(_0x3f2765,_0x4e0860){return function(_0x1b0ec7){if(!_0x1b0ec7){_0x3f2765[_0x8061('0x17')](0x194);}return _0x1b0ec7;};}function handleError(_0x39fb5c,_0x2f7544){_0x2f7544=_0x2f7544||0x1f4;return function(_0x5f0822){logger['error'](_0x5f0822[_0x8061('0x24')]);if(_0x5f0822[_0x8061('0x25')]){delete _0x5f0822[_0x8061('0x25')];}_0x39fb5c[_0x8061('0x18')](_0x2f7544)[_0x8061('0x26')](_0x5f0822);};}exports['index']=function(_0x4c9202,_0x518700){var _0x59a65d={},_0xfb9138={},_0x38317c={'count':0x0,'rows':[]};var _0x36714f=_[_0x8061('0x27')](db[_0x8061('0x28')][_0x8061('0x29')],function(_0x2d1537){return{'name':_0x2d1537[_0x8061('0x2a')],'type':_0x2d1537[_0x8061('0x2b')][_0x8061('0x2c')]};});_0xfb9138['model']=_['map'](_0x36714f,_0x8061('0x25'));_0xfb9138[_0x8061('0x2d')]=_[_0x8061('0x2e')](_0x4c9202[_0x8061('0x2d')]);_0xfb9138[_0x8061('0x2f')]=_['intersection'](_0xfb9138[_0x8061('0x30')],_0xfb9138[_0x8061('0x2d')]);_0x59a65d['attributes']=_['intersection'](_0xfb9138[_0x8061('0x30')],qs[_0x8061('0x31')](_0x4c9202['query'][_0x8061('0x31')]));_0x59a65d[_0x8061('0x32')]=_0x59a65d[_0x8061('0x32')][_0x8061('0x33')]?_0x59a65d[_0x8061('0x32')]:_0xfb9138[_0x8061('0x30')];if(!_0x4c9202[_0x8061('0x2d')][_0x8061('0x34')](_0x8061('0x35'))){_0x59a65d['limit']=qs[_0x8061('0x1c')](_0x4c9202[_0x8061('0x2d')][_0x8061('0x1c')]);_0x59a65d[_0x8061('0x1a')]=qs['offset'](_0x4c9202['query']['offset']);}_0x59a65d['order']=qs['sort'](_0x4c9202[_0x8061('0x2d')]['sort']);_0x59a65d[_0x8061('0x36')]=qs[_0x8061('0x2f')](_[_0x8061('0x37')](_0x4c9202[_0x8061('0x2d')],_0xfb9138[_0x8061('0x2f')]),_0x36714f);if(_0x4c9202['query'][_0x8061('0x38')]){_0x59a65d[_0x8061('0x36')]=_[_0x8061('0x39')](_0x59a65d[_0x8061('0x36')],{'$or':_[_0x8061('0x27')](_0x36714f,function(_0x31ed9d){if(_0x31ed9d[_0x8061('0x2b')]!==_0x8061('0x3a')){var _0x714833={};_0x714833[_0x31ed9d[_0x8061('0x25')]]={'$like':'%'+_0x4c9202[_0x8061('0x2d')][_0x8061('0x38')]+'%'};return _0x714833;}})});}_0x59a65d=_['merge']({},_0x59a65d,_0x4c9202['options']);var _0xb72481={'where':_0x59a65d['where']};return db[_0x8061('0x28')]['count'](_0xb72481)['then'](function(_0x105747){_0x38317c[_0x8061('0x1d')]=_0x105747;if(_0x4c9202[_0x8061('0x2d')][_0x8061('0x3b')]){_0x59a65d[_0x8061('0x3c')]=[{'all':!![]}];}return db[_0x8061('0x28')][_0x8061('0x3d')](_0x59a65d);})[_0x8061('0x3e')](function(_0x1475b1){_0x38317c[_0x8061('0x3f')]=_0x1475b1;return _0x38317c;})['then'](respondWithFilteredResult(_0x518700,_0x59a65d))[_0x8061('0x40')](handleError(_0x518700,null));};exports[_0x8061('0x41')]=function(_0x177ab1,_0x2675e3){var _0x4435b8={'raw':!![],'where':{'id':_0x177ab1['params']['id']}},_0x4ea342={};_0x4ea342[_0x8061('0x30')]=_[_0x8061('0x2e')](db[_0x8061('0x28')][_0x8061('0x29')]);_0x4ea342[_0x8061('0x2d')]=_[_0x8061('0x2e')](_0x177ab1[_0x8061('0x2d')]);_0x4ea342['filters']=_[_0x8061('0x42')](_0x4ea342[_0x8061('0x30')],_0x4ea342[_0x8061('0x2d')]);_0x4435b8[_0x8061('0x32')]=_[_0x8061('0x42')](_0x4ea342[_0x8061('0x30')],qs[_0x8061('0x31')](_0x177ab1['query'][_0x8061('0x31')]));_0x4435b8['attributes']=_0x4435b8[_0x8061('0x32')][_0x8061('0x33')]?_0x4435b8[_0x8061('0x32')]:_0x4ea342['model'];if(_0x177ab1['query'][_0x8061('0x3b')]){_0x4435b8[_0x8061('0x3c')]=[{'all':!![]}];}_0x4435b8=_[_0x8061('0x39')]({},_0x4435b8,_0x177ab1[_0x8061('0x43')]);return db[_0x8061('0x28')]['find'](_0x4435b8)['then'](handleEntityNotFound(_0x2675e3,null))[_0x8061('0x3e')](respondWithResult(_0x2675e3,null))['catch'](handleError(_0x2675e3,null));};exports[_0x8061('0x44')]=function(_0x393bc9,_0x54546a){return db[_0x8061('0x28')][_0x8061('0x44')](_0x393bc9[_0x8061('0x45')],{})[_0x8061('0x3e')](respondWithResult(_0x54546a,0xc9))['catch'](handleError(_0x54546a,null));};exports[_0x8061('0x46')]=function(_0xb1cc9d,_0x2eaab6){if(_0xb1cc9d[_0x8061('0x45')]['id']){delete _0xb1cc9d[_0x8061('0x45')]['id'];}return db[_0x8061('0x28')][_0x8061('0x47')]({'where':{'id':_0xb1cc9d[_0x8061('0x48')]['id']}})[_0x8061('0x3e')](handleEntityNotFound(_0x2eaab6,null))[_0x8061('0x3e')](saveUpdates(_0xb1cc9d[_0x8061('0x45')],null))[_0x8061('0x3e')](respondWithResult(_0x2eaab6,null))[_0x8061('0x40')](handleError(_0x2eaab6,null));};exports[_0x8061('0x22')]=function(_0x291c8b,_0x30771f){return db[_0x8061('0x28')]['find']({'where':{'id':_0x291c8b[_0x8061('0x48')]['id']}})[_0x8061('0x3e')](handleEntityNotFound(_0x30771f,null))[_0x8061('0x3e')](removeEntity(_0x30771f,null))[_0x8061('0x40')](handleError(_0x30771f,null));};exports['describe']=function(_0x2be970,_0xd63f0e){return db[_0x8061('0x28')][_0x8061('0x49')]()[_0x8061('0x3e')](respondWithResult(_0xd63f0e,null))[_0x8061('0x40')](handleError(_0xd63f0e,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 9428b41..3be4d14 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(_0x41440d,_0x1c9cc0){var _0x5ee2ca=function(_0x41432c){while(--_0x41432c){_0x41440d['push'](_0x41440d['shift']());}};_0x5ee2ca(++_0x1c9cc0);}(_0x7a54,0x106));var _0x47a5=function(_0x638951,_0x3cfebd){_0x638951=_0x638951-0x0;var _0xd5228d=_0x7a54[_0x638951];return _0xd5228d;};'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(_0x1635b5,_0x20dc22){var _0x485909=function(_0x527083){while(--_0x527083){_0x1635b5['push'](_0x1635b5['shift']());}};_0x485909(++_0x20dc22);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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 1757308..b6b2935 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 _0xce41=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','error','message','result','lodash'];(function(_0x3a9815,_0x47eb16){var _0x188653=function(_0x203e84){while(--_0x203e84){_0x3a9815['push'](_0x3a9815['shift']());}};_0x188653(++_0x47eb16);}(_0xce41,0x142));var _0x1ce4=function(_0x4eec9b,_0x4aea09){_0x4eec9b=_0x4eec9b-0x0;var _0x2e3849=_0xce41[_0x4eec9b];return _0x2e3849;};'use strict';var _=require(_0x1ce4('0x0'));var util=require(_0x1ce4('0x1'));var moment=require(_0x1ce4('0x2'));var BPromise=require(_0x1ce4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ce4('0x4'));var db=require(_0x1ce4('0x5'))['db'];var utils=require(_0x1ce4('0x6'));var logger=require('../../config/logger')(_0x1ce4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ce4('0x8')][_0x1ce4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40cabc,_0x40047d,_0x1fadb4){return new BPromise(function(_0x1a0224,_0x17f2e2){return client[_0x1ce4('0xa')](_0x40cabc,_0x1fadb4)[_0x1ce4('0xb')](function(_0x3f9bef){logger[_0x1ce4('0xc')](_0x1ce4('0xd'),_0x40047d,_0x1ce4('0xe'));logger['debug'](_0x1ce4('0xf'),_0x40047d,_0x1ce4('0xe'),JSON['stringify'](_0x3f9bef));if(_0x3f9bef[_0x1ce4('0x10')]){if(_0x3f9bef[_0x1ce4('0x10')]['code']===0x1f4){logger[_0x1ce4('0x10')](_0x1ce4('0xd'),_0x40047d,_0x3f9bef[_0x1ce4('0x10')]['message']);return _0x17f2e2(_0x3f9bef[_0x1ce4('0x10')]['message']);}logger[_0x1ce4('0x10')](_0x1ce4('0xd'),_0x40047d,_0x3f9bef['error'][_0x1ce4('0x11')]);return _0x1a0224(_0x3f9bef['error'][_0x1ce4('0x11')]);}else{logger[_0x1ce4('0xc')]('Cdr,\x20%s,\x20%s',_0x40047d,_0x1ce4('0xe'));_0x1a0224(_0x3f9bef[_0x1ce4('0x12')][_0x1ce4('0x11')]);}})['catch'](function(_0x456e1b){logger[_0x1ce4('0x10')](_0x1ce4('0xd'),_0x40047d,_0x456e1b);_0x17f2e2(_0x456e1b);});});} \ No newline at end of file +var _0x6fed=['error','code','message','info','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x46225a,_0x326973){var _0x2d2f1e=function(_0x3e95a9){while(--_0x3e95a9){_0x46225a['push'](_0x46225a['shift']());}};_0x2d2f1e(++_0x326973);}(_0x6fed,0xee));var _0xd6fe=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x6fed[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xd6fe('0x0'));var util=require(_0xd6fe('0x1'));var moment=require(_0xd6fe('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd6fe('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd6fe('0x4'));var logger=require(_0xd6fe('0x5'))(_0xd6fe('0x6'));var config=require(_0xd6fe('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd6fe('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f9d4b,_0x1cc761,_0x4a0bc8){return new BPromise(function(_0x2a62c3,_0x8d8fde){return client['request'](_0x1f9d4b,_0x4a0bc8)[_0xd6fe('0x9')](function(_0x48462f){logger['info'](_0xd6fe('0xa'),_0x1cc761,_0xd6fe('0xb'));logger['debug'](_0xd6fe('0xc'),_0x1cc761,'request\x20sent',JSON[_0xd6fe('0xd')](_0x48462f));if(_0x48462f[_0xd6fe('0xe')]){if(_0x48462f[_0xd6fe('0xe')][_0xd6fe('0xf')]===0x1f4){logger[_0xd6fe('0xe')]('Cdr,\x20%s,\x20%s',_0x1cc761,_0x48462f[_0xd6fe('0xe')][_0xd6fe('0x10')]);return _0x8d8fde(_0x48462f[_0xd6fe('0xe')][_0xd6fe('0x10')]);}logger['error'](_0xd6fe('0xa'),_0x1cc761,_0x48462f[_0xd6fe('0xe')][_0xd6fe('0x10')]);return _0x2a62c3(_0x48462f[_0xd6fe('0xe')][_0xd6fe('0x10')]);}else{logger[_0xd6fe('0x11')](_0xd6fe('0xa'),_0x1cc761,_0xd6fe('0xb'));_0x2a62c3(_0x48462f['result'][_0xd6fe('0x10')]);}})['catch'](function(_0x4e1d3a){logger[_0xd6fe('0xe')](_0xd6fe('0xa'),_0x1cc761,_0x4e1d3a);_0x8d8fde(_0x4e1d3a);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 21dba42..9e09fad 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(_0x221f71,_0x221c04){var _0x2df2e5=function(_0x242926){while(--_0x242926){_0x221f71['push'](_0x221f71['shift']());}};_0x2df2e5(++_0x221c04);}(_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 _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(_0x3776b4,_0x19a1e3){var _0x1636d9=function(_0x320ae3){while(--_0x320ae3){_0x3776b4['push'](_0x3776b4['shift']());}};_0x1636d9(++_0x19a1e3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index f7f53b7..a293f4d 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 _0x18a2=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x89100d,_0x59c43d){var _0x15974a=function(_0x2fb1ac){while(--_0x2fb1ac){_0x89100d['push'](_0x89100d['shift']());}};_0x15974a(++_0x59c43d);}(_0x18a2,0x154));var _0x218a=function(_0x544d1b,_0x514773){_0x544d1b=_0x544d1b-0x0;var _0x1cbd33=_0x18a2[_0x544d1b];return _0x1cbd33;};'use strict';var Sequelize=require(_0x218a('0x0'));module[_0x218a('0x1')]={'priority':{'type':Sequelize[_0x218a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x218a('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x218a('0x4')]()},'description':{'type':Sequelize[_0x218a('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x218a('0x5')}}; \ No newline at end of file +var _0x7b95=['INTEGER','STRING','noop','TEXT','sequelize','exports'];(function(_0xa3df8a,_0x537752){var _0x5b1996=function(_0x2e974d){while(--_0x2e974d){_0xa3df8a['push'](_0xa3df8a['shift']());}};_0x5b1996(++_0x537752);}(_0x7b95,0x112));var _0x57b9=function(_0x38e66c,_0x385b54){_0x38e66c=_0x38e66c-0x0;var _0x1efa7c=_0x7b95[_0x38e66c];return _0x1efa7c;};'use strict';var Sequelize=require(_0x57b9('0x0'));module[_0x57b9('0x1')]={'priority':{'type':Sequelize[_0x57b9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x57b9('0x3')],'allowNull':![],'defaultValue':_0x57b9('0x4')},'appdata':{'type':Sequelize[_0x57b9('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x57b9('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 4452c81..1089f38 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 _0x2e54=['options','find','catch','update','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','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','apply','reject','save','then','error','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge'];(function(_0x56daff,_0xadca9a){var _0x132c82=function(_0x19e0d7){while(--_0x19e0d7){_0x56daff['push'](_0x56daff['shift']());}};_0x132c82(++_0xadca9a);}(_0x2e54,0x1dd));var _0x42e5=function(_0x25e854,_0x3f5b6b){_0x25e854=_0x25e854-0x0;var _0x181329=_0x2e54[_0x25e854];return _0x181329;};'use strict';var emlformat=require(_0x42e5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42e5('0x1'));var rp=require(_0x42e5('0x2'));var moment=require(_0x42e5('0x3'));var BPromise=require(_0x42e5('0x4'));var Mustache=require(_0x42e5('0x5'));var util=require(_0x42e5('0x6'));var path=require(_0x42e5('0x7'));var sox=require('sox');var csv=require(_0x42e5('0x8'));var ejs=require(_0x42e5('0x9'));var fs=require('fs');var fs_extra=require(_0x42e5('0xa'));var _=require('lodash');var squel=require(_0x42e5('0xb'));var crypto=require('crypto');var jsforce=require(_0x42e5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x42e5('0x8'));var querystring=require(_0x42e5('0xd'));var Papa=require(_0x42e5('0xe'));var Redis=require(_0x42e5('0xf'));var authService=require(_0x42e5('0x10'));var qs=require(_0x42e5('0x11'));var as=require(_0x42e5('0x12'));var hardwareService=require(_0x42e5('0x13'));var logger=require(_0x42e5('0x14'))('api');var utils=require(_0x42e5('0x15'));var config=require(_0x42e5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x42e5('0x17'))['db'];function respondWithStatusCode(_0x12385d,_0x4530ba){_0x4530ba=_0x4530ba||0xcc;return function(_0x41598d){if(_0x41598d){return _0x12385d[_0x42e5('0x18')](_0x4530ba);}return _0x12385d[_0x42e5('0x19')](_0x4530ba)[_0x42e5('0x1a')]();};}function respondWithResult(_0x96fae2,_0x447648){_0x447648=_0x447648||0xc8;return function(_0x23957f){if(_0x23957f){return _0x96fae2['status'](_0x447648)[_0x42e5('0x1b')](_0x23957f);}};}function respondWithFilteredResult(_0x1d8e52,_0x4034bd){return function(_0x388300){if(_0x388300){var _0x2f4999=typeof _0x4034bd[_0x42e5('0x1c')]===_0x42e5('0x1d')&&typeof _0x4034bd[_0x42e5('0x1e')]===_0x42e5('0x1d');var _0x3c7b79=_0x388300[_0x42e5('0x1f')];var _0x38282d=_0x2f4999?0x0:_0x4034bd[_0x42e5('0x1c')];var _0x23fe09=_0x2f4999?_0x388300['count']:_0x4034bd[_0x42e5('0x1c')]+_0x4034bd['limit'];var _0x5f4428;if(_0x23fe09>=_0x3c7b79){_0x23fe09=_0x3c7b79;_0x5f4428=0xc8;}else{_0x5f4428=0xce;}_0x1d8e52[_0x42e5('0x19')](_0x5f4428);return _0x1d8e52[_0x42e5('0x20')]('Content-Range',_0x38282d+'-'+_0x23fe09+'/'+_0x3c7b79)[_0x42e5('0x1b')](_0x388300);}return null;};}function patchUpdates(_0x39a3e2){return function(_0x1c2169){try{jsonpatch[_0x42e5('0x21')](_0x1c2169,_0x39a3e2,!![]);}catch(_0x1150f4){return BPromise[_0x42e5('0x22')](_0x1150f4);}return _0x1c2169[_0x42e5('0x23')]();};}function saveUpdates(_0x58eee5,_0x4da508){return function(_0x283d44){if(_0x283d44){return _0x283d44['update'](_0x58eee5)[_0x42e5('0x24')](function(_0x2e9574){return _0x2e9574;});}return null;};}function removeEntity(_0x37d10e,_0x49490f){return function(_0x32380f){if(_0x32380f){return _0x32380f['destroy']()[_0x42e5('0x24')](function(){_0x37d10e[_0x42e5('0x19')](0xcc)[_0x42e5('0x1a')]();});}};}function handleEntityNotFound(_0x275c80,_0x4638bc){return function(_0x4f52b2){if(!_0x4f52b2){_0x275c80['sendStatus'](0x194);}return _0x4f52b2;};}function handleError(_0x3115e4,_0x534a26){_0x534a26=_0x534a26||0x1f4;return function(_0x56f812){logger[_0x42e5('0x25')](_0x56f812['stack']);if(_0x56f812[_0x42e5('0x26')]){delete _0x56f812[_0x42e5('0x26')];}_0x3115e4[_0x42e5('0x19')](_0x534a26)[_0x42e5('0x27')](_0x56f812);};}exports[_0x42e5('0x28')]=function(_0x2f1edc,_0x59a46b){var _0x3e2ea5={'raw':!![],'where':{'id':_0x2f1edc[_0x42e5('0x29')]['id']}},_0x201d9e={};_0x201d9e[_0x42e5('0x2a')]=_[_0x42e5('0x2b')](db[_0x42e5('0x2c')][_0x42e5('0x2d')]);_0x201d9e[_0x42e5('0x2e')]=_[_0x42e5('0x2b')](_0x2f1edc[_0x42e5('0x2e')]);_0x201d9e[_0x42e5('0x2f')]=_[_0x42e5('0x30')](_0x201d9e[_0x42e5('0x2a')],_0x201d9e['query']);_0x3e2ea5[_0x42e5('0x31')]=_[_0x42e5('0x30')](_0x201d9e[_0x42e5('0x2a')],qs[_0x42e5('0x32')](_0x2f1edc['query']['fields']));_0x3e2ea5[_0x42e5('0x31')]=_0x3e2ea5['attributes'][_0x42e5('0x33')]?_0x3e2ea5['attributes']:_0x201d9e[_0x42e5('0x2a')];if(_0x2f1edc[_0x42e5('0x2e')][_0x42e5('0x34')]){_0x3e2ea5['include']=[{'all':!![]}];}_0x3e2ea5=_[_0x42e5('0x35')]({},_0x3e2ea5,_0x2f1edc[_0x42e5('0x36')]);return db['ChatApplication'][_0x42e5('0x37')](_0x3e2ea5)['then'](handleEntityNotFound(_0x59a46b,null))[_0x42e5('0x24')](respondWithResult(_0x59a46b,null))[_0x42e5('0x38')](handleError(_0x59a46b,null));};exports[_0x42e5('0x39')]=function(_0x2a1d23,_0x3c12c6){if(_0x2a1d23[_0x42e5('0x3a')]['id']){delete _0x2a1d23[_0x42e5('0x3a')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x2a1d23[_0x42e5('0x29')]['id']}})[_0x42e5('0x24')](handleEntityNotFound(_0x3c12c6,null))[_0x42e5('0x24')](saveUpdates(_0x2a1d23['body'],null))['then'](respondWithResult(_0x3c12c6,null))['catch'](handleError(_0x3c12c6,null));};exports['destroy']=function(_0x245cda,_0x288fb0){return db[_0x42e5('0x2c')][_0x42e5('0x37')]({'where':{'id':_0x245cda[_0x42e5('0x29')]['id']}})[_0x42e5('0x24')](handleEntityNotFound(_0x288fb0,null))[_0x42e5('0x24')](removeEntity(_0x288fb0,null))[_0x42e5('0x38')](handleError(_0x288fb0,null));}; \ No newline at end of file +var _0xfbac=['length','includeAll','include','merge','options','ChatApplication','find','then','body','catch','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','apply','reject','update','error','stack','name','send','show','model','rawAttributes','keys','filters','intersection','query','attributes','fields'];(function(_0x41f332,_0x1e0373){var _0x489bef=function(_0x1195e0){while(--_0x1195e0){_0x41f332['push'](_0x41f332['shift']());}};_0x489bef(++_0x1e0373);}(_0xfbac,0x167));var _0xcfba=function(_0x3835fa,_0x55a48e){_0x3835fa=_0x3835fa-0x0;var _0x41d64c=_0xfbac[_0x3835fa];return _0x41d64c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcfba('0x0'));var zipdir=require(_0xcfba('0x1'));var jsonpatch=require(_0xcfba('0x2'));var rp=require(_0xcfba('0x3'));var moment=require(_0xcfba('0x4'));var BPromise=require(_0xcfba('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcfba('0x6'));var sox=require(_0xcfba('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcfba('0x8'));var _=require('lodash');var squel=require(_0xcfba('0x9'));var crypto=require('crypto');var jsforce=require(_0xcfba('0xa'));var deskjs=require(_0xcfba('0xb'));var toCsv=require('to-csv');var querystring=require(_0xcfba('0xc'));var Papa=require(_0xcfba('0xd'));var Redis=require(_0xcfba('0xe'));var authService=require(_0xcfba('0xf'));var qs=require(_0xcfba('0x10'));var as=require(_0xcfba('0x11'));var hardwareService=require(_0xcfba('0x12'));var logger=require(_0xcfba('0x13'))(_0xcfba('0x14'));var utils=require(_0xcfba('0x15'));var config=require(_0xcfba('0x16'));var licenseUtil=require(_0xcfba('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48d6f1,_0x1f590b){_0x1f590b=_0x1f590b||0xcc;return function(_0x24168c){if(_0x24168c){return _0x48d6f1['sendStatus'](_0x1f590b);}return _0x48d6f1[_0xcfba('0x18')](_0x1f590b)[_0xcfba('0x19')]();};}function respondWithResult(_0x335bfd,_0x226e89){_0x226e89=_0x226e89||0xc8;return function(_0x2333ee){if(_0x2333ee){return _0x335bfd[_0xcfba('0x18')](_0x226e89)[_0xcfba('0x1a')](_0x2333ee);}};}function respondWithFilteredResult(_0xa0508d,_0x2f497b){return function(_0x18d1d6){if(_0x18d1d6){var _0x231192=typeof _0x2f497b[_0xcfba('0x1b')]===_0xcfba('0x1c')&&typeof _0x2f497b['limit']===_0xcfba('0x1c');var _0x1d7be2=_0x18d1d6[_0xcfba('0x1d')];var _0x30c319=_0x231192?0x0:_0x2f497b[_0xcfba('0x1b')];var _0x778955=_0x231192?_0x18d1d6[_0xcfba('0x1d')]:_0x2f497b['offset']+_0x2f497b[_0xcfba('0x1e')];var _0x35c1e4;if(_0x778955>=_0x1d7be2){_0x778955=_0x1d7be2;_0x35c1e4=0xc8;}else{_0x35c1e4=0xce;}_0xa0508d[_0xcfba('0x18')](_0x35c1e4);return _0xa0508d['set']('Content-Range',_0x30c319+'-'+_0x778955+'/'+_0x1d7be2)[_0xcfba('0x1a')](_0x18d1d6);}return null;};}function patchUpdates(_0x43b745){return function(_0x40a0df){try{jsonpatch[_0xcfba('0x1f')](_0x40a0df,_0x43b745,!![]);}catch(_0x358610){return BPromise[_0xcfba('0x20')](_0x358610);}return _0x40a0df['save']();};}function saveUpdates(_0x1d4d83,_0x5d4c92){return function(_0x286d20){if(_0x286d20){return _0x286d20[_0xcfba('0x21')](_0x1d4d83)['then'](function(_0x25e9ea){return _0x25e9ea;});}return null;};}function removeEntity(_0x42cf58,_0x14850f){return function(_0x3fb061){if(_0x3fb061){return _0x3fb061['destroy']()['then'](function(){_0x42cf58[_0xcfba('0x18')](0xcc)[_0xcfba('0x19')]();});}};}function handleEntityNotFound(_0x200a77,_0x4c9098){return function(_0x1f01a7){if(!_0x1f01a7){_0x200a77['sendStatus'](0x194);}return _0x1f01a7;};}function handleError(_0x3eb614,_0x5e79c7){_0x5e79c7=_0x5e79c7||0x1f4;return function(_0x4ee825){logger[_0xcfba('0x22')](_0x4ee825[_0xcfba('0x23')]);if(_0x4ee825['name']){delete _0x4ee825[_0xcfba('0x24')];}_0x3eb614[_0xcfba('0x18')](_0x5e79c7)[_0xcfba('0x25')](_0x4ee825);};}exports[_0xcfba('0x26')]=function(_0xae6518,_0x1c3343){var _0x2ee85c={'raw':!![],'where':{'id':_0xae6518['params']['id']}},_0x4585ec={};_0x4585ec[_0xcfba('0x27')]=_['keys'](db['ChatApplication'][_0xcfba('0x28')]);_0x4585ec['query']=_[_0xcfba('0x29')](_0xae6518['query']);_0x4585ec[_0xcfba('0x2a')]=_[_0xcfba('0x2b')](_0x4585ec[_0xcfba('0x27')],_0x4585ec[_0xcfba('0x2c')]);_0x2ee85c[_0xcfba('0x2d')]=_[_0xcfba('0x2b')](_0x4585ec[_0xcfba('0x27')],qs[_0xcfba('0x2e')](_0xae6518['query']['fields']));_0x2ee85c['attributes']=_0x2ee85c[_0xcfba('0x2d')][_0xcfba('0x2f')]?_0x2ee85c['attributes']:_0x4585ec[_0xcfba('0x27')];if(_0xae6518['query'][_0xcfba('0x30')]){_0x2ee85c[_0xcfba('0x31')]=[{'all':!![]}];}_0x2ee85c=_[_0xcfba('0x32')]({},_0x2ee85c,_0xae6518[_0xcfba('0x33')]);return db[_0xcfba('0x34')][_0xcfba('0x35')](_0x2ee85c)[_0xcfba('0x36')](handleEntityNotFound(_0x1c3343,null))[_0xcfba('0x36')](respondWithResult(_0x1c3343,null))['catch'](handleError(_0x1c3343,null));};exports[_0xcfba('0x21')]=function(_0x1d23ea,_0x2d0085){if(_0x1d23ea[_0xcfba('0x37')]['id']){delete _0x1d23ea[_0xcfba('0x37')]['id'];}return db[_0xcfba('0x34')][_0xcfba('0x35')]({'where':{'id':_0x1d23ea['params']['id']}})[_0xcfba('0x36')](handleEntityNotFound(_0x2d0085,null))[_0xcfba('0x36')](saveUpdates(_0x1d23ea[_0xcfba('0x37')],null))[_0xcfba('0x36')](respondWithResult(_0x2d0085,null))[_0xcfba('0x38')](handleError(_0x2d0085,null));};exports['destroy']=function(_0x4d94df,_0x62fc63){return db[_0xcfba('0x34')][_0xcfba('0x35')]({'where':{'id':_0x4d94df[_0xcfba('0x39')]['id']}})['then'](handleEntityNotFound(_0x62fc63,null))[_0xcfba('0x36')](removeEntity(_0x62fc63,null))[_0xcfba('0x38')](handleError(_0x62fc63,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 2ecb6dc..fbd184b 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 _0x37a6=['define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x1865f3,_0x5154be){var _0xb69290=function(_0x12e20b){while(--_0x12e20b){_0x1865f3['push'](_0x1865f3['shift']());}};_0xb69290(++_0x5154be);}(_0x37a6,0x8d));var _0x637a=function(_0x4b1bb0,_0x7dc32b){_0x4b1bb0=_0x4b1bb0-0x0;var _0x549407=_0x37a6[_0x4b1bb0];return _0x549407;};'use strict';var _=require(_0x637a('0x0'));var util=require(_0x637a('0x1'));var logger=require(_0x637a('0x2'))(_0x637a('0x3'));var moment=require(_0x637a('0x4'));var BPromise=require(_0x637a('0x5'));var rp=require(_0x637a('0x6'));var fs=require('fs');var path=require(_0x637a('0x7'));var rimraf=require(_0x637a('0x8'));var config=require(_0x637a('0x9'));var attributes=require(_0x637a('0xa'));module[_0x637a('0xb')]=function(_0x4b7d5f,_0x41eea1){return _0x4b7d5f[_0x637a('0xc')](_0x637a('0xd'),attributes,{'tableName':_0x637a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x637a('0xf'),'collate':_0x637a('0x10')});}; \ No newline at end of file +var _0x9a0b=['./chatApplication.attributes','chat_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9a0b,0x7c));var _0xb9a0=function(_0x500cf0,_0x1ee8e5){_0x500cf0=_0x500cf0-0x0;var _0x1c55ba=_0x9a0b[_0x500cf0];return _0x1c55ba;};'use strict';var _=require('lodash');var util=require(_0xb9a0('0x0'));var logger=require(_0xb9a0('0x1'))(_0xb9a0('0x2'));var moment=require('moment');var BPromise=require(_0xb9a0('0x3'));var rp=require(_0xb9a0('0x4'));var fs=require('fs');var path=require(_0xb9a0('0x5'));var rimraf=require(_0xb9a0('0x6'));var config=require(_0xb9a0('0x7'));var attributes=require(_0xb9a0('0x8'));module['exports']=function(_0x519362,_0xa18963){return _0x519362['define']('ChatApplication',attributes,{'tableName':_0xb9a0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb9a0('0xa'),'collate':_0xb9a0('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 7e785bf..0393365 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 _0x7c14=['jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x2533c0,_0x43d010){var _0x34c6b4=function(_0x309eb9){while(--_0x309eb9){_0x2533c0['push'](_0x2533c0['shift']());}};_0x34c6b4(++_0x43d010);}(_0x7c14,0x184));var _0x47c1=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x7c14[_0x199572];return _0x13cfa3;};'use strict';var _=require('lodash');var util=require(_0x47c1('0x0'));var moment=require(_0x47c1('0x1'));var BPromise=require(_0x47c1('0x2'));var rs=require(_0x47c1('0x3'));var fs=require('fs');var Redis=require(_0x47c1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47c1('0x5'));var logger=require('../../config/logger')(_0x47c1('0x6'));var config=require(_0x47c1('0x7'));var jayson=require(_0x47c1('0x8'));var client=jayson[_0x47c1('0x9')][_0x47c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54a54f,_0x9c7dc,_0x3e53ff){return new BPromise(function(_0x3eba71,_0x1e2d71){return client[_0x47c1('0xb')](_0x54a54f,_0x3e53ff)[_0x47c1('0xc')](function(_0xece6e5){logger[_0x47c1('0xd')](_0x47c1('0xe'),_0x9c7dc,'request\x20sent');logger[_0x47c1('0xf')](_0x47c1('0x10'),_0x9c7dc,_0x47c1('0x11'),JSON['stringify'](_0xece6e5));if(_0xece6e5[_0x47c1('0x12')]){if(_0xece6e5[_0x47c1('0x12')][_0x47c1('0x13')]===0x1f4){logger[_0x47c1('0x12')](_0x47c1('0xe'),_0x9c7dc,_0xece6e5[_0x47c1('0x12')][_0x47c1('0x14')]);return _0x1e2d71(_0xece6e5[_0x47c1('0x12')][_0x47c1('0x14')]);}logger['error'](_0x47c1('0xe'),_0x9c7dc,_0xece6e5[_0x47c1('0x12')][_0x47c1('0x14')]);return _0x3eba71(_0xece6e5[_0x47c1('0x12')]['message']);}else{logger[_0x47c1('0xd')](_0x47c1('0xe'),_0x9c7dc,_0x47c1('0x11'));_0x3eba71(_0xece6e5[_0x47c1('0x15')][_0x47c1('0x14')]);}})['catch'](function(_0x134a76){logger[_0x47c1('0x12')](_0x47c1('0xe'),_0x9c7dc,_0x134a76);_0x1e2d71(_0x134a76);});});} \ No newline at end of file +var _0x7d53=['jayson/promise','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatApplication,\x20%s,\x20%s','result','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1bc019,_0x3b33ec){var _0x4dc25f=function(_0x18168c){while(--_0x18168c){_0x1bc019['push'](_0x1bc019['shift']());}};_0x4dc25f(++_0x3b33ec);}(_0x7d53,0x134));var _0x37d5=function(_0xf6c23d,_0x2076d7){_0xf6c23d=_0xf6c23d-0x0;var _0x568084=_0x7d53[_0xf6c23d];return _0x568084;};'use strict';var _=require(_0x37d5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37d5('0x1'));var db=require(_0x37d5('0x2'))['db'];var utils=require(_0x37d5('0x3'));var logger=require(_0x37d5('0x4'))(_0x37d5('0x5'));var config=require(_0x37d5('0x6'));var jayson=require(_0x37d5('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5524b9,_0x45e187,_0xde65b9){return new BPromise(function(_0x3aa2e8,_0xe5e7a2){return client[_0x37d5('0x8')](_0x5524b9,_0xde65b9)[_0x37d5('0x9')](function(_0x2bb669){logger[_0x37d5('0xa')]('ChatApplication,\x20%s,\x20%s',_0x45e187,_0x37d5('0xb'));logger[_0x37d5('0xc')](_0x37d5('0xd'),_0x45e187,_0x37d5('0xb'),JSON[_0x37d5('0xe')](_0x2bb669));if(_0x2bb669[_0x37d5('0xf')]){if(_0x2bb669['error'][_0x37d5('0x10')]===0x1f4){logger[_0x37d5('0xf')]('ChatApplication,\x20%s,\x20%s',_0x45e187,_0x2bb669[_0x37d5('0xf')][_0x37d5('0x11')]);return _0xe5e7a2(_0x2bb669[_0x37d5('0xf')][_0x37d5('0x11')]);}logger['error'](_0x37d5('0x12'),_0x45e187,_0x2bb669[_0x37d5('0xf')][_0x37d5('0x11')]);return _0x3aa2e8(_0x2bb669[_0x37d5('0xf')][_0x37d5('0x11')]);}else{logger[_0x37d5('0xa')]('ChatApplication,\x20%s,\x20%s',_0x45e187,_0x37d5('0xb'));_0x3aa2e8(_0x2bb669[_0x37d5('0x13')][_0x37d5('0x11')]);}})[_0x37d5('0x14')](function(_0x3c3532){logger[_0x37d5('0xf')](_0x37d5('0x12'),_0x45e187,_0x3c3532);_0xe5e7a2(_0x3c3532);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 7137a17..fda08bb 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 _0x5065=['../../config/environment','./chatApplication.controller','get','/:id','put','update','isAuthenticated','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x485898,_0x5b4e77){var _0x5c9932=function(_0x533365){while(--_0x533365){_0x485898['push'](_0x485898['shift']());}};_0x5c9932(++_0x5b4e77);}(_0x5065,0x117));var _0x5506=function(_0x15b42f,_0xf140e5){_0x15b42f=_0x15b42f-0x0;var _0x349ac1=_0x5065[_0x15b42f];return _0x349ac1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5506('0x0'));var timeout=require(_0x5506('0x1'));var express=require(_0x5506('0x2'));var router=express['Router']();var fs_extra=require(_0x5506('0x3'));var auth=require(_0x5506('0x4'));var interaction=require(_0x5506('0x5'));var config=require(_0x5506('0x6'));var controller=require(_0x5506('0x7'));router[_0x5506('0x8')](_0x5506('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x5506('0xa')](_0x5506('0x9'),auth['isAuthenticated'](),controller[_0x5506('0xb')]);router['delete']('/:id',auth[_0x5506('0xc')](),controller[_0x5506('0xd')]);module[_0x5506('0xe')]=router; \ No newline at end of file +var _0x81d4=['destroy','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update'];(function(_0x413aac,_0x5e2430){var _0x569b11=function(_0x52e060){while(--_0x52e060){_0x413aac['push'](_0x413aac['shift']());}};_0x569b11(++_0x5e2430);}(_0x81d4,0xb7));var _0x481d=function(_0x846d94,_0xc08ef){_0x846d94=_0x846d94-0x0;var _0xb5f12d=_0x81d4[_0x846d94];return _0xb5f12d;};'use strict';var multer=require(_0x481d('0x0'));var util=require(_0x481d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x481d('0x2'));var auth=require(_0x481d('0x3'));var interaction=require(_0x481d('0x4'));var config=require('../../config/environment');var controller=require(_0x481d('0x5'));router[_0x481d('0x6')](_0x481d('0x7'),auth[_0x481d('0x8')](),controller[_0x481d('0x9')]);router[_0x481d('0xa')](_0x481d('0x7'),auth[_0x481d('0x8')](),controller[_0x481d('0xb')]);router['delete'](_0x481d('0x7'),auth['isAuthenticated'](),controller[_0x481d('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 8887272..38a5a38 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 _0xd566=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3c2a6e,_0x1136b1){var _0x1795ad=function(_0x3979fb){while(--_0x3979fb){_0x3c2a6e['push'](_0x3c2a6e['shift']());}};_0x1795ad(++_0x1136b1);}(_0xd566,0x100));var _0x6d56=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd566[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x6d56('0x0'));module[_0x6d56('0x1')]={'name':{'type':Sequelize[_0x6d56('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6d56('0x2')]},'write':{'type':Sequelize[_0x6d56('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8bf4=['BOOLEAN','sequelize','exports','STRING'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x8bf4,0x185));var _0x48bf=function(_0x9d9183,_0x4704df){_0x9d9183=_0x9d9183-0x0;var _0x3bec8e=_0x8bf4[_0x9d9183];return _0x3bec8e;};'use strict';var Sequelize=require(_0x48bf('0x0'));module[_0x48bf('0x1')]={'name':{'type':Sequelize[_0x48bf('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x48bf('0x2')]},'write':{'type':Sequelize[_0x48bf('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 5ee68f4..211a7b7 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 _0x482a=['count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','ChatGroup','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','findOne','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','offset','undefined','limit'];(function(_0x53e634,_0x3590ea){var _0x430cc4=function(_0x1d00d7){while(--_0x1d00d7){_0x53e634['push'](_0x53e634['shift']());}};_0x430cc4(++_0x3590ea);}(_0x482a,0x9d));var _0xa482=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x482a[_0x40a825];return _0x273a54;};'use strict';var emlformat=require(_0xa482('0x0'));var rimraf=require(_0xa482('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa482('0x2'));var rp=require(_0xa482('0x3'));var moment=require(_0xa482('0x4'));var BPromise=require(_0xa482('0x5'));var Mustache=require(_0xa482('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa482('0x7'));var csv=require(_0xa482('0x8'));var ejs=require(_0xa482('0x9'));var fs=require('fs');var fs_extra=require(_0xa482('0xa'));var _=require(_0xa482('0xb'));var squel=require(_0xa482('0xc'));var crypto=require(_0xa482('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa482('0xe'));var toCsv=require(_0xa482('0x8'));var querystring=require(_0xa482('0xf'));var Papa=require('papaparse');var Redis=require(_0xa482('0x10'));var authService=require(_0xa482('0x11'));var qs=require(_0xa482('0x12'));var as=require(_0xa482('0x13'));var hardwareService=require(_0xa482('0x14'));var logger=require(_0xa482('0x15'))('api');var utils=require(_0xa482('0x16'));var config=require(_0xa482('0x17'));var licenseUtil=require(_0xa482('0x18'));var db=require('../../mysqldb')['db'];config[_0xa482('0x19')]=_[_0xa482('0x1a')](config[_0xa482('0x19')],{'host':_0xa482('0x1b'),'port':0x18eb});var socket=require(_0xa482('0x1c'))(new Redis(config[_0xa482('0x19')]));require(_0xa482('0x1d'))['register'](socket);function respondWithStatusCode(_0x3585e2,_0x279139){_0x279139=_0x279139||0xcc;return function(_0x5f2934){if(_0x5f2934){return _0x3585e2[_0xa482('0x1e')](_0x279139);}return _0x3585e2['status'](_0x279139)['end']();};}function respondWithResult(_0x64e2a3,_0x13ec16){_0x13ec16=_0x13ec16||0xc8;return function(_0x41a665){if(_0x41a665){return _0x64e2a3[_0xa482('0x1f')](_0x13ec16)['json'](_0x41a665);}};}function respondWithFilteredResult(_0x352de2,_0x31f5c4){return function(_0x3430fa){if(_0x3430fa){var _0xf74ee7=typeof _0x31f5c4[_0xa482('0x20')]===_0xa482('0x21')&&typeof _0x31f5c4[_0xa482('0x22')]==='undefined';var _0x6f3872=_0x3430fa[_0xa482('0x23')];var _0x15248c=_0xf74ee7?0x0:_0x31f5c4[_0xa482('0x20')];var _0x3ca7bf=_0xf74ee7?_0x3430fa[_0xa482('0x23')]:_0x31f5c4['offset']+_0x31f5c4['limit'];var _0x3567b4;if(_0x3ca7bf>=_0x6f3872){_0x3ca7bf=_0x6f3872;_0x3567b4=0xc8;}else{_0x3567b4=0xce;}_0x352de2[_0xa482('0x1f')](_0x3567b4);return _0x352de2[_0xa482('0x24')](_0xa482('0x25'),_0x15248c+'-'+_0x3ca7bf+'/'+_0x6f3872)[_0xa482('0x26')](_0x3430fa);}return null;};}function patchUpdates(_0x25cc1f){return function(_0x5f2627){try{jsonpatch[_0xa482('0x27')](_0x5f2627,_0x25cc1f,!![]);}catch(_0x5a044c){return BPromise[_0xa482('0x28')](_0x5a044c);}return _0x5f2627['save']();};}function saveUpdates(_0x27ffe0,_0x354bf5){return function(_0x2ccdf2){if(_0x2ccdf2){return _0x2ccdf2[_0xa482('0x29')](_0x27ffe0)[_0xa482('0x2a')](function(_0x9a6e1a){return _0x9a6e1a;});}return null;};}function removeEntity(_0x4c2505,_0x6cb517){return function(_0x4885ab){if(_0x4885ab){return _0x4885ab[_0xa482('0x2b')]()[_0xa482('0x2a')](function(){_0x4c2505[_0xa482('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f589c,_0x4d420f){return function(_0x140a96){if(!_0x140a96){_0x2f589c[_0xa482('0x1e')](0x194);}return _0x140a96;};}function handleError(_0x55701a,_0x2cd1d6){_0x2cd1d6=_0x2cd1d6||0x1f4;return function(_0x53da89){logger[_0xa482('0x2c')](_0x53da89[_0xa482('0x2d')]);if(_0x53da89['name']){delete _0x53da89[_0xa482('0x2e')];}_0x55701a[_0xa482('0x1f')](_0x2cd1d6)[_0xa482('0x2f')](_0x53da89);};}exports[_0xa482('0x30')]=function(_0x33a255,_0x3dc255){var _0x551974={},_0x2aab86={},_0x5f4ca0={'count':0x0,'rows':[]};var _0x4c8d3f=_['map'](db[_0xa482('0x31')]['rawAttributes'],function(_0x4517b8){return{'name':_0x4517b8[_0xa482('0x32')],'type':_0x4517b8[_0xa482('0x33')]['key']};});_0x2aab86[_0xa482('0x34')]=_[_0xa482('0x35')](_0x4c8d3f,'name');_0x2aab86['query']=_[_0xa482('0x36')](_0x33a255[_0xa482('0x37')]);_0x2aab86[_0xa482('0x38')]=_[_0xa482('0x39')](_0x2aab86['model'],_0x2aab86['query']);_0x551974[_0xa482('0x3a')]=_['intersection'](_0x2aab86[_0xa482('0x34')],qs[_0xa482('0x3b')](_0x33a255[_0xa482('0x37')][_0xa482('0x3b')]));_0x551974[_0xa482('0x3a')]=_0x551974[_0xa482('0x3a')]['length']?_0x551974[_0xa482('0x3a')]:_0x2aab86[_0xa482('0x34')];if(!_0x33a255[_0xa482('0x37')]['hasOwnProperty'](_0xa482('0x3c'))){_0x551974[_0xa482('0x22')]=qs['limit'](_0x33a255[_0xa482('0x37')]['limit']);_0x551974['offset']=qs[_0xa482('0x20')](_0x33a255[_0xa482('0x37')][_0xa482('0x20')]);}_0x551974[_0xa482('0x3d')]=qs[_0xa482('0x3e')](_0x33a255['query'][_0xa482('0x3e')]);_0x551974[_0xa482('0x3f')]=qs[_0xa482('0x38')](_[_0xa482('0x40')](_0x33a255['query'],_0x2aab86[_0xa482('0x38')]),_0x4c8d3f);if(_0x33a255[_0xa482('0x37')][_0xa482('0x41')]){_0x551974[_0xa482('0x3f')]=_[_0xa482('0x42')](_0x551974['where'],{'$or':_[_0xa482('0x35')](_0x4c8d3f,function(_0x33c3ce){if(_0x33c3ce['type']!==_0xa482('0x43')){var _0x5bdaac={};_0x5bdaac[_0x33c3ce[_0xa482('0x2e')]]={'$like':'%'+_0x33a255['query'][_0xa482('0x41')]+'%'};return _0x5bdaac;}})});}_0x551974=_[_0xa482('0x42')]({},_0x551974,_0x33a255[_0xa482('0x44')]);var _0x2fb17b={'where':_0x551974[_0xa482('0x3f')]};return db[_0xa482('0x31')][_0xa482('0x23')](_0x2fb17b)[_0xa482('0x2a')](function(_0x14c592){_0x5f4ca0[_0xa482('0x23')]=_0x14c592;if(_0x33a255['query'][_0xa482('0x45')]){_0x551974[_0xa482('0x46')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x551974);})[_0xa482('0x2a')](function(_0x7b9fd1){_0x5f4ca0[_0xa482('0x47')]=_0x7b9fd1;return _0x5f4ca0;})[_0xa482('0x2a')](respondWithFilteredResult(_0x3dc255,_0x551974))[_0xa482('0x48')](handleError(_0x3dc255,null));};exports[_0xa482('0x49')]=function(_0x48cc08,_0x1d7bda){var _0x5b3574={'raw':!![],'where':{'id':_0x48cc08[_0xa482('0x4a')]['id']}},_0x537b44={};_0x537b44['model']=_[_0xa482('0x36')](db['ChatGroup'][_0xa482('0x4b')]);_0x537b44[_0xa482('0x37')]=_['keys'](_0x48cc08[_0xa482('0x37')]);_0x537b44[_0xa482('0x38')]=_[_0xa482('0x39')](_0x537b44[_0xa482('0x34')],_0x537b44['query']);_0x5b3574[_0xa482('0x3a')]=_['intersection'](_0x537b44['model'],qs[_0xa482('0x3b')](_0x48cc08[_0xa482('0x37')][_0xa482('0x3b')]));_0x5b3574[_0xa482('0x3a')]=_0x5b3574[_0xa482('0x3a')][_0xa482('0x4c')]?_0x5b3574['attributes']:_0x537b44[_0xa482('0x34')];if(_0x48cc08[_0xa482('0x37')][_0xa482('0x45')]){_0x5b3574[_0xa482('0x46')]=[{'all':!![]}];}_0x5b3574=_['merge']({},_0x5b3574,_0x48cc08[_0xa482('0x44')]);return db['ChatGroup'][_0xa482('0x4d')](_0x5b3574)[_0xa482('0x2a')](handleEntityNotFound(_0x1d7bda,null))[_0xa482('0x2a')](respondWithResult(_0x1d7bda,null))[_0xa482('0x48')](handleError(_0x1d7bda,null));};exports[_0xa482('0x4e')]=function(_0x440c9b,_0x55ada8){return db[_0xa482('0x31')][_0xa482('0x4e')](_0x440c9b[_0xa482('0x4f')],{})['then'](respondWithResult(_0x55ada8,0xc9))['catch'](handleError(_0x55ada8,null));};exports[_0xa482('0x29')]=function(_0x485af4,_0xc4e183){if(_0x485af4[_0xa482('0x4f')]['id']){delete _0x485af4[_0xa482('0x4f')]['id'];}return db['ChatGroup'][_0xa482('0x4d')]({'where':{'id':_0x485af4['params']['id']}})[_0xa482('0x2a')](handleEntityNotFound(_0xc4e183,null))['then'](saveUpdates(_0x485af4['body'],null))[_0xa482('0x2a')](respondWithResult(_0xc4e183,null))[_0xa482('0x48')](handleError(_0xc4e183,null));};exports['destroy']=function(_0x2c3851,_0x4f8b61){return db[_0xa482('0x31')][_0xa482('0x4d')]({'where':{'id':_0x2c3851['params']['id']}})[_0xa482('0x2a')](handleEntityNotFound(_0x4f8b61,null))[_0xa482('0x2a')](removeEntity(_0x4f8b61,null))[_0xa482('0x48')](handleError(_0x4f8b61,null));};exports['describe']=function(_0x29c8f3,_0x341e50){return db[_0xa482('0x31')]['describe']()[_0xa482('0x2a')](respondWithResult(_0x341e50,null))[_0xa482('0x48')](handleError(_0x341e50,null));};exports[_0xa482('0x50')]=function(_0x164a02,_0x386ca6,_0x455c5a){return db[_0xa482('0x51')][_0xa482('0x23')]({'where':{'ChatGroupId':_0x164a02[_0xa482('0x4a')]['id'],'ToId':_0x164a02[_0xa482('0x52')]['id'],'read':![]}})[_0xa482('0x2a')](function(_0x5383ae){return{'id':_[_0xa482('0x53')](_0x164a02[_0xa482('0x4a')]['id']),'count':_0x5383ae};})[_0xa482('0x2a')](respondWithResult(_0x386ca6,null))[_0xa482('0x48')](handleError(_0x386ca6,null));};exports[_0xa482('0x54')]=function(_0xb9b91b,_0x25bbcb,_0x54020c){return db[_0xa482('0x31')][_0xa482('0x4d')]({'where':{'id':_0xb9b91b[_0xa482('0x4a')]['id']}})[_0xa482('0x2a')](handleEntityNotFound(_0x25bbcb,null))[_0xa482('0x2a')](function(_0x4bccdd){if(_0x4bccdd){return _0x4bccdd['addMembers'](_0xb9b91b['body']['ids'],_['omit'](_0xb9b91b[_0xa482('0x4f')],[_0xa482('0x55'),'id'])||{});}})[_0xa482('0x2a')](respondWithResult(_0x25bbcb,null))[_0xa482('0x48')](handleError(_0x25bbcb,null));};exports[_0xa482('0x56')]=function(_0x3078ad,_0x2049fa,_0x2ea38e){var _0x237bf4={};var _0x203a1e={};var _0x52aa21;var _0x2e62e7;return db['ChatGroup'][_0xa482('0x57')]({'where':{'id':_0x3078ad[_0xa482('0x4a')]['id']}})[_0xa482('0x2a')](handleEntityNotFound(_0x2049fa,null))[_0xa482('0x2a')](function(_0x468868){if(_0x468868){_0x52aa21=_0x468868;_0x203a1e['model']=_['keys'](db['User'][_0xa482('0x4b')]);_0x203a1e[_0xa482('0x37')]=_[_0xa482('0x36')](_0x3078ad[_0xa482('0x37')]);_0x203a1e['filters']=_[_0xa482('0x39')](_0x203a1e[_0xa482('0x34')],_0x203a1e[_0xa482('0x37')]);_0x237bf4[_0xa482('0x3a')]=_['intersection'](_0x203a1e[_0xa482('0x34')],qs[_0xa482('0x3b')](_0x3078ad[_0xa482('0x37')][_0xa482('0x3b')]));_0x237bf4[_0xa482('0x3a')]=_0x237bf4[_0xa482('0x3a')][_0xa482('0x4c')]?_0x237bf4[_0xa482('0x3a')]:_0x203a1e['model'];_0x237bf4[_0xa482('0x3d')]=qs[_0xa482('0x3e')](_0x3078ad[_0xa482('0x37')]['sort']);_0x237bf4[_0xa482('0x3f')]=qs['filters'](_['pick'](_0x3078ad[_0xa482('0x37')],_0x203a1e['filters']));if(_0x3078ad['query'][_0xa482('0x41')]){_0x237bf4[_0xa482('0x3f')]=_['merge'](_0x237bf4[_0xa482('0x3f')],{'$or':_[_0xa482('0x35')](_0x237bf4[_0xa482('0x3a')],function(_0x2dedc0){var _0x165c70={};_0x165c70[_0x2dedc0]={'$like':'%'+_0x3078ad['query'][_0xa482('0x41')]+'%'};return _0x165c70;})});}_0x237bf4=_[_0xa482('0x42')]({},_0x237bf4,_0x3078ad['options']);return _0x52aa21[_0xa482('0x56')](_0x237bf4);}})[_0xa482('0x2a')](function(_0x33cefa){if(_0x33cefa){_0x2e62e7=_0x33cefa[_0xa482('0x4c')];if(!_0x3078ad[_0xa482('0x37')][_0xa482('0x58')]('nolimit')){_0x237bf4[_0xa482('0x22')]=qs[_0xa482('0x22')](_0x3078ad[_0xa482('0x37')][_0xa482('0x22')]);_0x237bf4[_0xa482('0x20')]=qs[_0xa482('0x20')](_0x3078ad[_0xa482('0x37')]['offset']);}return _0x52aa21['getMembers'](_0x237bf4);}})['then'](function(_0x4ab26){if(_0x4ab26){return _0x4ab26?{'count':_0x2e62e7,'rows':_0x4ab26}:null;}})[_0xa482('0x2a')](respondWithResult(_0x2049fa,null))[_0xa482('0x48')](handleError(_0x2049fa,null));};exports['removeMembers']=function(_0x10e0c4,_0x472fd1,_0x33c7a0){return db['ChatGroup'][_0xa482('0x4d')]({'where':{'id':_0x10e0c4[_0xa482('0x4a')]['id']}})['then'](handleEntityNotFound(_0x472fd1,null))['then'](function(_0x936ad0){if(_0x936ad0){return _0x936ad0[_0xa482('0x59')](_0x10e0c4['query']['ids']);}})[_0xa482('0x2a')](respondWithStatusCode(_0x472fd1,null))[_0xa482('0x48')](handleError(_0x472fd1,null));};exports[_0xa482('0x5a')]=function(_0x4e3742,_0x239e48,_0x28c7d6){if(_0x4e3742[_0xa482('0x4f')]['id']){delete _0x4e3742[_0xa482('0x4f')]['id'];}return db[_0xa482('0x31')][_0xa482('0x4d')]({'where':{'id':_0x4e3742['params']['id']}})['then'](handleEntityNotFound(_0x239e48,null))[_0xa482('0x2a')](function(_0x3f71d3){if(_0x3f71d3){_0x4e3742[_0xa482('0x4f')][_0xa482('0x5b')]=_0x3f71d3['id'];return db[_0xa482('0x51')][_0xa482('0x4e')](_0x4e3742[_0xa482('0x4f')]);}})['then'](respondWithResult(_0x239e48,null))[_0xa482('0x48')](handleError(_0x239e48,null));};exports[_0xa482('0x5c')]=function(_0x204c3b,_0x2e160a,_0x26da0e){var _0x57c185={};var _0x8d95db={};var _0xaf7ccf;var _0x3543cd;return db['ChatGroup'][_0xa482('0x57')]({'where':{'id':_0x204c3b[_0xa482('0x4a')]['id']}})[_0xa482('0x2a')](handleEntityNotFound(_0x2e160a,null))[_0xa482('0x2a')](function(_0x529b00){if(_0x529b00){_0xaf7ccf=_0x529b00;_0x8d95db['model']=_[_0xa482('0x36')](db[_0xa482('0x51')][_0xa482('0x4b')]);_0x8d95db[_0xa482('0x37')]=_[_0xa482('0x36')](_0x204c3b['query']);_0x8d95db['filters']=_['intersection'](_0x8d95db[_0xa482('0x34')],_0x8d95db[_0xa482('0x37')]);_0x57c185[_0xa482('0x3a')]=_['intersection'](_0x8d95db['model'],qs[_0xa482('0x3b')](_0x204c3b['query']['fields']));_0x57c185[_0xa482('0x3a')]=_0x57c185[_0xa482('0x3a')][_0xa482('0x4c')]?_0x57c185[_0xa482('0x3a')]:_0x8d95db[_0xa482('0x34')];_0x57c185[_0xa482('0x3d')]=qs[_0xa482('0x3e')](_0x204c3b[_0xa482('0x37')]['sort']);_0x57c185[_0xa482('0x3f')]=qs[_0xa482('0x38')](_[_0xa482('0x40')](_0x204c3b['query'],_0x8d95db[_0xa482('0x38')]));if(_0x204c3b[_0xa482('0x37')][_0xa482('0x41')]){_0x57c185[_0xa482('0x3f')]=_['merge'](_0x57c185[_0xa482('0x3f')],{'$or':_[_0xa482('0x35')](_0x57c185['attributes'],function(_0x35c35f){var _0x29df92={};_0x29df92[_0x35c35f]={'$like':'%'+_0x204c3b['query']['filter']+'%'};return _0x29df92;})});}if(_0x204c3b[_0xa482('0x37')][_0xa482('0x5d')]){var _0x573487=_0x204c3b[_0xa482('0x37')][_0xa482('0x5d')][_0xa482('0x5e')](',');var _0x469280={};_0x469280[_0x573487[0x0]]={'$gte':moment(_0x573487[0x1])[_0xa482('0x5f')]('YYYY-MM-DD\x20HH:mm:ss')};_0x57c185[_0xa482('0x3f')]=_[_0xa482('0x42')](_0x57c185[_0xa482('0x3f')],_0x469280);}_0x57c185=_[_0xa482('0x42')]({},_0x57c185,_0x204c3b[_0xa482('0x44')]);return _0xaf7ccf[_0xa482('0x5c')](_0x57c185);}})[_0xa482('0x2a')](function(_0x2dc538){if(_0x2dc538){_0x3543cd=_0x2dc538['length'];if(!_0x204c3b[_0xa482('0x37')][_0xa482('0x58')](_0xa482('0x3c'))){_0x57c185[_0xa482('0x22')]=qs[_0xa482('0x22')](_0x204c3b[_0xa482('0x37')][_0xa482('0x22')]);_0x57c185[_0xa482('0x20')]=qs[_0xa482('0x20')](_0x204c3b['query']['offset']);}return _0xaf7ccf['getMessages'](_0x57c185);}})[_0xa482('0x2a')](function(_0x15e6c4){if(_0x15e6c4){return _0x15e6c4?{'count':_0x3543cd,'rows':_0x15e6c4}:null;}})[_0xa482('0x2a')](respondWithResult(_0x2e160a,null))[_0xa482('0x48')](handleError(_0x2e160a,null));}; \ No newline at end of file +var _0xee89=['pick','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','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','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','ChatGroup','includeAll','include','catch','show','create','body','find','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','length','nolimit','removeMembers','addMessage','ChatGroupId','getMessages'];(function(_0x2b10b6,_0x3e54fa){var _0x28a925=function(_0x21fa59){while(--_0x21fa59){_0x2b10b6['push'](_0x2b10b6['shift']());}};_0x28a925(++_0x3e54fa);}(_0xee89,0x69));var _0x9ee8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xee89[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x9ee8('0x0'));var rimraf=require(_0x9ee8('0x1'));var zipdir=require(_0x9ee8('0x2'));var jsonpatch=require(_0x9ee8('0x3'));var rp=require('request-promise');var moment=require(_0x9ee8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9ee8('0x5'));var util=require(_0x9ee8('0x6'));var path=require(_0x9ee8('0x7'));var sox=require(_0x9ee8('0x8'));var csv=require(_0x9ee8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ee8('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9ee8('0xb'));var deskjs=require(_0x9ee8('0xc'));var toCsv=require(_0x9ee8('0x9'));var querystring=require(_0x9ee8('0xd'));var Papa=require(_0x9ee8('0xe'));var Redis=require(_0x9ee8('0xf'));var authService=require(_0x9ee8('0x10'));var qs=require(_0x9ee8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9ee8('0x12'));var logger=require(_0x9ee8('0x13'))(_0x9ee8('0x14'));var utils=require(_0x9ee8('0x15'));var config=require(_0x9ee8('0x16'));var licenseUtil=require(_0x9ee8('0x17'));var db=require(_0x9ee8('0x18'))['db'];config['redis']=_[_0x9ee8('0x19')](config[_0x9ee8('0x1a')],{'host':_0x9ee8('0x1b'),'port':0x18eb});var socket=require(_0x9ee8('0x1c'))(new Redis(config[_0x9ee8('0x1a')]));require(_0x9ee8('0x1d'))['register'](socket);function respondWithStatusCode(_0xc57834,_0x39c3c0){_0x39c3c0=_0x39c3c0||0xcc;return function(_0x3abba0){if(_0x3abba0){return _0xc57834[_0x9ee8('0x1e')](_0x39c3c0);}return _0xc57834[_0x9ee8('0x1f')](_0x39c3c0)['end']();};}function respondWithResult(_0x1d0a40,_0x443a4c){_0x443a4c=_0x443a4c||0xc8;return function(_0x43ba76){if(_0x43ba76){return _0x1d0a40[_0x9ee8('0x1f')](_0x443a4c)[_0x9ee8('0x20')](_0x43ba76);}};}function respondWithFilteredResult(_0x3d621a,_0x33beb3){return function(_0x226700){if(_0x226700){var _0x4cd089=typeof _0x33beb3[_0x9ee8('0x21')]===_0x9ee8('0x22')&&typeof _0x33beb3[_0x9ee8('0x23')]===_0x9ee8('0x22');var _0x1990dc=_0x226700[_0x9ee8('0x24')];var _0x57a20f=_0x4cd089?0x0:_0x33beb3[_0x9ee8('0x21')];var _0x240695=_0x4cd089?_0x226700['count']:_0x33beb3['offset']+_0x33beb3['limit'];var _0x3d5136;if(_0x240695>=_0x1990dc){_0x240695=_0x1990dc;_0x3d5136=0xc8;}else{_0x3d5136=0xce;}_0x3d621a[_0x9ee8('0x1f')](_0x3d5136);return _0x3d621a['set'](_0x9ee8('0x25'),_0x57a20f+'-'+_0x240695+'/'+_0x1990dc)[_0x9ee8('0x20')](_0x226700);}return null;};}function patchUpdates(_0x2b7fb0){return function(_0x2b7de9){try{jsonpatch[_0x9ee8('0x26')](_0x2b7de9,_0x2b7fb0,!![]);}catch(_0x515112){return BPromise[_0x9ee8('0x27')](_0x515112);}return _0x2b7de9[_0x9ee8('0x28')]();};}function saveUpdates(_0x4d55ab,_0x39b44f){return function(_0x6bfea5){if(_0x6bfea5){return _0x6bfea5[_0x9ee8('0x29')](_0x4d55ab)[_0x9ee8('0x2a')](function(_0x157d70){return _0x157d70;});}return null;};}function removeEntity(_0x3904e5,_0xecf2d0){return function(_0x4988d2){if(_0x4988d2){return _0x4988d2[_0x9ee8('0x2b')]()[_0x9ee8('0x2a')](function(){_0x3904e5[_0x9ee8('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x305f9d,_0x35ab9c){return function(_0x5887e6){if(!_0x5887e6){_0x305f9d[_0x9ee8('0x1e')](0x194);}return _0x5887e6;};}function handleError(_0x19b5d2,_0x11581c){_0x11581c=_0x11581c||0x1f4;return function(_0x442e61){logger[_0x9ee8('0x2c')](_0x442e61[_0x9ee8('0x2d')]);if(_0x442e61[_0x9ee8('0x2e')]){delete _0x442e61[_0x9ee8('0x2e')];}_0x19b5d2[_0x9ee8('0x1f')](_0x11581c)[_0x9ee8('0x2f')](_0x442e61);};}exports[_0x9ee8('0x30')]=function(_0xb08761,_0xdd817d){var _0x479e81={},_0x6c3c6a={},_0x1a393a={'count':0x0,'rows':[]};var _0x347b67=_[_0x9ee8('0x31')](db['ChatGroup'][_0x9ee8('0x32')],function(_0x2d609d){return{'name':_0x2d609d[_0x9ee8('0x33')],'type':_0x2d609d[_0x9ee8('0x34')][_0x9ee8('0x35')]};});_0x6c3c6a['model']=_[_0x9ee8('0x31')](_0x347b67,_0x9ee8('0x2e'));_0x6c3c6a[_0x9ee8('0x36')]=_[_0x9ee8('0x37')](_0xb08761[_0x9ee8('0x36')]);_0x6c3c6a[_0x9ee8('0x38')]=_[_0x9ee8('0x39')](_0x6c3c6a['model'],_0x6c3c6a[_0x9ee8('0x36')]);_0x479e81[_0x9ee8('0x3a')]=_['intersection'](_0x6c3c6a[_0x9ee8('0x3b')],qs[_0x9ee8('0x3c')](_0xb08761[_0x9ee8('0x36')]['fields']));_0x479e81[_0x9ee8('0x3a')]=_0x479e81['attributes']['length']?_0x479e81[_0x9ee8('0x3a')]:_0x6c3c6a['model'];if(!_0xb08761['query'][_0x9ee8('0x3d')]('nolimit')){_0x479e81[_0x9ee8('0x23')]=qs[_0x9ee8('0x23')](_0xb08761[_0x9ee8('0x36')][_0x9ee8('0x23')]);_0x479e81[_0x9ee8('0x21')]=qs['offset'](_0xb08761[_0x9ee8('0x36')][_0x9ee8('0x21')]);}_0x479e81[_0x9ee8('0x3e')]=qs['sort'](_0xb08761[_0x9ee8('0x36')][_0x9ee8('0x3f')]);_0x479e81[_0x9ee8('0x40')]=qs[_0x9ee8('0x38')](_['pick'](_0xb08761[_0x9ee8('0x36')],_0x6c3c6a[_0x9ee8('0x38')]),_0x347b67);if(_0xb08761['query']['filter']){_0x479e81['where']=_[_0x9ee8('0x41')](_0x479e81[_0x9ee8('0x40')],{'$or':_[_0x9ee8('0x31')](_0x347b67,function(_0xbd83e3){if(_0xbd83e3[_0x9ee8('0x34')]!==_0x9ee8('0x42')){var _0x219ac5={};_0x219ac5[_0xbd83e3[_0x9ee8('0x2e')]]={'$like':'%'+_0xb08761[_0x9ee8('0x36')][_0x9ee8('0x43')]+'%'};return _0x219ac5;}})});}_0x479e81=_[_0x9ee8('0x41')]({},_0x479e81,_0xb08761[_0x9ee8('0x44')]);var _0x39d648={'where':_0x479e81['where']};return db[_0x9ee8('0x45')][_0x9ee8('0x24')](_0x39d648)[_0x9ee8('0x2a')](function(_0x2fdf06){_0x1a393a[_0x9ee8('0x24')]=_0x2fdf06;if(_0xb08761[_0x9ee8('0x36')][_0x9ee8('0x46')]){_0x479e81[_0x9ee8('0x47')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x479e81);})[_0x9ee8('0x2a')](function(_0x58289b){_0x1a393a['rows']=_0x58289b;return _0x1a393a;})['then'](respondWithFilteredResult(_0xdd817d,_0x479e81))[_0x9ee8('0x48')](handleError(_0xdd817d,null));};exports[_0x9ee8('0x49')]=function(_0x23c334,_0x1c6936){var _0x1f4bbc={'raw':!![],'where':{'id':_0x23c334['params']['id']}},_0x17a285={};_0x17a285[_0x9ee8('0x3b')]=_[_0x9ee8('0x37')](db[_0x9ee8('0x45')][_0x9ee8('0x32')]);_0x17a285[_0x9ee8('0x36')]=_[_0x9ee8('0x37')](_0x23c334['query']);_0x17a285[_0x9ee8('0x38')]=_[_0x9ee8('0x39')](_0x17a285[_0x9ee8('0x3b')],_0x17a285[_0x9ee8('0x36')]);_0x1f4bbc['attributes']=_[_0x9ee8('0x39')](_0x17a285[_0x9ee8('0x3b')],qs[_0x9ee8('0x3c')](_0x23c334[_0x9ee8('0x36')]['fields']));_0x1f4bbc[_0x9ee8('0x3a')]=_0x1f4bbc[_0x9ee8('0x3a')]['length']?_0x1f4bbc[_0x9ee8('0x3a')]:_0x17a285[_0x9ee8('0x3b')];if(_0x23c334[_0x9ee8('0x36')][_0x9ee8('0x46')]){_0x1f4bbc['include']=[{'all':!![]}];}_0x1f4bbc=_[_0x9ee8('0x41')]({},_0x1f4bbc,_0x23c334[_0x9ee8('0x44')]);return db['ChatGroup']['find'](_0x1f4bbc)[_0x9ee8('0x2a')](handleEntityNotFound(_0x1c6936,null))[_0x9ee8('0x2a')](respondWithResult(_0x1c6936,null))[_0x9ee8('0x48')](handleError(_0x1c6936,null));};exports[_0x9ee8('0x4a')]=function(_0xcd46ab,_0x10870e){return db[_0x9ee8('0x45')][_0x9ee8('0x4a')](_0xcd46ab['body'],{})[_0x9ee8('0x2a')](respondWithResult(_0x10870e,0xc9))[_0x9ee8('0x48')](handleError(_0x10870e,null));};exports['update']=function(_0x1a6a02,_0x424937){if(_0x1a6a02[_0x9ee8('0x4b')]['id']){delete _0x1a6a02['body']['id'];}return db[_0x9ee8('0x45')][_0x9ee8('0x4c')]({'where':{'id':_0x1a6a02[_0x9ee8('0x4d')]['id']}})[_0x9ee8('0x2a')](handleEntityNotFound(_0x424937,null))['then'](saveUpdates(_0x1a6a02['body'],null))[_0x9ee8('0x2a')](respondWithResult(_0x424937,null))[_0x9ee8('0x48')](handleError(_0x424937,null));};exports[_0x9ee8('0x2b')]=function(_0x5958b4,_0x2b4b0f){return db[_0x9ee8('0x45')][_0x9ee8('0x4c')]({'where':{'id':_0x5958b4[_0x9ee8('0x4d')]['id']}})[_0x9ee8('0x2a')](handleEntityNotFound(_0x2b4b0f,null))[_0x9ee8('0x2a')](removeEntity(_0x2b4b0f,null))[_0x9ee8('0x48')](handleError(_0x2b4b0f,null));};exports['describe']=function(_0x3f86a4,_0x13b545){return db['ChatGroup'][_0x9ee8('0x4e')]()[_0x9ee8('0x2a')](respondWithResult(_0x13b545,null))[_0x9ee8('0x48')](handleError(_0x13b545,null));};exports[_0x9ee8('0x4f')]=function(_0x41015b,_0x1a128c,_0x3080cf){return db[_0x9ee8('0x50')][_0x9ee8('0x24')]({'where':{'ChatGroupId':_0x41015b[_0x9ee8('0x4d')]['id'],'ToId':_0x41015b[_0x9ee8('0x51')]['id'],'read':![]}})[_0x9ee8('0x2a')](function(_0x2fbccb){return{'id':_[_0x9ee8('0x52')](_0x41015b['params']['id']),'count':_0x2fbccb};})[_0x9ee8('0x2a')](respondWithResult(_0x1a128c,null))[_0x9ee8('0x48')](handleError(_0x1a128c,null));};exports[_0x9ee8('0x53')]=function(_0x3a5a7a,_0x59b8fd,_0x318f15){return db[_0x9ee8('0x45')][_0x9ee8('0x4c')]({'where':{'id':_0x3a5a7a['params']['id']}})['then'](handleEntityNotFound(_0x59b8fd,null))[_0x9ee8('0x2a')](function(_0x5518cd){if(_0x5518cd){return _0x5518cd['addMembers'](_0x3a5a7a[_0x9ee8('0x4b')][_0x9ee8('0x54')],_[_0x9ee8('0x55')](_0x3a5a7a[_0x9ee8('0x4b')],[_0x9ee8('0x54'),'id'])||{});}})['then'](respondWithResult(_0x59b8fd,null))[_0x9ee8('0x48')](handleError(_0x59b8fd,null));};exports[_0x9ee8('0x56')]=function(_0x9a8fa9,_0x56aa3b,_0x29a636){var _0x182e9f={};var _0x941e6={};var _0x21680c;var _0x5b759e;return db[_0x9ee8('0x45')][_0x9ee8('0x57')]({'where':{'id':_0x9a8fa9[_0x9ee8('0x4d')]['id']}})[_0x9ee8('0x2a')](handleEntityNotFound(_0x56aa3b,null))['then'](function(_0x48a92a){if(_0x48a92a){_0x21680c=_0x48a92a;_0x941e6[_0x9ee8('0x3b')]=_[_0x9ee8('0x37')](db[_0x9ee8('0x58')]['rawAttributes']);_0x941e6[_0x9ee8('0x36')]=_[_0x9ee8('0x37')](_0x9a8fa9[_0x9ee8('0x36')]);_0x941e6[_0x9ee8('0x38')]=_[_0x9ee8('0x39')](_0x941e6[_0x9ee8('0x3b')],_0x941e6[_0x9ee8('0x36')]);_0x182e9f['attributes']=_['intersection'](_0x941e6[_0x9ee8('0x3b')],qs[_0x9ee8('0x3c')](_0x9a8fa9['query'][_0x9ee8('0x3c')]));_0x182e9f[_0x9ee8('0x3a')]=_0x182e9f[_0x9ee8('0x3a')][_0x9ee8('0x59')]?_0x182e9f[_0x9ee8('0x3a')]:_0x941e6[_0x9ee8('0x3b')];_0x182e9f[_0x9ee8('0x3e')]=qs[_0x9ee8('0x3f')](_0x9a8fa9['query'][_0x9ee8('0x3f')]);_0x182e9f[_0x9ee8('0x40')]=qs[_0x9ee8('0x38')](_['pick'](_0x9a8fa9[_0x9ee8('0x36')],_0x941e6[_0x9ee8('0x38')]));if(_0x9a8fa9[_0x9ee8('0x36')][_0x9ee8('0x43')]){_0x182e9f[_0x9ee8('0x40')]=_[_0x9ee8('0x41')](_0x182e9f['where'],{'$or':_['map'](_0x182e9f[_0x9ee8('0x3a')],function(_0x83785c){var _0x4fd8f1={};_0x4fd8f1[_0x83785c]={'$like':'%'+_0x9a8fa9[_0x9ee8('0x36')][_0x9ee8('0x43')]+'%'};return _0x4fd8f1;})});}_0x182e9f=_['merge']({},_0x182e9f,_0x9a8fa9[_0x9ee8('0x44')]);return _0x21680c[_0x9ee8('0x56')](_0x182e9f);}})[_0x9ee8('0x2a')](function(_0x472c2e){if(_0x472c2e){_0x5b759e=_0x472c2e[_0x9ee8('0x59')];if(!_0x9a8fa9[_0x9ee8('0x36')]['hasOwnProperty'](_0x9ee8('0x5a'))){_0x182e9f[_0x9ee8('0x23')]=qs['limit'](_0x9a8fa9['query']['limit']);_0x182e9f[_0x9ee8('0x21')]=qs[_0x9ee8('0x21')](_0x9a8fa9[_0x9ee8('0x36')]['offset']);}return _0x21680c[_0x9ee8('0x56')](_0x182e9f);}})[_0x9ee8('0x2a')](function(_0x11df3c){if(_0x11df3c){return _0x11df3c?{'count':_0x5b759e,'rows':_0x11df3c}:null;}})[_0x9ee8('0x2a')](respondWithResult(_0x56aa3b,null))['catch'](handleError(_0x56aa3b,null));};exports[_0x9ee8('0x5b')]=function(_0x2f70d5,_0x1b82f4,_0x167c3c){return db[_0x9ee8('0x45')]['find']({'where':{'id':_0x2f70d5[_0x9ee8('0x4d')]['id']}})[_0x9ee8('0x2a')](handleEntityNotFound(_0x1b82f4,null))[_0x9ee8('0x2a')](function(_0x1f8846){if(_0x1f8846){return _0x1f8846[_0x9ee8('0x5b')](_0x2f70d5[_0x9ee8('0x36')]['ids']);}})[_0x9ee8('0x2a')](respondWithStatusCode(_0x1b82f4,null))['catch'](handleError(_0x1b82f4,null));};exports[_0x9ee8('0x5c')]=function(_0x12cf30,_0xe94f00,_0x183b20){if(_0x12cf30[_0x9ee8('0x4b')]['id']){delete _0x12cf30[_0x9ee8('0x4b')]['id'];}return db[_0x9ee8('0x45')]['find']({'where':{'id':_0x12cf30[_0x9ee8('0x4d')]['id']}})[_0x9ee8('0x2a')](handleEntityNotFound(_0xe94f00,null))[_0x9ee8('0x2a')](function(_0x48b0da){if(_0x48b0da){_0x12cf30['body'][_0x9ee8('0x5d')]=_0x48b0da['id'];return db[_0x9ee8('0x50')][_0x9ee8('0x4a')](_0x12cf30[_0x9ee8('0x4b')]);}})[_0x9ee8('0x2a')](respondWithResult(_0xe94f00,null))[_0x9ee8('0x48')](handleError(_0xe94f00,null));};exports[_0x9ee8('0x5e')]=function(_0x20c4f6,_0xdfe2fb,_0x109665){var _0x32a97a={};var _0x564429={};var _0x154477;var _0x52ce07;return db[_0x9ee8('0x45')][_0x9ee8('0x57')]({'where':{'id':_0x20c4f6[_0x9ee8('0x4d')]['id']}})['then'](handleEntityNotFound(_0xdfe2fb,null))[_0x9ee8('0x2a')](function(_0x475fcd){if(_0x475fcd){_0x154477=_0x475fcd;_0x564429[_0x9ee8('0x3b')]=_[_0x9ee8('0x37')](db[_0x9ee8('0x50')][_0x9ee8('0x32')]);_0x564429[_0x9ee8('0x36')]=_[_0x9ee8('0x37')](_0x20c4f6['query']);_0x564429[_0x9ee8('0x38')]=_[_0x9ee8('0x39')](_0x564429[_0x9ee8('0x3b')],_0x564429[_0x9ee8('0x36')]);_0x32a97a[_0x9ee8('0x3a')]=_['intersection'](_0x564429['model'],qs['fields'](_0x20c4f6[_0x9ee8('0x36')]['fields']));_0x32a97a['attributes']=_0x32a97a[_0x9ee8('0x3a')][_0x9ee8('0x59')]?_0x32a97a['attributes']:_0x564429[_0x9ee8('0x3b')];_0x32a97a['order']=qs['sort'](_0x20c4f6[_0x9ee8('0x36')][_0x9ee8('0x3f')]);_0x32a97a[_0x9ee8('0x40')]=qs[_0x9ee8('0x38')](_[_0x9ee8('0x5f')](_0x20c4f6[_0x9ee8('0x36')],_0x564429['filters']));if(_0x20c4f6[_0x9ee8('0x36')][_0x9ee8('0x43')]){_0x32a97a[_0x9ee8('0x40')]=_[_0x9ee8('0x41')](_0x32a97a[_0x9ee8('0x40')],{'$or':_[_0x9ee8('0x31')](_0x32a97a[_0x9ee8('0x3a')],function(_0x5ae071){var _0x5d908d={};_0x5d908d[_0x5ae071]={'$like':'%'+_0x20c4f6['query'][_0x9ee8('0x43')]+'%'};return _0x5d908d;})});}if(_0x20c4f6[_0x9ee8('0x36')][_0x9ee8('0x60')]){var _0x5f0492=_0x20c4f6[_0x9ee8('0x36')][_0x9ee8('0x60')][_0x9ee8('0x61')](',');var _0x39d1e7={};_0x39d1e7[_0x5f0492[0x0]]={'$gte':moment(_0x5f0492[0x1])[_0x9ee8('0x62')](_0x9ee8('0x63'))};_0x32a97a['where']=_[_0x9ee8('0x41')](_0x32a97a[_0x9ee8('0x40')],_0x39d1e7);}_0x32a97a=_[_0x9ee8('0x41')]({},_0x32a97a,_0x20c4f6[_0x9ee8('0x44')]);return _0x154477[_0x9ee8('0x5e')](_0x32a97a);}})[_0x9ee8('0x2a')](function(_0x1ed94b){if(_0x1ed94b){_0x52ce07=_0x1ed94b[_0x9ee8('0x59')];if(!_0x20c4f6['query'][_0x9ee8('0x3d')]('nolimit')){_0x32a97a[_0x9ee8('0x23')]=qs['limit'](_0x20c4f6[_0x9ee8('0x36')]['limit']);_0x32a97a['offset']=qs[_0x9ee8('0x21')](_0x20c4f6[_0x9ee8('0x36')][_0x9ee8('0x21')]);}return _0x154477[_0x9ee8('0x5e')](_0x32a97a);}})[_0x9ee8('0x2a')](function(_0x4b848b){if(_0x4b848b){return _0x4b848b?{'count':_0x52ce07,'rows':_0x4b848b}:null;}})[_0x9ee8('0x2a')](respondWithResult(_0xdfe2fb,null))['catch'](handleError(_0xdfe2fb,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index fb80c65..80e0460 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 _0xb403=['../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0x5451f3,_0x27cc69){var _0x5cdd1b=function(_0x36dd2c){while(--_0x36dd2c){_0x5451f3['push'](_0x5451f3['shift']());}};_0x5cdd1b(++_0x27cc69);}(_0xb403,0x15e));var _0x3b40=function(_0x483e3a,_0x568361){_0x483e3a=_0x483e3a-0x0;var _0x43fca9=_0xb403[_0x483e3a];return _0x43fca9;};'use strict';var EventEmitter=require(_0x3b40('0x0'));var ChatGroup=require(_0x3b40('0x1'))['db'][_0x3b40('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x3b40('0x3')](0x0);var events={'afterCreate':_0x3b40('0x4'),'afterUpdate':_0x3b40('0x5'),'afterDestroy':_0x3b40('0x6')};function emitEvent(_0xd9709d){return function(_0x992302,_0x5d56d7,_0x6d56d3){ChatGroupEvents[_0x3b40('0x7')](_0xd9709d+':'+_0x992302['id'],_0x992302);ChatGroupEvents[_0x3b40('0x7')](_0xd9709d,_0x992302);_0x6d56d3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x3b40('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0xe07e=['emit','hasOwnProperty','ChatGroup','setMaxListeners','save','update','remove'];(function(_0x4b13ce,_0x339cb0){var _0x427d4b=function(_0x26aaad){while(--_0x26aaad){_0x4b13ce['push'](_0x4b13ce['shift']());}};_0x427d4b(++_0x339cb0);}(_0xe07e,0xa3));var _0xee07=function(_0x5ba74f,_0x200bf4){_0x5ba74f=_0x5ba74f-0x0;var _0x534d79=_0xe07e[_0x5ba74f];return _0x534d79;};'use strict';var EventEmitter=require('events');var ChatGroup=require('../../mysqldb')['db'][_0xee07('0x0')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xee07('0x1')](0x0);var events={'afterCreate':_0xee07('0x2'),'afterUpdate':_0xee07('0x3'),'afterDestroy':_0xee07('0x4')};function emitEvent(_0x45b993){return function(_0x4cf4f5,_0xffcc84,_0xa0306b){ChatGroupEvents[_0xee07('0x5')](_0x45b993+':'+_0x4cf4f5['id'],_0x4cf4f5);ChatGroupEvents[_0xee07('0x5')](_0x45b993,_0x4cf4f5);_0xa0306b(null);};}for(var e in events){if(events[_0xee07('0x6')](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 1f57a45..e7aa58a 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 _0xdb1c=['define','ChatGroup','chat_groups','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1d8df7,_0x4bf7f7){var _0x36ded3=function(_0x5f41ec){while(--_0x5f41ec){_0x1d8df7['push'](_0x1d8df7['shift']());}};_0x36ded3(++_0x4bf7f7);}(_0xdb1c,0x1f2));var _0xcdb1=function(_0x4efd3d,_0x2b9694){_0x4efd3d=_0x4efd3d-0x0;var _0x1293f2=_0xdb1c[_0x4efd3d];return _0x1293f2;};'use strict';var _=require(_0xcdb1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcdb1('0x1'));var moment=require('moment');var BPromise=require(_0xcdb1('0x2'));var rp=require(_0xcdb1('0x3'));var fs=require('fs');var path=require(_0xcdb1('0x4'));var rimraf=require(_0xcdb1('0x5'));var config=require(_0xcdb1('0x6'));var attributes=require('./chatGroup.attributes');module[_0xcdb1('0x7')]=function(_0x4355a8,_0x57d536){return _0x4355a8[_0xcdb1('0x8')](_0xcdb1('0x9'),attributes,{'tableName':_0xcdb1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9f0=['../../config/logger','api','bluebird','request-promise','path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','chat_groups'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9f0,0x16b));var _0x0b9f=function(_0x45416d,_0x1f42bf){_0x45416d=_0x45416d-0x0;var _0x4d8666=_0xb9f0[_0x45416d];return _0x4d8666;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0b9f('0x0'))(_0x0b9f('0x1'));var moment=require('moment');var BPromise=require(_0x0b9f('0x2'));var rp=require(_0x0b9f('0x3'));var fs=require('fs');var path=require(_0x0b9f('0x4'));var rimraf=require(_0x0b9f('0x5'));var config=require('../../config/environment');var attributes=require(_0x0b9f('0x6'));module[_0x0b9f('0x7')]=function(_0x435dd3,_0x121156){return _0x435dd3[_0x0b9f('0x8')](_0x0b9f('0x9'),attributes,{'tableName':_0x0b9f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 2ca91a0..6779f1d 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 _0x64f5=['message','ChatGroup,\x20%s,\x20%s','result','catch','lodash','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0x64f5,0x17e));var _0x564f=function(_0x267f82,_0xb6de9c){_0x267f82=_0x267f82-0x0;var _0x5a7769=_0x64f5[_0x267f82];return _0x5a7769;};'use strict';var _=require(_0x564f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x564f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x564f('0x2'))['db'];var utils=require(_0x564f('0x3'));var logger=require('../../config/logger')(_0x564f('0x4'));var config=require(_0x564f('0x5'));var jayson=require(_0x564f('0x6'));var client=jayson[_0x564f('0x7')][_0x564f('0x8')]({'port':0x232a});config['redis']=_[_0x564f('0x9')](config[_0x564f('0xa')],{'host':_0x564f('0xb'),'port':0x18eb});var socket=require(_0x564f('0xc'))(new Redis(config[_0x564f('0xa')]));require(_0x564f('0xd'))[_0x564f('0xe')](socket);function respondWithRpcPromise(_0x2b49dc,_0xc3b20f,_0x3aa86a){return new BPromise(function(_0x45b060,_0x42f4b6){return client[_0x564f('0xf')](_0x2b49dc,_0x3aa86a)['then'](function(_0x58028b){logger[_0x564f('0x10')]('ChatGroup,\x20%s,\x20%s',_0xc3b20f,_0x564f('0x11'));logger[_0x564f('0x12')](_0x564f('0x13'),_0xc3b20f,'request\x20sent',JSON[_0x564f('0x14')](_0x58028b));if(_0x58028b[_0x564f('0x15')]){if(_0x58028b[_0x564f('0x15')][_0x564f('0x16')]===0x1f4){logger[_0x564f('0x15')]('ChatGroup,\x20%s,\x20%s',_0xc3b20f,_0x58028b['error'][_0x564f('0x17')]);return _0x42f4b6(_0x58028b[_0x564f('0x15')][_0x564f('0x17')]);}logger[_0x564f('0x15')](_0x564f('0x18'),_0xc3b20f,_0x58028b[_0x564f('0x15')][_0x564f('0x17')]);return _0x45b060(_0x58028b[_0x564f('0x15')][_0x564f('0x17')]);}else{logger[_0x564f('0x10')](_0x564f('0x18'),_0xc3b20f,'request\x20sent');_0x45b060(_0x58028b[_0x564f('0x19')][_0x564f('0x17')]);}})[_0x564f('0x1a')](function(_0xed14eb){logger[_0x564f('0x15')](_0x564f('0x18'),_0xc3b20f,_0xed14eb);_0x42f4b6(_0xed14eb);});});} \ No newline at end of file +var _0x23fe=['ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','redis','./chatGroup.socket','request','then'];(function(_0x2d65b3,_0x54b6c5){var _0x43589d=function(_0x1c255b){while(--_0x1c255b){_0x2d65b3['push'](_0x2d65b3['shift']());}};_0x43589d(++_0x54b6c5);}(_0x23fe,0x102));var _0xe23f=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x23fe[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0xe23f('0x0'));var util=require(_0xe23f('0x1'));var moment=require('moment');var BPromise=require(_0xe23f('0x2'));var rs=require(_0xe23f('0x3'));var fs=require('fs');var Redis=require(_0xe23f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe23f('0x5'));var logger=require(_0xe23f('0x6'))(_0xe23f('0x7'));var config=require(_0xe23f('0x8'));var jayson=require(_0xe23f('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xe23f('0xa')](config['redis'],{'host':_0xe23f('0xb'),'port':0x18eb});var socket=require(_0xe23f('0xc'))(new Redis(config[_0xe23f('0xd')]));require(_0xe23f('0xe'))['register'](socket);function respondWithRpcPromise(_0x8da3e5,_0x238a64,_0x40cc65){return new BPromise(function(_0x280c21,_0x879441){return client[_0xe23f('0xf')](_0x8da3e5,_0x40cc65)[_0xe23f('0x10')](function(_0x5caeea){logger['info'](_0xe23f('0x11'),_0x238a64,_0xe23f('0x12'));logger[_0xe23f('0x13')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x238a64,_0xe23f('0x12'),JSON[_0xe23f('0x14')](_0x5caeea));if(_0x5caeea[_0xe23f('0x15')]){if(_0x5caeea[_0xe23f('0x15')]['code']===0x1f4){logger[_0xe23f('0x15')](_0xe23f('0x11'),_0x238a64,_0x5caeea[_0xe23f('0x15')]['message']);return _0x879441(_0x5caeea[_0xe23f('0x15')]['message']);}logger[_0xe23f('0x15')](_0xe23f('0x11'),_0x238a64,_0x5caeea['error'][_0xe23f('0x16')]);return _0x280c21(_0x5caeea[_0xe23f('0x15')][_0xe23f('0x16')]);}else{logger[_0xe23f('0x17')](_0xe23f('0x11'),_0x238a64,'request\x20sent');_0x280c21(_0x5caeea['result'][_0xe23f('0x16')]);}})[_0xe23f('0x18')](function(_0x5b0c4d){logger[_0xe23f('0x15')](_0xe23f('0x11'),_0x238a64,_0x5b0c4d);_0x879441(_0x5b0c4d);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 8212290..c3689b5 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 _0x39ba=['update','chatGroup:','./chatGroup.events','save','remove'];(function(_0x3c578a,_0x42daac){var _0x1a4258=function(_0x277d67){while(--_0x277d67){_0x3c578a['push'](_0x3c578a['shift']());}};_0x1a4258(++_0x42daac);}(_0x39ba,0x179));var _0xa39b=function(_0x2570c7,_0x5a1c73){_0x2570c7=_0x2570c7-0x0;var _0x195524=_0x39ba[_0x2570c7];return _0x195524;};'use strict';var ChatGroupEvents=require(_0xa39b('0x0'));var events=[_0xa39b('0x1'),_0xa39b('0x2'),_0xa39b('0x3')];function createListener(_0x156ae0,_0x53eea6){return function(_0x3519e3){_0x53eea6['emit'](_0x156ae0,_0x3519e3);};}function removeListener(_0x4661e2,_0x46c980){return function(){ChatGroupEvents['removeListener'](_0x4661e2,_0x46c980);};}exports['register']=function(_0x5f5de8){for(var _0xd35fec=0x0,_0x2c012e=events['length'];_0xd35fec<_0x2c012e;_0xd35fec++){var _0x348301=events[_0xd35fec];var _0xf92b25=createListener(_0xa39b('0x4')+_0x348301,_0x5f5de8);ChatGroupEvents['on'](_0x348301,_0xf92b25);}}; \ No newline at end of file +var _0x0fc3=['remove','update','emit','removeListener','register','chatGroup:','./chatGroup.events','save'];(function(_0x58a9ad,_0x4429f2){var _0x52694d=function(_0x5b29bd){while(--_0x5b29bd){_0x58a9ad['push'](_0x58a9ad['shift']());}};_0x52694d(++_0x4429f2);}(_0x0fc3,0x1be));var _0x30fc=function(_0x2f3a2e,_0x40d83d){_0x2f3a2e=_0x2f3a2e-0x0;var _0x1d6975=_0x0fc3[_0x2f3a2e];return _0x1d6975;};'use strict';var ChatGroupEvents=require(_0x30fc('0x0'));var events=[_0x30fc('0x1'),_0x30fc('0x2'),_0x30fc('0x3')];function createListener(_0xc8c333,_0x44d5f9){return function(_0x3c0a19){_0x44d5f9[_0x30fc('0x4')](_0xc8c333,_0x3c0a19);};}function removeListener(_0x374799,_0x1eb147){return function(){ChatGroupEvents[_0x30fc('0x5')](_0x374799,_0x1eb147);};}exports[_0x30fc('0x6')]=function(_0x1a5435){for(var _0x27a92c=0x0,_0x2a6384=events['length'];_0x27a92c<_0x2a6384;_0x27a92c++){var _0x25e5f4=events[_0x27a92c];var _0x31aaf1=createListener(_0x30fc('0x7')+_0x25e5f4,_0x1a5435);ChatGroupEvents['on'](_0x25e5f4,_0x31aaf1);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 5e7b942..1882123 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 _0xa7b1=['describe','get','show','/:id/unread','/:id/members','getMembers','/:id/messages','getMessages','create','post','/:id','delete','removeMembers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','/describe'];(function(_0x36cfbb,_0x50af4a){var _0x201176=function(_0x40e3ab){while(--_0x40e3ab){_0x36cfbb['push'](_0x36cfbb['shift']());}};_0x201176(++_0x50af4a);}(_0xa7b1,0x19e));var _0x1a7b=function(_0x151b94,_0x46eca2){_0x151b94=_0x151b94-0x0;var _0x227173=_0xa7b1[_0x151b94];return _0x227173;};'use strict';var multer=require(_0x1a7b('0x0'));var util=require(_0x1a7b('0x1'));var path=require('path');var timeout=require(_0x1a7b('0x2'));var express=require(_0x1a7b('0x3'));var router=express[_0x1a7b('0x4')]();var fs_extra=require(_0x1a7b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1a7b('0x6'));var config=require(_0x1a7b('0x7'));var controller=require(_0x1a7b('0x8'));router['get']('/',auth[_0x1a7b('0x9')](),controller['index']);router['get'](_0x1a7b('0xa'),auth[_0x1a7b('0x9')](),controller[_0x1a7b('0xb')]);router[_0x1a7b('0xc')]('/:id',auth[_0x1a7b('0x9')](),controller[_0x1a7b('0xd')]);router[_0x1a7b('0xc')](_0x1a7b('0xe'),auth[_0x1a7b('0x9')](),controller['getUnread']);router['get'](_0x1a7b('0xf'),auth[_0x1a7b('0x9')](),controller[_0x1a7b('0x10')]);router['get'](_0x1a7b('0x11'),auth['isAuthenticated'](),controller[_0x1a7b('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1a7b('0x13')]);router['post'](_0x1a7b('0xf'),auth[_0x1a7b('0x9')](),controller['addMembers']);router[_0x1a7b('0x14')]('/:id/messages',auth[_0x1a7b('0x9')](),controller['addMessage']);router['put'](_0x1a7b('0x15'),auth['isAuthenticated'](),controller['update']);router[_0x1a7b('0x16')](_0x1a7b('0x15'),auth['isAuthenticated'](),controller['destroy']);router[_0x1a7b('0x16')](_0x1a7b('0xf'),auth[_0x1a7b('0x9')](),controller[_0x1a7b('0x17')]);module[_0x1a7b('0x18')]=router; \ No newline at end of file +var _0xa8b0=['index','describe','/:id','show','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated'];(function(_0x1f7dd8,_0xe3a542){var _0xda8840=function(_0x2999f6){while(--_0x2999f6){_0x1f7dd8['push'](_0x1f7dd8['shift']());}};_0xda8840(++_0xe3a542);}(_0xa8b0,0x150));var _0x0a8b=function(_0x42d1f8,_0x22e529){_0x42d1f8=_0x42d1f8-0x0;var _0x40d234=_0xa8b0[_0x42d1f8];return _0x40d234;};'use strict';var multer=require(_0x0a8b('0x0'));var util=require(_0x0a8b('0x1'));var path=require('path');var timeout=require(_0x0a8b('0x2'));var express=require(_0x0a8b('0x3'));var router=express[_0x0a8b('0x4')]();var fs_extra=require(_0x0a8b('0x5'));var auth=require(_0x0a8b('0x6'));var interaction=require(_0x0a8b('0x7'));var config=require(_0x0a8b('0x8'));var controller=require(_0x0a8b('0x9'));router[_0x0a8b('0xa')]('/',auth[_0x0a8b('0xb')](),controller[_0x0a8b('0xc')]);router[_0x0a8b('0xa')]('/describe',auth[_0x0a8b('0xb')](),controller[_0x0a8b('0xd')]);router[_0x0a8b('0xa')](_0x0a8b('0xe'),auth[_0x0a8b('0xb')](),controller[_0x0a8b('0xf')]);router[_0x0a8b('0xa')]('/:id/unread',auth[_0x0a8b('0xb')](),controller['getUnread']);router[_0x0a8b('0xa')](_0x0a8b('0x10'),auth[_0x0a8b('0xb')](),controller[_0x0a8b('0x11')]);router[_0x0a8b('0xa')](_0x0a8b('0x12'),auth['isAuthenticated'](),controller[_0x0a8b('0x13')]);router[_0x0a8b('0x14')]('/',auth[_0x0a8b('0xb')](),controller[_0x0a8b('0x15')]);router[_0x0a8b('0x14')](_0x0a8b('0x10'),auth['isAuthenticated'](),controller[_0x0a8b('0x16')]);router[_0x0a8b('0x14')](_0x0a8b('0x12'),auth[_0x0a8b('0xb')](),controller[_0x0a8b('0x17')]);router[_0x0a8b('0x18')]('/:id',auth[_0x0a8b('0xb')](),controller[_0x0a8b('0x19')]);router[_0x0a8b('0x1a')](_0x0a8b('0xe'),auth[_0x0a8b('0xb')](),controller[_0x0a8b('0x1b')]);router[_0x0a8b('0x1a')](_0x0a8b('0x10'),auth['isAuthenticated'](),controller['removeMembers']);module[_0x0a8b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 39491c6..dd84904 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 _0xd6e6=['TEXT','STRING','DATE','sequelize','BOOLEAN','INTEGER','ENUM','star'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0xd6e6,0x193));var _0x6d6e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd6e6[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x6d6e('0x0'));module['exports']={'closed':{'type':Sequelize[_0x6d6e('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x6d6e('0x2')]},'ratingType':{'type':Sequelize[_0x6d6e('0x3')](_0x6d6e('0x4'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x6d6e('0x5')]},'pathTranscript':{'type':Sequelize[_0x6d6e('0x5')]},'mailTranscript':{'type':Sequelize[_0x6d6e('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x6d6e('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6d6e('0x6')]},'note':{'type':Sequelize[_0x6d6e('0x6')]},'browserName':{'type':Sequelize[_0x6d6e('0x6')]},'browserVersion':{'type':Sequelize[_0x6d6e('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x6d6e('0x6')]},'deviceModel':{'type':Sequelize[_0x6d6e('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x6d6e('0x6')]},'referer':{'type':Sequelize[_0x6d6e('0x5')]},'customerIp':{'type':Sequelize[_0x6d6e('0x6')]},'formData':{'type':Sequelize[_0x6d6e('0x5')]('long')},'read1stAt':{'type':Sequelize[_0x6d6e('0x7')]},'lastMsgAt':{'type':Sequelize[_0x6d6e('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x6d6e('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6d6e('0x6')]},'customerPort':{'type':Sequelize[_0x6d6e('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x6d6e('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x6d6e('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x6d6e('0x2')]}}; \ No newline at end of file +var _0x1228=['sequelize','exports','INTEGER','ENUM','star','TEXT','STRING','long','DATE','BOOLEAN'];(function(_0x2757f8,_0xb3ded1){var _0x36aab9=function(_0x439dbe){while(--_0x439dbe){_0x2757f8['push'](_0x2757f8['shift']());}};_0x36aab9(++_0xb3ded1);}(_0x1228,0x1a4));var _0x8122=function(_0x474cc5,_0x57be85){_0x474cc5=_0x474cc5-0x0;var _0x51e42e=_0x1228[_0x474cc5];return _0x51e42e;};'use strict';var Sequelize=require(_0x8122('0x0'));module[_0x8122('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x8122('0x2')]},'ratingType':{'type':Sequelize[_0x8122('0x3')](_0x8122('0x4'),'thumb'),'defaultValue':_0x8122('0x4')},'ratingMessage':{'type':Sequelize[_0x8122('0x5')]},'pathTranscript':{'type':Sequelize[_0x8122('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8122('0x6')]},'secondDisposition':{'type':Sequelize[_0x8122('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x8122('0x6')]},'browserVersion':{'type':Sequelize[_0x8122('0x6')]},'osName':{'type':Sequelize[_0x8122('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x8122('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x8122('0x6')]},'referer':{'type':Sequelize[_0x8122('0x5')]},'customerIp':{'type':Sequelize[_0x8122('0x6')]},'formData':{'type':Sequelize[_0x8122('0x5')](_0x8122('0x7'))},'read1stAt':{'type':Sequelize[_0x8122('0x8')]},'lastMsgAt':{'type':Sequelize[_0x8122('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x8122('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x8122('0x6')]},'customerPort':{'type':Sequelize[_0x8122('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x8122('0x9')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x8122('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 3999a28..23d0685 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 _0x8a27=['options','rows','include','includeAgent','push','spread','Tag','emit','chatInteractionTags:save','removeTags','download','unix','toString','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','read','get','Owner','closedAt','disposition','browserName','customerIp','customerPort','N.A.','tail','existsSync','createReadStream','pipe','createWriteStream','value','renderFile','views','transcript-','.pdf','Chat','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','client','http','request','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','destroy','stack','send','body','contact','account','index','map','ChatInteraction','rawAttributes','fieldName','type','getOptions','findAll','chat','query','user','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','create','update','find','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooMetadata','name','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooApiKey','isNull','vidaooNote','follow','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','AbandonInteraction','file','originalname','mimetype','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','close','mailTranscript','format','transcript-%s.txt','now','pathTranscript','Messages','User','ChatWebsite','ContactId','UserId','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','ChatInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5d6c40,_0x34f7e0){var _0x5120a8=function(_0x2e4b91){while(--_0x2e4b91){_0x5d6c40['push'](_0x5d6c40['shift']());}};_0x5120a8(++_0x34f7e0);}(_0x8a27,0xfb));var _0x78a2=function(_0x462416,_0x12a2ce){_0x462416=_0x462416-0x0;var _0x4b5474=_0x8a27[_0x462416];return _0x4b5474;};'use strict';var rimraf=require(_0x78a2('0x0'));var zipdir=require(_0x78a2('0x1'));var rp=require(_0x78a2('0x2'));var moment=require(_0x78a2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x78a2('0x4'));var util=require(_0x78a2('0x5'));var path=require(_0x78a2('0x6'));var ejs=require(_0x78a2('0x7'));var fs=require('fs');var _=require(_0x78a2('0x8'));var Redis=require('ioredis');var interaction=require(_0x78a2('0x9'));var qs=require(_0x78a2('0xa'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x78a2('0xb'));var config=require(_0x78a2('0xc'));var db=require(_0x78a2('0xd'))['db'];config[_0x78a2('0xe')]=_[_0x78a2('0xf')](config[_0x78a2('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x78a2('0x10'))(new Redis(config[_0x78a2('0xe')]));require(_0x78a2('0x11'))[_0x78a2('0x12')](socket);var jayson=require('jayson/promise');var client=jayson[_0x78a2('0x13')][_0x78a2('0x14')]({'port':0x232b});var client9004=jayson[_0x78a2('0x13')]['http']({'port':0x232c});function respondWithRpcPromise(_0x59b11c,_0x2fc21b,_0x296008,_0x6dec78){return new BPromise(function(_0x575b73,_0x55dfb6){var _0x12489d=_0x6dec78||client;return _0x12489d[_0x78a2('0x15')](_0x59b11c,_0x296008)[_0x78a2('0x16')](function(_0x2b384a){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x2fc21b,_0x78a2('0x17'));logger[_0x78a2('0x18')](_0x78a2('0x19'),_0x2fc21b,_0x78a2('0x17'),JSON[_0x78a2('0x1a')](_0x2b384a));if(_0x2b384a['error']){if(_0x2b384a[_0x78a2('0x1b')][_0x78a2('0x1c')]===0x1f4){logger[_0x78a2('0x1b')](_0x78a2('0x1d'),_0x2fc21b,_0x2b384a[_0x78a2('0x1b')]['message']);return _0x55dfb6(_0x2b384a['error']['message']);}logger[_0x78a2('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x2fc21b,_0x2b384a[_0x78a2('0x1b')]['message']);return _0x575b73(_0x2b384a[_0x78a2('0x1b')][_0x78a2('0x1e')]);}else{logger['info'](_0x78a2('0x1d'),_0x2fc21b,_0x78a2('0x17'));_0x575b73(_0x2b384a[_0x78a2('0x1f')][_0x78a2('0x1e')]);}})[_0x78a2('0x20')](function(_0x49f21c){logger['error'](_0x78a2('0x1d'),_0x2fc21b,_0x49f21c);_0x55dfb6(_0x49f21c);});});}function respondWithStatusCode(_0x147768,_0x246a3d){_0x246a3d=_0x246a3d||0xcc;return function(_0x524ca9){if(_0x524ca9){return _0x147768[_0x78a2('0x21')](_0x246a3d);}return _0x147768['status'](_0x246a3d)[_0x78a2('0x22')]();};}function respondWithResult(_0x3126b8,_0x536fb2){_0x536fb2=_0x536fb2||0xc8;return function(_0x552bac){if(_0x552bac){return _0x3126b8[_0x78a2('0x23')](_0x536fb2)[_0x78a2('0x24')](_0x552bac);}};}function respondWithFilteredResult(_0xe1408a,_0x20636b){return function(_0x10fbed){if(_0x10fbed){var _0x457e2b=typeof _0x20636b['offset']===_0x78a2('0x25')&&typeof _0x20636b[_0x78a2('0x26')]===_0x78a2('0x25');var _0x542f15=_0x10fbed[_0x78a2('0x27')];var _0x53771b=_0x457e2b?0x0:_0x20636b[_0x78a2('0x28')];var _0x66507=_0x457e2b?_0x10fbed[_0x78a2('0x27')]:_0x20636b[_0x78a2('0x28')]+_0x20636b[_0x78a2('0x26')];var _0x1ba9b9;if(_0x66507>=_0x542f15){_0x66507=_0x542f15;_0x1ba9b9=0xc8;}else{_0x1ba9b9=0xce;}_0xe1408a[_0x78a2('0x23')](_0x1ba9b9);return _0xe1408a[_0x78a2('0x29')](_0x78a2('0x2a'),_0x53771b+'-'+_0x66507+'/'+_0x542f15)[_0x78a2('0x24')](_0x10fbed);}return null;};}function saveUpdates(_0x4a84b3){return function(_0x47a10a){if(_0x47a10a){return _0x47a10a['update'](_0x4a84b3)[_0x78a2('0x16')](function(_0x598a6a){return _0x598a6a;});}return null;};}function removeEntity(_0xf4380){return function(_0x2ea563){if(_0x2ea563){return _0x2ea563[_0x78a2('0x2b')]()[_0x78a2('0x16')](function(){_0xf4380['status'](0xcc)[_0x78a2('0x22')]();});}};}function handleEntityNotFound(_0x7e681b){return function(_0x461820){if(!_0x461820){_0x7e681b[_0x78a2('0x21')](0x194);}return _0x461820;};}function handleError(_0x52a248,_0x309cbd){_0x309cbd=_0x309cbd||0x1f4;return function(_0x3fbdaa){logger['error'](_0x3fbdaa[_0x78a2('0x2c')]);if(_0x3fbdaa['name']){delete _0x3fbdaa['name'];}_0x52a248[_0x78a2('0x23')](_0x309cbd)[_0x78a2('0x2d')](_0x3fbdaa);};}function getMustacheRender(_0x5033c1,_0x229345){return Mustache['render'](_0x5033c1,_['merge'](_0x229345[_0x78a2('0x2e')],{'contact':_0x229345[_0x78a2('0x2f')],'message':_0x229345[_0x78a2('0x1e')],'agent':_0x229345['agent'],'interaction':_0x229345['interaction'],'account':_0x229345[_0x78a2('0x30')]}))||'';}exports[_0x78a2('0x31')]=function(_0x1d862c,_0x74d689){var _0xea0c01={};var _0x2a8cb7=_[_0x78a2('0x32')](db[_0x78a2('0x33')][_0x78a2('0x34')],function(_0x4c01e9){return{'name':_0x4c01e9[_0x78a2('0x35')],'type':_0x4c01e9[_0x78a2('0x36')]['key']};});_0xea0c01=qs[_0x78a2('0x37')](_0x2a8cb7,_0x1d862c);return interaction[_0x78a2('0x38')](_0x78a2('0x39'),_0x1d862c[_0x78a2('0x3a')],_0x1d862c[_0x78a2('0x3b')],_0xea0c01,_0x2a8cb7)['then'](respondWithFilteredResult(_0x74d689,_0xea0c01))['catch'](handleError(_0x74d689,null));};exports['show']=function(_0x4345d2,_0x44710c){var _0x1e0631={'raw':![],'where':{'id':_0x4345d2[_0x78a2('0x3c')]['id']}},_0x241503={};_0x241503[_0x78a2('0x3d')]=_['keys'](db[_0x78a2('0x33')][_0x78a2('0x34')]);_0x241503['query']=_[_0x78a2('0x3e')](_0x4345d2[_0x78a2('0x3a')]);_0x241503[_0x78a2('0x3f')]=_[_0x78a2('0x40')](_0x241503[_0x78a2('0x3d')],_0x241503[_0x78a2('0x3a')]);_0x1e0631[_0x78a2('0x41')]=_['intersection'](_0x241503[_0x78a2('0x3d')],qs['fields'](_0x4345d2[_0x78a2('0x3a')][_0x78a2('0x42')]));_0x1e0631['attributes']=_0x1e0631[_0x78a2('0x41')][_0x78a2('0x43')]?_0x1e0631[_0x78a2('0x41')]:_0x241503[_0x78a2('0x3d')];if(_0x4345d2[_0x78a2('0x3a')][_0x78a2('0x44')]){_0x1e0631['include']=[{'all':!![]}];}_0x1e0631=_[_0x78a2('0x45')]({},_0x1e0631,_0x4345d2['options']);return db[_0x78a2('0x33')]['find'](_0x1e0631)[_0x78a2('0x16')](handleEntityNotFound(_0x44710c,null))[_0x78a2('0x16')](respondWithResult(_0x44710c,null))[_0x78a2('0x20')](handleError(_0x44710c,null));};exports[_0x78a2('0x46')]=function(_0x2e1933,_0x1b30b1){return db[_0x78a2('0x33')][_0x78a2('0x46')](_0x2e1933[_0x78a2('0x2e')],{})[_0x78a2('0x16')](respondWithResult(_0x1b30b1,0xc9))[_0x78a2('0x20')](handleError(_0x1b30b1,null));};exports[_0x78a2('0x47')]=function(_0x50e262,_0x4361aa){if(_0x50e262[_0x78a2('0x2e')]['id']){delete _0x50e262[_0x78a2('0x2e')]['id'];}return db[_0x78a2('0x33')][_0x78a2('0x48')]({'where':{'id':_0x50e262[_0x78a2('0x3c')]['id']}})[_0x78a2('0x16')](handleEntityNotFound(_0x4361aa,null))[_0x78a2('0x16')](saveUpdates(_0x50e262[_0x78a2('0x2e')],null))[_0x78a2('0x16')](respondWithResult(_0x4361aa,null))[_0x78a2('0x20')](handleError(_0x4361aa,null));};exports['destroy']=function(_0x404c0e,_0x44392b){return db[_0x78a2('0x33')][_0x78a2('0x48')]({'where':{'id':_0x404c0e[_0x78a2('0x3c')]['id']}})[_0x78a2('0x16')](handleEntityNotFound(_0x44392b,null))[_0x78a2('0x16')](removeEntity(_0x44392b,null))[_0x78a2('0x20')](handleError(_0x44392b,null));};exports[_0x78a2('0x49')]=function(_0x5e14ca,_0x41ac5b){return db['ChatInteraction'][_0x78a2('0x49')]()['then'](respondWithResult(_0x41ac5b,null))[_0x78a2('0x20')](handleError(_0x41ac5b,null));};exports[_0x78a2('0x4a')]=function(_0x40695d,_0x19c423){var _0x31b728=_0x40695d[_0x78a2('0x3c')]['id'];var _0xbc6414;var _0x17d63b;var _0x54e91c;return db['ChatInteraction'][_0x78a2('0x4b')]({'where':{'id':_0x31b728}})[_0x78a2('0x16')](function(_0x46715c){_0xbc6414=_0x46715c;return db['ChatWebsite']['findOne']({'where':{'id':_0x46715c[_0x78a2('0x4c')]},'attributes':['id','vidaooApiKey',_0x78a2('0x4d'),_0x78a2('0x4e'),'vidaooNote',_0x78a2('0x4f')],'raw':!![]});})[_0x78a2('0x16')](function(_0x5cc2e4){if(_0x5cc2e4&&_0x5cc2e4['vidaooApiKey']&&_0x5cc2e4[_0x78a2('0x4d')]){_0x17d63b=_0x5cc2e4;var _0x2193e1={'interaction':{'id':_0x31b728},'agent':{'id':_0x40695d['user']['id'],'name':_0x40695d[_0x78a2('0x3b')][_0x78a2('0x50')],'fullname':_0x40695d[_0x78a2('0x3b')][_0x78a2('0x51')],'email':_0x40695d[_0x78a2('0x3b')][_0x78a2('0x52')]},'contact':_0x40695d['body'][_0x78a2('0x2f')],'account':_0x40695d[_0x78a2('0x2e')][_0x78a2('0x30')]};var _0x2fb54a={'rejectUnauthorized':![],'method':_0x78a2('0x53'),'url':_0x78a2('0x54'),'headers':{'X-APIKEY':_0x5cc2e4[_0x78a2('0x55')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x40695d['user']['email']],'buttons':null,'topic':_0x17d63b[_0x78a2('0x4e')],'note':_[_0x78a2('0x56')](_0x17d63b[_0x78a2('0x57')])?null:getMustacheRender(_0x17d63b['vidaooNote'],_0x2193e1),'metadata':null},'redirect':_0x78a2('0x58'),'json':!![]};try{if(!_[_0x78a2('0x56')](_0x17d63b[_0x78a2('0x4f')])){var _0x504453=getMustacheRender(_0x17d63b['vidaooMetadata'],_0x2193e1);var _0x3cd4d0=JSON['parse'](_0x504453);_0x2fb54a['body'][_0x78a2('0x59')]=_0x3cd4d0;}}catch(_0x2347c3){throw new db[(_0x78a2('0x5a'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x2fb54a);}else{throw new db['Sequelize'][(_0x78a2('0x5b'))](_0x78a2('0x5c'));}})[_0x78a2('0x16')](function(_0x2a6c30){_0x54e91c=_0x2a6c30;if(_0x54e91c['id']){var _0x42bd51={'body':_0x54e91c[_0x78a2('0x5d')],'ChatWebsiteId':_0x17d63b['id'],'ChatInteractionId':_0xbc6414['id'],'direction':_0x78a2('0x5e'),'UserId':_0x40695d[_0x78a2('0x3b')]['id']};return db[_0x78a2('0x5f')][_0x78a2('0x46')](_0x42bd51,{});}else{throw new db[(_0x78a2('0x5a'))][(_0x78a2('0x5b'))](_0x78a2('0x60'));}})[_0x78a2('0x16')](function(){return _0xbc6414['updateAttributes']({'vidaooSessionId':_0x54e91c['id']});})['then'](respondWithResult(_0x19c423,null))[_0x78a2('0x20')](handleError(_0x19c423,null));};exports[_0x78a2('0x61')]=function(_0x227f2b,_0x40201f){if(_0x227f2b[_0x78a2('0x2e')]['id']){delete _0x227f2b['body']['id'];}return db[_0x78a2('0x33')][_0x78a2('0x48')]({'where':{'id':_0x227f2b['params']['id']},'include':[{'model':db[_0x78a2('0x62')],'as':_0x78a2('0x63')}]})['then'](handleEntityNotFound(_0x40201f,null))[_0x78a2('0x16')](saveUpdates(_0x227f2b[_0x78a2('0x2e')],null))[_0x78a2('0x16')](respondWithResult(_0x40201f,null))[_0x78a2('0x20')](handleError(_0x40201f,null));};exports[_0x78a2('0x64')]=function(_0x1b6c4e,_0x3c969a){if(_0x1b6c4e[_0x78a2('0x2e')]['id']){delete _0x1b6c4e[_0x78a2('0x2e')]['id'];}return db[_0x78a2('0x33')]['find']({'where':{'id':_0x1b6c4e[_0x78a2('0x3c')]['id']}})[_0x78a2('0x16')](function(_0x4ea5b1){if(!_0x4ea5b1){logger[_0x78a2('0x1b')](_0x78a2('0x65'),'abandon',0x194,_0x78a2('0x66'));_0x3c969a[_0x78a2('0x21')](0x194);}else{if(_0x4ea5b1['UserId']){throw new db[(_0x78a2('0x5a'))]['ValidationError'](_0x78a2('0x67'));}}return _0x4ea5b1;})[_0x78a2('0x16')](function(_0x129081){if(_0x129081){return _0x129081['update']({'closed':_0x1b6c4e[_0x78a2('0x2e')][_0x78a2('0x68')],'disposition':_0x1b6c4e[_0x78a2('0x2e')]['disposition']})[_0x78a2('0x16')](function(_0x288814){return _0x288814;});}})[_0x78a2('0x16')](function(){return respondWithRpcPromise(_0x78a2('0x69'),'abandon',_0x1b6c4e['body'],client9004);})[_0x78a2('0x16')](respondWithResult(_0x3c969a,null))['catch'](handleError(_0x3c969a,null));};exports['attachmentUpload']=function(_0x5364bc,_0x14b875){_0x5364bc['body'][_0x78a2('0x50')]=_0x5364bc[_0x78a2('0x6a')][_0x78a2('0x6b')];_0x5364bc[_0x78a2('0x2e')]['basename']=_0x5364bc[_0x78a2('0x6a')]['filename'];_0x5364bc[_0x78a2('0x2e')][_0x78a2('0x36')]=_0x5364bc[_0x78a2('0x6a')][_0x78a2('0x6c')];return db[_0x78a2('0x6d')]['create'](_0x5364bc['body'])[_0x78a2('0x16')](respondWithResult(_0x14b875,0xc9))[_0x78a2('0x20')](handleError(_0x14b875,null));};exports['attachmentDownload']=function(_0x4fb3e7,_0x40c54f){return db[_0x78a2('0x33')]['findOne']({'where':{'id':_0x4fb3e7['params']['id']},'raw':!![]})[_0x78a2('0x16')](handleEntityNotFound(_0x40c54f,null))['then'](function(_0x3740b0){if(_0x3740b0){if(_0x3740b0[_0x78a2('0x68')]){return _0x40c54f[_0x78a2('0x23')](0x193)[_0x78a2('0x24')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment'][_0x78a2('0x4b')]({'where':{'id':_0x4fb3e7['query'][_0x78a2('0x6e')]},'raw':!![]})[_0x78a2('0x16')](handleEntityNotFound(_0x40c54f,null));}})[_0x78a2('0x16')](function(_0x4021eb){if(_0x4021eb){var _0xb7d679=_0x4021eb[_0x78a2('0x6f')]!==null;var _0xfe128a=path[_0x78a2('0x70')](config[_0x78a2('0x71')],_0x78a2('0x72'));if(_0xb7d679){_0xfe128a=path['join'](_0xfe128a,_0x78a2('0x73'));}var _0x24b68a=path[_0x78a2('0x70')](_0xfe128a,_0x4021eb[_0x78a2('0x74')]);return _0x40c54f['download'](_0x24b68a);}})[_0x78a2('0x20')](handleError(_0x40c54f,null));};exports[_0x78a2('0x75')]=function(_0x404f73,_0xd683d9){var _0x4ed43a=null;var _0x246892=null;var _0x43d543=null;if(_0x404f73[_0x78a2('0x2e')]['id']){delete _0x404f73['body']['id'];}if(_0x404f73['body'][_0x78a2('0x76')]){_0x43d543=path[_0x78a2('0x70')](config[_0x78a2('0x71')],'server/files/chat/upload/',util[_0x78a2('0x77')](_0x78a2('0x78'),Date[_0x78a2('0x79')]()));_0x404f73[_0x78a2('0x2e')][_0x78a2('0x7a')]=_0x43d543;}return db[_0x78a2('0x33')][_0x78a2('0x48')]({'where':{'id':_0x404f73[_0x78a2('0x3c')]['id']},'include':[{'model':db[_0x78a2('0x5f')],'as':_0x78a2('0x7b'),'include':[{'model':db[_0x78a2('0x7c')],'as':_0x78a2('0x7c')}]}]})[_0x78a2('0x16')](handleEntityNotFound(_0xd683d9,null))[_0x78a2('0x16')](saveUpdates(_0x404f73[_0x78a2('0x2e')],null))['then'](function(_0x44109d){if(_0x44109d){_0x4ed43a=_0x44109d;return db[_0x78a2('0x7d')][_0x78a2('0x48')]({'where':{'id':_0x4ed43a['ChatWebsiteId']}});}})[_0x78a2('0x16')](function(_0xfda860){if(_0xfda860){_0x246892=_0xfda860;return db[_0x78a2('0x62')][_0x78a2('0x48')]({'where':{'id':_0x4ed43a[_0x78a2('0x7e')]}});}})['then'](function(_0xa90604){if(_0xa90604){if(_0x43d543){var _0x24c37a=null;for(var _0x49780b=0x1;_0x49780b<_0x4ed43a['Messages'][_0x78a2('0x43')];++_0x49780b){_0x24c37a=_0x4ed43a['Messages'][_0x49780b];var _0xf0964a=_0x24c37a[_0x78a2('0x7f')]?util[_0x78a2('0x77')](_0x78a2('0x80'),_0x246892[_0x78a2('0x81')],_0x24c37a[_0x78a2('0x7f')]):_0x78a2('0x82');var _0x30eab1=_0x404f73[_0x78a2('0x2e')][_0x78a2('0x83')]||util[_0x78a2('0x77')]('%s%d',_0x78a2('0x84'),_0x24c37a[_0x78a2('0x7e')]);switch(_0x246892[_0x78a2('0x85')]){case _0x78a2('0x86'):_0xf0964a=_0x24c37a[_0x78a2('0x7f')]?util[_0x78a2('0x77')](_0x78a2('0x80'),_0x246892[_0x78a2('0x81')],_0x24c37a[_0x78a2('0x7f')]):_0x78a2('0x82');break;case _0x78a2('0x87'):_0xf0964a=_0x24c37a[_0x78a2('0x7f')]?_0x24c37a[_0x78a2('0x7c')][_0x78a2('0x88')]||_0x24c37a['User'][_0x78a2('0x51')]:_0x78a2('0x82');break;case _0x78a2('0x89'):_0xf0964a=_0x24c37a[_0x78a2('0x7f')]?_0x24c37a[_0x78a2('0x7c')][_0x78a2('0x51')]:'System';break;default:_0xf0964a=_0x24c37a[_0x78a2('0x7f')]?util[_0x78a2('0x77')]('%s%d',_0x246892['agentAlias'],_0x24c37a[_0x78a2('0x7f')]):'System';}var _0x546c54=util['format'](_0x78a2('0x8a'),moment(_0x24c37a[_0x78a2('0x8b')])[_0x78a2('0x77')](_0x78a2('0x8c')),_0x24c37a[_0x78a2('0x8d')]==='in'?_0x30eab1:_0xf0964a,_0x24c37a[_0x78a2('0x2e')]);if(!_0x24c37a[_0x78a2('0x8e')]){fs['appendFileSync'](_0x43d543,_0x546c54);}}return db[_0x78a2('0x8f')][_0x78a2('0x4b')]({'where':{'service':!![]},'include':[{'model':db[_0x78a2('0x90')],'as':_0x78a2('0x91'),'raw':!![],'include':[{'model':db[_0x78a2('0x92')],'as':_0x78a2('0x92'),'raw':!![]}]}]});}}})[_0x78a2('0x16')](function(_0x51cb72){if(!_0x51cb72||!_0x51cb72[_0x78a2('0x91')]||!_0x404f73[_0x78a2('0x2e')])return _0x4ed43a;var _0x2b3642=_0x51cb72['getSmtpOptions']();return respondWithRpcPromise(_0x78a2('0x93'),_0x78a2('0x94'),{'account':_0x2b3642,'message':{'from':util['format'](_0x78a2('0x95'),_0x51cb72[_0x78a2('0x50')],_0x51cb72['email']||_0x51cb72[_0x78a2('0x91')][_0x78a2('0x3b')]),'to':_0x404f73[_0x78a2('0x2e')][_0x78a2('0x76')],'subject':_0x78a2('0x96'),'text':util[_0x78a2('0x77')](_0x78a2('0x97'),_0x404f73[_0x78a2('0x2e')][_0x78a2('0x76')]),'attachments':[{'path':_0x43d543}]}})['then'](function(){return _0x4ed43a;})[_0x78a2('0x20')](function(_0x10a35b){logger[_0x78a2('0x1b')](_0x10a35b);});})[_0x78a2('0x16')](respondWithStatusCode(_0xd683d9,0xc8))[_0x78a2('0x20')](handleError(_0xd683d9,null));};exports[_0x78a2('0x98')]=function(_0x5d5caf,_0x470945){return db[_0x78a2('0x5f')][_0x78a2('0x48')]({'where':{'id':_0x5d5caf['params']['id']}})['then'](handleEntityNotFound(_0x470945,null))[_0x78a2('0x16')](function(_0x4f1bd3){if(_0x4f1bd3){return _0x4f1bd3['addMessage'](_0x5d5caf[_0x78a2('0x2e')][_0x78a2('0x99')],_[_0x78a2('0x9a')](_0x5d5caf['body'],[_0x78a2('0x99'),'id'])||{});}})[_0x78a2('0x16')](respondWithResult(_0x470945,null))[_0x78a2('0x20')](handleError(_0x470945,null));};exports[_0x78a2('0x9b')]=function(_0x357c13,_0x41be5e){var _0x2d829c={'raw':![],'where':{}};var _0x17c9bb={};var _0x4ec61f={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x357c13['params']['id']}})[_0x78a2('0x16')](handleEntityNotFound(_0x41be5e,null))['then'](function(_0x4e73b2){if(_0x4e73b2){_0x17c9bb[_0x78a2('0x3d')]=_[_0x78a2('0x3e')](db[_0x78a2('0x5f')][_0x78a2('0x34')]);_0x17c9bb[_0x78a2('0x3a')]=_['keys'](_0x357c13[_0x78a2('0x3a')]);_0x17c9bb['filters']=_[_0x78a2('0x40')](_0x17c9bb[_0x78a2('0x3d')],_0x17c9bb['query']);_0x2d829c[_0x78a2('0x41')]=_['intersection'](_0x17c9bb[_0x78a2('0x3d')],qs[_0x78a2('0x42')](_0x357c13[_0x78a2('0x3a')][_0x78a2('0x42')]));_0x2d829c['attributes']=_0x2d829c[_0x78a2('0x41')][_0x78a2('0x43')]?_0x2d829c['attributes']:_0x17c9bb[_0x78a2('0x3d')];if(!_0x357c13['query'][_0x78a2('0x9c')](_0x78a2('0x9d'))){_0x2d829c[_0x78a2('0x26')]=qs[_0x78a2('0x26')](_0x357c13['query'][_0x78a2('0x26')]);_0x2d829c[_0x78a2('0x28')]=qs['offset'](_0x357c13[_0x78a2('0x3a')][_0x78a2('0x28')]);}_0x2d829c[_0x78a2('0x9e')]=qs[_0x78a2('0x9f')](_0x357c13['query']['sort']);_0x2d829c[_0x78a2('0xa0')]=qs['filters'](_['pick'](_0x357c13['query'],_0x17c9bb[_0x78a2('0x3f')]));_0x2d829c[_0x78a2('0xa0')][_0x78a2('0xa1')]=_0x4e73b2['id'];if(_0x357c13[_0x78a2('0x3a')]['filter']){_0x2d829c['where']=_[_0x78a2('0x45')](_0x2d829c[_0x78a2('0xa0')],{'$or':_[_0x78a2('0x32')](_0x2d829c[_0x78a2('0x41')],function(_0x1bebf1){var _0x5b5272={};_0x5b5272[_0x1bebf1]={'$like':'%'+_0x357c13[_0x78a2('0x3a')][_0x78a2('0xa2')]+'%'};return _0x5b5272;})});}if(_0x357c13['query'][_0x78a2('0xa3')]){var _0x45f876=_0x357c13[_0x78a2('0x3a')][_0x78a2('0xa3')]['split'](',');var _0x2c5e35={};_0x2c5e35[_0x45f876[0x0]]={'$gte':moment(_0x45f876[0x1])[_0x78a2('0x77')](_0x78a2('0xa4'))};_0x2d829c[_0x78a2('0xa0')]=_['merge'](_0x2d829c['where'],_0x2c5e35);}_0x2d829c=_[_0x78a2('0x45')]({},_0x2d829c,_0x357c13[_0x78a2('0xa5')]);return db[_0x78a2('0x5f')][_0x78a2('0x27')]({'where':_0x2d829c[_0x78a2('0xa0')]})[_0x78a2('0x16')](function(_0x16dddf){_0x4ec61f[_0x78a2('0x27')]=_0x16dddf;if(_0x357c13[_0x78a2('0x3a')][_0x78a2('0x44')]){_0x2d829c['include']=[{'all':!![]}];}return db[_0x78a2('0x5f')][_0x78a2('0x38')](_0x2d829c);})[_0x78a2('0x16')](function(_0x523b87){_0x4ec61f[_0x78a2('0xa6')]=_0x523b87;return _0x4ec61f;});}})['then'](respondWithFilteredResult(_0x41be5e,_0x2d829c))[_0x78a2('0x20')](handleError(_0x41be5e,null));};exports['getMyMessages']=function(_0x43237a,_0x481f0f){var _0x3549d3={'where':{}},_0x2a7323={},_0x2ed90d={'count':0x0,'rows':[]};return db[_0x78a2('0x33')]['findOne']({'where':{'id':_0x43237a[_0x78a2('0x3c')]['id']}})[_0x78a2('0x16')](handleEntityNotFound(_0x481f0f,null))[_0x78a2('0x16')](function(_0x5db1f6){if(_0x5db1f6){_0x2a7323['model']=_[_0x78a2('0x3e')](db[_0x78a2('0x5f')][_0x78a2('0x34')]);_0x2a7323[_0x78a2('0x3a')]=_[_0x78a2('0x3e')](_0x43237a[_0x78a2('0x3a')]);_0x2a7323[_0x78a2('0x3f')]=_[_0x78a2('0x40')](_0x2a7323[_0x78a2('0x3d')],_0x2a7323[_0x78a2('0x3a')]);_0x3549d3['attributes']=_[_0x78a2('0x40')](_0x2a7323[_0x78a2('0x3d')],qs['fields'](_0x43237a[_0x78a2('0x3a')]['fields']));_0x3549d3[_0x78a2('0x41')]=_0x3549d3[_0x78a2('0x41')][_0x78a2('0x43')]?_0x3549d3[_0x78a2('0x41')]:_0x2a7323[_0x78a2('0x3d')];if(!_0x43237a['query'][_0x78a2('0x9c')](_0x78a2('0x9d'))){_0x3549d3['limit']=qs[_0x78a2('0x26')](_0x43237a['query'][_0x78a2('0x26')]);_0x3549d3['offset']=qs[_0x78a2('0x28')](_0x43237a[_0x78a2('0x3a')][_0x78a2('0x28')]);}_0x3549d3[_0x78a2('0x9e')]=qs[_0x78a2('0x9f')](_0x43237a[_0x78a2('0x3a')]['sort']);_0x3549d3[_0x78a2('0xa0')]=qs[_0x78a2('0x3f')](_['pick'](_0x43237a['query'],_0x2a7323[_0x78a2('0x3f')]));_0x3549d3['where'][_0x78a2('0xa1')]=_0x5db1f6['id'];if(_0x43237a[_0x78a2('0x3a')]['filter']){_0x3549d3[_0x78a2('0xa0')]=_[_0x78a2('0x45')](_0x3549d3['where'],{'$or':_[_0x78a2('0x32')](_0x3549d3[_0x78a2('0x41')],function(_0x2e0117){var _0x45558c={};_0x45558c[_0x2e0117]={'$like':'%'+_0x43237a[_0x78a2('0x3a')][_0x78a2('0xa2')]+'%'};return _0x45558c;})});}_0x3549d3['where'][_0x78a2('0x8e')]=![];if(_0x43237a[_0x78a2('0x3a')]['id']){_0x3549d3[_0x78a2('0xa0')]['id']={'$gt':_0x43237a['query']['id']};}_0x3549d3=_[_0x78a2('0x45')]({},_0x3549d3,_0x43237a[_0x78a2('0xa5')]);return db[_0x78a2('0x5f')][_0x78a2('0x27')]({'where':_0x3549d3[_0x78a2('0xa0')]})[_0x78a2('0x16')](function(_0x55af0e){_0x2ed90d[_0x78a2('0x27')]=_0x55af0e;_0x3549d3[_0x78a2('0xa7')]=[];if(_0x43237a[_0x78a2('0x3a')][_0x78a2('0xa8')]){_0x3549d3[_0x78a2('0xa7')][_0x78a2('0xa9')]({'model':db[_0x78a2('0x7c')],'as':_0x78a2('0x7c'),'attributes':['id','fullname','alias']});}if(_0x43237a[_0x78a2('0x3a')][_0x78a2('0x44')]){_0x3549d3[_0x78a2('0xa7')]=[{'all':!![]}];}return db['ChatMessage'][_0x78a2('0x38')](_0x3549d3);})[_0x78a2('0x16')](function(_0xa32fd1){_0x2ed90d[_0x78a2('0xa6')]=_0xa32fd1;return _0x2ed90d;});}})[_0x78a2('0x16')](respondWithFilteredResult(_0x481f0f,_0x3549d3))['catch'](handleError(_0x481f0f,null));};exports['addTags']=function(_0x298b26,_0x2eb525){return db[_0x78a2('0x33')][_0x78a2('0x48')]({'where':{'id':_0x298b26['params']['id']}})[_0x78a2('0x16')](handleEntityNotFound(_0x2eb525,null))[_0x78a2('0x16')](function(_0x53a441){if(_0x53a441){return _0x53a441['setTags'](_0x298b26[_0x78a2('0x2e')]['ids'],_['omit'](_0x298b26[_0x78a2('0x2e')],[_0x78a2('0x99'),'id'])||{})[_0x78a2('0xaa')](function(){return db[_0x78a2('0xab')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x298b26[_0x78a2('0x2e')]['ids']}});})[_0x78a2('0x16')](function(_0x10fec3){socket[_0x78a2('0xac')](_0x78a2('0xad'),{'id':Number(_0x298b26[_0x78a2('0x3c')]['id']),'tags':_0x10fec3||[]});return{'id':Number(_0x298b26[_0x78a2('0x3c')]['id']),'tags':_0x10fec3||[]};});}})[_0x78a2('0x16')](respondWithResult(_0x2eb525,null))['catch'](handleError(_0x2eb525,null));};exports['removeTags']=function(_0x1ecd34,_0xc04bfa){return db[_0x78a2('0x33')]['find']({'where':{'id':_0x1ecd34[_0x78a2('0x3c')]['id']}})['then'](handleEntityNotFound(_0xc04bfa,null))['then'](function(_0x22fcd3){if(_0x22fcd3){return _0x22fcd3[_0x78a2('0xae')](_0x1ecd34[_0x78a2('0x3a')][_0x78a2('0x99')]);}})[_0x78a2('0x16')](respondWithStatusCode(_0xc04bfa,null))['catch'](handleError(_0xc04bfa,null));};exports[_0x78a2('0xaf')]=function(_0x1c7c0,_0x483f2a){var _0x29fb1a=moment()[_0x78a2('0xb0')]()[_0x78a2('0xb1')]();var _0xd98381=path[_0x78a2('0x70')](config[_0x78a2('0x71')],_0x78a2('0xb2'),_0x78a2('0xb3'),_0x78a2('0xb4'));var _0x56fc86=path[_0x78a2('0x70')](config[_0x78a2('0x71')],_0x78a2('0xb2'),_0x78a2('0xb3'),_0x78a2('0xb5'));var _0x463de9=path[_0x78a2('0x70')](_0xd98381,_0x29fb1a);var _0xe8de3b=util[_0x78a2('0x77')](_0x78a2('0xb6'),_0x1c7c0['params']['id'],_0x29fb1a);var _0xfb9857=path[_0x78a2('0x70')](_0xd98381,_0xe8de3b);var _0x1c74cc=[];_0x1c74cc[_0x78a2('0xa9')]({'model':db[_0x78a2('0x7c')],'as':'User','attributes':['id',_0x78a2('0x51')],'raw':!![]});_0x1c74cc[_0x78a2('0xa9')]({'model':db[_0x78a2('0x62')],'as':_0x78a2('0x63'),'attributes':['id',_0x78a2('0xb7'),_0x78a2('0xb8')],'raw':!![]});if(_0x1c7c0['query'][_0x78a2('0xb5')]){_0x1c74cc[_0x78a2('0xa9')]({'model':db[_0x78a2('0x6d')],'as':'Attachment','raw':!![]});}var _0x442343=[{'model':db[_0x78a2('0x5f')],'as':_0x78a2('0x7b'),'attributes':['id','body',_0x78a2('0x8b'),_0x78a2('0x8d'),_0x78a2('0x8e'),_0x78a2('0xb9')],'include':_0x1c74cc}];_0x442343[_0x78a2('0xa9')]({'model':db[_0x78a2('0x7d')],'as':'Account','attributes':['id','name']});_0x442343[_0x78a2('0xa9')]({'model':db[_0x78a2('0x7c')],'as':'Owner','attributes':['id',_0x78a2('0x51')]});return db[_0x78a2('0x33')]['find']({'where':{'id':_0x1c7c0[_0x78a2('0x3c')]['id']},'include':_0x442343})[_0x78a2('0x16')](handleEntityNotFound(_0x483f2a,null))[_0x78a2('0x16')](function(_0x31ffc7){if(_0x31ffc7){var _0xe65b8b=_0x31ffc7[_0x78a2('0xba')]({'plain':!![]});fs['mkdirSync'](_0x463de9);var _0x32f487={'channel':'Chat','account':_0xe65b8b['Account']['name'],'agent':_0xe65b8b[_0x78a2('0xbb')]?_0xe65b8b[_0x78a2('0xbb')]['fullname']:'N.A.','createdAt':moment(_0xe65b8b[_0x78a2('0x8b')])[_0x78a2('0x77')]('YYYY-MM-DD\x20HH:mm:ss')[_0x78a2('0xb1')](),'closedAt':_0xe65b8b[_0x78a2('0x68')]?moment(_0xe65b8b[_0x78a2('0xbc')])[_0x78a2('0x77')](_0x78a2('0xa4'))[_0x78a2('0xb1')]():'','disposition':_0xe65b8b[_0x78a2('0xbd')],'chatInfo':{'browser':_0xe65b8b[_0x78a2('0xbe')],'os':_0xe65b8b['osName'],'referer':_0xe65b8b['referer'],'customerIp':_0xe65b8b[_0x78a2('0xbf')],'customerPort':_0xe65b8b[_0x78a2('0xc0')]?_0xe65b8b['customerPort']:_0x78a2('0xc1')},'messages':_(_0xe65b8b[_0x78a2('0x7b')])[_0x78a2('0xc2')]()[_0x78a2('0xa2')]({'secret':![]})['map'](function(_0x3abca1){if(_0x3abca1[_0x78a2('0x6d')]){var _0x1b8b8e=path[_0x78a2('0x70')](_0x56fc86,_0x3abca1[_0x78a2('0x6d')][_0x78a2('0x74')]);if(fs[_0x78a2('0xc3')](_0x1b8b8e)){fs[_0x78a2('0xc4')](_0x1b8b8e)[_0x78a2('0xc5')](fs[_0x78a2('0xc6')](path[_0x78a2('0x70')](_0x463de9,_0x3abca1['Attachment'][_0x78a2('0x74')])));}}return{'date':moment(_0x3abca1[_0x78a2('0x8b')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x78a2('0xb1')](),'sender':_0x3abca1['direction']==='out'?_0x3abca1[_0x78a2('0x7c')]?_0x3abca1[_0x78a2('0x7c')][_0x78a2('0x51')]:_0x78a2('0x82'):_0x3abca1[_0x78a2('0x63')][_0x78a2('0xb7')]+(_0x3abca1[_0x78a2('0x63')][_0x78a2('0xb8')]?'\x20'+_0x3abca1['Contact'][_0x78a2('0xb8')]:''),'body':_0x3abca1[_0x78a2('0x6d')]?_0x3abca1['Attachment'][_0x78a2('0x74')]:_0x3abca1[_0x78a2('0x2e')],'direction':_0x3abca1['direction']===_0x78a2('0x5e')?'A':'C','secret':_0x3abca1[_0x78a2('0x8e')],'read':_0x3abca1['read'],'attachment':_0x3abca1[_0x78a2('0x6d')]};})[_0x78a2('0xc7')]()};return ejs[_0x78a2('0xc8')](path['join'](config[_0x78a2('0x71')],_0x78a2('0xb2'),_0x78a2('0xc9'),'downloadInteraction.ejs'),{'interaction':_0x32f487})[_0x78a2('0x16')](function(_0x2bfb2e){var _0x10755e=path[_0x78a2('0x70')](_0x463de9,_0x78a2('0xca')+_0xe65b8b['id']+'-'+_0x29fb1a+_0x78a2('0xcb'));var _0x45fafc={'path':_0x10755e,'channel':_0x78a2('0xcc'),'interactionId':_0xe65b8b['id']};return pdf[_0x78a2('0xcd')](_0x2bfb2e,_0x45fafc);})[_0x78a2('0x16')](function(){return new Promise(function(_0xa07450,_0x361949){zipdir(_0x463de9,{'saveTo':_0xfb9857},function(_0x1a4312,_0x56901e){if(_0x1a4312)return _0x361949(_0x1a4312);return _0xa07450(_0x56901e);});})[_0x78a2('0x16')](function(){return new BPromise(function(_0x34fcb1,_0x496e8c){rimraf(_0x463de9,function(_0x24a0ae){if(_0x24a0ae)_0x496e8c(_0x24a0ae);return _0x34fcb1();});});})[_0x78a2('0x16')](function(){return _0x483f2a[_0x78a2('0xaf')](_0xfb9857,_0xe8de3b,function(_0x2e9b38){if(_0x2e9b38){logger['error'](_0x78a2('0xce'),_0x2e9b38);}else{fs[_0x78a2('0xcf')](_0xfb9857);}});});});}else{return _0x483f2a[_0x78a2('0x21')](0xc8);}})[_0x78a2('0x20')](handleError(_0x483f2a,null));}; \ No newline at end of file +var _0x0138=['attachments','transcript-%d-%s.zip','firstName','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','toString','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','read','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','mustache','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInteraction,\x20%s,\x20%s','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','update','destroy','then','stack','name','render','merge','body','contact','interaction','account','index','map','ChatInteraction','rawAttributes','type','key','getOptions','chat','query','show','params','model','keys','filters','attributes','intersection','fields','includeAll','include','options','find','create','describe','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooMetadata','user','fullname','email','POST','vidaooNote','follow','isNull','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','disposition','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','closed','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','download','mailTranscript','root','format','transcript-%s.txt','pathTranscript','Messages','User','ContactId','%s%d','agentAlias','customer','Visitor','agentIdentifier','website_alias','System','agent_alias','alias','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailServerOut','Smtp','CloudProvider','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','length','hasOwnProperty','nolimit','sort','where','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','order','pick','ChatInteractionId','includeAgent','push','addTags','omit','spread','color','emit','chatInteractionTags:save','removeTags','unix','server','files','tmp'];(function(_0x3b48ab,_0x3982d1){var _0x36c993=function(_0x2d0046){while(--_0x2d0046){_0x3b48ab['push'](_0x3b48ab['shift']());}};_0x36c993(++_0x3982d1);}(_0x0138,0xf4));var _0x8013=function(_0x5a12d3,_0x1170aa){_0x5a12d3=_0x5a12d3-0x0;var _0xb282fc=_0x0138[_0x5a12d3];return _0xb282fc;};'use strict';var rimraf=require(_0x8013('0x0'));var zipdir=require(_0x8013('0x1'));var rp=require('request-promise');var moment=require(_0x8013('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8013('0x3'));var util=require(_0x8013('0x4'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8013('0x5'));var Redis=require(_0x8013('0x6'));var interaction=require(_0x8013('0x7'));var qs=require(_0x8013('0x8'));var pdf=require(_0x8013('0x9'));var logger=require('../../config/logger')(_0x8013('0xa'));var config=require(_0x8013('0xb'));var db=require('../../mysqldb')['db'];config[_0x8013('0xc')]=_[_0x8013('0xd')](config[_0x8013('0xc')],{'host':_0x8013('0xe'),'port':0x18eb});var socket=require(_0x8013('0xf'))(new Redis(config[_0x8013('0xc')]));require('./chatInteraction.socket')[_0x8013('0x10')](socket);var jayson=require(_0x8013('0x11'));var client=jayson[_0x8013('0x12')]['http']({'port':0x232b});var client9004=jayson[_0x8013('0x12')][_0x8013('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x27e9bd,_0x4172ab,_0x335154,_0x1471ef){return new BPromise(function(_0xa0593d,_0x30d513){var _0x907a73=_0x1471ef||client;return _0x907a73[_0x8013('0x14')](_0x27e9bd,_0x335154)['then'](function(_0x49455f){logger[_0x8013('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x4172ab,_0x8013('0x16'));logger[_0x8013('0x17')](_0x8013('0x18'),_0x4172ab,'request\x20sent',JSON[_0x8013('0x19')](_0x49455f));if(_0x49455f[_0x8013('0x1a')]){if(_0x49455f[_0x8013('0x1a')][_0x8013('0x1b')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x4172ab,_0x49455f[_0x8013('0x1a')][_0x8013('0x1c')]);return _0x30d513(_0x49455f[_0x8013('0x1a')]['message']);}logger[_0x8013('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x4172ab,_0x49455f[_0x8013('0x1a')]['message']);return _0xa0593d(_0x49455f[_0x8013('0x1a')][_0x8013('0x1c')]);}else{logger[_0x8013('0x15')](_0x8013('0x1d'),_0x4172ab,_0x8013('0x16'));_0xa0593d(_0x49455f[_0x8013('0x1e')][_0x8013('0x1c')]);}})[_0x8013('0x1f')](function(_0xd099c0){logger['error'](_0x8013('0x1d'),_0x4172ab,_0xd099c0);_0x30d513(_0xd099c0);});});}function respondWithStatusCode(_0x1c00bf,_0x2f6684){_0x2f6684=_0x2f6684||0xcc;return function(_0x318b7d){if(_0x318b7d){return _0x1c00bf[_0x8013('0x20')](_0x2f6684);}return _0x1c00bf[_0x8013('0x21')](_0x2f6684)[_0x8013('0x22')]();};}function respondWithResult(_0x4912d8,_0x1ef7eb){_0x1ef7eb=_0x1ef7eb||0xc8;return function(_0x44033d){if(_0x44033d){return _0x4912d8['status'](_0x1ef7eb)['json'](_0x44033d);}};}function respondWithFilteredResult(_0x54ef1f,_0x425170){return function(_0x3c7aed){if(_0x3c7aed){var _0x2d612f=typeof _0x425170[_0x8013('0x23')]===_0x8013('0x24')&&typeof _0x425170['limit']===_0x8013('0x24');var _0x497776=_0x3c7aed[_0x8013('0x25')];var _0x501492=_0x2d612f?0x0:_0x425170[_0x8013('0x23')];var _0x5b5e8e=_0x2d612f?_0x3c7aed[_0x8013('0x25')]:_0x425170[_0x8013('0x23')]+_0x425170[_0x8013('0x26')];var _0xbf6e61;if(_0x5b5e8e>=_0x497776){_0x5b5e8e=_0x497776;_0xbf6e61=0xc8;}else{_0xbf6e61=0xce;}_0x54ef1f[_0x8013('0x21')](_0xbf6e61);return _0x54ef1f[_0x8013('0x27')](_0x8013('0x28'),_0x501492+'-'+_0x5b5e8e+'/'+_0x497776)[_0x8013('0x29')](_0x3c7aed);}return null;};}function saveUpdates(_0x21530f){return function(_0x1cb2bc){if(_0x1cb2bc){return _0x1cb2bc[_0x8013('0x2a')](_0x21530f)['then'](function(_0x116b80){return _0x116b80;});}return null;};}function removeEntity(_0x53b9f){return function(_0x152b85){if(_0x152b85){return _0x152b85[_0x8013('0x2b')]()[_0x8013('0x2c')](function(){_0x53b9f[_0x8013('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cc5b9){return function(_0x5b8371){if(!_0x5b8371){_0x4cc5b9[_0x8013('0x20')](0x194);}return _0x5b8371;};}function handleError(_0x1ece5a,_0x45197f){_0x45197f=_0x45197f||0x1f4;return function(_0xda9521){logger[_0x8013('0x1a')](_0xda9521[_0x8013('0x2d')]);if(_0xda9521[_0x8013('0x2e')]){delete _0xda9521['name'];}_0x1ece5a[_0x8013('0x21')](_0x45197f)['send'](_0xda9521);};}function getMustacheRender(_0xb79fc8,_0x191fb2){return Mustache[_0x8013('0x2f')](_0xb79fc8,_[_0x8013('0x30')](_0x191fb2[_0x8013('0x31')],{'contact':_0x191fb2[_0x8013('0x32')],'message':_0x191fb2[_0x8013('0x1c')],'agent':_0x191fb2['agent'],'interaction':_0x191fb2[_0x8013('0x33')],'account':_0x191fb2[_0x8013('0x34')]}))||'';}exports[_0x8013('0x35')]=function(_0x37b4ba,_0x415b9a){var _0x2c1544={};var _0xb9cb2=_[_0x8013('0x36')](db[_0x8013('0x37')][_0x8013('0x38')],function(_0x4994e3){return{'name':_0x4994e3['fieldName'],'type':_0x4994e3[_0x8013('0x39')][_0x8013('0x3a')]};});_0x2c1544=qs[_0x8013('0x3b')](_0xb9cb2,_0x37b4ba);return interaction['findAll'](_0x8013('0x3c'),_0x37b4ba[_0x8013('0x3d')],_0x37b4ba['user'],_0x2c1544,_0xb9cb2)[_0x8013('0x2c')](respondWithFilteredResult(_0x415b9a,_0x2c1544))[_0x8013('0x1f')](handleError(_0x415b9a,null));};exports[_0x8013('0x3e')]=function(_0x2d7ede,_0x2e12a2){var _0x1d9583={'raw':![],'where':{'id':_0x2d7ede[_0x8013('0x3f')]['id']}},_0x556178={};_0x556178[_0x8013('0x40')]=_[_0x8013('0x41')](db[_0x8013('0x37')][_0x8013('0x38')]);_0x556178[_0x8013('0x3d')]=_[_0x8013('0x41')](_0x2d7ede['query']);_0x556178[_0x8013('0x42')]=_['intersection'](_0x556178[_0x8013('0x40')],_0x556178[_0x8013('0x3d')]);_0x1d9583[_0x8013('0x43')]=_[_0x8013('0x44')](_0x556178[_0x8013('0x40')],qs[_0x8013('0x45')](_0x2d7ede['query'][_0x8013('0x45')]));_0x1d9583[_0x8013('0x43')]=_0x1d9583['attributes']['length']?_0x1d9583[_0x8013('0x43')]:_0x556178[_0x8013('0x40')];if(_0x2d7ede[_0x8013('0x3d')][_0x8013('0x46')]){_0x1d9583[_0x8013('0x47')]=[{'all':!![]}];}_0x1d9583=_['merge']({},_0x1d9583,_0x2d7ede[_0x8013('0x48')]);return db[_0x8013('0x37')][_0x8013('0x49')](_0x1d9583)[_0x8013('0x2c')](handleEntityNotFound(_0x2e12a2,null))['then'](respondWithResult(_0x2e12a2,null))[_0x8013('0x1f')](handleError(_0x2e12a2,null));};exports[_0x8013('0x4a')]=function(_0x7b250c,_0x1aa9f6){return db[_0x8013('0x37')][_0x8013('0x4a')](_0x7b250c['body'],{})[_0x8013('0x2c')](respondWithResult(_0x1aa9f6,0xc9))[_0x8013('0x1f')](handleError(_0x1aa9f6,null));};exports[_0x8013('0x2a')]=function(_0x3ff5ca,_0x2cbd69){if(_0x3ff5ca[_0x8013('0x31')]['id']){delete _0x3ff5ca[_0x8013('0x31')]['id'];}return db['ChatInteraction'][_0x8013('0x49')]({'where':{'id':_0x3ff5ca['params']['id']}})[_0x8013('0x2c')](handleEntityNotFound(_0x2cbd69,null))[_0x8013('0x2c')](saveUpdates(_0x3ff5ca[_0x8013('0x31')],null))[_0x8013('0x2c')](respondWithResult(_0x2cbd69,null))[_0x8013('0x1f')](handleError(_0x2cbd69,null));};exports[_0x8013('0x2b')]=function(_0x2951a9,_0x1d7633){return db[_0x8013('0x37')][_0x8013('0x49')]({'where':{'id':_0x2951a9[_0x8013('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1d7633,null))[_0x8013('0x2c')](removeEntity(_0x1d7633,null))[_0x8013('0x1f')](handleError(_0x1d7633,null));};exports[_0x8013('0x4b')]=function(_0x1231e0,_0x201d67){return db[_0x8013('0x37')]['describe']()[_0x8013('0x2c')](respondWithResult(_0x201d67,null))['catch'](handleError(_0x201d67,null));};exports['createVidaooSession']=function(_0x8ec26b,_0x29cc43){var _0x72b21b=_0x8ec26b[_0x8013('0x3f')]['id'];var _0x164a99;var _0x3ba278;var _0x5662e9;return db[_0x8013('0x37')][_0x8013('0x4c')]({'where':{'id':_0x72b21b}})[_0x8013('0x2c')](function(_0x30a1fa){_0x164a99=_0x30a1fa;return db[_0x8013('0x4d')]['findOne']({'where':{'id':_0x30a1fa[_0x8013('0x4e')]},'attributes':['id',_0x8013('0x4f'),_0x8013('0x50'),'vidaooTopic','vidaooNote',_0x8013('0x51')],'raw':!![]});})[_0x8013('0x2c')](function(_0x194f29){if(_0x194f29&&_0x194f29[_0x8013('0x4f')]&&_0x194f29[_0x8013('0x50')]){_0x3ba278=_0x194f29;var _0x5bb899={'interaction':{'id':_0x72b21b},'agent':{'id':_0x8ec26b['user']['id'],'name':_0x8ec26b[_0x8013('0x52')]['name'],'fullname':_0x8ec26b[_0x8013('0x52')][_0x8013('0x53')],'email':_0x8ec26b[_0x8013('0x52')][_0x8013('0x54')]},'contact':_0x8ec26b[_0x8013('0x31')][_0x8013('0x32')],'account':_0x8ec26b[_0x8013('0x31')][_0x8013('0x34')]};var _0x8fb350={'rejectUnauthorized':![],'method':_0x8013('0x55'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x194f29[_0x8013('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x8ec26b[_0x8013('0x52')]['email']],'buttons':null,'topic':_0x3ba278['vidaooTopic'],'note':_['isNull'](_0x3ba278['vidaooNote'])?null:getMustacheRender(_0x3ba278[_0x8013('0x56')],_0x5bb899),'metadata':null},'redirect':_0x8013('0x57'),'json':!![]};try{if(!_[_0x8013('0x58')](_0x3ba278[_0x8013('0x51')])){var _0x44621e=getMustacheRender(_0x3ba278[_0x8013('0x51')],_0x5bb899);var _0x13123e=JSON['parse'](_0x44621e);_0x8fb350[_0x8013('0x31')][_0x8013('0x59')]=_0x13123e;}}catch(_0x21bea5){throw new db[(_0x8013('0x5a'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x8fb350);}else{throw new db[(_0x8013('0x5a'))][(_0x8013('0x5b'))](_0x8013('0x5c'));}})[_0x8013('0x2c')](function(_0x2f5f64){_0x5662e9=_0x2f5f64;if(_0x5662e9['id']){var _0x1e8c7b={'body':_0x5662e9[_0x8013('0x5d')],'ChatWebsiteId':_0x3ba278['id'],'ChatInteractionId':_0x164a99['id'],'direction':_0x8013('0x5e'),'UserId':_0x8ec26b[_0x8013('0x52')]['id']};return db[_0x8013('0x5f')][_0x8013('0x4a')](_0x1e8c7b,{});}else{throw new db['Sequelize']['ValidationError'](_0x8013('0x60'));}})[_0x8013('0x2c')](function(){return _0x164a99[_0x8013('0x61')]({'vidaooSessionId':_0x5662e9['id']});})[_0x8013('0x2c')](respondWithResult(_0x29cc43,null))[_0x8013('0x1f')](handleError(_0x29cc43,null));};exports[_0x8013('0x62')]=function(_0x3021fb,_0x3548bf){if(_0x3021fb[_0x8013('0x31')]['id']){delete _0x3021fb[_0x8013('0x31')]['id'];}return db[_0x8013('0x37')][_0x8013('0x49')]({'where':{'id':_0x3021fb['params']['id']},'include':[{'model':db[_0x8013('0x63')],'as':_0x8013('0x64')}]})[_0x8013('0x2c')](handleEntityNotFound(_0x3548bf,null))['then'](saveUpdates(_0x3021fb['body'],null))['then'](respondWithResult(_0x3548bf,null))[_0x8013('0x1f')](handleError(_0x3548bf,null));};exports[_0x8013('0x65')]=function(_0x422bc1,_0x48a10a){if(_0x422bc1[_0x8013('0x31')]['id']){delete _0x422bc1[_0x8013('0x31')]['id'];}return db['ChatInteraction'][_0x8013('0x49')]({'where':{'id':_0x422bc1[_0x8013('0x3f')]['id']}})[_0x8013('0x2c')](function(_0x1e5273){if(!_0x1e5273){logger[_0x8013('0x1a')](_0x8013('0x66'),'abandon',0x194,_0x8013('0x67'));_0x48a10a[_0x8013('0x20')](0x194);}else{if(_0x1e5273[_0x8013('0x68')]){throw new db[(_0x8013('0x5a'))][(_0x8013('0x5b'))](_0x8013('0x69'));}}return _0x1e5273;})[_0x8013('0x2c')](function(_0x14e634){if(_0x14e634){return _0x14e634[_0x8013('0x2a')]({'closed':_0x422bc1[_0x8013('0x31')]['closed'],'disposition':_0x422bc1['body'][_0x8013('0x6a')]})[_0x8013('0x2c')](function(_0x1f9890){return _0x1f9890;});}})['then'](function(){return respondWithRpcPromise('AbandonInteraction',_0x8013('0x65'),_0x422bc1[_0x8013('0x31')],client9004);})[_0x8013('0x2c')](respondWithResult(_0x48a10a,null))[_0x8013('0x1f')](handleError(_0x48a10a,null));};exports[_0x8013('0x6b')]=function(_0x2bed1b,_0x5d589a){_0x2bed1b[_0x8013('0x31')]['name']=_0x2bed1b[_0x8013('0x6c')][_0x8013('0x6d')];_0x2bed1b[_0x8013('0x31')][_0x8013('0x6e')]=_0x2bed1b['file'][_0x8013('0x6f')];_0x2bed1b['body'][_0x8013('0x39')]=_0x2bed1b['file'][_0x8013('0x70')];return db[_0x8013('0x71')][_0x8013('0x4a')](_0x2bed1b[_0x8013('0x31')])[_0x8013('0x2c')](respondWithResult(_0x5d589a,0xc9))[_0x8013('0x1f')](handleError(_0x5d589a,null));};exports[_0x8013('0x72')]=function(_0x49f1a5,_0x12d828){return db[_0x8013('0x37')]['findOne']({'where':{'id':_0x49f1a5[_0x8013('0x3f')]['id']},'raw':!![]})[_0x8013('0x2c')](handleEntityNotFound(_0x12d828,null))[_0x8013('0x2c')](function(_0x1a4d98){if(_0x1a4d98){if(_0x1a4d98[_0x8013('0x73')]){return _0x12d828['status'](0x193)['json']({'status':0x193,'message':_0x8013('0x74')});}return db[_0x8013('0x71')][_0x8013('0x4c')]({'where':{'id':_0x49f1a5[_0x8013('0x3d')][_0x8013('0x75')]},'raw':!![]})['then'](handleEntityNotFound(_0x12d828,null));}})[_0x8013('0x2c')](function(_0x58b01d){if(_0x58b01d){var _0x386df1=_0x58b01d[_0x8013('0x76')]!==null;var _0x165165=path[_0x8013('0x77')](config['root'],_0x8013('0x78'));if(_0x386df1){_0x165165=path[_0x8013('0x77')](_0x165165,_0x8013('0x79'));}var _0x2bfad3=path[_0x8013('0x77')](_0x165165,_0x58b01d[_0x8013('0x6e')]);return _0x12d828[_0x8013('0x7a')](_0x2bfad3);}})['catch'](handleError(_0x12d828,null));};exports['close']=function(_0x18ece3,_0x189edf){var _0x5c2adf=null;var _0x45ad1e=null;var _0x491403=null;if(_0x18ece3[_0x8013('0x31')]['id']){delete _0x18ece3[_0x8013('0x31')]['id'];}if(_0x18ece3[_0x8013('0x31')][_0x8013('0x7b')]){_0x491403=path[_0x8013('0x77')](config[_0x8013('0x7c')],'server/files/chat/upload/',util[_0x8013('0x7d')](_0x8013('0x7e'),Date['now']()));_0x18ece3['body'][_0x8013('0x7f')]=_0x491403;}return db['ChatInteraction'][_0x8013('0x49')]({'where':{'id':_0x18ece3['params']['id']},'include':[{'model':db[_0x8013('0x5f')],'as':_0x8013('0x80'),'include':[{'model':db[_0x8013('0x81')],'as':_0x8013('0x81')}]}]})[_0x8013('0x2c')](handleEntityNotFound(_0x189edf,null))[_0x8013('0x2c')](saveUpdates(_0x18ece3[_0x8013('0x31')],null))[_0x8013('0x2c')](function(_0x319083){if(_0x319083){_0x5c2adf=_0x319083;return db[_0x8013('0x4d')]['find']({'where':{'id':_0x5c2adf[_0x8013('0x4e')]}});}})[_0x8013('0x2c')](function(_0x4bbc3d){if(_0x4bbc3d){_0x45ad1e=_0x4bbc3d;return db[_0x8013('0x63')][_0x8013('0x49')]({'where':{'id':_0x5c2adf[_0x8013('0x82')]}});}})['then'](function(_0x268b70){if(_0x268b70){if(_0x491403){var _0x3159b4=null;for(var _0x8126cf=0x1;_0x8126cf<_0x5c2adf[_0x8013('0x80')]['length'];++_0x8126cf){_0x3159b4=_0x5c2adf[_0x8013('0x80')][_0x8126cf];var _0x182509=_0x3159b4[_0x8013('0x68')]?util[_0x8013('0x7d')](_0x8013('0x83'),_0x45ad1e[_0x8013('0x84')],_0x3159b4[_0x8013('0x68')]):'System';var _0x132751=_0x18ece3[_0x8013('0x31')][_0x8013('0x85')]||util['format'](_0x8013('0x83'),_0x8013('0x86'),_0x3159b4['ContactId']);switch(_0x45ad1e[_0x8013('0x87')]){case _0x8013('0x88'):_0x182509=_0x3159b4['UserId']?util['format'](_0x8013('0x83'),_0x45ad1e[_0x8013('0x84')],_0x3159b4['UserId']):_0x8013('0x89');break;case _0x8013('0x8a'):_0x182509=_0x3159b4[_0x8013('0x68')]?_0x3159b4[_0x8013('0x81')][_0x8013('0x8b')]||_0x3159b4[_0x8013('0x81')]['fullname']:_0x8013('0x89');break;case'agent_fullname':_0x182509=_0x3159b4[_0x8013('0x68')]?_0x3159b4['User'][_0x8013('0x53')]:_0x8013('0x89');break;default:_0x182509=_0x3159b4[_0x8013('0x68')]?util['format'](_0x8013('0x83'),_0x45ad1e[_0x8013('0x84')],_0x3159b4[_0x8013('0x68')]):_0x8013('0x89');}var _0x376097=util[_0x8013('0x7d')]('[%s]\x20%s:\x20%s\x0a',moment(_0x3159b4[_0x8013('0x8c')])['format'](_0x8013('0x8d')),_0x3159b4[_0x8013('0x8e')]==='in'?_0x132751:_0x182509,_0x3159b4['body']);if(!_0x3159b4[_0x8013('0x8f')]){fs['appendFileSync'](_0x491403,_0x376097);}}return db['MailAccount'][_0x8013('0x4c')]({'where':{'service':!![]},'include':[{'model':db[_0x8013('0x90')],'as':_0x8013('0x91'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x8013('0x92'),'raw':!![]}]}]});}}})[_0x8013('0x2c')](function(_0xdedef){if(!_0xdedef||!_0xdedef[_0x8013('0x91')]||!_0x18ece3[_0x8013('0x31')])return _0x5c2adf;var _0x47d10=_0xdedef[_0x8013('0x93')]();return respondWithRpcPromise('SendMail',_0x8013('0x94'),{'account':_0x47d10,'message':{'from':util[_0x8013('0x7d')](_0x8013('0x95'),_0xdedef[_0x8013('0x2e')],_0xdedef['email']||_0xdedef[_0x8013('0x91')][_0x8013('0x52')]),'to':_0x18ece3[_0x8013('0x31')]['mailTranscript'],'subject':_0x8013('0x96'),'text':util[_0x8013('0x7d')](_0x8013('0x97'),_0x18ece3[_0x8013('0x31')]['mailTranscript']),'attachments':[{'path':_0x491403}]}})[_0x8013('0x2c')](function(){return _0x5c2adf;})['catch'](function(_0x460dab){logger[_0x8013('0x1a')](_0x460dab);});})[_0x8013('0x2c')](respondWithStatusCode(_0x189edf,0xc8))[_0x8013('0x1f')](handleError(_0x189edf,null));};exports[_0x8013('0x98')]=function(_0x147c27,_0x68d845){return db[_0x8013('0x5f')][_0x8013('0x49')]({'where':{'id':_0x147c27['params']['id']}})[_0x8013('0x2c')](handleEntityNotFound(_0x68d845,null))[_0x8013('0x2c')](function(_0x3391ea){if(_0x3391ea){return _0x3391ea['addMessage'](_0x147c27[_0x8013('0x31')]['ids'],_['omit'](_0x147c27[_0x8013('0x31')],[_0x8013('0x99'),'id'])||{});}})[_0x8013('0x2c')](respondWithResult(_0x68d845,null))[_0x8013('0x1f')](handleError(_0x68d845,null));};exports[_0x8013('0x9a')]=function(_0x21c483,_0x2f9229){var _0x370f84={'raw':![],'where':{}};var _0x1e3fce={};var _0x4314d1={'count':0x0,'rows':[]};return db[_0x8013('0x37')][_0x8013('0x4c')]({'where':{'id':_0x21c483[_0x8013('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2f9229,null))[_0x8013('0x2c')](function(_0x351597){if(_0x351597){_0x1e3fce[_0x8013('0x40')]=_[_0x8013('0x41')](db['ChatMessage']['rawAttributes']);_0x1e3fce[_0x8013('0x3d')]=_[_0x8013('0x41')](_0x21c483['query']);_0x1e3fce[_0x8013('0x42')]=_['intersection'](_0x1e3fce['model'],_0x1e3fce[_0x8013('0x3d')]);_0x370f84['attributes']=_[_0x8013('0x44')](_0x1e3fce[_0x8013('0x40')],qs[_0x8013('0x45')](_0x21c483[_0x8013('0x3d')]['fields']));_0x370f84[_0x8013('0x43')]=_0x370f84[_0x8013('0x43')][_0x8013('0x9b')]?_0x370f84[_0x8013('0x43')]:_0x1e3fce[_0x8013('0x40')];if(!_0x21c483[_0x8013('0x3d')][_0x8013('0x9c')](_0x8013('0x9d'))){_0x370f84[_0x8013('0x26')]=qs['limit'](_0x21c483[_0x8013('0x3d')][_0x8013('0x26')]);_0x370f84[_0x8013('0x23')]=qs['offset'](_0x21c483[_0x8013('0x3d')][_0x8013('0x23')]);}_0x370f84['order']=qs[_0x8013('0x9e')](_0x21c483[_0x8013('0x3d')][_0x8013('0x9e')]);_0x370f84[_0x8013('0x9f')]=qs['filters'](_['pick'](_0x21c483[_0x8013('0x3d')],_0x1e3fce[_0x8013('0x42')]));_0x370f84[_0x8013('0x9f')]['ChatInteractionId']=_0x351597['id'];if(_0x21c483[_0x8013('0x3d')][_0x8013('0xa0')]){_0x370f84[_0x8013('0x9f')]=_[_0x8013('0x30')](_0x370f84[_0x8013('0x9f')],{'$or':_[_0x8013('0x36')](_0x370f84[_0x8013('0x43')],function(_0x1218b2){var _0x1c34f0={};_0x1c34f0[_0x1218b2]={'$like':'%'+_0x21c483[_0x8013('0x3d')]['filter']+'%'};return _0x1c34f0;})});}if(_0x21c483['query'][_0x8013('0xa1')]){var _0x5027c6=_0x21c483[_0x8013('0x3d')]['$gte']['split'](',');var _0x3a4878={};_0x3a4878[_0x5027c6[0x0]]={'$gte':moment(_0x5027c6[0x1])[_0x8013('0x7d')](_0x8013('0xa2'))};_0x370f84['where']=_[_0x8013('0x30')](_0x370f84[_0x8013('0x9f')],_0x3a4878);}_0x370f84=_[_0x8013('0x30')]({},_0x370f84,_0x21c483[_0x8013('0x48')]);return db[_0x8013('0x5f')][_0x8013('0x25')]({'where':_0x370f84[_0x8013('0x9f')]})[_0x8013('0x2c')](function(_0x17265d){_0x4314d1['count']=_0x17265d;if(_0x21c483[_0x8013('0x3d')][_0x8013('0x46')]){_0x370f84[_0x8013('0x47')]=[{'all':!![]}];}return db[_0x8013('0x5f')][_0x8013('0xa3')](_0x370f84);})[_0x8013('0x2c')](function(_0x546ddf){_0x4314d1[_0x8013('0xa4')]=_0x546ddf;return _0x4314d1;});}})[_0x8013('0x2c')](respondWithFilteredResult(_0x2f9229,_0x370f84))[_0x8013('0x1f')](handleError(_0x2f9229,null));};exports[_0x8013('0xa5')]=function(_0x1adc56,_0x3f8998){var _0x1b9822={'where':{}},_0x4c4e57={},_0xb99ed={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x8013('0x4c')]({'where':{'id':_0x1adc56[_0x8013('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3f8998,null))[_0x8013('0x2c')](function(_0x9c12af){if(_0x9c12af){_0x4c4e57[_0x8013('0x40')]=_[_0x8013('0x41')](db[_0x8013('0x5f')][_0x8013('0x38')]);_0x4c4e57[_0x8013('0x3d')]=_['keys'](_0x1adc56[_0x8013('0x3d')]);_0x4c4e57[_0x8013('0x42')]=_[_0x8013('0x44')](_0x4c4e57[_0x8013('0x40')],_0x4c4e57[_0x8013('0x3d')]);_0x1b9822['attributes']=_[_0x8013('0x44')](_0x4c4e57[_0x8013('0x40')],qs['fields'](_0x1adc56[_0x8013('0x3d')][_0x8013('0x45')]));_0x1b9822[_0x8013('0x43')]=_0x1b9822[_0x8013('0x43')][_0x8013('0x9b')]?_0x1b9822[_0x8013('0x43')]:_0x4c4e57['model'];if(!_0x1adc56[_0x8013('0x3d')]['hasOwnProperty']('nolimit')){_0x1b9822[_0x8013('0x26')]=qs[_0x8013('0x26')](_0x1adc56[_0x8013('0x3d')][_0x8013('0x26')]);_0x1b9822['offset']=qs[_0x8013('0x23')](_0x1adc56['query'][_0x8013('0x23')]);}_0x1b9822[_0x8013('0xa6')]=qs[_0x8013('0x9e')](_0x1adc56['query']['sort']);_0x1b9822[_0x8013('0x9f')]=qs[_0x8013('0x42')](_[_0x8013('0xa7')](_0x1adc56[_0x8013('0x3d')],_0x4c4e57[_0x8013('0x42')]));_0x1b9822['where'][_0x8013('0xa8')]=_0x9c12af['id'];if(_0x1adc56[_0x8013('0x3d')][_0x8013('0xa0')]){_0x1b9822[_0x8013('0x9f')]=_[_0x8013('0x30')](_0x1b9822[_0x8013('0x9f')],{'$or':_[_0x8013('0x36')](_0x1b9822['attributes'],function(_0xd0aacf){var _0x30a60d={};_0x30a60d[_0xd0aacf]={'$like':'%'+_0x1adc56[_0x8013('0x3d')][_0x8013('0xa0')]+'%'};return _0x30a60d;})});}_0x1b9822['where'][_0x8013('0x8f')]=![];if(_0x1adc56[_0x8013('0x3d')]['id']){_0x1b9822['where']['id']={'$gt':_0x1adc56[_0x8013('0x3d')]['id']};}_0x1b9822=_[_0x8013('0x30')]({},_0x1b9822,_0x1adc56['options']);return db[_0x8013('0x5f')][_0x8013('0x25')]({'where':_0x1b9822['where']})[_0x8013('0x2c')](function(_0xfdc0ec){_0xb99ed[_0x8013('0x25')]=_0xfdc0ec;_0x1b9822['include']=[];if(_0x1adc56[_0x8013('0x3d')][_0x8013('0xa9')]){_0x1b9822[_0x8013('0x47')][_0x8013('0xaa')]({'model':db['User'],'as':'User','attributes':['id',_0x8013('0x53'),'alias']});}if(_0x1adc56[_0x8013('0x3d')][_0x8013('0x46')]){_0x1b9822[_0x8013('0x47')]=[{'all':!![]}];}return db[_0x8013('0x5f')][_0x8013('0xa3')](_0x1b9822);})['then'](function(_0x36896b){_0xb99ed[_0x8013('0xa4')]=_0x36896b;return _0xb99ed;});}})[_0x8013('0x2c')](respondWithFilteredResult(_0x3f8998,_0x1b9822))[_0x8013('0x1f')](handleError(_0x3f8998,null));};exports[_0x8013('0xab')]=function(_0x3355fb,_0xf88343){return db['ChatInteraction'][_0x8013('0x49')]({'where':{'id':_0x3355fb['params']['id']}})[_0x8013('0x2c')](handleEntityNotFound(_0xf88343,null))[_0x8013('0x2c')](function(_0x35f36f){if(_0x35f36f){return _0x35f36f['setTags'](_0x3355fb[_0x8013('0x31')][_0x8013('0x99')],_[_0x8013('0xac')](_0x3355fb['body'],[_0x8013('0x99'),'id'])||{})[_0x8013('0xad')](function(){return db['Tag'][_0x8013('0xa3')]({'attributes':['id',_0x8013('0x2e'),_0x8013('0xae')],'where':{'id':_0x3355fb[_0x8013('0x31')]['ids']}});})['then'](function(_0xd1657d){socket[_0x8013('0xaf')](_0x8013('0xb0'),{'id':Number(_0x3355fb[_0x8013('0x3f')]['id']),'tags':_0xd1657d||[]});return{'id':Number(_0x3355fb['params']['id']),'tags':_0xd1657d||[]};});}})[_0x8013('0x2c')](respondWithResult(_0xf88343,null))['catch'](handleError(_0xf88343,null));};exports[_0x8013('0xb1')]=function(_0xec0146,_0x327c81){return db[_0x8013('0x37')][_0x8013('0x49')]({'where':{'id':_0xec0146[_0x8013('0x3f')]['id']}})[_0x8013('0x2c')](handleEntityNotFound(_0x327c81,null))['then'](function(_0x3b97f3){if(_0x3b97f3){return _0x3b97f3[_0x8013('0xb1')](_0xec0146['query'][_0x8013('0x99')]);}})[_0x8013('0x2c')](respondWithStatusCode(_0x327c81,null))[_0x8013('0x1f')](handleError(_0x327c81,null));};exports[_0x8013('0x7a')]=function(_0x8745a6,_0x21c0ef){var _0x142225=moment()[_0x8013('0xb2')]()['toString']();var _0x5b838b=path['join'](config[_0x8013('0x7c')],_0x8013('0xb3'),_0x8013('0xb4'),_0x8013('0xb5'));var _0x349c79=path[_0x8013('0x77')](config[_0x8013('0x7c')],_0x8013('0xb3'),_0x8013('0xb4'),_0x8013('0xb6'));var _0x152106=path[_0x8013('0x77')](_0x5b838b,_0x142225);var _0x150729=util['format'](_0x8013('0xb7'),_0x8745a6[_0x8013('0x3f')]['id'],_0x142225);var _0x5a6fa1=path[_0x8013('0x77')](_0x5b838b,_0x150729);var _0x398755=[];_0x398755[_0x8013('0xaa')]({'model':db[_0x8013('0x81')],'as':_0x8013('0x81'),'attributes':['id',_0x8013('0x53')],'raw':!![]});_0x398755[_0x8013('0xaa')]({'model':db[_0x8013('0x63')],'as':_0x8013('0x64'),'attributes':['id',_0x8013('0xb8'),_0x8013('0xb9')],'raw':!![]});if(_0x8745a6['query'][_0x8013('0xb6')]){_0x398755[_0x8013('0xaa')]({'model':db[_0x8013('0x71')],'as':_0x8013('0x71'),'raw':!![]});}var _0x32b8b0=[{'model':db[_0x8013('0x5f')],'as':_0x8013('0x80'),'attributes':['id',_0x8013('0x31'),_0x8013('0x8c'),'direction',_0x8013('0x8f'),'read'],'include':_0x398755}];_0x32b8b0['push']({'model':db['ChatWebsite'],'as':_0x8013('0xba'),'attributes':['id',_0x8013('0x2e')]});_0x32b8b0[_0x8013('0xaa')]({'model':db['User'],'as':_0x8013('0xbb'),'attributes':['id','fullname']});return db[_0x8013('0x37')]['find']({'where':{'id':_0x8745a6[_0x8013('0x3f')]['id']},'include':_0x32b8b0})[_0x8013('0x2c')](handleEntityNotFound(_0x21c0ef,null))[_0x8013('0x2c')](function(_0x1e87aa){if(_0x1e87aa){var _0x372acf=_0x1e87aa[_0x8013('0xbc')]({'plain':!![]});fs[_0x8013('0xbd')](_0x152106);var _0x28ea95={'channel':_0x8013('0xbe'),'account':_0x372acf[_0x8013('0xba')]['name'],'agent':_0x372acf[_0x8013('0xbb')]?_0x372acf[_0x8013('0xbb')][_0x8013('0x53')]:_0x8013('0xbf'),'createdAt':moment(_0x372acf[_0x8013('0x8c')])[_0x8013('0x7d')](_0x8013('0xa2'))[_0x8013('0xc0')](),'closedAt':_0x372acf[_0x8013('0x73')]?moment(_0x372acf[_0x8013('0xc1')])[_0x8013('0x7d')](_0x8013('0xa2'))[_0x8013('0xc0')]():'','disposition':_0x372acf[_0x8013('0x6a')],'chatInfo':{'browser':_0x372acf[_0x8013('0xc2')],'os':_0x372acf[_0x8013('0xc3')],'referer':_0x372acf[_0x8013('0xc4')],'customerIp':_0x372acf[_0x8013('0xc5')],'customerPort':_0x372acf[_0x8013('0xc6')]?_0x372acf[_0x8013('0xc6')]:_0x8013('0xbf')},'messages':_(_0x372acf[_0x8013('0x80')])[_0x8013('0xc7')]()[_0x8013('0xa0')]({'secret':![]})[_0x8013('0x36')](function(_0x395112){if(_0x395112[_0x8013('0x71')]){var _0x26c9f6=path[_0x8013('0x77')](_0x349c79,_0x395112[_0x8013('0x71')][_0x8013('0x6e')]);if(fs[_0x8013('0xc8')](_0x26c9f6)){fs[_0x8013('0xc9')](_0x26c9f6)[_0x8013('0xca')](fs[_0x8013('0xcb')](path['join'](_0x152106,_0x395112['Attachment'][_0x8013('0x6e')])));}}return{'date':moment(_0x395112[_0x8013('0x8c')])['format'](_0x8013('0xa2'))[_0x8013('0xc0')](),'sender':_0x395112[_0x8013('0x8e')]==='out'?_0x395112['User']?_0x395112['User'][_0x8013('0x53')]:_0x8013('0x89'):_0x395112['Contact'][_0x8013('0xb8')]+(_0x395112[_0x8013('0x64')]['lastName']?'\x20'+_0x395112[_0x8013('0x64')]['lastName']:''),'body':_0x395112[_0x8013('0x71')]?_0x395112['Attachment'][_0x8013('0x6e')]:_0x395112[_0x8013('0x31')],'direction':_0x395112[_0x8013('0x8e')]===_0x8013('0x5e')?'A':'C','secret':_0x395112[_0x8013('0x8f')],'read':_0x395112[_0x8013('0xcc')],'attachment':_0x395112[_0x8013('0x71')]};})[_0x8013('0xcd')]()};return ejs[_0x8013('0xce')](path['join'](config[_0x8013('0x7c')],_0x8013('0xb3'),_0x8013('0xcf'),_0x8013('0xd0')),{'interaction':_0x28ea95})[_0x8013('0x2c')](function(_0x5c4e7d){var _0x5ebbc4=path[_0x8013('0x77')](_0x152106,_0x8013('0xd1')+_0x372acf['id']+'-'+_0x142225+'.pdf');var _0x1a8635={'path':_0x5ebbc4,'channel':_0x8013('0xbe'),'interactionId':_0x372acf['id']};return pdf[_0x8013('0xd2')](_0x5c4e7d,_0x1a8635);})['then'](function(){return new Promise(function(_0x26a3af,_0x25317f){zipdir(_0x152106,{'saveTo':_0x5a6fa1},function(_0x42ea44,_0x49312e){if(_0x42ea44)return _0x25317f(_0x42ea44);return _0x26a3af(_0x49312e);});})[_0x8013('0x2c')](function(){return new BPromise(function(_0x42d8da,_0x28b611){rimraf(_0x152106,function(_0xd032ea){if(_0xd032ea)_0x28b611(_0xd032ea);return _0x42d8da();});});})[_0x8013('0x2c')](function(){return _0x21c0ef[_0x8013('0x7a')](_0x5a6fa1,_0x150729,function(_0x2091c4){if(_0x2091c4){logger[_0x8013('0x1a')](_0x8013('0xd3'),_0x2091c4);}else{fs[_0x8013('0xd4')](_0x5a6fa1);}});});});}else{return _0x21c0ef[_0x8013('0x20')](0xc8);}})['catch'](handleError(_0x21c0ef,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index e234c4b..fc9e3c5 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 _0xc4d8=['../../mysqldb','ChatInteraction','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook','exports','events'];(function(_0x34bfd8,_0x24eaa3){var _0x122c91=function(_0x17081a){while(--_0x17081a){_0x34bfd8['push'](_0x34bfd8['shift']());}};_0x122c91(++_0x24eaa3);}(_0xc4d8,0x1ca));var _0x8c4d=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xc4d8[_0x373dee];return _0x46798f;};'use strict';var EventEmitter=require(_0x8c4d('0x0'));var ChatInteraction=require(_0x8c4d('0x1'))['db'][_0x8c4d('0x2')];var ChatMessage=require(_0x8c4d('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8c4d('0x3'),'afterUpdate':_0x8c4d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x484841){return function(_0x240f0b,_0x23547b,_0x440892){_0x240f0b[_0x8c4d('0x5')]({'attributes':['id'],'raw':!![]})[_0x8c4d('0x6')](function(_0x5ed698){_0x240f0b[_0x8c4d('0x7')](_0x8c4d('0x8'),_0x5ed698[_0x8c4d('0x9')](function(_0x38afb5){return{'id':_0x38afb5['id']};}));return ChatMessage[_0x8c4d('0xa')]({'where':{'ChatInteractionId':_0x240f0b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8c4d('0x6')](function(_0xa660dc){_0x240f0b[_0x8c4d('0x7')](_0x8c4d('0xb'),_0xa660dc[_0x8c4d('0xc')]);ChatInteractionEvents['emit'](_0x484841+':'+_0x240f0b['id'],_0x240f0b);ChatInteractionEvents[_0x8c4d('0xd')](_0x484841,_0x240f0b);_0x440892(null);})[_0x8c4d('0xe')](_0x440892(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x8c4d('0xf')](e,emitEvent(event));}}module[_0x8c4d('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0xc0d1=['getUsers','then','setDataValue','map','findAll','length','emit','catch','hook','exports','events','../../mysqldb','ChatInteraction','save','update','remove'];(function(_0x4804d7,_0x56ef10){var _0x532259=function(_0x5929e3){while(--_0x5929e3){_0x4804d7['push'](_0x4804d7['shift']());}};_0x532259(++_0x56ef10);}(_0xc0d1,0x15a));var _0x1c0d=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xc0d1[_0x4e676e];return _0x336a3c;};'use strict';var EventEmitter=require(_0x1c0d('0x0'));var ChatInteraction=require(_0x1c0d('0x1'))['db'][_0x1c0d('0x2')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1c0d('0x3'),'afterUpdate':_0x1c0d('0x4'),'afterDestroy':_0x1c0d('0x5')};function emitEvent(_0x500df2){return function(_0x3426b0,_0x48e3dc,_0x7431cc){_0x3426b0[_0x1c0d('0x6')]({'attributes':['id'],'raw':!![]})[_0x1c0d('0x7')](function(_0x250c10){_0x3426b0[_0x1c0d('0x8')]('Users',_0x250c10[_0x1c0d('0x9')](function(_0x2533d4){return{'id':_0x2533d4['id']};}));return ChatMessage[_0x1c0d('0xa')]({'where':{'ChatInteractionId':_0x3426b0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1c0d('0x7')](function(_0x2d148e){_0x3426b0[_0x1c0d('0x8')]('unreadMessages',_0x2d148e[_0x1c0d('0xb')]);ChatInteractionEvents[_0x1c0d('0xc')](_0x500df2+':'+_0x3426b0['id'],_0x3426b0);ChatInteractionEvents[_0x1c0d('0xc')](_0x500df2,_0x3426b0);_0x7431cc(null);})[_0x1c0d('0xd')](_0x7431cc(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x1c0d('0xe')](e,emitEvent(event));}}module[_0x1c0d('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 5b3fc8f..d2b24cd 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 _0x7724=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./chatInteraction.attributes','exports','define','ChatInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci'];(function(_0x1ab35d,_0x3f401d){var _0x133d6d=function(_0x381b41){while(--_0x381b41){_0x1ab35d['push'](_0x1ab35d['shift']());}};_0x133d6d(++_0x3f401d);}(_0x7724,0x143));var _0x4772=function(_0x3e2682,_0x4690b0){_0x3e2682=_0x3e2682-0x0;var _0x5977e9=_0x7724[_0x3e2682];return _0x5977e9;};'use strict';var _=require(_0x4772('0x0'));var util=require(_0x4772('0x1'));var logger=require(_0x4772('0x2'))(_0x4772('0x3'));var moment=require(_0x4772('0x4'));var BPromise=require('bluebird');var rp=require(_0x4772('0x5'));var fs=require('fs');var path=require(_0x4772('0x6'));var rimraf=require(_0x4772('0x7'));var config=require('../../config/environment');var attributes=require(_0x4772('0x8'));module[_0x4772('0x9')]=function(_0xccaf2e,_0x389055){return _0xccaf2e[_0x4772('0xa')](_0x4772('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x352c27,_0x3b9bd2,_0x2537e7){if(_0x352c27[_0x4772('0xc')]('closed')){_0x352c27[_0x4772('0xd')]=moment()[_0x4772('0xe')](_0x4772('0xf'));}_0x2537e7(null,_0x352c27);}},'charset':'utf8mb4','collate':_0x4772('0x10')});}; \ No newline at end of file +var _0xb8e4=['moment','rimraf','../../config/environment','exports','define','chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger'];(function(_0x24d88c,_0x485c4d){var _0x49ac8c=function(_0x58f116){while(--_0x58f116){_0x24d88c['push'](_0x24d88c['shift']());}};_0x49ac8c(++_0x485c4d);}(_0xb8e4,0x1de));var _0x4b8e=function(_0x54fd96,_0xdd6498){_0x54fd96=_0x54fd96-0x0;var _0x501cbb=_0xb8e4[_0x54fd96];return _0x501cbb;};'use strict';var _=require('lodash');var util=require(_0x4b8e('0x0'));var logger=require(_0x4b8e('0x1'))('api');var moment=require(_0x4b8e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4b8e('0x3'));var config=require(_0x4b8e('0x4'));var attributes=require('./chatInteraction.attributes');module[_0x4b8e('0x5')]=function(_0xf4a14,_0x15abdc){return _0xf4a14[_0x4b8e('0x6')]('ChatInteraction',attributes,{'tableName':_0x4b8e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x168eec,_0xf7a6e3,_0x1d5ff2){if(_0x168eec[_0x4b8e('0x8')]('closed')){_0x168eec[_0x4b8e('0x9')]=moment()[_0x4b8e('0xa')](_0x4b8e('0xb'));}_0x1d5ff2(null,_0x168eec);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 2a7f3f1..2253d8c 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 _0x188f=['request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','update','body','options','raw','attributes','limit','debug','AddTagsToChatInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./chatInteraction.socket','register'];(function(_0x583773,_0x2dd85a){var _0x433ed4=function(_0x267f31){while(--_0x267f31){_0x583773['push'](_0x583773['shift']());}};_0x433ed4(++_0x2dd85a);}(_0x188f,0x76));var _0xf188=function(_0x2acbcf,_0x19ba8f){_0x2acbcf=_0x2acbcf-0x0;var _0x4173ee=_0x188f[_0x2acbcf];return _0x4173ee;};'use strict';var _=require(_0xf188('0x0'));var util=require('util');var moment=require(_0xf188('0x1'));var BPromise=require(_0xf188('0x2'));var rs=require(_0xf188('0x3'));var fs=require('fs');var Redis=require(_0xf188('0x4'));var db=require(_0xf188('0x5'))['db'];var utils=require(_0xf188('0x6'));var logger=require(_0xf188('0x7'))(_0xf188('0x8'));var config=require('../../config/environment');var jayson=require(_0xf188('0x9'));var client=jayson[_0xf188('0xa')][_0xf188('0xb')]({'port':0x232a});config[_0xf188('0xc')]=_[_0xf188('0xd')](config[_0xf188('0xc')],{'host':_0xf188('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf188('0xc')]));require(_0xf188('0xf'))[_0xf188('0x10')](socket);function respondWithRpcPromise(_0x585f78,_0x13e39e,_0x5a0b8a){return new BPromise(function(_0x13e03e,_0x328c0e){return client[_0xf188('0x11')](_0x585f78,_0x5a0b8a)[_0xf188('0x12')](function(_0x374bb4){logger[_0xf188('0x13')](_0xf188('0x14'),_0x13e39e,_0xf188('0x15'));logger['debug'](_0xf188('0x16'),_0x13e39e,_0xf188('0x15'),JSON[_0xf188('0x17')](_0x374bb4));if(_0x374bb4[_0xf188('0x18')]){if(_0x374bb4[_0xf188('0x18')][_0xf188('0x19')]===0x1f4){logger[_0xf188('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x13e39e,_0x374bb4[_0xf188('0x18')][_0xf188('0x1a')]);return _0x328c0e(_0x374bb4['error'][_0xf188('0x1a')]);}logger[_0xf188('0x18')](_0xf188('0x14'),_0x13e39e,_0x374bb4[_0xf188('0x18')]['message']);return _0x13e03e(_0x374bb4[_0xf188('0x18')][_0xf188('0x1a')]);}else{logger['info'](_0xf188('0x14'),_0x13e39e,_0xf188('0x15'));_0x13e03e(_0x374bb4[_0xf188('0x1b')][_0xf188('0x1a')]);}})[_0xf188('0x1c')](function(_0x5c28fd){logger[_0xf188('0x18')](_0xf188('0x14'),_0x13e39e,_0x5c28fd);_0x328c0e(_0x5c28fd);});});}exports[_0xf188('0x1d')]=function(_0xe4d3ad){var _0x26cc47=this;return new Promise(function(_0x4fab6b,_0x2cde7d){return db['ChatInteraction'][_0xf188('0x1e')](_0xe4d3ad[_0xf188('0x1f')],{'raw':_0xe4d3ad[_0xf188('0x20')]?_0xe4d3ad['options'][_0xf188('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe4d3ad[_0xf188('0x20')]?_0xe4d3ad[_0xf188('0x20')]['where']||null:null,'attributes':_0xe4d3ad[_0xf188('0x20')]?_0xe4d3ad['options'][_0xf188('0x22')]||null:null,'limit':_0xe4d3ad[_0xf188('0x20')]?_0xe4d3ad['options'][_0xf188('0x23')]||null:null})['then'](function(_0x3940bf){logger[_0xf188('0x13')](_0xf188('0x1d'),_0xe4d3ad);logger[_0xf188('0x24')](_0xf188('0x1d'),_0xe4d3ad,JSON[_0xf188('0x17')](_0x3940bf));_0x4fab6b(_0x3940bf);})[_0xf188('0x1c')](function(_0x5734bd){logger[_0xf188('0x18')](_0xf188('0x1d'),_0x5734bd[_0xf188('0x1a')],_0xe4d3ad);_0x2cde7d(_0x26cc47[_0xf188('0x18')](0x1f4,_0x5734bd[_0xf188('0x1a')]));});});};exports[_0xf188('0x25')]=function(_0x128799){return new Promise(function(_0x5408e5,_0x32d201){return db['ChatInteraction'][_0xf188('0x26')]({'where':_0x128799[_0xf188('0x20')]?_0x128799['options'][_0xf188('0x27')]||null:null})[_0xf188('0x12')](function(_0x21c177){if(_0x21c177){return _0x21c177[_0xf188('0x28')](_0x128799[_0xf188('0x1f')][_0xf188('0x29')],_[_0xf188('0x2a')](_0x128799[_0xf188('0x1f')],[_0xf188('0x29'),'id'])||{});}})[_0xf188('0x2b')](function(_0x4df79b){logger['info']('AddTags',_0x128799);logger[_0xf188('0x24')](_0xf188('0x2c'),_0x128799,JSON['stringify'](_0x4df79b));_0x5408e5(_0x4df79b);})[_0xf188('0x1c')](function(_0x581354){logger['error'](_0xf188('0x2c'),_0x581354[_0xf188('0x1a')],_0x128799);_0x32d201(_this[_0xf188('0x18')](0x1f4,_0x581354[_0xf188('0x1a')]));});});}; \ No newline at end of file +var _0x2592=['then','catch','AddTagsToChatInteraction','find','addTags','ids','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./chatInteraction.socket','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit'];(function(_0x314b4b,_0x2706d9){var _0x3e857b=function(_0x39c7b0){while(--_0x39c7b0){_0x314b4b['push'](_0x314b4b['shift']());}};_0x3e857b(++_0x2706d9);}(_0x2592,0x1e0));var _0x2259=function(_0x21bef5,_0x27b94a){_0x21bef5=_0x21bef5-0x0;var _0x524300=_0x2592[_0x21bef5];return _0x524300;};'use strict';var _=require(_0x2259('0x0'));var util=require('util');var moment=require(_0x2259('0x1'));var BPromise=require(_0x2259('0x2'));var rs=require(_0x2259('0x3'));var fs=require('fs');var Redis=require(_0x2259('0x4'));var db=require(_0x2259('0x5'))['db'];var utils=require(_0x2259('0x6'));var logger=require(_0x2259('0x7'))(_0x2259('0x8'));var config=require('../../config/environment');var jayson=require(_0x2259('0x9'));var client=jayson[_0x2259('0xa')][_0x2259('0xb')]({'port':0x232a});config[_0x2259('0xc')]=_[_0x2259('0xd')](config[_0x2259('0xc')],{'host':_0x2259('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2259('0xc')]));require(_0x2259('0xf'))['register'](socket);function respondWithRpcPromise(_0x3a05cb,_0x441443,_0xdaf957){return new BPromise(function(_0x1a5ae0,_0x31fc64){return client[_0x2259('0x10')](_0x3a05cb,_0xdaf957)['then'](function(_0xfd12a4){logger['info'](_0x2259('0x11'),_0x441443,_0x2259('0x12'));logger[_0x2259('0x13')](_0x2259('0x14'),_0x441443,_0x2259('0x12'),JSON[_0x2259('0x15')](_0xfd12a4));if(_0xfd12a4[_0x2259('0x16')]){if(_0xfd12a4[_0x2259('0x16')][_0x2259('0x17')]===0x1f4){logger[_0x2259('0x16')](_0x2259('0x11'),_0x441443,_0xfd12a4['error'][_0x2259('0x18')]);return _0x31fc64(_0xfd12a4[_0x2259('0x16')][_0x2259('0x18')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x441443,_0xfd12a4['error'][_0x2259('0x18')]);return _0x1a5ae0(_0xfd12a4[_0x2259('0x16')][_0x2259('0x18')]);}else{logger[_0x2259('0x19')](_0x2259('0x11'),_0x441443,_0x2259('0x12'));_0x1a5ae0(_0xfd12a4[_0x2259('0x1a')][_0x2259('0x18')]);}})['catch'](function(_0x57e033){logger['error'](_0x2259('0x11'),_0x441443,_0x57e033);_0x31fc64(_0x57e033);});});}exports[_0x2259('0x1b')]=function(_0x1b117f){var _0x470d08=this;return new Promise(function(_0x5b4903,_0xfd69d5){return db[_0x2259('0x1c')][_0x2259('0x1d')](_0x1b117f[_0x2259('0x1e')],{'raw':_0x1b117f['options']?_0x1b117f[_0x2259('0x1f')][_0x2259('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b117f['options']?_0x1b117f['options'][_0x2259('0x21')]||null:null,'attributes':_0x1b117f['options']?_0x1b117f[_0x2259('0x1f')][_0x2259('0x22')]||null:null,'limit':_0x1b117f[_0x2259('0x1f')]?_0x1b117f['options'][_0x2259('0x23')]||null:null})[_0x2259('0x24')](function(_0xe585c1){logger[_0x2259('0x19')]('UpdateChatInteraction',_0x1b117f);logger[_0x2259('0x13')](_0x2259('0x1b'),_0x1b117f,JSON['stringify'](_0xe585c1));_0x5b4903(_0xe585c1);})[_0x2259('0x25')](function(_0x5b8829){logger[_0x2259('0x16')](_0x2259('0x1b'),_0x5b8829['message'],_0x1b117f);_0xfd69d5(_0x470d08[_0x2259('0x16')](0x1f4,_0x5b8829['message']));});});};exports[_0x2259('0x26')]=function(_0x2ecbe0){return new Promise(function(_0x16fe54,_0x119d6a){return db[_0x2259('0x1c')][_0x2259('0x27')]({'where':_0x2ecbe0[_0x2259('0x1f')]?_0x2ecbe0[_0x2259('0x1f')][_0x2259('0x21')]||null:null})[_0x2259('0x24')](function(_0x1be5d5){if(_0x1be5d5){return _0x1be5d5[_0x2259('0x28')](_0x2ecbe0[_0x2259('0x1e')][_0x2259('0x29')],_['omit'](_0x2ecbe0[_0x2259('0x1e')],[_0x2259('0x29'),'id'])||{});}})['spread'](function(_0x16a4ec){logger[_0x2259('0x19')](_0x2259('0x2a'),_0x2ecbe0);logger[_0x2259('0x13')](_0x2259('0x2a'),_0x2ecbe0,JSON[_0x2259('0x15')](_0x16a4ec));_0x16fe54(_0x16a4ec);})[_0x2259('0x25')](function(_0x4c48b7){logger[_0x2259('0x16')]('AddTags',_0x4c48b7['message'],_0x2ecbe0);_0x119d6a(_this[_0x2259('0x16')](0x1f4,_0x4c48b7[_0x2259('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 45fc78f..6a7b36d 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 _0x22c5=['remove','removeListener','register','length','chatInteraction:'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x22c5,0x6e));var _0x522c=function(_0x106186,_0x2e5349){_0x106186=_0x106186-0x0;var _0x1aeb40=_0x22c5[_0x106186];return _0x1aeb40;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0x522c('0x0'),'update'];function createListener(_0x4a314d,_0x26aaf5){return function(_0x510943){_0x26aaf5['emit'](_0x4a314d,_0x510943);};}function removeListener(_0x561452,_0x549f75){return function(){ChatInteractionEvents[_0x522c('0x1')](_0x561452,_0x549f75);};}exports[_0x522c('0x2')]=function(_0x84e973){for(var _0x3be57e=0x0,_0x1ecf19=events[_0x522c('0x3')];_0x3be57e<_0x1ecf19;_0x3be57e++){var _0x484e03=events[_0x3be57e];var _0x4d495e=createListener(_0x522c('0x4')+_0x484e03,_0x84e973);ChatInteractionEvents['on'](_0x484e03,_0x4d495e);}}; \ No newline at end of file +var _0x8e00=['removeListener','register','length','./chatInteraction.events','remove','emit'];(function(_0x4d3ef1,_0x5a6a7c){var _0xc229a9=function(_0x2f9c03){while(--_0x2f9c03){_0x4d3ef1['push'](_0x4d3ef1['shift']());}};_0xc229a9(++_0x5a6a7c);}(_0x8e00,0x159));var _0x08e0=function(_0x382ea9,_0x4019fa){_0x382ea9=_0x382ea9-0x0;var _0x282c0d=_0x8e00[_0x382ea9];return _0x282c0d;};'use strict';var ChatInteractionEvents=require(_0x08e0('0x0'));var events=['save',_0x08e0('0x1'),'update'];function createListener(_0x526a86,_0x598f62){return function(_0x27a07f){_0x598f62[_0x08e0('0x2')](_0x526a86,_0x27a07f);};}function removeListener(_0xa05c08,_0x4cc584){return function(){ChatInteractionEvents[_0x08e0('0x3')](_0xa05c08,_0x4cc584);};}exports[_0x08e0('0x4')]=function(_0x4e73c1){for(var _0x131223=0x0,_0x1b3f69=events[_0x08e0('0x5')];_0x131223<_0x1b3f69;_0x131223++){var _0x3a9bf9=events[_0x131223];var _0x5a253f=createListener('chatInteraction:'+_0x3a9bf9,_0x4e73c1);ChatInteractionEvents['on'](_0x3a9bf9,_0x5a253f);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index c82c145..bd06788 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 _0x9383=['/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','%s-%s','now','originalname','/:id/attachment_upload','addMessage','/:id/tags','chatinteraction:addtags','addTags','put','tracked','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','destroy','removeTags','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x9383,0x14c));var _0x3938=function(_0x3430c8,_0xcd3a8){_0x3430c8=_0x3430c8-0x0;var _0x354ddc=_0x9383[_0x3430c8];return _0x354ddc;};'use strict';var multer=require(_0x3938('0x0'));var util=require('util');var path=require(_0x3938('0x1'));var timeout=require('connect-timeout');var express=require(_0x3938('0x2'));var router=express[_0x3938('0x3')]();var fs_extra=require(_0x3938('0x4'));var auth=require(_0x3938('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3938('0x6'));var controller=require(_0x3938('0x7'));router[_0x3938('0x8')]('/',auth[_0x3938('0x9')](),controller[_0x3938('0xa')]);router[_0x3938('0x8')](_0x3938('0xb'),auth[_0x3938('0x9')](),controller[_0x3938('0xc')]);router[_0x3938('0x8')](_0x3938('0xd'),auth[_0x3938('0xe')](),controller['show']);router['get'](_0x3938('0xf'),auth[_0x3938('0xe')](),controller[_0x3938('0x10')]);router[_0x3938('0x8')](_0x3938('0x11'),auth[_0x3938('0x9')](),controller['getMessages']);router[_0x3938('0x8')]('/:id/my_messages',auth[_0x3938('0xe')](),controller[_0x3938('0x12')]);router['get'](_0x3938('0x13'),auth[_0x3938('0x9')](),controller[_0x3938('0x14')]);router[_0x3938('0x15')]('/',auth['isAuthenticated'](),controller[_0x3938('0x16')]);router['post'](_0x3938('0x17'),auth[_0x3938('0x9')](),controller[_0x3938('0x18')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x29f3e3,_0x30c1ce,_0x1fd554){_0x1fd554(null,path[_0x3938('0x19')](config[_0x3938('0x1a')],_0x3938('0x1b')));},'filename':function(_0x10aec0,_0x498460,_0x47bcb7){_0x47bcb7(null,util['format'](_0x3938('0x1c'),Date[_0x3938('0x1d')](),_0x498460[_0x3938('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x3938('0x15')](_0x3938('0x1f'),upload['single']('file'),controller['attachmentUpload']);router['post'](_0x3938('0x11'),auth['isChatInteractionAuthorized'](),controller[_0x3938('0x20')]);router[_0x3938('0x15')](_0x3938('0x21'),auth['isAuthenticated'](),interaction['tracked']('chat',_0x3938('0x22')),controller[_0x3938('0x23')]);router[_0x3938('0x24')](_0x3938('0xd'),auth['isAuthenticated'](),interaction[_0x3938('0x25')](_0x3938('0x26'),_0x3938('0x27')),controller[_0x3938('0x28')]);router[_0x3938('0x24')](_0x3938('0x29'),controller[_0x3938('0x2a')]);router[_0x3938('0x24')](_0x3938('0x2b'),auth[_0x3938('0xe')](),controller[_0x3938('0x2c')]);router['put'](_0x3938('0x2d'),controller['close']);router[_0x3938('0x2e')]('/:id',auth[_0x3938('0x9')](),interaction[_0x3938('0x25')](_0x3938('0x26'),'chatinteraction:destroy'),controller[_0x3938('0x2f')]);router[_0x3938('0x2e')](_0x3938('0x21'),auth['isAuthenticated'](),controller[_0x3938('0x30')]);module['exports']=router; \ No newline at end of file +var _0xe864=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','show','/:id/messages','getMessages','getMyMessages','/:id/download','download','post','create','createVidaooSession','join','root','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','addMessage','/:id/tags','tracked','chatinteraction:addtags','addTags','put','chat','update','/:id/custom_update','customUpdate','abandon','delete','chatinteraction:destroy','destroy','multer','util','path','connect-timeout','express'];(function(_0x5d4e2b,_0x417755){var _0x4520f9=function(_0x2840ed){while(--_0x2840ed){_0x5d4e2b['push'](_0x5d4e2b['shift']());}};_0x4520f9(++_0x417755);}(_0xe864,0x1db));var _0x4e86=function(_0x1e6cee,_0x2346ec){_0x1e6cee=_0x1e6cee-0x0;var _0x549528=_0xe864[_0x1e6cee];return _0x549528;};'use strict';var multer=require(_0x4e86('0x0'));var util=require(_0x4e86('0x1'));var path=require(_0x4e86('0x2'));var timeout=require(_0x4e86('0x3'));var express=require(_0x4e86('0x4'));var router=express[_0x4e86('0x5')]();var fs_extra=require(_0x4e86('0x6'));var auth=require(_0x4e86('0x7'));var interaction=require(_0x4e86('0x8'));var config=require(_0x4e86('0x9'));var controller=require(_0x4e86('0xa'));router[_0x4e86('0xb')]('/',auth[_0x4e86('0xc')](),controller[_0x4e86('0xd')]);router[_0x4e86('0xb')](_0x4e86('0xe'),auth[_0x4e86('0xc')](),controller[_0x4e86('0xf')]);router[_0x4e86('0xb')]('/:id',auth[_0x4e86('0x10')](),controller[_0x4e86('0x11')]);router['get']('/:id/attachment_download',auth[_0x4e86('0x10')](),controller['attachmentDownload']);router[_0x4e86('0xb')](_0x4e86('0x12'),auth[_0x4e86('0xc')](),controller[_0x4e86('0x13')]);router[_0x4e86('0xb')]('/:id/my_messages',auth[_0x4e86('0x10')](),controller[_0x4e86('0x14')]);router[_0x4e86('0xb')](_0x4e86('0x15'),auth['isAuthenticated'](),controller[_0x4e86('0x16')]);router[_0x4e86('0x17')]('/',auth[_0x4e86('0xc')](),controller[_0x4e86('0x18')]);router[_0x4e86('0x17')]('/:id/vidaoo',auth[_0x4e86('0xc')](),controller[_0x4e86('0x19')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2edc1f,_0x38f57d,_0x4e5845){_0x4e5845(null,path[_0x4e86('0x1a')](config[_0x4e86('0x1b')],_0x4e86('0x1c')));},'filename':function(_0x50c35f,_0x4d0a6e,_0x35af73){_0x35af73(null,util[_0x4e86('0x1d')]('%s-%s',Date[_0x4e86('0x1e')](),_0x4d0a6e[_0x4e86('0x1f')][_0x4e86('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x4e86('0x17')](_0x4e86('0x21'),upload['single']('file'),controller['attachmentUpload']);router[_0x4e86('0x17')](_0x4e86('0x12'),auth[_0x4e86('0x10')](),controller[_0x4e86('0x22')]);router[_0x4e86('0x17')](_0x4e86('0x23'),auth[_0x4e86('0xc')](),interaction[_0x4e86('0x24')]('chat',_0x4e86('0x25')),controller[_0x4e86('0x26')]);router[_0x4e86('0x27')]('/:id',auth[_0x4e86('0xc')](),interaction[_0x4e86('0x24')](_0x4e86('0x28'),'chatinteraction:update'),controller[_0x4e86('0x29')]);router[_0x4e86('0x27')](_0x4e86('0x2a'),controller[_0x4e86('0x2b')]);router[_0x4e86('0x27')]('/:id/abandon',auth[_0x4e86('0x10')](),controller[_0x4e86('0x2c')]);router['put']('/:id/close',controller['close']);router[_0x4e86('0x2d')]('/:id',auth[_0x4e86('0xc')](),interaction['tracked']('chat',_0x4e86('0x2e')),controller[_0x4e86('0x2f')]);router['delete'](_0x4e86('0x23'),auth[_0x4e86('0xc')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index f76f9c9..1d1a1fc 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 _0xc695=['sequelize','TEXT','BOOLEAN','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc695,0xb0));var _0x5c69=function(_0x388914,_0x3c63f9){_0x388914=_0x388914-0x0;var _0x1f9111=_0xc695[_0x388914];return _0x1f9111;};'use strict';var Sequelize=require(_0x5c69('0x0'));module['exports']={'body':{'type':Sequelize[_0x5c69('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x5c69('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x5c69('0x3')]}}; \ No newline at end of file +var _0x6fcf=['sequelize','exports','TEXT','BOOLEAN','INTEGER'];(function(_0xeefb3d,_0x51a865){var _0x4fd222=function(_0x11aa14){while(--_0x11aa14){_0xeefb3d['push'](_0xeefb3d['shift']());}};_0x4fd222(++_0x51a865);}(_0x6fcf,0x1f4));var _0xf6fc=function(_0x1055d3,_0x5dce87){_0x1055d3=_0x1055d3-0x0;var _0x55b24a=_0x6fcf[_0x1055d3];return _0x55b24a;};'use strict';var Sequelize=require(_0xf6fc('0x0'));module[_0xf6fc('0x1')]={'body':{'type':Sequelize[_0xf6fc('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xf6fc('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xf6fc('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 9f04fa7..96842fa 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 _0x8a89=['zip-dir','fast-json-patch','request-promise','moment','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','ChatInternalMessage','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','rawAttributes','options','find','catch','create','body','params','describe','get','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent','admin','user','fullname','role','userpic','online','lastLoginAt','-online','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','FromId','ToId','-createdAt','all','eml-format','rimraf'];(function(_0x443506,_0x192499){var _0x1a9ba4=function(_0x5baa78){while(--_0x5baa78){_0x443506['push'](_0x443506['shift']());}};_0x1a9ba4(++_0x192499);}(_0x8a89,0x1ca));var _0x98a8=function(_0x29ae80,_0x3579f1){_0x29ae80=_0x29ae80-0x0;var _0x5d6d71=_0x8a89[_0x29ae80];return _0x5d6d71;};'use strict';var emlformat=require(_0x98a8('0x0'));var rimraf=require(_0x98a8('0x1'));var zipdir=require(_0x98a8('0x2'));var jsonpatch=require(_0x98a8('0x3'));var rp=require(_0x98a8('0x4'));var moment=require(_0x98a8('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x98a8('0x6'));var path=require(_0x98a8('0x7'));var sox=require(_0x98a8('0x8'));var csv=require(_0x98a8('0x9'));var ejs=require(_0x98a8('0xa'));var fs=require('fs');var fs_extra=require(_0x98a8('0xb'));var _=require(_0x98a8('0xc'));var squel=require('squel');var crypto=require(_0x98a8('0xd'));var jsforce=require(_0x98a8('0xe'));var deskjs=require(_0x98a8('0xf'));var toCsv=require(_0x98a8('0x9'));var querystring=require(_0x98a8('0x10'));var Papa=require(_0x98a8('0x11'));var Redis=require(_0x98a8('0x12'));var authService=require(_0x98a8('0x13'));var qs=require(_0x98a8('0x14'));var as=require(_0x98a8('0x15'));var hardwareService=require(_0x98a8('0x16'));var logger=require('../../config/logger')(_0x98a8('0x17'));var utils=require(_0x98a8('0x18'));var config=require(_0x98a8('0x19'));var licenseUtil=require(_0x98a8('0x1a'));var db=require(_0x98a8('0x1b'))['db'];config[_0x98a8('0x1c')]=_[_0x98a8('0x1d')](config[_0x98a8('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x98a8('0x1e'))(new Redis(config[_0x98a8('0x1c')]));require(_0x98a8('0x1f'))['register'](socket);function respondWithStatusCode(_0x39aa40,_0x4f0cdb){_0x4f0cdb=_0x4f0cdb||0xcc;return function(_0x3d59c8){if(_0x3d59c8){return _0x39aa40[_0x98a8('0x20')](_0x4f0cdb);}return _0x39aa40[_0x98a8('0x21')](_0x4f0cdb)[_0x98a8('0x22')]();};}function respondWithResult(_0x2f071b,_0x48038a){_0x48038a=_0x48038a||0xc8;return function(_0x4eacef){if(_0x4eacef){return _0x2f071b['status'](_0x48038a)['json'](_0x4eacef);}};}function respondWithFilteredResult(_0x3c1bb6,_0x18630e){return function(_0x1f5e95){if(_0x1f5e95){var _0x25459f=typeof _0x18630e[_0x98a8('0x23')]===_0x98a8('0x24')&&typeof _0x18630e[_0x98a8('0x25')]===_0x98a8('0x24');var _0x56160a=_0x1f5e95[_0x98a8('0x26')];var _0x3851dd=_0x25459f?0x0:_0x18630e[_0x98a8('0x23')];var _0xdac96a=_0x25459f?_0x1f5e95[_0x98a8('0x26')]:_0x18630e['offset']+_0x18630e[_0x98a8('0x25')];var _0x12d754;if(_0xdac96a>=_0x56160a){_0xdac96a=_0x56160a;_0x12d754=0xc8;}else{_0x12d754=0xce;}_0x3c1bb6[_0x98a8('0x21')](_0x12d754);return _0x3c1bb6[_0x98a8('0x27')](_0x98a8('0x28'),_0x3851dd+'-'+_0xdac96a+'/'+_0x56160a)[_0x98a8('0x29')](_0x1f5e95);}return null;};}function patchUpdates(_0x1824d6){return function(_0x18e8be){try{jsonpatch[_0x98a8('0x2a')](_0x18e8be,_0x1824d6,!![]);}catch(_0x11b11d){return BPromise[_0x98a8('0x2b')](_0x11b11d);}return _0x18e8be[_0x98a8('0x2c')]();};}function saveUpdates(_0x58c808,_0x3e3d5c){return function(_0x3603c5){if(_0x3603c5){return _0x3603c5[_0x98a8('0x2d')](_0x58c808)[_0x98a8('0x2e')](function(_0x2c4b5a){return _0x2c4b5a;});}return null;};}function removeEntity(_0xdb4e80,_0x37b1a7){return function(_0x3a681d){if(_0x3a681d){return _0x3a681d[_0x98a8('0x2f')]()[_0x98a8('0x2e')](function(){_0xdb4e80['status'](0xcc)[_0x98a8('0x22')]();});}};}function handleEntityNotFound(_0xbcdb1e,_0x1e8841){return function(_0x541663){if(!_0x541663){_0xbcdb1e[_0x98a8('0x20')](0x194);}return _0x541663;};}function handleError(_0x3c6e51,_0x41dc4a){_0x41dc4a=_0x41dc4a||0x1f4;return function(_0x41fe6d){logger[_0x98a8('0x30')](_0x41fe6d[_0x98a8('0x31')]);if(_0x41fe6d[_0x98a8('0x32')]){delete _0x41fe6d['name'];}_0x3c6e51['status'](_0x41dc4a)[_0x98a8('0x33')](_0x41fe6d);};}exports['index']=function(_0x4a989b,_0x3e950c){var _0x2a937a={},_0x1e85b2={},_0x1dd46f={'count':0x0,'rows':[]};var _0x1f52de=_[_0x98a8('0x34')](db[_0x98a8('0x35')]['rawAttributes'],function(_0x1e245e){return{'name':_0x1e245e[_0x98a8('0x36')],'type':_0x1e245e[_0x98a8('0x37')][_0x98a8('0x38')]};});_0x1e85b2['model']=_[_0x98a8('0x34')](_0x1f52de,_0x98a8('0x32'));_0x1e85b2['query']=_[_0x98a8('0x39')](_0x4a989b[_0x98a8('0x3a')]);_0x1e85b2[_0x98a8('0x3b')]=_[_0x98a8('0x3c')](_0x1e85b2[_0x98a8('0x3d')],_0x1e85b2['query']);_0x2a937a[_0x98a8('0x3e')]=_[_0x98a8('0x3c')](_0x1e85b2['model'],qs[_0x98a8('0x3f')](_0x4a989b[_0x98a8('0x3a')][_0x98a8('0x3f')]));_0x2a937a[_0x98a8('0x3e')]=_0x2a937a[_0x98a8('0x3e')][_0x98a8('0x40')]?_0x2a937a['attributes']:_0x1e85b2[_0x98a8('0x3d')];if(!_0x4a989b[_0x98a8('0x3a')][_0x98a8('0x41')]('nolimit')){_0x2a937a[_0x98a8('0x25')]=qs['limit'](_0x4a989b['query']['limit']);_0x2a937a[_0x98a8('0x23')]=qs[_0x98a8('0x23')](_0x4a989b[_0x98a8('0x3a')]['offset']);}_0x2a937a[_0x98a8('0x42')]=qs['sort'](_0x4a989b[_0x98a8('0x3a')][_0x98a8('0x43')]);_0x2a937a[_0x98a8('0x44')]=qs[_0x98a8('0x3b')](_[_0x98a8('0x45')](_0x4a989b['query'],_0x1e85b2[_0x98a8('0x3b')]),_0x1f52de);if(_0x4a989b['query'][_0x98a8('0x46')]){_0x2a937a[_0x98a8('0x44')]=_['merge'](_0x2a937a[_0x98a8('0x44')],{'$or':_[_0x98a8('0x34')](_0x1f52de,function(_0x16e87a){if(_0x16e87a['type']!==_0x98a8('0x47')){var _0x5b23e9={};_0x5b23e9[_0x16e87a[_0x98a8('0x32')]]={'$like':'%'+_0x4a989b[_0x98a8('0x3a')][_0x98a8('0x46')]+'%'};return _0x5b23e9;}})});}_0x2a937a=_[_0x98a8('0x48')]({},_0x2a937a,_0x4a989b['options']);var _0x4e4c0f={'where':_0x2a937a[_0x98a8('0x44')]};return db[_0x98a8('0x35')][_0x98a8('0x26')](_0x4e4c0f)[_0x98a8('0x2e')](function(_0x2b0cb8){_0x1dd46f[_0x98a8('0x26')]=_0x2b0cb8;if(_0x4a989b[_0x98a8('0x3a')][_0x98a8('0x49')]){_0x2a937a[_0x98a8('0x4a')]=[{'all':!![]}];}return db[_0x98a8('0x35')][_0x98a8('0x4b')](_0x2a937a);})[_0x98a8('0x2e')](function(_0x3edf94){_0x1dd46f[_0x98a8('0x4c')]=_0x3edf94;return _0x1dd46f;})[_0x98a8('0x2e')](respondWithFilteredResult(_0x3e950c,_0x2a937a))['catch'](handleError(_0x3e950c,null));};exports[_0x98a8('0x4d')]=function(_0x4547f7,_0x4451a4){var _0x4ad21b={'raw':!![],'where':{'id':_0x4547f7['params']['id']}},_0x23de92={};_0x23de92[_0x98a8('0x3d')]=_[_0x98a8('0x39')](db[_0x98a8('0x35')][_0x98a8('0x4e')]);_0x23de92[_0x98a8('0x3a')]=_['keys'](_0x4547f7['query']);_0x23de92[_0x98a8('0x3b')]=_[_0x98a8('0x3c')](_0x23de92[_0x98a8('0x3d')],_0x23de92[_0x98a8('0x3a')]);_0x4ad21b['attributes']=_[_0x98a8('0x3c')](_0x23de92[_0x98a8('0x3d')],qs['fields'](_0x4547f7[_0x98a8('0x3a')][_0x98a8('0x3f')]));_0x4ad21b[_0x98a8('0x3e')]=_0x4ad21b[_0x98a8('0x3e')][_0x98a8('0x40')]?_0x4ad21b[_0x98a8('0x3e')]:_0x23de92['model'];if(_0x4547f7[_0x98a8('0x3a')]['includeAll']){_0x4ad21b['include']=[{'all':!![]}];}_0x4ad21b=_[_0x98a8('0x48')]({},_0x4ad21b,_0x4547f7[_0x98a8('0x4f')]);return db[_0x98a8('0x35')][_0x98a8('0x50')](_0x4ad21b)[_0x98a8('0x2e')](handleEntityNotFound(_0x4451a4,null))[_0x98a8('0x2e')](respondWithResult(_0x4451a4,null))[_0x98a8('0x51')](handleError(_0x4451a4,null));};exports[_0x98a8('0x52')]=function(_0x2882a7,_0x16f423){return db[_0x98a8('0x35')][_0x98a8('0x52')](_0x2882a7[_0x98a8('0x53')],{})['then'](respondWithResult(_0x16f423,0xc9))['catch'](handleError(_0x16f423,null));};exports[_0x98a8('0x2d')]=function(_0x11cddf,_0x487228){if(_0x11cddf['body']['id']){delete _0x11cddf[_0x98a8('0x53')]['id'];}return db[_0x98a8('0x35')][_0x98a8('0x50')]({'where':{'id':_0x11cddf[_0x98a8('0x54')]['id']}})[_0x98a8('0x2e')](handleEntityNotFound(_0x487228,null))['then'](saveUpdates(_0x11cddf[_0x98a8('0x53')],null))[_0x98a8('0x2e')](respondWithResult(_0x487228,null))[_0x98a8('0x51')](handleError(_0x487228,null));};exports['destroy']=function(_0x52a378,_0x5c8371){return db[_0x98a8('0x35')][_0x98a8('0x50')]({'where':{'id':_0x52a378[_0x98a8('0x54')]['id']}})[_0x98a8('0x2e')](handleEntityNotFound(_0x5c8371,null))[_0x98a8('0x2e')](removeEntity(_0x5c8371,null))['catch'](handleError(_0x5c8371,null));};exports[_0x98a8('0x55')]=function(_0x3e6d09,_0x1cd04a){return db[_0x98a8('0x35')]['describe']()[_0x98a8('0x2e')](respondWithResult(_0x1cd04a,null))[_0x98a8('0x51')](handleError(_0x1cd04a,null));};function wrapUser(_0x37d620){return function(_0x14a40e){var _0x13b74c=_0x37d620[_0x98a8('0x56')]({'plain':!![]});_0x13b74c['messages']=[];if(_0x14a40e){_0x13b74c['lastMessageAt']=_0x14a40e[_0x98a8('0x57')];_0x13b74c['lastMessage']=_0x14a40e;}else{_0x13b74c['lastMessageAt']=moment(0x0)[_0x98a8('0x58')](_0x98a8('0x59'));_0x13b74c[_0x98a8('0x5a')]={};}return _0x13b74c;};}exports[_0x98a8('0x5b')]=function(_0x2b7b8f,_0x230172,_0x4545b2){var _0x289df9=[];return db[_0x98a8('0x5c')][_0x98a8('0x4b')]({'where':{'role':[_0x98a8('0x5d'),_0x98a8('0x5e'),_0x98a8('0x5f')]},'attributes':['id',_0x98a8('0x60'),_0x98a8('0x32'),_0x98a8('0x61'),_0x98a8('0x62'),'internal',_0x98a8('0x63'),_0x98a8('0x64'),'allowmessenger','showWebBar'],'order':qs['sort'](_0x98a8('0x65')),'include':[{'model':db[_0x98a8('0x66')],'as':'VoiceQueues','attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0x98a8('0x2e')](function(_0x1a9867){if(_0x1a9867){var _0x468164=_0x2b7b8f['user'][_0x98a8('0x56')]({'plain':!![]});if(!_0x468164)throw new Error(_0x98a8('0x67'));if(_0x468164[_0x98a8('0x61')]===_0x98a8('0x5f')){return db[_0x98a8('0x68')][_0x98a8('0x50')]({'where':{'name':_0x98a8('0x69'),'userProfileId':_0x468164[_0x98a8('0x6a')]},'raw':!![]})[_0x98a8('0x2e')](function(_0x565f3b){if(_0x565f3b){if(_0x565f3b[_0x98a8('0x6b')]===0x0){return db[_0x98a8('0x6c')][_0x98a8('0x4b')]({'where':{'sectionId':_0x565f3b['id']},'raw':!![]})[_0x98a8('0x2e')](function(_0x2291a5){var _0xff5ea6=[];if(_[_0x98a8('0x6d')](_0x2291a5)){_0xff5ea6=_[_0x98a8('0x46')](_0x1a9867,function(_0x13528a){if(_0x13528a[_0x98a8('0x61')]!==_0x98a8('0x5d')){return _0x13528a;}});return _0xff5ea6;}else{for(var _0x51d945=0x0;_0x51d945<_0x1a9867[_0x98a8('0x40')];_0x51d945++){var _0x3a0e19=_0x1a9867[_0x51d945];if(_0x3a0e19[_0x98a8('0x61')]===_0x98a8('0x5d')){var _0x1887e8=_[_0x98a8('0x50')](_0x2291a5,function(_0x49019e){return _0x49019e['resourceId']===_0x3a0e19['id'];});if(_0x1887e8)_0xff5ea6[_0x98a8('0x6e')](_0x3a0e19);}else{_0xff5ea6[_0x98a8('0x6e')](_0x3a0e19);}}return _0xff5ea6;}});}else{return _0x1a9867;}}else{var _0x14cf58=_[_0x98a8('0x46')](_0x1a9867,function(_0xe4d4e3){if(_0xe4d4e3['role']!==_0x98a8('0x5d')){return _0xe4d4e3;}});return _0x14cf58;}});}else{return _0x1a9867;}}})[_0x98a8('0x2e')](function(_0x5f3f20){var _0x44c737=[];if(_0x5f3f20){_0x289df9=_0x5f3f20;for(var _0x3369b6=0x0;_0x3369b6<_0x5f3f20[_0x98a8('0x40')];_0x3369b6+=0x1){_0x289df9[_0x3369b6]['messages']=[];_0x44c737[_0x98a8('0x6e')](db[_0x98a8('0x35')]['find']({'where':{'FromId':[_0x2b7b8f[_0x98a8('0x5f')]['id'],_0x5f3f20[_0x3369b6]['id']],'ToId':[_0x2b7b8f[_0x98a8('0x5f')]['id'],_0x5f3f20[_0x3369b6]['id']],'ChatGroupId':null},'attributes':['id',_0x98a8('0x57'),_0x98a8('0x6f'),_0x98a8('0x70'),'read',_0x98a8('0x53')],'order':qs[_0x98a8('0x43')](_0x98a8('0x71')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x98a8('0x2e')](wrapUser(_0x5f3f20[_0x3369b6])));}return BPromise[_0x98a8('0x72')](_0x44c737);}return[];})[_0x98a8('0x2e')](function(_0x3ee840){return{'rows':_0x3ee840,'count':_0x3ee840['length']};})[_0x98a8('0x2e')](respondWithResult(_0x230172,null))[_0x98a8('0x51')](handleError(_0x230172,null));}; \ No newline at end of file +var _0x59b1=['filter','VIRTUAL','options','ChatInternalMessage','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','internal','allowmessenger','showWebBar','-online','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','sendStatus','end','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x4c2665,_0x5623e0){var _0x3a4fa5=function(_0x1785f8){while(--_0x1785f8){_0x4c2665['push'](_0x4c2665['shift']());}};_0x3a4fa5(++_0x5623e0);}(_0x59b1,0x10e));var _0x159b=function(_0x2ade90,_0xf704df){_0x2ade90=_0x2ade90-0x0;var _0x2cbfa6=_0x59b1[_0x2ade90];return _0x2cbfa6;};'use strict';var emlformat=require(_0x159b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x159b('0x1'));var jsonpatch=require(_0x159b('0x2'));var rp=require(_0x159b('0x3'));var moment=require(_0x159b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x159b('0x5'));var util=require(_0x159b('0x6'));var path=require('path');var sox=require(_0x159b('0x7'));var csv=require(_0x159b('0x8'));var ejs=require(_0x159b('0x9'));var fs=require('fs');var fs_extra=require(_0x159b('0xa'));var _=require(_0x159b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x159b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x159b('0x8'));var querystring=require(_0x159b('0xd'));var Papa=require(_0x159b('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x159b('0xf'));var as=require(_0x159b('0x10'));var hardwareService=require(_0x159b('0x11'));var logger=require(_0x159b('0x12'))(_0x159b('0x13'));var utils=require(_0x159b('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x159b('0x15'))['db'];config[_0x159b('0x16')]=_[_0x159b('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x159b('0x18'))(new Redis(config[_0x159b('0x16')]));require(_0x159b('0x19'))['register'](socket);function respondWithStatusCode(_0x1d0c46,_0x1ac06c){_0x1ac06c=_0x1ac06c||0xcc;return function(_0x172282){if(_0x172282){return _0x1d0c46[_0x159b('0x1a')](_0x1ac06c);}return _0x1d0c46['status'](_0x1ac06c)[_0x159b('0x1b')]();};}function respondWithResult(_0x3156d4,_0x516936){_0x516936=_0x516936||0xc8;return function(_0x248937){if(_0x248937){return _0x3156d4[_0x159b('0x1c')](_0x516936)[_0x159b('0x1d')](_0x248937);}};}function respondWithFilteredResult(_0x479418,_0x4d4e35){return function(_0x2d15c6){if(_0x2d15c6){var _0xde2f9e=typeof _0x4d4e35['offset']===_0x159b('0x1e')&&typeof _0x4d4e35['limit']===_0x159b('0x1e');var _0xf57353=_0x2d15c6['count'];var _0xb65eb5=_0xde2f9e?0x0:_0x4d4e35[_0x159b('0x1f')];var _0x3ac268=_0xde2f9e?_0x2d15c6[_0x159b('0x20')]:_0x4d4e35['offset']+_0x4d4e35[_0x159b('0x21')];var _0x491475;if(_0x3ac268>=_0xf57353){_0x3ac268=_0xf57353;_0x491475=0xc8;}else{_0x491475=0xce;}_0x479418['status'](_0x491475);return _0x479418[_0x159b('0x22')](_0x159b('0x23'),_0xb65eb5+'-'+_0x3ac268+'/'+_0xf57353)['json'](_0x2d15c6);}return null;};}function patchUpdates(_0x23775a){return function(_0x46e67f){try{jsonpatch[_0x159b('0x24')](_0x46e67f,_0x23775a,!![]);}catch(_0x4e4a56){return BPromise[_0x159b('0x25')](_0x4e4a56);}return _0x46e67f[_0x159b('0x26')]();};}function saveUpdates(_0xa36e62,_0x42b548){return function(_0x28cfe5){if(_0x28cfe5){return _0x28cfe5[_0x159b('0x27')](_0xa36e62)[_0x159b('0x28')](function(_0x14165b){return _0x14165b;});}return null;};}function removeEntity(_0x4d7cab,_0x10079a){return function(_0x36d687){if(_0x36d687){return _0x36d687['destroy']()[_0x159b('0x28')](function(){_0x4d7cab[_0x159b('0x1c')](0xcc)[_0x159b('0x1b')]();});}};}function handleEntityNotFound(_0x2f9ec9,_0x345ee2){return function(_0x235a8e){if(!_0x235a8e){_0x2f9ec9[_0x159b('0x1a')](0x194);}return _0x235a8e;};}function handleError(_0x1ab787,_0x502944){_0x502944=_0x502944||0x1f4;return function(_0x1c4c33){logger[_0x159b('0x29')](_0x1c4c33[_0x159b('0x2a')]);if(_0x1c4c33[_0x159b('0x2b')]){delete _0x1c4c33[_0x159b('0x2b')];}_0x1ab787[_0x159b('0x1c')](_0x502944)[_0x159b('0x2c')](_0x1c4c33);};}exports[_0x159b('0x2d')]=function(_0x3ce2d2,_0x53175c){var _0x3145cc={},_0x3005cb={},_0x2f5031={'count':0x0,'rows':[]};var _0x2139a6=_['map'](db['ChatInternalMessage'][_0x159b('0x2e')],function(_0x5aac4c){return{'name':_0x5aac4c['fieldName'],'type':_0x5aac4c[_0x159b('0x2f')][_0x159b('0x30')]};});_0x3005cb[_0x159b('0x31')]=_[_0x159b('0x32')](_0x2139a6,'name');_0x3005cb[_0x159b('0x33')]=_[_0x159b('0x34')](_0x3ce2d2['query']);_0x3005cb[_0x159b('0x35')]=_['intersection'](_0x3005cb[_0x159b('0x31')],_0x3005cb[_0x159b('0x33')]);_0x3145cc[_0x159b('0x36')]=_[_0x159b('0x37')](_0x3005cb[_0x159b('0x31')],qs[_0x159b('0x38')](_0x3ce2d2['query'][_0x159b('0x38')]));_0x3145cc[_0x159b('0x36')]=_0x3145cc[_0x159b('0x36')][_0x159b('0x39')]?_0x3145cc[_0x159b('0x36')]:_0x3005cb[_0x159b('0x31')];if(!_0x3ce2d2[_0x159b('0x33')][_0x159b('0x3a')](_0x159b('0x3b'))){_0x3145cc[_0x159b('0x21')]=qs['limit'](_0x3ce2d2[_0x159b('0x33')][_0x159b('0x21')]);_0x3145cc[_0x159b('0x1f')]=qs[_0x159b('0x1f')](_0x3ce2d2[_0x159b('0x33')]['offset']);}_0x3145cc['order']=qs[_0x159b('0x3c')](_0x3ce2d2[_0x159b('0x33')]['sort']);_0x3145cc[_0x159b('0x3d')]=qs[_0x159b('0x35')](_[_0x159b('0x3e')](_0x3ce2d2[_0x159b('0x33')],_0x3005cb[_0x159b('0x35')]),_0x2139a6);if(_0x3ce2d2[_0x159b('0x33')][_0x159b('0x3f')]){_0x3145cc[_0x159b('0x3d')]=_['merge'](_0x3145cc[_0x159b('0x3d')],{'$or':_[_0x159b('0x32')](_0x2139a6,function(_0x129fc9){if(_0x129fc9['type']!==_0x159b('0x40')){var _0x1a1e86={};_0x1a1e86[_0x129fc9[_0x159b('0x2b')]]={'$like':'%'+_0x3ce2d2[_0x159b('0x33')]['filter']+'%'};return _0x1a1e86;}})});}_0x3145cc=_['merge']({},_0x3145cc,_0x3ce2d2[_0x159b('0x41')]);var _0x4416f5={'where':_0x3145cc['where']};return db[_0x159b('0x42')][_0x159b('0x20')](_0x4416f5)['then'](function(_0x3cb0b0){_0x2f5031[_0x159b('0x20')]=_0x3cb0b0;if(_0x3ce2d2[_0x159b('0x33')][_0x159b('0x43')]){_0x3145cc[_0x159b('0x44')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x159b('0x45')](_0x3145cc);})['then'](function(_0x536a0d){_0x2f5031[_0x159b('0x46')]=_0x536a0d;return _0x2f5031;})['then'](respondWithFilteredResult(_0x53175c,_0x3145cc))[_0x159b('0x47')](handleError(_0x53175c,null));};exports[_0x159b('0x48')]=function(_0x17830f,_0x35872a){var _0x44f806={'raw':!![],'where':{'id':_0x17830f[_0x159b('0x49')]['id']}},_0x65920d={};_0x65920d[_0x159b('0x31')]=_[_0x159b('0x34')](db[_0x159b('0x42')][_0x159b('0x2e')]);_0x65920d['query']=_[_0x159b('0x34')](_0x17830f[_0x159b('0x33')]);_0x65920d['filters']=_['intersection'](_0x65920d[_0x159b('0x31')],_0x65920d[_0x159b('0x33')]);_0x44f806['attributes']=_[_0x159b('0x37')](_0x65920d['model'],qs['fields'](_0x17830f[_0x159b('0x33')][_0x159b('0x38')]));_0x44f806[_0x159b('0x36')]=_0x44f806[_0x159b('0x36')]['length']?_0x44f806[_0x159b('0x36')]:_0x65920d[_0x159b('0x31')];if(_0x17830f['query']['includeAll']){_0x44f806['include']=[{'all':!![]}];}_0x44f806=_['merge']({},_0x44f806,_0x17830f['options']);return db[_0x159b('0x42')]['find'](_0x44f806)[_0x159b('0x28')](handleEntityNotFound(_0x35872a,null))[_0x159b('0x28')](respondWithResult(_0x35872a,null))[_0x159b('0x47')](handleError(_0x35872a,null));};exports['create']=function(_0x2cb45f,_0x6cd8d8){return db[_0x159b('0x42')][_0x159b('0x4a')](_0x2cb45f['body'],{})['then'](respondWithResult(_0x6cd8d8,0xc9))['catch'](handleError(_0x6cd8d8,null));};exports['update']=function(_0x4bc879,_0x24cb69){if(_0x4bc879[_0x159b('0x4b')]['id']){delete _0x4bc879[_0x159b('0x4b')]['id'];}return db[_0x159b('0x42')][_0x159b('0x4c')]({'where':{'id':_0x4bc879['params']['id']}})[_0x159b('0x28')](handleEntityNotFound(_0x24cb69,null))[_0x159b('0x28')](saveUpdates(_0x4bc879[_0x159b('0x4b')],null))[_0x159b('0x28')](respondWithResult(_0x24cb69,null))[_0x159b('0x47')](handleError(_0x24cb69,null));};exports[_0x159b('0x4d')]=function(_0xcd62a5,_0x32f1e9){return db['ChatInternalMessage'][_0x159b('0x4c')]({'where':{'id':_0xcd62a5[_0x159b('0x49')]['id']}})[_0x159b('0x28')](handleEntityNotFound(_0x32f1e9,null))[_0x159b('0x28')](removeEntity(_0x32f1e9,null))[_0x159b('0x47')](handleError(_0x32f1e9,null));};exports[_0x159b('0x4e')]=function(_0x45f453,_0x557e00){return db[_0x159b('0x42')]['describe']()[_0x159b('0x28')](respondWithResult(_0x557e00,null))[_0x159b('0x47')](handleError(_0x557e00,null));};function wrapUser(_0x17c18e){return function(_0x440d91){var _0x484f87=_0x17c18e['get']({'plain':!![]});_0x484f87[_0x159b('0x4f')]=[];if(_0x440d91){_0x484f87[_0x159b('0x50')]=_0x440d91[_0x159b('0x51')];_0x484f87[_0x159b('0x52')]=_0x440d91;}else{_0x484f87[_0x159b('0x50')]=moment(0x0)[_0x159b('0x53')](_0x159b('0x54'));_0x484f87[_0x159b('0x52')]={};}return _0x484f87;};}exports[_0x159b('0x55')]=function(_0xe01a3c,_0x5f0740,_0x4a312d){var _0x46bd38=[];return db[_0x159b('0x56')][_0x159b('0x45')]({'where':{'role':[_0x159b('0x57'),_0x159b('0x58'),_0x159b('0x59')]},'attributes':['id',_0x159b('0x5a'),_0x159b('0x2b'),_0x159b('0x5b'),_0x159b('0x5c'),_0x159b('0x5d'),'online','lastLoginAt',_0x159b('0x5e'),_0x159b('0x5f')],'order':qs[_0x159b('0x3c')](_0x159b('0x60')),'include':[{'model':db['VoiceQueue'],'as':_0x159b('0x61'),'attributes':['id','name',_0x159b('0x2f')],'through':{'attributes':[]}}]})[_0x159b('0x28')](function(_0xf2974e){if(_0xf2974e){var _0x239cfa=_0xe01a3c['user']['get']({'plain':!![]});if(!_0x239cfa)throw new Error(_0x159b('0x62'));if(_0x239cfa[_0x159b('0x5b')]===_0x159b('0x59')){return db[_0x159b('0x63')][_0x159b('0x4c')]({'where':{'name':_0x159b('0x64'),'userProfileId':_0x239cfa[_0x159b('0x65')]},'raw':!![]})[_0x159b('0x28')](function(_0x18802d){if(_0x18802d){if(_0x18802d[_0x159b('0x66')]===0x0){return db[_0x159b('0x67')]['findAll']({'where':{'sectionId':_0x18802d['id']},'raw':!![]})[_0x159b('0x28')](function(_0x2fa9dc){var _0x393bcc=[];if(_['isEmpty'](_0x2fa9dc)){_0x393bcc=_['filter'](_0xf2974e,function(_0x353334){if(_0x353334[_0x159b('0x5b')]!==_0x159b('0x57')){return _0x353334;}});return _0x393bcc;}else{for(var _0xc2b290=0x0;_0xc2b290<_0xf2974e[_0x159b('0x39')];_0xc2b290++){var _0x2563b8=_0xf2974e[_0xc2b290];if(_0x2563b8[_0x159b('0x5b')]==='agent'){var _0x5ac5cd=_[_0x159b('0x4c')](_0x2fa9dc,function(_0x442a5a){return _0x442a5a[_0x159b('0x68')]===_0x2563b8['id'];});if(_0x5ac5cd)_0x393bcc[_0x159b('0x69')](_0x2563b8);}else{_0x393bcc[_0x159b('0x69')](_0x2563b8);}}return _0x393bcc;}});}else{return _0xf2974e;}}else{var _0x172e02=_[_0x159b('0x3f')](_0xf2974e,function(_0x176b7b){if(_0x176b7b[_0x159b('0x5b')]!==_0x159b('0x57')){return _0x176b7b;}});return _0x172e02;}});}else{return _0xf2974e;}}})[_0x159b('0x28')](function(_0x276329){var _0x1f9351=[];if(_0x276329){_0x46bd38=_0x276329;for(var _0x48efe1=0x0;_0x48efe1<_0x276329[_0x159b('0x39')];_0x48efe1+=0x1){_0x46bd38[_0x48efe1][_0x159b('0x4f')]=[];_0x1f9351['push'](db[_0x159b('0x42')][_0x159b('0x4c')]({'where':{'FromId':[_0xe01a3c[_0x159b('0x59')]['id'],_0x276329[_0x48efe1]['id']],'ToId':[_0xe01a3c['user']['id'],_0x276329[_0x48efe1]['id']],'ChatGroupId':null},'attributes':['id',_0x159b('0x51'),_0x159b('0x6a'),_0x159b('0x6b'),_0x159b('0x6c'),'body'],'order':qs['sort'](_0x159b('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x159b('0x28')](wrapUser(_0x276329[_0x48efe1])));}return BPromise[_0x159b('0x6e')](_0x1f9351);}return[];})[_0x159b('0x28')](function(_0x53f63d){return{'rows':_0x53f63d,'count':_0x53f63d['length']};})[_0x159b('0x28')](respondWithResult(_0x5f0740,null))[_0x159b('0x47')](handleError(_0x5f0740,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 96942fe..ebdb855 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 _0x7425=['emit','hook','exports','events','../../mysqldb','ChatInternalMessage','save','update'];(function(_0x1c78dd,_0x117d6e){var _0x927903=function(_0x464012){while(--_0x464012){_0x1c78dd['push'](_0x1c78dd['shift']());}};_0x927903(++_0x117d6e);}(_0x7425,0x10b));var _0x5742=function(_0x283e5d,_0x60dff){_0x283e5d=_0x283e5d-0x0;var _0x4987fb=_0x7425[_0x283e5d];return _0x4987fb;};'use strict';var EventEmitter=require(_0x5742('0x0'));var ChatInternalMessage=require(_0x5742('0x1'))['db'][_0x5742('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5742('0x3'),'afterUpdate':_0x5742('0x4'),'afterDestroy':'remove'};function emitEvent(_0x86b03d){return function(_0x494265,_0x4cd3a5,_0x1364e8){ChatInternalMessageEvents[_0x5742('0x5')](_0x86b03d+':'+_0x494265['id'],_0x494265);ChatInternalMessageEvents[_0x5742('0x5')](_0x86b03d,_0x494265);_0x1364e8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x5742('0x6')](e,emitEvent(event));}}module[_0x5742('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x2c64=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x3891ce,_0x312c49){var _0xdf2765=function(_0x5afd39){while(--_0x5afd39){_0x3891ce['push'](_0x3891ce['shift']());}};_0xdf2765(++_0x312c49);}(_0x2c64,0x181));var _0x42c6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x2c64[_0x173441];return _0x2423a8;};'use strict';var EventEmitter=require(_0x42c6('0x0'));var ChatInternalMessage=require(_0x42c6('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x42c6('0x2')](0x0);var events={'afterCreate':_0x42c6('0x3'),'afterUpdate':_0x42c6('0x4'),'afterDestroy':_0x42c6('0x5')};function emitEvent(_0x4c5b95){return function(_0x5a6d74,_0x427ee2,_0x41e211){ChatInternalMessageEvents[_0x42c6('0x6')](_0x4c5b95+':'+_0x5a6d74['id'],_0x5a6d74);ChatInternalMessageEvents['emit'](_0x4c5b95,_0x5a6d74);_0x41e211(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x42c6('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 79b4346..cbd11c0 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 _0x7fbc=['../../config/environment','./chatInternalMessage.attributes','exports','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x1a9907,_0x53ee2c){var _0x4bf6e8=function(_0xe67d83){while(--_0xe67d83){_0x1a9907['push'](_0x1a9907['shift']());}};_0x4bf6e8(++_0x53ee2c);}(_0x7fbc,0x1c7));var _0xc7fb=function(_0x50779a,_0x1c3e6d){_0x50779a=_0x50779a-0x0;var _0x28d535=_0x7fbc[_0x50779a];return _0x28d535;};'use strict';var _=require(_0xc7fb('0x0'));var util=require('util');var logger=require(_0xc7fb('0x1'))(_0xc7fb('0x2'));var moment=require(_0xc7fb('0x3'));var BPromise=require(_0xc7fb('0x4'));var rp=require(_0xc7fb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc7fb('0x6'));var config=require(_0xc7fb('0x7'));var attributes=require(_0xc7fb('0x8'));module[_0xc7fb('0x9')]=function(_0x11f5b2,_0x3a1e8c){return _0x11f5b2['define']('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc7fb('0xa')});}; \ No newline at end of file +var _0x9118=['utf8mb4','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage'];(function(_0x48df88,_0xf92cd9){var _0x131496=function(_0x1b75fe){while(--_0x1b75fe){_0x48df88['push'](_0x48df88['shift']());}};_0x131496(++_0xf92cd9);}(_0x9118,0x114));var _0x8911=function(_0xcbd776,_0x302fe8){_0xcbd776=_0xcbd776-0x0;var _0x13d4b4=_0x9118[_0xcbd776];return _0x13d4b4;};'use strict';var _=require(_0x8911('0x0'));var util=require('util');var logger=require(_0x8911('0x1'))(_0x8911('0x2'));var moment=require('moment');var BPromise=require(_0x8911('0x3'));var rp=require(_0x8911('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8911('0x5'));var config=require(_0x8911('0x6'));var attributes=require(_0x8911('0x7'));module[_0x8911('0x8')]=function(_0x203e31,_0xa67e6c){return _0x203e31['define'](_0x8911('0x9'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8911('0xa'),'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 4cefb8a..6c38fdc 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 _0xaa9d=['ChatInternalMessage,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x11cbb5,_0x390441){var _0x54b8d3=function(_0x162ca2){while(--_0x162ca2){_0x11cbb5['push'](_0x11cbb5['shift']());}};_0x54b8d3(++_0x390441);}(_0xaa9d,0x1aa));var _0xdaa9=function(_0x3fbbfb,_0xc6faa8){_0x3fbbfb=_0x3fbbfb-0x0;var _0x39644a=_0xaa9d[_0x3fbbfb];return _0x39644a;};'use strict';var _=require(_0xdaa9('0x0'));var util=require(_0xdaa9('0x1'));var moment=require(_0xdaa9('0x2'));var BPromise=require(_0xdaa9('0x3'));var rs=require(_0xdaa9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdaa9('0x5'));var config=require(_0xdaa9('0x6'));var jayson=require(_0xdaa9('0x7'));var client=jayson[_0xdaa9('0x8')]['http']({'port':0x232a});config['redis']=_[_0xdaa9('0x9')](config[_0xdaa9('0xa')],{'host':_0xdaa9('0xb'),'port':0x18eb});var socket=require(_0xdaa9('0xc'))(new Redis(config['redis']));require(_0xdaa9('0xd'))['register'](socket);function respondWithRpcPromise(_0x383742,_0x5d01cb,_0x2e2a50){return new BPromise(function(_0x513d36,_0x4f490d){return client[_0xdaa9('0xe')](_0x383742,_0x2e2a50)[_0xdaa9('0xf')](function(_0x37a749){logger[_0xdaa9('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x5d01cb,'request\x20sent');logger[_0xdaa9('0x11')](_0xdaa9('0x12'),_0x5d01cb,_0xdaa9('0x13'),JSON[_0xdaa9('0x14')](_0x37a749));if(_0x37a749[_0xdaa9('0x15')]){if(_0x37a749[_0xdaa9('0x15')][_0xdaa9('0x16')]===0x1f4){logger[_0xdaa9('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x5d01cb,_0x37a749['error'][_0xdaa9('0x17')]);return _0x4f490d(_0x37a749[_0xdaa9('0x15')][_0xdaa9('0x17')]);}logger[_0xdaa9('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x5d01cb,_0x37a749['error'][_0xdaa9('0x17')]);return _0x513d36(_0x37a749['error']['message']);}else{logger['info'](_0xdaa9('0x18'),_0x5d01cb,'request\x20sent');_0x513d36(_0x37a749['result'][_0xdaa9('0x17')]);}})['catch'](function(_0x3c4445){logger[_0xdaa9('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x5d01cb,_0x3c4445);_0x4f490d(_0x3c4445);});});} \ No newline at end of file +var _0x6367=['ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','info'];(function(_0x137078,_0x53da8b){var _0x713920=function(_0x57ddc8){while(--_0x57ddc8){_0x137078['push'](_0x137078['shift']());}};_0x713920(++_0x53da8b);}(_0x6367,0x1d5));var _0x7636=function(_0xd21fe7,_0x225a39){_0xd21fe7=_0xd21fe7-0x0;var _0x14d570=_0x6367[_0xd21fe7];return _0x14d570;};'use strict';var _=require('lodash');var util=require(_0x7636('0x0'));var moment=require('moment');var BPromise=require(_0x7636('0x1'));var rs=require(_0x7636('0x2'));var fs=require('fs');var Redis=require(_0x7636('0x3'));var db=require(_0x7636('0x4'))['db'];var utils=require(_0x7636('0x5'));var logger=require('../../config/logger')(_0x7636('0x6'));var config=require(_0x7636('0x7'));var jayson=require(_0x7636('0x8'));var client=jayson[_0x7636('0x9')]['http']({'port':0x232a});config[_0x7636('0xa')]=_['defaults'](config['redis'],{'host':_0x7636('0xb'),'port':0x18eb});var socket=require(_0x7636('0xc'))(new Redis(config[_0x7636('0xa')]));require('./chatInternalMessage.socket')[_0x7636('0xd')](socket);function respondWithRpcPromise(_0x4cc5a6,_0x140d97,_0x3f2e3b){return new BPromise(function(_0x51bb02,_0x20fc59){return client[_0x7636('0xe')](_0x4cc5a6,_0x3f2e3b)[_0x7636('0xf')](function(_0x2f7e28){logger[_0x7636('0x10')](_0x7636('0x11'),_0x140d97,_0x7636('0x12'));logger[_0x7636('0x13')](_0x7636('0x14'),_0x140d97,'request\x20sent',JSON[_0x7636('0x15')](_0x2f7e28));if(_0x2f7e28[_0x7636('0x16')]){if(_0x2f7e28['error'][_0x7636('0x17')]===0x1f4){logger[_0x7636('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x140d97,_0x2f7e28[_0x7636('0x16')][_0x7636('0x18')]);return _0x20fc59(_0x2f7e28[_0x7636('0x16')]['message']);}logger[_0x7636('0x16')](_0x7636('0x11'),_0x140d97,_0x2f7e28[_0x7636('0x16')][_0x7636('0x18')]);return _0x51bb02(_0x2f7e28['error'][_0x7636('0x18')]);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x140d97,_0x7636('0x12'));_0x51bb02(_0x2f7e28[_0x7636('0x19')][_0x7636('0x18')]);}})[_0x7636('0x1a')](function(_0x357a84){logger[_0x7636('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x140d97,_0x357a84);_0x20fc59(_0x357a84);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 4005c51..a96b5a6 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 _0x4a9a=['remove','update','emit','register','length','./chatInternalMessage.events','save'];(function(_0x7976f8,_0x3ebfb0){var _0x33c2c4=function(_0x522e44){while(--_0x522e44){_0x7976f8['push'](_0x7976f8['shift']());}};_0x33c2c4(++_0x3ebfb0);}(_0x4a9a,0x98));var _0xa4a9=function(_0x1beaeb,_0x593fc5){_0x1beaeb=_0x1beaeb-0x0;var _0x58acc2=_0x4a9a[_0x1beaeb];return _0x58acc2;};'use strict';var ChatInternalMessageEvents=require(_0xa4a9('0x0'));var events=[_0xa4a9('0x1'),_0xa4a9('0x2'),_0xa4a9('0x3')];function createListener(_0x17911f,_0x40cd00){return function(_0x243421){_0x40cd00[_0xa4a9('0x4')](_0x17911f,_0x243421);};}function removeListener(_0xe09297,_0x402585){return function(){ChatInternalMessageEvents['removeListener'](_0xe09297,_0x402585);};}exports[_0xa4a9('0x5')]=function(_0x4aae56){for(var _0x5834fc=0x0,_0xacabb3=events[_0xa4a9('0x6')];_0x5834fc<_0xacabb3;_0x5834fc++){var _0x16c023=events[_0x5834fc];var _0x58db5d=createListener('chatInternalMessage:'+_0x16c023,_0x4aae56);ChatInternalMessageEvents['on'](_0x16c023,_0x58db5d);}}; \ No newline at end of file +var _0x1035=['remove','update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x10f34b,_0x2a1872){var _0x4a648f=function(_0x15edc2){while(--_0x15edc2){_0x10f34b['push'](_0x10f34b['shift']());}};_0x4a648f(++_0x2a1872);}(_0x1035,0x18a));var _0x5103=function(_0x586fa2,_0x1a45bc){_0x586fa2=_0x586fa2-0x0;var _0x515be9=_0x1035[_0x586fa2];return _0x515be9;};'use strict';var ChatInternalMessageEvents=require(_0x5103('0x0'));var events=[_0x5103('0x1'),_0x5103('0x2'),_0x5103('0x3')];function createListener(_0x1f68a0,_0x475423){return function(_0x2925c3){_0x475423[_0x5103('0x4')](_0x1f68a0,_0x2925c3);};}function removeListener(_0x592265,_0x2737b6){return function(){ChatInternalMessageEvents[_0x5103('0x5')](_0x592265,_0x2737b6);};}exports[_0x5103('0x6')]=function(_0x31f741){for(var _0x33a264=0x0,_0x58c7a6=events[_0x5103('0x7')];_0x33a264<_0x58c7a6;_0x33a264++){var _0x5f5dfd=events[_0x33a264];var _0x479d02=createListener(_0x5103('0x8')+_0x5f5dfd,_0x31f741);ChatInternalMessageEvents['on'](_0x5f5dfd,_0x479d02);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index d3d85ac..4c42568 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 _0xb917=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','post','create','put','update','delete','destroy','multer'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xb917,0xef));var _0x7b91=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xb917[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7b91('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7b91('0x1'));var express=require('express');var router=express[_0x7b91('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7b91('0x3'));var config=require(_0x7b91('0x4'));var controller=require(_0x7b91('0x5'));router[_0x7b91('0x6')]('/',auth[_0x7b91('0x7')](),controller[_0x7b91('0x8')]);router['get'](_0x7b91('0x9'),auth[_0x7b91('0x7')](),controller[_0x7b91('0xa')]);router[_0x7b91('0x6')](_0x7b91('0xb'),auth[_0x7b91('0x7')](),controller[_0x7b91('0xc')]);router[_0x7b91('0x6')](_0x7b91('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x7b91('0xe')]('/',auth[_0x7b91('0x7')](),controller[_0x7b91('0xf')]);router[_0x7b91('0x10')]('/:id',controller[_0x7b91('0x11')]);router[_0x7b91('0x12')](_0x7b91('0xd'),auth[_0x7b91('0x7')](),controller[_0x7b91('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1503=['index','/describe','describe','/users','getUsers','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated'];(function(_0x2b1ecb,_0x4c900f){var _0x45eced=function(_0x8f19e0){while(--_0x8f19e0){_0x2b1ecb['push'](_0x2b1ecb['shift']());}};_0x45eced(++_0x4c900f);}(_0x1503,0x1e2));var _0x3150=function(_0x23967c,_0x2e4a6e){_0x23967c=_0x23967c-0x0;var _0x151129=_0x1503[_0x23967c];return _0x151129;};'use strict';var multer=require(_0x3150('0x0'));var util=require(_0x3150('0x1'));var path=require(_0x3150('0x2'));var timeout=require(_0x3150('0x3'));var express=require(_0x3150('0x4'));var router=express[_0x3150('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3150('0x6'));var interaction=require(_0x3150('0x7'));var config=require(_0x3150('0x8'));var controller=require(_0x3150('0x9'));router[_0x3150('0xa')]('/',auth[_0x3150('0xb')](),controller[_0x3150('0xc')]);router['get'](_0x3150('0xd'),auth['isAuthenticated'](),controller[_0x3150('0xe')]);router[_0x3150('0xa')](_0x3150('0xf'),auth[_0x3150('0xb')](),controller[_0x3150('0x10')]);router[_0x3150('0xa')](_0x3150('0x11'),auth[_0x3150('0xb')](),controller[_0x3150('0x12')]);router[_0x3150('0x13')]('/',auth[_0x3150('0xb')](),controller[_0x3150('0x14')]);router[_0x3150('0x15')]('/:id',controller[_0x3150('0x16')]);router[_0x3150('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x3150('0x18')]);module[_0x3150('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 3a7322c..6f0d10b 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 _0x93e9=['BOOLEAN','ENUM','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x5b8a38,_0x4ce772){var _0xa720b8=function(_0x7df6bd){while(--_0x7df6bd){_0x5b8a38['push'](_0x5b8a38['shift']());}};_0xa720b8(++_0x4ce772);}(_0x93e9,0xcc));var _0x993e=function(_0x4e7163,_0x5378e4){_0x4e7163=_0x4e7163-0x0;var _0x14c715=_0x93e9[_0x4e7163];return _0x14c715;};'use strict';var Sequelize=require(_0x993e('0x0'));module[_0x993e('0x1')]={'body':{'type':Sequelize[_0x993e('0x2')](_0x993e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x993e('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x993e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x993e('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x993e('0x6')]},'providerName':{'type':Sequelize[_0x993e('0x7')]},'providerResponse':{'type':Sequelize[_0x993e('0x2')]}}; \ No newline at end of file +var _0x5c00=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x577f3d,_0x43ab79){var _0x3b11f6=function(_0x4f1a61){while(--_0x4f1a61){_0x577f3d['push'](_0x577f3d['shift']());}};_0x3b11f6(++_0x43ab79);}(_0x5c00,0x17e));var _0x05c0=function(_0x328b40,_0x370642){_0x328b40=_0x328b40-0x0;var _0x556a56=_0x5c00[_0x328b40];return _0x556a56;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'body':{'type':Sequelize[_0x05c0('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x05c0('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x05c0('0x4')]('in',_0x05c0('0x5')),'defaultValue':_0x05c0('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x05c0('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x05c0('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 6340757..aaa7777 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 _0x6970=['pick','filter','merge','VIRTUAL','ChatMessage','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','chat-interactions','readAt','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','SIP/%s','channel','event','accept','EventManager','acceptmessage','parse','formData','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','User','interface','motionChannel','rejectmessage','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x6970,0xc3));var _0x0697=function(_0x314538,_0x38cb08){_0x314538=_0x314538-0x0;var _0x5d324d=_0x6970[_0x314538];return _0x5d324d;};'use strict';var emlformat=require(_0x0697('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0697('0x1'));var rp=require(_0x0697('0x2'));var moment=require(_0x0697('0x3'));var BPromise=require(_0x0697('0x4'));var Mustache=require(_0x0697('0x5'));var util=require(_0x0697('0x6'));var path=require(_0x0697('0x7'));var sox=require(_0x0697('0x8'));var csv=require(_0x0697('0x9'));var ejs=require(_0x0697('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0697('0xb'));var squel=require(_0x0697('0xc'));var crypto=require(_0x0697('0xd'));var jsforce=require(_0x0697('0xe'));var deskjs=require(_0x0697('0xf'));var toCsv=require(_0x0697('0x9'));var querystring=require('querystring');var Papa=require(_0x0697('0x10'));var Redis=require(_0x0697('0x11'));var authService=require(_0x0697('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0697('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0697('0x14'))(_0x0697('0x15'));var utils=require('../../config/utils');var config=require(_0x0697('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0697('0x17'))['db'];config[_0x0697('0x18')]=_[_0x0697('0x19')](config[_0x0697('0x18')],{'host':_0x0697('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0697('0x1b'))['register'](socket);var jayson=require(_0x0697('0x1c'));var client=jayson[_0x0697('0x1d')][_0x0697('0x1e')]({'port':0x232c});var client9002=jayson[_0x0697('0x1d')][_0x0697('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4b0d96,_0x29253b,_0x51e2a1,_0x5520f7){return new BPromise(function(_0x5dc613,_0x1333e6){var _0x2feae2=_0x5520f7||client;return _0x2feae2[_0x0697('0x1f')](_0x4b0d96,_0x51e2a1)[_0x0697('0x20')](function(_0x21c47b){logger[_0x0697('0x21')]('ChatMessage,\x20%s,\x20%s',_0x29253b,_0x0697('0x22'));logger[_0x0697('0x23')](_0x0697('0x24'),_0x29253b,_0x0697('0x22'),JSON[_0x0697('0x25')](_0x21c47b));if(_0x21c47b[_0x0697('0x26')]){if(_0x21c47b[_0x0697('0x26')][_0x0697('0x27')]===0x1f4){logger[_0x0697('0x26')](_0x0697('0x28'),_0x29253b,_0x21c47b[_0x0697('0x26')][_0x0697('0x29')]);return _0x1333e6(_0x21c47b['error'][_0x0697('0x29')]);}logger[_0x0697('0x26')](_0x0697('0x28'),_0x29253b,_0x21c47b[_0x0697('0x26')][_0x0697('0x29')]);return _0x5dc613(_0x21c47b[_0x0697('0x26')][_0x0697('0x29')]);}else{logger[_0x0697('0x21')]('ChatMessage,\x20%s,\x20%s',_0x29253b,_0x0697('0x22'));_0x5dc613(_0x21c47b[_0x0697('0x2a')][_0x0697('0x29')]);}})[_0x0697('0x2b')](function(_0x2b51ee){logger[_0x0697('0x26')](_0x0697('0x28'),_0x29253b,_0x2b51ee);_0x1333e6(_0x2b51ee);});});}function respondWithStatusCode(_0x375505,_0x1b3e67){_0x1b3e67=_0x1b3e67||0xcc;return function(_0x5a72ba){if(_0x5a72ba){return _0x375505[_0x0697('0x2c')](_0x1b3e67);}return _0x375505['status'](_0x1b3e67)[_0x0697('0x2d')]();};}function respondWithResult(_0x154414,_0x33937e){_0x33937e=_0x33937e||0xc8;return function(_0x130cb5){if(_0x130cb5){return _0x154414[_0x0697('0x2e')](_0x33937e)[_0x0697('0x2f')](_0x130cb5);}};}function respondWithFilteredResult(_0x44b3ff,_0x23deca){return function(_0x292638){if(_0x292638){var _0x21c23f=typeof _0x23deca[_0x0697('0x30')]===_0x0697('0x31')&&typeof _0x23deca[_0x0697('0x32')]===_0x0697('0x31');var _0x49e4db=_0x292638['count'];var _0x45d4f9=_0x21c23f?0x0:_0x23deca[_0x0697('0x30')];var _0xba7396=_0x21c23f?_0x292638[_0x0697('0x33')]:_0x23deca[_0x0697('0x30')]+_0x23deca[_0x0697('0x32')];var _0x4bcaf9;if(_0xba7396>=_0x49e4db){_0xba7396=_0x49e4db;_0x4bcaf9=0xc8;}else{_0x4bcaf9=0xce;}_0x44b3ff[_0x0697('0x2e')](_0x4bcaf9);return _0x44b3ff[_0x0697('0x34')](_0x0697('0x35'),_0x45d4f9+'-'+_0xba7396+'/'+_0x49e4db)[_0x0697('0x2f')](_0x292638);}return null;};}function patchUpdates(_0x359e2c){return function(_0x7944b2){try{jsonpatch[_0x0697('0x36')](_0x7944b2,_0x359e2c,!![]);}catch(_0x1ce940){return BPromise[_0x0697('0x37')](_0x1ce940);}return _0x7944b2[_0x0697('0x38')]();};}function saveUpdates(_0x4b1a9d,_0x58a4d9){return function(_0x3d1a8a){if(_0x3d1a8a){return _0x3d1a8a[_0x0697('0x39')](_0x4b1a9d)['then'](function(_0x362f7a){return _0x362f7a;});}return null;};}function removeEntity(_0x1d0df7,_0x3c060d){return function(_0x4477c8){if(_0x4477c8){return _0x4477c8[_0x0697('0x3a')]()[_0x0697('0x20')](function(){_0x1d0df7[_0x0697('0x2e')](0xcc)[_0x0697('0x2d')]();});}};}function handleEntityNotFound(_0x462978,_0xd1b8c6){return function(_0x267f05){if(!_0x267f05){_0x462978['sendStatus'](0x194);}return _0x267f05;};}function handleError(_0x27ad5b,_0x2dfb11){_0x2dfb11=_0x2dfb11||0x1f4;return function(_0x3a7150){logger[_0x0697('0x26')](_0x3a7150[_0x0697('0x3b')]);if(_0x3a7150['name']){delete _0x3a7150[_0x0697('0x3c')];}_0x27ad5b[_0x0697('0x2e')](_0x2dfb11)[_0x0697('0x3d')](_0x3a7150);};}exports[_0x0697('0x3e')]=function(_0x13dafa,_0x58d4cc){var _0x269bc1={},_0x3164df={},_0x268d2a={'count':0x0,'rows':[]};var _0xbe46a6=_[_0x0697('0x3f')](db['ChatMessage'][_0x0697('0x40')],function(_0x3b7de6){return{'name':_0x3b7de6[_0x0697('0x41')],'type':_0x3b7de6[_0x0697('0x42')][_0x0697('0x43')]};});_0x3164df[_0x0697('0x44')]=_[_0x0697('0x3f')](_0xbe46a6,_0x0697('0x3c'));_0x3164df[_0x0697('0x45')]=_['keys'](_0x13dafa[_0x0697('0x45')]);_0x3164df[_0x0697('0x46')]=_['intersection'](_0x3164df[_0x0697('0x44')],_0x3164df['query']);_0x269bc1[_0x0697('0x47')]=_[_0x0697('0x48')](_0x3164df[_0x0697('0x44')],qs[_0x0697('0x49')](_0x13dafa['query'][_0x0697('0x49')]));_0x269bc1['attributes']=_0x269bc1[_0x0697('0x47')][_0x0697('0x4a')]?_0x269bc1[_0x0697('0x47')]:_0x3164df[_0x0697('0x44')];if(!_0x13dafa['query']['hasOwnProperty'](_0x0697('0x4b'))){_0x269bc1[_0x0697('0x32')]=qs[_0x0697('0x32')](_0x13dafa[_0x0697('0x45')][_0x0697('0x32')]);_0x269bc1['offset']=qs[_0x0697('0x30')](_0x13dafa['query'][_0x0697('0x30')]);}_0x269bc1[_0x0697('0x4c')]=qs[_0x0697('0x4d')](_0x13dafa[_0x0697('0x45')][_0x0697('0x4d')]);_0x269bc1[_0x0697('0x4e')]=qs[_0x0697('0x46')](_[_0x0697('0x4f')](_0x13dafa['query'],_0x3164df[_0x0697('0x46')]),_0xbe46a6);if(_0x13dafa[_0x0697('0x45')][_0x0697('0x50')]){_0x269bc1[_0x0697('0x4e')]=_[_0x0697('0x51')](_0x269bc1[_0x0697('0x4e')],{'$or':_[_0x0697('0x3f')](_0xbe46a6,function(_0x4ecc1a){if(_0x4ecc1a[_0x0697('0x42')]!==_0x0697('0x52')){var _0x45b629={};_0x45b629[_0x4ecc1a[_0x0697('0x3c')]]={'$like':'%'+_0x13dafa[_0x0697('0x45')]['filter']+'%'};return _0x45b629;}})});}_0x269bc1=_[_0x0697('0x51')]({},_0x269bc1,_0x13dafa['options']);var _0x511f4a={'where':_0x269bc1['where']};return db[_0x0697('0x53')][_0x0697('0x33')](_0x511f4a)[_0x0697('0x20')](function(_0x2feee6){_0x268d2a['count']=_0x2feee6;if(_0x13dafa['query'][_0x0697('0x54')]){_0x269bc1[_0x0697('0x55')]=[{'all':!![]}];}return db[_0x0697('0x53')][_0x0697('0x56')](_0x269bc1);})[_0x0697('0x20')](function(_0x38abc7){_0x268d2a[_0x0697('0x57')]=_0x38abc7;return _0x268d2a;})['then'](respondWithFilteredResult(_0x58d4cc,_0x269bc1))[_0x0697('0x2b')](handleError(_0x58d4cc,null));};exports[_0x0697('0x58')]=function(_0x59d8ab,_0x84d7d4){var _0x4b2b08={'raw':!![],'where':{'id':_0x59d8ab[_0x0697('0x59')]['id']}},_0x433878={};_0x433878['model']=_[_0x0697('0x5a')](db[_0x0697('0x53')][_0x0697('0x40')]);_0x433878[_0x0697('0x45')]=_[_0x0697('0x5a')](_0x59d8ab[_0x0697('0x45')]);_0x433878['filters']=_[_0x0697('0x48')](_0x433878['model'],_0x433878['query']);_0x4b2b08[_0x0697('0x47')]=_['intersection'](_0x433878['model'],qs[_0x0697('0x49')](_0x59d8ab[_0x0697('0x45')][_0x0697('0x49')]));_0x4b2b08[_0x0697('0x47')]=_0x4b2b08[_0x0697('0x47')][_0x0697('0x4a')]?_0x4b2b08['attributes']:_0x433878['model'];if(_0x59d8ab[_0x0697('0x45')][_0x0697('0x54')]){_0x4b2b08[_0x0697('0x55')]=[{'all':!![]}];}_0x4b2b08=_[_0x0697('0x51')]({},_0x4b2b08,_0x59d8ab[_0x0697('0x5b')]);return db[_0x0697('0x53')][_0x0697('0x5c')](_0x4b2b08)[_0x0697('0x20')](handleEntityNotFound(_0x84d7d4,null))[_0x0697('0x20')](respondWithResult(_0x84d7d4,null))[_0x0697('0x2b')](handleError(_0x84d7d4,null));};exports[_0x0697('0x5d')]=function(_0x508ec8,_0x1ad6bc){return db[_0x0697('0x53')]['create'](_0x508ec8[_0x0697('0x5e')],{})[_0x0697('0x20')](respondWithResult(_0x1ad6bc,0xc9))[_0x0697('0x2b')](handleError(_0x1ad6bc,null));};exports['update']=function(_0x7af6cf,_0x5d27a8){if(_0x7af6cf['body']['id']){delete _0x7af6cf[_0x0697('0x5e')]['id'];}return db[_0x0697('0x53')][_0x0697('0x5c')]({'where':{'id':_0x7af6cf[_0x0697('0x59')]['id']}})[_0x0697('0x20')](handleEntityNotFound(_0x5d27a8,null))[_0x0697('0x20')](saveUpdates(_0x7af6cf[_0x0697('0x5e')],null))[_0x0697('0x20')](respondWithResult(_0x5d27a8,null))[_0x0697('0x2b')](handleError(_0x5d27a8,null));};exports[_0x0697('0x3a')]=function(_0x45f4a4,_0x8f5d80){return db['ChatMessage']['find']({'where':{'id':_0x45f4a4[_0x0697('0x59')]['id']}})['then'](handleEntityNotFound(_0x8f5d80,null))[_0x0697('0x20')](removeEntity(_0x8f5d80,null))['catch'](handleError(_0x8f5d80,null));};exports['describe']=function(_0x550eb4,_0xcdcccd){return db[_0x0697('0x53')]['describe']()[_0x0697('0x20')](respondWithResult(_0xcdcccd,null))[_0x0697('0x2b')](handleError(_0xcdcccd,null));};var interaction_log=require('../../config/logger')(_0x0697('0x5f'));exports['accept']=function(_0x5f2b72,_0x1a13af,_0x34c7db){var _0x5140b4={'agent':{},'channel':'chat'};if(_0x5f2b72[_0x0697('0x5e')]['id']){delete _0x5f2b72['body']['id'];}_0x5f2b72[_0x0697('0x5e')]['read']=!![];_0x5f2b72[_0x0697('0x5e')][_0x0697('0x60')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5f2b72['body']['UserId']=_0x5f2b72[_0x0697('0x5e')][_0x0697('0x61')]||_0x5f2b72[_0x0697('0x62')]['id'];_0x5140b4[_0x0697('0x63')]['id']=_0x5f2b72[_0x0697('0x5e')][_0x0697('0x61')];return db[_0x0697('0x53')][_0x0697('0x5c')]({'where':{'id':_0x5f2b72[_0x0697('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1a13af,null))['then'](saveUpdates(_0x5f2b72[_0x0697('0x5e')],null))['then'](function(_0x4ed75f){if(_0x4ed75f){_0x5140b4[_0x0697('0x29')]=_0x4ed75f[_0x0697('0x64')]({'plain':!![]});return db[_0x0697('0x65')][_0x0697('0x5c')]({'where':{'id':_0x4ed75f[_0x0697('0x66')]}});}return null;})[_0x0697('0x20')](handleEntityNotFound(_0x1a13af,null))['then'](function(_0x3a4583){if(_0x3a4583){return _0x3a4583[_0x0697('0x39')]({'UserId':_0x5f2b72['body'][_0x0697('0x61')],'read1stAt':_[_0x0697('0x67')](_0x3a4583[_0x0697('0x68')])?moment()[_0x0697('0x69')](_0x0697('0x6a')):undefined});}return null;})['then'](function(_0x4dc158){if(_0x4dc158){_0x5140b4['interaction']=_0x4dc158['get']({'plain':!![]});interaction_log['info'](_0x0697('0x6b'),_0x5f2b72[_0x0697('0x62')]['id'],_0x5f2b72[_0x0697('0x62')]['name'],_0x5f2b72[_0x0697('0x62')][_0x0697('0x6c')],_0x5140b4[_0x0697('0x6d')]['id'],_0x5f2b72[_0x0697('0x5e')]?JSON[_0x0697('0x25')](_0x5f2b72['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x0697('0x6e'),_0x5140b4);}return null;})[_0x0697('0x20')](function(_0x225e99){var _0x231a26=_0x0697('0x6f')+_0x225e99[_0x0697('0x29')][_0x0697('0x70')];return db[_0x0697('0x71')][_0x0697('0x45')](_0x231a26,{'type':db[_0x0697('0x72')][_0x0697('0x73')][_0x0697('0x74')],'raw':!![]})[_0x0697('0x20')](function(_0x4862bb){return _0x4862bb;});})[_0x0697('0x20')](function(_0x131a84){if(_0x131a84){_0x5140b4[_0x0697('0x29')][_0x0697('0x75')]=_0x131a84[0x0];if(!_0x5f2b72[_0x0697('0x5e')]['UserId'])return;return db['User'][_0x0697('0x5c')]({'where':{'id':_0x5f2b72['body']['UserId'],'role':_0x0697('0x63')},'attributes':['id',_0x0697('0x3c'),_0x0697('0x76'),_0x0697('0x77'),_0x0697('0x78')],'raw':!![]});}return null;})['then'](function(_0x39ed8e){if(!_0x39ed8e)return null;_0x5140b4['message'][_0x0697('0x63')]=_0x39ed8e;return _0x5140b4;})[_0x0697('0x20')](function(_0x3e563d){if(_0x3e563d){if(_0x5f2b72[_0x0697('0x5e')]['manual']){_0x5140b4[_0x0697('0x29')]['interface']=util[_0x0697('0x69')](_0x0697('0x79'),_0x5f2b72['user'][_0x0697('0x3c')]);_0x5140b4[_0x0697('0x29')][_0x0697('0x7a')]=_0x5140b4['channel'];_0x5140b4[_0x0697('0x29')]['motionChannel']=_0x5140b4[_0x0697('0x7a')];_0x5140b4[_0x0697('0x29')][_0x0697('0x7b')]=_0x0697('0x7c');return respondWithRpcPromise(_0x0697('0x7d'),'EventManager',{'event':_0x0697('0x7e'),'message':_[_0x0697('0x51')](_0x5140b4[_0x0697('0x29')],JSON[_0x0697('0x7f')](_0x5140b4[_0x0697('0x6d')][_0x0697('0x80')]))},client9002)[_0x0697('0x20')](function(){return _0x5140b4;});}return _0x5140b4;}return null;})[_0x0697('0x20')](respondWithResult(_0x1a13af,null))[_0x0697('0x2b')](handleError(_0x1a13af,null));};var interaction_log=require(_0x0697('0x14'))(_0x0697('0x5f'));exports[_0x0697('0x37')]=function(_0x34b68b,_0x28bd2f,_0x2edd2f){var _0x1059ba={'agent':{},'channel':_0x0697('0x81')};if(_0x34b68b[_0x0697('0x5e')]['id']){delete _0x34b68b[_0x0697('0x5e')]['id'];}_0x34b68b[_0x0697('0x5e')][_0x0697('0x61')]=_0x34b68b['body'][_0x0697('0x61')]||_0x34b68b[_0x0697('0x62')]['id'];_0x1059ba['agent']['id']=_0x34b68b['body'][_0x0697('0x61')];return db['ChatMessage'][_0x0697('0x5c')]({'where':{'id':_0x34b68b[_0x0697('0x59')]['id'],'UserId':null}})[_0x0697('0x20')](handleEntityNotFound(_0x28bd2f,null))[_0x0697('0x20')](function(_0x41642e){if(_0x41642e){_0x1059ba[_0x0697('0x29')]=_0x41642e[_0x0697('0x64')]({'plain':!![]});return db[_0x0697('0x65')]['find']({'where':{'id':_0x41642e['ChatInteractionId']}});}return null;})[_0x0697('0x20')](handleEntityNotFound(_0x28bd2f,null))['then'](function(_0x3dd9e9){if(_0x3dd9e9){_0x1059ba[_0x0697('0x6d')]=_0x3dd9e9[_0x0697('0x64')]({'plain':!![]});interaction_log[_0x0697('0x21')](_0x0697('0x82'),_0x34b68b['user']['id'],_0x34b68b[_0x0697('0x62')][_0x0697('0x3c')],_0x34b68b[_0x0697('0x62')]['role'],_0x1059ba[_0x0697('0x6d')]['id'],_0x34b68b[_0x0697('0x5e')]?JSON[_0x0697('0x25')](_0x34b68b[_0x0697('0x5e')]):'null');return respondWithRpcPromise(_0x0697('0x83'),_0x0697('0x84'),_0x1059ba);}return null;})['then'](function(_0x4c7886){var _0x274abd='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4c7886['message'][_0x0697('0x70')];return db[_0x0697('0x71')]['query'](_0x274abd,{'type':db[_0x0697('0x72')]['QueryTypes'][_0x0697('0x74')],'raw':!![]})[_0x0697('0x20')](function(_0x31f57d){return _0x31f57d;});})[_0x0697('0x20')](function(_0x10c052){if(_0x10c052){_0x1059ba[_0x0697('0x29')][_0x0697('0x75')]=_0x10c052[0x0];if(!_0x34b68b[_0x0697('0x5e')][_0x0697('0x61')])return;return db[_0x0697('0x85')][_0x0697('0x5c')]({'where':{'id':_0x34b68b[_0x0697('0x5e')]['UserId'],'role':'agent'},'attributes':['id',_0x0697('0x3c'),_0x0697('0x76'),_0x0697('0x77'),_0x0697('0x78')],'raw':!![]});}return null;})[_0x0697('0x20')](function(_0x37f05a){if(!_0x37f05a)return null;_0x1059ba[_0x0697('0x29')][_0x0697('0x63')]=_0x37f05a;return _0x1059ba;})[_0x0697('0x20')](function(_0x9b06f7){if(_0x9b06f7){_0x9b06f7[_0x0697('0x29')][_0x0697('0x86')]=util[_0x0697('0x69')](_0x0697('0x79'),_0x34b68b['user']['name']);_0x9b06f7['message'][_0x0697('0x7a')]=_0x1059ba['channel'];_0x9b06f7[_0x0697('0x29')][_0x0697('0x87')]=_0x1059ba[_0x0697('0x7a')];_0x9b06f7[_0x0697('0x29')][_0x0697('0x7b')]=_0x0697('0x37');respondWithRpcPromise(_0x0697('0x7d'),_0x0697('0x7d'),{'event':_0x0697('0x88'),'message':_['merge'](_0x1059ba[_0x0697('0x29')],JSON[_0x0697('0x7f')](_0x1059ba['interaction'][_0x0697('0x80')]))},client9002);return _0x1059ba;}return null;})[_0x0697('0x20')](respondWithResult(_0x28bd2f,null))[_0x0697('0x2b')](handleError(_0x28bd2f,null));}; \ No newline at end of file +var _0xd8c0=['set','reject','save','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','params','options','update','body','find','describe','chat-interactions','accept','chat','read','format','UserId','user','agent','get','ChatInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','fullname','interface','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./chatMessage.socket','client','http','request','then','info','debug','stringify','error','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset'];(function(_0x1c72c2,_0x21a241){var _0x4b9c84=function(_0x302f07){while(--_0x302f07){_0x1c72c2['push'](_0x1c72c2['shift']());}};_0x4b9c84(++_0x21a241);}(_0xd8c0,0x147));var _0x0d8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8c0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d8c('0x0'));var zipdir=require(_0x0d8c('0x1'));var jsonpatch=require(_0x0d8c('0x2'));var rp=require('request-promise');var moment=require(_0x0d8c('0x3'));var BPromise=require(_0x0d8c('0x4'));var Mustache=require('mustache');var util=require(_0x0d8c('0x5'));var path=require('path');var sox=require(_0x0d8c('0x6'));var csv=require(_0x0d8c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0d8c('0x8'));var _=require(_0x0d8c('0x9'));var squel=require('squel');var crypto=require(_0x0d8c('0xa'));var jsforce=require(_0x0d8c('0xb'));var deskjs=require(_0x0d8c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0d8c('0xd'));var Papa=require(_0x0d8c('0xe'));var Redis=require(_0x0d8c('0xf'));var authService=require(_0x0d8c('0x10'));var qs=require(_0x0d8c('0x11'));var as=require(_0x0d8c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d8c('0x13'))(_0x0d8c('0x14'));var utils=require(_0x0d8c('0x15'));var config=require(_0x0d8c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d8c('0x17'))['db'];config['redis']=_[_0x0d8c('0x18')](config[_0x0d8c('0x19')],{'host':_0x0d8c('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0d8c('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x0d8c('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x0d8c('0x1c')][_0x0d8c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1b7b82,_0x5437ab,_0x5d7e32,_0x3ef7d8){return new BPromise(function(_0x574ee8,_0x4fd88e){var _0x16015a=_0x3ef7d8||client;return _0x16015a[_0x0d8c('0x1e')](_0x1b7b82,_0x5d7e32)[_0x0d8c('0x1f')](function(_0x2d339b){logger[_0x0d8c('0x20')]('ChatMessage,\x20%s,\x20%s',_0x5437ab,'request\x20sent');logger[_0x0d8c('0x21')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x5437ab,'request\x20sent',JSON[_0x0d8c('0x22')](_0x2d339b));if(_0x2d339b[_0x0d8c('0x23')]){if(_0x2d339b['error']['code']===0x1f4){logger[_0x0d8c('0x23')](_0x0d8c('0x24'),_0x5437ab,_0x2d339b[_0x0d8c('0x23')][_0x0d8c('0x25')]);return _0x4fd88e(_0x2d339b[_0x0d8c('0x23')][_0x0d8c('0x25')]);}logger[_0x0d8c('0x23')](_0x0d8c('0x24'),_0x5437ab,_0x2d339b[_0x0d8c('0x23')][_0x0d8c('0x25')]);return _0x574ee8(_0x2d339b[_0x0d8c('0x23')][_0x0d8c('0x25')]);}else{logger[_0x0d8c('0x20')]('ChatMessage,\x20%s,\x20%s',_0x5437ab,'request\x20sent');_0x574ee8(_0x2d339b[_0x0d8c('0x26')]['message']);}})[_0x0d8c('0x27')](function(_0x53c28e){logger[_0x0d8c('0x23')]('ChatMessage,\x20%s,\x20%s',_0x5437ab,_0x53c28e);_0x4fd88e(_0x53c28e);});});}function respondWithStatusCode(_0x490a92,_0xea352f){_0xea352f=_0xea352f||0xcc;return function(_0x53e50a){if(_0x53e50a){return _0x490a92[_0x0d8c('0x28')](_0xea352f);}return _0x490a92['status'](_0xea352f)[_0x0d8c('0x29')]();};}function respondWithResult(_0x573b79,_0xc08209){_0xc08209=_0xc08209||0xc8;return function(_0x361488){if(_0x361488){return _0x573b79[_0x0d8c('0x2a')](_0xc08209)[_0x0d8c('0x2b')](_0x361488);}};}function respondWithFilteredResult(_0x50d32f,_0x24e813){return function(_0x258559){if(_0x258559){var _0x4d39e2=typeof _0x24e813['offset']===_0x0d8c('0x2c')&&typeof _0x24e813[_0x0d8c('0x2d')]===_0x0d8c('0x2c');var _0x55e70a=_0x258559[_0x0d8c('0x2e')];var _0x235bd8=_0x4d39e2?0x0:_0x24e813[_0x0d8c('0x2f')];var _0x7cb51b=_0x4d39e2?_0x258559[_0x0d8c('0x2e')]:_0x24e813[_0x0d8c('0x2f')]+_0x24e813['limit'];var _0x301896;if(_0x7cb51b>=_0x55e70a){_0x7cb51b=_0x55e70a;_0x301896=0xc8;}else{_0x301896=0xce;}_0x50d32f[_0x0d8c('0x2a')](_0x301896);return _0x50d32f[_0x0d8c('0x30')]('Content-Range',_0x235bd8+'-'+_0x7cb51b+'/'+_0x55e70a)[_0x0d8c('0x2b')](_0x258559);}return null;};}function patchUpdates(_0x4f2e6f){return function(_0x3136cc){try{jsonpatch['apply'](_0x3136cc,_0x4f2e6f,!![]);}catch(_0x30742b){return BPromise[_0x0d8c('0x31')](_0x30742b);}return _0x3136cc[_0x0d8c('0x32')]();};}function saveUpdates(_0x3a60b5,_0x22c40e){return function(_0x2bcbda){if(_0x2bcbda){return _0x2bcbda['update'](_0x3a60b5)[_0x0d8c('0x1f')](function(_0x232617){return _0x232617;});}return null;};}function removeEntity(_0x5a9ced,_0x1beb36){return function(_0x1fdb02){if(_0x1fdb02){return _0x1fdb02[_0x0d8c('0x33')]()[_0x0d8c('0x1f')](function(){_0x5a9ced['status'](0xcc)[_0x0d8c('0x29')]();});}};}function handleEntityNotFound(_0x51db29,_0x563abc){return function(_0x82eba6){if(!_0x82eba6){_0x51db29[_0x0d8c('0x28')](0x194);}return _0x82eba6;};}function handleError(_0x34c1fe,_0x2cbb02){_0x2cbb02=_0x2cbb02||0x1f4;return function(_0x2d2d60){logger[_0x0d8c('0x23')](_0x2d2d60[_0x0d8c('0x34')]);if(_0x2d2d60['name']){delete _0x2d2d60[_0x0d8c('0x35')];}_0x34c1fe[_0x0d8c('0x2a')](_0x2cbb02)[_0x0d8c('0x36')](_0x2d2d60);};}exports[_0x0d8c('0x37')]=function(_0x273e59,_0x3ab99a){var _0xdb7f24={},_0x5c2577={},_0x5e7056={'count':0x0,'rows':[]};var _0x917c=_[_0x0d8c('0x38')](db[_0x0d8c('0x39')][_0x0d8c('0x3a')],function(_0x18e465){return{'name':_0x18e465[_0x0d8c('0x3b')],'type':_0x18e465[_0x0d8c('0x3c')]['key']};});_0x5c2577[_0x0d8c('0x3d')]=_[_0x0d8c('0x38')](_0x917c,_0x0d8c('0x35'));_0x5c2577[_0x0d8c('0x3e')]=_[_0x0d8c('0x3f')](_0x273e59[_0x0d8c('0x3e')]);_0x5c2577[_0x0d8c('0x40')]=_[_0x0d8c('0x41')](_0x5c2577[_0x0d8c('0x3d')],_0x5c2577[_0x0d8c('0x3e')]);_0xdb7f24[_0x0d8c('0x42')]=_[_0x0d8c('0x41')](_0x5c2577['model'],qs[_0x0d8c('0x43')](_0x273e59[_0x0d8c('0x3e')][_0x0d8c('0x43')]));_0xdb7f24[_0x0d8c('0x42')]=_0xdb7f24[_0x0d8c('0x42')][_0x0d8c('0x44')]?_0xdb7f24['attributes']:_0x5c2577[_0x0d8c('0x3d')];if(!_0x273e59[_0x0d8c('0x3e')]['hasOwnProperty'](_0x0d8c('0x45'))){_0xdb7f24[_0x0d8c('0x2d')]=qs['limit'](_0x273e59[_0x0d8c('0x3e')][_0x0d8c('0x2d')]);_0xdb7f24[_0x0d8c('0x2f')]=qs[_0x0d8c('0x2f')](_0x273e59[_0x0d8c('0x3e')][_0x0d8c('0x2f')]);}_0xdb7f24[_0x0d8c('0x46')]=qs[_0x0d8c('0x47')](_0x273e59['query'][_0x0d8c('0x47')]);_0xdb7f24['where']=qs[_0x0d8c('0x40')](_[_0x0d8c('0x48')](_0x273e59['query'],_0x5c2577[_0x0d8c('0x40')]),_0x917c);if(_0x273e59[_0x0d8c('0x3e')][_0x0d8c('0x49')]){_0xdb7f24[_0x0d8c('0x4a')]=_[_0x0d8c('0x4b')](_0xdb7f24['where'],{'$or':_['map'](_0x917c,function(_0xa21ea5){if(_0xa21ea5[_0x0d8c('0x3c')]!==_0x0d8c('0x4c')){var _0x39a84f={};_0x39a84f[_0xa21ea5[_0x0d8c('0x35')]]={'$like':'%'+_0x273e59[_0x0d8c('0x3e')][_0x0d8c('0x49')]+'%'};return _0x39a84f;}})});}_0xdb7f24=_[_0x0d8c('0x4b')]({},_0xdb7f24,_0x273e59['options']);var _0x577538={'where':_0xdb7f24[_0x0d8c('0x4a')]};return db[_0x0d8c('0x39')][_0x0d8c('0x2e')](_0x577538)[_0x0d8c('0x1f')](function(_0x27f798){_0x5e7056[_0x0d8c('0x2e')]=_0x27f798;if(_0x273e59[_0x0d8c('0x3e')][_0x0d8c('0x4d')]){_0xdb7f24['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0xdb7f24);})['then'](function(_0x42ff26){_0x5e7056[_0x0d8c('0x4e')]=_0x42ff26;return _0x5e7056;})['then'](respondWithFilteredResult(_0x3ab99a,_0xdb7f24))[_0x0d8c('0x27')](handleError(_0x3ab99a,null));};exports['show']=function(_0x486008,_0x33f514){var _0x27699a={'raw':!![],'where':{'id':_0x486008[_0x0d8c('0x4f')]['id']}},_0x21e005={};_0x21e005['model']=_[_0x0d8c('0x3f')](db['ChatMessage']['rawAttributes']);_0x21e005[_0x0d8c('0x3e')]=_['keys'](_0x486008[_0x0d8c('0x3e')]);_0x21e005[_0x0d8c('0x40')]=_[_0x0d8c('0x41')](_0x21e005['model'],_0x21e005[_0x0d8c('0x3e')]);_0x27699a[_0x0d8c('0x42')]=_[_0x0d8c('0x41')](_0x21e005[_0x0d8c('0x3d')],qs['fields'](_0x486008[_0x0d8c('0x3e')][_0x0d8c('0x43')]));_0x27699a[_0x0d8c('0x42')]=_0x27699a[_0x0d8c('0x42')][_0x0d8c('0x44')]?_0x27699a[_0x0d8c('0x42')]:_0x21e005[_0x0d8c('0x3d')];if(_0x486008[_0x0d8c('0x3e')]['includeAll']){_0x27699a['include']=[{'all':!![]}];}_0x27699a=_[_0x0d8c('0x4b')]({},_0x27699a,_0x486008[_0x0d8c('0x50')]);return db[_0x0d8c('0x39')]['find'](_0x27699a)[_0x0d8c('0x1f')](handleEntityNotFound(_0x33f514,null))['then'](respondWithResult(_0x33f514,null))[_0x0d8c('0x27')](handleError(_0x33f514,null));};exports['create']=function(_0xf11721,_0x33f77c){return db['ChatMessage']['create'](_0xf11721['body'],{})[_0x0d8c('0x1f')](respondWithResult(_0x33f77c,0xc9))[_0x0d8c('0x27')](handleError(_0x33f77c,null));};exports[_0x0d8c('0x51')]=function(_0x3d1772,_0x218688){if(_0x3d1772['body']['id']){delete _0x3d1772[_0x0d8c('0x52')]['id'];}return db[_0x0d8c('0x39')]['find']({'where':{'id':_0x3d1772[_0x0d8c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x218688,null))['then'](saveUpdates(_0x3d1772['body'],null))[_0x0d8c('0x1f')](respondWithResult(_0x218688,null))['catch'](handleError(_0x218688,null));};exports[_0x0d8c('0x33')]=function(_0x3f99b6,_0x127f46){return db[_0x0d8c('0x39')][_0x0d8c('0x53')]({'where':{'id':_0x3f99b6[_0x0d8c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x127f46,null))[_0x0d8c('0x1f')](removeEntity(_0x127f46,null))[_0x0d8c('0x27')](handleError(_0x127f46,null));};exports[_0x0d8c('0x54')]=function(_0x2f5976,_0x5b31af){return db[_0x0d8c('0x39')][_0x0d8c('0x54')]()[_0x0d8c('0x1f')](respondWithResult(_0x5b31af,null))['catch'](handleError(_0x5b31af,null));};var interaction_log=require(_0x0d8c('0x13'))(_0x0d8c('0x55'));exports[_0x0d8c('0x56')]=function(_0x2146c1,_0x1ef570,_0x42fcbf){var _0x3e66be={'agent':{},'channel':_0x0d8c('0x57')};if(_0x2146c1[_0x0d8c('0x52')]['id']){delete _0x2146c1[_0x0d8c('0x52')]['id'];}_0x2146c1[_0x0d8c('0x52')][_0x0d8c('0x58')]=!![];_0x2146c1[_0x0d8c('0x52')]['readAt']=moment()[_0x0d8c('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x2146c1[_0x0d8c('0x52')][_0x0d8c('0x5a')]=_0x2146c1['body'][_0x0d8c('0x5a')]||_0x2146c1[_0x0d8c('0x5b')]['id'];_0x3e66be[_0x0d8c('0x5c')]['id']=_0x2146c1[_0x0d8c('0x52')]['UserId'];return db[_0x0d8c('0x39')][_0x0d8c('0x53')]({'where':{'id':_0x2146c1['params']['id'],'UserId':null}})[_0x0d8c('0x1f')](handleEntityNotFound(_0x1ef570,null))[_0x0d8c('0x1f')](saveUpdates(_0x2146c1[_0x0d8c('0x52')],null))[_0x0d8c('0x1f')](function(_0x40db50){if(_0x40db50){_0x3e66be['message']=_0x40db50[_0x0d8c('0x5d')]({'plain':!![]});return db[_0x0d8c('0x5e')][_0x0d8c('0x53')]({'where':{'id':_0x40db50['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1ef570,null))['then'](function(_0x422995){if(_0x422995){return _0x422995[_0x0d8c('0x51')]({'UserId':_0x2146c1[_0x0d8c('0x52')][_0x0d8c('0x5a')],'read1stAt':_[_0x0d8c('0x5f')](_0x422995[_0x0d8c('0x60')])?moment()[_0x0d8c('0x59')](_0x0d8c('0x61')):undefined});}return null;})['then'](function(_0x22fc29){if(_0x22fc29){_0x3e66be[_0x0d8c('0x62')]=_0x22fc29[_0x0d8c('0x5d')]({'plain':!![]});interaction_log[_0x0d8c('0x20')](_0x0d8c('0x63'),_0x2146c1[_0x0d8c('0x5b')]['id'],_0x2146c1['user'][_0x0d8c('0x35')],_0x2146c1[_0x0d8c('0x5b')][_0x0d8c('0x64')],_0x3e66be['interaction']['id'],_0x2146c1[_0x0d8c('0x52')]?JSON[_0x0d8c('0x22')](_0x2146c1['body']):_0x0d8c('0x65'));return respondWithRpcPromise('AcceptMessage',_0x0d8c('0x66'),_0x3e66be);}return null;})['then'](function(_0x4852ea){var _0x1f2196=_0x0d8c('0x67')+_0x4852ea[_0x0d8c('0x25')][_0x0d8c('0x68')];return db['sequelize']['query'](_0x1f2196,{'type':db[_0x0d8c('0x69')][_0x0d8c('0x6a')][_0x0d8c('0x6b')],'raw':!![]})[_0x0d8c('0x1f')](function(_0x3370ac){return _0x3370ac;});})[_0x0d8c('0x1f')](function(_0x308fcc){if(_0x308fcc){_0x3e66be['message'][_0x0d8c('0x6c')]=_0x308fcc[0x0];if(!_0x2146c1[_0x0d8c('0x52')][_0x0d8c('0x5a')])return;return db['User'][_0x0d8c('0x53')]({'where':{'id':_0x2146c1[_0x0d8c('0x52')][_0x0d8c('0x5a')],'role':'agent'},'attributes':['id','name','fullname',_0x0d8c('0x6d'),_0x0d8c('0x6e')],'raw':!![]});}return null;})[_0x0d8c('0x1f')](function(_0x388bcb){if(!_0x388bcb)return null;_0x3e66be[_0x0d8c('0x25')][_0x0d8c('0x5c')]=_0x388bcb;return _0x3e66be;})[_0x0d8c('0x1f')](function(_0x3c52c2){if(_0x3c52c2){if(_0x2146c1[_0x0d8c('0x52')][_0x0d8c('0x6f')]){_0x3e66be[_0x0d8c('0x25')]['interface']=util[_0x0d8c('0x59')](_0x0d8c('0x70'),_0x2146c1[_0x0d8c('0x5b')][_0x0d8c('0x35')]);_0x3e66be[_0x0d8c('0x25')][_0x0d8c('0x71')]=_0x3e66be['channel'];_0x3e66be[_0x0d8c('0x25')][_0x0d8c('0x72')]=_0x3e66be[_0x0d8c('0x71')];_0x3e66be[_0x0d8c('0x25')][_0x0d8c('0x73')]=_0x0d8c('0x56');return respondWithRpcPromise('EventManager',_0x0d8c('0x74'),{'event':_0x0d8c('0x75'),'message':_['merge'](_0x3e66be[_0x0d8c('0x25')],JSON[_0x0d8c('0x76')](_0x3e66be[_0x0d8c('0x62')]['formData']))},client9002)[_0x0d8c('0x1f')](function(){return _0x3e66be;});}return _0x3e66be;}return null;})[_0x0d8c('0x1f')](respondWithResult(_0x1ef570,null))['catch'](handleError(_0x1ef570,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x0d8c('0x31')]=function(_0x341872,_0x1e4833,_0x2a3c89){var _0x5da4ae={'agent':{},'channel':_0x0d8c('0x57')};if(_0x341872[_0x0d8c('0x52')]['id']){delete _0x341872[_0x0d8c('0x52')]['id'];}_0x341872[_0x0d8c('0x52')][_0x0d8c('0x5a')]=_0x341872['body'][_0x0d8c('0x5a')]||_0x341872['user']['id'];_0x5da4ae[_0x0d8c('0x5c')]['id']=_0x341872[_0x0d8c('0x52')][_0x0d8c('0x5a')];return db[_0x0d8c('0x39')][_0x0d8c('0x53')]({'where':{'id':_0x341872[_0x0d8c('0x4f')]['id'],'UserId':null}})[_0x0d8c('0x1f')](handleEntityNotFound(_0x1e4833,null))[_0x0d8c('0x1f')](function(_0x3cfd07){if(_0x3cfd07){_0x5da4ae[_0x0d8c('0x25')]=_0x3cfd07['get']({'plain':!![]});return db[_0x0d8c('0x5e')][_0x0d8c('0x53')]({'where':{'id':_0x3cfd07['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1e4833,null))[_0x0d8c('0x1f')](function(_0x2564fe){if(_0x2564fe){_0x5da4ae[_0x0d8c('0x62')]=_0x2564fe['get']({'plain':!![]});interaction_log[_0x0d8c('0x20')](_0x0d8c('0x77'),_0x341872[_0x0d8c('0x5b')]['id'],_0x341872[_0x0d8c('0x5b')][_0x0d8c('0x35')],_0x341872['user'][_0x0d8c('0x64')],_0x5da4ae[_0x0d8c('0x62')]['id'],_0x341872['body']?JSON[_0x0d8c('0x22')](_0x341872['body']):_0x0d8c('0x65'));return respondWithRpcPromise(_0x0d8c('0x78'),_0x0d8c('0x79'),_0x5da4ae);}return null;})[_0x0d8c('0x1f')](function(_0x262893){var _0x4b9217=_0x0d8c('0x67')+_0x262893[_0x0d8c('0x25')]['ContactId'];return db[_0x0d8c('0x7a')]['query'](_0x4b9217,{'type':db[_0x0d8c('0x69')][_0x0d8c('0x6a')][_0x0d8c('0x6b')],'raw':!![]})['then'](function(_0x11fd72){return _0x11fd72;});})['then'](function(_0x3e4c97){if(_0x3e4c97){_0x5da4ae[_0x0d8c('0x25')][_0x0d8c('0x6c')]=_0x3e4c97[0x0];if(!_0x341872['body']['UserId'])return;return db['User'][_0x0d8c('0x53')]({'where':{'id':_0x341872['body']['UserId'],'role':_0x0d8c('0x5c')},'attributes':['id',_0x0d8c('0x35'),_0x0d8c('0x7b'),_0x0d8c('0x6d'),_0x0d8c('0x6e')],'raw':!![]});}return null;})[_0x0d8c('0x1f')](function(_0x40b4c5){if(!_0x40b4c5)return null;_0x5da4ae[_0x0d8c('0x25')][_0x0d8c('0x5c')]=_0x40b4c5;return _0x5da4ae;})[_0x0d8c('0x1f')](function(_0x36d79e){if(_0x36d79e){_0x36d79e[_0x0d8c('0x25')][_0x0d8c('0x7c')]=util['format'](_0x0d8c('0x70'),_0x341872[_0x0d8c('0x5b')][_0x0d8c('0x35')]);_0x36d79e[_0x0d8c('0x25')][_0x0d8c('0x71')]=_0x5da4ae[_0x0d8c('0x71')];_0x36d79e[_0x0d8c('0x25')][_0x0d8c('0x72')]=_0x5da4ae[_0x0d8c('0x71')];_0x36d79e[_0x0d8c('0x25')][_0x0d8c('0x73')]=_0x0d8c('0x31');respondWithRpcPromise(_0x0d8c('0x74'),_0x0d8c('0x74'),{'event':'rejectmessage','message':_['merge'](_0x5da4ae[_0x0d8c('0x25')],JSON[_0x0d8c('0x76')](_0x5da4ae['interaction']['formData']))},client9002);return _0x5da4ae;}return null;})[_0x0d8c('0x1f')](respondWithResult(_0x1e4833,null))[_0x0d8c('0x27')](handleError(_0x1e4833,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 83f6c7b..b8ad4f3 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 _0xd4ec=['../../mysqldb','ChatMessage','remove','emit','hasOwnProperty','exports'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xd4ec,0x180));var _0xcd4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4ec[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xcd4e('0x0'))['db'][_0xcd4e('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xcd4e('0x2')};function emitEvent(_0x320d37){return function(_0x42d25e,_0x26e986,_0x35a862){ChatMessageEvents['emit'](_0x320d37+':'+_0x42d25e['id'],_0x42d25e);ChatMessageEvents[_0xcd4e('0x3')](_0x320d37,_0x42d25e);_0x35a862(null);};}for(var e in events){if(events[_0xcd4e('0x4')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xcd4e('0x5')]=ChatMessageEvents; \ No newline at end of file +var _0x2c6a=['hook','exports','events','../../mysqldb','ChatMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x4b6420,_0x126201){var _0x37076f=function(_0x3ee471){while(--_0x3ee471){_0x4b6420['push'](_0x4b6420['shift']());}};_0x37076f(++_0x126201);}(_0x2c6a,0x1a6));var _0xa2c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c6a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xa2c6('0x0'));var ChatMessage=require(_0xa2c6('0x1'))['db'][_0xa2c6('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa2c6('0x3'),'afterUpdate':_0xa2c6('0x4'),'afterDestroy':_0xa2c6('0x5')};function emitEvent(_0x40f80a){return function(_0x1668bf,_0x25939c,_0x1b400f){ChatMessageEvents[_0xa2c6('0x6')](_0x40f80a+':'+_0x1668bf['id'],_0x1668bf);ChatMessageEvents['emit'](_0x40f80a,_0x1668bf);_0x1b400f(null);};}for(var e in events){if(events[_0xa2c6('0x7')](e)){var event=events[e];ChatMessage[_0xa2c6('0x8')](e,emitEvent(event));}}module[_0xa2c6('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 2dc589e..9df1967 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 _0x1c7f=['api','bluebird','request-promise','path','rimraf','./chatMessage.attributes','exports','define','chat_messages','fti_chat_messages','body','FULLTEXT','models','toLowerCase','direction','out','UserId','ChatInteraction','ChatInteractionId','then','update','catch','utf8mb4','utf8mb4_unicode_ci','../../config/logger'];(function(_0x2da8e7,_0x2426ff){var _0x531799=function(_0x5527a3){while(--_0x5527a3){_0x2da8e7['push'](_0x2da8e7['shift']());}};_0x531799(++_0x2426ff);}(_0x1c7f,0x95));var _0xf1c7=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x1c7f[_0x5bd426];return _0x23a7eb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf1c7('0x0'))(_0xf1c7('0x1'));var moment=require('moment');var BPromise=require(_0xf1c7('0x2'));var rp=require(_0xf1c7('0x3'));var fs=require('fs');var path=require(_0xf1c7('0x4'));var rimraf=require(_0xf1c7('0x5'));var config=require('../../config/environment');var attributes=require(_0xf1c7('0x6'));module[_0xf1c7('0x7')]=function(_0x3e98c6,_0x2dc96c){return _0x3e98c6[_0xf1c7('0x8')]('ChatMessage',attributes,{'tableName':_0xf1c7('0x9'),'paranoid':![],'indexes':[{'name':_0xf1c7('0xa'),'fields':[_0xf1c7('0xb')],'type':_0xf1c7('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x226a48,_0x1b7d5d,_0x46e441){var _0x5b9d6b=_0x3e98c6[_0xf1c7('0xd')];var _0x2e1f7a=_0x226a48['get']({'plain':!![]});if(_0x2e1f7a['direction'][_0xf1c7('0xe')]()==='in'||_0x2e1f7a[_0xf1c7('0xf')][_0xf1c7('0xe')]()===_0xf1c7('0x10')&&!_0x2e1f7a['secret']&&!_['isNil'](_0x2e1f7a[_0xf1c7('0x11')])){_0x5b9d6b[_0xf1c7('0x12')]['findOne']({'where':{'id':_0x2e1f7a[_0xf1c7('0x13')]}})[_0xf1c7('0x14')](function(_0x1f655e){if(_0x1f655e){_0x1f655e[_0xf1c7('0x15')]({'lastMsgAt':_0x2e1f7a['createdAt'],'lastMsgDirection':_0x2e1f7a[_0xf1c7('0xf')][_0xf1c7('0xe')]()});}})[_0xf1c7('0x16')](function(_0x11c4bd){console['error'](_0x11c4bd);});}_0x46e441();}},'charset':_0xf1c7('0x17'),'collate':_0xf1c7('0x18')});}; \ No newline at end of file +var _0xc39c=['then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','direction','toLowerCase','out','secret','isNil','ChatInteraction','findOne','ChatInteractionId'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc39c,0x13a));var _0xcc39=function(_0x32c247,_0x41b343){_0x32c247=_0x32c247-0x0;var _0x1fae4a=_0xc39c[_0x32c247];return _0x1fae4a;};'use strict';var _=require('lodash');var util=require(_0xcc39('0x0'));var logger=require(_0xcc39('0x1'))('api');var moment=require(_0xcc39('0x2'));var BPromise=require(_0xcc39('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc39('0x4'));var rimraf=require(_0xcc39('0x5'));var config=require(_0xcc39('0x6'));var attributes=require(_0xcc39('0x7'));module['exports']=function(_0x1a4ef5,_0x56182e){return _0x1a4ef5[_0xcc39('0x8')](_0xcc39('0x9'),attributes,{'tableName':_0xcc39('0xa'),'paranoid':![],'indexes':[{'name':_0xcc39('0xb'),'fields':[_0xcc39('0xc')],'type':_0xcc39('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x172f86,_0x484d83,_0xc02a2d){var _0x10231e=_0x1a4ef5['models'];var _0x2fc0fc=_0x172f86['get']({'plain':!![]});if(_0x2fc0fc[_0xcc39('0xe')]['toLowerCase']()==='in'||_0x2fc0fc[_0xcc39('0xe')][_0xcc39('0xf')]()===_0xcc39('0x10')&&!_0x2fc0fc[_0xcc39('0x11')]&&!_[_0xcc39('0x12')](_0x2fc0fc['UserId'])){_0x10231e[_0xcc39('0x13')][_0xcc39('0x14')]({'where':{'id':_0x2fc0fc[_0xcc39('0x15')]}})[_0xcc39('0x16')](function(_0x3bdc9a){if(_0x3bdc9a){_0x3bdc9a[_0xcc39('0x17')]({'lastMsgAt':_0x2fc0fc[_0xcc39('0x18')],'lastMsgDirection':_0x2fc0fc[_0xcc39('0xe')][_0xcc39('0xf')]()});}})['catch'](function(_0x4cbb8f){console[_0xcc39('0x19')](_0x4cbb8f);});}_0xc02a2d();}},'charset':_0xcc39('0x1a'),'collate':_0xcc39('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 71b5722..35e7176 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 _0x0ae9=['then','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','CreateChatMessage','ChatMessage','body','options','raw','stringify','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request'];(function(_0x2fb2f5,_0x5732b){var _0x2616ad=function(_0xf83f85){while(--_0xf83f85){_0x2fb2f5['push'](_0x2fb2f5['shift']());}};_0x2616ad(++_0x5732b);}(_0x0ae9,0x105));var _0x90ae=function(_0x40649b,_0x346b1e){_0x40649b=_0x40649b-0x0;var _0xcb984b=_0x0ae9[_0x40649b];return _0xcb984b;};'use strict';var _=require(_0x90ae('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x90ae('0x1'));var rs=require(_0x90ae('0x2'));var fs=require('fs');var Redis=require(_0x90ae('0x3'));var db=require(_0x90ae('0x4'))['db'];var utils=require(_0x90ae('0x5'));var logger=require(_0x90ae('0x6'))(_0x90ae('0x7'));var config=require(_0x90ae('0x8'));var jayson=require(_0x90ae('0x9'));var client=jayson[_0x90ae('0xa')][_0x90ae('0xb')]({'port':0x232a});config[_0x90ae('0xc')]=_[_0x90ae('0xd')](config[_0x90ae('0xc')],{'host':_0x90ae('0xe'),'port':0x18eb});var socket=require(_0x90ae('0xf'))(new Redis(config[_0x90ae('0xc')]));require(_0x90ae('0x10'))[_0x90ae('0x11')](socket);function respondWithRpcPromise(_0x269d0f,_0x4631c5,_0x363b6c){return new BPromise(function(_0x142c26,_0x578efc){return client[_0x90ae('0x12')](_0x269d0f,_0x363b6c)[_0x90ae('0x13')](function(_0x3dbecb){logger['info'](_0x90ae('0x14'),_0x4631c5,'request\x20sent');logger[_0x90ae('0x15')](_0x90ae('0x16'),_0x4631c5,'request\x20sent',JSON['stringify'](_0x3dbecb));if(_0x3dbecb[_0x90ae('0x17')]){if(_0x3dbecb[_0x90ae('0x17')][_0x90ae('0x18')]===0x1f4){logger[_0x90ae('0x17')](_0x90ae('0x14'),_0x4631c5,_0x3dbecb['error'][_0x90ae('0x19')]);return _0x578efc(_0x3dbecb[_0x90ae('0x17')][_0x90ae('0x19')]);}logger['error'](_0x90ae('0x14'),_0x4631c5,_0x3dbecb[_0x90ae('0x17')][_0x90ae('0x19')]);return _0x142c26(_0x3dbecb['error'][_0x90ae('0x19')]);}else{logger[_0x90ae('0x1a')](_0x90ae('0x14'),_0x4631c5,'request\x20sent');_0x142c26(_0x3dbecb[_0x90ae('0x1b')]['message']);}})['catch'](function(_0x3a8b70){logger['error'](_0x90ae('0x14'),_0x4631c5,_0x3a8b70);_0x578efc(_0x3a8b70);});});}exports[_0x90ae('0x1c')]=function(_0x309a56){var _0x4abbe0=this;return new Promise(function(_0x3cf1e3,_0x4046ea){return db[_0x90ae('0x1d')]['create'](_0x309a56[_0x90ae('0x1e')],{'raw':_0x309a56['options']?_0x309a56[_0x90ae('0x1f')][_0x90ae('0x20')]===undefined?!![]:![]:!![]})[_0x90ae('0x13')](function(_0x17004c){logger[_0x90ae('0x1a')](_0x90ae('0x1c'),_0x309a56);logger['debug'](_0x90ae('0x1c'),_0x309a56,JSON[_0x90ae('0x21')](_0x17004c));_0x3cf1e3(_0x17004c);})[_0x90ae('0x22')](function(_0x2abaa1){logger[_0x90ae('0x17')](_0x90ae('0x1c'),_0x2abaa1['message'],_0x309a56);_0x4046ea(_0x4abbe0[_0x90ae('0x17')](0x1f4,_0x2abaa1[_0x90ae('0x19')]));});});}; \ No newline at end of file +var _0x8bcc=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','result','catch','CreateChatMessage','ChatMessage','create','options','raw','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x4cd690,_0x4797cc){var _0x4a74a9=function(_0x4cbbc5){while(--_0x4cbbc5){_0x4cd690['push'](_0x4cd690['shift']());}};_0x4a74a9(++_0x4797cc);}(_0x8bcc,0xaa));var _0xc8bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bcc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc8bc('0x0'));var util=require(_0xc8bc('0x1'));var moment=require(_0xc8bc('0x2'));var BPromise=require(_0xc8bc('0x3'));var rs=require(_0xc8bc('0x4'));var fs=require('fs');var Redis=require(_0xc8bc('0x5'));var db=require(_0xc8bc('0x6'))['db'];var utils=require(_0xc8bc('0x7'));var logger=require(_0xc8bc('0x8'))(_0xc8bc('0x9'));var config=require(_0xc8bc('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc8bc('0xb')][_0xc8bc('0xc')]({'port':0x232a});config[_0xc8bc('0xd')]=_[_0xc8bc('0xe')](config[_0xc8bc('0xd')],{'host':_0xc8bc('0xf'),'port':0x18eb});var socket=require(_0xc8bc('0x10'))(new Redis(config[_0xc8bc('0xd')]));require('./chatMessage.socket')[_0xc8bc('0x11')](socket);function respondWithRpcPromise(_0x1dec81,_0x5e1fbb,_0x380322){return new BPromise(function(_0x30b3b1,_0x5f29e8){return client[_0xc8bc('0x12')](_0x1dec81,_0x380322)[_0xc8bc('0x13')](function(_0x2317de){logger['info'](_0xc8bc('0x14'),_0x5e1fbb,'request\x20sent');logger[_0xc8bc('0x15')](_0xc8bc('0x16'),_0x5e1fbb,'request\x20sent',JSON['stringify'](_0x2317de));if(_0x2317de[_0xc8bc('0x17')]){if(_0x2317de['error']['code']===0x1f4){logger[_0xc8bc('0x17')]('ChatMessage,\x20%s,\x20%s',_0x5e1fbb,_0x2317de['error'][_0xc8bc('0x18')]);return _0x5f29e8(_0x2317de[_0xc8bc('0x17')]['message']);}logger[_0xc8bc('0x17')](_0xc8bc('0x14'),_0x5e1fbb,_0x2317de['error'][_0xc8bc('0x18')]);return _0x30b3b1(_0x2317de[_0xc8bc('0x17')][_0xc8bc('0x18')]);}else{logger[_0xc8bc('0x19')](_0xc8bc('0x14'),_0x5e1fbb,_0xc8bc('0x1a'));_0x30b3b1(_0x2317de[_0xc8bc('0x1b')][_0xc8bc('0x18')]);}})[_0xc8bc('0x1c')](function(_0x2435ff){logger[_0xc8bc('0x17')](_0xc8bc('0x14'),_0x5e1fbb,_0x2435ff);_0x5f29e8(_0x2435ff);});});}exports[_0xc8bc('0x1d')]=function(_0xf4a84c){var _0x3a34d4=this;return new Promise(function(_0x391f99,_0x223bff){return db[_0xc8bc('0x1e')][_0xc8bc('0x1f')](_0xf4a84c['body'],{'raw':_0xf4a84c[_0xc8bc('0x20')]?_0xf4a84c[_0xc8bc('0x20')][_0xc8bc('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x4be65f){logger[_0xc8bc('0x19')](_0xc8bc('0x1d'),_0xf4a84c);logger['debug'](_0xc8bc('0x1d'),_0xf4a84c,JSON[_0xc8bc('0x22')](_0x4be65f));_0x391f99(_0x4be65f);})[_0xc8bc('0x1c')](function(_0x468628){logger[_0xc8bc('0x17')](_0xc8bc('0x1d'),_0x468628[_0xc8bc('0x18')],_0xf4a84c);_0x223bff(_0x3a34d4[_0xc8bc('0x17')](0x1f4,_0x468628['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index ef1a6d6..9a1bfe4 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 _0x078c=['register','length','./chatMessage.events','remove','update','emit','removeListener'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x078c,0x19f));var _0xc078=function(_0x421725,_0x318a04){_0x421725=_0x421725-0x0;var _0x51b322=_0x078c[_0x421725];return _0x51b322;};'use strict';var ChatMessageEvents=require(_0xc078('0x0'));var events=['save',_0xc078('0x1'),_0xc078('0x2')];function createListener(_0x503bd4,_0x82572){return function(_0x107624){_0x82572[_0xc078('0x3')](_0x503bd4,_0x107624);};}function removeListener(_0x217004,_0x56bf2e){return function(){ChatMessageEvents[_0xc078('0x4')](_0x217004,_0x56bf2e);};}exports[_0xc078('0x5')]=function(_0x394068){for(var _0x24b241=0x0,_0x40e428=events[_0xc078('0x6')];_0x24b241<_0x40e428;_0x24b241++){var _0x22661e=events[_0x24b241];var _0x4030b1=createListener('chatMessage:'+_0x22661e,_0x394068);ChatMessageEvents['on'](_0x22661e,_0x4030b1);}}; \ No newline at end of file +var _0x4491=['remove','emit','register','length','chatMessage:','./chatMessage.events'];(function(_0x382719,_0x91d5cb){var _0x48cff9=function(_0xf539c3){while(--_0xf539c3){_0x382719['push'](_0x382719['shift']());}};_0x48cff9(++_0x91d5cb);}(_0x4491,0x1bb));var _0x1449=function(_0x506172,_0xbc3a3){_0x506172=_0x506172-0x0;var _0x2723c0=_0x4491[_0x506172];return _0x2723c0;};'use strict';var ChatMessageEvents=require(_0x1449('0x0'));var events=['save',_0x1449('0x1'),'update'];function createListener(_0x4273ee,_0x176880){return function(_0x45474c){_0x176880[_0x1449('0x2')](_0x4273ee,_0x45474c);};}function removeListener(_0x1ff47f,_0x1b2870){return function(){ChatMessageEvents['removeListener'](_0x1ff47f,_0x1b2870);};}exports[_0x1449('0x3')]=function(_0x557482){for(var _0x1d45eb=0x0,_0x5dfe4c=events[_0x1449('0x4')];_0x1d45eb<_0x5dfe4c;_0x1d45eb++){var _0x2f4189=events[_0x1d45eb];var _0x10e119=createListener(_0x1449('0x5')+_0x2f4189,_0x557482);ChatMessageEvents['on'](_0x2f4189,_0x10e119);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index fa20a97..4248ceb 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 _0x7add=['reject','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x7add,0x16b));var _0xd7ad=function(_0x655082,_0x4619b1){_0x655082=_0x655082-0x0;var _0x561a70=_0x7add[_0x655082];return _0x561a70;};'use strict';var multer=require('multer');var util=require(_0xd7ad('0x0'));var path=require(_0xd7ad('0x1'));var timeout=require(_0xd7ad('0x2'));var express=require(_0xd7ad('0x3'));var router=express[_0xd7ad('0x4')]();var fs_extra=require(_0xd7ad('0x5'));var auth=require(_0xd7ad('0x6'));var interaction=require(_0xd7ad('0x7'));var config=require(_0xd7ad('0x8'));var controller=require(_0xd7ad('0x9'));router[_0xd7ad('0xa')]('/',auth['isAuthenticated'](),controller[_0xd7ad('0xb')]);router[_0xd7ad('0xa')](_0xd7ad('0xc'),auth['isAuthenticated'](),controller[_0xd7ad('0xd')]);router[_0xd7ad('0xa')](_0xd7ad('0xe'),auth[_0xd7ad('0xf')](),controller[_0xd7ad('0x10')]);router[_0xd7ad('0x11')]('/',auth[_0xd7ad('0xf')](),interaction[_0xd7ad('0x12')](_0xd7ad('0x13'),_0xd7ad('0x14')),controller[_0xd7ad('0x15')]);router[_0xd7ad('0x16')]('/:id',controller[_0xd7ad('0x17')]);router['put'](_0xd7ad('0x18'),auth[_0xd7ad('0xf')](),controller[_0xd7ad('0x19')]);router[_0xd7ad('0x16')](_0xd7ad('0x1a'),auth[_0xd7ad('0xf')](),controller[_0xd7ad('0x1b')]);router[_0xd7ad('0x1c')]('/:id',auth[_0xd7ad('0xf')](),controller['destroy']);module[_0xd7ad('0x1d')]=router; \ No newline at end of file +var _0x3394=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','chat','chatmessage:create','create','put','accept','/:id/reject','reject','delete','destroy'];(function(_0x383494,_0x2070d2){var _0x2485e5=function(_0x37c52e){while(--_0x37c52e){_0x383494['push'](_0x383494['shift']());}};_0x2485e5(++_0x2070d2);}(_0x3394,0x1a1));var _0x4339=function(_0x5b3608,_0x1d1559){_0x5b3608=_0x5b3608-0x0;var _0xa7d861=_0x3394[_0x5b3608];return _0xa7d861;};'use strict';var multer=require(_0x4339('0x0'));var util=require(_0x4339('0x1'));var path=require('path');var timeout=require(_0x4339('0x2'));var express=require(_0x4339('0x3'));var router=express[_0x4339('0x4')]();var fs_extra=require(_0x4339('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4339('0x6'));var config=require(_0x4339('0x7'));var controller=require('./chatMessage.controller');router[_0x4339('0x8')]('/',auth['isAuthenticated'](),controller[_0x4339('0x9')]);router[_0x4339('0x8')](_0x4339('0xa'),auth[_0x4339('0xb')](),controller[_0x4339('0xc')]);router[_0x4339('0x8')](_0x4339('0xd'),auth[_0x4339('0xb')](),controller[_0x4339('0xe')]);router[_0x4339('0xf')]('/',auth[_0x4339('0xb')](),interaction['tracked'](_0x4339('0x10'),_0x4339('0x11')),controller[_0x4339('0x12')]);router[_0x4339('0x13')](_0x4339('0xd'),controller['update']);router[_0x4339('0x13')]('/:id/accept',auth[_0x4339('0xb')](),controller[_0x4339('0x14')]);router[_0x4339('0x13')](_0x4339('0x15'),auth[_0x4339('0xb')](),controller[_0x4339('0x16')]);router[_0x4339('0x17')](_0x4339('0xd'),auth[_0x4339('0xb')](),controller[_0x4339('0x18')]);module[_0x4339('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 6abbfcf..173b7fe 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x2291bb,_0x1101e2){var _0x113b28=function(_0x5bfad3){while(--_0x5bfad3){_0x2291bb['push'](_0x2291bb['shift']());}};_0x113b28(++_0x1101e2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x46ae87,_0x4bd053){_0x46ae87=_0x46ae87-0x0;var _0x303fcc=_0x5f2f[_0x46ae87];return _0x303fcc;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x0b0e=['medium','sequelize','TEXT'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x0b0e[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 7834e18..f974a3e 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x7a54,0x106));var _0x47a5=function(_0x483a4b,_0x386afd){_0x483a4b=_0x483a4b-0x0;var _0x2a9580=_0x7a54[_0x483a4b];return _0x2a9580;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x7a54,0x106));var _0x47a5=function(_0x1f097c,_0x48f58d){_0x1f097c=_0x1f097c-0x0;var _0x4c608a=_0x7a54[_0x1f097c];return _0x4c608a;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index c619ff6..409557d 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0aba=['save','update','remove','emit','hasOwnProperty','events','ChatOfflineMessage','setMaxListeners'];(function(_0x19b980,_0x40c574){var _0x320fd8=function(_0x58f323){while(--_0x58f323){_0x19b980['push'](_0x19b980['shift']());}};_0x320fd8(++_0x40c574);}(_0x0aba,0x11d));var _0xa0ab=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x0aba[_0x363ef8];return _0x148822;};'use strict';var EventEmitter=require(_0xa0ab('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0xa0ab('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xa0ab('0x2')](0x0);var events={'afterCreate':_0xa0ab('0x3'),'afterUpdate':_0xa0ab('0x4'),'afterDestroy':_0xa0ab('0x5')};function emitEvent(_0x25dd5c){return function(_0x2f2eb4,_0x50cb98,_0x99410d){ChatOfflineMessageEvents[_0xa0ab('0x6')](_0x25dd5c+':'+_0x2f2eb4['id'],_0x2f2eb4);ChatOfflineMessageEvents[_0xa0ab('0x6')](_0x25dd5c,_0x2f2eb4);_0x99410d(null);};}for(var e in events){if(events[_0xa0ab('0x7')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x148c=['hook','events','../../mysqldb','ChatOfflineMessage','remove','emit','hasOwnProperty'];(function(_0x35f1de,_0x4dda19){var _0x4b66d6=function(_0x4ff6c5){while(--_0x4ff6c5){_0x35f1de['push'](_0x35f1de['shift']());}};_0x4b66d6(++_0x4dda19);}(_0x148c,0xd3));var _0xc148=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x148c[_0x16d10f];return _0x50c823;};'use strict';var EventEmitter=require(_0xc148('0x0'));var ChatOfflineMessage=require(_0xc148('0x1'))['db'][_0xc148('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc148('0x3')};function emitEvent(_0x16e00b){return function(_0x44e488,_0x3af8ce,_0xabe01a){ChatOfflineMessageEvents[_0xc148('0x4')](_0x16e00b+':'+_0x44e488['id'],_0x44e488);ChatOfflineMessageEvents['emit'](_0x16e00b,_0x44e488);_0xabe01a(null);};}for(var e in events){if(events[_0xc148('0x5')](e)){var event=events[e];ChatOfflineMessage[_0xc148('0x6')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 080cf34..58fbc1e 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 _0xe2dd=['ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define'];(function(_0x574df2,_0x3ea353){var _0x583bc2=function(_0x582981){while(--_0x582981){_0x574df2['push'](_0x574df2['shift']());}};_0x583bc2(++_0x3ea353);}(_0xe2dd,0x10b));var _0xde2d=function(_0x26a906,_0x3d135c){_0x26a906=_0x26a906-0x0;var _0x495575=_0xe2dd[_0x26a906];return _0x495575;};'use strict';var attributes=require(_0xde2d('0x0'));module[_0xde2d('0x1')]=function(_0x1b4d9e){return _0x1b4d9e[_0xde2d('0x2')](_0xde2d('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xde2d('0x4'),'collate':_0xde2d('0x5')});}; \ No newline at end of file +var _0x94d4=['chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0x55f49c,_0x3d85b1){var _0x29a4f7=function(_0x1fcb14){while(--_0x1fcb14){_0x55f49c['push'](_0x55f49c['shift']());}};_0x29a4f7(++_0x3d85b1);}(_0x94d4,0x104));var _0x494d=function(_0x242ef4,_0x4b3ba8){_0x242ef4=_0x242ef4-0x0;var _0x1c52bb=_0x94d4[_0x242ef4];return _0x1c52bb;};'use strict';var attributes=require(_0x494d('0x0'));module[_0x494d('0x1')]=function(_0xda94ec){return _0xda94ec[_0x494d('0x2')](_0x494d('0x3'),attributes,{'tableName':_0x494d('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x494d('0x5'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 2083018..9dc96c9 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 _0xf0aa=['stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf0aa,0x16e));var _0xaf0a=function(_0x39456d,_0x5ae469){_0x39456d=_0x39456d-0x0;var _0x1d1220=_0xf0aa[_0x39456d];return _0x1d1220;};'use strict';var _=require(_0xaf0a('0x0'));var util=require('util');var moment=require(_0xaf0a('0x1'));var BPromise=require(_0xaf0a('0x2'));var rs=require(_0xaf0a('0x3'));var fs=require('fs');var Redis=require(_0xaf0a('0x4'));var db=require(_0xaf0a('0x5'))['db'];var utils=require(_0xaf0a('0x6'));var logger=require(_0xaf0a('0x7'))(_0xaf0a('0x8'));var config=require(_0xaf0a('0x9'));var jayson=require(_0xaf0a('0xa'));var client=jayson['client'][_0xaf0a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x191bca,_0x26c42e,_0x261b37){return new BPromise(function(_0xf11a48,_0x46707c){return client[_0xaf0a('0xc')](_0x191bca,_0x261b37)[_0xaf0a('0xd')](function(_0x4d19e7){logger[_0xaf0a('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x26c42e,'request\x20sent');logger[_0xaf0a('0xf')](_0xaf0a('0x10'),_0x26c42e,_0xaf0a('0x11'),JSON[_0xaf0a('0x12')](_0x4d19e7));if(_0x4d19e7[_0xaf0a('0x13')]){if(_0x4d19e7[_0xaf0a('0x13')][_0xaf0a('0x14')]===0x1f4){logger['error'](_0xaf0a('0x15'),_0x26c42e,_0x4d19e7[_0xaf0a('0x13')][_0xaf0a('0x16')]);return _0x46707c(_0x4d19e7[_0xaf0a('0x13')][_0xaf0a('0x16')]);}logger['error'](_0xaf0a('0x15'),_0x26c42e,_0x4d19e7[_0xaf0a('0x13')][_0xaf0a('0x16')]);return _0xf11a48(_0x4d19e7['error']['message']);}else{logger[_0xaf0a('0xe')](_0xaf0a('0x15'),_0x26c42e,_0xaf0a('0x11'));_0xf11a48(_0x4d19e7[_0xaf0a('0x17')][_0xaf0a('0x16')]);}})['catch'](function(_0x3a44cf){logger['error'](_0xaf0a('0x15'),_0x26c42e,_0x3a44cf);_0x46707c(_0x3a44cf);});});} \ No newline at end of file +var _0x16b4=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x16b4,0xa9));var _0x416b=function(_0x515bbd,_0x102ffe){_0x515bbd=_0x515bbd-0x0;var _0x472340=_0x16b4[_0x515bbd];return _0x472340;};'use strict';var _=require(_0x416b('0x0'));var util=require(_0x416b('0x1'));var moment=require(_0x416b('0x2'));var BPromise=require(_0x416b('0x3'));var rs=require(_0x416b('0x4'));var fs=require('fs');var Redis=require(_0x416b('0x5'));var db=require(_0x416b('0x6'))['db'];var utils=require(_0x416b('0x7'));var logger=require(_0x416b('0x8'))(_0x416b('0x9'));var config=require(_0x416b('0xa'));var jayson=require(_0x416b('0xb'));var client=jayson[_0x416b('0xc')][_0x416b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2da355,_0x185c7e,_0x458871){return new BPromise(function(_0x40d930,_0x33cdd3){return client[_0x416b('0xe')](_0x2da355,_0x458871)['then'](function(_0x2666a4){logger[_0x416b('0xf')](_0x416b('0x10'),_0x185c7e,_0x416b('0x11'));logger[_0x416b('0x12')](_0x416b('0x13'),_0x185c7e,_0x416b('0x11'),JSON[_0x416b('0x14')](_0x2666a4));if(_0x2666a4[_0x416b('0x15')]){if(_0x2666a4['error'][_0x416b('0x16')]===0x1f4){logger[_0x416b('0x15')](_0x416b('0x10'),_0x185c7e,_0x2666a4[_0x416b('0x15')]['message']);return _0x33cdd3(_0x2666a4[_0x416b('0x15')]['message']);}logger[_0x416b('0x15')](_0x416b('0x10'),_0x185c7e,_0x2666a4[_0x416b('0x15')][_0x416b('0x17')]);return _0x40d930(_0x2666a4[_0x416b('0x15')]['message']);}else{logger['info'](_0x416b('0x10'),_0x185c7e,_0x416b('0x11'));_0x40d930(_0x2666a4[_0x416b('0x18')][_0x416b('0x17')]);}})['catch'](function(_0xa7a3bb){logger[_0x416b('0x15')]('ChatOfflineMessage,\x20%s,\x20%s',_0x185c7e,_0xa7a3bb);_0x33cdd3(_0xa7a3bb);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 7775dcf..e5ce4ea 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 _0x7ba4=['create','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7ba4,0xa5));var _0x47ba=function(_0x499dde,_0x2001f9){_0x499dde=_0x499dde-0x0;var _0x204ec5=_0x7ba4[_0x499dde];return _0x204ec5;};'use strict';var multer=require(_0x47ba('0x0'));var util=require('util');var path=require(_0x47ba('0x1'));var timeout=require(_0x47ba('0x2'));var express=require(_0x47ba('0x3'));var router=express['Router']();var fs_extra=require(_0x47ba('0x4'));var auth=require(_0x47ba('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x47ba('0x6'));var controller=require(_0x47ba('0x7'));router[_0x47ba('0x8')]('/',auth[_0x47ba('0x9')](),controller[_0x47ba('0xa')]);router[_0x47ba('0x8')](_0x47ba('0xb'),auth[_0x47ba('0x9')](),controller[_0x47ba('0xc')]);router[_0x47ba('0x8')](_0x47ba('0xd'),auth[_0x47ba('0x9')](),controller['show']);router[_0x47ba('0xe')]('/',auth['isAuthenticated'](),controller[_0x47ba('0xf')]);router[_0x47ba('0x10')]('/:id',auth[_0x47ba('0x9')](),controller['update']);router[_0x47ba('0x11')]('/:id',auth[_0x47ba('0x9')](),controller[_0x47ba('0x12')]);module[_0x47ba('0x13')]=router; \ No newline at end of file +var _0xfade=['destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0xfade,0x14c));var _0xefad=function(_0x28f5ae,_0x3a0190){_0x28f5ae=_0x28f5ae-0x0;var _0x4acc8b=_0xfade[_0x28f5ae];return _0x4acc8b;};'use strict';var multer=require('multer');var util=require(_0xefad('0x0'));var path=require(_0xefad('0x1'));var timeout=require(_0xefad('0x2'));var express=require('express');var router=express[_0xefad('0x3')]();var fs_extra=require(_0xefad('0x4'));var auth=require(_0xefad('0x5'));var interaction=require(_0xefad('0x6'));var config=require('../../config/environment');var controller=require(_0xefad('0x7'));router['get']('/',auth[_0xefad('0x8')](),controller[_0xefad('0x9')]);router[_0xefad('0xa')](_0xefad('0xb'),auth['isAuthenticated'](),controller[_0xefad('0xc')]);router[_0xefad('0xa')](_0xefad('0xd'),auth[_0xefad('0x8')](),controller[_0xefad('0xe')]);router[_0xefad('0xf')]('/',auth[_0xefad('0x8')](),controller[_0xefad('0x10')]);router[_0xefad('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xefad('0x12')]);router[_0xefad('0x13')](_0xefad('0xd'),auth[_0xefad('0x8')](),controller[_0xefad('0x14')]);module[_0xefad('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index c8f3401..630b0e5 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 _0xb6ff=['sequelize','exports','STRING','mouseOver'];(function(_0x11382b,_0x14449f){var _0x35f1ff=function(_0x15f59a){while(--_0x15f59a){_0x11382b['push'](_0x11382b['shift']());}};_0x35f1ff(++_0x14449f);}(_0xb6ff,0x1cc));var _0xfb6f=function(_0x256e32,_0x4013bc){_0x256e32=_0x256e32-0x0;var _0x464070=_0xb6ff[_0x256e32];return _0x464070;};'use strict';var Sequelize=require(_0xfb6f('0x0'));module[_0xfb6f('0x1')]={'name':{'type':Sequelize[_0xfb6f('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xfb6f('0x3'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xfb6f('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x093e=['mouseOver','timeout','STRING','sequelize','exports','ENUM'];(function(_0x209302,_0x5826ac){var _0x1df8e9=function(_0x16ae49){while(--_0x16ae49){_0x209302['push'](_0x209302['shift']());}};_0x1df8e9(++_0x5826ac);}(_0x093e,0x1ad));var _0xe093=function(_0x23d122,_0x2e3249){_0x23d122=_0x23d122-0x0;var _0x355d6a=_0x093e[_0x23d122];return _0x355d6a;};'use strict';var Sequelize=require(_0xe093('0x0'));module[_0xe093('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe093('0x2')](_0xe093('0x3'),_0xe093('0x4')),'defaultValue':_0xe093('0x3')},'selector':{'type':Sequelize[_0xe093('0x5')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 2fb675c..0421512 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 _0x3c6c=['include','options','ChatProactiveAction','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length'];(function(_0x41c259,_0x56d296){var _0x104492=function(_0x1864f0){while(--_0x1864f0){_0x41c259['push'](_0x41c259['shift']());}};_0x104492(++_0x56d296);}(_0x3c6c,0x7b));var _0xc3c6=function(_0xa1724b,_0x5b29c0){_0xa1724b=_0xa1724b-0x0;var _0x38312b=_0x3c6c[_0xa1724b];return _0x38312b;};'use strict';var emlformat=require(_0xc3c6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc3c6('0x1'));var jsonpatch=require(_0xc3c6('0x2'));var rp=require(_0xc3c6('0x3'));var moment=require(_0xc3c6('0x4'));var BPromise=require(_0xc3c6('0x5'));var Mustache=require(_0xc3c6('0x6'));var util=require(_0xc3c6('0x7'));var path=require(_0xc3c6('0x8'));var sox=require('sox');var csv=require(_0xc3c6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc3c6('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc3c6('0x9'));var querystring=require(_0xc3c6('0xb'));var Papa=require('papaparse');var Redis=require(_0xc3c6('0xc'));var authService=require(_0xc3c6('0xd'));var qs=require(_0xc3c6('0xe'));var as=require(_0xc3c6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc3c6('0x10'))(_0xc3c6('0x11'));var utils=require(_0xc3c6('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc3c6('0x13'))['db'];function respondWithStatusCode(_0x407147,_0x1d18e3){_0x1d18e3=_0x1d18e3||0xcc;return function(_0x648a0){if(_0x648a0){return _0x407147[_0xc3c6('0x14')](_0x1d18e3);}return _0x407147[_0xc3c6('0x15')](_0x1d18e3)[_0xc3c6('0x16')]();};}function respondWithResult(_0x28a431,_0x34eeeb){_0x34eeeb=_0x34eeeb||0xc8;return function(_0x55c1d8){if(_0x55c1d8){return _0x28a431[_0xc3c6('0x15')](_0x34eeeb)[_0xc3c6('0x17')](_0x55c1d8);}};}function respondWithFilteredResult(_0x37a6a8,_0x25d2bd){return function(_0x283506){if(_0x283506){var _0x42c631=typeof _0x25d2bd[_0xc3c6('0x18')]===_0xc3c6('0x19')&&typeof _0x25d2bd[_0xc3c6('0x1a')]===_0xc3c6('0x19');var _0x64c62a=_0x283506[_0xc3c6('0x1b')];var _0x26c9b0=_0x42c631?0x0:_0x25d2bd[_0xc3c6('0x18')];var _0x3003e1=_0x42c631?_0x283506[_0xc3c6('0x1b')]:_0x25d2bd['offset']+_0x25d2bd[_0xc3c6('0x1a')];var _0x5a2456;if(_0x3003e1>=_0x64c62a){_0x3003e1=_0x64c62a;_0x5a2456=0xc8;}else{_0x5a2456=0xce;}_0x37a6a8[_0xc3c6('0x15')](_0x5a2456);return _0x37a6a8[_0xc3c6('0x1c')](_0xc3c6('0x1d'),_0x26c9b0+'-'+_0x3003e1+'/'+_0x64c62a)[_0xc3c6('0x17')](_0x283506);}return null;};}function patchUpdates(_0xfe2f70){return function(_0x3490a2){try{jsonpatch[_0xc3c6('0x1e')](_0x3490a2,_0xfe2f70,!![]);}catch(_0x22aa76){return BPromise[_0xc3c6('0x1f')](_0x22aa76);}return _0x3490a2[_0xc3c6('0x20')]();};}function saveUpdates(_0x2a99a0,_0x392d20){return function(_0x3d03b0){if(_0x3d03b0){return _0x3d03b0[_0xc3c6('0x21')](_0x2a99a0)['then'](function(_0x24fb2d){return _0x24fb2d;});}return null;};}function removeEntity(_0x40893b,_0x2bced6){return function(_0x565a86){if(_0x565a86){return _0x565a86[_0xc3c6('0x22')]()[_0xc3c6('0x23')](function(){_0x40893b[_0xc3c6('0x15')](0xcc)[_0xc3c6('0x16')]();});}};}function handleEntityNotFound(_0x2bc9bf,_0x47808f){return function(_0x1a0e3b){if(!_0x1a0e3b){_0x2bc9bf['sendStatus'](0x194);}return _0x1a0e3b;};}function handleError(_0x104e80,_0x13b909){_0x13b909=_0x13b909||0x1f4;return function(_0x4ca76f){logger[_0xc3c6('0x24')](_0x4ca76f[_0xc3c6('0x25')]);if(_0x4ca76f[_0xc3c6('0x26')]){delete _0x4ca76f[_0xc3c6('0x26')];}_0x104e80[_0xc3c6('0x15')](_0x13b909)[_0xc3c6('0x27')](_0x4ca76f);};}exports[_0xc3c6('0x28')]=function(_0x2e4094,_0x1f1d36){var _0x478a4b={'raw':!![],'where':{'id':_0x2e4094[_0xc3c6('0x29')]['id']}},_0xb047b1={};_0xb047b1[_0xc3c6('0x2a')]=_[_0xc3c6('0x2b')](db['ChatProactiveAction'][_0xc3c6('0x2c')]);_0xb047b1[_0xc3c6('0x2d')]=_[_0xc3c6('0x2b')](_0x2e4094[_0xc3c6('0x2d')]);_0xb047b1[_0xc3c6('0x2e')]=_[_0xc3c6('0x2f')](_0xb047b1['model'],_0xb047b1[_0xc3c6('0x2d')]);_0x478a4b[_0xc3c6('0x30')]=_[_0xc3c6('0x2f')](_0xb047b1[_0xc3c6('0x2a')],qs[_0xc3c6('0x31')](_0x2e4094['query'][_0xc3c6('0x31')]));_0x478a4b[_0xc3c6('0x30')]=_0x478a4b[_0xc3c6('0x30')][_0xc3c6('0x32')]?_0x478a4b[_0xc3c6('0x30')]:_0xb047b1[_0xc3c6('0x2a')];if(_0x2e4094[_0xc3c6('0x2d')]['includeAll']){_0x478a4b[_0xc3c6('0x33')]=[{'all':!![]}];}_0x478a4b=_['merge']({},_0x478a4b,_0x2e4094[_0xc3c6('0x34')]);return db[_0xc3c6('0x35')][_0xc3c6('0x36')](_0x478a4b)[_0xc3c6('0x23')](handleEntityNotFound(_0x1f1d36,null))[_0xc3c6('0x23')](respondWithResult(_0x1f1d36,null))[_0xc3c6('0x37')](handleError(_0x1f1d36,null));};exports['create']=function(_0x36562e,_0x2bba67){return db['ChatProactiveAction'][_0xc3c6('0x38')](_0x36562e[_0xc3c6('0x39')],{})[_0xc3c6('0x23')](respondWithResult(_0x2bba67,0xc9))[_0xc3c6('0x37')](handleError(_0x2bba67,null));};exports[_0xc3c6('0x21')]=function(_0x377a2f,_0x21163c){if(_0x377a2f['body']['id']){delete _0x377a2f['body']['id'];}return db[_0xc3c6('0x35')][_0xc3c6('0x36')]({'where':{'id':_0x377a2f[_0xc3c6('0x29')]['id']}})[_0xc3c6('0x23')](handleEntityNotFound(_0x21163c,null))[_0xc3c6('0x23')](saveUpdates(_0x377a2f['body'],null))[_0xc3c6('0x23')](respondWithResult(_0x21163c,null))[_0xc3c6('0x37')](handleError(_0x21163c,null));};exports[_0xc3c6('0x22')]=function(_0x4aae1e,_0x1eb423){return db[_0xc3c6('0x35')][_0xc3c6('0x36')]({'where':{'id':_0x4aae1e[_0xc3c6('0x29')]['id']}})[_0xc3c6('0x23')](handleEntityNotFound(_0x1eb423,null))['then'](removeEntity(_0x1eb423,null))[_0xc3c6('0x37')](handleError(_0x1eb423,null));}; \ No newline at end of file +var _0x7579=['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','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','name','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto'];(function(_0x2bbc07,_0x1e2168){var _0x6879e4=function(_0x290fa1){while(--_0x290fa1){_0x2bbc07['push'](_0x2bbc07['shift']());}};_0x6879e4(++_0x1e2168);}(_0x7579,0x1e2));var _0x9757=function(_0x35a6b3,_0x5c9114){_0x35a6b3=_0x35a6b3-0x0;var _0x1d95bb=_0x7579[_0x35a6b3];return _0x1d95bb;};'use strict';var emlformat=require(_0x9757('0x0'));var rimraf=require(_0x9757('0x1'));var zipdir=require(_0x9757('0x2'));var jsonpatch=require(_0x9757('0x3'));var rp=require(_0x9757('0x4'));var moment=require(_0x9757('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9757('0x6'));var util=require(_0x9757('0x7'));var path=require(_0x9757('0x8'));var sox=require(_0x9757('0x9'));var csv=require('to-csv');var ejs=require(_0x9757('0xa'));var fs=require('fs');var fs_extra=require(_0x9757('0xb'));var _=require(_0x9757('0xc'));var squel=require('squel');var crypto=require(_0x9757('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9757('0xe'));var toCsv=require(_0x9757('0xf'));var querystring=require(_0x9757('0x10'));var Papa=require('papaparse');var Redis=require(_0x9757('0x11'));var authService=require(_0x9757('0x12'));var qs=require(_0x9757('0x13'));var as=require(_0x9757('0x14'));var hardwareService=require(_0x9757('0x15'));var logger=require(_0x9757('0x16'))(_0x9757('0x17'));var utils=require(_0x9757('0x18'));var config=require(_0x9757('0x19'));var licenseUtil=require(_0x9757('0x1a'));var db=require(_0x9757('0x1b'))['db'];function respondWithStatusCode(_0x5c19c9,_0x2f2200){_0x2f2200=_0x2f2200||0xcc;return function(_0x1d32ee){if(_0x1d32ee){return _0x5c19c9[_0x9757('0x1c')](_0x2f2200);}return _0x5c19c9['status'](_0x2f2200)[_0x9757('0x1d')]();};}function respondWithResult(_0x39fa5c,_0x413d55){_0x413d55=_0x413d55||0xc8;return function(_0x14f67c){if(_0x14f67c){return _0x39fa5c[_0x9757('0x1e')](_0x413d55)[_0x9757('0x1f')](_0x14f67c);}};}function respondWithFilteredResult(_0x105e56,_0x4b994d){return function(_0x1fd6f6){if(_0x1fd6f6){var _0x55ded7=typeof _0x4b994d[_0x9757('0x20')]===_0x9757('0x21')&&typeof _0x4b994d[_0x9757('0x22')]===_0x9757('0x21');var _0x3f6be9=_0x1fd6f6[_0x9757('0x23')];var _0x57e309=_0x55ded7?0x0:_0x4b994d[_0x9757('0x20')];var _0x2aa360=_0x55ded7?_0x1fd6f6[_0x9757('0x23')]:_0x4b994d[_0x9757('0x20')]+_0x4b994d[_0x9757('0x22')];var _0xd2306b;if(_0x2aa360>=_0x3f6be9){_0x2aa360=_0x3f6be9;_0xd2306b=0xc8;}else{_0xd2306b=0xce;}_0x105e56[_0x9757('0x1e')](_0xd2306b);return _0x105e56['set'](_0x9757('0x24'),_0x57e309+'-'+_0x2aa360+'/'+_0x3f6be9)['json'](_0x1fd6f6);}return null;};}function patchUpdates(_0x517504){return function(_0x37c889){try{jsonpatch[_0x9757('0x25')](_0x37c889,_0x517504,!![]);}catch(_0x1443a9){return BPromise[_0x9757('0x26')](_0x1443a9);}return _0x37c889['save']();};}function saveUpdates(_0x4ef000,_0x53d21c){return function(_0x73dac4){if(_0x73dac4){return _0x73dac4[_0x9757('0x27')](_0x4ef000)[_0x9757('0x28')](function(_0x21435e){return _0x21435e;});}return null;};}function removeEntity(_0x5dc2fa,_0x11f5ac){return function(_0x160108){if(_0x160108){return _0x160108['destroy']()[_0x9757('0x28')](function(){_0x5dc2fa[_0x9757('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b6915,_0x1a7036){return function(_0x172e8c){if(!_0x172e8c){_0x2b6915[_0x9757('0x1c')](0x194);}return _0x172e8c;};}function handleError(_0x115e33,_0x19588f){_0x19588f=_0x19588f||0x1f4;return function(_0x4e6b86){logger[_0x9757('0x29')](_0x4e6b86['stack']);if(_0x4e6b86[_0x9757('0x2a')]){delete _0x4e6b86[_0x9757('0x2a')];}_0x115e33['status'](_0x19588f)['send'](_0x4e6b86);};}exports[_0x9757('0x2b')]=function(_0x21a4bd,_0xc81976){var _0x3aae8b={'raw':!![],'where':{'id':_0x21a4bd[_0x9757('0x2c')]['id']}},_0x4ebdb6={};_0x4ebdb6[_0x9757('0x2d')]=_[_0x9757('0x2e')](db[_0x9757('0x2f')][_0x9757('0x30')]);_0x4ebdb6[_0x9757('0x31')]=_['keys'](_0x21a4bd[_0x9757('0x31')]);_0x4ebdb6[_0x9757('0x32')]=_[_0x9757('0x33')](_0x4ebdb6[_0x9757('0x2d')],_0x4ebdb6[_0x9757('0x31')]);_0x3aae8b[_0x9757('0x34')]=_[_0x9757('0x33')](_0x4ebdb6['model'],qs[_0x9757('0x35')](_0x21a4bd[_0x9757('0x31')][_0x9757('0x35')]));_0x3aae8b[_0x9757('0x34')]=_0x3aae8b[_0x9757('0x34')][_0x9757('0x36')]?_0x3aae8b[_0x9757('0x34')]:_0x4ebdb6[_0x9757('0x2d')];if(_0x21a4bd['query'][_0x9757('0x37')]){_0x3aae8b['include']=[{'all':!![]}];}_0x3aae8b=_[_0x9757('0x38')]({},_0x3aae8b,_0x21a4bd[_0x9757('0x39')]);return db['ChatProactiveAction'][_0x9757('0x3a')](_0x3aae8b)[_0x9757('0x28')](handleEntityNotFound(_0xc81976,null))[_0x9757('0x28')](respondWithResult(_0xc81976,null))[_0x9757('0x3b')](handleError(_0xc81976,null));};exports[_0x9757('0x3c')]=function(_0x2f2688,_0x3c94b2){return db[_0x9757('0x2f')][_0x9757('0x3c')](_0x2f2688[_0x9757('0x3d')],{})['then'](respondWithResult(_0x3c94b2,0xc9))[_0x9757('0x3b')](handleError(_0x3c94b2,null));};exports[_0x9757('0x27')]=function(_0x457d6c,_0x4f2ea4){if(_0x457d6c[_0x9757('0x3d')]['id']){delete _0x457d6c[_0x9757('0x3d')]['id'];}return db[_0x9757('0x2f')][_0x9757('0x3a')]({'where':{'id':_0x457d6c[_0x9757('0x2c')]['id']}})[_0x9757('0x28')](handleEntityNotFound(_0x4f2ea4,null))[_0x9757('0x28')](saveUpdates(_0x457d6c[_0x9757('0x3d')],null))[_0x9757('0x28')](respondWithResult(_0x4f2ea4,null))['catch'](handleError(_0x4f2ea4,null));};exports['destroy']=function(_0x2cf830,_0x2d0a6e){return db[_0x9757('0x2f')][_0x9757('0x3a')]({'where':{'id':_0x2cf830['params']['id']}})[_0x9757('0x28')](handleEntityNotFound(_0x2d0a6e,null))['then'](removeEntity(_0x2d0a6e,null))[_0x9757('0x3b')](handleError(_0x2d0a6e,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 5c1c8d4..ba9edea 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 _0xdb10=['exports','define','ChatProactiveAction','chat_proactive_actions','../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0x2138e8,_0x320078){var _0x183ed3=function(_0x1ef41d){while(--_0x1ef41d){_0x2138e8['push'](_0x2138e8['shift']());}};_0x183ed3(++_0x320078);}(_0xdb10,0x19e));var _0x0db1=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xdb10[_0x1caf6a];return _0x1bf493;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0db1('0x0'))('api');var moment=require(_0x0db1('0x1'));var BPromise=require('bluebird');var rp=require(_0x0db1('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0db1('0x3'));var config=require(_0x0db1('0x4'));var attributes=require(_0x0db1('0x5'));module[_0x0db1('0x6')]=function(_0x252dc9,_0x281789){return _0x252dc9[_0x0db1('0x7')](_0x0db1('0x8'),attributes,{'tableName':_0x0db1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34f3=['chat_proactive_actions','lodash','api','bluebird','request-promise','path','../../config/environment','exports','define','ChatProactiveAction'];(function(_0x407ecd,_0x3b833a){var _0xf9bbbf=function(_0x215021){while(--_0x215021){_0x407ecd['push'](_0x407ecd['shift']());}};_0xf9bbbf(++_0x3b833a);}(_0x34f3,0x169));var _0x334f=function(_0x3e25ff,_0x42309d){_0x3e25ff=_0x3e25ff-0x0;var _0x397545=_0x34f3[_0x3e25ff];return _0x397545;};'use strict';var _=require(_0x334f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x334f('0x1'));var moment=require('moment');var BPromise=require(_0x334f('0x2'));var rp=require(_0x334f('0x3'));var fs=require('fs');var path=require(_0x334f('0x4'));var rimraf=require('rimraf');var config=require(_0x334f('0x5'));var attributes=require('./chatProactiveAction.attributes');module[_0x334f('0x6')]=function(_0x3c89f9,_0x17fe03){return _0x3c89f9[_0x334f('0x7')](_0x334f('0x8'),attributes,{'tableName':_0x334f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 65c2799..f915857 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 _0x018e=['request\x20sent','debug','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0xe54585,_0x9db18c){var _0x584d94=function(_0x380e0d){while(--_0x380e0d){_0xe54585['push'](_0xe54585['shift']());}};_0x584d94(++_0x9db18c);}(_0x018e,0x1a8));var _0xe018=function(_0x3b085,_0x250543){_0x3b085=_0x3b085-0x0;var _0x476a57=_0x018e[_0x3b085];return _0x476a57;};'use strict';var _=require(_0xe018('0x0'));var util=require(_0xe018('0x1'));var moment=require(_0xe018('0x2'));var BPromise=require(_0xe018('0x3'));var rs=require(_0xe018('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe018('0x5'))['db'];var utils=require(_0xe018('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe018('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe018('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dbbfb,_0x14c4d7,_0x167615){return new BPromise(function(_0x5b44eb,_0x26f394){return client[_0xe018('0x9')](_0x3dbbfb,_0x167615)[_0xe018('0xa')](function(_0x60db92){logger[_0xe018('0xb')](_0xe018('0xc'),_0x14c4d7,_0xe018('0xd'));logger[_0xe018('0xe')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x14c4d7,_0xe018('0xd'),JSON['stringify'](_0x60db92));if(_0x60db92['error']){if(_0x60db92[_0xe018('0xf')]['code']===0x1f4){logger[_0xe018('0xf')](_0xe018('0xc'),_0x14c4d7,_0x60db92[_0xe018('0xf')][_0xe018('0x10')]);return _0x26f394(_0x60db92[_0xe018('0xf')][_0xe018('0x10')]);}logger[_0xe018('0xf')](_0xe018('0xc'),_0x14c4d7,_0x60db92[_0xe018('0xf')]['message']);return _0x5b44eb(_0x60db92[_0xe018('0xf')][_0xe018('0x10')]);}else{logger[_0xe018('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x14c4d7,_0xe018('0xd'));_0x5b44eb(_0x60db92[_0xe018('0x11')][_0xe018('0x10')]);}})[_0xe018('0x12')](function(_0x5940ce){logger[_0xe018('0xf')](_0xe018('0xc'),_0x14c4d7,_0x5940ce);_0x26f394(_0x5940ce);});});} \ No newline at end of file +var _0x00cf=['client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x16b396,_0x5dea08){var _0xff7f77=function(_0x3c9682){while(--_0x3c9682){_0x16b396['push'](_0x16b396['shift']());}};_0xff7f77(++_0x5dea08);}(_0x00cf,0xd3));var _0xf00c=function(_0x4e7307,_0x359bb4){_0x4e7307=_0x4e7307-0x0;var _0x44b9d7=_0x00cf[_0x4e7307];return _0x44b9d7;};'use strict';var _=require(_0xf00c('0x0'));var util=require(_0xf00c('0x1'));var moment=require(_0xf00c('0x2'));var BPromise=require(_0xf00c('0x3'));var rs=require(_0xf00c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf00c('0x5'));var logger=require(_0xf00c('0x6'))(_0xf00c('0x7'));var config=require('../../config/environment');var jayson=require(_0xf00c('0x8'));var client=jayson[_0xf00c('0x9')][_0xf00c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xce9b20,_0x3614f6,_0x50d9c8){return new BPromise(function(_0x279df2,_0x13c073){return client['request'](_0xce9b20,_0x50d9c8)[_0xf00c('0xb')](function(_0x1d3278){logger[_0xf00c('0xc')](_0xf00c('0xd'),_0x3614f6,_0xf00c('0xe'));logger[_0xf00c('0xf')](_0xf00c('0x10'),_0x3614f6,_0xf00c('0xe'),JSON['stringify'](_0x1d3278));if(_0x1d3278[_0xf00c('0x11')]){if(_0x1d3278[_0xf00c('0x11')][_0xf00c('0x12')]===0x1f4){logger['error'](_0xf00c('0xd'),_0x3614f6,_0x1d3278['error'][_0xf00c('0x13')]);return _0x13c073(_0x1d3278[_0xf00c('0x11')][_0xf00c('0x13')]);}logger[_0xf00c('0x11')](_0xf00c('0xd'),_0x3614f6,_0x1d3278['error'][_0xf00c('0x13')]);return _0x279df2(_0x1d3278[_0xf00c('0x11')][_0xf00c('0x13')]);}else{logger[_0xf00c('0xc')](_0xf00c('0xd'),_0x3614f6,_0xf00c('0xe'));_0x279df2(_0x1d3278[_0xf00c('0x14')][_0xf00c('0x13')]);}})[_0xf00c('0x15')](function(_0x3372b0){logger[_0xf00c('0x11')](_0xf00c('0xd'),_0x3614f6,_0x3372b0);_0x13c073(_0x3372b0);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 8fad625..9582649 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 _0x2675=['../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','delete','exports','multer','express','Router'];(function(_0x5783e1,_0x3bcf25){var _0x3fafdf=function(_0x33a993){while(--_0x33a993){_0x5783e1['push'](_0x5783e1['shift']());}};_0x3fafdf(++_0x3bcf25);}(_0x2675,0x75));var _0x5267=function(_0x368491,_0x1adb5c){_0x368491=_0x368491-0x0;var _0x2b14e2=_0x2675[_0x368491];return _0x2b14e2;};'use strict';var multer=require(_0x5267('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5267('0x1'));var router=express[_0x5267('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5267('0x3'));var interaction=require(_0x5267('0x4'));var config=require('../../config/environment');var controller=require(_0x5267('0x5'));router[_0x5267('0x6')](_0x5267('0x7'),auth[_0x5267('0x8')](),controller[_0x5267('0x9')]);router[_0x5267('0xa')]('/',auth['isAuthenticated'](),controller[_0x5267('0xb')]);router[_0x5267('0xc')]('/:id',auth[_0x5267('0x8')](),controller['update']);router[_0x5267('0xd')](_0x5267('0x7'),auth[_0x5267('0x8')](),controller['destroy']);module[_0x5267('0xe')]=router; \ No newline at end of file +var _0xeda8=['get','/:id','isAuthenticated','show','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x1531d5,_0x1cfc23){var _0x124680=function(_0xc27d57){while(--_0xc27d57){_0x1531d5['push'](_0x1531d5['shift']());}};_0x124680(++_0x1cfc23);}(_0xeda8,0x104));var _0x8eda=function(_0x49dc19,_0x50f73f){_0x49dc19=_0x49dc19-0x0;var _0x4f05de=_0xeda8[_0x49dc19];return _0x4f05de;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var fs_extra=require(_0x8eda('0x5'));var auth=require(_0x8eda('0x6'));var interaction=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var controller=require(_0x8eda('0x9'));router[_0x8eda('0xa')](_0x8eda('0xb'),auth[_0x8eda('0xc')](),controller[_0x8eda('0xd')]);router['post']('/',auth[_0x8eda('0xc')](),controller[_0x8eda('0xe')]);router[_0x8eda('0xf')](_0x8eda('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x8eda('0xc')](),controller[_0x8eda('0x10')]);module[_0x8eda('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 777f3ae..29becbb 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 _0x6099=['ENUM','roundrobin','exports','STRING'];(function(_0x2ab124,_0x3f90a5){var _0x3da393=function(_0x590678){while(--_0x590678){_0x2ab124['push'](_0x2ab124['shift']());}};_0x3da393(++_0x3f90a5);}(_0x6099,0x14e));var _0x9609=function(_0xd8eef3,_0x434e2e){_0xd8eef3=_0xd8eef3-0x0;var _0x20e59a=_0x6099[_0xd8eef3];return _0x20e59a;};'use strict';var Sequelize=require('sequelize');module[_0x9609('0x0')]={'name':{'type':Sequelize[_0x9609('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9609('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9609('0x2')]('rrmemory','beepall',_0x9609('0x3'))}}; \ No newline at end of file +var _0x5234=['beepall','sequelize','STRING','name','ENUM','rrmemory'];(function(_0x22dfb9,_0x2e231c){var _0x51cbb1=function(_0x7dac5a){while(--_0x7dac5a){_0x22dfb9['push'](_0x22dfb9['shift']());}};_0x51cbb1(++_0x2e231c);}(_0x5234,0x1cf));var _0x4523=function(_0x3ffe8a,_0x57de78){_0x3ffe8a=_0x3ffe8a-0x0;var _0x3ae039=_0x5234[_0x3ffe8a];return _0x3ae039;};'use strict';var Sequelize=require(_0x4523('0x0'));module['exports']={'name':{'type':Sequelize[_0x4523('0x1')],'unique':_0x4523('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4523('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4523('0x3')](_0x4523('0x4'),_0x4523('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 5c5775b..8691b40 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 _0xcef8=['ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','all','transaction','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','sendStatus','status','end','json','offset','undefined','limit','Content-Range','update','get','UserProfileResource','then','error','name','send','index','map','ChatQueue','rawAttributes','fieldName','getOptions','where','count','include','query','findAll','rows','show','keys','filters','model','intersection','fields','length','includeAll','merge','options','find','catch','create','body','user','role','ChatQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','describe','getMembers','findOne','UserChatQueue','attributes','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','filter','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','sequelize','each','forEach','emit','userChatQueue:save','select','field','tq.TeamId','from','team_has_chat_queues','join'];(function(_0x149bdf,_0x4eeb79){var _0x2d55a3=function(_0x39bdd5){while(--_0x39bdd5){_0x149bdf['push'](_0x149bdf['shift']());}};_0x2d55a3(++_0x4eeb79);}(_0xcef8,0x101));var _0x8cef=function(_0x453e2a,_0x32febf){_0x453e2a=_0x453e2a-0x0;var _0x51c753=_0xcef8[_0x453e2a];return _0x51c753;};'use strict';var BPromise=require('bluebird');var util=require(_0x8cef('0x0'));var _=require(_0x8cef('0x1'));var squel=require(_0x8cef('0x2'));var Redis=require(_0x8cef('0x3'));var qs=require(_0x8cef('0x4'));var logger=require(_0x8cef('0x5'))('api');var config=require(_0x8cef('0x6'));var db=require(_0x8cef('0x7'))['db'];config[_0x8cef('0x8')]=_[_0x8cef('0x9')](config['redis'],{'host':_0x8cef('0xa'),'port':0x18eb});var socket=require(_0x8cef('0xb'))(new Redis(config[_0x8cef('0x8')]));require(_0x8cef('0xc'))['register'](socket);function respondWithStatusCode(_0x1e304b,_0x4d8b1b){_0x4d8b1b=_0x4d8b1b||0xcc;return function(_0x5e8db5){if(_0x5e8db5){return _0x1e304b[_0x8cef('0xd')](_0x4d8b1b);}return _0x1e304b[_0x8cef('0xe')](_0x4d8b1b)[_0x8cef('0xf')]();};}function respondWithResult(_0xd16a88,_0x25d9b0){_0x25d9b0=_0x25d9b0||0xc8;return function(_0x57149b){if(_0x57149b){return _0xd16a88[_0x8cef('0xe')](_0x25d9b0)[_0x8cef('0x10')](_0x57149b);}};}function respondWithFilteredResult(_0x42e387,_0x26f1fa){return function(_0x4dc166){if(_0x4dc166){var _0x319d49=typeof _0x26f1fa[_0x8cef('0x11')]===_0x8cef('0x12')&&typeof _0x26f1fa[_0x8cef('0x13')]===_0x8cef('0x12');var _0x535b02=_0x4dc166['count'];var _0x57b399=_0x319d49?0x0:_0x26f1fa['offset'];var _0x524917=_0x319d49?_0x4dc166['count']:_0x26f1fa[_0x8cef('0x11')]+_0x26f1fa[_0x8cef('0x13')];var _0x360922;if(_0x524917>=_0x535b02){_0x524917=_0x535b02;_0x360922=0xc8;}else{_0x360922=0xce;}_0x42e387[_0x8cef('0xe')](_0x360922);return _0x42e387['set'](_0x8cef('0x14'),_0x57b399+'-'+_0x524917+'/'+_0x535b02)[_0x8cef('0x10')](_0x4dc166);}return null;};}function saveUpdates(_0x15f88f){return function(_0x21eea7){if(_0x21eea7){return _0x21eea7[_0x8cef('0x15')](_0x15f88f)['then'](function(_0x430b88){return _0x430b88;});}return null;};}function removeEntity(_0x1af9ca){return function(_0x3c3782){if(_0x3c3782){return _0x3c3782['destroy']()['then'](function(){var _0x151262=_0x3c3782[_0x8cef('0x16')]({'plain':!![]});var _0x20fe39='ChatQueues';return db[_0x8cef('0x17')]['destroy']({'where':{'type':_0x20fe39,'resourceId':_0x151262['id']}})['then'](function(){return _0x3c3782;});})[_0x8cef('0x18')](function(){_0x1af9ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc9b2a9){return function(_0x14f185){if(!_0x14f185){_0xc9b2a9[_0x8cef('0xd')](0x194);}return _0x14f185;};}function handleError(_0x18599c,_0x4c6776){_0x4c6776=_0x4c6776||0x1f4;return function(_0x19e318){logger[_0x8cef('0x19')](_0x19e318['stack']);if(_0x19e318['name']){delete _0x19e318[_0x8cef('0x1a')];}_0x18599c[_0x8cef('0xe')](_0x4c6776)[_0x8cef('0x1b')](_0x19e318);};}exports[_0x8cef('0x1c')]=function(_0x4885a6,_0xa9ce1e){var _0x181a26={};var _0x21162d={'count':0x0,'rows':[]};var _0x82e208=_[_0x8cef('0x1d')](db[_0x8cef('0x1e')][_0x8cef('0x1f')],function(_0x1690e7){return{'name':_0x1690e7[_0x8cef('0x20')],'type':_0x1690e7['type']['key']};});_0x181a26=qs[_0x8cef('0x21')](_0x82e208,_0x4885a6);var _0x3d3f7c={'where':_0x181a26[_0x8cef('0x22')]};return db[_0x8cef('0x1e')][_0x8cef('0x23')](_0x3d3f7c)[_0x8cef('0x18')](function(_0x1564a3){_0x21162d['count']=_0x1564a3;_0x181a26[_0x8cef('0x24')]=qs[_0x8cef('0x24')](_0x4885a6[_0x8cef('0x25')]);return db['ChatQueue'][_0x8cef('0x26')](_0x181a26);})[_0x8cef('0x18')](function(_0x202409){_0x21162d[_0x8cef('0x27')]=_0x202409;return _0x21162d;})[_0x8cef('0x18')](respondWithFilteredResult(_0xa9ce1e,_0x181a26))['catch'](handleError(_0xa9ce1e,null));};exports[_0x8cef('0x28')]=function(_0x22c271,_0x4fa9a9){var _0x5955f0={'raw':!![],'where':{'id':_0x22c271['params']['id']}},_0x192b6c={};_0x192b6c['model']=_['keys'](db['ChatQueue'][_0x8cef('0x1f')]);_0x192b6c['query']=_[_0x8cef('0x29')](_0x22c271[_0x8cef('0x25')]);_0x192b6c[_0x8cef('0x2a')]=_['intersection'](_0x192b6c[_0x8cef('0x2b')],_0x192b6c[_0x8cef('0x25')]);_0x5955f0['attributes']=_[_0x8cef('0x2c')](_0x192b6c[_0x8cef('0x2b')],qs[_0x8cef('0x2d')](_0x22c271[_0x8cef('0x25')][_0x8cef('0x2d')]));_0x5955f0['attributes']=_0x5955f0['attributes'][_0x8cef('0x2e')]?_0x5955f0['attributes']:_0x192b6c[_0x8cef('0x2b')];if(_0x22c271[_0x8cef('0x25')][_0x8cef('0x2f')]){_0x5955f0[_0x8cef('0x24')]=[{'all':!![]}];}_0x5955f0=_[_0x8cef('0x30')]({},_0x5955f0,_0x22c271[_0x8cef('0x31')]);return db[_0x8cef('0x1e')][_0x8cef('0x32')](_0x5955f0)[_0x8cef('0x18')](handleEntityNotFound(_0x4fa9a9,null))[_0x8cef('0x18')](respondWithResult(_0x4fa9a9,null))[_0x8cef('0x33')](handleError(_0x4fa9a9,null));};exports['create']=function(_0x11b327,_0x196e12){return db['ChatQueue'][_0x8cef('0x34')](_0x11b327[_0x8cef('0x35')],{})[_0x8cef('0x18')](function(_0x196aaa){var _0x2ef19d=_0x11b327[_0x8cef('0x36')][_0x8cef('0x16')]({'plain':!![]});if(!_0x2ef19d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ef19d[_0x8cef('0x37')]===_0x8cef('0x36')){var _0x1fbebc=_0x196aaa['get']({'plain':!![]});var _0x2463a7=_0x8cef('0x38');return db[_0x8cef('0x39')]['find']({'where':{'name':_0x2463a7,'userProfileId':_0x2ef19d[_0x8cef('0x3a')]},'raw':!![]})[_0x8cef('0x18')](function(_0x25cf7f){if(_0x25cf7f&&_0x25cf7f['autoAssociation']===0x0){return db[_0x8cef('0x17')][_0x8cef('0x34')]({'name':_0x1fbebc[_0x8cef('0x1a')],'resourceId':_0x1fbebc['id'],'type':_0x25cf7f[_0x8cef('0x1a')],'sectionId':_0x25cf7f['id']},{})['then'](function(){return _0x196aaa;});}else{return _0x196aaa;}})[_0x8cef('0x33')](function(_0x161228){logger['error'](_0x8cef('0x3b'),_0x161228);throw _0x161228;});}return _0x196aaa;})[_0x8cef('0x18')](respondWithResult(_0x196e12,0xc9))[_0x8cef('0x33')](handleError(_0x196e12,null));};exports[_0x8cef('0x15')]=function(_0x303ea9,_0x11f776){if(_0x303ea9[_0x8cef('0x35')]['id']){delete _0x303ea9[_0x8cef('0x35')]['id'];}return db[_0x8cef('0x1e')]['find']({'where':{'id':_0x303ea9[_0x8cef('0x3c')]['id']}})[_0x8cef('0x18')](handleEntityNotFound(_0x11f776,null))[_0x8cef('0x18')](saveUpdates(_0x303ea9['body'],null))[_0x8cef('0x18')](respondWithResult(_0x11f776,null))[_0x8cef('0x33')](handleError(_0x11f776,null));};exports[_0x8cef('0x3d')]=function(_0x57bcb3,_0x12a933){return db[_0x8cef('0x1e')][_0x8cef('0x32')]({'where':{'id':_0x57bcb3['params']['id']}})['then'](handleEntityNotFound(_0x12a933,null))[_0x8cef('0x18')](removeEntity(_0x12a933,null))['catch'](handleError(_0x12a933,null));};exports['describe']=function(_0x4cd7ec,_0x48c45d){return db[_0x8cef('0x1e')][_0x8cef('0x3e')]()[_0x8cef('0x18')](respondWithResult(_0x48c45d,null))[_0x8cef('0x33')](handleError(_0x48c45d,null));};exports[_0x8cef('0x3f')]=function(_0x32fb38,_0x304ce2){var _0x7dad96={'raw':!![],'where':{}},_0x26ba49={},_0x17d10f;return db[_0x8cef('0x1e')][_0x8cef('0x40')]({'where':{'id':_0x32fb38[_0x8cef('0x3c')]['id']}})[_0x8cef('0x18')](handleEntityNotFound(_0x304ce2,null))[_0x8cef('0x18')](function(_0x2acf3d){if(_0x2acf3d){_0x17d10f=_0x2acf3d[_0x8cef('0x16')]({'plain':!![]});_0x26ba49[_0x8cef('0x2b')]=_[_0x8cef('0x29')](db[_0x8cef('0x41')][_0x8cef('0x1f')]);_0x26ba49['query']=_['keys'](_0x32fb38[_0x8cef('0x25')]);_0x26ba49['filters']=_[_0x8cef('0x2c')](_0x26ba49[_0x8cef('0x2b')],_0x26ba49[_0x8cef('0x25')]);_0x7dad96[_0x8cef('0x42')]=_['intersection'](_0x26ba49['model'],qs[_0x8cef('0x2d')](_0x32fb38[_0x8cef('0x25')][_0x8cef('0x2d')]));_0x7dad96['attributes']=_0x7dad96[_0x8cef('0x42')]['length']?_0x7dad96[_0x8cef('0x42')]:_0x26ba49[_0x8cef('0x2b')];if(!_0x32fb38[_0x8cef('0x25')][_0x8cef('0x43')](_0x8cef('0x44'))){_0x7dad96[_0x8cef('0x13')]=qs[_0x8cef('0x13')](_0x32fb38['query']['limit']);_0x7dad96['offset']=qs[_0x8cef('0x11')](_0x32fb38[_0x8cef('0x25')][_0x8cef('0x11')]);}_0x7dad96[_0x8cef('0x45')]=qs['sort'](_0x32fb38['query'][_0x8cef('0x46')]);_0x7dad96[_0x8cef('0x22')]=qs[_0x8cef('0x2a')](_[_0x8cef('0x47')](_0x32fb38[_0x8cef('0x25')],_0x26ba49[_0x8cef('0x2a')]));_0x7dad96['where'][_0x8cef('0x48')]=_0x2acf3d['id'];if(_0x32fb38[_0x8cef('0x25')][_0x8cef('0x49')]){_0x7dad96[_0x8cef('0x22')]=_[_0x8cef('0x30')](_0x7dad96[_0x8cef('0x22')],{'$or':_[_0x8cef('0x1d')](_0x7dad96[_0x8cef('0x42')],function(_0x311a21){var _0x3b6ae2={};_0x3b6ae2[_0x311a21]={'$like':'%'+_0x32fb38['query'][_0x8cef('0x49')]+'%'};return _0x3b6ae2;})});}_0x7dad96=_[_0x8cef('0x30')]({},_0x7dad96,_0x32fb38[_0x8cef('0x31')]);return db['UserChatQueue'][_0x8cef('0x26')](_0x7dad96);}})[_0x8cef('0x18')](function(_0x69580d){if(_0x69580d){return db[_0x8cef('0x4a')][_0x8cef('0x4b')]({'where':{'id':_[_0x8cef('0x1d')](_0x69580d,_0x8cef('0x4c')),'role':_0x8cef('0x4d')},'attributes':['id',_0x8cef('0x1a'),_0x8cef('0x4e'),_0x8cef('0x4f'),_0x8cef('0x50')]});}})[_0x8cef('0x18')](function(_0x4ed40c){if(_0x4ed40c){return{'count':_0x4ed40c[_0x8cef('0x23')],'rows':_['map'](_0x4ed40c[_0x8cef('0x27')],function(_0x49455f){return{'membername':_0x49455f[_0x8cef('0x1a')],'UserId':_0x49455f['id'],'queue_name':_0x17d10f[_0x8cef('0x1a')],'ChatQueueId':_0x17d10f['id'],'interface':util[_0x8cef('0x51')](_0x8cef('0x52'),_0x8cef('0x53'),_0x49455f[_0x8cef('0x1a')]),'penalty':0x0,'paused':_0x49455f[_0x8cef('0x4e')],'createdAt':_0x49455f[_0x8cef('0x50')],'updatedAt':_0x49455f[_0x8cef('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x304ce2,_0x7dad96))[_0x8cef('0x33')](handleError(_0x304ce2,null));};exports['getTeams']=function(_0x3a3f71,_0x519875){var _0x142060={};var _0x2e6f01={};var _0x35f660;var _0x24423f;return db[_0x8cef('0x1e')]['findOne']({'where':{'id':_0x3a3f71['params']['id']}})[_0x8cef('0x18')](handleEntityNotFound(_0x519875,null))[_0x8cef('0x18')](function(_0x35f043){if(_0x35f043){_0x35f660=_0x35f043;_0x2e6f01['model']=_[_0x8cef('0x29')](db['Team'][_0x8cef('0x1f')]);_0x2e6f01[_0x8cef('0x25')]=_['keys'](_0x3a3f71[_0x8cef('0x25')]);_0x2e6f01['filters']=_[_0x8cef('0x2c')](_0x2e6f01[_0x8cef('0x2b')],_0x2e6f01[_0x8cef('0x25')]);_0x142060[_0x8cef('0x42')]=_[_0x8cef('0x2c')](_0x2e6f01[_0x8cef('0x2b')],qs[_0x8cef('0x2d')](_0x3a3f71[_0x8cef('0x25')]['fields']));_0x142060['attributes']=_0x142060[_0x8cef('0x42')]['length']?_0x142060[_0x8cef('0x42')]:_0x2e6f01['model'];_0x142060[_0x8cef('0x45')]=qs[_0x8cef('0x46')](_0x3a3f71[_0x8cef('0x25')][_0x8cef('0x46')]);_0x142060[_0x8cef('0x22')]=qs[_0x8cef('0x2a')](_[_0x8cef('0x47')](_0x3a3f71[_0x8cef('0x25')],_0x2e6f01[_0x8cef('0x2a')]));if(_0x3a3f71[_0x8cef('0x25')][_0x8cef('0x49')]){_0x142060[_0x8cef('0x22')]=_['merge'](_0x142060[_0x8cef('0x22')],{'$or':_['map'](_0x142060[_0x8cef('0x42')],function(_0x9a2d51){var _0x1bbd86={};_0x1bbd86[_0x9a2d51]={'$like':'%'+_0x3a3f71['query'][_0x8cef('0x49')]+'%'};return _0x1bbd86;})});}_0x142060=_[_0x8cef('0x30')]({},_0x142060,_0x3a3f71['options']);return _0x35f660[_0x8cef('0x54')](_0x142060);}})[_0x8cef('0x18')](function(_0x29953f){if(_0x29953f){_0x24423f=_0x29953f[_0x8cef('0x2e')];if(!_0x3a3f71[_0x8cef('0x25')][_0x8cef('0x43')]('nolimit')){_0x142060[_0x8cef('0x13')]=qs[_0x8cef('0x13')](_0x3a3f71[_0x8cef('0x25')][_0x8cef('0x13')]);_0x142060[_0x8cef('0x11')]=qs[_0x8cef('0x11')](_0x3a3f71[_0x8cef('0x25')][_0x8cef('0x11')]);}return _0x35f660[_0x8cef('0x54')](_0x142060);}})[_0x8cef('0x18')](function(_0x4f4314){if(_0x4f4314){return _0x4f4314?{'count':_0x24423f,'rows':_0x4f4314}:null;}})[_0x8cef('0x18')](respondWithResult(_0x519875,null))[_0x8cef('0x33')](handleError(_0x519875,null));};exports[_0x8cef('0x55')]=function(_0x193f85,_0x194ed6){var _0x117fb2=_0x193f85[_0x8cef('0x35')][_0x8cef('0x56')];return db[_0x8cef('0x57')][_0x8cef('0x26')]({'where':{'id':_0x117fb2},'attributes':['id'],'include':[{'model':db[_0x8cef('0x4a')],'as':_0x8cef('0x58'),'attributes':['id','name',_0x8cef('0x59'),_0x8cef('0x5a'),_0x8cef('0x5b')],'raw':!![]}]})[_0x8cef('0x18')](function(_0x12d6db){if(_0x12d6db){var _0x338294=_['flatMap'](_0x12d6db,function(_0x25a737){var _0x220b59=_0x25a737[_0x8cef('0x16')]({'plain':!![]});return _0x220b59[_0x8cef('0x58')];});return db[_0x8cef('0x1e')]['find']({'where':{'id':_0x193f85[_0x8cef('0x3c')]['id']}})[_0x8cef('0x18')](function(_0x1d8f4f){return db[_0x8cef('0x5c')]['transaction'](function(_0x211a5e){return _0x1d8f4f['addTeams'](_0x117fb2,{'transaction':_0x211a5e})[_0x8cef('0x18')](function(){return BPromise[_0x8cef('0x5d')](_0x338294,function(_0xf0a4bc){return db[_0x8cef('0x41')]['findOrCreate']({'where':{'UserId':_0xf0a4bc['id'],'ChatQueueId':_0x193f85[_0x8cef('0x3c')]['id']},'transaction':_0x211a5e});});})['then'](function(){_0x338294[_0x8cef('0x5e')](function(_0x1f29d6){socket[_0x8cef('0x5f')](_0x8cef('0x60'),{'UserId':_0x1f29d6['id'],'ChatQueueId':_0x1d8f4f['id']});});});});});}})[_0x8cef('0x18')](respondWithStatusCode(_0x194ed6,null))[_0x8cef('0x33')](handleError(_0x194ed6,null));};exports['removeTeams']=function(_0x4958a1,_0x11585c){return db[_0x8cef('0x57')]['findAll']({'where':{'id':_0x4958a1[_0x8cef('0x25')][_0x8cef('0x56')]},'attributes':['id'],'include':[{'model':db[_0x8cef('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8cef('0x18')](handleEntityNotFound(_0x11585c,null))[_0x8cef('0x18')](function(_0x41bb8d){var _0x2f21df=_[_0x8cef('0x1d')](_0x41bb8d,'id');var _0x24f48d=[];var _0x28dba1=[];var _0x4eeea1=squel[_0x8cef('0x61')]();_0x4eeea1[_0x8cef('0x62')](_0x8cef('0x63'))[_0x8cef('0x64')](_0x8cef('0x65'),'tq')[_0x8cef('0x66')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8cef('0x22')](_0x8cef('0x67'),_0x4958a1[_0x8cef('0x3c')]['id']);for(var _0x1f9a7c=0x0;_0x1f9a7c<_0x41bb8d['length'];_0x1f9a7c+=0x1){let _0x197845=_0x41bb8d[_0x1f9a7c];for(var _0x390dc1=0x0;_0x390dc1<_0x197845['Agents']['length'];_0x390dc1+=0x1){let _0x274fb1=_0x197845['Agents'][_0x390dc1];var _0x9cdc0d=_0x4eeea1[_0x8cef('0x68')]();_0x9cdc0d[_0x8cef('0x22')](_0x8cef('0x69'),_0x274fb1['id']);_0x28dba1[_0x8cef('0x6a')](db[_0x8cef('0x5c')]['query'](_0x9cdc0d[_0x8cef('0x6b')](),{'type':db[_0x8cef('0x5c')][_0x8cef('0x6c')]['SELECT']})[_0x8cef('0x18')](function(_0x3c37f9){if(_0x3c37f9['length']===0x1){return _0x274fb1['id'];}else{var _0x13bff9=_['every'](_[_0x8cef('0x1d')](_0x3c37f9,_0x8cef('0x6d')),function(_0x5aa482){return _['includes'](_0x2f21df,_0x5aa482);});if(_0x13bff9){return _0x274fb1['id'];}}}));}}return BPromise[_0x8cef('0x6e')](_0x28dba1)[_0x8cef('0x18')](function(_0xa1c518){_0x24f48d=_(_0x24f48d)['union'](_0xa1c518)['compact']()['value']();return db[_0x8cef('0x1e')][_0x8cef('0x32')]({'where':{'id':_0x4958a1[_0x8cef('0x3c')]['id']}})['then'](function(_0x23fe37){return db['sequelize'][_0x8cef('0x6f')](function(_0x398ec5){return _0x23fe37['removeTeams'](_0x4958a1[_0x8cef('0x25')][_0x8cef('0x56')],{'transaction':_0x398ec5})[_0x8cef('0x18')](function(){if(!_[_0x8cef('0x70')](_0x24f48d)){return _0x23fe37[_0x8cef('0x71')](_0x24f48d,{'transaction':_0x398ec5});}})['then'](function(){_0x24f48d[_0x8cef('0x5e')](function(_0x451a0f){socket[_0x8cef('0x5f')](_0x8cef('0x72'),{'UserId':_0x451a0f,'ChatQueueId':_0x23fe37['id']});});});});});});})['then'](respondWithStatusCode(_0x11585c,null))['catch'](handleError(_0x11585c,null));};exports[_0x8cef('0x73')]=function(_0x851315,_0x195008){return db[_0x8cef('0x1e')][_0x8cef('0x32')]({'where':{'id':_0x851315[_0x8cef('0x3c')]['id']}})[_0x8cef('0x18')](handleEntityNotFound(_0x195008,null))['then'](function(_0x3efa46){if(_0x3efa46){return _0x3efa46[_0x8cef('0x73')](_0x851315[_0x8cef('0x35')][_0x8cef('0x56')],_[_0x8cef('0x74')](_0x851315[_0x8cef('0x35')],['ids','id'])||{})[_0x8cef('0x75')](function(_0x3f400f){for(var _0x3c0019=0x0;_0x3c0019<_0x851315[_0x8cef('0x35')][_0x8cef('0x56')]['length'];_0x3c0019+=0x1){socket[_0x8cef('0x5f')]('userChatQueue:save',{'UserId':Number(_0x851315[_0x8cef('0x35')][_0x8cef('0x56')][_0x3c0019]),'ChatQueueId':Number(_0x851315[_0x8cef('0x3c')]['id'])});}return _0x3f400f;});}})['then'](respondWithResult(_0x195008,null))[_0x8cef('0x33')](handleError(_0x195008,null));};exports['removeAgents']=function(_0x14b414,_0xc12f36){return db[_0x8cef('0x1e')][_0x8cef('0x32')]({'where':{'id':_0x14b414[_0x8cef('0x3c')]['id']}})[_0x8cef('0x18')](handleEntityNotFound(_0xc12f36,null))[_0x8cef('0x18')](function(_0x36bc67){if(_0x36bc67){return _0x36bc67[_0x8cef('0x71')](_0x14b414['query'][_0x8cef('0x56')])[_0x8cef('0x18')](function(){if(_[_0x8cef('0x76')](_0x14b414[_0x8cef('0x25')][_0x8cef('0x56')])){for(var _0x40c015=0x0;_0x40c015<_0x14b414[_0x8cef('0x25')][_0x8cef('0x56')][_0x8cef('0x2e')];_0x40c015+=0x1){socket[_0x8cef('0x5f')](_0x8cef('0x72'),{'UserId':Number(_0x14b414[_0x8cef('0x25')][_0x8cef('0x56')][_0x40c015]),'ChatQueueId':Number(_0x14b414['params']['id'])});}}else{socket[_0x8cef('0x5f')](_0x8cef('0x72'),{'UserId':Number(_0x14b414['query'][_0x8cef('0x56')]),'ChatQueueId':Number(_0x14b414[_0x8cef('0x3c')]['id'])});}});}})[_0x8cef('0x18')](respondWithStatusCode(_0xc12f36,null))[_0x8cef('0x33')](handleError(_0xc12f36,null));};exports['getAgents']=function(_0x206e36,_0x16598a){var _0x28e2a7={};var _0x3bdfd4={};var _0x232b1b;var _0x2f8748;return db['ChatQueue']['findOne']({'where':{'id':_0x206e36['params']['id']}})['then'](handleEntityNotFound(_0x16598a,null))[_0x8cef('0x18')](function(_0xd4b44d){if(_0xd4b44d){_0x232b1b=_0xd4b44d;_0x3bdfd4[_0x8cef('0x2b')]=_[_0x8cef('0x29')](db['User']['rawAttributes']);_0x3bdfd4['query']=_[_0x8cef('0x29')](_0x206e36[_0x8cef('0x25')]);_0x3bdfd4[_0x8cef('0x2a')]=_[_0x8cef('0x2c')](_0x3bdfd4['model'],_0x3bdfd4[_0x8cef('0x25')]);_0x28e2a7['attributes']=_['intersection'](_0x3bdfd4[_0x8cef('0x2b')],qs[_0x8cef('0x2d')](_0x206e36[_0x8cef('0x25')][_0x8cef('0x2d')]));_0x28e2a7['attributes']=_0x28e2a7[_0x8cef('0x42')][_0x8cef('0x2e')]?_0x28e2a7[_0x8cef('0x42')]:_0x3bdfd4[_0x8cef('0x2b')];_0x28e2a7[_0x8cef('0x45')]=qs['sort'](_0x206e36[_0x8cef('0x25')][_0x8cef('0x46')]);_0x28e2a7[_0x8cef('0x22')]=qs[_0x8cef('0x2a')](_[_0x8cef('0x47')](_0x206e36[_0x8cef('0x25')],_0x3bdfd4[_0x8cef('0x2a')]));if(_0x206e36[_0x8cef('0x25')][_0x8cef('0x49')]){_0x28e2a7['where']=_[_0x8cef('0x30')](_0x28e2a7[_0x8cef('0x22')],{'$or':_[_0x8cef('0x1d')](_0x28e2a7['attributes'],function(_0x10a88d){var _0x155bad={};_0x155bad[_0x10a88d]={'$like':'%'+_0x206e36['query']['filter']+'%'};return _0x155bad;})});}_0x28e2a7=_[_0x8cef('0x30')]({},_0x28e2a7,_0x206e36[_0x8cef('0x31')]);return _0x232b1b[_0x8cef('0x77')](_0x28e2a7);}})[_0x8cef('0x18')](function(_0x349f5d){if(_0x349f5d){_0x2f8748=_0x349f5d[_0x8cef('0x2e')];if(!_0x206e36[_0x8cef('0x25')]['hasOwnProperty'](_0x8cef('0x44'))){_0x28e2a7[_0x8cef('0x13')]=qs[_0x8cef('0x13')](_0x206e36[_0x8cef('0x25')]['limit']);_0x28e2a7[_0x8cef('0x11')]=qs['offset'](_0x206e36['query'][_0x8cef('0x11')]);}return _0x232b1b['getAgents'](_0x28e2a7);}})[_0x8cef('0x18')](function(_0x2ac63c){if(_0x2ac63c){return _0x2ac63c?{'count':_0x2f8748,'rows':_0x2ac63c}:null;}})['then'](respondWithResult(_0x16598a,null))[_0x8cef('0x33')](handleError(_0x16598a,null));}; \ No newline at end of file +var _0x133c=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','order','sort','where','pick','ChatQueueId','merge','filter','findAll','findAndCountAll','chatPause','createdAt','format','%s/%s','getTeams','Team','nolimit','addTeams','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','all','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','getAgents','bluebird','util','lodash','squel','ioredis','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','undefined','limit','count','offset','set','update','destroy','get','ChatQueues','UserProfileResource','then','sendStatus','stack','name','send','index','map','ChatQueue','fieldName','type','getOptions','include','rows','catch','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','options','find','create','body','user'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x133c,0x130));var _0xc133=function(_0x3778f4,_0x194462){_0x3778f4=_0x3778f4-0x0;var _0x5623df=_0x133c[_0x3778f4];return _0x5623df;};'use strict';var BPromise=require(_0xc133('0x0'));var util=require(_0xc133('0x1'));var _=require(_0xc133('0x2'));var squel=require(_0xc133('0x3'));var Redis=require(_0xc133('0x4'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xc133('0x5'));var config=require(_0xc133('0x6'));var db=require(_0xc133('0x7'))['db'];config[_0xc133('0x8')]=_['defaults'](config['redis'],{'host':_0xc133('0x9'),'port':0x18eb});var socket=require(_0xc133('0xa'))(new Redis(config[_0xc133('0x8')]));require('./chatQueue.socket')[_0xc133('0xb')](socket);function respondWithStatusCode(_0x117354,_0x49b56d){_0x49b56d=_0x49b56d||0xcc;return function(_0x1d4be8){if(_0x1d4be8){return _0x117354['sendStatus'](_0x49b56d);}return _0x117354[_0xc133('0xc')](_0x49b56d)[_0xc133('0xd')]();};}function respondWithResult(_0x2b20da,_0xbaf26d){_0xbaf26d=_0xbaf26d||0xc8;return function(_0x1a8214){if(_0x1a8214){return _0x2b20da[_0xc133('0xc')](_0xbaf26d)[_0xc133('0xe')](_0x1a8214);}};}function respondWithFilteredResult(_0xf8b6d9,_0x58fb4c){return function(_0x365a85){if(_0x365a85){var _0x639799=typeof _0x58fb4c['offset']===_0xc133('0xf')&&typeof _0x58fb4c[_0xc133('0x10')]==='undefined';var _0x436da0=_0x365a85[_0xc133('0x11')];var _0x48d5c2=_0x639799?0x0:_0x58fb4c[_0xc133('0x12')];var _0x465983=_0x639799?_0x365a85[_0xc133('0x11')]:_0x58fb4c['offset']+_0x58fb4c[_0xc133('0x10')];var _0x1d537a;if(_0x465983>=_0x436da0){_0x465983=_0x436da0;_0x1d537a=0xc8;}else{_0x1d537a=0xce;}_0xf8b6d9['status'](_0x1d537a);return _0xf8b6d9[_0xc133('0x13')]('Content-Range',_0x48d5c2+'-'+_0x465983+'/'+_0x436da0)[_0xc133('0xe')](_0x365a85);}return null;};}function saveUpdates(_0xa2d04b){return function(_0x2ac783){if(_0x2ac783){return _0x2ac783[_0xc133('0x14')](_0xa2d04b)['then'](function(_0x13fe6c){return _0x13fe6c;});}return null;};}function removeEntity(_0x11e91b){return function(_0x4e3c68){if(_0x4e3c68){return _0x4e3c68[_0xc133('0x15')]()['then'](function(){var _0x5bc11f=_0x4e3c68[_0xc133('0x16')]({'plain':!![]});var _0x3c5c77=_0xc133('0x17');return db[_0xc133('0x18')]['destroy']({'where':{'type':_0x3c5c77,'resourceId':_0x5bc11f['id']}})[_0xc133('0x19')](function(){return _0x4e3c68;});})[_0xc133('0x19')](function(){_0x11e91b[_0xc133('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ccba9){return function(_0x3949ca){if(!_0x3949ca){_0x3ccba9[_0xc133('0x1a')](0x194);}return _0x3949ca;};}function handleError(_0x2f52ae,_0x1bf182){_0x1bf182=_0x1bf182||0x1f4;return function(_0x4d8786){logger['error'](_0x4d8786[_0xc133('0x1b')]);if(_0x4d8786[_0xc133('0x1c')]){delete _0x4d8786['name'];}_0x2f52ae[_0xc133('0xc')](_0x1bf182)[_0xc133('0x1d')](_0x4d8786);};}exports[_0xc133('0x1e')]=function(_0x31a9b7,_0x4cd406){var _0x4bfe44={};var _0x3808f7={'count':0x0,'rows':[]};var _0x249009=_[_0xc133('0x1f')](db[_0xc133('0x20')]['rawAttributes'],function(_0x4d87d2){return{'name':_0x4d87d2[_0xc133('0x21')],'type':_0x4d87d2[_0xc133('0x22')]['key']};});_0x4bfe44=qs[_0xc133('0x23')](_0x249009,_0x31a9b7);var _0x2b2543={'where':_0x4bfe44['where']};return db[_0xc133('0x20')][_0xc133('0x11')](_0x2b2543)['then'](function(_0x2386a1){_0x3808f7[_0xc133('0x11')]=_0x2386a1;_0x4bfe44['include']=qs[_0xc133('0x24')](_0x31a9b7['query']);return db[_0xc133('0x20')]['findAll'](_0x4bfe44);})[_0xc133('0x19')](function(_0x115722){_0x3808f7[_0xc133('0x25')]=_0x115722;return _0x3808f7;})[_0xc133('0x19')](respondWithFilteredResult(_0x4cd406,_0x4bfe44))[_0xc133('0x26')](handleError(_0x4cd406,null));};exports[_0xc133('0x27')]=function(_0x305551,_0x4ab1b3){var _0x2017fe={'raw':!![],'where':{'id':_0x305551[_0xc133('0x28')]['id']}},_0x43ecd4={};_0x43ecd4[_0xc133('0x29')]=_[_0xc133('0x2a')](db[_0xc133('0x20')][_0xc133('0x2b')]);_0x43ecd4[_0xc133('0x2c')]=_[_0xc133('0x2a')](_0x305551[_0xc133('0x2c')]);_0x43ecd4[_0xc133('0x2d')]=_[_0xc133('0x2e')](_0x43ecd4[_0xc133('0x29')],_0x43ecd4['query']);_0x2017fe[_0xc133('0x2f')]=_[_0xc133('0x2e')](_0x43ecd4['model'],qs[_0xc133('0x30')](_0x305551['query'][_0xc133('0x30')]));_0x2017fe[_0xc133('0x2f')]=_0x2017fe[_0xc133('0x2f')][_0xc133('0x31')]?_0x2017fe['attributes']:_0x43ecd4['model'];if(_0x305551[_0xc133('0x2c')][_0xc133('0x32')]){_0x2017fe[_0xc133('0x24')]=[{'all':!![]}];}_0x2017fe=_['merge']({},_0x2017fe,_0x305551[_0xc133('0x33')]);return db[_0xc133('0x20')][_0xc133('0x34')](_0x2017fe)[_0xc133('0x19')](handleEntityNotFound(_0x4ab1b3,null))[_0xc133('0x19')](respondWithResult(_0x4ab1b3,null))[_0xc133('0x26')](handleError(_0x4ab1b3,null));};exports['create']=function(_0x4e63b2,_0x1288f3){return db[_0xc133('0x20')][_0xc133('0x35')](_0x4e63b2[_0xc133('0x36')],{})[_0xc133('0x19')](function(_0x402802){var _0x47ad47=_0x4e63b2[_0xc133('0x37')]['get']({'plain':!![]});if(!_0x47ad47)throw new Error(_0xc133('0x38'));if(_0x47ad47[_0xc133('0x39')]==='user'){var _0x3e4c9d=_0x402802[_0xc133('0x16')]({'plain':!![]});var _0xc425c7=_0xc133('0x17');return db['UserProfileSection'][_0xc133('0x34')]({'where':{'name':_0xc425c7,'userProfileId':_0x47ad47['userProfileId']},'raw':!![]})['then'](function(_0x154bd6){if(_0x154bd6&&_0x154bd6[_0xc133('0x3a')]===0x0){return db[_0xc133('0x18')][_0xc133('0x35')]({'name':_0x3e4c9d[_0xc133('0x1c')],'resourceId':_0x3e4c9d['id'],'type':_0x154bd6[_0xc133('0x1c')],'sectionId':_0x154bd6['id']},{})['then'](function(){return _0x402802;});}else{return _0x402802;}})['catch'](function(_0x4f81a6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f81a6);throw _0x4f81a6;});}return _0x402802;})[_0xc133('0x19')](respondWithResult(_0x1288f3,0xc9))['catch'](handleError(_0x1288f3,null));};exports['update']=function(_0x29b785,_0x30020e){if(_0x29b785[_0xc133('0x36')]['id']){delete _0x29b785[_0xc133('0x36')]['id'];}return db[_0xc133('0x20')]['find']({'where':{'id':_0x29b785[_0xc133('0x28')]['id']}})[_0xc133('0x19')](handleEntityNotFound(_0x30020e,null))['then'](saveUpdates(_0x29b785[_0xc133('0x36')],null))['then'](respondWithResult(_0x30020e,null))['catch'](handleError(_0x30020e,null));};exports[_0xc133('0x15')]=function(_0x3f0e8e,_0x5d663f){return db[_0xc133('0x20')]['find']({'where':{'id':_0x3f0e8e[_0xc133('0x28')]['id']}})['then'](handleEntityNotFound(_0x5d663f,null))[_0xc133('0x19')](removeEntity(_0x5d663f,null))[_0xc133('0x26')](handleError(_0x5d663f,null));};exports[_0xc133('0x3b')]=function(_0x1b6257,_0x13754b){return db[_0xc133('0x20')]['describe']()['then'](respondWithResult(_0x13754b,null))['catch'](handleError(_0x13754b,null));};exports[_0xc133('0x3c')]=function(_0x3b200a,_0x1e0e2d){var _0x5437e2={'raw':!![],'where':{}},_0x25b64c={},_0x1789c4;return db[_0xc133('0x20')][_0xc133('0x3d')]({'where':{'id':_0x3b200a[_0xc133('0x28')]['id']}})[_0xc133('0x19')](handleEntityNotFound(_0x1e0e2d,null))[_0xc133('0x19')](function(_0x47f59c){if(_0x47f59c){_0x1789c4=_0x47f59c[_0xc133('0x16')]({'plain':!![]});_0x25b64c[_0xc133('0x29')]=_[_0xc133('0x2a')](db[_0xc133('0x3e')][_0xc133('0x2b')]);_0x25b64c[_0xc133('0x2c')]=_[_0xc133('0x2a')](_0x3b200a[_0xc133('0x2c')]);_0x25b64c['filters']=_[_0xc133('0x2e')](_0x25b64c[_0xc133('0x29')],_0x25b64c[_0xc133('0x2c')]);_0x5437e2[_0xc133('0x2f')]=_[_0xc133('0x2e')](_0x25b64c[_0xc133('0x29')],qs[_0xc133('0x30')](_0x3b200a[_0xc133('0x2c')]['fields']));_0x5437e2[_0xc133('0x2f')]=_0x5437e2['attributes']['length']?_0x5437e2[_0xc133('0x2f')]:_0x25b64c[_0xc133('0x29')];if(!_0x3b200a[_0xc133('0x2c')][_0xc133('0x3f')]('nolimit')){_0x5437e2[_0xc133('0x10')]=qs[_0xc133('0x10')](_0x3b200a[_0xc133('0x2c')][_0xc133('0x10')]);_0x5437e2[_0xc133('0x12')]=qs[_0xc133('0x12')](_0x3b200a[_0xc133('0x2c')][_0xc133('0x12')]);}_0x5437e2[_0xc133('0x40')]=qs[_0xc133('0x41')](_0x3b200a[_0xc133('0x2c')][_0xc133('0x41')]);_0x5437e2[_0xc133('0x42')]=qs[_0xc133('0x2d')](_[_0xc133('0x43')](_0x3b200a['query'],_0x25b64c[_0xc133('0x2d')]));_0x5437e2[_0xc133('0x42')][_0xc133('0x44')]=_0x47f59c['id'];if(_0x3b200a[_0xc133('0x2c')]['filter']){_0x5437e2[_0xc133('0x42')]=_[_0xc133('0x45')](_0x5437e2[_0xc133('0x42')],{'$or':_[_0xc133('0x1f')](_0x5437e2[_0xc133('0x2f')],function(_0x4b8b3b){var _0x5749b4={};_0x5749b4[_0x4b8b3b]={'$like':'%'+_0x3b200a[_0xc133('0x2c')][_0xc133('0x46')]+'%'};return _0x5749b4;})});}_0x5437e2=_[_0xc133('0x45')]({},_0x5437e2,_0x3b200a[_0xc133('0x33')]);return db[_0xc133('0x3e')][_0xc133('0x47')](_0x5437e2);}})['then'](function(_0x2bcb54){if(_0x2bcb54){return db['User'][_0xc133('0x48')]({'where':{'id':_[_0xc133('0x1f')](_0x2bcb54,'UserId'),'role':'agent'},'attributes':['id','name',_0xc133('0x49'),'updatedAt',_0xc133('0x4a')]});}})[_0xc133('0x19')](function(_0x18241f){if(_0x18241f){return{'count':_0x18241f[_0xc133('0x11')],'rows':_[_0xc133('0x1f')](_0x18241f[_0xc133('0x25')],function(_0x905a42){return{'membername':_0x905a42['name'],'UserId':_0x905a42['id'],'queue_name':_0x1789c4[_0xc133('0x1c')],'ChatQueueId':_0x1789c4['id'],'interface':util[_0xc133('0x4b')](_0xc133('0x4c'),'SIP',_0x905a42[_0xc133('0x1c')]),'penalty':0x0,'paused':_0x905a42[_0xc133('0x49')],'createdAt':_0x905a42['createdAt'],'updatedAt':_0x905a42['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xc133('0x19')](respondWithFilteredResult(_0x1e0e2d,_0x5437e2))[_0xc133('0x26')](handleError(_0x1e0e2d,null));};exports[_0xc133('0x4d')]=function(_0x5107bc,_0x5a11e5){var _0x22b9ed={};var _0x49f9c4={};var _0x419b84;var _0x524142;return db[_0xc133('0x20')][_0xc133('0x3d')]({'where':{'id':_0x5107bc[_0xc133('0x28')]['id']}})['then'](handleEntityNotFound(_0x5a11e5,null))[_0xc133('0x19')](function(_0x38966a){if(_0x38966a){_0x419b84=_0x38966a;_0x49f9c4[_0xc133('0x29')]=_[_0xc133('0x2a')](db[_0xc133('0x4e')][_0xc133('0x2b')]);_0x49f9c4[_0xc133('0x2c')]=_['keys'](_0x5107bc['query']);_0x49f9c4[_0xc133('0x2d')]=_['intersection'](_0x49f9c4[_0xc133('0x29')],_0x49f9c4[_0xc133('0x2c')]);_0x22b9ed['attributes']=_[_0xc133('0x2e')](_0x49f9c4[_0xc133('0x29')],qs[_0xc133('0x30')](_0x5107bc[_0xc133('0x2c')][_0xc133('0x30')]));_0x22b9ed[_0xc133('0x2f')]=_0x22b9ed[_0xc133('0x2f')][_0xc133('0x31')]?_0x22b9ed[_0xc133('0x2f')]:_0x49f9c4[_0xc133('0x29')];_0x22b9ed[_0xc133('0x40')]=qs[_0xc133('0x41')](_0x5107bc[_0xc133('0x2c')][_0xc133('0x41')]);_0x22b9ed[_0xc133('0x42')]=qs['filters'](_[_0xc133('0x43')](_0x5107bc['query'],_0x49f9c4[_0xc133('0x2d')]));if(_0x5107bc[_0xc133('0x2c')][_0xc133('0x46')]){_0x22b9ed[_0xc133('0x42')]=_['merge'](_0x22b9ed[_0xc133('0x42')],{'$or':_[_0xc133('0x1f')](_0x22b9ed[_0xc133('0x2f')],function(_0x47588c){var _0x5f0681={};_0x5f0681[_0x47588c]={'$like':'%'+_0x5107bc[_0xc133('0x2c')]['filter']+'%'};return _0x5f0681;})});}_0x22b9ed=_[_0xc133('0x45')]({},_0x22b9ed,_0x5107bc[_0xc133('0x33')]);return _0x419b84[_0xc133('0x4d')](_0x22b9ed);}})[_0xc133('0x19')](function(_0x16d287){if(_0x16d287){_0x524142=_0x16d287[_0xc133('0x31')];if(!_0x5107bc[_0xc133('0x2c')][_0xc133('0x3f')](_0xc133('0x4f'))){_0x22b9ed['limit']=qs[_0xc133('0x10')](_0x5107bc[_0xc133('0x2c')][_0xc133('0x10')]);_0x22b9ed[_0xc133('0x12')]=qs[_0xc133('0x12')](_0x5107bc['query'][_0xc133('0x12')]);}return _0x419b84['getTeams'](_0x22b9ed);}})[_0xc133('0x19')](function(_0x4ef948){if(_0x4ef948){return _0x4ef948?{'count':_0x524142,'rows':_0x4ef948}:null;}})[_0xc133('0x19')](respondWithResult(_0x5a11e5,null))[_0xc133('0x26')](handleError(_0x5a11e5,null));};exports[_0xc133('0x50')]=function(_0x5144ef,_0x645759){var _0x414cd5=_0x5144ef[_0xc133('0x36')]['ids'];return db[_0xc133('0x4e')][_0xc133('0x47')]({'where':{'id':_0x414cd5},'attributes':['id'],'include':[{'model':db[_0xc133('0x51')],'as':_0xc133('0x52'),'attributes':['id',_0xc133('0x1c'),_0xc133('0x53'),_0xc133('0x54'),_0xc133('0x55')],'raw':!![]}]})[_0xc133('0x19')](function(_0x27e672){if(_0x27e672){var _0x4e485e=_[_0xc133('0x56')](_0x27e672,function(_0x14f3c4){var _0x31760b=_0x14f3c4[_0xc133('0x16')]({'plain':!![]});return _0x31760b[_0xc133('0x52')];});return db[_0xc133('0x20')][_0xc133('0x34')]({'where':{'id':_0x5144ef[_0xc133('0x28')]['id']}})['then'](function(_0x8e9b4a){return db[_0xc133('0x57')][_0xc133('0x58')](function(_0x49be0f){return _0x8e9b4a[_0xc133('0x50')](_0x414cd5,{'transaction':_0x49be0f})['then'](function(){return BPromise[_0xc133('0x59')](_0x4e485e,function(_0x3845b6){return db[_0xc133('0x3e')][_0xc133('0x5a')]({'where':{'UserId':_0x3845b6['id'],'ChatQueueId':_0x5144ef[_0xc133('0x28')]['id']},'transaction':_0x49be0f});});})[_0xc133('0x19')](function(){_0x4e485e[_0xc133('0x5b')](function(_0x176723){socket[_0xc133('0x5c')](_0xc133('0x5d'),{'UserId':_0x176723['id'],'ChatQueueId':_0x8e9b4a['id']});});});});});}})['then'](respondWithStatusCode(_0x645759,null))[_0xc133('0x26')](handleError(_0x645759,null));};exports[_0xc133('0x5e')]=function(_0x21c025,_0x322cf5){return db[_0xc133('0x4e')]['findAll']({'where':{'id':_0x21c025['query'][_0xc133('0x5f')]},'attributes':['id'],'include':[{'model':db[_0xc133('0x51')],'as':_0xc133('0x52'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x322cf5,null))[_0xc133('0x19')](function(_0x174ebf){var _0x31de45=_['map'](_0x174ebf,'id');var _0xba4fa9=[];var _0x4a07e4=[];var _0xa5af46=squel[_0xc133('0x60')]();_0xa5af46[_0xc133('0x61')](_0xc133('0x62'))[_0xc133('0x63')](_0xc133('0x64'),'tq')['join'](_0xc133('0x65'),'ut',_0xc133('0x66'))[_0xc133('0x42')](_0xc133('0x67'),_0x21c025[_0xc133('0x28')]['id']);for(var _0x52d9e9=0x0;_0x52d9e9<_0x174ebf[_0xc133('0x31')];_0x52d9e9+=0x1){let _0x24f988=_0x174ebf[_0x52d9e9];for(var _0x322275=0x0;_0x322275<_0x24f988['Agents']['length'];_0x322275+=0x1){let _0x1ed432=_0x24f988[_0xc133('0x52')][_0x322275];var _0x1d8ed6=_0xa5af46[_0xc133('0x68')]();_0x1d8ed6[_0xc133('0x42')](_0xc133('0x69'),_0x1ed432['id']);_0x4a07e4[_0xc133('0x6a')](db[_0xc133('0x57')][_0xc133('0x2c')](_0x1d8ed6['toString'](),{'type':db['sequelize'][_0xc133('0x6b')][_0xc133('0x6c')]})[_0xc133('0x19')](function(_0x2ab6f9){if(_0x2ab6f9[_0xc133('0x31')]===0x1){return _0x1ed432['id'];}else{var _0x2a5981=_[_0xc133('0x6d')](_[_0xc133('0x1f')](_0x2ab6f9,'TeamId'),function(_0x187a75){return _['includes'](_0x31de45,_0x187a75);});if(_0x2a5981){return _0x1ed432['id'];}}}));}}return BPromise[_0xc133('0x6e')](_0x4a07e4)[_0xc133('0x19')](function(_0x4ed619){_0xba4fa9=_(_0xba4fa9)[_0xc133('0x6f')](_0x4ed619)[_0xc133('0x70')]()[_0xc133('0x71')]();return db[_0xc133('0x20')][_0xc133('0x34')]({'where':{'id':_0x21c025[_0xc133('0x28')]['id']}})[_0xc133('0x19')](function(_0x53a27e){return db['sequelize'][_0xc133('0x58')](function(_0x2d0418){return _0x53a27e[_0xc133('0x5e')](_0x21c025['query'][_0xc133('0x5f')],{'transaction':_0x2d0418})[_0xc133('0x19')](function(){if(!_[_0xc133('0x72')](_0xba4fa9)){return _0x53a27e[_0xc133('0x73')](_0xba4fa9,{'transaction':_0x2d0418});}})[_0xc133('0x19')](function(){_0xba4fa9[_0xc133('0x5b')](function(_0xb6e213){socket[_0xc133('0x5c')](_0xc133('0x74'),{'UserId':_0xb6e213,'ChatQueueId':_0x53a27e['id']});});});});});});})[_0xc133('0x19')](respondWithStatusCode(_0x322cf5,null))[_0xc133('0x26')](handleError(_0x322cf5,null));};exports[_0xc133('0x75')]=function(_0x4d2d78,_0x3a1fb1){return db['ChatQueue'][_0xc133('0x34')]({'where':{'id':_0x4d2d78[_0xc133('0x28')]['id']}})['then'](handleEntityNotFound(_0x3a1fb1,null))[_0xc133('0x19')](function(_0x340522){if(_0x340522){return _0x340522['addAgents'](_0x4d2d78[_0xc133('0x36')]['ids'],_[_0xc133('0x76')](_0x4d2d78['body'],[_0xc133('0x5f'),'id'])||{})['spread'](function(_0x3b6f25){for(var _0x192f93=0x0;_0x192f93<_0x4d2d78[_0xc133('0x36')][_0xc133('0x5f')][_0xc133('0x31')];_0x192f93+=0x1){socket['emit'](_0xc133('0x5d'),{'UserId':Number(_0x4d2d78['body'][_0xc133('0x5f')][_0x192f93]),'ChatQueueId':Number(_0x4d2d78[_0xc133('0x28')]['id'])});}return _0x3b6f25;});}})[_0xc133('0x19')](respondWithResult(_0x3a1fb1,null))[_0xc133('0x26')](handleError(_0x3a1fb1,null));};exports[_0xc133('0x73')]=function(_0xca2572,_0x55abdb){return db[_0xc133('0x20')]['find']({'where':{'id':_0xca2572[_0xc133('0x28')]['id']}})[_0xc133('0x19')](handleEntityNotFound(_0x55abdb,null))[_0xc133('0x19')](function(_0xf57a16){if(_0xf57a16){return _0xf57a16[_0xc133('0x73')](_0xca2572['query'][_0xc133('0x5f')])[_0xc133('0x19')](function(){if(_['isArray'](_0xca2572[_0xc133('0x2c')]['ids'])){for(var _0x12ba59=0x0;_0x12ba59<_0xca2572['query'][_0xc133('0x5f')][_0xc133('0x31')];_0x12ba59+=0x1){socket[_0xc133('0x5c')](_0xc133('0x74'),{'UserId':Number(_0xca2572[_0xc133('0x2c')][_0xc133('0x5f')][_0x12ba59]),'ChatQueueId':Number(_0xca2572[_0xc133('0x28')]['id'])});}}else{socket[_0xc133('0x5c')](_0xc133('0x74'),{'UserId':Number(_0xca2572[_0xc133('0x2c')][_0xc133('0x5f')]),'ChatQueueId':Number(_0xca2572['params']['id'])});}});}})[_0xc133('0x19')](respondWithStatusCode(_0x55abdb,null))[_0xc133('0x26')](handleError(_0x55abdb,null));};exports['getAgents']=function(_0x169e33,_0x3bdf52){var _0x4dc4fd={};var _0x5e98ca={};var _0x47dc0d;var _0x35f865;return db[_0xc133('0x20')]['findOne']({'where':{'id':_0x169e33[_0xc133('0x28')]['id']}})[_0xc133('0x19')](handleEntityNotFound(_0x3bdf52,null))['then'](function(_0x9da301){if(_0x9da301){_0x47dc0d=_0x9da301;_0x5e98ca[_0xc133('0x29')]=_[_0xc133('0x2a')](db[_0xc133('0x51')][_0xc133('0x2b')]);_0x5e98ca[_0xc133('0x2c')]=_[_0xc133('0x2a')](_0x169e33[_0xc133('0x2c')]);_0x5e98ca[_0xc133('0x2d')]=_['intersection'](_0x5e98ca[_0xc133('0x29')],_0x5e98ca[_0xc133('0x2c')]);_0x4dc4fd[_0xc133('0x2f')]=_[_0xc133('0x2e')](_0x5e98ca[_0xc133('0x29')],qs[_0xc133('0x30')](_0x169e33[_0xc133('0x2c')][_0xc133('0x30')]));_0x4dc4fd[_0xc133('0x2f')]=_0x4dc4fd[_0xc133('0x2f')]['length']?_0x4dc4fd['attributes']:_0x5e98ca[_0xc133('0x29')];_0x4dc4fd[_0xc133('0x40')]=qs[_0xc133('0x41')](_0x169e33[_0xc133('0x2c')]['sort']);_0x4dc4fd[_0xc133('0x42')]=qs[_0xc133('0x2d')](_[_0xc133('0x43')](_0x169e33[_0xc133('0x2c')],_0x5e98ca[_0xc133('0x2d')]));if(_0x169e33[_0xc133('0x2c')]['filter']){_0x4dc4fd['where']=_[_0xc133('0x45')](_0x4dc4fd[_0xc133('0x42')],{'$or':_['map'](_0x4dc4fd[_0xc133('0x2f')],function(_0x310431){var _0x2a1d4c={};_0x2a1d4c[_0x310431]={'$like':'%'+_0x169e33[_0xc133('0x2c')][_0xc133('0x46')]+'%'};return _0x2a1d4c;})});}_0x4dc4fd=_[_0xc133('0x45')]({},_0x4dc4fd,_0x169e33[_0xc133('0x33')]);return _0x47dc0d[_0xc133('0x77')](_0x4dc4fd);}})[_0xc133('0x19')](function(_0x40d4b9){if(_0x40d4b9){_0x35f865=_0x40d4b9[_0xc133('0x31')];if(!_0x169e33['query'][_0xc133('0x3f')](_0xc133('0x4f'))){_0x4dc4fd[_0xc133('0x10')]=qs[_0xc133('0x10')](_0x169e33[_0xc133('0x2c')][_0xc133('0x10')]);_0x4dc4fd[_0xc133('0x12')]=qs[_0xc133('0x12')](_0x169e33[_0xc133('0x2c')][_0xc133('0x12')]);}return _0x47dc0d[_0xc133('0x77')](_0x4dc4fd);}})['then'](function(_0x2676b8){if(_0x2676b8){return _0x2676b8?{'count':_0x35f865,'rows':_0x2676b8}:null;}})[_0xc133('0x19')](respondWithResult(_0x3bdf52,null))['catch'](handleError(_0x3bdf52,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 0a276bf..46ec30b 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 _0xaffe=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xaffe,0x163));var _0xeaff=function(_0x51203b,_0x1e0cc0){_0x51203b=_0x51203b-0x0;var _0xe212c=_0xaffe[_0x51203b];return _0xe212c;};'use strict';var EventEmitter=require(_0xeaff('0x0'));var ChatQueue=require(_0xeaff('0x1'))['db'][_0xeaff('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xeaff('0x3')](0x0);var events={'afterCreate':_0xeaff('0x4'),'afterUpdate':_0xeaff('0x5'),'afterDestroy':_0xeaff('0x6')};function emitEvent(_0x216dea){return function(_0xa74ddd,_0x1b4995,_0x4627bd){ChatQueueEvents[_0xeaff('0x7')](_0x216dea+':'+_0xa74ddd['id'],_0xa74ddd);ChatQueueEvents[_0xeaff('0x7')](_0x216dea,_0xa74ddd);_0x4627bd(null);};}for(var e in events){if(events[_0xeaff('0x8')](e)){var event=events[e];ChatQueue[_0xeaff('0x9')](e,emitEvent(event));}}module[_0xeaff('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0x7fc4=['../../mysqldb','ChatQueue','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x5b40e4,_0xd9db24){var _0x59af32=function(_0x1ccf78){while(--_0x1ccf78){_0x5b40e4['push'](_0x5b40e4['shift']());}};_0x59af32(++_0xd9db24);}(_0x7fc4,0x8f));var _0x47fc=function(_0x2c1e30,_0x52d61e){_0x2c1e30=_0x2c1e30-0x0;var _0x891bcc=_0x7fc4[_0x2c1e30];return _0x891bcc;};'use strict';var EventEmitter=require(_0x47fc('0x0'));var ChatQueue=require(_0x47fc('0x1'))['db'][_0x47fc('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x47fc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x47fc('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2148f7){return function(_0x3724b6,_0x3bcb71,_0x52f167){ChatQueueEvents[_0x47fc('0x5')](_0x2148f7+':'+_0x3724b6['id'],_0x3724b6);ChatQueueEvents['emit'](_0x2148f7,_0x3724b6);_0x52f167(null);};}for(var e in events){if(events[_0x47fc('0x6')](e)){var event=events[e];ChatQueue[_0x47fc('0x7')](e,emitEvent(event));}}module[_0x47fc('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index c4a7a1c..2af17f6 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 _0x017e=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatQueue','chat_queues','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x017e,0x103));var _0xe017=function(_0x2a83af,_0x4fa9ed){_0x2a83af=_0x2a83af-0x0;var _0x2e1648=_0x017e[_0x2a83af];return _0x2e1648;};'use strict';var _=require(_0xe017('0x0'));var util=require(_0xe017('0x1'));var logger=require('../../config/logger')(_0xe017('0x2'));var moment=require(_0xe017('0x3'));var BPromise=require(_0xe017('0x4'));var rp=require(_0xe017('0x5'));var fs=require('fs');var path=require(_0xe017('0x6'));var rimraf=require(_0xe017('0x7'));var config=require(_0xe017('0x8'));var attributes=require('./chatQueue.attributes');module[_0xe017('0x9')]=function(_0x547d73,_0x3a266f){return _0x547d73[_0xe017('0xa')](_0xe017('0xb'),attributes,{'tableName':_0xe017('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa157=['lodash','../../config/logger','api','bluebird','request-promise','rimraf','./chatQueue.attributes','exports','define','chat_queues'];(function(_0x25efdf,_0x521462){var _0x22c495=function(_0x184469){while(--_0x184469){_0x25efdf['push'](_0x25efdf['shift']());}};_0x22c495(++_0x521462);}(_0xa157,0x12c));var _0x7a15=function(_0x33d580,_0x177cf2){_0x33d580=_0x33d580-0x0;var _0x4cf904=_0xa157[_0x33d580];return _0x4cf904;};'use strict';var _=require(_0x7a15('0x0'));var util=require('util');var logger=require(_0x7a15('0x1'))(_0x7a15('0x2'));var moment=require('moment');var BPromise=require(_0x7a15('0x3'));var rp=require(_0x7a15('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7a15('0x5'));var config=require('../../config/environment');var attributes=require(_0x7a15('0x6'));module[_0x7a15('0x7')]=function(_0x1f62ba,_0x5c45ac){return _0x1f62ba[_0x7a15('0x8')]('ChatQueue',attributes,{'tableName':_0x7a15('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 71f8459..14b3c2a 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 _0xf274=['redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','map','model','ShowChatQueue','find','include','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xf274,0x99));var _0x4f27=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xf274[_0x62c958];return _0x57ec61;};'use strict';var _=require('lodash');var util=require(_0x4f27('0x0'));var moment=require(_0x4f27('0x1'));var BPromise=require(_0x4f27('0x2'));var rs=require(_0x4f27('0x3'));var fs=require('fs');var Redis=require(_0x4f27('0x4'));var db=require(_0x4f27('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f27('0x6'))(_0x4f27('0x7'));var config=require(_0x4f27('0x8'));var jayson=require(_0x4f27('0x9'));var client=jayson[_0x4f27('0xa')]['http']({'port':0x232a});config[_0x4f27('0xb')]=_[_0x4f27('0xc')](config[_0x4f27('0xb')],{'host':_0x4f27('0xd'),'port':0x18eb});var socket=require(_0x4f27('0xe'))(new Redis(config[_0x4f27('0xb')]));require(_0x4f27('0xf'))['register'](socket);function respondWithRpcPromise(_0x5d2624,_0x150414,_0x1eb796){return new BPromise(function(_0x4f4640,_0x211294){return client[_0x4f27('0x10')](_0x5d2624,_0x1eb796)[_0x4f27('0x11')](function(_0x3f395b){logger['info'](_0x4f27('0x12'),_0x150414,_0x4f27('0x13'));logger[_0x4f27('0x14')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x150414,_0x4f27('0x13'),JSON[_0x4f27('0x15')](_0x3f395b));if(_0x3f395b[_0x4f27('0x16')]){if(_0x3f395b[_0x4f27('0x16')][_0x4f27('0x17')]===0x1f4){logger[_0x4f27('0x16')](_0x4f27('0x12'),_0x150414,_0x3f395b[_0x4f27('0x16')][_0x4f27('0x18')]);return _0x211294(_0x3f395b[_0x4f27('0x16')][_0x4f27('0x18')]);}logger[_0x4f27('0x16')](_0x4f27('0x12'),_0x150414,_0x3f395b['error'][_0x4f27('0x18')]);return _0x4f4640(_0x3f395b['error'][_0x4f27('0x18')]);}else{logger[_0x4f27('0x19')](_0x4f27('0x12'),_0x150414,_0x4f27('0x13'));_0x4f4640(_0x3f395b[_0x4f27('0x1a')][_0x4f27('0x18')]);}})[_0x4f27('0x1b')](function(_0x4d6fb3){logger[_0x4f27('0x16')]('ChatQueue,\x20%s,\x20%s',_0x150414,_0x4d6fb3);_0x211294(_0x4d6fb3);});});}exports[_0x4f27('0x1c')]=function(_0x29a177){var _0x6cb587=this;return new Promise(function(_0x426ac7,_0x57c89f){return db[_0x4f27('0x1d')][_0x4f27('0x1e')]({'raw':_0x29a177[_0x4f27('0x1f')]?_0x29a177[_0x4f27('0x1f')][_0x4f27('0x20')]===undefined?!![]:![]:!![],'where':_0x29a177[_0x4f27('0x1f')]?_0x29a177['options'][_0x4f27('0x21')]||null:null,'attributes':_0x29a177[_0x4f27('0x1f')]?_0x29a177['options'][_0x4f27('0x22')]||null:null,'limit':_0x29a177['options']?_0x29a177[_0x4f27('0x1f')][_0x4f27('0x23')]||null:null,'include':_0x29a177[_0x4f27('0x1f')]?_0x29a177[_0x4f27('0x1f')]['include']?_[_0x4f27('0x24')](_0x29a177[_0x4f27('0x1f')]['include'],function(_0x185ba2){return{'model':db[_0x185ba2[_0x4f27('0x25')]],'as':_0x185ba2['as'],'attributes':_0x185ba2[_0x4f27('0x22')],'include':_0x185ba2['include']?_[_0x4f27('0x24')](_0x185ba2['include'],function(_0x4652dd){return{'model':db[_0x4652dd['model']],'as':_0x4652dd['as'],'attributes':_0x4652dd[_0x4f27('0x22')],'include':_0x4652dd['include']?_[_0x4f27('0x24')](_0x4652dd['include'],function(_0x539ac9){return{'model':db[_0x539ac9[_0x4f27('0x25')]],'as':_0x539ac9['as'],'attributes':_0x539ac9[_0x4f27('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36d787){logger['info'](_0x4f27('0x1c'),_0x29a177);logger[_0x4f27('0x14')](_0x4f27('0x1c'),_0x29a177,JSON[_0x4f27('0x15')](_0x36d787));_0x426ac7(_0x36d787);})['catch'](function(_0x5b02d3){logger[_0x4f27('0x16')](_0x4f27('0x1c'),_0x5b02d3['message'],_0x29a177);_0x57c89f(_0x6cb587['error'](0x1f4,_0x5b02d3[_0x4f27('0x18')]));});});};exports[_0x4f27('0x26')]=function(_0x3cf621){var _0x4d514b=this;return new Promise(function(_0x47d415,_0x4886b9){return db['ChatQueue'][_0x4f27('0x27')]({'raw':_0x3cf621['options']?_0x3cf621['options'][_0x4f27('0x20')]===undefined?!![]:![]:!![],'where':_0x3cf621[_0x4f27('0x1f')]?_0x3cf621[_0x4f27('0x1f')][_0x4f27('0x21')]||null:null,'attributes':_0x3cf621[_0x4f27('0x1f')]?_0x3cf621[_0x4f27('0x1f')]['attributes']||null:null,'include':_0x3cf621[_0x4f27('0x1f')]?_0x3cf621[_0x4f27('0x1f')][_0x4f27('0x28')]?_[_0x4f27('0x24')](_0x3cf621['options']['include'],function(_0x27ec74){return{'model':db[_0x27ec74[_0x4f27('0x25')]],'as':_0x27ec74['as'],'attributes':_0x27ec74[_0x4f27('0x22')],'include':_0x27ec74[_0x4f27('0x28')]?_[_0x4f27('0x24')](_0x27ec74[_0x4f27('0x28')],function(_0x45ce84){return{'model':db[_0x45ce84['model']],'as':_0x45ce84['as'],'attributes':_0x45ce84[_0x4f27('0x22')],'include':_0x45ce84[_0x4f27('0x28')]?_[_0x4f27('0x24')](_0x45ce84[_0x4f27('0x28')],function(_0x363843){return{'model':db[_0x363843[_0x4f27('0x25')]],'as':_0x363843['as'],'attributes':_0x363843['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5afea9){logger['info'](_0x4f27('0x26'),_0x3cf621);logger[_0x4f27('0x14')](_0x4f27('0x26'),_0x3cf621,JSON[_0x4f27('0x15')](_0x5afea9));_0x47d415(_0x5afea9);})[_0x4f27('0x1b')](function(_0x102b13){logger[_0x4f27('0x16')]('ShowChatQueue',_0x102b13[_0x4f27('0x18')],_0x3cf621);_0x4886b9(_0x4d514b[_0x4f27('0x16')](0x1f4,_0x102b13['message']));});});}; \ No newline at end of file +var _0x2162=['model','GetChatQueue','ShowChatQueue','ChatQueue','find','where','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','findAll','options','raw','limit','map','include','attributes'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x2162,0x110));var _0x2216=function(_0x24c15a,_0x261c48){_0x24c15a=_0x24c15a-0x0;var _0x2a3137=_0x2162[_0x24c15a];return _0x2a3137;};'use strict';var _=require('lodash');var util=require(_0x2216('0x0'));var moment=require('moment');var BPromise=require(_0x2216('0x1'));var rs=require(_0x2216('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2216('0x3'))['db'];var utils=require(_0x2216('0x4'));var logger=require('../../config/logger')(_0x2216('0x5'));var config=require(_0x2216('0x6'));var jayson=require(_0x2216('0x7'));var client=jayson['client'][_0x2216('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2216('0x9')],{'host':_0x2216('0xa'),'port':0x18eb});var socket=require(_0x2216('0xb'))(new Redis(config[_0x2216('0x9')]));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x5ef687,_0x4b16f8,_0x26087b){return new BPromise(function(_0x291559,_0x4bae57){return client[_0x2216('0xc')](_0x5ef687,_0x26087b)[_0x2216('0xd')](function(_0x462180){logger[_0x2216('0xe')]('ChatQueue,\x20%s,\x20%s',_0x4b16f8,_0x2216('0xf'));logger[_0x2216('0x10')](_0x2216('0x11'),_0x4b16f8,_0x2216('0xf'),JSON[_0x2216('0x12')](_0x462180));if(_0x462180[_0x2216('0x13')]){if(_0x462180[_0x2216('0x13')][_0x2216('0x14')]===0x1f4){logger['error'](_0x2216('0x15'),_0x4b16f8,_0x462180[_0x2216('0x13')]['message']);return _0x4bae57(_0x462180[_0x2216('0x13')]['message']);}logger[_0x2216('0x13')](_0x2216('0x15'),_0x4b16f8,_0x462180[_0x2216('0x13')][_0x2216('0x16')]);return _0x291559(_0x462180[_0x2216('0x13')][_0x2216('0x16')]);}else{logger[_0x2216('0xe')](_0x2216('0x15'),_0x4b16f8,_0x2216('0xf'));_0x291559(_0x462180[_0x2216('0x17')][_0x2216('0x16')]);}})[_0x2216('0x18')](function(_0x376a36){logger[_0x2216('0x13')](_0x2216('0x15'),_0x4b16f8,_0x376a36);_0x4bae57(_0x376a36);});});}exports['GetChatQueue']=function(_0x1157f7){var _0x36708c=this;return new Promise(function(_0x41ac4b,_0x230faa){return db['ChatQueue'][_0x2216('0x19')]({'raw':_0x1157f7[_0x2216('0x1a')]?_0x1157f7[_0x2216('0x1a')][_0x2216('0x1b')]===undefined?!![]:![]:!![],'where':_0x1157f7['options']?_0x1157f7['options']['where']||null:null,'attributes':_0x1157f7[_0x2216('0x1a')]?_0x1157f7[_0x2216('0x1a')]['attributes']||null:null,'limit':_0x1157f7[_0x2216('0x1a')]?_0x1157f7[_0x2216('0x1a')][_0x2216('0x1c')]||null:null,'include':_0x1157f7[_0x2216('0x1a')]?_0x1157f7[_0x2216('0x1a')]['include']?_[_0x2216('0x1d')](_0x1157f7[_0x2216('0x1a')][_0x2216('0x1e')],function(_0x15fded){return{'model':db[_0x15fded['model']],'as':_0x15fded['as'],'attributes':_0x15fded[_0x2216('0x1f')],'include':_0x15fded[_0x2216('0x1e')]?_[_0x2216('0x1d')](_0x15fded[_0x2216('0x1e')],function(_0xcb96b6){return{'model':db[_0xcb96b6[_0x2216('0x20')]],'as':_0xcb96b6['as'],'attributes':_0xcb96b6[_0x2216('0x1f')],'include':_0xcb96b6[_0x2216('0x1e')]?_['map'](_0xcb96b6[_0x2216('0x1e')],function(_0x50703e){return{'model':db[_0x50703e['model']],'as':_0x50703e['as'],'attributes':_0x50703e[_0x2216('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d08fd){logger['info'](_0x2216('0x21'),_0x1157f7);logger[_0x2216('0x10')](_0x2216('0x21'),_0x1157f7,JSON[_0x2216('0x12')](_0x2d08fd));_0x41ac4b(_0x2d08fd);})[_0x2216('0x18')](function(_0x2fd7cb){logger[_0x2216('0x13')](_0x2216('0x21'),_0x2fd7cb[_0x2216('0x16')],_0x1157f7);_0x230faa(_0x36708c[_0x2216('0x13')](0x1f4,_0x2fd7cb['message']));});});};exports[_0x2216('0x22')]=function(_0xcb23b0){var _0x22e017=this;return new Promise(function(_0x3fde1f,_0x4861d2){return db[_0x2216('0x23')][_0x2216('0x24')]({'raw':_0xcb23b0[_0x2216('0x1a')]?_0xcb23b0[_0x2216('0x1a')][_0x2216('0x1b')]===undefined?!![]:![]:!![],'where':_0xcb23b0[_0x2216('0x1a')]?_0xcb23b0[_0x2216('0x1a')][_0x2216('0x25')]||null:null,'attributes':_0xcb23b0['options']?_0xcb23b0[_0x2216('0x1a')]['attributes']||null:null,'include':_0xcb23b0[_0x2216('0x1a')]?_0xcb23b0[_0x2216('0x1a')]['include']?_['map'](_0xcb23b0[_0x2216('0x1a')][_0x2216('0x1e')],function(_0x133f0f){return{'model':db[_0x133f0f[_0x2216('0x20')]],'as':_0x133f0f['as'],'attributes':_0x133f0f[_0x2216('0x1f')],'include':_0x133f0f[_0x2216('0x1e')]?_[_0x2216('0x1d')](_0x133f0f[_0x2216('0x1e')],function(_0x4ee42c){return{'model':db[_0x4ee42c['model']],'as':_0x4ee42c['as'],'attributes':_0x4ee42c[_0x2216('0x1f')],'include':_0x4ee42c[_0x2216('0x1e')]?_[_0x2216('0x1d')](_0x4ee42c['include'],function(_0x372df4){return{'model':db[_0x372df4[_0x2216('0x20')]],'as':_0x372df4['as'],'attributes':_0x372df4[_0x2216('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2216('0xd')](function(_0x4eee0a){logger[_0x2216('0xe')](_0x2216('0x22'),_0xcb23b0);logger['debug'](_0x2216('0x22'),_0xcb23b0,JSON[_0x2216('0x12')](_0x4eee0a));_0x3fde1f(_0x4eee0a);})[_0x2216('0x18')](function(_0x52ac76){logger[_0x2216('0x13')](_0x2216('0x22'),_0x52ac76[_0x2216('0x16')],_0xcb23b0);_0x4861d2(_0x22e017['error'](0x1f4,_0x52ac76[_0x2216('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 3cc3a62..04f186b 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(_0x27c068,_0x342981){var _0xe5a67f=function(_0x20658a){while(--_0x20658a){_0x27c068['push'](_0x27c068['shift']());}};_0xe5a67f(++_0x342981);}(_0xe13a,0x178));var _0xae13=function(_0x1bcaed,_0x1dd3fa){_0x1bcaed=_0x1bcaed-0x0;var _0x3366a8=_0xe13a[_0x1bcaed];return _0x3366a8;};'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 _0x222f=['./chatQueue.events','save','remove','update','emit','register'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x222f,0x1a4));var _0xf222=function(_0x279755,_0x42ad77){_0x279755=_0x279755-0x0;var _0x138178=_0x222f[_0x279755];return _0x138178;};'use strict';var ChatQueueEvents=require(_0xf222('0x0'));var events=[_0xf222('0x1'),_0xf222('0x2'),_0xf222('0x3')];function createListener(_0x4d09ec,_0x4b4237){return function(_0x195de1){_0x4b4237[_0xf222('0x4')](_0x4d09ec,_0x195de1);};}function removeListener(_0x307791,_0x7b187d){return function(){ChatQueueEvents['removeListener'](_0x307791,_0x7b187d);};}exports[_0xf222('0x5')]=function(_0x54a758){for(var _0x112e6d=0x0,_0x26f129=events['length'];_0x112e6d<_0x26f129;_0x112e6d++){var _0xf5a105=events[_0x112e6d];var _0x302d7a=createListener('chatQueue:'+_0xf5a105,_0x54a758);ChatQueueEvents['on'](_0xf5a105,_0x302d7a);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 01e25bc..a22d8a2 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 _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2c9b79,_0x7cf58b){_0x2c9b79=_0x2c9b79-0x0;var _0x265032=_0x5fc3[_0x2c9b79];return _0x265032;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=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(_0x48de73,_0x5cb42f){var _0x2ff266=function(_0xa2b9ea){while(--_0xa2b9ea){_0x48de73['push'](_0x48de73['shift']());}};_0x2ff266(++_0x5cb42f);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',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 840e78b..1752f0d 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 _0x1239=['DATE','moment','sequelize','exports','STRING'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x1239,0x114));var _0x9123=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1239[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require(_0x9123('0x0'));var Sequelize=require(_0x9123('0x1'));module[_0x9123('0x2')]={'uniqueid':{'type':Sequelize[_0x9123('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9123('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x9123('0x4')]},'acceptAt':{'type':Sequelize[_0x9123('0x4')]},'exitAt':{'type':Sequelize[_0x9123('0x4')]},'reason':{'type':Sequelize[_0x9123('0x3')]}}; \ No newline at end of file +var _0xf2ad=['STRING','DATE','moment','exports'];(function(_0x3515a0,_0xc6dccf){var _0x560260=function(_0x171b46){while(--_0x171b46){_0x3515a0['push'](_0x3515a0['shift']());}};_0x560260(++_0xc6dccf);}(_0xf2ad,0x1f2));var _0xdf2a=function(_0x25efdf,_0x521462){_0x25efdf=_0x25efdf-0x0;var _0x22c495=_0xf2ad[_0x25efdf];return _0x22c495;};'use strict';var moment=require(_0xdf2a('0x0'));var Sequelize=require('sequelize');module[_0xdf2a('0x1')]={'uniqueid':{'type':Sequelize[_0xdf2a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdf2a('0x2')]},'joinAt':{'type':Sequelize[_0xdf2a('0x3')]},'leaveAt':{'type':Sequelize[_0xdf2a('0x3')]},'acceptAt':{'type':Sequelize[_0xdf2a('0x3')]},'exitAt':{'type':Sequelize[_0xdf2a('0x3')]},'reason':{'type':Sequelize[_0xdf2a('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 8d59207..f24420e 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 _0x3e24=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','then','destroy','error','name','send','index','map','ChatQueueReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','keys','includeAll','find','catch','create','body','update','describe','eml-format'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0x3e24,0x167));var _0x43e2=function(_0x5c55dd,_0x3cd260){_0x5c55dd=_0x5c55dd-0x0;var _0x3521fc=_0x3e24[_0x5c55dd];return _0x3521fc;};'use strict';var emlformat=require(_0x43e2('0x0'));var rimraf=require(_0x43e2('0x1'));var zipdir=require(_0x43e2('0x2'));var jsonpatch=require(_0x43e2('0x3'));var rp=require(_0x43e2('0x4'));var moment=require('moment');var BPromise=require(_0x43e2('0x5'));var Mustache=require(_0x43e2('0x6'));var util=require('util');var path=require(_0x43e2('0x7'));var sox=require(_0x43e2('0x8'));var csv=require(_0x43e2('0x9'));var ejs=require(_0x43e2('0xa'));var fs=require('fs');var fs_extra=require(_0x43e2('0xb'));var _=require(_0x43e2('0xc'));var squel=require(_0x43e2('0xd'));var crypto=require('crypto');var jsforce=require(_0x43e2('0xe'));var deskjs=require(_0x43e2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x43e2('0x10'));var Papa=require(_0x43e2('0x11'));var Redis=require('ioredis');var authService=require(_0x43e2('0x12'));var qs=require(_0x43e2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43e2('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x43e2('0x15'));var licenseUtil=require(_0x43e2('0x16'));var db=require(_0x43e2('0x17'))['db'];function respondWithStatusCode(_0x44781a,_0x43ba14){_0x43ba14=_0x43ba14||0xcc;return function(_0x68e82d){if(_0x68e82d){return _0x44781a[_0x43e2('0x18')](_0x43ba14);}return _0x44781a[_0x43e2('0x19')](_0x43ba14)[_0x43e2('0x1a')]();};}function respondWithResult(_0x218ae7,_0x377097){_0x377097=_0x377097||0xc8;return function(_0x3ccccd){if(_0x3ccccd){return _0x218ae7['status'](_0x377097)[_0x43e2('0x1b')](_0x3ccccd);}};}function respondWithFilteredResult(_0x40fb7b,_0xb929b5){return function(_0x2a0fb0){if(_0x2a0fb0){var _0x5cea01=typeof _0xb929b5['offset']===_0x43e2('0x1c')&&typeof _0xb929b5[_0x43e2('0x1d')]===_0x43e2('0x1c');var _0x3a27eb=_0x2a0fb0[_0x43e2('0x1e')];var _0x1b7cde=_0x5cea01?0x0:_0xb929b5[_0x43e2('0x1f')];var _0x15ecb5=_0x5cea01?_0x2a0fb0[_0x43e2('0x1e')]:_0xb929b5[_0x43e2('0x1f')]+_0xb929b5['limit'];var _0x3ee34c;if(_0x15ecb5>=_0x3a27eb){_0x15ecb5=_0x3a27eb;_0x3ee34c=0xc8;}else{_0x3ee34c=0xce;}_0x40fb7b[_0x43e2('0x19')](_0x3ee34c);return _0x40fb7b['set'](_0x43e2('0x20'),_0x1b7cde+'-'+_0x15ecb5+'/'+_0x3a27eb)['json'](_0x2a0fb0);}return null;};}function patchUpdates(_0x3bc2ce){return function(_0x13610f){try{jsonpatch[_0x43e2('0x21')](_0x13610f,_0x3bc2ce,!![]);}catch(_0x23825c){return BPromise[_0x43e2('0x22')](_0x23825c);}return _0x13610f['save']();};}function saveUpdates(_0x3b0357,_0x12d842){return function(_0x272934){if(_0x272934){return _0x272934['update'](_0x3b0357)[_0x43e2('0x23')](function(_0x32f048){return _0x32f048;});}return null;};}function removeEntity(_0x43078f,_0x11b285){return function(_0x4f20e6){if(_0x4f20e6){return _0x4f20e6[_0x43e2('0x24')]()[_0x43e2('0x23')](function(){_0x43078f[_0x43e2('0x19')](0xcc)[_0x43e2('0x1a')]();});}};}function handleEntityNotFound(_0x178223,_0x2a593e){return function(_0x3ca16b){if(!_0x3ca16b){_0x178223[_0x43e2('0x18')](0x194);}return _0x3ca16b;};}function handleError(_0xd29b7b,_0x1ec68e){_0x1ec68e=_0x1ec68e||0x1f4;return function(_0x1ea844){logger[_0x43e2('0x25')](_0x1ea844['stack']);if(_0x1ea844[_0x43e2('0x26')]){delete _0x1ea844[_0x43e2('0x26')];}_0xd29b7b['status'](_0x1ec68e)[_0x43e2('0x27')](_0x1ea844);};}exports[_0x43e2('0x28')]=function(_0x2dffa2,_0x404483){var _0x3fd232={},_0x5a896b={},_0x42f495={'count':0x0,'rows':[]};var _0xd1b43a=_[_0x43e2('0x29')](db[_0x43e2('0x2a')][_0x43e2('0x2b')],function(_0x30bdcb){return{'name':_0x30bdcb['fieldName'],'type':_0x30bdcb['type'][_0x43e2('0x2c')]};});_0x5a896b[_0x43e2('0x2d')]=_[_0x43e2('0x29')](_0xd1b43a,_0x43e2('0x26'));_0x5a896b[_0x43e2('0x2e')]=_['keys'](_0x2dffa2[_0x43e2('0x2e')]);_0x5a896b[_0x43e2('0x2f')]=_[_0x43e2('0x30')](_0x5a896b[_0x43e2('0x2d')],_0x5a896b[_0x43e2('0x2e')]);_0x3fd232[_0x43e2('0x31')]=_[_0x43e2('0x30')](_0x5a896b['model'],qs['fields'](_0x2dffa2[_0x43e2('0x2e')][_0x43e2('0x32')]));_0x3fd232['attributes']=_0x3fd232[_0x43e2('0x31')][_0x43e2('0x33')]?_0x3fd232['attributes']:_0x5a896b[_0x43e2('0x2d')];if(!_0x2dffa2['query']['hasOwnProperty']('nolimit')){_0x3fd232[_0x43e2('0x1d')]=qs['limit'](_0x2dffa2[_0x43e2('0x2e')][_0x43e2('0x1d')]);_0x3fd232[_0x43e2('0x1f')]=qs[_0x43e2('0x1f')](_0x2dffa2[_0x43e2('0x2e')][_0x43e2('0x1f')]);}_0x3fd232[_0x43e2('0x34')]=qs[_0x43e2('0x35')](_0x2dffa2[_0x43e2('0x2e')][_0x43e2('0x35')]);_0x3fd232[_0x43e2('0x36')]=qs[_0x43e2('0x2f')](_[_0x43e2('0x37')](_0x2dffa2[_0x43e2('0x2e')],_0x5a896b[_0x43e2('0x2f')]),_0xd1b43a);if(_0x2dffa2[_0x43e2('0x2e')][_0x43e2('0x38')]){_0x3fd232['where']=_['merge'](_0x3fd232['where'],{'$or':_[_0x43e2('0x29')](_0xd1b43a,function(_0x13af7f){if(_0x13af7f['type']!=='VIRTUAL'){var _0x2b5fce={};_0x2b5fce[_0x13af7f[_0x43e2('0x26')]]={'$like':'%'+_0x2dffa2[_0x43e2('0x2e')][_0x43e2('0x38')]+'%'};return _0x2b5fce;}})});}_0x3fd232=_[_0x43e2('0x39')]({},_0x3fd232,_0x2dffa2[_0x43e2('0x3a')]);var _0x2afcdd={'where':_0x3fd232[_0x43e2('0x36')]};return db[_0x43e2('0x2a')][_0x43e2('0x1e')](_0x2afcdd)[_0x43e2('0x23')](function(_0x257de9){_0x42f495[_0x43e2('0x1e')]=_0x257de9;if(_0x2dffa2[_0x43e2('0x2e')]['includeAll']){_0x3fd232[_0x43e2('0x3b')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x43e2('0x3c')](_0x3fd232);})['then'](function(_0x19ce1b){_0x42f495[_0x43e2('0x3d')]=_0x19ce1b;return _0x42f495;})[_0x43e2('0x23')](respondWithFilteredResult(_0x404483,_0x3fd232))['catch'](handleError(_0x404483,null));};exports[_0x43e2('0x3e')]=function(_0x5ca5d0,_0x1ba4cf){var _0x36f94a={'raw':!![],'where':{'id':_0x5ca5d0[_0x43e2('0x3f')]['id']}},_0x34f2b5={};_0x34f2b5['model']=_['keys'](db[_0x43e2('0x2a')][_0x43e2('0x2b')]);_0x34f2b5[_0x43e2('0x2e')]=_[_0x43e2('0x40')](_0x5ca5d0['query']);_0x34f2b5[_0x43e2('0x2f')]=_[_0x43e2('0x30')](_0x34f2b5[_0x43e2('0x2d')],_0x34f2b5[_0x43e2('0x2e')]);_0x36f94a[_0x43e2('0x31')]=_['intersection'](_0x34f2b5[_0x43e2('0x2d')],qs['fields'](_0x5ca5d0[_0x43e2('0x2e')][_0x43e2('0x32')]));_0x36f94a['attributes']=_0x36f94a[_0x43e2('0x31')]['length']?_0x36f94a['attributes']:_0x34f2b5[_0x43e2('0x2d')];if(_0x5ca5d0[_0x43e2('0x2e')][_0x43e2('0x41')]){_0x36f94a[_0x43e2('0x3b')]=[{'all':!![]}];}_0x36f94a=_[_0x43e2('0x39')]({},_0x36f94a,_0x5ca5d0['options']);return db[_0x43e2('0x2a')][_0x43e2('0x42')](_0x36f94a)[_0x43e2('0x23')](handleEntityNotFound(_0x1ba4cf,null))[_0x43e2('0x23')](respondWithResult(_0x1ba4cf,null))[_0x43e2('0x43')](handleError(_0x1ba4cf,null));};exports[_0x43e2('0x44')]=function(_0x29a9ef,_0x2462db){return db['ChatQueueReport'][_0x43e2('0x44')](_0x29a9ef[_0x43e2('0x45')],{})['then'](respondWithResult(_0x2462db,0xc9))[_0x43e2('0x43')](handleError(_0x2462db,null));};exports[_0x43e2('0x46')]=function(_0x466f65,_0x8bc721){if(_0x466f65['body']['id']){delete _0x466f65[_0x43e2('0x45')]['id'];}return db[_0x43e2('0x2a')][_0x43e2('0x42')]({'where':{'id':_0x466f65[_0x43e2('0x3f')]['id']}})[_0x43e2('0x23')](handleEntityNotFound(_0x8bc721,null))['then'](saveUpdates(_0x466f65['body'],null))[_0x43e2('0x23')](respondWithResult(_0x8bc721,null))[_0x43e2('0x43')](handleError(_0x8bc721,null));};exports['destroy']=function(_0x2a40a5,_0x28a101){return db[_0x43e2('0x2a')]['find']({'where':{'id':_0x2a40a5['params']['id']}})[_0x43e2('0x23')](handleEntityNotFound(_0x28a101,null))[_0x43e2('0x23')](removeEntity(_0x28a101,null))[_0x43e2('0x43')](handleError(_0x28a101,null));};exports[_0x43e2('0x47')]=function(_0x1a9283,_0x278730){return db[_0x43e2('0x2a')][_0x43e2('0x47')]()[_0x43e2('0x23')](respondWithResult(_0x278730,null))['catch'](handleError(_0x278730,null));}; \ No newline at end of file +var _0x36f3=['map','includeAll','include','findAll','rows','catch','show','params','filters','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','undefined','limit','offset','count','set','json','apply','reject','save','update','then','destroy','error','name','index','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','where','pick','merge'];(function(_0x143cfd,_0x1a336e){var _0x2cb5f5=function(_0x1523fa){while(--_0x1523fa){_0x143cfd['push'](_0x143cfd['shift']());}};_0x2cb5f5(++_0x1a336e);}(_0x36f3,0xe6));var _0x336f=function(_0x4099af,_0x1578bf){_0x4099af=_0x4099af-0x0;var _0x46e189=_0x36f3[_0x4099af];return _0x46e189;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x336f('0x0'));var zipdir=require(_0x336f('0x1'));var jsonpatch=require(_0x336f('0x2'));var rp=require(_0x336f('0x3'));var moment=require(_0x336f('0x4'));var BPromise=require(_0x336f('0x5'));var Mustache=require(_0x336f('0x6'));var util=require(_0x336f('0x7'));var path=require(_0x336f('0x8'));var sox=require('sox');var csv=require(_0x336f('0x9'));var ejs=require(_0x336f('0xa'));var fs=require('fs');var fs_extra=require(_0x336f('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x336f('0xc'));var jsforce=require(_0x336f('0xd'));var deskjs=require(_0x336f('0xe'));var toCsv=require(_0x336f('0x9'));var querystring=require(_0x336f('0xf'));var Papa=require(_0x336f('0x10'));var Redis=require(_0x336f('0x11'));var authService=require(_0x336f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x336f('0x13'));var hardwareService=require(_0x336f('0x14'));var logger=require(_0x336f('0x15'))(_0x336f('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x336f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2edd0c,_0x29f1ff){_0x29f1ff=_0x29f1ff||0xcc;return function(_0x4986ba){if(_0x4986ba){return _0x2edd0c[_0x336f('0x18')](_0x29f1ff);}return _0x2edd0c[_0x336f('0x19')](_0x29f1ff)[_0x336f('0x1a')]();};}function respondWithResult(_0x14f88f,_0x12c5e0){_0x12c5e0=_0x12c5e0||0xc8;return function(_0x1e021b){if(_0x1e021b){return _0x14f88f[_0x336f('0x19')](_0x12c5e0)['json'](_0x1e021b);}};}function respondWithFilteredResult(_0x163061,_0x670ed5){return function(_0x3c7d01){if(_0x3c7d01){var _0x115be9=typeof _0x670ed5['offset']===_0x336f('0x1b')&&typeof _0x670ed5[_0x336f('0x1c')]===_0x336f('0x1b');var _0x724918=_0x3c7d01['count'];var _0xbbe464=_0x115be9?0x0:_0x670ed5[_0x336f('0x1d')];var _0x5d1eec=_0x115be9?_0x3c7d01[_0x336f('0x1e')]:_0x670ed5[_0x336f('0x1d')]+_0x670ed5[_0x336f('0x1c')];var _0x5a7d0d;if(_0x5d1eec>=_0x724918){_0x5d1eec=_0x724918;_0x5a7d0d=0xc8;}else{_0x5a7d0d=0xce;}_0x163061[_0x336f('0x19')](_0x5a7d0d);return _0x163061[_0x336f('0x1f')]('Content-Range',_0xbbe464+'-'+_0x5d1eec+'/'+_0x724918)[_0x336f('0x20')](_0x3c7d01);}return null;};}function patchUpdates(_0x245612){return function(_0x13b12c){try{jsonpatch[_0x336f('0x21')](_0x13b12c,_0x245612,!![]);}catch(_0x4ebd9f){return BPromise[_0x336f('0x22')](_0x4ebd9f);}return _0x13b12c[_0x336f('0x23')]();};}function saveUpdates(_0x183a5d,_0x2031b3){return function(_0x175637){if(_0x175637){return _0x175637[_0x336f('0x24')](_0x183a5d)[_0x336f('0x25')](function(_0x20ee82){return _0x20ee82;});}return null;};}function removeEntity(_0x26de86,_0x149fc){return function(_0x1a6e60){if(_0x1a6e60){return _0x1a6e60[_0x336f('0x26')]()[_0x336f('0x25')](function(){_0x26de86['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x386d6f,_0x377bcd){return function(_0x1aa9c0){if(!_0x1aa9c0){_0x386d6f[_0x336f('0x18')](0x194);}return _0x1aa9c0;};}function handleError(_0x526cc1,_0x1cfba1){_0x1cfba1=_0x1cfba1||0x1f4;return function(_0x282e07){logger[_0x336f('0x27')](_0x282e07['stack']);if(_0x282e07[_0x336f('0x28')]){delete _0x282e07[_0x336f('0x28')];}_0x526cc1[_0x336f('0x19')](_0x1cfba1)['send'](_0x282e07);};}exports[_0x336f('0x29')]=function(_0x1c6bb9,_0x395aad){var _0x1195c1={},_0x19e727={},_0x2978b8={'count':0x0,'rows':[]};var _0x5d5684=_['map'](db[_0x336f('0x2a')][_0x336f('0x2b')],function(_0x390ded){return{'name':_0x390ded[_0x336f('0x2c')],'type':_0x390ded[_0x336f('0x2d')][_0x336f('0x2e')]};});_0x19e727[_0x336f('0x2f')]=_['map'](_0x5d5684,_0x336f('0x28'));_0x19e727[_0x336f('0x30')]=_[_0x336f('0x31')](_0x1c6bb9['query']);_0x19e727['filters']=_[_0x336f('0x32')](_0x19e727[_0x336f('0x2f')],_0x19e727['query']);_0x1195c1[_0x336f('0x33')]=_[_0x336f('0x32')](_0x19e727['model'],qs[_0x336f('0x34')](_0x1c6bb9[_0x336f('0x30')][_0x336f('0x34')]));_0x1195c1[_0x336f('0x33')]=_0x1195c1[_0x336f('0x33')][_0x336f('0x35')]?_0x1195c1['attributes']:_0x19e727['model'];if(!_0x1c6bb9['query'][_0x336f('0x36')]('nolimit')){_0x1195c1[_0x336f('0x1c')]=qs[_0x336f('0x1c')](_0x1c6bb9['query'][_0x336f('0x1c')]);_0x1195c1[_0x336f('0x1d')]=qs[_0x336f('0x1d')](_0x1c6bb9[_0x336f('0x30')]['offset']);}_0x1195c1['order']=qs['sort'](_0x1c6bb9[_0x336f('0x30')]['sort']);_0x1195c1[_0x336f('0x37')]=qs['filters'](_[_0x336f('0x38')](_0x1c6bb9[_0x336f('0x30')],_0x19e727['filters']),_0x5d5684);if(_0x1c6bb9[_0x336f('0x30')]['filter']){_0x1195c1['where']=_[_0x336f('0x39')](_0x1195c1[_0x336f('0x37')],{'$or':_[_0x336f('0x3a')](_0x5d5684,function(_0x5c0cd8){if(_0x5c0cd8['type']!=='VIRTUAL'){var _0x32c243={};_0x32c243[_0x5c0cd8['name']]={'$like':'%'+_0x1c6bb9[_0x336f('0x30')]['filter']+'%'};return _0x32c243;}})});}_0x1195c1=_[_0x336f('0x39')]({},_0x1195c1,_0x1c6bb9['options']);var _0x442dae={'where':_0x1195c1['where']};return db[_0x336f('0x2a')][_0x336f('0x1e')](_0x442dae)[_0x336f('0x25')](function(_0x2dc122){_0x2978b8[_0x336f('0x1e')]=_0x2dc122;if(_0x1c6bb9[_0x336f('0x30')][_0x336f('0x3b')]){_0x1195c1[_0x336f('0x3c')]=[{'all':!![]}];}return db[_0x336f('0x2a')][_0x336f('0x3d')](_0x1195c1);})[_0x336f('0x25')](function(_0x1c4f7c){_0x2978b8[_0x336f('0x3e')]=_0x1c4f7c;return _0x2978b8;})['then'](respondWithFilteredResult(_0x395aad,_0x1195c1))[_0x336f('0x3f')](handleError(_0x395aad,null));};exports[_0x336f('0x40')]=function(_0x2d0708,_0x572315){var _0x7c5f5d={'raw':!![],'where':{'id':_0x2d0708[_0x336f('0x41')]['id']}},_0xe5cbd3={};_0xe5cbd3['model']=_[_0x336f('0x31')](db[_0x336f('0x2a')]['rawAttributes']);_0xe5cbd3[_0x336f('0x30')]=_[_0x336f('0x31')](_0x2d0708[_0x336f('0x30')]);_0xe5cbd3[_0x336f('0x42')]=_[_0x336f('0x32')](_0xe5cbd3[_0x336f('0x2f')],_0xe5cbd3[_0x336f('0x30')]);_0x7c5f5d['attributes']=_[_0x336f('0x32')](_0xe5cbd3['model'],qs[_0x336f('0x34')](_0x2d0708[_0x336f('0x30')]['fields']));_0x7c5f5d[_0x336f('0x33')]=_0x7c5f5d['attributes']['length']?_0x7c5f5d[_0x336f('0x33')]:_0xe5cbd3[_0x336f('0x2f')];if(_0x2d0708[_0x336f('0x30')][_0x336f('0x3b')]){_0x7c5f5d[_0x336f('0x3c')]=[{'all':!![]}];}_0x7c5f5d=_[_0x336f('0x39')]({},_0x7c5f5d,_0x2d0708[_0x336f('0x43')]);return db[_0x336f('0x2a')][_0x336f('0x44')](_0x7c5f5d)['then'](handleEntityNotFound(_0x572315,null))[_0x336f('0x25')](respondWithResult(_0x572315,null))['catch'](handleError(_0x572315,null));};exports['create']=function(_0x1b8802,_0x21c6ee){return db[_0x336f('0x2a')][_0x336f('0x45')](_0x1b8802[_0x336f('0x46')],{})[_0x336f('0x25')](respondWithResult(_0x21c6ee,0xc9))[_0x336f('0x3f')](handleError(_0x21c6ee,null));};exports[_0x336f('0x24')]=function(_0x5809e1,_0xc5bd24){if(_0x5809e1[_0x336f('0x46')]['id']){delete _0x5809e1[_0x336f('0x46')]['id'];}return db[_0x336f('0x2a')][_0x336f('0x44')]({'where':{'id':_0x5809e1['params']['id']}})['then'](handleEntityNotFound(_0xc5bd24,null))[_0x336f('0x25')](saveUpdates(_0x5809e1[_0x336f('0x46')],null))[_0x336f('0x25')](respondWithResult(_0xc5bd24,null))[_0x336f('0x3f')](handleError(_0xc5bd24,null));};exports[_0x336f('0x26')]=function(_0x7a21b2,_0x5ada31){return db['ChatQueueReport']['find']({'where':{'id':_0x7a21b2[_0x336f('0x41')]['id']}})[_0x336f('0x25')](handleEntityNotFound(_0x5ada31,null))[_0x336f('0x25')](removeEntity(_0x5ada31,null))['catch'](handleError(_0x5ada31,null));};exports[_0x336f('0x47')]=function(_0x10345b,_0x10f8b2){return db[_0x336f('0x2a')][_0x336f('0x47')]()['then'](respondWithResult(_0x10f8b2,null))[_0x336f('0x3f')](handleError(_0x10f8b2,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 5955a02..3abd2b9 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x55bae1,_0x309a99){var _0xb99f64=function(_0x4436d0){while(--_0x4436d0){_0x55bae1['push'](_0x55bae1['shift']());}};_0xb99f64(++_0x309a99);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xb7e7[_0x1beef3];return _0x5af964;};'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_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x26b5ff,_0x92009a){var _0x58603e=function(_0x4454ff){while(--_0x4454ff){_0x26b5ff['push'](_0x26b5ff['shift']());}};_0x58603e(++_0x92009a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 2716016..3bcd53e 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 _0x578d=['limit','debug','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','body','options','info','CreateChatQueueReport','UpdateChatQueueReport','ChatQueueReport','update','raw','where','attributes'];(function(_0x10a7c2,_0x546bb2){var _0x47ce71=function(_0x11d8d2){while(--_0x11d8d2){_0x10a7c2['push'](_0x10a7c2['shift']());}};_0x47ce71(++_0x546bb2);}(_0x578d,0x11a));var _0xd578=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x578d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd578('0x0'));var util=require('util');var moment=require(_0xd578('0x1'));var BPromise=require(_0xd578('0x2'));var rs=require(_0xd578('0x3'));var fs=require('fs');var Redis=require(_0xd578('0x4'));var db=require(_0xd578('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd578('0x6'));var config=require(_0xd578('0x7'));var jayson=require(_0xd578('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x48f7af,_0x2798f5,_0x22a569){return new BPromise(function(_0x37b3f0,_0x1c444a){return client[_0xd578('0x9')](_0x48f7af,_0x22a569)[_0xd578('0xa')](function(_0x19812e){logger['info'](_0xd578('0xb'),_0x2798f5,_0xd578('0xc'));logger['debug'](_0xd578('0xd'),_0x2798f5,_0xd578('0xc'),JSON['stringify'](_0x19812e));if(_0x19812e['error']){if(_0x19812e[_0xd578('0xe')]['code']===0x1f4){logger[_0xd578('0xe')](_0xd578('0xb'),_0x2798f5,_0x19812e['error'][_0xd578('0xf')]);return _0x1c444a(_0x19812e[_0xd578('0xe')]['message']);}logger[_0xd578('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x2798f5,_0x19812e['error'][_0xd578('0xf')]);return _0x37b3f0(_0x19812e[_0xd578('0xe')][_0xd578('0xf')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x2798f5,'request\x20sent');_0x37b3f0(_0x19812e[_0xd578('0x10')][_0xd578('0xf')]);}})[_0xd578('0x11')](function(_0x3bf79e){logger[_0xd578('0xe')](_0xd578('0xb'),_0x2798f5,_0x3bf79e);_0x1c444a(_0x3bf79e);});});}exports['CreateChatQueueReport']=function(_0x1df3ff){var _0x3d3a54=this;return new Promise(function(_0x389de1,_0x4f63eb){return db['ChatQueueReport']['create'](_0x1df3ff[_0xd578('0x12')],{'raw':_0x1df3ff[_0xd578('0x13')]?_0x1df3ff[_0xd578('0x13')]['raw']===undefined?!![]:![]:!![]})[_0xd578('0xa')](function(_0x5ae08f){logger[_0xd578('0x14')]('CreateChatQueueReport',_0x1df3ff);logger['debug'](_0xd578('0x15'),_0x1df3ff,JSON['stringify'](_0x5ae08f));_0x389de1(_0x5ae08f);})[_0xd578('0x11')](function(_0x21030c){logger['error'](_0xd578('0x15'),_0x21030c['message'],_0x1df3ff);_0x4f63eb(_0x3d3a54[_0xd578('0xe')](0x1f4,_0x21030c[_0xd578('0xf')]));});});};exports[_0xd578('0x16')]=function(_0x1de9b8){var _0x55ba21=this;return new Promise(function(_0x140562,_0x29de5f){return db[_0xd578('0x17')][_0xd578('0x18')](_0x1de9b8[_0xd578('0x12')],{'raw':_0x1de9b8[_0xd578('0x13')]?_0x1de9b8['options'][_0xd578('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1de9b8[_0xd578('0x13')]?_0x1de9b8[_0xd578('0x13')][_0xd578('0x1a')]||null:null,'attributes':_0x1de9b8[_0xd578('0x13')]?_0x1de9b8[_0xd578('0x13')][_0xd578('0x1b')]||null:null,'limit':_0x1de9b8[_0xd578('0x13')]?_0x1de9b8[_0xd578('0x13')][_0xd578('0x1c')]||null:null})[_0xd578('0xa')](function(_0x51854f){logger[_0xd578('0x14')](_0xd578('0x16'),_0x1de9b8);logger[_0xd578('0x1d')](_0xd578('0x16'),_0x1de9b8,JSON[_0xd578('0x1e')](_0x51854f));_0x140562(_0x51854f);})[_0xd578('0x11')](function(_0x180ca9){logger[_0xd578('0xe')](_0xd578('0x16'),_0x180ca9['message'],_0x1de9b8);_0x29de5f(_0x55ba21[_0xd578('0xe')](0x1f4,_0x180ca9['message']));});});}; \ No newline at end of file +var _0x6206=['ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','UpdateChatQueueReport','update','body','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x32f1ef,_0x51a021){var _0x2e89d2=function(_0x338da0){while(--_0x338da0){_0x32f1ef['push'](_0x32f1ef['shift']());}};_0x2e89d2(++_0x51a021);}(_0x6206,0x1b4));var _0x6620=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x6206[_0x4b7895];return _0x264180;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6620('0x0'));var BPromise=require(_0x6620('0x1'));var rs=require(_0x6620('0x2'));var fs=require('fs');var Redis=require(_0x6620('0x3'));var db=require(_0x6620('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6620('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6620('0x6'));var client=jayson[_0x6620('0x7')][_0x6620('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x329c79,_0x414470,_0x2f1de0){return new BPromise(function(_0x1f2a98,_0xd1730c){return client[_0x6620('0x9')](_0x329c79,_0x2f1de0)[_0x6620('0xa')](function(_0x359f76){logger[_0x6620('0xb')](_0x6620('0xc'),_0x414470,_0x6620('0xd'));logger['debug'](_0x6620('0xe'),_0x414470,'request\x20sent',JSON[_0x6620('0xf')](_0x359f76));if(_0x359f76['error']){if(_0x359f76[_0x6620('0x10')]['code']===0x1f4){logger[_0x6620('0x10')](_0x6620('0xc'),_0x414470,_0x359f76[_0x6620('0x10')]['message']);return _0xd1730c(_0x359f76[_0x6620('0x10')]['message']);}logger[_0x6620('0x10')](_0x6620('0xc'),_0x414470,_0x359f76[_0x6620('0x10')][_0x6620('0x11')]);return _0x1f2a98(_0x359f76[_0x6620('0x10')][_0x6620('0x11')]);}else{logger[_0x6620('0xb')](_0x6620('0xc'),_0x414470,'request\x20sent');_0x1f2a98(_0x359f76[_0x6620('0x12')][_0x6620('0x11')]);}})[_0x6620('0x13')](function(_0x2512ac){logger[_0x6620('0x10')](_0x6620('0xc'),_0x414470,_0x2512ac);_0xd1730c(_0x2512ac);});});}exports[_0x6620('0x14')]=function(_0x33874d){var _0x2fa1f7=this;return new Promise(function(_0x180e16,_0x557489){return db[_0x6620('0x15')][_0x6620('0x16')](_0x33874d['body'],{'raw':_0x33874d[_0x6620('0x17')]?_0x33874d['options']['raw']===undefined?!![]:![]:!![]})[_0x6620('0xa')](function(_0x2341c5){logger['info'](_0x6620('0x14'),_0x33874d);logger['debug'](_0x6620('0x14'),_0x33874d,JSON[_0x6620('0xf')](_0x2341c5));_0x180e16(_0x2341c5);})[_0x6620('0x13')](function(_0x410008){logger[_0x6620('0x10')](_0x6620('0x14'),_0x410008[_0x6620('0x11')],_0x33874d);_0x557489(_0x2fa1f7[_0x6620('0x10')](0x1f4,_0x410008[_0x6620('0x11')]));});});};exports[_0x6620('0x18')]=function(_0x48ee6d){var _0x2eb9ef=this;return new Promise(function(_0x181a63,_0x1e5cf7){return db[_0x6620('0x15')][_0x6620('0x19')](_0x48ee6d[_0x6620('0x1a')],{'raw':_0x48ee6d[_0x6620('0x17')]?_0x48ee6d[_0x6620('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48ee6d[_0x6620('0x17')]?_0x48ee6d[_0x6620('0x17')][_0x6620('0x1b')]||null:null,'attributes':_0x48ee6d[_0x6620('0x17')]?_0x48ee6d[_0x6620('0x17')][_0x6620('0x1c')]||null:null,'limit':_0x48ee6d[_0x6620('0x17')]?_0x48ee6d[_0x6620('0x17')][_0x6620('0x1d')]||null:null})[_0x6620('0xa')](function(_0x548046){logger[_0x6620('0xb')](_0x6620('0x18'),_0x48ee6d);logger['debug'](_0x6620('0x18'),_0x48ee6d,JSON[_0x6620('0xf')](_0x548046));_0x181a63(_0x548046);})['catch'](function(_0x24b4fd){logger['error'](_0x6620('0x18'),_0x24b4fd['message'],_0x48ee6d);_0x1e5cf7(_0x2eb9ef[_0x6620('0x10')](0x1f4,_0x24b4fd['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 27255c4..7e586e3 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 _0x3ca4=['/describe','/:id','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index'];(function(_0x7b1da3,_0x4317f4){var _0x27b504=function(_0x3b0d9c){while(--_0x3b0d9c){_0x7b1da3['push'](_0x7b1da3['shift']());}};_0x27b504(++_0x4317f4);}(_0x3ca4,0xef));var _0x43ca=function(_0x800a95,_0x520512){_0x800a95=_0x800a95-0x0;var _0x14c7b6=_0x3ca4[_0x800a95];return _0x14c7b6;};'use strict';var multer=require(_0x43ca('0x0'));var util=require(_0x43ca('0x1'));var path=require(_0x43ca('0x2'));var timeout=require(_0x43ca('0x3'));var express=require(_0x43ca('0x4'));var router=express['Router']();var fs_extra=require(_0x43ca('0x5'));var auth=require(_0x43ca('0x6'));var interaction=require(_0x43ca('0x7'));var config=require(_0x43ca('0x8'));var controller=require(_0x43ca('0x9'));router[_0x43ca('0xa')]('/',auth[_0x43ca('0xb')](),controller[_0x43ca('0xc')]);router[_0x43ca('0xa')](_0x43ca('0xd'),auth[_0x43ca('0xb')](),controller['describe']);router[_0x43ca('0xa')](_0x43ca('0xe'),auth[_0x43ca('0xb')](),controller['show']);router['post']('/',auth[_0x43ca('0xb')](),controller[_0x43ca('0xf')]);router[_0x43ca('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x43ca('0x11')]);router[_0x43ca('0x12')](_0x43ca('0xe'),auth['isAuthenticated'](),controller[_0x43ca('0x13')]);module[_0x43ca('0x14')]=router; \ No newline at end of file +var _0x9453=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./chatQueueReport.controller','get','index','/describe','describe','isAuthenticated','show','put','/:id','update'];(function(_0xe6391c,_0x322480){var _0x3f396f=function(_0x13f612){while(--_0x13f612){_0xe6391c['push'](_0xe6391c['shift']());}};_0x3f396f(++_0x322480);}(_0x9453,0x88));var _0x3945=function(_0x393650,_0x7f8f1f){_0x393650=_0x393650-0x0;var _0x18e2db=_0x9453[_0x393650];return _0x18e2db;};'use strict';var multer=require(_0x3945('0x0'));var util=require(_0x3945('0x1'));var path=require(_0x3945('0x2'));var timeout=require(_0x3945('0x3'));var express=require('express');var router=express[_0x3945('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3945('0x5'));var config=require('../../config/environment');var controller=require(_0x3945('0x6'));router[_0x3945('0x7')]('/',auth['isAuthenticated'](),controller[_0x3945('0x8')]);router[_0x3945('0x7')](_0x3945('0x9'),auth['isAuthenticated'](),controller[_0x3945('0xa')]);router['get']('/:id',auth[_0x3945('0xb')](),controller[_0x3945('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x3945('0xd')](_0x3945('0xe'),auth[_0x3945('0xb')](),controller[_0x3945('0xf')]);router[_0x3945('0x10')](_0x3945('0xe'),auth[_0x3945('0xb')](),controller[_0x3945('0x11')]);module[_0x3945('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 412e7ed..e9c7814 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x322a35,_0x3d331a){var _0x24751e=function(_0x481080){while(--_0x481080){_0x322a35['push'](_0x322a35['shift']());}};_0x24751e(++_0x3d331a);}(_0xaa88,0x137));var _0x8aa8=function(_0x4dbba7,_0x34d6d1){_0x4dbba7=_0x4dbba7-0x0;var _0x43ef83=_0xaa88[_0x4dbba7];return _0x43ef83;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4bb593,_0x272ed0){var _0x2da2d8=function(_0x4b25e9){while(--_0x4b25e9){_0x4bb593['push'](_0x4bb593['shift']());}};_0x2da2d8(++_0x272ed0);}(_0xaa88,0x137));var _0x8aa8=function(_0x3efe87,_0x35ad48){_0x3efe87=_0x3efe87-0x0;var _0x56a4cc=_0xaa88[_0x3efe87];return _0x56a4cc;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index fffd82c..348dfff 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 _0xbeb7=['offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','index','map','ChatTransferReport','type','query','keys','attributes','fields','length','hasOwnProperty','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','model','rawAttributes','intersection','find','create','body','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x1f06b1,_0x1605f3){var _0x5a67bc=function(_0x800288){while(--_0x800288){_0x1f06b1['push'](_0x1f06b1['shift']());}};_0x5a67bc(++_0x1605f3);}(_0xbeb7,0xbe));var _0x7beb=function(_0x522b28,_0x56ff2b){_0x522b28=_0x522b28-0x0;var _0x2b4d56=_0xbeb7[_0x522b28];return _0x2b4d56;};'use strict';var emlformat=require(_0x7beb('0x0'));var rimraf=require(_0x7beb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7beb('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7beb('0x3'));var Mustache=require(_0x7beb('0x4'));var util=require(_0x7beb('0x5'));var path=require(_0x7beb('0x6'));var sox=require(_0x7beb('0x7'));var csv=require(_0x7beb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7beb('0x9'));var _=require(_0x7beb('0xa'));var squel=require(_0x7beb('0xb'));var crypto=require(_0x7beb('0xc'));var jsforce=require(_0x7beb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7beb('0x8'));var querystring=require(_0x7beb('0xe'));var Papa=require(_0x7beb('0xf'));var Redis=require(_0x7beb('0x10'));var authService=require(_0x7beb('0x11'));var qs=require(_0x7beb('0x12'));var as=require(_0x7beb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7beb('0x14'));var utils=require('../../config/utils');var config=require(_0x7beb('0x15'));var licenseUtil=require(_0x7beb('0x16'));var db=require(_0x7beb('0x17'))['db'];function respondWithStatusCode(_0x547f93,_0x3737f3){_0x3737f3=_0x3737f3||0xcc;return function(_0x1d900e){if(_0x1d900e){return _0x547f93['sendStatus'](_0x3737f3);}return _0x547f93[_0x7beb('0x18')](_0x3737f3)[_0x7beb('0x19')]();};}function respondWithResult(_0x26fb93,_0x1f20c9){_0x1f20c9=_0x1f20c9||0xc8;return function(_0x8a5456){if(_0x8a5456){return _0x26fb93[_0x7beb('0x18')](_0x1f20c9)['json'](_0x8a5456);}};}function respondWithFilteredResult(_0x116e9d,_0x421bc7){return function(_0x2f5eef){if(_0x2f5eef){var _0x1a57dd=typeof _0x421bc7[_0x7beb('0x1a')]===_0x7beb('0x1b')&&typeof _0x421bc7[_0x7beb('0x1c')]===_0x7beb('0x1b');var _0x1c9c2c=_0x2f5eef[_0x7beb('0x1d')];var _0x1f2e35=_0x1a57dd?0x0:_0x421bc7[_0x7beb('0x1a')];var _0x15fe43=_0x1a57dd?_0x2f5eef['count']:_0x421bc7[_0x7beb('0x1a')]+_0x421bc7[_0x7beb('0x1c')];var _0x2acc79;if(_0x15fe43>=_0x1c9c2c){_0x15fe43=_0x1c9c2c;_0x2acc79=0xc8;}else{_0x2acc79=0xce;}_0x116e9d['status'](_0x2acc79);return _0x116e9d[_0x7beb('0x1e')](_0x7beb('0x1f'),_0x1f2e35+'-'+_0x15fe43+'/'+_0x1c9c2c)[_0x7beb('0x20')](_0x2f5eef);}return null;};}function patchUpdates(_0x5b7e98){return function(_0x18aa18){try{jsonpatch[_0x7beb('0x21')](_0x18aa18,_0x5b7e98,!![]);}catch(_0x429048){return BPromise[_0x7beb('0x22')](_0x429048);}return _0x18aa18[_0x7beb('0x23')]();};}function saveUpdates(_0x2edad4,_0x2d29e0){return function(_0x2bde5c){if(_0x2bde5c){return _0x2bde5c[_0x7beb('0x24')](_0x2edad4)[_0x7beb('0x25')](function(_0x4b51f3){return _0x4b51f3;});}return null;};}function removeEntity(_0x2117f0,_0x345ecb){return function(_0x26857e){if(_0x26857e){return _0x26857e[_0x7beb('0x26')]()[_0x7beb('0x25')](function(){_0x2117f0[_0x7beb('0x18')](0xcc)[_0x7beb('0x19')]();});}};}function handleEntityNotFound(_0x5b74cf,_0x280e06){return function(_0x94cd6a){if(!_0x94cd6a){_0x5b74cf[_0x7beb('0x27')](0x194);}return _0x94cd6a;};}function handleError(_0x1fff0e,_0x4c92d3){_0x4c92d3=_0x4c92d3||0x1f4;return function(_0x3d2a2e){logger[_0x7beb('0x28')](_0x3d2a2e['stack']);if(_0x3d2a2e[_0x7beb('0x29')]){delete _0x3d2a2e[_0x7beb('0x29')];}_0x1fff0e[_0x7beb('0x18')](_0x4c92d3)['send'](_0x3d2a2e);};}exports[_0x7beb('0x2a')]=function(_0x51f24e,_0x17497d){var _0x948ff6={},_0x17ec78={},_0x4018ed={'count':0x0,'rows':[]};var _0x4d2e50=_[_0x7beb('0x2b')](db[_0x7beb('0x2c')]['rawAttributes'],function(_0x49b6b9){return{'name':_0x49b6b9['fieldName'],'type':_0x49b6b9[_0x7beb('0x2d')]['key']};});_0x17ec78['model']=_[_0x7beb('0x2b')](_0x4d2e50,_0x7beb('0x29'));_0x17ec78[_0x7beb('0x2e')]=_[_0x7beb('0x2f')](_0x51f24e[_0x7beb('0x2e')]);_0x17ec78['filters']=_['intersection'](_0x17ec78['model'],_0x17ec78[_0x7beb('0x2e')]);_0x948ff6[_0x7beb('0x30')]=_['intersection'](_0x17ec78['model'],qs[_0x7beb('0x31')](_0x51f24e[_0x7beb('0x2e')]['fields']));_0x948ff6[_0x7beb('0x30')]=_0x948ff6[_0x7beb('0x30')][_0x7beb('0x32')]?_0x948ff6['attributes']:_0x17ec78['model'];if(!_0x51f24e['query'][_0x7beb('0x33')]('nolimit')){_0x948ff6[_0x7beb('0x1c')]=qs['limit'](_0x51f24e[_0x7beb('0x2e')][_0x7beb('0x1c')]);_0x948ff6[_0x7beb('0x1a')]=qs[_0x7beb('0x1a')](_0x51f24e['query'][_0x7beb('0x1a')]);}_0x948ff6['order']=qs[_0x7beb('0x34')](_0x51f24e[_0x7beb('0x2e')]['sort']);_0x948ff6['where']=qs[_0x7beb('0x35')](_['pick'](_0x51f24e[_0x7beb('0x2e')],_0x17ec78[_0x7beb('0x35')]),_0x4d2e50);if(_0x51f24e[_0x7beb('0x2e')][_0x7beb('0x36')]){_0x948ff6[_0x7beb('0x37')]=_[_0x7beb('0x38')](_0x948ff6[_0x7beb('0x37')],{'$or':_[_0x7beb('0x2b')](_0x4d2e50,function(_0x9fd153){if(_0x9fd153['type']!==_0x7beb('0x39')){var _0x2b315e={};_0x2b315e[_0x9fd153[_0x7beb('0x29')]]={'$like':'%'+_0x51f24e[_0x7beb('0x2e')]['filter']+'%'};return _0x2b315e;}})});}_0x948ff6=_[_0x7beb('0x38')]({},_0x948ff6,_0x51f24e[_0x7beb('0x3a')]);var _0x5302c9={'where':_0x948ff6[_0x7beb('0x37')]};return db[_0x7beb('0x2c')][_0x7beb('0x1d')](_0x5302c9)[_0x7beb('0x25')](function(_0x1f245e){_0x4018ed['count']=_0x1f245e;if(_0x51f24e[_0x7beb('0x2e')][_0x7beb('0x3b')]){_0x948ff6[_0x7beb('0x3c')]=[{'all':!![]}];}return db[_0x7beb('0x2c')][_0x7beb('0x3d')](_0x948ff6);})[_0x7beb('0x25')](function(_0x5153b5){_0x4018ed['rows']=_0x5153b5;return _0x4018ed;})['then'](respondWithFilteredResult(_0x17497d,_0x948ff6))[_0x7beb('0x3e')](handleError(_0x17497d,null));};exports[_0x7beb('0x3f')]=function(_0x28a2ed,_0x257095){var _0x2feb5c={'raw':!![],'where':{'id':_0x28a2ed[_0x7beb('0x40')]['id']}},_0x20fe7b={};_0x20fe7b[_0x7beb('0x41')]=_[_0x7beb('0x2f')](db[_0x7beb('0x2c')][_0x7beb('0x42')]);_0x20fe7b['query']=_[_0x7beb('0x2f')](_0x28a2ed[_0x7beb('0x2e')]);_0x20fe7b[_0x7beb('0x35')]=_['intersection'](_0x20fe7b[_0x7beb('0x41')],_0x20fe7b[_0x7beb('0x2e')]);_0x2feb5c[_0x7beb('0x30')]=_[_0x7beb('0x43')](_0x20fe7b[_0x7beb('0x41')],qs[_0x7beb('0x31')](_0x28a2ed[_0x7beb('0x2e')][_0x7beb('0x31')]));_0x2feb5c[_0x7beb('0x30')]=_0x2feb5c[_0x7beb('0x30')][_0x7beb('0x32')]?_0x2feb5c['attributes']:_0x20fe7b['model'];if(_0x28a2ed[_0x7beb('0x2e')][_0x7beb('0x3b')]){_0x2feb5c[_0x7beb('0x3c')]=[{'all':!![]}];}_0x2feb5c=_[_0x7beb('0x38')]({},_0x2feb5c,_0x28a2ed['options']);return db[_0x7beb('0x2c')][_0x7beb('0x44')](_0x2feb5c)[_0x7beb('0x25')](handleEntityNotFound(_0x257095,null))['then'](respondWithResult(_0x257095,null))[_0x7beb('0x3e')](handleError(_0x257095,null));};exports[_0x7beb('0x45')]=function(_0x223454,_0x437a1c){return db[_0x7beb('0x2c')][_0x7beb('0x45')](_0x223454[_0x7beb('0x46')],{})['then'](respondWithResult(_0x437a1c,0xc9))[_0x7beb('0x3e')](handleError(_0x437a1c,null));};exports[_0x7beb('0x24')]=function(_0x2023ee,_0x22bb0e){if(_0x2023ee[_0x7beb('0x46')]['id']){delete _0x2023ee[_0x7beb('0x46')]['id'];}return db[_0x7beb('0x2c')]['find']({'where':{'id':_0x2023ee['params']['id']}})[_0x7beb('0x25')](handleEntityNotFound(_0x22bb0e,null))[_0x7beb('0x25')](saveUpdates(_0x2023ee[_0x7beb('0x46')],null))[_0x7beb('0x25')](respondWithResult(_0x22bb0e,null))[_0x7beb('0x3e')](handleError(_0x22bb0e,null));};exports[_0x7beb('0x26')]=function(_0x32bc52,_0x2bfb83){return db[_0x7beb('0x2c')][_0x7beb('0x44')]({'where':{'id':_0x32bc52[_0x7beb('0x40')]['id']}})['then'](handleEntityNotFound(_0x2bfb83,null))[_0x7beb('0x25')](removeEntity(_0x2bfb83,null))[_0x7beb('0x3e')](handleError(_0x2bfb83,null));};exports[_0x7beb('0x47')]=function(_0x6f8813,_0x254aa1){return db['ChatTransferReport'][_0x7beb('0x47')]()[_0x7beb('0x25')](respondWithResult(_0x254aa1,null))[_0x7beb('0x3e')](handleError(_0x254aa1,null));}; \ No newline at end of file +var _0xae35=['papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','end','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','include','findAll','params','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring'];(function(_0x48a6e7,_0x5e9ecf){var _0x428fa7=function(_0x5e691a){while(--_0x5e691a){_0x48a6e7['push'](_0x48a6e7['shift']());}};_0x428fa7(++_0x5e9ecf);}(_0xae35,0x7b));var _0x5ae3=function(_0x294649,_0x4c0712){_0x294649=_0x294649-0x0;var _0x1225a8=_0xae35[_0x294649];return _0x1225a8;};'use strict';var emlformat=require(_0x5ae3('0x0'));var rimraf=require(_0x5ae3('0x1'));var zipdir=require(_0x5ae3('0x2'));var jsonpatch=require(_0x5ae3('0x3'));var rp=require(_0x5ae3('0x4'));var moment=require(_0x5ae3('0x5'));var BPromise=require(_0x5ae3('0x6'));var Mustache=require(_0x5ae3('0x7'));var util=require(_0x5ae3('0x8'));var path=require(_0x5ae3('0x9'));var sox=require(_0x5ae3('0xa'));var csv=require('to-csv');var ejs=require(_0x5ae3('0xb'));var fs=require('fs');var fs_extra=require(_0x5ae3('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5ae3('0xd'));var deskjs=require(_0x5ae3('0xe'));var toCsv=require(_0x5ae3('0xf'));var querystring=require(_0x5ae3('0x10'));var Papa=require(_0x5ae3('0x11'));var Redis=require(_0x5ae3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5ae3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ae3('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x5ae3('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f974d,_0x19f66a){_0x19f66a=_0x19f66a||0xcc;return function(_0x5cb990){if(_0x5cb990){return _0x4f974d[_0x5ae3('0x16')](_0x19f66a);}return _0x4f974d['status'](_0x19f66a)['end']();};}function respondWithResult(_0x47b657,_0x3e8907){_0x3e8907=_0x3e8907||0xc8;return function(_0x2b7f95){if(_0x2b7f95){return _0x47b657[_0x5ae3('0x17')](_0x3e8907)[_0x5ae3('0x18')](_0x2b7f95);}};}function respondWithFilteredResult(_0xc8eb21,_0x3b4982){return function(_0x1dd78b){if(_0x1dd78b){var _0x17cf57=typeof _0x3b4982[_0x5ae3('0x19')]===_0x5ae3('0x1a')&&typeof _0x3b4982[_0x5ae3('0x1b')]===_0x5ae3('0x1a');var _0x28d2db=_0x1dd78b[_0x5ae3('0x1c')];var _0x2d88d1=_0x17cf57?0x0:_0x3b4982[_0x5ae3('0x19')];var _0x2083b8=_0x17cf57?_0x1dd78b['count']:_0x3b4982['offset']+_0x3b4982[_0x5ae3('0x1b')];var _0xed1955;if(_0x2083b8>=_0x28d2db){_0x2083b8=_0x28d2db;_0xed1955=0xc8;}else{_0xed1955=0xce;}_0xc8eb21['status'](_0xed1955);return _0xc8eb21[_0x5ae3('0x1d')]('Content-Range',_0x2d88d1+'-'+_0x2083b8+'/'+_0x28d2db)[_0x5ae3('0x18')](_0x1dd78b);}return null;};}function patchUpdates(_0x1e0005){return function(_0x43cc98){try{jsonpatch[_0x5ae3('0x1e')](_0x43cc98,_0x1e0005,!![]);}catch(_0xa9e73){return BPromise['reject'](_0xa9e73);}return _0x43cc98[_0x5ae3('0x1f')]();};}function saveUpdates(_0x3f6c55,_0x4c218c){return function(_0x413a7f){if(_0x413a7f){return _0x413a7f[_0x5ae3('0x20')](_0x3f6c55)[_0x5ae3('0x21')](function(_0x30530b){return _0x30530b;});}return null;};}function removeEntity(_0x494534,_0x22188f){return function(_0x3c8816){if(_0x3c8816){return _0x3c8816['destroy']()['then'](function(){_0x494534['status'](0xcc)[_0x5ae3('0x22')]();});}};}function handleEntityNotFound(_0x1196ff,_0x380521){return function(_0x2f54af){if(!_0x2f54af){_0x1196ff[_0x5ae3('0x16')](0x194);}return _0x2f54af;};}function handleError(_0x28e1ca,_0x20f4b0){_0x20f4b0=_0x20f4b0||0x1f4;return function(_0x3a0fcf){logger[_0x5ae3('0x23')](_0x3a0fcf[_0x5ae3('0x24')]);if(_0x3a0fcf[_0x5ae3('0x25')]){delete _0x3a0fcf[_0x5ae3('0x25')];}_0x28e1ca[_0x5ae3('0x17')](_0x20f4b0)[_0x5ae3('0x26')](_0x3a0fcf);};}exports[_0x5ae3('0x27')]=function(_0x40e6b4,_0x4ad139){var _0x24029c={},_0x591f10={},_0xf29ba8={'count':0x0,'rows':[]};var _0x225c2e=_[_0x5ae3('0x28')](db[_0x5ae3('0x29')][_0x5ae3('0x2a')],function(_0x1bd406){return{'name':_0x1bd406['fieldName'],'type':_0x1bd406[_0x5ae3('0x2b')]['key']};});_0x591f10[_0x5ae3('0x2c')]=_['map'](_0x225c2e,'name');_0x591f10['query']=_[_0x5ae3('0x2d')](_0x40e6b4[_0x5ae3('0x2e')]);_0x591f10['filters']=_[_0x5ae3('0x2f')](_0x591f10[_0x5ae3('0x2c')],_0x591f10[_0x5ae3('0x2e')]);_0x24029c[_0x5ae3('0x30')]=_['intersection'](_0x591f10[_0x5ae3('0x2c')],qs['fields'](_0x40e6b4[_0x5ae3('0x2e')][_0x5ae3('0x31')]));_0x24029c[_0x5ae3('0x30')]=_0x24029c[_0x5ae3('0x30')][_0x5ae3('0x32')]?_0x24029c[_0x5ae3('0x30')]:_0x591f10['model'];if(!_0x40e6b4['query'][_0x5ae3('0x33')](_0x5ae3('0x34'))){_0x24029c[_0x5ae3('0x1b')]=qs['limit'](_0x40e6b4[_0x5ae3('0x2e')][_0x5ae3('0x1b')]);_0x24029c[_0x5ae3('0x19')]=qs[_0x5ae3('0x19')](_0x40e6b4[_0x5ae3('0x2e')][_0x5ae3('0x19')]);}_0x24029c[_0x5ae3('0x35')]=qs[_0x5ae3('0x36')](_0x40e6b4[_0x5ae3('0x2e')][_0x5ae3('0x36')]);_0x24029c['where']=qs[_0x5ae3('0x37')](_[_0x5ae3('0x38')](_0x40e6b4[_0x5ae3('0x2e')],_0x591f10[_0x5ae3('0x37')]),_0x225c2e);if(_0x40e6b4[_0x5ae3('0x2e')][_0x5ae3('0x39')]){_0x24029c['where']=_[_0x5ae3('0x3a')](_0x24029c[_0x5ae3('0x3b')],{'$or':_[_0x5ae3('0x28')](_0x225c2e,function(_0x96f71d){if(_0x96f71d[_0x5ae3('0x2b')]!==_0x5ae3('0x3c')){var _0x5eb838={};_0x5eb838[_0x96f71d[_0x5ae3('0x25')]]={'$like':'%'+_0x40e6b4['query']['filter']+'%'};return _0x5eb838;}})});}_0x24029c=_[_0x5ae3('0x3a')]({},_0x24029c,_0x40e6b4[_0x5ae3('0x3d')]);var _0x4e3af5={'where':_0x24029c[_0x5ae3('0x3b')]};return db[_0x5ae3('0x29')][_0x5ae3('0x1c')](_0x4e3af5)['then'](function(_0x5eac03){_0xf29ba8[_0x5ae3('0x1c')]=_0x5eac03;if(_0x40e6b4[_0x5ae3('0x2e')]['includeAll']){_0x24029c[_0x5ae3('0x3e')]=[{'all':!![]}];}return db[_0x5ae3('0x29')][_0x5ae3('0x3f')](_0x24029c);})[_0x5ae3('0x21')](function(_0x55c05e){_0xf29ba8['rows']=_0x55c05e;return _0xf29ba8;})['then'](respondWithFilteredResult(_0x4ad139,_0x24029c))['catch'](handleError(_0x4ad139,null));};exports['show']=function(_0x320f0f,_0x3ab133){var _0x4e4be3={'raw':!![],'where':{'id':_0x320f0f[_0x5ae3('0x40')]['id']}},_0x23c363={};_0x23c363['model']=_[_0x5ae3('0x2d')](db[_0x5ae3('0x29')]['rawAttributes']);_0x23c363[_0x5ae3('0x2e')]=_[_0x5ae3('0x2d')](_0x320f0f['query']);_0x23c363[_0x5ae3('0x37')]=_[_0x5ae3('0x2f')](_0x23c363[_0x5ae3('0x2c')],_0x23c363[_0x5ae3('0x2e')]);_0x4e4be3[_0x5ae3('0x30')]=_[_0x5ae3('0x2f')](_0x23c363[_0x5ae3('0x2c')],qs[_0x5ae3('0x31')](_0x320f0f[_0x5ae3('0x2e')]['fields']));_0x4e4be3[_0x5ae3('0x30')]=_0x4e4be3[_0x5ae3('0x30')][_0x5ae3('0x32')]?_0x4e4be3[_0x5ae3('0x30')]:_0x23c363[_0x5ae3('0x2c')];if(_0x320f0f[_0x5ae3('0x2e')]['includeAll']){_0x4e4be3['include']=[{'all':!![]}];}_0x4e4be3=_['merge']({},_0x4e4be3,_0x320f0f[_0x5ae3('0x3d')]);return db[_0x5ae3('0x29')]['find'](_0x4e4be3)[_0x5ae3('0x21')](handleEntityNotFound(_0x3ab133,null))[_0x5ae3('0x21')](respondWithResult(_0x3ab133,null))[_0x5ae3('0x41')](handleError(_0x3ab133,null));};exports[_0x5ae3('0x42')]=function(_0x198f03,_0x57be84){return db[_0x5ae3('0x29')][_0x5ae3('0x42')](_0x198f03[_0x5ae3('0x43')],{})['then'](respondWithResult(_0x57be84,0xc9))[_0x5ae3('0x41')](handleError(_0x57be84,null));};exports['update']=function(_0x32b1f7,_0x16019e){if(_0x32b1f7[_0x5ae3('0x43')]['id']){delete _0x32b1f7['body']['id'];}return db[_0x5ae3('0x29')]['find']({'where':{'id':_0x32b1f7[_0x5ae3('0x40')]['id']}})[_0x5ae3('0x21')](handleEntityNotFound(_0x16019e,null))[_0x5ae3('0x21')](saveUpdates(_0x32b1f7[_0x5ae3('0x43')],null))[_0x5ae3('0x21')](respondWithResult(_0x16019e,null))[_0x5ae3('0x41')](handleError(_0x16019e,null));};exports[_0x5ae3('0x44')]=function(_0x482872,_0x573c3e){return db[_0x5ae3('0x29')]['find']({'where':{'id':_0x482872[_0x5ae3('0x40')]['id']}})[_0x5ae3('0x21')](handleEntityNotFound(_0x573c3e,null))[_0x5ae3('0x21')](removeEntity(_0x573c3e,null))[_0x5ae3('0x41')](handleError(_0x573c3e,null));};exports['describe']=function(_0x37c690,_0x344b1f){return db['ChatTransferReport'][_0x5ae3('0x45')]()[_0x5ae3('0x21')](respondWithResult(_0x344b1f,null))['catch'](handleError(_0x344b1f,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 3fb8abc..e887951 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 _0x024c=['bluebird','request-promise','path','./chatTransferReport.attributes','define','uniqueid','lodash','util','api'];(function(_0x19584e,_0x528482){var _0x5725b0=function(_0x1b5759){while(--_0x1b5759){_0x19584e['push'](_0x19584e['shift']());}};_0x5725b0(++_0x528482);}(_0x024c,0x165));var _0xc024=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x024c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc024('0x0'));var util=require(_0xc024('0x1'));var logger=require('../../config/logger')(_0xc024('0x2'));var moment=require('moment');var BPromise=require(_0xc024('0x3'));var rp=require(_0xc024('0x4'));var fs=require('fs');var path=require(_0xc024('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc024('0x6'));module['exports']=function(_0x18a7ab,_0x5bf681){return _0x18a7ab[_0xc024('0x7')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xc024('0x8'),'fields':[_0xc024('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7b31=['./chatTransferReport.attributes','exports','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x39899b,_0x5596c6){var _0x3eeb44=function(_0x34b483){while(--_0x34b483){_0x39899b['push'](_0x39899b['shift']());}};_0x3eeb44(++_0x5596c6);}(_0x7b31,0xee));var _0x17b3=function(_0x34fa36,_0x44121c){_0x34fa36=_0x34fa36-0x0;var _0x4acc08=_0x7b31[_0x34fa36];return _0x4acc08;};'use strict';var _=require(_0x17b3('0x0'));var util=require(_0x17b3('0x1'));var logger=require(_0x17b3('0x2'))(_0x17b3('0x3'));var moment=require(_0x17b3('0x4'));var BPromise=require(_0x17b3('0x5'));var rp=require(_0x17b3('0x6'));var fs=require('fs');var path=require(_0x17b3('0x7'));var rimraf=require('rimraf');var config=require(_0x17b3('0x8'));var attributes=require(_0x17b3('0x9'));module[_0x17b3('0xa')]=function(_0x58b47b,_0x2168b6){return _0x58b47b['define']('ChatTransferReport',attributes,{'tableName':_0x17b3('0xb'),'paranoid':![],'indexes':[{'name':_0x17b3('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 9b2f73f..a87fc23 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 _0x417c=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x1c532a,_0x791a93){var _0x16e144=function(_0x4544b2){while(--_0x4544b2){_0x1c532a['push'](_0x1c532a['shift']());}};_0x16e144(++_0x791a93);}(_0x417c,0xcc));var _0xc417=function(_0x19f968,_0x1b28af){_0x19f968=_0x19f968-0x0;var _0x1732ae=_0x417c[_0x19f968];return _0x1732ae;};'use strict';var _=require(_0xc417('0x0'));var util=require(_0xc417('0x1'));var moment=require(_0xc417('0x2'));var BPromise=require(_0xc417('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc417('0x4'));var db=require(_0xc417('0x5'))['db'];var utils=require(_0xc417('0x6'));var logger=require(_0xc417('0x7'))('rpc');var config=require(_0xc417('0x8'));var jayson=require(_0xc417('0x9'));var client=jayson[_0xc417('0xa')][_0xc417('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52195d,_0x300226,_0x53ce35){return new BPromise(function(_0x18452f,_0x12c3fa){return client[_0xc417('0xc')](_0x52195d,_0x53ce35)[_0xc417('0xd')](function(_0x354e85){logger[_0xc417('0xe')](_0xc417('0xf'),_0x300226,_0xc417('0x10'));logger[_0xc417('0x11')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x300226,_0xc417('0x10'),JSON[_0xc417('0x12')](_0x354e85));if(_0x354e85[_0xc417('0x13')]){if(_0x354e85[_0xc417('0x13')][_0xc417('0x14')]===0x1f4){logger[_0xc417('0x13')](_0xc417('0xf'),_0x300226,_0x354e85['error'][_0xc417('0x15')]);return _0x12c3fa(_0x354e85[_0xc417('0x13')][_0xc417('0x15')]);}logger['error'](_0xc417('0xf'),_0x300226,_0x354e85[_0xc417('0x13')][_0xc417('0x15')]);return _0x18452f(_0x354e85[_0xc417('0x13')][_0xc417('0x15')]);}else{logger[_0xc417('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x300226,_0xc417('0x10'));_0x18452f(_0x354e85['result']['message']);}})[_0xc417('0x16')](function(_0x573186){logger[_0xc417('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x300226,_0x573186);_0x12c3fa(_0x573186);});});} \ No newline at end of file +var _0xbac3=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x3e4f43,_0x224773){var _0x30f56c=function(_0x381a0f){while(--_0x381a0f){_0x3e4f43['push'](_0x3e4f43['shift']());}};_0x30f56c(++_0x224773);}(_0xbac3,0x1ef));var _0x3bac=function(_0x13eaae,_0x11ec0a){_0x13eaae=_0x13eaae-0x0;var _0x4493db=_0xbac3[_0x13eaae];return _0x4493db;};'use strict';var _=require(_0x3bac('0x0'));var util=require('util');var moment=require(_0x3bac('0x1'));var BPromise=require(_0x3bac('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3bac('0x3'));var db=require(_0x3bac('0x4'))['db'];var utils=require(_0x3bac('0x5'));var logger=require(_0x3bac('0x6'))(_0x3bac('0x7'));var config=require(_0x3bac('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3bac('0x9')][_0x3bac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x157915,_0x828d0f,_0x385dea){return new BPromise(function(_0x196987,_0x5cf8de){return client[_0x3bac('0xb')](_0x157915,_0x385dea)[_0x3bac('0xc')](function(_0x2e96d8){logger[_0x3bac('0xd')](_0x3bac('0xe'),_0x828d0f,'request\x20sent');logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x828d0f,_0x3bac('0xf'),JSON['stringify'](_0x2e96d8));if(_0x2e96d8['error']){if(_0x2e96d8['error']['code']===0x1f4){logger[_0x3bac('0x10')](_0x3bac('0xe'),_0x828d0f,_0x2e96d8[_0x3bac('0x10')][_0x3bac('0x11')]);return _0x5cf8de(_0x2e96d8[_0x3bac('0x10')][_0x3bac('0x11')]);}logger[_0x3bac('0x10')](_0x3bac('0xe'),_0x828d0f,_0x2e96d8[_0x3bac('0x10')][_0x3bac('0x11')]);return _0x196987(_0x2e96d8[_0x3bac('0x10')][_0x3bac('0x11')]);}else{logger[_0x3bac('0xd')](_0x3bac('0xe'),_0x828d0f,_0x3bac('0xf'));_0x196987(_0x2e96d8['result'][_0x3bac('0x11')]);}})[_0x3bac('0x12')](function(_0x222764){logger[_0x3bac('0x10')](_0x3bac('0xe'),_0x828d0f,_0x222764);_0x5cf8de(_0x222764);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 6204994..0de56ae 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 _0x5886=['destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','isAuthenticated','/describe','describe','get','show','post','create','/:id','update','delete'];(function(_0x1ebce2,_0x10e903){var _0x4a330c=function(_0x4fd810){while(--_0x4fd810){_0x1ebce2['push'](_0x1ebce2['shift']());}};_0x4a330c(++_0x10e903);}(_0x5886,0x191));var _0x6588=function(_0x915e8b,_0x316b37){_0x915e8b=_0x915e8b-0x0;var _0x1391a0=_0x5886[_0x915e8b];return _0x1391a0;};'use strict';var multer=require(_0x6588('0x0'));var util=require(_0x6588('0x1'));var path=require(_0x6588('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6588('0x3')]();var fs_extra=require(_0x6588('0x4'));var auth=require(_0x6588('0x5'));var interaction=require(_0x6588('0x6'));var config=require(_0x6588('0x7'));var controller=require(_0x6588('0x8'));router['get']('/',auth[_0x6588('0x9')](),controller['index']);router['get'](_0x6588('0xa'),auth[_0x6588('0x9')](),controller[_0x6588('0xb')]);router[_0x6588('0xc')]('/:id',auth[_0x6588('0x9')](),controller[_0x6588('0xd')]);router[_0x6588('0xe')]('/',auth['isAuthenticated'](),controller[_0x6588('0xf')]);router['put'](_0x6588('0x10'),auth[_0x6588('0x9')](),controller[_0x6588('0x11')]);router[_0x6588('0x12')](_0x6588('0x10'),auth[_0x6588('0x9')](),controller[_0x6588('0x13')]);module[_0x6588('0x14')]=router; \ No newline at end of file +var _0x517e=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','post','create'];(function(_0x46ef1d,_0x24926){var _0x49ce69=function(_0x5db4fc){while(--_0x5db4fc){_0x46ef1d['push'](_0x46ef1d['shift']());}};_0x49ce69(++_0x24926);}(_0x517e,0x115));var _0xe517=function(_0x136a67,_0x50cc82){_0x136a67=_0x136a67-0x0;var _0x4d3ed2=_0x517e[_0x136a67];return _0x4d3ed2;};'use strict';var multer=require(_0xe517('0x0'));var util=require(_0xe517('0x1'));var path=require(_0xe517('0x2'));var timeout=require(_0xe517('0x3'));var express=require(_0xe517('0x4'));var router=express[_0xe517('0x5')]();var fs_extra=require(_0xe517('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe517('0x7'));var config=require(_0xe517('0x8'));var controller=require('./chatTransferReport.controller');router['get']('/',auth[_0xe517('0x9')](),controller[_0xe517('0xa')]);router[_0xe517('0xb')](_0xe517('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xe517('0xb')](_0xe517('0xd'),auth[_0xe517('0x9')](),controller[_0xe517('0xe')]);router[_0xe517('0xf')]('/',auth['isAuthenticated'](),controller[_0xe517('0x10')]);router[_0xe517('0x11')](_0xe517('0xd'),auth[_0xe517('0x9')](),controller[_0xe517('0x12')]);router[_0xe517('0x13')](_0xe517('0xd'),auth['isAuthenticated'](),controller[_0xe517('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 1e78ba8..fa06c2e 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 _0x279b=['squared','We\x20are\x20here!','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','Send','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','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','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','address','STRING','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded'];(function(_0x2085f3,_0x50105b){var _0x384e3c=function(_0x235fa0){while(--_0x235fa0){_0x2085f3['push'](_0x2085f3['shift']());}};_0x384e3c(++_0x50105b);}(_0x279b,0x94));var _0xb279=function(_0x4b6086,_0x3b9028){_0x4b6086=_0x4b6086-0x0;var _0x4da986=_0x279b[_0x4b6086];return _0x4da986;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xb279('0x0'));module[_0xb279('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb279('0x2')},'description':{'type':Sequelize[_0xb279('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xb279('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xb279('0x4')},'key':{'type':Sequelize[_0xb279('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xb279('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xb279('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xb279('0x3')],'allowNull':![],'defaultValue':_0xb279('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xb279('0x3')],'allowNull':![],'defaultValue':_0xb279('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xb279('0x3')],'allowNull':![],'defaultValue':_0xb279('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xb279('0x3')],'allowNull':![],'defaultValue':_0xb279('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xb279('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xb279('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xb279('0x9')](_0xb279('0xa'),_0xb279('0xb')),'defaultValue':_0xb279('0xa')},'header_online':{'type':Sequelize[_0xb279('0x3')],'defaultValue':_0xb279('0xc')},'start_chat_button':{'type':Sequelize[_0xb279('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xb279('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xb279('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xb279('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xb279('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xb279('0x3')],'defaultValue':_0xb279('0xd')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xb279('0xe')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xb279('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xb279('0x3')],'defaultValue':_0xb279('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xb279('0x3')],'defaultValue':_0xb279('0x11')},'noteTitle':{'type':Sequelize[_0xb279('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xb279('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xb279('0x3')],'defaultValue':_0xb279('0x12')},'closingMessageButton':{'type':Sequelize[_0xb279('0x3')],'defaultValue':_0xb279('0x13')},'skipMessageButton':{'type':Sequelize[_0xb279('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xb279('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xb279('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xb279('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xb279('0x3')],'defaultValue':_0xb279('0x14')},'ratingType':{'type':Sequelize['ENUM'](_0xb279('0x15'),_0xb279('0x16')),'defaultValue':_0xb279('0x15')},'ratingStarsNumber':{'type':Sequelize[_0xb279('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xb279('0xe')],'defaultValue':function(){return JSON[_0xb279('0x17')]({'items':[{'type':_0xb279('0x18'),'variable':null,'config':{'placeholder':_0xb279('0x19'),'type':_0xb279('0x1a'),'required':!![]},'props':{'title':_0xb279('0x19'),'helpText':''}},{'type':'input','props':{'title':_0xb279('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xb279('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xb279('0x1b')](_0xb279('0x1c'))?JSON[_0xb279('0x1d')](this[_0xb279('0x1b')](_0xb279('0x1c'))):{};},'set':function(_0x502b66){return this[_0xb279('0x1e')](_0xb279('0x1c'),JSON['stringify'](_0x502b66));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xb279('0x18'),'props':{'title':_0xb279('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xb279('0x4'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':_0xb279('0x1f')},'props':{'title':'Comments','helpText':_0xb279('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0xb279('0x1b')](_0xb279('0x21'))?JSON[_0xb279('0x1d')](this[_0xb279('0x1b')](_0xb279('0x21'))):{};},'set':function(_0x95782d){return this[_0xb279('0x1e')]('offlineForm',JSON[_0xb279('0x17')](_0x95782d));}},'token':{'type':Sequelize[_0xb279('0x3')],'defaultValue':function(){return rs[_0xb279('0x22')]();}},'autoclose':{'type':Sequelize[_0xb279('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xb279('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xb279('0x3')]},'forwardOffline':{'type':Sequelize[_0xb279('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xb279('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xb279('0x23')},'waitingMessage':{'type':Sequelize[_0xb279('0x3')],'defaultValue':_0xb279('0x24')},'offlineMessageSubject':{'type':Sequelize[_0xb279('0x3')],'defaultValue':_0xb279('0x25')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xb279('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0xb279('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xb279('0x3')],'defaultValue':_0xb279('0x27')},'skipUnmanaged':{'type':Sequelize[_0xb279('0x3')],'defaultValue':_0xb279('0x28')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xb279('0x13')},'enableCustomerAttachment':{'type':Sequelize[_0xb279('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xb279('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xb279('0x3')]},'notificationTemplate':{'type':Sequelize[_0xb279('0xe')],'defaultValue':function(){return _0xb279('0x29');}},'notificationSound':{'type':Sequelize[_0xb279('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb279('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xb279('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xb279('0x3')],'defaultValue':_0xb279('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0xb279('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xb279('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xb279('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xb279('0x3')],'defaultValue':_0xb279('0x2b')},'messagesAlignment':{'type':Sequelize[_0xb279('0x3')],'defaultValue':_0xb279('0x2c')},'defaultTitle':{'type':Sequelize[_0xb279('0x3')]},'customerAvatar':{'type':Sequelize[_0xb279('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0xb279('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xb279('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xb279('0x3')],'allowNull':![],'defaultValue':_0xb279('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xb279('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb279('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb279('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xb279('0x3')],'defaultValue':_0xb279('0x2e')},'systemAvatar':{'type':Sequelize[_0xb279('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xb279('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0xb279('0x8')],'defaultValue':![],'comment':_0xb279('0x30'),'set':function(_0x2b7629){if(!_0x2b7629)this['setDataValue'](_0xb279('0x31'),null);this[_0xb279('0x1e')](_0xb279('0x32'),_0x2b7629);}},'vidaooEscalation':{'type':Sequelize[_0xb279('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xb279('0x3')]},'vidaooTopic':{'type':Sequelize[_0xb279('0x3')],'allowNull':![],'defaultValue':_0xb279('0x33')},'vidaooNote':{'type':Sequelize[_0xb279('0x3')],'defaultValue':function(){return _0xb279('0x34');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xb279('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xb279('0xe')]}}; \ No newline at end of file +var _0x2943=['New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Skip','Feedback','star','stringify','input','name','text','getDataValue','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'];(function(_0x19456a,_0x44ae21){var _0x4c7a95=function(_0x5e49ff){while(--_0x5e49ff){_0x19456a['push'](_0x19456a['shift']());}};_0x4c7a95(++_0x44ae21);}(_0x2943,0xe6));var _0x3294=function(_0x2bddf9,_0x22c873){_0x2bddf9=_0x2bddf9-0x0;var _0x3f3ae9=_0x2943[_0x2bddf9];return _0x3f3ae9;};'use strict';var Sequelize=require(_0x3294('0x0'));var rs=require(_0x3294('0x1'));module[_0x3294('0x2')]={'name':{'type':Sequelize[_0x3294('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3294('0x4')},'description':{'type':Sequelize[_0x3294('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x3294('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x3294('0x6')},'customerAlias':{'type':Sequelize[_0x3294('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x3294('0x3')],'allowNull':![],'defaultValue':_0x3294('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3294('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3294('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3294('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x3294('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x3294('0xa')](_0x3294('0xb'),_0x3294('0xc')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0xd')},'start_chat_button':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x3294('0xf')},'header_offline':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0x10')},'download_transcript':{'type':Sequelize[_0x3294('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x3294('0x11')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x3294('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x3294('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x3294('0x12')]},'closingQuestion':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0x13')},'formSubmitSuccessMessage':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0x14')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3294('0x15')},'noteTitle':{'type':Sequelize[_0x3294('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3294('0x16')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0xf')},'skipMessageButton':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0x17')},'conditionAgreement':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0x18')},'ratingType':{'type':Sequelize[_0x3294('0xa')](_0x3294('0x19'),'thumb'),'defaultValue':_0x3294('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x3294('0x11')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x3294('0x12')],'defaultValue':function(){return JSON[_0x3294('0x1a')]({'items':[{'type':_0x3294('0x1b'),'variable':null,'config':{'placeholder':_0x3294('0x1c'),'type':_0x3294('0x1d'),'required':!![]},'props':{'title':_0x3294('0x1c'),'helpText':''}},{'type':_0x3294('0x1b'),'props':{'title':_0x3294('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x3294('0x5'),'type':_0x3294('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x3294('0x1e')](_0x3294('0x1f'))?JSON['parse'](this['getDataValue'](_0x3294('0x1f'))):{};},'set':function(_0x1b904b){return this[_0x3294('0x20')](_0x3294('0x1f'),JSON[_0x3294('0x1a')](_0x1b904b));}},'offlineForm':{'type':Sequelize[_0x3294('0x12')],'defaultValue':function(){return JSON[_0x3294('0x1a')]({'items':[{'type':_0x3294('0x1b'),'props':{'title':_0x3294('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x3294('0x5'),'type':_0x3294('0x5')},'variable':null},{'type':_0x3294('0x21'),'config':{'placeholder':_0x3294('0x22')},'props':{'title':'Comments','helpText':_0x3294('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x3294('0x1e')](_0x3294('0x24'))?JSON[_0x3294('0x25')](this[_0x3294('0x1e')](_0x3294('0x24'))):{};},'set':function(_0x4811e5){return this[_0x3294('0x20')](_0x3294('0x24'),JSON[_0x3294('0x1a')](_0x4811e5));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x3294('0x26')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x3294('0x3')]},'forwardOffline':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x3294('0x3')]},'waitingTitle':{'type':Sequelize[_0x3294('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0x27')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x3294('0x28')},'offlineMessageBody':{'type':Sequelize[_0x3294('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0x29')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x3294('0x17')},'sendUnmanaged':{'type':Sequelize[_0x3294('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x3294('0x12')]},'showAgentAvatar':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x3294('0x12')],'defaultValue':function(){return _0x3294('0x2a');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x3294('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0x2c')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x3294('0x2d')},'messagesAlignment':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0x2e')},'defaultTitle':{'type':Sequelize[_0x3294('0x3')]},'customerAvatar':{'type':Sequelize[_0x3294('0x12')]},'showCustomerAvatar':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x3294('0x11')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x3294('0x3')],'allowNull':![],'defaultValue':_0x3294('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3294('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3294('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x3294('0x3')],'defaultValue':_0x3294('0x30')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3294('0x11')],'comment':_0x3294('0x31')},'mandatoryDisposition':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x59e320){if(!_0x59e320)this[_0x3294('0x20')](_0x3294('0x32'),null);this['setDataValue'](_0x3294('0x33'),_0x59e320);}},'vidaooEscalation':{'type':Sequelize[_0x3294('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x3294('0x3')]},'vidaooTopic':{'type':Sequelize[_0x3294('0x3')],'allowNull':![],'defaultValue':_0x3294('0x34')},'vidaooNote':{'type':Sequelize[_0x3294('0x3')],'defaultValue':function(){return _0x3294('0x35');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x3294('0x12')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index d7bb03b..f6760fa 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 _0x72b1=['fullname','internal','Tags','color','tag','getProactiveActions','getLicense','virtual','chatLicenseExceeded','readFileSync','server/files/chat/iframe.ejs','3.10.1','origin','http://localhost:9000','testWebsiteWithWildcard','x-real-ip','remoteAddress','replace','alignment','verticalAlignment','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','ISOLATION_LEVELS','findAndCountAll','priority','stack','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','path','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','../../errors/api','handleError','./helpers/wildcard-expressions','url','URL','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','client','http','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','get','ChatWebsites','UserProfileResource','name','send','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','x-real-port','referer','browser','version','%s\x20%s','unknown','device','model','format','vendor','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','key','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','body','address','split','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','describe','Disposition','pick','ChatWebsiteId','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','existsSync','getSystemAvatar','server/files/images/avatars/system_avatar.png','resolve','timezone','ifTime','chat','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','CmContact','No\x20available\x20attributes','updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','from','CmList','List','Contacts','DESC','ChatApplication','Applications','Interval','Intervals','interval','account','orderBy','asc','list','contact','headers','threadId','closed','Writing\x20on\x20closed\x20interaction','externalUrl','ChatInteraction','ContactId','interaction','firstName','lastName','messageId','created','autoclose','applications','push','close','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','Start','startRouting','EventManager','notify','offline','files','Sequelize','ValidationError','difference','createdAt','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','offline-chat','openNewInteraction','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','email','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','Owner'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x72b1,0x16e));var _0x172b=function(_0x30caaa,_0x3e3d1f){_0x30caaa=_0x30caaa-0x0;var _0x3b7b67=_0x72b1[_0x30caaa];return _0x3b7b67;};'use strict';var Mustache=require(_0x172b('0x0'));var util=require('util');var path=require(_0x172b('0x1'));var ejs=require(_0x172b('0x2'));var fs=require('fs');var fs_extra=require(_0x172b('0x3'));var _=require(_0x172b('0x4'));var querystring=require(_0x172b('0x5'));var htmlToText=require(_0x172b('0x6'));var Redis=require(_0x172b('0x7'));var jayson=require('jayson/promise');var qs=require(_0x172b('0x8'));var logger=require(_0x172b('0x9'))(_0x172b('0xa'));var config=require(_0x172b('0xb'));var APIBadRequestError=require('../../errors/api')[_0x172b('0xc')];var APINotFoundError=require('../../errors/api')[_0x172b('0xd')];var APIOutOfIntervalError=require('../../errors/api')[_0x172b('0xe')];var APIHandleError=require(_0x172b('0xf'))[_0x172b('0x10')];var APIConflictError=require(_0x172b('0xf'))['APIConflictError'];var wildcardUtils=require(_0x172b('0x11'));var URL=require(_0x172b('0x12'))[_0x172b('0x13')];var db=require(_0x172b('0x14'))['db'];config[_0x172b('0x15')]=_[_0x172b('0x16')](config[_0x172b('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x172b('0x17'))(new Redis(config[_0x172b('0x15')]));require(_0x172b('0x18'))['register'](socket);var client=jayson[_0x172b('0x19')]['http']({'port':0x232c});var client9002=jayson[_0x172b('0x19')][_0x172b('0x1a')]({'port':0x232a});var client9003=jayson['client'][_0x172b('0x1a')]({'port':0x232b});var client9001=jayson[_0x172b('0x19')][_0x172b('0x1a')]({'port':0x2329});function respondWithRpcPromise(_0xa28463,_0x5b0ab1,_0x5293ef,_0x3625bb){return new Promise(function(_0x34be39,_0x36af74){var _0x3c7fff=_0x3625bb||client;return _0x3c7fff['request'](_0xa28463,_0x5293ef)['then'](function(_0x10c80b){logger[_0x172b('0x1b')](_0x172b('0x1c'),_0x5b0ab1,_0x172b('0x1d'));logger[_0x172b('0x1e')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5b0ab1,_0x172b('0x1d'),JSON[_0x172b('0x1f')](_0x10c80b));if(_0x10c80b[_0x172b('0x20')]){if(_0x10c80b[_0x172b('0x20')][_0x172b('0x21')]===0x1f4){logger[_0x172b('0x20')](_0x172b('0x1c'),_0x5b0ab1,_0x10c80b['error']['message']);return _0x36af74(_0x10c80b['error']['message']);}logger[_0x172b('0x20')]('ChatWebsite,\x20%s,\x20%s',_0x5b0ab1,_0x10c80b[_0x172b('0x20')][_0x172b('0x22')]);return _0x34be39(_0x10c80b[_0x172b('0x20')][_0x172b('0x22')]);}else{logger[_0x172b('0x1b')](_0x172b('0x1c'),_0x5b0ab1,_0x172b('0x1d'));_0x34be39(_0x10c80b[_0x172b('0x23')][_0x172b('0x22')]);}})['catch'](function(_0x3858fc){logger[_0x172b('0x20')](_0x172b('0x1c'),_0x5b0ab1,_0x3858fc);_0x36af74(_0x3858fc);});});}function respondWithStatusCode(_0x29e1d4,_0x356c83){_0x356c83=_0x356c83||0xcc;return function(_0x778c29){if(_0x778c29){return _0x29e1d4[_0x172b('0x24')](_0x356c83);}return _0x29e1d4['status'](_0x356c83)[_0x172b('0x25')]();};}function respondWithResult(_0x22827a,_0x5c8603){_0x5c8603=_0x5c8603||0xc8;return function(_0x4263a1){if(_0x4263a1){return _0x22827a[_0x172b('0x26')](_0x5c8603)[_0x172b('0x27')](_0x4263a1);}};}function respondWithFilteredResult(_0xa58782,_0x15d79f){return function(_0x4bea8e){if(_0x4bea8e){var _0x9624f5=typeof _0x15d79f[_0x172b('0x28')]==='undefined'&&typeof _0x15d79f['limit']===_0x172b('0x29');var _0xe923f1=_0x4bea8e[_0x172b('0x2a')];var _0x17bce6=_0x9624f5?0x0:_0x15d79f[_0x172b('0x28')];var _0x1934ea=_0x9624f5?_0x4bea8e[_0x172b('0x2a')]:_0x15d79f[_0x172b('0x28')]+_0x15d79f[_0x172b('0x2b')];var _0x239161;if(_0x1934ea>=_0xe923f1){_0x1934ea=_0xe923f1;_0x239161=0xc8;}else{_0x239161=0xce;}_0xa58782[_0x172b('0x26')](_0x239161);return _0xa58782[_0x172b('0x2c')](_0x172b('0x2d'),_0x17bce6+'-'+_0x1934ea+'/'+_0xe923f1)[_0x172b('0x27')](_0x4bea8e);}return null;};}function saveUpdates(_0x32e35b){return function(_0x1095dd){if(_0x1095dd){return _0x1095dd[_0x172b('0x2e')](_0x32e35b)[_0x172b('0x2f')](function(_0x3cea35){return _0x3cea35;});}return null;};}function removeEntity(_0x2cd3fd){return function(_0x2e0d50){if(_0x2e0d50){return _0x2e0d50[_0x172b('0x30')]()[_0x172b('0x2f')](function(){var _0x20f962=_0x2e0d50[_0x172b('0x31')]({'plain':!![]});var _0x5d211b=_0x172b('0x32');return db[_0x172b('0x33')][_0x172b('0x30')]({'where':{'type':_0x5d211b,'resourceId':_0x20f962['id']}})['then'](function(){return _0x2e0d50;});})[_0x172b('0x2f')](function(){_0x2cd3fd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cc073){return function(_0x1009ae){if(!_0x1009ae){_0x5cc073['sendStatus'](0x194);}return _0x1009ae;};}function handleError(_0x4f68a9,_0x38e5cb){_0x38e5cb=_0x38e5cb||0x1f4;return function(_0x375cb6){logger[_0x172b('0x20')](_0x375cb6['stack']);if(_0x375cb6[_0x172b('0x34')]){delete _0x375cb6[_0x172b('0x34')];}_0x4f68a9[_0x172b('0x26')](_0x38e5cb)[_0x172b('0x35')](_0x375cb6);};}function createInteractionObject(_0x2f3e42,_0x3043ec,_0x3baff4,_0x35c397){var _0x40b14c=require(_0x172b('0x36'));var _0x460204=new _0x40b14c();var _0x27c5d8=_0x460204[_0x172b('0x37')](_0x3baff4[_0x172b('0x38')])[_0x172b('0x39')]();var _0x194d59=_0x3043ec[_0x172b('0x3a')];if(_0x3baff4[_0x172b('0x3b')]){_0x194d59=_0x3baff4[_0x172b('0x3b')];}else if(_0x3baff4['x-forwarded-for']){_0x194d59=_['first'](_0x3baff4[_0x172b('0x3c')]['split'](','));}return{'ContactId':_0x35c397['id'],'ChatWebsiteId':_0x2f3e42,'from':(_0x35c397['firstName']||'')+'\x20'+(_0x35c397['lastName']||''),'customerIp':_0x194d59,'customerPort':_0x3baff4[_0x172b('0x3d')]?_0x3baff4[_0x172b('0x3d')]:null,'referer':_0x3043ec[_0x172b('0x3e')],'browserName':_0x27c5d8['browser'][_0x172b('0x34')]&&_0x27c5d8[_0x172b('0x3f')][_0x172b('0x40')]?util['format'](_0x172b('0x41'),_0x27c5d8['browser'][_0x172b('0x34')],_0x27c5d8[_0x172b('0x3f')][_0x172b('0x40')]):_0x172b('0x42'),'browserVersion':_0x27c5d8[_0x172b('0x3f')][_0x172b('0x40')]||_0x172b('0x42'),'osName':util['format'](_0x172b('0x41'),_0x27c5d8['os'][_0x172b('0x34')],_0x27c5d8['os'][_0x172b('0x40')]),'osVersion':_0x27c5d8['os'][_0x172b('0x40')],'deviceModel':_0x27c5d8[_0x172b('0x43')][_0x172b('0x44')]&&_0x27c5d8['device']['vendor']?util[_0x172b('0x45')]('%s\x20%s\x20%s',_0x27c5d8['device']['model'],_0x27c5d8[_0x172b('0x43')][_0x172b('0x46')],_0x27c5d8[_0x172b('0x43')][_0x172b('0x47')]):null,'deviceVendor':_0x27c5d8['device'][_0x172b('0x46')],'deviceType':_0x27c5d8[_0x172b('0x43')][_0x172b('0x47')],'formData':JSON[_0x172b('0x1f')](_0x3043ec)};}exports[_0x172b('0x48')]=function(_0x464b4d,_0x5c178c){var _0x219e29={'include':[{'model':db[_0x172b('0x49')],'as':_0x172b('0x4a')}]},_0x17f786={},_0x3ab5a6={'count':0x0,'rows':[]};var _0x4f5b6c=_[_0x172b('0x4b')](db[_0x172b('0x4c')]['rawAttributes'],function(_0x5e1b0a){return{'name':_0x5e1b0a[_0x172b('0x4d')],'type':_0x5e1b0a[_0x172b('0x47')][_0x172b('0x4e')]};});_0x17f786['model']=_[_0x172b('0x4b')](_0x4f5b6c,'name');_0x17f786['query']=_[_0x172b('0x4f')](_0x464b4d[_0x172b('0x50')]);_0x17f786[_0x172b('0x51')]=_[_0x172b('0x52')](_0x17f786[_0x172b('0x44')],_0x17f786[_0x172b('0x50')]);_0x219e29[_0x172b('0x53')]=_[_0x172b('0x52')](_0x17f786[_0x172b('0x44')],qs[_0x172b('0x54')](_0x464b4d['query']['fields']));_0x219e29[_0x172b('0x53')]=_0x219e29[_0x172b('0x53')]['length']?_0x219e29['attributes']:_0x17f786[_0x172b('0x44')];if(!_0x464b4d[_0x172b('0x50')][_0x172b('0x55')](_0x172b('0x56'))){_0x219e29[_0x172b('0x2b')]=qs[_0x172b('0x2b')](_0x464b4d['query'][_0x172b('0x2b')]);_0x219e29['offset']=qs['offset'](_0x464b4d[_0x172b('0x50')][_0x172b('0x28')]);}_0x219e29[_0x172b('0x57')]=qs['sort'](_0x464b4d[_0x172b('0x50')][_0x172b('0x58')]);_0x219e29[_0x172b('0x59')]=qs['filters'](_['pick'](_0x464b4d[_0x172b('0x50')],_0x17f786[_0x172b('0x51')]),_0x4f5b6c);if(_0x464b4d[_0x172b('0x50')][_0x172b('0x5a')]){_0x219e29[_0x172b('0x59')]=_[_0x172b('0x5b')](_0x219e29[_0x172b('0x59')],{'$or':_[_0x172b('0x4b')](_0x4f5b6c,function(_0x503c4f){if(_0x503c4f[_0x172b('0x47')]!=='VIRTUAL'){var _0x47ff1b={};_0x47ff1b[_0x503c4f[_0x172b('0x34')]]={'$like':'%'+_0x464b4d['query'][_0x172b('0x5a')]+'%'};return _0x47ff1b;}})});}_0x219e29=_[_0x172b('0x5b')]({},_0x219e29,_0x464b4d[_0x172b('0x5c')]);var _0x4ced24={'where':_0x219e29[_0x172b('0x59')]};return db['ChatWebsite'][_0x172b('0x2a')](_0x4ced24)[_0x172b('0x2f')](function(_0x567de5){_0x3ab5a6[_0x172b('0x2a')]=_0x567de5;if(_0x464b4d['query'][_0x172b('0x5d')]){_0x219e29[_0x172b('0x5e')]=[{'all':!![]}];}return db[_0x172b('0x4c')][_0x172b('0x5f')](_0x219e29);})[_0x172b('0x2f')](function(_0x47e2bf){_0x3ab5a6[_0x172b('0x60')]=_0x47e2bf;return _0x3ab5a6;})[_0x172b('0x2f')](respondWithFilteredResult(_0x5c178c,_0x219e29))[_0x172b('0x61')](handleError(_0x5c178c,null));};exports[_0x172b('0x62')]=function(_0x535c3f,_0x24ccdd){var _0x49535f={'raw':![],'where':{'id':_0x535c3f[_0x172b('0x63')]['id']},'include':[{'model':db[_0x172b('0x49')],'as':_0x172b('0x4a')}]},_0x3c811b={};_0x3c811b[_0x172b('0x44')]=_[_0x172b('0x4f')](db['ChatWebsite'][_0x172b('0x64')]);_0x3c811b[_0x172b('0x50')]=_[_0x172b('0x4f')](_0x535c3f['query']);_0x3c811b[_0x172b('0x51')]=_['intersection'](_0x3c811b['model'],_0x3c811b[_0x172b('0x50')]);_0x49535f[_0x172b('0x53')]=_[_0x172b('0x52')](_0x3c811b[_0x172b('0x44')],qs[_0x172b('0x54')](_0x535c3f[_0x172b('0x50')][_0x172b('0x54')]));_0x49535f[_0x172b('0x53')]=_0x49535f[_0x172b('0x53')][_0x172b('0x65')]?_0x49535f['attributes']:_0x3c811b[_0x172b('0x44')];if(_0x535c3f[_0x172b('0x50')][_0x172b('0x5d')]){_0x49535f[_0x172b('0x5e')]=[{'all':!![]}];}_0x49535f=_[_0x172b('0x5b')]({},_0x49535f,_0x535c3f[_0x172b('0x5c')]);return db[_0x172b('0x4c')][_0x172b('0x66')](_0x49535f)[_0x172b('0x2f')](handleEntityNotFound(_0x24ccdd,null))[_0x172b('0x2f')](respondWithResult(_0x24ccdd,null))[_0x172b('0x61')](handleError(_0x24ccdd,null));};exports['create']=function(_0x2a8360,_0x248b32){var _0x41ebe4=null;_0x2a8360[_0x172b('0x67')][_0x172b('0x68')][_0x172b('0x69')](',')['forEach'](_0x575269=>{if(_0x575269[_0x172b('0x6a')]()!==''&&!wildcardUtils[_0x172b('0x6b')](_0x575269[_0x172b('0x6a')]())){_0x41ebe4=new APIBadRequestError('\x22'+_0x575269[_0x172b('0x6a')]()+_0x172b('0x6c'));}});if(_0x41ebe4){return handleError(_0x248b32,null)(_0x41ebe4);}return db[_0x172b('0x4c')][_0x172b('0x6d')](_0x2a8360['body'],{})[_0x172b('0x2f')](function(_0x324815){var _0x3faa9d=_0x2a8360[_0x172b('0x6e')][_0x172b('0x31')]({'plain':!![]});if(!_0x3faa9d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3faa9d[_0x172b('0x6f')]===_0x172b('0x6e')){var _0x493d1d=_0x324815[_0x172b('0x31')]({'plain':!![]});var _0x1d70d6='ChatWebsites';return db[_0x172b('0x70')][_0x172b('0x66')]({'where':{'name':_0x1d70d6,'userProfileId':_0x3faa9d[_0x172b('0x71')]},'raw':!![]})[_0x172b('0x2f')](function(_0x52b76e){if(_0x52b76e&&_0x52b76e[_0x172b('0x72')]===0x0){return db[_0x172b('0x33')]['create']({'name':_0x493d1d[_0x172b('0x34')],'resourceId':_0x493d1d['id'],'type':_0x52b76e['name'],'sectionId':_0x52b76e['id']},{})[_0x172b('0x2f')](function(){return _0x324815;});}else{return _0x324815;}})[_0x172b('0x61')](function(_0x5dfb63){logger[_0x172b('0x20')](_0x172b('0x73'),_0x5dfb63);throw _0x5dfb63;});}return _0x324815;})[_0x172b('0x2f')](respondWithResult(_0x248b32,0xc9))[_0x172b('0x61')](handleError(_0x248b32,null));};exports[_0x172b('0x2e')]=function(_0x5d3b38,_0x9f9f46){var _0x2eab04=null;_0x5d3b38['body']['address'][_0x172b('0x69')](',')[_0x172b('0x74')](_0x506d51=>{if(_0x506d51[_0x172b('0x6a')]()!==''&&!wildcardUtils[_0x172b('0x6b')](_0x506d51[_0x172b('0x6a')]())){_0x2eab04=new APIBadRequestError('\x22'+_0x506d51[_0x172b('0x6a')]()+_0x172b('0x6c'));}});if(_0x2eab04){return handleError(_0x9f9f46,null)(_0x2eab04);}if(_0x5d3b38['body']['id']){delete _0x5d3b38['body']['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x5d3b38['params']['id']},'include':[{'model':db[_0x172b('0x49')],'as':_0x172b('0x4a')}]})['then'](handleEntityNotFound(_0x9f9f46,null))[_0x172b('0x2f')](saveUpdates(_0x5d3b38[_0x172b('0x67')],null))[_0x172b('0x2f')](respondWithResult(_0x9f9f46,null))[_0x172b('0x61')](handleError(_0x9f9f46,null));};exports[_0x172b('0x30')]=function(_0x21e7cb,_0x5aca7f){return db[_0x172b('0x4c')][_0x172b('0x66')]({'where':{'id':_0x21e7cb[_0x172b('0x63')]['id']}})[_0x172b('0x2f')](handleEntityNotFound(_0x5aca7f,null))[_0x172b('0x2f')](removeEntity(_0x5aca7f,null))[_0x172b('0x61')](handleError(_0x5aca7f,null));};exports['describe']=function(_0x2b1d80,_0x236c5f){return db[_0x172b('0x4c')][_0x172b('0x75')]()['then'](respondWithResult(_0x236c5f,null))[_0x172b('0x61')](handleError(_0x236c5f,null));};exports['addDisposition']=function(_0x1efbc,_0x4395a4){if(_0x1efbc[_0x172b('0x67')]['id']){delete _0x1efbc[_0x172b('0x67')]['id'];}return db[_0x172b('0x4c')][_0x172b('0x66')]({'where':{'id':_0x1efbc[_0x172b('0x63')]['id']}})[_0x172b('0x2f')](handleEntityNotFound(_0x4395a4,null))[_0x172b('0x2f')](function(_0x49f3d4){if(_0x49f3d4){_0x1efbc[_0x172b('0x67')]['ChatWebsiteId']=_0x49f3d4['id'];return db[_0x172b('0x76')][_0x172b('0x6d')](_0x1efbc[_0x172b('0x67')]);}})[_0x172b('0x2f')](respondWithResult(_0x4395a4,null))[_0x172b('0x61')](handleError(_0x4395a4,null));};exports['getDispositions']=function(_0x41e701,_0x43c5ab){var _0x5d4965={'raw':![],'where':{}};var _0x43b671={};var _0x65c14c={'count':0x0,'rows':[]};return db[_0x172b('0x4c')]['findOne']({'where':{'id':_0x41e701[_0x172b('0x63')]['id']}})[_0x172b('0x2f')](handleEntityNotFound(_0x43c5ab,null))[_0x172b('0x2f')](function(_0x33ca1a){if(_0x33ca1a){_0x43b671[_0x172b('0x44')]=_[_0x172b('0x4f')](db[_0x172b('0x76')]['rawAttributes']);_0x43b671[_0x172b('0x50')]=_[_0x172b('0x4f')](_0x41e701[_0x172b('0x50')]);_0x43b671[_0x172b('0x51')]=_[_0x172b('0x52')](_0x43b671[_0x172b('0x44')],_0x43b671[_0x172b('0x50')]);_0x5d4965[_0x172b('0x53')]=_['intersection'](_0x43b671[_0x172b('0x44')],qs[_0x172b('0x54')](_0x41e701[_0x172b('0x50')][_0x172b('0x54')]));_0x5d4965[_0x172b('0x53')]=_0x5d4965[_0x172b('0x53')][_0x172b('0x65')]?_0x5d4965[_0x172b('0x53')]:_0x43b671[_0x172b('0x44')];if(!_0x41e701[_0x172b('0x50')][_0x172b('0x55')]('nolimit')){_0x5d4965['limit']=qs['limit'](_0x41e701[_0x172b('0x50')][_0x172b('0x2b')]);_0x5d4965['offset']=qs['offset'](_0x41e701['query'][_0x172b('0x28')]);}_0x5d4965[_0x172b('0x57')]=qs[_0x172b('0x58')](_0x41e701['query'][_0x172b('0x58')]);_0x5d4965[_0x172b('0x59')]=qs[_0x172b('0x51')](_[_0x172b('0x77')](_0x41e701[_0x172b('0x50')],_0x43b671['filters']));_0x5d4965['where'][_0x172b('0x78')]=_0x33ca1a['id'];if(_0x41e701['query'][_0x172b('0x5a')]){_0x5d4965[_0x172b('0x59')]=_[_0x172b('0x5b')](_0x5d4965[_0x172b('0x59')],{'$or':_['map'](_0x5d4965['attributes'],function(_0x1095c2){var _0x4e769e={};_0x4e769e[_0x1095c2]={'$like':'%'+_0x41e701['query']['filter']+'%'};return _0x4e769e;})});}_0x5d4965=_[_0x172b('0x5b')]({},_0x5d4965,_0x41e701[_0x172b('0x5c')]);return db[_0x172b('0x76')][_0x172b('0x2a')]({'where':_0x5d4965['where']})[_0x172b('0x2f')](function(_0x53f256){_0x65c14c[_0x172b('0x2a')]=_0x53f256;if(_0x41e701[_0x172b('0x50')]['includeAll']){_0x5d4965[_0x172b('0x5e')]=[{'all':!![]}];}return db[_0x172b('0x76')][_0x172b('0x5f')](_0x5d4965);})['then'](function(_0x303db3){_0x65c14c['rows']=_0x303db3;return _0x65c14c;});}})[_0x172b('0x2f')](respondWithFilteredResult(_0x43c5ab,_0x5d4965))[_0x172b('0x61')](handleError(_0x43c5ab,null));};exports['removeDispositions']=function(_0x4e119b,_0x52ee00){return db[_0x172b('0x4c')][_0x172b('0x66')]({'where':{'id':_0x4e119b[_0x172b('0x63')]['id']}})[_0x172b('0x2f')](handleEntityNotFound(_0x52ee00,null))[_0x172b('0x2f')](function(_0x522a12){if(_0x522a12){return _0x522a12[_0x172b('0x79')](_0x4e119b[_0x172b('0x50')][_0x172b('0x7a')]);}})[_0x172b('0x2f')](respondWithStatusCode(_0x52ee00,null))['catch'](handleError(_0x52ee00,null));};exports[_0x172b('0x7b')]=function(_0x3b567b,_0x134972){if(_0x3b567b[_0x172b('0x67')]['id']){delete _0x3b567b[_0x172b('0x67')]['id'];}return db['ChatWebsite'][_0x172b('0x66')]({'where':{'id':_0x3b567b[_0x172b('0x63')]['id']}})[_0x172b('0x2f')](handleEntityNotFound(_0x134972,null))[_0x172b('0x2f')](function(_0x41141b){if(_0x41141b){_0x3b567b[_0x172b('0x67')][_0x172b('0x78')]=_0x41141b['id'];return db['CannedAnswer'][_0x172b('0x6d')](_0x3b567b[_0x172b('0x67')]);}})['then'](respondWithResult(_0x134972,null))[_0x172b('0x61')](handleError(_0x134972,null));};exports[_0x172b('0x7c')]=function(_0x275923,_0x38ff90){var _0x2a75dc={'raw':![],'where':{}};var _0x53d171={};var _0x269630={'count':0x0,'rows':[]};return db[_0x172b('0x4c')][_0x172b('0x7d')]({'where':{'id':_0x275923[_0x172b('0x63')]['id']}})[_0x172b('0x2f')](handleEntityNotFound(_0x38ff90,null))['then'](function(_0x329ce2){if(_0x329ce2){_0x53d171[_0x172b('0x44')]=_[_0x172b('0x4f')](db[_0x172b('0x7e')]['rawAttributes']);_0x53d171[_0x172b('0x50')]=_[_0x172b('0x4f')](_0x275923['query']);_0x53d171[_0x172b('0x51')]=_['intersection'](_0x53d171[_0x172b('0x44')],_0x53d171[_0x172b('0x50')]);_0x2a75dc[_0x172b('0x53')]=_[_0x172b('0x52')](_0x53d171['model'],qs[_0x172b('0x54')](_0x275923['query'][_0x172b('0x54')]));_0x2a75dc[_0x172b('0x53')]=_0x2a75dc['attributes'][_0x172b('0x65')]?_0x2a75dc[_0x172b('0x53')]:_0x53d171['model'];if(!_0x275923[_0x172b('0x50')][_0x172b('0x55')]('nolimit')){_0x2a75dc[_0x172b('0x2b')]=qs[_0x172b('0x2b')](_0x275923[_0x172b('0x50')][_0x172b('0x2b')]);_0x2a75dc[_0x172b('0x28')]=qs[_0x172b('0x28')](_0x275923[_0x172b('0x50')][_0x172b('0x28')]);}_0x2a75dc[_0x172b('0x57')]=qs['sort'](_0x275923[_0x172b('0x50')][_0x172b('0x58')]);_0x2a75dc[_0x172b('0x59')]=qs[_0x172b('0x51')](_[_0x172b('0x77')](_0x275923['query'],_0x53d171[_0x172b('0x51')]));_0x2a75dc[_0x172b('0x59')][_0x172b('0x78')]=_0x329ce2['id'];if(_0x275923[_0x172b('0x50')][_0x172b('0x5a')]){_0x2a75dc['where']=_[_0x172b('0x5b')](_0x2a75dc[_0x172b('0x59')],{'$or':_[_0x172b('0x4b')](_0x2a75dc['attributes'],function(_0x15d603){var _0x18bf38={};_0x18bf38[_0x15d603]={'$like':'%'+_0x275923[_0x172b('0x50')]['filter']+'%'};return _0x18bf38;})});}_0x2a75dc=_[_0x172b('0x5b')]({},_0x2a75dc,_0x275923[_0x172b('0x5c')]);return db[_0x172b('0x7e')][_0x172b('0x2a')]({'where':_0x2a75dc[_0x172b('0x59')]})['then'](function(_0x41a9a4){_0x269630[_0x172b('0x2a')]=_0x41a9a4;if(_0x275923[_0x172b('0x50')][_0x172b('0x5d')]){_0x2a75dc[_0x172b('0x5e')]=[{'all':!![]}];}return db[_0x172b('0x7e')][_0x172b('0x5f')](_0x2a75dc);})['then'](function(_0x413f5c){_0x269630[_0x172b('0x60')]=_0x413f5c;return _0x269630;});}})[_0x172b('0x2f')](respondWithFilteredResult(_0x38ff90,_0x2a75dc))['catch'](handleError(_0x38ff90,null));};exports['removeAnswers']=function(_0x7119c5,_0x5210ce){return db[_0x172b('0x4c')]['find']({'where':{'id':_0x7119c5[_0x172b('0x63')]['id']}})[_0x172b('0x2f')](handleEntityNotFound(_0x5210ce,null))[_0x172b('0x2f')](function(_0x5184b7){if(_0x5184b7){return _0x5184b7[_0x172b('0x7f')](_0x7119c5[_0x172b('0x50')][_0x172b('0x7a')]);}})[_0x172b('0x2f')](respondWithStatusCode(_0x5210ce,null))[_0x172b('0x61')](handleError(_0x5210ce,null));};exports[_0x172b('0x80')]=function(_0x5227b2,_0x150ca3){_0x5227b2[_0x172b('0x67')][_0x172b('0x81')]=_0x5227b2[_0x172b('0x82')][_0x172b('0x83')];return db[_0x172b('0x4c')][_0x172b('0x66')]({'where':{'id':_0x5227b2['params']['id']}})[_0x172b('0x2f')](handleEntityNotFound(_0x150ca3,null))['then'](saveUpdates(_0x5227b2[_0x172b('0x67')],null))[_0x172b('0x2f')](respondWithResult(_0x150ca3,null))['catch'](handleError(_0x150ca3,null));};exports[_0x172b('0x84')]=function(_0x5a4944,_0x5413a3){_0x5a4944[_0x172b('0x67')][_0x172b('0x85')]=_0x5a4944[_0x172b('0x82')][_0x172b('0x83')];return db[_0x172b('0x4c')][_0x172b('0x66')]({'where':{'id':_0x5a4944[_0x172b('0x63')]['id']}})[_0x172b('0x2f')](handleEntityNotFound(_0x5413a3,null))['then'](saveUpdates(_0x5a4944['body'],null))[_0x172b('0x2f')](respondWithResult(_0x5413a3,null))[_0x172b('0x61')](handleError(_0x5413a3,null));};exports[_0x172b('0x86')]=function(_0x2560a6,_0x1a0af0){_0x2560a6['body'][_0x172b('0x87')]=_0x2560a6['file'][_0x172b('0x83')];return db[_0x172b('0x4c')][_0x172b('0x66')]({'where':{'id':_0x2560a6[_0x172b('0x63')]['id']}})[_0x172b('0x2f')](handleEntityNotFound(_0x1a0af0,null))['then'](saveUpdates(_0x2560a6[_0x172b('0x67')],null))[_0x172b('0x2f')](respondWithResult(_0x1a0af0,null))[_0x172b('0x61')](handleError(_0x1a0af0,null));};exports[_0x172b('0x88')]=function(_0x2a431,_0xda2b81){_0x2a431[_0x172b('0x67')][_0x172b('0x89')]=_0x2a431[_0x172b('0x82')][_0x172b('0x83')];return db[_0x172b('0x4c')]['find']({'where':{'id':_0x2a431[_0x172b('0x63')]['id']}})[_0x172b('0x2f')](handleEntityNotFound(_0xda2b81,null))[_0x172b('0x2f')](saveUpdates(_0x2a431['body'],null))[_0x172b('0x2f')](respondWithResult(_0xda2b81,null))[_0x172b('0x61')](handleError(_0xda2b81,null));};exports[_0x172b('0x8a')]=function(_0x41f316,_0x2ef854){var _0x4e73d0=path[_0x172b('0x8b')](config['root'],_0x172b('0x8c'));var _0x1ed35d={'where':{'id':_0x41f316[_0x172b('0x63')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x429d06=![];return require(_0x172b('0x8d'))['getLicense']()[_0x172b('0x2f')](function(_0x20e64e){if(_0x20e64e){_0x429d06=_0x20e64e[_0x172b('0x8e')];}})['then'](function(){return db[_0x172b('0x4c')][_0x172b('0x66')](_0x1ed35d);})[_0x172b('0x2f')](handleEntityNotFound(_0x2ef854,null))[_0x172b('0x2f')](function(_0x5ee150){if(_0x5ee150){if(!_[_0x172b('0x8f')](_0x5ee150[_0x172b('0x81')])){if(fs['existsSync'](path[_0x172b('0x8b')](config[_0x172b('0x90')],_0x172b('0x91'),_0x5ee150[_0x172b('0x81')]))&&_0x429d06){_0x4e73d0=path[_0x172b('0x8b')](config['root'],_0x172b('0x91'),_0x5ee150[_0x172b('0x81')]);}}return _0x2ef854[_0x172b('0x92')](_0x4e73d0);}})[_0x172b('0x61')](handleError(_0x2ef854,null));};exports[_0x172b('0x93')]=function(_0x4e03a3,_0x5b771d){var _0x1ff832=path[_0x172b('0x8b')](config['root'],_0x172b('0x94'));var _0x539293={'where':{'id':_0x4e03a3[_0x172b('0x63')]['id']},'attributes':['id',_0x172b('0x85')],'raw':!![]};return db[_0x172b('0x4c')][_0x172b('0x66')](_0x539293)['then'](handleEntityNotFound(_0x5b771d,null))[_0x172b('0x2f')](function(_0x59daee){if(_0x59daee){if(!_[_0x172b('0x8f')](_0x59daee['agentAvatar'])){if(fs['existsSync'](path[_0x172b('0x8b')](config[_0x172b('0x90')],_0x172b('0x95'),_0x59daee[_0x172b('0x85')]))){_0x1ff832=path[_0x172b('0x8b')](config[_0x172b('0x90')],_0x172b('0x95'),_0x59daee[_0x172b('0x85')]);}}return _0x5b771d[_0x172b('0x92')](_0x1ff832);}})[_0x172b('0x61')](handleError(_0x5b771d,null));};exports[_0x172b('0x96')]=function(_0x38a076,_0x15295a){var _0x8fe274=path['join'](config[_0x172b('0x90')],_0x172b('0x97'));var _0xc03a5a={'where':{'id':_0x38a076[_0x172b('0x63')]['id']},'attributes':['id',_0x172b('0x87'),_0x172b('0x98')],'raw':!![]};return db['ChatWebsite'][_0x172b('0x66')](_0xc03a5a)[_0x172b('0x2f')](handleEntityNotFound(_0x15295a,null))[_0x172b('0x2f')](function(_0x45d2e4){if(_0x45d2e4){if(!_[_0x172b('0x8f')](_0x45d2e4[_0x172b('0x87')])){if(fs[_0x172b('0x99')](path['join'](config[_0x172b('0x90')],_0x172b('0x95'),_0x45d2e4[_0x172b('0x87')]))&&_0x45d2e4['showCustomerAvatar']){_0x8fe274=path[_0x172b('0x8b')](config[_0x172b('0x90')],_0x172b('0x95'),_0x45d2e4[_0x172b('0x87')]);}}return _0x15295a[_0x172b('0x92')](_0x8fe274);}})[_0x172b('0x61')](handleError(_0x15295a,null));};exports[_0x172b('0x9a')]=function(_0x2d313d,_0x3b3900){var _0x35be7d=path[_0x172b('0x8b')](config[_0x172b('0x90')],_0x172b('0x9b'));var _0x49106e={'where':{'id':_0x2d313d[_0x172b('0x63')]['id']},'attributes':['id',_0x172b('0x89')],'raw':!![]};return db['ChatWebsite']['find'](_0x49106e)[_0x172b('0x2f')](handleEntityNotFound(_0x3b3900,null))[_0x172b('0x2f')](function(_0x294b63){if(_0x294b63){if(!_[_0x172b('0x8f')](_0x294b63[_0x172b('0x89')])){if(fs[_0x172b('0x99')](path[_0x172b('0x8b')](config[_0x172b('0x90')],'server/files/images/avatars/',_0x294b63['systemAvatar']))){_0x35be7d=path[_0x172b('0x8b')](config[_0x172b('0x90')],_0x172b('0x95'),_0x294b63[_0x172b('0x89')]);}}return _0x3b3900[_0x172b('0x92')](_0x35be7d);}})[_0x172b('0x61')](handleError(_0x3b3900,null));};function checkWebsiteInterval(_0x5df397){var _0x358a7d=_0x5df397['Interval'];if(!_0x358a7d){return Promise[_0x172b('0x9c')](_0x5df397);}var _0x2ff65d=_0x5df397[_0x172b('0x9d')]||undefined;return _0x358a7d[_0x172b('0x9e')](_0x2ff65d)['then'](function(_0x109699){if(!_0x109699){throw new APIOutOfIntervalError();}return _0x5df397;});}exports['notify']=function(_0x1cc8cb,_0x1de322){var _0x243297={'body':_0x1cc8cb['body'],'channel':_0x172b('0x9f')};var _0x56cce8=[];var _0x169523=[];var _0x24b3c7={};var _0x181607=![];if(_0x1cc8cb[_0x172b('0x67')]['id']){delete _0x1cc8cb[_0x172b('0x67')]['id'];}if(_[_0x172b('0x8f')](_0x1cc8cb['body']['from'])){throw new APIBadRequestError(_0x172b('0xa0'));}if(_[_0x172b('0x8f')](_0x1cc8cb[_0x172b('0x67')][_0x172b('0xa1')])){throw new APIBadRequestError(_0x172b('0xa2'));}if(_['isEmpty'](_0x1cc8cb[_0x172b('0x67')][_0x172b('0x67')])){throw new APIBadRequestError('Body\x20is\x20mandatory');}var _0x5df98f=_0x1cc8cb[_0x172b('0x67')][_0x172b('0x3a')]&&_0x1cc8cb['body'][_0x172b('0x3e')];return db[_0x172b('0xa3')][_0x172b('0x75')]()['then'](function(_0x5981e4){if(!_0x5981e4){throw new Error(_0x172b('0xa4'));}_0x56cce8=Object[_0x172b('0x4f')](_0x5981e4)[_0x172b('0x5a')](function(_0x4f73d0){return!['createdAt',_0x172b('0xa5')][_0x172b('0xa6')](_0x4f73d0);});_0x169523=Object[_0x172b('0x4f')](_0x5981e4)['filter'](function(_0x143a69){return!['createdAt',_0x172b('0xa5'),_0x172b('0xa7'),_0x172b('0xa8')][_0x172b('0xa6')](_0x143a69);});if(!_[_0x172b('0xa6')](_0x169523,_0x1cc8cb['body'][_0x172b('0xa1')])){throw new APIBadRequestError(_0x172b('0xa9')+_0x169523[_0x172b('0x8b')](',\x20'));}_0x24b3c7[_0x1cc8cb['body'][_0x172b('0xa1')]]=_0x1cc8cb[_0x172b('0x67')][_0x172b('0xaa')];})[_0x172b('0x2f')](function(){return db[_0x172b('0x4c')]['find']({'where':{'id':_0x1cc8cb[_0x172b('0x63')]['id']},'include':[{'model':db[_0x172b('0xab')],'as':_0x172b('0xac'),'include':[{'model':db[_0x172b('0xa3')],'as':_0x172b('0xad'),'where':_0x24b3c7,'limit':0x1,'order':[[_0x172b('0xa5'),_0x172b('0xae')]]}]},{'model':db[_0x172b('0xaf')],'as':_0x172b('0xb0')},{'model':db[_0x172b('0xb1')],'as':'Interval','include':[{'model':db[_0x172b('0xb1')],'as':_0x172b('0xb2'),'attributes':['id',_0x172b('0xb3')],'raw':!![]}]}]});})[_0x172b('0x2f')](function(_0x322a33){if(!_0x322a33){throw new APINotFoundError(util[_0x172b('0x45')]('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x1cc8cb['params']['id']));}if(_0x5df98f){return checkWebsiteInterval(_0x322a33);}return _0x322a33;})[_0x172b('0x2f')](function(_0x4b1e98){_0x243297[_0x172b('0xb4')]=_0x4b1e98;_0x243297['applications']=_[_0x172b('0xb5')](_0x4b1e98[_0x172b('0xb0')],['priority'],[_0x172b('0xb6')]);if(_0x243297['account']['Applications']){delete _0x243297['account'][_0x172b('0xb0')];}_0x243297[_0x172b('0xb7')]=_0x4b1e98[_0x172b('0xac')]||{'id':_0x4b1e98['ListId']};if(_0x243297[_0x172b('0xb7')]&&_0x243297[_0x172b('0xb7')][_0x172b('0xad')][_0x172b('0x65')]){return _0x243297[_0x172b('0xb7')][_0x172b('0xad')][0x0];}var _0x1f0060=_[_0x172b('0x16')](_0x1cc8cb[_0x172b('0x67')],{'firstName':_0x1cc8cb[_0x172b('0x67')][_0x172b('0xaa')],'ListId':_0x4b1e98['ListId']});_0x1f0060[_0x1cc8cb[_0x172b('0x67')]['mapKey']]=_0x1cc8cb[_0x172b('0x67')][_0x172b('0xaa')];return db[_0x172b('0xa3')]['create'](_0x1f0060,{'fields':_0x56cce8,'raw':!![]});})[_0x172b('0x2f')](function(_0x347c7b){_0x243297[_0x172b('0xb8')]=_0x347c7b;var _0x16e344=createInteractionObject(_0x1cc8cb[_0x172b('0x63')]['id'],_0x1cc8cb[_0x172b('0x67')],_0x1cc8cb[_0x172b('0xb9')],_0x347c7b);var _0x493360={'ChatWebsiteId':_0x1cc8cb[_0x172b('0x63')]['id']};if(_0x1cc8cb[_0x172b('0x67')][_0x172b('0xba')]){_0x493360[_0x172b('0xba')]=_0x1cc8cb[_0x172b('0x67')][_0x172b('0xba')];_0x493360['closed']=![];return db['ChatInteraction'][_0x172b('0x66')]({'where':_0x493360})['then'](function(_0x1789c4){var _0x4931d0=_0x1cc8cb['body'][_0x172b('0x3a')]&&_0x1cc8cb[_0x172b('0x67')]['referer'];if(_0x1789c4){_0x181607=!![];return _0x1789c4;}else if(!_0x4931d0&&_0x1789c4&&_0x1789c4[_0x172b('0xbb')]){throw new APIConflictError(_0x172b('0xbc'));}_0x16e344['threadId']=_0x1cc8cb['body']['threadId'];_0x16e344[_0x172b('0xbd')]=_0x1cc8cb['body'][_0x172b('0xbd')];return db[_0x172b('0xbe')]['create'](_0x16e344);});}_0x493360[_0x172b('0xbf')]=_0x347c7b['id'];if(_0x1cc8cb[_0x172b('0x67')][_0x172b('0xc0')]&&_0x1cc8cb[_0x172b('0x67')][_0x172b('0xc0')]['id']){_0x493360['id']=_0x1cc8cb['body'][_0x172b('0xc0')]['id'];return db['ChatInteraction'][_0x172b('0x66')]({'where':_0x493360})[_0x172b('0x2f')](function(_0x30ab21){var _0x3472f2=_0x1cc8cb[_0x172b('0x67')][_0x172b('0x3a')]&&_0x1cc8cb[_0x172b('0x67')][_0x172b('0x3e')];if(!_0x3472f2&&_0x30ab21&&_0x30ab21[_0x172b('0xbb')]){throw new APIConflictError(_0x172b('0xbc'));}else if(_0x30ab21){_0x181607=!![];return _0x30ab21;}else{return db[_0x172b('0xbe')]['create'](_0x16e344);}});}return db[_0x172b('0xbe')][_0x172b('0x6d')](_0x16e344);})[_0x172b('0x2f')](function(_0x4e8ef7){if(!_0x181607){return _0x4e8ef7;}var _0x39d966={'from':(_0x243297[_0x172b('0xb8')][_0x172b('0xc1')]||'')+'\x20'+(_0x243297[_0x172b('0xb8')][_0x172b('0xc2')]||'')};if(_0x1cc8cb[_0x172b('0x67')]['threadId']&&_0x1cc8cb[_0x172b('0x67')][_0x172b('0xc3')]&&_0x1cc8cb['body'][_0x172b('0xba')]!=_0x1cc8cb['body'][_0x172b('0xc3')]){_0x39d966['threadId']=_0x1cc8cb['body'][_0x172b('0xc3')];}return _0x4e8ef7[_0x172b('0x2e')](_0x39d966);})['then'](function(_0x46eaa4){_0x243297[_0x172b('0xc0')]=_0x46eaa4[_0x172b('0x31')]({'plain':!![]});_0x243297['interaction'][_0x172b('0xc4')]=!_0x181607;if(_0x243297[_0x172b('0xc0')][_0x172b('0xc4')]){if(_0x243297[_0x172b('0xb4')][_0x172b('0xc5')]){_0x243297[_0x172b('0xc6')][_0x172b('0xc7')]({'id':0x0,'priority':_0x243297[_0x172b('0xc6')][_0x172b('0x65')]+0x1,'app':_0x172b('0xc8'),'appdata':_0x172b('0xc9'),'interval':_0x172b('0xca')});}}return db[_0x172b('0xcb')]['create']({'body':_0x1cc8cb[_0x172b('0x67')][_0x172b('0x67')],'ChatWebsiteId':_0x1cc8cb[_0x172b('0x63')]['id'],'ChatInteractionId':_0x46eaa4['id'],'direction':'in','ContactId':_0x243297[_0x172b('0xb8')]['id'],'AttachmentId':_0x1cc8cb[_0x172b('0x67')]['AttachmentId']});})[_0x172b('0x2f')](function(_0x42acd3){_0x243297[_0x172b('0x22')]=_0x42acd3;if(!_0x243297[_0x172b('0xc0')][_0x172b('0xcc')]){return;}return db[_0x172b('0xcd')][_0x172b('0x66')]({'attributes':['id',_0x172b('0x34')],'where':{'id':_0x243297['interaction'][_0x172b('0xcc')]}});})['then'](function(_0x59cfad){if(_0x59cfad){_0x243297[_0x172b('0xc6')][_0x172b('0xce')]({'id':0x0,'priority':0x0,'app':_0x172b('0xcf'),'appdata':_0x59cfad[_0x172b('0x34')]+','+(_0x243297[_0x172b('0xb4')][_0x172b('0xd0')]||0xa),'interval':_0x172b('0xca')});_0x243297[_0x172b('0xd1')]=!![];}if(!_0x243297['interaction'][_0x172b('0xd2')]){return;}return db[_0x172b('0xd3')][_0x172b('0x66')]({'attributes':['id','name'],'where':{'id':_0x243297[_0x172b('0xc0')][_0x172b('0xd2')]}});})[_0x172b('0x2f')](function(_0x19fb50){if(_0x19fb50){_0x243297[_0x172b('0xc6')][_0x172b('0xce')]({'id':0x0,'priority':0x1,'app':_0x172b('0xd4'),'appdata':_0x19fb50[_0x172b('0x34')]+','+(_0x243297[_0x172b('0xb4')]['waitForTheAssignedQueue']||0x12c),'interval':_0x172b('0xca')});}return respondWithRpcPromise(_0x172b('0xd5'),_0x172b('0xd6'),_0x243297);})[_0x172b('0x2f')](function(_0x5cd746){respondWithRpcPromise(_0x172b('0xd7'),_0x172b('0xd7'),{'event':_0x172b('0xd8'),'message':_0x5cd746},client9002);return _0x5cd746;})['then'](respondWithResult(_0x1de322,null))['catch'](APIHandleError(_0x1de322));};exports[_0x172b('0xd9')]=function(_0x4f4f4e,_0x5371e2){var _0x79420b,_0xcd69c9,_0x59082c;var _0x289394=[];var _0x2de1fb={};var _0x2b9fad=_0x4f4f4e[_0x172b('0xda')]||[];var _0x2e46ec=[];var _0x59e5ed;return db[_0x172b('0xa3')][_0x172b('0x75')]()[_0x172b('0x2f')](function(_0x223f97){if(!_0x223f97){throw new db[(_0x172b('0xdb'))][(_0x172b('0xdc'))]('no\x20available\x20attributes');}_0x289394=_[_0x172b('0xdd')](_[_0x172b('0x4f')](_0x223f97),[_0x172b('0xde'),_0x172b('0xa5'),_0x172b('0xa7'),_0x172b('0xa8')]);if(_0x4f4f4e[_0x172b('0x67')]['id']){delete _0x4f4f4e[_0x172b('0x67')]['id'];}if(_['isNil'](_0x4f4f4e[_0x172b('0x67')][_0x172b('0xaa')])){throw _0x5371e2[_0x172b('0x26')](0x1f4)[_0x172b('0x35')](new db[(_0x172b('0xdb'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0x172b('0x8f')](_0x4f4f4e[_0x172b('0x67')]['body'])||_0x4f4f4e[_0x172b('0x67')]['body']===''){throw _0x5371e2[_0x172b('0x26')](0x1f4)[_0x172b('0x35')](new db[(_0x172b('0xdb'))][(_0x172b('0xdc'))](_0x172b('0xdf')));}if(_[_0x172b('0x8f')](_0x4f4f4e[_0x172b('0x67')][_0x172b('0xe0')])){throw _0x5371e2[_0x172b('0x26')](0x1f4)[_0x172b('0x35')](new db[(_0x172b('0xdb'))][(_0x172b('0xdc'))](_0x172b('0xe1')+_0x289394));}if(!_[_0x172b('0xa6')](_0x289394,_0x4f4f4e[_0x172b('0x67')][_0x172b('0xe0')])){throw _0x5371e2[_0x172b('0x26')](0x1f4)[_0x172b('0x35')](new db[(_0x172b('0xdb'))]['ValidationError'](_0x172b('0xe2')+_0x289394));}_0x2de1fb[_0x4f4f4e[_0x172b('0x67')][_0x172b('0xe0')]]=_0x4f4f4e['body']['from'];})[_0x172b('0x2f')](function(){return db[_0x172b('0x4c')][_0x172b('0x66')]({'where':{'id':_0x4f4f4e[_0x172b('0x63')]['id']},'include':[{'model':db['CmList'],'as':_0x172b('0xac')},{'model':db[_0x172b('0xe3')],'as':'MailAccount'}]});})[_0x172b('0x2f')](handleEntityNotFound(_0x5371e2,null))[_0x172b('0x2f')](function(_0x4aa633){if(_0x4aa633&&_0x4aa633[_0x172b('0xac')]){_0xcd69c9=_0x4aa633;var _0x23842c=_[_0x172b('0x16')](_0x4f4f4e[_0x172b('0x67')],{'firstName':_0x4f4f4e['body'][_0x172b('0xaa')],'phone':_0x4f4f4e['body'][_0x172b('0xaa')],'ListId':_0x4aa633[_0x172b('0xa8')]});_0x23842c[_0x4f4f4e['body'][_0x172b('0xe0')]]=_0x4f4f4e[_0x172b('0x67')][_0x172b('0xaa')];return db[_0x172b('0xa3')][_0x172b('0xe4')]({'where':_0x2de1fb,'defaults':_0x23842c});}})[_0x172b('0xe5')](function(_0x31530f){if(_0x31530f){_0x59082c=_0x31530f;var _0x252bbb=fs['readFileSync'](path[_0x172b('0x8b')](config[_0x172b('0x90')],_0x172b('0xe6')),_0x172b('0xe7'));var _0xe538e9=ejs[_0x172b('0xe8')](_0x252bbb,{'body':_[_0x172b('0xe9')](_0x4f4f4e[_0x172b('0x67')][_0x172b('0x67')]),'bodyTitle':_0xcd69c9[_0x172b('0xea')]});return db[_0x172b('0xeb')][_0x172b('0x6d')]({'body':_0xe538e9,'plainBody':htmlToText[_0x172b('0xec')](_0xe538e9),'ContactId':_0x31530f['id'],'ChatWebsiteId':_0xcd69c9['id']});}})[_0x172b('0x2f')](function(_0x152700){_0x59e5ed=_0x152700;if(_0x2b9fad['length']){var _0x3902a9=_0x2b9fad[_0x172b('0x4b')](function(_0x353bcf){return{'name':_0x353bcf[_0x172b('0xed')],'basename':_0x353bcf[_0x172b('0x83')],'type':_0x353bcf[_0x172b('0xee')],'ChatOfflineMessageId':_0x152700['id']};});_0x2e46ec=_0x3902a9[_0x172b('0x4b')](_0x539f04=>{var _0x2f8e49={'filename':_0x539f04['name'],'path':path[_0x172b('0x8b')](config['root'],_0x172b('0xef'),_0x172b('0xda'),'attachments',_0x172b('0xf0'),_0x539f04['basename'])};return _0x2f8e49;});if(!_0xcd69c9[_0x172b('0xf1')]){return db['sequelize'][_0x172b('0xf2')](function(_0x516ef3){return db[_0x172b('0xf3')][_0x172b('0xf4')](_0x3902a9,{'transaction':_0x516ef3});});}}})['then'](function(){if(_0x59e5ed){_0x79420b=_0x59e5ed;return db['MailAccount'][_0x172b('0x7d')]({'where':{'service':!![]},'include':[{'model':db[_0x172b('0xf5')],'as':_0x172b('0xf6'),'raw':!![],'include':[{'model':db[_0x172b('0xf7')],'as':_0x172b('0xf7'),'raw':!![]}]}]});}})['then'](function(_0x35c4d1){if(_0x35c4d1&&_0x35c4d1[_0x172b('0xf6')]&&_0xcd69c9['forwardOffline']&&_0xcd69c9[_0x172b('0xf8')]){var _0x1b71c4=_0x35c4d1[_0x172b('0xf9')]();return respondWithRpcPromise(_0x172b('0xfa'),'sendMail',{'account':_0x1b71c4,'message':{'from':util['format'](_0x172b('0xfb'),_0x35c4d1[_0x172b('0x34')],_0x35c4d1['email']||_0x35c4d1[_0x172b('0xf6')][_0x172b('0x6e')]),'to':_0xcd69c9[_0x172b('0xf8')],'subject':_0xcd69c9[_0x172b('0xfc')],'html':_0x79420b[_0x172b('0x67')],'attachments':_0x2e46ec}},client9003)[_0x172b('0x2f')](function(){return _0x79420b;})[_0x172b('0x61')](function(_0x22b7ca){logger[_0x172b('0x20')](_0x22b7ca);});}})['then'](function(){if(_0xcd69c9&&_0xcd69c9['openNewInteraction']&&_0xcd69c9[_0x172b('0xfd')]){var _0x34eba7=[];if(_0x2b9fad['length']){_0x34eba7=_0x2b9fad[_0x172b('0x4b')](function(_0x39d7dc){return{'name':_0x39d7dc[_0x172b('0xed')],'basename':_0x39d7dc[_0x172b('0x83')],'type':_0x39d7dc[_0x172b('0xee')],'ChatOfflineMessageId':_0x59e5ed['id']};});}var _0x1d791e;if(!_[_0x172b('0x8f')](_0xcd69c9[_0x172b('0xfe')])){var _0x1758ec=_['map'](_0x4f4f4e[_0x172b('0x67')],function(_0x5b2b25){return _0x5b2b25;});var _0x3803ba=_[_0x172b('0xff')](_0x1758ec)[0x0];var _0x549f65=_['mapValues'](_0x3803ba,function(_0xbe0407){return _0xbe0407;});_0x1d791e=_0x549f65[0x1][_0xcd69c9[_0x172b('0xfe')]];}var _0x12acb8={'from':_0x59082c[_0x172b('0x100')],'firstName':_0x59082c[_0x172b('0xc1')],'lastName':_0x59082c[_0x172b('0xc2')],'mapKey':'email','message':{'from':_0x59082c['email'],'to':_0xcd69c9[_0x172b('0xe3')]['email'],'cc':'','subject':_['isNil'](_0x1d791e)?_0xcd69c9[_0x172b('0xfc')]:_0x1d791e,'messageId':'','sentAt':new Date(),'attach':_0x34eba7[_0x172b('0x65')],'attachments':_0x34eba7,'originChannel':_0x172b('0x101'),'ChatWebsiteId':_0xcd69c9['id'],'ChatOfflineMessageId':_0x79420b['id'],'originTo':_0xcd69c9[_0x172b('0xe3')][_0x172b('0x100')]},'body':_0x79420b[_0x172b('0x67')]};var _0x174410={'account':{'id':_0xcd69c9['MailAccountId']},'body':_0x12acb8,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0x172b('0x102'),_0x172b('0x103'),_0x174410,client9001)[_0x172b('0x2f')](function(){return _0x79420b;})['catch'](function(_0x373912){logger[_0x172b('0x20')](_0x373912);});}return;})[_0x172b('0x2f')](function(){if(_0x79420b){return _0x79420b;}})['then'](respondWithResult(_0x5371e2,null))['catch'](function(){for(var _0x5342fd of _0x2b9fad){var _0x5cfe58=path[_0x172b('0x8b')](config[_0x172b('0x90')],_0x172b('0xef'),_0x172b('0xda'),'attachments','offline-chat',_0x5342fd[_0x172b('0x83')]);fs_extra[_0x172b('0x104')](_0x5cfe58)[_0x172b('0x61')](function(_0x3e145c){logger[_0x172b('0x20')](_0x172b('0x105'),_0x5cfe58,_0x3e145c);});}});};exports[_0x172b('0x106')]=function(_0x14ebaa,_0x185a90){return db[_0x172b('0xbe')]['find']({'where':{'id':_0x14ebaa[_0x172b('0x63')]['id']}})[_0x172b('0x2f')](handleEntityNotFound(_0x185a90,null))['then'](function(_0x932dd7){if(_0x932dd7){return _0x932dd7[_0x172b('0x106')](_0x14ebaa[_0x172b('0x67')]['ids'],_[_0x172b('0x107')](_0x14ebaa['body'],['ids','id'])||{});}})[_0x172b('0x2f')](respondWithResult(_0x185a90,null))[_0x172b('0x61')](handleError(_0x185a90,null));};exports['getInteractions']=function(_0x47ee59,_0x586764){var _0x4c0ae5={'raw':![],'where':{}};var _0x154587={};var _0x144891={'count':0x0,'rows':[]};return db[_0x172b('0x4c')][_0x172b('0x7d')]({'where':{'id':_0x47ee59[_0x172b('0x63')]['id']}})[_0x172b('0x2f')](handleEntityNotFound(_0x586764,null))[_0x172b('0x2f')](function(_0x93bb3d){if(_0x93bb3d){_0x154587[_0x172b('0x44')]=_[_0x172b('0x4f')](db[_0x172b('0xbe')][_0x172b('0x64')]);_0x154587[_0x172b('0x50')]=_['keys'](_0x47ee59[_0x172b('0x50')]);_0x154587[_0x172b('0x51')]=_[_0x172b('0x52')](_0x154587[_0x172b('0x44')],_0x154587[_0x172b('0x50')]);_0x4c0ae5[_0x172b('0x53')]=_[_0x172b('0x52')](_0x154587[_0x172b('0x44')],qs['fields'](_0x47ee59[_0x172b('0x50')]['fields']));_0x4c0ae5['attributes']=_0x4c0ae5[_0x172b('0x53')][_0x172b('0x65')]?_0x4c0ae5[_0x172b('0x53')]:_0x154587[_0x172b('0x44')];if(!_0x47ee59[_0x172b('0x50')][_0x172b('0x55')](_0x172b('0x56'))){_0x4c0ae5[_0x172b('0x2b')]=qs[_0x172b('0x2b')](_0x47ee59['query'][_0x172b('0x2b')]);_0x4c0ae5[_0x172b('0x28')]=qs[_0x172b('0x28')](_0x47ee59[_0x172b('0x50')][_0x172b('0x28')]);}_0x4c0ae5[_0x172b('0x57')]=qs[_0x172b('0x58')](_0x47ee59[_0x172b('0x50')][_0x172b('0x58')]);_0x4c0ae5[_0x172b('0x59')]=qs[_0x172b('0x51')](_[_0x172b('0x77')](_0x47ee59[_0x172b('0x50')],_0x154587[_0x172b('0x51')]));_0x4c0ae5[_0x172b('0x59')][_0x172b('0x78')]=_0x93bb3d['id'];if(_0x47ee59[_0x172b('0x50')]['filter']){_0x4c0ae5[_0x172b('0x59')]=_[_0x172b('0x5b')](_0x4c0ae5['where'],{'$or':_['map'](_0x4c0ae5[_0x172b('0x53')],function(_0x4025aa){var _0x40a1ad={};_0x40a1ad[_0x4025aa]={'$like':'%'+_0x47ee59[_0x172b('0x50')][_0x172b('0x5a')]+'%'};return _0x40a1ad;})});}_0x4c0ae5=_['merge']({},_0x4c0ae5,_0x47ee59[_0x172b('0x5c')]);return db['ChatInteraction']['count']({'where':_0x4c0ae5['where']})[_0x172b('0x2f')](function(_0x1f7082){_0x144891[_0x172b('0x2a')]=_0x1f7082;if(_0x47ee59['query'][_0x172b('0x5d')]){_0x4c0ae5['include']=[{'model':db[_0x172b('0xa3')],'as':_0x172b('0x108'),'required':![]},{'model':db[_0x172b('0xcd')],'as':_0x172b('0x109'),'attributes':[_0x172b('0x34'),_0x172b('0x10a'),_0x172b('0x10b')],'required':![]},{'model':db['Tag'],'as':_0x172b('0x10c'),'attributes':['id',_0x172b('0x34'),_0x172b('0x10d')],'where':_0x47ee59[_0x172b('0x50')][_0x172b('0x10e')]?{'id':_0x47ee59[_0x172b('0x50')][_0x172b('0x10e')]}:undefined,'required':_0x47ee59[_0x172b('0x50')][_0x172b('0x10e')]?!![]:![]}];}return db[_0x172b('0xbe')][_0x172b('0x5f')](_0x4c0ae5);})['then'](function(_0xd7b8fc){_0x144891[_0x172b('0x60')]=_0xd7b8fc;return _0x144891;});}})[_0x172b('0x2f')](respondWithFilteredResult(_0x586764,_0x4c0ae5))['catch'](handleError(_0x586764,null));};exports['getSnippet']=function(_0x50893d,_0x30d218){var _0x1c814b=0x0;var _0x1af948=0x0;var _0x40ceab=![];var _0x3939ae;var _0x3a7abf;return db[_0x172b('0x4c')]['find']({'where':{'id':_0x50893d[_0x172b('0x63')]['id']},'include':[{'model':db[_0x172b('0xb1')],'as':_0x172b('0xb1'),'include':[{'model':db['Interval'],'as':_0x172b('0xb2'),'attributes':['id',_0x172b('0xb3')]}]}]})[_0x172b('0x2f')](handleEntityNotFound(_0x30d218,null))['then'](function(_0x398891){if(_0x398891){_0x3939ae=_0x398891;return _0x398891[_0x172b('0x10f')]({'raw':!![]});}})[_0x172b('0x2f')](function(_0x55e473){if(_0x3939ae){if(_0x55e473){_0x3a7abf=_0x55e473;}}return require('../../config/license/util')[_0x172b('0x110')]();})[_0x172b('0x2f')](function(_0x3bbc67){if(_0x3bbc67){_0x1af948=_0x3bbc67[_0x172b('0x111')];_0x40ceab=_0x3bbc67['custom'];}})['then'](function(){return db['ChatInteraction'][_0x172b('0x2a')]({'where':{'closed':![]}});})[_0x172b('0x2f')](function(_0x477e19){_0x1c814b=_0x477e19;if(_0x1af948&&_0x477e19>_0x1af948){return db['License'][_0x172b('0x7d')]({'where':{'id':0x1}})['then'](function(_0x2d3c30){if(_0x2d3c30){_0x2d3c30['increment'](_0x172b('0x112'));}});}})[_0x172b('0x2f')](function(){var _0x49415c=_0x3939ae[_0x172b('0xb1')];var _0x442d55=_0x3939ae[_0x172b('0x9d')]||undefined;return _0x49415c?_0x49415c[_0x172b('0x9e')](_0x442d55):!![];})[_0x172b('0x2f')](function(_0x506043){var _0x5abc06=fs[_0x172b('0x113')](path[_0x172b('0x8b')](config[_0x172b('0x90')],_0x172b('0x114')),'utf8');var _0x4a84b0=_0x172b('0x115');var _0x3127cb=![];var _0x240d74,_0x2164f9;if(_0x50893d[_0x172b('0xb9')]['referer']){_0x240d74=new URL(_0x50893d[_0x172b('0xb9')][_0x172b('0x3e')])[_0x172b('0x116')];}else if(_0x50893d['headers']['origin']){_0x240d74=new URL(_0x50893d[_0x172b('0xb9')][_0x172b('0x116')])[_0x172b('0x116')];}else{_0x240d74=_0x172b('0x117');}_0x2164f9=typeof _0x3939ae[_0x172b('0x68')]['split'](',')[_0x172b('0x66')](function(_0x3fc4c7){return wildcardUtils[_0x172b('0x118')](_0x3fc4c7,_0x240d74);})!=='undefined';var _0x55ac1e={'chatVersion':_0x4a84b0,'chatWebsiteAddressOrigin':_0x2164f9?_0x240d74:_0x3939ae[_0x172b('0x68')],'remote':_0x3939ae['remote'],'query':querystring[_0x172b('0x1f')](_[_0x172b('0x5b')](_0x3939ae['get']({'plain':!![]}),{'customerIp':_0x50893d[_0x172b('0xb9')]['x-forwarded-for']||_0x50893d[_0x172b('0xb9')][_0x172b('0x119')]||_0x50893d['connection'][_0x172b('0x11a')]||_0x50893d['ip'],'referer':_0x50893d[_0x172b('0xb9')][_0x172b('0x3e')],'openedInteractions':_0x1c814b,'maxInteractions':_0x1af948,'virtual':_0x40ceab[_0x172b('0x111')],'online':_0x506043,'custom':_0x40ceab,'address':_0x2164f9?_0x240d74:null}))[_0x172b('0x11b')](/'/g,'\x5c\x27')};_0x30d218[_0x172b('0x35')](ejs['render'](Mustache[_0x172b('0xe8')](_0x5abc06,_0x55ac1e),{'proactiveActions':_0x3a7abf,'alignment':_0x3939ae[_0x172b('0x11c')],'verticalAlignment':_0x3939ae[_0x172b('0x11d')],'div_color':_0x3939ae[_0x172b('0x10d')],'labelText':_0x3939ae['labelText'],'text_color':_0x3939ae[_0x172b('0x11e')],'text_button_color':_0x3939ae[_0x172b('0x11f')],'button_color':_0x3939ae[_0x172b('0x120')],'background_color':_0x3939ae[_0x172b('0x121')],'hideWhenOffline':_0x3939ae[_0x172b('0x122')],'intervalId':_0x3939ae[_0x172b('0x123')],'isDevelopment':_0x3127cb,'chatVersion':_0x4a84b0}));})[_0x172b('0x61')](handleError(_0x30d218,null));};exports[_0x172b('0x124')]=function(_0x2697fd,_0x253ad1){var _0x199586=_0x2697fd[_0x172b('0x63')]['id'];var _0x58cb83=_0x2697fd[_0x172b('0x67')];var _0x41dad8=0xc8;var _0x33f82b=null;return db[_0x172b('0x125')]['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0x172b('0x126')]['READ_COMMITTED']},function(_0x4bdb81){return db[_0x172b('0x4c')][_0x172b('0x7d')]({'where':{'id':_0x199586},'transaction':_0x4bdb81})[_0x172b('0x2f')](function(_0x4fd06d){if(_0x4fd06d){return db[_0x172b('0xaf')][_0x172b('0x30')]({'where':{'ChatWebsiteId':_0x199586},'transaction':_0x4bdb81})[_0x172b('0x2f')](function(){var _0x577636=_[_0x172b('0x4b')](_0x58cb83,function(_0x5082cc){_0x5082cc[_0x172b('0x78')]=_0x199586;return _0x5082cc;});return db[_0x172b('0xaf')][_0x172b('0xf4')](_0x577636,{'transaction':_0x4bdb81});});}else{_0x41dad8=0x194;_0x33f82b=[];}});})['then'](function(){if(_0x41dad8!==0x194){return db[_0x172b('0xaf')][_0x172b('0x127')]({'where':{'ChatWebsiteId':_0x199586},'order':_0x172b('0x128')})[_0x172b('0x2f')](function(_0xb2fa92){_0x33f82b=_0xb2fa92;});}})[_0x172b('0x61')](function(_0x87bd93){_0x41dad8=0x1f4;logger[_0x172b('0x20')](_0x87bd93[_0x172b('0x129')]);if(_0x87bd93[_0x172b('0x34')]){delete _0x87bd93['name'];}_0x33f82b=_0x87bd93;})[_0x172b('0x12a')](function(){if(_0x33f82b===null){_0x253ad1[_0x172b('0x24')](_0x41dad8);}else{if(_0x41dad8===0x1f4){_0x253ad1['status'](_0x41dad8)['send'](_0x33f82b);}else{_0x253ad1[_0x172b('0x26')](_0x41dad8)[_0x172b('0x27')](_0x33f82b);}}});};exports[_0x172b('0x12b')]=function(_0x2eeb5a,_0x42d068){var _0x4e3745={};var _0x3a2ef5={};var _0x531ec3;var _0x2ff591;return db['ChatWebsite'][_0x172b('0x7d')]({'where':{'id':_0x2eeb5a[_0x172b('0x63')]['id']}})['then'](handleEntityNotFound(_0x42d068,null))[_0x172b('0x2f')](function(_0x1dcf0d){if(_0x1dcf0d){_0x531ec3=_0x1dcf0d;_0x3a2ef5[_0x172b('0x44')]=_[_0x172b('0x4f')](db[_0x172b('0xaf')][_0x172b('0x64')]);_0x3a2ef5['query']=_['keys'](_0x2eeb5a['query']);_0x3a2ef5[_0x172b('0x51')]=_[_0x172b('0x52')](_0x3a2ef5[_0x172b('0x44')],_0x3a2ef5[_0x172b('0x50')]);_0x4e3745[_0x172b('0x53')]=_[_0x172b('0x52')](_0x3a2ef5['model'],qs['fields'](_0x2eeb5a[_0x172b('0x50')][_0x172b('0x54')]));_0x4e3745['attributes']=_0x4e3745[_0x172b('0x53')][_0x172b('0x65')]?_0x4e3745[_0x172b('0x53')]:_0x3a2ef5[_0x172b('0x44')];_0x4e3745[_0x172b('0x57')]=qs['sort'](_0x2eeb5a[_0x172b('0x50')]['sort']);_0x4e3745['where']=qs[_0x172b('0x51')](_[_0x172b('0x77')](_0x2eeb5a['query'],_0x3a2ef5['filters']));if(_0x2eeb5a['query'][_0x172b('0x5a')]){_0x4e3745[_0x172b('0x59')]=_[_0x172b('0x5b')](_0x4e3745[_0x172b('0x59')],{'$or':_[_0x172b('0x4b')](_0x4e3745['attributes'],function(_0x23b0a6){var _0x235e41={};_0x235e41[_0x23b0a6]={'$like':'%'+_0x2eeb5a[_0x172b('0x50')]['filter']+'%'};return _0x235e41;})});}_0x4e3745=_[_0x172b('0x5b')]({},_0x4e3745,_0x2eeb5a[_0x172b('0x5c')]);return _0x531ec3[_0x172b('0x12b')](_0x4e3745);}})[_0x172b('0x2f')](function(_0x5c57fb){if(_0x5c57fb){_0x2ff591=_0x5c57fb[_0x172b('0x65')];if(!_0x2eeb5a[_0x172b('0x50')]['hasOwnProperty'](_0x172b('0x56'))){_0x4e3745[_0x172b('0x2b')]=qs[_0x172b('0x2b')](_0x2eeb5a['query'][_0x172b('0x2b')]);_0x4e3745[_0x172b('0x28')]=qs[_0x172b('0x28')](_0x2eeb5a[_0x172b('0x50')][_0x172b('0x28')]);}return _0x531ec3[_0x172b('0x12b')](_0x4e3745);}})['then'](function(_0x2279f8){if(_0x2279f8){return _0x2279f8?{'count':_0x2ff591,'rows':_0x2279f8}:null;}})[_0x172b('0x2f')](respondWithResult(_0x42d068,null))[_0x172b('0x61')](handleError(_0x42d068,null));};exports[_0x172b('0x12c')]=function(_0x54f5b2,_0x4bcfe2){return db['chatProactiveAction']['find']({'where':{'id':_0x54f5b2[_0x172b('0x63')]['id']}})[_0x172b('0x2f')](handleEntityNotFound(_0x4bcfe2,null))[_0x172b('0x2f')](function(_0x3a0c51){if(_0x3a0c51){return _0x3a0c51['addProactiveActions'](_0x54f5b2[_0x172b('0x67')][_0x172b('0x7a')],_['omit'](_0x54f5b2['body'],[_0x172b('0x7a'),'id'])||{});}})['then'](respondWithResult(_0x4bcfe2,null))[_0x172b('0x61')](handleError(_0x4bcfe2,null));};exports[_0x172b('0x10f')]=function(_0x9bcdc2,_0x87a959){var _0x3dba1b={};var _0xdf23b0={};var _0x2fa5df;var _0x2fb062;return db[_0x172b('0x4c')]['findOne']({'where':{'id':_0x9bcdc2[_0x172b('0x63')]['id']}})[_0x172b('0x2f')](handleEntityNotFound(_0x87a959,null))[_0x172b('0x2f')](function(_0x5cec8b){if(_0x5cec8b){_0x2fa5df=_0x5cec8b;_0xdf23b0[_0x172b('0x44')]=_[_0x172b('0x4f')](db[_0x172b('0x12d')][_0x172b('0x64')]);_0xdf23b0[_0x172b('0x50')]=_[_0x172b('0x4f')](_0x9bcdc2['query']);_0xdf23b0[_0x172b('0x51')]=_[_0x172b('0x52')](_0xdf23b0[_0x172b('0x44')],_0xdf23b0['query']);_0x3dba1b['attributes']=_[_0x172b('0x52')](_0xdf23b0['model'],qs[_0x172b('0x54')](_0x9bcdc2[_0x172b('0x50')][_0x172b('0x54')]));_0x3dba1b[_0x172b('0x53')]=_0x3dba1b[_0x172b('0x53')][_0x172b('0x65')]?_0x3dba1b[_0x172b('0x53')]:_0xdf23b0[_0x172b('0x44')];_0x3dba1b[_0x172b('0x57')]=qs['sort'](_0x9bcdc2[_0x172b('0x50')][_0x172b('0x58')]);_0x3dba1b['where']=qs[_0x172b('0x51')](_[_0x172b('0x77')](_0x9bcdc2[_0x172b('0x50')],_0xdf23b0['filters']));if(_0x9bcdc2[_0x172b('0x50')][_0x172b('0x5a')]){_0x3dba1b[_0x172b('0x59')]=_[_0x172b('0x5b')](_0x3dba1b[_0x172b('0x59')],{'$or':_[_0x172b('0x4b')](_0x3dba1b[_0x172b('0x53')],function(_0x5bc4cd){var _0x29be8c={};_0x29be8c[_0x5bc4cd]={'$like':'%'+_0x9bcdc2[_0x172b('0x50')][_0x172b('0x5a')]+'%'};return _0x29be8c;})});}_0x3dba1b=_[_0x172b('0x5b')]({},_0x3dba1b,_0x9bcdc2[_0x172b('0x5c')]);return _0x2fa5df[_0x172b('0x10f')](_0x3dba1b);}})[_0x172b('0x2f')](function(_0x3bd92d){if(_0x3bd92d){_0x2fb062=_0x3bd92d[_0x172b('0x65')];if(!_0x9bcdc2['query'][_0x172b('0x55')](_0x172b('0x56'))){_0x3dba1b[_0x172b('0x2b')]=qs['limit'](_0x9bcdc2[_0x172b('0x50')][_0x172b('0x2b')]);_0x3dba1b[_0x172b('0x28')]=qs[_0x172b('0x28')](_0x9bcdc2[_0x172b('0x50')][_0x172b('0x28')]);}return _0x2fa5df['getProactiveActions'](_0x3dba1b);}})[_0x172b('0x2f')](function(_0x47fc8a){if(_0x47fc8a){return _0x47fc8a?{'count':_0x2fb062,'rows':_0x47fc8a}:null;}})[_0x172b('0x2f')](respondWithResult(_0x87a959,null))['catch'](handleError(_0x87a959,null));};exports[_0x172b('0x12e')]=function(_0x4c4957,_0x32b9f0){var _0x17e627=_0x4c4957[_0x172b('0x50')][_0x172b('0x12f')]===_0x172b('0x130')?'offlineForm':_0x172b('0x131');return db['ChatWebsite'][_0x172b('0x66')]({'attributes':['id',_0x17e627],'where':{'id':_0x4c4957['params']['id']}})[_0x172b('0x2f')](handleEntityNotFound(_0x32b9f0,null))[_0x172b('0x2f')](function(_0x30543e){if(_0x30543e){var _0x5b7f35=_0x30543e[_0x17e627];var _0x3c0767=_0x5b7f35&&_0x5b7f35[_0x172b('0x132')]?_0x5b7f35[_0x172b('0x132')]:[];_0x32b9f0[_0x172b('0x35')]({'fromKey':_[_0x172b('0x8f')](_0x5b7f35[_0x172b('0x133')])?undefined:_0x5b7f35[_0x172b('0x133')],'count':_0x3c0767[_0x172b('0x65')],'rows':_0x3c0767});}})[_0x172b('0x61')](handleError(_0x32b9f0,null));};exports[_0x172b('0x134')]=function(_0x2f2719,_0x113a91){var _0x530fd9={'raw':![],'where':{}};var _0x2810bb={};var _0x147ebe={'count':0x0,'rows':[]};return db[_0x172b('0x4c')][_0x172b('0x7d')]({'where':{'id':_0x2f2719['params']['id']}})[_0x172b('0x2f')](handleEntityNotFound(_0x113a91,null))[_0x172b('0x2f')](function(_0x2e21be){if(_0x2e21be){_0x2810bb[_0x172b('0x44')]=_['keys'](db[_0x172b('0xeb')]['rawAttributes']);_0x2810bb[_0x172b('0x50')]=_[_0x172b('0x4f')](_0x2f2719[_0x172b('0x50')]);_0x2810bb[_0x172b('0x51')]=_[_0x172b('0x52')](_0x2810bb[_0x172b('0x44')],_0x2810bb['query']);_0x530fd9[_0x172b('0x53')]=_[_0x172b('0x52')](_0x2810bb['model'],qs[_0x172b('0x54')](_0x2f2719[_0x172b('0x50')][_0x172b('0x54')]));_0x530fd9['attributes']=_0x530fd9['attributes'][_0x172b('0x65')]?_0x530fd9['attributes']:_0x2810bb[_0x172b('0x44')];if(!_0x2f2719[_0x172b('0x50')]['hasOwnProperty'](_0x172b('0x56'))){_0x530fd9['limit']=qs[_0x172b('0x2b')](_0x2f2719['query'][_0x172b('0x2b')]);_0x530fd9[_0x172b('0x28')]=qs[_0x172b('0x28')](_0x2f2719[_0x172b('0x50')]['offset']);}_0x530fd9[_0x172b('0x57')]=qs[_0x172b('0x58')](_0x2f2719[_0x172b('0x50')]['sort']);_0x530fd9[_0x172b('0x59')]=qs[_0x172b('0x51')](_['pick'](_0x2f2719['query'],_0x2810bb[_0x172b('0x51')]));_0x530fd9[_0x172b('0x59')][_0x172b('0x78')]=_0x2e21be['id'];if(_0x2f2719[_0x172b('0x50')]['filter']){_0x530fd9['where']=_['merge'](_0x530fd9[_0x172b('0x59')],{'$or':_[_0x172b('0x4b')](_0x530fd9[_0x172b('0x53')],function(_0x448724){var _0x175d03={};_0x175d03[_0x448724]={'$like':'%'+_0x2f2719[_0x172b('0x50')][_0x172b('0x5a')]+'%'};return _0x175d03;})});}_0x530fd9=_[_0x172b('0x5b')]({},_0x530fd9,_0x2f2719[_0x172b('0x5c')]);return db[_0x172b('0xeb')][_0x172b('0x2a')]({'where':_0x530fd9[_0x172b('0x59')]})[_0x172b('0x2f')](function(_0x5a2037){_0x147ebe['count']=_0x5a2037;if(_0x2f2719['query'][_0x172b('0x5d')]){_0x530fd9['include']=[{'all':!![]}];}else{_0x530fd9['include']=[{'model':db[_0x172b('0xa3')],'as':'Contact','required':![]},{'model':db[_0x172b('0xf3')],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x530fd9);})['then'](function(_0x570c90){_0x147ebe[_0x172b('0x60')]=_0x570c90;return _0x147ebe;});}})[_0x172b('0x2f')](respondWithFilteredResult(_0x113a91,_0x530fd9))['catch'](handleError(_0x113a91,null));};exports[_0x172b('0x135')]=function(_0x25628e,_0x2513f0){return db[_0x172b('0x4c')][_0x172b('0x66')]({'where':{'id':_0x25628e[_0x172b('0x63')]['id']}})[_0x172b('0x2f')](handleEntityNotFound(_0x2513f0,null))[_0x172b('0x2f')](function(_0x3b957d){if(_0x3b957d){return _0x3b957d['addAgents'](_0x25628e[_0x172b('0x67')]['ids'],_[_0x172b('0x107')](_0x25628e['body'],[_0x172b('0x7a'),'id'])||{})['spread'](function(_0x3151e2){for(var _0x167287=0x0;_0x167287<_0x25628e[_0x172b('0x67')][_0x172b('0x7a')][_0x172b('0x65')];_0x167287+=0x1){socket[_0x172b('0x136')](_0x172b('0x137'),{'UserId':Number(_0x25628e[_0x172b('0x67')][_0x172b('0x7a')][_0x167287]),'ChatWebsiteId':Number(_0x25628e[_0x172b('0x63')]['id'])});}return _0x3151e2;});}})[_0x172b('0x2f')](respondWithResult(_0x2513f0,null))[_0x172b('0x61')](handleError(_0x2513f0,null));};exports[_0x172b('0x138')]=function(_0x58b3a6,_0x34457f){return db[_0x172b('0x4c')][_0x172b('0x66')]({'where':{'id':_0x58b3a6['params']['id']}})['then'](handleEntityNotFound(_0x34457f,null))[_0x172b('0x2f')](function(_0xf32eb){if(_0xf32eb){return _0xf32eb['removeAgents'](_0x58b3a6[_0x172b('0x50')][_0x172b('0x7a')])[_0x172b('0x2f')](function(){if(_[_0x172b('0x139')](_0x58b3a6[_0x172b('0x50')]['ids'])){for(var _0xab60e0=0x0;_0xab60e0<_0x58b3a6[_0x172b('0x50')]['ids'][_0x172b('0x65')];_0xab60e0+=0x1){socket[_0x172b('0x136')](_0x172b('0x13a'),{'UserId':Number(_0x58b3a6['query'][_0x172b('0x7a')][_0xab60e0]),'ChatWebsiteId':Number(_0x58b3a6['params']['id'])});}}else{socket['emit'](_0x172b('0x13a'),{'UserId':Number(_0x58b3a6['query']['ids']),'ChatWebsiteId':Number(_0x58b3a6[_0x172b('0x63')]['id'])});}});}})[_0x172b('0x2f')](respondWithStatusCode(_0x34457f,null))[_0x172b('0x61')](handleError(_0x34457f,null));};exports[_0x172b('0x13b')]=function(_0x5b6d7c,_0x4ccac0){var _0x10cf3e={};var _0x362a06={};var _0x23734b;var _0x853cb4;return db[_0x172b('0x4c')]['findOne']({'where':{'id':_0x5b6d7c[_0x172b('0x63')]['id']}})[_0x172b('0x2f')](handleEntityNotFound(_0x4ccac0,null))[_0x172b('0x2f')](function(_0x4a7867){if(_0x4a7867){_0x23734b=_0x4a7867;_0x362a06[_0x172b('0x44')]=_['keys'](db[_0x172b('0xcd')][_0x172b('0x64')]);_0x362a06[_0x172b('0x50')]=_[_0x172b('0x4f')](_0x5b6d7c[_0x172b('0x50')]);_0x362a06[_0x172b('0x51')]=_['intersection'](_0x362a06[_0x172b('0x44')],_0x362a06[_0x172b('0x50')]);_0x10cf3e[_0x172b('0x53')]=_['intersection'](_0x362a06['model'],qs[_0x172b('0x54')](_0x5b6d7c[_0x172b('0x50')]['fields']));_0x10cf3e[_0x172b('0x53')]=_0x10cf3e[_0x172b('0x53')][_0x172b('0x65')]?_0x10cf3e['attributes']:_0x362a06[_0x172b('0x44')];_0x10cf3e['order']=qs[_0x172b('0x58')](_0x5b6d7c[_0x172b('0x50')][_0x172b('0x58')]);_0x10cf3e[_0x172b('0x59')]=qs[_0x172b('0x51')](_['pick'](_0x5b6d7c[_0x172b('0x50')],_0x362a06['filters']));if(_0x5b6d7c[_0x172b('0x50')][_0x172b('0x5a')]){_0x10cf3e[_0x172b('0x59')]=_[_0x172b('0x5b')](_0x10cf3e[_0x172b('0x59')],{'$or':_[_0x172b('0x4b')](_0x10cf3e[_0x172b('0x53')],function(_0x5047dc){var _0x3f7525={};_0x3f7525[_0x5047dc]={'$like':'%'+_0x5b6d7c[_0x172b('0x50')][_0x172b('0x5a')]+'%'};return _0x3f7525;})});}_0x10cf3e=_[_0x172b('0x5b')]({},_0x10cf3e,_0x5b6d7c['options']);return _0x23734b[_0x172b('0x13b')](_0x10cf3e);}})[_0x172b('0x2f')](function(_0x14acbe){if(_0x14acbe){_0x853cb4=_0x14acbe['length'];if(!_0x5b6d7c[_0x172b('0x50')]['hasOwnProperty']('nolimit')){_0x10cf3e[_0x172b('0x2b')]=qs[_0x172b('0x2b')](_0x5b6d7c[_0x172b('0x50')][_0x172b('0x2b')]);_0x10cf3e[_0x172b('0x28')]=qs['offset'](_0x5b6d7c[_0x172b('0x50')][_0x172b('0x28')]);}return _0x23734b[_0x172b('0x13b')](_0x10cf3e);}})[_0x172b('0x2f')](function(_0x35c5f8){if(_0x35c5f8){return _0x35c5f8?{'count':_0x853cb4,'rows':_0x35c5f8}:null;}})[_0x172b('0x2f')](respondWithResult(_0x4ccac0,null))['catch'](handleError(_0x4ccac0,null));}; \ No newline at end of file +var _0x0fda=['queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','Sequelize','ValidationError','no\x20available\x20attributes','difference','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','offlineMessageBody','ChatOfflineMessage','server','attachments','basename','openNewInteraction','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','originalname','mimetype','subjectOffline','mapValues','Chat','notifyMail','offline-chat','remove','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','tag','getSnippet','virtual','custom','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','3.10.1','origin','http://localhost:9000','testWebsiteWithWildcard','remote','x-real-ip','connection','remoteAddress','render','alignment','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','READ_COMMITTED','finally','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','online','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','path','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','../../config/logger','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','./helpers/wildcard-expressions','url','URL','redis','defaults','localhost','socket.io-emitter','register','client','http','request','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','status','end','json','undefined','limit','count','offset','then','destroy','get','ChatWebsites','sendStatus','stack','name','send','user-agent-parser','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','model','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','key','query','attributes','intersection','fields','length','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','options','find','create','body','address','split','forEach','testWildcardValidity','trim','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','keys','Disposition','hasOwnProperty','nolimit','order','addAnswer','CannedAnswer','getAnswers','rawAttributes','findAll','ids','addLogo','sitepic','filename','addCustomerAvatar','customerAvatar','file','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','timezone','ifTime','notify','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','CmContact','No\x20available\x20attributes','createdAt','includes','updatedAt','CompanyId','from','CmList','List','ChatApplication','Intervals','interval','account','orderBy','Applications','priority','asc','list','ListId','Contacts','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','ChatMessage','AttachmentId','UserId','applications','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','queueId'];(function(_0x3bf925,_0x4dd8e4){var _0x2128a1=function(_0x4d2049){while(--_0x4d2049){_0x3bf925['push'](_0x3bf925['shift']());}};_0x2128a1(++_0x4dd8e4);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x4c3819,_0x2d4d27){_0x4c3819=_0x4c3819-0x0;var _0xf75525=_0x0fda[_0x4c3819];return _0xf75525;};'use strict';var Mustache=require(_0xa0fd('0x0'));var util=require('util');var path=require(_0xa0fd('0x1'));var ejs=require(_0xa0fd('0x2'));var fs=require('fs');var fs_extra=require(_0xa0fd('0x3'));var _=require(_0xa0fd('0x4'));var querystring=require(_0xa0fd('0x5'));var htmlToText=require(_0xa0fd('0x6'));var Redis=require(_0xa0fd('0x7'));var jayson=require('jayson/promise');var qs=require('../../components/parsers/qs');var logger=require(_0xa0fd('0x8'))('api');var config=require('../../config/environment');var APIBadRequestError=require(_0xa0fd('0x9'))[_0xa0fd('0xa')];var APINotFoundError=require(_0xa0fd('0x9'))[_0xa0fd('0xb')];var APIOutOfIntervalError=require('../../errors/api')[_0xa0fd('0xc')];var APIHandleError=require(_0xa0fd('0x9'))[_0xa0fd('0xd')];var APIConflictError=require(_0xa0fd('0x9'))['APIConflictError'];var wildcardUtils=require(_0xa0fd('0xe'));var URL=require(_0xa0fd('0xf'))[_0xa0fd('0x10')];var db=require('../../mysqldb')['db'];config[_0xa0fd('0x11')]=_[_0xa0fd('0x12')](config[_0xa0fd('0x11')],{'host':_0xa0fd('0x13'),'port':0x18eb});var socket=require(_0xa0fd('0x14'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0xa0fd('0x15')](socket);var client=jayson[_0xa0fd('0x16')]['http']({'port':0x232c});var client9002=jayson[_0xa0fd('0x16')][_0xa0fd('0x17')]({'port':0x232a});var client9003=jayson[_0xa0fd('0x16')][_0xa0fd('0x17')]({'port':0x232b});var client9001=jayson[_0xa0fd('0x16')][_0xa0fd('0x17')]({'port':0x2329});function respondWithRpcPromise(_0x2811c0,_0x4fe62c,_0x1c6ffc,_0x326ba8){return new Promise(function(_0x5605ae,_0x50aa6d){var _0x205506=_0x326ba8||client;return _0x205506[_0xa0fd('0x18')](_0x2811c0,_0x1c6ffc)['then'](function(_0x2b8d15){logger[_0xa0fd('0x19')](_0xa0fd('0x1a'),_0x4fe62c,'request\x20sent');logger['debug'](_0xa0fd('0x1b'),_0x4fe62c,'request\x20sent',JSON[_0xa0fd('0x1c')](_0x2b8d15));if(_0x2b8d15[_0xa0fd('0x1d')]){if(_0x2b8d15[_0xa0fd('0x1d')][_0xa0fd('0x1e')]===0x1f4){logger[_0xa0fd('0x1d')](_0xa0fd('0x1a'),_0x4fe62c,_0x2b8d15[_0xa0fd('0x1d')]['message']);return _0x50aa6d(_0x2b8d15[_0xa0fd('0x1d')][_0xa0fd('0x1f')]);}logger[_0xa0fd('0x1d')](_0xa0fd('0x1a'),_0x4fe62c,_0x2b8d15[_0xa0fd('0x1d')][_0xa0fd('0x1f')]);return _0x5605ae(_0x2b8d15[_0xa0fd('0x1d')][_0xa0fd('0x1f')]);}else{logger[_0xa0fd('0x19')](_0xa0fd('0x1a'),_0x4fe62c,_0xa0fd('0x20'));_0x5605ae(_0x2b8d15[_0xa0fd('0x21')][_0xa0fd('0x1f')]);}})['catch'](function(_0x37177b){logger[_0xa0fd('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0x4fe62c,_0x37177b);_0x50aa6d(_0x37177b);});});}function respondWithStatusCode(_0x197ae5,_0x3cd5b0){_0x3cd5b0=_0x3cd5b0||0xcc;return function(_0x4f9258){if(_0x4f9258){return _0x197ae5['sendStatus'](_0x3cd5b0);}return _0x197ae5[_0xa0fd('0x22')](_0x3cd5b0)[_0xa0fd('0x23')]();};}function respondWithResult(_0x4d2c96,_0x5c70fb){_0x5c70fb=_0x5c70fb||0xc8;return function(_0x5b50c0){if(_0x5b50c0){return _0x4d2c96['status'](_0x5c70fb)[_0xa0fd('0x24')](_0x5b50c0);}};}function respondWithFilteredResult(_0x5ef13e,_0x3212d5){return function(_0x1db300){if(_0x1db300){var _0x2f5b0d=typeof _0x3212d5['offset']===_0xa0fd('0x25')&&typeof _0x3212d5[_0xa0fd('0x26')]===_0xa0fd('0x25');var _0x1dd0c4=_0x1db300[_0xa0fd('0x27')];var _0x58ddb3=_0x2f5b0d?0x0:_0x3212d5[_0xa0fd('0x28')];var _0xf69d1c=_0x2f5b0d?_0x1db300[_0xa0fd('0x27')]:_0x3212d5[_0xa0fd('0x28')]+_0x3212d5['limit'];var _0x33785f;if(_0xf69d1c>=_0x1dd0c4){_0xf69d1c=_0x1dd0c4;_0x33785f=0xc8;}else{_0x33785f=0xce;}_0x5ef13e[_0xa0fd('0x22')](_0x33785f);return _0x5ef13e['set']('Content-Range',_0x58ddb3+'-'+_0xf69d1c+'/'+_0x1dd0c4)['json'](_0x1db300);}return null;};}function saveUpdates(_0x1fc249){return function(_0x481271){if(_0x481271){return _0x481271['update'](_0x1fc249)[_0xa0fd('0x29')](function(_0x56f911){return _0x56f911;});}return null;};}function removeEntity(_0xbaa5d2){return function(_0x410246){if(_0x410246){return _0x410246[_0xa0fd('0x2a')]()[_0xa0fd('0x29')](function(){var _0x1f6e72=_0x410246[_0xa0fd('0x2b')]({'plain':!![]});var _0x3d2e32=_0xa0fd('0x2c');return db['UserProfileResource'][_0xa0fd('0x2a')]({'where':{'type':_0x3d2e32,'resourceId':_0x1f6e72['id']}})['then'](function(){return _0x410246;});})[_0xa0fd('0x29')](function(){_0xbaa5d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x33f24b){return function(_0x4bcec1){if(!_0x4bcec1){_0x33f24b[_0xa0fd('0x2d')](0x194);}return _0x4bcec1;};}function handleError(_0x322deb,_0x431d31){_0x431d31=_0x431d31||0x1f4;return function(_0x3c7884){logger['error'](_0x3c7884[_0xa0fd('0x2e')]);if(_0x3c7884[_0xa0fd('0x2f')]){delete _0x3c7884[_0xa0fd('0x2f')];}_0x322deb[_0xa0fd('0x22')](_0x431d31)[_0xa0fd('0x30')](_0x3c7884);};}function createInteractionObject(_0x31f1e2,_0x41feca,_0x5e20ea,_0x5f12ac){var _0x2aa6a8=require(_0xa0fd('0x31'));var _0x283740=new _0x2aa6a8();var _0x155f5=_0x283740['setUA'](_0x5e20ea[_0xa0fd('0x32')])[_0xa0fd('0x33')]();var _0x273511=_0x41feca[_0xa0fd('0x34')];if(_0x5e20ea[_0xa0fd('0x35')]){_0x273511=_0x5e20ea['cf-connecting-ip'];}else if(_0x5e20ea[_0xa0fd('0x36')]){_0x273511=_[_0xa0fd('0x37')](_0x5e20ea['x-forwarded-for']['split'](','));}return{'ContactId':_0x5f12ac['id'],'ChatWebsiteId':_0x31f1e2,'from':(_0x5f12ac[_0xa0fd('0x38')]||'')+'\x20'+(_0x5f12ac[_0xa0fd('0x39')]||''),'customerIp':_0x273511,'customerPort':_0x5e20ea[_0xa0fd('0x3a')]?_0x5e20ea[_0xa0fd('0x3a')]:null,'referer':_0x41feca[_0xa0fd('0x3b')],'browserName':_0x155f5[_0xa0fd('0x3c')][_0xa0fd('0x2f')]&&_0x155f5[_0xa0fd('0x3c')][_0xa0fd('0x3d')]?util[_0xa0fd('0x3e')](_0xa0fd('0x3f'),_0x155f5[_0xa0fd('0x3c')][_0xa0fd('0x2f')],_0x155f5[_0xa0fd('0x3c')][_0xa0fd('0x3d')]):'unknown','browserVersion':_0x155f5['browser']['version']||_0xa0fd('0x40'),'osName':util[_0xa0fd('0x3e')](_0xa0fd('0x3f'),_0x155f5['os']['name'],_0x155f5['os'][_0xa0fd('0x3d')]),'osVersion':_0x155f5['os'][_0xa0fd('0x3d')],'deviceModel':_0x155f5[_0xa0fd('0x41')]['model']&&_0x155f5[_0xa0fd('0x41')][_0xa0fd('0x42')]?util[_0xa0fd('0x3e')](_0xa0fd('0x43'),_0x155f5[_0xa0fd('0x41')][_0xa0fd('0x44')],_0x155f5['device'][_0xa0fd('0x42')],_0x155f5[_0xa0fd('0x41')][_0xa0fd('0x45')]):null,'deviceVendor':_0x155f5[_0xa0fd('0x41')][_0xa0fd('0x42')],'deviceType':_0x155f5[_0xa0fd('0x41')]['type'],'formData':JSON[_0xa0fd('0x1c')](_0x41feca)};}exports[_0xa0fd('0x46')]=function(_0xf1c674,_0x1cc583){var _0x16d0cc={'include':[{'model':db[_0xa0fd('0x47')],'as':_0xa0fd('0x48')}]},_0x508747={},_0x5a6824={'count':0x0,'rows':[]};var _0x3677c1=_[_0xa0fd('0x49')](db[_0xa0fd('0x4a')]['rawAttributes'],function(_0x2d9777){return{'name':_0x2d9777[_0xa0fd('0x4b')],'type':_0x2d9777[_0xa0fd('0x45')][_0xa0fd('0x4c')]};});_0x508747[_0xa0fd('0x44')]=_[_0xa0fd('0x49')](_0x3677c1,'name');_0x508747['query']=_['keys'](_0xf1c674[_0xa0fd('0x4d')]);_0x508747['filters']=_['intersection'](_0x508747[_0xa0fd('0x44')],_0x508747['query']);_0x16d0cc[_0xa0fd('0x4e')]=_[_0xa0fd('0x4f')](_0x508747['model'],qs['fields'](_0xf1c674[_0xa0fd('0x4d')][_0xa0fd('0x50')]));_0x16d0cc[_0xa0fd('0x4e')]=_0x16d0cc[_0xa0fd('0x4e')][_0xa0fd('0x51')]?_0x16d0cc[_0xa0fd('0x4e')]:_0x508747['model'];if(!_0xf1c674['query']['hasOwnProperty']('nolimit')){_0x16d0cc[_0xa0fd('0x26')]=qs[_0xa0fd('0x26')](_0xf1c674[_0xa0fd('0x4d')][_0xa0fd('0x26')]);_0x16d0cc[_0xa0fd('0x28')]=qs['offset'](_0xf1c674['query']['offset']);}_0x16d0cc['order']=qs['sort'](_0xf1c674[_0xa0fd('0x4d')][_0xa0fd('0x52')]);_0x16d0cc[_0xa0fd('0x53')]=qs[_0xa0fd('0x54')](_[_0xa0fd('0x55')](_0xf1c674[_0xa0fd('0x4d')],_0x508747[_0xa0fd('0x54')]),_0x3677c1);if(_0xf1c674[_0xa0fd('0x4d')][_0xa0fd('0x56')]){_0x16d0cc[_0xa0fd('0x53')]=_['merge'](_0x16d0cc['where'],{'$or':_[_0xa0fd('0x49')](_0x3677c1,function(_0x3fbd1a){if(_0x3fbd1a[_0xa0fd('0x45')]!==_0xa0fd('0x57')){var _0x4c4339={};_0x4c4339[_0x3fbd1a[_0xa0fd('0x2f')]]={'$like':'%'+_0xf1c674[_0xa0fd('0x4d')]['filter']+'%'};return _0x4c4339;}})});}_0x16d0cc=_[_0xa0fd('0x58')]({},_0x16d0cc,_0xf1c674['options']);var _0x1df896={'where':_0x16d0cc[_0xa0fd('0x53')]};return db['ChatWebsite'][_0xa0fd('0x27')](_0x1df896)[_0xa0fd('0x29')](function(_0x10d3c3){_0x5a6824[_0xa0fd('0x27')]=_0x10d3c3;if(_0xf1c674[_0xa0fd('0x4d')][_0xa0fd('0x59')]){_0x16d0cc[_0xa0fd('0x5a')]=[{'all':!![]}];}return db[_0xa0fd('0x4a')]['findAll'](_0x16d0cc);})[_0xa0fd('0x29')](function(_0x4f7c12){_0x5a6824[_0xa0fd('0x5b')]=_0x4f7c12;return _0x5a6824;})[_0xa0fd('0x29')](respondWithFilteredResult(_0x1cc583,_0x16d0cc))[_0xa0fd('0x5c')](handleError(_0x1cc583,null));};exports[_0xa0fd('0x5d')]=function(_0xa37ca9,_0x4a7ae4){var _0x31710d={'raw':![],'where':{'id':_0xa37ca9['params']['id']},'include':[{'model':db[_0xa0fd('0x47')],'as':_0xa0fd('0x48')}]},_0xb5941e={};_0xb5941e[_0xa0fd('0x44')]=_['keys'](db[_0xa0fd('0x4a')]['rawAttributes']);_0xb5941e[_0xa0fd('0x4d')]=_['keys'](_0xa37ca9[_0xa0fd('0x4d')]);_0xb5941e['filters']=_[_0xa0fd('0x4f')](_0xb5941e[_0xa0fd('0x44')],_0xb5941e[_0xa0fd('0x4d')]);_0x31710d[_0xa0fd('0x4e')]=_[_0xa0fd('0x4f')](_0xb5941e[_0xa0fd('0x44')],qs[_0xa0fd('0x50')](_0xa37ca9['query'][_0xa0fd('0x50')]));_0x31710d[_0xa0fd('0x4e')]=_0x31710d[_0xa0fd('0x4e')][_0xa0fd('0x51')]?_0x31710d[_0xa0fd('0x4e')]:_0xb5941e['model'];if(_0xa37ca9['query']['includeAll']){_0x31710d[_0xa0fd('0x5a')]=[{'all':!![]}];}_0x31710d=_['merge']({},_0x31710d,_0xa37ca9[_0xa0fd('0x5e')]);return db['ChatWebsite'][_0xa0fd('0x5f')](_0x31710d)[_0xa0fd('0x29')](handleEntityNotFound(_0x4a7ae4,null))[_0xa0fd('0x29')](respondWithResult(_0x4a7ae4,null))[_0xa0fd('0x5c')](handleError(_0x4a7ae4,null));};exports[_0xa0fd('0x60')]=function(_0x5c3efa,_0x471a34){var _0x12cc39=null;_0x5c3efa[_0xa0fd('0x61')][_0xa0fd('0x62')][_0xa0fd('0x63')](',')[_0xa0fd('0x64')](_0x527e93=>{if(_0x527e93['trim']()!==''&&!wildcardUtils[_0xa0fd('0x65')](_0x527e93[_0xa0fd('0x66')]())){_0x12cc39=new APIBadRequestError('\x22'+_0x527e93[_0xa0fd('0x66')]()+_0xa0fd('0x67'));}});if(_0x12cc39){return handleError(_0x471a34,null)(_0x12cc39);}return db[_0xa0fd('0x4a')][_0xa0fd('0x60')](_0x5c3efa[_0xa0fd('0x61')],{})[_0xa0fd('0x29')](function(_0x545f7f){var _0xc69e41=_0x5c3efa[_0xa0fd('0x68')][_0xa0fd('0x2b')]({'plain':!![]});if(!_0xc69e41)throw new Error(_0xa0fd('0x69'));if(_0xc69e41[_0xa0fd('0x6a')]===_0xa0fd('0x68')){var _0x45f7df=_0x545f7f[_0xa0fd('0x2b')]({'plain':!![]});var _0x319e80=_0xa0fd('0x2c');return db[_0xa0fd('0x6b')][_0xa0fd('0x5f')]({'where':{'name':_0x319e80,'userProfileId':_0xc69e41['userProfileId']},'raw':!![]})[_0xa0fd('0x29')](function(_0x3cd5a5){if(_0x3cd5a5&&_0x3cd5a5[_0xa0fd('0x6c')]===0x0){return db[_0xa0fd('0x6d')][_0xa0fd('0x60')]({'name':_0x45f7df[_0xa0fd('0x2f')],'resourceId':_0x45f7df['id'],'type':_0x3cd5a5[_0xa0fd('0x2f')],'sectionId':_0x3cd5a5['id']},{})[_0xa0fd('0x29')](function(){return _0x545f7f;});}else{return _0x545f7f;}})[_0xa0fd('0x5c')](function(_0x4452f0){logger['error'](_0xa0fd('0x6e'),_0x4452f0);throw _0x4452f0;});}return _0x545f7f;})[_0xa0fd('0x29')](respondWithResult(_0x471a34,0xc9))[_0xa0fd('0x5c')](handleError(_0x471a34,null));};exports[_0xa0fd('0x6f')]=function(_0x239243,_0x1196d4){var _0x15c756=null;_0x239243[_0xa0fd('0x61')]['address'][_0xa0fd('0x63')](',')[_0xa0fd('0x64')](_0x5934fa=>{if(_0x5934fa[_0xa0fd('0x66')]()!==''&&!wildcardUtils[_0xa0fd('0x65')](_0x5934fa[_0xa0fd('0x66')]())){_0x15c756=new APIBadRequestError('\x22'+_0x5934fa[_0xa0fd('0x66')]()+_0xa0fd('0x67'));}});if(_0x15c756){return handleError(_0x1196d4,null)(_0x15c756);}if(_0x239243['body']['id']){delete _0x239243[_0xa0fd('0x61')]['id'];}return db[_0xa0fd('0x4a')][_0xa0fd('0x5f')]({'where':{'id':_0x239243[_0xa0fd('0x70')]['id']},'include':[{'model':db[_0xa0fd('0x47')],'as':_0xa0fd('0x48')}]})[_0xa0fd('0x29')](handleEntityNotFound(_0x1196d4,null))[_0xa0fd('0x29')](saveUpdates(_0x239243[_0xa0fd('0x61')],null))[_0xa0fd('0x29')](respondWithResult(_0x1196d4,null))[_0xa0fd('0x5c')](handleError(_0x1196d4,null));};exports[_0xa0fd('0x2a')]=function(_0x36452c,_0x7d5b1d){return db[_0xa0fd('0x4a')][_0xa0fd('0x5f')]({'where':{'id':_0x36452c[_0xa0fd('0x70')]['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0x7d5b1d,null))[_0xa0fd('0x29')](removeEntity(_0x7d5b1d,null))['catch'](handleError(_0x7d5b1d,null));};exports[_0xa0fd('0x71')]=function(_0x36523e,_0x356f36){return db[_0xa0fd('0x4a')]['describe']()[_0xa0fd('0x29')](respondWithResult(_0x356f36,null))[_0xa0fd('0x5c')](handleError(_0x356f36,null));};exports[_0xa0fd('0x72')]=function(_0x495bc1,_0xc2f803){if(_0x495bc1['body']['id']){delete _0x495bc1[_0xa0fd('0x61')]['id'];}return db[_0xa0fd('0x4a')]['find']({'where':{'id':_0x495bc1['params']['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0xc2f803,null))['then'](function(_0x5afbc8){if(_0x5afbc8){_0x495bc1[_0xa0fd('0x61')][_0xa0fd('0x73')]=_0x5afbc8['id'];return db['Disposition'][_0xa0fd('0x60')](_0x495bc1[_0xa0fd('0x61')]);}})[_0xa0fd('0x29')](respondWithResult(_0xc2f803,null))[_0xa0fd('0x5c')](handleError(_0xc2f803,null));};exports[_0xa0fd('0x74')]=function(_0x59ab1e,_0x398455){var _0x6c8da3={'raw':![],'where':{}};var _0x50153f={};var _0x424676={'count':0x0,'rows':[]};return db[_0xa0fd('0x4a')][_0xa0fd('0x75')]({'where':{'id':_0x59ab1e['params']['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0x398455,null))['then'](function(_0x24fa4f){if(_0x24fa4f){_0x50153f[_0xa0fd('0x44')]=_[_0xa0fd('0x76')](db[_0xa0fd('0x77')]['rawAttributes']);_0x50153f[_0xa0fd('0x4d')]=_[_0xa0fd('0x76')](_0x59ab1e[_0xa0fd('0x4d')]);_0x50153f[_0xa0fd('0x54')]=_[_0xa0fd('0x4f')](_0x50153f[_0xa0fd('0x44')],_0x50153f['query']);_0x6c8da3[_0xa0fd('0x4e')]=_[_0xa0fd('0x4f')](_0x50153f[_0xa0fd('0x44')],qs[_0xa0fd('0x50')](_0x59ab1e[_0xa0fd('0x4d')][_0xa0fd('0x50')]));_0x6c8da3['attributes']=_0x6c8da3['attributes'][_0xa0fd('0x51')]?_0x6c8da3[_0xa0fd('0x4e')]:_0x50153f['model'];if(!_0x59ab1e[_0xa0fd('0x4d')][_0xa0fd('0x78')](_0xa0fd('0x79'))){_0x6c8da3[_0xa0fd('0x26')]=qs[_0xa0fd('0x26')](_0x59ab1e[_0xa0fd('0x4d')][_0xa0fd('0x26')]);_0x6c8da3[_0xa0fd('0x28')]=qs[_0xa0fd('0x28')](_0x59ab1e['query'][_0xa0fd('0x28')]);}_0x6c8da3[_0xa0fd('0x7a')]=qs[_0xa0fd('0x52')](_0x59ab1e['query'][_0xa0fd('0x52')]);_0x6c8da3[_0xa0fd('0x53')]=qs['filters'](_['pick'](_0x59ab1e[_0xa0fd('0x4d')],_0x50153f[_0xa0fd('0x54')]));_0x6c8da3[_0xa0fd('0x53')][_0xa0fd('0x73')]=_0x24fa4f['id'];if(_0x59ab1e['query']['filter']){_0x6c8da3[_0xa0fd('0x53')]=_[_0xa0fd('0x58')](_0x6c8da3[_0xa0fd('0x53')],{'$or':_[_0xa0fd('0x49')](_0x6c8da3[_0xa0fd('0x4e')],function(_0x57945d){var _0x56801a={};_0x56801a[_0x57945d]={'$like':'%'+_0x59ab1e[_0xa0fd('0x4d')][_0xa0fd('0x56')]+'%'};return _0x56801a;})});}_0x6c8da3=_[_0xa0fd('0x58')]({},_0x6c8da3,_0x59ab1e[_0xa0fd('0x5e')]);return db[_0xa0fd('0x77')][_0xa0fd('0x27')]({'where':_0x6c8da3[_0xa0fd('0x53')]})[_0xa0fd('0x29')](function(_0x1b3dfa){_0x424676[_0xa0fd('0x27')]=_0x1b3dfa;if(_0x59ab1e[_0xa0fd('0x4d')][_0xa0fd('0x59')]){_0x6c8da3[_0xa0fd('0x5a')]=[{'all':!![]}];}return db[_0xa0fd('0x77')]['findAll'](_0x6c8da3);})[_0xa0fd('0x29')](function(_0x28ddc2){_0x424676[_0xa0fd('0x5b')]=_0x28ddc2;return _0x424676;});}})[_0xa0fd('0x29')](respondWithFilteredResult(_0x398455,_0x6c8da3))['catch'](handleError(_0x398455,null));};exports['removeDispositions']=function(_0x785ba5,_0x49f1a3){return db[_0xa0fd('0x4a')][_0xa0fd('0x5f')]({'where':{'id':_0x785ba5[_0xa0fd('0x70')]['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0x49f1a3,null))['then'](function(_0x537979){if(_0x537979){return _0x537979['removeDispositions'](_0x785ba5['query']['ids']);}})['then'](respondWithStatusCode(_0x49f1a3,null))[_0xa0fd('0x5c')](handleError(_0x49f1a3,null));};exports[_0xa0fd('0x7b')]=function(_0xabf058,_0x51c982){if(_0xabf058[_0xa0fd('0x61')]['id']){delete _0xabf058['body']['id'];}return db[_0xa0fd('0x4a')][_0xa0fd('0x5f')]({'where':{'id':_0xabf058[_0xa0fd('0x70')]['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0x51c982,null))['then'](function(_0xee8c4f){if(_0xee8c4f){_0xabf058[_0xa0fd('0x61')][_0xa0fd('0x73')]=_0xee8c4f['id'];return db[_0xa0fd('0x7c')][_0xa0fd('0x60')](_0xabf058[_0xa0fd('0x61')]);}})['then'](respondWithResult(_0x51c982,null))[_0xa0fd('0x5c')](handleError(_0x51c982,null));};exports[_0xa0fd('0x7d')]=function(_0x91853c,_0x33cfc6){var _0x1091c4={'raw':![],'where':{}};var _0x433a8c={};var _0x2d46f2={'count':0x0,'rows':[]};return db[_0xa0fd('0x4a')]['findOne']({'where':{'id':_0x91853c[_0xa0fd('0x70')]['id']}})['then'](handleEntityNotFound(_0x33cfc6,null))[_0xa0fd('0x29')](function(_0x320a53){if(_0x320a53){_0x433a8c[_0xa0fd('0x44')]=_['keys'](db[_0xa0fd('0x7c')][_0xa0fd('0x7e')]);_0x433a8c[_0xa0fd('0x4d')]=_[_0xa0fd('0x76')](_0x91853c['query']);_0x433a8c['filters']=_[_0xa0fd('0x4f')](_0x433a8c['model'],_0x433a8c[_0xa0fd('0x4d')]);_0x1091c4[_0xa0fd('0x4e')]=_[_0xa0fd('0x4f')](_0x433a8c['model'],qs[_0xa0fd('0x50')](_0x91853c[_0xa0fd('0x4d')]['fields']));_0x1091c4[_0xa0fd('0x4e')]=_0x1091c4['attributes']['length']?_0x1091c4[_0xa0fd('0x4e')]:_0x433a8c[_0xa0fd('0x44')];if(!_0x91853c[_0xa0fd('0x4d')]['hasOwnProperty'](_0xa0fd('0x79'))){_0x1091c4['limit']=qs[_0xa0fd('0x26')](_0x91853c[_0xa0fd('0x4d')][_0xa0fd('0x26')]);_0x1091c4[_0xa0fd('0x28')]=qs[_0xa0fd('0x28')](_0x91853c['query'][_0xa0fd('0x28')]);}_0x1091c4[_0xa0fd('0x7a')]=qs[_0xa0fd('0x52')](_0x91853c[_0xa0fd('0x4d')][_0xa0fd('0x52')]);_0x1091c4[_0xa0fd('0x53')]=qs[_0xa0fd('0x54')](_['pick'](_0x91853c[_0xa0fd('0x4d')],_0x433a8c[_0xa0fd('0x54')]));_0x1091c4[_0xa0fd('0x53')][_0xa0fd('0x73')]=_0x320a53['id'];if(_0x91853c[_0xa0fd('0x4d')]['filter']){_0x1091c4[_0xa0fd('0x53')]=_[_0xa0fd('0x58')](_0x1091c4[_0xa0fd('0x53')],{'$or':_[_0xa0fd('0x49')](_0x1091c4['attributes'],function(_0x550d8c){var _0x3bb845={};_0x3bb845[_0x550d8c]={'$like':'%'+_0x91853c['query'][_0xa0fd('0x56')]+'%'};return _0x3bb845;})});}_0x1091c4=_[_0xa0fd('0x58')]({},_0x1091c4,_0x91853c['options']);return db[_0xa0fd('0x7c')]['count']({'where':_0x1091c4[_0xa0fd('0x53')]})[_0xa0fd('0x29')](function(_0x4e335c){_0x2d46f2['count']=_0x4e335c;if(_0x91853c[_0xa0fd('0x4d')]['includeAll']){_0x1091c4[_0xa0fd('0x5a')]=[{'all':!![]}];}return db['CannedAnswer'][_0xa0fd('0x7f')](_0x1091c4);})['then'](function(_0x3c8d51){_0x2d46f2[_0xa0fd('0x5b')]=_0x3c8d51;return _0x2d46f2;});}})[_0xa0fd('0x29')](respondWithFilteredResult(_0x33cfc6,_0x1091c4))[_0xa0fd('0x5c')](handleError(_0x33cfc6,null));};exports['removeAnswers']=function(_0x3198ef,_0x29fe97){return db['ChatWebsite'][_0xa0fd('0x5f')]({'where':{'id':_0x3198ef[_0xa0fd('0x70')]['id']}})['then'](handleEntityNotFound(_0x29fe97,null))[_0xa0fd('0x29')](function(_0x69e5c3){if(_0x69e5c3){return _0x69e5c3['removeAnswers'](_0x3198ef[_0xa0fd('0x4d')][_0xa0fd('0x80')]);}})[_0xa0fd('0x29')](respondWithStatusCode(_0x29fe97,null))[_0xa0fd('0x5c')](handleError(_0x29fe97,null));};exports[_0xa0fd('0x81')]=function(_0xf65b43,_0x28546a){_0xf65b43[_0xa0fd('0x61')][_0xa0fd('0x82')]=_0xf65b43['file'][_0xa0fd('0x83')];return db[_0xa0fd('0x4a')]['find']({'where':{'id':_0xf65b43['params']['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0x28546a,null))[_0xa0fd('0x29')](saveUpdates(_0xf65b43[_0xa0fd('0x61')],null))[_0xa0fd('0x29')](respondWithResult(_0x28546a,null))[_0xa0fd('0x5c')](handleError(_0x28546a,null));};exports['addAvatar']=function(_0x2ae0fe,_0x41b201){_0x2ae0fe[_0xa0fd('0x61')]['agentAvatar']=_0x2ae0fe['file'][_0xa0fd('0x83')];return db[_0xa0fd('0x4a')][_0xa0fd('0x5f')]({'where':{'id':_0x2ae0fe[_0xa0fd('0x70')]['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0x41b201,null))['then'](saveUpdates(_0x2ae0fe[_0xa0fd('0x61')],null))[_0xa0fd('0x29')](respondWithResult(_0x41b201,null))[_0xa0fd('0x5c')](handleError(_0x41b201,null));};exports[_0xa0fd('0x84')]=function(_0x7dbcea,_0xf39378){_0x7dbcea['body'][_0xa0fd('0x85')]=_0x7dbcea[_0xa0fd('0x86')][_0xa0fd('0x83')];return db[_0xa0fd('0x4a')][_0xa0fd('0x5f')]({'where':{'id':_0x7dbcea[_0xa0fd('0x70')]['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0xf39378,null))['then'](saveUpdates(_0x7dbcea[_0xa0fd('0x61')],null))['then'](respondWithResult(_0xf39378,null))['catch'](handleError(_0xf39378,null));};exports['addSystemAvatar']=function(_0x52ff09,_0x54b24f){_0x52ff09['body'][_0xa0fd('0x87')]=_0x52ff09[_0xa0fd('0x86')]['filename'];return db[_0xa0fd('0x4a')][_0xa0fd('0x5f')]({'where':{'id':_0x52ff09[_0xa0fd('0x70')]['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0x54b24f,null))['then'](saveUpdates(_0x52ff09[_0xa0fd('0x61')],null))[_0xa0fd('0x29')](respondWithResult(_0x54b24f,null))[_0xa0fd('0x5c')](handleError(_0x54b24f,null));};exports[_0xa0fd('0x88')]=function(_0x16da38,_0x239982){var _0x544d47=path[_0xa0fd('0x89')](config[_0xa0fd('0x8a')],_0xa0fd('0x8b'));var _0x15a37f={'where':{'id':_0x16da38[_0xa0fd('0x70')]['id']},'attributes':['id',_0xa0fd('0x82')],'raw':!![]};var _0x5a038c=![];return require(_0xa0fd('0x8c'))[_0xa0fd('0x8d')]()['then'](function(_0x57c1ce){if(_0x57c1ce){_0x5a038c=_0x57c1ce['custom'];}})[_0xa0fd('0x29')](function(){return db['ChatWebsite']['find'](_0x15a37f);})[_0xa0fd('0x29')](handleEntityNotFound(_0x239982,null))[_0xa0fd('0x29')](function(_0x2647f9){if(_0x2647f9){if(!_[_0xa0fd('0x8e')](_0x2647f9[_0xa0fd('0x82')])){if(fs[_0xa0fd('0x8f')](path[_0xa0fd('0x89')](config['root'],_0xa0fd('0x90'),_0x2647f9['sitepic']))&&_0x5a038c){_0x544d47=path[_0xa0fd('0x89')](config['root'],_0xa0fd('0x90'),_0x2647f9[_0xa0fd('0x82')]);}}return _0x239982[_0xa0fd('0x91')](_0x544d47);}})[_0xa0fd('0x5c')](handleError(_0x239982,null));};exports[_0xa0fd('0x92')]=function(_0x5028a5,_0x3743fa){var _0x5d847d=path[_0xa0fd('0x89')](config['root'],_0xa0fd('0x93'));var _0x520c68={'where':{'id':_0x5028a5[_0xa0fd('0x70')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xa0fd('0x4a')]['find'](_0x520c68)[_0xa0fd('0x29')](handleEntityNotFound(_0x3743fa,null))['then'](function(_0x5b3546){if(_0x5b3546){if(!_[_0xa0fd('0x8e')](_0x5b3546[_0xa0fd('0x94')])){if(fs['existsSync'](path[_0xa0fd('0x89')](config[_0xa0fd('0x8a')],'server/files/images/avatars/',_0x5b3546['agentAvatar']))){_0x5d847d=path[_0xa0fd('0x89')](config['root'],'server/files/images/avatars/',_0x5b3546[_0xa0fd('0x94')]);}}return _0x3743fa['download'](_0x5d847d);}})[_0xa0fd('0x5c')](handleError(_0x3743fa,null));};exports[_0xa0fd('0x95')]=function(_0x2e88cf,_0x575f53){var _0x27c385=path[_0xa0fd('0x89')](config[_0xa0fd('0x8a')],_0xa0fd('0x96'));var _0x3e3f64={'where':{'id':_0x2e88cf[_0xa0fd('0x70')]['id']},'attributes':['id',_0xa0fd('0x85'),_0xa0fd('0x97')],'raw':!![]};return db[_0xa0fd('0x4a')][_0xa0fd('0x5f')](_0x3e3f64)['then'](handleEntityNotFound(_0x575f53,null))[_0xa0fd('0x29')](function(_0x27aa2d){if(_0x27aa2d){if(!_[_0xa0fd('0x8e')](_0x27aa2d['customerAvatar'])){if(fs[_0xa0fd('0x8f')](path['join'](config[_0xa0fd('0x8a')],_0xa0fd('0x98'),_0x27aa2d[_0xa0fd('0x85')]))&&_0x27aa2d[_0xa0fd('0x97')]){_0x27c385=path['join'](config[_0xa0fd('0x8a')],_0xa0fd('0x98'),_0x27aa2d[_0xa0fd('0x85')]);}}return _0x575f53[_0xa0fd('0x91')](_0x27c385);}})['catch'](handleError(_0x575f53,null));};exports[_0xa0fd('0x99')]=function(_0x239c6b,_0xdfc377){var _0x4d58cc=path['join'](config[_0xa0fd('0x8a')],_0xa0fd('0x9a'));var _0x201d04={'where':{'id':_0x239c6b[_0xa0fd('0x70')]['id']},'attributes':['id',_0xa0fd('0x87')],'raw':!![]};return db[_0xa0fd('0x4a')][_0xa0fd('0x5f')](_0x201d04)[_0xa0fd('0x29')](handleEntityNotFound(_0xdfc377,null))[_0xa0fd('0x29')](function(_0x1f73f4){if(_0x1f73f4){if(!_[_0xa0fd('0x8e')](_0x1f73f4[_0xa0fd('0x87')])){if(fs[_0xa0fd('0x8f')](path[_0xa0fd('0x89')](config['root'],_0xa0fd('0x98'),_0x1f73f4[_0xa0fd('0x87')]))){_0x4d58cc=path[_0xa0fd('0x89')](config[_0xa0fd('0x8a')],_0xa0fd('0x98'),_0x1f73f4['systemAvatar']);}}return _0xdfc377[_0xa0fd('0x91')](_0x4d58cc);}})[_0xa0fd('0x5c')](handleError(_0xdfc377,null));};function checkWebsiteInterval(_0x2b6d98){var _0x41d6f5=_0x2b6d98[_0xa0fd('0x9b')];if(!_0x41d6f5){return Promise[_0xa0fd('0x9c')](_0x2b6d98);}var _0x4138e9=_0x2b6d98[_0xa0fd('0x9d')]||undefined;return _0x41d6f5[_0xa0fd('0x9e')](_0x4138e9)[_0xa0fd('0x29')](function(_0x3fab51){if(!_0x3fab51){throw new APIOutOfIntervalError();}return _0x2b6d98;});}exports[_0xa0fd('0x9f')]=function(_0x31776b,_0x3afe1a){var _0x44acb5={'body':_0x31776b['body'],'channel':'chat'};var _0x363262=[];var _0x160b0c=[];var _0x3d5af0={};var _0x4c398f=![];if(_0x31776b['body']['id']){delete _0x31776b['body']['id'];}if(_[_0xa0fd('0x8e')](_0x31776b[_0xa0fd('0x61')]['from'])){throw new APIBadRequestError(_0xa0fd('0xa0'));}if(_[_0xa0fd('0x8e')](_0x31776b[_0xa0fd('0x61')][_0xa0fd('0xa1')])){throw new APIBadRequestError(_0xa0fd('0xa2'));}if(_[_0xa0fd('0xa3')](_0x31776b[_0xa0fd('0x61')][_0xa0fd('0x61')])){throw new APIBadRequestError(_0xa0fd('0xa4'));}var _0x2185d6=_0x31776b[_0xa0fd('0x61')][_0xa0fd('0x34')]&&_0x31776b['body'][_0xa0fd('0x3b')];return db[_0xa0fd('0xa5')][_0xa0fd('0x71')]()[_0xa0fd('0x29')](function(_0xff8796){if(!_0xff8796){throw new Error(_0xa0fd('0xa6'));}_0x363262=Object[_0xa0fd('0x76')](_0xff8796)[_0xa0fd('0x56')](function(_0x37475b){return![_0xa0fd('0xa7'),'updatedAt'][_0xa0fd('0xa8')](_0x37475b);});_0x160b0c=Object['keys'](_0xff8796)['filter'](function(_0x55516f){return![_0xa0fd('0xa7'),_0xa0fd('0xa9'),_0xa0fd('0xaa'),'ListId']['includes'](_0x55516f);});if(!_[_0xa0fd('0xa8')](_0x160b0c,_0x31776b[_0xa0fd('0x61')][_0xa0fd('0xa1')])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0x160b0c[_0xa0fd('0x89')](',\x20'));}_0x3d5af0[_0x31776b[_0xa0fd('0x61')][_0xa0fd('0xa1')]]=_0x31776b[_0xa0fd('0x61')][_0xa0fd('0xab')];})[_0xa0fd('0x29')](function(){return db[_0xa0fd('0x4a')]['find']({'where':{'id':_0x31776b['params']['id']},'include':[{'model':db[_0xa0fd('0xac')],'as':_0xa0fd('0xad'),'include':[{'model':db[_0xa0fd('0xa5')],'as':'Contacts','where':_0x3d5af0,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xa0fd('0xae')],'as':'Applications'},{'model':db[_0xa0fd('0x9b')],'as':_0xa0fd('0x9b'),'include':[{'model':db['Interval'],'as':_0xa0fd('0xaf'),'attributes':['id',_0xa0fd('0xb0')],'raw':!![]}]}]});})[_0xa0fd('0x29')](function(_0x250863){if(!_0x250863){throw new APINotFoundError(util[_0xa0fd('0x3e')]('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x31776b[_0xa0fd('0x70')]['id']));}if(_0x2185d6){return checkWebsiteInterval(_0x250863);}return _0x250863;})[_0xa0fd('0x29')](function(_0x2a6825){_0x44acb5[_0xa0fd('0xb1')]=_0x2a6825;_0x44acb5['applications']=_[_0xa0fd('0xb2')](_0x2a6825[_0xa0fd('0xb3')],[_0xa0fd('0xb4')],[_0xa0fd('0xb5')]);if(_0x44acb5[_0xa0fd('0xb1')][_0xa0fd('0xb3')]){delete _0x44acb5['account'][_0xa0fd('0xb3')];}_0x44acb5[_0xa0fd('0xb6')]=_0x2a6825['List']||{'id':_0x2a6825[_0xa0fd('0xb7')]};if(_0x44acb5['list']&&_0x44acb5[_0xa0fd('0xb6')][_0xa0fd('0xb8')][_0xa0fd('0x51')]){return _0x44acb5[_0xa0fd('0xb6')]['Contacts'][0x0];}var _0x38707f=_[_0xa0fd('0x12')](_0x31776b[_0xa0fd('0x61')],{'firstName':_0x31776b[_0xa0fd('0x61')]['from'],'ListId':_0x2a6825['ListId']});_0x38707f[_0x31776b[_0xa0fd('0x61')]['mapKey']]=_0x31776b[_0xa0fd('0x61')][_0xa0fd('0xab')];return db[_0xa0fd('0xa5')][_0xa0fd('0x60')](_0x38707f,{'fields':_0x363262,'raw':!![]});})[_0xa0fd('0x29')](function(_0x389ce9){_0x44acb5[_0xa0fd('0xb9')]=_0x389ce9;var _0x53a8fb=createInteractionObject(_0x31776b[_0xa0fd('0x70')]['id'],_0x31776b[_0xa0fd('0x61')],_0x31776b[_0xa0fd('0xba')],_0x389ce9);var _0x43130a={'ChatWebsiteId':_0x31776b['params']['id']};if(_0x31776b[_0xa0fd('0x61')][_0xa0fd('0xbb')]){_0x43130a[_0xa0fd('0xbb')]=_0x31776b[_0xa0fd('0x61')][_0xa0fd('0xbb')];_0x43130a[_0xa0fd('0xbc')]=![];return db[_0xa0fd('0xbd')][_0xa0fd('0x5f')]({'where':_0x43130a})['then'](function(_0x4195fe){var _0x8f35e4=_0x31776b[_0xa0fd('0x61')][_0xa0fd('0x34')]&&_0x31776b[_0xa0fd('0x61')]['referer'];if(_0x4195fe){_0x4c398f=!![];return _0x4195fe;}else if(!_0x8f35e4&&_0x4195fe&&_0x4195fe[_0xa0fd('0xbc')]){throw new APIConflictError(_0xa0fd('0xbe'));}_0x53a8fb[_0xa0fd('0xbb')]=_0x31776b['body']['threadId'];_0x53a8fb['externalUrl']=_0x31776b[_0xa0fd('0x61')][_0xa0fd('0xbf')];return db[_0xa0fd('0xbd')]['create'](_0x53a8fb);});}_0x43130a[_0xa0fd('0xc0')]=_0x389ce9['id'];if(_0x31776b['body'][_0xa0fd('0xc1')]&&_0x31776b['body']['interaction']['id']){_0x43130a['id']=_0x31776b['body']['interaction']['id'];return db['ChatInteraction'][_0xa0fd('0x5f')]({'where':_0x43130a})[_0xa0fd('0x29')](function(_0x42cd7a){var _0x4e5e6a=_0x31776b[_0xa0fd('0x61')][_0xa0fd('0x34')]&&_0x31776b['body'][_0xa0fd('0x3b')];if(!_0x4e5e6a&&_0x42cd7a&&_0x42cd7a['closed']){throw new APIConflictError(_0xa0fd('0xbe'));}else if(_0x42cd7a){_0x4c398f=!![];return _0x42cd7a;}else{return db['ChatInteraction'][_0xa0fd('0x60')](_0x53a8fb);}});}return db['ChatInteraction'][_0xa0fd('0x60')](_0x53a8fb);})['then'](function(_0xba90df){if(!_0x4c398f){return _0xba90df;}var _0x195fe5={'from':(_0x44acb5[_0xa0fd('0xb9')][_0xa0fd('0x38')]||'')+'\x20'+(_0x44acb5['contact'][_0xa0fd('0x39')]||'')};if(_0x31776b[_0xa0fd('0x61')][_0xa0fd('0xbb')]&&_0x31776b[_0xa0fd('0x61')][_0xa0fd('0xc2')]&&_0x31776b[_0xa0fd('0x61')][_0xa0fd('0xbb')]!=_0x31776b['body'][_0xa0fd('0xc2')]){_0x195fe5[_0xa0fd('0xbb')]=_0x31776b['body'][_0xa0fd('0xc2')];}return _0xba90df[_0xa0fd('0x6f')](_0x195fe5);})[_0xa0fd('0x29')](function(_0xf5dff9){_0x44acb5['interaction']=_0xf5dff9[_0xa0fd('0x2b')]({'plain':!![]});_0x44acb5[_0xa0fd('0xc1')][_0xa0fd('0xc3')]=!_0x4c398f;if(_0x44acb5[_0xa0fd('0xc1')][_0xa0fd('0xc3')]){if(_0x44acb5[_0xa0fd('0xb1')][_0xa0fd('0xc4')]){_0x44acb5['applications'][_0xa0fd('0xc5')]({'id':0x0,'priority':_0x44acb5['applications'][_0xa0fd('0x51')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0xa0fd('0xc6')]['create']({'body':_0x31776b[_0xa0fd('0x61')][_0xa0fd('0x61')],'ChatWebsiteId':_0x31776b[_0xa0fd('0x70')]['id'],'ChatInteractionId':_0xf5dff9['id'],'direction':'in','ContactId':_0x44acb5[_0xa0fd('0xb9')]['id'],'AttachmentId':_0x31776b[_0xa0fd('0x61')][_0xa0fd('0xc7')]});})['then'](function(_0x4d2500){_0x44acb5[_0xa0fd('0x1f')]=_0x4d2500;if(!_0x44acb5[_0xa0fd('0xc1')][_0xa0fd('0xc8')]){return;}return db['User'][_0xa0fd('0x5f')]({'attributes':['id','name'],'where':{'id':_0x44acb5[_0xa0fd('0xc1')][_0xa0fd('0xc8')]}});})[_0xa0fd('0x29')](function(_0x259193){if(_0x259193){_0x44acb5[_0xa0fd('0xc9')][_0xa0fd('0xca')]({'id':0x0,'priority':0x0,'app':_0xa0fd('0xcb'),'appdata':_0x259193[_0xa0fd('0x2f')]+','+(_0x44acb5[_0xa0fd('0xb1')][_0xa0fd('0xcc')]||0xa),'interval':_0xa0fd('0xcd')});_0x44acb5[_0xa0fd('0xce')]=!![];}if(!_0x44acb5[_0xa0fd('0xc1')]['queueId']){return;}return db['ChatQueue'][_0xa0fd('0x5f')]({'attributes':['id',_0xa0fd('0x2f')],'where':{'id':_0x44acb5[_0xa0fd('0xc1')][_0xa0fd('0xcf')]}});})[_0xa0fd('0x29')](function(_0x19515b){if(_0x19515b){_0x44acb5['applications'][_0xa0fd('0xca')]({'id':0x0,'priority':0x1,'app':_0xa0fd('0xd0'),'appdata':_0x19515b['name']+','+(_0x44acb5[_0xa0fd('0xb1')][_0xa0fd('0xd1')]||0x12c),'interval':_0xa0fd('0xcd')});}return respondWithRpcPromise(_0xa0fd('0xd2'),_0xa0fd('0xd3'),_0x44acb5);})[_0xa0fd('0x29')](function(_0x235fc2){respondWithRpcPromise(_0xa0fd('0xd4'),_0xa0fd('0xd4'),{'event':_0xa0fd('0x9f'),'message':_0x235fc2},client9002);return _0x235fc2;})[_0xa0fd('0x29')](respondWithResult(_0x3afe1a,null))[_0xa0fd('0x5c')](APIHandleError(_0x3afe1a));};exports[_0xa0fd('0xd5')]=function(_0x214ff2,_0x174406){var _0x4e4153,_0x48e0c0,_0x1807e3;var _0x442e23=[];var _0x42365d={};var _0x32e160=_0x214ff2['files']||[];var _0x49ae73=[];var _0x120fb2;return db[_0xa0fd('0xa5')][_0xa0fd('0x71')]()[_0xa0fd('0x29')](function(_0x4c95e2){if(!_0x4c95e2){throw new db[(_0xa0fd('0xd6'))][(_0xa0fd('0xd7'))](_0xa0fd('0xd8'));}_0x442e23=_[_0xa0fd('0xd9')](_[_0xa0fd('0x76')](_0x4c95e2),['createdAt',_0xa0fd('0xa9'),'CompanyId',_0xa0fd('0xb7')]);if(_0x214ff2['body']['id']){delete _0x214ff2[_0xa0fd('0x61')]['id'];}if(_[_0xa0fd('0x8e')](_0x214ff2[_0xa0fd('0x61')]['from'])){throw _0x174406[_0xa0fd('0x22')](0x1f4)[_0xa0fd('0x30')](new db[(_0xa0fd('0xd6'))][(_0xa0fd('0xd7'))](_0xa0fd('0xda')));}if(_[_0xa0fd('0x8e')](_0x214ff2[_0xa0fd('0x61')][_0xa0fd('0x61')])||_0x214ff2['body'][_0xa0fd('0x61')]===''){throw _0x174406[_0xa0fd('0x22')](0x1f4)['send'](new db[(_0xa0fd('0xd6'))][(_0xa0fd('0xd7'))](_0xa0fd('0xdb')));}if(_[_0xa0fd('0x8e')](_0x214ff2[_0xa0fd('0x61')][_0xa0fd('0xdc')])){throw _0x174406[_0xa0fd('0x22')](0x1f4)[_0xa0fd('0x30')](new db[(_0xa0fd('0xd6'))][(_0xa0fd('0xd7'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x442e23));}if(!_[_0xa0fd('0xa8')](_0x442e23,_0x214ff2[_0xa0fd('0x61')][_0xa0fd('0xdc')])){throw _0x174406[_0xa0fd('0x22')](0x1f4)[_0xa0fd('0x30')](new db[(_0xa0fd('0xd6'))]['ValidationError'](_0xa0fd('0xdd')+_0x442e23));}_0x42365d[_0x214ff2[_0xa0fd('0x61')]['mapKeyOffline']]=_0x214ff2[_0xa0fd('0x61')]['from'];})[_0xa0fd('0x29')](function(){return db[_0xa0fd('0x4a')][_0xa0fd('0x5f')]({'where':{'id':_0x214ff2[_0xa0fd('0x70')]['id']},'include':[{'model':db[_0xa0fd('0xac')],'as':_0xa0fd('0xad')},{'model':db[_0xa0fd('0xde')],'as':_0xa0fd('0xde')}]});})[_0xa0fd('0x29')](handleEntityNotFound(_0x174406,null))[_0xa0fd('0x29')](function(_0x31d06){if(_0x31d06&&_0x31d06[_0xa0fd('0xad')]){_0x48e0c0=_0x31d06;var _0x504f6d=_[_0xa0fd('0x12')](_0x214ff2['body'],{'firstName':_0x214ff2['body'][_0xa0fd('0xab')],'phone':_0x214ff2[_0xa0fd('0x61')][_0xa0fd('0xab')],'ListId':_0x31d06['ListId']});_0x504f6d[_0x214ff2[_0xa0fd('0x61')][_0xa0fd('0xdc')]]=_0x214ff2['body'][_0xa0fd('0xab')];return db['CmContact'][_0xa0fd('0xdf')]({'where':_0x42365d,'defaults':_0x504f6d});}})[_0xa0fd('0xe0')](function(_0x29b790){if(_0x29b790){_0x1807e3=_0x29b790;var _0x13aac3=fs[_0xa0fd('0xe1')](path[_0xa0fd('0x89')](config[_0xa0fd('0x8a')],_0xa0fd('0xe2')),_0xa0fd('0xe3'));var _0x549ac2=ejs['render'](_0x13aac3,{'body':_['toPairs'](_0x214ff2[_0xa0fd('0x61')][_0xa0fd('0x61')]),'bodyTitle':_0x48e0c0[_0xa0fd('0xe4')]});return db[_0xa0fd('0xe5')]['create']({'body':_0x549ac2,'plainBody':htmlToText['fromString'](_0x549ac2),'ContactId':_0x29b790['id'],'ChatWebsiteId':_0x48e0c0['id']});}})['then'](function(_0x36c22d){_0x120fb2=_0x36c22d;if(_0x32e160[_0xa0fd('0x51')]){var _0x12f159=_0x32e160[_0xa0fd('0x49')](function(_0x1fe7b3){return{'name':_0x1fe7b3['originalname'],'basename':_0x1fe7b3[_0xa0fd('0x83')],'type':_0x1fe7b3['mimetype'],'ChatOfflineMessageId':_0x36c22d['id']};});_0x49ae73=_0x12f159[_0xa0fd('0x49')](_0x5b8536=>{var _0x330cf5={'filename':_0x5b8536[_0xa0fd('0x2f')],'path':path[_0xa0fd('0x89')](config['root'],_0xa0fd('0xe6'),'files',_0xa0fd('0xe7'),'offline-chat',_0x5b8536[_0xa0fd('0xe8')])};return _0x330cf5;});if(!_0x48e0c0[_0xa0fd('0xe9')]){return db['sequelize'][_0xa0fd('0xea')](function(_0xf20388){return db[_0xa0fd('0xeb')][_0xa0fd('0xec')](_0x12f159,{'transaction':_0xf20388});});}}})[_0xa0fd('0x29')](function(){if(_0x120fb2){_0x4e4153=_0x120fb2;return db[_0xa0fd('0xde')][_0xa0fd('0x75')]({'where':{'service':!![]},'include':[{'model':db[_0xa0fd('0xed')],'as':_0xa0fd('0xee'),'raw':!![],'include':[{'model':db[_0xa0fd('0xef')],'as':_0xa0fd('0xef'),'raw':!![]}]}]});}})[_0xa0fd('0x29')](function(_0x52e9d5){if(_0x52e9d5&&_0x52e9d5['Smtp']&&_0x48e0c0[_0xa0fd('0xf0')]&&_0x48e0c0[_0xa0fd('0xf1')]){var _0x53e964=_0x52e9d5[_0xa0fd('0xf2')]();return respondWithRpcPromise(_0xa0fd('0xf3'),'sendMail',{'account':_0x53e964,'message':{'from':util[_0xa0fd('0x3e')](_0xa0fd('0xf4'),_0x52e9d5[_0xa0fd('0x2f')],_0x52e9d5[_0xa0fd('0xf5')]||_0x52e9d5[_0xa0fd('0xee')][_0xa0fd('0x68')]),'to':_0x48e0c0[_0xa0fd('0xf1')],'subject':_0x48e0c0[_0xa0fd('0xf6')],'html':_0x4e4153[_0xa0fd('0x61')],'attachments':_0x49ae73}},client9003)[_0xa0fd('0x29')](function(){return _0x4e4153;})[_0xa0fd('0x5c')](function(_0x384fd9){logger[_0xa0fd('0x1d')](_0x384fd9);});}})['then'](function(){if(_0x48e0c0&&_0x48e0c0[_0xa0fd('0xe9')]&&_0x48e0c0[_0xa0fd('0xf7')]){var _0x8e6ad8=[];if(_0x32e160[_0xa0fd('0x51')]){_0x8e6ad8=_0x32e160['map'](function(_0x35ed76){return{'name':_0x35ed76[_0xa0fd('0xf8')],'basename':_0x35ed76[_0xa0fd('0x83')],'type':_0x35ed76[_0xa0fd('0xf9')],'ChatOfflineMessageId':_0x120fb2['id']};});}var _0x548cd1;if(!_['isNil'](_0x48e0c0[_0xa0fd('0xfa')])){var _0x21f169=_['map'](_0x214ff2['body'],function(_0x23826c){return _0x23826c;});var _0x14eed8=_['toPairsIn'](_0x21f169)[0x0];var _0x59a9d6=_[_0xa0fd('0xfb')](_0x14eed8,function(_0x208022){return _0x208022;});_0x548cd1=_0x59a9d6[0x1][_0x48e0c0[_0xa0fd('0xfa')]];}var _0x2cb010={'from':_0x1807e3[_0xa0fd('0xf5')],'firstName':_0x1807e3[_0xa0fd('0x38')],'lastName':_0x1807e3[_0xa0fd('0x39')],'mapKey':_0xa0fd('0xf5'),'message':{'from':_0x1807e3['email'],'to':_0x48e0c0[_0xa0fd('0xde')][_0xa0fd('0xf5')],'cc':'','subject':_[_0xa0fd('0x8e')](_0x548cd1)?_0x48e0c0[_0xa0fd('0xf6')]:_0x548cd1,'messageId':'','sentAt':new Date(),'attach':_0x8e6ad8[_0xa0fd('0x51')],'attachments':_0x8e6ad8,'originChannel':_0xa0fd('0xfc'),'ChatWebsiteId':_0x48e0c0['id'],'ChatOfflineMessageId':_0x4e4153['id'],'originTo':_0x48e0c0['MailAccount'][_0xa0fd('0xf5')]},'body':_0x4e4153[_0xa0fd('0x61')]};var _0x2cbaea={'account':{'id':_0x48e0c0[_0xa0fd('0xf7')]},'body':_0x2cb010,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0xa0fd('0xfd'),_0x2cbaea,client9001)[_0xa0fd('0x29')](function(){return _0x4e4153;})['catch'](function(_0x1d6296){logger[_0xa0fd('0x1d')](_0x1d6296);});}return;})[_0xa0fd('0x29')](function(){if(_0x4e4153){return _0x4e4153;}})[_0xa0fd('0x29')](respondWithResult(_0x174406,null))[_0xa0fd('0x5c')](function(){for(var _0x3257c6 of _0x32e160){var _0x1acc84=path[_0xa0fd('0x89')](config[_0xa0fd('0x8a')],_0xa0fd('0xe6'),'files','attachments',_0xa0fd('0xfe'),_0x3257c6[_0xa0fd('0x83')]);fs_extra[_0xa0fd('0xff')](_0x1acc84)[_0xa0fd('0x5c')](function(_0x1aec9d){logger['error']('Could\x20not\x20remove\x20attachment\x20file',_0x1acc84,_0x1aec9d);});}});};exports[_0xa0fd('0x100')]=function(_0x136591,_0x567244){return db[_0xa0fd('0xbd')][_0xa0fd('0x5f')]({'where':{'id':_0x136591['params']['id']}})['then'](handleEntityNotFound(_0x567244,null))[_0xa0fd('0x29')](function(_0x6ee599){if(_0x6ee599){return _0x6ee599[_0xa0fd('0x100')](_0x136591[_0xa0fd('0x61')]['ids'],_[_0xa0fd('0x101')](_0x136591[_0xa0fd('0x61')],[_0xa0fd('0x80'),'id'])||{});}})[_0xa0fd('0x29')](respondWithResult(_0x567244,null))[_0xa0fd('0x5c')](handleError(_0x567244,null));};exports[_0xa0fd('0x102')]=function(_0x108811,_0x1b5223){var _0x180281={'raw':![],'where':{}};var _0x571ce7={};var _0x7b7808={'count':0x0,'rows':[]};return db[_0xa0fd('0x4a')]['findOne']({'where':{'id':_0x108811[_0xa0fd('0x70')]['id']}})['then'](handleEntityNotFound(_0x1b5223,null))[_0xa0fd('0x29')](function(_0xf5039e){if(_0xf5039e){_0x571ce7['model']=_[_0xa0fd('0x76')](db[_0xa0fd('0xbd')][_0xa0fd('0x7e')]);_0x571ce7[_0xa0fd('0x4d')]=_[_0xa0fd('0x76')](_0x108811['query']);_0x571ce7['filters']=_[_0xa0fd('0x4f')](_0x571ce7[_0xa0fd('0x44')],_0x571ce7[_0xa0fd('0x4d')]);_0x180281[_0xa0fd('0x4e')]=_[_0xa0fd('0x4f')](_0x571ce7[_0xa0fd('0x44')],qs[_0xa0fd('0x50')](_0x108811['query'][_0xa0fd('0x50')]));_0x180281[_0xa0fd('0x4e')]=_0x180281[_0xa0fd('0x4e')][_0xa0fd('0x51')]?_0x180281[_0xa0fd('0x4e')]:_0x571ce7['model'];if(!_0x108811[_0xa0fd('0x4d')][_0xa0fd('0x78')](_0xa0fd('0x79'))){_0x180281[_0xa0fd('0x26')]=qs[_0xa0fd('0x26')](_0x108811[_0xa0fd('0x4d')]['limit']);_0x180281[_0xa0fd('0x28')]=qs['offset'](_0x108811['query'][_0xa0fd('0x28')]);}_0x180281[_0xa0fd('0x7a')]=qs['sort'](_0x108811[_0xa0fd('0x4d')][_0xa0fd('0x52')]);_0x180281[_0xa0fd('0x53')]=qs[_0xa0fd('0x54')](_[_0xa0fd('0x55')](_0x108811[_0xa0fd('0x4d')],_0x571ce7[_0xa0fd('0x54')]));_0x180281[_0xa0fd('0x53')]['ChatWebsiteId']=_0xf5039e['id'];if(_0x108811[_0xa0fd('0x4d')][_0xa0fd('0x56')]){_0x180281[_0xa0fd('0x53')]=_['merge'](_0x180281[_0xa0fd('0x53')],{'$or':_[_0xa0fd('0x49')](_0x180281['attributes'],function(_0x20b71e){var _0xb927a7={};_0xb927a7[_0x20b71e]={'$like':'%'+_0x108811[_0xa0fd('0x4d')]['filter']+'%'};return _0xb927a7;})});}_0x180281=_[_0xa0fd('0x58')]({},_0x180281,_0x108811[_0xa0fd('0x5e')]);return db['ChatInteraction'][_0xa0fd('0x27')]({'where':_0x180281[_0xa0fd('0x53')]})[_0xa0fd('0x29')](function(_0x2094fd){_0x7b7808['count']=_0x2094fd;if(_0x108811['query']['includeAll']){_0x180281['include']=[{'model':db[_0xa0fd('0xa5')],'as':_0xa0fd('0x103'),'required':![]},{'model':db[_0xa0fd('0x104')],'as':_0xa0fd('0x105'),'attributes':[_0xa0fd('0x2f'),_0xa0fd('0x106'),_0xa0fd('0x107')],'required':![]},{'model':db[_0xa0fd('0x108')],'as':_0xa0fd('0x109'),'attributes':['id',_0xa0fd('0x2f'),'color'],'where':_0x108811[_0xa0fd('0x4d')][_0xa0fd('0x10a')]?{'id':_0x108811['query'][_0xa0fd('0x10a')]}:undefined,'required':_0x108811['query'][_0xa0fd('0x10a')]?!![]:![]}];}return db[_0xa0fd('0xbd')]['findAll'](_0x180281);})['then'](function(_0x184747){_0x7b7808[_0xa0fd('0x5b')]=_0x184747;return _0x7b7808;});}})[_0xa0fd('0x29')](respondWithFilteredResult(_0x1b5223,_0x180281))[_0xa0fd('0x5c')](handleError(_0x1b5223,null));};exports[_0xa0fd('0x10b')]=function(_0x1f1f70,_0x34f26d){var _0x2b5339=0x0;var _0x561ee8=0x0;var _0x467828=![];var _0x4410d3;var _0x2dd046;return db[_0xa0fd('0x4a')]['find']({'where':{'id':_0x1f1f70[_0xa0fd('0x70')]['id']},'include':[{'model':db[_0xa0fd('0x9b')],'as':_0xa0fd('0x9b'),'include':[{'model':db['Interval'],'as':_0xa0fd('0xaf'),'attributes':['id',_0xa0fd('0xb0')]}]}]})[_0xa0fd('0x29')](handleEntityNotFound(_0x34f26d,null))[_0xa0fd('0x29')](function(_0x169292){if(_0x169292){_0x4410d3=_0x169292;return _0x169292['getProactiveActions']({'raw':!![]});}})[_0xa0fd('0x29')](function(_0x4f86bd){if(_0x4410d3){if(_0x4f86bd){_0x2dd046=_0x4f86bd;}}return require(_0xa0fd('0x8c'))[_0xa0fd('0x8d')]();})[_0xa0fd('0x29')](function(_0x1540d0){if(_0x1540d0){_0x561ee8=_0x1540d0[_0xa0fd('0x10c')];_0x467828=_0x1540d0[_0xa0fd('0x10d')];}})[_0xa0fd('0x29')](function(){return db[_0xa0fd('0xbd')][_0xa0fd('0x27')]({'where':{'closed':![]}});})[_0xa0fd('0x29')](function(_0x1e8ca9){_0x2b5339=_0x1e8ca9;if(_0x561ee8&&_0x1e8ca9>_0x561ee8){return db[_0xa0fd('0x10e')][_0xa0fd('0x75')]({'where':{'id':0x1}})[_0xa0fd('0x29')](function(_0x2d73c8){if(_0x2d73c8){_0x2d73c8[_0xa0fd('0x10f')](_0xa0fd('0x110'));}});}})['then'](function(){var _0x245bd2=_0x4410d3['Interval'];var _0x8b14b0=_0x4410d3[_0xa0fd('0x9d')]||undefined;return _0x245bd2?_0x245bd2['ifTime'](_0x8b14b0):!![];})['then'](function(_0x393d4d){var _0x34b2b0=fs[_0xa0fd('0xe1')](path[_0xa0fd('0x89')](config[_0xa0fd('0x8a')],_0xa0fd('0x111')),'utf8');var _0x44ccc5=_0xa0fd('0x112');var _0x4ba475=![];var _0x188b93,_0x2ee2d2;if(_0x1f1f70[_0xa0fd('0xba')]['referer']){_0x188b93=new URL(_0x1f1f70[_0xa0fd('0xba')][_0xa0fd('0x3b')])[_0xa0fd('0x113')];}else if(_0x1f1f70['headers'][_0xa0fd('0x113')]){_0x188b93=new URL(_0x1f1f70['headers'][_0xa0fd('0x113')])[_0xa0fd('0x113')];}else{_0x188b93=_0xa0fd('0x114');}_0x2ee2d2=typeof _0x4410d3[_0xa0fd('0x62')][_0xa0fd('0x63')](',')[_0xa0fd('0x5f')](function(_0xe2fb30){return wildcardUtils[_0xa0fd('0x115')](_0xe2fb30,_0x188b93);})!==_0xa0fd('0x25');var _0x2a1b40={'chatVersion':_0x44ccc5,'chatWebsiteAddressOrigin':_0x2ee2d2?_0x188b93:_0x4410d3[_0xa0fd('0x62')],'remote':_0x4410d3[_0xa0fd('0x116')],'query':querystring[_0xa0fd('0x1c')](_[_0xa0fd('0x58')](_0x4410d3['get']({'plain':!![]}),{'customerIp':_0x1f1f70[_0xa0fd('0xba')][_0xa0fd('0x36')]||_0x1f1f70[_0xa0fd('0xba')][_0xa0fd('0x117')]||_0x1f1f70[_0xa0fd('0x118')][_0xa0fd('0x119')]||_0x1f1f70['ip'],'referer':_0x1f1f70[_0xa0fd('0xba')][_0xa0fd('0x3b')],'openedInteractions':_0x2b5339,'maxInteractions':_0x561ee8,'virtual':_0x467828[_0xa0fd('0x10c')],'online':_0x393d4d,'custom':_0x467828,'address':_0x2ee2d2?_0x188b93:null}))['replace'](/'/g,'\x5c\x27')};_0x34f26d[_0xa0fd('0x30')](ejs['render'](Mustache[_0xa0fd('0x11a')](_0x34b2b0,_0x2a1b40),{'proactiveActions':_0x2dd046,'alignment':_0x4410d3[_0xa0fd('0x11b')],'verticalAlignment':_0x4410d3['verticalAlignment'],'div_color':_0x4410d3['color'],'labelText':_0x4410d3['labelText'],'text_color':_0x4410d3[_0xa0fd('0x11c')],'text_button_color':_0x4410d3['textButtonColor'],'button_color':_0x4410d3[_0xa0fd('0x11d')],'background_color':_0x4410d3[_0xa0fd('0x11e')],'hideWhenOffline':_0x4410d3[_0xa0fd('0x11f')],'intervalId':_0x4410d3[_0xa0fd('0x120')],'isDevelopment':_0x4ba475,'chatVersion':_0x44ccc5}));})[_0xa0fd('0x5c')](handleError(_0x34f26d,null));};exports[_0xa0fd('0x121')]=function(_0x3ff43e,_0xada1a0){var _0x1b5abb=_0x3ff43e['params']['id'];var _0x29de9b=_0x3ff43e[_0xa0fd('0x61')];var _0x4d1788=0xc8;var _0x447a6e=null;return db[_0xa0fd('0x122')]['transaction']({'isolationLevel':db[_0xa0fd('0x122')][_0xa0fd('0x123')]['ISOLATION_LEVELS'][_0xa0fd('0x124')]},function(_0x25227b){return db['ChatWebsite'][_0xa0fd('0x75')]({'where':{'id':_0x1b5abb},'transaction':_0x25227b})[_0xa0fd('0x29')](function(_0x139b1b){if(_0x139b1b){return db[_0xa0fd('0xae')][_0xa0fd('0x2a')]({'where':{'ChatWebsiteId':_0x1b5abb},'transaction':_0x25227b})[_0xa0fd('0x29')](function(){var _0x1ee64c=_[_0xa0fd('0x49')](_0x29de9b,function(_0x2583a9){_0x2583a9['ChatWebsiteId']=_0x1b5abb;return _0x2583a9;});return db[_0xa0fd('0xae')][_0xa0fd('0xec')](_0x1ee64c,{'transaction':_0x25227b});});}else{_0x4d1788=0x194;_0x447a6e=[];}});})[_0xa0fd('0x29')](function(){if(_0x4d1788!==0x194){return db[_0xa0fd('0xae')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x1b5abb},'order':_0xa0fd('0xb4')})[_0xa0fd('0x29')](function(_0x264a28){_0x447a6e=_0x264a28;});}})[_0xa0fd('0x5c')](function(_0x10ed7d){_0x4d1788=0x1f4;logger[_0xa0fd('0x1d')](_0x10ed7d['stack']);if(_0x10ed7d[_0xa0fd('0x2f')]){delete _0x10ed7d[_0xa0fd('0x2f')];}_0x447a6e=_0x10ed7d;})[_0xa0fd('0x125')](function(){if(_0x447a6e===null){_0xada1a0[_0xa0fd('0x2d')](_0x4d1788);}else{if(_0x4d1788===0x1f4){_0xada1a0[_0xa0fd('0x22')](_0x4d1788)['send'](_0x447a6e);}else{_0xada1a0[_0xa0fd('0x22')](_0x4d1788)[_0xa0fd('0x24')](_0x447a6e);}}});};exports[_0xa0fd('0x126')]=function(_0x44d5a8,_0x4639b9){var _0x588214={};var _0x19a1a9={};var _0x3d212f;var _0x5c9f33;return db[_0xa0fd('0x4a')][_0xa0fd('0x75')]({'where':{'id':_0x44d5a8[_0xa0fd('0x70')]['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0x4639b9,null))[_0xa0fd('0x29')](function(_0x3af596){if(_0x3af596){_0x3d212f=_0x3af596;_0x19a1a9[_0xa0fd('0x44')]=_['keys'](db[_0xa0fd('0xae')][_0xa0fd('0x7e')]);_0x19a1a9[_0xa0fd('0x4d')]=_['keys'](_0x44d5a8[_0xa0fd('0x4d')]);_0x19a1a9[_0xa0fd('0x54')]=_['intersection'](_0x19a1a9[_0xa0fd('0x44')],_0x19a1a9[_0xa0fd('0x4d')]);_0x588214['attributes']=_[_0xa0fd('0x4f')](_0x19a1a9[_0xa0fd('0x44')],qs[_0xa0fd('0x50')](_0x44d5a8[_0xa0fd('0x4d')][_0xa0fd('0x50')]));_0x588214[_0xa0fd('0x4e')]=_0x588214['attributes']['length']?_0x588214[_0xa0fd('0x4e')]:_0x19a1a9['model'];_0x588214[_0xa0fd('0x7a')]=qs[_0xa0fd('0x52')](_0x44d5a8[_0xa0fd('0x4d')][_0xa0fd('0x52')]);_0x588214[_0xa0fd('0x53')]=qs['filters'](_[_0xa0fd('0x55')](_0x44d5a8['query'],_0x19a1a9['filters']));if(_0x44d5a8[_0xa0fd('0x4d')][_0xa0fd('0x56')]){_0x588214['where']=_[_0xa0fd('0x58')](_0x588214['where'],{'$or':_['map'](_0x588214[_0xa0fd('0x4e')],function(_0x14a866){var _0xb5a5bf={};_0xb5a5bf[_0x14a866]={'$like':'%'+_0x44d5a8[_0xa0fd('0x4d')][_0xa0fd('0x56')]+'%'};return _0xb5a5bf;})});}_0x588214=_[_0xa0fd('0x58')]({},_0x588214,_0x44d5a8[_0xa0fd('0x5e')]);return _0x3d212f[_0xa0fd('0x126')](_0x588214);}})[_0xa0fd('0x29')](function(_0x266848){if(_0x266848){_0x5c9f33=_0x266848['length'];if(!_0x44d5a8[_0xa0fd('0x4d')][_0xa0fd('0x78')](_0xa0fd('0x79'))){_0x588214[_0xa0fd('0x26')]=qs[_0xa0fd('0x26')](_0x44d5a8[_0xa0fd('0x4d')][_0xa0fd('0x26')]);_0x588214[_0xa0fd('0x28')]=qs['offset'](_0x44d5a8['query'][_0xa0fd('0x28')]);}return _0x3d212f[_0xa0fd('0x126')](_0x588214);}})[_0xa0fd('0x29')](function(_0x2cf9ed){if(_0x2cf9ed){return _0x2cf9ed?{'count':_0x5c9f33,'rows':_0x2cf9ed}:null;}})[_0xa0fd('0x29')](respondWithResult(_0x4639b9,null))[_0xa0fd('0x5c')](handleError(_0x4639b9,null));};exports[_0xa0fd('0x127')]=function(_0x52d5a9,_0x5918ed){return db[_0xa0fd('0x128')][_0xa0fd('0x5f')]({'where':{'id':_0x52d5a9[_0xa0fd('0x70')]['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0x5918ed,null))[_0xa0fd('0x29')](function(_0x77ab48){if(_0x77ab48){return _0x77ab48['addProactiveActions'](_0x52d5a9['body'][_0xa0fd('0x80')],_['omit'](_0x52d5a9[_0xa0fd('0x61')],['ids','id'])||{});}})[_0xa0fd('0x29')](respondWithResult(_0x5918ed,null))[_0xa0fd('0x5c')](handleError(_0x5918ed,null));};exports[_0xa0fd('0x129')]=function(_0x1bcb40,_0x39b66b){var _0x6d66bf={};var _0x547549={};var _0x7d6fdf;var _0x5bf1a5;return db[_0xa0fd('0x4a')]['findOne']({'where':{'id':_0x1bcb40[_0xa0fd('0x70')]['id']}})['then'](handleEntityNotFound(_0x39b66b,null))[_0xa0fd('0x29')](function(_0x1320bd){if(_0x1320bd){_0x7d6fdf=_0x1320bd;_0x547549[_0xa0fd('0x44')]=_[_0xa0fd('0x76')](db[_0xa0fd('0x12a')]['rawAttributes']);_0x547549[_0xa0fd('0x4d')]=_[_0xa0fd('0x76')](_0x1bcb40[_0xa0fd('0x4d')]);_0x547549[_0xa0fd('0x54')]=_[_0xa0fd('0x4f')](_0x547549[_0xa0fd('0x44')],_0x547549[_0xa0fd('0x4d')]);_0x6d66bf[_0xa0fd('0x4e')]=_[_0xa0fd('0x4f')](_0x547549[_0xa0fd('0x44')],qs[_0xa0fd('0x50')](_0x1bcb40[_0xa0fd('0x4d')]['fields']));_0x6d66bf[_0xa0fd('0x4e')]=_0x6d66bf[_0xa0fd('0x4e')][_0xa0fd('0x51')]?_0x6d66bf['attributes']:_0x547549['model'];_0x6d66bf[_0xa0fd('0x7a')]=qs[_0xa0fd('0x52')](_0x1bcb40[_0xa0fd('0x4d')][_0xa0fd('0x52')]);_0x6d66bf['where']=qs[_0xa0fd('0x54')](_[_0xa0fd('0x55')](_0x1bcb40[_0xa0fd('0x4d')],_0x547549[_0xa0fd('0x54')]));if(_0x1bcb40[_0xa0fd('0x4d')][_0xa0fd('0x56')]){_0x6d66bf['where']=_[_0xa0fd('0x58')](_0x6d66bf[_0xa0fd('0x53')],{'$or':_[_0xa0fd('0x49')](_0x6d66bf[_0xa0fd('0x4e')],function(_0x22014e){var _0x19dfe3={};_0x19dfe3[_0x22014e]={'$like':'%'+_0x1bcb40[_0xa0fd('0x4d')][_0xa0fd('0x56')]+'%'};return _0x19dfe3;})});}_0x6d66bf=_['merge']({},_0x6d66bf,_0x1bcb40['options']);return _0x7d6fdf[_0xa0fd('0x129')](_0x6d66bf);}})['then'](function(_0x1131e3){if(_0x1131e3){_0x5bf1a5=_0x1131e3[_0xa0fd('0x51')];if(!_0x1bcb40['query']['hasOwnProperty'](_0xa0fd('0x79'))){_0x6d66bf[_0xa0fd('0x26')]=qs['limit'](_0x1bcb40[_0xa0fd('0x4d')]['limit']);_0x6d66bf[_0xa0fd('0x28')]=qs[_0xa0fd('0x28')](_0x1bcb40[_0xa0fd('0x4d')]['offset']);}return _0x7d6fdf['getProactiveActions'](_0x6d66bf);}})['then'](function(_0x5a60a9){if(_0x5a60a9){return _0x5a60a9?{'count':_0x5bf1a5,'rows':_0x5a60a9}:null;}})[_0xa0fd('0x29')](respondWithResult(_0x39b66b,null))['catch'](handleError(_0x39b66b,null));};exports[_0xa0fd('0x12b')]=function(_0x3b0925,_0x3ce595){var _0x56628c=_0x3b0925[_0xa0fd('0x4d')][_0xa0fd('0x12c')]==='false'?'offlineForm':_0xa0fd('0x12d');return db[_0xa0fd('0x4a')][_0xa0fd('0x5f')]({'attributes':['id',_0x56628c],'where':{'id':_0x3b0925[_0xa0fd('0x70')]['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0x3ce595,null))[_0xa0fd('0x29')](function(_0x158b1b){if(_0x158b1b){var _0x172b4a=_0x158b1b[_0x56628c];var _0x299209=_0x172b4a&&_0x172b4a[_0xa0fd('0x12e')]?_0x172b4a[_0xa0fd('0x12e')]:[];_0x3ce595[_0xa0fd('0x30')]({'fromKey':_[_0xa0fd('0x8e')](_0x172b4a[_0xa0fd('0x12f')])?undefined:_0x172b4a['fromKey'],'count':_0x299209[_0xa0fd('0x51')],'rows':_0x299209});}})[_0xa0fd('0x5c')](handleError(_0x3ce595,null));};exports[_0xa0fd('0x130')]=function(_0x2d4dc4,_0x2777c0){var _0x3f21a8={'raw':![],'where':{}};var _0x275578={};var _0x11a06a={'count':0x0,'rows':[]};return db[_0xa0fd('0x4a')][_0xa0fd('0x75')]({'where':{'id':_0x2d4dc4[_0xa0fd('0x70')]['id']}})['then'](handleEntityNotFound(_0x2777c0,null))['then'](function(_0x462b31){if(_0x462b31){_0x275578[_0xa0fd('0x44')]=_[_0xa0fd('0x76')](db[_0xa0fd('0xe5')][_0xa0fd('0x7e')]);_0x275578[_0xa0fd('0x4d')]=_['keys'](_0x2d4dc4['query']);_0x275578[_0xa0fd('0x54')]=_[_0xa0fd('0x4f')](_0x275578[_0xa0fd('0x44')],_0x275578['query']);_0x3f21a8[_0xa0fd('0x4e')]=_[_0xa0fd('0x4f')](_0x275578[_0xa0fd('0x44')],qs['fields'](_0x2d4dc4['query'][_0xa0fd('0x50')]));_0x3f21a8[_0xa0fd('0x4e')]=_0x3f21a8[_0xa0fd('0x4e')]['length']?_0x3f21a8[_0xa0fd('0x4e')]:_0x275578[_0xa0fd('0x44')];if(!_0x2d4dc4[_0xa0fd('0x4d')][_0xa0fd('0x78')](_0xa0fd('0x79'))){_0x3f21a8[_0xa0fd('0x26')]=qs[_0xa0fd('0x26')](_0x2d4dc4['query'][_0xa0fd('0x26')]);_0x3f21a8[_0xa0fd('0x28')]=qs['offset'](_0x2d4dc4[_0xa0fd('0x4d')][_0xa0fd('0x28')]);}_0x3f21a8[_0xa0fd('0x7a')]=qs['sort'](_0x2d4dc4[_0xa0fd('0x4d')][_0xa0fd('0x52')]);_0x3f21a8[_0xa0fd('0x53')]=qs['filters'](_[_0xa0fd('0x55')](_0x2d4dc4[_0xa0fd('0x4d')],_0x275578[_0xa0fd('0x54')]));_0x3f21a8[_0xa0fd('0x53')]['ChatWebsiteId']=_0x462b31['id'];if(_0x2d4dc4[_0xa0fd('0x4d')][_0xa0fd('0x56')]){_0x3f21a8[_0xa0fd('0x53')]=_[_0xa0fd('0x58')](_0x3f21a8['where'],{'$or':_[_0xa0fd('0x49')](_0x3f21a8[_0xa0fd('0x4e')],function(_0x147241){var _0x260a93={};_0x260a93[_0x147241]={'$like':'%'+_0x2d4dc4[_0xa0fd('0x4d')][_0xa0fd('0x56')]+'%'};return _0x260a93;})});}_0x3f21a8=_['merge']({},_0x3f21a8,_0x2d4dc4[_0xa0fd('0x5e')]);return db[_0xa0fd('0xe5')]['count']({'where':_0x3f21a8[_0xa0fd('0x53')]})['then'](function(_0x212318){_0x11a06a[_0xa0fd('0x27')]=_0x212318;if(_0x2d4dc4[_0xa0fd('0x4d')][_0xa0fd('0x59')]){_0x3f21a8[_0xa0fd('0x5a')]=[{'all':!![]}];}else{_0x3f21a8[_0xa0fd('0x5a')]=[{'model':db[_0xa0fd('0xa5')],'as':_0xa0fd('0x103'),'required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db[_0xa0fd('0xe5')][_0xa0fd('0x7f')](_0x3f21a8);})['then'](function(_0x2eb0d6){_0x11a06a['rows']=_0x2eb0d6;return _0x11a06a;});}})[_0xa0fd('0x29')](respondWithFilteredResult(_0x2777c0,_0x3f21a8))[_0xa0fd('0x5c')](handleError(_0x2777c0,null));};exports[_0xa0fd('0x131')]=function(_0x3a263a,_0x30e2e2){return db[_0xa0fd('0x4a')]['find']({'where':{'id':_0x3a263a[_0xa0fd('0x70')]['id']}})['then'](handleEntityNotFound(_0x30e2e2,null))[_0xa0fd('0x29')](function(_0x4bc35b){if(_0x4bc35b){return _0x4bc35b[_0xa0fd('0x131')](_0x3a263a[_0xa0fd('0x61')]['ids'],_['omit'](_0x3a263a[_0xa0fd('0x61')],[_0xa0fd('0x80'),'id'])||{})[_0xa0fd('0xe0')](function(_0x516ce6){for(var _0xe40db=0x0;_0xe40db<_0x3a263a['body'][_0xa0fd('0x80')][_0xa0fd('0x51')];_0xe40db+=0x1){socket[_0xa0fd('0x132')](_0xa0fd('0x133'),{'UserId':Number(_0x3a263a[_0xa0fd('0x61')][_0xa0fd('0x80')][_0xe40db]),'ChatWebsiteId':Number(_0x3a263a[_0xa0fd('0x70')]['id'])});}return _0x516ce6;});}})[_0xa0fd('0x29')](respondWithResult(_0x30e2e2,null))[_0xa0fd('0x5c')](handleError(_0x30e2e2,null));};exports[_0xa0fd('0x134')]=function(_0x353a7d,_0x4e8d38){return db[_0xa0fd('0x4a')][_0xa0fd('0x5f')]({'where':{'id':_0x353a7d[_0xa0fd('0x70')]['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0x4e8d38,null))['then'](function(_0x4b9d31){if(_0x4b9d31){return _0x4b9d31[_0xa0fd('0x134')](_0x353a7d[_0xa0fd('0x4d')][_0xa0fd('0x80')])[_0xa0fd('0x29')](function(){if(_[_0xa0fd('0x135')](_0x353a7d[_0xa0fd('0x4d')]['ids'])){for(var _0xb1b3ab=0x0;_0xb1b3ab<_0x353a7d[_0xa0fd('0x4d')][_0xa0fd('0x80')]['length'];_0xb1b3ab+=0x1){socket[_0xa0fd('0x132')]('userChatWebsite:remove',{'UserId':Number(_0x353a7d[_0xa0fd('0x4d')][_0xa0fd('0x80')][_0xb1b3ab]),'ChatWebsiteId':Number(_0x353a7d[_0xa0fd('0x70')]['id'])});}}else{socket[_0xa0fd('0x132')](_0xa0fd('0x136'),{'UserId':Number(_0x353a7d[_0xa0fd('0x4d')][_0xa0fd('0x80')]),'ChatWebsiteId':Number(_0x353a7d['params']['id'])});}});}})[_0xa0fd('0x29')](respondWithStatusCode(_0x4e8d38,null))[_0xa0fd('0x5c')](handleError(_0x4e8d38,null));};exports[_0xa0fd('0x137')]=function(_0x562461,_0x1c8a6d){var _0x201a2c={};var _0x3245e6={};var _0x3702c2;var _0x5e205e;return db[_0xa0fd('0x4a')]['findOne']({'where':{'id':_0x562461[_0xa0fd('0x70')]['id']}})[_0xa0fd('0x29')](handleEntityNotFound(_0x1c8a6d,null))[_0xa0fd('0x29')](function(_0xad52df){if(_0xad52df){_0x3702c2=_0xad52df;_0x3245e6[_0xa0fd('0x44')]=_[_0xa0fd('0x76')](db[_0xa0fd('0x104')][_0xa0fd('0x7e')]);_0x3245e6[_0xa0fd('0x4d')]=_[_0xa0fd('0x76')](_0x562461[_0xa0fd('0x4d')]);_0x3245e6['filters']=_[_0xa0fd('0x4f')](_0x3245e6[_0xa0fd('0x44')],_0x3245e6[_0xa0fd('0x4d')]);_0x201a2c[_0xa0fd('0x4e')]=_[_0xa0fd('0x4f')](_0x3245e6[_0xa0fd('0x44')],qs[_0xa0fd('0x50')](_0x562461[_0xa0fd('0x4d')][_0xa0fd('0x50')]));_0x201a2c[_0xa0fd('0x4e')]=_0x201a2c[_0xa0fd('0x4e')][_0xa0fd('0x51')]?_0x201a2c['attributes']:_0x3245e6['model'];_0x201a2c['order']=qs[_0xa0fd('0x52')](_0x562461[_0xa0fd('0x4d')][_0xa0fd('0x52')]);_0x201a2c[_0xa0fd('0x53')]=qs[_0xa0fd('0x54')](_[_0xa0fd('0x55')](_0x562461[_0xa0fd('0x4d')],_0x3245e6[_0xa0fd('0x54')]));if(_0x562461['query']['filter']){_0x201a2c[_0xa0fd('0x53')]=_[_0xa0fd('0x58')](_0x201a2c[_0xa0fd('0x53')],{'$or':_[_0xa0fd('0x49')](_0x201a2c[_0xa0fd('0x4e')],function(_0x5f3479){var _0x17a13f={};_0x17a13f[_0x5f3479]={'$like':'%'+_0x562461['query'][_0xa0fd('0x56')]+'%'};return _0x17a13f;})});}_0x201a2c=_[_0xa0fd('0x58')]({},_0x201a2c,_0x562461[_0xa0fd('0x5e')]);return _0x3702c2[_0xa0fd('0x137')](_0x201a2c);}})[_0xa0fd('0x29')](function(_0x251515){if(_0x251515){_0x5e205e=_0x251515[_0xa0fd('0x51')];if(!_0x562461[_0xa0fd('0x4d')][_0xa0fd('0x78')](_0xa0fd('0x79'))){_0x201a2c[_0xa0fd('0x26')]=qs['limit'](_0x562461[_0xa0fd('0x4d')]['limit']);_0x201a2c['offset']=qs[_0xa0fd('0x28')](_0x562461[_0xa0fd('0x4d')]['offset']);}return _0x3702c2['getAgents'](_0x201a2c);}})[_0xa0fd('0x29')](function(_0x3aae5b){if(_0x3aae5b){return _0x3aae5b?{'count':_0x5e205e,'rows':_0x3aae5b}:null;}})['then'](respondWithResult(_0x1c8a6d,null))[_0xa0fd('0x5c')](handleError(_0x1c8a6d,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 6f76f10..a8c1fc3 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 _0x6208=['emit','hasOwnProperty','exports','events','ChatWebsite','setMaxListeners','update'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x6208,0x17d));var _0x8620=function(_0x3ee1fe,_0x59f2a1){_0x3ee1fe=_0x3ee1fe-0x0;var _0x1ae57a=_0x6208[_0x3ee1fe];return _0x1ae57a;};'use strict';var EventEmitter=require(_0x8620('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x8620('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x8620('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8620('0x3'),'afterDestroy':'remove'};function emitEvent(_0x440e16){return function(_0x360578,_0x196447,_0x286b72){ChatWebsiteEvents[_0x8620('0x4')](_0x440e16+':'+_0x360578['id'],_0x360578);ChatWebsiteEvents[_0x8620('0x4')](_0x440e16,_0x360578);_0x286b72(null);};}for(var e in events){if(events[_0x8620('0x5')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x8620('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0xe0c3=['events','ChatWebsite','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports'];(function(_0x35457b,_0x116ab7){var _0x4f8627=function(_0x2c68b8){while(--_0x2c68b8){_0x35457b['push'](_0x35457b['shift']());}};_0x4f8627(++_0x116ab7);}(_0xe0c3,0xea));var _0x3e0c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0c3[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x3e0c('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x3e0c('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x3e0c('0x2')](0x0);var events={'afterCreate':_0x3e0c('0x3'),'afterUpdate':_0x3e0c('0x4'),'afterDestroy':_0x3e0c('0x5')};function emitEvent(_0x410ec4){return function(_0x31851c,_0x26c964,_0x1a026f){ChatWebsiteEvents['emit'](_0x410ec4+':'+_0x31851c['id'],_0x31851c);ChatWebsiteEvents['emit'](_0x410ec4,_0x31851c);_0x1a026f(null);};}for(var e in events){if(events[_0x3e0c('0x6')](e)){var event=events[e];ChatWebsite[_0x3e0c('0x7')](e,emitEvent(event));}}module[_0x3e0c('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index e148a7e..8c24f2d 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 _0xafe3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','util','../../config/logger','api'];(function(_0x5e09ed,_0x3a2790){var _0x553ad6=function(_0x20aa57){while(--_0x20aa57){_0x5e09ed['push'](_0x5e09ed['shift']());}};_0x553ad6(++_0x3a2790);}(_0xafe3,0x189));var _0x3afe=function(_0xfa0378,_0x392d58){_0xfa0378=_0xfa0378-0x0;var _0x4f97c6=_0xafe3[_0xfa0378];return _0x4f97c6;};'use strict';var _=require('lodash');var util=require(_0x3afe('0x0'));var logger=require(_0x3afe('0x1'))(_0x3afe('0x2'));var moment=require(_0x3afe('0x3'));var BPromise=require(_0x3afe('0x4'));var rp=require(_0x3afe('0x5'));var fs=require('fs');var path=require(_0x3afe('0x6'));var rimraf=require(_0x3afe('0x7'));var config=require(_0x3afe('0x8'));var attributes=require(_0x3afe('0x9'));module[_0x3afe('0xa')]=function(_0x556faf,_0x328f02){return _0x556faf[_0x3afe('0xb')]('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b55=['api','moment','bluebird','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger'];(function(_0x4c6081,_0x4821a7){var _0x2933be=function(_0x78f29){while(--_0x78f29){_0x4c6081['push'](_0x4c6081['shift']());}};_0x2933be(++_0x4821a7);}(_0x2b55,0x147));var _0x52b5=function(_0x8a4931,_0x5a7a4a){_0x8a4931=_0x8a4931-0x0;var _0x113b99=_0x2b55[_0x8a4931];return _0x113b99;};'use strict';var _=require(_0x52b5('0x0'));var util=require(_0x52b5('0x1'));var logger=require(_0x52b5('0x2'))(_0x52b5('0x3'));var moment=require(_0x52b5('0x4'));var BPromise=require(_0x52b5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x52b5('0x6'));module[_0x52b5('0x7')]=function(_0x4a721d,_0xde1243){return _0x4a721d[_0x52b5('0x8')](_0x52b5('0x9'),attributes,{'tableName':_0x52b5('0xa'),'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 32f6cf3..bf89590 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 _0xbf98=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1612bb,_0x79b339){var _0x33842b=function(_0x557241){while(--_0x557241){_0x1612bb['push'](_0x1612bb['shift']());}};_0x33842b(++_0x79b339);}(_0xbf98,0x9e));var _0x8bf9=function(_0x4ebd67,_0x103d20){_0x4ebd67=_0x4ebd67-0x0;var _0x5094ac=_0xbf98[_0x4ebd67];return _0x5094ac;};'use strict';var _=require(_0x8bf9('0x0'));var util=require(_0x8bf9('0x1'));var moment=require('moment');var BPromise=require(_0x8bf9('0x2'));var rs=require(_0x8bf9('0x3'));var fs=require('fs');var Redis=require(_0x8bf9('0x4'));var db=require(_0x8bf9('0x5'))['db'];var utils=require(_0x8bf9('0x6'));var logger=require(_0x8bf9('0x7'))('rpc');var config=require(_0x8bf9('0x8'));var jayson=require(_0x8bf9('0x9'));var client=jayson[_0x8bf9('0xa')][_0x8bf9('0xb')]({'port':0x232a});config[_0x8bf9('0xc')]=_[_0x8bf9('0xd')](config[_0x8bf9('0xc')],{'host':_0x8bf9('0xe'),'port':0x18eb});var socket=require(_0x8bf9('0xf'))(new Redis(config[_0x8bf9('0xc')]));require(_0x8bf9('0x10'))[_0x8bf9('0x11')](socket);function respondWithRpcPromise(_0x3db604,_0x1e420e,_0x3d9798){return new BPromise(function(_0x491d24,_0x1fc05b){return client[_0x8bf9('0x12')](_0x3db604,_0x3d9798)[_0x8bf9('0x13')](function(_0xd18277){logger[_0x8bf9('0x14')](_0x8bf9('0x15'),_0x1e420e,_0x8bf9('0x16'));logger[_0x8bf9('0x17')](_0x8bf9('0x18'),_0x1e420e,'request\x20sent',JSON[_0x8bf9('0x19')](_0xd18277));if(_0xd18277[_0x8bf9('0x1a')]){if(_0xd18277['error'][_0x8bf9('0x1b')]===0x1f4){logger[_0x8bf9('0x1a')](_0x8bf9('0x15'),_0x1e420e,_0xd18277[_0x8bf9('0x1a')]['message']);return _0x1fc05b(_0xd18277[_0x8bf9('0x1a')][_0x8bf9('0x1c')]);}logger[_0x8bf9('0x1a')](_0x8bf9('0x15'),_0x1e420e,_0xd18277[_0x8bf9('0x1a')][_0x8bf9('0x1c')]);return _0x491d24(_0xd18277['error'][_0x8bf9('0x1c')]);}else{logger[_0x8bf9('0x14')](_0x8bf9('0x15'),_0x1e420e,_0x8bf9('0x16'));_0x491d24(_0xd18277[_0x8bf9('0x1d')][_0x8bf9('0x1c')]);}})[_0x8bf9('0x1e')](function(_0x3060b6){logger[_0x8bf9('0x1a')](_0x8bf9('0x15'),_0x1e420e,_0x3060b6);_0x1fc05b(_0x3060b6);});});} \ No newline at end of file +var _0xfb7c=['rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3d34da,_0x3abcc1){var _0xcf6af8=function(_0x300a53){while(--_0x300a53){_0x3d34da['push'](_0x3d34da['shift']());}};_0xcf6af8(++_0x3abcc1);}(_0xfb7c,0x1d4));var _0xcfb7=function(_0x6f4696,_0x45e8da){_0x6f4696=_0x6f4696-0x0;var _0x3e9056=_0xfb7c[_0x6f4696];return _0x3e9056;};'use strict';var _=require(_0xcfb7('0x0'));var util=require(_0xcfb7('0x1'));var moment=require(_0xcfb7('0x2'));var BPromise=require(_0xcfb7('0x3'));var rs=require(_0xcfb7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcfb7('0x5'))['db'];var utils=require(_0xcfb7('0x6'));var logger=require(_0xcfb7('0x7'))(_0xcfb7('0x8'));var config=require('../../config/environment');var jayson=require(_0xcfb7('0x9'));var client=jayson[_0xcfb7('0xa')][_0xcfb7('0xb')]({'port':0x232a});config[_0xcfb7('0xc')]=_[_0xcfb7('0xd')](config[_0xcfb7('0xc')],{'host':_0xcfb7('0xe'),'port':0x18eb});var socket=require(_0xcfb7('0xf'))(new Redis(config[_0xcfb7('0xc')]));require(_0xcfb7('0x10'))[_0xcfb7('0x11')](socket);function respondWithRpcPromise(_0x3b6390,_0x662830,_0x59d1ed){return new BPromise(function(_0x26c40c,_0x57a5ff){return client['request'](_0x3b6390,_0x59d1ed)[_0xcfb7('0x12')](function(_0x4b9f4c){logger[_0xcfb7('0x13')](_0xcfb7('0x14'),_0x662830,_0xcfb7('0x15'));logger[_0xcfb7('0x16')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x662830,_0xcfb7('0x15'),JSON[_0xcfb7('0x17')](_0x4b9f4c));if(_0x4b9f4c[_0xcfb7('0x18')]){if(_0x4b9f4c[_0xcfb7('0x18')][_0xcfb7('0x19')]===0x1f4){logger['error'](_0xcfb7('0x14'),_0x662830,_0x4b9f4c[_0xcfb7('0x18')][_0xcfb7('0x1a')]);return _0x57a5ff(_0x4b9f4c[_0xcfb7('0x18')]['message']);}logger[_0xcfb7('0x18')](_0xcfb7('0x14'),_0x662830,_0x4b9f4c['error'][_0xcfb7('0x1a')]);return _0x26c40c(_0x4b9f4c[_0xcfb7('0x18')]['message']);}else{logger[_0xcfb7('0x13')](_0xcfb7('0x14'),_0x662830,_0xcfb7('0x15'));_0x26c40c(_0x4b9f4c[_0xcfb7('0x1b')]['message']);}})['catch'](function(_0x56d387){logger[_0xcfb7('0x18')](_0xcfb7('0x14'),_0x662830,_0x56d387);_0x57a5ff(_0x56d387);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index a5f7078..6591f29 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 _0xc3b0=['emit','register','length','chatWebsite:','./chatWebsite.events','save','remove','update'];(function(_0x5a66fd,_0x4e0a9e){var _0x49b848=function(_0xcdc9c6){while(--_0xcdc9c6){_0x5a66fd['push'](_0x5a66fd['shift']());}};_0x49b848(++_0x4e0a9e);}(_0xc3b0,0x1d4));var _0x0c3b=function(_0x18057e,_0x5e6e0b){_0x18057e=_0x18057e-0x0;var _0x36ffdf=_0xc3b0[_0x18057e];return _0x36ffdf;};'use strict';var ChatWebsiteEvents=require(_0x0c3b('0x0'));var events=[_0x0c3b('0x1'),_0x0c3b('0x2'),_0x0c3b('0x3')];function createListener(_0x28920a,_0x95ae17){return function(_0x5b1c50){_0x95ae17[_0x0c3b('0x4')](_0x28920a,_0x5b1c50);};}function removeListener(_0x8f06e0,_0x1d630b){return function(){ChatWebsiteEvents['removeListener'](_0x8f06e0,_0x1d630b);};}exports[_0x0c3b('0x5')]=function(_0x3159e2){for(var _0x39af92=0x0,_0x3b8055=events[_0x0c3b('0x6')];_0x39af92<_0x3b8055;_0x39af92++){var _0xb4eeae=events[_0x39af92];var _0x1ec915=createListener(_0x0c3b('0x7')+_0xb4eeae,_0x3159e2);ChatWebsiteEvents['on'](_0xb4eeae,_0x1ec915);}}; \ No newline at end of file +var _0xb9f3=['./chatWebsite.events','save','emit','removeListener','register','length','chatWebsite:'];(function(_0x1a6629,_0x1ab63d){var _0x1eb452=function(_0x46e91c){while(--_0x46e91c){_0x1a6629['push'](_0x1a6629['shift']());}};_0x1eb452(++_0x1ab63d);}(_0xb9f3,0x150));var _0x3b9f=function(_0x223134,_0x323bd3){_0x223134=_0x223134-0x0;var _0x3bcc90=_0xb9f3[_0x223134];return _0x3bcc90;};'use strict';var ChatWebsiteEvents=require(_0x3b9f('0x0'));var events=[_0x3b9f('0x1'),'remove','update'];function createListener(_0x1a29b5,_0x244c0e){return function(_0x106ce8){_0x244c0e[_0x3b9f('0x2')](_0x1a29b5,_0x106ce8);};}function removeListener(_0x532f88,_0x54f159){return function(){ChatWebsiteEvents[_0x3b9f('0x3')](_0x532f88,_0x54f159);};}exports[_0x3b9f('0x4')]=function(_0x3c4882){for(var _0x15ba3a=0x0,_0x3c87e1=events[_0x3b9f('0x5')];_0x15ba3a<_0x3c87e1;_0x15ba3a++){var _0x280ba1=events[_0x15ba3a];var _0x3c5bdf=createListener(_0x3b9f('0x6')+_0x280ba1,_0x3c4882);ChatWebsiteEvents['on'](_0x280ba1,_0x3c5bdf);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index 37c1301..ec82565 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x199c=['test','([\x5cw]+)','exports','url','URL','replace','localhost'];(function(_0x11011b,_0x10fc82){var _0x4f26b9=function(_0x2adc38){while(--_0x2adc38){_0x11011b['push'](_0x11011b['shift']());}};_0x4f26b9(++_0x10fc82);}(_0x199c,0x1d8));var _0xc199=function(_0x6950bb,_0x1fb02f){_0x6950bb=_0x6950bb-0x0;var _0x28673c=_0x199c[_0x6950bb];return _0x28673c;};var escapeRegExp=require('../../../utils/misc')['escapeRegExp'];var URL=require(_0xc199('0x0'))[_0xc199('0x1')];function testWildcardValidity(_0xf15666){var _0x3e0b15=!![];try{new URL(_0xf15666[_0xc199('0x2')]('*',_0xc199('0x3')));}catch(_0x3f06cc){_0x3e0b15=![];}return _0x3e0b15&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xc199('0x4')](_0xf15666);}function testWebsiteWithWildcard(_0x4b4a7b,_0x4688b9){var _0x2ff172;var _0x499721=escapeRegExp(_0x4b4a7b['trim']()[_0xc199('0x2')](/\/$/,''))[_0xc199('0x2')]('\x5c*',_0xc199('0x5'));try{new URL(_0x4b4a7b[_0xc199('0x2')]('\x5c*',_0xc199('0x3')));_0x2ff172=new RegExp(_0x499721)[_0xc199('0x4')](_0x4688b9);}catch(_0x211733){_0x2ff172=![];}return _0x2ff172;}module[_0xc199('0x6')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x161a=['url','URL','localhost','trim','replace','([\x5cw]+)','test','exports'];(function(_0x5d7b48,_0x1c8eaa){var _0x31bd82=function(_0x3632d5){while(--_0x3632d5){_0x5d7b48['push'](_0x5d7b48['shift']());}};_0x31bd82(++_0x1c8eaa);}(_0x161a,0x140));var _0xa161=function(_0x10d34b,_0x4fef76){_0x10d34b=_0x10d34b-0x0;var _0x92b0bf=_0x161a[_0x10d34b];return _0x92b0bf;};var escapeRegExp=require('../../../utils/misc')['escapeRegExp'];var URL=require(_0xa161('0x0'))[_0xa161('0x1')];function testWildcardValidity(_0x549285){var _0x4ca66c=!![];try{new URL(_0x549285['replace']('*',_0xa161('0x2')));}catch(_0x36340b){_0x4ca66c=![];}return _0x4ca66c&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0x549285);}function testWebsiteWithWildcard(_0x551cc8,_0x7fde92){var _0x1705ab;var _0x12d54c=escapeRegExp(_0x551cc8[_0xa161('0x3')]()[_0xa161('0x4')](/\/$/,''))[_0xa161('0x4')]('\x5c*',_0xa161('0x5'));try{new URL(_0x551cc8['replace']('\x5c*',_0xa161('0x2')));_0x1705ab=new RegExp(_0x12d54c)[_0xa161('0x6')](_0x7fde92);}catch(_0x327221){_0x1705ab=![];}return _0x1705ab;}module[_0xa161('0x7')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 718616c..8dff054 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 _0x4f9e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','getOfflineMessages','getAgents','post','create','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','single','file','addLogo','now','originalname','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','/:id/interactions','addInteraction','/:id/proactive_actions','addProactiveActions','/:id/users','addAgents','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','util','connect-timeout','express'];(function(_0x4d063d,_0x1226e9){var _0x2053be=function(_0xfa769a){while(--_0xfa769a){_0x4d063d['push'](_0x4d063d['shift']());}};_0x2053be(++_0x1226e9);}(_0x4f9e,0x183));var _0xe4f9=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0x4f9e[_0x589aee];return _0x2f5ed4;};'use strict';var multer=require('multer');var util=require(_0xe4f9('0x0'));var path=require('path');var timeout=require(_0xe4f9('0x1'));var express=require(_0xe4f9('0x2'));var router=express[_0xe4f9('0x3')]();var fs_extra=require(_0xe4f9('0x4'));var auth=require(_0xe4f9('0x5'));var interaction=require(_0xe4f9('0x6'));var config=require(_0xe4f9('0x7'));var controller=require(_0xe4f9('0x8'));router[_0xe4f9('0x9')]('/',auth[_0xe4f9('0xa')](),controller[_0xe4f9('0xb')]);router[_0xe4f9('0x9')](_0xe4f9('0xc'),auth[_0xe4f9('0xa')](),controller[_0xe4f9('0xd')]);router[_0xe4f9('0x9')](_0xe4f9('0xe'),auth['isAuthenticated'](),controller[_0xe4f9('0xf')]);router['get'](_0xe4f9('0x10'),auth[_0xe4f9('0xa')](),controller[_0xe4f9('0x11')]);router[_0xe4f9('0x9')](_0xe4f9('0x12'),auth[_0xe4f9('0xa')](),controller[_0xe4f9('0x13')]);router[_0xe4f9('0x9')](_0xe4f9('0x14'),controller[_0xe4f9('0x15')]);router['get'](_0xe4f9('0x16'),controller[_0xe4f9('0x17')]);router[_0xe4f9('0x9')](_0xe4f9('0x18'),controller[_0xe4f9('0x19')]);router[_0xe4f9('0x9')](_0xe4f9('0x1a'),controller[_0xe4f9('0x1b')]);router['get']('/:id/interactions',auth[_0xe4f9('0xa')](),controller[_0xe4f9('0x1c')]);router[_0xe4f9('0x9')](_0xe4f9('0x1d'),controller['getSnippet']);router[_0xe4f9('0x9')](_0xe4f9('0x1e'),auth['isAuthenticated'](),controller[_0xe4f9('0x1f')]);router[_0xe4f9('0x9')]('/:id/proactive_actions',auth[_0xe4f9('0xa')](),controller[_0xe4f9('0x20')]);router[_0xe4f9('0x9')](_0xe4f9('0x21'),controller[_0xe4f9('0x22')]);router[_0xe4f9('0x9')]('/:id/offline_messages',auth[_0xe4f9('0xa')](),controller[_0xe4f9('0x23')]);router[_0xe4f9('0x9')]('/:id/users',auth[_0xe4f9('0xa')](),controller[_0xe4f9('0x24')]);router[_0xe4f9('0x25')]('/',auth[_0xe4f9('0xa')](),controller[_0xe4f9('0x26')]);router[_0xe4f9('0x25')](_0xe4f9('0x10'),auth[_0xe4f9('0xa')](),controller['addDisposition']);router[_0xe4f9('0x25')](_0xe4f9('0x12'),auth[_0xe4f9('0xa')](),controller[_0xe4f9('0x27')]);var upload=multer({'storage':multer[_0xe4f9('0x28')]({'destination':function(_0x44013c,_0x58d71e,_0x32c96f){_0x32c96f(null,path[_0xe4f9('0x29')](config[_0xe4f9('0x2a')],_0xe4f9('0x2b')));},'filename':function(_0x180550,_0x43ae2f,_0x40575b){_0x40575b(null,util[_0xe4f9('0x2c')](_0xe4f9('0x2d'),Date['now'](),_0x43ae2f['originalname']));}})});router[_0xe4f9('0x25')](_0xe4f9('0x14'),upload[_0xe4f9('0x2e')](_0xe4f9('0x2f')),controller[_0xe4f9('0x30')]);var upload=multer({'storage':multer[_0xe4f9('0x28')]({'destination':function(_0x1992bb,_0xd76013,_0x5f40cb){_0x5f40cb(null,path[_0xe4f9('0x29')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x25de82,_0x52c58d,_0x16fa6f){_0x16fa6f(null,util[_0xe4f9('0x2c')](_0xe4f9('0x2d'),Date[_0xe4f9('0x31')](),_0x52c58d[_0xe4f9('0x32')]));}})});router[_0xe4f9('0x25')](_0xe4f9('0x16'),upload[_0xe4f9('0x2e')](_0xe4f9('0x2f')),controller[_0xe4f9('0x33')]);var upload=multer({'storage':multer[_0xe4f9('0x28')]({'destination':function(_0xd4c89e,_0x29b970,_0x4523c8){_0x4523c8(null,path[_0xe4f9('0x29')](config[_0xe4f9('0x2a')],'server/files/images/avatars/'));},'filename':function(_0x5c1985,_0x7c6528,_0x8a5d5d){_0x8a5d5d(null,util[_0xe4f9('0x2c')](_0xe4f9('0x2d'),Date['now'](),_0x7c6528[_0xe4f9('0x32')]));}})});router['post']('/:id/customer_avatar',upload[_0xe4f9('0x2e')](_0xe4f9('0x2f')),controller[_0xe4f9('0x34')]);var upload=multer({'storage':multer[_0xe4f9('0x28')]({'destination':function(_0x3caeb3,_0x469e21,_0x515751){_0x515751(null,path[_0xe4f9('0x29')](config[_0xe4f9('0x2a')],'server/files/images/avatars/'));},'filename':function(_0x2dddfa,_0x397bfd,_0x21d716){_0x21d716(null,util[_0xe4f9('0x2c')]('%s-%s',Date[_0xe4f9('0x31')](),_0x397bfd[_0xe4f9('0x32')]));}})});router[_0xe4f9('0x25')](_0xe4f9('0x1a'),upload[_0xe4f9('0x2e')](_0xe4f9('0x2f')),controller[_0xe4f9('0x35')]);router[_0xe4f9('0x25')](_0xe4f9('0x36'),controller[_0xe4f9('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0xe4f9('0x28')]({'destination':function(_0x5938b9,_0x4a3a83,_0x3b7192){const _0xc023fc=path['join'](config['root'],_0xe4f9('0x38'),_0xe4f9('0x39'),_0xe4f9('0x3a'));fs_extra[_0xe4f9('0x3b')](_0xc023fc,function(){_0x3b7192(null,_0xc023fc);});},'filename':function(_0x5575f7,_0x4c318c,_0x1444d6){const _0x3cd475=_0x4c318c['originalname'][_0xe4f9('0x3c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5da9d3=path[_0xe4f9('0x3d')](_0x3cd475);const _0x5a25e3=Date[_0xe4f9('0x31')]()+'-'+_0x3cd475[_0xe4f9('0x3c')](_0x5da9d3,'')+_0x5da9d3;_0x1444d6(null,_0x5a25e3);}})});router[_0xe4f9('0x25')](_0xe4f9('0x3e'),offlineUploadMulter[_0xe4f9('0x3f')](),controller[_0xe4f9('0x40')]);router[_0xe4f9('0x25')](_0xe4f9('0x41'),auth[_0xe4f9('0xa')](),controller[_0xe4f9('0x42')]);router[_0xe4f9('0x25')](_0xe4f9('0x1e'),auth['isAuthenticated'](),controller['addApplications']);router[_0xe4f9('0x25')](_0xe4f9('0x43'),auth[_0xe4f9('0xa')](),controller[_0xe4f9('0x44')]);router[_0xe4f9('0x25')](_0xe4f9('0x45'),auth[_0xe4f9('0xa')](),controller[_0xe4f9('0x46')]);router['put'](_0xe4f9('0xe'),auth['isAuthenticated'](),controller[_0xe4f9('0x47')]);router['delete'](_0xe4f9('0xe'),auth['isAuthenticated'](),controller[_0xe4f9('0x48')]);router[_0xe4f9('0x49')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xe4f9('0x4a')]);router[_0xe4f9('0x49')]('/:id/canned_answers',auth[_0xe4f9('0xa')](),controller[_0xe4f9('0x4b')]);router['delete'](_0xe4f9('0x45'),auth[_0xe4f9('0xa')](),controller[_0xe4f9('0x4c')]);module[_0xe4f9('0x4d')]=router; \ No newline at end of file +var _0xc769=['/:id/customer_avatar','single','addCustomerAvatar','/:id/system_avatar','/:id/notify','notify','server/files','attachments','ensureDir','replace','extname','/:id/offline','any','offline','/:id/interactions','addInteraction','/:id/applications','addApplications','addProactiveActions','update','/:id/dispositions','removeDispositions','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','getSystemAvatar','getInteractions','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','addDisposition','addAnswer','join','root','server/files/images/logos/','format','%s-%s','now','originalname','file','addLogo','diskStorage','server/files/images/avatars/'];(function(_0x33c2af,_0x163198){var _0x13c04a=function(_0x4de68e){while(--_0x4de68e){_0x33c2af['push'](_0x33c2af['shift']());}};_0x13c04a(++_0x163198);}(_0xc769,0x1f4));var _0x9c76=function(_0x3c3d39,_0xa5e915){_0x3c3d39=_0x3c3d39-0x0;var _0x57015a=_0xc769[_0x3c3d39];return _0x57015a;};'use strict';var multer=require(_0x9c76('0x0'));var util=require('util');var path=require(_0x9c76('0x1'));var timeout=require(_0x9c76('0x2'));var express=require(_0x9c76('0x3'));var router=express['Router']();var fs_extra=require(_0x9c76('0x4'));var auth=require(_0x9c76('0x5'));var interaction=require(_0x9c76('0x6'));var config=require(_0x9c76('0x7'));var controller=require(_0x9c76('0x8'));router[_0x9c76('0x9')]('/',auth[_0x9c76('0xa')](),controller['index']);router['get'](_0x9c76('0xb'),auth['isAuthenticated'](),controller[_0x9c76('0xc')]);router[_0x9c76('0x9')](_0x9c76('0xd'),auth['isAuthenticated'](),controller[_0x9c76('0xe')]);router[_0x9c76('0x9')]('/:id/dispositions',auth[_0x9c76('0xa')](),controller['getDispositions']);router['get'](_0x9c76('0xf'),auth[_0x9c76('0xa')](),controller[_0x9c76('0x10')]);router[_0x9c76('0x9')](_0x9c76('0x11'),controller['getLogo']);router[_0x9c76('0x9')](_0x9c76('0x12'),controller[_0x9c76('0x13')]);router['get']('/:id/customer_avatar',controller['getCustomerAvatar']);router['get']('/:id/system_avatar',controller[_0x9c76('0x14')]);router[_0x9c76('0x9')]('/:id/interactions',auth[_0x9c76('0xa')](),controller[_0x9c76('0x15')]);router['get']('/:id/snippet',controller['getSnippet']);router['get']('/:id/applications',auth[_0x9c76('0xa')](),controller['getApplications']);router[_0x9c76('0x9')](_0x9c76('0x16'),auth[_0x9c76('0xa')](),controller[_0x9c76('0x17')]);router[_0x9c76('0x9')]('/:id/fields',controller[_0x9c76('0x18')]);router[_0x9c76('0x9')](_0x9c76('0x19'),auth['isAuthenticated'](),controller[_0x9c76('0x1a')]);router[_0x9c76('0x9')](_0x9c76('0x1b'),auth['isAuthenticated'](),controller[_0x9c76('0x1c')]);router['post']('/',auth[_0x9c76('0xa')](),controller[_0x9c76('0x1d')]);router[_0x9c76('0x1e')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9c76('0x1f')]);router[_0x9c76('0x1e')](_0x9c76('0xf'),auth[_0x9c76('0xa')](),controller[_0x9c76('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4871ba,_0x526e0d,_0x1584a0){_0x1584a0(null,path[_0x9c76('0x21')](config[_0x9c76('0x22')],_0x9c76('0x23')));},'filename':function(_0x3b1e41,_0xda22f2,_0x4fd49){_0x4fd49(null,util[_0x9c76('0x24')](_0x9c76('0x25'),Date[_0x9c76('0x26')](),_0xda22f2[_0x9c76('0x27')]));}})});router['post'](_0x9c76('0x11'),upload['single'](_0x9c76('0x28')),controller[_0x9c76('0x29')]);var upload=multer({'storage':multer[_0x9c76('0x2a')]({'destination':function(_0x52dac4,_0x21510a,_0x16fa0a){_0x16fa0a(null,path[_0x9c76('0x21')](config['root'],_0x9c76('0x2b')));},'filename':function(_0x44eb27,_0x3a2c62,_0x34c12c){_0x34c12c(null,util[_0x9c76('0x24')](_0x9c76('0x25'),Date[_0x9c76('0x26')](),_0x3a2c62[_0x9c76('0x27')]));}})});router[_0x9c76('0x1e')](_0x9c76('0x12'),upload['single'](_0x9c76('0x28')),controller['addAvatar']);var upload=multer({'storage':multer[_0x9c76('0x2a')]({'destination':function(_0x5c7fe7,_0x446257,_0x3831a5){_0x3831a5(null,path[_0x9c76('0x21')](config['root'],_0x9c76('0x2b')));},'filename':function(_0x409d12,_0x448963,_0x47ef73){_0x47ef73(null,util[_0x9c76('0x24')](_0x9c76('0x25'),Date[_0x9c76('0x26')](),_0x448963['originalname']));}})});router[_0x9c76('0x1e')](_0x9c76('0x2c'),upload[_0x9c76('0x2d')](_0x9c76('0x28')),controller[_0x9c76('0x2e')]);var upload=multer({'storage':multer[_0x9c76('0x2a')]({'destination':function(_0x565472,_0x326146,_0x25e7f8){_0x25e7f8(null,path[_0x9c76('0x21')](config[_0x9c76('0x22')],_0x9c76('0x2b')));},'filename':function(_0x2e353d,_0x2f93c2,_0x49e43a){_0x49e43a(null,util[_0x9c76('0x24')]('%s-%s',Date[_0x9c76('0x26')](),_0x2f93c2[_0x9c76('0x27')]));}})});router['post'](_0x9c76('0x2f'),upload[_0x9c76('0x2d')](_0x9c76('0x28')),controller['addSystemAvatar']);router[_0x9c76('0x1e')](_0x9c76('0x30'),controller[_0x9c76('0x31')]);const offlineUploadMulter=multer({'storage':multer[_0x9c76('0x2a')]({'destination':function(_0x100c01,_0x4e0b24,_0x1c5235){const _0x3e8dea=path[_0x9c76('0x21')](config[_0x9c76('0x22')],_0x9c76('0x32'),_0x9c76('0x33'),'offline-chat');fs_extra[_0x9c76('0x34')](_0x3e8dea,function(){_0x1c5235(null,_0x3e8dea);});},'filename':function(_0x18e65e,_0x4a35d7,_0x5b5921){const _0x74e1ce=_0x4a35d7['originalname'][_0x9c76('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x398f0f=path[_0x9c76('0x36')](_0x74e1ce);const _0x4eeb2e=Date[_0x9c76('0x26')]()+'-'+_0x74e1ce['replace'](_0x398f0f,'')+_0x398f0f;_0x5b5921(null,_0x4eeb2e);}})});router[_0x9c76('0x1e')](_0x9c76('0x37'),offlineUploadMulter[_0x9c76('0x38')](),controller[_0x9c76('0x39')]);router[_0x9c76('0x1e')](_0x9c76('0x3a'),auth[_0x9c76('0xa')](),controller[_0x9c76('0x3b')]);router[_0x9c76('0x1e')](_0x9c76('0x3c'),auth[_0x9c76('0xa')](),controller[_0x9c76('0x3d')]);router['post'](_0x9c76('0x16'),auth[_0x9c76('0xa')](),controller[_0x9c76('0x3e')]);router[_0x9c76('0x1e')](_0x9c76('0x1b'),auth[_0x9c76('0xa')](),controller['addAgents']);router['put'](_0x9c76('0xd'),auth[_0x9c76('0xa')](),controller[_0x9c76('0x3f')]);router['delete'](_0x9c76('0xd'),auth[_0x9c76('0xa')](),controller['destroy']);router['delete'](_0x9c76('0x40'),auth[_0x9c76('0xa')](),controller[_0x9c76('0x41')]);router[_0x9c76('0x42')](_0x9c76('0xf'),auth[_0x9c76('0xa')](),controller['removeAnswers']);router[_0x9c76('0x42')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x9c76('0x43')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index a1f9534..0381bc7 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc7e4=['beaver-logger/server','express','../components/auth/service','../config/environment','Router','env','app','get','Client-Side\x20logger\x20not\x20found!','/client-logs','use','isAuthenticated','exports'];(function(_0x46d7f8,_0x18d521){var _0x49a690=function(_0x4fe8d5){while(--_0x4fe8d5){_0x46d7f8['push'](_0x46d7f8['shift']());}};_0x49a690(++_0x18d521);}(_0xc7e4,0x1d4));var _0x4c7e=function(_0x13ce62,_0x189733){_0x13ce62=_0x13ce62-0x0;var _0x659d2=_0xc7e4[_0x13ce62];return _0x659d2;};var beaverLogger=require(_0x4c7e('0x0'));var express=require(_0x4c7e('0x1'));var auth=require(_0x4c7e('0x2'));var config=require(_0x4c7e('0x3'));var router=express[_0x4c7e('0x4')]();var isProduction=config[_0x4c7e('0x5')]==='production'||![];function clientSideLogs(_0x3db880,_0x3f5aa1,_0x285a62){var _0x52d8e3=_0x3db880[_0x4c7e('0x6')][_0x4c7e('0x7')]('client-side-logger');if(!_0x52d8e3){throw new Error(_0x4c7e('0x8'));}return beaverLogger['expressEndpoint']({'uri':_0x4c7e('0x9'),'logger':_0x52d8e3,'enableCors':!isProduction})(_0x3db880,_0x3f5aa1,_0x285a62);}router[_0x4c7e('0xa')](auth[_0x4c7e('0xb')](),clientSideLogs);module[_0x4c7e('0xc')]=router; \ No newline at end of file +var _0x29e8=['client-side-logger','Client-Side\x20logger\x20not\x20found!','/client-logs','use','isAuthenticated','express','../components/auth/service','Router','env','production','app','get'];(function(_0x5144bd,_0x46e5f0){var _0x3bac80=function(_0x4b6dd2){while(--_0x4b6dd2){_0x5144bd['push'](_0x5144bd['shift']());}};_0x3bac80(++_0x46e5f0);}(_0x29e8,0xdd));var _0x829e=function(_0x64ca36,_0x1863c1){_0x64ca36=_0x64ca36-0x0;var _0x19e5f7=_0x29e8[_0x64ca36];return _0x19e5f7;};var beaverLogger=require('beaver-logger/server');var express=require(_0x829e('0x0'));var auth=require(_0x829e('0x1'));var config=require('../config/environment');var router=express[_0x829e('0x2')]();var isProduction=config[_0x829e('0x3')]===_0x829e('0x4')||![];function clientSideLogs(_0x3f5aaa,_0x25d3ce,_0x12baa2){var _0x23b5ee=_0x3f5aaa[_0x829e('0x5')][_0x829e('0x6')](_0x829e('0x7'));if(!_0x23b5ee){throw new Error(_0x829e('0x8'));}return beaverLogger['expressEndpoint']({'uri':_0x829e('0x9'),'logger':_0x23b5ee,'enableCors':!isProduction})(_0x3f5aaa,_0x25d3ce,_0x12baa2);}router[_0x829e('0xa')](auth[_0x829e('0xb')](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 81f83a6..a784d15 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 _0x7305=['MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x7305,0xd5));var _0x5730=function(_0x567011,_0x273172){_0x567011=_0x567011-0x0;var _0x50ac02=_0x7305[_0x567011];return _0x50ac02;};'use strict';var Sequelize=require(_0x5730('0x0'));module[_0x5730('0x1')]={'name':{'type':Sequelize[_0x5730('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x5730('0x3')](_0x5730('0x4'),_0x5730('0x5'),_0x5730('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x5730('0x3')](_0x5730('0x7'),'Dynamics365')},'data1':{'type':Sequelize[_0x5730('0x2')],'comment':_0x5730('0x8')},'data2':{'type':Sequelize[_0x5730('0x2')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x5730('0x2')],'comment':_0x5730('0x9')},'data4':{'type':Sequelize[_0x5730('0x2')],'comment':_0x5730('0xa')},'data5':{'type':Sequelize['TEXT'],'comment':_0x5730('0xb')},'data6':{'type':Sequelize[_0x5730('0xc')],'comment':_0x5730('0xd')},'data7':{'type':Sequelize[_0x5730('0xc')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0xbff0=['Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','STRING','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','AmazonAWS'];(function(_0x3e0763,_0x3d12be){var _0x351ca2=function(_0x9beae7){while(--_0x9beae7){_0x3e0763['push'](_0x3e0763['shift']());}};_0x351ca2(++_0x3d12be);}(_0xbff0,0xde));var _0x0bff=function(_0x301064,_0x1985aa){_0x301064=_0x301064-0x0;var _0x5bc841=_0xbff0[_0x301064];return _0x5bc841;};'use strict';var Sequelize=require(_0x0bff('0x0'));module[_0x0bff('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x0bff('0x2'),_0x0bff('0x3'),_0x0bff('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x0bff('0x5'),_0x0bff('0x6'))},'data1':{'type':Sequelize['STRING'],'comment':_0x0bff('0x7')},'data2':{'type':Sequelize[_0x0bff('0x8')],'comment':_0x0bff('0x9')},'data3':{'type':Sequelize[_0x0bff('0x8')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x0bff('0x8')],'comment':_0x0bff('0xa')},'data5':{'type':Sequelize[_0x0bff('0xb')],'comment':_0x0bff('0xc')},'data6':{'type':Sequelize[_0x0bff('0xb')],'comment':_0x0bff('0xd')},'data7':{'type':Sequelize[_0x0bff('0xb')],'comment':_0x0bff('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 743c257..94ea16d 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 _0xbd11=['Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','status','end','json','offset','limit','count','set','Content-Range','update','then','destroy','error','name','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','findAll','rows','service','MicrosoftAzure','data3','catch','show','params','keys','include','find','decryptString','create','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','body','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','sendStatus','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','ascii','isValidIdToken','oauth2Claims'];(function(_0x328570,_0x119817){var _0x3e4bb1=function(_0x12725a){while(--_0x12725a){_0x328570['push'](_0x328570['shift']());}};_0x3e4bb1(++_0x119817);}(_0xbd11,0x1e6));var _0x1bd1=function(_0x30126c,_0x43a5a3){_0x30126c=_0x30126c-0x0;var _0x184d7f=_0xbd11[_0x30126c];return _0x184d7f;};'use strict';var _=require(_0x1bd1('0x0'));var Redis=require(_0x1bd1('0x1'));var qs=require(_0x1bd1('0x2'));var encryptor=require(_0x1bd1('0x3'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x1bd1('0x4'));var db=require(_0x1bd1('0x5'))['db'];var oauth=require(_0x1bd1('0x6'));config[_0x1bd1('0x7')]=_[_0x1bd1('0x8')](config[_0x1bd1('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var redis=new Redis(config[_0x1bd1('0x7')]);function respondWithStatusCode(_0x4e62d3,_0x2672a4){_0x2672a4=_0x2672a4||0xcc;return function(_0x7fcd35){if(_0x7fcd35){return _0x4e62d3['sendStatus'](_0x2672a4);}return _0x4e62d3[_0x1bd1('0x9')](_0x2672a4)[_0x1bd1('0xa')]();};}function respondWithResult(_0x2df3cd,_0x2cd834){_0x2cd834=_0x2cd834||0xc8;return function(_0xddafd6){if(_0xddafd6){return _0x2df3cd[_0x1bd1('0x9')](_0x2cd834)[_0x1bd1('0xb')](_0xddafd6);}};}function respondWithFilteredResult(_0x464725,_0x35c90c){return function(_0xc7126){if(_0xc7126){var _0x3ed433=typeof _0x35c90c[_0x1bd1('0xc')]==='undefined'&&typeof _0x35c90c[_0x1bd1('0xd')]==='undefined';var _0x5d98cf=_0xc7126['count'];var _0x1eeddf=_0x3ed433?0x0:_0x35c90c['offset'];var _0x207100=_0x3ed433?_0xc7126[_0x1bd1('0xe')]:_0x35c90c[_0x1bd1('0xc')]+_0x35c90c[_0x1bd1('0xd')];var _0x49acb8;if(_0x207100>=_0x5d98cf){_0x207100=_0x5d98cf;_0x49acb8=0xc8;}else{_0x49acb8=0xce;}_0x464725['status'](_0x49acb8);return _0x464725[_0x1bd1('0xf')](_0x1bd1('0x10'),_0x1eeddf+'-'+_0x207100+'/'+_0x5d98cf)['json'](_0xc7126);}return null;};}function saveUpdates(_0x2018bb){return function(_0x19cf94){if(_0x19cf94){return _0x19cf94[_0x1bd1('0x11')](_0x2018bb)[_0x1bd1('0x12')](function(_0x1e6d7b){return _0x1e6d7b;});}return null;};}function removeEntity(_0x1e71b1){return function(_0x3cfb4c){if(_0x3cfb4c){return _0x3cfb4c[_0x1bd1('0x13')]()['then'](function(){_0x1e71b1[_0x1bd1('0x9')](0xcc)[_0x1bd1('0xa')]();});}};}function handleEntityNotFound(_0x4828cb){return function(_0x33117d){if(!_0x33117d){_0x4828cb['sendStatus'](0x194);}return _0x33117d;};}function handleError(_0x5e4730,_0x4d8636){_0x4d8636=_0x4d8636||0x1f4;return function(_0x3c4c34){logger[_0x1bd1('0x14')](_0x3c4c34['stack']);if(_0x3c4c34[_0x1bd1('0x15')]){delete _0x3c4c34['name'];}_0x5e4730[_0x1bd1('0x9')](_0x4d8636)['send'](_0x3c4c34);};}function maskClientSecret(_0x56c737){return _['padEnd'](_0x56c737[_0x1bd1('0x16')](0x0,0x3),0x14,'*');}exports[_0x1bd1('0x17')]=function(_0x516347,_0x700053){var _0x32af94={},_0x298dec={},_0x2b0ea4={'count':0x0,'rows':[]};var _0x22ec0c=_[_0x1bd1('0x18')](db[_0x1bd1('0x19')][_0x1bd1('0x1a')],function(_0x51efda){return{'name':_0x51efda[_0x1bd1('0x1b')],'type':_0x51efda[_0x1bd1('0x1c')][_0x1bd1('0x1d')]};});_0x298dec['model']=_[_0x1bd1('0x18')](_0x22ec0c,'name');_0x298dec[_0x1bd1('0x1e')]=_['keys'](_0x516347[_0x1bd1('0x1e')]);_0x298dec[_0x1bd1('0x1f')]=_[_0x1bd1('0x20')](_0x298dec[_0x1bd1('0x21')],_0x298dec['query']);_0x32af94[_0x1bd1('0x22')]=_[_0x1bd1('0x20')](_0x298dec['model'],qs[_0x1bd1('0x23')](_0x516347[_0x1bd1('0x1e')]['fields']));_0x32af94[_0x1bd1('0x22')]=_0x32af94[_0x1bd1('0x22')][_0x1bd1('0x24')]?_0x32af94[_0x1bd1('0x22')]:_0x298dec[_0x1bd1('0x21')];if(!_0x516347[_0x1bd1('0x1e')][_0x1bd1('0x25')](_0x1bd1('0x26'))){_0x32af94[_0x1bd1('0xd')]=qs[_0x1bd1('0xd')](_0x516347['query']['limit']);_0x32af94[_0x1bd1('0xc')]=qs['offset'](_0x516347[_0x1bd1('0x1e')][_0x1bd1('0xc')]);}_0x32af94[_0x1bd1('0x27')]=qs[_0x1bd1('0x28')](_0x516347[_0x1bd1('0x1e')][_0x1bd1('0x28')]);_0x32af94[_0x1bd1('0x29')]=qs['filters'](_['pick'](_0x516347[_0x1bd1('0x1e')],_0x298dec['filters']),_0x22ec0c);if(_0x516347[_0x1bd1('0x1e')][_0x1bd1('0x2a')]){_0x32af94['where']=_[_0x1bd1('0x2b')](_0x32af94[_0x1bd1('0x29')],{'$or':_[_0x1bd1('0x18')](_0x22ec0c,function(_0x16de36){if(_0x16de36[_0x1bd1('0x1c')]!=='VIRTUAL'){var _0x548e4d={};_0x548e4d[_0x16de36[_0x1bd1('0x15')]]={'$like':'%'+_0x516347['query'][_0x1bd1('0x2a')]+'%'};return _0x548e4d;}})});}_0x32af94=_[_0x1bd1('0x2b')]({},_0x32af94,_0x516347[_0x1bd1('0x2c')]);var _0xa9f366={'where':_0x32af94['where']};return db[_0x1bd1('0x19')][_0x1bd1('0xe')](_0xa9f366)[_0x1bd1('0x12')](function(_0x5f4bb1){_0x2b0ea4['count']=_0x5f4bb1;if(_0x516347[_0x1bd1('0x1e')]['includeAll']){_0x32af94['include']=[{'all':!![]}];}return db[_0x1bd1('0x19')][_0x1bd1('0x2d')](_0x32af94);})[_0x1bd1('0x12')](function(_0x5e51e8){_0x2b0ea4[_0x1bd1('0x2e')]=_[_0x1bd1('0x18')](_0x5e51e8,function(_0x16aed3){if(_0x16aed3[_0x1bd1('0x2f')]===_0x1bd1('0x30')){var _0x24f4f9=encryptor['decryptString'](_0x16aed3['data3']);_0x16aed3[_0x1bd1('0x31')]=maskClientSecret(_0x24f4f9);}return _0x16aed3;});return _0x2b0ea4;})[_0x1bd1('0x12')](respondWithFilteredResult(_0x700053,_0x32af94))[_0x1bd1('0x32')](handleError(_0x700053,null));};exports[_0x1bd1('0x33')]=function(_0x2f82fc,_0x569b7f){var _0xcac35d={'raw':!![],'where':{'id':_0x2f82fc[_0x1bd1('0x34')]['id']}},_0x8d549e={};_0x8d549e[_0x1bd1('0x21')]=_['keys'](db['CloudProvider'][_0x1bd1('0x1a')]);_0x8d549e[_0x1bd1('0x1e')]=_[_0x1bd1('0x35')](_0x2f82fc[_0x1bd1('0x1e')]);_0x8d549e[_0x1bd1('0x1f')]=_[_0x1bd1('0x20')](_0x8d549e[_0x1bd1('0x21')],_0x8d549e[_0x1bd1('0x1e')]);_0xcac35d['attributes']=_[_0x1bd1('0x20')](_0x8d549e[_0x1bd1('0x21')],qs[_0x1bd1('0x23')](_0x2f82fc[_0x1bd1('0x1e')][_0x1bd1('0x23')]));_0xcac35d[_0x1bd1('0x22')]=_0xcac35d[_0x1bd1('0x22')][_0x1bd1('0x24')]?_0xcac35d[_0x1bd1('0x22')]:_0x8d549e[_0x1bd1('0x21')];if(_0x2f82fc[_0x1bd1('0x1e')]['includeAll']){_0xcac35d[_0x1bd1('0x36')]=[{'all':!![]}];}_0xcac35d=_['merge']({},_0xcac35d,_0x2f82fc[_0x1bd1('0x2c')]);return db[_0x1bd1('0x19')][_0x1bd1('0x37')](_0xcac35d)[_0x1bd1('0x12')](handleEntityNotFound(_0x569b7f,null))[_0x1bd1('0x12')](function(_0xb7cc65){if(_0xb7cc65['service']===_0x1bd1('0x30')){var _0x4a7977=encryptor[_0x1bd1('0x38')](_0xb7cc65[_0x1bd1('0x31')]);_0xb7cc65[_0x1bd1('0x31')]=maskClientSecret(_0x4a7977);}return _0xb7cc65;})[_0x1bd1('0x12')](respondWithResult(_0x569b7f,null))[_0x1bd1('0x32')](handleError(_0x569b7f,null));};exports[_0x1bd1('0x39')]=function(_0x3ca1d8,_0x4be25e){if(!_0x3ca1d8['body'][_0x1bd1('0x15')])throw new Error(_0x1bd1('0x3a'));if(!_0x3ca1d8['body'][_0x1bd1('0x2f')])throw new Error(_0x1bd1('0x3b'));var _0x30436a=db[_0x1bd1('0x19')][_0x1bd1('0x1a')]['service'][_0x1bd1('0x3c')];if(!_0x30436a[_0x1bd1('0x3d')](_0x3ca1d8[_0x1bd1('0x3e')][_0x1bd1('0x2f')]))throw new Error(_0x1bd1('0x3f')+_0x30436a[_0x1bd1('0x40')](',\x20'));if(_0x3ca1d8['body'][_0x1bd1('0x2f')]==='MicrosoftAzure'&&_0x3ca1d8[_0x1bd1('0x3e')]['data3']){_0x3ca1d8[_0x1bd1('0x3e')]['data3']=encryptor[_0x1bd1('0x41')](_0x3ca1d8[_0x1bd1('0x3e')][_0x1bd1('0x31')]);}return db[_0x1bd1('0x19')][_0x1bd1('0x39')](_0x3ca1d8[_0x1bd1('0x3e')],{})['then'](respondWithResult(_0x4be25e,0xc9))[_0x1bd1('0x32')](handleError(_0x4be25e,null));};exports[_0x1bd1('0x11')]=function(_0x696f2,_0x147cb3){if(_0x696f2[_0x1bd1('0x3e')]['id']){delete _0x696f2[_0x1bd1('0x3e')]['id'];}return db[_0x1bd1('0x19')][_0x1bd1('0x37')]({'where':{'id':_0x696f2[_0x1bd1('0x34')]['id']}})[_0x1bd1('0x12')](handleEntityNotFound(_0x147cb3,null))[_0x1bd1('0x12')](function(_0x213936){if(_0x213936[_0x1bd1('0x2f')]===_0x1bd1('0x30')&&_0x696f2[_0x1bd1('0x3e')][_0x1bd1('0x31')]){_0x696f2[_0x1bd1('0x3e')]['data3']=encryptor['encryptString'](_0x696f2['body']['data3']);}return _0x213936;})[_0x1bd1('0x12')](saveUpdates(_0x696f2[_0x1bd1('0x3e')],null))['then'](respondWithResult(_0x147cb3,null))['catch'](handleError(_0x147cb3,null));};exports[_0x1bd1('0x13')]=function(_0x2b9ebe,_0x54ad1f){return db[_0x1bd1('0x19')][_0x1bd1('0x37')]({'where':{'id':_0x2b9ebe['params']['id']}})[_0x1bd1('0x12')](handleEntityNotFound(_0x54ad1f,null))[_0x1bd1('0x12')](removeEntity(_0x54ad1f,null))[_0x1bd1('0x32')](handleError(_0x54ad1f,null));};exports[_0x1bd1('0x42')]=function(_0x36358e,_0xa73e14){return db[_0x1bd1('0x19')]['findOne']({'where':{'id':_0x36358e[_0x1bd1('0x34')]['id']},'raw':!![]})['then'](function(_0x6552e4){if(!_0x6552e4)return _0xa73e14[_0x1bd1('0x43')](0x194);return{'url':oauth[_0x1bd1('0x44')](_0x6552e4,_0x36358e[_0x1bd1('0x45')]['id'])};})['then'](respondWithResult(_0xa73e14,null))[_0x1bd1('0x32')](handleError(_0xa73e14,null));};exports[_0x1bd1('0x46')]=function(_0x370ac3,_0x476188){var _0x10cea5=_0x370ac3['body'];var _0x47173d;var _0x1eb2f7;if(_0x10cea5['error'])throw _0x10cea5;redis[_0x1bd1('0x47')](_0x10cea5[_0x1bd1('0x48')])[_0x1bd1('0x12')](function(_0x555c5c){if(!_0x555c5c)throw new Error(_0x1bd1('0x49'));_0x47173d=JSON[_0x1bd1('0x4a')](_0x555c5c);var _0x49114c=Buffer['from'](_0x10cea5[_0x1bd1('0x48')],'base64')['toString'](_0x1bd1('0x4b'));_0x1eb2f7=JSON[_0x1bd1('0x4a')](_0x49114c);if(!oauth[_0x1bd1('0x4c')](_0x10cea5['id_token'],_0x47173d[_0x1bd1('0x4d')]))throw new Error(_0x1bd1('0x4e'));redis[_0x1bd1('0x4f')](_0x10cea5[_0x1bd1('0x48')]);return oauth[_0x1bd1('0x50')](_0x10cea5[_0x1bd1('0x51')],_0x47173d);})[_0x1bd1('0x12')](function(_0x3759ce){_0x47173d[_0x1bd1('0x52')]=_0x3759ce[_0x1bd1('0x53')];_0x47173d[_0x1bd1('0x54')]=_0x3759ce[_0x1bd1('0x55')];return db['CloudProvider'][_0x1bd1('0x11')]({'data5':_0x47173d[_0x1bd1('0x52')],'data6':_0x47173d['data6']},{'where':{'id':_0x47173d['id']}});})[_0x1bd1('0x12')](function(){oauth[_0x1bd1('0x56')](_0x47173d);socket[_0x1bd1('0x57')](_0x1bd1('0x58'),{'id':_0x1eb2f7['id']});return;})[_0x1bd1('0x12')](respondWithStatusCode(_0x476188,null))[_0x1bd1('0x32')](function(_0x10b5e6){if(_0x1eb2f7){socket[_0x1bd1('0x57')](_0x1bd1('0x59'),{'id':_0x1eb2f7['id']});}if(!_0x47173d){logger[_0x1bd1('0x14')](_0x1bd1('0x5a'),_0x10b5e6);return _0x476188[_0x1bd1('0x9')](0x1f4)[_0x1bd1('0x5b')](_0x10b5e6['message']);}logger['error'](_0x1bd1('0x5c'),_0x47173d['id'],JSON[_0x1bd1('0x5d')](_0x10b5e6));});}; \ No newline at end of file +var _0x2741=['data5','refresh_token','data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','update','destroy','then','end','error','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','type','key','query','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','rows','service','decryptString','data3','catch','show','params','keys','intersection','find','MicrosoftAzure','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','from','base64','toString','ascii','parse','isValidIdToken','Unable\x20to\x20validate\x20id_token','state','getOauth2MicrosoftAccessToken','code'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x2741,0x1e9));var _0x1274=function(_0x442d58,_0x192b11){_0x442d58=_0x442d58-0x0;var _0x205c77=_0x2741[_0x442d58];return _0x205c77;};'use strict';var _=require(_0x1274('0x0'));var Redis=require(_0x1274('0x1'));var qs=require(_0x1274('0x2'));var encryptor=require(_0x1274('0x3'));var config=require(_0x1274('0x4'));var logger=require(_0x1274('0x5'))('api');var db=require(_0x1274('0x6'))['db'];var oauth=require(_0x1274('0x7'));config[_0x1274('0x8')]=_[_0x1274('0x9')](config[_0x1274('0x8')],{'host':_0x1274('0xa'),'port':0x18eb});var socket=require(_0x1274('0xb'))(new Redis(config[_0x1274('0x8')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x4f42a5,_0x4dfbbc){_0x4dfbbc=_0x4dfbbc||0xcc;return function(_0x93d87){if(_0x93d87){return _0x4f42a5[_0x1274('0xc')](_0x4dfbbc);}return _0x4f42a5[_0x1274('0xd')](_0x4dfbbc)['end']();};}function respondWithResult(_0x1f76a8,_0x30264b){_0x30264b=_0x30264b||0xc8;return function(_0x23b8e3){if(_0x23b8e3){return _0x1f76a8[_0x1274('0xd')](_0x30264b)[_0x1274('0xe')](_0x23b8e3);}};}function respondWithFilteredResult(_0x248096,_0x38de52){return function(_0x33cf48){if(_0x33cf48){var _0x1862bc=typeof _0x38de52[_0x1274('0xf')]===_0x1274('0x10')&&typeof _0x38de52[_0x1274('0x11')]===_0x1274('0x10');var _0x1f573d=_0x33cf48[_0x1274('0x12')];var _0x8278f5=_0x1862bc?0x0:_0x38de52[_0x1274('0xf')];var _0x3b83a5=_0x1862bc?_0x33cf48[_0x1274('0x12')]:_0x38de52[_0x1274('0xf')]+_0x38de52[_0x1274('0x11')];var _0x22104f;if(_0x3b83a5>=_0x1f573d){_0x3b83a5=_0x1f573d;_0x22104f=0xc8;}else{_0x22104f=0xce;}_0x248096[_0x1274('0xd')](_0x22104f);return _0x248096['set']('Content-Range',_0x8278f5+'-'+_0x3b83a5+'/'+_0x1f573d)[_0x1274('0xe')](_0x33cf48);}return null;};}function saveUpdates(_0x5c6cb1){return function(_0x25e434){if(_0x25e434){return _0x25e434[_0x1274('0x13')](_0x5c6cb1)['then'](function(_0x3e6e11){return _0x3e6e11;});}return null;};}function removeEntity(_0x4e9609){return function(_0x84be30){if(_0x84be30){return _0x84be30[_0x1274('0x14')]()[_0x1274('0x15')](function(){_0x4e9609[_0x1274('0xd')](0xcc)[_0x1274('0x16')]();});}};}function handleEntityNotFound(_0x63b519){return function(_0x2c6556){if(!_0x2c6556){_0x63b519[_0x1274('0xc')](0x194);}return _0x2c6556;};}function handleError(_0x30366a,_0x5f79a2){_0x5f79a2=_0x5f79a2||0x1f4;return function(_0x39531f){logger[_0x1274('0x17')](_0x39531f[_0x1274('0x18')]);if(_0x39531f[_0x1274('0x19')]){delete _0x39531f[_0x1274('0x19')];}_0x30366a[_0x1274('0xd')](_0x5f79a2)[_0x1274('0x1a')](_0x39531f);};}function maskClientSecret(_0x5deb32){return _[_0x1274('0x1b')](_0x5deb32[_0x1274('0x1c')](0x0,0x3),0x14,'*');}exports[_0x1274('0x1d')]=function(_0x4d014d,_0x422a54){var _0x1fd8ed={},_0x332ce2={},_0x5e6942={'count':0x0,'rows':[]};var _0x1c8b07=_[_0x1274('0x1e')](db[_0x1274('0x1f')][_0x1274('0x20')],function(_0x27d954){return{'name':_0x27d954['fieldName'],'type':_0x27d954[_0x1274('0x21')][_0x1274('0x22')]};});_0x332ce2['model']=_[_0x1274('0x1e')](_0x1c8b07,_0x1274('0x19'));_0x332ce2[_0x1274('0x23')]=_['keys'](_0x4d014d[_0x1274('0x23')]);_0x332ce2['filters']=_['intersection'](_0x332ce2[_0x1274('0x24')],_0x332ce2['query']);_0x1fd8ed[_0x1274('0x25')]=_['intersection'](_0x332ce2[_0x1274('0x24')],qs[_0x1274('0x26')](_0x4d014d[_0x1274('0x23')][_0x1274('0x26')]));_0x1fd8ed[_0x1274('0x25')]=_0x1fd8ed['attributes'][_0x1274('0x27')]?_0x1fd8ed['attributes']:_0x332ce2[_0x1274('0x24')];if(!_0x4d014d[_0x1274('0x23')][_0x1274('0x28')](_0x1274('0x29'))){_0x1fd8ed[_0x1274('0x11')]=qs[_0x1274('0x11')](_0x4d014d[_0x1274('0x23')]['limit']);_0x1fd8ed[_0x1274('0xf')]=qs[_0x1274('0xf')](_0x4d014d['query']['offset']);}_0x1fd8ed['order']=qs[_0x1274('0x2a')](_0x4d014d[_0x1274('0x23')][_0x1274('0x2a')]);_0x1fd8ed[_0x1274('0x2b')]=qs['filters'](_[_0x1274('0x2c')](_0x4d014d[_0x1274('0x23')],_0x332ce2[_0x1274('0x2d')]),_0x1c8b07);if(_0x4d014d[_0x1274('0x23')][_0x1274('0x2e')]){_0x1fd8ed[_0x1274('0x2b')]=_['merge'](_0x1fd8ed[_0x1274('0x2b')],{'$or':_['map'](_0x1c8b07,function(_0x582d0d){if(_0x582d0d[_0x1274('0x21')]!==_0x1274('0x2f')){var _0x367c0a={};_0x367c0a[_0x582d0d[_0x1274('0x19')]]={'$like':'%'+_0x4d014d[_0x1274('0x23')][_0x1274('0x2e')]+'%'};return _0x367c0a;}})});}_0x1fd8ed=_[_0x1274('0x30')]({},_0x1fd8ed,_0x4d014d[_0x1274('0x31')]);var _0x56a894={'where':_0x1fd8ed[_0x1274('0x2b')]};return db[_0x1274('0x1f')][_0x1274('0x12')](_0x56a894)[_0x1274('0x15')](function(_0x265bf6){_0x5e6942[_0x1274('0x12')]=_0x265bf6;if(_0x4d014d[_0x1274('0x23')][_0x1274('0x32')]){_0x1fd8ed[_0x1274('0x33')]=[{'all':!![]}];}return db[_0x1274('0x1f')]['findAll'](_0x1fd8ed);})['then'](function(_0xccd906){_0x5e6942[_0x1274('0x34')]=_[_0x1274('0x1e')](_0xccd906,function(_0x409288){if(_0x409288[_0x1274('0x35')]==='MicrosoftAzure'){var _0x281339=encryptor[_0x1274('0x36')](_0x409288[_0x1274('0x37')]);_0x409288[_0x1274('0x37')]=maskClientSecret(_0x281339);}return _0x409288;});return _0x5e6942;})[_0x1274('0x15')](respondWithFilteredResult(_0x422a54,_0x1fd8ed))[_0x1274('0x38')](handleError(_0x422a54,null));};exports[_0x1274('0x39')]=function(_0x39701d,_0x55cf0d){var _0x207345={'raw':!![],'where':{'id':_0x39701d[_0x1274('0x3a')]['id']}},_0x1ccb0a={};_0x1ccb0a[_0x1274('0x24')]=_[_0x1274('0x3b')](db[_0x1274('0x1f')]['rawAttributes']);_0x1ccb0a[_0x1274('0x23')]=_['keys'](_0x39701d['query']);_0x1ccb0a[_0x1274('0x2d')]=_[_0x1274('0x3c')](_0x1ccb0a[_0x1274('0x24')],_0x1ccb0a[_0x1274('0x23')]);_0x207345[_0x1274('0x25')]=_['intersection'](_0x1ccb0a[_0x1274('0x24')],qs['fields'](_0x39701d['query']['fields']));_0x207345[_0x1274('0x25')]=_0x207345['attributes']['length']?_0x207345[_0x1274('0x25')]:_0x1ccb0a[_0x1274('0x24')];if(_0x39701d['query'][_0x1274('0x32')]){_0x207345[_0x1274('0x33')]=[{'all':!![]}];}_0x207345=_[_0x1274('0x30')]({},_0x207345,_0x39701d[_0x1274('0x31')]);return db['CloudProvider'][_0x1274('0x3d')](_0x207345)[_0x1274('0x15')](handleEntityNotFound(_0x55cf0d,null))[_0x1274('0x15')](function(_0x46cb0d){if(_0x46cb0d[_0x1274('0x35')]===_0x1274('0x3e')){var _0x24f413=encryptor[_0x1274('0x36')](_0x46cb0d[_0x1274('0x37')]);_0x46cb0d['data3']=maskClientSecret(_0x24f413);}return _0x46cb0d;})['then'](respondWithResult(_0x55cf0d,null))[_0x1274('0x38')](handleError(_0x55cf0d,null));};exports['create']=function(_0x203455,_0x30d757){if(!_0x203455[_0x1274('0x3f')]['name'])throw new Error(_0x1274('0x40'));if(!_0x203455[_0x1274('0x3f')][_0x1274('0x35')])throw new Error(_0x1274('0x41'));var _0x101491=db['CloudProvider'][_0x1274('0x20')][_0x1274('0x35')][_0x1274('0x42')];if(!_0x101491[_0x1274('0x43')](_0x203455[_0x1274('0x3f')][_0x1274('0x35')]))throw new Error(_0x1274('0x44')+_0x101491[_0x1274('0x45')](',\x20'));if(_0x203455[_0x1274('0x3f')][_0x1274('0x35')]===_0x1274('0x3e')&&_0x203455['body'][_0x1274('0x37')]){_0x203455[_0x1274('0x3f')]['data3']=encryptor[_0x1274('0x46')](_0x203455[_0x1274('0x3f')]['data3']);}return db[_0x1274('0x1f')][_0x1274('0x47')](_0x203455['body'],{})[_0x1274('0x15')](respondWithResult(_0x30d757,0xc9))[_0x1274('0x38')](handleError(_0x30d757,null));};exports[_0x1274('0x13')]=function(_0x2dbc6a,_0x363c33){if(_0x2dbc6a[_0x1274('0x3f')]['id']){delete _0x2dbc6a[_0x1274('0x3f')]['id'];}return db[_0x1274('0x1f')]['find']({'where':{'id':_0x2dbc6a[_0x1274('0x3a')]['id']}})[_0x1274('0x15')](handleEntityNotFound(_0x363c33,null))[_0x1274('0x15')](function(_0x221b97){if(_0x221b97['service']==='MicrosoftAzure'&&_0x2dbc6a[_0x1274('0x3f')][_0x1274('0x37')]){_0x2dbc6a[_0x1274('0x3f')]['data3']=encryptor[_0x1274('0x46')](_0x2dbc6a['body'][_0x1274('0x37')]);}return _0x221b97;})['then'](saveUpdates(_0x2dbc6a[_0x1274('0x3f')],null))[_0x1274('0x15')](respondWithResult(_0x363c33,null))[_0x1274('0x38')](handleError(_0x363c33,null));};exports[_0x1274('0x14')]=function(_0x3431b1,_0x459b62){return db['CloudProvider'][_0x1274('0x3d')]({'where':{'id':_0x3431b1[_0x1274('0x3a')]['id']}})[_0x1274('0x15')](handleEntityNotFound(_0x459b62,null))['then'](removeEntity(_0x459b62,null))['catch'](handleError(_0x459b62,null));};exports[_0x1274('0x48')]=function(_0x297fe5,_0x266699){return db[_0x1274('0x1f')][_0x1274('0x49')]({'where':{'id':_0x297fe5[_0x1274('0x3a')]['id']},'raw':!![]})['then'](function(_0x32e382){if(!_0x32e382)return _0x266699['sendStatus'](0x194);return{'url':oauth[_0x1274('0x4a')](_0x32e382,_0x297fe5['user']['id'])};})[_0x1274('0x15')](respondWithResult(_0x266699,null))['catch'](handleError(_0x266699,null));};exports[_0x1274('0x4b')]=function(_0x3acb64,_0x299f8a){var _0x46501f=_0x3acb64['body'];var _0x4d8333;var _0x58e7d6;if(_0x46501f[_0x1274('0x17')])throw _0x46501f;redis[_0x1274('0x4c')](_0x46501f['state'])[_0x1274('0x15')](function(_0x2e5065){if(!_0x2e5065)throw new Error('Invalid\x20state\x20parameter');_0x4d8333=JSON['parse'](_0x2e5065);var _0x188990=Buffer[_0x1274('0x4d')](_0x46501f['state'],_0x1274('0x4e'))[_0x1274('0x4f')](_0x1274('0x50'));_0x58e7d6=JSON[_0x1274('0x51')](_0x188990);if(!oauth[_0x1274('0x52')](_0x46501f['id_token'],_0x4d8333['oauth2Claims']))throw new Error(_0x1274('0x53'));redis['del'](_0x46501f[_0x1274('0x54')]);return oauth[_0x1274('0x55')](_0x46501f[_0x1274('0x56')],_0x4d8333);})[_0x1274('0x15')](function(_0x1cd29a){_0x4d8333[_0x1274('0x57')]=_0x1cd29a['access_token'];_0x4d8333['data6']=_0x1cd29a[_0x1274('0x58')];return db['CloudProvider'][_0x1274('0x13')]({'data5':_0x4d8333[_0x1274('0x57')],'data6':_0x4d8333[_0x1274('0x59')]},{'where':{'id':_0x4d8333['id']}});})[_0x1274('0x15')](function(){oauth[_0x1274('0x5a')](_0x4d8333);socket[_0x1274('0x5b')](_0x1274('0x5c'),{'id':_0x58e7d6['id']});return;})['then'](respondWithStatusCode(_0x299f8a,null))['catch'](function(_0x51e2fa){if(_0x58e7d6){socket[_0x1274('0x5b')](_0x1274('0x5d'),{'id':_0x58e7d6['id']});}if(!_0x4d8333){logger[_0x1274('0x17')]('Invalid\x20authentication\x20state\x20parameter',_0x51e2fa);return _0x299f8a[_0x1274('0xd')](0x1f4)['send'](_0x51e2fa[_0x1274('0x5e')]);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x4d8333['id'],JSON[_0x1274('0x5f')](_0x51e2fa));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 58d7254..cc10bce 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 _0x7f2b=['request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','CloudProvider','cloud_providers','lodash','util','api','bluebird'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x7f2b,0x68));var _0xb7f2=function(_0x5850aa,_0x3be25c){_0x5850aa=_0x5850aa-0x0;var _0x1b32ee=_0x7f2b[_0x5850aa];return _0x1b32ee;};'use strict';var _=require(_0xb7f2('0x0'));var util=require(_0xb7f2('0x1'));var logger=require('../../config/logger')(_0xb7f2('0x2'));var moment=require('moment');var BPromise=require(_0xb7f2('0x3'));var rp=require(_0xb7f2('0x4'));var fs=require('fs');var path=require(_0xb7f2('0x5'));var rimraf=require(_0xb7f2('0x6'));var config=require(_0xb7f2('0x7'));var attributes=require(_0xb7f2('0x8'));module[_0xb7f2('0x9')]=function(_0x2ecc70,_0x5f77f6){return _0x2ecc70['define'](_0xb7f2('0xa'),attributes,{'tableName':_0xb7f2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bd5=['../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','api','bluebird','request-promise','rimraf'];(function(_0x133199,_0x307e52){var _0x17cfaa=function(_0x59d572){while(--_0x59d572){_0x133199['push'](_0x133199['shift']());}};_0x17cfaa(++_0x307e52);}(_0x8bd5,0x74));var _0x58bd=function(_0x45b9c8,_0x4d6d5a){_0x45b9c8=_0x45b9c8-0x0;var _0x48344f=_0x8bd5[_0x45b9c8];return _0x48344f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x58bd('0x0'));var moment=require('moment');var BPromise=require(_0x58bd('0x1'));var rp=require(_0x58bd('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x58bd('0x3'));var config=require(_0x58bd('0x4'));var attributes=require(_0x58bd('0x5'));module[_0x58bd('0x6')]=function(_0x422069,_0x33bee6){return _0x422069[_0x58bd('0x7')](_0x58bd('0x8'),attributes,{'tableName':_0x58bd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index fbbb5b9..9e2f9b1 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a7a=['{TENANT_ID}','data2','code','id_token','from','stringify','toString','randomBytes','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','scope','state','login','map','key','value','set','decode','payload','iss','issuer','audience','nonce','unix','exp','then','data3','CloudProvider','findOne','refresh_token','data6','POST','data5','access_token','update','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','decryptString','bind','intervals','findAll','catch','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','offline_access','/authorize','type','Dynamics365','push','data7','/.default','join','Outlook365','replace'];(function(_0x18cd9a,_0x39f7c9){var _0x33efc2=function(_0x659f4c){while(--_0x659f4c){_0x18cd9a['push'](_0x18cd9a['shift']());}};_0x33efc2(++_0x39f7c9);}(_0x3a7a,0x123));var _0xa3a7=function(_0x5b87ce,_0x20b7f6){_0x5b87ce=_0x5b87ce-0x0;var _0x597aa7=_0x3a7a[_0x5b87ce];return _0x597aa7;};'use strict';var _=require('lodash');var crypto=require(_0xa3a7('0x0'));var jwt=require('jsonwebtoken');var moment=require(_0xa3a7('0x1'));var Redis=require(_0xa3a7('0x2'));var rp=require(_0xa3a7('0x3'));var util=require(_0xa3a7('0x4'));var encryptor=require(_0xa3a7('0x5'));var config=require(_0xa3a7('0x6'));var logger=require(_0xa3a7('0x7'))('api');var schedule=require(_0xa3a7('0x8'));var db=require(_0xa3a7('0x9'))['db'];config['redis']=_[_0xa3a7('0xa')](config[_0xa3a7('0xb')],{'host':_0xa3a7('0xc'),'port':0x18eb});var redis=new Redis(config[_0xa3a7('0xb')]);var MICROSOFT_AUTH_URL=_0xa3a7('0xd');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xa3a7('0xe'),_0xa3a7('0xf'),'offline_access',_0xa3a7('0x10'),'https://outlook.office.com/POP.AccessAsUser.All',_0xa3a7('0x11')],'Dynamics365':[_0xa3a7('0x12'),_0xa3a7('0x13')]};var MICROSOFT_AUTH_ENDPOINT=_0xa3a7('0x14');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x54d8a8){var _0x2d4881=_['map'](AZURE_AUTH_SCOPES[_0x54d8a8[_0xa3a7('0x15')]]);if(_0x54d8a8[_0xa3a7('0x15')]===_0xa3a7('0x16'))_0x2d4881[_0xa3a7('0x17')](_0x54d8a8[_0xa3a7('0x18')]+_0xa3a7('0x19'));return _0x2d4881[_0xa3a7('0x1a')]('\x20');}function getAccessTokenScope(_0x215720){if(_0x215720['type']===_0xa3a7('0x1b'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x215720[_0xa3a7('0x15')]===_0xa3a7('0x16'))return _0x215720[_0xa3a7('0x18')]+_0xa3a7('0x19');}function generateMicrosoftAuthorizationUrl(_0x515030,_0x2e4a41){var _0x1394fb=MICROSOFT_AUTH_URL[_0xa3a7('0x1c')](_0xa3a7('0x1d'),_0x515030[_0xa3a7('0x1e')]);var _0x5129a2=[_0xa3a7('0x1f'),_0xa3a7('0x20')];var _0x52bf13=Buffer[_0xa3a7('0x21')](JSON[_0xa3a7('0x22')]({'id':_0x2e4a41}))[_0xa3a7('0x23')]('base64');var _0x57bc3e=crypto[_0xa3a7('0x24')](0x10)[_0xa3a7('0x23')](_0xa3a7('0x25'));var _0x266ee9=getAuthorizationScopes(_0x515030);var _0xb563b5=[{'key':_0xa3a7('0x26'),'value':_0x515030[_0xa3a7('0x27')]},{'key':_0xa3a7('0x28'),'value':encodeURIComponent(_0x5129a2[_0xa3a7('0x1a')]('\x20'))},{'key':_0xa3a7('0x29'),'value':_0x515030[_0xa3a7('0x2a')]},{'key':_0xa3a7('0x2b'),'value':_0xa3a7('0x2c')},{'key':_0xa3a7('0x2d'),'value':encodeURIComponent(_0x266ee9)},{'key':_0xa3a7('0x2e'),'value':_0x52bf13},{'key':'nonce','value':_0x57bc3e},{'key':'prompt','value':_0xa3a7('0x2f')}];var _0x15612f=_0x1394fb+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xa3a7('0x30')](_0xb563b5,function(_0x26e94f){return _0x26e94f[_0xa3a7('0x31')]+'='+_0x26e94f[_0xa3a7('0x32')];})[_0xa3a7('0x1a')]('&');_0x515030['oauth2Claims']={'issuer':_0x1394fb['replace']('oauth2/',''),'audience':_0x515030['data1'],'state':_0x52bf13,'nonce':_0x57bc3e};redis[_0xa3a7('0x33')](_0x52bf13,JSON[_0xa3a7('0x22')](_0x515030));return _0x15612f;}function isValidIdToken(_0x3d0c96,_0x58e066){try{var _0x48ed98=jwt[_0xa3a7('0x34')](_0x3d0c96,{'complete':!![]});var _0x301849=_0x48ed98[_0xa3a7('0x35')];if(_0x301849[_0xa3a7('0x36')]!==_0x58e066[_0xa3a7('0x37')])return![];if(_0x301849['aud']!==_0x58e066[_0xa3a7('0x38')])return![];if(_0x301849['nonce']!==_0x58e066[_0xa3a7('0x39')])return![];if(moment()['isAfter'](moment[_0xa3a7('0x3a')](_0x301849[_0xa3a7('0x3b')])))return![];return!![];}catch(_0x4cf7a6){throw _0x4cf7a6;}}function refreshOauth2MicrosoftAccessToken(_0x3821e2){return Promise['resolve']()[_0xa3a7('0x3c')](function(){if(_0x3821e2[_0xa3a7('0x3d')])return _0x3821e2;return db[_0xa3a7('0x3e')][_0xa3a7('0x3f')]({'where':{'id':_0x3821e2['id']},'raw':!![]});})[_0xa3a7('0x3c')](function(_0x526cad){var _0x2def5b={'grant_type':_0xa3a7('0x40'),'refresh_token':_0x526cad[_0xa3a7('0x41')],'scope':getAccessTokenScope(_0x526cad),'redirect_uri':_0x526cad['data4'],'client_id':_0x526cad[_0xa3a7('0x27')],'client_secret':encryptor['decryptString'](_0x526cad['data3'])};var _0x4050a6={'method':_0xa3a7('0x42'),'uri':MICROSOFT_AUTH_URL[_0xa3a7('0x1c')](_0xa3a7('0x1d'),_0x526cad[_0xa3a7('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2def5b,'json':!![]};return rp(_0x4050a6);})['then'](function(_0x40ae3b){_0x3821e2[_0xa3a7('0x43')]=_0x40ae3b[_0xa3a7('0x44')];_0x3821e2[_0xa3a7('0x41')]=_0x40ae3b[_0xa3a7('0x40')];return db[_0xa3a7('0x3e')][_0xa3a7('0x45')]({'data5':_0x3821e2[_0xa3a7('0x43')],'data6':_0x3821e2[_0xa3a7('0x41')]},{'where':{'id':_0x3821e2['id']}});})[_0xa3a7('0x3c')](function(){return _0x3821e2;})['catch'](function(_0x392f57){logger['error'](_0xa3a7('0x46'),_0x3821e2['id'],_0x392f57);});}function getOauth2MicrosoftAccessToken(_0x3f8e3f,_0x47870a){var _0x1447a9={'grant_type':'authorization_code','code':_0x3f8e3f,'scope':getAccessTokenScope(_0x47870a),'redirect_uri':_0x47870a['data4'],'client_id':_0x47870a['data1'],'client_secret':encryptor[_0xa3a7('0x47')](_0x47870a[_0xa3a7('0x3d')])};var _0x25f537={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xa3a7('0x1c')](_0xa3a7('0x1d'),_0x47870a[_0xa3a7('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1447a9,'json':!![]};return rp(_0x25f537);}function startRefreshInterval(_0x3edc3f){var _0x24901a=schedule['intervals'];if(_0x24901a[_0x3edc3f['id']])clearInterval(_0x24901a[_0x3edc3f['id']]);_0x24901a[_0x3edc3f['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xa3a7('0x48')](this,{'id':_0x3edc3f['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xa3a7('0x49')]=_0x24901a;}function startAllRefreshIntervals(){return db[_0xa3a7('0x3e')][_0xa3a7('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xa3a7('0x3c')](function(_0x48bf13){var _0x361cee=_0x48bf13[_0xa3a7('0x30')](function(_0x3e143f){return refreshOauth2MicrosoftAccessToken(_0x3e143f)[_0xa3a7('0x3c')](function(_0x37f2d1){startRefreshInterval(_0x37f2d1);});});return Promise['all'](_0x361cee);})[_0xa3a7('0x4b')](function(_0x5a2bff){var _0x9e10ae=_0x5a2bff?util[_0xa3a7('0x4c')](_0x5a2bff,{'showHidden':![],'depth':null}):'';logger[_0xa3a7('0x4d')](_0xa3a7('0x4e'),_0x9e10ae);});}module[_0xa3a7('0x4f')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x9703=['refresh_token','data6','data4','POST','data5','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','decryptString','intervals','bind','findAll','inspect','exports','lodash','jsonwebtoken','moment','ioredis','util','../../components/encryptor','../../config/environment','../../config/logger','api','redis','defaults','localhost','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','randomBytes','client_id','data1','redirect_uri','response_mode','form_post','scope','nonce','prompt','login','key','value','oauth2/','payload','issuer','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9703,0x144));var _0x3970=function(_0x21cc4e,_0x24a7ac){_0x21cc4e=_0x21cc4e-0x0;var _0x3b7125=_0x9703[_0x21cc4e];return _0x3b7125;};'use strict';var _=require(_0x3970('0x0'));var crypto=require('crypto');var jwt=require(_0x3970('0x1'));var moment=require(_0x3970('0x2'));var Redis=require(_0x3970('0x3'));var rp=require('request-promise');var util=require(_0x3970('0x4'));var encryptor=require(_0x3970('0x5'));var config=require(_0x3970('0x6'));var logger=require(_0x3970('0x7'))(_0x3970('0x8'));var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config[_0x3970('0x9')]=_[_0x3970('0xa')](config[_0x3970('0x9')],{'host':_0x3970('0xb'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x3970('0xc'),_0x3970('0xd'),_0x3970('0xe'),'offline_access',_0x3970('0xf'),_0x3970('0x10'),_0x3970('0x11')],'Dynamics365':[_0x3970('0xc'),_0x3970('0x12')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x3970('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x57477a){var _0x5cdbfc=_[_0x3970('0x14')](AZURE_AUTH_SCOPES[_0x57477a[_0x3970('0x15')]]);if(_0x57477a[_0x3970('0x15')]===_0x3970('0x16'))_0x5cdbfc[_0x3970('0x17')](_0x57477a[_0x3970('0x18')]+_0x3970('0x19'));return _0x5cdbfc[_0x3970('0x1a')]('\x20');}function getAccessTokenScope(_0xe2e0b9){if(_0xe2e0b9[_0x3970('0x15')]===_0x3970('0x1b'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0xe2e0b9['type']===_0x3970('0x16'))return _0xe2e0b9[_0x3970('0x18')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x5520eb,_0x14309f){var _0x36c792=MICROSOFT_AUTH_URL[_0x3970('0x1c')](_0x3970('0x1d'),_0x5520eb[_0x3970('0x1e')]);var _0x264531=[_0x3970('0x1f'),_0x3970('0x20')];var _0x5205a5=Buffer[_0x3970('0x21')](JSON[_0x3970('0x22')]({'id':_0x14309f}))[_0x3970('0x23')](_0x3970('0x24'));var _0x9d6e30=crypto[_0x3970('0x25')](0x10)['toString']('hex');var _0x50593d=getAuthorizationScopes(_0x5520eb);var _0xe6198c=[{'key':_0x3970('0x26'),'value':_0x5520eb[_0x3970('0x27')]},{'key':'response_type','value':encodeURIComponent(_0x264531[_0x3970('0x1a')]('\x20'))},{'key':_0x3970('0x28'),'value':_0x5520eb['data4']},{'key':_0x3970('0x29'),'value':_0x3970('0x2a')},{'key':_0x3970('0x2b'),'value':encodeURIComponent(_0x50593d)},{'key':'state','value':_0x5205a5},{'key':_0x3970('0x2c'),'value':_0x9d6e30},{'key':_0x3970('0x2d'),'value':_0x3970('0x2e')}];var _0x2cf29c=_0x36c792+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0xe6198c,function(_0x425856){return _0x425856[_0x3970('0x2f')]+'='+_0x425856[_0x3970('0x30')];})['join']('&');_0x5520eb['oauth2Claims']={'issuer':_0x36c792[_0x3970('0x1c')](_0x3970('0x31'),''),'audience':_0x5520eb[_0x3970('0x27')],'state':_0x5205a5,'nonce':_0x9d6e30};redis['set'](_0x5205a5,JSON['stringify'](_0x5520eb));return _0x2cf29c;}function isValidIdToken(_0x42f403,_0x538218){try{var _0x5ea8bd=jwt['decode'](_0x42f403,{'complete':!![]});var _0x489346=_0x5ea8bd[_0x3970('0x32')];if(_0x489346['iss']!==_0x538218[_0x3970('0x33')])return![];if(_0x489346['aud']!==_0x538218[_0x3970('0x34')])return![];if(_0x489346[_0x3970('0x2c')]!==_0x538218[_0x3970('0x2c')])return![];if(moment()[_0x3970('0x35')](moment[_0x3970('0x36')](_0x489346[_0x3970('0x37')])))return![];return!![];}catch(_0x2a8c8d){throw _0x2a8c8d;}}function refreshOauth2MicrosoftAccessToken(_0x114671){return Promise[_0x3970('0x38')]()[_0x3970('0x39')](function(){if(_0x114671[_0x3970('0x3a')])return _0x114671;return db[_0x3970('0x3b')][_0x3970('0x3c')]({'where':{'id':_0x114671['id']},'raw':!![]});})[_0x3970('0x39')](function(_0x4b78f6){var _0x125a4b={'grant_type':_0x3970('0x3d'),'refresh_token':_0x4b78f6[_0x3970('0x3e')],'scope':getAccessTokenScope(_0x4b78f6),'redirect_uri':_0x4b78f6[_0x3970('0x3f')],'client_id':_0x4b78f6[_0x3970('0x27')],'client_secret':encryptor['decryptString'](_0x4b78f6['data3'])};var _0x9ba242={'method':_0x3970('0x40'),'uri':MICROSOFT_AUTH_URL[_0x3970('0x1c')](_0x3970('0x1d'),_0x4b78f6[_0x3970('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x125a4b,'json':!![]};return rp(_0x9ba242);})[_0x3970('0x39')](function(_0x119d4e){_0x114671[_0x3970('0x41')]=_0x119d4e['access_token'];_0x114671['data6']=_0x119d4e[_0x3970('0x3d')];return db[_0x3970('0x3b')][_0x3970('0x42')]({'data5':_0x114671[_0x3970('0x41')],'data6':_0x114671['data6']},{'where':{'id':_0x114671['id']}});})[_0x3970('0x39')](function(){return _0x114671;})[_0x3970('0x43')](function(_0x4cb9c4){logger[_0x3970('0x44')](_0x3970('0x45'),_0x114671['id'],_0x4cb9c4);});}function getOauth2MicrosoftAccessToken(_0x5d642d,_0x4da496){var _0x162bf6={'grant_type':_0x3970('0x46'),'code':_0x5d642d,'scope':getAccessTokenScope(_0x4da496),'redirect_uri':_0x4da496[_0x3970('0x3f')],'client_id':_0x4da496[_0x3970('0x27')],'client_secret':encryptor[_0x3970('0x47')](_0x4da496['data3'])};var _0x22eea2={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x3970('0x1c')]('{TENANT_ID}',_0x4da496[_0x3970('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x162bf6,'json':!![]};return rp(_0x22eea2);}function startRefreshInterval(_0x527ea5){var _0x5a5d6c=schedule[_0x3970('0x48')];if(_0x5a5d6c[_0x527ea5['id']])clearInterval(_0x5a5d6c[_0x527ea5['id']]);_0x5a5d6c[_0x527ea5['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x3970('0x49')](this,{'id':_0x527ea5['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x3970('0x48')]=_0x5a5d6c;}function startAllRefreshIntervals(){return db[_0x3970('0x3b')][_0x3970('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x2afb85){var _0x5dc8b7=_0x2afb85[_0x3970('0x14')](function(_0x4724e1){return refreshOauth2MicrosoftAccessToken(_0x4724e1)['then'](function(_0xcbaede){startRefreshInterval(_0xcbaede);});});return Promise['all'](_0x5dc8b7);})[_0x3970('0x43')](function(_0x1ce5c5){var _0x16aaba=_0x1ce5c5?util[_0x3970('0x4b')](_0x1ce5c5,{'showHidden':![],'depth':null}):'';logger[_0x3970('0x44')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x16aaba);});}module[_0x3970('0x4c')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 5ed25a6..a5bcf02 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 _0xb91a=['request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','request','CloudProvider,\x20%s,\x20%s'];(function(_0x50a454,_0x26b2d6){var _0x314a27=function(_0x3b674f){while(--_0x3b674f){_0x50a454['push'](_0x50a454['shift']());}};_0x314a27(++_0x26b2d6);}(_0xb91a,0xe5));var _0xab91=function(_0x5b726d,_0x4f06dc){_0x5b726d=_0x5b726d-0x0;var _0x242974=_0xb91a[_0x5b726d];return _0x242974;};'use strict';var _=require('lodash');var util=require(_0xab91('0x0'));var moment=require(_0xab91('0x1'));var BPromise=require(_0xab91('0x2'));var rs=require(_0xab91('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab91('0x4'))['db'];var utils=require(_0xab91('0x5'));var logger=require('../../config/logger')(_0xab91('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xab91('0x7')][_0xab91('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x56f24d,_0x2ebd86,_0x26e44b){return new BPromise(function(_0x55a554,_0x1748f2){return client[_0xab91('0x9')](_0x56f24d,_0x26e44b)['then'](function(_0x5765fc){logger['info'](_0xab91('0xa'),_0x2ebd86,_0xab91('0xb'));logger[_0xab91('0xc')](_0xab91('0xd'),_0x2ebd86,'request\x20sent',JSON[_0xab91('0xe')](_0x5765fc));if(_0x5765fc[_0xab91('0xf')]){if(_0x5765fc['error'][_0xab91('0x10')]===0x1f4){logger['error'](_0xab91('0xa'),_0x2ebd86,_0x5765fc['error']['message']);return _0x1748f2(_0x5765fc[_0xab91('0xf')]['message']);}logger[_0xab91('0xf')](_0xab91('0xa'),_0x2ebd86,_0x5765fc[_0xab91('0xf')][_0xab91('0x11')]);return _0x55a554(_0x5765fc[_0xab91('0xf')][_0xab91('0x11')]);}else{logger['info'](_0xab91('0xa'),_0x2ebd86,'request\x20sent');_0x55a554(_0x5765fc[_0xab91('0x12')][_0xab91('0x11')]);}})[_0xab91('0x13')](function(_0x32df88){logger['error'](_0xab91('0xa'),_0x2ebd86,_0x32df88);_0x1748f2(_0x32df88);});});} \ No newline at end of file +var _0xd5f9=['../../config/environment','then','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x41561b,_0x1a4792){var _0x2fa151=function(_0x12bfee){while(--_0x12bfee){_0x41561b['push'](_0x41561b['shift']());}};_0x2fa151(++_0x1a4792);}(_0xd5f9,0x1f1));var _0x9d5f=function(_0x3e10c0,_0x385bdc){_0x3e10c0=_0x3e10c0-0x0;var _0x2fb415=_0xd5f9[_0x3e10c0];return _0x2fb415;};'use strict';var _=require(_0x9d5f('0x0'));var util=require(_0x9d5f('0x1'));var moment=require(_0x9d5f('0x2'));var BPromise=require(_0x9d5f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d5f('0x4'));var db=require(_0x9d5f('0x5'))['db'];var utils=require(_0x9d5f('0x6'));var logger=require(_0x9d5f('0x7'))(_0x9d5f('0x8'));var config=require(_0x9d5f('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1dca4b,_0x2e1c4e,_0x4ac60a){return new BPromise(function(_0x402a35,_0x255389){return client['request'](_0x1dca4b,_0x4ac60a)[_0x9d5f('0xa')](function(_0x241166){logger['info'](_0x9d5f('0xb'),_0x2e1c4e,'request\x20sent');logger[_0x9d5f('0xc')](_0x9d5f('0xd'),_0x2e1c4e,_0x9d5f('0xe'),JSON[_0x9d5f('0xf')](_0x241166));if(_0x241166[_0x9d5f('0x10')]){if(_0x241166['error'][_0x9d5f('0x11')]===0x1f4){logger[_0x9d5f('0x10')](_0x9d5f('0xb'),_0x2e1c4e,_0x241166[_0x9d5f('0x10')][_0x9d5f('0x12')]);return _0x255389(_0x241166[_0x9d5f('0x10')][_0x9d5f('0x12')]);}logger[_0x9d5f('0x10')](_0x9d5f('0xb'),_0x2e1c4e,_0x241166['error']['message']);return _0x402a35(_0x241166['error']['message']);}else{logger[_0x9d5f('0x13')](_0x9d5f('0xb'),_0x2e1c4e,'request\x20sent');_0x402a35(_0x241166[_0x9d5f('0x14')][_0x9d5f('0x12')]);}})[_0x9d5f('0x15')](function(_0x3a9220){logger[_0x9d5f('0x10')]('CloudProvider,\x20%s,\x20%s',_0x2e1c4e,_0x3a9220);_0x255389(_0x3a9220);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index e14e583..6138f71 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 _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x1261,0x144));var _0x1126=function(_0x5ab340,_0x3bf3e4){_0x5ab340=_0x5ab340-0x0;var _0x2ed5b7=_0x1261[_0x5ab340];return _0x2ed5b7;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file +var _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x7a54,0x106));var _0x47a5=function(_0x39acaa,_0x1028a4){_0x39acaa=_0x39acaa-0x0;var _0x36ae79=_0x7a54[_0x39acaa];return _0x36ae79;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 0d9927e..757e78a 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 _0x95d9=['name','sequelize','exports','STRING'];(function(_0x4b120e,_0x144dd4){var _0x4fd86b=function(_0x591838){while(--_0x591838){_0x4b120e['push'](_0x4b120e['shift']());}};_0x4fd86b(++_0x144dd4);}(_0x95d9,0x8d));var _0x995d=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x95d9[_0x1fc122];return _0xa2cb13;};'use strict';var Sequelize=require(_0x995d('0x0'));module[_0x995d('0x1')]={'name':{'type':Sequelize[_0x995d('0x2')],'unique':_0x995d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x995d('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x995d('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x995d('0x2')]},'street':{'type':Sequelize[_0x995d('0x2')]},'postalCode':{'type':Sequelize[_0x995d('0x2')]},'city':{'type':Sequelize[_0x995d('0x2')]},'country':{'type':Sequelize[_0x995d('0x2')]},'email':{'type':Sequelize[_0x995d('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x995d('0x2')]},'sStreet':{'type':Sequelize[_0x995d('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x995d('0x2')]},'description':{'type':Sequelize[_0x995d('0x2')]}}; \ No newline at end of file +var _0x54f3=['exports','STRING','name'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x54f3,0x120));var _0x354f=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x54f3[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require('sequelize');module[_0x354f('0x0')]={'name':{'type':Sequelize[_0x354f('0x1')],'unique':_0x354f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x354f('0x1')]},'companyId':{'type':Sequelize[_0x354f('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x354f('0x1')]},'type':{'type':Sequelize[_0x354f('0x1')]},'street':{'type':Sequelize[_0x354f('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x354f('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x354f('0x1')]},'sStreet':{'type':Sequelize[_0x354f('0x1')]},'sPostalCode':{'type':Sequelize[_0x354f('0x1')]},'sCity':{'type':Sequelize[_0x354f('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x354f('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index f163a59..6047e06 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 _0xf061=['includeAll','include','findAll','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addContacts','ids','omit','getContacts','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','end','json','undefined','limit','offset','set','apply','reject','save','then','destroy','get','UserProfileResource','status','name','send','CmCompany','describe','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','map','merge','options'];(function(_0x40725e,_0x305d77){var _0x2dac6=function(_0x5a8ae2){while(--_0x5a8ae2){_0x40725e['push'](_0x40725e['shift']());}};_0x2dac6(++_0x305d77);}(_0xf061,0xc5));var _0x1f06=function(_0x28e09d,_0x100fad){_0x28e09d=_0x28e09d-0x0;var _0x28c01a=_0xf061[_0x28e09d];return _0x28c01a;};'use strict';var emlformat=require(_0x1f06('0x0'));var rimraf=require(_0x1f06('0x1'));var zipdir=require(_0x1f06('0x2'));var jsonpatch=require(_0x1f06('0x3'));var rp=require(_0x1f06('0x4'));var moment=require(_0x1f06('0x5'));var BPromise=require(_0x1f06('0x6'));var Mustache=require(_0x1f06('0x7'));var util=require(_0x1f06('0x8'));var path=require(_0x1f06('0x9'));var sox=require(_0x1f06('0xa'));var csv=require('to-csv');var ejs=require(_0x1f06('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f06('0xc'));var squel=require('squel');var crypto=require(_0x1f06('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1f06('0xe'));var toCsv=require(_0x1f06('0xf'));var querystring=require(_0x1f06('0x10'));var Papa=require(_0x1f06('0x11'));var Redis=require(_0x1f06('0x12'));var authService=require(_0x1f06('0x13'));var qs=require(_0x1f06('0x14'));var as=require(_0x1f06('0x15'));var hardwareService=require(_0x1f06('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x1f06('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1f06('0x18'))['db'];function respondWithStatusCode(_0x47b3f8,_0x374635){_0x374635=_0x374635||0xcc;return function(_0x53b999){if(_0x53b999){return _0x47b3f8[_0x1f06('0x19')](_0x374635);}return _0x47b3f8['status'](_0x374635)[_0x1f06('0x1a')]();};}function respondWithResult(_0x266979,_0x1395e3){_0x1395e3=_0x1395e3||0xc8;return function(_0x801da6){if(_0x801da6){return _0x266979['status'](_0x1395e3)[_0x1f06('0x1b')](_0x801da6);}};}function respondWithFilteredResult(_0x48f029,_0xfa2180){return function(_0x135dfa){if(_0x135dfa){var _0x2bd76f=typeof _0xfa2180['offset']===_0x1f06('0x1c')&&typeof _0xfa2180[_0x1f06('0x1d')]===_0x1f06('0x1c');var _0x84d264=_0x135dfa['count'];var _0x26ee2f=_0x2bd76f?0x0:_0xfa2180[_0x1f06('0x1e')];var _0x40ce48=_0x2bd76f?_0x135dfa['count']:_0xfa2180[_0x1f06('0x1e')]+_0xfa2180[_0x1f06('0x1d')];var _0xc3e005;if(_0x40ce48>=_0x84d264){_0x40ce48=_0x84d264;_0xc3e005=0xc8;}else{_0xc3e005=0xce;}_0x48f029['status'](_0xc3e005);return _0x48f029[_0x1f06('0x1f')]('Content-Range',_0x26ee2f+'-'+_0x40ce48+'/'+_0x84d264)[_0x1f06('0x1b')](_0x135dfa);}return null;};}function patchUpdates(_0x5109f3){return function(_0x505506){try{jsonpatch[_0x1f06('0x20')](_0x505506,_0x5109f3,!![]);}catch(_0x494252){return BPromise[_0x1f06('0x21')](_0x494252);}return _0x505506[_0x1f06('0x22')]();};}function saveUpdates(_0x3370ae,_0x281eab){return function(_0x2f8423){if(_0x2f8423){return _0x2f8423['update'](_0x3370ae)[_0x1f06('0x23')](function(_0x2d1f6e){return _0x2d1f6e;});}return null;};}function removeEntity(_0x53330b,_0x477fca){return function(_0x30e9e0){if(_0x30e9e0){return _0x30e9e0[_0x1f06('0x24')]()[_0x1f06('0x23')](function(){var _0x468cd8=_0x30e9e0[_0x1f06('0x25')]({'plain':!![]});var _0x3eccb3='Companies';return db[_0x1f06('0x26')][_0x1f06('0x24')]({'where':{'type':_0x3eccb3,'resourceId':_0x468cd8['id']}})[_0x1f06('0x23')](function(){return _0x30e9e0;});})[_0x1f06('0x23')](function(){_0x53330b[_0x1f06('0x27')](0xcc)[_0x1f06('0x1a')]();});}};}function handleEntityNotFound(_0x103622,_0x4a4362){return function(_0x2fb8a4){if(!_0x2fb8a4){_0x103622['sendStatus'](0x194);}return _0x2fb8a4;};}function handleError(_0x425500,_0x26193e){_0x26193e=_0x26193e||0x1f4;return function(_0x194e06){logger['error'](_0x194e06['stack']);if(_0x194e06['name']){delete _0x194e06[_0x1f06('0x28')];}_0x425500[_0x1f06('0x27')](_0x26193e)[_0x1f06('0x29')](_0x194e06);};}exports['index']=function(_0x43e421,_0x2e067a){var _0x2a2641={},_0x5af978={},_0x3cad56={'count':0x0,'rows':[]};return db[_0x1f06('0x2a')][_0x1f06('0x2b')]()['then'](function(_0x2b935e){_0x5af978[_0x1f06('0x2c')]=_[_0x1f06('0x2d')](_0x2b935e);_0x5af978[_0x1f06('0x2e')]=_[_0x1f06('0x2d')](_0x43e421[_0x1f06('0x2e')]);_0x5af978['filters']=_['intersection'](_0x5af978[_0x1f06('0x2c')],_0x5af978[_0x1f06('0x2e')]);_0x2a2641[_0x1f06('0x2f')]=_[_0x1f06('0x30')](_0x5af978['model'],qs[_0x1f06('0x31')](_0x43e421[_0x1f06('0x2e')][_0x1f06('0x31')]));_0x2a2641['attributes']=_0x2a2641['attributes'][_0x1f06('0x32')]?_0x2a2641[_0x1f06('0x2f')]:_0x5af978['model'];if(!_0x43e421[_0x1f06('0x2e')][_0x1f06('0x33')](_0x1f06('0x34'))){_0x2a2641[_0x1f06('0x1d')]=qs[_0x1f06('0x1d')](_0x43e421[_0x1f06('0x2e')][_0x1f06('0x1d')]);_0x2a2641[_0x1f06('0x1e')]=qs[_0x1f06('0x1e')](_0x43e421[_0x1f06('0x2e')]['offset']);}_0x2a2641[_0x1f06('0x35')]=qs[_0x1f06('0x36')](_0x43e421[_0x1f06('0x2e')][_0x1f06('0x36')]);_0x2a2641[_0x1f06('0x37')]=qs[_0x1f06('0x38')](_['pick'](_0x43e421[_0x1f06('0x2e')],_0x5af978[_0x1f06('0x38')]),_0x2b935e);if(_0x43e421[_0x1f06('0x2e')][_0x1f06('0x39')]){_0x2a2641['where']=_['merge'](_0x2a2641[_0x1f06('0x37')],{'$or':_[_0x1f06('0x3a')](_0x2a2641[_0x1f06('0x2f')],function(_0x4dcc9b){var _0x29c7d4={};_0x29c7d4[_0x4dcc9b]={'$like':'%'+_0x43e421['query']['filter']+'%'};return _0x29c7d4;})});}_0x2a2641=_[_0x1f06('0x3b')]({},_0x2a2641,_0x43e421[_0x1f06('0x3c')]);var _0x5c7da1={'where':_0x2a2641[_0x1f06('0x37')]};return db['CmCompany']['count'](_0x5c7da1)['then'](function(_0x297893){_0x3cad56['count']=_0x297893;if(_0x43e421['query'][_0x1f06('0x3d')]){_0x2a2641[_0x1f06('0x3e')]=[{'all':!![]}];}return db[_0x1f06('0x2a')][_0x1f06('0x3f')](_0x2a2641);})[_0x1f06('0x23')](function(_0x22a3e0){_0x3cad56['rows']=_0x22a3e0;return _0x3cad56;})[_0x1f06('0x23')](respondWithFilteredResult(_0x2e067a,_0x2a2641))[_0x1f06('0x40')](handleError(_0x2e067a,null));})[_0x1f06('0x40')](handleError(_0x2e067a,null));};exports[_0x1f06('0x41')]=function(_0x288f99,_0x5fe6e){var _0x11c33e={'raw':![],'where':{'id':_0x288f99[_0x1f06('0x42')]['id']}},_0xd4b8a5={};_0xd4b8a5[_0x1f06('0x2c')]=_[_0x1f06('0x2d')](db['CmCompany'][_0x1f06('0x43')]);_0xd4b8a5['query']=_['keys'](_0x288f99[_0x1f06('0x2e')]);_0xd4b8a5[_0x1f06('0x38')]=_[_0x1f06('0x30')](_0xd4b8a5[_0x1f06('0x2c')],_0xd4b8a5[_0x1f06('0x2e')]);_0x11c33e[_0x1f06('0x2f')]=_[_0x1f06('0x30')](_0xd4b8a5['model'],qs[_0x1f06('0x31')](_0x288f99[_0x1f06('0x2e')][_0x1f06('0x31')]));_0x11c33e[_0x1f06('0x2f')]=_0x11c33e['attributes']['length']?_0x11c33e[_0x1f06('0x2f')]:_0xd4b8a5['model'];if(_0x288f99[_0x1f06('0x2e')][_0x1f06('0x3d')]){_0x11c33e[_0x1f06('0x3e')]=[{'all':!![]}];}_0x11c33e=_[_0x1f06('0x3b')]({},_0x11c33e,_0x288f99[_0x1f06('0x3c')]);return db['CmCompany'][_0x1f06('0x44')](_0x11c33e)['then'](handleEntityNotFound(_0x5fe6e,null))[_0x1f06('0x23')](respondWithResult(_0x5fe6e,null))[_0x1f06('0x40')](handleError(_0x5fe6e,null));};exports['create']=function(_0x5e552b,_0x1b4b86){return db[_0x1f06('0x2a')][_0x1f06('0x45')](_0x5e552b['body'],{})['then'](function(_0x49e50f){var _0x101f0f=_0x5e552b[_0x1f06('0x46')]['get']({'plain':!![]});if(!_0x101f0f)throw new Error(_0x1f06('0x47'));if(_0x101f0f[_0x1f06('0x48')]==='user'){var _0x29fc8f=_0x49e50f[_0x1f06('0x25')]({'plain':!![]});var _0x317f08=_0x1f06('0x49');return db[_0x1f06('0x4a')][_0x1f06('0x44')]({'where':{'name':_0x317f08,'userProfileId':_0x101f0f[_0x1f06('0x4b')]},'raw':!![]})[_0x1f06('0x23')](function(_0x4ac1ba){if(_0x4ac1ba&&_0x4ac1ba[_0x1f06('0x4c')]===0x0){return db['UserProfileResource'][_0x1f06('0x45')]({'name':_0x29fc8f['name'],'resourceId':_0x29fc8f['id'],'type':_0x4ac1ba[_0x1f06('0x28')],'sectionId':_0x4ac1ba['id']},{})[_0x1f06('0x23')](function(){return _0x49e50f;});}else{return _0x49e50f;}})[_0x1f06('0x40')](function(_0x370484){logger[_0x1f06('0x4d')](_0x1f06('0x4e'),_0x370484);throw _0x370484;});}return _0x49e50f;})[_0x1f06('0x23')](respondWithResult(_0x1b4b86,0xc9))['catch'](handleError(_0x1b4b86,null));};exports[_0x1f06('0x4f')]=function(_0x4b8868,_0x3f4b84){if(_0x4b8868['body']['id']){delete _0x4b8868[_0x1f06('0x50')]['id'];}return db[_0x1f06('0x2a')][_0x1f06('0x44')]({'where':{'id':_0x4b8868[_0x1f06('0x42')]['id']}})[_0x1f06('0x23')](handleEntityNotFound(_0x3f4b84,null))['then'](saveUpdates(_0x4b8868[_0x1f06('0x50')],null))[_0x1f06('0x23')](respondWithResult(_0x3f4b84,null))['catch'](handleError(_0x3f4b84,null));};exports[_0x1f06('0x24')]=function(_0x1e820d,_0x5069b4){return db['CmCompany'][_0x1f06('0x44')]({'where':{'id':_0x1e820d[_0x1f06('0x42')]['id']}})[_0x1f06('0x23')](handleEntityNotFound(_0x5069b4,null))['then'](removeEntity(_0x5069b4,null))[_0x1f06('0x40')](handleError(_0x5069b4,null));};exports[_0x1f06('0x2b')]=function(_0x16a09a,_0x470a81){return db[_0x1f06('0x2a')][_0x1f06('0x2b')]()[_0x1f06('0x23')](respondWithResult(_0x470a81,null))['catch'](handleError(_0x470a81,null));};exports[_0x1f06('0x51')]=function(_0x253b56,_0xb87c01,_0xfe42ea){return db['CmContact'][_0x1f06('0x44')]({'where':{'id':_0x253b56[_0x1f06('0x42')]['id']}})['then'](handleEntityNotFound(_0xb87c01,null))['then'](function(_0x16380e){if(_0x16380e){return _0x16380e[_0x1f06('0x51')](_0x253b56[_0x1f06('0x50')][_0x1f06('0x52')],_[_0x1f06('0x53')](_0x253b56[_0x1f06('0x50')],[_0x1f06('0x52'),'id'])||{});}})[_0x1f06('0x23')](respondWithResult(_0xb87c01,null))[_0x1f06('0x40')](handleError(_0xb87c01,null));};exports[_0x1f06('0x54')]=function(_0x3a9d78,_0x33a7ec,_0xadfbb7){var _0x17d287={};var _0x529359={};var _0x1cd75a;var _0x1fc49b;return db['CmCompany']['findOne']({'where':{'id':_0x3a9d78[_0x1f06('0x42')]['id']}})[_0x1f06('0x23')](handleEntityNotFound(_0x33a7ec,null))[_0x1f06('0x23')](function(_0x4de4be){if(_0x4de4be){_0x1cd75a=_0x4de4be;_0x529359['model']=_[_0x1f06('0x2d')](db['CmContact'][_0x1f06('0x43')]);_0x529359['query']=_[_0x1f06('0x2d')](_0x3a9d78['query']);_0x529359[_0x1f06('0x38')]=_[_0x1f06('0x30')](_0x529359[_0x1f06('0x2c')],_0x529359[_0x1f06('0x2e')]);_0x17d287['attributes']=_[_0x1f06('0x30')](_0x529359[_0x1f06('0x2c')],qs[_0x1f06('0x31')](_0x3a9d78[_0x1f06('0x2e')][_0x1f06('0x31')]));_0x17d287[_0x1f06('0x2f')]=_0x17d287['attributes'][_0x1f06('0x32')]?_0x17d287['attributes']:_0x529359[_0x1f06('0x2c')];_0x17d287[_0x1f06('0x35')]=qs['sort'](_0x3a9d78[_0x1f06('0x2e')]['sort']);_0x17d287['where']=qs[_0x1f06('0x38')](_[_0x1f06('0x55')](_0x3a9d78['query'],_0x529359[_0x1f06('0x38')]));if(_0x3a9d78['query']['filter']){_0x17d287['where']=_[_0x1f06('0x3b')](_0x17d287[_0x1f06('0x37')],{'$or':_[_0x1f06('0x3a')](_0x17d287[_0x1f06('0x2f')],function(_0x57fb88){var _0x48d615={};_0x48d615[_0x57fb88]={'$like':'%'+_0x3a9d78[_0x1f06('0x2e')][_0x1f06('0x39')]+'%'};return _0x48d615;})});}_0x17d287=_['merge']({},_0x17d287,_0x3a9d78['options']);return _0x1cd75a[_0x1f06('0x54')](_0x17d287);}})['then'](function(_0x178401){if(_0x178401){_0x1fc49b=_0x178401['length'];if(!_0x3a9d78[_0x1f06('0x2e')][_0x1f06('0x33')](_0x1f06('0x34'))){_0x17d287[_0x1f06('0x1d')]=qs['limit'](_0x3a9d78[_0x1f06('0x2e')]['limit']);_0x17d287[_0x1f06('0x1e')]=qs['offset'](_0x3a9d78[_0x1f06('0x2e')]['offset']);}return _0x1cd75a[_0x1f06('0x54')](_0x17d287);}})[_0x1f06('0x23')](function(_0x5cbfea){if(_0x5cbfea){return _0x5cbfea?{'count':_0x1fc49b,'rows':_0x5cbfea}:null;}})[_0x1f06('0x23')](respondWithResult(_0x33a7ec,null))['catch'](handleError(_0x33a7ec,null));}; \ No newline at end of file +var _0xc8d3=['count','limit','set','Content-Range','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','index','describe','model','keys','query','filters','intersection','fields','attributes','length','order','sort','where','pick','merge','filter','options','CmCompany','includeAll','include','catch','show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','omit','ids','findOne','map','getContacts','hasOwnProperty','nolimit','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x2162e0,_0xd18181){var _0x162d05=function(_0x421403){while(--_0x421403){_0x2162e0['push'](_0x2162e0['shift']());}};_0x162d05(++_0xd18181);}(_0xc8d3,0x19c));var _0x3c8d=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0xc8d3[_0x2d89ce];return _0x3fad10;};'use strict';var emlformat=require(_0x3c8d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3c8d('0x1'));var rp=require(_0x3c8d('0x2'));var moment=require(_0x3c8d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3c8d('0x4'));var util=require(_0x3c8d('0x5'));var path=require('path');var sox=require(_0x3c8d('0x6'));var csv=require('to-csv');var ejs=require(_0x3c8d('0x7'));var fs=require('fs');var fs_extra=require(_0x3c8d('0x8'));var _=require(_0x3c8d('0x9'));var squel=require(_0x3c8d('0xa'));var crypto=require(_0x3c8d('0xb'));var jsforce=require(_0x3c8d('0xc'));var deskjs=require(_0x3c8d('0xd'));var toCsv=require(_0x3c8d('0xe'));var querystring=require(_0x3c8d('0xf'));var Papa=require('papaparse');var Redis=require(_0x3c8d('0x10'));var authService=require(_0x3c8d('0x11'));var qs=require(_0x3c8d('0x12'));var as=require(_0x3c8d('0x13'));var hardwareService=require(_0x3c8d('0x14'));var logger=require(_0x3c8d('0x15'))(_0x3c8d('0x16'));var utils=require(_0x3c8d('0x17'));var config=require(_0x3c8d('0x18'));var licenseUtil=require(_0x3c8d('0x19'));var db=require(_0x3c8d('0x1a'))['db'];function respondWithStatusCode(_0x1668be,_0x276da0){_0x276da0=_0x276da0||0xcc;return function(_0x2fb365){if(_0x2fb365){return _0x1668be[_0x3c8d('0x1b')](_0x276da0);}return _0x1668be[_0x3c8d('0x1c')](_0x276da0)[_0x3c8d('0x1d')]();};}function respondWithResult(_0x336afa,_0x5195d7){_0x5195d7=_0x5195d7||0xc8;return function(_0x37ab99){if(_0x37ab99){return _0x336afa[_0x3c8d('0x1c')](_0x5195d7)[_0x3c8d('0x1e')](_0x37ab99);}};}function respondWithFilteredResult(_0x31638e,_0x203a9b){return function(_0x36b170){if(_0x36b170){var _0x2121f1=typeof _0x203a9b[_0x3c8d('0x1f')]===_0x3c8d('0x20')&&typeof _0x203a9b['limit']===_0x3c8d('0x20');var _0xf02acf=_0x36b170[_0x3c8d('0x21')];var _0x21159c=_0x2121f1?0x0:_0x203a9b[_0x3c8d('0x1f')];var _0x234cf5=_0x2121f1?_0x36b170[_0x3c8d('0x21')]:_0x203a9b[_0x3c8d('0x1f')]+_0x203a9b[_0x3c8d('0x22')];var _0x4e0502;if(_0x234cf5>=_0xf02acf){_0x234cf5=_0xf02acf;_0x4e0502=0xc8;}else{_0x4e0502=0xce;}_0x31638e[_0x3c8d('0x1c')](_0x4e0502);return _0x31638e[_0x3c8d('0x23')](_0x3c8d('0x24'),_0x21159c+'-'+_0x234cf5+'/'+_0xf02acf)[_0x3c8d('0x1e')](_0x36b170);}return null;};}function patchUpdates(_0x1f9cc2){return function(_0x4a01e9){try{jsonpatch['apply'](_0x4a01e9,_0x1f9cc2,!![]);}catch(_0x4a510d){return BPromise['reject'](_0x4a510d);}return _0x4a01e9[_0x3c8d('0x25')]();};}function saveUpdates(_0x186e7a,_0x1b6cfc){return function(_0x52e249){if(_0x52e249){return _0x52e249[_0x3c8d('0x26')](_0x186e7a)[_0x3c8d('0x27')](function(_0x833bfb){return _0x833bfb;});}return null;};}function removeEntity(_0x2a71a6,_0x2da356){return function(_0x5330bc){if(_0x5330bc){return _0x5330bc[_0x3c8d('0x28')]()[_0x3c8d('0x27')](function(){var _0x5489d8=_0x5330bc[_0x3c8d('0x29')]({'plain':!![]});var _0x3803c8=_0x3c8d('0x2a');return db[_0x3c8d('0x2b')][_0x3c8d('0x28')]({'where':{'type':_0x3803c8,'resourceId':_0x5489d8['id']}})[_0x3c8d('0x27')](function(){return _0x5330bc;});})[_0x3c8d('0x27')](function(){_0x2a71a6[_0x3c8d('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cd0c8,_0x15e539){return function(_0x2bebdf){if(!_0x2bebdf){_0x4cd0c8[_0x3c8d('0x1b')](0x194);}return _0x2bebdf;};}function handleError(_0x5d9596,_0x1b3daf){_0x1b3daf=_0x1b3daf||0x1f4;return function(_0xd31828){logger[_0x3c8d('0x2c')](_0xd31828[_0x3c8d('0x2d')]);if(_0xd31828[_0x3c8d('0x2e')]){delete _0xd31828['name'];}_0x5d9596[_0x3c8d('0x1c')](_0x1b3daf)['send'](_0xd31828);};}exports[_0x3c8d('0x2f')]=function(_0x11d7f,_0x1fd621){var _0x2c0d0a={},_0x40d36b={},_0x25e0bb={'count':0x0,'rows':[]};return db['CmCompany'][_0x3c8d('0x30')]()[_0x3c8d('0x27')](function(_0x64437e){_0x40d36b[_0x3c8d('0x31')]=_[_0x3c8d('0x32')](_0x64437e);_0x40d36b['query']=_[_0x3c8d('0x32')](_0x11d7f[_0x3c8d('0x33')]);_0x40d36b[_0x3c8d('0x34')]=_['intersection'](_0x40d36b[_0x3c8d('0x31')],_0x40d36b[_0x3c8d('0x33')]);_0x2c0d0a['attributes']=_[_0x3c8d('0x35')](_0x40d36b[_0x3c8d('0x31')],qs[_0x3c8d('0x36')](_0x11d7f[_0x3c8d('0x33')][_0x3c8d('0x36')]));_0x2c0d0a[_0x3c8d('0x37')]=_0x2c0d0a[_0x3c8d('0x37')][_0x3c8d('0x38')]?_0x2c0d0a[_0x3c8d('0x37')]:_0x40d36b[_0x3c8d('0x31')];if(!_0x11d7f['query']['hasOwnProperty']('nolimit')){_0x2c0d0a[_0x3c8d('0x22')]=qs['limit'](_0x11d7f['query'][_0x3c8d('0x22')]);_0x2c0d0a['offset']=qs[_0x3c8d('0x1f')](_0x11d7f['query'][_0x3c8d('0x1f')]);}_0x2c0d0a[_0x3c8d('0x39')]=qs[_0x3c8d('0x3a')](_0x11d7f['query'][_0x3c8d('0x3a')]);_0x2c0d0a[_0x3c8d('0x3b')]=qs['filters'](_[_0x3c8d('0x3c')](_0x11d7f['query'],_0x40d36b['filters']),_0x64437e);if(_0x11d7f[_0x3c8d('0x33')]['filter']){_0x2c0d0a[_0x3c8d('0x3b')]=_[_0x3c8d('0x3d')](_0x2c0d0a[_0x3c8d('0x3b')],{'$or':_['map'](_0x2c0d0a[_0x3c8d('0x37')],function(_0x349918){var _0x5952f5={};_0x5952f5[_0x349918]={'$like':'%'+_0x11d7f[_0x3c8d('0x33')][_0x3c8d('0x3e')]+'%'};return _0x5952f5;})});}_0x2c0d0a=_[_0x3c8d('0x3d')]({},_0x2c0d0a,_0x11d7f[_0x3c8d('0x3f')]);var _0x4ee8be={'where':_0x2c0d0a[_0x3c8d('0x3b')]};return db[_0x3c8d('0x40')]['count'](_0x4ee8be)['then'](function(_0x2a80e3){_0x25e0bb[_0x3c8d('0x21')]=_0x2a80e3;if(_0x11d7f[_0x3c8d('0x33')][_0x3c8d('0x41')]){_0x2c0d0a[_0x3c8d('0x42')]=[{'all':!![]}];}return db[_0x3c8d('0x40')]['findAll'](_0x2c0d0a);})['then'](function(_0x528018){_0x25e0bb['rows']=_0x528018;return _0x25e0bb;})['then'](respondWithFilteredResult(_0x1fd621,_0x2c0d0a))[_0x3c8d('0x43')](handleError(_0x1fd621,null));})[_0x3c8d('0x43')](handleError(_0x1fd621,null));};exports[_0x3c8d('0x44')]=function(_0x3320e7,_0x220ecb){var _0x505548={'raw':![],'where':{'id':_0x3320e7[_0x3c8d('0x45')]['id']}},_0x3f5e76={};_0x3f5e76[_0x3c8d('0x31')]=_[_0x3c8d('0x32')](db[_0x3c8d('0x40')][_0x3c8d('0x46')]);_0x3f5e76['query']=_[_0x3c8d('0x32')](_0x3320e7[_0x3c8d('0x33')]);_0x3f5e76[_0x3c8d('0x34')]=_[_0x3c8d('0x35')](_0x3f5e76[_0x3c8d('0x31')],_0x3f5e76['query']);_0x505548[_0x3c8d('0x37')]=_['intersection'](_0x3f5e76['model'],qs['fields'](_0x3320e7[_0x3c8d('0x33')][_0x3c8d('0x36')]));_0x505548[_0x3c8d('0x37')]=_0x505548[_0x3c8d('0x37')]['length']?_0x505548['attributes']:_0x3f5e76['model'];if(_0x3320e7[_0x3c8d('0x33')][_0x3c8d('0x41')]){_0x505548[_0x3c8d('0x42')]=[{'all':!![]}];}_0x505548=_['merge']({},_0x505548,_0x3320e7[_0x3c8d('0x3f')]);return db['CmCompany'][_0x3c8d('0x47')](_0x505548)['then'](handleEntityNotFound(_0x220ecb,null))[_0x3c8d('0x27')](respondWithResult(_0x220ecb,null))[_0x3c8d('0x43')](handleError(_0x220ecb,null));};exports[_0x3c8d('0x48')]=function(_0x54825b,_0x422445){return db[_0x3c8d('0x40')][_0x3c8d('0x48')](_0x54825b[_0x3c8d('0x49')],{})[_0x3c8d('0x27')](function(_0x5830a6){var _0x1305ba=_0x54825b['user'][_0x3c8d('0x29')]({'plain':!![]});if(!_0x1305ba)throw new Error(_0x3c8d('0x4a'));if(_0x1305ba[_0x3c8d('0x4b')]==='user'){var _0xde7bd1=_0x5830a6[_0x3c8d('0x29')]({'plain':!![]});var _0x460f30=_0x3c8d('0x2a');return db[_0x3c8d('0x4c')][_0x3c8d('0x47')]({'where':{'name':_0x460f30,'userProfileId':_0x1305ba[_0x3c8d('0x4d')]},'raw':!![]})[_0x3c8d('0x27')](function(_0x2a1b67){if(_0x2a1b67&&_0x2a1b67[_0x3c8d('0x4e')]===0x0){return db[_0x3c8d('0x2b')][_0x3c8d('0x48')]({'name':_0xde7bd1[_0x3c8d('0x2e')],'resourceId':_0xde7bd1['id'],'type':_0x2a1b67[_0x3c8d('0x2e')],'sectionId':_0x2a1b67['id']},{})[_0x3c8d('0x27')](function(){return _0x5830a6;});}else{return _0x5830a6;}})[_0x3c8d('0x43')](function(_0x26f45a){logger['error'](_0x3c8d('0x4f'),_0x26f45a);throw _0x26f45a;});}return _0x5830a6;})[_0x3c8d('0x27')](respondWithResult(_0x422445,0xc9))['catch'](handleError(_0x422445,null));};exports[_0x3c8d('0x26')]=function(_0x5a3897,_0x4c182f){if(_0x5a3897[_0x3c8d('0x49')]['id']){delete _0x5a3897[_0x3c8d('0x49')]['id'];}return db[_0x3c8d('0x40')][_0x3c8d('0x47')]({'where':{'id':_0x5a3897[_0x3c8d('0x45')]['id']}})[_0x3c8d('0x27')](handleEntityNotFound(_0x4c182f,null))[_0x3c8d('0x27')](saveUpdates(_0x5a3897['body'],null))['then'](respondWithResult(_0x4c182f,null))[_0x3c8d('0x43')](handleError(_0x4c182f,null));};exports[_0x3c8d('0x28')]=function(_0x303bbc,_0x5d8c95){return db['CmCompany'][_0x3c8d('0x47')]({'where':{'id':_0x303bbc[_0x3c8d('0x45')]['id']}})[_0x3c8d('0x27')](handleEntityNotFound(_0x5d8c95,null))[_0x3c8d('0x27')](removeEntity(_0x5d8c95,null))[_0x3c8d('0x43')](handleError(_0x5d8c95,null));};exports[_0x3c8d('0x30')]=function(_0x1df4f2,_0x5764f9){return db[_0x3c8d('0x40')][_0x3c8d('0x30')]()[_0x3c8d('0x27')](respondWithResult(_0x5764f9,null))['catch'](handleError(_0x5764f9,null));};exports[_0x3c8d('0x50')]=function(_0x3e3318,_0xf84863,_0x4ea1ec){return db[_0x3c8d('0x51')]['find']({'where':{'id':_0x3e3318[_0x3c8d('0x45')]['id']}})[_0x3c8d('0x27')](handleEntityNotFound(_0xf84863,null))[_0x3c8d('0x27')](function(_0x1b8fbc){if(_0x1b8fbc){return _0x1b8fbc[_0x3c8d('0x50')](_0x3e3318[_0x3c8d('0x49')]['ids'],_[_0x3c8d('0x52')](_0x3e3318[_0x3c8d('0x49')],[_0x3c8d('0x53'),'id'])||{});}})[_0x3c8d('0x27')](respondWithResult(_0xf84863,null))[_0x3c8d('0x43')](handleError(_0xf84863,null));};exports['getContacts']=function(_0x5e80c9,_0xefad3c,_0x523645){var _0x3f8479={};var _0x171cb4={};var _0x2429cf;var _0x3d8fa2;return db[_0x3c8d('0x40')][_0x3c8d('0x54')]({'where':{'id':_0x5e80c9[_0x3c8d('0x45')]['id']}})[_0x3c8d('0x27')](handleEntityNotFound(_0xefad3c,null))[_0x3c8d('0x27')](function(_0x297b26){if(_0x297b26){_0x2429cf=_0x297b26;_0x171cb4['model']=_[_0x3c8d('0x32')](db[_0x3c8d('0x51')][_0x3c8d('0x46')]);_0x171cb4['query']=_[_0x3c8d('0x32')](_0x5e80c9[_0x3c8d('0x33')]);_0x171cb4['filters']=_['intersection'](_0x171cb4[_0x3c8d('0x31')],_0x171cb4['query']);_0x3f8479[_0x3c8d('0x37')]=_[_0x3c8d('0x35')](_0x171cb4['model'],qs[_0x3c8d('0x36')](_0x5e80c9[_0x3c8d('0x33')][_0x3c8d('0x36')]));_0x3f8479[_0x3c8d('0x37')]=_0x3f8479[_0x3c8d('0x37')]['length']?_0x3f8479[_0x3c8d('0x37')]:_0x171cb4[_0x3c8d('0x31')];_0x3f8479[_0x3c8d('0x39')]=qs[_0x3c8d('0x3a')](_0x5e80c9['query'][_0x3c8d('0x3a')]);_0x3f8479[_0x3c8d('0x3b')]=qs['filters'](_['pick'](_0x5e80c9[_0x3c8d('0x33')],_0x171cb4[_0x3c8d('0x34')]));if(_0x5e80c9[_0x3c8d('0x33')][_0x3c8d('0x3e')]){_0x3f8479[_0x3c8d('0x3b')]=_[_0x3c8d('0x3d')](_0x3f8479[_0x3c8d('0x3b')],{'$or':_[_0x3c8d('0x55')](_0x3f8479[_0x3c8d('0x37')],function(_0x2abc8f){var _0x27f5b8={};_0x27f5b8[_0x2abc8f]={'$like':'%'+_0x5e80c9['query']['filter']+'%'};return _0x27f5b8;})});}_0x3f8479=_[_0x3c8d('0x3d')]({},_0x3f8479,_0x5e80c9[_0x3c8d('0x3f')]);return _0x2429cf[_0x3c8d('0x56')](_0x3f8479);}})[_0x3c8d('0x27')](function(_0x1c90fa){if(_0x1c90fa){_0x3d8fa2=_0x1c90fa[_0x3c8d('0x38')];if(!_0x5e80c9[_0x3c8d('0x33')][_0x3c8d('0x57')](_0x3c8d('0x58'))){_0x3f8479['limit']=qs[_0x3c8d('0x22')](_0x5e80c9[_0x3c8d('0x33')]['limit']);_0x3f8479[_0x3c8d('0x1f')]=qs[_0x3c8d('0x1f')](_0x5e80c9[_0x3c8d('0x33')]['offset']);}return _0x2429cf[_0x3c8d('0x56')](_0x3f8479);}})[_0x3c8d('0x27')](function(_0x5cb35e){if(_0x5cb35e){return _0x5cb35e?{'count':_0x3d8fa2,'rows':_0x5cb35e}:null;}})[_0x3c8d('0x27')](respondWithResult(_0xefad3c,null))['catch'](handleError(_0xefad3c,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index c8f2851..4f30470 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 _0x338d=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','CmCompany','cm_companies','util','../../config/logger','api'];(function(_0x3e5ba5,_0x28e9cd){var _0x4ab4d8=function(_0x24ab01){while(--_0x24ab01){_0x3e5ba5['push'](_0x3e5ba5['shift']());}};_0x4ab4d8(++_0x28e9cd);}(_0x338d,0x75));var _0xd338=function(_0x3eb6ae,_0x489080){_0x3eb6ae=_0x3eb6ae-0x0;var _0x5d8c49=_0x338d[_0x3eb6ae];return _0x5d8c49;};'use strict';var _=require('lodash');var util=require(_0xd338('0x0'));var logger=require(_0xd338('0x1'))(_0xd338('0x2'));var moment=require(_0xd338('0x3'));var BPromise=require(_0xd338('0x4'));var rp=require(_0xd338('0x5'));var fs=require('fs');var path=require(_0xd338('0x6'));var rimraf=require(_0xd338('0x7'));var config=require(_0xd338('0x8'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x2ce553,_0x48f73b){return _0x2ce553[_0xd338('0x9')](_0xd338('0xa'),attributes,{'tableName':_0xd338('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9879=['cm_companies','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./cmCompany.attributes','exports','define'];(function(_0xca2360,_0x5d7eb2){var _0xa8b24b=function(_0x5b5381){while(--_0x5b5381){_0xca2360['push'](_0xca2360['shift']());}};_0xa8b24b(++_0x5d7eb2);}(_0x9879,0xa6));var _0x9987=function(_0xcd3673,_0x327208){_0xcd3673=_0xcd3673-0x0;var _0x22a7c4=_0x9879[_0xcd3673];return _0x22a7c4;};'use strict';var _=require('lodash');var util=require(_0x9987('0x0'));var logger=require(_0x9987('0x1'))(_0x9987('0x2'));var moment=require(_0x9987('0x3'));var BPromise=require(_0x9987('0x4'));var rp=require(_0x9987('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9987('0x6'));var attributes=require(_0x9987('0x7'));module[_0x9987('0x8')]=function(_0x1a7b0f,_0x11cfa0){return _0x1a7b0f[_0x9987('0x9')]('CmCompany',attributes,{'tableName':_0x9987('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 7934369..8621609 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 _0xa81f=['lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','info','catch'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xa81f,0x11d));var _0xfa81=function(_0x513d80,_0x1649db){_0x513d80=_0x513d80-0x0;var _0x174463=_0xa81f[_0x513d80];return _0x174463;};'use strict';var _=require(_0xfa81('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfa81('0x1'));var rs=require(_0xfa81('0x2'));var fs=require('fs');var Redis=require(_0xfa81('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfa81('0x4'));var logger=require(_0xfa81('0x5'))('rpc');var config=require(_0xfa81('0x6'));var jayson=require(_0xfa81('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x491d68,_0x59cb88,_0xd0e61a){return new BPromise(function(_0x53388c,_0x5b5423){return client['request'](_0x491d68,_0xd0e61a)[_0xfa81('0x8')](function(_0x1bc368){logger['info']('CmCompany,\x20%s,\x20%s',_0x59cb88,_0xfa81('0x9'));logger[_0xfa81('0xa')](_0xfa81('0xb'),_0x59cb88,_0xfa81('0x9'),JSON[_0xfa81('0xc')](_0x1bc368));if(_0x1bc368[_0xfa81('0xd')]){if(_0x1bc368[_0xfa81('0xd')][_0xfa81('0xe')]===0x1f4){logger[_0xfa81('0xd')](_0xfa81('0xf'),_0x59cb88,_0x1bc368[_0xfa81('0xd')][_0xfa81('0x10')]);return _0x5b5423(_0x1bc368['error']['message']);}logger[_0xfa81('0xd')](_0xfa81('0xf'),_0x59cb88,_0x1bc368[_0xfa81('0xd')][_0xfa81('0x10')]);return _0x53388c(_0x1bc368[_0xfa81('0xd')][_0xfa81('0x10')]);}else{logger[_0xfa81('0x11')](_0xfa81('0xf'),_0x59cb88,'request\x20sent');_0x53388c(_0x1bc368['result']['message']);}})[_0xfa81('0x12')](function(_0x1e3047){logger['error'](_0xfa81('0xf'),_0x59cb88,_0x1e3047);_0x5b5423(_0x1e3047);});});} \ No newline at end of file +var _0xe109=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x55e6db,_0x102cbc){var _0x18f2b1=function(_0x29cbd8){while(--_0x29cbd8){_0x55e6db['push'](_0x55e6db['shift']());}};_0x18f2b1(++_0x102cbc);}(_0xe109,0x16b));var _0x9e10=function(_0x102363,_0x158232){_0x102363=_0x102363-0x0;var _0x59c3ed=_0xe109[_0x102363];return _0x59c3ed;};'use strict';var _=require(_0x9e10('0x0'));var util=require(_0x9e10('0x1'));var moment=require(_0x9e10('0x2'));var BPromise=require('bluebird');var rs=require(_0x9e10('0x3'));var fs=require('fs');var Redis=require(_0x9e10('0x4'));var db=require(_0x9e10('0x5'))['db'];var utils=require(_0x9e10('0x6'));var logger=require(_0x9e10('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9e10('0x8'));var client=jayson['client'][_0x9e10('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x286e0f,_0x3453eb,_0x2e0462){return new BPromise(function(_0xd9c360,_0x36ba54){return client['request'](_0x286e0f,_0x2e0462)['then'](function(_0x3ba882){logger[_0x9e10('0xa')](_0x9e10('0xb'),_0x3453eb,_0x9e10('0xc'));logger[_0x9e10('0xd')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x3453eb,'request\x20sent',JSON[_0x9e10('0xe')](_0x3ba882));if(_0x3ba882[_0x9e10('0xf')]){if(_0x3ba882['error'][_0x9e10('0x10')]===0x1f4){logger[_0x9e10('0xf')](_0x9e10('0xb'),_0x3453eb,_0x3ba882[_0x9e10('0xf')]['message']);return _0x36ba54(_0x3ba882[_0x9e10('0xf')][_0x9e10('0x11')]);}logger[_0x9e10('0xf')](_0x9e10('0xb'),_0x3453eb,_0x3ba882[_0x9e10('0xf')]['message']);return _0xd9c360(_0x3ba882[_0x9e10('0xf')]['message']);}else{logger['info'](_0x9e10('0xb'),_0x3453eb,_0x9e10('0xc'));_0xd9c360(_0x3ba882[_0x9e10('0x12')][_0x9e10('0x11')]);}})[_0x9e10('0x13')](function(_0x5db0ea){logger[_0x9e10('0xf')](_0x9e10('0xb'),_0x3453eb,_0x5db0ea);_0x36ba54(_0x5db0ea);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index bf2bb5d..cf0b286 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 _0xfdcd=['/:id','destroy','exports','connect-timeout','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/contacts','getContacts','post','create','addContacts','put','update'];(function(_0x1e6399,_0x50b8fb){var _0x211c25=function(_0x27481a){while(--_0x27481a){_0x1e6399['push'](_0x1e6399['shift']());}};_0x211c25(++_0x50b8fb);}(_0xfdcd,0x75));var _0xdfdc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfdcd[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xdfdc('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdfdc('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0xdfdc('0x2'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0xdfdc('0x3')]('/',auth[_0xdfdc('0x4')](),controller[_0xdfdc('0x5')]);router[_0xdfdc('0x3')](_0xdfdc('0x6'),auth[_0xdfdc('0x4')](),controller[_0xdfdc('0x7')]);router[_0xdfdc('0x3')]('/:id',auth[_0xdfdc('0x4')](),controller[_0xdfdc('0x8')]);router[_0xdfdc('0x3')](_0xdfdc('0x9'),auth[_0xdfdc('0x4')](),controller[_0xdfdc('0xa')]);router[_0xdfdc('0xb')]('/',auth[_0xdfdc('0x4')](),controller[_0xdfdc('0xc')]);router[_0xdfdc('0xb')](_0xdfdc('0x9'),auth[_0xdfdc('0x4')](),controller[_0xdfdc('0xd')]);router[_0xdfdc('0xe')]('/:id',auth[_0xdfdc('0x4')](),controller[_0xdfdc('0xf')]);router['delete'](_0xdfdc('0x10'),auth[_0xdfdc('0x4')](),controller[_0xdfdc('0x11')]);module[_0xdfdc('0x12')]=router; \ No newline at end of file +var _0x36d2=['express','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','index','/describe','/:id','isAuthenticated','show','/:id/contacts','getContacts','create','post','addContacts','put','delete','exports','util','connect-timeout'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x36d2,0x1b7));var _0x236d=function(_0x2cfb48,_0x24b83b){_0x2cfb48=_0x2cfb48-0x0;var _0xc4594f=_0x36d2[_0x2cfb48];return _0xc4594f;};'use strict';var multer=require('multer');var util=require(_0x236d('0x0'));var path=require('path');var timeout=require(_0x236d('0x1'));var express=require(_0x236d('0x2'));var router=express['Router']();var fs_extra=require(_0x236d('0x3'));var auth=require(_0x236d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x236d('0x5'));var controller=require(_0x236d('0x6'));router[_0x236d('0x7')]('/',auth['isAuthenticated'](),controller[_0x236d('0x8')]);router[_0x236d('0x7')](_0x236d('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x236d('0xa'),auth[_0x236d('0xb')](),controller[_0x236d('0xc')]);router[_0x236d('0x7')](_0x236d('0xd'),auth[_0x236d('0xb')](),controller[_0x236d('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x236d('0xf')]);router[_0x236d('0x10')](_0x236d('0xd'),auth[_0x236d('0xb')](),controller[_0x236d('0x11')]);router[_0x236d('0x12')](_0x236d('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x236d('0x13')](_0x236d('0xa'),auth[_0x236d('0xb')](),controller['destroy']);module[_0x236d('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index cb90f9a..55c2448 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 _0x7045=['UNSIGNED','DATE','NOW','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x1d9533,_0x382651){var _0x5c61d6=function(_0x28a106){while(--_0x28a106){_0x1d9533['push'](_0x1d9533['shift']());}};_0x5c61d6(++_0x382651);}(_0x7045,0xbb));var _0x5704=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7045[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var Sequelize=require(_0x5704('0x0'));module[_0x5704('0x1')]={'firstName':{'type':Sequelize[_0x5704('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x5704('0x2')]},'postalCode':{'type':Sequelize[_0x5704('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x5704('0x2')]},'dateOfBirth':{'type':Sequelize[_0x5704('0x2')]},'description':{'type':Sequelize[_0x5704('0x3')]},'phone':{'type':Sequelize[_0x5704('0x2')]},'mobile':{'type':Sequelize[_0x5704('0x2')]},'fax':{'type':Sequelize[_0x5704('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x5704('0x2')]},'facebook':{'type':Sequelize[_0x5704('0x2')]},'fb_data':{'type':Sequelize[_0x5704('0x2')]},'twitter':{'type':Sequelize[_0x5704('0x2')]},'skype':{'type':Sequelize[_0x5704('0x2')]},'teams':{'type':Sequelize[_0x5704('0x2')]},'viber':{'type':Sequelize[_0x5704('0x2')]},'line':{'type':Sequelize[_0x5704('0x2')]},'wechat':{'type':Sequelize[_0x5704('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x5704('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x5704('0x2')]},'priority':{'type':Sequelize[_0x5704('0x4')](0x2)[_0x5704('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x5704('0x6')],'defaultValue':Sequelize[_0x5704('0x7')]},'dialTimezone':{'type':Sequelize[_0x5704('0x2')]},'utcOffset':{'type':Sequelize[_0x5704('0x4')]}}; \ No newline at end of file +var _0x3b91=['INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x6eb833,_0x2bb5e5){var _0xdfc38c=function(_0x13c4a4){while(--_0x13c4a4){_0x6eb833['push'](_0x6eb833['shift']());}};_0xdfc38c(++_0x2bb5e5);}(_0x3b91,0x15a));var _0x13b9=function(_0x475004,_0x33de48){_0x475004=_0x475004-0x0;var _0x2f16fd=_0x3b91[_0x475004];return _0x2f16fd;};'use strict';var _=require(_0x13b9('0x0'));var Sequelize=require(_0x13b9('0x1'));module[_0x13b9('0x2')]={'firstName':{'type':Sequelize[_0x13b9('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x13b9('0x3')]},'street':{'type':Sequelize[_0x13b9('0x3')]},'postalCode':{'type':Sequelize[_0x13b9('0x3')]},'city':{'type':Sequelize[_0x13b9('0x3')]},'country':{'type':Sequelize[_0x13b9('0x3')]},'dateOfBirth':{'type':Sequelize[_0x13b9('0x3')]},'description':{'type':Sequelize[_0x13b9('0x4')]},'phone':{'type':Sequelize[_0x13b9('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x13b9('0x3')]},'email':{'type':Sequelize[_0x13b9('0x3')]},'url':{'type':Sequelize[_0x13b9('0x3')]},'facebook':{'type':Sequelize[_0x13b9('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x13b9('0x3')]},'skype':{'type':Sequelize[_0x13b9('0x3')]},'teams':{'type':Sequelize[_0x13b9('0x3')]},'viber':{'type':Sequelize[_0x13b9('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x13b9('0x3')]},'UserId':{'type':Sequelize[_0x13b9('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x13b9('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x13b9('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x13b9('0x7')],'defaultValue':Sequelize[_0x13b9('0x8')]},'dialTimezone':{'type':Sequelize[_0x13b9('0x3')]},'utcOffset':{'type':Sequelize[_0x13b9('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 99e97a8..09d8f57 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 _0x5ffd=['0777','child_process','../../components/import/cm/csv','binding_keys','File\x20uploaded\x20correctly!','upload','createReadStream','path','parse','meta','agent','No\x20ListId\x20specified','binding','fork','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20createdAt\x20filter','uniqueid','source','destination','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','DESC','findAndCountAll','fullname','Website','closed','closedAt','disposition','secondDisposition','thirdDisposition','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','referer','subject','substatus','externalUrl','threadId','Interaction','Owner','sortBy','reverse','value','slice','moment','bluebird','util','lodash','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','./cmContact.socket','register','status','json','offset','undefined','limit','count','update','then','destroy','end','error','stack','name','send','getOptions','findAll','query','catch','CmContact','find','params','describe','tags','keys','length','startsWith','cf_','columnName','displayName','analytics','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','get','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappQueueReport','isNil','timezones','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','findOrCreate','contact','all','show','Tag','Tags','color','Phones','ContactItemType','sequelize','literal','Phones.OrderBy','$and','CmCustomField','omit','map','format','cf_%d','dialTimezone','utcOffset','isEmpty','table','setFields','id\x20=\x20?','toParam','phone','findOne','filters','intersection','model','attributes','order','sort','pick','filter','options','getTags','nolimit','setTags','ids','OrderBy','item_types','items','ItemTypeId','description','contact\x20phone\x20exists','PHONE','item','ItemType','CmHopperId','getAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','rawAttributes','fields','ContactId','includeAll','include','rows','getHopperHistories','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync'];(function(_0x1ef5bb,_0x1f6f91){var _0x1083eb=function(_0x3c8975){while(--_0x3c8975){_0x1ef5bb['push'](_0x1ef5bb['shift']());}};_0x1083eb(++_0x1f6f91);}(_0x5ffd,0x14e));var _0xd5ff=function(_0x2b7389,_0x95488d){_0x2b7389=_0x2b7389-0x0;var _0x25538c=_0x5ffd[_0x2b7389];return _0x25538c;};'use strict';var moment=require(_0xd5ff('0x0'));var BPromise=require(_0xd5ff('0x1'));var util=require(_0xd5ff('0x2'));var path=require('path');var fs=require('fs');var _=require(_0xd5ff('0x3'));var squel=require('squel');var Papa=require(_0xd5ff('0x4'));var Redis=require(_0xd5ff('0x5'));var contacts=require(_0xd5ff('0x6'));var qs=require(_0xd5ff('0x7'));var logger=require(_0xd5ff('0x8'))(_0xd5ff('0x9'));var config=require(_0xd5ff('0xa'));var shared=require(_0xd5ff('0xb'));var db=require(_0xd5ff('0xc'))['db'];config[_0xd5ff('0xd')]=_[_0xd5ff('0xe')](config[_0xd5ff('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd5ff('0xd')]));require(_0xd5ff('0xf'))[_0xd5ff('0x10')](socket);function respondWithResult(_0x4736db,_0x250642){_0x250642=_0x250642||0xc8;return function(_0x3f0589){if(_0x3f0589){return _0x4736db[_0xd5ff('0x11')](_0x250642)[_0xd5ff('0x12')](_0x3f0589);}};}function respondWithFilteredResult(_0x13b0eb,_0x687b0a){return function(_0x3f27a1){if(_0x3f27a1){var _0x3fdecb=typeof _0x687b0a[_0xd5ff('0x13')]===_0xd5ff('0x14')&&typeof _0x687b0a[_0xd5ff('0x15')]===_0xd5ff('0x14');var _0x144896=_0x3f27a1['count'];var _0x5d9f54=_0x3fdecb?0x0:_0x687b0a[_0xd5ff('0x13')];var _0x4a9f75=_0x3fdecb?_0x3f27a1[_0xd5ff('0x16')]:_0x687b0a[_0xd5ff('0x13')]+_0x687b0a[_0xd5ff('0x15')];var _0x5b00c7;if(_0x4a9f75>=_0x144896){_0x4a9f75=_0x144896;_0x5b00c7=0xc8;}else{_0x5b00c7=0xce;}_0x13b0eb['status'](_0x5b00c7);return _0x13b0eb['set']('Content-Range',_0x5d9f54+'-'+_0x4a9f75+'/'+_0x144896)[_0xd5ff('0x12')](_0x3f27a1);}return null;};}function saveUpdates(_0x3c20cb){return function(_0x1ef2ec){if(_0x1ef2ec){return _0x1ef2ec[_0xd5ff('0x17')](_0x3c20cb)[_0xd5ff('0x18')](function(_0x38713f){return _0x38713f;});}return null;};}function removeEntity(_0x2ac059){return function(_0x554dd5){if(_0x554dd5){return _0x554dd5[_0xd5ff('0x19')]()[_0xd5ff('0x18')](function(){_0x2ac059[_0xd5ff('0x11')](0xcc)[_0xd5ff('0x1a')]();});}};}function handleEntityNotFound(_0x33a6b6){return function(_0x1ede39){if(!_0x1ede39){_0x33a6b6['sendStatus'](0x194);}return _0x1ede39;};}function handleError(_0x3d19c2,_0x42b007){_0x42b007=_0x42b007||0x1f4;return function(_0x3fdd73){logger[_0xd5ff('0x1b')](_0x3fdd73[_0xd5ff('0x1c')]);if(_0x3fdd73[_0xd5ff('0x1d')]){delete _0x3fdd73[_0xd5ff('0x1d')];}_0x3d19c2[_0xd5ff('0x11')](_0x42b007)[_0xd5ff('0x1e')](_0x3fdd73);};}exports['index']=function(_0x1b50ac,_0x12dafa){var _0x491971={};return contacts['describe']()['then'](function(_0x48fb93){_0x491971=qs[_0xd5ff('0x1f')](_0x48fb93,_0x1b50ac);return contacts[_0xd5ff('0x20')](_0x1b50ac[_0xd5ff('0x21')],_0x1b50ac['user'],_0x491971,_0x48fb93);})[_0xd5ff('0x18')](respondWithFilteredResult(_0x12dafa,_0x491971))[_0xd5ff('0x22')](handleError(_0x12dafa,null));};exports['destroy']=function(_0x6d86fc,_0x5b9bea){return db[_0xd5ff('0x23')][_0xd5ff('0x24')]({'where':{'id':_0x6d86fc[_0xd5ff('0x25')]['id']}})[_0xd5ff('0x18')](handleEntityNotFound(_0x5b9bea,null))[_0xd5ff('0x18')](removeEntity(_0x5b9bea,null))[_0xd5ff('0x22')](handleError(_0x5b9bea,null));};exports[_0xd5ff('0x26')]=function(_0x72be08,_0x20da62){return db[_0xd5ff('0x23')][_0xd5ff('0x26')]()[_0xd5ff('0x18')](function(_0x4f675d){delete _0x4f675d[_0xd5ff('0x27')];for(var _0x2d64b6=0x0;_0x2d64b60x0){return new Promise(function(_0x151e6d){var _0x49c151=[];for(var _0x14f14e=0x0;_0x14f14e<_0x3893a0[_0xd5ff('0x29')];_0x14f14e++){_0x49c151['push'](insertAdditionalPhones(_0x3893a0[_0x14f14e][_0xd5ff('0x62')],_0x3893a0[_0x14f14e][_0xd5ff('0x59')]));}Promise[_0xd5ff('0x63')](_0x49c151)[_0xd5ff('0x18')](function(){_0x151e6d(0x1);});})[_0xd5ff('0x18')](function(){return{'success':_0x4c1a66,'failure':_0x256cc0,'duplicates':_0x4349e6};});}else{return{'success':_0x4c1a66,'failure':_0x256cc0,'duplicates':_0x4349e6};}}})[_0xd5ff('0x18')](respondWithResult(_0x200b52,0xc9))[_0xd5ff('0x22')](handleError(_0x200b52,null));};exports[_0xd5ff('0x64')]=function(_0x1d135d,_0x3fea49){var _0x424f6c;return db['CmContact'][_0xd5ff('0x26')]()['then'](function(_0x12e9d8){return db[_0xd5ff('0x23')][_0xd5ff('0x24')]({'where':{'id':_0x1d135d['params']['id']},'include':[{'model':db[_0xd5ff('0x65')],'as':_0xd5ff('0x66'),'attributes':['id','name',_0xd5ff('0x67')],'required':_0x1d135d['query']['tag']?!![]:![]},{'model':db[_0xd5ff('0x4a')],'as':_0xd5ff('0x68'),'where':{'CmContactId':_0x1d135d[_0xd5ff('0x25')]['id']},'required':![],'include':[{'model':db[_0xd5ff('0x69')],'as':'ItemType'}]}],'order':[db[_0xd5ff('0x6a')][_0xd5ff('0x6b')](_0xd5ff('0x6c'))],'attributes':_['keys'](_0x12e9d8)});})[_0xd5ff('0x18')](function(_0x4e5b8d){if(!_[_0xd5ff('0x57')](_0x4e5b8d)){_0x424f6c=_0x4e5b8d[_0xd5ff('0x39')]({'plain':!![]});var _0x5ee5a1={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4e5b8d&&_0x4e5b8d[_0xd5ff('0x60')]){if(_0x4e5b8d[_0xd5ff('0x60')]){_0x5ee5a1[_0xd5ff('0x5d')][_0xd5ff('0x6d')]['push']({'ListId':{'$ne':_0x4e5b8d[_0xd5ff('0x60')]}});}}return db[_0xd5ff('0x6e')][_0xd5ff('0x20')](_0x5ee5a1);}})[_0xd5ff('0x18')](function(_0x340eb8){if(!_[_0xd5ff('0x57')](_0x340eb8)){return _[_0xd5ff('0x6f')](_0x424f6c,_[_0xd5ff('0x70')](_0x340eb8,function(_0x40d9d6){return util[_0xd5ff('0x71')](_0xd5ff('0x72'),_0x40d9d6['id']);}));}})[_0xd5ff('0x18')](handleEntityNotFound(_0x3fea49,null))[_0xd5ff('0x18')](respondWithResult(_0x3fea49,null))['catch'](handleError(_0x3fea49,null));};exports[_0xd5ff('0x17')]=function(_0x15612d,_0x171919){var _0x563af1;if(_0x15612d[_0xd5ff('0x38')]['id']){delete _0x15612d[_0xd5ff('0x38')]['id'];}if(!_['isNil'](_0x15612d['body'][_0xd5ff('0x73')])){var _0x26a2c7=_0x15612d[_0xd5ff('0x38')][_0xd5ff('0x73')];if(!_[_0xd5ff('0x57')](shared[_0xd5ff('0x58')][_0x26a2c7]))_0x15612d['body'][_0xd5ff('0x74')]=shared['timezones'][_0x26a2c7][_0xd5ff('0x74')];}return db[_0xd5ff('0x23')][_0xd5ff('0x24')]({'where':{'id':_0x15612d[_0xd5ff('0x25')]['id']}})['then'](handleEntityNotFound(_0x171919,null))['then'](saveUpdates(_0x15612d['body'],null))[_0xd5ff('0x18')](function(_0x2050f2){_0x563af1=_0x2050f2;var _0x313f99={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2050f2&&_0x2050f2[_0xd5ff('0x60')]){if(_0x2050f2[_0xd5ff('0x60')]){_0x313f99[_0xd5ff('0x5d')][_0xd5ff('0x6d')][_0xd5ff('0x5f')]({'ListId':{'$ne':_0x2050f2[_0xd5ff('0x60')]}});}}return db[_0xd5ff('0x6e')][_0xd5ff('0x20')](_0x313f99);})[_0xd5ff('0x18')](function(_0x40a3f6){if(_0x40a3f6){return _[_0xd5ff('0x6f')](_['pickBy'](_0x15612d[_0xd5ff('0x38')],function(_0xad89a0,_0x3ae2f2){return _[_0xd5ff('0x2a')](_0x3ae2f2,'cf_');}),_['map'](_0x40a3f6,function(_0x697a93){return util[_0xd5ff('0x71')]('cf_%d',_0x697a93['id']);}));}})[_0xd5ff('0x18')](function(_0x4d23c0){if(_0x4d23c0&&!_[_0xd5ff('0x75')](_0x4d23c0)){var _0x22c766=squel[_0xd5ff('0x17')]()[_0xd5ff('0x76')]('cm_contacts')[_0xd5ff('0x77')](_0x4d23c0)[_0xd5ff('0x5d')](_0xd5ff('0x78'),_0x15612d[_0xd5ff('0x25')]['id'])[_0xd5ff('0x79')]();return db[_0xd5ff('0x6a')][_0xd5ff('0x21')](_0x22c766['text'],{'replacements':_0x22c766[_0xd5ff('0x32')]});}})[_0xd5ff('0x18')](function(){if(_0x15612d[_0xd5ff('0x38')][_0xd5ff('0x7a')]&&_0x563af1){return db[_0xd5ff('0x3e')]['update']({'phone':_0x15612d['body'][_0xd5ff('0x7a')],'OrderBy':0x0},{'where':{'ContactId':_0x563af1['id']}});}})[_0xd5ff('0x18')](function(){return _0x563af1;})['then'](respondWithResult(_0x171919,null))[_0xd5ff('0x22')](handleError(_0x171919,null));};exports['getTags']=function(_0x28328a,_0x57bf4e){var _0x448cfc={};var _0x374c5e={};var _0xbf5398;var _0x4c4e81;return db[_0xd5ff('0x23')][_0xd5ff('0x7b')]({'where':{'id':_0x28328a[_0xd5ff('0x25')]['id']}})[_0xd5ff('0x18')](handleEntityNotFound(_0x57bf4e,null))[_0xd5ff('0x18')](function(_0x1e0a82){if(_0x1e0a82){_0xbf5398=_0x1e0a82;_0x374c5e['model']=_[_0xd5ff('0x28')](db[_0xd5ff('0x65')]['rawAttributes']);_0x374c5e[_0xd5ff('0x21')]=_[_0xd5ff('0x28')](_0x28328a['query']);_0x374c5e[_0xd5ff('0x7c')]=_[_0xd5ff('0x7d')](_0x374c5e[_0xd5ff('0x7e')],_0x374c5e[_0xd5ff('0x21')]);_0x448cfc[_0xd5ff('0x7f')]=_[_0xd5ff('0x7d')](_0x374c5e[_0xd5ff('0x7e')],qs['fields'](_0x28328a[_0xd5ff('0x21')]['fields']));_0x448cfc['attributes']=_0x448cfc[_0xd5ff('0x7f')]['length']?_0x448cfc[_0xd5ff('0x7f')]:_0x374c5e[_0xd5ff('0x7e')];_0x448cfc[_0xd5ff('0x80')]=qs[_0xd5ff('0x81')](_0x28328a[_0xd5ff('0x21')][_0xd5ff('0x81')]);_0x448cfc[_0xd5ff('0x5d')]=qs[_0xd5ff('0x7c')](_[_0xd5ff('0x82')](_0x28328a[_0xd5ff('0x21')],_0x374c5e[_0xd5ff('0x7c')]));if(_0x28328a[_0xd5ff('0x21')][_0xd5ff('0x83')]){_0x448cfc[_0xd5ff('0x5d')]=_['merge'](_0x448cfc[_0xd5ff('0x5d')],{'$or':_['map'](_0x448cfc['attributes'],function(_0x10e7aa){var _0x44afe1={};_0x44afe1[_0x10e7aa]={'$like':'%'+_0x28328a['query'][_0xd5ff('0x83')]+'%'};return _0x44afe1;})});}_0x448cfc=_[_0xd5ff('0x37')]({},_0x448cfc,_0x28328a[_0xd5ff('0x84')]);return _0xbf5398[_0xd5ff('0x85')](_0x448cfc);}})[_0xd5ff('0x18')](function(_0x32caa2){if(_0x32caa2){_0x4c4e81=_0x32caa2['length'];if(!_0x28328a[_0xd5ff('0x21')]['hasOwnProperty'](_0xd5ff('0x86'))){_0x448cfc['limit']=qs[_0xd5ff('0x15')](_0x28328a[_0xd5ff('0x21')]['limit']);_0x448cfc[_0xd5ff('0x13')]=qs[_0xd5ff('0x13')](_0x28328a[_0xd5ff('0x21')][_0xd5ff('0x13')]);}return _0xbf5398[_0xd5ff('0x85')](_0x448cfc);}})[_0xd5ff('0x18')](function(_0xf55011){if(_0xf55011){return _0xf55011?{'count':_0x4c4e81,'rows':_0xf55011}:null;}})['then'](respondWithResult(_0x57bf4e,null))[_0xd5ff('0x22')](handleError(_0x57bf4e,null));};exports[_0xd5ff('0x87')]=function(_0x42ebf3,_0x3ecfcd){if(_0x42ebf3[_0xd5ff('0x38')]['id']){delete _0x42ebf3[_0xd5ff('0x38')]['id'];}return db[_0xd5ff('0x23')][_0xd5ff('0x7b')]({'where':{'id':_0x42ebf3['params']['id']}})[_0xd5ff('0x18')](handleEntityNotFound(_0x3ecfcd,null))[_0xd5ff('0x18')](function(_0x55573a){if(_0x55573a){return _0x55573a[_0xd5ff('0x87')](_0x42ebf3['body'][_0xd5ff('0x88')]||[]);}return null;})['then'](respondWithResult(_0x3ecfcd,null))[_0xd5ff('0x22')](handleError(_0x3ecfcd,null));};exports['setAdditionalPhones']=function(_0x12f65c,_0x2f0031){var _0x370c61=[];_0x370c61['push'](addAdditionalPhones(_0x12f65c[_0xd5ff('0x38')]));Promise['all'](_0x370c61)['then'](function(){_0x370c61=[];_0x370c61[_0xd5ff('0x5f')](deleteCmHopperPhones(_0x12f65c[_0xd5ff('0x38')]['id']));_0x370c61[_0xd5ff('0x5f')](addCmHopperPhones(_0x12f65c[_0xd5ff('0x38')]['id']));Promise[_0xd5ff('0x63')](_0x370c61)['then'](function(){return[0x1];})[_0xd5ff('0x18')](respondWithResult(_0x2f0031,null));});};function addAdditionalPhones(_0x283cd6){var _0x5a8028;return new Promise(function(_0x57411f){return db[_0xd5ff('0x4a')]['destroy']({'where':{'CmContactId':_0x283cd6['id']}})['then'](function(){db['ContactItemType'][_0xd5ff('0x20')]({'raw':!![],'attributes':['id',_0xd5ff('0x89')]})['then'](function(_0xdefc43){var _0x42ead6=[];for(var _0x5a6c4d=0x0;_0x5a6c4d<_0x283cd6['items'][_0xd5ff('0x29')];_0x5a6c4d++){var _0x1ee5d5=_0x283cd6['item_types']?_[_0xd5ff('0x57')](_0x283cd6[_0xd5ff('0x8a')][_0x5a6c4d])?'':_0x283cd6[_0xd5ff('0x8a')][_0x5a6c4d]:_0x283cd6[_0xd5ff('0x8b')][_0x5a6c4d][_0xd5ff('0x8c')]?_0x283cd6[_0xd5ff('0x8b')][_0x5a6c4d][_0xd5ff('0x8c')]:'';var _0xb63b44=_['isNil'](_0x283cd6[_0xd5ff('0x8b')][_0x5a6c4d][_0xd5ff('0x8d')])?'':_0x283cd6['items'][_0x5a6c4d][_0xd5ff('0x8d')];var _0x31286b=_0x1ee5d5+':'+_0x283cd6[_0xd5ff('0x8b')][_0x5a6c4d][_0xd5ff('0x7a')]+'§'+_0xb63b44;if(_['isNil'](_0x5a8028))_0x5a8028=_0x31286b;else _0x5a8028+=';'+_0x31286b;var _0x4f9029=null;var _0x24319e=null;if(_0x283cd6[_0xd5ff('0x8a')]){if(!_[_0xd5ff('0x57')](_0x283cd6['item_types'][_0x5a6c4d])){_0x24319e=_[_0xd5ff('0x24')](_0xdefc43,function(_0x183b80){return _0x183b80['id']===_0x283cd6[_0xd5ff('0x8a')][_0x5a6c4d];});if(!_['isNil'](_0x24319e)){_0x4f9029=_0x24319e['OrderBy'];}}}else{if(!_['isNil'](_0x283cd6[_0xd5ff('0x8b')][_0x5a6c4d])){_0x24319e=_['find'](_0xdefc43,function(_0x234abe){return _0x234abe['id']===_0x283cd6[_0xd5ff('0x8b')][_0x5a6c4d]['ItemTypeId'];});if(!_[_0xd5ff('0x57')](_0x24319e)){_0x4f9029=_0x5a6c4d;}}}if(_['isNil'](_0x4f9029)){_0x4f9029=0x64;}_0x42ead6[_0xd5ff('0x5f')](addAdditionalPhone(_0x283cd6['id'],_0x283cd6['items'][_0x5a6c4d][_0xd5ff('0x7a')],_0x283cd6[_0xd5ff('0x8a')]?_[_0xd5ff('0x57')](_0x283cd6[_0xd5ff('0x8a')][_0x5a6c4d])?null:_0x283cd6[_0xd5ff('0x8a')][_0x5a6c4d]:_0x283cd6['items'][_0x5a6c4d]['ItemTypeId']?_0x283cd6[_0xd5ff('0x8b')][_0x5a6c4d][_0xd5ff('0x8c')]:null,_0x4f9029,_0xb63b44));}Promise[_0xd5ff('0x63')](_0x42ead6)[_0xd5ff('0x18')](function(){db[_0xd5ff('0x23')][_0xd5ff('0x17')]({'AdditionalPhones':_0x5a8028},{'where':{'id':_0x283cd6['id']}})[_0xd5ff('0x18')](function(){_0x57411f(0x1);});});});});});}function addAdditionalPhone(_0x3befa5,_0x24b4d3,_0xfa0258,_0x1fce37,_0x5eb06d){return db['CmContactHasItem'][_0xd5ff('0x24')]({'where':{'CmContactId':_0x3befa5,'item':_0x24b4d3}})[_0xd5ff('0x18')](function(_0x9df1e9){if(_0x9df1e9)logger[_0xd5ff('0x33')](_0xd5ff('0x8e'),_0x9df1e9);else{db[_0xd5ff('0x4a')][_0xd5ff('0x41')]({'CmContactId':_0x3befa5,'item':_0x24b4d3,'ItemTypeId':_0xfa0258,'OrderBy':_0x1fce37,'ItemClass':_0xd5ff('0x8f'),'description':_0x5eb06d});}});}function deleteCmHopperPhones(_0x20606f){return new Promise(function(_0x53b119){return db[_0xd5ff('0x3e')][_0xd5ff('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x20606f}})['then'](function(_0xc8c1b3){db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':{'$in':_[_0xd5ff('0x70')](_0xc8c1b3,'id')}}});})['then'](function(){_0x53b119(0x1);});});}function addCmHopperPhones(_0x3fbbc4){return new Promise(function(_0x4bc6d8){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3fbbc4}})['then'](function(_0x334468){var _0x117257=[];_[_0xd5ff('0x70')](_0x334468,function(_0x275832){_0x117257[_0xd5ff('0x5f')](createCmHopperPhone(_0x3fbbc4,_0x275832['id']));});Promise[_0xd5ff('0x63')](_0x117257)[_0xd5ff('0x18')](function(){_0x4bc6d8(0x1);});});});}function createCmHopperPhone(_0x24d043,_0xaed641){return new Promise(function(_0x16b169){db[_0xd5ff('0x4a')][_0xd5ff('0x20')]({'raw':!![],'attributes':[_0xd5ff('0x90'),_0xd5ff('0x89')],'where':{'CmContactId':_0x24d043,'ItemClass':'PHONE'},'include':[{'model':db[_0xd5ff('0x69')],'attributes':[_0xd5ff('0x89')],'as':_0xd5ff('0x91')}],'order':[_0xd5ff('0x89'),db['sequelize']['literal']('`ItemType`.OrderBy')]})[_0xd5ff('0x18')](function(_0x3e4878){var _0x4345a2=0x1;var _0x42b0aa=_[_0xd5ff('0x70')](_0x3e4878,function(_0x405eda){_0x405eda[_0xd5ff('0x92')]=_0xaed641;_0x405eda[_0xd5ff('0x7a')]=_0x405eda['item'];_0x405eda[_0xd5ff('0x89')]=_0x4345a2;delete _0x405eda['ItemType.OrderBy'];_0x4345a2=_0x4345a2+0x1;return _0x405eda;});return db['CmHopperAdditionalPhone'][_0xd5ff('0x5a')](_0x42b0aa,{});})[_0xd5ff('0x18')](function(){_0x16b169(0x1);});});}function insertAdditionalPhones(_0x30f87d,_0x10c158){return new Promise(function(_0x3173dc){var _0x62b24c=[];for(var _0x141be2=0x0;_0x141be2<_0x10c158[_0xd5ff('0x29')];_0x141be2++){var _0x4ccc42=_0x10c158[_0x141be2];_0x62b24c['push'](parseContactItemType(_0x4ccc42));}Promise[_0xd5ff('0x63')](_0x62b24c)[_0xd5ff('0x18')](function(){var _0x26c27a={'id':_0x30f87d['id'],'items':_0x10c158};return addAdditionalPhones(_0x26c27a)[_0xd5ff('0x18')](function(){return addCmHopperPhones(_0x30f87d['id']);});})['then'](function(){_0x3173dc(_0x30f87d);});});}function parseContactItemType(_0x17792e){return new Promise(function(_0x5aa39c){if(_0x17792e[_0xd5ff('0x36')](_0xd5ff('0x8c'))){_0x5aa39c(_0x17792e);}else{return db[_0xd5ff('0x69')][_0xd5ff('0x24')]({'where':{'name':_0x17792e[_0xd5ff('0x91')]}})[_0xd5ff('0x18')](function(_0x5616a1){if(_[_0xd5ff('0x57')](_0x5616a1))_0x17792e[_0xd5ff('0x8c')]=null;else _0x17792e[_0xd5ff('0x8c')]=_0x5616a1['id'];_0x5aa39c(_0x17792e);});}});}exports[_0xd5ff('0x93')]=function(_0x46c32f,_0x16bd8b){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x46c32f[_0xd5ff('0x25')]['id'],'ItemClass':_0xd5ff('0x8f')},'include':[{'model':db[_0xd5ff('0x69')],'as':_0xd5ff('0x91')}],'order':[['OrderBy'],[db['sequelize'][_0xd5ff('0x6b')]('`ItemType`.OrderBy')]]})[_0xd5ff('0x18')](function(_0x156a12){return _0x156a12;})[_0xd5ff('0x18')](respondWithResult(_0x16bd8b,null))[_0xd5ff('0x22')](handleError(_0x16bd8b,null));};exports['duplicateAdditionalPhones']=function(_0xb5d574,_0x17fc91){return db[_0xd5ff('0x4a')][_0xd5ff('0x20')]({'raw':!![],'where':{'CmContactId':_0xb5d574[_0xd5ff('0x38')][_0xd5ff('0x94')]}})['then'](function(_0x26329a){var _0x2a86b1=_[_0xd5ff('0x70')](_0x26329a,function(_0x97f556){_0x97f556[_0xd5ff('0x95')]=_0xb5d574['body'][_0xd5ff('0x96')];return _0x97f556;});return db[_0xd5ff('0x4a')][_0xd5ff('0x5a')](_0x2a86b1,{});})[_0xd5ff('0x18')](function(){return addCmHopperPhones(_0xb5d574['body'][_0xd5ff('0x96')]);})[_0xd5ff('0x18')](function(){return['ok'];})[_0xd5ff('0x18')](respondWithResult(_0x17fc91,null))['catch'](handleError(_0x17fc91,null));};exports[_0xd5ff('0x97')]=function(_0x434dc7,_0x10575a){var _0x3574a5=[];_0x3574a5[_0xd5ff('0x5f')](createCmHopperPhone(_0x434dc7[_0xd5ff('0x38')]['id'],_0x434dc7[_0xd5ff('0x38')][_0xd5ff('0x98')]));Promise[_0xd5ff('0x63')](_0x3574a5)['then'](function(){return[0x1];})[_0xd5ff('0x18')](respondWithResult(_0x10575a,null));};exports[_0xd5ff('0x99')]=function(_0x83cc2d,_0x4e91de){var _0x2e29f9={'raw':![],'where':{}};var _0x7be8ae={};var _0x5dd665={'count':0x0,'rows':[]};return db[_0xd5ff('0x23')][_0xd5ff('0x7b')]({'where':{'id':_0x83cc2d[_0xd5ff('0x25')]['id']}})[_0xd5ff('0x18')](handleEntityNotFound(_0x4e91de,null))[_0xd5ff('0x18')](function(_0x107e20){if(_0x107e20){_0x7be8ae['model']=_[_0xd5ff('0x28')](db[_0xd5ff('0x3e')][_0xd5ff('0x9a')]);_0x7be8ae[_0xd5ff('0x21')]=_[_0xd5ff('0x28')](_0x83cc2d[_0xd5ff('0x21')]);_0x7be8ae[_0xd5ff('0x7c')]=_[_0xd5ff('0x7d')](_0x7be8ae[_0xd5ff('0x7e')],_0x7be8ae[_0xd5ff('0x21')]);_0x2e29f9[_0xd5ff('0x7f')]=_[_0xd5ff('0x7d')](_0x7be8ae[_0xd5ff('0x7e')],qs[_0xd5ff('0x9b')](_0x83cc2d[_0xd5ff('0x21')][_0xd5ff('0x9b')]));_0x2e29f9[_0xd5ff('0x7f')]=_0x2e29f9[_0xd5ff('0x7f')]['length']?_0x2e29f9['attributes']:_0x7be8ae[_0xd5ff('0x7e')];if(!_0x83cc2d[_0xd5ff('0x21')]['hasOwnProperty'](_0xd5ff('0x86'))){_0x2e29f9[_0xd5ff('0x15')]=qs[_0xd5ff('0x15')](_0x83cc2d[_0xd5ff('0x21')][_0xd5ff('0x15')]);_0x2e29f9[_0xd5ff('0x13')]=qs[_0xd5ff('0x13')](_0x83cc2d['query'][_0xd5ff('0x13')]);}_0x2e29f9[_0xd5ff('0x80')]=qs[_0xd5ff('0x81')](_0x83cc2d[_0xd5ff('0x21')][_0xd5ff('0x81')]);_0x2e29f9[_0xd5ff('0x5d')]=qs['filters'](_[_0xd5ff('0x82')](_0x83cc2d[_0xd5ff('0x21')],_0x7be8ae[_0xd5ff('0x7c')]));_0x2e29f9['where'][_0xd5ff('0x9c')]=_0x107e20['id'];if(_0x83cc2d['query'][_0xd5ff('0x83')]){_0x2e29f9['where']=_[_0xd5ff('0x37')](_0x2e29f9[_0xd5ff('0x5d')],{'$or':_['map'](_0x2e29f9[_0xd5ff('0x7f')],function(_0x5dedc0){var _0x380bba={};_0x380bba[_0x5dedc0]={'$like':'%'+_0x83cc2d['query']['filter']+'%'};return _0x380bba;})});}_0x2e29f9=_[_0xd5ff('0x37')]({},_0x2e29f9,_0x83cc2d[_0xd5ff('0x84')]);return db['CmHopper'][_0xd5ff('0x16')]({'where':_0x2e29f9[_0xd5ff('0x5d')]})[_0xd5ff('0x18')](function(_0xc1587a){_0x5dd665[_0xd5ff('0x16')]=_0xc1587a;if(_0x83cc2d[_0xd5ff('0x21')][_0xd5ff('0x9d')]){_0x2e29f9[_0xd5ff('0x9e')]=[{'all':!![]}];}return db['CmHopper'][_0xd5ff('0x20')](_0x2e29f9);})[_0xd5ff('0x18')](function(_0x3b99a2){_0x5dd665[_0xd5ff('0x9f')]=_0x3b99a2;return _0x5dd665;});}})[_0xd5ff('0x18')](respondWithFilteredResult(_0x4e91de,_0x2e29f9))[_0xd5ff('0x22')](handleError(_0x4e91de,null));};exports[_0xd5ff('0xa0')]=function(_0x294c5f,_0x464ab0){var _0x11ebce={'raw':!![],'where':{}};var _0x486597={};var _0x465b7a={'count':0x0,'rows':[]};return db['CmContact'][_0xd5ff('0x7b')]({'where':{'id':_0x294c5f['params']['id']}})['then'](handleEntityNotFound(_0x464ab0,null))[_0xd5ff('0x18')](function(_0x87ff09){if(_0x87ff09){_0x486597[_0xd5ff('0x7e')]=_[_0xd5ff('0x28')](db[_0xd5ff('0x4c')][_0xd5ff('0x9a')]);_0x486597[_0xd5ff('0x21')]=_[_0xd5ff('0x28')](_0x294c5f[_0xd5ff('0x21')]);_0x486597[_0xd5ff('0x7c')]=_[_0xd5ff('0x7d')](_0x486597[_0xd5ff('0x7e')],_0x486597[_0xd5ff('0x21')]);_0x11ebce['attributes']=_['intersection'](_0x486597[_0xd5ff('0x7e')],qs[_0xd5ff('0x9b')](_0x294c5f[_0xd5ff('0x21')]['fields']));_0x11ebce[_0xd5ff('0x7f')]=_0x11ebce[_0xd5ff('0x7f')][_0xd5ff('0x29')]?_0x11ebce[_0xd5ff('0x7f')]:_0x486597['model'];if(!_0x294c5f[_0xd5ff('0x21')][_0xd5ff('0x36')](_0xd5ff('0x86'))){_0x11ebce[_0xd5ff('0x15')]=qs[_0xd5ff('0x15')](_0x294c5f[_0xd5ff('0x21')][_0xd5ff('0x15')]);_0x11ebce[_0xd5ff('0x13')]=qs['offset'](_0x294c5f['query'][_0xd5ff('0x13')]);}_0x11ebce[_0xd5ff('0x80')]=qs[_0xd5ff('0x81')](_0x294c5f[_0xd5ff('0x21')][_0xd5ff('0x81')]);_0x11ebce[_0xd5ff('0x5d')]=qs[_0xd5ff('0x7c')](_[_0xd5ff('0x82')](_0x294c5f[_0xd5ff('0x21')],_0x486597[_0xd5ff('0x7c')]));_0x11ebce[_0xd5ff('0x5d')][_0xd5ff('0x9c')]=_0x87ff09['id'];if(_0x294c5f[_0xd5ff('0x21')][_0xd5ff('0x83')]){_0x11ebce[_0xd5ff('0x5d')]=_[_0xd5ff('0x37')](_0x11ebce[_0xd5ff('0x5d')],{'$or':_[_0xd5ff('0x70')](_0x11ebce[_0xd5ff('0x7f')],function(_0x161da3){var _0x278c24={};_0x278c24[_0x161da3]={'$like':'%'+_0x294c5f['query'][_0xd5ff('0x83')]+'%'};return _0x278c24;})});}_0x11ebce=_['merge']({},_0x11ebce,_0x294c5f[_0xd5ff('0x84')]);return db['CmHopperHistory'][_0xd5ff('0x16')]({'where':_0x11ebce[_0xd5ff('0x5d')]})[_0xd5ff('0x18')](function(_0x3b1b87){_0x465b7a['count']=_0x3b1b87;if(_0x294c5f[_0xd5ff('0x21')]['includeAll']){_0x11ebce[_0xd5ff('0x9e')]=[{'all':!![]}];}return db[_0xd5ff('0x4c')]['findAll'](_0x11ebce);})['then'](function(_0x3a81a7){_0x465b7a['rows']=_0x3a81a7;return _0x465b7a;});}})[_0xd5ff('0x18')](respondWithFilteredResult(_0x464ab0,_0x11ebce))[_0xd5ff('0x22')](handleError(_0x464ab0,null));};exports['getHopperFinals']=function(_0x2ad293,_0x32cf63){var _0x5369c3={'raw':!![],'where':{}};var _0x12b399={};var _0x37904a={'count':0x0,'rows':[]};return db['CmContact'][_0xd5ff('0x7b')]({'where':{'id':_0x2ad293['params']['id']}})[_0xd5ff('0x18')](handleEntityNotFound(_0x32cf63,null))[_0xd5ff('0x18')](function(_0x2ec0a){if(_0x2ec0a){_0x12b399['model']=_[_0xd5ff('0x28')](db[_0xd5ff('0x4b')][_0xd5ff('0x9a')]);_0x12b399[_0xd5ff('0x21')]=_['keys'](_0x2ad293[_0xd5ff('0x21')]);_0x12b399['filters']=_[_0xd5ff('0x7d')](_0x12b399[_0xd5ff('0x7e')],_0x12b399['query']);_0x5369c3[_0xd5ff('0x7f')]=_[_0xd5ff('0x7d')](_0x12b399[_0xd5ff('0x7e')],qs[_0xd5ff('0x9b')](_0x2ad293['query'][_0xd5ff('0x9b')]));_0x5369c3[_0xd5ff('0x7f')]=_0x5369c3['attributes']['length']?_0x5369c3[_0xd5ff('0x7f')]:_0x12b399['model'];if(!_0x2ad293[_0xd5ff('0x21')][_0xd5ff('0x36')](_0xd5ff('0x86'))){_0x5369c3[_0xd5ff('0x15')]=qs[_0xd5ff('0x15')](_0x2ad293[_0xd5ff('0x21')][_0xd5ff('0x15')]);_0x5369c3['offset']=qs[_0xd5ff('0x13')](_0x2ad293['query'][_0xd5ff('0x13')]);}_0x5369c3[_0xd5ff('0x80')]=qs[_0xd5ff('0x81')](_0x2ad293['query'][_0xd5ff('0x81')]);_0x5369c3[_0xd5ff('0x5d')]=qs[_0xd5ff('0x7c')](_[_0xd5ff('0x82')](_0x2ad293[_0xd5ff('0x21')],_0x12b399['filters']));_0x5369c3[_0xd5ff('0x5d')][_0xd5ff('0x9c')]=_0x2ec0a['id'];if(_0x2ad293[_0xd5ff('0x21')]['filter']){_0x5369c3[_0xd5ff('0x5d')]=_[_0xd5ff('0x37')](_0x5369c3[_0xd5ff('0x5d')],{'$or':_['map'](_0x5369c3['attributes'],function(_0xc5524){var _0x1b853d={};_0x1b853d[_0xc5524]={'$like':'%'+_0x2ad293[_0xd5ff('0x21')][_0xd5ff('0x83')]+'%'};return _0x1b853d;})});}_0x5369c3=_[_0xd5ff('0x37')]({},_0x5369c3,_0x2ad293['options']);return db[_0xd5ff('0x4b')][_0xd5ff('0x16')]({'where':_0x5369c3['where']})[_0xd5ff('0x18')](function(_0x34b582){_0x37904a[_0xd5ff('0x16')]=_0x34b582;if(_0x2ad293[_0xd5ff('0x21')][_0xd5ff('0x9d')]){_0x5369c3['include']=[{'all':!![]}];}return db[_0xd5ff('0x4b')][_0xd5ff('0x20')](_0x5369c3);})[_0xd5ff('0x18')](function(_0x5caba8){_0x37904a[_0xd5ff('0x9f')]=_0x5caba8;return _0x37904a;});}})[_0xd5ff('0x18')](respondWithFilteredResult(_0x32cf63,_0x5369c3))[_0xd5ff('0x22')](handleError(_0x32cf63,null));};exports['getJscriptySessions']=function(_0x1102a3,_0xd122b7){var _0x329b0b={'raw':!![],'where':{}};var _0x20318f={};var _0x596273={'count':0x0,'rows':[]};return db[_0xd5ff('0x23')][_0xd5ff('0x7b')]({'where':{'id':_0x1102a3[_0xd5ff('0x25')]['id']}})['then'](handleEntityNotFound(_0xd122b7,null))[_0xd5ff('0x18')](function(_0x4aaae2){if(_0x4aaae2){_0x20318f[_0xd5ff('0x7e')]=_[_0xd5ff('0x28')](db[_0xd5ff('0x54')][_0xd5ff('0x9a')]);_0x20318f[_0xd5ff('0x21')]=_[_0xd5ff('0x28')](_0x1102a3['query']);_0x20318f[_0xd5ff('0x7c')]=_[_0xd5ff('0x7d')](_0x20318f[_0xd5ff('0x7e')],_0x20318f[_0xd5ff('0x21')]);_0x329b0b[_0xd5ff('0x7f')]=_['intersection'](_0x20318f[_0xd5ff('0x7e')],qs[_0xd5ff('0x9b')](_0x1102a3['query']['fields']));_0x329b0b[_0xd5ff('0x7f')]=_0x329b0b[_0xd5ff('0x7f')][_0xd5ff('0x29')]?_0x329b0b[_0xd5ff('0x7f')]:_0x20318f[_0xd5ff('0x7e')];if(!_0x1102a3[_0xd5ff('0x21')]['hasOwnProperty'](_0xd5ff('0x86'))){_0x329b0b[_0xd5ff('0x15')]=qs[_0xd5ff('0x15')](_0x1102a3[_0xd5ff('0x21')][_0xd5ff('0x15')]);_0x329b0b[_0xd5ff('0x13')]=qs['offset'](_0x1102a3['query'][_0xd5ff('0x13')]);}_0x329b0b['order']=qs[_0xd5ff('0x81')](_0x1102a3['query'][_0xd5ff('0x81')]);_0x329b0b['where']=qs[_0xd5ff('0x7c')](_[_0xd5ff('0x82')](_0x1102a3[_0xd5ff('0x21')],_0x20318f[_0xd5ff('0x7c')]));_0x329b0b[_0xd5ff('0x5d')][_0xd5ff('0x9c')]=_0x4aaae2['id'];if(_0x1102a3[_0xd5ff('0x21')][_0xd5ff('0x83')]){_0x329b0b['where']=_['merge'](_0x329b0b[_0xd5ff('0x5d')],{'$or':_[_0xd5ff('0x70')](_0x329b0b['attributes'],function(_0xce81db){var _0xd55d31={};_0xd55d31[_0xce81db]={'$like':'%'+_0x1102a3[_0xd5ff('0x21')][_0xd5ff('0x83')]+'%'};return _0xd55d31;})});}_0x329b0b=_['merge']({},_0x329b0b,_0x1102a3[_0xd5ff('0x84')]);return db[_0xd5ff('0x54')][_0xd5ff('0x16')]({'where':_0x329b0b[_0xd5ff('0x5d')]})['then'](function(_0x5a786b){_0x596273[_0xd5ff('0x16')]=_0x5a786b;if(_0x1102a3['query'][_0xd5ff('0x9d')]){_0x329b0b['include']=[{'all':!![]}];}return db[_0xd5ff('0x54')][_0xd5ff('0x20')](_0x329b0b);})[_0xd5ff('0x18')](function(_0x5699e7){_0x596273[_0xd5ff('0x9f')]=_0x5699e7;return _0x596273;});}})['then'](respondWithFilteredResult(_0xd122b7,_0x329b0b))[_0xd5ff('0x22')](handleError(_0xd122b7,null));};exports['uploadCsv']=function(_0x52a188,_0x4daed1){try{if(!_0x52a188[_0xd5ff('0x38')][_0xd5ff('0x60')]){throw new Error('No\x20ListId\x20specified');}if(!_0x52a188[_0xd5ff('0x38')]['binding_keys']){throw new Error(_0xd5ff('0xa1'));}if(!_0x52a188[_0xd5ff('0x38')][_0xd5ff('0xa2')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x52a188[_0xd5ff('0x38')][_0xd5ff('0xa3')]){throw new Error(_0xd5ff('0xa4'));}var _0x9d5654=_0x52a188[_0xd5ff('0x38')]['binding_keys']['split'](',');var _0x240c69=_0x52a188[_0xd5ff('0x38')][_0xd5ff('0xa2')]['split'](',');if(!_0x9d5654[_0xd5ff('0x29')]||!_0x240c69['length']||_0x9d5654[_0xd5ff('0x29')]!==_0x240c69[_0xd5ff('0x29')]){throw new Error(_0xd5ff('0xa5'));}_0x52a188[_0xd5ff('0x38')][_0xd5ff('0x9b')]=_['zipObject'](_0x9d5654,_0x240c69);if(!_0x52a188[_0xd5ff('0x38')]['fields'][_0xd5ff('0x7a')]){throw new Error(_0xd5ff('0xa6'));}if(!_0x52a188[_0xd5ff('0x38')][_0xd5ff('0x9b')][_0xd5ff('0xa7')]){throw new Error(_0xd5ff('0xa8'));}var _0x29cbe1=path[_0xd5ff('0x3b')](config[_0xd5ff('0xa9')],_0xd5ff('0xaa'),_0x52a188[_0xd5ff('0xab')][_0xd5ff('0xac')]);fs[_0xd5ff('0xad')](_0x29cbe1,parseInt(_0xd5ff('0xae'),0x8));var _0x4083be=require(_0xd5ff('0xaf'))['fork'](path[_0xd5ff('0x3b')](__dirname,_0xd5ff('0xb0')),[_0x29cbe1,_0x52a188[_0xd5ff('0x38')][_0xd5ff('0xb1')],_0x52a188[_0xd5ff('0x38')][_0xd5ff('0xa2')],_0x52a188['body'][_0xd5ff('0x60')],_0x52a188['body']['CompanyId'],_0x52a188[_0xd5ff('0x38')][_0xd5ff('0x5c')],_0x52a188[_0xd5ff('0x38')][_0xd5ff('0xa3')]]);return _0x4daed1['status'](0xc8)['json']({'message':_0xd5ff('0xb2'),'pid':_0x4083be['pid']});}catch(_0x20989a){return _0x4daed1[_0xd5ff('0x11')](0x1f4)[_0xd5ff('0x1e')](_0x20989a);}};exports[_0xd5ff('0xb3')]=function(_0x14facd,_0x1db9a9){var _0x1f2a8b=fs[_0xd5ff('0xb4')](_0x14facd['file'][_0xd5ff('0xb5')]);Papa[_0xd5ff('0xb6')](_0x1f2a8b,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0xba98f8){return _0x1db9a9['status'](0xc8)[_0xd5ff('0x12')]({'file':_0x14facd[_0xd5ff('0xab')],'fields':_0xba98f8[_0xd5ff('0xb7')][_0xd5ff('0x9b')]});}});};exports['import']=function(_0x4443e0,_0x49824d){return db['User'][_0xd5ff('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0xd5ff('0xb8')}})[_0xd5ff('0x18')](function(_0x1fef20){var _0x4537d8=![];if(!_0x4443e0[_0xd5ff('0x38')]['ListId']){throw new Error(_0xd5ff('0xb9'));}if(!_0x4443e0['body'][_0xd5ff('0xba')][_0xd5ff('0x7a')]){throw new Error(_0xd5ff('0xa6'));}if(!_0x4443e0[_0xd5ff('0x38')][_0xd5ff('0xba')][_0xd5ff('0xa7')]){throw new Error(_0xd5ff('0xa8'));}if(!_0x4443e0['body'][_0xd5ff('0xa3')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x9044e=require(_0xd5ff('0xaf'))[_0xd5ff('0xbb')](path[_0xd5ff('0x3b')](__dirname,_0xd5ff('0xbc')),[_0x4443e0[_0xd5ff('0x25')]['id'],JSON[_0xd5ff('0xbd')](_0x4443e0[_0xd5ff('0x38')]),JSON[_0xd5ff('0xbd')](_0x1fef20)]);_0x9044e['on'](_0xd5ff('0xbe'),function(){_0x4537d8=!![];return _0x49824d['status'](0xc8)[_0xd5ff('0x12')]({'message':_0xd5ff('0xbf'),'pid':_0x9044e[_0xd5ff('0xc0')]});});_0x9044e['on'](_0xd5ff('0xc1'),function(_0xf07e04){if(_0xf07e04&&!_0x4537d8){return _0x49824d[_0xd5ff('0x11')](0x1f4)[_0xd5ff('0x12')]({'message':_0xd5ff('0xc2'),'pid':_0x9044e[_0xd5ff('0xc0')]});}});})['catch'](handleError(_0x49824d,null));};exports[_0xd5ff('0xc3')]=function(_0x1b2db5,_0xef5036){return db[_0xd5ff('0xc4')][_0xd5ff('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0xd5ff('0xb8')}})[_0xd5ff('0x18')](function(_0x5d9fb4){var _0x22729d=![];if(!_0x1b2db5['body'][_0xd5ff('0x60')]){throw new Error('No\x20ListId\x20specified');}if(!_0x1b2db5['body'][_0xd5ff('0xba')][_0xd5ff('0x7a')]){throw new Error(_0xd5ff('0xa6'));}if(!_0x1b2db5[_0xd5ff('0x38')][_0xd5ff('0xba')][_0xd5ff('0xa7')]){throw new Error(_0xd5ff('0xa8'));}if(!_0x1b2db5[_0xd5ff('0x38')][_0xd5ff('0xa3')]){throw new Error(_0xd5ff('0xa4'));}var _0x3dbb1a=require('child_process')[_0xd5ff('0xbb')](path[_0xd5ff('0x3b')](__dirname,_0xd5ff('0xc5')),[_0x1b2db5[_0xd5ff('0x25')]['id'],JSON[_0xd5ff('0xbd')](_0x1b2db5[_0xd5ff('0x38')]),JSON[_0xd5ff('0xbd')](_0x5d9fb4)]);_0x3dbb1a['on'](_0xd5ff('0xbe'),function(){_0x22729d=!![];return _0xef5036[_0xd5ff('0x11')](0xc8)[_0xd5ff('0x12')]({'message':_0xd5ff('0xbf'),'pid':_0x3dbb1a[_0xd5ff('0xc0')]});});_0x3dbb1a['on']('exit',function(_0x4c2b13){if(_0x4c2b13&&!_0x22729d){return _0xef5036[_0xd5ff('0x11')](0x1f4)['json']({'message':_0xd5ff('0xc2'),'pid':_0x3dbb1a['pid']});}});})[_0xd5ff('0x22')](handleError(_0xef5036,null));};exports[_0xd5ff('0xc6')]=function(_0x121e93,_0x5b6711){var _0x146b95=[_0xd5ff('0xc7'),_0xd5ff('0xc8'),_0xd5ff('0xc9'),_0xd5ff('0xca'),_0xd5ff('0xcb'),_0xd5ff('0xcc'),_0xd5ff('0xcd')];var _0x36b3ff={'offset':0x0,'order':qs[_0xd5ff('0x81')]('-createdAt')},_0x4cab89={'count':0x0,'rows':[]};Promise[_0xd5ff('0xce')]()[_0xd5ff('0x18')](function(){if(_0x121e93[_0xd5ff('0x21')][_0xd5ff('0xcf')]){if(!_[_0xd5ff('0xd0')](_0x146b95,_0x121e93[_0xd5ff('0x21')]['channel'][_0xd5ff('0xd1')]())){throw new Error(_0xd5ff('0xd2'));}_0x146b95=[_0x121e93['query'][_0xd5ff('0xcf')][_0xd5ff('0xd1')]()];}if(_0x121e93[_0xd5ff('0x21')][_0xd5ff('0xd3')]){try{var _0x55d406=JSON[_0xd5ff('0xb6')](_0x121e93[_0xd5ff('0x21')][_0xd5ff('0xd3')]);if(!moment(_0x55d406[_0xd5ff('0x3d')])['isValid']()){throw new Error(_0xd5ff('0xd4'));}if(!moment(_0x55d406['to'])[_0xd5ff('0xd5')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x1b872a){throw new Error(_0xd5ff('0xd6'));}}if(!_0x121e93[_0xd5ff('0x21')][_0xd5ff('0x36')]('nolimit')){_0x36b3ff[_0xd5ff('0x15')]=qs[_0xd5ff('0x15')](_0x121e93[_0xd5ff('0x21')][_0xd5ff('0x15')]||0xa);_0x36b3ff['offset']=qs[_0xd5ff('0x13')](_0x121e93[_0xd5ff('0x21')][_0xd5ff('0x13')]);}var _0x984971=_0x146b95[_0xd5ff('0x70')](function(_0x908e11){if(_0x908e11===_0xd5ff('0xcd')){var _0x37a162={'attributes':['id',_0xd5ff('0xd7'),'type',_0xd5ff('0xd8'),_0xd5ff('0xd9'),'callerid',_0xd5ff('0xda'),_0xd5ff('0xdb'),_0xd5ff('0xdc'),_0xd5ff('0xdd'),_0xd5ff('0xde'),_0xd5ff('0xdf'),_0xd5ff('0xe0'),_0xd5ff('0xe1'),_0xd5ff('0xe2')],'where':{'ContactId':_0x121e93['params']['id']},'include':[{'model':db['User'],'as':_0xd5ff('0xc4'),'attributes':['id',_0xd5ff('0x1d'),'fullname',_0xd5ff('0x2f')]}],'order':[[_0xd5ff('0xde'),_0xd5ff('0xe3')]]};if(_0x121e93[_0xd5ff('0x21')][_0xd5ff('0xd3')]){_0x37a162[_0xd5ff('0x5d')][_0xd5ff('0xde')]={'$gte':_0x55d406[_0xd5ff('0x3d')],'$lte':_0x55d406['to']};}return db[_0xd5ff('0x4e')][_0xd5ff('0xe4')](_0x37a162)[_0xd5ff('0x18')](function(_0x15d235){_0x4cab89[_0xd5ff('0x16')]+=_0x15d235['count'];return _[_0xd5ff('0x70')](_0x15d235[_0xd5ff('0x9f')],function(_0x136b29){var _0xa9408c=_0x136b29[_0xd5ff('0x39')]({'plain':!![]});_0xa9408c[_0xd5ff('0xcf')]=_0x908e11;if(_0xa9408c[_0xd5ff('0xc4')]){_0xa9408c[_0xd5ff('0xc4')]={'id':_0xa9408c[_0xd5ff('0xc4')]['id'],'name':_0xa9408c['User'][_0xd5ff('0x1d')],'fullname':_0xa9408c['User'][_0xd5ff('0xe5')],'alias':_0xa9408c[_0xd5ff('0xc4')][_0xd5ff('0x2f')]};}return _0xa9408c;});});}else{var _0x1d0739=_['startCase'](_0x908e11)+(_0x908e11==='chat'?_0xd5ff('0xe6'):'Account');var _0x4c1e0f={'attributes':['id',_0xd5ff('0xe7'),_0xd5ff('0xe8'),_0xd5ff('0xde'),_0xd5ff('0xdd'),_0xd5ff('0xe9'),_0xd5ff('0xea'),_0xd5ff('0xeb'),_0xd5ff('0xe2'),_0x1d0739+'Id'],'where':{'ContactId':_0x121e93[_0xd5ff('0x25')]['id']},'include':[{'model':db[_0x1d0739],'as':'Account','attributes':['id',_0xd5ff('0x1d'),'key']},{'model':db['User'],'as':'Owner','attributes':['id',_0xd5ff('0x1d'),_0xd5ff('0xe5')]},{'model':db[_0xd5ff('0x65')],'as':_0xd5ff('0x66'),'attributes':['id','name',_0xd5ff('0x67')],'through':{'attributes':[]}}],'order':[[_0xd5ff('0xde'),_0xd5ff('0xe3')]]};if(_0x121e93[_0xd5ff('0x21')]['range']){_0x4c1e0f[_0xd5ff('0x5d')]['createdAt']={'$gte':_0x55d406[_0xd5ff('0x3d')],'$lte':_0x55d406['to']};}switch(_0x908e11){case _0xd5ff('0xc8'):_0x4c1e0f['attributes'][_0xd5ff('0x5f')](_0xd5ff('0xec'),_0xd5ff('0xed'),_0xd5ff('0xee'),_0xd5ff('0xef'),_0xd5ff('0xf0'),_0xd5ff('0xf1'),_0xd5ff('0xf2'),'ratingValue',_0xd5ff('0xf3'));break;case _0xd5ff('0xc7'):_0x4c1e0f[_0xd5ff('0x7f')]['push'](_0xd5ff('0xf4'),_0xd5ff('0xf5'));break;case'openchannel':_0x4c1e0f['attributes']['push'](_0xd5ff('0xf6'),_0xd5ff('0xf7'));break;}return db[_['startCase'](_0x908e11)+_0xd5ff('0xf8')][_0xd5ff('0xe4')](_0x4c1e0f)[_0xd5ff('0x18')](function(_0x29a93d){_0x4cab89[_0xd5ff('0x16')]+=_0x29a93d['count'];return _[_0xd5ff('0x70')](_0x29a93d[_0xd5ff('0x9f')],function(_0x2418a2){var _0x33ebf1=_0x2418a2[_0xd5ff('0x39')]({'plain':!![]});_0x33ebf1[_0xd5ff('0xcf')]=_0x908e11;if(_0x33ebf1[_0xd5ff('0xf9')]){_0x33ebf1['Owner']={'id':_0x33ebf1[_0xd5ff('0xf9')]['id'],'name':_0x33ebf1[_0xd5ff('0xf9')]['name'],'fullname':_0x33ebf1[_0xd5ff('0xf9')][_0xd5ff('0xe5')]};}return _0x33ebf1;});});}});return Promise[_0xd5ff('0x63')](_0x984971);})['then'](function(_0x52117a){return _(_0x52117a)['flatten']()[_0xd5ff('0xfa')](_0xd5ff('0xde'))[_0xd5ff('0xfb')]()[_0xd5ff('0xfc')]();})[_0xd5ff('0x18')](function(_0x3f97ea){_0x4cab89[_0xd5ff('0x9f')]=_0x36b3ff[_0xd5ff('0x15')]?_0x3f97ea[_0xd5ff('0xfd')](_0x36b3ff[_0xd5ff('0x13')],_0x36b3ff[_0xd5ff('0x13')]+_0x36b3ff[_0xd5ff('0x15')]):_0x3f97ea;return _0x4cab89;})[_0xd5ff('0x18')](respondWithFilteredResult(_0x5b6711,_0x36b3ff))[_0xd5ff('0x22')](handleError(_0x5b6711,null));}; \ No newline at end of file +var _0xf2e3=['include','rows','getHopperHistories','ContactId','CmHopperHistory','includeAll','getHopperFinals','CmHopperFinal','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','binding_keys','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','import','agent','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','importUpdates','User','../../components/import/cm/csvUpdates','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','getJourney','mail','chat','openchannel','fax','voice','-createdAt','channel','includes','Invalid\x20channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','callerid','starttime','duration','note','createdAt','userDisposition','userSecondDisposition','UserId','DESC','findAndCountAll','startCase','Website','closed','closedAt','secondDisposition','thirdDisposition','key','Owner','fullname','color','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','sortBy','reverse','bluebird','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','sendStatus','stack','name','send','index','describe','findAll','query','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','length','alias','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','columnName','merge','body','from','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','create','isNil','dialTimezone','timezones','utcOffset','additionalPhones','duplicates','where','$or','push','ListId','findOrCreate','spread','hasOwnProperty','contact','all','Tag','Tags','tag','Phones','ItemType','literal','Phones.OrderBy','format','cf_%d','CmCustomField','omit','pickBy','table','cm_contacts','toParam','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','map','options','nolimit','findOne','setTags','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','ContactItemType','`ItemType`.OrderBy','CmHopperId','item','ItemType.OrderBy','getAdditionalPhones','fromContactId','CmContactId','toContactId','bulkCreate','rescheduleAdditionalPhones','hopperId','getHoppers'];(function(_0xdd22b4,_0x30d40a){var _0x40d550=function(_0x5a9ac6){while(--_0x5a9ac6){_0xdd22b4['push'](_0xdd22b4['shift']());}};_0x40d550(++_0x30d40a);}(_0xf2e3,0x15f));var _0x3f2e=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0xf2e3[_0x176329];return _0x31997c;};'use strict';var moment=require('moment');var BPromise=require(_0x3f2e('0x0'));var util=require('util');var path=require(_0x3f2e('0x1'));var fs=require('fs');var _=require(_0x3f2e('0x2'));var squel=require(_0x3f2e('0x3'));var Papa=require(_0x3f2e('0x4'));var Redis=require(_0x3f2e('0x5'));var contacts=require(_0x3f2e('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x3f2e('0x7'))(_0x3f2e('0x8'));var config=require(_0x3f2e('0x9'));var shared=require('../../config/environment/shared');var db=require(_0x3f2e('0xa'))['db'];config[_0x3f2e('0xb')]=_[_0x3f2e('0xc')](config['redis'],{'host':_0x3f2e('0xd'),'port':0x18eb});var socket=require(_0x3f2e('0xe'))(new Redis(config[_0x3f2e('0xb')]));require('./cmContact.socket')[_0x3f2e('0xf')](socket);function respondWithResult(_0x2d34b9,_0x488334){_0x488334=_0x488334||0xc8;return function(_0x52056c){if(_0x52056c){return _0x2d34b9[_0x3f2e('0x10')](_0x488334)[_0x3f2e('0x11')](_0x52056c);}};}function respondWithFilteredResult(_0x2b8fba,_0x2e09da){return function(_0x851f9a){if(_0x851f9a){var _0x303a90=typeof _0x2e09da[_0x3f2e('0x12')]===_0x3f2e('0x13')&&typeof _0x2e09da[_0x3f2e('0x14')]===_0x3f2e('0x13');var _0xe8f0da=_0x851f9a[_0x3f2e('0x15')];var _0x38a156=_0x303a90?0x0:_0x2e09da[_0x3f2e('0x12')];var _0x4e6c66=_0x303a90?_0x851f9a[_0x3f2e('0x15')]:_0x2e09da[_0x3f2e('0x12')]+_0x2e09da[_0x3f2e('0x14')];var _0x2e9a2a;if(_0x4e6c66>=_0xe8f0da){_0x4e6c66=_0xe8f0da;_0x2e9a2a=0xc8;}else{_0x2e9a2a=0xce;}_0x2b8fba['status'](_0x2e9a2a);return _0x2b8fba['set'](_0x3f2e('0x16'),_0x38a156+'-'+_0x4e6c66+'/'+_0xe8f0da)['json'](_0x851f9a);}return null;};}function saveUpdates(_0x6ae745){return function(_0x466ba0){if(_0x466ba0){return _0x466ba0[_0x3f2e('0x17')](_0x6ae745)[_0x3f2e('0x18')](function(_0x2bfba6){return _0x2bfba6;});}return null;};}function removeEntity(_0x15937d){return function(_0x523d90){if(_0x523d90){return _0x523d90[_0x3f2e('0x19')]()[_0x3f2e('0x18')](function(){_0x15937d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38ebe0){return function(_0x5caa14){if(!_0x5caa14){_0x38ebe0[_0x3f2e('0x1a')](0x194);}return _0x5caa14;};}function handleError(_0x104cf2,_0x357655){_0x357655=_0x357655||0x1f4;return function(_0x286736){logger['error'](_0x286736[_0x3f2e('0x1b')]);if(_0x286736[_0x3f2e('0x1c')]){delete _0x286736['name'];}_0x104cf2[_0x3f2e('0x10')](_0x357655)[_0x3f2e('0x1d')](_0x286736);};}exports[_0x3f2e('0x1e')]=function(_0x170b00,_0xe63c83){var _0x3ee968={};return contacts[_0x3f2e('0x1f')]()['then'](function(_0x15a3b4){_0x3ee968=qs['getOptions'](_0x15a3b4,_0x170b00);return contacts[_0x3f2e('0x20')](_0x170b00[_0x3f2e('0x21')],_0x170b00['user'],_0x3ee968,_0x15a3b4);})[_0x3f2e('0x18')](respondWithFilteredResult(_0xe63c83,_0x3ee968))[_0x3f2e('0x22')](handleError(_0xe63c83,null));};exports[_0x3f2e('0x19')]=function(_0x288291,_0x4ff0fb){return db[_0x3f2e('0x23')][_0x3f2e('0x24')]({'where':{'id':_0x288291[_0x3f2e('0x25')]['id']}})['then'](handleEntityNotFound(_0x4ff0fb,null))['then'](removeEntity(_0x4ff0fb,null))[_0x3f2e('0x22')](handleError(_0x4ff0fb,null));};exports['describe']=function(_0x4be7da,_0x103dff){return db[_0x3f2e('0x23')][_0x3f2e('0x1f')]()[_0x3f2e('0x18')](function(_0x14552e){delete _0x14552e[_0x3f2e('0x26')];for(var _0x425f64=0x0;_0x425f640x0){return new Promise(function(_0x67f90e){var _0x22d816=[];for(var _0x4940cf=0x0;_0x4940cf<_0x5295d4[_0x3f2e('0x2c')];_0x4940cf++){_0x22d816['push'](insertAdditionalPhones(_0x5295d4[_0x4940cf][_0x3f2e('0x61')],_0x5295d4[_0x4940cf]['additionalPhones']));}Promise[_0x3f2e('0x62')](_0x22d816)[_0x3f2e('0x18')](function(){_0x67f90e(0x1);});})['then'](function(){return{'success':_0x544460,'failure':_0x1e5cb2,'duplicates':_0x5aeadf};});}else{return{'success':_0x544460,'failure':_0x1e5cb2,'duplicates':_0x5aeadf};}}})[_0x3f2e('0x18')](respondWithResult(_0x2f47b1,0xc9))['catch'](handleError(_0x2f47b1,null));};exports['show']=function(_0x4b5958,_0x4f6cd4){var _0x1cd658;return db['CmContact'][_0x3f2e('0x1f')]()[_0x3f2e('0x18')](function(_0x2246f6){return db[_0x3f2e('0x23')][_0x3f2e('0x24')]({'where':{'id':_0x4b5958[_0x3f2e('0x25')]['id']},'include':[{'model':db[_0x3f2e('0x63')],'as':_0x3f2e('0x64'),'attributes':['id','name','color'],'required':_0x4b5958[_0x3f2e('0x21')][_0x3f2e('0x65')]?!![]:![]},{'model':db[_0x3f2e('0x49')],'as':_0x3f2e('0x66'),'where':{'CmContactId':_0x4b5958[_0x3f2e('0x25')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0x3f2e('0x67')}]}],'order':[db['sequelize'][_0x3f2e('0x68')](_0x3f2e('0x69'))],'attributes':_[_0x3f2e('0x27')](_0x2246f6)});})[_0x3f2e('0x18')](function(_0xbf6b7e){if(!_[_0x3f2e('0x54')](_0xbf6b7e)){_0x1cd658=_0xbf6b7e[_0x3f2e('0x38')]({'plain':!![]});var _0x5c050c={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xbf6b7e&&_0xbf6b7e[_0x3f2e('0x5d')]){if(_0xbf6b7e[_0x3f2e('0x5d')]){_0x5c050c['where']['$and'][_0x3f2e('0x5c')]({'ListId':{'$ne':_0xbf6b7e['ListId']}});}}return db['CmCustomField']['findAll'](_0x5c050c);}})[_0x3f2e('0x18')](function(_0x49220d){if(!_[_0x3f2e('0x54')](_0x49220d)){return _['omit'](_0x1cd658,_['map'](_0x49220d,function(_0x5b718d){return util[_0x3f2e('0x6a')](_0x3f2e('0x6b'),_0x5b718d['id']);}));}})[_0x3f2e('0x18')](handleEntityNotFound(_0x4f6cd4,null))[_0x3f2e('0x18')](respondWithResult(_0x4f6cd4,null))['catch'](handleError(_0x4f6cd4,null));};exports[_0x3f2e('0x17')]=function(_0x2cb722,_0x83dd9a){var _0x5e43e4;if(_0x2cb722[_0x3f2e('0x36')]['id']){delete _0x2cb722[_0x3f2e('0x36')]['id'];}if(!_[_0x3f2e('0x54')](_0x2cb722['body'][_0x3f2e('0x55')])){var _0x188843=_0x2cb722[_0x3f2e('0x36')][_0x3f2e('0x55')];if(!_[_0x3f2e('0x54')](shared['timezones'][_0x188843]))_0x2cb722[_0x3f2e('0x36')][_0x3f2e('0x57')]=shared[_0x3f2e('0x56')][_0x188843][_0x3f2e('0x57')];}return db[_0x3f2e('0x23')][_0x3f2e('0x24')]({'where':{'id':_0x2cb722[_0x3f2e('0x25')]['id']}})[_0x3f2e('0x18')](handleEntityNotFound(_0x83dd9a,null))['then'](saveUpdates(_0x2cb722[_0x3f2e('0x36')],null))[_0x3f2e('0x18')](function(_0x2a2c40){_0x5e43e4=_0x2a2c40;var _0x47310b={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2a2c40&&_0x2a2c40[_0x3f2e('0x5d')]){if(_0x2a2c40[_0x3f2e('0x5d')]){_0x47310b[_0x3f2e('0x5a')]['$and'][_0x3f2e('0x5c')]({'ListId':{'$ne':_0x2a2c40[_0x3f2e('0x5d')]}});}}return db[_0x3f2e('0x6c')][_0x3f2e('0x20')](_0x47310b);})[_0x3f2e('0x18')](function(_0x2eb301){if(_0x2eb301){return _[_0x3f2e('0x6d')](_[_0x3f2e('0x6e')](_0x2cb722[_0x3f2e('0x36')],function(_0x33f26e,_0x1e4d81){return _[_0x3f2e('0x28')](_0x1e4d81,'cf_');}),_['map'](_0x2eb301,function(_0x1243c6){return util['format'](_0x3f2e('0x6b'),_0x1243c6['id']);}));}})[_0x3f2e('0x18')](function(_0x2d0e80){if(_0x2d0e80&&!_['isEmpty'](_0x2d0e80)){var _0x202b9a=squel[_0x3f2e('0x17')]()[_0x3f2e('0x6f')](_0x3f2e('0x70'))['setFields'](_0x2d0e80)[_0x3f2e('0x5a')]('id\x20=\x20?',_0x2cb722[_0x3f2e('0x25')]['id'])[_0x3f2e('0x71')]();return db['sequelize'][_0x3f2e('0x21')](_0x202b9a['text'],{'replacements':_0x202b9a['values']});}})[_0x3f2e('0x18')](function(){if(_0x2cb722['body'][_0x3f2e('0x72')]&&_0x5e43e4){return db[_0x3f2e('0x3d')]['update']({'phone':_0x2cb722[_0x3f2e('0x36')][_0x3f2e('0x72')],'OrderBy':0x0},{'where':{'ContactId':_0x5e43e4['id']}});}})['then'](function(){return _0x5e43e4;})[_0x3f2e('0x18')](respondWithResult(_0x83dd9a,null))[_0x3f2e('0x22')](handleError(_0x83dd9a,null));};exports[_0x3f2e('0x73')]=function(_0x364037,_0xd9fe8f){var _0x4e09f6={};var _0x2cde85={};var _0x12f0ec;var _0x1597b7;return db['CmContact']['findOne']({'where':{'id':_0x364037[_0x3f2e('0x25')]['id']}})[_0x3f2e('0x18')](handleEntityNotFound(_0xd9fe8f,null))['then'](function(_0x48a8a7){if(_0x48a8a7){_0x12f0ec=_0x48a8a7;_0x2cde85[_0x3f2e('0x74')]=_[_0x3f2e('0x27')](db['Tag'][_0x3f2e('0x75')]);_0x2cde85['query']=_[_0x3f2e('0x27')](_0x364037[_0x3f2e('0x21')]);_0x2cde85[_0x3f2e('0x76')]=_[_0x3f2e('0x77')](_0x2cde85['model'],_0x2cde85[_0x3f2e('0x21')]);_0x4e09f6[_0x3f2e('0x78')]=_[_0x3f2e('0x77')](_0x2cde85['model'],qs[_0x3f2e('0x79')](_0x364037[_0x3f2e('0x21')][_0x3f2e('0x79')]));_0x4e09f6[_0x3f2e('0x78')]=_0x4e09f6['attributes'][_0x3f2e('0x2c')]?_0x4e09f6[_0x3f2e('0x78')]:_0x2cde85[_0x3f2e('0x74')];_0x4e09f6[_0x3f2e('0x7a')]=qs['sort'](_0x364037[_0x3f2e('0x21')][_0x3f2e('0x7b')]);_0x4e09f6[_0x3f2e('0x5a')]=qs[_0x3f2e('0x76')](_[_0x3f2e('0x7c')](_0x364037[_0x3f2e('0x21')],_0x2cde85[_0x3f2e('0x76')]));if(_0x364037[_0x3f2e('0x21')][_0x3f2e('0x7d')]){_0x4e09f6[_0x3f2e('0x5a')]=_[_0x3f2e('0x35')](_0x4e09f6[_0x3f2e('0x5a')],{'$or':_[_0x3f2e('0x7e')](_0x4e09f6[_0x3f2e('0x78')],function(_0x488ed8){var _0x43367b={};_0x43367b[_0x488ed8]={'$like':'%'+_0x364037[_0x3f2e('0x21')][_0x3f2e('0x7d')]+'%'};return _0x43367b;})});}_0x4e09f6=_[_0x3f2e('0x35')]({},_0x4e09f6,_0x364037[_0x3f2e('0x7f')]);return _0x12f0ec[_0x3f2e('0x73')](_0x4e09f6);}})[_0x3f2e('0x18')](function(_0x314b82){if(_0x314b82){_0x1597b7=_0x314b82[_0x3f2e('0x2c')];if(!_0x364037[_0x3f2e('0x21')][_0x3f2e('0x60')](_0x3f2e('0x80'))){_0x4e09f6[_0x3f2e('0x14')]=qs[_0x3f2e('0x14')](_0x364037[_0x3f2e('0x21')][_0x3f2e('0x14')]);_0x4e09f6['offset']=qs[_0x3f2e('0x12')](_0x364037[_0x3f2e('0x21')][_0x3f2e('0x12')]);}return _0x12f0ec['getTags'](_0x4e09f6);}})[_0x3f2e('0x18')](function(_0x3f819a){if(_0x3f819a){return _0x3f819a?{'count':_0x1597b7,'rows':_0x3f819a}:null;}})[_0x3f2e('0x18')](respondWithResult(_0xd9fe8f,null))[_0x3f2e('0x22')](handleError(_0xd9fe8f,null));};exports['setTags']=function(_0x31c62e,_0x5e1339){if(_0x31c62e[_0x3f2e('0x36')]['id']){delete _0x31c62e[_0x3f2e('0x36')]['id'];}return db[_0x3f2e('0x23')][_0x3f2e('0x81')]({'where':{'id':_0x31c62e[_0x3f2e('0x25')]['id']}})[_0x3f2e('0x18')](handleEntityNotFound(_0x5e1339,null))[_0x3f2e('0x18')](function(_0xdefd05){if(_0xdefd05){return _0xdefd05[_0x3f2e('0x82')](_0x31c62e[_0x3f2e('0x36')]['ids']||[]);}return null;})[_0x3f2e('0x18')](respondWithResult(_0x5e1339,null))[_0x3f2e('0x22')](handleError(_0x5e1339,null));};exports[_0x3f2e('0x83')]=function(_0x4947f9,_0x404973){var _0x39cb34=[];_0x39cb34[_0x3f2e('0x5c')](addAdditionalPhones(_0x4947f9[_0x3f2e('0x36')]));Promise[_0x3f2e('0x62')](_0x39cb34)['then'](function(){_0x39cb34=[];_0x39cb34['push'](deleteCmHopperPhones(_0x4947f9['body']['id']));_0x39cb34[_0x3f2e('0x5c')](addCmHopperPhones(_0x4947f9[_0x3f2e('0x36')]['id']));Promise[_0x3f2e('0x62')](_0x39cb34)[_0x3f2e('0x18')](function(){return[0x1];})[_0x3f2e('0x18')](respondWithResult(_0x404973,null));});};function addAdditionalPhones(_0x5cf6d8){var _0x1ff8b2;return new Promise(function(_0x29fc16){return db['CmContactHasItem'][_0x3f2e('0x19')]({'where':{'CmContactId':_0x5cf6d8['id']}})[_0x3f2e('0x18')](function(){db['ContactItemType'][_0x3f2e('0x20')]({'raw':!![],'attributes':['id',_0x3f2e('0x84')]})[_0x3f2e('0x18')](function(_0xcfd3a7){var _0x5af0ab=[];for(var _0x3b860e=0x0;_0x3b860e<_0x5cf6d8[_0x3f2e('0x85')][_0x3f2e('0x2c')];_0x3b860e++){var _0x42ad42=_0x5cf6d8[_0x3f2e('0x86')]?_[_0x3f2e('0x54')](_0x5cf6d8[_0x3f2e('0x86')][_0x3b860e])?'':_0x5cf6d8['item_types'][_0x3b860e]:_0x5cf6d8['items'][_0x3b860e][_0x3f2e('0x87')]?_0x5cf6d8['items'][_0x3b860e][_0x3f2e('0x87')]:'';var _0x30d9ea=_[_0x3f2e('0x54')](_0x5cf6d8[_0x3f2e('0x85')][_0x3b860e][_0x3f2e('0x88')])?'':_0x5cf6d8[_0x3f2e('0x85')][_0x3b860e]['description'];var _0x19cdcf=_0x42ad42+':'+_0x5cf6d8[_0x3f2e('0x85')][_0x3b860e][_0x3f2e('0x72')]+'§'+_0x30d9ea;if(_[_0x3f2e('0x54')](_0x1ff8b2))_0x1ff8b2=_0x19cdcf;else _0x1ff8b2+=';'+_0x19cdcf;var _0xbb6a3f=null;var _0x3bc460=null;if(_0x5cf6d8[_0x3f2e('0x86')]){if(!_['isNil'](_0x5cf6d8[_0x3f2e('0x86')][_0x3b860e])){_0x3bc460=_['find'](_0xcfd3a7,function(_0x5bf313){return _0x5bf313['id']===_0x5cf6d8[_0x3f2e('0x86')][_0x3b860e];});if(!_[_0x3f2e('0x54')](_0x3bc460)){_0xbb6a3f=_0x3bc460[_0x3f2e('0x84')];}}}else{if(!_[_0x3f2e('0x54')](_0x5cf6d8[_0x3f2e('0x85')][_0x3b860e])){_0x3bc460=_['find'](_0xcfd3a7,function(_0x43a72f){return _0x43a72f['id']===_0x5cf6d8[_0x3f2e('0x85')][_0x3b860e][_0x3f2e('0x87')];});if(!_[_0x3f2e('0x54')](_0x3bc460)){_0xbb6a3f=_0x3b860e;}}}if(_[_0x3f2e('0x54')](_0xbb6a3f)){_0xbb6a3f=0x64;}_0x5af0ab['push'](addAdditionalPhone(_0x5cf6d8['id'],_0x5cf6d8['items'][_0x3b860e]['phone'],_0x5cf6d8[_0x3f2e('0x86')]?_[_0x3f2e('0x54')](_0x5cf6d8[_0x3f2e('0x86')][_0x3b860e])?null:_0x5cf6d8[_0x3f2e('0x86')][_0x3b860e]:_0x5cf6d8['items'][_0x3b860e]['ItemTypeId']?_0x5cf6d8[_0x3f2e('0x85')][_0x3b860e]['ItemTypeId']:null,_0xbb6a3f,_0x30d9ea));}Promise[_0x3f2e('0x62')](_0x5af0ab)[_0x3f2e('0x18')](function(){db[_0x3f2e('0x23')][_0x3f2e('0x17')]({'AdditionalPhones':_0x1ff8b2},{'where':{'id':_0x5cf6d8['id']}})[_0x3f2e('0x18')](function(){_0x29fc16(0x1);});});});});});}function addAdditionalPhone(_0x45bb8e,_0x36d0f1,_0x197b83,_0x2772fa,_0x1821d9){return db[_0x3f2e('0x49')][_0x3f2e('0x24')]({'where':{'CmContactId':_0x45bb8e,'item':_0x36d0f1}})[_0x3f2e('0x18')](function(_0x4cb5a9){if(_0x4cb5a9)logger['info'](_0x3f2e('0x89'),_0x4cb5a9);else{db[_0x3f2e('0x49')][_0x3f2e('0x53')]({'CmContactId':_0x45bb8e,'item':_0x36d0f1,'ItemTypeId':_0x197b83,'OrderBy':_0x2772fa,'ItemClass':_0x3f2e('0x8a'),'description':_0x1821d9});}});}function deleteCmHopperPhones(_0x9c6878){return new Promise(function(_0x3e8c56){return db[_0x3f2e('0x3d')][_0x3f2e('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x9c6878}})[_0x3f2e('0x18')](function(_0x280206){db[_0x3f2e('0x8b')][_0x3f2e('0x19')]({'where':{'CmHopperId':{'$in':_[_0x3f2e('0x7e')](_0x280206,'id')}}});})[_0x3f2e('0x18')](function(){_0x3e8c56(0x1);});});}function addCmHopperPhones(_0x40be4c){return new Promise(function(_0x3a01d1){return db[_0x3f2e('0x3d')][_0x3f2e('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x40be4c}})['then'](function(_0x4b6d36){var _0x51f1cc=[];_['map'](_0x4b6d36,function(_0x25a906){_0x51f1cc[_0x3f2e('0x5c')](createCmHopperPhone(_0x40be4c,_0x25a906['id']));});Promise[_0x3f2e('0x62')](_0x51f1cc)[_0x3f2e('0x18')](function(){_0x3a01d1(0x1);});});});}function createCmHopperPhone(_0x253498,_0x404ca6){return new Promise(function(_0x33a4de){db[_0x3f2e('0x49')]['findAll']({'raw':!![],'attributes':['item','OrderBy'],'where':{'CmContactId':_0x253498,'ItemClass':_0x3f2e('0x8a')},'include':[{'model':db[_0x3f2e('0x8c')],'attributes':[_0x3f2e('0x84')],'as':_0x3f2e('0x67')}],'order':[_0x3f2e('0x84'),db['sequelize']['literal'](_0x3f2e('0x8d'))]})[_0x3f2e('0x18')](function(_0x18b61f){var _0x27cd52=0x1;var _0x2ec9ed=_['map'](_0x18b61f,function(_0x2b4182){_0x2b4182[_0x3f2e('0x8e')]=_0x404ca6;_0x2b4182[_0x3f2e('0x72')]=_0x2b4182[_0x3f2e('0x8f')];_0x2b4182[_0x3f2e('0x84')]=_0x27cd52;delete _0x2b4182[_0x3f2e('0x90')];_0x27cd52=_0x27cd52+0x1;return _0x2b4182;});return db[_0x3f2e('0x8b')]['bulkCreate'](_0x2ec9ed,{});})[_0x3f2e('0x18')](function(){_0x33a4de(0x1);});});}function insertAdditionalPhones(_0x393abc,_0x121782){return new Promise(function(_0x9e6db6){var _0x2d1b48=[];for(var _0x223835=0x0;_0x223835<_0x121782['length'];_0x223835++){var _0x5442d0=_0x121782[_0x223835];_0x2d1b48[_0x3f2e('0x5c')](parseContactItemType(_0x5442d0));}Promise[_0x3f2e('0x62')](_0x2d1b48)[_0x3f2e('0x18')](function(){var _0x2225dd={'id':_0x393abc['id'],'items':_0x121782};return addAdditionalPhones(_0x2225dd)[_0x3f2e('0x18')](function(){return addCmHopperPhones(_0x393abc['id']);});})[_0x3f2e('0x18')](function(){_0x9e6db6(_0x393abc);});});}function parseContactItemType(_0x2305f8){return new Promise(function(_0x320b5e){if(_0x2305f8[_0x3f2e('0x60')]('ItemTypeId')){_0x320b5e(_0x2305f8);}else{return db[_0x3f2e('0x8c')][_0x3f2e('0x24')]({'where':{'name':_0x2305f8['ItemType']}})['then'](function(_0x297cb4){if(_[_0x3f2e('0x54')](_0x297cb4))_0x2305f8[_0x3f2e('0x87')]=null;else _0x2305f8['ItemTypeId']=_0x297cb4['id'];_0x320b5e(_0x2305f8);});}});}exports[_0x3f2e('0x91')]=function(_0x135a2f,_0x13f6d5){return db[_0x3f2e('0x49')][_0x3f2e('0x20')]({'raw':!![],'where':{'CmContactId':_0x135a2f[_0x3f2e('0x25')]['id'],'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'as':_0x3f2e('0x67')}],'order':[['OrderBy'],[db['sequelize'][_0x3f2e('0x68')](_0x3f2e('0x8d'))]]})['then'](function(_0x33f525){return _0x33f525;})[_0x3f2e('0x18')](respondWithResult(_0x13f6d5,null))[_0x3f2e('0x22')](handleError(_0x13f6d5,null));};exports['duplicateAdditionalPhones']=function(_0x1bd7e8,_0x3e8813){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x1bd7e8['body'][_0x3f2e('0x92')]}})[_0x3f2e('0x18')](function(_0x58eceb){var _0x545dee=_['map'](_0x58eceb,function(_0x30b2ff){_0x30b2ff[_0x3f2e('0x93')]=_0x1bd7e8['body'][_0x3f2e('0x94')];return _0x30b2ff;});return db[_0x3f2e('0x49')][_0x3f2e('0x95')](_0x545dee,{});})[_0x3f2e('0x18')](function(){return addCmHopperPhones(_0x1bd7e8[_0x3f2e('0x36')][_0x3f2e('0x94')]);})[_0x3f2e('0x18')](function(){return['ok'];})[_0x3f2e('0x18')](respondWithResult(_0x3e8813,null))[_0x3f2e('0x22')](handleError(_0x3e8813,null));};exports[_0x3f2e('0x96')]=function(_0x34854c,_0x52f5a8){var _0x45ab30=[];_0x45ab30[_0x3f2e('0x5c')](createCmHopperPhone(_0x34854c[_0x3f2e('0x36')]['id'],_0x34854c[_0x3f2e('0x36')][_0x3f2e('0x97')]));Promise[_0x3f2e('0x62')](_0x45ab30)[_0x3f2e('0x18')](function(){return[0x1];})[_0x3f2e('0x18')](respondWithResult(_0x52f5a8,null));};exports[_0x3f2e('0x98')]=function(_0x2f4412,_0x1f222f){var _0x3353ae={'raw':![],'where':{}};var _0x333685={};var _0x4186e5={'count':0x0,'rows':[]};return db[_0x3f2e('0x23')][_0x3f2e('0x81')]({'where':{'id':_0x2f4412['params']['id']}})[_0x3f2e('0x18')](handleEntityNotFound(_0x1f222f,null))['then'](function(_0x31a7d9){if(_0x31a7d9){_0x333685[_0x3f2e('0x74')]=_[_0x3f2e('0x27')](db[_0x3f2e('0x3d')][_0x3f2e('0x75')]);_0x333685[_0x3f2e('0x21')]=_['keys'](_0x2f4412[_0x3f2e('0x21')]);_0x333685['filters']=_[_0x3f2e('0x77')](_0x333685[_0x3f2e('0x74')],_0x333685[_0x3f2e('0x21')]);_0x3353ae[_0x3f2e('0x78')]=_[_0x3f2e('0x77')](_0x333685['model'],qs[_0x3f2e('0x79')](_0x2f4412['query'][_0x3f2e('0x79')]));_0x3353ae['attributes']=_0x3353ae['attributes'][_0x3f2e('0x2c')]?_0x3353ae[_0x3f2e('0x78')]:_0x333685[_0x3f2e('0x74')];if(!_0x2f4412[_0x3f2e('0x21')]['hasOwnProperty'](_0x3f2e('0x80'))){_0x3353ae[_0x3f2e('0x14')]=qs['limit'](_0x2f4412[_0x3f2e('0x21')][_0x3f2e('0x14')]);_0x3353ae[_0x3f2e('0x12')]=qs['offset'](_0x2f4412[_0x3f2e('0x21')]['offset']);}_0x3353ae[_0x3f2e('0x7a')]=qs['sort'](_0x2f4412['query'][_0x3f2e('0x7b')]);_0x3353ae['where']=qs[_0x3f2e('0x76')](_['pick'](_0x2f4412[_0x3f2e('0x21')],_0x333685['filters']));_0x3353ae[_0x3f2e('0x5a')]['ContactId']=_0x31a7d9['id'];if(_0x2f4412[_0x3f2e('0x21')][_0x3f2e('0x7d')]){_0x3353ae[_0x3f2e('0x5a')]=_[_0x3f2e('0x35')](_0x3353ae['where'],{'$or':_[_0x3f2e('0x7e')](_0x3353ae[_0x3f2e('0x78')],function(_0x462712){var _0x312980={};_0x312980[_0x462712]={'$like':'%'+_0x2f4412[_0x3f2e('0x21')][_0x3f2e('0x7d')]+'%'};return _0x312980;})});}_0x3353ae=_[_0x3f2e('0x35')]({},_0x3353ae,_0x2f4412[_0x3f2e('0x7f')]);return db[_0x3f2e('0x3d')][_0x3f2e('0x15')]({'where':_0x3353ae[_0x3f2e('0x5a')]})[_0x3f2e('0x18')](function(_0xa7637){_0x4186e5['count']=_0xa7637;if(_0x2f4412['query']['includeAll']){_0x3353ae[_0x3f2e('0x99')]=[{'all':!![]}];}return db[_0x3f2e('0x3d')]['findAll'](_0x3353ae);})[_0x3f2e('0x18')](function(_0x3aceeb){_0x4186e5[_0x3f2e('0x9a')]=_0x3aceeb;return _0x4186e5;});}})[_0x3f2e('0x18')](respondWithFilteredResult(_0x1f222f,_0x3353ae))[_0x3f2e('0x22')](handleError(_0x1f222f,null));};exports[_0x3f2e('0x9b')]=function(_0x1ac501,_0xa2ad71){var _0x5b97bd={'raw':!![],'where':{}};var _0xe48980={};var _0xaadaf4={'count':0x0,'rows':[]};return db[_0x3f2e('0x23')][_0x3f2e('0x81')]({'where':{'id':_0x1ac501[_0x3f2e('0x25')]['id']}})['then'](handleEntityNotFound(_0xa2ad71,null))[_0x3f2e('0x18')](function(_0x2b8832){if(_0x2b8832){_0xe48980[_0x3f2e('0x74')]=_[_0x3f2e('0x27')](db['CmHopperHistory'][_0x3f2e('0x75')]);_0xe48980[_0x3f2e('0x21')]=_[_0x3f2e('0x27')](_0x1ac501[_0x3f2e('0x21')]);_0xe48980[_0x3f2e('0x76')]=_['intersection'](_0xe48980[_0x3f2e('0x74')],_0xe48980[_0x3f2e('0x21')]);_0x5b97bd[_0x3f2e('0x78')]=_[_0x3f2e('0x77')](_0xe48980[_0x3f2e('0x74')],qs[_0x3f2e('0x79')](_0x1ac501[_0x3f2e('0x21')][_0x3f2e('0x79')]));_0x5b97bd[_0x3f2e('0x78')]=_0x5b97bd[_0x3f2e('0x78')][_0x3f2e('0x2c')]?_0x5b97bd[_0x3f2e('0x78')]:_0xe48980['model'];if(!_0x1ac501[_0x3f2e('0x21')][_0x3f2e('0x60')](_0x3f2e('0x80'))){_0x5b97bd[_0x3f2e('0x14')]=qs['limit'](_0x1ac501[_0x3f2e('0x21')][_0x3f2e('0x14')]);_0x5b97bd['offset']=qs['offset'](_0x1ac501[_0x3f2e('0x21')]['offset']);}_0x5b97bd[_0x3f2e('0x7a')]=qs[_0x3f2e('0x7b')](_0x1ac501[_0x3f2e('0x21')][_0x3f2e('0x7b')]);_0x5b97bd[_0x3f2e('0x5a')]=qs['filters'](_['pick'](_0x1ac501['query'],_0xe48980[_0x3f2e('0x76')]));_0x5b97bd[_0x3f2e('0x5a')][_0x3f2e('0x9c')]=_0x2b8832['id'];if(_0x1ac501[_0x3f2e('0x21')][_0x3f2e('0x7d')]){_0x5b97bd[_0x3f2e('0x5a')]=_[_0x3f2e('0x35')](_0x5b97bd[_0x3f2e('0x5a')],{'$or':_[_0x3f2e('0x7e')](_0x5b97bd[_0x3f2e('0x78')],function(_0x445066){var _0x506682={};_0x506682[_0x445066]={'$like':'%'+_0x1ac501[_0x3f2e('0x21')][_0x3f2e('0x7d')]+'%'};return _0x506682;})});}_0x5b97bd=_['merge']({},_0x5b97bd,_0x1ac501[_0x3f2e('0x7f')]);return db[_0x3f2e('0x9d')][_0x3f2e('0x15')]({'where':_0x5b97bd['where']})['then'](function(_0x2312a8){_0xaadaf4[_0x3f2e('0x15')]=_0x2312a8;if(_0x1ac501[_0x3f2e('0x21')][_0x3f2e('0x9e')]){_0x5b97bd[_0x3f2e('0x99')]=[{'all':!![]}];}return db[_0x3f2e('0x9d')]['findAll'](_0x5b97bd);})[_0x3f2e('0x18')](function(_0x83a0f5){_0xaadaf4[_0x3f2e('0x9a')]=_0x83a0f5;return _0xaadaf4;});}})['then'](respondWithFilteredResult(_0xa2ad71,_0x5b97bd))['catch'](handleError(_0xa2ad71,null));};exports[_0x3f2e('0x9f')]=function(_0x439a00,_0x4c70fa){var _0x24b8d8={'raw':!![],'where':{}};var _0x2a0262={};var _0x45d330={'count':0x0,'rows':[]};return db[_0x3f2e('0x23')][_0x3f2e('0x81')]({'where':{'id':_0x439a00['params']['id']}})['then'](handleEntityNotFound(_0x4c70fa,null))[_0x3f2e('0x18')](function(_0x5bd7af){if(_0x5bd7af){_0x2a0262[_0x3f2e('0x74')]=_['keys'](db[_0x3f2e('0xa0')][_0x3f2e('0x75')]);_0x2a0262[_0x3f2e('0x21')]=_[_0x3f2e('0x27')](_0x439a00[_0x3f2e('0x21')]);_0x2a0262['filters']=_['intersection'](_0x2a0262[_0x3f2e('0x74')],_0x2a0262['query']);_0x24b8d8[_0x3f2e('0x78')]=_[_0x3f2e('0x77')](_0x2a0262[_0x3f2e('0x74')],qs[_0x3f2e('0x79')](_0x439a00[_0x3f2e('0x21')][_0x3f2e('0x79')]));_0x24b8d8[_0x3f2e('0x78')]=_0x24b8d8[_0x3f2e('0x78')]['length']?_0x24b8d8[_0x3f2e('0x78')]:_0x2a0262[_0x3f2e('0x74')];if(!_0x439a00['query'][_0x3f2e('0x60')](_0x3f2e('0x80'))){_0x24b8d8[_0x3f2e('0x14')]=qs[_0x3f2e('0x14')](_0x439a00['query'][_0x3f2e('0x14')]);_0x24b8d8[_0x3f2e('0x12')]=qs[_0x3f2e('0x12')](_0x439a00[_0x3f2e('0x21')]['offset']);}_0x24b8d8[_0x3f2e('0x7a')]=qs[_0x3f2e('0x7b')](_0x439a00[_0x3f2e('0x21')]['sort']);_0x24b8d8[_0x3f2e('0x5a')]=qs[_0x3f2e('0x76')](_[_0x3f2e('0x7c')](_0x439a00['query'],_0x2a0262['filters']));_0x24b8d8['where'][_0x3f2e('0x9c')]=_0x5bd7af['id'];if(_0x439a00['query'][_0x3f2e('0x7d')]){_0x24b8d8[_0x3f2e('0x5a')]=_[_0x3f2e('0x35')](_0x24b8d8['where'],{'$or':_[_0x3f2e('0x7e')](_0x24b8d8[_0x3f2e('0x78')],function(_0x47d040){var _0x28122e={};_0x28122e[_0x47d040]={'$like':'%'+_0x439a00[_0x3f2e('0x21')][_0x3f2e('0x7d')]+'%'};return _0x28122e;})});}_0x24b8d8=_[_0x3f2e('0x35')]({},_0x24b8d8,_0x439a00[_0x3f2e('0x7f')]);return db[_0x3f2e('0xa0')][_0x3f2e('0x15')]({'where':_0x24b8d8['where']})[_0x3f2e('0x18')](function(_0x2ad299){_0x45d330['count']=_0x2ad299;if(_0x439a00[_0x3f2e('0x21')][_0x3f2e('0x9e')]){_0x24b8d8[_0x3f2e('0x99')]=[{'all':!![]}];}return db[_0x3f2e('0xa0')][_0x3f2e('0x20')](_0x24b8d8);})[_0x3f2e('0x18')](function(_0x598750){_0x45d330[_0x3f2e('0x9a')]=_0x598750;return _0x45d330;});}})['then'](respondWithFilteredResult(_0x4c70fa,_0x24b8d8))[_0x3f2e('0x22')](handleError(_0x4c70fa,null));};exports[_0x3f2e('0xa1')]=function(_0x3b8312,_0x2012bf){var _0x4b9fd4={'raw':!![],'where':{}};var _0x1731ea={};var _0x2d2229={'count':0x0,'rows':[]};return db[_0x3f2e('0x23')][_0x3f2e('0x81')]({'where':{'id':_0x3b8312[_0x3f2e('0x25')]['id']}})[_0x3f2e('0x18')](handleEntityNotFound(_0x2012bf,null))[_0x3f2e('0x18')](function(_0x41041f){if(_0x41041f){_0x1731ea['model']=_[_0x3f2e('0x27')](db[_0x3f2e('0x50')]['rawAttributes']);_0x1731ea[_0x3f2e('0x21')]=_['keys'](_0x3b8312[_0x3f2e('0x21')]);_0x1731ea[_0x3f2e('0x76')]=_[_0x3f2e('0x77')](_0x1731ea[_0x3f2e('0x74')],_0x1731ea[_0x3f2e('0x21')]);_0x4b9fd4[_0x3f2e('0x78')]=_[_0x3f2e('0x77')](_0x1731ea[_0x3f2e('0x74')],qs['fields'](_0x3b8312['query']['fields']));_0x4b9fd4['attributes']=_0x4b9fd4[_0x3f2e('0x78')][_0x3f2e('0x2c')]?_0x4b9fd4[_0x3f2e('0x78')]:_0x1731ea['model'];if(!_0x3b8312[_0x3f2e('0x21')][_0x3f2e('0x60')](_0x3f2e('0x80'))){_0x4b9fd4[_0x3f2e('0x14')]=qs[_0x3f2e('0x14')](_0x3b8312['query']['limit']);_0x4b9fd4['offset']=qs[_0x3f2e('0x12')](_0x3b8312[_0x3f2e('0x21')][_0x3f2e('0x12')]);}_0x4b9fd4[_0x3f2e('0x7a')]=qs['sort'](_0x3b8312[_0x3f2e('0x21')]['sort']);_0x4b9fd4[_0x3f2e('0x5a')]=qs[_0x3f2e('0x76')](_[_0x3f2e('0x7c')](_0x3b8312[_0x3f2e('0x21')],_0x1731ea[_0x3f2e('0x76')]));_0x4b9fd4[_0x3f2e('0x5a')][_0x3f2e('0x9c')]=_0x41041f['id'];if(_0x3b8312[_0x3f2e('0x21')][_0x3f2e('0x7d')]){_0x4b9fd4[_0x3f2e('0x5a')]=_[_0x3f2e('0x35')](_0x4b9fd4[_0x3f2e('0x5a')],{'$or':_[_0x3f2e('0x7e')](_0x4b9fd4[_0x3f2e('0x78')],function(_0x1867e4){var _0x32abf6={};_0x32abf6[_0x1867e4]={'$like':'%'+_0x3b8312[_0x3f2e('0x21')][_0x3f2e('0x7d')]+'%'};return _0x32abf6;})});}_0x4b9fd4=_[_0x3f2e('0x35')]({},_0x4b9fd4,_0x3b8312[_0x3f2e('0x7f')]);return db[_0x3f2e('0x50')]['count']({'where':_0x4b9fd4[_0x3f2e('0x5a')]})[_0x3f2e('0x18')](function(_0x1c0ebb){_0x2d2229['count']=_0x1c0ebb;if(_0x3b8312[_0x3f2e('0x21')][_0x3f2e('0x9e')]){_0x4b9fd4[_0x3f2e('0x99')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x4b9fd4);})[_0x3f2e('0x18')](function(_0x516437){_0x2d2229[_0x3f2e('0x9a')]=_0x516437;return _0x2d2229;});}})[_0x3f2e('0x18')](respondWithFilteredResult(_0x2012bf,_0x4b9fd4))[_0x3f2e('0x22')](handleError(_0x2012bf,null));};exports[_0x3f2e('0xa2')]=function(_0x364a2c,_0x3725a6){try{if(!_0x364a2c['body'][_0x3f2e('0x5d')]){throw new Error(_0x3f2e('0xa3'));}if(!_0x364a2c['body']['binding_keys']){throw new Error(_0x3f2e('0xa4'));}if(!_0x364a2c[_0x3f2e('0x36')][_0x3f2e('0xa5')]){throw new Error(_0x3f2e('0xa6'));}if(!_0x364a2c[_0x3f2e('0x36')][_0x3f2e('0xa7')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x1c8b6e=_0x364a2c['body'][_0x3f2e('0xa8')][_0x3f2e('0xa9')](',');var _0x19de89=_0x364a2c[_0x3f2e('0x36')][_0x3f2e('0xa5')]['split'](',');if(!_0x1c8b6e['length']||!_0x19de89[_0x3f2e('0x2c')]||_0x1c8b6e[_0x3f2e('0x2c')]!==_0x19de89[_0x3f2e('0x2c')]){throw new Error(_0x3f2e('0xaa'));}_0x364a2c[_0x3f2e('0x36')][_0x3f2e('0x79')]=_[_0x3f2e('0xab')](_0x1c8b6e,_0x19de89);if(!_0x364a2c[_0x3f2e('0x36')][_0x3f2e('0x79')][_0x3f2e('0x72')]){throw new Error(_0x3f2e('0xac'));}if(!_0x364a2c[_0x3f2e('0x36')][_0x3f2e('0x79')][_0x3f2e('0xad')]){throw new Error(_0x3f2e('0xae'));}var _0x3185bb=path[_0x3f2e('0x3b')](config[_0x3f2e('0xaf')],_0x3f2e('0xb0'),_0x364a2c[_0x3f2e('0xb1')][_0x3f2e('0xb2')]);fs[_0x3f2e('0xb3')](_0x3185bb,parseInt(_0x3f2e('0xb4'),0x8));var _0x13aaf8=require(_0x3f2e('0xb5'))[_0x3f2e('0xb6')](path['join'](__dirname,'../../components/import/cm/csv'),[_0x3185bb,_0x364a2c['body'][_0x3f2e('0xa8')],_0x364a2c[_0x3f2e('0x36')][_0x3f2e('0xa5')],_0x364a2c[_0x3f2e('0x36')][_0x3f2e('0x5d')],_0x364a2c[_0x3f2e('0x36')][_0x3f2e('0xb7')],_0x364a2c[_0x3f2e('0x36')]['duplicates'],_0x364a2c['body'][_0x3f2e('0xa7')]]);return _0x3725a6[_0x3f2e('0x10')](0xc8)[_0x3f2e('0x11')]({'message':_0x3f2e('0xb8'),'pid':_0x13aaf8[_0x3f2e('0xb9')]});}catch(_0x25b520){return _0x3725a6['status'](0x1f4)[_0x3f2e('0x1d')](_0x25b520);}};exports[_0x3f2e('0xba')]=function(_0x64401c,_0x48fc61){var _0x3a97d8=fs[_0x3f2e('0xbb')](_0x64401c['file']['path']);Papa[_0x3f2e('0xbc')](_0x3a97d8,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x12bde8){return _0x48fc61['status'](0xc8)[_0x3f2e('0x11')]({'file':_0x64401c[_0x3f2e('0xb1')],'fields':_0x12bde8['meta'][_0x3f2e('0x79')]});}});};exports[_0x3f2e('0xbd')]=function(_0x5923a3,_0x56ecb8){return db['User'][_0x3f2e('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0x3f2e('0xbe')}})[_0x3f2e('0x18')](function(_0x227e1d){var _0x1a69c7=![];if(!_0x5923a3['body']['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x5923a3['body'][_0x3f2e('0xbf')][_0x3f2e('0x72')]){throw new Error(_0x3f2e('0xac'));}if(!_0x5923a3[_0x3f2e('0x36')][_0x3f2e('0xbf')][_0x3f2e('0xad')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x5923a3['body'][_0x3f2e('0xa7')]){throw new Error(_0x3f2e('0xc0'));}var _0x27c438=require(_0x3f2e('0xb5'))['fork'](path[_0x3f2e('0x3b')](__dirname,_0x3f2e('0xc1')),[_0x5923a3['params']['id'],JSON['stringify'](_0x5923a3[_0x3f2e('0x36')]),JSON[_0x3f2e('0xc2')](_0x227e1d)]);_0x27c438['on']('message',function(){_0x1a69c7=!![];return _0x56ecb8['status'](0xc8)[_0x3f2e('0x11')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x27c438[_0x3f2e('0xb9')]});});_0x27c438['on']('exit',function(_0x3b523f){if(_0x3b523f&&!_0x1a69c7){return _0x56ecb8[_0x3f2e('0x10')](0x1f4)['json']({'message':'error\x20child\x20process','pid':_0x27c438[_0x3f2e('0xb9')]});}});})[_0x3f2e('0x22')](handleError(_0x56ecb8,null));};exports[_0x3f2e('0xc3')]=function(_0x1ce45b,_0x5a3a29){return db[_0x3f2e('0xc4')][_0x3f2e('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0x3f2e('0xbe')}})[_0x3f2e('0x18')](function(_0x45f0b7){var _0x2ee87d=![];if(!_0x1ce45b[_0x3f2e('0x36')][_0x3f2e('0x5d')]){throw new Error(_0x3f2e('0xa3'));}if(!_0x1ce45b[_0x3f2e('0x36')][_0x3f2e('0xbf')][_0x3f2e('0x72')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x1ce45b['body'][_0x3f2e('0xbf')][_0x3f2e('0xad')]){throw new Error(_0x3f2e('0xae'));}if(!_0x1ce45b[_0x3f2e('0x36')][_0x3f2e('0xa7')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x349c99=require('child_process')[_0x3f2e('0xb6')](path['join'](__dirname,_0x3f2e('0xc5')),[_0x1ce45b[_0x3f2e('0x25')]['id'],JSON[_0x3f2e('0xc2')](_0x1ce45b[_0x3f2e('0x36')]),JSON['stringify'](_0x45f0b7)]);_0x349c99['on'](_0x3f2e('0xc6'),function(){_0x2ee87d=!![];return _0x5a3a29[_0x3f2e('0x10')](0xc8)[_0x3f2e('0x11')]({'message':_0x3f2e('0xc7'),'pid':_0x349c99['pid']});});_0x349c99['on'](_0x3f2e('0xc8'),function(_0x4ac06e){if(_0x4ac06e&&!_0x2ee87d){return _0x5a3a29['status'](0x1f4)['json']({'message':_0x3f2e('0xc9'),'pid':_0x349c99[_0x3f2e('0xb9')]});}});})[_0x3f2e('0x22')](handleError(_0x5a3a29,null));};exports[_0x3f2e('0xca')]=function(_0x39bc6b,_0x2a5588){var _0x55c2cc=[_0x3f2e('0xcb'),_0x3f2e('0xcc'),'sms',_0x3f2e('0xcd'),_0x3f2e('0xce'),'whatsapp',_0x3f2e('0xcf')];var _0x4ee479={'offset':0x0,'order':qs[_0x3f2e('0x7b')](_0x3f2e('0xd0'))},_0x4f78af={'count':0x0,'rows':[]};Promise['resolve']()[_0x3f2e('0x18')](function(){if(_0x39bc6b[_0x3f2e('0x21')][_0x3f2e('0xd1')]){if(!_[_0x3f2e('0xd2')](_0x55c2cc,_0x39bc6b['query']['channel']['toLowerCase']())){throw new Error(_0x3f2e('0xd3'));}_0x55c2cc=[_0x39bc6b['query'][_0x3f2e('0xd1')][_0x3f2e('0xd4')]()];}if(_0x39bc6b[_0x3f2e('0x21')][_0x3f2e('0xd5')]){try{var _0x142b46=JSON['parse'](_0x39bc6b['query']['range']);if(!moment(_0x142b46['from'])[_0x3f2e('0xd6')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x142b46['to'])[_0x3f2e('0xd6')]()){throw new Error(_0x3f2e('0xd7'));}}catch(_0x334bf5){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x39bc6b[_0x3f2e('0x21')][_0x3f2e('0x60')](_0x3f2e('0x80'))){_0x4ee479[_0x3f2e('0x14')]=qs[_0x3f2e('0x14')](_0x39bc6b[_0x3f2e('0x21')][_0x3f2e('0x14')]||0xa);_0x4ee479[_0x3f2e('0x12')]=qs[_0x3f2e('0x12')](_0x39bc6b[_0x3f2e('0x21')][_0x3f2e('0x12')]);}var _0x37ceda=_0x55c2cc[_0x3f2e('0x7e')](function(_0x3ed29e){if(_0x3ed29e===_0x3f2e('0xcf')){var _0x33c25e={'attributes':['id',_0x3f2e('0xd8'),_0x3f2e('0x2f'),_0x3f2e('0xd9'),'destination',_0x3f2e('0xda'),_0x3f2e('0xdb'),'endtime',_0x3f2e('0xdc'),_0x3f2e('0xdd'),_0x3f2e('0xde'),_0x3f2e('0xdf'),_0x3f2e('0xe0'),'userThirdDisposition',_0x3f2e('0xe1')],'where':{'ContactId':_0x39bc6b[_0x3f2e('0x25')]['id']},'include':[{'model':db[_0x3f2e('0xc4')],'as':_0x3f2e('0xc4'),'attributes':['id','name','fullname',_0x3f2e('0x2d')]}],'order':[[_0x3f2e('0xde'),_0x3f2e('0xe2')]]};if(_0x39bc6b[_0x3f2e('0x21')][_0x3f2e('0xd5')]){_0x33c25e[_0x3f2e('0x5a')]['createdAt']={'$gte':_0x142b46['from'],'$lte':_0x142b46['to']};}return db['VoiceCallReport'][_0x3f2e('0xe3')](_0x33c25e)[_0x3f2e('0x18')](function(_0x4a4c7b){_0x4f78af[_0x3f2e('0x15')]+=_0x4a4c7b['count'];return _['map'](_0x4a4c7b[_0x3f2e('0x9a')],function(_0x1654c0){var _0x3a3a8c=_0x1654c0[_0x3f2e('0x38')]({'plain':!![]});_0x3a3a8c[_0x3f2e('0xd1')]=_0x3ed29e;if(_0x3a3a8c[_0x3f2e('0xc4')]){_0x3a3a8c[_0x3f2e('0xc4')]={'id':_0x3a3a8c[_0x3f2e('0xc4')]['id'],'name':_0x3a3a8c['User']['name'],'fullname':_0x3a3a8c[_0x3f2e('0xc4')]['fullname'],'alias':_0x3a3a8c[_0x3f2e('0xc4')]['alias']};}return _0x3a3a8c;});});}else{var _0x572fee=_[_0x3f2e('0xe4')](_0x3ed29e)+(_0x3ed29e===_0x3f2e('0xcc')?_0x3f2e('0xe5'):'Account');var _0x145148={'attributes':['id',_0x3f2e('0xe6'),_0x3f2e('0xe7'),_0x3f2e('0xde'),_0x3f2e('0xdd'),'disposition',_0x3f2e('0xe8'),_0x3f2e('0xe9'),_0x3f2e('0xe1'),_0x572fee+'Id'],'where':{'ContactId':_0x39bc6b[_0x3f2e('0x25')]['id']},'include':[{'model':db[_0x572fee],'as':'Account','attributes':['id',_0x3f2e('0x1c'),_0x3f2e('0xea')]},{'model':db[_0x3f2e('0xc4')],'as':_0x3f2e('0xeb'),'attributes':['id',_0x3f2e('0x1c'),_0x3f2e('0xec')]},{'model':db[_0x3f2e('0x63')],'as':_0x3f2e('0x64'),'attributes':['id','name',_0x3f2e('0xed')],'through':{'attributes':[]}}],'order':[[_0x3f2e('0xde'),'DESC']]};if(_0x39bc6b[_0x3f2e('0x21')][_0x3f2e('0xd5')]){_0x145148['where'][_0x3f2e('0xde')]={'$gte':_0x142b46['from'],'$lte':_0x142b46['to']};}switch(_0x3ed29e){case'chat':_0x145148[_0x3f2e('0x78')][_0x3f2e('0x5c')]('browserName',_0x3f2e('0xee'),_0x3f2e('0xef'),_0x3f2e('0xf0'),_0x3f2e('0xf1'),_0x3f2e('0xf2'),'ratingType',_0x3f2e('0xf3'),_0x3f2e('0xf4'));break;case'mail':_0x145148['attributes'][_0x3f2e('0x5c')](_0x3f2e('0xf5'),_0x3f2e('0xf6'));break;case _0x3f2e('0xcd'):_0x145148[_0x3f2e('0x78')][_0x3f2e('0x5c')](_0x3f2e('0xf7'),_0x3f2e('0xf8'));break;}return db[_['startCase'](_0x3ed29e)+_0x3f2e('0xf9')][_0x3f2e('0xe3')](_0x145148)[_0x3f2e('0x18')](function(_0x2d956d){_0x4f78af[_0x3f2e('0x15')]+=_0x2d956d[_0x3f2e('0x15')];return _['map'](_0x2d956d[_0x3f2e('0x9a')],function(_0x3ea2b6){var _0x1b9e98=_0x3ea2b6['get']({'plain':!![]});_0x1b9e98['channel']=_0x3ed29e;if(_0x1b9e98['Owner']){_0x1b9e98[_0x3f2e('0xeb')]={'id':_0x1b9e98[_0x3f2e('0xeb')]['id'],'name':_0x1b9e98['Owner'][_0x3f2e('0x1c')],'fullname':_0x1b9e98['Owner'][_0x3f2e('0xec')]};}return _0x1b9e98;});});}});return Promise[_0x3f2e('0x62')](_0x37ceda);})[_0x3f2e('0x18')](function(_0x20415c){return _(_0x20415c)['flatten']()[_0x3f2e('0xfa')]('createdAt')[_0x3f2e('0xfb')]()['value']();})[_0x3f2e('0x18')](function(_0x5bcd52){_0x4f78af[_0x3f2e('0x9a')]=_0x4ee479[_0x3f2e('0x14')]?_0x5bcd52['slice'](_0x4ee479[_0x3f2e('0x12')],_0x4ee479['offset']+_0x4ee479[_0x3f2e('0x14')]):_0x5bcd52;return _0x4f78af;})['then'](respondWithFilteredResult(_0x2a5588,_0x4ee479))[_0x3f2e('0x22')](handleError(_0x2a5588,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 1512623..e147b0d 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 _0xf355=['exports','events','../../mysqldb','CmContact','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf355,0x191));var _0x5f35=function(_0xa02b05,_0xaecc61){_0xa02b05=_0xa02b05-0x0;var _0x554408=_0xf355[_0xa02b05];return _0x554408;};'use strict';var EventEmitter=require(_0x5f35('0x0'));var CmContact=require(_0x5f35('0x1'))['db'][_0x5f35('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x5f35('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5f35('0x4'),'afterDestroy':_0x5f35('0x5')};function emitEvent(_0x3b7d52){return function(_0x597343,_0x2595c6,_0x1e27ca){CmContactEvents[_0x5f35('0x6')](_0x3b7d52+':'+_0x597343['id'],_0x597343);CmContactEvents[_0x5f35('0x6')](_0x3b7d52,_0x597343);_0x1e27ca(null);};}for(var e in events){if(events[_0x5f35('0x7')](e)){var event=events[e];CmContact[_0x5f35('0x8')](e,emitEvent(event));}}module[_0x5f35('0x9')]=CmContactEvents; \ No newline at end of file +var _0x2d3a=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','CmContact','setMaxListeners'];(function(_0x57975f,_0x388556){var _0x4793b8=function(_0x652c05){while(--_0x652c05){_0x57975f['push'](_0x57975f['shift']());}};_0x4793b8(++_0x388556);}(_0x2d3a,0x1bc));var _0xa2d3=function(_0x2d8434,_0x43d781){_0x2d8434=_0x2d8434-0x0;var _0x26b9e4=_0x2d3a[_0x2d8434];return _0x26b9e4;};'use strict';var EventEmitter=require(_0xa2d3('0x0'));var CmContact=require(_0xa2d3('0x1'))['db'][_0xa2d3('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xa2d3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa2d3('0x4')};function emitEvent(_0x5b9c7a){return function(_0xe6a471,_0x261c04,_0x3aa23a){CmContactEvents[_0xa2d3('0x5')](_0x5b9c7a+':'+_0xe6a471['id'],_0xe6a471);CmContactEvents['emit'](_0x5b9c7a,_0xe6a471);_0x3aa23a(null);};}for(var e in events){if(events[_0xa2d3('0x6')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xa2d3('0x7')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 2935a4a..13b6164 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 _0x5278=['timezones','utcOffset','add','minutes','phone','callbackUniqueid','assign','findOne','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','VoiceQueueId','CmHopper','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','then','always','onlyIfOpen','findAll','outbound','CmList','Lists','map','all','Campaign','ListId','BlackLists','CmHopperBlack','exports','define','CmContact','cm_contacts','fti_cm_contacts','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','message','isEmpty','length','destroy','ContactId','push','[CmContact][afterDestroy][Succesfull]','inspect','catch','[CmContact][afterDestroy][Error]','util','../../config/logger','moment','../../config/environment/shared','VoiceQueue','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5278,0x181));var _0x8527=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x5278[_0x11ce46];return _0x368a1e;};'use strict';var _=require('lodash');var util=require(_0x8527('0x0'));var logger=require(_0x8527('0x1'))('api');var moment=require(_0x8527('0x2'));var shared=require(_0x8527('0x3'));var attributes=require('./cmContact.attributes');function getTimezoneCallbackAt(_0x423c26,_0x140cc9,_0x23d995,_0x238384){var _0x213b3e=_0x238384?'Campaign':_0x8527('0x4');var _0x766295=_0x23d995[_0x8527('0x5')]?_0x23d995['scheduledat']:moment()[_0x8527('0x6')](_0x8527('0x7'));if(_[_0x8527('0x8')](_0x23d995[_0x8527('0x9')])){return Promise[_0x8527('0xa')](_0x766295);}return _0x423c26[_0x213b3e]['findOne']({'where':{'id':_0x140cc9}})['then'](function(_0x30616c){if(_[_0x8527('0x8')](_0x30616c)||_[_0x8527('0x8')](_0x30616c[_0x8527('0x9')])){return Promise['resolve'](_0x766295);}var _0x1e493a=shared[_0x8527('0xb')];var _0x385790=_0x1e493a[_0x30616c[_0x8527('0x9')]];var _0x18a541=_0x1e493a[_0x23d995['dialTimezone']];if(_[_0x8527('0x8')](_0x385790)&&_[_0x8527('0x8')](_0x18a541)){return Promise['resolve'](_0x766295);}var _0x1deb73=_0x385790[_0x8527('0xc')]-_0x18a541[_0x8527('0xc')];var _0x534bb6=_0x23d995['scheduledat']?_0x23d995['scheduledat']:moment();_0x766295=moment(_0x534bb6)[_0x8527('0xd')](_0x1deb73,_0x8527('0xe'))[_0x8527('0x6')](_0x8527('0x7'));return Promise[_0x8527('0xa')](_0x766295);});}function getNewHopperPayload(_0x31249c){return{'phone':_0x31249c[_0x8527('0xf')],'ContactId':_0x31249c['id'],'ListId':_0x31249c['ListId'],'scheduledat':_0x31249c['scheduledat']?_0x31249c[_0x8527('0x5')]:moment()[_0x8527('0x6')](_0x8527('0x7')),'priority':_0x31249c['priority']?_0x31249c['priority']:0x2,'callback':_0x31249c['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x31249c['callbackUniqueid']?_0x31249c[_0x8527('0x10')]:undefined,'callbackat':_0x31249c[_0x8527('0x10')]?moment()[_0x8527('0x6')](_0x8527('0x7')):undefined};}function handleAlwaysCheckDuplicate(_0x18d1c4,_0x50492e,_0x3b062b,_0x5bad01){var _0x398e87={'phone':_0x3b062b[_0x8527('0xf')]};var _0x18c8c9={'calleridnum':_0x3b062b[_0x8527('0xf')]};if(_0x5bad01){Object[_0x8527('0x11')](_0x398e87,{'CampaignId':_0x50492e['id']});Object[_0x8527('0x11')](_0x18c8c9,{'CampaignId':_0x50492e['id']});}else{Object[_0x8527('0x11')](_0x398e87,{'VoiceQueueId':_0x50492e['id']});Object[_0x8527('0x11')](_0x18c8c9,{'VoiceQueueId':_0x50492e['id']});}return _0x18d1c4['CmHopper'][_0x8527('0x12')]({'where':_0x398e87})['then'](function(_0x376f01){if(_0x376f01){throw new Error(_0x8527('0x13')+_0x3b062b['phone']+'\x20in\x20Campaign\x20with\x20id\x20'+_0x50492e['id']);}return _0x18d1c4['CmHopperFinal'][_0x8527('0x12')]({'where':_0x18c8c9});})['then'](function(_0x40ad92){if(_0x40ad92){throw new Error('[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x3b062b[_0x8527('0xf')]+_0x8527('0x14')+_0x50492e['id']);}var _0x51047d=getNewHopperPayload(_0x3b062b);if(_0x5bad01){_0x51047d['CampaignId']=_0x50492e['id'];}else{_0x51047d[_0x8527('0x15')]=_0x50492e['id'];}return _0x18d1c4[_0x8527('0x16')][_0x8527('0x17')](_0x51047d);});}function handleOnlyIfOpenCheckDuplicate(_0x4d418d,_0x4b1f72,_0x3a737b,_0x3c3098){var _0x4d6246={'phone':_0x3a737b[_0x8527('0xf')]};if(_0x3c3098){Object[_0x8527('0x11')](_0x4d6246,{'CampaignId':_0x4b1f72['id']});}else{Object[_0x8527('0x11')](_0x4d6246,{'VoiceQueueId':_0x4b1f72['id']});}return _0x4d418d[_0x8527('0x16')][_0x8527('0x12')]({'where':_0x4d6246})['then'](function(_0x5d9168){if(_0x5d9168){throw new Error(_0x8527('0x18')+_0x3a737b[_0x8527('0xf')]+_0x8527('0x14')+_0x4b1f72['id']);}var _0x524271=getNewHopperPayload(_0x3a737b);if(_0x3c3098){_0x524271[_0x8527('0x19')]=_0x4b1f72['id'];}else{_0x524271[_0x8527('0x15')]=_0x4b1f72['id'];}return _0x4d418d[_0x8527('0x16')]['create'](_0x524271);});}function handleNeverCheckDuplicate(_0x3c1cac,_0x4442ba,_0x2bbe8f){var _0x33fdbb=getNewHopperPayload(_0x2bbe8f);_0x33fdbb['VoiceQueueId']=_0x4442ba['id'];return _0x3c1cac[_0x8527('0x16')]['create'](_0x33fdbb);}function handleCheckDuplicate(_0x13d8b1,_0x1632dc,_0x149089,_0xed54cb){return getTimezoneCallbackAt(_0x13d8b1,_0x1632dc,_0x149089,_0xed54cb)[_0x8527('0x1a')](function(_0x310e03){_0x149089['scheduledat']=_0x310e03;switch(_0x1632dc['dialCheckDuplicateType']){case _0x8527('0x1b'):return handleAlwaysCheckDuplicate(_0x13d8b1,_0x1632dc,_0x149089,_0xed54cb);case _0x8527('0x1c'):return handleOnlyIfOpenCheckDuplicate(_0x13d8b1,_0x1632dc,_0x149089,_0xed54cb);default:return handleNeverCheckDuplicate(_0x13d8b1,_0x1632dc,_0x149089);}});}function createHopperForVoiceQueues(_0x3c9499,_0x3312b6){return _0x3c9499[_0x8527('0x4')][_0x8527('0x1d')]({'where':{'type':_0x8527('0x1e')},'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x3c9499[_0x8527('0x1f')],'as':_0x8527('0x20'),'where':{'id':_0x3312b6['ListId']}}],'raw':!![]})[_0x8527('0x1a')](function(_0x487327){var _0x571f37=_0x487327[_0x8527('0x21')](function(_0xd42a5d){return handleCheckDuplicate(_0x3c9499,_0xd42a5d,_0x3312b6,![]);});return Promise[_0x8527('0x22')](_0x571f37);});}function createHopperForCampaigns(_0x54b975,_0x2f8380){return _0x54b975[_0x8527('0x23')][_0x8527('0x1d')]({'attributes':['id','dialCheckDuplicateType',_0x8527('0x9')],'include':[{'model':_0x54b975['CmList'],'as':'Lists','where':{'id':_0x2f8380[_0x8527('0x24')]}}],'raw':!![]})[_0x8527('0x1a')](function(_0x3909b5){var _0x48f524=_0x3909b5['map'](function(_0x48b293){return handleCheckDuplicate(_0x54b975,_0x48b293,_0x2f8380,!![]);});return Promise[_0x8527('0x22')](_0x48f524);});}function createHopperBlackForVoiceQueues(_0x5d8822,_0x30167b){return _0x5d8822[_0x8527('0x4')]['findAll']({'where':{'type':_0x8527('0x1e')},'attributes':['id'],'include':[{'model':_0x5d8822[_0x8527('0x1f')],'as':_0x8527('0x25'),'where':{'id':_0x30167b[_0x8527('0x24')]}}],'raw':!![]})['then'](function(_0x501e43){var _0x458308=_0x501e43[_0x8527('0x21')](function(_0x58d007){return _0x5d8822[_0x8527('0x26')][_0x8527('0x17')]({'phone':_0x30167b['phone'],'ContactId':_0x30167b['id'],'ListId':_0x30167b[_0x8527('0x24')],'VoiceQueueId':_0x58d007['id']});});return Promise[_0x8527('0x22')](_0x458308);});}function createHopperBlackForCampaigns(_0x3a86df,_0x10566a){return _0x3a86df[_0x8527('0x23')][_0x8527('0x1d')]({'attributes':['id'],'include':[{'model':_0x3a86df[_0x8527('0x1f')],'as':_0x8527('0x25'),'where':{'id':_0x10566a[_0x8527('0x24')]}}],'raw':!![]})[_0x8527('0x1a')](function(_0x1ecbd3){var _0x1a2e09=_0x1ecbd3[_0x8527('0x21')](function(_0x4d50e0){return _0x3a86df[_0x8527('0x26')][_0x8527('0x17')]({'phone':_0x10566a[_0x8527('0xf')],'ContactId':_0x10566a['id'],'ListId':_0x10566a[_0x8527('0x24')],'CampaignId':_0x4d50e0['id']});});return Promise['all'](_0x1a2e09);});}module[_0x8527('0x27')]=function(_0x1f11a5){return _0x1f11a5[_0x8527('0x28')](_0x8527('0x29'),attributes,{'tableName':_0x8527('0x2a'),'paranoid':!![],'indexes':[{'name':_0x8527('0xf'),'fields':[_0x8527('0xf')]},{'name':_0x8527('0x2b'),'fields':[_0x8527('0x2c'),_0x8527('0x2d'),_0x8527('0xf'),_0x8527('0x2e'),_0x8527('0x2f'),_0x8527('0x30')],'type':_0x8527('0x31')}],'timestamps':!![],'charset':_0x8527('0x32'),'collate':_0x8527('0x33'),'hooks':{'afterCreate':function(_0x181207,_0x1ed4e0,_0x4a2ee4){var _0xbfb920=_0x1f11a5[_0x8527('0x34')];var _0x1a723d=_0x181207[_0x8527('0x35')]({'plain':!![]});if(!_0x1a723d[_0x8527('0x24')]){logger[_0x8527('0x36')](_0x8527('0x37')+_0x1a723d['id']);return _0x4a2ee4();}if(!_0x1a723d['phone']){return _0x4a2ee4();}return createHopperForVoiceQueues(_0xbfb920,_0x1a723d)[_0x8527('0x1a')](function(){return createHopperBlackForVoiceQueues(_0xbfb920,_0x1a723d);})[_0x8527('0x1a')](function(){return createHopperForCampaigns(_0xbfb920,_0x1a723d);})['then'](function(){return createHopperBlackForCampaigns(_0xbfb920,_0x1a723d);})[_0x8527('0x1a')](function(){return _0x4a2ee4();})['catch'](function(_0x459507){logger[_0x8527('0x36')]('[cmContact][afterCreate]',_0x459507[_0x8527('0x38')]);_0x4a2ee4();});},'afterDestroy':function(_0x37cb0d,_0x1b047c,_0x10fa71){var _0xbf011b=_0x1f11a5['models'];var _0xcb167b=_0x37cb0d[_0x8527('0x35')]({'plain':!![]});return _0xbf011b[_0x8527('0x16')][_0x8527('0x1d')]({'raw':!![],'where':{'ListId':_0xcb167b[_0x8527('0x24')],'ContactId':_0xcb167b['id']}})[_0x8527('0x1a')](function(_0x1e9a6f){if(!_[_0x8527('0x39')](_0x1e9a6f)){var _0x3ff699=[];for(var _0x2ed322=0x0;_0x2ed322<_0x1e9a6f[_0x8527('0x3a')];_0x2ed322+=0x1){var _0x5a0ea6=_0xbf011b['CmHopper'][_0x8527('0x3b')]({'where':{'ListId':_0x1e9a6f[_0x2ed322][_0x8527('0x24')],'ContactId':_0x1e9a6f[_0x2ed322][_0x8527('0x3c')],'VoiceQueueId':_0x1e9a6f[_0x2ed322][_0x8527('0x15')],'CampaignId':_0x1e9a6f[_0x2ed322][_0x8527('0x19')]}});_0x3ff699[_0x8527('0x3d')](_0x5a0ea6);}return Promise[_0x8527('0x22')](_0x3ff699);}})[_0x8527('0x1a')](function(_0x46d3c3){logger['info'](_0x8527('0x3e'),util[_0x8527('0x3f')](_0x46d3c3,{'showHidden':![],'depth':null}));_0x10fa71();})[_0x8527('0x40')](function(_0xd6bb10){logger[_0x8527('0x36')](_0x8527('0x41'),util[_0x8527('0x3f')](_0xd6bb10,{'showHidden':![],'depth':null}));_0x10fa71(_0xd6bb10);});}}});}; \ No newline at end of file +var _0x44ce=['fax','email','utf8mb4_unicode_ci','models','get','error','catch','[cmContact][afterCreate]','isEmpty','length','ContactId','push','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','inspect','lodash','util','../../config/logger','api','moment','../../config/environment/shared','./cmContact.attributes','Campaign','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','findOne','then','dialTimezone','resolve','timezones','utcOffset','minutes','ListId','priority','callbackUniqueid','phone','assign','CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','dialCheckDuplicateType','onlyIfOpen','VoiceQueue','outbound','Lists','map','findAll','all','CmList','CmHopperBlack','BlackLists','exports','define','CmContact','cm_contacts','fti_cm_contacts','mobile'];(function(_0x3d5304,_0x1e01e5){var _0x58f9ea=function(_0x3e3bc4){while(--_0x3e3bc4){_0x3d5304['push'](_0x3d5304['shift']());}};_0x58f9ea(++_0x1e01e5);}(_0x44ce,0x94));var _0xe44c=function(_0x3d035b,_0x23633a){_0x3d035b=_0x3d035b-0x0;var _0x38ddb2=_0x44ce[_0x3d035b];return _0x38ddb2;};'use strict';var _=require(_0xe44c('0x0'));var util=require(_0xe44c('0x1'));var logger=require(_0xe44c('0x2'))(_0xe44c('0x3'));var moment=require(_0xe44c('0x4'));var shared=require(_0xe44c('0x5'));var attributes=require(_0xe44c('0x6'));function getTimezoneCallbackAt(_0x17baa0,_0x37383d,_0x3b6501,_0x9b5285){var _0x264ecd=_0x9b5285?_0xe44c('0x7'):'VoiceQueue';var _0x58cfd0=_0x3b6501['scheduledat']?_0x3b6501[_0xe44c('0x8')]:moment()[_0xe44c('0x9')](_0xe44c('0xa'));if(_[_0xe44c('0xb')](_0x3b6501['dialTimezone'])){return Promise['resolve'](_0x58cfd0);}return _0x17baa0[_0x264ecd][_0xe44c('0xc')]({'where':{'id':_0x37383d}})[_0xe44c('0xd')](function(_0x400ce6){if(_[_0xe44c('0xb')](_0x400ce6)||_[_0xe44c('0xb')](_0x400ce6[_0xe44c('0xe')])){return Promise[_0xe44c('0xf')](_0x58cfd0);}var _0x5a0017=shared[_0xe44c('0x10')];var _0x59a568=_0x5a0017[_0x400ce6[_0xe44c('0xe')]];var _0x2dd7e6=_0x5a0017[_0x3b6501[_0xe44c('0xe')]];if(_[_0xe44c('0xb')](_0x59a568)&&_[_0xe44c('0xb')](_0x2dd7e6)){return Promise[_0xe44c('0xf')](_0x58cfd0);}var _0x24a5a4=_0x59a568[_0xe44c('0x11')]-_0x2dd7e6[_0xe44c('0x11')];var _0x3893ce=_0x3b6501['scheduledat']?_0x3b6501[_0xe44c('0x8')]:moment();_0x58cfd0=moment(_0x3893ce)['add'](_0x24a5a4,_0xe44c('0x12'))[_0xe44c('0x9')](_0xe44c('0xa'));return Promise['resolve'](_0x58cfd0);});}function getNewHopperPayload(_0x3dc528){return{'phone':_0x3dc528['phone'],'ContactId':_0x3dc528['id'],'ListId':_0x3dc528[_0xe44c('0x13')],'scheduledat':_0x3dc528['scheduledat']?_0x3dc528[_0xe44c('0x8')]:moment()[_0xe44c('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x3dc528[_0xe44c('0x14')]?_0x3dc528[_0xe44c('0x14')]:0x2,'callback':_0x3dc528[_0xe44c('0x15')]?!![]:![],'callbackuniqueid':_0x3dc528[_0xe44c('0x15')]?_0x3dc528['callbackUniqueid']:undefined,'callbackat':_0x3dc528[_0xe44c('0x15')]?moment()[_0xe44c('0x9')](_0xe44c('0xa')):undefined};}function handleAlwaysCheckDuplicate(_0x246951,_0x2f39b0,_0x1eecc6,_0x19f0a8){var _0x3d81d5={'phone':_0x1eecc6[_0xe44c('0x16')]};var _0x195244={'calleridnum':_0x1eecc6[_0xe44c('0x16')]};if(_0x19f0a8){Object[_0xe44c('0x17')](_0x3d81d5,{'CampaignId':_0x2f39b0['id']});Object[_0xe44c('0x17')](_0x195244,{'CampaignId':_0x2f39b0['id']});}else{Object[_0xe44c('0x17')](_0x3d81d5,{'VoiceQueueId':_0x2f39b0['id']});Object[_0xe44c('0x17')](_0x195244,{'VoiceQueueId':_0x2f39b0['id']});}return _0x246951[_0xe44c('0x18')][_0xe44c('0xc')]({'where':_0x3d81d5})['then'](function(_0x169247){if(_0x169247){throw new Error(_0xe44c('0x19')+_0x1eecc6['phone']+_0xe44c('0x1a')+_0x2f39b0['id']);}return _0x246951[_0xe44c('0x1b')][_0xe44c('0xc')]({'where':_0x195244});})[_0xe44c('0xd')](function(_0x1f85fd){if(_0x1f85fd){throw new Error(_0xe44c('0x1c')+_0x1eecc6[_0xe44c('0x16')]+_0xe44c('0x1a')+_0x2f39b0['id']);}var _0x25040=getNewHopperPayload(_0x1eecc6);if(_0x19f0a8){_0x25040[_0xe44c('0x1d')]=_0x2f39b0['id'];}else{_0x25040['VoiceQueueId']=_0x2f39b0['id'];}return _0x246951[_0xe44c('0x18')][_0xe44c('0x1e')](_0x25040);});}function handleOnlyIfOpenCheckDuplicate(_0x5d9594,_0x2d9e8f,_0x1881ba,_0x4e146a){var _0x297c44={'phone':_0x1881ba['phone']};if(_0x4e146a){Object[_0xe44c('0x17')](_0x297c44,{'CampaignId':_0x2d9e8f['id']});}else{Object[_0xe44c('0x17')](_0x297c44,{'VoiceQueueId':_0x2d9e8f['id']});}return _0x5d9594[_0xe44c('0x18')][_0xe44c('0xc')]({'where':_0x297c44})[_0xe44c('0xd')](function(_0x218cdb){if(_0x218cdb){throw new Error(_0xe44c('0x1f')+_0x1881ba[_0xe44c('0x16')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x2d9e8f['id']);}var _0x19b5de=getNewHopperPayload(_0x1881ba);if(_0x4e146a){_0x19b5de[_0xe44c('0x1d')]=_0x2d9e8f['id'];}else{_0x19b5de[_0xe44c('0x20')]=_0x2d9e8f['id'];}return _0x5d9594[_0xe44c('0x18')]['create'](_0x19b5de);});}function handleNeverCheckDuplicate(_0x2f8330,_0xb903e1,_0x17087f){var _0x1f4d48=getNewHopperPayload(_0x17087f);_0x1f4d48[_0xe44c('0x20')]=_0xb903e1['id'];return _0x2f8330[_0xe44c('0x18')][_0xe44c('0x1e')](_0x1f4d48);}function handleCheckDuplicate(_0x3b5a45,_0x18c3f7,_0x100136,_0x45abb9){return getTimezoneCallbackAt(_0x3b5a45,_0x18c3f7,_0x100136,_0x45abb9)['then'](function(_0x272da4){_0x100136['scheduledat']=_0x272da4;switch(_0x18c3f7[_0xe44c('0x21')]){case'always':return handleAlwaysCheckDuplicate(_0x3b5a45,_0x18c3f7,_0x100136,_0x45abb9);case _0xe44c('0x22'):return handleOnlyIfOpenCheckDuplicate(_0x3b5a45,_0x18c3f7,_0x100136,_0x45abb9);default:return handleNeverCheckDuplicate(_0x3b5a45,_0x18c3f7,_0x100136);}});}function createHopperForVoiceQueues(_0x593649,_0x4188ea){return _0x593649[_0xe44c('0x23')]['findAll']({'where':{'type':_0xe44c('0x24')},'attributes':['id',_0xe44c('0x21'),_0xe44c('0xe')],'include':[{'model':_0x593649['CmList'],'as':_0xe44c('0x25'),'where':{'id':_0x4188ea[_0xe44c('0x13')]}}],'raw':!![]})[_0xe44c('0xd')](function(_0x18b303){var _0x1fb594=_0x18b303[_0xe44c('0x26')](function(_0x51e1dc){return handleCheckDuplicate(_0x593649,_0x51e1dc,_0x4188ea,![]);});return Promise['all'](_0x1fb594);});}function createHopperForCampaigns(_0x43c6c0,_0x4419a6){return _0x43c6c0['Campaign'][_0xe44c('0x27')]({'attributes':['id','dialCheckDuplicateType',_0xe44c('0xe')],'include':[{'model':_0x43c6c0['CmList'],'as':_0xe44c('0x25'),'where':{'id':_0x4419a6['ListId']}}],'raw':!![]})[_0xe44c('0xd')](function(_0x5519af){var _0x13c28c=_0x5519af[_0xe44c('0x26')](function(_0x216346){return handleCheckDuplicate(_0x43c6c0,_0x216346,_0x4419a6,!![]);});return Promise[_0xe44c('0x28')](_0x13c28c);});}function createHopperBlackForVoiceQueues(_0x17aea5,_0x3c50ee){return _0x17aea5['VoiceQueue'][_0xe44c('0x27')]({'where':{'type':_0xe44c('0x24')},'attributes':['id'],'include':[{'model':_0x17aea5[_0xe44c('0x29')],'as':'BlackLists','where':{'id':_0x3c50ee['ListId']}}],'raw':!![]})[_0xe44c('0xd')](function(_0x3dd37b){var _0x22e8e9=_0x3dd37b[_0xe44c('0x26')](function(_0x11af35){return _0x17aea5[_0xe44c('0x2a')][_0xe44c('0x1e')]({'phone':_0x3c50ee['phone'],'ContactId':_0x3c50ee['id'],'ListId':_0x3c50ee[_0xe44c('0x13')],'VoiceQueueId':_0x11af35['id']});});return Promise[_0xe44c('0x28')](_0x22e8e9);});}function createHopperBlackForCampaigns(_0x35715a,_0xb68eb6){return _0x35715a[_0xe44c('0x7')][_0xe44c('0x27')]({'attributes':['id'],'include':[{'model':_0x35715a[_0xe44c('0x29')],'as':_0xe44c('0x2b'),'where':{'id':_0xb68eb6[_0xe44c('0x13')]}}],'raw':!![]})[_0xe44c('0xd')](function(_0x25b784){var _0x41d4d5=_0x25b784[_0xe44c('0x26')](function(_0x534c21){return _0x35715a[_0xe44c('0x2a')]['create']({'phone':_0xb68eb6[_0xe44c('0x16')],'ContactId':_0xb68eb6['id'],'ListId':_0xb68eb6[_0xe44c('0x13')],'CampaignId':_0x534c21['id']});});return Promise['all'](_0x41d4d5);});}module[_0xe44c('0x2c')]=function(_0x4ccbb7){return _0x4ccbb7[_0xe44c('0x2d')](_0xe44c('0x2e'),attributes,{'tableName':_0xe44c('0x2f'),'paranoid':!![],'indexes':[{'name':_0xe44c('0x16'),'fields':[_0xe44c('0x16')]},{'name':_0xe44c('0x30'),'fields':['firstName','lastName',_0xe44c('0x16'),_0xe44c('0x31'),_0xe44c('0x32'),_0xe44c('0x33')],'type':'FULLTEXT'}],'timestamps':!![],'charset':'utf8mb4','collate':_0xe44c('0x34'),'hooks':{'afterCreate':function(_0x3ae2d5,_0xbdbb48,_0x1ba50c){var _0x2c66a6=_0x4ccbb7[_0xe44c('0x35')];var _0x2bfad7=_0x3ae2d5[_0xe44c('0x36')]({'plain':!![]});if(!_0x2bfad7['ListId']){logger[_0xe44c('0x37')]('[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20'+_0x2bfad7['id']);return _0x1ba50c();}if(!_0x2bfad7[_0xe44c('0x16')]){return _0x1ba50c();}return createHopperForVoiceQueues(_0x2c66a6,_0x2bfad7)['then'](function(){return createHopperBlackForVoiceQueues(_0x2c66a6,_0x2bfad7);})[_0xe44c('0xd')](function(){return createHopperForCampaigns(_0x2c66a6,_0x2bfad7);})[_0xe44c('0xd')](function(){return createHopperBlackForCampaigns(_0x2c66a6,_0x2bfad7);})[_0xe44c('0xd')](function(){return _0x1ba50c();})[_0xe44c('0x38')](function(_0xcad04a){logger['error'](_0xe44c('0x39'),_0xcad04a['message']);_0x1ba50c();});},'afterDestroy':function(_0x94e997,_0x4b9df7,_0x2c3438){var _0x57021c=_0x4ccbb7[_0xe44c('0x35')];var _0x34911b=_0x94e997[_0xe44c('0x36')]({'plain':!![]});return _0x57021c[_0xe44c('0x18')][_0xe44c('0x27')]({'raw':!![],'where':{'ListId':_0x34911b[_0xe44c('0x13')],'ContactId':_0x34911b['id']}})[_0xe44c('0xd')](function(_0x3bc32c){if(!_[_0xe44c('0x3a')](_0x3bc32c)){var _0x591fa2=[];for(var _0x5252a1=0x0;_0x5252a1<_0x3bc32c[_0xe44c('0x3b')];_0x5252a1+=0x1){var _0x2a34a3=_0x57021c[_0xe44c('0x18')]['destroy']({'where':{'ListId':_0x3bc32c[_0x5252a1][_0xe44c('0x13')],'ContactId':_0x3bc32c[_0x5252a1][_0xe44c('0x3c')],'VoiceQueueId':_0x3bc32c[_0x5252a1][_0xe44c('0x20')],'CampaignId':_0x3bc32c[_0x5252a1]['CampaignId']}});_0x591fa2[_0xe44c('0x3d')](_0x2a34a3);}return Promise[_0xe44c('0x28')](_0x591fa2);}})['then'](function(_0x49c7e9){logger[_0xe44c('0x3e')](_0xe44c('0x3f'),util['inspect'](_0x49c7e9,{'showHidden':![],'depth':null}));_0x2c3438();})[_0xe44c('0x38')](function(_0x5c5b9c){logger['error'](_0xe44c('0x40'),util[_0xe44c('0x41')](_0x5c5b9c,{'showHidden':![],'depth':null}));_0x2c3438(_0x5c5b9c);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 4c1dcaf..58a1dc0 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x3ba8bf,_0x1dde5c){var _0x6c31f2=function(_0x12b322){while(--_0x12b322){_0x3ba8bf['push'](_0x3ba8bf['shift']());}};_0x6c31f2(++_0x1dde5c);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x412143,_0x36fbd6){var _0x523b1f=function(_0x262edd){while(--_0x262edd){_0x412143['push'](_0x412143['shift']());}};_0x523b1f(++_0x36fbd6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/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 4b4ad89..292443b 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 _0x6d0b=['PHONE','sequelize','INTEGER','STRING'];(function(_0x19eeb9,_0x284e33){var _0x4cf1b1=function(_0x3ee919){while(--_0x3ee919){_0x19eeb9['push'](_0x19eeb9['shift']());}};_0x4cf1b1(++_0x284e33);}(_0x6d0b,0x71));var _0xb6d0=function(_0x1ebed1,_0x33955e){_0x1ebed1=_0x1ebed1-0x0;var _0x11c114=_0x6d0b[_0x1ebed1];return _0x11c114;};'use strict';var Sequelize=require(_0xb6d0('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xb6d0('0x1')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xb6d0('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xb6d0('0x2')],'defaultValue':_0xb6d0('0x3')},'OrderBy':{'type':Sequelize[_0xb6d0('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xb6d0('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x8b04=['exports','STRING','PHONE','INTEGER','sequelize'];(function(_0x4da1cb,_0x3e6aec){var _0x503cb1=function(_0xaff627){while(--_0xaff627){_0x4da1cb['push'](_0x4da1cb['shift']());}};_0x503cb1(++_0x3e6aec);}(_0x8b04,0x130));var _0x48b0=function(_0x1dfa1a,_0x2a9522){_0x1dfa1a=_0x1dfa1a-0x0;var _0x1d7844=_0x8b04[_0x1dfa1a];return _0x1d7844;};'use strict';var Sequelize=require(_0x48b0('0x0'));module[_0x48b0('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x48b0('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x48b0('0x2')],'defaultValue':_0x48b0('0x3')},'OrderBy':{'type':Sequelize[_0x48b0('0x4')],'defaultValue':null},'description':{'type':Sequelize[_0x48b0('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 2389207..f823aba 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 _0xa433=['autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','get','destroy','end','error','name','send','index','map','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','type','VIRTUAL','merge','options','CmContactHasItem','includeAll','include','findAll','catch','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmContactHasItems','UserProfileSection','userProfileId'];(function(_0x5e89d8,_0x30a21a){var _0x5c1153=function(_0x2dcba0){while(--_0x2dcba0){_0x5e89d8['push'](_0x5e89d8['shift']());}};_0x5c1153(++_0x30a21a);}(_0xa433,0x158));var _0x3a43=function(_0x54bc3f,_0xad8619){_0x54bc3f=_0x54bc3f-0x0;var _0x589b84=_0xa433[_0x54bc3f];return _0x589b84;};'use strict';var emlformat=require(_0x3a43('0x0'));var rimraf=require(_0x3a43('0x1'));var zipdir=require(_0x3a43('0x2'));var jsonpatch=require(_0x3a43('0x3'));var rp=require(_0x3a43('0x4'));var moment=require(_0x3a43('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3a43('0x6'));var sox=require(_0x3a43('0x7'));var csv=require('to-csv');var ejs=require(_0x3a43('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3a43('0x9'));var squel=require('squel');var crypto=require(_0x3a43('0xa'));var jsforce=require(_0x3a43('0xb'));var deskjs=require(_0x3a43('0xc'));var toCsv=require(_0x3a43('0xd'));var querystring=require(_0x3a43('0xe'));var Papa=require(_0x3a43('0xf'));var Redis=require(_0x3a43('0x10'));var authService=require(_0x3a43('0x11'));var qs=require(_0x3a43('0x12'));var as=require(_0x3a43('0x13'));var hardwareService=require(_0x3a43('0x14'));var logger=require(_0x3a43('0x15'))(_0x3a43('0x16'));var utils=require(_0x3a43('0x17'));var config=require(_0x3a43('0x18'));var licenseUtil=require(_0x3a43('0x19'));var db=require(_0x3a43('0x1a'))['db'];function respondWithStatusCode(_0xe19ed9,_0x2f3c4a){_0x2f3c4a=_0x2f3c4a||0xcc;return function(_0x1caf06){if(_0x1caf06){return _0xe19ed9[_0x3a43('0x1b')](_0x2f3c4a);}return _0xe19ed9[_0x3a43('0x1c')](_0x2f3c4a)['end']();};}function respondWithResult(_0x502c8a,_0x3bf4fc){_0x3bf4fc=_0x3bf4fc||0xc8;return function(_0x338fd5){if(_0x338fd5){return _0x502c8a[_0x3a43('0x1c')](_0x3bf4fc)['json'](_0x338fd5);}};}function respondWithFilteredResult(_0x49afe4,_0x3ff900){return function(_0x2e8f32){if(_0x2e8f32){var _0x5002c2=typeof _0x3ff900['offset']===_0x3a43('0x1d')&&typeof _0x3ff900[_0x3a43('0x1e')]===_0x3a43('0x1d');var _0x2756d9=_0x2e8f32[_0x3a43('0x1f')];var _0x194edf=_0x5002c2?0x0:_0x3ff900['offset'];var _0x5c0a8e=_0x5002c2?_0x2e8f32[_0x3a43('0x1f')]:_0x3ff900[_0x3a43('0x20')]+_0x3ff900[_0x3a43('0x1e')];var _0x5a57a2;if(_0x5c0a8e>=_0x2756d9){_0x5c0a8e=_0x2756d9;_0x5a57a2=0xc8;}else{_0x5a57a2=0xce;}_0x49afe4[_0x3a43('0x1c')](_0x5a57a2);return _0x49afe4[_0x3a43('0x21')](_0x3a43('0x22'),_0x194edf+'-'+_0x5c0a8e+'/'+_0x2756d9)[_0x3a43('0x23')](_0x2e8f32);}return null;};}function patchUpdates(_0x130720){return function(_0x4f269b){try{jsonpatch[_0x3a43('0x24')](_0x4f269b,_0x130720,!![]);}catch(_0x450470){return BPromise[_0x3a43('0x25')](_0x450470);}return _0x4f269b[_0x3a43('0x26')]();};}function saveUpdates(_0x51f563,_0x5a9264){return function(_0x178205){if(_0x178205){return _0x178205[_0x3a43('0x27')](_0x51f563)[_0x3a43('0x28')](function(_0x1eea8e){return _0x1eea8e;});}return null;};}function removeEntity(_0x1efee4,_0x20e48d){return function(_0x305e95){if(_0x305e95){return _0x305e95['destroy']()[_0x3a43('0x28')](function(){var _0x22b8e6=_0x305e95[_0x3a43('0x29')]({'plain':!![]});var _0x5c3d68='CmContactHasItems';return db['UserProfileResource'][_0x3a43('0x2a')]({'where':{'type':_0x5c3d68,'resourceId':_0x22b8e6['id']}})[_0x3a43('0x28')](function(){return _0x305e95;});})[_0x3a43('0x28')](function(){_0x1efee4[_0x3a43('0x1c')](0xcc)[_0x3a43('0x2b')]();});}};}function handleEntityNotFound(_0x5c4621,_0x4123e2){return function(_0x20b919){if(!_0x20b919){_0x5c4621[_0x3a43('0x1b')](0x194);}return _0x20b919;};}function handleError(_0x3f1f48,_0x4f3a46){_0x4f3a46=_0x4f3a46||0x1f4;return function(_0x229ca5){logger[_0x3a43('0x2c')](_0x229ca5['stack']);if(_0x229ca5['name']){delete _0x229ca5[_0x3a43('0x2d')];}_0x3f1f48[_0x3a43('0x1c')](_0x4f3a46)[_0x3a43('0x2e')](_0x229ca5);};}exports[_0x3a43('0x2f')]=function(_0x1f77f2,_0x2b9564){var _0x3cc0c2={},_0xdf4155={},_0x12f899={'count':0x0,'rows':[]};var _0x3f9011=_[_0x3a43('0x30')](db['CmContactHasItem']['rawAttributes'],function(_0x42f9f2){return{'name':_0x42f9f2['fieldName'],'type':_0x42f9f2['type'][_0x3a43('0x31')]};});_0xdf4155[_0x3a43('0x32')]=_['map'](_0x3f9011,_0x3a43('0x2d'));_0xdf4155[_0x3a43('0x33')]=_['keys'](_0x1f77f2[_0x3a43('0x33')]);_0xdf4155['filters']=_[_0x3a43('0x34')](_0xdf4155[_0x3a43('0x32')],_0xdf4155['query']);_0x3cc0c2[_0x3a43('0x35')]=_[_0x3a43('0x34')](_0xdf4155[_0x3a43('0x32')],qs[_0x3a43('0x36')](_0x1f77f2[_0x3a43('0x33')][_0x3a43('0x36')]));_0x3cc0c2[_0x3a43('0x35')]=_0x3cc0c2[_0x3a43('0x35')][_0x3a43('0x37')]?_0x3cc0c2[_0x3a43('0x35')]:_0xdf4155[_0x3a43('0x32')];if(!_0x1f77f2[_0x3a43('0x33')][_0x3a43('0x38')](_0x3a43('0x39'))){_0x3cc0c2[_0x3a43('0x1e')]=qs[_0x3a43('0x1e')](_0x1f77f2['query']['limit']);_0x3cc0c2[_0x3a43('0x20')]=qs[_0x3a43('0x20')](_0x1f77f2['query'][_0x3a43('0x20')]);}_0x3cc0c2['order']=qs[_0x3a43('0x3a')](_0x1f77f2[_0x3a43('0x33')]['sort']);_0x3cc0c2[_0x3a43('0x3b')]=qs[_0x3a43('0x3c')](_[_0x3a43('0x3d')](_0x1f77f2['query'],_0xdf4155[_0x3a43('0x3c')]),_0x3f9011);if(_0x1f77f2['query']['filter']){_0x3cc0c2[_0x3a43('0x3b')]=_['merge'](_0x3cc0c2[_0x3a43('0x3b')],{'$or':_['map'](_0x3f9011,function(_0x171033){if(_0x171033[_0x3a43('0x3e')]!==_0x3a43('0x3f')){var _0x1f0469={};_0x1f0469[_0x171033[_0x3a43('0x2d')]]={'$like':'%'+_0x1f77f2[_0x3a43('0x33')]['filter']+'%'};return _0x1f0469;}})});}_0x3cc0c2=_[_0x3a43('0x40')]({},_0x3cc0c2,_0x1f77f2[_0x3a43('0x41')]);var _0x56cbc0={'where':_0x3cc0c2['where']};return db[_0x3a43('0x42')][_0x3a43('0x1f')](_0x56cbc0)['then'](function(_0x583b0a){_0x12f899[_0x3a43('0x1f')]=_0x583b0a;if(_0x1f77f2['query'][_0x3a43('0x43')]){_0x3cc0c2[_0x3a43('0x44')]=[{'all':!![]}];}return db[_0x3a43('0x42')][_0x3a43('0x45')](_0x3cc0c2);})[_0x3a43('0x28')](function(_0x4ac981){_0x12f899['rows']=_0x4ac981;return _0x12f899;})[_0x3a43('0x28')](respondWithFilteredResult(_0x2b9564,_0x3cc0c2))[_0x3a43('0x46')](handleError(_0x2b9564,null));};exports['show']=function(_0x4d4f6b,_0x2c9363){var _0x1bc8b9={'raw':!![],'where':{'id':_0x4d4f6b['params']['id']}},_0x204c71={};_0x204c71[_0x3a43('0x32')]=_[_0x3a43('0x47')](db[_0x3a43('0x42')][_0x3a43('0x48')]);_0x204c71['query']=_[_0x3a43('0x47')](_0x4d4f6b['query']);_0x204c71[_0x3a43('0x3c')]=_['intersection'](_0x204c71['model'],_0x204c71[_0x3a43('0x33')]);_0x1bc8b9[_0x3a43('0x35')]=_[_0x3a43('0x34')](_0x204c71[_0x3a43('0x32')],qs[_0x3a43('0x36')](_0x4d4f6b['query']['fields']));_0x1bc8b9['attributes']=_0x1bc8b9[_0x3a43('0x35')][_0x3a43('0x37')]?_0x1bc8b9[_0x3a43('0x35')]:_0x204c71[_0x3a43('0x32')];if(_0x4d4f6b[_0x3a43('0x33')][_0x3a43('0x43')]){_0x1bc8b9[_0x3a43('0x44')]=[{'all':!![]}];}_0x1bc8b9=_[_0x3a43('0x40')]({},_0x1bc8b9,_0x4d4f6b['options']);return db['CmContactHasItem'][_0x3a43('0x49')](_0x1bc8b9)['then'](handleEntityNotFound(_0x2c9363,null))[_0x3a43('0x28')](respondWithResult(_0x2c9363,null))[_0x3a43('0x46')](handleError(_0x2c9363,null));};exports[_0x3a43('0x4a')]=function(_0x1cd690,_0x234fdd){return db[_0x3a43('0x42')][_0x3a43('0x4a')](_0x1cd690[_0x3a43('0x4b')],{})[_0x3a43('0x28')](function(_0x207e48){var _0x19c720=_0x1cd690[_0x3a43('0x4c')]['get']({'plain':!![]});if(!_0x19c720)throw new Error(_0x3a43('0x4d'));if(_0x19c720['role']===_0x3a43('0x4c')){var _0x40755b=_0x207e48[_0x3a43('0x29')]({'plain':!![]});var _0x2f0030=_0x3a43('0x4e');return db[_0x3a43('0x4f')][_0x3a43('0x49')]({'where':{'name':_0x2f0030,'userProfileId':_0x19c720[_0x3a43('0x50')]},'raw':!![]})[_0x3a43('0x28')](function(_0x33b48a){if(_0x33b48a&&_0x33b48a[_0x3a43('0x51')]===0x0){return db[_0x3a43('0x52')][_0x3a43('0x4a')]({'name':_0x40755b[_0x3a43('0x2d')],'resourceId':_0x40755b['id'],'type':_0x33b48a[_0x3a43('0x2d')],'sectionId':_0x33b48a['id']},{})[_0x3a43('0x28')](function(){return _0x207e48;});}else{return _0x207e48;}})[_0x3a43('0x46')](function(_0x45989a){logger['error'](_0x3a43('0x53'),_0x45989a);throw _0x45989a;});}return _0x207e48;})[_0x3a43('0x28')](respondWithResult(_0x234fdd,0xc9))[_0x3a43('0x46')](handleError(_0x234fdd,null));};exports[_0x3a43('0x27')]=function(_0x4e89f4,_0x5a9df7){if(_0x4e89f4[_0x3a43('0x4b')]['id']){delete _0x4e89f4[_0x3a43('0x4b')]['id'];}return db[_0x3a43('0x42')][_0x3a43('0x49')]({'where':{'id':_0x4e89f4[_0x3a43('0x54')]['id']}})[_0x3a43('0x28')](handleEntityNotFound(_0x5a9df7,null))[_0x3a43('0x28')](saveUpdates(_0x4e89f4[_0x3a43('0x4b')],null))['then'](respondWithResult(_0x5a9df7,null))['catch'](handleError(_0x5a9df7,null));};exports[_0x3a43('0x2a')]=function(_0x5746f9,_0x1612a2){return db['CmContactHasItem'][_0x3a43('0x49')]({'where':{'id':_0x5746f9[_0x3a43('0x54')]['id']}})['then'](handleEntityNotFound(_0x1612a2,null))[_0x3a43('0x28')](removeEntity(_0x1612a2,null))['catch'](handleError(_0x1612a2,null));}; \ No newline at end of file +var _0x1601=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','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','get','CmContactHasItems','error','stack','name','index','map','CmContactHasItem','rawAttributes','type','model','query','keys','filters','intersection','attributes'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x1601,0xc9));var _0x1160=function(_0x2e7025,_0x187270){_0x2e7025=_0x2e7025-0x0;var _0x5373ed=_0x1601[_0x2e7025];return _0x5373ed;};'use strict';var emlformat=require(_0x1160('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1160('0x1'));var jsonpatch=require(_0x1160('0x2'));var rp=require(_0x1160('0x3'));var moment=require(_0x1160('0x4'));var BPromise=require(_0x1160('0x5'));var Mustache=require(_0x1160('0x6'));var util=require('util');var path=require(_0x1160('0x7'));var sox=require(_0x1160('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1160('0x9'));var _=require(_0x1160('0xa'));var squel=require('squel');var crypto=require(_0x1160('0xb'));var jsforce=require(_0x1160('0xc'));var deskjs=require(_0x1160('0xd'));var toCsv=require(_0x1160('0xe'));var querystring=require('querystring');var Papa=require(_0x1160('0xf'));var Redis=require(_0x1160('0x10'));var authService=require(_0x1160('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1160('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1160('0x13'))(_0x1160('0x14'));var utils=require(_0x1160('0x15'));var config=require(_0x1160('0x16'));var licenseUtil=require(_0x1160('0x17'));var db=require(_0x1160('0x18'))['db'];function respondWithStatusCode(_0x472d65,_0x5e4bc9){_0x5e4bc9=_0x5e4bc9||0xcc;return function(_0x3b0ece){if(_0x3b0ece){return _0x472d65[_0x1160('0x19')](_0x5e4bc9);}return _0x472d65[_0x1160('0x1a')](_0x5e4bc9)[_0x1160('0x1b')]();};}function respondWithResult(_0x22a592,_0x5f338d){_0x5f338d=_0x5f338d||0xc8;return function(_0x4d1ffe){if(_0x4d1ffe){return _0x22a592[_0x1160('0x1a')](_0x5f338d)[_0x1160('0x1c')](_0x4d1ffe);}};}function respondWithFilteredResult(_0x2a5194,_0x1a0ca7){return function(_0x4b38d4){if(_0x4b38d4){var _0xfca350=typeof _0x1a0ca7[_0x1160('0x1d')]===_0x1160('0x1e')&&typeof _0x1a0ca7[_0x1160('0x1f')]===_0x1160('0x1e');var _0x191cf4=_0x4b38d4['count'];var _0x427b28=_0xfca350?0x0:_0x1a0ca7['offset'];var _0x3018e6=_0xfca350?_0x4b38d4[_0x1160('0x20')]:_0x1a0ca7[_0x1160('0x1d')]+_0x1a0ca7[_0x1160('0x1f')];var _0x4898c5;if(_0x3018e6>=_0x191cf4){_0x3018e6=_0x191cf4;_0x4898c5=0xc8;}else{_0x4898c5=0xce;}_0x2a5194[_0x1160('0x1a')](_0x4898c5);return _0x2a5194[_0x1160('0x21')](_0x1160('0x22'),_0x427b28+'-'+_0x3018e6+'/'+_0x191cf4)['json'](_0x4b38d4);}return null;};}function patchUpdates(_0x7e4362){return function(_0x41e511){try{jsonpatch[_0x1160('0x23')](_0x41e511,_0x7e4362,!![]);}catch(_0x4849a8){return BPromise[_0x1160('0x24')](_0x4849a8);}return _0x41e511[_0x1160('0x25')]();};}function saveUpdates(_0x4081b1,_0x4acd5d){return function(_0x340716){if(_0x340716){return _0x340716[_0x1160('0x26')](_0x4081b1)[_0x1160('0x27')](function(_0x4173d){return _0x4173d;});}return null;};}function removeEntity(_0x230acf,_0x1562a0){return function(_0x2f37e7){if(_0x2f37e7){return _0x2f37e7[_0x1160('0x28')]()['then'](function(){var _0x2e4409=_0x2f37e7[_0x1160('0x29')]({'plain':!![]});var _0x52026a=_0x1160('0x2a');return db['UserProfileResource'][_0x1160('0x28')]({'where':{'type':_0x52026a,'resourceId':_0x2e4409['id']}})[_0x1160('0x27')](function(){return _0x2f37e7;});})['then'](function(){_0x230acf[_0x1160('0x1a')](0xcc)[_0x1160('0x1b')]();});}};}function handleEntityNotFound(_0x5c78bf,_0x5c0034){return function(_0x6ee882){if(!_0x6ee882){_0x5c78bf[_0x1160('0x19')](0x194);}return _0x6ee882;};}function handleError(_0x1752b1,_0x4e0562){_0x4e0562=_0x4e0562||0x1f4;return function(_0x280fef){logger[_0x1160('0x2b')](_0x280fef[_0x1160('0x2c')]);if(_0x280fef[_0x1160('0x2d')]){delete _0x280fef[_0x1160('0x2d')];}_0x1752b1[_0x1160('0x1a')](_0x4e0562)['send'](_0x280fef);};}exports[_0x1160('0x2e')]=function(_0x785fe8,_0x398251){var _0x30418d={},_0x49b257={},_0x10093e={'count':0x0,'rows':[]};var _0x38782c=_[_0x1160('0x2f')](db[_0x1160('0x30')][_0x1160('0x31')],function(_0x228fe8){return{'name':_0x228fe8['fieldName'],'type':_0x228fe8[_0x1160('0x32')]['key']};});_0x49b257[_0x1160('0x33')]=_['map'](_0x38782c,_0x1160('0x2d'));_0x49b257[_0x1160('0x34')]=_[_0x1160('0x35')](_0x785fe8[_0x1160('0x34')]);_0x49b257[_0x1160('0x36')]=_[_0x1160('0x37')](_0x49b257['model'],_0x49b257[_0x1160('0x34')]);_0x30418d[_0x1160('0x38')]=_['intersection'](_0x49b257[_0x1160('0x33')],qs[_0x1160('0x39')](_0x785fe8[_0x1160('0x34')]['fields']));_0x30418d[_0x1160('0x38')]=_0x30418d[_0x1160('0x38')][_0x1160('0x3a')]?_0x30418d[_0x1160('0x38')]:_0x49b257['model'];if(!_0x785fe8[_0x1160('0x34')][_0x1160('0x3b')](_0x1160('0x3c'))){_0x30418d[_0x1160('0x1f')]=qs['limit'](_0x785fe8['query'][_0x1160('0x1f')]);_0x30418d[_0x1160('0x1d')]=qs[_0x1160('0x1d')](_0x785fe8['query'][_0x1160('0x1d')]);}_0x30418d[_0x1160('0x3d')]=qs[_0x1160('0x3e')](_0x785fe8[_0x1160('0x34')][_0x1160('0x3e')]);_0x30418d[_0x1160('0x3f')]=qs[_0x1160('0x36')](_[_0x1160('0x40')](_0x785fe8[_0x1160('0x34')],_0x49b257[_0x1160('0x36')]),_0x38782c);if(_0x785fe8[_0x1160('0x34')][_0x1160('0x41')]){_0x30418d['where']=_[_0x1160('0x42')](_0x30418d[_0x1160('0x3f')],{'$or':_[_0x1160('0x2f')](_0x38782c,function(_0x2c343b){if(_0x2c343b[_0x1160('0x32')]!==_0x1160('0x43')){var _0xa8eaff={};_0xa8eaff[_0x2c343b[_0x1160('0x2d')]]={'$like':'%'+_0x785fe8[_0x1160('0x34')]['filter']+'%'};return _0xa8eaff;}})});}_0x30418d=_[_0x1160('0x42')]({},_0x30418d,_0x785fe8[_0x1160('0x44')]);var _0x1e88a6={'where':_0x30418d[_0x1160('0x3f')]};return db[_0x1160('0x30')][_0x1160('0x20')](_0x1e88a6)[_0x1160('0x27')](function(_0x4e26d2){_0x10093e[_0x1160('0x20')]=_0x4e26d2;if(_0x785fe8[_0x1160('0x34')]['includeAll']){_0x30418d['include']=[{'all':!![]}];}return db[_0x1160('0x30')][_0x1160('0x45')](_0x30418d);})[_0x1160('0x27')](function(_0xfc918){_0x10093e[_0x1160('0x46')]=_0xfc918;return _0x10093e;})[_0x1160('0x27')](respondWithFilteredResult(_0x398251,_0x30418d))[_0x1160('0x47')](handleError(_0x398251,null));};exports[_0x1160('0x48')]=function(_0x3a0600,_0x948c78){var _0x3b6b6e={'raw':!![],'where':{'id':_0x3a0600[_0x1160('0x49')]['id']}},_0x4a3c20={};_0x4a3c20[_0x1160('0x33')]=_[_0x1160('0x35')](db[_0x1160('0x30')]['rawAttributes']);_0x4a3c20[_0x1160('0x34')]=_[_0x1160('0x35')](_0x3a0600[_0x1160('0x34')]);_0x4a3c20[_0x1160('0x36')]=_['intersection'](_0x4a3c20[_0x1160('0x33')],_0x4a3c20['query']);_0x3b6b6e['attributes']=_['intersection'](_0x4a3c20['model'],qs[_0x1160('0x39')](_0x3a0600[_0x1160('0x34')]['fields']));_0x3b6b6e[_0x1160('0x38')]=_0x3b6b6e[_0x1160('0x38')][_0x1160('0x3a')]?_0x3b6b6e['attributes']:_0x4a3c20['model'];if(_0x3a0600[_0x1160('0x34')][_0x1160('0x4a')]){_0x3b6b6e[_0x1160('0x4b')]=[{'all':!![]}];}_0x3b6b6e=_['merge']({},_0x3b6b6e,_0x3a0600[_0x1160('0x44')]);return db[_0x1160('0x30')][_0x1160('0x4c')](_0x3b6b6e)[_0x1160('0x27')](handleEntityNotFound(_0x948c78,null))[_0x1160('0x27')](respondWithResult(_0x948c78,null))['catch'](handleError(_0x948c78,null));};exports[_0x1160('0x4d')]=function(_0x276cb9,_0xb6cd4b){return db[_0x1160('0x30')][_0x1160('0x4d')](_0x276cb9[_0x1160('0x4e')],{})[_0x1160('0x27')](function(_0x50b7af){var _0x5c009b=_0x276cb9['user'][_0x1160('0x29')]({'plain':!![]});if(!_0x5c009b)throw new Error(_0x1160('0x4f'));if(_0x5c009b[_0x1160('0x50')]==='user'){var _0x44d004=_0x50b7af['get']({'plain':!![]});var _0x43b00a=_0x1160('0x2a');return db[_0x1160('0x51')][_0x1160('0x4c')]({'where':{'name':_0x43b00a,'userProfileId':_0x5c009b[_0x1160('0x52')]},'raw':!![]})[_0x1160('0x27')](function(_0x3d972e){if(_0x3d972e&&_0x3d972e[_0x1160('0x53')]===0x0){return db[_0x1160('0x54')]['create']({'name':_0x44d004[_0x1160('0x2d')],'resourceId':_0x44d004['id'],'type':_0x3d972e['name'],'sectionId':_0x3d972e['id']},{})['then'](function(){return _0x50b7af;});}else{return _0x50b7af;}})['catch'](function(_0x27a703){logger[_0x1160('0x2b')](_0x1160('0x55'),_0x27a703);throw _0x27a703;});}return _0x50b7af;})[_0x1160('0x27')](respondWithResult(_0xb6cd4b,0xc9))[_0x1160('0x47')](handleError(_0xb6cd4b,null));};exports[_0x1160('0x26')]=function(_0x509398,_0xfb1217){if(_0x509398[_0x1160('0x4e')]['id']){delete _0x509398[_0x1160('0x4e')]['id'];}return db['CmContactHasItem'][_0x1160('0x4c')]({'where':{'id':_0x509398['params']['id']}})[_0x1160('0x27')](handleEntityNotFound(_0xfb1217,null))[_0x1160('0x27')](saveUpdates(_0x509398[_0x1160('0x4e')],null))[_0x1160('0x27')](respondWithResult(_0xfb1217,null))['catch'](handleError(_0xfb1217,null));};exports[_0x1160('0x28')]=function(_0x9ad796,_0x3956ce){return db[_0x1160('0x30')][_0x1160('0x4c')]({'where':{'id':_0x9ad796['params']['id']}})[_0x1160('0x27')](handleEntityNotFound(_0x3956ce,null))[_0x1160('0x27')](removeEntity(_0x3956ce,null))[_0x1160('0x47')](handleError(_0x3956ce,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 7cfa49c..592a157 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 _0x7dc0=['request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','api','moment'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0x7dc0,0x127));var _0x07dc=function(_0x59616b,_0x38e534){_0x59616b=_0x59616b-0x0;var _0x5c4523=_0x7dc0[_0x59616b];return _0x5c4523;};'use strict';var _=require(_0x07dc('0x0'));var util=require(_0x07dc('0x1'));var logger=require('../../config/logger')(_0x07dc('0x2'));var moment=require(_0x07dc('0x3'));var BPromise=require('bluebird');var rp=require(_0x07dc('0x4'));var fs=require('fs');var path=require(_0x07dc('0x5'));var rimraf=require(_0x07dc('0x6'));var config=require(_0x07dc('0x7'));var attributes=require(_0x07dc('0x8'));module[_0x07dc('0x9')]=function(_0x3721c9,_0xa4205b){return _0x3721c9[_0x07dc('0xa')](_0x07dc('0xb'),attributes,{'tableName':_0x07dc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc27d=['define','CmContactHasItem','cm_contact_has_items','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x173fb3,_0x5d448a){var _0x4cc36e=function(_0x412456){while(--_0x412456){_0x173fb3['push'](_0x173fb3['shift']());}};_0x4cc36e(++_0x5d448a);}(_0xc27d,0xdf));var _0xdc27=function(_0x576963,_0x590db2){_0x576963=_0x576963-0x0;var _0x29f9cf=_0xc27d[_0x576963];return _0x29f9cf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdc27('0x0'))(_0xdc27('0x1'));var moment=require(_0xdc27('0x2'));var BPromise=require('bluebird');var rp=require(_0xdc27('0x3'));var fs=require('fs');var path=require(_0xdc27('0x4'));var rimraf=require(_0xdc27('0x5'));var config=require(_0xdc27('0x6'));var attributes=require(_0xdc27('0x7'));module['exports']=function(_0x865b6d,_0xcea8e0){return _0x865b6d[_0xdc27('0x8')](_0xdc27('0x9'),attributes,{'tableName':_0xdc27('0xa'),'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 bdf3e8a..2f40627 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 _0x620a=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','CmContactHasItem,\x20%s,\x20%s','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0x4e5156,_0x28ba84){var _0x409f28=function(_0x52fe32){while(--_0x52fe32){_0x4e5156['push'](_0x4e5156['shift']());}};_0x409f28(++_0x28ba84);}(_0x620a,0xb8));var _0xa620=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x620a[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0xa620('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa620('0x1'));var rs=require(_0xa620('0x2'));var fs=require('fs');var Redis=require(_0xa620('0x3'));var db=require(_0xa620('0x4'))['db'];var utils=require(_0xa620('0x5'));var logger=require(_0xa620('0x6'))('rpc');var config=require(_0xa620('0x7'));var jayson=require(_0xa620('0x8'));var client=jayson[_0xa620('0x9')][_0xa620('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b0154,_0x4a49e8,_0x506a95){return new BPromise(function(_0x5b6a25,_0x4154cc){return client[_0xa620('0xb')](_0x3b0154,_0x506a95)[_0xa620('0xc')](function(_0x597f48){logger['info'](_0xa620('0xd'),_0x4a49e8,'request\x20sent');logger['debug'](_0xa620('0xe'),_0x4a49e8,_0xa620('0xf'),JSON[_0xa620('0x10')](_0x597f48));if(_0x597f48['error']){if(_0x597f48[_0xa620('0x11')][_0xa620('0x12')]===0x1f4){logger['error'](_0xa620('0xd'),_0x4a49e8,_0x597f48[_0xa620('0x11')][_0xa620('0x13')]);return _0x4154cc(_0x597f48[_0xa620('0x11')][_0xa620('0x13')]);}logger[_0xa620('0x11')](_0xa620('0xd'),_0x4a49e8,_0x597f48['error'][_0xa620('0x13')]);return _0x5b6a25(_0x597f48['error'][_0xa620('0x13')]);}else{logger[_0xa620('0x14')](_0xa620('0xd'),_0x4a49e8,_0xa620('0xf'));_0x5b6a25(_0x597f48[_0xa620('0x15')][_0xa620('0x13')]);}})[_0xa620('0x16')](function(_0x387246){logger[_0xa620('0x11')](_0xa620('0xd'),_0x4a49e8,_0x387246);_0x4154cc(_0x387246);});});} \ No newline at end of file +var _0xe7c4=['request\x20sent','debug','CmContactHasItem,\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','request','then','info','CmContactHasItem,\x20%s,\x20%s'];(function(_0x3eaabf,_0x5c5e48){var _0x2c297e=function(_0x8c62dc){while(--_0x8c62dc){_0x3eaabf['push'](_0x3eaabf['shift']());}};_0x2c297e(++_0x5c5e48);}(_0xe7c4,0x81));var _0x4e7c=function(_0xa7f511,_0x5964f1){_0xa7f511=_0xa7f511-0x0;var _0x108ec0=_0xe7c4[_0xa7f511];return _0x108ec0;};'use strict';var _=require(_0x4e7c('0x0'));var util=require(_0x4e7c('0x1'));var moment=require(_0x4e7c('0x2'));var BPromise=require(_0x4e7c('0x3'));var rs=require(_0x4e7c('0x4'));var fs=require('fs');var Redis=require(_0x4e7c('0x5'));var db=require(_0x4e7c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e7c('0x7'))(_0x4e7c('0x8'));var config=require(_0x4e7c('0x9'));var jayson=require(_0x4e7c('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x388de1,_0xf72d2f,_0x4dc396){return new BPromise(function(_0xb955f2,_0x102c00){return client[_0x4e7c('0xb')](_0x388de1,_0x4dc396)[_0x4e7c('0xc')](function(_0x1cadf2){logger[_0x4e7c('0xd')](_0x4e7c('0xe'),_0xf72d2f,_0x4e7c('0xf'));logger[_0x4e7c('0x10')](_0x4e7c('0x11'),_0xf72d2f,_0x4e7c('0xf'),JSON[_0x4e7c('0x12')](_0x1cadf2));if(_0x1cadf2[_0x4e7c('0x13')]){if(_0x1cadf2[_0x4e7c('0x13')][_0x4e7c('0x14')]===0x1f4){logger[_0x4e7c('0x13')](_0x4e7c('0xe'),_0xf72d2f,_0x1cadf2['error']['message']);return _0x102c00(_0x1cadf2[_0x4e7c('0x13')][_0x4e7c('0x15')]);}logger[_0x4e7c('0x13')](_0x4e7c('0xe'),_0xf72d2f,_0x1cadf2[_0x4e7c('0x13')][_0x4e7c('0x15')]);return _0xb955f2(_0x1cadf2[_0x4e7c('0x13')]['message']);}else{logger['info'](_0x4e7c('0xe'),_0xf72d2f,_0x4e7c('0xf'));_0xb955f2(_0x1cadf2[_0x4e7c('0x16')][_0x4e7c('0x15')]);}})[_0x4e7c('0x17')](function(_0x59f1b2){logger[_0x4e7c('0x13')](_0x4e7c('0xe'),_0xf72d2f,_0x59f1b2);_0x102c00(_0x59f1b2);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 1031eec..f2306a7 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 _0xb455=['multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x51da77,_0x5c956d){var _0x11a4c5=function(_0x24c383){while(--_0x24c383){_0x51da77['push'](_0x51da77['shift']());}};_0x11a4c5(++_0x5c956d);}(_0xb455,0x104));var _0x5b45=function(_0x4fad56,_0x146756){_0x4fad56=_0x4fad56-0x0;var _0x43f579=_0xb455[_0x4fad56];return _0x43f579;};'use strict';var multer=require(_0x5b45('0x0'));var util=require(_0x5b45('0x1'));var path=require(_0x5b45('0x2'));var timeout=require(_0x5b45('0x3'));var express=require(_0x5b45('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5b45('0x5'));var config=require(_0x5b45('0x6'));var controller=require(_0x5b45('0x7'));router[_0x5b45('0x8')]('/',auth[_0x5b45('0x9')](),controller[_0x5b45('0xa')]);router[_0x5b45('0x8')](_0x5b45('0xb'),auth[_0x5b45('0x9')](),controller[_0x5b45('0xc')]);router[_0x5b45('0xd')]('/',auth[_0x5b45('0x9')](),controller[_0x5b45('0xe')]);router[_0x5b45('0xf')](_0x5b45('0xb'),auth['isAuthenticated'](),controller[_0x5b45('0x10')]);router[_0x5b45('0x11')](_0x5b45('0xb'),auth[_0x5b45('0x9')](),controller[_0x5b45('0x12')]);module[_0x5b45('0x13')]=router; \ No newline at end of file +var _0xad00=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xad00,0x195));var _0x0ad0=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xad00[_0x4709c0];return _0x13348b;};'use strict';var multer=require(_0x0ad0('0x0'));var util=require(_0x0ad0('0x1'));var path=require(_0x0ad0('0x2'));var timeout=require(_0x0ad0('0x3'));var express=require(_0x0ad0('0x4'));var router=express[_0x0ad0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0ad0('0x6'));var interaction=require(_0x0ad0('0x7'));var config=require(_0x0ad0('0x8'));var controller=require('./cmContactHasItem.controller');router[_0x0ad0('0x9')]('/',auth[_0x0ad0('0xa')](),controller[_0x0ad0('0xb')]);router[_0x0ad0('0x9')](_0x0ad0('0xc'),auth[_0x0ad0('0xa')](),controller[_0x0ad0('0xd')]);router[_0x0ad0('0xe')]('/',auth[_0x0ad0('0xa')](),controller[_0x0ad0('0xf')]);router['put'](_0x0ad0('0xc'),auth[_0x0ad0('0xa')](),controller[_0x0ad0('0x10')]);router[_0x0ad0('0x11')](_0x0ad0('0xc'),auth[_0x0ad0('0xa')](),controller[_0x0ad0('0x12')]);module[_0x0ad0('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 2e529f3..954711a 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 _0x7ed5=['voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','STRING','TEXT','select','parse','values','isArray','stringify','BOOLEAN','ENUM'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x7ed5,0x155));var _0x57ed=function(_0x38cfe6,_0x13f32a){_0x38cfe6=_0x38cfe6-0x0;var _0xffcb11=_0x7ed5[_0x38cfe6];return _0xffcb11;};'use strict';var Sequelize=require(_0x57ed('0x0'));var _=require(_0x57ed('0x1'));module[_0x57ed('0x2')]={'name':{'type':Sequelize[_0x57ed('0x3')],'get':function(_0x461b10){return this[_0x57ed('0x4')](_0x57ed('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x31d388){this[_0x57ed('0x6')](_0x57ed('0x5'),_0x31d388?_0x31d388:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x57ed('0x7')],'allowNull':![]},'values':{'type':Sequelize[_0x57ed('0x8')]('long'),'get':function(){if(this[_0x57ed('0x4')]('type')===_0x57ed('0x9')){return JSON[_0x57ed('0xa')](this[_0x57ed('0x4')](_0x57ed('0xb')));}else{return this[_0x57ed('0x4')](_0x57ed('0xb'));}},'set':function(_0x1289cc){if(Array[_0x57ed('0xc')](_0x1289cc)){this[_0x57ed('0x6')]('values',JSON[_0x57ed('0xd')](_0x1289cc));}else{this['setDataValue'](_0x57ed('0xb'),_0x1289cc);}}},'required':{'type':Sequelize[_0x57ed('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x57ed('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x57ed('0xf')](_0x57ed('0x10'))}}; \ No newline at end of file +var _0x48ff=['BOOLEAN','ENUM','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','name','TEXT','long','select','values','isArray','setDataValue','stringify'];(function(_0x47c0d8,_0x195708){var _0x12f83c=function(_0x126117){while(--_0x126117){_0x47c0d8['push'](_0x47c0d8['shift']());}};_0x12f83c(++_0x195708);}(_0x48ff,0x8a));var _0xf48f=function(_0x57ab14,_0x506efa){_0x57ab14=_0x57ab14-0x0;var _0x42c52f=_0x48ff[_0x57ab14];return _0x42c52f;};'use strict';var Sequelize=require(_0xf48f('0x0'));var _=require(_0xf48f('0x1'));module[_0xf48f('0x2')]={'name':{'type':Sequelize[_0xf48f('0x3')],'get':function(_0x3b6ea5){return this[_0xf48f('0x4')](_0xf48f('0x5'));}},'alias':{'type':Sequelize[_0xf48f('0x6')],'allowNull':![],'set':function(_0x410410){this['setDataValue']('alias',_0x410410?_0x410410:this[_0xf48f('0x4')](_0xf48f('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xf48f('0x8')](_0xf48f('0x9')),'get':function(){if(this[_0xf48f('0x4')]('type')===_0xf48f('0xa')){return JSON['parse'](this['getDataValue']('values'));}else{return this['getDataValue'](_0xf48f('0xb'));}},'set':function(_0x332e3f){if(Array[_0xf48f('0xc')](_0x332e3f)){this[_0xf48f('0xd')](_0xf48f('0xb'),JSON[_0xf48f('0xe')](_0x332e3f));}else{this[_0xf48f('0xd')](_0xf48f('0xb'),_0x332e3f);}}},'required':{'type':Sequelize[_0xf48f('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xf48f('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf48f('0x10')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 42d8302..c44c297 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 _0x6d76=['update','destroy','then','end','error','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','offset','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','CmCustomField','findAll','catch','show','params','body','find','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','format','cf_%d','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','set','apply','reject','save'];(function(_0x2b0bc2,_0x4331f5){var _0x56e5b9=function(_0x4c1b06){while(--_0x4c1b06){_0x2b0bc2['push'](_0x2b0bc2['shift']());}};_0x56e5b9(++_0x4331f5);}(_0x6d76,0x13a));var _0x66d7=function(_0x5afb78,_0x3c75f4){_0x5afb78=_0x5afb78-0x0;var _0x168535=_0x6d76[_0x5afb78];return _0x168535;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x66d7('0x0'));var zipdir=require(_0x66d7('0x1'));var jsonpatch=require(_0x66d7('0x2'));var rp=require(_0x66d7('0x3'));var moment=require(_0x66d7('0x4'));var BPromise=require(_0x66d7('0x5'));var Mustache=require(_0x66d7('0x6'));var util=require(_0x66d7('0x7'));var path=require(_0x66d7('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x66d7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x66d7('0xa'));var squel=require(_0x66d7('0xb'));var crypto=require(_0x66d7('0xc'));var jsforce=require(_0x66d7('0xd'));var deskjs=require(_0x66d7('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x66d7('0xf'));var Redis=require(_0x66d7('0x10'));var authService=require(_0x66d7('0x11'));var qs=require(_0x66d7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66d7('0x13'));var logger=require('../../config/logger')(_0x66d7('0x14'));var utils=require(_0x66d7('0x15'));var config=require(_0x66d7('0x16'));var licenseUtil=require(_0x66d7('0x17'));var db=require(_0x66d7('0x18'))['db'];function respondWithStatusCode(_0x2babf9,_0x1cd607){_0x1cd607=_0x1cd607||0xcc;return function(_0x30a3b9){if(_0x30a3b9){return _0x2babf9[_0x66d7('0x19')](_0x1cd607);}return _0x2babf9[_0x66d7('0x1a')](_0x1cd607)['end']();};}function respondWithResult(_0x4cc2b4,_0x26cee7){_0x26cee7=_0x26cee7||0xc8;return function(_0x401a5a){if(_0x401a5a){return _0x4cc2b4['status'](_0x26cee7)['json'](_0x401a5a);}};}function respondWithFilteredResult(_0xc5d5b5,_0x1cae59){return function(_0x558f12){if(_0x558f12){var _0x2121b0=typeof _0x1cae59['offset']===_0x66d7('0x1b')&&typeof _0x1cae59[_0x66d7('0x1c')]===_0x66d7('0x1b');var _0x4b38c7=_0x558f12[_0x66d7('0x1d')];var _0x27e910=_0x2121b0?0x0:_0x1cae59['offset'];var _0x424cbd=_0x2121b0?_0x558f12[_0x66d7('0x1d')]:_0x1cae59['offset']+_0x1cae59[_0x66d7('0x1c')];var _0x2aceff;if(_0x424cbd>=_0x4b38c7){_0x424cbd=_0x4b38c7;_0x2aceff=0xc8;}else{_0x2aceff=0xce;}_0xc5d5b5['status'](_0x2aceff);return _0xc5d5b5[_0x66d7('0x1e')]('Content-Range',_0x27e910+'-'+_0x424cbd+'/'+_0x4b38c7)['json'](_0x558f12);}return null;};}function patchUpdates(_0x58ed23){return function(_0x90f9c0){try{jsonpatch[_0x66d7('0x1f')](_0x90f9c0,_0x58ed23,!![]);}catch(_0x29d9f3){return BPromise[_0x66d7('0x20')](_0x29d9f3);}return _0x90f9c0[_0x66d7('0x21')]();};}function saveUpdates(_0x80a972,_0x1c8491){return function(_0x4f01cd){if(_0x4f01cd){return _0x4f01cd[_0x66d7('0x22')](_0x80a972)['then'](function(_0x24dafc){return _0x24dafc;});}return null;};}function removeEntity(_0x1f9e01,_0x44924a){return function(_0x45c04e){if(_0x45c04e){return _0x45c04e[_0x66d7('0x23')]()[_0x66d7('0x24')](function(){_0x1f9e01[_0x66d7('0x1a')](0xcc)[_0x66d7('0x25')]();});}};}function handleEntityNotFound(_0x1a4c3d,_0xa373c3){return function(_0x1cd58e){if(!_0x1cd58e){_0x1a4c3d[_0x66d7('0x19')](0x194);}return _0x1cd58e;};}function handleError(_0x284d20,_0x44ec2d){_0x44ec2d=_0x44ec2d||0x1f4;return function(_0x5a51ce){logger[_0x66d7('0x26')](_0x5a51ce['stack']);if(_0x5a51ce[_0x66d7('0x27')]){delete _0x5a51ce['name'];}_0x284d20[_0x66d7('0x1a')](_0x44ec2d)[_0x66d7('0x28')](_0x5a51ce);};}exports[_0x66d7('0x29')]=function(_0x582f09,_0x1d0e34){var _0x5c1a40={},_0x39ba08={},_0x56033b={'count':0x0,'rows':[]};var _0x1f433b=_[_0x66d7('0x2a')](db['CmCustomField'][_0x66d7('0x2b')],function(_0xe04e13){return{'name':_0xe04e13[_0x66d7('0x2c')],'type':_0xe04e13['type'][_0x66d7('0x2d')]};});_0x39ba08['model']=_['differenceBy'](_[_0x66d7('0x2a')](_0x1f433b,_0x66d7('0x27')),[_0x66d7('0x27')]);_0x39ba08[_0x66d7('0x2e')]=_[_0x66d7('0x2f')](_0x582f09['query']);_0x39ba08[_0x66d7('0x30')]=_['intersection'](_0x39ba08[_0x66d7('0x31')],_0x39ba08[_0x66d7('0x2e')]);_0x5c1a40[_0x66d7('0x32')]=_[_0x66d7('0x33')](_0x39ba08[_0x66d7('0x31')],qs[_0x66d7('0x34')](_0x582f09[_0x66d7('0x2e')]['fields']));_0x5c1a40['attributes']=_0x5c1a40[_0x66d7('0x32')][_0x66d7('0x35')]?_0x5c1a40[_0x66d7('0x32')]:_0x39ba08[_0x66d7('0x31')];if(!_0x582f09['query']['hasOwnProperty'](_0x66d7('0x36'))){_0x5c1a40[_0x66d7('0x1c')]=qs[_0x66d7('0x1c')](_0x582f09[_0x66d7('0x2e')][_0x66d7('0x1c')]);_0x5c1a40['offset']=qs[_0x66d7('0x37')](_0x582f09[_0x66d7('0x2e')][_0x66d7('0x37')]);}_0x5c1a40[_0x66d7('0x38')]=qs[_0x66d7('0x39')](_0x582f09['query'][_0x66d7('0x39')]);_0x5c1a40['where']=qs['filters'](_['pick'](_0x582f09[_0x66d7('0x2e')],_0x39ba08[_0x66d7('0x30')]),_0x1f433b);if(_0x582f09[_0x66d7('0x2e')][_0x66d7('0x3a')]){_0x5c1a40[_0x66d7('0x3b')]=_[_0x66d7('0x3c')](_0x5c1a40[_0x66d7('0x3b')],{'$or':_[_0x66d7('0x2a')](_0x1f433b,function(_0x46535d){if(_0x46535d[_0x66d7('0x3d')]!==_0x66d7('0x3e')){var _0x2303c1={};_0x2303c1[_0x46535d[_0x66d7('0x27')]]={'$like':'%'+_0x582f09[_0x66d7('0x2e')][_0x66d7('0x3a')]+'%'};return _0x2303c1;}})});}_0x5c1a40=_['merge']({},_0x5c1a40,_0x582f09[_0x66d7('0x3f')]);var _0x59edff={'where':_0x5c1a40[_0x66d7('0x3b')]};return db['CmCustomField'][_0x66d7('0x1d')](_0x59edff)['then'](function(_0x26a4e9){_0x56033b['count']=_0x26a4e9;if(_0x582f09[_0x66d7('0x2e')][_0x66d7('0x40')]){_0x5c1a40[_0x66d7('0x41')]=[{'all':!![]}];}return db[_0x66d7('0x42')][_0x66d7('0x43')](_0x5c1a40);})[_0x66d7('0x24')](function(_0xb941ec){_0x56033b['rows']=_0xb941ec;return _0x56033b;})[_0x66d7('0x24')](respondWithFilteredResult(_0x1d0e34,_0x5c1a40))[_0x66d7('0x44')](handleError(_0x1d0e34,null));};exports[_0x66d7('0x45')]=function(_0x26721a,_0x62a478){var _0x19354b={'raw':!![],'where':{'id':_0x26721a[_0x66d7('0x46')]['id']}},_0x43780a={};_0x43780a['model']=_['keys'](db['CmCustomField'][_0x66d7('0x2b')]);_0x43780a['query']=_[_0x66d7('0x2f')](_0x26721a['query']);_0x43780a[_0x66d7('0x30')]=_[_0x66d7('0x33')](_0x43780a[_0x66d7('0x31')],_0x43780a['query']);_0x19354b[_0x66d7('0x32')]=_[_0x66d7('0x33')](_0x43780a['model'],qs['fields'](_0x26721a['query'][_0x66d7('0x34')]));_0x19354b[_0x66d7('0x32')]=_0x19354b['attributes'][_0x66d7('0x35')]?_0x19354b[_0x66d7('0x32')]:_0x43780a[_0x66d7('0x31')];if(_0x26721a[_0x66d7('0x2e')][_0x66d7('0x40')]){_0x19354b[_0x66d7('0x41')]=[{'all':!![]}];}_0x19354b=_[_0x66d7('0x3c')]({},_0x19354b,_0x26721a[_0x66d7('0x3f')]);return db[_0x66d7('0x42')]['find'](_0x19354b)[_0x66d7('0x24')](handleEntityNotFound(_0x62a478,null))[_0x66d7('0x24')](respondWithResult(_0x62a478,null))[_0x66d7('0x44')](handleError(_0x62a478,null));};exports[_0x66d7('0x22')]=function(_0x3db62e,_0x6a078e){if(_0x3db62e[_0x66d7('0x47')]['id']){delete _0x3db62e[_0x66d7('0x47')]['id'];}return db[_0x66d7('0x42')]['find']({'where':{'id':_0x3db62e[_0x66d7('0x46')]['id']}})['then'](handleEntityNotFound(_0x6a078e,null))[_0x66d7('0x24')](saveUpdates(_0x3db62e[_0x66d7('0x47')],null))[_0x66d7('0x24')](respondWithResult(_0x6a078e,null))[_0x66d7('0x44')](handleError(_0x6a078e,null));};exports['destroy']=function(_0x491856,_0x186da2){return db[_0x66d7('0x42')][_0x66d7('0x48')]({'where':{'id':_0x491856[_0x66d7('0x46')]['id']}})['then'](handleEntityNotFound(_0x186da2,null))[_0x66d7('0x24')](removeEntity(_0x186da2,null))[_0x66d7('0x44')](handleError(_0x186da2,null));};exports[_0x66d7('0x49')]=function(_0x1d431c,_0x47c479){var _0x26f270;return db[_0x66d7('0x4a')][_0x66d7('0x4b')](function(_0x2dcebd){return db[_0x66d7('0x42')][_0x66d7('0x49')](_0x1d431c[_0x66d7('0x47')],{'transaction':_0x2dcebd})[_0x66d7('0x24')](function(_0x4851dc){_0x26f270=_0x4851dc;var _0x361440={'type':db[_0x66d7('0x4c')][_0x66d7('0x4d')],'transaction':_0x2dcebd};switch(_0x1d431c[_0x66d7('0x47')][_0x66d7('0x3d')]){case'text':_0x361440[_0x66d7('0x3d')]=db[_0x66d7('0x4c')][_0x66d7('0x4d')];break;case _0x66d7('0x4e'):_0x361440['type']=db[_0x66d7('0x4c')][_0x66d7('0x4f')];break;case _0x66d7('0x50'):_0x361440['type']=db[_0x66d7('0x4c')][_0x66d7('0x51')];_0x361440[_0x66d7('0x52')]=![];break;default:}return db[_0x66d7('0x4a')][_0x66d7('0x53')]['addColumn'](_0x66d7('0x54'),util[_0x66d7('0x55')](_0x66d7('0x56'),_0x26f270['id']),_0x361440);})['then'](function(){return _0x26f270;});})[_0x66d7('0x24')](respondWithResult(_0x47c479,0xc9))[_0x66d7('0x44')](handleError(_0x47c479,null));}; \ No newline at end of file +var _0x5dbe=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','save','update','destroy','then','error','stack','name','send','map','CmCustomField','rawAttributes','fieldName','type','key','differenceBy','query','keys','filters','intersection','model','fields','attributes','nolimit','order','sort','where','filter','merge','options','count','includeAll','findAll','rows','catch','show','params','length','find','body','sequelize','create','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','zip-dir','fast-json-patch','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/license/hardware'];(function(_0x305fa3,_0x18d27b){var _0x5b3132=function(_0x140e34){while(--_0x140e34){_0x305fa3['push'](_0x305fa3['shift']());}};_0x5b3132(++_0x18d27b);}(_0x5dbe,0xf3));var _0xe5db=function(_0x524efa,_0xbe406e){_0x524efa=_0x524efa-0x0;var _0x775cd5=_0x5dbe[_0x524efa];return _0x775cd5;};'use strict';var emlformat=require(_0xe5db('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe5db('0x1'));var jsonpatch=require(_0xe5db('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe5db('0x3'));var Mustache=require(_0xe5db('0x4'));var util=require(_0xe5db('0x5'));var path=require(_0xe5db('0x6'));var sox=require(_0xe5db('0x7'));var csv=require('to-csv');var ejs=require(_0xe5db('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe5db('0x9'));var squel=require(_0xe5db('0xa'));var crypto=require(_0xe5db('0xb'));var jsforce=require(_0xe5db('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe5db('0xd'));var querystring=require(_0xe5db('0xe'));var Papa=require(_0xe5db('0xf'));var Redis=require(_0xe5db('0x10'));var authService=require(_0xe5db('0x11'));var qs=require(_0xe5db('0x12'));var as=require(_0xe5db('0x13'));var hardwareService=require(_0xe5db('0x14'));var logger=require(_0xe5db('0x15'))('api');var utils=require(_0xe5db('0x16'));var config=require(_0xe5db('0x17'));var licenseUtil=require(_0xe5db('0x18'));var db=require(_0xe5db('0x19'))['db'];function respondWithStatusCode(_0x4892af,_0x19db6e){_0x19db6e=_0x19db6e||0xcc;return function(_0x424239){if(_0x424239){return _0x4892af[_0xe5db('0x1a')](_0x19db6e);}return _0x4892af[_0xe5db('0x1b')](_0x19db6e)[_0xe5db('0x1c')]();};}function respondWithResult(_0x63e864,_0x3641f1){_0x3641f1=_0x3641f1||0xc8;return function(_0x32c0c4){if(_0x32c0c4){return _0x63e864[_0xe5db('0x1b')](_0x3641f1)[_0xe5db('0x1d')](_0x32c0c4);}};}function respondWithFilteredResult(_0x501f95,_0x2dd81d){return function(_0x1ec506){if(_0x1ec506){var _0x55740f=typeof _0x2dd81d[_0xe5db('0x1e')]===_0xe5db('0x1f')&&typeof _0x2dd81d[_0xe5db('0x20')]===_0xe5db('0x1f');var _0x585a62=_0x1ec506['count'];var _0x4d7ae5=_0x55740f?0x0:_0x2dd81d[_0xe5db('0x1e')];var _0x422a7b=_0x55740f?_0x1ec506['count']:_0x2dd81d[_0xe5db('0x1e')]+_0x2dd81d['limit'];var _0x249075;if(_0x422a7b>=_0x585a62){_0x422a7b=_0x585a62;_0x249075=0xc8;}else{_0x249075=0xce;}_0x501f95['status'](_0x249075);return _0x501f95[_0xe5db('0x21')](_0xe5db('0x22'),_0x4d7ae5+'-'+_0x422a7b+'/'+_0x585a62)['json'](_0x1ec506);}return null;};}function patchUpdates(_0x4e64c9){return function(_0xd7ee53){try{jsonpatch['apply'](_0xd7ee53,_0x4e64c9,!![]);}catch(_0x48fa79){return BPromise['reject'](_0x48fa79);}return _0xd7ee53[_0xe5db('0x23')]();};}function saveUpdates(_0x2623dd,_0x11fbba){return function(_0x5f08a2){if(_0x5f08a2){return _0x5f08a2[_0xe5db('0x24')](_0x2623dd)['then'](function(_0x34152d){return _0x34152d;});}return null;};}function removeEntity(_0x4c0521,_0x34b4ef){return function(_0x1c1b48){if(_0x1c1b48){return _0x1c1b48[_0xe5db('0x25')]()[_0xe5db('0x26')](function(){_0x4c0521[_0xe5db('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19bb2c,_0x50e037){return function(_0x55f5f4){if(!_0x55f5f4){_0x19bb2c['sendStatus'](0x194);}return _0x55f5f4;};}function handleError(_0x5cace0,_0x5491a5){_0x5491a5=_0x5491a5||0x1f4;return function(_0x2c935b){logger[_0xe5db('0x27')](_0x2c935b[_0xe5db('0x28')]);if(_0x2c935b['name']){delete _0x2c935b[_0xe5db('0x29')];}_0x5cace0[_0xe5db('0x1b')](_0x5491a5)[_0xe5db('0x2a')](_0x2c935b);};}exports['index']=function(_0x5ea4a1,_0x46c66d){var _0x52b851={},_0x446bf2={},_0x898e={'count':0x0,'rows':[]};var _0xf7dbbc=_[_0xe5db('0x2b')](db[_0xe5db('0x2c')][_0xe5db('0x2d')],function(_0x59fc72){return{'name':_0x59fc72[_0xe5db('0x2e')],'type':_0x59fc72[_0xe5db('0x2f')][_0xe5db('0x30')]};});_0x446bf2['model']=_[_0xe5db('0x31')](_[_0xe5db('0x2b')](_0xf7dbbc,_0xe5db('0x29')),['name']);_0x446bf2[_0xe5db('0x32')]=_[_0xe5db('0x33')](_0x5ea4a1[_0xe5db('0x32')]);_0x446bf2[_0xe5db('0x34')]=_[_0xe5db('0x35')](_0x446bf2[_0xe5db('0x36')],_0x446bf2[_0xe5db('0x32')]);_0x52b851['attributes']=_[_0xe5db('0x35')](_0x446bf2[_0xe5db('0x36')],qs['fields'](_0x5ea4a1[_0xe5db('0x32')][_0xe5db('0x37')]));_0x52b851[_0xe5db('0x38')]=_0x52b851[_0xe5db('0x38')]['length']?_0x52b851['attributes']:_0x446bf2[_0xe5db('0x36')];if(!_0x5ea4a1[_0xe5db('0x32')]['hasOwnProperty'](_0xe5db('0x39'))){_0x52b851[_0xe5db('0x20')]=qs[_0xe5db('0x20')](_0x5ea4a1['query'][_0xe5db('0x20')]);_0x52b851[_0xe5db('0x1e')]=qs[_0xe5db('0x1e')](_0x5ea4a1[_0xe5db('0x32')]['offset']);}_0x52b851[_0xe5db('0x3a')]=qs[_0xe5db('0x3b')](_0x5ea4a1[_0xe5db('0x32')]['sort']);_0x52b851[_0xe5db('0x3c')]=qs[_0xe5db('0x34')](_['pick'](_0x5ea4a1[_0xe5db('0x32')],_0x446bf2[_0xe5db('0x34')]),_0xf7dbbc);if(_0x5ea4a1[_0xe5db('0x32')]['filter']){_0x52b851['where']=_['merge'](_0x52b851[_0xe5db('0x3c')],{'$or':_[_0xe5db('0x2b')](_0xf7dbbc,function(_0x1470c6){if(_0x1470c6['type']!=='VIRTUAL'){var _0x2d2848={};_0x2d2848[_0x1470c6[_0xe5db('0x29')]]={'$like':'%'+_0x5ea4a1['query'][_0xe5db('0x3d')]+'%'};return _0x2d2848;}})});}_0x52b851=_[_0xe5db('0x3e')]({},_0x52b851,_0x5ea4a1[_0xe5db('0x3f')]);var _0x4d49e5={'where':_0x52b851[_0xe5db('0x3c')]};return db[_0xe5db('0x2c')]['count'](_0x4d49e5)[_0xe5db('0x26')](function(_0x5534f6){_0x898e[_0xe5db('0x40')]=_0x5534f6;if(_0x5ea4a1[_0xe5db('0x32')][_0xe5db('0x41')]){_0x52b851['include']=[{'all':!![]}];}return db[_0xe5db('0x2c')][_0xe5db('0x42')](_0x52b851);})['then'](function(_0x2e5fba){_0x898e[_0xe5db('0x43')]=_0x2e5fba;return _0x898e;})[_0xe5db('0x26')](respondWithFilteredResult(_0x46c66d,_0x52b851))[_0xe5db('0x44')](handleError(_0x46c66d,null));};exports[_0xe5db('0x45')]=function(_0xe063ad,_0x5bcc03){var _0xbd4bd8={'raw':!![],'where':{'id':_0xe063ad[_0xe5db('0x46')]['id']}},_0x40f391={};_0x40f391[_0xe5db('0x36')]=_[_0xe5db('0x33')](db['CmCustomField']['rawAttributes']);_0x40f391['query']=_[_0xe5db('0x33')](_0xe063ad[_0xe5db('0x32')]);_0x40f391['filters']=_['intersection'](_0x40f391['model'],_0x40f391['query']);_0xbd4bd8['attributes']=_['intersection'](_0x40f391[_0xe5db('0x36')],qs['fields'](_0xe063ad[_0xe5db('0x32')][_0xe5db('0x37')]));_0xbd4bd8[_0xe5db('0x38')]=_0xbd4bd8[_0xe5db('0x38')][_0xe5db('0x47')]?_0xbd4bd8[_0xe5db('0x38')]:_0x40f391[_0xe5db('0x36')];if(_0xe063ad[_0xe5db('0x32')]['includeAll']){_0xbd4bd8['include']=[{'all':!![]}];}_0xbd4bd8=_[_0xe5db('0x3e')]({},_0xbd4bd8,_0xe063ad[_0xe5db('0x3f')]);return db[_0xe5db('0x2c')][_0xe5db('0x48')](_0xbd4bd8)[_0xe5db('0x26')](handleEntityNotFound(_0x5bcc03,null))[_0xe5db('0x26')](respondWithResult(_0x5bcc03,null))[_0xe5db('0x44')](handleError(_0x5bcc03,null));};exports[_0xe5db('0x24')]=function(_0xf00cb4,_0x27bcc4){if(_0xf00cb4['body']['id']){delete _0xf00cb4[_0xe5db('0x49')]['id'];}return db[_0xe5db('0x2c')][_0xe5db('0x48')]({'where':{'id':_0xf00cb4[_0xe5db('0x46')]['id']}})[_0xe5db('0x26')](handleEntityNotFound(_0x27bcc4,null))['then'](saveUpdates(_0xf00cb4[_0xe5db('0x49')],null))[_0xe5db('0x26')](respondWithResult(_0x27bcc4,null))[_0xe5db('0x44')](handleError(_0x27bcc4,null));};exports[_0xe5db('0x25')]=function(_0x588757,_0x2e9cf8){return db['CmCustomField']['find']({'where':{'id':_0x588757[_0xe5db('0x46')]['id']}})[_0xe5db('0x26')](handleEntityNotFound(_0x2e9cf8,null))['then'](removeEntity(_0x2e9cf8,null))[_0xe5db('0x44')](handleError(_0x2e9cf8,null));};exports['create']=function(_0x4aea75,_0x13ff94){var _0x3c1a7c;return db[_0xe5db('0x4a')]['transaction'](function(_0x3615ce){return db[_0xe5db('0x2c')][_0xe5db('0x4b')](_0x4aea75['body'],{'transaction':_0x3615ce})[_0xe5db('0x26')](function(_0xb5cfb9){_0x3c1a7c=_0xb5cfb9;var _0x2cca67={'type':db[_0xe5db('0x4c')][_0xe5db('0x4d')],'transaction':_0x3615ce};switch(_0x4aea75['body']['type']){case _0xe5db('0x4e'):_0x2cca67[_0xe5db('0x2f')]=db[_0xe5db('0x4c')]['TEXT'];break;case'number':_0x2cca67['type']=db[_0xe5db('0x4c')][_0xe5db('0x4f')];break;case _0xe5db('0x50'):_0x2cca67[_0xe5db('0x2f')]=db['Sequelize'][_0xe5db('0x51')];_0x2cca67[_0xe5db('0x52')]=![];break;default:}return db[_0xe5db('0x4a')][_0xe5db('0x53')][_0xe5db('0x54')](_0xe5db('0x55'),util[_0xe5db('0x56')](_0xe5db('0x57'),_0x3c1a7c['id']),_0x2cca67);})['then'](function(){return _0x3c1a7c;});})[_0xe5db('0x26')](respondWithResult(_0x13ff94,0xc9))[_0xe5db('0x44')](handleError(_0x13ff94,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 0ed3b20..d1b86bd 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 _0xdbfd=['CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmCustomField.attributes'];(function(_0x2e37f0,_0x948742){var _0x53c009=function(_0x330ff9){while(--_0x330ff9){_0x2e37f0['push'](_0x2e37f0['shift']());}};_0x53c009(++_0x948742);}(_0xdbfd,0x146));var _0xddbf=function(_0x381936,_0x29d789){_0x381936=_0x381936-0x0;var _0xc25947=_0xdbfd[_0x381936];return _0xc25947;};'use strict';var _=require(_0xddbf('0x0'));var util=require(_0xddbf('0x1'));var logger=require(_0xddbf('0x2'))(_0xddbf('0x3'));var moment=require(_0xddbf('0x4'));var BPromise=require(_0xddbf('0x5'));var rp=require(_0xddbf('0x6'));var fs=require('fs');var path=require(_0xddbf('0x7'));var rimraf=require('rimraf');var config=require(_0xddbf('0x8'));var attributes=require(_0xddbf('0x9'));module['exports']=function(_0x467f6b,_0x413786){return _0x467f6b['define'](_0xddbf('0xa'),attributes,{'tableName':_0xddbf('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd39=['request-promise','rimraf','./cmCustomField.attributes','exports','CmCustomField','util','api','moment','bluebird'];(function(_0xc77498,_0x519cfe){var _0x5f2ac2=function(_0x3cd1a0){while(--_0x3cd1a0){_0xc77498['push'](_0xc77498['shift']());}};_0x5f2ac2(++_0x519cfe);}(_0xcd39,0x1eb));var _0x9cd3=function(_0x5216e0,_0x4f8cb9){_0x5216e0=_0x5216e0-0x0;var _0x5b3f40=_0xcd39[_0x5216e0];return _0x5b3f40;};'use strict';var _=require('lodash');var util=require(_0x9cd3('0x0'));var logger=require('../../config/logger')(_0x9cd3('0x1'));var moment=require(_0x9cd3('0x2'));var BPromise=require(_0x9cd3('0x3'));var rp=require(_0x9cd3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9cd3('0x5'));var config=require('../../config/environment');var attributes=require(_0x9cd3('0x6'));module[_0x9cd3('0x7')]=function(_0x342242,_0x55e11a){return _0x342242['define'](_0x9cd3('0x8'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index e954b93..c2a2ca9 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 _0xe3b2=['debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x347fbf,_0x2e6f30){var _0x5dd3fc=function(_0x292c9a){while(--_0x292c9a){_0x347fbf['push'](_0x347fbf['shift']());}};_0x5dd3fc(++_0x2e6f30);}(_0xe3b2,0x1b9));var _0x2e3b=function(_0x136bc6,_0x491dc9){_0x136bc6=_0x136bc6-0x0;var _0x3bd141=_0xe3b2[_0x136bc6];return _0x3bd141;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2e3b('0x0'));var BPromise=require(_0x2e3b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e3b('0x2'));var db=require(_0x2e3b('0x3'))['db'];var utils=require(_0x2e3b('0x4'));var logger=require(_0x2e3b('0x5'))(_0x2e3b('0x6'));var config=require(_0x2e3b('0x7'));var jayson=require(_0x2e3b('0x8'));var client=jayson[_0x2e3b('0x9')][_0x2e3b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f52fb,_0x2cc423,_0x1a2acf){return new BPromise(function(_0xfe873f,_0x59fc9e){return client[_0x2e3b('0xb')](_0x4f52fb,_0x1a2acf)[_0x2e3b('0xc')](function(_0x40da13){logger[_0x2e3b('0xd')]('CmCustomField,\x20%s,\x20%s',_0x2cc423,_0x2e3b('0xe'));logger[_0x2e3b('0xf')](_0x2e3b('0x10'),_0x2cc423,_0x2e3b('0xe'),JSON[_0x2e3b('0x11')](_0x40da13));if(_0x40da13[_0x2e3b('0x12')]){if(_0x40da13[_0x2e3b('0x12')][_0x2e3b('0x13')]===0x1f4){logger[_0x2e3b('0x12')](_0x2e3b('0x14'),_0x2cc423,_0x40da13[_0x2e3b('0x12')]['message']);return _0x59fc9e(_0x40da13[_0x2e3b('0x12')][_0x2e3b('0x15')]);}logger[_0x2e3b('0x12')](_0x2e3b('0x14'),_0x2cc423,_0x40da13[_0x2e3b('0x12')][_0x2e3b('0x15')]);return _0xfe873f(_0x40da13[_0x2e3b('0x12')][_0x2e3b('0x15')]);}else{logger[_0x2e3b('0xd')](_0x2e3b('0x14'),_0x2cc423,_0x2e3b('0xe'));_0xfe873f(_0x40da13[_0x2e3b('0x16')][_0x2e3b('0x15')]);}})[_0x2e3b('0x17')](function(_0x56ceee){logger[_0x2e3b('0x12')](_0x2e3b('0x14'),_0x2cc423,_0x56ceee);_0x59fc9e(_0x56ceee);});});} \ No newline at end of file +var _0x745c=['message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x146484,_0x27a7f0){var _0x4c7aa3=function(_0x481b98){while(--_0x481b98){_0x146484['push'](_0x146484['shift']());}};_0x4c7aa3(++_0x27a7f0);}(_0x745c,0x1e4));var _0xc745=function(_0x25875a,_0x54dd06){_0x25875a=_0x25875a-0x0;var _0x21daee=_0x745c[_0x25875a];return _0x21daee;};'use strict';var _=require(_0xc745('0x0'));var util=require(_0xc745('0x1'));var moment=require('moment');var BPromise=require(_0xc745('0x2'));var rs=require(_0xc745('0x3'));var fs=require('fs');var Redis=require(_0xc745('0x4'));var db=require(_0xc745('0x5'))['db'];var utils=require(_0xc745('0x6'));var logger=require(_0xc745('0x7'))(_0xc745('0x8'));var config=require(_0xc745('0x9'));var jayson=require(_0xc745('0xa'));var client=jayson[_0xc745('0xb')][_0xc745('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x881cc7,_0x2a5fbe,_0x264074){return new BPromise(function(_0x4df180,_0x4a6889){return client['request'](_0x881cc7,_0x264074)['then'](function(_0x4e081c){logger[_0xc745('0xd')](_0xc745('0xe'),_0x2a5fbe,'request\x20sent');logger[_0xc745('0xf')](_0xc745('0x10'),_0x2a5fbe,'request\x20sent',JSON[_0xc745('0x11')](_0x4e081c));if(_0x4e081c['error']){if(_0x4e081c[_0xc745('0x12')][_0xc745('0x13')]===0x1f4){logger[_0xc745('0x12')]('CmCustomField,\x20%s,\x20%s',_0x2a5fbe,_0x4e081c[_0xc745('0x12')]['message']);return _0x4a6889(_0x4e081c[_0xc745('0x12')]['message']);}logger['error'](_0xc745('0xe'),_0x2a5fbe,_0x4e081c[_0xc745('0x12')][_0xc745('0x14')]);return _0x4df180(_0x4e081c['error'][_0xc745('0x14')]);}else{logger[_0xc745('0xd')](_0xc745('0xe'),_0x2a5fbe,_0xc745('0x15'));_0x4df180(_0x4e081c[_0xc745('0x16')]['message']);}})[_0xc745('0x17')](function(_0x4f3f2b){logger[_0xc745('0x12')]('CmCustomField,\x20%s,\x20%s',_0x2a5fbe,_0x4f3f2b);_0x4a6889(_0x4f3f2b);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index d3f3634..ed8ed04 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 _0x938d=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','/:id','show','create','put','update'];(function(_0x323591,_0x518650){var _0x423982=function(_0x1b7a15){while(--_0x1b7a15){_0x323591['push'](_0x323591['shift']());}};_0x423982(++_0x518650);}(_0x938d,0x122));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd938('0x0'));var util=require(_0xd938('0x1'));var path=require('path');var timeout=require(_0xd938('0x2'));var express=require(_0xd938('0x3'));var router=express[_0xd938('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd938('0x5'));var config=require(_0xd938('0x6'));var controller=require(_0xd938('0x7'));router['get']('/',auth[_0xd938('0x8')](),controller[_0xd938('0x9')]);router[_0xd938('0xa')](_0xd938('0xb'),auth[_0xd938('0x8')](),controller[_0xd938('0xc')]);router['post']('/',auth[_0xd938('0x8')](),controller[_0xd938('0xd')]);router[_0xd938('0xe')](_0xd938('0xb'),auth[_0xd938('0x8')](),controller[_0xd938('0xf')]);router['delete'](_0xd938('0xb'),auth[_0xd938('0x8')](),controller[_0xd938('0x10')]);module[_0xd938('0x11')]=router; \ No newline at end of file +var _0x3baf=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','post','create','put'];(function(_0x13750c,_0x91becf){var _0x26acfd=function(_0x3ef89d){while(--_0x3ef89d){_0x13750c['push'](_0x13750c['shift']());}};_0x26acfd(++_0x91becf);}(_0x3baf,0xf7));var _0xf3ba=function(_0x11db48,_0x363415){_0x11db48=_0x11db48-0x0;var _0x2cc224=_0x3baf[_0x11db48];return _0x2cc224;};'use strict';var multer=require(_0xf3ba('0x0'));var util=require(_0xf3ba('0x1'));var path=require(_0xf3ba('0x2'));var timeout=require(_0xf3ba('0x3'));var express=require(_0xf3ba('0x4'));var router=express[_0xf3ba('0x5')]();var fs_extra=require(_0xf3ba('0x6'));var auth=require(_0xf3ba('0x7'));var interaction=require(_0xf3ba('0x8'));var config=require(_0xf3ba('0x9'));var controller=require(_0xf3ba('0xa'));router[_0xf3ba('0xb')]('/',auth[_0xf3ba('0xc')](),controller[_0xf3ba('0xd')]);router[_0xf3ba('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf3ba('0xe')]('/',auth['isAuthenticated'](),controller[_0xf3ba('0xf')]);router[_0xf3ba('0x10')](_0xf3ba('0x11'),auth[_0xf3ba('0xc')](),controller[_0xf3ba('0x12')]);router[_0xf3ba('0x13')](_0xf3ba('0x11'),auth[_0xf3ba('0xc')](),controller[_0xf3ba('0x14')]);module[_0xf3ba('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 4c4f68b..edd540a 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 _0x29af=['DATE','format','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','STRING','BOOLEAN'];(function(_0x3a1a1d,_0x39767f){var _0x188668=function(_0x46df3a){while(--_0x46df3a){_0x3a1a1d['push'](_0x3a1a1d['shift']());}};_0x188668(++_0x39767f);}(_0x29af,0xb0));var _0xf29a=function(_0x1fffcc,_0xb258ec){_0x1fffcc=_0x1fffcc-0x0;var _0xa83ea3=_0x29af[_0x1fffcc];return _0xa83ea3;};'use strict';var moment=require(_0xf29a('0x0'));var Sequelize=require(_0xf29a('0x1'));module['exports']={'phone':{'type':Sequelize[_0xf29a('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xf29a('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xf29a('0x4')],'defaultValue':moment()[_0xf29a('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xf29a('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf29a('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xf29a('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf29a('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf29a('0x4')]},'priority':{'type':Sequelize[_0xf29a('0x6')](0x2)[_0xf29a('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xf29a('0x6')],'unique':_0xf29a('0x8')},'ListId':{'type':Sequelize[_0xf29a('0x6')],'unique':_0xf29a('0x8')},'UserId':{'type':Sequelize[_0xf29a('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xf29a('0x8')},'CampaignId':{'type':Sequelize[_0xf29a('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xf29a('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf29a('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf29a('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf29a('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xf29a('0x2')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x7779=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','STRING','BOOLEAN','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7779,0xe1));var _0x9777=function(_0x299eb8,_0x2a3c76){_0x299eb8=_0x299eb8-0x0;var _0x59ee49=_0x7779[_0x299eb8];return _0x59ee49;};'use strict';var moment=require(_0x9777('0x0'));var Sequelize=require(_0x9777('0x1'));module['exports']={'phone':{'type':Sequelize[_0x9777('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x9777('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x9777('0x4')],'defaultValue':moment()[_0x9777('0x5')](_0x9777('0x6'))},'countbusyretry':{'type':Sequelize[_0x9777('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9777('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x9777('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9777('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9777('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x9777('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x9777('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x9777('0x7')],'unique':_0x9777('0x9')},'ListId':{'type':Sequelize[_0x9777('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x9777('0x7')],'unique':_0x9777('0x9')},'CampaignId':{'type':Sequelize[_0x9777('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x9777('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9777('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x9777('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x9777('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x9777('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 4a0c61a..4892f89 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 _0x7217=['utcOffset','getTimezone','timezones','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','then','sendStatus','stack','name','index','map','CmHopper','rawAttributes','fieldName','type','key','query','keys','filters','model','concat','$and','$or','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$like','$notILike','$overlap','$contains','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','catch','create','body','find','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','isNil','lastName','end','getPreview','describe','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue','dialActive','getPreviewRecall','Company','update','getOpenContacts','isNumber','error'];(function(_0x12f750,_0x1a6660){var _0x3cbcf0=function(_0x1beca9){while(--_0x1beca9){_0x12f750['push'](_0x12f750['shift']());}};_0x3cbcf0(++_0x1a6660);}(_0x7217,0x19e));var _0x7721=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x7217[_0x311c35];return _0x5cc50c;};'use strict';var moment=require(_0x7721('0x0'));var _=require('lodash');var qs=require(_0x7721('0x1'));var logger=require(_0x7721('0x2'))(_0x7721('0x3'));var shared=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];function respondWithResult(_0x4d6446,_0x5bf160){_0x5bf160=_0x5bf160||0xc8;return function(_0x472a96){if(_0x472a96){return _0x4d6446[_0x7721('0x6')](_0x5bf160)[_0x7721('0x7')](_0x472a96);}};}function respondWithFilteredResult(_0x3fe47c,_0xb239e0){return function(_0xf7ff37){if(_0xf7ff37){var _0x18ab6b=typeof _0xb239e0[_0x7721('0x8')]===_0x7721('0x9')&&typeof _0xb239e0[_0x7721('0xa')]===_0x7721('0x9');var _0x2a66cb=_0xf7ff37[_0x7721('0xb')];var _0x138740=_0x18ab6b?0x0:_0xb239e0[_0x7721('0x8')];var _0x578d59=_0x18ab6b?_0xf7ff37[_0x7721('0xb')]:_0xb239e0[_0x7721('0x8')]+_0xb239e0[_0x7721('0xa')];var _0xf78099;if(_0x578d59>=_0x2a66cb){_0x578d59=_0x2a66cb;_0xf78099=0xc8;}else{_0xf78099=0xce;}_0x3fe47c[_0x7721('0x6')](_0xf78099);return _0x3fe47c[_0x7721('0xc')](_0x7721('0xd'),_0x138740+'-'+_0x578d59+'/'+_0x2a66cb)[_0x7721('0x7')](_0xf7ff37);}return null;};}function saveUpdates(_0x55b4ca,_0x2911ec){return function(_0x199930){if(_0x199930){return _0x199930['update'](_0x55b4ca)[_0x7721('0xe')](function(_0x30da54){return _0x30da54;});}return null;};}function handleEntityNotFound(_0x3f01c5,_0x2e9752){return function(_0x5069da){if(!_0x5069da){_0x3f01c5[_0x7721('0xf')](0x194);}return _0x5069da;};}function handleError(_0x25b1c0,_0x534f1b){_0x534f1b=_0x534f1b||0x1f4;return function(_0x4e199a){logger['error'](_0x4e199a[_0x7721('0x10')]);if(_0x4e199a[_0x7721('0x11')]){delete _0x4e199a[_0x7721('0x11')];}_0x25b1c0[_0x7721('0x6')](_0x534f1b)['send'](_0x4e199a);};}exports[_0x7721('0x12')]=function(_0x54a838,_0x3fc09e){var _0x5cb0e6={},_0xfec626={},_0x4e96fb={'count':0x0,'rows':[]};var _0x3ab5a5=_[_0x7721('0x13')](db[_0x7721('0x14')][_0x7721('0x15')],function(_0x402820){return{'name':_0x402820[_0x7721('0x16')],'type':_0x402820[_0x7721('0x17')][_0x7721('0x18')]};});_0xfec626['model']=_[_0x7721('0x13')](_0x3ab5a5,_0x7721('0x11'));_0xfec626[_0x7721('0x19')]=_[_0x7721('0x1a')](_0x54a838['query']);_0xfec626[_0x7721('0x1b')]=_['intersection'](_0xfec626[_0x7721('0x1c')],_0xfec626[_0x7721('0x19')]);_0xfec626[_0x7721('0x1b')]=_[_0x7721('0x1d')](_0xfec626[_0x7721('0x1b')],[_0x7721('0x1e'),_0x7721('0x1f'),'$gt',_0x7721('0x20'),_0x7721('0x21'),_0x7721('0x22'),_0x7721('0x23'),_0x7721('0x24'),_0x7721('0x25'),_0x7721('0x26'),_0x7721('0x27'),_0x7721('0x28'),'$notIn',_0x7721('0x29'),'$notLike','$iLike',_0x7721('0x2a'),_0x7721('0x29'),_0x7721('0x2b'),_0x7721('0x2c'),_0x7721('0x2d'),_0x7721('0x2e')]);_0x5cb0e6[_0x7721('0x2f')]=_[_0x7721('0x30')](_0xfec626['model'],qs[_0x7721('0x31')](_0x54a838[_0x7721('0x19')]['fields']));_0x5cb0e6['attributes']=_0x5cb0e6[_0x7721('0x2f')][_0x7721('0x32')]?_0x5cb0e6['attributes']:_0xfec626[_0x7721('0x1c')];if(!_0x54a838[_0x7721('0x19')][_0x7721('0x33')]('nolimit')){_0x5cb0e6[_0x7721('0xa')]=qs[_0x7721('0xa')](_0x54a838[_0x7721('0x19')][_0x7721('0xa')]);_0x5cb0e6[_0x7721('0x8')]=qs['offset'](_0x54a838[_0x7721('0x19')][_0x7721('0x8')]);}_0x5cb0e6[_0x7721('0x34')]=qs['sort'](_0x54a838[_0x7721('0x19')][_0x7721('0x35')]);_0x5cb0e6['where']=qs[_0x7721('0x1b')](_['pick'](_0x54a838[_0x7721('0x19')],_0xfec626[_0x7721('0x1b')]),_0x3ab5a5);if(_0x54a838[_0x7721('0x19')][_0x7721('0x36')]){_0x5cb0e6[_0x7721('0x37')]=_[_0x7721('0x38')](_0x5cb0e6[_0x7721('0x37')],{'$or':_[_0x7721('0x13')](_0x3ab5a5,function(_0x25bdd9){if(_0x25bdd9[_0x7721('0x17')]!==_0x7721('0x39')){var _0x5c806d={};_0x5c806d[_0x25bdd9[_0x7721('0x11')]]={'$like':'%'+_0x54a838['query'][_0x7721('0x36')]+'%'};return _0x5c806d;}})});}_0x5cb0e6=_[_0x7721('0x38')]({},_0x5cb0e6,_0x54a838[_0x7721('0x3a')]);var _0x1d03de={'where':_0x5cb0e6[_0x7721('0x37')]};return db[_0x7721('0x14')]['count'](_0x1d03de)['then'](function(_0x4cadef){_0x4e96fb['count']=_0x4cadef;if(_0x54a838[_0x7721('0x19')][_0x7721('0x3b')]){_0x5cb0e6[_0x7721('0x3c')]=[{'all':!![]}];}return db[_0x7721('0x14')]['findAll'](_0x5cb0e6);})[_0x7721('0xe')](function(_0x4cf659){_0x4e96fb[_0x7721('0x3d')]=_0x4cf659;return _0x4e96fb;})[_0x7721('0xe')](respondWithFilteredResult(_0x3fc09e,_0x5cb0e6))['catch'](handleError(_0x3fc09e,null));};exports[_0x7721('0x3e')]=function(_0x3a47c8,_0x4e77ff){var _0x4d0111={'raw':!![],'where':{'id':_0x3a47c8[_0x7721('0x3f')]['id']}},_0x3d84d3={};_0x3d84d3[_0x7721('0x1c')]=_[_0x7721('0x1a')](db['CmHopper'][_0x7721('0x15')]);_0x3d84d3[_0x7721('0x19')]=_[_0x7721('0x1a')](_0x3a47c8[_0x7721('0x19')]);_0x3d84d3[_0x7721('0x1b')]=_['intersection'](_0x3d84d3[_0x7721('0x1c')],_0x3d84d3['query']);_0x4d0111[_0x7721('0x2f')]=_['intersection'](_0x3d84d3[_0x7721('0x1c')],qs[_0x7721('0x31')](_0x3a47c8[_0x7721('0x19')]['fields']));_0x4d0111[_0x7721('0x2f')]=_0x4d0111[_0x7721('0x2f')][_0x7721('0x32')]?_0x4d0111['attributes']:_0x3d84d3[_0x7721('0x1c')];if(_0x3a47c8[_0x7721('0x19')][_0x7721('0x3b')]){_0x4d0111[_0x7721('0x3c')]=[{'all':!![]}];}_0x4d0111=_[_0x7721('0x38')]({},_0x4d0111,_0x3a47c8[_0x7721('0x3a')]);return db[_0x7721('0x14')]['find'](_0x4d0111)['then'](handleEntityNotFound(_0x4e77ff,null))[_0x7721('0xe')](respondWithResult(_0x4e77ff,null))[_0x7721('0x40')](handleError(_0x4e77ff,null));};exports[_0x7721('0x41')]=function(_0x39a3ad,_0x335145){return db[_0x7721('0x14')][_0x7721('0x41')](_0x39a3ad[_0x7721('0x42')],{})[_0x7721('0xe')](respondWithResult(_0x335145,0xc9))[_0x7721('0x40')](handleError(_0x335145,null));};exports['update']=function(_0x578867,_0x5ed70d){if(_0x578867[_0x7721('0x42')]['id']){delete _0x578867[_0x7721('0x42')]['id'];}return db[_0x7721('0x14')]['find']({'where':{'id':_0x578867[_0x7721('0x3f')]['id']}})[_0x7721('0xe')](handleEntityNotFound(_0x5ed70d,null))['then'](saveUpdates(_0x578867[_0x7721('0x42')],null))['then'](respondWithResult(_0x5ed70d,null))[_0x7721('0x40')](handleError(_0x5ed70d,null));};exports['describe']=function(_0x334f23,_0x196be4){return db[_0x7721('0x14')]['describe']()[_0x7721('0xe')](respondWithResult(_0x196be4,null))[_0x7721('0x40')](handleError(_0x196be4,null));};exports['destroy']=function(_0x223d93,_0x1196c2){var _0xf88e8c;var _0x5c4078=_0x223d93[_0x7721('0x3f')]['id'];return db['CmHopper'][_0x7721('0x43')]({'where':{'id':_0x223d93[_0x7721('0x3f')]['id']}})[_0x7721('0xe')](handleEntityNotFound(_0x1196c2,null))[_0x7721('0xe')](function(_0x1c95d8){if(_0x1c95d8){return _0x1c95d8[_0x7721('0x44')]()[_0x7721('0xe')](function(_0x7fbb73){return _0x7fbb73;});}})[_0x7721('0xe')](function(_0x3386aa){_0xf88e8c=_0x3386aa;if(_0x3386aa){if(_0x3386aa[_0x7721('0x45')]||_0x3386aa[_0x7721('0x46')]){return db[_0x3386aa[_0x7721('0x45')]?_0x7721('0x47'):_0x7721('0x48')]['find']({'where':{'id':_0x3386aa[_0x7721('0x45')]?_0x3386aa[_0x7721('0x45')]:_0x3386aa[_0x7721('0x46')]},'attributes':['id',_0x7721('0x11')],'raw':!![]});}}})[_0x7721('0xe')](function(_0x315127){var _0x267f5e={};if(_0x315127){_['merge'](_0x267f5e,_[_0x7721('0x49')](_0xf88e8c[_0x7721('0x4a')],[_0x7721('0x4b'),_0x7721('0x4c'),'id']));_0x267f5e[_0x7721('0x4d')]=0x15;_0x267f5e[_0x7721('0x4e')]=_0x7721('0x4f');_0x267f5e[_0x7721('0x50')]=_0x315127[_0x7721('0x11')];_0x267f5e[_0x7721('0x51')]=_0x223d93[_0x7721('0x52')]['name'];_0x267f5e[_0x7721('0x53')]=_0x223d93[_0x7721('0x52')]['id'];_0x267f5e[_0x7721('0x4f')]=!![];_0x267f5e[_0x7721('0x54')]=moment()[_0x7721('0x55')](_0x7721('0x56'));_0x267f5e[_0x7721('0x57')]=_0xf88e8c[_0x7721('0x58')];_0x267f5e[_0x7721('0x59')]=_0xf88e8c[_0x7721('0x45')]?_0x7721('0x5a'):_0x7721('0x5b');return db[_0x7721('0x5c')][_0x7721('0x43')]({'where':{'id':_0x267f5e[_0x7721('0x5d')]},'attributes':['firstName','lastName']})['then'](function(_0x885a3a){if(!_['isNil'](_0x1196c2)&&!_['isNil'](_0x885a3a['firstName'])){_0x267f5e['calleridname']=_0x885a3a[_0x7721('0x5e')];if(!_[_0x7721('0x5f')](_0x885a3a[_0x7721('0x60')])){_0x267f5e['calleridname']+='\x20'+_0x885a3a[_0x7721('0x60')];}}})['finally'](function(){return db['CmHopperFinal']['create'](_0x267f5e);});}})[_0x7721('0xe')](function(_0x4f0d38){return db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':_0x5c4078}});})[_0x7721('0xe')](function(){return _0x1196c2[_0x7721('0x6')](0xcc)[_0x7721('0x61')]();})['catch'](handleError(_0x1196c2,null));};exports[_0x7721('0x62')]=function(_0x1f1890,_0x2c95d0){var _0x168343=[];return db[_0x7721('0x5c')][_0x7721('0x63')]()[_0x7721('0xe')](function(_0x3e3301){_0x168343=_[_0x7721('0x1a')](_0x3e3301);return _0x1f1890[_0x7721('0x52')][_0x7721('0x64')]({'where':{'type':_0x7721('0x65'),'dialActive':!![],'dialMethod':_0x7721('0x66')},'attributes':['id',_0x7721('0x67'),_0x7721('0x68')],'raw':!![]});})['then'](function(_0x233e5d){if(_0x233e5d&&_0x233e5d[_0x7721('0x32')]){return db[_0x7721('0x69')][_0x7721('0x6a')](function(_0x542e30){var _0x103009={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7721('0x55')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x7721('0x13')](_0x233e5d,'id')},'$or':[{'UserId':null},{'UserId':_0x1f1890['user']['id']}]};var _0x1f508d={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x233e5d)[_0x7721('0x36')]([_0x7721('0x68'),0x0])[_0x7721('0x13')]('id')[_0x7721('0x6b')]()},'$or':[{'UserId':null},{'UserId':_0x1f1890[_0x7721('0x52')]['id']}]};var _0x3121e0={'$or':[_0x103009,_0x1f508d]};var _0x167ce7=[];if(_0x1f1890[_0x7721('0x42')]['direction']&&_0x1f1890[_0x7721('0x42')][_0x7721('0x6c')]===_0x7721('0x6d')){if(!_[_0x7721('0x6e')](_0x1f1890[_0x7721('0x42')][_0x7721('0x6f')])){_0x3121e0['id']={'$in':_0x1f1890[_0x7721('0x42')]['hopperIds']};}_0x167ce7=[[_0x7721('0x70'),_0x7721('0x71')],['scheduledAt',_0x233e5d[0x0][_0x7721('0x67')]==='ASC'?_0x7721('0x72'):_0x7721('0x71')],db[_0x7721('0x69')][_0x7721('0x73')](_0x7721('0x74')),['id',_0x7721('0x72')]];}else{if(!_[_0x7721('0x6e')](_0x1f1890['body'][_0x7721('0x6f')])){_0x3121e0['id']={'$notIn':_0x1f1890[_0x7721('0x42')][_0x7721('0x6f')]};}_0x167ce7=[['priority','DESC'],['scheduledAt',_0x233e5d[0x0]['dialOrderByScheduledAt']],db['sequelize'][_0x7721('0x73')](_0x7721('0x75')),['id','ASC']];}return db[_0x7721('0x14')][_0x7721('0x76')]({'attributes':['id',_0x7721('0x77'),_0x7721('0x58'),'recallme'],'where':_0x3121e0,'order':_0x167ce7,'transaction':_0x542e30,'lock':_0x542e30[_0x7721('0x78')][_0x7721('0x79')],'include':[{'model':db[_0x7721('0x5c')],'as':_0x7721('0x7a'),'attributes':_0x168343,'include':[{'model':db[_0x7721('0x7b')],'as':'Company','attributes':['id',_0x7721('0x11')]}]},{'model':db[_0x7721('0x7c')],'as':_0x7721('0x7d'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x7721('0x7e'),'attributes':['id',_0x7721('0x11'),_0x7721('0x7f')]}]})[_0x7721('0xe')](function(_0x75a5cc){if(_0x75a5cc){return _0x75a5cc['update']({'UserId':_0x1f1890['user']['id']},{'transaction':_0x542e30});}});});}})[_0x7721('0xe')](handleEntityNotFound(_0x2c95d0,null))[_0x7721('0xe')](respondWithResult(_0x2c95d0,null))[_0x7721('0x40')](handleError(_0x2c95d0,null));};exports[_0x7721('0x80')]=function(_0x142ec6,_0x145a0b,_0x34187f){var _0x58f944=[];var _0xdfae41=_0x142ec6[_0x7721('0x3f')]['id'];var _0x27d7f1=_0x142ec6['user']['id'];return db[_0x7721('0x5c')][_0x7721('0x63')]()[_0x7721('0xe')](function(_0x321a40){_0x58f944=_['keys'](_0x321a40);return db['sequelize'][_0x7721('0x6a')](function(_0x2cac50){const _0x177fe3={'id':_0xdfae41};return db[_0x7721('0x14')][_0x7721('0x76')]({'attributes':['id',_0x7721('0x77'),'recallme'],'where':_0x177fe3,'transaction':_0x2cac50,'lock':_0x2cac50[_0x7721('0x78')][_0x7721('0x79')],'include':[{'model':db[_0x7721('0x5c')],'as':'Contact','attributes':_0x58f944,'include':[{'model':db[_0x7721('0x7b')],'as':_0x7721('0x81'),'attributes':['id',_0x7721('0x11')]}]},{'model':db[_0x7721('0x7c')],'as':_0x7721('0x7d'),'attributes':['id','name']},{'model':db[_0x7721('0x47')],'as':'Queue','attributes':['id',_0x7721('0x11'),_0x7721('0x7f')]}]})[_0x7721('0xe')](function(_0x7f0598){if(_0x7f0598){return _0x7f0598[_0x7721('0x82')]({'UserId':_0x27d7f1},{'transaction':_0x2cac50});}});});})[_0x7721('0xe')](handleEntityNotFound(_0x145a0b,null))[_0x7721('0xe')](respondWithResult(_0x145a0b,null))[_0x7721('0x40')](handleError(_0x145a0b,null));};exports[_0x7721('0x83')]=function(_0x3b78f5,_0x2c74d8){return _0x3b78f5['user'][_0x7721('0x64')]({'where':{'type':_0x7721('0x65'),'dialActive':!![],'dialMethod':_0x7721('0x66')},'attributes':['id'],'raw':!![]})['then'](function(_0x94af20){if(_0x94af20&&_0x94af20[_0x7721('0x32')]){return db[_0x7721('0x14')][_0x7721('0xb')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7721('0x55')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x7721('0x13')](_0x94af20,'id')},'$or':[{'UserId':null},{'UserId':_0x3b78f5[_0x7721('0x52')]['id']}]}});}return 0x0;})[_0x7721('0xe')](function(_0x21b365){if(!_[_0x7721('0x5f')](_0x21b365)&&_[_0x7721('0x84')](_0x21b365)){return _0x2c74d8['status'](0xc8)[_0x7721('0x7')]({'contacts':_0x21b365});}else{logger[_0x7721('0x85')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x7721('0x83'),0x194,'entity\x20not\x20found');_0x2c74d8[_0x7721('0xf')](0x194);}})[_0x7721('0x40')](handleError(_0x2c74d8,null));};exports['getTimezones']=function(_0x3e910c,_0x5209e1){var _0x56069f=shared['timezones'];var _0x1bd716=[];_[_0x7721('0x13')](_0x56069f,function(_0x21a686){_0x1bd716['push']({'id':_0x21a686['name'],'name':_0x21a686['name'],'utcOffset':_0x21a686[_0x7721('0x86')]});});return _0x5209e1[_0x7721('0x6')](0xc8)[_0x7721('0x7')]({'tz':_0x1bd716});};exports[_0x7721('0x87')]=function(_0x3b02d7,_0x259ee8){var _0x58302a=shared[_0x7721('0x88')];var _0x2514b3={};if(!_[_0x7721('0x5f')](_0x58302a[_0x3b02d7[_0x7721('0x42')]['id']]))_0x2514b3=_0x58302a[_0x3b02d7[_0x7721('0x42')]['id']];return _0x259ee8[_0x7721('0x6')](0xc8)[_0x7721('0x7')](_0x2514b3);}; \ No newline at end of file +var _0x61a5=['$gte','$lt','$lte','$ne','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contained','$any','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','catch','show','params','fields','include','options','find','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','membername','user','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','end','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','direction','hopperIds','ASC','DESC','isEmpty','priority','scheduledAt','literal','findOne','recallme','UPDATE','Contact','Company','List','Queue','getPreviewRecall','transaction','scheduledat','LOCK','CmCompany','CmList','dialActive','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','json','offset','undefined','count','limit','status','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','CmHopper','fieldName','type','model','map','query','keys','intersection','filters','$and','$or','$gt'];(function(_0x4c2189,_0x308589){var _0x583fa8=function(_0x25b5f8){while(--_0x25b5f8){_0x4c2189['push'](_0x4c2189['shift']());}};_0x583fa8(++_0x308589);}(_0x61a5,0xf0));var _0x561a=function(_0x52c4e9,_0x5412d0){_0x52c4e9=_0x52c4e9-0x0;var _0x252a03=_0x61a5[_0x52c4e9];return _0x252a03;};'use strict';var moment=require(_0x561a('0x0'));var _=require('lodash');var qs=require(_0x561a('0x1'));var logger=require(_0x561a('0x2'))(_0x561a('0x3'));var shared=require(_0x561a('0x4'));var db=require(_0x561a('0x5'))['db'];function respondWithResult(_0x58f636,_0xe92b4d){_0xe92b4d=_0xe92b4d||0xc8;return function(_0x33c0f5){if(_0x33c0f5){return _0x58f636['status'](_0xe92b4d)[_0x561a('0x6')](_0x33c0f5);}};}function respondWithFilteredResult(_0x31f762,_0x24c89a){return function(_0x2646bd){if(_0x2646bd){var _0x3d55f8=typeof _0x24c89a[_0x561a('0x7')]===_0x561a('0x8')&&typeof _0x24c89a['limit']===_0x561a('0x8');var _0x52563e=_0x2646bd[_0x561a('0x9')];var _0x5288b4=_0x3d55f8?0x0:_0x24c89a['offset'];var _0x34e464=_0x3d55f8?_0x2646bd[_0x561a('0x9')]:_0x24c89a['offset']+_0x24c89a[_0x561a('0xa')];var _0x5cc8ed;if(_0x34e464>=_0x52563e){_0x34e464=_0x52563e;_0x5cc8ed=0xc8;}else{_0x5cc8ed=0xce;}_0x31f762[_0x561a('0xb')](_0x5cc8ed);return _0x31f762[_0x561a('0xc')](_0x561a('0xd'),_0x5288b4+'-'+_0x34e464+'/'+_0x52563e)[_0x561a('0x6')](_0x2646bd);}return null;};}function saveUpdates(_0x2777c6,_0x3dfa9f){return function(_0x136465){if(_0x136465){return _0x136465[_0x561a('0xe')](_0x2777c6)[_0x561a('0xf')](function(_0x4f1e33){return _0x4f1e33;});}return null;};}function handleEntityNotFound(_0x2a332e,_0x28638b){return function(_0x5696b9){if(!_0x5696b9){_0x2a332e[_0x561a('0x10')](0x194);}return _0x5696b9;};}function handleError(_0x64498a,_0x1ab5ae){_0x1ab5ae=_0x1ab5ae||0x1f4;return function(_0xecbcc4){logger[_0x561a('0x11')](_0xecbcc4[_0x561a('0x12')]);if(_0xecbcc4[_0x561a('0x13')]){delete _0xecbcc4[_0x561a('0x13')];}_0x64498a[_0x561a('0xb')](_0x1ab5ae)[_0x561a('0x14')](_0xecbcc4);};}exports[_0x561a('0x15')]=function(_0x48df6a,_0x43c5aa){var _0x190057={},_0x533d95={},_0x11033f={'count':0x0,'rows':[]};var _0x785831=_['map'](db[_0x561a('0x16')]['rawAttributes'],function(_0x4d66b8){return{'name':_0x4d66b8[_0x561a('0x17')],'type':_0x4d66b8[_0x561a('0x18')]['key']};});_0x533d95[_0x561a('0x19')]=_[_0x561a('0x1a')](_0x785831,_0x561a('0x13'));_0x533d95[_0x561a('0x1b')]=_[_0x561a('0x1c')](_0x48df6a[_0x561a('0x1b')]);_0x533d95['filters']=_[_0x561a('0x1d')](_0x533d95[_0x561a('0x19')],_0x533d95[_0x561a('0x1b')]);_0x533d95['filters']=_['concat'](_0x533d95[_0x561a('0x1e')],[_0x561a('0x1f'),_0x561a('0x20'),_0x561a('0x21'),_0x561a('0x22'),_0x561a('0x23'),_0x561a('0x24'),_0x561a('0x25'),'$eq','$not',_0x561a('0x26'),_0x561a('0x27'),_0x561a('0x28'),_0x561a('0x29'),'$like',_0x561a('0x2a'),_0x561a('0x2b'),_0x561a('0x2c'),_0x561a('0x2d'),_0x561a('0x2e'),'$contains',_0x561a('0x2f'),_0x561a('0x30')]);_0x190057['attributes']=_[_0x561a('0x1d')](_0x533d95[_0x561a('0x19')],qs['fields'](_0x48df6a[_0x561a('0x1b')]['fields']));_0x190057['attributes']=_0x190057[_0x561a('0x31')][_0x561a('0x32')]?_0x190057['attributes']:_0x533d95[_0x561a('0x19')];if(!_0x48df6a[_0x561a('0x1b')][_0x561a('0x33')](_0x561a('0x34'))){_0x190057[_0x561a('0xa')]=qs[_0x561a('0xa')](_0x48df6a[_0x561a('0x1b')][_0x561a('0xa')]);_0x190057['offset']=qs[_0x561a('0x7')](_0x48df6a[_0x561a('0x1b')][_0x561a('0x7')]);}_0x190057[_0x561a('0x35')]=qs[_0x561a('0x36')](_0x48df6a['query'][_0x561a('0x36')]);_0x190057[_0x561a('0x37')]=qs[_0x561a('0x1e')](_[_0x561a('0x38')](_0x48df6a['query'],_0x533d95[_0x561a('0x1e')]),_0x785831);if(_0x48df6a[_0x561a('0x1b')][_0x561a('0x39')]){_0x190057['where']=_['merge'](_0x190057[_0x561a('0x37')],{'$or':_['map'](_0x785831,function(_0x5a45a4){if(_0x5a45a4['type']!==_0x561a('0x3a')){var _0x2a2479={};_0x2a2479[_0x5a45a4[_0x561a('0x13')]]={'$like':'%'+_0x48df6a[_0x561a('0x1b')][_0x561a('0x39')]+'%'};return _0x2a2479;}})});}_0x190057=_[_0x561a('0x3b')]({},_0x190057,_0x48df6a['options']);var _0x588a39={'where':_0x190057[_0x561a('0x37')]};return db[_0x561a('0x16')][_0x561a('0x9')](_0x588a39)[_0x561a('0xf')](function(_0x4d81f7){_0x11033f[_0x561a('0x9')]=_0x4d81f7;if(_0x48df6a[_0x561a('0x1b')][_0x561a('0x3c')]){_0x190057['include']=[{'all':!![]}];}return db[_0x561a('0x16')][_0x561a('0x3d')](_0x190057);})[_0x561a('0xf')](function(_0x330c8d){_0x11033f['rows']=_0x330c8d;return _0x11033f;})[_0x561a('0xf')](respondWithFilteredResult(_0x43c5aa,_0x190057))[_0x561a('0x3e')](handleError(_0x43c5aa,null));};exports[_0x561a('0x3f')]=function(_0x5c59dc,_0x3ebf2b){var _0x3ae2db={'raw':!![],'where':{'id':_0x5c59dc[_0x561a('0x40')]['id']}},_0x289c68={};_0x289c68[_0x561a('0x19')]=_[_0x561a('0x1c')](db[_0x561a('0x16')]['rawAttributes']);_0x289c68[_0x561a('0x1b')]=_[_0x561a('0x1c')](_0x5c59dc[_0x561a('0x1b')]);_0x289c68[_0x561a('0x1e')]=_[_0x561a('0x1d')](_0x289c68[_0x561a('0x19')],_0x289c68['query']);_0x3ae2db[_0x561a('0x31')]=_[_0x561a('0x1d')](_0x289c68[_0x561a('0x19')],qs[_0x561a('0x41')](_0x5c59dc[_0x561a('0x1b')][_0x561a('0x41')]));_0x3ae2db[_0x561a('0x31')]=_0x3ae2db[_0x561a('0x31')][_0x561a('0x32')]?_0x3ae2db['attributes']:_0x289c68[_0x561a('0x19')];if(_0x5c59dc[_0x561a('0x1b')]['includeAll']){_0x3ae2db[_0x561a('0x42')]=[{'all':!![]}];}_0x3ae2db=_['merge']({},_0x3ae2db,_0x5c59dc[_0x561a('0x43')]);return db[_0x561a('0x16')][_0x561a('0x44')](_0x3ae2db)[_0x561a('0xf')](handleEntityNotFound(_0x3ebf2b,null))[_0x561a('0xf')](respondWithResult(_0x3ebf2b,null))['catch'](handleError(_0x3ebf2b,null));};exports[_0x561a('0x45')]=function(_0x12e7c6,_0x30b94d){return db[_0x561a('0x16')][_0x561a('0x45')](_0x12e7c6[_0x561a('0x46')],{})['then'](respondWithResult(_0x30b94d,0xc9))['catch'](handleError(_0x30b94d,null));};exports[_0x561a('0xe')]=function(_0x5d6f3d,_0x4c4127){if(_0x5d6f3d['body']['id']){delete _0x5d6f3d['body']['id'];}return db['CmHopper'][_0x561a('0x44')]({'where':{'id':_0x5d6f3d[_0x561a('0x40')]['id']}})[_0x561a('0xf')](handleEntityNotFound(_0x4c4127,null))['then'](saveUpdates(_0x5d6f3d[_0x561a('0x46')],null))['then'](respondWithResult(_0x4c4127,null))['catch'](handleError(_0x4c4127,null));};exports[_0x561a('0x47')]=function(_0x13a2ad,_0x19d247){return db['CmHopper'][_0x561a('0x47')]()['then'](respondWithResult(_0x19d247,null))[_0x561a('0x3e')](handleError(_0x19d247,null));};exports['destroy']=function(_0x1bd3df,_0x43d557){var _0x68dc4a;var _0x14d82b=_0x1bd3df[_0x561a('0x40')]['id'];return db[_0x561a('0x16')][_0x561a('0x44')]({'where':{'id':_0x1bd3df[_0x561a('0x40')]['id']}})[_0x561a('0xf')](handleEntityNotFound(_0x43d557,null))['then'](function(_0x1cb7e4){if(_0x1cb7e4){return _0x1cb7e4[_0x561a('0x48')]()[_0x561a('0xf')](function(_0x48ed34){return _0x48ed34;});}})[_0x561a('0xf')](function(_0x4583b1){_0x68dc4a=_0x4583b1;if(_0x4583b1){if(_0x4583b1['VoiceQueueId']||_0x4583b1[_0x561a('0x49')]){return db[_0x4583b1[_0x561a('0x4a')]?_0x561a('0x4b'):'Campaign'][_0x561a('0x44')]({'where':{'id':_0x4583b1[_0x561a('0x4a')]?_0x4583b1[_0x561a('0x4a')]:_0x4583b1[_0x561a('0x49')]},'attributes':['id',_0x561a('0x13')],'raw':!![]});}}})[_0x561a('0xf')](function(_0x3d9b63){var _0x4ebb99={};if(_0x3d9b63){_[_0x561a('0x3b')](_0x4ebb99,_[_0x561a('0x4c')](_0x68dc4a[_0x561a('0x4d')],[_0x561a('0x4e'),_0x561a('0x4f'),'id']));_0x4ebb99[_0x561a('0x50')]=0x15;_0x4ebb99[_0x561a('0x51')]='deleted';_0x4ebb99[_0x561a('0x52')]=_0x3d9b63[_0x561a('0x13')];_0x4ebb99[_0x561a('0x53')]=_0x1bd3df['user'][_0x561a('0x13')];_0x4ebb99['UserId']=_0x1bd3df[_0x561a('0x54')]['id'];_0x4ebb99[_0x561a('0x55')]=!![];_0x4ebb99[_0x561a('0x56')]=moment()[_0x561a('0x57')](_0x561a('0x58'));_0x4ebb99[_0x561a('0x59')]=_0x68dc4a[_0x561a('0x5a')];_0x4ebb99['campaigntype']=_0x68dc4a['VoiceQueueId']?_0x561a('0x5b'):_0x561a('0x5c');return db[_0x561a('0x5d')][_0x561a('0x44')]({'where':{'id':_0x4ebb99[_0x561a('0x5e')]},'attributes':[_0x561a('0x5f'),'lastName']})[_0x561a('0xf')](function(_0x1b0ecf){if(!_['isNil'](_0x43d557)&&!_[_0x561a('0x60')](_0x1b0ecf['firstName'])){_0x4ebb99[_0x561a('0x61')]=_0x1b0ecf[_0x561a('0x5f')];if(!_[_0x561a('0x60')](_0x1b0ecf[_0x561a('0x62')])){_0x4ebb99[_0x561a('0x61')]+='\x20'+_0x1b0ecf['lastName'];}}})[_0x561a('0x63')](function(){return db['CmHopperFinal'][_0x561a('0x45')](_0x4ebb99);});}})[_0x561a('0xf')](function(_0x457d0e){return db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':_0x14d82b}});})['then'](function(){return _0x43d557['status'](0xcc)[_0x561a('0x64')]();})[_0x561a('0x3e')](handleError(_0x43d557,null));};exports['getPreview']=function(_0xb0f744,_0xe76184){var _0x209f07=[];return db['CmContact'][_0x561a('0x47')]()[_0x561a('0xf')](function(_0x4341a4){_0x209f07=_[_0x561a('0x1c')](_0x4341a4);return _0xb0f744[_0x561a('0x54')][_0x561a('0x65')]({'where':{'type':_0x561a('0x66'),'dialActive':!![],'dialMethod':_0x561a('0x67')},'attributes':['id',_0x561a('0x68'),_0x561a('0x69')],'raw':!![]});})[_0x561a('0xf')](function(_0x5ac279){if(_0x5ac279&&_0x5ac279[_0x561a('0x32')]){return db[_0x561a('0x6a')]['transaction'](function(_0x54056b){var _0x33509a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x561a('0x57')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x561a('0x1a')](_0x5ac279,'id')},'$or':[{'UserId':null},{'UserId':_0xb0f744[_0x561a('0x54')]['id']}]};var _0x174483={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x5ac279)[_0x561a('0x39')]([_0x561a('0x69'),0x0])[_0x561a('0x1a')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0xb0f744['user']['id']}]};var _0x518826={'$or':[_0x33509a,_0x174483]};var _0x21234d=[];if(_0xb0f744[_0x561a('0x46')][_0x561a('0x6b')]&&_0xb0f744[_0x561a('0x46')][_0x561a('0x6b')]==='prev'){if(!_['isEmpty'](_0xb0f744['body'][_0x561a('0x6c')])){_0x518826['id']={'$in':_0xb0f744[_0x561a('0x46')][_0x561a('0x6c')]};}_0x21234d=[['priority','ASC'],['scheduledAt',_0x5ac279[0x0]['dialOrderByScheduledAt']===_0x561a('0x6d')?_0x561a('0x6e'):'ASC'],db[_0x561a('0x6a')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x561a('0x6e')]];}else{if(!_[_0x561a('0x6f')](_0xb0f744['body'][_0x561a('0x6c')])){_0x518826['id']={'$notIn':_0xb0f744['body'][_0x561a('0x6c')]};}_0x21234d=[[_0x561a('0x70'),_0x561a('0x6e')],[_0x561a('0x71'),_0x5ac279[0x0][_0x561a('0x68')]],db[_0x561a('0x6a')][_0x561a('0x72')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db[_0x561a('0x16')][_0x561a('0x73')]({'attributes':['id','scheduledat',_0x561a('0x5a'),_0x561a('0x74')],'where':_0x518826,'order':_0x21234d,'transaction':_0x54056b,'lock':_0x54056b['LOCK'][_0x561a('0x75')],'include':[{'model':db[_0x561a('0x5d')],'as':_0x561a('0x76'),'attributes':_0x209f07,'include':[{'model':db['CmCompany'],'as':_0x561a('0x77'),'attributes':['id',_0x561a('0x13')]}]},{'model':db['CmList'],'as':_0x561a('0x78'),'attributes':['id','name']},{'model':db[_0x561a('0x4b')],'as':_0x561a('0x79'),'attributes':['id',_0x561a('0x13'),'dialActive']}]})[_0x561a('0xf')](function(_0x4e155f){if(_0x4e155f){return _0x4e155f[_0x561a('0xe')]({'UserId':_0xb0f744['user']['id']},{'transaction':_0x54056b});}});});}})[_0x561a('0xf')](handleEntityNotFound(_0xe76184,null))[_0x561a('0xf')](respondWithResult(_0xe76184,null))[_0x561a('0x3e')](handleError(_0xe76184,null));};exports[_0x561a('0x7a')]=function(_0x3e0b55,_0x127301,_0x4dcb3a){var _0x528846=[];var _0x43dd9b=_0x3e0b55[_0x561a('0x40')]['id'];var _0x5153f0=_0x3e0b55[_0x561a('0x54')]['id'];return db[_0x561a('0x5d')][_0x561a('0x47')]()[_0x561a('0xf')](function(_0x26699b){_0x528846=_[_0x561a('0x1c')](_0x26699b);return db[_0x561a('0x6a')][_0x561a('0x7b')](function(_0x127a29){const _0x45df37={'id':_0x43dd9b};return db[_0x561a('0x16')][_0x561a('0x73')]({'attributes':['id',_0x561a('0x7c'),'recallme'],'where':_0x45df37,'transaction':_0x127a29,'lock':_0x127a29[_0x561a('0x7d')][_0x561a('0x75')],'include':[{'model':db[_0x561a('0x5d')],'as':'Contact','attributes':_0x528846,'include':[{'model':db[_0x561a('0x7e')],'as':_0x561a('0x77'),'attributes':['id',_0x561a('0x13')]}]},{'model':db[_0x561a('0x7f')],'as':'List','attributes':['id',_0x561a('0x13')]},{'model':db[_0x561a('0x4b')],'as':_0x561a('0x79'),'attributes':['id',_0x561a('0x13'),_0x561a('0x80')]}]})[_0x561a('0xf')](function(_0x40d801){if(_0x40d801){return _0x40d801['update']({'UserId':_0x5153f0},{'transaction':_0x127a29});}});});})['then'](handleEntityNotFound(_0x127301,null))[_0x561a('0xf')](respondWithResult(_0x127301,null))[_0x561a('0x3e')](handleError(_0x127301,null));};exports['getOpenContacts']=function(_0x5a6e8a,_0x54f78e){return _0x5a6e8a[_0x561a('0x54')][_0x561a('0x65')]({'where':{'type':_0x561a('0x66'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x4ec14a){if(_0x4ec14a&&_0x4ec14a[_0x561a('0x32')]){return db[_0x561a('0x16')][_0x561a('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x561a('0x57')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x561a('0x1a')](_0x4ec14a,'id')},'$or':[{'UserId':null},{'UserId':_0x5a6e8a[_0x561a('0x54')]['id']}]}});}return 0x0;})[_0x561a('0xf')](function(_0x3698c2){if(!_[_0x561a('0x60')](_0x3698c2)&&_['isNumber'](_0x3698c2)){return _0x54f78e['status'](0xc8)[_0x561a('0x6')]({'contacts':_0x3698c2});}else{logger[_0x561a('0x11')](_0x561a('0x81'),_0x561a('0x82'),0x194,_0x561a('0x83'));_0x54f78e[_0x561a('0x10')](0x194);}})['catch'](handleError(_0x54f78e,null));};exports[_0x561a('0x84')]=function(_0x1d3771,_0x168fe8){var _0x443a4a=shared[_0x561a('0x85')];var _0x56ce02=[];_[_0x561a('0x1a')](_0x443a4a,function(_0x81c3e4){_0x56ce02[_0x561a('0x86')]({'id':_0x81c3e4[_0x561a('0x13')],'name':_0x81c3e4[_0x561a('0x13')],'utcOffset':_0x81c3e4[_0x561a('0x87')]});});return _0x168fe8[_0x561a('0xb')](0xc8)[_0x561a('0x6')]({'tz':_0x56ce02});};exports[_0x561a('0x88')]=function(_0x5bdb1c,_0x379e9e){var _0x2d3cb3=shared[_0x561a('0x85')];var _0x2874a0={};if(!_[_0x561a('0x60')](_0x2d3cb3[_0x5bdb1c[_0x561a('0x46')]['id']]))_0x2874a0=_0x2d3cb3[_0x5bdb1c[_0x561a('0x46')]['id']];return _0x379e9e['status'](0xc8)[_0x561a('0x6')](_0x2874a0);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 14ab9b4..da55429 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 _0x4975=['exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes'];(function(_0x33ea46,_0x27da46){var _0x261a12=function(_0x23e9f6){while(--_0x23e9f6){_0x33ea46['push'](_0x33ea46['shift']());}};_0x261a12(++_0x27da46);}(_0x4975,0x86));var _0x5497=function(_0x2d87a2,_0x2bd433){_0x2d87a2=_0x2d87a2-0x0;var _0x287e57=_0x4975[_0x2d87a2];return _0x287e57;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['scheduledat']},{'name':_0x5497('0xe'),'fields':['phone']},{'name':_0x5497('0xf'),'fields':[_0x5497('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbd51=['./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4e9a22,_0x65e645){var _0x364420=function(_0x4ecb09){while(--_0x4ecb09){_0x4e9a22['push'](_0x4e9a22['shift']());}};_0x364420(++_0x65e645);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x2ee485,_0x489149){_0x2ee485=_0x2ee485-0x0;var _0x491080=_0xbd51[_0x2ee485];return _0x491080;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var logger=require(_0x1bd5('0x1'))(_0x1bd5('0x2'));var moment=require(_0x1bd5('0x3'));var BPromise=require(_0x1bd5('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(_0x1bd5('0x5'));module[_0x1bd5('0x6')]=function(_0x43e6b6,_0x59ddfb){return _0x43e6b6[_0x1bd5('0x7')](_0x1bd5('0x8'),attributes,{'tableName':_0x1bd5('0x9'),'paranoid':![],'indexes':[{'name':_0x1bd5('0xa'),'fields':[_0x1bd5('0xa')]},{'name':'phone','fields':[_0x1bd5('0xb')]},{'name':'priority','fields':[_0x1bd5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 8541ac5..8e9d4a6 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 _0x40fd=['attributes','map','include','model','then','info','debug','error','message','ShowCmHopper','find','where','stringify','catch','CreateCmHopper','create','body','UpdateCmHopper','update','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','UPDATE','Contact','keys','User','Agent','voicePause','length','UserId','includes','push','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','destroy','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','LOCK','all','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()','name','List','lodash','moment','rpc','GetCmHopper','CmHopper','findAll','options','raw'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x40fd,0x17e));var _0xd40f=function(_0x4e7551,_0x398ee5){_0x4e7551=_0x4e7551-0x0;var _0x2c2ae8=_0x40fd[_0x4e7551];return _0x2c2ae8;};'use strict';var _=require(_0xd40f('0x0'));var util=require('util');var moment=require(_0xd40f('0x1'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xd40f('0x2'));exports[_0xd40f('0x3')]=function(_0xbe3839){var _0x191e08=this;return new Promise(function(_0x235998,_0x3b8911){return db[_0xd40f('0x4')][_0xd40f('0x5')]({'raw':_0xbe3839['options']?_0xbe3839[_0xd40f('0x6')][_0xd40f('0x7')]===undefined?!![]:![]:!![],'where':_0xbe3839[_0xd40f('0x6')]?_0xbe3839[_0xd40f('0x6')]['where']||null:null,'attributes':_0xbe3839[_0xd40f('0x6')]?_0xbe3839[_0xd40f('0x6')][_0xd40f('0x8')]||null:null,'limit':_0xbe3839['options']?_0xbe3839[_0xd40f('0x6')]['limit']||null:null,'include':_0xbe3839[_0xd40f('0x6')]?_0xbe3839[_0xd40f('0x6')]['include']?_[_0xd40f('0x9')](_0xbe3839[_0xd40f('0x6')][_0xd40f('0xa')],function(_0x14b696){return{'model':db[_0x14b696[_0xd40f('0xb')]],'as':_0x14b696['as'],'attributes':_0x14b696[_0xd40f('0x8')],'include':_0x14b696[_0xd40f('0xa')]?_[_0xd40f('0x9')](_0x14b696['include'],function(_0x5b94e8){return{'model':db[_0x5b94e8['model']],'as':_0x5b94e8['as'],'attributes':_0x5b94e8[_0xd40f('0x8')],'include':_0x5b94e8['include']?_[_0xd40f('0x9')](_0x5b94e8[_0xd40f('0xa')],function(_0x589cb9){return{'model':db[_0x589cb9[_0xd40f('0xb')]],'as':_0x589cb9['as'],'attributes':_0x589cb9['attributes']};}):[]};}):[]};}):[]:[]})[_0xd40f('0xc')](function(_0x2968b9){logger[_0xd40f('0xd')]('GetCmHopper',_0xbe3839);logger[_0xd40f('0xe')]('GetCmHopper',_0xbe3839,JSON['stringify'](_0x2968b9));_0x235998(_0x2968b9);})['catch'](function(_0xf7dd9b){logger[_0xd40f('0xf')]('GetCmHopper',_0xf7dd9b[_0xd40f('0x10')],_0xbe3839);_0x3b8911(_0x191e08[_0xd40f('0xf')](0x1f4,_0xf7dd9b['message']));});});};exports[_0xd40f('0x11')]=function(_0x2ab4e1){var _0x45ed7c=this;return new Promise(function(_0x382f79,_0x52207a){return db[_0xd40f('0x4')][_0xd40f('0x12')]({'raw':_0x2ab4e1[_0xd40f('0x6')]?_0x2ab4e1[_0xd40f('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x2ab4e1[_0xd40f('0x6')]?_0x2ab4e1[_0xd40f('0x6')][_0xd40f('0x13')]||null:null,'attributes':_0x2ab4e1[_0xd40f('0x6')]?_0x2ab4e1[_0xd40f('0x6')][_0xd40f('0x8')]||null:null,'include':_0x2ab4e1['options']?_0x2ab4e1[_0xd40f('0x6')][_0xd40f('0xa')]?_[_0xd40f('0x9')](_0x2ab4e1['options'][_0xd40f('0xa')],function(_0x5e9017){return{'model':db[_0x5e9017[_0xd40f('0xb')]],'as':_0x5e9017['as'],'attributes':_0x5e9017[_0xd40f('0x8')],'include':_0x5e9017['include']?_[_0xd40f('0x9')](_0x5e9017['include'],function(_0x9cc726){return{'model':db[_0x9cc726[_0xd40f('0xb')]],'as':_0x9cc726['as'],'attributes':_0x9cc726['attributes'],'include':_0x9cc726[_0xd40f('0xa')]?_[_0xd40f('0x9')](_0x9cc726[_0xd40f('0xa')],function(_0x42ef57){return{'model':db[_0x42ef57[_0xd40f('0xb')]],'as':_0x42ef57['as'],'attributes':_0x42ef57[_0xd40f('0x8')]};}):[]};}):[]};}):[]:[]})[_0xd40f('0xc')](function(_0x28a57f){logger[_0xd40f('0xd')](_0xd40f('0x11'),_0x2ab4e1);logger['debug'](_0xd40f('0x11'),_0x2ab4e1,JSON[_0xd40f('0x14')](_0x28a57f));_0x382f79(_0x28a57f);})[_0xd40f('0x15')](function(_0x1ee2f3){logger['error']('ShowCmHopper',_0x1ee2f3[_0xd40f('0x10')],_0x2ab4e1);_0x52207a(_0x45ed7c['error'](0x1f4,_0x1ee2f3[_0xd40f('0x10')]));});});};exports[_0xd40f('0x16')]=function(_0xecf7cd){var _0x341718=this;return new Promise(function(_0x26ee8b,_0x567726){return db[_0xd40f('0x4')][_0xd40f('0x17')](_0xecf7cd[_0xd40f('0x18')],{'raw':_0xecf7cd[_0xd40f('0x6')]?_0xecf7cd['options']['raw']===undefined?!![]:![]:!![]})[_0xd40f('0xc')](function(_0x3699ef){logger[_0xd40f('0xd')](_0xd40f('0x16'),_0xecf7cd);logger[_0xd40f('0xe')]('CreateCmHopper',_0xecf7cd,JSON['stringify'](_0x3699ef));_0x26ee8b(_0x3699ef);})[_0xd40f('0x15')](function(_0x37c76c){logger[_0xd40f('0xf')](_0xd40f('0x16'),_0x37c76c[_0xd40f('0x10')],_0xecf7cd);_0x567726(_0x341718['error'](0x1f4,_0x37c76c[_0xd40f('0x10')]));});});};exports[_0xd40f('0x19')]=function(_0x3b12c1){var _0xe0b1f9=this;return new Promise(function(_0x57983b,_0x12222d){return db[_0xd40f('0x4')][_0xd40f('0x1a')](_0x3b12c1[_0xd40f('0x18')],{'raw':_0x3b12c1['options']?_0x3b12c1['options'][_0xd40f('0x7')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b12c1[_0xd40f('0x6')]?_0x3b12c1[_0xd40f('0x6')][_0xd40f('0x13')]||null:null,'attributes':_0x3b12c1[_0xd40f('0x6')]?_0x3b12c1['options'][_0xd40f('0x8')]||null:null,'limit':_0x3b12c1['options']?_0x3b12c1['options'][_0xd40f('0x1b')]||null:null})[_0xd40f('0xc')](function(_0x5d94d6){logger[_0xd40f('0xd')](_0xd40f('0x19'),_0x3b12c1);logger[_0xd40f('0xd')](_0xd40f('0x1c'),JSON[_0xd40f('0x14')](_0x3b12c1[_0xd40f('0x6')][_0xd40f('0x13')]),_0x3b12c1['body']['active']);logger[_0xd40f('0xe')]('UpdateCmHopper',_0x3b12c1,JSON[_0xd40f('0x14')](_0x5d94d6));_0x57983b(_0x5d94d6);})[_0xd40f('0x15')](function(_0x5ab696){logger[_0xd40f('0xf')](_0xd40f('0x19'),_0x5ab696[_0xd40f('0x10')],_0x3b12c1);_0x12222d(_0xe0b1f9[_0xd40f('0xf')](0x1f4,_0x5ab696[_0xd40f('0x10')]));});});};exports[_0xd40f('0x1d')]=function(_0x4b2503){var _0x474d40=this;return new Promise(function(_0x58e4de,_0xe6209a){return db[_0xd40f('0x4')]['destroy']({'where':_0x4b2503['options']?_0x4b2503['options'][_0xd40f('0x13')]||null:null})[_0xd40f('0xc')](function(_0x18dc52){logger[_0xd40f('0xd')]('DestroyCmHopper',_0x4b2503);logger['debug'](_0xd40f('0x1d'),_0x4b2503,JSON[_0xd40f('0x14')](_0x18dc52));_0x58e4de(_0x18dc52);})[_0xd40f('0x15')](function(_0xfd42ca){logger[_0xd40f('0xf')](_0xd40f('0x1d'),_0xfd42ca['message'],_0x4b2503);_0xe6209a(_0x474d40['error'](0x1f4,_0xfd42ca[_0xd40f('0x10')]));});});};exports[_0xd40f('0x1e')]=function(_0x193c72){var _0x41556e=this;return new Promise(function(_0x491440,_0x5c4cbe){return db[_0xd40f('0x1f')][_0xd40f('0x20')]()['then'](function(_0x35df47){return db[_0xd40f('0x21')][_0xd40f('0x22')](function(_0x2c2358){return db[_0xd40f('0x4')]['findAll']({'where':_0x193c72[_0xd40f('0x6')]?_0x193c72['options'][_0xd40f('0x13')]||null:null,'attributes':_0x193c72[_0xd40f('0x6')]?_0x193c72[_0xd40f('0x6')]['attributes']||null:null,'limit':_0x193c72[_0xd40f('0x6')]?_0x193c72[_0xd40f('0x6')][_0xd40f('0x1b')]||null:null,'order':_0x193c72[_0xd40f('0x6')]?_0x193c72['options'][_0xd40f('0x23')]||null:null,'transaction':_0x2c2358,'lock':_0x2c2358['LOCK'][_0xd40f('0x24')],'include':[{'model':db['CmContact'],'as':_0xd40f('0x25'),'attributes':_[_0xd40f('0x26')](_0x35df47)},{'model':db[_0xd40f('0x27')],'as':_0xd40f('0x28'),'attributes':['id','name',_0xd40f('0x29')]}]})['then'](function(_0x3296d1){var _0x52a5fc=[];var _0x542406=[];for(var _0x256240=0x0;_0x256240<_0x3296d1[_0xd40f('0x2a')];_0x256240+=0x1){var _0x4e50ac=_0x3296d1[_0x256240][_0xd40f('0x2b')];if(_0x4e50ac===null){_0x52a5fc['push'](_0x3296d1[_0x256240]['update'](_0x193c72[_0xd40f('0x18')],{'transaction':_0x2c2358}));}else if(!_0x542406[_0xd40f('0x2c')](_0x4e50ac)){_0x542406['push'](_0x4e50ac);_0x52a5fc[_0xd40f('0x2d')](_0x3296d1[_0x256240]['update'](_0x193c72[_0xd40f('0x18')],{'transaction':_0x2c2358}));}}return BPromise['all'](_0x52a5fc);});})[_0xd40f('0xc')](function(_0x3ec95b){logger[_0xd40f('0xd')](_0xd40f('0x1e'),_0x193c72);if(_0x3ec95b[_0xd40f('0x2a')]>0x0){logger[_0xd40f('0xd')](_0xd40f('0x2e'),_0x3ec95b[0x0][_0xd40f('0x2f')]['id'],_0x3ec95b[0x0][_0xd40f('0x2f')][_0xd40f('0x30')],_0x3ec95b[0x0][_0xd40f('0x2f')]['active']);}logger[_0xd40f('0xe')](_0xd40f('0x1e'),_0x193c72,JSON['stringify'](_0x3ec95b));_0x491440(_0x3ec95b);})[_0xd40f('0x15')](function(_0x356da8){logger[_0xd40f('0xf')](_0xd40f('0x1e'),_0x356da8['message'],_0x193c72);_0x5c4cbe(_0x41556e[_0xd40f('0xf')](0x1f4,_0x356da8[_0xd40f('0x10')]));});});});};exports[_0xd40f('0x31')]=function(_0x4cfa32){var _0x5b4b36=this;return new Promise(function(_0x312052,_0x44cde9){return db[_0xd40f('0x21')][_0xd40f('0x22')](function(_0x5033a4){return db['CmHopperFinal'][_0xd40f('0x17')](_0x4cfa32[_0xd40f('0x18')],{'raw':_0x4cfa32['options']?_0x4cfa32['options'][_0xd40f('0x7')]===undefined?!![]:![]:!![],'transaction':_0x5033a4})[_0xd40f('0xc')](function(){logger[_0xd40f('0xd')](_0xd40f('0x32'),JSON[_0xd40f('0x14')](_0x4cfa32['options'][_0xd40f('0x13')]),_0x4cfa32[_0xd40f('0x6')]['where'][_0xd40f('0x33')]);return db[_0xd40f('0x4')][_0xd40f('0x34')]({'where':_0x4cfa32['options']?_0x4cfa32['options'][_0xd40f('0x13')]||null:null,'transaction':_0x5033a4});});})[_0xd40f('0xc')](function(_0x553610){logger[_0xd40f('0xd')](_0xd40f('0x31'),_0x4cfa32);logger[_0xd40f('0xe')]('MoveContactManagedDialer',_0x4cfa32,JSON[_0xd40f('0x14')](_0x553610));_0x312052(_0x553610);})[_0xd40f('0x15')](function(_0x7192a4){logger[_0xd40f('0xf')](_0xd40f('0x31'),_0x7192a4[_0xd40f('0x10')],_0x4cfa32);_0x44cde9(_0x5b4b36['error'](0x1f4,_0x7192a4[_0xd40f('0x10')]));});});};exports[_0xd40f('0x35')]=function(_0x232e03){var _0x1fe9f6=this;return new Promise(function(_0x167081,_0x4128ae){return db[_0xd40f('0x4')][_0xd40f('0x5')]({'raw':_0x232e03[_0xd40f('0x6')]?_0x232e03['options'][_0xd40f('0x7')]===undefined?!![]:![]:!![],'where':_0x232e03[_0xd40f('0x6')]?_0x232e03[_0xd40f('0x6')][_0xd40f('0x13')]||null:null,'attributes':[[db[_0xd40f('0x21')]['fn'](_0xd40f('0x36'),db[_0xd40f('0x21')]['fn']('IF',db[_0xd40f('0x21')][_0xd40f('0x37')](_0xd40f('0x38')+util[_0xd40f('0x39')](_0xd40f('0x3a'),moment()[_0xd40f('0x39')](_0xd40f('0x3b')))+_0xd40f('0x3c')))),'contactsRescheduled']]})[_0xd40f('0xc')](function(_0x3c0314){logger[_0xd40f('0xd')]('CountReScheduled',_0x232e03);logger['debug'](_0xd40f('0x35'),_0x232e03,JSON[_0xd40f('0x14')](_0x3c0314));_0x167081(_0x3c0314);})['catch'](function(_0x26fb76){logger[_0xd40f('0xf')](_0xd40f('0x35'),_0x26fb76['message'],_0x232e03);_0x4128ae(_0x1fe9f6[_0xd40f('0xf')](0x1f4,_0x26fb76[_0xd40f('0x10')]));});});};exports[_0xd40f('0x3d')]=function(_0x40b982){var _0x44911e=this;return new Promise(function(_0x21cd48,_0x45e8ad){return db[_0xd40f('0x1f')][_0xd40f('0x20')]()[_0xd40f('0xc')](function(){return db[_0xd40f('0x21')][_0xd40f('0x22')](function(_0x1f4c5f){return db['CmHopper'][_0xd40f('0x5')]({'where':_0x40b982[_0xd40f('0x6')]?_0x40b982[_0xd40f('0x6')][_0xd40f('0x13')]||null:null,'attributes':_0x40b982[_0xd40f('0x6')]?_0x40b982[_0xd40f('0x6')][_0xd40f('0x8')]||null:null,'limit':0x1,'order':_0x40b982[_0xd40f('0x6')]?_0x40b982[_0xd40f('0x6')][_0xd40f('0x23')]||null:null,'group':db[_0xd40f('0x4')]['UserId'],'transaction':_0x1f4c5f,'lock':_0x1f4c5f[_0xd40f('0x3e')]['UPDATE'],'include':_0x40b982[_0xd40f('0x6')]?_0x40b982['options'][_0xd40f('0xa')]?_[_0xd40f('0x9')](_0x40b982['options']['include'],function(_0x473952){return{'model':db[_0x473952[_0xd40f('0xb')]],'as':_0x473952['as'],'attributes':_0x473952[_0xd40f('0x8')],'include':_0x473952['include']?_['map'](_0x473952[_0xd40f('0xa')],function(_0xd3ea35){return{'model':db[_0xd3ea35[_0xd40f('0xb')]],'as':_0xd3ea35['as'],'attributes':_0xd3ea35[_0xd40f('0x8')],'include':_0xd3ea35[_0xd40f('0xa')]?_[_0xd40f('0x9')](_0xd3ea35[_0xd40f('0xa')],function(_0x4ac613){return{'model':db[_0x4ac613[_0xd40f('0xb')]],'as':_0x4ac613['as'],'attributes':_0x4ac613[_0xd40f('0x8')]};}):[]};}):[]};}):[]:[]})[_0xd40f('0xc')](function(_0x4b148e){var _0x537242=[];for(var _0x1f293c=0x0;_0x1f293c<_0x4b148e[_0xd40f('0x2a')];_0x1f293c+=0x1){_0x537242[_0xd40f('0x2d')](_0x4b148e[_0x1f293c]['update'](_0x40b982[_0xd40f('0x18')],{'transaction':_0x1f4c5f}));}return BPromise[_0xd40f('0x3f')](_0x537242);});})['then'](function(_0x27f829){logger[_0xd40f('0xd')](_0xd40f('0x3d'),_0x40b982);logger[_0xd40f('0xe')](_0xd40f('0x3d'),_0x40b982,JSON[_0xd40f('0x14')](_0x27f829));_0x21cd48(_0x27f829);})[_0xd40f('0x15')](function(_0x2d17be){logger[_0xd40f('0xf')]('GetContactRecallMe',_0x2d17be['message'],_0x40b982);_0x45e8ad(_0x44911e[_0xd40f('0xf')](0x1f4,_0x2d17be[_0xd40f('0x10')]));});});});};exports[_0xd40f('0x40')]=function(_0x42c8ff){var _0x483992=this;return new Promise(function(_0x4b3419,_0x4850d9){db['CmContact'][_0xd40f('0x20')]()['then'](function(_0x37ad6e){return db['CmHopper']['findAll']({'raw':_0x42c8ff[_0xd40f('0x6')]?_0x42c8ff[_0xd40f('0x6')][_0xd40f('0x7')]===undefined?!![]:![]:!![],'where':_0x42c8ff[_0xd40f('0x6')]?_0x42c8ff[_0xd40f('0x6')][_0xd40f('0x13')]||null:null,'attributes':_0x42c8ff[_0xd40f('0x6')]?_0x42c8ff['options'][_0xd40f('0x8')]||null:null,'limit':_0x42c8ff['options']?_0x42c8ff[_0xd40f('0x6')]['limit']||null:null,'include':_0x42c8ff[_0xd40f('0x6')]?_0x42c8ff[_0xd40f('0x6')]['include']?_[_0xd40f('0x9')](_0x42c8ff['options'][_0xd40f('0xa')],function(_0x108ecd){return{'model':db[_0x108ecd['model']],'as':_0x108ecd['as'],'attributes':_0x108ecd['as']==='Contact'?_[_0xd40f('0x26')](_0x37ad6e):_0x108ecd[_0xd40f('0x8')],'include':_0x108ecd[_0xd40f('0xa')]?_[_0xd40f('0x9')](_0x108ecd[_0xd40f('0xa')],function(_0x40748c){return{'model':db[_0x40748c[_0xd40f('0xb')]],'as':_0x40748c['as'],'attributes':_0x40748c[_0xd40f('0x8')],'include':_0x40748c['include']?_[_0xd40f('0x9')](_0x40748c['include'],function(_0x353ca1){return{'model':db[_0x353ca1[_0xd40f('0xb')]],'as':_0x353ca1['as'],'attributes':_0x353ca1[_0xd40f('0x8')]};}):[]};}):[]};}):[]:[]})[_0xd40f('0xc')](function(_0x55cd87){logger[_0xd40f('0xd')](_0xd40f('0x3'),_0x42c8ff);logger[_0xd40f('0xe')](_0xd40f('0x3'),_0x42c8ff,JSON[_0xd40f('0x14')](_0x55cd87));_0x4b3419(_0x55cd87);})['catch'](function(_0x46d89a){logger[_0xd40f('0xf')]('GetCmHopper',_0x46d89a[_0xd40f('0x10')],_0x42c8ff);_0x4850d9(_0x483992['error'](0x1f4,_0x46d89a[_0xd40f('0x10')]));});});});};exports[_0xd40f('0x41')]=function(_0x2c1b08){var _0x58207c=this;return new Promise(function(_0x57dbf9,_0x217693){return db[_0xd40f('0x1f')][_0xd40f('0x42')]({'raw':!![],'where':{'phone':_0x2c1b08['options'][_0xd40f('0x13')][_0xd40f('0x43')]},'attributes':['id',_0xd40f('0x44')],'order':[['id',_0xd40f('0x45')]]})[_0xd40f('0xc')](function(_0x3e991f){logger[_0xd40f('0xd')](_0xd40f('0x46'),_0x2c1b08);logger[_0xd40f('0xe')](_0xd40f('0x46'),_0x2c1b08,JSON['stringify'](_0x3e991f));_0x57dbf9(_0x3e991f);})['catch'](function(_0x5f456d){logger[_0xd40f('0xf')](_0xd40f('0x46'),_0x5f456d[_0xd40f('0x10')],_0x2c1b08);_0x217693(_0x58207c[_0xd40f('0xf')](0x1f4,_0x5f456d[_0xd40f('0x10')]));});});};exports[_0xd40f('0x47')]=function(_0x1e453b){var _0x1b9de2=this;return new Promise(function(_0x4836dd,_0x41bb5f){return db['sequelize'][_0xd40f('0x22')](function(_0x54f119){var _0xe74269=_0x1e453b[_0xd40f('0x6')]&&_0x1e453b[_0xd40f('0x6')][_0xd40f('0x13')]?_0x1e453b[_0xd40f('0x6')][_0xd40f('0x13')]:{};return db[_0xd40f('0x4')][_0xd40f('0x1a')](_0x1e453b[_0xd40f('0x18')],{'where':_0xe74269,'transaction':_0x54f119})['then'](function(_0x2af9ef){logger[_0xd40f('0xd')](_0xd40f('0x47'),_0x1e453b);logger[_0xd40f('0xe')](_0xd40f('0x47'),_0x1e453b,JSON[_0xd40f('0x14')](_0x2af9ef));_0x4836dd(_0x2af9ef);})[_0xd40f('0x15')](function(_0x2f2bd1){logger[_0xd40f('0xf')](_0xd40f('0x47'),_0x2f2bd1[_0xd40f('0x10')],_0x1e453b);_0x41bb5f(_0x1b9de2[_0xd40f('0xf')](0x1f4,_0x2f2bd1['message']));});});});};exports[_0xd40f('0x48')]=function(_0x15cbff){var _0x5a8c31=this;var _0x2a8457=_0x15cbff['body'][_0xd40f('0x13')]['voiceQueueIds'];var _0x578085=_0x15cbff[_0xd40f('0x18')]['where'][_0xd40f('0x49')];var _0x50bcc4=_0x15cbff['body'][_0xd40f('0x13')][_0xd40f('0x4a')];return new Promise(function(_0x13ca41,_0x208fec){return db[_0xd40f('0x4')][_0xd40f('0x5')]({'where':{'voiceQueueId':{'$in':_0x2a8457},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xd40f('0x21')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x578085+'\x20MINUTE'),'$gt':db['sequelize'][_0xd40f('0x37')](_0xd40f('0x4b'))}},'UserId':{'$in':_0x50bcc4}},'include':[{'model':db[_0xd40f('0x1f')],'as':_0xd40f('0x25')},{'model':db[_0xd40f('0x27')],'as':'Agent','attributes':['id',_0xd40f('0x4c'),_0xd40f('0x29')]},{'model':db['CmList'],'as':_0xd40f('0x4d')}]})[_0xd40f('0xc')](function(_0x21b085){if(_0x21b085[_0xd40f('0x2a')]>0x0){return db[_0xd40f('0x21')][_0xd40f('0x22')](function(_0x1c69e3){return db[_0xd40f('0x4')]['update']({'recallmeNotifiedDate':db[_0xd40f('0x21')][_0xd40f('0x37')]('NOW()')},{'where':{'id':{'$in':_[_0xd40f('0x9')](_0x21b085,'id')}},'transaction':_0x1c69e3})['then'](function(){_0x13ca41(_0x21b085);})[_0xd40f('0x15')](function(_0x371437){logger[_0xd40f('0xf')](_0xd40f('0x48'),_0x371437[_0xd40f('0x10')],_0x15cbff);_0x208fec(_0x5a8c31[_0xd40f('0xf')](0x1f4,_0x371437[_0xd40f('0x10')]));});})[_0xd40f('0x15')](function(_0x5100bc){logger[_0xd40f('0xf')]('CmHopperHandlePreviewRecallNotifications',_0x5100bc['message'],_0x15cbff);_0x208fec(_0x5a8c31[_0xd40f('0xf')](0x1f4,_0x5100bc['message']));});}else{_0x13ca41(_0x21b085);}});});}; \ No newline at end of file +var _0xb9c1=['UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','User','Agent','name','length','push','all','GetContactDialer','dataValues','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','destroy','CountReScheduled','literal','format','\x22%s\x22','GetContactRecallMe','keys','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','NOW()','voicePause','CmList','List','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','model','map','info','stringify','catch','error','message','ShowCmHopper','find','then','debug','CreateCmHopper','create','body'];(function(_0x59ca7f,_0x340135){var _0x484377=function(_0x4f0cd9){while(--_0x4f0cd9){_0x59ca7f['push'](_0x59ca7f['shift']());}};_0x484377(++_0x340135);}(_0xb9c1,0xc1));var _0x1b9c=function(_0x3333e9,_0x4d1d0e){_0x3333e9=_0x3333e9-0x0;var _0x48b7bb=_0xb9c1[_0x3333e9];return _0x48b7bb;};'use strict';var _=require(_0x1b9c('0x0'));var util=require('util');var moment=require(_0x1b9c('0x1'));var BPromise=require(_0x1b9c('0x2'));var db=require(_0x1b9c('0x3'))['db'];var logger=require(_0x1b9c('0x4'))(_0x1b9c('0x5'));exports[_0x1b9c('0x6')]=function(_0x199494){var _0x145bf6=this;return new Promise(function(_0x212169,_0x594f40){return db[_0x1b9c('0x7')][_0x1b9c('0x8')]({'raw':_0x199494['options']?_0x199494[_0x1b9c('0x9')][_0x1b9c('0xa')]===undefined?!![]:![]:!![],'where':_0x199494[_0x1b9c('0x9')]?_0x199494[_0x1b9c('0x9')][_0x1b9c('0xb')]||null:null,'attributes':_0x199494[_0x1b9c('0x9')]?_0x199494[_0x1b9c('0x9')][_0x1b9c('0xc')]||null:null,'limit':_0x199494[_0x1b9c('0x9')]?_0x199494['options'][_0x1b9c('0xd')]||null:null,'include':_0x199494[_0x1b9c('0x9')]?_0x199494[_0x1b9c('0x9')]['include']?_['map'](_0x199494[_0x1b9c('0x9')][_0x1b9c('0xe')],function(_0x13bea2){return{'model':db[_0x13bea2[_0x1b9c('0xf')]],'as':_0x13bea2['as'],'attributes':_0x13bea2[_0x1b9c('0xc')],'include':_0x13bea2['include']?_[_0x1b9c('0x10')](_0x13bea2[_0x1b9c('0xe')],function(_0x3fc40d){return{'model':db[_0x3fc40d['model']],'as':_0x3fc40d['as'],'attributes':_0x3fc40d['attributes'],'include':_0x3fc40d[_0x1b9c('0xe')]?_[_0x1b9c('0x10')](_0x3fc40d['include'],function(_0x1717bb){return{'model':db[_0x1717bb[_0x1b9c('0xf')]],'as':_0x1717bb['as'],'attributes':_0x1717bb[_0x1b9c('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x191cd5){logger[_0x1b9c('0x11')]('GetCmHopper',_0x199494);logger['debug']('GetCmHopper',_0x199494,JSON[_0x1b9c('0x12')](_0x191cd5));_0x212169(_0x191cd5);})[_0x1b9c('0x13')](function(_0x49d3ec){logger[_0x1b9c('0x14')]('GetCmHopper',_0x49d3ec[_0x1b9c('0x15')],_0x199494);_0x594f40(_0x145bf6[_0x1b9c('0x14')](0x1f4,_0x49d3ec['message']));});});};exports[_0x1b9c('0x16')]=function(_0x52253b){var _0x92088a=this;return new Promise(function(_0x494c29,_0x3bf09e){return db[_0x1b9c('0x7')][_0x1b9c('0x17')]({'raw':_0x52253b[_0x1b9c('0x9')]?_0x52253b[_0x1b9c('0x9')][_0x1b9c('0xa')]===undefined?!![]:![]:!![],'where':_0x52253b[_0x1b9c('0x9')]?_0x52253b[_0x1b9c('0x9')]['where']||null:null,'attributes':_0x52253b[_0x1b9c('0x9')]?_0x52253b[_0x1b9c('0x9')][_0x1b9c('0xc')]||null:null,'include':_0x52253b[_0x1b9c('0x9')]?_0x52253b[_0x1b9c('0x9')]['include']?_[_0x1b9c('0x10')](_0x52253b[_0x1b9c('0x9')][_0x1b9c('0xe')],function(_0x14e952){return{'model':db[_0x14e952[_0x1b9c('0xf')]],'as':_0x14e952['as'],'attributes':_0x14e952[_0x1b9c('0xc')],'include':_0x14e952[_0x1b9c('0xe')]?_[_0x1b9c('0x10')](_0x14e952['include'],function(_0x51efbe){return{'model':db[_0x51efbe[_0x1b9c('0xf')]],'as':_0x51efbe['as'],'attributes':_0x51efbe['attributes'],'include':_0x51efbe[_0x1b9c('0xe')]?_['map'](_0x51efbe[_0x1b9c('0xe')],function(_0x4d2f46){return{'model':db[_0x4d2f46[_0x1b9c('0xf')]],'as':_0x4d2f46['as'],'attributes':_0x4d2f46[_0x1b9c('0xc')]};}):[]};}):[]};}):[]:[]})[_0x1b9c('0x18')](function(_0xa75b7f){logger['info'](_0x1b9c('0x16'),_0x52253b);logger[_0x1b9c('0x19')]('ShowCmHopper',_0x52253b,JSON[_0x1b9c('0x12')](_0xa75b7f));_0x494c29(_0xa75b7f);})[_0x1b9c('0x13')](function(_0x5ac689){logger['error'](_0x1b9c('0x16'),_0x5ac689['message'],_0x52253b);_0x3bf09e(_0x92088a[_0x1b9c('0x14')](0x1f4,_0x5ac689[_0x1b9c('0x15')]));});});};exports[_0x1b9c('0x1a')]=function(_0x54a9ef){var _0x2513b3=this;return new Promise(function(_0x340724,_0x280dfd){return db[_0x1b9c('0x7')][_0x1b9c('0x1b')](_0x54a9ef[_0x1b9c('0x1c')],{'raw':_0x54a9ef[_0x1b9c('0x9')]?_0x54a9ef[_0x1b9c('0x9')][_0x1b9c('0xa')]===undefined?!![]:![]:!![]})['then'](function(_0x5209f1){logger['info'](_0x1b9c('0x1a'),_0x54a9ef);logger['debug'](_0x1b9c('0x1a'),_0x54a9ef,JSON[_0x1b9c('0x12')](_0x5209f1));_0x340724(_0x5209f1);})[_0x1b9c('0x13')](function(_0x31fba3){logger[_0x1b9c('0x14')](_0x1b9c('0x1a'),_0x31fba3['message'],_0x54a9ef);_0x280dfd(_0x2513b3[_0x1b9c('0x14')](0x1f4,_0x31fba3['message']));});});};exports[_0x1b9c('0x1d')]=function(_0x4e975d){var _0x2acb57=this;return new Promise(function(_0x467ebd,_0x36bc0e){return db[_0x1b9c('0x7')][_0x1b9c('0x1e')](_0x4e975d[_0x1b9c('0x1c')],{'raw':_0x4e975d[_0x1b9c('0x9')]?_0x4e975d[_0x1b9c('0x9')][_0x1b9c('0xa')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e975d[_0x1b9c('0x9')]?_0x4e975d['options'][_0x1b9c('0xb')]||null:null,'attributes':_0x4e975d['options']?_0x4e975d[_0x1b9c('0x9')][_0x1b9c('0xc')]||null:null,'limit':_0x4e975d[_0x1b9c('0x9')]?_0x4e975d[_0x1b9c('0x9')][_0x1b9c('0xd')]||null:null})['then'](function(_0x59636b){logger[_0x1b9c('0x11')](_0x1b9c('0x1d'),_0x4e975d);logger[_0x1b9c('0x11')](_0x1b9c('0x1f'),JSON['stringify'](_0x4e975d[_0x1b9c('0x9')][_0x1b9c('0xb')]),_0x4e975d[_0x1b9c('0x1c')]['active']);logger[_0x1b9c('0x19')](_0x1b9c('0x1d'),_0x4e975d,JSON['stringify'](_0x59636b));_0x467ebd(_0x59636b);})['catch'](function(_0x566400){logger[_0x1b9c('0x14')]('UpdateCmHopper',_0x566400[_0x1b9c('0x15')],_0x4e975d);_0x36bc0e(_0x2acb57[_0x1b9c('0x14')](0x1f4,_0x566400[_0x1b9c('0x15')]));});});};exports[_0x1b9c('0x20')]=function(_0x152c30){var _0x1f5b82=this;return new Promise(function(_0x5f36ac,_0x49e67f){return db[_0x1b9c('0x7')]['destroy']({'where':_0x152c30[_0x1b9c('0x9')]?_0x152c30[_0x1b9c('0x9')][_0x1b9c('0xb')]||null:null})[_0x1b9c('0x18')](function(_0x34f109){logger['info'](_0x1b9c('0x20'),_0x152c30);logger[_0x1b9c('0x19')](_0x1b9c('0x20'),_0x152c30,JSON[_0x1b9c('0x12')](_0x34f109));_0x5f36ac(_0x34f109);})[_0x1b9c('0x13')](function(_0x49268b){logger[_0x1b9c('0x14')]('DestroyCmHopper',_0x49268b[_0x1b9c('0x15')],_0x152c30);_0x49e67f(_0x1f5b82[_0x1b9c('0x14')](0x1f4,_0x49268b[_0x1b9c('0x15')]));});});};exports['GetContactDialer']=function(_0x40d926){var _0x230e01=this;return new Promise(function(_0x14f1ef,_0x249117){return db[_0x1b9c('0x21')][_0x1b9c('0x22')]()[_0x1b9c('0x18')](function(_0x30efe7){return db[_0x1b9c('0x23')][_0x1b9c('0x24')](function(_0x309d9f){return db['CmHopper'][_0x1b9c('0x8')]({'where':_0x40d926[_0x1b9c('0x9')]?_0x40d926['options'][_0x1b9c('0xb')]||null:null,'attributes':_0x40d926[_0x1b9c('0x9')]?_0x40d926['options']['attributes']||null:null,'limit':_0x40d926[_0x1b9c('0x9')]?_0x40d926['options'][_0x1b9c('0xd')]||null:null,'order':_0x40d926[_0x1b9c('0x9')]?_0x40d926[_0x1b9c('0x9')][_0x1b9c('0x25')]||null:null,'transaction':_0x309d9f,'lock':_0x309d9f[_0x1b9c('0x26')][_0x1b9c('0x27')],'include':[{'model':db[_0x1b9c('0x21')],'as':_0x1b9c('0x28'),'attributes':_['keys'](_0x30efe7)},{'model':db[_0x1b9c('0x29')],'as':_0x1b9c('0x2a'),'attributes':['id',_0x1b9c('0x2b'),'voicePause']}]})['then'](function(_0x15a7c5){var _0x1b5dd9=[];var _0x44156f=[];for(var _0x4c465f=0x0;_0x4c465f<_0x15a7c5[_0x1b9c('0x2c')];_0x4c465f+=0x1){var _0xd3b935=_0x15a7c5[_0x4c465f]['UserId'];if(_0xd3b935===null){_0x1b5dd9[_0x1b9c('0x2d')](_0x15a7c5[_0x4c465f][_0x1b9c('0x1e')](_0x40d926['body'],{'transaction':_0x309d9f}));}else if(!_0x44156f['includes'](_0xd3b935)){_0x44156f[_0x1b9c('0x2d')](_0xd3b935);_0x1b5dd9['push'](_0x15a7c5[_0x4c465f][_0x1b9c('0x1e')](_0x40d926['body'],{'transaction':_0x309d9f}));}}return BPromise[_0x1b9c('0x2e')](_0x1b5dd9);});})[_0x1b9c('0x18')](function(_0x53caf0){logger[_0x1b9c('0x11')](_0x1b9c('0x2f'),_0x40d926);if(_0x53caf0[_0x1b9c('0x2c')]>0x0){logger[_0x1b9c('0x11')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x53caf0[0x0][_0x1b9c('0x30')]['id'],_0x53caf0[0x0][_0x1b9c('0x30')]['ContactId'],_0x53caf0[0x0][_0x1b9c('0x30')]['active']);}logger[_0x1b9c('0x19')](_0x1b9c('0x2f'),_0x40d926,JSON[_0x1b9c('0x12')](_0x53caf0));_0x14f1ef(_0x53caf0);})[_0x1b9c('0x13')](function(_0x4989a3){logger[_0x1b9c('0x14')](_0x1b9c('0x2f'),_0x4989a3[_0x1b9c('0x15')],_0x40d926);_0x249117(_0x230e01['error'](0x1f4,_0x4989a3[_0x1b9c('0x15')]));});});});};exports[_0x1b9c('0x31')]=function(_0x91c172){var _0x42072c=this;return new Promise(function(_0x2c2340,_0x247d3a){return db['sequelize'][_0x1b9c('0x24')](function(_0x495bd0){return db[_0x1b9c('0x32')][_0x1b9c('0x1b')](_0x91c172[_0x1b9c('0x1c')],{'raw':_0x91c172['options']?_0x91c172[_0x1b9c('0x9')][_0x1b9c('0xa')]===undefined?!![]:![]:!![],'transaction':_0x495bd0})[_0x1b9c('0x18')](function(){logger[_0x1b9c('0x11')](_0x1b9c('0x33'),JSON[_0x1b9c('0x12')](_0x91c172[_0x1b9c('0x9')][_0x1b9c('0xb')]),_0x91c172[_0x1b9c('0x9')][_0x1b9c('0xb')][_0x1b9c('0x34')]);return db[_0x1b9c('0x7')][_0x1b9c('0x35')]({'where':_0x91c172[_0x1b9c('0x9')]?_0x91c172[_0x1b9c('0x9')][_0x1b9c('0xb')]||null:null,'transaction':_0x495bd0});});})[_0x1b9c('0x18')](function(_0x2b491c){logger[_0x1b9c('0x11')]('MoveContactManagedDialer',_0x91c172);logger['debug']('MoveContactManagedDialer',_0x91c172,JSON[_0x1b9c('0x12')](_0x2b491c));_0x2c2340(_0x2b491c);})['catch'](function(_0x154b88){logger[_0x1b9c('0x14')](_0x1b9c('0x31'),_0x154b88[_0x1b9c('0x15')],_0x91c172);_0x247d3a(_0x42072c['error'](0x1f4,_0x154b88[_0x1b9c('0x15')]));});});};exports[_0x1b9c('0x36')]=function(_0x38bf94){var _0x12abf0=this;return new Promise(function(_0x4c3a8b,_0x49f556){return db[_0x1b9c('0x7')][_0x1b9c('0x8')]({'raw':_0x38bf94['options']?_0x38bf94[_0x1b9c('0x9')][_0x1b9c('0xa')]===undefined?!![]:![]:!![],'where':_0x38bf94[_0x1b9c('0x9')]?_0x38bf94[_0x1b9c('0x9')][_0x1b9c('0xb')]||null:null,'attributes':[[db[_0x1b9c('0x23')]['fn']('COUNT',db[_0x1b9c('0x23')]['fn']('IF',db[_0x1b9c('0x23')][_0x1b9c('0x37')]('`scheduledat`\x20>=\x20'+util[_0x1b9c('0x38')](_0x1b9c('0x39'),moment()[_0x1b9c('0x38')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x1b9c('0x18')](function(_0x11a466){logger['info'](_0x1b9c('0x36'),_0x38bf94);logger['debug'](_0x1b9c('0x36'),_0x38bf94,JSON[_0x1b9c('0x12')](_0x11a466));_0x4c3a8b(_0x11a466);})['catch'](function(_0x434047){logger[_0x1b9c('0x14')](_0x1b9c('0x36'),_0x434047['message'],_0x38bf94);_0x49f556(_0x12abf0[_0x1b9c('0x14')](0x1f4,_0x434047['message']));});});};exports[_0x1b9c('0x3a')]=function(_0x57568f){var _0x2665e5=this;return new Promise(function(_0x127da3,_0x2db235){return db[_0x1b9c('0x21')][_0x1b9c('0x22')]()['then'](function(){return db[_0x1b9c('0x23')]['transaction'](function(_0x5513c8){return db[_0x1b9c('0x7')]['findAll']({'where':_0x57568f[_0x1b9c('0x9')]?_0x57568f[_0x1b9c('0x9')][_0x1b9c('0xb')]||null:null,'attributes':_0x57568f[_0x1b9c('0x9')]?_0x57568f[_0x1b9c('0x9')][_0x1b9c('0xc')]||null:null,'limit':0x1,'order':_0x57568f[_0x1b9c('0x9')]?_0x57568f[_0x1b9c('0x9')][_0x1b9c('0x25')]||null:null,'group':db[_0x1b9c('0x7')]['UserId'],'transaction':_0x5513c8,'lock':_0x5513c8['LOCK'][_0x1b9c('0x27')],'include':_0x57568f[_0x1b9c('0x9')]?_0x57568f['options'][_0x1b9c('0xe')]?_['map'](_0x57568f[_0x1b9c('0x9')]['include'],function(_0x1007da){return{'model':db[_0x1007da['model']],'as':_0x1007da['as'],'attributes':_0x1007da[_0x1b9c('0xc')],'include':_0x1007da[_0x1b9c('0xe')]?_[_0x1b9c('0x10')](_0x1007da[_0x1b9c('0xe')],function(_0x2c1055){return{'model':db[_0x2c1055[_0x1b9c('0xf')]],'as':_0x2c1055['as'],'attributes':_0x2c1055[_0x1b9c('0xc')],'include':_0x2c1055[_0x1b9c('0xe')]?_[_0x1b9c('0x10')](_0x2c1055[_0x1b9c('0xe')],function(_0x2d6f52){return{'model':db[_0x2d6f52[_0x1b9c('0xf')]],'as':_0x2d6f52['as'],'attributes':_0x2d6f52[_0x1b9c('0xc')]};}):[]};}):[]};}):[]:[]})[_0x1b9c('0x18')](function(_0x4ff77c){var _0x3e5709=[];for(var _0x745564=0x0;_0x745564<_0x4ff77c[_0x1b9c('0x2c')];_0x745564+=0x1){_0x3e5709['push'](_0x4ff77c[_0x745564][_0x1b9c('0x1e')](_0x57568f[_0x1b9c('0x1c')],{'transaction':_0x5513c8}));}return BPromise[_0x1b9c('0x2e')](_0x3e5709);});})[_0x1b9c('0x18')](function(_0x42b49b){logger[_0x1b9c('0x11')](_0x1b9c('0x3a'),_0x57568f);logger['debug'](_0x1b9c('0x3a'),_0x57568f,JSON['stringify'](_0x42b49b));_0x127da3(_0x42b49b);})[_0x1b9c('0x13')](function(_0x140ac4){logger[_0x1b9c('0x14')](_0x1b9c('0x3a'),_0x140ac4[_0x1b9c('0x15')],_0x57568f);_0x2db235(_0x2665e5['error'](0x1f4,_0x140ac4['message']));});});});};exports['GetCmHopperPreview']=function(_0x145072){var _0x114493=this;return new Promise(function(_0x287b58,_0x23d6c9){db[_0x1b9c('0x21')]['describe']()[_0x1b9c('0x18')](function(_0x1b95c9){return db[_0x1b9c('0x7')][_0x1b9c('0x8')]({'raw':_0x145072[_0x1b9c('0x9')]?_0x145072[_0x1b9c('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x145072[_0x1b9c('0x9')]?_0x145072[_0x1b9c('0x9')][_0x1b9c('0xb')]||null:null,'attributes':_0x145072[_0x1b9c('0x9')]?_0x145072[_0x1b9c('0x9')]['attributes']||null:null,'limit':_0x145072[_0x1b9c('0x9')]?_0x145072[_0x1b9c('0x9')]['limit']||null:null,'include':_0x145072['options']?_0x145072[_0x1b9c('0x9')][_0x1b9c('0xe')]?_['map'](_0x145072[_0x1b9c('0x9')][_0x1b9c('0xe')],function(_0x1a59dc){return{'model':db[_0x1a59dc[_0x1b9c('0xf')]],'as':_0x1a59dc['as'],'attributes':_0x1a59dc['as']===_0x1b9c('0x28')?_[_0x1b9c('0x3b')](_0x1b95c9):_0x1a59dc[_0x1b9c('0xc')],'include':_0x1a59dc[_0x1b9c('0xe')]?_[_0x1b9c('0x10')](_0x1a59dc[_0x1b9c('0xe')],function(_0x533e18){return{'model':db[_0x533e18[_0x1b9c('0xf')]],'as':_0x533e18['as'],'attributes':_0x533e18[_0x1b9c('0xc')],'include':_0x533e18[_0x1b9c('0xe')]?_[_0x1b9c('0x10')](_0x533e18['include'],function(_0x7c8d2){return{'model':db[_0x7c8d2['model']],'as':_0x7c8d2['as'],'attributes':_0x7c8d2[_0x1b9c('0xc')]};}):[]};}):[]};}):[]:[]})[_0x1b9c('0x18')](function(_0xddbfad){logger[_0x1b9c('0x11')]('GetCmHopper',_0x145072);logger[_0x1b9c('0x19')](_0x1b9c('0x6'),_0x145072,JSON[_0x1b9c('0x12')](_0xddbfad));_0x287b58(_0xddbfad);})[_0x1b9c('0x13')](function(_0x9472e7){logger[_0x1b9c('0x14')]('GetCmHopper',_0x9472e7['message'],_0x145072);_0x23d6c9(_0x114493['error'](0x1f4,_0x9472e7[_0x1b9c('0x15')]));});});});};exports['GetContactByPhone']=function(_0x159d2a){var _0x312170=this;return new Promise(function(_0x5573cd,_0x14c825){return db['CmContact'][_0x1b9c('0x3c')]({'raw':!![],'where':{'phone':_0x159d2a[_0x1b9c('0x9')][_0x1b9c('0xb')][_0x1b9c('0x3d')]},'attributes':['id',_0x1b9c('0x3e')],'order':[['id',_0x1b9c('0x3f')]]})[_0x1b9c('0x18')](function(_0x2d0482){logger[_0x1b9c('0x11')]('getContactByPhone',_0x159d2a);logger[_0x1b9c('0x19')]('getContactByPhone',_0x159d2a,JSON[_0x1b9c('0x12')](_0x2d0482));_0x5573cd(_0x2d0482);})[_0x1b9c('0x13')](function(_0x1e0bd7){logger['error'](_0x1b9c('0x40'),_0x1e0bd7[_0x1b9c('0x15')],_0x159d2a);_0x14c825(_0x312170[_0x1b9c('0x14')](0x1f4,_0x1e0bd7['message']));});});};exports['ResetActiveCalls']=function(_0x63cd6d){var _0x33274d=this;return new Promise(function(_0x1fa669,_0x260c0b){return db[_0x1b9c('0x23')]['transaction'](function(_0x18c4d6){var _0x4309b2=_0x63cd6d[_0x1b9c('0x9')]&&_0x63cd6d[_0x1b9c('0x9')][_0x1b9c('0xb')]?_0x63cd6d[_0x1b9c('0x9')][_0x1b9c('0xb')]:{};return db[_0x1b9c('0x7')][_0x1b9c('0x1e')](_0x63cd6d[_0x1b9c('0x1c')],{'where':_0x4309b2,'transaction':_0x18c4d6})[_0x1b9c('0x18')](function(_0x428133){logger['info'](_0x1b9c('0x41'),_0x63cd6d);logger[_0x1b9c('0x19')]('ResetActiveCalls',_0x63cd6d,JSON[_0x1b9c('0x12')](_0x428133));_0x1fa669(_0x428133);})[_0x1b9c('0x13')](function(_0x1bf19b){logger[_0x1b9c('0x14')](_0x1b9c('0x41'),_0x1bf19b[_0x1b9c('0x15')],_0x63cd6d);_0x260c0b(_0x33274d[_0x1b9c('0x14')](0x1f4,_0x1bf19b['message']));});});});};exports[_0x1b9c('0x42')]=function(_0x43fa74){var _0x3a1dcd=this;var _0x4c5872=_0x43fa74[_0x1b9c('0x1c')]['where']['voiceQueueIds'];var _0x6dbcb8=_0x43fa74[_0x1b9c('0x1c')][_0x1b9c('0xb')][_0x1b9c('0x43')];var _0x20fe44=_0x43fa74[_0x1b9c('0x1c')][_0x1b9c('0xb')][_0x1b9c('0x44')];return new Promise(function(_0x5669be,_0x4e8ea8){return db[_0x1b9c('0x7')]['findAll']({'where':{'voiceQueueId':{'$in':_0x4c5872},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x1b9c('0x23')][_0x1b9c('0x37')](_0x1b9c('0x45')+_0x6dbcb8+'\x20MINUTE'),'$gt':db['sequelize']['literal'](_0x1b9c('0x46'))}},'UserId':{'$in':_0x20fe44}},'include':[{'model':db['CmContact'],'as':'Contact'},{'model':db[_0x1b9c('0x29')],'as':_0x1b9c('0x2a'),'attributes':['id',_0x1b9c('0x2b'),_0x1b9c('0x47')]},{'model':db[_0x1b9c('0x48')],'as':_0x1b9c('0x49')}]})[_0x1b9c('0x18')](function(_0x335cc5){if(_0x335cc5[_0x1b9c('0x2c')]>0x0){return db[_0x1b9c('0x23')][_0x1b9c('0x24')](function(_0x7325b0){return db[_0x1b9c('0x7')][_0x1b9c('0x1e')]({'recallmeNotifiedDate':db[_0x1b9c('0x23')][_0x1b9c('0x37')](_0x1b9c('0x46'))},{'where':{'id':{'$in':_[_0x1b9c('0x10')](_0x335cc5,'id')}},'transaction':_0x7325b0})['then'](function(){_0x5669be(_0x335cc5);})[_0x1b9c('0x13')](function(_0x22d2a2){logger[_0x1b9c('0x14')](_0x1b9c('0x42'),_0x22d2a2[_0x1b9c('0x15')],_0x43fa74);_0x4e8ea8(_0x3a1dcd[_0x1b9c('0x14')](0x1f4,_0x22d2a2[_0x1b9c('0x15')]));});})[_0x1b9c('0x13')](function(_0x339993){logger[_0x1b9c('0x14')](_0x1b9c('0x42'),_0x339993[_0x1b9c('0x15')],_0x43fa74);_0x4e8ea8(_0x3a1dcd[_0x1b9c('0x14')](0x1f4,_0x339993[_0x1b9c('0x15')]));});}else{_0x5669be(_0x335cc5);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index f67103a..040b412 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 _0x0d1f=['get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','put','update','destroy','express','Router','../../components/auth/service','./cmHopper.controller'];(function(_0x5ec9db,_0x4f051e){var _0xfc7061=function(_0x3993b8){while(--_0x3993b8){_0x5ec9db['push'](_0x5ec9db['shift']());}};_0xfc7061(++_0x4f051e);}(_0x0d1f,0x1e0));var _0xf0d1=function(_0x44e738,_0x52b938){_0x44e738=_0x44e738-0x0;var _0xba7948=_0x0d1f[_0x44e738];return _0xba7948;};'use strict';var express=require(_0xf0d1('0x0'));var router=express[_0xf0d1('0x1')]();var auth=require(_0xf0d1('0x2'));var controller=require(_0xf0d1('0x3'));router[_0xf0d1('0x4')]('/',auth[_0xf0d1('0x5')](),controller[_0xf0d1('0x6')]);router['get'](_0xf0d1('0x7'),auth[_0xf0d1('0x5')](),controller[_0xf0d1('0x8')]);router[_0xf0d1('0x4')](_0xf0d1('0x9'),auth[_0xf0d1('0x5')](),controller[_0xf0d1('0xa')]);router['get']('/timezones',auth[_0xf0d1('0x5')](),controller['getTimezones']);router[_0xf0d1('0x4')](_0xf0d1('0xb'),auth['isAuthenticated'](),controller[_0xf0d1('0xc')]);router[_0xf0d1('0x4')](_0xf0d1('0xd'),auth[_0xf0d1('0x5')](),controller[_0xf0d1('0xe')]);router[_0xf0d1('0xf')]('/',auth['isAuthenticated'](),controller[_0xf0d1('0x10')]);router[_0xf0d1('0xf')](_0xf0d1('0x11'),auth['isAuthenticated'](),controller[_0xf0d1('0x12')]);router[_0xf0d1('0xf')]('/timezone',auth[_0xf0d1('0x5')](),controller['getTimezone']);router[_0xf0d1('0x13')](_0xf0d1('0xb'),auth['isAuthenticated'](),controller[_0xf0d1('0x14')]);router['delete'](_0xf0d1('0xb'),auth[_0xf0d1('0x5')](),controller[_0xf0d1('0x15')]);module['exports']=router; \ No newline at end of file +var _0x9ec2=['index','/describe','isAuthenticated','describe','/opencontacts','getOpenContacts','/timezones','/:id','/:id/previewrecall','getPreviewRecall','post','/preview','getPreview','getTimezone','put','update','destroy','exports','Router','../../components/auth/service','get'];(function(_0x173113,_0x316a7c){var _0x3bea89=function(_0xd33ac1){while(--_0xd33ac1){_0x173113['push'](_0x173113['shift']());}};_0x3bea89(++_0x316a7c);}(_0x9ec2,0x1e0));var _0x29ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ec2[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var router=express[_0x29ec('0x0')]();var auth=require(_0x29ec('0x1'));var controller=require('./cmHopper.controller');router[_0x29ec('0x2')]('/',auth['isAuthenticated'](),controller[_0x29ec('0x3')]);router[_0x29ec('0x2')](_0x29ec('0x4'),auth[_0x29ec('0x5')](),controller[_0x29ec('0x6')]);router[_0x29ec('0x2')](_0x29ec('0x7'),auth[_0x29ec('0x5')](),controller[_0x29ec('0x8')]);router[_0x29ec('0x2')](_0x29ec('0x9'),auth['isAuthenticated'](),controller['getTimezones']);router[_0x29ec('0x2')](_0x29ec('0xa'),auth[_0x29ec('0x5')](),controller['show']);router[_0x29ec('0x2')](_0x29ec('0xb'),auth[_0x29ec('0x5')](),controller[_0x29ec('0xc')]);router[_0x29ec('0xd')]('/',auth[_0x29ec('0x5')](),controller['create']);router[_0x29ec('0xd')](_0x29ec('0xe'),auth['isAuthenticated'](),controller[_0x29ec('0xf')]);router['post']('/timezone',auth[_0x29ec('0x5')](),controller[_0x29ec('0x10')]);router[_0x29ec('0x11')]('/:id',auth[_0x29ec('0x5')](),controller[_0x29ec('0x12')]);router['delete']('/:id',auth[_0x29ec('0x5')](),controller[_0x29ec('0x13')]);module[_0x29ec('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index c126f5b..702c158 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 _0xfd75=['INTEGER','STRING','DATE','format','sequelize','exports'];(function(_0x28a133,_0x336e70){var _0x27c2d7=function(_0xf41eca){while(--_0xf41eca){_0x28a133['push'](_0x28a133['shift']());}};_0x27c2d7(++_0x336e70);}(_0xfd75,0xc4));var _0x5fd7=function(_0x2b81b8,_0x4733ef){_0x2b81b8=_0x2b81b8-0x0;var _0x2675b7=_0xfd75[_0x2b81b8];return _0x2675b7;};'use strict';var moment=require('moment');var Sequelize=require(_0x5fd7('0x0'));module[_0x5fd7('0x1')]={'CmHopperId':{'type':Sequelize[_0x5fd7('0x2')]},'phone':{'type':Sequelize[_0x5fd7('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x5fd7('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x5fd7('0x4')],'defaultValue':moment()[_0x5fd7('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x5fd7('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5fd7('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5fd7('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5fd7('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x454f=['DATE','format','moment','sequelize','INTEGER','STRING'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x454f,0x8c));var _0xf454=function(_0x1ebc9c,_0xcb1e5a){_0x1ebc9c=_0x1ebc9c-0x0;var _0x400ad9=_0x454f[_0x1ebc9c];return _0x400ad9;};'use strict';var moment=require(_0xf454('0x0'));var Sequelize=require(_0xf454('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0xf454('0x2')]},'phone':{'type':Sequelize[_0xf454('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xf454('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xf454('0x4')],'defaultValue':moment()[_0xf454('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf454('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xf454('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf454('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf454('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf454('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 8b62638..7519d38 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 _0x4015=['show','params','rawAttributes','attributes','fields','body','user','get','UserProfileSection','autoAssociation','create','find','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','CmHopperAdditionalPhones','UserProfileResource','end','error','stack','name','send','index','map','CmHopperAdditionalPhone','fieldName','type','key','model','query','keys','filters','intersection','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch'];(function(_0x4376a1,_0xa6bb59){var _0xc6921f=function(_0x9c3eaf){while(--_0x9c3eaf){_0x4376a1['push'](_0x4376a1['shift']());}};_0xc6921f(++_0xa6bb59);}(_0x4015,0x15c));var _0x5401=function(_0x4de877,_0x340170){_0x4de877=_0x4de877-0x0;var _0xb2cfeb=_0x4015[_0x4de877];return _0xb2cfeb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5401('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5401('0x1'));var rp=require(_0x5401('0x2'));var moment=require('moment');var BPromise=require(_0x5401('0x3'));var Mustache=require(_0x5401('0x4'));var util=require(_0x5401('0x5'));var path=require(_0x5401('0x6'));var sox=require(_0x5401('0x7'));var csv=require(_0x5401('0x8'));var ejs=require(_0x5401('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5401('0xa'));var crypto=require(_0x5401('0xb'));var jsforce=require(_0x5401('0xc'));var deskjs=require(_0x5401('0xd'));var toCsv=require(_0x5401('0x8'));var querystring=require(_0x5401('0xe'));var Papa=require(_0x5401('0xf'));var Redis=require('ioredis');var authService=require(_0x5401('0x10'));var qs=require(_0x5401('0x11'));var as=require(_0x5401('0x12'));var hardwareService=require(_0x5401('0x13'));var logger=require(_0x5401('0x14'))(_0x5401('0x15'));var utils=require(_0x5401('0x16'));var config=require(_0x5401('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5401('0x18'))['db'];function respondWithStatusCode(_0x497eaf,_0x5d9616){_0x5d9616=_0x5d9616||0xcc;return function(_0x376f4d){if(_0x376f4d){return _0x497eaf[_0x5401('0x19')](_0x5d9616);}return _0x497eaf[_0x5401('0x1a')](_0x5d9616)['end']();};}function respondWithResult(_0x2de96e,_0x39f5b7){_0x39f5b7=_0x39f5b7||0xc8;return function(_0x4ea67c){if(_0x4ea67c){return _0x2de96e[_0x5401('0x1a')](_0x39f5b7)[_0x5401('0x1b')](_0x4ea67c);}};}function respondWithFilteredResult(_0x335b5f,_0x476964){return function(_0x57c031){if(_0x57c031){var _0x284a71=typeof _0x476964[_0x5401('0x1c')]===_0x5401('0x1d')&&typeof _0x476964[_0x5401('0x1e')]===_0x5401('0x1d');var _0x2b040b=_0x57c031['count'];var _0x4b4998=_0x284a71?0x0:_0x476964[_0x5401('0x1c')];var _0x4a86d3=_0x284a71?_0x57c031[_0x5401('0x1f')]:_0x476964[_0x5401('0x1c')]+_0x476964['limit'];var _0x5d105a;if(_0x4a86d3>=_0x2b040b){_0x4a86d3=_0x2b040b;_0x5d105a=0xc8;}else{_0x5d105a=0xce;}_0x335b5f['status'](_0x5d105a);return _0x335b5f[_0x5401('0x20')](_0x5401('0x21'),_0x4b4998+'-'+_0x4a86d3+'/'+_0x2b040b)[_0x5401('0x1b')](_0x57c031);}return null;};}function patchUpdates(_0x496bca){return function(_0x548499){try{jsonpatch[_0x5401('0x22')](_0x548499,_0x496bca,!![]);}catch(_0x430972){return BPromise[_0x5401('0x23')](_0x430972);}return _0x548499['save']();};}function saveUpdates(_0x3bc0c3,_0x2c6afc){return function(_0x214b18){if(_0x214b18){return _0x214b18[_0x5401('0x24')](_0x3bc0c3)[_0x5401('0x25')](function(_0x1c1eea){return _0x1c1eea;});}return null;};}function removeEntity(_0x5a2cb0,_0x546501){return function(_0x54c721){if(_0x54c721){return _0x54c721[_0x5401('0x26')]()[_0x5401('0x25')](function(){var _0x35028c=_0x54c721['get']({'plain':!![]});var _0x108667=_0x5401('0x27');return db[_0x5401('0x28')][_0x5401('0x26')]({'where':{'type':_0x108667,'resourceId':_0x35028c['id']}})['then'](function(){return _0x54c721;});})[_0x5401('0x25')](function(){_0x5a2cb0['status'](0xcc)[_0x5401('0x29')]();});}};}function handleEntityNotFound(_0x66a5a1,_0x36963b){return function(_0x46638e){if(!_0x46638e){_0x66a5a1[_0x5401('0x19')](0x194);}return _0x46638e;};}function handleError(_0x1de08d,_0x1d5dac){_0x1d5dac=_0x1d5dac||0x1f4;return function(_0x1cda72){logger[_0x5401('0x2a')](_0x1cda72[_0x5401('0x2b')]);if(_0x1cda72[_0x5401('0x2c')]){delete _0x1cda72[_0x5401('0x2c')];}_0x1de08d[_0x5401('0x1a')](_0x1d5dac)[_0x5401('0x2d')](_0x1cda72);};}exports[_0x5401('0x2e')]=function(_0x837974,_0x42c2b0){var _0x348e3c={},_0x4c1fe1={},_0x23775b={'count':0x0,'rows':[]};var _0x1548e0=_[_0x5401('0x2f')](db[_0x5401('0x30')]['rawAttributes'],function(_0x17fb31){return{'name':_0x17fb31[_0x5401('0x31')],'type':_0x17fb31[_0x5401('0x32')][_0x5401('0x33')]};});_0x4c1fe1[_0x5401('0x34')]=_['map'](_0x1548e0,'name');_0x4c1fe1[_0x5401('0x35')]=_[_0x5401('0x36')](_0x837974[_0x5401('0x35')]);_0x4c1fe1[_0x5401('0x37')]=_[_0x5401('0x38')](_0x4c1fe1[_0x5401('0x34')],_0x4c1fe1[_0x5401('0x35')]);_0x348e3c['attributes']=_[_0x5401('0x38')](_0x4c1fe1['model'],qs['fields'](_0x837974[_0x5401('0x35')]['fields']));_0x348e3c['attributes']=_0x348e3c['attributes'][_0x5401('0x39')]?_0x348e3c['attributes']:_0x4c1fe1[_0x5401('0x34')];if(!_0x837974['query'][_0x5401('0x3a')](_0x5401('0x3b'))){_0x348e3c[_0x5401('0x1e')]=qs['limit'](_0x837974[_0x5401('0x35')]['limit']);_0x348e3c[_0x5401('0x1c')]=qs[_0x5401('0x1c')](_0x837974[_0x5401('0x35')]['offset']);}_0x348e3c[_0x5401('0x3c')]=qs[_0x5401('0x3d')](_0x837974[_0x5401('0x35')]['sort']);_0x348e3c['where']=qs[_0x5401('0x37')](_[_0x5401('0x3e')](_0x837974['query'],_0x4c1fe1[_0x5401('0x37')]),_0x1548e0);if(_0x837974['query'][_0x5401('0x3f')]){_0x348e3c[_0x5401('0x40')]=_['merge'](_0x348e3c[_0x5401('0x40')],{'$or':_[_0x5401('0x2f')](_0x1548e0,function(_0xcd37){if(_0xcd37['type']!=='VIRTUAL'){var _0x3e7617={};_0x3e7617[_0xcd37[_0x5401('0x2c')]]={'$like':'%'+_0x837974[_0x5401('0x35')][_0x5401('0x3f')]+'%'};return _0x3e7617;}})});}_0x348e3c=_[_0x5401('0x41')]({},_0x348e3c,_0x837974[_0x5401('0x42')]);var _0x1726bc={'where':_0x348e3c['where']};return db[_0x5401('0x30')]['count'](_0x1726bc)[_0x5401('0x25')](function(_0x32b324){_0x23775b['count']=_0x32b324;if(_0x837974[_0x5401('0x35')][_0x5401('0x43')]){_0x348e3c[_0x5401('0x44')]=[{'all':!![]}];}return db[_0x5401('0x30')][_0x5401('0x45')](_0x348e3c);})[_0x5401('0x25')](function(_0x1abbcb){_0x23775b[_0x5401('0x46')]=_0x1abbcb;return _0x23775b;})['then'](respondWithFilteredResult(_0x42c2b0,_0x348e3c))[_0x5401('0x47')](handleError(_0x42c2b0,null));};exports[_0x5401('0x48')]=function(_0x26eabc,_0x3879d4){var _0x21e93e={'raw':!![],'where':{'id':_0x26eabc[_0x5401('0x49')]['id']}},_0x1c1b82={};_0x1c1b82['model']=_[_0x5401('0x36')](db[_0x5401('0x30')][_0x5401('0x4a')]);_0x1c1b82['query']=_[_0x5401('0x36')](_0x26eabc[_0x5401('0x35')]);_0x1c1b82[_0x5401('0x37')]=_[_0x5401('0x38')](_0x1c1b82[_0x5401('0x34')],_0x1c1b82[_0x5401('0x35')]);_0x21e93e[_0x5401('0x4b')]=_[_0x5401('0x38')](_0x1c1b82[_0x5401('0x34')],qs[_0x5401('0x4c')](_0x26eabc[_0x5401('0x35')]['fields']));_0x21e93e['attributes']=_0x21e93e['attributes']['length']?_0x21e93e[_0x5401('0x4b')]:_0x1c1b82[_0x5401('0x34')];if(_0x26eabc[_0x5401('0x35')][_0x5401('0x43')]){_0x21e93e[_0x5401('0x44')]=[{'all':!![]}];}_0x21e93e=_[_0x5401('0x41')]({},_0x21e93e,_0x26eabc[_0x5401('0x42')]);return db['CmHopperAdditionalPhone']['find'](_0x21e93e)[_0x5401('0x25')](handleEntityNotFound(_0x3879d4,null))[_0x5401('0x25')](respondWithResult(_0x3879d4,null))[_0x5401('0x47')](handleError(_0x3879d4,null));};exports['create']=function(_0x43ac83,_0x485c55){return db[_0x5401('0x30')]['create'](_0x43ac83[_0x5401('0x4d')],{})[_0x5401('0x25')](function(_0x1b83ce){var _0x49912e=_0x43ac83[_0x5401('0x4e')][_0x5401('0x4f')]({'plain':!![]});if(!_0x49912e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49912e['role']===_0x5401('0x4e')){var _0x1303c2=_0x1b83ce[_0x5401('0x4f')]({'plain':!![]});var _0x57fc46='CmHopperAdditionalPhones';return db[_0x5401('0x50')]['find']({'where':{'name':_0x57fc46,'userProfileId':_0x49912e['userProfileId']},'raw':!![]})['then'](function(_0xef8d66){if(_0xef8d66&&_0xef8d66[_0x5401('0x51')]===0x0){return db[_0x5401('0x28')][_0x5401('0x52')]({'name':_0x1303c2[_0x5401('0x2c')],'resourceId':_0x1303c2['id'],'type':_0xef8d66[_0x5401('0x2c')],'sectionId':_0xef8d66['id']},{})[_0x5401('0x25')](function(){return _0x1b83ce;});}else{return _0x1b83ce;}})[_0x5401('0x47')](function(_0xedabf4){logger[_0x5401('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xedabf4);throw _0xedabf4;});}return _0x1b83ce;})[_0x5401('0x25')](respondWithResult(_0x485c55,0xc9))['catch'](handleError(_0x485c55,null));};exports[_0x5401('0x24')]=function(_0x26580d,_0x241e57){if(_0x26580d[_0x5401('0x4d')]['id']){delete _0x26580d[_0x5401('0x4d')]['id'];}return db[_0x5401('0x30')][_0x5401('0x53')]({'where':{'id':_0x26580d[_0x5401('0x49')]['id']}})['then'](handleEntityNotFound(_0x241e57,null))[_0x5401('0x25')](saveUpdates(_0x26580d[_0x5401('0x4d')],null))[_0x5401('0x25')](respondWithResult(_0x241e57,null))[_0x5401('0x47')](handleError(_0x241e57,null));};exports[_0x5401('0x26')]=function(_0x22fe17,_0x2ca44d){return db['CmHopperAdditionalPhone'][_0x5401('0x53')]({'where':{'id':_0x22fe17[_0x5401('0x49')]['id']}})['then'](handleEntityNotFound(_0x2ca44d,null))['then'](removeEntity(_0x2ca44d,null))[_0x5401('0x47')](handleError(_0x2ca44d,null));}; \ No newline at end of file +var _0x6895=['keys','intersection','fields','attributes','length','hasOwnProperty','sort','filters','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','sendStatus','error','stack','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName','key','model','name','query'];(function(_0x52a903,_0x3bab0f){var _0x14a58e=function(_0x325805){while(--_0x325805){_0x52a903['push'](_0x52a903['shift']());}};_0x14a58e(++_0x3bab0f);}(_0x6895,0x119));var _0x5689=function(_0x3e7a26,_0x2206d2){_0x3e7a26=_0x3e7a26-0x0;var _0x377293=_0x6895[_0x3e7a26];return _0x377293;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5689('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5689('0x1'));var rp=require(_0x5689('0x2'));var moment=require(_0x5689('0x3'));var BPromise=require(_0x5689('0x4'));var Mustache=require('mustache');var util=require(_0x5689('0x5'));var path=require(_0x5689('0x6'));var sox=require(_0x5689('0x7'));var csv=require(_0x5689('0x8'));var ejs=require(_0x5689('0x9'));var fs=require('fs');var fs_extra=require(_0x5689('0xa'));var _=require(_0x5689('0xb'));var squel=require(_0x5689('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5689('0x8'));var querystring=require(_0x5689('0xd'));var Papa=require(_0x5689('0xe'));var Redis=require(_0x5689('0xf'));var authService=require(_0x5689('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5689('0x11'));var logger=require('../../config/logger')(_0x5689('0x12'));var utils=require(_0x5689('0x13'));var config=require(_0x5689('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5689('0x15'))['db'];function respondWithStatusCode(_0x494b1e,_0x14c26c){_0x14c26c=_0x14c26c||0xcc;return function(_0x769acc){if(_0x769acc){return _0x494b1e['sendStatus'](_0x14c26c);}return _0x494b1e['status'](_0x14c26c)[_0x5689('0x16')]();};}function respondWithResult(_0x224175,_0x9118e5){_0x9118e5=_0x9118e5||0xc8;return function(_0x4744de){if(_0x4744de){return _0x224175[_0x5689('0x17')](_0x9118e5)['json'](_0x4744de);}};}function respondWithFilteredResult(_0x434a46,_0x259ef3){return function(_0x34780a){if(_0x34780a){var _0x11582c=typeof _0x259ef3[_0x5689('0x18')]==='undefined'&&typeof _0x259ef3[_0x5689('0x19')]===_0x5689('0x1a');var _0xf41b5b=_0x34780a['count'];var _0x43b9f2=_0x11582c?0x0:_0x259ef3[_0x5689('0x18')];var _0x3dce7b=_0x11582c?_0x34780a[_0x5689('0x1b')]:_0x259ef3[_0x5689('0x18')]+_0x259ef3['limit'];var _0x4f7eae;if(_0x3dce7b>=_0xf41b5b){_0x3dce7b=_0xf41b5b;_0x4f7eae=0xc8;}else{_0x4f7eae=0xce;}_0x434a46[_0x5689('0x17')](_0x4f7eae);return _0x434a46[_0x5689('0x1c')](_0x5689('0x1d'),_0x43b9f2+'-'+_0x3dce7b+'/'+_0xf41b5b)[_0x5689('0x1e')](_0x34780a);}return null;};}function patchUpdates(_0x255bad){return function(_0x2bcf1d){try{jsonpatch['apply'](_0x2bcf1d,_0x255bad,!![]);}catch(_0x9e6a44){return BPromise[_0x5689('0x1f')](_0x9e6a44);}return _0x2bcf1d[_0x5689('0x20')]();};}function saveUpdates(_0x10885b,_0x55e3a6){return function(_0x6606b5){if(_0x6606b5){return _0x6606b5[_0x5689('0x21')](_0x10885b)[_0x5689('0x22')](function(_0x17a22c){return _0x17a22c;});}return null;};}function removeEntity(_0x53213e,_0x47b2f3){return function(_0x28e8bd){if(_0x28e8bd){return _0x28e8bd[_0x5689('0x23')]()[_0x5689('0x22')](function(){var _0x36f1c6=_0x28e8bd[_0x5689('0x24')]({'plain':!![]});var _0x2f84f8=_0x5689('0x25');return db[_0x5689('0x26')]['destroy']({'where':{'type':_0x2f84f8,'resourceId':_0x36f1c6['id']}})['then'](function(){return _0x28e8bd;});})[_0x5689('0x22')](function(){_0x53213e[_0x5689('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38d865,_0x535560){return function(_0x47a977){if(!_0x47a977){_0x38d865[_0x5689('0x27')](0x194);}return _0x47a977;};}function handleError(_0x457fdc,_0x3ce49f){_0x3ce49f=_0x3ce49f||0x1f4;return function(_0x2e3667){logger[_0x5689('0x28')](_0x2e3667[_0x5689('0x29')]);if(_0x2e3667['name']){delete _0x2e3667['name'];}_0x457fdc[_0x5689('0x17')](_0x3ce49f)[_0x5689('0x2a')](_0x2e3667);};}exports['index']=function(_0x46cdfb,_0x3e501e){var _0x2462ac={},_0x1ce40e={},_0x37c3d8={'count':0x0,'rows':[]};var _0x2c9790=_[_0x5689('0x2b')](db[_0x5689('0x2c')][_0x5689('0x2d')],function(_0x21d9a7){return{'name':_0x21d9a7[_0x5689('0x2e')],'type':_0x21d9a7['type'][_0x5689('0x2f')]};});_0x1ce40e[_0x5689('0x30')]=_[_0x5689('0x2b')](_0x2c9790,_0x5689('0x31'));_0x1ce40e[_0x5689('0x32')]=_[_0x5689('0x33')](_0x46cdfb[_0x5689('0x32')]);_0x1ce40e['filters']=_[_0x5689('0x34')](_0x1ce40e['model'],_0x1ce40e[_0x5689('0x32')]);_0x2462ac['attributes']=_[_0x5689('0x34')](_0x1ce40e[_0x5689('0x30')],qs[_0x5689('0x35')](_0x46cdfb[_0x5689('0x32')][_0x5689('0x35')]));_0x2462ac['attributes']=_0x2462ac[_0x5689('0x36')][_0x5689('0x37')]?_0x2462ac['attributes']:_0x1ce40e['model'];if(!_0x46cdfb[_0x5689('0x32')][_0x5689('0x38')]('nolimit')){_0x2462ac[_0x5689('0x19')]=qs[_0x5689('0x19')](_0x46cdfb[_0x5689('0x32')][_0x5689('0x19')]);_0x2462ac[_0x5689('0x18')]=qs['offset'](_0x46cdfb['query'][_0x5689('0x18')]);}_0x2462ac['order']=qs[_0x5689('0x39')](_0x46cdfb[_0x5689('0x32')][_0x5689('0x39')]);_0x2462ac['where']=qs[_0x5689('0x3a')](_[_0x5689('0x3b')](_0x46cdfb[_0x5689('0x32')],_0x1ce40e['filters']),_0x2c9790);if(_0x46cdfb[_0x5689('0x32')][_0x5689('0x3c')]){_0x2462ac[_0x5689('0x3d')]=_['merge'](_0x2462ac[_0x5689('0x3d')],{'$or':_[_0x5689('0x2b')](_0x2c9790,function(_0x338f66){if(_0x338f66[_0x5689('0x3e')]!==_0x5689('0x3f')){var _0x55ddb6={};_0x55ddb6[_0x338f66[_0x5689('0x31')]]={'$like':'%'+_0x46cdfb['query']['filter']+'%'};return _0x55ddb6;}})});}_0x2462ac=_[_0x5689('0x40')]({},_0x2462ac,_0x46cdfb[_0x5689('0x41')]);var _0x2417d5={'where':_0x2462ac[_0x5689('0x3d')]};return db[_0x5689('0x2c')][_0x5689('0x1b')](_0x2417d5)[_0x5689('0x22')](function(_0x32e933){_0x37c3d8[_0x5689('0x1b')]=_0x32e933;if(_0x46cdfb[_0x5689('0x32')][_0x5689('0x42')]){_0x2462ac[_0x5689('0x43')]=[{'all':!![]}];}return db[_0x5689('0x2c')][_0x5689('0x44')](_0x2462ac);})[_0x5689('0x22')](function(_0x15adf2){_0x37c3d8[_0x5689('0x45')]=_0x15adf2;return _0x37c3d8;})[_0x5689('0x22')](respondWithFilteredResult(_0x3e501e,_0x2462ac))[_0x5689('0x46')](handleError(_0x3e501e,null));};exports[_0x5689('0x47')]=function(_0x218e48,_0x588f5b){var _0x49a3d6={'raw':!![],'where':{'id':_0x218e48['params']['id']}},_0x1766dc={};_0x1766dc['model']=_[_0x5689('0x33')](db[_0x5689('0x2c')][_0x5689('0x2d')]);_0x1766dc['query']=_[_0x5689('0x33')](_0x218e48[_0x5689('0x32')]);_0x1766dc[_0x5689('0x3a')]=_[_0x5689('0x34')](_0x1766dc[_0x5689('0x30')],_0x1766dc[_0x5689('0x32')]);_0x49a3d6[_0x5689('0x36')]=_[_0x5689('0x34')](_0x1766dc[_0x5689('0x30')],qs[_0x5689('0x35')](_0x218e48[_0x5689('0x32')][_0x5689('0x35')]));_0x49a3d6[_0x5689('0x36')]=_0x49a3d6[_0x5689('0x36')]['length']?_0x49a3d6['attributes']:_0x1766dc[_0x5689('0x30')];if(_0x218e48['query'][_0x5689('0x42')]){_0x49a3d6[_0x5689('0x43')]=[{'all':!![]}];}_0x49a3d6=_[_0x5689('0x40')]({},_0x49a3d6,_0x218e48[_0x5689('0x41')]);return db[_0x5689('0x2c')][_0x5689('0x48')](_0x49a3d6)[_0x5689('0x22')](handleEntityNotFound(_0x588f5b,null))[_0x5689('0x22')](respondWithResult(_0x588f5b,null))[_0x5689('0x46')](handleError(_0x588f5b,null));};exports[_0x5689('0x49')]=function(_0x3e2253,_0x3b7fca){return db[_0x5689('0x2c')][_0x5689('0x49')](_0x3e2253[_0x5689('0x4a')],{})[_0x5689('0x22')](function(_0x24d46b){var _0x17dcbc=_0x3e2253[_0x5689('0x4b')]['get']({'plain':!![]});if(!_0x17dcbc)throw new Error(_0x5689('0x4c'));if(_0x17dcbc[_0x5689('0x4d')]==='user'){var _0x1e9e8b=_0x24d46b[_0x5689('0x24')]({'plain':!![]});var _0x3d50d5=_0x5689('0x25');return db[_0x5689('0x4e')][_0x5689('0x48')]({'where':{'name':_0x3d50d5,'userProfileId':_0x17dcbc[_0x5689('0x4f')]},'raw':!![]})[_0x5689('0x22')](function(_0x4cdc68){if(_0x4cdc68&&_0x4cdc68[_0x5689('0x50')]===0x0){return db[_0x5689('0x26')][_0x5689('0x49')]({'name':_0x1e9e8b[_0x5689('0x31')],'resourceId':_0x1e9e8b['id'],'type':_0x4cdc68[_0x5689('0x31')],'sectionId':_0x4cdc68['id']},{})[_0x5689('0x22')](function(){return _0x24d46b;});}else{return _0x24d46b;}})[_0x5689('0x46')](function(_0x22f258){logger[_0x5689('0x28')](_0x5689('0x51'),_0x22f258);throw _0x22f258;});}return _0x24d46b;})[_0x5689('0x22')](respondWithResult(_0x3b7fca,0xc9))['catch'](handleError(_0x3b7fca,null));};exports['update']=function(_0x35bc8d,_0x3f5e13){if(_0x35bc8d[_0x5689('0x4a')]['id']){delete _0x35bc8d[_0x5689('0x4a')]['id'];}return db[_0x5689('0x2c')]['find']({'where':{'id':_0x35bc8d[_0x5689('0x52')]['id']}})[_0x5689('0x22')](handleEntityNotFound(_0x3f5e13,null))['then'](saveUpdates(_0x35bc8d[_0x5689('0x4a')],null))[_0x5689('0x22')](respondWithResult(_0x3f5e13,null))[_0x5689('0x46')](handleError(_0x3f5e13,null));};exports[_0x5689('0x23')]=function(_0x4e60b6,_0x2bae46){return db[_0x5689('0x2c')][_0x5689('0x48')]({'where':{'id':_0x4e60b6[_0x5689('0x52')]['id']}})[_0x5689('0x22')](handleEntityNotFound(_0x2bae46,null))[_0x5689('0x22')](removeEntity(_0x2bae46,null))[_0x5689('0x46')](handleError(_0x2bae46,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 5e76e14..e0c4899 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 _0xd053=['lodash','util','api','moment','bluebird','rimraf','../../config/environment','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones'];(function(_0x31b9cf,_0x164dcd){var _0x50c970=function(_0x1ed656){while(--_0x1ed656){_0x31b9cf['push'](_0x31b9cf['shift']());}};_0x50c970(++_0x164dcd);}(_0xd053,0xe7));var _0x3d05=function(_0x27638d,_0x4094db){_0x27638d=_0x27638d-0x0;var _0x35da35=_0xd053[_0x27638d];return _0x35da35;};'use strict';var _=require(_0x3d05('0x0'));var util=require(_0x3d05('0x1'));var logger=require('../../config/logger')(_0x3d05('0x2'));var moment=require(_0x3d05('0x3'));var BPromise=require(_0x3d05('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3d05('0x5'));var config=require(_0x3d05('0x6'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x3d05('0x7')]=function(_0x2ba33b,_0x59161d){return _0x2ba33b[_0x3d05('0x8')](_0x3d05('0x9'),attributes,{'tableName':_0x3d05('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec86=['bluebird','request-promise','path','rimraf','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','api'];(function(_0x1710e0,_0x4c7f7d){var _0x1a3805=function(_0x2e3b8f){while(--_0x2e3b8f){_0x1710e0['push'](_0x1710e0['shift']());}};_0x1a3805(++_0x4c7f7d);}(_0xec86,0x1d4));var _0x6ec8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xec86[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6ec8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6ec8('0x1'));var moment=require('moment');var BPromise=require(_0x6ec8('0x2'));var rp=require(_0x6ec8('0x3'));var fs=require('fs');var path=require(_0x6ec8('0x4'));var rimraf=require(_0x6ec8('0x5'));var config=require('../../config/environment');var attributes=require(_0x6ec8('0x6'));module[_0x6ec8('0x7')]=function(_0x5d516b,_0x25de2b){return _0x5d516b['define'](_0x6ec8('0x8'),attributes,{'tableName':_0x6ec8('0x9'),'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 d5c67c4..6af2b4a 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 _0xe3c1=['CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','VerifyAdditionalPhones','findOne','body','ListId','VoiceQueueId','CampaignId','OrderBy','countbusyretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','CmHopperAdditionalPhone','ASC','countcongestionretry','countdropretry','entity','SwapAdditionalPhones','ContactId','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug'];(function(_0x3713c7,_0x40df49){var _0x3576fe=function(_0x263dab){while(--_0x263dab){_0x3713c7['push'](_0x3713c7['shift']());}};_0x3576fe(++_0x40df49);}(_0xe3c1,0x148));var _0x1e3c=function(_0x13c70c,_0x546b34){_0x13c70c=_0x13c70c-0x0;var _0x50f0f2=_0xe3c1[_0x13c70c];return _0x50f0f2;};'use strict';var _=require(_0x1e3c('0x0'));var util=require(_0x1e3c('0x1'));var moment=require(_0x1e3c('0x2'));var BPromise=require('bluebird');var rs=require(_0x1e3c('0x3'));var fs=require('fs');var Redis=require(_0x1e3c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1e3c('0x5'));var logger=require(_0x1e3c('0x6'))(_0x1e3c('0x7'));var config=require(_0x1e3c('0x8'));var jayson=require(_0x1e3c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x10294f,_0x27e54d,_0x29c117){return new BPromise(function(_0x4552f3,_0x2f9669){return client['request'](_0x10294f,_0x29c117)[_0x1e3c('0xa')](function(_0x43eaf1){logger[_0x1e3c('0xb')](_0x1e3c('0xc'),_0x27e54d,'request\x20sent');logger[_0x1e3c('0xd')](_0x1e3c('0xe'),_0x27e54d,_0x1e3c('0xf'),JSON[_0x1e3c('0x10')](_0x43eaf1));if(_0x43eaf1[_0x1e3c('0x11')]){if(_0x43eaf1[_0x1e3c('0x11')][_0x1e3c('0x12')]===0x1f4){logger[_0x1e3c('0x11')](_0x1e3c('0xc'),_0x27e54d,_0x43eaf1[_0x1e3c('0x11')][_0x1e3c('0x13')]);return _0x2f9669(_0x43eaf1[_0x1e3c('0x11')][_0x1e3c('0x13')]);}logger[_0x1e3c('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x27e54d,_0x43eaf1[_0x1e3c('0x11')][_0x1e3c('0x13')]);return _0x4552f3(_0x43eaf1[_0x1e3c('0x11')][_0x1e3c('0x13')]);}else{logger['info'](_0x1e3c('0xc'),_0x27e54d,'request\x20sent');_0x4552f3(_0x43eaf1['result'][_0x1e3c('0x13')]);}})[_0x1e3c('0x14')](function(_0x4152cc){logger[_0x1e3c('0x11')](_0x1e3c('0xc'),_0x27e54d,_0x4152cc);_0x2f9669(_0x4152cc);});});}exports[_0x1e3c('0x15')]=function(_0x3969a1){var _0x1441af=this;return new Promise(function(_0x237346,_0x1ccdf5){return db['CmHopper'][_0x1e3c('0x16')]({'raw':!![],'where':{'ContactId':_0x3969a1['body']['ContactId'],'ListId':_0x3969a1[_0x1e3c('0x17')][_0x1e3c('0x18')],'VoiceQueueId':_0x3969a1[_0x1e3c('0x17')][_0x1e3c('0x19')]===undefined?null:_0x3969a1[_0x1e3c('0x17')][_0x1e3c('0x19')],'CampaignId':_0x3969a1[_0x1e3c('0x17')][_0x1e3c('0x1a')]===undefined?null:_0x3969a1[_0x1e3c('0x17')]['CampaignId']}})['then'](function(_0x19d37b){if(_0x19d37b!=null){return db['CmHopperAdditionalPhone'][_0x1e3c('0x16')]({'raw':!![],'where':{'CmHopperId':_0x19d37b['id'],'OrderBy':{'$gt':_0x19d37b[_0x1e3c('0x1b')]}},'order':[[_0x1e3c('0x1b'),'ASC']]})[_0x1e3c('0xa')](function(_0x506b6e){var _0x54c9a8=0x0;if(_0x506b6e){if(_0x506b6e[_0x1e3c('0x1c')]+_0x506b6e['countcongestionretry']+_0x506b6e[_0x1e3c('0x1d')]+_0x506b6e[_0x1e3c('0x1e')]+_0x506b6e['countdropretry']+_0x506b6e[_0x1e3c('0x1f')]+_0x506b6e[_0x1e3c('0x20')]+_0x506b6e[_0x1e3c('0x21')]<_0x3969a1['entity'][_0x1e3c('0x22')])_0x54c9a8=0x1;_0x237346({'additional':_0x54c9a8});}else{return db[_0x1e3c('0x23')][_0x1e3c('0x16')]({'raw':!![],'where':{'CmHopperId':_0x19d37b['id']},'order':[[_0x1e3c('0x1b'),_0x1e3c('0x24')]]})[_0x1e3c('0xa')](function(_0x5ec998){var _0x15972a=0x0;if(_0x5ec998){if(_0x5ec998[_0x1e3c('0x1c')]+_0x5ec998[_0x1e3c('0x25')]+_0x5ec998[_0x1e3c('0x1d')]+_0x5ec998['countnosuchnumberretry']+_0x5ec998[_0x1e3c('0x26')]+_0x5ec998[_0x1e3c('0x1f')]+_0x5ec998[_0x1e3c('0x20')]+_0x5ec998[_0x1e3c('0x21')]<_0x3969a1[_0x1e3c('0x27')]['dialGlobalMaxRetry'])_0x15972a=0x1;_0x237346({'additional':_0x15972a});}else{_0x237346({'additional':0x0});}})['catch'](function(_0x10248c){logger[_0x1e3c('0x11')](_0x1e3c('0x15'),_0x10248c[_0x1e3c('0x13')]);_0x1ccdf5(_0x1441af[_0x1e3c('0x11')](0x1f4,_0x10248c[_0x1e3c('0x13')]));});}})[_0x1e3c('0x14')](function(_0x3138eb){logger['error'](_0x1e3c('0x15'),_0x3138eb['message']);_0x1ccdf5(_0x1441af['error'](0x1f4,_0x3138eb['message']));});}else _0x237346({'additional':0x0});});});};exports[_0x1e3c('0x28')]=function(_0x19ed51){var _0x5f53a9=this;return new Promise(function(_0x3f2c6a,_0x183d07){return db['CmHopper'][_0x1e3c('0x16')]({'raw':!![],'where':{'ContactId':_0x19ed51[_0x1e3c('0x17')][_0x1e3c('0x29')],'ListId':_0x19ed51[_0x1e3c('0x17')][_0x1e3c('0x18')],'VoiceQueueId':_0x19ed51['body'][_0x1e3c('0x19')]===undefined?null:_0x19ed51[_0x1e3c('0x17')][_0x1e3c('0x19')],'CampaignId':_0x19ed51['body'][_0x1e3c('0x1a')]===undefined?null:_0x19ed51[_0x1e3c('0x17')][_0x1e3c('0x1a')]}})['then'](function(_0x2eaa13){if(_0x2eaa13!=null){return db[_0x1e3c('0x23')][_0x1e3c('0x16')]({'raw':!![],'where':{'CmHopperId':_0x2eaa13['id'],'OrderBy':{'$gte':_0x2eaa13[_0x1e3c('0x1b')]}},'order':[[_0x1e3c('0x1b'),_0x1e3c('0x24')]]})[_0x1e3c('0xa')](function(_0x5bb298){if(_0x5bb298)return activateAdditionalPhone(_0x2eaa13,_0x19ed51[_0x1e3c('0x17')],_0x5bb298,_0x19ed51[_0x1e3c('0x2a')],_0x19ed51[_0x1e3c('0x2b')])[_0x1e3c('0xa')](function(_0xa9f1c0){_0x3f2c6a(_0xa9f1c0);});else{return db[_0x1e3c('0x23')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x2eaa13['id']},'order':[[_0x1e3c('0x1b'),_0x1e3c('0x24')]]})[_0x1e3c('0xa')](function(_0x456863){if(_0x456863)return activateAdditionalPhone(_0x2eaa13,_0x19ed51[_0x1e3c('0x17')],_0x456863,_0x19ed51[_0x1e3c('0x2a')],_0x19ed51[_0x1e3c('0x2b')])['then'](function(_0x57c591){_0x3f2c6a(_0x57c591);});else{_0x3f2c6a({'id':_0x2eaa13['id'],'phone':''});}})[_0x1e3c('0x14')](function(_0x3d6a9a){logger[_0x1e3c('0x11')](_0x1e3c('0x15'),_0x3d6a9a['message']);_0x183d07(_0x5f53a9[_0x1e3c('0x11')](0x1f4,_0x3d6a9a[_0x1e3c('0x13')]));});}})['catch'](function(_0x5ba76e){logger[_0x1e3c('0x11')](_0x1e3c('0x15'),_0x5ba76e['message']);_0x183d07(_0x5f53a9['error'](0x1f4,_0x5ba76e[_0x1e3c('0x13')]));});}else _0x3f2c6a(0x1);});});};function activateAdditionalPhone(_0x10e1c4,_0xc787ef,_0x2a03a4,_0x316017,_0x4ec1bc){return new Promise(function(_0x1d8b05,_0x48d35e){var _0x4507ca;if(_[_0x1e3c('0x2c')](_0x2a03a4[_0x1e3c('0x2d')])){_0x2a03a4['scheduledat']=moment();}if(moment()>moment(_0x2a03a4[_0x1e3c('0x2d')])){_0x4507ca=moment()[_0x1e3c('0x2e')](_0x4ec1bc||0x3,_0x1e3c('0x2f'));}else{if(_0x2a03a4[_0x1e3c('0x1b')]==0x0){_0x4507ca=moment(_0x2a03a4['scheduledat']);}else{_0x4507ca=moment()['add'](_0x4ec1bc||0x3,_0x1e3c('0x2f'));}}if(_[_0x1e3c('0x2c')](_0x4507ca)){_0x4507ca=moment()[_0x1e3c('0x2e')](_0x4ec1bc||0x3,_0x1e3c('0x2f'));}var _0x17471e={'phone':_0x10e1c4[_0x1e3c('0x30')],'active':0x0,'OrderBy':_['isNil'](_0x10e1c4[_0x1e3c('0x1b')])?0x0:_0x10e1c4[_0x1e3c('0x1b')],'scheduledat':moment()[_0x1e3c('0x2e')](_0x316017||0x1,_0x1e3c('0x2f')),'countbusyretry':_0xc787ef['countbusyretry'],'countcongestionretry':_0xc787ef[_0x1e3c('0x25')],'countnoanswerretry':_0xc787ef[_0x1e3c('0x1d')],'countnosuchnumberretry':_0xc787ef[_0x1e3c('0x1e')],'countdropretry':_0xc787ef[_0x1e3c('0x26')],'countabandonedretry':_0xc787ef['countabandonedretry'],'countmachineretry':_0xc787ef[_0x1e3c('0x20')],'countagentrejectretry':_0xc787ef[_0x1e3c('0x21')],'createdAt':_0xc787ef[_0x1e3c('0x31')],'updatedAt':_0xc787ef[_0x1e3c('0x32')]};var _0x44da55={'CmHopperId':_0x10e1c4['id'],'phone':_0x2a03a4['phone'],'active':0x0,'OrderBy':_['isNil'](_0x2a03a4[_0x1e3c('0x1b')])?0x0:_0x2a03a4[_0x1e3c('0x1b')],'scheduledat':_0x4507ca,'countbusyretry':_0x2a03a4[_0x1e3c('0x1c')],'countcongestionretry':_0x2a03a4[_0x1e3c('0x25')],'countnoanswerretry':_0x2a03a4[_0x1e3c('0x1d')],'countnosuchnumberretry':_0x2a03a4['countnosuchnumberretry'],'countdropretry':_0x2a03a4['countdropretry'],'countabandonedretry':_0x2a03a4['countabandonedretry'],'countmachineretry':_0x2a03a4['countmachineretry'],'countagentrejectretry':_0x2a03a4[_0x1e3c('0x21')],'createdAt':_0x2a03a4[_0x1e3c('0x31')],'updatedAt':_0x2a03a4[_0x1e3c('0x32')]};return db[_0x1e3c('0x33')][_0x1e3c('0x34')](function(_0x20b7ed){return db[_0x1e3c('0x23')]['update'](_0x17471e,{'where':{'id':_0x2a03a4['id']}},{'transaction':_0x20b7ed})[_0x1e3c('0xa')](function(){return db['CmHopper'][_0x1e3c('0x35')](_0x44da55,{'where':{'id':_0x10e1c4['id']}},{'transaction':_0x20b7ed});});})['then'](function(_0x5089ae){_0x1d8b05({'id':_0x10e1c4['id'],'phone':_0x2a03a4[_0x1e3c('0x30')]});})[_0x1e3c('0x14')](function(_0x3440e0){logger[_0x1e3c('0x11')](_0x1e3c('0x36'),_0x3440e0[_0x1e3c('0x13')]);_0x48d35e({'error':_0x3440e0[_0x1e3c('0x13')]});});});}exports[_0x1e3c('0x37')]=function(_0x1cc49f){var _0xaded2a=this;return new Promise(function(_0x1a902c,_0x3e0292){return db['CmHopper'][_0x1e3c('0x35')](_0x1cc49f[_0x1e3c('0x17')][_0x1e3c('0x38')],{'where':{'id':_0x1cc49f[_0x1e3c('0x17')]['id']}})['then'](function(_0x3ed812){_0x1a902c(_0x3ed812);})[_0x1e3c('0x14')](function(_0x3474a6){logger[_0x1e3c('0x11')](_0x1e3c('0x37'),_0x3474a6[_0x1e3c('0x13')]);_0x3e0292(_0xaded2a[_0x1e3c('0x11')](0x1f4,_0x3474a6[_0x1e3c('0x13')]));});});}; \ No newline at end of file +var _0x4cb1=['countcongestionretry','countagentrejectretry','entity','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','isNil','phone','createdAt','updatedAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','findOne','OrderBy','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','dialGlobalMaxRetry','CmHopperAdditionalPhone','ASC','countbusyretry'];(function(_0x2646db,_0xb55473){var _0x3336f9=function(_0x372784){while(--_0x372784){_0x2646db['push'](_0x2646db['shift']());}};_0x3336f9(++_0xb55473);}(_0x4cb1,0x167));var _0x14cb=function(_0x235164,_0x45322a){_0x235164=_0x235164-0x0;var _0x35639a=_0x4cb1[_0x235164];return _0x35639a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x14cb('0x0'));var BPromise=require(_0x14cb('0x1'));var rs=require(_0x14cb('0x2'));var fs=require('fs');var Redis=require(_0x14cb('0x3'));var db=require(_0x14cb('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x14cb('0x5'));var jayson=require(_0x14cb('0x6'));var client=jayson[_0x14cb('0x7')][_0x14cb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23aa5f,_0x2b7caf,_0x9ed853){return new BPromise(function(_0x1fd724,_0x3b1d4d){return client[_0x14cb('0x9')](_0x23aa5f,_0x9ed853)[_0x14cb('0xa')](function(_0x4b849a){logger[_0x14cb('0xb')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2b7caf,'request\x20sent');logger[_0x14cb('0xc')](_0x14cb('0xd'),_0x2b7caf,_0x14cb('0xe'),JSON[_0x14cb('0xf')](_0x4b849a));if(_0x4b849a[_0x14cb('0x10')]){if(_0x4b849a[_0x14cb('0x10')][_0x14cb('0x11')]===0x1f4){logger['error'](_0x14cb('0x12'),_0x2b7caf,_0x4b849a[_0x14cb('0x10')][_0x14cb('0x13')]);return _0x3b1d4d(_0x4b849a[_0x14cb('0x10')][_0x14cb('0x13')]);}logger[_0x14cb('0x10')](_0x14cb('0x12'),_0x2b7caf,_0x4b849a[_0x14cb('0x10')]['message']);return _0x1fd724(_0x4b849a[_0x14cb('0x10')][_0x14cb('0x13')]);}else{logger[_0x14cb('0xb')](_0x14cb('0x12'),_0x2b7caf,_0x14cb('0xe'));_0x1fd724(_0x4b849a[_0x14cb('0x14')][_0x14cb('0x13')]);}})[_0x14cb('0x15')](function(_0x332a10){logger['error'](_0x14cb('0x12'),_0x2b7caf,_0x332a10);_0x3b1d4d(_0x332a10);});});}exports[_0x14cb('0x16')]=function(_0x36e6a0){var _0x4a40b4=this;return new Promise(function(_0xe24aab,_0x2d4ac9){return db[_0x14cb('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x36e6a0[_0x14cb('0x18')][_0x14cb('0x19')],'ListId':_0x36e6a0['body'][_0x14cb('0x1a')],'VoiceQueueId':_0x36e6a0[_0x14cb('0x18')]['VoiceQueueId']===undefined?null:_0x36e6a0[_0x14cb('0x18')][_0x14cb('0x1b')],'CampaignId':_0x36e6a0['body'][_0x14cb('0x1c')]===undefined?null:_0x36e6a0['body']['CampaignId']}})['then'](function(_0x4dd5a4){if(_0x4dd5a4!=null){return db['CmHopperAdditionalPhone'][_0x14cb('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x4dd5a4['id'],'OrderBy':{'$gt':_0x4dd5a4[_0x14cb('0x1e')]}},'order':[[_0x14cb('0x1e'),'ASC']]})[_0x14cb('0xa')](function(_0xce9f6b){var _0x495192=0x0;if(_0xce9f6b){if(_0xce9f6b['countbusyretry']+_0xce9f6b['countcongestionretry']+_0xce9f6b[_0x14cb('0x1f')]+_0xce9f6b[_0x14cb('0x20')]+_0xce9f6b[_0x14cb('0x21')]+_0xce9f6b[_0x14cb('0x22')]+_0xce9f6b[_0x14cb('0x23')]+_0xce9f6b['countagentrejectretry']<_0x36e6a0['entity'][_0x14cb('0x24')])_0x495192=0x1;_0xe24aab({'additional':_0x495192});}else{return db[_0x14cb('0x25')][_0x14cb('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x4dd5a4['id']},'order':[['OrderBy',_0x14cb('0x26')]]})[_0x14cb('0xa')](function(_0x49412a){var _0xfd3b4=0x0;if(_0x49412a){if(_0x49412a[_0x14cb('0x27')]+_0x49412a[_0x14cb('0x28')]+_0x49412a['countnoanswerretry']+_0x49412a['countnosuchnumberretry']+_0x49412a[_0x14cb('0x21')]+_0x49412a[_0x14cb('0x22')]+_0x49412a[_0x14cb('0x23')]+_0x49412a[_0x14cb('0x29')]<_0x36e6a0[_0x14cb('0x2a')]['dialGlobalMaxRetry'])_0xfd3b4=0x1;_0xe24aab({'additional':_0xfd3b4});}else{_0xe24aab({'additional':0x0});}})[_0x14cb('0x15')](function(_0x5c8cb8){logger['error'](_0x14cb('0x16'),_0x5c8cb8['message']);_0x2d4ac9(_0x4a40b4[_0x14cb('0x10')](0x1f4,_0x5c8cb8['message']));});}})[_0x14cb('0x15')](function(_0x3571f7){logger[_0x14cb('0x10')](_0x14cb('0x16'),_0x3571f7[_0x14cb('0x13')]);_0x2d4ac9(_0x4a40b4[_0x14cb('0x10')](0x1f4,_0x3571f7['message']));});}else _0xe24aab({'additional':0x0});});});};exports[_0x14cb('0x2b')]=function(_0x346cc2){var _0x663f2b=this;return new Promise(function(_0x2c95c5,_0x29897c){return db[_0x14cb('0x17')][_0x14cb('0x1d')]({'raw':!![],'where':{'ContactId':_0x346cc2[_0x14cb('0x18')][_0x14cb('0x19')],'ListId':_0x346cc2[_0x14cb('0x18')][_0x14cb('0x1a')],'VoiceQueueId':_0x346cc2[_0x14cb('0x18')]['VoiceQueueId']===undefined?null:_0x346cc2['body'][_0x14cb('0x1b')],'CampaignId':_0x346cc2[_0x14cb('0x18')][_0x14cb('0x1c')]===undefined?null:_0x346cc2[_0x14cb('0x18')]['CampaignId']}})[_0x14cb('0xa')](function(_0x345a63){if(_0x345a63!=null){return db['CmHopperAdditionalPhone'][_0x14cb('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x345a63['id'],'OrderBy':{'$gte':_0x345a63[_0x14cb('0x1e')]}},'order':[[_0x14cb('0x1e'),'ASC']]})[_0x14cb('0xa')](function(_0x4b473a){if(_0x4b473a)return activateAdditionalPhone(_0x345a63,_0x346cc2['body'],_0x4b473a,_0x346cc2[_0x14cb('0x2c')],_0x346cc2['waitTime'])[_0x14cb('0xa')](function(_0x3a513b){_0x2c95c5(_0x3a513b);});else{return db[_0x14cb('0x25')][_0x14cb('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x345a63['id']},'order':[[_0x14cb('0x1e'),'ASC']]})[_0x14cb('0xa')](function(_0x50dac3){if(_0x50dac3)return activateAdditionalPhone(_0x345a63,_0x346cc2[_0x14cb('0x18')],_0x50dac3,_0x346cc2[_0x14cb('0x2c')],_0x346cc2[_0x14cb('0x2d')])[_0x14cb('0xa')](function(_0x44fae1){_0x2c95c5(_0x44fae1);});else{_0x2c95c5({'id':_0x345a63['id'],'phone':''});}})[_0x14cb('0x15')](function(_0x5df968){logger[_0x14cb('0x10')](_0x14cb('0x16'),_0x5df968[_0x14cb('0x13')]);_0x29897c(_0x663f2b[_0x14cb('0x10')](0x1f4,_0x5df968[_0x14cb('0x13')]));});}})[_0x14cb('0x15')](function(_0x4b7f9c){logger[_0x14cb('0x10')](_0x14cb('0x16'),_0x4b7f9c[_0x14cb('0x13')]);_0x29897c(_0x663f2b[_0x14cb('0x10')](0x1f4,_0x4b7f9c[_0x14cb('0x13')]));});}else _0x2c95c5(0x1);});});};function activateAdditionalPhone(_0x3a6284,_0x53655a,_0x173258,_0x24dc34,_0x22fc5b){return new Promise(function(_0xeb6892,_0x30af32){var _0x47de93;if(_['isNil'](_0x173258[_0x14cb('0x2e')])){_0x173258['scheduledat']=moment();}if(moment()>moment(_0x173258[_0x14cb('0x2e')])){_0x47de93=moment()[_0x14cb('0x2f')](_0x22fc5b||0x3,_0x14cb('0x30'));}else{if(_0x173258[_0x14cb('0x1e')]==0x0){_0x47de93=moment(_0x173258[_0x14cb('0x2e')]);}else{_0x47de93=moment()[_0x14cb('0x2f')](_0x22fc5b||0x3,_0x14cb('0x30'));}}if(_[_0x14cb('0x31')](_0x47de93)){_0x47de93=moment()[_0x14cb('0x2f')](_0x22fc5b||0x3,_0x14cb('0x30'));}var _0x3bbd97={'phone':_0x3a6284[_0x14cb('0x32')],'active':0x0,'OrderBy':_[_0x14cb('0x31')](_0x3a6284[_0x14cb('0x1e')])?0x0:_0x3a6284['OrderBy'],'scheduledat':moment()[_0x14cb('0x2f')](_0x24dc34||0x1,_0x14cb('0x30')),'countbusyretry':_0x53655a[_0x14cb('0x27')],'countcongestionretry':_0x53655a[_0x14cb('0x28')],'countnoanswerretry':_0x53655a[_0x14cb('0x1f')],'countnosuchnumberretry':_0x53655a[_0x14cb('0x20')],'countdropretry':_0x53655a['countdropretry'],'countabandonedretry':_0x53655a[_0x14cb('0x22')],'countmachineretry':_0x53655a['countmachineretry'],'countagentrejectretry':_0x53655a['countagentrejectretry'],'createdAt':_0x53655a[_0x14cb('0x33')],'updatedAt':_0x53655a[_0x14cb('0x34')]};var _0x5817d4={'CmHopperId':_0x3a6284['id'],'phone':_0x173258[_0x14cb('0x32')],'active':0x0,'OrderBy':_[_0x14cb('0x31')](_0x173258['OrderBy'])?0x0:_0x173258[_0x14cb('0x1e')],'scheduledat':_0x47de93,'countbusyretry':_0x173258[_0x14cb('0x27')],'countcongestionretry':_0x173258[_0x14cb('0x28')],'countnoanswerretry':_0x173258[_0x14cb('0x1f')],'countnosuchnumberretry':_0x173258[_0x14cb('0x20')],'countdropretry':_0x173258[_0x14cb('0x21')],'countabandonedretry':_0x173258['countabandonedretry'],'countmachineretry':_0x173258[_0x14cb('0x23')],'countagentrejectretry':_0x173258[_0x14cb('0x29')],'createdAt':_0x173258['createdAt'],'updatedAt':_0x173258[_0x14cb('0x34')]};return db[_0x14cb('0x35')]['transaction'](function(_0x2195e7){return db[_0x14cb('0x25')][_0x14cb('0x36')](_0x3bbd97,{'where':{'id':_0x173258['id']}},{'transaction':_0x2195e7})[_0x14cb('0xa')](function(){return db[_0x14cb('0x17')]['update'](_0x5817d4,{'where':{'id':_0x3a6284['id']}},{'transaction':_0x2195e7});});})[_0x14cb('0xa')](function(_0x56c3ef){_0xeb6892({'id':_0x3a6284['id'],'phone':_0x173258['phone']});})['catch'](function(_0x386c88){logger[_0x14cb('0x10')](_0x14cb('0x37'),_0x386c88[_0x14cb('0x13')]);_0x30af32({'error':_0x386c88[_0x14cb('0x13')]});});});}exports[_0x14cb('0x38')]=function(_0x1fade5){var _0x88e167=this;return new Promise(function(_0x1e80e2,_0x37961d){return db['CmHopper'][_0x14cb('0x36')](_0x1fade5[_0x14cb('0x18')]['field'],{'where':{'id':_0x1fade5[_0x14cb('0x18')]['id']}})[_0x14cb('0xa')](function(_0x3030b2){_0x1e80e2(_0x3030b2);})['catch'](function(_0x1358ef){logger[_0x14cb('0x10')](_0x14cb('0x38'),_0x1358ef['message']);_0x37961d(_0x88e167[_0x14cb('0x10')](0x1f4,_0x1358ef['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 53e213e..14c6022 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 _0x1637=['./cmHopperAdditionalPhone.controller','isAuthenticated','index','/:id','show','post','create','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x456e60,_0x14b156){var _0xd999f4=function(_0x2dd389){while(--_0x2dd389){_0x456e60['push'](_0x456e60['shift']());}};_0xd999f4(++_0x14b156);}(_0x1637,0x14c));var _0x7163=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x1637[_0x59befa];return _0x1dd63d;};'use strict';var multer=require(_0x7163('0x0'));var util=require(_0x7163('0x1'));var path=require('path');var timeout=require(_0x7163('0x2'));var express=require(_0x7163('0x3'));var router=express[_0x7163('0x4')]();var fs_extra=require(_0x7163('0x5'));var auth=require(_0x7163('0x6'));var interaction=require(_0x7163('0x7'));var config=require('../../config/environment');var controller=require(_0x7163('0x8'));router['get']('/',auth[_0x7163('0x9')](),controller[_0x7163('0xa')]);router['get'](_0x7163('0xb'),auth['isAuthenticated'](),controller[_0x7163('0xc')]);router[_0x7163('0xd')]('/',auth['isAuthenticated'](),controller[_0x7163('0xe')]);router['put'](_0x7163('0xb'),auth[_0x7163('0x9')](),controller[_0x7163('0xf')]);router['delete'](_0x7163('0xb'),auth[_0x7163('0x9')](),controller[_0x7163('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2761=['/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x2761,0x1c1));var _0x1276=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2761[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0x1276('0x0'));var util=require('util');var path=require(_0x1276('0x1'));var timeout=require(_0x1276('0x2'));var express=require(_0x1276('0x3'));var router=express[_0x1276('0x4')]();var fs_extra=require(_0x1276('0x5'));var auth=require(_0x1276('0x6'));var interaction=require(_0x1276('0x7'));var config=require(_0x1276('0x8'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x1276('0x9')]('/',auth['isAuthenticated'](),controller[_0x1276('0xa')]);router[_0x1276('0x9')](_0x1276('0xb'),auth[_0x1276('0xc')](),controller[_0x1276('0xd')]);router[_0x1276('0xe')]('/',auth[_0x1276('0xc')](),controller[_0x1276('0xf')]);router['put'](_0x1276('0xb'),auth[_0x1276('0xc')](),controller[_0x1276('0x10')]);router[_0x1276('0x11')](_0x1276('0xb'),auth[_0x1276('0xc')](),controller[_0x1276('0x12')]);module[_0x1276('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index ea3ff78..97df7df 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 _0x2d97=['contactListQueue','sequelize','STRING','INTEGER'];(function(_0x56bdb3,_0x445376){var _0x403f47=function(_0x2748ff){while(--_0x2748ff){_0x56bdb3['push'](_0x56bdb3['shift']());}};_0x403f47(++_0x445376);}(_0x2d97,0x1f1));var _0x72d9=function(_0x7de442,_0x182d78){_0x7de442=_0x7de442-0x0;var _0x51072f=_0x2d97[_0x7de442];return _0x51072f;};'use strict';var moment=require('moment');var Sequelize=require(_0x72d9('0x0'));module['exports']={'phone':{'type':Sequelize[_0x72d9('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x72d9('0x2')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x72d9('0x2')],'unique':_0x72d9('0x3')},'VoiceQueueId':{'type':Sequelize[_0x72d9('0x2')],'unique':_0x72d9('0x3')}}; \ No newline at end of file +var _0xeb9e=['STRING','INTEGER','contactListQueue','sequelize'];(function(_0x2c3f08,_0x380f2b){var _0x4ea2ab=function(_0x4b198a){while(--_0x4b198a){_0x2c3f08['push'](_0x2c3f08['shift']());}};_0x4ea2ab(++_0x380f2b);}(_0xeb9e,0x143));var _0xeeb9=function(_0x1f0b7d,_0x32ab5b){_0x1f0b7d=_0x1f0b7d-0x0;var _0xa1ba18=_0xeb9e[_0x1f0b7d];return _0xa1ba18;};'use strict';var moment=require('moment');var Sequelize=require(_0xeeb9('0x0'));module['exports']={'phone':{'type':Sequelize[_0xeeb9('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xeeb9('0x2')],'unique':_0xeeb9('0x3')},'ListId':{'type':Sequelize[_0xeeb9('0x2')],'unique':_0xeeb9('0x3')},'VoiceQueueId':{'type':Sequelize[_0xeeb9('0x2')],'unique':_0xeeb9('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 24ffb70..0323e40 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 _0x0e33=['model','query','keys','intersection','attributes','fields','length','offset','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','CmHopperBlack','findAll','rows','catch','params','find','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','set','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','fieldName','type','key'];(function(_0x47857d,_0x4a4cbb){var _0x296efd=function(_0x1ae52a){while(--_0x1ae52a){_0x47857d['push'](_0x47857d['shift']());}};_0x296efd(++_0x4a4cbb);}(_0x0e33,0xf8));var _0x30e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e33[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x30e3('0x0'));var rimraf=require(_0x30e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x30e3('0x2'));var rp=require(_0x30e3('0x3'));var moment=require(_0x30e3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x30e3('0x5'));var util=require(_0x30e3('0x6'));var path=require(_0x30e3('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x30e3('0x8'));var fs=require('fs');var fs_extra=require(_0x30e3('0x9'));var _=require(_0x30e3('0xa'));var squel=require(_0x30e3('0xb'));var crypto=require('crypto');var jsforce=require(_0x30e3('0xc'));var deskjs=require(_0x30e3('0xd'));var toCsv=require(_0x30e3('0xe'));var querystring=require(_0x30e3('0xf'));var Papa=require(_0x30e3('0x10'));var Redis=require('ioredis');var authService=require(_0x30e3('0x11'));var qs=require(_0x30e3('0x12'));var as=require(_0x30e3('0x13'));var hardwareService=require(_0x30e3('0x14'));var logger=require(_0x30e3('0x15'))(_0x30e3('0x16'));var utils=require('../../config/utils');var config=require(_0x30e3('0x17'));var licenseUtil=require(_0x30e3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12aec8,_0x3cd367){_0x3cd367=_0x3cd367||0xcc;return function(_0x2aef24){if(_0x2aef24){return _0x12aec8['sendStatus'](_0x3cd367);}return _0x12aec8[_0x30e3('0x19')](_0x3cd367)[_0x30e3('0x1a')]();};}function respondWithResult(_0x5bae3e,_0xf13d46){_0xf13d46=_0xf13d46||0xc8;return function(_0x25456d){if(_0x25456d){return _0x5bae3e[_0x30e3('0x19')](_0xf13d46)[_0x30e3('0x1b')](_0x25456d);}};}function respondWithFilteredResult(_0x1b6d9e,_0xfc3438){return function(_0x4f6bb4){if(_0x4f6bb4){var _0x77185f=typeof _0xfc3438['offset']===_0x30e3('0x1c')&&typeof _0xfc3438[_0x30e3('0x1d')]===_0x30e3('0x1c');var _0x190fff=_0x4f6bb4[_0x30e3('0x1e')];var _0x30a58c=_0x77185f?0x0:_0xfc3438['offset'];var _0x391d90=_0x77185f?_0x4f6bb4['count']:_0xfc3438['offset']+_0xfc3438['limit'];var _0x1e59af;if(_0x391d90>=_0x190fff){_0x391d90=_0x190fff;_0x1e59af=0xc8;}else{_0x1e59af=0xce;}_0x1b6d9e[_0x30e3('0x19')](_0x1e59af);return _0x1b6d9e[_0x30e3('0x1f')]('Content-Range',_0x30a58c+'-'+_0x391d90+'/'+_0x190fff)[_0x30e3('0x1b')](_0x4f6bb4);}return null;};}function patchUpdates(_0x1b846c){return function(_0x401fce){try{jsonpatch[_0x30e3('0x20')](_0x401fce,_0x1b846c,!![]);}catch(_0x24f08b){return BPromise[_0x30e3('0x21')](_0x24f08b);}return _0x401fce[_0x30e3('0x22')]();};}function saveUpdates(_0x1d87d9,_0x161ca3){return function(_0x4d1036){if(_0x4d1036){return _0x4d1036[_0x30e3('0x23')](_0x1d87d9)['then'](function(_0x27d927){return _0x27d927;});}return null;};}function removeEntity(_0x247d55,_0x4bbf00){return function(_0xb5a6cd){if(_0xb5a6cd){return _0xb5a6cd[_0x30e3('0x24')]()[_0x30e3('0x25')](function(){_0x247d55[_0x30e3('0x19')](0xcc)[_0x30e3('0x1a')]();});}};}function handleEntityNotFound(_0x57acd4,_0x461781){return function(_0x1e0870){if(!_0x1e0870){_0x57acd4[_0x30e3('0x26')](0x194);}return _0x1e0870;};}function handleError(_0x499560,_0x15fbee){_0x15fbee=_0x15fbee||0x1f4;return function(_0x26407e){logger[_0x30e3('0x27')](_0x26407e[_0x30e3('0x28')]);if(_0x26407e[_0x30e3('0x29')]){delete _0x26407e[_0x30e3('0x29')];}_0x499560['status'](_0x15fbee)[_0x30e3('0x2a')](_0x26407e);};}exports[_0x30e3('0x2b')]=function(_0x531354,_0x23dccc){var _0x3e9d99={},_0x232ac6={},_0x542a07={'count':0x0,'rows':[]};var _0x5489c5=_[_0x30e3('0x2c')](db['CmHopperBlack']['rawAttributes'],function(_0x37d4a6){return{'name':_0x37d4a6[_0x30e3('0x2d')],'type':_0x37d4a6[_0x30e3('0x2e')][_0x30e3('0x2f')]};});_0x232ac6[_0x30e3('0x30')]=_[_0x30e3('0x2c')](_0x5489c5,_0x30e3('0x29'));_0x232ac6[_0x30e3('0x31')]=_[_0x30e3('0x32')](_0x531354[_0x30e3('0x31')]);_0x232ac6['filters']=_[_0x30e3('0x33')](_0x232ac6['model'],_0x232ac6[_0x30e3('0x31')]);_0x3e9d99[_0x30e3('0x34')]=_['intersection'](_0x232ac6['model'],qs[_0x30e3('0x35')](_0x531354['query'][_0x30e3('0x35')]));_0x3e9d99[_0x30e3('0x34')]=_0x3e9d99[_0x30e3('0x34')][_0x30e3('0x36')]?_0x3e9d99['attributes']:_0x232ac6[_0x30e3('0x30')];if(!_0x531354[_0x30e3('0x31')]['hasOwnProperty']('nolimit')){_0x3e9d99[_0x30e3('0x1d')]=qs[_0x30e3('0x1d')](_0x531354[_0x30e3('0x31')][_0x30e3('0x1d')]);_0x3e9d99[_0x30e3('0x37')]=qs[_0x30e3('0x37')](_0x531354[_0x30e3('0x31')][_0x30e3('0x37')]);}_0x3e9d99[_0x30e3('0x38')]=qs[_0x30e3('0x39')](_0x531354[_0x30e3('0x31')][_0x30e3('0x39')]);_0x3e9d99[_0x30e3('0x3a')]=qs['filters'](_[_0x30e3('0x3b')](_0x531354['query'],_0x232ac6[_0x30e3('0x3c')]),_0x5489c5);if(_0x531354[_0x30e3('0x31')][_0x30e3('0x3d')]){_0x3e9d99['where']=_[_0x30e3('0x3e')](_0x3e9d99['where'],{'$or':_[_0x30e3('0x2c')](_0x5489c5,function(_0x1e381e){if(_0x1e381e[_0x30e3('0x2e')]!==_0x30e3('0x3f')){var _0xfbb6cb={};_0xfbb6cb[_0x1e381e[_0x30e3('0x29')]]={'$like':'%'+_0x531354[_0x30e3('0x31')][_0x30e3('0x3d')]+'%'};return _0xfbb6cb;}})});}_0x3e9d99=_[_0x30e3('0x3e')]({},_0x3e9d99,_0x531354[_0x30e3('0x40')]);var _0x1b8c02={'where':_0x3e9d99[_0x30e3('0x3a')]};return db['CmHopperBlack']['count'](_0x1b8c02)[_0x30e3('0x25')](function(_0x228854){_0x542a07[_0x30e3('0x1e')]=_0x228854;if(_0x531354[_0x30e3('0x31')][_0x30e3('0x41')]){_0x3e9d99['include']=[{'all':!![]}];}return db[_0x30e3('0x42')][_0x30e3('0x43')](_0x3e9d99);})[_0x30e3('0x25')](function(_0x31f5d7){_0x542a07[_0x30e3('0x44')]=_0x31f5d7;return _0x542a07;})[_0x30e3('0x25')](respondWithFilteredResult(_0x23dccc,_0x3e9d99))[_0x30e3('0x45')](handleError(_0x23dccc,null));};exports['show']=function(_0x2dea7e,_0x175df8){var _0x126365={'raw':!![],'where':{'id':_0x2dea7e[_0x30e3('0x46')]['id']}},_0x5f0f5a={};_0x5f0f5a[_0x30e3('0x30')]=_[_0x30e3('0x32')](db[_0x30e3('0x42')]['rawAttributes']);_0x5f0f5a[_0x30e3('0x31')]=_[_0x30e3('0x32')](_0x2dea7e[_0x30e3('0x31')]);_0x5f0f5a[_0x30e3('0x3c')]=_[_0x30e3('0x33')](_0x5f0f5a[_0x30e3('0x30')],_0x5f0f5a[_0x30e3('0x31')]);_0x126365[_0x30e3('0x34')]=_[_0x30e3('0x33')](_0x5f0f5a[_0x30e3('0x30')],qs['fields'](_0x2dea7e[_0x30e3('0x31')][_0x30e3('0x35')]));_0x126365['attributes']=_0x126365['attributes']['length']?_0x126365[_0x30e3('0x34')]:_0x5f0f5a['model'];if(_0x2dea7e[_0x30e3('0x31')][_0x30e3('0x41')]){_0x126365['include']=[{'all':!![]}];}_0x126365=_[_0x30e3('0x3e')]({},_0x126365,_0x2dea7e[_0x30e3('0x40')]);return db[_0x30e3('0x42')][_0x30e3('0x47')](_0x126365)[_0x30e3('0x25')](handleEntityNotFound(_0x175df8,null))['then'](respondWithResult(_0x175df8,null))[_0x30e3('0x45')](handleError(_0x175df8,null));};exports['update']=function(_0x376ef7,_0x153442){if(_0x376ef7[_0x30e3('0x48')]['id']){delete _0x376ef7[_0x30e3('0x48')]['id'];}return db[_0x30e3('0x42')]['find']({'where':{'id':_0x376ef7[_0x30e3('0x46')]['id']}})[_0x30e3('0x25')](handleEntityNotFound(_0x153442,null))[_0x30e3('0x25')](saveUpdates(_0x376ef7[_0x30e3('0x48')],null))['then'](respondWithResult(_0x153442,null))[_0x30e3('0x45')](handleError(_0x153442,null));};exports[_0x30e3('0x24')]=function(_0x333a13,_0x1539c5){return db[_0x30e3('0x42')][_0x30e3('0x47')]({'where':{'id':_0x333a13[_0x30e3('0x46')]['id']}})[_0x30e3('0x25')](handleEntityNotFound(_0x1539c5,null))[_0x30e3('0x25')](removeEntity(_0x1539c5,null))['catch'](handleError(_0x1539c5,null));};exports[_0x30e3('0x49')]=function(_0x45fe44,_0x3422b1){return db[_0x30e3('0x42')][_0x30e3('0x49')]()[_0x30e3('0x25')](respondWithResult(_0x3422b1,null))[_0x30e3('0x45')](handleError(_0x3422b1,null));}; \ No newline at end of file +var _0xe137=['name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','include','findAll','rows','show','CmHopperBlack','keys','includeAll','options','find','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error'];(function(_0x4f9cd1,_0x447a10){var _0x3b2d1=function(_0x363a5c){while(--_0x363a5c){_0x4f9cd1['push'](_0x4f9cd1['shift']());}};_0x3b2d1(++_0x447a10);}(_0xe137,0xb3));var _0x7e13=function(_0x178668,_0x1ec300){_0x178668=_0x178668-0x0;var _0x26107d=_0xe137[_0x178668];return _0x26107d;};'use strict';var emlformat=require(_0x7e13('0x0'));var rimraf=require(_0x7e13('0x1'));var zipdir=require(_0x7e13('0x2'));var jsonpatch=require(_0x7e13('0x3'));var rp=require(_0x7e13('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7e13('0x5'));var util=require('util');var path=require(_0x7e13('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e13('0x7'));var _=require(_0x7e13('0x8'));var squel=require(_0x7e13('0x9'));var crypto=require(_0x7e13('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7e13('0xb'));var querystring=require(_0x7e13('0xc'));var Papa=require(_0x7e13('0xd'));var Redis=require(_0x7e13('0xe'));var authService=require(_0x7e13('0xf'));var qs=require(_0x7e13('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e13('0x11'));var logger=require(_0x7e13('0x12'))(_0x7e13('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7e13('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6e3d10,_0x2a0266){_0x2a0266=_0x2a0266||0xcc;return function(_0x214395){if(_0x214395){return _0x6e3d10[_0x7e13('0x15')](_0x2a0266);}return _0x6e3d10[_0x7e13('0x16')](_0x2a0266)[_0x7e13('0x17')]();};}function respondWithResult(_0x3ad2d1,_0x3cd137){_0x3cd137=_0x3cd137||0xc8;return function(_0x1d2c07){if(_0x1d2c07){return _0x3ad2d1['status'](_0x3cd137)[_0x7e13('0x18')](_0x1d2c07);}};}function respondWithFilteredResult(_0x2ca343,_0xc99624){return function(_0x266a5b){if(_0x266a5b){var _0x51447a=typeof _0xc99624[_0x7e13('0x19')]==='undefined'&&typeof _0xc99624[_0x7e13('0x1a')]===_0x7e13('0x1b');var _0x316c4e=_0x266a5b[_0x7e13('0x1c')];var _0x483c3b=_0x51447a?0x0:_0xc99624[_0x7e13('0x19')];var _0x3ea219=_0x51447a?_0x266a5b['count']:_0xc99624[_0x7e13('0x19')]+_0xc99624[_0x7e13('0x1a')];var _0x23ec31;if(_0x3ea219>=_0x316c4e){_0x3ea219=_0x316c4e;_0x23ec31=0xc8;}else{_0x23ec31=0xce;}_0x2ca343[_0x7e13('0x16')](_0x23ec31);return _0x2ca343[_0x7e13('0x1d')](_0x7e13('0x1e'),_0x483c3b+'-'+_0x3ea219+'/'+_0x316c4e)[_0x7e13('0x18')](_0x266a5b);}return null;};}function patchUpdates(_0x122070){return function(_0x3ee6c0){try{jsonpatch[_0x7e13('0x1f')](_0x3ee6c0,_0x122070,!![]);}catch(_0x20d8e4){return BPromise['reject'](_0x20d8e4);}return _0x3ee6c0[_0x7e13('0x20')]();};}function saveUpdates(_0x7b096d,_0x56b331){return function(_0x58df4d){if(_0x58df4d){return _0x58df4d[_0x7e13('0x21')](_0x7b096d)[_0x7e13('0x22')](function(_0x5e0611){return _0x5e0611;});}return null;};}function removeEntity(_0x542864,_0x5835c8){return function(_0x580745){if(_0x580745){return _0x580745[_0x7e13('0x23')]()[_0x7e13('0x22')](function(){_0x542864[_0x7e13('0x16')](0xcc)[_0x7e13('0x17')]();});}};}function handleEntityNotFound(_0x1f56e9,_0x49c7f0){return function(_0xa54815){if(!_0xa54815){_0x1f56e9[_0x7e13('0x15')](0x194);}return _0xa54815;};}function handleError(_0x25d7e8,_0x4d0ee2){_0x4d0ee2=_0x4d0ee2||0x1f4;return function(_0x57fe31){logger[_0x7e13('0x24')](_0x57fe31['stack']);if(_0x57fe31['name']){delete _0x57fe31[_0x7e13('0x25')];}_0x25d7e8[_0x7e13('0x16')](_0x4d0ee2)[_0x7e13('0x26')](_0x57fe31);};}exports[_0x7e13('0x27')]=function(_0x19925a,_0x434bed){var _0x5d939c={},_0x4d9a39={},_0x553dc1={'count':0x0,'rows':[]};var _0x52c4de=_[_0x7e13('0x28')](db['CmHopperBlack'][_0x7e13('0x29')],function(_0x409ec8){return{'name':_0x409ec8[_0x7e13('0x2a')],'type':_0x409ec8[_0x7e13('0x2b')]['key']};});_0x4d9a39[_0x7e13('0x2c')]=_[_0x7e13('0x28')](_0x52c4de,_0x7e13('0x25'));_0x4d9a39['query']=_['keys'](_0x19925a[_0x7e13('0x2d')]);_0x4d9a39[_0x7e13('0x2e')]=_[_0x7e13('0x2f')](_0x4d9a39[_0x7e13('0x2c')],_0x4d9a39[_0x7e13('0x2d')]);_0x5d939c['attributes']=_[_0x7e13('0x2f')](_0x4d9a39[_0x7e13('0x2c')],qs[_0x7e13('0x30')](_0x19925a[_0x7e13('0x2d')]['fields']));_0x5d939c[_0x7e13('0x31')]=_0x5d939c[_0x7e13('0x31')][_0x7e13('0x32')]?_0x5d939c['attributes']:_0x4d9a39[_0x7e13('0x2c')];if(!_0x19925a[_0x7e13('0x2d')]['hasOwnProperty'](_0x7e13('0x33'))){_0x5d939c[_0x7e13('0x1a')]=qs['limit'](_0x19925a['query'][_0x7e13('0x1a')]);_0x5d939c[_0x7e13('0x19')]=qs['offset'](_0x19925a[_0x7e13('0x2d')][_0x7e13('0x19')]);}_0x5d939c[_0x7e13('0x34')]=qs['sort'](_0x19925a['query'][_0x7e13('0x35')]);_0x5d939c['where']=qs[_0x7e13('0x2e')](_[_0x7e13('0x36')](_0x19925a[_0x7e13('0x2d')],_0x4d9a39[_0x7e13('0x2e')]),_0x52c4de);if(_0x19925a[_0x7e13('0x2d')][_0x7e13('0x37')]){_0x5d939c['where']=_[_0x7e13('0x38')](_0x5d939c[_0x7e13('0x39')],{'$or':_['map'](_0x52c4de,function(_0x3fc5b1){if(_0x3fc5b1[_0x7e13('0x2b')]!==_0x7e13('0x3a')){var _0x27c3ff={};_0x27c3ff[_0x3fc5b1['name']]={'$like':'%'+_0x19925a[_0x7e13('0x2d')][_0x7e13('0x37')]+'%'};return _0x27c3ff;}})});}_0x5d939c=_[_0x7e13('0x38')]({},_0x5d939c,_0x19925a['options']);var _0x11eca0={'where':_0x5d939c[_0x7e13('0x39')]};return db['CmHopperBlack']['count'](_0x11eca0)[_0x7e13('0x22')](function(_0xdf579f){_0x553dc1['count']=_0xdf579f;if(_0x19925a['query']['includeAll']){_0x5d939c[_0x7e13('0x3b')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x7e13('0x3c')](_0x5d939c);})['then'](function(_0x1e384a){_0x553dc1[_0x7e13('0x3d')]=_0x1e384a;return _0x553dc1;})[_0x7e13('0x22')](respondWithFilteredResult(_0x434bed,_0x5d939c))['catch'](handleError(_0x434bed,null));};exports[_0x7e13('0x3e')]=function(_0x58cec8,_0x2ec770){var _0x4ada30={'raw':!![],'where':{'id':_0x58cec8['params']['id']}},_0x4c8a96={};_0x4c8a96[_0x7e13('0x2c')]=_['keys'](db[_0x7e13('0x3f')][_0x7e13('0x29')]);_0x4c8a96[_0x7e13('0x2d')]=_[_0x7e13('0x40')](_0x58cec8['query']);_0x4c8a96['filters']=_[_0x7e13('0x2f')](_0x4c8a96['model'],_0x4c8a96[_0x7e13('0x2d')]);_0x4ada30[_0x7e13('0x31')]=_[_0x7e13('0x2f')](_0x4c8a96[_0x7e13('0x2c')],qs[_0x7e13('0x30')](_0x58cec8[_0x7e13('0x2d')]['fields']));_0x4ada30[_0x7e13('0x31')]=_0x4ada30['attributes'][_0x7e13('0x32')]?_0x4ada30[_0x7e13('0x31')]:_0x4c8a96[_0x7e13('0x2c')];if(_0x58cec8['query'][_0x7e13('0x41')]){_0x4ada30[_0x7e13('0x3b')]=[{'all':!![]}];}_0x4ada30=_[_0x7e13('0x38')]({},_0x4ada30,_0x58cec8[_0x7e13('0x42')]);return db[_0x7e13('0x3f')][_0x7e13('0x43')](_0x4ada30)[_0x7e13('0x22')](handleEntityNotFound(_0x2ec770,null))[_0x7e13('0x22')](respondWithResult(_0x2ec770,null))[_0x7e13('0x44')](handleError(_0x2ec770,null));};exports[_0x7e13('0x21')]=function(_0x1cbf68,_0x2b7ac3){if(_0x1cbf68[_0x7e13('0x45')]['id']){delete _0x1cbf68[_0x7e13('0x45')]['id'];}return db[_0x7e13('0x3f')][_0x7e13('0x43')]({'where':{'id':_0x1cbf68['params']['id']}})[_0x7e13('0x22')](handleEntityNotFound(_0x2b7ac3,null))[_0x7e13('0x22')](saveUpdates(_0x1cbf68[_0x7e13('0x45')],null))[_0x7e13('0x22')](respondWithResult(_0x2b7ac3,null))[_0x7e13('0x44')](handleError(_0x2b7ac3,null));};exports[_0x7e13('0x23')]=function(_0x396522,_0x3356b){return db[_0x7e13('0x3f')][_0x7e13('0x43')]({'where':{'id':_0x396522[_0x7e13('0x46')]['id']}})[_0x7e13('0x22')](handleEntityNotFound(_0x3356b,null))[_0x7e13('0x22')](removeEntity(_0x3356b,null))['catch'](handleError(_0x3356b,null));};exports[_0x7e13('0x47')]=function(_0x3aacc2,_0xa75a18){return db[_0x7e13('0x3f')][_0x7e13('0x47')]()[_0x7e13('0x22')](respondWithResult(_0xa75a18,null))[_0x7e13('0x44')](handleError(_0xa75a18,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 73474cc..d0aa4d4 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 _0x68c2=['path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','util','api','moment','bluebird'];(function(_0x5f477d,_0x33c7ed){var _0x28756c=function(_0x537920){while(--_0x537920){_0x5f477d['push'](_0x5f477d['shift']());}};_0x28756c(++_0x33c7ed);}(_0x68c2,0x97));var _0x268c=function(_0xf0f9ae,_0x3b02ef){_0xf0f9ae=_0xf0f9ae-0x0;var _0x46b898=_0x68c2[_0xf0f9ae];return _0x46b898;};'use strict';var _=require(_0x268c('0x0'));var util=require(_0x268c('0x1'));var logger=require('../../config/logger')(_0x268c('0x2'));var moment=require(_0x268c('0x3'));var BPromise=require(_0x268c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x268c('0x5'));var rimraf=require(_0x268c('0x6'));var config=require(_0x268c('0x7'));var attributes=require(_0x268c('0x8'));module[_0x268c('0x9')]=function(_0x50a2f6,_0x59852f){return _0x50a2f6[_0x268c('0xa')]('CmHopperBlack',attributes,{'tableName':_0x268c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa66=['request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2110ce,_0x37c29b){var _0x139610=function(_0x16b65a){while(--_0x16b65a){_0x2110ce['push'](_0x2110ce['shift']());}};_0x139610(++_0x37c29b);}(_0xfa66,0x12e));var _0x6fa6=function(_0x151359,_0x424fa1){_0x151359=_0x151359-0x0;var _0x285507=_0xfa66[_0x151359];return _0x285507;};'use strict';var _=require(_0x6fa6('0x0'));var util=require(_0x6fa6('0x1'));var logger=require(_0x6fa6('0x2'))(_0x6fa6('0x3'));var moment=require(_0x6fa6('0x4'));var BPromise=require(_0x6fa6('0x5'));var rp=require(_0x6fa6('0x6'));var fs=require('fs');var path=require(_0x6fa6('0x7'));var rimraf=require(_0x6fa6('0x8'));var config=require(_0x6fa6('0x9'));var attributes=require(_0x6fa6('0xa'));module[_0x6fa6('0xb')]=function(_0x49cb7b,_0x23fcf9){return _0x49cb7b[_0x6fa6('0xc')]('CmHopperBlack',attributes,{'tableName':_0x6fa6('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 1cc9d05..ea8a1af 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 _0xd8cd=['request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','limit','map','include','model','attributes','catch','UpdateCmHopperBlack','update','DestroyCmHopperBlack','destroy','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0xc7be4b,_0x593333){var _0x72ef33=function(_0x3a7b30){while(--_0x3a7b30){_0xc7be4b['push'](_0xc7be4b['shift']());}};_0x72ef33(++_0x593333);}(_0xd8cd,0x64));var _0xdd8c=function(_0x5939c4,_0x3509df){_0x5939c4=_0x5939c4-0x0;var _0x358050=_0xd8cd[_0x5939c4];return _0x358050;};'use strict';var _=require(_0xdd8c('0x0'));var util=require(_0xdd8c('0x1'));var moment=require('moment');var BPromise=require(_0xdd8c('0x2'));var rs=require(_0xdd8c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd8c('0x4'))['db'];var utils=require(_0xdd8c('0x5'));var logger=require(_0xdd8c('0x6'))('rpc');var config=require(_0xdd8c('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x82520a,_0x39f0cd,_0x26b289){return new BPromise(function(_0x4efb5f,_0x26dec3){return client[_0xdd8c('0x8')](_0x82520a,_0x26b289)[_0xdd8c('0x9')](function(_0xe09083){logger[_0xdd8c('0xa')](_0xdd8c('0xb'),_0x39f0cd,'request\x20sent');logger[_0xdd8c('0xc')](_0xdd8c('0xd'),_0x39f0cd,_0xdd8c('0xe'),JSON[_0xdd8c('0xf')](_0xe09083));if(_0xe09083[_0xdd8c('0x10')]){if(_0xe09083[_0xdd8c('0x10')][_0xdd8c('0x11')]===0x1f4){logger[_0xdd8c('0x10')](_0xdd8c('0xb'),_0x39f0cd,_0xe09083[_0xdd8c('0x10')]['message']);return _0x26dec3(_0xe09083[_0xdd8c('0x10')]['message']);}logger['error'](_0xdd8c('0xb'),_0x39f0cd,_0xe09083[_0xdd8c('0x10')][_0xdd8c('0x12')]);return _0x4efb5f(_0xe09083[_0xdd8c('0x10')][_0xdd8c('0x12')]);}else{logger[_0xdd8c('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0x39f0cd,_0xdd8c('0xe'));_0x4efb5f(_0xe09083[_0xdd8c('0x13')]['message']);}})['catch'](function(_0x428c63){logger[_0xdd8c('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x39f0cd,_0x428c63);_0x26dec3(_0x428c63);});});}exports[_0xdd8c('0x14')]=function(_0x4e4503){var _0x5cf57f=this;return new Promise(function(_0x3ad081,_0x116ab7){return db[_0xdd8c('0x15')][_0xdd8c('0x16')]({'raw':_0x4e4503[_0xdd8c('0x17')]?_0x4e4503['options'][_0xdd8c('0x18')]===undefined?!![]:![]:!![],'where':_0x4e4503[_0xdd8c('0x17')]?_0x4e4503[_0xdd8c('0x17')][_0xdd8c('0x19')]||null:null,'attributes':_0x4e4503[_0xdd8c('0x17')]?_0x4e4503[_0xdd8c('0x17')]['attributes']||null:null,'limit':_0x4e4503[_0xdd8c('0x17')]?_0x4e4503['options'][_0xdd8c('0x1a')]||null:null,'include':_0x4e4503['options']?_0x4e4503[_0xdd8c('0x17')]['include']?_[_0xdd8c('0x1b')](_0x4e4503[_0xdd8c('0x17')][_0xdd8c('0x1c')],function(_0x1bd0db){return{'model':db[_0x1bd0db[_0xdd8c('0x1d')]],'as':_0x1bd0db['as'],'attributes':_0x1bd0db[_0xdd8c('0x1e')],'include':_0x1bd0db[_0xdd8c('0x1c')]?_['map'](_0x1bd0db[_0xdd8c('0x1c')],function(_0x49b771){return{'model':db[_0x49b771[_0xdd8c('0x1d')]],'as':_0x49b771['as'],'attributes':_0x49b771[_0xdd8c('0x1e')],'include':_0x49b771['include']?_[_0xdd8c('0x1b')](_0x49b771[_0xdd8c('0x1c')],function(_0x26af5c){return{'model':db[_0x26af5c['model']],'as':_0x26af5c['as'],'attributes':_0x26af5c[_0xdd8c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xdd8c('0x9')](function(_0xad61c5){logger[_0xdd8c('0xa')](_0xdd8c('0x14'),_0x4e4503);logger[_0xdd8c('0xc')](_0xdd8c('0x14'),_0x4e4503,JSON[_0xdd8c('0xf')](_0xad61c5));_0x3ad081(_0xad61c5);})[_0xdd8c('0x1f')](function(_0x51cde3){logger['error'](_0xdd8c('0x14'),_0x51cde3[_0xdd8c('0x12')],_0x4e4503);_0x116ab7(_0x5cf57f[_0xdd8c('0x10')](0x1f4,_0x51cde3[_0xdd8c('0x12')]));});});};exports[_0xdd8c('0x20')]=function(_0x2c38eb){var _0x538e02=this;return new Promise(function(_0x22801b,_0x2dfcc1){return db[_0xdd8c('0x15')][_0xdd8c('0x21')](_0x2c38eb['body'],{'raw':_0x2c38eb[_0xdd8c('0x17')]?_0x2c38eb[_0xdd8c('0x17')][_0xdd8c('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c38eb['options']?_0x2c38eb[_0xdd8c('0x17')][_0xdd8c('0x19')]||null:null,'attributes':_0x2c38eb[_0xdd8c('0x17')]?_0x2c38eb[_0xdd8c('0x17')][_0xdd8c('0x1e')]||null:null,'limit':_0x2c38eb[_0xdd8c('0x17')]?_0x2c38eb[_0xdd8c('0x17')]['limit']||null:null})['then'](function(_0x506974){logger[_0xdd8c('0xa')](_0xdd8c('0x20'),_0x2c38eb);logger[_0xdd8c('0xc')](_0xdd8c('0x20'),_0x2c38eb,JSON[_0xdd8c('0xf')](_0x506974));_0x22801b(_0x506974);})[_0xdd8c('0x1f')](function(_0x4ea223){logger['error'](_0xdd8c('0x20'),_0x4ea223[_0xdd8c('0x12')],_0x2c38eb);_0x2dfcc1(_0x538e02['error'](0x1f4,_0x4ea223[_0xdd8c('0x12')]));});});};exports[_0xdd8c('0x22')]=function(_0x6196eb){var _0x486df2=this;return new Promise(function(_0xf7b841,_0x873b92){return db['CmHopperBlack'][_0xdd8c('0x23')]({'where':_0x6196eb[_0xdd8c('0x17')]?_0x6196eb[_0xdd8c('0x17')]['where']||null:null})[_0xdd8c('0x9')](function(_0x58c4d7){logger[_0xdd8c('0xa')](_0xdd8c('0x22'),_0x6196eb);logger['debug'](_0xdd8c('0x22'),_0x6196eb,JSON['stringify'](_0x58c4d7));_0xf7b841(_0x58c4d7);})[_0xdd8c('0x1f')](function(_0x20c02b){logger['error']('DestroyCmHopperBlack',_0x20c02b['message'],_0x6196eb);_0x873b92(_0x486df2[_0xdd8c('0x10')](0x1f4,_0x20c02b[_0xdd8c('0x12')]));});});}; \ No newline at end of file +var _0x1f6e=['then','UpdateCmHopperBlack','update','body','where','DestroyCmHopperBlack','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','raw','options','attributes','limit','include','map','model'];(function(_0x3d4f9e,_0xf816fe){var _0x320f80=function(_0xb1790a){while(--_0xb1790a){_0x3d4f9e['push'](_0x3d4f9e['shift']());}};_0x320f80(++_0xf816fe);}(_0x1f6e,0x1e6));var _0xe1f6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1f6e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe1f6('0x0'));var util=require(_0xe1f6('0x1'));var moment=require('moment');var BPromise=require(_0xe1f6('0x2'));var rs=require(_0xe1f6('0x3'));var fs=require('fs');var Redis=require(_0xe1f6('0x4'));var db=require(_0xe1f6('0x5'))['db'];var utils=require(_0xe1f6('0x6'));var logger=require(_0xe1f6('0x7'))(_0xe1f6('0x8'));var config=require(_0xe1f6('0x9'));var jayson=require(_0xe1f6('0xa'));var client=jayson['client'][_0xe1f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x130a6b,_0x27a74f,_0x5bdd69){return new BPromise(function(_0x12982d,_0x854a33){return client[_0xe1f6('0xc')](_0x130a6b,_0x5bdd69)['then'](function(_0x591eb4){logger[_0xe1f6('0xd')](_0xe1f6('0xe'),_0x27a74f,_0xe1f6('0xf'));logger[_0xe1f6('0x10')](_0xe1f6('0x11'),_0x27a74f,_0xe1f6('0xf'),JSON[_0xe1f6('0x12')](_0x591eb4));if(_0x591eb4['error']){if(_0x591eb4[_0xe1f6('0x13')][_0xe1f6('0x14')]===0x1f4){logger[_0xe1f6('0x13')](_0xe1f6('0xe'),_0x27a74f,_0x591eb4[_0xe1f6('0x13')][_0xe1f6('0x15')]);return _0x854a33(_0x591eb4[_0xe1f6('0x13')]['message']);}logger[_0xe1f6('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x27a74f,_0x591eb4[_0xe1f6('0x13')][_0xe1f6('0x15')]);return _0x12982d(_0x591eb4[_0xe1f6('0x13')][_0xe1f6('0x15')]);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x27a74f,_0xe1f6('0xf'));_0x12982d(_0x591eb4[_0xe1f6('0x16')][_0xe1f6('0x15')]);}})[_0xe1f6('0x17')](function(_0x1361b2){logger[_0xe1f6('0x13')](_0xe1f6('0xe'),_0x27a74f,_0x1361b2);_0x854a33(_0x1361b2);});});}exports[_0xe1f6('0x18')]=function(_0x240b3a){var _0x114499=this;return new Promise(function(_0x4b8977,_0xdbeb67){return db[_0xe1f6('0x19')][_0xe1f6('0x1a')]({'raw':_0x240b3a['options']?_0x240b3a['options'][_0xe1f6('0x1b')]===undefined?!![]:![]:!![],'where':_0x240b3a[_0xe1f6('0x1c')]?_0x240b3a[_0xe1f6('0x1c')]['where']||null:null,'attributes':_0x240b3a[_0xe1f6('0x1c')]?_0x240b3a[_0xe1f6('0x1c')][_0xe1f6('0x1d')]||null:null,'limit':_0x240b3a[_0xe1f6('0x1c')]?_0x240b3a['options'][_0xe1f6('0x1e')]||null:null,'include':_0x240b3a[_0xe1f6('0x1c')]?_0x240b3a['options'][_0xe1f6('0x1f')]?_[_0xe1f6('0x20')](_0x240b3a[_0xe1f6('0x1c')][_0xe1f6('0x1f')],function(_0x53ac84){return{'model':db[_0x53ac84[_0xe1f6('0x21')]],'as':_0x53ac84['as'],'attributes':_0x53ac84[_0xe1f6('0x1d')],'include':_0x53ac84[_0xe1f6('0x1f')]?_[_0xe1f6('0x20')](_0x53ac84[_0xe1f6('0x1f')],function(_0x2f6bdf){return{'model':db[_0x2f6bdf[_0xe1f6('0x21')]],'as':_0x2f6bdf['as'],'attributes':_0x2f6bdf[_0xe1f6('0x1d')],'include':_0x2f6bdf['include']?_['map'](_0x2f6bdf[_0xe1f6('0x1f')],function(_0x425e9b){return{'model':db[_0x425e9b[_0xe1f6('0x21')]],'as':_0x425e9b['as'],'attributes':_0x425e9b[_0xe1f6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe1f6('0x22')](function(_0x27adb5){logger['info'](_0xe1f6('0x18'),_0x240b3a);logger[_0xe1f6('0x10')](_0xe1f6('0x18'),_0x240b3a,JSON[_0xe1f6('0x12')](_0x27adb5));_0x4b8977(_0x27adb5);})[_0xe1f6('0x17')](function(_0x1373d5){logger[_0xe1f6('0x13')](_0xe1f6('0x18'),_0x1373d5['message'],_0x240b3a);_0xdbeb67(_0x114499['error'](0x1f4,_0x1373d5['message']));});});};exports[_0xe1f6('0x23')]=function(_0x47d59a){var _0x3ab21e=this;return new Promise(function(_0xeeeec6,_0x3c83df){return db[_0xe1f6('0x19')][_0xe1f6('0x24')](_0x47d59a[_0xe1f6('0x25')],{'raw':_0x47d59a[_0xe1f6('0x1c')]?_0x47d59a[_0xe1f6('0x1c')][_0xe1f6('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47d59a[_0xe1f6('0x1c')]?_0x47d59a['options'][_0xe1f6('0x26')]||null:null,'attributes':_0x47d59a[_0xe1f6('0x1c')]?_0x47d59a['options'][_0xe1f6('0x1d')]||null:null,'limit':_0x47d59a[_0xe1f6('0x1c')]?_0x47d59a['options'][_0xe1f6('0x1e')]||null:null})['then'](function(_0x227fe3){logger[_0xe1f6('0xd')](_0xe1f6('0x23'),_0x47d59a);logger[_0xe1f6('0x10')](_0xe1f6('0x23'),_0x47d59a,JSON[_0xe1f6('0x12')](_0x227fe3));_0xeeeec6(_0x227fe3);})[_0xe1f6('0x17')](function(_0x45855c){logger[_0xe1f6('0x13')](_0xe1f6('0x23'),_0x45855c['message'],_0x47d59a);_0x3c83df(_0x3ab21e['error'](0x1f4,_0x45855c[_0xe1f6('0x15')]));});});};exports[_0xe1f6('0x27')]=function(_0x4e5f3f){var _0x37312f=this;return new Promise(function(_0x5213ef,_0x40e5fe){return db['CmHopperBlack']['destroy']({'where':_0x4e5f3f[_0xe1f6('0x1c')]?_0x4e5f3f[_0xe1f6('0x1c')][_0xe1f6('0x26')]||null:null})['then'](function(_0x5b53aa){logger[_0xe1f6('0xd')]('DestroyCmHopperBlack',_0x4e5f3f);logger['debug'](_0xe1f6('0x27'),_0x4e5f3f,JSON['stringify'](_0x5b53aa));_0x5213ef(_0x5b53aa);})[_0xe1f6('0x17')](function(_0x446778){logger[_0xe1f6('0x13')](_0xe1f6('0x27'),_0x446778[_0xe1f6('0x15')],_0x4e5f3f);_0x40e5fe(_0x37312f[_0xe1f6('0x13')](0x1f4,_0x446778[_0xe1f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 50284a0..0009540 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 _0xd117=['/describe','describe','/:id','show','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xd117,0x182));var _0x7d11=function(_0x3cafb8,_0x32860e){_0x3cafb8=_0x3cafb8-0x0;var _0x4b7f85=_0xd117[_0x3cafb8];return _0x4b7f85;};'use strict';var multer=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var path=require(_0x7d11('0x2'));var timeout=require(_0x7d11('0x3'));var express=require(_0x7d11('0x4'));var router=express[_0x7d11('0x5')]();var fs_extra=require(_0x7d11('0x6'));var auth=require(_0x7d11('0x7'));var interaction=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var controller=require(_0x7d11('0xa'));router[_0x7d11('0xb')]('/',auth[_0x7d11('0xc')](),controller[_0x7d11('0xd')]);router[_0x7d11('0xb')](_0x7d11('0xe'),auth['isAuthenticated'](),controller[_0x7d11('0xf')]);router[_0x7d11('0xb')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x11')]);router[_0x7d11('0x12')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x13')]);router['delete']('/:id',auth[_0x7d11('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1883=['../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','/:id','show','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x104b96,_0x2d1df8){var _0x14b65c=function(_0x37debb){while(--_0x37debb){_0x104b96['push'](_0x104b96['shift']());}};_0x14b65c(++_0x2d1df8);}(_0x1883,0xab));var _0x3188=function(_0x992dd1,_0x45ceac){_0x992dd1=_0x992dd1-0x0;var _0x2bf63a=_0x1883[_0x992dd1];return _0x2bf63a;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require(_0x3188('0x3'));var express=require(_0x3188('0x4'));var router=express[_0x3188('0x5')]();var fs_extra=require(_0x3188('0x6'));var auth=require(_0x3188('0x7'));var interaction=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var controller=require(_0x3188('0xa'));router[_0x3188('0xb')]('/',auth[_0x3188('0xc')](),controller[_0x3188('0xd')]);router[_0x3188('0xb')](_0x3188('0xe'),auth[_0x3188('0xc')](),controller['describe']);router[_0x3188('0xb')](_0x3188('0xf'),auth['isAuthenticated'](),controller[_0x3188('0x10')]);router['put'](_0x3188('0xf'),auth[_0x3188('0xc')](),controller[_0x3188('0x11')]);router[_0x3188('0x12')]('/:id',auth[_0x3188('0xc')](),controller[_0x3188('0x13')]);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 3a49391..862f63e 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 _0x95fd=['exports','INTEGER','STRING','DATE','getDataValue','setDataValue','followuptime','BOOLEAN','sequelize','moment'];(function(_0x3dea14,_0x384599){var _0x4d2176=function(_0x59e2c1){while(--_0x59e2c1){_0x3dea14['push'](_0x3dea14['shift']());}};_0x4d2176(++_0x384599);}(_0x95fd,0x102));var _0xd95f=function(_0x560f33,_0x242084){_0x560f33=_0x560f33-0x0;var _0x161706=_0x95fd[_0x560f33];return _0x161706;};'use strict';var Sequelize=require(_0xd95f('0x0'));var moment=require(_0xd95f('0x1'));module[_0xd95f('0x2')]={'state':{'type':Sequelize[_0xd95f('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xd95f('0x4')]},'scheduledat':{'type':Sequelize[_0xd95f('0x5')]},'countbusyretry':{'type':Sequelize[_0xd95f('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd95f('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd95f('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd95f('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xd95f('0x4')]},'originatecalleridname':{'type':Sequelize[_0xd95f('0x4')]},'calleridnum':{'type':Sequelize[_0xd95f('0x4')]},'calleridname':{'type':Sequelize[_0xd95f('0x4')]},'starttime':{'type':Sequelize[_0xd95f('0x5')]},'responsetime':{'type':Sequelize[_0xd95f('0x5')]},'answertime':{'type':Sequelize[_0xd95f('0x5')]},'droptime':{'type':Sequelize[_0xd95f('0x5')]},'endtime':{'type':Sequelize[_0xd95f('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd95f('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd95f('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd95f('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xd95f('0x4')]},'campaigntype':{'type':Sequelize[_0xd95f('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd95f('0x4')]},'thirdDisposition':{'type':Sequelize[_0xd95f('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x15ca18){var _0x3709b6=this[_0xd95f('0x6')]('endtime');if(_0x3709b6&&_0x15ca18){this[_0xd95f('0x7')](_0xd95f('0x8'),moment(_0x15ca18)['diff'](moment(_0x3709b6),'seconds'));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xd95f('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xd95f('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xd95f('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd95f('0x5')]},'deleted':{'type':Sequelize[_0xd95f('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xd95f('0x5')]},'recallme':{'type':Sequelize[_0xd95f('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xd95f('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xd95f('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd95f('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd95f('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd95f('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd95f('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5135=['exports','INTEGER','DATE','STRING','followuptime','diff','seconds','BOOLEAN','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5135,0x86));var _0x5513=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x5135[_0x2ec461];return _0x28603d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5513('0x0'));module[_0x5513('0x1')]={'state':{'type':Sequelize[_0x5513('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x5513('0x3')]},'countbusyretry':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x5513('0x4')]},'originatecalleridname':{'type':Sequelize[_0x5513('0x4')]},'calleridnum':{'type':Sequelize[_0x5513('0x4')]},'calleridname':{'type':Sequelize[_0x5513('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x5513('0x3')]},'droptime':{'type':Sequelize[_0x5513('0x3')]},'endtime':{'type':Sequelize[_0x5513('0x3')]},'ringtime':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x5513('0x4')]},'campaign':{'type':Sequelize[_0x5513('0x4')]},'campaigntype':{'type':Sequelize[_0x5513('0x4')]},'membername':{'type':Sequelize[_0x5513('0x4')]},'reason':{'type':Sequelize[_0x5513('0x4')]},'disposition':{'type':Sequelize[_0x5513('0x4')]},'secondDisposition':{'type':Sequelize[_0x5513('0x4')]},'thirdDisposition':{'type':Sequelize[_0x5513('0x4')]},'dispositionat':{'type':Sequelize[_0x5513('0x3')],'set':function(_0x448474){var _0x13e7ff=this['getDataValue']('endtime');if(_0x13e7ff&&_0x448474){this['setDataValue'](_0x5513('0x5'),moment(_0x448474)[_0x5513('0x6')](moment(_0x13e7ff),_0x5513('0x7')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x5513('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x5513('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x5513('0x8')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x5513('0x3')]},'callback':{'type':Sequelize[_0x5513('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5513('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5513('0x3')]},'deleted':{'type':Sequelize[_0x5513('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x5513('0x3')]},'recallme':{'type':Sequelize[_0x5513('0x8')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x5513('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 8cede88..fcabb4a 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 _0x2675=['lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','destroy','then','error','name','send','index','map','CmHopperFinal','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','rawAttributes','length','options','find','describe','body','uniqueid','params','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','busyContacts','abandonedContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','VoiceQueueId','createdAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','updatedAt','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','select','phone','from','calleridnum','cm_hopper_final','state\x20=\x204','moveContactsIvrCampaignHopperFinal','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','group','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x2b9951,_0x18cdad){var _0x859d41=function(_0x9cfcd8){while(--_0x9cfcd8){_0x2b9951['push'](_0x2b9951['shift']());}};_0x859d41(++_0x18cdad);}(_0x2675,0x75));var _0x5267=function(_0x1879dd,_0x363cbd){_0x1879dd=_0x1879dd-0x0;var _0x4d3063=_0x2675[_0x1879dd];return _0x4d3063;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];function respondWithStatusCode(_0x1f9be3,_0x1d7090){_0x1d7090=_0x1d7090||0xcc;return function(_0x1171b9){if(_0x1171b9){return _0x1f9be3[_0x5267('0x16')](_0x1d7090);}return _0x1f9be3[_0x5267('0x17')](_0x1d7090)[_0x5267('0x18')]();};}function respondWithResult(_0x1e2d3b,_0x16e5a7){_0x16e5a7=_0x16e5a7||0xc8;return function(_0x29349a){if(_0x29349a){return _0x1e2d3b[_0x5267('0x17')](_0x16e5a7)['json'](_0x29349a);}};}function respondWithFilteredResult(_0x52e24e,_0xa593fb){return function(_0x40d897){if(_0x40d897){var _0x38a147=typeof _0xa593fb[_0x5267('0x19')]===_0x5267('0x1a')&&typeof _0xa593fb[_0x5267('0x1b')]===_0x5267('0x1a');var _0x6831e0=_0x40d897[_0x5267('0x1c')];var _0xb1c97a=_0x38a147?0x0:_0xa593fb[_0x5267('0x19')];var _0x1ab03=_0x38a147?_0x40d897['count']:_0xa593fb[_0x5267('0x19')]+_0xa593fb[_0x5267('0x1b')];var _0x5069e8;if(_0x1ab03>=_0x6831e0){_0x1ab03=_0x6831e0;_0x5069e8=0xc8;}else{_0x5069e8=0xce;}_0x52e24e[_0x5267('0x17')](_0x5069e8);return _0x52e24e['set'](_0x5267('0x1d'),_0xb1c97a+'-'+_0x1ab03+'/'+_0x6831e0)[_0x5267('0x1e')](_0x40d897);}return null;};}function patchUpdates(_0x39c0c3){return function(_0x2a9f99){try{jsonpatch[_0x5267('0x1f')](_0x2a9f99,_0x39c0c3,!![]);}catch(_0x4dd637){return BPromise[_0x5267('0x20')](_0x4dd637);}return _0x2a9f99['save']();};}function saveUpdates(_0xa32663,_0x420fb8){return function(_0x3b53ac){if(_0x3b53ac){return _0x3b53ac['update'](_0xa32663)['then'](function(_0x5546e2){return _0x5546e2;});}return null;};}function removeEntity(_0x4a17c7,_0x5ea6a6){return function(_0x26c7f8){if(_0x26c7f8){return _0x26c7f8[_0x5267('0x21')]()[_0x5267('0x22')](function(){_0x4a17c7[_0x5267('0x17')](0xcc)[_0x5267('0x18')]();});}};}function handleEntityNotFound(_0x40d1be,_0x126a97){return function(_0x220e03){if(!_0x220e03){_0x40d1be[_0x5267('0x16')](0x194);}return _0x220e03;};}function handleError(_0x59f112,_0x5cb64f){_0x5cb64f=_0x5cb64f||0x1f4;return function(_0x354111){logger[_0x5267('0x23')](_0x354111['stack']);if(_0x354111[_0x5267('0x24')]){delete _0x354111['name'];}_0x59f112['status'](_0x5cb64f)[_0x5267('0x25')](_0x354111);};}exports[_0x5267('0x26')]=function(_0x1f33b7,_0x2d2ace){var _0x33c431={},_0x4f3d4d={},_0x5e87eb={'count':0x0,'rows':[]};var _0x18020c=_[_0x5267('0x27')](db[_0x5267('0x28')]['rawAttributes'],function(_0x58d685){return{'name':_0x58d685[_0x5267('0x29')],'type':_0x58d685[_0x5267('0x2a')][_0x5267('0x2b')]};});_0x4f3d4d['model']=_['map'](_0x18020c,_0x5267('0x24'));_0x4f3d4d[_0x5267('0x2c')]=_[_0x5267('0x2d')](_0x1f33b7[_0x5267('0x2c')]);_0x4f3d4d['filters']=_[_0x5267('0x2e')](_0x4f3d4d[_0x5267('0x2f')],_0x4f3d4d[_0x5267('0x2c')]);_0x33c431[_0x5267('0x30')]=_[_0x5267('0x2e')](_0x4f3d4d[_0x5267('0x2f')],qs[_0x5267('0x31')](_0x1f33b7[_0x5267('0x2c')]['fields']));_0x33c431['attributes']=_0x33c431[_0x5267('0x30')]['length']?_0x33c431[_0x5267('0x30')]:_0x4f3d4d[_0x5267('0x2f')];if(!_0x1f33b7[_0x5267('0x2c')][_0x5267('0x32')]('nolimit')){_0x33c431[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0x1f33b7[_0x5267('0x2c')][_0x5267('0x1b')]);_0x33c431[_0x5267('0x19')]=qs[_0x5267('0x19')](_0x1f33b7[_0x5267('0x2c')][_0x5267('0x19')]);}_0x33c431['order']=qs[_0x5267('0x33')](_0x1f33b7['query'][_0x5267('0x33')]);_0x33c431[_0x5267('0x34')]=qs[_0x5267('0x35')](_[_0x5267('0x36')](_0x1f33b7[_0x5267('0x2c')],_0x4f3d4d[_0x5267('0x35')]),_0x18020c);if(_0x1f33b7[_0x5267('0x2c')]['filter']){_0x33c431[_0x5267('0x34')]=_[_0x5267('0x37')](_0x33c431[_0x5267('0x34')],{'$or':_[_0x5267('0x27')](_0x18020c,function(_0x82cea7){if(_0x82cea7[_0x5267('0x2a')]!==_0x5267('0x38')){var _0x487dfc={};_0x487dfc[_0x82cea7[_0x5267('0x24')]]={'$like':'%'+_0x1f33b7['query'][_0x5267('0x39')]+'%'};return _0x487dfc;}})});}_0x33c431=_['merge']({},_0x33c431,_0x1f33b7['options']);var _0x51bddd={'where':_0x33c431[_0x5267('0x34')]};return db['CmHopperFinal'][_0x5267('0x1c')](_0x51bddd)[_0x5267('0x22')](function(_0x3d4b19){_0x5e87eb[_0x5267('0x1c')]=_0x3d4b19;if(_0x1f33b7['query'][_0x5267('0x3a')]){_0x33c431[_0x5267('0x3b')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x33c431);})[_0x5267('0x22')](function(_0x560cdf){_0x5e87eb[_0x5267('0x3c')]=_0x560cdf;return _0x5e87eb;})[_0x5267('0x22')](respondWithFilteredResult(_0x2d2ace,_0x33c431))[_0x5267('0x3d')](handleError(_0x2d2ace,null));};exports[_0x5267('0x3e')]=function(_0x36d0f1,_0x3012cb){var _0x27add5={'raw':!![],'where':{'id':_0x36d0f1['params']['id']}},_0x5697b3={};_0x5697b3[_0x5267('0x2f')]=_['keys'](db[_0x5267('0x28')][_0x5267('0x3f')]);_0x5697b3['query']=_[_0x5267('0x2d')](_0x36d0f1[_0x5267('0x2c')]);_0x5697b3[_0x5267('0x35')]=_[_0x5267('0x2e')](_0x5697b3[_0x5267('0x2f')],_0x5697b3[_0x5267('0x2c')]);_0x27add5[_0x5267('0x30')]=_[_0x5267('0x2e')](_0x5697b3[_0x5267('0x2f')],qs['fields'](_0x36d0f1[_0x5267('0x2c')][_0x5267('0x31')]));_0x27add5[_0x5267('0x30')]=_0x27add5[_0x5267('0x30')][_0x5267('0x40')]?_0x27add5['attributes']:_0x5697b3[_0x5267('0x2f')];if(_0x36d0f1['query'][_0x5267('0x3a')]){_0x27add5['include']=[{'all':!![]}];}_0x27add5=_['merge']({},_0x27add5,_0x36d0f1[_0x5267('0x41')]);return db['CmHopperFinal'][_0x5267('0x42')](_0x27add5)[_0x5267('0x22')](handleEntityNotFound(_0x3012cb,null))[_0x5267('0x22')](respondWithResult(_0x3012cb,null))[_0x5267('0x3d')](handleError(_0x3012cb,null));};exports['describe']=function(_0x12d6a8,_0x4ee826){return db['CmHopperFinal'][_0x5267('0x43')]()[_0x5267('0x22')](respondWithResult(_0x4ee826,null))['catch'](handleError(_0x4ee826,null));};exports['update']=function(_0x383ebe,_0xe0439e){if(_0x383ebe[_0x5267('0x44')][_0x5267('0x45')]){delete _0x383ebe[_0x5267('0x44')][_0x5267('0x45')];}return db[_0x5267('0x28')][_0x5267('0x42')]({'where':{'uniqueid':_0x383ebe[_0x5267('0x46')]['id']}})[_0x5267('0x22')](handleEntityNotFound(_0xe0439e,null))[_0x5267('0x22')](saveUpdates(_0x383ebe[_0x5267('0x44')],null))[_0x5267('0x22')](respondWithResult(_0xe0439e,null))[_0x5267('0x3d')](handleError(_0xe0439e,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x8636d0,_0x466d46,_0x371486){return db['CmHopperFinal'][_0x5267('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x8636d0[_0x5267('0x46')]['id']},'attributes':[[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x4a')))),'noSuchContacts'],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4c')))),_0x5267('0x4d')],[db['sequelize']['fn']('COUNT',db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x4e')))),'busyContacts'],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4f')))),_0x5267('0x50')],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x51')))),_0x5267('0x52')],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x53')))),'abandonedContacts'],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db['sequelize'][_0x5267('0x4b')](_0x5267('0x54')))),_0x5267('0x55')],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db['sequelize'][_0x5267('0x4b')](_0x5267('0x56')))),_0x5267('0x57')]]})[_0x5267('0x22')](handleEntityNotFound(_0x466d46,null))['then'](respondWithResult(_0x466d46,null))['catch'](handleError(_0x466d46,null));};exports[_0x5267('0x58')]=function(_0x5393e9,_0x3f5cda,_0x47059c){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x5393e9[_0x5267('0x46')]['id']},'attributes':[[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db['sequelize']['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4a')))),_0x5267('0x59')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4c')))),_0x5267('0x4d')],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x4e')))),_0x5267('0x5a')],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4f')))),_0x5267('0x50')],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x51')))),_0x5267('0x52')],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x53')))),_0x5267('0x5b')],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db['sequelize']['fn'](_0x5267('0x49'),db['sequelize']['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x56')))),_0x5267('0x57')]]})[_0x5267('0x22')](handleEntityNotFound(_0x3f5cda,null))[_0x5267('0x22')](respondWithResult(_0x3f5cda,null))[_0x5267('0x3d')](handleError(_0x3f5cda,null));};exports[_0x5267('0x5c')]=function(_0x21338f,_0x1103c5,_0x489b9a){return db['VoiceQueue']['find']({'where':{'id':_0x21338f[_0x5267('0x46')]['id']}})[_0x5267('0x22')](handleEntityNotFound(_0x1103c5,null))[_0x5267('0x22')](function(_0x457d84){var _0x4974d1;if(_0x457d84){_0x4974d1=squel[_0x5267('0x5d')]()[_0x5267('0x5e')](_0x5267('0x5f'))[_0x5267('0x60')](['phone',_0x5267('0x61'),_0x5267('0x62'),'ListId',_0x5267('0x63'),_0x5267('0x64'),'updatedAt'],squel['select']()[_0x5267('0x65')](_0x5267('0x66'),'phone')['field'](_0x5267('0x67'),_0x5267('0x61'))[_0x5267('0x65')](_0x5267('0x68'),_0x5267('0x62'))['field'](_0x5267('0x69'),_0x5267('0x6a'))['field'](_0x5267('0x6b'),_0x5267('0x63'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x64'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x6c'))['from']('cm_hopper_final')[_0x5267('0x34')](_0x5267('0x6d'),_0x21338f[_0x5267('0x46')]['id'][_0x5267('0x6e')]())['where'](_0x5267('0x6f'),_0x21338f['body'][_0x5267('0x70')][_0x5267('0x6e')]())[_0x5267('0x34')](_0x5267('0x71'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5267('0x72')]()[_0x5267('0x65')](_0x5267('0x73'))[_0x5267('0x74')](_0x5267('0x5f'))[_0x5267('0x34')]('VoiceQueueId\x20=\x20?',_0x21338f[_0x5267('0x46')]['id']['toString']()))[_0x5267('0x34')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5267('0x72')]()[_0x5267('0x65')](_0x5267('0x75'))[_0x5267('0x74')](_0x5267('0x76'))[_0x5267('0x34')](_0x5267('0x6d'),_0x21338f[_0x5267('0x46')]['id'][_0x5267('0x6e')]())[_0x5267('0x34')](_0x5267('0x77')))['group'](_0x5267('0x62')))[_0x5267('0x6e')]();return db['sequelize'][_0x5267('0x2c')](_0x4974d1);}return[];})[_0x5267('0x22')](respondWithResult(_0x1103c5,null))[_0x5267('0x3d')](handleError(_0x1103c5,null));};exports[_0x5267('0x78')]=function(_0xd18795,_0x37b007,_0x358543){return db['Campaign'][_0x5267('0x42')]({'where':{'id':_0xd18795[_0x5267('0x46')]['id']}})[_0x5267('0x22')](handleEntityNotFound(_0x37b007,null))[_0x5267('0x22')](function(_0x1cdf9f){var _0x4dbaa2;if(_0x1cdf9f){_0x4dbaa2=squel['insert']()[_0x5267('0x5e')](_0x5267('0x5f'))[_0x5267('0x60')]([_0x5267('0x73'),'scheduledAt',_0x5267('0x62'),_0x5267('0x6a'),_0x5267('0x79'),_0x5267('0x64'),_0x5267('0x6c')],squel[_0x5267('0x72')]()[_0x5267('0x65')](_0x5267('0x66'),_0x5267('0x73'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x61'))[_0x5267('0x65')]('ANY_VALUE(ContactId)',_0x5267('0x62'))[_0x5267('0x65')](_0x5267('0x69'),_0x5267('0x6a'))[_0x5267('0x65')](_0x5267('0x7a'),_0x5267('0x79'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x64'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x6c'))[_0x5267('0x74')](_0x5267('0x76'))[_0x5267('0x34')](_0x5267('0x7b'),_0xd18795[_0x5267('0x46')]['id'][_0x5267('0x6e')]())[_0x5267('0x34')](_0x5267('0x6f'),_0xd18795[_0x5267('0x44')][_0x5267('0x70')]['toString']())[_0x5267('0x34')](_0x5267('0x71'))[_0x5267('0x34')](_0x5267('0x7c'),squel[_0x5267('0x72')]()['field'](_0x5267('0x73'))[_0x5267('0x74')]('cm_hopper')['where']('CampaignId\x20=\x20?',_0xd18795[_0x5267('0x46')]['id']['toString']()))[_0x5267('0x34')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x5267('0x65')](_0x5267('0x75'))[_0x5267('0x74')](_0x5267('0x76'))[_0x5267('0x34')]('CampaignId\x20=\x20?',_0xd18795['params']['id'][_0x5267('0x6e')]())[_0x5267('0x34')](_0x5267('0x77')))[_0x5267('0x7d')](_0x5267('0x62')))['toString']();return db[_0x5267('0x48')]['query'](_0x4dbaa2);}return[];})['then'](respondWithResult(_0x37b007,null))[_0x5267('0x3d')](handleError(_0x37b007,null));};exports['checkContactHopper']=function(_0x5da8d6,_0x3ebe63,_0x321322){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x5da8d6['body'][_0x5267('0x63')],'CampaignId':_0x5da8d6['body'][_0x5267('0x79')],'ContactId':_0x5da8d6['body'][_0x5267('0x62')]}})[_0x5267('0x22')](handleEntityNotFound(_0x3ebe63,null))['then'](function(_0x1ae9fe){if(_0x1ae9fe){return _0x1ae9fe;}return null;})[_0x5267('0x22')](respondWithResult(_0x3ebe63,null))[_0x5267('0x3d')](handleError(_0x3ebe63,null));}; \ No newline at end of file +var _0xb016=['error','name','send','index','map','CmHopperFinal','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','body','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','calleridnum','state\x20=\x204','group','checkContactHopper','CmHopper','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','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','apply','reject','save','then','destroy','end'];(function(_0x5da6f9,_0x111700){var _0x103a21=function(_0x4b7139){while(--_0x4b7139){_0x5da6f9['push'](_0x5da6f9['shift']());}};_0x103a21(++_0x111700);}(_0xb016,0x159));var _0x6b01=function(_0xca6057,_0x5866d7){_0xca6057=_0xca6057-0x0;var _0x27a8e3=_0xb016[_0xca6057];return _0x27a8e3;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':!![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['describe']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['describe']()['then'](respondWithResult(_0x27442e,null))['catch'](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x12160f,_0x518d94){if(_0x12160f[_0x6b01('0x43')]['uniqueid']){delete _0x12160f['body']['uniqueid'];}return db[_0x6b01('0x29')][_0x6b01('0x44')]({'where':{'uniqueid':_0x12160f['params']['id']}})['then'](handleEntityNotFound(_0x518d94,null))[_0x6b01('0x21')](saveUpdates(_0x12160f['body'],null))[_0x6b01('0x21')](respondWithResult(_0x518d94,null))[_0x6b01('0x40')](handleError(_0x518d94,null));};exports[_0x6b01('0x45')]=function(_0x172a56,_0x13f6d7,_0x4d327f){return db[_0x6b01('0x29')][_0x6b01('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x172a56[_0x6b01('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')](_0x6b01('0x49')))),_0x6b01('0x4a')],[db[_0x6b01('0x47')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6b01('0x47')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x6b01('0x4b')],[db[_0x6b01('0x47')]['fn']('COUNT',db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')]['literal'](_0x6b01('0x4c')))),_0x6b01('0x4d')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')]('`state`\x20=\x208,\x201,\x20null'))),_0x6b01('0x4e')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db['sequelize']['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x4f')))),_0x6b01('0x50')],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6b01('0x51')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db['sequelize']['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x52')))),'reCallContacts'],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')](_0x6b01('0x53')))),_0x6b01('0x54')]]})[_0x6b01('0x21')](handleEntityNotFound(_0x13f6d7,null))[_0x6b01('0x21')](respondWithResult(_0x13f6d7,null))[_0x6b01('0x40')](handleError(_0x13f6d7,null));};exports[_0x6b01('0x55')]=function(_0x425d28,_0x132dda,_0x4c1345){return db[_0x6b01('0x29')][_0x6b01('0x3f')]({'raw':![],'where':{'CampaignId':_0x425d28[_0x6b01('0x41')]['id']},'attributes':[[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x49')))),'noSuchContacts'],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x56')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x4c')))),_0x6b01('0x4d')],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x57')))),_0x6b01('0x4e')],[db[_0x6b01('0x47')]['fn']('COUNT',db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')](_0x6b01('0x4f')))),_0x6b01('0x50')],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x58')))),_0x6b01('0x51')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x52')))),_0x6b01('0x59')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x53')))),'answeringMachine']]})[_0x6b01('0x21')](handleEntityNotFound(_0x132dda,null))[_0x6b01('0x21')](respondWithResult(_0x132dda,null))[_0x6b01('0x40')](handleError(_0x132dda,null));};exports[_0x6b01('0x5a')]=function(_0x1c419c,_0x250889,_0x40931a){return db[_0x6b01('0x5b')][_0x6b01('0x44')]({'where':{'id':_0x1c419c[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x250889,null))[_0x6b01('0x21')](function(_0x468a0b){var _0x30171f;if(_0x468a0b){_0x30171f=squel[_0x6b01('0x5c')]()['into'](_0x6b01('0x5d'))[_0x6b01('0x5e')]([_0x6b01('0x5f'),_0x6b01('0x60'),_0x6b01('0x61'),_0x6b01('0x62'),_0x6b01('0x63'),_0x6b01('0x64'),_0x6b01('0x65')],squel[_0x6b01('0x66')]()[_0x6b01('0x67')](_0x6b01('0x68'),_0x6b01('0x5f'))[_0x6b01('0x67')](_0x6b01('0x69'),_0x6b01('0x60'))[_0x6b01('0x67')](_0x6b01('0x6a'),_0x6b01('0x61'))[_0x6b01('0x67')]('ANY_VALUE(ListId)','ListId')['field']('ANY_VALUE(VoiceQueueId)',_0x6b01('0x63'))['field']('NOW()','createdAt')[_0x6b01('0x67')]('NOW()',_0x6b01('0x65'))[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x6d'),_0x1c419c['params']['id']['toString']())[_0x6b01('0x37')](_0x6b01('0x6e'),_0x1c419c[_0x6b01('0x43')]['state'][_0x6b01('0x6f')]())[_0x6b01('0x37')](_0x6b01('0x70'))[_0x6b01('0x37')](_0x6b01('0x71'),squel['select']()[_0x6b01('0x67')]('phone')[_0x6b01('0x6b')](_0x6b01('0x5d'))[_0x6b01('0x37')](_0x6b01('0x6d'),_0x1c419c[_0x6b01('0x41')]['id']['toString']()))[_0x6b01('0x37')](_0x6b01('0x71'),squel[_0x6b01('0x66')]()[_0x6b01('0x67')]('calleridnum')[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x6d'),_0x1c419c[_0x6b01('0x41')]['id'][_0x6b01('0x6f')]())['where']('state\x20=\x204'))['group'](_0x6b01('0x61')))[_0x6b01('0x6f')]();return db['sequelize'][_0x6b01('0x2c')](_0x30171f);}return[];})[_0x6b01('0x21')](respondWithResult(_0x250889,null))[_0x6b01('0x40')](handleError(_0x250889,null));};exports[_0x6b01('0x72')]=function(_0x536748,_0x18066a,_0x4ccc00){return db[_0x6b01('0x73')]['find']({'where':{'id':_0x536748[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x18066a,null))[_0x6b01('0x21')](function(_0x3bc182){var _0x410303;if(_0x3bc182){_0x410303=squel[_0x6b01('0x5c')]()[_0x6b01('0x74')](_0x6b01('0x5d'))[_0x6b01('0x5e')](['phone',_0x6b01('0x60'),'ContactId',_0x6b01('0x62'),_0x6b01('0x75'),_0x6b01('0x64'),_0x6b01('0x65')],squel[_0x6b01('0x66')]()[_0x6b01('0x67')](_0x6b01('0x68'),_0x6b01('0x5f'))[_0x6b01('0x67')](_0x6b01('0x69'),_0x6b01('0x60'))['field'](_0x6b01('0x6a'),_0x6b01('0x61'))[_0x6b01('0x67')](_0x6b01('0x76'),'ListId')[_0x6b01('0x67')](_0x6b01('0x77'),_0x6b01('0x75'))[_0x6b01('0x67')](_0x6b01('0x69'),'createdAt')[_0x6b01('0x67')]('NOW()',_0x6b01('0x65'))[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x78'),_0x536748[_0x6b01('0x41')]['id'][_0x6b01('0x6f')]())[_0x6b01('0x37')](_0x6b01('0x6e'),_0x536748[_0x6b01('0x43')][_0x6b01('0x79')][_0x6b01('0x6f')]())[_0x6b01('0x37')](_0x6b01('0x70'))['where'](_0x6b01('0x71'),squel['select']()['field'](_0x6b01('0x5f'))[_0x6b01('0x6b')](_0x6b01('0x5d'))[_0x6b01('0x37')]('CampaignId\x20=\x20?',_0x536748[_0x6b01('0x41')]['id'][_0x6b01('0x6f')]()))[_0x6b01('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6b01('0x66')]()[_0x6b01('0x67')](_0x6b01('0x7a'))[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x78'),_0x536748[_0x6b01('0x41')]['id']['toString']())[_0x6b01('0x37')](_0x6b01('0x7b')))[_0x6b01('0x7c')](_0x6b01('0x61')))['toString']();return db['sequelize'][_0x6b01('0x2c')](_0x410303);}return[];})[_0x6b01('0x21')](respondWithResult(_0x18066a,null))[_0x6b01('0x40')](handleError(_0x18066a,null));};exports[_0x6b01('0x7d')]=function(_0x6a33d7,_0x214f54,_0x1343af){return db[_0x6b01('0x7e')]['findOne']({'where':{'VoiceQueueId':_0x6a33d7[_0x6b01('0x43')][_0x6b01('0x63')],'CampaignId':_0x6a33d7[_0x6b01('0x43')][_0x6b01('0x75')],'ContactId':_0x6a33d7[_0x6b01('0x43')][_0x6b01('0x61')]}})[_0x6b01('0x21')](handleEntityNotFound(_0x214f54,null))['then'](function(_0x5140ba){if(_0x5140ba){return _0x5140ba;}return null;})['then'](respondWithResult(_0x214f54,null))[_0x6b01('0x40')](handleError(_0x214f54,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index bae9574..6839ae6 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 _0xc182=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','api','moment'];(function(_0xee2b30,_0x3c6ed0){var _0x5eadab=function(_0x523771){while(--_0x523771){_0xee2b30['push'](_0xee2b30['shift']());}};_0x5eadab(++_0x3c6ed0);}(_0xc182,0x191));var _0x2c18=function(_0x491323,_0x510520){_0x491323=_0x491323-0x0;var _0x6d5ad2=_0xc182[_0x491323];return _0x6d5ad2;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2c18('0x0'));var moment=require(_0x2c18('0x1'));var BPromise=require(_0x2c18('0x2'));var rp=require(_0x2c18('0x3'));var fs=require('fs');var path=require(_0x2c18('0x4'));var rimraf=require(_0x2c18('0x5'));var config=require(_0x2c18('0x6'));var attributes=require(_0x2c18('0x7'));module[_0x2c18('0x8')]=function(_0xa9f2a2,_0xa0885c){return _0xa9f2a2[_0x2c18('0x9')]('CmHopperFinal',attributes,{'tableName':_0x2c18('0xa'),'paranoid':![],'indexes':[{'name':_0x2c18('0xb'),'fields':[_0x2c18('0xb')]},{'name':_0x2c18('0xc'),'fields':[_0x2c18('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5751=['../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x5a18c3,_0x5c6928){var _0x3e22e7=function(_0x1cc5a5){while(--_0x1cc5a5){_0x5a18c3['push'](_0x5a18c3['shift']());}};_0x3e22e7(++_0x5c6928);}(_0x5751,0x192));var _0x1575=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x5751[_0x556bb1];return _0x45455f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1575('0x0'))(_0x1575('0x1'));var moment=require('moment');var BPromise=require(_0x1575('0x2'));var rp=require(_0x1575('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1575('0x4'));var config=require(_0x1575('0x5'));var attributes=require(_0x1575('0x6'));module[_0x1575('0x7')]=function(_0xfeccc2,_0x474752){return _0xfeccc2[_0x1575('0x8')]('CmHopperFinal',attributes,{'tableName':_0x1575('0x9'),'paranoid':![],'indexes':[{'name':_0x1575('0xa'),'fields':[_0x1575('0xa')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 650b4c7..15f31a6 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x335a5c,_0x539048){var _0x6a45f9=function(_0x67d12c){while(--_0x67d12c){_0x335a5c['push'](_0x335a5c['shift']());}};_0x6a45f9(++_0x539048);}(_0xb10b,0x12a));var _0xbb10=function(_0x37affd,_0x53e54d){_0x37affd=_0x37affd-0x0;var _0x5c385a=_0xb10b[_0x37affd];return _0x5c385a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x45cf0b,_0x3cb841){var _0x2963e2=function(_0x4e5cca){while(--_0x4e5cca){_0x45cf0b['push'](_0x45cf0b['shift']());}};_0x2963e2(++_0x3cb841);}(_0x7a54,0x106));var _0x47a5=function(_0x517623,_0x4a5441){_0x517623=_0x517623-0x0;var _0x59737f=_0x7a54[_0x517623];return _0x59737f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index f980735..7b98e1c 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 _0x3a29=['/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x49794d,_0x59b0c5){var _0x580277=function(_0x995b8c){while(--_0x995b8c){_0x49794d['push'](_0x49794d['shift']());}};_0x580277(++_0x59b0c5);}(_0x3a29,0x199));var _0x93a2=function(_0x51d6db,_0x19d9af){_0x51d6db=_0x51d6db-0x0;var _0x39f768=_0x3a29[_0x51d6db];return _0x39f768;};'use strict';var multer=require(_0x93a2('0x0'));var util=require(_0x93a2('0x1'));var path=require(_0x93a2('0x2'));var timeout=require(_0x93a2('0x3'));var express=require('express');var router=express[_0x93a2('0x4')]();var fs_extra=require(_0x93a2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x93a2('0x6'));var config=require(_0x93a2('0x7'));var controller=require(_0x93a2('0x8'));router[_0x93a2('0x9')]('/',auth[_0x93a2('0xa')](),controller[_0x93a2('0xb')]);router[_0x93a2('0x9')](_0x93a2('0xc'),auth[_0x93a2('0xa')](),controller[_0x93a2('0xd')]);router[_0x93a2('0x9')](_0x93a2('0xe'),auth[_0x93a2('0xa')](),controller[_0x93a2('0xf')]);router[_0x93a2('0x9')](_0x93a2('0x10'),auth['isAuthenticated'](),controller[_0x93a2('0x11')]);router[_0x93a2('0x9')]('/campaign/countAttributes/:id',auth[_0x93a2('0xa')](),controller[_0x93a2('0x12')]);router['post'](_0x93a2('0x13'),auth[_0x93a2('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x93a2('0x14')](_0x93a2('0x15'),auth[_0x93a2('0xa')](),controller[_0x93a2('0x16')]);router[_0x93a2('0x14')]('/checkContactHopper',auth['isAuthenticated'](),controller[_0x93a2('0x17')]);router[_0x93a2('0x18')]('/:id',auth[_0x93a2('0xa')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x382a=['/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','/describe','isAuthenticated','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x382a,0x91));var _0xa382=function(_0x176865,_0x465e53){_0x176865=_0x176865-0x0;var _0x2bc1e1=_0x382a[_0x176865];return _0x2bc1e1;};'use strict';var multer=require(_0xa382('0x0'));var util=require(_0xa382('0x1'));var path=require(_0xa382('0x2'));var timeout=require(_0xa382('0x3'));var express=require(_0xa382('0x4'));var router=express['Router']();var fs_extra=require(_0xa382('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa382('0x6'));var config=require(_0xa382('0x7'));var controller=require(_0xa382('0x8'));router[_0xa382('0x9')]('/',auth['isAuthenticated'](),controller[_0xa382('0xa')]);router['get'](_0xa382('0xb'),auth[_0xa382('0xc')](),controller['describe']);router[_0xa382('0x9')](_0xa382('0xd'),auth[_0xa382('0xc')](),controller[_0xa382('0xe')]);router['get'](_0xa382('0xf'),auth['isAuthenticated'](),controller[_0xa382('0x10')]);router[_0xa382('0x9')](_0xa382('0x11'),auth[_0xa382('0xc')](),controller[_0xa382('0x12')]);router[_0xa382('0x13')](_0xa382('0x14'),auth['isAuthenticated'](),controller[_0xa382('0x15')]);router[_0xa382('0x13')](_0xa382('0x16'),auth[_0xa382('0xc')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xa382('0x13')]('/checkContactHopper',auth['isAuthenticated'](),controller[_0xa382('0x17')]);router[_0xa382('0x18')](_0xa382('0xd'),auth[_0xa382('0xc')](),controller[_0xa382('0x19')]);module[_0xa382('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 2599492..1001994 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 _0x13aa=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x159b4c,_0x4361b9){var _0x2ac1c3=function(_0x42d411){while(--_0x42d411){_0x159b4c['push'](_0x159b4c['shift']());}};_0x2ac1c3(++_0x4361b9);}(_0x13aa,0x1f0));var _0xa13a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x13aa[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xa13a('0x0'));module[_0xa13a('0x1')]={'state':{'type':Sequelize[_0xa13a('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa13a('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa13a('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa13a('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xa13a('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa13a('0x3')]},'calleridname':{'type':Sequelize[_0xa13a('0x3')]},'starttime':{'type':Sequelize[_0xa13a('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xa13a('0x4')]},'endtime':{'type':Sequelize[_0xa13a('0x4')]},'ringtime':{'type':Sequelize[_0xa13a('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa13a('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa13a('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xa13a('0x3')]},'membername':{'type':Sequelize[_0xa13a('0x3')]},'reason':{'type':Sequelize[_0xa13a('0x3')]},'amd':{'type':Sequelize[_0xa13a('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xa13a('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xa13a('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa13a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa13a('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xa13a('0x4')]},'edited':{'type':Sequelize[_0xa13a('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xa13a('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa13a('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa13a('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa13a('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc58f=['exports','INTEGER','DATE','STRING','BOOLEAN','sequelize'];(function(_0x3c4047,_0x26c881){var _0xea78a2=function(_0x4f1147){while(--_0x4f1147){_0x3c4047['push'](_0x3c4047['shift']());}};_0xea78a2(++_0x26c881);}(_0xc58f,0xad));var _0xfc58=function(_0x13e8ac,_0x25c0c0){_0x13e8ac=_0x13e8ac-0x0;var _0xc77ea6=_0xc58f[_0x13e8ac];return _0xc77ea6;};'use strict';var Sequelize=require(_0xfc58('0x0'));module[_0xfc58('0x1')]={'state':{'type':Sequelize[_0xfc58('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xfc58('0x3')]},'countbusyretry':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xfc58('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xfc58('0x4')]},'originatecalleridname':{'type':Sequelize[_0xfc58('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xfc58('0x4')]},'starttime':{'type':Sequelize[_0xfc58('0x3')]},'responsetime':{'type':Sequelize[_0xfc58('0x3')]},'answertime':{'type':Sequelize[_0xfc58('0x3')]},'droptime':{'type':Sequelize[_0xfc58('0x3')]},'endtime':{'type':Sequelize[_0xfc58('0x3')]},'ringtime':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xfc58('0x4')]},'campaign':{'type':Sequelize[_0xfc58('0x4')]},'campaigntype':{'type':Sequelize[_0xfc58('0x4')]},'membername':{'type':Sequelize[_0xfc58('0x4')]},'reason':{'type':Sequelize[_0xfc58('0x4')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xfc58('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfc58('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfc58('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xfc58('0x3')]},'edited':{'type':Sequelize[_0xfc58('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfc58('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xfc58('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index c8f6524..65bae71 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 _0xc2bf=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','stack','name','index','CmHopperHistory','fieldName','type','model','query','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filters','merge','where','map','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','length','find','create','body','describe','uniqueid'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xc2bf,0x1c2));var _0xfc2b=function(_0x129d05,_0x517503){_0x129d05=_0x129d05-0x0;var _0x22ce6b=_0xc2bf[_0x129d05];return _0x22ce6b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfc2b('0x0'));var zipdir=require(_0xfc2b('0x1'));var jsonpatch=require(_0xfc2b('0x2'));var rp=require(_0xfc2b('0x3'));var moment=require(_0xfc2b('0x4'));var BPromise=require(_0xfc2b('0x5'));var Mustache=require(_0xfc2b('0x6'));var util=require(_0xfc2b('0x7'));var path=require(_0xfc2b('0x8'));var sox=require(_0xfc2b('0x9'));var csv=require('to-csv');var ejs=require(_0xfc2b('0xa'));var fs=require('fs');var fs_extra=require(_0xfc2b('0xb'));var _=require(_0xfc2b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfc2b('0xd'));var deskjs=require(_0xfc2b('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfc2b('0xf'));var Papa=require(_0xfc2b('0x10'));var Redis=require(_0xfc2b('0x11'));var authService=require(_0xfc2b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfc2b('0x13'));var hardwareService=require(_0xfc2b('0x14'));var logger=require(_0xfc2b('0x15'))(_0xfc2b('0x16'));var utils=require(_0xfc2b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfc2b('0x18'));var db=require(_0xfc2b('0x19'))['db'];function respondWithStatusCode(_0x57818b,_0x18f2f2){_0x18f2f2=_0x18f2f2||0xcc;return function(_0x26849d){if(_0x26849d){return _0x57818b[_0xfc2b('0x1a')](_0x18f2f2);}return _0x57818b[_0xfc2b('0x1b')](_0x18f2f2)[_0xfc2b('0x1c')]();};}function respondWithResult(_0xbe84cf,_0x3bdaec){_0x3bdaec=_0x3bdaec||0xc8;return function(_0x395aab){if(_0x395aab){return _0xbe84cf[_0xfc2b('0x1b')](_0x3bdaec)[_0xfc2b('0x1d')](_0x395aab);}};}function respondWithFilteredResult(_0xf4545c,_0xfc8259){return function(_0x3941d5){if(_0x3941d5){var _0x409ab4=typeof _0xfc8259[_0xfc2b('0x1e')]==='undefined'&&typeof _0xfc8259[_0xfc2b('0x1f')]===_0xfc2b('0x20');var _0x262f18=_0x3941d5['count'];var _0x51ba73=_0x409ab4?0x0:_0xfc8259[_0xfc2b('0x1e')];var _0x1eee35=_0x409ab4?_0x3941d5[_0xfc2b('0x21')]:_0xfc8259['offset']+_0xfc8259[_0xfc2b('0x1f')];var _0x594c7e;if(_0x1eee35>=_0x262f18){_0x1eee35=_0x262f18;_0x594c7e=0xc8;}else{_0x594c7e=0xce;}_0xf4545c[_0xfc2b('0x1b')](_0x594c7e);return _0xf4545c[_0xfc2b('0x22')]('Content-Range',_0x51ba73+'-'+_0x1eee35+'/'+_0x262f18)['json'](_0x3941d5);}return null;};}function patchUpdates(_0x11533c){return function(_0x25e2d8){try{jsonpatch[_0xfc2b('0x23')](_0x25e2d8,_0x11533c,!![]);}catch(_0x3cf99d){return BPromise[_0xfc2b('0x24')](_0x3cf99d);}return _0x25e2d8[_0xfc2b('0x25')]();};}function saveUpdates(_0x1001d9,_0x39b192){return function(_0x358b1d){if(_0x358b1d){return _0x358b1d[_0xfc2b('0x26')](_0x1001d9)[_0xfc2b('0x27')](function(_0x1e8f1d){return _0x1e8f1d;});}return null;};}function removeEntity(_0x1d694a,_0xc47fa){return function(_0x3664ec){if(_0x3664ec){return _0x3664ec[_0xfc2b('0x28')]()['then'](function(){_0x1d694a['status'](0xcc)[_0xfc2b('0x1c')]();});}};}function handleEntityNotFound(_0x3bf30,_0x11b9d3){return function(_0x144a26){if(!_0x144a26){_0x3bf30[_0xfc2b('0x1a')](0x194);}return _0x144a26;};}function handleError(_0x1f5208,_0x5e579e){_0x5e579e=_0x5e579e||0x1f4;return function(_0x40695a){logger['error'](_0x40695a[_0xfc2b('0x29')]);if(_0x40695a[_0xfc2b('0x2a')]){delete _0x40695a[_0xfc2b('0x2a')];}_0x1f5208[_0xfc2b('0x1b')](_0x5e579e)['send'](_0x40695a);};}exports[_0xfc2b('0x2b')]=function(_0x4b0418,_0x596f48){var _0x5b130c={},_0x39e314={},_0x893ae7={'count':0x0,'rows':[]};var _0xa7d318=_['map'](db[_0xfc2b('0x2c')]['rawAttributes'],function(_0x3d015a){return{'name':_0x3d015a[_0xfc2b('0x2d')],'type':_0x3d015a[_0xfc2b('0x2e')]['key']};});_0x39e314[_0xfc2b('0x2f')]=_['map'](_0xa7d318,_0xfc2b('0x2a'));_0x39e314['query']=_['keys'](_0x4b0418[_0xfc2b('0x30')]);_0x39e314['filters']=_[_0xfc2b('0x31')](_0x39e314[_0xfc2b('0x2f')],_0x39e314[_0xfc2b('0x30')]);_0x5b130c['attributes']=_[_0xfc2b('0x31')](_0x39e314['model'],qs[_0xfc2b('0x32')](_0x4b0418[_0xfc2b('0x30')][_0xfc2b('0x32')]));_0x5b130c[_0xfc2b('0x33')]=_0x5b130c['attributes']['length']?_0x5b130c[_0xfc2b('0x33')]:_0x39e314['model'];if(!_0x4b0418[_0xfc2b('0x30')][_0xfc2b('0x34')]('nolimit')){_0x5b130c['limit']=qs[_0xfc2b('0x1f')](_0x4b0418[_0xfc2b('0x30')]['limit']);_0x5b130c[_0xfc2b('0x1e')]=qs[_0xfc2b('0x1e')](_0x4b0418[_0xfc2b('0x30')]['offset']);}_0x5b130c[_0xfc2b('0x35')]=qs[_0xfc2b('0x36')](_0x4b0418[_0xfc2b('0x30')][_0xfc2b('0x36')]);_0x5b130c['where']=qs['filters'](_[_0xfc2b('0x37')](_0x4b0418[_0xfc2b('0x30')],_0x39e314[_0xfc2b('0x38')]),_0xa7d318);if(_0x4b0418[_0xfc2b('0x30')]['filter']){_0x5b130c['where']=_[_0xfc2b('0x39')](_0x5b130c[_0xfc2b('0x3a')],{'$or':_[_0xfc2b('0x3b')](_0xa7d318,function(_0xd2e4f7){if(_0xd2e4f7[_0xfc2b('0x2e')]!==_0xfc2b('0x3c')){var _0x404fd6={};_0x404fd6[_0xd2e4f7[_0xfc2b('0x2a')]]={'$like':'%'+_0x4b0418['query']['filter']+'%'};return _0x404fd6;}})});}_0x5b130c=_[_0xfc2b('0x39')]({},_0x5b130c,_0x4b0418[_0xfc2b('0x3d')]);var _0x18b6e6={'where':_0x5b130c['where']};return db[_0xfc2b('0x2c')][_0xfc2b('0x21')](_0x18b6e6)[_0xfc2b('0x27')](function(_0x50f64a){_0x893ae7[_0xfc2b('0x21')]=_0x50f64a;if(_0x4b0418[_0xfc2b('0x30')][_0xfc2b('0x3e')]){_0x5b130c[_0xfc2b('0x3f')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x5b130c);})[_0xfc2b('0x27')](function(_0x37de93){_0x893ae7[_0xfc2b('0x40')]=_0x37de93;return _0x893ae7;})[_0xfc2b('0x27')](respondWithFilteredResult(_0x596f48,_0x5b130c))[_0xfc2b('0x41')](handleError(_0x596f48,null));};exports[_0xfc2b('0x42')]=function(_0x40f480,_0x5ebb0f){var _0x428d03={'raw':!![],'where':{'id':_0x40f480[_0xfc2b('0x43')]['id']}},_0x54bec8={};_0x54bec8[_0xfc2b('0x2f')]=_[_0xfc2b('0x44')](db[_0xfc2b('0x2c')]['rawAttributes']);_0x54bec8[_0xfc2b('0x30')]=_[_0xfc2b('0x44')](_0x40f480[_0xfc2b('0x30')]);_0x54bec8[_0xfc2b('0x38')]=_[_0xfc2b('0x31')](_0x54bec8[_0xfc2b('0x2f')],_0x54bec8[_0xfc2b('0x30')]);_0x428d03[_0xfc2b('0x33')]=_[_0xfc2b('0x31')](_0x54bec8[_0xfc2b('0x2f')],qs[_0xfc2b('0x32')](_0x40f480[_0xfc2b('0x30')][_0xfc2b('0x32')]));_0x428d03[_0xfc2b('0x33')]=_0x428d03['attributes'][_0xfc2b('0x45')]?_0x428d03[_0xfc2b('0x33')]:_0x54bec8[_0xfc2b('0x2f')];if(_0x40f480['query'][_0xfc2b('0x3e')]){_0x428d03[_0xfc2b('0x3f')]=[{'all':!![]}];}_0x428d03=_[_0xfc2b('0x39')]({},_0x428d03,_0x40f480['options']);return db['CmHopperHistory'][_0xfc2b('0x46')](_0x428d03)[_0xfc2b('0x27')](handleEntityNotFound(_0x5ebb0f,null))[_0xfc2b('0x27')](respondWithResult(_0x5ebb0f,null))['catch'](handleError(_0x5ebb0f,null));};exports[_0xfc2b('0x47')]=function(_0x4b6b59,_0x1efea0){return db[_0xfc2b('0x2c')][_0xfc2b('0x47')](_0x4b6b59[_0xfc2b('0x48')],{})[_0xfc2b('0x27')](respondWithResult(_0x1efea0,0xc9))['catch'](handleError(_0x1efea0,null));};exports[_0xfc2b('0x49')]=function(_0x10be24,_0x26851d){return db[_0xfc2b('0x2c')][_0xfc2b('0x49')]()[_0xfc2b('0x27')](respondWithResult(_0x26851d,null))[_0xfc2b('0x41')](handleError(_0x26851d,null));};exports[_0xfc2b('0x26')]=function(_0x3c0f59,_0x1eb7e5){if(_0x3c0f59['body'][_0xfc2b('0x4a')]){delete _0x3c0f59[_0xfc2b('0x48')][_0xfc2b('0x4a')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x3c0f59[_0xfc2b('0x43')]['id']}})[_0xfc2b('0x27')](handleEntityNotFound(_0x1eb7e5,null))['then'](saveUpdates(_0x3c0f59['body'],null))['then'](respondWithResult(_0x1eb7e5,null))[_0xfc2b('0x41')](handleError(_0x1eb7e5,null));}; \ No newline at end of file +var _0x5c6d=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','map','CmHopperHistory','fieldName','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','catch','params','keys','rawAttributes','length','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','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/logger'];(function(_0x5260a1,_0x4b672f){var _0x1c2b9a=function(_0x5c8636){while(--_0x5c8636){_0x5260a1['push'](_0x5260a1['shift']());}};_0x1c2b9a(++_0x4b672f);}(_0x5c6d,0xc5));var _0xd5c6=function(_0x38123d,_0x567dab){_0x38123d=_0x38123d-0x0;var _0x2e27a3=_0x5c6d[_0x38123d];return _0x2e27a3;};'use strict';var emlformat=require(_0xd5c6('0x0'));var rimraf=require(_0xd5c6('0x1'));var zipdir=require(_0xd5c6('0x2'));var jsonpatch=require(_0xd5c6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd5c6('0x4'));var Mustache=require(_0xd5c6('0x5'));var util=require('util');var path=require(_0xd5c6('0x6'));var sox=require(_0xd5c6('0x7'));var csv=require(_0xd5c6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd5c6('0x9'));var _=require(_0xd5c6('0xa'));var squel=require(_0xd5c6('0xb'));var crypto=require(_0xd5c6('0xc'));var jsforce=require(_0xd5c6('0xd'));var deskjs=require(_0xd5c6('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd5c6('0xf'));var Papa=require(_0xd5c6('0x10'));var Redis=require(_0xd5c6('0x11'));var authService=require(_0xd5c6('0x12'));var qs=require(_0xd5c6('0x13'));var as=require(_0xd5c6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5c6('0x15'))(_0xd5c6('0x16'));var utils=require(_0xd5c6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd5c6('0x18'));var db=require(_0xd5c6('0x19'))['db'];function respondWithStatusCode(_0x3d8721,_0x5a954d){_0x5a954d=_0x5a954d||0xcc;return function(_0x2396e2){if(_0x2396e2){return _0x3d8721[_0xd5c6('0x1a')](_0x5a954d);}return _0x3d8721['status'](_0x5a954d)['end']();};}function respondWithResult(_0x385b45,_0x1b5602){_0x1b5602=_0x1b5602||0xc8;return function(_0x2574fa){if(_0x2574fa){return _0x385b45[_0xd5c6('0x1b')](_0x1b5602)[_0xd5c6('0x1c')](_0x2574fa);}};}function respondWithFilteredResult(_0x5fa5bd,_0x5af712){return function(_0x2ca933){if(_0x2ca933){var _0x1e9b7a=typeof _0x5af712['offset']===_0xd5c6('0x1d')&&typeof _0x5af712[_0xd5c6('0x1e')]===_0xd5c6('0x1d');var _0xd72cc9=_0x2ca933[_0xd5c6('0x1f')];var _0x1827d2=_0x1e9b7a?0x0:_0x5af712[_0xd5c6('0x20')];var _0x595943=_0x1e9b7a?_0x2ca933[_0xd5c6('0x1f')]:_0x5af712['offset']+_0x5af712[_0xd5c6('0x1e')];var _0x1a21a2;if(_0x595943>=_0xd72cc9){_0x595943=_0xd72cc9;_0x1a21a2=0xc8;}else{_0x1a21a2=0xce;}_0x5fa5bd[_0xd5c6('0x1b')](_0x1a21a2);return _0x5fa5bd[_0xd5c6('0x21')](_0xd5c6('0x22'),_0x1827d2+'-'+_0x595943+'/'+_0xd72cc9)['json'](_0x2ca933);}return null;};}function patchUpdates(_0x475da8){return function(_0x5a5e85){try{jsonpatch['apply'](_0x5a5e85,_0x475da8,!![]);}catch(_0x5b90d0){return BPromise[_0xd5c6('0x23')](_0x5b90d0);}return _0x5a5e85[_0xd5c6('0x24')]();};}function saveUpdates(_0x1fc79f,_0x2751d0){return function(_0x19dfa2){if(_0x19dfa2){return _0x19dfa2[_0xd5c6('0x25')](_0x1fc79f)[_0xd5c6('0x26')](function(_0x491749){return _0x491749;});}return null;};}function removeEntity(_0x662772,_0x29c8c7){return function(_0x13687e){if(_0x13687e){return _0x13687e[_0xd5c6('0x27')]()[_0xd5c6('0x26')](function(){_0x662772[_0xd5c6('0x1b')](0xcc)[_0xd5c6('0x28')]();});}};}function handleEntityNotFound(_0x27291a,_0x2e88dd){return function(_0x1ec950){if(!_0x1ec950){_0x27291a[_0xd5c6('0x1a')](0x194);}return _0x1ec950;};}function handleError(_0x4784e9,_0x3cb0a7){_0x3cb0a7=_0x3cb0a7||0x1f4;return function(_0x17833e){logger[_0xd5c6('0x29')](_0x17833e['stack']);if(_0x17833e[_0xd5c6('0x2a')]){delete _0x17833e[_0xd5c6('0x2a')];}_0x4784e9[_0xd5c6('0x1b')](_0x3cb0a7)[_0xd5c6('0x2b')](_0x17833e);};}exports['index']=function(_0x4f88c7,_0x13f1a0){var _0x344c47={},_0x392d94={},_0x484081={'count':0x0,'rows':[]};var _0x2f8683=_[_0xd5c6('0x2c')](db[_0xd5c6('0x2d')]['rawAttributes'],function(_0x1a30a9){return{'name':_0x1a30a9[_0xd5c6('0x2e')],'type':_0x1a30a9[_0xd5c6('0x2f')]['key']};});_0x392d94[_0xd5c6('0x30')]=_[_0xd5c6('0x2c')](_0x2f8683,_0xd5c6('0x2a'));_0x392d94[_0xd5c6('0x31')]=_['keys'](_0x4f88c7[_0xd5c6('0x31')]);_0x392d94['filters']=_[_0xd5c6('0x32')](_0x392d94[_0xd5c6('0x30')],_0x392d94[_0xd5c6('0x31')]);_0x344c47[_0xd5c6('0x33')]=_[_0xd5c6('0x32')](_0x392d94[_0xd5c6('0x30')],qs['fields'](_0x4f88c7[_0xd5c6('0x31')][_0xd5c6('0x34')]));_0x344c47[_0xd5c6('0x33')]=_0x344c47[_0xd5c6('0x33')]['length']?_0x344c47[_0xd5c6('0x33')]:_0x392d94[_0xd5c6('0x30')];if(!_0x4f88c7[_0xd5c6('0x31')][_0xd5c6('0x35')](_0xd5c6('0x36'))){_0x344c47[_0xd5c6('0x1e')]=qs[_0xd5c6('0x1e')](_0x4f88c7[_0xd5c6('0x31')]['limit']);_0x344c47[_0xd5c6('0x20')]=qs[_0xd5c6('0x20')](_0x4f88c7[_0xd5c6('0x31')][_0xd5c6('0x20')]);}_0x344c47[_0xd5c6('0x37')]=qs[_0xd5c6('0x38')](_0x4f88c7[_0xd5c6('0x31')][_0xd5c6('0x38')]);_0x344c47[_0xd5c6('0x39')]=qs['filters'](_[_0xd5c6('0x3a')](_0x4f88c7[_0xd5c6('0x31')],_0x392d94['filters']),_0x2f8683);if(_0x4f88c7[_0xd5c6('0x31')][_0xd5c6('0x3b')]){_0x344c47[_0xd5c6('0x39')]=_['merge'](_0x344c47[_0xd5c6('0x39')],{'$or':_['map'](_0x2f8683,function(_0x6141d8){if(_0x6141d8['type']!=='VIRTUAL'){var _0x2bdb49={};_0x2bdb49[_0x6141d8[_0xd5c6('0x2a')]]={'$like':'%'+_0x4f88c7[_0xd5c6('0x31')][_0xd5c6('0x3b')]+'%'};return _0x2bdb49;}})});}_0x344c47=_[_0xd5c6('0x3c')]({},_0x344c47,_0x4f88c7[_0xd5c6('0x3d')]);var _0x40aa5e={'where':_0x344c47[_0xd5c6('0x39')]};return db[_0xd5c6('0x2d')][_0xd5c6('0x1f')](_0x40aa5e)['then'](function(_0x87eac0){_0x484081[_0xd5c6('0x1f')]=_0x87eac0;if(_0x4f88c7[_0xd5c6('0x31')]['includeAll']){_0x344c47[_0xd5c6('0x3e')]=[{'all':!![]}];}return db[_0xd5c6('0x2d')]['findAll'](_0x344c47);})[_0xd5c6('0x26')](function(_0x46e755){_0x484081['rows']=_0x46e755;return _0x484081;})['then'](respondWithFilteredResult(_0x13f1a0,_0x344c47))[_0xd5c6('0x3f')](handleError(_0x13f1a0,null));};exports['show']=function(_0x928dc0,_0x5d165e){var _0x44cc2d={'raw':!![],'where':{'id':_0x928dc0[_0xd5c6('0x40')]['id']}},_0x7fee2={};_0x7fee2[_0xd5c6('0x30')]=_[_0xd5c6('0x41')](db[_0xd5c6('0x2d')][_0xd5c6('0x42')]);_0x7fee2['query']=_[_0xd5c6('0x41')](_0x928dc0[_0xd5c6('0x31')]);_0x7fee2['filters']=_[_0xd5c6('0x32')](_0x7fee2['model'],_0x7fee2[_0xd5c6('0x31')]);_0x44cc2d[_0xd5c6('0x33')]=_[_0xd5c6('0x32')](_0x7fee2['model'],qs[_0xd5c6('0x34')](_0x928dc0['query'][_0xd5c6('0x34')]));_0x44cc2d['attributes']=_0x44cc2d[_0xd5c6('0x33')][_0xd5c6('0x43')]?_0x44cc2d[_0xd5c6('0x33')]:_0x7fee2[_0xd5c6('0x30')];if(_0x928dc0[_0xd5c6('0x31')]['includeAll']){_0x44cc2d[_0xd5c6('0x3e')]=[{'all':!![]}];}_0x44cc2d=_[_0xd5c6('0x3c')]({},_0x44cc2d,_0x928dc0['options']);return db['CmHopperHistory'][_0xd5c6('0x44')](_0x44cc2d)[_0xd5c6('0x26')](handleEntityNotFound(_0x5d165e,null))[_0xd5c6('0x26')](respondWithResult(_0x5d165e,null))[_0xd5c6('0x3f')](handleError(_0x5d165e,null));};exports[_0xd5c6('0x45')]=function(_0x45e560,_0xbc1c11){return db['CmHopperHistory'][_0xd5c6('0x45')](_0x45e560[_0xd5c6('0x46')],{})[_0xd5c6('0x26')](respondWithResult(_0xbc1c11,0xc9))[_0xd5c6('0x3f')](handleError(_0xbc1c11,null));};exports[_0xd5c6('0x47')]=function(_0x2a4ac1,_0x297268){return db['CmHopperHistory'][_0xd5c6('0x47')]()[_0xd5c6('0x26')](respondWithResult(_0x297268,null))[_0xd5c6('0x3f')](handleError(_0x297268,null));};exports[_0xd5c6('0x25')]=function(_0x2952fd,_0x549d02){if(_0x2952fd['body'][_0xd5c6('0x48')]){delete _0x2952fd[_0xd5c6('0x46')][_0xd5c6('0x48')];}return db[_0xd5c6('0x2d')][_0xd5c6('0x44')]({'where':{'uniqueid':_0x2952fd[_0xd5c6('0x40')]['id']}})['then'](handleEntityNotFound(_0x549d02,null))[_0xd5c6('0x26')](saveUpdates(_0x2952fd[_0xd5c6('0x46')],null))[_0xd5c6('0x26')](respondWithResult(_0x549d02,null))[_0xd5c6('0x3f')](handleError(_0x549d02,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 96b4a32..5ec7731 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 _0x751c=['uniqueid','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime'];(function(_0x4a3a5b,_0x1e50e5){var _0xf3e3f1=function(_0x2effe7){while(--_0x2effe7){_0x4a3a5b['push'](_0x4a3a5b['shift']());}};_0xf3e3f1(++_0x1e50e5);}(_0x751c,0x69));var _0xc751=function(_0x58ef86,_0xb4c1d5){_0x58ef86=_0x58ef86-0x0;var _0x5e84c2=_0x751c[_0x58ef86];return _0x5e84c2;};'use strict';var _=require(_0xc751('0x0'));var util=require(_0xc751('0x1'));var logger=require(_0xc751('0x2'))('api');var moment=require(_0xc751('0x3'));var BPromise=require('bluebird');var rp=require(_0xc751('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc751('0x5'));var config=require(_0xc751('0x6'));var attributes=require(_0xc751('0x7'));module[_0xc751('0x8')]=function(_0x3b8c5a,_0x562b89){return _0x3b8c5a[_0xc751('0x9')](_0xc751('0xa'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xc751('0xb'),'fields':[_0xc751('0xb')]},{'name':'uniqueid','fields':[_0xc751('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c9b=['bluebird','path','rimraf','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','../../config/logger','api','moment'];(function(_0x253d1c,_0x30be97){var _0x16b3c2=function(_0x1ec045){while(--_0x1ec045){_0x253d1c['push'](_0x253d1c['shift']());}};_0x16b3c2(++_0x30be97);}(_0x9c9b,0x194));var _0xb9c9=function(_0x33db67,_0x1e0188){_0x33db67=_0x33db67-0x0;var _0x3e6842=_0x9c9b[_0x33db67];return _0x3e6842;};'use strict';var _=require('lodash');var util=require(_0xb9c9('0x0'));var logger=require(_0xb9c9('0x1'))(_0xb9c9('0x2'));var moment=require(_0xb9c9('0x3'));var BPromise=require(_0xb9c9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9c9('0x5'));var rimraf=require(_0xb9c9('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0xfe4cb4,_0x26bf07){return _0xfe4cb4[_0xb9c9('0x7')](_0xb9c9('0x8'),attributes,{'tableName':_0xb9c9('0x9'),'paranoid':![],'indexes':[{'name':_0xb9c9('0xa'),'fields':[_0xb9c9('0xa')]},{'name':_0xb9c9('0xb'),'fields':[_0xb9c9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index c330b8e..c28cd7d 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 _0xd0be=['catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','AvgHandleTime','findAll','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','col','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result'];(function(_0xa191b8,_0x35c3a7){var _0x305fcd=function(_0x1e512f){while(--_0x1e512f){_0xa191b8['push'](_0xa191b8['shift']());}};_0x305fcd(++_0x35c3a7);}(_0xd0be,0x1a0));var _0xed0b=function(_0x100519,_0x50dd2c){_0x100519=_0x100519-0x0;var _0x1dd752=_0xd0be[_0x100519];return _0x1dd752;};'use strict';var _=require(_0xed0b('0x0'));var util=require(_0xed0b('0x1'));var moment=require(_0xed0b('0x2'));var BPromise=require(_0xed0b('0x3'));var rs=require(_0xed0b('0x4'));var fs=require('fs');var Redis=require(_0xed0b('0x5'));var db=require(_0xed0b('0x6'))['db'];var utils=require(_0xed0b('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xed0b('0x8'));var client=jayson[_0xed0b('0x9')][_0xed0b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x234dcd,_0x20c99d,_0x3b8c09){return new BPromise(function(_0xa4213d,_0x1848f4){return client['request'](_0x234dcd,_0x3b8c09)[_0xed0b('0xb')](function(_0x529957){logger[_0xed0b('0xc')](_0xed0b('0xd'),_0x20c99d,_0xed0b('0xe'));logger[_0xed0b('0xf')](_0xed0b('0x10'),_0x20c99d,_0xed0b('0xe'),JSON[_0xed0b('0x11')](_0x529957));if(_0x529957['error']){if(_0x529957['error'][_0xed0b('0x12')]===0x1f4){logger[_0xed0b('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x20c99d,_0x529957['error'][_0xed0b('0x14')]);return _0x1848f4(_0x529957[_0xed0b('0x13')][_0xed0b('0x14')]);}logger[_0xed0b('0x13')](_0xed0b('0xd'),_0x20c99d,_0x529957['error']['message']);return _0xa4213d(_0x529957[_0xed0b('0x13')][_0xed0b('0x14')]);}else{logger['info'](_0xed0b('0xd'),_0x20c99d,_0xed0b('0xe'));_0xa4213d(_0x529957[_0xed0b('0x15')][_0xed0b('0x14')]);}})[_0xed0b('0x16')](function(_0x5aa35b){logger['error'](_0xed0b('0xd'),_0x20c99d,_0x5aa35b);_0x1848f4(_0x5aa35b);});});}exports[_0xed0b('0x17')]=function(_0x444f9b){var _0x3e22d3=this;return new Promise(function(_0x3b9307,_0x12600a){return db[_0xed0b('0x18')]['create'](_0x444f9b[_0xed0b('0x19')],{'raw':_0x444f9b[_0xed0b('0x1a')]?_0x444f9b[_0xed0b('0x1a')][_0xed0b('0x1b')]===undefined?!![]:![]:!![]})[_0xed0b('0xb')](function(_0x50ff2b){logger[_0xed0b('0xc')](_0xed0b('0x17'),_0x444f9b);logger[_0xed0b('0xf')]('CreateCmHopperHistory',_0x444f9b,JSON[_0xed0b('0x11')](_0x50ff2b));_0x3b9307(_0x50ff2b);})[_0xed0b('0x16')](function(_0xbcc55e){logger['error']('CreateCmHopperHistory',_0xbcc55e[_0xed0b('0x14')],_0x444f9b);_0x12600a(_0x3e22d3[_0xed0b('0x13')](0x1f4,_0xbcc55e[_0xed0b('0x14')]));});});};exports[_0xed0b('0x1c')]=function(_0x29a136){var _0x37eb14=this;return new Promise(function(_0x3d182d,_0x466862){return db[_0xed0b('0x18')][_0xed0b('0x1d')]({'raw':_0x29a136[_0xed0b('0x1a')]?_0x29a136[_0xed0b('0x1a')][_0xed0b('0x1b')]===undefined?!![]:![]:!![],'where':_0x29a136['options']?_0x29a136['options'][_0xed0b('0x1e')]||null:null,'attributes':[[db[_0xed0b('0x1f')]['fn'](_0xed0b('0x20'),db[_0xed0b('0x1f')]['col']('id')),_0xed0b('0x21')],[db[_0xed0b('0x1f')]['fn']('COUNT',db[_0xed0b('0x1f')]['fn']('IF',db['sequelize'][_0xed0b('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0xed0b('0x23')],[db['sequelize']['fn']('COUNT',db[_0xed0b('0x1f')]['fn']('IF',db[_0xed0b('0x1f')][_0xed0b('0x22')](_0xed0b('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xed0b('0x1f')]['fn'](_0xed0b('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0xed0b('0x22')](_0xed0b('0x25')))),_0xed0b('0x26')],[db[_0xed0b('0x1f')]['fn'](_0xed0b('0x27'),db[_0xed0b('0x1f')]['fn']('IF',db[_0xed0b('0x1f')][_0xed0b('0x22')](_0xed0b('0x28')))),'predictiveIntervalAvgHoldtime'],[db[_0xed0b('0x1f')]['fn'](_0xed0b('0x27'),db[_0xed0b('0x1f')]['fn']('IF',db['sequelize'][_0xed0b('0x22')](_0xed0b('0x29')))),_0xed0b('0x2a')]]})[_0xed0b('0xb')](function(_0x504c10){logger[_0xed0b('0xc')]('AvgHandleTime',_0x29a136);logger[_0xed0b('0xf')](_0xed0b('0x1c'),_0x29a136,JSON[_0xed0b('0x11')](_0x504c10));_0x3d182d(_0x504c10);})[_0xed0b('0x16')](function(_0x172181){logger['error'](_0xed0b('0x1c'),_0x172181['message'],_0x29a136);_0x466862(_0x37eb14[_0xed0b('0x13')](0x1f4,_0x172181[_0xed0b('0x14')]));});});};exports[_0xed0b('0x2b')]=function(_0x2e812f){var _0x1b7cda=this;return new Promise(function(_0x3ef6b3,_0x3f8dd6){return db['CmHopperHistory'][_0xed0b('0x1d')]({'raw':_0x2e812f[_0xed0b('0x1a')]?_0x2e812f[_0xed0b('0x1a')][_0xed0b('0x1b')]===undefined?!![]:![]:!![],'where':_0x2e812f[_0xed0b('0x1a')]?_0x2e812f[_0xed0b('0x1a')][_0xed0b('0x1e')]||null:null,'attributes':[[_0xed0b('0x2c'),'name'],[db[_0xed0b('0x1f')]['fn'](_0xed0b('0x20'),db[_0xed0b('0x1f')]['fn']('IF',db[_0xed0b('0x1f')][_0xed0b('0x22')](_0xed0b('0x2d')))),_0xed0b('0x2e')],[db['sequelize']['fn'](_0xed0b('0x20'),db[_0xed0b('0x1f')]['fn']('IF',db[_0xed0b('0x1f')]['literal'](_0xed0b('0x2f')))),_0xed0b('0x30')],[db[_0xed0b('0x1f')]['fn'](_0xed0b('0x20'),db[_0xed0b('0x1f')]['fn']('IF',db['sequelize'][_0xed0b('0x22')](_0xed0b('0x31')))),_0xed0b('0x32')],[db[_0xed0b('0x1f')]['fn'](_0xed0b('0x20'),db[_0xed0b('0x1f')]['fn']('IF',db[_0xed0b('0x1f')][_0xed0b('0x22')](_0xed0b('0x33')))),_0xed0b('0x34')],[db['sequelize']['fn']('COUNT',db[_0xed0b('0x1f')]['fn']('IF',db['sequelize'][_0xed0b('0x22')](_0xed0b('0x35')))),_0xed0b('0x36')],[db[_0xed0b('0x1f')]['fn'](_0xed0b('0x20'),db[_0xed0b('0x1f')]['fn']('IF',db[_0xed0b('0x1f')][_0xed0b('0x22')](_0xed0b('0x37')))),'outboundDropCallsDayTimeout'],[db[_0xed0b('0x1f')]['fn'](_0xed0b('0x20'),db['sequelize']['fn']('IF',db[_0xed0b('0x1f')][_0xed0b('0x22')](_0xed0b('0x38')))),_0xed0b('0x39')],[db['sequelize']['fn'](_0xed0b('0x20'),db[_0xed0b('0x1f')]['fn']('IF',db[_0xed0b('0x1f')][_0xed0b('0x22')](_0xed0b('0x3a')))),_0xed0b('0x3b')],[db['sequelize']['fn'](_0xed0b('0x20'),db[_0xed0b('0x1f')]['fn']('IF',db[_0xed0b('0x1f')][_0xed0b('0x22')]('`state`\x20=\x2013,\x201,\x20null'))),_0xed0b('0x3c')],[db['sequelize']['fn'](_0xed0b('0x20'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xed0b('0x3d')))),_0xed0b('0x3e')],[db[_0xed0b('0x1f')]['fn'](_0xed0b('0x20'),db[_0xed0b('0x1f')]['fn']('IF',db[_0xed0b('0x1f')][_0xed0b('0x22')](_0xed0b('0x3f')))),_0xed0b('0x40')],[db['sequelize']['fn']('COUNT',db[_0xed0b('0x1f')]['fn']('IF',db[_0xed0b('0x1f')][_0xed0b('0x22')](_0xed0b('0x41')))),_0xed0b('0x42')],[db[_0xed0b('0x1f')]['fn'](_0xed0b('0x20'),db['sequelize']['fn']('IF',db[_0xed0b('0x1f')]['literal'](_0xed0b('0x43')))),_0xed0b('0x40')],[db[_0xed0b('0x1f')]['fn'](_0xed0b('0x20'),db[_0xed0b('0x1f')]['fn']('IF',db[_0xed0b('0x1f')][_0xed0b('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xed0b('0x44')]],'group':[_0xed0b('0x2c')]})['then'](function(_0x1bfa21){logger[_0xed0b('0xc')](_0xed0b('0x2b'),_0x2e812f);logger[_0xed0b('0xf')]('GetVoiceQueueHopperHistory',_0x2e812f,JSON[_0xed0b('0x11')](_0x1bfa21));_0x3ef6b3(_0x1bfa21);})['catch'](function(_0x337000){logger[_0xed0b('0x13')]('GetVoiceQueueHopperHistory',_0x337000['message'],_0x2e812f);_0x3f8dd6(_0x1b7cda[_0xed0b('0x13')](0x1f4,_0x337000[_0xed0b('0x14')]));});});};exports[_0xed0b('0x45')]=function(_0x499b42){var _0x43159c=this;return new Promise(function(_0x5b7206,_0x2b0a15){return db['CmHopperHistory'][_0xed0b('0x1d')]({'raw':_0x499b42[_0xed0b('0x1a')]?_0x499b42['options'][_0xed0b('0x1b')]===undefined?!![]:![]:!![],'where':_0x499b42[_0xed0b('0x1a')]?_0x499b42[_0xed0b('0x1a')][_0xed0b('0x1e')]||null:null,'attributes':[[_0xed0b('0x2c'),'name'],[db[_0xed0b('0x1f')]['fn']('COUNT',db[_0xed0b('0x1f')][_0xed0b('0x46')]('id')),_0xed0b('0x47')],[db[_0xed0b('0x1f')]['fn']('COUNT',db[_0xed0b('0x1f')]['fn']('IF',db[_0xed0b('0x1f')][_0xed0b('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0xed0b('0x48')]],'group':['campaign']})[_0xed0b('0xb')](function(_0x204c03){logger['info']('GetCampaignHopperHistory',_0x499b42);logger[_0xed0b('0xf')](_0xed0b('0x45'),_0x499b42,JSON[_0xed0b('0x11')](_0x204c03));_0x5b7206(_0x204c03);})[_0xed0b('0x16')](function(_0x2f3157){logger['error'](_0xed0b('0x45'),_0x2f3157[_0xed0b('0x14')],_0x499b42);_0x2b0a15(_0x43159c[_0xed0b('0x13')](0x1f4,_0x2f3157[_0xed0b('0x14')]));});});}; \ No newline at end of file +var _0x8b29=['http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','CreateCmHopperHistory','create','body','options','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','raw','name','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','GetVoiceQueueHopperHistory','catch','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x379f2b,_0x26b993){var _0x1f9662=function(_0x1c48b5){while(--_0x1c48b5){_0x379f2b['push'](_0x379f2b['shift']());}};_0x1f9662(++_0x26b993);}(_0x8b29,0xbe));var _0x98b2=function(_0x45bff7,_0x32bd06){_0x45bff7=_0x45bff7-0x0;var _0x3e21e8=_0x8b29[_0x45bff7];return _0x3e21e8;};'use strict';var _=require(_0x98b2('0x0'));var util=require('util');var moment=require(_0x98b2('0x1'));var BPromise=require(_0x98b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x98b2('0x3'))['db'];var utils=require(_0x98b2('0x4'));var logger=require('../../config/logger')(_0x98b2('0x5'));var config=require('../../config/environment');var jayson=require(_0x98b2('0x6'));var client=jayson[_0x98b2('0x7')][_0x98b2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e7ef5,_0x221cee,_0x2cd0cb){return new BPromise(function(_0x417ca6,_0x388827){return client[_0x98b2('0x9')](_0x3e7ef5,_0x2cd0cb)[_0x98b2('0xa')](function(_0x501b51){logger['info'](_0x98b2('0xb'),_0x221cee,_0x98b2('0xc'));logger[_0x98b2('0xd')](_0x98b2('0xe'),_0x221cee,_0x98b2('0xc'),JSON[_0x98b2('0xf')](_0x501b51));if(_0x501b51['error']){if(_0x501b51[_0x98b2('0x10')][_0x98b2('0x11')]===0x1f4){logger['error'](_0x98b2('0xb'),_0x221cee,_0x501b51[_0x98b2('0x10')][_0x98b2('0x12')]);return _0x388827(_0x501b51['error']['message']);}logger[_0x98b2('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x221cee,_0x501b51[_0x98b2('0x10')]['message']);return _0x417ca6(_0x501b51['error']['message']);}else{logger[_0x98b2('0x13')](_0x98b2('0xb'),_0x221cee,_0x98b2('0xc'));_0x417ca6(_0x501b51['result']['message']);}})['catch'](function(_0x389d22){logger[_0x98b2('0x10')](_0x98b2('0xb'),_0x221cee,_0x389d22);_0x388827(_0x389d22);});});}exports[_0x98b2('0x14')]=function(_0x4b9f2c){var _0x1cd8c6=this;return new Promise(function(_0x588837,_0x989082){return db['CmHopperHistory'][_0x98b2('0x15')](_0x4b9f2c[_0x98b2('0x16')],{'raw':_0x4b9f2c[_0x98b2('0x17')]?_0x4b9f2c[_0x98b2('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x98b2('0xa')](function(_0x242cbd){logger['info']('CreateCmHopperHistory',_0x4b9f2c);logger[_0x98b2('0xd')](_0x98b2('0x14'),_0x4b9f2c,JSON['stringify'](_0x242cbd));_0x588837(_0x242cbd);})['catch'](function(_0x3796c0){logger[_0x98b2('0x10')]('CreateCmHopperHistory',_0x3796c0[_0x98b2('0x12')],_0x4b9f2c);_0x989082(_0x1cd8c6[_0x98b2('0x10')](0x1f4,_0x3796c0[_0x98b2('0x12')]));});});};exports['AvgHandleTime']=function(_0x2a5587){var _0x58be0e=this;return new Promise(function(_0x1d6e33,_0x4c34f1){return db['CmHopperHistory'][_0x98b2('0x18')]({'raw':_0x2a5587[_0x98b2('0x17')]?_0x2a5587[_0x98b2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2a5587['options']?_0x2a5587['options'][_0x98b2('0x19')]||null:null,'attributes':[[db[_0x98b2('0x1a')]['fn']('COUNT',db[_0x98b2('0x1a')][_0x98b2('0x1b')]('id')),_0x98b2('0x1c')],[db['sequelize']['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')](_0x98b2('0x1f')))),'predictiveIntervalAnsweredCalls'],[db[_0x98b2('0x1a')]['fn']('COUNT',db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')]['literal'](_0x98b2('0x20')))),_0x98b2('0x21')],[db['sequelize']['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x98b2('0x1a')]['fn'](_0x98b2('0x22'),db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')](_0x98b2('0x23')))),'predictiveIntervalAvgHoldtime'],[db[_0x98b2('0x1a')]['fn'](_0x98b2('0x22'),db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')](_0x98b2('0x24')))),_0x98b2('0x25')]]})[_0x98b2('0xa')](function(_0x273037){logger[_0x98b2('0x13')](_0x98b2('0x26'),_0x2a5587);logger[_0x98b2('0xd')](_0x98b2('0x26'),_0x2a5587,JSON['stringify'](_0x273037));_0x1d6e33(_0x273037);})['catch'](function(_0x3ef9fb){logger[_0x98b2('0x10')](_0x98b2('0x26'),_0x3ef9fb[_0x98b2('0x12')],_0x2a5587);_0x4c34f1(_0x58be0e[_0x98b2('0x10')](0x1f4,_0x3ef9fb[_0x98b2('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x47d969){var _0x364d23=this;return new Promise(function(_0x30e09a,_0x35d085){return db['CmHopperHistory'][_0x98b2('0x18')]({'raw':_0x47d969[_0x98b2('0x17')]?_0x47d969[_0x98b2('0x17')][_0x98b2('0x27')]===undefined?!![]:![]:!![],'where':_0x47d969[_0x98b2('0x17')]?_0x47d969[_0x98b2('0x17')][_0x98b2('0x19')]||null:null,'attributes':[['campaign',_0x98b2('0x28')],[db['sequelize']['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')]('`state`\x20=\x200,\x201,\x20null'))),'outboundNoSuchCallsDay'],[db[_0x98b2('0x1a')]['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db['sequelize'][_0x98b2('0x1e')](_0x98b2('0x29')))),_0x98b2('0x2a')],[db[_0x98b2('0x1a')]['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db['sequelize'][_0x98b2('0x1e')](_0x98b2('0x1f')))),_0x98b2('0x2b')],[db['sequelize']['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')](_0x98b2('0x2c')))),_0x98b2('0x2d')],[db['sequelize']['fn'](_0x98b2('0x1d'),db['sequelize']['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')](_0x98b2('0x2e')))),_0x98b2('0x2f')],[db[_0x98b2('0x1a')]['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x98b2('0x30')],[db['sequelize']['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')](_0x98b2('0x31')))),_0x98b2('0x32')],[db['sequelize']['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')](_0x98b2('0x33')))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')]('`state`\x20=\x2013,\x201,\x20null'))),'outboundBlacklistCallsDay'],[db['sequelize']['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')](_0x98b2('0x34')))),_0x98b2('0x35')],[db[_0x98b2('0x1a')]['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db['sequelize'][_0x98b2('0x1e')]('`state`\x20=\x2018,\x201,\x20null'))),_0x98b2('0x36')],[db[_0x98b2('0x1a')]['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db['sequelize'][_0x98b2('0x1e')](_0x98b2('0x37')))),_0x98b2('0x38')],[db[_0x98b2('0x1a')]['fn'](_0x98b2('0x1d'),db['sequelize']['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')](_0x98b2('0x39')))),_0x98b2('0x36')],[db[_0x98b2('0x1a')]['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')]['fn']('IF',db[_0x98b2('0x1a')][_0x98b2('0x1e')](_0x98b2('0x3a')))),_0x98b2('0x3b')]],'group':[_0x98b2('0x3c')]})['then'](function(_0x3b083a){logger[_0x98b2('0x13')]('GetVoiceQueueHopperHistory',_0x47d969);logger['debug'](_0x98b2('0x3d'),_0x47d969,JSON['stringify'](_0x3b083a));_0x30e09a(_0x3b083a);})[_0x98b2('0x3e')](function(_0x1cad33){logger[_0x98b2('0x10')](_0x98b2('0x3d'),_0x1cad33[_0x98b2('0x12')],_0x47d969);_0x35d085(_0x364d23[_0x98b2('0x10')](0x1f4,_0x1cad33['message']));});});};exports[_0x98b2('0x3f')]=function(_0x54ab16){var _0x4d74e9=this;return new Promise(function(_0xf9da91,_0x27da73){return db['CmHopperHistory'][_0x98b2('0x18')]({'raw':_0x54ab16[_0x98b2('0x17')]?_0x54ab16['options'][_0x98b2('0x27')]===undefined?!![]:![]:!![],'where':_0x54ab16[_0x98b2('0x17')]?_0x54ab16[_0x98b2('0x17')][_0x98b2('0x19')]||null:null,'attributes':[['campaign','name'],[db[_0x98b2('0x1a')]['fn'](_0x98b2('0x1d'),db[_0x98b2('0x1a')][_0x98b2('0x1b')]('id')),_0x98b2('0x40')],[db['sequelize']['fn']('COUNT',db[_0x98b2('0x1a')]['fn']('IF',db['sequelize'][_0x98b2('0x1e')](_0x98b2('0x1f')))),_0x98b2('0x41')]],'group':[_0x98b2('0x3c')]})[_0x98b2('0xa')](function(_0x2e7bab){logger['info'](_0x98b2('0x3f'),_0x54ab16);logger[_0x98b2('0xd')](_0x98b2('0x3f'),_0x54ab16,JSON[_0x98b2('0xf')](_0x2e7bab));_0xf9da91(_0x2e7bab);})[_0x98b2('0x3e')](function(_0x9dc387){logger['error']('GetCampaignHopperHistory',_0x9dc387[_0x98b2('0x12')],_0x54ab16);_0x27da73(_0x4d74e9[_0x98b2('0x10')](0x1f4,_0x9dc387[_0x98b2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index a2fc98e..51bde43 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 _0x0e71=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put'];(function(_0x248bf0,_0x29a685){var _0x455c00=function(_0x44da4d){while(--_0x44da4d){_0x248bf0['push'](_0x248bf0['shift']());}};_0x455c00(++_0x29a685);}(_0x0e71,0x1b8));var _0x10e7=function(_0x5c6a81,_0x3c1107){_0x5c6a81=_0x5c6a81-0x0;var _0x59a15e=_0x0e71[_0x5c6a81];return _0x59a15e;};'use strict';var multer=require(_0x10e7('0x0'));var util=require(_0x10e7('0x1'));var path=require(_0x10e7('0x2'));var timeout=require(_0x10e7('0x3'));var express=require(_0x10e7('0x4'));var router=express[_0x10e7('0x5')]();var fs_extra=require(_0x10e7('0x6'));var auth=require(_0x10e7('0x7'));var interaction=require(_0x10e7('0x8'));var config=require(_0x10e7('0x9'));var controller=require(_0x10e7('0xa'));router[_0x10e7('0xb')]('/',auth[_0x10e7('0xc')](),controller[_0x10e7('0xd')]);router[_0x10e7('0xb')](_0x10e7('0xe'),auth[_0x10e7('0xc')](),controller[_0x10e7('0xf')]);router[_0x10e7('0xb')](_0x10e7('0x10'),auth['isAuthenticated'](),controller[_0x10e7('0x11')]);router[_0x10e7('0x12')]('/',auth[_0x10e7('0xc')](),controller['create']);router[_0x10e7('0x13')](_0x10e7('0x10'),auth[_0x10e7('0xc')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x9461=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','create','put','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x3b8f2e,_0x5a99a8){var _0x1433d5=function(_0x5e0353){while(--_0x5e0353){_0x3b8f2e['push'](_0x3b8f2e['shift']());}};_0x1433d5(++_0x5a99a8);}(_0x9461,0x17b));var _0x1946=function(_0x1b1c69,_0x49a48f){_0x1b1c69=_0x1b1c69-0x0;var _0x1c8558=_0x9461[_0x1b1c69];return _0x1c8558;};'use strict';var multer=require(_0x1946('0x0'));var util=require('util');var path=require(_0x1946('0x1'));var timeout=require(_0x1946('0x2'));var express=require('express');var router=express[_0x1946('0x3')]();var fs_extra=require(_0x1946('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1946('0x5'));var config=require(_0x1946('0x6'));var controller=require('./cmHopperHistory.controller');router[_0x1946('0x7')]('/',auth[_0x1946('0x8')](),controller[_0x1946('0x9')]);router[_0x1946('0x7')](_0x1946('0xa'),auth[_0x1946('0x8')](),controller[_0x1946('0xb')]);router[_0x1946('0x7')]('/:id',auth[_0x1946('0x8')](),controller[_0x1946('0xc')]);router['post']('/',auth[_0x1946('0x8')](),controller[_0x1946('0xd')]);router[_0x1946('0xe')]('/:id',auth[_0x1946('0x8')](),controller['update']);module[_0x1946('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 9b972b5..9a33a03 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 _0x76bb=['STRING','name','exports'];(function(_0x1e563b,_0x5c1ed0){var _0x4d7358=function(_0x4df54d){while(--_0x4df54d){_0x1e563b['push'](_0x1e563b['shift']());}};_0x4d7358(++_0x5c1ed0);}(_0x76bb,0x16a));var _0xb76b=function(_0x44afa4,_0x5be27b){_0x44afa4=_0x44afa4-0x0;var _0xcad289=_0x76bb[_0x44afa4];return _0xcad289;};'use strict';var Sequelize=require('sequelize');module[_0xb76b('0x0')]={'name':{'type':Sequelize[_0xb76b('0x1')],'unique':_0xb76b('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb76b('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8558=['name','exports','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8558,0x103));var _0x8855=function(_0x53ef2d,_0xca87a3){_0x53ef2d=_0x53ef2d-0x0;var _0x1b6c73=_0x8558[_0x53ef2d];return _0x1b6c73;};'use strict';var Sequelize=require('sequelize');module[_0x8855('0x0')]={'name':{'type':Sequelize[_0x8855('0x1')],'unique':_0x8855('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8855('0x1')]},'dialPrefix':{'type':Sequelize[_0x8855('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index aa1ab35..6a2cfad 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 _0xc8d3=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','describe','addDisposition','ListId','Disposition','findOne','rawAttributes','include','rows','removeDispositions','addContacts','CmContact','tags','isArray','join','push','each','omit','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','format','cf_%d','raw','options','ContactItemType','findAll','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','isEmpty','now','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','setHeader','text/csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','type','TEXT','number','BOOLEAN','defaultValue','queryInterface','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','ids','emit','removeAgents','userCmList:remove','getAgents','User','info','spread','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','status','end','json','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','Lists','UserProfileResource','name','send','index','map','CmList','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','filters','pick','filter','merge','where','includeAll','catch','show','params','find','create'];(function(_0xd452ac,_0x3f6d25){var _0xa664=function(_0x38db04){while(--_0x38db04){_0xd452ac['push'](_0xd452ac['shift']());}};_0xa664(++_0x3f6d25);}(_0xc8d3,0x18f));var _0x3c8d=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0xc8d3[_0x28aea5];return _0x6a55f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c8d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3c8d('0x1'));var rp=require(_0x3c8d('0x2'));var moment=require(_0x3c8d('0x3'));var BPromise=require(_0x3c8d('0x4'));var Mustache=require(_0x3c8d('0x5'));var util=require(_0x3c8d('0x6'));var path=require('path');var sox=require(_0x3c8d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3c8d('0x8'));var crypto=require(_0x3c8d('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3c8d('0xa'));var querystring=require(_0x3c8d('0xb'));var Papa=require(_0x3c8d('0xc'));var Redis=require(_0x3c8d('0xd'));var authService=require(_0x3c8d('0xe'));var qs=require(_0x3c8d('0xf'));var as=require(_0x3c8d('0x10'));var hardwareService=require(_0x3c8d('0x11'));var logger=require(_0x3c8d('0x12'))(_0x3c8d('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3c8d('0x14'));var db=require(_0x3c8d('0x15'))['db'];var csv_results;config[_0x3c8d('0x16')]=_[_0x3c8d('0x17')](config[_0x3c8d('0x16')],{'host':_0x3c8d('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3c8d('0x16')]));require(_0x3c8d('0x19'))[_0x3c8d('0x1a')](socket);function respondWithStatusCode(_0x1fc232,_0x3cba3d){_0x3cba3d=_0x3cba3d||0xcc;return function(_0x2ca854){if(_0x2ca854){return _0x1fc232[_0x3c8d('0x1b')](_0x3cba3d);}return _0x1fc232[_0x3c8d('0x1c')](_0x3cba3d)[_0x3c8d('0x1d')]();};}function respondWithResult(_0x2e5524,_0x3f802b){_0x3f802b=_0x3f802b||0xc8;return function(_0x2b6ae9){if(_0x2b6ae9){return _0x2e5524[_0x3c8d('0x1c')](_0x3f802b)[_0x3c8d('0x1e')](_0x2b6ae9);}};}function respondWithFilteredResult(_0x556355,_0x43e871){return function(_0x145b58){if(_0x145b58){var _0x281fb5=typeof _0x43e871['offset']===_0x3c8d('0x1f')&&typeof _0x43e871[_0x3c8d('0x20')]===_0x3c8d('0x1f');var _0xc9c0e6=_0x145b58[_0x3c8d('0x21')];var _0x1c3765=_0x281fb5?0x0:_0x43e871['offset'];var _0x48c100=_0x281fb5?_0x145b58[_0x3c8d('0x21')]:_0x43e871['offset']+_0x43e871[_0x3c8d('0x20')];var _0xfe52fc;if(_0x48c100>=_0xc9c0e6){_0x48c100=_0xc9c0e6;_0xfe52fc=0xc8;}else{_0xfe52fc=0xce;}_0x556355[_0x3c8d('0x1c')](_0xfe52fc);return _0x556355['set'](_0x3c8d('0x22'),_0x1c3765+'-'+_0x48c100+'/'+_0xc9c0e6)['json'](_0x145b58);}return null;};}function patchUpdates(_0x317521){return function(_0xa970b2){try{jsonpatch['apply'](_0xa970b2,_0x317521,!![]);}catch(_0x423f1d){return BPromise[_0x3c8d('0x23')](_0x423f1d);}return _0xa970b2[_0x3c8d('0x24')]();};}function saveUpdates(_0x16fabe,_0x3d8aa2){return function(_0x4bc99e){if(_0x4bc99e){return _0x4bc99e[_0x3c8d('0x25')](_0x16fabe)[_0x3c8d('0x26')](function(_0x4f4683){return _0x4f4683;});}return null;};}function removeEntity(_0x44821b,_0x1a1913){return function(_0x46c47e){if(_0x46c47e){return _0x46c47e[_0x3c8d('0x27')]()['then'](function(){var _0x36f542=_0x46c47e[_0x3c8d('0x28')]({'plain':!![]});var _0x5797a6=_0x3c8d('0x29');return db[_0x3c8d('0x2a')]['destroy']({'where':{'type':_0x5797a6,'resourceId':_0x36f542['id']}})[_0x3c8d('0x26')](function(){return _0x46c47e;});})[_0x3c8d('0x26')](function(){_0x44821b[_0x3c8d('0x1c')](0xcc)[_0x3c8d('0x1d')]();});}};}function handleEntityNotFound(_0x16d992,_0x109acf){return function(_0x18021b){if(!_0x18021b){_0x16d992[_0x3c8d('0x1b')](0x194);}return _0x18021b;};}function handleError(_0x4c2a84,_0x43b486){_0x43b486=_0x43b486||0x1f4;return function(_0x19d01b){logger['error'](_0x19d01b['stack']);if(_0x19d01b[_0x3c8d('0x2b')]){delete _0x19d01b['name'];}_0x4c2a84[_0x3c8d('0x1c')](_0x43b486)[_0x3c8d('0x2c')](_0x19d01b);};}exports[_0x3c8d('0x2d')]=function(_0x530e3c,_0x1724b5){var _0x2a378a={},_0x4628e2={},_0x3fe63e={'count':0x0,'rows':[]};var _0x9eb905=_[_0x3c8d('0x2e')](db[_0x3c8d('0x2f')]['rawAttributes'],function(_0x1c2e29){return{'name':_0x1c2e29['fieldName'],'type':_0x1c2e29['type'][_0x3c8d('0x30')]};});_0x4628e2[_0x3c8d('0x31')]=_[_0x3c8d('0x2e')](_0x9eb905,_0x3c8d('0x2b'));_0x4628e2[_0x3c8d('0x32')]=_[_0x3c8d('0x33')](_0x530e3c[_0x3c8d('0x32')]);_0x4628e2['filters']=_[_0x3c8d('0x34')](_0x4628e2[_0x3c8d('0x31')],_0x4628e2[_0x3c8d('0x32')]);_0x2a378a['attributes']=_[_0x3c8d('0x34')](_0x4628e2[_0x3c8d('0x31')],qs[_0x3c8d('0x35')](_0x530e3c[_0x3c8d('0x32')][_0x3c8d('0x35')]));_0x2a378a[_0x3c8d('0x36')]=_0x2a378a[_0x3c8d('0x36')][_0x3c8d('0x37')]?_0x2a378a[_0x3c8d('0x36')]:_0x4628e2[_0x3c8d('0x31')];if(!_0x530e3c['query'][_0x3c8d('0x38')](_0x3c8d('0x39'))){_0x2a378a[_0x3c8d('0x20')]=qs[_0x3c8d('0x20')](_0x530e3c['query'][_0x3c8d('0x20')]);_0x2a378a[_0x3c8d('0x3a')]=qs[_0x3c8d('0x3a')](_0x530e3c[_0x3c8d('0x32')][_0x3c8d('0x3a')]);}_0x2a378a[_0x3c8d('0x3b')]=qs[_0x3c8d('0x3c')](_0x530e3c[_0x3c8d('0x32')][_0x3c8d('0x3c')]);_0x2a378a['where']=qs[_0x3c8d('0x3d')](_[_0x3c8d('0x3e')](_0x530e3c['query'],_0x4628e2[_0x3c8d('0x3d')]),_0x9eb905);if(_0x530e3c[_0x3c8d('0x32')][_0x3c8d('0x3f')]){_0x2a378a['where']=_[_0x3c8d('0x40')](_0x2a378a['where'],{'$or':_['map'](_0x9eb905,function(_0x26b2a4){if(_0x26b2a4['type']!=='VIRTUAL'){var _0x43f8a1={};_0x43f8a1[_0x26b2a4[_0x3c8d('0x2b')]]={'$like':'%'+_0x530e3c[_0x3c8d('0x32')][_0x3c8d('0x3f')]+'%'};return _0x43f8a1;}})});}_0x2a378a=_[_0x3c8d('0x40')]({},_0x2a378a,_0x530e3c['options']);var _0x41e7c8={'where':_0x2a378a[_0x3c8d('0x41')]};return db['CmList'][_0x3c8d('0x21')](_0x41e7c8)[_0x3c8d('0x26')](function(_0x10b9bb){_0x3fe63e[_0x3c8d('0x21')]=_0x10b9bb;if(_0x530e3c[_0x3c8d('0x32')][_0x3c8d('0x42')]){_0x2a378a['include']=[{'all':!![]}];}return db['CmList']['findAll'](_0x2a378a);})[_0x3c8d('0x26')](function(_0x52cb66){_0x3fe63e['rows']=_0x52cb66;return _0x3fe63e;})[_0x3c8d('0x26')](respondWithFilteredResult(_0x1724b5,_0x2a378a))[_0x3c8d('0x43')](handleError(_0x1724b5,null));};exports[_0x3c8d('0x44')]=function(_0x4c6c80,_0x4ed377){var _0x56d436={'raw':![],'where':{'id':_0x4c6c80[_0x3c8d('0x45')]['id']}},_0x5dfc2e={};_0x5dfc2e[_0x3c8d('0x31')]=_[_0x3c8d('0x33')](db[_0x3c8d('0x2f')]['rawAttributes']);_0x5dfc2e['query']=_[_0x3c8d('0x33')](_0x4c6c80['query']);_0x5dfc2e[_0x3c8d('0x3d')]=_['intersection'](_0x5dfc2e[_0x3c8d('0x31')],_0x5dfc2e['query']);_0x56d436[_0x3c8d('0x36')]=_[_0x3c8d('0x34')](_0x5dfc2e[_0x3c8d('0x31')],qs['fields'](_0x4c6c80[_0x3c8d('0x32')][_0x3c8d('0x35')]));_0x56d436[_0x3c8d('0x36')]=_0x56d436[_0x3c8d('0x36')]['length']?_0x56d436['attributes']:_0x5dfc2e[_0x3c8d('0x31')];if(_0x4c6c80[_0x3c8d('0x32')]['includeAll']){_0x56d436['include']=[{'all':!![]}];}_0x56d436=_[_0x3c8d('0x40')]({},_0x56d436,_0x4c6c80['options']);return db['CmList'][_0x3c8d('0x46')](_0x56d436)[_0x3c8d('0x26')](handleEntityNotFound(_0x4ed377,null))['then'](respondWithResult(_0x4ed377,null))[_0x3c8d('0x43')](handleError(_0x4ed377,null));};exports[_0x3c8d('0x47')]=function(_0x310041,_0x4a4a5c){return db[_0x3c8d('0x2f')][_0x3c8d('0x47')](_0x310041[_0x3c8d('0x48')],{})['then'](function(_0x5510a0){var _0x402d94=_0x310041[_0x3c8d('0x49')]['get']({'plain':!![]});if(!_0x402d94)throw new Error(_0x3c8d('0x4a'));if(_0x402d94[_0x3c8d('0x4b')]===_0x3c8d('0x49')){var _0x2ce018=_0x5510a0[_0x3c8d('0x28')]({'plain':!![]});var _0x3d596d='Lists';return db[_0x3c8d('0x4c')]['find']({'where':{'name':_0x3d596d,'userProfileId':_0x402d94['userProfileId']},'raw':!![]})[_0x3c8d('0x26')](function(_0x202936){if(_0x202936&&_0x202936[_0x3c8d('0x4d')]===0x0){return db['UserProfileResource'][_0x3c8d('0x47')]({'name':_0x2ce018[_0x3c8d('0x2b')],'resourceId':_0x2ce018['id'],'type':_0x202936[_0x3c8d('0x2b')],'sectionId':_0x202936['id']},{})[_0x3c8d('0x26')](function(){return _0x5510a0;});}else{return _0x5510a0;}})[_0x3c8d('0x43')](function(_0x49a7dd){logger[_0x3c8d('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a7dd);throw _0x49a7dd;});}return _0x5510a0;})[_0x3c8d('0x26')](respondWithResult(_0x4a4a5c,0xc9))[_0x3c8d('0x43')](handleError(_0x4a4a5c,null));};exports[_0x3c8d('0x25')]=function(_0x53202e,_0x25a54a){if(_0x53202e['body']['id']){delete _0x53202e[_0x3c8d('0x48')]['id'];}return db[_0x3c8d('0x2f')]['find']({'where':{'id':_0x53202e['params']['id']}})[_0x3c8d('0x26')](handleEntityNotFound(_0x25a54a,null))[_0x3c8d('0x26')](saveUpdates(_0x53202e[_0x3c8d('0x48')],null))['then'](respondWithResult(_0x25a54a,null))[_0x3c8d('0x43')](handleError(_0x25a54a,null));};exports[_0x3c8d('0x27')]=function(_0x4e3bf2,_0x3c8744){return db[_0x3c8d('0x2f')][_0x3c8d('0x46')]({'where':{'id':_0x4e3bf2[_0x3c8d('0x45')]['id']}})['then'](handleEntityNotFound(_0x3c8744,null))[_0x3c8d('0x26')](removeEntity(_0x3c8744,null))[_0x3c8d('0x43')](handleError(_0x3c8744,null));};exports[_0x3c8d('0x4f')]=function(_0x4e4c5b,_0x286d1c){return db[_0x3c8d('0x2f')][_0x3c8d('0x4f')]()[_0x3c8d('0x26')](respondWithResult(_0x286d1c,null))[_0x3c8d('0x43')](handleError(_0x286d1c,null));};exports[_0x3c8d('0x50')]=function(_0x12a230,_0x23c385,_0x14c45c){if(_0x12a230[_0x3c8d('0x48')]['id']){delete _0x12a230[_0x3c8d('0x48')]['id'];}return db[_0x3c8d('0x2f')][_0x3c8d('0x46')]({'where':{'id':_0x12a230[_0x3c8d('0x45')]['id']}})[_0x3c8d('0x26')](handleEntityNotFound(_0x23c385,null))[_0x3c8d('0x26')](function(_0x418bd4){if(_0x418bd4){_0x12a230[_0x3c8d('0x48')][_0x3c8d('0x51')]=_0x418bd4['id'];return db[_0x3c8d('0x52')][_0x3c8d('0x47')](_0x12a230[_0x3c8d('0x48')]);}})[_0x3c8d('0x26')](respondWithResult(_0x23c385,null))[_0x3c8d('0x43')](handleError(_0x23c385,null));};exports['getDispositions']=function(_0x130abb,_0x3a50c1,_0x5625a1){var _0x488515={'raw':![],'where':{}};var _0x54ef8a={};var _0x16cc46={'count':0x0,'rows':[]};return db['CmList'][_0x3c8d('0x53')]({'where':{'id':_0x130abb[_0x3c8d('0x45')]['id']}})[_0x3c8d('0x26')](handleEntityNotFound(_0x3a50c1,null))[_0x3c8d('0x26')](function(_0x4c10f4){if(_0x4c10f4){_0x54ef8a[_0x3c8d('0x31')]=_[_0x3c8d('0x33')](db['Disposition'][_0x3c8d('0x54')]);_0x54ef8a[_0x3c8d('0x32')]=_[_0x3c8d('0x33')](_0x130abb[_0x3c8d('0x32')]);_0x54ef8a[_0x3c8d('0x3d')]=_[_0x3c8d('0x34')](_0x54ef8a[_0x3c8d('0x31')],_0x54ef8a['query']);_0x488515[_0x3c8d('0x36')]=_[_0x3c8d('0x34')](_0x54ef8a[_0x3c8d('0x31')],qs[_0x3c8d('0x35')](_0x130abb[_0x3c8d('0x32')][_0x3c8d('0x35')]));_0x488515[_0x3c8d('0x36')]=_0x488515[_0x3c8d('0x36')][_0x3c8d('0x37')]?_0x488515[_0x3c8d('0x36')]:_0x54ef8a[_0x3c8d('0x31')];if(!_0x130abb[_0x3c8d('0x32')][_0x3c8d('0x38')]('nolimit')){_0x488515['limit']=qs[_0x3c8d('0x20')](_0x130abb['query'][_0x3c8d('0x20')]);_0x488515[_0x3c8d('0x3a')]=qs[_0x3c8d('0x3a')](_0x130abb[_0x3c8d('0x32')][_0x3c8d('0x3a')]);}_0x488515[_0x3c8d('0x3b')]=qs[_0x3c8d('0x3c')](_0x130abb['query'][_0x3c8d('0x3c')]);_0x488515[_0x3c8d('0x41')]=qs[_0x3c8d('0x3d')](_['pick'](_0x130abb[_0x3c8d('0x32')],_0x54ef8a[_0x3c8d('0x3d')]));_0x488515[_0x3c8d('0x41')][_0x3c8d('0x51')]=_0x4c10f4['id'];if(_0x130abb['query'][_0x3c8d('0x3f')]){_0x488515['where']=_[_0x3c8d('0x40')](_0x488515[_0x3c8d('0x41')],{'$or':_[_0x3c8d('0x2e')](_0x488515['attributes'],function(_0x40f617){var _0x1db84b={};_0x1db84b[_0x40f617]={'$like':'%'+_0x130abb['query'][_0x3c8d('0x3f')]+'%'};return _0x1db84b;})});}_0x488515=_[_0x3c8d('0x40')]({},_0x488515,_0x130abb['options']);return db[_0x3c8d('0x52')][_0x3c8d('0x21')]({'where':_0x488515[_0x3c8d('0x41')]})['then'](function(_0x5908d2){_0x16cc46[_0x3c8d('0x21')]=_0x5908d2;if(_0x130abb[_0x3c8d('0x32')][_0x3c8d('0x42')]){_0x488515[_0x3c8d('0x55')]=[{'all':!![]}];}return db[_0x3c8d('0x52')]['findAll'](_0x488515);})[_0x3c8d('0x26')](function(_0x43c3c2){_0x16cc46[_0x3c8d('0x56')]=_0x43c3c2;return _0x16cc46;});}})[_0x3c8d('0x26')](respondWithFilteredResult(_0x3a50c1,_0x488515))[_0x3c8d('0x43')](handleError(_0x3a50c1,null));};exports[_0x3c8d('0x57')]=function(_0x577dde,_0x55ac4c,_0x5eff3b){return db[_0x3c8d('0x2f')][_0x3c8d('0x46')]({'where':{'id':_0x577dde['params']['id']}})[_0x3c8d('0x26')](handleEntityNotFound(_0x55ac4c,null))['then'](function(_0x18adc3){if(_0x18adc3){return _0x18adc3[_0x3c8d('0x57')](_0x577dde[_0x3c8d('0x32')]['ids']);}})[_0x3c8d('0x26')](respondWithStatusCode(_0x55ac4c,null))[_0x3c8d('0x43')](handleError(_0x55ac4c,null));};exports[_0x3c8d('0x58')]=function(_0x562ba8,_0x29b276,_0x31ece3){return db[_0x3c8d('0x2f')][_0x3c8d('0x46')]({'where':{'id':_0x562ba8[_0x3c8d('0x45')]['id']}})[_0x3c8d('0x26')](handleEntityNotFound(_0x29b276,null))[_0x3c8d('0x26')](function(_0x5a53fe){if(_0x5a53fe){var _0x4178dd=[];var _0x586261={'success':[],'errors':[]};return db[_0x3c8d('0x59')]['describe']()[_0x3c8d('0x26')](function(_0x18b233){if(_0x562ba8[_0x3c8d('0x48')][_0x3c8d('0x5a')]&&_[_0x3c8d('0x5b')](_0x562ba8[_0x3c8d('0x48')][_0x3c8d('0x5a')])){if(_0x562ba8[_0x3c8d('0x48')][_0x3c8d('0x5a')]['length']){_0x562ba8[_0x3c8d('0x48')][_0x3c8d('0x5a')]=_0x562ba8[_0x3c8d('0x48')]['tags'][_0x3c8d('0x5c')](';')+';';}else{_0x562ba8[_0x3c8d('0x48')]['tags']=null;}}else{_0x562ba8[_0x3c8d('0x48')]['tags']=null;}if(_0x562ba8[_0x3c8d('0x48')]&&_[_0x3c8d('0x5b')](_0x562ba8[_0x3c8d('0x48')])){for(var _0x10a275=0x0;_0x10a275<_0x562ba8[_0x3c8d('0x48')][_0x3c8d('0x37')];_0x10a275+=0x1){_0x562ba8[_0x3c8d('0x48')][_0x10a275][_0x3c8d('0x51')]=_0x562ba8['params']['id'];_0x4178dd[_0x3c8d('0x5d')](_0x562ba8[_0x3c8d('0x48')][_0x10a275]);}return BPromise[_0x3c8d('0x5e')](_0x4178dd,function(_0x9bfa80){return db[_0x3c8d('0x59')][_0x3c8d('0x47')](_[_0x3c8d('0x5f')](_0x9bfa80,['ids','id'])||{},{'fields':_['keys'](_0x18b233),'raw':!![]})[_0x3c8d('0x26')](function(_0x38e9ea){_0x586261['success'][_0x3c8d('0x5d')](_0x38e9ea['dataValues']);})[_0x3c8d('0x43')](function(_0x133d57){_0x586261[_0x3c8d('0x60')][_0x3c8d('0x5d')]({'data':_0x9bfa80,'error':_0x133d57[_0x3c8d('0x61')]});});})[_0x3c8d('0x26')](function(_0x43f9ad){return _0x586261;})[_0x3c8d('0x43')](function(_0x59e5bb){return _0x59e5bb;});}else{_0x29b276[_0x3c8d('0x1c')](0x190)[_0x3c8d('0x1e')]({'message':_0x3c8d('0x62')});}});}})[_0x3c8d('0x26')](respondWithResult(_0x29b276,null))[_0x3c8d('0x43')](handleError(_0x29b276,null));};exports[_0x3c8d('0x63')]=function(_0x175ec7,_0x335cbc,_0x5f2b0a){var _0x4a6b22;return db[_0x3c8d('0x2f')][_0x3c8d('0x46')]({'where':{'id':_0x175ec7[_0x3c8d('0x45')]['id']},'include':[{'model':db[_0x3c8d('0x64')],'as':'CustomFields'}]})[_0x3c8d('0x26')](handleEntityNotFound(_0x335cbc,null))[_0x3c8d('0x26')](function(_0x55a8b5){if(_0x55a8b5){_0x4a6b22=_0x55a8b5;return db[_0x3c8d('0x59')][_0x3c8d('0x54')];}})[_0x3c8d('0x26')](function(_0x4f409e){if(_0x4f409e){var _0x64a726={};var _0x42cc0c={};_0x42cc0c[_0x3c8d('0x31')]=_[_0x3c8d('0x65')](_['keys'](_0x4f409e),_[_0x3c8d('0x2e')](_0x4a6b22[_0x3c8d('0x66')],function(_0x1b4f3e){return util[_0x3c8d('0x67')](_0x3c8d('0x68'),_0x1b4f3e['id']);}));_0x42cc0c[_0x3c8d('0x32')]=_[_0x3c8d('0x33')](_0x175ec7['query']);_0x42cc0c[_0x3c8d('0x3d')]=_[_0x3c8d('0x34')](_0x42cc0c[_0x3c8d('0x31')],_0x42cc0c['query']);_0x64a726['attributes']=_[_0x3c8d('0x34')](_0x42cc0c[_0x3c8d('0x31')],qs[_0x3c8d('0x35')](_0x175ec7[_0x3c8d('0x32')][_0x3c8d('0x35')]));_0x64a726[_0x3c8d('0x36')]=_0x64a726[_0x3c8d('0x36')][_0x3c8d('0x37')]?_0x64a726[_0x3c8d('0x36')]:_0x42cc0c['model'];if(!_0x175ec7['query'][_0x3c8d('0x38')](_0x3c8d('0x39'))){_0x64a726[_0x3c8d('0x20')]=qs[_0x3c8d('0x20')](_0x175ec7[_0x3c8d('0x32')][_0x3c8d('0x20')]);_0x64a726[_0x3c8d('0x3a')]=qs['offset'](_0x175ec7[_0x3c8d('0x32')][_0x3c8d('0x3a')]);}_0x64a726[_0x3c8d('0x3b')]=qs[_0x3c8d('0x3c')](_0x175ec7['query'][_0x3c8d('0x3c')]);_0x64a726[_0x3c8d('0x41')]=qs[_0x3c8d('0x3d')](_[_0x3c8d('0x3e')](_0x175ec7[_0x3c8d('0x32')],_0x42cc0c[_0x3c8d('0x3d')]));_0x64a726[_0x3c8d('0x69')]=!![];if(_0x175ec7[_0x3c8d('0x32')][_0x3c8d('0x3f')]){_0x64a726[_0x3c8d('0x41')]=_[_0x3c8d('0x40')](_0x64a726[_0x3c8d('0x41')],{'$or':_[_0x3c8d('0x2e')](_0x64a726['attributes'],function(_0x4257f4){var _0x35cae8={};_0x35cae8[_0x4257f4]={'$like':'%'+_0x175ec7[_0x3c8d('0x32')][_0x3c8d('0x3f')]+'%'};return _0x35cae8;})});}_0x64a726=_[_0x3c8d('0x40')]({},_0x64a726,_0x175ec7[_0x3c8d('0x6a')]);return _0x4a6b22[_0x3c8d('0x63')](_0x64a726);}})[_0x3c8d('0x26')](respondWithResult(_0x335cbc,null))[_0x3c8d('0x43')](handleError(_0x335cbc,null));};exports['getContactsCsv']=function(_0x52fff5,_0x249a63,_0x3a8ca3){var _0x3361e1;var _0x2641bc;var _0x1cd24a;var _0x5411b4=_0x52fff5[_0x3c8d('0x45')]['id'];csv_results=[];return db[_0x3c8d('0x6b')][_0x3c8d('0x6c')]({'attributes':['id',_0x3c8d('0x2b')],'raw':!![],'order':['OrderBy']})[_0x3c8d('0x26')](function(_0x321f75){_0x3361e1=_0x321f75;var _0x521e13=_['keys'](db[_0x3c8d('0x59')]['rawAttributes']);return db[_0x3c8d('0x64')][_0x3c8d('0x6c')]({'raw':!![],'attributes':['id',_0x3c8d('0x6d')]})[_0x3c8d('0x26')](function(_0x59f1e0){_0x2641bc=_0x59f1e0;var _0x4d0055=squel[_0x3c8d('0x6e')]()['fields'](_0x521e13)[_0x3c8d('0x6f')](_0x3c8d('0x70'),'c')[_0x3c8d('0x41')](_0x3c8d('0x71'),_0x5411b4)['where'](_0x3c8d('0x72'))['distinct']();for(var _0x497dec=0x0;_0x497dec<_0x2641bc['length'];_0x497dec++){_0x4d0055[_0x3c8d('0x73')](_0x3c8d('0x74')+_0x2641bc[_0x497dec]['id'],_0x3c8d('0x75')+_0x2641bc[_0x497dec][_0x3c8d('0x6d')]);}for(var _0x497dec=0x0;_0x497dec<_0x3361e1['length'];_0x497dec++){_0x4d0055[_0x3c8d('0x73')](squel[_0x3c8d('0x6e')]()[_0x3c8d('0x73')](_0x3c8d('0x76'))['from'](_0x3c8d('0x77'))[_0x3c8d('0x41')](_0x3c8d('0x78'),_0x3361e1[_0x497dec]['id'])[_0x3c8d('0x41')]('CmContactId\x20=\x20c.id'),_0x3c8d('0x79')+_0x3361e1[_0x497dec][_0x3c8d('0x2b')]);_0x4d0055[_0x3c8d('0x73')](squel[_0x3c8d('0x6e')]()[_0x3c8d('0x73')](_0x3c8d('0x7a'))[_0x3c8d('0x6f')](_0x3c8d('0x77'))['where'](_0x3c8d('0x78'),_0x3361e1[_0x497dec]['id'])['where'](_0x3c8d('0x7b')),_0x3c8d('0x7c')+_0x3361e1[_0x497dec]['name']);}var _0x143da3=[];_0x143da3[_0x3c8d('0x5d')](_0x4d0055[_0x3c8d('0x7d')]());BPromise[_0x3c8d('0x5e')](_0x143da3,handleQuery)[_0x3c8d('0x26')](function(_0x1c21b3){handleQuery(_0x4d0055['toString']());var _0x393b73=csv_results[0x0];if(!_[_0x3c8d('0x7e')](_0x393b73)){var _0x4cb079=toCsv(_0x393b73);var _0x17dff9=Date[_0x3c8d('0x7f')]();fs['writeFileSync'](util['format'](_0x3c8d('0x80'),_0x5411b4,_0x17dff9),_0x4cb079);_0x249a63['setHeader'](_0x3c8d('0x81'),_0x3c8d('0x82')+util[_0x3c8d('0x67')]('list_%d_%s.csv',_0x5411b4,_0x17dff9));_0x249a63[_0x3c8d('0x83')]('Content-type',_0x3c8d('0x84'));return _0x249a63['download'](util[_0x3c8d('0x67')](_0x3c8d('0x80'),_0x5411b4,_0x17dff9));}else{return _0x249a63[_0x3c8d('0x1b')](0xcc);}});});});};exports[_0x3c8d('0x85')]=function(_0x5ee088,_0x227004,_0x53de8e){var _0x26ec98;delete _0x5ee088[_0x3c8d('0x48')]['id'];return db[_0x3c8d('0x2f')][_0x3c8d('0x53')]({'where':{'id':_0x5ee088[_0x3c8d('0x45')]['id']}})[_0x3c8d('0x26')](handleEntityNotFound(_0x227004,null))[_0x3c8d('0x26')](function(_0x18c974){if(_0x18c974){return db[_0x3c8d('0x86')][_0x3c8d('0x87')](function(_0x1c8f20){return db[_0x3c8d('0x64')][_0x3c8d('0x47')](_0x5ee088['body'],{'transaction':_0x1c8f20})[_0x3c8d('0x26')](function(_0x43e416){_0x26ec98=_0x43e416;return _0x18c974[_0x3c8d('0x88')](_0x43e416,{'transaction':_0x1c8f20});})[_0x3c8d('0x26')](function(){var _0x3b27eb={'type':db[_0x3c8d('0x89')]['TEXT'],'transaction':_0x1c8f20};switch(_0x5ee088[_0x3c8d('0x48')]['type']){case'text':_0x3b27eb[_0x3c8d('0x8a')]=db[_0x3c8d('0x89')][_0x3c8d('0x8b')];break;case _0x3c8d('0x8c'):_0x3b27eb[_0x3c8d('0x8a')]=db[_0x3c8d('0x89')]['INTEGER'];break;case'switch':_0x3b27eb[_0x3c8d('0x8a')]=db[_0x3c8d('0x89')][_0x3c8d('0x8d')];_0x3b27eb[_0x3c8d('0x8e')]=![];break;default:}return db[_0x3c8d('0x86')][_0x3c8d('0x8f')]['addColumn'](_0x3c8d('0x70'),util[_0x3c8d('0x67')](_0x3c8d('0x90'),_0x26ec98['id']),_0x3b27eb);})[_0x3c8d('0x26')](function(){return _0x26ec98;});});}})[_0x3c8d('0x26')](respondWithResult(_0x227004,null))['catch'](handleError(_0x227004,null));};exports[_0x3c8d('0x91')]=function(_0x266953,_0x132159,_0x3b84ef){var _0x42cc23={};var _0x49d1da={};var _0x6b375b;var _0x3cb952;return db[_0x3c8d('0x2f')][_0x3c8d('0x53')]({'where':{'id':_0x266953[_0x3c8d('0x45')]['id']}})['then'](handleEntityNotFound(_0x132159,null))['then'](function(_0xe0ab26){if(_0xe0ab26){_0x6b375b=_0xe0ab26;_0x49d1da[_0x3c8d('0x31')]=_[_0x3c8d('0x33')](db['CmCustomField'][_0x3c8d('0x54')]);_0x49d1da[_0x3c8d('0x32')]=_['keys'](_0x266953[_0x3c8d('0x32')]);_0x49d1da[_0x3c8d('0x3d')]=_[_0x3c8d('0x34')](_0x49d1da[_0x3c8d('0x31')],_0x49d1da[_0x3c8d('0x32')]);_0x42cc23['attributes']=_['intersection'](_0x49d1da[_0x3c8d('0x31')],qs['fields'](_0x266953['query'][_0x3c8d('0x35')]));_0x42cc23[_0x3c8d('0x36')]=_0x42cc23[_0x3c8d('0x36')][_0x3c8d('0x37')]?_0x42cc23[_0x3c8d('0x36')]:_0x49d1da['model'];_0x42cc23[_0x3c8d('0x3b')]=qs['sort'](_0x266953['query'][_0x3c8d('0x3c')]);_0x42cc23['where']=qs[_0x3c8d('0x3d')](_['pick'](_0x266953[_0x3c8d('0x32')],_0x49d1da[_0x3c8d('0x3d')]));_0x42cc23[_0x3c8d('0x41')]=_[_0x3c8d('0x40')](_0x42cc23[_0x3c8d('0x41')],{'$or':[{'ListId':_0xe0ab26['id']},{'ListId':null}]});if(_0x266953['query']['filter']){_0x42cc23[_0x3c8d('0x41')]=_[_0x3c8d('0x40')](_0x42cc23['where'],{'$or':_['map'](_0x42cc23[_0x3c8d('0x36')],function(_0x43d342){var _0x316c84={};_0x316c84[_0x43d342]={'$like':'%'+_0x266953[_0x3c8d('0x32')]['filter']+'%'};return _0x316c84;})});}_0x42cc23=_[_0x3c8d('0x40')]({},_0x42cc23,_0x266953[_0x3c8d('0x6a')]);return db[_0x3c8d('0x64')]['findAndCountAll'](_0x42cc23);}})[_0x3c8d('0x26')](respondWithResult(_0x132159,null))[_0x3c8d('0x43')](handleError(_0x132159,null));};exports[_0x3c8d('0x92')]=function(_0x116c03,_0x94d3d6){return db[_0x3c8d('0x64')][_0x3c8d('0x93')]({'where':{'ListId':null}})[_0x3c8d('0x26')](handleEntityNotFound(_0x94d3d6,null))[_0x3c8d('0x26')](function(_0x47ff46){return _0x47ff46;})[_0x3c8d('0x26')](respondWithResult(_0x94d3d6,null))['catch'](handleError(_0x94d3d6,null));};exports[_0x3c8d('0x94')]=function(_0xddf3cb,_0x5031a1,_0x30df58){return db[_0x3c8d('0x2f')]['find']({'where':{'id':_0xddf3cb['params']['id']}})[_0x3c8d('0x26')](handleEntityNotFound(_0x5031a1,null))[_0x3c8d('0x26')](function(_0x3c0e2f){if(_0x3c0e2f){return _0x3c0e2f['addAgents'](_0xddf3cb[_0x3c8d('0x48')][_0x3c8d('0x95')],_[_0x3c8d('0x5f')](_0xddf3cb[_0x3c8d('0x48')],['ids','id'])||{})['spread'](function(_0x2113fe){for(var _0x10c36c=0x0;_0x10c36c<_0xddf3cb[_0x3c8d('0x48')][_0x3c8d('0x95')][_0x3c8d('0x37')];_0x10c36c+=0x1){socket[_0x3c8d('0x96')]('userCmList:save',{'UserId':Number(_0xddf3cb[_0x3c8d('0x48')][_0x3c8d('0x95')][_0x10c36c]),'CmListId':Number(_0xddf3cb[_0x3c8d('0x45')]['id'])});}return _0x2113fe;});}})['then'](respondWithResult(_0x5031a1,null))[_0x3c8d('0x43')](handleError(_0x5031a1,null));};exports[_0x3c8d('0x97')]=function(_0x2e77ad,_0x10b43e,_0x4ceeea){return db['CmList'][_0x3c8d('0x46')]({'where':{'id':_0x2e77ad[_0x3c8d('0x45')]['id']}})[_0x3c8d('0x26')](handleEntityNotFound(_0x10b43e,null))[_0x3c8d('0x26')](function(_0x4f25cf){if(_0x4f25cf){return _0x4f25cf[_0x3c8d('0x97')](_0x2e77ad[_0x3c8d('0x32')][_0x3c8d('0x95')])[_0x3c8d('0x26')](function(){if(_[_0x3c8d('0x5b')](_0x2e77ad[_0x3c8d('0x32')][_0x3c8d('0x95')])){for(var _0xdb5a83=0x0;_0xdb5a83<_0x2e77ad[_0x3c8d('0x32')][_0x3c8d('0x95')][_0x3c8d('0x37')];_0xdb5a83+=0x1){socket[_0x3c8d('0x96')](_0x3c8d('0x98'),{'UserId':Number(_0x2e77ad['query'][_0x3c8d('0x95')][_0xdb5a83]),'CmListId':Number(_0x2e77ad['params']['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0x2e77ad['query'][_0x3c8d('0x95')]),'CmListId':Number(_0x2e77ad[_0x3c8d('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0x10b43e,null))[_0x3c8d('0x43')](handleError(_0x10b43e,null));};exports[_0x3c8d('0x99')]=function(_0x3a1a0e,_0x5ba349,_0x381987){var _0x3a52f2={};var _0x379eec={};var _0x2b3f97;var _0x3681ac;return db['CmList'][_0x3c8d('0x53')]({'where':{'id':_0x3a1a0e[_0x3c8d('0x45')]['id']}})['then'](handleEntityNotFound(_0x5ba349,null))[_0x3c8d('0x26')](function(_0x41584a){if(_0x41584a){_0x2b3f97=_0x41584a;_0x379eec['model']=_[_0x3c8d('0x33')](db[_0x3c8d('0x9a')][_0x3c8d('0x54')]);_0x379eec['query']=_[_0x3c8d('0x33')](_0x3a1a0e['query']);_0x379eec['filters']=_[_0x3c8d('0x34')](_0x379eec['model'],_0x379eec[_0x3c8d('0x32')]);_0x3a52f2[_0x3c8d('0x36')]=_[_0x3c8d('0x34')](_0x379eec[_0x3c8d('0x31')],qs[_0x3c8d('0x35')](_0x3a1a0e[_0x3c8d('0x32')][_0x3c8d('0x35')]));_0x3a52f2['attributes']=_0x3a52f2[_0x3c8d('0x36')]['length']?_0x3a52f2[_0x3c8d('0x36')]:_0x379eec[_0x3c8d('0x31')];_0x3a52f2[_0x3c8d('0x3b')]=qs[_0x3c8d('0x3c')](_0x3a1a0e[_0x3c8d('0x32')][_0x3c8d('0x3c')]);_0x3a52f2['where']=qs[_0x3c8d('0x3d')](_[_0x3c8d('0x3e')](_0x3a1a0e[_0x3c8d('0x32')],_0x379eec[_0x3c8d('0x3d')]));if(_0x3a1a0e[_0x3c8d('0x32')][_0x3c8d('0x3f')]){_0x3a52f2[_0x3c8d('0x41')]=_[_0x3c8d('0x40')](_0x3a52f2[_0x3c8d('0x41')],{'$or':_[_0x3c8d('0x2e')](_0x3a52f2[_0x3c8d('0x36')],function(_0x48c2ff){var _0x2d6218={};_0x2d6218[_0x48c2ff]={'$like':'%'+_0x3a1a0e[_0x3c8d('0x32')][_0x3c8d('0x3f')]+'%'};return _0x2d6218;})});}_0x3a52f2=_['merge']({},_0x3a52f2,_0x3a1a0e[_0x3c8d('0x6a')]);return _0x2b3f97[_0x3c8d('0x99')](_0x3a52f2);}})[_0x3c8d('0x26')](function(_0x12cc3c){if(_0x12cc3c){_0x3681ac=_0x12cc3c['length'];if(!_0x3a1a0e[_0x3c8d('0x32')]['hasOwnProperty'](_0x3c8d('0x39'))){_0x3a52f2[_0x3c8d('0x20')]=qs['limit'](_0x3a1a0e[_0x3c8d('0x32')][_0x3c8d('0x20')]);_0x3a52f2[_0x3c8d('0x3a')]=qs[_0x3c8d('0x3a')](_0x3a1a0e['query'][_0x3c8d('0x3a')]);}return _0x2b3f97['getAgents'](_0x3a52f2);}})[_0x3c8d('0x26')](function(_0xdaf52){if(_0xdaf52){return _0xdaf52?{'count':_0x3681ac,'rows':_0xdaf52}:null;}})['then'](respondWithResult(_0x5ba349,null))[_0x3c8d('0x43')](handleError(_0x5ba349,null));};function handleQuery(_0x875179){logger[_0x3c8d('0x9b')](_0x875179);return db[_0x3c8d('0x86')][_0x3c8d('0x32')](_0x875179)[_0x3c8d('0x9c')](function(_0x116cc2){csv_results[_0x3c8d('0x5d')](_0x116cc2);})['catch'](function(_0x1a3c79){logger[_0x3c8d('0x4e')](_0x1a3c79[_0x3c8d('0x61')]);});} \ No newline at end of file +var _0x723c=['CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','customField_','alias','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','number','switch','BOOLEAN','defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','undefined','count','offset','limit','json','reject','save','update','destroy','then','get','Lists','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','CmList','includeAll','include','findAll','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','describe','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','rows','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','omit','success','dataValues','message','getContacts'];(function(_0x415727,_0xb2e02c){var _0x50f623=function(_0xe269ad){while(--_0xe269ad){_0x415727['push'](_0x415727['shift']());}};_0x50f623(++_0xb2e02c);}(_0x723c,0x17b));var _0xc723=function(_0xa1841f,_0x296e3d){_0xa1841f=_0xa1841f-0x0;var _0x50a86e=_0x723c[_0xa1841f];return _0x50a86e;};'use strict';var emlformat=require(_0xc723('0x0'));var rimraf=require(_0xc723('0x1'));var zipdir=require(_0xc723('0x2'));var jsonpatch=require(_0xc723('0x3'));var rp=require(_0xc723('0x4'));var moment=require(_0xc723('0x5'));var BPromise=require(_0xc723('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc723('0x7'));var sox=require('sox');var csv=require(_0xc723('0x8'));var ejs=require(_0xc723('0x9'));var fs=require('fs');var fs_extra=require(_0xc723('0xa'));var _=require(_0xc723('0xb'));var squel=require('squel');var crypto=require(_0xc723('0xc'));var jsforce=require(_0xc723('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc723('0x8'));var querystring=require(_0xc723('0xe'));var Papa=require(_0xc723('0xf'));var Redis=require(_0xc723('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc723('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc723('0x12'))(_0xc723('0x13'));var utils=require(_0xc723('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc723('0x15'));var db=require(_0xc723('0x16'))['db'];var csv_results;config[_0xc723('0x17')]=_['defaults'](config[_0xc723('0x17')],{'host':_0xc723('0x18'),'port':0x18eb});var socket=require(_0xc723('0x19'))(new Redis(config[_0xc723('0x17')]));require(_0xc723('0x1a'))[_0xc723('0x1b')](socket);function respondWithStatusCode(_0x8b23fc,_0x4018c0){_0x4018c0=_0x4018c0||0xcc;return function(_0x50c04f){if(_0x50c04f){return _0x8b23fc[_0xc723('0x1c')](_0x4018c0);}return _0x8b23fc[_0xc723('0x1d')](_0x4018c0)[_0xc723('0x1e')]();};}function respondWithResult(_0x4ddc79,_0x2e73a2){_0x2e73a2=_0x2e73a2||0xc8;return function(_0x27e0d9){if(_0x27e0d9){return _0x4ddc79['status'](_0x2e73a2)['json'](_0x27e0d9);}};}function respondWithFilteredResult(_0x27504b,_0x4ad2fb){return function(_0x3a6b9c){if(_0x3a6b9c){var _0x2fe4e4=typeof _0x4ad2fb['offset']===_0xc723('0x1f')&&typeof _0x4ad2fb['limit']===_0xc723('0x1f');var _0xf5ef83=_0x3a6b9c[_0xc723('0x20')];var _0xe61c53=_0x2fe4e4?0x0:_0x4ad2fb[_0xc723('0x21')];var _0x211de2=_0x2fe4e4?_0x3a6b9c[_0xc723('0x20')]:_0x4ad2fb['offset']+_0x4ad2fb[_0xc723('0x22')];var _0x5104ec;if(_0x211de2>=_0xf5ef83){_0x211de2=_0xf5ef83;_0x5104ec=0xc8;}else{_0x5104ec=0xce;}_0x27504b[_0xc723('0x1d')](_0x5104ec);return _0x27504b['set']('Content-Range',_0xe61c53+'-'+_0x211de2+'/'+_0xf5ef83)[_0xc723('0x23')](_0x3a6b9c);}return null;};}function patchUpdates(_0x20c552){return function(_0x8de455){try{jsonpatch['apply'](_0x8de455,_0x20c552,!![]);}catch(_0x4b5b96){return BPromise[_0xc723('0x24')](_0x4b5b96);}return _0x8de455[_0xc723('0x25')]();};}function saveUpdates(_0x552f51,_0x3c582b){return function(_0x325961){if(_0x325961){return _0x325961[_0xc723('0x26')](_0x552f51)['then'](function(_0x32d26f){return _0x32d26f;});}return null;};}function removeEntity(_0x1a13d1,_0x5f3398){return function(_0x597f0e){if(_0x597f0e){return _0x597f0e[_0xc723('0x27')]()[_0xc723('0x28')](function(){var _0x1744cd=_0x597f0e[_0xc723('0x29')]({'plain':!![]});var _0x3957eb=_0xc723('0x2a');return db[_0xc723('0x2b')][_0xc723('0x27')]({'where':{'type':_0x3957eb,'resourceId':_0x1744cd['id']}})[_0xc723('0x28')](function(){return _0x597f0e;});})[_0xc723('0x28')](function(){_0x1a13d1[_0xc723('0x1d')](0xcc)[_0xc723('0x1e')]();});}};}function handleEntityNotFound(_0x5f234a,_0x48d7bb){return function(_0x4f35aa){if(!_0x4f35aa){_0x5f234a[_0xc723('0x1c')](0x194);}return _0x4f35aa;};}function handleError(_0xb65314,_0x15c7e3){_0x15c7e3=_0x15c7e3||0x1f4;return function(_0x4cc1d4){logger[_0xc723('0x2c')](_0x4cc1d4[_0xc723('0x2d')]);if(_0x4cc1d4['name']){delete _0x4cc1d4[_0xc723('0x2e')];}_0xb65314[_0xc723('0x1d')](_0x15c7e3)['send'](_0x4cc1d4);};}exports[_0xc723('0x2f')]=function(_0x1e2c47,_0x5a2ffd){var _0x156fbe={},_0x1229ac={},_0x11f85e={'count':0x0,'rows':[]};var _0x2d967c=_['map'](db['CmList'][_0xc723('0x30')],function(_0x265127){return{'name':_0x265127[_0xc723('0x31')],'type':_0x265127[_0xc723('0x32')]['key']};});_0x1229ac[_0xc723('0x33')]=_['map'](_0x2d967c,_0xc723('0x2e'));_0x1229ac['query']=_[_0xc723('0x34')](_0x1e2c47[_0xc723('0x35')]);_0x1229ac[_0xc723('0x36')]=_[_0xc723('0x37')](_0x1229ac[_0xc723('0x33')],_0x1229ac[_0xc723('0x35')]);_0x156fbe['attributes']=_[_0xc723('0x37')](_0x1229ac[_0xc723('0x33')],qs['fields'](_0x1e2c47[_0xc723('0x35')][_0xc723('0x38')]));_0x156fbe[_0xc723('0x39')]=_0x156fbe[_0xc723('0x39')]['length']?_0x156fbe['attributes']:_0x1229ac[_0xc723('0x33')];if(!_0x1e2c47[_0xc723('0x35')]['hasOwnProperty'](_0xc723('0x3a'))){_0x156fbe[_0xc723('0x22')]=qs[_0xc723('0x22')](_0x1e2c47[_0xc723('0x35')][_0xc723('0x22')]);_0x156fbe[_0xc723('0x21')]=qs['offset'](_0x1e2c47['query'][_0xc723('0x21')]);}_0x156fbe[_0xc723('0x3b')]=qs[_0xc723('0x3c')](_0x1e2c47['query']['sort']);_0x156fbe['where']=qs['filters'](_[_0xc723('0x3d')](_0x1e2c47[_0xc723('0x35')],_0x1229ac[_0xc723('0x36')]),_0x2d967c);if(_0x1e2c47[_0xc723('0x35')][_0xc723('0x3e')]){_0x156fbe[_0xc723('0x3f')]=_[_0xc723('0x40')](_0x156fbe[_0xc723('0x3f')],{'$or':_[_0xc723('0x41')](_0x2d967c,function(_0x29eb8e){if(_0x29eb8e[_0xc723('0x32')]!==_0xc723('0x42')){var _0x3a1b83={};_0x3a1b83[_0x29eb8e['name']]={'$like':'%'+_0x1e2c47[_0xc723('0x35')][_0xc723('0x3e')]+'%'};return _0x3a1b83;}})});}_0x156fbe=_[_0xc723('0x40')]({},_0x156fbe,_0x1e2c47[_0xc723('0x43')]);var _0x220927={'where':_0x156fbe[_0xc723('0x3f')]};return db[_0xc723('0x44')]['count'](_0x220927)['then'](function(_0x3318f4){_0x11f85e[_0xc723('0x20')]=_0x3318f4;if(_0x1e2c47[_0xc723('0x35')][_0xc723('0x45')]){_0x156fbe[_0xc723('0x46')]=[{'all':!![]}];}return db[_0xc723('0x44')][_0xc723('0x47')](_0x156fbe);})[_0xc723('0x28')](function(_0x4cac6c){_0x11f85e['rows']=_0x4cac6c;return _0x11f85e;})[_0xc723('0x28')](respondWithFilteredResult(_0x5a2ffd,_0x156fbe))['catch'](handleError(_0x5a2ffd,null));};exports[_0xc723('0x48')]=function(_0x4e289d,_0x107c6c){var _0x23a7b7={'raw':![],'where':{'id':_0x4e289d[_0xc723('0x49')]['id']}},_0x598580={};_0x598580['model']=_['keys'](db[_0xc723('0x44')]['rawAttributes']);_0x598580[_0xc723('0x35')]=_[_0xc723('0x34')](_0x4e289d[_0xc723('0x35')]);_0x598580[_0xc723('0x36')]=_['intersection'](_0x598580['model'],_0x598580[_0xc723('0x35')]);_0x23a7b7[_0xc723('0x39')]=_[_0xc723('0x37')](_0x598580[_0xc723('0x33')],qs[_0xc723('0x38')](_0x4e289d[_0xc723('0x35')]['fields']));_0x23a7b7[_0xc723('0x39')]=_0x23a7b7['attributes'][_0xc723('0x4a')]?_0x23a7b7[_0xc723('0x39')]:_0x598580['model'];if(_0x4e289d[_0xc723('0x35')][_0xc723('0x45')]){_0x23a7b7[_0xc723('0x46')]=[{'all':!![]}];}_0x23a7b7=_[_0xc723('0x40')]({},_0x23a7b7,_0x4e289d[_0xc723('0x43')]);return db[_0xc723('0x44')]['find'](_0x23a7b7)[_0xc723('0x28')](handleEntityNotFound(_0x107c6c,null))[_0xc723('0x28')](respondWithResult(_0x107c6c,null))['catch'](handleError(_0x107c6c,null));};exports[_0xc723('0x4b')]=function(_0x31d576,_0x57936a){return db['CmList'][_0xc723('0x4b')](_0x31d576[_0xc723('0x4c')],{})[_0xc723('0x28')](function(_0x2c03c3){var _0x3a3595=_0x31d576[_0xc723('0x4d')][_0xc723('0x29')]({'plain':!![]});if(!_0x3a3595)throw new Error(_0xc723('0x4e'));if(_0x3a3595[_0xc723('0x4f')]===_0xc723('0x4d')){var _0x4c9e30=_0x2c03c3[_0xc723('0x29')]({'plain':!![]});var _0xabaa74=_0xc723('0x2a');return db[_0xc723('0x50')][_0xc723('0x51')]({'where':{'name':_0xabaa74,'userProfileId':_0x3a3595[_0xc723('0x52')]},'raw':!![]})[_0xc723('0x28')](function(_0x2901bb){if(_0x2901bb&&_0x2901bb['autoAssociation']===0x0){return db[_0xc723('0x2b')][_0xc723('0x4b')]({'name':_0x4c9e30[_0xc723('0x2e')],'resourceId':_0x4c9e30['id'],'type':_0x2901bb[_0xc723('0x2e')],'sectionId':_0x2901bb['id']},{})[_0xc723('0x28')](function(){return _0x2c03c3;});}else{return _0x2c03c3;}})['catch'](function(_0x4c408d){logger[_0xc723('0x2c')](_0xc723('0x53'),_0x4c408d);throw _0x4c408d;});}return _0x2c03c3;})['then'](respondWithResult(_0x57936a,0xc9))['catch'](handleError(_0x57936a,null));};exports[_0xc723('0x26')]=function(_0x2ef658,_0x1d1db9){if(_0x2ef658['body']['id']){delete _0x2ef658['body']['id'];}return db[_0xc723('0x44')][_0xc723('0x51')]({'where':{'id':_0x2ef658[_0xc723('0x49')]['id']}})[_0xc723('0x28')](handleEntityNotFound(_0x1d1db9,null))['then'](saveUpdates(_0x2ef658['body'],null))[_0xc723('0x28')](respondWithResult(_0x1d1db9,null))['catch'](handleError(_0x1d1db9,null));};exports[_0xc723('0x27')]=function(_0x347bfe,_0x417464){return db['CmList'][_0xc723('0x51')]({'where':{'id':_0x347bfe[_0xc723('0x49')]['id']}})[_0xc723('0x28')](handleEntityNotFound(_0x417464,null))[_0xc723('0x28')](removeEntity(_0x417464,null))[_0xc723('0x54')](handleError(_0x417464,null));};exports['describe']=function(_0xed72f2,_0x946bb9){return db[_0xc723('0x44')][_0xc723('0x55')]()[_0xc723('0x28')](respondWithResult(_0x946bb9,null))[_0xc723('0x54')](handleError(_0x946bb9,null));};exports[_0xc723('0x56')]=function(_0x4f6755,_0x17737d,_0x57dcab){if(_0x4f6755['body']['id']){delete _0x4f6755['body']['id'];}return db['CmList'][_0xc723('0x51')]({'where':{'id':_0x4f6755[_0xc723('0x49')]['id']}})[_0xc723('0x28')](handleEntityNotFound(_0x17737d,null))[_0xc723('0x28')](function(_0x2da95c){if(_0x2da95c){_0x4f6755[_0xc723('0x4c')]['ListId']=_0x2da95c['id'];return db[_0xc723('0x57')][_0xc723('0x4b')](_0x4f6755[_0xc723('0x4c')]);}})[_0xc723('0x28')](respondWithResult(_0x17737d,null))[_0xc723('0x54')](handleError(_0x17737d,null));};exports[_0xc723('0x58')]=function(_0x43c055,_0x432896,_0x58b823){var _0x11c14e={'raw':![],'where':{}};var _0xa4533c={};var _0x1ef177={'count':0x0,'rows':[]};return db[_0xc723('0x44')][_0xc723('0x59')]({'where':{'id':_0x43c055['params']['id']}})[_0xc723('0x28')](handleEntityNotFound(_0x432896,null))[_0xc723('0x28')](function(_0x2d9cc8){if(_0x2d9cc8){_0xa4533c['model']=_[_0xc723('0x34')](db[_0xc723('0x57')][_0xc723('0x30')]);_0xa4533c[_0xc723('0x35')]=_[_0xc723('0x34')](_0x43c055['query']);_0xa4533c[_0xc723('0x36')]=_['intersection'](_0xa4533c[_0xc723('0x33')],_0xa4533c[_0xc723('0x35')]);_0x11c14e[_0xc723('0x39')]=_[_0xc723('0x37')](_0xa4533c['model'],qs[_0xc723('0x38')](_0x43c055['query'][_0xc723('0x38')]));_0x11c14e[_0xc723('0x39')]=_0x11c14e[_0xc723('0x39')][_0xc723('0x4a')]?_0x11c14e['attributes']:_0xa4533c[_0xc723('0x33')];if(!_0x43c055['query'][_0xc723('0x5a')](_0xc723('0x3a'))){_0x11c14e[_0xc723('0x22')]=qs[_0xc723('0x22')](_0x43c055['query'][_0xc723('0x22')]);_0x11c14e[_0xc723('0x21')]=qs[_0xc723('0x21')](_0x43c055[_0xc723('0x35')]['offset']);}_0x11c14e[_0xc723('0x3b')]=qs['sort'](_0x43c055[_0xc723('0x35')][_0xc723('0x3c')]);_0x11c14e[_0xc723('0x3f')]=qs[_0xc723('0x36')](_[_0xc723('0x3d')](_0x43c055[_0xc723('0x35')],_0xa4533c[_0xc723('0x36')]));_0x11c14e[_0xc723('0x3f')]['ListId']=_0x2d9cc8['id'];if(_0x43c055['query'][_0xc723('0x3e')]){_0x11c14e[_0xc723('0x3f')]=_['merge'](_0x11c14e['where'],{'$or':_[_0xc723('0x41')](_0x11c14e['attributes'],function(_0x1b3fc5){var _0x14130f={};_0x14130f[_0x1b3fc5]={'$like':'%'+_0x43c055[_0xc723('0x35')][_0xc723('0x3e')]+'%'};return _0x14130f;})});}_0x11c14e=_['merge']({},_0x11c14e,_0x43c055['options']);return db[_0xc723('0x57')][_0xc723('0x20')]({'where':_0x11c14e[_0xc723('0x3f')]})[_0xc723('0x28')](function(_0x47eeed){_0x1ef177[_0xc723('0x20')]=_0x47eeed;if(_0x43c055[_0xc723('0x35')]['includeAll']){_0x11c14e[_0xc723('0x46')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x11c14e);})['then'](function(_0x323990){_0x1ef177[_0xc723('0x5b')]=_0x323990;return _0x1ef177;});}})[_0xc723('0x28')](respondWithFilteredResult(_0x432896,_0x11c14e))[_0xc723('0x54')](handleError(_0x432896,null));};exports[_0xc723('0x5c')]=function(_0x464e22,_0xa6b83d,_0x42eef0){return db['CmList']['find']({'where':{'id':_0x464e22[_0xc723('0x49')]['id']}})[_0xc723('0x28')](handleEntityNotFound(_0xa6b83d,null))[_0xc723('0x28')](function(_0x404587){if(_0x404587){return _0x404587[_0xc723('0x5c')](_0x464e22[_0xc723('0x35')][_0xc723('0x5d')]);}})['then'](respondWithStatusCode(_0xa6b83d,null))[_0xc723('0x54')](handleError(_0xa6b83d,null));};exports[_0xc723('0x5e')]=function(_0xd3c339,_0x527192,_0x492e70){return db[_0xc723('0x44')]['find']({'where':{'id':_0xd3c339[_0xc723('0x49')]['id']}})[_0xc723('0x28')](handleEntityNotFound(_0x527192,null))[_0xc723('0x28')](function(_0x4ff269){if(_0x4ff269){var _0x2c2710=[];var _0x4117b8={'success':[],'errors':[]};return db[_0xc723('0x5f')]['describe']()[_0xc723('0x28')](function(_0x340f3c){if(_0xd3c339[_0xc723('0x4c')][_0xc723('0x60')]&&_[_0xc723('0x61')](_0xd3c339[_0xc723('0x4c')][_0xc723('0x60')])){if(_0xd3c339[_0xc723('0x4c')][_0xc723('0x60')][_0xc723('0x4a')]){_0xd3c339[_0xc723('0x4c')][_0xc723('0x60')]=_0xd3c339[_0xc723('0x4c')][_0xc723('0x60')]['join'](';')+';';}else{_0xd3c339[_0xc723('0x4c')][_0xc723('0x60')]=null;}}else{_0xd3c339['body'][_0xc723('0x60')]=null;}if(_0xd3c339[_0xc723('0x4c')]&&_['isArray'](_0xd3c339[_0xc723('0x4c')])){for(var _0xebb3d6=0x0;_0xebb3d6<_0xd3c339[_0xc723('0x4c')][_0xc723('0x4a')];_0xebb3d6+=0x1){_0xd3c339[_0xc723('0x4c')][_0xebb3d6]['ListId']=_0xd3c339[_0xc723('0x49')]['id'];_0x2c2710[_0xc723('0x62')](_0xd3c339[_0xc723('0x4c')][_0xebb3d6]);}return BPromise['each'](_0x2c2710,function(_0x317ee2){return db[_0xc723('0x5f')][_0xc723('0x4b')](_[_0xc723('0x63')](_0x317ee2,[_0xc723('0x5d'),'id'])||{},{'fields':_['keys'](_0x340f3c),'raw':!![]})[_0xc723('0x28')](function(_0x1e502e){_0x4117b8[_0xc723('0x64')][_0xc723('0x62')](_0x1e502e[_0xc723('0x65')]);})['catch'](function(_0x4b79bd){_0x4117b8['errors'][_0xc723('0x62')]({'data':_0x317ee2,'error':_0x4b79bd[_0xc723('0x66')]});});})[_0xc723('0x28')](function(_0x67bd83){return _0x4117b8;})['catch'](function(_0x5be7af){return _0x5be7af;});}else{_0x527192['status'](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0xc723('0x28')](respondWithResult(_0x527192,null))[_0xc723('0x54')](handleError(_0x527192,null));};exports[_0xc723('0x67')]=function(_0x2f48d8,_0x13bb55,_0xc7e097){var _0x52c615;return db['CmList'][_0xc723('0x51')]({'where':{'id':_0x2f48d8[_0xc723('0x49')]['id']},'include':[{'model':db[_0xc723('0x68')],'as':_0xc723('0x69')}]})[_0xc723('0x28')](handleEntityNotFound(_0x13bb55,null))[_0xc723('0x28')](function(_0x50c62c){if(_0x50c62c){_0x52c615=_0x50c62c;return db[_0xc723('0x5f')][_0xc723('0x30')];}})[_0xc723('0x28')](function(_0x214a4b){if(_0x214a4b){var _0x248161={};var _0x45f063={};_0x45f063['model']=_[_0xc723('0x6a')](_['keys'](_0x214a4b),_['map'](_0x52c615[_0xc723('0x69')],function(_0xa97bb4){return util[_0xc723('0x6b')](_0xc723('0x6c'),_0xa97bb4['id']);}));_0x45f063[_0xc723('0x35')]=_[_0xc723('0x34')](_0x2f48d8[_0xc723('0x35')]);_0x45f063['filters']=_['intersection'](_0x45f063['model'],_0x45f063[_0xc723('0x35')]);_0x248161[_0xc723('0x39')]=_[_0xc723('0x37')](_0x45f063['model'],qs['fields'](_0x2f48d8[_0xc723('0x35')][_0xc723('0x38')]));_0x248161[_0xc723('0x39')]=_0x248161[_0xc723('0x39')][_0xc723('0x4a')]?_0x248161[_0xc723('0x39')]:_0x45f063[_0xc723('0x33')];if(!_0x2f48d8[_0xc723('0x35')][_0xc723('0x5a')](_0xc723('0x3a'))){_0x248161['limit']=qs[_0xc723('0x22')](_0x2f48d8[_0xc723('0x35')]['limit']);_0x248161[_0xc723('0x21')]=qs[_0xc723('0x21')](_0x2f48d8[_0xc723('0x35')][_0xc723('0x21')]);}_0x248161[_0xc723('0x3b')]=qs['sort'](_0x2f48d8['query'][_0xc723('0x3c')]);_0x248161['where']=qs[_0xc723('0x36')](_[_0xc723('0x3d')](_0x2f48d8['query'],_0x45f063[_0xc723('0x36')]));_0x248161[_0xc723('0x6d')]=!![];if(_0x2f48d8[_0xc723('0x35')]['filter']){_0x248161[_0xc723('0x3f')]=_[_0xc723('0x40')](_0x248161['where'],{'$or':_[_0xc723('0x41')](_0x248161[_0xc723('0x39')],function(_0xaeb699){var _0x1c9b5a={};_0x1c9b5a[_0xaeb699]={'$like':'%'+_0x2f48d8[_0xc723('0x35')][_0xc723('0x3e')]+'%'};return _0x1c9b5a;})});}_0x248161=_[_0xc723('0x40')]({},_0x248161,_0x2f48d8[_0xc723('0x43')]);return _0x52c615[_0xc723('0x67')](_0x248161);}})[_0xc723('0x28')](respondWithResult(_0x13bb55,null))[_0xc723('0x54')](handleError(_0x13bb55,null));};exports[_0xc723('0x6e')]=function(_0x40c6d7,_0x379643,_0x442c78){var _0x440e41;var _0x471008;var _0x2a70fa;var _0x1da1a3=_0x40c6d7[_0xc723('0x49')]['id'];csv_results=[];return db[_0xc723('0x6f')][_0xc723('0x47')]({'attributes':['id',_0xc723('0x2e')],'raw':!![],'order':[_0xc723('0x70')]})[_0xc723('0x28')](function(_0x2da383){_0x440e41=_0x2da383;var _0x224f32=_[_0xc723('0x34')](db[_0xc723('0x5f')][_0xc723('0x30')]);return db[_0xc723('0x68')][_0xc723('0x47')]({'raw':!![],'attributes':['id','alias']})[_0xc723('0x28')](function(_0x2659fa){_0x471008=_0x2659fa;var _0x4a9c34=squel[_0xc723('0x71')]()[_0xc723('0x38')](_0x224f32)[_0xc723('0x72')](_0xc723('0x73'),'c')[_0xc723('0x3f')](_0xc723('0x74'),_0x1da1a3)[_0xc723('0x3f')](_0xc723('0x75'))[_0xc723('0x76')]();for(var _0x192839=0x0;_0x192839<_0x471008[_0xc723('0x4a')];_0x192839++){_0x4a9c34[_0xc723('0x77')]('c.cf_'+_0x471008[_0x192839]['id'],_0xc723('0x78')+_0x471008[_0x192839][_0xc723('0x79')]);}for(var _0x192839=0x0;_0x192839<_0x440e41[_0xc723('0x4a')];_0x192839++){_0x4a9c34[_0xc723('0x77')](squel[_0xc723('0x71')]()['field'](_0xc723('0x7a'))[_0xc723('0x72')](_0xc723('0x7b'))[_0xc723('0x3f')](_0xc723('0x7c'),_0x440e41[_0x192839]['id'])['where']('CmContactId\x20=\x20c.id'),_0xc723('0x7d')+_0x440e41[_0x192839][_0xc723('0x2e')]);_0x4a9c34[_0xc723('0x77')](squel[_0xc723('0x71')]()[_0xc723('0x77')](_0xc723('0x7e'))[_0xc723('0x72')]('cm_contact_has_items')[_0xc723('0x3f')]('ItemTypeId\x20=\x20?',_0x440e41[_0x192839]['id'])[_0xc723('0x3f')](_0xc723('0x7f')),_0xc723('0x80')+_0x440e41[_0x192839][_0xc723('0x2e')]);}var _0x5c7447=[];_0x5c7447[_0xc723('0x62')](_0x4a9c34[_0xc723('0x81')]());BPromise['each'](_0x5c7447,handleQuery)[_0xc723('0x28')](function(_0x141ea1){handleQuery(_0x4a9c34[_0xc723('0x81')]());var _0x3d062a=csv_results[0x0];if(!_[_0xc723('0x82')](_0x3d062a)){var _0x460738=toCsv(_0x3d062a);var _0x485246=Date[_0xc723('0x83')]();fs[_0xc723('0x84')](util['format'](_0xc723('0x85'),_0x1da1a3,_0x485246),_0x460738);_0x379643[_0xc723('0x86')](_0xc723('0x87'),_0xc723('0x88')+util[_0xc723('0x6b')]('list_%d_%s.csv',_0x1da1a3,_0x485246));_0x379643['setHeader'](_0xc723('0x89'),_0xc723('0x8a'));return _0x379643['download'](util['format']('/tmp/list_%d_%s.csv',_0x1da1a3,_0x485246));}else{return _0x379643[_0xc723('0x1c')](0xcc);}});});});};exports[_0xc723('0x8b')]=function(_0x586019,_0x1405bb,_0x35c667){var _0x1c3064;delete _0x586019[_0xc723('0x4c')]['id'];return db[_0xc723('0x44')]['findOne']({'where':{'id':_0x586019['params']['id']}})['then'](handleEntityNotFound(_0x1405bb,null))[_0xc723('0x28')](function(_0x40eb22){if(_0x40eb22){return db[_0xc723('0x8c')]['transaction'](function(_0xd7d7ff){return db[_0xc723('0x68')][_0xc723('0x4b')](_0x586019[_0xc723('0x4c')],{'transaction':_0xd7d7ff})[_0xc723('0x28')](function(_0x5cdcc3){_0x1c3064=_0x5cdcc3;return _0x40eb22[_0xc723('0x8d')](_0x5cdcc3,{'transaction':_0xd7d7ff});})['then'](function(){var _0x1dd87d={'type':db[_0xc723('0x8e')][_0xc723('0x8f')],'transaction':_0xd7d7ff};switch(_0x586019[_0xc723('0x4c')]['type']){case'text':_0x1dd87d['type']=db['Sequelize'][_0xc723('0x8f')];break;case _0xc723('0x90'):_0x1dd87d[_0xc723('0x32')]=db[_0xc723('0x8e')]['INTEGER'];break;case _0xc723('0x91'):_0x1dd87d[_0xc723('0x32')]=db['Sequelize'][_0xc723('0x92')];_0x1dd87d[_0xc723('0x93')]=![];break;default:}return db[_0xc723('0x8c')][_0xc723('0x94')]['addColumn']('cm_contacts',util[_0xc723('0x6b')](_0xc723('0x95'),_0x1c3064['id']),_0x1dd87d);})[_0xc723('0x28')](function(){return _0x1c3064;});});}})[_0xc723('0x28')](respondWithResult(_0x1405bb,null))[_0xc723('0x54')](handleError(_0x1405bb,null));};exports[_0xc723('0x96')]=function(_0x5a0b4d,_0x5ce491,_0x59f4df){var _0x161308={};var _0x25702f={};var _0x5f04b9;var _0x577efe;return db[_0xc723('0x44')][_0xc723('0x59')]({'where':{'id':_0x5a0b4d['params']['id']}})[_0xc723('0x28')](handleEntityNotFound(_0x5ce491,null))[_0xc723('0x28')](function(_0x43cfb4){if(_0x43cfb4){_0x5f04b9=_0x43cfb4;_0x25702f[_0xc723('0x33')]=_['keys'](db[_0xc723('0x68')][_0xc723('0x30')]);_0x25702f[_0xc723('0x35')]=_[_0xc723('0x34')](_0x5a0b4d['query']);_0x25702f[_0xc723('0x36')]=_[_0xc723('0x37')](_0x25702f[_0xc723('0x33')],_0x25702f[_0xc723('0x35')]);_0x161308[_0xc723('0x39')]=_[_0xc723('0x37')](_0x25702f[_0xc723('0x33')],qs[_0xc723('0x38')](_0x5a0b4d[_0xc723('0x35')][_0xc723('0x38')]));_0x161308[_0xc723('0x39')]=_0x161308[_0xc723('0x39')][_0xc723('0x4a')]?_0x161308[_0xc723('0x39')]:_0x25702f[_0xc723('0x33')];_0x161308[_0xc723('0x3b')]=qs[_0xc723('0x3c')](_0x5a0b4d[_0xc723('0x35')][_0xc723('0x3c')]);_0x161308[_0xc723('0x3f')]=qs[_0xc723('0x36')](_[_0xc723('0x3d')](_0x5a0b4d['query'],_0x25702f[_0xc723('0x36')]));_0x161308[_0xc723('0x3f')]=_[_0xc723('0x40')](_0x161308[_0xc723('0x3f')],{'$or':[{'ListId':_0x43cfb4['id']},{'ListId':null}]});if(_0x5a0b4d[_0xc723('0x35')]['filter']){_0x161308[_0xc723('0x3f')]=_[_0xc723('0x40')](_0x161308['where'],{'$or':_[_0xc723('0x41')](_0x161308[_0xc723('0x39')],function(_0x3179d9){var _0x2781e6={};_0x2781e6[_0x3179d9]={'$like':'%'+_0x5a0b4d['query'][_0xc723('0x3e')]+'%'};return _0x2781e6;})});}_0x161308=_[_0xc723('0x40')]({},_0x161308,_0x5a0b4d[_0xc723('0x43')]);return db[_0xc723('0x68')][_0xc723('0x97')](_0x161308);}})[_0xc723('0x28')](respondWithResult(_0x5ce491,null))[_0xc723('0x54')](handleError(_0x5ce491,null));};exports[_0xc723('0x98')]=function(_0x5041f8,_0x27e22a){return db[_0xc723('0x68')][_0xc723('0x97')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x27e22a,null))['then'](function(_0x2a7f1d){return _0x2a7f1d;})[_0xc723('0x28')](respondWithResult(_0x27e22a,null))['catch'](handleError(_0x27e22a,null));};exports[_0xc723('0x99')]=function(_0x47c3f2,_0x52c392,_0xd63d76){return db[_0xc723('0x44')][_0xc723('0x51')]({'where':{'id':_0x47c3f2[_0xc723('0x49')]['id']}})['then'](handleEntityNotFound(_0x52c392,null))[_0xc723('0x28')](function(_0x48aa9a){if(_0x48aa9a){return _0x48aa9a[_0xc723('0x99')](_0x47c3f2[_0xc723('0x4c')][_0xc723('0x5d')],_['omit'](_0x47c3f2[_0xc723('0x4c')],[_0xc723('0x5d'),'id'])||{})[_0xc723('0x9a')](function(_0x551875){for(var _0x1825da=0x0;_0x1825da<_0x47c3f2[_0xc723('0x4c')]['ids']['length'];_0x1825da+=0x1){socket[_0xc723('0x9b')](_0xc723('0x9c'),{'UserId':Number(_0x47c3f2[_0xc723('0x4c')]['ids'][_0x1825da]),'CmListId':Number(_0x47c3f2['params']['id'])});}return _0x551875;});}})[_0xc723('0x28')](respondWithResult(_0x52c392,null))[_0xc723('0x54')](handleError(_0x52c392,null));};exports['removeAgents']=function(_0x28b84a,_0xf0cd11,_0x5b9e8b){return db['CmList'][_0xc723('0x51')]({'where':{'id':_0x28b84a[_0xc723('0x49')]['id']}})[_0xc723('0x28')](handleEntityNotFound(_0xf0cd11,null))[_0xc723('0x28')](function(_0x508a3){if(_0x508a3){return _0x508a3[_0xc723('0x9d')](_0x28b84a[_0xc723('0x35')][_0xc723('0x5d')])[_0xc723('0x28')](function(){if(_[_0xc723('0x61')](_0x28b84a[_0xc723('0x35')]['ids'])){for(var _0x12869d=0x0;_0x12869d<_0x28b84a[_0xc723('0x35')][_0xc723('0x5d')]['length'];_0x12869d+=0x1){socket[_0xc723('0x9b')]('userCmList:remove',{'UserId':Number(_0x28b84a[_0xc723('0x35')][_0xc723('0x5d')][_0x12869d]),'CmListId':Number(_0x28b84a[_0xc723('0x49')]['id'])});}}else{socket[_0xc723('0x9b')](_0xc723('0x9e'),{'UserId':Number(_0x28b84a[_0xc723('0x35')][_0xc723('0x5d')]),'CmListId':Number(_0x28b84a[_0xc723('0x49')]['id'])});}});}})[_0xc723('0x28')](respondWithStatusCode(_0xf0cd11,null))[_0xc723('0x54')](handleError(_0xf0cd11,null));};exports[_0xc723('0x9f')]=function(_0xf49aca,_0x42980a,_0x1960c7){var _0x1495a2={};var _0x43f6d9={};var _0x553821;var _0x5d8ed6;return db[_0xc723('0x44')][_0xc723('0x59')]({'where':{'id':_0xf49aca[_0xc723('0x49')]['id']}})[_0xc723('0x28')](handleEntityNotFound(_0x42980a,null))['then'](function(_0x4bb5b7){if(_0x4bb5b7){_0x553821=_0x4bb5b7;_0x43f6d9[_0xc723('0x33')]=_[_0xc723('0x34')](db['User'][_0xc723('0x30')]);_0x43f6d9[_0xc723('0x35')]=_[_0xc723('0x34')](_0xf49aca[_0xc723('0x35')]);_0x43f6d9['filters']=_[_0xc723('0x37')](_0x43f6d9[_0xc723('0x33')],_0x43f6d9[_0xc723('0x35')]);_0x1495a2[_0xc723('0x39')]=_[_0xc723('0x37')](_0x43f6d9[_0xc723('0x33')],qs[_0xc723('0x38')](_0xf49aca[_0xc723('0x35')][_0xc723('0x38')]));_0x1495a2[_0xc723('0x39')]=_0x1495a2[_0xc723('0x39')][_0xc723('0x4a')]?_0x1495a2['attributes']:_0x43f6d9[_0xc723('0x33')];_0x1495a2[_0xc723('0x3b')]=qs[_0xc723('0x3c')](_0xf49aca[_0xc723('0x35')][_0xc723('0x3c')]);_0x1495a2[_0xc723('0x3f')]=qs[_0xc723('0x36')](_[_0xc723('0x3d')](_0xf49aca[_0xc723('0x35')],_0x43f6d9[_0xc723('0x36')]));if(_0xf49aca[_0xc723('0x35')]['filter']){_0x1495a2[_0xc723('0x3f')]=_['merge'](_0x1495a2[_0xc723('0x3f')],{'$or':_[_0xc723('0x41')](_0x1495a2['attributes'],function(_0x586a34){var _0x50f631={};_0x50f631[_0x586a34]={'$like':'%'+_0xf49aca[_0xc723('0x35')][_0xc723('0x3e')]+'%'};return _0x50f631;})});}_0x1495a2=_['merge']({},_0x1495a2,_0xf49aca[_0xc723('0x43')]);return _0x553821['getAgents'](_0x1495a2);}})['then'](function(_0x5b3f9f){if(_0x5b3f9f){_0x5d8ed6=_0x5b3f9f[_0xc723('0x4a')];if(!_0xf49aca[_0xc723('0x35')]['hasOwnProperty'](_0xc723('0x3a'))){_0x1495a2[_0xc723('0x22')]=qs['limit'](_0xf49aca['query'][_0xc723('0x22')]);_0x1495a2[_0xc723('0x21')]=qs[_0xc723('0x21')](_0xf49aca[_0xc723('0x35')][_0xc723('0x21')]);}return _0x553821[_0xc723('0x9f')](_0x1495a2);}})['then'](function(_0x5afffb){if(_0x5afffb){return _0x5afffb?{'count':_0x5d8ed6,'rows':_0x5afffb}:null;}})[_0xc723('0x28')](respondWithResult(_0x42980a,null))[_0xc723('0x54')](handleError(_0x42980a,null));};function handleQuery(_0x57d567){logger[_0xc723('0xa0')](_0x57d567);return db[_0xc723('0x8c')][_0xc723('0x35')](_0x57d567)[_0xc723('0x9a')](function(_0xab88a){csv_results[_0xc723('0x62')](_0xab88a);})[_0xc723('0x54')](function(_0x827fd8){logger[_0xc723('0x2c')](_0x827fd8[_0xc723('0x66')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 22b3c9c..1f5135e 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x442755,_0x21f049){var _0x296d4c=function(_0x3c4e91){while(--_0x3c4e91){_0x442755['push'](_0x442755['shift']());}};_0x296d4c(++_0x21f049);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe14b,0x93));var _0xbe14=function(_0x9c6362,_0x1ef30a){_0x9c6362=_0x9c6362-0x0;var _0x3f6b91=_0xe14b[_0x9c6362];return _0x3f6b91;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index a3afc4f..10f1622 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 _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','../../config/logger','api'];(function(_0x3e8dc6,_0x32caa6){var _0x464789=function(_0x29bdd0){while(--_0x29bdd0){_0x3e8dc6['push'](_0x3e8dc6['shift']());}};_0x464789(++_0x32caa6);}(_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':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac4a=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmList.attributes','define','cm_lists'];(function(_0x14c6e9,_0x399222){var _0x4c1eed=function(_0x167ceb){while(--_0x167ceb){_0x14c6e9['push'](_0x14c6e9['shift']());}};_0x4c1eed(++_0x399222);}(_0xac4a,0x13f));var _0xaac4=function(_0x4ce2dc,_0x3c39af){_0x4ce2dc=_0x4ce2dc-0x0;var _0x19f585=_0xac4a[_0x4ce2dc];return _0x19f585;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var moment=require(_0xaac4('0x4'));var BPromise=require(_0xaac4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var attributes=require(_0xaac4('0x8'));module['exports']=function(_0x1283a5,_0x53d03a){return _0x1283a5[_0xaac4('0x9')]('CmList',attributes,{'tableName':_0xaac4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 33aa606..e8c4b15 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 _0xd067=['redis','localhost','socket.io-emitter','register','then','info','request\x20sent','error','code','CmList,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xd067,0x1f2));var _0x7d06=function(_0x32d934,_0x31b889){_0x32d934=_0x32d934-0x0;var _0x15594a=_0xd067[_0x32d934];return _0x15594a;};'use strict';var _=require(_0x7d06('0x0'));var util=require(_0x7d06('0x1'));var moment=require(_0x7d06('0x2'));var BPromise=require(_0x7d06('0x3'));var rs=require(_0x7d06('0x4'));var fs=require('fs');var Redis=require(_0x7d06('0x5'));var db=require(_0x7d06('0x6'))['db'];var utils=require(_0x7d06('0x7'));var logger=require(_0x7d06('0x8'))(_0x7d06('0x9'));var config=require(_0x7d06('0xa'));var jayson=require(_0x7d06('0xb'));var client=jayson[_0x7d06('0xc')][_0x7d06('0xd')]({'port':0x232a});config['redis']=_[_0x7d06('0xe')](config[_0x7d06('0xf')],{'host':_0x7d06('0x10'),'port':0x18eb});var socket=require(_0x7d06('0x11'))(new Redis(config['redis']));require('./cmList.socket')[_0x7d06('0x12')](socket);function respondWithRpcPromise(_0x4cd286,_0x21ef61,_0x52a75d){return new BPromise(function(_0xb128e1,_0x343dca){return client['request'](_0x4cd286,_0x52a75d)[_0x7d06('0x13')](function(_0x371ba9){logger[_0x7d06('0x14')]('CmList,\x20%s,\x20%s',_0x21ef61,_0x7d06('0x15'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x21ef61,_0x7d06('0x15'),JSON['stringify'](_0x371ba9));if(_0x371ba9[_0x7d06('0x16')]){if(_0x371ba9[_0x7d06('0x16')][_0x7d06('0x17')]===0x1f4){logger[_0x7d06('0x16')](_0x7d06('0x18'),_0x21ef61,_0x371ba9[_0x7d06('0x16')][_0x7d06('0x19')]);return _0x343dca(_0x371ba9[_0x7d06('0x16')][_0x7d06('0x19')]);}logger[_0x7d06('0x16')](_0x7d06('0x18'),_0x21ef61,_0x371ba9[_0x7d06('0x16')][_0x7d06('0x19')]);return _0xb128e1(_0x371ba9['error'][_0x7d06('0x19')]);}else{logger[_0x7d06('0x14')](_0x7d06('0x18'),_0x21ef61,_0x7d06('0x15'));_0xb128e1(_0x371ba9['result'][_0x7d06('0x19')]);}})[_0x7d06('0x1a')](function(_0x30dc3f){logger[_0x7d06('0x16')]('CmList,\x20%s,\x20%s',_0x21ef61,_0x30dc3f);_0x343dca(_0x30dc3f);});});} \ No newline at end of file +var _0x7f38=['info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','redis','./cmList.socket','register','then'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x7f38,0x1ec));var _0x87f3=function(_0x373e4f,_0x55a083){_0x373e4f=_0x373e4f-0x0;var _0x53c41e=_0x7f38[_0x373e4f];return _0x53c41e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x87f3('0x0'));var BPromise=require(_0x87f3('0x1'));var rs=require(_0x87f3('0x2'));var fs=require('fs');var Redis=require(_0x87f3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x87f3('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x87f3('0x5'));var jayson=require(_0x87f3('0x6'));var client=jayson[_0x87f3('0x7')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x87f3('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x87f3('0x8')]));require(_0x87f3('0x9'))[_0x87f3('0xa')](socket);function respondWithRpcPromise(_0x228728,_0x4e9180,_0x4d7af7){return new BPromise(function(_0x102197,_0xc1bcf){return client['request'](_0x228728,_0x4d7af7)[_0x87f3('0xb')](function(_0x2d4c0e){logger[_0x87f3('0xc')](_0x87f3('0xd'),_0x4e9180,'request\x20sent');logger[_0x87f3('0xe')](_0x87f3('0xf'),_0x4e9180,_0x87f3('0x10'),JSON[_0x87f3('0x11')](_0x2d4c0e));if(_0x2d4c0e['error']){if(_0x2d4c0e[_0x87f3('0x12')]['code']===0x1f4){logger[_0x87f3('0x12')](_0x87f3('0xd'),_0x4e9180,_0x2d4c0e[_0x87f3('0x12')]['message']);return _0xc1bcf(_0x2d4c0e[_0x87f3('0x12')][_0x87f3('0x13')]);}logger[_0x87f3('0x12')](_0x87f3('0xd'),_0x4e9180,_0x2d4c0e[_0x87f3('0x12')]['message']);return _0x102197(_0x2d4c0e[_0x87f3('0x12')][_0x87f3('0x13')]);}else{logger[_0x87f3('0xc')](_0x87f3('0xd'),_0x4e9180,_0x87f3('0x10'));_0x102197(_0x2d4c0e['result'][_0x87f3('0x13')]);}})[_0x87f3('0x14')](function(_0x305e4c){logger[_0x87f3('0x12')]('CmList,\x20%s,\x20%s',_0x4e9180,_0x305e4c);_0xc1bcf(_0x305e4c);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index d679a05..466c9a7 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 _0x03d3=['length','cmList:','save','remove','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x03d3,0x6e));var _0x303d=function(_0xf00575,_0x8ecae6){_0xf00575=_0xf00575-0x0;var _0x58a7f6=_0x03d3[_0xf00575];return _0x58a7f6;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x303d('0x0'),_0x303d('0x1'),'update'];function createListener(_0x4950d5,_0x409a37){return function(_0x483f24){_0x409a37[_0x303d('0x2')](_0x4950d5,_0x483f24);};}function removeListener(_0x4eafb7,_0x46227b){return function(){CmListEvents[_0x303d('0x3')](_0x4eafb7,_0x46227b);};}exports['register']=function(_0x5413a3){for(var _0x2cca98=0x0,_0xaafd06=events[_0x303d('0x4')];_0x2cca98<_0xaafd06;_0x2cca98++){var _0x9cb378=events[_0x2cca98];var _0x307f4a=createListener(_0x303d('0x5')+_0x9cb378,_0x5413a3);CmListEvents['on'](_0x9cb378,_0x307f4a);}}; \ No newline at end of file +var _0x25ef=['remove','update','emit','removeListener','register','length','cmList:','./cmList.events'];(function(_0x2ffcdf,_0x5e8cc6){var _0x2715aa=function(_0x588b1f){while(--_0x588b1f){_0x2ffcdf['push'](_0x2ffcdf['shift']());}};_0x2715aa(++_0x5e8cc6);}(_0x25ef,0xf7));var _0xf25e=function(_0x477864,_0x2fc625){_0x477864=_0x477864-0x0;var _0x37d121=_0x25ef[_0x477864];return _0x37d121;};'use strict';var CmListEvents=require(_0xf25e('0x0'));var events=['save',_0xf25e('0x1'),_0xf25e('0x2')];function createListener(_0x23c690,_0x55b7bb){return function(_0x212544){_0x55b7bb[_0xf25e('0x3')](_0x23c690,_0x212544);};}function removeListener(_0x58f621,_0x5806b6){return function(){CmListEvents[_0xf25e('0x4')](_0x58f621,_0x5806b6);};}exports[_0xf25e('0x5')]=function(_0x148f96){for(var _0x47f98a=0x0,_0x3d5a1a=events[_0xf25e('0x6')];_0x47f98a<_0x3d5a1a;_0x47f98a++){var _0x706c6c=events[_0x47f98a];var _0x15500a=createListener(_0xf25e('0x7')+_0x706c6c,_0x148f96);CmListEvents['on'](_0x706c6c,_0x15500a);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 01b786a..13bc9a9 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 _0x1cd5=['/:id/users','put','destroy','delete','removeDispositions','removeAgents','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/global_fields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','getCustomFields','getAgents','post','create','addDisposition','addContacts','addCustomField'];(function(_0x25a484,_0x18cc0c){var _0x332237=function(_0x2e84d8){while(--_0x2e84d8){_0x25a484['push'](_0x25a484['shift']());}};_0x332237(++_0x18cc0c);}(_0x1cd5,0x107));var _0x51cd=function(_0x173466,_0x55cb4d){_0x173466=_0x173466-0x0;var _0x229c18=_0x1cd5[_0x173466];return _0x229c18;};'use strict';var multer=require('multer');var util=require(_0x51cd('0x0'));var path=require('path');var timeout=require(_0x51cd('0x1'));var express=require(_0x51cd('0x2'));var router=express['Router']();var fs_extra=require(_0x51cd('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x51cd('0x4'));var config=require(_0x51cd('0x5'));var controller=require('./cmList.controller');router[_0x51cd('0x6')]('/',auth[_0x51cd('0x7')](),controller[_0x51cd('0x8')]);router[_0x51cd('0x6')](_0x51cd('0x9'),auth[_0x51cd('0x7')](),controller['describe']);router['get'](_0x51cd('0xa'),auth[_0x51cd('0x7')](),controller['getGlobalCustomFields']);router[_0x51cd('0x6')](_0x51cd('0xb'),auth[_0x51cd('0x7')](),controller[_0x51cd('0xc')]);router[_0x51cd('0x6')](_0x51cd('0xd'),auth[_0x51cd('0x7')](),controller[_0x51cd('0xe')]);router['get'](_0x51cd('0xf'),auth[_0x51cd('0x7')](),controller['getContacts']);router['get'](_0x51cd('0x10'),auth[_0x51cd('0x7')](),controller[_0x51cd('0x11')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x51cd('0x12')]);router[_0x51cd('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0x51cd('0x13')]);router[_0x51cd('0x14')]('/',auth[_0x51cd('0x7')](),controller[_0x51cd('0x15')]);router['post'](_0x51cd('0xd'),auth['isAuthenticated'](),controller[_0x51cd('0x16')]);router[_0x51cd('0x14')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x51cd('0x17')]);router[_0x51cd('0x14')]('/:id/fields',auth['isAuthenticated'](),controller[_0x51cd('0x18')]);router[_0x51cd('0x14')](_0x51cd('0x19'),auth[_0x51cd('0x7')](),controller['addAgents']);router[_0x51cd('0x1a')](_0x51cd('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x51cd('0xb'),auth[_0x51cd('0x7')](),controller[_0x51cd('0x1b')]);router[_0x51cd('0x1c')](_0x51cd('0xd'),auth[_0x51cd('0x7')](),controller[_0x51cd('0x1d')]);router[_0x51cd('0x1c')](_0x51cd('0x19'),auth['isAuthenticated'](),controller[_0x51cd('0x1e')]);module[_0x51cd('0x1f')]=router; \ No newline at end of file +var _0xcfee=['addDisposition','addContacts','addCustomField','/:id/users','addAgents','put','delete','destroy','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','/describe','describe','get','/global_fields','/:id','/:id/dispositions','/:id/contacts','getContacts','/:id/fields','getCustomFields','getAgents','post'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcfee,0x175));var _0xecfe=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xcfee[_0x46e363];return _0x3fb059;};'use strict';var multer=require('multer');var util=require(_0xecfe('0x0'));var path=require(_0xecfe('0x1'));var timeout=require(_0xecfe('0x2'));var express=require(_0xecfe('0x3'));var router=express['Router']();var fs_extra=require(_0xecfe('0x4'));var auth=require(_0xecfe('0x5'));var interaction=require(_0xecfe('0x6'));var config=require(_0xecfe('0x7'));var controller=require(_0xecfe('0x8'));router['get']('/',auth[_0xecfe('0x9')](),controller[_0xecfe('0xa')]);router['get'](_0xecfe('0xb'),auth[_0xecfe('0x9')](),controller[_0xecfe('0xc')]);router[_0xecfe('0xd')](_0xecfe('0xe'),auth[_0xecfe('0x9')](),controller['getGlobalCustomFields']);router['get'](_0xecfe('0xf'),auth[_0xecfe('0x9')](),controller['show']);router[_0xecfe('0xd')](_0xecfe('0x10'),auth[_0xecfe('0x9')](),controller['getDispositions']);router[_0xecfe('0xd')](_0xecfe('0x11'),auth[_0xecfe('0x9')](),controller[_0xecfe('0x12')]);router[_0xecfe('0xd')]('/:id/contacts/csv',auth[_0xecfe('0x9')](),controller['getContactsCsv']);router['get'](_0xecfe('0x13'),auth[_0xecfe('0x9')](),controller[_0xecfe('0x14')]);router[_0xecfe('0xd')]('/:id/users',auth[_0xecfe('0x9')](),controller[_0xecfe('0x15')]);router[_0xecfe('0x16')]('/',auth[_0xecfe('0x9')](),controller['create']);router[_0xecfe('0x16')](_0xecfe('0x10'),auth[_0xecfe('0x9')](),controller[_0xecfe('0x17')]);router[_0xecfe('0x16')](_0xecfe('0x11'),auth[_0xecfe('0x9')](),controller[_0xecfe('0x18')]);router[_0xecfe('0x16')](_0xecfe('0x13'),auth[_0xecfe('0x9')](),controller[_0xecfe('0x19')]);router[_0xecfe('0x16')](_0xecfe('0x1a'),auth[_0xecfe('0x9')](),controller[_0xecfe('0x1b')]);router[_0xecfe('0x1c')](_0xecfe('0xf'),auth[_0xecfe('0x9')](),controller['update']);router[_0xecfe('0x1d')](_0xecfe('0xf'),auth[_0xecfe('0x9')](),controller[_0xecfe('0x1e')]);router[_0xecfe('0x1d')](_0xecfe('0x10'),auth[_0xecfe('0x9')](),controller['removeDispositions']);router[_0xecfe('0x1d')](_0xecfe('0x1a'),auth[_0xecfe('0x9')](),controller[_0xecfe('0x1f')]);module[_0xecfe('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 fb547db..79e52d5 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 _0xc36d=['sequelize','exports','VIRTUAL','getDataValue','STRING'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0xc36d,0x113));var _0xdc36=function(_0x114d1f,_0x55548e){_0x114d1f=_0x114d1f-0x0;var _0x5b91d4=_0xc36d[_0x114d1f];return _0x5b91d4;};'use strict';var Sequelize=require(_0xdc36('0x0'));module[_0xdc36('0x1')]={'name':{'type':Sequelize[_0xdc36('0x2')],'get':function(_0x119a8d){return this[_0xdc36('0x3')]('field');}},'field':{'type':Sequelize[_0xdc36('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xdc36('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x8abb=['STRING','sequelize','getDataValue','field'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x8abb,0x17d));var _0xb8ab=function(_0x51b06a,_0x69bfa5){_0x51b06a=_0x51b06a-0x0;var _0xa2336c=_0x8abb[_0x51b06a];return _0xa2336c;};'use strict';var Sequelize=require(_0xb8ab('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5c1158){return this[_0xb8ab('0x1')](_0xb8ab('0x2'));}},'field':{'type':Sequelize[_0xb8ab('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xb8ab('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0xb8ab('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 27a54a4..bafb1dd 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(_0x48d9bb,_0xea5004){var _0x192fbf=function(_0x5007f0){while(--_0x5007f0){_0x48d9bb['push'](_0x48d9bb['shift']());}};_0x192fbf(++_0xea5004);}(_0x7a54,0x106));var _0x47a5=function(_0x51800c,_0x28e84b){_0x51800c=_0x51800c-0x0;var _0x2df8dd=_0x7a54[_0x51800c];return _0x2df8dd;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x5e3df5,_0x34b435){var _0x2bc2f6=function(_0x28644b){while(--_0x28644b){_0x5e3df5['push'](_0x5e3df5['shift']());}};_0x2bc2f6(++_0x34b435);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index f0a97bb..99460b5 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 _0xd3af=['tools_conditions','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./condition.attributes','Condition'];(function(_0x1a5d1d,_0x1c52ac){var _0x3fadf4=function(_0x190523){while(--_0x190523){_0x1a5d1d['push'](_0x1a5d1d['shift']());}};_0x3fadf4(++_0x1c52ac);}(_0xd3af,0xe7));var _0xfd3a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd3af[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0xfd3a('0x0'));var logger=require(_0xfd3a('0x1'))('api');var moment=require(_0xfd3a('0x2'));var BPromise=require(_0xfd3a('0x3'));var rp=require(_0xfd3a('0x4'));var fs=require('fs');var path=require(_0xfd3a('0x5'));var rimraf=require(_0xfd3a('0x6'));var config=require('../../config/environment');var attributes=require(_0xfd3a('0x7'));module['exports']=function(_0x32834c,_0x14f408){return _0x32834c['define'](_0xfd3a('0x8'),attributes,{'tableName':_0xfd3a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64ce=['define','Condition','tools_conditions','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports'];(function(_0x2dc81b,_0x2063ae){var _0x3a2946=function(_0x398317){while(--_0x398317){_0x2dc81b['push'](_0x2dc81b['shift']());}};_0x3a2946(++_0x2063ae);}(_0x64ce,0xc3));var _0xe64c=function(_0x1b96c9,_0x166085){_0x1b96c9=_0x1b96c9-0x0;var _0x534a56=_0x64ce[_0x1b96c9];return _0x534a56;};'use strict';var _=require(_0xe64c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe64c('0x1'));var moment=require('moment');var BPromise=require(_0xe64c('0x2'));var rp=require(_0xe64c('0x3'));var fs=require('fs');var path=require(_0xe64c('0x4'));var rimraf=require(_0xe64c('0x5'));var config=require(_0xe64c('0x6'));var attributes=require(_0xe64c('0x7'));module[_0xe64c('0x8')]=function(_0xb95a34,_0x56f6b5){return _0xb95a34[_0xe64c('0x9')](_0xe64c('0xa'),attributes,{'tableName':_0xe64c('0xb'),'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 f28e3cd..00fa853 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 _0xff2c=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x477714,_0x2bbbcc){var _0x45048d=function(_0x4402cb){while(--_0x4402cb){_0x477714['push'](_0x477714['shift']());}};_0x45048d(++_0x2bbbcc);}(_0xff2c,0x136));var _0xcff2=function(_0x513047,_0x2199c5){_0x513047=_0x513047-0x0;var _0x15b779=_0xff2c[_0x513047];return _0x15b779;};'use strict';var _=require(_0xcff2('0x0'));var util=require(_0xcff2('0x1'));var moment=require('moment');var BPromise=require(_0xcff2('0x2'));var rs=require(_0xcff2('0x3'));var fs=require('fs');var Redis=require(_0xcff2('0x4'));var db=require(_0xcff2('0x5'))['db'];var utils=require(_0xcff2('0x6'));var logger=require(_0xcff2('0x7'))(_0xcff2('0x8'));var config=require(_0xcff2('0x9'));var jayson=require(_0xcff2('0xa'));var client=jayson[_0xcff2('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37f0a3,_0x5deb97,_0xf7f5f1){return new BPromise(function(_0x283d84,_0x27e889){return client[_0xcff2('0xc')](_0x37f0a3,_0xf7f5f1)['then'](function(_0x2efa79){logger[_0xcff2('0xd')](_0xcff2('0xe'),_0x5deb97,_0xcff2('0xf'));logger[_0xcff2('0x10')](_0xcff2('0x11'),_0x5deb97,_0xcff2('0xf'),JSON[_0xcff2('0x12')](_0x2efa79));if(_0x2efa79[_0xcff2('0x13')]){if(_0x2efa79[_0xcff2('0x13')][_0xcff2('0x14')]===0x1f4){logger[_0xcff2('0x13')](_0xcff2('0xe'),_0x5deb97,_0x2efa79[_0xcff2('0x13')][_0xcff2('0x15')]);return _0x27e889(_0x2efa79[_0xcff2('0x13')][_0xcff2('0x15')]);}logger[_0xcff2('0x13')](_0xcff2('0xe'),_0x5deb97,_0x2efa79['error'][_0xcff2('0x15')]);return _0x283d84(_0x2efa79[_0xcff2('0x13')][_0xcff2('0x15')]);}else{logger['info'](_0xcff2('0xe'),_0x5deb97,'request\x20sent');_0x283d84(_0x2efa79[_0xcff2('0x16')]['message']);}})[_0xcff2('0x17')](function(_0x540ea8){logger[_0xcff2('0x13')](_0xcff2('0xe'),_0x5deb97,_0x540ea8);_0x27e889(_0x540ea8);});});} \ No newline at end of file +var _0x2578=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird'];(function(_0x44e054,_0x2b8042){var _0x244f0e=function(_0x5e001c){while(--_0x5e001c){_0x44e054['push'](_0x44e054['shift']());}};_0x244f0e(++_0x2b8042);}(_0x2578,0x1b2));var _0x8257=function(_0x547a87,_0x4d4e24){_0x547a87=_0x547a87-0x0;var _0x11fde1=_0x2578[_0x547a87];return _0x11fde1;};'use strict';var _=require(_0x8257('0x0'));var util=require(_0x8257('0x1'));var moment=require('moment');var BPromise=require(_0x8257('0x2'));var rs=require(_0x8257('0x3'));var fs=require('fs');var Redis=require(_0x8257('0x4'));var db=require(_0x8257('0x5'))['db'];var utils=require(_0x8257('0x6'));var logger=require(_0x8257('0x7'))(_0x8257('0x8'));var config=require(_0x8257('0x9'));var jayson=require(_0x8257('0xa'));var client=jayson[_0x8257('0xb')][_0x8257('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x58eaed,_0x41382a,_0x4b1aa4){return new BPromise(function(_0x4439a1,_0x3b4acd){return client[_0x8257('0xd')](_0x58eaed,_0x4b1aa4)[_0x8257('0xe')](function(_0x563751){logger[_0x8257('0xf')](_0x8257('0x10'),_0x41382a,_0x8257('0x11'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x41382a,_0x8257('0x11'),JSON[_0x8257('0x12')](_0x563751));if(_0x563751[_0x8257('0x13')]){if(_0x563751[_0x8257('0x13')][_0x8257('0x14')]===0x1f4){logger[_0x8257('0x13')]('Condition,\x20%s,\x20%s',_0x41382a,_0x563751['error'][_0x8257('0x15')]);return _0x3b4acd(_0x563751['error'][_0x8257('0x15')]);}logger[_0x8257('0x13')](_0x8257('0x10'),_0x41382a,_0x563751[_0x8257('0x13')]['message']);return _0x4439a1(_0x563751[_0x8257('0x13')][_0x8257('0x15')]);}else{logger[_0x8257('0xf')](_0x8257('0x10'),_0x41382a,_0x8257('0x11'));_0x4439a1(_0x563751['result'][_0x8257('0x15')]);}})[_0x8257('0x16')](function(_0x423fde){logger['error'](_0x8257('0x10'),_0x41382a,_0x423fde);_0x3b4acd(_0x423fde);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 7be04b3..8479dd3 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 _0x6ee7=['exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy'];(function(_0x2fe089,_0x5691c2){var _0x12f648=function(_0x55345f){while(--_0x55345f){_0x2fe089['push'](_0x2fe089['shift']());}};_0x12f648(++_0x5691c2);}(_0x6ee7,0x1e1));var _0x76ee=function(_0x1462b1,_0x48825a){_0x1462b1=_0x1462b1-0x0;var _0x23f406=_0x6ee7[_0x1462b1];return _0x23f406;};'use strict';var multer=require(_0x76ee('0x0'));var util=require(_0x76ee('0x1'));var path=require(_0x76ee('0x2'));var timeout=require(_0x76ee('0x3'));var express=require('express');var router=express[_0x76ee('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x76ee('0x5'));var config=require(_0x76ee('0x6'));var controller=require(_0x76ee('0x7'));router[_0x76ee('0x8')](_0x76ee('0x9'),auth[_0x76ee('0xa')](),controller[_0x76ee('0xb')]);router[_0x76ee('0xc')]('/:id',auth[_0x76ee('0xa')](),controller[_0x76ee('0xd')]);module[_0x76ee('0xe')]=router; \ No newline at end of file +var _0x162b=['update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','put','/:id','isAuthenticated'];(function(_0x31b57a,_0x3dddf3){var _0x2df3dd=function(_0x394522){while(--_0x394522){_0x31b57a['push'](_0x31b57a['shift']());}};_0x2df3dd(++_0x3dddf3);}(_0x162b,0x17b));var _0xb162=function(_0x322318,_0x276d64){_0x322318=_0x322318-0x0;var _0x59ce6f=_0x162b[_0x322318];return _0x59ce6f;};'use strict';var multer=require(_0xb162('0x0'));var util=require(_0xb162('0x1'));var path=require(_0xb162('0x2'));var timeout=require(_0xb162('0x3'));var express=require(_0xb162('0x4'));var router=express['Router']();var fs_extra=require(_0xb162('0x5'));var auth=require(_0xb162('0x6'));var interaction=require(_0xb162('0x7'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0xb162('0x8')](_0xb162('0x9'),auth[_0xb162('0xa')](),controller[_0xb162('0xb')]);router['delete'](_0xb162('0x9'),auth[_0xb162('0xa')](),controller[_0xb162('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 488fd4f..ce4dde4 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 _0xb935=['name','INTEGER','exports','STRING'];(function(_0x265802,_0xefe860){var _0x5d063f=function(_0x1b0eda){while(--_0x1b0eda){_0x265802['push'](_0x265802['shift']());}};_0x5d063f(++_0xefe860);}(_0xb935,0x1da));var _0x5b93=function(_0x5b8518,_0x2afb49){_0x5b8518=_0x5b8518-0x0;var _0x4fb59f=_0xb935[_0x5b8518];return _0x4fb59f;};'use strict';var Sequelize=require('sequelize');module[_0x5b93('0x0')]={'name':{'type':Sequelize[_0x5b93('0x1')],'allowNull':![],'unique':_0x5b93('0x2')},'OrderBy':{'type':Sequelize[_0x5b93('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x5b93('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xb3c0=['INTEGER','STRING','sequelize','exports','name'];(function(_0xf05c4d,_0x140378){var _0x14030b=function(_0x4e0fe9){while(--_0x4e0fe9){_0xf05c4d['push'](_0xf05c4d['shift']());}};_0x14030b(++_0x140378);}(_0xb3c0,0x129));var _0x0b3c=function(_0x389726,_0x282267){_0x389726=_0x389726-0x0;var _0x295a74=_0xb3c0[_0x389726];return _0x295a74;};'use strict';var Sequelize=require(_0x0b3c('0x0'));module[_0x0b3c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0b3c('0x2')},'OrderBy':{'type':Sequelize[_0x0b3c('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x0b3c('0x4')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 51493f2..486ef2f 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 _0x5464=['filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','squel','crypto','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','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','get','ContactItemTypes','destroy','sendStatus','stack','name','map','ContactItemType','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x2926b7,_0x548319){var _0x2dd568=function(_0x315ed3){while(--_0x315ed3){_0x2926b7['push'](_0x2926b7['shift']());}};_0x2dd568(++_0x548319);}(_0x5464,0x15d));var _0x4546=function(_0x81ee56,_0xc66ce){_0x81ee56=_0x81ee56-0x0;var _0x482356=_0x5464[_0x81ee56];return _0x482356;};'use strict';var emlformat=require(_0x4546('0x0'));var rimraf=require(_0x4546('0x1'));var zipdir=require(_0x4546('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4546('0x3'));var moment=require('moment');var BPromise=require(_0x4546('0x4'));var Mustache=require('mustache');var util=require(_0x4546('0x5'));var path=require(_0x4546('0x6'));var sox=require(_0x4546('0x7'));var csv=require(_0x4546('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4546('0x9'));var crypto=require(_0x4546('0xa'));var jsforce=require(_0x4546('0xb'));var deskjs=require(_0x4546('0xc'));var toCsv=require(_0x4546('0x8'));var querystring=require(_0x4546('0xd'));var Papa=require(_0x4546('0xe'));var Redis=require(_0x4546('0xf'));var authService=require(_0x4546('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4546('0x11'));var hardwareService=require(_0x4546('0x12'));var logger=require(_0x4546('0x13'))('api');var utils=require(_0x4546('0x14'));var config=require(_0x4546('0x15'));var licenseUtil=require(_0x4546('0x16'));var db=require(_0x4546('0x17'))['db'];function respondWithStatusCode(_0x4d31a7,_0x4f2641){_0x4f2641=_0x4f2641||0xcc;return function(_0x3e6622){if(_0x3e6622){return _0x4d31a7['sendStatus'](_0x4f2641);}return _0x4d31a7['status'](_0x4f2641)['end']();};}function respondWithResult(_0x5b64b7,_0x598516){_0x598516=_0x598516||0xc8;return function(_0x4f5571){if(_0x4f5571){return _0x5b64b7[_0x4546('0x18')](_0x598516)['json'](_0x4f5571);}};}function respondWithFilteredResult(_0x363a17,_0x54581c){return function(_0x26fc0e){if(_0x26fc0e){var _0x564f3e=typeof _0x54581c[_0x4546('0x19')]===_0x4546('0x1a')&&typeof _0x54581c[_0x4546('0x1b')]===_0x4546('0x1a');var _0x2a294b=_0x26fc0e[_0x4546('0x1c')];var _0x57d8de=_0x564f3e?0x0:_0x54581c['offset'];var _0x5780a7=_0x564f3e?_0x26fc0e[_0x4546('0x1c')]:_0x54581c[_0x4546('0x19')]+_0x54581c[_0x4546('0x1b')];var _0x3d95c2;if(_0x5780a7>=_0x2a294b){_0x5780a7=_0x2a294b;_0x3d95c2=0xc8;}else{_0x3d95c2=0xce;}_0x363a17[_0x4546('0x18')](_0x3d95c2);return _0x363a17[_0x4546('0x1d')](_0x4546('0x1e'),_0x57d8de+'-'+_0x5780a7+'/'+_0x2a294b)[_0x4546('0x1f')](_0x26fc0e);}return null;};}function patchUpdates(_0x4034a5){return function(_0xceb1d6){try{jsonpatch['apply'](_0xceb1d6,_0x4034a5,!![]);}catch(_0x2d689f){return BPromise[_0x4546('0x20')](_0x2d689f);}return _0xceb1d6['save']();};}function saveUpdates(_0x3067ab,_0x437f55){return function(_0x1a1984){if(_0x1a1984){return _0x1a1984[_0x4546('0x21')](_0x3067ab)[_0x4546('0x22')](function(_0x15b013){return _0x15b013;});}return null;};}function removeEntity(_0x53e402,_0x3dab5c){return function(_0x2cca8b){if(_0x2cca8b){return _0x2cca8b['destroy']()[_0x4546('0x22')](function(){var _0x4618a6=_0x2cca8b[_0x4546('0x23')]({'plain':!![]});var _0x4467ee=_0x4546('0x24');return db['UserProfileResource'][_0x4546('0x25')]({'where':{'type':_0x4467ee,'resourceId':_0x4618a6['id']}})[_0x4546('0x22')](function(){return _0x2cca8b;});})[_0x4546('0x22')](function(){_0x53e402['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43740e,_0x166d6f){return function(_0x15611c){if(!_0x15611c){_0x43740e[_0x4546('0x26')](0x194);}return _0x15611c;};}function handleError(_0x29a3f0,_0x225bc6){_0x225bc6=_0x225bc6||0x1f4;return function(_0xcea7da){logger['error'](_0xcea7da[_0x4546('0x27')]);if(_0xcea7da['name']){delete _0xcea7da[_0x4546('0x28')];}_0x29a3f0[_0x4546('0x18')](_0x225bc6)['send'](_0xcea7da);};}exports['index']=function(_0xf7a95b,_0x5af997){var _0x3c7c7d={},_0x58b69={},_0x480d8e={'count':0x0,'rows':[]};var _0x5f0226=_[_0x4546('0x29')](db[_0x4546('0x2a')][_0x4546('0x2b')],function(_0x5716dc){return{'name':_0x5716dc[_0x4546('0x2c')],'type':_0x5716dc[_0x4546('0x2d')]['key']};});_0x58b69[_0x4546('0x2e')]=_['map'](_0x5f0226,_0x4546('0x28'));_0x58b69[_0x4546('0x2f')]=_[_0x4546('0x30')](_0xf7a95b[_0x4546('0x2f')]);_0x58b69['filters']=_[_0x4546('0x31')](_0x58b69[_0x4546('0x2e')],_0x58b69[_0x4546('0x2f')]);_0x3c7c7d[_0x4546('0x32')]=_[_0x4546('0x31')](_0x58b69[_0x4546('0x2e')],qs['fields'](_0xf7a95b[_0x4546('0x2f')][_0x4546('0x33')]));_0x3c7c7d['attributes']=_0x3c7c7d['attributes'][_0x4546('0x34')]?_0x3c7c7d[_0x4546('0x32')]:_0x58b69['model'];if(!_0xf7a95b[_0x4546('0x2f')][_0x4546('0x35')]('nolimit')){_0x3c7c7d['limit']=qs[_0x4546('0x1b')](_0xf7a95b[_0x4546('0x2f')][_0x4546('0x1b')]);_0x3c7c7d[_0x4546('0x19')]=qs[_0x4546('0x19')](_0xf7a95b[_0x4546('0x2f')]['offset']);}_0x3c7c7d[_0x4546('0x36')]=qs[_0x4546('0x37')](_0xf7a95b['query'][_0x4546('0x37')]);_0x3c7c7d['where']=qs[_0x4546('0x38')](_[_0x4546('0x39')](_0xf7a95b['query'],_0x58b69['filters']),_0x5f0226);if(_0xf7a95b[_0x4546('0x2f')][_0x4546('0x3a')]){_0x3c7c7d[_0x4546('0x3b')]=_['merge'](_0x3c7c7d[_0x4546('0x3b')],{'$or':_[_0x4546('0x29')](_0x5f0226,function(_0x24eb6d){if(_0x24eb6d[_0x4546('0x2d')]!==_0x4546('0x3c')){var _0x320772={};_0x320772[_0x24eb6d[_0x4546('0x28')]]={'$like':'%'+_0xf7a95b[_0x4546('0x2f')]['filter']+'%'};return _0x320772;}})});}_0x3c7c7d=_[_0x4546('0x3d')]({},_0x3c7c7d,_0xf7a95b[_0x4546('0x3e')]);var _0x4a76a2={'where':_0x3c7c7d['where']};return db[_0x4546('0x2a')][_0x4546('0x1c')](_0x4a76a2)[_0x4546('0x22')](function(_0x1ea5c4){_0x480d8e[_0x4546('0x1c')]=_0x1ea5c4;if(_0xf7a95b['query'][_0x4546('0x3f')]){_0x3c7c7d[_0x4546('0x40')]=[{'all':!![]}];}return db[_0x4546('0x2a')][_0x4546('0x41')](_0x3c7c7d);})[_0x4546('0x22')](function(_0x3fabf0){_0x480d8e[_0x4546('0x42')]=_0x3fabf0;return _0x480d8e;})[_0x4546('0x22')](respondWithFilteredResult(_0x5af997,_0x3c7c7d))[_0x4546('0x43')](handleError(_0x5af997,null));};exports['show']=function(_0x270f59,_0x1dd5b0){var _0x3510e0={'raw':!![],'where':{'id':_0x270f59[_0x4546('0x44')]['id']}},_0x35b51e={};_0x35b51e[_0x4546('0x2e')]=_[_0x4546('0x30')](db[_0x4546('0x2a')][_0x4546('0x2b')]);_0x35b51e[_0x4546('0x2f')]=_[_0x4546('0x30')](_0x270f59['query']);_0x35b51e[_0x4546('0x38')]=_[_0x4546('0x31')](_0x35b51e['model'],_0x35b51e[_0x4546('0x2f')]);_0x3510e0[_0x4546('0x32')]=_[_0x4546('0x31')](_0x35b51e['model'],qs[_0x4546('0x33')](_0x270f59[_0x4546('0x2f')][_0x4546('0x33')]));_0x3510e0[_0x4546('0x32')]=_0x3510e0[_0x4546('0x32')][_0x4546('0x34')]?_0x3510e0[_0x4546('0x32')]:_0x35b51e[_0x4546('0x2e')];if(_0x270f59[_0x4546('0x2f')][_0x4546('0x3f')]){_0x3510e0['include']=[{'all':!![]}];}_0x3510e0=_[_0x4546('0x3d')]({},_0x3510e0,_0x270f59[_0x4546('0x3e')]);return db['ContactItemType'][_0x4546('0x45')](_0x3510e0)[_0x4546('0x22')](handleEntityNotFound(_0x1dd5b0,null))[_0x4546('0x22')](respondWithResult(_0x1dd5b0,null))[_0x4546('0x43')](handleError(_0x1dd5b0,null));};exports['create']=function(_0x329566,_0x57bb39){return db[_0x4546('0x2a')][_0x4546('0x46')](_0x329566[_0x4546('0x47')],{})['then'](function(_0x118a36){var _0x3dc9a9=_0x329566[_0x4546('0x48')][_0x4546('0x23')]({'plain':!![]});if(!_0x3dc9a9)throw new Error(_0x4546('0x49'));if(_0x3dc9a9[_0x4546('0x4a')]===_0x4546('0x48')){var _0x325181=_0x118a36[_0x4546('0x23')]({'plain':!![]});var _0x369dc3=_0x4546('0x24');return db['UserProfileSection'][_0x4546('0x45')]({'where':{'name':_0x369dc3,'userProfileId':_0x3dc9a9[_0x4546('0x4b')]},'raw':!![]})['then'](function(_0x50da6e){if(_0x50da6e&&_0x50da6e[_0x4546('0x4c')]===0x0){return db[_0x4546('0x4d')]['create']({'name':_0x325181[_0x4546('0x28')],'resourceId':_0x325181['id'],'type':_0x50da6e[_0x4546('0x28')],'sectionId':_0x50da6e['id']},{})[_0x4546('0x22')](function(){return _0x118a36;});}else{return _0x118a36;}})[_0x4546('0x43')](function(_0x10dfd6){logger[_0x4546('0x4e')](_0x4546('0x4f'),_0x10dfd6);throw _0x10dfd6;});}return _0x118a36;})[_0x4546('0x22')](respondWithResult(_0x57bb39,0xc9))[_0x4546('0x43')](handleError(_0x57bb39,null));};exports[_0x4546('0x21')]=function(_0x14f5a3,_0x198c5d){if(_0x14f5a3[_0x4546('0x47')]['id']){delete _0x14f5a3[_0x4546('0x47')]['id'];}return db[_0x4546('0x2a')][_0x4546('0x45')]({'where':{'id':_0x14f5a3['params']['id']}})[_0x4546('0x22')](handleEntityNotFound(_0x198c5d,null))[_0x4546('0x22')](saveUpdates(_0x14f5a3['body'],null))[_0x4546('0x22')](respondWithResult(_0x198c5d,null))[_0x4546('0x43')](handleError(_0x198c5d,null));};exports[_0x4546('0x25')]=function(_0x30e748,_0x5e2094){return db[_0x4546('0x2a')][_0x4546('0x45')]({'where':{'id':_0x30e748[_0x4546('0x44')]['id']}})[_0x4546('0x22')](handleEntityNotFound(_0x5e2094,null))[_0x4546('0x22')](db[_0x4546('0x50')][_0x4546('0x21')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x30e748[_0x4546('0x44')]['id']}}))[_0x4546('0x22')](removeEntity(_0x5e2094,null))[_0x4546('0x43')](handleError(_0x5e2094,null));}; \ No newline at end of file +var _0x351d=['path','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','end','status','json','limit','count','offset','apply','reject','save','update','destroy','then','get','ContactItemTypes','error','stack','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','rows','catch','show','length','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util'];(function(_0x512677,_0x3af1f6){var _0x4a3cc0=function(_0x3394be){while(--_0x3394be){_0x512677['push'](_0x512677['shift']());}};_0x4a3cc0(++_0x3af1f6);}(_0x351d,0x90));var _0xd351=function(_0x2e4953,_0x2c565c){_0x2e4953=_0x2e4953-0x0;var _0x241163=_0x351d[_0x2e4953];return _0x241163;};'use strict';var emlformat=require(_0xd351('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd351('0x1'));var jsonpatch=require(_0xd351('0x2'));var rp=require(_0xd351('0x3'));var moment=require('moment');var BPromise=require(_0xd351('0x4'));var Mustache=require('mustache');var util=require(_0xd351('0x5'));var path=require(_0xd351('0x6'));var sox=require('sox');var csv=require(_0xd351('0x7'));var ejs=require(_0xd351('0x8'));var fs=require('fs');var fs_extra=require(_0xd351('0x9'));var _=require('lodash');var squel=require(_0xd351('0xa'));var crypto=require(_0xd351('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd351('0xc'));var toCsv=require(_0xd351('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd351('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd351('0xe'));var as=require(_0xd351('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd351('0x10'))(_0xd351('0x11'));var utils=require('../../config/utils');var config=require(_0xd351('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3eb40c,_0x15549a){_0x15549a=_0x15549a||0xcc;return function(_0x23445f){if(_0x23445f){return _0x3eb40c[_0xd351('0x13')](_0x15549a);}return _0x3eb40c['status'](_0x15549a)[_0xd351('0x14')]();};}function respondWithResult(_0x316cf6,_0x597d7c){_0x597d7c=_0x597d7c||0xc8;return function(_0xc5a145){if(_0xc5a145){return _0x316cf6[_0xd351('0x15')](_0x597d7c)[_0xd351('0x16')](_0xc5a145);}};}function respondWithFilteredResult(_0xf1c285,_0x3867fb){return function(_0x4d238c){if(_0x4d238c){var _0x9f790f=typeof _0x3867fb['offset']==='undefined'&&typeof _0x3867fb[_0xd351('0x17')]==='undefined';var _0x21e591=_0x4d238c[_0xd351('0x18')];var _0x4e0164=_0x9f790f?0x0:_0x3867fb['offset'];var _0x1e1a3c=_0x9f790f?_0x4d238c[_0xd351('0x18')]:_0x3867fb[_0xd351('0x19')]+_0x3867fb[_0xd351('0x17')];var _0x51f265;if(_0x1e1a3c>=_0x21e591){_0x1e1a3c=_0x21e591;_0x51f265=0xc8;}else{_0x51f265=0xce;}_0xf1c285[_0xd351('0x15')](_0x51f265);return _0xf1c285['set']('Content-Range',_0x4e0164+'-'+_0x1e1a3c+'/'+_0x21e591)[_0xd351('0x16')](_0x4d238c);}return null;};}function patchUpdates(_0x4a427b){return function(_0x33b1e5){try{jsonpatch[_0xd351('0x1a')](_0x33b1e5,_0x4a427b,!![]);}catch(_0x3634c9){return BPromise[_0xd351('0x1b')](_0x3634c9);}return _0x33b1e5[_0xd351('0x1c')]();};}function saveUpdates(_0x53e729,_0x18625b){return function(_0xbbc58){if(_0xbbc58){return _0xbbc58[_0xd351('0x1d')](_0x53e729)['then'](function(_0x1ce7f7){return _0x1ce7f7;});}return null;};}function removeEntity(_0x2d9aa0,_0x365bbc){return function(_0x59fb6d){if(_0x59fb6d){return _0x59fb6d[_0xd351('0x1e')]()[_0xd351('0x1f')](function(){var _0x4626c4=_0x59fb6d[_0xd351('0x20')]({'plain':!![]});var _0x489c9a=_0xd351('0x21');return db['UserProfileResource'][_0xd351('0x1e')]({'where':{'type':_0x489c9a,'resourceId':_0x4626c4['id']}})[_0xd351('0x1f')](function(){return _0x59fb6d;});})['then'](function(){_0x2d9aa0[_0xd351('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50d67e,_0x1d0cb1){return function(_0x560be9){if(!_0x560be9){_0x50d67e['sendStatus'](0x194);}return _0x560be9;};}function handleError(_0x134580,_0x555a50){_0x555a50=_0x555a50||0x1f4;return function(_0x38471c){logger[_0xd351('0x22')](_0x38471c[_0xd351('0x23')]);if(_0x38471c['name']){delete _0x38471c[_0xd351('0x24')];}_0x134580['status'](_0x555a50)[_0xd351('0x25')](_0x38471c);};}exports['index']=function(_0x5f07b1,_0xeb4da9){var _0x38c82f={},_0x3f9ef3={},_0x33b43d={'count':0x0,'rows':[]};var _0x48aa96=_[_0xd351('0x26')](db[_0xd351('0x27')][_0xd351('0x28')],function(_0x41da60){return{'name':_0x41da60[_0xd351('0x29')],'type':_0x41da60[_0xd351('0x2a')][_0xd351('0x2b')]};});_0x3f9ef3[_0xd351('0x2c')]=_[_0xd351('0x26')](_0x48aa96,'name');_0x3f9ef3[_0xd351('0x2d')]=_[_0xd351('0x2e')](_0x5f07b1[_0xd351('0x2d')]);_0x3f9ef3[_0xd351('0x2f')]=_['intersection'](_0x3f9ef3[_0xd351('0x2c')],_0x3f9ef3[_0xd351('0x2d')]);_0x38c82f[_0xd351('0x30')]=_[_0xd351('0x31')](_0x3f9ef3[_0xd351('0x2c')],qs[_0xd351('0x32')](_0x5f07b1[_0xd351('0x2d')][_0xd351('0x32')]));_0x38c82f[_0xd351('0x30')]=_0x38c82f['attributes']['length']?_0x38c82f[_0xd351('0x30')]:_0x3f9ef3[_0xd351('0x2c')];if(!_0x5f07b1[_0xd351('0x2d')][_0xd351('0x33')](_0xd351('0x34'))){_0x38c82f[_0xd351('0x17')]=qs['limit'](_0x5f07b1['query'][_0xd351('0x17')]);_0x38c82f['offset']=qs[_0xd351('0x19')](_0x5f07b1[_0xd351('0x2d')][_0xd351('0x19')]);}_0x38c82f[_0xd351('0x35')]=qs[_0xd351('0x36')](_0x5f07b1[_0xd351('0x2d')][_0xd351('0x36')]);_0x38c82f[_0xd351('0x37')]=qs[_0xd351('0x2f')](_[_0xd351('0x38')](_0x5f07b1[_0xd351('0x2d')],_0x3f9ef3['filters']),_0x48aa96);if(_0x5f07b1[_0xd351('0x2d')]['filter']){_0x38c82f[_0xd351('0x37')]=_[_0xd351('0x39')](_0x38c82f[_0xd351('0x37')],{'$or':_[_0xd351('0x26')](_0x48aa96,function(_0x3b42e7){if(_0x3b42e7[_0xd351('0x2a')]!=='VIRTUAL'){var _0x3ad98e={};_0x3ad98e[_0x3b42e7[_0xd351('0x24')]]={'$like':'%'+_0x5f07b1['query'][_0xd351('0x3a')]+'%'};return _0x3ad98e;}})});}_0x38c82f=_[_0xd351('0x39')]({},_0x38c82f,_0x5f07b1[_0xd351('0x3b')]);var _0x1fc216={'where':_0x38c82f[_0xd351('0x37')]};return db['ContactItemType']['count'](_0x1fc216)[_0xd351('0x1f')](function(_0x3935aa){_0x33b43d['count']=_0x3935aa;if(_0x5f07b1['query'][_0xd351('0x3c')]){_0x38c82f[_0xd351('0x3d')]=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x38c82f);})[_0xd351('0x1f')](function(_0x18f9d1){_0x33b43d[_0xd351('0x3e')]=_0x18f9d1;return _0x33b43d;})[_0xd351('0x1f')](respondWithFilteredResult(_0xeb4da9,_0x38c82f))[_0xd351('0x3f')](handleError(_0xeb4da9,null));};exports[_0xd351('0x40')]=function(_0x6192c3,_0x110458){var _0x129605={'raw':!![],'where':{'id':_0x6192c3['params']['id']}},_0x553360={};_0x553360[_0xd351('0x2c')]=_[_0xd351('0x2e')](db[_0xd351('0x27')][_0xd351('0x28')]);_0x553360[_0xd351('0x2d')]=_[_0xd351('0x2e')](_0x6192c3[_0xd351('0x2d')]);_0x553360[_0xd351('0x2f')]=_[_0xd351('0x31')](_0x553360[_0xd351('0x2c')],_0x553360[_0xd351('0x2d')]);_0x129605[_0xd351('0x30')]=_[_0xd351('0x31')](_0x553360[_0xd351('0x2c')],qs[_0xd351('0x32')](_0x6192c3[_0xd351('0x2d')]['fields']));_0x129605[_0xd351('0x30')]=_0x129605[_0xd351('0x30')][_0xd351('0x41')]?_0x129605['attributes']:_0x553360[_0xd351('0x2c')];if(_0x6192c3[_0xd351('0x2d')][_0xd351('0x3c')]){_0x129605[_0xd351('0x3d')]=[{'all':!![]}];}_0x129605=_[_0xd351('0x39')]({},_0x129605,_0x6192c3['options']);return db[_0xd351('0x27')]['find'](_0x129605)[_0xd351('0x1f')](handleEntityNotFound(_0x110458,null))[_0xd351('0x1f')](respondWithResult(_0x110458,null))['catch'](handleError(_0x110458,null));};exports['create']=function(_0x1bd727,_0x444206){return db[_0xd351('0x27')]['create'](_0x1bd727[_0xd351('0x42')],{})[_0xd351('0x1f')](function(_0x548d90){var _0xf3ce5=_0x1bd727['user'][_0xd351('0x20')]({'plain':!![]});if(!_0xf3ce5)throw new Error(_0xd351('0x43'));if(_0xf3ce5['role']==='user'){var _0x25ea1e=_0x548d90['get']({'plain':!![]});var _0xf9f375=_0xd351('0x21');return db[_0xd351('0x44')]['find']({'where':{'name':_0xf9f375,'userProfileId':_0xf3ce5[_0xd351('0x45')]},'raw':!![]})['then'](function(_0x5527da){if(_0x5527da&&_0x5527da['autoAssociation']===0x0){return db[_0xd351('0x46')][_0xd351('0x47')]({'name':_0x25ea1e[_0xd351('0x24')],'resourceId':_0x25ea1e['id'],'type':_0x5527da['name'],'sectionId':_0x5527da['id']},{})['then'](function(){return _0x548d90;});}else{return _0x548d90;}})[_0xd351('0x3f')](function(_0x42f248){logger['error'](_0xd351('0x48'),_0x42f248);throw _0x42f248;});}return _0x548d90;})[_0xd351('0x1f')](respondWithResult(_0x444206,0xc9))['catch'](handleError(_0x444206,null));};exports[_0xd351('0x1d')]=function(_0x59ab0f,_0x22394e){if(_0x59ab0f['body']['id']){delete _0x59ab0f[_0xd351('0x42')]['id'];}return db[_0xd351('0x27')][_0xd351('0x49')]({'where':{'id':_0x59ab0f[_0xd351('0x4a')]['id']}})[_0xd351('0x1f')](handleEntityNotFound(_0x22394e,null))[_0xd351('0x1f')](saveUpdates(_0x59ab0f[_0xd351('0x42')],null))['then'](respondWithResult(_0x22394e,null))['catch'](handleError(_0x22394e,null));};exports[_0xd351('0x1e')]=function(_0x624224,_0x53a9da){return db[_0xd351('0x27')][_0xd351('0x49')]({'where':{'id':_0x624224[_0xd351('0x4a')]['id']}})['then'](handleEntityNotFound(_0x53a9da,null))[_0xd351('0x1f')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x624224[_0xd351('0x4a')]['id']}}))[_0xd351('0x1f')](removeEntity(_0x53a9da,null))['catch'](handleError(_0x53a9da,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index e4bd56f..e76cf0a 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 _0xc0ce=['../../config/environment','./contactItemType.attributes','exports','define','lodash','util','api','moment'];(function(_0x243fcb,_0x3e9f63){var _0xb3b173=function(_0x5815df){while(--_0x5815df){_0x243fcb['push'](_0x243fcb['shift']());}};_0xb3b173(++_0x3e9f63);}(_0xc0ce,0x64));var _0xec0c=function(_0x9f8aee,_0x3b0035){_0x9f8aee=_0x9f8aee-0x0;var _0xc11a0e=_0xc0ce[_0x9f8aee];return _0xc11a0e;};'use strict';var _=require(_0xec0c('0x0'));var util=require(_0xec0c('0x1'));var logger=require('../../config/logger')(_0xec0c('0x2'));var moment=require(_0xec0c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xec0c('0x4'));var attributes=require(_0xec0c('0x5'));module[_0xec0c('0x6')]=function(_0xaddd2d,_0x370038){return _0xaddd2d[_0xec0c('0x7')]('ContactItemType',attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75a7=['request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','ContactItemType','lodash','util','../../config/logger','api','moment'];(function(_0x2c6858,_0x2fffab){var _0x216fdf=function(_0x51e3ef){while(--_0x51e3ef){_0x2c6858['push'](_0x2c6858['shift']());}};_0x216fdf(++_0x2fffab);}(_0x75a7,0x127));var _0x775a=function(_0x1d8af0,_0x44f849){_0x1d8af0=_0x1d8af0-0x0;var _0x36fb49=_0x75a7[_0x1d8af0];return _0x36fb49;};'use strict';var _=require(_0x775a('0x0'));var util=require(_0x775a('0x1'));var logger=require(_0x775a('0x2'))(_0x775a('0x3'));var moment=require(_0x775a('0x4'));var BPromise=require('bluebird');var rp=require(_0x775a('0x5'));var fs=require('fs');var path=require(_0x775a('0x6'));var rimraf=require(_0x775a('0x7'));var config=require(_0x775a('0x8'));var attributes=require(_0x775a('0x9'));module[_0x775a('0xa')]=function(_0x1ed8e9,_0x5c1c08){return _0x1ed8e9['define'](_0x775a('0xb'),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 9b5a1c9..5e54d6c 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 _0xe021=['stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xe021,0x138));var _0x1e02=function(_0x5849c4,_0x1d04de){_0x5849c4=_0x5849c4-0x0;var _0x57fba5=_0xe021[_0x5849c4];return _0x57fba5;};'use strict';var _=require(_0x1e02('0x0'));var util=require(_0x1e02('0x1'));var moment=require(_0x1e02('0x2'));var BPromise=require(_0x1e02('0x3'));var rs=require(_0x1e02('0x4'));var fs=require('fs');var Redis=require(_0x1e02('0x5'));var db=require(_0x1e02('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e02('0x7'))(_0x1e02('0x8'));var config=require(_0x1e02('0x9'));var jayson=require(_0x1e02('0xa'));var client=jayson[_0x1e02('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1dc9a1,_0x54f139,_0x598282){return new BPromise(function(_0x105a22,_0x450994){return client[_0x1e02('0xc')](_0x1dc9a1,_0x598282)[_0x1e02('0xd')](function(_0x15d88a){logger[_0x1e02('0xe')](_0x1e02('0xf'),_0x54f139,_0x1e02('0x10'));logger[_0x1e02('0x11')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x54f139,_0x1e02('0x10'),JSON[_0x1e02('0x12')](_0x15d88a));if(_0x15d88a[_0x1e02('0x13')]){if(_0x15d88a['error']['code']===0x1f4){logger[_0x1e02('0x13')](_0x1e02('0xf'),_0x54f139,_0x15d88a['error'][_0x1e02('0x14')]);return _0x450994(_0x15d88a[_0x1e02('0x13')][_0x1e02('0x14')]);}logger[_0x1e02('0x13')]('ContactItemType,\x20%s,\x20%s',_0x54f139,_0x15d88a[_0x1e02('0x13')][_0x1e02('0x14')]);return _0x105a22(_0x15d88a['error'][_0x1e02('0x14')]);}else{logger['info']('ContactItemType,\x20%s,\x20%s',_0x54f139,_0x1e02('0x10'));_0x105a22(_0x15d88a['result']['message']);}})[_0x1e02('0x15')](function(_0x4649e1){logger[_0x1e02('0x13')](_0x1e02('0xf'),_0x54f139,_0x4649e1);_0x450994(_0x4649e1);});});} \ No newline at end of file +var _0x8ec7=['error','message','result','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0x8ec7,0x1f1));var _0x78ec=function(_0x246f0c,_0x39f734){_0x246f0c=_0x246f0c-0x0;var _0x30fe50=_0x8ec7[_0x246f0c];return _0x30fe50;};'use strict';var _=require(_0x78ec('0x0'));var util=require(_0x78ec('0x1'));var moment=require('moment');var BPromise=require(_0x78ec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78ec('0x3'))['db'];var utils=require(_0x78ec('0x4'));var logger=require('../../config/logger')(_0x78ec('0x5'));var config=require(_0x78ec('0x6'));var jayson=require(_0x78ec('0x7'));var client=jayson[_0x78ec('0x8')][_0x78ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d2780,_0x21e3f7,_0x4ca55e){return new BPromise(function(_0x372108,_0x268c50){return client[_0x78ec('0xa')](_0x5d2780,_0x4ca55e)['then'](function(_0x367c80){logger[_0x78ec('0xb')](_0x78ec('0xc'),_0x21e3f7,_0x78ec('0xd'));logger[_0x78ec('0xe')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x21e3f7,'request\x20sent',JSON[_0x78ec('0xf')](_0x367c80));if(_0x367c80[_0x78ec('0x10')]){if(_0x367c80[_0x78ec('0x10')]['code']===0x1f4){logger[_0x78ec('0x10')](_0x78ec('0xc'),_0x21e3f7,_0x367c80[_0x78ec('0x10')][_0x78ec('0x11')]);return _0x268c50(_0x367c80[_0x78ec('0x10')][_0x78ec('0x11')]);}logger[_0x78ec('0x10')](_0x78ec('0xc'),_0x21e3f7,_0x367c80[_0x78ec('0x10')][_0x78ec('0x11')]);return _0x372108(_0x367c80[_0x78ec('0x10')]['message']);}else{logger[_0x78ec('0xb')](_0x78ec('0xc'),_0x21e3f7,_0x78ec('0xd'));_0x372108(_0x367c80[_0x78ec('0x12')][_0x78ec('0x11')]);}})['catch'](function(_0x4f9ffd){logger['error']('ContactItemType,\x20%s,\x20%s',_0x21e3f7,_0x4f9ffd);_0x268c50(_0x4f9ffd);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 4ff8b54..aa50743 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 _0xe4b0=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0xbf64ae,_0x54f83b){var _0x2ed262=function(_0x262c73){while(--_0x262c73){_0xbf64ae['push'](_0xbf64ae['shift']());}};_0x2ed262(++_0x54f83b);}(_0xe4b0,0x1b7));var _0x0e4b=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0xe4b0[_0x26f1b2];return _0x1624a4;};'use strict';var multer=require(_0x0e4b('0x0'));var util=require(_0x0e4b('0x1'));var path=require(_0x0e4b('0x2'));var timeout=require(_0x0e4b('0x3'));var express=require(_0x0e4b('0x4'));var router=express[_0x0e4b('0x5')]();var fs_extra=require(_0x0e4b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0e4b('0x7'));var config=require(_0x0e4b('0x8'));var controller=require(_0x0e4b('0x9'));router[_0x0e4b('0xa')]('/',auth[_0x0e4b('0xb')](),controller[_0x0e4b('0xc')]);router['get'](_0x0e4b('0xd'),auth['isAuthenticated'](),controller[_0x0e4b('0xe')]);router[_0x0e4b('0xf')]('/',auth[_0x0e4b('0xb')](),controller[_0x0e4b('0x10')]);router[_0x0e4b('0x11')](_0x0e4b('0xd'),auth[_0x0e4b('0xb')](),controller[_0x0e4b('0x12')]);router['delete'](_0x0e4b('0xd'),auth[_0x0e4b('0xb')](),controller[_0x0e4b('0x13')]);module[_0x0e4b('0x14')]=router; \ No newline at end of file +var _0xd702=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x4c23b6,_0x4bd0e6){var _0x507cde=function(_0x3a626f){while(--_0x3a626f){_0x4c23b6['push'](_0x4c23b6['shift']());}};_0x507cde(++_0x4bd0e6);}(_0xd702,0x121));var _0x2d70=function(_0x59dc26,_0x1b2a67){_0x59dc26=_0x59dc26-0x0;var _0x1324a7=_0xd702[_0x59dc26];return _0x1324a7;};'use strict';var multer=require('multer');var util=require(_0x2d70('0x0'));var path=require(_0x2d70('0x1'));var timeout=require(_0x2d70('0x2'));var express=require(_0x2d70('0x3'));var router=express[_0x2d70('0x4')]();var fs_extra=require(_0x2d70('0x5'));var auth=require(_0x2d70('0x6'));var interaction=require(_0x2d70('0x7'));var config=require(_0x2d70('0x8'));var controller=require(_0x2d70('0x9'));router['get']('/',auth[_0x2d70('0xa')](),controller[_0x2d70('0xb')]);router['get'](_0x2d70('0xc'),auth['isAuthenticated'](),controller[_0x2d70('0xd')]);router[_0x2d70('0xe')]('/',auth['isAuthenticated'](),controller[_0x2d70('0xf')]);router[_0x2d70('0x10')](_0x2d70('0xc'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x2d70('0xa')](),controller['destroy']);module[_0x2d70('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 3c6dd60..afc9d37 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(_0xc2ac45,_0x47adf7){var _0x115d62=function(_0x51c3d7){while(--_0x51c3d7){_0xc2ac45['push'](_0xc2ac45['shift']());}};_0x115d62(++_0x47adf7);}(_0xb10b,0x12a));var _0xbb10=function(_0x17c1a4,_0x195273){_0x17c1a4=_0x17c1a4-0x0;var _0x2ecdee=_0xb10b[_0x17c1a4];return _0x2ecdee;};'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 _0xd8b0=['exports','sequelize'];(function(_0x108131,_0x39a0f4){var _0x23bda7=function(_0x1ce983){while(--_0x1ce983){_0x108131['push'](_0x108131['shift']());}};_0x23bda7(++_0x39a0f4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 6d15255..e19fccd 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 _0xef2b=['status','json','offset','undefined','limit','count','apply','reject','save','update','destroy','get','CustomDashboards','UserProfileResource','then','end','error','stack','name','send','Dashboard','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','catch','show','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','sendStatus'];(function(_0x423aa7,_0x292f1a){var _0x3e0222=function(_0x3d3ad5){while(--_0x3d3ad5){_0x423aa7['push'](_0x423aa7['shift']());}};_0x3e0222(++_0x292f1a);}(_0xef2b,0x1ef));var _0xbef2=function(_0xb96f50,_0xa21d9b){_0xb96f50=_0xb96f50-0x0;var _0x1caf5d=_0xef2b[_0xb96f50];return _0x1caf5d;};'use strict';var emlformat=require(_0xbef2('0x0'));var rimraf=require(_0xbef2('0x1'));var zipdir=require(_0xbef2('0x2'));var jsonpatch=require(_0xbef2('0x3'));var rp=require(_0xbef2('0x4'));var moment=require(_0xbef2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbef2('0x6'));var path=require(_0xbef2('0x7'));var sox=require(_0xbef2('0x8'));var csv=require(_0xbef2('0x9'));var ejs=require(_0xbef2('0xa'));var fs=require('fs');var fs_extra=require(_0xbef2('0xb'));var _=require('lodash');var squel=require(_0xbef2('0xc'));var crypto=require(_0xbef2('0xd'));var jsforce=require(_0xbef2('0xe'));var deskjs=require(_0xbef2('0xf'));var toCsv=require(_0xbef2('0x9'));var querystring=require('querystring');var Papa=require(_0xbef2('0x10'));var Redis=require(_0xbef2('0x11'));var authService=require(_0xbef2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbef2('0x13'));var hardwareService=require(_0xbef2('0x14'));var logger=require(_0xbef2('0x15'))(_0xbef2('0x16'));var utils=require(_0xbef2('0x17'));var config=require(_0xbef2('0x18'));var licenseUtil=require(_0xbef2('0x19'));var db=require(_0xbef2('0x1a'))['db'];config['redis']=_[_0xbef2('0x1b')](config[_0xbef2('0x1c')],{'host':_0xbef2('0x1d'),'port':0x18eb});var socket=require(_0xbef2('0x1e'))(new Redis(config[_0xbef2('0x1c')]));require(_0xbef2('0x1f'))['register'](socket);function respondWithStatusCode(_0x4680d2,_0x9b6233){_0x9b6233=_0x9b6233||0xcc;return function(_0x7acb75){if(_0x7acb75){return _0x4680d2[_0xbef2('0x20')](_0x9b6233);}return _0x4680d2[_0xbef2('0x21')](_0x9b6233)['end']();};}function respondWithResult(_0x44db30,_0xc29b44){_0xc29b44=_0xc29b44||0xc8;return function(_0x5b5fcd){if(_0x5b5fcd){return _0x44db30[_0xbef2('0x21')](_0xc29b44)[_0xbef2('0x22')](_0x5b5fcd);}};}function respondWithFilteredResult(_0x4dd5ff,_0x535e2d){return function(_0x3f534e){if(_0x3f534e){var _0x51f0ca=typeof _0x535e2d[_0xbef2('0x23')]===_0xbef2('0x24')&&typeof _0x535e2d[_0xbef2('0x25')]===_0xbef2('0x24');var _0x24bd33=_0x3f534e[_0xbef2('0x26')];var _0x3dfd69=_0x51f0ca?0x0:_0x535e2d[_0xbef2('0x23')];var _0x372d6f=_0x51f0ca?_0x3f534e['count']:_0x535e2d[_0xbef2('0x23')]+_0x535e2d[_0xbef2('0x25')];var _0x4ba8c9;if(_0x372d6f>=_0x24bd33){_0x372d6f=_0x24bd33;_0x4ba8c9=0xc8;}else{_0x4ba8c9=0xce;}_0x4dd5ff[_0xbef2('0x21')](_0x4ba8c9);return _0x4dd5ff['set']('Content-Range',_0x3dfd69+'-'+_0x372d6f+'/'+_0x24bd33)['json'](_0x3f534e);}return null;};}function patchUpdates(_0x44cd12){return function(_0x357a09){try{jsonpatch[_0xbef2('0x27')](_0x357a09,_0x44cd12,!![]);}catch(_0x2f9bcc){return BPromise[_0xbef2('0x28')](_0x2f9bcc);}return _0x357a09[_0xbef2('0x29')]();};}function saveUpdates(_0x11ee8f,_0x537d8d){return function(_0x36dea1){if(_0x36dea1){return _0x36dea1[_0xbef2('0x2a')](_0x11ee8f)['then'](function(_0x523732){return _0x523732;});}return null;};}function removeEntity(_0x65b2f3,_0x2bce70){return function(_0x1ae338){if(_0x1ae338){return _0x1ae338[_0xbef2('0x2b')]()['then'](function(){var _0x3d5659=_0x1ae338[_0xbef2('0x2c')]({'plain':!![]});var _0x4d8051=_0xbef2('0x2d');return db[_0xbef2('0x2e')]['destroy']({'where':{'type':_0x4d8051,'resourceId':_0x3d5659['id']}})['then'](function(){return _0x1ae338;});})[_0xbef2('0x2f')](function(){_0x65b2f3[_0xbef2('0x21')](0xcc)[_0xbef2('0x30')]();});}};}function handleEntityNotFound(_0x3454c0,_0x2adbc3){return function(_0x28338d){if(!_0x28338d){_0x3454c0[_0xbef2('0x20')](0x194);}return _0x28338d;};}function handleError(_0x43cb37,_0x2c8075){_0x2c8075=_0x2c8075||0x1f4;return function(_0x4a0040){logger[_0xbef2('0x31')](_0x4a0040[_0xbef2('0x32')]);if(_0x4a0040[_0xbef2('0x33')]){delete _0x4a0040[_0xbef2('0x33')];}_0x43cb37[_0xbef2('0x21')](_0x2c8075)[_0xbef2('0x34')](_0x4a0040);};}exports['index']=function(_0x504dfd,_0x380e52){var _0x6fe14d={},_0x1cc194={},_0x2039f4={'count':0x0,'rows':[]};var _0x1d007b=_['map'](db[_0xbef2('0x35')][_0xbef2('0x36')],function(_0x1fa5cc){return{'name':_0x1fa5cc[_0xbef2('0x37')],'type':_0x1fa5cc[_0xbef2('0x38')][_0xbef2('0x39')]};});_0x1cc194[_0xbef2('0x3a')]=_[_0xbef2('0x3b')](_0x1d007b,_0xbef2('0x33'));_0x1cc194['query']=_[_0xbef2('0x3c')](_0x504dfd[_0xbef2('0x3d')]);_0x1cc194['filters']=_[_0xbef2('0x3e')](_0x1cc194[_0xbef2('0x3a')],_0x1cc194[_0xbef2('0x3d')]);_0x6fe14d[_0xbef2('0x3f')]=_[_0xbef2('0x3e')](_0x1cc194[_0xbef2('0x3a')],qs['fields'](_0x504dfd[_0xbef2('0x3d')][_0xbef2('0x40')]));_0x6fe14d[_0xbef2('0x3f')]=_0x6fe14d[_0xbef2('0x3f')]['length']?_0x6fe14d[_0xbef2('0x3f')]:_0x1cc194[_0xbef2('0x3a')];if(!_0x504dfd['query'][_0xbef2('0x41')](_0xbef2('0x42'))){_0x6fe14d['limit']=qs[_0xbef2('0x25')](_0x504dfd['query'][_0xbef2('0x25')]);_0x6fe14d['offset']=qs[_0xbef2('0x23')](_0x504dfd['query']['offset']);}_0x6fe14d[_0xbef2('0x43')]=qs[_0xbef2('0x44')](_0x504dfd[_0xbef2('0x3d')][_0xbef2('0x44')]);_0x6fe14d[_0xbef2('0x45')]=qs[_0xbef2('0x46')](_[_0xbef2('0x47')](_0x504dfd[_0xbef2('0x3d')],_0x1cc194[_0xbef2('0x46')]),_0x1d007b);if(_0x504dfd[_0xbef2('0x3d')][_0xbef2('0x48')]){_0x6fe14d[_0xbef2('0x45')]=_['merge'](_0x6fe14d['where'],{'$or':_['map'](_0x1d007b,function(_0x28a97c){if(_0x28a97c[_0xbef2('0x38')]!=='VIRTUAL'){var _0x2dd4d5={};_0x2dd4d5[_0x28a97c[_0xbef2('0x33')]]={'$like':'%'+_0x504dfd[_0xbef2('0x3d')][_0xbef2('0x48')]+'%'};return _0x2dd4d5;}})});}_0x6fe14d=_[_0xbef2('0x49')]({},_0x6fe14d,_0x504dfd['options']);var _0x4a9c9b={'where':_0x6fe14d[_0xbef2('0x45')]};return db[_0xbef2('0x35')][_0xbef2('0x26')](_0x4a9c9b)['then'](function(_0x263133){_0x2039f4[_0xbef2('0x26')]=_0x263133;if(_0x504dfd[_0xbef2('0x3d')][_0xbef2('0x4a')]){_0x6fe14d[_0xbef2('0x4b')]=[{'all':!![]}];}return db['Dashboard'][_0xbef2('0x4c')](_0x6fe14d);})[_0xbef2('0x2f')](function(_0x538c3f){_0x2039f4['rows']=_0x538c3f;return _0x2039f4;})[_0xbef2('0x2f')](respondWithFilteredResult(_0x380e52,_0x6fe14d))[_0xbef2('0x4d')](handleError(_0x380e52,null));};exports[_0xbef2('0x4e')]=function(_0x213d02,_0x5a5f34){var _0x3eb898={'raw':![],'where':{'id':_0x213d02[_0xbef2('0x4f')]['id']}},_0x3136ae={};_0x3136ae[_0xbef2('0x3a')]=_[_0xbef2('0x3c')](db[_0xbef2('0x35')][_0xbef2('0x36')]);_0x3136ae[_0xbef2('0x3d')]=_[_0xbef2('0x3c')](_0x213d02['query']);_0x3136ae[_0xbef2('0x46')]=_[_0xbef2('0x3e')](_0x3136ae[_0xbef2('0x3a')],_0x3136ae[_0xbef2('0x3d')]);_0x3eb898[_0xbef2('0x3f')]=_[_0xbef2('0x3e')](_0x3136ae[_0xbef2('0x3a')],qs[_0xbef2('0x40')](_0x213d02[_0xbef2('0x3d')][_0xbef2('0x40')]));_0x3eb898[_0xbef2('0x3f')]=_0x3eb898[_0xbef2('0x3f')][_0xbef2('0x50')]?_0x3eb898['attributes']:_0x3136ae[_0xbef2('0x3a')];if(_0x213d02['query'][_0xbef2('0x4a')]){_0x3eb898[_0xbef2('0x4b')]=[{'all':!![]}];}_0x3eb898=_[_0xbef2('0x49')]({},_0x3eb898,_0x213d02[_0xbef2('0x51')]);return db[_0xbef2('0x35')][_0xbef2('0x52')](_0x3eb898)[_0xbef2('0x2f')](handleEntityNotFound(_0x5a5f34,null))[_0xbef2('0x2f')](respondWithResult(_0x5a5f34,null))[_0xbef2('0x4d')](handleError(_0x5a5f34,null));};exports[_0xbef2('0x53')]=function(_0x3011a1,_0x23e06d){return db[_0xbef2('0x35')][_0xbef2('0x53')](_0x3011a1[_0xbef2('0x54')],{})['then'](function(_0x39747e){var _0x356f9c=_0x3011a1[_0xbef2('0x55')][_0xbef2('0x2c')]({'plain':!![]});if(!_0x356f9c)throw new Error(_0xbef2('0x56'));if(_0x356f9c[_0xbef2('0x57')]==='user'){var _0x16dc38=_0x39747e[_0xbef2('0x2c')]({'plain':!![]});var _0x101c1f=_0xbef2('0x2d');return db[_0xbef2('0x58')][_0xbef2('0x52')]({'where':{'name':_0x101c1f,'userProfileId':_0x356f9c[_0xbef2('0x59')]},'raw':!![]})[_0xbef2('0x2f')](function(_0x26a264){if(_0x26a264&&_0x26a264[_0xbef2('0x5a')]===0x0){return db['UserProfileResource']['create']({'name':_0x16dc38['name'],'resourceId':_0x16dc38['id'],'type':_0x26a264[_0xbef2('0x33')],'sectionId':_0x26a264['id']},{})[_0xbef2('0x2f')](function(){return _0x39747e;});}else{return _0x39747e;}})[_0xbef2('0x4d')](function(_0x2a8700){logger[_0xbef2('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a8700);throw _0x2a8700;});}return _0x39747e;})[_0xbef2('0x2f')](respondWithResult(_0x23e06d,0xc9))[_0xbef2('0x4d')](handleError(_0x23e06d,null));};exports['clone']=function(_0x493676,_0x5b9e95){var _0x423343={'where':{'id':_0x493676[_0xbef2('0x4f')]['id']}},_0x43d23c={};_0x43d23c[_0xbef2('0x3a')]=_[_0xbef2('0x3c')](db['Dashboard']['rawAttributes']);_0x423343[_0xbef2('0x3f')]=_[_0xbef2('0x3e')](_0x43d23c[_0xbef2('0x3a')],qs[_0xbef2('0x40')](_0x493676['query'][_0xbef2('0x40')]));_0x423343[_0xbef2('0x3f')]=_0x423343[_0xbef2('0x3f')][_0xbef2('0x50')]?_0x423343['attributes']:_0x43d23c['model'];if(_0x493676['query'][_0xbef2('0x4a')]){_0x423343['include']=[{'all':!![]}];}_0x423343=_[_0xbef2('0x49')]({},_0x423343,_0x493676[_0xbef2('0x51')]);return db[_0xbef2('0x35')]['find'](_0x423343)[_0xbef2('0x2f')](handleEntityNotFound(_0x5b9e95,null))[_0xbef2('0x2f')](function(_0x397cf9){if(_0x397cf9){var _0x121cec=_0x397cf9[_0xbef2('0x2c')]({'plain':!![]});_0x121cec=qs[_0xbef2('0x5b')](_0x121cec,['id',_0xbef2('0x5c'),_0xbef2('0x5d')]);_0x493676['body']=_[_0xbef2('0x5b')](_0x493676['body'],['id','createdAt',_0xbef2('0x5d')]);return db[_0xbef2('0x35')][_0xbef2('0x53')](_['merge'](_0x121cec,_0x493676[_0xbef2('0x54')]),{'include':_0x493676[_0xbef2('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0xbef2('0x2f')](function(_0x5b04a4){var _0x51a0d3=_0x493676[_0xbef2('0x55')]['get']({'plain':!![]});if(!_0x51a0d3)throw new Error(_0xbef2('0x56'));if(_0x51a0d3['role']==='user'){var _0x55061d=_0x5b04a4[_0xbef2('0x2c')]({'plain':!![]});var _0x21e119=_0xbef2('0x2d');return db[_0xbef2('0x58')]['find']({'where':{'name':_0x21e119,'userProfileId':_0x51a0d3[_0xbef2('0x59')]},'raw':!![]})[_0xbef2('0x2f')](function(_0x449b5d){if(_0x449b5d&&_0x449b5d[_0xbef2('0x5a')]===0x0){return db[_0xbef2('0x2e')][_0xbef2('0x53')]({'name':_0x55061d['name'],'resourceId':_0x55061d['id'],'type':_0x449b5d[_0xbef2('0x33')],'sectionId':_0x449b5d['id']},{})[_0xbef2('0x2f')](function(){return _0x5b04a4;});}else{return _0x5b04a4;}})[_0xbef2('0x4d')](function(_0x1c3730){logger[_0xbef2('0x31')](_0xbef2('0x5e'),_0x1c3730);throw _0x1c3730;});}return _0x5b04a4;});}})[_0xbef2('0x2f')](respondWithResult(_0x5b9e95,0xc9))[_0xbef2('0x4d')](handleError(_0x5b9e95,null));};exports[_0xbef2('0x2a')]=function(_0x42f93f,_0x3e1bea){if(_0x42f93f['body']['id']){delete _0x42f93f[_0xbef2('0x54')]['id'];}return db['Dashboard'][_0xbef2('0x52')]({'where':{'id':_0x42f93f[_0xbef2('0x4f')]['id']}})[_0xbef2('0x2f')](handleEntityNotFound(_0x3e1bea,null))[_0xbef2('0x2f')](saveUpdates(_0x42f93f[_0xbef2('0x54')],null))[_0xbef2('0x2f')](respondWithResult(_0x3e1bea,null))[_0xbef2('0x4d')](handleError(_0x3e1bea,null));};exports[_0xbef2('0x2b')]=function(_0xfdc74c,_0x297543){return db[_0xbef2('0x35')]['find']({'where':{'id':_0xfdc74c[_0xbef2('0x4f')]['id']}})[_0xbef2('0x2f')](handleEntityNotFound(_0x297543,null))[_0xbef2('0x2f')](removeEntity(_0x297543,null))[_0xbef2('0x4d')](handleError(_0x297543,null));};function widgetAttributes(_0x5d2cdc){try{switch(_0x5d2cdc[_0xbef2('0x38')]){case _0xbef2('0x5f'):return[{'name':_0xbef2('0x60'),'value':_0x5d2cdc['attrUrl']||(_0x5d2cdc[_0xbef2('0x61')]&&_0x5d2cdc['attrs'][0x0]?_0x5d2cdc[_0xbef2('0x61')][0x0][_0xbef2('0x62')]:undefined)||_0xbef2('0x63')}];case _0xbef2('0x64'):return[{'name':_0xbef2('0x65'),'value':_0x5d2cdc['attrPath']||(_0x5d2cdc[_0xbef2('0x61')]&&_0x5d2cdc['attrs'][0x0]?_0x5d2cdc['attrs'][0x0][_0xbef2('0x62')]:undefined)||''}];case _0xbef2('0x66'):return[{'name':_0xbef2('0x67'),'value':_0x5d2cdc[_0xbef2('0x67')]||(_0x5d2cdc[_0xbef2('0x61')]&&_0x5d2cdc[_0xbef2('0x61')][0x0]?_0x5d2cdc[_0xbef2('0x61')][0x0][_0xbef2('0x62')]:undefined)||_0xbef2('0x68')},{'name':_0xbef2('0x69'),'value':_0x5d2cdc[_0xbef2('0x69')]||(_0x5d2cdc['attrs']&&_0x5d2cdc['attrs'][0x1]?_0x5d2cdc[_0xbef2('0x61')][0x1]['value']:undefined)||_0xbef2('0x6a')},{'name':_0xbef2('0x6b'),'value':_0x5d2cdc[_0xbef2('0x6b')]||(_0x5d2cdc[_0xbef2('0x61')]&&_0x5d2cdc[_0xbef2('0x61')][0x2]?_0x5d2cdc[_0xbef2('0x61')][0x2][_0xbef2('0x62')]:undefined)||0xc}];case _0xbef2('0x6c'):return[{'name':_0xbef2('0x6d'),'value':_0x5d2cdc[_0xbef2('0x6d')]||(_0x5d2cdc[_0xbef2('0x61')]&&_0x5d2cdc[_0xbef2('0x61')][0x0]?_0x5d2cdc['attrs'][0x0]['value']:undefined)||_0xbef2('0x6e')},{'name':_0xbef2('0x6f'),'value':_0x5d2cdc[_0xbef2('0x6f')]||(_0x5d2cdc['attrs']&&_0x5d2cdc[_0xbef2('0x61')][0x1]?_0x5d2cdc[_0xbef2('0x61')][0x1][_0xbef2('0x62')]:undefined)||[]},{'name':'attrFontSize','value':_0x5d2cdc[_0xbef2('0x6b')]||(_0x5d2cdc[_0xbef2('0x61')]&&_0x5d2cdc[_0xbef2('0x61')][0x2]?_0x5d2cdc[_0xbef2('0x61')][0x2][_0xbef2('0x62')]:undefined)||0x14},{'name':_0xbef2('0x70'),'value':_0x5d2cdc[_0xbef2('0x70')]||(_0x5d2cdc[_0xbef2('0x61')]&&_0x5d2cdc[_0xbef2('0x61')][0x3]?_0x5d2cdc[_0xbef2('0x61')][0x3][_0xbef2('0x62')]:undefined)||'voice'},{'name':_0xbef2('0x71'),'value':_0x5d2cdc[_0xbef2('0x71')]||(_0x5d2cdc[_0xbef2('0x61')]&&_0x5d2cdc[_0xbef2('0x61')][0x4]?_0x5d2cdc[_0xbef2('0x61')][0x4][_0xbef2('0x62')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x5d2cdc[_0xbef2('0x72')]||(_0x5d2cdc['attrs']&&_0x5d2cdc['attrs'][0x5]?_0x5d2cdc[_0xbef2('0x61')][0x5][_0xbef2('0x62')]:undefined)||''},{'name':_0xbef2('0x73'),'value':_0x5d2cdc[_0xbef2('0x73')]||(_0x5d2cdc[_0xbef2('0x61')]&&_0x5d2cdc['attrs'][0x6]?_0x5d2cdc[_0xbef2('0x61')][0x6][_0xbef2('0x62')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5d2cdc[_0xbef2('0x74')]||(_0x5d2cdc[_0xbef2('0x61')]&&_0x5d2cdc[_0xbef2('0x61')][0x7]?_0x5d2cdc[_0xbef2('0x61')][0x7][_0xbef2('0x62')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5d2cdc[_0xbef2('0x75')]||(_0x5d2cdc[_0xbef2('0x61')]&&_0x5d2cdc[_0xbef2('0x61')][0x8]?_0x5d2cdc['attrs'][0x8]['value']:undefined)||''},{'name':_0xbef2('0x76'),'value':_0x5d2cdc[_0xbef2('0x76')]||(_0x5d2cdc['attrs']&&_0x5d2cdc[_0xbef2('0x61')][0x9]?_0x5d2cdc['attrs'][0x9]['value']:undefined)||''}];case'multibar-chart':case _0xbef2('0x77'):return[{'name':_0xbef2('0x78'),'value':_0x5d2cdc['attrSerie1']||(_0x5d2cdc[_0xbef2('0x61')]&&_0x5d2cdc[_0xbef2('0x61')][0x0]?_0x5d2cdc[_0xbef2('0x61')][0x0][_0xbef2('0x62')]:undefined)||'total'},{'name':'attrSerie2','value':_0x5d2cdc['attrSerie2']||(_0x5d2cdc[_0xbef2('0x61')]&&_0x5d2cdc[_0xbef2('0x61')][0x1]?_0x5d2cdc[_0xbef2('0x61')][0x1][_0xbef2('0x62')]:undefined)||null},{'name':_0xbef2('0x79'),'value':_0x5d2cdc[_0xbef2('0x79')]||(_0x5d2cdc[_0xbef2('0x61')]&&_0x5d2cdc['attrs'][0x2]?_0x5d2cdc[_0xbef2('0x61')][0x2][_0xbef2('0x62')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x5d2cdc[_0xbef2('0x6f')]||(_0x5d2cdc[_0xbef2('0x61')]&&_0x5d2cdc['attrs'][0x3]?_0x5d2cdc[_0xbef2('0x61')][0x3][_0xbef2('0x62')]:undefined)||[]},{'name':_0xbef2('0x70'),'value':_0x5d2cdc['attrChannel']||(_0x5d2cdc[_0xbef2('0x61')]&&_0x5d2cdc[_0xbef2('0x61')][0x4]?_0x5d2cdc[_0xbef2('0x61')][0x4][_0xbef2('0x62')]:undefined)||'voice'},{'name':_0xbef2('0x71'),'value':_0x5d2cdc['attrEmailAccounts']||(_0x5d2cdc[_0xbef2('0x61')]&&_0x5d2cdc[_0xbef2('0x61')][0x5]?_0x5d2cdc['attrs'][0x5][_0xbef2('0x62')]:undefined)||''},{'name':_0xbef2('0x72'),'value':_0x5d2cdc['attrFaxAccounts']||(_0x5d2cdc[_0xbef2('0x61')]&&_0x5d2cdc['attrs'][0x6]?_0x5d2cdc[_0xbef2('0x61')][0x6][_0xbef2('0x62')]:undefined)||''},{'name':_0xbef2('0x73'),'value':_0x5d2cdc['attrSmsAccounts']||(_0x5d2cdc['attrs']&&_0x5d2cdc[_0xbef2('0x61')][0x7]?_0x5d2cdc['attrs'][0x7][_0xbef2('0x62')]:undefined)||''},{'name':_0xbef2('0x74'),'value':_0x5d2cdc[_0xbef2('0x74')]||(_0x5d2cdc[_0xbef2('0x61')]&&_0x5d2cdc['attrs'][0x8]?_0x5d2cdc[_0xbef2('0x61')][0x8][_0xbef2('0x62')]:undefined)||''},{'name':_0xbef2('0x75'),'value':_0x5d2cdc[_0xbef2('0x75')]||(_0x5d2cdc[_0xbef2('0x61')]&&_0x5d2cdc[_0xbef2('0x61')][0x9]?_0x5d2cdc[_0xbef2('0x61')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x5d2cdc[_0xbef2('0x76')]||(_0x5d2cdc[_0xbef2('0x61')]&&_0x5d2cdc[_0xbef2('0x61')][0xa]?_0x5d2cdc['attrs'][0xa][_0xbef2('0x62')]:undefined)||''}];case _0xbef2('0x7a'):return[{'name':'attrReport','type':_0x5d2cdc[_0xbef2('0x7b')]||(_0x5d2cdc[_0xbef2('0x61')]&&_0x5d2cdc[_0xbef2('0x61')][0x0]?_0x5d2cdc[_0xbef2('0x61')][0x0]['type']:undefined)||null,'value':_0x5d2cdc[_0xbef2('0x7c')]||(_0x5d2cdc[_0xbef2('0x61')]&&_0x5d2cdc[_0xbef2('0x61')][0x0]?_0x5d2cdc[_0xbef2('0x61')][0x0][_0xbef2('0x62')]:undefined)||null},{'name':'attrRefresh','value':_0x5d2cdc[_0xbef2('0x7d')]||(_0x5d2cdc[_0xbef2('0x61')]&&_0x5d2cdc[_0xbef2('0x61')][0x1]?_0x5d2cdc[_0xbef2('0x61')][0x1][_0xbef2('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x7edb97){logger[_0xbef2('0x31')](_0xbef2('0x7e'),JSON[_0xbef2('0x7f')](_0x7edb97));return[];}}exports[_0xbef2('0x80')]=function(_0x4ca519,_0x1ea8b7,_0x2c0760){if(_0x4ca519[_0xbef2('0x54')]['id']){delete _0x4ca519['body']['id'];}return db[_0xbef2('0x35')]['find']({'where':{'id':_0x4ca519[_0xbef2('0x4f')]['id']}})[_0xbef2('0x2f')](handleEntityNotFound(_0x1ea8b7,null))['then'](function(_0x323890){if(_0x323890){_0x4ca519[_0xbef2('0x54')][_0xbef2('0x81')]=_0x323890['id'];_0x4ca519[_0xbef2('0x54')][_0xbef2('0x61')]=widgetAttributes(_0x4ca519['body']);return db[_0xbef2('0x82')][_0xbef2('0x53')](_0x4ca519[_0xbef2('0x54')]);}})['then'](respondWithResult(_0x1ea8b7,null))[_0xbef2('0x4d')](handleError(_0x1ea8b7,null));};exports[_0xbef2('0x83')]=function(_0x24c0ef,_0xc0ad46,_0x49e91a){var _0x5d11e6={};var _0x4d854d={};var _0x7b2c4b;var _0x22efa6;return db[_0xbef2('0x35')]['findOne']({'where':{'id':_0x24c0ef[_0xbef2('0x4f')]['id']}})[_0xbef2('0x2f')](handleEntityNotFound(_0xc0ad46,null))[_0xbef2('0x2f')](function(_0x43097d){if(_0x43097d){_0x7b2c4b=_0x43097d;_0x4d854d[_0xbef2('0x3a')]=_[_0xbef2('0x3c')](db[_0xbef2('0x82')][_0xbef2('0x36')]);_0x4d854d[_0xbef2('0x3d')]=_[_0xbef2('0x3c')](_0x24c0ef[_0xbef2('0x3d')]);_0x4d854d['filters']=_[_0xbef2('0x3e')](_0x4d854d[_0xbef2('0x3a')],_0x4d854d[_0xbef2('0x3d')]);_0x5d11e6[_0xbef2('0x3f')]=_[_0xbef2('0x3e')](_0x4d854d['model'],qs[_0xbef2('0x40')](_0x24c0ef['query'][_0xbef2('0x40')]));_0x5d11e6['attributes']=_0x5d11e6[_0xbef2('0x3f')][_0xbef2('0x50')]?_0x5d11e6[_0xbef2('0x3f')]:_0x4d854d[_0xbef2('0x3a')];_0x5d11e6[_0xbef2('0x43')]=qs[_0xbef2('0x44')](_0x24c0ef[_0xbef2('0x3d')][_0xbef2('0x44')]);_0x5d11e6[_0xbef2('0x45')]=qs['filters'](_[_0xbef2('0x47')](_0x24c0ef[_0xbef2('0x3d')],_0x4d854d[_0xbef2('0x46')]));if(_0x24c0ef[_0xbef2('0x3d')][_0xbef2('0x48')]){_0x5d11e6[_0xbef2('0x45')]=_[_0xbef2('0x49')](_0x5d11e6[_0xbef2('0x45')],{'$or':_[_0xbef2('0x3b')](_0x5d11e6['attributes'],function(_0x25131f){var _0x3ff720={};_0x3ff720[_0x25131f]={'$like':'%'+_0x24c0ef[_0xbef2('0x3d')][_0xbef2('0x48')]+'%'};return _0x3ff720;})});}_0x5d11e6=_[_0xbef2('0x49')]({},_0x5d11e6,_0x24c0ef[_0xbef2('0x51')]);return _0x7b2c4b['getItems'](_0x5d11e6);}})['then'](function(_0x6e9f2b){if(_0x6e9f2b){_0x22efa6=_0x6e9f2b[_0xbef2('0x50')];if(!_0x24c0ef[_0xbef2('0x3d')]['hasOwnProperty'](_0xbef2('0x42'))){_0x5d11e6[_0xbef2('0x25')]=qs[_0xbef2('0x25')](_0x24c0ef[_0xbef2('0x3d')][_0xbef2('0x25')]);_0x5d11e6[_0xbef2('0x23')]=qs[_0xbef2('0x23')](_0x24c0ef[_0xbef2('0x3d')][_0xbef2('0x23')]);}return _0x7b2c4b[_0xbef2('0x83')](_0x5d11e6);}})[_0xbef2('0x2f')](function(_0x443d5d){if(_0x443d5d){return _0x443d5d?{'count':_0x22efa6,'rows':_0x443d5d}:null;}})['then'](respondWithResult(_0xc0ad46,null))[_0xbef2('0x4d')](handleError(_0xc0ad46,null));}; \ No newline at end of file +var _0x8a82=['redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','destroy','then','get','end','error','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','keys','query','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','filters','includeAll','create','user','role','CustomDashboards','find','userProfileId','autoAssociation','UserProfileResource','omit','body','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','iframe','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrSmsAccounts','web-report','reportType','attrReport','attrRefresh','stringify','addItem','DashboardItem','getItems','findOne','pick','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3c4ab7,_0x25ed12){var _0x536d89=function(_0x30d0cc){while(--_0x30d0cc){_0x3c4ab7['push'](_0x3c4ab7['shift']());}};_0x536d89(++_0x25ed12);}(_0x8a82,0x69));var _0x28a8=function(_0x26cd80,_0x397b6d){_0x26cd80=_0x26cd80-0x0;var _0x238cda=_0x8a82[_0x26cd80];return _0x238cda;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x28a8('0x0'));var zipdir=require(_0x28a8('0x1'));var jsonpatch=require(_0x28a8('0x2'));var rp=require(_0x28a8('0x3'));var moment=require(_0x28a8('0x4'));var BPromise=require(_0x28a8('0x5'));var Mustache=require(_0x28a8('0x6'));var util=require(_0x28a8('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x28a8('0x8'));var ejs=require(_0x28a8('0x9'));var fs=require('fs');var fs_extra=require(_0x28a8('0xa'));var _=require('lodash');var squel=require(_0x28a8('0xb'));var crypto=require('crypto');var jsforce=require(_0x28a8('0xc'));var deskjs=require(_0x28a8('0xd'));var toCsv=require(_0x28a8('0x8'));var querystring=require('querystring');var Papa=require(_0x28a8('0xe'));var Redis=require(_0x28a8('0xf'));var authService=require(_0x28a8('0x10'));var qs=require(_0x28a8('0x11'));var as=require(_0x28a8('0x12'));var hardwareService=require(_0x28a8('0x13'));var logger=require(_0x28a8('0x14'))('api');var utils=require(_0x28a8('0x15'));var config=require(_0x28a8('0x16'));var licenseUtil=require(_0x28a8('0x17'));var db=require('../../mysqldb')['db'];config[_0x28a8('0x18')]=_[_0x28a8('0x19')](config[_0x28a8('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x28a8('0x1a'))(new Redis(config[_0x28a8('0x18')]));require(_0x28a8('0x1b'))[_0x28a8('0x1c')](socket);function respondWithStatusCode(_0x20caf5,_0x5518d8){_0x5518d8=_0x5518d8||0xcc;return function(_0x11b9b4){if(_0x11b9b4){return _0x20caf5[_0x28a8('0x1d')](_0x5518d8);}return _0x20caf5[_0x28a8('0x1e')](_0x5518d8)['end']();};}function respondWithResult(_0x1e8fad,_0x3f3560){_0x3f3560=_0x3f3560||0xc8;return function(_0x40ae07){if(_0x40ae07){return _0x1e8fad['status'](_0x3f3560)[_0x28a8('0x1f')](_0x40ae07);}};}function respondWithFilteredResult(_0x2da3fa,_0x4e7cc6){return function(_0x310b46){if(_0x310b46){var _0x124c5a=typeof _0x4e7cc6[_0x28a8('0x20')]===_0x28a8('0x21')&&typeof _0x4e7cc6['limit']==='undefined';var _0x405bac=_0x310b46['count'];var _0x142ae2=_0x124c5a?0x0:_0x4e7cc6['offset'];var _0x5a7ff7=_0x124c5a?_0x310b46[_0x28a8('0x22')]:_0x4e7cc6[_0x28a8('0x20')]+_0x4e7cc6[_0x28a8('0x23')];var _0xb81e60;if(_0x5a7ff7>=_0x405bac){_0x5a7ff7=_0x405bac;_0xb81e60=0xc8;}else{_0xb81e60=0xce;}_0x2da3fa['status'](_0xb81e60);return _0x2da3fa[_0x28a8('0x24')](_0x28a8('0x25'),_0x142ae2+'-'+_0x5a7ff7+'/'+_0x405bac)[_0x28a8('0x1f')](_0x310b46);}return null;};}function patchUpdates(_0x3559c7){return function(_0x24fca3){try{jsonpatch['apply'](_0x24fca3,_0x3559c7,!![]);}catch(_0x58f95d){return BPromise[_0x28a8('0x26')](_0x58f95d);}return _0x24fca3[_0x28a8('0x27')]();};}function saveUpdates(_0x2de655,_0x152484){return function(_0x3713e4){if(_0x3713e4){return _0x3713e4['update'](_0x2de655)['then'](function(_0x2efb7e){return _0x2efb7e;});}return null;};}function removeEntity(_0x59155d,_0x5bf568){return function(_0x9d5ca6){if(_0x9d5ca6){return _0x9d5ca6[_0x28a8('0x28')]()[_0x28a8('0x29')](function(){var _0x10cbb5=_0x9d5ca6[_0x28a8('0x2a')]({'plain':!![]});var _0x29b777='CustomDashboards';return db['UserProfileResource']['destroy']({'where':{'type':_0x29b777,'resourceId':_0x10cbb5['id']}})['then'](function(){return _0x9d5ca6;});})['then'](function(){_0x59155d['status'](0xcc)[_0x28a8('0x2b')]();});}};}function handleEntityNotFound(_0x152411,_0x26ad66){return function(_0x578c1f){if(!_0x578c1f){_0x152411['sendStatus'](0x194);}return _0x578c1f;};}function handleError(_0x64107a,_0x49546f){_0x49546f=_0x49546f||0x1f4;return function(_0x244bf8){logger[_0x28a8('0x2c')](_0x244bf8['stack']);if(_0x244bf8[_0x28a8('0x2d')]){delete _0x244bf8[_0x28a8('0x2d')];}_0x64107a[_0x28a8('0x1e')](_0x49546f)[_0x28a8('0x2e')](_0x244bf8);};}exports[_0x28a8('0x2f')]=function(_0x20cd95,_0x610823){var _0x23da0a={},_0x19db01={},_0x147e13={'count':0x0,'rows':[]};var _0x30cb5b=_[_0x28a8('0x30')](db[_0x28a8('0x31')][_0x28a8('0x32')],function(_0x3b107c){return{'name':_0x3b107c[_0x28a8('0x33')],'type':_0x3b107c[_0x28a8('0x34')][_0x28a8('0x35')]};});_0x19db01['model']=_['map'](_0x30cb5b,_0x28a8('0x2d'));_0x19db01['query']=_[_0x28a8('0x36')](_0x20cd95[_0x28a8('0x37')]);_0x19db01['filters']=_[_0x28a8('0x38')](_0x19db01['model'],_0x19db01['query']);_0x23da0a[_0x28a8('0x39')]=_[_0x28a8('0x38')](_0x19db01['model'],qs[_0x28a8('0x3a')](_0x20cd95[_0x28a8('0x37')][_0x28a8('0x3a')]));_0x23da0a[_0x28a8('0x39')]=_0x23da0a[_0x28a8('0x39')][_0x28a8('0x3b')]?_0x23da0a[_0x28a8('0x39')]:_0x19db01[_0x28a8('0x3c')];if(!_0x20cd95[_0x28a8('0x37')][_0x28a8('0x3d')](_0x28a8('0x3e'))){_0x23da0a[_0x28a8('0x23')]=qs[_0x28a8('0x23')](_0x20cd95[_0x28a8('0x37')]['limit']);_0x23da0a[_0x28a8('0x20')]=qs['offset'](_0x20cd95[_0x28a8('0x37')][_0x28a8('0x20')]);}_0x23da0a[_0x28a8('0x3f')]=qs[_0x28a8('0x40')](_0x20cd95[_0x28a8('0x37')][_0x28a8('0x40')]);_0x23da0a[_0x28a8('0x41')]=qs['filters'](_['pick'](_0x20cd95[_0x28a8('0x37')],_0x19db01['filters']),_0x30cb5b);if(_0x20cd95[_0x28a8('0x37')][_0x28a8('0x42')]){_0x23da0a[_0x28a8('0x41')]=_[_0x28a8('0x43')](_0x23da0a[_0x28a8('0x41')],{'$or':_[_0x28a8('0x30')](_0x30cb5b,function(_0x56adbd){if(_0x56adbd[_0x28a8('0x34')]!==_0x28a8('0x44')){var _0x1991f4={};_0x1991f4[_0x56adbd['name']]={'$like':'%'+_0x20cd95[_0x28a8('0x37')][_0x28a8('0x42')]+'%'};return _0x1991f4;}})});}_0x23da0a=_['merge']({},_0x23da0a,_0x20cd95[_0x28a8('0x45')]);var _0x43b48c={'where':_0x23da0a['where']};return db[_0x28a8('0x31')][_0x28a8('0x22')](_0x43b48c)[_0x28a8('0x29')](function(_0xb99924){_0x147e13['count']=_0xb99924;if(_0x20cd95[_0x28a8('0x37')]['includeAll']){_0x23da0a[_0x28a8('0x46')]=[{'all':!![]}];}return db[_0x28a8('0x31')][_0x28a8('0x47')](_0x23da0a);})[_0x28a8('0x29')](function(_0x344a46){_0x147e13['rows']=_0x344a46;return _0x147e13;})[_0x28a8('0x29')](respondWithFilteredResult(_0x610823,_0x23da0a))[_0x28a8('0x48')](handleError(_0x610823,null));};exports[_0x28a8('0x49')]=function(_0x45eefd,_0x55ed91){var _0x5899e4={'raw':![],'where':{'id':_0x45eefd[_0x28a8('0x4a')]['id']}},_0xbbd6e4={};_0xbbd6e4[_0x28a8('0x3c')]=_[_0x28a8('0x36')](db['Dashboard'][_0x28a8('0x32')]);_0xbbd6e4[_0x28a8('0x37')]=_[_0x28a8('0x36')](_0x45eefd[_0x28a8('0x37')]);_0xbbd6e4[_0x28a8('0x4b')]=_['intersection'](_0xbbd6e4[_0x28a8('0x3c')],_0xbbd6e4[_0x28a8('0x37')]);_0x5899e4[_0x28a8('0x39')]=_[_0x28a8('0x38')](_0xbbd6e4['model'],qs[_0x28a8('0x3a')](_0x45eefd[_0x28a8('0x37')]['fields']));_0x5899e4[_0x28a8('0x39')]=_0x5899e4[_0x28a8('0x39')]['length']?_0x5899e4[_0x28a8('0x39')]:_0xbbd6e4[_0x28a8('0x3c')];if(_0x45eefd[_0x28a8('0x37')][_0x28a8('0x4c')]){_0x5899e4[_0x28a8('0x46')]=[{'all':!![]}];}_0x5899e4=_[_0x28a8('0x43')]({},_0x5899e4,_0x45eefd['options']);return db[_0x28a8('0x31')]['find'](_0x5899e4)[_0x28a8('0x29')](handleEntityNotFound(_0x55ed91,null))[_0x28a8('0x29')](respondWithResult(_0x55ed91,null))[_0x28a8('0x48')](handleError(_0x55ed91,null));};exports[_0x28a8('0x4d')]=function(_0x1b46f4,_0x2e8b2a){return db[_0x28a8('0x31')]['create'](_0x1b46f4['body'],{})[_0x28a8('0x29')](function(_0x2841b6){var _0x49cc05=_0x1b46f4[_0x28a8('0x4e')][_0x28a8('0x2a')]({'plain':!![]});if(!_0x49cc05)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49cc05[_0x28a8('0x4f')]===_0x28a8('0x4e')){var _0x39a294=_0x2841b6[_0x28a8('0x2a')]({'plain':!![]});var _0x5ba21d=_0x28a8('0x50');return db['UserProfileSection'][_0x28a8('0x51')]({'where':{'name':_0x5ba21d,'userProfileId':_0x49cc05[_0x28a8('0x52')]},'raw':!![]})[_0x28a8('0x29')](function(_0x380839){if(_0x380839&&_0x380839[_0x28a8('0x53')]===0x0){return db[_0x28a8('0x54')][_0x28a8('0x4d')]({'name':_0x39a294[_0x28a8('0x2d')],'resourceId':_0x39a294['id'],'type':_0x380839[_0x28a8('0x2d')],'sectionId':_0x380839['id']},{})[_0x28a8('0x29')](function(){return _0x2841b6;});}else{return _0x2841b6;}})[_0x28a8('0x48')](function(_0xa58676){logger[_0x28a8('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa58676);throw _0xa58676;});}return _0x2841b6;})[_0x28a8('0x29')](respondWithResult(_0x2e8b2a,0xc9))[_0x28a8('0x48')](handleError(_0x2e8b2a,null));};exports['clone']=function(_0x16ecc5,_0x25816e){var _0x1561e7={'where':{'id':_0x16ecc5[_0x28a8('0x4a')]['id']}},_0x343086={};_0x343086[_0x28a8('0x3c')]=_['keys'](db[_0x28a8('0x31')][_0x28a8('0x32')]);_0x1561e7['attributes']=_[_0x28a8('0x38')](_0x343086[_0x28a8('0x3c')],qs[_0x28a8('0x3a')](_0x16ecc5[_0x28a8('0x37')][_0x28a8('0x3a')]));_0x1561e7[_0x28a8('0x39')]=_0x1561e7[_0x28a8('0x39')][_0x28a8('0x3b')]?_0x1561e7[_0x28a8('0x39')]:_0x343086[_0x28a8('0x3c')];if(_0x16ecc5['query'][_0x28a8('0x4c')]){_0x1561e7[_0x28a8('0x46')]=[{'all':!![]}];}_0x1561e7=_[_0x28a8('0x43')]({},_0x1561e7,_0x16ecc5[_0x28a8('0x45')]);return db[_0x28a8('0x31')]['find'](_0x1561e7)[_0x28a8('0x29')](handleEntityNotFound(_0x25816e,null))[_0x28a8('0x29')](function(_0x22e0ce){if(_0x22e0ce){var _0x193cff=_0x22e0ce['get']({'plain':!![]});_0x193cff=qs[_0x28a8('0x55')](_0x193cff,['id','createdAt','updatedAt']);_0x16ecc5['body']=_[_0x28a8('0x55')](_0x16ecc5[_0x28a8('0x56')],['id','createdAt',_0x28a8('0x57')]);return db[_0x28a8('0x31')][_0x28a8('0x4d')](_[_0x28a8('0x43')](_0x193cff,_0x16ecc5[_0x28a8('0x56')]),{'include':_0x16ecc5[_0x28a8('0x37')][_0x28a8('0x4c')]?[{'all':!![]}]:undefined})[_0x28a8('0x29')](function(_0x16b82f){var _0x1a8426=_0x16ecc5[_0x28a8('0x4e')][_0x28a8('0x2a')]({'plain':!![]});if(!_0x1a8426)throw new Error(_0x28a8('0x58'));if(_0x1a8426[_0x28a8('0x4f')]===_0x28a8('0x4e')){var _0x406922=_0x16b82f['get']({'plain':!![]});var _0x271bce=_0x28a8('0x50');return db['UserProfileSection'][_0x28a8('0x51')]({'where':{'name':_0x271bce,'userProfileId':_0x1a8426['userProfileId']},'raw':!![]})[_0x28a8('0x29')](function(_0x51815f){if(_0x51815f&&_0x51815f['autoAssociation']===0x0){return db[_0x28a8('0x54')]['create']({'name':_0x406922[_0x28a8('0x2d')],'resourceId':_0x406922['id'],'type':_0x51815f[_0x28a8('0x2d')],'sectionId':_0x51815f['id']},{})[_0x28a8('0x29')](function(){return _0x16b82f;});}else{return _0x16b82f;}})[_0x28a8('0x48')](function(_0x460fbb){logger[_0x28a8('0x2c')](_0x28a8('0x59'),_0x460fbb);throw _0x460fbb;});}return _0x16b82f;});}})[_0x28a8('0x29')](respondWithResult(_0x25816e,0xc9))[_0x28a8('0x48')](handleError(_0x25816e,null));};exports[_0x28a8('0x5a')]=function(_0x128645,_0x5189d1){if(_0x128645[_0x28a8('0x56')]['id']){delete _0x128645[_0x28a8('0x56')]['id'];}return db['Dashboard'][_0x28a8('0x51')]({'where':{'id':_0x128645['params']['id']}})[_0x28a8('0x29')](handleEntityNotFound(_0x5189d1,null))['then'](saveUpdates(_0x128645['body'],null))[_0x28a8('0x29')](respondWithResult(_0x5189d1,null))[_0x28a8('0x48')](handleError(_0x5189d1,null));};exports[_0x28a8('0x28')]=function(_0x36187d,_0x62f4c3){return db[_0x28a8('0x31')][_0x28a8('0x51')]({'where':{'id':_0x36187d[_0x28a8('0x4a')]['id']}})[_0x28a8('0x29')](handleEntityNotFound(_0x62f4c3,null))[_0x28a8('0x29')](removeEntity(_0x62f4c3,null))['catch'](handleError(_0x62f4c3,null));};function widgetAttributes(_0x4e0c44){try{switch(_0x4e0c44[_0x28a8('0x34')]){case _0x28a8('0x5b'):return[{'name':'attrUrl','value':_0x4e0c44[_0x28a8('0x5c')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x0]?_0x4e0c44[_0x28a8('0x5d')][0x0]['value']:undefined)||'https://'}];case _0x28a8('0x5e'):return[{'name':_0x28a8('0x5f'),'value':_0x4e0c44[_0x28a8('0x5f')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x0]?_0x4e0c44[_0x28a8('0x5d')][0x0][_0x28a8('0x60')]:undefined)||''}];case _0x28a8('0x61'):return[{'name':_0x28a8('0x62'),'value':_0x4e0c44['attrHourFormat']||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x0]?_0x4e0c44['attrs'][0x0][_0x28a8('0x60')]:undefined)||'HH:mm:ss'},{'name':_0x28a8('0x63'),'value':_0x4e0c44['attrTimezone']||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x1]?_0x4e0c44['attrs'][0x1][_0x28a8('0x60')]:undefined)||_0x28a8('0x64')},{'name':_0x28a8('0x65'),'value':_0x4e0c44[_0x28a8('0x65')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x2]?_0x4e0c44[_0x28a8('0x5d')][0x2][_0x28a8('0x60')]:undefined)||0xc}];case _0x28a8('0x66'):return[{'name':_0x28a8('0x67'),'value':_0x4e0c44['attrMetric']||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x0]?_0x4e0c44[_0x28a8('0x5d')][0x0][_0x28a8('0x60')]:undefined)||_0x28a8('0x68')},{'name':_0x28a8('0x69'),'value':_0x4e0c44[_0x28a8('0x69')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x1]?_0x4e0c44[_0x28a8('0x5d')][0x1][_0x28a8('0x60')]:undefined)||[]},{'name':_0x28a8('0x65'),'value':_0x4e0c44['attrFontSize']||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44['attrs'][0x2]?_0x4e0c44[_0x28a8('0x5d')][0x2][_0x28a8('0x60')]:undefined)||0x14},{'name':_0x28a8('0x6a'),'value':_0x4e0c44[_0x28a8('0x6a')]||(_0x4e0c44['attrs']&&_0x4e0c44[_0x28a8('0x5d')][0x3]?_0x4e0c44['attrs'][0x3]['value']:undefined)||_0x28a8('0x6b')},{'name':'attrEmailAccounts','value':_0x4e0c44[_0x28a8('0x6c')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44['attrs'][0x4]?_0x4e0c44[_0x28a8('0x5d')][0x4][_0x28a8('0x60')]:undefined)||''},{'name':_0x28a8('0x6d'),'value':_0x4e0c44['attrFaxAccounts']||(_0x4e0c44['attrs']&&_0x4e0c44[_0x28a8('0x5d')][0x5]?_0x4e0c44[_0x28a8('0x5d')][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x4e0c44['attrSmsAccounts']||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x6]?_0x4e0c44[_0x28a8('0x5d')][0x6][_0x28a8('0x60')]:undefined)||''},{'name':_0x28a8('0x6e'),'value':_0x4e0c44[_0x28a8('0x6e')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x7]?_0x4e0c44[_0x28a8('0x5d')][0x7][_0x28a8('0x60')]:undefined)||''},{'name':_0x28a8('0x6f'),'value':_0x4e0c44[_0x28a8('0x6f')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x8]?_0x4e0c44[_0x28a8('0x5d')][0x8][_0x28a8('0x60')]:undefined)||''},{'name':_0x28a8('0x70'),'value':_0x4e0c44['attrChatWebsites']||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x9]?_0x4e0c44[_0x28a8('0x5d')][0x9][_0x28a8('0x60')]:undefined)||''}];case _0x28a8('0x71'):case _0x28a8('0x72'):return[{'name':_0x28a8('0x73'),'value':_0x4e0c44[_0x28a8('0x73')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44['attrs'][0x0]?_0x4e0c44[_0x28a8('0x5d')][0x0]['value']:undefined)||_0x28a8('0x68')},{'name':_0x28a8('0x74'),'value':_0x4e0c44[_0x28a8('0x74')]||(_0x4e0c44['attrs']&&_0x4e0c44[_0x28a8('0x5d')][0x1]?_0x4e0c44[_0x28a8('0x5d')][0x1][_0x28a8('0x60')]:undefined)||null},{'name':_0x28a8('0x75'),'value':_0x4e0c44[_0x28a8('0x75')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44['attrs'][0x2]?_0x4e0c44['attrs'][0x2]['value']:undefined)||null},{'name':_0x28a8('0x69'),'value':_0x4e0c44[_0x28a8('0x69')]||(_0x4e0c44['attrs']&&_0x4e0c44[_0x28a8('0x5d')][0x3]?_0x4e0c44[_0x28a8('0x5d')][0x3]['value']:undefined)||[]},{'name':_0x28a8('0x6a'),'value':_0x4e0c44['attrChannel']||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x4]?_0x4e0c44[_0x28a8('0x5d')][0x4][_0x28a8('0x60')]:undefined)||_0x28a8('0x6b')},{'name':_0x28a8('0x6c'),'value':_0x4e0c44['attrEmailAccounts']||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44['attrs'][0x5]?_0x4e0c44[_0x28a8('0x5d')][0x5][_0x28a8('0x60')]:undefined)||''},{'name':_0x28a8('0x6d'),'value':_0x4e0c44[_0x28a8('0x6d')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x6]?_0x4e0c44[_0x28a8('0x5d')][0x6][_0x28a8('0x60')]:undefined)||''},{'name':_0x28a8('0x76'),'value':_0x4e0c44['attrSmsAccounts']||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x7]?_0x4e0c44[_0x28a8('0x5d')][0x7][_0x28a8('0x60')]:undefined)||''},{'name':_0x28a8('0x6e'),'value':_0x4e0c44[_0x28a8('0x6e')]||(_0x4e0c44['attrs']&&_0x4e0c44[_0x28a8('0x5d')][0x8]?_0x4e0c44[_0x28a8('0x5d')][0x8][_0x28a8('0x60')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x4e0c44[_0x28a8('0x6f')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x9]?_0x4e0c44['attrs'][0x9][_0x28a8('0x60')]:undefined)||''},{'name':_0x28a8('0x70'),'value':_0x4e0c44[_0x28a8('0x70')]||(_0x4e0c44['attrs']&&_0x4e0c44[_0x28a8('0x5d')][0xa]?_0x4e0c44[_0x28a8('0x5d')][0xa][_0x28a8('0x60')]:undefined)||''}];case _0x28a8('0x77'):return[{'name':'attrReport','type':_0x4e0c44[_0x28a8('0x78')]||(_0x4e0c44['attrs']&&_0x4e0c44['attrs'][0x0]?_0x4e0c44[_0x28a8('0x5d')][0x0]['type']:undefined)||null,'value':_0x4e0c44[_0x28a8('0x79')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44[_0x28a8('0x5d')][0x0]?_0x4e0c44[_0x28a8('0x5d')][0x0][_0x28a8('0x60')]:undefined)||null},{'name':_0x28a8('0x7a'),'value':_0x4e0c44[_0x28a8('0x7a')]||(_0x4e0c44[_0x28a8('0x5d')]&&_0x4e0c44['attrs'][0x1]?_0x4e0c44['attrs'][0x1][_0x28a8('0x60')]:undefined)||0x0}];default:return[];}}catch(_0xd5182e){logger['error']('widgetAttributes:\x20%s',JSON[_0x28a8('0x7b')](_0xd5182e));return[];}}exports[_0x28a8('0x7c')]=function(_0x28fd19,_0x4f171a,_0x3f3146){if(_0x28fd19[_0x28a8('0x56')]['id']){delete _0x28fd19[_0x28a8('0x56')]['id'];}return db['Dashboard'][_0x28a8('0x51')]({'where':{'id':_0x28fd19[_0x28a8('0x4a')]['id']}})[_0x28a8('0x29')](handleEntityNotFound(_0x4f171a,null))[_0x28a8('0x29')](function(_0x357580){if(_0x357580){_0x28fd19[_0x28a8('0x56')]['DashboardId']=_0x357580['id'];_0x28fd19['body'][_0x28a8('0x5d')]=widgetAttributes(_0x28fd19[_0x28a8('0x56')]);return db[_0x28a8('0x7d')][_0x28a8('0x4d')](_0x28fd19['body']);}})[_0x28a8('0x29')](respondWithResult(_0x4f171a,null))[_0x28a8('0x48')](handleError(_0x4f171a,null));};exports[_0x28a8('0x7e')]=function(_0x17f8a9,_0x48e264,_0x3fb0fe){var _0x368385={};var _0x3de8a8={};var _0x88c8d4;var _0x99b56d;return db['Dashboard'][_0x28a8('0x7f')]({'where':{'id':_0x17f8a9[_0x28a8('0x4a')]['id']}})[_0x28a8('0x29')](handleEntityNotFound(_0x48e264,null))[_0x28a8('0x29')](function(_0x2c9ea1){if(_0x2c9ea1){_0x88c8d4=_0x2c9ea1;_0x3de8a8[_0x28a8('0x3c')]=_[_0x28a8('0x36')](db[_0x28a8('0x7d')][_0x28a8('0x32')]);_0x3de8a8[_0x28a8('0x37')]=_[_0x28a8('0x36')](_0x17f8a9['query']);_0x3de8a8[_0x28a8('0x4b')]=_[_0x28a8('0x38')](_0x3de8a8[_0x28a8('0x3c')],_0x3de8a8[_0x28a8('0x37')]);_0x368385[_0x28a8('0x39')]=_[_0x28a8('0x38')](_0x3de8a8[_0x28a8('0x3c')],qs['fields'](_0x17f8a9['query'][_0x28a8('0x3a')]));_0x368385[_0x28a8('0x39')]=_0x368385[_0x28a8('0x39')]['length']?_0x368385[_0x28a8('0x39')]:_0x3de8a8[_0x28a8('0x3c')];_0x368385['order']=qs[_0x28a8('0x40')](_0x17f8a9[_0x28a8('0x37')]['sort']);_0x368385[_0x28a8('0x41')]=qs['filters'](_[_0x28a8('0x80')](_0x17f8a9[_0x28a8('0x37')],_0x3de8a8[_0x28a8('0x4b')]));if(_0x17f8a9[_0x28a8('0x37')]['filter']){_0x368385[_0x28a8('0x41')]=_['merge'](_0x368385[_0x28a8('0x41')],{'$or':_[_0x28a8('0x30')](_0x368385['attributes'],function(_0xe45a87){var _0xa15e11={};_0xa15e11[_0xe45a87]={'$like':'%'+_0x17f8a9[_0x28a8('0x37')]['filter']+'%'};return _0xa15e11;})});}_0x368385=_[_0x28a8('0x43')]({},_0x368385,_0x17f8a9[_0x28a8('0x45')]);return _0x88c8d4[_0x28a8('0x7e')](_0x368385);}})[_0x28a8('0x29')](function(_0x46b263){if(_0x46b263){_0x99b56d=_0x46b263['length'];if(!_0x17f8a9['query'][_0x28a8('0x3d')](_0x28a8('0x3e'))){_0x368385[_0x28a8('0x23')]=qs[_0x28a8('0x23')](_0x17f8a9[_0x28a8('0x37')]['limit']);_0x368385[_0x28a8('0x20')]=qs['offset'](_0x17f8a9[_0x28a8('0x37')][_0x28a8('0x20')]);}return _0x88c8d4[_0x28a8('0x7e')](_0x368385);}})[_0x28a8('0x29')](function(_0x2901bb){if(_0x2901bb){return _0x2901bb?{'count':_0x99b56d,'rows':_0x2901bb}:null;}})['then'](respondWithResult(_0x48e264,null))[_0x28a8('0x48')](handleError(_0x48e264,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index a7d95e1..c9a9546 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 _0x0b16=['Dashboard','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events'];(function(_0x3f9562,_0x330b47){var _0x3c3d9e=function(_0x49cba8){while(--_0x49cba8){_0x3f9562['push'](_0x3f9562['shift']());}};_0x3c3d9e(++_0x330b47);}(_0x0b16,0x8f));var _0x60b1=function(_0x59fbe4,_0x3904b4){_0x59fbe4=_0x59fbe4-0x0;var _0x31a4aa=_0x0b16[_0x59fbe4];return _0x31a4aa;};'use strict';var EventEmitter=require(_0x60b1('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x60b1('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x60b1('0x2')](0x0);var events={'afterCreate':_0x60b1('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x9e4f96){return function(_0x3be577,_0x3117f9,_0x1d4e21){DashboardEvents[_0x60b1('0x4')](_0x9e4f96+':'+_0x3be577['id'],_0x3be577);DashboardEvents['emit'](_0x9e4f96,_0x3be577);_0x1d4e21(null);};}for(var e in events){if(events[_0x60b1('0x5')](e)){var event=events[e];Dashboard[_0x60b1('0x6')](e,emitEvent(event));}}module[_0x60b1('0x7')]=DashboardEvents; \ No newline at end of file +var _0xeb33=['hasOwnProperty','hook','events','../../mysqldb','Dashboard','save','emit'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0xeb33,0xf0));var _0x3eb3=function(_0x251999,_0x101e56){_0x251999=_0x251999-0x0;var _0x14b385=_0xeb33[_0x251999];return _0x14b385;};'use strict';var EventEmitter=require(_0x3eb3('0x0'));var Dashboard=require(_0x3eb3('0x1'))['db'][_0x3eb3('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3eb3('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4aaab9){return function(_0x308b10,_0x176657,_0x39f1f8){DashboardEvents[_0x3eb3('0x4')](_0x4aaab9+':'+_0x308b10['id'],_0x308b10);DashboardEvents['emit'](_0x4aaab9,_0x308b10);_0x39f1f8(null);};}for(var e in events){if(events[_0x3eb3('0x5')](e)){var event=events[e];Dashboard[_0x3eb3('0x6')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index e6edff3..c72ef2a 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 _0x3f19=['../../config/environment','./dashboard.attributes','exports','define','Dashboard','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x5534e3,_0x5e40c4){var _0xd605df=function(_0x113330){while(--_0x113330){_0x5534e3['push'](_0x5534e3['shift']());}};_0xd605df(++_0x5e40c4);}(_0x3f19,0x155));var _0x93f1=function(_0x1b338e,_0x25ac31){_0x1b338e=_0x1b338e-0x0;var _0x3ae2f4=_0x3f19[_0x1b338e];return _0x3ae2f4;};'use strict';var _=require(_0x93f1('0x0'));var util=require(_0x93f1('0x1'));var logger=require('../../config/logger')(_0x93f1('0x2'));var moment=require('moment');var BPromise=require(_0x93f1('0x3'));var rp=require(_0x93f1('0x4'));var fs=require('fs');var path=require(_0x93f1('0x5'));var rimraf=require(_0x93f1('0x6'));var config=require(_0x93f1('0x7'));var attributes=require(_0x93f1('0x8'));module[_0x93f1('0x9')]=function(_0xddbe,_0x297965){return _0xddbe[_0x93f1('0xa')](_0x93f1('0xb'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf313=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','define','Dashboard','lodash'];(function(_0x51c5d3,_0x20137e){var _0x1d5909=function(_0x56a5ef){while(--_0x56a5ef){_0x51c5d3['push'](_0x51c5d3['shift']());}};_0x1d5909(++_0x20137e);}(_0xf313,0x12b));var _0x3f31=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xf313[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x3f31('0x0'));var util=require('util');var logger=require(_0x3f31('0x1'))(_0x3f31('0x2'));var moment=require('moment');var BPromise=require(_0x3f31('0x3'));var rp=require(_0x3f31('0x4'));var fs=require('fs');var path=require(_0x3f31('0x5'));var rimraf=require('rimraf');var config=require(_0x3f31('0x6'));var attributes=require('./dashboard.attributes');module[_0x3f31('0x7')]=function(_0x552f9e,_0x3c9c9f){return _0x552f9e[_0x3f31('0x8')](_0x3f31('0x9'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 783c997..f684b43 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 _0x2802=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x2802,0x8e));var _0x2280=function(_0x1443eb,_0x203408){_0x1443eb=_0x1443eb-0x0;var _0x2b8810=_0x2802[_0x1443eb];return _0x2b8810;};'use strict';var _=require(_0x2280('0x0'));var util=require(_0x2280('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2280('0x2'));var fs=require('fs');var Redis=require(_0x2280('0x3'));var db=require(_0x2280('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2280('0x5'))(_0x2280('0x6'));var config=require(_0x2280('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2280('0x8')]({'port':0x232a});config[_0x2280('0x9')]=_[_0x2280('0xa')](config['redis'],{'host':_0x2280('0xb'),'port':0x18eb});var socket=require(_0x2280('0xc'))(new Redis(config[_0x2280('0x9')]));require('./dashboard.socket')[_0x2280('0xd')](socket);function respondWithRpcPromise(_0x29a0a0,_0x4e8576,_0x5490d7){return new BPromise(function(_0x1e27b6,_0x255ab0){return client[_0x2280('0xe')](_0x29a0a0,_0x5490d7)[_0x2280('0xf')](function(_0x9e2154){logger['info'](_0x2280('0x10'),_0x4e8576,_0x2280('0x11'));logger['debug'](_0x2280('0x12'),_0x4e8576,'request\x20sent',JSON[_0x2280('0x13')](_0x9e2154));if(_0x9e2154[_0x2280('0x14')]){if(_0x9e2154[_0x2280('0x14')][_0x2280('0x15')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x4e8576,_0x9e2154[_0x2280('0x14')][_0x2280('0x16')]);return _0x255ab0(_0x9e2154[_0x2280('0x14')]['message']);}logger['error']('Dashboard,\x20%s,\x20%s',_0x4e8576,_0x9e2154[_0x2280('0x14')]['message']);return _0x1e27b6(_0x9e2154[_0x2280('0x14')][_0x2280('0x16')]);}else{logger['info'](_0x2280('0x10'),_0x4e8576,_0x2280('0x11'));_0x1e27b6(_0x9e2154[_0x2280('0x17')]['message']);}})['catch'](function(_0x1b1423){logger['error'](_0x2280('0x10'),_0x4e8576,_0x1b1423);_0x255ab0(_0x1b1423);});});} \ No newline at end of file +var _0x2e99=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x24341c,_0x137c37){var _0x3409f6=function(_0x390115){while(--_0x390115){_0x24341c['push'](_0x24341c['shift']());}};_0x3409f6(++_0x137c37);}(_0x2e99,0xf4));var _0x92e9=function(_0x2cfaaf,_0x880529){_0x2cfaaf=_0x2cfaaf-0x0;var _0x444943=_0x2e99[_0x2cfaaf];return _0x444943;};'use strict';var _=require(_0x92e9('0x0'));var util=require(_0x92e9('0x1'));var moment=require(_0x92e9('0x2'));var BPromise=require(_0x92e9('0x3'));var rs=require(_0x92e9('0x4'));var fs=require('fs');var Redis=require(_0x92e9('0x5'));var db=require(_0x92e9('0x6'))['db'];var utils=require(_0x92e9('0x7'));var logger=require(_0x92e9('0x8'))('rpc');var config=require(_0x92e9('0x9'));var jayson=require(_0x92e9('0xa'));var client=jayson[_0x92e9('0xb')][_0x92e9('0xc')]({'port':0x232a});config[_0x92e9('0xd')]=_['defaults'](config['redis'],{'host':_0x92e9('0xe'),'port':0x18eb});var socket=require(_0x92e9('0xf'))(new Redis(config[_0x92e9('0xd')]));require(_0x92e9('0x10'))['register'](socket);function respondWithRpcPromise(_0x24bdec,_0x17eb6c,_0xa05a04){return new BPromise(function(_0x161de1,_0x117bdf){return client['request'](_0x24bdec,_0xa05a04)[_0x92e9('0x11')](function(_0x4c097d){logger[_0x92e9('0x12')](_0x92e9('0x13'),_0x17eb6c,_0x92e9('0x14'));logger[_0x92e9('0x15')](_0x92e9('0x16'),_0x17eb6c,_0x92e9('0x14'),JSON[_0x92e9('0x17')](_0x4c097d));if(_0x4c097d[_0x92e9('0x18')]){if(_0x4c097d['error']['code']===0x1f4){logger[_0x92e9('0x18')](_0x92e9('0x13'),_0x17eb6c,_0x4c097d[_0x92e9('0x18')][_0x92e9('0x19')]);return _0x117bdf(_0x4c097d[_0x92e9('0x18')][_0x92e9('0x19')]);}logger[_0x92e9('0x18')](_0x92e9('0x13'),_0x17eb6c,_0x4c097d[_0x92e9('0x18')]['message']);return _0x161de1(_0x4c097d['error'][_0x92e9('0x19')]);}else{logger[_0x92e9('0x12')](_0x92e9('0x13'),_0x17eb6c,'request\x20sent');_0x161de1(_0x4c097d[_0x92e9('0x1a')][_0x92e9('0x19')]);}})[_0x92e9('0x1b')](function(_0xf97f6){logger['error'](_0x92e9('0x13'),_0x17eb6c,_0xf97f6);_0x117bdf(_0xf97f6);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index f82c34e..21a46dc 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 _0x55ab=['remove','update','register','length'];(function(_0x31e8e6,_0x34b340){var _0x5ceac8=function(_0x367056){while(--_0x367056){_0x31e8e6['push'](_0x31e8e6['shift']());}};_0x5ceac8(++_0x34b340);}(_0x55ab,0x1cc));var _0xb55a=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x55ab[_0x5b561d];return _0x431060;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0xb55a('0x0'),_0xb55a('0x1')];function createListener(_0x4c23e7,_0x1d4dfb){return function(_0x57f140){_0x1d4dfb['emit'](_0x4c23e7,_0x57f140);};}function removeListener(_0x41e2aa,_0x4edd19){return function(){DashboardEvents['removeListener'](_0x41e2aa,_0x4edd19);};}exports[_0xb55a('0x2')]=function(_0xadab9){for(var _0x2470fa=0x0,_0x36caf5=events[_0xb55a('0x3')];_0x2470fa<_0x36caf5;_0x2470fa++){var _0x323f06=events[_0x2470fa];var _0x1d50b3=createListener('dashboard:'+_0x323f06,_0xadab9);DashboardEvents['on'](_0x323f06,_0x1d50b3);}}; \ No newline at end of file +var _0x866e=['length','./dashboard.events','remove','removeListener'];(function(_0x140ef7,_0x38c3fa){var _0x446793=function(_0xe52a50){while(--_0xe52a50){_0x140ef7['push'](_0x140ef7['shift']());}};_0x446793(++_0x38c3fa);}(_0x866e,0xad));var _0xe866=function(_0x52d298,_0x5c056e){_0x52d298=_0x52d298-0x0;var _0x12323a=_0x866e[_0x52d298];return _0x12323a;};'use strict';var DashboardEvents=require(_0xe866('0x0'));var events=['save',_0xe866('0x1'),'update'];function createListener(_0x2439af,_0x61d5f8){return function(_0x523810){_0x61d5f8['emit'](_0x2439af,_0x523810);};}function removeListener(_0x2cb964,_0x5b931a){return function(){DashboardEvents[_0xe866('0x2')](_0x2cb964,_0x5b931a);};}exports['register']=function(_0x5263e2){for(var _0x2960c7=0x0,_0x4369f2=events[_0xe866('0x3')];_0x2960c7<_0x4369f2;_0x2960c7++){var _0x2a65bd=events[_0x2960c7];var _0xbcfa6d=createListener('dashboard:'+_0x2a65bd,_0x5263e2);DashboardEvents['on'](_0x2a65bd,_0xbcfa6d);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 5a92bd3..45767b0 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 _0x75d6=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','post','create','addItem','update','delete'];(function(_0x1ff8a7,_0x3196bc){var _0x4976fc=function(_0x409ebb){while(--_0x409ebb){_0x1ff8a7['push'](_0x1ff8a7['shift']());}};_0x4976fc(++_0x3196bc);}(_0x75d6,0xdd));var _0x675d=function(_0x50cfc3,_0x526cc6){_0x50cfc3=_0x50cfc3-0x0;var _0x5c11ef=_0x75d6[_0x50cfc3];return _0x5c11ef;};'use strict';var multer=require(_0x675d('0x0'));var util=require(_0x675d('0x1'));var path=require(_0x675d('0x2'));var timeout=require(_0x675d('0x3'));var express=require(_0x675d('0x4'));var router=express[_0x675d('0x5')]();var fs_extra=require(_0x675d('0x6'));var auth=require(_0x675d('0x7'));var interaction=require(_0x675d('0x8'));var config=require('../../config/environment');var controller=require(_0x675d('0x9'));router[_0x675d('0xa')]('/',auth[_0x675d('0xb')](),controller[_0x675d('0xc')]);router[_0x675d('0xa')](_0x675d('0xd'),auth[_0x675d('0xb')](),controller[_0x675d('0xe')]);router[_0x675d('0xa')](_0x675d('0xf'),auth[_0x675d('0xb')](),controller['getItems']);router[_0x675d('0x10')]('/',auth[_0x675d('0xb')](),controller[_0x675d('0x11')]);router[_0x675d('0x10')]('/:id/clone',auth[_0x675d('0xb')](),controller['clone']);router[_0x675d('0x10')](_0x675d('0xf'),auth[_0x675d('0xb')](),controller[_0x675d('0x12')]);router['put'](_0x675d('0xd'),auth[_0x675d('0xb')](),controller[_0x675d('0x13')]);router[_0x675d('0x14')](_0x675d('0xd'),auth[_0x675d('0xb')](),controller[_0x675d('0x15')]);module['exports']=router; \ No newline at end of file +var _0xb874=['clone','addItem','put','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/items','getItems','post','/:id/clone'];(function(_0x22cb0e,_0x190ba9){var _0x10b1ed=function(_0x3844dc){while(--_0x3844dc){_0x22cb0e['push'](_0x22cb0e['shift']());}};_0x10b1ed(++_0x190ba9);}(_0xb874,0x12f));var _0x4b87=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb874[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x4b87('0x0'));var util=require(_0x4b87('0x1'));var path=require(_0x4b87('0x2'));var timeout=require(_0x4b87('0x3'));var express=require(_0x4b87('0x4'));var router=express[_0x4b87('0x5')]();var fs_extra=require(_0x4b87('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4b87('0x7'));var config=require(_0x4b87('0x8'));var controller=require('./dashboard.controller');router[_0x4b87('0x9')]('/',auth[_0x4b87('0xa')](),controller['index']);router['get'](_0x4b87('0xb'),auth[_0x4b87('0xa')](),controller[_0x4b87('0xc')]);router['get'](_0x4b87('0xd'),auth['isAuthenticated'](),controller[_0x4b87('0xe')]);router[_0x4b87('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4b87('0xf')](_0x4b87('0x10'),auth['isAuthenticated'](),controller[_0x4b87('0x11')]);router[_0x4b87('0xf')]('/:id/items',auth[_0x4b87('0xa')](),controller[_0x4b87('0x12')]);router[_0x4b87('0x13')]('/:id',auth[_0x4b87('0xa')](),controller['update']);router['delete'](_0x4b87('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index dad2322..4e191d9 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 _0x0295=['#ffffff','sequelize','exports','TEXT','long','parse','getDataValue','attrs','setDataValue','INTEGER','STRING'];(function(_0x1c3386,_0x2868c0){var _0x2cc8e9=function(_0x556aa2){while(--_0x556aa2){_0x1c3386['push'](_0x1c3386['shift']());}};_0x2cc8e9(++_0x2868c0);}(_0x0295,0x1f0));var _0x5029=function(_0x29ef06,_0x3e54b7){_0x29ef06=_0x29ef06-0x0;var _0x57bd49=_0x0295[_0x29ef06];return _0x57bd49;};'use strict';var Sequelize=require(_0x5029('0x0'));var squel=require('squel');var _=require('lodash');module[_0x5029('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5029('0x2')](_0x5029('0x3')),'get':function(){try{return JSON[_0x5029('0x4')](this[_0x5029('0x5')](_0x5029('0x6')));}catch(_0x69a497){return[];}},'set':function(_0x200217){try{this[_0x5029('0x7')](_0x5029('0x6'),JSON['stringify'](_0x200217));}catch(_0x54978f){this['setDataValue'](_0x5029('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x5029('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5029('0x8')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x5029('0x9')],'allowNull':![],'defaultValue':_0x5029('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5029('0x9')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5029('0x9')]},'titleFontSize':{'type':Sequelize[_0x5029('0x8')],'defaultValue':0xc}}; \ No newline at end of file +var _0xe3da=['squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize'];(function(_0x4a8617,_0x5d3dc5){var _0x44b7dd=function(_0x44d3d9){while(--_0x44d3d9){_0x4a8617['push'](_0x4a8617['shift']());}};_0x44b7dd(++_0x5d3dc5);}(_0xe3da,0x1cd));var _0xae3d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe3da[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xae3d('0x0'));var squel=require(_0xae3d('0x1'));var _=require(_0xae3d('0x2'));module[_0xae3d('0x3')]={'title':{'type':Sequelize[_0xae3d('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xae3d('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xae3d('0x5')](_0xae3d('0x6')),'get':function(){try{return JSON[_0xae3d('0x7')](this[_0xae3d('0x8')](_0xae3d('0x9')));}catch(_0x26282d){return[];}},'set':function(_0xa9a1a){try{this[_0xae3d('0xa')](_0xae3d('0x9'),JSON[_0xae3d('0xb')](_0xa9a1a));}catch(_0x583b98){this[_0xae3d('0xa')](_0xae3d('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xae3d('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xae3d('0xc')]},'col':{'type':Sequelize[_0xae3d('0xc')]},'background':{'type':Sequelize[_0xae3d('0x4')],'allowNull':![],'defaultValue':_0xae3d('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xae3d('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xae3d('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 2e8b051..390014a 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 _0x31af=['attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','web-report','reportType','attrReport','attrRefresh','stringify','create','body','update','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','apply','reject','save','then','error','stack','send','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options','find','destroy','catch','type','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss'];(function(_0x111347,_0x4c88a4){var _0x4f8902=function(_0x5bd3f5){while(--_0x5bd3f5){_0x111347['push'](_0x111347['shift']());}};_0x4f8902(++_0x4c88a4);}(_0x31af,0xde));var _0xf31a=function(_0x2f713b,_0x4d1316){_0x2f713b=_0x2f713b-0x0;var _0x8428f8=_0x31af[_0x2f713b];return _0x8428f8;};'use strict';var emlformat=require(_0xf31a('0x0'));var rimraf=require(_0xf31a('0x1'));var zipdir=require(_0xf31a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf31a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf31a('0x4'));var util=require(_0xf31a('0x5'));var path=require(_0xf31a('0x6'));var sox=require(_0xf31a('0x7'));var csv=require('to-csv');var ejs=require(_0xf31a('0x8'));var fs=require('fs');var fs_extra=require(_0xf31a('0x9'));var _=require(_0xf31a('0xa'));var squel=require(_0xf31a('0xb'));var crypto=require('crypto');var jsforce=require(_0xf31a('0xc'));var deskjs=require(_0xf31a('0xd'));var toCsv=require(_0xf31a('0xe'));var querystring=require(_0xf31a('0xf'));var Papa=require('papaparse');var Redis=require(_0xf31a('0x10'));var authService=require(_0xf31a('0x11'));var qs=require(_0xf31a('0x12'));var as=require(_0xf31a('0x13'));var hardwareService=require(_0xf31a('0x14'));var logger=require('../../config/logger')(_0xf31a('0x15'));var utils=require(_0xf31a('0x16'));var config=require(_0xf31a('0x17'));var licenseUtil=require(_0xf31a('0x18'));var db=require('../../mysqldb')['db'];config[_0xf31a('0x19')]=_[_0xf31a('0x1a')](config['redis'],{'host':_0xf31a('0x1b'),'port':0x18eb});var socket=require(_0xf31a('0x1c'))(new Redis(config[_0xf31a('0x19')]));require(_0xf31a('0x1d'))[_0xf31a('0x1e')](socket);function respondWithStatusCode(_0x203031,_0x1d2d07){_0x1d2d07=_0x1d2d07||0xcc;return function(_0x4681e3){if(_0x4681e3){return _0x203031[_0xf31a('0x1f')](_0x1d2d07);}return _0x203031[_0xf31a('0x20')](_0x1d2d07)[_0xf31a('0x21')]();};}function respondWithResult(_0x1da226,_0x3439ba){_0x3439ba=_0x3439ba||0xc8;return function(_0xccfd8b){if(_0xccfd8b){return _0x1da226[_0xf31a('0x20')](_0x3439ba)['json'](_0xccfd8b);}};}function respondWithFilteredResult(_0x454836,_0x27e161){return function(_0x251ca7){if(_0x251ca7){var _0x3bff26=typeof _0x27e161['offset']===_0xf31a('0x22')&&typeof _0x27e161[_0xf31a('0x23')]===_0xf31a('0x22');var _0x208da3=_0x251ca7[_0xf31a('0x24')];var _0x516672=_0x3bff26?0x0:_0x27e161[_0xf31a('0x25')];var _0xd3ac94=_0x3bff26?_0x251ca7['count']:_0x27e161[_0xf31a('0x25')]+_0x27e161[_0xf31a('0x23')];var _0x55da11;if(_0xd3ac94>=_0x208da3){_0xd3ac94=_0x208da3;_0x55da11=0xc8;}else{_0x55da11=0xce;}_0x454836[_0xf31a('0x20')](_0x55da11);return _0x454836[_0xf31a('0x26')]('Content-Range',_0x516672+'-'+_0xd3ac94+'/'+_0x208da3)['json'](_0x251ca7);}return null;};}function patchUpdates(_0x534317){return function(_0x15db83){try{jsonpatch[_0xf31a('0x27')](_0x15db83,_0x534317,!![]);}catch(_0x5c23db){return BPromise[_0xf31a('0x28')](_0x5c23db);}return _0x15db83[_0xf31a('0x29')]();};}function saveUpdates(_0x5d08ee,_0x177fb6){return function(_0x4c46d9){if(_0x4c46d9){return _0x4c46d9['update'](_0x5d08ee)[_0xf31a('0x2a')](function(_0x714292){return _0x714292;});}return null;};}function removeEntity(_0x54ad77,_0x4e115c){return function(_0x59114a){if(_0x59114a){return _0x59114a['destroy']()[_0xf31a('0x2a')](function(){_0x54ad77[_0xf31a('0x20')](0xcc)[_0xf31a('0x21')]();});}};}function handleEntityNotFound(_0x595db6,_0x2281c5){return function(_0x2ace06){if(!_0x2ace06){_0x595db6[_0xf31a('0x1f')](0x194);}return _0x2ace06;};}function handleError(_0x2aa749,_0x347a20){_0x347a20=_0x347a20||0x1f4;return function(_0x5a55c6){logger[_0xf31a('0x2b')](_0x5a55c6[_0xf31a('0x2c')]);if(_0x5a55c6['name']){delete _0x5a55c6['name'];}_0x2aa749[_0xf31a('0x20')](_0x347a20)[_0xf31a('0x2d')](_0x5a55c6);};}exports['show']=function(_0x1bcfe6,_0x221048){var _0x2f739c={'raw':![],'where':{'id':_0x1bcfe6[_0xf31a('0x2e')]['id']}},_0x5385ba={};_0x5385ba[_0xf31a('0x2f')]=_[_0xf31a('0x30')](db[_0xf31a('0x31')][_0xf31a('0x32')]);_0x5385ba[_0xf31a('0x33')]=_['keys'](_0x1bcfe6[_0xf31a('0x33')]);_0x5385ba[_0xf31a('0x34')]=_[_0xf31a('0x35')](_0x5385ba[_0xf31a('0x2f')],_0x5385ba[_0xf31a('0x33')]);_0x2f739c[_0xf31a('0x36')]=_[_0xf31a('0x35')](_0x5385ba[_0xf31a('0x2f')],qs[_0xf31a('0x37')](_0x1bcfe6[_0xf31a('0x33')][_0xf31a('0x37')]));_0x2f739c[_0xf31a('0x36')]=_0x2f739c[_0xf31a('0x36')][_0xf31a('0x38')]?_0x2f739c[_0xf31a('0x36')]:_0x5385ba[_0xf31a('0x2f')];if(_0x1bcfe6[_0xf31a('0x33')][_0xf31a('0x39')]){_0x2f739c[_0xf31a('0x3a')]=[{'all':!![]}];}_0x2f739c=_['merge']({},_0x2f739c,_0x1bcfe6[_0xf31a('0x3b')]);return db[_0xf31a('0x31')][_0xf31a('0x3c')](_0x2f739c)[_0xf31a('0x2a')](handleEntityNotFound(_0x221048,null))[_0xf31a('0x2a')](respondWithResult(_0x221048,null))['catch'](handleError(_0x221048,null));};exports[_0xf31a('0x3d')]=function(_0x619352,_0xe8e0e0){return db['DashboardItem'][_0xf31a('0x3c')]({'where':{'id':_0x619352[_0xf31a('0x2e')]['id']}})[_0xf31a('0x2a')](handleEntityNotFound(_0xe8e0e0,null))[_0xf31a('0x2a')](removeEntity(_0xe8e0e0,null))[_0xf31a('0x3e')](handleError(_0xe8e0e0,null));};function widgetAttributes(_0x59ef5b){try{switch(_0x59ef5b[_0xf31a('0x3f')]){case'iframe':return[{'name':_0xf31a('0x40'),'value':_0x59ef5b[_0xf31a('0x40')]||(_0x59ef5b['attrs']&&_0x59ef5b[_0xf31a('0x41')][0x0]?_0x59ef5b[_0xf31a('0x41')][0x0][_0xf31a('0x42')]:undefined)||'https://'}];case _0xf31a('0x43'):return[{'name':_0xf31a('0x44'),'value':_0x59ef5b[_0xf31a('0x44')]||(_0x59ef5b[_0xf31a('0x41')]&&_0x59ef5b[_0xf31a('0x41')][0x0]?_0x59ef5b[_0xf31a('0x41')][0x0][_0xf31a('0x42')]:undefined)||''}];case _0xf31a('0x45'):return[{'name':_0xf31a('0x46'),'value':_0x59ef5b['attrHourFormat']||(_0x59ef5b[_0xf31a('0x41')]&&_0x59ef5b[_0xf31a('0x41')][0x0]?_0x59ef5b['attrs'][0x0][_0xf31a('0x42')]:undefined)||_0xf31a('0x47')},{'name':_0xf31a('0x48'),'value':_0x59ef5b[_0xf31a('0x48')]||(_0x59ef5b['attrs']&&_0x59ef5b[_0xf31a('0x41')][0x1]?_0x59ef5b[_0xf31a('0x41')][0x1][_0xf31a('0x42')]:undefined)||_0xf31a('0x49')},{'name':'attrFontSize','value':_0x59ef5b[_0xf31a('0x4a')]||(_0x59ef5b['attrs']&&_0x59ef5b[_0xf31a('0x41')][0x2]?_0x59ef5b[_0xf31a('0x41')][0x2][_0xf31a('0x42')]:undefined)||0xc}];case'counter':return[{'name':_0xf31a('0x4b'),'value':_0x59ef5b['attrMetric']||(_0x59ef5b[_0xf31a('0x41')]&&_0x59ef5b[_0xf31a('0x41')][0x0]?_0x59ef5b[_0xf31a('0x41')][0x0][_0xf31a('0x42')]:undefined)||_0xf31a('0x4c')},{'name':_0xf31a('0x4d'),'value':_0x59ef5b[_0xf31a('0x4d')]||(_0x59ef5b[_0xf31a('0x41')]&&_0x59ef5b[_0xf31a('0x41')][0x1]?_0x59ef5b['attrs'][0x1][_0xf31a('0x42')]:undefined)||[]},{'name':_0xf31a('0x4a'),'value':_0x59ef5b[_0xf31a('0x4a')]||(_0x59ef5b[_0xf31a('0x41')]&&_0x59ef5b[_0xf31a('0x41')][0x2]?_0x59ef5b[_0xf31a('0x41')][0x2][_0xf31a('0x42')]:undefined)||0x14},{'name':'attrChannel','value':_0x59ef5b['attrChannel']||(_0x59ef5b[_0xf31a('0x41')]&&_0x59ef5b[_0xf31a('0x41')][0x3]?_0x59ef5b[_0xf31a('0x41')][0x3][_0xf31a('0x42')]:undefined)||_0xf31a('0x4e')},{'name':_0xf31a('0x4f'),'value':_0x59ef5b['attrEmailAccounts']||(_0x59ef5b[_0xf31a('0x41')]&&_0x59ef5b[_0xf31a('0x41')][0x4]?_0x59ef5b[_0xf31a('0x41')][0x4][_0xf31a('0x42')]:undefined)||''},{'name':_0xf31a('0x50'),'value':_0x59ef5b[_0xf31a('0x50')]||(_0x59ef5b['attrs']&&_0x59ef5b[_0xf31a('0x41')][0x5]?_0x59ef5b[_0xf31a('0x41')][0x5][_0xf31a('0x42')]:undefined)||''},{'name':_0xf31a('0x51'),'value':_0x59ef5b[_0xf31a('0x51')]||(_0x59ef5b[_0xf31a('0x41')]&&_0x59ef5b[_0xf31a('0x41')][0x6]?_0x59ef5b[_0xf31a('0x41')][0x6][_0xf31a('0x42')]:undefined)||''},{'name':_0xf31a('0x52'),'value':_0x59ef5b['attrOpenchannelAccounts']||(_0x59ef5b[_0xf31a('0x41')]&&_0x59ef5b['attrs'][0x7]?_0x59ef5b[_0xf31a('0x41')][0x7][_0xf31a('0x42')]:undefined)||''},{'name':_0xf31a('0x53'),'value':_0x59ef5b[_0xf31a('0x53')]||(_0x59ef5b[_0xf31a('0x41')]&&_0x59ef5b[_0xf31a('0x41')][0x8]?_0x59ef5b[_0xf31a('0x41')][0x8][_0xf31a('0x42')]:undefined)||''},{'name':'attrChatWebsites','value':_0x59ef5b[_0xf31a('0x54')]||(_0x59ef5b[_0xf31a('0x41')]&&_0x59ef5b[_0xf31a('0x41')][0x9]?_0x59ef5b[_0xf31a('0x41')][0x9][_0xf31a('0x42')]:undefined)||''}];case _0xf31a('0x55'):case'pie-chart':return[{'name':_0xf31a('0x56'),'value':_0x59ef5b[_0xf31a('0x56')]||(_0x59ef5b[_0xf31a('0x41')]&&_0x59ef5b[_0xf31a('0x41')][0x0]?_0x59ef5b[_0xf31a('0x41')][0x0][_0xf31a('0x42')]:undefined)||_0xf31a('0x4c')},{'name':_0xf31a('0x57'),'value':_0x59ef5b[_0xf31a('0x57')]||(_0x59ef5b[_0xf31a('0x41')]&&_0x59ef5b[_0xf31a('0x41')][0x1]?_0x59ef5b[_0xf31a('0x41')][0x1]['value']:undefined)||null},{'name':_0xf31a('0x58'),'value':_0x59ef5b[_0xf31a('0x58')]||(_0x59ef5b[_0xf31a('0x41')]&&_0x59ef5b['attrs'][0x2]?_0x59ef5b[_0xf31a('0x41')][0x2]['value']:undefined)||null},{'name':_0xf31a('0x4d'),'value':_0x59ef5b[_0xf31a('0x4d')]||(_0x59ef5b[_0xf31a('0x41')]&&_0x59ef5b[_0xf31a('0x41')][0x3]?_0x59ef5b['attrs'][0x3][_0xf31a('0x42')]:undefined)||[]},{'name':_0xf31a('0x59'),'value':_0x59ef5b[_0xf31a('0x59')]||(_0x59ef5b[_0xf31a('0x41')]&&_0x59ef5b[_0xf31a('0x41')][0x4]?_0x59ef5b[_0xf31a('0x41')][0x4]['value']:undefined)||_0xf31a('0x4e')},{'name':'attrEmailAccounts','value':_0x59ef5b['attrEmailAccounts']||(_0x59ef5b['attrs']&&_0x59ef5b[_0xf31a('0x41')][0x5]?_0x59ef5b[_0xf31a('0x41')][0x5][_0xf31a('0x42')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x59ef5b[_0xf31a('0x50')]||(_0x59ef5b[_0xf31a('0x41')]&&_0x59ef5b[_0xf31a('0x41')][0x6]?_0x59ef5b['attrs'][0x6]['value']:undefined)||''},{'name':_0xf31a('0x51'),'value':_0x59ef5b[_0xf31a('0x51')]||(_0x59ef5b[_0xf31a('0x41')]&&_0x59ef5b[_0xf31a('0x41')][0x7]?_0x59ef5b[_0xf31a('0x41')][0x7][_0xf31a('0x42')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x59ef5b[_0xf31a('0x52')]||(_0x59ef5b['attrs']&&_0x59ef5b[_0xf31a('0x41')][0x8]?_0x59ef5b[_0xf31a('0x41')][0x8][_0xf31a('0x42')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x59ef5b[_0xf31a('0x53')]||(_0x59ef5b[_0xf31a('0x41')]&&_0x59ef5b[_0xf31a('0x41')][0x9]?_0x59ef5b[_0xf31a('0x41')][0x9][_0xf31a('0x42')]:undefined)||''},{'name':_0xf31a('0x54'),'value':_0x59ef5b[_0xf31a('0x54')]||(_0x59ef5b[_0xf31a('0x41')]&&_0x59ef5b['attrs'][0xa]?_0x59ef5b[_0xf31a('0x41')][0xa]['value']:undefined)||''}];case _0xf31a('0x5a'):return[{'name':'attrReport','type':_0x59ef5b[_0xf31a('0x5b')]||(_0x59ef5b[_0xf31a('0x41')]&&_0x59ef5b[_0xf31a('0x41')][0x0]?_0x59ef5b[_0xf31a('0x41')][0x0]['type']:undefined)||null,'value':_0x59ef5b[_0xf31a('0x5c')]||(_0x59ef5b[_0xf31a('0x41')]&&_0x59ef5b[_0xf31a('0x41')][0x0]?_0x59ef5b[_0xf31a('0x41')][0x0][_0xf31a('0x42')]:undefined)||null},{'name':_0xf31a('0x5d'),'value':_0x59ef5b[_0xf31a('0x5d')]||(_0x59ef5b[_0xf31a('0x41')]&&_0x59ef5b[_0xf31a('0x41')][0x1]?_0x59ef5b[_0xf31a('0x41')][0x1][_0xf31a('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x776ec7){logger[_0xf31a('0x2b')]('widgetAttributes:\x20%s',JSON[_0xf31a('0x5e')](_0x776ec7));return[];}}exports[_0xf31a('0x5f')]=function(_0x55695a,_0x4558d8){if(_0x55695a[_0xf31a('0x60')]){_0x55695a['body'][_0xf31a('0x41')]=widgetAttributes(_0x55695a[_0xf31a('0x60')]);}return db['DashboardItem']['create'](_0x55695a['body'],{})['then'](respondWithResult(_0x4558d8,0xc9))[_0xf31a('0x3e')](handleError(_0x4558d8,null));};exports[_0xf31a('0x61')]=function(_0x19c85e,_0x36ceca){if(_0x19c85e[_0xf31a('0x60')]['id']){delete _0x19c85e[_0xf31a('0x60')]['id'];}_0x19c85e['body'][_0xf31a('0x41')]=widgetAttributes(_0x19c85e[_0xf31a('0x60')]);return db[_0xf31a('0x31')][_0xf31a('0x3c')]({'where':{'id':_0x19c85e[_0xf31a('0x2e')]['id']}})[_0xf31a('0x2a')](handleEntityNotFound(_0x36ceca,null))[_0xf31a('0x2a')](saveUpdates(_0x19c85e[_0xf31a('0x60')],null))[_0xf31a('0x2a')](respondWithResult(_0x36ceca,null))['catch'](handleError(_0x36ceca,null));}; \ No newline at end of file +var _0xe0c1=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','reject','save','then','error','name','send','show','params','DashboardItem','query','keys','filters','intersection','model','attributes','length','options','catch','destroy','find','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','type','attrReport','attrRefresh','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x39d8fe,_0xae071e){var _0x4b52a6=function(_0xa91476){while(--_0xa91476){_0x39d8fe['push'](_0x39d8fe['shift']());}};_0x4b52a6(++_0xae071e);}(_0xe0c1,0x10f));var _0x1e0c=function(_0xfbcbb,_0x12233e){_0xfbcbb=_0xfbcbb-0x0;var _0x531aa4=_0xe0c1[_0xfbcbb];return _0x531aa4;};'use strict';var emlformat=require(_0x1e0c('0x0'));var rimraf=require(_0x1e0c('0x1'));var zipdir=require(_0x1e0c('0x2'));var jsonpatch=require(_0x1e0c('0x3'));var rp=require(_0x1e0c('0x4'));var moment=require(_0x1e0c('0x5'));var BPromise=require(_0x1e0c('0x6'));var Mustache=require('mustache');var util=require('util');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(_0x1e0c('0x7'));var _=require(_0x1e0c('0x8'));var squel=require(_0x1e0c('0x9'));var crypto=require(_0x1e0c('0xa'));var jsforce=require(_0x1e0c('0xb'));var deskjs=require(_0x1e0c('0xc'));var toCsv=require(_0x1e0c('0xd'));var querystring=require(_0x1e0c('0xe'));var Papa=require('papaparse');var Redis=require(_0x1e0c('0xf'));var authService=require(_0x1e0c('0x10'));var qs=require(_0x1e0c('0x11'));var as=require(_0x1e0c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e0c('0x13'))(_0x1e0c('0x14'));var utils=require(_0x1e0c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1e0c('0x16'));var db=require('../../mysqldb')['db'];config[_0x1e0c('0x17')]=_[_0x1e0c('0x18')](config[_0x1e0c('0x17')],{'host':_0x1e0c('0x19'),'port':0x18eb});var socket=require(_0x1e0c('0x1a'))(new Redis(config[_0x1e0c('0x17')]));require(_0x1e0c('0x1b'))[_0x1e0c('0x1c')](socket);function respondWithStatusCode(_0x1fbc44,_0x452248){_0x452248=_0x452248||0xcc;return function(_0x599d0b){if(_0x599d0b){return _0x1fbc44[_0x1e0c('0x1d')](_0x452248);}return _0x1fbc44['status'](_0x452248)[_0x1e0c('0x1e')]();};}function respondWithResult(_0xcf9c3b,_0x13840b){_0x13840b=_0x13840b||0xc8;return function(_0xb52d20){if(_0xb52d20){return _0xcf9c3b[_0x1e0c('0x1f')](_0x13840b)[_0x1e0c('0x20')](_0xb52d20);}};}function respondWithFilteredResult(_0x35a9cc,_0x4e2fbd){return function(_0x4315aa){if(_0x4315aa){var _0x1d0fe6=typeof _0x4e2fbd[_0x1e0c('0x21')]===_0x1e0c('0x22')&&typeof _0x4e2fbd['limit']==='undefined';var _0x596304=_0x4315aa[_0x1e0c('0x23')];var _0x268365=_0x1d0fe6?0x0:_0x4e2fbd[_0x1e0c('0x21')];var _0x186a02=_0x1d0fe6?_0x4315aa[_0x1e0c('0x23')]:_0x4e2fbd[_0x1e0c('0x21')]+_0x4e2fbd[_0x1e0c('0x24')];var _0x3c955c;if(_0x186a02>=_0x596304){_0x186a02=_0x596304;_0x3c955c=0xc8;}else{_0x3c955c=0xce;}_0x35a9cc['status'](_0x3c955c);return _0x35a9cc['set'](_0x1e0c('0x25'),_0x268365+'-'+_0x186a02+'/'+_0x596304)[_0x1e0c('0x20')](_0x4315aa);}return null;};}function patchUpdates(_0x3b1200){return function(_0xb29b17){try{jsonpatch['apply'](_0xb29b17,_0x3b1200,!![]);}catch(_0x4743e7){return BPromise[_0x1e0c('0x26')](_0x4743e7);}return _0xb29b17[_0x1e0c('0x27')]();};}function saveUpdates(_0x1cf772,_0x3d5f10){return function(_0x1697a4){if(_0x1697a4){return _0x1697a4['update'](_0x1cf772)['then'](function(_0x1d7c49){return _0x1d7c49;});}return null;};}function removeEntity(_0x3867c6,_0x4296b5){return function(_0x46eb21){if(_0x46eb21){return _0x46eb21['destroy']()[_0x1e0c('0x28')](function(){_0x3867c6[_0x1e0c('0x1f')](0xcc)[_0x1e0c('0x1e')]();});}};}function handleEntityNotFound(_0x5e7e6f,_0xef59ad){return function(_0x1a6a87){if(!_0x1a6a87){_0x5e7e6f[_0x1e0c('0x1d')](0x194);}return _0x1a6a87;};}function handleError(_0x2d8c99,_0x2c7593){_0x2c7593=_0x2c7593||0x1f4;return function(_0x4e0cea){logger[_0x1e0c('0x29')](_0x4e0cea['stack']);if(_0x4e0cea[_0x1e0c('0x2a')]){delete _0x4e0cea['name'];}_0x2d8c99[_0x1e0c('0x1f')](_0x2c7593)[_0x1e0c('0x2b')](_0x4e0cea);};}exports[_0x1e0c('0x2c')]=function(_0x28422a,_0x11cb84){var _0x5be528={'raw':![],'where':{'id':_0x28422a[_0x1e0c('0x2d')]['id']}},_0x1c96bf={};_0x1c96bf['model']=_['keys'](db[_0x1e0c('0x2e')]['rawAttributes']);_0x1c96bf[_0x1e0c('0x2f')]=_[_0x1e0c('0x30')](_0x28422a[_0x1e0c('0x2f')]);_0x1c96bf[_0x1e0c('0x31')]=_[_0x1e0c('0x32')](_0x1c96bf[_0x1e0c('0x33')],_0x1c96bf[_0x1e0c('0x2f')]);_0x5be528[_0x1e0c('0x34')]=_[_0x1e0c('0x32')](_0x1c96bf[_0x1e0c('0x33')],qs['fields'](_0x28422a[_0x1e0c('0x2f')]['fields']));_0x5be528[_0x1e0c('0x34')]=_0x5be528['attributes'][_0x1e0c('0x35')]?_0x5be528['attributes']:_0x1c96bf[_0x1e0c('0x33')];if(_0x28422a[_0x1e0c('0x2f')]['includeAll']){_0x5be528['include']=[{'all':!![]}];}_0x5be528=_['merge']({},_0x5be528,_0x28422a[_0x1e0c('0x36')]);return db['DashboardItem']['find'](_0x5be528)[_0x1e0c('0x28')](handleEntityNotFound(_0x11cb84,null))[_0x1e0c('0x28')](respondWithResult(_0x11cb84,null))[_0x1e0c('0x37')](handleError(_0x11cb84,null));};exports[_0x1e0c('0x38')]=function(_0x293bef,_0x40d2e9){return db['DashboardItem'][_0x1e0c('0x39')]({'where':{'id':_0x293bef[_0x1e0c('0x2d')]['id']}})[_0x1e0c('0x28')](handleEntityNotFound(_0x40d2e9,null))[_0x1e0c('0x28')](removeEntity(_0x40d2e9,null))[_0x1e0c('0x37')](handleError(_0x40d2e9,null));};function widgetAttributes(_0x208d98){try{switch(_0x208d98['type']){case _0x1e0c('0x3a'):return[{'name':_0x1e0c('0x3b'),'value':_0x208d98[_0x1e0c('0x3b')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x0]?_0x208d98[_0x1e0c('0x3c')][0x0]['value']:undefined)||_0x1e0c('0x3d')}];case _0x1e0c('0x3e'):return[{'name':'attrPath','value':_0x208d98[_0x1e0c('0x3f')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98['attrs'][0x0]?_0x208d98['attrs'][0x0][_0x1e0c('0x40')]:undefined)||''}];case _0x1e0c('0x41'):return[{'name':_0x1e0c('0x42'),'value':_0x208d98[_0x1e0c('0x42')]||(_0x208d98['attrs']&&_0x208d98['attrs'][0x0]?_0x208d98[_0x1e0c('0x3c')][0x0]['value']:undefined)||_0x1e0c('0x43')},{'name':_0x1e0c('0x44'),'value':_0x208d98[_0x1e0c('0x44')]||(_0x208d98['attrs']&&_0x208d98['attrs'][0x1]?_0x208d98[_0x1e0c('0x3c')][0x1]['value']:undefined)||_0x1e0c('0x45')},{'name':'attrFontSize','value':_0x208d98[_0x1e0c('0x46')]||(_0x208d98['attrs']&&_0x208d98[_0x1e0c('0x3c')][0x2]?_0x208d98['attrs'][0x2][_0x1e0c('0x40')]:undefined)||0xc}];case _0x1e0c('0x47'):return[{'name':_0x1e0c('0x48'),'value':_0x208d98[_0x1e0c('0x48')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x0]?_0x208d98['attrs'][0x0]['value']:undefined)||_0x1e0c('0x49')},{'name':_0x1e0c('0x4a'),'value':_0x208d98[_0x1e0c('0x4a')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x1]?_0x208d98[_0x1e0c('0x3c')][0x1]['value']:undefined)||[]},{'name':_0x1e0c('0x46'),'value':_0x208d98[_0x1e0c('0x46')]||(_0x208d98['attrs']&&_0x208d98['attrs'][0x2]?_0x208d98[_0x1e0c('0x3c')][0x2][_0x1e0c('0x40')]:undefined)||0x14},{'name':_0x1e0c('0x4b'),'value':_0x208d98[_0x1e0c('0x4b')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x3]?_0x208d98[_0x1e0c('0x3c')][0x3][_0x1e0c('0x40')]:undefined)||_0x1e0c('0x4c')},{'name':_0x1e0c('0x4d'),'value':_0x208d98[_0x1e0c('0x4d')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98['attrs'][0x4]?_0x208d98[_0x1e0c('0x3c')][0x4]['value']:undefined)||''},{'name':_0x1e0c('0x4e'),'value':_0x208d98[_0x1e0c('0x4e')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x5]?_0x208d98[_0x1e0c('0x3c')][0x5][_0x1e0c('0x40')]:undefined)||''},{'name':_0x1e0c('0x4f'),'value':_0x208d98[_0x1e0c('0x4f')]||(_0x208d98['attrs']&&_0x208d98['attrs'][0x6]?_0x208d98[_0x1e0c('0x3c')][0x6][_0x1e0c('0x40')]:undefined)||''},{'name':_0x1e0c('0x50'),'value':_0x208d98['attrOpenchannelAccounts']||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x7]?_0x208d98[_0x1e0c('0x3c')][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x208d98[_0x1e0c('0x51')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98['attrs'][0x8]?_0x208d98[_0x1e0c('0x3c')][0x8][_0x1e0c('0x40')]:undefined)||''},{'name':_0x1e0c('0x52'),'value':_0x208d98['attrChatWebsites']||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98['attrs'][0x9]?_0x208d98[_0x1e0c('0x3c')][0x9][_0x1e0c('0x40')]:undefined)||''}];case _0x1e0c('0x53'):case _0x1e0c('0x54'):return[{'name':_0x1e0c('0x55'),'value':_0x208d98[_0x1e0c('0x55')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x0]?_0x208d98[_0x1e0c('0x3c')][0x0]['value']:undefined)||'total'},{'name':_0x1e0c('0x56'),'value':_0x208d98[_0x1e0c('0x56')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x1]?_0x208d98[_0x1e0c('0x3c')][0x1][_0x1e0c('0x40')]:undefined)||null},{'name':'attrSerie3','value':_0x208d98[_0x1e0c('0x57')]||(_0x208d98['attrs']&&_0x208d98['attrs'][0x2]?_0x208d98[_0x1e0c('0x3c')][0x2]['value']:undefined)||null},{'name':_0x1e0c('0x4a'),'value':_0x208d98[_0x1e0c('0x4a')]||(_0x208d98['attrs']&&_0x208d98['attrs'][0x3]?_0x208d98[_0x1e0c('0x3c')][0x3]['value']:undefined)||[]},{'name':_0x1e0c('0x4b'),'value':_0x208d98[_0x1e0c('0x4b')]||(_0x208d98['attrs']&&_0x208d98[_0x1e0c('0x3c')][0x4]?_0x208d98[_0x1e0c('0x3c')][0x4][_0x1e0c('0x40')]:undefined)||_0x1e0c('0x4c')},{'name':_0x1e0c('0x4d'),'value':_0x208d98[_0x1e0c('0x4d')]||(_0x208d98['attrs']&&_0x208d98['attrs'][0x5]?_0x208d98[_0x1e0c('0x3c')][0x5][_0x1e0c('0x40')]:undefined)||''},{'name':_0x1e0c('0x4e'),'value':_0x208d98[_0x1e0c('0x4e')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x6]?_0x208d98[_0x1e0c('0x3c')][0x6]['value']:undefined)||''},{'name':_0x1e0c('0x4f'),'value':_0x208d98[_0x1e0c('0x4f')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x7]?_0x208d98[_0x1e0c('0x3c')][0x7][_0x1e0c('0x40')]:undefined)||''},{'name':_0x1e0c('0x50'),'value':_0x208d98['attrOpenchannelAccounts']||(_0x208d98['attrs']&&_0x208d98[_0x1e0c('0x3c')][0x8]?_0x208d98['attrs'][0x8][_0x1e0c('0x40')]:undefined)||''},{'name':_0x1e0c('0x51'),'value':_0x208d98[_0x1e0c('0x51')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x9]?_0x208d98[_0x1e0c('0x3c')][0x9]['value']:undefined)||''},{'name':_0x1e0c('0x52'),'value':_0x208d98[_0x1e0c('0x52')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0xa]?_0x208d98[_0x1e0c('0x3c')][0xa]['value']:undefined)||''}];case _0x1e0c('0x58'):return[{'name':'attrReport','type':_0x208d98[_0x1e0c('0x59')]||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x0]?_0x208d98[_0x1e0c('0x3c')][0x0][_0x1e0c('0x5a')]:undefined)||null,'value':_0x208d98[_0x1e0c('0x5b')]||(_0x208d98['attrs']&&_0x208d98[_0x1e0c('0x3c')][0x0]?_0x208d98[_0x1e0c('0x3c')][0x0][_0x1e0c('0x40')]:undefined)||null},{'name':_0x1e0c('0x5c'),'value':_0x208d98['attrRefresh']||(_0x208d98[_0x1e0c('0x3c')]&&_0x208d98[_0x1e0c('0x3c')][0x1]?_0x208d98[_0x1e0c('0x3c')][0x1][_0x1e0c('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x2ae0ab){logger[_0x1e0c('0x29')]('widgetAttributes:\x20%s',JSON['stringify'](_0x2ae0ab));return[];}}exports[_0x1e0c('0x5d')]=function(_0x35febe,_0x126969){if(_0x35febe[_0x1e0c('0x5e')]){_0x35febe['body'][_0x1e0c('0x3c')]=widgetAttributes(_0x35febe[_0x1e0c('0x5e')]);}return db['DashboardItem'][_0x1e0c('0x5d')](_0x35febe[_0x1e0c('0x5e')],{})[_0x1e0c('0x28')](respondWithResult(_0x126969,0xc9))['catch'](handleError(_0x126969,null));};exports['update']=function(_0x163bca,_0x2ad822){if(_0x163bca['body']['id']){delete _0x163bca[_0x1e0c('0x5e')]['id'];}_0x163bca[_0x1e0c('0x5e')]['attrs']=widgetAttributes(_0x163bca[_0x1e0c('0x5e')]);return db[_0x1e0c('0x2e')][_0x1e0c('0x39')]({'where':{'id':_0x163bca['params']['id']}})[_0x1e0c('0x28')](handleEntityNotFound(_0x2ad822,null))['then'](saveUpdates(_0x163bca['body'],null))[_0x1e0c('0x28')](respondWithResult(_0x2ad822,null))[_0x1e0c('0x37')](handleError(_0x2ad822,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 17935c8..54846f9 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 _0x2854=['hook','exports','events','DashboardItem','save','update','remove'];(function(_0x187718,_0x427383){var _0x29ddf4=function(_0x2ec62a){while(--_0x2ec62a){_0x187718['push'](_0x187718['shift']());}};_0x29ddf4(++_0x427383);}(_0x2854,0xaa));var _0x4285=function(_0x482c20,_0x49c007){_0x482c20=_0x482c20-0x0;var _0xf92978=_0x2854[_0x482c20];return _0xf92978;};'use strict';var EventEmitter=require(_0x4285('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x4285('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4285('0x2'),'afterUpdate':_0x4285('0x3'),'afterDestroy':_0x4285('0x4')};function emitEvent(_0x19068c){return function(_0x256541,_0x22b4a1,_0x140897){DashboardItemEvents['emit'](_0x19068c+':'+_0x256541['id'],_0x256541);DashboardItemEvents['emit'](_0x19068c,_0x256541);_0x140897(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x4285('0x5')](e,emitEvent(event));}}module[_0x4285('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0x221f=['save','remove','emit','hook','exports','events','DashboardItem','setMaxListeners'];(function(_0x5b7e4a,_0x2747e4){var _0x5e5858=function(_0x4783b3){while(--_0x4783b3){_0x5b7e4a['push'](_0x5b7e4a['shift']());}};_0x5e5858(++_0x2747e4);}(_0x221f,0x19d));var _0xf221=function(_0x26f1cf,_0x3ed15f){_0x26f1cf=_0x26f1cf-0x0;var _0x6674e8=_0x221f[_0x26f1cf];return _0x6674e8;};'use strict';var EventEmitter=require(_0xf221('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xf221('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xf221('0x2')](0x0);var events={'afterCreate':_0xf221('0x3'),'afterUpdate':'update','afterDestroy':_0xf221('0x4')};function emitEvent(_0x370609){return function(_0xe279d1,_0x363a9c,_0x969947){DashboardItemEvents[_0xf221('0x5')](_0x370609+':'+_0xe279d1['id'],_0xe279d1);DashboardItemEvents[_0xf221('0x5')](_0x370609,_0xe279d1);_0x969947(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xf221('0x6')](e,emitEvent(event));}}module[_0xf221('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 9df63cc..d70a1e6 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 _0xe991=['define','DashboardItem','dashboard_items','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','exports'];(function(_0x872795,_0x260445){var _0x22af15=function(_0x109a5f){while(--_0x109a5f){_0x872795['push'](_0x872795['shift']());}};_0x22af15(++_0x260445);}(_0xe991,0x92));var _0x1e99=function(_0x382037,_0x2f2d62){_0x382037=_0x382037-0x0;var _0x3bf761=_0xe991[_0x382037];return _0x3bf761;};'use strict';var _=require(_0x1e99('0x0'));var util=require(_0x1e99('0x1'));var logger=require('../../config/logger')(_0x1e99('0x2'));var moment=require(_0x1e99('0x3'));var BPromise=require(_0x1e99('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e99('0x5'));var rimraf=require(_0x1e99('0x6'));var config=require(_0x1e99('0x7'));var attributes=require(_0x1e99('0x8'));module[_0x1e99('0x9')]=function(_0x1d5c98,_0xa56a31){return _0x1d5c98[_0x1e99('0xa')](_0x1e99('0xb'),attributes,{'tableName':_0x1e99('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5145=['define','DashboardItem','dashboard_items','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5145,0x93));var _0x5514=function(_0x5f0a7d,_0x1e2628){_0x5f0a7d=_0x5f0a7d-0x0;var _0x233fd6=_0x5145[_0x5f0a7d];return _0x233fd6;};'use strict';var _=require(_0x5514('0x0'));var util=require(_0x5514('0x1'));var logger=require(_0x5514('0x2'))('api');var moment=require(_0x5514('0x3'));var BPromise=require('bluebird');var rp=require(_0x5514('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5514('0x5'));var config=require(_0x5514('0x6'));var attributes=require(_0x5514('0x7'));module[_0x5514('0x8')]=function(_0x399032,_0x205a65){return _0x399032[_0x5514('0x9')](_0x5514('0xa'),attributes,{'tableName':_0x5514('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 9abeccc..ce4a2bd 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 _0x500d=['DashboardItem,\x20%s,\x20%s','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./dashboardItem.socket','register','request','then','info'];(function(_0xe53226,_0x4c0657){var _0x44e5b4=function(_0x11af7c){while(--_0x11af7c){_0xe53226['push'](_0xe53226['shift']());}};_0x44e5b4(++_0x4c0657);}(_0x500d,0x14b));var _0xd500=function(_0x1f4e09,_0x1fc591){_0x1f4e09=_0x1f4e09-0x0;var _0x10deec=_0x500d[_0x1f4e09];return _0x10deec;};'use strict';var _=require(_0xd500('0x0'));var util=require(_0xd500('0x1'));var moment=require(_0xd500('0x2'));var BPromise=require(_0xd500('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd500('0x4'))['db'];var utils=require(_0xd500('0x5'));var logger=require(_0xd500('0x6'))(_0xd500('0x7'));var config=require(_0xd500('0x8'));var jayson=require(_0xd500('0x9'));var client=jayson['client'][_0xd500('0xa')]({'port':0x232a});config['redis']=_[_0xd500('0xb')](config['redis'],{'host':_0xd500('0xc'),'port':0x18eb});var socket=require(_0xd500('0xd'))(new Redis(config[_0xd500('0xe')]));require(_0xd500('0xf'))[_0xd500('0x10')](socket);function respondWithRpcPromise(_0x4ec8a3,_0x30e8a3,_0x84a6a2){return new BPromise(function(_0x3e6118,_0x411de1){return client[_0xd500('0x11')](_0x4ec8a3,_0x84a6a2)[_0xd500('0x12')](function(_0x470a2e){logger[_0xd500('0x13')](_0xd500('0x14'),_0x30e8a3,'request\x20sent');logger['debug'](_0xd500('0x15'),_0x30e8a3,_0xd500('0x16'),JSON[_0xd500('0x17')](_0x470a2e));if(_0x470a2e['error']){if(_0x470a2e[_0xd500('0x18')][_0xd500('0x19')]===0x1f4){logger[_0xd500('0x18')](_0xd500('0x14'),_0x30e8a3,_0x470a2e[_0xd500('0x18')][_0xd500('0x1a')]);return _0x411de1(_0x470a2e[_0xd500('0x18')][_0xd500('0x1a')]);}logger[_0xd500('0x18')](_0xd500('0x14'),_0x30e8a3,_0x470a2e[_0xd500('0x18')][_0xd500('0x1a')]);return _0x3e6118(_0x470a2e[_0xd500('0x18')][_0xd500('0x1a')]);}else{logger[_0xd500('0x13')](_0xd500('0x14'),_0x30e8a3,_0xd500('0x16'));_0x3e6118(_0x470a2e['result'][_0xd500('0x1a')]);}})['catch'](function(_0x33b6f4){logger['error'](_0xd500('0x14'),_0x30e8a3,_0x33b6f4);_0x411de1(_0x33b6f4);});});} \ No newline at end of file +var _0x1e7e=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x47c0cd,_0xcbeafb){var _0x3c1b5e=function(_0x29458a){while(--_0x29458a){_0x47c0cd['push'](_0x47c0cd['shift']());}};_0x3c1b5e(++_0xcbeafb);}(_0x1e7e,0x122));var _0xe1e7=function(_0x5ae2c,_0x216476){_0x5ae2c=_0x5ae2c-0x0;var _0x3962fd=_0x1e7e[_0x5ae2c];return _0x3962fd;};'use strict';var _=require(_0xe1e7('0x0'));var util=require(_0xe1e7('0x1'));var moment=require(_0xe1e7('0x2'));var BPromise=require(_0xe1e7('0x3'));var rs=require(_0xe1e7('0x4'));var fs=require('fs');var Redis=require(_0xe1e7('0x5'));var db=require(_0xe1e7('0x6'))['db'];var utils=require(_0xe1e7('0x7'));var logger=require(_0xe1e7('0x8'))(_0xe1e7('0x9'));var config=require(_0xe1e7('0xa'));var jayson=require(_0xe1e7('0xb'));var client=jayson[_0xe1e7('0xc')][_0xe1e7('0xd')]({'port':0x232a});config[_0xe1e7('0xe')]=_[_0xe1e7('0xf')](config['redis'],{'host':_0xe1e7('0x10'),'port':0x18eb});var socket=require(_0xe1e7('0x11'))(new Redis(config['redis']));require(_0xe1e7('0x12'))[_0xe1e7('0x13')](socket);function respondWithRpcPromise(_0x169a7d,_0x5bf7e9,_0x369979){return new BPromise(function(_0x1c3d9c,_0x2c7bd7){return client['request'](_0x169a7d,_0x369979)['then'](function(_0x2b1477){logger[_0xe1e7('0x14')](_0xe1e7('0x15'),_0x5bf7e9,_0xe1e7('0x16'));logger['debug'](_0xe1e7('0x17'),_0x5bf7e9,_0xe1e7('0x16'),JSON[_0xe1e7('0x18')](_0x2b1477));if(_0x2b1477[_0xe1e7('0x19')]){if(_0x2b1477[_0xe1e7('0x19')][_0xe1e7('0x1a')]===0x1f4){logger[_0xe1e7('0x19')](_0xe1e7('0x15'),_0x5bf7e9,_0x2b1477[_0xe1e7('0x19')][_0xe1e7('0x1b')]);return _0x2c7bd7(_0x2b1477[_0xe1e7('0x19')][_0xe1e7('0x1b')]);}logger[_0xe1e7('0x19')](_0xe1e7('0x15'),_0x5bf7e9,_0x2b1477['error']['message']);return _0x1c3d9c(_0x2b1477[_0xe1e7('0x19')]['message']);}else{logger[_0xe1e7('0x14')](_0xe1e7('0x15'),_0x5bf7e9,_0xe1e7('0x16'));_0x1c3d9c(_0x2b1477[_0xe1e7('0x1c')][_0xe1e7('0x1b')]);}})[_0xe1e7('0x1d')](function(_0x28f71d){logger['error'](_0xe1e7('0x15'),_0x5bf7e9,_0x28f71d);_0x2c7bd7(_0x28f71d);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 0526c8f..ae3de17 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 _0x2bbb=['remove','update','removeListener','register','dashboardItem:','./dashboardItem.events'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0x2bbb,0x167));var _0xb2bb=function(_0x5ec4c0,_0x31f711){_0x5ec4c0=_0x5ec4c0-0x0;var _0x1387e0=_0x2bbb[_0x5ec4c0];return _0x1387e0;};'use strict';var DashboardItemEvents=require(_0xb2bb('0x0'));var events=['save',_0xb2bb('0x1'),_0xb2bb('0x2')];function createListener(_0x171db5,_0x1fe7d1){return function(_0x4d954b){_0x1fe7d1['emit'](_0x171db5,_0x4d954b);};}function removeListener(_0x1bc90c,_0x51dd9f){return function(){DashboardItemEvents[_0xb2bb('0x3')](_0x1bc90c,_0x51dd9f);};}exports[_0xb2bb('0x4')]=function(_0x38c20e){for(var _0x581602=0x0,_0x3f735a=events['length'];_0x581602<_0x3f735a;_0x581602++){var _0x3779f5=events[_0x581602];var _0x3c6bf2=createListener(_0xb2bb('0x5')+_0x3779f5,_0x38c20e);DashboardItemEvents['on'](_0x3779f5,_0x3c6bf2);}}; \ No newline at end of file +var _0x7dba=['remove','emit','removeListener','register','length','dashboardItem:','./dashboardItem.events'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x7dba,0x1b1));var _0xa7db=function(_0x3faf41,_0x45850e){_0x3faf41=_0x3faf41-0x0;var _0x49d289=_0x7dba[_0x3faf41];return _0x49d289;};'use strict';var DashboardItemEvents=require(_0xa7db('0x0'));var events=['save',_0xa7db('0x1'),'update'];function createListener(_0x52b866,_0x41422a){return function(_0x2719ff){_0x41422a[_0xa7db('0x2')](_0x52b866,_0x2719ff);};}function removeListener(_0x18f767,_0x329676){return function(){DashboardItemEvents[_0xa7db('0x3')](_0x18f767,_0x329676);};}exports[_0xa7db('0x4')]=function(_0x9e3d9e){for(var _0x3f3028=0x0,_0x51c2e7=events[_0xa7db('0x5')];_0x3f3028<_0x51c2e7;_0x3f3028++){var _0x2a4c67=events[_0x3f3028];var _0x175466=createListener(_0xa7db('0x6')+_0x2a4c67,_0x9e3d9e);DashboardItemEvents['on'](_0x2a4c67,_0x175466);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index e39d865..be2aea3 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 _0xbd41=['isAuthenticated','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','show','post'];(function(_0x132990,_0x1370c9){var _0x2aa89d=function(_0x31ae05){while(--_0x31ae05){_0x132990['push'](_0x132990['shift']());}};_0x2aa89d(++_0x1370c9);}(_0xbd41,0x196));var _0x1bd4=function(_0x3f186c,_0x407d8c){_0x3f186c=_0x3f186c-0x0;var _0x16f766=_0xbd41[_0x3f186c];return _0x16f766;};'use strict';var multer=require('multer');var util=require(_0x1bd4('0x0'));var path=require('path');var timeout=require(_0x1bd4('0x1'));var express=require(_0x1bd4('0x2'));var router=express[_0x1bd4('0x3')]();var fs_extra=require(_0x1bd4('0x4'));var auth=require(_0x1bd4('0x5'));var interaction=require(_0x1bd4('0x6'));var config=require(_0x1bd4('0x7'));var controller=require(_0x1bd4('0x8'));router['get'](_0x1bd4('0x9'),auth['isAuthenticated'](),controller[_0x1bd4('0xa')]);router[_0x1bd4('0xb')]('/',auth[_0x1bd4('0xc')](),controller[_0x1bd4('0xd')]);router[_0x1bd4('0xe')]('/:id',auth[_0x1bd4('0xc')](),controller[_0x1bd4('0xf')]);router[_0x1bd4('0x10')](_0x1bd4('0x9'),auth[_0x1bd4('0xc')](),controller[_0x1bd4('0x11')]);module[_0x1bd4('0x12')]=router; \ No newline at end of file +var _0x062a=['/:id','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','isAuthenticated','show','post','create'];(function(_0x29c3b2,_0x3c12ac){var _0x4b3aa7=function(_0x622a9d){while(--_0x622a9d){_0x29c3b2['push'](_0x29c3b2['shift']());}};_0x4b3aa7(++_0x3c12ac);}(_0x062a,0x73));var _0xa062=function(_0x404992,_0x58aca1){_0x404992=_0x404992-0x0;var _0x384bae=_0x062a[_0x404992];return _0x384bae;};'use strict';var multer=require(_0xa062('0x0'));var util=require(_0xa062('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa062('0x2'));var router=express[_0xa062('0x3')]();var fs_extra=require(_0xa062('0x4'));var auth=require(_0xa062('0x5'));var interaction=require(_0xa062('0x6'));var config=require(_0xa062('0x7'));var controller=require(_0xa062('0x8'));router['get']('/:id',auth[_0xa062('0x9')](),controller[_0xa062('0xa')]);router[_0xa062('0xb')]('/',auth[_0xa062('0x9')](),controller[_0xa062('0xc')]);router['put'](_0xa062('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xa062('0xe')]('/:id',auth[_0xa062('0x9')](),controller['destroy']);module[_0xa062('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 5ef1f4e..37ebbde 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 _0x43e1=['exports','STRING','first','sequelize'];(function(_0x1fda8c,_0x4cf5ec){var _0x46495c=function(_0x987194){while(--_0x987194){_0x1fda8c['push'](_0x1fda8c['shift']());}};_0x46495c(++_0x4cf5ec);}(_0x43e1,0xb7));var _0x143e=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0x43e1[_0x11a55c];return _0x26c390;};'use strict';var Sequelize=require(_0x143e('0x0'));module[_0x143e('0x1')]={'name':{'type':Sequelize[_0x143e('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM']('first','second','third'),'allowNull':![],'defaultValue':_0x143e('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf779=['STRING','ENUM','first','second','sequelize','exports'];(function(_0x2e8328,_0x4aff6f){var _0x26bc81=function(_0x400bc6){while(--_0x400bc6){_0x2e8328['push'](_0x2e8328['shift']());}};_0x26bc81(++_0x4aff6f);}(_0xf779,0x1b4));var _0x9f77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf779[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9f77('0x0'));module[_0x9f77('0x1')]={'name':{'type':Sequelize[_0x9f77('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x9f77('0x3')](_0x9f77('0x4'),_0x9f77('0x5'),'third'),'allowNull':![],'defaultValue':_0x9f77('0x4')},'description':{'type':Sequelize[_0x9f77('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 53a7246..3573b6d 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 _0x6ee1=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','userProfileId','catch','params','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','count','set','reject','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x22fe0c,_0x4a1b45){var _0xca26cf=function(_0x2580c9){while(--_0x2580c9){_0x22fe0c['push'](_0x22fe0c['shift']());}};_0xca26cf(++_0x4a1b45);}(_0x6ee1,0x6a));var _0x16ee=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0x6ee1[_0x4ab3fb];return _0x34fe1e;};'use strict';var emlformat=require(_0x16ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x16ee('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x16ee('0x2'));var moment=require(_0x16ee('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x16ee('0x4'));var util=require(_0x16ee('0x5'));var path=require(_0x16ee('0x6'));var sox=require(_0x16ee('0x7'));var csv=require('to-csv');var ejs=require(_0x16ee('0x8'));var fs=require('fs');var fs_extra=require(_0x16ee('0x9'));var _=require('lodash');var squel=require(_0x16ee('0xa'));var crypto=require(_0x16ee('0xb'));var jsforce=require(_0x16ee('0xc'));var deskjs=require(_0x16ee('0xd'));var toCsv=require(_0x16ee('0xe'));var querystring=require(_0x16ee('0xf'));var Papa=require(_0x16ee('0x10'));var Redis=require(_0x16ee('0x11'));var authService=require(_0x16ee('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x16ee('0x13'))(_0x16ee('0x14'));var utils=require(_0x16ee('0x15'));var config=require(_0x16ee('0x16'));var licenseUtil=require(_0x16ee('0x17'));var db=require(_0x16ee('0x18'))['db'];function respondWithStatusCode(_0x178928,_0x2a9e8c){_0x2a9e8c=_0x2a9e8c||0xcc;return function(_0x45a62c){if(_0x45a62c){return _0x178928['sendStatus'](_0x2a9e8c);}return _0x178928[_0x16ee('0x19')](_0x2a9e8c)['end']();};}function respondWithResult(_0x4b3e07,_0x15cc83){_0x15cc83=_0x15cc83||0xc8;return function(_0x58d7eb){if(_0x58d7eb){return _0x4b3e07['status'](_0x15cc83)[_0x16ee('0x1a')](_0x58d7eb);}};}function respondWithFilteredResult(_0x401cbb,_0x2248f0){return function(_0x45a7ff){if(_0x45a7ff){var _0x31146d=typeof _0x2248f0[_0x16ee('0x1b')]==='undefined'&&typeof _0x2248f0[_0x16ee('0x1c')]==='undefined';var _0x5340d4=_0x45a7ff['count'];var _0x2822e9=_0x31146d?0x0:_0x2248f0[_0x16ee('0x1b')];var _0x5db1d2=_0x31146d?_0x45a7ff[_0x16ee('0x1d')]:_0x2248f0['offset']+_0x2248f0[_0x16ee('0x1c')];var _0x36b683;if(_0x5db1d2>=_0x5340d4){_0x5db1d2=_0x5340d4;_0x36b683=0xc8;}else{_0x36b683=0xce;}_0x401cbb[_0x16ee('0x19')](_0x36b683);return _0x401cbb[_0x16ee('0x1e')]('Content-Range',_0x2822e9+'-'+_0x5db1d2+'/'+_0x5340d4)[_0x16ee('0x1a')](_0x45a7ff);}return null;};}function patchUpdates(_0x20ec3d){return function(_0x2d2bac){try{jsonpatch['apply'](_0x2d2bac,_0x20ec3d,!![]);}catch(_0x26e5b5){return BPromise[_0x16ee('0x1f')](_0x26e5b5);}return _0x2d2bac['save']();};}function saveUpdates(_0x28829b,_0x7c5412){return function(_0xe3976c){if(_0xe3976c){return _0xe3976c[_0x16ee('0x20')](_0x28829b)[_0x16ee('0x21')](function(_0x481e0b){return _0x481e0b;});}return null;};}function removeEntity(_0x21a709,_0x2fd8e6){return function(_0x172561){if(_0x172561){return _0x172561[_0x16ee('0x22')]()[_0x16ee('0x21')](function(){var _0x3ab814=_0x172561[_0x16ee('0x23')]({'plain':!![]});var _0x5f7742='Dispositions';return db[_0x16ee('0x24')][_0x16ee('0x22')]({'where':{'type':_0x5f7742,'resourceId':_0x3ab814['id']}})['then'](function(){return _0x172561;});})[_0x16ee('0x21')](function(){_0x21a709['status'](0xcc)[_0x16ee('0x25')]();});}};}function handleEntityNotFound(_0x578e16,_0x3349a6){return function(_0x93675d){if(!_0x93675d){_0x578e16['sendStatus'](0x194);}return _0x93675d;};}function handleError(_0x18e037,_0x3ed9c0){_0x3ed9c0=_0x3ed9c0||0x1f4;return function(_0x1b35ab){logger[_0x16ee('0x26')](_0x1b35ab[_0x16ee('0x27')]);if(_0x1b35ab['name']){delete _0x1b35ab[_0x16ee('0x28')];}_0x18e037['status'](_0x3ed9c0)[_0x16ee('0x29')](_0x1b35ab);};}exports[_0x16ee('0x2a')]=function(_0x48e379,_0x5296a1){var _0x4531b7={},_0x4db267={},_0x133632={'count':0x0,'rows':[]};var _0x75810f=_[_0x16ee('0x2b')](db[_0x16ee('0x2c')][_0x16ee('0x2d')],function(_0x5e70de){return{'name':_0x5e70de[_0x16ee('0x2e')],'type':_0x5e70de[_0x16ee('0x2f')]['key']};});_0x4db267[_0x16ee('0x30')]=_[_0x16ee('0x2b')](_0x75810f,_0x16ee('0x28'));_0x4db267[_0x16ee('0x31')]=_[_0x16ee('0x32')](_0x48e379[_0x16ee('0x31')]);_0x4db267[_0x16ee('0x33')]=_[_0x16ee('0x34')](_0x4db267[_0x16ee('0x30')],_0x4db267[_0x16ee('0x31')]);_0x4531b7[_0x16ee('0x35')]=_[_0x16ee('0x34')](_0x4db267[_0x16ee('0x30')],qs['fields'](_0x48e379[_0x16ee('0x31')][_0x16ee('0x36')]));_0x4531b7[_0x16ee('0x35')]=_0x4531b7['attributes'][_0x16ee('0x37')]?_0x4531b7[_0x16ee('0x35')]:_0x4db267[_0x16ee('0x30')];if(!_0x48e379[_0x16ee('0x31')][_0x16ee('0x38')](_0x16ee('0x39'))){_0x4531b7[_0x16ee('0x1c')]=qs['limit'](_0x48e379['query'][_0x16ee('0x1c')]);_0x4531b7[_0x16ee('0x1b')]=qs[_0x16ee('0x1b')](_0x48e379[_0x16ee('0x31')][_0x16ee('0x1b')]);}_0x4531b7[_0x16ee('0x3a')]=qs['sort'](_0x48e379[_0x16ee('0x31')][_0x16ee('0x3b')]);_0x4531b7[_0x16ee('0x3c')]=qs[_0x16ee('0x33')](_[_0x16ee('0x3d')](_0x48e379[_0x16ee('0x31')],_0x4db267['filters']),_0x75810f);if(_0x48e379['query'][_0x16ee('0x3e')]){_0x4531b7[_0x16ee('0x3c')]=_[_0x16ee('0x3f')](_0x4531b7[_0x16ee('0x3c')],{'$or':_[_0x16ee('0x2b')](_0x75810f,function(_0x1db544){if(_0x1db544[_0x16ee('0x2f')]!==_0x16ee('0x40')){var _0xa07e0b={};_0xa07e0b[_0x1db544['name']]={'$like':'%'+_0x48e379[_0x16ee('0x31')][_0x16ee('0x3e')]+'%'};return _0xa07e0b;}})});}_0x4531b7=_[_0x16ee('0x3f')]({},_0x4531b7,_0x48e379[_0x16ee('0x41')]);var _0x425cbe={'where':_0x4531b7[_0x16ee('0x3c')]};return db[_0x16ee('0x2c')][_0x16ee('0x1d')](_0x425cbe)[_0x16ee('0x21')](function(_0x1a54a7){_0x133632[_0x16ee('0x1d')]=_0x1a54a7;if(_0x48e379[_0x16ee('0x31')][_0x16ee('0x42')]){_0x4531b7[_0x16ee('0x43')]=[{'all':!![]}];}return db[_0x16ee('0x2c')][_0x16ee('0x44')](_0x4531b7);})[_0x16ee('0x21')](function(_0x56f916){_0x133632[_0x16ee('0x45')]=_0x56f916;return _0x133632;})['then'](respondWithFilteredResult(_0x5296a1,_0x4531b7))['catch'](handleError(_0x5296a1,null));};exports[_0x16ee('0x46')]=function(_0x43a29a,_0x2f27f4){var _0x2ee4dc={'raw':!![],'where':{'id':_0x43a29a['params']['id']}},_0x38185d={};_0x38185d['model']=_['keys'](db[_0x16ee('0x2c')][_0x16ee('0x2d')]);_0x38185d[_0x16ee('0x31')]=_['keys'](_0x43a29a['query']);_0x38185d[_0x16ee('0x33')]=_[_0x16ee('0x34')](_0x38185d[_0x16ee('0x30')],_0x38185d['query']);_0x2ee4dc[_0x16ee('0x35')]=_[_0x16ee('0x34')](_0x38185d['model'],qs['fields'](_0x43a29a['query']['fields']));_0x2ee4dc[_0x16ee('0x35')]=_0x2ee4dc[_0x16ee('0x35')][_0x16ee('0x37')]?_0x2ee4dc[_0x16ee('0x35')]:_0x38185d[_0x16ee('0x30')];if(_0x43a29a['query'][_0x16ee('0x42')]){_0x2ee4dc[_0x16ee('0x43')]=[{'all':!![]}];}_0x2ee4dc=_[_0x16ee('0x3f')]({},_0x2ee4dc,_0x43a29a['options']);return db[_0x16ee('0x2c')][_0x16ee('0x47')](_0x2ee4dc)['then'](handleEntityNotFound(_0x2f27f4,null))['then'](respondWithResult(_0x2f27f4,null))['catch'](handleError(_0x2f27f4,null));};exports[_0x16ee('0x48')]=function(_0x22803d,_0x507cfd){return db[_0x16ee('0x2c')]['create'](_0x22803d[_0x16ee('0x49')],{})[_0x16ee('0x21')](function(_0x130d86){var _0xe766a4=_0x22803d[_0x16ee('0x4a')][_0x16ee('0x23')]({'plain':!![]});if(!_0xe766a4)throw new Error(_0x16ee('0x4b'));if(_0xe766a4[_0x16ee('0x4c')]===_0x16ee('0x4a')){var _0x404dad=_0x130d86[_0x16ee('0x23')]({'plain':!![]});var _0x4c537b=_0x16ee('0x4d');return db[_0x16ee('0x4e')]['find']({'where':{'name':_0x4c537b,'userProfileId':_0xe766a4[_0x16ee('0x4f')]},'raw':!![]})[_0x16ee('0x21')](function(_0x4ce109){if(_0x4ce109&&_0x4ce109['autoAssociation']===0x0){return db[_0x16ee('0x24')][_0x16ee('0x48')]({'name':_0x404dad[_0x16ee('0x28')],'resourceId':_0x404dad['id'],'type':_0x4ce109[_0x16ee('0x28')],'sectionId':_0x4ce109['id']},{})[_0x16ee('0x21')](function(){return _0x130d86;});}else{return _0x130d86;}})[_0x16ee('0x50')](function(_0x37a834){logger[_0x16ee('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37a834);throw _0x37a834;});}return _0x130d86;})[_0x16ee('0x21')](respondWithResult(_0x507cfd,0xc9))[_0x16ee('0x50')](handleError(_0x507cfd,null));};exports[_0x16ee('0x20')]=function(_0x3a7bc1,_0x1bf178){if(_0x3a7bc1['body']['id']){delete _0x3a7bc1[_0x16ee('0x49')]['id'];}return db['Disposition'][_0x16ee('0x47')]({'where':{'id':_0x3a7bc1[_0x16ee('0x51')]['id']}})[_0x16ee('0x21')](handleEntityNotFound(_0x1bf178,null))[_0x16ee('0x21')](saveUpdates(_0x3a7bc1[_0x16ee('0x49')],null))['then'](respondWithResult(_0x1bf178,null))[_0x16ee('0x50')](handleError(_0x1bf178,null));};exports[_0x16ee('0x22')]=function(_0x508b75,_0x4f4dcf){return db['Disposition'][_0x16ee('0x47')]({'where':{'id':_0x508b75[_0x16ee('0x51')]['id']}})['then'](handleEntityNotFound(_0x4f4dcf,null))[_0x16ee('0x21')](removeEntity(_0x4f4dcf,null))[_0x16ee('0x50')](handleError(_0x4f4dcf,null));}; \ No newline at end of file +var _0x4f96=['filter','Disposition','include','findAll','rows','show','params','includeAll','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','count','limit','set','Content-Range','json','apply','reject','save','update','then','get','Dispositions','UserProfileResource','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL'];(function(_0x3acb52,_0x94375){var _0x5cbf45=function(_0x22ad34){while(--_0x22ad34){_0x3acb52['push'](_0x3acb52['shift']());}};_0x5cbf45(++_0x94375);}(_0x4f96,0xb9));var _0x64f9=function(_0x574250,_0x3ec0d7){_0x574250=_0x574250-0x0;var _0x5e3d92=_0x4f96[_0x574250];return _0x5e3d92;};'use strict';var emlformat=require(_0x64f9('0x0'));var rimraf=require(_0x64f9('0x1'));var zipdir=require(_0x64f9('0x2'));var jsonpatch=require(_0x64f9('0x3'));var rp=require(_0x64f9('0x4'));var moment=require(_0x64f9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x64f9('0x6'));var util=require('util');var path=require('path');var sox=require(_0x64f9('0x7'));var csv=require('to-csv');var ejs=require(_0x64f9('0x8'));var fs=require('fs');var fs_extra=require(_0x64f9('0x9'));var _=require(_0x64f9('0xa'));var squel=require(_0x64f9('0xb'));var crypto=require(_0x64f9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x64f9('0xd'));var toCsv=require('to-csv');var querystring=require(_0x64f9('0xe'));var Papa=require(_0x64f9('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x64f9('0x10'));var as=require(_0x64f9('0x11'));var hardwareService=require(_0x64f9('0x12'));var logger=require(_0x64f9('0x13'))(_0x64f9('0x14'));var utils=require('../../config/utils');var config=require(_0x64f9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x64f9('0x16'))['db'];function respondWithStatusCode(_0x4491bb,_0x4b5ecd){_0x4b5ecd=_0x4b5ecd||0xcc;return function(_0x2db632){if(_0x2db632){return _0x4491bb[_0x64f9('0x17')](_0x4b5ecd);}return _0x4491bb[_0x64f9('0x18')](_0x4b5ecd)[_0x64f9('0x19')]();};}function respondWithResult(_0x33da78,_0x4b52b3){_0x4b52b3=_0x4b52b3||0xc8;return function(_0x14febc){if(_0x14febc){return _0x33da78['status'](_0x4b52b3)['json'](_0x14febc);}};}function respondWithFilteredResult(_0x3f69a5,_0x2109cb){return function(_0x5c2a12){if(_0x5c2a12){var _0xd9aa4b=typeof _0x2109cb[_0x64f9('0x1a')]==='undefined'&&typeof _0x2109cb['limit']==='undefined';var _0x534c2c=_0x5c2a12[_0x64f9('0x1b')];var _0x28553e=_0xd9aa4b?0x0:_0x2109cb[_0x64f9('0x1a')];var _0x238672=_0xd9aa4b?_0x5c2a12['count']:_0x2109cb['offset']+_0x2109cb[_0x64f9('0x1c')];var _0x482a6d;if(_0x238672>=_0x534c2c){_0x238672=_0x534c2c;_0x482a6d=0xc8;}else{_0x482a6d=0xce;}_0x3f69a5[_0x64f9('0x18')](_0x482a6d);return _0x3f69a5[_0x64f9('0x1d')](_0x64f9('0x1e'),_0x28553e+'-'+_0x238672+'/'+_0x534c2c)[_0x64f9('0x1f')](_0x5c2a12);}return null;};}function patchUpdates(_0x1bdda9){return function(_0x89eb57){try{jsonpatch[_0x64f9('0x20')](_0x89eb57,_0x1bdda9,!![]);}catch(_0x40b9b7){return BPromise[_0x64f9('0x21')](_0x40b9b7);}return _0x89eb57[_0x64f9('0x22')]();};}function saveUpdates(_0x253a94,_0x327e59){return function(_0x55ca87){if(_0x55ca87){return _0x55ca87[_0x64f9('0x23')](_0x253a94)[_0x64f9('0x24')](function(_0x714f93){return _0x714f93;});}return null;};}function removeEntity(_0x4a1796,_0x5ce72e){return function(_0x51544b){if(_0x51544b){return _0x51544b['destroy']()[_0x64f9('0x24')](function(){var _0x35169c=_0x51544b[_0x64f9('0x25')]({'plain':!![]});var _0x1f8e45=_0x64f9('0x26');return db[_0x64f9('0x27')]['destroy']({'where':{'type':_0x1f8e45,'resourceId':_0x35169c['id']}})['then'](function(){return _0x51544b;});})[_0x64f9('0x24')](function(){_0x4a1796['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x104bc8,_0x4ec97d){return function(_0x4f9c6a){if(!_0x4f9c6a){_0x104bc8[_0x64f9('0x17')](0x194);}return _0x4f9c6a;};}function handleError(_0x434c2f,_0x6c6d14){_0x6c6d14=_0x6c6d14||0x1f4;return function(_0x2d9c3e){logger[_0x64f9('0x28')](_0x2d9c3e['stack']);if(_0x2d9c3e[_0x64f9('0x29')]){delete _0x2d9c3e[_0x64f9('0x29')];}_0x434c2f[_0x64f9('0x18')](_0x6c6d14)['send'](_0x2d9c3e);};}exports[_0x64f9('0x2a')]=function(_0x3dc350,_0x276714){var _0x4f16ae={},_0x57ab35={},_0x4ffee7={'count':0x0,'rows':[]};var _0x9e0bed=_[_0x64f9('0x2b')](db['Disposition'][_0x64f9('0x2c')],function(_0x198aad){return{'name':_0x198aad[_0x64f9('0x2d')],'type':_0x198aad[_0x64f9('0x2e')][_0x64f9('0x2f')]};});_0x57ab35[_0x64f9('0x30')]=_[_0x64f9('0x2b')](_0x9e0bed,_0x64f9('0x29'));_0x57ab35[_0x64f9('0x31')]=_[_0x64f9('0x32')](_0x3dc350['query']);_0x57ab35[_0x64f9('0x33')]=_[_0x64f9('0x34')](_0x57ab35[_0x64f9('0x30')],_0x57ab35[_0x64f9('0x31')]);_0x4f16ae[_0x64f9('0x35')]=_['intersection'](_0x57ab35[_0x64f9('0x30')],qs[_0x64f9('0x36')](_0x3dc350['query'][_0x64f9('0x36')]));_0x4f16ae['attributes']=_0x4f16ae['attributes'][_0x64f9('0x37')]?_0x4f16ae[_0x64f9('0x35')]:_0x57ab35[_0x64f9('0x30')];if(!_0x3dc350[_0x64f9('0x31')][_0x64f9('0x38')](_0x64f9('0x39'))){_0x4f16ae[_0x64f9('0x1c')]=qs[_0x64f9('0x1c')](_0x3dc350['query'][_0x64f9('0x1c')]);_0x4f16ae[_0x64f9('0x1a')]=qs[_0x64f9('0x1a')](_0x3dc350[_0x64f9('0x31')][_0x64f9('0x1a')]);}_0x4f16ae[_0x64f9('0x3a')]=qs[_0x64f9('0x3b')](_0x3dc350[_0x64f9('0x31')][_0x64f9('0x3b')]);_0x4f16ae[_0x64f9('0x3c')]=qs['filters'](_[_0x64f9('0x3d')](_0x3dc350[_0x64f9('0x31')],_0x57ab35[_0x64f9('0x33')]),_0x9e0bed);if(_0x3dc350['query']['filter']){_0x4f16ae[_0x64f9('0x3c')]=_[_0x64f9('0x3e')](_0x4f16ae[_0x64f9('0x3c')],{'$or':_[_0x64f9('0x2b')](_0x9e0bed,function(_0x5b9bf0){if(_0x5b9bf0[_0x64f9('0x2e')]!==_0x64f9('0x3f')){var _0xd4beb5={};_0xd4beb5[_0x5b9bf0[_0x64f9('0x29')]]={'$like':'%'+_0x3dc350[_0x64f9('0x31')][_0x64f9('0x40')]+'%'};return _0xd4beb5;}})});}_0x4f16ae=_[_0x64f9('0x3e')]({},_0x4f16ae,_0x3dc350['options']);var _0x20de4b={'where':_0x4f16ae['where']};return db[_0x64f9('0x41')]['count'](_0x20de4b)[_0x64f9('0x24')](function(_0x3a20d8){_0x4ffee7['count']=_0x3a20d8;if(_0x3dc350[_0x64f9('0x31')]['includeAll']){_0x4f16ae[_0x64f9('0x42')]=[{'all':!![]}];}return db[_0x64f9('0x41')][_0x64f9('0x43')](_0x4f16ae);})['then'](function(_0x51838b){_0x4ffee7[_0x64f9('0x44')]=_0x51838b;return _0x4ffee7;})[_0x64f9('0x24')](respondWithFilteredResult(_0x276714,_0x4f16ae))['catch'](handleError(_0x276714,null));};exports[_0x64f9('0x45')]=function(_0x30fcd9,_0xbdcc87){var _0x1f724a={'raw':!![],'where':{'id':_0x30fcd9[_0x64f9('0x46')]['id']}},_0x8e3d17={};_0x8e3d17['model']=_['keys'](db[_0x64f9('0x41')][_0x64f9('0x2c')]);_0x8e3d17[_0x64f9('0x31')]=_[_0x64f9('0x32')](_0x30fcd9[_0x64f9('0x31')]);_0x8e3d17[_0x64f9('0x33')]=_[_0x64f9('0x34')](_0x8e3d17[_0x64f9('0x30')],_0x8e3d17['query']);_0x1f724a[_0x64f9('0x35')]=_[_0x64f9('0x34')](_0x8e3d17[_0x64f9('0x30')],qs[_0x64f9('0x36')](_0x30fcd9[_0x64f9('0x31')][_0x64f9('0x36')]));_0x1f724a[_0x64f9('0x35')]=_0x1f724a[_0x64f9('0x35')][_0x64f9('0x37')]?_0x1f724a[_0x64f9('0x35')]:_0x8e3d17[_0x64f9('0x30')];if(_0x30fcd9[_0x64f9('0x31')][_0x64f9('0x47')]){_0x1f724a[_0x64f9('0x42')]=[{'all':!![]}];}_0x1f724a=_[_0x64f9('0x3e')]({},_0x1f724a,_0x30fcd9[_0x64f9('0x48')]);return db['Disposition'][_0x64f9('0x49')](_0x1f724a)[_0x64f9('0x24')](handleEntityNotFound(_0xbdcc87,null))[_0x64f9('0x24')](respondWithResult(_0xbdcc87,null))[_0x64f9('0x4a')](handleError(_0xbdcc87,null));};exports['create']=function(_0x5d6b04,_0x3299dd){return db[_0x64f9('0x41')][_0x64f9('0x4b')](_0x5d6b04[_0x64f9('0x4c')],{})[_0x64f9('0x24')](function(_0x3ce265){var _0x3fb745=_0x5d6b04[_0x64f9('0x4d')][_0x64f9('0x25')]({'plain':!![]});if(!_0x3fb745)throw new Error(_0x64f9('0x4e'));if(_0x3fb745[_0x64f9('0x4f')]===_0x64f9('0x4d')){var _0x7bbd1d=_0x3ce265[_0x64f9('0x25')]({'plain':!![]});var _0x5adf8c=_0x64f9('0x26');return db[_0x64f9('0x50')][_0x64f9('0x49')]({'where':{'name':_0x5adf8c,'userProfileId':_0x3fb745['userProfileId']},'raw':!![]})['then'](function(_0x2e537b){if(_0x2e537b&&_0x2e537b['autoAssociation']===0x0){return db[_0x64f9('0x27')][_0x64f9('0x4b')]({'name':_0x7bbd1d[_0x64f9('0x29')],'resourceId':_0x7bbd1d['id'],'type':_0x2e537b['name'],'sectionId':_0x2e537b['id']},{})[_0x64f9('0x24')](function(){return _0x3ce265;});}else{return _0x3ce265;}})[_0x64f9('0x4a')](function(_0x3ca96d){logger[_0x64f9('0x28')](_0x64f9('0x51'),_0x3ca96d);throw _0x3ca96d;});}return _0x3ce265;})[_0x64f9('0x24')](respondWithResult(_0x3299dd,0xc9))['catch'](handleError(_0x3299dd,null));};exports[_0x64f9('0x23')]=function(_0x31656c,_0xf4b8c7){if(_0x31656c[_0x64f9('0x4c')]['id']){delete _0x31656c[_0x64f9('0x4c')]['id'];}return db[_0x64f9('0x41')]['find']({'where':{'id':_0x31656c['params']['id']}})[_0x64f9('0x24')](handleEntityNotFound(_0xf4b8c7,null))[_0x64f9('0x24')](saveUpdates(_0x31656c[_0x64f9('0x4c')],null))[_0x64f9('0x24')](respondWithResult(_0xf4b8c7,null))['catch'](handleError(_0xf4b8c7,null));};exports[_0x64f9('0x52')]=function(_0x21b869,_0x151562){return db[_0x64f9('0x41')][_0x64f9('0x49')]({'where':{'id':_0x21b869[_0x64f9('0x46')]['id']}})[_0x64f9('0x24')](handleEntityNotFound(_0x151562,null))[_0x64f9('0x24')](removeEntity(_0x151562,null))[_0x64f9('0x4a')](handleError(_0x151562,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index a550fa7..6186bc4 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 _0xe888=['FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','name_sms','SmsAccountId'];(function(_0x4ec5bc,_0x18d11c){var _0x3d0bb6=function(_0x41004e){while(--_0x41004e){_0x4ec5bc['push'](_0x4ec5bc['shift']());}};_0x3d0bb6(++_0x18d11c);}(_0xe888,0x1a6));var _0x8e88=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0xe888[_0x57486e];return _0x5f110b;};'use strict';var _=require(_0x8e88('0x0'));var util=require(_0x8e88('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8e88('0x2'));var BPromise=require(_0x8e88('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e88('0x4'));var rimraf=require(_0x8e88('0x5'));var config=require(_0x8e88('0x6'));var attributes=require(_0x8e88('0x7'));module[_0x8e88('0x8')]=function(_0x1788f9,_0x2642eb){return _0x1788f9[_0x8e88('0x9')](_0x8e88('0xa'),attributes,{'tableName':_0x8e88('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x8e88('0xc'),_0x8e88('0xd')]},{'unique':!![],'name':_0x8e88('0xe'),'fields':[_0x8e88('0xc'),_0x8e88('0xf')]},{'unique':!![],'name':'name_mail','fields':['name','MailAccountId']},{'unique':!![],'name':_0x8e88('0x10'),'fields':['name',_0x8e88('0x11')]},{'unique':!![],'name':'name_fax','fields':['name',_0x8e88('0x12')]},{'unique':!![],'name':_0x8e88('0x13'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':_0x8e88('0x14'),'fields':['name',_0x8e88('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9e63=['ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','WhatsappAccountId','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat'];(function(_0x33446f,_0x3f9d63){var _0x344eac=function(_0x53b1a4){while(--_0x53b1a4){_0x33446f['push'](_0x33446f['shift']());}};_0x344eac(++_0x3f9d63);}(_0x9e63,0xaf));var _0x39e6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9e63[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x39e6('0x0'));var util=require(_0x39e6('0x1'));var logger=require('../../config/logger')(_0x39e6('0x2'));var moment=require(_0x39e6('0x3'));var BPromise=require('bluebird');var rp=require(_0x39e6('0x4'));var fs=require('fs');var path=require(_0x39e6('0x5'));var rimraf=require(_0x39e6('0x6'));var config=require(_0x39e6('0x7'));var attributes=require(_0x39e6('0x8'));module[_0x39e6('0x9')]=function(_0x1ca664,_0x29b835){return _0x1ca664[_0x39e6('0xa')](_0x39e6('0xb'),attributes,{'tableName':_0x39e6('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x39e6('0xd'),'fields':[_0x39e6('0xe'),_0x39e6('0xf')]},{'unique':!![],'name':_0x39e6('0x10'),'fields':[_0x39e6('0xe'),_0x39e6('0x11')]},{'unique':!![],'name':'name_mail','fields':[_0x39e6('0xe'),_0x39e6('0x12')]},{'unique':!![],'name':_0x39e6('0x13'),'fields':[_0x39e6('0xe'),_0x39e6('0x14')]},{'unique':!![],'name':_0x39e6('0x15'),'fields':[_0x39e6('0xe'),'FaxAccountId']},{'unique':!![],'name':_0x39e6('0x16'),'fields':[_0x39e6('0xe'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0x39e6('0xe'),_0x39e6('0x17')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 02ebe3d..b5c4941 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(_0x3d7c76,_0x1181a2){var _0x32d9b9=function(_0x1965ed){while(--_0x1965ed){_0x3d7c76['push'](_0x3d7c76['shift']());}};_0x32d9b9(++_0x1181a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','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(_0xf55248,_0x40d1ab){var _0x92a83b=function(_0x518eab){while(--_0x518eab){_0xf55248['push'](_0xf55248['shift']());}};_0x92a83b(++_0x40d1ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 575236c..38bfd5b 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 _0x2d74=['get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller'];(function(_0x2f0230,_0x4d0d5d){var _0x163ed9=function(_0x58232e){while(--_0x58232e){_0x2f0230['push'](_0x2f0230['shift']());}};_0x163ed9(++_0x4d0d5d);}(_0x2d74,0x19a));var _0x42d7=function(_0x1f9027,_0x3cdc76){_0x1f9027=_0x1f9027-0x0;var _0x22fb98=_0x2d74[_0x1f9027];return _0x22fb98;};'use strict';var multer=require('multer');var util=require(_0x42d7('0x0'));var path=require(_0x42d7('0x1'));var timeout=require(_0x42d7('0x2'));var express=require(_0x42d7('0x3'));var router=express[_0x42d7('0x4')]();var fs_extra=require(_0x42d7('0x5'));var auth=require(_0x42d7('0x6'));var interaction=require(_0x42d7('0x7'));var config=require(_0x42d7('0x8'));var controller=require(_0x42d7('0x9'));router[_0x42d7('0xa')]('/',auth[_0x42d7('0xb')](),controller[_0x42d7('0xc')]);router['get'](_0x42d7('0xd'),auth[_0x42d7('0xb')](),controller[_0x42d7('0xe')]);router[_0x42d7('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x42d7('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x42d7('0x11')]);router[_0x42d7('0x12')](_0x42d7('0xd'),auth[_0x42d7('0xb')](),controller[_0x42d7('0x13')]);module['exports']=router; \ No newline at end of file +var _0xbbc8=['get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x553997,_0x46f7ac){var _0x425cad=function(_0x3abfe1){while(--_0x3abfe1){_0x553997['push'](_0x553997['shift']());}};_0x425cad(++_0x46f7ac);}(_0xbbc8,0x106));var _0x8bbc=function(_0x5d6d7d,_0x1f1ed8){_0x5d6d7d=_0x5d6d7d-0x0;var _0x2ad1a7=_0xbbc8[_0x5d6d7d];return _0x2ad1a7;};'use strict';var multer=require('multer');var util=require(_0x8bbc('0x0'));var path=require(_0x8bbc('0x1'));var timeout=require(_0x8bbc('0x2'));var express=require('express');var router=express[_0x8bbc('0x3')]();var fs_extra=require(_0x8bbc('0x4'));var auth=require(_0x8bbc('0x5'));var interaction=require(_0x8bbc('0x6'));var config=require(_0x8bbc('0x7'));var controller=require('./disposition.controller');router[_0x8bbc('0x8')]('/',auth[_0x8bbc('0x9')](),controller['index']);router['get'](_0x8bbc('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x8bbc('0xb')]('/',auth[_0x8bbc('0x9')](),controller[_0x8bbc('0xc')]);router[_0x8bbc('0xd')](_0x8bbc('0xa'),auth['isAuthenticated'](),controller[_0x8bbc('0xe')]);router[_0x8bbc('0xf')](_0x8bbc('0xa'),auth[_0x8bbc('0x9')](),controller[_0x8bbc('0x10')]);module[_0x8bbc('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 7f34153..bbfce92 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 _0x326f=['4800','INTEGER','SIP','IAX','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','7200','9600','12000','14400'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x326f,0xd1));var _0xf326=function(_0x186390,_0x1feded){_0x186390=_0x186390-0x0;var _0x1ac235=_0x326f[_0x186390];return _0x1ac235;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf326('0x1')]},'ecm':{'type':Sequelize[_0xf326('0x2')](_0xf326('0x3'),'no'),'defaultValue':_0xf326('0x3')},'headerinfo':{'type':Sequelize[_0xf326('0x1')],'defaultValue':_0xf326('0x4')},'localstationid':{'type':Sequelize[_0xf326('0x1')],'unique':_0xf326('0x5')},'minrate':{'type':Sequelize[_0xf326('0x2')](_0xf326('0x6'),'4800',_0xf326('0x7'),_0xf326('0x8'),_0xf326('0x9'),_0xf326('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM']('2400',_0xf326('0xb'),_0xf326('0x7'),_0xf326('0x8'),_0xf326('0x9'),_0xf326('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xf326('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xf326('0x1')],'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[_0xf326('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xf326('0xd'),_0xf326('0xe'),'DADHI',_0xf326('0xf')),'defaultValue':_0xf326('0xd')},'key':{'type':Sequelize[_0xf326('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf326('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xf326('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xf326('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf326('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf326('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf326('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf326('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf326('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xf326('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xf326('0x11')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3ad7da){if(!_0x3ad7da)this[_0xf326('0x13')](_0xf326('0x14'),null);this[_0xf326('0x13')](_0xf326('0x15'),_0x3ad7da);}}}; \ No newline at end of file +var _0x1dcc=['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','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','12000','14400','ENUM','9600','v17,v27,v29','INTEGER'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x4b3ea4,_0x1e46f2){_0x4b3ea4=_0x4b3ea4-0x0;var _0x3dae3d=_0x1dcc[_0x4b3ea4];return _0x3dae3d;};'use strict';var Sequelize=require(_0xc1dc('0x0'));module[_0xc1dc('0x1')]={'name':{'type':Sequelize[_0xc1dc('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc1dc('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0xc1dc('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xc1dc('0x2')],'defaultValue':_0xc1dc('0x4')},'localstationid':{'type':Sequelize[_0xc1dc('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0xc1dc('0x5'),_0xc1dc('0x6'),_0xc1dc('0x7'),'9600',_0xc1dc('0x8'),_0xc1dc('0x9')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xc1dc('0xa')]('2400',_0xc1dc('0x6'),'7200',_0xc1dc('0xb'),_0xc1dc('0x8'),_0xc1dc('0x9')),'defaultValue':_0xc1dc('0x9')},'modem':{'type':Sequelize[_0xc1dc('0x2')],'defaultValue':_0xc1dc('0xc')},'gateway':{'type':Sequelize[_0xc1dc('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xc1dc('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xc1dc('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xc1dc('0xe'),_0xc1dc('0xf'),_0xc1dc('0x10'),'KHOMP'),'defaultValue':_0xc1dc('0xe')},'key':{'type':Sequelize[_0xc1dc('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc1dc('0x11')],'defaultValue':function(){return _0xc1dc('0x12');}},'notificationSound':{'type':Sequelize[_0xc1dc('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc1dc('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc1dc('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc1dc('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc1dc('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc1dc('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc1dc('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc1dc('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xc1dc('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xc1dc('0x13')],'defaultValue':![],'comment':_0xc1dc('0x15'),'set':function(_0x47c72e){if(!_0x47c72e)this[_0xc1dc('0x16')](_0xc1dc('0x17'),null);this['setDataValue']('mandatoryDisposition',_0x47c72e);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 7837558..0b31f23 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 _0x3b33=['rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','VIRTUAL','merge','includeAll','include','rows','params','mandatoryDispositionPause','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','count','findAll','ids','addAnswer','CannedAnswer','pick','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','color','tag','sequelize','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','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','addAccountApplications','transaction','VoiceExtension','tech','createdAt','updatedAt','TrunkId','findById','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','CmContact','Contacts','attachments','join','root','basename','CheckAfterSend','isNil','path','from','format','\x22%s\x22\x20<%s>','fax','defaults','ListId','List\x20not\x20found','Send\x20Fax\x20failed','filename','Contact\x20not\x20found','spread','out','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./faxAccount.socket','register','client','http','then','request\x20sent','debug','error','FaxAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','get','FaxAccounts','UserProfileResource','destroy','name','send','Pause','FaxAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b33,0x87));var _0x33b3=function(_0x14e708,_0x46ae6d){_0x14e708=_0x14e708-0x0;var _0x41dd5e=_0x3b33[_0x14e708];return _0x41dd5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x33b3('0x0'));var zipdir=require(_0x33b3('0x1'));var jsonpatch=require(_0x33b3('0x2'));var rp=require('request-promise');var moment=require(_0x33b3('0x3'));var BPromise=require(_0x33b3('0x4'));var Mustache=require('mustache');var util=require(_0x33b3('0x5'));var path=require('path');var sox=require(_0x33b3('0x6'));var csv=require('to-csv');var ejs=require(_0x33b3('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x33b3('0x8'));var crypto=require(_0x33b3('0x9'));var jsforce=require(_0x33b3('0xa'));var deskjs=require(_0x33b3('0xb'));var toCsv=require(_0x33b3('0xc'));var querystring=require(_0x33b3('0xd'));var Papa=require('papaparse');var Redis=require(_0x33b3('0xe'));var authService=require(_0x33b3('0xf'));var qs=require(_0x33b3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x33b3('0x11'));var logger=require(_0x33b3('0x12'))(_0x33b3('0x13'));var utils=require(_0x33b3('0x14'));var config=require(_0x33b3('0x15'));var licenseUtil=require(_0x33b3('0x16'));var db=require('../../mysqldb')['db'];config[_0x33b3('0x17')]=_['defaults'](config['redis'],{'host':_0x33b3('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x33b3('0x17')]));require(_0x33b3('0x19'))[_0x33b3('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x33b3('0x1b')][_0x33b3('0x1c')]({'port':0x232c});var client9002=jayson[_0x33b3('0x1b')][_0x33b3('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4742c2,_0x26bd92,_0x27d8d3,_0x4ef52b){return new BPromise(function(_0x2fd218,_0x1d3d4c){var _0x46f1bc=_0x4ef52b||client;return _0x46f1bc['request'](_0x4742c2,_0x27d8d3)[_0x33b3('0x1d')](function(_0x575d06){logger['info']('FaxAccount,\x20%s,\x20%s',_0x26bd92,_0x33b3('0x1e'));logger[_0x33b3('0x1f')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x26bd92,_0x33b3('0x1e'),JSON['stringify'](_0x575d06));if(_0x575d06[_0x33b3('0x20')]){if(_0x575d06[_0x33b3('0x20')]['code']===0x1f4){logger[_0x33b3('0x20')](_0x33b3('0x21'),_0x26bd92,_0x575d06[_0x33b3('0x20')][_0x33b3('0x22')]);return _0x1d3d4c(_0x575d06[_0x33b3('0x20')][_0x33b3('0x22')]);}logger[_0x33b3('0x20')](_0x33b3('0x21'),_0x26bd92,_0x575d06[_0x33b3('0x20')][_0x33b3('0x22')]);return _0x2fd218(_0x575d06[_0x33b3('0x20')][_0x33b3('0x22')]);}else{logger[_0x33b3('0x23')](_0x33b3('0x21'),_0x26bd92,'request\x20sent');_0x2fd218(_0x575d06[_0x33b3('0x24')][_0x33b3('0x22')]);}})[_0x33b3('0x25')](function(_0x377f24){logger['error']('FaxAccount,\x20%s,\x20%s',_0x26bd92,_0x377f24);_0x1d3d4c(_0x377f24);});});}function respondWithStatusCode(_0x15732c,_0x415c9e){_0x415c9e=_0x415c9e||0xcc;return function(_0x4038e6){if(_0x4038e6){return _0x15732c[_0x33b3('0x26')](_0x415c9e);}return _0x15732c['status'](_0x415c9e)[_0x33b3('0x27')]();};}function respondWithResult(_0x4b9f44,_0x3ec618){_0x3ec618=_0x3ec618||0xc8;return function(_0x3a1e4a){if(_0x3a1e4a){return _0x4b9f44[_0x33b3('0x28')](_0x3ec618)[_0x33b3('0x29')](_0x3a1e4a);}};}function respondWithFilteredResult(_0x478b79,_0xd94e86){return function(_0x4fe486){if(_0x4fe486){var _0x52b80b=typeof _0xd94e86[_0x33b3('0x2a')]==='undefined'&&typeof _0xd94e86['limit']===_0x33b3('0x2b');var _0x136806=_0x4fe486['count'];var _0x3cf6f0=_0x52b80b?0x0:_0xd94e86[_0x33b3('0x2a')];var _0x5651fd=_0x52b80b?_0x4fe486['count']:_0xd94e86['offset']+_0xd94e86[_0x33b3('0x2c')];var _0x4746b9;if(_0x5651fd>=_0x136806){_0x5651fd=_0x136806;_0x4746b9=0xc8;}else{_0x4746b9=0xce;}_0x478b79['status'](_0x4746b9);return _0x478b79[_0x33b3('0x2d')](_0x33b3('0x2e'),_0x3cf6f0+'-'+_0x5651fd+'/'+_0x136806)[_0x33b3('0x29')](_0x4fe486);}return null;};}function patchUpdates(_0x18e7d3){return function(_0x1bf049){try{jsonpatch[_0x33b3('0x2f')](_0x1bf049,_0x18e7d3,!![]);}catch(_0x1c7dbe){return BPromise['reject'](_0x1c7dbe);}return _0x1bf049[_0x33b3('0x30')]();};}function saveUpdates(_0x4ada36,_0x255f3c){return function(_0x4c1df0){if(_0x4c1df0){return _0x4c1df0[_0x33b3('0x31')](_0x4ada36)['then'](function(_0x5ec109){return _0x5ec109;});}return null;};}function removeEntity(_0x603887,_0x3aab75){return function(_0x2496cb){if(_0x2496cb){return _0x2496cb['destroy']()[_0x33b3('0x1d')](function(){var _0x538b63=_0x2496cb[_0x33b3('0x32')]({'plain':!![]});var _0x4d2d84=_0x33b3('0x33');return db[_0x33b3('0x34')][_0x33b3('0x35')]({'where':{'type':_0x4d2d84,'resourceId':_0x538b63['id']}})[_0x33b3('0x1d')](function(){return _0x2496cb;});})[_0x33b3('0x1d')](function(){_0x603887['status'](0xcc)[_0x33b3('0x27')]();});}};}function handleEntityNotFound(_0x117bbb,_0x588abb){return function(_0xd284e9){if(!_0xd284e9){_0x117bbb[_0x33b3('0x26')](0x194);}return _0xd284e9;};}function handleError(_0x197aba,_0x44b6b9){_0x44b6b9=_0x44b6b9||0x1f4;return function(_0x109a08){logger[_0x33b3('0x20')](_0x109a08['stack']);if(_0x109a08[_0x33b3('0x36')]){delete _0x109a08[_0x33b3('0x36')];}_0x197aba[_0x33b3('0x28')](_0x44b6b9)[_0x33b3('0x37')](_0x109a08);};}exports['index']=function(_0x1ef6ff,_0x59310e){var _0xdd6f08={'include':[{'model':db[_0x33b3('0x38')],'as':'mandatoryDispositionPause'}]},_0x294853={},_0x784c65={'count':0x0,'rows':[]};var _0x3d0de4=_['map'](db[_0x33b3('0x39')][_0x33b3('0x3a')],function(_0x42dad3){return{'name':_0x42dad3[_0x33b3('0x3b')],'type':_0x42dad3['type'][_0x33b3('0x3c')]};});_0x294853[_0x33b3('0x3d')]=_[_0x33b3('0x3e')](_0x3d0de4,_0x33b3('0x36'));_0x294853[_0x33b3('0x3f')]=_[_0x33b3('0x40')](_0x1ef6ff[_0x33b3('0x3f')]);_0x294853['filters']=_['intersection'](_0x294853['model'],_0x294853[_0x33b3('0x3f')]);_0xdd6f08['attributes']=_[_0x33b3('0x41')](_0x294853[_0x33b3('0x3d')],qs[_0x33b3('0x42')](_0x1ef6ff[_0x33b3('0x3f')][_0x33b3('0x42')]));_0xdd6f08[_0x33b3('0x43')]=_0xdd6f08[_0x33b3('0x43')]['length']?_0xdd6f08[_0x33b3('0x43')]:_0x294853[_0x33b3('0x3d')];if(!_0x1ef6ff[_0x33b3('0x3f')][_0x33b3('0x44')](_0x33b3('0x45'))){_0xdd6f08[_0x33b3('0x2c')]=qs[_0x33b3('0x2c')](_0x1ef6ff[_0x33b3('0x3f')][_0x33b3('0x2c')]);_0xdd6f08[_0x33b3('0x2a')]=qs[_0x33b3('0x2a')](_0x1ef6ff[_0x33b3('0x3f')][_0x33b3('0x2a')]);}_0xdd6f08[_0x33b3('0x46')]=qs[_0x33b3('0x47')](_0x1ef6ff['query']['sort']);_0xdd6f08[_0x33b3('0x48')]=qs[_0x33b3('0x49')](_['pick'](_0x1ef6ff['query'],_0x294853[_0x33b3('0x49')]),_0x3d0de4);if(_0x1ef6ff[_0x33b3('0x3f')][_0x33b3('0x4a')]){_0xdd6f08[_0x33b3('0x48')]=_['merge'](_0xdd6f08['where'],{'$or':_[_0x33b3('0x3e')](_0x3d0de4,function(_0x16607a){if(_0x16607a[_0x33b3('0x4b')]!==_0x33b3('0x4c')){var _0x3e5e1f={};_0x3e5e1f[_0x16607a[_0x33b3('0x36')]]={'$like':'%'+_0x1ef6ff[_0x33b3('0x3f')][_0x33b3('0x4a')]+'%'};return _0x3e5e1f;}})});}_0xdd6f08=_[_0x33b3('0x4d')]({},_0xdd6f08,_0x1ef6ff['options']);var _0xc19f3a={'where':_0xdd6f08[_0x33b3('0x48')]};return db['FaxAccount']['count'](_0xc19f3a)[_0x33b3('0x1d')](function(_0x2bbd6a){_0x784c65['count']=_0x2bbd6a;if(_0x1ef6ff['query'][_0x33b3('0x4e')]){_0xdd6f08[_0x33b3('0x4f')]=[{'all':!![]}];}return db[_0x33b3('0x39')]['findAll'](_0xdd6f08);})[_0x33b3('0x1d')](function(_0x38dc7f){_0x784c65[_0x33b3('0x50')]=_0x38dc7f;return _0x784c65;})[_0x33b3('0x1d')](respondWithFilteredResult(_0x59310e,_0xdd6f08))[_0x33b3('0x25')](handleError(_0x59310e,null));};exports['show']=function(_0x4e4b06,_0x5089c4){var _0x204b6a={'raw':![],'where':{'id':_0x4e4b06[_0x33b3('0x51')]['id']},'include':[{'model':db['Pause'],'as':_0x33b3('0x52')}]},_0x454905={};_0x454905[_0x33b3('0x3d')]=_['keys'](db[_0x33b3('0x39')][_0x33b3('0x3a')]);_0x454905['query']=_['keys'](_0x4e4b06[_0x33b3('0x3f')]);_0x454905[_0x33b3('0x49')]=_[_0x33b3('0x41')](_0x454905[_0x33b3('0x3d')],_0x454905[_0x33b3('0x3f')]);_0x204b6a['attributes']=_[_0x33b3('0x41')](_0x454905[_0x33b3('0x3d')],qs['fields'](_0x4e4b06['query'][_0x33b3('0x42')]));_0x204b6a['attributes']=_0x204b6a['attributes'][_0x33b3('0x53')]?_0x204b6a[_0x33b3('0x43')]:_0x454905['model'];if(_0x4e4b06[_0x33b3('0x3f')][_0x33b3('0x4e')]){_0x204b6a[_0x33b3('0x4f')]=[{'all':!![]}];}_0x204b6a=_['merge']({},_0x204b6a,_0x4e4b06[_0x33b3('0x54')]);return db[_0x33b3('0x39')][_0x33b3('0x55')](_0x204b6a)['then'](handleEntityNotFound(_0x5089c4,null))[_0x33b3('0x1d')](respondWithResult(_0x5089c4,null))[_0x33b3('0x25')](handleError(_0x5089c4,null));};exports[_0x33b3('0x56')]=function(_0x5ce6fb,_0x483d80){return db[_0x33b3('0x39')]['create'](_0x5ce6fb[_0x33b3('0x57')],{})[_0x33b3('0x1d')](function(_0x1af798){var _0x19a1c7=_0x5ce6fb[_0x33b3('0x58')][_0x33b3('0x32')]({'plain':!![]});if(!_0x19a1c7)throw new Error(_0x33b3('0x59'));if(_0x19a1c7[_0x33b3('0x5a')]===_0x33b3('0x58')){var _0x3acebb=_0x1af798['get']({'plain':!![]});var _0x441013=_0x33b3('0x33');return db['UserProfileSection'][_0x33b3('0x55')]({'where':{'name':_0x441013,'userProfileId':_0x19a1c7[_0x33b3('0x5b')]},'raw':!![]})['then'](function(_0x36a976){if(_0x36a976&&_0x36a976['autoAssociation']===0x0){return db[_0x33b3('0x34')]['create']({'name':_0x3acebb[_0x33b3('0x36')],'resourceId':_0x3acebb['id'],'type':_0x36a976[_0x33b3('0x36')],'sectionId':_0x36a976['id']},{})[_0x33b3('0x1d')](function(){return _0x1af798;});}else{return _0x1af798;}})['catch'](function(_0x163bc3){logger[_0x33b3('0x20')](_0x33b3('0x5c'),_0x163bc3);throw _0x163bc3;});}return _0x1af798;})[_0x33b3('0x1d')](respondWithResult(_0x483d80,0xc9))[_0x33b3('0x25')](handleError(_0x483d80,null));};exports[_0x33b3('0x31')]=function(_0x34015e,_0x3752d0){if(_0x34015e[_0x33b3('0x57')]['id']){delete _0x34015e[_0x33b3('0x57')]['id'];}return db['FaxAccount'][_0x33b3('0x55')]({'where':{'id':_0x34015e['params']['id']},'include':[{'model':db[_0x33b3('0x38')],'as':_0x33b3('0x52')}]})[_0x33b3('0x1d')](handleEntityNotFound(_0x3752d0,null))[_0x33b3('0x1d')](saveUpdates(_0x34015e['body'],null))['then'](respondWithResult(_0x3752d0,null))[_0x33b3('0x25')](handleError(_0x3752d0,null));};exports['destroy']=function(_0x30880d,_0x50a2b1){return db['FaxAccount'][_0x33b3('0x55')]({'where':{'id':_0x30880d['params']['id']}})[_0x33b3('0x1d')](handleEntityNotFound(_0x50a2b1,null))['then'](removeEntity(_0x50a2b1,null))[_0x33b3('0x25')](handleError(_0x50a2b1,null));};exports[_0x33b3('0x5d')]=function(_0x1d256d,_0x30099c){return db[_0x33b3('0x39')][_0x33b3('0x5d')]()['then'](respondWithResult(_0x30099c,null))[_0x33b3('0x25')](handleError(_0x30099c,null));};exports[_0x33b3('0x5e')]=function(_0x4e0b16,_0x414c05,_0x222525){if(_0x4e0b16['body']['id']){delete _0x4e0b16[_0x33b3('0x57')]['id'];}return db[_0x33b3('0x39')][_0x33b3('0x55')]({'where':{'id':_0x4e0b16[_0x33b3('0x51')]['id']}})[_0x33b3('0x1d')](handleEntityNotFound(_0x414c05,null))[_0x33b3('0x1d')](function(_0x19774a){if(_0x19774a){_0x4e0b16[_0x33b3('0x57')][_0x33b3('0x5f')]=_0x19774a['id'];return db[_0x33b3('0x60')][_0x33b3('0x56')](_0x4e0b16[_0x33b3('0x57')]);}})[_0x33b3('0x1d')](respondWithResult(_0x414c05,null))['catch'](handleError(_0x414c05,null));};exports[_0x33b3('0x61')]=function(_0x4832a9,_0x14face,_0x240696){var _0x4dd5e3={'raw':![],'where':{}};var _0x28bc39={};var _0x426324={'count':0x0,'rows':[]};return db[_0x33b3('0x39')][_0x33b3('0x62')]({'where':{'id':_0x4832a9[_0x33b3('0x51')]['id']}})['then'](handleEntityNotFound(_0x14face,null))[_0x33b3('0x1d')](function(_0x5b6264){if(_0x5b6264){_0x28bc39[_0x33b3('0x3d')]=_[_0x33b3('0x40')](db[_0x33b3('0x60')][_0x33b3('0x3a')]);_0x28bc39['query']=_[_0x33b3('0x40')](_0x4832a9[_0x33b3('0x3f')]);_0x28bc39[_0x33b3('0x49')]=_['intersection'](_0x28bc39[_0x33b3('0x3d')],_0x28bc39[_0x33b3('0x3f')]);_0x4dd5e3['attributes']=_['intersection'](_0x28bc39[_0x33b3('0x3d')],qs[_0x33b3('0x42')](_0x4832a9['query'][_0x33b3('0x42')]));_0x4dd5e3[_0x33b3('0x43')]=_0x4dd5e3['attributes'][_0x33b3('0x53')]?_0x4dd5e3[_0x33b3('0x43')]:_0x28bc39[_0x33b3('0x3d')];if(!_0x4832a9[_0x33b3('0x3f')][_0x33b3('0x44')](_0x33b3('0x45'))){_0x4dd5e3[_0x33b3('0x2c')]=qs['limit'](_0x4832a9[_0x33b3('0x3f')][_0x33b3('0x2c')]);_0x4dd5e3[_0x33b3('0x2a')]=qs[_0x33b3('0x2a')](_0x4832a9['query']['offset']);}_0x4dd5e3[_0x33b3('0x46')]=qs[_0x33b3('0x47')](_0x4832a9[_0x33b3('0x3f')][_0x33b3('0x47')]);_0x4dd5e3[_0x33b3('0x48')]=qs[_0x33b3('0x49')](_['pick'](_0x4832a9[_0x33b3('0x3f')],_0x28bc39['filters']));_0x4dd5e3[_0x33b3('0x48')][_0x33b3('0x5f')]=_0x5b6264['id'];if(_0x4832a9[_0x33b3('0x3f')][_0x33b3('0x4a')]){_0x4dd5e3['where']=_[_0x33b3('0x4d')](_0x4dd5e3[_0x33b3('0x48')],{'$or':_[_0x33b3('0x3e')](_0x4dd5e3[_0x33b3('0x43')],function(_0x38697d){var _0x9b3bd3={};_0x9b3bd3[_0x38697d]={'$like':'%'+_0x4832a9['query'][_0x33b3('0x4a')]+'%'};return _0x9b3bd3;})});}_0x4dd5e3=_[_0x33b3('0x4d')]({},_0x4dd5e3,_0x4832a9[_0x33b3('0x54')]);return db[_0x33b3('0x60')][_0x33b3('0x63')]({'where':_0x4dd5e3['where']})['then'](function(_0x191fcf){_0x426324[_0x33b3('0x63')]=_0x191fcf;if(_0x4832a9[_0x33b3('0x3f')][_0x33b3('0x4e')]){_0x4dd5e3['include']=[{'all':!![]}];}return db[_0x33b3('0x60')][_0x33b3('0x64')](_0x4dd5e3);})[_0x33b3('0x1d')](function(_0x5a24c3){_0x426324['rows']=_0x5a24c3;return _0x426324;});}})[_0x33b3('0x1d')](respondWithFilteredResult(_0x14face,_0x4dd5e3))['catch'](handleError(_0x14face,null));};exports['removeDispositions']=function(_0xa83905,_0x4c41d3,_0x14aeb4){return db[_0x33b3('0x39')]['find']({'where':{'id':_0xa83905[_0x33b3('0x51')]['id']}})[_0x33b3('0x1d')](handleEntityNotFound(_0x4c41d3,null))[_0x33b3('0x1d')](function(_0x2ad2cc){if(_0x2ad2cc){return _0x2ad2cc['removeDispositions'](_0xa83905['query'][_0x33b3('0x65')]);}})[_0x33b3('0x1d')](respondWithStatusCode(_0x4c41d3,null))['catch'](handleError(_0x4c41d3,null));};exports[_0x33b3('0x66')]=function(_0x227ff3,_0x5b7700,_0x473311){if(_0x227ff3['body']['id']){delete _0x227ff3[_0x33b3('0x57')]['id'];}return db['FaxAccount'][_0x33b3('0x55')]({'where':{'id':_0x227ff3[_0x33b3('0x51')]['id']}})['then'](handleEntityNotFound(_0x5b7700,null))['then'](function(_0x302e11){if(_0x302e11){_0x227ff3[_0x33b3('0x57')]['FaxAccountId']=_0x302e11['id'];return db['CannedAnswer'][_0x33b3('0x56')](_0x227ff3[_0x33b3('0x57')]);}})[_0x33b3('0x1d')](respondWithResult(_0x5b7700,null))[_0x33b3('0x25')](handleError(_0x5b7700,null));};exports['getAnswers']=function(_0x209d8f,_0x58cf6b,_0x452af7){var _0x2b8217={'raw':![],'where':{}};var _0x3a5182={};var _0xdc977d={'count':0x0,'rows':[]};return db['FaxAccount'][_0x33b3('0x62')]({'where':{'id':_0x209d8f[_0x33b3('0x51')]['id']}})[_0x33b3('0x1d')](handleEntityNotFound(_0x58cf6b,null))[_0x33b3('0x1d')](function(_0x399cfc){if(_0x399cfc){_0x3a5182[_0x33b3('0x3d')]=_[_0x33b3('0x40')](db[_0x33b3('0x67')][_0x33b3('0x3a')]);_0x3a5182[_0x33b3('0x3f')]=_[_0x33b3('0x40')](_0x209d8f[_0x33b3('0x3f')]);_0x3a5182[_0x33b3('0x49')]=_[_0x33b3('0x41')](_0x3a5182[_0x33b3('0x3d')],_0x3a5182[_0x33b3('0x3f')]);_0x2b8217[_0x33b3('0x43')]=_[_0x33b3('0x41')](_0x3a5182['model'],qs['fields'](_0x209d8f[_0x33b3('0x3f')]['fields']));_0x2b8217[_0x33b3('0x43')]=_0x2b8217[_0x33b3('0x43')][_0x33b3('0x53')]?_0x2b8217[_0x33b3('0x43')]:_0x3a5182[_0x33b3('0x3d')];if(!_0x209d8f[_0x33b3('0x3f')][_0x33b3('0x44')](_0x33b3('0x45'))){_0x2b8217['limit']=qs['limit'](_0x209d8f[_0x33b3('0x3f')][_0x33b3('0x2c')]);_0x2b8217[_0x33b3('0x2a')]=qs[_0x33b3('0x2a')](_0x209d8f[_0x33b3('0x3f')][_0x33b3('0x2a')]);}_0x2b8217['order']=qs[_0x33b3('0x47')](_0x209d8f[_0x33b3('0x3f')][_0x33b3('0x47')]);_0x2b8217[_0x33b3('0x48')]=qs[_0x33b3('0x49')](_[_0x33b3('0x68')](_0x209d8f['query'],_0x3a5182[_0x33b3('0x49')]));_0x2b8217[_0x33b3('0x48')][_0x33b3('0x5f')]=_0x399cfc['id'];if(_0x209d8f[_0x33b3('0x3f')][_0x33b3('0x4a')]){_0x2b8217['where']=_[_0x33b3('0x4d')](_0x2b8217[_0x33b3('0x48')],{'$or':_[_0x33b3('0x3e')](_0x2b8217[_0x33b3('0x43')],function(_0x58dd61){var _0x3a5aa4={};_0x3a5aa4[_0x58dd61]={'$like':'%'+_0x209d8f['query'][_0x33b3('0x4a')]+'%'};return _0x3a5aa4;})});}_0x2b8217=_[_0x33b3('0x4d')]({},_0x2b8217,_0x209d8f[_0x33b3('0x54')]);return db[_0x33b3('0x67')][_0x33b3('0x63')]({'where':_0x2b8217[_0x33b3('0x48')]})['then'](function(_0x4175b4){_0xdc977d[_0x33b3('0x63')]=_0x4175b4;if(_0x209d8f['query'][_0x33b3('0x4e')]){_0x2b8217[_0x33b3('0x4f')]=[{'all':!![]}];}return db[_0x33b3('0x67')][_0x33b3('0x64')](_0x2b8217);})[_0x33b3('0x1d')](function(_0x3115e9){_0xdc977d[_0x33b3('0x50')]=_0x3115e9;return _0xdc977d;});}})[_0x33b3('0x1d')](respondWithFilteredResult(_0x58cf6b,_0x2b8217))[_0x33b3('0x25')](handleError(_0x58cf6b,null));};exports[_0x33b3('0x69')]=function(_0x1378f3,_0x5a2717,_0x543e01){return db[_0x33b3('0x39')][_0x33b3('0x55')]({'where':{'id':_0x1378f3[_0x33b3('0x51')]['id']}})['then'](handleEntityNotFound(_0x5a2717,null))[_0x33b3('0x1d')](function(_0x136d86){if(_0x136d86){return _0x136d86[_0x33b3('0x69')](_0x1378f3['query'][_0x33b3('0x65')]);}})['then'](respondWithStatusCode(_0x5a2717,null))[_0x33b3('0x25')](handleError(_0x5a2717,null));};exports[_0x33b3('0x6a')]=function(_0x34a585,_0x121003,_0x4ba584){return db[_0x33b3('0x6b')][_0x33b3('0x55')]({'where':{'id':_0x34a585[_0x33b3('0x51')]['id']}})[_0x33b3('0x1d')](handleEntityNotFound(_0x121003,null))[_0x33b3('0x1d')](function(_0x782263){if(_0x782263){return _0x782263[_0x33b3('0x6a')](_0x34a585[_0x33b3('0x57')][_0x33b3('0x65')],_[_0x33b3('0x6c')](_0x34a585[_0x33b3('0x57')],[_0x33b3('0x65'),'id'])||{});}})[_0x33b3('0x1d')](respondWithResult(_0x121003,null))[_0x33b3('0x25')](handleError(_0x121003,null));};exports[_0x33b3('0x6d')]=function(_0x5d0194,_0x12d22d,_0x43bae4){var _0x2d8808={'raw':![],'where':{}};var _0x6e9f3b={};var _0x21b613={'count':0x0,'rows':[]};return db[_0x33b3('0x39')][_0x33b3('0x62')]({'where':{'id':_0x5d0194[_0x33b3('0x51')]['id']}})[_0x33b3('0x1d')](handleEntityNotFound(_0x12d22d,null))[_0x33b3('0x1d')](function(_0x1c875b){if(_0x1c875b){_0x6e9f3b['model']=_[_0x33b3('0x40')](db[_0x33b3('0x6b')][_0x33b3('0x3a')]);_0x6e9f3b[_0x33b3('0x3f')]=_['keys'](_0x5d0194[_0x33b3('0x3f')]);_0x6e9f3b['filters']=_[_0x33b3('0x41')](_0x6e9f3b[_0x33b3('0x3d')],_0x6e9f3b[_0x33b3('0x3f')]);_0x2d8808[_0x33b3('0x43')]=_[_0x33b3('0x41')](_0x6e9f3b[_0x33b3('0x3d')],qs[_0x33b3('0x42')](_0x5d0194[_0x33b3('0x3f')][_0x33b3('0x42')]));_0x2d8808['attributes']=_0x2d8808[_0x33b3('0x43')]['length']?_0x2d8808[_0x33b3('0x43')]:_0x6e9f3b[_0x33b3('0x3d')];if(!_0x5d0194[_0x33b3('0x3f')][_0x33b3('0x44')](_0x33b3('0x45'))){_0x2d8808[_0x33b3('0x2c')]=qs[_0x33b3('0x2c')](_0x5d0194[_0x33b3('0x3f')]['limit']);_0x2d8808['offset']=qs['offset'](_0x5d0194[_0x33b3('0x3f')][_0x33b3('0x2a')]);}_0x2d8808[_0x33b3('0x46')]=qs[_0x33b3('0x47')](_0x5d0194[_0x33b3('0x3f')][_0x33b3('0x47')]);_0x2d8808[_0x33b3('0x48')]=qs['filters'](_['pick'](_0x5d0194[_0x33b3('0x3f')],_0x6e9f3b[_0x33b3('0x49')]));_0x2d8808[_0x33b3('0x48')][_0x33b3('0x5f')]=_0x1c875b['id'];if(_0x5d0194['query'][_0x33b3('0x4a')]){_0x2d8808[_0x33b3('0x48')]=_[_0x33b3('0x4d')](_0x2d8808[_0x33b3('0x48')],{'$or':_[_0x33b3('0x3e')](_0x2d8808[_0x33b3('0x43')],function(_0x4d021a){var _0x55fa43={};_0x55fa43[_0x4d021a]={'$like':'%'+_0x5d0194['query'][_0x33b3('0x4a')]+'%'};return _0x55fa43;})});}_0x2d8808=_['merge']({},_0x2d8808,_0x5d0194['options']);return db[_0x33b3('0x6b')]['count']({'where':_0x2d8808['where']})[_0x33b3('0x1d')](function(_0x40fdd4){_0x21b613[_0x33b3('0x63')]=_0x40fdd4;if(_0x5d0194[_0x33b3('0x3f')][_0x33b3('0x4e')]){_0x2d8808[_0x33b3('0x4f')]=[{'model':db['CmContact'],'as':_0x33b3('0x6e'),'required':![]},{'model':db[_0x33b3('0x6f')],'as':_0x33b3('0x70'),'attributes':[_0x33b3('0x36'),_0x33b3('0x71'),_0x33b3('0x72')],'required':![]},{'model':db[_0x33b3('0x73')],'as':'Tags','attributes':['id',_0x33b3('0x36'),_0x33b3('0x74')],'where':_0x5d0194[_0x33b3('0x3f')][_0x33b3('0x75')]?{'id':_0x5d0194[_0x33b3('0x3f')][_0x33b3('0x75')]}:undefined,'required':_0x5d0194[_0x33b3('0x3f')]['tag']?!![]:![]}];}return db[_0x33b3('0x6b')]['findAll'](_0x2d8808);})['then'](function(_0x207b7c){_0x21b613[_0x33b3('0x50')]=_0x207b7c;return _0x21b613;});}})['then'](respondWithFilteredResult(_0x12d22d,_0x2d8808))[_0x33b3('0x25')](handleError(_0x12d22d,null));};exports['addApplications']=function(_0x246370,_0x4f3551){var _0x211fc0=_0x246370[_0x33b3('0x51')]['id'];var _0x3a95ca=_0x246370[_0x33b3('0x57')];var _0x1a1953=0xc8;var _0x3d1abb=null;return db[_0x33b3('0x76')]['transaction']({'isolationLevel':db[_0x33b3('0x76')]['Transaction'][_0x33b3('0x77')]['READ_COMMITTED']},function(_0x2567a6){return db[_0x33b3('0x39')][_0x33b3('0x62')]({'where':{'id':_0x211fc0},'transaction':_0x2567a6})[_0x33b3('0x1d')](function(_0xa7ef33){if(_0xa7ef33){return db[_0x33b3('0x78')][_0x33b3('0x35')]({'where':{'FaxAccountId':_0x211fc0},'transaction':_0x2567a6})[_0x33b3('0x1d')](function(){var _0x32bb06=_['map'](_0x3a95ca,function(_0x4bf932){_0x4bf932[_0x33b3('0x5f')]=_0x211fc0;return _0x4bf932;});return db['FaxApplication'][_0x33b3('0x79')](_0x32bb06,{'transaction':_0x2567a6});});}else{_0x1a1953=0x194;_0x3d1abb=[];}});})[_0x33b3('0x1d')](function(){if(_0x1a1953!==0x194){return db['FaxApplication'][_0x33b3('0x7a')]({'where':{'FaxAccountId':_0x211fc0},'order':_0x33b3('0x7b')})[_0x33b3('0x1d')](function(_0x3a2437){_0x3d1abb=_0x3a2437;});}})[_0x33b3('0x25')](function(_0x537ef2){_0x1a1953=0x1f4;logger[_0x33b3('0x20')](_0x537ef2['stack']);if(_0x537ef2['name']){delete _0x537ef2[_0x33b3('0x36')];}_0x3d1abb=_0x537ef2;})[_0x33b3('0x7c')](function(){if(_0x3d1abb===null){_0x4f3551[_0x33b3('0x26')](_0x1a1953);}else{if(_0x1a1953===0x1f4){_0x4f3551[_0x33b3('0x28')](_0x1a1953)[_0x33b3('0x37')](_0x3d1abb);}else{_0x4f3551[_0x33b3('0x28')](_0x1a1953)[_0x33b3('0x29')](_0x3d1abb);}}});};exports[_0x33b3('0x7d')]=function(_0x3a44bb,_0x5a0454,_0x1ccdc0){var _0x3d1f96={};var _0x169618={};var _0x443329;var _0x12eb8e;return db[_0x33b3('0x39')]['findOne']({'where':{'id':_0x3a44bb['params']['id']}})[_0x33b3('0x1d')](handleEntityNotFound(_0x5a0454,null))[_0x33b3('0x1d')](function(_0x26347b){if(_0x26347b){_0x443329=_0x26347b;_0x169618[_0x33b3('0x3d')]=_[_0x33b3('0x40')](db[_0x33b3('0x78')]['rawAttributes']);_0x169618[_0x33b3('0x3f')]=_['keys'](_0x3a44bb[_0x33b3('0x3f')]);_0x169618[_0x33b3('0x49')]=_[_0x33b3('0x41')](_0x169618[_0x33b3('0x3d')],_0x169618['query']);_0x3d1f96['attributes']=_[_0x33b3('0x41')](_0x169618[_0x33b3('0x3d')],qs['fields'](_0x3a44bb['query'][_0x33b3('0x42')]));_0x3d1f96[_0x33b3('0x43')]=_0x3d1f96[_0x33b3('0x43')][_0x33b3('0x53')]?_0x3d1f96[_0x33b3('0x43')]:_0x169618[_0x33b3('0x3d')];_0x3d1f96[_0x33b3('0x46')]=qs[_0x33b3('0x47')](_0x3a44bb[_0x33b3('0x3f')][_0x33b3('0x47')]);_0x3d1f96[_0x33b3('0x48')]=qs[_0x33b3('0x49')](_[_0x33b3('0x68')](_0x3a44bb[_0x33b3('0x3f')],_0x169618[_0x33b3('0x49')]));if(_0x3a44bb[_0x33b3('0x3f')]['filter']){_0x3d1f96['where']=_['merge'](_0x3d1f96[_0x33b3('0x48')],{'$or':_[_0x33b3('0x3e')](_0x3d1f96['attributes'],function(_0x402267){var _0x569ae9={};_0x569ae9[_0x402267]={'$like':'%'+_0x3a44bb[_0x33b3('0x3f')][_0x33b3('0x4a')]+'%'};return _0x569ae9;})});}_0x3d1f96=_[_0x33b3('0x4d')]({},_0x3d1f96,_0x3a44bb['options']);return _0x443329[_0x33b3('0x7d')](_0x3d1f96);}})[_0x33b3('0x1d')](function(_0x31e41f){if(_0x31e41f){_0x12eb8e=_0x31e41f['length'];if(!_0x3a44bb['query'][_0x33b3('0x44')](_0x33b3('0x45'))){_0x3d1f96[_0x33b3('0x2c')]=qs[_0x33b3('0x2c')](_0x3a44bb['query']['limit']);_0x3d1f96['offset']=qs[_0x33b3('0x2a')](_0x3a44bb[_0x33b3('0x3f')]['offset']);}return _0x443329[_0x33b3('0x7d')](_0x3d1f96);}})[_0x33b3('0x1d')](function(_0x3bc0b3){if(_0x3bc0b3){return _0x3bc0b3?{'count':_0x12eb8e,'rows':_0x3bc0b3}:null;}})[_0x33b3('0x1d')](respondWithResult(_0x5a0454,null))[_0x33b3('0x25')](handleError(_0x5a0454,null));};function Extension(_0x4571ba,_0x52a50e,_0x2be332,_0x4ef4b0){this[_0x33b3('0x7e')]=_0x33b3('0x7f');this[_0x33b3('0x80')]=_0x4571ba[_0x33b3('0x81')];this['app']=_0x4ef4b0;this[_0x33b3('0x4b')]=_0x33b3('0x82');this[_0x33b3('0x83')]=_0x33b3('0x84');this[_0x33b3('0x5f')]=_0x4571ba['id'];this[_0x33b3('0x7b')]=_0x52a50e;this[_0x33b3('0x85')]=_0x2be332;}function createExtensionsReciveFax(_0x1c5d01){var _0x5cc4d0=0x1;var _0x5e947c=[];_0x5e947c[_0x33b3('0x86')](new Extension(_0x1c5d01,_0x5cc4d0,'',_0x33b3('0x87')));_0x5cc4d0+=0x1;_0x5e947c[_0x33b3('0x86')](new Extension(_0x1c5d01,_0x5cc4d0,_0x33b3('0x88'),_0x33b3('0x89')));_0x5cc4d0+=0x1;for(var _0x244cb6 in _0x1c5d01){if(_0x1c5d01['hasOwnProperty'](_0x244cb6)&&(_0x244cb6===_0x33b3('0x8a')||_0x244cb6===_0x33b3('0x81')||_0x244cb6==='gateway'||_0x244cb6==='faxdetect'||_0x244cb6===_0x33b3('0x8b')||_0x244cb6===_0x33b3('0x8c')||_0x244cb6==='minrate'||_0x244cb6===_0x33b3('0x8d')||_0x244cb6===_0x33b3('0x8e'))){_0x5e947c[_0x33b3('0x86')](new Extension(_0x1c5d01,_0x5cc4d0,_0x33b3('0x8f')+_0x244cb6+')='+_0x1c5d01[_0x244cb6],_0x33b3('0x89')));_0x5cc4d0+=0x1;}}_0x5e947c[_0x33b3('0x86')](new Extension(_0x1c5d01,_0x5cc4d0,'6',_0x33b3('0x90')));_0x5cc4d0+=0x1;_0x5e947c[_0x33b3('0x86')](new Extension(_0x1c5d01,_0x5cc4d0,_0x33b3('0x91'),'ReceiveFax'));_0x5cc4d0=0x0;return _0x5e947c;}exports[_0x33b3('0x92')]=function(_0x1b7089,_0x87365c,_0x33b6f8){var _0x1c8ab0;return db['sequelize'][_0x33b3('0x93')](function(_0x28b14f){return db[_0x33b3('0x39')][_0x33b3('0x56')](_0x1b7089['body'],{'transaction':_0x28b14f})['then'](function(_0xe8889){_0x1c8ab0=_0xe8889[_0x33b3('0x32')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x1c8ab0),{'transaction':_0x28b14f});});})['then'](function(){return _0x1c8ab0;})[_0x33b3('0x1d')](respondWithResult(_0x87365c,null))['catch'](handleError(_0x87365c,null));};exports['updateAccountApplications']=function(_0x5667b3,_0x47a3e5,_0x5abf6a){var _0x51c6c1;return db[_0x33b3('0x76')]['transaction'](function(_0x4673bf){return db['FaxAccount'][_0x33b3('0x31')](_0x5667b3[_0x33b3('0x57')],{'where':{'id':_0x5667b3['body']['id']},'transaction':_0x4673bf})[_0x33b3('0x1d')](function(_0x5c3674){return db[_0x33b3('0x94')][_0x33b3('0x35')]({'where':{'FaxAccountId':_0x5667b3['body']['id']},'transaction':_0x4673bf})['then'](function(_0x1ea2bc){return db[_0x33b3('0x94')][_0x33b3('0x79')](createExtensionsReciveFax(_['omit'](_0x5667b3[_0x33b3('0x57')],[_0x33b3('0x95'),_0x33b3('0x3c'),_0x33b3('0x96'),_0x33b3('0x97'),_0x33b3('0x98'),'ListId'])),{'transaction':_0x4673bf});});});})['then'](function(){return db['FaxAccount'][_0x33b3('0x99')](_0x5667b3[_0x33b3('0x57')]['id']);})[_0x33b3('0x1d')](respondWithResult(_0x47a3e5,null))[_0x33b3('0x25')](handleError(_0x47a3e5,null));};exports[_0x33b3('0x9a')]=function(_0x140e57,_0x3de47d,_0x3ec879){var _0x36105e={'raw':!![],'where':{}};var _0x41c38b={};var _0x50065={'count':0x0,'rows':[]};return db[_0x33b3('0x39')][_0x33b3('0x62')]({'where':{'id':_0x140e57[_0x33b3('0x51')]['id']}})['then'](handleEntityNotFound(_0x3de47d,null))[_0x33b3('0x1d')](function(_0x117e78){if(_0x117e78){_0x41c38b[_0x33b3('0x3d')]=_[_0x33b3('0x40')](db['FaxMessage']['rawAttributes']);_0x41c38b[_0x33b3('0x3f')]=_[_0x33b3('0x40')](_0x140e57['query']);_0x41c38b[_0x33b3('0x49')]=_[_0x33b3('0x41')](_0x41c38b[_0x33b3('0x3d')],_0x41c38b['query']);_0x36105e[_0x33b3('0x43')]=_[_0x33b3('0x41')](_0x41c38b[_0x33b3('0x3d')],qs[_0x33b3('0x42')](_0x140e57[_0x33b3('0x3f')]['fields']));_0x36105e['attributes']=_0x36105e[_0x33b3('0x43')]['length']?_0x36105e[_0x33b3('0x43')]:_0x41c38b[_0x33b3('0x3d')];if(!_0x140e57[_0x33b3('0x3f')][_0x33b3('0x44')]('nolimit')){_0x36105e[_0x33b3('0x2c')]=qs[_0x33b3('0x2c')](_0x140e57[_0x33b3('0x3f')][_0x33b3('0x2c')]);_0x36105e[_0x33b3('0x2a')]=qs['offset'](_0x140e57['query'][_0x33b3('0x2a')]);}_0x36105e[_0x33b3('0x46')]=qs[_0x33b3('0x47')](_0x140e57[_0x33b3('0x3f')][_0x33b3('0x47')]);_0x36105e[_0x33b3('0x48')]=qs[_0x33b3('0x49')](_[_0x33b3('0x68')](_0x140e57[_0x33b3('0x3f')],_0x41c38b[_0x33b3('0x49')]));_0x36105e[_0x33b3('0x48')][_0x33b3('0x5f')]=_0x117e78['id'];if(_0x140e57[_0x33b3('0x3f')][_0x33b3('0x4a')]){_0x36105e['where']=_[_0x33b3('0x4d')](_0x36105e[_0x33b3('0x48')],{'$or':_[_0x33b3('0x3e')](_0x36105e[_0x33b3('0x43')],function(_0x59be1d){var _0x385d2c={};_0x385d2c[_0x59be1d]={'$like':'%'+_0x140e57[_0x33b3('0x3f')][_0x33b3('0x4a')]+'%'};return _0x385d2c;})});}if(_0x140e57[_0x33b3('0x3f')][_0x33b3('0x9b')]){var _0x52739c=_0x140e57[_0x33b3('0x3f')][_0x33b3('0x9b')][_0x33b3('0x9c')](',');var _0x4e326e={};_0x4e326e[_0x52739c[0x0]]={'$gte':moment(_0x52739c[0x1])['format'](_0x33b3('0x9d'))};_0x36105e[_0x33b3('0x48')]=_[_0x33b3('0x4d')](_0x36105e['where'],_0x4e326e);}_0x36105e=_[_0x33b3('0x4d')]({},_0x36105e,_0x140e57[_0x33b3('0x54')]);return db[_0x33b3('0x9e')][_0x33b3('0x63')]({'where':_0x36105e['where']})['then'](function(_0x181485){_0x50065[_0x33b3('0x63')]=_0x181485;if(_0x140e57[_0x33b3('0x3f')][_0x33b3('0x4e')]){_0x36105e[_0x33b3('0x4f')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x36105e);})[_0x33b3('0x1d')](function(_0x1640ad){_0x50065[_0x33b3('0x50')]=_0x1640ad;return _0x50065;});}})[_0x33b3('0x1d')](respondWithFilteredResult(_0x3de47d,_0x36105e))[_0x33b3('0x25')](handleError(_0x3de47d,null));};exports[_0x33b3('0x37')]=function(_0x58ee5a,_0x539038,_0x5c9f79){var _0x430be1,_0x2a7f81={},_0xd253d7;if(_0x58ee5a['body']['to']){_0xd253d7=_0x58ee5a[_0x33b3('0x57')]['to'][0x0];}return db['FaxAccount'][_0x33b3('0x55')]({'where':{'id':_0x58ee5a['params']['id']},'include':[{'model':db[_0x33b3('0x9f')],'as':_0x33b3('0xa0'),'include':[{'model':db[_0x33b3('0xa1')],'as':_0x33b3('0xa2'),'where':{'fax':_0xd253d7},'limit':0x1,'order':[[_0x33b3('0x97'),'DESC']]}]}]})[_0x33b3('0x1d')](handleEntityNotFound(_0x539038,null))['then'](function(_0x26cdaf){_0x430be1=_0x26cdaf;if(_0x58ee5a[_0x33b3('0x57')][_0x33b3('0xa3')]&&_0x58ee5a[_0x33b3('0x57')][_0x33b3('0xa3')][_0x33b3('0x53')]){for(var _0xad4a60=0x0;_0xad4a60<_0x58ee5a[_0x33b3('0x57')]['attachments']['length'];_0xad4a60+=0x1){_0x58ee5a[_0x33b3('0x57')]['attachments'][_0xad4a60]={'filename':_0x58ee5a[_0x33b3('0x57')]['attachments'][_0xad4a60][_0x33b3('0x36')],'id':_0x58ee5a[_0x33b3('0x57')]['attachments'][_0xad4a60]['id'],'path':path[_0x33b3('0xa4')](config[_0x33b3('0xa5')],'server/files/attachments',_0x58ee5a[_0x33b3('0x57')][_0x33b3('0xa3')][_0xad4a60][_0x33b3('0xa6')])};}}return respondWithRpcPromise('CheckAfterSend',_0x33b3('0xa7'),{'FaxAccountId':_[_0x33b3('0xa8')](_0x58ee5a[_0x33b3('0x51')]['id'])?undefined:_0x58ee5a['params']['id'],'path':_['isNil'](_0x58ee5a[_0x33b3('0x57')][_0x33b3('0xa3')][0x0][_0x33b3('0xa9')])?undefined:_0x58ee5a[_0x33b3('0x57')][_0x33b3('0xa3')][0x0][_0x33b3('0xa9')],'fax':_[_0x33b3('0xa8')](_0x58ee5a[_0x33b3('0x57')]['to'][0x0])?undefined:_0x58ee5a['body']['to'][0x0]},client9002);})[_0x33b3('0x1d')](function(){if(_0x430be1){if(_['isNil'](_0x58ee5a[_0x33b3('0x57')][_0x33b3('0xaa')])){_0x58ee5a['body'][_0x33b3('0xaa')]=util[_0x33b3('0xab')](_0x33b3('0xac'),_0x430be1[_0x33b3('0x36')],_0x430be1[_0x33b3('0xad')]);}if(_0x430be1['List']){if(_0x430be1['List'][_0x33b3('0xa2')][_0x33b3('0x53')]){return _0x430be1[_0x33b3('0xa0')][_0x33b3('0xa2')][0x0];}else{return db[_0x33b3('0xa1')]['create'](_[_0x33b3('0xae')](_0x58ee5a[_0x33b3('0x57')],{'firstName':_0x58ee5a[_0x33b3('0x57')]['to'][0x0],'phone':_0x58ee5a[_0x33b3('0x57')]['to'][0x0],'fax':_0x58ee5a['body']['to'][0x0],'ListId':_0x430be1[_0x33b3('0xaf')]}));}}else{throw new Error(_0x33b3('0xb0'));}}else{throw new Error(_0x33b3('0xb1'));}})[_0x33b3('0x1d')](function(_0x59b6c1){if(_0x59b6c1){return db['FaxInteraction'][_0x33b3('0x55')]({'where':{'ContactId':_0x59b6c1['id'],'closed':![],'FaxAccountId':_0x430be1['id']}})[_0x33b3('0x1d')](function(_0x2a6141){if(_0x2a6141){return[_0x2a6141,![]];}return db[_0x33b3('0x6b')]['create']({'UserId':_0x58ee5a[_0x33b3('0x58')]['id'],'ContactId':_0x59b6c1['id'],'FaxAccountId':_0x430be1['id'],'fax':_0x58ee5a['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x33b3('0x4d')](_0x58ee5a[_0x33b3('0x57')],{'read':![],'body':_0x58ee5a[_0x33b3('0x57')][_0x33b3('0xa3')][0x0][_0x33b3('0xb2')],'FaxAccountId':_0x430be1['id'],'UserId':_0x58ee5a[_0x33b3('0x58')]['id'],'ContactId':_0x59b6c1['id'],'AttachmentId':_0x58ee5a[_0x33b3('0x57')][_0x33b3('0xa3')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})[_0x33b3('0x1d')](function(_0x40a2e8){return[_0x40a2e8,!![]];});});}else{throw new Error(_0x33b3('0xb3'));}})[_0x33b3('0xb4')](function(_0x348af1,_0x2cb711){if(_0x2cb711){return _0x348af1;}return db['FaxMessage'][_0x33b3('0x56')]({'direction':_0x33b3('0xb5'),'read':![],'body':_0x58ee5a[_0x33b3('0x57')][_0x33b3('0xa3')][0x0]['filename'],'FaxAccountId':_0x430be1['id'],'FaxInteractionId':_0x348af1['id'],'UserId':_0x58ee5a[_0x33b3('0x58')]['id'],'ContactId':_0x348af1[_0x33b3('0xb6')],'AttachmentId':_0x58ee5a[_0x33b3('0x57')]['attachments'][0x0]['id']})['then'](function(_0x9ed567){_0x348af1[_0x33b3('0xb7')][_0x33b3('0xb8')]=[];_0x348af1['dataValues'][_0x33b3('0xb8')]['push'](_0x9ed567['dataValues']);return _0x348af1;});})[_0x33b3('0x1d')](function(_0x49be88){respondWithRpcPromise(_0x33b3('0xb9'),_0x33b3('0xb9'),{'FaxAccountId':_[_0x33b3('0xa8')](_0x58ee5a['params']['id'])?undefined:_0x58ee5a['params']['id'],'path':_[_0x33b3('0xa8')](_0x58ee5a[_0x33b3('0x57')][_0x33b3('0xa3')][0x0]['path'])?undefined:_0x58ee5a[_0x33b3('0x57')]['attachments'][0x0][_0x33b3('0xa9')],'fax':_[_0x33b3('0xa8')](_0x58ee5a['body']['to'][0x0])?undefined:_0x58ee5a['body']['to'][0x0],'AttachmentId':_0x58ee5a[_0x33b3('0x57')]['attachments'][0x0]['id']},client9002)['then'](function(_0x5580d9){logger['info'](_0x33b3('0xba'),_0x5580d9);})[_0x33b3('0x25')](function(_0x516e2c){logger[_0x33b3('0x23')](_0x33b3('0xba'),_0x516e2c);});return _0x49be88;})[_0x33b3('0x1d')](respondWithResult(_0x539038,null))[_0x33b3('0x25')](handleError(_0x539038,null));};exports[_0x33b3('0xbb')]=function(_0xd86d5,_0x3848c8,_0x53288b){return db[_0x33b3('0x39')][_0x33b3('0x55')]({'where':{'id':_0xd86d5[_0x33b3('0x51')]['id']}})[_0x33b3('0x1d')](handleEntityNotFound(_0x3848c8,null))[_0x33b3('0x1d')](function(_0x1ce677){if(_0x1ce677){return _0x1ce677[_0x33b3('0xbb')](_0xd86d5['body'][_0x33b3('0x65')],_[_0x33b3('0x6c')](_0xd86d5[_0x33b3('0x57')],['ids','id'])||{})[_0x33b3('0xb4')](function(_0x1a4026){for(var _0x391c8c=0x0;_0x391c8c<_0xd86d5[_0x33b3('0x57')][_0x33b3('0x65')][_0x33b3('0x53')];_0x391c8c+=0x1){socket[_0x33b3('0xbc')](_0x33b3('0xbd'),{'UserId':Number(_0xd86d5[_0x33b3('0x57')][_0x33b3('0x65')][_0x391c8c]),'FaxAccountId':Number(_0xd86d5[_0x33b3('0x51')]['id'])});}return _0x1a4026;});}})[_0x33b3('0x1d')](respondWithResult(_0x3848c8,null))[_0x33b3('0x25')](handleError(_0x3848c8,null));};exports['removeAgents']=function(_0x40ff68,_0x1f226b,_0x197cda){return db['FaxAccount'][_0x33b3('0x55')]({'where':{'id':_0x40ff68['params']['id']}})[_0x33b3('0x1d')](handleEntityNotFound(_0x1f226b,null))['then'](function(_0x464af6){if(_0x464af6){return _0x464af6[_0x33b3('0xbe')](_0x40ff68[_0x33b3('0x3f')][_0x33b3('0x65')])[_0x33b3('0x1d')](function(){if(_[_0x33b3('0xbf')](_0x40ff68[_0x33b3('0x3f')][_0x33b3('0x65')])){for(var _0x2a36b3=0x0;_0x2a36b3<_0x40ff68[_0x33b3('0x3f')][_0x33b3('0x65')][_0x33b3('0x53')];_0x2a36b3+=0x1){socket[_0x33b3('0xbc')]('userFaxAccount:remove',{'UserId':Number(_0x40ff68[_0x33b3('0x3f')][_0x33b3('0x65')][_0x2a36b3]),'FaxAccountId':Number(_0x40ff68['params']['id'])});}}else{socket[_0x33b3('0xbc')]('userFaxAccount:remove',{'UserId':Number(_0x40ff68[_0x33b3('0x3f')]['ids']),'FaxAccountId':Number(_0x40ff68[_0x33b3('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x1f226b,null))[_0x33b3('0x25')](handleError(_0x1f226b,null));};exports[_0x33b3('0xc0')]=function(_0x58de28,_0x2503b9,_0x1c3273){var _0x335002={};var _0x4c1c7c={};var _0x5632ed;var _0x5e0ceb;return db[_0x33b3('0x39')][_0x33b3('0x62')]({'where':{'id':_0x58de28[_0x33b3('0x51')]['id']}})[_0x33b3('0x1d')](handleEntityNotFound(_0x2503b9,null))[_0x33b3('0x1d')](function(_0x309e19){if(_0x309e19){_0x5632ed=_0x309e19;_0x4c1c7c[_0x33b3('0x3d')]=_['keys'](db[_0x33b3('0x6f')][_0x33b3('0x3a')]);_0x4c1c7c[_0x33b3('0x3f')]=_[_0x33b3('0x40')](_0x58de28['query']);_0x4c1c7c['filters']=_['intersection'](_0x4c1c7c[_0x33b3('0x3d')],_0x4c1c7c[_0x33b3('0x3f')]);_0x335002[_0x33b3('0x43')]=_[_0x33b3('0x41')](_0x4c1c7c[_0x33b3('0x3d')],qs[_0x33b3('0x42')](_0x58de28[_0x33b3('0x3f')][_0x33b3('0x42')]));_0x335002[_0x33b3('0x43')]=_0x335002['attributes'][_0x33b3('0x53')]?_0x335002['attributes']:_0x4c1c7c[_0x33b3('0x3d')];_0x335002[_0x33b3('0x46')]=qs[_0x33b3('0x47')](_0x58de28[_0x33b3('0x3f')]['sort']);_0x335002[_0x33b3('0x48')]=qs['filters'](_['pick'](_0x58de28[_0x33b3('0x3f')],_0x4c1c7c[_0x33b3('0x49')]));if(_0x58de28[_0x33b3('0x3f')]['filter']){_0x335002[_0x33b3('0x48')]=_[_0x33b3('0x4d')](_0x335002['where'],{'$or':_[_0x33b3('0x3e')](_0x335002[_0x33b3('0x43')],function(_0xa13883){var _0xc9c9d4={};_0xc9c9d4[_0xa13883]={'$like':'%'+_0x58de28[_0x33b3('0x3f')][_0x33b3('0x4a')]+'%'};return _0xc9c9d4;})});}_0x335002=_[_0x33b3('0x4d')]({},_0x335002,_0x58de28[_0x33b3('0x54')]);return _0x5632ed[_0x33b3('0xc0')](_0x335002);}})['then'](function(_0x436bff){if(_0x436bff){_0x5e0ceb=_0x436bff[_0x33b3('0x53')];if(!_0x58de28[_0x33b3('0x3f')]['hasOwnProperty'](_0x33b3('0x45'))){_0x335002[_0x33b3('0x2c')]=qs['limit'](_0x58de28[_0x33b3('0x3f')][_0x33b3('0x2c')]);_0x335002[_0x33b3('0x2a')]=qs['offset'](_0x58de28[_0x33b3('0x3f')][_0x33b3('0x2a')]);}return _0x5632ed[_0x33b3('0xc0')](_0x335002);}})['then'](function(_0x7b3892){if(_0x7b3892){return _0x7b3892?{'count':_0x5e0ceb,'rows':_0x7b3892}:null;}})[_0x33b3('0x1d')](respondWithResult(_0x2503b9,null))[_0x33b3('0x25')](handleError(_0x2503b9,null));}; \ No newline at end of file +var _0x93d6=['\x22%s\x22\x20<%s>','fax','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','spread','ContactId','dataValues','SendFax','path','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','request-promise','bluebird','mustache','util','fs-extra','lodash','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','destroy','get','FaxAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','FaxAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','include','findAll','rows','mandatoryDispositionPause','length','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','getDispositions','pick','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','FaxInteraction','omit','getInteractions','Contact','User','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','priority','finally','getApplications','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','minrate','modem','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','CmContact','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x93d6,0x1a3));var _0x693d=function(_0x146497,_0x534896){_0x146497=_0x146497-0x0;var _0x4e6144=_0x93d6[_0x146497];return _0x4e6144;};'use strict';var emlformat=require(_0x693d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x693d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x693d('0x2'));var moment=require('moment');var BPromise=require(_0x693d('0x3'));var Mustache=require(_0x693d('0x4'));var util=require(_0x693d('0x5'));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(_0x693d('0x6'));var _=require(_0x693d('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x693d('0x8'));var toCsv=require(_0x693d('0x9'));var querystring=require('querystring');var Papa=require(_0x693d('0xa'));var Redis=require(_0x693d('0xb'));var authService=require(_0x693d('0xc'));var qs=require(_0x693d('0xd'));var as=require(_0x693d('0xe'));var hardwareService=require(_0x693d('0xf'));var logger=require('../../config/logger')(_0x693d('0x10'));var utils=require(_0x693d('0x11'));var config=require(_0x693d('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x693d('0x13'))['db'];config['redis']=_['defaults'](config[_0x693d('0x14')],{'host':_0x693d('0x15'),'port':0x18eb});var socket=require(_0x693d('0x16'))(new Redis(config['redis']));require(_0x693d('0x17'))[_0x693d('0x18')](socket);var jayson=require(_0x693d('0x19'));var client=jayson[_0x693d('0x1a')][_0x693d('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0x693d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xbf061,_0xc0d793,_0x3c7894,_0x154960){return new BPromise(function(_0x3fd012,_0x1054b9){var _0x2e4635=_0x154960||client;return _0x2e4635['request'](_0xbf061,_0x3c7894)[_0x693d('0x1c')](function(_0x5b18fe){logger[_0x693d('0x1d')]('FaxAccount,\x20%s,\x20%s',_0xc0d793,_0x693d('0x1e'));logger[_0x693d('0x1f')](_0x693d('0x20'),_0xc0d793,_0x693d('0x1e'),JSON[_0x693d('0x21')](_0x5b18fe));if(_0x5b18fe[_0x693d('0x22')]){if(_0x5b18fe[_0x693d('0x22')][_0x693d('0x23')]===0x1f4){logger['error'](_0x693d('0x24'),_0xc0d793,_0x5b18fe[_0x693d('0x22')][_0x693d('0x25')]);return _0x1054b9(_0x5b18fe[_0x693d('0x22')]['message']);}logger[_0x693d('0x22')](_0x693d('0x24'),_0xc0d793,_0x5b18fe[_0x693d('0x22')][_0x693d('0x25')]);return _0x3fd012(_0x5b18fe[_0x693d('0x22')][_0x693d('0x25')]);}else{logger[_0x693d('0x1d')](_0x693d('0x24'),_0xc0d793,_0x693d('0x1e'));_0x3fd012(_0x5b18fe[_0x693d('0x26')][_0x693d('0x25')]);}})[_0x693d('0x27')](function(_0x11d9e4){logger['error'](_0x693d('0x24'),_0xc0d793,_0x11d9e4);_0x1054b9(_0x11d9e4);});});}function respondWithStatusCode(_0x19f0c6,_0x36fdca){_0x36fdca=_0x36fdca||0xcc;return function(_0x34e924){if(_0x34e924){return _0x19f0c6['sendStatus'](_0x36fdca);}return _0x19f0c6[_0x693d('0x28')](_0x36fdca)[_0x693d('0x29')]();};}function respondWithResult(_0x1686ff,_0x54bd10){_0x54bd10=_0x54bd10||0xc8;return function(_0x55ef3c){if(_0x55ef3c){return _0x1686ff[_0x693d('0x28')](_0x54bd10)[_0x693d('0x2a')](_0x55ef3c);}};}function respondWithFilteredResult(_0x17d2cf,_0x2b63aa){return function(_0x5413d5){if(_0x5413d5){var _0x3c6834=typeof _0x2b63aa['offset']===_0x693d('0x2b')&&typeof _0x2b63aa[_0x693d('0x2c')]==='undefined';var _0x425e49=_0x5413d5[_0x693d('0x2d')];var _0x5c3819=_0x3c6834?0x0:_0x2b63aa['offset'];var _0x253f45=_0x3c6834?_0x5413d5[_0x693d('0x2d')]:_0x2b63aa[_0x693d('0x2e')]+_0x2b63aa['limit'];var _0x2d8f34;if(_0x253f45>=_0x425e49){_0x253f45=_0x425e49;_0x2d8f34=0xc8;}else{_0x2d8f34=0xce;}_0x17d2cf[_0x693d('0x28')](_0x2d8f34);return _0x17d2cf[_0x693d('0x2f')](_0x693d('0x30'),_0x5c3819+'-'+_0x253f45+'/'+_0x425e49)['json'](_0x5413d5);}return null;};}function patchUpdates(_0x413f16){return function(_0x1f6e04){try{jsonpatch['apply'](_0x1f6e04,_0x413f16,!![]);}catch(_0xdc2c5f){return BPromise['reject'](_0xdc2c5f);}return _0x1f6e04[_0x693d('0x31')]();};}function saveUpdates(_0x2f8d77,_0x497213){return function(_0x573a0b){if(_0x573a0b){return _0x573a0b[_0x693d('0x32')](_0x2f8d77)[_0x693d('0x1c')](function(_0x48d889){return _0x48d889;});}return null;};}function removeEntity(_0x4fc9b2,_0xa4cf67){return function(_0x5e24ba){if(_0x5e24ba){return _0x5e24ba[_0x693d('0x33')]()[_0x693d('0x1c')](function(){var _0xe7d2c9=_0x5e24ba[_0x693d('0x34')]({'plain':!![]});var _0x279df0=_0x693d('0x35');return db[_0x693d('0x36')][_0x693d('0x33')]({'where':{'type':_0x279df0,'resourceId':_0xe7d2c9['id']}})[_0x693d('0x1c')](function(){return _0x5e24ba;});})[_0x693d('0x1c')](function(){_0x4fc9b2[_0x693d('0x28')](0xcc)[_0x693d('0x29')]();});}};}function handleEntityNotFound(_0x498de7,_0x367a8a){return function(_0x3965ec){if(!_0x3965ec){_0x498de7[_0x693d('0x37')](0x194);}return _0x3965ec;};}function handleError(_0x3aa404,_0x8e8bd7){_0x8e8bd7=_0x8e8bd7||0x1f4;return function(_0x501dc9){logger[_0x693d('0x22')](_0x501dc9[_0x693d('0x38')]);if(_0x501dc9['name']){delete _0x501dc9[_0x693d('0x39')];}_0x3aa404[_0x693d('0x28')](_0x8e8bd7)[_0x693d('0x3a')](_0x501dc9);};}exports[_0x693d('0x3b')]=function(_0x6ecc26,_0x50422b){var _0xcab7ba={'include':[{'model':db[_0x693d('0x3c')],'as':'mandatoryDispositionPause'}]},_0x2bd240={},_0x4f1ce4={'count':0x0,'rows':[]};var _0xea7ea3=_['map'](db[_0x693d('0x3d')][_0x693d('0x3e')],function(_0x5193cd){return{'name':_0x5193cd[_0x693d('0x3f')],'type':_0x5193cd[_0x693d('0x40')][_0x693d('0x41')]};});_0x2bd240[_0x693d('0x42')]=_[_0x693d('0x43')](_0xea7ea3,_0x693d('0x39'));_0x2bd240[_0x693d('0x44')]=_[_0x693d('0x45')](_0x6ecc26[_0x693d('0x44')]);_0x2bd240['filters']=_[_0x693d('0x46')](_0x2bd240['model'],_0x2bd240[_0x693d('0x44')]);_0xcab7ba['attributes']=_[_0x693d('0x46')](_0x2bd240[_0x693d('0x42')],qs['fields'](_0x6ecc26[_0x693d('0x44')][_0x693d('0x47')]));_0xcab7ba[_0x693d('0x48')]=_0xcab7ba[_0x693d('0x48')]['length']?_0xcab7ba['attributes']:_0x2bd240[_0x693d('0x42')];if(!_0x6ecc26[_0x693d('0x44')][_0x693d('0x49')](_0x693d('0x4a'))){_0xcab7ba[_0x693d('0x2c')]=qs[_0x693d('0x2c')](_0x6ecc26[_0x693d('0x44')][_0x693d('0x2c')]);_0xcab7ba[_0x693d('0x2e')]=qs[_0x693d('0x2e')](_0x6ecc26[_0x693d('0x44')][_0x693d('0x2e')]);}_0xcab7ba[_0x693d('0x4b')]=qs['sort'](_0x6ecc26[_0x693d('0x44')][_0x693d('0x4c')]);_0xcab7ba[_0x693d('0x4d')]=qs[_0x693d('0x4e')](_['pick'](_0x6ecc26[_0x693d('0x44')],_0x2bd240[_0x693d('0x4e')]),_0xea7ea3);if(_0x6ecc26['query']['filter']){_0xcab7ba[_0x693d('0x4d')]=_[_0x693d('0x4f')](_0xcab7ba[_0x693d('0x4d')],{'$or':_[_0x693d('0x43')](_0xea7ea3,function(_0x5eac77){if(_0x5eac77[_0x693d('0x40')]!==_0x693d('0x50')){var _0x5b2578={};_0x5b2578[_0x5eac77[_0x693d('0x39')]]={'$like':'%'+_0x6ecc26[_0x693d('0x44')][_0x693d('0x51')]+'%'};return _0x5b2578;}})});}_0xcab7ba=_[_0x693d('0x4f')]({},_0xcab7ba,_0x6ecc26['options']);var _0x5a2687={'where':_0xcab7ba[_0x693d('0x4d')]};return db['FaxAccount']['count'](_0x5a2687)['then'](function(_0x4a1708){_0x4f1ce4[_0x693d('0x2d')]=_0x4a1708;if(_0x6ecc26[_0x693d('0x44')]['includeAll']){_0xcab7ba[_0x693d('0x52')]=[{'all':!![]}];}return db[_0x693d('0x3d')][_0x693d('0x53')](_0xcab7ba);})[_0x693d('0x1c')](function(_0x3214e0){_0x4f1ce4[_0x693d('0x54')]=_0x3214e0;return _0x4f1ce4;})[_0x693d('0x1c')](respondWithFilteredResult(_0x50422b,_0xcab7ba))[_0x693d('0x27')](handleError(_0x50422b,null));};exports['show']=function(_0x11fd00,_0x5f2c33){var _0x1669c9={'raw':![],'where':{'id':_0x11fd00['params']['id']},'include':[{'model':db[_0x693d('0x3c')],'as':_0x693d('0x55')}]},_0xfa2d14={};_0xfa2d14[_0x693d('0x42')]=_[_0x693d('0x45')](db[_0x693d('0x3d')][_0x693d('0x3e')]);_0xfa2d14[_0x693d('0x44')]=_['keys'](_0x11fd00[_0x693d('0x44')]);_0xfa2d14['filters']=_[_0x693d('0x46')](_0xfa2d14[_0x693d('0x42')],_0xfa2d14['query']);_0x1669c9[_0x693d('0x48')]=_[_0x693d('0x46')](_0xfa2d14[_0x693d('0x42')],qs[_0x693d('0x47')](_0x11fd00[_0x693d('0x44')][_0x693d('0x47')]));_0x1669c9['attributes']=_0x1669c9[_0x693d('0x48')][_0x693d('0x56')]?_0x1669c9[_0x693d('0x48')]:_0xfa2d14['model'];if(_0x11fd00[_0x693d('0x44')][_0x693d('0x57')]){_0x1669c9[_0x693d('0x52')]=[{'all':!![]}];}_0x1669c9=_['merge']({},_0x1669c9,_0x11fd00[_0x693d('0x58')]);return db['FaxAccount']['find'](_0x1669c9)[_0x693d('0x1c')](handleEntityNotFound(_0x5f2c33,null))['then'](respondWithResult(_0x5f2c33,null))['catch'](handleError(_0x5f2c33,null));};exports[_0x693d('0x59')]=function(_0x56eadb,_0x4d1bf8){return db[_0x693d('0x3d')][_0x693d('0x59')](_0x56eadb[_0x693d('0x5a')],{})[_0x693d('0x1c')](function(_0x28d7ee){var _0x3ff29a=_0x56eadb[_0x693d('0x5b')]['get']({'plain':!![]});if(!_0x3ff29a)throw new Error(_0x693d('0x5c'));if(_0x3ff29a[_0x693d('0x5d')]===_0x693d('0x5b')){var _0x39fe92=_0x28d7ee[_0x693d('0x34')]({'plain':!![]});var _0x12751a='FaxAccounts';return db[_0x693d('0x5e')][_0x693d('0x5f')]({'where':{'name':_0x12751a,'userProfileId':_0x3ff29a[_0x693d('0x60')]},'raw':!![]})[_0x693d('0x1c')](function(_0x1cce16){if(_0x1cce16&&_0x1cce16[_0x693d('0x61')]===0x0){return db[_0x693d('0x36')]['create']({'name':_0x39fe92[_0x693d('0x39')],'resourceId':_0x39fe92['id'],'type':_0x1cce16[_0x693d('0x39')],'sectionId':_0x1cce16['id']},{})[_0x693d('0x1c')](function(){return _0x28d7ee;});}else{return _0x28d7ee;}})[_0x693d('0x27')](function(_0x53d917){logger[_0x693d('0x22')](_0x693d('0x62'),_0x53d917);throw _0x53d917;});}return _0x28d7ee;})[_0x693d('0x1c')](respondWithResult(_0x4d1bf8,0xc9))[_0x693d('0x27')](handleError(_0x4d1bf8,null));};exports[_0x693d('0x32')]=function(_0x223132,_0x3e47a1){if(_0x223132[_0x693d('0x5a')]['id']){delete _0x223132['body']['id'];}return db['FaxAccount'][_0x693d('0x5f')]({'where':{'id':_0x223132[_0x693d('0x63')]['id']},'include':[{'model':db[_0x693d('0x3c')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x3e47a1,null))[_0x693d('0x1c')](saveUpdates(_0x223132[_0x693d('0x5a')],null))[_0x693d('0x1c')](respondWithResult(_0x3e47a1,null))['catch'](handleError(_0x3e47a1,null));};exports[_0x693d('0x33')]=function(_0x12f8e8,_0x4ecf3b){return db[_0x693d('0x3d')][_0x693d('0x5f')]({'where':{'id':_0x12f8e8['params']['id']}})[_0x693d('0x1c')](handleEntityNotFound(_0x4ecf3b,null))['then'](removeEntity(_0x4ecf3b,null))[_0x693d('0x27')](handleError(_0x4ecf3b,null));};exports[_0x693d('0x64')]=function(_0x2511d1,_0x4743b6){return db[_0x693d('0x3d')][_0x693d('0x64')]()[_0x693d('0x1c')](respondWithResult(_0x4743b6,null))['catch'](handleError(_0x4743b6,null));};exports[_0x693d('0x65')]=function(_0x2ff92b,_0x39a701,_0x4432f9){if(_0x2ff92b[_0x693d('0x5a')]['id']){delete _0x2ff92b[_0x693d('0x5a')]['id'];}return db[_0x693d('0x3d')][_0x693d('0x5f')]({'where':{'id':_0x2ff92b['params']['id']}})[_0x693d('0x1c')](handleEntityNotFound(_0x39a701,null))[_0x693d('0x1c')](function(_0x23fd1d){if(_0x23fd1d){_0x2ff92b[_0x693d('0x5a')][_0x693d('0x66')]=_0x23fd1d['id'];return db['Disposition'][_0x693d('0x59')](_0x2ff92b[_0x693d('0x5a')]);}})[_0x693d('0x1c')](respondWithResult(_0x39a701,null))[_0x693d('0x27')](handleError(_0x39a701,null));};exports[_0x693d('0x67')]=function(_0x2a4c11,_0x2153fc,_0x496f1b){var _0x5df028={'raw':![],'where':{}};var _0x16d5bc={};var _0x2e8a06={'count':0x0,'rows':[]};return db[_0x693d('0x3d')]['findOne']({'where':{'id':_0x2a4c11[_0x693d('0x63')]['id']}})[_0x693d('0x1c')](handleEntityNotFound(_0x2153fc,null))['then'](function(_0x5ace0b){if(_0x5ace0b){_0x16d5bc['model']=_[_0x693d('0x45')](db['Disposition'][_0x693d('0x3e')]);_0x16d5bc['query']=_[_0x693d('0x45')](_0x2a4c11[_0x693d('0x44')]);_0x16d5bc[_0x693d('0x4e')]=_[_0x693d('0x46')](_0x16d5bc[_0x693d('0x42')],_0x16d5bc['query']);_0x5df028[_0x693d('0x48')]=_['intersection'](_0x16d5bc[_0x693d('0x42')],qs['fields'](_0x2a4c11['query'][_0x693d('0x47')]));_0x5df028[_0x693d('0x48')]=_0x5df028[_0x693d('0x48')][_0x693d('0x56')]?_0x5df028[_0x693d('0x48')]:_0x16d5bc[_0x693d('0x42')];if(!_0x2a4c11[_0x693d('0x44')][_0x693d('0x49')](_0x693d('0x4a'))){_0x5df028[_0x693d('0x2c')]=qs['limit'](_0x2a4c11['query'][_0x693d('0x2c')]);_0x5df028[_0x693d('0x2e')]=qs[_0x693d('0x2e')](_0x2a4c11[_0x693d('0x44')]['offset']);}_0x5df028[_0x693d('0x4b')]=qs[_0x693d('0x4c')](_0x2a4c11[_0x693d('0x44')][_0x693d('0x4c')]);_0x5df028[_0x693d('0x4d')]=qs[_0x693d('0x4e')](_[_0x693d('0x68')](_0x2a4c11['query'],_0x16d5bc[_0x693d('0x4e')]));_0x5df028[_0x693d('0x4d')]['FaxAccountId']=_0x5ace0b['id'];if(_0x2a4c11[_0x693d('0x44')]['filter']){_0x5df028[_0x693d('0x4d')]=_[_0x693d('0x4f')](_0x5df028[_0x693d('0x4d')],{'$or':_[_0x693d('0x43')](_0x5df028[_0x693d('0x48')],function(_0x10f527){var _0x356d0d={};_0x356d0d[_0x10f527]={'$like':'%'+_0x2a4c11[_0x693d('0x44')][_0x693d('0x51')]+'%'};return _0x356d0d;})});}_0x5df028=_['merge']({},_0x5df028,_0x2a4c11[_0x693d('0x58')]);return db[_0x693d('0x69')][_0x693d('0x2d')]({'where':_0x5df028[_0x693d('0x4d')]})[_0x693d('0x1c')](function(_0x581959){_0x2e8a06[_0x693d('0x2d')]=_0x581959;if(_0x2a4c11[_0x693d('0x44')]['includeAll']){_0x5df028['include']=[{'all':!![]}];}return db[_0x693d('0x69')][_0x693d('0x53')](_0x5df028);})['then'](function(_0x56fb10){_0x2e8a06[_0x693d('0x54')]=_0x56fb10;return _0x2e8a06;});}})[_0x693d('0x1c')](respondWithFilteredResult(_0x2153fc,_0x5df028))[_0x693d('0x27')](handleError(_0x2153fc,null));};exports[_0x693d('0x6a')]=function(_0x3a53d0,_0x4baaf6,_0x5b3973){return db[_0x693d('0x3d')][_0x693d('0x5f')]({'where':{'id':_0x3a53d0[_0x693d('0x63')]['id']}})['then'](handleEntityNotFound(_0x4baaf6,null))[_0x693d('0x1c')](function(_0x140d1c){if(_0x140d1c){return _0x140d1c['removeDispositions'](_0x3a53d0[_0x693d('0x44')][_0x693d('0x6b')]);}})[_0x693d('0x1c')](respondWithStatusCode(_0x4baaf6,null))[_0x693d('0x27')](handleError(_0x4baaf6,null));};exports[_0x693d('0x6c')]=function(_0x49dd88,_0x20240e,_0x480997){if(_0x49dd88[_0x693d('0x5a')]['id']){delete _0x49dd88['body']['id'];}return db[_0x693d('0x3d')]['find']({'where':{'id':_0x49dd88[_0x693d('0x63')]['id']}})[_0x693d('0x1c')](handleEntityNotFound(_0x20240e,null))[_0x693d('0x1c')](function(_0xdf7a5f){if(_0xdf7a5f){_0x49dd88[_0x693d('0x5a')][_0x693d('0x66')]=_0xdf7a5f['id'];return db[_0x693d('0x6d')][_0x693d('0x59')](_0x49dd88['body']);}})['then'](respondWithResult(_0x20240e,null))[_0x693d('0x27')](handleError(_0x20240e,null));};exports[_0x693d('0x6e')]=function(_0x3f1b2f,_0x35e6b3,_0x4efe7e){var _0x155e3b={'raw':![],'where':{}};var _0x1b5fc4={};var _0x23840b={'count':0x0,'rows':[]};return db[_0x693d('0x3d')][_0x693d('0x6f')]({'where':{'id':_0x3f1b2f[_0x693d('0x63')]['id']}})[_0x693d('0x1c')](handleEntityNotFound(_0x35e6b3,null))[_0x693d('0x1c')](function(_0x4ff12d){if(_0x4ff12d){_0x1b5fc4[_0x693d('0x42')]=_[_0x693d('0x45')](db[_0x693d('0x6d')][_0x693d('0x3e')]);_0x1b5fc4[_0x693d('0x44')]=_['keys'](_0x3f1b2f['query']);_0x1b5fc4[_0x693d('0x4e')]=_['intersection'](_0x1b5fc4[_0x693d('0x42')],_0x1b5fc4['query']);_0x155e3b[_0x693d('0x48')]=_['intersection'](_0x1b5fc4['model'],qs[_0x693d('0x47')](_0x3f1b2f[_0x693d('0x44')][_0x693d('0x47')]));_0x155e3b['attributes']=_0x155e3b[_0x693d('0x48')][_0x693d('0x56')]?_0x155e3b[_0x693d('0x48')]:_0x1b5fc4[_0x693d('0x42')];if(!_0x3f1b2f[_0x693d('0x44')][_0x693d('0x49')]('nolimit')){_0x155e3b[_0x693d('0x2c')]=qs[_0x693d('0x2c')](_0x3f1b2f[_0x693d('0x44')][_0x693d('0x2c')]);_0x155e3b[_0x693d('0x2e')]=qs[_0x693d('0x2e')](_0x3f1b2f[_0x693d('0x44')][_0x693d('0x2e')]);}_0x155e3b[_0x693d('0x4b')]=qs[_0x693d('0x4c')](_0x3f1b2f[_0x693d('0x44')][_0x693d('0x4c')]);_0x155e3b['where']=qs[_0x693d('0x4e')](_[_0x693d('0x68')](_0x3f1b2f[_0x693d('0x44')],_0x1b5fc4[_0x693d('0x4e')]));_0x155e3b['where']['FaxAccountId']=_0x4ff12d['id'];if(_0x3f1b2f[_0x693d('0x44')]['filter']){_0x155e3b[_0x693d('0x4d')]=_[_0x693d('0x4f')](_0x155e3b[_0x693d('0x4d')],{'$or':_[_0x693d('0x43')](_0x155e3b[_0x693d('0x48')],function(_0x8e3ab6){var _0x3157c9={};_0x3157c9[_0x8e3ab6]={'$like':'%'+_0x3f1b2f[_0x693d('0x44')][_0x693d('0x51')]+'%'};return _0x3157c9;})});}_0x155e3b=_['merge']({},_0x155e3b,_0x3f1b2f[_0x693d('0x58')]);return db[_0x693d('0x6d')][_0x693d('0x2d')]({'where':_0x155e3b[_0x693d('0x4d')]})['then'](function(_0x7a85bd){_0x23840b[_0x693d('0x2d')]=_0x7a85bd;if(_0x3f1b2f[_0x693d('0x44')][_0x693d('0x57')]){_0x155e3b['include']=[{'all':!![]}];}return db[_0x693d('0x6d')]['findAll'](_0x155e3b);})['then'](function(_0x2b58f0){_0x23840b['rows']=_0x2b58f0;return _0x23840b;});}})[_0x693d('0x1c')](respondWithFilteredResult(_0x35e6b3,_0x155e3b))[_0x693d('0x27')](handleError(_0x35e6b3,null));};exports[_0x693d('0x70')]=function(_0x6c73df,_0x51e7a8,_0x298b91){return db[_0x693d('0x3d')][_0x693d('0x5f')]({'where':{'id':_0x6c73df[_0x693d('0x63')]['id']}})[_0x693d('0x1c')](handleEntityNotFound(_0x51e7a8,null))['then'](function(_0x593ffe){if(_0x593ffe){return _0x593ffe[_0x693d('0x70')](_0x6c73df['query']['ids']);}})['then'](respondWithStatusCode(_0x51e7a8,null))['catch'](handleError(_0x51e7a8,null));};exports['addInteraction']=function(_0x4f8c34,_0xc35274,_0x196742){return db[_0x693d('0x71')]['find']({'where':{'id':_0x4f8c34['params']['id']}})[_0x693d('0x1c')](handleEntityNotFound(_0xc35274,null))[_0x693d('0x1c')](function(_0x8a9f6c){if(_0x8a9f6c){return _0x8a9f6c['addInteraction'](_0x4f8c34[_0x693d('0x5a')][_0x693d('0x6b')],_[_0x693d('0x72')](_0x4f8c34[_0x693d('0x5a')],['ids','id'])||{});}})['then'](respondWithResult(_0xc35274,null))['catch'](handleError(_0xc35274,null));};exports[_0x693d('0x73')]=function(_0x4a9844,_0x2cf8cc,_0x376d2a){var _0x1f9dfc={'raw':![],'where':{}};var _0x586bae={};var _0x597d0b={'count':0x0,'rows':[]};return db[_0x693d('0x3d')][_0x693d('0x6f')]({'where':{'id':_0x4a9844[_0x693d('0x63')]['id']}})['then'](handleEntityNotFound(_0x2cf8cc,null))['then'](function(_0x1698c4){if(_0x1698c4){_0x586bae[_0x693d('0x42')]=_[_0x693d('0x45')](db['FaxInteraction'][_0x693d('0x3e')]);_0x586bae[_0x693d('0x44')]=_[_0x693d('0x45')](_0x4a9844[_0x693d('0x44')]);_0x586bae[_0x693d('0x4e')]=_[_0x693d('0x46')](_0x586bae[_0x693d('0x42')],_0x586bae[_0x693d('0x44')]);_0x1f9dfc[_0x693d('0x48')]=_[_0x693d('0x46')](_0x586bae[_0x693d('0x42')],qs[_0x693d('0x47')](_0x4a9844[_0x693d('0x44')][_0x693d('0x47')]));_0x1f9dfc[_0x693d('0x48')]=_0x1f9dfc[_0x693d('0x48')]['length']?_0x1f9dfc['attributes']:_0x586bae[_0x693d('0x42')];if(!_0x4a9844[_0x693d('0x44')][_0x693d('0x49')](_0x693d('0x4a'))){_0x1f9dfc['limit']=qs['limit'](_0x4a9844['query']['limit']);_0x1f9dfc[_0x693d('0x2e')]=qs[_0x693d('0x2e')](_0x4a9844[_0x693d('0x44')]['offset']);}_0x1f9dfc['order']=qs['sort'](_0x4a9844[_0x693d('0x44')][_0x693d('0x4c')]);_0x1f9dfc[_0x693d('0x4d')]=qs[_0x693d('0x4e')](_[_0x693d('0x68')](_0x4a9844[_0x693d('0x44')],_0x586bae[_0x693d('0x4e')]));_0x1f9dfc[_0x693d('0x4d')][_0x693d('0x66')]=_0x1698c4['id'];if(_0x4a9844[_0x693d('0x44')][_0x693d('0x51')]){_0x1f9dfc[_0x693d('0x4d')]=_[_0x693d('0x4f')](_0x1f9dfc[_0x693d('0x4d')],{'$or':_[_0x693d('0x43')](_0x1f9dfc[_0x693d('0x48')],function(_0x47ab5e){var _0x2cd675={};_0x2cd675[_0x47ab5e]={'$like':'%'+_0x4a9844[_0x693d('0x44')]['filter']+'%'};return _0x2cd675;})});}_0x1f9dfc=_[_0x693d('0x4f')]({},_0x1f9dfc,_0x4a9844[_0x693d('0x58')]);return db[_0x693d('0x71')]['count']({'where':_0x1f9dfc[_0x693d('0x4d')]})[_0x693d('0x1c')](function(_0x865ee7){_0x597d0b[_0x693d('0x2d')]=_0x865ee7;if(_0x4a9844[_0x693d('0x44')][_0x693d('0x57')]){_0x1f9dfc[_0x693d('0x52')]=[{'model':db['CmContact'],'as':_0x693d('0x74'),'required':![]},{'model':db[_0x693d('0x75')],'as':'Owner','attributes':[_0x693d('0x39'),'fullname',_0x693d('0x76')],'required':![]},{'model':db['Tag'],'as':_0x693d('0x77'),'attributes':['id',_0x693d('0x39'),_0x693d('0x78')],'where':_0x4a9844[_0x693d('0x44')][_0x693d('0x79')]?{'id':_0x4a9844[_0x693d('0x44')]['tag']}:undefined,'required':_0x4a9844[_0x693d('0x44')][_0x693d('0x79')]?!![]:![]}];}return db[_0x693d('0x71')][_0x693d('0x53')](_0x1f9dfc);})[_0x693d('0x1c')](function(_0x4958b1){_0x597d0b[_0x693d('0x54')]=_0x4958b1;return _0x597d0b;});}})[_0x693d('0x1c')](respondWithFilteredResult(_0x2cf8cc,_0x1f9dfc))['catch'](handleError(_0x2cf8cc,null));};exports[_0x693d('0x7a')]=function(_0x3a57c0,_0x193e56){var _0xa09520=_0x3a57c0[_0x693d('0x63')]['id'];var _0x241b4d=_0x3a57c0['body'];var _0x4e54c1=0xc8;var _0x2e89eb=null;return db[_0x693d('0x7b')][_0x693d('0x7c')]({'isolationLevel':db['sequelize'][_0x693d('0x7d')][_0x693d('0x7e')][_0x693d('0x7f')]},function(_0x13ad30){return db[_0x693d('0x3d')][_0x693d('0x6f')]({'where':{'id':_0xa09520},'transaction':_0x13ad30})[_0x693d('0x1c')](function(_0x21edf5){if(_0x21edf5){return db[_0x693d('0x80')][_0x693d('0x33')]({'where':{'FaxAccountId':_0xa09520},'transaction':_0x13ad30})[_0x693d('0x1c')](function(){var _0x248a7c=_['map'](_0x241b4d,function(_0x2d59b4){_0x2d59b4[_0x693d('0x66')]=_0xa09520;return _0x2d59b4;});return db[_0x693d('0x80')]['bulkCreate'](_0x248a7c,{'transaction':_0x13ad30});});}else{_0x4e54c1=0x194;_0x2e89eb=[];}});})[_0x693d('0x1c')](function(){if(_0x4e54c1!==0x194){return db['FaxApplication'][_0x693d('0x81')]({'where':{'FaxAccountId':_0xa09520},'order':_0x693d('0x82')})[_0x693d('0x1c')](function(_0x471f14){_0x2e89eb=_0x471f14;});}})[_0x693d('0x27')](function(_0x4416b8){_0x4e54c1=0x1f4;logger[_0x693d('0x22')](_0x4416b8[_0x693d('0x38')]);if(_0x4416b8[_0x693d('0x39')]){delete _0x4416b8[_0x693d('0x39')];}_0x2e89eb=_0x4416b8;})[_0x693d('0x83')](function(){if(_0x2e89eb===null){_0x193e56[_0x693d('0x37')](_0x4e54c1);}else{if(_0x4e54c1===0x1f4){_0x193e56['status'](_0x4e54c1)['send'](_0x2e89eb);}else{_0x193e56[_0x693d('0x28')](_0x4e54c1)[_0x693d('0x2a')](_0x2e89eb);}}});};exports[_0x693d('0x84')]=function(_0x20a4ad,_0x220775,_0x5cdba8){var _0x52f696={};var _0x5034af={};var _0x4fed3e;var _0xe0d54f;return db['FaxAccount'][_0x693d('0x6f')]({'where':{'id':_0x20a4ad[_0x693d('0x63')]['id']}})[_0x693d('0x1c')](handleEntityNotFound(_0x220775,null))[_0x693d('0x1c')](function(_0x3cad6f){if(_0x3cad6f){_0x4fed3e=_0x3cad6f;_0x5034af[_0x693d('0x42')]=_[_0x693d('0x45')](db[_0x693d('0x80')]['rawAttributes']);_0x5034af[_0x693d('0x44')]=_[_0x693d('0x45')](_0x20a4ad['query']);_0x5034af['filters']=_[_0x693d('0x46')](_0x5034af[_0x693d('0x42')],_0x5034af['query']);_0x52f696[_0x693d('0x48')]=_[_0x693d('0x46')](_0x5034af[_0x693d('0x42')],qs[_0x693d('0x47')](_0x20a4ad[_0x693d('0x44')][_0x693d('0x47')]));_0x52f696[_0x693d('0x48')]=_0x52f696['attributes']['length']?_0x52f696['attributes']:_0x5034af[_0x693d('0x42')];_0x52f696[_0x693d('0x4b')]=qs[_0x693d('0x4c')](_0x20a4ad['query'][_0x693d('0x4c')]);_0x52f696['where']=qs['filters'](_[_0x693d('0x68')](_0x20a4ad['query'],_0x5034af['filters']));if(_0x20a4ad[_0x693d('0x44')]['filter']){_0x52f696['where']=_[_0x693d('0x4f')](_0x52f696['where'],{'$or':_[_0x693d('0x43')](_0x52f696[_0x693d('0x48')],function(_0x450cde){var _0x2eb849={};_0x2eb849[_0x450cde]={'$like':'%'+_0x20a4ad[_0x693d('0x44')]['filter']+'%'};return _0x2eb849;})});}_0x52f696=_[_0x693d('0x4f')]({},_0x52f696,_0x20a4ad['options']);return _0x4fed3e['getApplications'](_0x52f696);}})[_0x693d('0x1c')](function(_0x5e8655){if(_0x5e8655){_0xe0d54f=_0x5e8655[_0x693d('0x56')];if(!_0x20a4ad[_0x693d('0x44')][_0x693d('0x49')](_0x693d('0x4a'))){_0x52f696[_0x693d('0x2c')]=qs[_0x693d('0x2c')](_0x20a4ad[_0x693d('0x44')]['limit']);_0x52f696[_0x693d('0x2e')]=qs[_0x693d('0x2e')](_0x20a4ad[_0x693d('0x44')][_0x693d('0x2e')]);}return _0x4fed3e[_0x693d('0x84')](_0x52f696);}})[_0x693d('0x1c')](function(_0x27704e){if(_0x27704e){return _0x27704e?{'count':_0xe0d54f,'rows':_0x27704e}:null;}})[_0x693d('0x1c')](respondWithResult(_0x220775,null))[_0x693d('0x27')](handleError(_0x220775,null));};function Extension(_0x6db9f2,_0x172f5f,_0x559c7b,_0x14496e){this['context']=_0x693d('0x85');this[_0x693d('0x86')]=_0x6db9f2[_0x693d('0x87')];this[_0x693d('0x88')]=_0x14496e;this['type']=_0x693d('0x89');this[_0x693d('0x8a')]=_0x693d('0x8b');this['FaxAccountId']=_0x6db9f2['id'];this['priority']=_0x172f5f;this['appdata']=_0x559c7b;}function createExtensionsReciveFax(_0x49ac00){var _0x229886=0x1;var _0x28f686=[];_0x28f686[_0x693d('0x8c')](new Extension(_0x49ac00,_0x229886,'',_0x693d('0x8d')));_0x229886+=0x1;_0x28f686[_0x693d('0x8c')](new Extension(_0x49ac00,_0x229886,_0x693d('0x8e'),_0x693d('0x8f')));_0x229886+=0x1;for(var _0x499099 in _0x49ac00){if(_0x49ac00[_0x693d('0x49')](_0x499099)&&(_0x499099===_0x693d('0x90')||_0x499099===_0x693d('0x87')||_0x499099===_0x693d('0x91')||_0x499099===_0x693d('0x92')||_0x499099===_0x693d('0x93')||_0x499099==='maxrate'||_0x499099===_0x693d('0x94')||_0x499099===_0x693d('0x95')||_0x499099==='t38timeout')){_0x28f686['push'](new Extension(_0x49ac00,_0x229886,'FAXOPT('+_0x499099+')='+_0x49ac00[_0x499099],_0x693d('0x8f')));_0x229886+=0x1;}}_0x28f686[_0x693d('0x8c')](new Extension(_0x49ac00,_0x229886,'6',_0x693d('0x96')));_0x229886+=0x1;_0x28f686[_0x693d('0x8c')](new Extension(_0x49ac00,_0x229886,_0x693d('0x97'),'ReceiveFax'));_0x229886=0x0;return _0x28f686;}exports[_0x693d('0x98')]=function(_0x37dec8,_0x3d906a,_0x41820d){var _0x550c4c;return db[_0x693d('0x7b')][_0x693d('0x7c')](function(_0x1a6bf4){return db['FaxAccount']['create'](_0x37dec8[_0x693d('0x5a')],{'transaction':_0x1a6bf4})[_0x693d('0x1c')](function(_0x351a1e){_0x550c4c=_0x351a1e[_0x693d('0x34')]({'plain':!![]});return db[_0x693d('0x99')]['bulkCreate'](createExtensionsReciveFax(_0x550c4c),{'transaction':_0x1a6bf4});});})[_0x693d('0x1c')](function(){return _0x550c4c;})[_0x693d('0x1c')](respondWithResult(_0x3d906a,null))[_0x693d('0x27')](handleError(_0x3d906a,null));};exports[_0x693d('0x9a')]=function(_0x5b6d99,_0x235205,_0x2f90eb){var _0x24a8dc;return db[_0x693d('0x7b')][_0x693d('0x7c')](function(_0x524039){return db[_0x693d('0x3d')][_0x693d('0x32')](_0x5b6d99[_0x693d('0x5a')],{'where':{'id':_0x5b6d99[_0x693d('0x5a')]['id']},'transaction':_0x524039})[_0x693d('0x1c')](function(_0x13e608){return db['VoiceExtension'][_0x693d('0x33')]({'where':{'FaxAccountId':_0x5b6d99['body']['id']},'transaction':_0x524039})[_0x693d('0x1c')](function(_0x153348){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0x693d('0x72')](_0x5b6d99[_0x693d('0x5a')],[_0x693d('0x9b'),_0x693d('0x41'),_0x693d('0x9c'),_0x693d('0x9d'),_0x693d('0x9e'),_0x693d('0x9f')])),{'transaction':_0x524039});});});})[_0x693d('0x1c')](function(){return db[_0x693d('0x3d')][_0x693d('0xa0')](_0x5b6d99[_0x693d('0x5a')]['id']);})[_0x693d('0x1c')](respondWithResult(_0x235205,null))[_0x693d('0x27')](handleError(_0x235205,null));};exports[_0x693d('0xa1')]=function(_0x26614e,_0x2bd0e5,_0x2320ce){var _0x44db49={'raw':!![],'where':{}};var _0x20e1ca={};var _0x53dfda={'count':0x0,'rows':[]};return db[_0x693d('0x3d')][_0x693d('0x6f')]({'where':{'id':_0x26614e[_0x693d('0x63')]['id']}})['then'](handleEntityNotFound(_0x2bd0e5,null))['then'](function(_0x251e8f){if(_0x251e8f){_0x20e1ca[_0x693d('0x42')]=_['keys'](db[_0x693d('0xa2')][_0x693d('0x3e')]);_0x20e1ca['query']=_['keys'](_0x26614e['query']);_0x20e1ca[_0x693d('0x4e')]=_[_0x693d('0x46')](_0x20e1ca[_0x693d('0x42')],_0x20e1ca[_0x693d('0x44')]);_0x44db49[_0x693d('0x48')]=_[_0x693d('0x46')](_0x20e1ca[_0x693d('0x42')],qs[_0x693d('0x47')](_0x26614e[_0x693d('0x44')][_0x693d('0x47')]));_0x44db49[_0x693d('0x48')]=_0x44db49['attributes']['length']?_0x44db49['attributes']:_0x20e1ca['model'];if(!_0x26614e[_0x693d('0x44')]['hasOwnProperty'](_0x693d('0x4a'))){_0x44db49[_0x693d('0x2c')]=qs['limit'](_0x26614e['query'][_0x693d('0x2c')]);_0x44db49[_0x693d('0x2e')]=qs[_0x693d('0x2e')](_0x26614e[_0x693d('0x44')][_0x693d('0x2e')]);}_0x44db49['order']=qs[_0x693d('0x4c')](_0x26614e[_0x693d('0x44')]['sort']);_0x44db49[_0x693d('0x4d')]=qs[_0x693d('0x4e')](_['pick'](_0x26614e[_0x693d('0x44')],_0x20e1ca[_0x693d('0x4e')]));_0x44db49[_0x693d('0x4d')][_0x693d('0x66')]=_0x251e8f['id'];if(_0x26614e[_0x693d('0x44')]['filter']){_0x44db49['where']=_[_0x693d('0x4f')](_0x44db49[_0x693d('0x4d')],{'$or':_[_0x693d('0x43')](_0x44db49[_0x693d('0x48')],function(_0x98964f){var _0x406301={};_0x406301[_0x98964f]={'$like':'%'+_0x26614e['query']['filter']+'%'};return _0x406301;})});}if(_0x26614e['query'][_0x693d('0xa3')]){var _0x2c4c07=_0x26614e[_0x693d('0x44')][_0x693d('0xa3')][_0x693d('0xa4')](',');var _0x221ad3={};_0x221ad3[_0x2c4c07[0x0]]={'$gte':moment(_0x2c4c07[0x1])[_0x693d('0xa5')](_0x693d('0xa6'))};_0x44db49[_0x693d('0x4d')]=_[_0x693d('0x4f')](_0x44db49[_0x693d('0x4d')],_0x221ad3);}_0x44db49=_[_0x693d('0x4f')]({},_0x44db49,_0x26614e['options']);return db['FaxMessage']['count']({'where':_0x44db49[_0x693d('0x4d')]})['then'](function(_0x1eae80){_0x53dfda[_0x693d('0x2d')]=_0x1eae80;if(_0x26614e[_0x693d('0x44')][_0x693d('0x57')]){_0x44db49[_0x693d('0x52')]=[{'all':!![]}];}return db[_0x693d('0xa2')][_0x693d('0x53')](_0x44db49);})[_0x693d('0x1c')](function(_0x543e7f){_0x53dfda['rows']=_0x543e7f;return _0x53dfda;});}})[_0x693d('0x1c')](respondWithFilteredResult(_0x2bd0e5,_0x44db49))[_0x693d('0x27')](handleError(_0x2bd0e5,null));};exports[_0x693d('0x3a')]=function(_0xb23313,_0x4777b6,_0x1b2dcf){var _0x16a039,_0x1fb24b={},_0xe037c3;if(_0xb23313[_0x693d('0x5a')]['to']){_0xe037c3=_0xb23313[_0x693d('0x5a')]['to'][0x0];}return db['FaxAccount'][_0x693d('0x5f')]({'where':{'id':_0xb23313['params']['id']},'include':[{'model':db['CmList'],'as':_0x693d('0xa7'),'include':[{'model':db[_0x693d('0xa8')],'as':_0x693d('0xa9'),'where':{'fax':_0xe037c3},'limit':0x1,'order':[[_0x693d('0x9d'),_0x693d('0xaa')]]}]}]})['then'](handleEntityNotFound(_0x4777b6,null))[_0x693d('0x1c')](function(_0x3c1441){_0x16a039=_0x3c1441;if(_0xb23313[_0x693d('0x5a')][_0x693d('0xab')]&&_0xb23313[_0x693d('0x5a')][_0x693d('0xab')]['length']){for(var _0x4938ef=0x0;_0x4938ef<_0xb23313[_0x693d('0x5a')][_0x693d('0xab')][_0x693d('0x56')];_0x4938ef+=0x1){_0xb23313[_0x693d('0x5a')]['attachments'][_0x4938ef]={'filename':_0xb23313[_0x693d('0x5a')]['attachments'][_0x4938ef][_0x693d('0x39')],'id':_0xb23313[_0x693d('0x5a')][_0x693d('0xab')][_0x4938ef]['id'],'path':path['join'](config[_0x693d('0xac')],_0x693d('0xad'),_0xb23313['body'][_0x693d('0xab')][_0x4938ef][_0x693d('0xae')])};}}return respondWithRpcPromise('CheckAfterSend',_0x693d('0xaf'),{'FaxAccountId':_[_0x693d('0xb0')](_0xb23313[_0x693d('0x63')]['id'])?undefined:_0xb23313[_0x693d('0x63')]['id'],'path':_['isNil'](_0xb23313[_0x693d('0x5a')][_0x693d('0xab')][0x0]['path'])?undefined:_0xb23313[_0x693d('0x5a')]['attachments'][0x0]['path'],'fax':_[_0x693d('0xb0')](_0xb23313[_0x693d('0x5a')]['to'][0x0])?undefined:_0xb23313[_0x693d('0x5a')]['to'][0x0]},client9002);})['then'](function(){if(_0x16a039){if(_[_0x693d('0xb0')](_0xb23313[_0x693d('0x5a')][_0x693d('0xb1')])){_0xb23313[_0x693d('0x5a')]['from']=util[_0x693d('0xa5')](_0x693d('0xb2'),_0x16a039[_0x693d('0x39')],_0x16a039[_0x693d('0xb3')]);}if(_0x16a039[_0x693d('0xa7')]){if(_0x16a039[_0x693d('0xa7')][_0x693d('0xa9')]['length']){return _0x16a039['List'][_0x693d('0xa9')][0x0];}else{return db[_0x693d('0xa8')]['create'](_[_0x693d('0xb4')](_0xb23313[_0x693d('0x5a')],{'firstName':_0xb23313['body']['to'][0x0],'phone':_0xb23313[_0x693d('0x5a')]['to'][0x0],'fax':_0xb23313[_0x693d('0x5a')]['to'][0x0],'ListId':_0x16a039['ListId']}));}}else{throw new Error(_0x693d('0xb5'));}}else{throw new Error(_0x693d('0xb6'));}})[_0x693d('0x1c')](function(_0x58cf44){if(_0x58cf44){return db['FaxInteraction'][_0x693d('0x5f')]({'where':{'ContactId':_0x58cf44['id'],'closed':![],'FaxAccountId':_0x16a039['id']}})[_0x693d('0x1c')](function(_0x2560ea){if(_0x2560ea){return[_0x2560ea,![]];}return db[_0x693d('0x71')][_0x693d('0x59')]({'UserId':_0xb23313[_0x693d('0x5b')]['id'],'ContactId':_0x58cf44['id'],'FaxAccountId':_0x16a039['id'],'fax':_0xb23313[_0x693d('0x5a')]['to'][0x0],'firstMsgDirection':_0x693d('0xb7'),'Messages':[_[_0x693d('0x4f')](_0xb23313[_0x693d('0x5a')],{'read':![],'body':_0xb23313[_0x693d('0x5a')][_0x693d('0xab')][0x0][_0x693d('0xb8')],'FaxAccountId':_0x16a039['id'],'UserId':_0xb23313[_0x693d('0x5b')]['id'],'ContactId':_0x58cf44['id'],'AttachmentId':_0xb23313['body']['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x693d('0xb9')}]})['then'](function(_0x2a0350){return[_0x2a0350,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x693d('0xba')](function(_0x56f53f,_0x9a377b){if(_0x9a377b){return _0x56f53f;}return db[_0x693d('0xa2')]['create']({'direction':_0x693d('0xb7'),'read':![],'body':_0xb23313['body']['attachments'][0x0]['filename'],'FaxAccountId':_0x16a039['id'],'FaxInteractionId':_0x56f53f['id'],'UserId':_0xb23313['user']['id'],'ContactId':_0x56f53f[_0x693d('0xbb')],'AttachmentId':_0xb23313[_0x693d('0x5a')]['attachments'][0x0]['id']})['then'](function(_0x38b594){_0x56f53f[_0x693d('0xbc')][_0x693d('0xb9')]=[];_0x56f53f[_0x693d('0xbc')][_0x693d('0xb9')][_0x693d('0x8c')](_0x38b594[_0x693d('0xbc')]);return _0x56f53f;});})[_0x693d('0x1c')](function(_0x569b9c){respondWithRpcPromise(_0x693d('0xbd'),'SendFax',{'FaxAccountId':_[_0x693d('0xb0')](_0xb23313[_0x693d('0x63')]['id'])?undefined:_0xb23313['params']['id'],'path':_[_0x693d('0xb0')](_0xb23313['body']['attachments'][0x0][_0x693d('0xbe')])?undefined:_0xb23313[_0x693d('0x5a')][_0x693d('0xab')][0x0][_0x693d('0xbe')],'fax':_[_0x693d('0xb0')](_0xb23313[_0x693d('0x5a')]['to'][0x0])?undefined:_0xb23313[_0x693d('0x5a')]['to'][0x0],'AttachmentId':_0xb23313[_0x693d('0x5a')][_0x693d('0xab')][0x0]['id']},client9002)[_0x693d('0x1c')](function(_0x41eda5){logger[_0x693d('0x1d')]('SendFaxRpc,\x20%s',_0x41eda5);})[_0x693d('0x27')](function(_0x136d73){logger['info'](_0x693d('0xbf'),_0x136d73);});return _0x569b9c;})[_0x693d('0x1c')](respondWithResult(_0x4777b6,null))[_0x693d('0x27')](handleError(_0x4777b6,null));};exports[_0x693d('0xc0')]=function(_0x3b164d,_0x383948,_0x46ff03){return db[_0x693d('0x3d')]['find']({'where':{'id':_0x3b164d[_0x693d('0x63')]['id']}})[_0x693d('0x1c')](handleEntityNotFound(_0x383948,null))[_0x693d('0x1c')](function(_0x4fdc73){if(_0x4fdc73){return _0x4fdc73[_0x693d('0xc0')](_0x3b164d['body'][_0x693d('0x6b')],_[_0x693d('0x72')](_0x3b164d[_0x693d('0x5a')],[_0x693d('0x6b'),'id'])||{})['spread'](function(_0x47bfcf){for(var _0x4b12a2=0x0;_0x4b12a2<_0x3b164d['body'][_0x693d('0x6b')][_0x693d('0x56')];_0x4b12a2+=0x1){socket[_0x693d('0xc1')](_0x693d('0xc2'),{'UserId':Number(_0x3b164d['body']['ids'][_0x4b12a2]),'FaxAccountId':Number(_0x3b164d[_0x693d('0x63')]['id'])});}return _0x47bfcf;});}})['then'](respondWithResult(_0x383948,null))['catch'](handleError(_0x383948,null));};exports['removeAgents']=function(_0x374c4f,_0x3b26cb,_0x507042){return db[_0x693d('0x3d')][_0x693d('0x5f')]({'where':{'id':_0x374c4f['params']['id']}})['then'](handleEntityNotFound(_0x3b26cb,null))[_0x693d('0x1c')](function(_0x5df136){if(_0x5df136){return _0x5df136[_0x693d('0xc3')](_0x374c4f[_0x693d('0x44')][_0x693d('0x6b')])[_0x693d('0x1c')](function(){if(_[_0x693d('0xc4')](_0x374c4f[_0x693d('0x44')]['ids'])){for(var _0x13fee2=0x0;_0x13fee2<_0x374c4f[_0x693d('0x44')]['ids'][_0x693d('0x56')];_0x13fee2+=0x1){socket[_0x693d('0xc1')](_0x693d('0xc5'),{'UserId':Number(_0x374c4f[_0x693d('0x44')][_0x693d('0x6b')][_0x13fee2]),'FaxAccountId':Number(_0x374c4f[_0x693d('0x63')]['id'])});}}else{socket[_0x693d('0xc1')](_0x693d('0xc5'),{'UserId':Number(_0x374c4f['query'][_0x693d('0x6b')]),'FaxAccountId':Number(_0x374c4f[_0x693d('0x63')]['id'])});}});}})['then'](respondWithStatusCode(_0x3b26cb,null))[_0x693d('0x27')](handleError(_0x3b26cb,null));};exports[_0x693d('0xc6')]=function(_0x5ae70b,_0x96fded,_0x49a573){var _0x270cb3={};var _0x3374f3={};var _0x5ea3dd;var _0x48822e;return db[_0x693d('0x3d')]['findOne']({'where':{'id':_0x5ae70b[_0x693d('0x63')]['id']}})['then'](handleEntityNotFound(_0x96fded,null))[_0x693d('0x1c')](function(_0x2bab92){if(_0x2bab92){_0x5ea3dd=_0x2bab92;_0x3374f3['model']=_['keys'](db[_0x693d('0x75')][_0x693d('0x3e')]);_0x3374f3[_0x693d('0x44')]=_[_0x693d('0x45')](_0x5ae70b['query']);_0x3374f3[_0x693d('0x4e')]=_[_0x693d('0x46')](_0x3374f3[_0x693d('0x42')],_0x3374f3['query']);_0x270cb3[_0x693d('0x48')]=_['intersection'](_0x3374f3[_0x693d('0x42')],qs[_0x693d('0x47')](_0x5ae70b[_0x693d('0x44')][_0x693d('0x47')]));_0x270cb3['attributes']=_0x270cb3[_0x693d('0x48')][_0x693d('0x56')]?_0x270cb3[_0x693d('0x48')]:_0x3374f3['model'];_0x270cb3['order']=qs[_0x693d('0x4c')](_0x5ae70b[_0x693d('0x44')]['sort']);_0x270cb3[_0x693d('0x4d')]=qs[_0x693d('0x4e')](_['pick'](_0x5ae70b[_0x693d('0x44')],_0x3374f3['filters']));if(_0x5ae70b['query']['filter']){_0x270cb3[_0x693d('0x4d')]=_['merge'](_0x270cb3['where'],{'$or':_['map'](_0x270cb3[_0x693d('0x48')],function(_0x27fc3a){var _0x1137b3={};_0x1137b3[_0x27fc3a]={'$like':'%'+_0x5ae70b[_0x693d('0x44')][_0x693d('0x51')]+'%'};return _0x1137b3;})});}_0x270cb3=_[_0x693d('0x4f')]({},_0x270cb3,_0x5ae70b[_0x693d('0x58')]);return _0x5ea3dd['getAgents'](_0x270cb3);}})[_0x693d('0x1c')](function(_0x105a8a){if(_0x105a8a){_0x48822e=_0x105a8a[_0x693d('0x56')];if(!_0x5ae70b[_0x693d('0x44')][_0x693d('0x49')](_0x693d('0x4a'))){_0x270cb3['limit']=qs[_0x693d('0x2c')](_0x5ae70b[_0x693d('0x44')]['limit']);_0x270cb3[_0x693d('0x2e')]=qs[_0x693d('0x2e')](_0x5ae70b[_0x693d('0x44')][_0x693d('0x2e')]);}return _0x5ea3dd[_0x693d('0xc6')](_0x270cb3);}})[_0x693d('0x1c')](function(_0x5c33d3){if(_0x5c33d3){return _0x5c33d3?{'count':_0x48822e,'rows':_0x5c33d3}:null;}})[_0x693d('0x1c')](respondWithResult(_0x96fded,null))[_0x693d('0x27')](handleError(_0x96fded,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index ef93005..067d4d9 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 _0xe36a=['FaxAccount','setMaxListeners','save','emit','hasOwnProperty','exports'];(function(_0x5cc118,_0x479136){var _0x87ff2b=function(_0x2e3aa7){while(--_0x2e3aa7){_0x5cc118['push'](_0x5cc118['shift']());}};_0x87ff2b(++_0x479136);}(_0xe36a,0xc0));var _0xae36=function(_0x303c30,_0x16edcb){_0x303c30=_0x303c30-0x0;var _0x43161b=_0xe36a[_0x303c30];return _0x43161b;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db'][_0xae36('0x0')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xae36('0x1')](0x0);var events={'afterCreate':_0xae36('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xd20505){return function(_0x4540aa,_0x3308c4,_0x456a09){FaxAccountEvents[_0xae36('0x3')](_0xd20505+':'+_0x4540aa['id'],_0x4540aa);FaxAccountEvents[_0xae36('0x3')](_0xd20505,_0x4540aa);_0x456a09(null);};}for(var e in events){if(events[_0xae36('0x4')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xae36('0x5')]=FaxAccountEvents; \ No newline at end of file +var _0x5d30=['../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x1b3c93,_0x3a6456){var _0x1e4b5b=function(_0x3a97c5){while(--_0x3a97c5){_0x1b3c93['push'](_0x1b3c93['shift']());}};_0x1e4b5b(++_0x3a6456);}(_0x5d30,0x135));var _0x05d3=function(_0x44e00a,_0x248bbc){_0x44e00a=_0x44e00a-0x0;var _0x2bdfba=_0x5d30[_0x44e00a];return _0x2bdfba;};'use strict';var EventEmitter=require(_0x05d3('0x0'));var FaxAccount=require(_0x05d3('0x1'))['db'][_0x05d3('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x05d3('0x3')](0x0);var events={'afterCreate':_0x05d3('0x4'),'afterUpdate':_0x05d3('0x5'),'afterDestroy':_0x05d3('0x6')};function emitEvent(_0x472da5){return function(_0x21f06e,_0x14e388,_0x103bfb){FaxAccountEvents[_0x05d3('0x7')](_0x472da5+':'+_0x21f06e['id'],_0x21f06e);FaxAccountEvents['emit'](_0x472da5,_0x21f06e);_0x103bfb(null);};}for(var e in events){if(events[_0x05d3('0x8')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x05d3('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 ed32864..84c35c7 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 _0xbd83=['request-promise','path','rimraf','./faxAccount.attributes','define','FaxAccount','fax_accounts','lodash','util','api','moment','bluebird'];(function(_0x52e625,_0x4a38f3){var _0x2da7f6=function(_0x1112b4){while(--_0x1112b4){_0x52e625['push'](_0x52e625['shift']());}};_0x2da7f6(++_0x4a38f3);}(_0xbd83,0x97));var _0x3bd8=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xbd83[_0x2112d4];return _0x434972;};'use strict';var _=require(_0x3bd8('0x0'));var util=require(_0x3bd8('0x1'));var logger=require('../../config/logger')(_0x3bd8('0x2'));var moment=require(_0x3bd8('0x3'));var BPromise=require(_0x3bd8('0x4'));var rp=require(_0x3bd8('0x5'));var fs=require('fs');var path=require(_0x3bd8('0x6'));var rimraf=require(_0x3bd8('0x7'));var config=require('../../config/environment');var attributes=require(_0x3bd8('0x8'));module['exports']=function(_0x115678,_0x5dc9ae){return _0x115678[_0x3bd8('0x9')](_0x3bd8('0xa'),attributes,{'tableName':_0x3bd8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba22=['lodash','util','../../config/logger','bluebird','path','rimraf','./faxAccount.attributes','exports','define','fax_accounts'];(function(_0x2f8c59,_0x4248e5){var _0x2b4a05=function(_0x5c6605){while(--_0x5c6605){_0x2f8c59['push'](_0x2f8c59['shift']());}};_0x2b4a05(++_0x4248e5);}(_0xba22,0x10e));var _0x2ba2=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xba22[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x2ba2('0x0'));var util=require(_0x2ba2('0x1'));var logger=require(_0x2ba2('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2ba2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ba2('0x4'));var rimraf=require(_0x2ba2('0x5'));var config=require('../../config/environment');var attributes=require(_0x2ba2('0x6'));module[_0x2ba2('0x7')]=function(_0x186cd6,_0x111696){return _0x186cd6[_0x2ba2('0x8')]('FaxAccount',attributes,{'tableName':_0x2ba2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index dd66937..c3b1657 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 _0x2fae=['from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','CmList','CmContact','FaxApplication','Applications','account','applications','list','List','orderBy','priority','asc','Contacts','length','ListId','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','User','name','waitForTheAssignedAgent','queueId','FaxQueue','unshift','queue','Start','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','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','raw','where','attributes','include','map','model','body','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','from'];(function(_0x360a27,_0x4afe5e){var _0x5b9d9e=function(_0xa80572){while(--_0xa80572){_0x360a27['push'](_0x360a27['shift']());}};_0x5b9d9e(++_0x4afe5e);}(_0x2fae,0xd9));var _0xe2fa=function(_0x474195,_0x1e77a5){_0x474195=_0x474195-0x0;var _0x104cf2=_0x2fae[_0x474195];return _0x104cf2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe2fa('0x0'));var rs=require(_0xe2fa('0x1'));var fs=require('fs');var Redis=require(_0xe2fa('0x2'));var db=require(_0xe2fa('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe2fa('0x4'))('rpc');var config=require(_0xe2fa('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe2fa('0x6')][_0xe2fa('0x7')]({'port':0x232c});config[_0xe2fa('0x8')]=_[_0xe2fa('0x9')](config[_0xe2fa('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xe2fa('0xa'))(new Redis(config[_0xe2fa('0x8')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x35c55a,_0x2f57a2,_0x2bfe6e){return new BPromise(function(_0x146fa9,_0x3d29b6){return client[_0xe2fa('0xb')](_0x35c55a,_0x2bfe6e)[_0xe2fa('0xc')](function(_0x40793e){logger[_0xe2fa('0xd')](_0xe2fa('0xe'),_0x2f57a2,_0xe2fa('0xf'));logger['debug'](_0xe2fa('0x10'),_0x2f57a2,_0xe2fa('0xf'),JSON[_0xe2fa('0x11')](_0x40793e));if(_0x40793e[_0xe2fa('0x12')]){if(_0x40793e[_0xe2fa('0x12')][_0xe2fa('0x13')]===0x1f4){logger[_0xe2fa('0x12')]('FaxAccount,\x20%s,\x20%s',_0x2f57a2,_0x40793e['error'][_0xe2fa('0x14')]);return _0x3d29b6(_0x40793e[_0xe2fa('0x12')][_0xe2fa('0x14')]);}logger[_0xe2fa('0x12')](_0xe2fa('0xe'),_0x2f57a2,_0x40793e[_0xe2fa('0x12')]['message']);return _0x146fa9(_0x40793e[_0xe2fa('0x12')]['message']);}else{logger[_0xe2fa('0xd')](_0xe2fa('0xe'),_0x2f57a2,_0xe2fa('0xf'));_0x146fa9(_0x40793e[_0xe2fa('0x15')][_0xe2fa('0x14')]);}})[_0xe2fa('0x16')](function(_0x64996){logger[_0xe2fa('0x12')](_0xe2fa('0xe'),_0x2f57a2,_0x64996);_0x3d29b6(_0x64996);});});}exports[_0xe2fa('0x17')]=function(_0x37a550){var _0x5262c6=this;return new Promise(function(_0x52ee83,_0x46d421){return db['FaxAccount'][_0xe2fa('0x18')]({'raw':_0x37a550['options']?_0x37a550[_0xe2fa('0x19')][_0xe2fa('0x1a')]===undefined?!![]:![]:!![],'where':_0x37a550[_0xe2fa('0x19')]?_0x37a550[_0xe2fa('0x19')][_0xe2fa('0x1b')]||null:null,'attributes':_0x37a550[_0xe2fa('0x19')]?_0x37a550[_0xe2fa('0x19')][_0xe2fa('0x1c')]||null:null,'limit':_0x37a550[_0xe2fa('0x19')]?_0x37a550[_0xe2fa('0x19')]['limit']||null:null,'include':_0x37a550[_0xe2fa('0x19')]?_0x37a550[_0xe2fa('0x19')][_0xe2fa('0x1d')]?_[_0xe2fa('0x1e')](_0x37a550['options'][_0xe2fa('0x1d')],function(_0x311461){return{'model':db[_0x311461[_0xe2fa('0x1f')]],'as':_0x311461['as'],'attributes':_0x311461[_0xe2fa('0x1c')],'include':_0x311461[_0xe2fa('0x1d')]?_[_0xe2fa('0x1e')](_0x311461['include'],function(_0x2d0f9f){return{'model':db[_0x2d0f9f[_0xe2fa('0x1f')]],'as':_0x2d0f9f['as'],'attributes':_0x2d0f9f['attributes'],'include':_0x2d0f9f['include']?_[_0xe2fa('0x1e')](_0x2d0f9f[_0xe2fa('0x1d')],function(_0x59b320){return{'model':db[_0x59b320[_0xe2fa('0x1f')]],'as':_0x59b320['as'],'attributes':_0x59b320[_0xe2fa('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe2fa('0xc')](function(_0x4b6b7c){logger[_0xe2fa('0xd')](_0xe2fa('0x17'),_0x37a550);logger['debug'](_0xe2fa('0x17'),_0x37a550,JSON[_0xe2fa('0x11')](_0x4b6b7c));_0x52ee83(_0x4b6b7c);})[_0xe2fa('0x16')](function(_0x4ab439){logger[_0xe2fa('0x12')](_0xe2fa('0x17'),_0x4ab439[_0xe2fa('0x14')],_0x37a550);_0x46d421(_0x5262c6['error'](0x1f4,_0x4ab439[_0xe2fa('0x14')]));});});};exports['NotifyFaxAccount']=function(_0xf8be0c,_0x10e194,_0x337b3b){var _0x23368a=this;return new Promise(function(_0x28a662,_0x41e6b3){var _0x56f727={'body':_0xf8be0c[_0xe2fa('0x20')],'channel':_0xe2fa('0x21')};var _0x2f7397=[];var _0x189f91=[];var _0x1afe46={};return db['CmContact'][_0xe2fa('0x22')]()[_0xe2fa('0xc')](function(_0x33b0c3){if(!_0x33b0c3){throw new db[(_0xe2fa('0x23'))][(_0xe2fa('0x24'))](_0xe2fa('0x25'));}_0x2f7397=_[_0xe2fa('0x26')](_[_0xe2fa('0x27')](_0x33b0c3),[_0xe2fa('0x28'),'updatedAt']);_0x189f91=_[_0xe2fa('0x26')](_['keys'](_0x33b0c3),[_0xe2fa('0x28'),_0xe2fa('0x29'),_0xe2fa('0x2a'),'ListId']);if(_0xf8be0c['body']['id']){delete _0xf8be0c[_0xe2fa('0x20')]['id'];}if(_['isNil'](_0xf8be0c[_0xe2fa('0x20')][_0xe2fa('0x2b')])){throw new db['Sequelize'][(_0xe2fa('0x24'))](_0xe2fa('0x2c'));}if(_[_0xe2fa('0x2d')](_0xf8be0c['body'][_0xe2fa('0x20')])||_0xf8be0c[_0xe2fa('0x20')][_0xe2fa('0x20')]===''){throw new db[(_0xe2fa('0x23'))]['ValidationError'](_0xe2fa('0x2e'));}if(_[_0xe2fa('0x2d')](_0xf8be0c['body'][_0xe2fa('0x2f')])){throw new db['Sequelize'][(_0xe2fa('0x24'))](_0xe2fa('0x30')+_0x189f91);}if(!_[_0xe2fa('0x31')](_0x189f91,_0xf8be0c[_0xe2fa('0x20')][_0xe2fa('0x2f')])){throw new db[(_0xe2fa('0x23'))][(_0xe2fa('0x24'))](_0xe2fa('0x32')+_0x189f91);}_0x1afe46[_0xf8be0c[_0xe2fa('0x20')][_0xe2fa('0x2f')]]=_0xf8be0c[_0xe2fa('0x20')][_0xe2fa('0x2b')];})[_0xe2fa('0xc')](function(){return db[_0xe2fa('0x33')][_0xe2fa('0x34')]({'where':{'id':_0xf8be0c['account']['id']},'include':[{'model':db[_0xe2fa('0x35')],'as':'List','include':[{'model':db[_0xe2fa('0x36')],'as':'Contacts','where':_0x1afe46,'limit':0x1,'order':[[_0xe2fa('0x29'),'DESC']]}]},{'model':db[_0xe2fa('0x37')],'as':_0xe2fa('0x38')}]});})[_0xe2fa('0xc')](function(_0x43867a){if(_0x43867a&&_0x43867a['List']){var _0x3071ed=_0x43867a['get']({'plain':!![]});_0x56f727[_0xe2fa('0x39')]=_0x3071ed;_0x56f727[_0xe2fa('0x3a')]=_0x3071ed[_0xe2fa('0x38')];_0x56f727[_0xe2fa('0x3b')]=_0x3071ed[_0xe2fa('0x3c')];_0x56f727[_0xe2fa('0x3a')]=_[_0xe2fa('0x3d')](_0x56f727['applications'],[_0xe2fa('0x3e')],[_0xe2fa('0x3f')]);if(_0x56f727[_0xe2fa('0x39')]['Applications']){delete _0x56f727[_0xe2fa('0x39')][_0xe2fa('0x38')];}if(_0x56f727[_0xe2fa('0x39')][_0xe2fa('0x3c')]&&_0x56f727[_0xe2fa('0x39')][_0xe2fa('0x3c')][_0xe2fa('0x40')][_0xe2fa('0x41')]){return _0x56f727[_0xe2fa('0x39')][_0xe2fa('0x3c')]['Contacts'][0x0];}var _0x243a7e=_[_0xe2fa('0x9')](_0xf8be0c['body'],{'firstName':_0xf8be0c['body'][_0xe2fa('0x2b')],'ListId':_0x3071ed[_0xe2fa('0x42')]});_0x243a7e[_0xf8be0c['body'][_0xe2fa('0x2f')]]=_0xf8be0c[_0xe2fa('0x20')]['from'];return db[_0xe2fa('0x36')][_0xe2fa('0x43')](_0x243a7e,{'fields':_0x2f7397,'raw':!![]});}})['then'](function(_0x249501){_0x56f727[_0xe2fa('0x44')]=_0x249501;if(_0x249501){var _0x5989d5={'ContactId':_0x249501['id'],'FaxAccountId':_0xf8be0c[_0xe2fa('0x39')]['id'],'fax':_0x249501[_0xe2fa('0x21')]};return db[_0xe2fa('0x45')]['find']({'where':{'ContactId':_0x249501['id'],'closed':![],'FaxAccountId':_0xf8be0c[_0xe2fa('0x39')]['id']}})['then'](function(_0x1c22e0){if(_0x1c22e0){return[_0x1c22e0,![]];}return db[_0xe2fa('0x45')][_0xe2fa('0x43')](_0x5989d5)[_0xe2fa('0xc')](function(_0x308936){return[_0x308936,!![]];});});}else{throw new Error(_0xe2fa('0x46'));}})[_0xe2fa('0x47')](function(_0x347a13,_0x13d288){var _0x2f4e8c=_0x347a13['get']({'plain':!![]});if(_0x13d288){if(_0x56f727[_0xe2fa('0x39')]['autoclose']){_0x56f727['applications'][_0xe2fa('0x48')]({'id':0x0,'priority':_0x56f727[_0xe2fa('0x3a')][_0xe2fa('0x41')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xe2fa('0x49')});}_0x2f4e8c[_0xe2fa('0x4a')]=!![];}else{_0x2f4e8c[_0xe2fa('0x4a')]=![];}_0x56f727[_0xe2fa('0x4b')]=_0x2f4e8c;return db['FaxMessage']['create']({'body':_0xf8be0c[_0xe2fa('0x20')][_0xe2fa('0x20')],'FaxAccountId':_0xf8be0c[_0xe2fa('0x39')]['id'],'FaxInteractionId':_0x347a13['id'],'direction':'in','ContactId':_0x347a13[_0xe2fa('0x4c')],'AttachmentId':_0xf8be0c[_0xe2fa('0x20')][_0xe2fa('0x4d')]});})[_0xe2fa('0xc')](function(_0x40c558){_0x56f727[_0xe2fa('0x14')]=_0x40c558;if(!_0x56f727['interaction'][_0xe2fa('0x4e')])return;return db[_0xe2fa('0x4f')][_0xe2fa('0x34')]({'attributes':['id',_0xe2fa('0x50')],'where':{'id':_0x56f727[_0xe2fa('0x4b')]['UserId']}});})[_0xe2fa('0xc')](function(_0x4f788d){if(_0x4f788d){_0x56f727[_0xe2fa('0x3a')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4f788d['name']+','+(_0x56f727[_0xe2fa('0x39')][_0xe2fa('0x51')]||0xa),'interval':_0xe2fa('0x49')});}if(!_0x56f727[_0xe2fa('0x4b')][_0xe2fa('0x52')])return;return db[_0xe2fa('0x53')][_0xe2fa('0x34')]({'attributes':['id',_0xe2fa('0x50')],'where':{'id':_0x56f727[_0xe2fa('0x4b')][_0xe2fa('0x52')]}});})['then'](function(_0x573154){if(_0x573154){_0x56f727['applications'][_0xe2fa('0x54')]({'id':0x0,'priority':0x1,'app':_0xe2fa('0x55'),'appdata':_0x573154[_0xe2fa('0x50')]+','+(_0x56f727[_0xe2fa('0x39')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xe2fa('0x56'),'startRouting',_0x56f727);})['then'](function(_0x4fa6d8){_0x28a662(_0x4fa6d8);})[_0xe2fa('0x16')](function(_0x4d3f3a){_0x41e6b3(_0x23368a['error'](0x1f4,_0x4d3f3a[_0xe2fa('0x14')]));});});}; \ No newline at end of file +var _0x543f=['raw','where','attributes','limit','map','include','model','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','difference','updatedAt','CompanyId','body','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','FaxAccount','find','account','CmList','List','Contacts','DESC','Applications','get','applications','orderBy','priority','asc','length','ListId','create','FaxInteraction','spread','autoclose','push','close','FaxMessage','ContactId','interaction','UserId','User','name','waitForTheAssignedAgent','*,*,*,*','queueId','unshift','queue','Start','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetFaxAccount','findAll','options'];(function(_0xeb4849,_0x21d281){var _0x5006c2=function(_0x4db46d){while(--_0x4db46d){_0xeb4849['push'](_0xeb4849['shift']());}};_0x5006c2(++_0x21d281);}(_0x543f,0xee));var _0xf543=function(_0x4f6e60,_0x489974){_0x4f6e60=_0x4f6e60-0x0;var _0x19cc6c=_0x543f[_0x4f6e60];return _0x19cc6c;};'use strict';var _=require(_0xf543('0x0'));var util=require(_0xf543('0x1'));var moment=require(_0xf543('0x2'));var BPromise=require(_0xf543('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf543('0x4'));var db=require(_0xf543('0x5'))['db'];var utils=require(_0xf543('0x6'));var logger=require(_0xf543('0x7'))(_0xf543('0x8'));var config=require('../../config/environment');var jayson=require(_0xf543('0x9'));var client=jayson['client'][_0xf543('0xa')]({'port':0x232c});config[_0xf543('0xb')]=_[_0xf543('0xc')](config[_0xf543('0xb')],{'host':_0xf543('0xd'),'port':0x18eb});var socket=require(_0xf543('0xe'))(new Redis(config[_0xf543('0xb')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x2fbb38,_0x1e4bf3,_0x37cfd3){return new BPromise(function(_0xce6ca0,_0x482d2e){return client[_0xf543('0xf')](_0x2fbb38,_0x37cfd3)[_0xf543('0x10')](function(_0xbf19e0){logger[_0xf543('0x11')](_0xf543('0x12'),_0x1e4bf3,_0xf543('0x13'));logger[_0xf543('0x14')](_0xf543('0x15'),_0x1e4bf3,_0xf543('0x13'),JSON[_0xf543('0x16')](_0xbf19e0));if(_0xbf19e0[_0xf543('0x17')]){if(_0xbf19e0[_0xf543('0x17')]['code']===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x1e4bf3,_0xbf19e0[_0xf543('0x17')][_0xf543('0x18')]);return _0x482d2e(_0xbf19e0['error']['message']);}logger['error'](_0xf543('0x12'),_0x1e4bf3,_0xbf19e0[_0xf543('0x17')][_0xf543('0x18')]);return _0xce6ca0(_0xbf19e0[_0xf543('0x17')]['message']);}else{logger[_0xf543('0x11')](_0xf543('0x12'),_0x1e4bf3,_0xf543('0x13'));_0xce6ca0(_0xbf19e0['result'][_0xf543('0x18')]);}})[_0xf543('0x19')](function(_0x2485da){logger[_0xf543('0x17')](_0xf543('0x12'),_0x1e4bf3,_0x2485da);_0x482d2e(_0x2485da);});});}exports[_0xf543('0x1a')]=function(_0x4c4246){var _0x1a6493=this;return new Promise(function(_0x5a2c39,_0x9c7c8e){return db['FaxAccount'][_0xf543('0x1b')]({'raw':_0x4c4246['options']?_0x4c4246[_0xf543('0x1c')][_0xf543('0x1d')]===undefined?!![]:![]:!![],'where':_0x4c4246[_0xf543('0x1c')]?_0x4c4246[_0xf543('0x1c')][_0xf543('0x1e')]||null:null,'attributes':_0x4c4246['options']?_0x4c4246[_0xf543('0x1c')][_0xf543('0x1f')]||null:null,'limit':_0x4c4246[_0xf543('0x1c')]?_0x4c4246['options'][_0xf543('0x20')]||null:null,'include':_0x4c4246[_0xf543('0x1c')]?_0x4c4246[_0xf543('0x1c')]['include']?_[_0xf543('0x21')](_0x4c4246['options'][_0xf543('0x22')],function(_0x1839de){return{'model':db[_0x1839de[_0xf543('0x23')]],'as':_0x1839de['as'],'attributes':_0x1839de['attributes'],'include':_0x1839de[_0xf543('0x22')]?_[_0xf543('0x21')](_0x1839de[_0xf543('0x22')],function(_0x58bc8b){return{'model':db[_0x58bc8b[_0xf543('0x23')]],'as':_0x58bc8b['as'],'attributes':_0x58bc8b[_0xf543('0x1f')],'include':_0x58bc8b['include']?_['map'](_0x58bc8b['include'],function(_0x10a946){return{'model':db[_0x10a946[_0xf543('0x23')]],'as':_0x10a946['as'],'attributes':_0x10a946[_0xf543('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x171cce){logger[_0xf543('0x11')](_0xf543('0x1a'),_0x4c4246);logger[_0xf543('0x14')](_0xf543('0x1a'),_0x4c4246,JSON[_0xf543('0x16')](_0x171cce));_0x5a2c39(_0x171cce);})[_0xf543('0x19')](function(_0x3d7290){logger[_0xf543('0x17')](_0xf543('0x1a'),_0x3d7290[_0xf543('0x18')],_0x4c4246);_0x9c7c8e(_0x1a6493[_0xf543('0x17')](0x1f4,_0x3d7290['message']));});});};exports[_0xf543('0x24')]=function(_0x4025e5,_0x43bc98,_0x27bfee){var _0x275e44=this;return new Promise(function(_0xca775c,_0x12a103){var _0x436b2b={'body':_0x4025e5['body'],'channel':_0xf543('0x25')};var _0x3ddbe8=[];var _0x275190=[];var _0x3a8f72={};return db[_0xf543('0x26')][_0xf543('0x27')]()[_0xf543('0x10')](function(_0x103423){if(!_0x103423){throw new db[(_0xf543('0x28'))][(_0xf543('0x29'))](_0xf543('0x2a'));}_0x3ddbe8=_['difference'](_[_0xf543('0x2b')](_0x103423),[_0xf543('0x2c'),'updatedAt']);_0x275190=_[_0xf543('0x2d')](_[_0xf543('0x2b')](_0x103423),[_0xf543('0x2c'),_0xf543('0x2e'),_0xf543('0x2f'),'ListId']);if(_0x4025e5[_0xf543('0x30')]['id']){delete _0x4025e5[_0xf543('0x30')]['id'];}if(_['isNil'](_0x4025e5['body'][_0xf543('0x31')])){throw new db['Sequelize'][(_0xf543('0x29'))]('from\x20is\x20mandatory');}if(_[_0xf543('0x32')](_0x4025e5[_0xf543('0x30')][_0xf543('0x30')])||_0x4025e5[_0xf543('0x30')][_0xf543('0x30')]===''){throw new db[(_0xf543('0x28'))]['ValidationError'](_0xf543('0x33'));}if(_[_0xf543('0x32')](_0x4025e5[_0xf543('0x30')]['mapKey'])){throw new db[(_0xf543('0x28'))][(_0xf543('0x29'))](_0xf543('0x34')+_0x275190);}if(!_[_0xf543('0x35')](_0x275190,_0x4025e5[_0xf543('0x30')]['mapKey'])){throw new db[(_0xf543('0x28'))][(_0xf543('0x29'))](_0xf543('0x36')+_0x275190);}_0x3a8f72[_0x4025e5['body'][_0xf543('0x37')]]=_0x4025e5['body'][_0xf543('0x31')];})[_0xf543('0x10')](function(){return db[_0xf543('0x38')][_0xf543('0x39')]({'where':{'id':_0x4025e5[_0xf543('0x3a')]['id']},'include':[{'model':db[_0xf543('0x3b')],'as':_0xf543('0x3c'),'include':[{'model':db[_0xf543('0x26')],'as':_0xf543('0x3d'),'where':_0x3a8f72,'limit':0x1,'order':[[_0xf543('0x2e'),_0xf543('0x3e')]]}]},{'model':db['FaxApplication'],'as':_0xf543('0x3f')}]});})[_0xf543('0x10')](function(_0x486492){if(_0x486492&&_0x486492[_0xf543('0x3c')]){var _0x46703f=_0x486492[_0xf543('0x40')]({'plain':!![]});_0x436b2b[_0xf543('0x3a')]=_0x46703f;_0x436b2b[_0xf543('0x41')]=_0x46703f[_0xf543('0x3f')];_0x436b2b['list']=_0x46703f['List'];_0x436b2b[_0xf543('0x41')]=_[_0xf543('0x42')](_0x436b2b['applications'],[_0xf543('0x43')],[_0xf543('0x44')]);if(_0x436b2b[_0xf543('0x3a')][_0xf543('0x3f')]){delete _0x436b2b[_0xf543('0x3a')][_0xf543('0x3f')];}if(_0x436b2b[_0xf543('0x3a')][_0xf543('0x3c')]&&_0x436b2b[_0xf543('0x3a')][_0xf543('0x3c')][_0xf543('0x3d')][_0xf543('0x45')]){return _0x436b2b[_0xf543('0x3a')][_0xf543('0x3c')][_0xf543('0x3d')][0x0];}var _0x53c0bb=_[_0xf543('0xc')](_0x4025e5['body'],{'firstName':_0x4025e5[_0xf543('0x30')][_0xf543('0x31')],'ListId':_0x46703f[_0xf543('0x46')]});_0x53c0bb[_0x4025e5[_0xf543('0x30')]['mapKey']]=_0x4025e5[_0xf543('0x30')][_0xf543('0x31')];return db[_0xf543('0x26')][_0xf543('0x47')](_0x53c0bb,{'fields':_0x3ddbe8,'raw':!![]});}})[_0xf543('0x10')](function(_0x29cf91){_0x436b2b['contact']=_0x29cf91;if(_0x29cf91){var _0x23c215={'ContactId':_0x29cf91['id'],'FaxAccountId':_0x4025e5[_0xf543('0x3a')]['id'],'fax':_0x29cf91[_0xf543('0x25')]};return db[_0xf543('0x48')]['find']({'where':{'ContactId':_0x29cf91['id'],'closed':![],'FaxAccountId':_0x4025e5[_0xf543('0x3a')]['id']}})[_0xf543('0x10')](function(_0xc1bc23){if(_0xc1bc23){return[_0xc1bc23,![]];}return db['FaxInteraction'][_0xf543('0x47')](_0x23c215)[_0xf543('0x10')](function(_0x468a73){return[_0x468a73,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xf543('0x49')](function(_0x165932,_0x20f92e){var _0x21a299=_0x165932[_0xf543('0x40')]({'plain':!![]});if(_0x20f92e){if(_0x436b2b[_0xf543('0x3a')][_0xf543('0x4a')]){_0x436b2b[_0xf543('0x41')][_0xf543('0x4b')]({'id':0x0,'priority':_0x436b2b[_0xf543('0x41')]['length']+0x1,'app':_0xf543('0x4c'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x21a299['created']=!![];}else{_0x21a299['created']=![];}_0x436b2b['interaction']=_0x21a299;return db[_0xf543('0x4d')][_0xf543('0x47')]({'body':_0x4025e5[_0xf543('0x30')][_0xf543('0x30')],'FaxAccountId':_0x4025e5['account']['id'],'FaxInteractionId':_0x165932['id'],'direction':'in','ContactId':_0x165932[_0xf543('0x4e')],'AttachmentId':_0x4025e5['body']['AttachmentId']});})['then'](function(_0x52ecaf){_0x436b2b['message']=_0x52ecaf;if(!_0x436b2b[_0xf543('0x4f')][_0xf543('0x50')])return;return db[_0xf543('0x51')][_0xf543('0x39')]({'attributes':['id',_0xf543('0x52')],'where':{'id':_0x436b2b['interaction']['UserId']}});})['then'](function(_0x49f548){if(_0x49f548){_0x436b2b[_0xf543('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x49f548[_0xf543('0x52')]+','+(_0x436b2b[_0xf543('0x3a')][_0xf543('0x53')]||0xa),'interval':_0xf543('0x54')});}if(!_0x436b2b[_0xf543('0x4f')]['queueId'])return;return db['FaxQueue'][_0xf543('0x39')]({'attributes':['id',_0xf543('0x52')],'where':{'id':_0x436b2b[_0xf543('0x4f')][_0xf543('0x55')]}});})[_0xf543('0x10')](function(_0x4df651){if(_0x4df651){_0x436b2b[_0xf543('0x41')][_0xf543('0x56')]({'id':0x0,'priority':0x1,'app':_0xf543('0x57'),'appdata':_0x4df651[_0xf543('0x52')]+','+(_0x436b2b[_0xf543('0x3a')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xf543('0x58'),'startRouting',_0x436b2b);})[_0xf543('0x10')](function(_0x260b10){_0xca775c(_0x260b10);})[_0xf543('0x19')](function(_0x612957){_0x12a103(_0x275e44[_0xf543('0x17')](0x1f4,_0x612957['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 3657f6e..4de3eb3 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 _0xd900=['update','emit','register','length','faxAccount:','./faxAccount.events','remove'];(function(_0x21b971,_0x3f1a28){var _0x4d39ac=function(_0x2b0d3a){while(--_0x2b0d3a){_0x21b971['push'](_0x21b971['shift']());}};_0x4d39ac(++_0x3f1a28);}(_0xd900,0xd7));var _0x0d90=function(_0x55d893,_0x325ebe){_0x55d893=_0x55d893-0x0;var _0x52d152=_0xd900[_0x55d893];return _0x52d152;};'use strict';var FaxAccountEvents=require(_0x0d90('0x0'));var events=['save',_0x0d90('0x1'),_0x0d90('0x2')];function createListener(_0x13390b,_0x322572){return function(_0x3c7226){_0x322572[_0x0d90('0x3')](_0x13390b,_0x3c7226);};}function removeListener(_0x583ac9,_0x2262e6){return function(){FaxAccountEvents['removeListener'](_0x583ac9,_0x2262e6);};}exports[_0x0d90('0x4')]=function(_0x4a3bac){for(var _0x47a8be=0x0,_0x58db48=events[_0x0d90('0x5')];_0x47a8be<_0x58db48;_0x47a8be++){var _0x24f001=events[_0x47a8be];var _0x297442=createListener(_0x0d90('0x6')+_0x24f001,_0x4a3bac);FaxAccountEvents['on'](_0x24f001,_0x297442);}}; \ No newline at end of file +var _0xa6fd=['length','faxAccount:','./faxAccount.events','save','remove','emit','removeListener','register'];(function(_0x1ccf21,_0x1a3963){var _0x456815=function(_0x3feeb0){while(--_0x3feeb0){_0x1ccf21['push'](_0x1ccf21['shift']());}};_0x456815(++_0x1a3963);}(_0xa6fd,0xd2));var _0xda6f=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0xa6fd[_0xa990b7];return _0x52c99c;};'use strict';var FaxAccountEvents=require(_0xda6f('0x0'));var events=[_0xda6f('0x1'),_0xda6f('0x2'),'update'];function createListener(_0x2ec806,_0xf49c08){return function(_0x3fddd0){_0xf49c08[_0xda6f('0x3')](_0x2ec806,_0x3fddd0);};}function removeListener(_0x13cee2,_0x2f20aa){return function(){FaxAccountEvents[_0xda6f('0x4')](_0x13cee2,_0x2f20aa);};}exports[_0xda6f('0x5')]=function(_0x266b52){for(var _0x1de9b1=0x0,_0x1199d3=events[_0xda6f('0x6')];_0x1de9b1<_0x1199d3;_0x1de9b1++){var _0x5dc0b4=events[_0x1de9b1];var _0x222a1e=createListener(_0xda6f('0x7')+_0x5dc0b4,_0x266b52);FaxAccountEvents['on'](_0x5dc0b4,_0x222a1e);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 1b68941..f4857a6 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 _0xe25e=['/describe','describe','/:id','isAuthenticated','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addAccountApplications','/updateaccountapplications','updateAccountApplications','addAgents','update','delete','destroy','removeAnswers','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get'];(function(_0x30deda,_0x45a9e1){var _0x54c52b=function(_0x1bfb7c){while(--_0x1bfb7c){_0x30deda['push'](_0x30deda['shift']());}};_0x54c52b(++_0x45a9e1);}(_0xe25e,0x1e3));var _0xee25=function(_0x2ae444,_0x5e9881){_0x2ae444=_0x2ae444-0x0;var _0x4d8790=_0xe25e[_0x2ae444];return _0x4d8790;};'use strict';var multer=require(_0xee25('0x0'));var util=require(_0xee25('0x1'));var path=require(_0xee25('0x2'));var timeout=require(_0xee25('0x3'));var express=require('express');var router=express[_0xee25('0x4')]();var fs_extra=require(_0xee25('0x5'));var auth=require(_0xee25('0x6'));var interaction=require(_0xee25('0x7'));var config=require(_0xee25('0x8'));var controller=require(_0xee25('0x9'));router[_0xee25('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xee25('0xa')](_0xee25('0xb'),auth['isAuthenticated'](),controller[_0xee25('0xc')]);router[_0xee25('0xa')](_0xee25('0xd'),auth[_0xee25('0xe')](),controller['show']);router[_0xee25('0xa')](_0xee25('0xf'),auth[_0xee25('0xe')](),controller[_0xee25('0x10')]);router[_0xee25('0xa')](_0xee25('0x11'),auth[_0xee25('0xe')](),controller[_0xee25('0x12')]);router[_0xee25('0xa')](_0xee25('0x13'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xee25('0xa')](_0xee25('0x14'),auth['isAuthenticated'](),controller[_0xee25('0x15')]);router[_0xee25('0xa')](_0xee25('0x16'),auth['isAuthenticated'](),controller[_0xee25('0x17')]);router[_0xee25('0xa')](_0xee25('0x18'),auth[_0xee25('0xe')](),controller[_0xee25('0x19')]);router[_0xee25('0x1a')]('/',auth[_0xee25('0xe')](),controller[_0xee25('0x1b')]);router[_0xee25('0x1a')](_0xee25('0xf'),auth[_0xee25('0xe')](),controller[_0xee25('0x1c')]);router['post'](_0xee25('0x11'),auth['isAuthenticated'](),controller['addAnswer']);router[_0xee25('0x1a')](_0xee25('0x13'),auth[_0xee25('0xe')](),controller['addInteraction']);router[_0xee25('0x1a')]('/:id/applications',auth[_0xee25('0xe')](),controller['addApplications']);router[_0xee25('0x1a')]('/addaccountapplications',auth[_0xee25('0xe')](),controller[_0xee25('0x1d')]);router[_0xee25('0x1a')](_0xee25('0x1e'),auth[_0xee25('0xe')](),controller[_0xee25('0x1f')]);router[_0xee25('0x1a')]('/:id/send',auth[_0xee25('0xe')](),controller['send']);router['post'](_0xee25('0x18'),auth[_0xee25('0xe')](),controller[_0xee25('0x20')]);router['put'](_0xee25('0xd'),auth[_0xee25('0xe')](),controller[_0xee25('0x21')]);router[_0xee25('0x22')](_0xee25('0xd'),auth['isAuthenticated'](),controller[_0xee25('0x23')]);router[_0xee25('0x22')](_0xee25('0xf'),auth[_0xee25('0xe')](),controller['removeDispositions']);router['delete'](_0xee25('0x11'),auth[_0xee25('0xe')](),controller[_0xee25('0x24')]);router[_0xee25('0x22')]('/:id/users',auth[_0xee25('0xe')](),controller[_0xee25('0x25')]);module['exports']=router; \ No newline at end of file +var _0xf119=['connect-timeout','Router','../../components/auth/service','../../config/environment','./faxAccount.controller','isAuthenticated','index','get','/describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','updateAccountApplications','/:id/send','addAgents','put','update','/:id','destroy','delete','removeDispositions','removeAnswers','exports','multer','util','path'];(function(_0x3da707,_0x30c36d){var _0x342ee7=function(_0x175135){while(--_0x175135){_0x3da707['push'](_0x3da707['shift']());}};_0x342ee7(++_0x30c36d);}(_0xf119,0x1de));var _0x9f11=function(_0x34c872,_0x42844e){_0x34c872=_0x34c872-0x0;var _0x10a5b5=_0xf119[_0x34c872];return _0x10a5b5;};'use strict';var multer=require(_0x9f11('0x0'));var util=require(_0x9f11('0x1'));var path=require(_0x9f11('0x2'));var timeout=require(_0x9f11('0x3'));var express=require('express');var router=express[_0x9f11('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9f11('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9f11('0x6'));var controller=require(_0x9f11('0x7'));router['get']('/',auth[_0x9f11('0x8')](),controller[_0x9f11('0x9')]);router[_0x9f11('0xa')](_0x9f11('0xb'),auth[_0x9f11('0x8')](),controller['describe']);router[_0x9f11('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x9f11('0xc')]);router['get']('/:id/dispositions',auth[_0x9f11('0x8')](),controller[_0x9f11('0xd')]);router[_0x9f11('0xa')](_0x9f11('0xe'),auth[_0x9f11('0x8')](),controller[_0x9f11('0xf')]);router['get'](_0x9f11('0x10'),auth[_0x9f11('0x8')](),controller['getInteractions']);router['get'](_0x9f11('0x11'),auth[_0x9f11('0x8')](),controller['getApplications']);router[_0x9f11('0xa')](_0x9f11('0x12'),auth[_0x9f11('0x8')](),controller[_0x9f11('0x13')]);router[_0x9f11('0xa')](_0x9f11('0x14'),auth['isAuthenticated'](),controller[_0x9f11('0x15')]);router[_0x9f11('0x16')]('/',auth['isAuthenticated'](),controller[_0x9f11('0x17')]);router[_0x9f11('0x16')]('/:id/dispositions',auth[_0x9f11('0x8')](),controller[_0x9f11('0x18')]);router[_0x9f11('0x16')](_0x9f11('0xe'),auth[_0x9f11('0x8')](),controller[_0x9f11('0x19')]);router[_0x9f11('0x16')](_0x9f11('0x10'),auth[_0x9f11('0x8')](),controller['addInteraction']);router[_0x9f11('0x16')](_0x9f11('0x11'),auth[_0x9f11('0x8')](),controller['addApplications']);router['post']('/addaccountapplications',auth['isAuthenticated'](),controller['addAccountApplications']);router[_0x9f11('0x16')]('/updateaccountapplications',auth[_0x9f11('0x8')](),controller[_0x9f11('0x1a')]);router[_0x9f11('0x16')](_0x9f11('0x1b'),auth[_0x9f11('0x8')](),controller['send']);router[_0x9f11('0x16')](_0x9f11('0x14'),auth[_0x9f11('0x8')](),controller[_0x9f11('0x1c')]);router[_0x9f11('0x1d')]('/:id',auth[_0x9f11('0x8')](),controller[_0x9f11('0x1e')]);router['delete'](_0x9f11('0x1f'),auth['isAuthenticated'](),controller[_0x9f11('0x20')]);router[_0x9f11('0x21')]('/:id/dispositions',auth[_0x9f11('0x8')](),controller[_0x9f11('0x22')]);router['delete'](_0x9f11('0xe'),auth[_0x9f11('0x8')](),controller[_0x9f11('0x23')]);router['delete'](_0x9f11('0x14'),auth[_0x9f11('0x8')](),controller['removeAgents']);module[_0x9f11('0x24')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 7a4b2a4..fff42bd 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 _0xa43d=['sequelize','STRING','TEXT','*,*,*,*'];(function(_0x21820e,_0x23a7d0){var _0x5aab28=function(_0x1e272d){while(--_0x1e272d){_0x21820e['push'](_0x21820e['shift']());}};_0x5aab28(++_0x23a7d0);}(_0xa43d,0x1c0));var _0xda43=function(_0x591896,_0x386bac){_0x591896=_0x591896-0x0;var _0x5eaa48=_0xa43d[_0x591896];return _0x5eaa48;};'use strict';var Sequelize=require(_0xda43('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xda43('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xda43('0x2')]()},'description':{'type':Sequelize[_0xda43('0x1')]},'interval':{'type':Sequelize[_0xda43('0x1')],'defaultValue':_0xda43('0x3')}}; \ No newline at end of file +var _0x9d83=['STRING','noop','sequelize','exports','INTEGER'];(function(_0x16920a,_0x509068){var _0x421782=function(_0x52dcdb){while(--_0x52dcdb){_0x16920a['push'](_0x16920a['shift']());}};_0x421782(++_0x509068);}(_0x9d83,0xf7));var _0x39d8=function(_0x524e23,_0x1e2aa7){_0x524e23=_0x524e23-0x0;var _0x231413=_0x9d83[_0x524e23];return _0x231413;};'use strict';var Sequelize=require(_0x39d8('0x0'));module[_0x39d8('0x1')]={'priority':{'type':Sequelize[_0x39d8('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x39d8('0x3')],'allowNull':![],'defaultValue':_0x39d8('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x39d8('0x3')]},'interval':{'type':Sequelize[_0x39d8('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 525792e..758a8c5 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 _0x7d78=['model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','json','reject','destroy','then','error','stack','name','index','map','FaxApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection'];(function(_0x3bbbd2,_0x506692){var _0x18ad2e=function(_0x3f1d2f){while(--_0x3f1d2f){_0x3bbbd2['push'](_0x3bbbd2['shift']());}};_0x18ad2e(++_0x506692);}(_0x7d78,0x132));var _0x87d7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7d78[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x87d7('0x0'));var rimraf=require(_0x87d7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x87d7('0x2'));var rp=require(_0x87d7('0x3'));var moment=require(_0x87d7('0x4'));var BPromise=require(_0x87d7('0x5'));var Mustache=require(_0x87d7('0x6'));var util=require(_0x87d7('0x7'));var path=require(_0x87d7('0x8'));var sox=require('sox');var csv=require(_0x87d7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x87d7('0xa'));var _=require(_0x87d7('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x87d7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x87d7('0x9'));var querystring=require(_0x87d7('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x87d7('0xe'));var qs=require(_0x87d7('0xf'));var as=require(_0x87d7('0x10'));var hardwareService=require(_0x87d7('0x11'));var logger=require(_0x87d7('0x12'))(_0x87d7('0x13'));var utils=require(_0x87d7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x87d7('0x15'));var db=require(_0x87d7('0x16'))['db'];function respondWithStatusCode(_0x2ff0c4,_0x5c966b){_0x5c966b=_0x5c966b||0xcc;return function(_0x5c3ef9){if(_0x5c3ef9){return _0x2ff0c4[_0x87d7('0x17')](_0x5c966b);}return _0x2ff0c4[_0x87d7('0x18')](_0x5c966b)[_0x87d7('0x19')]();};}function respondWithResult(_0x53c362,_0x1e30ca){_0x1e30ca=_0x1e30ca||0xc8;return function(_0x520b24){if(_0x520b24){return _0x53c362['status'](_0x1e30ca)['json'](_0x520b24);}};}function respondWithFilteredResult(_0x3dfb6a,_0x273971){return function(_0x195806){if(_0x195806){var _0x4b7cab=typeof _0x273971['offset']==='undefined'&&typeof _0x273971[_0x87d7('0x1a')]===_0x87d7('0x1b');var _0x4d3858=_0x195806[_0x87d7('0x1c')];var _0x1a8796=_0x4b7cab?0x0:_0x273971[_0x87d7('0x1d')];var _0x4ae55c=_0x4b7cab?_0x195806[_0x87d7('0x1c')]:_0x273971[_0x87d7('0x1d')]+_0x273971[_0x87d7('0x1a')];var _0x2384a6;if(_0x4ae55c>=_0x4d3858){_0x4ae55c=_0x4d3858;_0x2384a6=0xc8;}else{_0x2384a6=0xce;}_0x3dfb6a['status'](_0x2384a6);return _0x3dfb6a[_0x87d7('0x1e')]('Content-Range',_0x1a8796+'-'+_0x4ae55c+'/'+_0x4d3858)[_0x87d7('0x1f')](_0x195806);}return null;};}function patchUpdates(_0x493623){return function(_0x571659){try{jsonpatch['apply'](_0x571659,_0x493623,!![]);}catch(_0xe3b929){return BPromise[_0x87d7('0x20')](_0xe3b929);}return _0x571659['save']();};}function saveUpdates(_0x301427,_0x25cd69){return function(_0x192666){if(_0x192666){return _0x192666['update'](_0x301427)['then'](function(_0x271b1b){return _0x271b1b;});}return null;};}function removeEntity(_0x318f9a,_0x397dce){return function(_0x28d9b5){if(_0x28d9b5){return _0x28d9b5[_0x87d7('0x21')]()[_0x87d7('0x22')](function(){_0x318f9a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31724f,_0x1fbeb1){return function(_0x1c49d2){if(!_0x1c49d2){_0x31724f[_0x87d7('0x17')](0x194);}return _0x1c49d2;};}function handleError(_0x4bf256,_0x579143){_0x579143=_0x579143||0x1f4;return function(_0x38e4f5){logger[_0x87d7('0x23')](_0x38e4f5[_0x87d7('0x24')]);if(_0x38e4f5[_0x87d7('0x25')]){delete _0x38e4f5[_0x87d7('0x25')];}_0x4bf256[_0x87d7('0x18')](_0x579143)['send'](_0x38e4f5);};}exports[_0x87d7('0x26')]=function(_0x47c22f,_0x57dbcd){var _0x25655e={},_0x4bcde1={},_0x22d0a7={'count':0x0,'rows':[]};var _0x652be2=_[_0x87d7('0x27')](db[_0x87d7('0x28')][_0x87d7('0x29')],function(_0x1a3626){return{'name':_0x1a3626[_0x87d7('0x2a')],'type':_0x1a3626[_0x87d7('0x2b')][_0x87d7('0x2c')]};});_0x4bcde1['model']=_[_0x87d7('0x27')](_0x652be2,'name');_0x4bcde1[_0x87d7('0x2d')]=_[_0x87d7('0x2e')](_0x47c22f[_0x87d7('0x2d')]);_0x4bcde1[_0x87d7('0x2f')]=_[_0x87d7('0x30')](_0x4bcde1['model'],_0x4bcde1[_0x87d7('0x2d')]);_0x25655e['attributes']=_[_0x87d7('0x30')](_0x4bcde1[_0x87d7('0x31')],qs[_0x87d7('0x32')](_0x47c22f[_0x87d7('0x2d')][_0x87d7('0x32')]));_0x25655e['attributes']=_0x25655e[_0x87d7('0x33')]['length']?_0x25655e[_0x87d7('0x33')]:_0x4bcde1['model'];if(!_0x47c22f[_0x87d7('0x2d')][_0x87d7('0x34')](_0x87d7('0x35'))){_0x25655e[_0x87d7('0x1a')]=qs[_0x87d7('0x1a')](_0x47c22f[_0x87d7('0x2d')][_0x87d7('0x1a')]);_0x25655e[_0x87d7('0x1d')]=qs[_0x87d7('0x1d')](_0x47c22f[_0x87d7('0x2d')][_0x87d7('0x1d')]);}_0x25655e[_0x87d7('0x36')]=qs[_0x87d7('0x37')](_0x47c22f[_0x87d7('0x2d')][_0x87d7('0x37')]);_0x25655e[_0x87d7('0x38')]=qs[_0x87d7('0x2f')](_['pick'](_0x47c22f[_0x87d7('0x2d')],_0x4bcde1[_0x87d7('0x2f')]),_0x652be2);if(_0x47c22f['query'][_0x87d7('0x39')]){_0x25655e['where']=_[_0x87d7('0x3a')](_0x25655e['where'],{'$or':_[_0x87d7('0x27')](_0x652be2,function(_0xd2902){if(_0xd2902[_0x87d7('0x2b')]!==_0x87d7('0x3b')){var _0x3a9a9c={};_0x3a9a9c[_0xd2902[_0x87d7('0x25')]]={'$like':'%'+_0x47c22f[_0x87d7('0x2d')][_0x87d7('0x39')]+'%'};return _0x3a9a9c;}})});}_0x25655e=_[_0x87d7('0x3a')]({},_0x25655e,_0x47c22f['options']);var _0x3790dc={'where':_0x25655e[_0x87d7('0x38')]};return db[_0x87d7('0x28')]['count'](_0x3790dc)['then'](function(_0x35742b){_0x22d0a7['count']=_0x35742b;if(_0x47c22f[_0x87d7('0x2d')][_0x87d7('0x3c')]){_0x25655e['include']=[{'all':!![]}];}return db[_0x87d7('0x28')][_0x87d7('0x3d')](_0x25655e);})[_0x87d7('0x22')](function(_0x375b28){_0x22d0a7[_0x87d7('0x3e')]=_0x375b28;return _0x22d0a7;})[_0x87d7('0x22')](respondWithFilteredResult(_0x57dbcd,_0x25655e))[_0x87d7('0x3f')](handleError(_0x57dbcd,null));};exports[_0x87d7('0x40')]=function(_0x254cfc,_0x582755){var _0x1292c={'raw':!![],'where':{'id':_0x254cfc[_0x87d7('0x41')]['id']}},_0x1b62ff={};_0x1b62ff['model']=_['keys'](db[_0x87d7('0x28')]['rawAttributes']);_0x1b62ff[_0x87d7('0x2d')]=_[_0x87d7('0x2e')](_0x254cfc[_0x87d7('0x2d')]);_0x1b62ff['filters']=_[_0x87d7('0x30')](_0x1b62ff[_0x87d7('0x31')],_0x1b62ff[_0x87d7('0x2d')]);_0x1292c[_0x87d7('0x33')]=_[_0x87d7('0x30')](_0x1b62ff[_0x87d7('0x31')],qs[_0x87d7('0x32')](_0x254cfc[_0x87d7('0x2d')][_0x87d7('0x32')]));_0x1292c[_0x87d7('0x33')]=_0x1292c[_0x87d7('0x33')]['length']?_0x1292c[_0x87d7('0x33')]:_0x1b62ff[_0x87d7('0x31')];if(_0x254cfc[_0x87d7('0x2d')][_0x87d7('0x3c')]){_0x1292c[_0x87d7('0x42')]=[{'all':!![]}];}_0x1292c=_['merge']({},_0x1292c,_0x254cfc[_0x87d7('0x43')]);return db['FaxApplication'][_0x87d7('0x44')](_0x1292c)[_0x87d7('0x22')](handleEntityNotFound(_0x582755,null))[_0x87d7('0x22')](respondWithResult(_0x582755,null))[_0x87d7('0x3f')](handleError(_0x582755,null));};exports[_0x87d7('0x45')]=function(_0x1b4649,_0x20e343){return db[_0x87d7('0x28')][_0x87d7('0x45')](_0x1b4649[_0x87d7('0x46')],{})[_0x87d7('0x22')](respondWithResult(_0x20e343,0xc9))[_0x87d7('0x3f')](handleError(_0x20e343,null));};exports['update']=function(_0xba5402,_0xac6b30){if(_0xba5402[_0x87d7('0x46')]['id']){delete _0xba5402[_0x87d7('0x46')]['id'];}return db[_0x87d7('0x28')]['find']({'where':{'id':_0xba5402[_0x87d7('0x41')]['id']}})[_0x87d7('0x22')](handleEntityNotFound(_0xac6b30,null))['then'](saveUpdates(_0xba5402[_0x87d7('0x46')],null))[_0x87d7('0x22')](respondWithResult(_0xac6b30,null))[_0x87d7('0x3f')](handleError(_0xac6b30,null));};exports[_0x87d7('0x21')]=function(_0x4c8d5c,_0x31cb0b){return db[_0x87d7('0x28')][_0x87d7('0x44')]({'where':{'id':_0x4c8d5c[_0x87d7('0x41')]['id']}})[_0x87d7('0x22')](handleEntityNotFound(_0x31cb0b,null))['then'](removeEntity(_0x31cb0b,null))[_0x87d7('0x3f')](handleError(_0x31cb0b,null));}; \ No newline at end of file +var _0xffe5=['offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','FaxApplication','rawAttributes','type','key','model','query','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','find','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x42bafd,_0x3f0fe3){var _0x2ed705=function(_0x4311ea){while(--_0x4311ea){_0x42bafd['push'](_0x42bafd['shift']());}};_0x2ed705(++_0x3f0fe3);}(_0xffe5,0xbe));var _0x5ffe=function(_0x5ed0c5,_0xc21d27){_0x5ed0c5=_0x5ed0c5-0x0;var _0x2b8b5f=_0xffe5[_0x5ed0c5];return _0x2b8b5f;};'use strict';var emlformat=require(_0x5ffe('0x0'));var rimraf=require(_0x5ffe('0x1'));var zipdir=require(_0x5ffe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5ffe('0x3'));var moment=require(_0x5ffe('0x4'));var BPromise=require(_0x5ffe('0x5'));var Mustache=require(_0x5ffe('0x6'));var util=require(_0x5ffe('0x7'));var path=require(_0x5ffe('0x8'));var sox=require(_0x5ffe('0x9'));var csv=require('to-csv');var ejs=require(_0x5ffe('0xa'));var fs=require('fs');var fs_extra=require(_0x5ffe('0xb'));var _=require(_0x5ffe('0xc'));var squel=require(_0x5ffe('0xd'));var crypto=require(_0x5ffe('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5ffe('0xf'));var toCsv=require(_0x5ffe('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5ffe('0x11'));var qs=require(_0x5ffe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ffe('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x5ffe('0x14'));var licenseUtil=require(_0x5ffe('0x15'));var db=require(_0x5ffe('0x16'))['db'];function respondWithStatusCode(_0x2dfacc,_0x35664f){_0x35664f=_0x35664f||0xcc;return function(_0x2368ac){if(_0x2368ac){return _0x2dfacc[_0x5ffe('0x17')](_0x35664f);}return _0x2dfacc[_0x5ffe('0x18')](_0x35664f)[_0x5ffe('0x19')]();};}function respondWithResult(_0x6112ff,_0x274c18){_0x274c18=_0x274c18||0xc8;return function(_0x54562f){if(_0x54562f){return _0x6112ff[_0x5ffe('0x18')](_0x274c18)['json'](_0x54562f);}};}function respondWithFilteredResult(_0x183030,_0x3ecfd8){return function(_0x5a090d){if(_0x5a090d){var _0x2bc3de=typeof _0x3ecfd8[_0x5ffe('0x1a')]===_0x5ffe('0x1b')&&typeof _0x3ecfd8[_0x5ffe('0x1c')]===_0x5ffe('0x1b');var _0x4ac8a1=_0x5a090d[_0x5ffe('0x1d')];var _0xc75a2f=_0x2bc3de?0x0:_0x3ecfd8[_0x5ffe('0x1a')];var _0x397b45=_0x2bc3de?_0x5a090d[_0x5ffe('0x1d')]:_0x3ecfd8['offset']+_0x3ecfd8['limit'];var _0x261c4b;if(_0x397b45>=_0x4ac8a1){_0x397b45=_0x4ac8a1;_0x261c4b=0xc8;}else{_0x261c4b=0xce;}_0x183030[_0x5ffe('0x18')](_0x261c4b);return _0x183030[_0x5ffe('0x1e')](_0x5ffe('0x1f'),_0xc75a2f+'-'+_0x397b45+'/'+_0x4ac8a1)['json'](_0x5a090d);}return null;};}function patchUpdates(_0x222551){return function(_0x29ab72){try{jsonpatch['apply'](_0x29ab72,_0x222551,!![]);}catch(_0x393884){return BPromise[_0x5ffe('0x20')](_0x393884);}return _0x29ab72[_0x5ffe('0x21')]();};}function saveUpdates(_0x5b81fe,_0x2d5151){return function(_0xc971af){if(_0xc971af){return _0xc971af[_0x5ffe('0x22')](_0x5b81fe)['then'](function(_0x192f43){return _0x192f43;});}return null;};}function removeEntity(_0xd61b02,_0x53bb21){return function(_0x2c6e3f){if(_0x2c6e3f){return _0x2c6e3f[_0x5ffe('0x23')]()[_0x5ffe('0x24')](function(){_0xd61b02[_0x5ffe('0x18')](0xcc)[_0x5ffe('0x19')]();});}};}function handleEntityNotFound(_0x43b07a,_0x526ca8){return function(_0x3f5270){if(!_0x3f5270){_0x43b07a['sendStatus'](0x194);}return _0x3f5270;};}function handleError(_0x18c979,_0x52f438){_0x52f438=_0x52f438||0x1f4;return function(_0x4e5513){logger[_0x5ffe('0x25')](_0x4e5513[_0x5ffe('0x26')]);if(_0x4e5513[_0x5ffe('0x27')]){delete _0x4e5513['name'];}_0x18c979['status'](_0x52f438)[_0x5ffe('0x28')](_0x4e5513);};}exports[_0x5ffe('0x29')]=function(_0x547581,_0x2ab982){var _0x5b7ccd={},_0x1f9180={},_0x2f6f25={'count':0x0,'rows':[]};var _0x127292=_[_0x5ffe('0x2a')](db[_0x5ffe('0x2b')][_0x5ffe('0x2c')],function(_0x23ee69){return{'name':_0x23ee69['fieldName'],'type':_0x23ee69[_0x5ffe('0x2d')][_0x5ffe('0x2e')]};});_0x1f9180[_0x5ffe('0x2f')]=_[_0x5ffe('0x2a')](_0x127292,_0x5ffe('0x27'));_0x1f9180[_0x5ffe('0x30')]=_['keys'](_0x547581[_0x5ffe('0x30')]);_0x1f9180['filters']=_[_0x5ffe('0x31')](_0x1f9180[_0x5ffe('0x2f')],_0x1f9180['query']);_0x5b7ccd['attributes']=_[_0x5ffe('0x31')](_0x1f9180['model'],qs[_0x5ffe('0x32')](_0x547581[_0x5ffe('0x30')][_0x5ffe('0x32')]));_0x5b7ccd['attributes']=_0x5b7ccd['attributes'][_0x5ffe('0x33')]?_0x5b7ccd[_0x5ffe('0x34')]:_0x1f9180[_0x5ffe('0x2f')];if(!_0x547581[_0x5ffe('0x30')][_0x5ffe('0x35')](_0x5ffe('0x36'))){_0x5b7ccd[_0x5ffe('0x1c')]=qs[_0x5ffe('0x1c')](_0x547581[_0x5ffe('0x30')]['limit']);_0x5b7ccd[_0x5ffe('0x1a')]=qs[_0x5ffe('0x1a')](_0x547581[_0x5ffe('0x30')][_0x5ffe('0x1a')]);}_0x5b7ccd[_0x5ffe('0x37')]=qs[_0x5ffe('0x38')](_0x547581[_0x5ffe('0x30')][_0x5ffe('0x38')]);_0x5b7ccd[_0x5ffe('0x39')]=qs[_0x5ffe('0x3a')](_['pick'](_0x547581[_0x5ffe('0x30')],_0x1f9180[_0x5ffe('0x3a')]),_0x127292);if(_0x547581[_0x5ffe('0x30')][_0x5ffe('0x3b')]){_0x5b7ccd[_0x5ffe('0x39')]=_[_0x5ffe('0x3c')](_0x5b7ccd['where'],{'$or':_[_0x5ffe('0x2a')](_0x127292,function(_0x5aaea8){if(_0x5aaea8[_0x5ffe('0x2d')]!==_0x5ffe('0x3d')){var _0x8c65fc={};_0x8c65fc[_0x5aaea8[_0x5ffe('0x27')]]={'$like':'%'+_0x547581[_0x5ffe('0x30')][_0x5ffe('0x3b')]+'%'};return _0x8c65fc;}})});}_0x5b7ccd=_[_0x5ffe('0x3c')]({},_0x5b7ccd,_0x547581[_0x5ffe('0x3e')]);var _0xc5dd49={'where':_0x5b7ccd[_0x5ffe('0x39')]};return db[_0x5ffe('0x2b')][_0x5ffe('0x1d')](_0xc5dd49)['then'](function(_0xcb5b97){_0x2f6f25['count']=_0xcb5b97;if(_0x547581[_0x5ffe('0x30')][_0x5ffe('0x3f')]){_0x5b7ccd[_0x5ffe('0x40')]=[{'all':!![]}];}return db['FaxApplication'][_0x5ffe('0x41')](_0x5b7ccd);})[_0x5ffe('0x24')](function(_0x4d3d59){_0x2f6f25['rows']=_0x4d3d59;return _0x2f6f25;})['then'](respondWithFilteredResult(_0x2ab982,_0x5b7ccd))[_0x5ffe('0x42')](handleError(_0x2ab982,null));};exports[_0x5ffe('0x43')]=function(_0x19c6b0,_0x215fb2){var _0x3910c8={'raw':!![],'where':{'id':_0x19c6b0['params']['id']}},_0x121576={};_0x121576[_0x5ffe('0x2f')]=_['keys'](db['FaxApplication'][_0x5ffe('0x2c')]);_0x121576['query']=_[_0x5ffe('0x44')](_0x19c6b0['query']);_0x121576[_0x5ffe('0x3a')]=_['intersection'](_0x121576[_0x5ffe('0x2f')],_0x121576[_0x5ffe('0x30')]);_0x3910c8[_0x5ffe('0x34')]=_[_0x5ffe('0x31')](_0x121576[_0x5ffe('0x2f')],qs[_0x5ffe('0x32')](_0x19c6b0[_0x5ffe('0x30')][_0x5ffe('0x32')]));_0x3910c8[_0x5ffe('0x34')]=_0x3910c8['attributes'][_0x5ffe('0x33')]?_0x3910c8[_0x5ffe('0x34')]:_0x121576[_0x5ffe('0x2f')];if(_0x19c6b0['query'][_0x5ffe('0x3f')]){_0x3910c8[_0x5ffe('0x40')]=[{'all':!![]}];}_0x3910c8=_['merge']({},_0x3910c8,_0x19c6b0[_0x5ffe('0x3e')]);return db['FaxApplication'][_0x5ffe('0x45')](_0x3910c8)[_0x5ffe('0x24')](handleEntityNotFound(_0x215fb2,null))[_0x5ffe('0x24')](respondWithResult(_0x215fb2,null))[_0x5ffe('0x42')](handleError(_0x215fb2,null));};exports['create']=function(_0x483cc9,_0x27d8f0){return db['FaxApplication']['create'](_0x483cc9[_0x5ffe('0x46')],{})[_0x5ffe('0x24')](respondWithResult(_0x27d8f0,0xc9))[_0x5ffe('0x42')](handleError(_0x27d8f0,null));};exports[_0x5ffe('0x22')]=function(_0x312d71,_0x52dcee){if(_0x312d71['body']['id']){delete _0x312d71[_0x5ffe('0x46')]['id'];}return db['FaxApplication'][_0x5ffe('0x45')]({'where':{'id':_0x312d71[_0x5ffe('0x47')]['id']}})['then'](handleEntityNotFound(_0x52dcee,null))['then'](saveUpdates(_0x312d71[_0x5ffe('0x46')],null))[_0x5ffe('0x24')](respondWithResult(_0x52dcee,null))['catch'](handleError(_0x52dcee,null));};exports[_0x5ffe('0x23')]=function(_0x5d2ec6,_0x3e552e){return db['FaxApplication'][_0x5ffe('0x45')]({'where':{'id':_0x5d2ec6[_0x5ffe('0x47')]['id']}})[_0x5ffe('0x24')](handleEntityNotFound(_0x3e552e,null))[_0x5ffe('0x24')](removeEntity(_0x3e552e,null))[_0x5ffe('0x42')](handleError(_0x3e552e,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 94b67f2..ca5a6e3 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 _0x7ad4=['bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','util','../../config/logger','api','moment'];(function(_0x1676e9,_0x1934b9){var _0x444adc=function(_0x5d37a1){while(--_0x5d37a1){_0x1676e9['push'](_0x1676e9['shift']());}};_0x444adc(++_0x1934b9);}(_0x7ad4,0x11c));var _0x47ad=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7ad4[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x47ad('0x0'));var logger=require(_0x47ad('0x1'))(_0x47ad('0x2'));var moment=require(_0x47ad('0x3'));var BPromise=require(_0x47ad('0x4'));var rp=require(_0x47ad('0x5'));var fs=require('fs');var path=require(_0x47ad('0x6'));var rimraf=require('rimraf');var config=require(_0x47ad('0x7'));var attributes=require(_0x47ad('0x8'));module[_0x47ad('0x9')]=function(_0x448ecc,_0x56d500){return _0x448ecc[_0x47ad('0xa')](_0x47ad('0xb'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3108=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x97cc12,_0x54d583){var _0x5a25d7=function(_0x46add6){while(--_0x46add6){_0x97cc12['push'](_0x97cc12['shift']());}};_0x5a25d7(++_0x54d583);}(_0x3108,0x107));var _0x8310=function(_0xad1709,_0x464a66){_0xad1709=_0xad1709-0x0;var _0x54938e=_0x3108[_0xad1709];return _0x54938e;};'use strict';var _=require(_0x8310('0x0'));var util=require('util');var logger=require(_0x8310('0x1'))('api');var moment=require(_0x8310('0x2'));var BPromise=require('bluebird');var rp=require(_0x8310('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8310('0x4'));var config=require(_0x8310('0x5'));var attributes=require(_0x8310('0x6'));module[_0x8310('0x7')]=function(_0x527394,_0x3c85a4){return _0x527394[_0x8310('0x8')]('FaxApplication',attributes,{'tableName':_0x8310('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8310('0xa'),'collate':_0x8310('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index aa086df..4266237 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 _0x5824=['then','UpdateFaxApplication','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','FaxApplication','update','options','raw','where','attributes','limit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5824,0x14c));var _0x4582=function(_0x2c2d7f,_0xc58e6a){_0x2c2d7f=_0x2c2d7f-0x0;var _0x25d687=_0x5824[_0x2c2d7f];return _0x25d687;};'use strict';var _=require(_0x4582('0x0'));var util=require('util');var moment=require(_0x4582('0x1'));var BPromise=require(_0x4582('0x2'));var rs=require(_0x4582('0x3'));var fs=require('fs');var Redis=require(_0x4582('0x4'));var db=require(_0x4582('0x5'))['db'];var utils=require(_0x4582('0x6'));var logger=require(_0x4582('0x7'))(_0x4582('0x8'));var config=require(_0x4582('0x9'));var jayson=require(_0x4582('0xa'));var client=jayson[_0x4582('0xb')][_0x4582('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x309a79,_0x52e6e0,_0x38406e){return new BPromise(function(_0x4d192d,_0x10bf86){return client['request'](_0x309a79,_0x38406e)['then'](function(_0x52cb85){logger['info'](_0x4582('0xd'),_0x52e6e0,_0x4582('0xe'));logger[_0x4582('0xf')](_0x4582('0x10'),_0x52e6e0,_0x4582('0xe'),JSON[_0x4582('0x11')](_0x52cb85));if(_0x52cb85[_0x4582('0x12')]){if(_0x52cb85['error'][_0x4582('0x13')]===0x1f4){logger[_0x4582('0x12')](_0x4582('0xd'),_0x52e6e0,_0x52cb85[_0x4582('0x12')]['message']);return _0x10bf86(_0x52cb85[_0x4582('0x12')][_0x4582('0x14')]);}logger[_0x4582('0x12')](_0x4582('0xd'),_0x52e6e0,_0x52cb85[_0x4582('0x12')]['message']);return _0x4d192d(_0x52cb85[_0x4582('0x12')]['message']);}else{logger[_0x4582('0x15')](_0x4582('0xd'),_0x52e6e0,_0x4582('0xe'));_0x4d192d(_0x52cb85[_0x4582('0x16')][_0x4582('0x14')]);}})[_0x4582('0x17')](function(_0x29682c){logger[_0x4582('0x12')]('FaxApplication,\x20%s,\x20%s',_0x52e6e0,_0x29682c);_0x10bf86(_0x29682c);});});}exports['UpdateFaxApplication']=function(_0x317c8e){var _0x46cd7f=this;return new Promise(function(_0x470830,_0x3a029b){return db[_0x4582('0x18')][_0x4582('0x19')](_0x317c8e['body'],{'raw':_0x317c8e[_0x4582('0x1a')]?_0x317c8e[_0x4582('0x1a')][_0x4582('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x317c8e['options']?_0x317c8e[_0x4582('0x1a')][_0x4582('0x1c')]||null:null,'attributes':_0x317c8e[_0x4582('0x1a')]?_0x317c8e['options'][_0x4582('0x1d')]||null:null,'limit':_0x317c8e['options']?_0x317c8e[_0x4582('0x1a')][_0x4582('0x1e')]||null:null})[_0x4582('0x1f')](function(_0x14b201){logger[_0x4582('0x15')](_0x4582('0x20'),_0x317c8e);logger[_0x4582('0xf')](_0x4582('0x20'),_0x317c8e,JSON[_0x4582('0x11')](_0x14b201));_0x470830(_0x14b201);})[_0x4582('0x17')](function(_0x292506){logger[_0x4582('0x12')]('UpdateFaxApplication',_0x292506['message'],_0x317c8e);_0x3a029b(_0x46cd7f['error'](0x1f4,_0x292506['message']));});});}; \ No newline at end of file +var _0x16dc=['FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','attributes','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x4d3f27,_0x30546a){var _0x6fd21f=function(_0x3d6647){while(--_0x3d6647){_0x4d3f27['push'](_0x4d3f27['shift']());}};_0x6fd21f(++_0x30546a);}(_0x16dc,0xe3));var _0xc16d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x16dc[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xc16d('0x0'));var moment=require('moment');var BPromise=require(_0xc16d('0x1'));var rs=require(_0xc16d('0x2'));var fs=require('fs');var Redis=require(_0xc16d('0x3'));var db=require(_0xc16d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc16d('0x5'))(_0xc16d('0x6'));var config=require(_0xc16d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc16d('0x8')][_0xc16d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37706f,_0x445435,_0x5e9616){return new BPromise(function(_0x20bc6f,_0x328726){return client[_0xc16d('0xa')](_0x37706f,_0x5e9616)[_0xc16d('0xb')](function(_0x4933ef){logger[_0xc16d('0xc')](_0xc16d('0xd'),_0x445435,_0xc16d('0xe'));logger[_0xc16d('0xf')](_0xc16d('0x10'),_0x445435,_0xc16d('0xe'),JSON['stringify'](_0x4933ef));if(_0x4933ef[_0xc16d('0x11')]){if(_0x4933ef['error'][_0xc16d('0x12')]===0x1f4){logger[_0xc16d('0x11')](_0xc16d('0xd'),_0x445435,_0x4933ef[_0xc16d('0x11')][_0xc16d('0x13')]);return _0x328726(_0x4933ef[_0xc16d('0x11')][_0xc16d('0x13')]);}logger[_0xc16d('0x11')](_0xc16d('0xd'),_0x445435,_0x4933ef[_0xc16d('0x11')][_0xc16d('0x13')]);return _0x20bc6f(_0x4933ef[_0xc16d('0x11')]['message']);}else{logger[_0xc16d('0xc')]('FaxApplication,\x20%s,\x20%s',_0x445435,_0xc16d('0xe'));_0x20bc6f(_0x4933ef[_0xc16d('0x14')][_0xc16d('0x13')]);}})[_0xc16d('0x15')](function(_0x46ddf0){logger[_0xc16d('0x11')](_0xc16d('0xd'),_0x445435,_0x46ddf0);_0x328726(_0x46ddf0);});});}exports[_0xc16d('0x16')]=function(_0x15cb87){var _0x2b0642=this;return new Promise(function(_0x549dcb,_0x22d8ac){return db[_0xc16d('0x17')][_0xc16d('0x18')](_0x15cb87[_0xc16d('0x19')],{'raw':_0x15cb87[_0xc16d('0x1a')]?_0x15cb87[_0xc16d('0x1a')][_0xc16d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15cb87[_0xc16d('0x1a')]?_0x15cb87['options']['where']||null:null,'attributes':_0x15cb87[_0xc16d('0x1a')]?_0x15cb87[_0xc16d('0x1a')][_0xc16d('0x1c')]||null:null,'limit':_0x15cb87['options']?_0x15cb87[_0xc16d('0x1a')][_0xc16d('0x1d')]||null:null})[_0xc16d('0xb')](function(_0x21dfb8){logger[_0xc16d('0xc')](_0xc16d('0x16'),_0x15cb87);logger[_0xc16d('0xf')]('UpdateFaxApplication',_0x15cb87,JSON['stringify'](_0x21dfb8));_0x549dcb(_0x21dfb8);})[_0xc16d('0x15')](function(_0x5819f9){logger[_0xc16d('0x11')](_0xc16d('0x16'),_0x5819f9[_0xc16d('0x13')],_0x15cb87);_0x22d8ac(_0x2b0642[_0xc16d('0x11')](0x1f4,_0x5819f9[_0xc16d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index fc2548c..43d2c7c 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 _0x6cb4=['get','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxApplication.controller','isAuthenticated'];(function(_0x5af573,_0x21acfa){var _0x281395=function(_0x20e328){while(--_0x20e328){_0x5af573['push'](_0x5af573['shift']());}};_0x281395(++_0x21acfa);}(_0x6cb4,0xff));var _0x46cb=function(_0x33f147,_0x1bc8ed){_0x33f147=_0x33f147-0x0;var _0x4bd4cc=_0x6cb4[_0x33f147];return _0x4bd4cc;};'use strict';var multer=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var path=require(_0x46cb('0x2'));var timeout=require(_0x46cb('0x3'));var express=require(_0x46cb('0x4'));var router=express[_0x46cb('0x5')]();var fs_extra=require(_0x46cb('0x6'));var auth=require(_0x46cb('0x7'));var interaction=require(_0x46cb('0x8'));var config=require('../../config/environment');var controller=require(_0x46cb('0x9'));router['get']('/',auth[_0x46cb('0xa')](),controller['index']);router[_0x46cb('0xb')](_0x46cb('0xc'),auth[_0x46cb('0xa')](),controller[_0x46cb('0xd')]);router[_0x46cb('0xe')]('/',auth[_0x46cb('0xa')](),controller['create']);router[_0x46cb('0xf')](_0x46cb('0xc'),auth['isAuthenticated'](),controller[_0x46cb('0x10')]);router[_0x46cb('0x11')]('/:id',auth[_0x46cb('0xa')](),controller[_0x46cb('0x12')]);module['exports']=router; \ No newline at end of file +var _0x93e9=['multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x358973,_0x17f72d){var _0x48b844=function(_0x35edf1){while(--_0x35edf1){_0x358973['push'](_0x358973['shift']());}};_0x48b844(++_0x17f72d);}(_0x93e9,0xcc));var _0x993e=function(_0x5fd2a6,_0x25dcdc){_0x5fd2a6=_0x5fd2a6-0x0;var _0x12a506=_0x93e9[_0x5fd2a6];return _0x12a506;};'use strict';var multer=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var path=require(_0x993e('0x2'));var timeout=require(_0x993e('0x3'));var express=require(_0x993e('0x4'));var router=express[_0x993e('0x5')]();var fs_extra=require(_0x993e('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x993e('0x7'));var controller=require(_0x993e('0x8'));router[_0x993e('0x9')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0xb')]);router[_0x993e('0x9')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller['show']);router[_0x993e('0xd')]('/',auth[_0x993e('0xa')](),controller[_0x993e('0xe')]);router[_0x993e('0xf')](_0x993e('0xc'),auth[_0x993e('0xa')](),controller[_0x993e('0x10')]);router['delete'](_0x993e('0xc'),auth[_0x993e('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 3255ea2..4299d01 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 _0xe820=['sequelize','BOOLEAN','STRING','out','DATE','ENUM','INTEGER'];(function(_0x259b90,_0x39e843){var _0x3ce4cd=function(_0x55d95d){while(--_0x55d95d){_0x259b90['push'](_0x259b90['shift']());}};_0x3ce4cd(++_0x39e843);}(_0xe820,0xd2));var _0x0e82=function(_0x532cd5,_0x5387ab){_0x532cd5=_0x532cd5-0x0;var _0x1f402a=_0xe820[_0x532cd5];return _0x1f402a;};'use strict';var Sequelize=require(_0x0e82('0x0'));module['exports']={'closed':{'type':Sequelize[_0x0e82('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0e82('0x2')]},'thirdDisposition':{'type':Sequelize[_0x0e82('0x2')]},'note':{'type':Sequelize[_0x0e82('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x0e82('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x0e82('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0e82('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x0e82('0x5')]('in',_0x0e82('0x3')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x0e82('0x6')]}}; \ No newline at end of file +var _0xd824=['exports','STRING','DATE','INTEGER','sequelize'];(function(_0x42abed,_0x4bca02){var _0x2dcbf0=function(_0x5eb843){while(--_0x5eb843){_0x42abed['push'](_0x42abed['shift']());}};_0x2dcbf0(++_0x4bca02);}(_0xd824,0xc2));var _0x4d82=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd824[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x4d82('0x0'));module[_0x4d82('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x4d82('0x2')]},'secondDisposition':{'type':Sequelize[_0x4d82('0x2')]},'thirdDisposition':{'type':Sequelize[_0x4d82('0x2')]},'note':{'type':Sequelize[_0x4d82('0x2')]},'read1stAt':{'type':Sequelize[_0x4d82('0x3')]},'fax':{'type':Sequelize[_0x4d82('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4d82('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x4d82('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 5019b70..6c37b22 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 _0x8662=['defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax','query','catch','show','params','model','keys','intersection','attributes','fields','length','includeAll','include','merge','options','create','body','find','describe','addMessage','FaxMessage','omit','ids','findOne','filters','order','sort','where','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','emit','faxInteractionTags:save','removeTags','download','join','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','existsSync','createReadStream','createWriteStream','basename','resolve','err','unlinkSync','rimraf','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis'];(function(_0x49d48d,_0xf1fdaa){var _0x46e093=function(_0x535f82){while(--_0x535f82){_0x49d48d['push'](_0x49d48d['shift']());}};_0x46e093(++_0xf1fdaa);}(_0x8662,0x180));var _0x2866=function(_0x3b9636,_0x362181){_0x3b9636=_0x3b9636-0x0;var _0x4685a2=_0x8662[_0x3b9636];return _0x4685a2;};'use strict';var rimraf=require(_0x2866('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x2866('0x1'));var util=require(_0x2866('0x2'));var path=require(_0x2866('0x3'));var fs=require('fs');var _=require(_0x2866('0x4'));var Redis=require(_0x2866('0x5'));var interaction=require(_0x2866('0x6'));var qs=require(_0x2866('0x7'));var logger=require('../../config/logger')(_0x2866('0x8'));var config=require(_0x2866('0x9'));var db=require(_0x2866('0xa'))['db'];config[_0x2866('0xb')]=_[_0x2866('0xc')](config[_0x2866('0xb')],{'host':_0x2866('0xd'),'port':0x18eb});var socket=require(_0x2866('0xe'))(new Redis(config[_0x2866('0xb')]));require(_0x2866('0xf'))[_0x2866('0x10')](socket);function respondWithStatusCode(_0x11d208,_0xccd611){_0xccd611=_0xccd611||0xcc;return function(_0x1658f7){if(_0x1658f7){return _0x11d208[_0x2866('0x11')](_0xccd611);}return _0x11d208[_0x2866('0x12')](_0xccd611)[_0x2866('0x13')]();};}function respondWithResult(_0x8437f9,_0x3212f9){_0x3212f9=_0x3212f9||0xc8;return function(_0x5ac76e){if(_0x5ac76e){return _0x8437f9[_0x2866('0x12')](_0x3212f9)[_0x2866('0x14')](_0x5ac76e);}};}function respondWithFilteredResult(_0x48ced0,_0x21edcb){return function(_0x34a25f){if(_0x34a25f){var _0x46a614=typeof _0x21edcb[_0x2866('0x15')]===_0x2866('0x16')&&typeof _0x21edcb[_0x2866('0x17')]===_0x2866('0x16');var _0x17b29b=_0x34a25f[_0x2866('0x18')];var _0x2c8273=_0x46a614?0x0:_0x21edcb[_0x2866('0x15')];var _0x9829cf=_0x46a614?_0x34a25f['count']:_0x21edcb[_0x2866('0x15')]+_0x21edcb[_0x2866('0x17')];var _0x5a1c08;if(_0x9829cf>=_0x17b29b){_0x9829cf=_0x17b29b;_0x5a1c08=0xc8;}else{_0x5a1c08=0xce;}_0x48ced0['status'](_0x5a1c08);return _0x48ced0[_0x2866('0x19')](_0x2866('0x1a'),_0x2c8273+'-'+_0x9829cf+'/'+_0x17b29b)[_0x2866('0x14')](_0x34a25f);}return null;};}function saveUpdates(_0x3c4c0b){return function(_0x31348e){if(_0x31348e){return _0x31348e['update'](_0x3c4c0b)[_0x2866('0x1b')](function(_0x533018){return _0x533018;});}return null;};}function removeEntity(_0x5d301e){return function(_0x3ad6e9){if(_0x3ad6e9){return _0x3ad6e9[_0x2866('0x1c')]()[_0x2866('0x1b')](function(){_0x5d301e[_0x2866('0x12')](0xcc)[_0x2866('0x13')]();});}};}function handleEntityNotFound(_0x16b5ff){return function(_0x122734){if(!_0x122734){_0x16b5ff[_0x2866('0x11')](0x194);}return _0x122734;};}function handleError(_0x2fdbaa,_0xbc6968){_0xbc6968=_0xbc6968||0x1f4;return function(_0x296d7d){logger['error'](_0x296d7d[_0x2866('0x1d')]);if(_0x296d7d[_0x2866('0x1e')]){delete _0x296d7d[_0x2866('0x1e')];}_0x2fdbaa[_0x2866('0x12')](_0xbc6968)[_0x2866('0x1f')](_0x296d7d);};}exports[_0x2866('0x20')]=function(_0x296935,_0x2edba3){var _0x1db48a={};var _0x2acea3=_[_0x2866('0x21')](db[_0x2866('0x22')][_0x2866('0x23')],function(_0x1c88f8){return{'name':_0x1c88f8[_0x2866('0x24')],'type':_0x1c88f8[_0x2866('0x25')][_0x2866('0x26')]};});_0x1db48a=qs[_0x2866('0x27')](_0x2acea3,_0x296935);return interaction[_0x2866('0x28')](_0x2866('0x29'),_0x296935[_0x2866('0x2a')],_0x296935['user'],_0x1db48a,_0x2acea3)[_0x2866('0x1b')](respondWithFilteredResult(_0x2edba3,_0x1db48a))[_0x2866('0x2b')](handleError(_0x2edba3,null));};exports[_0x2866('0x2c')]=function(_0x529741,_0x548e54){var _0x7e0f21={'raw':![],'where':{'id':_0x529741[_0x2866('0x2d')]['id']}},_0x391af3={};_0x391af3[_0x2866('0x2e')]=_['keys'](db[_0x2866('0x22')]['rawAttributes']);_0x391af3['query']=_[_0x2866('0x2f')](_0x529741[_0x2866('0x2a')]);_0x391af3['filters']=_[_0x2866('0x30')](_0x391af3[_0x2866('0x2e')],_0x391af3[_0x2866('0x2a')]);_0x7e0f21[_0x2866('0x31')]=_[_0x2866('0x30')](_0x391af3[_0x2866('0x2e')],qs[_0x2866('0x32')](_0x529741[_0x2866('0x2a')][_0x2866('0x32')]));_0x7e0f21[_0x2866('0x31')]=_0x7e0f21['attributes'][_0x2866('0x33')]?_0x7e0f21[_0x2866('0x31')]:_0x391af3[_0x2866('0x2e')];if(_0x529741[_0x2866('0x2a')][_0x2866('0x34')]){_0x7e0f21[_0x2866('0x35')]=[{'all':!![]}];}_0x7e0f21=_[_0x2866('0x36')]({},_0x7e0f21,_0x529741[_0x2866('0x37')]);return db[_0x2866('0x22')]['find'](_0x7e0f21)['then'](handleEntityNotFound(_0x548e54,null))[_0x2866('0x1b')](respondWithResult(_0x548e54,null))[_0x2866('0x2b')](handleError(_0x548e54,null));};exports[_0x2866('0x38')]=function(_0x3c6a68,_0x50b272){return db[_0x2866('0x22')][_0x2866('0x38')](_0x3c6a68[_0x2866('0x39')],{})[_0x2866('0x1b')](respondWithResult(_0x50b272,0xc9))[_0x2866('0x2b')](handleError(_0x50b272,null));};exports['update']=function(_0x4085f3,_0x52bebf){if(_0x4085f3['body']['id']){delete _0x4085f3['body']['id'];}return db[_0x2866('0x22')][_0x2866('0x3a')]({'where':{'id':_0x4085f3[_0x2866('0x2d')]['id']}})[_0x2866('0x1b')](handleEntityNotFound(_0x52bebf,null))[_0x2866('0x1b')](saveUpdates(_0x4085f3['body'],null))[_0x2866('0x1b')](respondWithResult(_0x52bebf,null))[_0x2866('0x2b')](handleError(_0x52bebf,null));};exports[_0x2866('0x1c')]=function(_0x525d8b,_0x45c871){return db['FaxInteraction'][_0x2866('0x3a')]({'where':{'id':_0x525d8b[_0x2866('0x2d')]['id']}})['then'](handleEntityNotFound(_0x45c871,null))['then'](removeEntity(_0x45c871,null))['catch'](handleError(_0x45c871,null));};exports['describe']=function(_0x33b7be,_0x2db646){return db[_0x2866('0x22')][_0x2866('0x3b')]()[_0x2866('0x1b')](respondWithResult(_0x2db646,null))[_0x2866('0x2b')](handleError(_0x2db646,null));};exports[_0x2866('0x3c')]=function(_0x24d49c,_0x5b4f28){return db[_0x2866('0x3d')][_0x2866('0x3a')]({'where':{'id':_0x24d49c[_0x2866('0x2d')]['id']}})[_0x2866('0x1b')](handleEntityNotFound(_0x5b4f28,null))['then'](function(_0x1295ac){if(_0x1295ac){return _0x1295ac[_0x2866('0x3c')](_0x24d49c[_0x2866('0x39')]['ids'],_[_0x2866('0x3e')](_0x24d49c['body'],[_0x2866('0x3f'),'id'])||{});}})['then'](respondWithResult(_0x5b4f28,null))[_0x2866('0x2b')](handleError(_0x5b4f28,null));};exports['getMessages']=function(_0x1dd97c,_0x233a2f){var _0x3e7e02={'raw':![],'where':{}};var _0x43bb6f={};var _0x559771={'count':0x0,'rows':[]};return db[_0x2866('0x22')][_0x2866('0x40')]({'where':{'id':_0x1dd97c[_0x2866('0x2d')]['id']}})[_0x2866('0x1b')](handleEntityNotFound(_0x233a2f,null))['then'](function(_0x4bf39d){if(_0x4bf39d){_0x43bb6f[_0x2866('0x2e')]=_[_0x2866('0x2f')](db[_0x2866('0x3d')][_0x2866('0x23')]);_0x43bb6f['query']=_[_0x2866('0x2f')](_0x1dd97c[_0x2866('0x2a')]);_0x43bb6f[_0x2866('0x41')]=_[_0x2866('0x30')](_0x43bb6f[_0x2866('0x2e')],_0x43bb6f[_0x2866('0x2a')]);_0x3e7e02[_0x2866('0x31')]=_[_0x2866('0x30')](_0x43bb6f[_0x2866('0x2e')],qs[_0x2866('0x32')](_0x1dd97c[_0x2866('0x2a')][_0x2866('0x32')]));_0x3e7e02['attributes']=_0x3e7e02[_0x2866('0x31')][_0x2866('0x33')]?_0x3e7e02['attributes']:_0x43bb6f[_0x2866('0x2e')];if(!_0x1dd97c['query']['hasOwnProperty']('nolimit')){_0x3e7e02[_0x2866('0x17')]=qs[_0x2866('0x17')](_0x1dd97c['query'][_0x2866('0x17')]);_0x3e7e02[_0x2866('0x15')]=qs['offset'](_0x1dd97c['query'][_0x2866('0x15')]);}_0x3e7e02[_0x2866('0x42')]=qs[_0x2866('0x43')](_0x1dd97c[_0x2866('0x2a')][_0x2866('0x43')]);_0x3e7e02[_0x2866('0x44')]=qs['filters'](_['pick'](_0x1dd97c[_0x2866('0x2a')],_0x43bb6f[_0x2866('0x41')]));_0x3e7e02[_0x2866('0x44')]['FaxInteractionId']=_0x4bf39d['id'];if(_0x1dd97c[_0x2866('0x2a')][_0x2866('0x45')]){_0x3e7e02[_0x2866('0x44')]=_[_0x2866('0x36')](_0x3e7e02[_0x2866('0x44')],{'$or':_['map'](_0x3e7e02[_0x2866('0x31')],function(_0x45269b){var _0x4adc18={};_0x4adc18[_0x45269b]={'$like':'%'+_0x1dd97c[_0x2866('0x2a')][_0x2866('0x45')]+'%'};return _0x4adc18;})});}if(_0x1dd97c[_0x2866('0x2a')]['$gte']){var _0x443362=_0x1dd97c[_0x2866('0x2a')][_0x2866('0x46')][_0x2866('0x47')](',');var _0x3c5daa={};_0x3c5daa[_0x443362[0x0]]={'$gte':moment(_0x443362[0x1])['format'](_0x2866('0x48'))};_0x3e7e02['where']=_[_0x2866('0x36')](_0x3e7e02[_0x2866('0x44')],_0x3c5daa);}_0x3e7e02=_[_0x2866('0x36')]({},_0x3e7e02,_0x1dd97c[_0x2866('0x37')]);return db[_0x2866('0x3d')][_0x2866('0x18')]({'where':_0x3e7e02[_0x2866('0x44')]})[_0x2866('0x1b')](function(_0x581ed6){_0x559771[_0x2866('0x18')]=_0x581ed6;if(_0x1dd97c[_0x2866('0x2a')][_0x2866('0x34')]){_0x3e7e02[_0x2866('0x35')]=[{'all':!![]}];}return db['FaxMessage'][_0x2866('0x28')](_0x3e7e02);})[_0x2866('0x1b')](function(_0x293194){_0x559771[_0x2866('0x49')]=_0x293194;return _0x559771;});}})[_0x2866('0x1b')](respondWithFilteredResult(_0x233a2f,_0x3e7e02))[_0x2866('0x2b')](handleError(_0x233a2f,null));};exports[_0x2866('0x4a')]=function(_0x32c672,_0x36c43e){return db[_0x2866('0x22')][_0x2866('0x3a')]({'where':{'id':_0x32c672['params']['id']}})[_0x2866('0x1b')](handleEntityNotFound(_0x36c43e,null))['then'](function(_0x1ee359){if(_0x1ee359){return _0x1ee359['setTags'](_0x32c672[_0x2866('0x39')][_0x2866('0x3f')],_[_0x2866('0x3e')](_0x32c672[_0x2866('0x39')],[_0x2866('0x3f'),'id'])||{})[_0x2866('0x4b')](function(){return db[_0x2866('0x4c')]['findAll']({'attributes':['id',_0x2866('0x1e'),'color'],'where':{'id':_0x32c672[_0x2866('0x39')][_0x2866('0x3f')]}});})[_0x2866('0x1b')](function(_0x2f4920){socket[_0x2866('0x4d')](_0x2866('0x4e'),{'id':Number(_0x32c672[_0x2866('0x2d')]['id']),'tags':_0x2f4920||[]});return{'id':Number(_0x32c672[_0x2866('0x2d')]['id']),'tags':_0x2f4920||[]};});}})[_0x2866('0x1b')](respondWithResult(_0x36c43e,null))[_0x2866('0x2b')](handleError(_0x36c43e,null));};exports[_0x2866('0x4f')]=function(_0x5be5c0,_0xd425a0){return db[_0x2866('0x22')][_0x2866('0x3a')]({'where':{'id':_0x5be5c0['params']['id']}})['then'](handleEntityNotFound(_0xd425a0,null))[_0x2866('0x1b')](function(_0x127ba4){if(_0x127ba4){return _0x127ba4[_0x2866('0x4f')](_0x5be5c0[_0x2866('0x2a')][_0x2866('0x3f')]);}})[_0x2866('0x1b')](respondWithStatusCode(_0xd425a0,null))[_0x2866('0x2b')](handleError(_0xd425a0,null));};exports[_0x2866('0x50')]=function(_0x170020,_0x262d91){var _0x79cb81=moment()['unix']()['toString']();var _0x3143e4=path[_0x2866('0x51')](config['root'],_0x2866('0x52'),_0x2866('0x53'),_0x2866('0x54'));var _0x1a3c9f=path[_0x2866('0x51')](config['root'],_0x2866('0x52'),_0x2866('0x53'),_0x2866('0x55'));var _0x54e081=path['join'](_0x3143e4,_0x79cb81);var _0x3deb39=util['format'](_0x2866('0x56'),_0x170020[_0x2866('0x2d')]['id'],_0x79cb81);var _0x52bd99=path[_0x2866('0x51')](_0x3143e4,_0x3deb39);var _0x2d4dac=[];_0x2d4dac['push']({'model':db[_0x2866('0x57')],'as':_0x2866('0x57'),'raw':!![]});var _0x12f04e=[{'model':db[_0x2866('0x3d')],'as':_0x2866('0x58'),'attributes':['id',_0x2866('0x39'),_0x2866('0x59')],'include':_0x2d4dac}];return db[_0x2866('0x22')][_0x2866('0x3a')]({'where':{'id':_0x170020['params']['id']},'include':_0x12f04e})[_0x2866('0x1b')](handleEntityNotFound(_0x262d91,null))[_0x2866('0x1b')](function(_0x4c4546){if(_0x4c4546&&_0x4c4546[_0x2866('0x58')]){var _0x2d9220=_0x4c4546[_0x2866('0x5a')]({'plain':!![]});fs[_0x2866('0x5b')](_0x54e081);for(var _0x5f22f5=0x0;_0x5f22f5<_0x2d9220[_0x2866('0x58')][_0x2866('0x33')];_0x5f22f5++){var _0x5e76b4=_0x2d9220[_0x2866('0x58')][_0x5f22f5][_0x2866('0x57')];if(_0x5e76b4){var _0x501c47=path[_0x2866('0x51')](_0x1a3c9f,_0x5e76b4['basename']);if(fs[_0x2866('0x5c')](_0x501c47)){fs[_0x2866('0x5d')](_0x501c47)['pipe'](fs[_0x2866('0x5e')](path[_0x2866('0x51')](_0x54e081,_0x5e76b4[_0x2866('0x5f')])));}}}return BPromise[_0x2866('0x60')]()['then'](function(){return new BPromise(function(_0x4710f4,_0x243621){zipdir(_0x54e081,{'saveTo':_0x52bd99},function(_0x47a24e,_0x2a959a){if(_0x47a24e)return _0x243621(_0x47a24e);return _0x4710f4(_0x2a959a);});})['then'](function(){return new BPromise(function(_0x44f359,_0x3ba304){rimraf(_0x54e081,function(_0x1e3214){if(_0x1e3214)_0x3ba304(_0x1e3214);return _0x44f359();});});})[_0x2866('0x1b')](function(){return _0x262d91[_0x2866('0x50')](_0x52bd99,_0x3deb39,function(_0x1f95a6){if(_0x1f95a6){console['log'](_0x2866('0x61'),_0x1f95a6);}else{fs[_0x2866('0x62')](_0x52bd99);}});});});}else{return _0x262d91[_0x2866('0x11')](0xc8);}})[_0x2866('0x2b')](handleError(_0x262d91,null));}; \ No newline at end of file +var _0x5d9e=['status','end','offset','undefined','limit','count','set','json','update','then','destroy','error','stack','name','send','map','rawAttributes','type','getOptions','findAll','fax','query','user','catch','show','params','model','keys','FaxInteraction','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','body','describe','addMessage','FaxMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','FaxInteractionId','merge','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','omit','spread','Tag','color','emit','faxInteractionTags:save','unix','toString','join','files','root','transcript-%d-%s.zip','Attachment','createdAt','Messages','get','mkdirSync','basename','createReadStream','createWriteStream','resolve','download','log','unlinkSync','rimraf','zip-dir','moment','bluebird','path','lodash','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5d9e,0x1dc));var _0xe5d9=function(_0x398562,_0x5a90d3){_0x398562=_0x398562-0x0;var _0x51e2c3=_0x5d9e[_0x398562];return _0x51e2c3;};'use strict';var rimraf=require(_0xe5d9('0x0'));var zipdir=require(_0xe5d9('0x1'));var moment=require(_0xe5d9('0x2'));var BPromise=require(_0xe5d9('0x3'));var util=require('util');var path=require(_0xe5d9('0x4'));var fs=require('fs');var _=require(_0xe5d9('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0xe5d9('0x6'))(_0xe5d9('0x7'));var config=require('../../config/environment');var db=require(_0xe5d9('0x8'))['db'];config[_0xe5d9('0x9')]=_[_0xe5d9('0xa')](config[_0xe5d9('0x9')],{'host':_0xe5d9('0xb'),'port':0x18eb});var socket=require(_0xe5d9('0xc'))(new Redis(config[_0xe5d9('0x9')]));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0x3e02a8,_0x1d62be){_0x1d62be=_0x1d62be||0xcc;return function(_0x1b8b10){if(_0x1b8b10){return _0x3e02a8[_0xe5d9('0xd')](_0x1d62be);}return _0x3e02a8[_0xe5d9('0xe')](_0x1d62be)[_0xe5d9('0xf')]();};}function respondWithResult(_0x4a79b7,_0x47f502){_0x47f502=_0x47f502||0xc8;return function(_0x186edc){if(_0x186edc){return _0x4a79b7['status'](_0x47f502)['json'](_0x186edc);}};}function respondWithFilteredResult(_0x7af67f,_0x58e3c4){return function(_0x4b9caa){if(_0x4b9caa){var _0xdf8a93=typeof _0x58e3c4[_0xe5d9('0x10')]===_0xe5d9('0x11')&&typeof _0x58e3c4[_0xe5d9('0x12')]==='undefined';var _0x573c5a=_0x4b9caa['count'];var _0x2d8847=_0xdf8a93?0x0:_0x58e3c4[_0xe5d9('0x10')];var _0x25f06b=_0xdf8a93?_0x4b9caa[_0xe5d9('0x13')]:_0x58e3c4[_0xe5d9('0x10')]+_0x58e3c4['limit'];var _0x1badd2;if(_0x25f06b>=_0x573c5a){_0x25f06b=_0x573c5a;_0x1badd2=0xc8;}else{_0x1badd2=0xce;}_0x7af67f[_0xe5d9('0xe')](_0x1badd2);return _0x7af67f[_0xe5d9('0x14')]('Content-Range',_0x2d8847+'-'+_0x25f06b+'/'+_0x573c5a)[_0xe5d9('0x15')](_0x4b9caa);}return null;};}function saveUpdates(_0x317109){return function(_0x382fcc){if(_0x382fcc){return _0x382fcc[_0xe5d9('0x16')](_0x317109)[_0xe5d9('0x17')](function(_0x425186){return _0x425186;});}return null;};}function removeEntity(_0x5c15eb){return function(_0x346e4b){if(_0x346e4b){return _0x346e4b[_0xe5d9('0x18')]()['then'](function(){_0x5c15eb[_0xe5d9('0xe')](0xcc)[_0xe5d9('0xf')]();});}};}function handleEntityNotFound(_0x32bd0c){return function(_0x413135){if(!_0x413135){_0x32bd0c['sendStatus'](0x194);}return _0x413135;};}function handleError(_0x276a79,_0x19d22d){_0x19d22d=_0x19d22d||0x1f4;return function(_0x3c40d3){logger[_0xe5d9('0x19')](_0x3c40d3[_0xe5d9('0x1a')]);if(_0x3c40d3[_0xe5d9('0x1b')]){delete _0x3c40d3[_0xe5d9('0x1b')];}_0x276a79[_0xe5d9('0xe')](_0x19d22d)[_0xe5d9('0x1c')](_0x3c40d3);};}exports['index']=function(_0x1d5f19,_0x53884d){var _0x34e353={};var _0x558051=_[_0xe5d9('0x1d')](db['FaxInteraction'][_0xe5d9('0x1e')],function(_0x477534){return{'name':_0x477534['fieldName'],'type':_0x477534[_0xe5d9('0x1f')]['key']};});_0x34e353=qs[_0xe5d9('0x20')](_0x558051,_0x1d5f19);return interaction[_0xe5d9('0x21')](_0xe5d9('0x22'),_0x1d5f19[_0xe5d9('0x23')],_0x1d5f19[_0xe5d9('0x24')],_0x34e353,_0x558051)[_0xe5d9('0x17')](respondWithFilteredResult(_0x53884d,_0x34e353))[_0xe5d9('0x25')](handleError(_0x53884d,null));};exports[_0xe5d9('0x26')]=function(_0x345523,_0x13fa7a){var _0x3c0f88={'raw':![],'where':{'id':_0x345523[_0xe5d9('0x27')]['id']}},_0x1840a1={};_0x1840a1[_0xe5d9('0x28')]=_[_0xe5d9('0x29')](db[_0xe5d9('0x2a')]['rawAttributes']);_0x1840a1[_0xe5d9('0x23')]=_[_0xe5d9('0x29')](_0x345523[_0xe5d9('0x23')]);_0x1840a1[_0xe5d9('0x2b')]=_[_0xe5d9('0x2c')](_0x1840a1[_0xe5d9('0x28')],_0x1840a1[_0xe5d9('0x23')]);_0x3c0f88[_0xe5d9('0x2d')]=_['intersection'](_0x1840a1['model'],qs['fields'](_0x345523['query'][_0xe5d9('0x2e')]));_0x3c0f88[_0xe5d9('0x2d')]=_0x3c0f88[_0xe5d9('0x2d')][_0xe5d9('0x2f')]?_0x3c0f88[_0xe5d9('0x2d')]:_0x1840a1['model'];if(_0x345523['query'][_0xe5d9('0x30')]){_0x3c0f88[_0xe5d9('0x31')]=[{'all':!![]}];}_0x3c0f88=_['merge']({},_0x3c0f88,_0x345523[_0xe5d9('0x32')]);return db['FaxInteraction'][_0xe5d9('0x33')](_0x3c0f88)[_0xe5d9('0x17')](handleEntityNotFound(_0x13fa7a,null))[_0xe5d9('0x17')](respondWithResult(_0x13fa7a,null))[_0xe5d9('0x25')](handleError(_0x13fa7a,null));};exports[_0xe5d9('0x34')]=function(_0x262595,_0x6812f8){return db[_0xe5d9('0x2a')]['create'](_0x262595[_0xe5d9('0x35')],{})[_0xe5d9('0x17')](respondWithResult(_0x6812f8,0xc9))[_0xe5d9('0x25')](handleError(_0x6812f8,null));};exports['update']=function(_0x2c058d,_0x3ca1ac){if(_0x2c058d[_0xe5d9('0x35')]['id']){delete _0x2c058d[_0xe5d9('0x35')]['id'];}return db[_0xe5d9('0x2a')][_0xe5d9('0x33')]({'where':{'id':_0x2c058d['params']['id']}})['then'](handleEntityNotFound(_0x3ca1ac,null))[_0xe5d9('0x17')](saveUpdates(_0x2c058d['body'],null))[_0xe5d9('0x17')](respondWithResult(_0x3ca1ac,null))['catch'](handleError(_0x3ca1ac,null));};exports[_0xe5d9('0x18')]=function(_0x16f28d,_0x5cc36f){return db[_0xe5d9('0x2a')][_0xe5d9('0x33')]({'where':{'id':_0x16f28d['params']['id']}})[_0xe5d9('0x17')](handleEntityNotFound(_0x5cc36f,null))[_0xe5d9('0x17')](removeEntity(_0x5cc36f,null))['catch'](handleError(_0x5cc36f,null));};exports['describe']=function(_0xf2ace0,_0x503f73){return db[_0xe5d9('0x2a')][_0xe5d9('0x36')]()['then'](respondWithResult(_0x503f73,null))['catch'](handleError(_0x503f73,null));};exports[_0xe5d9('0x37')]=function(_0x39dbb7,_0x2c9fba){return db[_0xe5d9('0x38')][_0xe5d9('0x33')]({'where':{'id':_0x39dbb7[_0xe5d9('0x27')]['id']}})['then'](handleEntityNotFound(_0x2c9fba,null))['then'](function(_0x1f66dd){if(_0x1f66dd){return _0x1f66dd['addMessage'](_0x39dbb7[_0xe5d9('0x35')][_0xe5d9('0x39')],_['omit'](_0x39dbb7[_0xe5d9('0x35')],[_0xe5d9('0x39'),'id'])||{});}})[_0xe5d9('0x17')](respondWithResult(_0x2c9fba,null))['catch'](handleError(_0x2c9fba,null));};exports[_0xe5d9('0x3a')]=function(_0x18576b,_0x475003){var _0x230fc5={'raw':![],'where':{}};var _0xa43cc={};var _0x87364d={'count':0x0,'rows':[]};return db[_0xe5d9('0x2a')][_0xe5d9('0x3b')]({'where':{'id':_0x18576b[_0xe5d9('0x27')]['id']}})[_0xe5d9('0x17')](handleEntityNotFound(_0x475003,null))[_0xe5d9('0x17')](function(_0x963954){if(_0x963954){_0xa43cc['model']=_[_0xe5d9('0x29')](db[_0xe5d9('0x38')]['rawAttributes']);_0xa43cc[_0xe5d9('0x23')]=_[_0xe5d9('0x29')](_0x18576b['query']);_0xa43cc[_0xe5d9('0x2b')]=_[_0xe5d9('0x2c')](_0xa43cc['model'],_0xa43cc['query']);_0x230fc5[_0xe5d9('0x2d')]=_[_0xe5d9('0x2c')](_0xa43cc[_0xe5d9('0x28')],qs['fields'](_0x18576b[_0xe5d9('0x23')][_0xe5d9('0x2e')]));_0x230fc5[_0xe5d9('0x2d')]=_0x230fc5['attributes']['length']?_0x230fc5[_0xe5d9('0x2d')]:_0xa43cc[_0xe5d9('0x28')];if(!_0x18576b[_0xe5d9('0x23')][_0xe5d9('0x3c')](_0xe5d9('0x3d'))){_0x230fc5[_0xe5d9('0x12')]=qs['limit'](_0x18576b[_0xe5d9('0x23')][_0xe5d9('0x12')]);_0x230fc5['offset']=qs[_0xe5d9('0x10')](_0x18576b['query']['offset']);}_0x230fc5[_0xe5d9('0x3e')]=qs[_0xe5d9('0x3f')](_0x18576b[_0xe5d9('0x23')]['sort']);_0x230fc5[_0xe5d9('0x40')]=qs[_0xe5d9('0x2b')](_['pick'](_0x18576b[_0xe5d9('0x23')],_0xa43cc['filters']));_0x230fc5[_0xe5d9('0x40')][_0xe5d9('0x41')]=_0x963954['id'];if(_0x18576b[_0xe5d9('0x23')]['filter']){_0x230fc5[_0xe5d9('0x40')]=_[_0xe5d9('0x42')](_0x230fc5[_0xe5d9('0x40')],{'$or':_[_0xe5d9('0x1d')](_0x230fc5['attributes'],function(_0x6d76bb){var _0x498e0c={};_0x498e0c[_0x6d76bb]={'$like':'%'+_0x18576b[_0xe5d9('0x23')][_0xe5d9('0x43')]+'%'};return _0x498e0c;})});}if(_0x18576b[_0xe5d9('0x23')]['$gte']){var _0x4ffd1d=_0x18576b[_0xe5d9('0x23')][_0xe5d9('0x44')][_0xe5d9('0x45')](',');var _0x20e853={};_0x20e853[_0x4ffd1d[0x0]]={'$gte':moment(_0x4ffd1d[0x1])[_0xe5d9('0x46')](_0xe5d9('0x47'))};_0x230fc5['where']=_[_0xe5d9('0x42')](_0x230fc5[_0xe5d9('0x40')],_0x20e853);}_0x230fc5=_[_0xe5d9('0x42')]({},_0x230fc5,_0x18576b[_0xe5d9('0x32')]);return db['FaxMessage'][_0xe5d9('0x13')]({'where':_0x230fc5['where']})[_0xe5d9('0x17')](function(_0x43b1b1){_0x87364d[_0xe5d9('0x13')]=_0x43b1b1;if(_0x18576b[_0xe5d9('0x23')][_0xe5d9('0x30')]){_0x230fc5['include']=[{'all':!![]}];}return db[_0xe5d9('0x38')][_0xe5d9('0x21')](_0x230fc5);})[_0xe5d9('0x17')](function(_0x3bd18a){_0x87364d[_0xe5d9('0x48')]=_0x3bd18a;return _0x87364d;});}})[_0xe5d9('0x17')](respondWithFilteredResult(_0x475003,_0x230fc5))[_0xe5d9('0x25')](handleError(_0x475003,null));};exports[_0xe5d9('0x49')]=function(_0x101b43,_0xfbbf2d){return db[_0xe5d9('0x2a')]['find']({'where':{'id':_0x101b43[_0xe5d9('0x27')]['id']}})[_0xe5d9('0x17')](handleEntityNotFound(_0xfbbf2d,null))[_0xe5d9('0x17')](function(_0x57df69){if(_0x57df69){return _0x57df69['setTags'](_0x101b43[_0xe5d9('0x35')][_0xe5d9('0x39')],_[_0xe5d9('0x4a')](_0x101b43[_0xe5d9('0x35')],[_0xe5d9('0x39'),'id'])||{})[_0xe5d9('0x4b')](function(){return db[_0xe5d9('0x4c')][_0xe5d9('0x21')]({'attributes':['id',_0xe5d9('0x1b'),_0xe5d9('0x4d')],'where':{'id':_0x101b43['body'][_0xe5d9('0x39')]}});})[_0xe5d9('0x17')](function(_0xe01668){socket[_0xe5d9('0x4e')](_0xe5d9('0x4f'),{'id':Number(_0x101b43[_0xe5d9('0x27')]['id']),'tags':_0xe01668||[]});return{'id':Number(_0x101b43[_0xe5d9('0x27')]['id']),'tags':_0xe01668||[]};});}})[_0xe5d9('0x17')](respondWithResult(_0xfbbf2d,null))['catch'](handleError(_0xfbbf2d,null));};exports['removeTags']=function(_0xdd8320,_0x459464){return db[_0xe5d9('0x2a')][_0xe5d9('0x33')]({'where':{'id':_0xdd8320[_0xe5d9('0x27')]['id']}})[_0xe5d9('0x17')](handleEntityNotFound(_0x459464,null))[_0xe5d9('0x17')](function(_0x4d515b){if(_0x4d515b){return _0x4d515b['removeTags'](_0xdd8320[_0xe5d9('0x23')][_0xe5d9('0x39')]);}})['then'](respondWithStatusCode(_0x459464,null))[_0xe5d9('0x25')](handleError(_0x459464,null));};exports['download']=function(_0x503998,_0x3cfea7){var _0x265d87=moment()[_0xe5d9('0x50')]()[_0xe5d9('0x51')]();var _0x14d6d2=path[_0xe5d9('0x52')](config['root'],'server',_0xe5d9('0x53'),'tmp');var _0x2cd27c=path[_0xe5d9('0x52')](config[_0xe5d9('0x54')],'server','files','attachments');var _0x32bb4c=path[_0xe5d9('0x52')](_0x14d6d2,_0x265d87);var _0x3f8ef2=util[_0xe5d9('0x46')](_0xe5d9('0x55'),_0x503998[_0xe5d9('0x27')]['id'],_0x265d87);var _0x344742=path[_0xe5d9('0x52')](_0x14d6d2,_0x3f8ef2);var _0x259444=[];_0x259444['push']({'model':db[_0xe5d9('0x56')],'as':_0xe5d9('0x56'),'raw':!![]});var _0x38c10b=[{'model':db[_0xe5d9('0x38')],'as':'Messages','attributes':['id',_0xe5d9('0x35'),_0xe5d9('0x57')],'include':_0x259444}];return db[_0xe5d9('0x2a')][_0xe5d9('0x33')]({'where':{'id':_0x503998[_0xe5d9('0x27')]['id']},'include':_0x38c10b})['then'](handleEntityNotFound(_0x3cfea7,null))[_0xe5d9('0x17')](function(_0x42908a){if(_0x42908a&&_0x42908a[_0xe5d9('0x58')]){var _0x1b25cc=_0x42908a[_0xe5d9('0x59')]({'plain':!![]});fs[_0xe5d9('0x5a')](_0x32bb4c);for(var _0xc03a29=0x0;_0xc03a29<_0x1b25cc['Messages'][_0xe5d9('0x2f')];_0xc03a29++){var _0x935ac9=_0x1b25cc[_0xe5d9('0x58')][_0xc03a29][_0xe5d9('0x56')];if(_0x935ac9){var _0x20d6c6=path[_0xe5d9('0x52')](_0x2cd27c,_0x935ac9[_0xe5d9('0x5b')]);if(fs['existsSync'](_0x20d6c6)){fs[_0xe5d9('0x5c')](_0x20d6c6)['pipe'](fs[_0xe5d9('0x5d')](path[_0xe5d9('0x52')](_0x32bb4c,_0x935ac9[_0xe5d9('0x5b')])));}}}return BPromise[_0xe5d9('0x5e')]()[_0xe5d9('0x17')](function(){return new BPromise(function(_0xd7062,_0x20e3d0){zipdir(_0x32bb4c,{'saveTo':_0x344742},function(_0x4c0401,_0x57bb24){if(_0x4c0401)return _0x20e3d0(_0x4c0401);return _0xd7062(_0x57bb24);});})[_0xe5d9('0x17')](function(){return new BPromise(function(_0x5510ef,_0x33bacb){rimraf(_0x32bb4c,function(_0x2833f1){if(_0x2833f1)_0x33bacb(_0x2833f1);return _0x5510ef();});});})[_0xe5d9('0x17')](function(){return _0x3cfea7[_0xe5d9('0x5f')](_0x344742,_0x3f8ef2,function(_0x2ff05c){if(_0x2ff05c){console[_0xe5d9('0x60')]('err',_0x2ff05c);}else{fs[_0xe5d9('0x61')](_0x344742);}});});});}else{return _0x3cfea7[_0xe5d9('0xd')](0xc8);}})['catch'](handleError(_0x3cfea7,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 87f2f69..a86e680 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 _0x2852=['FaxMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x4ef619,_0x542f8f){var _0xcdc94c=function(_0x343cf6){while(--_0x343cf6){_0x4ef619['push'](_0x4ef619['shift']());}};_0xcdc94c(++_0x542f8f);}(_0x2852,0x1c0));var _0x2285=function(_0x4bc8c9,_0x2b3855){_0x4bc8c9=_0x4bc8c9-0x0;var _0x52e85d=_0x2852[_0x4bc8c9];return _0x52e85d;};'use strict';var EventEmitter=require(_0x2285('0x0'));var FaxInteraction=require(_0x2285('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0x2285('0x1'))['db'][_0x2285('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x2285('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2285('0x4'),'afterDestroy':_0x2285('0x5')};function emitEvent(_0x160f22){return function(_0xe62ec8,_0x297c0d,_0x20857c){_0xe62ec8[_0x2285('0x6')]({'attributes':['id'],'raw':!![]})[_0x2285('0x7')](function(_0x5a7b02){_0xe62ec8[_0x2285('0x8')](_0x2285('0x9'),_0x5a7b02[_0x2285('0xa')](function(_0x299a5d){return{'id':_0x299a5d['id']};}));return FaxMessage[_0x2285('0xb')]({'where':{'FaxInteractionId':_0xe62ec8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2285('0x7')](function(_0x70dd68){_0xe62ec8[_0x2285('0x8')](_0x2285('0xc'),_0x70dd68[_0x2285('0xd')]);FaxInteractionEvents[_0x2285('0xe')](_0x160f22+':'+_0xe62ec8['id'],_0xe62ec8);FaxInteractionEvents['emit'](_0x160f22,_0xe62ec8);_0x20857c(null);})[_0x2285('0xf')](_0x20857c(null));};}for(var e in events){if(events[_0x2285('0x10')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x2285('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0xbf36=['FaxInteraction','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','findAll','then','length','catch','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x5bc18d,_0x4a1372){var _0x32a08e=function(_0x22d348){while(--_0x22d348){_0x5bc18d['push'](_0x5bc18d['shift']());}};_0x32a08e(++_0x4a1372);}(_0xbf36,0x1ee));var _0x6bf3=function(_0xff646,_0x5722cc){_0xff646=_0xff646-0x0;var _0x177504=_0xbf36[_0xff646];return _0x177504;};'use strict';var EventEmitter=require(_0x6bf3('0x0'));var FaxInteraction=require(_0x6bf3('0x1'))['db'][_0x6bf3('0x2')];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x6bf3('0x3')](0x0);var events={'afterCreate':_0x6bf3('0x4'),'afterUpdate':_0x6bf3('0x5'),'afterDestroy':_0x6bf3('0x6')};function emitEvent(_0x5594e8){return function(_0x5e38f5,_0x351463,_0xa09766){_0x5e38f5[_0x6bf3('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3dae91){_0x5e38f5[_0x6bf3('0x8')](_0x6bf3('0x9'),_0x3dae91['map'](function(_0x42c1aa){return{'id':_0x42c1aa['id']};}));return FaxMessage[_0x6bf3('0xa')]({'where':{'FaxInteractionId':_0x5e38f5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6bf3('0xb')](function(_0x2c42c5){_0x5e38f5[_0x6bf3('0x8')]('unreadMessages',_0x2c42c5[_0x6bf3('0xc')]);FaxInteractionEvents['emit'](_0x5594e8+':'+_0x5e38f5['id'],_0x5e38f5);FaxInteractionEvents['emit'](_0x5594e8,_0x5e38f5);_0xa09766(null);})[_0x6bf3('0xd')](_0xa09766(null));};}for(var e in events){if(events[_0x6bf3('0xe')](e)){var event=events[e];FaxInteraction[_0x6bf3('0xf')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 1de6d12..3f42366 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 _0xf232=['request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','bluebird'];(function(_0x23096f,_0x46b17d){var _0x4315d2=function(_0x4c78bd){while(--_0x4c78bd){_0x23096f['push'](_0x23096f['shift']());}};_0x4315d2(++_0x46b17d);}(_0xf232,0xc8));var _0x2f23=function(_0x452ad0,_0x434613){_0x452ad0=_0x452ad0-0x0;var _0x3d8ee4=_0xf232[_0x452ad0];return _0x3d8ee4;};'use strict';var _=require(_0x2f23('0x0'));var util=require('util');var logger=require(_0x2f23('0x1'))(_0x2f23('0x2'));var moment=require('moment');var BPromise=require(_0x2f23('0x3'));var rp=require(_0x2f23('0x4'));var fs=require('fs');var path=require(_0x2f23('0x5'));var rimraf=require(_0x2f23('0x6'));var config=require(_0x2f23('0x7'));var attributes=require(_0x2f23('0x8'));module[_0x2f23('0x9')]=function(_0x334970,_0xdce7a){return _0x334970[_0x2f23('0xa')]('FaxInteraction',attributes,{'tableName':_0x2f23('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x552c5b,_0x5a446f,_0xb3538b){if(_0x552c5b[_0x2f23('0xc')](_0x2f23('0xd'))){_0x552c5b[_0x2f23('0xe')]=moment()[_0x2f23('0xf')](_0x2f23('0x10'));}_0xb3538b(null,_0x552c5b);}}});}; \ No newline at end of file +var _0xe256=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xe256,0x197));var _0x6e25=function(_0x515bb8,_0x333e51){_0x515bb8=_0x515bb8-0x0;var _0x3691b7=_0xe256[_0x515bb8];return _0x3691b7;};'use strict';var _=require(_0x6e25('0x0'));var util=require(_0x6e25('0x1'));var logger=require(_0x6e25('0x2'))('api');var moment=require(_0x6e25('0x3'));var BPromise=require(_0x6e25('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e25('0x5'));var rimraf=require(_0x6e25('0x6'));var config=require(_0x6e25('0x7'));var attributes=require(_0x6e25('0x8'));module[_0x6e25('0x9')]=function(_0x2e6b46,_0x213db8){return _0x2e6b46[_0x6e25('0xa')](_0x6e25('0xb'),attributes,{'tableName':_0x6e25('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5c9cf3,_0x595fef,_0x299d28){if(_0x5c9cf3[_0x6e25('0xd')](_0x6e25('0xe'))){_0x5c9cf3[_0x6e25('0xf')]=moment()['format'](_0x6e25('0x10'));}_0x299d28(null,_0x5c9cf3);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 93f270c..e2d5f51 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 _0x6935=['stringify','error','code','message','result','catch','update','body','options','where','attributes','limit','then','UpdateFaxInteraction','AddTagsToFaxInteraction','FaxInteraction','find','ids','omit','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x1bcf5b,_0xd5637f){var _0x352544=function(_0x1401a7){while(--_0x1401a7){_0x1bcf5b['push'](_0x1bcf5b['shift']());}};_0x352544(++_0xd5637f);}(_0x6935,0xf0));var _0x5693=function(_0x221066,_0x596a17){_0x221066=_0x221066-0x0;var _0x424943=_0x6935[_0x221066];return _0x424943;};'use strict';var _=require(_0x5693('0x0'));var util=require(_0x5693('0x1'));var moment=require(_0x5693('0x2'));var BPromise=require('bluebird');var rs=require(_0x5693('0x3'));var fs=require('fs');var Redis=require(_0x5693('0x4'));var db=require(_0x5693('0x5'))['db'];var utils=require(_0x5693('0x6'));var logger=require(_0x5693('0x7'))(_0x5693('0x8'));var config=require(_0x5693('0x9'));var jayson=require(_0x5693('0xa'));var client=jayson[_0x5693('0xb')][_0x5693('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5693('0xd')],{'host':_0x5693('0xe'),'port':0x18eb});var socket=require(_0x5693('0xf'))(new Redis(config['redis']));require(_0x5693('0x10'))[_0x5693('0x11')](socket);function respondWithRpcPromise(_0x22ee97,_0x3a29a0,_0x4749e4){return new BPromise(function(_0x42e089,_0x1b52ac){return client[_0x5693('0x12')](_0x22ee97,_0x4749e4)['then'](function(_0x3cd39c){logger[_0x5693('0x13')](_0x5693('0x14'),_0x3a29a0,_0x5693('0x15'));logger[_0x5693('0x16')](_0x5693('0x17'),_0x3a29a0,'request\x20sent',JSON[_0x5693('0x18')](_0x3cd39c));if(_0x3cd39c[_0x5693('0x19')]){if(_0x3cd39c[_0x5693('0x19')][_0x5693('0x1a')]===0x1f4){logger[_0x5693('0x19')](_0x5693('0x14'),_0x3a29a0,_0x3cd39c['error'][_0x5693('0x1b')]);return _0x1b52ac(_0x3cd39c[_0x5693('0x19')][_0x5693('0x1b')]);}logger['error'](_0x5693('0x14'),_0x3a29a0,_0x3cd39c[_0x5693('0x19')][_0x5693('0x1b')]);return _0x42e089(_0x3cd39c['error']['message']);}else{logger[_0x5693('0x13')](_0x5693('0x14'),_0x3a29a0,'request\x20sent');_0x42e089(_0x3cd39c[_0x5693('0x1c')][_0x5693('0x1b')]);}})[_0x5693('0x1d')](function(_0x53b921){logger[_0x5693('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x3a29a0,_0x53b921);_0x1b52ac(_0x53b921);});});}exports['UpdateFaxInteraction']=function(_0x33d71d){var _0x721ad9=this;return new Promise(function(_0x296e3d,_0x351a8d){return db['FaxInteraction'][_0x5693('0x1e')](_0x33d71d[_0x5693('0x1f')],{'raw':_0x33d71d['options']?_0x33d71d[_0x5693('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33d71d[_0x5693('0x20')]?_0x33d71d['options'][_0x5693('0x21')]||null:null,'attributes':_0x33d71d['options']?_0x33d71d[_0x5693('0x20')][_0x5693('0x22')]||null:null,'limit':_0x33d71d[_0x5693('0x20')]?_0x33d71d[_0x5693('0x20')][_0x5693('0x23')]||null:null})[_0x5693('0x24')](function(_0x3c98f2){logger['info'](_0x5693('0x25'),_0x33d71d);logger[_0x5693('0x16')](_0x5693('0x25'),_0x33d71d,JSON[_0x5693('0x18')](_0x3c98f2));_0x296e3d(_0x3c98f2);})['catch'](function(_0x1c897e){logger[_0x5693('0x19')](_0x5693('0x25'),_0x1c897e[_0x5693('0x1b')],_0x33d71d);_0x351a8d(_0x721ad9['error'](0x1f4,_0x1c897e[_0x5693('0x1b')]));});});};exports[_0x5693('0x26')]=function(_0x5207a8){return new Promise(function(_0x3d9214,_0x4004ce){return db[_0x5693('0x27')][_0x5693('0x28')]({'where':_0x5207a8[_0x5693('0x20')]?_0x5207a8[_0x5693('0x20')][_0x5693('0x21')]||null:null})['then'](function(_0x45a696){if(_0x45a696){return _0x45a696['addTags'](_0x5207a8[_0x5693('0x1f')][_0x5693('0x29')],_[_0x5693('0x2a')](_0x5207a8[_0x5693('0x1f')],[_0x5693('0x29'),'id'])||{});}})['spread'](function(_0x18f409){logger[_0x5693('0x13')]('AddTags',_0x5207a8);logger[_0x5693('0x16')](_0x5693('0x2b'),_0x5207a8,JSON['stringify'](_0x18f409));_0x3d9214(_0x18f409);})[_0x5693('0x1d')](function(_0x2cbfc8){logger[_0x5693('0x19')]('AddTags',_0x2cbfc8[_0x5693('0x1b')],_0x5207a8);_0x4004ce(_this[_0x5693('0x19')](0x1f4,_0x2cbfc8[_0x5693('0x1b')]));});});}; \ No newline at end of file +var _0x2d7c=['addTags','body','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','info','FaxInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','UpdateFaxInteraction','options','raw','where','attributes','limit','AddTagsToFaxInteraction'];(function(_0x304e17,_0x1568ee){var _0x42a19c=function(_0x5b62d3){while(--_0x5b62d3){_0x304e17['push'](_0x304e17['shift']());}};_0x42a19c(++_0x1568ee);}(_0x2d7c,0x116));var _0xc2d7=function(_0x511e82,_0x5c8e7b){_0x511e82=_0x511e82-0x0;var _0x32bc8e=_0x2d7c[_0x511e82];return _0x32bc8e;};'use strict';var _=require(_0xc2d7('0x0'));var util=require('util');var moment=require(_0xc2d7('0x1'));var BPromise=require(_0xc2d7('0x2'));var rs=require(_0xc2d7('0x3'));var fs=require('fs');var Redis=require(_0xc2d7('0x4'));var db=require(_0xc2d7('0x5'))['db'];var utils=require(_0xc2d7('0x6'));var logger=require(_0xc2d7('0x7'))(_0xc2d7('0x8'));var config=require(_0xc2d7('0x9'));var jayson=require(_0xc2d7('0xa'));var client=jayson[_0xc2d7('0xb')][_0xc2d7('0xc')]({'port':0x232a});config[_0xc2d7('0xd')]=_['defaults'](config[_0xc2d7('0xd')],{'host':_0xc2d7('0xe'),'port':0x18eb});var socket=require(_0xc2d7('0xf'))(new Redis(config['redis']));require('./faxInteraction.socket')['register'](socket);function respondWithRpcPromise(_0xfc6303,_0x3f964a,_0xb0eed7){return new BPromise(function(_0x4bd5f1,_0x4894ef){return client[_0xc2d7('0x10')](_0xfc6303,_0xb0eed7)[_0xc2d7('0x11')](function(_0xcf5a76){logger[_0xc2d7('0x12')](_0xc2d7('0x13'),_0x3f964a,'request\x20sent');logger[_0xc2d7('0x14')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x3f964a,_0xc2d7('0x15'),JSON[_0xc2d7('0x16')](_0xcf5a76));if(_0xcf5a76[_0xc2d7('0x17')]){if(_0xcf5a76[_0xc2d7('0x17')][_0xc2d7('0x18')]===0x1f4){logger['error'](_0xc2d7('0x13'),_0x3f964a,_0xcf5a76[_0xc2d7('0x17')][_0xc2d7('0x19')]);return _0x4894ef(_0xcf5a76[_0xc2d7('0x17')][_0xc2d7('0x19')]);}logger[_0xc2d7('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x3f964a,_0xcf5a76[_0xc2d7('0x17')]['message']);return _0x4bd5f1(_0xcf5a76[_0xc2d7('0x17')][_0xc2d7('0x19')]);}else{logger[_0xc2d7('0x12')](_0xc2d7('0x13'),_0x3f964a,_0xc2d7('0x15'));_0x4bd5f1(_0xcf5a76['result'][_0xc2d7('0x19')]);}})[_0xc2d7('0x1a')](function(_0x1049b8){logger[_0xc2d7('0x17')](_0xc2d7('0x13'),_0x3f964a,_0x1049b8);_0x4894ef(_0x1049b8);});});}exports[_0xc2d7('0x1b')]=function(_0x3a59f2){var _0x18705b=this;return new Promise(function(_0x23a32a,_0x126b65){return db['FaxInteraction']['update'](_0x3a59f2['body'],{'raw':_0x3a59f2['options']?_0x3a59f2[_0xc2d7('0x1c')][_0xc2d7('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a59f2[_0xc2d7('0x1c')]?_0x3a59f2[_0xc2d7('0x1c')][_0xc2d7('0x1e')]||null:null,'attributes':_0x3a59f2[_0xc2d7('0x1c')]?_0x3a59f2[_0xc2d7('0x1c')][_0xc2d7('0x1f')]||null:null,'limit':_0x3a59f2[_0xc2d7('0x1c')]?_0x3a59f2[_0xc2d7('0x1c')][_0xc2d7('0x20')]||null:null})[_0xc2d7('0x11')](function(_0x112be5){logger[_0xc2d7('0x12')](_0xc2d7('0x1b'),_0x3a59f2);logger[_0xc2d7('0x14')](_0xc2d7('0x1b'),_0x3a59f2,JSON[_0xc2d7('0x16')](_0x112be5));_0x23a32a(_0x112be5);})[_0xc2d7('0x1a')](function(_0x21cf1c){logger[_0xc2d7('0x17')](_0xc2d7('0x1b'),_0x21cf1c['message'],_0x3a59f2);_0x126b65(_0x18705b[_0xc2d7('0x17')](0x1f4,_0x21cf1c[_0xc2d7('0x19')]));});});};exports[_0xc2d7('0x21')]=function(_0xc83cdd){return new Promise(function(_0x2172e8,_0x3f2da6){return db['FaxInteraction']['find']({'where':_0xc83cdd[_0xc2d7('0x1c')]?_0xc83cdd[_0xc2d7('0x1c')][_0xc2d7('0x1e')]||null:null})[_0xc2d7('0x11')](function(_0x332507){if(_0x332507){return _0x332507[_0xc2d7('0x22')](_0xc83cdd[_0xc2d7('0x23')][_0xc2d7('0x24')],_[_0xc2d7('0x25')](_0xc83cdd[_0xc2d7('0x23')],[_0xc2d7('0x24'),'id'])||{});}})['spread'](function(_0x1f9ac1){logger['info'](_0xc2d7('0x26'),_0xc83cdd);logger[_0xc2d7('0x14')](_0xc2d7('0x26'),_0xc83cdd,JSON['stringify'](_0x1f9ac1));_0x2172e8(_0x1f9ac1);})[_0xc2d7('0x1a')](function(_0x3d5405){logger[_0xc2d7('0x17')]('AddTags',_0x3d5405[_0xc2d7('0x19')],_0xc83cdd);_0x3f2da6(_this[_0xc2d7('0x17')](0x1f4,_0x3d5405['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index f4769e3..76a3100 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 _0x5de0=['remove','update','emit','removeListener','register','length','faxInteraction:','./faxInteraction.events'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5de0,0x1cf));var _0x05de=function(_0x218a54,_0x82b9bd){_0x218a54=_0x218a54-0x0;var _0x13d3bb=_0x5de0[_0x218a54];return _0x13d3bb;};'use strict';var FaxInteractionEvents=require(_0x05de('0x0'));var events=['save',_0x05de('0x1'),_0x05de('0x2')];function createListener(_0x23cdc9,_0x340313){return function(_0x1ac422){_0x340313[_0x05de('0x3')](_0x23cdc9,_0x1ac422);};}function removeListener(_0x1bdb2f,_0x676ca1){return function(){FaxInteractionEvents[_0x05de('0x4')](_0x1bdb2f,_0x676ca1);};}exports[_0x05de('0x5')]=function(_0x3b637d){for(var _0x224327=0x0,_0x30e2c1=events[_0x05de('0x6')];_0x224327<_0x30e2c1;_0x224327++){var _0x551d1a=events[_0x224327];var _0x3e20dd=createListener(_0x05de('0x7')+_0x551d1a,_0x3b637d);FaxInteractionEvents['on'](_0x551d1a,_0x3e20dd);}}; \ No newline at end of file +var _0xef5c=['register','length','faxInteraction:','./faxInteraction.events','save','remove','update','removeListener'];(function(_0x31c10d,_0x5aa26f){var _0x16d696=function(_0x32d35e){while(--_0x32d35e){_0x31c10d['push'](_0x31c10d['shift']());}};_0x16d696(++_0x5aa26f);}(_0xef5c,0xbb));var _0xcef5=function(_0x565e36,_0x550f47){_0x565e36=_0x565e36-0x0;var _0xe0260e=_0xef5c[_0x565e36];return _0xe0260e;};'use strict';var FaxInteractionEvents=require(_0xcef5('0x0'));var events=[_0xcef5('0x1'),_0xcef5('0x2'),_0xcef5('0x3')];function createListener(_0x235605,_0x20cf3f){return function(_0x3bb28d){_0x20cf3f['emit'](_0x235605,_0x3bb28d);};}function removeListener(_0x103435,_0x3a3b89){return function(){FaxInteractionEvents[_0xcef5('0x4')](_0x103435,_0x3a3b89);};}exports[_0xcef5('0x5')]=function(_0x43d5b2){for(var _0x114bac=0x0,_0x1170fb=events[_0xcef5('0x6')];_0x114bac<_0x1170fb;_0x114bac++){var _0x2677e3=events[_0x114bac];var _0x2089fb=createListener(_0xcef5('0x7')+_0x2677e3,_0x43d5b2);FaxInteractionEvents['on'](_0x2677e3,_0x2089fb);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index da5a2bc..1bd696d 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 _0xc574=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','/:id/tags','removeTags','exports','multer'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0xc574,0x107));var _0x4c57=function(_0x3a00f8,_0x190793){_0x3a00f8=_0x3a00f8-0x0;var _0x18bcaf=_0xc574[_0x3a00f8];return _0x18bcaf;};'use strict';var multer=require(_0x4c57('0x0'));var util=require(_0x4c57('0x1'));var path=require(_0x4c57('0x2'));var timeout=require('connect-timeout');var express=require(_0x4c57('0x3'));var router=express[_0x4c57('0x4')]();var fs_extra=require(_0x4c57('0x5'));var auth=require(_0x4c57('0x6'));var interaction=require(_0x4c57('0x7'));var config=require('../../config/environment');var controller=require(_0x4c57('0x8'));router[_0x4c57('0x9')]('/',auth[_0x4c57('0xa')](),controller['index']);router[_0x4c57('0x9')](_0x4c57('0xb'),auth[_0x4c57('0xa')](),controller[_0x4c57('0xc')]);router[_0x4c57('0x9')](_0x4c57('0xd'),auth[_0x4c57('0xa')](),controller[_0x4c57('0xe')]);router['get'](_0x4c57('0xf'),auth[_0x4c57('0xa')](),controller[_0x4c57('0x10')]);router[_0x4c57('0x9')](_0x4c57('0x11'),auth['isAuthenticated'](),controller[_0x4c57('0x12')]);router[_0x4c57('0x13')]('/',auth[_0x4c57('0xa')](),controller[_0x4c57('0x14')]);router[_0x4c57('0x13')](_0x4c57('0xf'),auth[_0x4c57('0xa')](),controller['addMessage']);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0x4c57('0x15')](_0x4c57('0x16'),_0x4c57('0x17')),controller[_0x4c57('0x18')]);router[_0x4c57('0x19')](_0x4c57('0xd'),auth[_0x4c57('0xa')](),interaction[_0x4c57('0x15')](_0x4c57('0x16'),_0x4c57('0x1a')),controller[_0x4c57('0x1b')]);router[_0x4c57('0x1c')](_0x4c57('0xd'),auth['isAuthenticated'](),interaction[_0x4c57('0x15')](_0x4c57('0x16'),_0x4c57('0x1d')),controller['destroy']);router[_0x4c57('0x1c')](_0x4c57('0x1e'),auth[_0x4c57('0xa')](),controller[_0x4c57('0x1f')]);module[_0x4c57('0x20')]=router; \ No newline at end of file +var _0x5c6e=['update','delete','faxinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','fax','faxinteraction:addtags','addTags','put','tracked','faxinteraction:update'];(function(_0x2122f,_0x41c9d7){var _0x25924c=function(_0x4adc79){while(--_0x4adc79){_0x2122f['push'](_0x2122f['shift']());}};_0x25924c(++_0x41c9d7);}(_0x5c6e,0x11c));var _0xe5c6=function(_0x1d7037,_0x57dd95){_0x1d7037=_0x1d7037-0x0;var _0x4d6568=_0x5c6e[_0x1d7037];return _0x4d6568;};'use strict';var multer=require(_0xe5c6('0x0'));var util=require(_0xe5c6('0x1'));var path=require(_0xe5c6('0x2'));var timeout=require(_0xe5c6('0x3'));var express=require(_0xe5c6('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe5c6('0x5'));var controller=require(_0xe5c6('0x6'));router[_0xe5c6('0x7')]('/',auth[_0xe5c6('0x8')](),controller[_0xe5c6('0x9')]);router[_0xe5c6('0x7')]('/describe',auth[_0xe5c6('0x8')](),controller['describe']);router[_0xe5c6('0x7')](_0xe5c6('0xa'),auth[_0xe5c6('0x8')](),controller[_0xe5c6('0xb')]);router[_0xe5c6('0x7')]('/:id/messages',auth[_0xe5c6('0x8')](),controller[_0xe5c6('0xc')]);router[_0xe5c6('0x7')](_0xe5c6('0xd'),auth[_0xe5c6('0x8')](),controller[_0xe5c6('0xe')]);router[_0xe5c6('0xf')]('/',auth['isAuthenticated'](),controller[_0xe5c6('0x10')]);router[_0xe5c6('0xf')](_0xe5c6('0x11'),auth['isAuthenticated'](),controller[_0xe5c6('0x12')]);router[_0xe5c6('0xf')](_0xe5c6('0x13'),auth[_0xe5c6('0x8')](),interaction['tracked'](_0xe5c6('0x14'),_0xe5c6('0x15')),controller[_0xe5c6('0x16')]);router[_0xe5c6('0x17')]('/:id',auth['isAuthenticated'](),interaction[_0xe5c6('0x18')](_0xe5c6('0x14'),_0xe5c6('0x19')),controller[_0xe5c6('0x1a')]);router[_0xe5c6('0x1b')](_0xe5c6('0xa'),auth[_0xe5c6('0x8')](),interaction[_0xe5c6('0x18')]('fax',_0xe5c6('0x1c')),controller[_0xe5c6('0x1d')]);router['delete']('/:id/tags',auth[_0xe5c6('0x8')](),controller['removeTags']);module[_0xe5c6('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 134a948..bd02c79 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 _0x028d=['ENUM','out','DATE','exports','TEXT','BOOLEAN'];(function(_0x44417d,_0xcbd30c){var _0xd9c1a4=function(_0x5caeb6){while(--_0x5caeb6){_0x44417d['push'](_0x44417d['shift']());}};_0xd9c1a4(++_0xcbd30c);}(_0x028d,0xff));var _0xd028=function(_0x48fbbd,_0xe170ed){_0x48fbbd=_0x48fbbd-0x0;var _0x3fd20d=_0x028d[_0x48fbbd];return _0x3fd20d;};'use strict';var Sequelize=require('sequelize');module[_0xd028('0x0')]={'body':{'type':Sequelize[_0xd028('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd028('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd028('0x3')]('in',_0xd028('0x4')),'defaultValue':_0xd028('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xd028('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xd028('0x5')]}}; \ No newline at end of file +var _0xe3ee=['out','DATE','TEXT','medium'];(function(_0xf086a2,_0x44f469){var _0x5ca86f=function(_0x19a3dd){while(--_0x19a3dd){_0xf086a2['push'](_0xf086a2['shift']());}};_0x5ca86f(++_0x44f469);}(_0xe3ee,0x116));var _0xee3e=function(_0x10cf8c,_0x15488c){_0x10cf8c=_0x10cf8c-0x0;var _0x53b810=_0xe3ee[_0x10cf8c];return _0x53b810;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xee3e('0x0')](_0xee3e('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xee3e('0x2')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xee3e('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 34ff230..550d003 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 _0xcecf=['../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','save','update','then','name','send','index','rawAttributes','fieldName','type','model','map','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','FaxMessage','find','body','destroy','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','internal','manual','SIP/%s','channel','event','EventManager','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','User','email','interface','motionChannel','create','CmContact','findOne','fax','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','root','server','attachments','join','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x55db51,_0x2e4468){var _0x59642a=function(_0x195efd){while(--_0x195efd){_0x55db51['push'](_0x55db51['shift']());}};_0x59642a(++_0x2e4468);}(_0xcecf,0x19e));var _0xfcec=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xcecf[_0x46698a];return _0x356db0;};'use strict';var emlformat=require(_0xfcec('0x0'));var rimraf=require(_0xfcec('0x1'));var zipdir=require(_0xfcec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfcec('0x3'));var moment=require('moment');var BPromise=require(_0xfcec('0x4'));var Mustache=require(_0xfcec('0x5'));var util=require(_0xfcec('0x6'));var path=require(_0xfcec('0x7'));var sox=require(_0xfcec('0x8'));var csv=require(_0xfcec('0x9'));var ejs=require(_0xfcec('0xa'));var fs=require('fs');var fs_extra=require(_0xfcec('0xb'));var _=require(_0xfcec('0xc'));var squel=require(_0xfcec('0xd'));var crypto=require(_0xfcec('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfcec('0xf'));var toCsv=require(_0xfcec('0x9'));var querystring=require(_0xfcec('0x10'));var Papa=require(_0xfcec('0x11'));var Redis=require('ioredis');var authService=require(_0xfcec('0x12'));var qs=require(_0xfcec('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcec('0x14'));var logger=require(_0xfcec('0x15'))(_0xfcec('0x16'));var utils=require(_0xfcec('0x17'));var config=require(_0xfcec('0x18'));var licenseUtil=require(_0xfcec('0x19'));var db=require(_0xfcec('0x1a'))['db'];config[_0xfcec('0x1b')]=_['defaults'](config[_0xfcec('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xfcec('0x1c'))(new Redis(config[_0xfcec('0x1b')]));require(_0xfcec('0x1d'))['register'](socket);var jayson=require(_0xfcec('0x1e'));var client=jayson[_0xfcec('0x1f')][_0xfcec('0x20')]({'port':0x232c});var client9002=jayson['client'][_0xfcec('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x920a95,_0x3756c2,_0x4af8b6,_0x105fe7){return new BPromise(function(_0x4fb1c6,_0x562e60){var _0x468e39=_0x105fe7||client;return _0x468e39[_0xfcec('0x21')](_0x920a95,_0x4af8b6)['then'](function(_0xc9f9e2){logger[_0xfcec('0x22')](_0xfcec('0x23'),_0x3756c2,'request\x20sent');logger[_0xfcec('0x24')](_0xfcec('0x25'),_0x3756c2,_0xfcec('0x26'),JSON[_0xfcec('0x27')](_0xc9f9e2));if(_0xc9f9e2[_0xfcec('0x28')]){if(_0xc9f9e2['error'][_0xfcec('0x29')]===0x1f4){logger[_0xfcec('0x28')](_0xfcec('0x23'),_0x3756c2,_0xc9f9e2['error']['message']);return _0x562e60(_0xc9f9e2[_0xfcec('0x28')][_0xfcec('0x2a')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x3756c2,_0xc9f9e2[_0xfcec('0x28')]['message']);return _0x4fb1c6(_0xc9f9e2['error'][_0xfcec('0x2a')]);}else{logger[_0xfcec('0x22')](_0xfcec('0x23'),_0x3756c2,_0xfcec('0x26'));_0x4fb1c6(_0xc9f9e2[_0xfcec('0x2b')][_0xfcec('0x2a')]);}})[_0xfcec('0x2c')](function(_0x47a731){logger[_0xfcec('0x28')](_0xfcec('0x23'),_0x3756c2,_0x47a731);_0x562e60(_0x47a731);});});}function respondWithStatusCode(_0x15e9ad,_0x44418a){_0x44418a=_0x44418a||0xcc;return function(_0x31a552){if(_0x31a552){return _0x15e9ad[_0xfcec('0x2d')](_0x44418a);}return _0x15e9ad[_0xfcec('0x2e')](_0x44418a)[_0xfcec('0x2f')]();};}function respondWithResult(_0x53acba,_0x116fc6){_0x116fc6=_0x116fc6||0xc8;return function(_0x39b769){if(_0x39b769){return _0x53acba[_0xfcec('0x2e')](_0x116fc6)[_0xfcec('0x30')](_0x39b769);}};}function respondWithFilteredResult(_0x349629,_0x352bfd){return function(_0xf9d327){if(_0xf9d327){var _0x4b59ab=typeof _0x352bfd[_0xfcec('0x31')]===_0xfcec('0x32')&&typeof _0x352bfd['limit']==='undefined';var _0x4dc99e=_0xf9d327[_0xfcec('0x33')];var _0x434f35=_0x4b59ab?0x0:_0x352bfd[_0xfcec('0x31')];var _0x85827=_0x4b59ab?_0xf9d327[_0xfcec('0x33')]:_0x352bfd[_0xfcec('0x31')]+_0x352bfd[_0xfcec('0x34')];var _0x207976;if(_0x85827>=_0x4dc99e){_0x85827=_0x4dc99e;_0x207976=0xc8;}else{_0x207976=0xce;}_0x349629[_0xfcec('0x2e')](_0x207976);return _0x349629['set'](_0xfcec('0x35'),_0x434f35+'-'+_0x85827+'/'+_0x4dc99e)[_0xfcec('0x30')](_0xf9d327);}return null;};}function patchUpdates(_0x39aa35){return function(_0x1beb6f){try{jsonpatch['apply'](_0x1beb6f,_0x39aa35,!![]);}catch(_0x565e1c){return BPromise['reject'](_0x565e1c);}return _0x1beb6f[_0xfcec('0x36')]();};}function saveUpdates(_0x197223,_0x17d27e){return function(_0x41601d){if(_0x41601d){return _0x41601d[_0xfcec('0x37')](_0x197223)[_0xfcec('0x38')](function(_0x1d98af){return _0x1d98af;});}return null;};}function removeEntity(_0x252e6c,_0x359aeb){return function(_0x13fc5c){if(_0x13fc5c){return _0x13fc5c['destroy']()[_0xfcec('0x38')](function(){_0x252e6c[_0xfcec('0x2e')](0xcc)[_0xfcec('0x2f')]();});}};}function handleEntityNotFound(_0x5a4a0a,_0x5587c9){return function(_0x56220c){if(!_0x56220c){_0x5a4a0a['sendStatus'](0x194);}return _0x56220c;};}function handleError(_0x3421fd,_0x7b6a7f){_0x7b6a7f=_0x7b6a7f||0x1f4;return function(_0x536472){logger[_0xfcec('0x28')](_0x536472['stack']);if(_0x536472[_0xfcec('0x39')]){delete _0x536472[_0xfcec('0x39')];}_0x3421fd[_0xfcec('0x2e')](_0x7b6a7f)[_0xfcec('0x3a')](_0x536472);};}exports[_0xfcec('0x3b')]=function(_0x4231f8,_0x5cd79c){var _0x4ebad9={},_0x22a31c={},_0x3d5057={'count':0x0,'rows':[]};var _0x34f641=_['map'](db['FaxMessage'][_0xfcec('0x3c')],function(_0x2aaad8){return{'name':_0x2aaad8[_0xfcec('0x3d')],'type':_0x2aaad8[_0xfcec('0x3e')]['key']};});_0x22a31c[_0xfcec('0x3f')]=_[_0xfcec('0x40')](_0x34f641,'name');_0x22a31c['query']=_[_0xfcec('0x41')](_0x4231f8['query']);_0x22a31c['filters']=_[_0xfcec('0x42')](_0x22a31c[_0xfcec('0x3f')],_0x22a31c[_0xfcec('0x43')]);_0x4ebad9[_0xfcec('0x44')]=_[_0xfcec('0x42')](_0x22a31c[_0xfcec('0x3f')],qs[_0xfcec('0x45')](_0x4231f8[_0xfcec('0x43')][_0xfcec('0x45')]));_0x4ebad9[_0xfcec('0x44')]=_0x4ebad9[_0xfcec('0x44')]['length']?_0x4ebad9[_0xfcec('0x44')]:_0x22a31c['model'];if(!_0x4231f8[_0xfcec('0x43')][_0xfcec('0x46')](_0xfcec('0x47'))){_0x4ebad9[_0xfcec('0x34')]=qs['limit'](_0x4231f8[_0xfcec('0x43')][_0xfcec('0x34')]);_0x4ebad9[_0xfcec('0x31')]=qs[_0xfcec('0x31')](_0x4231f8[_0xfcec('0x43')][_0xfcec('0x31')]);}_0x4ebad9['order']=qs[_0xfcec('0x48')](_0x4231f8['query'][_0xfcec('0x48')]);_0x4ebad9['where']=qs[_0xfcec('0x49')](_[_0xfcec('0x4a')](_0x4231f8['query'],_0x22a31c['filters']),_0x34f641);if(_0x4231f8['query'][_0xfcec('0x4b')]){_0x4ebad9[_0xfcec('0x4c')]=_[_0xfcec('0x4d')](_0x4ebad9[_0xfcec('0x4c')],{'$or':_[_0xfcec('0x40')](_0x34f641,function(_0xa04681){if(_0xa04681[_0xfcec('0x3e')]!==_0xfcec('0x4e')){var _0x5ee874={};_0x5ee874[_0xa04681[_0xfcec('0x39')]]={'$like':'%'+_0x4231f8[_0xfcec('0x43')]['filter']+'%'};return _0x5ee874;}})});}_0x4ebad9=_[_0xfcec('0x4d')]({},_0x4ebad9,_0x4231f8[_0xfcec('0x4f')]);var _0x201b51={'where':_0x4ebad9[_0xfcec('0x4c')]};return db['FaxMessage'][_0xfcec('0x33')](_0x201b51)[_0xfcec('0x38')](function(_0x412480){_0x3d5057[_0xfcec('0x33')]=_0x412480;if(_0x4231f8['query'][_0xfcec('0x50')]){_0x4ebad9[_0xfcec('0x51')]=[{'all':!![]}];}return db['FaxMessage'][_0xfcec('0x52')](_0x4ebad9);})[_0xfcec('0x38')](function(_0x1f1d40){_0x3d5057[_0xfcec('0x53')]=_0x1f1d40;return _0x3d5057;})[_0xfcec('0x38')](respondWithFilteredResult(_0x5cd79c,_0x4ebad9))[_0xfcec('0x2c')](handleError(_0x5cd79c,null));};exports[_0xfcec('0x54')]=function(_0xb46b92,_0x3081d7){var _0x4a4ed5={'raw':!![],'where':{'id':_0xb46b92[_0xfcec('0x55')]['id']}},_0x46a254={};_0x46a254['model']=_[_0xfcec('0x41')](db[_0xfcec('0x56')][_0xfcec('0x3c')]);_0x46a254['query']=_[_0xfcec('0x41')](_0xb46b92['query']);_0x46a254[_0xfcec('0x49')]=_['intersection'](_0x46a254[_0xfcec('0x3f')],_0x46a254['query']);_0x4a4ed5['attributes']=_[_0xfcec('0x42')](_0x46a254[_0xfcec('0x3f')],qs[_0xfcec('0x45')](_0xb46b92[_0xfcec('0x43')][_0xfcec('0x45')]));_0x4a4ed5[_0xfcec('0x44')]=_0x4a4ed5[_0xfcec('0x44')]['length']?_0x4a4ed5[_0xfcec('0x44')]:_0x46a254[_0xfcec('0x3f')];if(_0xb46b92[_0xfcec('0x43')][_0xfcec('0x50')]){_0x4a4ed5[_0xfcec('0x51')]=[{'all':!![]}];}_0x4a4ed5=_[_0xfcec('0x4d')]({},_0x4a4ed5,_0xb46b92['options']);return db[_0xfcec('0x56')][_0xfcec('0x57')](_0x4a4ed5)[_0xfcec('0x38')](handleEntityNotFound(_0x3081d7,null))[_0xfcec('0x38')](respondWithResult(_0x3081d7,null))[_0xfcec('0x2c')](handleError(_0x3081d7,null));};exports[_0xfcec('0x37')]=function(_0x516211,_0x182ef0){if(_0x516211[_0xfcec('0x58')]['id']){delete _0x516211[_0xfcec('0x58')]['id'];}return db[_0xfcec('0x56')][_0xfcec('0x57')]({'where':{'id':_0x516211['params']['id']}})[_0xfcec('0x38')](handleEntityNotFound(_0x182ef0,null))[_0xfcec('0x38')](saveUpdates(_0x516211[_0xfcec('0x58')],null))[_0xfcec('0x38')](respondWithResult(_0x182ef0,null))[_0xfcec('0x2c')](handleError(_0x182ef0,null));};exports[_0xfcec('0x59')]=function(_0x35be38,_0x42b315){return db[_0xfcec('0x56')][_0xfcec('0x57')]({'where':{'id':_0x35be38[_0xfcec('0x55')]['id']}})['then'](handleEntityNotFound(_0x42b315,null))[_0xfcec('0x38')](removeEntity(_0x42b315,null))['catch'](handleError(_0x42b315,null));};exports['describe']=function(_0x5df56a,_0x20f6f8){return db['FaxMessage']['describe']()[_0xfcec('0x38')](respondWithResult(_0x20f6f8,null))[_0xfcec('0x2c')](handleError(_0x20f6f8,null));};var interaction_log=require(_0xfcec('0x15'))(_0xfcec('0x5a'));exports[_0xfcec('0x5b')]=function(_0x33558b,_0x52d811,_0x896835){var _0x2c16e3={'agent':{},'channel':'fax'};if(_0x33558b[_0xfcec('0x58')]['id']){delete _0x33558b[_0xfcec('0x58')]['id'];}_0x33558b[_0xfcec('0x58')][_0xfcec('0x5c')]=!![];_0x33558b[_0xfcec('0x58')][_0xfcec('0x5d')]=moment()[_0xfcec('0x5e')](_0xfcec('0x5f'));_0x33558b['body']['UserId']=_0x33558b[_0xfcec('0x58')][_0xfcec('0x60')]||_0x33558b[_0xfcec('0x61')]['id'];_0x2c16e3[_0xfcec('0x62')]['id']=_0x33558b[_0xfcec('0x58')][_0xfcec('0x60')];return db[_0xfcec('0x56')][_0xfcec('0x57')]({'where':{'id':_0x33558b['params']['id'],'UserId':null}})[_0xfcec('0x38')](handleEntityNotFound(_0x52d811,null))[_0xfcec('0x38')](saveUpdates(_0x33558b[_0xfcec('0x58')],null))[_0xfcec('0x38')](function(_0x109ba){if(_0x109ba){_0x2c16e3[_0xfcec('0x2a')]=_0x109ba[_0xfcec('0x63')]({'plain':!![]});return db[_0xfcec('0x64')][_0xfcec('0x57')]({'where':{'id':_0x109ba[_0xfcec('0x65')]}});}return null;})[_0xfcec('0x38')](handleEntityNotFound(_0x52d811,null))['then'](function(_0x296f34){if(_0x296f34){return _0x296f34[_0xfcec('0x37')]({'UserId':_0x33558b[_0xfcec('0x58')][_0xfcec('0x60')],'read1stAt':_[_0xfcec('0x66')](_0x296f34[_0xfcec('0x67')])?moment()[_0xfcec('0x5e')](_0xfcec('0x5f')):undefined});}return null;})[_0xfcec('0x38')](function(_0x42ba46){if(_0x42ba46){_0x2c16e3[_0xfcec('0x68')]=_0x42ba46['get']({'plain':!![]});interaction_log[_0xfcec('0x22')](_0xfcec('0x69'),_0x33558b[_0xfcec('0x61')]['id'],_0x33558b[_0xfcec('0x61')][_0xfcec('0x39')],_0x33558b[_0xfcec('0x61')][_0xfcec('0x6a')],_0x2c16e3[_0xfcec('0x68')]['id'],_0x33558b[_0xfcec('0x58')]?JSON[_0xfcec('0x27')](_0x33558b['body']):_0xfcec('0x6b'));return respondWithRpcPromise('AcceptMessage',_0xfcec('0x6c'),_0x2c16e3);}return null;})['then'](function(_0x359d05){var _0x1d3514=_0xfcec('0x6d')+_0x359d05[_0xfcec('0x2a')][_0xfcec('0x6e')];return db[_0xfcec('0x6f')][_0xfcec('0x43')](_0x1d3514,{'type':db[_0xfcec('0x70')][_0xfcec('0x71')][_0xfcec('0x72')],'raw':!![]})['then'](function(_0x44cbdc){return _0x44cbdc;});})[_0xfcec('0x38')](function(_0x42e99c){if(_0x42e99c){_0x2c16e3[_0xfcec('0x2a')][_0xfcec('0x73')]=_0x42e99c[0x0];if(!_0x33558b['body'][_0xfcec('0x60')])return;return db['User'][_0xfcec('0x57')]({'where':{'id':_0x33558b['body'][_0xfcec('0x60')],'role':_0xfcec('0x62')},'attributes':['id',_0xfcec('0x39'),_0xfcec('0x74'),'email',_0xfcec('0x75')],'raw':!![]});}return null;})[_0xfcec('0x38')](function(_0x3b8373){if(!_0x3b8373)return null;_0x2c16e3[_0xfcec('0x2a')][_0xfcec('0x62')]=_0x3b8373;return _0x2c16e3;})[_0xfcec('0x38')](function(_0x7078ab){if(_0x7078ab){if(_0x33558b[_0xfcec('0x58')][_0xfcec('0x76')]){_0x2c16e3['message']['interface']=util['format'](_0xfcec('0x77'),_0x33558b[_0xfcec('0x61')]['name']);_0x2c16e3[_0xfcec('0x2a')][_0xfcec('0x78')]=_0x2c16e3[_0xfcec('0x78')];_0x2c16e3[_0xfcec('0x2a')]['motionChannel']=_0x2c16e3[_0xfcec('0x78')];_0x2c16e3['message'][_0xfcec('0x79')]=_0xfcec('0x5b');return respondWithRpcPromise(_0xfcec('0x7a'),_0xfcec('0x7a'),{'event':'acceptmessage','message':_0x2c16e3['message']},client9002)[_0xfcec('0x38')](function(){return _0x2c16e3;});}return _0x2c16e3;}return null;})[_0xfcec('0x38')](respondWithResult(_0x52d811,null))[_0xfcec('0x2c')](handleError(_0x52d811,null));};var interaction_log=require(_0xfcec('0x15'))(_0xfcec('0x5a'));exports[_0xfcec('0x7b')]=function(_0x8e8626,_0xbbfae7,_0x3c54be){var _0x359617={'agent':{},'channel':'fax'};if(_0x8e8626[_0xfcec('0x58')]['id']){delete _0x8e8626[_0xfcec('0x58')]['id'];}_0x8e8626['body'][_0xfcec('0x60')]=_0x8e8626['body'][_0xfcec('0x60')]||_0x8e8626[_0xfcec('0x61')]['id'];_0x359617[_0xfcec('0x62')]['id']=_0x8e8626[_0xfcec('0x58')]['UserId'];return db['FaxMessage'][_0xfcec('0x57')]({'where':{'id':_0x8e8626[_0xfcec('0x55')]['id'],'UserId':null}})[_0xfcec('0x38')](handleEntityNotFound(_0xbbfae7,null))[_0xfcec('0x38')](function(_0x2cbd94){if(_0x2cbd94){_0x359617[_0xfcec('0x2a')]=_0x2cbd94[_0xfcec('0x63')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x2cbd94[_0xfcec('0x65')]}});}return null;})[_0xfcec('0x38')](handleEntityNotFound(_0xbbfae7,null))[_0xfcec('0x38')](function(_0x5988be){if(_0x5988be){_0x359617[_0xfcec('0x68')]=_0x5988be[_0xfcec('0x63')]({'plain':!![]});interaction_log[_0xfcec('0x22')](_0xfcec('0x7c'),_0x8e8626['user']['id'],_0x8e8626[_0xfcec('0x61')]['name'],_0x8e8626['user'][_0xfcec('0x6a')],_0x359617[_0xfcec('0x68')]['id'],_0x8e8626[_0xfcec('0x58')]?JSON['stringify'](_0x8e8626[_0xfcec('0x58')]):_0xfcec('0x6b'));return respondWithRpcPromise(_0xfcec('0x7d'),_0xfcec('0x7e'),_0x359617);}return null;})[_0xfcec('0x38')](function(_0xdef496){var _0x39736e=_0xfcec('0x6d')+_0xdef496[_0xfcec('0x2a')]['ContactId'];return db['sequelize'][_0xfcec('0x43')](_0x39736e,{'type':db[_0xfcec('0x70')][_0xfcec('0x71')][_0xfcec('0x72')],'raw':!![]})[_0xfcec('0x38')](function(_0x5269b5){return _0x5269b5;});})[_0xfcec('0x38')](function(_0x2de6b8){if(_0x2de6b8){_0x359617[_0xfcec('0x2a')][_0xfcec('0x73')]=_0x2de6b8[0x0];if(!_0x8e8626[_0xfcec('0x58')][_0xfcec('0x60')])return;return db[_0xfcec('0x7f')][_0xfcec('0x57')]({'where':{'id':_0x8e8626[_0xfcec('0x58')]['UserId'],'role':_0xfcec('0x62')},'attributes':['id',_0xfcec('0x39'),'fullname',_0xfcec('0x80'),_0xfcec('0x75')],'raw':!![]});}return null;})['then'](function(_0x10305e){if(!_0x10305e)return null;_0x359617[_0xfcec('0x2a')]['agent']=_0x10305e;return _0x359617;})[_0xfcec('0x38')](function(_0x46c5fd){if(_0x46c5fd){_0x46c5fd[_0xfcec('0x2a')][_0xfcec('0x81')]=util['format'](_0xfcec('0x77'),_0x8e8626[_0xfcec('0x61')][_0xfcec('0x39')]);_0x46c5fd['message'][_0xfcec('0x78')]=_0x359617['channel'];_0x46c5fd[_0xfcec('0x2a')][_0xfcec('0x82')]=_0x359617[_0xfcec('0x78')];_0x46c5fd[_0xfcec('0x2a')][_0xfcec('0x79')]='reject';respondWithRpcPromise(_0xfcec('0x7a'),_0xfcec('0x7a'),{'event':'rejectmessage','message':_0x46c5fd[_0xfcec('0x2a')]},client9002);return _0x359617;}return null;})[_0xfcec('0x38')](respondWithResult(_0xbbfae7,null))[_0xfcec('0x2c')](handleError(_0xbbfae7,null));};exports[_0xfcec('0x83')]=function(_0x5e9eb0,_0x4bb6f5){var _0x417d79;return db[_0xfcec('0x56')]['create'](_0x5e9eb0[_0xfcec('0x58')],{})[_0xfcec('0x38')](function(_0x5f1364){_0x417d79=_0x5f1364;return db[_0xfcec('0x84')][_0xfcec('0x85')]({'where':{'id':_0x417d79['ContactId']}});})[_0xfcec('0x38')](function(_0x59b586){if(_[_0xfcec('0x66')](_0x59b586)){return;}else{_0x417d79[_0xfcec('0x86')]=_0x59b586[_0xfcec('0x86')];return db[_0xfcec('0x87')]['findOne']({'where':{'id':_0x417d79['AttachmentId']}});}})[_0xfcec('0x38')](function(_0x1cbde5){return respondWithRpcPromise(_0xfcec('0x88'),_0xfcec('0x88'),{'FaxAccountId':_[_0xfcec('0x66')](_0x5e9eb0[_0xfcec('0x58')])?undefined:_0x5e9eb0[_0xfcec('0x58')][_0xfcec('0x89')],'path':_[_0xfcec('0x66')](_0x1cbde5)?undefined:util['format'](_0xfcec('0x8a'),_0x1cbde5[_0xfcec('0x8b')]),'fax':_[_0xfcec('0x66')](_0x417d79[_0xfcec('0x86')])?undefined:_0x417d79[_0xfcec('0x86')],'AttachmentId':_0x417d79[_0xfcec('0x8c')]},client9002);})[_0xfcec('0x38')](respondWithResult(_0x4bb6f5,0xc9))[_0xfcec('0x2c')](handleError(_0x4bb6f5,null));};exports[_0xfcec('0x8d')]=function(_0x54606f,_0x618b82){var _0x25b6a9=path['join'](config[_0xfcec('0x8e')],_0xfcec('0x8f'),'files',_0xfcec('0x90'));return db[_0xfcec('0x56')][_0xfcec('0x57')]({'where':{'id':_0x54606f['params']['id']},'include':[{'model':db[_0xfcec('0x87')],'as':_0xfcec('0x87')}]})[_0xfcec('0x38')](handleEntityNotFound(_0x618b82,null))['then'](function(_0x3d0e34){if(_0x3d0e34){return _0x618b82['download'](path[_0xfcec('0x91')](_0x25b6a9,_0x3d0e34[_0xfcec('0x87')][_0xfcec('0x8b')]));}})[_0xfcec('0x2c')](handleError(_0x618b82,null));}; \ No newline at end of file +var _0xdbd3=['EventManager','fax-interactions','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','fullname','email','interface','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','files','attachments','download','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','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','redis','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','map','FaxMessage','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','merge','include','findAll','rows','params','keys','rawAttributes','length','includeAll','options','find','catch','body','describe','accept','fax','UserId','user','agent','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','get','role','interaction','null','AcceptMessage','acceptMessage','sequelize','QueryTypes','SELECT','contact','User','internal','SIP/%s','channel','event'];(function(_0x410895,_0x1afef3){var _0x5acf7e=function(_0x400893){while(--_0x400893){_0x410895['push'](_0x410895['shift']());}};_0x5acf7e(++_0x1afef3);}(_0xdbd3,0x141));var _0x3dbd=function(_0x5f49c0,_0x27a1b4){_0x5f49c0=_0x5f49c0-0x0;var _0x5ab653=_0xdbd3[_0x5f49c0];return _0x5ab653;};'use strict';var emlformat=require(_0x3dbd('0x0'));var rimraf=require(_0x3dbd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3dbd('0x2'));var rp=require(_0x3dbd('0x3'));var moment=require(_0x3dbd('0x4'));var BPromise=require(_0x3dbd('0x5'));var Mustache=require(_0x3dbd('0x6'));var util=require('util');var path=require('path');var sox=require(_0x3dbd('0x7'));var csv=require(_0x3dbd('0x8'));var ejs=require(_0x3dbd('0x9'));var fs=require('fs');var fs_extra=require(_0x3dbd('0xa'));var _=require('lodash');var squel=require(_0x3dbd('0xb'));var crypto=require(_0x3dbd('0xc'));var jsforce=require(_0x3dbd('0xd'));var deskjs=require(_0x3dbd('0xe'));var toCsv=require(_0x3dbd('0x8'));var querystring=require(_0x3dbd('0xf'));var Papa=require(_0x3dbd('0x10'));var Redis=require('ioredis');var authService=require(_0x3dbd('0x11'));var qs=require(_0x3dbd('0x12'));var as=require(_0x3dbd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3dbd('0x14'))(_0x3dbd('0x15'));var utils=require(_0x3dbd('0x16'));var config=require(_0x3dbd('0x17'));var licenseUtil=require(_0x3dbd('0x18'));var db=require(_0x3dbd('0x19'))['db'];config['redis']=_['defaults'](config[_0x3dbd('0x1a')],{'host':_0x3dbd('0x1b'),'port':0x18eb});var socket=require(_0x3dbd('0x1c'))(new Redis(config[_0x3dbd('0x1a')]));require(_0x3dbd('0x1d'))['register'](socket);var jayson=require(_0x3dbd('0x1e'));var client=jayson[_0x3dbd('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x3dbd('0x1f')][_0x3dbd('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x344909,_0x29ac1f,_0x20bce9,_0x20b31b){return new BPromise(function(_0x129212,_0x12b8a5){var _0x29f648=_0x20b31b||client;return _0x29f648[_0x3dbd('0x21')](_0x344909,_0x20bce9)[_0x3dbd('0x22')](function(_0x35ce7a){logger['info'](_0x3dbd('0x23'),_0x29ac1f,_0x3dbd('0x24'));logger[_0x3dbd('0x25')](_0x3dbd('0x26'),_0x29ac1f,_0x3dbd('0x24'),JSON[_0x3dbd('0x27')](_0x35ce7a));if(_0x35ce7a[_0x3dbd('0x28')]){if(_0x35ce7a['error'][_0x3dbd('0x29')]===0x1f4){logger[_0x3dbd('0x28')]('FaxMessage,\x20%s,\x20%s',_0x29ac1f,_0x35ce7a[_0x3dbd('0x28')]['message']);return _0x12b8a5(_0x35ce7a[_0x3dbd('0x28')]['message']);}logger[_0x3dbd('0x28')]('FaxMessage,\x20%s,\x20%s',_0x29ac1f,_0x35ce7a['error'][_0x3dbd('0x2a')]);return _0x129212(_0x35ce7a[_0x3dbd('0x28')]['message']);}else{logger[_0x3dbd('0x2b')](_0x3dbd('0x23'),_0x29ac1f,_0x3dbd('0x24'));_0x129212(_0x35ce7a[_0x3dbd('0x2c')]['message']);}})['catch'](function(_0x3802a3){logger[_0x3dbd('0x28')](_0x3dbd('0x23'),_0x29ac1f,_0x3802a3);_0x12b8a5(_0x3802a3);});});}function respondWithStatusCode(_0x221d14,_0x28d714){_0x28d714=_0x28d714||0xcc;return function(_0x4b5457){if(_0x4b5457){return _0x221d14[_0x3dbd('0x2d')](_0x28d714);}return _0x221d14[_0x3dbd('0x2e')](_0x28d714)[_0x3dbd('0x2f')]();};}function respondWithResult(_0x3910d1,_0x3bbb35){_0x3bbb35=_0x3bbb35||0xc8;return function(_0x47a758){if(_0x47a758){return _0x3910d1[_0x3dbd('0x2e')](_0x3bbb35)['json'](_0x47a758);}};}function respondWithFilteredResult(_0x4b8c2b,_0x5cf798){return function(_0x3a9d6a){if(_0x3a9d6a){var _0x2cf29d=typeof _0x5cf798[_0x3dbd('0x30')]==='undefined'&&typeof _0x5cf798[_0x3dbd('0x31')]===_0x3dbd('0x32');var _0x45b64a=_0x3a9d6a[_0x3dbd('0x33')];var _0xa9c128=_0x2cf29d?0x0:_0x5cf798[_0x3dbd('0x30')];var _0x3c1aa4=_0x2cf29d?_0x3a9d6a[_0x3dbd('0x33')]:_0x5cf798[_0x3dbd('0x30')]+_0x5cf798[_0x3dbd('0x31')];var _0x25cc3f;if(_0x3c1aa4>=_0x45b64a){_0x3c1aa4=_0x45b64a;_0x25cc3f=0xc8;}else{_0x25cc3f=0xce;}_0x4b8c2b[_0x3dbd('0x2e')](_0x25cc3f);return _0x4b8c2b[_0x3dbd('0x34')](_0x3dbd('0x35'),_0xa9c128+'-'+_0x3c1aa4+'/'+_0x45b64a)[_0x3dbd('0x36')](_0x3a9d6a);}return null;};}function patchUpdates(_0x45ed0d){return function(_0x353113){try{jsonpatch[_0x3dbd('0x37')](_0x353113,_0x45ed0d,!![]);}catch(_0x3bf79b){return BPromise[_0x3dbd('0x38')](_0x3bf79b);}return _0x353113[_0x3dbd('0x39')]();};}function saveUpdates(_0x2f67b9,_0x1b33d3){return function(_0x2a8408){if(_0x2a8408){return _0x2a8408[_0x3dbd('0x3a')](_0x2f67b9)[_0x3dbd('0x22')](function(_0x433960){return _0x433960;});}return null;};}function removeEntity(_0x32ea48,_0x10fb92){return function(_0x431bd0){if(_0x431bd0){return _0x431bd0[_0x3dbd('0x3b')]()['then'](function(){_0x32ea48[_0x3dbd('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c2eed,_0x4f16db){return function(_0x2ca8d4){if(!_0x2ca8d4){_0x5c2eed[_0x3dbd('0x2d')](0x194);}return _0x2ca8d4;};}function handleError(_0x648029,_0x900fd5){_0x900fd5=_0x900fd5||0x1f4;return function(_0x177e08){logger[_0x3dbd('0x28')](_0x177e08[_0x3dbd('0x3c')]);if(_0x177e08[_0x3dbd('0x3d')]){delete _0x177e08[_0x3dbd('0x3d')];}_0x648029[_0x3dbd('0x2e')](_0x900fd5)[_0x3dbd('0x3e')](_0x177e08);};}exports['index']=function(_0x392e42,_0x21a125){var _0x562387={},_0x31a277={},_0x5aa0fc={'count':0x0,'rows':[]};var _0x46e751=_[_0x3dbd('0x3f')](db[_0x3dbd('0x40')]['rawAttributes'],function(_0x17e038){return{'name':_0x17e038[_0x3dbd('0x41')],'type':_0x17e038[_0x3dbd('0x42')][_0x3dbd('0x43')]};});_0x31a277[_0x3dbd('0x44')]=_['map'](_0x46e751,_0x3dbd('0x3d'));_0x31a277[_0x3dbd('0x45')]=_['keys'](_0x392e42[_0x3dbd('0x45')]);_0x31a277[_0x3dbd('0x46')]=_[_0x3dbd('0x47')](_0x31a277[_0x3dbd('0x44')],_0x31a277[_0x3dbd('0x45')]);_0x562387['attributes']=_['intersection'](_0x31a277['model'],qs[_0x3dbd('0x48')](_0x392e42['query'][_0x3dbd('0x48')]));_0x562387['attributes']=_0x562387[_0x3dbd('0x49')]['length']?_0x562387['attributes']:_0x31a277['model'];if(!_0x392e42[_0x3dbd('0x45')]['hasOwnProperty'](_0x3dbd('0x4a'))){_0x562387[_0x3dbd('0x31')]=qs[_0x3dbd('0x31')](_0x392e42[_0x3dbd('0x45')]['limit']);_0x562387[_0x3dbd('0x30')]=qs[_0x3dbd('0x30')](_0x392e42[_0x3dbd('0x45')][_0x3dbd('0x30')]);}_0x562387[_0x3dbd('0x4b')]=qs['sort'](_0x392e42[_0x3dbd('0x45')][_0x3dbd('0x4c')]);_0x562387['where']=qs['filters'](_[_0x3dbd('0x4d')](_0x392e42[_0x3dbd('0x45')],_0x31a277[_0x3dbd('0x46')]),_0x46e751);if(_0x392e42['query'][_0x3dbd('0x4e')]){_0x562387[_0x3dbd('0x4f')]=_[_0x3dbd('0x50')](_0x562387[_0x3dbd('0x4f')],{'$or':_[_0x3dbd('0x3f')](_0x46e751,function(_0x3b8467){if(_0x3b8467['type']!=='VIRTUAL'){var _0x49d95d={};_0x49d95d[_0x3b8467['name']]={'$like':'%'+_0x392e42['query'][_0x3dbd('0x4e')]+'%'};return _0x49d95d;}})});}_0x562387=_['merge']({},_0x562387,_0x392e42['options']);var _0x1bd347={'where':_0x562387['where']};return db['FaxMessage'][_0x3dbd('0x33')](_0x1bd347)['then'](function(_0x935fb3){_0x5aa0fc['count']=_0x935fb3;if(_0x392e42[_0x3dbd('0x45')]['includeAll']){_0x562387[_0x3dbd('0x51')]=[{'all':!![]}];}return db[_0x3dbd('0x40')][_0x3dbd('0x52')](_0x562387);})['then'](function(_0x45459b){_0x5aa0fc[_0x3dbd('0x53')]=_0x45459b;return _0x5aa0fc;})[_0x3dbd('0x22')](respondWithFilteredResult(_0x21a125,_0x562387))['catch'](handleError(_0x21a125,null));};exports['show']=function(_0x51ad6f,_0x4ad37d){var _0x24ef8d={'raw':!![],'where':{'id':_0x51ad6f[_0x3dbd('0x54')]['id']}},_0x572f79={};_0x572f79[_0x3dbd('0x44')]=_[_0x3dbd('0x55')](db[_0x3dbd('0x40')][_0x3dbd('0x56')]);_0x572f79[_0x3dbd('0x45')]=_[_0x3dbd('0x55')](_0x51ad6f[_0x3dbd('0x45')]);_0x572f79[_0x3dbd('0x46')]=_[_0x3dbd('0x47')](_0x572f79[_0x3dbd('0x44')],_0x572f79[_0x3dbd('0x45')]);_0x24ef8d[_0x3dbd('0x49')]=_[_0x3dbd('0x47')](_0x572f79[_0x3dbd('0x44')],qs[_0x3dbd('0x48')](_0x51ad6f[_0x3dbd('0x45')][_0x3dbd('0x48')]));_0x24ef8d[_0x3dbd('0x49')]=_0x24ef8d[_0x3dbd('0x49')][_0x3dbd('0x57')]?_0x24ef8d['attributes']:_0x572f79[_0x3dbd('0x44')];if(_0x51ad6f['query'][_0x3dbd('0x58')]){_0x24ef8d['include']=[{'all':!![]}];}_0x24ef8d=_['merge']({},_0x24ef8d,_0x51ad6f[_0x3dbd('0x59')]);return db[_0x3dbd('0x40')][_0x3dbd('0x5a')](_0x24ef8d)[_0x3dbd('0x22')](handleEntityNotFound(_0x4ad37d,null))[_0x3dbd('0x22')](respondWithResult(_0x4ad37d,null))[_0x3dbd('0x5b')](handleError(_0x4ad37d,null));};exports[_0x3dbd('0x3a')]=function(_0x43f25c,_0x53ce7a){if(_0x43f25c[_0x3dbd('0x5c')]['id']){delete _0x43f25c[_0x3dbd('0x5c')]['id'];}return db[_0x3dbd('0x40')][_0x3dbd('0x5a')]({'where':{'id':_0x43f25c['params']['id']}})[_0x3dbd('0x22')](handleEntityNotFound(_0x53ce7a,null))[_0x3dbd('0x22')](saveUpdates(_0x43f25c[_0x3dbd('0x5c')],null))[_0x3dbd('0x22')](respondWithResult(_0x53ce7a,null))['catch'](handleError(_0x53ce7a,null));};exports[_0x3dbd('0x3b')]=function(_0xc31956,_0x25e9a8){return db['FaxMessage'][_0x3dbd('0x5a')]({'where':{'id':_0xc31956[_0x3dbd('0x54')]['id']}})[_0x3dbd('0x22')](handleEntityNotFound(_0x25e9a8,null))[_0x3dbd('0x22')](removeEntity(_0x25e9a8,null))['catch'](handleError(_0x25e9a8,null));};exports[_0x3dbd('0x5d')]=function(_0x158f6f,_0x2f1dc0){return db[_0x3dbd('0x40')][_0x3dbd('0x5d')]()[_0x3dbd('0x22')](respondWithResult(_0x2f1dc0,null))[_0x3dbd('0x5b')](handleError(_0x2f1dc0,null));};var interaction_log=require(_0x3dbd('0x14'))('fax-interactions');exports[_0x3dbd('0x5e')]=function(_0x2c6b86,_0x32e636,_0x486ad4){var _0x1fcd3c={'agent':{},'channel':_0x3dbd('0x5f')};if(_0x2c6b86[_0x3dbd('0x5c')]['id']){delete _0x2c6b86[_0x3dbd('0x5c')]['id'];}_0x2c6b86[_0x3dbd('0x5c')]['read']=!![];_0x2c6b86[_0x3dbd('0x5c')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2c6b86[_0x3dbd('0x5c')][_0x3dbd('0x60')]=_0x2c6b86[_0x3dbd('0x5c')][_0x3dbd('0x60')]||_0x2c6b86[_0x3dbd('0x61')]['id'];_0x1fcd3c[_0x3dbd('0x62')]['id']=_0x2c6b86[_0x3dbd('0x5c')][_0x3dbd('0x60')];return db[_0x3dbd('0x40')]['find']({'where':{'id':_0x2c6b86[_0x3dbd('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x32e636,null))[_0x3dbd('0x22')](saveUpdates(_0x2c6b86[_0x3dbd('0x5c')],null))[_0x3dbd('0x22')](function(_0x560ae4){if(_0x560ae4){_0x1fcd3c['message']=_0x560ae4['get']({'plain':!![]});return db[_0x3dbd('0x63')][_0x3dbd('0x5a')]({'where':{'id':_0x560ae4[_0x3dbd('0x64')]}});}return null;})[_0x3dbd('0x22')](handleEntityNotFound(_0x32e636,null))[_0x3dbd('0x22')](function(_0x3ff90c){if(_0x3ff90c){return _0x3ff90c[_0x3dbd('0x3a')]({'UserId':_0x2c6b86['body']['UserId'],'read1stAt':_[_0x3dbd('0x65')](_0x3ff90c[_0x3dbd('0x66')])?moment()[_0x3dbd('0x67')](_0x3dbd('0x68')):undefined});}return null;})['then'](function(_0x169daf){if(_0x169daf){_0x1fcd3c['interaction']=_0x169daf[_0x3dbd('0x69')]({'plain':!![]});interaction_log[_0x3dbd('0x2b')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2c6b86['user']['id'],_0x2c6b86[_0x3dbd('0x61')][_0x3dbd('0x3d')],_0x2c6b86[_0x3dbd('0x61')][_0x3dbd('0x6a')],_0x1fcd3c[_0x3dbd('0x6b')]['id'],_0x2c6b86[_0x3dbd('0x5c')]?JSON[_0x3dbd('0x27')](_0x2c6b86['body']):_0x3dbd('0x6c'));return respondWithRpcPromise(_0x3dbd('0x6d'),_0x3dbd('0x6e'),_0x1fcd3c);}return null;})[_0x3dbd('0x22')](function(_0x267ea9){var _0x3d637e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x267ea9['message']['ContactId'];return db[_0x3dbd('0x6f')][_0x3dbd('0x45')](_0x3d637e,{'type':db['Sequelize'][_0x3dbd('0x70')][_0x3dbd('0x71')],'raw':!![]})[_0x3dbd('0x22')](function(_0x3e4329){return _0x3e4329;});})['then'](function(_0x54c654){if(_0x54c654){_0x1fcd3c[_0x3dbd('0x2a')][_0x3dbd('0x72')]=_0x54c654[0x0];if(!_0x2c6b86[_0x3dbd('0x5c')][_0x3dbd('0x60')])return;return db[_0x3dbd('0x73')]['find']({'where':{'id':_0x2c6b86[_0x3dbd('0x5c')][_0x3dbd('0x60')],'role':'agent'},'attributes':['id',_0x3dbd('0x3d'),'fullname','email',_0x3dbd('0x74')],'raw':!![]});}return null;})[_0x3dbd('0x22')](function(_0x6a465d){if(!_0x6a465d)return null;_0x1fcd3c[_0x3dbd('0x2a')]['agent']=_0x6a465d;return _0x1fcd3c;})['then'](function(_0x21ece9){if(_0x21ece9){if(_0x2c6b86['body']['manual']){_0x1fcd3c[_0x3dbd('0x2a')]['interface']=util[_0x3dbd('0x67')](_0x3dbd('0x75'),_0x2c6b86[_0x3dbd('0x61')][_0x3dbd('0x3d')]);_0x1fcd3c[_0x3dbd('0x2a')]['channel']=_0x1fcd3c['channel'];_0x1fcd3c['message']['motionChannel']=_0x1fcd3c[_0x3dbd('0x76')];_0x1fcd3c[_0x3dbd('0x2a')][_0x3dbd('0x77')]=_0x3dbd('0x5e');return respondWithRpcPromise('EventManager',_0x3dbd('0x78'),{'event':'acceptmessage','message':_0x1fcd3c['message']},client9002)['then'](function(){return _0x1fcd3c;});}return _0x1fcd3c;}return null;})[_0x3dbd('0x22')](respondWithResult(_0x32e636,null))['catch'](handleError(_0x32e636,null));};var interaction_log=require(_0x3dbd('0x14'))(_0x3dbd('0x79'));exports[_0x3dbd('0x38')]=function(_0x4da74b,_0x2fbd33,_0x2b202f){var _0x86852={'agent':{},'channel':'fax'};if(_0x4da74b[_0x3dbd('0x5c')]['id']){delete _0x4da74b['body']['id'];}_0x4da74b['body'][_0x3dbd('0x60')]=_0x4da74b[_0x3dbd('0x5c')][_0x3dbd('0x60')]||_0x4da74b[_0x3dbd('0x61')]['id'];_0x86852['agent']['id']=_0x4da74b[_0x3dbd('0x5c')][_0x3dbd('0x60')];return db[_0x3dbd('0x40')]['find']({'where':{'id':_0x4da74b[_0x3dbd('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2fbd33,null))[_0x3dbd('0x22')](function(_0x4e90c6){if(_0x4e90c6){_0x86852['message']=_0x4e90c6[_0x3dbd('0x69')]({'plain':!![]});return db[_0x3dbd('0x63')][_0x3dbd('0x5a')]({'where':{'id':_0x4e90c6[_0x3dbd('0x64')]}});}return null;})[_0x3dbd('0x22')](handleEntityNotFound(_0x2fbd33,null))['then'](function(_0x33c9f3){if(_0x33c9f3){_0x86852['interaction']=_0x33c9f3[_0x3dbd('0x69')]({'plain':!![]});interaction_log[_0x3dbd('0x2b')](_0x3dbd('0x7a'),_0x4da74b[_0x3dbd('0x61')]['id'],_0x4da74b[_0x3dbd('0x61')][_0x3dbd('0x3d')],_0x4da74b[_0x3dbd('0x61')][_0x3dbd('0x6a')],_0x86852[_0x3dbd('0x6b')]['id'],_0x4da74b['body']?JSON[_0x3dbd('0x27')](_0x4da74b['body']):_0x3dbd('0x6c'));return respondWithRpcPromise(_0x3dbd('0x7b'),_0x3dbd('0x7c'),_0x86852);}return null;})[_0x3dbd('0x22')](function(_0x337b7f){var _0x1a994d=_0x3dbd('0x7d')+_0x337b7f['message'][_0x3dbd('0x7e')];return db['sequelize'][_0x3dbd('0x45')](_0x1a994d,{'type':db[_0x3dbd('0x7f')][_0x3dbd('0x70')][_0x3dbd('0x71')],'raw':!![]})[_0x3dbd('0x22')](function(_0x4ee6d2){return _0x4ee6d2;});})['then'](function(_0x281f17){if(_0x281f17){_0x86852[_0x3dbd('0x2a')]['contact']=_0x281f17[0x0];if(!_0x4da74b['body'][_0x3dbd('0x60')])return;return db['User'][_0x3dbd('0x5a')]({'where':{'id':_0x4da74b[_0x3dbd('0x5c')]['UserId'],'role':_0x3dbd('0x62')},'attributes':['id',_0x3dbd('0x3d'),_0x3dbd('0x80'),_0x3dbd('0x81'),'internal'],'raw':!![]});}return null;})['then'](function(_0x1c369b){if(!_0x1c369b)return null;_0x86852['message'][_0x3dbd('0x62')]=_0x1c369b;return _0x86852;})[_0x3dbd('0x22')](function(_0x16f649){if(_0x16f649){_0x16f649['message'][_0x3dbd('0x82')]=util[_0x3dbd('0x67')](_0x3dbd('0x75'),_0x4da74b[_0x3dbd('0x61')][_0x3dbd('0x3d')]);_0x16f649[_0x3dbd('0x2a')][_0x3dbd('0x76')]=_0x86852[_0x3dbd('0x76')];_0x16f649[_0x3dbd('0x2a')]['motionChannel']=_0x86852[_0x3dbd('0x76')];_0x16f649[_0x3dbd('0x2a')][_0x3dbd('0x77')]=_0x3dbd('0x38');respondWithRpcPromise(_0x3dbd('0x78'),_0x3dbd('0x78'),{'event':_0x3dbd('0x83'),'message':_0x16f649['message']},client9002);return _0x86852;}return null;})[_0x3dbd('0x22')](respondWithResult(_0x2fbd33,null))[_0x3dbd('0x5b')](handleError(_0x2fbd33,null));};exports[_0x3dbd('0x84')]=function(_0x343eaf,_0x2cc5c7){var _0x53dcb7;return db[_0x3dbd('0x40')][_0x3dbd('0x84')](_0x343eaf['body'],{})[_0x3dbd('0x22')](function(_0x492288){_0x53dcb7=_0x492288;return db[_0x3dbd('0x85')][_0x3dbd('0x86')]({'where':{'id':_0x53dcb7[_0x3dbd('0x7e')]}});})[_0x3dbd('0x22')](function(_0x5d3f1d){if(_['isNil'](_0x5d3f1d)){return;}else{_0x53dcb7['fax']=_0x5d3f1d[_0x3dbd('0x5f')];return db[_0x3dbd('0x87')][_0x3dbd('0x86')]({'where':{'id':_0x53dcb7[_0x3dbd('0x88')]}});}})[_0x3dbd('0x22')](function(_0x56c2de){return respondWithRpcPromise(_0x3dbd('0x89'),_0x3dbd('0x89'),{'FaxAccountId':_[_0x3dbd('0x65')](_0x343eaf[_0x3dbd('0x5c')])?undefined:_0x343eaf[_0x3dbd('0x5c')][_0x3dbd('0x8a')],'path':_[_0x3dbd('0x65')](_0x56c2de)?undefined:util[_0x3dbd('0x67')](_0x3dbd('0x8b'),_0x56c2de[_0x3dbd('0x8c')]),'fax':_[_0x3dbd('0x65')](_0x53dcb7[_0x3dbd('0x5f')])?undefined:_0x53dcb7[_0x3dbd('0x5f')],'AttachmentId':_0x53dcb7['AttachmentId']},client9002);})[_0x3dbd('0x22')](respondWithResult(_0x2cc5c7,0xc9))['catch'](handleError(_0x2cc5c7,null));};exports['download']=function(_0x5f10b1,_0x3aa9f4){var _0x29cd01=path[_0x3dbd('0x8d')](config[_0x3dbd('0x8e')],_0x3dbd('0x8f'),_0x3dbd('0x90'),_0x3dbd('0x91'));return db['FaxMessage'][_0x3dbd('0x5a')]({'where':{'id':_0x5f10b1[_0x3dbd('0x54')]['id']},'include':[{'model':db[_0x3dbd('0x87')],'as':_0x3dbd('0x87')}]})[_0x3dbd('0x22')](handleEntityNotFound(_0x3aa9f4,null))[_0x3dbd('0x22')](function(_0x22b6fb){if(_0x22b6fb){return _0x3aa9f4[_0x3dbd('0x92')](path['join'](_0x29cd01,_0x22b6fb[_0x3dbd('0x87')]['basename']));}})[_0x3dbd('0x5b')](handleError(_0x3aa9f4,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index df4bb93..0d62ef5 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 _0x0e76=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','update','remove'];(function(_0x569025,_0x685ff3){var _0x555208=function(_0x402782){while(--_0x402782){_0x569025['push'](_0x569025['shift']());}};_0x555208(++_0x685ff3);}(_0x0e76,0xc4));var _0x60e7=function(_0x1afd3b,_0x212a08){_0x1afd3b=_0x1afd3b-0x0;var _0x21dd50=_0x0e76[_0x1afd3b];return _0x21dd50;};'use strict';var EventEmitter=require(_0x60e7('0x0'));var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x60e7('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x60e7('0x2'),'afterDestroy':_0x60e7('0x3')};function emitEvent(_0x16131f){return function(_0xd3886,_0x2f1ad1,_0x4ee126){FaxMessageEvents[_0x60e7('0x4')](_0x16131f+':'+_0xd3886['id'],_0xd3886);FaxMessageEvents[_0x60e7('0x4')](_0x16131f,_0xd3886);_0x4ee126(null);};}for(var e in events){if(events[_0x60e7('0x5')](e)){var event=events[e];FaxMessage[_0x60e7('0x6')](e,emitEvent(event));}}module[_0x60e7('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x2af8=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','FaxMessage'];(function(_0x1f0ad7,_0xbdbf69){var _0xc907ef=function(_0x8bc3ef){while(--_0x8bc3ef){_0x1f0ad7['push'](_0x1f0ad7['shift']());}};_0xc907ef(++_0xbdbf69);}(_0x2af8,0xf6));var _0x82af=function(_0x1eae9e,_0x28746e){_0x1eae9e=_0x1eae9e-0x0;var _0x49e6d4=_0x2af8[_0x1eae9e];return _0x49e6d4;};'use strict';var EventEmitter=require(_0x82af('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x82af('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x82af('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x82af('0x3'),'afterDestroy':_0x82af('0x4')};function emitEvent(_0x5f107e){return function(_0x29c672,_0x4a8c15,_0xafdd39){FaxMessageEvents[_0x82af('0x5')](_0x5f107e+':'+_0x29c672['id'],_0x29c672);FaxMessageEvents['emit'](_0x5f107e,_0x29c672);_0xafdd39(null);};}for(var e in events){if(events[_0x82af('0x6')](e)){var event=events[e];FaxMessage[_0x82af('0x7')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 41ca6b4..c87f11d 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 _0x5899=['models','get','direction','out','secret','UserId','FaxInteraction','findOne','FaxInteractionId','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','fax_messages','fti_fax_messages','body'];(function(_0x1e2ad7,_0x5a9ec7){var _0x1158e5=function(_0x419ca8){while(--_0x419ca8){_0x1e2ad7['push'](_0x1e2ad7['shift']());}};_0x1158e5(++_0x5a9ec7);}(_0x5899,0xe5));var _0x9589=function(_0x5ad49c,_0x182dda){_0x5ad49c=_0x5ad49c-0x0;var _0x50826e=_0x5899[_0x5ad49c];return _0x50826e;};'use strict';var _=require(_0x9589('0x0'));var util=require(_0x9589('0x1'));var logger=require(_0x9589('0x2'))(_0x9589('0x3'));var moment=require(_0x9589('0x4'));var BPromise=require('bluebird');var rp=require(_0x9589('0x5'));var fs=require('fs');var path=require(_0x9589('0x6'));var rimraf=require(_0x9589('0x7'));var config=require(_0x9589('0x8'));var attributes=require(_0x9589('0x9'));module[_0x9589('0xa')]=function(_0x26e6fa,_0x2a7c47){return _0x26e6fa['define']('FaxMessage',attributes,{'tableName':_0x9589('0xb'),'paranoid':![],'indexes':[{'name':_0x9589('0xc'),'fields':[_0x9589('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x21f0d0,_0x8cd7aa,_0x419666){var _0x22e4c9=_0x26e6fa[_0x9589('0xe')];var _0x414b6c=_0x21f0d0[_0x9589('0xf')]({'plain':!![]});if(_0x414b6c[_0x9589('0x10')]['toLowerCase']()==='in'||_0x414b6c[_0x9589('0x10')]['toLowerCase']()===_0x9589('0x11')&&!_0x414b6c[_0x9589('0x12')]&&!_['isNil'](_0x414b6c[_0x9589('0x13')])){_0x22e4c9[_0x9589('0x14')][_0x9589('0x15')]({'where':{'id':_0x414b6c[_0x9589('0x16')]}})[_0x9589('0x17')](function(_0x4a372b){if(_0x4a372b){_0x4a372b['update']({'lastMsgAt':_0x414b6c['createdAt'],'lastMsgDirection':_0x414b6c['direction']['toLowerCase']()});}})[_0x9589('0x18')](function(_0x1b3fb4){console['error'](_0x1b3fb4);});}_0x419666();}},'charset':_0x9589('0x19'),'collate':_0x9589('0x1a')});}; \ No newline at end of file +var _0xd549=['then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','fax_messages','fti_fax_messages','FULLTEXT','direction','toLowerCase','secret','isNil','UserId','FaxInteraction'];(function(_0x55fb83,_0x1d3856){var _0x59a87a=function(_0x38bdd1){while(--_0x38bdd1){_0x55fb83['push'](_0x55fb83['shift']());}};_0x59a87a(++_0x1d3856);}(_0xd549,0xce));var _0x9d54=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xd549[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x9d54('0x0'));var util=require('util');var logger=require(_0x9d54('0x1'))(_0x9d54('0x2'));var moment=require(_0x9d54('0x3'));var BPromise=require(_0x9d54('0x4'));var rp=require(_0x9d54('0x5'));var fs=require('fs');var path=require(_0x9d54('0x6'));var rimraf=require(_0x9d54('0x7'));var config=require('../../config/environment');var attributes=require(_0x9d54('0x8'));module[_0x9d54('0x9')]=function(_0x302046,_0x34696c){return _0x302046['define']('FaxMessage',attributes,{'tableName':_0x9d54('0xa'),'paranoid':![],'indexes':[{'name':_0x9d54('0xb'),'fields':['body'],'type':_0x9d54('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x33b213,_0x591e04,_0x5b418d){var _0x2e600b=_0x302046['models'];var _0x2eaf59=_0x33b213['get']({'plain':!![]});if(_0x2eaf59[_0x9d54('0xd')][_0x9d54('0xe')]()==='in'||_0x2eaf59[_0x9d54('0xd')]['toLowerCase']()==='out'&&!_0x2eaf59[_0x9d54('0xf')]&&!_[_0x9d54('0x10')](_0x2eaf59[_0x9d54('0x11')])){_0x2e600b[_0x9d54('0x12')]['findOne']({'where':{'id':_0x2eaf59['FaxInteractionId']}})[_0x9d54('0x13')](function(_0x14defc){if(_0x14defc){_0x14defc['update']({'lastMsgAt':_0x2eaf59[_0x9d54('0x14')],'lastMsgDirection':_0x2eaf59['direction'][_0x9d54('0xe')]()});}})[_0x9d54('0x15')](function(_0x5d00e3){console[_0x9d54('0x16')](_0x5d00e3);});}_0x5b418d();}},'charset':_0x9d54('0x17'),'collate':_0x9d54('0x18')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 518cbd7..7dd7851 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 _0xac31=['attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','update','where'];(function(_0xe8650c,_0x39b044){var _0x5e534b=function(_0xcd6eeb){while(--_0xcd6eeb){_0xe8650c['push'](_0xe8650c['shift']());}};_0x5e534b(++_0x39b044);}(_0xac31,0xca));var _0x1ac3=function(_0x2a1b92,_0x4ca31d){_0x2a1b92=_0x2a1b92-0x0;var _0x409468=_0xac31[_0x2a1b92];return _0x409468;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var moment=require(_0x1ac3('0x2'));var BPromise=require(_0x1ac3('0x3'));var rs=require(_0x1ac3('0x4'));var fs=require('fs');var Redis=require(_0x1ac3('0x5'));var db=require(_0x1ac3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ac3('0x7'))(_0x1ac3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ac3('0x9')][_0x1ac3('0xa')]({'port':0x232a});config[_0x1ac3('0xb')]=_[_0x1ac3('0xc')](config[_0x1ac3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ac3('0xd'))(new Redis(config['redis']));require(_0x1ac3('0xe'))[_0x1ac3('0xf')](socket);function respondWithRpcPromise(_0x344674,_0x53500b,_0xa26c88){return new BPromise(function(_0x1e2642,_0x3e835b){return client[_0x1ac3('0x10')](_0x344674,_0xa26c88)[_0x1ac3('0x11')](function(_0x422d19){logger['info'](_0x1ac3('0x12'),_0x53500b,_0x1ac3('0x13'));logger[_0x1ac3('0x14')](_0x1ac3('0x15'),_0x53500b,'request\x20sent',JSON[_0x1ac3('0x16')](_0x422d19));if(_0x422d19[_0x1ac3('0x17')]){if(_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x18')]===0x1f4){logger['error'](_0x1ac3('0x12'),_0x53500b,_0x422d19[_0x1ac3('0x17')]['message']);return _0x3e835b(_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x19')]);}logger[_0x1ac3('0x17')]('FaxMessage,\x20%s,\x20%s',_0x53500b,_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x19')]);return _0x1e2642(_0x422d19[_0x1ac3('0x17')]['message']);}else{logger[_0x1ac3('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x53500b,_0x1ac3('0x13'));_0x1e2642(_0x422d19[_0x1ac3('0x1b')][_0x1ac3('0x19')]);}})[_0x1ac3('0x1c')](function(_0x18b985){logger['error'](_0x1ac3('0x12'),_0x53500b,_0x18b985);_0x3e835b(_0x18b985);});});}exports[_0x1ac3('0x1d')]=function(_0x296abf){var _0x257f60=this;return new Promise(function(_0x5f1918,_0x48d18a){return db[_0x1ac3('0x1e')][_0x1ac3('0x1f')](_0x296abf[_0x1ac3('0x20')],{'raw':_0x296abf[_0x1ac3('0x21')]?_0x296abf[_0x1ac3('0x21')][_0x1ac3('0x22')]===undefined?!![]:![]:!![]})[_0x1ac3('0x11')](function(_0x10912a){logger[_0x1ac3('0x1a')]('CreateFaxMessage',_0x296abf);logger[_0x1ac3('0x14')](_0x1ac3('0x1d'),_0x296abf,JSON['stringify'](_0x10912a));_0x5f1918(_0x10912a);})[_0x1ac3('0x1c')](function(_0x10f30c){logger['error'](_0x1ac3('0x1d'),_0x10f30c[_0x1ac3('0x19')],_0x296abf);_0x48d18a(_0x257f60[_0x1ac3('0x17')](0x1f4,_0x10f30c[_0x1ac3('0x19')]));});});};exports[_0x1ac3('0x23')]=function(_0x565a0f){var _0x5a2ab2=this;return new Promise(function(_0x503a64,_0x528807){return db['FaxMessage'][_0x1ac3('0x24')](_0x565a0f['body'],{'raw':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f['options'][_0x1ac3('0x25')]||null:null,'attributes':_0x565a0f['options']?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x26')]||null:null,'limit':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x27')]||null:null})[_0x1ac3('0x11')](function(_0x9c17c2){logger['info'](_0x1ac3('0x23'),_0x565a0f);logger[_0x1ac3('0x14')](_0x1ac3('0x23'),_0x565a0f,JSON[_0x1ac3('0x16')](_0x9c17c2));_0x503a64(_0x9c17c2);})['catch'](function(_0x3591a9){logger[_0x1ac3('0x17')](_0x1ac3('0x23'),_0x3591a9[_0x1ac3('0x19')],_0x565a0f);_0x528807(_0x5a2ab2[_0x1ac3('0x17')](0x1f4,_0x3591a9['message']));});});}; \ No newline at end of file +var _0xbec5=['then','info','request\x20sent','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','catch','CreateFaxMessage','FaxMessage','create','body','options','UpdateFaxMessage','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket'];(function(_0x2069d8,_0x580879){var _0x257db3=function(_0x65aef4){while(--_0x65aef4){_0x2069d8['push'](_0x2069d8['shift']());}};_0x257db3(++_0x580879);}(_0xbec5,0xe5));var _0x5bec=function(_0x11f5ff,_0xa0ef18){_0x11f5ff=_0x11f5ff-0x0;var _0x46eefb=_0xbec5[_0x11f5ff];return _0x46eefb;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var moment=require('moment');var BPromise=require(_0x5bec('0x2'));var rs=require(_0x5bec('0x3'));var fs=require('fs');var Redis=require(_0x5bec('0x4'));var db=require(_0x5bec('0x5'))['db'];var utils=require(_0x5bec('0x6'));var logger=require('../../config/logger')(_0x5bec('0x7'));var config=require(_0x5bec('0x8'));var jayson=require(_0x5bec('0x9'));var client=jayson['client'][_0x5bec('0xa')]({'port':0x232a});config[_0x5bec('0xb')]=_[_0x5bec('0xc')](config[_0x5bec('0xb')],{'host':_0x5bec('0xd'),'port':0x18eb});var socket=require(_0x5bec('0xe'))(new Redis(config[_0x5bec('0xb')]));require(_0x5bec('0xf'))['register'](socket);function respondWithRpcPromise(_0x41a827,_0x5c2d67,_0x748f75){return new BPromise(function(_0x2a70a7,_0x117162){return client['request'](_0x41a827,_0x748f75)[_0x5bec('0x10')](function(_0x18fa47){logger[_0x5bec('0x11')]('FaxMessage,\x20%s,\x20%s',_0x5c2d67,_0x5bec('0x12'));logger[_0x5bec('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5c2d67,_0x5bec('0x12'),JSON[_0x5bec('0x14')](_0x18fa47));if(_0x18fa47[_0x5bec('0x15')]){if(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x16')]===0x1f4){logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);return _0x117162(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);}logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x18fa47['error']['message']);return _0x2a70a7(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);}else{logger[_0x5bec('0x11')](_0x5bec('0x17'),_0x5c2d67,'request\x20sent');_0x2a70a7(_0x18fa47['result'][_0x5bec('0x18')]);}})[_0x5bec('0x19')](function(_0x4e0191){logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x4e0191);_0x117162(_0x4e0191);});});}exports[_0x5bec('0x1a')]=function(_0x593786){var _0x554f9f=this;return new Promise(function(_0xab397b,_0x5be91c){return db[_0x5bec('0x1b')][_0x5bec('0x1c')](_0x593786[_0x5bec('0x1d')],{'raw':_0x593786[_0x5bec('0x1e')]?_0x593786[_0x5bec('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x5bec('0x10')](function(_0x4cfcb8){logger[_0x5bec('0x11')](_0x5bec('0x1a'),_0x593786);logger['debug'](_0x5bec('0x1a'),_0x593786,JSON[_0x5bec('0x14')](_0x4cfcb8));_0xab397b(_0x4cfcb8);})['catch'](function(_0x45afb7){logger[_0x5bec('0x15')](_0x5bec('0x1a'),_0x45afb7[_0x5bec('0x18')],_0x593786);_0x5be91c(_0x554f9f[_0x5bec('0x15')](0x1f4,_0x45afb7[_0x5bec('0x18')]));});});};exports[_0x5bec('0x1f')]=function(_0x4de66a){var _0x5b63ab=this;return new Promise(function(_0x5e44b3,_0x2961bd){return db[_0x5bec('0x1b')][_0x5bec('0x20')](_0x4de66a['body'],{'raw':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')]['where']||null:null,'attributes':_0x4de66a['options']?_0x4de66a[_0x5bec('0x1e')][_0x5bec('0x21')]||null:null,'limit':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')][_0x5bec('0x22')]||null:null})[_0x5bec('0x10')](function(_0x5d6621){logger[_0x5bec('0x11')]('UpdateFaxMessage',_0x4de66a);logger[_0x5bec('0x13')](_0x5bec('0x1f'),_0x4de66a,JSON[_0x5bec('0x14')](_0x5d6621));_0x5e44b3(_0x5d6621);})[_0x5bec('0x19')](function(_0x5128c0){logger[_0x5bec('0x15')](_0x5bec('0x1f'),_0x5128c0[_0x5bec('0x18')],_0x4de66a);_0x2961bd(_0x5b63ab['error'](0x1f4,_0x5128c0[_0x5bec('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index c520273..3c58c1a 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 _0x35e2=['emit','removeListener','register','length','faxMessage:','./faxMessage.events','save','update'];(function(_0x27f4c5,_0x33811c){var _0x503cf8=function(_0x3878f4){while(--_0x3878f4){_0x27f4c5['push'](_0x27f4c5['shift']());}};_0x503cf8(++_0x33811c);}(_0x35e2,0x95));var _0x235e=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x35e2[_0x550d12];return _0x12103d;};'use strict';var FaxMessageEvents=require(_0x235e('0x0'));var events=[_0x235e('0x1'),'remove',_0x235e('0x2')];function createListener(_0x28c64c,_0x95a1b8){return function(_0x2117f1){_0x95a1b8[_0x235e('0x3')](_0x28c64c,_0x2117f1);};}function removeListener(_0x571b91,_0x4b8d91){return function(){FaxMessageEvents[_0x235e('0x4')](_0x571b91,_0x4b8d91);};}exports[_0x235e('0x5')]=function(_0x4bfa28){for(var _0x574b50=0x0,_0x2ee525=events[_0x235e('0x6')];_0x574b50<_0x2ee525;_0x574b50++){var _0x59bb1c=events[_0x574b50];var _0x1696d5=createListener(_0x235e('0x7')+_0x59bb1c,_0x4bfa28);FaxMessageEvents['on'](_0x59bb1c,_0x1696d5);}}; \ No newline at end of file +var _0x8c2b=['./faxMessage.events','update','register','length','faxMessage:'];(function(_0x1b290e,_0x3a47c){var _0x298465=function(_0x5db5a5){while(--_0x5db5a5){_0x1b290e['push'](_0x1b290e['shift']());}};_0x298465(++_0x3a47c);}(_0x8c2b,0x6e));var _0xb8c2=function(_0x5383b4,_0x307870){_0x5383b4=_0x5383b4-0x0;var _0x2702c2=_0x8c2b[_0x5383b4];return _0x2702c2;};'use strict';var FaxMessageEvents=require(_0xb8c2('0x0'));var events=['save','remove',_0xb8c2('0x1')];function createListener(_0x513b13,_0x31a21a){return function(_0x2f46ee){_0x31a21a['emit'](_0x513b13,_0x2f46ee);};}function removeListener(_0x495559,_0x53cff5){return function(){FaxMessageEvents['removeListener'](_0x495559,_0x53cff5);};}exports[_0xb8c2('0x2')]=function(_0xc015b4){for(var _0x427b3b=0x0,_0x1bc878=events[_0xb8c2('0x3')];_0x427b3b<_0x1bc878;_0x427b3b++){var _0x1e45a4=events[_0x427b3b];var _0x2af153=createListener(_0xb8c2('0x4')+_0x1e45a4,_0xc015b4);FaxMessageEvents['on'](_0x1e45a4,_0x2af153);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 3ea70d5..330eb6c 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 _0x44a3=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/:id','show','download','fax','create','put','update','/:id/accept','accept','reject','delete','exports'];(function(_0x3ba1c0,_0xbe8e7a){var _0x3fc721=function(_0x3c5e94){while(--_0x3c5e94){_0x3ba1c0['push'](_0x3ba1c0['shift']());}};_0x3fc721(++_0xbe8e7a);}(_0x44a3,0x1a9));var _0x344a=function(_0x592cbc,_0x5ec030){_0x592cbc=_0x592cbc-0x0;var _0x39b8d9=_0x44a3[_0x592cbc];return _0x39b8d9;};'use strict';var multer=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var path=require(_0x344a('0x2'));var timeout=require(_0x344a('0x3'));var express=require(_0x344a('0x4'));var router=express[_0x344a('0x5')]();var fs_extra=require(_0x344a('0x6'));var auth=require(_0x344a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x344a('0x8'));var controller=require(_0x344a('0x9'));router[_0x344a('0xa')]('/',auth[_0x344a('0xb')](),controller[_0x344a('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x344a('0xa')](_0x344a('0xd'),auth[_0x344a('0xb')](),controller[_0x344a('0xe')]);router[_0x344a('0xa')]('/:id/download',auth[_0x344a('0xb')](),controller[_0x344a('0xf')]);router['post']('/',auth[_0x344a('0xb')](),interaction['tracked'](_0x344a('0x10'),'faxmessage:create'),controller[_0x344a('0x11')]);router[_0x344a('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x344a('0x13')]);router[_0x344a('0x12')](_0x344a('0x14'),auth[_0x344a('0xb')](),controller[_0x344a('0x15')]);router[_0x344a('0x12')]('/:id/reject',auth[_0x344a('0xb')](),controller[_0x344a('0x16')]);router[_0x344a('0x17')](_0x344a('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x344a('0x18')]=router; \ No newline at end of file +var _0xc6d8=['describe','/:id','show','/:id/download','download','post','tracked','faxmessage:create','update','put','/:id/accept','accept','/:id/reject','delete','exports','multer','path','express','fs-extra','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x5e1dac,_0x260087){var _0x4dc299=function(_0x557c08){while(--_0x557c08){_0x5e1dac['push'](_0x5e1dac['shift']());}};_0x4dc299(++_0x260087);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x40cb69,_0x37f2ba){_0x40cb69=_0x40cb69-0x0;var _0x55e036=_0xc6d8[_0x40cb69];return _0x55e036;};'use strict';var multer=require(_0x8c6d('0x0'));var util=require('util');var path=require(_0x8c6d('0x1'));var timeout=require('connect-timeout');var express=require(_0x8c6d('0x2'));var router=express['Router']();var fs_extra=require(_0x8c6d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8c6d('0x4'));var controller=require(_0x8c6d('0x5'));router[_0x8c6d('0x6')]('/',auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x8')]);router[_0x8c6d('0x6')](_0x8c6d('0x9'),auth['isAuthenticated'](),controller[_0x8c6d('0xa')]);router[_0x8c6d('0x6')](_0x8c6d('0xb'),auth['isAuthenticated'](),controller[_0x8c6d('0xc')]);router[_0x8c6d('0x6')](_0x8c6d('0xd'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0xe')]);router[_0x8c6d('0xf')]('/',auth[_0x8c6d('0x7')](),interaction[_0x8c6d('0x10')]('fax',_0x8c6d('0x11')),controller['create']);router['put'](_0x8c6d('0xb'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x12')]);router[_0x8c6d('0x13')](_0x8c6d('0x14'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x15')]);router[_0x8c6d('0x13')](_0x8c6d('0x16'),auth[_0x8c6d('0x7')](),controller['reject']);router[_0x8c6d('0x17')]('/:id',auth[_0x8c6d('0x7')](),controller['destroy']);module[_0x8c6d('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 4a68fb8..a19c652 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 _0x858e=['rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x29052f,_0x5b0eb0){var _0x287150=function(_0xba1b6f){while(--_0xba1b6f){_0x29052f['push'](_0x29052f['shift']());}};_0x287150(++_0x5b0eb0);}(_0x858e,0x16e));var _0xe858=function(_0x2a1268,_0x4f93b8){_0x2a1268=_0x2a1268-0x0;var _0x2bf668=_0x858e[_0x2a1268];return _0x2bf668;};'use strict';var Sequelize=require(_0xe858('0x0'));module[_0xe858('0x1')]={'name':{'type':Sequelize[_0xe858('0x2')],'unique':_0xe858('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xe858('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xe858('0x5'),'beepall',_0xe858('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xe858('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa33c=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa33c,0xd4));var _0xca33=function(_0x5e8a30,_0x5194fb){_0x5e8a30=_0x5e8a30-0x0;var _0x14f14d=_0xa33c[_0x5e8a30];return _0x14f14d;};'use strict';var Sequelize=require(_0xca33('0x0'));module[_0xca33('0x1')]={'name':{'type':Sequelize[_0xca33('0x2')],'unique':_0xca33('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xca33('0x2')]},'timeout':{'type':Sequelize[_0xca33('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xca33('0x5')](_0xca33('0x6'),'beepall',_0xca33('0x7')),'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 acf66e9..53f5b65 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 _0xa498=['name','send','index','FaxQueue','type','key','where','include','query','rows','catch','show','params','model','keys','rawAttributes','intersection','attributes','fields','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserFaxQueue','filters','hasOwnProperty','order','sort','pick','FaxQueueId','filter','map','findAll','findAndCountAll','UserId','agent','faxPause','SIP','createdAt','updatedAt','getTeams','Team','length','merge','nolimit','ids','User','online','interface','Agents','addTeams','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','util','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','json','undefined','limit','count','offset','update','destroy','then','FaxQueues','UserProfileResource','end','stack'];(function(_0x2bfbd6,_0x54dba9){var _0x3e2da9=function(_0x1b9699){while(--_0x1b9699){_0x2bfbd6['push'](_0x2bfbd6['shift']());}};_0x3e2da9(++_0x54dba9);}(_0xa498,0x1d6));var _0x8a49=function(_0x4fa4fd,_0x4c656b){_0x4fa4fd=_0x4fa4fd-0x0;var _0x3c50d0=_0xa498[_0x4fa4fd];return _0x3c50d0;};'use strict';var BPromise=require('bluebird');var util=require(_0x8a49('0x0'));var _=require(_0x8a49('0x1'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x8a49('0x2'));var logger=require(_0x8a49('0x3'))(_0x8a49('0x4'));var config=require(_0x8a49('0x5'));var db=require(_0x8a49('0x6'))['db'];config['redis']=_[_0x8a49('0x7')](config['redis'],{'host':_0x8a49('0x8'),'port':0x18eb});var socket=require(_0x8a49('0x9'))(new Redis(config[_0x8a49('0xa')]));require('./faxQueue.socket')[_0x8a49('0xb')](socket);function respondWithStatusCode(_0x29cba4,_0x37305d){_0x37305d=_0x37305d||0xcc;return function(_0x43995b){if(_0x43995b){return _0x29cba4[_0x8a49('0xc')](_0x37305d);}return _0x29cba4[_0x8a49('0xd')](_0x37305d)['end']();};}function respondWithResult(_0x15e5b4,_0x24bb85){_0x24bb85=_0x24bb85||0xc8;return function(_0x41674b){if(_0x41674b){return _0x15e5b4[_0x8a49('0xd')](_0x24bb85)[_0x8a49('0xe')](_0x41674b);}};}function respondWithFilteredResult(_0x35f2b0,_0x3052e0){return function(_0x378ea4){if(_0x378ea4){var _0x31d95a=typeof _0x3052e0['offset']===_0x8a49('0xf')&&typeof _0x3052e0[_0x8a49('0x10')]===_0x8a49('0xf');var _0x4ba3ae=_0x378ea4[_0x8a49('0x11')];var _0x57b350=_0x31d95a?0x0:_0x3052e0[_0x8a49('0x12')];var _0x2fe212=_0x31d95a?_0x378ea4['count']:_0x3052e0[_0x8a49('0x12')]+_0x3052e0[_0x8a49('0x10')];var _0x329a7b;if(_0x2fe212>=_0x4ba3ae){_0x2fe212=_0x4ba3ae;_0x329a7b=0xc8;}else{_0x329a7b=0xce;}_0x35f2b0[_0x8a49('0xd')](_0x329a7b);return _0x35f2b0['set']('Content-Range',_0x57b350+'-'+_0x2fe212+'/'+_0x4ba3ae)[_0x8a49('0xe')](_0x378ea4);}return null;};}function saveUpdates(_0x1caa4d){return function(_0x70f8d8){if(_0x70f8d8){return _0x70f8d8[_0x8a49('0x13')](_0x1caa4d)['then'](function(_0x47604e){return _0x47604e;});}return null;};}function removeEntity(_0x758a24){return function(_0x47328a){if(_0x47328a){return _0x47328a[_0x8a49('0x14')]()[_0x8a49('0x15')](function(){var _0x523879=_0x47328a['get']({'plain':!![]});var _0x420f04=_0x8a49('0x16');return db[_0x8a49('0x17')]['destroy']({'where':{'type':_0x420f04,'resourceId':_0x523879['id']}})[_0x8a49('0x15')](function(){return _0x47328a;});})[_0x8a49('0x15')](function(){_0x758a24[_0x8a49('0xd')](0xcc)[_0x8a49('0x18')]();});}};}function handleEntityNotFound(_0x3ef56e){return function(_0x3a0e6c){if(!_0x3a0e6c){_0x3ef56e[_0x8a49('0xc')](0x194);}return _0x3a0e6c;};}function handleError(_0x4bc3bc,_0x304372){_0x304372=_0x304372||0x1f4;return function(_0x28d752){logger['error'](_0x28d752[_0x8a49('0x19')]);if(_0x28d752['name']){delete _0x28d752[_0x8a49('0x1a')];}_0x4bc3bc['status'](_0x304372)[_0x8a49('0x1b')](_0x28d752);};}exports[_0x8a49('0x1c')]=function(_0x2d1a0a,_0xec2d8d){var _0xe2ca8b={};var _0x2b5d8b={'count':0x0,'rows':[]};var _0x1b0a01=_['map'](db[_0x8a49('0x1d')]['rawAttributes'],function(_0x29af9f){return{'name':_0x29af9f['fieldName'],'type':_0x29af9f[_0x8a49('0x1e')][_0x8a49('0x1f')]};});_0xe2ca8b=qs['getOptions'](_0x1b0a01,_0x2d1a0a);var _0x53cafc={'where':_0xe2ca8b[_0x8a49('0x20')]};return db[_0x8a49('0x1d')][_0x8a49('0x11')](_0x53cafc)[_0x8a49('0x15')](function(_0x484a57){_0x2b5d8b[_0x8a49('0x11')]=_0x484a57;_0xe2ca8b[_0x8a49('0x21')]=qs[_0x8a49('0x21')](_0x2d1a0a[_0x8a49('0x22')]);return db[_0x8a49('0x1d')]['findAll'](_0xe2ca8b);})[_0x8a49('0x15')](function(_0x42a1aa){_0x2b5d8b[_0x8a49('0x23')]=_0x42a1aa;return _0x2b5d8b;})[_0x8a49('0x15')](respondWithFilteredResult(_0xec2d8d,_0xe2ca8b))[_0x8a49('0x24')](handleError(_0xec2d8d,null));};exports[_0x8a49('0x25')]=function(_0x3fc5e0,_0x47bb1b){var _0x49af4e={'raw':!![],'where':{'id':_0x3fc5e0[_0x8a49('0x26')]['id']}},_0x10f110={};_0x10f110[_0x8a49('0x27')]=_[_0x8a49('0x28')](db['FaxQueue'][_0x8a49('0x29')]);_0x10f110[_0x8a49('0x22')]=_['keys'](_0x3fc5e0[_0x8a49('0x22')]);_0x10f110['filters']=_[_0x8a49('0x2a')](_0x10f110[_0x8a49('0x27')],_0x10f110[_0x8a49('0x22')]);_0x49af4e[_0x8a49('0x2b')]=_['intersection'](_0x10f110[_0x8a49('0x27')],qs[_0x8a49('0x2c')](_0x3fc5e0[_0x8a49('0x22')]['fields']));_0x49af4e[_0x8a49('0x2b')]=_0x49af4e['attributes']['length']?_0x49af4e[_0x8a49('0x2b')]:_0x10f110[_0x8a49('0x27')];if(_0x3fc5e0[_0x8a49('0x22')][_0x8a49('0x2d')]){_0x49af4e['include']=[{'all':!![]}];}_0x49af4e=_['merge']({},_0x49af4e,_0x3fc5e0[_0x8a49('0x2e')]);return db[_0x8a49('0x1d')][_0x8a49('0x2f')](_0x49af4e)[_0x8a49('0x15')](handleEntityNotFound(_0x47bb1b,null))['then'](respondWithResult(_0x47bb1b,null))[_0x8a49('0x24')](handleError(_0x47bb1b,null));};exports[_0x8a49('0x30')]=function(_0x450637,_0x597340){return db['FaxQueue'][_0x8a49('0x30')](_0x450637[_0x8a49('0x31')],{})[_0x8a49('0x15')](function(_0x4f1a57){var _0x158d8c=_0x450637[_0x8a49('0x32')][_0x8a49('0x33')]({'plain':!![]});if(!_0x158d8c)throw new Error(_0x8a49('0x34'));if(_0x158d8c[_0x8a49('0x35')]===_0x8a49('0x32')){var _0x4a520a=_0x4f1a57[_0x8a49('0x33')]({'plain':!![]});var _0x1b6624=_0x8a49('0x16');return db[_0x8a49('0x36')][_0x8a49('0x2f')]({'where':{'name':_0x1b6624,'userProfileId':_0x158d8c[_0x8a49('0x37')]},'raw':!![]})['then'](function(_0x2c9838){if(_0x2c9838&&_0x2c9838[_0x8a49('0x38')]===0x0){return db[_0x8a49('0x17')][_0x8a49('0x30')]({'name':_0x4a520a[_0x8a49('0x1a')],'resourceId':_0x4a520a['id'],'type':_0x2c9838[_0x8a49('0x1a')],'sectionId':_0x2c9838['id']},{})[_0x8a49('0x15')](function(){return _0x4f1a57;});}else{return _0x4f1a57;}})[_0x8a49('0x24')](function(_0x41b6c2){logger[_0x8a49('0x39')](_0x8a49('0x3a'),_0x41b6c2);throw _0x41b6c2;});}return _0x4f1a57;})['then'](respondWithResult(_0x597340,0xc9))[_0x8a49('0x24')](handleError(_0x597340,null));};exports[_0x8a49('0x13')]=function(_0x2938a8,_0x4aac2b){if(_0x2938a8[_0x8a49('0x31')]['id']){delete _0x2938a8[_0x8a49('0x31')]['id'];}return db[_0x8a49('0x1d')][_0x8a49('0x2f')]({'where':{'id':_0x2938a8[_0x8a49('0x26')]['id']}})['then'](handleEntityNotFound(_0x4aac2b,null))[_0x8a49('0x15')](saveUpdates(_0x2938a8[_0x8a49('0x31')],null))['then'](respondWithResult(_0x4aac2b,null))[_0x8a49('0x24')](handleError(_0x4aac2b,null));};exports['destroy']=function(_0x4ba519,_0xf77d8){return db['FaxQueue'][_0x8a49('0x2f')]({'where':{'id':_0x4ba519[_0x8a49('0x26')]['id']}})[_0x8a49('0x15')](handleEntityNotFound(_0xf77d8,null))[_0x8a49('0x15')](removeEntity(_0xf77d8,null))['catch'](handleError(_0xf77d8,null));};exports[_0x8a49('0x3b')]=function(_0x30f8e2,_0x239cea){return db[_0x8a49('0x1d')][_0x8a49('0x3b')]()[_0x8a49('0x15')](respondWithResult(_0x239cea,null))[_0x8a49('0x24')](handleError(_0x239cea,null));};exports['getMembers']=function(_0x4ee6ba,_0x359d53){var _0x375e75={'raw':!![],'where':{}},_0x37b79f={},_0x426ae3;return db[_0x8a49('0x1d')][_0x8a49('0x3c')]({'where':{'id':_0x4ee6ba[_0x8a49('0x26')]['id']}})[_0x8a49('0x15')](handleEntityNotFound(_0x359d53,null))['then'](function(_0x2faa39){if(_0x2faa39){_0x426ae3=_0x2faa39[_0x8a49('0x33')]({'plain':!![]});_0x37b79f[_0x8a49('0x27')]=_[_0x8a49('0x28')](db[_0x8a49('0x3d')][_0x8a49('0x29')]);_0x37b79f[_0x8a49('0x22')]=_[_0x8a49('0x28')](_0x4ee6ba[_0x8a49('0x22')]);_0x37b79f[_0x8a49('0x3e')]=_[_0x8a49('0x2a')](_0x37b79f['model'],_0x37b79f['query']);_0x375e75[_0x8a49('0x2b')]=_[_0x8a49('0x2a')](_0x37b79f[_0x8a49('0x27')],qs[_0x8a49('0x2c')](_0x4ee6ba[_0x8a49('0x22')][_0x8a49('0x2c')]));_0x375e75[_0x8a49('0x2b')]=_0x375e75['attributes']['length']?_0x375e75['attributes']:_0x37b79f[_0x8a49('0x27')];if(!_0x4ee6ba[_0x8a49('0x22')][_0x8a49('0x3f')]('nolimit')){_0x375e75[_0x8a49('0x10')]=qs[_0x8a49('0x10')](_0x4ee6ba[_0x8a49('0x22')][_0x8a49('0x10')]);_0x375e75[_0x8a49('0x12')]=qs[_0x8a49('0x12')](_0x4ee6ba[_0x8a49('0x22')][_0x8a49('0x12')]);}_0x375e75[_0x8a49('0x40')]=qs[_0x8a49('0x41')](_0x4ee6ba['query']['sort']);_0x375e75[_0x8a49('0x20')]=qs[_0x8a49('0x3e')](_[_0x8a49('0x42')](_0x4ee6ba[_0x8a49('0x22')],_0x37b79f[_0x8a49('0x3e')]));_0x375e75[_0x8a49('0x20')][_0x8a49('0x43')]=_0x2faa39['id'];if(_0x4ee6ba[_0x8a49('0x22')][_0x8a49('0x44')]){_0x375e75[_0x8a49('0x20')]=_['merge'](_0x375e75[_0x8a49('0x20')],{'$or':_[_0x8a49('0x45')](_0x375e75[_0x8a49('0x2b')],function(_0x11564c){var _0x543c69={};_0x543c69[_0x11564c]={'$like':'%'+_0x4ee6ba['query']['filter']+'%'};return _0x543c69;})});}_0x375e75=_['merge']({},_0x375e75,_0x4ee6ba[_0x8a49('0x2e')]);return db[_0x8a49('0x3d')][_0x8a49('0x46')](_0x375e75);}})[_0x8a49('0x15')](function(_0x3f9260){if(_0x3f9260){return db['User'][_0x8a49('0x47')]({'where':{'id':_[_0x8a49('0x45')](_0x3f9260,_0x8a49('0x48')),'role':_0x8a49('0x49')},'attributes':['id',_0x8a49('0x1a'),_0x8a49('0x4a'),'updatedAt','createdAt']});}})[_0x8a49('0x15')](function(_0x1f2b80){if(_0x1f2b80){return{'count':_0x1f2b80['count'],'rows':_[_0x8a49('0x45')](_0x1f2b80[_0x8a49('0x23')],function(_0x41ca88){return{'membername':_0x41ca88[_0x8a49('0x1a')],'UserId':_0x41ca88['id'],'queue_name':_0x426ae3[_0x8a49('0x1a')],'FaxQueueId':_0x426ae3['id'],'interface':util['format']('%s/%s',_0x8a49('0x4b'),_0x41ca88[_0x8a49('0x1a')]),'penalty':0x0,'paused':_0x41ca88[_0x8a49('0x4a')],'createdAt':_0x41ca88[_0x8a49('0x4c')],'updatedAt':_0x41ca88[_0x8a49('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8a49('0x15')](respondWithFilteredResult(_0x359d53,_0x375e75))['catch'](handleError(_0x359d53,null));};exports[_0x8a49('0x4e')]=function(_0x2f9ca0,_0x5c1f6a){var _0x10bca1={};var _0x53b690={};var _0x2d04da;var _0x455809;return db[_0x8a49('0x1d')][_0x8a49('0x3c')]({'where':{'id':_0x2f9ca0[_0x8a49('0x26')]['id']}})[_0x8a49('0x15')](handleEntityNotFound(_0x5c1f6a,null))[_0x8a49('0x15')](function(_0x4f1972){if(_0x4f1972){_0x2d04da=_0x4f1972;_0x53b690[_0x8a49('0x27')]=_[_0x8a49('0x28')](db[_0x8a49('0x4f')]['rawAttributes']);_0x53b690[_0x8a49('0x22')]=_[_0x8a49('0x28')](_0x2f9ca0[_0x8a49('0x22')]);_0x53b690[_0x8a49('0x3e')]=_[_0x8a49('0x2a')](_0x53b690[_0x8a49('0x27')],_0x53b690[_0x8a49('0x22')]);_0x10bca1[_0x8a49('0x2b')]=_['intersection'](_0x53b690[_0x8a49('0x27')],qs[_0x8a49('0x2c')](_0x2f9ca0['query'][_0x8a49('0x2c')]));_0x10bca1[_0x8a49('0x2b')]=_0x10bca1[_0x8a49('0x2b')][_0x8a49('0x50')]?_0x10bca1[_0x8a49('0x2b')]:_0x53b690['model'];_0x10bca1[_0x8a49('0x40')]=qs[_0x8a49('0x41')](_0x2f9ca0[_0x8a49('0x22')][_0x8a49('0x41')]);_0x10bca1[_0x8a49('0x20')]=qs[_0x8a49('0x3e')](_[_0x8a49('0x42')](_0x2f9ca0['query'],_0x53b690['filters']));if(_0x2f9ca0['query']['filter']){_0x10bca1['where']=_[_0x8a49('0x51')](_0x10bca1['where'],{'$or':_[_0x8a49('0x45')](_0x10bca1[_0x8a49('0x2b')],function(_0x408925){var _0x305b1e={};_0x305b1e[_0x408925]={'$like':'%'+_0x2f9ca0[_0x8a49('0x22')]['filter']+'%'};return _0x305b1e;})});}_0x10bca1=_['merge']({},_0x10bca1,_0x2f9ca0[_0x8a49('0x2e')]);return _0x2d04da['getTeams'](_0x10bca1);}})['then'](function(_0x2ac6d5){if(_0x2ac6d5){_0x455809=_0x2ac6d5[_0x8a49('0x50')];if(!_0x2f9ca0['query'][_0x8a49('0x3f')](_0x8a49('0x52'))){_0x10bca1['limit']=qs[_0x8a49('0x10')](_0x2f9ca0['query'][_0x8a49('0x10')]);_0x10bca1['offset']=qs[_0x8a49('0x12')](_0x2f9ca0[_0x8a49('0x22')][_0x8a49('0x12')]);}return _0x2d04da[_0x8a49('0x4e')](_0x10bca1);}})['then'](function(_0x59e00f){if(_0x59e00f){return _0x59e00f?{'count':_0x455809,'rows':_0x59e00f}:null;}})[_0x8a49('0x15')](respondWithResult(_0x5c1f6a,null))[_0x8a49('0x24')](handleError(_0x5c1f6a,null));};exports['addTeams']=function(_0x5418a5,_0x4c0dd4){var _0xa7f17d=_0x5418a5['body'][_0x8a49('0x53')];return db[_0x8a49('0x4f')][_0x8a49('0x46')]({'where':{'id':_0xa7f17d},'attributes':['id'],'include':[{'model':db[_0x8a49('0x54')],'as':'Agents','attributes':['id',_0x8a49('0x1a'),_0x8a49('0x55'),'voicePause',_0x8a49('0x56')],'raw':!![]}]})[_0x8a49('0x15')](function(_0x19ca95){if(_0x19ca95){var _0x14f73f=_['flatMap'](_0x19ca95,function(_0x5ec54b){var _0x177405=_0x5ec54b[_0x8a49('0x33')]({'plain':!![]});return _0x177405[_0x8a49('0x57')];});return db[_0x8a49('0x1d')][_0x8a49('0x2f')]({'where':{'id':_0x5418a5[_0x8a49('0x26')]['id']}})[_0x8a49('0x15')](function(_0x39688a){return db['sequelize']['transaction'](function(_0x498899){return _0x39688a[_0x8a49('0x58')](_0xa7f17d,{'transaction':_0x498899})[_0x8a49('0x15')](function(){return BPromise[_0x8a49('0x59')](_0x14f73f,function(_0x462f9f){return db[_0x8a49('0x3d')][_0x8a49('0x5a')]({'where':{'UserId':_0x462f9f['id'],'FaxQueueId':_0x5418a5[_0x8a49('0x26')]['id']},'transaction':_0x498899});});})['then'](function(){_0x14f73f[_0x8a49('0x5b')](function(_0x5a8ab3){socket[_0x8a49('0x5c')](_0x8a49('0x5d'),{'UserId':_0x5a8ab3['id'],'FaxQueueId':_0x39688a['id']});});});});});}})[_0x8a49('0x15')](respondWithStatusCode(_0x4c0dd4,null))[_0x8a49('0x24')](handleError(_0x4c0dd4,null));};exports[_0x8a49('0x5e')]=function(_0x2f532b,_0x1e2f5d){return db[_0x8a49('0x4f')][_0x8a49('0x46')]({'where':{'id':_0x2f532b[_0x8a49('0x22')]['ids']},'attributes':['id'],'include':[{'model':db[_0x8a49('0x54')],'as':_0x8a49('0x57'),'attributes':['id'],'raw':!![]}]})[_0x8a49('0x15')](handleEntityNotFound(_0x1e2f5d,null))[_0x8a49('0x15')](function(_0x4a3ed3){var _0x19c868=_[_0x8a49('0x45')](_0x4a3ed3,'id');var _0x243c8c=[];var _0x1e326f=[];var _0x368568=squel['select']();_0x368568[_0x8a49('0x5f')](_0x8a49('0x60'))[_0x8a49('0x61')]('team_has_fax_queues','tq')[_0x8a49('0x62')]('user_has_teams','ut',_0x8a49('0x63'))['where'](_0x8a49('0x64'),_0x2f532b[_0x8a49('0x26')]['id']);for(var _0x1bf724=0x0;_0x1bf724<_0x4a3ed3[_0x8a49('0x50')];_0x1bf724+=0x1){let _0x800ea2=_0x4a3ed3[_0x1bf724];for(var _0x9b6c2b=0x0;_0x9b6c2b<_0x800ea2[_0x8a49('0x57')]['length'];_0x9b6c2b+=0x1){let _0x2b9f17=_0x800ea2['Agents'][_0x9b6c2b];var _0x4026f4=_0x368568[_0x8a49('0x65')]();_0x4026f4[_0x8a49('0x20')](_0x8a49('0x66'),_0x2b9f17['id']);_0x1e326f[_0x8a49('0x67')](db[_0x8a49('0x68')][_0x8a49('0x22')](_0x4026f4[_0x8a49('0x69')](),{'type':db['sequelize'][_0x8a49('0x6a')][_0x8a49('0x6b')]})[_0x8a49('0x15')](function(_0x1ed6c3){if(_0x1ed6c3[_0x8a49('0x50')]===0x1){return _0x2b9f17['id'];}else{var _0x3fd3e6=_[_0x8a49('0x6c')](_[_0x8a49('0x45')](_0x1ed6c3,_0x8a49('0x6d')),function(_0x111734){return _[_0x8a49('0x6e')](_0x19c868,_0x111734);});if(_0x3fd3e6){return _0x2b9f17['id'];}}}));}}return BPromise[_0x8a49('0x6f')](_0x1e326f)[_0x8a49('0x15')](function(_0x2a22f4){_0x243c8c=_(_0x243c8c)[_0x8a49('0x70')](_0x2a22f4)[_0x8a49('0x71')]()[_0x8a49('0x72')]();return db[_0x8a49('0x1d')][_0x8a49('0x2f')]({'where':{'id':_0x2f532b['params']['id']}})[_0x8a49('0x15')](function(_0x267038){return db['sequelize'][_0x8a49('0x73')](function(_0x3d3be8){return _0x267038[_0x8a49('0x5e')](_0x2f532b[_0x8a49('0x22')][_0x8a49('0x53')],{'transaction':_0x3d3be8})['then'](function(){if(!_[_0x8a49('0x74')](_0x243c8c)){return _0x267038[_0x8a49('0x75')](_0x243c8c,{'transaction':_0x3d3be8});}})[_0x8a49('0x15')](function(){_0x243c8c[_0x8a49('0x5b')](function(_0x5d9ed8){socket[_0x8a49('0x5c')](_0x8a49('0x76'),{'UserId':_0x5d9ed8,'FaxQueueId':_0x267038['id']});});});});});});})['then'](respondWithStatusCode(_0x1e2f5d,null))[_0x8a49('0x24')](handleError(_0x1e2f5d,null));};exports[_0x8a49('0x77')]=function(_0x443667,_0x33f0a4){return db[_0x8a49('0x1d')][_0x8a49('0x2f')]({'where':{'id':_0x443667[_0x8a49('0x26')]['id']}})[_0x8a49('0x15')](handleEntityNotFound(_0x33f0a4,null))[_0x8a49('0x15')](function(_0x115966){if(_0x115966){return _0x115966[_0x8a49('0x77')](_0x443667[_0x8a49('0x31')][_0x8a49('0x53')],_[_0x8a49('0x78')](_0x443667['body'],[_0x8a49('0x53'),'id'])||{})[_0x8a49('0x79')](function(_0x2b2b38){for(var _0x241296=0x0;_0x241296<_0x443667[_0x8a49('0x31')][_0x8a49('0x53')][_0x8a49('0x50')];_0x241296+=0x1){socket[_0x8a49('0x5c')](_0x8a49('0x5d'),{'UserId':Number(_0x443667[_0x8a49('0x31')][_0x8a49('0x53')][_0x241296]),'FaxQueueId':Number(_0x443667[_0x8a49('0x26')]['id'])});}return _0x2b2b38;});}})[_0x8a49('0x15')](respondWithResult(_0x33f0a4,null))[_0x8a49('0x24')](handleError(_0x33f0a4,null));};exports[_0x8a49('0x75')]=function(_0x1424df,_0x379961){return db[_0x8a49('0x1d')][_0x8a49('0x2f')]({'where':{'id':_0x1424df['params']['id']}})['then'](handleEntityNotFound(_0x379961,null))['then'](function(_0x118cef){if(_0x118cef){return _0x118cef[_0x8a49('0x75')](_0x1424df[_0x8a49('0x22')][_0x8a49('0x53')])['then'](function(){if(_[_0x8a49('0x7a')](_0x1424df['query'][_0x8a49('0x53')])){for(var _0x1d0a6a=0x0;_0x1d0a6a<_0x1424df[_0x8a49('0x22')][_0x8a49('0x53')]['length'];_0x1d0a6a+=0x1){socket[_0x8a49('0x5c')](_0x8a49('0x76'),{'UserId':Number(_0x1424df[_0x8a49('0x22')][_0x8a49('0x53')][_0x1d0a6a]),'FaxQueueId':Number(_0x1424df[_0x8a49('0x26')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x1424df[_0x8a49('0x22')][_0x8a49('0x53')]),'FaxQueueId':Number(_0x1424df[_0x8a49('0x26')]['id'])});}});}})[_0x8a49('0x15')](respondWithStatusCode(_0x379961,null))[_0x8a49('0x24')](handleError(_0x379961,null));};exports[_0x8a49('0x7b')]=function(_0xcae906,_0xf13694){var _0x517900={};var _0xaec64d={};var _0x3a8fd2;var _0x20c316;return db[_0x8a49('0x1d')]['findOne']({'where':{'id':_0xcae906[_0x8a49('0x26')]['id']}})[_0x8a49('0x15')](handleEntityNotFound(_0xf13694,null))[_0x8a49('0x15')](function(_0x250a9d){if(_0x250a9d){_0x3a8fd2=_0x250a9d;_0xaec64d['model']=_[_0x8a49('0x28')](db[_0x8a49('0x54')][_0x8a49('0x29')]);_0xaec64d[_0x8a49('0x22')]=_[_0x8a49('0x28')](_0xcae906[_0x8a49('0x22')]);_0xaec64d[_0x8a49('0x3e')]=_[_0x8a49('0x2a')](_0xaec64d[_0x8a49('0x27')],_0xaec64d[_0x8a49('0x22')]);_0x517900[_0x8a49('0x2b')]=_[_0x8a49('0x2a')](_0xaec64d[_0x8a49('0x27')],qs['fields'](_0xcae906[_0x8a49('0x22')]['fields']));_0x517900['attributes']=_0x517900[_0x8a49('0x2b')]['length']?_0x517900[_0x8a49('0x2b')]:_0xaec64d[_0x8a49('0x27')];_0x517900[_0x8a49('0x40')]=qs['sort'](_0xcae906[_0x8a49('0x22')]['sort']);_0x517900[_0x8a49('0x20')]=qs['filters'](_[_0x8a49('0x42')](_0xcae906[_0x8a49('0x22')],_0xaec64d[_0x8a49('0x3e')]));if(_0xcae906['query'][_0x8a49('0x44')]){_0x517900[_0x8a49('0x20')]=_[_0x8a49('0x51')](_0x517900[_0x8a49('0x20')],{'$or':_[_0x8a49('0x45')](_0x517900[_0x8a49('0x2b')],function(_0x2cb9c6){var _0x220553={};_0x220553[_0x2cb9c6]={'$like':'%'+_0xcae906[_0x8a49('0x22')][_0x8a49('0x44')]+'%'};return _0x220553;})});}_0x517900=_[_0x8a49('0x51')]({},_0x517900,_0xcae906[_0x8a49('0x2e')]);return _0x3a8fd2[_0x8a49('0x7b')](_0x517900);}})[_0x8a49('0x15')](function(_0x22201b){if(_0x22201b){_0x20c316=_0x22201b['length'];if(!_0xcae906[_0x8a49('0x22')][_0x8a49('0x3f')](_0x8a49('0x52'))){_0x517900[_0x8a49('0x10')]=qs['limit'](_0xcae906[_0x8a49('0x22')][_0x8a49('0x10')]);_0x517900[_0x8a49('0x12')]=qs[_0x8a49('0x12')](_0xcae906[_0x8a49('0x22')][_0x8a49('0x12')]);}return _0x3a8fd2[_0x8a49('0x7b')](_0x517900);}})[_0x8a49('0x15')](function(_0xeee0a3){if(_0xeee0a3){return _0xeee0a3?{'count':_0x20c316,'rows':_0xeee0a3}:null;}})[_0x8a49('0x15')](respondWithResult(_0xf13694,null))['catch'](handleError(_0xf13694,null));}; \ No newline at end of file +var _0x187d=['push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','isArray','getAgents','nolimit','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','update','then','destroy','get','FaxQueues','UserProfileResource','stack','name','send','rawAttributes','fieldName','type','getOptions','FaxQueue','include','query','findAll','rows','show','params','model','keys','filters','attributes','fields','length','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','catch','error','describe','getMembers','findOne','UserFaxQueue','intersection','hasOwnProperty','order','sort','where','pick','FaxQueueId','filter','map','merge','options','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','faxPause','getTeams','addTeams','ids','Team','Agents','voicePause','interface','flatMap','transaction','each','findOrCreate','emit','removeTeams','select','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?'];(function(_0x400d9e,_0x1426d8){var _0x498976=function(_0x45b1d8){while(--_0x45b1d8){_0x400d9e['push'](_0x400d9e['shift']());}};_0x498976(++_0x1426d8);}(_0x187d,0x93));var _0xd187=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x187d[_0x1e7b16];return _0x37fadc;};'use strict';var BPromise=require(_0xd187('0x0'));var util=require('util');var _=require(_0xd187('0x1'));var squel=require(_0xd187('0x2'));var Redis=require(_0xd187('0x3'));var qs=require(_0xd187('0x4'));var logger=require(_0xd187('0x5'))(_0xd187('0x6'));var config=require('../../config/environment');var db=require(_0xd187('0x7'))['db'];config[_0xd187('0x8')]=_['defaults'](config[_0xd187('0x8')],{'host':_0xd187('0x9'),'port':0x18eb});var socket=require(_0xd187('0xa'))(new Redis(config[_0xd187('0x8')]));require(_0xd187('0xb'))[_0xd187('0xc')](socket);function respondWithStatusCode(_0x358c45,_0x461a44){_0x461a44=_0x461a44||0xcc;return function(_0x5b480f){if(_0x5b480f){return _0x358c45[_0xd187('0xd')](_0x461a44);}return _0x358c45[_0xd187('0xe')](_0x461a44)[_0xd187('0xf')]();};}function respondWithResult(_0x473866,_0x33ca45){_0x33ca45=_0x33ca45||0xc8;return function(_0x2a61a4){if(_0x2a61a4){return _0x473866['status'](_0x33ca45)[_0xd187('0x10')](_0x2a61a4);}};}function respondWithFilteredResult(_0x412ccf,_0x18237b){return function(_0x5e6180){if(_0x5e6180){var _0x37e80c=typeof _0x18237b[_0xd187('0x11')]===_0xd187('0x12')&&typeof _0x18237b['limit']===_0xd187('0x12');var _0x18ce42=_0x5e6180[_0xd187('0x13')];var _0x126d1a=_0x37e80c?0x0:_0x18237b['offset'];var _0x39a927=_0x37e80c?_0x5e6180[_0xd187('0x13')]:_0x18237b[_0xd187('0x11')]+_0x18237b[_0xd187('0x14')];var _0x4c8f68;if(_0x39a927>=_0x18ce42){_0x39a927=_0x18ce42;_0x4c8f68=0xc8;}else{_0x4c8f68=0xce;}_0x412ccf[_0xd187('0xe')](_0x4c8f68);return _0x412ccf['set']('Content-Range',_0x126d1a+'-'+_0x39a927+'/'+_0x18ce42)[_0xd187('0x10')](_0x5e6180);}return null;};}function saveUpdates(_0x5a4986){return function(_0x4ec155){if(_0x4ec155){return _0x4ec155[_0xd187('0x15')](_0x5a4986)[_0xd187('0x16')](function(_0x374fe0){return _0x374fe0;});}return null;};}function removeEntity(_0x10d9fd){return function(_0x21df74){if(_0x21df74){return _0x21df74[_0xd187('0x17')]()[_0xd187('0x16')](function(){var _0x369809=_0x21df74[_0xd187('0x18')]({'plain':!![]});var _0x46fca3=_0xd187('0x19');return db[_0xd187('0x1a')][_0xd187('0x17')]({'where':{'type':_0x46fca3,'resourceId':_0x369809['id']}})['then'](function(){return _0x21df74;});})[_0xd187('0x16')](function(){_0x10d9fd[_0xd187('0xe')](0xcc)[_0xd187('0xf')]();});}};}function handleEntityNotFound(_0x5bcf5b){return function(_0x5a0360){if(!_0x5a0360){_0x5bcf5b['sendStatus'](0x194);}return _0x5a0360;};}function handleError(_0x435d94,_0x33741d){_0x33741d=_0x33741d||0x1f4;return function(_0x249a82){logger['error'](_0x249a82[_0xd187('0x1b')]);if(_0x249a82['name']){delete _0x249a82[_0xd187('0x1c')];}_0x435d94['status'](_0x33741d)[_0xd187('0x1d')](_0x249a82);};}exports['index']=function(_0x4f3879,_0x2c76fd){var _0x4d992b={};var _0x12da33={'count':0x0,'rows':[]};var _0x598aa4=_['map'](db['FaxQueue'][_0xd187('0x1e')],function(_0xeff822){return{'name':_0xeff822[_0xd187('0x1f')],'type':_0xeff822[_0xd187('0x20')]['key']};});_0x4d992b=qs[_0xd187('0x21')](_0x598aa4,_0x4f3879);var _0x2875c8={'where':_0x4d992b['where']};return db[_0xd187('0x22')][_0xd187('0x13')](_0x2875c8)[_0xd187('0x16')](function(_0x4c50a5){_0x12da33[_0xd187('0x13')]=_0x4c50a5;_0x4d992b['include']=qs[_0xd187('0x23')](_0x4f3879[_0xd187('0x24')]);return db[_0xd187('0x22')][_0xd187('0x25')](_0x4d992b);})['then'](function(_0x140e54){_0x12da33[_0xd187('0x26')]=_0x140e54;return _0x12da33;})['then'](respondWithFilteredResult(_0x2c76fd,_0x4d992b))['catch'](handleError(_0x2c76fd,null));};exports[_0xd187('0x27')]=function(_0x1836cf,_0x13f285){var _0x481346={'raw':!![],'where':{'id':_0x1836cf[_0xd187('0x28')]['id']}},_0x2874b2={};_0x2874b2[_0xd187('0x29')]=_[_0xd187('0x2a')](db['FaxQueue'][_0xd187('0x1e')]);_0x2874b2[_0xd187('0x24')]=_[_0xd187('0x2a')](_0x1836cf['query']);_0x2874b2[_0xd187('0x2b')]=_['intersection'](_0x2874b2[_0xd187('0x29')],_0x2874b2[_0xd187('0x24')]);_0x481346[_0xd187('0x2c')]=_['intersection'](_0x2874b2['model'],qs[_0xd187('0x2d')](_0x1836cf[_0xd187('0x24')]['fields']));_0x481346[_0xd187('0x2c')]=_0x481346[_0xd187('0x2c')][_0xd187('0x2e')]?_0x481346['attributes']:_0x2874b2['model'];if(_0x1836cf[_0xd187('0x24')][_0xd187('0x2f')]){_0x481346['include']=[{'all':!![]}];}_0x481346=_['merge']({},_0x481346,_0x1836cf['options']);return db[_0xd187('0x22')]['find'](_0x481346)[_0xd187('0x16')](handleEntityNotFound(_0x13f285,null))[_0xd187('0x16')](respondWithResult(_0x13f285,null))['catch'](handleError(_0x13f285,null));};exports[_0xd187('0x30')]=function(_0x5674ca,_0x293ce9){return db[_0xd187('0x22')]['create'](_0x5674ca[_0xd187('0x31')],{})[_0xd187('0x16')](function(_0x56cbb2){var _0x4399a5=_0x5674ca['user']['get']({'plain':!![]});if(!_0x4399a5)throw new Error(_0xd187('0x32'));if(_0x4399a5[_0xd187('0x33')]===_0xd187('0x34')){var _0x1a8f54=_0x56cbb2[_0xd187('0x18')]({'plain':!![]});var _0x51964d=_0xd187('0x19');return db[_0xd187('0x35')][_0xd187('0x36')]({'where':{'name':_0x51964d,'userProfileId':_0x4399a5['userProfileId']},'raw':!![]})['then'](function(_0x538c05){if(_0x538c05&&_0x538c05['autoAssociation']===0x0){return db[_0xd187('0x1a')][_0xd187('0x30')]({'name':_0x1a8f54[_0xd187('0x1c')],'resourceId':_0x1a8f54['id'],'type':_0x538c05[_0xd187('0x1c')],'sectionId':_0x538c05['id']},{})[_0xd187('0x16')](function(){return _0x56cbb2;});}else{return _0x56cbb2;}})[_0xd187('0x37')](function(_0x4699e1){logger[_0xd187('0x38')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4699e1);throw _0x4699e1;});}return _0x56cbb2;})[_0xd187('0x16')](respondWithResult(_0x293ce9,0xc9))[_0xd187('0x37')](handleError(_0x293ce9,null));};exports[_0xd187('0x15')]=function(_0x51c7fc,_0x21cbf6){if(_0x51c7fc['body']['id']){delete _0x51c7fc[_0xd187('0x31')]['id'];}return db[_0xd187('0x22')][_0xd187('0x36')]({'where':{'id':_0x51c7fc[_0xd187('0x28')]['id']}})[_0xd187('0x16')](handleEntityNotFound(_0x21cbf6,null))['then'](saveUpdates(_0x51c7fc[_0xd187('0x31')],null))[_0xd187('0x16')](respondWithResult(_0x21cbf6,null))[_0xd187('0x37')](handleError(_0x21cbf6,null));};exports[_0xd187('0x17')]=function(_0x4d6e80,_0xa02567){return db[_0xd187('0x22')]['find']({'where':{'id':_0x4d6e80[_0xd187('0x28')]['id']}})[_0xd187('0x16')](handleEntityNotFound(_0xa02567,null))['then'](removeEntity(_0xa02567,null))['catch'](handleError(_0xa02567,null));};exports[_0xd187('0x39')]=function(_0x5b5d25,_0x505764){return db['FaxQueue']['describe']()[_0xd187('0x16')](respondWithResult(_0x505764,null))[_0xd187('0x37')](handleError(_0x505764,null));};exports[_0xd187('0x3a')]=function(_0x248d6e,_0x321b86){var _0x60062b={'raw':!![],'where':{}},_0x452114={},_0x573155;return db[_0xd187('0x22')][_0xd187('0x3b')]({'where':{'id':_0x248d6e[_0xd187('0x28')]['id']}})[_0xd187('0x16')](handleEntityNotFound(_0x321b86,null))[_0xd187('0x16')](function(_0x2dc84f){if(_0x2dc84f){_0x573155=_0x2dc84f[_0xd187('0x18')]({'plain':!![]});_0x452114[_0xd187('0x29')]=_['keys'](db[_0xd187('0x3c')][_0xd187('0x1e')]);_0x452114[_0xd187('0x24')]=_[_0xd187('0x2a')](_0x248d6e[_0xd187('0x24')]);_0x452114['filters']=_[_0xd187('0x3d')](_0x452114[_0xd187('0x29')],_0x452114['query']);_0x60062b[_0xd187('0x2c')]=_[_0xd187('0x3d')](_0x452114['model'],qs['fields'](_0x248d6e['query']['fields']));_0x60062b[_0xd187('0x2c')]=_0x60062b[_0xd187('0x2c')][_0xd187('0x2e')]?_0x60062b[_0xd187('0x2c')]:_0x452114[_0xd187('0x29')];if(!_0x248d6e[_0xd187('0x24')][_0xd187('0x3e')]('nolimit')){_0x60062b[_0xd187('0x14')]=qs[_0xd187('0x14')](_0x248d6e[_0xd187('0x24')][_0xd187('0x14')]);_0x60062b['offset']=qs[_0xd187('0x11')](_0x248d6e['query']['offset']);}_0x60062b[_0xd187('0x3f')]=qs['sort'](_0x248d6e[_0xd187('0x24')][_0xd187('0x40')]);_0x60062b[_0xd187('0x41')]=qs[_0xd187('0x2b')](_[_0xd187('0x42')](_0x248d6e[_0xd187('0x24')],_0x452114[_0xd187('0x2b')]));_0x60062b[_0xd187('0x41')][_0xd187('0x43')]=_0x2dc84f['id'];if(_0x248d6e['query'][_0xd187('0x44')]){_0x60062b[_0xd187('0x41')]=_['merge'](_0x60062b[_0xd187('0x41')],{'$or':_[_0xd187('0x45')](_0x60062b[_0xd187('0x2c')],function(_0x57eaf5){var _0x2b87fe={};_0x2b87fe[_0x57eaf5]={'$like':'%'+_0x248d6e[_0xd187('0x24')]['filter']+'%'};return _0x2b87fe;})});}_0x60062b=_[_0xd187('0x46')]({},_0x60062b,_0x248d6e[_0xd187('0x47')]);return db['UserFaxQueue'][_0xd187('0x25')](_0x60062b);}})['then'](function(_0x1840d9){if(_0x1840d9){return db[_0xd187('0x48')][_0xd187('0x49')]({'where':{'id':_[_0xd187('0x45')](_0x1840d9,_0xd187('0x4a')),'role':_0xd187('0x4b')},'attributes':['id',_0xd187('0x1c'),'faxPause',_0xd187('0x4c'),_0xd187('0x4d')]});}})[_0xd187('0x16')](function(_0x56b36b){if(_0x56b36b){return{'count':_0x56b36b[_0xd187('0x13')],'rows':_[_0xd187('0x45')](_0x56b36b[_0xd187('0x26')],function(_0x2409c2){return{'membername':_0x2409c2[_0xd187('0x1c')],'UserId':_0x2409c2['id'],'queue_name':_0x573155[_0xd187('0x1c')],'FaxQueueId':_0x573155['id'],'interface':util[_0xd187('0x4e')](_0xd187('0x4f'),_0xd187('0x50'),_0x2409c2[_0xd187('0x1c')]),'penalty':0x0,'paused':_0x2409c2[_0xd187('0x51')],'createdAt':_0x2409c2[_0xd187('0x4d')],'updatedAt':_0x2409c2[_0xd187('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd187('0x16')](respondWithFilteredResult(_0x321b86,_0x60062b))[_0xd187('0x37')](handleError(_0x321b86,null));};exports[_0xd187('0x52')]=function(_0x42fb32,_0x3499b3){var _0x2c4155={};var _0x36a8cc={};var _0x5292dd;var _0x4de2db;return db['FaxQueue'][_0xd187('0x3b')]({'where':{'id':_0x42fb32[_0xd187('0x28')]['id']}})[_0xd187('0x16')](handleEntityNotFound(_0x3499b3,null))[_0xd187('0x16')](function(_0x51fbdb){if(_0x51fbdb){_0x5292dd=_0x51fbdb;_0x36a8cc[_0xd187('0x29')]=_[_0xd187('0x2a')](db['Team']['rawAttributes']);_0x36a8cc[_0xd187('0x24')]=_[_0xd187('0x2a')](_0x42fb32[_0xd187('0x24')]);_0x36a8cc[_0xd187('0x2b')]=_['intersection'](_0x36a8cc[_0xd187('0x29')],_0x36a8cc['query']);_0x2c4155[_0xd187('0x2c')]=_[_0xd187('0x3d')](_0x36a8cc[_0xd187('0x29')],qs[_0xd187('0x2d')](_0x42fb32['query'][_0xd187('0x2d')]));_0x2c4155[_0xd187('0x2c')]=_0x2c4155[_0xd187('0x2c')][_0xd187('0x2e')]?_0x2c4155[_0xd187('0x2c')]:_0x36a8cc['model'];_0x2c4155['order']=qs[_0xd187('0x40')](_0x42fb32[_0xd187('0x24')][_0xd187('0x40')]);_0x2c4155[_0xd187('0x41')]=qs[_0xd187('0x2b')](_[_0xd187('0x42')](_0x42fb32[_0xd187('0x24')],_0x36a8cc[_0xd187('0x2b')]));if(_0x42fb32[_0xd187('0x24')][_0xd187('0x44')]){_0x2c4155[_0xd187('0x41')]=_[_0xd187('0x46')](_0x2c4155['where'],{'$or':_[_0xd187('0x45')](_0x2c4155[_0xd187('0x2c')],function(_0x54e908){var _0x3528b9={};_0x3528b9[_0x54e908]={'$like':'%'+_0x42fb32[_0xd187('0x24')]['filter']+'%'};return _0x3528b9;})});}_0x2c4155=_['merge']({},_0x2c4155,_0x42fb32[_0xd187('0x47')]);return _0x5292dd[_0xd187('0x52')](_0x2c4155);}})[_0xd187('0x16')](function(_0x2f743b){if(_0x2f743b){_0x4de2db=_0x2f743b['length'];if(!_0x42fb32[_0xd187('0x24')][_0xd187('0x3e')]('nolimit')){_0x2c4155['limit']=qs[_0xd187('0x14')](_0x42fb32['query'][_0xd187('0x14')]);_0x2c4155[_0xd187('0x11')]=qs['offset'](_0x42fb32[_0xd187('0x24')]['offset']);}return _0x5292dd[_0xd187('0x52')](_0x2c4155);}})['then'](function(_0x534d03){if(_0x534d03){return _0x534d03?{'count':_0x4de2db,'rows':_0x534d03}:null;}})['then'](respondWithResult(_0x3499b3,null))[_0xd187('0x37')](handleError(_0x3499b3,null));};exports[_0xd187('0x53')]=function(_0x421585,_0x216829){var _0x18e07a=_0x421585[_0xd187('0x31')][_0xd187('0x54')];return db[_0xd187('0x55')]['findAll']({'where':{'id':_0x18e07a},'attributes':['id'],'include':[{'model':db[_0xd187('0x48')],'as':_0xd187('0x56'),'attributes':['id',_0xd187('0x1c'),'online',_0xd187('0x57'),_0xd187('0x58')],'raw':!![]}]})[_0xd187('0x16')](function(_0x433dd3){if(_0x433dd3){var _0x5360d0=_[_0xd187('0x59')](_0x433dd3,function(_0x3a71bb){var _0x4c3255=_0x3a71bb[_0xd187('0x18')]({'plain':!![]});return _0x4c3255[_0xd187('0x56')];});return db[_0xd187('0x22')][_0xd187('0x36')]({'where':{'id':_0x421585['params']['id']}})[_0xd187('0x16')](function(_0x9e6304){return db['sequelize'][_0xd187('0x5a')](function(_0x4f75bb){return _0x9e6304['addTeams'](_0x18e07a,{'transaction':_0x4f75bb})['then'](function(){return BPromise[_0xd187('0x5b')](_0x5360d0,function(_0x28472d){return db[_0xd187('0x3c')][_0xd187('0x5c')]({'where':{'UserId':_0x28472d['id'],'FaxQueueId':_0x421585[_0xd187('0x28')]['id']},'transaction':_0x4f75bb});});})[_0xd187('0x16')](function(){_0x5360d0['forEach'](function(_0xbbe4fb){socket[_0xd187('0x5d')]('userFaxQueue:save',{'UserId':_0xbbe4fb['id'],'FaxQueueId':_0x9e6304['id']});});});});});}})['then'](respondWithStatusCode(_0x216829,null))[_0xd187('0x37')](handleError(_0x216829,null));};exports[_0xd187('0x5e')]=function(_0xaf156f,_0x1f163a){return db[_0xd187('0x55')][_0xd187('0x25')]({'where':{'id':_0xaf156f['query'][_0xd187('0x54')]},'attributes':['id'],'include':[{'model':db[_0xd187('0x48')],'as':_0xd187('0x56'),'attributes':['id'],'raw':!![]}]})[_0xd187('0x16')](handleEntityNotFound(_0x1f163a,null))[_0xd187('0x16')](function(_0x2879ff){var _0x1982cd=_[_0xd187('0x45')](_0x2879ff,'id');var _0x3d9b2f=[];var _0xf31fac=[];var _0x195497=squel[_0xd187('0x5f')]();_0x195497['field']('tq.TeamId')[_0xd187('0x60')](_0xd187('0x61'),'tq')[_0xd187('0x62')](_0xd187('0x63'),'ut',_0xd187('0x64'))[_0xd187('0x41')]('FaxQueueId\x20=\x20?',_0xaf156f[_0xd187('0x28')]['id']);for(var _0x5541ef=0x0;_0x5541ef<_0x2879ff[_0xd187('0x2e')];_0x5541ef+=0x1){let _0x520f86=_0x2879ff[_0x5541ef];for(var _0x5cbfa6=0x0;_0x5cbfa6<_0x520f86[_0xd187('0x56')]['length'];_0x5cbfa6+=0x1){let _0x2fc480=_0x520f86[_0xd187('0x56')][_0x5cbfa6];var _0x1ccb17=_0x195497[_0xd187('0x65')]();_0x1ccb17[_0xd187('0x41')](_0xd187('0x66'),_0x2fc480['id']);_0xf31fac[_0xd187('0x67')](db[_0xd187('0x68')][_0xd187('0x24')](_0x1ccb17[_0xd187('0x69')](),{'type':db[_0xd187('0x68')][_0xd187('0x6a')][_0xd187('0x6b')]})[_0xd187('0x16')](function(_0x25fc08){if(_0x25fc08['length']===0x1){return _0x2fc480['id'];}else{var _0x524dca=_[_0xd187('0x6c')](_[_0xd187('0x45')](_0x25fc08,_0xd187('0x6d')),function(_0x59cc5a){return _[_0xd187('0x6e')](_0x1982cd,_0x59cc5a);});if(_0x524dca){return _0x2fc480['id'];}}}));}}return BPromise[_0xd187('0x6f')](_0xf31fac)['then'](function(_0x4c020b){_0x3d9b2f=_(_0x3d9b2f)[_0xd187('0x70')](_0x4c020b)[_0xd187('0x71')]()[_0xd187('0x72')]();return db[_0xd187('0x22')][_0xd187('0x36')]({'where':{'id':_0xaf156f[_0xd187('0x28')]['id']}})['then'](function(_0x22900){return db[_0xd187('0x68')]['transaction'](function(_0x3244dd){return _0x22900[_0xd187('0x5e')](_0xaf156f[_0xd187('0x24')][_0xd187('0x54')],{'transaction':_0x3244dd})['then'](function(){if(!_['isEmpty'](_0x3d9b2f)){return _0x22900[_0xd187('0x73')](_0x3d9b2f,{'transaction':_0x3244dd});}})[_0xd187('0x16')](function(){_0x3d9b2f[_0xd187('0x74')](function(_0x5f4122){socket[_0xd187('0x5d')](_0xd187('0x75'),{'UserId':_0x5f4122,'FaxQueueId':_0x22900['id']});});});});});});})[_0xd187('0x16')](respondWithStatusCode(_0x1f163a,null))[_0xd187('0x37')](handleError(_0x1f163a,null));};exports['addAgents']=function(_0x17d7d6,_0x4efb9f){return db['FaxQueue']['find']({'where':{'id':_0x17d7d6['params']['id']}})['then'](handleEntityNotFound(_0x4efb9f,null))['then'](function(_0x49d76d){if(_0x49d76d){return _0x49d76d[_0xd187('0x76')](_0x17d7d6[_0xd187('0x31')]['ids'],_[_0xd187('0x77')](_0x17d7d6[_0xd187('0x31')],[_0xd187('0x54'),'id'])||{})[_0xd187('0x78')](function(_0x453e35){for(var _0x4a1189=0x0;_0x4a1189<_0x17d7d6[_0xd187('0x31')]['ids'][_0xd187('0x2e')];_0x4a1189+=0x1){socket[_0xd187('0x5d')](_0xd187('0x79'),{'UserId':Number(_0x17d7d6[_0xd187('0x31')][_0xd187('0x54')][_0x4a1189]),'FaxQueueId':Number(_0x17d7d6[_0xd187('0x28')]['id'])});}return _0x453e35;});}})[_0xd187('0x16')](respondWithResult(_0x4efb9f,null))['catch'](handleError(_0x4efb9f,null));};exports[_0xd187('0x73')]=function(_0x138281,_0x4e358e){return db[_0xd187('0x22')][_0xd187('0x36')]({'where':{'id':_0x138281['params']['id']}})[_0xd187('0x16')](handleEntityNotFound(_0x4e358e,null))[_0xd187('0x16')](function(_0x224312){if(_0x224312){return _0x224312[_0xd187('0x73')](_0x138281[_0xd187('0x24')][_0xd187('0x54')])[_0xd187('0x16')](function(){if(_[_0xd187('0x7a')](_0x138281['query'][_0xd187('0x54')])){for(var _0x516cb3=0x0;_0x516cb3<_0x138281[_0xd187('0x24')][_0xd187('0x54')][_0xd187('0x2e')];_0x516cb3+=0x1){socket[_0xd187('0x5d')]('userFaxQueue:remove',{'UserId':Number(_0x138281['query'][_0xd187('0x54')][_0x516cb3]),'FaxQueueId':Number(_0x138281[_0xd187('0x28')]['id'])});}}else{socket['emit'](_0xd187('0x75'),{'UserId':Number(_0x138281[_0xd187('0x24')][_0xd187('0x54')]),'FaxQueueId':Number(_0x138281[_0xd187('0x28')]['id'])});}});}})[_0xd187('0x16')](respondWithStatusCode(_0x4e358e,null))[_0xd187('0x37')](handleError(_0x4e358e,null));};exports['getAgents']=function(_0x16a7bd,_0x1e834d){var _0x259f1f={};var _0x23e30b={};var _0x1d1d36;var _0x37f046;return db[_0xd187('0x22')][_0xd187('0x3b')]({'where':{'id':_0x16a7bd[_0xd187('0x28')]['id']}})['then'](handleEntityNotFound(_0x1e834d,null))[_0xd187('0x16')](function(_0x162df6){if(_0x162df6){_0x1d1d36=_0x162df6;_0x23e30b[_0xd187('0x29')]=_['keys'](db[_0xd187('0x48')][_0xd187('0x1e')]);_0x23e30b[_0xd187('0x24')]=_[_0xd187('0x2a')](_0x16a7bd[_0xd187('0x24')]);_0x23e30b[_0xd187('0x2b')]=_['intersection'](_0x23e30b[_0xd187('0x29')],_0x23e30b[_0xd187('0x24')]);_0x259f1f[_0xd187('0x2c')]=_['intersection'](_0x23e30b[_0xd187('0x29')],qs[_0xd187('0x2d')](_0x16a7bd[_0xd187('0x24')][_0xd187('0x2d')]));_0x259f1f[_0xd187('0x2c')]=_0x259f1f[_0xd187('0x2c')]['length']?_0x259f1f[_0xd187('0x2c')]:_0x23e30b[_0xd187('0x29')];_0x259f1f['order']=qs[_0xd187('0x40')](_0x16a7bd[_0xd187('0x24')]['sort']);_0x259f1f[_0xd187('0x41')]=qs[_0xd187('0x2b')](_['pick'](_0x16a7bd[_0xd187('0x24')],_0x23e30b[_0xd187('0x2b')]));if(_0x16a7bd['query'][_0xd187('0x44')]){_0x259f1f['where']=_[_0xd187('0x46')](_0x259f1f[_0xd187('0x41')],{'$or':_[_0xd187('0x45')](_0x259f1f[_0xd187('0x2c')],function(_0x636c28){var _0x4b6948={};_0x4b6948[_0x636c28]={'$like':'%'+_0x16a7bd['query'][_0xd187('0x44')]+'%'};return _0x4b6948;})});}_0x259f1f=_[_0xd187('0x46')]({},_0x259f1f,_0x16a7bd[_0xd187('0x47')]);return _0x1d1d36[_0xd187('0x7b')](_0x259f1f);}})[_0xd187('0x16')](function(_0x307522){if(_0x307522){_0x37f046=_0x307522[_0xd187('0x2e')];if(!_0x16a7bd['query'][_0xd187('0x3e')](_0xd187('0x7c'))){_0x259f1f[_0xd187('0x14')]=qs[_0xd187('0x14')](_0x16a7bd[_0xd187('0x24')][_0xd187('0x14')]);_0x259f1f['offset']=qs[_0xd187('0x11')](_0x16a7bd[_0xd187('0x24')][_0xd187('0x11')]);}return _0x1d1d36[_0xd187('0x7b')](_0x259f1f);}})[_0xd187('0x16')](function(_0x38a7cd){if(_0x38a7cd){return _0x38a7cd?{'count':_0x37f046,'rows':_0x38a7cd}:null;}})[_0xd187('0x16')](respondWithResult(_0x1e834d,null))[_0xd187('0x37')](handleError(_0x1e834d,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index d9c20ac..a83fd78 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 _0x6b4a=['save','remove','emit','hasOwnProperty','hook','exports','setMaxListeners'];(function(_0x55ed26,_0x413d46){var _0x20e66f=function(_0x2dc941){while(--_0x2dc941){_0x55ed26['push'](_0x55ed26['shift']());}};_0x20e66f(++_0x413d46);}(_0x6b4a,0x7d));var _0xa6b4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6b4a[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xa6b4('0x0')](0x0);var events={'afterCreate':_0xa6b4('0x1'),'afterUpdate':'update','afterDestroy':_0xa6b4('0x2')};function emitEvent(_0x2c8119){return function(_0x34a39c,_0x2128dd,_0x578073){FaxQueueEvents[_0xa6b4('0x3')](_0x2c8119+':'+_0x34a39c['id'],_0x34a39c);FaxQueueEvents['emit'](_0x2c8119,_0x34a39c);_0x578073(null);};}for(var e in events){if(events[_0xa6b4('0x4')](e)){var event=events[e];FaxQueue[_0xa6b4('0x5')](e,emitEvent(event));}}module[_0xa6b4('0x6')]=FaxQueueEvents; \ No newline at end of file +var _0xf5e6=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','save'];(function(_0x35f14f,_0x2a2960){var _0x3c738c=function(_0x393235){while(--_0x393235){_0x35f14f['push'](_0x35f14f['shift']());}};_0x3c738c(++_0x2a2960);}(_0xf5e6,0xb5));var _0x6f5e=function(_0x2bd101,_0x1a6fb3){_0x2bd101=_0x2bd101-0x0;var _0x30e156=_0xf5e6[_0x2bd101];return _0x30e156;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x6f5e('0x0'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x6f5e('0x1')](0x0);var events={'afterCreate':_0x6f5e('0x2'),'afterUpdate':_0x6f5e('0x3'),'afterDestroy':_0x6f5e('0x4')};function emitEvent(_0x5975df){return function(_0x4148e4,_0x441ff7,_0x58d628){FaxQueueEvents[_0x6f5e('0x5')](_0x5975df+':'+_0x4148e4['id'],_0x4148e4);FaxQueueEvents[_0x6f5e('0x5')](_0x5975df,_0x4148e4);_0x58d628(null);};}for(var e in events){if(events[_0x6f5e('0x6')](e)){var event=events[e];FaxQueue[_0x6f5e('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index ad001ac..46f67c5 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 _0xd4d2=['util','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash'];(function(_0x1e8dd5,_0x571f6d){var _0x9aa844=function(_0x21dee6){while(--_0x21dee6){_0x1e8dd5['push'](_0x1e8dd5['shift']());}};_0x9aa844(++_0x571f6d);}(_0xd4d2,0xd0));var _0x2d4d=function(_0x34374f,_0x5d1655){_0x34374f=_0x34374f-0x0;var _0x21cc1f=_0xd4d2[_0x34374f];return _0x21cc1f;};'use strict';var _=require(_0x2d4d('0x0'));var util=require(_0x2d4d('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2d4d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d4d('0x3'));var rimraf=require(_0x2d4d('0x4'));var config=require(_0x2d4d('0x5'));var attributes=require(_0x2d4d('0x6'));module[_0x2d4d('0x7')]=function(_0x8c6a3e,_0x19d571){return _0x8c6a3e[_0x2d4d('0x8')](_0x2d4d('0x9'),attributes,{'tableName':_0x2d4d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x139c=['../../config/environment','exports','define','fax_queues','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0x139c,0x138));var _0xc139=function(_0x2ee0b7,_0x1c6591){_0x2ee0b7=_0x2ee0b7-0x0;var _0x156128=_0x139c[_0x2ee0b7];return _0x156128;};'use strict';var _=require(_0xc139('0x0'));var util=require(_0xc139('0x1'));var logger=require('../../config/logger')(_0xc139('0x2'));var moment=require(_0xc139('0x3'));var BPromise=require(_0xc139('0x4'));var rp=require(_0xc139('0x5'));var fs=require('fs');var path=require(_0xc139('0x6'));var rimraf=require('rimraf');var config=require(_0xc139('0x7'));var attributes=require('./faxQueue.attributes');module[_0xc139('0x8')]=function(_0x51b604,_0x55dbe0){return _0x51b604[_0xc139('0x9')]('FaxQueue',attributes,{'tableName':_0xc139('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 9bc89b4..42fc554 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 _0xc03c=['info','FaxQueue,\x20%s,\x20%s','request\x20sent','error','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then'];(function(_0x396466,_0xe9857b){var _0x5e9ab4=function(_0x362f66){while(--_0x362f66){_0x396466['push'](_0x396466['shift']());}};_0x5e9ab4(++_0xe9857b);}(_0xc03c,0xb1));var _0xcc03=function(_0x1551af,_0x5223c3){_0x1551af=_0x1551af-0x0;var _0xd8eb82=_0xc03c[_0x1551af];return _0xd8eb82;};'use strict';var _=require(_0xcc03('0x0'));var util=require(_0xcc03('0x1'));var moment=require(_0xcc03('0x2'));var BPromise=require(_0xcc03('0x3'));var rs=require(_0xcc03('0x4'));var fs=require('fs');var Redis=require(_0xcc03('0x5'));var db=require(_0xcc03('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc03('0x7'))(_0xcc03('0x8'));var config=require(_0xcc03('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcc03('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xcc03('0xb')],{'host':_0xcc03('0xc'),'port':0x18eb});var socket=require(_0xcc03('0xd'))(new Redis(config['redis']));require(_0xcc03('0xe'))[_0xcc03('0xf')](socket);function respondWithRpcPromise(_0x15ae41,_0x1895d6,_0x35884b){return new BPromise(function(_0x582622,_0x28e354){return client[_0xcc03('0x10')](_0x15ae41,_0x35884b)[_0xcc03('0x11')](function(_0x3b03e1){logger[_0xcc03('0x12')](_0xcc03('0x13'),_0x1895d6,_0xcc03('0x14'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x1895d6,_0xcc03('0x14'),JSON['stringify'](_0x3b03e1));if(_0x3b03e1['error']){if(_0x3b03e1[_0xcc03('0x15')]['code']===0x1f4){logger[_0xcc03('0x15')](_0xcc03('0x13'),_0x1895d6,_0x3b03e1[_0xcc03('0x15')][_0xcc03('0x16')]);return _0x28e354(_0x3b03e1['error']['message']);}logger[_0xcc03('0x15')](_0xcc03('0x13'),_0x1895d6,_0x3b03e1[_0xcc03('0x15')]['message']);return _0x582622(_0x3b03e1[_0xcc03('0x15')][_0xcc03('0x16')]);}else{logger[_0xcc03('0x12')](_0xcc03('0x13'),_0x1895d6,'request\x20sent');_0x582622(_0x3b03e1['result'][_0xcc03('0x16')]);}})[_0xcc03('0x17')](function(_0x46bec8){logger['error'](_0xcc03('0x13'),_0x1895d6,_0x46bec8);_0x28e354(_0x46bec8);});});}exports[_0xcc03('0x18')]=function(_0x3e92b8){var _0x56e7bc=this;return new Promise(function(_0x226484,_0x47ad50){return db[_0xcc03('0x19')][_0xcc03('0x1a')]({'raw':_0x3e92b8[_0xcc03('0x1b')]?_0x3e92b8[_0xcc03('0x1b')][_0xcc03('0x1c')]===undefined?!![]:![]:!![],'where':_0x3e92b8[_0xcc03('0x1b')]?_0x3e92b8[_0xcc03('0x1b')][_0xcc03('0x1d')]||null:null,'attributes':_0x3e92b8['options']?_0x3e92b8['options'][_0xcc03('0x1e')]||null:null,'limit':_0x3e92b8[_0xcc03('0x1b')]?_0x3e92b8['options'][_0xcc03('0x1f')]||null:null,'include':_0x3e92b8[_0xcc03('0x1b')]?_0x3e92b8['options'][_0xcc03('0x20')]?_[_0xcc03('0x21')](_0x3e92b8[_0xcc03('0x1b')]['include'],function(_0x9a620e){return{'model':db[_0x9a620e[_0xcc03('0x22')]],'as':_0x9a620e['as'],'attributes':_0x9a620e[_0xcc03('0x1e')],'include':_0x9a620e[_0xcc03('0x20')]?_[_0xcc03('0x21')](_0x9a620e[_0xcc03('0x20')],function(_0x1b60b8){return{'model':db[_0x1b60b8['model']],'as':_0x1b60b8['as'],'attributes':_0x1b60b8[_0xcc03('0x1e')],'include':_0x1b60b8[_0xcc03('0x20')]?_[_0xcc03('0x21')](_0x1b60b8['include'],function(_0x2f4874){return{'model':db[_0x2f4874[_0xcc03('0x22')]],'as':_0x2f4874['as'],'attributes':_0x2f4874[_0xcc03('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a75dc){logger[_0xcc03('0x12')]('GetFaxQueue',_0x3e92b8);logger[_0xcc03('0x23')](_0xcc03('0x18'),_0x3e92b8,JSON[_0xcc03('0x24')](_0x5a75dc));_0x226484(_0x5a75dc);})[_0xcc03('0x17')](function(_0x205b05){logger[_0xcc03('0x15')]('GetFaxQueue',_0x205b05[_0xcc03('0x16')],_0x3e92b8);_0x47ad50(_0x56e7bc[_0xcc03('0x15')](0x1f4,_0x205b05[_0xcc03('0x16')]));});});};exports[_0xcc03('0x25')]=function(_0x1019e3){var _0x57a154=this;return new Promise(function(_0x3c29fc,_0x48db0a){return db[_0xcc03('0x19')][_0xcc03('0x26')]({'raw':_0x1019e3[_0xcc03('0x1b')]?_0x1019e3[_0xcc03('0x1b')][_0xcc03('0x1c')]===undefined?!![]:![]:!![],'where':_0x1019e3[_0xcc03('0x1b')]?_0x1019e3[_0xcc03('0x1b')]['where']||null:null,'attributes':_0x1019e3['options']?_0x1019e3[_0xcc03('0x1b')][_0xcc03('0x1e')]||null:null,'include':_0x1019e3[_0xcc03('0x1b')]?_0x1019e3['options']['include']?_[_0xcc03('0x21')](_0x1019e3[_0xcc03('0x1b')][_0xcc03('0x20')],function(_0x4ecf3b){return{'model':db[_0x4ecf3b[_0xcc03('0x22')]],'as':_0x4ecf3b['as'],'attributes':_0x4ecf3b['attributes'],'include':_0x4ecf3b[_0xcc03('0x20')]?_[_0xcc03('0x21')](_0x4ecf3b[_0xcc03('0x20')],function(_0x1a0b48){return{'model':db[_0x1a0b48[_0xcc03('0x22')]],'as':_0x1a0b48['as'],'attributes':_0x1a0b48['attributes'],'include':_0x1a0b48[_0xcc03('0x20')]?_['map'](_0x1a0b48['include'],function(_0x286a84){return{'model':db[_0x286a84[_0xcc03('0x22')]],'as':_0x286a84['as'],'attributes':_0x286a84[_0xcc03('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e17f8){logger[_0xcc03('0x12')](_0xcc03('0x25'),_0x1019e3);logger[_0xcc03('0x23')]('ShowFaxQueue',_0x1019e3,JSON[_0xcc03('0x24')](_0x1e17f8));_0x3c29fc(_0x1e17f8);})[_0xcc03('0x17')](function(_0xccd55f){logger[_0xcc03('0x15')](_0xcc03('0x25'),_0xccd55f['message'],_0x1019e3);_0x48db0a(_0x57a154[_0xcc03('0x15')](0x1f4,_0xccd55f[_0xcc03('0x16')]));});});}; \ No newline at end of file +var _0xb339=['where','attributes','limit','include','map','model','then','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','request','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetFaxQueue','FaxQueue','options','raw'];(function(_0x2144f3,_0x5f325e){var _0x18cc72=function(_0x2e798a){while(--_0x2e798a){_0x2144f3['push'](_0x2144f3['shift']());}};_0x18cc72(++_0x5f325e);}(_0xb339,0x1ad));var _0x9b33=function(_0x56608c,_0x29eb74){_0x56608c=_0x56608c-0x0;var _0x3c7fb0=_0xb339[_0x56608c];return _0x3c7fb0;};'use strict';var _=require(_0x9b33('0x0'));var util=require(_0x9b33('0x1'));var moment=require(_0x9b33('0x2'));var BPromise=require(_0x9b33('0x3'));var rs=require(_0x9b33('0x4'));var fs=require('fs');var Redis=require(_0x9b33('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b33('0x6'));var logger=require('../../config/logger')(_0x9b33('0x7'));var config=require(_0x9b33('0x8'));var jayson=require(_0x9b33('0x9'));var client=jayson[_0x9b33('0xa')][_0x9b33('0xb')]({'port':0x232a});config[_0x9b33('0xc')]=_[_0x9b33('0xd')](config[_0x9b33('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x9b33('0xe'))(new Redis(config[_0x9b33('0xc')]));require(_0x9b33('0xf'))[_0x9b33('0x10')](socket);function respondWithRpcPromise(_0xa479a7,_0x46d2ac,_0x255d96){return new BPromise(function(_0x4807d9,_0x1424b6){return client[_0x9b33('0x11')](_0xa479a7,_0x255d96)['then'](function(_0x403c2a){logger['info'](_0x9b33('0x12'),_0x46d2ac,_0x9b33('0x13'));logger[_0x9b33('0x14')](_0x9b33('0x15'),_0x46d2ac,_0x9b33('0x13'),JSON[_0x9b33('0x16')](_0x403c2a));if(_0x403c2a[_0x9b33('0x17')]){if(_0x403c2a[_0x9b33('0x17')][_0x9b33('0x18')]===0x1f4){logger[_0x9b33('0x17')]('FaxQueue,\x20%s,\x20%s',_0x46d2ac,_0x403c2a[_0x9b33('0x17')][_0x9b33('0x19')]);return _0x1424b6(_0x403c2a[_0x9b33('0x17')][_0x9b33('0x19')]);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x46d2ac,_0x403c2a[_0x9b33('0x17')]['message']);return _0x4807d9(_0x403c2a[_0x9b33('0x17')][_0x9b33('0x19')]);}else{logger[_0x9b33('0x1a')](_0x9b33('0x12'),_0x46d2ac,'request\x20sent');_0x4807d9(_0x403c2a[_0x9b33('0x1b')][_0x9b33('0x19')]);}})[_0x9b33('0x1c')](function(_0x5e2a7d){logger[_0x9b33('0x17')](_0x9b33('0x12'),_0x46d2ac,_0x5e2a7d);_0x1424b6(_0x5e2a7d);});});}exports[_0x9b33('0x1d')]=function(_0x2830e8){var _0x21c4cc=this;return new Promise(function(_0xf70151,_0x2c1661){return db[_0x9b33('0x1e')]['findAll']({'raw':_0x2830e8[_0x9b33('0x1f')]?_0x2830e8[_0x9b33('0x1f')][_0x9b33('0x20')]===undefined?!![]:![]:!![],'where':_0x2830e8[_0x9b33('0x1f')]?_0x2830e8[_0x9b33('0x1f')][_0x9b33('0x21')]||null:null,'attributes':_0x2830e8['options']?_0x2830e8['options'][_0x9b33('0x22')]||null:null,'limit':_0x2830e8[_0x9b33('0x1f')]?_0x2830e8[_0x9b33('0x1f')][_0x9b33('0x23')]||null:null,'include':_0x2830e8[_0x9b33('0x1f')]?_0x2830e8[_0x9b33('0x1f')][_0x9b33('0x24')]?_[_0x9b33('0x25')](_0x2830e8[_0x9b33('0x1f')][_0x9b33('0x24')],function(_0x22026e){return{'model':db[_0x22026e[_0x9b33('0x26')]],'as':_0x22026e['as'],'attributes':_0x22026e[_0x9b33('0x22')],'include':_0x22026e[_0x9b33('0x24')]?_[_0x9b33('0x25')](_0x22026e['include'],function(_0x319b88){return{'model':db[_0x319b88[_0x9b33('0x26')]],'as':_0x319b88['as'],'attributes':_0x319b88[_0x9b33('0x22')],'include':_0x319b88[_0x9b33('0x24')]?_[_0x9b33('0x25')](_0x319b88[_0x9b33('0x24')],function(_0x453742){return{'model':db[_0x453742[_0x9b33('0x26')]],'as':_0x453742['as'],'attributes':_0x453742[_0x9b33('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9b33('0x27')](function(_0x40357f){logger[_0x9b33('0x1a')](_0x9b33('0x1d'),_0x2830e8);logger['debug'](_0x9b33('0x1d'),_0x2830e8,JSON[_0x9b33('0x16')](_0x40357f));_0xf70151(_0x40357f);})['catch'](function(_0x3d9d1d){logger[_0x9b33('0x17')](_0x9b33('0x1d'),_0x3d9d1d[_0x9b33('0x19')],_0x2830e8);_0x2c1661(_0x21c4cc[_0x9b33('0x17')](0x1f4,_0x3d9d1d[_0x9b33('0x19')]));});});};exports[_0x9b33('0x28')]=function(_0x39a0ea){var _0x3de307=this;return new Promise(function(_0x2eac4e,_0x52f59c){return db[_0x9b33('0x1e')][_0x9b33('0x29')]({'raw':_0x39a0ea[_0x9b33('0x1f')]?_0x39a0ea['options'][_0x9b33('0x20')]===undefined?!![]:![]:!![],'where':_0x39a0ea['options']?_0x39a0ea['options'][_0x9b33('0x21')]||null:null,'attributes':_0x39a0ea[_0x9b33('0x1f')]?_0x39a0ea[_0x9b33('0x1f')][_0x9b33('0x22')]||null:null,'include':_0x39a0ea['options']?_0x39a0ea[_0x9b33('0x1f')][_0x9b33('0x24')]?_[_0x9b33('0x25')](_0x39a0ea[_0x9b33('0x1f')][_0x9b33('0x24')],function(_0x366216){return{'model':db[_0x366216[_0x9b33('0x26')]],'as':_0x366216['as'],'attributes':_0x366216[_0x9b33('0x22')],'include':_0x366216['include']?_[_0x9b33('0x25')](_0x366216[_0x9b33('0x24')],function(_0x170837){return{'model':db[_0x170837['model']],'as':_0x170837['as'],'attributes':_0x170837[_0x9b33('0x22')],'include':_0x170837[_0x9b33('0x24')]?_['map'](_0x170837[_0x9b33('0x24')],function(_0x589fc8){return{'model':db[_0x589fc8[_0x9b33('0x26')]],'as':_0x589fc8['as'],'attributes':_0x589fc8[_0x9b33('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a789d){logger[_0x9b33('0x1a')](_0x9b33('0x28'),_0x39a0ea);logger['debug'](_0x9b33('0x28'),_0x39a0ea,JSON['stringify'](_0x3a789d));_0x2eac4e(_0x3a789d);})[_0x9b33('0x1c')](function(_0x12f485){logger[_0x9b33('0x17')](_0x9b33('0x28'),_0x12f485['message'],_0x39a0ea);_0x52f59c(_0x3de307[_0x9b33('0x17')](0x1f4,_0x12f485['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index eaca04f..5765d90 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 _0x2fbc=['update','removeListener','./faxQueue.events','save','remove'];(function(_0x583b3b,_0x31271d){var _0xcdb6d0=function(_0x209dcd){while(--_0x209dcd){_0x583b3b['push'](_0x583b3b['shift']());}};_0xcdb6d0(++_0x31271d);}(_0x2fbc,0x106));var _0xc2fb=function(_0x28b347,_0x56ae58){_0x28b347=_0x28b347-0x0;var _0x16708a=_0x2fbc[_0x28b347];return _0x16708a;};'use strict';var FaxQueueEvents=require(_0xc2fb('0x0'));var events=[_0xc2fb('0x1'),_0xc2fb('0x2'),_0xc2fb('0x3')];function createListener(_0x8ccfac,_0x118b84){return function(_0x200345){_0x118b84['emit'](_0x8ccfac,_0x200345);};}function removeListener(_0x5be756,_0x2cf307){return function(){FaxQueueEvents[_0xc2fb('0x4')](_0x5be756,_0x2cf307);};}exports['register']=function(_0x42131d){for(var _0xe92640=0x0,_0x5162a4=events['length'];_0xe92640<_0x5162a4;_0xe92640++){var _0x3e79e9=events[_0xe92640];var _0x35cc7c=createListener('faxQueue:'+_0x3e79e9,_0x42131d);FaxQueueEvents['on'](_0x3e79e9,_0x35cc7c);}}; \ No newline at end of file +var _0xbea5=['removeListener','register','length','faxQueue:','./faxQueue.events','save','remove','update'];(function(_0x18b3ad,_0x2a0be7){var _0x23057a=function(_0x3a1d84){while(--_0x3a1d84){_0x18b3ad['push'](_0x18b3ad['shift']());}};_0x23057a(++_0x2a0be7);}(_0xbea5,0x13c));var _0x5bea=function(_0x13b7fd,_0x4eaf7f){_0x13b7fd=_0x13b7fd-0x0;var _0x32a74a=_0xbea5[_0x13b7fd];return _0x32a74a;};'use strict';var FaxQueueEvents=require(_0x5bea('0x0'));var events=[_0x5bea('0x1'),_0x5bea('0x2'),_0x5bea('0x3')];function createListener(_0x2885a2,_0x5e6ec3){return function(_0x544acf){_0x5e6ec3['emit'](_0x2885a2,_0x544acf);};}function removeListener(_0x1d12aa,_0x4007fa){return function(){FaxQueueEvents[_0x5bea('0x4')](_0x1d12aa,_0x4007fa);};}exports[_0x5bea('0x5')]=function(_0x115efa){for(var _0x20c132=0x0,_0x250fdd=events[_0x5bea('0x6')];_0x20c132<_0x250fdd;_0x20c132++){var _0x3a0192=events[_0x20c132];var _0x2585c1=createListener(_0x5bea('0x7')+_0x3a0192,_0x115efa);FaxQueueEvents['on'](_0x3a0192,_0x2585c1);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 4cde3ea..6692ab9 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 _0x4888=['/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index'];(function(_0x3cd820,_0x1df583){var _0x849613=function(_0x11a7b0){while(--_0x11a7b0){_0x3cd820['push'](_0x3cd820['shift']());}};_0x849613(++_0x1df583);}(_0x4888,0x198));var _0x8488=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x4888[_0x5e3b04];return _0x1fc44d;};'use strict';var multer=require('multer');var util=require(_0x8488('0x0'));var path=require(_0x8488('0x1'));var timeout=require(_0x8488('0x2'));var express=require(_0x8488('0x3'));var router=express[_0x8488('0x4')]();var fs_extra=require(_0x8488('0x5'));var auth=require(_0x8488('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8488('0x7'));var controller=require(_0x8488('0x8'));router[_0x8488('0x9')]('/',auth[_0x8488('0xa')](),controller[_0x8488('0xb')]);router[_0x8488('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x8488('0xc'),auth[_0x8488('0xa')](),controller['show']);router[_0x8488('0x9')](_0x8488('0xd'),auth[_0x8488('0xa')](),controller[_0x8488('0xe')]);router['get'](_0x8488('0xf'),auth[_0x8488('0xa')](),controller[_0x8488('0x10')]);router[_0x8488('0x9')](_0x8488('0x11'),auth['isAuthenticated'](),controller[_0x8488('0x12')]);router[_0x8488('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8488('0x13')]('/:id/teams',auth[_0x8488('0xa')](),controller['addTeams']);router['post'](_0x8488('0x11'),auth[_0x8488('0xa')](),controller[_0x8488('0x14')]);router[_0x8488('0x15')](_0x8488('0xc'),auth[_0x8488('0xa')](),controller[_0x8488('0x16')]);router['delete'](_0x8488('0xc'),auth[_0x8488('0xa')](),controller[_0x8488('0x17')]);router[_0x8488('0x18')](_0x8488('0xf'),auth[_0x8488('0xa')](),controller[_0x8488('0x19')]);router[_0x8488('0x18')](_0x8488('0x11'),auth[_0x8488('0xa')](),controller[_0x8488('0x1a')]);module[_0x8488('0x1b')]=router; \ No newline at end of file +var _0x6d38=['../../config/environment','./faxQueue.controller','isAuthenticated','index','get','/describe','/:id','/:id/members','/:id/teams','getAgents','post','create','/:id/users','addAgents','put','update','destroy','delete','removeTeams','removeAgents','util','path','connect-timeout','fs-extra','../../components/interaction/service'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6d38,0x1ef));var _0x86d3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x6d38[_0x21a9d9];return _0x46adce;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86d3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var controller=require(_0x86d3('0x6'));router['get']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x8')]);router[_0x86d3('0x9')](_0x86d3('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x86d3('0x9')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['show']);router['get'](_0x86d3('0xc'),auth[_0x86d3('0x7')](),controller['getMembers']);router['get'](_0x86d3('0xd'),auth[_0x86d3('0x7')](),controller['getTeams']);router[_0x86d3('0x9')]('/:id/users',auth[_0x86d3('0x7')](),controller[_0x86d3('0xe')]);router[_0x86d3('0xf')]('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x10')]);router[_0x86d3('0xf')](_0x86d3('0xd'),auth[_0x86d3('0x7')](),controller['addTeams']);router[_0x86d3('0xf')](_0x86d3('0x11'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x12')]);router[_0x86d3('0x13')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x14')]);router['delete'](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x15')]);router[_0x86d3('0x16')](_0x86d3('0xd'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x17')]);router[_0x86d3('0x16')](_0x86d3('0x11'),auth['isAuthenticated'](),controller[_0x86d3('0x18')]);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 ff49dc8..911872f 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 _0xfd32=['STRING','DATE','moment','sequelize','exports'];(function(_0xcd5653,_0x383485){var _0xa6bdc0=function(_0x165885){while(--_0x165885){_0xcd5653['push'](_0xcd5653['shift']());}};_0xa6bdc0(++_0x383485);}(_0xfd32,0xd9));var _0x2fd3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd32[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x2fd3('0x0'));var Sequelize=require(_0x2fd3('0x1'));module[_0x2fd3('0x2')]={'uniqueid':{'type':Sequelize[_0x2fd3('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x2fd3('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x2fd3('0x4')]},'reason':{'type':Sequelize[_0x2fd3('0x3')]}}; \ No newline at end of file +var _0x716a=['exports','STRING','DATE','moment','sequelize'];(function(_0x2311c9,_0x19a509){var _0x4cf57a=function(_0xf776d2){while(--_0xf776d2){_0x2311c9['push'](_0x2311c9['shift']());}};_0x4cf57a(++_0x19a509);}(_0x716a,0x1a2));var _0xa716=function(_0x1678c8,_0x1c32f4){_0x1678c8=_0x1678c8-0x0;var _0x387aa9=_0x716a[_0x1678c8];return _0x387aa9;};'use strict';var moment=require(_0xa716('0x0'));var Sequelize=require(_0xa716('0x1'));module[_0xa716('0x2')]={'uniqueid':{'type':Sequelize[_0xa716('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa716('0x3')]},'joinAt':{'type':Sequelize[_0xa716('0x4')]},'leaveAt':{'type':Sequelize[_0xa716('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xa716('0x4')]},'reason':{'type':Sequelize[_0xa716('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 230d2e4..24840fa 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 _0xe2cc=['keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','create','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','FaxQueueReport','rawAttributes','fieldName','type','model','map','query'];(function(_0x2f78ea,_0x136ea2){var _0x7f25b7=function(_0x21d602){while(--_0x21d602){_0x2f78ea['push'](_0x2f78ea['shift']());}};_0x7f25b7(++_0x136ea2);}(_0xe2cc,0x69));var _0xce2c=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xe2cc[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0xce2c('0x0'));var rimraf=require(_0xce2c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xce2c('0x2'));var moment=require(_0xce2c('0x3'));var BPromise=require(_0xce2c('0x4'));var Mustache=require(_0xce2c('0x5'));var util=require(_0xce2c('0x6'));var path=require(_0xce2c('0x7'));var sox=require(_0xce2c('0x8'));var csv=require(_0xce2c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce2c('0xa'));var squel=require(_0xce2c('0xb'));var crypto=require(_0xce2c('0xc'));var jsforce=require(_0xce2c('0xd'));var deskjs=require(_0xce2c('0xe'));var toCsv=require(_0xce2c('0x9'));var querystring=require('querystring');var Papa=require(_0xce2c('0xf'));var Redis=require(_0xce2c('0x10'));var authService=require(_0xce2c('0x11'));var qs=require(_0xce2c('0x12'));var as=require(_0xce2c('0x13'));var hardwareService=require(_0xce2c('0x14'));var logger=require(_0xce2c('0x15'))(_0xce2c('0x16'));var utils=require(_0xce2c('0x17'));var config=require(_0xce2c('0x18'));var licenseUtil=require(_0xce2c('0x19'));var db=require(_0xce2c('0x1a'))['db'];function respondWithStatusCode(_0x2f3b17,_0x27928d){_0x27928d=_0x27928d||0xcc;return function(_0x2421f6){if(_0x2421f6){return _0x2f3b17['sendStatus'](_0x27928d);}return _0x2f3b17['status'](_0x27928d)[_0xce2c('0x1b')]();};}function respondWithResult(_0x57c898,_0x214c62){_0x214c62=_0x214c62||0xc8;return function(_0x179855){if(_0x179855){return _0x57c898[_0xce2c('0x1c')](_0x214c62)[_0xce2c('0x1d')](_0x179855);}};}function respondWithFilteredResult(_0x4873e6,_0xb99213){return function(_0x1c3046){if(_0x1c3046){var _0x146830=typeof _0xb99213[_0xce2c('0x1e')]===_0xce2c('0x1f')&&typeof _0xb99213[_0xce2c('0x20')]===_0xce2c('0x1f');var _0x561b9e=_0x1c3046[_0xce2c('0x21')];var _0x35bc08=_0x146830?0x0:_0xb99213[_0xce2c('0x1e')];var _0x151422=_0x146830?_0x1c3046[_0xce2c('0x21')]:_0xb99213['offset']+_0xb99213[_0xce2c('0x20')];var _0xcc8a80;if(_0x151422>=_0x561b9e){_0x151422=_0x561b9e;_0xcc8a80=0xc8;}else{_0xcc8a80=0xce;}_0x4873e6['status'](_0xcc8a80);return _0x4873e6['set'](_0xce2c('0x22'),_0x35bc08+'-'+_0x151422+'/'+_0x561b9e)[_0xce2c('0x1d')](_0x1c3046);}return null;};}function patchUpdates(_0x43ee21){return function(_0x2f409c){try{jsonpatch[_0xce2c('0x23')](_0x2f409c,_0x43ee21,!![]);}catch(_0x228bf3){return BPromise[_0xce2c('0x24')](_0x228bf3);}return _0x2f409c['save']();};}function saveUpdates(_0x30380e,_0xb8057b){return function(_0x399f67){if(_0x399f67){return _0x399f67[_0xce2c('0x25')](_0x30380e)[_0xce2c('0x26')](function(_0x1c8bb6){return _0x1c8bb6;});}return null;};}function removeEntity(_0x1e263d,_0x39880d){return function(_0x451e86){if(_0x451e86){return _0x451e86[_0xce2c('0x27')]()['then'](function(){_0x1e263d[_0xce2c('0x1c')](0xcc)[_0xce2c('0x1b')]();});}};}function handleEntityNotFound(_0x333471,_0x1d1e5c){return function(_0x16382d){if(!_0x16382d){_0x333471[_0xce2c('0x28')](0x194);}return _0x16382d;};}function handleError(_0x59b52c,_0x1e744b){_0x1e744b=_0x1e744b||0x1f4;return function(_0x5728c7){logger[_0xce2c('0x29')](_0x5728c7[_0xce2c('0x2a')]);if(_0x5728c7[_0xce2c('0x2b')]){delete _0x5728c7[_0xce2c('0x2b')];}_0x59b52c[_0xce2c('0x1c')](_0x1e744b)[_0xce2c('0x2c')](_0x5728c7);};}exports[_0xce2c('0x2d')]=function(_0x32caae,_0x1e349c){var _0x4f9808={},_0x4358ee={},_0x45efae={'count':0x0,'rows':[]};var _0x385b0d=_['map'](db[_0xce2c('0x2e')][_0xce2c('0x2f')],function(_0x472a5f){return{'name':_0x472a5f[_0xce2c('0x30')],'type':_0x472a5f[_0xce2c('0x31')]['key']};});_0x4358ee[_0xce2c('0x32')]=_[_0xce2c('0x33')](_0x385b0d,'name');_0x4358ee[_0xce2c('0x34')]=_[_0xce2c('0x35')](_0x32caae[_0xce2c('0x34')]);_0x4358ee[_0xce2c('0x36')]=_[_0xce2c('0x37')](_0x4358ee['model'],_0x4358ee[_0xce2c('0x34')]);_0x4f9808['attributes']=_[_0xce2c('0x37')](_0x4358ee[_0xce2c('0x32')],qs['fields'](_0x32caae[_0xce2c('0x34')][_0xce2c('0x38')]));_0x4f9808[_0xce2c('0x39')]=_0x4f9808[_0xce2c('0x39')]['length']?_0x4f9808[_0xce2c('0x39')]:_0x4358ee[_0xce2c('0x32')];if(!_0x32caae['query'][_0xce2c('0x3a')](_0xce2c('0x3b'))){_0x4f9808[_0xce2c('0x20')]=qs[_0xce2c('0x20')](_0x32caae[_0xce2c('0x34')][_0xce2c('0x20')]);_0x4f9808[_0xce2c('0x1e')]=qs[_0xce2c('0x1e')](_0x32caae['query'][_0xce2c('0x1e')]);}_0x4f9808[_0xce2c('0x3c')]=qs['sort'](_0x32caae[_0xce2c('0x34')][_0xce2c('0x3d')]);_0x4f9808[_0xce2c('0x3e')]=qs[_0xce2c('0x36')](_[_0xce2c('0x3f')](_0x32caae[_0xce2c('0x34')],_0x4358ee[_0xce2c('0x36')]),_0x385b0d);if(_0x32caae[_0xce2c('0x34')][_0xce2c('0x40')]){_0x4f9808[_0xce2c('0x3e')]=_[_0xce2c('0x41')](_0x4f9808['where'],{'$or':_[_0xce2c('0x33')](_0x385b0d,function(_0x232b10){if(_0x232b10[_0xce2c('0x31')]!==_0xce2c('0x42')){var _0x317dce={};_0x317dce[_0x232b10[_0xce2c('0x2b')]]={'$like':'%'+_0x32caae[_0xce2c('0x34')][_0xce2c('0x40')]+'%'};return _0x317dce;}})});}_0x4f9808=_[_0xce2c('0x41')]({},_0x4f9808,_0x32caae[_0xce2c('0x43')]);var _0x19a21f={'where':_0x4f9808[_0xce2c('0x3e')]};return db[_0xce2c('0x2e')][_0xce2c('0x21')](_0x19a21f)['then'](function(_0x57b7d7){_0x45efae['count']=_0x57b7d7;if(_0x32caae['query'][_0xce2c('0x44')]){_0x4f9808[_0xce2c('0x45')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x4f9808);})[_0xce2c('0x26')](function(_0x29a022){_0x45efae[_0xce2c('0x46')]=_0x29a022;return _0x45efae;})[_0xce2c('0x26')](respondWithFilteredResult(_0x1e349c,_0x4f9808))[_0xce2c('0x47')](handleError(_0x1e349c,null));};exports[_0xce2c('0x48')]=function(_0x16fa9c,_0x1012fb){var _0x4e2ae2={'raw':!![],'where':{'id':_0x16fa9c[_0xce2c('0x49')]['id']}},_0x8bbc9a={};_0x8bbc9a[_0xce2c('0x32')]=_['keys'](db[_0xce2c('0x2e')][_0xce2c('0x2f')]);_0x8bbc9a['query']=_['keys'](_0x16fa9c[_0xce2c('0x34')]);_0x8bbc9a[_0xce2c('0x36')]=_['intersection'](_0x8bbc9a['model'],_0x8bbc9a['query']);_0x4e2ae2[_0xce2c('0x39')]=_[_0xce2c('0x37')](_0x8bbc9a['model'],qs[_0xce2c('0x38')](_0x16fa9c[_0xce2c('0x34')]['fields']));_0x4e2ae2['attributes']=_0x4e2ae2['attributes'][_0xce2c('0x4a')]?_0x4e2ae2['attributes']:_0x8bbc9a[_0xce2c('0x32')];if(_0x16fa9c[_0xce2c('0x34')]['includeAll']){_0x4e2ae2[_0xce2c('0x45')]=[{'all':!![]}];}_0x4e2ae2=_[_0xce2c('0x41')]({},_0x4e2ae2,_0x16fa9c[_0xce2c('0x43')]);return db[_0xce2c('0x2e')]['find'](_0x4e2ae2)[_0xce2c('0x26')](handleEntityNotFound(_0x1012fb,null))[_0xce2c('0x26')](respondWithResult(_0x1012fb,null))[_0xce2c('0x47')](handleError(_0x1012fb,null));};exports['create']=function(_0x307ba2,_0x1313ea){return db['FaxQueueReport'][_0xce2c('0x4b')](_0x307ba2['body'],{})[_0xce2c('0x26')](respondWithResult(_0x1313ea,0xc9))[_0xce2c('0x47')](handleError(_0x1313ea,null));};exports[_0xce2c('0x25')]=function(_0x23fb2b,_0xff694f){if(_0x23fb2b[_0xce2c('0x4c')]['id']){delete _0x23fb2b['body']['id'];}return db[_0xce2c('0x2e')][_0xce2c('0x4d')]({'where':{'id':_0x23fb2b[_0xce2c('0x49')]['id']}})[_0xce2c('0x26')](handleEntityNotFound(_0xff694f,null))[_0xce2c('0x26')](saveUpdates(_0x23fb2b[_0xce2c('0x4c')],null))[_0xce2c('0x26')](respondWithResult(_0xff694f,null))[_0xce2c('0x47')](handleError(_0xff694f,null));};exports[_0xce2c('0x27')]=function(_0x7b381f,_0x3414b3){return db[_0xce2c('0x2e')][_0xce2c('0x4d')]({'where':{'id':_0x7b381f['params']['id']}})['then'](handleEntityNotFound(_0x3414b3,null))['then'](removeEntity(_0x3414b3,null))[_0xce2c('0x47')](handleError(_0x3414b3,null));};exports[_0xce2c('0x4e')]=function(_0x269cb8,_0xd5f25b){return db[_0xce2c('0x2e')][_0xce2c('0x4e')]()[_0xce2c('0x26')](respondWithResult(_0xd5f25b,null))[_0xce2c('0x47')](handleError(_0xd5f25b,null));}; \ No newline at end of file +var _0x4627=['apply','reject','save','then','end','sendStatus','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','params','length','include','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','Content-Range','json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4627,0x115));var _0x7462=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0x4627[_0x43d16c];return _0x208cce;};'use strict';var emlformat=require(_0x7462('0x0'));var rimraf=require(_0x7462('0x1'));var zipdir=require(_0x7462('0x2'));var jsonpatch=require(_0x7462('0x3'));var rp=require(_0x7462('0x4'));var moment=require(_0x7462('0x5'));var BPromise=require(_0x7462('0x6'));var Mustache=require(_0x7462('0x7'));var util=require(_0x7462('0x8'));var path=require(_0x7462('0x9'));var sox=require(_0x7462('0xa'));var csv=require(_0x7462('0xb'));var ejs=require(_0x7462('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7462('0xd'));var squel=require(_0x7462('0xe'));var crypto=require(_0x7462('0xf'));var jsforce=require(_0x7462('0x10'));var deskjs=require(_0x7462('0x11'));var toCsv=require(_0x7462('0xb'));var querystring=require(_0x7462('0x12'));var Papa=require(_0x7462('0x13'));var Redis=require(_0x7462('0x14'));var authService=require(_0x7462('0x15'));var qs=require(_0x7462('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7462('0x17'))(_0x7462('0x18'));var utils=require(_0x7462('0x19'));var config=require(_0x7462('0x1a'));var licenseUtil=require(_0x7462('0x1b'));var db=require(_0x7462('0x1c'))['db'];function respondWithStatusCode(_0x31bf84,_0x4e313a){_0x4e313a=_0x4e313a||0xcc;return function(_0x5cb363){if(_0x5cb363){return _0x31bf84['sendStatus'](_0x4e313a);}return _0x31bf84[_0x7462('0x1d')](_0x4e313a)['end']();};}function respondWithResult(_0x1ba7e5,_0x461bd2){_0x461bd2=_0x461bd2||0xc8;return function(_0x368f45){if(_0x368f45){return _0x1ba7e5[_0x7462('0x1d')](_0x461bd2)['json'](_0x368f45);}};}function respondWithFilteredResult(_0x27b8f5,_0x4913ff){return function(_0x36b008){if(_0x36b008){var _0x42ed50=typeof _0x4913ff[_0x7462('0x1e')]===_0x7462('0x1f')&&typeof _0x4913ff['limit']===_0x7462('0x1f');var _0x56ed70=_0x36b008[_0x7462('0x20')];var _0x216eba=_0x42ed50?0x0:_0x4913ff[_0x7462('0x1e')];var _0x26e25f=_0x42ed50?_0x36b008['count']:_0x4913ff[_0x7462('0x1e')]+_0x4913ff['limit'];var _0x85341c;if(_0x26e25f>=_0x56ed70){_0x26e25f=_0x56ed70;_0x85341c=0xc8;}else{_0x85341c=0xce;}_0x27b8f5[_0x7462('0x1d')](_0x85341c);return _0x27b8f5['set'](_0x7462('0x21'),_0x216eba+'-'+_0x26e25f+'/'+_0x56ed70)[_0x7462('0x22')](_0x36b008);}return null;};}function patchUpdates(_0x4d0e60){return function(_0x25a44a){try{jsonpatch[_0x7462('0x23')](_0x25a44a,_0x4d0e60,!![]);}catch(_0x2e9a25){return BPromise[_0x7462('0x24')](_0x2e9a25);}return _0x25a44a[_0x7462('0x25')]();};}function saveUpdates(_0x4404eb,_0x32da06){return function(_0x3c9616){if(_0x3c9616){return _0x3c9616['update'](_0x4404eb)[_0x7462('0x26')](function(_0x52460e){return _0x52460e;});}return null;};}function removeEntity(_0x185934,_0x11caf5){return function(_0x290715){if(_0x290715){return _0x290715['destroy']()[_0x7462('0x26')](function(){_0x185934['status'](0xcc)[_0x7462('0x27')]();});}};}function handleEntityNotFound(_0x5473d1,_0x5759fa){return function(_0x29992b){if(!_0x29992b){_0x5473d1[_0x7462('0x28')](0x194);}return _0x29992b;};}function handleError(_0x51d9d9,_0x5575fc){_0x5575fc=_0x5575fc||0x1f4;return function(_0x554d21){logger['error'](_0x554d21['stack']);if(_0x554d21[_0x7462('0x29')]){delete _0x554d21[_0x7462('0x29')];}_0x51d9d9['status'](_0x5575fc)[_0x7462('0x2a')](_0x554d21);};}exports[_0x7462('0x2b')]=function(_0x3a3313,_0x10a673){var _0x4948c9={},_0x1f279b={},_0x3523c={'count':0x0,'rows':[]};var _0x30cb61=_[_0x7462('0x2c')](db[_0x7462('0x2d')][_0x7462('0x2e')],function(_0x1136e7){return{'name':_0x1136e7[_0x7462('0x2f')],'type':_0x1136e7[_0x7462('0x30')][_0x7462('0x31')]};});_0x1f279b['model']=_[_0x7462('0x2c')](_0x30cb61,'name');_0x1f279b[_0x7462('0x32')]=_[_0x7462('0x33')](_0x3a3313[_0x7462('0x32')]);_0x1f279b[_0x7462('0x34')]=_['intersection'](_0x1f279b[_0x7462('0x35')],_0x1f279b[_0x7462('0x32')]);_0x4948c9[_0x7462('0x36')]=_[_0x7462('0x37')](_0x1f279b[_0x7462('0x35')],qs[_0x7462('0x38')](_0x3a3313['query'][_0x7462('0x38')]));_0x4948c9['attributes']=_0x4948c9[_0x7462('0x36')]['length']?_0x4948c9[_0x7462('0x36')]:_0x1f279b[_0x7462('0x35')];if(!_0x3a3313['query'][_0x7462('0x39')](_0x7462('0x3a'))){_0x4948c9[_0x7462('0x3b')]=qs[_0x7462('0x3b')](_0x3a3313[_0x7462('0x32')][_0x7462('0x3b')]);_0x4948c9[_0x7462('0x1e')]=qs[_0x7462('0x1e')](_0x3a3313[_0x7462('0x32')][_0x7462('0x1e')]);}_0x4948c9[_0x7462('0x3c')]=qs[_0x7462('0x3d')](_0x3a3313[_0x7462('0x32')][_0x7462('0x3d')]);_0x4948c9['where']=qs[_0x7462('0x34')](_[_0x7462('0x3e')](_0x3a3313[_0x7462('0x32')],_0x1f279b[_0x7462('0x34')]),_0x30cb61);if(_0x3a3313['query'][_0x7462('0x3f')]){_0x4948c9[_0x7462('0x40')]=_[_0x7462('0x41')](_0x4948c9[_0x7462('0x40')],{'$or':_[_0x7462('0x2c')](_0x30cb61,function(_0x235075){if(_0x235075['type']!==_0x7462('0x42')){var _0x11192a={};_0x11192a[_0x235075[_0x7462('0x29')]]={'$like':'%'+_0x3a3313[_0x7462('0x32')]['filter']+'%'};return _0x11192a;}})});}_0x4948c9=_[_0x7462('0x41')]({},_0x4948c9,_0x3a3313[_0x7462('0x43')]);var _0x2ceb2c={'where':_0x4948c9['where']};return db[_0x7462('0x2d')][_0x7462('0x20')](_0x2ceb2c)[_0x7462('0x26')](function(_0x592df3){_0x3523c[_0x7462('0x20')]=_0x592df3;if(_0x3a3313['query'][_0x7462('0x44')]){_0x4948c9['include']=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x4948c9);})[_0x7462('0x26')](function(_0x128029){_0x3523c[_0x7462('0x45')]=_0x128029;return _0x3523c;})['then'](respondWithFilteredResult(_0x10a673,_0x4948c9))['catch'](handleError(_0x10a673,null));};exports['show']=function(_0x3baf7a,_0x8aa7cd){var _0x57e0ae={'raw':!![],'where':{'id':_0x3baf7a[_0x7462('0x46')]['id']}},_0x5e50c7={};_0x5e50c7[_0x7462('0x35')]=_[_0x7462('0x33')](db[_0x7462('0x2d')]['rawAttributes']);_0x5e50c7['query']=_[_0x7462('0x33')](_0x3baf7a[_0x7462('0x32')]);_0x5e50c7[_0x7462('0x34')]=_[_0x7462('0x37')](_0x5e50c7['model'],_0x5e50c7[_0x7462('0x32')]);_0x57e0ae[_0x7462('0x36')]=_[_0x7462('0x37')](_0x5e50c7['model'],qs[_0x7462('0x38')](_0x3baf7a['query'][_0x7462('0x38')]));_0x57e0ae['attributes']=_0x57e0ae['attributes'][_0x7462('0x47')]?_0x57e0ae[_0x7462('0x36')]:_0x5e50c7[_0x7462('0x35')];if(_0x3baf7a[_0x7462('0x32')][_0x7462('0x44')]){_0x57e0ae[_0x7462('0x48')]=[{'all':!![]}];}_0x57e0ae=_[_0x7462('0x41')]({},_0x57e0ae,_0x3baf7a[_0x7462('0x43')]);return db[_0x7462('0x2d')]['find'](_0x57e0ae)['then'](handleEntityNotFound(_0x8aa7cd,null))[_0x7462('0x26')](respondWithResult(_0x8aa7cd,null))['catch'](handleError(_0x8aa7cd,null));};exports[_0x7462('0x49')]=function(_0x53ddd2,_0x331459){return db[_0x7462('0x2d')][_0x7462('0x49')](_0x53ddd2[_0x7462('0x4a')],{})[_0x7462('0x26')](respondWithResult(_0x331459,0xc9))['catch'](handleError(_0x331459,null));};exports['update']=function(_0xe71f4d,_0x37fc97){if(_0xe71f4d[_0x7462('0x4a')]['id']){delete _0xe71f4d[_0x7462('0x4a')]['id'];}return db[_0x7462('0x2d')][_0x7462('0x4b')]({'where':{'id':_0xe71f4d['params']['id']}})[_0x7462('0x26')](handleEntityNotFound(_0x37fc97,null))[_0x7462('0x26')](saveUpdates(_0xe71f4d[_0x7462('0x4a')],null))[_0x7462('0x26')](respondWithResult(_0x37fc97,null))['catch'](handleError(_0x37fc97,null));};exports[_0x7462('0x4c')]=function(_0x26fa39,_0x4429da){return db['FaxQueueReport'][_0x7462('0x4b')]({'where':{'id':_0x26fa39['params']['id']}})[_0x7462('0x26')](handleEntityNotFound(_0x4429da,null))[_0x7462('0x26')](removeEntity(_0x4429da,null))['catch'](handleError(_0x4429da,null));};exports['describe']=function(_0x198fdb,_0x3c82fa){return db[_0x7462('0x2d')][_0x7462('0x4d')]()[_0x7462('0x26')](respondWithResult(_0x3c82fa,null))['catch'](handleError(_0x3c82fa,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 7e530ee..fffa5d1 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 _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x4ac044,_0x4d6e2e){var _0x250f14=function(_0x4bbcef){while(--_0x4bbcef){_0x4ac044['push'](_0x4ac044['shift']());}};_0x250f14(++_0x4d6e2e);}(_0xabce,0x103));var _0xeabc=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xabce[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FaxQueueReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4c39d9,_0x5062a9){_0x4c39d9=_0x4c39d9-0x0;var _0x50bb1=_0x1cb9[_0x4c39d9];return _0x50bb1;};'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':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index ead217b..75f7c08 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 _0xc39d=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','FaxQueueReport,\x20%s,\x20%s','message','info','result','CreateFaxQueueReport','options','raw','debug','catch','UpdateFaxQueueReport','FaxQueueReport','update','where','limit','lodash','moment','bluebird'];(function(_0x4216f0,_0x54f855){var _0x3415ea=function(_0x45fcca){while(--_0x45fcca){_0x4216f0['push'](_0x4216f0['shift']());}};_0x3415ea(++_0x54f855);}(_0xc39d,0x75));var _0xdc39=function(_0xd973ff,_0x20bb38){_0xd973ff=_0xd973ff-0x0;var _0x5114fa=_0xc39d[_0xd973ff];return _0x5114fa;};'use strict';var _=require(_0xdc39('0x0'));var util=require('util');var moment=require(_0xdc39('0x1'));var BPromise=require(_0xdc39('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc39('0x3'))['db'];var utils=require(_0xdc39('0x4'));var logger=require('../../config/logger')(_0xdc39('0x5'));var config=require(_0xdc39('0x6'));var jayson=require(_0xdc39('0x7'));var client=jayson[_0xdc39('0x8')][_0xdc39('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11dc0e,_0x3602b3,_0x4ce4de){return new BPromise(function(_0x2d5f79,_0x230340){return client[_0xdc39('0xa')](_0x11dc0e,_0x4ce4de)[_0xdc39('0xb')](function(_0x3dd14e){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x3602b3,_0xdc39('0xc'));logger['debug'](_0xdc39('0xd'),_0x3602b3,_0xdc39('0xc'),JSON[_0xdc39('0xe')](_0x3dd14e));if(_0x3dd14e[_0xdc39('0xf')]){if(_0x3dd14e[_0xdc39('0xf')]['code']===0x1f4){logger[_0xdc39('0xf')](_0xdc39('0x10'),_0x3602b3,_0x3dd14e['error']['message']);return _0x230340(_0x3dd14e[_0xdc39('0xf')]['message']);}logger[_0xdc39('0xf')](_0xdc39('0x10'),_0x3602b3,_0x3dd14e[_0xdc39('0xf')][_0xdc39('0x11')]);return _0x2d5f79(_0x3dd14e[_0xdc39('0xf')][_0xdc39('0x11')]);}else{logger[_0xdc39('0x12')](_0xdc39('0x10'),_0x3602b3,_0xdc39('0xc'));_0x2d5f79(_0x3dd14e[_0xdc39('0x13')][_0xdc39('0x11')]);}})['catch'](function(_0x3e82d2){logger[_0xdc39('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x3602b3,_0x3e82d2);_0x230340(_0x3e82d2);});});}exports[_0xdc39('0x14')]=function(_0x22e3ac){var _0x1d651e=this;return new Promise(function(_0x37dd5e,_0x319d09){return db['FaxQueueReport']['create'](_0x22e3ac['body'],{'raw':_0x22e3ac[_0xdc39('0x15')]?_0x22e3ac[_0xdc39('0x15')][_0xdc39('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x1af018){logger[_0xdc39('0x12')](_0xdc39('0x14'),_0x22e3ac);logger[_0xdc39('0x17')]('CreateFaxQueueReport',_0x22e3ac,JSON[_0xdc39('0xe')](_0x1af018));_0x37dd5e(_0x1af018);})[_0xdc39('0x18')](function(_0x4e2ac7){logger[_0xdc39('0xf')](_0xdc39('0x14'),_0x4e2ac7[_0xdc39('0x11')],_0x22e3ac);_0x319d09(_0x1d651e[_0xdc39('0xf')](0x1f4,_0x4e2ac7['message']));});});};exports[_0xdc39('0x19')]=function(_0x2a66ce){var _0x5bf9de=this;return new Promise(function(_0xf72bd3,_0x2de698){return db[_0xdc39('0x1a')][_0xdc39('0x1b')](_0x2a66ce['body'],{'raw':_0x2a66ce['options']?_0x2a66ce[_0xdc39('0x15')][_0xdc39('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a66ce[_0xdc39('0x15')]?_0x2a66ce[_0xdc39('0x15')][_0xdc39('0x1c')]||null:null,'attributes':_0x2a66ce[_0xdc39('0x15')]?_0x2a66ce[_0xdc39('0x15')]['attributes']||null:null,'limit':_0x2a66ce[_0xdc39('0x15')]?_0x2a66ce[_0xdc39('0x15')][_0xdc39('0x1d')]||null:null})['then'](function(_0x5050c0){logger['info'](_0xdc39('0x19'),_0x2a66ce);logger[_0xdc39('0x17')](_0xdc39('0x19'),_0x2a66ce,JSON['stringify'](_0x5050c0));_0xf72bd3(_0x5050c0);})['catch'](function(_0x453de2){logger['error'](_0xdc39('0x19'),_0x453de2[_0xdc39('0x11')],_0x2a66ce);_0x2de698(_0x5bf9de[_0xdc39('0xf')](0x1f4,_0x453de2[_0xdc39('0x11')]));});});}; \ No newline at end of file +var _0x6bd2=['request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','UpdateFaxQueueReport','update','where','attributes','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','info','FaxQueueReport,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6bd2,0xed));var _0x26bd=function(_0x60047e,_0x5b82ff){_0x60047e=_0x60047e-0x0;var _0x4057b1=_0x6bd2[_0x60047e];return _0x4057b1;};'use strict';var _=require(_0x26bd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x26bd('0x1'));var rs=require(_0x26bd('0x2'));var fs=require('fs');var Redis=require(_0x26bd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x26bd('0x4'));var logger=require(_0x26bd('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x26bd('0x6'));var client=jayson[_0x26bd('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1be82e,_0x7f92f5,_0x2beae2){return new BPromise(function(_0x117a8f,_0x2208c3){return client[_0x26bd('0x8')](_0x1be82e,_0x2beae2)['then'](function(_0x1d431c){logger[_0x26bd('0x9')](_0x26bd('0xa'),_0x7f92f5,_0x26bd('0xb'));logger[_0x26bd('0xc')](_0x26bd('0xd'),_0x7f92f5,_0x26bd('0xb'),JSON[_0x26bd('0xe')](_0x1d431c));if(_0x1d431c[_0x26bd('0xf')]){if(_0x1d431c['error'][_0x26bd('0x10')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x7f92f5,_0x1d431c[_0x26bd('0xf')][_0x26bd('0x11')]);return _0x2208c3(_0x1d431c[_0x26bd('0xf')]['message']);}logger[_0x26bd('0xf')](_0x26bd('0xa'),_0x7f92f5,_0x1d431c['error'][_0x26bd('0x11')]);return _0x117a8f(_0x1d431c['error'][_0x26bd('0x11')]);}else{logger[_0x26bd('0x9')]('FaxQueueReport,\x20%s,\x20%s',_0x7f92f5,'request\x20sent');_0x117a8f(_0x1d431c[_0x26bd('0x12')][_0x26bd('0x11')]);}})[_0x26bd('0x13')](function(_0x5bb9c1){logger[_0x26bd('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x7f92f5,_0x5bb9c1);_0x2208c3(_0x5bb9c1);});});}exports[_0x26bd('0x14')]=function(_0x358a31){var _0x26df18=this;return new Promise(function(_0x243b68,_0x43aac3){return db[_0x26bd('0x15')][_0x26bd('0x16')](_0x358a31[_0x26bd('0x17')],{'raw':_0x358a31[_0x26bd('0x18')]?_0x358a31[_0x26bd('0x18')][_0x26bd('0x19')]===undefined?!![]:![]:!![]})[_0x26bd('0x1a')](function(_0x50d464){logger['info'](_0x26bd('0x14'),_0x358a31);logger['debug']('CreateFaxQueueReport',_0x358a31,JSON[_0x26bd('0xe')](_0x50d464));_0x243b68(_0x50d464);})[_0x26bd('0x13')](function(_0x370037){logger['error'](_0x26bd('0x14'),_0x370037[_0x26bd('0x11')],_0x358a31);_0x43aac3(_0x26df18['error'](0x1f4,_0x370037[_0x26bd('0x11')]));});});};exports[_0x26bd('0x1b')]=function(_0x446510){var _0x4b06e1=this;return new Promise(function(_0x1ffe63,_0x3e45fd){return db[_0x26bd('0x15')][_0x26bd('0x1c')](_0x446510[_0x26bd('0x17')],{'raw':_0x446510[_0x26bd('0x18')]?_0x446510[_0x26bd('0x18')][_0x26bd('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x446510[_0x26bd('0x18')]?_0x446510['options'][_0x26bd('0x1d')]||null:null,'attributes':_0x446510[_0x26bd('0x18')]?_0x446510['options'][_0x26bd('0x1e')]||null:null,'limit':_0x446510[_0x26bd('0x18')]?_0x446510['options']['limit']||null:null})[_0x26bd('0x1a')](function(_0x5ba65d){logger['info'](_0x26bd('0x1b'),_0x446510);logger[_0x26bd('0xc')]('UpdateFaxQueueReport',_0x446510,JSON[_0x26bd('0xe')](_0x5ba65d));_0x1ffe63(_0x5ba65d);})[_0x26bd('0x13')](function(_0x1a2464){logger['error']('UpdateFaxQueueReport',_0x1a2464[_0x26bd('0x11')],_0x446510);_0x3e45fd(_0x4b06e1[_0x26bd('0xf')](0x1f4,_0x1a2464[_0x26bd('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index b0d649f..883c613 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 _0x09b2=['describe','/:id','show','post','put','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x30adff,_0x213499){var _0x3de126=function(_0x37d442){while(--_0x37d442){_0x30adff['push'](_0x30adff['shift']());}};_0x3de126(++_0x213499);}(_0x09b2,0x73));var _0x209b=function(_0x3cc90b,_0x1b69d9){_0x3cc90b=_0x3cc90b-0x0;var _0x34051b=_0x09b2[_0x3cc90b];return _0x34051b;};'use strict';var multer=require(_0x209b('0x0'));var util=require('util');var path=require(_0x209b('0x1'));var timeout=require(_0x209b('0x2'));var express=require(_0x209b('0x3'));var router=express[_0x209b('0x4')]();var fs_extra=require(_0x209b('0x5'));var auth=require(_0x209b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x209b('0x7'));var controller=require('./faxQueueReport.controller');router[_0x209b('0x8')]('/',auth[_0x209b('0x9')](),controller[_0x209b('0xa')]);router[_0x209b('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x209b('0xb')]);router[_0x209b('0x8')](_0x209b('0xc'),auth[_0x209b('0x9')](),controller[_0x209b('0xd')]);router[_0x209b('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x209b('0xf')](_0x209b('0xc'),auth[_0x209b('0x9')](),controller['update']);router[_0x209b('0x10')](_0x209b('0xc'),auth[_0x209b('0x9')](),controller[_0x209b('0x11')]);module['exports']=router; \ No newline at end of file +var _0xfb7f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','index','get','describe','/:id','post','put','update','destroy','exports','util','path','express'];(function(_0x395bfe,_0x4db521){var _0x35c81c=function(_0x484a1b){while(--_0x484a1b){_0x395bfe['push'](_0x395bfe['shift']());}};_0x35c81c(++_0x4db521);}(_0xfb7f,0x107));var _0xffb7=function(_0x29bdc9,_0x3e7217){_0x29bdc9=_0x29bdc9-0x0;var _0x5cf78f=_0xfb7f[_0x29bdc9];return _0x5cf78f;};'use strict';var multer=require('multer');var util=require(_0xffb7('0x0'));var path=require(_0xffb7('0x1'));var timeout=require('connect-timeout');var express=require(_0xffb7('0x2'));var router=express[_0xffb7('0x3')]();var fs_extra=require(_0xffb7('0x4'));var auth=require(_0xffb7('0x5'));var interaction=require(_0xffb7('0x6'));var config=require(_0xffb7('0x7'));var controller=require(_0xffb7('0x8'));router['get']('/',auth[_0xffb7('0x9')](),controller[_0xffb7('0xa')]);router[_0xffb7('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xffb7('0xc')]);router[_0xffb7('0xb')](_0xffb7('0xd'),auth[_0xffb7('0x9')](),controller['show']);router[_0xffb7('0xe')]('/',auth[_0xffb7('0x9')](),controller['create']);router[_0xffb7('0xf')](_0xffb7('0xd'),auth[_0xffb7('0x9')](),controller[_0xffb7('0x10')]);router['delete'](_0xffb7('0xd'),auth[_0xffb7('0x9')](),controller[_0xffb7('0x11')]);module[_0xffb7('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 748550e..e628dc0 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x294d8f,_0xe9cbd){var _0x571010=function(_0x3a1ced){while(--_0x3a1ced){_0x294d8f['push'](_0x294d8f['shift']());}};_0x571010(++_0xe9cbd);}(_0xaa88,0x137));var _0x8aa8=function(_0x543c51,_0xff0084){_0x543c51=_0x543c51-0x0;var _0x360555=_0xaa88[_0x543c51];return _0x360555;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0xcba9b4,_0x4e4ecd){var _0x15c441=function(_0x1354a7){while(--_0x1354a7){_0xcba9b4['push'](_0xcba9b4['shift']());}};_0x15c441(++_0x4e4ecd);}(_0x00bb,0x1d8));var _0xb00b=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x00bb[_0x29b609];return _0x54c952;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 393ff44..fa300d5 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 _0xcc2b=['Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','findAll','rows','show','params','length','find','catch','create','body','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc2b,0xc8));var _0xbcc2=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xcc2b[_0x50a0c2];return _0x5ebadd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbcc2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbcc2('0x1'));var rp=require(_0xbcc2('0x2'));var moment=require(_0xbcc2('0x3'));var BPromise=require(_0xbcc2('0x4'));var Mustache=require('mustache');var util=require(_0xbcc2('0x5'));var path=require(_0xbcc2('0x6'));var sox=require(_0xbcc2('0x7'));var csv=require(_0xbcc2('0x8'));var ejs=require(_0xbcc2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbcc2('0xa'));var squel=require(_0xbcc2('0xb'));var crypto=require(_0xbcc2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbcc2('0xd'));var toCsv=require(_0xbcc2('0x8'));var querystring=require(_0xbcc2('0xe'));var Papa=require(_0xbcc2('0xf'));var Redis=require(_0xbcc2('0x10'));var authService=require(_0xbcc2('0x11'));var qs=require(_0xbcc2('0x12'));var as=require(_0xbcc2('0x13'));var hardwareService=require(_0xbcc2('0x14'));var logger=require('../../config/logger')(_0xbcc2('0x15'));var utils=require(_0xbcc2('0x16'));var config=require(_0xbcc2('0x17'));var licenseUtil=require(_0xbcc2('0x18'));var db=require(_0xbcc2('0x19'))['db'];function respondWithStatusCode(_0x51f623,_0x4672bc){_0x4672bc=_0x4672bc||0xcc;return function(_0x1e2acd){if(_0x1e2acd){return _0x51f623[_0xbcc2('0x1a')](_0x4672bc);}return _0x51f623[_0xbcc2('0x1b')](_0x4672bc)[_0xbcc2('0x1c')]();};}function respondWithResult(_0x5793c2,_0x196027){_0x196027=_0x196027||0xc8;return function(_0x43593b){if(_0x43593b){return _0x5793c2[_0xbcc2('0x1b')](_0x196027)['json'](_0x43593b);}};}function respondWithFilteredResult(_0x59771f,_0x4c4255){return function(_0x586957){if(_0x586957){var _0xbd7657=typeof _0x4c4255[_0xbcc2('0x1d')]===_0xbcc2('0x1e')&&typeof _0x4c4255[_0xbcc2('0x1f')]===_0xbcc2('0x1e');var _0x51382a=_0x586957[_0xbcc2('0x20')];var _0x2c77b4=_0xbd7657?0x0:_0x4c4255[_0xbcc2('0x1d')];var _0x7af105=_0xbd7657?_0x586957[_0xbcc2('0x20')]:_0x4c4255['offset']+_0x4c4255['limit'];var _0x4189be;if(_0x7af105>=_0x51382a){_0x7af105=_0x51382a;_0x4189be=0xc8;}else{_0x4189be=0xce;}_0x59771f[_0xbcc2('0x1b')](_0x4189be);return _0x59771f[_0xbcc2('0x21')](_0xbcc2('0x22'),_0x2c77b4+'-'+_0x7af105+'/'+_0x51382a)[_0xbcc2('0x23')](_0x586957);}return null;};}function patchUpdates(_0x5231f2){return function(_0x421b78){try{jsonpatch[_0xbcc2('0x24')](_0x421b78,_0x5231f2,!![]);}catch(_0x25e993){return BPromise['reject'](_0x25e993);}return _0x421b78[_0xbcc2('0x25')]();};}function saveUpdates(_0x5db8cc,_0x49ce54){return function(_0xde33fc){if(_0xde33fc){return _0xde33fc[_0xbcc2('0x26')](_0x5db8cc)[_0xbcc2('0x27')](function(_0x1a4455){return _0x1a4455;});}return null;};}function removeEntity(_0x20dbdc,_0x5b0c03){return function(_0x24bd9c){if(_0x24bd9c){return _0x24bd9c[_0xbcc2('0x28')]()[_0xbcc2('0x27')](function(){_0x20dbdc[_0xbcc2('0x1b')](0xcc)[_0xbcc2('0x1c')]();});}};}function handleEntityNotFound(_0x55a6ec,_0x50036d){return function(_0x50d44){if(!_0x50d44){_0x55a6ec['sendStatus'](0x194);}return _0x50d44;};}function handleError(_0x16e372,_0x6c23fe){_0x6c23fe=_0x6c23fe||0x1f4;return function(_0x22f01f){logger[_0xbcc2('0x29')](_0x22f01f[_0xbcc2('0x2a')]);if(_0x22f01f[_0xbcc2('0x2b')]){delete _0x22f01f['name'];}_0x16e372[_0xbcc2('0x1b')](_0x6c23fe)[_0xbcc2('0x2c')](_0x22f01f);};}exports[_0xbcc2('0x2d')]=function(_0x220f29,_0x357eb0){var _0x12f660={},_0x25aba8={},_0x58ddf6={'count':0x0,'rows':[]};var _0x56b9d8=_[_0xbcc2('0x2e')](db[_0xbcc2('0x2f')][_0xbcc2('0x30')],function(_0x3aa0f9){return{'name':_0x3aa0f9[_0xbcc2('0x31')],'type':_0x3aa0f9[_0xbcc2('0x32')][_0xbcc2('0x33')]};});_0x25aba8[_0xbcc2('0x34')]=_['map'](_0x56b9d8,'name');_0x25aba8[_0xbcc2('0x35')]=_[_0xbcc2('0x36')](_0x220f29[_0xbcc2('0x35')]);_0x25aba8['filters']=_['intersection'](_0x25aba8['model'],_0x25aba8['query']);_0x12f660[_0xbcc2('0x37')]=_[_0xbcc2('0x38')](_0x25aba8[_0xbcc2('0x34')],qs[_0xbcc2('0x39')](_0x220f29['query'][_0xbcc2('0x39')]));_0x12f660[_0xbcc2('0x37')]=_0x12f660['attributes']['length']?_0x12f660[_0xbcc2('0x37')]:_0x25aba8['model'];if(!_0x220f29[_0xbcc2('0x35')][_0xbcc2('0x3a')](_0xbcc2('0x3b'))){_0x12f660['limit']=qs[_0xbcc2('0x1f')](_0x220f29[_0xbcc2('0x35')]['limit']);_0x12f660[_0xbcc2('0x1d')]=qs[_0xbcc2('0x1d')](_0x220f29['query']['offset']);}_0x12f660[_0xbcc2('0x3c')]=qs['sort'](_0x220f29[_0xbcc2('0x35')][_0xbcc2('0x3d')]);_0x12f660[_0xbcc2('0x3e')]=qs['filters'](_[_0xbcc2('0x3f')](_0x220f29[_0xbcc2('0x35')],_0x25aba8[_0xbcc2('0x40')]),_0x56b9d8);if(_0x220f29[_0xbcc2('0x35')][_0xbcc2('0x41')]){_0x12f660['where']=_[_0xbcc2('0x42')](_0x12f660[_0xbcc2('0x3e')],{'$or':_[_0xbcc2('0x2e')](_0x56b9d8,function(_0x3145ed){if(_0x3145ed[_0xbcc2('0x32')]!=='VIRTUAL'){var _0x2d08a4={};_0x2d08a4[_0x3145ed[_0xbcc2('0x2b')]]={'$like':'%'+_0x220f29[_0xbcc2('0x35')][_0xbcc2('0x41')]+'%'};return _0x2d08a4;}})});}_0x12f660=_[_0xbcc2('0x42')]({},_0x12f660,_0x220f29[_0xbcc2('0x43')]);var _0x4ad9ac={'where':_0x12f660['where']};return db[_0xbcc2('0x2f')][_0xbcc2('0x20')](_0x4ad9ac)[_0xbcc2('0x27')](function(_0x26293d){_0x58ddf6[_0xbcc2('0x20')]=_0x26293d;if(_0x220f29[_0xbcc2('0x35')]['includeAll']){_0x12f660['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0xbcc2('0x44')](_0x12f660);})['then'](function(_0x3f226c){_0x58ddf6[_0xbcc2('0x45')]=_0x3f226c;return _0x58ddf6;})[_0xbcc2('0x27')](respondWithFilteredResult(_0x357eb0,_0x12f660))['catch'](handleError(_0x357eb0,null));};exports[_0xbcc2('0x46')]=function(_0xac0dcf,_0x5ac00d){var _0x436628={'raw':!![],'where':{'id':_0xac0dcf[_0xbcc2('0x47')]['id']}},_0x3d7aaa={};_0x3d7aaa[_0xbcc2('0x34')]=_[_0xbcc2('0x36')](db[_0xbcc2('0x2f')][_0xbcc2('0x30')]);_0x3d7aaa['query']=_['keys'](_0xac0dcf[_0xbcc2('0x35')]);_0x3d7aaa['filters']=_[_0xbcc2('0x38')](_0x3d7aaa['model'],_0x3d7aaa['query']);_0x436628[_0xbcc2('0x37')]=_[_0xbcc2('0x38')](_0x3d7aaa['model'],qs[_0xbcc2('0x39')](_0xac0dcf['query'][_0xbcc2('0x39')]));_0x436628['attributes']=_0x436628[_0xbcc2('0x37')][_0xbcc2('0x48')]?_0x436628[_0xbcc2('0x37')]:_0x3d7aaa[_0xbcc2('0x34')];if(_0xac0dcf[_0xbcc2('0x35')]['includeAll']){_0x436628['include']=[{'all':!![]}];}_0x436628=_[_0xbcc2('0x42')]({},_0x436628,_0xac0dcf[_0xbcc2('0x43')]);return db[_0xbcc2('0x2f')][_0xbcc2('0x49')](_0x436628)[_0xbcc2('0x27')](handleEntityNotFound(_0x5ac00d,null))[_0xbcc2('0x27')](respondWithResult(_0x5ac00d,null))[_0xbcc2('0x4a')](handleError(_0x5ac00d,null));};exports[_0xbcc2('0x4b')]=function(_0x530d05,_0x40a4c8){return db[_0xbcc2('0x2f')][_0xbcc2('0x4b')](_0x530d05[_0xbcc2('0x4c')],{})['then'](respondWithResult(_0x40a4c8,0xc9))['catch'](handleError(_0x40a4c8,null));};exports[_0xbcc2('0x26')]=function(_0x3c7f96,_0x2205d7){if(_0x3c7f96[_0xbcc2('0x4c')]['id']){delete _0x3c7f96['body']['id'];}return db[_0xbcc2('0x2f')][_0xbcc2('0x49')]({'where':{'id':_0x3c7f96[_0xbcc2('0x47')]['id']}})[_0xbcc2('0x27')](handleEntityNotFound(_0x2205d7,null))[_0xbcc2('0x27')](saveUpdates(_0x3c7f96[_0xbcc2('0x4c')],null))[_0xbcc2('0x27')](respondWithResult(_0x2205d7,null))[_0xbcc2('0x4a')](handleError(_0x2205d7,null));};exports[_0xbcc2('0x28')]=function(_0x5edd2e,_0x4529f8){return db[_0xbcc2('0x2f')][_0xbcc2('0x49')]({'where':{'id':_0x5edd2e[_0xbcc2('0x47')]['id']}})[_0xbcc2('0x27')](handleEntityNotFound(_0x4529f8,null))[_0xbcc2('0x27')](removeEntity(_0x4529f8,null))['catch'](handleError(_0x4529f8,null));};exports[_0xbcc2('0x4d')]=function(_0x253327,_0x27b5ff){return db[_0xbcc2('0x2f')][_0xbcc2('0x4d')]()[_0xbcc2('0x27')](respondWithResult(_0x27b5ff,null))[_0xbcc2('0x4a')](handleError(_0x27b5ff,null));}; \ No newline at end of file +var _0x8349=['body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','apply','save','update','then','destroy','name','send','index','map','FaxTransferReport','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','sort','filters','pick','merge','where','type','filter','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x8349,0x93));var _0x9834=function(_0x19ebfd,_0x5ae121){_0x19ebfd=_0x19ebfd-0x0;var _0x11017a=_0x8349[_0x19ebfd];return _0x11017a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9834('0x0'));var zipdir=require(_0x9834('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9834('0x2'));var moment=require(_0x9834('0x3'));var BPromise=require(_0x9834('0x4'));var Mustache=require(_0x9834('0x5'));var util=require(_0x9834('0x6'));var path=require(_0x9834('0x7'));var sox=require(_0x9834('0x8'));var csv=require('to-csv');var ejs=require(_0x9834('0x9'));var fs=require('fs');var fs_extra=require(_0x9834('0xa'));var _=require(_0x9834('0xb'));var squel=require(_0x9834('0xc'));var crypto=require(_0x9834('0xd'));var jsforce=require(_0x9834('0xe'));var deskjs=require(_0x9834('0xf'));var toCsv=require(_0x9834('0x10'));var querystring=require(_0x9834('0x11'));var Papa=require(_0x9834('0x12'));var Redis=require(_0x9834('0x13'));var authService=require(_0x9834('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x9834('0x15'));var hardwareService=require(_0x9834('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x9834('0x17'));var config=require(_0x9834('0x18'));var licenseUtil=require(_0x9834('0x19'));var db=require(_0x9834('0x1a'))['db'];function respondWithStatusCode(_0x4c8018,_0x48ffd9){_0x48ffd9=_0x48ffd9||0xcc;return function(_0x3447fe){if(_0x3447fe){return _0x4c8018[_0x9834('0x1b')](_0x48ffd9);}return _0x4c8018[_0x9834('0x1c')](_0x48ffd9)[_0x9834('0x1d')]();};}function respondWithResult(_0x3d5dad,_0x91d14b){_0x91d14b=_0x91d14b||0xc8;return function(_0x51db2d){if(_0x51db2d){return _0x3d5dad['status'](_0x91d14b)[_0x9834('0x1e')](_0x51db2d);}};}function respondWithFilteredResult(_0x3448a,_0xd93230){return function(_0x3e1a54){if(_0x3e1a54){var _0x2c8d9f=typeof _0xd93230[_0x9834('0x1f')]==='undefined'&&typeof _0xd93230['limit']===_0x9834('0x20');var _0x182a57=_0x3e1a54[_0x9834('0x21')];var _0x45253d=_0x2c8d9f?0x0:_0xd93230[_0x9834('0x1f')];var _0x50d488=_0x2c8d9f?_0x3e1a54['count']:_0xd93230[_0x9834('0x1f')]+_0xd93230['limit'];var _0x5a29fd;if(_0x50d488>=_0x182a57){_0x50d488=_0x182a57;_0x5a29fd=0xc8;}else{_0x5a29fd=0xce;}_0x3448a['status'](_0x5a29fd);return _0x3448a['set']('Content-Range',_0x45253d+'-'+_0x50d488+'/'+_0x182a57)[_0x9834('0x1e')](_0x3e1a54);}return null;};}function patchUpdates(_0x499c28){return function(_0x21e523){try{jsonpatch[_0x9834('0x22')](_0x21e523,_0x499c28,!![]);}catch(_0x588e6b){return BPromise['reject'](_0x588e6b);}return _0x21e523[_0x9834('0x23')]();};}function saveUpdates(_0x6839a9,_0xb85be4){return function(_0x3444af){if(_0x3444af){return _0x3444af[_0x9834('0x24')](_0x6839a9)[_0x9834('0x25')](function(_0x1c5d23){return _0x1c5d23;});}return null;};}function removeEntity(_0xd9794,_0xe85eed){return function(_0x53da31){if(_0x53da31){return _0x53da31[_0x9834('0x26')]()[_0x9834('0x25')](function(){_0xd9794[_0x9834('0x1c')](0xcc)[_0x9834('0x1d')]();});}};}function handleEntityNotFound(_0x348eea,_0x1d3433){return function(_0x10bcc6){if(!_0x10bcc6){_0x348eea[_0x9834('0x1b')](0x194);}return _0x10bcc6;};}function handleError(_0x397566,_0x31b2e0){_0x31b2e0=_0x31b2e0||0x1f4;return function(_0x1a3e96){logger['error'](_0x1a3e96['stack']);if(_0x1a3e96[_0x9834('0x27')]){delete _0x1a3e96[_0x9834('0x27')];}_0x397566['status'](_0x31b2e0)[_0x9834('0x28')](_0x1a3e96);};}exports[_0x9834('0x29')]=function(_0x48c91a,_0x270d2c){var _0x306684={},_0x3f1958={},_0x1e37f5={'count':0x0,'rows':[]};var _0x2c4174=_[_0x9834('0x2a')](db[_0x9834('0x2b')]['rawAttributes'],function(_0x19aa1c){return{'name':_0x19aa1c[_0x9834('0x2c')],'type':_0x19aa1c['type'][_0x9834('0x2d')]};});_0x3f1958[_0x9834('0x2e')]=_[_0x9834('0x2a')](_0x2c4174,'name');_0x3f1958[_0x9834('0x2f')]=_[_0x9834('0x30')](_0x48c91a[_0x9834('0x2f')]);_0x3f1958['filters']=_[_0x9834('0x31')](_0x3f1958[_0x9834('0x2e')],_0x3f1958[_0x9834('0x2f')]);_0x306684[_0x9834('0x32')]=_[_0x9834('0x31')](_0x3f1958[_0x9834('0x2e')],qs['fields'](_0x48c91a[_0x9834('0x2f')][_0x9834('0x33')]));_0x306684['attributes']=_0x306684[_0x9834('0x32')][_0x9834('0x34')]?_0x306684[_0x9834('0x32')]:_0x3f1958[_0x9834('0x2e')];if(!_0x48c91a[_0x9834('0x2f')][_0x9834('0x35')]('nolimit')){_0x306684[_0x9834('0x36')]=qs[_0x9834('0x36')](_0x48c91a[_0x9834('0x2f')][_0x9834('0x36')]);_0x306684[_0x9834('0x1f')]=qs[_0x9834('0x1f')](_0x48c91a[_0x9834('0x2f')][_0x9834('0x1f')]);}_0x306684['order']=qs[_0x9834('0x37')](_0x48c91a[_0x9834('0x2f')][_0x9834('0x37')]);_0x306684['where']=qs[_0x9834('0x38')](_[_0x9834('0x39')](_0x48c91a[_0x9834('0x2f')],_0x3f1958[_0x9834('0x38')]),_0x2c4174);if(_0x48c91a[_0x9834('0x2f')]['filter']){_0x306684['where']=_[_0x9834('0x3a')](_0x306684[_0x9834('0x3b')],{'$or':_[_0x9834('0x2a')](_0x2c4174,function(_0x2c1bd5){if(_0x2c1bd5[_0x9834('0x3c')]!=='VIRTUAL'){var _0x17e237={};_0x17e237[_0x2c1bd5[_0x9834('0x27')]]={'$like':'%'+_0x48c91a['query'][_0x9834('0x3d')]+'%'};return _0x17e237;}})});}_0x306684=_[_0x9834('0x3a')]({},_0x306684,_0x48c91a['options']);var _0x3b5fd9={'where':_0x306684[_0x9834('0x3b')]};return db[_0x9834('0x2b')][_0x9834('0x21')](_0x3b5fd9)[_0x9834('0x25')](function(_0x252915){_0x1e37f5[_0x9834('0x21')]=_0x252915;if(_0x48c91a[_0x9834('0x2f')][_0x9834('0x3e')]){_0x306684[_0x9834('0x3f')]=[{'all':!![]}];}return db[_0x9834('0x2b')][_0x9834('0x40')](_0x306684);})[_0x9834('0x25')](function(_0xa0f3d9){_0x1e37f5['rows']=_0xa0f3d9;return _0x1e37f5;})[_0x9834('0x25')](respondWithFilteredResult(_0x270d2c,_0x306684))[_0x9834('0x41')](handleError(_0x270d2c,null));};exports[_0x9834('0x42')]=function(_0x1cf46c,_0x1a8fe3){var _0xd47f97={'raw':!![],'where':{'id':_0x1cf46c[_0x9834('0x43')]['id']}},_0x2dae16={};_0x2dae16[_0x9834('0x2e')]=_['keys'](db[_0x9834('0x2b')][_0x9834('0x44')]);_0x2dae16[_0x9834('0x2f')]=_[_0x9834('0x30')](_0x1cf46c['query']);_0x2dae16['filters']=_[_0x9834('0x31')](_0x2dae16['model'],_0x2dae16['query']);_0xd47f97[_0x9834('0x32')]=_[_0x9834('0x31')](_0x2dae16['model'],qs[_0x9834('0x33')](_0x1cf46c[_0x9834('0x2f')][_0x9834('0x33')]));_0xd47f97[_0x9834('0x32')]=_0xd47f97[_0x9834('0x32')][_0x9834('0x34')]?_0xd47f97[_0x9834('0x32')]:_0x2dae16['model'];if(_0x1cf46c[_0x9834('0x2f')][_0x9834('0x3e')]){_0xd47f97[_0x9834('0x3f')]=[{'all':!![]}];}_0xd47f97=_[_0x9834('0x3a')]({},_0xd47f97,_0x1cf46c[_0x9834('0x45')]);return db['FaxTransferReport'][_0x9834('0x46')](_0xd47f97)[_0x9834('0x25')](handleEntityNotFound(_0x1a8fe3,null))['then'](respondWithResult(_0x1a8fe3,null))[_0x9834('0x41')](handleError(_0x1a8fe3,null));};exports[_0x9834('0x47')]=function(_0x15291f,_0x4c9d03){return db[_0x9834('0x2b')][_0x9834('0x47')](_0x15291f[_0x9834('0x48')],{})[_0x9834('0x25')](respondWithResult(_0x4c9d03,0xc9))[_0x9834('0x41')](handleError(_0x4c9d03,null));};exports[_0x9834('0x24')]=function(_0x2c10c0,_0x483c85){if(_0x2c10c0['body']['id']){delete _0x2c10c0[_0x9834('0x48')]['id'];}return db[_0x9834('0x2b')][_0x9834('0x46')]({'where':{'id':_0x2c10c0[_0x9834('0x43')]['id']}})[_0x9834('0x25')](handleEntityNotFound(_0x483c85,null))['then'](saveUpdates(_0x2c10c0['body'],null))[_0x9834('0x25')](respondWithResult(_0x483c85,null))['catch'](handleError(_0x483c85,null));};exports[_0x9834('0x26')]=function(_0x4b3fca,_0x1c0ea3){return db[_0x9834('0x2b')][_0x9834('0x46')]({'where':{'id':_0x4b3fca[_0x9834('0x43')]['id']}})[_0x9834('0x25')](handleEntityNotFound(_0x1c0ea3,null))[_0x9834('0x25')](removeEntity(_0x1c0ea3,null))['catch'](handleError(_0x1c0ea3,null));};exports['describe']=function(_0x4438da,_0x324f27){return db['FaxTransferReport']['describe']()[_0x9834('0x25')](respondWithResult(_0x324f27,null))[_0x9834('0x41')](handleError(_0x324f27,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 7c335d4..ad21a7a 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 _0xaf23=['path','../../config/environment','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','../../config/logger','api','moment','request-promise'];(function(_0x10eb4d,_0x1113ab){var _0x535845=function(_0x5674d5){while(--_0x5674d5){_0x10eb4d['push'](_0x10eb4d['shift']());}};_0x535845(++_0x1113ab);}(_0xaf23,0x11a));var _0x3af2=function(_0x405541,_0x2945cc){_0x405541=_0x405541-0x0;var _0x194a1e=_0xaf23[_0x405541];return _0x194a1e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3af2('0x0'))(_0x3af2('0x1'));var moment=require(_0x3af2('0x2'));var BPromise=require('bluebird');var rp=require(_0x3af2('0x3'));var fs=require('fs');var path=require(_0x3af2('0x4'));var rimraf=require('rimraf');var config=require(_0x3af2('0x5'));var attributes=require('./faxTransferReport.attributes');module[_0x3af2('0x6')]=function(_0x533d17,_0x523e91){return _0x533d17[_0x3af2('0x7')](_0x3af2('0x8'),attributes,{'tableName':_0x3af2('0x9'),'paranoid':![],'indexes':[{'name':_0x3af2('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa0d9=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x5cf543,_0x15a6e0){var _0x4966ab=function(_0x545f19){while(--_0x545f19){_0x5cf543['push'](_0x5cf543['shift']());}};_0x4966ab(++_0x15a6e0);}(_0xa0d9,0x1e0));var _0x9a0d=function(_0x4a93bb,_0x495404){_0x4a93bb=_0x4a93bb-0x0;var _0x208468=_0xa0d9[_0x4a93bb];return _0x208468;};'use strict';var _=require(_0x9a0d('0x0'));var util=require(_0x9a0d('0x1'));var logger=require('../../config/logger')(_0x9a0d('0x2'));var moment=require(_0x9a0d('0x3'));var BPromise=require(_0x9a0d('0x4'));var rp=require(_0x9a0d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a0d('0x6'));var config=require(_0x9a0d('0x7'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x33f151,_0x16c8e9){return _0x33f151[_0x9a0d('0x8')](_0x9a0d('0x9'),attributes,{'tableName':_0x9a0d('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9a0d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 51a9023..34b7b62 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 _0x7f32=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x336dee,_0x2ea81b){var _0x2c38a=function(_0x1e688f){while(--_0x1e688f){_0x336dee['push'](_0x336dee['shift']());}};_0x2c38a(++_0x2ea81b);}(_0x7f32,0xf7));var _0x27f3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7f32[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x27f3('0x0'));var util=require(_0x27f3('0x1'));var moment=require(_0x27f3('0x2'));var BPromise=require(_0x27f3('0x3'));var rs=require(_0x27f3('0x4'));var fs=require('fs');var Redis=require(_0x27f3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x27f3('0x6'));var logger=require(_0x27f3('0x7'))(_0x27f3('0x8'));var config=require('../../config/environment');var jayson=require(_0x27f3('0x9'));var client=jayson['client'][_0x27f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16e1da,_0x5a1bde,_0x44b4cc){return new BPromise(function(_0x4d1de7,_0x700866){return client[_0x27f3('0xb')](_0x16e1da,_0x44b4cc)[_0x27f3('0xc')](function(_0x527fe8){logger[_0x27f3('0xd')](_0x27f3('0xe'),_0x5a1bde,_0x27f3('0xf'));logger[_0x27f3('0x10')](_0x27f3('0x11'),_0x5a1bde,_0x27f3('0xf'),JSON[_0x27f3('0x12')](_0x527fe8));if(_0x527fe8[_0x27f3('0x13')]){if(_0x527fe8[_0x27f3('0x13')][_0x27f3('0x14')]===0x1f4){logger[_0x27f3('0x13')](_0x27f3('0xe'),_0x5a1bde,_0x527fe8['error']['message']);return _0x700866(_0x527fe8[_0x27f3('0x13')][_0x27f3('0x15')]);}logger[_0x27f3('0x13')](_0x27f3('0xe'),_0x5a1bde,_0x527fe8['error'][_0x27f3('0x15')]);return _0x4d1de7(_0x527fe8['error']['message']);}else{logger[_0x27f3('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x5a1bde,_0x27f3('0xf'));_0x4d1de7(_0x527fe8[_0x27f3('0x16')][_0x27f3('0x15')]);}})['catch'](function(_0x255786){logger['error'](_0x27f3('0xe'),_0x5a1bde,_0x255786);_0x700866(_0x255786);});});} \ No newline at end of file +var _0xe25f=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0xeffc63,_0x4acafd){var _0x175db2=function(_0x131a8b){while(--_0x131a8b){_0xeffc63['push'](_0xeffc63['shift']());}};_0x175db2(++_0x4acafd);}(_0xe25f,0x95));var _0xfe25=function(_0x56377a,_0x41d1e2){_0x56377a=_0x56377a-0x0;var _0x5d9b85=_0xe25f[_0x56377a];return _0x5d9b85;};'use strict';var _=require('lodash');var util=require(_0xfe25('0x0'));var moment=require(_0xfe25('0x1'));var BPromise=require('bluebird');var rs=require(_0xfe25('0x2'));var fs=require('fs');var Redis=require(_0xfe25('0x3'));var db=require(_0xfe25('0x4'))['db'];var utils=require(_0xfe25('0x5'));var logger=require(_0xfe25('0x6'))(_0xfe25('0x7'));var config=require(_0xfe25('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfe25('0x9')][_0xfe25('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fa280,_0x5239f5,_0x3158e5){return new BPromise(function(_0x528b63,_0xdba292){return client[_0xfe25('0xb')](_0x3fa280,_0x3158e5)['then'](function(_0x3c31cb){logger['info'](_0xfe25('0xc'),_0x5239f5,_0xfe25('0xd'));logger[_0xfe25('0xe')](_0xfe25('0xf'),_0x5239f5,'request\x20sent',JSON[_0xfe25('0x10')](_0x3c31cb));if(_0x3c31cb['error']){if(_0x3c31cb[_0xfe25('0x11')][_0xfe25('0x12')]===0x1f4){logger[_0xfe25('0x11')](_0xfe25('0xc'),_0x5239f5,_0x3c31cb[_0xfe25('0x11')][_0xfe25('0x13')]);return _0xdba292(_0x3c31cb[_0xfe25('0x11')][_0xfe25('0x13')]);}logger[_0xfe25('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x5239f5,_0x3c31cb[_0xfe25('0x11')]['message']);return _0x528b63(_0x3c31cb['error'][_0xfe25('0x13')]);}else{logger[_0xfe25('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0x5239f5,'request\x20sent');_0x528b63(_0x3c31cb[_0xfe25('0x15')]['message']);}})['catch'](function(_0x22ee7e){logger[_0xfe25('0x11')](_0xfe25('0xc'),_0x5239f5,_0x22ee7e);_0xdba292(_0x22ee7e);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 35ce1fc..37f8e1b 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 _0x0d65=['/describe','isAuthenticated','describe','show','create','put','/:id','delete','exports','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','index','get'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x0d65,0x117));var _0x50d6=function(_0x5a7705,_0x518fb9){_0x5a7705=_0x5a7705-0x0;var _0x5012d2=_0x0d65[_0x5a7705];return _0x5012d2;};'use strict';var multer=require('multer');var util=require(_0x50d6('0x0'));var path=require(_0x50d6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x50d6('0x2')]();var fs_extra=require(_0x50d6('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x50d6('0x4'));var config=require(_0x50d6('0x5'));var controller=require(_0x50d6('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x50d6('0x7')]);router[_0x50d6('0x8')](_0x50d6('0x9'),auth[_0x50d6('0xa')](),controller[_0x50d6('0xb')]);router[_0x50d6('0x8')]('/:id',auth[_0x50d6('0xa')](),controller[_0x50d6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x50d6('0xd')]);router[_0x50d6('0xe')](_0x50d6('0xf'),auth[_0x50d6('0xa')](),controller['update']);router[_0x50d6('0x10')](_0x50d6('0xf'),auth[_0x50d6('0xa')](),controller['destroy']);module[_0x50d6('0x11')]=router; \ No newline at end of file +var _0xf38b=['/describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index'];(function(_0x2721b8,_0x111d60){var _0x52153f=function(_0x8d29a5){while(--_0x8d29a5){_0x2721b8['push'](_0x2721b8['shift']());}};_0x52153f(++_0x111d60);}(_0xf38b,0x8d));var _0xbf38=function(_0x5247f1,_0x16defa){_0x5247f1=_0x5247f1-0x0;var _0x18b6fa=_0xf38b[_0x5247f1];return _0x18b6fa;};'use strict';var multer=require(_0xbf38('0x0'));var util=require(_0xbf38('0x1'));var path=require(_0xbf38('0x2'));var timeout=require(_0xbf38('0x3'));var express=require(_0xbf38('0x4'));var router=express['Router']();var fs_extra=require(_0xbf38('0x5'));var auth=require(_0xbf38('0x6'));var interaction=require(_0xbf38('0x7'));var config=require(_0xbf38('0x8'));var controller=require(_0xbf38('0x9'));router[_0xbf38('0xa')]('/',auth[_0xbf38('0xb')](),controller[_0xbf38('0xc')]);router[_0xbf38('0xa')](_0xbf38('0xd'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xbf38('0xe'),auth[_0xbf38('0xb')](),controller[_0xbf38('0xf')]);router[_0xbf38('0x10')]('/',auth[_0xbf38('0xb')](),controller[_0xbf38('0x11')]);router[_0xbf38('0x12')](_0xbf38('0xe'),auth[_0xbf38('0xb')](),controller['update']);router[_0xbf38('0x13')]('/:id',auth[_0xbf38('0xb')](),controller[_0xbf38('0x14')]);module[_0xbf38('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index b53d6f4..30063a4 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 _0x28d5=['fs-extra','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','put','delete','destroy','exports','path','connect-timeout','express','Router'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x28d5,0x1d0));var _0x528d=function(_0x364048,_0x34dea3){_0x364048=_0x364048-0x0;var _0x591678=_0x28d5[_0x364048];return _0x591678;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x528d('0x0'));var timeout=require(_0x528d('0x1'));var express=require(_0x528d('0x2'));var router=express[_0x528d('0x3')]();var fs_extra=require(_0x528d('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x528d('0x5'));router[_0x528d('0x6')]('/',auth[_0x528d('0x7')](),controller['index']);router[_0x528d('0x6')](_0x528d('0x8'),auth[_0x528d('0x7')](),controller[_0x528d('0x9')]);router[_0x528d('0x6')](_0x528d('0xa'),auth[_0x528d('0x7')](),controller[_0x528d('0xb')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x528d('0xc')]);router[_0x528d('0xd')]('/',auth[_0x528d('0x7')](),controller['create']);router[_0x528d('0xd')](_0x528d('0xa'),auth[_0x528d('0x7')](),controller['addConfiguration']);router[_0x528d('0xe')](_0x528d('0x8'),auth[_0x528d('0x7')](),controller['update']);router[_0x528d('0xf')](_0x528d('0x8'),auth[_0x528d('0x7')](),controller[_0x528d('0x10')]);module[_0x528d('0x11')]=router; \ No newline at end of file +var _0x908a=['isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','put','update','delete','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get'];(function(_0x3ca2f3,_0xc432d4){var _0x2f4880=function(_0x5d744a){while(--_0x5d744a){_0x3ca2f3['push'](_0x3ca2f3['shift']());}};_0x2f4880(++_0xc432d4);}(_0x908a,0x199));var _0xa908=function(_0xd513cb,_0x5d8397){_0xd513cb=_0xd513cb-0x0;var _0x3f2b4c=_0x908a[_0xd513cb];return _0x3f2b4c;};'use strict';var multer=require('multer');var util=require(_0xa908('0x0'));var path=require(_0xa908('0x1'));var timeout=require('connect-timeout');var express=require(_0xa908('0x2'));var router=express[_0xa908('0x3')]();var fs_extra=require(_0xa908('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa908('0x5'));var config=require(_0xa908('0x6'));var controller=require(_0xa908('0x7'));router[_0xa908('0x8')]('/',auth[_0xa908('0x9')](),controller[_0xa908('0xa')]);router['get'](_0xa908('0xb'),auth[_0xa908('0x9')](),controller[_0xa908('0xc')]);router[_0xa908('0x8')](_0xa908('0xd'),auth[_0xa908('0x9')](),controller['getConfigurations']);router[_0xa908('0x8')](_0xa908('0xe'),auth['isAuthenticated'](),controller[_0xa908('0xf')]);router[_0xa908('0x10')]('/',auth[_0xa908('0x9')](),controller[_0xa908('0x11')]);router['post'](_0xa908('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xa908('0x12')](_0xa908('0xb'),auth[_0xa908('0x9')](),controller[_0xa908('0x13')]);router[_0xa908('0x14')](_0xa908('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xa908('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 0414491..ba3967d 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 _0xb2e4=['sequelize','STRING','ENUM','basic','integrationTab'];(function(_0x30c106,_0x4eafa9){var _0xfbcc47=function(_0x3f29f2){while(--_0x3f29f2){_0x30c106['push'](_0x30c106['shift']());}};_0xfbcc47(++_0x4eafa9);}(_0xb2e4,0x87));var _0x4b2e=function(_0x5cc51f,_0x22c480){_0x5cc51f=_0x5cc51f-0x0;var _0x315a2f=_0xb2e4[_0x5cc51f];return _0x315a2f;};'use strict';var Sequelize=require(_0x4b2e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4b2e('0x1')]},'username':{'type':Sequelize[_0x4b2e('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x4b2e('0x2')](_0x4b2e('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x4b2e('0x1')]},'token':{'type':Sequelize[_0x4b2e('0x1')]},'tokenSecret':{'type':Sequelize[_0x4b2e('0x1')]},'serverUrl':{'type':Sequelize[_0x4b2e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x4b2e('0x2')](_0x4b2e('0x4'),'newTab'),'defaultValue':_0x4b2e('0x4')}}; \ No newline at end of file +var _0x61fe=['STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x688b4b,_0x910c5b){var _0x1a2dc1=function(_0x24c444){while(--_0x24c444){_0x688b4b['push'](_0x688b4b['shift']());}};_0x1a2dc1(++_0x910c5b);}(_0x61fe,0x197));var _0xe61f=function(_0x4d465c,_0x1845ae){_0x4d465c=_0x4d465c-0x0;var _0x2c078d=_0x61fe[_0x4d465c];return _0x2c078d;};'use strict';var Sequelize=require(_0xe61f('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe61f('0x1')]},'username':{'type':Sequelize[_0xe61f('0x1')]},'remoteUri':{'type':Sequelize[_0xe61f('0x1')]},'authType':{'type':Sequelize[_0xe61f('0x2')](_0xe61f('0x3')),'defaultValue':_0xe61f('0x3')},'password':{'type':Sequelize[_0xe61f('0x1')]},'consumerKey':{'type':Sequelize[_0xe61f('0x1')]},'consumerSecret':{'type':Sequelize[_0xe61f('0x1')]},'token':{'type':Sequelize[_0xe61f('0x1')]},'tokenSecret':{'type':Sequelize[_0xe61f('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe61f('0x4'),_0xe61f('0x5')),'defaultValue':_0xe61f('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 924d998..8fb959a 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 _0x39f0=['filters','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','DeskConfiguration','pick','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','username','password','consumerKey','token','substring','lastIndexOf','format','application/json','authType','headers','Authorization','%s:%s','toString','base64','concat','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','DeskAccount','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','order','sort'];(function(_0x43962b,_0xf89fbe){var _0x27afb2=function(_0x421be5){while(--_0x421be5){_0x43962b['push'](_0x43962b['shift']());}};_0x27afb2(++_0xf89fbe);}(_0x39f0,0x112));var _0x039f=function(_0x4de85e,_0xc85233){_0x4de85e=_0x4de85e-0x0;var _0x477891=_0x39f0[_0x4de85e];return _0x477891;};'use strict';var emlformat=require(_0x039f('0x0'));var rimraf=require(_0x039f('0x1'));var zipdir=require(_0x039f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x039f('0x3'));var moment=require(_0x039f('0x4'));var BPromise=require(_0x039f('0x5'));var Mustache=require(_0x039f('0x6'));var util=require(_0x039f('0x7'));var path=require('path');var sox=require(_0x039f('0x8'));var csv=require('to-csv');var ejs=require(_0x039f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x039f('0xa'));var crypto=require('crypto');var jsforce=require(_0x039f('0xb'));var deskjs=require(_0x039f('0xc'));var toCsv=require(_0x039f('0xd'));var querystring=require('querystring');var Papa=require(_0x039f('0xe'));var Redis=require(_0x039f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x039f('0x10'));var as=require(_0x039f('0x11'));var hardwareService=require(_0x039f('0x12'));var logger=require(_0x039f('0x13'))(_0x039f('0x14'));var utils=require(_0x039f('0x15'));var config=require(_0x039f('0x16'));var licenseUtil=require(_0x039f('0x17'));var db=require(_0x039f('0x18'))['db'];var integrations=require(_0x039f('0x19'));function respondWithStatusCode(_0x4c41fe,_0x26a32e){_0x26a32e=_0x26a32e||0xcc;return function(_0xf07110){if(_0xf07110){return _0x4c41fe[_0x039f('0x1a')](_0x26a32e);}return _0x4c41fe[_0x039f('0x1b')](_0x26a32e)[_0x039f('0x1c')]();};}function respondWithResult(_0x2d169a,_0x1ec809){_0x1ec809=_0x1ec809||0xc8;return function(_0xfc6293){if(_0xfc6293){return _0x2d169a[_0x039f('0x1b')](_0x1ec809)[_0x039f('0x1d')](_0xfc6293);}};}function respondWithFilteredResult(_0x36dcb5,_0xf0377c){return function(_0xf6877a){if(_0xf6877a){var _0x5dddd4=typeof _0xf0377c[_0x039f('0x1e')]===_0x039f('0x1f')&&typeof _0xf0377c[_0x039f('0x20')]===_0x039f('0x1f');var _0x2178bc=_0xf6877a[_0x039f('0x21')];var _0x591d9b=_0x5dddd4?0x0:_0xf0377c[_0x039f('0x1e')];var _0x286204=_0x5dddd4?_0xf6877a[_0x039f('0x21')]:_0xf0377c[_0x039f('0x1e')]+_0xf0377c[_0x039f('0x20')];var _0x5c2663;if(_0x286204>=_0x2178bc){_0x286204=_0x2178bc;_0x5c2663=0xc8;}else{_0x5c2663=0xce;}_0x36dcb5[_0x039f('0x1b')](_0x5c2663);return _0x36dcb5['set'](_0x039f('0x22'),_0x591d9b+'-'+_0x286204+'/'+_0x2178bc)[_0x039f('0x1d')](_0xf6877a);}return null;};}function patchUpdates(_0x120d5d){return function(_0x55d047){try{jsonpatch[_0x039f('0x23')](_0x55d047,_0x120d5d,!![]);}catch(_0x47c4b5){return BPromise[_0x039f('0x24')](_0x47c4b5);}return _0x55d047[_0x039f('0x25')]();};}function saveUpdates(_0x4bc9e4,_0xe47d6e){return function(_0x593355){if(_0x593355){return _0x593355['update'](_0x4bc9e4)['then'](function(_0x1f8f38){return _0x1f8f38;});}return null;};}function removeEntity(_0x3cd0f1,_0x4b98d9){return function(_0x357f36){if(_0x357f36){return _0x357f36[_0x039f('0x26')]()[_0x039f('0x27')](function(){_0x3cd0f1[_0x039f('0x1b')](0xcc)[_0x039f('0x1c')]();});}};}function handleEntityNotFound(_0x4279da,_0x2d4afa){return function(_0x558190){if(!_0x558190){_0x4279da[_0x039f('0x1a')](0x194);}return _0x558190;};}function handleError(_0x27da77,_0x419381){_0x419381=_0x419381||0x1f4;return function(_0x27c680){logger[_0x039f('0x28')](_0x27c680[_0x039f('0x29')]);if(_0x27c680['name']){delete _0x27c680[_0x039f('0x2a')];}_0x27da77['status'](_0x419381)[_0x039f('0x2b')](_0x27c680);};}exports[_0x039f('0x2c')]=function(_0x2e2836,_0x5ae2e1){var _0x21bbe8={},_0x15d287={},_0x4bf09a={'count':0x0,'rows':[]};var _0xa0258e=_['map'](db[_0x039f('0x2d')][_0x039f('0x2e')],function(_0x77e882){return{'name':_0x77e882[_0x039f('0x2f')],'type':_0x77e882[_0x039f('0x30')]['key']};});_0x15d287[_0x039f('0x31')]=_[_0x039f('0x32')](_0xa0258e,'name');_0x15d287[_0x039f('0x33')]=_[_0x039f('0x34')](_0x2e2836[_0x039f('0x33')]);_0x15d287['filters']=_[_0x039f('0x35')](_0x15d287[_0x039f('0x31')],_0x15d287[_0x039f('0x33')]);_0x21bbe8[_0x039f('0x36')]=_[_0x039f('0x35')](_0x15d287[_0x039f('0x31')],qs[_0x039f('0x37')](_0x2e2836[_0x039f('0x33')][_0x039f('0x37')]));_0x21bbe8[_0x039f('0x36')]=_0x21bbe8[_0x039f('0x36')][_0x039f('0x38')]?_0x21bbe8[_0x039f('0x36')]:_0x15d287[_0x039f('0x31')];if(!_0x2e2836[_0x039f('0x33')]['hasOwnProperty']('nolimit')){_0x21bbe8[_0x039f('0x20')]=qs['limit'](_0x2e2836['query'][_0x039f('0x20')]);_0x21bbe8[_0x039f('0x1e')]=qs[_0x039f('0x1e')](_0x2e2836[_0x039f('0x33')]['offset']);}_0x21bbe8[_0x039f('0x39')]=qs[_0x039f('0x3a')](_0x2e2836[_0x039f('0x33')][_0x039f('0x3a')]);_0x21bbe8['where']=qs[_0x039f('0x3b')](_['pick'](_0x2e2836['query'],_0x15d287[_0x039f('0x3b')]),_0xa0258e);if(_0x2e2836[_0x039f('0x33')]['filter']){_0x21bbe8[_0x039f('0x3c')]=_['merge'](_0x21bbe8['where'],{'$or':_['map'](_0xa0258e,function(_0x56981e){if(_0x56981e[_0x039f('0x30')]!=='VIRTUAL'){var _0x4e4e60={};_0x4e4e60[_0x56981e['name']]={'$like':'%'+_0x2e2836[_0x039f('0x33')][_0x039f('0x3d')]+'%'};return _0x4e4e60;}})});}_0x21bbe8=_[_0x039f('0x3e')]({},_0x21bbe8,_0x2e2836[_0x039f('0x3f')]);var _0x2ed8de={'where':_0x21bbe8[_0x039f('0x3c')]};return db[_0x039f('0x2d')][_0x039f('0x21')](_0x2ed8de)[_0x039f('0x27')](function(_0x259d97){_0x4bf09a['count']=_0x259d97;if(_0x2e2836['query'][_0x039f('0x40')]){_0x21bbe8[_0x039f('0x41')]=[{'all':!![]}];}return db[_0x039f('0x2d')][_0x039f('0x42')](_0x21bbe8);})[_0x039f('0x27')](function(_0x35507d){_0x4bf09a[_0x039f('0x43')]=_0x35507d;return _0x4bf09a;})[_0x039f('0x27')](respondWithFilteredResult(_0x5ae2e1,_0x21bbe8))[_0x039f('0x44')](handleError(_0x5ae2e1,null));};exports[_0x039f('0x45')]=function(_0x33678b,_0x2fddf0){var _0x122e8d={'raw':![],'where':{'id':_0x33678b[_0x039f('0x46')]['id']}},_0x26d0b6={};_0x26d0b6[_0x039f('0x31')]=_[_0x039f('0x34')](db[_0x039f('0x2d')][_0x039f('0x2e')]);_0x26d0b6[_0x039f('0x33')]=_['keys'](_0x33678b[_0x039f('0x33')]);_0x26d0b6[_0x039f('0x3b')]=_[_0x039f('0x35')](_0x26d0b6['model'],_0x26d0b6[_0x039f('0x33')]);_0x122e8d[_0x039f('0x36')]=_[_0x039f('0x35')](_0x26d0b6[_0x039f('0x31')],qs[_0x039f('0x37')](_0x33678b[_0x039f('0x33')][_0x039f('0x37')]));_0x122e8d[_0x039f('0x36')]=_0x122e8d['attributes']['length']?_0x122e8d[_0x039f('0x36')]:_0x26d0b6['model'];if(_0x33678b[_0x039f('0x33')][_0x039f('0x40')]){_0x122e8d['include']=[{'all':!![]}];}_0x122e8d=_[_0x039f('0x3e')]({},_0x122e8d,_0x33678b['options']);return db['DeskAccount'][_0x039f('0x47')](_0x122e8d)['then'](handleEntityNotFound(_0x2fddf0,null))[_0x039f('0x27')](respondWithResult(_0x2fddf0,null))[_0x039f('0x44')](handleError(_0x2fddf0,null));};exports['create']=function(_0x50c535,_0x334310){return db['DeskAccount'][_0x039f('0x48')](_0x50c535[_0x039f('0x49')],{})[_0x039f('0x27')](respondWithResult(_0x334310,0xc9))[_0x039f('0x44')](handleError(_0x334310,null));};exports['update']=function(_0x263142,_0x190428){if(_0x263142[_0x039f('0x49')]['id']){delete _0x263142[_0x039f('0x49')]['id'];}return db[_0x039f('0x2d')][_0x039f('0x47')]({'where':{'id':_0x263142[_0x039f('0x46')]['id']}})[_0x039f('0x27')](handleEntityNotFound(_0x190428,null))[_0x039f('0x27')](saveUpdates(_0x263142[_0x039f('0x49')],null))['then'](respondWithResult(_0x190428,null))[_0x039f('0x44')](handleError(_0x190428,null));};exports[_0x039f('0x26')]=function(_0x4a0d75,_0x8727be){return db[_0x039f('0x2d')][_0x039f('0x47')]({'where':{'id':_0x4a0d75[_0x039f('0x46')]['id']}})[_0x039f('0x27')](handleEntityNotFound(_0x8727be,null))[_0x039f('0x27')](removeEntity(_0x8727be,null))[_0x039f('0x44')](handleError(_0x8727be,null));};exports[_0x039f('0x4a')]=function(_0x499130,_0x87c6f1,_0x503d98){var _0x2119cf={};var _0x317506={};var _0x1246da;var _0x12f87e;return db[_0x039f('0x2d')]['findOne']({'where':{'id':_0x499130['params']['id']}})[_0x039f('0x27')](handleEntityNotFound(_0x87c6f1,null))[_0x039f('0x27')](function(_0x42cad7){if(_0x42cad7){_0x1246da=_0x42cad7;_0x317506[_0x039f('0x31')]=_[_0x039f('0x34')](db[_0x039f('0x4b')]['rawAttributes']);_0x317506[_0x039f('0x33')]=_['keys'](_0x499130[_0x039f('0x33')]);_0x317506[_0x039f('0x3b')]=_[_0x039f('0x35')](_0x317506[_0x039f('0x31')],_0x317506[_0x039f('0x33')]);_0x2119cf[_0x039f('0x36')]=_['intersection'](_0x317506[_0x039f('0x31')],qs['fields'](_0x499130[_0x039f('0x33')][_0x039f('0x37')]));_0x2119cf[_0x039f('0x36')]=_0x2119cf[_0x039f('0x36')][_0x039f('0x38')]?_0x2119cf[_0x039f('0x36')]:_0x317506[_0x039f('0x31')];_0x2119cf[_0x039f('0x39')]=qs[_0x039f('0x3a')](_0x499130['query'][_0x039f('0x3a')]);_0x2119cf[_0x039f('0x3c')]=qs['filters'](_[_0x039f('0x4c')](_0x499130[_0x039f('0x33')],_0x317506[_0x039f('0x3b')]));if(_0x499130['query'][_0x039f('0x3d')]){_0x2119cf[_0x039f('0x3c')]=_[_0x039f('0x3e')](_0x2119cf['where'],{'$or':_[_0x039f('0x32')](_0x2119cf[_0x039f('0x36')],function(_0xad677a){var _0x11e2f7={};_0x11e2f7[_0xad677a]={'$like':'%'+_0x499130['query'][_0x039f('0x3d')]+'%'};return _0x11e2f7;})});}_0x2119cf=_['merge']({},_0x2119cf,_0x499130[_0x039f('0x3f')]);return _0x1246da[_0x039f('0x4a')](_0x2119cf);}})[_0x039f('0x27')](function(_0x2cb07b){if(_0x2cb07b){_0x12f87e=_0x2cb07b['length'];if(!_0x499130[_0x039f('0x33')]['hasOwnProperty']('nolimit')){_0x2119cf[_0x039f('0x20')]=qs[_0x039f('0x20')](_0x499130[_0x039f('0x33')][_0x039f('0x20')]);_0x2119cf[_0x039f('0x1e')]=qs['offset'](_0x499130[_0x039f('0x33')][_0x039f('0x1e')]);}return _0x1246da[_0x039f('0x4a')](_0x2119cf);}})[_0x039f('0x27')](function(_0x6346ce){if(_0x6346ce){return _0x6346ce?{'count':_0x12f87e,'rows':_0x6346ce}:null;}})[_0x039f('0x27')](respondWithResult(_0x87c6f1,null))['catch'](handleError(_0x87c6f1,null));};exports[_0x039f('0x4d')]=function(_0x5dbaa4,_0x570f1f,_0x2ef78f){if(_0x5dbaa4[_0x039f('0x49')]['id']){delete _0x5dbaa4[_0x039f('0x49')]['id'];}return db[_0x039f('0x2d')][_0x039f('0x4e')]({'where':{'id':_0x5dbaa4[_0x039f('0x46')]['id']}})[_0x039f('0x27')](handleEntityNotFound(_0x570f1f,null))[_0x039f('0x27')](function(_0x300ab6){if(_0x300ab6){_0x5dbaa4[_0x039f('0x49')][_0x039f('0x4f')]=_0x300ab6['id'];_0x5dbaa4['body'][_0x039f('0x50')]=integrations['getSubjects'](_0x5dbaa4['body'][_0x039f('0x51')],_0x5dbaa4[_0x039f('0x49')][_0x039f('0x30')]);_0x5dbaa4[_0x039f('0x49')][_0x039f('0x52')]=integrations[_0x039f('0x53')](_0x5dbaa4['body']['channel'],_0x5dbaa4[_0x039f('0x49')][_0x039f('0x30')]);return db[_0x039f('0x4b')]['create'](_0x5dbaa4[_0x039f('0x49')],{'include':[{'model':db['DeskField'],'as':_0x039f('0x50')},{'model':db[_0x039f('0x54')],'as':_0x039f('0x52')}]});}return null;})[_0x039f('0x27')](respondWithResult(_0x570f1f,null))[_0x039f('0x44')](handleError(_0x570f1f,null));};exports[_0x039f('0x55')]=function(_0x19becf,_0x339cfd,_0x496fbf){var _0x6e0356=[{'name':_0x039f('0x56'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x13e1a5='';return db['DeskAccount'][_0x039f('0x4e')]({'where':{'id':_0x19becf['params']['id']},'attributes':['id',_0x039f('0x57'),'authType',_0x039f('0x58'),_0x039f('0x59'),_0x039f('0x5a'),'consumerSecret',_0x039f('0x5b'),'tokenSecret']})[_0x039f('0x27')](handleEntityNotFound(_0x339cfd,null))[_0x039f('0x27')](function(_0x323a3e){if(_0x323a3e){_0x13e1a5=_0x323a3e[_0x039f('0x57')];var _0x777c53=_0x13e1a5['slice'](-0x1);if(_0x777c53==='/'){_0x13e1a5=_0x13e1a5[_0x039f('0x5c')](0x0,_0x13e1a5[_0x039f('0x5d')](_0x777c53));}var _0x38ee4f={'method':'GET','uri':util[_0x039f('0x5e')]('%s/custom_fields',_0x13e1a5),'headers':{'Content-Type':_0x039f('0x5f'),'Accept':_0x039f('0x5f')},'json':!![]};if(_0x323a3e[_0x039f('0x60')]==='basic'){_0x38ee4f[_0x039f('0x61')][_0x039f('0x62')]=util[_0x039f('0x5e')]('Basic\x20%s',new Buffer(util['format'](_0x039f('0x63'),_0x323a3e[_0x039f('0x58')],_0x323a3e[_0x039f('0x59')]))[_0x039f('0x64')](_0x039f('0x65')));}return rp(_0x38ee4f)[_0x039f('0x27')](function(_0x3afa04){return _0x6e0356[_0x039f('0x66')](_[_0x039f('0x32')](_0x3afa04['_embedded'][_0x039f('0x67')],function(_0x4f557b){return{'id':_0x4f557b['name'],'name':_0x4f557b[_0x039f('0x2a')],'type':_0x4f557b[_0x039f('0x30')],'active':_0x4f557b[_0x039f('0x68')],'label':_0x4f557b[_0x039f('0x69')],'custom':!![]};}));});}})[_0x039f('0x27')](function(_0x4e0484){return{'count':_0x4e0484[_0x039f('0x38')],'rows':_0x4e0484};})[_0x039f('0x27')](respondWithResult(_0x339cfd,null))['catch'](function(_0x174077){var _0x239e18=_0x19becf[_0x039f('0x33')][_0x039f('0x6a')]?0x1f4:_0x174077[_0x039f('0x6b')]||0x1f4;logger[_0x039f('0x28')](_0x039f('0x6c'),_0x039f('0x55'),_0x239e18,JSON[_0x039f('0x6d')](_0x174077));delete _0x174077[_0x039f('0x2a')];if(_0x239e18===0x191){_0x239e18=0x190;}_0x339cfd[_0x039f('0x1b')](_0x239e18)[_0x039f('0x2b')](_0x19becf[_0x039f('0x33')][_0x039f('0x6a')]?{'message':_0x039f('0x6e'),'statusCode':_0x174077[_0x039f('0x6b')]}:_0x174077);});}; \ No newline at end of file +var _0xa1dd=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','DeskAccount','include','rows','catch','show','params','includeAll','find','create','update','body','findOne','DeskConfiguration','sort','getConfigurations','AccountId','channel','Descriptions','getDescriptions','DeskField','Subjects','priority','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','substring','%s/custom_fields','application/json','basic','Authorization','%s:%s','base64','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x1058ed,_0x109d8d){var _0x4e4661=function(_0x2fc1df){while(--_0x2fc1df){_0x1058ed['push'](_0x1058ed['shift']());}};_0x4e4661(++_0x109d8d);}(_0xa1dd,0x13c));var _0xda1d=function(_0x275e57,_0x3215e1){_0x275e57=_0x275e57-0x0;var _0x1bba4c=_0xa1dd[_0x275e57];return _0x1bba4c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda1d('0x0'));var zipdir=require(_0xda1d('0x1'));var jsonpatch=require(_0xda1d('0x2'));var rp=require(_0xda1d('0x3'));var moment=require(_0xda1d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xda1d('0x5'));var util=require(_0xda1d('0x6'));var path=require(_0xda1d('0x7'));var sox=require(_0xda1d('0x8'));var csv=require('to-csv');var ejs=require(_0xda1d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xda1d('0xa'));var crypto=require(_0xda1d('0xb'));var jsforce=require(_0xda1d('0xc'));var deskjs=require(_0xda1d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xda1d('0xe'));var Papa=require(_0xda1d('0xf'));var Redis=require(_0xda1d('0x10'));var authService=require(_0xda1d('0x11'));var qs=require(_0xda1d('0x12'));var as=require(_0xda1d('0x13'));var hardwareService=require(_0xda1d('0x14'));var logger=require(_0xda1d('0x15'))('api');var utils=require(_0xda1d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xda1d('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x53c84f,_0x32db5f){_0x32db5f=_0x32db5f||0xcc;return function(_0x2990ea){if(_0x2990ea){return _0x53c84f['sendStatus'](_0x32db5f);}return _0x53c84f[_0xda1d('0x18')](_0x32db5f)[_0xda1d('0x19')]();};}function respondWithResult(_0x1fc705,_0x4f212a){_0x4f212a=_0x4f212a||0xc8;return function(_0x3e7f3e){if(_0x3e7f3e){return _0x1fc705[_0xda1d('0x18')](_0x4f212a)['json'](_0x3e7f3e);}};}function respondWithFilteredResult(_0x57796e,_0x4af39b){return function(_0x4d1b07){if(_0x4d1b07){var _0x56d872=typeof _0x4af39b[_0xda1d('0x1a')]===_0xda1d('0x1b')&&typeof _0x4af39b[_0xda1d('0x1c')]===_0xda1d('0x1b');var _0x315432=_0x4d1b07[_0xda1d('0x1d')];var _0x2794bc=_0x56d872?0x0:_0x4af39b[_0xda1d('0x1a')];var _0x5a2d86=_0x56d872?_0x4d1b07['count']:_0x4af39b[_0xda1d('0x1a')]+_0x4af39b[_0xda1d('0x1c')];var _0xf42db3;if(_0x5a2d86>=_0x315432){_0x5a2d86=_0x315432;_0xf42db3=0xc8;}else{_0xf42db3=0xce;}_0x57796e[_0xda1d('0x18')](_0xf42db3);return _0x57796e['set'](_0xda1d('0x1e'),_0x2794bc+'-'+_0x5a2d86+'/'+_0x315432)[_0xda1d('0x1f')](_0x4d1b07);}return null;};}function patchUpdates(_0x554399){return function(_0x3c244f){try{jsonpatch[_0xda1d('0x20')](_0x3c244f,_0x554399,!![]);}catch(_0x1c852c){return BPromise[_0xda1d('0x21')](_0x1c852c);}return _0x3c244f['save']();};}function saveUpdates(_0x15a55c,_0x2c0bbd){return function(_0x76d343){if(_0x76d343){return _0x76d343['update'](_0x15a55c)['then'](function(_0x4f5296){return _0x4f5296;});}return null;};}function removeEntity(_0xfcf5ae,_0x59c4ef){return function(_0x5acf5c){if(_0x5acf5c){return _0x5acf5c[_0xda1d('0x22')]()[_0xda1d('0x23')](function(){_0xfcf5ae[_0xda1d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c57a9,_0x3fef13){return function(_0x152f86){if(!_0x152f86){_0x2c57a9[_0xda1d('0x24')](0x194);}return _0x152f86;};}function handleError(_0x43ecfb,_0x321538){_0x321538=_0x321538||0x1f4;return function(_0x48d411){logger[_0xda1d('0x25')](_0x48d411[_0xda1d('0x26')]);if(_0x48d411[_0xda1d('0x27')]){delete _0x48d411[_0xda1d('0x27')];}_0x43ecfb[_0xda1d('0x18')](_0x321538)[_0xda1d('0x28')](_0x48d411);};}exports[_0xda1d('0x29')]=function(_0x308bce,_0x5e3b43){var _0x21aa11={},_0x238127={},_0x372c15={'count':0x0,'rows':[]};var _0x4b9e6e=_[_0xda1d('0x2a')](db['DeskAccount'][_0xda1d('0x2b')],function(_0x430af3){return{'name':_0x430af3[_0xda1d('0x2c')],'type':_0x430af3[_0xda1d('0x2d')]['key']};});_0x238127[_0xda1d('0x2e')]=_[_0xda1d('0x2a')](_0x4b9e6e,_0xda1d('0x27'));_0x238127['query']=_[_0xda1d('0x2f')](_0x308bce[_0xda1d('0x30')]);_0x238127[_0xda1d('0x31')]=_[_0xda1d('0x32')](_0x238127[_0xda1d('0x2e')],_0x238127[_0xda1d('0x30')]);_0x21aa11[_0xda1d('0x33')]=_[_0xda1d('0x32')](_0x238127['model'],qs[_0xda1d('0x34')](_0x308bce[_0xda1d('0x30')]['fields']));_0x21aa11[_0xda1d('0x33')]=_0x21aa11[_0xda1d('0x33')][_0xda1d('0x35')]?_0x21aa11['attributes']:_0x238127[_0xda1d('0x2e')];if(!_0x308bce[_0xda1d('0x30')][_0xda1d('0x36')](_0xda1d('0x37'))){_0x21aa11['limit']=qs[_0xda1d('0x1c')](_0x308bce['query'][_0xda1d('0x1c')]);_0x21aa11[_0xda1d('0x1a')]=qs[_0xda1d('0x1a')](_0x308bce[_0xda1d('0x30')]['offset']);}_0x21aa11[_0xda1d('0x38')]=qs['sort'](_0x308bce[_0xda1d('0x30')]['sort']);_0x21aa11[_0xda1d('0x39')]=qs[_0xda1d('0x31')](_[_0xda1d('0x3a')](_0x308bce[_0xda1d('0x30')],_0x238127['filters']),_0x4b9e6e);if(_0x308bce[_0xda1d('0x30')][_0xda1d('0x3b')]){_0x21aa11[_0xda1d('0x39')]=_['merge'](_0x21aa11[_0xda1d('0x39')],{'$or':_[_0xda1d('0x2a')](_0x4b9e6e,function(_0x1ad8b3){if(_0x1ad8b3[_0xda1d('0x2d')]!==_0xda1d('0x3c')){var _0x385ed1={};_0x385ed1[_0x1ad8b3[_0xda1d('0x27')]]={'$like':'%'+_0x308bce[_0xda1d('0x30')]['filter']+'%'};return _0x385ed1;}})});}_0x21aa11=_[_0xda1d('0x3d')]({},_0x21aa11,_0x308bce[_0xda1d('0x3e')]);var _0x541aa9={'where':_0x21aa11[_0xda1d('0x39')]};return db[_0xda1d('0x3f')][_0xda1d('0x1d')](_0x541aa9)[_0xda1d('0x23')](function(_0x568c14){_0x372c15['count']=_0x568c14;if(_0x308bce[_0xda1d('0x30')]['includeAll']){_0x21aa11[_0xda1d('0x40')]=[{'all':!![]}];}return db[_0xda1d('0x3f')]['findAll'](_0x21aa11);})[_0xda1d('0x23')](function(_0x3b651d){_0x372c15[_0xda1d('0x41')]=_0x3b651d;return _0x372c15;})[_0xda1d('0x23')](respondWithFilteredResult(_0x5e3b43,_0x21aa11))[_0xda1d('0x42')](handleError(_0x5e3b43,null));};exports[_0xda1d('0x43')]=function(_0x49663f,_0x3a2241){var _0x19b8c4={'raw':![],'where':{'id':_0x49663f[_0xda1d('0x44')]['id']}},_0x593d7f={};_0x593d7f[_0xda1d('0x2e')]=_['keys'](db['DeskAccount'][_0xda1d('0x2b')]);_0x593d7f[_0xda1d('0x30')]=_['keys'](_0x49663f['query']);_0x593d7f[_0xda1d('0x31')]=_[_0xda1d('0x32')](_0x593d7f[_0xda1d('0x2e')],_0x593d7f[_0xda1d('0x30')]);_0x19b8c4[_0xda1d('0x33')]=_['intersection'](_0x593d7f[_0xda1d('0x2e')],qs['fields'](_0x49663f[_0xda1d('0x30')][_0xda1d('0x34')]));_0x19b8c4[_0xda1d('0x33')]=_0x19b8c4['attributes'][_0xda1d('0x35')]?_0x19b8c4[_0xda1d('0x33')]:_0x593d7f['model'];if(_0x49663f[_0xda1d('0x30')][_0xda1d('0x45')]){_0x19b8c4['include']=[{'all':!![]}];}_0x19b8c4=_[_0xda1d('0x3d')]({},_0x19b8c4,_0x49663f[_0xda1d('0x3e')]);return db[_0xda1d('0x3f')][_0xda1d('0x46')](_0x19b8c4)['then'](handleEntityNotFound(_0x3a2241,null))['then'](respondWithResult(_0x3a2241,null))[_0xda1d('0x42')](handleError(_0x3a2241,null));};exports[_0xda1d('0x47')]=function(_0x139d90,_0xe400f7){return db[_0xda1d('0x3f')][_0xda1d('0x47')](_0x139d90['body'],{})[_0xda1d('0x23')](respondWithResult(_0xe400f7,0xc9))[_0xda1d('0x42')](handleError(_0xe400f7,null));};exports[_0xda1d('0x48')]=function(_0x2d316c,_0x3d0305){if(_0x2d316c[_0xda1d('0x49')]['id']){delete _0x2d316c['body']['id'];}return db[_0xda1d('0x3f')][_0xda1d('0x46')]({'where':{'id':_0x2d316c[_0xda1d('0x44')]['id']}})[_0xda1d('0x23')](handleEntityNotFound(_0x3d0305,null))['then'](saveUpdates(_0x2d316c[_0xda1d('0x49')],null))[_0xda1d('0x23')](respondWithResult(_0x3d0305,null))[_0xda1d('0x42')](handleError(_0x3d0305,null));};exports[_0xda1d('0x22')]=function(_0x2da43,_0x4c02c3){return db[_0xda1d('0x3f')][_0xda1d('0x46')]({'where':{'id':_0x2da43[_0xda1d('0x44')]['id']}})['then'](handleEntityNotFound(_0x4c02c3,null))['then'](removeEntity(_0x4c02c3,null))['catch'](handleError(_0x4c02c3,null));};exports['getConfigurations']=function(_0x1aac6b,_0x54fdd3,_0x41495a){var _0x3ba291={};var _0x47be96={};var _0x2fabdc;var _0x3d5df4;return db['DeskAccount'][_0xda1d('0x4a')]({'where':{'id':_0x1aac6b[_0xda1d('0x44')]['id']}})[_0xda1d('0x23')](handleEntityNotFound(_0x54fdd3,null))[_0xda1d('0x23')](function(_0x1adc31){if(_0x1adc31){_0x2fabdc=_0x1adc31;_0x47be96[_0xda1d('0x2e')]=_[_0xda1d('0x2f')](db[_0xda1d('0x4b')][_0xda1d('0x2b')]);_0x47be96['query']=_[_0xda1d('0x2f')](_0x1aac6b[_0xda1d('0x30')]);_0x47be96[_0xda1d('0x31')]=_[_0xda1d('0x32')](_0x47be96[_0xda1d('0x2e')],_0x47be96[_0xda1d('0x30')]);_0x3ba291['attributes']=_['intersection'](_0x47be96[_0xda1d('0x2e')],qs[_0xda1d('0x34')](_0x1aac6b[_0xda1d('0x30')][_0xda1d('0x34')]));_0x3ba291[_0xda1d('0x33')]=_0x3ba291[_0xda1d('0x33')][_0xda1d('0x35')]?_0x3ba291['attributes']:_0x47be96['model'];_0x3ba291[_0xda1d('0x38')]=qs[_0xda1d('0x4c')](_0x1aac6b['query'][_0xda1d('0x4c')]);_0x3ba291['where']=qs[_0xda1d('0x31')](_['pick'](_0x1aac6b[_0xda1d('0x30')],_0x47be96[_0xda1d('0x31')]));if(_0x1aac6b['query'][_0xda1d('0x3b')]){_0x3ba291['where']=_[_0xda1d('0x3d')](_0x3ba291[_0xda1d('0x39')],{'$or':_[_0xda1d('0x2a')](_0x3ba291[_0xda1d('0x33')],function(_0x1dd5b8){var _0x29b7ea={};_0x29b7ea[_0x1dd5b8]={'$like':'%'+_0x1aac6b[_0xda1d('0x30')][_0xda1d('0x3b')]+'%'};return _0x29b7ea;})});}_0x3ba291=_[_0xda1d('0x3d')]({},_0x3ba291,_0x1aac6b[_0xda1d('0x3e')]);return _0x2fabdc['getConfigurations'](_0x3ba291);}})['then'](function(_0x4dba89){if(_0x4dba89){_0x3d5df4=_0x4dba89[_0xda1d('0x35')];if(!_0x1aac6b[_0xda1d('0x30')][_0xda1d('0x36')](_0xda1d('0x37'))){_0x3ba291[_0xda1d('0x1c')]=qs[_0xda1d('0x1c')](_0x1aac6b[_0xda1d('0x30')][_0xda1d('0x1c')]);_0x3ba291[_0xda1d('0x1a')]=qs['offset'](_0x1aac6b['query'][_0xda1d('0x1a')]);}return _0x2fabdc[_0xda1d('0x4d')](_0x3ba291);}})[_0xda1d('0x23')](function(_0x45ceef){if(_0x45ceef){return _0x45ceef?{'count':_0x3d5df4,'rows':_0x45ceef}:null;}})[_0xda1d('0x23')](respondWithResult(_0x54fdd3,null))[_0xda1d('0x42')](handleError(_0x54fdd3,null));};exports['addConfiguration']=function(_0x992db6,_0xfcbf3d,_0x3a3091){if(_0x992db6['body']['id']){delete _0x992db6[_0xda1d('0x49')]['id'];}return db['DeskAccount'][_0xda1d('0x4a')]({'where':{'id':_0x992db6[_0xda1d('0x44')]['id']}})['then'](handleEntityNotFound(_0xfcbf3d,null))[_0xda1d('0x23')](function(_0x209da1){if(_0x209da1){_0x992db6[_0xda1d('0x49')][_0xda1d('0x4e')]=_0x209da1['id'];_0x992db6[_0xda1d('0x49')]['Subjects']=integrations['getSubjects'](_0x992db6[_0xda1d('0x49')][_0xda1d('0x4f')],_0x992db6[_0xda1d('0x49')][_0xda1d('0x2d')]);_0x992db6[_0xda1d('0x49')][_0xda1d('0x50')]=integrations[_0xda1d('0x51')](_0x992db6[_0xda1d('0x49')][_0xda1d('0x4f')],_0x992db6['body']['type']);return db[_0xda1d('0x4b')]['create'](_0x992db6[_0xda1d('0x49')],{'include':[{'model':db[_0xda1d('0x52')],'as':_0xda1d('0x53')},{'model':db[_0xda1d('0x52')],'as':'Descriptions'}]});}return null;})[_0xda1d('0x23')](respondWithResult(_0xfcbf3d,null))['catch'](handleError(_0xfcbf3d,null));};exports['getFields']=function(_0x52cdf3,_0x3e53fc,_0x77ce63){var _0x5b798d=[{'name':_0xda1d('0x54'),'label':_0xda1d('0x54'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x1c5917='';return db[_0xda1d('0x3f')][_0xda1d('0x4a')]({'where':{'id':_0x52cdf3['params']['id']},'attributes':['id','remoteUri',_0xda1d('0x55'),_0xda1d('0x56'),_0xda1d('0x57'),_0xda1d('0x58'),_0xda1d('0x59'),_0xda1d('0x5a'),_0xda1d('0x5b')]})[_0xda1d('0x23')](handleEntityNotFound(_0x3e53fc,null))[_0xda1d('0x23')](function(_0xbba0aa){if(_0xbba0aa){_0x1c5917=_0xbba0aa[_0xda1d('0x5c')];var _0x2cb717=_0x1c5917[_0xda1d('0x5d')](-0x1);if(_0x2cb717==='/'){_0x1c5917=_0x1c5917[_0xda1d('0x5e')](0x0,_0x1c5917['lastIndexOf'](_0x2cb717));}var _0x4899b8={'method':'GET','uri':util['format'](_0xda1d('0x5f'),_0x1c5917),'headers':{'Content-Type':_0xda1d('0x60'),'Accept':'application/json'},'json':!![]};if(_0xbba0aa['authType']===_0xda1d('0x61')){_0x4899b8['headers'][_0xda1d('0x62')]=util['format']('Basic\x20%s',new Buffer(util['format'](_0xda1d('0x63'),_0xbba0aa[_0xda1d('0x56')],_0xbba0aa[_0xda1d('0x57')]))['toString'](_0xda1d('0x64')));}return rp(_0x4899b8)[_0xda1d('0x23')](function(_0x50ad09){return _0x5b798d['concat'](_[_0xda1d('0x2a')](_0x50ad09[_0xda1d('0x65')][_0xda1d('0x66')],function(_0x1c382a){return{'id':_0x1c382a[_0xda1d('0x27')],'name':_0x1c382a[_0xda1d('0x27')],'type':_0x1c382a['type'],'active':_0x1c382a[_0xda1d('0x67')],'label':_0x1c382a[_0xda1d('0x68')],'custom':!![]};}));});}})[_0xda1d('0x23')](function(_0x41efec){return{'count':_0x41efec['length'],'rows':_0x41efec};})['then'](respondWithResult(_0x3e53fc,null))[_0xda1d('0x42')](function(_0x1a844e){var _0x1268ab=_0x52cdf3['query']['test']?0x1f4:_0x1a844e[_0xda1d('0x69')]||0x1f4;logger[_0xda1d('0x25')](_0xda1d('0x6a'),_0xda1d('0x6b'),_0x1268ab,JSON[_0xda1d('0x6c')](_0x1a844e));delete _0x1a844e[_0xda1d('0x27')];if(_0x1268ab===0x191){_0x1268ab=0x190;}_0x3e53fc[_0xda1d('0x18')](_0x1268ab)[_0xda1d('0x28')](_0x52cdf3[_0xda1d('0x30')][_0xda1d('0x6d')]?{'message':_0xda1d('0x6e'),'statusCode':_0x1a844e[_0xda1d('0x69')]}:_0x1a844e);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 3514165..ef17b03 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 _0xccef=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','define','DeskAccount'];(function(_0x222765,_0x39c998){var _0x4610ef=function(_0x3d9505){while(--_0x3d9505){_0x222765['push'](_0x222765['shift']());}};_0x4610ef(++_0x39c998);}(_0xccef,0x13f));var _0xfcce=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xccef[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xfcce('0x0'));var util=require(_0xfcce('0x1'));var logger=require('../../config/logger')(_0xfcce('0x2'));var moment=require(_0xfcce('0x3'));var BPromise=require(_0xfcce('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcce('0x5'));var rimraf=require(_0xfcce('0x6'));var config=require(_0xfcce('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xfcce('0x8'));module['exports']=function(_0x2fb0d8,_0x246a52){return _0x2fb0d8[_0xfcce('0x9')](_0xfcce('0xa'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbd8=['lodash','util','moment','bluebird','request-promise','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','DeskAccount','int_desk_accounts'];(function(_0x47c958,_0x3cfe09){var _0x573eab=function(_0x380ec6){while(--_0x380ec6){_0x47c958['push'](_0x47c958['shift']());}};_0x573eab(++_0x3cfe09);}(_0xcbd8,0x17c));var _0x8cbd=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xcbd8[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x8cbd('0x0'));var util=require(_0x8cbd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8cbd('0x2'));var BPromise=require(_0x8cbd('0x3'));var rp=require(_0x8cbd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8cbd('0x5'));var attributes=require(_0x8cbd('0x6'));var integrations=require(_0x8cbd('0x7'));module['exports']=function(_0x4bf34a,_0x1cff67){return _0x4bf34a['define'](_0x8cbd('0x8'),attributes,{'tableName':_0x8cbd('0x9'),'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 d124958..7dcce4f 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 _0x9973=['result','catch','GetDeskAccount','DeskAccount','raw','options','where','attributes','limit','include','map','model','find','ShowDeskAccount','util','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','request','then','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x9973,0xfe));var _0x3997=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9973[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0x3997('0x0'));var moment=require('moment');var BPromise=require(_0x3997('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3997('0x2'))['db'];var utils=require(_0x3997('0x3'));var logger=require('../../config/logger')(_0x3997('0x4'));var config=require('../../config/environment');var jayson=require(_0x3997('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4752d2,_0x50ec65,_0x51b8f6){return new BPromise(function(_0x2d72a2,_0x568c2a){return client[_0x3997('0x6')](_0x4752d2,_0x51b8f6)[_0x3997('0x7')](function(_0x1d3146){logger['info'](_0x3997('0x8'),_0x50ec65,'request\x20sent');logger[_0x3997('0x9')](_0x3997('0xa'),_0x50ec65,_0x3997('0xb'),JSON[_0x3997('0xc')](_0x1d3146));if(_0x1d3146[_0x3997('0xd')]){if(_0x1d3146['error']['code']===0x1f4){logger['error'](_0x3997('0x8'),_0x50ec65,_0x1d3146['error'][_0x3997('0xe')]);return _0x568c2a(_0x1d3146['error']['message']);}logger[_0x3997('0xd')]('DeskAccount,\x20%s,\x20%s',_0x50ec65,_0x1d3146[_0x3997('0xd')][_0x3997('0xe')]);return _0x2d72a2(_0x1d3146['error'][_0x3997('0xe')]);}else{logger[_0x3997('0xf')]('DeskAccount,\x20%s,\x20%s',_0x50ec65,_0x3997('0xb'));_0x2d72a2(_0x1d3146[_0x3997('0x10')][_0x3997('0xe')]);}})[_0x3997('0x11')](function(_0x29da98){logger['error'](_0x3997('0x8'),_0x50ec65,_0x29da98);_0x568c2a(_0x29da98);});});}exports[_0x3997('0x12')]=function(_0x679b){var _0x209e16=this;return new Promise(function(_0x420fbc,_0xad2deb){return db[_0x3997('0x13')]['findAll']({'raw':_0x679b['options']?_0x679b['options'][_0x3997('0x14')]===undefined?!![]:![]:!![],'where':_0x679b[_0x3997('0x15')]?_0x679b[_0x3997('0x15')][_0x3997('0x16')]||null:null,'attributes':_0x679b['options']?_0x679b['options'][_0x3997('0x17')]||null:null,'limit':_0x679b[_0x3997('0x15')]?_0x679b[_0x3997('0x15')][_0x3997('0x18')]||null:null,'include':_0x679b[_0x3997('0x15')]?_0x679b[_0x3997('0x15')][_0x3997('0x19')]?_[_0x3997('0x1a')](_0x679b[_0x3997('0x15')][_0x3997('0x19')],function(_0x3ec8ec){return{'model':db[_0x3ec8ec[_0x3997('0x1b')]],'as':_0x3ec8ec['as'],'attributes':_0x3ec8ec['attributes'],'include':_0x3ec8ec[_0x3997('0x19')]?_['map'](_0x3ec8ec[_0x3997('0x19')],function(_0x292934){return{'model':db[_0x292934[_0x3997('0x1b')]],'as':_0x292934['as'],'attributes':_0x292934[_0x3997('0x17')],'include':_0x292934['include']?_[_0x3997('0x1a')](_0x292934[_0x3997('0x19')],function(_0x9f292d){return{'model':db[_0x9f292d[_0x3997('0x1b')]],'as':_0x9f292d['as'],'attributes':_0x9f292d['attributes']};}):[]};}):[]};}):[]:[]})[_0x3997('0x7')](function(_0x45eeac){logger['info'](_0x3997('0x12'),_0x679b);logger['debug']('GetDeskAccount',_0x679b,JSON[_0x3997('0xc')](_0x45eeac));_0x420fbc(_0x45eeac);})['catch'](function(_0x4c0c0b){logger[_0x3997('0xd')]('GetDeskAccount',_0x4c0c0b[_0x3997('0xe')],_0x679b);_0xad2deb(_0x209e16[_0x3997('0xd')](0x1f4,_0x4c0c0b[_0x3997('0xe')]));});});};exports['ShowDeskAccount']=function(_0x4d15d3){var _0x568675=this;return new Promise(function(_0x3a93df,_0x46ee77){return db[_0x3997('0x13')][_0x3997('0x1c')]({'raw':_0x4d15d3[_0x3997('0x15')]?_0x4d15d3[_0x3997('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x4d15d3[_0x3997('0x15')]?_0x4d15d3[_0x3997('0x15')][_0x3997('0x16')]||null:null,'attributes':_0x4d15d3[_0x3997('0x15')]?_0x4d15d3[_0x3997('0x15')][_0x3997('0x17')]||null:null,'include':_0x4d15d3['options']?_0x4d15d3[_0x3997('0x15')][_0x3997('0x19')]?_[_0x3997('0x1a')](_0x4d15d3[_0x3997('0x15')][_0x3997('0x19')],function(_0x3b9475){return{'model':db[_0x3b9475[_0x3997('0x1b')]],'as':_0x3b9475['as'],'attributes':_0x3b9475[_0x3997('0x17')],'include':_0x3b9475[_0x3997('0x19')]?_['map'](_0x3b9475[_0x3997('0x19')],function(_0x5b79cb){return{'model':db[_0x5b79cb[_0x3997('0x1b')]],'as':_0x5b79cb['as'],'attributes':_0x5b79cb[_0x3997('0x17')],'include':_0x5b79cb[_0x3997('0x19')]?_[_0x3997('0x1a')](_0x5b79cb[_0x3997('0x19')],function(_0x58c0cd){return{'model':db[_0x58c0cd[_0x3997('0x1b')]],'as':_0x58c0cd['as'],'attributes':_0x58c0cd[_0x3997('0x17')]};}):[]};}):[]};}):[]:[]})[_0x3997('0x7')](function(_0x1fca70){logger[_0x3997('0xf')]('ShowDeskAccount',_0x4d15d3);logger[_0x3997('0x9')](_0x3997('0x1d'),_0x4d15d3,JSON['stringify'](_0x1fca70));_0x3a93df(_0x1fca70);})[_0x3997('0x11')](function(_0x19071d){logger['error']('ShowDeskAccount',_0x19071d[_0x3997('0xe')],_0x4d15d3);_0x46ee77(_0x568675[_0x3997('0xd')](0x1f4,_0x19071d['message']));});});}; \ No newline at end of file +var _0x964e=['info','request\x20sent','debug','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','attributes','limit','include','map','model','ShowDeskAccount','find','where','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x2ab44d,_0x1dd6b6){var _0x306b50=function(_0x2d5a02){while(--_0x2d5a02){_0x2ab44d['push'](_0x2ab44d['shift']());}};_0x306b50(++_0x1dd6b6);}(_0x964e,0x149));var _0xe964=function(_0x3b3895,_0x23273b){_0x3b3895=_0x3b3895-0x0;var _0x10f219=_0x964e[_0x3b3895];return _0x10f219;};'use strict';var _=require(_0xe964('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe964('0x1'));var fs=require('fs');var Redis=require(_0xe964('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe964('0x3'));var logger=require(_0xe964('0x4'))(_0xe964('0x5'));var config=require('../../config/environment');var jayson=require(_0xe964('0x6'));var client=jayson[_0xe964('0x7')][_0xe964('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18445a,_0x11d31a,_0x1632ae){return new BPromise(function(_0xc67a97,_0x355333){return client[_0xe964('0x9')](_0x18445a,_0x1632ae)[_0xe964('0xa')](function(_0x144f1f){logger[_0xe964('0xb')]('DeskAccount,\x20%s,\x20%s',_0x11d31a,_0xe964('0xc'));logger[_0xe964('0xd')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x11d31a,_0xe964('0xc'),JSON[_0xe964('0xe')](_0x144f1f));if(_0x144f1f[_0xe964('0xf')]){if(_0x144f1f[_0xe964('0xf')][_0xe964('0x10')]===0x1f4){logger[_0xe964('0xf')](_0xe964('0x11'),_0x11d31a,_0x144f1f[_0xe964('0xf')][_0xe964('0x12')]);return _0x355333(_0x144f1f[_0xe964('0xf')][_0xe964('0x12')]);}logger[_0xe964('0xf')](_0xe964('0x11'),_0x11d31a,_0x144f1f[_0xe964('0xf')][_0xe964('0x12')]);return _0xc67a97(_0x144f1f[_0xe964('0xf')][_0xe964('0x12')]);}else{logger['info'](_0xe964('0x11'),_0x11d31a,_0xe964('0xc'));_0xc67a97(_0x144f1f[_0xe964('0x13')][_0xe964('0x12')]);}})[_0xe964('0x14')](function(_0x3aa391){logger['error'](_0xe964('0x11'),_0x11d31a,_0x3aa391);_0x355333(_0x3aa391);});});}exports[_0xe964('0x15')]=function(_0x5594c8){var _0x4c4ee0=this;return new Promise(function(_0x3a0a85,_0xdaee89){return db[_0xe964('0x16')][_0xe964('0x17')]({'raw':_0x5594c8[_0xe964('0x18')]?_0x5594c8[_0xe964('0x18')][_0xe964('0x19')]===undefined?!![]:![]:!![],'where':_0x5594c8['options']?_0x5594c8['options']['where']||null:null,'attributes':_0x5594c8['options']?_0x5594c8[_0xe964('0x18')][_0xe964('0x1a')]||null:null,'limit':_0x5594c8[_0xe964('0x18')]?_0x5594c8[_0xe964('0x18')][_0xe964('0x1b')]||null:null,'include':_0x5594c8[_0xe964('0x18')]?_0x5594c8[_0xe964('0x18')][_0xe964('0x1c')]?_['map'](_0x5594c8[_0xe964('0x18')]['include'],function(_0x509aa3){return{'model':db[_0x509aa3['model']],'as':_0x509aa3['as'],'attributes':_0x509aa3[_0xe964('0x1a')],'include':_0x509aa3[_0xe964('0x1c')]?_[_0xe964('0x1d')](_0x509aa3['include'],function(_0x4b58dc){return{'model':db[_0x4b58dc[_0xe964('0x1e')]],'as':_0x4b58dc['as'],'attributes':_0x4b58dc['attributes'],'include':_0x4b58dc[_0xe964('0x1c')]?_['map'](_0x4b58dc[_0xe964('0x1c')],function(_0x1e93e0){return{'model':db[_0x1e93e0[_0xe964('0x1e')]],'as':_0x1e93e0['as'],'attributes':_0x1e93e0[_0xe964('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe964('0xa')](function(_0x3f1778){logger[_0xe964('0xb')]('GetDeskAccount',_0x5594c8);logger['debug'](_0xe964('0x15'),_0x5594c8,JSON[_0xe964('0xe')](_0x3f1778));_0x3a0a85(_0x3f1778);})[_0xe964('0x14')](function(_0x5f5bbc){logger[_0xe964('0xf')]('GetDeskAccount',_0x5f5bbc[_0xe964('0x12')],_0x5594c8);_0xdaee89(_0x4c4ee0['error'](0x1f4,_0x5f5bbc['message']));});});};exports[_0xe964('0x1f')]=function(_0x1428ba){var _0x3c776d=this;return new Promise(function(_0x5c5d7c,_0x24b025){return db['DeskAccount'][_0xe964('0x20')]({'raw':_0x1428ba[_0xe964('0x18')]?_0x1428ba[_0xe964('0x18')][_0xe964('0x19')]===undefined?!![]:![]:!![],'where':_0x1428ba[_0xe964('0x18')]?_0x1428ba[_0xe964('0x18')][_0xe964('0x21')]||null:null,'attributes':_0x1428ba['options']?_0x1428ba[_0xe964('0x18')]['attributes']||null:null,'include':_0x1428ba[_0xe964('0x18')]?_0x1428ba['options']['include']?_[_0xe964('0x1d')](_0x1428ba[_0xe964('0x18')][_0xe964('0x1c')],function(_0x434769){return{'model':db[_0x434769[_0xe964('0x1e')]],'as':_0x434769['as'],'attributes':_0x434769[_0xe964('0x1a')],'include':_0x434769['include']?_[_0xe964('0x1d')](_0x434769[_0xe964('0x1c')],function(_0xd93d31){return{'model':db[_0xd93d31[_0xe964('0x1e')]],'as':_0xd93d31['as'],'attributes':_0xd93d31[_0xe964('0x1a')],'include':_0xd93d31[_0xe964('0x1c')]?_['map'](_0xd93d31[_0xe964('0x1c')],function(_0x43a803){return{'model':db[_0x43a803[_0xe964('0x1e')]],'as':_0x43a803['as'],'attributes':_0x43a803[_0xe964('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe964('0xa')](function(_0x3bf1eb){logger[_0xe964('0xb')]('ShowDeskAccount',_0x1428ba);logger[_0xe964('0xd')](_0xe964('0x1f'),_0x1428ba,JSON[_0xe964('0xe')](_0x3bf1eb));_0x5c5d7c(_0x3bf1eb);})[_0xe964('0x14')](function(_0x489c6b){logger[_0xe964('0xf')]('ShowDeskAccount',_0x489c6b['message'],_0x1428ba);_0x24b025(_0x3c776d[_0xe964('0xf')](0x1f4,_0x489c6b[_0xe964('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 3771cd1..9efc492 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 _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x211c68,_0x135a37){var _0x5692fb=function(_0x494f29){while(--_0x494f29){_0x211c68['push'](_0x211c68['shift']());}};_0x5692fb(++_0x135a37);}(_0x3e74,0x175));var _0x43e7=function(_0xb0749b,_0x104b80){_0xb0749b=_0xb0749b-0x0;var _0x362da1=_0x3e74[_0xb0749b];return _0x362da1;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file +var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x42d67a,_0x4049ad){var _0x5dcef9=function(_0x4aa90f){while(--_0x4aa90f){_0x42d67a['push'](_0x42d67a['shift']());}};_0x5dcef9(++_0x4049ad);}(_0xedd9,0xfc));var _0x9edd=function(_0x8cc8b3,_0x2adbd9){_0x8cc8b3=_0x8cc8b3-0x0;var _0x295b74=_0xedd9[_0x8cc8b3];return _0x295b74;};'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['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index d5fb999..a910c7f 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 _0xbc2b=['exports','STRING','sequelize'];(function(_0xd343,_0x47ddff){var _0x4886fa=function(_0x481048){while(--_0x481048){_0xd343['push'](_0xd343['shift']());}};_0x4886fa(++_0x47ddff);}(_0xbc2b,0x15e));var _0xbbc2=function(_0x7f4c0d,_0x3bca59){_0x7f4c0d=_0x7f4c0d-0x0;var _0x29219b=_0xbc2b[_0x7f4c0d];return _0x29219b;};'use strict';var Sequelize=require(_0xbbc2('0x0'));module[_0xbbc2('0x1')]={'name':{'type':Sequelize[_0xbbc2('0x2')]},'description':{'type':Sequelize[_0xbbc2('0x2')]}}; \ No newline at end of file +var _0xaaa6=['STRING','sequelize','exports'];(function(_0xd627f1,_0x4a848b){var _0x2d6d38=function(_0x7ad880){while(--_0x7ad880){_0xd627f1['push'](_0xd627f1['shift']());}};_0x2d6d38(++_0x4a848b);}(_0xaaa6,0x166));var _0x6aaa=function(_0xe718ab,_0x3c155f){_0xe718ab=_0xe718ab-0x0;var _0x5cbe5d=_0xaaa6[_0xe718ab];return _0x5cbe5d;};'use strict';var Sequelize=require(_0x6aaa('0x0'));module[_0x6aaa('0x1')]={'name':{'type':Sequelize[_0x6aaa('0x2')]},'description':{'type':Sequelize[_0x6aaa('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 51e8fae..a6c7bc2 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 _0x5729=['key','model','query','filters','intersection','attributes','fields','nolimit','order','where','filter','merge','include','rows','catch','show','params','keys','includeAll','options','find','create','body','getFields','findOne','DeskField','length','sort','getSubjects','pick','hasOwnProperty','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','util','path','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','end','error','name','index','map','DeskConfiguration','rawAttributes','fieldName','type'];(function(_0x4b11e8,_0x5f39e5){var _0x32b095=function(_0x73fd6a){while(--_0x73fd6a){_0x4b11e8['push'](_0x4b11e8['shift']());}};_0x32b095(++_0x5f39e5);}(_0x5729,0x158));var _0x9572=function(_0x294cf1,_0x5d6a40){_0x294cf1=_0x294cf1-0x0;var _0x334402=_0x5729[_0x294cf1];return _0x334402;};'use strict';var emlformat=require(_0x9572('0x0'));var rimraf=require(_0x9572('0x1'));var zipdir=require(_0x9572('0x2'));var jsonpatch=require(_0x9572('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9572('0x4'));var path=require(_0x9572('0x5'));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(_0x9572('0x6'));var squel=require('squel');var crypto=require(_0x9572('0x7'));var jsforce=require(_0x9572('0x8'));var deskjs=require(_0x9572('0x9'));var toCsv=require('to-csv');var querystring=require(_0x9572('0xa'));var Papa=require(_0x9572('0xb'));var Redis=require(_0x9572('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x9572('0xd'));var as=require(_0x9572('0xe'));var hardwareService=require(_0x9572('0xf'));var logger=require(_0x9572('0x10'))(_0x9572('0x11'));var utils=require('../../config/utils');var config=require(_0x9572('0x12'));var licenseUtil=require(_0x9572('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52928d,_0x57185e){_0x57185e=_0x57185e||0xcc;return function(_0x311016){if(_0x311016){return _0x52928d[_0x9572('0x14')](_0x57185e);}return _0x52928d[_0x9572('0x15')](_0x57185e)['end']();};}function respondWithResult(_0x4dca09,_0x2c9dbf){_0x2c9dbf=_0x2c9dbf||0xc8;return function(_0x4bd1b7){if(_0x4bd1b7){return _0x4dca09[_0x9572('0x15')](_0x2c9dbf)['json'](_0x4bd1b7);}};}function respondWithFilteredResult(_0xfe2cc1,_0x238aa5){return function(_0x287a96){if(_0x287a96){var _0x49cc46=typeof _0x238aa5[_0x9572('0x16')]===_0x9572('0x17')&&typeof _0x238aa5['limit']===_0x9572('0x17');var _0x218ed8=_0x287a96[_0x9572('0x18')];var _0x48ef79=_0x49cc46?0x0:_0x238aa5[_0x9572('0x16')];var _0x277279=_0x49cc46?_0x287a96['count']:_0x238aa5['offset']+_0x238aa5[_0x9572('0x19')];var _0x5e40b8;if(_0x277279>=_0x218ed8){_0x277279=_0x218ed8;_0x5e40b8=0xc8;}else{_0x5e40b8=0xce;}_0xfe2cc1['status'](_0x5e40b8);return _0xfe2cc1['set'](_0x9572('0x1a'),_0x48ef79+'-'+_0x277279+'/'+_0x218ed8)['json'](_0x287a96);}return null;};}function patchUpdates(_0x5778e5){return function(_0x5c3562){try{jsonpatch['apply'](_0x5c3562,_0x5778e5,!![]);}catch(_0x171098){return BPromise[_0x9572('0x1b')](_0x171098);}return _0x5c3562[_0x9572('0x1c')]();};}function saveUpdates(_0x155a42,_0x49bf69){return function(_0x509cbd){if(_0x509cbd){return _0x509cbd[_0x9572('0x1d')](_0x155a42)[_0x9572('0x1e')](function(_0x45b9dc){return _0x45b9dc;});}return null;};}function removeEntity(_0x1262d5,_0x267acb){return function(_0x5f0258){if(_0x5f0258){return _0x5f0258[_0x9572('0x1f')]()[_0x9572('0x1e')](function(){_0x1262d5[_0x9572('0x15')](0xcc)[_0x9572('0x20')]();});}};}function handleEntityNotFound(_0x19ff76,_0x28aba5){return function(_0x1a1cc0){if(!_0x1a1cc0){_0x19ff76[_0x9572('0x14')](0x194);}return _0x1a1cc0;};}function handleError(_0xfa1ed3,_0x2832bf){_0x2832bf=_0x2832bf||0x1f4;return function(_0x502d18){logger[_0x9572('0x21')](_0x502d18['stack']);if(_0x502d18[_0x9572('0x22')]){delete _0x502d18[_0x9572('0x22')];}_0xfa1ed3['status'](_0x2832bf)['send'](_0x502d18);};}exports[_0x9572('0x23')]=function(_0x295c53,_0x358040){var _0x1aed1d={},_0x3193ab={},_0x297e64={'count':0x0,'rows':[]};var _0x2713e8=_[_0x9572('0x24')](db[_0x9572('0x25')][_0x9572('0x26')],function(_0x102b10){return{'name':_0x102b10[_0x9572('0x27')],'type':_0x102b10[_0x9572('0x28')][_0x9572('0x29')]};});_0x3193ab[_0x9572('0x2a')]=_['map'](_0x2713e8,_0x9572('0x22'));_0x3193ab[_0x9572('0x2b')]=_['keys'](_0x295c53['query']);_0x3193ab[_0x9572('0x2c')]=_[_0x9572('0x2d')](_0x3193ab[_0x9572('0x2a')],_0x3193ab[_0x9572('0x2b')]);_0x1aed1d[_0x9572('0x2e')]=_[_0x9572('0x2d')](_0x3193ab[_0x9572('0x2a')],qs[_0x9572('0x2f')](_0x295c53[_0x9572('0x2b')]['fields']));_0x1aed1d[_0x9572('0x2e')]=_0x1aed1d[_0x9572('0x2e')]['length']?_0x1aed1d[_0x9572('0x2e')]:_0x3193ab['model'];if(!_0x295c53['query']['hasOwnProperty'](_0x9572('0x30'))){_0x1aed1d[_0x9572('0x19')]=qs[_0x9572('0x19')](_0x295c53['query'][_0x9572('0x19')]);_0x1aed1d[_0x9572('0x16')]=qs[_0x9572('0x16')](_0x295c53[_0x9572('0x2b')]['offset']);}_0x1aed1d[_0x9572('0x31')]=qs['sort'](_0x295c53[_0x9572('0x2b')]['sort']);_0x1aed1d[_0x9572('0x32')]=qs['filters'](_['pick'](_0x295c53['query'],_0x3193ab[_0x9572('0x2c')]),_0x2713e8);if(_0x295c53[_0x9572('0x2b')][_0x9572('0x33')]){_0x1aed1d[_0x9572('0x32')]=_[_0x9572('0x34')](_0x1aed1d['where'],{'$or':_[_0x9572('0x24')](_0x2713e8,function(_0x2ad836){if(_0x2ad836[_0x9572('0x28')]!=='VIRTUAL'){var _0x2d84e0={};_0x2d84e0[_0x2ad836[_0x9572('0x22')]]={'$like':'%'+_0x295c53['query']['filter']+'%'};return _0x2d84e0;}})});}_0x1aed1d=_[_0x9572('0x34')]({},_0x1aed1d,_0x295c53['options']);var _0x507854={'where':_0x1aed1d[_0x9572('0x32')]};return db[_0x9572('0x25')][_0x9572('0x18')](_0x507854)['then'](function(_0x12f9fc){_0x297e64['count']=_0x12f9fc;if(_0x295c53[_0x9572('0x2b')]['includeAll']){_0x1aed1d[_0x9572('0x35')]=[{'all':!![]}];}return db[_0x9572('0x25')]['findAll'](_0x1aed1d);})['then'](function(_0x3a09fb){_0x297e64[_0x9572('0x36')]=_0x3a09fb;return _0x297e64;})['then'](respondWithFilteredResult(_0x358040,_0x1aed1d))[_0x9572('0x37')](handleError(_0x358040,null));};exports[_0x9572('0x38')]=function(_0x4e845e,_0x14cdbb){var _0xe09b97={'raw':![],'where':{'id':_0x4e845e[_0x9572('0x39')]['id']}},_0x1626ff={};_0x1626ff['model']=_[_0x9572('0x3a')](db[_0x9572('0x25')]['rawAttributes']);_0x1626ff[_0x9572('0x2b')]=_[_0x9572('0x3a')](_0x4e845e[_0x9572('0x2b')]);_0x1626ff[_0x9572('0x2c')]=_[_0x9572('0x2d')](_0x1626ff[_0x9572('0x2a')],_0x1626ff['query']);_0xe09b97['attributes']=_[_0x9572('0x2d')](_0x1626ff[_0x9572('0x2a')],qs[_0x9572('0x2f')](_0x4e845e['query'][_0x9572('0x2f')]));_0xe09b97['attributes']=_0xe09b97[_0x9572('0x2e')]['length']?_0xe09b97['attributes']:_0x1626ff[_0x9572('0x2a')];if(_0x4e845e[_0x9572('0x2b')][_0x9572('0x3b')]){_0xe09b97['include']=[{'all':!![]}];}_0xe09b97=_[_0x9572('0x34')]({},_0xe09b97,_0x4e845e[_0x9572('0x3c')]);return db[_0x9572('0x25')][_0x9572('0x3d')](_0xe09b97)[_0x9572('0x1e')](handleEntityNotFound(_0x14cdbb,null))['then'](respondWithResult(_0x14cdbb,null))[_0x9572('0x37')](handleError(_0x14cdbb,null));};exports[_0x9572('0x3e')]=function(_0xa43068,_0x2a086b){return db[_0x9572('0x25')][_0x9572('0x3e')](_0xa43068[_0x9572('0x3f')],{})[_0x9572('0x1e')](respondWithResult(_0x2a086b,0xc9))[_0x9572('0x37')](handleError(_0x2a086b,null));};exports['update']=function(_0x2348a3,_0x46d9d8){if(_0x2348a3[_0x9572('0x3f')]['id']){delete _0x2348a3['body']['id'];}return db[_0x9572('0x25')][_0x9572('0x3d')]({'where':{'id':_0x2348a3['params']['id']}})[_0x9572('0x1e')](handleEntityNotFound(_0x46d9d8,null))[_0x9572('0x1e')](saveUpdates(_0x2348a3[_0x9572('0x3f')],null))[_0x9572('0x1e')](respondWithResult(_0x46d9d8,null))[_0x9572('0x37')](handleError(_0x46d9d8,null));};exports['destroy']=function(_0x12feb8,_0x189ea0){return db[_0x9572('0x25')][_0x9572('0x3d')]({'where':{'id':_0x12feb8[_0x9572('0x39')]['id']}})[_0x9572('0x1e')](handleEntityNotFound(_0x189ea0,null))[_0x9572('0x1e')](removeEntity(_0x189ea0,null))['catch'](handleError(_0x189ea0,null));};exports[_0x9572('0x40')]=function(_0x26cd7a,_0x562f21,_0x131c4d){var _0x157ec4={};var _0x5de205={};var _0x53c359;var _0x584ae5;return db[_0x9572('0x25')][_0x9572('0x41')]({'where':{'id':_0x26cd7a['params']['id']}})[_0x9572('0x1e')](handleEntityNotFound(_0x562f21,null))[_0x9572('0x1e')](function(_0x57f8fd){if(_0x57f8fd){_0x53c359=_0x57f8fd;_0x5de205[_0x9572('0x2a')]=_[_0x9572('0x3a')](db[_0x9572('0x42')]['rawAttributes']);_0x5de205[_0x9572('0x2b')]=_['keys'](_0x26cd7a[_0x9572('0x2b')]);_0x5de205['filters']=_[_0x9572('0x2d')](_0x5de205['model'],_0x5de205[_0x9572('0x2b')]);_0x157ec4[_0x9572('0x2e')]=_[_0x9572('0x2d')](_0x5de205[_0x9572('0x2a')],qs[_0x9572('0x2f')](_0x26cd7a[_0x9572('0x2b')][_0x9572('0x2f')]));_0x157ec4[_0x9572('0x2e')]=_0x157ec4['attributes'][_0x9572('0x43')]?_0x157ec4[_0x9572('0x2e')]:_0x5de205['model'];_0x157ec4[_0x9572('0x31')]=qs[_0x9572('0x44')](_0x26cd7a[_0x9572('0x2b')][_0x9572('0x44')]);_0x157ec4['where']=qs[_0x9572('0x2c')](_['pick'](_0x26cd7a[_0x9572('0x2b')],_0x5de205['filters']));if(_0x26cd7a[_0x9572('0x2b')][_0x9572('0x33')]){_0x157ec4['where']=_[_0x9572('0x34')](_0x157ec4['where'],{'$or':_[_0x9572('0x24')](_0x157ec4['attributes'],function(_0x39a484){var _0x20db6e={};_0x20db6e[_0x39a484]={'$like':'%'+_0x26cd7a['query'][_0x9572('0x33')]+'%'};return _0x20db6e;})});}_0x157ec4=_[_0x9572('0x34')]({},_0x157ec4,_0x26cd7a[_0x9572('0x3c')]);return _0x53c359[_0x9572('0x40')](_0x157ec4);}})[_0x9572('0x1e')](function(_0x400bcb){if(_0x400bcb){_0x584ae5=_0x400bcb[_0x9572('0x43')];if(!_0x26cd7a[_0x9572('0x2b')]['hasOwnProperty'](_0x9572('0x30'))){_0x157ec4[_0x9572('0x19')]=qs['limit'](_0x26cd7a['query'][_0x9572('0x19')]);_0x157ec4[_0x9572('0x16')]=qs['offset'](_0x26cd7a['query']['offset']);}return _0x53c359[_0x9572('0x40')](_0x157ec4);}})[_0x9572('0x1e')](function(_0x4ef9b9){if(_0x4ef9b9){return _0x4ef9b9?{'count':_0x584ae5,'rows':_0x4ef9b9}:null;}})[_0x9572('0x1e')](respondWithResult(_0x562f21,null))[_0x9572('0x37')](handleError(_0x562f21,null));};exports[_0x9572('0x45')]=function(_0x2bd3e6,_0x271917,_0x171d95){var _0xbab9de={};var _0x159e9c={};var _0x2df7c5;var _0x4e4a82;return db[_0x9572('0x25')][_0x9572('0x41')]({'where':{'id':_0x2bd3e6[_0x9572('0x39')]['id']}})[_0x9572('0x1e')](handleEntityNotFound(_0x271917,null))['then'](function(_0x2ccff0){if(_0x2ccff0){_0x2df7c5=_0x2ccff0;_0x159e9c[_0x9572('0x2a')]=_[_0x9572('0x3a')](db['DeskField'][_0x9572('0x26')]);_0x159e9c[_0x9572('0x2b')]=_[_0x9572('0x3a')](_0x2bd3e6['query']);_0x159e9c[_0x9572('0x2c')]=_[_0x9572('0x2d')](_0x159e9c[_0x9572('0x2a')],_0x159e9c['query']);_0xbab9de[_0x9572('0x2e')]=_['intersection'](_0x159e9c[_0x9572('0x2a')],qs[_0x9572('0x2f')](_0x2bd3e6[_0x9572('0x2b')][_0x9572('0x2f')]));_0xbab9de[_0x9572('0x2e')]=_0xbab9de['attributes'][_0x9572('0x43')]?_0xbab9de[_0x9572('0x2e')]:_0x159e9c[_0x9572('0x2a')];_0xbab9de['order']=qs[_0x9572('0x44')](_0x2bd3e6['query'][_0x9572('0x44')]);_0xbab9de[_0x9572('0x32')]=qs[_0x9572('0x2c')](_[_0x9572('0x46')](_0x2bd3e6[_0x9572('0x2b')],_0x159e9c[_0x9572('0x2c')]));if(_0x2bd3e6[_0x9572('0x2b')][_0x9572('0x33')]){_0xbab9de[_0x9572('0x32')]=_['merge'](_0xbab9de[_0x9572('0x32')],{'$or':_[_0x9572('0x24')](_0xbab9de[_0x9572('0x2e')],function(_0x4db7bd){var _0x14dfa1={};_0x14dfa1[_0x4db7bd]={'$like':'%'+_0x2bd3e6[_0x9572('0x2b')]['filter']+'%'};return _0x14dfa1;})});}_0xbab9de=_[_0x9572('0x34')]({},_0xbab9de,_0x2bd3e6['options']);return _0x2df7c5[_0x9572('0x45')](_0xbab9de);}})[_0x9572('0x1e')](function(_0x42945b){if(_0x42945b){_0x4e4a82=_0x42945b[_0x9572('0x43')];if(!_0x2bd3e6[_0x9572('0x2b')][_0x9572('0x47')](_0x9572('0x30'))){_0xbab9de['limit']=qs[_0x9572('0x19')](_0x2bd3e6[_0x9572('0x2b')][_0x9572('0x19')]);_0xbab9de[_0x9572('0x16')]=qs[_0x9572('0x16')](_0x2bd3e6['query'][_0x9572('0x16')]);}return _0x2df7c5[_0x9572('0x45')](_0xbab9de);}})[_0x9572('0x1e')](function(_0xf74587){if(_0xf74587){return _0xf74587?{'count':_0x4e4a82,'rows':_0xf74587}:null;}})[_0x9572('0x1e')](respondWithResult(_0x271917,null))[_0x9572('0x37')](handleError(_0x271917,null));};exports['getDescriptions']=function(_0x4d0deb,_0x5eb47f,_0x29dab2){var _0x28b6a4={};var _0x52c409={};var _0x4f77b9;var _0x13a5d1;return db[_0x9572('0x25')][_0x9572('0x41')]({'where':{'id':_0x4d0deb['params']['id']}})[_0x9572('0x1e')](handleEntityNotFound(_0x5eb47f,null))[_0x9572('0x1e')](function(_0x2c7b39){if(_0x2c7b39){_0x4f77b9=_0x2c7b39;_0x52c409[_0x9572('0x2a')]=_['keys'](db['DeskField'][_0x9572('0x26')]);_0x52c409['query']=_[_0x9572('0x3a')](_0x4d0deb[_0x9572('0x2b')]);_0x52c409[_0x9572('0x2c')]=_[_0x9572('0x2d')](_0x52c409[_0x9572('0x2a')],_0x52c409['query']);_0x28b6a4[_0x9572('0x2e')]=_['intersection'](_0x52c409[_0x9572('0x2a')],qs[_0x9572('0x2f')](_0x4d0deb[_0x9572('0x2b')][_0x9572('0x2f')]));_0x28b6a4[_0x9572('0x2e')]=_0x28b6a4['attributes'][_0x9572('0x43')]?_0x28b6a4['attributes']:_0x52c409[_0x9572('0x2a')];_0x28b6a4[_0x9572('0x31')]=qs[_0x9572('0x44')](_0x4d0deb[_0x9572('0x2b')]['sort']);_0x28b6a4['where']=qs[_0x9572('0x2c')](_['pick'](_0x4d0deb['query'],_0x52c409[_0x9572('0x2c')]));if(_0x4d0deb[_0x9572('0x2b')]['filter']){_0x28b6a4[_0x9572('0x32')]=_[_0x9572('0x34')](_0x28b6a4[_0x9572('0x32')],{'$or':_[_0x9572('0x24')](_0x28b6a4[_0x9572('0x2e')],function(_0x5dbc97){var _0x160108={};_0x160108[_0x5dbc97]={'$like':'%'+_0x4d0deb[_0x9572('0x2b')][_0x9572('0x33')]+'%'};return _0x160108;})});}_0x28b6a4=_[_0x9572('0x34')]({},_0x28b6a4,_0x4d0deb[_0x9572('0x3c')]);return _0x4f77b9['getDescriptions'](_0x28b6a4);}})[_0x9572('0x1e')](function(_0x464877){if(_0x464877){_0x13a5d1=_0x464877['length'];if(!_0x4d0deb['query'][_0x9572('0x47')](_0x9572('0x30'))){_0x28b6a4['limit']=qs[_0x9572('0x19')](_0x4d0deb[_0x9572('0x2b')][_0x9572('0x19')]);_0x28b6a4['offset']=qs[_0x9572('0x16')](_0x4d0deb['query'][_0x9572('0x16')]);}return _0x4f77b9[_0x9572('0x48')](_0x28b6a4);}})[_0x9572('0x1e')](function(_0x49682c){if(_0x49682c){return _0x49682c?{'count':_0x13a5d1,'rows':_0x49682c}:null;}})['then'](respondWithResult(_0x5eb47f,null))[_0x9572('0x37')](handleError(_0x5eb47f,null));};exports[_0x9572('0x49')]=function(_0x13acfe,_0x596ee2,_0x4d5006){var _0x8a6645={};var _0x29cddb={};var _0x14229f;var _0x212489;return db['DeskConfiguration'][_0x9572('0x41')]({'where':{'id':_0x13acfe[_0x9572('0x39')]['id']}})['then'](handleEntityNotFound(_0x596ee2,null))['then'](function(_0x1c8fc2){if(_0x1c8fc2){_0x14229f=_0x1c8fc2;_0x29cddb['model']=_[_0x9572('0x3a')](db[_0x9572('0x4a')][_0x9572('0x26')]);_0x29cddb[_0x9572('0x2b')]=_[_0x9572('0x3a')](_0x13acfe[_0x9572('0x2b')]);_0x29cddb[_0x9572('0x2c')]=_[_0x9572('0x2d')](_0x29cddb[_0x9572('0x2a')],_0x29cddb['query']);_0x8a6645[_0x9572('0x2e')]=_[_0x9572('0x2d')](_0x29cddb[_0x9572('0x2a')],qs[_0x9572('0x2f')](_0x13acfe[_0x9572('0x2b')][_0x9572('0x2f')]));_0x8a6645['attributes']=_0x8a6645[_0x9572('0x2e')][_0x9572('0x43')]?_0x8a6645[_0x9572('0x2e')]:_0x29cddb['model'];_0x8a6645[_0x9572('0x31')]=qs['sort'](_0x13acfe['query'][_0x9572('0x44')]);_0x8a6645[_0x9572('0x32')]=qs[_0x9572('0x2c')](_['pick'](_0x13acfe['query'],_0x29cddb['filters']));if(_0x13acfe[_0x9572('0x2b')][_0x9572('0x33')]){_0x8a6645[_0x9572('0x32')]=_['merge'](_0x8a6645[_0x9572('0x32')],{'$or':_['map'](_0x8a6645[_0x9572('0x2e')],function(_0x2885bb){var _0x37ff42={};_0x37ff42[_0x2885bb]={'$like':'%'+_0x13acfe['query'][_0x9572('0x33')]+'%'};return _0x37ff42;})});}_0x8a6645=_[_0x9572('0x34')]({},_0x8a6645,_0x13acfe[_0x9572('0x3c')]);return _0x14229f[_0x9572('0x49')](_0x8a6645);}})[_0x9572('0x1e')](function(_0x5cb249){if(_0x5cb249){_0x212489=_0x5cb249[_0x9572('0x43')];if(!_0x13acfe['query'][_0x9572('0x47')](_0x9572('0x30'))){_0x8a6645[_0x9572('0x19')]=qs[_0x9572('0x19')](_0x13acfe[_0x9572('0x2b')][_0x9572('0x19')]);_0x8a6645[_0x9572('0x16')]=qs[_0x9572('0x16')](_0x13acfe[_0x9572('0x2b')][_0x9572('0x16')]);}return _0x14229f[_0x9572('0x49')](_0x8a6645);}})[_0x9572('0x1e')](function(_0x5b8b7e){if(_0x5b8b7e){return _0x5b8b7e?{'count':_0x212489,'rows':_0x5b8b7e}:null;}})['then'](respondWithResult(_0x596ee2,null))[_0x9572('0x37')](handleError(_0x596ee2,null));};exports[_0x9572('0x4b')]=function(_0x56c624,_0xd05a9c,_0x126411){if(_0x56c624[_0x9572('0x3f')]['id']){delete _0x56c624[_0x9572('0x3f')]['id'];}return db[_0x9572('0x25')]['findOne']({'where':{'id':_0x56c624[_0x9572('0x39')]['id']}})['then'](handleEntityNotFound(_0xd05a9c,null))[_0x9572('0x1e')](function(_0x3c6c93){if(_0x3c6c93){return _0x3c6c93[_0x9572('0x4b')](_0x56c624[_0x9572('0x3f')][_0x9572('0x4c')]||[]);}return null;})[_0x9572('0x1e')](respondWithResult(_0xd05a9c,null))[_0x9572('0x37')](handleError(_0xd05a9c,null));}; \ No newline at end of file +var _0x2cc9=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','find','create','getFields','findOne','DeskField','sort','hasOwnProperty','getSubjects','options','getDescriptions','getTags','Tag','setTags','body','ids'];(function(_0x21ddb5,_0x4e5746){var _0x5d32a1=function(_0x17afda){while(--_0x17afda){_0x21ddb5['push'](_0x21ddb5['shift']());}};_0x5d32a1(++_0x4e5746);}(_0x2cc9,0xa2));var _0x92cc=function(_0x49fcc6,_0x22b508){_0x49fcc6=_0x49fcc6-0x0;var _0x5e3aaa=_0x2cc9[_0x49fcc6];return _0x5e3aaa;};'use strict';var emlformat=require(_0x92cc('0x0'));var rimraf=require(_0x92cc('0x1'));var zipdir=require(_0x92cc('0x2'));var jsonpatch=require(_0x92cc('0x3'));var rp=require('request-promise');var moment=require(_0x92cc('0x4'));var BPromise=require(_0x92cc('0x5'));var Mustache=require(_0x92cc('0x6'));var util=require(_0x92cc('0x7'));var path=require(_0x92cc('0x8'));var sox=require('sox');var csv=require(_0x92cc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x92cc('0xa'));var _=require('lodash');var squel=require(_0x92cc('0xb'));var crypto=require(_0x92cc('0xc'));var jsforce=require(_0x92cc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x92cc('0x9'));var querystring=require(_0x92cc('0xe'));var Papa=require(_0x92cc('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x92cc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x92cc('0x11'));var logger=require(_0x92cc('0x12'))('api');var utils=require(_0x92cc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x92cc('0x14'));var db=require(_0x92cc('0x15'))['db'];function respondWithStatusCode(_0x2d5f43,_0x2b33e4){_0x2b33e4=_0x2b33e4||0xcc;return function(_0x390e62){if(_0x390e62){return _0x2d5f43[_0x92cc('0x16')](_0x2b33e4);}return _0x2d5f43['status'](_0x2b33e4)['end']();};}function respondWithResult(_0x46a844,_0x16b6d3){_0x16b6d3=_0x16b6d3||0xc8;return function(_0x5081c2){if(_0x5081c2){return _0x46a844[_0x92cc('0x17')](_0x16b6d3)['json'](_0x5081c2);}};}function respondWithFilteredResult(_0x274155,_0x4315f7){return function(_0x164a11){if(_0x164a11){var _0x4cd226=typeof _0x4315f7[_0x92cc('0x18')]==='undefined'&&typeof _0x4315f7[_0x92cc('0x19')]===_0x92cc('0x1a');var _0x10f9b1=_0x164a11[_0x92cc('0x1b')];var _0xd467f5=_0x4cd226?0x0:_0x4315f7[_0x92cc('0x18')];var _0x35f4d6=_0x4cd226?_0x164a11[_0x92cc('0x1b')]:_0x4315f7[_0x92cc('0x18')]+_0x4315f7[_0x92cc('0x19')];var _0x8d6832;if(_0x35f4d6>=_0x10f9b1){_0x35f4d6=_0x10f9b1;_0x8d6832=0xc8;}else{_0x8d6832=0xce;}_0x274155['status'](_0x8d6832);return _0x274155['set'](_0x92cc('0x1c'),_0xd467f5+'-'+_0x35f4d6+'/'+_0x10f9b1)['json'](_0x164a11);}return null;};}function patchUpdates(_0x5d4e12){return function(_0x6f7bf2){try{jsonpatch[_0x92cc('0x1d')](_0x6f7bf2,_0x5d4e12,!![]);}catch(_0x127829){return BPromise[_0x92cc('0x1e')](_0x127829);}return _0x6f7bf2[_0x92cc('0x1f')]();};}function saveUpdates(_0x7ab2df,_0x241906){return function(_0x247026){if(_0x247026){return _0x247026[_0x92cc('0x20')](_0x7ab2df)[_0x92cc('0x21')](function(_0x294196){return _0x294196;});}return null;};}function removeEntity(_0x1fe2c9,_0x52a77a){return function(_0x37c9cc){if(_0x37c9cc){return _0x37c9cc[_0x92cc('0x22')]()[_0x92cc('0x21')](function(){_0x1fe2c9[_0x92cc('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2af659,_0x59e998){return function(_0x5af2e0){if(!_0x5af2e0){_0x2af659[_0x92cc('0x16')](0x194);}return _0x5af2e0;};}function handleError(_0x2c3de5,_0x344ff1){_0x344ff1=_0x344ff1||0x1f4;return function(_0x5257c2){logger['error'](_0x5257c2[_0x92cc('0x23')]);if(_0x5257c2['name']){delete _0x5257c2[_0x92cc('0x24')];}_0x2c3de5[_0x92cc('0x17')](_0x344ff1)[_0x92cc('0x25')](_0x5257c2);};}exports[_0x92cc('0x26')]=function(_0x2f79b5,_0x3aac07){var _0x2f2715={},_0x435c66={},_0x2bf79f={'count':0x0,'rows':[]};var _0x1d22f8=_[_0x92cc('0x27')](db[_0x92cc('0x28')][_0x92cc('0x29')],function(_0x24532b){return{'name':_0x24532b[_0x92cc('0x2a')],'type':_0x24532b[_0x92cc('0x2b')]['key']};});_0x435c66[_0x92cc('0x2c')]=_['map'](_0x1d22f8,_0x92cc('0x24'));_0x435c66[_0x92cc('0x2d')]=_['keys'](_0x2f79b5[_0x92cc('0x2d')]);_0x435c66[_0x92cc('0x2e')]=_[_0x92cc('0x2f')](_0x435c66[_0x92cc('0x2c')],_0x435c66['query']);_0x2f2715[_0x92cc('0x30')]=_[_0x92cc('0x2f')](_0x435c66[_0x92cc('0x2c')],qs[_0x92cc('0x31')](_0x2f79b5[_0x92cc('0x2d')][_0x92cc('0x31')]));_0x2f2715[_0x92cc('0x30')]=_0x2f2715['attributes'][_0x92cc('0x32')]?_0x2f2715['attributes']:_0x435c66[_0x92cc('0x2c')];if(!_0x2f79b5[_0x92cc('0x2d')]['hasOwnProperty'](_0x92cc('0x33'))){_0x2f2715[_0x92cc('0x19')]=qs[_0x92cc('0x19')](_0x2f79b5['query']['limit']);_0x2f2715[_0x92cc('0x18')]=qs['offset'](_0x2f79b5['query'][_0x92cc('0x18')]);}_0x2f2715[_0x92cc('0x34')]=qs['sort'](_0x2f79b5[_0x92cc('0x2d')]['sort']);_0x2f2715['where']=qs[_0x92cc('0x2e')](_[_0x92cc('0x35')](_0x2f79b5[_0x92cc('0x2d')],_0x435c66[_0x92cc('0x2e')]),_0x1d22f8);if(_0x2f79b5['query'][_0x92cc('0x36')]){_0x2f2715['where']=_[_0x92cc('0x37')](_0x2f2715[_0x92cc('0x38')],{'$or':_[_0x92cc('0x27')](_0x1d22f8,function(_0x1f5484){if(_0x1f5484[_0x92cc('0x2b')]!==_0x92cc('0x39')){var _0x2c9248={};_0x2c9248[_0x1f5484[_0x92cc('0x24')]]={'$like':'%'+_0x2f79b5[_0x92cc('0x2d')]['filter']+'%'};return _0x2c9248;}})});}_0x2f2715=_[_0x92cc('0x37')]({},_0x2f2715,_0x2f79b5['options']);var _0x27dd65={'where':_0x2f2715[_0x92cc('0x38')]};return db[_0x92cc('0x28')]['count'](_0x27dd65)[_0x92cc('0x21')](function(_0x3f30c0){_0x2bf79f[_0x92cc('0x1b')]=_0x3f30c0;if(_0x2f79b5[_0x92cc('0x2d')][_0x92cc('0x3a')]){_0x2f2715[_0x92cc('0x3b')]=[{'all':!![]}];}return db[_0x92cc('0x28')][_0x92cc('0x3c')](_0x2f2715);})['then'](function(_0x28734c){_0x2bf79f[_0x92cc('0x3d')]=_0x28734c;return _0x2bf79f;})[_0x92cc('0x21')](respondWithFilteredResult(_0x3aac07,_0x2f2715))[_0x92cc('0x3e')](handleError(_0x3aac07,null));};exports[_0x92cc('0x3f')]=function(_0x433aa6,_0x3fd18a){var _0xd9fb0f={'raw':![],'where':{'id':_0x433aa6[_0x92cc('0x40')]['id']}},_0x4cd001={};_0x4cd001[_0x92cc('0x2c')]=_['keys'](db['DeskConfiguration']['rawAttributes']);_0x4cd001[_0x92cc('0x2d')]=_[_0x92cc('0x41')](_0x433aa6[_0x92cc('0x2d')]);_0x4cd001['filters']=_[_0x92cc('0x2f')](_0x4cd001[_0x92cc('0x2c')],_0x4cd001['query']);_0xd9fb0f[_0x92cc('0x30')]=_[_0x92cc('0x2f')](_0x4cd001[_0x92cc('0x2c')],qs[_0x92cc('0x31')](_0x433aa6[_0x92cc('0x2d')][_0x92cc('0x31')]));_0xd9fb0f[_0x92cc('0x30')]=_0xd9fb0f['attributes'][_0x92cc('0x32')]?_0xd9fb0f['attributes']:_0x4cd001[_0x92cc('0x2c')];if(_0x433aa6[_0x92cc('0x2d')][_0x92cc('0x3a')]){_0xd9fb0f[_0x92cc('0x3b')]=[{'all':!![]}];}_0xd9fb0f=_[_0x92cc('0x37')]({},_0xd9fb0f,_0x433aa6['options']);return db['DeskConfiguration'][_0x92cc('0x42')](_0xd9fb0f)[_0x92cc('0x21')](handleEntityNotFound(_0x3fd18a,null))[_0x92cc('0x21')](respondWithResult(_0x3fd18a,null))[_0x92cc('0x3e')](handleError(_0x3fd18a,null));};exports[_0x92cc('0x43')]=function(_0xa0ec64,_0x3aa93a){return db['DeskConfiguration'][_0x92cc('0x43')](_0xa0ec64['body'],{})[_0x92cc('0x21')](respondWithResult(_0x3aa93a,0xc9))[_0x92cc('0x3e')](handleError(_0x3aa93a,null));};exports['update']=function(_0x1d4164,_0xa01f52){if(_0x1d4164['body']['id']){delete _0x1d4164['body']['id'];}return db[_0x92cc('0x28')][_0x92cc('0x42')]({'where':{'id':_0x1d4164[_0x92cc('0x40')]['id']}})[_0x92cc('0x21')](handleEntityNotFound(_0xa01f52,null))[_0x92cc('0x21')](saveUpdates(_0x1d4164['body'],null))[_0x92cc('0x21')](respondWithResult(_0xa01f52,null))[_0x92cc('0x3e')](handleError(_0xa01f52,null));};exports[_0x92cc('0x22')]=function(_0x177f1b,_0x4e86b2){return db[_0x92cc('0x28')][_0x92cc('0x42')]({'where':{'id':_0x177f1b[_0x92cc('0x40')]['id']}})[_0x92cc('0x21')](handleEntityNotFound(_0x4e86b2,null))[_0x92cc('0x21')](removeEntity(_0x4e86b2,null))[_0x92cc('0x3e')](handleError(_0x4e86b2,null));};exports[_0x92cc('0x44')]=function(_0x569161,_0x9b1f8b,_0x15051f){var _0xde5075={};var _0x12561d={};var _0xe3e645;var _0x120bb1;return db[_0x92cc('0x28')][_0x92cc('0x45')]({'where':{'id':_0x569161['params']['id']}})[_0x92cc('0x21')](handleEntityNotFound(_0x9b1f8b,null))['then'](function(_0x34f7c7){if(_0x34f7c7){_0xe3e645=_0x34f7c7;_0x12561d['model']=_[_0x92cc('0x41')](db[_0x92cc('0x46')][_0x92cc('0x29')]);_0x12561d[_0x92cc('0x2d')]=_[_0x92cc('0x41')](_0x569161[_0x92cc('0x2d')]);_0x12561d[_0x92cc('0x2e')]=_[_0x92cc('0x2f')](_0x12561d[_0x92cc('0x2c')],_0x12561d[_0x92cc('0x2d')]);_0xde5075[_0x92cc('0x30')]=_['intersection'](_0x12561d[_0x92cc('0x2c')],qs['fields'](_0x569161[_0x92cc('0x2d')][_0x92cc('0x31')]));_0xde5075[_0x92cc('0x30')]=_0xde5075[_0x92cc('0x30')][_0x92cc('0x32')]?_0xde5075['attributes']:_0x12561d['model'];_0xde5075[_0x92cc('0x34')]=qs['sort'](_0x569161['query'][_0x92cc('0x47')]);_0xde5075[_0x92cc('0x38')]=qs[_0x92cc('0x2e')](_[_0x92cc('0x35')](_0x569161[_0x92cc('0x2d')],_0x12561d[_0x92cc('0x2e')]));if(_0x569161[_0x92cc('0x2d')][_0x92cc('0x36')]){_0xde5075[_0x92cc('0x38')]=_[_0x92cc('0x37')](_0xde5075[_0x92cc('0x38')],{'$or':_[_0x92cc('0x27')](_0xde5075['attributes'],function(_0xec5569){var _0x5dba18={};_0x5dba18[_0xec5569]={'$like':'%'+_0x569161['query'][_0x92cc('0x36')]+'%'};return _0x5dba18;})});}_0xde5075=_[_0x92cc('0x37')]({},_0xde5075,_0x569161['options']);return _0xe3e645[_0x92cc('0x44')](_0xde5075);}})[_0x92cc('0x21')](function(_0x26df6a){if(_0x26df6a){_0x120bb1=_0x26df6a[_0x92cc('0x32')];if(!_0x569161[_0x92cc('0x2d')][_0x92cc('0x48')](_0x92cc('0x33'))){_0xde5075['limit']=qs[_0x92cc('0x19')](_0x569161[_0x92cc('0x2d')][_0x92cc('0x19')]);_0xde5075[_0x92cc('0x18')]=qs[_0x92cc('0x18')](_0x569161[_0x92cc('0x2d')][_0x92cc('0x18')]);}return _0xe3e645[_0x92cc('0x44')](_0xde5075);}})[_0x92cc('0x21')](function(_0x16f060){if(_0x16f060){return _0x16f060?{'count':_0x120bb1,'rows':_0x16f060}:null;}})['then'](respondWithResult(_0x9b1f8b,null))['catch'](handleError(_0x9b1f8b,null));};exports[_0x92cc('0x49')]=function(_0x59819a,_0x206da9,_0x51d268){var _0x2f0b2c={};var _0x25afa9={};var _0x111402;var _0x347580;return db['DeskConfiguration']['findOne']({'where':{'id':_0x59819a['params']['id']}})[_0x92cc('0x21')](handleEntityNotFound(_0x206da9,null))[_0x92cc('0x21')](function(_0xf25743){if(_0xf25743){_0x111402=_0xf25743;_0x25afa9[_0x92cc('0x2c')]=_[_0x92cc('0x41')](db[_0x92cc('0x46')][_0x92cc('0x29')]);_0x25afa9[_0x92cc('0x2d')]=_['keys'](_0x59819a[_0x92cc('0x2d')]);_0x25afa9['filters']=_[_0x92cc('0x2f')](_0x25afa9['model'],_0x25afa9['query']);_0x2f0b2c[_0x92cc('0x30')]=_['intersection'](_0x25afa9['model'],qs['fields'](_0x59819a['query'][_0x92cc('0x31')]));_0x2f0b2c[_0x92cc('0x30')]=_0x2f0b2c[_0x92cc('0x30')][_0x92cc('0x32')]?_0x2f0b2c[_0x92cc('0x30')]:_0x25afa9['model'];_0x2f0b2c['order']=qs[_0x92cc('0x47')](_0x59819a[_0x92cc('0x2d')][_0x92cc('0x47')]);_0x2f0b2c[_0x92cc('0x38')]=qs[_0x92cc('0x2e')](_[_0x92cc('0x35')](_0x59819a[_0x92cc('0x2d')],_0x25afa9[_0x92cc('0x2e')]));if(_0x59819a[_0x92cc('0x2d')][_0x92cc('0x36')]){_0x2f0b2c[_0x92cc('0x38')]=_['merge'](_0x2f0b2c[_0x92cc('0x38')],{'$or':_[_0x92cc('0x27')](_0x2f0b2c[_0x92cc('0x30')],function(_0xdc1b59){var _0x46fbdb={};_0x46fbdb[_0xdc1b59]={'$like':'%'+_0x59819a[_0x92cc('0x2d')][_0x92cc('0x36')]+'%'};return _0x46fbdb;})});}_0x2f0b2c=_[_0x92cc('0x37')]({},_0x2f0b2c,_0x59819a[_0x92cc('0x4a')]);return _0x111402['getSubjects'](_0x2f0b2c);}})['then'](function(_0x21cea9){if(_0x21cea9){_0x347580=_0x21cea9['length'];if(!_0x59819a[_0x92cc('0x2d')][_0x92cc('0x48')](_0x92cc('0x33'))){_0x2f0b2c[_0x92cc('0x19')]=qs[_0x92cc('0x19')](_0x59819a[_0x92cc('0x2d')]['limit']);_0x2f0b2c[_0x92cc('0x18')]=qs[_0x92cc('0x18')](_0x59819a[_0x92cc('0x2d')][_0x92cc('0x18')]);}return _0x111402[_0x92cc('0x49')](_0x2f0b2c);}})[_0x92cc('0x21')](function(_0x5c5ea4){if(_0x5c5ea4){return _0x5c5ea4?{'count':_0x347580,'rows':_0x5c5ea4}:null;}})[_0x92cc('0x21')](respondWithResult(_0x206da9,null))[_0x92cc('0x3e')](handleError(_0x206da9,null));};exports['getDescriptions']=function(_0x51431b,_0x305d4b,_0x54763e){var _0x4c652e={};var _0x1ae082={};var _0x38c418;var _0x566eea;return db[_0x92cc('0x28')][_0x92cc('0x45')]({'where':{'id':_0x51431b[_0x92cc('0x40')]['id']}})['then'](handleEntityNotFound(_0x305d4b,null))[_0x92cc('0x21')](function(_0x57902f){if(_0x57902f){_0x38c418=_0x57902f;_0x1ae082[_0x92cc('0x2c')]=_[_0x92cc('0x41')](db[_0x92cc('0x46')][_0x92cc('0x29')]);_0x1ae082[_0x92cc('0x2d')]=_[_0x92cc('0x41')](_0x51431b[_0x92cc('0x2d')]);_0x1ae082[_0x92cc('0x2e')]=_['intersection'](_0x1ae082[_0x92cc('0x2c')],_0x1ae082[_0x92cc('0x2d')]);_0x4c652e[_0x92cc('0x30')]=_[_0x92cc('0x2f')](_0x1ae082[_0x92cc('0x2c')],qs[_0x92cc('0x31')](_0x51431b['query'][_0x92cc('0x31')]));_0x4c652e[_0x92cc('0x30')]=_0x4c652e[_0x92cc('0x30')]['length']?_0x4c652e['attributes']:_0x1ae082[_0x92cc('0x2c')];_0x4c652e[_0x92cc('0x34')]=qs[_0x92cc('0x47')](_0x51431b[_0x92cc('0x2d')]['sort']);_0x4c652e[_0x92cc('0x38')]=qs[_0x92cc('0x2e')](_['pick'](_0x51431b[_0x92cc('0x2d')],_0x1ae082[_0x92cc('0x2e')]));if(_0x51431b[_0x92cc('0x2d')][_0x92cc('0x36')]){_0x4c652e[_0x92cc('0x38')]=_[_0x92cc('0x37')](_0x4c652e['where'],{'$or':_[_0x92cc('0x27')](_0x4c652e[_0x92cc('0x30')],function(_0xbb73a7){var _0x920e46={};_0x920e46[_0xbb73a7]={'$like':'%'+_0x51431b[_0x92cc('0x2d')]['filter']+'%'};return _0x920e46;})});}_0x4c652e=_[_0x92cc('0x37')]({},_0x4c652e,_0x51431b[_0x92cc('0x4a')]);return _0x38c418[_0x92cc('0x4b')](_0x4c652e);}})['then'](function(_0x105f16){if(_0x105f16){_0x566eea=_0x105f16[_0x92cc('0x32')];if(!_0x51431b[_0x92cc('0x2d')][_0x92cc('0x48')]('nolimit')){_0x4c652e[_0x92cc('0x19')]=qs[_0x92cc('0x19')](_0x51431b[_0x92cc('0x2d')][_0x92cc('0x19')]);_0x4c652e[_0x92cc('0x18')]=qs[_0x92cc('0x18')](_0x51431b[_0x92cc('0x2d')][_0x92cc('0x18')]);}return _0x38c418['getDescriptions'](_0x4c652e);}})[_0x92cc('0x21')](function(_0xf64372){if(_0xf64372){return _0xf64372?{'count':_0x566eea,'rows':_0xf64372}:null;}})[_0x92cc('0x21')](respondWithResult(_0x305d4b,null))[_0x92cc('0x3e')](handleError(_0x305d4b,null));};exports[_0x92cc('0x4c')]=function(_0x368e60,_0x413e91,_0x10f702){var _0x546b89={};var _0x4669fc={};var _0x420742;var _0x496b82;return db[_0x92cc('0x28')][_0x92cc('0x45')]({'where':{'id':_0x368e60[_0x92cc('0x40')]['id']}})[_0x92cc('0x21')](handleEntityNotFound(_0x413e91,null))['then'](function(_0x3dd687){if(_0x3dd687){_0x420742=_0x3dd687;_0x4669fc[_0x92cc('0x2c')]=_[_0x92cc('0x41')](db[_0x92cc('0x4d')][_0x92cc('0x29')]);_0x4669fc[_0x92cc('0x2d')]=_[_0x92cc('0x41')](_0x368e60['query']);_0x4669fc['filters']=_[_0x92cc('0x2f')](_0x4669fc[_0x92cc('0x2c')],_0x4669fc[_0x92cc('0x2d')]);_0x546b89['attributes']=_[_0x92cc('0x2f')](_0x4669fc[_0x92cc('0x2c')],qs[_0x92cc('0x31')](_0x368e60[_0x92cc('0x2d')][_0x92cc('0x31')]));_0x546b89[_0x92cc('0x30')]=_0x546b89[_0x92cc('0x30')][_0x92cc('0x32')]?_0x546b89[_0x92cc('0x30')]:_0x4669fc[_0x92cc('0x2c')];_0x546b89[_0x92cc('0x34')]=qs['sort'](_0x368e60[_0x92cc('0x2d')][_0x92cc('0x47')]);_0x546b89[_0x92cc('0x38')]=qs['filters'](_['pick'](_0x368e60[_0x92cc('0x2d')],_0x4669fc[_0x92cc('0x2e')]));if(_0x368e60[_0x92cc('0x2d')][_0x92cc('0x36')]){_0x546b89[_0x92cc('0x38')]=_[_0x92cc('0x37')](_0x546b89[_0x92cc('0x38')],{'$or':_[_0x92cc('0x27')](_0x546b89[_0x92cc('0x30')],function(_0x22f1b8){var _0xd47942={};_0xd47942[_0x22f1b8]={'$like':'%'+_0x368e60['query'][_0x92cc('0x36')]+'%'};return _0xd47942;})});}_0x546b89=_[_0x92cc('0x37')]({},_0x546b89,_0x368e60[_0x92cc('0x4a')]);return _0x420742['getTags'](_0x546b89);}})[_0x92cc('0x21')](function(_0x471c90){if(_0x471c90){_0x496b82=_0x471c90[_0x92cc('0x32')];if(!_0x368e60[_0x92cc('0x2d')][_0x92cc('0x48')](_0x92cc('0x33'))){_0x546b89[_0x92cc('0x19')]=qs[_0x92cc('0x19')](_0x368e60[_0x92cc('0x2d')][_0x92cc('0x19')]);_0x546b89[_0x92cc('0x18')]=qs['offset'](_0x368e60[_0x92cc('0x2d')][_0x92cc('0x18')]);}return _0x420742[_0x92cc('0x4c')](_0x546b89);}})[_0x92cc('0x21')](function(_0x42e4fb){if(_0x42e4fb){return _0x42e4fb?{'count':_0x496b82,'rows':_0x42e4fb}:null;}})['then'](respondWithResult(_0x413e91,null))['catch'](handleError(_0x413e91,null));};exports[_0x92cc('0x4e')]=function(_0x48d64a,_0xfc06b5,_0x55009c){if(_0x48d64a[_0x92cc('0x4f')]['id']){delete _0x48d64a[_0x92cc('0x4f')]['id'];}return db[_0x92cc('0x28')]['findOne']({'where':{'id':_0x48d64a[_0x92cc('0x40')]['id']}})[_0x92cc('0x21')](handleEntityNotFound(_0xfc06b5,null))['then'](function(_0x274564){if(_0x274564){return _0x274564[_0x92cc('0x4e')](_0x48d64a[_0x92cc('0x4f')][_0x92cc('0x50')]||[]);}return null;})[_0x92cc('0x21')](respondWithResult(_0xfc06b5,null))[_0x92cc('0x3e')](handleError(_0xfc06b5,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 701f13c..a718ab6 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 _0xb750=['path','../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','../../config/logger','api','moment','request-promise'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xb750,0x146));var _0x0b75=function(_0x5a5b14,_0xa5327b){_0x5a5b14=_0x5a5b14-0x0;var _0x45ab7a=_0xb750[_0x5a5b14];return _0x45ab7a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0b75('0x0'))(_0x0b75('0x1'));var moment=require(_0x0b75('0x2'));var BPromise=require('bluebird');var rp=require(_0x0b75('0x3'));var fs=require('fs');var path=require(_0x0b75('0x4'));var rimraf=require('rimraf');var config=require(_0x0b75('0x5'));var attributes=require(_0x0b75('0x6'));module['exports']=function(_0x4eb94e,_0x5508e4){return _0x4eb94e[_0x0b75('0x7')](_0x0b75('0x8'),attributes,{'tableName':_0x0b75('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadc9=['path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xf11596,_0x18bfb1){var _0x3459cf=function(_0x4f893b){while(--_0x4f893b){_0xf11596['push'](_0xf11596['shift']());}};_0x3459cf(++_0x18bfb1);}(_0xadc9,0x94));var _0x9adc=function(_0x5af8af,_0x6df2cd){_0x5af8af=_0x5af8af-0x0;var _0x59da8f=_0xadc9[_0x5af8af];return _0x59da8f;};'use strict';var _=require(_0x9adc('0x0'));var util=require(_0x9adc('0x1'));var logger=require(_0x9adc('0x2'))(_0x9adc('0x3'));var moment=require(_0x9adc('0x4'));var BPromise=require(_0x9adc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9adc('0x6'));var rimraf=require(_0x9adc('0x7'));var config=require(_0x9adc('0x8'));var attributes=require(_0x9adc('0x9'));module[_0x9adc('0xa')]=function(_0x2f7f9d,_0x2aa6d1){return _0x2f7f9d[_0x9adc('0xb')](_0x9adc('0xc'),attributes,{'tableName':_0x9adc('0xd'),'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 c378494..af297d4 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 _0xd7ab=['http','then','info','debug','stringify','error','code','message','DeskConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment'];(function(_0x5a529b,_0x555ba9){var _0x3a1ab5=function(_0x32d72b){while(--_0x32d72b){_0x5a529b['push'](_0x5a529b['shift']());}};_0x3a1ab5(++_0x555ba9);}(_0xd7ab,0x14e));var _0xbd7a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd7ab[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xbd7a('0x0'));var util=require(_0xbd7a('0x1'));var moment=require(_0xbd7a('0x2'));var BPromise=require(_0xbd7a('0x3'));var rs=require(_0xbd7a('0x4'));var fs=require('fs');var Redis=require(_0xbd7a('0x5'));var db=require(_0xbd7a('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xbd7a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbd7a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x331bcb,_0x407f62,_0x5ccda4){return new BPromise(function(_0x3eb09d,_0x2aa782){return client['request'](_0x331bcb,_0x5ccda4)[_0xbd7a('0x9')](function(_0x5c8abe){logger[_0xbd7a('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0x407f62,'request\x20sent');logger[_0xbd7a('0xb')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x407f62,'request\x20sent',JSON[_0xbd7a('0xc')](_0x5c8abe));if(_0x5c8abe[_0xbd7a('0xd')]){if(_0x5c8abe[_0xbd7a('0xd')][_0xbd7a('0xe')]===0x1f4){logger[_0xbd7a('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x407f62,_0x5c8abe[_0xbd7a('0xd')]['message']);return _0x2aa782(_0x5c8abe[_0xbd7a('0xd')][_0xbd7a('0xf')]);}logger[_0xbd7a('0xd')](_0xbd7a('0x10'),_0x407f62,_0x5c8abe[_0xbd7a('0xd')][_0xbd7a('0xf')]);return _0x3eb09d(_0x5c8abe['error'][_0xbd7a('0xf')]);}else{logger['info'](_0xbd7a('0x10'),_0x407f62,'request\x20sent');_0x3eb09d(_0x5c8abe[_0xbd7a('0x11')][_0xbd7a('0xf')]);}})[_0xbd7a('0x12')](function(_0xcc7ad3){logger[_0xbd7a('0xd')](_0xbd7a('0x10'),_0x407f62,_0xcc7ad3);_0x2aa782(_0xcc7ad3);});});} \ No newline at end of file +var _0xe820=['message','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xe820,0xd2));var _0x0e82=function(_0x28359e,_0x4a7c19){_0x28359e=_0x28359e-0x0;var _0x108990=_0xe820[_0x28359e];return _0x108990;};'use strict';var _=require(_0x0e82('0x0'));var util=require('util');var moment=require(_0x0e82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e82('0x2'));var db=require(_0x0e82('0x3'))['db'];var utils=require(_0x0e82('0x4'));var logger=require('../../config/logger')(_0x0e82('0x5'));var config=require('../../config/environment');var jayson=require(_0x0e82('0x6'));var client=jayson[_0x0e82('0x7')][_0x0e82('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x328b32,_0x2a0f9b,_0x55f277){return new BPromise(function(_0x10013b,_0x33c8a2){return client[_0x0e82('0x9')](_0x328b32,_0x55f277)[_0x0e82('0xa')](function(_0x3b7792){logger['info'](_0x0e82('0xb'),_0x2a0f9b,_0x0e82('0xc'));logger[_0x0e82('0xd')](_0x0e82('0xe'),_0x2a0f9b,_0x0e82('0xc'),JSON[_0x0e82('0xf')](_0x3b7792));if(_0x3b7792[_0x0e82('0x10')]){if(_0x3b7792['error'][_0x0e82('0x11')]===0x1f4){logger[_0x0e82('0x10')](_0x0e82('0xb'),_0x2a0f9b,_0x3b7792[_0x0e82('0x10')][_0x0e82('0x12')]);return _0x33c8a2(_0x3b7792[_0x0e82('0x10')]['message']);}logger[_0x0e82('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x2a0f9b,_0x3b7792['error'][_0x0e82('0x12')]);return _0x10013b(_0x3b7792['error']['message']);}else{logger['info'](_0x0e82('0xb'),_0x2a0f9b,'request\x20sent');_0x10013b(_0x3b7792['result'][_0x0e82('0x12')]);}})['catch'](function(_0x319303){logger[_0x0e82('0x10')](_0x0e82('0xb'),_0x2a0f9b,_0x319303);_0x33c8a2(_0x319303);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 204dbe6..5952a7b 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 _0x1f3d=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','isAuthenticated','/:id','post','create','update','delete','destroy'];(function(_0x15ce0a,_0x1b9a89){var _0x2e49fe=function(_0x366b86){while(--_0x366b86){_0x15ce0a['push'](_0x15ce0a['shift']());}};_0x2e49fe(++_0x1b9a89);}(_0x1f3d,0x10f));var _0xd1f3=function(_0x41e80c,_0x1189e7){_0x41e80c=_0x41e80c-0x0;var _0x5f201f=_0x1f3d[_0x41e80c];return _0x5f201f;};'use strict';var multer=require(_0xd1f3('0x0'));var util=require(_0xd1f3('0x1'));var path=require(_0xd1f3('0x2'));var timeout=require('connect-timeout');var express=require(_0xd1f3('0x3'));var router=express[_0xd1f3('0x4')]();var fs_extra=require(_0xd1f3('0x5'));var auth=require(_0xd1f3('0x6'));var interaction=require(_0xd1f3('0x7'));var config=require('../../config/environment');var controller=require(_0xd1f3('0x8'));router[_0xd1f3('0x9')]('/',auth[_0xd1f3('0xa')](),controller['index']);router[_0xd1f3('0x9')](_0xd1f3('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xd1f3('0xc')]('/',auth[_0xd1f3('0xa')](),controller[_0xd1f3('0xd')]);router['put'](_0xd1f3('0xb'),auth[_0xd1f3('0xa')](),controller[_0xd1f3('0xe')]);router[_0xd1f3('0xf')](_0xd1f3('0xb'),auth[_0xd1f3('0xa')](),controller[_0xd1f3('0x10')]);module[_0xd1f3('0x11')]=router; \ No newline at end of file +var _0x74e6=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','get','/:id','put','update','delete','destroy','exports','multer'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x74e6,0xed));var _0x674e=function(_0x783414,_0x312c77){_0x783414=_0x783414-0x0;var _0x294b0f=_0x74e6[_0x783414];return _0x294b0f;};'use strict';var multer=require(_0x674e('0x0'));var util=require(_0x674e('0x1'));var path=require(_0x674e('0x2'));var timeout=require(_0x674e('0x3'));var express=require('express');var router=express[_0x674e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x674e('0x5'));var interaction=require(_0x674e('0x6'));var config=require(_0x674e('0x7'));var controller=require(_0x674e('0x8'));router['get']('/',auth[_0x674e('0x9')](),controller['index']);router[_0x674e('0xa')](_0x674e('0xb'),auth[_0x674e('0x9')](),controller['show']);router['post']('/',auth[_0x674e('0x9')](),controller['create']);router[_0x674e('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x674e('0xd')]);router[_0x674e('0xe')](_0x674e('0xb'),auth[_0x674e('0x9')](),controller[_0x674e('0xf')]);module[_0x674e('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 6f0b84b..e5a4853 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 _0x9591=['customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x151300,_0x2068ea){var _0x516611=function(_0x2e637a){while(--_0x2e637a){_0x151300['push'](_0x151300['shift']());}};_0x516611(++_0x2068ea);}(_0x9591,0x1aa));var _0x1959=function(_0x325aea,_0x22377b){_0x325aea=_0x325aea-0x0;var _0x1609fc=_0x9591[_0x325aea];return _0x1609fc;};'use strict';var Sequelize=require(_0x1959('0x0'));module[_0x1959('0x1')]={'type':{'type':Sequelize[_0x1959('0x2')](_0x1959('0x3'),'variable',_0x1959('0x4'),_0x1959('0x5'),_0x1959('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1959('0x7')]},'keyType':{'type':Sequelize[_0x1959('0x2')](_0x1959('0x3'),_0x1959('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x1959('0x7')]},'idField':{'type':Sequelize[_0x1959('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1959('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1959('0x7')]}}; \ No newline at end of file +var _0xe318=['variable','keyValue','picklist','STRING','sequelize','ENUM','string'];(function(_0xf031c7,_0x2feb97){var _0x63320b=function(_0xb3bd54){while(--_0xb3bd54){_0xf031c7['push'](_0xf031c7['shift']());}};_0x63320b(++_0x2feb97);}(_0xe318,0x97));var _0x8e31=function(_0x5aa1dc,_0x34b45){_0x5aa1dc=_0x5aa1dc-0x0;var _0x59ec02=_0xe318[_0x5aa1dc];return _0x59ec02;};'use strict';var Sequelize=require(_0x8e31('0x0'));module['exports']={'type':{'type':Sequelize[_0x8e31('0x1')](_0x8e31('0x2'),_0x8e31('0x3'),'customVariable',_0x8e31('0x4'),_0x8e31('0x5')),'defaultValue':_0x8e31('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8e31('0x6')]},'keyType':{'type':Sequelize[_0x8e31('0x1')](_0x8e31('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x8e31('0x6')]},'idField':{'type':Sequelize[_0x8e31('0x6')]},'nameField':{'type':Sequelize[_0x8e31('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8e31('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index cce95d0..ac5dd82 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 _0xf78f=['stack','name','send','index','map','DeskField','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','update','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error'];(function(_0xf55e73,_0x3fecc5){var _0x116b99=function(_0x314e0c){while(--_0x314e0c){_0xf55e73['push'](_0xf55e73['shift']());}};_0x116b99(++_0x3fecc5);}(_0xf78f,0x72));var _0xff78=function(_0x48bab2,_0x4f3b53){_0x48bab2=_0x48bab2-0x0;var _0xf41d3c=_0xf78f[_0x48bab2];return _0xf41d3c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xff78('0x0'));var zipdir=require(_0xff78('0x1'));var jsonpatch=require(_0xff78('0x2'));var rp=require(_0xff78('0x3'));var moment=require(_0xff78('0x4'));var BPromise=require(_0xff78('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xff78('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xff78('0x7'));var squel=require(_0xff78('0x8'));var crypto=require(_0xff78('0x9'));var jsforce=require(_0xff78('0xa'));var deskjs=require(_0xff78('0xb'));var toCsv=require(_0xff78('0xc'));var querystring=require(_0xff78('0xd'));var Papa=require(_0xff78('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xff78('0xf'));var as=require(_0xff78('0x10'));var hardwareService=require(_0xff78('0x11'));var logger=require(_0xff78('0x12'))(_0xff78('0x13'));var utils=require(_0xff78('0x14'));var config=require(_0xff78('0x15'));var licenseUtil=require(_0xff78('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d325b,_0x25c5db){_0x25c5db=_0x25c5db||0xcc;return function(_0x52ea61){if(_0x52ea61){return _0x1d325b[_0xff78('0x17')](_0x25c5db);}return _0x1d325b['status'](_0x25c5db)[_0xff78('0x18')]();};}function respondWithResult(_0x532f51,_0x848823){_0x848823=_0x848823||0xc8;return function(_0x27c281){if(_0x27c281){return _0x532f51[_0xff78('0x19')](_0x848823)[_0xff78('0x1a')](_0x27c281);}};}function respondWithFilteredResult(_0x52bbf1,_0x2a0e95){return function(_0x150d87){if(_0x150d87){var _0x21b5ef=typeof _0x2a0e95[_0xff78('0x1b')]===_0xff78('0x1c')&&typeof _0x2a0e95[_0xff78('0x1d')]===_0xff78('0x1c');var _0x5dfd19=_0x150d87[_0xff78('0x1e')];var _0x183cd1=_0x21b5ef?0x0:_0x2a0e95[_0xff78('0x1b')];var _0x201af4=_0x21b5ef?_0x150d87[_0xff78('0x1e')]:_0x2a0e95[_0xff78('0x1b')]+_0x2a0e95[_0xff78('0x1d')];var _0xf0c91b;if(_0x201af4>=_0x5dfd19){_0x201af4=_0x5dfd19;_0xf0c91b=0xc8;}else{_0xf0c91b=0xce;}_0x52bbf1['status'](_0xf0c91b);return _0x52bbf1[_0xff78('0x1f')](_0xff78('0x20'),_0x183cd1+'-'+_0x201af4+'/'+_0x5dfd19)[_0xff78('0x1a')](_0x150d87);}return null;};}function patchUpdates(_0x4dd9fa){return function(_0x2cee04){try{jsonpatch['apply'](_0x2cee04,_0x4dd9fa,!![]);}catch(_0x16ed8e){return BPromise[_0xff78('0x21')](_0x16ed8e);}return _0x2cee04[_0xff78('0x22')]();};}function saveUpdates(_0xe2be6e,_0xe22c7e){return function(_0x4ebf5e){if(_0x4ebf5e){return _0x4ebf5e['update'](_0xe2be6e)[_0xff78('0x23')](function(_0x9f79f){return _0x9f79f;});}return null;};}function removeEntity(_0xd827a4,_0x600dbe){return function(_0x1dd2a2){if(_0x1dd2a2){return _0x1dd2a2[_0xff78('0x24')]()[_0xff78('0x23')](function(){_0xd827a4[_0xff78('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x184563,_0x122b5e){return function(_0x395734){if(!_0x395734){_0x184563[_0xff78('0x17')](0x194);}return _0x395734;};}function handleError(_0x5591fa,_0x2e4176){_0x2e4176=_0x2e4176||0x1f4;return function(_0xb77e22){logger[_0xff78('0x25')](_0xb77e22[_0xff78('0x26')]);if(_0xb77e22[_0xff78('0x27')]){delete _0xb77e22['name'];}_0x5591fa[_0xff78('0x19')](_0x2e4176)[_0xff78('0x28')](_0xb77e22);};}exports[_0xff78('0x29')]=function(_0x2e716b,_0x16b546){var _0x5a49f5={},_0x3500cc={},_0x35354b={'count':0x0,'rows':[]};var _0x473d9e=_[_0xff78('0x2a')](db[_0xff78('0x2b')]['rawAttributes'],function(_0x3d1a4a){return{'name':_0x3d1a4a[_0xff78('0x2c')],'type':_0x3d1a4a[_0xff78('0x2d')][_0xff78('0x2e')]};});_0x3500cc['model']=_[_0xff78('0x2a')](_0x473d9e,_0xff78('0x27'));_0x3500cc[_0xff78('0x2f')]=_[_0xff78('0x30')](_0x2e716b[_0xff78('0x2f')]);_0x3500cc[_0xff78('0x31')]=_[_0xff78('0x32')](_0x3500cc[_0xff78('0x33')],_0x3500cc['query']);_0x5a49f5[_0xff78('0x34')]=_[_0xff78('0x32')](_0x3500cc[_0xff78('0x33')],qs[_0xff78('0x35')](_0x2e716b[_0xff78('0x2f')][_0xff78('0x35')]));_0x5a49f5[_0xff78('0x34')]=_0x5a49f5['attributes'][_0xff78('0x36')]?_0x5a49f5['attributes']:_0x3500cc[_0xff78('0x33')];if(!_0x2e716b[_0xff78('0x2f')][_0xff78('0x37')](_0xff78('0x38'))){_0x5a49f5['limit']=qs[_0xff78('0x1d')](_0x2e716b[_0xff78('0x2f')][_0xff78('0x1d')]);_0x5a49f5[_0xff78('0x1b')]=qs[_0xff78('0x1b')](_0x2e716b[_0xff78('0x2f')][_0xff78('0x1b')]);}_0x5a49f5[_0xff78('0x39')]=qs[_0xff78('0x3a')](_0x2e716b[_0xff78('0x2f')][_0xff78('0x3a')]);_0x5a49f5['where']=qs[_0xff78('0x31')](_[_0xff78('0x3b')](_0x2e716b[_0xff78('0x2f')],_0x3500cc[_0xff78('0x31')]),_0x473d9e);if(_0x2e716b[_0xff78('0x2f')][_0xff78('0x3c')]){_0x5a49f5[_0xff78('0x3d')]=_[_0xff78('0x3e')](_0x5a49f5[_0xff78('0x3d')],{'$or':_['map'](_0x473d9e,function(_0x5729db){if(_0x5729db[_0xff78('0x2d')]!==_0xff78('0x3f')){var _0x565da3={};_0x565da3[_0x5729db['name']]={'$like':'%'+_0x2e716b['query'][_0xff78('0x3c')]+'%'};return _0x565da3;}})});}_0x5a49f5=_['merge']({},_0x5a49f5,_0x2e716b[_0xff78('0x40')]);var _0x2afd94={'where':_0x5a49f5[_0xff78('0x3d')]};return db[_0xff78('0x2b')][_0xff78('0x1e')](_0x2afd94)['then'](function(_0x31b444){_0x35354b[_0xff78('0x1e')]=_0x31b444;if(_0x2e716b['query'][_0xff78('0x41')]){_0x5a49f5[_0xff78('0x42')]=[{'all':!![]}];}return db[_0xff78('0x2b')]['findAll'](_0x5a49f5);})[_0xff78('0x23')](function(_0x1a6221){_0x35354b[_0xff78('0x43')]=_0x1a6221;return _0x35354b;})['then'](respondWithFilteredResult(_0x16b546,_0x5a49f5))[_0xff78('0x44')](handleError(_0x16b546,null));};exports[_0xff78('0x45')]=function(_0x448a87,_0xfcc444){var _0x3fdcb4={'raw':!![],'where':{'id':_0x448a87[_0xff78('0x46')]['id']}},_0x2d0f87={};_0x2d0f87[_0xff78('0x33')]=_[_0xff78('0x30')](db[_0xff78('0x2b')][_0xff78('0x47')]);_0x2d0f87['query']=_['keys'](_0x448a87[_0xff78('0x2f')]);_0x2d0f87['filters']=_[_0xff78('0x32')](_0x2d0f87[_0xff78('0x33')],_0x2d0f87[_0xff78('0x2f')]);_0x3fdcb4[_0xff78('0x34')]=_[_0xff78('0x32')](_0x2d0f87[_0xff78('0x33')],qs[_0xff78('0x35')](_0x448a87[_0xff78('0x2f')][_0xff78('0x35')]));_0x3fdcb4[_0xff78('0x34')]=_0x3fdcb4[_0xff78('0x34')][_0xff78('0x36')]?_0x3fdcb4[_0xff78('0x34')]:_0x2d0f87[_0xff78('0x33')];if(_0x448a87[_0xff78('0x2f')][_0xff78('0x41')]){_0x3fdcb4[_0xff78('0x42')]=[{'all':!![]}];}_0x3fdcb4=_[_0xff78('0x3e')]({},_0x3fdcb4,_0x448a87['options']);return db['DeskField']['find'](_0x3fdcb4)[_0xff78('0x23')](handleEntityNotFound(_0xfcc444,null))[_0xff78('0x23')](respondWithResult(_0xfcc444,null))[_0xff78('0x44')](handleError(_0xfcc444,null));};exports[_0xff78('0x48')]=function(_0x48a900,_0x25d896){return db['DeskField'][_0xff78('0x48')](_0x48a900[_0xff78('0x49')],{})[_0xff78('0x23')](respondWithResult(_0x25d896,0xc9))[_0xff78('0x44')](handleError(_0x25d896,null));};exports[_0xff78('0x4a')]=function(_0x4508bc,_0x3b48fd){if(_0x4508bc['body']['id']){delete _0x4508bc['body']['id'];}return db[_0xff78('0x2b')][_0xff78('0x4b')]({'where':{'id':_0x4508bc['params']['id']}})[_0xff78('0x23')](handleEntityNotFound(_0x3b48fd,null))['then'](saveUpdates(_0x4508bc[_0xff78('0x49')],null))[_0xff78('0x23')](respondWithResult(_0x3b48fd,null))[_0xff78('0x44')](handleError(_0x3b48fd,null));};exports[_0xff78('0x24')]=function(_0x371968,_0x7530e4){return db[_0xff78('0x2b')][_0xff78('0x4b')]({'where':{'id':_0x371968[_0xff78('0x46')]['id']}})[_0xff78('0x23')](handleEntityNotFound(_0x7530e4,null))[_0xff78('0x23')](removeEntity(_0x7530e4,null))['catch'](handleError(_0x7530e4,null));}; \ No newline at end of file +var _0xdfd2=['destroy','then','error','stack','name','index','DeskField','fieldName','key','map','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','catch','params','keys','includeAll','create','body','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save'];(function(_0x44f18c,_0x32f655){var _0xa22910=function(_0x406fd4){while(--_0x406fd4){_0x44f18c['push'](_0x44f18c['shift']());}};_0xa22910(++_0x32f655);}(_0xdfd2,0xf6));var _0x2dfd=function(_0xd3e346,_0x429d1b){_0xd3e346=_0xd3e346-0x0;var _0x4ab747=_0xdfd2[_0xd3e346];return _0x4ab747;};'use strict';var emlformat=require(_0x2dfd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2dfd('0x1'));var jsonpatch=require(_0x2dfd('0x2'));var rp=require('request-promise');var moment=require(_0x2dfd('0x3'));var BPromise=require(_0x2dfd('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2dfd('0x5'));var sox=require(_0x2dfd('0x6'));var csv=require(_0x2dfd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2dfd('0x8'));var squel=require(_0x2dfd('0x9'));var crypto=require(_0x2dfd('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2dfd('0xb'));var toCsv=require(_0x2dfd('0x7'));var querystring=require(_0x2dfd('0xc'));var Papa=require(_0x2dfd('0xd'));var Redis=require(_0x2dfd('0xe'));var authService=require(_0x2dfd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2dfd('0x10'));var hardwareService=require(_0x2dfd('0x11'));var logger=require(_0x2dfd('0x12'))(_0x2dfd('0x13'));var utils=require(_0x2dfd('0x14'));var config=require(_0x2dfd('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2595bc,_0x5d13de){_0x5d13de=_0x5d13de||0xcc;return function(_0x14b1dd){if(_0x14b1dd){return _0x2595bc[_0x2dfd('0x16')](_0x5d13de);}return _0x2595bc[_0x2dfd('0x17')](_0x5d13de)[_0x2dfd('0x18')]();};}function respondWithResult(_0x6653cd,_0x432d63){_0x432d63=_0x432d63||0xc8;return function(_0x21d7f3){if(_0x21d7f3){return _0x6653cd[_0x2dfd('0x17')](_0x432d63)['json'](_0x21d7f3);}};}function respondWithFilteredResult(_0x22f717,_0x413ee4){return function(_0x214441){if(_0x214441){var _0x48ec9b=typeof _0x413ee4[_0x2dfd('0x19')]==='undefined'&&typeof _0x413ee4['limit']===_0x2dfd('0x1a');var _0x19676c=_0x214441[_0x2dfd('0x1b')];var _0x336146=_0x48ec9b?0x0:_0x413ee4[_0x2dfd('0x19')];var _0x4cd8de=_0x48ec9b?_0x214441[_0x2dfd('0x1b')]:_0x413ee4[_0x2dfd('0x19')]+_0x413ee4[_0x2dfd('0x1c')];var _0x211e89;if(_0x4cd8de>=_0x19676c){_0x4cd8de=_0x19676c;_0x211e89=0xc8;}else{_0x211e89=0xce;}_0x22f717[_0x2dfd('0x17')](_0x211e89);return _0x22f717[_0x2dfd('0x1d')](_0x2dfd('0x1e'),_0x336146+'-'+_0x4cd8de+'/'+_0x19676c)[_0x2dfd('0x1f')](_0x214441);}return null;};}function patchUpdates(_0x2fa9d0){return function(_0x592d3e){try{jsonpatch['apply'](_0x592d3e,_0x2fa9d0,!![]);}catch(_0x4db0df){return BPromise[_0x2dfd('0x20')](_0x4db0df);}return _0x592d3e[_0x2dfd('0x21')]();};}function saveUpdates(_0x31a749,_0x813475){return function(_0x53895f){if(_0x53895f){return _0x53895f['update'](_0x31a749)['then'](function(_0x20d490){return _0x20d490;});}return null;};}function removeEntity(_0x1e61cd,_0x310421){return function(_0x50e1ca){if(_0x50e1ca){return _0x50e1ca[_0x2dfd('0x22')]()[_0x2dfd('0x23')](function(){_0x1e61cd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e3a33,_0xff43b){return function(_0x5d13ec){if(!_0x5d13ec){_0x1e3a33['sendStatus'](0x194);}return _0x5d13ec;};}function handleError(_0xf4a2e8,_0x1dbc5a){_0x1dbc5a=_0x1dbc5a||0x1f4;return function(_0x144e43){logger[_0x2dfd('0x24')](_0x144e43[_0x2dfd('0x25')]);if(_0x144e43[_0x2dfd('0x26')]){delete _0x144e43[_0x2dfd('0x26')];}_0xf4a2e8['status'](_0x1dbc5a)['send'](_0x144e43);};}exports[_0x2dfd('0x27')]=function(_0x2bd5aa,_0x5910cb){var _0x4b1be3={},_0x1117d4={},_0x4eb72c={'count':0x0,'rows':[]};var _0x3920a7=_['map'](db[_0x2dfd('0x28')]['rawAttributes'],function(_0x4c840f){return{'name':_0x4c840f[_0x2dfd('0x29')],'type':_0x4c840f['type'][_0x2dfd('0x2a')]};});_0x1117d4['model']=_[_0x2dfd('0x2b')](_0x3920a7,_0x2dfd('0x26'));_0x1117d4[_0x2dfd('0x2c')]=_['keys'](_0x2bd5aa[_0x2dfd('0x2c')]);_0x1117d4[_0x2dfd('0x2d')]=_[_0x2dfd('0x2e')](_0x1117d4['model'],_0x1117d4[_0x2dfd('0x2c')]);_0x4b1be3[_0x2dfd('0x2f')]=_[_0x2dfd('0x2e')](_0x1117d4[_0x2dfd('0x30')],qs[_0x2dfd('0x31')](_0x2bd5aa[_0x2dfd('0x2c')][_0x2dfd('0x31')]));_0x4b1be3[_0x2dfd('0x2f')]=_0x4b1be3[_0x2dfd('0x2f')][_0x2dfd('0x32')]?_0x4b1be3[_0x2dfd('0x2f')]:_0x1117d4[_0x2dfd('0x30')];if(!_0x2bd5aa['query'][_0x2dfd('0x33')](_0x2dfd('0x34'))){_0x4b1be3[_0x2dfd('0x1c')]=qs[_0x2dfd('0x1c')](_0x2bd5aa[_0x2dfd('0x2c')][_0x2dfd('0x1c')]);_0x4b1be3[_0x2dfd('0x19')]=qs[_0x2dfd('0x19')](_0x2bd5aa[_0x2dfd('0x2c')][_0x2dfd('0x19')]);}_0x4b1be3[_0x2dfd('0x35')]=qs['sort'](_0x2bd5aa['query'][_0x2dfd('0x36')]);_0x4b1be3[_0x2dfd('0x37')]=qs['filters'](_[_0x2dfd('0x38')](_0x2bd5aa[_0x2dfd('0x2c')],_0x1117d4['filters']),_0x3920a7);if(_0x2bd5aa[_0x2dfd('0x2c')][_0x2dfd('0x39')]){_0x4b1be3[_0x2dfd('0x37')]=_[_0x2dfd('0x3a')](_0x4b1be3[_0x2dfd('0x37')],{'$or':_[_0x2dfd('0x2b')](_0x3920a7,function(_0x20bcec){if(_0x20bcec[_0x2dfd('0x3b')]!=='VIRTUAL'){var _0x543b83={};_0x543b83[_0x20bcec[_0x2dfd('0x26')]]={'$like':'%'+_0x2bd5aa[_0x2dfd('0x2c')][_0x2dfd('0x39')]+'%'};return _0x543b83;}})});}_0x4b1be3=_[_0x2dfd('0x3a')]({},_0x4b1be3,_0x2bd5aa[_0x2dfd('0x3c')]);var _0x4b8d37={'where':_0x4b1be3[_0x2dfd('0x37')]};return db[_0x2dfd('0x28')]['count'](_0x4b8d37)['then'](function(_0x21c172){_0x4eb72c[_0x2dfd('0x1b')]=_0x21c172;if(_0x2bd5aa['query']['includeAll']){_0x4b1be3[_0x2dfd('0x3d')]=[{'all':!![]}];}return db[_0x2dfd('0x28')][_0x2dfd('0x3e')](_0x4b1be3);})[_0x2dfd('0x23')](function(_0x40ff7d){_0x4eb72c['rows']=_0x40ff7d;return _0x4eb72c;})[_0x2dfd('0x23')](respondWithFilteredResult(_0x5910cb,_0x4b1be3))[_0x2dfd('0x3f')](handleError(_0x5910cb,null));};exports['show']=function(_0x31f84d,_0x4b9c34){var _0x12492d={'raw':!![],'where':{'id':_0x31f84d[_0x2dfd('0x40')]['id']}},_0x471472={};_0x471472[_0x2dfd('0x30')]=_[_0x2dfd('0x41')](db[_0x2dfd('0x28')]['rawAttributes']);_0x471472[_0x2dfd('0x2c')]=_[_0x2dfd('0x41')](_0x31f84d['query']);_0x471472[_0x2dfd('0x2d')]=_['intersection'](_0x471472['model'],_0x471472[_0x2dfd('0x2c')]);_0x12492d[_0x2dfd('0x2f')]=_[_0x2dfd('0x2e')](_0x471472[_0x2dfd('0x30')],qs['fields'](_0x31f84d[_0x2dfd('0x2c')][_0x2dfd('0x31')]));_0x12492d[_0x2dfd('0x2f')]=_0x12492d[_0x2dfd('0x2f')][_0x2dfd('0x32')]?_0x12492d[_0x2dfd('0x2f')]:_0x471472[_0x2dfd('0x30')];if(_0x31f84d[_0x2dfd('0x2c')][_0x2dfd('0x42')]){_0x12492d[_0x2dfd('0x3d')]=[{'all':!![]}];}_0x12492d=_[_0x2dfd('0x3a')]({},_0x12492d,_0x31f84d[_0x2dfd('0x3c')]);return db[_0x2dfd('0x28')]['find'](_0x12492d)[_0x2dfd('0x23')](handleEntityNotFound(_0x4b9c34,null))[_0x2dfd('0x23')](respondWithResult(_0x4b9c34,null))[_0x2dfd('0x3f')](handleError(_0x4b9c34,null));};exports[_0x2dfd('0x43')]=function(_0x277f33,_0x26dde9){return db[_0x2dfd('0x28')][_0x2dfd('0x43')](_0x277f33[_0x2dfd('0x44')],{})[_0x2dfd('0x23')](respondWithResult(_0x26dde9,0xc9))[_0x2dfd('0x3f')](handleError(_0x26dde9,null));};exports['update']=function(_0x5b44a1,_0x27ef97){if(_0x5b44a1[_0x2dfd('0x44')]['id']){delete _0x5b44a1[_0x2dfd('0x44')]['id'];}return db[_0x2dfd('0x28')]['find']({'where':{'id':_0x5b44a1[_0x2dfd('0x40')]['id']}})[_0x2dfd('0x23')](handleEntityNotFound(_0x27ef97,null))[_0x2dfd('0x23')](saveUpdates(_0x5b44a1[_0x2dfd('0x44')],null))[_0x2dfd('0x23')](respondWithResult(_0x27ef97,null))[_0x2dfd('0x3f')](handleError(_0x27ef97,null));};exports[_0x2dfd('0x22')]=function(_0x5d359e,_0x1242f3){return db[_0x2dfd('0x28')][_0x2dfd('0x45')]({'where':{'id':_0x5d359e[_0x2dfd('0x40')]['id']}})['then'](handleEntityNotFound(_0x1242f3,null))[_0x2dfd('0x23')](removeEntity(_0x1242f3,null))[_0x2dfd('0x3f')](handleError(_0x1242f3,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index c3f3cd2..e503f9f 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 _0x4f52=['idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','DeskField','int_desk_fields','desk_unique_index'];(function(_0x22964f,_0x3d6e43){var _0xd54ff1=function(_0x4ef8d3){while(--_0x4ef8d3){_0x22964f['push'](_0x22964f['shift']());}};_0xd54ff1(++_0x3d6e43);}(_0x4f52,0x141));var _0x24f5=function(_0x573be0,_0x84a200){_0x573be0=_0x573be0-0x0;var _0x25176c=_0x4f52[_0x573be0];return _0x25176c;};'use strict';var _=require(_0x24f5('0x0'));var util=require(_0x24f5('0x1'));var logger=require(_0x24f5('0x2'))(_0x24f5('0x3'));var moment=require(_0x24f5('0x4'));var BPromise=require(_0x24f5('0x5'));var rp=require(_0x24f5('0x6'));var fs=require('fs');var path=require(_0x24f5('0x7'));var rimraf=require(_0x24f5('0x8'));var config=require(_0x24f5('0x9'));var attributes=require('./intDeskField.attributes');module[_0x24f5('0xa')]=function(_0x87de69,_0x5c7779){return _0x87de69[_0x24f5('0xb')](_0x24f5('0xc'),attributes,{'tableName':_0x24f5('0xd'),'paranoid':![],'indexes':[{'name':_0x24f5('0xe'),'fields':[_0x24f5('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d16=['path','../../config/environment','./intDeskField.attributes','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0x1d16,0xaf));var _0x61d1=function(_0x460ede,_0x185eb5){_0x460ede=_0x460ede-0x0;var _0x31944e=_0x1d16[_0x460ede];return _0x31944e;};'use strict';var _=require(_0x61d1('0x0'));var util=require(_0x61d1('0x1'));var logger=require(_0x61d1('0x2'))(_0x61d1('0x3'));var moment=require(_0x61d1('0x4'));var BPromise=require(_0x61d1('0x5'));var rp=require(_0x61d1('0x6'));var fs=require('fs');var path=require(_0x61d1('0x7'));var rimraf=require('rimraf');var config=require(_0x61d1('0x8'));var attributes=require(_0x61d1('0x9'));module['exports']=function(_0x152779,_0x2d02cc){return _0x152779['define']('DeskField',attributes,{'tableName':_0x61d1('0xa'),'paranoid':![],'indexes':[{'name':_0x61d1('0xb'),'fields':[_0x61d1('0xc'),_0x61d1('0xd')],'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 2a8eb1a..ddc3f1e 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 _0xfa6b=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xfa6b,0x81));var _0xbfa6=function(_0x2e0c4f,_0x172271){_0x2e0c4f=_0x2e0c4f-0x0;var _0x1451c6=_0xfa6b[_0x2e0c4f];return _0x1451c6;};'use strict';var _=require(_0xbfa6('0x0'));var util=require(_0xbfa6('0x1'));var moment=require(_0xbfa6('0x2'));var BPromise=require(_0xbfa6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfa6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbfa6('0x5'));var logger=require(_0xbfa6('0x6'))(_0xbfa6('0x7'));var config=require(_0xbfa6('0x8'));var jayson=require(_0xbfa6('0x9'));var client=jayson[_0xbfa6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4195ec,_0x3d2617,_0x2baded){return new BPromise(function(_0x5c6b64,_0x4d7e3c){return client[_0xbfa6('0xb')](_0x4195ec,_0x2baded)[_0xbfa6('0xc')](function(_0x29471f){logger[_0xbfa6('0xd')](_0xbfa6('0xe'),_0x3d2617,_0xbfa6('0xf'));logger['debug'](_0xbfa6('0x10'),_0x3d2617,_0xbfa6('0xf'),JSON[_0xbfa6('0x11')](_0x29471f));if(_0x29471f[_0xbfa6('0x12')]){if(_0x29471f[_0xbfa6('0x12')][_0xbfa6('0x13')]===0x1f4){logger['error'](_0xbfa6('0xe'),_0x3d2617,_0x29471f[_0xbfa6('0x12')][_0xbfa6('0x14')]);return _0x4d7e3c(_0x29471f['error'][_0xbfa6('0x14')]);}logger[_0xbfa6('0x12')]('DeskField,\x20%s,\x20%s',_0x3d2617,_0x29471f[_0xbfa6('0x12')]['message']);return _0x5c6b64(_0x29471f[_0xbfa6('0x12')][_0xbfa6('0x14')]);}else{logger[_0xbfa6('0xd')]('DeskField,\x20%s,\x20%s',_0x3d2617,_0xbfa6('0xf'));_0x5c6b64(_0x29471f[_0xbfa6('0x15')][_0xbfa6('0x14')]);}})['catch'](function(_0x3d3017){logger[_0xbfa6('0x12')](_0xbfa6('0xe'),_0x3d2617,_0x3d3017);_0x4d7e3c(_0x3d3017);});});} \ No newline at end of file +var _0xfbdd=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','DeskField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x2ebd61,_0x33dd0c){var _0x306cec=function(_0x55c2e5){while(--_0x55c2e5){_0x2ebd61['push'](_0x2ebd61['shift']());}};_0x306cec(++_0x33dd0c);}(_0xfbdd,0x86));var _0xdfbd=function(_0x23721b,_0x3d3cc8){_0x23721b=_0x23721b-0x0;var _0x5431c8=_0xfbdd[_0x23721b];return _0x5431c8;};'use strict';var _=require(_0xdfbd('0x0'));var util=require(_0xdfbd('0x1'));var moment=require(_0xdfbd('0x2'));var BPromise=require(_0xdfbd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdfbd('0x4'))['db'];var utils=require(_0xdfbd('0x5'));var logger=require(_0xdfbd('0x6'))(_0xdfbd('0x7'));var config=require(_0xdfbd('0x8'));var jayson=require(_0xdfbd('0x9'));var client=jayson[_0xdfbd('0xa')][_0xdfbd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36c928,_0x189baf,_0x146025){return new BPromise(function(_0x2c0baa,_0x1c4198){return client[_0xdfbd('0xc')](_0x36c928,_0x146025)[_0xdfbd('0xd')](function(_0x4d8a4f){logger[_0xdfbd('0xe')]('DeskField,\x20%s,\x20%s',_0x189baf,_0xdfbd('0xf'));logger[_0xdfbd('0x10')]('DeskField,\x20%s,\x20%s,\x20%s',_0x189baf,_0xdfbd('0xf'),JSON[_0xdfbd('0x11')](_0x4d8a4f));if(_0x4d8a4f['error']){if(_0x4d8a4f[_0xdfbd('0x12')][_0xdfbd('0x13')]===0x1f4){logger[_0xdfbd('0x12')](_0xdfbd('0x14'),_0x189baf,_0x4d8a4f[_0xdfbd('0x12')][_0xdfbd('0x15')]);return _0x1c4198(_0x4d8a4f['error'][_0xdfbd('0x15')]);}logger['error'](_0xdfbd('0x14'),_0x189baf,_0x4d8a4f[_0xdfbd('0x12')][_0xdfbd('0x15')]);return _0x2c0baa(_0x4d8a4f[_0xdfbd('0x12')]['message']);}else{logger[_0xdfbd('0xe')]('DeskField,\x20%s,\x20%s',_0x189baf,_0xdfbd('0xf'));_0x2c0baa(_0x4d8a4f['result'][_0xdfbd('0x15')]);}})[_0xdfbd('0x16')](function(_0x3e0bc2){logger[_0xdfbd('0x12')](_0xdfbd('0x14'),_0x189baf,_0x3e0bc2);_0x1c4198(_0x3e0bc2);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 64a4ae0..0cb51dd 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 _0x7f5e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','index','/:id','show','get','/:id/configurations','isAuthenticated','getFields','post','create','addConfiguration','put','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0x7f5e,0x11a));var _0xe7f5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7f5e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xe7f5('0x0'));var util=require(_0xe7f5('0x1'));var path=require(_0xe7f5('0x2'));var timeout=require(_0xe7f5('0x3'));var express=require(_0xe7f5('0x4'));var router=express[_0xe7f5('0x5')]();var fs_extra=require(_0xe7f5('0x6'));var auth=require(_0xe7f5('0x7'));var interaction=require(_0xe7f5('0x8'));var config=require(_0xe7f5('0x9'));var controller=require(_0xe7f5('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xe7f5('0xb')]);router['get'](_0xe7f5('0xc'),auth['isAuthenticated'](),controller[_0xe7f5('0xd')]);router[_0xe7f5('0xe')](_0xe7f5('0xf'),auth[_0xe7f5('0x10')](),controller['getConfigurations']);router[_0xe7f5('0xe')]('/:id/fields',auth[_0xe7f5('0x10')](),controller[_0xe7f5('0x11')]);router[_0xe7f5('0x12')]('/',auth[_0xe7f5('0x10')](),controller[_0xe7f5('0x13')]);router['post'](_0xe7f5('0xf'),auth[_0xe7f5('0x10')](),controller[_0xe7f5('0x14')]);router[_0xe7f5('0x15')](_0xe7f5('0xc'),auth[_0xe7f5('0x10')](),controller[_0xe7f5('0x16')]);router['delete'](_0xe7f5('0xc'),auth[_0xe7f5('0x10')](),controller[_0xe7f5('0x17')]);module['exports']=router; \ No newline at end of file +var _0x3df6=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x31c6b6,_0xdd33b7){var _0x32b27b=function(_0x32f195){while(--_0x32f195){_0x31c6b6['push'](_0x31c6b6['shift']());}};_0x32b27b(++_0xdd33b7);}(_0x3df6,0x1ab));var _0x63df=function(_0x4ce312,_0x476a02){_0x4ce312=_0x4ce312-0x0;var _0x347d20=_0x3df6[_0x4ce312];return _0x347d20;};'use strict';var multer=require(_0x63df('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x63df('0x1'));var router=express[_0x63df('0x2')]();var fs_extra=require(_0x63df('0x3'));var auth=require(_0x63df('0x4'));var interaction=require(_0x63df('0x5'));var config=require(_0x63df('0x6'));var controller=require('./intDynamics365Account.controller');router[_0x63df('0x7')]('/',auth[_0x63df('0x8')](),controller[_0x63df('0x9')]);router[_0x63df('0x7')](_0x63df('0xa'),auth['isAuthenticated'](),controller[_0x63df('0xb')]);router['get'](_0x63df('0xc'),auth[_0x63df('0x8')](),controller[_0x63df('0xd')]);router[_0x63df('0x7')](_0x63df('0xe'),auth[_0x63df('0x8')](),controller[_0x63df('0xf')]);router['post']('/',auth[_0x63df('0x8')](),controller['create']);router[_0x63df('0x10')](_0x63df('0xc'),auth[_0x63df('0x8')](),controller[_0x63df('0x11')]);router[_0x63df('0x12')](_0x63df('0xa'),auth[_0x63df('0x8')](),controller[_0x63df('0x13')]);router[_0x63df('0x14')](_0x63df('0xa'),auth[_0x63df('0x8')](),controller[_0x63df('0x15')]);module[_0x63df('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 c91834d..f64fe1b 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 _0x9865=['STRING','BOOLEAN','sequelize','exports'];(function(_0xdf56aa,_0x4d9c15){var _0x82768=function(_0x56a69f){while(--_0x56a69f){_0xdf56aa['push'](_0xdf56aa['shift']());}};_0x82768(++_0x4d9c15);}(_0x9865,0x1ba));var _0x5986=function(_0x2dd5d8,_0x2e01a6){_0x2dd5d8=_0x2dd5d8-0x0;var _0x1b3345=_0x9865[_0x2dd5d8];return _0x1b3345;};'use strict';var Sequelize=require(_0x5986('0x0'));module[_0x5986('0x1')]={'name':{'type':Sequelize[_0x5986('0x2')]},'username':{'type':Sequelize[_0x5986('0x2')]},'password':{'type':Sequelize[_0x5986('0x2')]},'remoteUri':{'type':Sequelize[_0x5986('0x2')]},'tenantId':{'type':Sequelize[_0x5986('0x2')]},'clientId':{'type':Sequelize[_0x5986('0x2')]},'clientSecret':{'type':Sequelize[_0x5986('0x2')]},'serverUrl':{'type':Sequelize[_0x5986('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x5986('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd7c3=['sequelize','exports','STRING'];(function(_0x372b6a,_0x2c4863){var _0x5e3538=function(_0x157204){while(--_0x157204){_0x372b6a['push'](_0x372b6a['shift']());}};_0x5e3538(++_0x2c4863);}(_0xd7c3,0x1c5));var _0x3d7c=function(_0x2f346c,_0x11fa76){_0x2f346c=_0x2f346c-0x0;var _0x3d3d12=_0xd7c3[_0x2f346c];return _0x3d3d12;};'use strict';var Sequelize=require(_0x3d7c('0x0'));module[_0x3d7c('0x1')]={'name':{'type':Sequelize[_0x3d7c('0x2')]},'username':{'type':Sequelize[_0x3d7c('0x2')]},'password':{'type':Sequelize[_0x3d7c('0x2')]},'remoteUri':{'type':Sequelize[_0x3d7c('0x2')]},'tenantId':{'type':Sequelize[_0x3d7c('0x2')]},'clientId':{'type':Sequelize[_0x3d7c('0x2')]},'clientSecret':{'type':Sequelize[_0x3d7c('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x3d7c('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index f3428b0..ed68f50 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 _0x9b78=['concat','username','password','remoteUri','tenantId','clientId','CloudProvider','data5','data7','modernAuthentication','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','forEach','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','statusCode','error','test',')/Attributes(','OptionSet','Label','UserLocalizedLabel','Value','DisplayName','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','stack','name','send','index','Dynamics365Account','rawAttributes','fieldName','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','keys','intersection','options','create','catch','body','find','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','channel','type','Descriptions','getDescriptions','slice','substring','lastIndexOf','%s/api/data/v9.0/','getFields','ticketType','Incident','PhoneCall','description','customerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyname','createdbyyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statecode','subjectidname','versionnumber'];(function(_0x133ccc,_0x4f9a55){var _0x230ac9=function(_0x96253d){while(--_0x96253d){_0x133ccc['push'](_0x133ccc['shift']());}};_0x230ac9(++_0x4f9a55);}(_0x9b78,0xe8));var _0x89b7=function(_0x2440fe,_0x281a11){_0x2440fe=_0x2440fe-0x0;var _0x5cf734=_0x9b78[_0x2440fe];return _0x5cf734;};'use strict';var rp=require(_0x89b7('0x0'));var util=require(_0x89b7('0x1'));var _=require(_0x89b7('0x2'));var qs=require(_0x89b7('0x3'));var logger=require(_0x89b7('0x4'))(_0x89b7('0x5'));var db=require(_0x89b7('0x6'))['db'];var integrations=require(_0x89b7('0x7'));function respondWithResult(_0x2e9db9,_0x3e819f){_0x3e819f=_0x3e819f||0xc8;return function(_0x1f403e){if(_0x1f403e){return _0x2e9db9[_0x89b7('0x8')](_0x3e819f)[_0x89b7('0x9')](_0x1f403e);}};}function respondWithFilteredResult(_0x350eae,_0x2b2b72){return function(_0x6ad1ff){if(_0x6ad1ff){var _0x22526b=typeof _0x2b2b72[_0x89b7('0xa')]===_0x89b7('0xb')&&typeof _0x2b2b72[_0x89b7('0xc')]==='undefined';var _0x3a40e8=_0x6ad1ff[_0x89b7('0xd')];var _0x4595dc=_0x22526b?0x0:_0x2b2b72[_0x89b7('0xa')];var _0x3f725c=_0x22526b?_0x6ad1ff[_0x89b7('0xd')]:_0x2b2b72['offset']+_0x2b2b72[_0x89b7('0xc')];var _0x44f122;if(_0x3f725c>=_0x3a40e8){_0x3f725c=_0x3a40e8;_0x44f122=0xc8;}else{_0x44f122=0xce;}_0x350eae[_0x89b7('0x8')](_0x44f122);return _0x350eae[_0x89b7('0xe')](_0x89b7('0xf'),_0x4595dc+'-'+_0x3f725c+'/'+_0x3a40e8)[_0x89b7('0x9')](_0x6ad1ff);}return null;};}function saveUpdates(_0x1999fb){return function(_0x2262e4){if(_0x2262e4){return _0x2262e4[_0x89b7('0x10')](_0x1999fb)[_0x89b7('0x11')](function(_0x1e0587){return _0x1e0587;});}return null;};}function removeEntity(_0x2f76ef){return function(_0x44fb1d){if(_0x44fb1d){return _0x44fb1d[_0x89b7('0x12')]()['then'](function(){_0x2f76ef['status'](0xcc)[_0x89b7('0x13')]();});}};}function handleEntityNotFound(_0x54597e){return function(_0x38806d){if(!_0x38806d){_0x54597e[_0x89b7('0x14')](0x194);}return _0x38806d;};}function handleError(_0x324a91,_0x4d50bf){_0x4d50bf=_0x4d50bf||0x1f4;return function(_0x334c88){logger['error'](_0x334c88[_0x89b7('0x15')]);if(_0x334c88[_0x89b7('0x16')]){delete _0x334c88['name'];}_0x324a91[_0x89b7('0x8')](_0x4d50bf)[_0x89b7('0x17')](_0x334c88);};}exports[_0x89b7('0x18')]=function(_0x4fb02b,_0x1d7742){var _0x217e51={},_0x1b7c47={},_0x3ead2f={'count':0x0,'rows':[]};var _0x34670c=_['map'](db[_0x89b7('0x19')][_0x89b7('0x1a')],function(_0x5f02b8){return{'name':_0x5f02b8[_0x89b7('0x1b')],'type':_0x5f02b8['type'][_0x89b7('0x1c')]};});_0x1b7c47[_0x89b7('0x1d')]=_[_0x89b7('0x1e')](_0x34670c,_0x89b7('0x16'));_0x1b7c47['query']=_['keys'](_0x4fb02b[_0x89b7('0x1f')]);_0x1b7c47[_0x89b7('0x20')]=_['intersection'](_0x1b7c47[_0x89b7('0x1d')],_0x1b7c47[_0x89b7('0x1f')]);_0x217e51[_0x89b7('0x21')]=_['intersection'](_0x1b7c47['model'],qs[_0x89b7('0x22')](_0x4fb02b[_0x89b7('0x1f')]['fields']));_0x217e51[_0x89b7('0x21')]=_0x217e51[_0x89b7('0x21')][_0x89b7('0x23')]?_0x217e51[_0x89b7('0x21')]:_0x1b7c47[_0x89b7('0x1d')];if(!_0x4fb02b[_0x89b7('0x1f')][_0x89b7('0x24')](_0x89b7('0x25'))){_0x217e51[_0x89b7('0xc')]=qs['limit'](_0x4fb02b['query']['limit']);_0x217e51[_0x89b7('0xa')]=qs[_0x89b7('0xa')](_0x4fb02b[_0x89b7('0x1f')]['offset']);}_0x217e51[_0x89b7('0x26')]=qs[_0x89b7('0x27')](_0x4fb02b['query']['sort']);_0x217e51[_0x89b7('0x28')]=qs[_0x89b7('0x20')](_[_0x89b7('0x29')](_0x4fb02b[_0x89b7('0x1f')],_0x1b7c47['filters']),_0x34670c);if(_0x4fb02b[_0x89b7('0x1f')][_0x89b7('0x2a')]){_0x217e51[_0x89b7('0x28')]=_[_0x89b7('0x2b')](_0x217e51[_0x89b7('0x28')],{'$or':_[_0x89b7('0x1e')](_0x34670c,function(_0x2f0bb2){if(_0x2f0bb2['type']!=='VIRTUAL'){var _0x4694d3={};_0x4694d3[_0x2f0bb2[_0x89b7('0x16')]]={'$like':'%'+_0x4fb02b['query'][_0x89b7('0x2a')]+'%'};return _0x4694d3;}})});}_0x217e51=_['merge']({},_0x217e51,_0x4fb02b['options']);var _0x4dfa53={'where':_0x217e51[_0x89b7('0x28')]};return db['Dynamics365Account'][_0x89b7('0xd')](_0x4dfa53)[_0x89b7('0x11')](function(_0x13aae4){_0x3ead2f[_0x89b7('0xd')]=_0x13aae4;if(_0x4fb02b[_0x89b7('0x1f')][_0x89b7('0x2c')]){_0x217e51[_0x89b7('0x2d')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x89b7('0x2e')](_0x217e51);})[_0x89b7('0x11')](function(_0x384677){_0x3ead2f[_0x89b7('0x2f')]=_0x384677;return _0x3ead2f;})[_0x89b7('0x11')](respondWithFilteredResult(_0x1d7742,_0x217e51))['catch'](handleError(_0x1d7742,null));};exports[_0x89b7('0x30')]=function(_0x442de9,_0x5e04ae){var _0x3b0439={'raw':![],'where':{'id':_0x442de9[_0x89b7('0x31')]['id']}},_0x9ca869={};_0x9ca869[_0x89b7('0x1d')]=_[_0x89b7('0x32')](db['Dynamics365Account']['rawAttributes']);_0x9ca869[_0x89b7('0x1f')]=_[_0x89b7('0x32')](_0x442de9[_0x89b7('0x1f')]);_0x9ca869['filters']=_[_0x89b7('0x33')](_0x9ca869[_0x89b7('0x1d')],_0x9ca869[_0x89b7('0x1f')]);_0x3b0439[_0x89b7('0x21')]=_[_0x89b7('0x33')](_0x9ca869[_0x89b7('0x1d')],qs[_0x89b7('0x22')](_0x442de9[_0x89b7('0x1f')][_0x89b7('0x22')]));_0x3b0439['attributes']=_0x3b0439['attributes'][_0x89b7('0x23')]?_0x3b0439[_0x89b7('0x21')]:_0x9ca869[_0x89b7('0x1d')];if(_0x442de9[_0x89b7('0x1f')][_0x89b7('0x2c')]){_0x3b0439[_0x89b7('0x2d')]=[{'all':!![]}];}_0x3b0439=_[_0x89b7('0x2b')]({},_0x3b0439,_0x442de9[_0x89b7('0x34')]);return db[_0x89b7('0x19')]['find'](_0x3b0439)[_0x89b7('0x11')](handleEntityNotFound(_0x5e04ae,null))[_0x89b7('0x11')](respondWithResult(_0x5e04ae,null))['catch'](handleError(_0x5e04ae,null));};exports[_0x89b7('0x35')]=function(_0x1acee6,_0x2d2f18){return db['Dynamics365Account'][_0x89b7('0x35')](_0x1acee6['body'],{})[_0x89b7('0x11')](respondWithResult(_0x2d2f18,0xc9))[_0x89b7('0x36')](handleError(_0x2d2f18,null));};exports[_0x89b7('0x10')]=function(_0x18c69d,_0xe49733){if(_0x18c69d[_0x89b7('0x37')]['id']){delete _0x18c69d[_0x89b7('0x37')]['id'];}return db[_0x89b7('0x19')]['find']({'where':{'id':_0x18c69d[_0x89b7('0x31')]['id']}})['then'](handleEntityNotFound(_0xe49733,null))[_0x89b7('0x11')](saveUpdates(_0x18c69d[_0x89b7('0x37')],null))[_0x89b7('0x11')](respondWithResult(_0xe49733,null))[_0x89b7('0x36')](handleError(_0xe49733,null));};exports[_0x89b7('0x12')]=function(_0x98f0f4,_0x229939){return db['Dynamics365Account'][_0x89b7('0x38')]({'where':{'id':_0x98f0f4[_0x89b7('0x31')]['id']}})['then'](handleEntityNotFound(_0x229939,null))[_0x89b7('0x11')](removeEntity(_0x229939,null))[_0x89b7('0x36')](handleError(_0x229939,null));};exports[_0x89b7('0x39')]=function(_0x322a02,_0x3087ca){var _0x2d8ac8={};var _0x4a82ab={};var _0x5bf16c;var _0x171f6e;return db[_0x89b7('0x19')][_0x89b7('0x3a')]({'where':{'id':_0x322a02[_0x89b7('0x31')]['id']}})[_0x89b7('0x11')](handleEntityNotFound(_0x3087ca,null))[_0x89b7('0x11')](function(_0x37096d){if(_0x37096d){_0x5bf16c=_0x37096d;_0x4a82ab['model']=_[_0x89b7('0x32')](db[_0x89b7('0x3b')]['rawAttributes']);_0x4a82ab[_0x89b7('0x1f')]=_['keys'](_0x322a02[_0x89b7('0x1f')]);_0x4a82ab[_0x89b7('0x20')]=_[_0x89b7('0x33')](_0x4a82ab[_0x89b7('0x1d')],_0x4a82ab['query']);_0x2d8ac8['attributes']=_[_0x89b7('0x33')](_0x4a82ab['model'],qs[_0x89b7('0x22')](_0x322a02[_0x89b7('0x1f')]['fields']));_0x2d8ac8[_0x89b7('0x21')]=_0x2d8ac8['attributes'][_0x89b7('0x23')]?_0x2d8ac8[_0x89b7('0x21')]:_0x4a82ab[_0x89b7('0x1d')];_0x2d8ac8[_0x89b7('0x26')]=qs[_0x89b7('0x27')](_0x322a02['query'][_0x89b7('0x27')]);_0x2d8ac8['where']=qs[_0x89b7('0x20')](_[_0x89b7('0x29')](_0x322a02['query'],_0x4a82ab['filters']));if(_0x322a02['query'][_0x89b7('0x2a')]){_0x2d8ac8['where']=_['merge'](_0x2d8ac8[_0x89b7('0x28')],{'$or':_[_0x89b7('0x1e')](_0x2d8ac8['attributes'],function(_0x5926d5){var _0x58cabe={};_0x58cabe[_0x5926d5]={'$like':'%'+_0x322a02[_0x89b7('0x1f')][_0x89b7('0x2a')]+'%'};return _0x58cabe;})});}_0x2d8ac8=_[_0x89b7('0x2b')]({},_0x2d8ac8,_0x322a02[_0x89b7('0x34')]);return _0x5bf16c[_0x89b7('0x39')](_0x2d8ac8);}})[_0x89b7('0x11')](function(_0x725e19){if(_0x725e19){_0x171f6e=_0x725e19[_0x89b7('0x23')];if(!_0x322a02[_0x89b7('0x1f')]['hasOwnProperty']('nolimit')){_0x2d8ac8[_0x89b7('0xc')]=qs[_0x89b7('0xc')](_0x322a02[_0x89b7('0x1f')][_0x89b7('0xc')]);_0x2d8ac8[_0x89b7('0xa')]=qs[_0x89b7('0xa')](_0x322a02[_0x89b7('0x1f')]['offset']);}return _0x5bf16c[_0x89b7('0x39')](_0x2d8ac8);}})[_0x89b7('0x11')](function(_0x37a4b2){if(_0x37a4b2){return _0x37a4b2?{'count':_0x171f6e,'rows':_0x37a4b2}:null;}})[_0x89b7('0x11')](respondWithResult(_0x3087ca,null))[_0x89b7('0x36')](handleError(_0x3087ca,null));};exports[_0x89b7('0x3c')]=function(_0x5c7be7,_0x1619e5){if(_0x5c7be7[_0x89b7('0x37')]['id']){delete _0x5c7be7[_0x89b7('0x37')]['id'];}return db[_0x89b7('0x19')][_0x89b7('0x3a')]({'where':{'id':_0x5c7be7[_0x89b7('0x31')]['id']}})[_0x89b7('0x11')](handleEntityNotFound(_0x1619e5,null))[_0x89b7('0x11')](function(_0x548e4f){if(_0x548e4f){_0x5c7be7['body'][_0x89b7('0x3d')]=_0x548e4f['id'];_0x5c7be7[_0x89b7('0x37')][_0x89b7('0x3e')]=integrations['getSubjects'](_0x5c7be7['body'][_0x89b7('0x3f')],_0x5c7be7[_0x89b7('0x37')][_0x89b7('0x40')]);_0x5c7be7['body'][_0x89b7('0x41')]=integrations[_0x89b7('0x42')](_0x5c7be7[_0x89b7('0x37')][_0x89b7('0x3f')],_0x5c7be7[_0x89b7('0x37')][_0x89b7('0x40')]);return db[_0x89b7('0x3b')][_0x89b7('0x35')](_0x5c7be7[_0x89b7('0x37')],{'include':[{'model':db['Dynamics365Field'],'as':_0x89b7('0x3e')},{'model':db['Dynamics365Field'],'as':_0x89b7('0x41')}]});}return null;})[_0x89b7('0x11')](respondWithResult(_0x1619e5,null))[_0x89b7('0x36')](handleError(_0x1619e5,null));};function sanitizeRemoteUri(_0x58635e){var _0x3dee4f=_0x58635e[_0x89b7('0x43')](-0x1);if(_0x3dee4f==='/')return _0x58635e[_0x89b7('0x44')](0x0,_0x58635e[_0x89b7('0x45')](_0x3dee4f));return _0x58635e;}function getWebApiUrl(_0x1b9561){return util['format'](_0x89b7('0x46'),_0x1b9561);}exports[_0x89b7('0x47')]=function(_0x3ea35a,_0x3ca655){var _0xfbe3da=_0x3ea35a[_0x89b7('0x1f')][_0x89b7('0x48')];var _0x278396=_0xfbe3da==='incident'?_0x89b7('0x49'):_0x89b7('0x4a');var _0x32e86c='';var _0x482be5='';var _0x52c197='';var _0x164a58='';var _0x12e6f9='';var _0x28cc3d='';var _0x1ab10f='';var _0x5d9e7f='';var _0x30f4ea=['title',_0x89b7('0x4b'),_0x89b7('0x4c'),'ownerid',_0x89b7('0x4d'),_0x89b7('0x4e'),_0x89b7('0x4f'),_0x89b7('0x50'),'directioncode',_0x89b7('0x51')];var _0x49cf3a=[_0x89b7('0x52'),_0x89b7('0x53'),'actualserviceunits',_0x89b7('0x54'),_0x89b7('0x55'),_0x89b7('0x56'),_0x89b7('0x57'),'contractidname',_0x89b7('0x58'),'createdbyexternalpartyyominame',_0x89b7('0x59'),_0x89b7('0x5a'),'createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress',_0x89b7('0x5b'),_0x89b7('0x5c'),_0x89b7('0x5d'),_0x89b7('0x5e'),_0x89b7('0x5f'),_0x89b7('0x60'),_0x89b7('0x61'),_0x89b7('0x62'),_0x89b7('0x63'),_0x89b7('0x64'),_0x89b7('0x65'),_0x89b7('0x66'),_0x89b7('0x67'),_0x89b7('0x68'),'modifiedbyname','modifiedbyyominame',_0x89b7('0x69'),'modifiedonbehalfbyname',_0x89b7('0x6a'),_0x89b7('0x6b'),'msdyn_iotalertname',_0x89b7('0x6c'),_0x89b7('0x6d'),_0x89b7('0x6e'),_0x89b7('0x6f'),_0x89b7('0x70'),_0x89b7('0x71'),_0x89b7('0x72'),_0x89b7('0x73'),'primarycontactidyominame',_0x89b7('0x74'),_0x89b7('0x75'),'productserialnumber',_0x89b7('0x76'),_0x89b7('0x77'),_0x89b7('0x78'),'responsiblecontactidname',_0x89b7('0x79'),_0x89b7('0x7a'),'slainvokedidname',_0x89b7('0x7b'),_0x89b7('0x7c'),_0x89b7('0x7d'),'statuscode',_0x89b7('0x7e'),'ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode',_0x89b7('0x7f')];var _0x23d43f=_0x30f4ea[_0x89b7('0x80')](_0x49cf3a);return db[_0x89b7('0x19')][_0x89b7('0x3a')]({'where':{'id':_0x3ea35a['params']['id']},'attributes':['id',_0x89b7('0x81'),_0x89b7('0x82'),_0x89b7('0x83'),_0x89b7('0x84'),_0x89b7('0x85'),'clientSecret','modernAuthentication'],'include':[{'model':db[_0x89b7('0x86')],'as':_0x89b7('0x86'),'attributes':['id',_0x89b7('0x87'),_0x89b7('0x88')]}]})['then'](handleEntityNotFound(_0x3ca655,null))['then'](function(_0x26c020){if(_0x26c020){if(_0x26c020[_0x89b7('0x89')]){_0x26c020['access_token']=_0x26c020[_0x89b7('0x86')][_0x89b7('0x87')];_0x5d9e7f=sanitizeRemoteUri(_0x26c020[_0x89b7('0x86')][_0x89b7('0x88')]);_0x1ab10f=getWebApiUrl(_0x5d9e7f);return _0x26c020;}_0x5d9e7f=sanitizeRemoteUri(_0x26c020[_0x89b7('0x83')]);_0x1ab10f=getWebApiUrl(_0x5d9e7f);var _0xa5fca3={'method':_0x89b7('0x8a'),'uri':_0x89b7('0x8b')+_0x26c020[_0x89b7('0x84')]+_0x89b7('0x8c'),'form':{'client_id':_0x26c020[_0x89b7('0x85')],'resource':_0x5d9e7f,'username':_0x26c020[_0x89b7('0x81')],'password':_0x26c020[_0x89b7('0x82')],'grant_type':_0x89b7('0x82'),'client_secret':_0x26c020['clientSecret']},'json':!![]};return rp(_0xa5fca3);}})[_0x89b7('0x11')](function(_0x44d949){_0x28cc3d=_0x44d949[_0x89b7('0x8d')];var _0x72db92={'method':_0x89b7('0x8e'),'uri':encodeURI(_0x1ab10f+_0x89b7('0x8f')+_0x278396+'\x27'),'headers':{'Authorization':_0x89b7('0x90')+_0x28cc3d,'If-None-Match':null,'OData-Version':_0x89b7('0x91')},'json':!![]};return rp(_0x72db92);})[_0x89b7('0x11')](function(_0x1a0d2a){var _0x1367a7=_0x1a0d2a[_0x89b7('0x92')][0x0];var _0x182f87=_0x1367a7[_0x89b7('0x93')];var _0x38676f={'method':_0x89b7('0x8e'),'uri':_0x1ab10f+_0x89b7('0x94')+_0x182f87+_0x89b7('0x95'),'headers':{'Authorization':'Bearer\x20'+_0x28cc3d,'If-None-Match':null,'OData-Version':_0x89b7('0x91')},'json':!![]};return rp(_0x38676f);})[_0x89b7('0x11')](function(_0x212e00){_0x32e86c=_0x212e00;_0x482be5=_0x32e86c['Attributes'];_0x482be5=_[_0x89b7('0x96')](_0x482be5,function(_0x1f85eb){return!_0x23d43f[_0x89b7('0x97')](_0x1f85eb[_0x89b7('0x98')]);});var _0x12a18a=[];var _0x11d840=[];_0x482be5['forEach'](function(_0x432466){if(_0x432466['@odata.type']){var _0x18eb5b=_0x432466['@odata.type'][_0x89b7('0x44')](_0x432466[_0x89b7('0x99')][_0x89b7('0x45')]('.')+0x1);if(_0x18eb5b===_0x89b7('0x9a')){_0x12a18a[_0x89b7('0x9b')](getSelectList(_0x1ab10f,_0xfbe3da,_0x11d840,_0x32e86c[_0x89b7('0x93')],_0x432466['MetadataId'],_0x28cc3d));}}});return Promise[_0x89b7('0x9c')](_0x12a18a);})[_0x89b7('0x11')](function(_0x51a0a6){_0x52c197=_0x51a0a6[0x0];var _0x5b8bcd=[];var _0x4b5734=[];_0x482be5['forEach'](function(_0x2b40b3){if(!_[_0x89b7('0x9d')](_0x2b40b3[_0x89b7('0x99')])){var _0x23ee17=_0x2b40b3[_0x89b7('0x99')]['substring'](_0x2b40b3['@odata.type']['lastIndexOf']('.')+0x1);if(_0x23ee17===_0x89b7('0x9e')){_0x5b8bcd['push'](getBooleanList(_0x1ab10f,_0xfbe3da,_0x4b5734,_0x32e86c[_0x89b7('0x93')],_0x2b40b3[_0x89b7('0x93')],_0x28cc3d));}}});return Promise['all'](_0x5b8bcd);})[_0x89b7('0x11')](function(_0x41969b){_0x164a58=_0x41969b[0x0];var _0x3723a0=[];var _0x5ba47b=[];_0x482be5[_0x89b7('0x9f')](function(_0x4a8b67){if(_0x4a8b67[_0x89b7('0x99')]){var _0x34cc99=_0x4a8b67[_0x89b7('0x99')]['substring'](_0x4a8b67[_0x89b7('0x99')][_0x89b7('0x45')]('.')+0x1);if(_0x34cc99==='StringAttributeMetadata'||_0x34cc99===_0x89b7('0xa0')||_0x34cc99===_0x89b7('0xa1')||_0x34cc99==='IntegerAttributeMetadata'||_0x34cc99===_0x89b7('0xa2')||_0x34cc99===_0x89b7('0xa3')||_0x34cc99==='StatusAttributeMetadata'||_0x34cc99===_0x89b7('0xa4')||_0x34cc99===_0x89b7('0xa5')||_0x34cc99==='DecimalAttributeMetadata'){_0x3723a0[_0x89b7('0x9b')](getInputList(_0x1ab10f,_0xfbe3da,_0x34cc99,_0x5ba47b,_0x32e86c[_0x89b7('0x93')],_0x4a8b67[_0x89b7('0x93')],_0x28cc3d));}}});return Promise[_0x89b7('0x9c')](_0x3723a0);})['then'](function(_0x16fb1d){_0x12e6f9=_0x16fb1d[0x0];var _0xc33a1f=_0x52c197[_0x89b7('0x80')](_0x164a58)['concat'](_0x12e6f9);var _0x303039={'count':_0xc33a1f[_0x89b7('0x23')],'rows':_0xc33a1f};return _0x303039;})[_0x89b7('0x11')](respondWithResult(_0x3ca655,null))[_0x89b7('0x36')](function(_0x527cf2){var _0x2bc73e=_0x3ea35a[_0x89b7('0x1f')]['test']?0x1f4:_0x527cf2[_0x89b7('0xa6')]||0x1f4;logger[_0x89b7('0xa7')](_0x527cf2[_0x89b7('0x15')]);delete _0x527cf2['name'];if(_0x2bc73e===0x191){_0x2bc73e=0x190;}_0x3ca655[_0x89b7('0x8')](_0x2bc73e)[_0x89b7('0x17')](_0x3ea35a[_0x89b7('0x1f')][_0x89b7('0xa8')]?{'message':'Wrong\x20credentials','statusCode':_0x527cf2['statusCode']}:_0x527cf2);});};function getSelectList(_0x3dedb2,_0x2ed885,_0x221473,_0x3e5d26,_0x2bc9a7,_0x2fe5c6){var _0x1e83c5={'method':'GET','uri':_0x3dedb2+'EntityDefinitions('+_0x3e5d26+_0x89b7('0xa9')+_0x2bc9a7+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x89b7('0x90')+_0x2fe5c6,'If-None-Match':null,'OData-Version':_0x89b7('0x91')},'json':!![]};return rp(_0x1e83c5)['then'](function(_0x20fd60){var _0x39eefd=[];var _0x5d05ed=_0x20fd60[_0x89b7('0xaa')]['Options'];_0x5d05ed[_0x89b7('0x9f')](function(_0x52e514){_0x39eefd[_0x89b7('0x9b')]({'name':_0x52e514[_0x89b7('0xab')][_0x89b7('0xac')][_0x89b7('0xab')],'value':String(_0x52e514[_0x89b7('0xad')])});});var _0x18c278={'id':_0x2ed885+'_'+_0x20fd60['LogicalName'],'name':_0x20fd60[_0x89b7('0xae')][_0x89b7('0xac')]['Label'],'custom':![],'options':_0x39eefd};_0x221473[_0x89b7('0x9b')](_0x18c278);return _0x221473;});}function getBooleanList(_0x54ce41,_0x4166a4,_0x447ea0,_0x2f8308,_0x4f042b,_0x7d727){var _0xc4b038={'method':_0x89b7('0x8e'),'uri':_0x54ce41+_0x89b7('0x94')+_0x2f8308+_0x89b7('0xa9')+_0x4f042b+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x89b7('0x90')+_0x7d727,'If-None-Match':null,'OData-Version':_0x89b7('0x91')},'json':!![]};return rp(_0xc4b038)[_0x89b7('0x11')](function(_0x238dca){var _0x4dc717=[];_0x4dc717['push']({'name':_0x238dca[_0x89b7('0xaa')][_0x89b7('0xaf')][_0x89b7('0xab')][_0x89b7('0xac')]['Label'],'value':_0x89b7('0xb0')},{'name':_0x238dca[_0x89b7('0xaa')][_0x89b7('0xb1')]['Label'][_0x89b7('0xac')][_0x89b7('0xab')],'value':_0x89b7('0xb2')});var _0x5970dd={'id':_0x4166a4+'_'+_0x238dca[_0x89b7('0x98')],'name':_0x238dca[_0x89b7('0xae')][_0x89b7('0xac')][_0x89b7('0xab')],'custom':![],'options':_0x4dc717};_0x447ea0[_0x89b7('0x9b')](_0x5970dd);return _0x447ea0;});}function getInputList(_0x207d11,_0xbebcf0,_0x2ae2d2,_0x1776ee,_0x5bf8c7,_0x5e0af8,_0x436fd1){var _0x28d782={'method':_0x89b7('0x8e'),'uri':_0x207d11+_0x89b7('0x94')+_0x5bf8c7+_0x89b7('0xa9')+_0x5e0af8+_0x89b7('0xb3')+_0x2ae2d2+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x89b7('0x90')+_0x436fd1,'If-None-Match':null,'OData-Version':_0x89b7('0x91')},'json':!![]};return rp(_0x28d782)[_0x89b7('0x11')](function(_0x1924de){var _0x43a09e={'id':_0xbebcf0+'_'+_0x1924de['LogicalName'],'name':_0x1924de[_0x89b7('0xae')][_0x89b7('0xac')]?_0x1924de[_0x89b7('0xae')][_0x89b7('0xac')]['Label']:_0x1924de['LogicalName'],'custom':![],'options':[]};_0x1776ee[_0x89b7('0x9b')](_0x43a09e);return _0x1776ee;});} \ No newline at end of file +var _0x2f74=['ticketnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','modernAuthentication','CloudProvider','data7','POST','https://login.microsoftonline.com/','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','LogicalName','@odata.type','PicklistAttributeMetadata','push','forEach','isNil','BooleanAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','status','send','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','TrueOption','true','OptionSet','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','offset','undefined','count','limit','set','Content-Range','json','update','then','sendStatus','error','name','index','map','Dynamics365Account','fieldName','type','key','model','query','keys','filters','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','length','create','body','find','getConfigurations','Dynamics365Configuration','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responsiblecontactidname','sentimentvalue','statuscode'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x2f74,0xf0));var _0x42f7=function(_0x37f5a1,_0x461925){_0x37f5a1=_0x37f5a1-0x0;var _0x3a97a5=_0x2f74[_0x37f5a1];return _0x3a97a5;};'use strict';var rp=require(_0x42f7('0x0'));var util=require(_0x42f7('0x1'));var _=require(_0x42f7('0x2'));var qs=require(_0x42f7('0x3'));var logger=require(_0x42f7('0x4'))(_0x42f7('0x5'));var db=require('../../mysqldb')['db'];var integrations=require(_0x42f7('0x6'));function respondWithResult(_0x4d4297,_0x440eb2){_0x440eb2=_0x440eb2||0xc8;return function(_0x3da608){if(_0x3da608){return _0x4d4297['status'](_0x440eb2)['json'](_0x3da608);}};}function respondWithFilteredResult(_0x5b2761,_0x3ce8a8){return function(_0x1c4ced){if(_0x1c4ced){var _0x3da9ab=typeof _0x3ce8a8[_0x42f7('0x7')]===_0x42f7('0x8')&&typeof _0x3ce8a8['limit']===_0x42f7('0x8');var _0x5b468d=_0x1c4ced[_0x42f7('0x9')];var _0x167715=_0x3da9ab?0x0:_0x3ce8a8[_0x42f7('0x7')];var _0x906e54=_0x3da9ab?_0x1c4ced[_0x42f7('0x9')]:_0x3ce8a8[_0x42f7('0x7')]+_0x3ce8a8[_0x42f7('0xa')];var _0x113c41;if(_0x906e54>=_0x5b468d){_0x906e54=_0x5b468d;_0x113c41=0xc8;}else{_0x113c41=0xce;}_0x5b2761['status'](_0x113c41);return _0x5b2761[_0x42f7('0xb')](_0x42f7('0xc'),_0x167715+'-'+_0x906e54+'/'+_0x5b468d)[_0x42f7('0xd')](_0x1c4ced);}return null;};}function saveUpdates(_0x40b6eb){return function(_0x388ea4){if(_0x388ea4){return _0x388ea4[_0x42f7('0xe')](_0x40b6eb)[_0x42f7('0xf')](function(_0x3abc0f){return _0x3abc0f;});}return null;};}function removeEntity(_0x1500fe){return function(_0x3da22c){if(_0x3da22c){return _0x3da22c['destroy']()[_0x42f7('0xf')](function(){_0x1500fe['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x817d33){return function(_0x4d7788){if(!_0x4d7788){_0x817d33[_0x42f7('0x10')](0x194);}return _0x4d7788;};}function handleError(_0x4a093f,_0x5464c1){_0x5464c1=_0x5464c1||0x1f4;return function(_0x4c8b91){logger[_0x42f7('0x11')](_0x4c8b91['stack']);if(_0x4c8b91['name']){delete _0x4c8b91[_0x42f7('0x12')];}_0x4a093f['status'](_0x5464c1)['send'](_0x4c8b91);};}exports[_0x42f7('0x13')]=function(_0x3b6dde,_0x2d8553){var _0x424078={},_0x3b7f2f={},_0x5180eb={'count':0x0,'rows':[]};var _0x50d076=_[_0x42f7('0x14')](db[_0x42f7('0x15')]['rawAttributes'],function(_0x62aa3c){return{'name':_0x62aa3c[_0x42f7('0x16')],'type':_0x62aa3c[_0x42f7('0x17')][_0x42f7('0x18')]};});_0x3b7f2f[_0x42f7('0x19')]=_[_0x42f7('0x14')](_0x50d076,_0x42f7('0x12'));_0x3b7f2f[_0x42f7('0x1a')]=_[_0x42f7('0x1b')](_0x3b6dde[_0x42f7('0x1a')]);_0x3b7f2f[_0x42f7('0x1c')]=_['intersection'](_0x3b7f2f[_0x42f7('0x19')],_0x3b7f2f['query']);_0x424078[_0x42f7('0x1d')]=_['intersection'](_0x3b7f2f[_0x42f7('0x19')],qs[_0x42f7('0x1e')](_0x3b6dde[_0x42f7('0x1a')][_0x42f7('0x1e')]));_0x424078[_0x42f7('0x1d')]=_0x424078[_0x42f7('0x1d')]['length']?_0x424078[_0x42f7('0x1d')]:_0x3b7f2f[_0x42f7('0x19')];if(!_0x3b6dde[_0x42f7('0x1a')]['hasOwnProperty'](_0x42f7('0x1f'))){_0x424078[_0x42f7('0xa')]=qs['limit'](_0x3b6dde[_0x42f7('0x1a')]['limit']);_0x424078[_0x42f7('0x7')]=qs[_0x42f7('0x7')](_0x3b6dde[_0x42f7('0x1a')][_0x42f7('0x7')]);}_0x424078[_0x42f7('0x20')]=qs['sort'](_0x3b6dde[_0x42f7('0x1a')][_0x42f7('0x21')]);_0x424078[_0x42f7('0x22')]=qs['filters'](_['pick'](_0x3b6dde[_0x42f7('0x1a')],_0x3b7f2f[_0x42f7('0x1c')]),_0x50d076);if(_0x3b6dde[_0x42f7('0x1a')][_0x42f7('0x23')]){_0x424078[_0x42f7('0x22')]=_[_0x42f7('0x24')](_0x424078['where'],{'$or':_[_0x42f7('0x14')](_0x50d076,function(_0x505041){if(_0x505041['type']!==_0x42f7('0x25')){var _0xed0125={};_0xed0125[_0x505041[_0x42f7('0x12')]]={'$like':'%'+_0x3b6dde['query'][_0x42f7('0x23')]+'%'};return _0xed0125;}})});}_0x424078=_[_0x42f7('0x24')]({},_0x424078,_0x3b6dde[_0x42f7('0x26')]);var _0x464640={'where':_0x424078[_0x42f7('0x22')]};return db[_0x42f7('0x15')][_0x42f7('0x9')](_0x464640)[_0x42f7('0xf')](function(_0x24bf51){_0x5180eb['count']=_0x24bf51;if(_0x3b6dde[_0x42f7('0x1a')][_0x42f7('0x27')]){_0x424078[_0x42f7('0x28')]=[{'all':!![]}];}return db[_0x42f7('0x15')][_0x42f7('0x29')](_0x424078);})[_0x42f7('0xf')](function(_0x533b6e){_0x5180eb[_0x42f7('0x2a')]=_0x533b6e;return _0x5180eb;})[_0x42f7('0xf')](respondWithFilteredResult(_0x2d8553,_0x424078))[_0x42f7('0x2b')](handleError(_0x2d8553,null));};exports[_0x42f7('0x2c')]=function(_0x425ae5,_0x339606){var _0x34ac7a={'raw':![],'where':{'id':_0x425ae5[_0x42f7('0x2d')]['id']}},_0x20c6d0={};_0x20c6d0[_0x42f7('0x19')]=_['keys'](db['Dynamics365Account'][_0x42f7('0x2e')]);_0x20c6d0[_0x42f7('0x1a')]=_[_0x42f7('0x1b')](_0x425ae5['query']);_0x20c6d0['filters']=_['intersection'](_0x20c6d0[_0x42f7('0x19')],_0x20c6d0[_0x42f7('0x1a')]);_0x34ac7a[_0x42f7('0x1d')]=_[_0x42f7('0x2f')](_0x20c6d0[_0x42f7('0x19')],qs[_0x42f7('0x1e')](_0x425ae5[_0x42f7('0x1a')][_0x42f7('0x1e')]));_0x34ac7a['attributes']=_0x34ac7a[_0x42f7('0x1d')][_0x42f7('0x30')]?_0x34ac7a['attributes']:_0x20c6d0[_0x42f7('0x19')];if(_0x425ae5[_0x42f7('0x1a')][_0x42f7('0x27')]){_0x34ac7a[_0x42f7('0x28')]=[{'all':!![]}];}_0x34ac7a=_[_0x42f7('0x24')]({},_0x34ac7a,_0x425ae5[_0x42f7('0x26')]);return db[_0x42f7('0x15')]['find'](_0x34ac7a)[_0x42f7('0xf')](handleEntityNotFound(_0x339606,null))[_0x42f7('0xf')](respondWithResult(_0x339606,null))[_0x42f7('0x2b')](handleError(_0x339606,null));};exports[_0x42f7('0x31')]=function(_0x5075d0,_0x2f9a21){return db[_0x42f7('0x15')]['create'](_0x5075d0[_0x42f7('0x32')],{})['then'](respondWithResult(_0x2f9a21,0xc9))[_0x42f7('0x2b')](handleError(_0x2f9a21,null));};exports[_0x42f7('0xe')]=function(_0x13a0c0,_0x1d8524){if(_0x13a0c0['body']['id']){delete _0x13a0c0[_0x42f7('0x32')]['id'];}return db['Dynamics365Account'][_0x42f7('0x33')]({'where':{'id':_0x13a0c0[_0x42f7('0x2d')]['id']}})[_0x42f7('0xf')](handleEntityNotFound(_0x1d8524,null))['then'](saveUpdates(_0x13a0c0[_0x42f7('0x32')],null))[_0x42f7('0xf')](respondWithResult(_0x1d8524,null))[_0x42f7('0x2b')](handleError(_0x1d8524,null));};exports['destroy']=function(_0x1b1a99,_0x1cb39e){return db[_0x42f7('0x15')]['find']({'where':{'id':_0x1b1a99[_0x42f7('0x2d')]['id']}})[_0x42f7('0xf')](handleEntityNotFound(_0x1cb39e,null))[_0x42f7('0xf')](removeEntity(_0x1cb39e,null))[_0x42f7('0x2b')](handleError(_0x1cb39e,null));};exports[_0x42f7('0x34')]=function(_0xcbc1f2,_0x1e0138){var _0x527595={};var _0x32124e={};var _0x4114ff;var _0x20c18f;return db[_0x42f7('0x15')]['findOne']({'where':{'id':_0xcbc1f2[_0x42f7('0x2d')]['id']}})[_0x42f7('0xf')](handleEntityNotFound(_0x1e0138,null))[_0x42f7('0xf')](function(_0x1ab795){if(_0x1ab795){_0x4114ff=_0x1ab795;_0x32124e[_0x42f7('0x19')]=_['keys'](db[_0x42f7('0x35')][_0x42f7('0x2e')]);_0x32124e[_0x42f7('0x1a')]=_[_0x42f7('0x1b')](_0xcbc1f2['query']);_0x32124e[_0x42f7('0x1c')]=_['intersection'](_0x32124e[_0x42f7('0x19')],_0x32124e['query']);_0x527595[_0x42f7('0x1d')]=_['intersection'](_0x32124e[_0x42f7('0x19')],qs['fields'](_0xcbc1f2[_0x42f7('0x1a')][_0x42f7('0x1e')]));_0x527595['attributes']=_0x527595[_0x42f7('0x1d')][_0x42f7('0x30')]?_0x527595[_0x42f7('0x1d')]:_0x32124e[_0x42f7('0x19')];_0x527595[_0x42f7('0x20')]=qs[_0x42f7('0x21')](_0xcbc1f2['query'][_0x42f7('0x21')]);_0x527595[_0x42f7('0x22')]=qs[_0x42f7('0x1c')](_['pick'](_0xcbc1f2[_0x42f7('0x1a')],_0x32124e[_0x42f7('0x1c')]));if(_0xcbc1f2[_0x42f7('0x1a')][_0x42f7('0x23')]){_0x527595[_0x42f7('0x22')]=_[_0x42f7('0x24')](_0x527595[_0x42f7('0x22')],{'$or':_['map'](_0x527595[_0x42f7('0x1d')],function(_0x41d1a3){var _0x325486={};_0x325486[_0x41d1a3]={'$like':'%'+_0xcbc1f2[_0x42f7('0x1a')][_0x42f7('0x23')]+'%'};return _0x325486;})});}_0x527595=_[_0x42f7('0x24')]({},_0x527595,_0xcbc1f2['options']);return _0x4114ff[_0x42f7('0x34')](_0x527595);}})[_0x42f7('0xf')](function(_0x4df956){if(_0x4df956){_0x20c18f=_0x4df956['length'];if(!_0xcbc1f2[_0x42f7('0x1a')][_0x42f7('0x36')]('nolimit')){_0x527595[_0x42f7('0xa')]=qs['limit'](_0xcbc1f2[_0x42f7('0x1a')][_0x42f7('0xa')]);_0x527595['offset']=qs[_0x42f7('0x7')](_0xcbc1f2[_0x42f7('0x1a')]['offset']);}return _0x4114ff[_0x42f7('0x34')](_0x527595);}})[_0x42f7('0xf')](function(_0x25bb0a){if(_0x25bb0a){return _0x25bb0a?{'count':_0x20c18f,'rows':_0x25bb0a}:null;}})[_0x42f7('0xf')](respondWithResult(_0x1e0138,null))[_0x42f7('0x2b')](handleError(_0x1e0138,null));};exports[_0x42f7('0x37')]=function(_0x2a1446,_0x6cf632){if(_0x2a1446[_0x42f7('0x32')]['id']){delete _0x2a1446[_0x42f7('0x32')]['id'];}return db[_0x42f7('0x15')][_0x42f7('0x38')]({'where':{'id':_0x2a1446[_0x42f7('0x2d')]['id']}})[_0x42f7('0xf')](handleEntityNotFound(_0x6cf632,null))[_0x42f7('0xf')](function(_0x380059){if(_0x380059){_0x2a1446['body'][_0x42f7('0x39')]=_0x380059['id'];_0x2a1446[_0x42f7('0x32')][_0x42f7('0x3a')]=integrations[_0x42f7('0x3b')](_0x2a1446['body'][_0x42f7('0x3c')],_0x2a1446['body'][_0x42f7('0x17')]);_0x2a1446[_0x42f7('0x32')][_0x42f7('0x3d')]=integrations[_0x42f7('0x3e')](_0x2a1446[_0x42f7('0x32')][_0x42f7('0x3c')],_0x2a1446[_0x42f7('0x32')][_0x42f7('0x17')]);return db[_0x42f7('0x35')][_0x42f7('0x31')](_0x2a1446[_0x42f7('0x32')],{'include':[{'model':db[_0x42f7('0x3f')],'as':_0x42f7('0x3a')},{'model':db['Dynamics365Field'],'as':_0x42f7('0x3d')}]});}return null;})['then'](respondWithResult(_0x6cf632,null))[_0x42f7('0x2b')](handleError(_0x6cf632,null));};function sanitizeRemoteUri(_0x4585d1){var _0x292f91=_0x4585d1[_0x42f7('0x40')](-0x1);if(_0x292f91==='/')return _0x4585d1[_0x42f7('0x41')](0x0,_0x4585d1[_0x42f7('0x42')](_0x292f91));return _0x4585d1;}function getWebApiUrl(_0x1f9769){return util[_0x42f7('0x43')](_0x42f7('0x44'),_0x1f9769);}exports[_0x42f7('0x45')]=function(_0x544f30,_0x40c90f){var _0x4b4a1b=_0x544f30[_0x42f7('0x1a')][_0x42f7('0x46')];var _0x20f751=_0x4b4a1b===_0x42f7('0x47')?_0x42f7('0x48'):_0x42f7('0x49');var _0x1c16e0='';var _0x4c3b54='';var _0x16c62a='';var _0x130bf4='';var _0x4e9d01='';var _0x1231e='';var _0x55ffca='';var _0x13bb87='';var _0x13f226=[_0x42f7('0x4a'),_0x42f7('0x4b'),_0x42f7('0x4c'),_0x42f7('0x4d'),_0x42f7('0x4e'),'subject','phonenumber',_0x42f7('0x4f'),_0x42f7('0x50'),_0x42f7('0x51')];var _0x43c7ef=['accountidname',_0x42f7('0x52'),'actualserviceunits','billedserviceunits','contactidname',_0x42f7('0x53'),_0x42f7('0x54'),'contractidname',_0x42f7('0x55'),_0x42f7('0x56'),'createdbyname',_0x42f7('0x57'),_0x42f7('0x58'),_0x42f7('0x59'),_0x42f7('0x5a'),_0x42f7('0x5b'),_0x42f7('0x5c'),_0x42f7('0x5d'),_0x42f7('0x5e'),'entitlementidname',_0x42f7('0x5f'),_0x42f7('0x60'),_0x42f7('0x61'),_0x42f7('0x62'),'firstresponsebykpiidname','followupby',_0x42f7('0x63'),'influencescore',_0x42f7('0x64'),_0x42f7('0x65'),_0x42f7('0x66'),_0x42f7('0x67'),_0x42f7('0x68'),_0x42f7('0x69'),_0x42f7('0x6a'),_0x42f7('0x6b'),'modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename',_0x42f7('0x6c'),_0x42f7('0x6d'),_0x42f7('0x6e'),'overriddencreatedon',_0x42f7('0x6f'),'owneridtype',_0x42f7('0x70'),'parentcaseidname',_0x42f7('0x71'),_0x42f7('0x72'),_0x42f7('0x73'),_0x42f7('0x74'),_0x42f7('0x75'),'resolveby',_0x42f7('0x76'),'responseby',_0x42f7('0x77'),'responsiblecontactidyominame',_0x42f7('0x78'),'slainvokedidname','slaname','socialprofileidname','statecode',_0x42f7('0x79'),'subjectidname',_0x42f7('0x7a'),'timezoneruleversionnumber',_0x42f7('0x7b'),'traversedpath',_0x42f7('0x7c'),_0x42f7('0x7d')];var _0x31916a=_0x13f226[_0x42f7('0x7e')](_0x43c7ef);return db[_0x42f7('0x15')]['findOne']({'where':{'id':_0x544f30[_0x42f7('0x2d')]['id']},'attributes':['id',_0x42f7('0x7f'),_0x42f7('0x80'),_0x42f7('0x81'),_0x42f7('0x82'),'clientId','clientSecret',_0x42f7('0x83')],'include':[{'model':db[_0x42f7('0x84')],'as':_0x42f7('0x84'),'attributes':['id','data5',_0x42f7('0x85')]}]})[_0x42f7('0xf')](handleEntityNotFound(_0x40c90f,null))[_0x42f7('0xf')](function(_0x5c0b4a){if(_0x5c0b4a){if(_0x5c0b4a['modernAuthentication']){_0x5c0b4a['access_token']=_0x5c0b4a[_0x42f7('0x84')]['data5'];_0x13bb87=sanitizeRemoteUri(_0x5c0b4a[_0x42f7('0x84')][_0x42f7('0x85')]);_0x55ffca=getWebApiUrl(_0x13bb87);return _0x5c0b4a;}_0x13bb87=sanitizeRemoteUri(_0x5c0b4a[_0x42f7('0x81')]);_0x55ffca=getWebApiUrl(_0x13bb87);var _0x47fa69={'method':_0x42f7('0x86'),'uri':_0x42f7('0x87')+_0x5c0b4a[_0x42f7('0x82')]+'/oauth2/token','form':{'client_id':_0x5c0b4a['clientId'],'resource':_0x13bb87,'username':_0x5c0b4a['username'],'password':_0x5c0b4a['password'],'grant_type':'password','client_secret':_0x5c0b4a[_0x42f7('0x88')]},'json':!![]};return rp(_0x47fa69);}})['then'](function(_0x5dffe9){_0x1231e=_0x5dffe9['access_token'];var _0x2de135={'method':_0x42f7('0x89'),'uri':encodeURI(_0x55ffca+_0x42f7('0x8a')+_0x20f751+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x1231e,'If-None-Match':null,'OData-Version':_0x42f7('0x8b')},'json':!![]};return rp(_0x2de135);})[_0x42f7('0xf')](function(_0x4f4221){var _0x245193=_0x4f4221[_0x42f7('0x8c')][0x0];var _0x5f5261=_0x245193[_0x42f7('0x8d')];var _0x2fcbd9={'method':_0x42f7('0x89'),'uri':_0x55ffca+_0x42f7('0x8e')+_0x5f5261+_0x42f7('0x8f'),'headers':{'Authorization':_0x42f7('0x90')+_0x1231e,'If-None-Match':null,'OData-Version':_0x42f7('0x8b')},'json':!![]};return rp(_0x2fcbd9);})[_0x42f7('0xf')](function(_0x6f4f74){_0x1c16e0=_0x6f4f74;_0x4c3b54=_0x1c16e0[_0x42f7('0x91')];_0x4c3b54=_['remove'](_0x4c3b54,function(_0xb9df8c){return!_0x31916a['includes'](_0xb9df8c[_0x42f7('0x92')]);});var _0x282067=[];var _0x3929e4=[];_0x4c3b54['forEach'](function(_0x33d970){if(_0x33d970['@odata.type']){var _0x2b5a0f=_0x33d970[_0x42f7('0x93')][_0x42f7('0x41')](_0x33d970['@odata.type'][_0x42f7('0x42')]('.')+0x1);if(_0x2b5a0f===_0x42f7('0x94')){_0x282067[_0x42f7('0x95')](getSelectList(_0x55ffca,_0x4b4a1b,_0x3929e4,_0x1c16e0[_0x42f7('0x8d')],_0x33d970[_0x42f7('0x8d')],_0x1231e));}}});return Promise['all'](_0x282067);})[_0x42f7('0xf')](function(_0x1eae7e){_0x16c62a=_0x1eae7e[0x0];var _0x791baa=[];var _0x41dbc2=[];_0x4c3b54[_0x42f7('0x96')](function(_0xbf411e){if(!_[_0x42f7('0x97')](_0xbf411e[_0x42f7('0x93')])){var _0x25f0ea=_0xbf411e[_0x42f7('0x93')]['substring'](_0xbf411e[_0x42f7('0x93')]['lastIndexOf']('.')+0x1);if(_0x25f0ea===_0x42f7('0x98')){_0x791baa[_0x42f7('0x95')](getBooleanList(_0x55ffca,_0x4b4a1b,_0x41dbc2,_0x1c16e0['MetadataId'],_0xbf411e['MetadataId'],_0x1231e));}}});return Promise[_0x42f7('0x99')](_0x791baa);})[_0x42f7('0xf')](function(_0x15d56b){_0x130bf4=_0x15d56b[0x0];var _0x50db7c=[];var _0x40c2fd=[];_0x4c3b54[_0x42f7('0x96')](function(_0x41544a){if(_0x41544a[_0x42f7('0x93')]){var _0x53e005=_0x41544a[_0x42f7('0x93')][_0x42f7('0x41')](_0x41544a[_0x42f7('0x93')][_0x42f7('0x42')]('.')+0x1);if(_0x53e005===_0x42f7('0x9a')||_0x53e005===_0x42f7('0x9b')||_0x53e005==='BigIntAttributeMetadata'||_0x53e005===_0x42f7('0x9c')||_0x53e005===_0x42f7('0x9d')||_0x53e005===_0x42f7('0x9e')||_0x53e005===_0x42f7('0x9f')||_0x53e005==='EntityNameAttributeMetadata'||_0x53e005===_0x42f7('0xa0')||_0x53e005===_0x42f7('0xa1')){_0x50db7c[_0x42f7('0x95')](getInputList(_0x55ffca,_0x4b4a1b,_0x53e005,_0x40c2fd,_0x1c16e0[_0x42f7('0x8d')],_0x41544a[_0x42f7('0x8d')],_0x1231e));}}});return Promise[_0x42f7('0x99')](_0x50db7c);})['then'](function(_0xc632a6){_0x4e9d01=_0xc632a6[0x0];var _0x33056b=_0x16c62a[_0x42f7('0x7e')](_0x130bf4)['concat'](_0x4e9d01);var _0x2abe44={'count':_0x33056b[_0x42f7('0x30')],'rows':_0x33056b};return _0x2abe44;})[_0x42f7('0xf')](respondWithResult(_0x40c90f,null))[_0x42f7('0x2b')](function(_0x48acbd){var _0x133767=_0x544f30[_0x42f7('0x1a')][_0x42f7('0xa2')]?0x1f4:_0x48acbd['statusCode']||0x1f4;logger[_0x42f7('0x11')](_0x48acbd['stack']);delete _0x48acbd[_0x42f7('0x12')];if(_0x133767===0x191){_0x133767=0x190;}_0x40c90f[_0x42f7('0xa3')](_0x133767)[_0x42f7('0xa4')](_0x544f30[_0x42f7('0x1a')][_0x42f7('0xa2')]?{'message':_0x42f7('0xa5'),'statusCode':_0x48acbd[_0x42f7('0xa6')]}:_0x48acbd);});};function getSelectList(_0x1219be,_0x48b24a,_0x45547c,_0x1b130a,_0x24332c,_0xc8facf){var _0xf47a3d={'method':_0x42f7('0x89'),'uri':_0x1219be+_0x42f7('0x8e')+_0x1b130a+_0x42f7('0xa7')+_0x24332c+_0x42f7('0xa8')+_0x42f7('0xa9'),'headers':{'Authorization':'Bearer\x20'+_0xc8facf,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xf47a3d)[_0x42f7('0xf')](function(_0x1b63b6){var _0x1bc594=[];var _0x260595=_0x1b63b6['OptionSet'][_0x42f7('0xaa')];_0x260595[_0x42f7('0x96')](function(_0x1acadf){_0x1bc594[_0x42f7('0x95')]({'name':_0x1acadf[_0x42f7('0xab')][_0x42f7('0xac')][_0x42f7('0xab')],'value':String(_0x1acadf['Value'])});});var _0x438717={'id':_0x48b24a+'_'+_0x1b63b6[_0x42f7('0x92')],'name':_0x1b63b6['DisplayName'][_0x42f7('0xac')]['Label'],'custom':![],'options':_0x1bc594};_0x45547c[_0x42f7('0x95')](_0x438717);return _0x45547c;});}function getBooleanList(_0x18eed6,_0x44dfd0,_0x2d48d4,_0x5dc312,_0x46ef4b,_0x23356b){var _0x3280eb={'method':_0x42f7('0x89'),'uri':_0x18eed6+_0x42f7('0x8e')+_0x5dc312+_0x42f7('0xa7')+_0x46ef4b+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x42f7('0x90')+_0x23356b,'If-None-Match':null,'OData-Version':_0x42f7('0x8b')},'json':!![]};return rp(_0x3280eb)[_0x42f7('0xf')](function(_0x409502){var _0x53faf1=[];_0x53faf1[_0x42f7('0x95')]({'name':_0x409502['OptionSet'][_0x42f7('0xad')][_0x42f7('0xab')]['UserLocalizedLabel'][_0x42f7('0xab')],'value':_0x42f7('0xae')},{'name':_0x409502[_0x42f7('0xaf')][_0x42f7('0xb0')]['Label'][_0x42f7('0xac')]['Label'],'value':_0x42f7('0xb1')});var _0x1e0aa1={'id':_0x44dfd0+'_'+_0x409502[_0x42f7('0x92')],'name':_0x409502[_0x42f7('0xb2')][_0x42f7('0xac')][_0x42f7('0xab')],'custom':![],'options':_0x53faf1};_0x2d48d4[_0x42f7('0x95')](_0x1e0aa1);return _0x2d48d4;});}function getInputList(_0x2febe9,_0x131ce3,_0x6ad17b,_0xe6ced0,_0x2952b9,_0x4f7cfe,_0x52ce0c){var _0x4a54d2={'method':_0x42f7('0x89'),'uri':_0x2febe9+'EntityDefinitions('+_0x2952b9+_0x42f7('0xa7')+_0x4f7cfe+_0x42f7('0xb3')+_0x6ad17b+_0x42f7('0xb4'),'headers':{'Authorization':'Bearer\x20'+_0x52ce0c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4a54d2)[_0x42f7('0xf')](function(_0x2f594e){var _0x1cd0c3={'id':_0x131ce3+'_'+_0x2f594e[_0x42f7('0x92')],'name':_0x2f594e['DisplayName'][_0x42f7('0xac')]?_0x2f594e[_0x42f7('0xb2')]['UserLocalizedLabel']['Label']:_0x2f594e[_0x42f7('0x92')],'custom':![],'options':[]};_0xe6ced0[_0x42f7('0x95')](_0x1cd0c3);return _0xe6ced0;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index f9e7f09..4b0b75b 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x42cc80,_0x5ec36c){var _0x4cd875=function(_0x351c55){while(--_0x351c55){_0x42cc80['push'](_0x42cc80['shift']());}};_0x4cd875(++_0x5ec36c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0xb7e7[_0x4e6ae6];return _0x23c108;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x6c8726,_0x5e3c0b){var _0xc68c5b=function(_0x117f46){while(--_0x117f46){_0x6c8726['push'](_0x6c8726['shift']());}};_0xc68c5b(++_0x5e3c0b);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index d62aed3..c87ca30 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 _0xd78f=['Dynamics365Account','findAll','options','raw','where','attributes','include','model','map','debug','ShowDynamics365Account','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetDynamics365Account'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xd78f,0x78));var _0xfd78=function(_0x415e06,_0x13a4c4){_0x415e06=_0x415e06-0x0;var _0x55312e=_0xd78f[_0x415e06];return _0x55312e;};'use strict';var _=require(_0xfd78('0x0'));var util=require(_0xfd78('0x1'));var moment=require(_0xfd78('0x2'));var BPromise=require(_0xfd78('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd78('0x4'));var db=require(_0xfd78('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd78('0x6'))(_0xfd78('0x7'));var config=require('../../config/environment');var jayson=require(_0xfd78('0x8'));var client=jayson[_0xfd78('0x9')][_0xfd78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e3c3e,_0x291a63,_0x202c79){return new BPromise(function(_0x20c9f8,_0x4806d1){return client[_0xfd78('0xb')](_0x2e3c3e,_0x202c79)[_0xfd78('0xc')](function(_0x317591){logger['info'](_0xfd78('0xd'),_0x291a63,_0xfd78('0xe'));logger['debug'](_0xfd78('0xf'),_0x291a63,_0xfd78('0xe'),JSON[_0xfd78('0x10')](_0x317591));if(_0x317591['error']){if(_0x317591[_0xfd78('0x11')][_0xfd78('0x12')]===0x1f4){logger[_0xfd78('0x11')](_0xfd78('0xd'),_0x291a63,_0x317591[_0xfd78('0x11')]['message']);return _0x4806d1(_0x317591[_0xfd78('0x11')][_0xfd78('0x13')]);}logger[_0xfd78('0x11')](_0xfd78('0xd'),_0x291a63,_0x317591['error'][_0xfd78('0x13')]);return _0x20c9f8(_0x317591['error'][_0xfd78('0x13')]);}else{logger[_0xfd78('0x14')](_0xfd78('0xd'),_0x291a63,_0xfd78('0xe'));_0x20c9f8(_0x317591[_0xfd78('0x15')][_0xfd78('0x13')]);}})[_0xfd78('0x16')](function(_0x3f2157){logger[_0xfd78('0x11')](_0xfd78('0xd'),_0x291a63,_0x3f2157);_0x4806d1(_0x3f2157);});});}exports[_0xfd78('0x17')]=function(_0x2e33da){var _0x21d1be=this;return new Promise(function(_0x79f0d9,_0x509d81){return db[_0xfd78('0x18')][_0xfd78('0x19')]({'raw':_0x2e33da[_0xfd78('0x1a')]?_0x2e33da[_0xfd78('0x1a')][_0xfd78('0x1b')]===undefined?!![]:![]:!![],'where':_0x2e33da[_0xfd78('0x1a')]?_0x2e33da['options'][_0xfd78('0x1c')]||null:null,'attributes':_0x2e33da[_0xfd78('0x1a')]?_0x2e33da[_0xfd78('0x1a')][_0xfd78('0x1d')]||null:null,'limit':_0x2e33da[_0xfd78('0x1a')]?_0x2e33da[_0xfd78('0x1a')]['limit']||null:null,'include':_0x2e33da[_0xfd78('0x1a')]?_0x2e33da[_0xfd78('0x1a')]['include']?_['map'](_0x2e33da[_0xfd78('0x1a')][_0xfd78('0x1e')],function(_0x35f632){return{'model':db[_0x35f632[_0xfd78('0x1f')]],'as':_0x35f632['as'],'attributes':_0x35f632['attributes'],'include':_0x35f632['include']?_[_0xfd78('0x20')](_0x35f632[_0xfd78('0x1e')],function(_0x131139){return{'model':db[_0x131139[_0xfd78('0x1f')]],'as':_0x131139['as'],'attributes':_0x131139['attributes'],'include':_0x131139['include']?_['map'](_0x131139[_0xfd78('0x1e')],function(_0x14247a){return{'model':db[_0x14247a['model']],'as':_0x14247a['as'],'attributes':_0x14247a['attributes']};}):[]};}):[]};}):[]:[]})[_0xfd78('0xc')](function(_0x50409f){logger[_0xfd78('0x14')](_0xfd78('0x17'),_0x2e33da);logger[_0xfd78('0x21')]('GetDynamics365Account',_0x2e33da,JSON['stringify'](_0x50409f));_0x79f0d9(_0x50409f);})['catch'](function(_0x195aa8){logger['error'](_0xfd78('0x17'),_0x195aa8['message'],_0x2e33da);_0x509d81(_0x21d1be[_0xfd78('0x11')](0x1f4,_0x195aa8['message']));});});};exports[_0xfd78('0x22')]=function(_0x451fae){var _0x4f337e=this;return new Promise(function(_0x312d8b,_0x50645b){return db[_0xfd78('0x18')][_0xfd78('0x23')]({'raw':_0x451fae['options']?_0x451fae['options'][_0xfd78('0x1b')]===undefined?!![]:![]:!![],'where':_0x451fae[_0xfd78('0x1a')]?_0x451fae[_0xfd78('0x1a')][_0xfd78('0x1c')]||null:null,'attributes':_0x451fae[_0xfd78('0x1a')]?_0x451fae[_0xfd78('0x1a')][_0xfd78('0x1d')]||null:null,'include':_0x451fae['options']?_0x451fae[_0xfd78('0x1a')][_0xfd78('0x1e')]?_[_0xfd78('0x20')](_0x451fae[_0xfd78('0x1a')][_0xfd78('0x1e')],function(_0x4188e3){return{'model':db[_0x4188e3[_0xfd78('0x1f')]],'as':_0x4188e3['as'],'attributes':_0x4188e3['attributes'],'include':_0x4188e3['include']?_[_0xfd78('0x20')](_0x4188e3[_0xfd78('0x1e')],function(_0x4ff616){return{'model':db[_0x4ff616[_0xfd78('0x1f')]],'as':_0x4ff616['as'],'attributes':_0x4ff616[_0xfd78('0x1d')],'include':_0x4ff616['include']?_[_0xfd78('0x20')](_0x4ff616[_0xfd78('0x1e')],function(_0xcb8c5f){return{'model':db[_0xcb8c5f[_0xfd78('0x1f')]],'as':_0xcb8c5f['as'],'attributes':_0xcb8c5f['attributes']};}):[]};}):[]};}):[]:[]})[_0xfd78('0xc')](function(_0x34487){logger[_0xfd78('0x14')](_0xfd78('0x22'),_0x451fae);logger[_0xfd78('0x21')]('ShowDynamics365Account',_0x451fae,JSON[_0xfd78('0x10')](_0x34487));_0x312d8b(_0x34487);})[_0xfd78('0x16')](function(_0x1dbaa6){logger[_0xfd78('0x11')](_0xfd78('0x22'),_0x1dbaa6[_0xfd78('0x13')],_0x451fae);_0x50645b(_0x4f337e['error'](0x1f4,_0x1dbaa6[_0xfd78('0x13')]));});});}; \ No newline at end of file +var _0x6ca5=['Dynamics365Account','findAll','options','attributes','limit','include','model','map','debug','ShowDynamics365Account','find','raw','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account'];(function(_0x2dc2ed,_0x10e921){var _0x3f8ab3=function(_0x4e41d4){while(--_0x4e41d4){_0x2dc2ed['push'](_0x2dc2ed['shift']());}};_0x3f8ab3(++_0x10e921);}(_0x6ca5,0x16c));var _0x56ca=function(_0x36b126,_0x30151d){_0x36b126=_0x36b126-0x0;var _0x41f5ab=_0x6ca5[_0x36b126];return _0x41f5ab;};'use strict';var _=require(_0x56ca('0x0'));var util=require(_0x56ca('0x1'));var moment=require(_0x56ca('0x2'));var BPromise=require(_0x56ca('0x3'));var rs=require(_0x56ca('0x4'));var fs=require('fs');var Redis=require(_0x56ca('0x5'));var db=require(_0x56ca('0x6'))['db'];var utils=require(_0x56ca('0x7'));var logger=require(_0x56ca('0x8'))(_0x56ca('0x9'));var config=require(_0x56ca('0xa'));var jayson=require(_0x56ca('0xb'));var client=jayson[_0x56ca('0xc')][_0x56ca('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x30ce8c,_0x4fe2fa,_0x1d3eeb){return new BPromise(function(_0x204471,_0x415bf7){return client[_0x56ca('0xe')](_0x30ce8c,_0x1d3eeb)[_0x56ca('0xf')](function(_0x54abfd){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x4fe2fa,_0x56ca('0x10'));logger['debug'](_0x56ca('0x11'),_0x4fe2fa,_0x56ca('0x10'),JSON[_0x56ca('0x12')](_0x54abfd));if(_0x54abfd[_0x56ca('0x13')]){if(_0x54abfd[_0x56ca('0x13')][_0x56ca('0x14')]===0x1f4){logger[_0x56ca('0x13')](_0x56ca('0x15'),_0x4fe2fa,_0x54abfd[_0x56ca('0x13')]['message']);return _0x415bf7(_0x54abfd['error']['message']);}logger[_0x56ca('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x4fe2fa,_0x54abfd['error'][_0x56ca('0x16')]);return _0x204471(_0x54abfd[_0x56ca('0x13')]['message']);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x4fe2fa,_0x56ca('0x10'));_0x204471(_0x54abfd[_0x56ca('0x17')][_0x56ca('0x16')]);}})[_0x56ca('0x18')](function(_0x1f0320){logger[_0x56ca('0x13')](_0x56ca('0x15'),_0x4fe2fa,_0x1f0320);_0x415bf7(_0x1f0320);});});}exports[_0x56ca('0x19')]=function(_0xd31104){var _0x5031b7=this;return new Promise(function(_0x133d1a,_0x133b70){return db[_0x56ca('0x1a')][_0x56ca('0x1b')]({'raw':_0xd31104[_0x56ca('0x1c')]?_0xd31104[_0x56ca('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xd31104['options']?_0xd31104[_0x56ca('0x1c')]['where']||null:null,'attributes':_0xd31104['options']?_0xd31104['options'][_0x56ca('0x1d')]||null:null,'limit':_0xd31104[_0x56ca('0x1c')]?_0xd31104[_0x56ca('0x1c')][_0x56ca('0x1e')]||null:null,'include':_0xd31104[_0x56ca('0x1c')]?_0xd31104['options'][_0x56ca('0x1f')]?_['map'](_0xd31104['options'][_0x56ca('0x1f')],function(_0x435bea){return{'model':db[_0x435bea[_0x56ca('0x20')]],'as':_0x435bea['as'],'attributes':_0x435bea['attributes'],'include':_0x435bea[_0x56ca('0x1f')]?_[_0x56ca('0x21')](_0x435bea[_0x56ca('0x1f')],function(_0x4c1b7a){return{'model':db[_0x4c1b7a[_0x56ca('0x20')]],'as':_0x4c1b7a['as'],'attributes':_0x4c1b7a[_0x56ca('0x1d')],'include':_0x4c1b7a[_0x56ca('0x1f')]?_[_0x56ca('0x21')](_0x4c1b7a[_0x56ca('0x1f')],function(_0x3af89f){return{'model':db[_0x3af89f[_0x56ca('0x20')]],'as':_0x3af89f['as'],'attributes':_0x3af89f[_0x56ca('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x56ca('0xf')](function(_0x19045c){logger['info'](_0x56ca('0x19'),_0xd31104);logger[_0x56ca('0x22')]('GetDynamics365Account',_0xd31104,JSON['stringify'](_0x19045c));_0x133d1a(_0x19045c);})[_0x56ca('0x18')](function(_0x5565ba){logger['error']('GetDynamics365Account',_0x5565ba[_0x56ca('0x16')],_0xd31104);_0x133b70(_0x5031b7[_0x56ca('0x13')](0x1f4,_0x5565ba['message']));});});};exports[_0x56ca('0x23')]=function(_0x43bd40){var _0x405f35=this;return new Promise(function(_0x4b2b1d,_0x43e3da){return db[_0x56ca('0x1a')][_0x56ca('0x24')]({'raw':_0x43bd40[_0x56ca('0x1c')]?_0x43bd40[_0x56ca('0x1c')][_0x56ca('0x25')]===undefined?!![]:![]:!![],'where':_0x43bd40['options']?_0x43bd40[_0x56ca('0x1c')]['where']||null:null,'attributes':_0x43bd40['options']?_0x43bd40[_0x56ca('0x1c')][_0x56ca('0x1d')]||null:null,'include':_0x43bd40[_0x56ca('0x1c')]?_0x43bd40[_0x56ca('0x1c')]['include']?_[_0x56ca('0x21')](_0x43bd40[_0x56ca('0x1c')][_0x56ca('0x1f')],function(_0x1fa74e){return{'model':db[_0x1fa74e[_0x56ca('0x20')]],'as':_0x1fa74e['as'],'attributes':_0x1fa74e['attributes'],'include':_0x1fa74e[_0x56ca('0x1f')]?_[_0x56ca('0x21')](_0x1fa74e[_0x56ca('0x1f')],function(_0x543718){return{'model':db[_0x543718[_0x56ca('0x20')]],'as':_0x543718['as'],'attributes':_0x543718['attributes'],'include':_0x543718[_0x56ca('0x1f')]?_[_0x56ca('0x21')](_0x543718[_0x56ca('0x1f')],function(_0x422dd1){return{'model':db[_0x422dd1['model']],'as':_0x422dd1['as'],'attributes':_0x422dd1[_0x56ca('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x56ca('0xf')](function(_0x3b40d6){logger[_0x56ca('0x26')](_0x56ca('0x23'),_0x43bd40);logger[_0x56ca('0x22')](_0x56ca('0x23'),_0x43bd40,JSON[_0x56ca('0x12')](_0x3b40d6));_0x4b2b1d(_0x3b40d6);})[_0x56ca('0x18')](function(_0x47377a){logger[_0x56ca('0x13')]('ShowDynamics365Account',_0x47377a[_0x56ca('0x16')],_0x43bd40);_0x43e3da(_0x405f35[_0x56ca('0x13')](0x1f4,_0x47377a['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 4c386d2..1004c5c 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 _0x6e7d=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','show','/:id/fields'];(function(_0x39a42e,_0x594f2c){var _0x462d94=function(_0x1b999a){while(--_0x1b999a){_0x39a42e['push'](_0x39a42e['shift']());}};_0x462d94(++_0x594f2c);}(_0x6e7d,0x1a0));var _0xd6e7=function(_0x3778d5,_0x162dfa){_0x3778d5=_0x3778d5-0x0;var _0x23913d=_0x6e7d[_0x3778d5];return _0x23913d;};'use strict';var multer=require(_0xd6e7('0x0'));var util=require(_0xd6e7('0x1'));var path=require(_0xd6e7('0x2'));var timeout=require(_0xd6e7('0x3'));var express=require(_0xd6e7('0x4'));var router=express[_0xd6e7('0x5')]();var fs_extra=require(_0xd6e7('0x6'));var auth=require(_0xd6e7('0x7'));var interaction=require(_0xd6e7('0x8'));var config=require(_0xd6e7('0x9'));var controller=require(_0xd6e7('0xa'));router[_0xd6e7('0xb')]('/',auth[_0xd6e7('0xc')](),controller[_0xd6e7('0xd')]);router[_0xd6e7('0xb')]('/:id',auth[_0xd6e7('0xc')](),controller[_0xd6e7('0xe')]);router[_0xd6e7('0xb')](_0xd6e7('0xf'),auth[_0xd6e7('0xc')](),controller['getFields']);router[_0xd6e7('0xb')](_0xd6e7('0x10'),auth[_0xd6e7('0xc')](),controller[_0xd6e7('0x11')]);router[_0xd6e7('0xb')](_0xd6e7('0x12'),auth[_0xd6e7('0xc')](),controller[_0xd6e7('0x13')]);router[_0xd6e7('0x14')]('/',auth[_0xd6e7('0xc')](),controller[_0xd6e7('0x15')]);router['put'](_0xd6e7('0x16'),auth[_0xd6e7('0xc')](),controller[_0xd6e7('0x17')]);router[_0xd6e7('0x18')](_0xd6e7('0x16'),auth[_0xd6e7('0xc')](),controller[_0xd6e7('0x19')]);module[_0xd6e7('0x1a')]=router; \ No newline at end of file +var _0xdbcd=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','create','put','delete','destroy','exports','util','path'];(function(_0x371f35,_0x33aee4){var _0x141c89=function(_0x50d0ab){while(--_0x50d0ab){_0x371f35['push'](_0x371f35['shift']());}};_0x141c89(++_0x33aee4);}(_0xdbcd,0x67));var _0xddbc=function(_0x2db146,_0x509cc5){_0x2db146=_0x2db146-0x0;var _0x524bcb=_0xdbcd[_0x2db146];return _0x524bcb;};'use strict';var multer=require('multer');var util=require(_0xddbc('0x0'));var path=require(_0xddbc('0x1'));var timeout=require(_0xddbc('0x2'));var express=require('express');var router=express[_0xddbc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xddbc('0x4'));var interaction=require(_0xddbc('0x5'));var config=require(_0xddbc('0x6'));var controller=require(_0xddbc('0x7'));router[_0xddbc('0x8')]('/',auth[_0xddbc('0x9')](),controller['index']);router[_0xddbc('0x8')](_0xddbc('0xa'),auth['isAuthenticated'](),controller[_0xddbc('0xb')]);router[_0xddbc('0x8')](_0xddbc('0xc'),auth[_0xddbc('0x9')](),controller['getFields']);router['get'](_0xddbc('0xd'),auth['isAuthenticated'](),controller[_0xddbc('0xe')]);router['get']('/:id/descriptions',auth[_0xddbc('0x9')](),controller[_0xddbc('0xf')]);router['post']('/',auth[_0xddbc('0x9')](),controller[_0xddbc('0x10')]);router[_0xddbc('0x11')]('/:id',auth[_0xddbc('0x9')](),controller['update']);router[_0xddbc('0x12')](_0xddbc('0xa'),auth[_0xddbc('0x9')](),controller[_0xddbc('0x13')]);module[_0xddbc('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 d49807a..d183cab 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 _0x9cad=['incident','contact','nothing','BOOLEAN','sequelize','exports','STRING','ENUM','phonecall'];(function(_0x1b4943,_0x48bd8d){var _0x1e91f0=function(_0x1799f2){while(--_0x1799f2){_0x1b4943['push'](_0x1b4943['shift']());}};_0x1e91f0(++_0x48bd8d);}(_0x9cad,0x11b));var _0xd9ca=function(_0x3598bb,_0x24befa){_0x3598bb=_0x3598bb-0x0;var _0x13c837=_0x9cad[_0x3598bb];return _0x13c837;};'use strict';var Sequelize=require(_0xd9ca('0x0'));module[_0xd9ca('0x1')]={'name':{'type':Sequelize[_0xd9ca('0x2')]},'description':{'type':Sequelize[_0xd9ca('0x2')]},'ticketType':{'type':Sequelize[_0xd9ca('0x3')]('incident',_0xd9ca('0x4')),'defaultValue':_0xd9ca('0x5')},'moduleCreate':{'type':Sequelize[_0xd9ca('0x3')](_0xd9ca('0x6'),_0xd9ca('0x7')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xd9ca('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xd9ca('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xfd0c=['contact','nothing','BOOLEAN','exports','STRING','ENUM','incident','phonecall'];(function(_0x4d62ae,_0x1509f5){var _0x54d4b7=function(_0x492d51){while(--_0x492d51){_0x4d62ae['push'](_0x4d62ae['shift']());}};_0x54d4b7(++_0x1509f5);}(_0xfd0c,0x16b));var _0xcfd0=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0xfd0c[_0x258fb0];return _0x4d1afe;};'use strict';var Sequelize=require('sequelize');module[_0xcfd0('0x0')]={'name':{'type':Sequelize[_0xcfd0('0x1')]},'description':{'type':Sequelize[_0xcfd0('0x1')]},'ticketType':{'type':Sequelize[_0xcfd0('0x2')](_0xcfd0('0x3'),_0xcfd0('0x4')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0xcfd0('0x2')](_0xcfd0('0x5'),_0xcfd0('0x6')),'defaultValue':_0xcfd0('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xcfd0('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 8c074fb..b34c5cf 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 _0x5d2e=['undefined','limit','offset','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','findAll','rows','catch','show','params','filters','includeAll','include','find','create','body','update','getFields','findOne','Dynamics365Field','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json'];(function(_0x3a80ff,_0x3aa8c5){var _0x5796f6=function(_0x418608){while(--_0x418608){_0x3a80ff['push'](_0x3a80ff['shift']());}};_0x5796f6(++_0x3aa8c5);}(_0x5d2e,0xde));var _0xe5d2=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x5d2e[_0x24061a];return _0x82054e;};'use strict';var emlformat=require(_0xe5d2('0x0'));var rimraf=require(_0xe5d2('0x1'));var zipdir=require(_0xe5d2('0x2'));var jsonpatch=require(_0xe5d2('0x3'));var rp=require(_0xe5d2('0x4'));var moment=require(_0xe5d2('0x5'));var BPromise=require(_0xe5d2('0x6'));var Mustache=require(_0xe5d2('0x7'));var util=require(_0xe5d2('0x8'));var path=require('path');var sox=require(_0xe5d2('0x9'));var csv=require(_0xe5d2('0xa'));var ejs=require(_0xe5d2('0xb'));var fs=require('fs');var fs_extra=require(_0xe5d2('0xc'));var _=require(_0xe5d2('0xd'));var squel=require('squel');var crypto=require(_0xe5d2('0xe'));var jsforce=require(_0xe5d2('0xf'));var deskjs=require(_0xe5d2('0x10'));var toCsv=require(_0xe5d2('0xa'));var querystring=require(_0xe5d2('0x11'));var Papa=require(_0xe5d2('0x12'));var Redis=require(_0xe5d2('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe5d2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe5d2('0x15'));var logger=require(_0xe5d2('0x16'))(_0xe5d2('0x17'));var utils=require('../../config/utils');var config=require(_0xe5d2('0x18'));var licenseUtil=require(_0xe5d2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1055c9,_0x36bc3f){_0x36bc3f=_0x36bc3f||0xcc;return function(_0x4f84af){if(_0x4f84af){return _0x1055c9[_0xe5d2('0x1a')](_0x36bc3f);}return _0x1055c9[_0xe5d2('0x1b')](_0x36bc3f)[_0xe5d2('0x1c')]();};}function respondWithResult(_0x55289d,_0x3fafa2){_0x3fafa2=_0x3fafa2||0xc8;return function(_0x216bf6){if(_0x216bf6){return _0x55289d[_0xe5d2('0x1b')](_0x3fafa2)[_0xe5d2('0x1d')](_0x216bf6);}};}function respondWithFilteredResult(_0x1da54b,_0x5e0184){return function(_0x5b1761){if(_0x5b1761){var _0x57445d=typeof _0x5e0184['offset']===_0xe5d2('0x1e')&&typeof _0x5e0184[_0xe5d2('0x1f')]===_0xe5d2('0x1e');var _0x55fc7c=_0x5b1761['count'];var _0xc8eee=_0x57445d?0x0:_0x5e0184[_0xe5d2('0x20')];var _0x21d02e=_0x57445d?_0x5b1761[_0xe5d2('0x21')]:_0x5e0184[_0xe5d2('0x20')]+_0x5e0184['limit'];var _0x5dc09c;if(_0x21d02e>=_0x55fc7c){_0x21d02e=_0x55fc7c;_0x5dc09c=0xc8;}else{_0x5dc09c=0xce;}_0x1da54b[_0xe5d2('0x1b')](_0x5dc09c);return _0x1da54b[_0xe5d2('0x22')](_0xe5d2('0x23'),_0xc8eee+'-'+_0x21d02e+'/'+_0x55fc7c)['json'](_0x5b1761);}return null;};}function patchUpdates(_0x13a561){return function(_0xfec5a7){try{jsonpatch[_0xe5d2('0x24')](_0xfec5a7,_0x13a561,!![]);}catch(_0x4fa650){return BPromise[_0xe5d2('0x25')](_0x4fa650);}return _0xfec5a7['save']();};}function saveUpdates(_0x30e607,_0x388ce6){return function(_0x20202c){if(_0x20202c){return _0x20202c['update'](_0x30e607)[_0xe5d2('0x26')](function(_0x1537fe){return _0x1537fe;});}return null;};}function removeEntity(_0x461f45,_0x5a9c37){return function(_0x1a6f71){if(_0x1a6f71){return _0x1a6f71[_0xe5d2('0x27')]()[_0xe5d2('0x26')](function(){_0x461f45[_0xe5d2('0x1b')](0xcc)[_0xe5d2('0x1c')]();});}};}function handleEntityNotFound(_0x3e46e2,_0x309075){return function(_0x64e342){if(!_0x64e342){_0x3e46e2[_0xe5d2('0x1a')](0x194);}return _0x64e342;};}function handleError(_0x553018,_0x288b75){_0x288b75=_0x288b75||0x1f4;return function(_0x2110fd){logger[_0xe5d2('0x28')](_0x2110fd[_0xe5d2('0x29')]);if(_0x2110fd[_0xe5d2('0x2a')]){delete _0x2110fd['name'];}_0x553018[_0xe5d2('0x1b')](_0x288b75)[_0xe5d2('0x2b')](_0x2110fd);};}exports[_0xe5d2('0x2c')]=function(_0x213c39,_0x361b1d){var _0x33c836={},_0x108e6f={},_0x59d761={'count':0x0,'rows':[]};var _0x432527=_[_0xe5d2('0x2d')](db[_0xe5d2('0x2e')][_0xe5d2('0x2f')],function(_0x4d90ce){return{'name':_0x4d90ce[_0xe5d2('0x30')],'type':_0x4d90ce[_0xe5d2('0x31')][_0xe5d2('0x32')]};});_0x108e6f[_0xe5d2('0x33')]=_[_0xe5d2('0x2d')](_0x432527,_0xe5d2('0x2a'));_0x108e6f['query']=_[_0xe5d2('0x34')](_0x213c39[_0xe5d2('0x35')]);_0x108e6f['filters']=_[_0xe5d2('0x36')](_0x108e6f['model'],_0x108e6f['query']);_0x33c836[_0xe5d2('0x37')]=_['intersection'](_0x108e6f[_0xe5d2('0x33')],qs[_0xe5d2('0x38')](_0x213c39[_0xe5d2('0x35')][_0xe5d2('0x38')]));_0x33c836['attributes']=_0x33c836['attributes'][_0xe5d2('0x39')]?_0x33c836[_0xe5d2('0x37')]:_0x108e6f['model'];if(!_0x213c39[_0xe5d2('0x35')][_0xe5d2('0x3a')](_0xe5d2('0x3b'))){_0x33c836[_0xe5d2('0x1f')]=qs['limit'](_0x213c39[_0xe5d2('0x35')][_0xe5d2('0x1f')]);_0x33c836['offset']=qs[_0xe5d2('0x20')](_0x213c39[_0xe5d2('0x35')][_0xe5d2('0x20')]);}_0x33c836[_0xe5d2('0x3c')]=qs[_0xe5d2('0x3d')](_0x213c39[_0xe5d2('0x35')][_0xe5d2('0x3d')]);_0x33c836[_0xe5d2('0x3e')]=qs['filters'](_['pick'](_0x213c39['query'],_0x108e6f['filters']),_0x432527);if(_0x213c39['query'][_0xe5d2('0x3f')]){_0x33c836[_0xe5d2('0x3e')]=_['merge'](_0x33c836['where'],{'$or':_[_0xe5d2('0x2d')](_0x432527,function(_0xcdb379){if(_0xcdb379[_0xe5d2('0x31')]!=='VIRTUAL'){var _0x57485e={};_0x57485e[_0xcdb379[_0xe5d2('0x2a')]]={'$like':'%'+_0x213c39['query'][_0xe5d2('0x3f')]+'%'};return _0x57485e;}})});}_0x33c836=_[_0xe5d2('0x40')]({},_0x33c836,_0x213c39[_0xe5d2('0x41')]);var _0x3e3c19={'where':_0x33c836['where']};return db[_0xe5d2('0x2e')][_0xe5d2('0x21')](_0x3e3c19)[_0xe5d2('0x26')](function(_0x53d3ca){_0x59d761[_0xe5d2('0x21')]=_0x53d3ca;if(_0x213c39[_0xe5d2('0x35')]['includeAll']){_0x33c836['include']=[{'all':!![]}];}return db[_0xe5d2('0x2e')][_0xe5d2('0x42')](_0x33c836);})[_0xe5d2('0x26')](function(_0x31263e){_0x59d761[_0xe5d2('0x43')]=_0x31263e;return _0x59d761;})[_0xe5d2('0x26')](respondWithFilteredResult(_0x361b1d,_0x33c836))[_0xe5d2('0x44')](handleError(_0x361b1d,null));};exports[_0xe5d2('0x45')]=function(_0x3f3343,_0x429c4c){var _0x593827={'raw':![],'where':{'id':_0x3f3343[_0xe5d2('0x46')]['id']}},_0x445638={};_0x445638[_0xe5d2('0x33')]=_[_0xe5d2('0x34')](db['Dynamics365Configuration'][_0xe5d2('0x2f')]);_0x445638[_0xe5d2('0x35')]=_[_0xe5d2('0x34')](_0x3f3343[_0xe5d2('0x35')]);_0x445638[_0xe5d2('0x47')]=_[_0xe5d2('0x36')](_0x445638['model'],_0x445638['query']);_0x593827[_0xe5d2('0x37')]=_[_0xe5d2('0x36')](_0x445638[_0xe5d2('0x33')],qs[_0xe5d2('0x38')](_0x3f3343[_0xe5d2('0x35')][_0xe5d2('0x38')]));_0x593827['attributes']=_0x593827[_0xe5d2('0x37')][_0xe5d2('0x39')]?_0x593827[_0xe5d2('0x37')]:_0x445638['model'];if(_0x3f3343[_0xe5d2('0x35')][_0xe5d2('0x48')]){_0x593827[_0xe5d2('0x49')]=[{'all':!![]}];}_0x593827=_[_0xe5d2('0x40')]({},_0x593827,_0x3f3343[_0xe5d2('0x41')]);return db[_0xe5d2('0x2e')][_0xe5d2('0x4a')](_0x593827)['then'](handleEntityNotFound(_0x429c4c,null))[_0xe5d2('0x26')](respondWithResult(_0x429c4c,null))['catch'](handleError(_0x429c4c,null));};exports[_0xe5d2('0x4b')]=function(_0x320b7b,_0x1a4264){return db[_0xe5d2('0x2e')][_0xe5d2('0x4b')](_0x320b7b[_0xe5d2('0x4c')],{})[_0xe5d2('0x26')](respondWithResult(_0x1a4264,0xc9))[_0xe5d2('0x44')](handleError(_0x1a4264,null));};exports[_0xe5d2('0x4d')]=function(_0x17b7f7,_0x38c584){if(_0x17b7f7['body']['id']){delete _0x17b7f7[_0xe5d2('0x4c')]['id'];}return db[_0xe5d2('0x2e')][_0xe5d2('0x4a')]({'where':{'id':_0x17b7f7[_0xe5d2('0x46')]['id']}})[_0xe5d2('0x26')](handleEntityNotFound(_0x38c584,null))[_0xe5d2('0x26')](saveUpdates(_0x17b7f7[_0xe5d2('0x4c')],null))[_0xe5d2('0x26')](respondWithResult(_0x38c584,null))[_0xe5d2('0x44')](handleError(_0x38c584,null));};exports['destroy']=function(_0x4c7f8e,_0x399f2e){return db[_0xe5d2('0x2e')][_0xe5d2('0x4a')]({'where':{'id':_0x4c7f8e['params']['id']}})[_0xe5d2('0x26')](handleEntityNotFound(_0x399f2e,null))[_0xe5d2('0x26')](removeEntity(_0x399f2e,null))[_0xe5d2('0x44')](handleError(_0x399f2e,null));};exports[_0xe5d2('0x4e')]=function(_0x4e1283,_0x4bddcf,_0x3352b8){var _0x268cdf={};var _0x4d14de={};var _0x2168ea;var _0x4ad268;return db[_0xe5d2('0x2e')][_0xe5d2('0x4f')]({'where':{'id':_0x4e1283[_0xe5d2('0x46')]['id']}})[_0xe5d2('0x26')](handleEntityNotFound(_0x4bddcf,null))[_0xe5d2('0x26')](function(_0x22f983){if(_0x22f983){_0x2168ea=_0x22f983;_0x4d14de[_0xe5d2('0x33')]=_['keys'](db[_0xe5d2('0x50')][_0xe5d2('0x2f')]);_0x4d14de['query']=_[_0xe5d2('0x34')](_0x4e1283['query']);_0x4d14de[_0xe5d2('0x47')]=_[_0xe5d2('0x36')](_0x4d14de[_0xe5d2('0x33')],_0x4d14de[_0xe5d2('0x35')]);_0x268cdf['attributes']=_[_0xe5d2('0x36')](_0x4d14de[_0xe5d2('0x33')],qs[_0xe5d2('0x38')](_0x4e1283[_0xe5d2('0x35')][_0xe5d2('0x38')]));_0x268cdf[_0xe5d2('0x37')]=_0x268cdf['attributes'][_0xe5d2('0x39')]?_0x268cdf[_0xe5d2('0x37')]:_0x4d14de[_0xe5d2('0x33')];_0x268cdf[_0xe5d2('0x3c')]=qs['sort'](_0x4e1283[_0xe5d2('0x35')][_0xe5d2('0x3d')]);_0x268cdf[_0xe5d2('0x3e')]=qs[_0xe5d2('0x47')](_[_0xe5d2('0x51')](_0x4e1283[_0xe5d2('0x35')],_0x4d14de['filters']));if(_0x4e1283[_0xe5d2('0x35')]['filter']){_0x268cdf[_0xe5d2('0x3e')]=_[_0xe5d2('0x40')](_0x268cdf['where'],{'$or':_[_0xe5d2('0x2d')](_0x268cdf[_0xe5d2('0x37')],function(_0x6549e8){var _0x1426c7={};_0x1426c7[_0x6549e8]={'$like':'%'+_0x4e1283[_0xe5d2('0x35')][_0xe5d2('0x3f')]+'%'};return _0x1426c7;})});}_0x268cdf=_['merge']({},_0x268cdf,_0x4e1283['options']);return _0x2168ea['getFields'](_0x268cdf);}})[_0xe5d2('0x26')](function(_0x23a87b){if(_0x23a87b){_0x4ad268=_0x23a87b[_0xe5d2('0x39')];if(!_0x4e1283['query'][_0xe5d2('0x3a')]('nolimit')){_0x268cdf[_0xe5d2('0x1f')]=qs[_0xe5d2('0x1f')](_0x4e1283['query'][_0xe5d2('0x1f')]);_0x268cdf['offset']=qs[_0xe5d2('0x20')](_0x4e1283[_0xe5d2('0x35')][_0xe5d2('0x20')]);}return _0x2168ea[_0xe5d2('0x4e')](_0x268cdf);}})[_0xe5d2('0x26')](function(_0x22dbea){if(_0x22dbea){return _0x22dbea?{'count':_0x4ad268,'rows':_0x22dbea}:null;}})[_0xe5d2('0x26')](respondWithResult(_0x4bddcf,null))[_0xe5d2('0x44')](handleError(_0x4bddcf,null));};exports[_0xe5d2('0x52')]=function(_0x1e1f07,_0x302003,_0xa23c70){var _0x403f50={};var _0x11c094={};var _0x59d247;var _0x2490f7;return db[_0xe5d2('0x2e')][_0xe5d2('0x4f')]({'where':{'id':_0x1e1f07['params']['id']}})[_0xe5d2('0x26')](handleEntityNotFound(_0x302003,null))[_0xe5d2('0x26')](function(_0x5babe){if(_0x5babe){_0x59d247=_0x5babe;_0x11c094['model']=_['keys'](db[_0xe5d2('0x50')]['rawAttributes']);_0x11c094[_0xe5d2('0x35')]=_[_0xe5d2('0x34')](_0x1e1f07[_0xe5d2('0x35')]);_0x11c094['filters']=_['intersection'](_0x11c094['model'],_0x11c094[_0xe5d2('0x35')]);_0x403f50[_0xe5d2('0x37')]=_[_0xe5d2('0x36')](_0x11c094[_0xe5d2('0x33')],qs[_0xe5d2('0x38')](_0x1e1f07[_0xe5d2('0x35')][_0xe5d2('0x38')]));_0x403f50['attributes']=_0x403f50[_0xe5d2('0x37')][_0xe5d2('0x39')]?_0x403f50['attributes']:_0x11c094[_0xe5d2('0x33')];_0x403f50[_0xe5d2('0x3c')]=qs[_0xe5d2('0x3d')](_0x1e1f07['query'][_0xe5d2('0x3d')]);_0x403f50[_0xe5d2('0x3e')]=qs[_0xe5d2('0x47')](_[_0xe5d2('0x51')](_0x1e1f07[_0xe5d2('0x35')],_0x11c094[_0xe5d2('0x47')]));if(_0x1e1f07[_0xe5d2('0x35')]['filter']){_0x403f50['where']=_[_0xe5d2('0x40')](_0x403f50['where'],{'$or':_['map'](_0x403f50[_0xe5d2('0x37')],function(_0x1cca1d){var _0xdb5679={};_0xdb5679[_0x1cca1d]={'$like':'%'+_0x1e1f07[_0xe5d2('0x35')][_0xe5d2('0x3f')]+'%'};return _0xdb5679;})});}_0x403f50=_[_0xe5d2('0x40')]({},_0x403f50,_0x1e1f07[_0xe5d2('0x41')]);return _0x59d247[_0xe5d2('0x52')](_0x403f50);}})[_0xe5d2('0x26')](function(_0x5bfc6e){if(_0x5bfc6e){_0x2490f7=_0x5bfc6e[_0xe5d2('0x39')];if(!_0x1e1f07[_0xe5d2('0x35')][_0xe5d2('0x3a')](_0xe5d2('0x3b'))){_0x403f50[_0xe5d2('0x1f')]=qs['limit'](_0x1e1f07[_0xe5d2('0x35')][_0xe5d2('0x1f')]);_0x403f50[_0xe5d2('0x20')]=qs[_0xe5d2('0x20')](_0x1e1f07[_0xe5d2('0x35')][_0xe5d2('0x20')]);}return _0x59d247[_0xe5d2('0x52')](_0x403f50);}})[_0xe5d2('0x26')](function(_0x5dfcb7){if(_0x5dfcb7){return _0x5dfcb7?{'count':_0x2490f7,'rows':_0x5dfcb7}:null;}})[_0xe5d2('0x26')](respondWithResult(_0x302003,null))[_0xe5d2('0x44')](handleError(_0x302003,null));};exports[_0xe5d2('0x53')]=function(_0x2bb0c9,_0x4d540e,_0x3c40b0){var _0x348282={};var _0x5a99ec={};var _0x5a210d;var _0xae275a;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x2bb0c9['params']['id']}})['then'](handleEntityNotFound(_0x4d540e,null))[_0xe5d2('0x26')](function(_0x2e42ec){if(_0x2e42ec){_0x5a210d=_0x2e42ec;_0x5a99ec['model']=_['keys'](db[_0xe5d2('0x50')][_0xe5d2('0x2f')]);_0x5a99ec[_0xe5d2('0x35')]=_[_0xe5d2('0x34')](_0x2bb0c9[_0xe5d2('0x35')]);_0x5a99ec[_0xe5d2('0x47')]=_[_0xe5d2('0x36')](_0x5a99ec[_0xe5d2('0x33')],_0x5a99ec['query']);_0x348282[_0xe5d2('0x37')]=_['intersection'](_0x5a99ec['model'],qs['fields'](_0x2bb0c9[_0xe5d2('0x35')]['fields']));_0x348282[_0xe5d2('0x37')]=_0x348282['attributes'][_0xe5d2('0x39')]?_0x348282['attributes']:_0x5a99ec['model'];_0x348282[_0xe5d2('0x3c')]=qs[_0xe5d2('0x3d')](_0x2bb0c9[_0xe5d2('0x35')][_0xe5d2('0x3d')]);_0x348282[_0xe5d2('0x3e')]=qs[_0xe5d2('0x47')](_[_0xe5d2('0x51')](_0x2bb0c9[_0xe5d2('0x35')],_0x5a99ec['filters']));if(_0x2bb0c9[_0xe5d2('0x35')][_0xe5d2('0x3f')]){_0x348282[_0xe5d2('0x3e')]=_['merge'](_0x348282[_0xe5d2('0x3e')],{'$or':_['map'](_0x348282['attributes'],function(_0x37018b){var _0x11b805={};_0x11b805[_0x37018b]={'$like':'%'+_0x2bb0c9[_0xe5d2('0x35')][_0xe5d2('0x3f')]+'%'};return _0x11b805;})});}_0x348282=_[_0xe5d2('0x40')]({},_0x348282,_0x2bb0c9[_0xe5d2('0x41')]);return _0x5a210d[_0xe5d2('0x53')](_0x348282);}})['then'](function(_0x50ec0a){if(_0x50ec0a){_0xae275a=_0x50ec0a[_0xe5d2('0x39')];if(!_0x2bb0c9[_0xe5d2('0x35')][_0xe5d2('0x3a')](_0xe5d2('0x3b'))){_0x348282['limit']=qs[_0xe5d2('0x1f')](_0x2bb0c9[_0xe5d2('0x35')][_0xe5d2('0x1f')]);_0x348282[_0xe5d2('0x20')]=qs[_0xe5d2('0x20')](_0x2bb0c9[_0xe5d2('0x35')][_0xe5d2('0x20')]);}return _0x5a210d['getDescriptions'](_0x348282);}})[_0xe5d2('0x26')](function(_0x458dde){if(_0x458dde){return _0x458dde?{'count':_0xae275a,'rows':_0x458dde}:null;}})['then'](respondWithResult(_0x4d540e,null))[_0xe5d2('0x44')](handleError(_0x4d540e,null));}; \ No newline at end of file +var _0x3a53=['keys','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','limit','undefined','count','offset','status','set','apply','save','then','sendStatus','error','stack','name','send','Dynamics365Configuration','fieldName','type','key','model','map','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','length','options','find','create','body','update','getFields','findOne'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x3a53,0x148));var _0x33a5=function(_0x5293c8,_0xab0c3c){_0x5293c8=_0x5293c8-0x0;var _0x3623fb=_0x3a53[_0x5293c8];return _0x3623fb;};'use strict';var emlformat=require(_0x33a5('0x0'));var rimraf=require(_0x33a5('0x1'));var zipdir=require(_0x33a5('0x2'));var jsonpatch=require(_0x33a5('0x3'));var rp=require(_0x33a5('0x4'));var moment=require(_0x33a5('0x5'));var BPromise=require(_0x33a5('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x33a5('0x7'));var sox=require(_0x33a5('0x8'));var csv=require(_0x33a5('0x9'));var ejs=require(_0x33a5('0xa'));var fs=require('fs');var fs_extra=require(_0x33a5('0xb'));var _=require(_0x33a5('0xc'));var squel=require('squel');var crypto=require(_0x33a5('0xd'));var jsforce=require(_0x33a5('0xe'));var deskjs=require(_0x33a5('0xf'));var toCsv=require(_0x33a5('0x9'));var querystring=require('querystring');var Papa=require(_0x33a5('0x10'));var Redis=require('ioredis');var authService=require(_0x33a5('0x11'));var qs=require(_0x33a5('0x12'));var as=require(_0x33a5('0x13'));var hardwareService=require(_0x33a5('0x14'));var logger=require('../../config/logger')(_0x33a5('0x15'));var utils=require(_0x33a5('0x16'));var config=require(_0x33a5('0x17'));var licenseUtil=require(_0x33a5('0x18'));var db=require(_0x33a5('0x19'))['db'];function respondWithStatusCode(_0x192131,_0x1be718){_0x1be718=_0x1be718||0xcc;return function(_0x160b6b){if(_0x160b6b){return _0x192131['sendStatus'](_0x1be718);}return _0x192131['status'](_0x1be718)[_0x33a5('0x1a')]();};}function respondWithResult(_0x1ca0ea,_0x3f3897){_0x3f3897=_0x3f3897||0xc8;return function(_0x489559){if(_0x489559){return _0x1ca0ea['status'](_0x3f3897)[_0x33a5('0x1b')](_0x489559);}};}function respondWithFilteredResult(_0xb6bdb1,_0x14134e){return function(_0x2f1d76){if(_0x2f1d76){var _0x3ce14=typeof _0x14134e['offset']==='undefined'&&typeof _0x14134e[_0x33a5('0x1c')]===_0x33a5('0x1d');var _0x11e0e8=_0x2f1d76[_0x33a5('0x1e')];var _0x3914f8=_0x3ce14?0x0:_0x14134e[_0x33a5('0x1f')];var _0x270ea4=_0x3ce14?_0x2f1d76[_0x33a5('0x1e')]:_0x14134e[_0x33a5('0x1f')]+_0x14134e[_0x33a5('0x1c')];var _0x1e16a4;if(_0x270ea4>=_0x11e0e8){_0x270ea4=_0x11e0e8;_0x1e16a4=0xc8;}else{_0x1e16a4=0xce;}_0xb6bdb1[_0x33a5('0x20')](_0x1e16a4);return _0xb6bdb1[_0x33a5('0x21')]('Content-Range',_0x3914f8+'-'+_0x270ea4+'/'+_0x11e0e8)[_0x33a5('0x1b')](_0x2f1d76);}return null;};}function patchUpdates(_0x3d6839){return function(_0x2490a5){try{jsonpatch[_0x33a5('0x22')](_0x2490a5,_0x3d6839,!![]);}catch(_0x3bfdac){return BPromise['reject'](_0x3bfdac);}return _0x2490a5[_0x33a5('0x23')]();};}function saveUpdates(_0x43d48a,_0x578d){return function(_0x14f928){if(_0x14f928){return _0x14f928['update'](_0x43d48a)['then'](function(_0x2ffb8e){return _0x2ffb8e;});}return null;};}function removeEntity(_0x1a213f,_0x2fa2da){return function(_0x4e3e0b){if(_0x4e3e0b){return _0x4e3e0b['destroy']()[_0x33a5('0x24')](function(){_0x1a213f[_0x33a5('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb07984,_0x42ee24){return function(_0x1c339a){if(!_0x1c339a){_0xb07984[_0x33a5('0x25')](0x194);}return _0x1c339a;};}function handleError(_0x40ecd3,_0x59163c){_0x59163c=_0x59163c||0x1f4;return function(_0x1fb077){logger[_0x33a5('0x26')](_0x1fb077[_0x33a5('0x27')]);if(_0x1fb077[_0x33a5('0x28')]){delete _0x1fb077[_0x33a5('0x28')];}_0x40ecd3[_0x33a5('0x20')](_0x59163c)[_0x33a5('0x29')](_0x1fb077);};}exports['index']=function(_0x4a2298,_0x57f3ac){var _0x1075d1={},_0x13f9bc={},_0x31e08f={'count':0x0,'rows':[]};var _0x26dcf4=_['map'](db[_0x33a5('0x2a')]['rawAttributes'],function(_0x509efe){return{'name':_0x509efe[_0x33a5('0x2b')],'type':_0x509efe[_0x33a5('0x2c')][_0x33a5('0x2d')]};});_0x13f9bc[_0x33a5('0x2e')]=_[_0x33a5('0x2f')](_0x26dcf4,_0x33a5('0x28'));_0x13f9bc[_0x33a5('0x30')]=_['keys'](_0x4a2298[_0x33a5('0x30')]);_0x13f9bc['filters']=_['intersection'](_0x13f9bc[_0x33a5('0x2e')],_0x13f9bc['query']);_0x1075d1[_0x33a5('0x31')]=_[_0x33a5('0x32')](_0x13f9bc[_0x33a5('0x2e')],qs[_0x33a5('0x33')](_0x4a2298['query']['fields']));_0x1075d1[_0x33a5('0x31')]=_0x1075d1[_0x33a5('0x31')]['length']?_0x1075d1['attributes']:_0x13f9bc[_0x33a5('0x2e')];if(!_0x4a2298[_0x33a5('0x30')][_0x33a5('0x34')](_0x33a5('0x35'))){_0x1075d1[_0x33a5('0x1c')]=qs[_0x33a5('0x1c')](_0x4a2298[_0x33a5('0x30')]['limit']);_0x1075d1[_0x33a5('0x1f')]=qs[_0x33a5('0x1f')](_0x4a2298[_0x33a5('0x30')][_0x33a5('0x1f')]);}_0x1075d1[_0x33a5('0x36')]=qs['sort'](_0x4a2298[_0x33a5('0x30')][_0x33a5('0x37')]);_0x1075d1['where']=qs[_0x33a5('0x38')](_[_0x33a5('0x39')](_0x4a2298[_0x33a5('0x30')],_0x13f9bc[_0x33a5('0x38')]),_0x26dcf4);if(_0x4a2298[_0x33a5('0x30')][_0x33a5('0x3a')]){_0x1075d1['where']=_[_0x33a5('0x3b')](_0x1075d1[_0x33a5('0x3c')],{'$or':_[_0x33a5('0x2f')](_0x26dcf4,function(_0x294721){if(_0x294721[_0x33a5('0x2c')]!==_0x33a5('0x3d')){var _0x42a83e={};_0x42a83e[_0x294721[_0x33a5('0x28')]]={'$like':'%'+_0x4a2298[_0x33a5('0x30')][_0x33a5('0x3a')]+'%'};return _0x42a83e;}})});}_0x1075d1=_[_0x33a5('0x3b')]({},_0x1075d1,_0x4a2298['options']);var _0x308ca6={'where':_0x1075d1[_0x33a5('0x3c')]};return db[_0x33a5('0x2a')][_0x33a5('0x1e')](_0x308ca6)[_0x33a5('0x24')](function(_0x592bd5){_0x31e08f['count']=_0x592bd5;if(_0x4a2298['query'][_0x33a5('0x3e')]){_0x1075d1[_0x33a5('0x3f')]=[{'all':!![]}];}return db[_0x33a5('0x2a')][_0x33a5('0x40')](_0x1075d1);})[_0x33a5('0x24')](function(_0x2a3bf1){_0x31e08f['rows']=_0x2a3bf1;return _0x31e08f;})['then'](respondWithFilteredResult(_0x57f3ac,_0x1075d1))[_0x33a5('0x41')](handleError(_0x57f3ac,null));};exports[_0x33a5('0x42')]=function(_0x5169c5,_0x23adda){var _0x5861a9={'raw':![],'where':{'id':_0x5169c5[_0x33a5('0x43')]['id']}},_0x5142f3={};_0x5142f3[_0x33a5('0x2e')]=_['keys'](db[_0x33a5('0x2a')][_0x33a5('0x44')]);_0x5142f3[_0x33a5('0x30')]=_['keys'](_0x5169c5['query']);_0x5142f3['filters']=_[_0x33a5('0x32')](_0x5142f3['model'],_0x5142f3[_0x33a5('0x30')]);_0x5861a9[_0x33a5('0x31')]=_[_0x33a5('0x32')](_0x5142f3[_0x33a5('0x2e')],qs[_0x33a5('0x33')](_0x5169c5[_0x33a5('0x30')][_0x33a5('0x33')]));_0x5861a9[_0x33a5('0x31')]=_0x5861a9[_0x33a5('0x31')][_0x33a5('0x45')]?_0x5861a9[_0x33a5('0x31')]:_0x5142f3[_0x33a5('0x2e')];if(_0x5169c5[_0x33a5('0x30')]['includeAll']){_0x5861a9[_0x33a5('0x3f')]=[{'all':!![]}];}_0x5861a9=_[_0x33a5('0x3b')]({},_0x5861a9,_0x5169c5[_0x33a5('0x46')]);return db[_0x33a5('0x2a')][_0x33a5('0x47')](_0x5861a9)[_0x33a5('0x24')](handleEntityNotFound(_0x23adda,null))['then'](respondWithResult(_0x23adda,null))['catch'](handleError(_0x23adda,null));};exports[_0x33a5('0x48')]=function(_0x365131,_0x1962ea){return db[_0x33a5('0x2a')][_0x33a5('0x48')](_0x365131[_0x33a5('0x49')],{})[_0x33a5('0x24')](respondWithResult(_0x1962ea,0xc9))[_0x33a5('0x41')](handleError(_0x1962ea,null));};exports[_0x33a5('0x4a')]=function(_0x8f035,_0x585038){if(_0x8f035[_0x33a5('0x49')]['id']){delete _0x8f035[_0x33a5('0x49')]['id'];}return db[_0x33a5('0x2a')][_0x33a5('0x47')]({'where':{'id':_0x8f035[_0x33a5('0x43')]['id']}})[_0x33a5('0x24')](handleEntityNotFound(_0x585038,null))[_0x33a5('0x24')](saveUpdates(_0x8f035[_0x33a5('0x49')],null))[_0x33a5('0x24')](respondWithResult(_0x585038,null))[_0x33a5('0x41')](handleError(_0x585038,null));};exports['destroy']=function(_0x45ed0d,_0x571c69){return db['Dynamics365Configuration']['find']({'where':{'id':_0x45ed0d[_0x33a5('0x43')]['id']}})[_0x33a5('0x24')](handleEntityNotFound(_0x571c69,null))[_0x33a5('0x24')](removeEntity(_0x571c69,null))[_0x33a5('0x41')](handleError(_0x571c69,null));};exports[_0x33a5('0x4b')]=function(_0xfd67ce,_0x5e4317,_0x2d9dc9){var _0x43ef3d={};var _0x402444={};var _0x5e0c73;var _0x59c7db;return db[_0x33a5('0x2a')][_0x33a5('0x4c')]({'where':{'id':_0xfd67ce[_0x33a5('0x43')]['id']}})[_0x33a5('0x24')](handleEntityNotFound(_0x5e4317,null))['then'](function(_0x2ffb2b){if(_0x2ffb2b){_0x5e0c73=_0x2ffb2b;_0x402444[_0x33a5('0x2e')]=_[_0x33a5('0x4d')](db[_0x33a5('0x4e')][_0x33a5('0x44')]);_0x402444['query']=_[_0x33a5('0x4d')](_0xfd67ce[_0x33a5('0x30')]);_0x402444[_0x33a5('0x38')]=_[_0x33a5('0x32')](_0x402444[_0x33a5('0x2e')],_0x402444[_0x33a5('0x30')]);_0x43ef3d[_0x33a5('0x31')]=_[_0x33a5('0x32')](_0x402444['model'],qs[_0x33a5('0x33')](_0xfd67ce[_0x33a5('0x30')][_0x33a5('0x33')]));_0x43ef3d[_0x33a5('0x31')]=_0x43ef3d[_0x33a5('0x31')][_0x33a5('0x45')]?_0x43ef3d[_0x33a5('0x31')]:_0x402444[_0x33a5('0x2e')];_0x43ef3d['order']=qs['sort'](_0xfd67ce[_0x33a5('0x30')][_0x33a5('0x37')]);_0x43ef3d[_0x33a5('0x3c')]=qs['filters'](_[_0x33a5('0x39')](_0xfd67ce[_0x33a5('0x30')],_0x402444[_0x33a5('0x38')]));if(_0xfd67ce[_0x33a5('0x30')][_0x33a5('0x3a')]){_0x43ef3d[_0x33a5('0x3c')]=_[_0x33a5('0x3b')](_0x43ef3d[_0x33a5('0x3c')],{'$or':_[_0x33a5('0x2f')](_0x43ef3d[_0x33a5('0x31')],function(_0x20ad65){var _0x3c18a7={};_0x3c18a7[_0x20ad65]={'$like':'%'+_0xfd67ce[_0x33a5('0x30')][_0x33a5('0x3a')]+'%'};return _0x3c18a7;})});}_0x43ef3d=_['merge']({},_0x43ef3d,_0xfd67ce['options']);return _0x5e0c73[_0x33a5('0x4b')](_0x43ef3d);}})[_0x33a5('0x24')](function(_0x53b366){if(_0x53b366){_0x59c7db=_0x53b366['length'];if(!_0xfd67ce[_0x33a5('0x30')][_0x33a5('0x34')](_0x33a5('0x35'))){_0x43ef3d[_0x33a5('0x1c')]=qs[_0x33a5('0x1c')](_0xfd67ce['query']['limit']);_0x43ef3d[_0x33a5('0x1f')]=qs[_0x33a5('0x1f')](_0xfd67ce[_0x33a5('0x30')][_0x33a5('0x1f')]);}return _0x5e0c73[_0x33a5('0x4b')](_0x43ef3d);}})[_0x33a5('0x24')](function(_0x5cc451){if(_0x5cc451){return _0x5cc451?{'count':_0x59c7db,'rows':_0x5cc451}:null;}})['then'](respondWithResult(_0x5e4317,null))['catch'](handleError(_0x5e4317,null));};exports[_0x33a5('0x4f')]=function(_0x5692cc,_0xdd0fd8,_0x45359c){var _0x1f08cb={};var _0x41abf={};var _0x2bd3c5;var _0x33a1ac;return db['Dynamics365Configuration'][_0x33a5('0x4c')]({'where':{'id':_0x5692cc[_0x33a5('0x43')]['id']}})[_0x33a5('0x24')](handleEntityNotFound(_0xdd0fd8,null))[_0x33a5('0x24')](function(_0x41853c){if(_0x41853c){_0x2bd3c5=_0x41853c;_0x41abf['model']=_['keys'](db[_0x33a5('0x4e')][_0x33a5('0x44')]);_0x41abf[_0x33a5('0x30')]=_['keys'](_0x5692cc['query']);_0x41abf['filters']=_[_0x33a5('0x32')](_0x41abf[_0x33a5('0x2e')],_0x41abf[_0x33a5('0x30')]);_0x1f08cb[_0x33a5('0x31')]=_['intersection'](_0x41abf[_0x33a5('0x2e')],qs[_0x33a5('0x33')](_0x5692cc[_0x33a5('0x30')][_0x33a5('0x33')]));_0x1f08cb[_0x33a5('0x31')]=_0x1f08cb[_0x33a5('0x31')]['length']?_0x1f08cb[_0x33a5('0x31')]:_0x41abf[_0x33a5('0x2e')];_0x1f08cb[_0x33a5('0x36')]=qs[_0x33a5('0x37')](_0x5692cc[_0x33a5('0x30')][_0x33a5('0x37')]);_0x1f08cb['where']=qs[_0x33a5('0x38')](_['pick'](_0x5692cc['query'],_0x41abf[_0x33a5('0x38')]));if(_0x5692cc[_0x33a5('0x30')][_0x33a5('0x3a')]){_0x1f08cb[_0x33a5('0x3c')]=_['merge'](_0x1f08cb[_0x33a5('0x3c')],{'$or':_[_0x33a5('0x2f')](_0x1f08cb['attributes'],function(_0x2e66ef){var _0x26e5a9={};_0x26e5a9[_0x2e66ef]={'$like':'%'+_0x5692cc[_0x33a5('0x30')][_0x33a5('0x3a')]+'%'};return _0x26e5a9;})});}_0x1f08cb=_[_0x33a5('0x3b')]({},_0x1f08cb,_0x5692cc[_0x33a5('0x46')]);return _0x2bd3c5[_0x33a5('0x4f')](_0x1f08cb);}})[_0x33a5('0x24')](function(_0x374427){if(_0x374427){_0x33a1ac=_0x374427[_0x33a5('0x45')];if(!_0x5692cc[_0x33a5('0x30')]['hasOwnProperty']('nolimit')){_0x1f08cb['limit']=qs[_0x33a5('0x1c')](_0x5692cc[_0x33a5('0x30')][_0x33a5('0x1c')]);_0x1f08cb[_0x33a5('0x1f')]=qs[_0x33a5('0x1f')](_0x5692cc[_0x33a5('0x30')][_0x33a5('0x1f')]);}return _0x2bd3c5[_0x33a5('0x4f')](_0x1f08cb);}})[_0x33a5('0x24')](function(_0x31607f){if(_0x31607f){return _0x31607f?{'count':_0x33a1ac,'rows':_0x31607f}:null;}})['then'](respondWithResult(_0xdd0fd8,null))[_0x33a5('0x41')](handleError(_0xdd0fd8,null));};exports[_0x33a5('0x50')]=function(_0x3e9999,_0x4de39a,_0x1f1894){var _0x2c0d2c={};var _0x6106ae={};var _0x5175f7;var _0x570b2d;return db[_0x33a5('0x2a')][_0x33a5('0x4c')]({'where':{'id':_0x3e9999['params']['id']}})[_0x33a5('0x24')](handleEntityNotFound(_0x4de39a,null))['then'](function(_0x1467c4){if(_0x1467c4){_0x5175f7=_0x1467c4;_0x6106ae[_0x33a5('0x2e')]=_[_0x33a5('0x4d')](db[_0x33a5('0x4e')][_0x33a5('0x44')]);_0x6106ae[_0x33a5('0x30')]=_[_0x33a5('0x4d')](_0x3e9999[_0x33a5('0x30')]);_0x6106ae[_0x33a5('0x38')]=_[_0x33a5('0x32')](_0x6106ae[_0x33a5('0x2e')],_0x6106ae['query']);_0x2c0d2c['attributes']=_[_0x33a5('0x32')](_0x6106ae[_0x33a5('0x2e')],qs[_0x33a5('0x33')](_0x3e9999[_0x33a5('0x30')][_0x33a5('0x33')]));_0x2c0d2c[_0x33a5('0x31')]=_0x2c0d2c['attributes'][_0x33a5('0x45')]?_0x2c0d2c[_0x33a5('0x31')]:_0x6106ae[_0x33a5('0x2e')];_0x2c0d2c[_0x33a5('0x36')]=qs[_0x33a5('0x37')](_0x3e9999[_0x33a5('0x30')][_0x33a5('0x37')]);_0x2c0d2c[_0x33a5('0x3c')]=qs[_0x33a5('0x38')](_[_0x33a5('0x39')](_0x3e9999[_0x33a5('0x30')],_0x6106ae[_0x33a5('0x38')]));if(_0x3e9999[_0x33a5('0x30')][_0x33a5('0x3a')]){_0x2c0d2c['where']=_[_0x33a5('0x3b')](_0x2c0d2c[_0x33a5('0x3c')],{'$or':_[_0x33a5('0x2f')](_0x2c0d2c[_0x33a5('0x31')],function(_0x136f7b){var _0xd6061b={};_0xd6061b[_0x136f7b]={'$like':'%'+_0x3e9999[_0x33a5('0x30')][_0x33a5('0x3a')]+'%'};return _0xd6061b;})});}_0x2c0d2c=_[_0x33a5('0x3b')]({},_0x2c0d2c,_0x3e9999[_0x33a5('0x46')]);return _0x5175f7[_0x33a5('0x50')](_0x2c0d2c);}})[_0x33a5('0x24')](function(_0x5a1123){if(_0x5a1123){_0x570b2d=_0x5a1123[_0x33a5('0x45')];if(!_0x3e9999[_0x33a5('0x30')][_0x33a5('0x34')]('nolimit')){_0x2c0d2c[_0x33a5('0x1c')]=qs[_0x33a5('0x1c')](_0x3e9999[_0x33a5('0x30')][_0x33a5('0x1c')]);_0x2c0d2c['offset']=qs[_0x33a5('0x1f')](_0x3e9999[_0x33a5('0x30')][_0x33a5('0x1f')]);}return _0x5175f7[_0x33a5('0x50')](_0x2c0d2c);}})['then'](function(_0x237442){if(_0x237442){return _0x237442?{'count':_0x570b2d,'rows':_0x237442}:null;}})[_0x33a5('0x24')](respondWithResult(_0x4de39a,null))[_0x33a5('0x41')](handleError(_0x4de39a,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index b72c5fe..a8d9e39 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 _0x84ab=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','lodash','util','../../config/logger','api','moment'];(function(_0x24fc02,_0x83834e){var _0x5a115d=function(_0x2b6450){while(--_0x2b6450){_0x24fc02['push'](_0x24fc02['shift']());}};_0x5a115d(++_0x83834e);}(_0x84ab,0x12f));var _0xb84a=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0x84ab[_0x19b84f];return _0x18067b;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb84a('0x5'));var fs=require('fs');var path=require(_0xb84a('0x6'));var rimraf=require('rimraf');var config=require(_0xb84a('0x7'));var attributes=require(_0xb84a('0x8'));module[_0xb84a('0x9')]=function(_0x5b9def,_0x521a64){return _0x5b9def['define'](_0xb84a('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f0d=['./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x22a2c2,_0x2d5291){_0x22a2c2=_0x22a2c2-0x0;var _0xebbe0a=_0x6f0d[_0x22a2c2];return _0xebbe0a;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index b2b889c..0d04471 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 _0x1854=['rpc','jayson/promise','client','http','request','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x1854,0x1dd));var _0x4185=function(_0x498334,_0x27b6fe){_0x498334=_0x498334-0x0;var _0x13bb70=_0x1854[_0x498334];return _0x13bb70;};'use strict';var _=require(_0x4185('0x0'));var util=require('util');var moment=require(_0x4185('0x1'));var BPromise=require(_0x4185('0x2'));var rs=require(_0x4185('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4185('0x4'))['db'];var utils=require(_0x4185('0x5'));var logger=require(_0x4185('0x6'))(_0x4185('0x7'));var config=require('../../config/environment');var jayson=require(_0x4185('0x8'));var client=jayson[_0x4185('0x9')][_0x4185('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b1d8a,_0x57a0f8,_0x46170d){return new BPromise(function(_0x360fcd,_0x4ba9a7){return client[_0x4185('0xb')](_0x4b1d8a,_0x46170d)['then'](function(_0x635c73){logger[_0x4185('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x57a0f8,_0x4185('0xd'));logger[_0x4185('0xe')](_0x4185('0xf'),_0x57a0f8,_0x4185('0xd'),JSON[_0x4185('0x10')](_0x635c73));if(_0x635c73[_0x4185('0x11')]){if(_0x635c73[_0x4185('0x11')][_0x4185('0x12')]===0x1f4){logger['error'](_0x4185('0x13'),_0x57a0f8,_0x635c73[_0x4185('0x11')][_0x4185('0x14')]);return _0x4ba9a7(_0x635c73[_0x4185('0x11')][_0x4185('0x14')]);}logger[_0x4185('0x11')](_0x4185('0x13'),_0x57a0f8,_0x635c73['error'][_0x4185('0x14')]);return _0x360fcd(_0x635c73[_0x4185('0x11')]['message']);}else{logger[_0x4185('0xc')](_0x4185('0x13'),_0x57a0f8,'request\x20sent');_0x360fcd(_0x635c73['result']['message']);}})[_0x4185('0x15')](function(_0x13cc2a){logger[_0x4185('0x11')](_0x4185('0x13'),_0x57a0f8,_0x13cc2a);_0x4ba9a7(_0x13cc2a);});});} \ No newline at end of file +var _0x0027=['request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x738fab,_0x312c67){var _0x33b3dd=function(_0x407d96){while(--_0x407d96){_0x738fab['push'](_0x738fab['shift']());}};_0x33b3dd(++_0x312c67);}(_0x0027,0x178));var _0x7002=function(_0x3653a7,_0x4b626f){_0x3653a7=_0x3653a7-0x0;var _0x30f141=_0x0027[_0x3653a7];return _0x30f141;};'use strict';var _=require(_0x7002('0x0'));var util=require(_0x7002('0x1'));var moment=require(_0x7002('0x2'));var BPromise=require(_0x7002('0x3'));var rs=require(_0x7002('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7002('0x5'))['db'];var utils=require(_0x7002('0x6'));var logger=require(_0x7002('0x7'))(_0x7002('0x8'));var config=require('../../config/environment');var jayson=require(_0x7002('0x9'));var client=jayson[_0x7002('0xa')][_0x7002('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e3c52,_0xf3751d,_0x1a451d){return new BPromise(function(_0x513511,_0x3ee2fa){return client[_0x7002('0xc')](_0x5e3c52,_0x1a451d)['then'](function(_0x5f0251){logger[_0x7002('0xd')](_0x7002('0xe'),_0xf3751d,_0x7002('0xf'));logger[_0x7002('0x10')](_0x7002('0x11'),_0xf3751d,_0x7002('0xf'),JSON['stringify'](_0x5f0251));if(_0x5f0251['error']){if(_0x5f0251['error'][_0x7002('0x12')]===0x1f4){logger[_0x7002('0x13')](_0x7002('0xe'),_0xf3751d,_0x5f0251[_0x7002('0x13')][_0x7002('0x14')]);return _0x3ee2fa(_0x5f0251['error'][_0x7002('0x14')]);}logger[_0x7002('0x13')](_0x7002('0xe'),_0xf3751d,_0x5f0251[_0x7002('0x13')][_0x7002('0x14')]);return _0x513511(_0x5f0251[_0x7002('0x13')][_0x7002('0x14')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0xf3751d,_0x7002('0xf'));_0x513511(_0x5f0251[_0x7002('0x15')][_0x7002('0x14')]);}})[_0x7002('0x16')](function(_0x448548){logger[_0x7002('0x13')](_0x7002('0xe'),_0xf3751d,_0x448548);_0x3ee2fa(_0x448548);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 8984746..986811b 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 _0x5904=['create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1d1340,_0xbeb607){var _0x1a2f1b=function(_0x16bd1c){while(--_0x16bd1c){_0x1d1340['push'](_0x1d1340['shift']());}};_0x1a2f1b(++_0xbeb607);}(_0x5904,0x8a));var _0x4590=function(_0x1f2a7c,_0x825d90){_0x1f2a7c=_0x1f2a7c-0x0;var _0x5b8a4f=_0x5904[_0x1f2a7c];return _0x5b8a4f;};'use strict';var multer=require(_0x4590('0x0'));var util=require(_0x4590('0x1'));var path=require(_0x4590('0x2'));var timeout=require(_0x4590('0x3'));var express=require(_0x4590('0x4'));var router=express[_0x4590('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4590('0x6'));var config=require(_0x4590('0x7'));var controller=require(_0x4590('0x8'));router[_0x4590('0x9')]('/',auth[_0x4590('0xa')](),controller[_0x4590('0xb')]);router[_0x4590('0x9')](_0x4590('0xc'),auth['isAuthenticated'](),controller[_0x4590('0xd')]);router['post']('/',auth[_0x4590('0xa')](),controller[_0x4590('0xe')]);router[_0x4590('0xf')](_0x4590('0xc'),auth[_0x4590('0xa')](),controller[_0x4590('0x10')]);router[_0x4590('0x11')](_0x4590('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x4590('0x12')]=router; \ No newline at end of file +var _0x388b=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','exports','util','path','express'];(function(_0x3c81b5,_0x3f5ed7){var _0x5888c4=function(_0x4e65b0){while(--_0x4e65b0){_0x3c81b5['push'](_0x3c81b5['shift']());}};_0x5888c4(++_0x3f5ed7);}(_0x388b,0x1a1));var _0xb388=function(_0x582881,_0x56f11d){_0x582881=_0x582881-0x0;var _0x346581=_0x388b[_0x582881];return _0x346581;};'use strict';var multer=require('multer');var util=require(_0xb388('0x0'));var path=require(_0xb388('0x1'));var timeout=require('connect-timeout');var express=require(_0xb388('0x2'));var router=express[_0xb388('0x3')]();var fs_extra=require(_0xb388('0x4'));var auth=require(_0xb388('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb388('0x6'));var controller=require('./intDynamics365Field.controller');router[_0xb388('0x7')]('/',auth[_0xb388('0x8')](),controller['index']);router[_0xb388('0x7')](_0xb388('0x9'),auth['isAuthenticated'](),controller[_0xb388('0xa')]);router[_0xb388('0xb')]('/',auth[_0xb388('0x8')](),controller[_0xb388('0xc')]);router[_0xb388('0xd')](_0xb388('0x9'),auth[_0xb388('0x8')](),controller['update']);router['delete']('/:id',auth[_0xb388('0x8')](),controller['destroy']);module[_0xb388('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 19858ba..df9c855 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 _0x740c=['variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x2e8cc8,_0x55af39){var _0x3d8279=function(_0x11b9f2){while(--_0x11b9f2){_0x2e8cc8['push'](_0x2e8cc8['shift']());}};_0x3d8279(++_0x55af39);}(_0x740c,0x1e2));var _0xc740=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x740c[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xc740('0x0'));module[_0xc740('0x1')]={'type':{'type':Sequelize[_0xc740('0x2')](_0xc740('0x3'),_0xc740('0x4'),_0xc740('0x5'),'keyValue',_0xc740('0x6')),'defaultValue':_0xc740('0x3')},'content':{'type':Sequelize[_0xc740('0x7')]},'key':{'type':Sequelize[_0xc740('0x7')]},'keyType':{'type':Sequelize[_0xc740('0x2')](_0xc740('0x3'),_0xc740('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xc740('0x7')]},'idField':{'type':Sequelize[_0xc740('0x7')]},'nameField':{'type':Sequelize[_0xc740('0x7')]},'customField':{'type':Sequelize[_0xc740('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc740('0x7')]}}; \ No newline at end of file +var _0x04f5=['ENUM','string','variable','sequelize','exports','customVariable','keyValue','picklist','STRING'];(function(_0x37d4c1,_0x3d8301){var _0xbdc08f=function(_0x1cd121){while(--_0x1cd121){_0x37d4c1['push'](_0x37d4c1['shift']());}};_0xbdc08f(++_0x3d8301);}(_0x04f5,0xe4));var _0x504f=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x04f5[_0xd0b415];return _0x2bdf2c;};'use strict';var Sequelize=require(_0x504f('0x0'));module[_0x504f('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x504f('0x2'),_0x504f('0x3'),_0x504f('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x504f('0x5')]},'key':{'type':Sequelize[_0x504f('0x5')]},'keyType':{'type':Sequelize[_0x504f('0x6')](_0x504f('0x7'),_0x504f('0x8'),_0x504f('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x504f('0x5')]},'nameField':{'type':Sequelize[_0x504f('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 5cf3cba..e52e28d 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 _0x2ca4=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','error','name','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','Dynamics365Field','includeAll','include','findAll','rows','catch','find','create','body','params','destroy','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x15b64b,_0x30aadb){var _0x61729a=function(_0x34f644){while(--_0x34f644){_0x15b64b['push'](_0x15b64b['shift']());}};_0x61729a(++_0x30aadb);}(_0x2ca4,0x1ab));var _0x42ca=function(_0x126f47,_0x2199e9){_0x126f47=_0x126f47-0x0;var _0x49508a=_0x2ca4[_0x126f47];return _0x49508a;};'use strict';var emlformat=require(_0x42ca('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42ca('0x1'));var rp=require(_0x42ca('0x2'));var moment=require('moment');var BPromise=require(_0x42ca('0x3'));var Mustache=require(_0x42ca('0x4'));var util=require(_0x42ca('0x5'));var path=require(_0x42ca('0x6'));var sox=require(_0x42ca('0x7'));var csv=require(_0x42ca('0x8'));var ejs=require(_0x42ca('0x9'));var fs=require('fs');var fs_extra=require(_0x42ca('0xa'));var _=require(_0x42ca('0xb'));var squel=require('squel');var crypto=require(_0x42ca('0xc'));var jsforce=require(_0x42ca('0xd'));var deskjs=require(_0x42ca('0xe'));var toCsv=require('to-csv');var querystring=require(_0x42ca('0xf'));var Papa=require(_0x42ca('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x42ca('0x11'));var as=require(_0x42ca('0x12'));var hardwareService=require(_0x42ca('0x13'));var logger=require('../../config/logger')(_0x42ca('0x14'));var utils=require(_0x42ca('0x15'));var config=require(_0x42ca('0x16'));var licenseUtil=require(_0x42ca('0x17'));var db=require(_0x42ca('0x18'))['db'];function respondWithStatusCode(_0x35eaa9,_0x1bbadf){_0x1bbadf=_0x1bbadf||0xcc;return function(_0x5946f1){if(_0x5946f1){return _0x35eaa9[_0x42ca('0x19')](_0x1bbadf);}return _0x35eaa9[_0x42ca('0x1a')](_0x1bbadf)[_0x42ca('0x1b')]();};}function respondWithResult(_0x3dca1e,_0x515364){_0x515364=_0x515364||0xc8;return function(_0x37381f){if(_0x37381f){return _0x3dca1e[_0x42ca('0x1a')](_0x515364)[_0x42ca('0x1c')](_0x37381f);}};}function respondWithFilteredResult(_0x10792a,_0x509f0f){return function(_0x6d75d9){if(_0x6d75d9){var _0x11b2a1=typeof _0x509f0f[_0x42ca('0x1d')]==='undefined'&&typeof _0x509f0f[_0x42ca('0x1e')]==='undefined';var _0x5003ce=_0x6d75d9[_0x42ca('0x1f')];var _0x2c9d4f=_0x11b2a1?0x0:_0x509f0f[_0x42ca('0x1d')];var _0x3c9a8=_0x11b2a1?_0x6d75d9[_0x42ca('0x1f')]:_0x509f0f['offset']+_0x509f0f['limit'];var _0x4ddc28;if(_0x3c9a8>=_0x5003ce){_0x3c9a8=_0x5003ce;_0x4ddc28=0xc8;}else{_0x4ddc28=0xce;}_0x10792a['status'](_0x4ddc28);return _0x10792a['set'](_0x42ca('0x20'),_0x2c9d4f+'-'+_0x3c9a8+'/'+_0x5003ce)[_0x42ca('0x1c')](_0x6d75d9);}return null;};}function patchUpdates(_0x279fc1){return function(_0xddff74){try{jsonpatch[_0x42ca('0x21')](_0xddff74,_0x279fc1,!![]);}catch(_0x2ca133){return BPromise[_0x42ca('0x22')](_0x2ca133);}return _0xddff74[_0x42ca('0x23')]();};}function saveUpdates(_0x41126c,_0x52e2f8){return function(_0x493d16){if(_0x493d16){return _0x493d16[_0x42ca('0x24')](_0x41126c)['then'](function(_0x274e07){return _0x274e07;});}return null;};}function removeEntity(_0x29ee8c,_0x20c695){return function(_0x56f583){if(_0x56f583){return _0x56f583['destroy']()[_0x42ca('0x25')](function(){_0x29ee8c['status'](0xcc)[_0x42ca('0x1b')]();});}};}function handleEntityNotFound(_0x1fd351,_0x4f123c){return function(_0x47ecb3){if(!_0x47ecb3){_0x1fd351['sendStatus'](0x194);}return _0x47ecb3;};}function handleError(_0x52fc05,_0x4c5081){_0x4c5081=_0x4c5081||0x1f4;return function(_0x208edd){logger[_0x42ca('0x26')](_0x208edd['stack']);if(_0x208edd['name']){delete _0x208edd[_0x42ca('0x27')];}_0x52fc05[_0x42ca('0x1a')](_0x4c5081)['send'](_0x208edd);};}exports[_0x42ca('0x28')]=function(_0x47a8d1,_0x25389e){var _0x42ff88={},_0x3783c3={},_0x3e2b43={'count':0x0,'rows':[]};var _0x307816=_['map'](db['Dynamics365Field'][_0x42ca('0x29')],function(_0xf153ee){return{'name':_0xf153ee[_0x42ca('0x2a')],'type':_0xf153ee[_0x42ca('0x2b')][_0x42ca('0x2c')]};});_0x3783c3[_0x42ca('0x2d')]=_[_0x42ca('0x2e')](_0x307816,_0x42ca('0x27'));_0x3783c3['query']=_[_0x42ca('0x2f')](_0x47a8d1[_0x42ca('0x30')]);_0x3783c3[_0x42ca('0x31')]=_[_0x42ca('0x32')](_0x3783c3[_0x42ca('0x2d')],_0x3783c3[_0x42ca('0x30')]);_0x42ff88[_0x42ca('0x33')]=_[_0x42ca('0x32')](_0x3783c3[_0x42ca('0x2d')],qs['fields'](_0x47a8d1[_0x42ca('0x30')][_0x42ca('0x34')]));_0x42ff88[_0x42ca('0x33')]=_0x42ff88[_0x42ca('0x33')][_0x42ca('0x35')]?_0x42ff88['attributes']:_0x3783c3['model'];if(!_0x47a8d1['query']['hasOwnProperty'](_0x42ca('0x36'))){_0x42ff88[_0x42ca('0x1e')]=qs[_0x42ca('0x1e')](_0x47a8d1[_0x42ca('0x30')]['limit']);_0x42ff88[_0x42ca('0x1d')]=qs[_0x42ca('0x1d')](_0x47a8d1[_0x42ca('0x30')][_0x42ca('0x1d')]);}_0x42ff88[_0x42ca('0x37')]=qs[_0x42ca('0x38')](_0x47a8d1['query'][_0x42ca('0x38')]);_0x42ff88[_0x42ca('0x39')]=qs['filters'](_[_0x42ca('0x3a')](_0x47a8d1['query'],_0x3783c3[_0x42ca('0x31')]),_0x307816);if(_0x47a8d1[_0x42ca('0x30')][_0x42ca('0x3b')]){_0x42ff88[_0x42ca('0x39')]=_['merge'](_0x42ff88['where'],{'$or':_[_0x42ca('0x2e')](_0x307816,function(_0x2a6515){if(_0x2a6515[_0x42ca('0x2b')]!==_0x42ca('0x3c')){var _0x19f42b={};_0x19f42b[_0x2a6515[_0x42ca('0x27')]]={'$like':'%'+_0x47a8d1[_0x42ca('0x30')][_0x42ca('0x3b')]+'%'};return _0x19f42b;}})});}_0x42ff88=_[_0x42ca('0x3d')]({},_0x42ff88,_0x47a8d1[_0x42ca('0x3e')]);var _0x528398={'where':_0x42ff88[_0x42ca('0x39')]};return db[_0x42ca('0x3f')][_0x42ca('0x1f')](_0x528398)[_0x42ca('0x25')](function(_0x381da5){_0x3e2b43[_0x42ca('0x1f')]=_0x381da5;if(_0x47a8d1[_0x42ca('0x30')][_0x42ca('0x40')]){_0x42ff88[_0x42ca('0x41')]=[{'all':!![]}];}return db[_0x42ca('0x3f')][_0x42ca('0x42')](_0x42ff88);})[_0x42ca('0x25')](function(_0x3aecc5){_0x3e2b43[_0x42ca('0x43')]=_0x3aecc5;return _0x3e2b43;})[_0x42ca('0x25')](respondWithFilteredResult(_0x25389e,_0x42ff88))[_0x42ca('0x44')](handleError(_0x25389e,null));};exports['show']=function(_0x5ccce5,_0x4acfc4){var _0x115fcc={'raw':!![],'where':{'id':_0x5ccce5['params']['id']}},_0x92e66={};_0x92e66['model']=_[_0x42ca('0x2f')](db[_0x42ca('0x3f')][_0x42ca('0x29')]);_0x92e66['query']=_[_0x42ca('0x2f')](_0x5ccce5[_0x42ca('0x30')]);_0x92e66[_0x42ca('0x31')]=_[_0x42ca('0x32')](_0x92e66[_0x42ca('0x2d')],_0x92e66[_0x42ca('0x30')]);_0x115fcc[_0x42ca('0x33')]=_['intersection'](_0x92e66['model'],qs['fields'](_0x5ccce5[_0x42ca('0x30')]['fields']));_0x115fcc[_0x42ca('0x33')]=_0x115fcc[_0x42ca('0x33')][_0x42ca('0x35')]?_0x115fcc['attributes']:_0x92e66[_0x42ca('0x2d')];if(_0x5ccce5['query'][_0x42ca('0x40')]){_0x115fcc[_0x42ca('0x41')]=[{'all':!![]}];}_0x115fcc=_['merge']({},_0x115fcc,_0x5ccce5[_0x42ca('0x3e')]);return db[_0x42ca('0x3f')][_0x42ca('0x45')](_0x115fcc)[_0x42ca('0x25')](handleEntityNotFound(_0x4acfc4,null))[_0x42ca('0x25')](respondWithResult(_0x4acfc4,null))[_0x42ca('0x44')](handleError(_0x4acfc4,null));};exports[_0x42ca('0x46')]=function(_0x396e5b,_0x5530d9){return db[_0x42ca('0x3f')]['create'](_0x396e5b[_0x42ca('0x47')],{})['then'](respondWithResult(_0x5530d9,0xc9))[_0x42ca('0x44')](handleError(_0x5530d9,null));};exports['update']=function(_0x1e79de,_0x37c194){if(_0x1e79de[_0x42ca('0x47')]['id']){delete _0x1e79de['body']['id'];}return db[_0x42ca('0x3f')]['find']({'where':{'id':_0x1e79de[_0x42ca('0x48')]['id']}})[_0x42ca('0x25')](handleEntityNotFound(_0x37c194,null))[_0x42ca('0x25')](saveUpdates(_0x1e79de[_0x42ca('0x47')],null))[_0x42ca('0x25')](respondWithResult(_0x37c194,null))[_0x42ca('0x44')](handleError(_0x37c194,null));};exports[_0x42ca('0x49')]=function(_0x3204da,_0x5f1786){return db[_0x42ca('0x3f')]['find']({'where':{'id':_0x3204da[_0x42ca('0x48')]['id']}})[_0x42ca('0x25')](handleEntityNotFound(_0x5f1786,null))['then'](removeEntity(_0x5f1786,null))[_0x42ca('0x44')](handleError(_0x5f1786,null));}; \ No newline at end of file +var _0xd137=['error','stack','send','index','map','Dynamics365Field','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then'];(function(_0x220025,_0x401d3e){var _0x276146=function(_0x1a267d){while(--_0x1a267d){_0x220025['push'](_0x220025['shift']());}};_0x276146(++_0x401d3e);}(_0xd137,0x10c));var _0x7d13=function(_0x3194b8,_0x5ebde6){_0x3194b8=_0x3194b8-0x0;var _0x45216d=_0xd137[_0x3194b8];return _0x45216d;};'use strict';var emlformat=require(_0x7d13('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7d13('0x1'));var jsonpatch=require(_0x7d13('0x2'));var rp=require(_0x7d13('0x3'));var moment=require(_0x7d13('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7d13('0x5'));var util=require(_0x7d13('0x6'));var path=require(_0x7d13('0x7'));var sox=require(_0x7d13('0x8'));var csv=require(_0x7d13('0x9'));var ejs=require(_0x7d13('0xa'));var fs=require('fs');var fs_extra=require(_0x7d13('0xb'));var _=require(_0x7d13('0xc'));var squel=require(_0x7d13('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7d13('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7d13('0xf'));var Papa=require(_0x7d13('0x10'));var Redis=require(_0x7d13('0x11'));var authService=require(_0x7d13('0x12'));var qs=require(_0x7d13('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d13('0x14'));var logger=require(_0x7d13('0x15'))(_0x7d13('0x16'));var utils=require(_0x7d13('0x17'));var config=require(_0x7d13('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7d13('0x19'))['db'];function respondWithStatusCode(_0x43ad58,_0x1dc154){_0x1dc154=_0x1dc154||0xcc;return function(_0x148709){if(_0x148709){return _0x43ad58[_0x7d13('0x1a')](_0x1dc154);}return _0x43ad58[_0x7d13('0x1b')](_0x1dc154)[_0x7d13('0x1c')]();};}function respondWithResult(_0x360a3b,_0x391f00){_0x391f00=_0x391f00||0xc8;return function(_0x2f68dd){if(_0x2f68dd){return _0x360a3b['status'](_0x391f00)[_0x7d13('0x1d')](_0x2f68dd);}};}function respondWithFilteredResult(_0x30a335,_0x2342a8){return function(_0x3f2e85){if(_0x3f2e85){var _0x5ccf2c=typeof _0x2342a8[_0x7d13('0x1e')]===_0x7d13('0x1f')&&typeof _0x2342a8[_0x7d13('0x20')]===_0x7d13('0x1f');var _0x24a63a=_0x3f2e85['count'];var _0x2a19e9=_0x5ccf2c?0x0:_0x2342a8[_0x7d13('0x1e')];var _0x5d4377=_0x5ccf2c?_0x3f2e85[_0x7d13('0x21')]:_0x2342a8[_0x7d13('0x1e')]+_0x2342a8['limit'];var _0x37000e;if(_0x5d4377>=_0x24a63a){_0x5d4377=_0x24a63a;_0x37000e=0xc8;}else{_0x37000e=0xce;}_0x30a335[_0x7d13('0x1b')](_0x37000e);return _0x30a335['set'](_0x7d13('0x22'),_0x2a19e9+'-'+_0x5d4377+'/'+_0x24a63a)['json'](_0x3f2e85);}return null;};}function patchUpdates(_0x580da9){return function(_0x1cb411){try{jsonpatch[_0x7d13('0x23')](_0x1cb411,_0x580da9,!![]);}catch(_0xadd607){return BPromise[_0x7d13('0x24')](_0xadd607);}return _0x1cb411[_0x7d13('0x25')]();};}function saveUpdates(_0x4b9f05,_0x324067){return function(_0xa9a6d6){if(_0xa9a6d6){return _0xa9a6d6[_0x7d13('0x26')](_0x4b9f05)[_0x7d13('0x27')](function(_0x1e0c34){return _0x1e0c34;});}return null;};}function removeEntity(_0x3e36ce,_0x2db591){return function(_0x1991fa){if(_0x1991fa){return _0x1991fa['destroy']()[_0x7d13('0x27')](function(){_0x3e36ce[_0x7d13('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45463e,_0x1e5e0e){return function(_0x11a391){if(!_0x11a391){_0x45463e['sendStatus'](0x194);}return _0x11a391;};}function handleError(_0x3e8aaf,_0x163d82){_0x163d82=_0x163d82||0x1f4;return function(_0x221db5){logger[_0x7d13('0x28')](_0x221db5[_0x7d13('0x29')]);if(_0x221db5['name']){delete _0x221db5['name'];}_0x3e8aaf[_0x7d13('0x1b')](_0x163d82)[_0x7d13('0x2a')](_0x221db5);};}exports[_0x7d13('0x2b')]=function(_0x4df563,_0x2a8e43){var _0x31a544={},_0x36e3cf={},_0x5899f7={'count':0x0,'rows':[]};var _0x256a3e=_[_0x7d13('0x2c')](db[_0x7d13('0x2d')]['rawAttributes'],function(_0x1dd830){return{'name':_0x1dd830[_0x7d13('0x2e')],'type':_0x1dd830[_0x7d13('0x2f')][_0x7d13('0x30')]};});_0x36e3cf[_0x7d13('0x31')]=_[_0x7d13('0x2c')](_0x256a3e,_0x7d13('0x32'));_0x36e3cf[_0x7d13('0x33')]=_['keys'](_0x4df563[_0x7d13('0x33')]);_0x36e3cf[_0x7d13('0x34')]=_[_0x7d13('0x35')](_0x36e3cf[_0x7d13('0x31')],_0x36e3cf[_0x7d13('0x33')]);_0x31a544['attributes']=_[_0x7d13('0x35')](_0x36e3cf[_0x7d13('0x31')],qs[_0x7d13('0x36')](_0x4df563[_0x7d13('0x33')]['fields']));_0x31a544[_0x7d13('0x37')]=_0x31a544['attributes'][_0x7d13('0x38')]?_0x31a544[_0x7d13('0x37')]:_0x36e3cf['model'];if(!_0x4df563[_0x7d13('0x33')][_0x7d13('0x39')](_0x7d13('0x3a'))){_0x31a544[_0x7d13('0x20')]=qs[_0x7d13('0x20')](_0x4df563['query'][_0x7d13('0x20')]);_0x31a544[_0x7d13('0x1e')]=qs['offset'](_0x4df563[_0x7d13('0x33')][_0x7d13('0x1e')]);}_0x31a544[_0x7d13('0x3b')]=qs[_0x7d13('0x3c')](_0x4df563[_0x7d13('0x33')][_0x7d13('0x3c')]);_0x31a544['where']=qs[_0x7d13('0x34')](_['pick'](_0x4df563['query'],_0x36e3cf[_0x7d13('0x34')]),_0x256a3e);if(_0x4df563['query'][_0x7d13('0x3d')]){_0x31a544['where']=_['merge'](_0x31a544[_0x7d13('0x3e')],{'$or':_[_0x7d13('0x2c')](_0x256a3e,function(_0x53f7a1){if(_0x53f7a1[_0x7d13('0x2f')]!==_0x7d13('0x3f')){var _0x2b9bbd={};_0x2b9bbd[_0x53f7a1[_0x7d13('0x32')]]={'$like':'%'+_0x4df563[_0x7d13('0x33')][_0x7d13('0x3d')]+'%'};return _0x2b9bbd;}})});}_0x31a544=_[_0x7d13('0x40')]({},_0x31a544,_0x4df563[_0x7d13('0x41')]);var _0x557dce={'where':_0x31a544['where']};return db[_0x7d13('0x2d')][_0x7d13('0x21')](_0x557dce)['then'](function(_0xa41f33){_0x5899f7['count']=_0xa41f33;if(_0x4df563[_0x7d13('0x33')][_0x7d13('0x42')]){_0x31a544[_0x7d13('0x43')]=[{'all':!![]}];}return db[_0x7d13('0x2d')][_0x7d13('0x44')](_0x31a544);})[_0x7d13('0x27')](function(_0x5acdb7){_0x5899f7['rows']=_0x5acdb7;return _0x5899f7;})[_0x7d13('0x27')](respondWithFilteredResult(_0x2a8e43,_0x31a544))[_0x7d13('0x45')](handleError(_0x2a8e43,null));};exports[_0x7d13('0x46')]=function(_0x4a6969,_0x533364){var _0x421ca0={'raw':!![],'where':{'id':_0x4a6969[_0x7d13('0x47')]['id']}},_0x171147={};_0x171147['model']=_[_0x7d13('0x48')](db[_0x7d13('0x2d')]['rawAttributes']);_0x171147['query']=_[_0x7d13('0x48')](_0x4a6969[_0x7d13('0x33')]);_0x171147[_0x7d13('0x34')]=_[_0x7d13('0x35')](_0x171147[_0x7d13('0x31')],_0x171147[_0x7d13('0x33')]);_0x421ca0[_0x7d13('0x37')]=_[_0x7d13('0x35')](_0x171147[_0x7d13('0x31')],qs[_0x7d13('0x36')](_0x4a6969[_0x7d13('0x33')][_0x7d13('0x36')]));_0x421ca0['attributes']=_0x421ca0['attributes']['length']?_0x421ca0[_0x7d13('0x37')]:_0x171147['model'];if(_0x4a6969[_0x7d13('0x33')]['includeAll']){_0x421ca0[_0x7d13('0x43')]=[{'all':!![]}];}_0x421ca0=_[_0x7d13('0x40')]({},_0x421ca0,_0x4a6969['options']);return db[_0x7d13('0x2d')][_0x7d13('0x49')](_0x421ca0)[_0x7d13('0x27')](handleEntityNotFound(_0x533364,null))['then'](respondWithResult(_0x533364,null))[_0x7d13('0x45')](handleError(_0x533364,null));};exports[_0x7d13('0x4a')]=function(_0xb47f90,_0x3b4a18){return db[_0x7d13('0x2d')]['create'](_0xb47f90[_0x7d13('0x4b')],{})['then'](respondWithResult(_0x3b4a18,0xc9))['catch'](handleError(_0x3b4a18,null));};exports[_0x7d13('0x26')]=function(_0x4cb51f,_0x43b07b){if(_0x4cb51f[_0x7d13('0x4b')]['id']){delete _0x4cb51f[_0x7d13('0x4b')]['id'];}return db['Dynamics365Field'][_0x7d13('0x49')]({'where':{'id':_0x4cb51f[_0x7d13('0x47')]['id']}})[_0x7d13('0x27')](handleEntityNotFound(_0x43b07b,null))[_0x7d13('0x27')](saveUpdates(_0x4cb51f['body'],null))[_0x7d13('0x27')](respondWithResult(_0x43b07b,null))[_0x7d13('0x45')](handleError(_0x43b07b,null));};exports[_0x7d13('0x4c')]=function(_0x54864c,_0x517677){return db[_0x7d13('0x2d')][_0x7d13('0x49')]({'where':{'id':_0x54864c[_0x7d13('0x47')]['id']}})[_0x7d13('0x27')](handleEntityNotFound(_0x517677,null))[_0x7d13('0x27')](removeEntity(_0x517677,null))[_0x7d13('0x45')](handleError(_0x517677,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index cdeb1b3..1c3d7cd 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 _0x9a99=['request-promise','path','rimraf','../../config/environment','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash','../../config/logger','api','moment'];(function(_0x2c5343,_0x5023b0){var _0x305f08=function(_0x2698c1){while(--_0x2698c1){_0x2c5343['push'](_0x2c5343['shift']());}};_0x305f08(++_0x5023b0);}(_0x9a99,0x6c));var _0x99a9=function(_0x32c610,_0x5b9fad){_0x32c610=_0x32c610-0x0;var _0x5e5741=_0x9a99[_0x32c610];return _0x5e5741;};'use strict';var _=require(_0x99a9('0x0'));var util=require('util');var logger=require(_0x99a9('0x1'))(_0x99a9('0x2'));var moment=require(_0x99a9('0x3'));var BPromise=require('bluebird');var rp=require(_0x99a9('0x4'));var fs=require('fs');var path=require(_0x99a9('0x5'));var rimraf=require(_0x99a9('0x6'));var config=require(_0x99a9('0x7'));var attributes=require('./intDynamics365Field.attributes');module[_0x99a9('0x8')]=function(_0x3e1933,_0xac42f9){return _0x3e1933[_0x99a9('0x9')](_0x99a9('0xa'),attributes,{'tableName':_0x99a9('0xb'),'paranoid':![],'indexes':[{'name':_0x99a9('0xc'),'fields':['idField',_0x99a9('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc960=['FieldId','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','int_dynamics365_fields','dynamics365_unique_index','idField'];(function(_0x5515ca,_0x165547){var _0x3aaa35=function(_0x3589f7){while(--_0x3589f7){_0x5515ca['push'](_0x5515ca['shift']());}};_0x3aaa35(++_0x165547);}(_0xc960,0x17a));var _0x0c96=function(_0x1b0750,_0x336303){_0x1b0750=_0x1b0750-0x0;var _0x17aef7=_0xc960[_0x1b0750];return _0x17aef7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c96('0x0'))('api');var moment=require(_0x0c96('0x1'));var BPromise=require(_0x0c96('0x2'));var rp=require(_0x0c96('0x3'));var fs=require('fs');var path=require(_0x0c96('0x4'));var rimraf=require(_0x0c96('0x5'));var config=require(_0x0c96('0x6'));var attributes=require(_0x0c96('0x7'));module[_0x0c96('0x8')]=function(_0x2d8fb0,_0x4f36bb){return _0x2d8fb0['define']('Dynamics365Field',attributes,{'tableName':_0x0c96('0x9'),'paranoid':![],'indexes':[{'name':_0x0c96('0xa'),'fields':[_0x0c96('0xb'),_0x0c96('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 6217a63..e8d8d97 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 _0x8b4c=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','randomstring'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0x8b4c,0x174));var _0xc8b4=function(_0x3b41a2,_0x5da694){_0x3b41a2=_0x3b41a2-0x0;var _0x71a275=_0x8b4c[_0x3b41a2];return _0x71a275;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc8b4('0x0'));var BPromise=require('bluebird');var rs=require(_0xc8b4('0x1'));var fs=require('fs');var Redis=require(_0xc8b4('0x2'));var db=require(_0xc8b4('0x3'))['db'];var utils=require(_0xc8b4('0x4'));var logger=require('../../config/logger')(_0xc8b4('0x5'));var config=require(_0xc8b4('0x6'));var jayson=require(_0xc8b4('0x7'));var client=jayson[_0xc8b4('0x8')][_0xc8b4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f799c,_0x4b6aba,_0x2f4479){return new BPromise(function(_0x5294b1,_0x5074df){return client[_0xc8b4('0xa')](_0x2f799c,_0x2f4479)['then'](function(_0x343349){logger[_0xc8b4('0xb')](_0xc8b4('0xc'),_0x4b6aba,_0xc8b4('0xd'));logger[_0xc8b4('0xe')](_0xc8b4('0xf'),_0x4b6aba,_0xc8b4('0xd'),JSON[_0xc8b4('0x10')](_0x343349));if(_0x343349['error']){if(_0x343349[_0xc8b4('0x11')][_0xc8b4('0x12')]===0x1f4){logger[_0xc8b4('0x11')](_0xc8b4('0xc'),_0x4b6aba,_0x343349[_0xc8b4('0x11')][_0xc8b4('0x13')]);return _0x5074df(_0x343349[_0xc8b4('0x11')][_0xc8b4('0x13')]);}logger[_0xc8b4('0x11')](_0xc8b4('0xc'),_0x4b6aba,_0x343349[_0xc8b4('0x11')][_0xc8b4('0x13')]);return _0x5294b1(_0x343349[_0xc8b4('0x11')][_0xc8b4('0x13')]);}else{logger[_0xc8b4('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x4b6aba,_0xc8b4('0xd'));_0x5294b1(_0x343349[_0xc8b4('0x14')][_0xc8b4('0x13')]);}})[_0xc8b4('0x15')](function(_0x5c9a3f){logger[_0xc8b4('0x11')](_0xc8b4('0xc'),_0x4b6aba,_0x5c9a3f);_0x5074df(_0x5c9a3f);});});} \ No newline at end of file +var _0x0140=['../../config/logger','rpc','../../config/environment','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x3a115e,_0x3dac39){var _0x1b7e61=function(_0x393180){while(--_0x393180){_0x3a115e['push'](_0x3a115e['shift']());}};_0x1b7e61(++_0x3dac39);}(_0x0140,0x177));var _0x0014=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x0140[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require(_0x0014('0x0'));var util=require('util');var moment=require(_0x0014('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0014('0x2'));var db=require(_0x0014('0x3'))['db'];var utils=require(_0x0014('0x4'));var logger=require(_0x0014('0x5'))(_0x0014('0x6'));var config=require(_0x0014('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0014('0x8')][_0x0014('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e15d9,_0xcf898a,_0x5ad2a6){return new BPromise(function(_0x2e8efe,_0x173b85){return client['request'](_0x1e15d9,_0x5ad2a6)[_0x0014('0xa')](function(_0x27993b){logger[_0x0014('0xb')](_0x0014('0xc'),_0xcf898a,_0x0014('0xd'));logger[_0x0014('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0xcf898a,_0x0014('0xd'),JSON[_0x0014('0xf')](_0x27993b));if(_0x27993b[_0x0014('0x10')]){if(_0x27993b[_0x0014('0x10')][_0x0014('0x11')]===0x1f4){logger[_0x0014('0x10')](_0x0014('0xc'),_0xcf898a,_0x27993b['error']['message']);return _0x173b85(_0x27993b['error'][_0x0014('0x12')]);}logger[_0x0014('0x10')](_0x0014('0xc'),_0xcf898a,_0x27993b['error'][_0x0014('0x12')]);return _0x2e8efe(_0x27993b['error']['message']);}else{logger[_0x0014('0xb')](_0x0014('0xc'),_0xcf898a,_0x0014('0xd'));_0x2e8efe(_0x27993b[_0x0014('0x13')][_0x0014('0x12')]);}})['catch'](function(_0x1bfa44){logger[_0x0014('0x10')](_0x0014('0xc'),_0xcf898a,_0x1bfa44);_0x173b85(_0x1bfa44);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 08d46ab..6bd7c93 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 _0x8a55=['../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x4bfdf9,_0x23dfb7){var _0x152f66=function(_0x155b06){while(--_0x155b06){_0x4bfdf9['push'](_0x4bfdf9['shift']());}};_0x152f66(++_0x23dfb7);}(_0x8a55,0xb7));var _0x58a5=function(_0x52cf2d,_0x13a1c4){_0x52cf2d=_0x52cf2d-0x0;var _0x284c65=_0x8a55[_0x52cf2d];return _0x284c65;};'use strict';var multer=require(_0x58a5('0x0'));var util=require('util');var path=require(_0x58a5('0x1'));var timeout=require(_0x58a5('0x2'));var express=require(_0x58a5('0x3'));var router=express['Router']();var fs_extra=require(_0x58a5('0x4'));var auth=require(_0x58a5('0x5'));var interaction=require(_0x58a5('0x6'));var config=require(_0x58a5('0x7'));var controller=require(_0x58a5('0x8'));router[_0x58a5('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x58a5('0x9')]('/:id',auth[_0x58a5('0xa')](),controller['show']);router['get'](_0x58a5('0xb'),auth[_0x58a5('0xa')](),controller[_0x58a5('0xc')]);router[_0x58a5('0x9')](_0x58a5('0xd'),auth[_0x58a5('0xa')](),controller['getFields']);router[_0x58a5('0xe')]('/',auth[_0x58a5('0xa')](),controller['create']);router['post'](_0x58a5('0xb'),auth['isAuthenticated'](),controller[_0x58a5('0xf')]);router[_0x58a5('0x10')](_0x58a5('0x11'),auth[_0x58a5('0xa')](),controller[_0x58a5('0x12')]);router['delete'](_0x58a5('0x11'),auth['isAuthenticated'](),controller[_0x58a5('0x13')]);module[_0x58a5('0x14')]=router; \ No newline at end of file +var _0xafff=['../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x4553e4,_0x1fec90){var _0x4dcfcf=function(_0x3145b9){while(--_0x3145b9){_0x4553e4['push'](_0x4553e4['shift']());}};_0x4dcfcf(++_0x1fec90);}(_0xafff,0x10d));var _0xfaff=function(_0x22e256,_0x144b14){_0x22e256=_0x22e256-0x0;var _0x58602a=_0xafff[_0x22e256];return _0x58602a;};'use strict';var multer=require(_0xfaff('0x0'));var util=require(_0xfaff('0x1'));var path=require(_0xfaff('0x2'));var timeout=require(_0xfaff('0x3'));var express=require(_0xfaff('0x4'));var router=express['Router']();var fs_extra=require(_0xfaff('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfaff('0x6'));var config=require(_0xfaff('0x7'));var controller=require(_0xfaff('0x8'));router[_0xfaff('0x9')]('/',auth[_0xfaff('0xa')](),controller[_0xfaff('0xb')]);router[_0xfaff('0x9')](_0xfaff('0xc'),auth[_0xfaff('0xa')](),controller[_0xfaff('0xd')]);router['get'](_0xfaff('0xe'),auth[_0xfaff('0xa')](),controller[_0xfaff('0xf')]);router['get'](_0xfaff('0x10'),auth['isAuthenticated'](),controller[_0xfaff('0x11')]);router[_0xfaff('0x12')]('/',auth[_0xfaff('0xa')](),controller[_0xfaff('0x13')]);router[_0xfaff('0x12')](_0xfaff('0xe'),auth['isAuthenticated'](),controller[_0xfaff('0x14')]);router[_0xfaff('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xfaff('0x16')]);router['delete']('/:id',auth[_0xfaff('0xa')](),controller[_0xfaff('0x17')]);module[_0xfaff('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 0defb31..af40b8e 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 _0x8f4c=['sequelize','exports','STRING','username','remoteUri'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8f4c,0x113));var _0xc8f4=function(_0x453705,_0x1f3175){_0x453705=_0x453705-0x0;var _0x2f9c07=_0x8f4c[_0x453705];return _0x2f9c07;};'use strict';var Sequelize=require(_0xc8f4('0x0'));module[_0xc8f4('0x1')]={'name':{'type':Sequelize[_0xc8f4('0x2')]},'description':{'type':Sequelize[_0xc8f4('0x2')]},'username':{'type':Sequelize[_0xc8f4('0x2')],'unique':_0xc8f4('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc8f4('0x2')],'unique':_0xc8f4('0x4')},'serverUrl':{'type':Sequelize[_0xc8f4('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6d11=['exports','STRING','sequelize'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x6d11,0xbf));var _0x16d1=function(_0x5f3309,_0x37871b){_0x5f3309=_0x5f3309-0x0;var _0xea65ec=_0x6d11[_0x5f3309];return _0xea65ec;};'use strict';var Sequelize=require(_0x16d1('0x0'));module[_0x16d1('0x1')]={'name':{'type':Sequelize[_0x16d1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x16d1('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x16d1('0x2')]},'remoteUri':{'type':Sequelize[_0x16d1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index ff7bb06..fa077ea 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 _0xfb3f=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','then','error','stack','name','FreshdeskAccount','rawAttributes','fieldName','type','key','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','include','rows','catch','show','params','keys','options','create','body','update','find','getConfigurations','findOne','pick','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','FreshdeskConfiguration','FreshdeskField','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','group','company','includes','custom_text','custom_dropdown','label','default','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','statusCode','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x161e02,_0x48f7ba){var _0x44c59d=function(_0x353793){while(--_0x353793){_0x161e02['push'](_0x161e02['shift']());}};_0x44c59d(++_0x48f7ba);}(_0xfb3f,0xd9));var _0xffb3=function(_0x4e831d,_0x4931b7){_0x4e831d=_0x4e831d-0x0;var _0x3e405e=_0xfb3f[_0x4e831d];return _0x3e405e;};'use strict';var emlformat=require(_0xffb3('0x0'));var rimraf=require(_0xffb3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xffb3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xffb3('0x3'));var Mustache=require('mustache');var util=require(_0xffb3('0x4'));var path=require(_0xffb3('0x5'));var sox=require(_0xffb3('0x6'));var csv=require(_0xffb3('0x7'));var ejs=require(_0xffb3('0x8'));var fs=require('fs');var fs_extra=require(_0xffb3('0x9'));var _=require(_0xffb3('0xa'));var squel=require(_0xffb3('0xb'));var crypto=require('crypto');var jsforce=require(_0xffb3('0xc'));var deskjs=require(_0xffb3('0xd'));var toCsv=require(_0xffb3('0x7'));var querystring=require(_0xffb3('0xe'));var Papa=require(_0xffb3('0xf'));var Redis=require('ioredis');var authService=require(_0xffb3('0x10'));var qs=require(_0xffb3('0x11'));var as=require(_0xffb3('0x12'));var hardwareService=require(_0xffb3('0x13'));var logger=require(_0xffb3('0x14'))(_0xffb3('0x15'));var utils=require(_0xffb3('0x16'));var config=require(_0xffb3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xffb3('0x18'))['db'];var integrations=require(_0xffb3('0x19'));function respondWithStatusCode(_0x55192c,_0x21924a){_0x21924a=_0x21924a||0xcc;return function(_0x356e10){if(_0x356e10){return _0x55192c[_0xffb3('0x1a')](_0x21924a);}return _0x55192c[_0xffb3('0x1b')](_0x21924a)[_0xffb3('0x1c')]();};}function respondWithResult(_0x420156,_0x19ce6e){_0x19ce6e=_0x19ce6e||0xc8;return function(_0x2338f1){if(_0x2338f1){return _0x420156[_0xffb3('0x1b')](_0x19ce6e)[_0xffb3('0x1d')](_0x2338f1);}};}function respondWithFilteredResult(_0x38daab,_0x2c3ef7){return function(_0x4d3c48){if(_0x4d3c48){var _0x46ae17=typeof _0x2c3ef7[_0xffb3('0x1e')]===_0xffb3('0x1f')&&typeof _0x2c3ef7['limit']==='undefined';var _0x1f3d9a=_0x4d3c48[_0xffb3('0x20')];var _0x57d096=_0x46ae17?0x0:_0x2c3ef7[_0xffb3('0x1e')];var _0x30f403=_0x46ae17?_0x4d3c48[_0xffb3('0x20')]:_0x2c3ef7['offset']+_0x2c3ef7[_0xffb3('0x21')];var _0x45fdd6;if(_0x30f403>=_0x1f3d9a){_0x30f403=_0x1f3d9a;_0x45fdd6=0xc8;}else{_0x45fdd6=0xce;}_0x38daab['status'](_0x45fdd6);return _0x38daab[_0xffb3('0x22')](_0xffb3('0x23'),_0x57d096+'-'+_0x30f403+'/'+_0x1f3d9a)[_0xffb3('0x1d')](_0x4d3c48);}return null;};}function patchUpdates(_0x21c9ad){return function(_0x1e75a0){try{jsonpatch[_0xffb3('0x24')](_0x1e75a0,_0x21c9ad,!![]);}catch(_0x40dc49){return BPromise['reject'](_0x40dc49);}return _0x1e75a0[_0xffb3('0x25')]();};}function saveUpdates(_0xe4c60e,_0x5e0f48){return function(_0x38330a){if(_0x38330a){return _0x38330a['update'](_0xe4c60e)['then'](function(_0x24c502){return _0x24c502;});}return null;};}function removeEntity(_0x3d55e6,_0x22bbea){return function(_0x3bc410){if(_0x3bc410){return _0x3bc410[_0xffb3('0x26')]()[_0xffb3('0x27')](function(){_0x3d55e6['status'](0xcc)[_0xffb3('0x1c')]();});}};}function handleEntityNotFound(_0x588608,_0x1390c6){return function(_0x2f01ff){if(!_0x2f01ff){_0x588608['sendStatus'](0x194);}return _0x2f01ff;};}function handleError(_0x32e047,_0x5e0474){_0x5e0474=_0x5e0474||0x1f4;return function(_0x1eee6b){logger[_0xffb3('0x28')](_0x1eee6b[_0xffb3('0x29')]);if(_0x1eee6b[_0xffb3('0x2a')]){delete _0x1eee6b['name'];}_0x32e047['status'](_0x5e0474)['send'](_0x1eee6b);};}exports['index']=function(_0xe3d338,_0x5d1630){var _0x17f601={},_0x3e64bb={},_0x17462d={'count':0x0,'rows':[]};var _0x28f65d=_['map'](db[_0xffb3('0x2b')][_0xffb3('0x2c')],function(_0x4d544d){return{'name':_0x4d544d[_0xffb3('0x2d')],'type':_0x4d544d[_0xffb3('0x2e')][_0xffb3('0x2f')]};});_0x3e64bb['model']=_[_0xffb3('0x30')](_0x28f65d,_0xffb3('0x2a'));_0x3e64bb[_0xffb3('0x31')]=_['keys'](_0xe3d338[_0xffb3('0x31')]);_0x3e64bb[_0xffb3('0x32')]=_['intersection'](_0x3e64bb[_0xffb3('0x33')],_0x3e64bb[_0xffb3('0x31')]);_0x17f601[_0xffb3('0x34')]=_[_0xffb3('0x35')](_0x3e64bb[_0xffb3('0x33')],qs['fields'](_0xe3d338[_0xffb3('0x31')][_0xffb3('0x36')]));_0x17f601[_0xffb3('0x34')]=_0x17f601['attributes'][_0xffb3('0x37')]?_0x17f601[_0xffb3('0x34')]:_0x3e64bb['model'];if(!_0xe3d338[_0xffb3('0x31')][_0xffb3('0x38')]('nolimit')){_0x17f601[_0xffb3('0x21')]=qs[_0xffb3('0x21')](_0xe3d338['query']['limit']);_0x17f601['offset']=qs[_0xffb3('0x1e')](_0xe3d338[_0xffb3('0x31')]['offset']);}_0x17f601[_0xffb3('0x39')]=qs['sort'](_0xe3d338[_0xffb3('0x31')][_0xffb3('0x3a')]);_0x17f601['where']=qs[_0xffb3('0x32')](_['pick'](_0xe3d338[_0xffb3('0x31')],_0x3e64bb[_0xffb3('0x32')]),_0x28f65d);if(_0xe3d338['query'][_0xffb3('0x3b')]){_0x17f601[_0xffb3('0x3c')]=_[_0xffb3('0x3d')](_0x17f601[_0xffb3('0x3c')],{'$or':_[_0xffb3('0x30')](_0x28f65d,function(_0x748cef){if(_0x748cef[_0xffb3('0x2e')]!==_0xffb3('0x3e')){var _0x183968={};_0x183968[_0x748cef[_0xffb3('0x2a')]]={'$like':'%'+_0xe3d338[_0xffb3('0x31')][_0xffb3('0x3b')]+'%'};return _0x183968;}})});}_0x17f601=_[_0xffb3('0x3d')]({},_0x17f601,_0xe3d338['options']);var _0x2f6a9a={'where':_0x17f601[_0xffb3('0x3c')]};return db[_0xffb3('0x2b')]['count'](_0x2f6a9a)[_0xffb3('0x27')](function(_0x5bd952){_0x17462d[_0xffb3('0x20')]=_0x5bd952;if(_0xe3d338[_0xffb3('0x31')]['includeAll']){_0x17f601[_0xffb3('0x3f')]=[{'all':!![]}];}return db[_0xffb3('0x2b')]['findAll'](_0x17f601);})['then'](function(_0x354088){_0x17462d[_0xffb3('0x40')]=_0x354088;return _0x17462d;})['then'](respondWithFilteredResult(_0x5d1630,_0x17f601))[_0xffb3('0x41')](handleError(_0x5d1630,null));};exports[_0xffb3('0x42')]=function(_0x3f2b13,_0x1bfa03){var _0x2e8564={'raw':![],'where':{'id':_0x3f2b13[_0xffb3('0x43')]['id']}},_0x4c2d24={};_0x4c2d24[_0xffb3('0x33')]=_[_0xffb3('0x44')](db[_0xffb3('0x2b')][_0xffb3('0x2c')]);_0x4c2d24['query']=_['keys'](_0x3f2b13[_0xffb3('0x31')]);_0x4c2d24[_0xffb3('0x32')]=_['intersection'](_0x4c2d24[_0xffb3('0x33')],_0x4c2d24[_0xffb3('0x31')]);_0x2e8564[_0xffb3('0x34')]=_[_0xffb3('0x35')](_0x4c2d24['model'],qs['fields'](_0x3f2b13[_0xffb3('0x31')][_0xffb3('0x36')]));_0x2e8564[_0xffb3('0x34')]=_0x2e8564[_0xffb3('0x34')][_0xffb3('0x37')]?_0x2e8564[_0xffb3('0x34')]:_0x4c2d24['model'];if(_0x3f2b13[_0xffb3('0x31')]['includeAll']){_0x2e8564[_0xffb3('0x3f')]=[{'all':!![]}];}_0x2e8564=_[_0xffb3('0x3d')]({},_0x2e8564,_0x3f2b13[_0xffb3('0x45')]);return db[_0xffb3('0x2b')]['find'](_0x2e8564)['then'](handleEntityNotFound(_0x1bfa03,null))[_0xffb3('0x27')](respondWithResult(_0x1bfa03,null))['catch'](handleError(_0x1bfa03,null));};exports[_0xffb3('0x46')]=function(_0x30a92a,_0x1d542e){return db['FreshdeskAccount'][_0xffb3('0x46')](_0x30a92a[_0xffb3('0x47')],{})[_0xffb3('0x27')](respondWithResult(_0x1d542e,0xc9))[_0xffb3('0x41')](handleError(_0x1d542e,null));};exports[_0xffb3('0x48')]=function(_0x4b0fd3,_0x2dd1d7){if(_0x4b0fd3[_0xffb3('0x47')]['id']){delete _0x4b0fd3[_0xffb3('0x47')]['id'];}return db['FreshdeskAccount'][_0xffb3('0x49')]({'where':{'id':_0x4b0fd3[_0xffb3('0x43')]['id']}})[_0xffb3('0x27')](handleEntityNotFound(_0x2dd1d7,null))['then'](saveUpdates(_0x4b0fd3[_0xffb3('0x47')],null))[_0xffb3('0x27')](respondWithResult(_0x2dd1d7,null))[_0xffb3('0x41')](handleError(_0x2dd1d7,null));};exports[_0xffb3('0x26')]=function(_0x51a66e,_0x525ecf){return db['FreshdeskAccount']['find']({'where':{'id':_0x51a66e[_0xffb3('0x43')]['id']}})['then'](handleEntityNotFound(_0x525ecf,null))['then'](removeEntity(_0x525ecf,null))[_0xffb3('0x41')](handleError(_0x525ecf,null));};exports[_0xffb3('0x4a')]=function(_0x2edbce,_0xf72b36,_0x9030ae){var _0x6b0b72={};var _0x23e2b1={};var _0x5b50fe;var _0x29ba96;return db[_0xffb3('0x2b')][_0xffb3('0x4b')]({'where':{'id':_0x2edbce[_0xffb3('0x43')]['id']}})[_0xffb3('0x27')](handleEntityNotFound(_0xf72b36,null))[_0xffb3('0x27')](function(_0x4cf832){if(_0x4cf832){_0x5b50fe=_0x4cf832;_0x23e2b1[_0xffb3('0x33')]=_[_0xffb3('0x44')](db['FreshdeskConfiguration']['rawAttributes']);_0x23e2b1[_0xffb3('0x31')]=_['keys'](_0x2edbce[_0xffb3('0x31')]);_0x23e2b1[_0xffb3('0x32')]=_[_0xffb3('0x35')](_0x23e2b1['model'],_0x23e2b1['query']);_0x6b0b72['attributes']=_[_0xffb3('0x35')](_0x23e2b1['model'],qs['fields'](_0x2edbce['query'][_0xffb3('0x36')]));_0x6b0b72[_0xffb3('0x34')]=_0x6b0b72[_0xffb3('0x34')]['length']?_0x6b0b72[_0xffb3('0x34')]:_0x23e2b1['model'];_0x6b0b72[_0xffb3('0x39')]=qs[_0xffb3('0x3a')](_0x2edbce['query'][_0xffb3('0x3a')]);_0x6b0b72[_0xffb3('0x3c')]=qs[_0xffb3('0x32')](_[_0xffb3('0x4c')](_0x2edbce['query'],_0x23e2b1[_0xffb3('0x32')]));if(_0x2edbce[_0xffb3('0x31')][_0xffb3('0x3b')]){_0x6b0b72['where']=_['merge'](_0x6b0b72['where'],{'$or':_[_0xffb3('0x30')](_0x6b0b72[_0xffb3('0x34')],function(_0x4ee0e0){var _0x220bc4={};_0x220bc4[_0x4ee0e0]={'$like':'%'+_0x2edbce[_0xffb3('0x31')]['filter']+'%'};return _0x220bc4;})});}_0x6b0b72=_[_0xffb3('0x3d')]({},_0x6b0b72,_0x2edbce[_0xffb3('0x45')]);return _0x5b50fe[_0xffb3('0x4a')](_0x6b0b72);}})[_0xffb3('0x27')](function(_0x3bf20a){if(_0x3bf20a){_0x29ba96=_0x3bf20a['length'];if(!_0x2edbce[_0xffb3('0x31')][_0xffb3('0x38')](_0xffb3('0x4d'))){_0x6b0b72['limit']=qs[_0xffb3('0x21')](_0x2edbce[_0xffb3('0x31')]['limit']);_0x6b0b72[_0xffb3('0x1e')]=qs[_0xffb3('0x1e')](_0x2edbce['query']['offset']);}return _0x5b50fe[_0xffb3('0x4a')](_0x6b0b72);}})['then'](function(_0x2307a0){if(_0x2307a0){return _0x2307a0?{'count':_0x29ba96,'rows':_0x2307a0}:null;}})[_0xffb3('0x27')](respondWithResult(_0xf72b36,null))[_0xffb3('0x41')](handleError(_0xf72b36,null));};exports[_0xffb3('0x4e')]=function(_0x4595ac,_0x469a62,_0x28addf){if(_0x4595ac[_0xffb3('0x47')]['id']){delete _0x4595ac['body']['id'];}return db[_0xffb3('0x2b')][_0xffb3('0x4b')]({'where':{'id':_0x4595ac['params']['id']}})['then'](handleEntityNotFound(_0x469a62,null))[_0xffb3('0x27')](function(_0x44be9d){if(_0x44be9d){_0x4595ac[_0xffb3('0x47')][_0xffb3('0x4f')]=_0x44be9d['id'];_0x4595ac['body'][_0xffb3('0x50')]=integrations['getSubjects'](_0x4595ac['body'][_0xffb3('0x51')],_0x4595ac['body'][_0xffb3('0x2e')]);_0x4595ac[_0xffb3('0x47')][_0xffb3('0x52')]=integrations['getDescriptions'](_0x4595ac[_0xffb3('0x47')]['channel'],_0x4595ac[_0xffb3('0x47')][_0xffb3('0x2e')]);return db[_0xffb3('0x53')][_0xffb3('0x46')](_0x4595ac[_0xffb3('0x47')],{'include':[{'model':db[_0xffb3('0x54')],'as':_0xffb3('0x50')},{'model':db[_0xffb3('0x54')],'as':_0xffb3('0x52')}]});}return null;})[_0xffb3('0x27')](respondWithResult(_0x469a62,null))[_0xffb3('0x41')](handleError(_0x469a62,null));};exports['getFields']=function(_0x158491,_0x17a45c,_0xccd731){var _0x5435c9='';return db[_0xffb3('0x2b')][_0xffb3('0x4b')]({'where':{'id':_0x158491[_0xffb3('0x43')]['id']},'attributes':['id',_0xffb3('0x55'),_0xffb3('0x56')]})[_0xffb3('0x27')](handleEntityNotFound(_0x17a45c,null))['then'](function(_0x518077){if(_0x518077){_0x5435c9=_0x518077[_0xffb3('0x55')];var _0x194ce1=_0x5435c9[_0xffb3('0x57')](-0x1);if(_0x194ce1==='/'){_0x5435c9=_0x5435c9[_0xffb3('0x58')](0x0,_0x5435c9[_0xffb3('0x59')](_0x194ce1));}return rp({'method':_0xffb3('0x5a'),'uri':util[_0xffb3('0x5b')](_0xffb3('0x5c'),_0x5435c9,_0xffb3('0x5d')),'headers':{'Authorization':util[_0xffb3('0x5b')](_0xffb3('0x5e'),new Buffer(util[_0xffb3('0x5b')](_0xffb3('0x5f'),_0x518077[_0xffb3('0x56')]))[_0xffb3('0x60')](_0xffb3('0x61')))},'json':!![]});}})[_0xffb3('0x27')](function(_0x3d28de){if(_0x3d28de){var _0x12ff08=[_0xffb3('0x62'),_0xffb3('0x63'),_0xffb3('0x64'),_0xffb3('0x65'),_0xffb3('0x1b'),_0xffb3('0x66'),_0xffb3('0x67'),'source','ticket_type',_0xffb3('0x67'),_0xffb3('0x68')];_['remove'](_0x3d28de,function(_0x55b68e){return _0x12ff08[_0xffb3('0x69')](_0x55b68e[_0xffb3('0x2a')])||!_0x55b68e['default']&&_0x55b68e[_0xffb3('0x2e')]!==_0xffb3('0x6a')&&_0x55b68e['type']!==_0xffb3('0x6b');});return{'count':_0x3d28de[_0xffb3('0x37')],'rows':_[_0xffb3('0x30')](_0x3d28de,function(_0x29b846){return{'id':_0x29b846[_0xffb3('0x2a')],'name':_0x29b846[_0xffb3('0x6c')],'custom':!_0x29b846[_0xffb3('0x6d')],'options':_0x29b846['choices']?_['map'](_0x29b846[_0xffb3('0x6e')],function(_0x14b3b1){return{'name':_[_0xffb3('0x6f')](_0x14b3b1),'value':_0x14b3b1};}):[]};})};}})[_0xffb3('0x27')](respondWithResult(_0x17a45c,null))['catch'](function(_0x36e58e){var _0x4676e0=_0x158491[_0xffb3('0x31')][_0xffb3('0x70')]?0x1f4:_0x36e58e['statusCode']||0x1f4;logger[_0xffb3('0x28')](_0xffb3('0x71'),_0xffb3('0x72'),_0x4676e0,JSON[_0xffb3('0x73')](_0x36e58e));delete _0x36e58e['name'];if(_0x4676e0===0x191){_0x4676e0=0x190;}_0x17a45c[_0xffb3('0x1b')](_0x4676e0)[_0xffb3('0x74')](_0x158491[_0xffb3('0x31')][_0xffb3('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x36e58e[_0xffb3('0x75')]}:_0x36e58e);});}; \ No newline at end of file +var _0xaf4c=['priority','group','source','ticket_type','remove','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','FreshdeskAccount','key','query','filters','intersection','model','attributes','fields','length','pick','where','merge','type','VIRTUAL','filter','options','count','include','rows','catch','params','keys','rawAttributes','includeAll','find','create','body','update','getConfigurations','findOne','order','sort','hasOwnProperty','nolimit','addConfiguration','AccountId','getSubjects','channel','getDescriptions','FreshdeskConfiguration','Subjects','FreshdeskField','Descriptions','apiKey','remoteUri','substring','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','subject','agent','description'];(function(_0x5533d4,_0x525249){var _0x4cabd2=function(_0x3a9583){while(--_0x3a9583){_0x5533d4['push'](_0x5533d4['shift']());}};_0x4cabd2(++_0x525249);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0x3aff3a,_0x4dda76){_0x3aff3a=_0x3aff3a-0x0;var _0xe4cb01=_0xaf4c[_0x3aff3a];return _0xe4cb01;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcaf4('0x0'));var zipdir=require(_0xcaf4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcaf4('0x2'));var moment=require(_0xcaf4('0x3'));var BPromise=require(_0xcaf4('0x4'));var Mustache=require('mustache');var util=require(_0xcaf4('0x5'));var path=require(_0xcaf4('0x6'));var sox=require(_0xcaf4('0x7'));var csv=require('to-csv');var ejs=require(_0xcaf4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcaf4('0x9'));var squel=require(_0xcaf4('0xa'));var crypto=require(_0xcaf4('0xb'));var jsforce=require(_0xcaf4('0xc'));var deskjs=require(_0xcaf4('0xd'));var toCsv=require(_0xcaf4('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcaf4('0xf'));var authService=require(_0xcaf4('0x10'));var qs=require(_0xcaf4('0x11'));var as=require(_0xcaf4('0x12'));var hardwareService=require(_0xcaf4('0x13'));var logger=require(_0xcaf4('0x14'))(_0xcaf4('0x15'));var utils=require(_0xcaf4('0x16'));var config=require(_0xcaf4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcaf4('0x18'))['db'];var integrations=require(_0xcaf4('0x19'));function respondWithStatusCode(_0x4d270c,_0x308173){_0x308173=_0x308173||0xcc;return function(_0x36df7b){if(_0x36df7b){return _0x4d270c[_0xcaf4('0x1a')](_0x308173);}return _0x4d270c['status'](_0x308173)[_0xcaf4('0x1b')]();};}function respondWithResult(_0x2ad48b,_0x593c44){_0x593c44=_0x593c44||0xc8;return function(_0x3e33e7){if(_0x3e33e7){return _0x2ad48b['status'](_0x593c44)[_0xcaf4('0x1c')](_0x3e33e7);}};}function respondWithFilteredResult(_0x191f38,_0x67532a){return function(_0x1ec93e){if(_0x1ec93e){var _0x1380f9=typeof _0x67532a[_0xcaf4('0x1d')]==='undefined'&&typeof _0x67532a[_0xcaf4('0x1e')]==='undefined';var _0x31743d=_0x1ec93e['count'];var _0x17e2e6=_0x1380f9?0x0:_0x67532a[_0xcaf4('0x1d')];var _0x3b4967=_0x1380f9?_0x1ec93e['count']:_0x67532a['offset']+_0x67532a[_0xcaf4('0x1e')];var _0x2c9828;if(_0x3b4967>=_0x31743d){_0x3b4967=_0x31743d;_0x2c9828=0xc8;}else{_0x2c9828=0xce;}_0x191f38[_0xcaf4('0x1f')](_0x2c9828);return _0x191f38[_0xcaf4('0x20')](_0xcaf4('0x21'),_0x17e2e6+'-'+_0x3b4967+'/'+_0x31743d)['json'](_0x1ec93e);}return null;};}function patchUpdates(_0x42d129){return function(_0x3ba74d){try{jsonpatch[_0xcaf4('0x22')](_0x3ba74d,_0x42d129,!![]);}catch(_0x58ada1){return BPromise[_0xcaf4('0x23')](_0x58ada1);}return _0x3ba74d[_0xcaf4('0x24')]();};}function saveUpdates(_0x39ff5d,_0x5b6525){return function(_0xaab3f9){if(_0xaab3f9){return _0xaab3f9['update'](_0x39ff5d)[_0xcaf4('0x25')](function(_0x3fb28a){return _0x3fb28a;});}return null;};}function removeEntity(_0x1d9f77,_0x5e4af3){return function(_0x2078d9){if(_0x2078d9){return _0x2078d9[_0xcaf4('0x26')]()[_0xcaf4('0x25')](function(){_0x1d9f77[_0xcaf4('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45f729,_0xf9fe54){return function(_0x47ae06){if(!_0x47ae06){_0x45f729[_0xcaf4('0x1a')](0x194);}return _0x47ae06;};}function handleError(_0x34b464,_0x43c05d){_0x43c05d=_0x43c05d||0x1f4;return function(_0xaf7045){logger[_0xcaf4('0x27')](_0xaf7045[_0xcaf4('0x28')]);if(_0xaf7045[_0xcaf4('0x29')]){delete _0xaf7045['name'];}_0x34b464[_0xcaf4('0x1f')](_0x43c05d)[_0xcaf4('0x2a')](_0xaf7045);};}exports[_0xcaf4('0x2b')]=function(_0x521926,_0x175cec){var _0x201371={},_0x1fca09={},_0x333249={'count':0x0,'rows':[]};var _0xfac767=_[_0xcaf4('0x2c')](db[_0xcaf4('0x2d')]['rawAttributes'],function(_0x8126a7){return{'name':_0x8126a7['fieldName'],'type':_0x8126a7['type'][_0xcaf4('0x2e')]};});_0x1fca09['model']=_[_0xcaf4('0x2c')](_0xfac767,'name');_0x1fca09[_0xcaf4('0x2f')]=_['keys'](_0x521926[_0xcaf4('0x2f')]);_0x1fca09[_0xcaf4('0x30')]=_[_0xcaf4('0x31')](_0x1fca09[_0xcaf4('0x32')],_0x1fca09[_0xcaf4('0x2f')]);_0x201371[_0xcaf4('0x33')]=_[_0xcaf4('0x31')](_0x1fca09[_0xcaf4('0x32')],qs['fields'](_0x521926[_0xcaf4('0x2f')][_0xcaf4('0x34')]));_0x201371[_0xcaf4('0x33')]=_0x201371[_0xcaf4('0x33')][_0xcaf4('0x35')]?_0x201371['attributes']:_0x1fca09['model'];if(!_0x521926['query']['hasOwnProperty']('nolimit')){_0x201371[_0xcaf4('0x1e')]=qs[_0xcaf4('0x1e')](_0x521926[_0xcaf4('0x2f')]['limit']);_0x201371[_0xcaf4('0x1d')]=qs[_0xcaf4('0x1d')](_0x521926[_0xcaf4('0x2f')][_0xcaf4('0x1d')]);}_0x201371['order']=qs['sort'](_0x521926['query']['sort']);_0x201371['where']=qs[_0xcaf4('0x30')](_[_0xcaf4('0x36')](_0x521926['query'],_0x1fca09[_0xcaf4('0x30')]),_0xfac767);if(_0x521926[_0xcaf4('0x2f')]['filter']){_0x201371[_0xcaf4('0x37')]=_[_0xcaf4('0x38')](_0x201371[_0xcaf4('0x37')],{'$or':_['map'](_0xfac767,function(_0x4b8f50){if(_0x4b8f50[_0xcaf4('0x39')]!==_0xcaf4('0x3a')){var _0x2e554a={};_0x2e554a[_0x4b8f50[_0xcaf4('0x29')]]={'$like':'%'+_0x521926['query'][_0xcaf4('0x3b')]+'%'};return _0x2e554a;}})});}_0x201371=_[_0xcaf4('0x38')]({},_0x201371,_0x521926[_0xcaf4('0x3c')]);var _0x53655b={'where':_0x201371[_0xcaf4('0x37')]};return db[_0xcaf4('0x2d')][_0xcaf4('0x3d')](_0x53655b)[_0xcaf4('0x25')](function(_0x3ad6b5){_0x333249[_0xcaf4('0x3d')]=_0x3ad6b5;if(_0x521926['query']['includeAll']){_0x201371[_0xcaf4('0x3e')]=[{'all':!![]}];}return db[_0xcaf4('0x2d')]['findAll'](_0x201371);})[_0xcaf4('0x25')](function(_0xf6f3e7){_0x333249[_0xcaf4('0x3f')]=_0xf6f3e7;return _0x333249;})[_0xcaf4('0x25')](respondWithFilteredResult(_0x175cec,_0x201371))[_0xcaf4('0x40')](handleError(_0x175cec,null));};exports['show']=function(_0x2597b9,_0x24800e){var _0x340566={'raw':![],'where':{'id':_0x2597b9[_0xcaf4('0x41')]['id']}},_0x1c0abe={};_0x1c0abe['model']=_[_0xcaf4('0x42')](db[_0xcaf4('0x2d')][_0xcaf4('0x43')]);_0x1c0abe['query']=_[_0xcaf4('0x42')](_0x2597b9[_0xcaf4('0x2f')]);_0x1c0abe['filters']=_[_0xcaf4('0x31')](_0x1c0abe[_0xcaf4('0x32')],_0x1c0abe[_0xcaf4('0x2f')]);_0x340566['attributes']=_[_0xcaf4('0x31')](_0x1c0abe[_0xcaf4('0x32')],qs[_0xcaf4('0x34')](_0x2597b9[_0xcaf4('0x2f')][_0xcaf4('0x34')]));_0x340566[_0xcaf4('0x33')]=_0x340566[_0xcaf4('0x33')]['length']?_0x340566[_0xcaf4('0x33')]:_0x1c0abe[_0xcaf4('0x32')];if(_0x2597b9[_0xcaf4('0x2f')][_0xcaf4('0x44')]){_0x340566[_0xcaf4('0x3e')]=[{'all':!![]}];}_0x340566=_[_0xcaf4('0x38')]({},_0x340566,_0x2597b9[_0xcaf4('0x3c')]);return db[_0xcaf4('0x2d')][_0xcaf4('0x45')](_0x340566)['then'](handleEntityNotFound(_0x24800e,null))['then'](respondWithResult(_0x24800e,null))[_0xcaf4('0x40')](handleError(_0x24800e,null));};exports[_0xcaf4('0x46')]=function(_0x40179c,_0x451f1e){return db['FreshdeskAccount']['create'](_0x40179c[_0xcaf4('0x47')],{})[_0xcaf4('0x25')](respondWithResult(_0x451f1e,0xc9))['catch'](handleError(_0x451f1e,null));};exports[_0xcaf4('0x48')]=function(_0x37a2ba,_0x17f030){if(_0x37a2ba[_0xcaf4('0x47')]['id']){delete _0x37a2ba[_0xcaf4('0x47')]['id'];}return db[_0xcaf4('0x2d')][_0xcaf4('0x45')]({'where':{'id':_0x37a2ba[_0xcaf4('0x41')]['id']}})['then'](handleEntityNotFound(_0x17f030,null))['then'](saveUpdates(_0x37a2ba[_0xcaf4('0x47')],null))[_0xcaf4('0x25')](respondWithResult(_0x17f030,null))[_0xcaf4('0x40')](handleError(_0x17f030,null));};exports['destroy']=function(_0x29ca80,_0x2d35be){return db['FreshdeskAccount'][_0xcaf4('0x45')]({'where':{'id':_0x29ca80[_0xcaf4('0x41')]['id']}})[_0xcaf4('0x25')](handleEntityNotFound(_0x2d35be,null))[_0xcaf4('0x25')](removeEntity(_0x2d35be,null))[_0xcaf4('0x40')](handleError(_0x2d35be,null));};exports[_0xcaf4('0x49')]=function(_0x4edf31,_0x336ba8,_0x3b93e4){var _0x4c0b37={};var _0x1983dc={};var _0x5ce637;var _0x51c928;return db['FreshdeskAccount'][_0xcaf4('0x4a')]({'where':{'id':_0x4edf31[_0xcaf4('0x41')]['id']}})[_0xcaf4('0x25')](handleEntityNotFound(_0x336ba8,null))[_0xcaf4('0x25')](function(_0x35de1f){if(_0x35de1f){_0x5ce637=_0x35de1f;_0x1983dc[_0xcaf4('0x32')]=_['keys'](db['FreshdeskConfiguration'][_0xcaf4('0x43')]);_0x1983dc[_0xcaf4('0x2f')]=_['keys'](_0x4edf31[_0xcaf4('0x2f')]);_0x1983dc[_0xcaf4('0x30')]=_[_0xcaf4('0x31')](_0x1983dc[_0xcaf4('0x32')],_0x1983dc[_0xcaf4('0x2f')]);_0x4c0b37[_0xcaf4('0x33')]=_['intersection'](_0x1983dc[_0xcaf4('0x32')],qs['fields'](_0x4edf31['query'][_0xcaf4('0x34')]));_0x4c0b37['attributes']=_0x4c0b37[_0xcaf4('0x33')]['length']?_0x4c0b37[_0xcaf4('0x33')]:_0x1983dc[_0xcaf4('0x32')];_0x4c0b37[_0xcaf4('0x4b')]=qs['sort'](_0x4edf31[_0xcaf4('0x2f')][_0xcaf4('0x4c')]);_0x4c0b37[_0xcaf4('0x37')]=qs[_0xcaf4('0x30')](_[_0xcaf4('0x36')](_0x4edf31[_0xcaf4('0x2f')],_0x1983dc[_0xcaf4('0x30')]));if(_0x4edf31[_0xcaf4('0x2f')][_0xcaf4('0x3b')]){_0x4c0b37['where']=_[_0xcaf4('0x38')](_0x4c0b37['where'],{'$or':_[_0xcaf4('0x2c')](_0x4c0b37[_0xcaf4('0x33')],function(_0x3e6641){var _0x136f75={};_0x136f75[_0x3e6641]={'$like':'%'+_0x4edf31[_0xcaf4('0x2f')][_0xcaf4('0x3b')]+'%'};return _0x136f75;})});}_0x4c0b37=_[_0xcaf4('0x38')]({},_0x4c0b37,_0x4edf31[_0xcaf4('0x3c')]);return _0x5ce637['getConfigurations'](_0x4c0b37);}})[_0xcaf4('0x25')](function(_0x20448){if(_0x20448){_0x51c928=_0x20448[_0xcaf4('0x35')];if(!_0x4edf31[_0xcaf4('0x2f')][_0xcaf4('0x4d')](_0xcaf4('0x4e'))){_0x4c0b37[_0xcaf4('0x1e')]=qs[_0xcaf4('0x1e')](_0x4edf31['query'][_0xcaf4('0x1e')]);_0x4c0b37[_0xcaf4('0x1d')]=qs[_0xcaf4('0x1d')](_0x4edf31[_0xcaf4('0x2f')][_0xcaf4('0x1d')]);}return _0x5ce637[_0xcaf4('0x49')](_0x4c0b37);}})[_0xcaf4('0x25')](function(_0x2449d8){if(_0x2449d8){return _0x2449d8?{'count':_0x51c928,'rows':_0x2449d8}:null;}})[_0xcaf4('0x25')](respondWithResult(_0x336ba8,null))[_0xcaf4('0x40')](handleError(_0x336ba8,null));};exports[_0xcaf4('0x4f')]=function(_0xee99c4,_0x5e89a8,_0xd39332){if(_0xee99c4[_0xcaf4('0x47')]['id']){delete _0xee99c4[_0xcaf4('0x47')]['id'];}return db[_0xcaf4('0x2d')][_0xcaf4('0x4a')]({'where':{'id':_0xee99c4['params']['id']}})[_0xcaf4('0x25')](handleEntityNotFound(_0x5e89a8,null))[_0xcaf4('0x25')](function(_0x429b7a){if(_0x429b7a){_0xee99c4[_0xcaf4('0x47')][_0xcaf4('0x50')]=_0x429b7a['id'];_0xee99c4['body']['Subjects']=integrations[_0xcaf4('0x51')](_0xee99c4[_0xcaf4('0x47')][_0xcaf4('0x52')],_0xee99c4['body'][_0xcaf4('0x39')]);_0xee99c4[_0xcaf4('0x47')]['Descriptions']=integrations[_0xcaf4('0x53')](_0xee99c4['body'][_0xcaf4('0x52')],_0xee99c4['body'][_0xcaf4('0x39')]);return db[_0xcaf4('0x54')]['create'](_0xee99c4[_0xcaf4('0x47')],{'include':[{'model':db['FreshdeskField'],'as':_0xcaf4('0x55')},{'model':db[_0xcaf4('0x56')],'as':_0xcaf4('0x57')}]});}return null;})['then'](respondWithResult(_0x5e89a8,null))[_0xcaf4('0x40')](handleError(_0x5e89a8,null));};exports['getFields']=function(_0x435b23,_0x58a03f,_0x5a4932){var _0x4d8942='';return db[_0xcaf4('0x2d')][_0xcaf4('0x4a')]({'where':{'id':_0x435b23[_0xcaf4('0x41')]['id']},'attributes':['id','remoteUri',_0xcaf4('0x58')]})[_0xcaf4('0x25')](handleEntityNotFound(_0x58a03f,null))[_0xcaf4('0x25')](function(_0x39b606){if(_0x39b606){_0x4d8942=_0x39b606[_0xcaf4('0x59')];var _0x5c10eb=_0x4d8942['slice'](-0x1);if(_0x5c10eb==='/'){_0x4d8942=_0x4d8942[_0xcaf4('0x5a')](0x0,_0x4d8942[_0xcaf4('0x5b')](_0x5c10eb));}return rp({'method':_0xcaf4('0x5c'),'uri':util[_0xcaf4('0x5d')]('%s/%s',_0x4d8942,_0xcaf4('0x5e')),'headers':{'Authorization':util[_0xcaf4('0x5d')](_0xcaf4('0x5f'),new Buffer(util[_0xcaf4('0x5d')](_0xcaf4('0x60'),_0x39b606['apiKey']))[_0xcaf4('0x61')](_0xcaf4('0x62')))},'json':!![]});}})['then'](function(_0x1775b5){if(_0x1775b5){var _0x492c4e=['requester',_0xcaf4('0x63'),_0xcaf4('0x64'),_0xcaf4('0x65'),_0xcaf4('0x1f'),_0xcaf4('0x66'),_0xcaf4('0x67'),_0xcaf4('0x68'),_0xcaf4('0x69'),_0xcaf4('0x67'),'company'];_[_0xcaf4('0x6a')](_0x1775b5,function(_0x3e9a10){return _0x492c4e['includes'](_0x3e9a10[_0xcaf4('0x29')])||!_0x3e9a10[_0xcaf4('0x6b')]&&_0x3e9a10[_0xcaf4('0x39')]!==_0xcaf4('0x6c')&&_0x3e9a10[_0xcaf4('0x39')]!==_0xcaf4('0x6d');});return{'count':_0x1775b5['length'],'rows':_[_0xcaf4('0x2c')](_0x1775b5,function(_0x33e7b4){return{'id':_0x33e7b4[_0xcaf4('0x29')],'name':_0x33e7b4[_0xcaf4('0x6e')],'custom':!_0x33e7b4['default'],'options':_0x33e7b4['choices']?_[_0xcaf4('0x2c')](_0x33e7b4[_0xcaf4('0x6f')],function(_0x1763ba){return{'name':_[_0xcaf4('0x70')](_0x1763ba),'value':_0x1763ba};}):[]};})};}})[_0xcaf4('0x25')](respondWithResult(_0x58a03f,null))['catch'](function(_0x40ccc5){var _0x5f2acc=_0x435b23[_0xcaf4('0x2f')][_0xcaf4('0x71')]?0x1f4:_0x40ccc5[_0xcaf4('0x72')]||0x1f4;logger['error'](_0xcaf4('0x73'),_0xcaf4('0x74'),_0x5f2acc,JSON[_0xcaf4('0x75')](_0x40ccc5));delete _0x40ccc5[_0xcaf4('0x29')];if(_0x5f2acc===0x191){_0x5f2acc=0x190;}_0x58a03f[_0xcaf4('0x1f')](_0x5f2acc)[_0xcaf4('0x2a')](_0x435b23[_0xcaf4('0x2f')][_0xcaf4('0x71')]?{'message':_0xcaf4('0x76'),'statusCode':_0x40ccc5[_0xcaf4('0x72')]}:_0x40ccc5);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 135f5e7..630fb26 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 _0xc4fc=['FreshdeskAccount','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x3216b5,_0x1c89c7){var _0x3bdf2a=function(_0x39339e){while(--_0x39339e){_0x3216b5['push'](_0x3216b5['shift']());}};_0x3bdf2a(++_0x1c89c7);}(_0xc4fc,0x1a1));var _0xcc4f=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xc4fc[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0xcc4f('0x0'));var util=require(_0xcc4f('0x1'));var logger=require('../../config/logger')(_0xcc4f('0x2'));var moment=require(_0xcc4f('0x3'));var BPromise=require(_0xcc4f('0x4'));var rp=require(_0xcc4f('0x5'));var fs=require('fs');var path=require(_0xcc4f('0x6'));var rimraf=require(_0xcc4f('0x7'));var config=require(_0xcc4f('0x8'));var attributes=require(_0xcc4f('0x9'));var integrations=require(_0xcc4f('0xa'));module[_0xcc4f('0xb')]=function(_0x31fd8b,_0x30122a){return _0x31fd8b['define'](_0xcc4f('0xc'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda46=['rimraf','../../config/environment','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x97d7b3,_0x1e59b4){var _0x4be3d6=function(_0x38dc49){while(--_0x38dc49){_0x97d7b3['push'](_0x97d7b3['shift']());}};_0x4be3d6(++_0x1e59b4);}(_0xda46,0xbc));var _0x6da4=function(_0x3b429b,_0x99efec){_0x3b429b=_0x3b429b-0x0;var _0x503882=_0xda46[_0x3b429b];return _0x503882;};'use strict';var _=require(_0x6da4('0x0'));var util=require(_0x6da4('0x1'));var logger=require(_0x6da4('0x2'))('api');var moment=require(_0x6da4('0x3'));var BPromise=require(_0x6da4('0x4'));var rp=require(_0x6da4('0x5'));var fs=require('fs');var path=require(_0x6da4('0x6'));var rimraf=require(_0x6da4('0x7'));var config=require(_0x6da4('0x8'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x6da4('0x9'));module[_0x6da4('0xa')]=function(_0x4487a4,_0x238f68){return _0x4487a4['define'](_0x6da4('0xb'),attributes,{'tableName':_0x6da4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index cfbdc13..91d9cd6 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 _0xd120=['findAll','options','raw','where','limit','include','model','attributes','map','GetFreshdeskAccount','catch','ShowFreshdeskAccount','find','then','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','FreshdeskAccount'];(function(_0x201c10,_0x322959){var _0x51921f=function(_0x3f3d7d){while(--_0x3f3d7d){_0x201c10['push'](_0x201c10['shift']());}};_0x51921f(++_0x322959);}(_0xd120,0x1b2));var _0x0d12=function(_0x3f1a8a,_0x5e6b68){_0x3f1a8a=_0x3f1a8a-0x0;var _0x3e34da=_0xd120[_0x3f1a8a];return _0x3e34da;};'use strict';var _=require(_0x0d12('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0d12('0x1'));var rs=require(_0x0d12('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d12('0x3'))['db'];var utils=require(_0x0d12('0x4'));var logger=require(_0x0d12('0x5'))(_0x0d12('0x6'));var config=require(_0x0d12('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0d12('0x8')][_0x0d12('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x206bc5,_0xdc27e1,_0x15f344){return new BPromise(function(_0x53c4bf,_0x407741){return client[_0x0d12('0xa')](_0x206bc5,_0x15f344)['then'](function(_0xd47e7){logger['info'](_0x0d12('0xb'),_0xdc27e1,_0x0d12('0xc'));logger[_0x0d12('0xd')](_0x0d12('0xe'),_0xdc27e1,_0x0d12('0xc'),JSON[_0x0d12('0xf')](_0xd47e7));if(_0xd47e7[_0x0d12('0x10')]){if(_0xd47e7['error']['code']===0x1f4){logger[_0x0d12('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0xdc27e1,_0xd47e7[_0x0d12('0x10')]['message']);return _0x407741(_0xd47e7['error'][_0x0d12('0x11')]);}logger[_0x0d12('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0xdc27e1,_0xd47e7[_0x0d12('0x10')][_0x0d12('0x11')]);return _0x53c4bf(_0xd47e7[_0x0d12('0x10')][_0x0d12('0x11')]);}else{logger[_0x0d12('0x12')](_0x0d12('0xb'),_0xdc27e1,_0x0d12('0xc'));_0x53c4bf(_0xd47e7[_0x0d12('0x13')][_0x0d12('0x11')]);}})['catch'](function(_0x24d968){logger['error'](_0x0d12('0xb'),_0xdc27e1,_0x24d968);_0x407741(_0x24d968);});});}exports['GetFreshdeskAccount']=function(_0x17789d){var _0x338702=this;return new Promise(function(_0x3e0487,_0x19ea9d){return db[_0x0d12('0x14')][_0x0d12('0x15')]({'raw':_0x17789d['options']?_0x17789d[_0x0d12('0x16')][_0x0d12('0x17')]===undefined?!![]:![]:!![],'where':_0x17789d[_0x0d12('0x16')]?_0x17789d['options'][_0x0d12('0x18')]||null:null,'attributes':_0x17789d['options']?_0x17789d[_0x0d12('0x16')]['attributes']||null:null,'limit':_0x17789d[_0x0d12('0x16')]?_0x17789d[_0x0d12('0x16')][_0x0d12('0x19')]||null:null,'include':_0x17789d[_0x0d12('0x16')]?_0x17789d[_0x0d12('0x16')]['include']?_['map'](_0x17789d[_0x0d12('0x16')][_0x0d12('0x1a')],function(_0x4a132e){return{'model':db[_0x4a132e[_0x0d12('0x1b')]],'as':_0x4a132e['as'],'attributes':_0x4a132e[_0x0d12('0x1c')],'include':_0x4a132e[_0x0d12('0x1a')]?_[_0x0d12('0x1d')](_0x4a132e[_0x0d12('0x1a')],function(_0x4d30e7){return{'model':db[_0x4d30e7[_0x0d12('0x1b')]],'as':_0x4d30e7['as'],'attributes':_0x4d30e7[_0x0d12('0x1c')],'include':_0x4d30e7[_0x0d12('0x1a')]?_[_0x0d12('0x1d')](_0x4d30e7[_0x0d12('0x1a')],function(_0x48dbbd){return{'model':db[_0x48dbbd[_0x0d12('0x1b')]],'as':_0x48dbbd['as'],'attributes':_0x48dbbd[_0x0d12('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x25793e){logger[_0x0d12('0x12')](_0x0d12('0x1e'),_0x17789d);logger[_0x0d12('0xd')]('GetFreshdeskAccount',_0x17789d,JSON[_0x0d12('0xf')](_0x25793e));_0x3e0487(_0x25793e);})[_0x0d12('0x1f')](function(_0xe39d21){logger['error']('GetFreshdeskAccount',_0xe39d21[_0x0d12('0x11')],_0x17789d);_0x19ea9d(_0x338702[_0x0d12('0x10')](0x1f4,_0xe39d21[_0x0d12('0x11')]));});});};exports[_0x0d12('0x20')]=function(_0x1e0d2f){var _0x1ab694=this;return new Promise(function(_0x3e490f,_0x222e54){return db['FreshdeskAccount'][_0x0d12('0x21')]({'raw':_0x1e0d2f[_0x0d12('0x16')]?_0x1e0d2f['options'][_0x0d12('0x17')]===undefined?!![]:![]:!![],'where':_0x1e0d2f[_0x0d12('0x16')]?_0x1e0d2f[_0x0d12('0x16')]['where']||null:null,'attributes':_0x1e0d2f[_0x0d12('0x16')]?_0x1e0d2f[_0x0d12('0x16')][_0x0d12('0x1c')]||null:null,'include':_0x1e0d2f['options']?_0x1e0d2f[_0x0d12('0x16')][_0x0d12('0x1a')]?_[_0x0d12('0x1d')](_0x1e0d2f[_0x0d12('0x16')][_0x0d12('0x1a')],function(_0x1d9680){return{'model':db[_0x1d9680[_0x0d12('0x1b')]],'as':_0x1d9680['as'],'attributes':_0x1d9680[_0x0d12('0x1c')],'include':_0x1d9680[_0x0d12('0x1a')]?_['map'](_0x1d9680[_0x0d12('0x1a')],function(_0xd6d76d){return{'model':db[_0xd6d76d['model']],'as':_0xd6d76d['as'],'attributes':_0xd6d76d[_0x0d12('0x1c')],'include':_0xd6d76d[_0x0d12('0x1a')]?_[_0x0d12('0x1d')](_0xd6d76d[_0x0d12('0x1a')],function(_0x654841){return{'model':db[_0x654841[_0x0d12('0x1b')]],'as':_0x654841['as'],'attributes':_0x654841[_0x0d12('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0d12('0x22')](function(_0x56003f){logger[_0x0d12('0x12')]('ShowFreshdeskAccount',_0x1e0d2f);logger[_0x0d12('0xd')](_0x0d12('0x20'),_0x1e0d2f,JSON[_0x0d12('0xf')](_0x56003f));_0x3e490f(_0x56003f);})[_0x0d12('0x1f')](function(_0x467b76){logger[_0x0d12('0x10')]('ShowFreshdeskAccount',_0x467b76[_0x0d12('0x11')],_0x1e0d2f);_0x222e54(_0x1ab694[_0x0d12('0x10')](0x1f4,_0x467b76['message']));});});}; \ No newline at end of file +var _0x4294=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','FreshdeskAccount','findAll','options','where','attributes','limit','include','map','model','then','GetFreshdeskAccount','find','raw','ShowFreshdeskAccount','lodash','util','bluebird'];(function(_0x4a41b6,_0x17f8e9){var _0x3cf615=function(_0xd93c34){while(--_0xd93c34){_0x4a41b6['push'](_0x4a41b6['shift']());}};_0x3cf615(++_0x17f8e9);}(_0x4294,0x6c));var _0x4429=function(_0x831451,_0x8f91c4){_0x831451=_0x831451-0x0;var _0x516e67=_0x4294[_0x831451];return _0x516e67;};'use strict';var _=require(_0x4429('0x0'));var util=require(_0x4429('0x1'));var moment=require('moment');var BPromise=require(_0x4429('0x2'));var rs=require(_0x4429('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4429('0x4'))['db'];var utils=require(_0x4429('0x5'));var logger=require(_0x4429('0x6'))(_0x4429('0x7'));var config=require(_0x4429('0x8'));var jayson=require(_0x4429('0x9'));var client=jayson[_0x4429('0xa')][_0x4429('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x424003,_0x193879,_0xb22e26){return new BPromise(function(_0x37a2d2,_0x4bfeed){return client[_0x4429('0xc')](_0x424003,_0xb22e26)['then'](function(_0x4bf788){logger[_0x4429('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x193879,_0x4429('0xe'));logger['debug'](_0x4429('0xf'),_0x193879,'request\x20sent',JSON[_0x4429('0x10')](_0x4bf788));if(_0x4bf788[_0x4429('0x11')]){if(_0x4bf788['error'][_0x4429('0x12')]===0x1f4){logger['error'](_0x4429('0x13'),_0x193879,_0x4bf788[_0x4429('0x11')][_0x4429('0x14')]);return _0x4bfeed(_0x4bf788[_0x4429('0x11')][_0x4429('0x14')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x193879,_0x4bf788['error']['message']);return _0x37a2d2(_0x4bf788[_0x4429('0x11')][_0x4429('0x14')]);}else{logger[_0x4429('0xd')](_0x4429('0x13'),_0x193879,_0x4429('0xe'));_0x37a2d2(_0x4bf788[_0x4429('0x15')]['message']);}})[_0x4429('0x16')](function(_0x47ec79){logger[_0x4429('0x11')](_0x4429('0x13'),_0x193879,_0x47ec79);_0x4bfeed(_0x47ec79);});});}exports['GetFreshdeskAccount']=function(_0x1011ea){var _0x37c450=this;return new Promise(function(_0x1bb127,_0x3c3671){return db[_0x4429('0x17')][_0x4429('0x18')]({'raw':_0x1011ea['options']?_0x1011ea[_0x4429('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1011ea['options']?_0x1011ea['options'][_0x4429('0x1a')]||null:null,'attributes':_0x1011ea[_0x4429('0x19')]?_0x1011ea[_0x4429('0x19')][_0x4429('0x1b')]||null:null,'limit':_0x1011ea['options']?_0x1011ea[_0x4429('0x19')][_0x4429('0x1c')]||null:null,'include':_0x1011ea[_0x4429('0x19')]?_0x1011ea['options']['include']?_['map'](_0x1011ea['options'][_0x4429('0x1d')],function(_0x3acfcc){return{'model':db[_0x3acfcc['model']],'as':_0x3acfcc['as'],'attributes':_0x3acfcc[_0x4429('0x1b')],'include':_0x3acfcc[_0x4429('0x1d')]?_[_0x4429('0x1e')](_0x3acfcc['include'],function(_0x295632){return{'model':db[_0x295632['model']],'as':_0x295632['as'],'attributes':_0x295632['attributes'],'include':_0x295632['include']?_[_0x4429('0x1e')](_0x295632[_0x4429('0x1d')],function(_0x573cae){return{'model':db[_0x573cae[_0x4429('0x1f')]],'as':_0x573cae['as'],'attributes':_0x573cae[_0x4429('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4429('0x20')](function(_0x166320){logger[_0x4429('0xd')]('GetFreshdeskAccount',_0x1011ea);logger['debug'](_0x4429('0x21'),_0x1011ea,JSON[_0x4429('0x10')](_0x166320));_0x1bb127(_0x166320);})[_0x4429('0x16')](function(_0x48a868){logger[_0x4429('0x11')](_0x4429('0x21'),_0x48a868['message'],_0x1011ea);_0x3c3671(_0x37c450[_0x4429('0x11')](0x1f4,_0x48a868[_0x4429('0x14')]));});});};exports['ShowFreshdeskAccount']=function(_0x1a30ef){var _0x51a121=this;return new Promise(function(_0x20c5f1,_0x3ae9b9){return db['FreshdeskAccount'][_0x4429('0x22')]({'raw':_0x1a30ef[_0x4429('0x19')]?_0x1a30ef[_0x4429('0x19')][_0x4429('0x23')]===undefined?!![]:![]:!![],'where':_0x1a30ef[_0x4429('0x19')]?_0x1a30ef['options'][_0x4429('0x1a')]||null:null,'attributes':_0x1a30ef[_0x4429('0x19')]?_0x1a30ef[_0x4429('0x19')][_0x4429('0x1b')]||null:null,'include':_0x1a30ef['options']?_0x1a30ef[_0x4429('0x19')]['include']?_['map'](_0x1a30ef[_0x4429('0x19')]['include'],function(_0x49461c){return{'model':db[_0x49461c['model']],'as':_0x49461c['as'],'attributes':_0x49461c[_0x4429('0x1b')],'include':_0x49461c[_0x4429('0x1d')]?_[_0x4429('0x1e')](_0x49461c[_0x4429('0x1d')],function(_0x5ce03c){return{'model':db[_0x5ce03c[_0x4429('0x1f')]],'as':_0x5ce03c['as'],'attributes':_0x5ce03c[_0x4429('0x1b')],'include':_0x5ce03c[_0x4429('0x1d')]?_['map'](_0x5ce03c['include'],function(_0x200941){return{'model':db[_0x200941[_0x4429('0x1f')]],'as':_0x200941['as'],'attributes':_0x200941[_0x4429('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4429('0x20')](function(_0x404bab){logger[_0x4429('0xd')](_0x4429('0x24'),_0x1a30ef);logger['debug']('ShowFreshdeskAccount',_0x1a30ef,JSON[_0x4429('0x10')](_0x404bab));_0x20c5f1(_0x404bab);})[_0x4429('0x16')](function(_0x499a85){logger['error'](_0x4429('0x24'),_0x499a85[_0x4429('0x14')],_0x1a30ef);_0x3ae9b9(_0x51a121[_0x4429('0x11')](0x1f4,_0x499a85[_0x4429('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 2824944..08c2c1d 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 _0xf5cd=['update','delete','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id/tags','setTags','put'];(function(_0x408fe0,_0x2b49c0){var _0x21b8b1=function(_0x57158a){while(--_0x57158a){_0x408fe0['push'](_0x408fe0['shift']());}};_0x21b8b1(++_0x2b49c0);}(_0xf5cd,0x11d));var _0xdf5c=function(_0x5eea31,_0x22be88){_0x5eea31=_0x5eea31-0x0;var _0x4a7db2=_0xf5cd[_0x5eea31];return _0x4a7db2;};'use strict';var multer=require(_0xdf5c('0x0'));var util=require(_0xdf5c('0x1'));var path=require(_0xdf5c('0x2'));var timeout=require('connect-timeout');var express=require(_0xdf5c('0x3'));var router=express[_0xdf5c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdf5c('0x5'));var interaction=require(_0xdf5c('0x6'));var config=require(_0xdf5c('0x7'));var controller=require(_0xdf5c('0x8'));router[_0xdf5c('0x9')]('/',auth[_0xdf5c('0xa')](),controller['index']);router['get']('/:id',auth[_0xdf5c('0xa')](),controller[_0xdf5c('0xb')]);router[_0xdf5c('0x9')](_0xdf5c('0xc'),auth['isAuthenticated'](),controller[_0xdf5c('0xd')]);router[_0xdf5c('0x9')](_0xdf5c('0xe'),auth[_0xdf5c('0xa')](),controller[_0xdf5c('0xf')]);router[_0xdf5c('0x9')](_0xdf5c('0x10'),auth[_0xdf5c('0xa')](),controller[_0xdf5c('0x11')]);router['get']('/:id/tags',auth[_0xdf5c('0xa')](),controller['getTags']);router[_0xdf5c('0x12')]('/',auth[_0xdf5c('0xa')](),controller[_0xdf5c('0x13')]);router[_0xdf5c('0x12')](_0xdf5c('0x14'),auth[_0xdf5c('0xa')](),controller[_0xdf5c('0x15')]);router[_0xdf5c('0x16')]('/:id',auth[_0xdf5c('0xa')](),controller[_0xdf5c('0x17')]);router[_0xdf5c('0x18')](_0xdf5c('0x19'),auth[_0xdf5c('0xa')](),controller[_0xdf5c('0x1a')]);module[_0xdf5c('0x1b')]=router; \ No newline at end of file +var _0x7be1=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','show','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5156e9,_0xed3375){var _0x31f40b=function(_0x301b1d){while(--_0x301b1d){_0x5156e9['push'](_0x5156e9['shift']());}};_0x31f40b(++_0xed3375);}(_0x7be1,0x9b));var _0x17be=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x7be1[_0xe73080];return _0x12cbc4;};'use strict';var multer=require(_0x17be('0x0'));var util=require(_0x17be('0x1'));var path=require(_0x17be('0x2'));var timeout=require(_0x17be('0x3'));var express=require(_0x17be('0x4'));var router=express[_0x17be('0x5')]();var fs_extra=require(_0x17be('0x6'));var auth=require(_0x17be('0x7'));var interaction=require(_0x17be('0x8'));var config=require(_0x17be('0x9'));var controller=require(_0x17be('0xa'));router['get']('/',auth[_0x17be('0xb')](),controller[_0x17be('0xc')]);router[_0x17be('0xd')]('/:id',auth[_0x17be('0xb')](),controller[_0x17be('0xe')]);router[_0x17be('0xd')]('/:id/fields',auth[_0x17be('0xb')](),controller[_0x17be('0xf')]);router[_0x17be('0xd')]('/:id/subjects',auth[_0x17be('0xb')](),controller[_0x17be('0x10')]);router[_0x17be('0xd')](_0x17be('0x11'),auth[_0x17be('0xb')](),controller[_0x17be('0x12')]);router[_0x17be('0xd')](_0x17be('0x13'),auth[_0x17be('0xb')](),controller[_0x17be('0x14')]);router[_0x17be('0x15')]('/',auth['isAuthenticated'](),controller[_0x17be('0x16')]);router['post'](_0x17be('0x13'),auth[_0x17be('0xb')](),controller['setTags']);router['put'](_0x17be('0x17'),auth[_0x17be('0xb')](),controller['update']);router[_0x17be('0x18')](_0x17be('0x17'),auth[_0x17be('0xb')](),controller[_0x17be('0x19')]);module[_0x17be('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index a97e810..976e732 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 _0x1240=['exports','STRING'];(function(_0x561276,_0x2240ae){var _0x389c84=function(_0x4c1b6b){while(--_0x4c1b6b){_0x561276['push'](_0x561276['shift']());}};_0x389c84(++_0x2240ae);}(_0x1240,0xc4));var _0x0124=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x1240[_0x7e2eb0];return _0xd92de4;};'use strict';var Sequelize=require('sequelize');module[_0x0124('0x0')]={'name':{'type':Sequelize[_0x0124('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8d96=['STRING','sequelize'];(function(_0x579313,_0x167518){var _0xddbae0=function(_0x20ded7){while(--_0x20ded7){_0x579313['push'](_0x579313['shift']());}};_0xddbae0(++_0x167518);}(_0x8d96,0x1cb));var _0x68d9=function(_0x118986,_0x2ea044){_0x118986=_0x118986-0x0;var _0x25c9e6=_0x8d96[_0x118986];return _0x25c9e6;};'use strict';var Sequelize=require(_0x68d9('0x0'));module['exports']={'name':{'type':Sequelize[_0x68d9('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 33ddbb3..8476f11 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 _0x3981=['limit','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','FreshdeskConfiguration','findAll','rows','catch','show','params','length','include','find','create','body','getFields','findOne','FreshdeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','offset','undefined','count'];(function(_0x569d47,_0x26ccc6){var _0x50f14f=function(_0x54f9bc){while(--_0x54f9bc){_0x569d47['push'](_0x569d47['shift']());}};_0x50f14f(++_0x26ccc6);}(_0x3981,0x8c));var _0x1398=function(_0x2b708a,_0x153cc4){_0x2b708a=_0x2b708a-0x0;var _0x1523d4=_0x3981[_0x2b708a];return _0x1523d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1398('0x0'));var zipdir=require(_0x1398('0x1'));var jsonpatch=require(_0x1398('0x2'));var rp=require(_0x1398('0x3'));var moment=require('moment');var BPromise=require(_0x1398('0x4'));var Mustache=require(_0x1398('0x5'));var util=require(_0x1398('0x6'));var path=require(_0x1398('0x7'));var sox=require('sox');var csv=require(_0x1398('0x8'));var ejs=require(_0x1398('0x9'));var fs=require('fs');var fs_extra=require(_0x1398('0xa'));var _=require(_0x1398('0xb'));var squel=require(_0x1398('0xc'));var crypto=require(_0x1398('0xd'));var jsforce=require(_0x1398('0xe'));var deskjs=require(_0x1398('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1398('0x10'));var Papa=require(_0x1398('0x11'));var Redis=require(_0x1398('0x12'));var authService=require(_0x1398('0x13'));var qs=require(_0x1398('0x14'));var as=require(_0x1398('0x15'));var hardwareService=require(_0x1398('0x16'));var logger=require(_0x1398('0x17'))(_0x1398('0x18'));var utils=require(_0x1398('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1398('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x409c07,_0x40873d){_0x40873d=_0x40873d||0xcc;return function(_0xb7dbe5){if(_0xb7dbe5){return _0x409c07['sendStatus'](_0x40873d);}return _0x409c07[_0x1398('0x1b')](_0x40873d)[_0x1398('0x1c')]();};}function respondWithResult(_0x58c2a8,_0x430e61){_0x430e61=_0x430e61||0xc8;return function(_0x2a430b){if(_0x2a430b){return _0x58c2a8['status'](_0x430e61)['json'](_0x2a430b);}};}function respondWithFilteredResult(_0x27f167,_0x14d6ad){return function(_0x1c31de){if(_0x1c31de){var _0xbdceb4=typeof _0x14d6ad[_0x1398('0x1d')]===_0x1398('0x1e')&&typeof _0x14d6ad['limit']==='undefined';var _0x19115a=_0x1c31de[_0x1398('0x1f')];var _0x27db72=_0xbdceb4?0x0:_0x14d6ad[_0x1398('0x1d')];var _0x2735d1=_0xbdceb4?_0x1c31de[_0x1398('0x1f')]:_0x14d6ad[_0x1398('0x1d')]+_0x14d6ad[_0x1398('0x20')];var _0x3d8418;if(_0x2735d1>=_0x19115a){_0x2735d1=_0x19115a;_0x3d8418=0xc8;}else{_0x3d8418=0xce;}_0x27f167[_0x1398('0x1b')](_0x3d8418);return _0x27f167[_0x1398('0x21')](_0x1398('0x22'),_0x27db72+'-'+_0x2735d1+'/'+_0x19115a)[_0x1398('0x23')](_0x1c31de);}return null;};}function patchUpdates(_0x531c57){return function(_0x2f7ca8){try{jsonpatch['apply'](_0x2f7ca8,_0x531c57,!![]);}catch(_0x149468){return BPromise[_0x1398('0x24')](_0x149468);}return _0x2f7ca8[_0x1398('0x25')]();};}function saveUpdates(_0x4a222e,_0x2cc389){return function(_0x4f7091){if(_0x4f7091){return _0x4f7091[_0x1398('0x26')](_0x4a222e)[_0x1398('0x27')](function(_0x419816){return _0x419816;});}return null;};}function removeEntity(_0x3ca790,_0x1697ba){return function(_0x402382){if(_0x402382){return _0x402382[_0x1398('0x28')]()[_0x1398('0x27')](function(){_0x3ca790[_0x1398('0x1b')](0xcc)[_0x1398('0x1c')]();});}};}function handleEntityNotFound(_0x7bb45,_0x106742){return function(_0x225d1d){if(!_0x225d1d){_0x7bb45['sendStatus'](0x194);}return _0x225d1d;};}function handleError(_0x141c69,_0x568ad9){_0x568ad9=_0x568ad9||0x1f4;return function(_0x4e8a14){logger[_0x1398('0x29')](_0x4e8a14['stack']);if(_0x4e8a14[_0x1398('0x2a')]){delete _0x4e8a14[_0x1398('0x2a')];}_0x141c69[_0x1398('0x1b')](_0x568ad9)[_0x1398('0x2b')](_0x4e8a14);};}exports[_0x1398('0x2c')]=function(_0x531893,_0x402695){var _0xd844f0={},_0x12ce83={},_0x2bb67d={'count':0x0,'rows':[]};var _0x200816=_[_0x1398('0x2d')](db['FreshdeskConfiguration'][_0x1398('0x2e')],function(_0x344b27){return{'name':_0x344b27['fieldName'],'type':_0x344b27[_0x1398('0x2f')][_0x1398('0x30')]};});_0x12ce83[_0x1398('0x31')]=_['map'](_0x200816,_0x1398('0x2a'));_0x12ce83['query']=_[_0x1398('0x32')](_0x531893[_0x1398('0x33')]);_0x12ce83[_0x1398('0x34')]=_[_0x1398('0x35')](_0x12ce83[_0x1398('0x31')],_0x12ce83[_0x1398('0x33')]);_0xd844f0['attributes']=_[_0x1398('0x35')](_0x12ce83['model'],qs[_0x1398('0x36')](_0x531893[_0x1398('0x33')]['fields']));_0xd844f0[_0x1398('0x37')]=_0xd844f0[_0x1398('0x37')]['length']?_0xd844f0[_0x1398('0x37')]:_0x12ce83['model'];if(!_0x531893[_0x1398('0x33')]['hasOwnProperty'](_0x1398('0x38'))){_0xd844f0[_0x1398('0x20')]=qs['limit'](_0x531893[_0x1398('0x33')]['limit']);_0xd844f0[_0x1398('0x1d')]=qs['offset'](_0x531893[_0x1398('0x33')][_0x1398('0x1d')]);}_0xd844f0[_0x1398('0x39')]=qs['sort'](_0x531893[_0x1398('0x33')][_0x1398('0x3a')]);_0xd844f0[_0x1398('0x3b')]=qs[_0x1398('0x34')](_[_0x1398('0x3c')](_0x531893[_0x1398('0x33')],_0x12ce83[_0x1398('0x34')]),_0x200816);if(_0x531893[_0x1398('0x33')][_0x1398('0x3d')]){_0xd844f0[_0x1398('0x3b')]=_[_0x1398('0x3e')](_0xd844f0['where'],{'$or':_[_0x1398('0x2d')](_0x200816,function(_0x2a97d7){if(_0x2a97d7[_0x1398('0x2f')]!==_0x1398('0x3f')){var _0x37a255={};_0x37a255[_0x2a97d7['name']]={'$like':'%'+_0x531893['query'][_0x1398('0x3d')]+'%'};return _0x37a255;}})});}_0xd844f0=_[_0x1398('0x3e')]({},_0xd844f0,_0x531893[_0x1398('0x40')]);var _0x2c4837={'where':_0xd844f0[_0x1398('0x3b')]};return db['FreshdeskConfiguration'][_0x1398('0x1f')](_0x2c4837)[_0x1398('0x27')](function(_0x546682){_0x2bb67d[_0x1398('0x1f')]=_0x546682;if(_0x531893[_0x1398('0x33')][_0x1398('0x41')]){_0xd844f0['include']=[{'all':!![]}];}return db[_0x1398('0x42')][_0x1398('0x43')](_0xd844f0);})['then'](function(_0x472cf4){_0x2bb67d[_0x1398('0x44')]=_0x472cf4;return _0x2bb67d;})[_0x1398('0x27')](respondWithFilteredResult(_0x402695,_0xd844f0))[_0x1398('0x45')](handleError(_0x402695,null));};exports[_0x1398('0x46')]=function(_0x1d6a4e,_0x361d66){var _0x47f984={'raw':![],'where':{'id':_0x1d6a4e[_0x1398('0x47')]['id']}},_0x8f6d0a={};_0x8f6d0a[_0x1398('0x31')]=_['keys'](db[_0x1398('0x42')][_0x1398('0x2e')]);_0x8f6d0a[_0x1398('0x33')]=_[_0x1398('0x32')](_0x1d6a4e['query']);_0x8f6d0a[_0x1398('0x34')]=_[_0x1398('0x35')](_0x8f6d0a[_0x1398('0x31')],_0x8f6d0a[_0x1398('0x33')]);_0x47f984[_0x1398('0x37')]=_[_0x1398('0x35')](_0x8f6d0a['model'],qs[_0x1398('0x36')](_0x1d6a4e['query']['fields']));_0x47f984[_0x1398('0x37')]=_0x47f984[_0x1398('0x37')][_0x1398('0x48')]?_0x47f984[_0x1398('0x37')]:_0x8f6d0a['model'];if(_0x1d6a4e[_0x1398('0x33')][_0x1398('0x41')]){_0x47f984[_0x1398('0x49')]=[{'all':!![]}];}_0x47f984=_[_0x1398('0x3e')]({},_0x47f984,_0x1d6a4e[_0x1398('0x40')]);return db['FreshdeskConfiguration'][_0x1398('0x4a')](_0x47f984)[_0x1398('0x27')](handleEntityNotFound(_0x361d66,null))[_0x1398('0x27')](respondWithResult(_0x361d66,null))['catch'](handleError(_0x361d66,null));};exports['create']=function(_0x273b2d,_0x8477bd){return db[_0x1398('0x42')][_0x1398('0x4b')](_0x273b2d[_0x1398('0x4c')],{})['then'](respondWithResult(_0x8477bd,0xc9))['catch'](handleError(_0x8477bd,null));};exports['update']=function(_0x188831,_0x25cf68){if(_0x188831[_0x1398('0x4c')]['id']){delete _0x188831[_0x1398('0x4c')]['id'];}return db[_0x1398('0x42')][_0x1398('0x4a')]({'where':{'id':_0x188831[_0x1398('0x47')]['id']}})['then'](handleEntityNotFound(_0x25cf68,null))['then'](saveUpdates(_0x188831[_0x1398('0x4c')],null))['then'](respondWithResult(_0x25cf68,null))[_0x1398('0x45')](handleError(_0x25cf68,null));};exports['destroy']=function(_0x26b14e,_0x251aa8){return db[_0x1398('0x42')]['find']({'where':{'id':_0x26b14e[_0x1398('0x47')]['id']}})[_0x1398('0x27')](handleEntityNotFound(_0x251aa8,null))[_0x1398('0x27')](removeEntity(_0x251aa8,null))[_0x1398('0x45')](handleError(_0x251aa8,null));};exports[_0x1398('0x4d')]=function(_0x224d76,_0xc17bdd,_0x468e7e){var _0xdc219b={};var _0x204e87={};var _0x5723eb;var _0x4e5da1;return db[_0x1398('0x42')][_0x1398('0x4e')]({'where':{'id':_0x224d76[_0x1398('0x47')]['id']}})[_0x1398('0x27')](handleEntityNotFound(_0xc17bdd,null))['then'](function(_0x31d05f){if(_0x31d05f){_0x5723eb=_0x31d05f;_0x204e87[_0x1398('0x31')]=_[_0x1398('0x32')](db[_0x1398('0x4f')]['rawAttributes']);_0x204e87[_0x1398('0x33')]=_[_0x1398('0x32')](_0x224d76['query']);_0x204e87['filters']=_[_0x1398('0x35')](_0x204e87['model'],_0x204e87[_0x1398('0x33')]);_0xdc219b['attributes']=_[_0x1398('0x35')](_0x204e87[_0x1398('0x31')],qs[_0x1398('0x36')](_0x224d76[_0x1398('0x33')]['fields']));_0xdc219b[_0x1398('0x37')]=_0xdc219b[_0x1398('0x37')][_0x1398('0x48')]?_0xdc219b['attributes']:_0x204e87['model'];_0xdc219b[_0x1398('0x39')]=qs[_0x1398('0x3a')](_0x224d76['query']['sort']);_0xdc219b[_0x1398('0x3b')]=qs[_0x1398('0x34')](_[_0x1398('0x3c')](_0x224d76[_0x1398('0x33')],_0x204e87[_0x1398('0x34')]));if(_0x224d76[_0x1398('0x33')][_0x1398('0x3d')]){_0xdc219b[_0x1398('0x3b')]=_['merge'](_0xdc219b[_0x1398('0x3b')],{'$or':_['map'](_0xdc219b[_0x1398('0x37')],function(_0x2899cc){var _0xf643b1={};_0xf643b1[_0x2899cc]={'$like':'%'+_0x224d76[_0x1398('0x33')][_0x1398('0x3d')]+'%'};return _0xf643b1;})});}_0xdc219b=_[_0x1398('0x3e')]({},_0xdc219b,_0x224d76[_0x1398('0x40')]);return _0x5723eb[_0x1398('0x4d')](_0xdc219b);}})[_0x1398('0x27')](function(_0xec0cdb){if(_0xec0cdb){_0x4e5da1=_0xec0cdb[_0x1398('0x48')];if(!_0x224d76[_0x1398('0x33')][_0x1398('0x50')](_0x1398('0x38'))){_0xdc219b['limit']=qs['limit'](_0x224d76['query'][_0x1398('0x20')]);_0xdc219b['offset']=qs[_0x1398('0x1d')](_0x224d76[_0x1398('0x33')][_0x1398('0x1d')]);}return _0x5723eb['getFields'](_0xdc219b);}})[_0x1398('0x27')](function(_0x1606b4){if(_0x1606b4){return _0x1606b4?{'count':_0x4e5da1,'rows':_0x1606b4}:null;}})['then'](respondWithResult(_0xc17bdd,null))[_0x1398('0x45')](handleError(_0xc17bdd,null));};exports['getSubjects']=function(_0x5edd2d,_0x58eb7c,_0x146d36){var _0x31f315={};var _0x2a685c={};var _0x352942;var _0x5c46a1;return db[_0x1398('0x42')]['findOne']({'where':{'id':_0x5edd2d[_0x1398('0x47')]['id']}})['then'](handleEntityNotFound(_0x58eb7c,null))[_0x1398('0x27')](function(_0x2fedd0){if(_0x2fedd0){_0x352942=_0x2fedd0;_0x2a685c['model']=_['keys'](db[_0x1398('0x4f')][_0x1398('0x2e')]);_0x2a685c['query']=_[_0x1398('0x32')](_0x5edd2d[_0x1398('0x33')]);_0x2a685c[_0x1398('0x34')]=_['intersection'](_0x2a685c[_0x1398('0x31')],_0x2a685c[_0x1398('0x33')]);_0x31f315[_0x1398('0x37')]=_[_0x1398('0x35')](_0x2a685c['model'],qs[_0x1398('0x36')](_0x5edd2d[_0x1398('0x33')][_0x1398('0x36')]));_0x31f315[_0x1398('0x37')]=_0x31f315[_0x1398('0x37')][_0x1398('0x48')]?_0x31f315['attributes']:_0x2a685c[_0x1398('0x31')];_0x31f315[_0x1398('0x39')]=qs[_0x1398('0x3a')](_0x5edd2d[_0x1398('0x33')][_0x1398('0x3a')]);_0x31f315[_0x1398('0x3b')]=qs['filters'](_[_0x1398('0x3c')](_0x5edd2d[_0x1398('0x33')],_0x2a685c[_0x1398('0x34')]));if(_0x5edd2d[_0x1398('0x33')]['filter']){_0x31f315[_0x1398('0x3b')]=_['merge'](_0x31f315['where'],{'$or':_[_0x1398('0x2d')](_0x31f315[_0x1398('0x37')],function(_0x13de80){var _0x6f6707={};_0x6f6707[_0x13de80]={'$like':'%'+_0x5edd2d[_0x1398('0x33')]['filter']+'%'};return _0x6f6707;})});}_0x31f315=_[_0x1398('0x3e')]({},_0x31f315,_0x5edd2d[_0x1398('0x40')]);return _0x352942[_0x1398('0x51')](_0x31f315);}})['then'](function(_0x812eb1){if(_0x812eb1){_0x5c46a1=_0x812eb1[_0x1398('0x48')];if(!_0x5edd2d[_0x1398('0x33')][_0x1398('0x50')](_0x1398('0x38'))){_0x31f315[_0x1398('0x20')]=qs[_0x1398('0x20')](_0x5edd2d['query'][_0x1398('0x20')]);_0x31f315[_0x1398('0x1d')]=qs[_0x1398('0x1d')](_0x5edd2d[_0x1398('0x33')][_0x1398('0x1d')]);}return _0x352942[_0x1398('0x51')](_0x31f315);}})['then'](function(_0x468d24){if(_0x468d24){return _0x468d24?{'count':_0x5c46a1,'rows':_0x468d24}:null;}})['then'](respondWithResult(_0x58eb7c,null))[_0x1398('0x45')](handleError(_0x58eb7c,null));};exports['getDescriptions']=function(_0x48fefc,_0x480e21,_0x35e8b8){var _0x638759={};var _0x1ae592={};var _0x35e00c;var _0x1f4a8c;return db[_0x1398('0x42')][_0x1398('0x4e')]({'where':{'id':_0x48fefc[_0x1398('0x47')]['id']}})['then'](handleEntityNotFound(_0x480e21,null))[_0x1398('0x27')](function(_0x48f349){if(_0x48f349){_0x35e00c=_0x48f349;_0x1ae592[_0x1398('0x31')]=_[_0x1398('0x32')](db['FreshdeskField']['rawAttributes']);_0x1ae592['query']=_[_0x1398('0x32')](_0x48fefc[_0x1398('0x33')]);_0x1ae592[_0x1398('0x34')]=_['intersection'](_0x1ae592['model'],_0x1ae592['query']);_0x638759[_0x1398('0x37')]=_[_0x1398('0x35')](_0x1ae592[_0x1398('0x31')],qs[_0x1398('0x36')](_0x48fefc[_0x1398('0x33')][_0x1398('0x36')]));_0x638759[_0x1398('0x37')]=_0x638759[_0x1398('0x37')][_0x1398('0x48')]?_0x638759[_0x1398('0x37')]:_0x1ae592[_0x1398('0x31')];_0x638759[_0x1398('0x39')]=qs[_0x1398('0x3a')](_0x48fefc[_0x1398('0x33')][_0x1398('0x3a')]);_0x638759['where']=qs['filters'](_[_0x1398('0x3c')](_0x48fefc[_0x1398('0x33')],_0x1ae592[_0x1398('0x34')]));if(_0x48fefc[_0x1398('0x33')][_0x1398('0x3d')]){_0x638759[_0x1398('0x3b')]=_[_0x1398('0x3e')](_0x638759[_0x1398('0x3b')],{'$or':_[_0x1398('0x2d')](_0x638759[_0x1398('0x37')],function(_0x196891){var _0x5879b8={};_0x5879b8[_0x196891]={'$like':'%'+_0x48fefc['query']['filter']+'%'};return _0x5879b8;})});}_0x638759=_['merge']({},_0x638759,_0x48fefc[_0x1398('0x40')]);return _0x35e00c[_0x1398('0x52')](_0x638759);}})['then'](function(_0xfc386f){if(_0xfc386f){_0x1f4a8c=_0xfc386f[_0x1398('0x48')];if(!_0x48fefc[_0x1398('0x33')]['hasOwnProperty']('nolimit')){_0x638759[_0x1398('0x20')]=qs[_0x1398('0x20')](_0x48fefc[_0x1398('0x33')]['limit']);_0x638759[_0x1398('0x1d')]=qs[_0x1398('0x1d')](_0x48fefc[_0x1398('0x33')][_0x1398('0x1d')]);}return _0x35e00c[_0x1398('0x52')](_0x638759);}})['then'](function(_0x457ab6){if(_0x457ab6){return _0x457ab6?{'count':_0x1f4a8c,'rows':_0x457ab6}:null;}})[_0x1398('0x27')](respondWithResult(_0x480e21,null))[_0x1398('0x45')](handleError(_0x480e21,null));};exports[_0x1398('0x53')]=function(_0x18a685,_0x14886f,_0x1763b7){var _0x352691={};var _0x9a8321={};var _0x223458;var _0x2582b5;return db['FreshdeskConfiguration'][_0x1398('0x4e')]({'where':{'id':_0x18a685[_0x1398('0x47')]['id']}})[_0x1398('0x27')](handleEntityNotFound(_0x14886f,null))[_0x1398('0x27')](function(_0x20f9c7){if(_0x20f9c7){_0x223458=_0x20f9c7;_0x9a8321['model']=_['keys'](db[_0x1398('0x54')][_0x1398('0x2e')]);_0x9a8321['query']=_[_0x1398('0x32')](_0x18a685[_0x1398('0x33')]);_0x9a8321[_0x1398('0x34')]=_[_0x1398('0x35')](_0x9a8321['model'],_0x9a8321[_0x1398('0x33')]);_0x352691[_0x1398('0x37')]=_[_0x1398('0x35')](_0x9a8321[_0x1398('0x31')],qs[_0x1398('0x36')](_0x18a685[_0x1398('0x33')][_0x1398('0x36')]));_0x352691[_0x1398('0x37')]=_0x352691[_0x1398('0x37')]['length']?_0x352691['attributes']:_0x9a8321[_0x1398('0x31')];_0x352691[_0x1398('0x39')]=qs[_0x1398('0x3a')](_0x18a685[_0x1398('0x33')][_0x1398('0x3a')]);_0x352691[_0x1398('0x3b')]=qs[_0x1398('0x34')](_[_0x1398('0x3c')](_0x18a685[_0x1398('0x33')],_0x9a8321[_0x1398('0x34')]));if(_0x18a685[_0x1398('0x33')][_0x1398('0x3d')]){_0x352691['where']=_[_0x1398('0x3e')](_0x352691[_0x1398('0x3b')],{'$or':_['map'](_0x352691['attributes'],function(_0x50a8f2){var _0x1b1633={};_0x1b1633[_0x50a8f2]={'$like':'%'+_0x18a685[_0x1398('0x33')][_0x1398('0x3d')]+'%'};return _0x1b1633;})});}_0x352691=_[_0x1398('0x3e')]({},_0x352691,_0x18a685[_0x1398('0x40')]);return _0x223458[_0x1398('0x53')](_0x352691);}})[_0x1398('0x27')](function(_0x434f2f){if(_0x434f2f){_0x2582b5=_0x434f2f['length'];if(!_0x18a685[_0x1398('0x33')][_0x1398('0x50')](_0x1398('0x38'))){_0x352691[_0x1398('0x20')]=qs[_0x1398('0x20')](_0x18a685[_0x1398('0x33')]['limit']);_0x352691[_0x1398('0x1d')]=qs['offset'](_0x18a685[_0x1398('0x33')][_0x1398('0x1d')]);}return _0x223458[_0x1398('0x53')](_0x352691);}})['then'](function(_0x5b7e67){if(_0x5b7e67){return _0x5b7e67?{'count':_0x2582b5,'rows':_0x5b7e67}:null;}})[_0x1398('0x27')](respondWithResult(_0x14886f,null))[_0x1398('0x45')](handleError(_0x14886f,null));};exports['setTags']=function(_0x1f74ff,_0xaf4cd6,_0x33a106){if(_0x1f74ff[_0x1398('0x4c')]['id']){delete _0x1f74ff[_0x1398('0x4c')]['id'];}return db[_0x1398('0x42')][_0x1398('0x4e')]({'where':{'id':_0x1f74ff[_0x1398('0x47')]['id']}})[_0x1398('0x27')](handleEntityNotFound(_0xaf4cd6,null))[_0x1398('0x27')](function(_0x12e32e){if(_0x12e32e){return _0x12e32e[_0x1398('0x55')](_0x1f74ff[_0x1398('0x4c')]['ids']||[]);}return null;})['then'](respondWithResult(_0xaf4cd6,null))[_0x1398('0x45')](handleError(_0xaf4cd6,null));}; \ No newline at end of file +var _0x7535=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','FreshdeskConfiguration','includeAll','include','findAll','catch','params','find','create','body','getFields','findOne','FreshdeskField','getSubjects','pick','nolimit','getDescriptions','getTags','setTags','ids','eml-format','rimraf','moment','bluebird','path','sox'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7535,0x18f));var _0x5753=function(_0x2b4448,_0x5bcc69){_0x2b4448=_0x2b4448-0x0;var _0xb4b465=_0x7535[_0x2b4448];return _0xb4b465;};'use strict';var emlformat=require(_0x5753('0x0'));var rimraf=require(_0x5753('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5753('0x2'));var BPromise=require(_0x5753('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5753('0x4'));var sox=require(_0x5753('0x5'));var csv=require(_0x5753('0x6'));var ejs=require(_0x5753('0x7'));var fs=require('fs');var fs_extra=require(_0x5753('0x8'));var _=require(_0x5753('0x9'));var squel=require(_0x5753('0xa'));var crypto=require(_0x5753('0xb'));var jsforce=require(_0x5753('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5753('0x6'));var querystring=require(_0x5753('0xd'));var Papa=require('papaparse');var Redis=require(_0x5753('0xe'));var authService=require(_0x5753('0xf'));var qs=require(_0x5753('0x10'));var as=require(_0x5753('0x11'));var hardwareService=require(_0x5753('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x5753('0x13'));var config=require(_0x5753('0x14'));var licenseUtil=require(_0x5753('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c13fc,_0x2188b1){_0x2188b1=_0x2188b1||0xcc;return function(_0x3c0762){if(_0x3c0762){return _0x1c13fc[_0x5753('0x16')](_0x2188b1);}return _0x1c13fc[_0x5753('0x17')](_0x2188b1)[_0x5753('0x18')]();};}function respondWithResult(_0x75b0cf,_0x6841c2){_0x6841c2=_0x6841c2||0xc8;return function(_0x377d9c){if(_0x377d9c){return _0x75b0cf[_0x5753('0x17')](_0x6841c2)[_0x5753('0x19')](_0x377d9c);}};}function respondWithFilteredResult(_0xc2491f,_0x4ec0dd){return function(_0x4ed8d4){if(_0x4ed8d4){var _0xd1dea5=typeof _0x4ec0dd[_0x5753('0x1a')]===_0x5753('0x1b')&&typeof _0x4ec0dd[_0x5753('0x1c')]==='undefined';var _0x5d8e24=_0x4ed8d4[_0x5753('0x1d')];var _0x53a4e8=_0xd1dea5?0x0:_0x4ec0dd['offset'];var _0x260480=_0xd1dea5?_0x4ed8d4[_0x5753('0x1d')]:_0x4ec0dd[_0x5753('0x1a')]+_0x4ec0dd[_0x5753('0x1c')];var _0x3bb61d;if(_0x260480>=_0x5d8e24){_0x260480=_0x5d8e24;_0x3bb61d=0xc8;}else{_0x3bb61d=0xce;}_0xc2491f[_0x5753('0x17')](_0x3bb61d);return _0xc2491f['set'](_0x5753('0x1e'),_0x53a4e8+'-'+_0x260480+'/'+_0x5d8e24)['json'](_0x4ed8d4);}return null;};}function patchUpdates(_0x13848d){return function(_0x467ae4){try{jsonpatch[_0x5753('0x1f')](_0x467ae4,_0x13848d,!![]);}catch(_0x1b3816){return BPromise[_0x5753('0x20')](_0x1b3816);}return _0x467ae4[_0x5753('0x21')]();};}function saveUpdates(_0x5765a9,_0x3e741c){return function(_0x254d2d){if(_0x254d2d){return _0x254d2d[_0x5753('0x22')](_0x5765a9)[_0x5753('0x23')](function(_0x15c827){return _0x15c827;});}return null;};}function removeEntity(_0x3d0518,_0x3f7708){return function(_0x49e910){if(_0x49e910){return _0x49e910[_0x5753('0x24')]()[_0x5753('0x23')](function(){_0x3d0518['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48c012,_0x59e474){return function(_0x373a33){if(!_0x373a33){_0x48c012[_0x5753('0x16')](0x194);}return _0x373a33;};}function handleError(_0x50de6e,_0x1a1e5b){_0x1a1e5b=_0x1a1e5b||0x1f4;return function(_0xff32f){logger[_0x5753('0x25')](_0xff32f[_0x5753('0x26')]);if(_0xff32f[_0x5753('0x27')]){delete _0xff32f[_0x5753('0x27')];}_0x50de6e[_0x5753('0x17')](_0x1a1e5b)[_0x5753('0x28')](_0xff32f);};}exports[_0x5753('0x29')]=function(_0x538d47,_0x439b8f){var _0x169f47={},_0x50b211={},_0x35652f={'count':0x0,'rows':[]};var _0x40c5f4=_[_0x5753('0x2a')](db['FreshdeskConfiguration'][_0x5753('0x2b')],function(_0x442668){return{'name':_0x442668['fieldName'],'type':_0x442668[_0x5753('0x2c')][_0x5753('0x2d')]};});_0x50b211[_0x5753('0x2e')]=_['map'](_0x40c5f4,_0x5753('0x27'));_0x50b211[_0x5753('0x2f')]=_[_0x5753('0x30')](_0x538d47[_0x5753('0x2f')]);_0x50b211[_0x5753('0x31')]=_['intersection'](_0x50b211[_0x5753('0x2e')],_0x50b211['query']);_0x169f47[_0x5753('0x32')]=_[_0x5753('0x33')](_0x50b211[_0x5753('0x2e')],qs[_0x5753('0x34')](_0x538d47[_0x5753('0x2f')][_0x5753('0x34')]));_0x169f47[_0x5753('0x32')]=_0x169f47['attributes'][_0x5753('0x35')]?_0x169f47[_0x5753('0x32')]:_0x50b211[_0x5753('0x2e')];if(!_0x538d47['query'][_0x5753('0x36')]('nolimit')){_0x169f47['limit']=qs[_0x5753('0x1c')](_0x538d47['query'][_0x5753('0x1c')]);_0x169f47['offset']=qs['offset'](_0x538d47['query'][_0x5753('0x1a')]);}_0x169f47[_0x5753('0x37')]=qs[_0x5753('0x38')](_0x538d47[_0x5753('0x2f')][_0x5753('0x38')]);_0x169f47[_0x5753('0x39')]=qs[_0x5753('0x31')](_['pick'](_0x538d47[_0x5753('0x2f')],_0x50b211[_0x5753('0x31')]),_0x40c5f4);if(_0x538d47['query'][_0x5753('0x3a')]){_0x169f47[_0x5753('0x39')]=_[_0x5753('0x3b')](_0x169f47['where'],{'$or':_[_0x5753('0x2a')](_0x40c5f4,function(_0x5c98d8){if(_0x5c98d8[_0x5753('0x2c')]!==_0x5753('0x3c')){var _0x5487ba={};_0x5487ba[_0x5c98d8[_0x5753('0x27')]]={'$like':'%'+_0x538d47[_0x5753('0x2f')][_0x5753('0x3a')]+'%'};return _0x5487ba;}})});}_0x169f47=_[_0x5753('0x3b')]({},_0x169f47,_0x538d47[_0x5753('0x3d')]);var _0x5121db={'where':_0x169f47[_0x5753('0x39')]};return db[_0x5753('0x3e')][_0x5753('0x1d')](_0x5121db)[_0x5753('0x23')](function(_0x7007a){_0x35652f['count']=_0x7007a;if(_0x538d47[_0x5753('0x2f')][_0x5753('0x3f')]){_0x169f47[_0x5753('0x40')]=[{'all':!![]}];}return db[_0x5753('0x3e')][_0x5753('0x41')](_0x169f47);})[_0x5753('0x23')](function(_0x5b2bdd){_0x35652f['rows']=_0x5b2bdd;return _0x35652f;})[_0x5753('0x23')](respondWithFilteredResult(_0x439b8f,_0x169f47))[_0x5753('0x42')](handleError(_0x439b8f,null));};exports['show']=function(_0x27e63a,_0x4981ca){var _0x51572f={'raw':![],'where':{'id':_0x27e63a[_0x5753('0x43')]['id']}},_0x1b256f={};_0x1b256f[_0x5753('0x2e')]=_[_0x5753('0x30')](db[_0x5753('0x3e')]['rawAttributes']);_0x1b256f[_0x5753('0x2f')]=_[_0x5753('0x30')](_0x27e63a[_0x5753('0x2f')]);_0x1b256f[_0x5753('0x31')]=_[_0x5753('0x33')](_0x1b256f[_0x5753('0x2e')],_0x1b256f[_0x5753('0x2f')]);_0x51572f[_0x5753('0x32')]=_[_0x5753('0x33')](_0x1b256f[_0x5753('0x2e')],qs[_0x5753('0x34')](_0x27e63a[_0x5753('0x2f')][_0x5753('0x34')]));_0x51572f['attributes']=_0x51572f[_0x5753('0x32')][_0x5753('0x35')]?_0x51572f[_0x5753('0x32')]:_0x1b256f[_0x5753('0x2e')];if(_0x27e63a['query'][_0x5753('0x3f')]){_0x51572f['include']=[{'all':!![]}];}_0x51572f=_[_0x5753('0x3b')]({},_0x51572f,_0x27e63a['options']);return db[_0x5753('0x3e')][_0x5753('0x44')](_0x51572f)['then'](handleEntityNotFound(_0x4981ca,null))[_0x5753('0x23')](respondWithResult(_0x4981ca,null))[_0x5753('0x42')](handleError(_0x4981ca,null));};exports[_0x5753('0x45')]=function(_0x1e988d,_0x6ff695){return db[_0x5753('0x3e')][_0x5753('0x45')](_0x1e988d['body'],{})[_0x5753('0x23')](respondWithResult(_0x6ff695,0xc9))[_0x5753('0x42')](handleError(_0x6ff695,null));};exports['update']=function(_0x4b4d29,_0x2f38b8){if(_0x4b4d29[_0x5753('0x46')]['id']){delete _0x4b4d29[_0x5753('0x46')]['id'];}return db['FreshdeskConfiguration'][_0x5753('0x44')]({'where':{'id':_0x4b4d29[_0x5753('0x43')]['id']}})[_0x5753('0x23')](handleEntityNotFound(_0x2f38b8,null))[_0x5753('0x23')](saveUpdates(_0x4b4d29[_0x5753('0x46')],null))[_0x5753('0x23')](respondWithResult(_0x2f38b8,null))[_0x5753('0x42')](handleError(_0x2f38b8,null));};exports[_0x5753('0x24')]=function(_0x3ff382,_0x35a35c){return db[_0x5753('0x3e')][_0x5753('0x44')]({'where':{'id':_0x3ff382['params']['id']}})[_0x5753('0x23')](handleEntityNotFound(_0x35a35c,null))[_0x5753('0x23')](removeEntity(_0x35a35c,null))[_0x5753('0x42')](handleError(_0x35a35c,null));};exports[_0x5753('0x47')]=function(_0x2abe1d,_0x139a9b,_0x28feda){var _0xa8934={};var _0x59ba80={};var _0x988b20;var _0x3e5550;return db['FreshdeskConfiguration'][_0x5753('0x48')]({'where':{'id':_0x2abe1d[_0x5753('0x43')]['id']}})[_0x5753('0x23')](handleEntityNotFound(_0x139a9b,null))['then'](function(_0xe935ef){if(_0xe935ef){_0x988b20=_0xe935ef;_0x59ba80[_0x5753('0x2e')]=_[_0x5753('0x30')](db[_0x5753('0x49')][_0x5753('0x2b')]);_0x59ba80[_0x5753('0x2f')]=_[_0x5753('0x30')](_0x2abe1d['query']);_0x59ba80[_0x5753('0x31')]=_[_0x5753('0x33')](_0x59ba80[_0x5753('0x2e')],_0x59ba80[_0x5753('0x2f')]);_0xa8934[_0x5753('0x32')]=_[_0x5753('0x33')](_0x59ba80[_0x5753('0x2e')],qs['fields'](_0x2abe1d[_0x5753('0x2f')][_0x5753('0x34')]));_0xa8934[_0x5753('0x32')]=_0xa8934[_0x5753('0x32')][_0x5753('0x35')]?_0xa8934[_0x5753('0x32')]:_0x59ba80['model'];_0xa8934['order']=qs[_0x5753('0x38')](_0x2abe1d[_0x5753('0x2f')][_0x5753('0x38')]);_0xa8934[_0x5753('0x39')]=qs['filters'](_['pick'](_0x2abe1d[_0x5753('0x2f')],_0x59ba80[_0x5753('0x31')]));if(_0x2abe1d['query'][_0x5753('0x3a')]){_0xa8934[_0x5753('0x39')]=_[_0x5753('0x3b')](_0xa8934['where'],{'$or':_[_0x5753('0x2a')](_0xa8934['attributes'],function(_0x2bda1d){var _0x33571a={};_0x33571a[_0x2bda1d]={'$like':'%'+_0x2abe1d[_0x5753('0x2f')]['filter']+'%'};return _0x33571a;})});}_0xa8934=_['merge']({},_0xa8934,_0x2abe1d[_0x5753('0x3d')]);return _0x988b20[_0x5753('0x47')](_0xa8934);}})[_0x5753('0x23')](function(_0x3c28c4){if(_0x3c28c4){_0x3e5550=_0x3c28c4['length'];if(!_0x2abe1d[_0x5753('0x2f')][_0x5753('0x36')]('nolimit')){_0xa8934[_0x5753('0x1c')]=qs[_0x5753('0x1c')](_0x2abe1d[_0x5753('0x2f')][_0x5753('0x1c')]);_0xa8934[_0x5753('0x1a')]=qs['offset'](_0x2abe1d['query'][_0x5753('0x1a')]);}return _0x988b20[_0x5753('0x47')](_0xa8934);}})[_0x5753('0x23')](function(_0x904a52){if(_0x904a52){return _0x904a52?{'count':_0x3e5550,'rows':_0x904a52}:null;}})[_0x5753('0x23')](respondWithResult(_0x139a9b,null))[_0x5753('0x42')](handleError(_0x139a9b,null));};exports[_0x5753('0x4a')]=function(_0x2cc331,_0x5047ba,_0x128b4a){var _0x362bc2={};var _0x231829={};var _0x19caea;var _0x7a84f3;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x2cc331[_0x5753('0x43')]['id']}})[_0x5753('0x23')](handleEntityNotFound(_0x5047ba,null))['then'](function(_0x4b84ac){if(_0x4b84ac){_0x19caea=_0x4b84ac;_0x231829[_0x5753('0x2e')]=_[_0x5753('0x30')](db[_0x5753('0x49')][_0x5753('0x2b')]);_0x231829[_0x5753('0x2f')]=_[_0x5753('0x30')](_0x2cc331['query']);_0x231829[_0x5753('0x31')]=_['intersection'](_0x231829[_0x5753('0x2e')],_0x231829[_0x5753('0x2f')]);_0x362bc2[_0x5753('0x32')]=_['intersection'](_0x231829[_0x5753('0x2e')],qs['fields'](_0x2cc331[_0x5753('0x2f')]['fields']));_0x362bc2['attributes']=_0x362bc2[_0x5753('0x32')][_0x5753('0x35')]?_0x362bc2[_0x5753('0x32')]:_0x231829['model'];_0x362bc2['order']=qs['sort'](_0x2cc331[_0x5753('0x2f')][_0x5753('0x38')]);_0x362bc2[_0x5753('0x39')]=qs[_0x5753('0x31')](_[_0x5753('0x4b')](_0x2cc331[_0x5753('0x2f')],_0x231829['filters']));if(_0x2cc331['query'][_0x5753('0x3a')]){_0x362bc2[_0x5753('0x39')]=_[_0x5753('0x3b')](_0x362bc2[_0x5753('0x39')],{'$or':_['map'](_0x362bc2[_0x5753('0x32')],function(_0x123b59){var _0x23692c={};_0x23692c[_0x123b59]={'$like':'%'+_0x2cc331[_0x5753('0x2f')][_0x5753('0x3a')]+'%'};return _0x23692c;})});}_0x362bc2=_[_0x5753('0x3b')]({},_0x362bc2,_0x2cc331['options']);return _0x19caea[_0x5753('0x4a')](_0x362bc2);}})[_0x5753('0x23')](function(_0x49c0e1){if(_0x49c0e1){_0x7a84f3=_0x49c0e1[_0x5753('0x35')];if(!_0x2cc331['query'][_0x5753('0x36')](_0x5753('0x4c'))){_0x362bc2[_0x5753('0x1c')]=qs['limit'](_0x2cc331[_0x5753('0x2f')][_0x5753('0x1c')]);_0x362bc2[_0x5753('0x1a')]=qs['offset'](_0x2cc331[_0x5753('0x2f')][_0x5753('0x1a')]);}return _0x19caea['getSubjects'](_0x362bc2);}})[_0x5753('0x23')](function(_0x4b0a94){if(_0x4b0a94){return _0x4b0a94?{'count':_0x7a84f3,'rows':_0x4b0a94}:null;}})[_0x5753('0x23')](respondWithResult(_0x5047ba,null))[_0x5753('0x42')](handleError(_0x5047ba,null));};exports[_0x5753('0x4d')]=function(_0x52ad9d,_0x7b699e,_0x23cf50){var _0x38bf3b={};var _0x2b8e73={};var _0x23242e;var _0x4079ed;return db[_0x5753('0x3e')][_0x5753('0x48')]({'where':{'id':_0x52ad9d['params']['id']}})[_0x5753('0x23')](handleEntityNotFound(_0x7b699e,null))[_0x5753('0x23')](function(_0x25ea03){if(_0x25ea03){_0x23242e=_0x25ea03;_0x2b8e73[_0x5753('0x2e')]=_[_0x5753('0x30')](db[_0x5753('0x49')][_0x5753('0x2b')]);_0x2b8e73['query']=_['keys'](_0x52ad9d[_0x5753('0x2f')]);_0x2b8e73[_0x5753('0x31')]=_[_0x5753('0x33')](_0x2b8e73['model'],_0x2b8e73[_0x5753('0x2f')]);_0x38bf3b[_0x5753('0x32')]=_[_0x5753('0x33')](_0x2b8e73[_0x5753('0x2e')],qs['fields'](_0x52ad9d[_0x5753('0x2f')][_0x5753('0x34')]));_0x38bf3b[_0x5753('0x32')]=_0x38bf3b[_0x5753('0x32')][_0x5753('0x35')]?_0x38bf3b['attributes']:_0x2b8e73[_0x5753('0x2e')];_0x38bf3b[_0x5753('0x37')]=qs[_0x5753('0x38')](_0x52ad9d['query'][_0x5753('0x38')]);_0x38bf3b[_0x5753('0x39')]=qs[_0x5753('0x31')](_[_0x5753('0x4b')](_0x52ad9d[_0x5753('0x2f')],_0x2b8e73['filters']));if(_0x52ad9d[_0x5753('0x2f')][_0x5753('0x3a')]){_0x38bf3b[_0x5753('0x39')]=_[_0x5753('0x3b')](_0x38bf3b[_0x5753('0x39')],{'$or':_[_0x5753('0x2a')](_0x38bf3b[_0x5753('0x32')],function(_0x5acf94){var _0x218879={};_0x218879[_0x5acf94]={'$like':'%'+_0x52ad9d['query']['filter']+'%'};return _0x218879;})});}_0x38bf3b=_[_0x5753('0x3b')]({},_0x38bf3b,_0x52ad9d[_0x5753('0x3d')]);return _0x23242e[_0x5753('0x4d')](_0x38bf3b);}})[_0x5753('0x23')](function(_0x113f6b){if(_0x113f6b){_0x4079ed=_0x113f6b[_0x5753('0x35')];if(!_0x52ad9d['query'][_0x5753('0x36')](_0x5753('0x4c'))){_0x38bf3b[_0x5753('0x1c')]=qs[_0x5753('0x1c')](_0x52ad9d[_0x5753('0x2f')][_0x5753('0x1c')]);_0x38bf3b[_0x5753('0x1a')]=qs[_0x5753('0x1a')](_0x52ad9d[_0x5753('0x2f')][_0x5753('0x1a')]);}return _0x23242e[_0x5753('0x4d')](_0x38bf3b);}})[_0x5753('0x23')](function(_0x42684c){if(_0x42684c){return _0x42684c?{'count':_0x4079ed,'rows':_0x42684c}:null;}})[_0x5753('0x23')](respondWithResult(_0x7b699e,null))[_0x5753('0x42')](handleError(_0x7b699e,null));};exports[_0x5753('0x4e')]=function(_0x4e53d3,_0x13c353,_0x117280){var _0x51914e={};var _0x1d9051={};var _0x6cd108;var _0x55a9e1;return db[_0x5753('0x3e')][_0x5753('0x48')]({'where':{'id':_0x4e53d3[_0x5753('0x43')]['id']}})[_0x5753('0x23')](handleEntityNotFound(_0x13c353,null))['then'](function(_0x59a48c){if(_0x59a48c){_0x6cd108=_0x59a48c;_0x1d9051[_0x5753('0x2e')]=_['keys'](db['Tag'][_0x5753('0x2b')]);_0x1d9051[_0x5753('0x2f')]=_['keys'](_0x4e53d3[_0x5753('0x2f')]);_0x1d9051[_0x5753('0x31')]=_['intersection'](_0x1d9051[_0x5753('0x2e')],_0x1d9051[_0x5753('0x2f')]);_0x51914e[_0x5753('0x32')]=_['intersection'](_0x1d9051[_0x5753('0x2e')],qs[_0x5753('0x34')](_0x4e53d3[_0x5753('0x2f')][_0x5753('0x34')]));_0x51914e[_0x5753('0x32')]=_0x51914e[_0x5753('0x32')][_0x5753('0x35')]?_0x51914e['attributes']:_0x1d9051['model'];_0x51914e['order']=qs[_0x5753('0x38')](_0x4e53d3[_0x5753('0x2f')][_0x5753('0x38')]);_0x51914e[_0x5753('0x39')]=qs[_0x5753('0x31')](_['pick'](_0x4e53d3[_0x5753('0x2f')],_0x1d9051[_0x5753('0x31')]));if(_0x4e53d3[_0x5753('0x2f')][_0x5753('0x3a')]){_0x51914e[_0x5753('0x39')]=_[_0x5753('0x3b')](_0x51914e[_0x5753('0x39')],{'$or':_[_0x5753('0x2a')](_0x51914e[_0x5753('0x32')],function(_0x119639){var _0x520d74={};_0x520d74[_0x119639]={'$like':'%'+_0x4e53d3[_0x5753('0x2f')]['filter']+'%'};return _0x520d74;})});}_0x51914e=_[_0x5753('0x3b')]({},_0x51914e,_0x4e53d3[_0x5753('0x3d')]);return _0x6cd108[_0x5753('0x4e')](_0x51914e);}})[_0x5753('0x23')](function(_0x1af93b){if(_0x1af93b){_0x55a9e1=_0x1af93b['length'];if(!_0x4e53d3[_0x5753('0x2f')]['hasOwnProperty'](_0x5753('0x4c'))){_0x51914e[_0x5753('0x1c')]=qs['limit'](_0x4e53d3[_0x5753('0x2f')][_0x5753('0x1c')]);_0x51914e[_0x5753('0x1a')]=qs[_0x5753('0x1a')](_0x4e53d3['query'][_0x5753('0x1a')]);}return _0x6cd108[_0x5753('0x4e')](_0x51914e);}})[_0x5753('0x23')](function(_0x2c8120){if(_0x2c8120){return _0x2c8120?{'count':_0x55a9e1,'rows':_0x2c8120}:null;}})['then'](respondWithResult(_0x13c353,null))['catch'](handleError(_0x13c353,null));};exports['setTags']=function(_0x1bab0d,_0x160417,_0x1be7bf){if(_0x1bab0d['body']['id']){delete _0x1bab0d[_0x5753('0x46')]['id'];}return db[_0x5753('0x3e')][_0x5753('0x48')]({'where':{'id':_0x1bab0d[_0x5753('0x43')]['id']}})[_0x5753('0x23')](handleEntityNotFound(_0x160417,null))[_0x5753('0x23')](function(_0x1eb429){if(_0x1eb429){return _0x1eb429[_0x5753('0x4f')](_0x1bab0d[_0x5753('0x46')][_0x5753('0x50')]||[]);}return null;})[_0x5753('0x23')](respondWithResult(_0x160417,null))[_0x5753('0x42')](handleError(_0x160417,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 2478056..840938b 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 _0x9a2f=['request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','api','moment','bluebird'];(function(_0x421eeb,_0x3d3e3e){var _0x2c7371=function(_0x174b74){while(--_0x174b74){_0x421eeb['push'](_0x421eeb['shift']());}};_0x2c7371(++_0x3d3e3e);}(_0x9a2f,0xf7));var _0xf9a2=function(_0xc56a5c,_0x7fbd4c){_0xc56a5c=_0xc56a5c-0x0;var _0x430d99=_0x9a2f[_0xc56a5c];return _0x430d99;};'use strict';var _=require(_0xf9a2('0x0'));var util=require(_0xf9a2('0x1'));var logger=require('../../config/logger')(_0xf9a2('0x2'));var moment=require(_0xf9a2('0x3'));var BPromise=require(_0xf9a2('0x4'));var rp=require(_0xf9a2('0x5'));var fs=require('fs');var path=require(_0xf9a2('0x6'));var rimraf=require('rimraf');var config=require(_0xf9a2('0x7'));var attributes=require(_0xf9a2('0x8'));module[_0xf9a2('0x9')]=function(_0x4405bf,_0x5243f4){return _0x4405bf['define'](_0xf9a2('0xa'),attributes,{'tableName':_0xf9a2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x656e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger'];(function(_0x45d5d3,_0x55183e){var _0x451079=function(_0xf7c87d){while(--_0xf7c87d){_0x45d5d3['push'](_0x45d5d3['shift']());}};_0x451079(++_0x55183e);}(_0x656e,0x9a));var _0xe656=function(_0x4ece58,_0x50922a){_0x4ece58=_0x4ece58-0x0;var _0x20d209=_0x656e[_0x4ece58];return _0x20d209;};'use strict';var _=require(_0xe656('0x0'));var util=require('util');var logger=require(_0xe656('0x1'))(_0xe656('0x2'));var moment=require(_0xe656('0x3'));var BPromise=require(_0xe656('0x4'));var rp=require(_0xe656('0x5'));var fs=require('fs');var path=require(_0xe656('0x6'));var rimraf=require(_0xe656('0x7'));var config=require(_0xe656('0x8'));var attributes=require(_0xe656('0x9'));module['exports']=function(_0x51a419,_0x1a5903){return _0x51a419[_0xe656('0xa')](_0xe656('0xb'),attributes,{'tableName':_0xe656('0xc'),'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 5c0c6cb..4e16755 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 _0x47a0=['http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x5b7665,_0x2eee1a){var _0x32e9c8=function(_0x3f1295){while(--_0x3f1295){_0x5b7665['push'](_0x5b7665['shift']());}};_0x32e9c8(++_0x2eee1a);}(_0x47a0,0xcd));var _0x047a=function(_0x5042e1,_0x294ee7){_0x5042e1=_0x5042e1-0x0;var _0x388a1b=_0x47a0[_0x5042e1];return _0x388a1b;};'use strict';var _=require(_0x047a('0x0'));var util=require('util');var moment=require(_0x047a('0x1'));var BPromise=require(_0x047a('0x2'));var rs=require(_0x047a('0x3'));var fs=require('fs');var Redis=require(_0x047a('0x4'));var db=require(_0x047a('0x5'))['db'];var utils=require(_0x047a('0x6'));var logger=require(_0x047a('0x7'))(_0x047a('0x8'));var config=require(_0x047a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x047a('0xa')][_0x047a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x511a4c,_0x562c58,_0x2e6e45){return new BPromise(function(_0x70da9e,_0x9906c2){return client[_0x047a('0xc')](_0x511a4c,_0x2e6e45)[_0x047a('0xd')](function(_0x3f83e5){logger[_0x047a('0xe')](_0x047a('0xf'),_0x562c58,_0x047a('0x10'));logger['debug'](_0x047a('0x11'),_0x562c58,_0x047a('0x10'),JSON[_0x047a('0x12')](_0x3f83e5));if(_0x3f83e5[_0x047a('0x13')]){if(_0x3f83e5['error'][_0x047a('0x14')]===0x1f4){logger['error'](_0x047a('0xf'),_0x562c58,_0x3f83e5[_0x047a('0x13')][_0x047a('0x15')]);return _0x9906c2(_0x3f83e5[_0x047a('0x13')][_0x047a('0x15')]);}logger[_0x047a('0x13')](_0x047a('0xf'),_0x562c58,_0x3f83e5['error']['message']);return _0x70da9e(_0x3f83e5['error']['message']);}else{logger[_0x047a('0xe')](_0x047a('0xf'),_0x562c58,'request\x20sent');_0x70da9e(_0x3f83e5[_0x047a('0x16')][_0x047a('0x15')]);}})[_0x047a('0x17')](function(_0x5543b4){logger[_0x047a('0x13')](_0x047a('0xf'),_0x562c58,_0x5543b4);_0x9906c2(_0x5543b4);});});} \ No newline at end of file +var _0xbf32=['request','info','debug','request\x20sent','stringify','error','code','message','FreshdeskConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x5858e0,_0x4059bd){var _0x599502=function(_0x4f3cc6){while(--_0x4f3cc6){_0x5858e0['push'](_0x5858e0['shift']());}};_0x599502(++_0x4059bd);}(_0xbf32,0x1d7));var _0x2bf3=function(_0x53aad0,_0x12d4be){_0x53aad0=_0x53aad0-0x0;var _0x52136c=_0xbf32[_0x53aad0];return _0x52136c;};'use strict';var _=require(_0x2bf3('0x0'));var util=require(_0x2bf3('0x1'));var moment=require(_0x2bf3('0x2'));var BPromise=require(_0x2bf3('0x3'));var rs=require(_0x2bf3('0x4'));var fs=require('fs');var Redis=require(_0x2bf3('0x5'));var db=require(_0x2bf3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2bf3('0x7'))(_0x2bf3('0x8'));var config=require(_0x2bf3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2bf3('0xa')][_0x2bf3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1087f8,_0x5df897,_0x54231d){return new BPromise(function(_0x5aa207,_0x5e188e){return client[_0x2bf3('0xc')](_0x1087f8,_0x54231d)['then'](function(_0x217d61){logger[_0x2bf3('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5df897,'request\x20sent');logger[_0x2bf3('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5df897,_0x2bf3('0xf'),JSON[_0x2bf3('0x10')](_0x217d61));if(_0x217d61[_0x2bf3('0x11')]){if(_0x217d61[_0x2bf3('0x11')][_0x2bf3('0x12')]===0x1f4){logger[_0x2bf3('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x5df897,_0x217d61[_0x2bf3('0x11')][_0x2bf3('0x13')]);return _0x5e188e(_0x217d61[_0x2bf3('0x11')]['message']);}logger['error'](_0x2bf3('0x14'),_0x5df897,_0x217d61[_0x2bf3('0x11')][_0x2bf3('0x13')]);return _0x5aa207(_0x217d61[_0x2bf3('0x11')][_0x2bf3('0x13')]);}else{logger[_0x2bf3('0xd')](_0x2bf3('0x14'),_0x5df897,'request\x20sent');_0x5aa207(_0x217d61[_0x2bf3('0x15')][_0x2bf3('0x13')]);}})[_0x2bf3('0x16')](function(_0x1c5c8a){logger[_0x2bf3('0x11')](_0x2bf3('0x14'),_0x5df897,_0x1c5c8a);_0x5e188e(_0x1c5c8a);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index f2696f2..4182780 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 _0x4e3d=['update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x4e3d,0xb8));var _0xd4e3=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x4e3d[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0xd4e3('0x0'));var path=require('path');var timeout=require(_0xd4e3('0x1'));var express=require('express');var router=express[_0xd4e3('0x2')]();var fs_extra=require(_0xd4e3('0x3'));var auth=require(_0xd4e3('0x4'));var interaction=require(_0xd4e3('0x5'));var config=require('../../config/environment');var controller=require(_0xd4e3('0x6'));router[_0xd4e3('0x7')]('/',auth[_0xd4e3('0x8')](),controller[_0xd4e3('0x9')]);router[_0xd4e3('0x7')](_0xd4e3('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xd4e3('0xb')]('/',auth[_0xd4e3('0x8')](),controller[_0xd4e3('0xc')]);router[_0xd4e3('0xd')](_0xd4e3('0xa'),auth[_0xd4e3('0x8')](),controller[_0xd4e3('0xe')]);router[_0xd4e3('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xd4e3('0x10')]);module[_0xd4e3('0x11')]=router; \ No newline at end of file +var _0xd0fe=['/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intFreshdeskField.controller','isAuthenticated','index','get'];(function(_0x34d635,_0x2784fc){var _0x3ab288=function(_0x41589b){while(--_0x41589b){_0x34d635['push'](_0x34d635['shift']());}};_0x3ab288(++_0x2784fc);}(_0xd0fe,0x137));var _0xed0f=function(_0x458cda,_0xf168ae){_0x458cda=_0x458cda-0x0;var _0xd961df=_0xd0fe[_0x458cda];return _0xd961df;};'use strict';var multer=require(_0xed0f('0x0'));var util=require(_0xed0f('0x1'));var path=require(_0xed0f('0x2'));var timeout=require(_0xed0f('0x3'));var express=require(_0xed0f('0x4'));var router=express[_0xed0f('0x5')]();var fs_extra=require(_0xed0f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xed0f('0x7'));var config=require('../../config/environment');var controller=require(_0xed0f('0x8'));router['get']('/',auth[_0xed0f('0x9')](),controller[_0xed0f('0xa')]);router[_0xed0f('0xb')](_0xed0f('0xc'),auth['isAuthenticated'](),controller[_0xed0f('0xd')]);router[_0xed0f('0xe')]('/',auth[_0xed0f('0x9')](),controller[_0xed0f('0xf')]);router['put'](_0xed0f('0xc'),auth[_0xed0f('0x9')](),controller[_0xed0f('0x10')]);router[_0xed0f('0x11')](_0xed0f('0xc'),auth['isAuthenticated'](),controller[_0xed0f('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index cb99862..ddce021 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 _0x714a=['customVariable','BOOLEAN','exports','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x46f13c,_0x3733fe){var _0x5a653a=function(_0x3fb600){while(--_0x3fb600){_0x46f13c['push'](_0x46f13c['shift']());}};_0x5a653a(++_0x3733fe);}(_0x714a,0xbf));var _0xa714=function(_0x35993d,_0x50ca39){_0x35993d=_0x35993d-0x0;var _0xa7e8ff=_0x714a[_0x35993d];return _0xa7e8ff;};'use strict';var Sequelize=require('sequelize');module[_0xa714('0x0')]={'type':{'type':Sequelize[_0xa714('0x1')](_0xa714('0x2'),_0xa714('0x3'),'customVariable',_0xa714('0x4'),_0xa714('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa714('0x6')]},'key':{'type':Sequelize[_0xa714('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xa714('0x2'),_0xa714('0x3'),_0xa714('0x7'))},'keyContent':{'type':Sequelize[_0xa714('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa714('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcaab=['BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x408817,_0x58bbf4){var _0xf75617=function(_0x273027){while(--_0x273027){_0x408817['push'](_0x408817['shift']());}};_0xf75617(++_0x58bbf4);}(_0xcaab,0x121));var _0xbcaa=function(_0x38e2e5,_0x2cf63f){_0x38e2e5=_0x38e2e5-0x0;var _0x3d94c0=_0xcaab[_0x38e2e5];return _0x3d94c0;};'use strict';var Sequelize=require('sequelize');module[_0xbcaa('0x0')]={'type':{'type':Sequelize[_0xbcaa('0x1')](_0xbcaa('0x2'),_0xbcaa('0x3'),_0xbcaa('0x4'),_0xbcaa('0x5'),_0xbcaa('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xbcaa('0x7')]},'key':{'type':Sequelize[_0xbcaa('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xbcaa('0x2'),_0xbcaa('0x3'),_0xbcaa('0x4'))},'keyContent':{'type':Sequelize[_0xbcaa('0x7')]},'idField':{'type':Sequelize[_0xbcaa('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xbcaa('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbcaa('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index e5fe38f..96e3603 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.controller.js +++ b/server/api/intFreshdeskField/intFreshdeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf45e=['Content-Range','json','apply','reject','save','destroy','then','sendStatus','stack','index','map','rawAttributes','type','key','model','name','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','FreshdeskField','includeAll','include','findAll','rows','show','params','keys','length','merge','find','create','body','update','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set'];(function(_0x3496d8,_0x580f3f){var _0x3cce3e=function(_0x1b63f1){while(--_0x1b63f1){_0x3496d8['push'](_0x3496d8['shift']());}};_0x3cce3e(++_0x580f3f);}(_0xf45e,0x115));var _0xef45=function(_0x291e9f,_0x36a96e){_0x291e9f=_0x291e9f-0x0;var _0x1aa2e5=_0xf45e[_0x291e9f];return _0x1aa2e5;};'use strict';var emlformat=require(_0xef45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef45('0x2'));var moment=require(_0xef45('0x3'));var BPromise=require(_0xef45('0x4'));var Mustache=require(_0xef45('0x5'));var util=require(_0xef45('0x6'));var path=require(_0xef45('0x7'));var sox=require(_0xef45('0x8'));var csv=require(_0xef45('0x9'));var ejs=require(_0xef45('0xa'));var fs=require('fs');var fs_extra=require(_0xef45('0xb'));var _=require(_0xef45('0xc'));var squel=require(_0xef45('0xd'));var crypto=require(_0xef45('0xe'));var jsforce=require(_0xef45('0xf'));var deskjs=require(_0xef45('0x10'));var toCsv=require(_0xef45('0x9'));var querystring=require(_0xef45('0x11'));var Papa=require(_0xef45('0x12'));var Redis=require(_0xef45('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xef45('0x14'));var as=require(_0xef45('0x15'));var hardwareService=require(_0xef45('0x16'));var logger=require(_0xef45('0x17'))(_0xef45('0x18'));var utils=require(_0xef45('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xef45('0x1a'));var db=require(_0xef45('0x1b'))['db'];function respondWithStatusCode(_0x30babb,_0x433be9){_0x433be9=_0x433be9||0xcc;return function(_0x476739){if(_0x476739){return _0x30babb['sendStatus'](_0x433be9);}return _0x30babb['status'](_0x433be9)[_0xef45('0x1c')]();};}function respondWithResult(_0x47fd96,_0x2ae89a){_0x2ae89a=_0x2ae89a||0xc8;return function(_0xb0fc43){if(_0xb0fc43){return _0x47fd96[_0xef45('0x1d')](_0x2ae89a)['json'](_0xb0fc43);}};}function respondWithFilteredResult(_0x5b3136,_0x29c0c4){return function(_0x5530e6){if(_0x5530e6){var _0x11cd3a=typeof _0x29c0c4[_0xef45('0x1e')]===_0xef45('0x1f')&&typeof _0x29c0c4[_0xef45('0x20')]==='undefined';var _0x560b2f=_0x5530e6[_0xef45('0x21')];var _0x219778=_0x11cd3a?0x0:_0x29c0c4[_0xef45('0x1e')];var _0x258785=_0x11cd3a?_0x5530e6['count']:_0x29c0c4['offset']+_0x29c0c4[_0xef45('0x20')];var _0x20ef26;if(_0x258785>=_0x560b2f){_0x258785=_0x560b2f;_0x20ef26=0xc8;}else{_0x20ef26=0xce;}_0x5b3136[_0xef45('0x1d')](_0x20ef26);return _0x5b3136[_0xef45('0x22')](_0xef45('0x23'),_0x219778+'-'+_0x258785+'/'+_0x560b2f)[_0xef45('0x24')](_0x5530e6);}return null;};}function patchUpdates(_0x375cbd){return function(_0x4a6217){try{jsonpatch[_0xef45('0x25')](_0x4a6217,_0x375cbd,!![]);}catch(_0x3e2a47){return BPromise[_0xef45('0x26')](_0x3e2a47);}return _0x4a6217[_0xef45('0x27')]();};}function saveUpdates(_0x27322f,_0x5205bf){return function(_0x40abc8){if(_0x40abc8){return _0x40abc8['update'](_0x27322f)['then'](function(_0x7707a1){return _0x7707a1;});}return null;};}function removeEntity(_0x2b41d8,_0xbb859b){return function(_0x7817d0){if(_0x7817d0){return _0x7817d0[_0xef45('0x28')]()[_0xef45('0x29')](function(){_0x2b41d8[_0xef45('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x208b35,_0x5f0593){return function(_0x38b470){if(!_0x38b470){_0x208b35[_0xef45('0x2a')](0x194);}return _0x38b470;};}function handleError(_0x578f03,_0x46e423){_0x46e423=_0x46e423||0x1f4;return function(_0x2c356d){logger['error'](_0x2c356d[_0xef45('0x2b')]);if(_0x2c356d['name']){delete _0x2c356d['name'];}_0x578f03['status'](_0x46e423)['send'](_0x2c356d);};}exports[_0xef45('0x2c')]=function(_0x2f72ef,_0x217e8d){var _0x15ad38={},_0x5782d0={},_0x18f304={'count':0x0,'rows':[]};var _0x4f028c=_[_0xef45('0x2d')](db['FreshdeskField'][_0xef45('0x2e')],function(_0x5bfd2d){return{'name':_0x5bfd2d['fieldName'],'type':_0x5bfd2d[_0xef45('0x2f')][_0xef45('0x30')]};});_0x5782d0[_0xef45('0x31')]=_[_0xef45('0x2d')](_0x4f028c,_0xef45('0x32'));_0x5782d0['query']=_['keys'](_0x2f72ef['query']);_0x5782d0[_0xef45('0x33')]=_[_0xef45('0x34')](_0x5782d0[_0xef45('0x31')],_0x5782d0[_0xef45('0x35')]);_0x15ad38[_0xef45('0x36')]=_[_0xef45('0x34')](_0x5782d0[_0xef45('0x31')],qs['fields'](_0x2f72ef['query'][_0xef45('0x37')]));_0x15ad38['attributes']=_0x15ad38[_0xef45('0x36')]['length']?_0x15ad38[_0xef45('0x36')]:_0x5782d0[_0xef45('0x31')];if(!_0x2f72ef[_0xef45('0x35')][_0xef45('0x38')](_0xef45('0x39'))){_0x15ad38['limit']=qs[_0xef45('0x20')](_0x2f72ef[_0xef45('0x35')][_0xef45('0x20')]);_0x15ad38['offset']=qs['offset'](_0x2f72ef[_0xef45('0x35')][_0xef45('0x1e')]);}_0x15ad38['order']=qs[_0xef45('0x3a')](_0x2f72ef['query']['sort']);_0x15ad38[_0xef45('0x3b')]=qs[_0xef45('0x33')](_[_0xef45('0x3c')](_0x2f72ef['query'],_0x5782d0[_0xef45('0x33')]),_0x4f028c);if(_0x2f72ef[_0xef45('0x35')][_0xef45('0x3d')]){_0x15ad38[_0xef45('0x3b')]=_['merge'](_0x15ad38['where'],{'$or':_[_0xef45('0x2d')](_0x4f028c,function(_0x474be1){if(_0x474be1[_0xef45('0x2f')]!==_0xef45('0x3e')){var _0x269a11={};_0x269a11[_0x474be1[_0xef45('0x32')]]={'$like':'%'+_0x2f72ef[_0xef45('0x35')][_0xef45('0x3d')]+'%'};return _0x269a11;}})});}_0x15ad38=_['merge']({},_0x15ad38,_0x2f72ef['options']);var _0x13f8b2={'where':_0x15ad38[_0xef45('0x3b')]};return db[_0xef45('0x3f')][_0xef45('0x21')](_0x13f8b2)[_0xef45('0x29')](function(_0x3bcada){_0x18f304[_0xef45('0x21')]=_0x3bcada;if(_0x2f72ef[_0xef45('0x35')][_0xef45('0x40')]){_0x15ad38[_0xef45('0x41')]=[{'all':!![]}];}return db[_0xef45('0x3f')][_0xef45('0x42')](_0x15ad38);})[_0xef45('0x29')](function(_0xd7d217){_0x18f304[_0xef45('0x43')]=_0xd7d217;return _0x18f304;})[_0xef45('0x29')](respondWithFilteredResult(_0x217e8d,_0x15ad38))['catch'](handleError(_0x217e8d,null));};exports[_0xef45('0x44')]=function(_0x5bdfad,_0x1b9d45){var _0x82c123={'raw':!![],'where':{'id':_0x5bdfad[_0xef45('0x45')]['id']}},_0x54ccb8={};_0x54ccb8['model']=_[_0xef45('0x46')](db['FreshdeskField'][_0xef45('0x2e')]);_0x54ccb8[_0xef45('0x35')]=_[_0xef45('0x46')](_0x5bdfad[_0xef45('0x35')]);_0x54ccb8[_0xef45('0x33')]=_[_0xef45('0x34')](_0x54ccb8[_0xef45('0x31')],_0x54ccb8['query']);_0x82c123[_0xef45('0x36')]=_[_0xef45('0x34')](_0x54ccb8[_0xef45('0x31')],qs[_0xef45('0x37')](_0x5bdfad[_0xef45('0x35')][_0xef45('0x37')]));_0x82c123[_0xef45('0x36')]=_0x82c123[_0xef45('0x36')][_0xef45('0x47')]?_0x82c123[_0xef45('0x36')]:_0x54ccb8[_0xef45('0x31')];if(_0x5bdfad[_0xef45('0x35')][_0xef45('0x40')]){_0x82c123[_0xef45('0x41')]=[{'all':!![]}];}_0x82c123=_[_0xef45('0x48')]({},_0x82c123,_0x5bdfad['options']);return db[_0xef45('0x3f')][_0xef45('0x49')](_0x82c123)[_0xef45('0x29')](handleEntityNotFound(_0x1b9d45,null))['then'](respondWithResult(_0x1b9d45,null))['catch'](handleError(_0x1b9d45,null));};exports['create']=function(_0x29aeab,_0x18143c){return db[_0xef45('0x3f')][_0xef45('0x4a')](_0x29aeab[_0xef45('0x4b')],{})[_0xef45('0x29')](respondWithResult(_0x18143c,0xc9))['catch'](handleError(_0x18143c,null));};exports[_0xef45('0x4c')]=function(_0x463796,_0x2b2419){if(_0x463796['body']['id']){delete _0x463796['body']['id'];}return db[_0xef45('0x3f')][_0xef45('0x49')]({'where':{'id':_0x463796['params']['id']}})[_0xef45('0x29')](handleEntityNotFound(_0x2b2419,null))[_0xef45('0x29')](saveUpdates(_0x463796[_0xef45('0x4b')],null))[_0xef45('0x29')](respondWithResult(_0x2b2419,null))[_0xef45('0x4d')](handleError(_0x2b2419,null));};exports[_0xef45('0x28')]=function(_0x23581f,_0xfa5fdd){return db[_0xef45('0x3f')][_0xef45('0x49')]({'where':{'id':_0x23581f[_0xef45('0x45')]['id']}})[_0xef45('0x29')](handleEntityNotFound(_0xfa5fdd,null))[_0xef45('0x29')](removeEntity(_0xfa5fdd,null))[_0xef45('0x4d')](handleError(_0xfa5fdd,null));}; \ No newline at end of file +var _0xa699=['index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','FreshdeskField','includeAll','include','rows','show','params','options','find','catch','create','body','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','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','error','stack','name','send'];(function(_0x32e1cc,_0x3605b9){var _0x4ea6b9=function(_0x31cf03){while(--_0x31cf03){_0x32e1cc['push'](_0x32e1cc['shift']());}};_0x4ea6b9(++_0x3605b9);}(_0xa699,0x6b));var _0x9a69=function(_0x3c6ae2,_0x5c52d8){_0x3c6ae2=_0x3c6ae2-0x0;var _0x4edda=_0xa699[_0x3c6ae2];return _0x4edda;};'use strict';var emlformat=require(_0x9a69('0x0'));var rimraf=require(_0x9a69('0x1'));var zipdir=require(_0x9a69('0x2'));var jsonpatch=require(_0x9a69('0x3'));var rp=require(_0x9a69('0x4'));var moment=require(_0x9a69('0x5'));var BPromise=require(_0x9a69('0x6'));var Mustache=require(_0x9a69('0x7'));var util=require(_0x9a69('0x8'));var path=require(_0x9a69('0x9'));var sox=require(_0x9a69('0xa'));var csv=require(_0x9a69('0xb'));var ejs=require(_0x9a69('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a69('0xd'));var squel=require(_0x9a69('0xe'));var crypto=require(_0x9a69('0xf'));var jsforce=require(_0x9a69('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x9a69('0xb'));var querystring=require(_0x9a69('0x11'));var Papa=require(_0x9a69('0x12'));var Redis=require(_0x9a69('0x13'));var authService=require(_0x9a69('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a69('0x15'));var logger=require('../../config/logger')(_0x9a69('0x16'));var utils=require(_0x9a69('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9a69('0x18'));var db=require(_0x9a69('0x19'))['db'];function respondWithStatusCode(_0x56e43f,_0x81dfb1){_0x81dfb1=_0x81dfb1||0xcc;return function(_0x2e613e){if(_0x2e613e){return _0x56e43f[_0x9a69('0x1a')](_0x81dfb1);}return _0x56e43f[_0x9a69('0x1b')](_0x81dfb1)[_0x9a69('0x1c')]();};}function respondWithResult(_0x70475b,_0x34b5b0){_0x34b5b0=_0x34b5b0||0xc8;return function(_0x2a5b83){if(_0x2a5b83){return _0x70475b[_0x9a69('0x1b')](_0x34b5b0)['json'](_0x2a5b83);}};}function respondWithFilteredResult(_0x2323ae,_0x17de41){return function(_0x2be3ec){if(_0x2be3ec){var _0x5e982d=typeof _0x17de41[_0x9a69('0x1d')]===_0x9a69('0x1e')&&typeof _0x17de41[_0x9a69('0x1f')]===_0x9a69('0x1e');var _0xed2c19=_0x2be3ec['count'];var _0x2e4264=_0x5e982d?0x0:_0x17de41[_0x9a69('0x1d')];var _0x186a5a=_0x5e982d?_0x2be3ec[_0x9a69('0x20')]:_0x17de41[_0x9a69('0x1d')]+_0x17de41[_0x9a69('0x1f')];var _0x2633d5;if(_0x186a5a>=_0xed2c19){_0x186a5a=_0xed2c19;_0x2633d5=0xc8;}else{_0x2633d5=0xce;}_0x2323ae[_0x9a69('0x1b')](_0x2633d5);return _0x2323ae[_0x9a69('0x21')](_0x9a69('0x22'),_0x2e4264+'-'+_0x186a5a+'/'+_0xed2c19)['json'](_0x2be3ec);}return null;};}function patchUpdates(_0x4d8db9){return function(_0x5ebb09){try{jsonpatch[_0x9a69('0x23')](_0x5ebb09,_0x4d8db9,!![]);}catch(_0x12ebe5){return BPromise['reject'](_0x12ebe5);}return _0x5ebb09[_0x9a69('0x24')]();};}function saveUpdates(_0x527ca6,_0x265291){return function(_0x4d6a93){if(_0x4d6a93){return _0x4d6a93['update'](_0x527ca6)['then'](function(_0x189989){return _0x189989;});}return null;};}function removeEntity(_0x5f4138,_0x140cbe){return function(_0x28f5f7){if(_0x28f5f7){return _0x28f5f7[_0x9a69('0x25')]()[_0x9a69('0x26')](function(){_0x5f4138['status'](0xcc)[_0x9a69('0x1c')]();});}};}function handleEntityNotFound(_0x5130b2,_0x203d32){return function(_0x4ef126){if(!_0x4ef126){_0x5130b2['sendStatus'](0x194);}return _0x4ef126;};}function handleError(_0xbcdcd9,_0xf6fea2){_0xf6fea2=_0xf6fea2||0x1f4;return function(_0x268cef){logger[_0x9a69('0x27')](_0x268cef[_0x9a69('0x28')]);if(_0x268cef[_0x9a69('0x29')]){delete _0x268cef[_0x9a69('0x29')];}_0xbcdcd9[_0x9a69('0x1b')](_0xf6fea2)[_0x9a69('0x2a')](_0x268cef);};}exports[_0x9a69('0x2b')]=function(_0x47916a,_0x1ff48e){var _0x165a87={},_0x5433b3={},_0x54e643={'count':0x0,'rows':[]};var _0x4b3539=_[_0x9a69('0x2c')](db['FreshdeskField'][_0x9a69('0x2d')],function(_0x2d15e3){return{'name':_0x2d15e3[_0x9a69('0x2e')],'type':_0x2d15e3[_0x9a69('0x2f')][_0x9a69('0x30')]};});_0x5433b3[_0x9a69('0x31')]=_[_0x9a69('0x2c')](_0x4b3539,_0x9a69('0x29'));_0x5433b3[_0x9a69('0x32')]=_[_0x9a69('0x33')](_0x47916a[_0x9a69('0x32')]);_0x5433b3[_0x9a69('0x34')]=_[_0x9a69('0x35')](_0x5433b3[_0x9a69('0x31')],_0x5433b3[_0x9a69('0x32')]);_0x165a87[_0x9a69('0x36')]=_[_0x9a69('0x35')](_0x5433b3['model'],qs['fields'](_0x47916a[_0x9a69('0x32')][_0x9a69('0x37')]));_0x165a87[_0x9a69('0x36')]=_0x165a87[_0x9a69('0x36')][_0x9a69('0x38')]?_0x165a87['attributes']:_0x5433b3['model'];if(!_0x47916a['query']['hasOwnProperty'](_0x9a69('0x39'))){_0x165a87[_0x9a69('0x1f')]=qs[_0x9a69('0x1f')](_0x47916a[_0x9a69('0x32')][_0x9a69('0x1f')]);_0x165a87[_0x9a69('0x1d')]=qs['offset'](_0x47916a['query'][_0x9a69('0x1d')]);}_0x165a87[_0x9a69('0x3a')]=qs[_0x9a69('0x3b')](_0x47916a['query'][_0x9a69('0x3b')]);_0x165a87[_0x9a69('0x3c')]=qs[_0x9a69('0x34')](_[_0x9a69('0x3d')](_0x47916a[_0x9a69('0x32')],_0x5433b3[_0x9a69('0x34')]),_0x4b3539);if(_0x47916a[_0x9a69('0x32')][_0x9a69('0x3e')]){_0x165a87[_0x9a69('0x3c')]=_[_0x9a69('0x3f')](_0x165a87[_0x9a69('0x3c')],{'$or':_['map'](_0x4b3539,function(_0x1ac0b7){if(_0x1ac0b7['type']!=='VIRTUAL'){var _0x4cc399={};_0x4cc399[_0x1ac0b7['name']]={'$like':'%'+_0x47916a[_0x9a69('0x32')][_0x9a69('0x3e')]+'%'};return _0x4cc399;}})});}_0x165a87=_['merge']({},_0x165a87,_0x47916a['options']);var _0x5a1e62={'where':_0x165a87[_0x9a69('0x3c')]};return db[_0x9a69('0x40')][_0x9a69('0x20')](_0x5a1e62)['then'](function(_0x2ff507){_0x54e643[_0x9a69('0x20')]=_0x2ff507;if(_0x47916a[_0x9a69('0x32')][_0x9a69('0x41')]){_0x165a87[_0x9a69('0x42')]=[{'all':!![]}];}return db[_0x9a69('0x40')]['findAll'](_0x165a87);})[_0x9a69('0x26')](function(_0x27d0db){_0x54e643[_0x9a69('0x43')]=_0x27d0db;return _0x54e643;})[_0x9a69('0x26')](respondWithFilteredResult(_0x1ff48e,_0x165a87))['catch'](handleError(_0x1ff48e,null));};exports[_0x9a69('0x44')]=function(_0x373939,_0x5b309a){var _0x318de1={'raw':!![],'where':{'id':_0x373939[_0x9a69('0x45')]['id']}},_0x3c78e2={};_0x3c78e2['model']=_['keys'](db['FreshdeskField'][_0x9a69('0x2d')]);_0x3c78e2[_0x9a69('0x32')]=_[_0x9a69('0x33')](_0x373939[_0x9a69('0x32')]);_0x3c78e2['filters']=_[_0x9a69('0x35')](_0x3c78e2[_0x9a69('0x31')],_0x3c78e2[_0x9a69('0x32')]);_0x318de1[_0x9a69('0x36')]=_['intersection'](_0x3c78e2[_0x9a69('0x31')],qs[_0x9a69('0x37')](_0x373939[_0x9a69('0x32')][_0x9a69('0x37')]));_0x318de1['attributes']=_0x318de1[_0x9a69('0x36')]['length']?_0x318de1[_0x9a69('0x36')]:_0x3c78e2['model'];if(_0x373939[_0x9a69('0x32')]['includeAll']){_0x318de1[_0x9a69('0x42')]=[{'all':!![]}];}_0x318de1=_['merge']({},_0x318de1,_0x373939[_0x9a69('0x46')]);return db[_0x9a69('0x40')][_0x9a69('0x47')](_0x318de1)[_0x9a69('0x26')](handleEntityNotFound(_0x5b309a,null))['then'](respondWithResult(_0x5b309a,null))[_0x9a69('0x48')](handleError(_0x5b309a,null));};exports[_0x9a69('0x49')]=function(_0x77781d,_0x2537b0){return db[_0x9a69('0x40')][_0x9a69('0x49')](_0x77781d[_0x9a69('0x4a')],{})[_0x9a69('0x26')](respondWithResult(_0x2537b0,0xc9))[_0x9a69('0x48')](handleError(_0x2537b0,null));};exports['update']=function(_0x281ef0,_0x6046a7){if(_0x281ef0[_0x9a69('0x4a')]['id']){delete _0x281ef0[_0x9a69('0x4a')]['id'];}return db[_0x9a69('0x40')][_0x9a69('0x47')]({'where':{'id':_0x281ef0[_0x9a69('0x45')]['id']}})[_0x9a69('0x26')](handleEntityNotFound(_0x6046a7,null))[_0x9a69('0x26')](saveUpdates(_0x281ef0[_0x9a69('0x4a')],null))[_0x9a69('0x26')](respondWithResult(_0x6046a7,null))[_0x9a69('0x48')](handleError(_0x6046a7,null));};exports[_0x9a69('0x25')]=function(_0x43b084,_0x18ab7a){return db['FreshdeskField'][_0x9a69('0x47')]({'where':{'id':_0x43b084[_0x9a69('0x45')]['id']}})[_0x9a69('0x26')](handleEntityNotFound(_0x18ab7a,null))[_0x9a69('0x26')](removeEntity(_0x18ab7a,null))[_0x9a69('0x48')](handleError(_0x18ab7a,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index b560638..933b2f2 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 _0xe9eb=['rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x562238,_0x1336b5){var _0x33be72=function(_0xb44066){while(--_0xb44066){_0x562238['push'](_0x562238['shift']());}};_0x33be72(++_0x1336b5);}(_0xe9eb,0xda));var _0xbe9e=function(_0x51440a,_0x54c7f7){_0x51440a=_0x51440a-0x0;var _0xe91afc=_0xe9eb[_0x51440a];return _0xe91afc;};'use strict';var _=require(_0xbe9e('0x0'));var util=require(_0xbe9e('0x1'));var logger=require(_0xbe9e('0x2'))(_0xbe9e('0x3'));var moment=require('moment');var BPromise=require(_0xbe9e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe9e('0x5'));var rimraf=require(_0xbe9e('0x6'));var config=require(_0xbe9e('0x7'));var attributes=require(_0xbe9e('0x8'));module[_0xbe9e('0x9')]=function(_0x227273,_0x450971){return _0x227273[_0xbe9e('0xa')](_0xbe9e('0xb'),attributes,{'tableName':_0xbe9e('0xc'),'paranoid':![],'indexes':[{'name':_0xbe9e('0xd'),'fields':[_0xbe9e('0xe'),_0xbe9e('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x23a8=['../../config/environment','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x5a6de2,_0x5c8b10){var _0x2c0525=function(_0x59d072){while(--_0x59d072){_0x5a6de2['push'](_0x5a6de2['shift']());}};_0x2c0525(++_0x5c8b10);}(_0x23a8,0xd8));var _0x823a=function(_0x4b36f9,_0x582566){_0x4b36f9=_0x4b36f9-0x0;var _0x476e53=_0x23a8[_0x4b36f9];return _0x476e53;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x823a('0x0'))(_0x823a('0x1'));var moment=require(_0x823a('0x2'));var BPromise=require('bluebird');var rp=require(_0x823a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x823a('0x4'));var config=require(_0x823a('0x5'));var attributes=require(_0x823a('0x6'));module[_0x823a('0x7')]=function(_0x4d4a43,_0x37dc78){return _0x4d4a43[_0x823a('0x8')]('FreshdeskField',attributes,{'tableName':_0x823a('0x9'),'paranoid':![],'indexes':[{'name':_0x823a('0xa'),'fields':[_0x823a('0xb'),_0x823a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 18e7b64..7737e0c 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 _0x148f=['info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x4e740c,_0x2f3120){var _0x327a06=function(_0x908629){while(--_0x908629){_0x4e740c['push'](_0x4e740c['shift']());}};_0x327a06(++_0x2f3120);}(_0x148f,0xc3));var _0xf148=function(_0x5a7357,_0x4a88e0){_0x5a7357=_0x5a7357-0x0;var _0x4bcf54=_0x148f[_0x5a7357];return _0x4bcf54;};'use strict';var _=require(_0xf148('0x0'));var util=require(_0xf148('0x1'));var moment=require('moment');var BPromise=require(_0xf148('0x2'));var rs=require(_0xf148('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf148('0x4'))['db'];var utils=require(_0xf148('0x5'));var logger=require(_0xf148('0x6'))(_0xf148('0x7'));var config=require(_0xf148('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf148('0x9')][_0xf148('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39a6ad,_0x5dd78f,_0x4b181c){return new BPromise(function(_0x110563,_0x4a2ee6){return client[_0xf148('0xb')](_0x39a6ad,_0x4b181c)[_0xf148('0xc')](function(_0x31dcd6){logger['info'](_0xf148('0xd'),_0x5dd78f,_0xf148('0xe'));logger[_0xf148('0xf')](_0xf148('0x10'),_0x5dd78f,_0xf148('0xe'),JSON[_0xf148('0x11')](_0x31dcd6));if(_0x31dcd6['error']){if(_0x31dcd6['error'][_0xf148('0x12')]===0x1f4){logger[_0xf148('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x5dd78f,_0x31dcd6[_0xf148('0x13')]['message']);return _0x4a2ee6(_0x31dcd6[_0xf148('0x13')][_0xf148('0x14')]);}logger[_0xf148('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x5dd78f,_0x31dcd6[_0xf148('0x13')][_0xf148('0x14')]);return _0x110563(_0x31dcd6[_0xf148('0x13')]['message']);}else{logger[_0xf148('0x15')](_0xf148('0xd'),_0x5dd78f,_0xf148('0xe'));_0x110563(_0x31dcd6[_0xf148('0x16')]['message']);}})[_0xf148('0x17')](function(_0x1176fb){logger[_0xf148('0x13')](_0xf148('0xd'),_0x5dd78f,_0x1176fb);_0x4a2ee6(_0x1176fb);});});} \ No newline at end of file +var _0x9f82=['client','request','then','info','request\x20sent','debug','error','code','FreshdeskField,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x4d1d6a,_0x307430){var _0x342f67=function(_0xfea4d9){while(--_0xfea4d9){_0x4d1d6a['push'](_0x4d1d6a['shift']());}};_0x342f67(++_0x307430);}(_0x9f82,0x1eb));var _0x29f8=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9f82[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x29f8('0x0'));var util=require(_0x29f8('0x1'));var moment=require(_0x29f8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x29f8('0x3'));var db=require(_0x29f8('0x4'))['db'];var utils=require(_0x29f8('0x5'));var logger=require(_0x29f8('0x6'))(_0x29f8('0x7'));var config=require('../../config/environment');var jayson=require(_0x29f8('0x8'));var client=jayson[_0x29f8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x186bce,_0x169cc4,_0x57115a){return new BPromise(function(_0x5cc47d,_0x48ea56){return client[_0x29f8('0xa')](_0x186bce,_0x57115a)[_0x29f8('0xb')](function(_0xfab2ef){logger[_0x29f8('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x169cc4,_0x29f8('0xd'));logger[_0x29f8('0xe')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x169cc4,_0x29f8('0xd'),JSON['stringify'](_0xfab2ef));if(_0xfab2ef[_0x29f8('0xf')]){if(_0xfab2ef[_0x29f8('0xf')][_0x29f8('0x10')]===0x1f4){logger[_0x29f8('0xf')](_0x29f8('0x11'),_0x169cc4,_0xfab2ef[_0x29f8('0xf')]['message']);return _0x48ea56(_0xfab2ef[_0x29f8('0xf')][_0x29f8('0x12')]);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x169cc4,_0xfab2ef[_0x29f8('0xf')][_0x29f8('0x12')]);return _0x5cc47d(_0xfab2ef[_0x29f8('0xf')][_0x29f8('0x12')]);}else{logger[_0x29f8('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x169cc4,_0x29f8('0xd'));_0x5cc47d(_0xfab2ef[_0x29f8('0x13')][_0x29f8('0x12')]);}})['catch'](function(_0x330df7){logger['error'](_0x29f8('0x11'),_0x169cc4,_0x330df7);_0x48ea56(_0x330df7);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 0701e3d..17ee64c 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 _0x3f8c=['index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','path','connect-timeout','express','Router','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f8c,0x104));var _0xc3f8=function(_0x4708b1,_0x563d90){_0x4708b1=_0x4708b1-0x0;var _0x2cdd07=_0x3f8c[_0x4708b1];return _0x2cdd07;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc3f8('0x0'));var timeout=require(_0xc3f8('0x1'));var express=require(_0xc3f8('0x2'));var router=express[_0xc3f8('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshsalesAccount.controller');router[_0xc3f8('0x4')]('/',auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x6')]);router[_0xc3f8('0x4')](_0xc3f8('0x7'),auth[_0xc3f8('0x5')](),controller['show']);router[_0xc3f8('0x4')](_0xc3f8('0x8'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x9')]);router[_0xc3f8('0x4')](_0xc3f8('0xa'),auth[_0xc3f8('0x5')](),controller['getFields']);router[_0xc3f8('0xb')]('/',auth[_0xc3f8('0x5')](),controller[_0xc3f8('0xc')]);router[_0xc3f8('0xb')]('/:id/configurations',auth[_0xc3f8('0x5')](),controller[_0xc3f8('0xd')]);router[_0xc3f8('0xe')](_0xc3f8('0x7'),auth['isAuthenticated'](),controller[_0xc3f8('0xf')]);router[_0xc3f8('0x10')](_0xc3f8('0x7'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x11')]);module[_0xc3f8('0x12')]=router; \ No newline at end of file +var _0x80ed=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','destroy','exports','multer','path'];(function(_0x212d37,_0x48c57e){var _0xf3ec1c=function(_0x3281a7){while(--_0x3281a7){_0x212d37['push'](_0x212d37['shift']());}};_0xf3ec1c(++_0x48c57e);}(_0x80ed,0x11c));var _0xd80e=function(_0x447096,_0x19b068){_0x447096=_0x447096-0x0;var _0x4be6ea=_0x80ed[_0x447096];return _0x4be6ea;};'use strict';var multer=require(_0xd80e('0x0'));var util=require('util');var path=require(_0xd80e('0x1'));var timeout=require(_0xd80e('0x2'));var express=require(_0xd80e('0x3'));var router=express['Router']();var fs_extra=require(_0xd80e('0x4'));var auth=require(_0xd80e('0x5'));var interaction=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0xd80e('0x8')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0xa')]);router['get'](_0xd80e('0xb'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xc')]);router[_0xd80e('0x8')](_0xd80e('0xd'),auth[_0xd80e('0x9')](),controller[_0xd80e('0xe')]);router[_0xd80e('0x8')](_0xd80e('0xf'),auth[_0xd80e('0x9')](),controller['getFields']);router[_0xd80e('0x10')]('/',auth[_0xd80e('0x9')](),controller[_0xd80e('0x11')]);router[_0xd80e('0x10')](_0xd80e('0xd'),auth[_0xd80e('0x9')](),controller[_0xd80e('0x12')]);router[_0xd80e('0x13')](_0xd80e('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xd80e('0x9')](),controller[_0xd80e('0x14')]);module[_0xd80e('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index f595136..ca7b8e4 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 _0x7096=['exports','STRING','username','remoteUri'];(function(_0x3f18cf,_0x1de928){var _0x2e140d=function(_0x4eed56){while(--_0x4eed56){_0x3f18cf['push'](_0x3f18cf['shift']());}};_0x2e140d(++_0x1de928);}(_0x7096,0x10c));var _0x6709=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7096[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x6709('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6709('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6709('0x2')},'apiKey':{'type':Sequelize[_0x6709('0x1')]},'remoteUri':{'type':Sequelize[_0x6709('0x1')],'unique':_0x6709('0x3')},'serverUrl':{'type':Sequelize[_0x6709('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x66fa=['exports','STRING','username','remoteUri','sequelize'];(function(_0x566a15,_0x240781){var _0x5db593=function(_0x245874){while(--_0x245874){_0x566a15['push'](_0x566a15['shift']());}};_0x5db593(++_0x240781);}(_0x66fa,0x117));var _0xa66f=function(_0x3d4782,_0x4a5e43){_0x3d4782=_0x3d4782-0x0;var _0x2b83b0=_0x66fa[_0x3d4782];return _0x2b83b0;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa66f('0x2')]},'username':{'type':Sequelize[_0xa66f('0x2')],'unique':_0xa66f('0x3')},'apiKey':{'type':Sequelize[_0xa66f('0x2')]},'remoteUri':{'type':Sequelize[_0xa66f('0x2')],'unique':_0xa66f('0x4')},'serverUrl':{'type':Sequelize[_0xa66f('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 3402595..d9d75f6 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 _0xd526=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','sendStatus','status','end','json','limit','undefined','count','offset','set','reject','then','destroy','error','stack','name','map','FreshsalesAccount','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','params','keys','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','nolimit','addConfiguration','AccountId','Subjects','channel','getDescriptions','FreshsalesField','Descriptions','getFields','username','apiKey','remoteUri','substring','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','getFields,\x20%s,\x20%s,\x20%s','stringify','test','statusCode','rimraf','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/qs'];(function(_0x112e6a,_0x4dfc41){var _0x1b691b=function(_0x9465e2){while(--_0x9465e2){_0x112e6a['push'](_0x112e6a['shift']());}};_0x1b691b(++_0x4dfc41);}(_0xd526,0xb1));var _0x6d52=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xd526[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6d52('0x0'));var zipdir=require(_0x6d52('0x1'));var jsonpatch=require(_0x6d52('0x2'));var rp=require(_0x6d52('0x3'));var moment=require(_0x6d52('0x4'));var BPromise=require(_0x6d52('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6d52('0x6'));var sox=require(_0x6d52('0x7'));var csv=require(_0x6d52('0x8'));var ejs=require(_0x6d52('0x9'));var fs=require('fs');var fs_extra=require(_0x6d52('0xa'));var _=require(_0x6d52('0xb'));var squel=require(_0x6d52('0xc'));var crypto=require(_0x6d52('0xd'));var jsforce=require(_0x6d52('0xe'));var deskjs=require(_0x6d52('0xf'));var toCsv=require(_0x6d52('0x8'));var querystring=require(_0x6d52('0x10'));var Papa=require(_0x6d52('0x11'));var Redis=require(_0x6d52('0x12'));var authService=require(_0x6d52('0x13'));var qs=require(_0x6d52('0x14'));var as=require(_0x6d52('0x15'));var hardwareService=require(_0x6d52('0x16'));var logger=require(_0x6d52('0x17'))(_0x6d52('0x18'));var utils=require(_0x6d52('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x6d52('0x1a'));function respondWithStatusCode(_0x42233e,_0x58b27b){_0x58b27b=_0x58b27b||0xcc;return function(_0x4d4126){if(_0x4d4126){return _0x42233e[_0x6d52('0x1b')](_0x58b27b);}return _0x42233e[_0x6d52('0x1c')](_0x58b27b)[_0x6d52('0x1d')]();};}function respondWithResult(_0x588ef6,_0x190f35){_0x190f35=_0x190f35||0xc8;return function(_0x341671){if(_0x341671){return _0x588ef6[_0x6d52('0x1c')](_0x190f35)[_0x6d52('0x1e')](_0x341671);}};}function respondWithFilteredResult(_0x2588a5,_0x34f141){return function(_0x4a98e5){if(_0x4a98e5){var _0x1a98b2=typeof _0x34f141['offset']==='undefined'&&typeof _0x34f141[_0x6d52('0x1f')]===_0x6d52('0x20');var _0x299fc6=_0x4a98e5[_0x6d52('0x21')];var _0xa548cc=_0x1a98b2?0x0:_0x34f141[_0x6d52('0x22')];var _0x4c4409=_0x1a98b2?_0x4a98e5['count']:_0x34f141['offset']+_0x34f141['limit'];var _0x3f74c5;if(_0x4c4409>=_0x299fc6){_0x4c4409=_0x299fc6;_0x3f74c5=0xc8;}else{_0x3f74c5=0xce;}_0x2588a5[_0x6d52('0x1c')](_0x3f74c5);return _0x2588a5[_0x6d52('0x23')]('Content-Range',_0xa548cc+'-'+_0x4c4409+'/'+_0x299fc6)[_0x6d52('0x1e')](_0x4a98e5);}return null;};}function patchUpdates(_0x3cf2f6){return function(_0x5c5744){try{jsonpatch['apply'](_0x5c5744,_0x3cf2f6,!![]);}catch(_0x505418){return BPromise[_0x6d52('0x24')](_0x505418);}return _0x5c5744['save']();};}function saveUpdates(_0x5030a2,_0x58be6c){return function(_0x23fc11){if(_0x23fc11){return _0x23fc11['update'](_0x5030a2)[_0x6d52('0x25')](function(_0x5f5b56){return _0x5f5b56;});}return null;};}function removeEntity(_0x22ba94,_0x5746e7){return function(_0x1014a3){if(_0x1014a3){return _0x1014a3[_0x6d52('0x26')]()[_0x6d52('0x25')](function(){_0x22ba94[_0x6d52('0x1c')](0xcc)[_0x6d52('0x1d')]();});}};}function handleEntityNotFound(_0x59bae3,_0x447986){return function(_0x3a6c09){if(!_0x3a6c09){_0x59bae3['sendStatus'](0x194);}return _0x3a6c09;};}function handleError(_0x1aa404,_0x1477fc){_0x1477fc=_0x1477fc||0x1f4;return function(_0x48275a){logger[_0x6d52('0x27')](_0x48275a[_0x6d52('0x28')]);if(_0x48275a[_0x6d52('0x29')]){delete _0x48275a['name'];}_0x1aa404['status'](_0x1477fc)['send'](_0x48275a);};}exports['index']=function(_0x372bb,_0x508500){var _0x453995={},_0x3c6e87={},_0x11cf99={'count':0x0,'rows':[]};var _0x2f3881=_[_0x6d52('0x2a')](db[_0x6d52('0x2b')][_0x6d52('0x2c')],function(_0x3c9039){return{'name':_0x3c9039['fieldName'],'type':_0x3c9039[_0x6d52('0x2d')][_0x6d52('0x2e')]};});_0x3c6e87[_0x6d52('0x2f')]=_[_0x6d52('0x2a')](_0x2f3881,_0x6d52('0x29'));_0x3c6e87[_0x6d52('0x30')]=_['keys'](_0x372bb[_0x6d52('0x30')]);_0x3c6e87['filters']=_[_0x6d52('0x31')](_0x3c6e87[_0x6d52('0x2f')],_0x3c6e87[_0x6d52('0x30')]);_0x453995['attributes']=_[_0x6d52('0x31')](_0x3c6e87['model'],qs[_0x6d52('0x32')](_0x372bb[_0x6d52('0x30')][_0x6d52('0x32')]));_0x453995[_0x6d52('0x33')]=_0x453995[_0x6d52('0x33')][_0x6d52('0x34')]?_0x453995[_0x6d52('0x33')]:_0x3c6e87[_0x6d52('0x2f')];if(!_0x372bb[_0x6d52('0x30')][_0x6d52('0x35')]('nolimit')){_0x453995['limit']=qs[_0x6d52('0x1f')](_0x372bb[_0x6d52('0x30')][_0x6d52('0x1f')]);_0x453995['offset']=qs[_0x6d52('0x22')](_0x372bb[_0x6d52('0x30')][_0x6d52('0x22')]);}_0x453995[_0x6d52('0x36')]=qs['sort'](_0x372bb[_0x6d52('0x30')][_0x6d52('0x37')]);_0x453995[_0x6d52('0x38')]=qs[_0x6d52('0x39')](_[_0x6d52('0x3a')](_0x372bb[_0x6d52('0x30')],_0x3c6e87[_0x6d52('0x39')]),_0x2f3881);if(_0x372bb[_0x6d52('0x30')][_0x6d52('0x3b')]){_0x453995['where']=_[_0x6d52('0x3c')](_0x453995['where'],{'$or':_[_0x6d52('0x2a')](_0x2f3881,function(_0x59a900){if(_0x59a900[_0x6d52('0x2d')]!==_0x6d52('0x3d')){var _0x560c4e={};_0x560c4e[_0x59a900[_0x6d52('0x29')]]={'$like':'%'+_0x372bb[_0x6d52('0x30')][_0x6d52('0x3b')]+'%'};return _0x560c4e;}})});}_0x453995=_[_0x6d52('0x3c')]({},_0x453995,_0x372bb[_0x6d52('0x3e')]);var _0xb7ce97={'where':_0x453995[_0x6d52('0x38')]};return db['FreshsalesAccount']['count'](_0xb7ce97)[_0x6d52('0x25')](function(_0x1f9363){_0x11cf99[_0x6d52('0x21')]=_0x1f9363;if(_0x372bb[_0x6d52('0x30')][_0x6d52('0x3f')]){_0x453995[_0x6d52('0x40')]=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x453995);})[_0x6d52('0x25')](function(_0x3abc2f){_0x11cf99['rows']=_0x3abc2f;return _0x11cf99;})['then'](respondWithFilteredResult(_0x508500,_0x453995))[_0x6d52('0x41')](handleError(_0x508500,null));};exports['show']=function(_0x3e7d6c,_0x258563){var _0x39b5aa={'raw':![],'where':{'id':_0x3e7d6c[_0x6d52('0x42')]['id']}},_0x2f75b6={};_0x2f75b6[_0x6d52('0x2f')]=_[_0x6d52('0x43')](db[_0x6d52('0x2b')][_0x6d52('0x2c')]);_0x2f75b6[_0x6d52('0x30')]=_[_0x6d52('0x43')](_0x3e7d6c[_0x6d52('0x30')]);_0x2f75b6[_0x6d52('0x39')]=_['intersection'](_0x2f75b6[_0x6d52('0x2f')],_0x2f75b6[_0x6d52('0x30')]);_0x39b5aa['attributes']=_[_0x6d52('0x31')](_0x2f75b6[_0x6d52('0x2f')],qs[_0x6d52('0x32')](_0x3e7d6c['query'][_0x6d52('0x32')]));_0x39b5aa[_0x6d52('0x33')]=_0x39b5aa[_0x6d52('0x33')]['length']?_0x39b5aa['attributes']:_0x2f75b6[_0x6d52('0x2f')];if(_0x3e7d6c[_0x6d52('0x30')][_0x6d52('0x3f')]){_0x39b5aa[_0x6d52('0x40')]=[{'all':!![]}];}_0x39b5aa=_[_0x6d52('0x3c')]({},_0x39b5aa,_0x3e7d6c[_0x6d52('0x3e')]);return db[_0x6d52('0x2b')][_0x6d52('0x44')](_0x39b5aa)[_0x6d52('0x25')](handleEntityNotFound(_0x258563,null))[_0x6d52('0x25')](respondWithResult(_0x258563,null))[_0x6d52('0x41')](handleError(_0x258563,null));};exports[_0x6d52('0x45')]=function(_0x2df2b3,_0x3b7365){return db[_0x6d52('0x2b')]['create'](_0x2df2b3['body'],{})[_0x6d52('0x25')](respondWithResult(_0x3b7365,0xc9))[_0x6d52('0x41')](handleError(_0x3b7365,null));};exports['update']=function(_0x340aca,_0x45dc44){if(_0x340aca['body']['id']){delete _0x340aca[_0x6d52('0x46')]['id'];}return db[_0x6d52('0x2b')][_0x6d52('0x44')]({'where':{'id':_0x340aca['params']['id']}})[_0x6d52('0x25')](handleEntityNotFound(_0x45dc44,null))[_0x6d52('0x25')](saveUpdates(_0x340aca[_0x6d52('0x46')],null))[_0x6d52('0x25')](respondWithResult(_0x45dc44,null))[_0x6d52('0x41')](handleError(_0x45dc44,null));};exports[_0x6d52('0x26')]=function(_0x5a435f,_0x27685a){return db[_0x6d52('0x2b')][_0x6d52('0x44')]({'where':{'id':_0x5a435f['params']['id']}})[_0x6d52('0x25')](handleEntityNotFound(_0x27685a,null))['then'](removeEntity(_0x27685a,null))[_0x6d52('0x41')](handleError(_0x27685a,null));};exports[_0x6d52('0x47')]=function(_0x3b5d6f,_0x5ef2c5,_0x41f695){var _0x1cba0e={};var _0x25b5a9={};var _0x3b5224;var _0x24d032;return db[_0x6d52('0x2b')][_0x6d52('0x48')]({'where':{'id':_0x3b5d6f[_0x6d52('0x42')]['id']}})['then'](handleEntityNotFound(_0x5ef2c5,null))[_0x6d52('0x25')](function(_0x3b488a){if(_0x3b488a){_0x3b5224=_0x3b488a;_0x25b5a9[_0x6d52('0x2f')]=_[_0x6d52('0x43')](db[_0x6d52('0x49')][_0x6d52('0x2c')]);_0x25b5a9[_0x6d52('0x30')]=_[_0x6d52('0x43')](_0x3b5d6f[_0x6d52('0x30')]);_0x25b5a9['filters']=_['intersection'](_0x25b5a9['model'],_0x25b5a9[_0x6d52('0x30')]);_0x1cba0e[_0x6d52('0x33')]=_['intersection'](_0x25b5a9['model'],qs[_0x6d52('0x32')](_0x3b5d6f[_0x6d52('0x30')]['fields']));_0x1cba0e[_0x6d52('0x33')]=_0x1cba0e[_0x6d52('0x33')][_0x6d52('0x34')]?_0x1cba0e[_0x6d52('0x33')]:_0x25b5a9[_0x6d52('0x2f')];_0x1cba0e[_0x6d52('0x36')]=qs[_0x6d52('0x37')](_0x3b5d6f[_0x6d52('0x30')][_0x6d52('0x37')]);_0x1cba0e['where']=qs['filters'](_[_0x6d52('0x3a')](_0x3b5d6f[_0x6d52('0x30')],_0x25b5a9['filters']));if(_0x3b5d6f[_0x6d52('0x30')][_0x6d52('0x3b')]){_0x1cba0e[_0x6d52('0x38')]=_[_0x6d52('0x3c')](_0x1cba0e['where'],{'$or':_[_0x6d52('0x2a')](_0x1cba0e[_0x6d52('0x33')],function(_0x4bbe78){var _0x4d16a6={};_0x4d16a6[_0x4bbe78]={'$like':'%'+_0x3b5d6f[_0x6d52('0x30')][_0x6d52('0x3b')]+'%'};return _0x4d16a6;})});}_0x1cba0e=_[_0x6d52('0x3c')]({},_0x1cba0e,_0x3b5d6f[_0x6d52('0x3e')]);return _0x3b5224[_0x6d52('0x47')](_0x1cba0e);}})[_0x6d52('0x25')](function(_0xe77190){if(_0xe77190){_0x24d032=_0xe77190[_0x6d52('0x34')];if(!_0x3b5d6f[_0x6d52('0x30')][_0x6d52('0x35')](_0x6d52('0x4a'))){_0x1cba0e['limit']=qs[_0x6d52('0x1f')](_0x3b5d6f['query'][_0x6d52('0x1f')]);_0x1cba0e[_0x6d52('0x22')]=qs['offset'](_0x3b5d6f[_0x6d52('0x30')][_0x6d52('0x22')]);}return _0x3b5224[_0x6d52('0x47')](_0x1cba0e);}})[_0x6d52('0x25')](function(_0x3b0499){if(_0x3b0499){return _0x3b0499?{'count':_0x24d032,'rows':_0x3b0499}:null;}})['then'](respondWithResult(_0x5ef2c5,null))[_0x6d52('0x41')](handleError(_0x5ef2c5,null));};exports[_0x6d52('0x4b')]=function(_0x226e9c,_0x179cdf,_0x193a44){if(_0x226e9c[_0x6d52('0x46')]['id']){delete _0x226e9c[_0x6d52('0x46')]['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x226e9c[_0x6d52('0x42')]['id']}})[_0x6d52('0x25')](handleEntityNotFound(_0x179cdf,null))[_0x6d52('0x25')](function(_0x4ad7d9){if(_0x4ad7d9){_0x226e9c[_0x6d52('0x46')][_0x6d52('0x4c')]=_0x4ad7d9['id'];_0x226e9c[_0x6d52('0x46')][_0x6d52('0x4d')]=integrations['getSubjects'](_0x226e9c['body'][_0x6d52('0x4e')],_0x226e9c['body']['type']);_0x226e9c[_0x6d52('0x46')]['Descriptions']=integrations[_0x6d52('0x4f')](_0x226e9c[_0x6d52('0x46')][_0x6d52('0x4e')],_0x226e9c[_0x6d52('0x46')][_0x6d52('0x2d')]);return db[_0x6d52('0x49')][_0x6d52('0x45')](_0x226e9c[_0x6d52('0x46')],{'include':[{'model':db[_0x6d52('0x50')],'as':'Subjects'},{'model':db[_0x6d52('0x50')],'as':_0x6d52('0x51')}]});}return null;})[_0x6d52('0x25')](respondWithResult(_0x179cdf,null))[_0x6d52('0x41')](handleError(_0x179cdf,null));};exports[_0x6d52('0x52')]=function(_0x2ef310,_0x4aeaf5,_0x1544ba){var _0x2368a8='';var _0x2ccdfa='';return db[_0x6d52('0x2b')][_0x6d52('0x48')]({'where':{'id':_0x2ef310['params']['id']},'attributes':['id',_0x6d52('0x53'),'remoteUri',_0x6d52('0x54')]})[_0x6d52('0x25')](handleEntityNotFound(_0x4aeaf5,null))[_0x6d52('0x25')](function(_0x167d14){if(_0x167d14){_0x2ccdfa=_0x167d14[_0x6d52('0x53')];_0x2368a8=_0x167d14['remoteUri'];var _0x2d13d4=_0x167d14[_0x6d52('0x55')]['slice'](-0x1);if(_0x2d13d4==='/'){_0x2368a8=_0x2368a8[_0x6d52('0x56')](0x0,_0x2368a8[_0x6d52('0x57')](_0x2d13d4));}return rp({'method':_0x6d52('0x58'),'uri':util[_0x6d52('0x59')]('%s%s',_0x2368a8,_0x6d52('0x5a')),'headers':{'Authorization':_0x6d52('0x5b')+_0x167d14[_0x6d52('0x54')]},'json':!![]});}})[_0x6d52('0x25')](function(_0x24f938){if(_0x24f938){var _0x3a826c=_0x24f938[_0x6d52('0x5c')];var _0x49cf29=![];var _0x1d3028=null;for(_0x1d3028=0x0;_0x1d3028<_0x3a826c['length'];_0x1d3028++){if(_0x3a826c[_0x1d3028][_0x6d52('0x5d')]===_0x2ccdfa){_0x49cf29=!![];}}if(_0x49cf29){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x6d52('0x5e')});}}})[_0x6d52('0x25')](respondWithResult(_0x4aeaf5,null))[_0x6d52('0x41')](function(_0x10296e){var _0x199d5c=_0x2ef310['query']['test']?0x1f4:_0x10296e['statusCode']||0x1f4;logger[_0x6d52('0x27')](_0x6d52('0x5f'),'getFields',_0x199d5c,JSON[_0x6d52('0x60')](_0x10296e));delete _0x10296e[_0x6d52('0x29')];if(_0x199d5c===0x191){_0x199d5c=0x190;}_0x4aeaf5[_0x6d52('0x1c')](_0x199d5c)['send'](_0x2ef310[_0x6d52('0x30')][_0x6d52('0x61')]?{'message':'Wrong\x20credentials','statusCode':_0x10296e[_0x6d52('0x62')]}:_0x10296e);});}; \ No newline at end of file +var _0xa536=['crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','FreshsalesAccount','rawAttributes','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','findAll','rows','show','params','keys','include','find','catch','create','body','findOne','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','username','remoteUri','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xa536,0x1ee));var _0x6a53=function(_0x225afd,_0x184394){_0x225afd=_0x225afd-0x0;var _0x4bb118=_0xa536[_0x225afd];return _0x4bb118;};'use strict';var emlformat=require(_0x6a53('0x0'));var rimraf=require(_0x6a53('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6a53('0x2'));var rp=require(_0x6a53('0x3'));var moment=require(_0x6a53('0x4'));var BPromise=require(_0x6a53('0x5'));var Mustache=require(_0x6a53('0x6'));var util=require(_0x6a53('0x7'));var path=require(_0x6a53('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6a53('0x9'));var fs=require('fs');var fs_extra=require(_0x6a53('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6a53('0xb'));var jsforce=require(_0x6a53('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6a53('0xd'));var querystring=require('querystring');var Papa=require(_0x6a53('0xe'));var Redis=require(_0x6a53('0xf'));var authService=require(_0x6a53('0x10'));var qs=require(_0x6a53('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6a53('0x12'));var utils=require(_0x6a53('0x13'));var config=require(_0x6a53('0x14'));var licenseUtil=require(_0x6a53('0x15'));var db=require(_0x6a53('0x16'))['db'];var integrations=require(_0x6a53('0x17'));function respondWithStatusCode(_0x4f08de,_0x10cdc6){_0x10cdc6=_0x10cdc6||0xcc;return function(_0x467180){if(_0x467180){return _0x4f08de['sendStatus'](_0x10cdc6);}return _0x4f08de[_0x6a53('0x18')](_0x10cdc6)[_0x6a53('0x19')]();};}function respondWithResult(_0x523f25,_0x1cc556){_0x1cc556=_0x1cc556||0xc8;return function(_0x579e7c){if(_0x579e7c){return _0x523f25[_0x6a53('0x18')](_0x1cc556)[_0x6a53('0x1a')](_0x579e7c);}};}function respondWithFilteredResult(_0x2b41e7,_0x5aa3d3){return function(_0x50bccf){if(_0x50bccf){var _0x37998d=typeof _0x5aa3d3[_0x6a53('0x1b')]===_0x6a53('0x1c')&&typeof _0x5aa3d3['limit']===_0x6a53('0x1c');var _0x33e1f3=_0x50bccf[_0x6a53('0x1d')];var _0x449825=_0x37998d?0x0:_0x5aa3d3[_0x6a53('0x1b')];var _0x5c86bc=_0x37998d?_0x50bccf[_0x6a53('0x1d')]:_0x5aa3d3[_0x6a53('0x1b')]+_0x5aa3d3[_0x6a53('0x1e')];var _0x2faabf;if(_0x5c86bc>=_0x33e1f3){_0x5c86bc=_0x33e1f3;_0x2faabf=0xc8;}else{_0x2faabf=0xce;}_0x2b41e7['status'](_0x2faabf);return _0x2b41e7[_0x6a53('0x1f')](_0x6a53('0x20'),_0x449825+'-'+_0x5c86bc+'/'+_0x33e1f3)[_0x6a53('0x1a')](_0x50bccf);}return null;};}function patchUpdates(_0x520d96){return function(_0x4c1d86){try{jsonpatch[_0x6a53('0x21')](_0x4c1d86,_0x520d96,!![]);}catch(_0x360536){return BPromise['reject'](_0x360536);}return _0x4c1d86[_0x6a53('0x22')]();};}function saveUpdates(_0xcb0ebb,_0x217e39){return function(_0x476d3e){if(_0x476d3e){return _0x476d3e[_0x6a53('0x23')](_0xcb0ebb)[_0x6a53('0x24')](function(_0x4eccd8){return _0x4eccd8;});}return null;};}function removeEntity(_0x332edd,_0x1d009a){return function(_0x2f1667){if(_0x2f1667){return _0x2f1667[_0x6a53('0x25')]()[_0x6a53('0x24')](function(){_0x332edd[_0x6a53('0x18')](0xcc)[_0x6a53('0x19')]();});}};}function handleEntityNotFound(_0xdccbc7,_0x2f1e8a){return function(_0x383b47){if(!_0x383b47){_0xdccbc7['sendStatus'](0x194);}return _0x383b47;};}function handleError(_0x228405,_0x419f90){_0x419f90=_0x419f90||0x1f4;return function(_0x415cb7){logger[_0x6a53('0x26')](_0x415cb7[_0x6a53('0x27')]);if(_0x415cb7[_0x6a53('0x28')]){delete _0x415cb7[_0x6a53('0x28')];}_0x228405[_0x6a53('0x18')](_0x419f90)[_0x6a53('0x29')](_0x415cb7);};}exports['index']=function(_0x2bb1ab,_0x187192){var _0xa64dd6={},_0x2500df={},_0x13132c={'count':0x0,'rows':[]};var _0x1b8e43=_[_0x6a53('0x2a')](db[_0x6a53('0x2b')][_0x6a53('0x2c')],function(_0x3dccc2){return{'name':_0x3dccc2['fieldName'],'type':_0x3dccc2[_0x6a53('0x2d')][_0x6a53('0x2e')]};});_0x2500df['model']=_['map'](_0x1b8e43,_0x6a53('0x28'));_0x2500df[_0x6a53('0x2f')]=_['keys'](_0x2bb1ab[_0x6a53('0x2f')]);_0x2500df['filters']=_['intersection'](_0x2500df[_0x6a53('0x30')],_0x2500df['query']);_0xa64dd6[_0x6a53('0x31')]=_[_0x6a53('0x32')](_0x2500df[_0x6a53('0x30')],qs[_0x6a53('0x33')](_0x2bb1ab[_0x6a53('0x2f')][_0x6a53('0x33')]));_0xa64dd6[_0x6a53('0x31')]=_0xa64dd6[_0x6a53('0x31')][_0x6a53('0x34')]?_0xa64dd6['attributes']:_0x2500df[_0x6a53('0x30')];if(!_0x2bb1ab[_0x6a53('0x2f')][_0x6a53('0x35')](_0x6a53('0x36'))){_0xa64dd6[_0x6a53('0x1e')]=qs[_0x6a53('0x1e')](_0x2bb1ab[_0x6a53('0x2f')]['limit']);_0xa64dd6[_0x6a53('0x1b')]=qs[_0x6a53('0x1b')](_0x2bb1ab[_0x6a53('0x2f')][_0x6a53('0x1b')]);}_0xa64dd6[_0x6a53('0x37')]=qs[_0x6a53('0x38')](_0x2bb1ab['query'][_0x6a53('0x38')]);_0xa64dd6['where']=qs[_0x6a53('0x39')](_[_0x6a53('0x3a')](_0x2bb1ab[_0x6a53('0x2f')],_0x2500df[_0x6a53('0x39')]),_0x1b8e43);if(_0x2bb1ab[_0x6a53('0x2f')][_0x6a53('0x3b')]){_0xa64dd6[_0x6a53('0x3c')]=_['merge'](_0xa64dd6[_0x6a53('0x3c')],{'$or':_['map'](_0x1b8e43,function(_0x1944d6){if(_0x1944d6[_0x6a53('0x2d')]!=='VIRTUAL'){var _0x38b8b8={};_0x38b8b8[_0x1944d6[_0x6a53('0x28')]]={'$like':'%'+_0x2bb1ab[_0x6a53('0x2f')][_0x6a53('0x3b')]+'%'};return _0x38b8b8;}})});}_0xa64dd6=_[_0x6a53('0x3d')]({},_0xa64dd6,_0x2bb1ab[_0x6a53('0x3e')]);var _0x195215={'where':_0xa64dd6[_0x6a53('0x3c')]};return db[_0x6a53('0x2b')][_0x6a53('0x1d')](_0x195215)[_0x6a53('0x24')](function(_0x3314ae){_0x13132c['count']=_0x3314ae;if(_0x2bb1ab[_0x6a53('0x2f')][_0x6a53('0x3f')]){_0xa64dd6['include']=[{'all':!![]}];}return db[_0x6a53('0x2b')][_0x6a53('0x40')](_0xa64dd6);})[_0x6a53('0x24')](function(_0x223b1c){_0x13132c[_0x6a53('0x41')]=_0x223b1c;return _0x13132c;})[_0x6a53('0x24')](respondWithFilteredResult(_0x187192,_0xa64dd6))['catch'](handleError(_0x187192,null));};exports[_0x6a53('0x42')]=function(_0xa93664,_0x2bfedc){var _0x213b5a={'raw':![],'where':{'id':_0xa93664[_0x6a53('0x43')]['id']}},_0x2521b9={};_0x2521b9['model']=_[_0x6a53('0x44')](db[_0x6a53('0x2b')][_0x6a53('0x2c')]);_0x2521b9['query']=_['keys'](_0xa93664[_0x6a53('0x2f')]);_0x2521b9['filters']=_[_0x6a53('0x32')](_0x2521b9[_0x6a53('0x30')],_0x2521b9[_0x6a53('0x2f')]);_0x213b5a[_0x6a53('0x31')]=_[_0x6a53('0x32')](_0x2521b9[_0x6a53('0x30')],qs[_0x6a53('0x33')](_0xa93664[_0x6a53('0x2f')]['fields']));_0x213b5a[_0x6a53('0x31')]=_0x213b5a['attributes'][_0x6a53('0x34')]?_0x213b5a[_0x6a53('0x31')]:_0x2521b9['model'];if(_0xa93664[_0x6a53('0x2f')]['includeAll']){_0x213b5a[_0x6a53('0x45')]=[{'all':!![]}];}_0x213b5a=_['merge']({},_0x213b5a,_0xa93664[_0x6a53('0x3e')]);return db[_0x6a53('0x2b')][_0x6a53('0x46')](_0x213b5a)[_0x6a53('0x24')](handleEntityNotFound(_0x2bfedc,null))[_0x6a53('0x24')](respondWithResult(_0x2bfedc,null))[_0x6a53('0x47')](handleError(_0x2bfedc,null));};exports[_0x6a53('0x48')]=function(_0x2fcbd8,_0x494ba3){return db[_0x6a53('0x2b')]['create'](_0x2fcbd8[_0x6a53('0x49')],{})[_0x6a53('0x24')](respondWithResult(_0x494ba3,0xc9))[_0x6a53('0x47')](handleError(_0x494ba3,null));};exports[_0x6a53('0x23')]=function(_0x2ba4fd,_0x1c3638){if(_0x2ba4fd[_0x6a53('0x49')]['id']){delete _0x2ba4fd[_0x6a53('0x49')]['id'];}return db['FreshsalesAccount'][_0x6a53('0x46')]({'where':{'id':_0x2ba4fd[_0x6a53('0x43')]['id']}})['then'](handleEntityNotFound(_0x1c3638,null))[_0x6a53('0x24')](saveUpdates(_0x2ba4fd[_0x6a53('0x49')],null))[_0x6a53('0x24')](respondWithResult(_0x1c3638,null))[_0x6a53('0x47')](handleError(_0x1c3638,null));};exports[_0x6a53('0x25')]=function(_0x348b84,_0x20e5ca){return db[_0x6a53('0x2b')]['find']({'where':{'id':_0x348b84['params']['id']}})[_0x6a53('0x24')](handleEntityNotFound(_0x20e5ca,null))[_0x6a53('0x24')](removeEntity(_0x20e5ca,null))['catch'](handleError(_0x20e5ca,null));};exports['getConfigurations']=function(_0xdaf1d2,_0xdd3145,_0x18c243){var _0x1abdd0={};var _0x293a1a={};var _0x1448b8;var _0x5858a9;return db[_0x6a53('0x2b')][_0x6a53('0x4a')]({'where':{'id':_0xdaf1d2['params']['id']}})['then'](handleEntityNotFound(_0xdd3145,null))[_0x6a53('0x24')](function(_0x1b814e){if(_0x1b814e){_0x1448b8=_0x1b814e;_0x293a1a[_0x6a53('0x30')]=_[_0x6a53('0x44')](db['FreshsalesConfiguration'][_0x6a53('0x2c')]);_0x293a1a['query']=_[_0x6a53('0x44')](_0xdaf1d2[_0x6a53('0x2f')]);_0x293a1a[_0x6a53('0x39')]=_[_0x6a53('0x32')](_0x293a1a['model'],_0x293a1a[_0x6a53('0x2f')]);_0x1abdd0[_0x6a53('0x31')]=_[_0x6a53('0x32')](_0x293a1a['model'],qs[_0x6a53('0x33')](_0xdaf1d2[_0x6a53('0x2f')][_0x6a53('0x33')]));_0x1abdd0['attributes']=_0x1abdd0[_0x6a53('0x31')][_0x6a53('0x34')]?_0x1abdd0[_0x6a53('0x31')]:_0x293a1a[_0x6a53('0x30')];_0x1abdd0[_0x6a53('0x37')]=qs['sort'](_0xdaf1d2[_0x6a53('0x2f')][_0x6a53('0x38')]);_0x1abdd0[_0x6a53('0x3c')]=qs[_0x6a53('0x39')](_['pick'](_0xdaf1d2[_0x6a53('0x2f')],_0x293a1a[_0x6a53('0x39')]));if(_0xdaf1d2[_0x6a53('0x2f')][_0x6a53('0x3b')]){_0x1abdd0[_0x6a53('0x3c')]=_[_0x6a53('0x3d')](_0x1abdd0[_0x6a53('0x3c')],{'$or':_[_0x6a53('0x2a')](_0x1abdd0[_0x6a53('0x31')],function(_0x5a83a0){var _0x2b5f7f={};_0x2b5f7f[_0x5a83a0]={'$like':'%'+_0xdaf1d2[_0x6a53('0x2f')][_0x6a53('0x3b')]+'%'};return _0x2b5f7f;})});}_0x1abdd0=_[_0x6a53('0x3d')]({},_0x1abdd0,_0xdaf1d2[_0x6a53('0x3e')]);return _0x1448b8[_0x6a53('0x4b')](_0x1abdd0);}})[_0x6a53('0x24')](function(_0xa6a953){if(_0xa6a953){_0x5858a9=_0xa6a953[_0x6a53('0x34')];if(!_0xdaf1d2[_0x6a53('0x2f')][_0x6a53('0x35')]('nolimit')){_0x1abdd0['limit']=qs['limit'](_0xdaf1d2[_0x6a53('0x2f')][_0x6a53('0x1e')]);_0x1abdd0[_0x6a53('0x1b')]=qs[_0x6a53('0x1b')](_0xdaf1d2[_0x6a53('0x2f')][_0x6a53('0x1b')]);}return _0x1448b8[_0x6a53('0x4b')](_0x1abdd0);}})[_0x6a53('0x24')](function(_0x10796b){if(_0x10796b){return _0x10796b?{'count':_0x5858a9,'rows':_0x10796b}:null;}})[_0x6a53('0x24')](respondWithResult(_0xdd3145,null))[_0x6a53('0x47')](handleError(_0xdd3145,null));};exports['addConfiguration']=function(_0x43489f,_0x274225,_0x26d940){if(_0x43489f[_0x6a53('0x49')]['id']){delete _0x43489f[_0x6a53('0x49')]['id'];}return db[_0x6a53('0x2b')]['findOne']({'where':{'id':_0x43489f[_0x6a53('0x43')]['id']}})[_0x6a53('0x24')](handleEntityNotFound(_0x274225,null))[_0x6a53('0x24')](function(_0x378974){if(_0x378974){_0x43489f[_0x6a53('0x49')][_0x6a53('0x4c')]=_0x378974['id'];_0x43489f[_0x6a53('0x49')][_0x6a53('0x4d')]=integrations[_0x6a53('0x4e')](_0x43489f[_0x6a53('0x49')][_0x6a53('0x4f')],_0x43489f[_0x6a53('0x49')][_0x6a53('0x2d')]);_0x43489f[_0x6a53('0x49')][_0x6a53('0x50')]=integrations[_0x6a53('0x51')](_0x43489f[_0x6a53('0x49')][_0x6a53('0x4f')],_0x43489f['body']['type']);return db['FreshsalesConfiguration'][_0x6a53('0x48')](_0x43489f[_0x6a53('0x49')],{'include':[{'model':db[_0x6a53('0x52')],'as':_0x6a53('0x4d')},{'model':db[_0x6a53('0x52')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x274225,null))[_0x6a53('0x47')](handleError(_0x274225,null));};exports['getFields']=function(_0x51890c,_0x1a72bb,_0xaa4e52){var _0x26b25a='';var _0x4f6fe6='';return db[_0x6a53('0x2b')][_0x6a53('0x4a')]({'where':{'id':_0x51890c[_0x6a53('0x43')]['id']},'attributes':['id',_0x6a53('0x53'),_0x6a53('0x54'),'apiKey']})[_0x6a53('0x24')](handleEntityNotFound(_0x1a72bb,null))[_0x6a53('0x24')](function(_0x2879f9){if(_0x2879f9){_0x4f6fe6=_0x2879f9[_0x6a53('0x53')];_0x26b25a=_0x2879f9[_0x6a53('0x54')];var _0x36b6a9=_0x2879f9[_0x6a53('0x54')]['slice'](-0x1);if(_0x36b6a9==='/'){_0x26b25a=_0x26b25a[_0x6a53('0x55')](0x0,_0x26b25a[_0x6a53('0x56')](_0x36b6a9));}return rp({'method':_0x6a53('0x57'),'uri':util[_0x6a53('0x58')](_0x6a53('0x59'),_0x26b25a,_0x6a53('0x5a')),'headers':{'Authorization':_0x6a53('0x5b')+_0x2879f9[_0x6a53('0x5c')]},'json':!![]});}})['then'](function(_0x5eee1b){if(_0x5eee1b){var _0x2ba319=_0x5eee1b[_0x6a53('0x5d')];var _0x2803ad=![];var _0x407a5b=null;for(_0x407a5b=0x0;_0x407a5b<_0x2ba319[_0x6a53('0x34')];_0x407a5b++){if(_0x2ba319[_0x407a5b][_0x6a53('0x5e')]===_0x4f6fe6){_0x2803ad=!![];}}if(_0x2803ad){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x1a72bb,null))[_0x6a53('0x47')](function(_0x28e3c4){var _0x5b23b6=_0x51890c[_0x6a53('0x2f')]['test']?0x1f4:_0x28e3c4[_0x6a53('0x5f')]||0x1f4;logger[_0x6a53('0x26')](_0x6a53('0x60'),_0x6a53('0x61'),_0x5b23b6,JSON[_0x6a53('0x62')](_0x28e3c4));delete _0x28e3c4['name'];if(_0x5b23b6===0x191){_0x5b23b6=0x190;}_0x1a72bb[_0x6a53('0x18')](_0x5b23b6)[_0x6a53('0x29')](_0x51890c['query'][_0x6a53('0x63')]?{'message':_0x6a53('0x64'),'statusCode':_0x28e3c4['statusCode']}:_0x28e3c4);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index adc131d..4940c4a 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 _0x11e5=['path','../../config/environment','exports','int_freshsales_accounts','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x11e5,0x8b));var _0x511e=function(_0x9c607a,_0x1cb2c6){_0x9c607a=_0x9c607a-0x0;var _0x3b1311=_0x11e5[_0x9c607a];return _0x3b1311;};'use strict';var _=require(_0x511e('0x0'));var util=require('util');var logger=require(_0x511e('0x1'))(_0x511e('0x2'));var moment=require('moment');var BPromise=require(_0x511e('0x3'));var rp=require(_0x511e('0x4'));var fs=require('fs');var path=require(_0x511e('0x5'));var rimraf=require('rimraf');var config=require(_0x511e('0x6'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x511e('0x7')]=function(_0x323f8c,_0x466dec){return _0x323f8c['define']('FreshsalesAccount',attributes,{'tableName':_0x511e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f0e=['define','FreshsalesAccount','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x838baf,_0x4243d9){var _0x20fc7d=function(_0x9b2d1b){while(--_0x9b2d1b){_0x838baf['push'](_0x838baf['shift']());}};_0x20fc7d(++_0x4243d9);}(_0x9f0e,0x116));var _0xe9f0=function(_0x7f8c63,_0x58f1b0){_0x7f8c63=_0x7f8c63-0x0;var _0x239b71=_0x9f0e[_0x7f8c63];return _0x239b71;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var logger=require(_0xe9f0('0x2'))(_0xe9f0('0x3'));var moment=require(_0xe9f0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9f0('0x5'));var rimraf=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var attributes=require(_0xe9f0('0x8'));var integrations=require(_0xe9f0('0x9'));module['exports']=function(_0x5b87c1,_0x3a17b3){return _0x5b87c1[_0xe9f0('0xa')](_0xe9f0('0xb'),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 ed0ac16..2b8bd1b 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 _0x77d4=['util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowFreshsalesAccount','find'];(function(_0x3767fa,_0x4822f4){var _0x4973d7=function(_0x6d8d13){while(--_0x6d8d13){_0x3767fa['push'](_0x3767fa['shift']());}};_0x4973d7(++_0x4822f4);}(_0x77d4,0x108));var _0x477d=function(_0x39d6c1,_0x2a7894){_0x39d6c1=_0x39d6c1-0x0;var _0x5da7bd=_0x77d4[_0x39d6c1];return _0x5da7bd;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var moment=require('moment');var BPromise=require(_0x477d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x477d('0x2'));var db=require(_0x477d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x477d('0x4'));var config=require(_0x477d('0x5'));var jayson=require(_0x477d('0x6'));var client=jayson[_0x477d('0x7')][_0x477d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45ca2d,_0x5153df,_0x4f4fb4){return new BPromise(function(_0x2dd5d2,_0x579859){return client['request'](_0x45ca2d,_0x4f4fb4)[_0x477d('0x9')](function(_0x29f11b){logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));logger['debug'](_0x477d('0xd'),_0x5153df,'request\x20sent',JSON[_0x477d('0xe')](_0x29f11b));if(_0x29f11b[_0x477d('0xf')]){if(_0x29f11b['error'][_0x477d('0x10')]===0x1f4){logger[_0x477d('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x5153df,_0x29f11b['error'][_0x477d('0x11')]);return _0x579859(_0x29f11b[_0x477d('0xf')]['message']);}logger[_0x477d('0xf')](_0x477d('0xb'),_0x5153df,_0x29f11b['error']['message']);return _0x2dd5d2(_0x29f11b[_0x477d('0xf')]['message']);}else{logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));_0x2dd5d2(_0x29f11b['result'][_0x477d('0x11')]);}})[_0x477d('0x12')](function(_0x29c6f8){logger[_0x477d('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x5153df,_0x29c6f8);_0x579859(_0x29c6f8);});});}exports[_0x477d('0x13')]=function(_0x5d5553){var _0x367965=this;return new Promise(function(_0x1399d7,_0x159beb){return db[_0x477d('0x14')][_0x477d('0x15')]({'raw':_0x5d5553[_0x477d('0x16')]?_0x5d5553['options'][_0x477d('0x17')]===undefined?!![]:![]:!![],'where':_0x5d5553['options']?_0x5d5553[_0x477d('0x16')][_0x477d('0x18')]||null:null,'attributes':_0x5d5553[_0x477d('0x16')]?_0x5d5553[_0x477d('0x16')][_0x477d('0x19')]||null:null,'limit':_0x5d5553[_0x477d('0x16')]?_0x5d5553[_0x477d('0x16')][_0x477d('0x1a')]||null:null,'include':_0x5d5553[_0x477d('0x16')]?_0x5d5553[_0x477d('0x16')][_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x5d5553[_0x477d('0x16')][_0x477d('0x1b')],function(_0x4e6a44){return{'model':db[_0x4e6a44[_0x477d('0x1d')]],'as':_0x4e6a44['as'],'attributes':_0x4e6a44['attributes'],'include':_0x4e6a44[_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x4e6a44[_0x477d('0x1b')],function(_0x2287b4){return{'model':db[_0x2287b4['model']],'as':_0x2287b4['as'],'attributes':_0x2287b4[_0x477d('0x19')],'include':_0x2287b4[_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x2287b4['include'],function(_0x585648){return{'model':db[_0x585648[_0x477d('0x1d')]],'as':_0x585648['as'],'attributes':_0x585648[_0x477d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x477d('0x9')](function(_0x5c8ef1){logger[_0x477d('0xa')](_0x477d('0x13'),_0x5d5553);logger[_0x477d('0x1e')](_0x477d('0x13'),_0x5d5553,JSON[_0x477d('0xe')](_0x5c8ef1));_0x1399d7(_0x5c8ef1);})['catch'](function(_0x2fc959){logger[_0x477d('0xf')](_0x477d('0x13'),_0x2fc959[_0x477d('0x11')],_0x5d5553);_0x159beb(_0x367965[_0x477d('0xf')](0x1f4,_0x2fc959[_0x477d('0x11')]));});});};exports[_0x477d('0x1f')]=function(_0x98b5d9){var _0x204541=this;return new Promise(function(_0x8fe6c4,_0x41b790){return db[_0x477d('0x14')][_0x477d('0x20')]({'raw':_0x98b5d9[_0x477d('0x16')]?_0x98b5d9[_0x477d('0x16')][_0x477d('0x17')]===undefined?!![]:![]:!![],'where':_0x98b5d9[_0x477d('0x16')]?_0x98b5d9[_0x477d('0x16')][_0x477d('0x18')]||null:null,'attributes':_0x98b5d9[_0x477d('0x16')]?_0x98b5d9['options'][_0x477d('0x19')]||null:null,'include':_0x98b5d9['options']?_0x98b5d9[_0x477d('0x16')][_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x98b5d9['options'][_0x477d('0x1b')],function(_0x1201a9){return{'model':db[_0x1201a9[_0x477d('0x1d')]],'as':_0x1201a9['as'],'attributes':_0x1201a9[_0x477d('0x19')],'include':_0x1201a9[_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x1201a9[_0x477d('0x1b')],function(_0xf84c4c){return{'model':db[_0xf84c4c[_0x477d('0x1d')]],'as':_0xf84c4c['as'],'attributes':_0xf84c4c[_0x477d('0x19')],'include':_0xf84c4c['include']?_[_0x477d('0x1c')](_0xf84c4c[_0x477d('0x1b')],function(_0xb41cd8){return{'model':db[_0xb41cd8['model']],'as':_0xb41cd8['as'],'attributes':_0xb41cd8[_0x477d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x477d('0x9')](function(_0x1b0410){logger['info']('ShowFreshsalesAccount',_0x98b5d9);logger[_0x477d('0x1e')](_0x477d('0x1f'),_0x98b5d9,JSON[_0x477d('0xe')](_0x1b0410));_0x8fe6c4(_0x1b0410);})[_0x477d('0x12')](function(_0x1c0d86){logger['error'](_0x477d('0x1f'),_0x1c0d86['message'],_0x98b5d9);_0x41b790(_0x204541[_0x477d('0xf')](0x1f4,_0x1c0d86[_0x477d('0x11')]));});});}; \ No newline at end of file +var _0x0424=['info','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','limit','include','model','map','ShowFreshsalesAccount','find','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x2ee2dd,_0x3faf72){var _0x5b7475=function(_0x3dd02f){while(--_0x3dd02f){_0x2ee2dd['push'](_0x2ee2dd['shift']());}};_0x5b7475(++_0x3faf72);}(_0x0424,0x159));var _0x4042=function(_0x377ddf,_0x102e9a){_0x377ddf=_0x377ddf-0x0;var _0x5b8465=_0x0424[_0x377ddf];return _0x5b8465;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3abaf1,_0xa5310f,_0x10ec07){return new BPromise(function(_0x5d11bf,_0x509772){return client[_0x4042('0x9')](_0x3abaf1,_0x10ec07)[_0x4042('0xa')](function(_0x103e4a){logger['info'](_0x4042('0xb'),_0xa5310f,_0x4042('0xc'));logger[_0x4042('0xd')](_0x4042('0xe'),_0xa5310f,_0x4042('0xc'),JSON[_0x4042('0xf')](_0x103e4a));if(_0x103e4a[_0x4042('0x10')]){if(_0x103e4a[_0x4042('0x10')]['code']===0x1f4){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a['error'][_0x4042('0x11')]);return _0x509772(_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);}logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);return _0x5d11bf(_0x103e4a['error'][_0x4042('0x11')]);}else{logger[_0x4042('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0xa5310f,_0x4042('0xc'));_0x5d11bf(_0x103e4a[_0x4042('0x13')][_0x4042('0x11')]);}})[_0x4042('0x14')](function(_0x31e765){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x31e765);_0x509772(_0x31e765);});});}exports[_0x4042('0x15')]=function(_0x466077){var _0x4b02d4=this;return new Promise(function(_0xe5c1ec,_0x4fe024){return db[_0x4042('0x16')]['findAll']({'raw':_0x466077[_0x4042('0x17')]?_0x466077[_0x4042('0x17')][_0x4042('0x18')]===undefined?!![]:![]:!![],'where':_0x466077[_0x4042('0x17')]?_0x466077['options'][_0x4042('0x19')]||null:null,'attributes':_0x466077[_0x4042('0x17')]?_0x466077[_0x4042('0x17')][_0x4042('0x1a')]||null:null,'limit':_0x466077['options']?_0x466077[_0x4042('0x17')][_0x4042('0x1b')]||null:null,'include':_0x466077[_0x4042('0x17')]?_0x466077[_0x4042('0x17')][_0x4042('0x1c')]?_['map'](_0x466077[_0x4042('0x17')][_0x4042('0x1c')],function(_0x519f2c){return{'model':db[_0x519f2c[_0x4042('0x1d')]],'as':_0x519f2c['as'],'attributes':_0x519f2c['attributes'],'include':_0x519f2c[_0x4042('0x1c')]?_[_0x4042('0x1e')](_0x519f2c[_0x4042('0x1c')],function(_0x5d5c6d){return{'model':db[_0x5d5c6d[_0x4042('0x1d')]],'as':_0x5d5c6d['as'],'attributes':_0x5d5c6d[_0x4042('0x1a')],'include':_0x5d5c6d[_0x4042('0x1c')]?_[_0x4042('0x1e')](_0x5d5c6d[_0x4042('0x1c')],function(_0x52e575){return{'model':db[_0x52e575['model']],'as':_0x52e575['as'],'attributes':_0x52e575[_0x4042('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4042('0xa')](function(_0x26542c){logger[_0x4042('0x12')](_0x4042('0x15'),_0x466077);logger[_0x4042('0xd')]('GetFreshsalesAccount',_0x466077,JSON[_0x4042('0xf')](_0x26542c));_0xe5c1ec(_0x26542c);})[_0x4042('0x14')](function(_0x4a6a6e){logger[_0x4042('0x10')](_0x4042('0x15'),_0x4a6a6e[_0x4042('0x11')],_0x466077);_0x4fe024(_0x4b02d4['error'](0x1f4,_0x4a6a6e['message']));});});};exports[_0x4042('0x1f')]=function(_0x43bd1c){var _0x59773f=this;return new Promise(function(_0x3e9304,_0xc42d70){return db[_0x4042('0x16')][_0x4042('0x20')]({'raw':_0x43bd1c[_0x4042('0x17')]?_0x43bd1c[_0x4042('0x17')][_0x4042('0x18')]===undefined?!![]:![]:!![],'where':_0x43bd1c[_0x4042('0x17')]?_0x43bd1c[_0x4042('0x17')]['where']||null:null,'attributes':_0x43bd1c[_0x4042('0x17')]?_0x43bd1c[_0x4042('0x17')]['attributes']||null:null,'include':_0x43bd1c[_0x4042('0x17')]?_0x43bd1c[_0x4042('0x17')]['include']?_[_0x4042('0x1e')](_0x43bd1c[_0x4042('0x17')][_0x4042('0x1c')],function(_0xaa7c99){return{'model':db[_0xaa7c99[_0x4042('0x1d')]],'as':_0xaa7c99['as'],'attributes':_0xaa7c99[_0x4042('0x1a')],'include':_0xaa7c99[_0x4042('0x1c')]?_[_0x4042('0x1e')](_0xaa7c99[_0x4042('0x1c')],function(_0x37195b){return{'model':db[_0x37195b[_0x4042('0x1d')]],'as':_0x37195b['as'],'attributes':_0x37195b[_0x4042('0x1a')],'include':_0x37195b[_0x4042('0x1c')]?_[_0x4042('0x1e')](_0x37195b[_0x4042('0x1c')],function(_0x2b5f5e){return{'model':db[_0x2b5f5e[_0x4042('0x1d')]],'as':_0x2b5f5e['as'],'attributes':_0x2b5f5e[_0x4042('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4042('0xa')](function(_0x26b7b0){logger[_0x4042('0x12')]('ShowFreshsalesAccount',_0x43bd1c);logger[_0x4042('0xd')](_0x4042('0x1f'),_0x43bd1c,JSON[_0x4042('0xf')](_0x26b7b0));_0x3e9304(_0x26b7b0);})[_0x4042('0x14')](function(_0x588932){logger[_0x4042('0x10')](_0x4042('0x1f'),_0x588932[_0x4042('0x11')],_0x43bd1c);_0xc42d70(_0x59773f[_0x4042('0x10')](0x1f4,_0x588932[_0x4042('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 74870df..b61af79 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 _0x4a17=['delete','exports','util','connect-timeout','Router','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','index','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','/:id','update'];(function(_0x98971a,_0x551acb){var _0x43e68f=function(_0x402325){while(--_0x402325){_0x98971a['push'](_0x98971a['shift']());}};_0x43e68f(++_0x551acb);}(_0x4a17,0xb2));var _0x74a1=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x4a17[_0x46d0c9];return _0x174506;};'use strict';var multer=require('multer');var util=require(_0x74a1('0x0'));var path=require('path');var timeout=require(_0x74a1('0x1'));var express=require('express');var router=express[_0x74a1('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x74a1('0x3'));var config=require('../../config/environment');var controller=require(_0x74a1('0x4'));router[_0x74a1('0x5')]('/',auth['isAuthenticated'](),controller[_0x74a1('0x6')]);router[_0x74a1('0x5')]('/:id',auth[_0x74a1('0x7')](),controller[_0x74a1('0x8')]);router[_0x74a1('0x5')](_0x74a1('0x9'),auth[_0x74a1('0x7')](),controller[_0x74a1('0xa')]);router[_0x74a1('0x5')](_0x74a1('0xb'),auth[_0x74a1('0x7')](),controller[_0x74a1('0xc')]);router['get'](_0x74a1('0xd'),auth[_0x74a1('0x7')](),controller[_0x74a1('0xe')]);router[_0x74a1('0xf')]('/',auth[_0x74a1('0x7')](),controller[_0x74a1('0x10')]);router[_0x74a1('0x11')](_0x74a1('0x12'),auth[_0x74a1('0x7')](),controller[_0x74a1('0x13')]);router[_0x74a1('0x14')](_0x74a1('0x12'),auth[_0x74a1('0x7')](),controller['destroy']);module[_0x74a1('0x15')]=router; \ No newline at end of file +var _0xe8f0=['getDescriptions','/:id/fields','getFields','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0xf81816,_0x391f04){var _0x5264a5=function(_0x571b25){while(--_0x571b25){_0xf81816['push'](_0xf81816['shift']());}};_0x5264a5(++_0x391f04);}(_0xe8f0,0x1e3));var _0x0e8f=function(_0x52e073,_0x2f8210){_0x52e073=_0x52e073-0x0;var _0x7b8a45=_0xe8f0[_0x52e073];return _0x7b8a45;};'use strict';var multer=require('multer');var util=require(_0x0e8f('0x0'));var path=require(_0x0e8f('0x1'));var timeout=require(_0x0e8f('0x2'));var express=require(_0x0e8f('0x3'));var router=express[_0x0e8f('0x4')]();var fs_extra=require(_0x0e8f('0x5'));var auth=require(_0x0e8f('0x6'));var interaction=require(_0x0e8f('0x7'));var config=require('../../config/environment');var controller=require(_0x0e8f('0x8'));router[_0x0e8f('0x9')]('/',auth[_0x0e8f('0xa')](),controller[_0x0e8f('0xb')]);router['get'](_0x0e8f('0xc'),auth[_0x0e8f('0xa')](),controller[_0x0e8f('0xd')]);router[_0x0e8f('0x9')](_0x0e8f('0xe'),auth[_0x0e8f('0xa')](),controller[_0x0e8f('0xf')]);router['get'](_0x0e8f('0x10'),auth['isAuthenticated'](),controller[_0x0e8f('0x11')]);router[_0x0e8f('0x9')](_0x0e8f('0x12'),auth['isAuthenticated'](),controller[_0x0e8f('0x13')]);router['post']('/',auth[_0x0e8f('0xa')](),controller[_0x0e8f('0x14')]);router['put'](_0x0e8f('0xc'),auth['isAuthenticated'](),controller[_0x0e8f('0x15')]);router[_0x0e8f('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x0e8f('0x17')]);module[_0x0e8f('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index c711dee..7eb2338 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 _0xe95d=['sequelize','exports','STRING'];(function(_0xaa8100,_0x9a35f6){var _0x310f9f=function(_0x161f68){while(--_0x161f68){_0xaa8100['push'](_0xaa8100['shift']());}};_0x310f9f(++_0x9a35f6);}(_0xe95d,0x1bc));var _0xde95=function(_0x83af7f,_0x49c6fd){_0x83af7f=_0x83af7f-0x0;var _0x32d85c=_0xe95d[_0x83af7f];return _0x32d85c;};'use strict';var Sequelize=require(_0xde95('0x0'));module[_0xde95('0x1')]={'name':{'type':Sequelize[_0xde95('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd39a=['sequelize','STRING'];(function(_0x3467d,_0x239b0e){var _0x8b13e7=function(_0x533510){while(--_0x533510){_0x3467d['push'](_0x3467d['shift']());}};_0x8b13e7(++_0x239b0e);}(_0xd39a,0x1f4));var _0xad39=function(_0x51b169,_0x5efbc2){_0x51b169=_0x51b169-0x0;var _0x12605a=_0xd39a[_0x51b169];return _0x12605a;};'use strict';var Sequelize=require(_0xad39('0x0'));module['exports']={'name':{'type':Sequelize[_0xad39('0x1')]},'description':{'type':Sequelize[_0xad39('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index e1d09aa..3739a19 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 _0xe75c=['set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','index','map','FreshsalesConfiguration','fieldName','key','model','name','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','body','find','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','limit','offset','count'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xe75c,0x172));var _0xce75=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe75c[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0xce75('0x0'));var rimraf=require(_0xce75('0x1'));var zipdir=require(_0xce75('0x2'));var jsonpatch=require(_0xce75('0x3'));var rp=require(_0xce75('0x4'));var moment=require(_0xce75('0x5'));var BPromise=require(_0xce75('0x6'));var Mustache=require(_0xce75('0x7'));var util=require(_0xce75('0x8'));var path=require(_0xce75('0x9'));var sox=require(_0xce75('0xa'));var csv=require('to-csv');var ejs=require(_0xce75('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce75('0xc'));var squel=require(_0xce75('0xd'));var crypto=require(_0xce75('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xce75('0xf'));var toCsv=require('to-csv');var querystring=require(_0xce75('0x10'));var Papa=require('papaparse');var Redis=require(_0xce75('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xce75('0x12'));var as=require(_0xce75('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce75('0x14'))(_0xce75('0x15'));var utils=require(_0xce75('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xce75('0x17'));var db=require(_0xce75('0x18'))['db'];function respondWithStatusCode(_0x64f0,_0x24fb6b){_0x24fb6b=_0x24fb6b||0xcc;return function(_0xc3e3ca){if(_0xc3e3ca){return _0x64f0['sendStatus'](_0x24fb6b);}return _0x64f0[_0xce75('0x19')](_0x24fb6b)['end']();};}function respondWithResult(_0x353187,_0x45a1da){_0x45a1da=_0x45a1da||0xc8;return function(_0x2a98d8){if(_0x2a98d8){return _0x353187[_0xce75('0x19')](_0x45a1da)[_0xce75('0x1a')](_0x2a98d8);}};}function respondWithFilteredResult(_0x452420,_0x27f5c7){return function(_0x5028ff){if(_0x5028ff){var _0x43d077=typeof _0x27f5c7['offset']==='undefined'&&typeof _0x27f5c7[_0xce75('0x1b')]==='undefined';var _0x5c5476=_0x5028ff['count'];var _0x13eb26=_0x43d077?0x0:_0x27f5c7[_0xce75('0x1c')];var _0x449c44=_0x43d077?_0x5028ff[_0xce75('0x1d')]:_0x27f5c7[_0xce75('0x1c')]+_0x27f5c7[_0xce75('0x1b')];var _0x2eeb9a;if(_0x449c44>=_0x5c5476){_0x449c44=_0x5c5476;_0x2eeb9a=0xc8;}else{_0x2eeb9a=0xce;}_0x452420['status'](_0x2eeb9a);return _0x452420[_0xce75('0x1e')](_0xce75('0x1f'),_0x13eb26+'-'+_0x449c44+'/'+_0x5c5476)['json'](_0x5028ff);}return null;};}function patchUpdates(_0x51476c){return function(_0x391fdf){try{jsonpatch['apply'](_0x391fdf,_0x51476c,!![]);}catch(_0x15a540){return BPromise[_0xce75('0x20')](_0x15a540);}return _0x391fdf[_0xce75('0x21')]();};}function saveUpdates(_0x4613cb,_0x39f305){return function(_0x4d567c){if(_0x4d567c){return _0x4d567c[_0xce75('0x22')](_0x4613cb)[_0xce75('0x23')](function(_0x5e287e){return _0x5e287e;});}return null;};}function removeEntity(_0x4326f2,_0x361677){return function(_0xae7e90){if(_0xae7e90){return _0xae7e90[_0xce75('0x24')]()[_0xce75('0x23')](function(){_0x4326f2[_0xce75('0x19')](0xcc)[_0xce75('0x25')]();});}};}function handleEntityNotFound(_0x5c7a4e,_0xb16391){return function(_0x12d708){if(!_0x12d708){_0x5c7a4e[_0xce75('0x26')](0x194);}return _0x12d708;};}function handleError(_0x6feeb8,_0x374693){_0x374693=_0x374693||0x1f4;return function(_0x4a2a80){logger[_0xce75('0x27')](_0x4a2a80[_0xce75('0x28')]);if(_0x4a2a80['name']){delete _0x4a2a80['name'];}_0x6feeb8[_0xce75('0x19')](_0x374693)['send'](_0x4a2a80);};}exports[_0xce75('0x29')]=function(_0x45e8fd,_0x54b1e9){var _0x16d36b={},_0x58ba8c={},_0x5d5323={'count':0x0,'rows':[]};var _0x3604c9=_[_0xce75('0x2a')](db[_0xce75('0x2b')]['rawAttributes'],function(_0x19d4d1){return{'name':_0x19d4d1[_0xce75('0x2c')],'type':_0x19d4d1['type'][_0xce75('0x2d')]};});_0x58ba8c[_0xce75('0x2e')]=_['map'](_0x3604c9,_0xce75('0x2f'));_0x58ba8c[_0xce75('0x30')]=_['keys'](_0x45e8fd[_0xce75('0x30')]);_0x58ba8c['filters']=_[_0xce75('0x31')](_0x58ba8c['model'],_0x58ba8c[_0xce75('0x30')]);_0x16d36b['attributes']=_[_0xce75('0x31')](_0x58ba8c[_0xce75('0x2e')],qs[_0xce75('0x32')](_0x45e8fd[_0xce75('0x30')][_0xce75('0x32')]));_0x16d36b[_0xce75('0x33')]=_0x16d36b[_0xce75('0x33')][_0xce75('0x34')]?_0x16d36b[_0xce75('0x33')]:_0x58ba8c['model'];if(!_0x45e8fd['query'][_0xce75('0x35')](_0xce75('0x36'))){_0x16d36b[_0xce75('0x1b')]=qs[_0xce75('0x1b')](_0x45e8fd[_0xce75('0x30')][_0xce75('0x1b')]);_0x16d36b[_0xce75('0x1c')]=qs[_0xce75('0x1c')](_0x45e8fd[_0xce75('0x30')]['offset']);}_0x16d36b[_0xce75('0x37')]=qs[_0xce75('0x38')](_0x45e8fd[_0xce75('0x30')]['sort']);_0x16d36b[_0xce75('0x39')]=qs[_0xce75('0x3a')](_[_0xce75('0x3b')](_0x45e8fd[_0xce75('0x30')],_0x58ba8c[_0xce75('0x3a')]),_0x3604c9);if(_0x45e8fd['query'][_0xce75('0x3c')]){_0x16d36b[_0xce75('0x39')]=_[_0xce75('0x3d')](_0x16d36b[_0xce75('0x39')],{'$or':_[_0xce75('0x2a')](_0x3604c9,function(_0x339086){if(_0x339086[_0xce75('0x3e')]!==_0xce75('0x3f')){var _0x41b80e={};_0x41b80e[_0x339086['name']]={'$like':'%'+_0x45e8fd[_0xce75('0x30')][_0xce75('0x3c')]+'%'};return _0x41b80e;}})});}_0x16d36b=_[_0xce75('0x3d')]({},_0x16d36b,_0x45e8fd[_0xce75('0x40')]);var _0x56977d={'where':_0x16d36b[_0xce75('0x39')]};return db[_0xce75('0x2b')]['count'](_0x56977d)[_0xce75('0x23')](function(_0x599449){_0x5d5323[_0xce75('0x1d')]=_0x599449;if(_0x45e8fd[_0xce75('0x30')][_0xce75('0x41')]){_0x16d36b[_0xce75('0x42')]=[{'all':!![]}];}return db[_0xce75('0x2b')][_0xce75('0x43')](_0x16d36b);})[_0xce75('0x23')](function(_0x3bf956){_0x5d5323['rows']=_0x3bf956;return _0x5d5323;})[_0xce75('0x23')](respondWithFilteredResult(_0x54b1e9,_0x16d36b))[_0xce75('0x44')](handleError(_0x54b1e9,null));};exports[_0xce75('0x45')]=function(_0x45559b,_0x24c04f){var _0x17ae7a={'raw':![],'where':{'id':_0x45559b[_0xce75('0x46')]['id']}},_0x1ca393={};_0x1ca393[_0xce75('0x2e')]=_[_0xce75('0x47')](db[_0xce75('0x2b')][_0xce75('0x48')]);_0x1ca393[_0xce75('0x30')]=_['keys'](_0x45559b[_0xce75('0x30')]);_0x1ca393[_0xce75('0x3a')]=_['intersection'](_0x1ca393['model'],_0x1ca393[_0xce75('0x30')]);_0x17ae7a['attributes']=_[_0xce75('0x31')](_0x1ca393[_0xce75('0x2e')],qs[_0xce75('0x32')](_0x45559b[_0xce75('0x30')][_0xce75('0x32')]));_0x17ae7a[_0xce75('0x33')]=_0x17ae7a[_0xce75('0x33')]['length']?_0x17ae7a[_0xce75('0x33')]:_0x1ca393[_0xce75('0x2e')];if(_0x45559b[_0xce75('0x30')][_0xce75('0x41')]){_0x17ae7a[_0xce75('0x42')]=[{'all':!![]}];}_0x17ae7a=_[_0xce75('0x3d')]({},_0x17ae7a,_0x45559b[_0xce75('0x40')]);return db[_0xce75('0x2b')]['find'](_0x17ae7a)[_0xce75('0x23')](handleEntityNotFound(_0x24c04f,null))[_0xce75('0x23')](respondWithResult(_0x24c04f,null))[_0xce75('0x44')](handleError(_0x24c04f,null));};exports['create']=function(_0x1dc000,_0x3c4ba5){return db[_0xce75('0x2b')]['create'](_0x1dc000[_0xce75('0x49')],{})[_0xce75('0x23')](respondWithResult(_0x3c4ba5,0xc9))[_0xce75('0x44')](handleError(_0x3c4ba5,null));};exports[_0xce75('0x22')]=function(_0x1273a9,_0x4822bc){if(_0x1273a9[_0xce75('0x49')]['id']){delete _0x1273a9[_0xce75('0x49')]['id'];}return db[_0xce75('0x2b')][_0xce75('0x4a')]({'where':{'id':_0x1273a9[_0xce75('0x46')]['id']}})[_0xce75('0x23')](handleEntityNotFound(_0x4822bc,null))[_0xce75('0x23')](saveUpdates(_0x1273a9[_0xce75('0x49')],null))[_0xce75('0x23')](respondWithResult(_0x4822bc,null))[_0xce75('0x44')](handleError(_0x4822bc,null));};exports[_0xce75('0x24')]=function(_0x162380,_0x6a9c11){return db[_0xce75('0x2b')]['find']({'where':{'id':_0x162380['params']['id']}})[_0xce75('0x23')](handleEntityNotFound(_0x6a9c11,null))[_0xce75('0x23')](removeEntity(_0x6a9c11,null))[_0xce75('0x44')](handleError(_0x6a9c11,null));};exports[_0xce75('0x4b')]=function(_0x3df326,_0x3c56cc,_0x35632e){var _0xf9f82d={};var _0x31e2de={};var _0xcbebea;var _0x2c0b2c;return db[_0xce75('0x2b')][_0xce75('0x4c')]({'where':{'id':_0x3df326['params']['id']}})[_0xce75('0x23')](handleEntityNotFound(_0x3c56cc,null))['then'](function(_0x4303af){if(_0x4303af){_0xcbebea=_0x4303af;_0x31e2de['model']=_[_0xce75('0x47')](db[_0xce75('0x4d')][_0xce75('0x48')]);_0x31e2de['query']=_[_0xce75('0x47')](_0x3df326[_0xce75('0x30')]);_0x31e2de[_0xce75('0x3a')]=_[_0xce75('0x31')](_0x31e2de[_0xce75('0x2e')],_0x31e2de[_0xce75('0x30')]);_0xf9f82d[_0xce75('0x33')]=_[_0xce75('0x31')](_0x31e2de[_0xce75('0x2e')],qs[_0xce75('0x32')](_0x3df326['query'][_0xce75('0x32')]));_0xf9f82d[_0xce75('0x33')]=_0xf9f82d[_0xce75('0x33')]['length']?_0xf9f82d['attributes']:_0x31e2de[_0xce75('0x2e')];_0xf9f82d[_0xce75('0x37')]=qs[_0xce75('0x38')](_0x3df326[_0xce75('0x30')][_0xce75('0x38')]);_0xf9f82d[_0xce75('0x39')]=qs[_0xce75('0x3a')](_[_0xce75('0x3b')](_0x3df326[_0xce75('0x30')],_0x31e2de[_0xce75('0x3a')]));if(_0x3df326[_0xce75('0x30')]['filter']){_0xf9f82d['where']=_[_0xce75('0x3d')](_0xf9f82d[_0xce75('0x39')],{'$or':_[_0xce75('0x2a')](_0xf9f82d[_0xce75('0x33')],function(_0x2ac509){var _0x3da7ea={};_0x3da7ea[_0x2ac509]={'$like':'%'+_0x3df326['query'][_0xce75('0x3c')]+'%'};return _0x3da7ea;})});}_0xf9f82d=_['merge']({},_0xf9f82d,_0x3df326[_0xce75('0x40')]);return _0xcbebea['getSubjects'](_0xf9f82d);}})[_0xce75('0x23')](function(_0x3c7f35){if(_0x3c7f35){_0x2c0b2c=_0x3c7f35[_0xce75('0x34')];if(!_0x3df326[_0xce75('0x30')][_0xce75('0x35')](_0xce75('0x36'))){_0xf9f82d[_0xce75('0x1b')]=qs[_0xce75('0x1b')](_0x3df326[_0xce75('0x30')][_0xce75('0x1b')]);_0xf9f82d['offset']=qs[_0xce75('0x1c')](_0x3df326[_0xce75('0x30')]['offset']);}return _0xcbebea['getSubjects'](_0xf9f82d);}})[_0xce75('0x23')](function(_0x3b4a5c){if(_0x3b4a5c){return _0x3b4a5c?{'count':_0x2c0b2c,'rows':_0x3b4a5c}:null;}})['then'](respondWithResult(_0x3c56cc,null))[_0xce75('0x44')](handleError(_0x3c56cc,null));};exports[_0xce75('0x4e')]=function(_0x457dcb,_0x2c3b2c,_0x123fd1){var _0x5c47b1={};var _0x7603f5={};var _0x3cf9fb;var _0xedcff1;return db[_0xce75('0x2b')][_0xce75('0x4c')]({'where':{'id':_0x457dcb[_0xce75('0x46')]['id']}})[_0xce75('0x23')](handleEntityNotFound(_0x2c3b2c,null))[_0xce75('0x23')](function(_0x5ba81d){if(_0x5ba81d){_0x3cf9fb=_0x5ba81d;_0x7603f5[_0xce75('0x2e')]=_[_0xce75('0x47')](db[_0xce75('0x4d')]['rawAttributes']);_0x7603f5[_0xce75('0x30')]=_['keys'](_0x457dcb[_0xce75('0x30')]);_0x7603f5['filters']=_['intersection'](_0x7603f5[_0xce75('0x2e')],_0x7603f5[_0xce75('0x30')]);_0x5c47b1[_0xce75('0x33')]=_[_0xce75('0x31')](_0x7603f5[_0xce75('0x2e')],qs['fields'](_0x457dcb['query'][_0xce75('0x32')]));_0x5c47b1[_0xce75('0x33')]=_0x5c47b1['attributes']['length']?_0x5c47b1['attributes']:_0x7603f5[_0xce75('0x2e')];_0x5c47b1[_0xce75('0x37')]=qs[_0xce75('0x38')](_0x457dcb[_0xce75('0x30')][_0xce75('0x38')]);_0x5c47b1[_0xce75('0x39')]=qs[_0xce75('0x3a')](_[_0xce75('0x3b')](_0x457dcb[_0xce75('0x30')],_0x7603f5[_0xce75('0x3a')]));if(_0x457dcb[_0xce75('0x30')][_0xce75('0x3c')]){_0x5c47b1[_0xce75('0x39')]=_['merge'](_0x5c47b1['where'],{'$or':_[_0xce75('0x2a')](_0x5c47b1[_0xce75('0x33')],function(_0x505e28){var _0x592c52={};_0x592c52[_0x505e28]={'$like':'%'+_0x457dcb['query'][_0xce75('0x3c')]+'%'};return _0x592c52;})});}_0x5c47b1=_['merge']({},_0x5c47b1,_0x457dcb[_0xce75('0x40')]);return _0x3cf9fb[_0xce75('0x4e')](_0x5c47b1);}})[_0xce75('0x23')](function(_0x24d799){if(_0x24d799){_0xedcff1=_0x24d799[_0xce75('0x34')];if(!_0x457dcb['query']['hasOwnProperty']('nolimit')){_0x5c47b1[_0xce75('0x1b')]=qs[_0xce75('0x1b')](_0x457dcb['query']['limit']);_0x5c47b1[_0xce75('0x1c')]=qs[_0xce75('0x1c')](_0x457dcb['query'][_0xce75('0x1c')]);}return _0x3cf9fb['getDescriptions'](_0x5c47b1);}})[_0xce75('0x23')](function(_0x37687a){if(_0x37687a){return _0x37687a?{'count':_0xedcff1,'rows':_0x37687a}:null;}})[_0xce75('0x23')](respondWithResult(_0x2c3b2c,null))[_0xce75('0x44')](handleError(_0x2c3b2c,null));};exports[_0xce75('0x4f')]=function(_0x39122d,_0x45e957,_0x4dbfb3){var _0x34f103={};var _0x121117={};var _0x50348a;var _0x573586;return db[_0xce75('0x2b')][_0xce75('0x4c')]({'where':{'id':_0x39122d[_0xce75('0x46')]['id']}})[_0xce75('0x23')](handleEntityNotFound(_0x45e957,null))[_0xce75('0x23')](function(_0xc7c14){if(_0xc7c14){_0x50348a=_0xc7c14;_0x121117[_0xce75('0x2e')]=_[_0xce75('0x47')](db[_0xce75('0x4d')][_0xce75('0x48')]);_0x121117[_0xce75('0x30')]=_[_0xce75('0x47')](_0x39122d[_0xce75('0x30')]);_0x121117[_0xce75('0x3a')]=_['intersection'](_0x121117[_0xce75('0x2e')],_0x121117['query']);_0x34f103[_0xce75('0x33')]=_[_0xce75('0x31')](_0x121117['model'],qs[_0xce75('0x32')](_0x39122d[_0xce75('0x30')][_0xce75('0x32')]));_0x34f103[_0xce75('0x33')]=_0x34f103[_0xce75('0x33')][_0xce75('0x34')]?_0x34f103['attributes']:_0x121117[_0xce75('0x2e')];_0x34f103[_0xce75('0x37')]=qs[_0xce75('0x38')](_0x39122d['query'][_0xce75('0x38')]);_0x34f103[_0xce75('0x39')]=qs[_0xce75('0x3a')](_[_0xce75('0x3b')](_0x39122d['query'],_0x121117[_0xce75('0x3a')]));if(_0x39122d[_0xce75('0x30')]['filter']){_0x34f103[_0xce75('0x39')]=_[_0xce75('0x3d')](_0x34f103['where'],{'$or':_['map'](_0x34f103[_0xce75('0x33')],function(_0x557369){var _0x416ea6={};_0x416ea6[_0x557369]={'$like':'%'+_0x39122d['query']['filter']+'%'};return _0x416ea6;})});}_0x34f103=_[_0xce75('0x3d')]({},_0x34f103,_0x39122d[_0xce75('0x40')]);return _0x50348a[_0xce75('0x4f')](_0x34f103);}})[_0xce75('0x23')](function(_0x4b2cec){if(_0x4b2cec){_0x573586=_0x4b2cec[_0xce75('0x34')];if(!_0x39122d[_0xce75('0x30')][_0xce75('0x35')]('nolimit')){_0x34f103[_0xce75('0x1b')]=qs[_0xce75('0x1b')](_0x39122d[_0xce75('0x30')][_0xce75('0x1b')]);_0x34f103[_0xce75('0x1c')]=qs['offset'](_0x39122d['query'][_0xce75('0x1c')]);}return _0x50348a[_0xce75('0x4f')](_0x34f103);}})[_0xce75('0x23')](function(_0x45df3b){if(_0x45df3b){return _0x45df3b?{'count':_0x573586,'rows':_0x45df3b}:null;}})[_0xce75('0x23')](respondWithResult(_0x45e957,null))[_0xce75('0x44')](handleError(_0x45e957,null));}; \ No newline at end of file +var _0xe000=['limit','count','set','Content-Range','json','save','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','model','query','keys','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','include','findAll','rows','catch','show','params','intersection','includeAll','find','body','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined'];(function(_0xd3e907,_0x309e5b){var _0x164844=function(_0x369060){while(--_0x369060){_0xd3e907['push'](_0xd3e907['shift']());}};_0x164844(++_0x309e5b);}(_0xe000,0x7e));var _0x0e00=function(_0x1cc534,_0x47b3d8){_0x1cc534=_0x1cc534-0x0;var _0x257fd4=_0xe000[_0x1cc534];return _0x257fd4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0e00('0x0'));var jsonpatch=require(_0x0e00('0x1'));var rp=require(_0x0e00('0x2'));var moment=require('moment');var BPromise=require(_0x0e00('0x3'));var Mustache=require(_0x0e00('0x4'));var util=require(_0x0e00('0x5'));var path=require('path');var sox=require(_0x0e00('0x6'));var csv=require(_0x0e00('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e00('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0e00('0x9'));var deskjs=require(_0x0e00('0xa'));var toCsv=require('to-csv');var querystring=require(_0x0e00('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0e00('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x0e00('0xd'));var hardwareService=require(_0x0e00('0xe'));var logger=require(_0x0e00('0xf'))(_0x0e00('0x10'));var utils=require(_0x0e00('0x11'));var config=require(_0x0e00('0x12'));var licenseUtil=require(_0x0e00('0x13'));var db=require(_0x0e00('0x14'))['db'];function respondWithStatusCode(_0x30a665,_0x4a9686){_0x4a9686=_0x4a9686||0xcc;return function(_0x50677e){if(_0x50677e){return _0x30a665[_0x0e00('0x15')](_0x4a9686);}return _0x30a665['status'](_0x4a9686)[_0x0e00('0x16')]();};}function respondWithResult(_0x57e55d,_0x6687e2){_0x6687e2=_0x6687e2||0xc8;return function(_0x3b5567){if(_0x3b5567){return _0x57e55d[_0x0e00('0x17')](_0x6687e2)['json'](_0x3b5567);}};}function respondWithFilteredResult(_0x25cccf,_0x486cbb){return function(_0x54de0f){if(_0x54de0f){var _0x1c49a5=typeof _0x486cbb[_0x0e00('0x18')]===_0x0e00('0x19')&&typeof _0x486cbb[_0x0e00('0x1a')]===_0x0e00('0x19');var _0x329fd3=_0x54de0f[_0x0e00('0x1b')];var _0x5171df=_0x1c49a5?0x0:_0x486cbb[_0x0e00('0x18')];var _0x5b20a3=_0x1c49a5?_0x54de0f[_0x0e00('0x1b')]:_0x486cbb[_0x0e00('0x18')]+_0x486cbb['limit'];var _0x460069;if(_0x5b20a3>=_0x329fd3){_0x5b20a3=_0x329fd3;_0x460069=0xc8;}else{_0x460069=0xce;}_0x25cccf['status'](_0x460069);return _0x25cccf[_0x0e00('0x1c')](_0x0e00('0x1d'),_0x5171df+'-'+_0x5b20a3+'/'+_0x329fd3)[_0x0e00('0x1e')](_0x54de0f);}return null;};}function patchUpdates(_0x759774){return function(_0x3ed209){try{jsonpatch['apply'](_0x3ed209,_0x759774,!![]);}catch(_0x571116){return BPromise['reject'](_0x571116);}return _0x3ed209[_0x0e00('0x1f')]();};}function saveUpdates(_0x42bda6,_0x7b94a7){return function(_0x32d552){if(_0x32d552){return _0x32d552['update'](_0x42bda6)[_0x0e00('0x20')](function(_0x46a1a7){return _0x46a1a7;});}return null;};}function removeEntity(_0x2b5732,_0x59b97a){return function(_0xc0da95){if(_0xc0da95){return _0xc0da95[_0x0e00('0x21')]()['then'](function(){_0x2b5732[_0x0e00('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3013bc,_0x443131){return function(_0x5841b2){if(!_0x5841b2){_0x3013bc[_0x0e00('0x15')](0x194);}return _0x5841b2;};}function handleError(_0xaf5371,_0x4125a2){_0x4125a2=_0x4125a2||0x1f4;return function(_0x39fc18){logger[_0x0e00('0x22')](_0x39fc18[_0x0e00('0x23')]);if(_0x39fc18[_0x0e00('0x24')]){delete _0x39fc18[_0x0e00('0x24')];}_0xaf5371['status'](_0x4125a2)[_0x0e00('0x25')](_0x39fc18);};}exports[_0x0e00('0x26')]=function(_0x1a453e,_0x524ead){var _0x368af8={},_0x311ccd={},_0x34f064={'count':0x0,'rows':[]};var _0x197c3c=_[_0x0e00('0x27')](db[_0x0e00('0x28')][_0x0e00('0x29')],function(_0x1474d3){return{'name':_0x1474d3[_0x0e00('0x2a')],'type':_0x1474d3[_0x0e00('0x2b')]['key']};});_0x311ccd[_0x0e00('0x2c')]=_[_0x0e00('0x27')](_0x197c3c,'name');_0x311ccd[_0x0e00('0x2d')]=_[_0x0e00('0x2e')](_0x1a453e[_0x0e00('0x2d')]);_0x311ccd['filters']=_['intersection'](_0x311ccd[_0x0e00('0x2c')],_0x311ccd[_0x0e00('0x2d')]);_0x368af8['attributes']=_['intersection'](_0x311ccd['model'],qs[_0x0e00('0x2f')](_0x1a453e['query']['fields']));_0x368af8[_0x0e00('0x30')]=_0x368af8[_0x0e00('0x30')][_0x0e00('0x31')]?_0x368af8['attributes']:_0x311ccd['model'];if(!_0x1a453e['query'][_0x0e00('0x32')](_0x0e00('0x33'))){_0x368af8['limit']=qs[_0x0e00('0x1a')](_0x1a453e['query']['limit']);_0x368af8[_0x0e00('0x18')]=qs[_0x0e00('0x18')](_0x1a453e['query'][_0x0e00('0x18')]);}_0x368af8[_0x0e00('0x34')]=qs[_0x0e00('0x35')](_0x1a453e['query']['sort']);_0x368af8['where']=qs[_0x0e00('0x36')](_[_0x0e00('0x37')](_0x1a453e[_0x0e00('0x2d')],_0x311ccd[_0x0e00('0x36')]),_0x197c3c);if(_0x1a453e[_0x0e00('0x2d')][_0x0e00('0x38')]){_0x368af8['where']=_[_0x0e00('0x39')](_0x368af8['where'],{'$or':_[_0x0e00('0x27')](_0x197c3c,function(_0x2677c3){if(_0x2677c3[_0x0e00('0x2b')]!==_0x0e00('0x3a')){var _0x4b189d={};_0x4b189d[_0x2677c3[_0x0e00('0x24')]]={'$like':'%'+_0x1a453e[_0x0e00('0x2d')][_0x0e00('0x38')]+'%'};return _0x4b189d;}})});}_0x368af8=_[_0x0e00('0x39')]({},_0x368af8,_0x1a453e[_0x0e00('0x3b')]);var _0x440d4a={'where':_0x368af8[_0x0e00('0x3c')]};return db[_0x0e00('0x28')][_0x0e00('0x1b')](_0x440d4a)[_0x0e00('0x20')](function(_0x494b02){_0x34f064[_0x0e00('0x1b')]=_0x494b02;if(_0x1a453e[_0x0e00('0x2d')]['includeAll']){_0x368af8[_0x0e00('0x3d')]=[{'all':!![]}];}return db[_0x0e00('0x28')][_0x0e00('0x3e')](_0x368af8);})[_0x0e00('0x20')](function(_0x34f3cc){_0x34f064[_0x0e00('0x3f')]=_0x34f3cc;return _0x34f064;})[_0x0e00('0x20')](respondWithFilteredResult(_0x524ead,_0x368af8))[_0x0e00('0x40')](handleError(_0x524ead,null));};exports[_0x0e00('0x41')]=function(_0x2088f5,_0x31779a){var _0x4cb2e5={'raw':![],'where':{'id':_0x2088f5[_0x0e00('0x42')]['id']}},_0x3db530={};_0x3db530['model']=_[_0x0e00('0x2e')](db[_0x0e00('0x28')][_0x0e00('0x29')]);_0x3db530['query']=_[_0x0e00('0x2e')](_0x2088f5[_0x0e00('0x2d')]);_0x3db530[_0x0e00('0x36')]=_[_0x0e00('0x43')](_0x3db530['model'],_0x3db530[_0x0e00('0x2d')]);_0x4cb2e5[_0x0e00('0x30')]=_['intersection'](_0x3db530[_0x0e00('0x2c')],qs[_0x0e00('0x2f')](_0x2088f5['query'][_0x0e00('0x2f')]));_0x4cb2e5[_0x0e00('0x30')]=_0x4cb2e5[_0x0e00('0x30')]['length']?_0x4cb2e5[_0x0e00('0x30')]:_0x3db530[_0x0e00('0x2c')];if(_0x2088f5['query'][_0x0e00('0x44')]){_0x4cb2e5[_0x0e00('0x3d')]=[{'all':!![]}];}_0x4cb2e5=_[_0x0e00('0x39')]({},_0x4cb2e5,_0x2088f5[_0x0e00('0x3b')]);return db[_0x0e00('0x28')][_0x0e00('0x45')](_0x4cb2e5)[_0x0e00('0x20')](handleEntityNotFound(_0x31779a,null))[_0x0e00('0x20')](respondWithResult(_0x31779a,null))['catch'](handleError(_0x31779a,null));};exports['create']=function(_0x15546a,_0x5291b8){return db[_0x0e00('0x28')]['create'](_0x15546a['body'],{})['then'](respondWithResult(_0x5291b8,0xc9))[_0x0e00('0x40')](handleError(_0x5291b8,null));};exports['update']=function(_0x467da2,_0x510c6a){if(_0x467da2[_0x0e00('0x46')]['id']){delete _0x467da2[_0x0e00('0x46')]['id'];}return db[_0x0e00('0x28')]['find']({'where':{'id':_0x467da2['params']['id']}})[_0x0e00('0x20')](handleEntityNotFound(_0x510c6a,null))['then'](saveUpdates(_0x467da2['body'],null))[_0x0e00('0x20')](respondWithResult(_0x510c6a,null))[_0x0e00('0x40')](handleError(_0x510c6a,null));};exports[_0x0e00('0x21')]=function(_0x15783c,_0x3ad70a){return db['FreshsalesConfiguration'][_0x0e00('0x45')]({'where':{'id':_0x15783c[_0x0e00('0x42')]['id']}})[_0x0e00('0x20')](handleEntityNotFound(_0x3ad70a,null))[_0x0e00('0x20')](removeEntity(_0x3ad70a,null))[_0x0e00('0x40')](handleError(_0x3ad70a,null));};exports[_0x0e00('0x47')]=function(_0x16116e,_0x4d99a5,_0x3d28fa){var _0x54f9da={};var _0x2c9a6c={};var _0x98eb41;var _0x122d54;return db[_0x0e00('0x28')][_0x0e00('0x48')]({'where':{'id':_0x16116e[_0x0e00('0x42')]['id']}})[_0x0e00('0x20')](handleEntityNotFound(_0x4d99a5,null))[_0x0e00('0x20')](function(_0x55d3bc){if(_0x55d3bc){_0x98eb41=_0x55d3bc;_0x2c9a6c[_0x0e00('0x2c')]=_[_0x0e00('0x2e')](db[_0x0e00('0x49')][_0x0e00('0x29')]);_0x2c9a6c[_0x0e00('0x2d')]=_['keys'](_0x16116e['query']);_0x2c9a6c['filters']=_[_0x0e00('0x43')](_0x2c9a6c['model'],_0x2c9a6c['query']);_0x54f9da[_0x0e00('0x30')]=_[_0x0e00('0x43')](_0x2c9a6c[_0x0e00('0x2c')],qs['fields'](_0x16116e['query'][_0x0e00('0x2f')]));_0x54f9da[_0x0e00('0x30')]=_0x54f9da[_0x0e00('0x30')][_0x0e00('0x31')]?_0x54f9da['attributes']:_0x2c9a6c[_0x0e00('0x2c')];_0x54f9da[_0x0e00('0x34')]=qs[_0x0e00('0x35')](_0x16116e[_0x0e00('0x2d')][_0x0e00('0x35')]);_0x54f9da['where']=qs[_0x0e00('0x36')](_[_0x0e00('0x37')](_0x16116e['query'],_0x2c9a6c[_0x0e00('0x36')]));if(_0x16116e[_0x0e00('0x2d')]['filter']){_0x54f9da['where']=_[_0x0e00('0x39')](_0x54f9da[_0x0e00('0x3c')],{'$or':_[_0x0e00('0x27')](_0x54f9da[_0x0e00('0x30')],function(_0x5aa30a){var _0x37082c={};_0x37082c[_0x5aa30a]={'$like':'%'+_0x16116e[_0x0e00('0x2d')][_0x0e00('0x38')]+'%'};return _0x37082c;})});}_0x54f9da=_[_0x0e00('0x39')]({},_0x54f9da,_0x16116e[_0x0e00('0x3b')]);return _0x98eb41[_0x0e00('0x47')](_0x54f9da);}})[_0x0e00('0x20')](function(_0x463aa0){if(_0x463aa0){_0x122d54=_0x463aa0[_0x0e00('0x31')];if(!_0x16116e[_0x0e00('0x2d')][_0x0e00('0x32')]('nolimit')){_0x54f9da[_0x0e00('0x1a')]=qs[_0x0e00('0x1a')](_0x16116e[_0x0e00('0x2d')][_0x0e00('0x1a')]);_0x54f9da[_0x0e00('0x18')]=qs[_0x0e00('0x18')](_0x16116e['query']['offset']);}return _0x98eb41[_0x0e00('0x47')](_0x54f9da);}})[_0x0e00('0x20')](function(_0x3ec40c){if(_0x3ec40c){return _0x3ec40c?{'count':_0x122d54,'rows':_0x3ec40c}:null;}})[_0x0e00('0x20')](respondWithResult(_0x4d99a5,null))['catch'](handleError(_0x4d99a5,null));};exports[_0x0e00('0x4a')]=function(_0x28f524,_0x3df330,_0x3bd523){var _0xee1aff={};var _0x2601d1={};var _0x9be55b;var _0x1641d4;return db['FreshsalesConfiguration'][_0x0e00('0x48')]({'where':{'id':_0x28f524['params']['id']}})['then'](handleEntityNotFound(_0x3df330,null))[_0x0e00('0x20')](function(_0x2d232a){if(_0x2d232a){_0x9be55b=_0x2d232a;_0x2601d1[_0x0e00('0x2c')]=_[_0x0e00('0x2e')](db[_0x0e00('0x49')]['rawAttributes']);_0x2601d1[_0x0e00('0x2d')]=_[_0x0e00('0x2e')](_0x28f524[_0x0e00('0x2d')]);_0x2601d1['filters']=_[_0x0e00('0x43')](_0x2601d1[_0x0e00('0x2c')],_0x2601d1[_0x0e00('0x2d')]);_0xee1aff[_0x0e00('0x30')]=_[_0x0e00('0x43')](_0x2601d1[_0x0e00('0x2c')],qs[_0x0e00('0x2f')](_0x28f524[_0x0e00('0x2d')]['fields']));_0xee1aff[_0x0e00('0x30')]=_0xee1aff[_0x0e00('0x30')]['length']?_0xee1aff['attributes']:_0x2601d1[_0x0e00('0x2c')];_0xee1aff[_0x0e00('0x34')]=qs['sort'](_0x28f524['query'][_0x0e00('0x35')]);_0xee1aff[_0x0e00('0x3c')]=qs[_0x0e00('0x36')](_[_0x0e00('0x37')](_0x28f524[_0x0e00('0x2d')],_0x2601d1[_0x0e00('0x36')]));if(_0x28f524['query'][_0x0e00('0x38')]){_0xee1aff[_0x0e00('0x3c')]=_[_0x0e00('0x39')](_0xee1aff[_0x0e00('0x3c')],{'$or':_[_0x0e00('0x27')](_0xee1aff[_0x0e00('0x30')],function(_0x2ebf8f){var _0x3ff038={};_0x3ff038[_0x2ebf8f]={'$like':'%'+_0x28f524[_0x0e00('0x2d')]['filter']+'%'};return _0x3ff038;})});}_0xee1aff=_[_0x0e00('0x39')]({},_0xee1aff,_0x28f524[_0x0e00('0x3b')]);return _0x9be55b[_0x0e00('0x4a')](_0xee1aff);}})[_0x0e00('0x20')](function(_0x2180fe){if(_0x2180fe){_0x1641d4=_0x2180fe['length'];if(!_0x28f524[_0x0e00('0x2d')]['hasOwnProperty'](_0x0e00('0x33'))){_0xee1aff[_0x0e00('0x1a')]=qs[_0x0e00('0x1a')](_0x28f524['query'][_0x0e00('0x1a')]);_0xee1aff[_0x0e00('0x18')]=qs['offset'](_0x28f524[_0x0e00('0x2d')]['offset']);}return _0x9be55b[_0x0e00('0x4a')](_0xee1aff);}})[_0x0e00('0x20')](function(_0x1c2e57){if(_0x1c2e57){return _0x1c2e57?{'count':_0x1641d4,'rows':_0x1c2e57}:null;}})[_0x0e00('0x20')](respondWithResult(_0x3df330,null))[_0x0e00('0x40')](handleError(_0x3df330,null));};exports[_0x0e00('0x4b')]=function(_0x196a3d,_0x2b3b8f,_0x14d490){var _0x20ce4c={};var _0x3ef57b={};var _0x3cea86;var _0x2691c6;return db[_0x0e00('0x28')]['findOne']({'where':{'id':_0x196a3d[_0x0e00('0x42')]['id']}})[_0x0e00('0x20')](handleEntityNotFound(_0x2b3b8f,null))[_0x0e00('0x20')](function(_0x4e5fb5){if(_0x4e5fb5){_0x3cea86=_0x4e5fb5;_0x3ef57b[_0x0e00('0x2c')]=_[_0x0e00('0x2e')](db[_0x0e00('0x49')][_0x0e00('0x29')]);_0x3ef57b[_0x0e00('0x2d')]=_['keys'](_0x196a3d[_0x0e00('0x2d')]);_0x3ef57b[_0x0e00('0x36')]=_[_0x0e00('0x43')](_0x3ef57b[_0x0e00('0x2c')],_0x3ef57b[_0x0e00('0x2d')]);_0x20ce4c[_0x0e00('0x30')]=_[_0x0e00('0x43')](_0x3ef57b[_0x0e00('0x2c')],qs[_0x0e00('0x2f')](_0x196a3d['query']['fields']));_0x20ce4c[_0x0e00('0x30')]=_0x20ce4c[_0x0e00('0x30')]['length']?_0x20ce4c[_0x0e00('0x30')]:_0x3ef57b[_0x0e00('0x2c')];_0x20ce4c[_0x0e00('0x34')]=qs[_0x0e00('0x35')](_0x196a3d[_0x0e00('0x2d')]['sort']);_0x20ce4c['where']=qs[_0x0e00('0x36')](_[_0x0e00('0x37')](_0x196a3d[_0x0e00('0x2d')],_0x3ef57b[_0x0e00('0x36')]));if(_0x196a3d[_0x0e00('0x2d')][_0x0e00('0x38')]){_0x20ce4c['where']=_[_0x0e00('0x39')](_0x20ce4c[_0x0e00('0x3c')],{'$or':_[_0x0e00('0x27')](_0x20ce4c[_0x0e00('0x30')],function(_0x17ef4c){var _0x569fd7={};_0x569fd7[_0x17ef4c]={'$like':'%'+_0x196a3d['query'][_0x0e00('0x38')]+'%'};return _0x569fd7;})});}_0x20ce4c=_[_0x0e00('0x39')]({},_0x20ce4c,_0x196a3d['options']);return _0x3cea86[_0x0e00('0x4b')](_0x20ce4c);}})[_0x0e00('0x20')](function(_0x1dadfb){if(_0x1dadfb){_0x2691c6=_0x1dadfb[_0x0e00('0x31')];if(!_0x196a3d['query'][_0x0e00('0x32')](_0x0e00('0x33'))){_0x20ce4c[_0x0e00('0x1a')]=qs[_0x0e00('0x1a')](_0x196a3d[_0x0e00('0x2d')][_0x0e00('0x1a')]);_0x20ce4c[_0x0e00('0x18')]=qs[_0x0e00('0x18')](_0x196a3d[_0x0e00('0x2d')][_0x0e00('0x18')]);}return _0x3cea86['getFields'](_0x20ce4c);}})[_0x0e00('0x20')](function(_0x15d79d){if(_0x15d79d){return _0x15d79d?{'count':_0x2691c6,'rows':_0x15d79d}:null;}})[_0x0e00('0x20')](respondWithResult(_0x2b3b8f,null))['catch'](handleError(_0x2b3b8f,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 2f067df..b34f81b 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 _0xa9ce=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','lodash','util','../../config/logger'];(function(_0x190cab,_0x338d8f){var _0x46ce1a=function(_0x3fd932){while(--_0x3fd932){_0x190cab['push'](_0x190cab['shift']());}};_0x46ce1a(++_0x338d8f);}(_0xa9ce,0xb1));var _0xea9c=function(_0x58f370,_0x2036cf){_0x58f370=_0x58f370-0x0;var _0x47ac1b=_0xa9ce[_0x58f370];return _0x47ac1b;};'use strict';var _=require(_0xea9c('0x0'));var util=require(_0xea9c('0x1'));var logger=require(_0xea9c('0x2'))('api');var moment=require('moment');var BPromise=require(_0xea9c('0x3'));var rp=require(_0xea9c('0x4'));var fs=require('fs');var path=require(_0xea9c('0x5'));var rimraf=require(_0xea9c('0x6'));var config=require(_0xea9c('0x7'));var attributes=require(_0xea9c('0x8'));module[_0xea9c('0x9')]=function(_0x18d8fd,_0x1a9b30){return _0x18d8fd[_0xea9c('0xa')](_0xea9c('0xb'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7827=['bluebird','request-promise','rimraf','../../config/environment','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger'];(function(_0x42121d,_0x1c31ab){var _0x2d6fde=function(_0x347a95){while(--_0x347a95){_0x42121d['push'](_0x42121d['shift']());}};_0x2d6fde(++_0x1c31ab);}(_0x7827,0x197));var _0x7782=function(_0x58a18a,_0x1d948a){_0x58a18a=_0x58a18a-0x0;var _0x504330=_0x7827[_0x58a18a];return _0x504330;};'use strict';var _=require(_0x7782('0x0'));var util=require(_0x7782('0x1'));var logger=require(_0x7782('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7782('0x3'));var rp=require(_0x7782('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7782('0x5'));var config=require(_0x7782('0x6'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x7782('0x7')]=function(_0x1f76bc,_0x582220){return _0x1f76bc['define'](_0x7782('0x8'),attributes,{'tableName':_0x7782('0x9'),'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 58697ce..53ff5d9 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 _0xd065=['code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4c7645,_0x49d3ab){var _0x59d1fc=function(_0xb7553f){while(--_0xb7553f){_0x4c7645['push'](_0x4c7645['shift']());}};_0x59d1fc(++_0x49d3ab);}(_0xd065,0x1be));var _0x5d06=function(_0xede821,_0x24d4ea){_0xede821=_0xede821-0x0;var _0x98ff3b=_0xd065[_0xede821];return _0x98ff3b;};'use strict';var _=require(_0x5d06('0x0'));var util=require(_0x5d06('0x1'));var moment=require('moment');var BPromise=require(_0x5d06('0x2'));var rs=require(_0x5d06('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5d06('0x4'));var logger=require(_0x5d06('0x5'))(_0x5d06('0x6'));var config=require('../../config/environment');var jayson=require(_0x5d06('0x7'));var client=jayson[_0x5d06('0x8')][_0x5d06('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f062e,_0x5af8eb,_0x99e681){return new BPromise(function(_0x30fd3c,_0x28035a){return client['request'](_0x4f062e,_0x99e681)[_0x5d06('0xa')](function(_0x4922ae){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x5af8eb,'request\x20sent');logger[_0x5d06('0xb')](_0x5d06('0xc'),_0x5af8eb,_0x5d06('0xd'),JSON[_0x5d06('0xe')](_0x4922ae));if(_0x4922ae[_0x5d06('0xf')]){if(_0x4922ae[_0x5d06('0xf')][_0x5d06('0x10')]===0x1f4){logger[_0x5d06('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5af8eb,_0x4922ae[_0x5d06('0xf')]['message']);return _0x28035a(_0x4922ae['error'][_0x5d06('0x11')]);}logger[_0x5d06('0xf')](_0x5d06('0x12'),_0x5af8eb,_0x4922ae[_0x5d06('0xf')][_0x5d06('0x11')]);return _0x30fd3c(_0x4922ae[_0x5d06('0xf')][_0x5d06('0x11')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x5af8eb,'request\x20sent');_0x30fd3c(_0x4922ae[_0x5d06('0x13')][_0x5d06('0x11')]);}})[_0x5d06('0x14')](function(_0x1fcfbf){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x5af8eb,_0x1fcfbf);_0x28035a(_0x1fcfbf);});});} \ No newline at end of file +var _0xc4f8=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x59f0dc,_0x1e2497){var _0x5b5445=function(_0x57ca91){while(--_0x57ca91){_0x59f0dc['push'](_0x59f0dc['shift']());}};_0x5b5445(++_0x1e2497);}(_0xc4f8,0x7c));var _0x8c4f=function(_0x48703d,_0x1ca448){_0x48703d=_0x48703d-0x0;var _0x20c0ad=_0xc4f8[_0x48703d];return _0x20c0ad;};'use strict';var _=require(_0x8c4f('0x0'));var util=require(_0x8c4f('0x1'));var moment=require(_0x8c4f('0x2'));var BPromise=require(_0x8c4f('0x3'));var rs=require(_0x8c4f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c4f('0x5'))['db'];var utils=require(_0x8c4f('0x6'));var logger=require(_0x8c4f('0x7'))(_0x8c4f('0x8'));var config=require('../../config/environment');var jayson=require(_0x8c4f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3bdcbe,_0x486232,_0x737338){return new BPromise(function(_0x5adb6c,_0x4c6bea){return client[_0x8c4f('0xa')](_0x3bdcbe,_0x737338)['then'](function(_0x1a0df7){logger[_0x8c4f('0xb')](_0x8c4f('0xc'),_0x486232,_0x8c4f('0xd'));logger['debug'](_0x8c4f('0xe'),_0x486232,_0x8c4f('0xd'),JSON[_0x8c4f('0xf')](_0x1a0df7));if(_0x1a0df7[_0x8c4f('0x10')]){if(_0x1a0df7[_0x8c4f('0x10')][_0x8c4f('0x11')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x486232,_0x1a0df7['error']['message']);return _0x4c6bea(_0x1a0df7[_0x8c4f('0x10')][_0x8c4f('0x12')]);}logger[_0x8c4f('0x10')](_0x8c4f('0xc'),_0x486232,_0x1a0df7[_0x8c4f('0x10')]['message']);return _0x5adb6c(_0x1a0df7[_0x8c4f('0x10')][_0x8c4f('0x12')]);}else{logger[_0x8c4f('0xb')](_0x8c4f('0xc'),_0x486232,_0x8c4f('0xd'));_0x5adb6c(_0x1a0df7[_0x8c4f('0x13')][_0x8c4f('0x12')]);}})[_0x8c4f('0x14')](function(_0xce4c1){logger[_0x8c4f('0x10')](_0x8c4f('0xc'),_0x486232,_0xce4c1);_0x4c6bea(_0xce4c1);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 63442e3..a8c8f9f 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 _0x86dd=['isAuthenticated','index','show','create','put','/:id','update','delete','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get'];(function(_0x900a8d,_0x1f009a){var _0x5b80fc=function(_0x19e19e){while(--_0x19e19e){_0x900a8d['push'](_0x900a8d['shift']());}};_0x5b80fc(++_0x1f009a);}(_0x86dd,0x1ee));var _0xd86d=function(_0x1a2183,_0x1fd82e){_0x1a2183=_0x1a2183-0x0;var _0x290ae8=_0x86dd[_0x1a2183];return _0x290ae8;};'use strict';var multer=require('multer');var util=require(_0xd86d('0x0'));var path=require('path');var timeout=require(_0xd86d('0x1'));var express=require(_0xd86d('0x2'));var router=express[_0xd86d('0x3')]();var fs_extra=require(_0xd86d('0x4'));var auth=require(_0xd86d('0x5'));var interaction=require(_0xd86d('0x6'));var config=require(_0xd86d('0x7'));var controller=require(_0xd86d('0x8'));router[_0xd86d('0x9')]('/',auth[_0xd86d('0xa')](),controller[_0xd86d('0xb')]);router[_0xd86d('0x9')]('/:id',auth[_0xd86d('0xa')](),controller[_0xd86d('0xc')]);router['post']('/',auth[_0xd86d('0xa')](),controller[_0xd86d('0xd')]);router[_0xd86d('0xe')](_0xd86d('0xf'),auth['isAuthenticated'](),controller[_0xd86d('0x10')]);router[_0xd86d('0x11')](_0xd86d('0xf'),auth[_0xd86d('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe205=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','index','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x38c6f4,_0x1463ed){var _0x4919e9=function(_0x425e10){while(--_0x425e10){_0x38c6f4['push'](_0x38c6f4['shift']());}};_0x4919e9(++_0x1463ed);}(_0xe205,0xa7));var _0x5e20=function(_0x3580d0,_0x4eb891){_0x3580d0=_0x3580d0-0x0;var _0x3646d4=_0xe205[_0x3580d0];return _0x3646d4;};'use strict';var multer=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var path=require(_0x5e20('0x2'));var timeout=require(_0x5e20('0x3'));var express=require(_0x5e20('0x4'));var router=express[_0x5e20('0x5')]();var fs_extra=require(_0x5e20('0x6'));var auth=require(_0x5e20('0x7'));var interaction=require(_0x5e20('0x8'));var config=require('../../config/environment');var controller=require(_0x5e20('0x9'));router[_0x5e20('0xa')]('/',auth[_0x5e20('0xb')](),controller[_0x5e20('0xc')]);router['get']('/:id',auth[_0x5e20('0xb')](),controller['show']);router['post']('/',auth[_0x5e20('0xb')](),controller[_0x5e20('0xd')]);router['put'](_0x5e20('0xe'),auth[_0x5e20('0xb')](),controller[_0x5e20('0xf')]);router[_0x5e20('0x10')]('/:id',auth[_0x5e20('0xb')](),controller[_0x5e20('0x11')]);module[_0x5e20('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 74e9f08..a432944 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 _0xe757=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe757,0xb7));var _0x7e75=function(_0x31c3be,_0x5e540f){_0x31c3be=_0x31c3be-0x0;var _0x48314d=_0xe757[_0x31c3be];return _0x48314d;};'use strict';var Sequelize=require(_0x7e75('0x0'));module[_0x7e75('0x1')]={'type':{'type':Sequelize[_0x7e75('0x2')]('string',_0x7e75('0x3'),_0x7e75('0x4'),_0x7e75('0x5'),_0x7e75('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x7e75('0x7')]},'key':{'type':Sequelize[_0x7e75('0x7')]},'keyType':{'type':Sequelize[_0x7e75('0x2')]('string',_0x7e75('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7e75('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7e75('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7e75('0x7')]}}; \ No newline at end of file +var _0x5254=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x5d8c78,_0x25783a){var _0x4df4f1=function(_0x1b0090){while(--_0x1b0090){_0x5d8c78['push'](_0x5d8c78['shift']());}};_0x4df4f1(++_0x25783a);}(_0x5254,0x19c));var _0x4525=function(_0x1819f2,_0x5e4c56){_0x1819f2=_0x1819f2-0x0;var _0x4f9a84=_0x5254[_0x1819f2];return _0x4f9a84;};'use strict';var Sequelize=require(_0x4525('0x0'));module['exports']={'type':{'type':Sequelize[_0x4525('0x1')](_0x4525('0x2'),_0x4525('0x3'),_0x4525('0x4'),_0x4525('0x5'),_0x4525('0x6')),'defaultValue':_0x4525('0x2')},'content':{'type':Sequelize[_0x4525('0x7')]},'key':{'type':Sequelize[_0x4525('0x7')]},'keyType':{'type':Sequelize[_0x4525('0x1')](_0x4525('0x2'),_0x4525('0x3'),_0x4525('0x4'))},'keyContent':{'type':Sequelize[_0x4525('0x7')]},'idField':{'type':Sequelize[_0x4525('0x7')]},'nameField':{'type':Sequelize[_0x4525('0x7')]},'customField':{'type':Sequelize[_0x4525('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4525('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 90999f6..1086887 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 _0xcfef=['catch','show','params','keys','include','merge','find','create','body','destroy','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','stack','name','send','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','rows'];(function(_0x27f30e,_0xd7344e){var _0x37b897=function(_0x228701){while(--_0x228701){_0x27f30e['push'](_0x27f30e['shift']());}};_0x37b897(++_0xd7344e);}(_0xcfef,0xeb));var _0xfcfe=function(_0x9d1214,_0x1bdf66){_0x9d1214=_0x9d1214-0x0;var _0x393756=_0xcfef[_0x9d1214];return _0x393756;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfcfe('0x0'));var jsonpatch=require(_0xfcfe('0x1'));var rp=require(_0xfcfe('0x2'));var moment=require(_0xfcfe('0x3'));var BPromise=require(_0xfcfe('0x4'));var Mustache=require(_0xfcfe('0x5'));var util=require(_0xfcfe('0x6'));var path=require(_0xfcfe('0x7'));var sox=require('sox');var csv=require(_0xfcfe('0x8'));var ejs=require(_0xfcfe('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfcfe('0xa'));var squel=require(_0xfcfe('0xb'));var crypto=require(_0xfcfe('0xc'));var jsforce=require(_0xfcfe('0xd'));var deskjs=require(_0xfcfe('0xe'));var toCsv=require(_0xfcfe('0x8'));var querystring=require(_0xfcfe('0xf'));var Papa=require(_0xfcfe('0x10'));var Redis=require(_0xfcfe('0x11'));var authService=require(_0xfcfe('0x12'));var qs=require(_0xfcfe('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfcfe('0x14'))(_0xfcfe('0x15'));var utils=require(_0xfcfe('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfcfe('0x17'));var db=require(_0xfcfe('0x18'))['db'];function respondWithStatusCode(_0x1d6002,_0x35be20){_0x35be20=_0x35be20||0xcc;return function(_0x1b3494){if(_0x1b3494){return _0x1d6002[_0xfcfe('0x19')](_0x35be20);}return _0x1d6002[_0xfcfe('0x1a')](_0x35be20)[_0xfcfe('0x1b')]();};}function respondWithResult(_0x2b990a,_0x10ca07){_0x10ca07=_0x10ca07||0xc8;return function(_0x337fa3){if(_0x337fa3){return _0x2b990a['status'](_0x10ca07)[_0xfcfe('0x1c')](_0x337fa3);}};}function respondWithFilteredResult(_0x4dedaf,_0x37508b){return function(_0x3a872b){if(_0x3a872b){var _0xb120ba=typeof _0x37508b['offset']===_0xfcfe('0x1d')&&typeof _0x37508b[_0xfcfe('0x1e')]===_0xfcfe('0x1d');var _0x2e7e5c=_0x3a872b[_0xfcfe('0x1f')];var _0x277328=_0xb120ba?0x0:_0x37508b[_0xfcfe('0x20')];var _0x4529af=_0xb120ba?_0x3a872b[_0xfcfe('0x1f')]:_0x37508b[_0xfcfe('0x20')]+_0x37508b[_0xfcfe('0x1e')];var _0x3d14f8;if(_0x4529af>=_0x2e7e5c){_0x4529af=_0x2e7e5c;_0x3d14f8=0xc8;}else{_0x3d14f8=0xce;}_0x4dedaf['status'](_0x3d14f8);return _0x4dedaf[_0xfcfe('0x21')]('Content-Range',_0x277328+'-'+_0x4529af+'/'+_0x2e7e5c)['json'](_0x3a872b);}return null;};}function patchUpdates(_0x2d7fb3){return function(_0x1ffd87){try{jsonpatch[_0xfcfe('0x22')](_0x1ffd87,_0x2d7fb3,!![]);}catch(_0x2dff9b){return BPromise[_0xfcfe('0x23')](_0x2dff9b);}return _0x1ffd87[_0xfcfe('0x24')]();};}function saveUpdates(_0x459ab2,_0x4a3a01){return function(_0x5443a2){if(_0x5443a2){return _0x5443a2[_0xfcfe('0x25')](_0x459ab2)[_0xfcfe('0x26')](function(_0x4cc224){return _0x4cc224;});}return null;};}function removeEntity(_0x4828ab,_0x5a1d6e){return function(_0x544fde){if(_0x544fde){return _0x544fde['destroy']()[_0xfcfe('0x26')](function(){_0x4828ab[_0xfcfe('0x1a')](0xcc)[_0xfcfe('0x1b')]();});}};}function handleEntityNotFound(_0xe5263a,_0x3a074c){return function(_0x47be4e){if(!_0x47be4e){_0xe5263a[_0xfcfe('0x19')](0x194);}return _0x47be4e;};}function handleError(_0x386fa4,_0x4f1c78){_0x4f1c78=_0x4f1c78||0x1f4;return function(_0x326b7f){logger['error'](_0x326b7f[_0xfcfe('0x27')]);if(_0x326b7f[_0xfcfe('0x28')]){delete _0x326b7f['name'];}_0x386fa4[_0xfcfe('0x1a')](_0x4f1c78)[_0xfcfe('0x29')](_0x326b7f);};}exports['index']=function(_0x5ccc24,_0x2b648f){var _0x51c3e8={},_0x4de479={},_0x36495f={'count':0x0,'rows':[]};var _0xa27038=_[_0xfcfe('0x2a')](db[_0xfcfe('0x2b')][_0xfcfe('0x2c')],function(_0x3ab3e3){return{'name':_0x3ab3e3[_0xfcfe('0x2d')],'type':_0x3ab3e3[_0xfcfe('0x2e')][_0xfcfe('0x2f')]};});_0x4de479[_0xfcfe('0x30')]=_[_0xfcfe('0x2a')](_0xa27038,_0xfcfe('0x28'));_0x4de479['query']=_['keys'](_0x5ccc24[_0xfcfe('0x31')]);_0x4de479[_0xfcfe('0x32')]=_[_0xfcfe('0x33')](_0x4de479[_0xfcfe('0x30')],_0x4de479[_0xfcfe('0x31')]);_0x51c3e8['attributes']=_[_0xfcfe('0x33')](_0x4de479[_0xfcfe('0x30')],qs[_0xfcfe('0x34')](_0x5ccc24[_0xfcfe('0x31')][_0xfcfe('0x34')]));_0x51c3e8[_0xfcfe('0x35')]=_0x51c3e8[_0xfcfe('0x35')][_0xfcfe('0x36')]?_0x51c3e8[_0xfcfe('0x35')]:_0x4de479[_0xfcfe('0x30')];if(!_0x5ccc24['query'][_0xfcfe('0x37')](_0xfcfe('0x38'))){_0x51c3e8['limit']=qs[_0xfcfe('0x1e')](_0x5ccc24['query'][_0xfcfe('0x1e')]);_0x51c3e8[_0xfcfe('0x20')]=qs[_0xfcfe('0x20')](_0x5ccc24[_0xfcfe('0x31')][_0xfcfe('0x20')]);}_0x51c3e8['order']=qs[_0xfcfe('0x39')](_0x5ccc24[_0xfcfe('0x31')][_0xfcfe('0x39')]);_0x51c3e8[_0xfcfe('0x3a')]=qs[_0xfcfe('0x32')](_[_0xfcfe('0x3b')](_0x5ccc24[_0xfcfe('0x31')],_0x4de479['filters']),_0xa27038);if(_0x5ccc24['query'][_0xfcfe('0x3c')]){_0x51c3e8['where']=_['merge'](_0x51c3e8[_0xfcfe('0x3a')],{'$or':_['map'](_0xa27038,function(_0x45624b){if(_0x45624b['type']!==_0xfcfe('0x3d')){var _0x35c774={};_0x35c774[_0x45624b[_0xfcfe('0x28')]]={'$like':'%'+_0x5ccc24[_0xfcfe('0x31')]['filter']+'%'};return _0x35c774;}})});}_0x51c3e8=_['merge']({},_0x51c3e8,_0x5ccc24[_0xfcfe('0x3e')]);var _0x4e553f={'where':_0x51c3e8[_0xfcfe('0x3a')]};return db[_0xfcfe('0x2b')][_0xfcfe('0x1f')](_0x4e553f)['then'](function(_0x480eb7){_0x36495f[_0xfcfe('0x1f')]=_0x480eb7;if(_0x5ccc24[_0xfcfe('0x31')][_0xfcfe('0x3f')]){_0x51c3e8['include']=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x51c3e8);})[_0xfcfe('0x26')](function(_0x46234f){_0x36495f[_0xfcfe('0x40')]=_0x46234f;return _0x36495f;})[_0xfcfe('0x26')](respondWithFilteredResult(_0x2b648f,_0x51c3e8))[_0xfcfe('0x41')](handleError(_0x2b648f,null));};exports[_0xfcfe('0x42')]=function(_0x4f7733,_0x2d2882){var _0x3baeca={'raw':!![],'where':{'id':_0x4f7733[_0xfcfe('0x43')]['id']}},_0x41189e={};_0x41189e[_0xfcfe('0x30')]=_[_0xfcfe('0x44')](db[_0xfcfe('0x2b')][_0xfcfe('0x2c')]);_0x41189e[_0xfcfe('0x31')]=_['keys'](_0x4f7733[_0xfcfe('0x31')]);_0x41189e[_0xfcfe('0x32')]=_[_0xfcfe('0x33')](_0x41189e[_0xfcfe('0x30')],_0x41189e[_0xfcfe('0x31')]);_0x3baeca['attributes']=_[_0xfcfe('0x33')](_0x41189e['model'],qs['fields'](_0x4f7733[_0xfcfe('0x31')][_0xfcfe('0x34')]));_0x3baeca[_0xfcfe('0x35')]=_0x3baeca[_0xfcfe('0x35')][_0xfcfe('0x36')]?_0x3baeca['attributes']:_0x41189e[_0xfcfe('0x30')];if(_0x4f7733['query'][_0xfcfe('0x3f')]){_0x3baeca[_0xfcfe('0x45')]=[{'all':!![]}];}_0x3baeca=_[_0xfcfe('0x46')]({},_0x3baeca,_0x4f7733['options']);return db[_0xfcfe('0x2b')][_0xfcfe('0x47')](_0x3baeca)[_0xfcfe('0x26')](handleEntityNotFound(_0x2d2882,null))[_0xfcfe('0x26')](respondWithResult(_0x2d2882,null))['catch'](handleError(_0x2d2882,null));};exports['create']=function(_0x3b5a6a,_0x562331){return db[_0xfcfe('0x2b')][_0xfcfe('0x48')](_0x3b5a6a[_0xfcfe('0x49')],{})[_0xfcfe('0x26')](respondWithResult(_0x562331,0xc9))[_0xfcfe('0x41')](handleError(_0x562331,null));};exports[_0xfcfe('0x25')]=function(_0x14b884,_0x198761){if(_0x14b884[_0xfcfe('0x49')]['id']){delete _0x14b884[_0xfcfe('0x49')]['id'];}return db['FreshsalesField'][_0xfcfe('0x47')]({'where':{'id':_0x14b884[_0xfcfe('0x43')]['id']}})[_0xfcfe('0x26')](handleEntityNotFound(_0x198761,null))[_0xfcfe('0x26')](saveUpdates(_0x14b884[_0xfcfe('0x49')],null))['then'](respondWithResult(_0x198761,null))[_0xfcfe('0x41')](handleError(_0x198761,null));};exports[_0xfcfe('0x4a')]=function(_0x2dcf98,_0x431149){return db[_0xfcfe('0x2b')][_0xfcfe('0x47')]({'where':{'id':_0x2dcf98[_0xfcfe('0x43')]['id']}})[_0xfcfe('0x26')](handleEntityNotFound(_0x431149,null))[_0xfcfe('0x26')](removeEntity(_0x431149,null))[_0xfcfe('0x41')](handleError(_0x431149,null));}; \ No newline at end of file +var _0xbd9b=['update','destroy','then','stack','name','send','map','FreshsalesField','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','filter','merge','where','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','eml-format','rimraf','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','reject','save'];(function(_0x38f9bb,_0x565c47){var _0x169ba5=function(_0xffab2e){while(--_0xffab2e){_0x38f9bb['push'](_0x38f9bb['shift']());}};_0x169ba5(++_0x565c47);}(_0xbd9b,0xe1));var _0xbbd9=function(_0x208790,_0x5b82db){_0x208790=_0x208790-0x0;var _0x2597c7=_0xbd9b[_0x208790];return _0x2597c7;};'use strict';var emlformat=require(_0xbbd9('0x0'));var rimraf=require(_0xbbd9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbbd9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbbd9('0x3'));var util=require(_0xbbd9('0x4'));var path=require(_0xbbd9('0x5'));var sox=require('sox');var csv=require(_0xbbd9('0x6'));var ejs=require(_0xbbd9('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbbd9('0x8'));var squel=require(_0xbbd9('0x9'));var crypto=require(_0xbbd9('0xa'));var jsforce=require(_0xbbd9('0xb'));var deskjs=require(_0xbbd9('0xc'));var toCsv=require(_0xbbd9('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbbd9('0xd'));var qs=require(_0xbbd9('0xe'));var as=require(_0xbbd9('0xf'));var hardwareService=require(_0xbbd9('0x10'));var logger=require(_0xbbd9('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbbd9('0x12'));var db=require(_0xbbd9('0x13'))['db'];function respondWithStatusCode(_0x15b7d7,_0xd91807){_0xd91807=_0xd91807||0xcc;return function(_0x50c5d5){if(_0x50c5d5){return _0x15b7d7[_0xbbd9('0x14')](_0xd91807);}return _0x15b7d7['status'](_0xd91807)[_0xbbd9('0x15')]();};}function respondWithResult(_0x16e56b,_0x2960e8){_0x2960e8=_0x2960e8||0xc8;return function(_0x8c38c0){if(_0x8c38c0){return _0x16e56b['status'](_0x2960e8)[_0xbbd9('0x16')](_0x8c38c0);}};}function respondWithFilteredResult(_0x387583,_0x2c0b8c){return function(_0x154f95){if(_0x154f95){var _0x52c332=typeof _0x2c0b8c[_0xbbd9('0x17')]===_0xbbd9('0x18')&&typeof _0x2c0b8c[_0xbbd9('0x19')]===_0xbbd9('0x18');var _0x484d9e=_0x154f95[_0xbbd9('0x1a')];var _0xa22ba1=_0x52c332?0x0:_0x2c0b8c[_0xbbd9('0x17')];var _0x164c88=_0x52c332?_0x154f95[_0xbbd9('0x1a')]:_0x2c0b8c['offset']+_0x2c0b8c[_0xbbd9('0x19')];var _0x4e7f8c;if(_0x164c88>=_0x484d9e){_0x164c88=_0x484d9e;_0x4e7f8c=0xc8;}else{_0x4e7f8c=0xce;}_0x387583[_0xbbd9('0x1b')](_0x4e7f8c);return _0x387583['set'](_0xbbd9('0x1c'),_0xa22ba1+'-'+_0x164c88+'/'+_0x484d9e)[_0xbbd9('0x16')](_0x154f95);}return null;};}function patchUpdates(_0x3f36bb){return function(_0x6bf28a){try{jsonpatch['apply'](_0x6bf28a,_0x3f36bb,!![]);}catch(_0x5d9451){return BPromise[_0xbbd9('0x1d')](_0x5d9451);}return _0x6bf28a[_0xbbd9('0x1e')]();};}function saveUpdates(_0x447d90,_0x277e92){return function(_0x422019){if(_0x422019){return _0x422019[_0xbbd9('0x1f')](_0x447d90)['then'](function(_0x51ad66){return _0x51ad66;});}return null;};}function removeEntity(_0x230a55,_0x2ec427){return function(_0x22037a){if(_0x22037a){return _0x22037a[_0xbbd9('0x20')]()[_0xbbd9('0x21')](function(){_0x230a55[_0xbbd9('0x1b')](0xcc)[_0xbbd9('0x15')]();});}};}function handleEntityNotFound(_0x78d4ad,_0x554dc0){return function(_0x37695b){if(!_0x37695b){_0x78d4ad[_0xbbd9('0x14')](0x194);}return _0x37695b;};}function handleError(_0x7ff295,_0x40eeb8){_0x40eeb8=_0x40eeb8||0x1f4;return function(_0x1d1985){logger['error'](_0x1d1985[_0xbbd9('0x22')]);if(_0x1d1985[_0xbbd9('0x23')]){delete _0x1d1985['name'];}_0x7ff295[_0xbbd9('0x1b')](_0x40eeb8)[_0xbbd9('0x24')](_0x1d1985);};}exports['index']=function(_0x9a6139,_0x204eed){var _0x5f254f={},_0x52b6ad={},_0x43ba70={'count':0x0,'rows':[]};var _0x1bfc10=_[_0xbbd9('0x25')](db[_0xbbd9('0x26')]['rawAttributes'],function(_0x6c0cfa){return{'name':_0x6c0cfa['fieldName'],'type':_0x6c0cfa[_0xbbd9('0x27')]['key']};});_0x52b6ad[_0xbbd9('0x28')]=_[_0xbbd9('0x25')](_0x1bfc10,_0xbbd9('0x23'));_0x52b6ad[_0xbbd9('0x29')]=_[_0xbbd9('0x2a')](_0x9a6139[_0xbbd9('0x29')]);_0x52b6ad[_0xbbd9('0x2b')]=_['intersection'](_0x52b6ad[_0xbbd9('0x28')],_0x52b6ad[_0xbbd9('0x29')]);_0x5f254f[_0xbbd9('0x2c')]=_[_0xbbd9('0x2d')](_0x52b6ad[_0xbbd9('0x28')],qs[_0xbbd9('0x2e')](_0x9a6139[_0xbbd9('0x29')]['fields']));_0x5f254f[_0xbbd9('0x2c')]=_0x5f254f['attributes'][_0xbbd9('0x2f')]?_0x5f254f[_0xbbd9('0x2c')]:_0x52b6ad[_0xbbd9('0x28')];if(!_0x9a6139['query']['hasOwnProperty'](_0xbbd9('0x30'))){_0x5f254f[_0xbbd9('0x19')]=qs[_0xbbd9('0x19')](_0x9a6139[_0xbbd9('0x29')]['limit']);_0x5f254f['offset']=qs[_0xbbd9('0x17')](_0x9a6139[_0xbbd9('0x29')][_0xbbd9('0x17')]);}_0x5f254f['order']=qs[_0xbbd9('0x31')](_0x9a6139[_0xbbd9('0x29')][_0xbbd9('0x31')]);_0x5f254f['where']=qs['filters'](_['pick'](_0x9a6139[_0xbbd9('0x29')],_0x52b6ad[_0xbbd9('0x2b')]),_0x1bfc10);if(_0x9a6139[_0xbbd9('0x29')][_0xbbd9('0x32')]){_0x5f254f['where']=_[_0xbbd9('0x33')](_0x5f254f[_0xbbd9('0x34')],{'$or':_[_0xbbd9('0x25')](_0x1bfc10,function(_0x471613){if(_0x471613[_0xbbd9('0x27')]!==_0xbbd9('0x35')){var _0x5a7a97={};_0x5a7a97[_0x471613[_0xbbd9('0x23')]]={'$like':'%'+_0x9a6139[_0xbbd9('0x29')]['filter']+'%'};return _0x5a7a97;}})});}_0x5f254f=_['merge']({},_0x5f254f,_0x9a6139['options']);var _0x4665e7={'where':_0x5f254f[_0xbbd9('0x34')]};return db[_0xbbd9('0x26')][_0xbbd9('0x1a')](_0x4665e7)[_0xbbd9('0x21')](function(_0x2527a9){_0x43ba70['count']=_0x2527a9;if(_0x9a6139[_0xbbd9('0x29')][_0xbbd9('0x36')]){_0x5f254f[_0xbbd9('0x37')]=[{'all':!![]}];}return db[_0xbbd9('0x26')]['findAll'](_0x5f254f);})[_0xbbd9('0x21')](function(_0x33a0b2){_0x43ba70[_0xbbd9('0x38')]=_0x33a0b2;return _0x43ba70;})[_0xbbd9('0x21')](respondWithFilteredResult(_0x204eed,_0x5f254f))[_0xbbd9('0x39')](handleError(_0x204eed,null));};exports[_0xbbd9('0x3a')]=function(_0x58f11f,_0x559e04){var _0x28662={'raw':!![],'where':{'id':_0x58f11f[_0xbbd9('0x3b')]['id']}},_0x235772={};_0x235772[_0xbbd9('0x28')]=_[_0xbbd9('0x2a')](db[_0xbbd9('0x26')]['rawAttributes']);_0x235772[_0xbbd9('0x29')]=_[_0xbbd9('0x2a')](_0x58f11f[_0xbbd9('0x29')]);_0x235772[_0xbbd9('0x2b')]=_[_0xbbd9('0x2d')](_0x235772[_0xbbd9('0x28')],_0x235772[_0xbbd9('0x29')]);_0x28662[_0xbbd9('0x2c')]=_[_0xbbd9('0x2d')](_0x235772[_0xbbd9('0x28')],qs[_0xbbd9('0x2e')](_0x58f11f['query']['fields']));_0x28662[_0xbbd9('0x2c')]=_0x28662[_0xbbd9('0x2c')][_0xbbd9('0x2f')]?_0x28662['attributes']:_0x235772[_0xbbd9('0x28')];if(_0x58f11f[_0xbbd9('0x29')][_0xbbd9('0x36')]){_0x28662[_0xbbd9('0x37')]=[{'all':!![]}];}_0x28662=_[_0xbbd9('0x33')]({},_0x28662,_0x58f11f[_0xbbd9('0x3c')]);return db[_0xbbd9('0x26')][_0xbbd9('0x3d')](_0x28662)['then'](handleEntityNotFound(_0x559e04,null))['then'](respondWithResult(_0x559e04,null))[_0xbbd9('0x39')](handleError(_0x559e04,null));};exports[_0xbbd9('0x3e')]=function(_0xd223,_0x27921e){return db[_0xbbd9('0x26')][_0xbbd9('0x3e')](_0xd223[_0xbbd9('0x3f')],{})[_0xbbd9('0x21')](respondWithResult(_0x27921e,0xc9))['catch'](handleError(_0x27921e,null));};exports['update']=function(_0x5f0bef,_0x275d38){if(_0x5f0bef['body']['id']){delete _0x5f0bef['body']['id'];}return db[_0xbbd9('0x26')][_0xbbd9('0x3d')]({'where':{'id':_0x5f0bef['params']['id']}})[_0xbbd9('0x21')](handleEntityNotFound(_0x275d38,null))['then'](saveUpdates(_0x5f0bef['body'],null))[_0xbbd9('0x21')](respondWithResult(_0x275d38,null))[_0xbbd9('0x39')](handleError(_0x275d38,null));};exports['destroy']=function(_0x2e8f32,_0x201cca){return db[_0xbbd9('0x26')]['find']({'where':{'id':_0x2e8f32[_0xbbd9('0x3b')]['id']}})[_0xbbd9('0x21')](handleEntityNotFound(_0x201cca,null))[_0xbbd9('0x21')](removeEntity(_0x201cca,null))['catch'](handleError(_0x201cca,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 7069230..89f97e4 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 _0x390a=['exports','define','FreshsalesField','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshsalesField.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x390a,0xc9));var _0xa390=function(_0x235dde,_0x44a494){_0x235dde=_0x235dde-0x0;var _0x2f0f3e=_0x390a[_0x235dde];return _0x2f0f3e;};'use strict';var _=require(_0xa390('0x0'));var util=require(_0xa390('0x1'));var logger=require(_0xa390('0x2'))(_0xa390('0x3'));var moment=require('moment');var BPromise=require(_0xa390('0x4'));var rp=require(_0xa390('0x5'));var fs=require('fs');var path=require(_0xa390('0x6'));var rimraf=require(_0xa390('0x7'));var config=require('../../config/environment');var attributes=require(_0xa390('0x8'));module[_0xa390('0x9')]=function(_0x3d7cd7,_0x4ac9f5){return _0x3d7cd7[_0xa390('0xa')](_0xa390('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xa390('0xc'),_0xa390('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb350=['../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xb350,0x6f));var _0x0b35=function(_0xcd3806,_0x3182ad){_0xcd3806=_0xcd3806-0x0;var _0x5e3594=_0xb350[_0xcd3806];return _0x5e3594;};'use strict';var _=require(_0x0b35('0x0'));var util=require(_0x0b35('0x1'));var logger=require(_0x0b35('0x2'))(_0x0b35('0x3'));var moment=require('moment');var BPromise=require(_0x0b35('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b35('0x5'));var rimraf=require('rimraf');var config=require(_0x0b35('0x6'));var attributes=require(_0x0b35('0x7'));module[_0x0b35('0x8')]=function(_0x1218c3,_0x417722){return _0x1218c3[_0x0b35('0x9')](_0x0b35('0xa'),attributes,{'tableName':_0x0b35('0xb'),'paranoid':![],'indexes':[{'name':_0x0b35('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 77991ac..9126726 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 _0x2a07=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x5370cb,_0x54bc62){var _0x1d980c=function(_0x16eaf0){while(--_0x16eaf0){_0x5370cb['push'](_0x5370cb['shift']());}};_0x1d980c(++_0x54bc62);}(_0x2a07,0x74));var _0x72a0=function(_0x5528c3,_0x35a416){_0x5528c3=_0x5528c3-0x0;var _0x47ec1b=_0x2a07[_0x5528c3];return _0x47ec1b;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var moment=require(_0x72a0('0x2'));var BPromise=require(_0x72a0('0x3'));var rs=require(_0x72a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72a0('0x5'))['db'];var utils=require(_0x72a0('0x6'));var logger=require(_0x72a0('0x7'))(_0x72a0('0x8'));var config=require(_0x72a0('0x9'));var jayson=require(_0x72a0('0xa'));var client=jayson[_0x72a0('0xb')][_0x72a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x193e3b,_0x287b06,_0x21c819){return new BPromise(function(_0x2c04eb,_0x22270e){return client[_0x72a0('0xd')](_0x193e3b,_0x21c819)[_0x72a0('0xe')](function(_0x2bc45b){logger['info'](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));logger['debug'](_0x72a0('0x11'),_0x287b06,_0x72a0('0x10'),JSON[_0x72a0('0x12')](_0x2bc45b));if(_0x2bc45b[_0x72a0('0x13')]){if(_0x2bc45b[_0x72a0('0x13')]['code']===0x1f4){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);return _0x22270e(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}logger[_0x72a0('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x287b06,_0x2bc45b['error'][_0x72a0('0x14')]);return _0x2c04eb(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}else{logger[_0x72a0('0x15')](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));_0x2c04eb(_0x2bc45b['result'][_0x72a0('0x14')]);}})[_0x72a0('0x16')](function(_0x16ac70){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x16ac70);_0x22270e(_0x16ac70);});});} \ No newline at end of file +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(_0x459734,_0x2af78a){var _0x48ec57=function(_0x14bae3){while(--_0x14bae3){_0x459734['push'](_0x459734['shift']());}};_0x48ec57(++_0x2af78a);}(_0x2542,0x169));var _0x2254=function(_0x2a5d23,_0x4e18b2){_0x2a5d23=_0x2a5d23-0x0;var _0x375a55=_0x2542[_0x2a5d23];return _0x375a55;};'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 a2c7277..d18302c 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x55b8c2,_0x57f417){var _0x47f503=function(_0x59dc58){while(--_0x59dc58){_0x55b8c2['push'](_0x55b8c2['shift']());}};_0x47f503(++_0x57f417);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x223738,_0x29fdca){var _0x3f47c=function(_0x2e9918){while(--_0x2e9918){_0x223738['push'](_0x223738['shift']());}};_0x3f47c(++_0x29fdca);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 04ecfa1..80abafe 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 _0x5a13=['ENUM','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x5840ee,_0x46435e){var _0x55852c=function(_0xbc1da9){while(--_0xbc1da9){_0x5840ee['push'](_0x5840ee['shift']());}};_0x55852c(++_0x46435e);}(_0x5a13,0x145));var _0x35a1=function(_0xf99da4,_0x506f9f){_0xf99da4=_0xf99da4-0x0;var _0x1a6295=_0x5a13[_0xf99da4];return _0x1a6295;};'use strict';var Sequelize=require(_0x35a1('0x0'));module[_0x35a1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x35a1('0x2')]},'username':{'type':Sequelize[_0x35a1('0x2')],'unique':_0x35a1('0x3')},'remoteUri':{'type':Sequelize[_0x35a1('0x2')]},'password':{'type':Sequelize[_0x35a1('0x2')]},'clientId':{'type':Sequelize[_0x35a1('0x2')]},'clientSecret':{'type':Sequelize[_0x35a1('0x2')]},'securityToken':{'type':Sequelize[_0x35a1('0x2')]},'serverUrl':{'type':Sequelize[_0x35a1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x35a1('0x4')](_0x35a1('0x5'),_0x35a1('0x6')),'defaultValue':_0x35a1('0x5')}}; \ No newline at end of file +var _0x6132=['ENUM','integrationTab','newTab','exports','STRING','username'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x6132,0xf3));var _0x2613=function(_0x4d87c5,_0x2e76a7){_0x4d87c5=_0x4d87c5-0x0;var _0x53c5ca=_0x6132[_0x4d87c5];return _0x53c5ca;};'use strict';var Sequelize=require('sequelize');module[_0x2613('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2613('0x1')]},'username':{'type':Sequelize[_0x2613('0x1')],'unique':_0x2613('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x2613('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x2613('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2613('0x3')](_0x2613('0x4'),_0x2613('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index bb0e1a7..cb3a54d 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 _0x622f=['True','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','options','includeAll','include','findAll','keys','find','catch','create','body','params','getConfigurations','findOne','SalesforceConfiguration','pick','filter','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','clientSecret','username','password','lastIndexOf','Connection','login','concat','securityToken','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','boolean','textarea','phone','includes','label','picklistValues'];(function(_0x464871,_0x3b037a){var _0x51ada2=function(_0x38ebcf){while(--_0x38ebcf){_0x464871['push'](_0x464871['shift']());}};_0x51ada2(++_0x3b037a);}(_0x622f,0x176));var _0xf622=function(_0x31b7cd,_0x25c928){_0x31b7cd=_0x31b7cd-0x0;var _0x9bc742=_0x622f[_0x31b7cd];return _0x9bc742;};'use strict';var emlformat=require(_0xf622('0x0'));var rimraf=require(_0xf622('0x1'));var zipdir=require(_0xf622('0x2'));var jsonpatch=require(_0xf622('0x3'));var rp=require('request-promise');var moment=require(_0xf622('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf622('0x5'));var util=require(_0xf622('0x6'));var path=require('path');var sox=require(_0xf622('0x7'));var csv=require('to-csv');var ejs=require(_0xf622('0x8'));var fs=require('fs');var fs_extra=require(_0xf622('0x9'));var _=require(_0xf622('0xa'));var squel=require(_0xf622('0xb'));var crypto=require(_0xf622('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf622('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf622('0xe'));var Papa=require(_0xf622('0xf'));var Redis=require('ioredis');var authService=require(_0xf622('0x10'));var qs=require(_0xf622('0x11'));var as=require(_0xf622('0x12'));var hardwareService=require(_0xf622('0x13'));var logger=require('../../config/logger')(_0xf622('0x14'));var utils=require(_0xf622('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf622('0x16'));var db=require(_0xf622('0x17'))['db'];var integrations=require(_0xf622('0x18'));function respondWithStatusCode(_0x35f402,_0xb2077e){_0xb2077e=_0xb2077e||0xcc;return function(_0x327d08){if(_0x327d08){return _0x35f402[_0xf622('0x19')](_0xb2077e);}return _0x35f402[_0xf622('0x1a')](_0xb2077e)[_0xf622('0x1b')]();};}function respondWithResult(_0x1185cb,_0x1c0d8f){_0x1c0d8f=_0x1c0d8f||0xc8;return function(_0x5c777b){if(_0x5c777b){return _0x1185cb[_0xf622('0x1a')](_0x1c0d8f)['json'](_0x5c777b);}};}function respondWithFilteredResult(_0x51a0c0,_0x4b5924){return function(_0x4ca1a0){if(_0x4ca1a0){var _0x73606e=typeof _0x4b5924[_0xf622('0x1c')]===_0xf622('0x1d')&&typeof _0x4b5924[_0xf622('0x1e')]==='undefined';var _0x4ceb54=_0x4ca1a0[_0xf622('0x1f')];var _0x54dfa4=_0x73606e?0x0:_0x4b5924['offset'];var _0x4f87f9=_0x73606e?_0x4ca1a0[_0xf622('0x1f')]:_0x4b5924[_0xf622('0x1c')]+_0x4b5924[_0xf622('0x1e')];var _0x54f12e;if(_0x4f87f9>=_0x4ceb54){_0x4f87f9=_0x4ceb54;_0x54f12e=0xc8;}else{_0x54f12e=0xce;}_0x51a0c0[_0xf622('0x1a')](_0x54f12e);return _0x51a0c0['set'](_0xf622('0x20'),_0x54dfa4+'-'+_0x4f87f9+'/'+_0x4ceb54)[_0xf622('0x21')](_0x4ca1a0);}return null;};}function patchUpdates(_0x1757b8){return function(_0x4ab98c){try{jsonpatch[_0xf622('0x22')](_0x4ab98c,_0x1757b8,!![]);}catch(_0x114d04){return BPromise[_0xf622('0x23')](_0x114d04);}return _0x4ab98c[_0xf622('0x24')]();};}function saveUpdates(_0x5d5d0f,_0xca9042){return function(_0x2db80b){if(_0x2db80b){return _0x2db80b[_0xf622('0x25')](_0x5d5d0f)[_0xf622('0x26')](function(_0x46005b){return _0x46005b;});}return null;};}function removeEntity(_0x521b51,_0x198707){return function(_0x1237fb){if(_0x1237fb){return _0x1237fb[_0xf622('0x27')]()[_0xf622('0x26')](function(){_0x521b51[_0xf622('0x1a')](0xcc)[_0xf622('0x1b')]();});}};}function handleEntityNotFound(_0x1fc1d9,_0x3b82ed){return function(_0x48bbd7){if(!_0x48bbd7){_0x1fc1d9[_0xf622('0x19')](0x194);}return _0x48bbd7;};}function handleError(_0x13e69c,_0x333832){_0x333832=_0x333832||0x1f4;return function(_0xa6ce00){logger[_0xf622('0x28')](_0xa6ce00['stack']);if(_0xa6ce00[_0xf622('0x29')]){delete _0xa6ce00[_0xf622('0x29')];}_0x13e69c[_0xf622('0x1a')](_0x333832)[_0xf622('0x2a')](_0xa6ce00);};}exports[_0xf622('0x2b')]=function(_0x3ba905,_0x2ae5a7){var _0x2dfd3a={},_0x2a9294={},_0x19769b={'count':0x0,'rows':[]};var _0x1328ff=_[_0xf622('0x2c')](db[_0xf622('0x2d')][_0xf622('0x2e')],function(_0x5b725f){return{'name':_0x5b725f[_0xf622('0x2f')],'type':_0x5b725f[_0xf622('0x30')]['key']};});_0x2a9294[_0xf622('0x31')]=_[_0xf622('0x2c')](_0x1328ff,'name');_0x2a9294[_0xf622('0x32')]=_['keys'](_0x3ba905[_0xf622('0x32')]);_0x2a9294['filters']=_[_0xf622('0x33')](_0x2a9294[_0xf622('0x31')],_0x2a9294[_0xf622('0x32')]);_0x2dfd3a[_0xf622('0x34')]=_[_0xf622('0x33')](_0x2a9294[_0xf622('0x31')],qs['fields'](_0x3ba905[_0xf622('0x32')][_0xf622('0x35')]));_0x2dfd3a[_0xf622('0x34')]=_0x2dfd3a[_0xf622('0x34')][_0xf622('0x36')]?_0x2dfd3a[_0xf622('0x34')]:_0x2a9294['model'];if(!_0x3ba905[_0xf622('0x32')][_0xf622('0x37')](_0xf622('0x38'))){_0x2dfd3a['limit']=qs[_0xf622('0x1e')](_0x3ba905['query'][_0xf622('0x1e')]);_0x2dfd3a['offset']=qs[_0xf622('0x1c')](_0x3ba905[_0xf622('0x32')]['offset']);}_0x2dfd3a[_0xf622('0x39')]=qs[_0xf622('0x3a')](_0x3ba905[_0xf622('0x32')][_0xf622('0x3a')]);_0x2dfd3a[_0xf622('0x3b')]=qs[_0xf622('0x3c')](_['pick'](_0x3ba905[_0xf622('0x32')],_0x2a9294[_0xf622('0x3c')]),_0x1328ff);if(_0x3ba905['query']['filter']){_0x2dfd3a['where']=_[_0xf622('0x3d')](_0x2dfd3a[_0xf622('0x3b')],{'$or':_[_0xf622('0x2c')](_0x1328ff,function(_0x121bca){if(_0x121bca[_0xf622('0x30')]!==_0xf622('0x3e')){var _0xba8e1e={};_0xba8e1e[_0x121bca['name']]={'$like':'%'+_0x3ba905[_0xf622('0x32')]['filter']+'%'};return _0xba8e1e;}})});}_0x2dfd3a=_[_0xf622('0x3d')]({},_0x2dfd3a,_0x3ba905[_0xf622('0x3f')]);var _0x4f9cb4={'where':_0x2dfd3a[_0xf622('0x3b')]};return db['SalesforceAccount'][_0xf622('0x1f')](_0x4f9cb4)[_0xf622('0x26')](function(_0x25acd4){_0x19769b[_0xf622('0x1f')]=_0x25acd4;if(_0x3ba905['query'][_0xf622('0x40')]){_0x2dfd3a[_0xf622('0x41')]=[{'all':!![]}];}return db[_0xf622('0x2d')][_0xf622('0x42')](_0x2dfd3a);})[_0xf622('0x26')](function(_0x1d3173){_0x19769b['rows']=_0x1d3173;return _0x19769b;})[_0xf622('0x26')](respondWithFilteredResult(_0x2ae5a7,_0x2dfd3a))['catch'](handleError(_0x2ae5a7,null));};exports['show']=function(_0x463071,_0x1cf515){var _0x307cd0={'raw':![],'where':{'id':_0x463071['params']['id']}},_0x31fa67={};_0x31fa67[_0xf622('0x31')]=_[_0xf622('0x43')](db[_0xf622('0x2d')][_0xf622('0x2e')]);_0x31fa67[_0xf622('0x32')]=_[_0xf622('0x43')](_0x463071[_0xf622('0x32')]);_0x31fa67[_0xf622('0x3c')]=_[_0xf622('0x33')](_0x31fa67[_0xf622('0x31')],_0x31fa67[_0xf622('0x32')]);_0x307cd0['attributes']=_[_0xf622('0x33')](_0x31fa67[_0xf622('0x31')],qs['fields'](_0x463071['query'][_0xf622('0x35')]));_0x307cd0[_0xf622('0x34')]=_0x307cd0['attributes'][_0xf622('0x36')]?_0x307cd0[_0xf622('0x34')]:_0x31fa67[_0xf622('0x31')];if(_0x463071[_0xf622('0x32')][_0xf622('0x40')]){_0x307cd0[_0xf622('0x41')]=[{'all':!![]}];}_0x307cd0=_[_0xf622('0x3d')]({},_0x307cd0,_0x463071['options']);return db[_0xf622('0x2d')][_0xf622('0x44')](_0x307cd0)[_0xf622('0x26')](handleEntityNotFound(_0x1cf515,null))[_0xf622('0x26')](respondWithResult(_0x1cf515,null))[_0xf622('0x45')](handleError(_0x1cf515,null));};exports[_0xf622('0x46')]=function(_0x2e7a42,_0x15196f){return db['SalesforceAccount'][_0xf622('0x46')](_0x2e7a42[_0xf622('0x47')],{})[_0xf622('0x26')](respondWithResult(_0x15196f,0xc9))[_0xf622('0x45')](handleError(_0x15196f,null));};exports['update']=function(_0x345856,_0x4e76a3){if(_0x345856[_0xf622('0x47')]['id']){delete _0x345856[_0xf622('0x47')]['id'];}return db[_0xf622('0x2d')]['find']({'where':{'id':_0x345856[_0xf622('0x48')]['id']}})['then'](handleEntityNotFound(_0x4e76a3,null))['then'](saveUpdates(_0x345856[_0xf622('0x47')],null))['then'](respondWithResult(_0x4e76a3,null))[_0xf622('0x45')](handleError(_0x4e76a3,null));};exports[_0xf622('0x27')]=function(_0x502e70,_0x5e151f){return db['SalesforceAccount']['find']({'where':{'id':_0x502e70[_0xf622('0x48')]['id']}})[_0xf622('0x26')](handleEntityNotFound(_0x5e151f,null))['then'](removeEntity(_0x5e151f,null))[_0xf622('0x45')](handleError(_0x5e151f,null));};exports[_0xf622('0x49')]=function(_0x46b178,_0x3650c6,_0x1cb6d6){var _0x5f0075={};var _0x25322f={};var _0x371990;var _0x248ecb;return db[_0xf622('0x2d')][_0xf622('0x4a')]({'where':{'id':_0x46b178['params']['id']}})[_0xf622('0x26')](handleEntityNotFound(_0x3650c6,null))[_0xf622('0x26')](function(_0x81c78a){if(_0x81c78a){_0x371990=_0x81c78a;_0x25322f[_0xf622('0x31')]=_[_0xf622('0x43')](db[_0xf622('0x4b')][_0xf622('0x2e')]);_0x25322f['query']=_[_0xf622('0x43')](_0x46b178[_0xf622('0x32')]);_0x25322f['filters']=_[_0xf622('0x33')](_0x25322f[_0xf622('0x31')],_0x25322f[_0xf622('0x32')]);_0x5f0075[_0xf622('0x34')]=_[_0xf622('0x33')](_0x25322f[_0xf622('0x31')],qs['fields'](_0x46b178[_0xf622('0x32')][_0xf622('0x35')]));_0x5f0075[_0xf622('0x34')]=_0x5f0075[_0xf622('0x34')][_0xf622('0x36')]?_0x5f0075['attributes']:_0x25322f[_0xf622('0x31')];_0x5f0075['order']=qs[_0xf622('0x3a')](_0x46b178[_0xf622('0x32')][_0xf622('0x3a')]);_0x5f0075[_0xf622('0x3b')]=qs['filters'](_[_0xf622('0x4c')](_0x46b178['query'],_0x25322f[_0xf622('0x3c')]));if(_0x46b178[_0xf622('0x32')]['filter']){_0x5f0075[_0xf622('0x3b')]=_['merge'](_0x5f0075[_0xf622('0x3b')],{'$or':_['map'](_0x5f0075['attributes'],function(_0x4a8f09){var _0x433f9b={};_0x433f9b[_0x4a8f09]={'$like':'%'+_0x46b178[_0xf622('0x32')][_0xf622('0x4d')]+'%'};return _0x433f9b;})});}_0x5f0075=_[_0xf622('0x3d')]({},_0x5f0075,_0x46b178[_0xf622('0x3f')]);return _0x371990[_0xf622('0x49')](_0x5f0075);}})[_0xf622('0x26')](function(_0x2fb26f){if(_0x2fb26f){_0x248ecb=_0x2fb26f[_0xf622('0x36')];if(!_0x46b178[_0xf622('0x32')][_0xf622('0x37')](_0xf622('0x38'))){_0x5f0075[_0xf622('0x1e')]=qs[_0xf622('0x1e')](_0x46b178[_0xf622('0x32')][_0xf622('0x1e')]);_0x5f0075[_0xf622('0x1c')]=qs[_0xf622('0x1c')](_0x46b178['query'][_0xf622('0x1c')]);}return _0x371990['getConfigurations'](_0x5f0075);}})['then'](function(_0x10a8c0){if(_0x10a8c0){return _0x10a8c0?{'count':_0x248ecb,'rows':_0x10a8c0}:null;}})[_0xf622('0x26')](respondWithResult(_0x3650c6,null))['catch'](handleError(_0x3650c6,null));};exports[_0xf622('0x4e')]=function(_0x3d4d6d,_0x440e10,_0x105d6d){if(_0x3d4d6d[_0xf622('0x47')]['id']){delete _0x3d4d6d[_0xf622('0x47')]['id'];}return db[_0xf622('0x2d')]['findOne']({'where':{'id':_0x3d4d6d[_0xf622('0x48')]['id']}})[_0xf622('0x26')](handleEntityNotFound(_0x440e10,null))[_0xf622('0x26')](function(_0x6e4b81){if(_0x6e4b81){_0x3d4d6d['body'][_0xf622('0x4f')]=_0x6e4b81['id'];_0x3d4d6d['body'][_0xf622('0x50')]=integrations[_0xf622('0x51')](_0x3d4d6d[_0xf622('0x47')][_0xf622('0x52')],_0x3d4d6d[_0xf622('0x47')][_0xf622('0x30')]);_0x3d4d6d[_0xf622('0x47')]['Descriptions']=integrations[_0xf622('0x53')](_0x3d4d6d[_0xf622('0x47')][_0xf622('0x52')],_0x3d4d6d['body'][_0xf622('0x30')]);return db[_0xf622('0x4b')][_0xf622('0x46')](_0x3d4d6d['body'],{'include':[{'model':db[_0xf622('0x54')],'as':_0xf622('0x50')},{'model':db[_0xf622('0x54')],'as':_0xf622('0x55')}]});}return null;})[_0xf622('0x26')](respondWithResult(_0x440e10,null))[_0xf622('0x45')](handleError(_0x440e10,null));};exports[_0xf622('0x56')]=function(_0x4a3146,_0x50e4d9,_0x3ae8fc){var _0x125a1c;var _0x470f7b='';var _0x68397c=_0xf622('0x57');return db[_0xf622('0x2d')][_0xf622('0x4a')]({'where':{'id':_0x4a3146[_0xf622('0x48')]['id']},'attributes':['id',_0xf622('0x58'),_0xf622('0x59'),_0xf622('0x5a'),_0xf622('0x5b'),_0xf622('0x5c'),'securityToken']})[_0xf622('0x26')](handleEntityNotFound(_0x50e4d9,null))[_0xf622('0x26')](function(_0x3e51a6){if(_0x3e51a6){_0x470f7b=_0x3e51a6[_0xf622('0x58')];var _0x1e27e9=_0x470f7b['slice'](-0x1);if(_0x1e27e9==='/'){_0x470f7b=_0x470f7b['substring'](0x0,_0x470f7b[_0xf622('0x5d')](_0x1e27e9));}_0x125a1c=new jsforce[(_0xf622('0x5e'))]({'oauth2':{'loginUrl':_0x470f7b,'clientId':_0x3e51a6[_0xf622('0x59')],'clientSecret':_0x3e51a6[_0xf622('0x5a')]}});return _0x125a1c[_0xf622('0x5f')](_0x3e51a6[_0xf622('0x5b')],_0x3e51a6[_0xf622('0x5c')][_0xf622('0x60')](_0x3e51a6[_0xf622('0x61')]));}})[_0xf622('0x26')](function(_0x102f2c){if(_0x102f2c){if(!_['isNil'](_0x4a3146[_0xf622('0x32')][_0xf622('0x62')])){_0x68397c=_0x4a3146[_0xf622('0x32')]['ticketType'];}return _0x125a1c['sobject'](_0x68397c)[_0xf622('0x63')]();}})[_0xf622('0x26')](function(_0x34601f){var _0xeaf110=[_0xf622('0x64'),_0xf622('0x65'),_0xf622('0x66'),_0xf622('0x67'),_0xf622('0x68'),_0xf622('0x69')];var _0x48a07c=[_0xf622('0x6a'),'int',_0xf622('0x6b'),_0xf622('0x6c'),'email',_0xf622('0x6d'),_0xf622('0x6e')];if(_0x34601f){_['remove'](_0x34601f[_0xf622('0x35')],function(_0xb330e3){return _0xeaf110[_0xf622('0x6f')](_0xb330e3[_0xf622('0x29')])||!_0x48a07c['includes'](_0xb330e3['type']);});return{'count':_0x34601f[_0xf622('0x35')][_0xf622('0x36')],'rows':_[_0xf622('0x2c')](_0x34601f['fields'],function(_0x2c89a2){return{'id':_0x2c89a2[_0xf622('0x29')],'name':_0x2c89a2[_0xf622('0x70')],'custom':_0x2c89a2['custom'],'options':_0x2c89a2[_0xf622('0x71')]['length']>0x0?_[_0xf622('0x2c')](_0x2c89a2[_0xf622('0x71')],function(_0x366c93){return{'name':_0x366c93[_0xf622('0x70')],'value':_0x366c93['value']};}):_0x2c89a2[_0xf622('0x30')]==_0xf622('0x6c')?[{'name':_0xf622('0x72'),'value':_0xf622('0x73')},{'name':_0xf622('0x74'),'value':'false'}]:[]};})};}})[_0xf622('0x26')](respondWithResult(_0x50e4d9,null))['catch'](function(_0x37727b){var _0x43087e=_0x4a3146[_0xf622('0x32')][_0xf622('0x75')]?0x1f4:_0x37727b[_0xf622('0x76')]||0x1f4;logger[_0xf622('0x28')](_0xf622('0x77'),_0xf622('0x56'),_0x43087e,JSON[_0xf622('0x78')](_0x37727b));delete _0x37727b[_0xf622('0x29')];if(_0x43087e===0x191){_0x43087e=0x190;}_0x50e4d9['status'](_0x43087e)[_0xf622('0x2a')](_0x4a3146[_0xf622('0x32')][_0xf622('0x75')]?{'message':_0xf622('0x79'),'statusCode':_0x37727b[_0xf622('0x76')]}:_0x37727b);});}; \ No newline at end of file +var _0x64ab=['Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','getFields','statusCode','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','reject','then','destroy','end','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','update','getConfigurations','SalesforceConfiguration','pick','addConfiguration','findOne','AccountId','getSubjects','channel','getDescriptions','SalesforceField','Subjects','Descriptions','Task','remoteUri','clientId','clientSecret','username','password','securityToken','login','concat','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence'];(function(_0x2ec7f2,_0xe24da3){var _0x29de00=function(_0x383338){while(--_0x383338){_0x2ec7f2['push'](_0x2ec7f2['shift']());}};_0x29de00(++_0xe24da3);}(_0x64ab,0x110));var _0xb64a=function(_0x3f664f,_0x35b2eb){_0x3f664f=_0x3f664f-0x0;var _0x508501=_0x64ab[_0x3f664f];return _0x508501;};'use strict';var emlformat=require(_0xb64a('0x0'));var rimraf=require(_0xb64a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb64a('0x2'));var rp=require(_0xb64a('0x3'));var moment=require(_0xb64a('0x4'));var BPromise=require(_0xb64a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb64a('0x6'));var sox=require(_0xb64a('0x7'));var csv=require(_0xb64a('0x8'));var ejs=require(_0xb64a('0x9'));var fs=require('fs');var fs_extra=require(_0xb64a('0xa'));var _=require(_0xb64a('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb64a('0xc'));var deskjs=require(_0xb64a('0xd'));var toCsv=require(_0xb64a('0x8'));var querystring=require(_0xb64a('0xe'));var Papa=require(_0xb64a('0xf'));var Redis=require('ioredis');var authService=require(_0xb64a('0x10'));var qs=require(_0xb64a('0x11'));var as=require(_0xb64a('0x12'));var hardwareService=require(_0xb64a('0x13'));var logger=require(_0xb64a('0x14'))(_0xb64a('0x15'));var utils=require(_0xb64a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb64a('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x24322a,_0x58004d){_0x58004d=_0x58004d||0xcc;return function(_0xfa6cc5){if(_0xfa6cc5){return _0x24322a[_0xb64a('0x18')](_0x58004d);}return _0x24322a[_0xb64a('0x19')](_0x58004d)['end']();};}function respondWithResult(_0xe5b959,_0x4c5108){_0x4c5108=_0x4c5108||0xc8;return function(_0x3d336a){if(_0x3d336a){return _0xe5b959['status'](_0x4c5108)['json'](_0x3d336a);}};}function respondWithFilteredResult(_0x55ccbc,_0x373a58){return function(_0x1788f8){if(_0x1788f8){var _0x4e6885=typeof _0x373a58[_0xb64a('0x1a')]===_0xb64a('0x1b')&&typeof _0x373a58[_0xb64a('0x1c')]===_0xb64a('0x1b');var _0x58dccf=_0x1788f8['count'];var _0x1992ea=_0x4e6885?0x0:_0x373a58[_0xb64a('0x1a')];var _0x5a0e7b=_0x4e6885?_0x1788f8['count']:_0x373a58[_0xb64a('0x1a')]+_0x373a58[_0xb64a('0x1c')];var _0x4cbc71;if(_0x5a0e7b>=_0x58dccf){_0x5a0e7b=_0x58dccf;_0x4cbc71=0xc8;}else{_0x4cbc71=0xce;}_0x55ccbc[_0xb64a('0x19')](_0x4cbc71);return _0x55ccbc[_0xb64a('0x1d')](_0xb64a('0x1e'),_0x1992ea+'-'+_0x5a0e7b+'/'+_0x58dccf)[_0xb64a('0x1f')](_0x1788f8);}return null;};}function patchUpdates(_0x2d6ebb){return function(_0xc61ba0){try{jsonpatch[_0xb64a('0x20')](_0xc61ba0,_0x2d6ebb,!![]);}catch(_0xe89633){return BPromise[_0xb64a('0x21')](_0xe89633);}return _0xc61ba0['save']();};}function saveUpdates(_0x17d355,_0xf23c9c){return function(_0x431e69){if(_0x431e69){return _0x431e69['update'](_0x17d355)[_0xb64a('0x22')](function(_0x4fa201){return _0x4fa201;});}return null;};}function removeEntity(_0x78f77,_0x4255a1){return function(_0x31f9bc){if(_0x31f9bc){return _0x31f9bc[_0xb64a('0x23')]()[_0xb64a('0x22')](function(){_0x78f77[_0xb64a('0x19')](0xcc)[_0xb64a('0x24')]();});}};}function handleEntityNotFound(_0x5e4371,_0x53d08e){return function(_0x4f33b4){if(!_0x4f33b4){_0x5e4371['sendStatus'](0x194);}return _0x4f33b4;};}function handleError(_0x37f9b5,_0x283ecf){_0x283ecf=_0x283ecf||0x1f4;return function(_0x44b57e){logger[_0xb64a('0x25')](_0x44b57e[_0xb64a('0x26')]);if(_0x44b57e[_0xb64a('0x27')]){delete _0x44b57e[_0xb64a('0x27')];}_0x37f9b5[_0xb64a('0x19')](_0x283ecf)[_0xb64a('0x28')](_0x44b57e);};}exports[_0xb64a('0x29')]=function(_0x489ed1,_0x4529c5){var _0x5a4ce0={},_0x18c93d={},_0x1d231b={'count':0x0,'rows':[]};var _0x36bc50=_[_0xb64a('0x2a')](db[_0xb64a('0x2b')][_0xb64a('0x2c')],function(_0x3964b8){return{'name':_0x3964b8[_0xb64a('0x2d')],'type':_0x3964b8[_0xb64a('0x2e')][_0xb64a('0x2f')]};});_0x18c93d['model']=_[_0xb64a('0x2a')](_0x36bc50,_0xb64a('0x27'));_0x18c93d['query']=_[_0xb64a('0x30')](_0x489ed1[_0xb64a('0x31')]);_0x18c93d[_0xb64a('0x32')]=_[_0xb64a('0x33')](_0x18c93d['model'],_0x18c93d['query']);_0x5a4ce0[_0xb64a('0x34')]=_[_0xb64a('0x33')](_0x18c93d[_0xb64a('0x35')],qs['fields'](_0x489ed1['query'][_0xb64a('0x36')]));_0x5a4ce0['attributes']=_0x5a4ce0[_0xb64a('0x34')]['length']?_0x5a4ce0[_0xb64a('0x34')]:_0x18c93d[_0xb64a('0x35')];if(!_0x489ed1[_0xb64a('0x31')][_0xb64a('0x37')](_0xb64a('0x38'))){_0x5a4ce0[_0xb64a('0x1c')]=qs[_0xb64a('0x1c')](_0x489ed1[_0xb64a('0x31')]['limit']);_0x5a4ce0[_0xb64a('0x1a')]=qs[_0xb64a('0x1a')](_0x489ed1[_0xb64a('0x31')][_0xb64a('0x1a')]);}_0x5a4ce0[_0xb64a('0x39')]=qs[_0xb64a('0x3a')](_0x489ed1[_0xb64a('0x31')]['sort']);_0x5a4ce0[_0xb64a('0x3b')]=qs['filters'](_['pick'](_0x489ed1[_0xb64a('0x31')],_0x18c93d[_0xb64a('0x32')]),_0x36bc50);if(_0x489ed1[_0xb64a('0x31')][_0xb64a('0x3c')]){_0x5a4ce0[_0xb64a('0x3b')]=_[_0xb64a('0x3d')](_0x5a4ce0[_0xb64a('0x3b')],{'$or':_[_0xb64a('0x2a')](_0x36bc50,function(_0xe69885){if(_0xe69885[_0xb64a('0x2e')]!=='VIRTUAL'){var _0xfa0a04={};_0xfa0a04[_0xe69885['name']]={'$like':'%'+_0x489ed1[_0xb64a('0x31')][_0xb64a('0x3c')]+'%'};return _0xfa0a04;}})});}_0x5a4ce0=_['merge']({},_0x5a4ce0,_0x489ed1[_0xb64a('0x3e')]);var _0x4c997d={'where':_0x5a4ce0[_0xb64a('0x3b')]};return db[_0xb64a('0x2b')][_0xb64a('0x3f')](_0x4c997d)[_0xb64a('0x22')](function(_0x2a440c){_0x1d231b[_0xb64a('0x3f')]=_0x2a440c;if(_0x489ed1[_0xb64a('0x31')]['includeAll']){_0x5a4ce0[_0xb64a('0x40')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xb64a('0x41')](_0x5a4ce0);})[_0xb64a('0x22')](function(_0x5d4662){_0x1d231b[_0xb64a('0x42')]=_0x5d4662;return _0x1d231b;})['then'](respondWithFilteredResult(_0x4529c5,_0x5a4ce0))[_0xb64a('0x43')](handleError(_0x4529c5,null));};exports[_0xb64a('0x44')]=function(_0x1430c5,_0xad7537){var _0x438b36={'raw':![],'where':{'id':_0x1430c5[_0xb64a('0x45')]['id']}},_0x525fef={};_0x525fef[_0xb64a('0x35')]=_['keys'](db[_0xb64a('0x2b')][_0xb64a('0x2c')]);_0x525fef[_0xb64a('0x31')]=_[_0xb64a('0x30')](_0x1430c5['query']);_0x525fef[_0xb64a('0x32')]=_[_0xb64a('0x33')](_0x525fef[_0xb64a('0x35')],_0x525fef['query']);_0x438b36[_0xb64a('0x34')]=_[_0xb64a('0x33')](_0x525fef[_0xb64a('0x35')],qs[_0xb64a('0x36')](_0x1430c5[_0xb64a('0x31')][_0xb64a('0x36')]));_0x438b36[_0xb64a('0x34')]=_0x438b36['attributes'][_0xb64a('0x46')]?_0x438b36[_0xb64a('0x34')]:_0x525fef[_0xb64a('0x35')];if(_0x1430c5['query'][_0xb64a('0x47')]){_0x438b36[_0xb64a('0x40')]=[{'all':!![]}];}_0x438b36=_[_0xb64a('0x3d')]({},_0x438b36,_0x1430c5['options']);return db[_0xb64a('0x2b')][_0xb64a('0x48')](_0x438b36)[_0xb64a('0x22')](handleEntityNotFound(_0xad7537,null))['then'](respondWithResult(_0xad7537,null))[_0xb64a('0x43')](handleError(_0xad7537,null));};exports[_0xb64a('0x49')]=function(_0x1a1303,_0x3e4a4b){return db[_0xb64a('0x2b')][_0xb64a('0x49')](_0x1a1303[_0xb64a('0x4a')],{})[_0xb64a('0x22')](respondWithResult(_0x3e4a4b,0xc9))[_0xb64a('0x43')](handleError(_0x3e4a4b,null));};exports[_0xb64a('0x4b')]=function(_0x2561e8,_0x4926e0){if(_0x2561e8[_0xb64a('0x4a')]['id']){delete _0x2561e8[_0xb64a('0x4a')]['id'];}return db[_0xb64a('0x2b')][_0xb64a('0x48')]({'where':{'id':_0x2561e8['params']['id']}})[_0xb64a('0x22')](handleEntityNotFound(_0x4926e0,null))[_0xb64a('0x22')](saveUpdates(_0x2561e8[_0xb64a('0x4a')],null))[_0xb64a('0x22')](respondWithResult(_0x4926e0,null))[_0xb64a('0x43')](handleError(_0x4926e0,null));};exports['destroy']=function(_0x4c0f28,_0x4f491d){return db[_0xb64a('0x2b')][_0xb64a('0x48')]({'where':{'id':_0x4c0f28[_0xb64a('0x45')]['id']}})[_0xb64a('0x22')](handleEntityNotFound(_0x4f491d,null))[_0xb64a('0x22')](removeEntity(_0x4f491d,null))[_0xb64a('0x43')](handleError(_0x4f491d,null));};exports[_0xb64a('0x4c')]=function(_0xfac9e2,_0x52a4c5,_0x50ad6d){var _0x155878={};var _0x5b27c3={};var _0x3b7961;var _0x12c639;return db[_0xb64a('0x2b')]['findOne']({'where':{'id':_0xfac9e2[_0xb64a('0x45')]['id']}})[_0xb64a('0x22')](handleEntityNotFound(_0x52a4c5,null))[_0xb64a('0x22')](function(_0x5ac9c3){if(_0x5ac9c3){_0x3b7961=_0x5ac9c3;_0x5b27c3[_0xb64a('0x35')]=_[_0xb64a('0x30')](db[_0xb64a('0x4d')][_0xb64a('0x2c')]);_0x5b27c3['query']=_[_0xb64a('0x30')](_0xfac9e2[_0xb64a('0x31')]);_0x5b27c3['filters']=_['intersection'](_0x5b27c3[_0xb64a('0x35')],_0x5b27c3[_0xb64a('0x31')]);_0x155878[_0xb64a('0x34')]=_['intersection'](_0x5b27c3[_0xb64a('0x35')],qs[_0xb64a('0x36')](_0xfac9e2[_0xb64a('0x31')][_0xb64a('0x36')]));_0x155878['attributes']=_0x155878[_0xb64a('0x34')][_0xb64a('0x46')]?_0x155878[_0xb64a('0x34')]:_0x5b27c3[_0xb64a('0x35')];_0x155878[_0xb64a('0x39')]=qs[_0xb64a('0x3a')](_0xfac9e2['query'][_0xb64a('0x3a')]);_0x155878[_0xb64a('0x3b')]=qs[_0xb64a('0x32')](_[_0xb64a('0x4e')](_0xfac9e2['query'],_0x5b27c3[_0xb64a('0x32')]));if(_0xfac9e2[_0xb64a('0x31')]['filter']){_0x155878[_0xb64a('0x3b')]=_[_0xb64a('0x3d')](_0x155878[_0xb64a('0x3b')],{'$or':_['map'](_0x155878[_0xb64a('0x34')],function(_0x4429ce){var _0x2a6149={};_0x2a6149[_0x4429ce]={'$like':'%'+_0xfac9e2[_0xb64a('0x31')][_0xb64a('0x3c')]+'%'};return _0x2a6149;})});}_0x155878=_['merge']({},_0x155878,_0xfac9e2[_0xb64a('0x3e')]);return _0x3b7961[_0xb64a('0x4c')](_0x155878);}})['then'](function(_0x4c9a30){if(_0x4c9a30){_0x12c639=_0x4c9a30[_0xb64a('0x46')];if(!_0xfac9e2[_0xb64a('0x31')]['hasOwnProperty'](_0xb64a('0x38'))){_0x155878[_0xb64a('0x1c')]=qs[_0xb64a('0x1c')](_0xfac9e2['query'][_0xb64a('0x1c')]);_0x155878['offset']=qs[_0xb64a('0x1a')](_0xfac9e2[_0xb64a('0x31')][_0xb64a('0x1a')]);}return _0x3b7961['getConfigurations'](_0x155878);}})[_0xb64a('0x22')](function(_0x3dddfe){if(_0x3dddfe){return _0x3dddfe?{'count':_0x12c639,'rows':_0x3dddfe}:null;}})[_0xb64a('0x22')](respondWithResult(_0x52a4c5,null))[_0xb64a('0x43')](handleError(_0x52a4c5,null));};exports[_0xb64a('0x4f')]=function(_0x181f8d,_0x222340,_0x5e9843){if(_0x181f8d[_0xb64a('0x4a')]['id']){delete _0x181f8d[_0xb64a('0x4a')]['id'];}return db[_0xb64a('0x2b')][_0xb64a('0x50')]({'where':{'id':_0x181f8d[_0xb64a('0x45')]['id']}})['then'](handleEntityNotFound(_0x222340,null))[_0xb64a('0x22')](function(_0x1181af){if(_0x1181af){_0x181f8d[_0xb64a('0x4a')][_0xb64a('0x51')]=_0x1181af['id'];_0x181f8d[_0xb64a('0x4a')]['Subjects']=integrations[_0xb64a('0x52')](_0x181f8d[_0xb64a('0x4a')][_0xb64a('0x53')],_0x181f8d['body'][_0xb64a('0x2e')]);_0x181f8d[_0xb64a('0x4a')]['Descriptions']=integrations[_0xb64a('0x54')](_0x181f8d[_0xb64a('0x4a')][_0xb64a('0x53')],_0x181f8d[_0xb64a('0x4a')][_0xb64a('0x2e')]);return db[_0xb64a('0x4d')][_0xb64a('0x49')](_0x181f8d['body'],{'include':[{'model':db[_0xb64a('0x55')],'as':_0xb64a('0x56')},{'model':db[_0xb64a('0x55')],'as':_0xb64a('0x57')}]});}return null;})[_0xb64a('0x22')](respondWithResult(_0x222340,null))[_0xb64a('0x43')](handleError(_0x222340,null));};exports['getFields']=function(_0x2a8490,_0x198cc0,_0x4bb9e4){var _0x3bdf3f;var _0x441e86='';var _0x41d941=_0xb64a('0x58');return db[_0xb64a('0x2b')][_0xb64a('0x50')]({'where':{'id':_0x2a8490[_0xb64a('0x45')]['id']},'attributes':['id',_0xb64a('0x59'),_0xb64a('0x5a'),_0xb64a('0x5b'),_0xb64a('0x5c'),_0xb64a('0x5d'),_0xb64a('0x5e')]})[_0xb64a('0x22')](handleEntityNotFound(_0x198cc0,null))[_0xb64a('0x22')](function(_0x256103){if(_0x256103){_0x441e86=_0x256103[_0xb64a('0x59')];var _0x1804e5=_0x441e86['slice'](-0x1);if(_0x1804e5==='/'){_0x441e86=_0x441e86['substring'](0x0,_0x441e86['lastIndexOf'](_0x1804e5));}_0x3bdf3f=new jsforce['Connection']({'oauth2':{'loginUrl':_0x441e86,'clientId':_0x256103[_0xb64a('0x5a')],'clientSecret':_0x256103['clientSecret']}});return _0x3bdf3f[_0xb64a('0x5f')](_0x256103[_0xb64a('0x5c')],_0x256103[_0xb64a('0x5d')][_0xb64a('0x60')](_0x256103[_0xb64a('0x5e')]));}})[_0xb64a('0x22')](function(_0x4b4244){if(_0x4b4244){if(!_['isNil'](_0x2a8490['query'][_0xb64a('0x61')])){_0x41d941=_0x2a8490['query'][_0xb64a('0x61')];}return _0x3bdf3f[_0xb64a('0x62')](_0x41d941)[_0xb64a('0x63')]();}})[_0xb64a('0x22')](function(_0x514c88){var _0x434475=['OwnerId',_0xb64a('0x64'),_0xb64a('0x65'),_0xb64a('0x66'),_0xb64a('0x67'),_0xb64a('0x68')];var _0x4e4f4e=[_0xb64a('0x69'),_0xb64a('0x6a'),_0xb64a('0x6b'),_0xb64a('0x6c'),_0xb64a('0x6d'),_0xb64a('0x6e'),_0xb64a('0x6f')];if(_0x514c88){_[_0xb64a('0x70')](_0x514c88['fields'],function(_0x360c96){return _0x434475['includes'](_0x360c96['name'])||!_0x4e4f4e[_0xb64a('0x71')](_0x360c96[_0xb64a('0x2e')]);});return{'count':_0x514c88[_0xb64a('0x36')]['length'],'rows':_[_0xb64a('0x2a')](_0x514c88[_0xb64a('0x36')],function(_0x5138ca){return{'id':_0x5138ca['name'],'name':_0x5138ca[_0xb64a('0x72')],'custom':_0x5138ca[_0xb64a('0x73')],'options':_0x5138ca['picklistValues'][_0xb64a('0x46')]>0x0?_[_0xb64a('0x2a')](_0x5138ca[_0xb64a('0x74')],function(_0x185ea9){return{'name':_0x185ea9[_0xb64a('0x72')],'value':_0x185ea9[_0xb64a('0x75')]};}):_0x5138ca[_0xb64a('0x2e')]==_0xb64a('0x6c')?[{'name':_0xb64a('0x76'),'value':_0xb64a('0x77')},{'name':_0xb64a('0x78'),'value':_0xb64a('0x79')}]:[]};})};}})[_0xb64a('0x22')](respondWithResult(_0x198cc0,null))[_0xb64a('0x43')](function(_0x2f4d1b){var _0x2c92af=_0x2a8490[_0xb64a('0x31')][_0xb64a('0x7a')]?0x1f4:_0x2f4d1b['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xb64a('0x7b'),_0x2c92af,JSON['stringify'](_0x2f4d1b));delete _0x2f4d1b['name'];if(_0x2c92af===0x191){_0x2c92af=0x190;}_0x198cc0[_0xb64a('0x19')](_0x2c92af)['send'](_0x2a8490['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x2f4d1b[_0xb64a('0x7c')]}:_0x2f4d1b);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index c15967a..da2ff6c 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 _0xdb38=['../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x2ba6e6,_0x2490c1){var _0x15cc0e=function(_0x8b9cd9){while(--_0x8b9cd9){_0x2ba6e6['push'](_0x2ba6e6['shift']());}};_0x15cc0e(++_0x2490c1);}(_0xdb38,0x19a));var _0x8db3=function(_0x30ae4a,_0x342d49){_0x30ae4a=_0x30ae4a-0x0;var _0x417ff8=_0xdb38[_0x30ae4a];return _0x417ff8;};'use strict';var _=require(_0x8db3('0x0'));var util=require(_0x8db3('0x1'));var logger=require('../../config/logger')(_0x8db3('0x2'));var moment=require(_0x8db3('0x3'));var BPromise=require(_0x8db3('0x4'));var rp=require(_0x8db3('0x5'));var fs=require('fs');var path=require(_0x8db3('0x6'));var rimraf=require(_0x8db3('0x7'));var config=require(_0x8db3('0x8'));var attributes=require(_0x8db3('0x9'));var integrations=require(_0x8db3('0xa'));module[_0x8db3('0xb')]=function(_0x273778,_0x3d2854){return _0x273778[_0x8db3('0xc')](_0x8db3('0xd'),attributes,{'tableName':_0x8db3('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fdc=['SalesforceAccount','int_salesforce_accounts','util','api','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x4eee9e,_0x57aa9f){var _0x37bc2b=function(_0x34f107){while(--_0x34f107){_0x4eee9e['push'](_0x4eee9e['shift']());}};_0x37bc2b(++_0x57aa9f);}(_0x9fdc,0xce));var _0xc9fd=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9fdc[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var util=require(_0xc9fd('0x0'));var logger=require('../../config/logger')(_0xc9fd('0x1'));var moment=require(_0xc9fd('0x2'));var BPromise=require(_0xc9fd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9fd('0x4'));var rimraf=require(_0xc9fd('0x5'));var config=require(_0xc9fd('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xc9fd('0x7'));module[_0xc9fd('0x8')]=function(_0x50f0cb,_0x191117){return _0x50f0cb[_0xc9fd('0x9')](_0xc9fd('0xa'),attributes,{'tableName':_0xc9fd('0xb'),'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 fff10ed..20244d6 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 _0x36d7=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','attributes','limit','map','include','model','stringify','ShowSalesforceAccount','find','raw','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x36d7,0xf7));var _0x736d=function(_0x3a4838,_0x5eb63c){_0x3a4838=_0x3a4838-0x0;var _0x10fc53=_0x36d7[_0x3a4838];return _0x10fc53;};'use strict';var _=require(_0x736d('0x0'));var util=require(_0x736d('0x1'));var moment=require(_0x736d('0x2'));var BPromise=require(_0x736d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x736d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x736d('0x5'))(_0x736d('0x6'));var config=require(_0x736d('0x7'));var jayson=require(_0x736d('0x8'));var client=jayson[_0x736d('0x9')][_0x736d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x441402,_0x4d9963,_0x172c0f){return new BPromise(function(_0x5668c,_0x28aa26){return client[_0x736d('0xb')](_0x441402,_0x172c0f)[_0x736d('0xc')](function(_0x5c118f){logger[_0x736d('0xd')](_0x736d('0xe'),_0x4d9963,_0x736d('0xf'));logger[_0x736d('0x10')](_0x736d('0x11'),_0x4d9963,_0x736d('0xf'),JSON['stringify'](_0x5c118f));if(_0x5c118f[_0x736d('0x12')]){if(_0x5c118f[_0x736d('0x12')][_0x736d('0x13')]===0x1f4){logger[_0x736d('0x12')](_0x736d('0xe'),_0x4d9963,_0x5c118f[_0x736d('0x12')][_0x736d('0x14')]);return _0x28aa26(_0x5c118f[_0x736d('0x12')][_0x736d('0x14')]);}logger[_0x736d('0x12')](_0x736d('0xe'),_0x4d9963,_0x5c118f[_0x736d('0x12')][_0x736d('0x14')]);return _0x5668c(_0x5c118f[_0x736d('0x12')][_0x736d('0x14')]);}else{logger[_0x736d('0xd')](_0x736d('0xe'),_0x4d9963,_0x736d('0xf'));_0x5668c(_0x5c118f['result'][_0x736d('0x14')]);}})[_0x736d('0x15')](function(_0xe57ed){logger[_0x736d('0x12')](_0x736d('0xe'),_0x4d9963,_0xe57ed);_0x28aa26(_0xe57ed);});});}exports[_0x736d('0x16')]=function(_0x3ec8de){var _0x27461e=this;return new Promise(function(_0xef0fc3,_0x44d3dc){return db[_0x736d('0x17')][_0x736d('0x18')]({'raw':_0x3ec8de[_0x736d('0x19')]?_0x3ec8de[_0x736d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3ec8de['options']?_0x3ec8de['options'][_0x736d('0x1a')]||null:null,'attributes':_0x3ec8de[_0x736d('0x19')]?_0x3ec8de[_0x736d('0x19')][_0x736d('0x1b')]||null:null,'limit':_0x3ec8de[_0x736d('0x19')]?_0x3ec8de[_0x736d('0x19')][_0x736d('0x1c')]||null:null,'include':_0x3ec8de[_0x736d('0x19')]?_0x3ec8de['options']['include']?_[_0x736d('0x1d')](_0x3ec8de['options'][_0x736d('0x1e')],function(_0x31895a){return{'model':db[_0x31895a[_0x736d('0x1f')]],'as':_0x31895a['as'],'attributes':_0x31895a[_0x736d('0x1b')],'include':_0x31895a[_0x736d('0x1e')]?_[_0x736d('0x1d')](_0x31895a[_0x736d('0x1e')],function(_0x1456d4){return{'model':db[_0x1456d4[_0x736d('0x1f')]],'as':_0x1456d4['as'],'attributes':_0x1456d4[_0x736d('0x1b')],'include':_0x1456d4[_0x736d('0x1e')]?_[_0x736d('0x1d')](_0x1456d4['include'],function(_0x418861){return{'model':db[_0x418861['model']],'as':_0x418861['as'],'attributes':_0x418861[_0x736d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x736d('0xc')](function(_0x1b77ca){logger[_0x736d('0xd')](_0x736d('0x16'),_0x3ec8de);logger['debug']('GetSalesforceAccount',_0x3ec8de,JSON[_0x736d('0x20')](_0x1b77ca));_0xef0fc3(_0x1b77ca);})[_0x736d('0x15')](function(_0xea52d1){logger['error']('GetSalesforceAccount',_0xea52d1[_0x736d('0x14')],_0x3ec8de);_0x44d3dc(_0x27461e[_0x736d('0x12')](0x1f4,_0xea52d1['message']));});});};exports[_0x736d('0x21')]=function(_0x42cc25){var _0x9fe687=this;return new Promise(function(_0x1b97b0,_0x3c19b0){return db[_0x736d('0x17')][_0x736d('0x22')]({'raw':_0x42cc25[_0x736d('0x19')]?_0x42cc25[_0x736d('0x19')][_0x736d('0x23')]===undefined?!![]:![]:!![],'where':_0x42cc25[_0x736d('0x19')]?_0x42cc25[_0x736d('0x19')]['where']||null:null,'attributes':_0x42cc25[_0x736d('0x19')]?_0x42cc25[_0x736d('0x19')][_0x736d('0x1b')]||null:null,'include':_0x42cc25[_0x736d('0x19')]?_0x42cc25[_0x736d('0x19')][_0x736d('0x1e')]?_[_0x736d('0x1d')](_0x42cc25[_0x736d('0x19')]['include'],function(_0x22b8cc){return{'model':db[_0x22b8cc[_0x736d('0x1f')]],'as':_0x22b8cc['as'],'attributes':_0x22b8cc[_0x736d('0x1b')],'include':_0x22b8cc[_0x736d('0x1e')]?_[_0x736d('0x1d')](_0x22b8cc[_0x736d('0x1e')],function(_0x3ea8a1){return{'model':db[_0x3ea8a1['model']],'as':_0x3ea8a1['as'],'attributes':_0x3ea8a1[_0x736d('0x1b')],'include':_0x3ea8a1[_0x736d('0x1e')]?_[_0x736d('0x1d')](_0x3ea8a1['include'],function(_0x195ec1){return{'model':db[_0x195ec1[_0x736d('0x1f')]],'as':_0x195ec1['as'],'attributes':_0x195ec1[_0x736d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x736d('0xc')](function(_0x2f8a37){logger['info'](_0x736d('0x21'),_0x42cc25);logger[_0x736d('0x10')](_0x736d('0x21'),_0x42cc25,JSON[_0x736d('0x20')](_0x2f8a37));_0x1b97b0(_0x2f8a37);})[_0x736d('0x15')](function(_0x239854){logger[_0x736d('0x12')]('ShowSalesforceAccount',_0x239854[_0x736d('0x14')],_0x42cc25);_0x3c19b0(_0x9fe687[_0x736d('0x12')](0x1f4,_0x239854[_0x736d('0x14')]));});});}; \ No newline at end of file +var _0xd3ad=['GetSalesforceAccount','ShowSalesforceAccount','find','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','SalesforceAccount','options','raw','attributes','limit','include','map','model'];(function(_0x1c880f,_0x51c1c2){var _0x4a13f3=function(_0x16a9e9){while(--_0x16a9e9){_0x1c880f['push'](_0x1c880f['shift']());}};_0x4a13f3(++_0x51c1c2);}(_0xd3ad,0x90));var _0xdd3a=function(_0x5ce435,_0x14a009){_0x5ce435=_0x5ce435-0x0;var _0x43a035=_0xd3ad[_0x5ce435];return _0x43a035;};'use strict';var _=require(_0xdd3a('0x0'));var util=require(_0xdd3a('0x1'));var moment=require('moment');var BPromise=require(_0xdd3a('0x2'));var rs=require(_0xdd3a('0x3'));var fs=require('fs');var Redis=require(_0xdd3a('0x4'));var db=require(_0xdd3a('0x5'))['db'];var utils=require(_0xdd3a('0x6'));var logger=require(_0xdd3a('0x7'))(_0xdd3a('0x8'));var config=require(_0xdd3a('0x9'));var jayson=require(_0xdd3a('0xa'));var client=jayson['client'][_0xdd3a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x442bda,_0x5d0473,_0x522da8){return new BPromise(function(_0x946716,_0x3da71d){return client[_0xdd3a('0xc')](_0x442bda,_0x522da8)[_0xdd3a('0xd')](function(_0x2fbd61){logger['info'](_0xdd3a('0xe'),_0x5d0473,_0xdd3a('0xf'));logger[_0xdd3a('0x10')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x5d0473,'request\x20sent',JSON[_0xdd3a('0x11')](_0x2fbd61));if(_0x2fbd61[_0xdd3a('0x12')]){if(_0x2fbd61[_0xdd3a('0x12')][_0xdd3a('0x13')]===0x1f4){logger[_0xdd3a('0x12')](_0xdd3a('0xe'),_0x5d0473,_0x2fbd61[_0xdd3a('0x12')][_0xdd3a('0x14')]);return _0x3da71d(_0x2fbd61[_0xdd3a('0x12')][_0xdd3a('0x14')]);}logger['error'](_0xdd3a('0xe'),_0x5d0473,_0x2fbd61[_0xdd3a('0x12')][_0xdd3a('0x14')]);return _0x946716(_0x2fbd61[_0xdd3a('0x12')][_0xdd3a('0x14')]);}else{logger[_0xdd3a('0x15')](_0xdd3a('0xe'),_0x5d0473,_0xdd3a('0xf'));_0x946716(_0x2fbd61['result']['message']);}})[_0xdd3a('0x16')](function(_0x4d6707){logger[_0xdd3a('0x12')](_0xdd3a('0xe'),_0x5d0473,_0x4d6707);_0x3da71d(_0x4d6707);});});}exports['GetSalesforceAccount']=function(_0x5d4117){var _0x24ac06=this;return new Promise(function(_0x4e707c,_0x5f5966){return db[_0xdd3a('0x17')]['findAll']({'raw':_0x5d4117[_0xdd3a('0x18')]?_0x5d4117[_0xdd3a('0x18')][_0xdd3a('0x19')]===undefined?!![]:![]:!![],'where':_0x5d4117[_0xdd3a('0x18')]?_0x5d4117[_0xdd3a('0x18')]['where']||null:null,'attributes':_0x5d4117['options']?_0x5d4117[_0xdd3a('0x18')][_0xdd3a('0x1a')]||null:null,'limit':_0x5d4117[_0xdd3a('0x18')]?_0x5d4117[_0xdd3a('0x18')][_0xdd3a('0x1b')]||null:null,'include':_0x5d4117[_0xdd3a('0x18')]?_0x5d4117[_0xdd3a('0x18')][_0xdd3a('0x1c')]?_[_0xdd3a('0x1d')](_0x5d4117[_0xdd3a('0x18')][_0xdd3a('0x1c')],function(_0x2439da){return{'model':db[_0x2439da[_0xdd3a('0x1e')]],'as':_0x2439da['as'],'attributes':_0x2439da[_0xdd3a('0x1a')],'include':_0x2439da[_0xdd3a('0x1c')]?_['map'](_0x2439da[_0xdd3a('0x1c')],function(_0x33ef95){return{'model':db[_0x33ef95[_0xdd3a('0x1e')]],'as':_0x33ef95['as'],'attributes':_0x33ef95[_0xdd3a('0x1a')],'include':_0x33ef95['include']?_[_0xdd3a('0x1d')](_0x33ef95[_0xdd3a('0x1c')],function(_0x193566){return{'model':db[_0x193566[_0xdd3a('0x1e')]],'as':_0x193566['as'],'attributes':_0x193566[_0xdd3a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdd3a('0xd')](function(_0x46a422){logger['info']('GetSalesforceAccount',_0x5d4117);logger['debug']('GetSalesforceAccount',_0x5d4117,JSON[_0xdd3a('0x11')](_0x46a422));_0x4e707c(_0x46a422);})[_0xdd3a('0x16')](function(_0x2728c5){logger[_0xdd3a('0x12')](_0xdd3a('0x1f'),_0x2728c5[_0xdd3a('0x14')],_0x5d4117);_0x5f5966(_0x24ac06['error'](0x1f4,_0x2728c5[_0xdd3a('0x14')]));});});};exports[_0xdd3a('0x20')]=function(_0x268d3c){var _0xced190=this;return new Promise(function(_0x5de914,_0x23928b){return db[_0xdd3a('0x17')][_0xdd3a('0x21')]({'raw':_0x268d3c['options']?_0x268d3c['options'][_0xdd3a('0x19')]===undefined?!![]:![]:!![],'where':_0x268d3c['options']?_0x268d3c[_0xdd3a('0x18')][_0xdd3a('0x22')]||null:null,'attributes':_0x268d3c[_0xdd3a('0x18')]?_0x268d3c[_0xdd3a('0x18')][_0xdd3a('0x1a')]||null:null,'include':_0x268d3c['options']?_0x268d3c[_0xdd3a('0x18')][_0xdd3a('0x1c')]?_[_0xdd3a('0x1d')](_0x268d3c['options'][_0xdd3a('0x1c')],function(_0x547feb){return{'model':db[_0x547feb[_0xdd3a('0x1e')]],'as':_0x547feb['as'],'attributes':_0x547feb[_0xdd3a('0x1a')],'include':_0x547feb['include']?_['map'](_0x547feb[_0xdd3a('0x1c')],function(_0x6a3c8a){return{'model':db[_0x6a3c8a[_0xdd3a('0x1e')]],'as':_0x6a3c8a['as'],'attributes':_0x6a3c8a['attributes'],'include':_0x6a3c8a['include']?_['map'](_0x6a3c8a['include'],function(_0xf6871e){return{'model':db[_0xf6871e['model']],'as':_0xf6871e['as'],'attributes':_0xf6871e['attributes']};}):[]};}):[]};}):[]:[]})[_0xdd3a('0xd')](function(_0x9ff171){logger[_0xdd3a('0x15')]('ShowSalesforceAccount',_0x268d3c);logger[_0xdd3a('0x10')](_0xdd3a('0x20'),_0x268d3c,JSON['stringify'](_0x9ff171));_0x5de914(_0x9ff171);})[_0xdd3a('0x16')](function(_0x56999c){logger['error'](_0xdd3a('0x20'),_0x56999c[_0xdd3a('0x14')],_0x268d3c);_0x23928b(_0xced190[_0xdd3a('0x12')](0x1f4,_0x56999c[_0xdd3a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 9e40e3a..98f5750 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x2971c0,_0x4ee553){var _0x488fea=function(_0x25f9ba){while(--_0x25f9ba){_0x2971c0['push'](_0x2971c0['shift']());}};_0x488fea(++_0x4ee553);}(_0x2ef3,0xba));var _0x32ef=function(_0x29c8ab,_0xbeb750){_0x29c8ab=_0x29c8ab-0x0;var _0x54ad77=_0x2ef3[_0x29c8ab];return _0x54ad77;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x2ac55d,_0x516771){var _0x59486b=function(_0x3e1900){while(--_0x3e1900){_0x2ac55d['push'](_0x2ac55d['shift']());}};_0x59486b(++_0x516771);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index f6a031c..4d8c04d 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 _0x1637=['account','lead','sequelize','exports','STRING','ENUM','Task','Case','contact','account_contact_lead'];(function(_0x1301aa,_0x4da5c4){var _0x5146a1=function(_0x417cd1){while(--_0x417cd1){_0x1301aa['push'](_0x1301aa['shift']());}};_0x5146a1(++_0x4da5c4);}(_0x1637,0x14c));var _0x7163=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x1637[_0x62c958];return _0x57ec61;};'use strict';var Sequelize=require(_0x7163('0x0'));module[_0x7163('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7163('0x2')]},'ticketType':{'type':Sequelize[_0x7163('0x3')](_0x7163('0x4'),_0x7163('0x5')),'defaultValue':_0x7163('0x4')},'moduleSearch':{'type':Sequelize[_0x7163('0x3')]('contact_lead',_0x7163('0x6'),'lead',_0x7163('0x7'),_0x7163('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x7163('0x3')]('nothing',_0x7163('0x6'),_0x7163('0x9'),'account'),'defaultValue':_0x7163('0x9')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x7163('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x7163('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x7163('0x2')]}}; \ No newline at end of file +var _0x8f58=['nothing','sequelize','STRING','ENUM','Task','contact_lead','contact','lead','account'];(function(_0xa35c14,_0xb8d25e){var _0x42fd1b=function(_0xd778ed){while(--_0xd778ed){_0xa35c14['push'](_0xa35c14['shift']());}};_0x42fd1b(++_0xb8d25e);}(_0x8f58,0xeb));var _0x88f5=function(_0x4f3feb,_0x1d1f17){_0x4f3feb=_0x4f3feb-0x0;var _0xf68dfd=_0x8f58[_0x4f3feb];return _0xf68dfd;};'use strict';var Sequelize=require(_0x88f5('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x88f5('0x1')]},'ticketType':{'type':Sequelize[_0x88f5('0x2')](_0x88f5('0x3'),'Case'),'defaultValue':_0x88f5('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0x88f5('0x4'),_0x88f5('0x5'),_0x88f5('0x6'),'account_contact_lead',_0x88f5('0x7')),'defaultValue':_0x88f5('0x4')},'moduleCreate':{'type':Sequelize[_0x88f5('0x2')](_0x88f5('0x8'),_0x88f5('0x5'),'lead','account'),'defaultValue':_0x88f5('0x6')},'leadId':{'type':Sequelize[_0x88f5('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x88f5('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 5f7343f..e19f6ad 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 _0x4f5d=['../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','index','map','SalesforceConfiguration','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','merge','type','VIRTUAL','filter','options','where','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','getFields','findOne','SalesforceField','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x3ad768,_0xe1650b){var _0x40ed7c=function(_0x513502){while(--_0x513502){_0x3ad768['push'](_0x3ad768['shift']());}};_0x40ed7c(++_0xe1650b);}(_0x4f5d,0x1d1));var _0xd4f5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4f5d[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xd4f5('0x0'));var rimraf=require(_0xd4f5('0x1'));var zipdir=require(_0xd4f5('0x2'));var jsonpatch=require(_0xd4f5('0x3'));var rp=require(_0xd4f5('0x4'));var moment=require(_0xd4f5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd4f5('0x6'));var util=require(_0xd4f5('0x7'));var path=require(_0xd4f5('0x8'));var sox=require(_0xd4f5('0x9'));var csv=require(_0xd4f5('0xa'));var ejs=require(_0xd4f5('0xb'));var fs=require('fs');var fs_extra=require(_0xd4f5('0xc'));var _=require(_0xd4f5('0xd'));var squel=require(_0xd4f5('0xe'));var crypto=require(_0xd4f5('0xf'));var jsforce=require(_0xd4f5('0x10'));var deskjs=require(_0xd4f5('0x11'));var toCsv=require(_0xd4f5('0xa'));var querystring=require('querystring');var Papa=require(_0xd4f5('0x12'));var Redis=require(_0xd4f5('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd4f5('0x14'));var as=require(_0xd4f5('0x15'));var hardwareService=require(_0xd4f5('0x16'));var logger=require(_0xd4f5('0x17'))(_0xd4f5('0x18'));var utils=require(_0xd4f5('0x19'));var config=require(_0xd4f5('0x1a'));var licenseUtil=require(_0xd4f5('0x1b'));var db=require(_0xd4f5('0x1c'))['db'];function respondWithStatusCode(_0x5d5554,_0x445072){_0x445072=_0x445072||0xcc;return function(_0x21b2a2){if(_0x21b2a2){return _0x5d5554['sendStatus'](_0x445072);}return _0x5d5554[_0xd4f5('0x1d')](_0x445072)[_0xd4f5('0x1e')]();};}function respondWithResult(_0x28e1cf,_0x511fcf){_0x511fcf=_0x511fcf||0xc8;return function(_0x166d4d){if(_0x166d4d){return _0x28e1cf[_0xd4f5('0x1d')](_0x511fcf)[_0xd4f5('0x1f')](_0x166d4d);}};}function respondWithFilteredResult(_0x1a158f,_0x33f6dc){return function(_0x32f4b7){if(_0x32f4b7){var _0x23780a=typeof _0x33f6dc[_0xd4f5('0x20')]==='undefined'&&typeof _0x33f6dc[_0xd4f5('0x21')]==='undefined';var _0x45d043=_0x32f4b7['count'];var _0x220707=_0x23780a?0x0:_0x33f6dc[_0xd4f5('0x20')];var _0x271f53=_0x23780a?_0x32f4b7[_0xd4f5('0x22')]:_0x33f6dc[_0xd4f5('0x20')]+_0x33f6dc[_0xd4f5('0x21')];var _0x8c7e05;if(_0x271f53>=_0x45d043){_0x271f53=_0x45d043;_0x8c7e05=0xc8;}else{_0x8c7e05=0xce;}_0x1a158f[_0xd4f5('0x1d')](_0x8c7e05);return _0x1a158f['set'](_0xd4f5('0x23'),_0x220707+'-'+_0x271f53+'/'+_0x45d043)[_0xd4f5('0x1f')](_0x32f4b7);}return null;};}function patchUpdates(_0x57a16b){return function(_0x1aae04){try{jsonpatch[_0xd4f5('0x24')](_0x1aae04,_0x57a16b,!![]);}catch(_0x47f101){return BPromise['reject'](_0x47f101);}return _0x1aae04[_0xd4f5('0x25')]();};}function saveUpdates(_0x161443,_0x3cbe7b){return function(_0x3ae7af){if(_0x3ae7af){return _0x3ae7af[_0xd4f5('0x26')](_0x161443)[_0xd4f5('0x27')](function(_0x378af6){return _0x378af6;});}return null;};}function removeEntity(_0x527dd4,_0x578071){return function(_0x5ccc63){if(_0x5ccc63){return _0x5ccc63[_0xd4f5('0x28')]()[_0xd4f5('0x27')](function(){_0x527dd4[_0xd4f5('0x1d')](0xcc)[_0xd4f5('0x1e')]();});}};}function handleEntityNotFound(_0x5f3a5d,_0xb7ea1){return function(_0x49ad32){if(!_0x49ad32){_0x5f3a5d[_0xd4f5('0x29')](0x194);}return _0x49ad32;};}function handleError(_0x2fbee8,_0x5b519e){_0x5b519e=_0x5b519e||0x1f4;return function(_0x5ba979){logger['error'](_0x5ba979[_0xd4f5('0x2a')]);if(_0x5ba979[_0xd4f5('0x2b')]){delete _0x5ba979['name'];}_0x2fbee8[_0xd4f5('0x1d')](_0x5b519e)['send'](_0x5ba979);};}exports[_0xd4f5('0x2c')]=function(_0xb5dd60,_0x2134f2){var _0x2130e4={},_0x32d067={},_0xc64585={'count':0x0,'rows':[]};var _0x405b97=_[_0xd4f5('0x2d')](db[_0xd4f5('0x2e')]['rawAttributes'],function(_0x4a602f){return{'name':_0x4a602f['fieldName'],'type':_0x4a602f['type'][_0xd4f5('0x2f')]};});_0x32d067[_0xd4f5('0x30')]=_[_0xd4f5('0x2d')](_0x405b97,_0xd4f5('0x2b'));_0x32d067['query']=_[_0xd4f5('0x31')](_0xb5dd60[_0xd4f5('0x32')]);_0x32d067[_0xd4f5('0x33')]=_[_0xd4f5('0x34')](_0x32d067[_0xd4f5('0x30')],_0x32d067[_0xd4f5('0x32')]);_0x2130e4[_0xd4f5('0x35')]=_[_0xd4f5('0x34')](_0x32d067[_0xd4f5('0x30')],qs['fields'](_0xb5dd60['query'][_0xd4f5('0x36')]));_0x2130e4[_0xd4f5('0x35')]=_0x2130e4[_0xd4f5('0x35')][_0xd4f5('0x37')]?_0x2130e4[_0xd4f5('0x35')]:_0x32d067['model'];if(!_0xb5dd60[_0xd4f5('0x32')][_0xd4f5('0x38')](_0xd4f5('0x39'))){_0x2130e4['limit']=qs[_0xd4f5('0x21')](_0xb5dd60[_0xd4f5('0x32')][_0xd4f5('0x21')]);_0x2130e4[_0xd4f5('0x20')]=qs[_0xd4f5('0x20')](_0xb5dd60[_0xd4f5('0x32')]['offset']);}_0x2130e4['order']=qs['sort'](_0xb5dd60[_0xd4f5('0x32')][_0xd4f5('0x3a')]);_0x2130e4['where']=qs[_0xd4f5('0x33')](_[_0xd4f5('0x3b')](_0xb5dd60['query'],_0x32d067[_0xd4f5('0x33')]),_0x405b97);if(_0xb5dd60[_0xd4f5('0x32')]['filter']){_0x2130e4['where']=_[_0xd4f5('0x3c')](_0x2130e4['where'],{'$or':_[_0xd4f5('0x2d')](_0x405b97,function(_0x3070bb){if(_0x3070bb[_0xd4f5('0x3d')]!==_0xd4f5('0x3e')){var _0x4323a2={};_0x4323a2[_0x3070bb[_0xd4f5('0x2b')]]={'$like':'%'+_0xb5dd60[_0xd4f5('0x32')][_0xd4f5('0x3f')]+'%'};return _0x4323a2;}})});}_0x2130e4=_['merge']({},_0x2130e4,_0xb5dd60[_0xd4f5('0x40')]);var _0x22722b={'where':_0x2130e4[_0xd4f5('0x41')]};return db[_0xd4f5('0x2e')][_0xd4f5('0x22')](_0x22722b)[_0xd4f5('0x27')](function(_0x21b182){_0xc64585['count']=_0x21b182;if(_0xb5dd60['query'][_0xd4f5('0x42')]){_0x2130e4[_0xd4f5('0x43')]=[{'all':!![]}];}return db[_0xd4f5('0x2e')]['findAll'](_0x2130e4);})['then'](function(_0x30d859){_0xc64585[_0xd4f5('0x44')]=_0x30d859;return _0xc64585;})[_0xd4f5('0x27')](respondWithFilteredResult(_0x2134f2,_0x2130e4))[_0xd4f5('0x45')](handleError(_0x2134f2,null));};exports[_0xd4f5('0x46')]=function(_0x4c0d75,_0x2e5596){var _0x3ab206={'raw':![],'where':{'id':_0x4c0d75[_0xd4f5('0x47')]['id']}},_0x24bd9b={};_0x24bd9b[_0xd4f5('0x30')]=_[_0xd4f5('0x31')](db[_0xd4f5('0x2e')][_0xd4f5('0x48')]);_0x24bd9b['query']=_[_0xd4f5('0x31')](_0x4c0d75['query']);_0x24bd9b['filters']=_['intersection'](_0x24bd9b[_0xd4f5('0x30')],_0x24bd9b[_0xd4f5('0x32')]);_0x3ab206['attributes']=_['intersection'](_0x24bd9b[_0xd4f5('0x30')],qs[_0xd4f5('0x36')](_0x4c0d75['query']['fields']));_0x3ab206[_0xd4f5('0x35')]=_0x3ab206[_0xd4f5('0x35')][_0xd4f5('0x37')]?_0x3ab206[_0xd4f5('0x35')]:_0x24bd9b['model'];if(_0x4c0d75[_0xd4f5('0x32')]['includeAll']){_0x3ab206[_0xd4f5('0x43')]=[{'all':!![]}];}_0x3ab206=_[_0xd4f5('0x3c')]({},_0x3ab206,_0x4c0d75[_0xd4f5('0x40')]);return db['SalesforceConfiguration']['find'](_0x3ab206)[_0xd4f5('0x27')](handleEntityNotFound(_0x2e5596,null))[_0xd4f5('0x27')](respondWithResult(_0x2e5596,null))[_0xd4f5('0x45')](handleError(_0x2e5596,null));};exports[_0xd4f5('0x49')]=function(_0x4a995f,_0x1687b2){return db['SalesforceConfiguration'][_0xd4f5('0x49')](_0x4a995f[_0xd4f5('0x4a')],{})[_0xd4f5('0x27')](respondWithResult(_0x1687b2,0xc9))[_0xd4f5('0x45')](handleError(_0x1687b2,null));};exports[_0xd4f5('0x26')]=function(_0xfeef22,_0x4fb122){if(_0xfeef22['body']['id']){delete _0xfeef22['body']['id'];}return db[_0xd4f5('0x2e')]['find']({'where':{'id':_0xfeef22['params']['id']}})[_0xd4f5('0x27')](handleEntityNotFound(_0x4fb122,null))[_0xd4f5('0x27')](saveUpdates(_0xfeef22[_0xd4f5('0x4a')],null))['then'](respondWithResult(_0x4fb122,null))[_0xd4f5('0x45')](handleError(_0x4fb122,null));};exports['destroy']=function(_0x5c8e34,_0x5e0b9c){return db[_0xd4f5('0x2e')][_0xd4f5('0x4b')]({'where':{'id':_0x5c8e34['params']['id']}})[_0xd4f5('0x27')](handleEntityNotFound(_0x5e0b9c,null))[_0xd4f5('0x27')](removeEntity(_0x5e0b9c,null))[_0xd4f5('0x45')](handleError(_0x5e0b9c,null));};exports[_0xd4f5('0x4c')]=function(_0x2c8172,_0x5c93b9,_0x613fc0){var _0x52d63b={};var _0x464394={};var _0x5bd044;var _0x120d8d;return db[_0xd4f5('0x2e')][_0xd4f5('0x4d')]({'where':{'id':_0x2c8172['params']['id']}})[_0xd4f5('0x27')](handleEntityNotFound(_0x5c93b9,null))[_0xd4f5('0x27')](function(_0x17c45e){if(_0x17c45e){_0x5bd044=_0x17c45e;_0x464394[_0xd4f5('0x30')]=_[_0xd4f5('0x31')](db[_0xd4f5('0x4e')][_0xd4f5('0x48')]);_0x464394['query']=_['keys'](_0x2c8172[_0xd4f5('0x32')]);_0x464394[_0xd4f5('0x33')]=_[_0xd4f5('0x34')](_0x464394[_0xd4f5('0x30')],_0x464394['query']);_0x52d63b[_0xd4f5('0x35')]=_[_0xd4f5('0x34')](_0x464394[_0xd4f5('0x30')],qs['fields'](_0x2c8172[_0xd4f5('0x32')]['fields']));_0x52d63b[_0xd4f5('0x35')]=_0x52d63b[_0xd4f5('0x35')][_0xd4f5('0x37')]?_0x52d63b['attributes']:_0x464394[_0xd4f5('0x30')];_0x52d63b[_0xd4f5('0x4f')]=qs[_0xd4f5('0x3a')](_0x2c8172[_0xd4f5('0x32')][_0xd4f5('0x3a')]);_0x52d63b[_0xd4f5('0x41')]=qs['filters'](_[_0xd4f5('0x3b')](_0x2c8172[_0xd4f5('0x32')],_0x464394[_0xd4f5('0x33')]));if(_0x2c8172[_0xd4f5('0x32')][_0xd4f5('0x3f')]){_0x52d63b[_0xd4f5('0x41')]=_['merge'](_0x52d63b['where'],{'$or':_['map'](_0x52d63b[_0xd4f5('0x35')],function(_0x1e74b0){var _0x12a741={};_0x12a741[_0x1e74b0]={'$like':'%'+_0x2c8172['query'][_0xd4f5('0x3f')]+'%'};return _0x12a741;})});}_0x52d63b=_['merge']({},_0x52d63b,_0x2c8172[_0xd4f5('0x40')]);return _0x5bd044[_0xd4f5('0x4c')](_0x52d63b);}})['then'](function(_0x3bf9a5){if(_0x3bf9a5){_0x120d8d=_0x3bf9a5[_0xd4f5('0x37')];if(!_0x2c8172['query'][_0xd4f5('0x38')](_0xd4f5('0x39'))){_0x52d63b['limit']=qs[_0xd4f5('0x21')](_0x2c8172['query'][_0xd4f5('0x21')]);_0x52d63b['offset']=qs[_0xd4f5('0x20')](_0x2c8172[_0xd4f5('0x32')][_0xd4f5('0x20')]);}return _0x5bd044[_0xd4f5('0x4c')](_0x52d63b);}})[_0xd4f5('0x27')](function(_0x2e4de9){if(_0x2e4de9){return _0x2e4de9?{'count':_0x120d8d,'rows':_0x2e4de9}:null;}})[_0xd4f5('0x27')](respondWithResult(_0x5c93b9,null))[_0xd4f5('0x45')](handleError(_0x5c93b9,null));};exports[_0xd4f5('0x50')]=function(_0x342490,_0x1adc92,_0x598551){var _0x338d77={};var _0x32671d={};var _0x2e60be;var _0x425be2;return db[_0xd4f5('0x2e')]['findOne']({'where':{'id':_0x342490[_0xd4f5('0x47')]['id']}})[_0xd4f5('0x27')](handleEntityNotFound(_0x1adc92,null))[_0xd4f5('0x27')](function(_0x437ef7){if(_0x437ef7){_0x2e60be=_0x437ef7;_0x32671d[_0xd4f5('0x30')]=_[_0xd4f5('0x31')](db['SalesforceField'][_0xd4f5('0x48')]);_0x32671d[_0xd4f5('0x32')]=_[_0xd4f5('0x31')](_0x342490[_0xd4f5('0x32')]);_0x32671d['filters']=_[_0xd4f5('0x34')](_0x32671d['model'],_0x32671d[_0xd4f5('0x32')]);_0x338d77[_0xd4f5('0x35')]=_[_0xd4f5('0x34')](_0x32671d[_0xd4f5('0x30')],qs['fields'](_0x342490['query'][_0xd4f5('0x36')]));_0x338d77[_0xd4f5('0x35')]=_0x338d77[_0xd4f5('0x35')][_0xd4f5('0x37')]?_0x338d77[_0xd4f5('0x35')]:_0x32671d['model'];_0x338d77[_0xd4f5('0x4f')]=qs['sort'](_0x342490['query']['sort']);_0x338d77['where']=qs['filters'](_[_0xd4f5('0x3b')](_0x342490[_0xd4f5('0x32')],_0x32671d[_0xd4f5('0x33')]));if(_0x342490[_0xd4f5('0x32')][_0xd4f5('0x3f')]){_0x338d77['where']=_[_0xd4f5('0x3c')](_0x338d77['where'],{'$or':_[_0xd4f5('0x2d')](_0x338d77[_0xd4f5('0x35')],function(_0xf720c0){var _0x4f4fe7={};_0x4f4fe7[_0xf720c0]={'$like':'%'+_0x342490['query'][_0xd4f5('0x3f')]+'%'};return _0x4f4fe7;})});}_0x338d77=_[_0xd4f5('0x3c')]({},_0x338d77,_0x342490['options']);return _0x2e60be[_0xd4f5('0x50')](_0x338d77);}})[_0xd4f5('0x27')](function(_0x4b1416){if(_0x4b1416){_0x425be2=_0x4b1416[_0xd4f5('0x37')];if(!_0x342490[_0xd4f5('0x32')][_0xd4f5('0x38')](_0xd4f5('0x39'))){_0x338d77[_0xd4f5('0x21')]=qs[_0xd4f5('0x21')](_0x342490[_0xd4f5('0x32')][_0xd4f5('0x21')]);_0x338d77[_0xd4f5('0x20')]=qs['offset'](_0x342490[_0xd4f5('0x32')]['offset']);}return _0x2e60be[_0xd4f5('0x50')](_0x338d77);}})[_0xd4f5('0x27')](function(_0x61b656){if(_0x61b656){return _0x61b656?{'count':_0x425be2,'rows':_0x61b656}:null;}})[_0xd4f5('0x27')](respondWithResult(_0x1adc92,null))[_0xd4f5('0x45')](handleError(_0x1adc92,null));};exports['getDescriptions']=function(_0x10488c,_0x52f1dd,_0x31bf51){var _0x211a24={};var _0x5653e7={};var _0x599844;var _0x4814fc;return db[_0xd4f5('0x2e')]['findOne']({'where':{'id':_0x10488c['params']['id']}})[_0xd4f5('0x27')](handleEntityNotFound(_0x52f1dd,null))['then'](function(_0x1ca2b9){if(_0x1ca2b9){_0x599844=_0x1ca2b9;_0x5653e7['model']=_[_0xd4f5('0x31')](db['SalesforceField'][_0xd4f5('0x48')]);_0x5653e7[_0xd4f5('0x32')]=_[_0xd4f5('0x31')](_0x10488c[_0xd4f5('0x32')]);_0x5653e7[_0xd4f5('0x33')]=_[_0xd4f5('0x34')](_0x5653e7[_0xd4f5('0x30')],_0x5653e7[_0xd4f5('0x32')]);_0x211a24[_0xd4f5('0x35')]=_[_0xd4f5('0x34')](_0x5653e7['model'],qs['fields'](_0x10488c[_0xd4f5('0x32')][_0xd4f5('0x36')]));_0x211a24[_0xd4f5('0x35')]=_0x211a24[_0xd4f5('0x35')][_0xd4f5('0x37')]?_0x211a24[_0xd4f5('0x35')]:_0x5653e7['model'];_0x211a24['order']=qs[_0xd4f5('0x3a')](_0x10488c[_0xd4f5('0x32')]['sort']);_0x211a24[_0xd4f5('0x41')]=qs['filters'](_[_0xd4f5('0x3b')](_0x10488c[_0xd4f5('0x32')],_0x5653e7[_0xd4f5('0x33')]));if(_0x10488c[_0xd4f5('0x32')][_0xd4f5('0x3f')]){_0x211a24['where']=_[_0xd4f5('0x3c')](_0x211a24['where'],{'$or':_[_0xd4f5('0x2d')](_0x211a24[_0xd4f5('0x35')],function(_0x2c31d7){var _0xcbe1c={};_0xcbe1c[_0x2c31d7]={'$like':'%'+_0x10488c['query'][_0xd4f5('0x3f')]+'%'};return _0xcbe1c;})});}_0x211a24=_[_0xd4f5('0x3c')]({},_0x211a24,_0x10488c[_0xd4f5('0x40')]);return _0x599844[_0xd4f5('0x51')](_0x211a24);}})[_0xd4f5('0x27')](function(_0x3d1a32){if(_0x3d1a32){_0x4814fc=_0x3d1a32[_0xd4f5('0x37')];if(!_0x10488c['query'][_0xd4f5('0x38')]('nolimit')){_0x211a24[_0xd4f5('0x21')]=qs[_0xd4f5('0x21')](_0x10488c[_0xd4f5('0x32')][_0xd4f5('0x21')]);_0x211a24[_0xd4f5('0x20')]=qs[_0xd4f5('0x20')](_0x10488c[_0xd4f5('0x32')]['offset']);}return _0x599844[_0xd4f5('0x51')](_0x211a24);}})['then'](function(_0x26bbd5){if(_0x26bbd5){return _0x26bbd5?{'count':_0x4814fc,'rows':_0x26bbd5}:null;}})[_0xd4f5('0x27')](respondWithResult(_0x52f1dd,null))[_0xd4f5('0x45')](handleError(_0x52f1dd,null));}; \ No newline at end of file +var _0x9f4b=['SalesforceField','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','SalesforceConfiguration','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','body','find','getFields','findOne'];(function(_0x34f980,_0x387963){var _0x5069c0=function(_0x581f72){while(--_0x581f72){_0x34f980['push'](_0x34f980['shift']());}};_0x5069c0(++_0x387963);}(_0x9f4b,0xfc));var _0xb9f4=function(_0x20cfab,_0x1e46f1){_0x20cfab=_0x20cfab-0x0;var _0x4c0a22=_0x9f4b[_0x20cfab];return _0x4c0a22;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb9f4('0x0'));var jsonpatch=require(_0xb9f4('0x1'));var rp=require(_0xb9f4('0x2'));var moment=require(_0xb9f4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb9f4('0x4'));var util=require(_0xb9f4('0x5'));var path=require(_0xb9f4('0x6'));var sox=require(_0xb9f4('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb9f4('0x8'));var _=require(_0xb9f4('0x9'));var squel=require(_0xb9f4('0xa'));var crypto=require(_0xb9f4('0xb'));var jsforce=require(_0xb9f4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb9f4('0xd'));var querystring=require('querystring');var Papa=require(_0xb9f4('0xe'));var Redis=require(_0xb9f4('0xf'));var authService=require(_0xb9f4('0x10'));var qs=require(_0xb9f4('0x11'));var as=require(_0xb9f4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb9f4('0x13'))(_0xb9f4('0x14'));var utils=require(_0xb9f4('0x15'));var config=require(_0xb9f4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb9f4('0x17'))['db'];function respondWithStatusCode(_0x29850f,_0x2e4572){_0x2e4572=_0x2e4572||0xcc;return function(_0x4fb403){if(_0x4fb403){return _0x29850f[_0xb9f4('0x18')](_0x2e4572);}return _0x29850f[_0xb9f4('0x19')](_0x2e4572)[_0xb9f4('0x1a')]();};}function respondWithResult(_0x4c948e,_0x255e35){_0x255e35=_0x255e35||0xc8;return function(_0x42bc1d){if(_0x42bc1d){return _0x4c948e['status'](_0x255e35)[_0xb9f4('0x1b')](_0x42bc1d);}};}function respondWithFilteredResult(_0x2dcabe,_0x15bfad){return function(_0x3c1297){if(_0x3c1297){var _0x24c9b5=typeof _0x15bfad[_0xb9f4('0x1c')]==='undefined'&&typeof _0x15bfad[_0xb9f4('0x1d')]===_0xb9f4('0x1e');var _0x49dd12=_0x3c1297[_0xb9f4('0x1f')];var _0x519040=_0x24c9b5?0x0:_0x15bfad[_0xb9f4('0x1c')];var _0x5f1763=_0x24c9b5?_0x3c1297[_0xb9f4('0x1f')]:_0x15bfad['offset']+_0x15bfad[_0xb9f4('0x1d')];var _0x3f28ca;if(_0x5f1763>=_0x49dd12){_0x5f1763=_0x49dd12;_0x3f28ca=0xc8;}else{_0x3f28ca=0xce;}_0x2dcabe[_0xb9f4('0x19')](_0x3f28ca);return _0x2dcabe[_0xb9f4('0x20')](_0xb9f4('0x21'),_0x519040+'-'+_0x5f1763+'/'+_0x49dd12)[_0xb9f4('0x1b')](_0x3c1297);}return null;};}function patchUpdates(_0x8f6ce){return function(_0x1b1234){try{jsonpatch[_0xb9f4('0x22')](_0x1b1234,_0x8f6ce,!![]);}catch(_0x549f43){return BPromise[_0xb9f4('0x23')](_0x549f43);}return _0x1b1234[_0xb9f4('0x24')]();};}function saveUpdates(_0x5d5a65,_0x2b6a38){return function(_0xe8a6b){if(_0xe8a6b){return _0xe8a6b[_0xb9f4('0x25')](_0x5d5a65)[_0xb9f4('0x26')](function(_0x35742d){return _0x35742d;});}return null;};}function removeEntity(_0x58efa3,_0x48e4a6){return function(_0x2812fd){if(_0x2812fd){return _0x2812fd[_0xb9f4('0x27')]()[_0xb9f4('0x26')](function(){_0x58efa3[_0xb9f4('0x19')](0xcc)[_0xb9f4('0x1a')]();});}};}function handleEntityNotFound(_0x2d1df2,_0x1cea80){return function(_0x3abac2){if(!_0x3abac2){_0x2d1df2[_0xb9f4('0x18')](0x194);}return _0x3abac2;};}function handleError(_0x1dbf39,_0x14ea94){_0x14ea94=_0x14ea94||0x1f4;return function(_0x6b6b89){logger[_0xb9f4('0x28')](_0x6b6b89[_0xb9f4('0x29')]);if(_0x6b6b89[_0xb9f4('0x2a')]){delete _0x6b6b89[_0xb9f4('0x2a')];}_0x1dbf39['status'](_0x14ea94)[_0xb9f4('0x2b')](_0x6b6b89);};}exports['index']=function(_0x382078,_0x107331){var _0x25f43e={},_0x2925dd={},_0x443b72={'count':0x0,'rows':[]};var _0x23fa53=_[_0xb9f4('0x2c')](db[_0xb9f4('0x2d')]['rawAttributes'],function(_0x3cadd0){return{'name':_0x3cadd0[_0xb9f4('0x2e')],'type':_0x3cadd0[_0xb9f4('0x2f')][_0xb9f4('0x30')]};});_0x2925dd[_0xb9f4('0x31')]=_[_0xb9f4('0x2c')](_0x23fa53,'name');_0x2925dd['query']=_[_0xb9f4('0x32')](_0x382078[_0xb9f4('0x33')]);_0x2925dd['filters']=_['intersection'](_0x2925dd[_0xb9f4('0x31')],_0x2925dd[_0xb9f4('0x33')]);_0x25f43e[_0xb9f4('0x34')]=_[_0xb9f4('0x35')](_0x2925dd[_0xb9f4('0x31')],qs[_0xb9f4('0x36')](_0x382078[_0xb9f4('0x33')][_0xb9f4('0x36')]));_0x25f43e[_0xb9f4('0x34')]=_0x25f43e[_0xb9f4('0x34')][_0xb9f4('0x37')]?_0x25f43e['attributes']:_0x2925dd[_0xb9f4('0x31')];if(!_0x382078[_0xb9f4('0x33')][_0xb9f4('0x38')](_0xb9f4('0x39'))){_0x25f43e[_0xb9f4('0x1d')]=qs[_0xb9f4('0x1d')](_0x382078['query']['limit']);_0x25f43e[_0xb9f4('0x1c')]=qs['offset'](_0x382078[_0xb9f4('0x33')]['offset']);}_0x25f43e[_0xb9f4('0x3a')]=qs['sort'](_0x382078['query'][_0xb9f4('0x3b')]);_0x25f43e['where']=qs[_0xb9f4('0x3c')](_[_0xb9f4('0x3d')](_0x382078['query'],_0x2925dd['filters']),_0x23fa53);if(_0x382078['query'][_0xb9f4('0x3e')]){_0x25f43e[_0xb9f4('0x3f')]=_[_0xb9f4('0x40')](_0x25f43e[_0xb9f4('0x3f')],{'$or':_['map'](_0x23fa53,function(_0x14e48e){if(_0x14e48e[_0xb9f4('0x2f')]!==_0xb9f4('0x41')){var _0x21a79c={};_0x21a79c[_0x14e48e[_0xb9f4('0x2a')]]={'$like':'%'+_0x382078[_0xb9f4('0x33')][_0xb9f4('0x3e')]+'%'};return _0x21a79c;}})});}_0x25f43e=_[_0xb9f4('0x40')]({},_0x25f43e,_0x382078[_0xb9f4('0x42')]);var _0x3afbb6={'where':_0x25f43e[_0xb9f4('0x3f')]};return db[_0xb9f4('0x2d')][_0xb9f4('0x1f')](_0x3afbb6)[_0xb9f4('0x26')](function(_0x9ed7cd){_0x443b72[_0xb9f4('0x1f')]=_0x9ed7cd;if(_0x382078[_0xb9f4('0x33')][_0xb9f4('0x43')]){_0x25f43e['include']=[{'all':!![]}];}return db[_0xb9f4('0x2d')][_0xb9f4('0x44')](_0x25f43e);})[_0xb9f4('0x26')](function(_0x1af987){_0x443b72[_0xb9f4('0x45')]=_0x1af987;return _0x443b72;})['then'](respondWithFilteredResult(_0x107331,_0x25f43e))[_0xb9f4('0x46')](handleError(_0x107331,null));};exports[_0xb9f4('0x47')]=function(_0x2e05f2,_0x4252db){var _0x377dd7={'raw':![],'where':{'id':_0x2e05f2[_0xb9f4('0x48')]['id']}},_0x98d591={};_0x98d591[_0xb9f4('0x31')]=_['keys'](db[_0xb9f4('0x2d')][_0xb9f4('0x49')]);_0x98d591[_0xb9f4('0x33')]=_[_0xb9f4('0x32')](_0x2e05f2['query']);_0x98d591[_0xb9f4('0x3c')]=_['intersection'](_0x98d591[_0xb9f4('0x31')],_0x98d591[_0xb9f4('0x33')]);_0x377dd7[_0xb9f4('0x34')]=_['intersection'](_0x98d591['model'],qs[_0xb9f4('0x36')](_0x2e05f2[_0xb9f4('0x33')][_0xb9f4('0x36')]));_0x377dd7[_0xb9f4('0x34')]=_0x377dd7[_0xb9f4('0x34')]['length']?_0x377dd7[_0xb9f4('0x34')]:_0x98d591[_0xb9f4('0x31')];if(_0x2e05f2[_0xb9f4('0x33')][_0xb9f4('0x43')]){_0x377dd7[_0xb9f4('0x4a')]=[{'all':!![]}];}_0x377dd7=_[_0xb9f4('0x40')]({},_0x377dd7,_0x2e05f2[_0xb9f4('0x42')]);return db['SalesforceConfiguration']['find'](_0x377dd7)[_0xb9f4('0x26')](handleEntityNotFound(_0x4252db,null))[_0xb9f4('0x26')](respondWithResult(_0x4252db,null))[_0xb9f4('0x46')](handleError(_0x4252db,null));};exports[_0xb9f4('0x4b')]=function(_0x2aef3c,_0x509093){return db[_0xb9f4('0x2d')]['create'](_0x2aef3c[_0xb9f4('0x4c')],{})['then'](respondWithResult(_0x509093,0xc9))[_0xb9f4('0x46')](handleError(_0x509093,null));};exports[_0xb9f4('0x25')]=function(_0x23299b,_0xef69c8){if(_0x23299b[_0xb9f4('0x4c')]['id']){delete _0x23299b[_0xb9f4('0x4c')]['id'];}return db['SalesforceConfiguration'][_0xb9f4('0x4d')]({'where':{'id':_0x23299b[_0xb9f4('0x48')]['id']}})['then'](handleEntityNotFound(_0xef69c8,null))[_0xb9f4('0x26')](saveUpdates(_0x23299b[_0xb9f4('0x4c')],null))[_0xb9f4('0x26')](respondWithResult(_0xef69c8,null))['catch'](handleError(_0xef69c8,null));};exports[_0xb9f4('0x27')]=function(_0x28ac96,_0x4ed7ee){return db[_0xb9f4('0x2d')][_0xb9f4('0x4d')]({'where':{'id':_0x28ac96[_0xb9f4('0x48')]['id']}})[_0xb9f4('0x26')](handleEntityNotFound(_0x4ed7ee,null))[_0xb9f4('0x26')](removeEntity(_0x4ed7ee,null))[_0xb9f4('0x46')](handleError(_0x4ed7ee,null));};exports[_0xb9f4('0x4e')]=function(_0x9dc3bc,_0x388e1a,_0x5dfb65){var _0x4e6d3f={};var _0x54799e={};var _0x321201;var _0x2f06a3;return db[_0xb9f4('0x2d')][_0xb9f4('0x4f')]({'where':{'id':_0x9dc3bc[_0xb9f4('0x48')]['id']}})[_0xb9f4('0x26')](handleEntityNotFound(_0x388e1a,null))['then'](function(_0x3e26e1){if(_0x3e26e1){_0x321201=_0x3e26e1;_0x54799e[_0xb9f4('0x31')]=_[_0xb9f4('0x32')](db[_0xb9f4('0x50')]['rawAttributes']);_0x54799e['query']=_['keys'](_0x9dc3bc[_0xb9f4('0x33')]);_0x54799e['filters']=_[_0xb9f4('0x35')](_0x54799e['model'],_0x54799e[_0xb9f4('0x33')]);_0x4e6d3f[_0xb9f4('0x34')]=_['intersection'](_0x54799e[_0xb9f4('0x31')],qs[_0xb9f4('0x36')](_0x9dc3bc[_0xb9f4('0x33')]['fields']));_0x4e6d3f[_0xb9f4('0x34')]=_0x4e6d3f[_0xb9f4('0x34')][_0xb9f4('0x37')]?_0x4e6d3f['attributes']:_0x54799e[_0xb9f4('0x31')];_0x4e6d3f[_0xb9f4('0x3a')]=qs[_0xb9f4('0x3b')](_0x9dc3bc[_0xb9f4('0x33')][_0xb9f4('0x3b')]);_0x4e6d3f[_0xb9f4('0x3f')]=qs[_0xb9f4('0x3c')](_[_0xb9f4('0x3d')](_0x9dc3bc[_0xb9f4('0x33')],_0x54799e[_0xb9f4('0x3c')]));if(_0x9dc3bc[_0xb9f4('0x33')][_0xb9f4('0x3e')]){_0x4e6d3f['where']=_['merge'](_0x4e6d3f[_0xb9f4('0x3f')],{'$or':_['map'](_0x4e6d3f[_0xb9f4('0x34')],function(_0x563998){var _0x336399={};_0x336399[_0x563998]={'$like':'%'+_0x9dc3bc[_0xb9f4('0x33')]['filter']+'%'};return _0x336399;})});}_0x4e6d3f=_[_0xb9f4('0x40')]({},_0x4e6d3f,_0x9dc3bc[_0xb9f4('0x42')]);return _0x321201['getFields'](_0x4e6d3f);}})[_0xb9f4('0x26')](function(_0x3c2c51){if(_0x3c2c51){_0x2f06a3=_0x3c2c51[_0xb9f4('0x37')];if(!_0x9dc3bc[_0xb9f4('0x33')][_0xb9f4('0x38')](_0xb9f4('0x39'))){_0x4e6d3f[_0xb9f4('0x1d')]=qs['limit'](_0x9dc3bc[_0xb9f4('0x33')]['limit']);_0x4e6d3f['offset']=qs[_0xb9f4('0x1c')](_0x9dc3bc['query']['offset']);}return _0x321201[_0xb9f4('0x4e')](_0x4e6d3f);}})[_0xb9f4('0x26')](function(_0xbd904b){if(_0xbd904b){return _0xbd904b?{'count':_0x2f06a3,'rows':_0xbd904b}:null;}})[_0xb9f4('0x26')](respondWithResult(_0x388e1a,null))[_0xb9f4('0x46')](handleError(_0x388e1a,null));};exports[_0xb9f4('0x51')]=function(_0x1216fb,_0x7a74,_0x3fcdba){var _0x2e1405={};var _0x222991={};var _0x12ae8d;var _0x5434e8;return db[_0xb9f4('0x2d')]['findOne']({'where':{'id':_0x1216fb['params']['id']}})[_0xb9f4('0x26')](handleEntityNotFound(_0x7a74,null))[_0xb9f4('0x26')](function(_0xe86674){if(_0xe86674){_0x12ae8d=_0xe86674;_0x222991['model']=_[_0xb9f4('0x32')](db[_0xb9f4('0x50')][_0xb9f4('0x49')]);_0x222991['query']=_['keys'](_0x1216fb[_0xb9f4('0x33')]);_0x222991[_0xb9f4('0x3c')]=_[_0xb9f4('0x35')](_0x222991[_0xb9f4('0x31')],_0x222991[_0xb9f4('0x33')]);_0x2e1405['attributes']=_[_0xb9f4('0x35')](_0x222991[_0xb9f4('0x31')],qs[_0xb9f4('0x36')](_0x1216fb[_0xb9f4('0x33')][_0xb9f4('0x36')]));_0x2e1405[_0xb9f4('0x34')]=_0x2e1405[_0xb9f4('0x34')][_0xb9f4('0x37')]?_0x2e1405[_0xb9f4('0x34')]:_0x222991[_0xb9f4('0x31')];_0x2e1405[_0xb9f4('0x3a')]=qs[_0xb9f4('0x3b')](_0x1216fb[_0xb9f4('0x33')]['sort']);_0x2e1405[_0xb9f4('0x3f')]=qs[_0xb9f4('0x3c')](_[_0xb9f4('0x3d')](_0x1216fb[_0xb9f4('0x33')],_0x222991['filters']));if(_0x1216fb[_0xb9f4('0x33')][_0xb9f4('0x3e')]){_0x2e1405[_0xb9f4('0x3f')]=_['merge'](_0x2e1405['where'],{'$or':_[_0xb9f4('0x2c')](_0x2e1405[_0xb9f4('0x34')],function(_0x4cfc42){var _0x1cfc7b={};_0x1cfc7b[_0x4cfc42]={'$like':'%'+_0x1216fb[_0xb9f4('0x33')][_0xb9f4('0x3e')]+'%'};return _0x1cfc7b;})});}_0x2e1405=_[_0xb9f4('0x40')]({},_0x2e1405,_0x1216fb[_0xb9f4('0x42')]);return _0x12ae8d[_0xb9f4('0x51')](_0x2e1405);}})[_0xb9f4('0x26')](function(_0x473bbe){if(_0x473bbe){_0x5434e8=_0x473bbe[_0xb9f4('0x37')];if(!_0x1216fb[_0xb9f4('0x33')][_0xb9f4('0x38')](_0xb9f4('0x39'))){_0x2e1405[_0xb9f4('0x1d')]=qs[_0xb9f4('0x1d')](_0x1216fb[_0xb9f4('0x33')][_0xb9f4('0x1d')]);_0x2e1405[_0xb9f4('0x1c')]=qs[_0xb9f4('0x1c')](_0x1216fb[_0xb9f4('0x33')][_0xb9f4('0x1c')]);}return _0x12ae8d[_0xb9f4('0x51')](_0x2e1405);}})[_0xb9f4('0x26')](function(_0x49068c){if(_0x49068c){return _0x49068c?{'count':_0x5434e8,'rows':_0x49068c}:null;}})[_0xb9f4('0x26')](respondWithResult(_0x7a74,null))['catch'](handleError(_0x7a74,null));};exports[_0xb9f4('0x52')]=function(_0x4c4734,_0x50a7b8,_0x747eba){var _0x4e4c42={};var _0x29d667={};var _0x131ecc;var _0xf42c44;return db[_0xb9f4('0x2d')][_0xb9f4('0x4f')]({'where':{'id':_0x4c4734['params']['id']}})[_0xb9f4('0x26')](handleEntityNotFound(_0x50a7b8,null))['then'](function(_0x15444f){if(_0x15444f){_0x131ecc=_0x15444f;_0x29d667['model']=_[_0xb9f4('0x32')](db['SalesforceField'][_0xb9f4('0x49')]);_0x29d667['query']=_[_0xb9f4('0x32')](_0x4c4734[_0xb9f4('0x33')]);_0x29d667[_0xb9f4('0x3c')]=_[_0xb9f4('0x35')](_0x29d667[_0xb9f4('0x31')],_0x29d667['query']);_0x4e4c42[_0xb9f4('0x34')]=_['intersection'](_0x29d667[_0xb9f4('0x31')],qs[_0xb9f4('0x36')](_0x4c4734[_0xb9f4('0x33')][_0xb9f4('0x36')]));_0x4e4c42['attributes']=_0x4e4c42['attributes'][_0xb9f4('0x37')]?_0x4e4c42[_0xb9f4('0x34')]:_0x29d667[_0xb9f4('0x31')];_0x4e4c42[_0xb9f4('0x3a')]=qs[_0xb9f4('0x3b')](_0x4c4734[_0xb9f4('0x33')][_0xb9f4('0x3b')]);_0x4e4c42[_0xb9f4('0x3f')]=qs[_0xb9f4('0x3c')](_[_0xb9f4('0x3d')](_0x4c4734[_0xb9f4('0x33')],_0x29d667[_0xb9f4('0x3c')]));if(_0x4c4734[_0xb9f4('0x33')]['filter']){_0x4e4c42[_0xb9f4('0x3f')]=_[_0xb9f4('0x40')](_0x4e4c42[_0xb9f4('0x3f')],{'$or':_['map'](_0x4e4c42[_0xb9f4('0x34')],function(_0x1fd457){var _0x1bc86f={};_0x1bc86f[_0x1fd457]={'$like':'%'+_0x4c4734[_0xb9f4('0x33')][_0xb9f4('0x3e')]+'%'};return _0x1bc86f;})});}_0x4e4c42=_[_0xb9f4('0x40')]({},_0x4e4c42,_0x4c4734[_0xb9f4('0x42')]);return _0x131ecc[_0xb9f4('0x52')](_0x4e4c42);}})[_0xb9f4('0x26')](function(_0x2bbd10){if(_0x2bbd10){_0xf42c44=_0x2bbd10['length'];if(!_0x4c4734[_0xb9f4('0x33')]['hasOwnProperty'](_0xb9f4('0x39'))){_0x4e4c42[_0xb9f4('0x1d')]=qs[_0xb9f4('0x1d')](_0x4c4734[_0xb9f4('0x33')][_0xb9f4('0x1d')]);_0x4e4c42['offset']=qs[_0xb9f4('0x1c')](_0x4c4734[_0xb9f4('0x33')][_0xb9f4('0x1c')]);}return _0x131ecc['getDescriptions'](_0x4e4c42);}})['then'](function(_0x181644){if(_0x181644){return _0x181644?{'count':_0xf42c44,'rows':_0x181644}:null;}})[_0xb9f4('0x26')](respondWithResult(_0x50a7b8,null))[_0xb9f4('0x46')](handleError(_0x50a7b8,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 6ff95c4..b553ed2 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 _0xb5b3=['../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x10d912,_0x52b89e){var _0x546435=function(_0x27136c){while(--_0x27136c){_0x10d912['push'](_0x10d912['shift']());}};_0x546435(++_0x52b89e);}(_0xb5b3,0x179));var _0x3b5b=function(_0x429692,_0x13189d){_0x429692=_0x429692-0x0;var _0xc9a0a4=_0xb5b3[_0x429692];return _0xc9a0a4;};'use strict';var _=require(_0x3b5b('0x0'));var util=require(_0x3b5b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3b5b('0x2'));var BPromise=require(_0x3b5b('0x3'));var rp=require(_0x3b5b('0x4'));var fs=require('fs');var path=require(_0x3b5b('0x5'));var rimraf=require(_0x3b5b('0x6'));var config=require(_0x3b5b('0x7'));var attributes=require(_0x3b5b('0x8'));module[_0x3b5b('0x9')]=function(_0x31bdbc,_0x2f1f0a){return _0x31bdbc['define'](_0x3b5b('0xa'),attributes,{'tableName':_0x3b5b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x08c2=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration'];(function(_0x15cba0,_0x14164b){var _0x4b7b48=function(_0x54cbdb){while(--_0x54cbdb){_0x15cba0['push'](_0x15cba0['shift']());}};_0x4b7b48(++_0x14164b);}(_0x08c2,0x9a));var _0x208c=function(_0x512973,_0x564e8b){_0x512973=_0x512973-0x0;var _0x32f2e1=_0x08c2[_0x512973];return _0x32f2e1;};'use strict';var _=require(_0x208c('0x0'));var util=require(_0x208c('0x1'));var logger=require('../../config/logger')(_0x208c('0x2'));var moment=require('moment');var BPromise=require(_0x208c('0x3'));var rp=require(_0x208c('0x4'));var fs=require('fs');var path=require(_0x208c('0x5'));var rimraf=require(_0x208c('0x6'));var config=require(_0x208c('0x7'));var attributes=require(_0x208c('0x8'));module[_0x208c('0x9')]=function(_0x429c79,_0x314f9c){return _0x429c79['define'](_0x208c('0xa'),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 732298f..6b74a66 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 _0x92f2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','catch','lodash','util'];(function(_0x579065,_0x1b9178){var _0x1c84bc=function(_0x3ace36){while(--_0x3ace36){_0x579065['push'](_0x579065['shift']());}};_0x1c84bc(++_0x1b9178);}(_0x92f2,0x106));var _0x292f=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x92f2[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x292f('0x0'));var util=require(_0x292f('0x1'));var moment=require(_0x292f('0x2'));var BPromise=require(_0x292f('0x3'));var rs=require(_0x292f('0x4'));var fs=require('fs');var Redis=require(_0x292f('0x5'));var db=require(_0x292f('0x6'))['db'];var utils=require(_0x292f('0x7'));var logger=require('../../config/logger')(_0x292f('0x8'));var config=require(_0x292f('0x9'));var jayson=require(_0x292f('0xa'));var client=jayson[_0x292f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x367db6,_0x366c48,_0x185d4e){return new BPromise(function(_0x53eb4d,_0x329eae){return client[_0x292f('0xc')](_0x367db6,_0x185d4e)[_0x292f('0xd')](function(_0x33aca2){logger[_0x292f('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x366c48,'request\x20sent');logger[_0x292f('0xf')](_0x292f('0x10'),_0x366c48,_0x292f('0x11'),JSON[_0x292f('0x12')](_0x33aca2));if(_0x33aca2['error']){if(_0x33aca2[_0x292f('0x13')][_0x292f('0x14')]===0x1f4){logger[_0x292f('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x366c48,_0x33aca2[_0x292f('0x13')][_0x292f('0x15')]);return _0x329eae(_0x33aca2['error'][_0x292f('0x15')]);}logger[_0x292f('0x13')](_0x292f('0x16'),_0x366c48,_0x33aca2[_0x292f('0x13')][_0x292f('0x15')]);return _0x53eb4d(_0x33aca2[_0x292f('0x13')][_0x292f('0x15')]);}else{logger['info'](_0x292f('0x16'),_0x366c48,_0x292f('0x11'));_0x53eb4d(_0x33aca2['result'][_0x292f('0x15')]);}})[_0x292f('0x17')](function(_0x57d945){logger[_0x292f('0x13')](_0x292f('0x16'),_0x366c48,_0x57d945);_0x329eae(_0x57d945);});});} \ No newline at end of file +var _0x30c4=['bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x54784f,_0x2a24d8){var _0x241e1b=function(_0x3a4cc2){while(--_0x3a4cc2){_0x54784f['push'](_0x54784f['shift']());}};_0x241e1b(++_0x2a24d8);}(_0x30c4,0xad));var _0x430c=function(_0x511e81,_0x40b17d){_0x511e81=_0x511e81-0x0;var _0x207de6=_0x30c4[_0x511e81];return _0x207de6;};'use strict';var _=require(_0x430c('0x0'));var util=require(_0x430c('0x1'));var moment=require(_0x430c('0x2'));var BPromise=require(_0x430c('0x3'));var rs=require(_0x430c('0x4'));var fs=require('fs');var Redis=require(_0x430c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x430c('0x6'));var logger=require('../../config/logger')(_0x430c('0x7'));var config=require('../../config/environment');var jayson=require(_0x430c('0x8'));var client=jayson[_0x430c('0x9')][_0x430c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbc92e1,_0x57786a,_0x369220){return new BPromise(function(_0x579d04,_0xc36ba0){return client[_0x430c('0xb')](_0xbc92e1,_0x369220)[_0x430c('0xc')](function(_0x5f2a29){logger[_0x430c('0xd')](_0x430c('0xe'),_0x57786a,'request\x20sent');logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x57786a,_0x430c('0xf'),JSON[_0x430c('0x10')](_0x5f2a29));if(_0x5f2a29['error']){if(_0x5f2a29[_0x430c('0x11')][_0x430c('0x12')]===0x1f4){logger[_0x430c('0x11')](_0x430c('0xe'),_0x57786a,_0x5f2a29['error'][_0x430c('0x13')]);return _0xc36ba0(_0x5f2a29[_0x430c('0x11')]['message']);}logger[_0x430c('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x57786a,_0x5f2a29['error'][_0x430c('0x13')]);return _0x579d04(_0x5f2a29[_0x430c('0x11')][_0x430c('0x13')]);}else{logger[_0x430c('0xd')](_0x430c('0xe'),_0x57786a,_0x430c('0xf'));_0x579d04(_0x5f2a29[_0x430c('0x14')][_0x430c('0x13')]);}})[_0x430c('0x15')](function(_0x3e7413){logger[_0x430c('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x57786a,_0x3e7413);_0xc36ba0(_0x3e7413);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index d1479f6..6309d65 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 _0x9800=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','path'];(function(_0x7794ac,_0x19c5c6){var _0x54b7d4=function(_0x206cc4){while(--_0x206cc4){_0x7794ac['push'](_0x7794ac['shift']());}};_0x54b7d4(++_0x19c5c6);}(_0x9800,0x166));var _0x0980=function(_0x237aa1,_0x5733af){_0x237aa1=_0x237aa1-0x0;var _0x1d0bef=_0x9800[_0x237aa1];return _0x1d0bef;};'use strict';var multer=require(_0x0980('0x0'));var util=require('util');var path=require(_0x0980('0x1'));var timeout=require('connect-timeout');var express=require(_0x0980('0x2'));var router=express[_0x0980('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0980('0x4'));var interaction=require(_0x0980('0x5'));var config=require(_0x0980('0x6'));var controller=require(_0x0980('0x7'));router[_0x0980('0x8')]('/',auth[_0x0980('0x9')](),controller[_0x0980('0xa')]);router['get'](_0x0980('0xb'),auth[_0x0980('0x9')](),controller[_0x0980('0xc')]);router[_0x0980('0xd')]('/',auth[_0x0980('0x9')](),controller[_0x0980('0xe')]);router[_0x0980('0xf')]('/:id',auth[_0x0980('0x9')](),controller[_0x0980('0x10')]);router['delete'](_0x0980('0xb'),auth[_0x0980('0x9')](),controller[_0x0980('0x11')]);module['exports']=router; \ No newline at end of file +var _0xbba6=['index','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xbba6,0xe7));var _0x6bba=function(_0x18e75c,_0x3d8b9e){_0x18e75c=_0x18e75c-0x0;var _0x3a5863=_0xbba6[_0x18e75c];return _0x3a5863;};'use strict';var multer=require('multer');var util=require(_0x6bba('0x0'));var path=require(_0x6bba('0x1'));var timeout=require(_0x6bba('0x2'));var express=require('express');var router=express[_0x6bba('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6bba('0x4'));var interaction=require(_0x6bba('0x5'));var config=require('../../config/environment');var controller=require(_0x6bba('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x6bba('0x7')]);router['get'](_0x6bba('0x8'),auth[_0x6bba('0x9')](),controller[_0x6bba('0xa')]);router[_0x6bba('0xb')]('/',auth['isAuthenticated'](),controller[_0x6bba('0xc')]);router['put'](_0x6bba('0x8'),auth[_0x6bba('0x9')](),controller[_0x6bba('0xd')]);router[_0x6bba('0xe')](_0x6bba('0x8'),auth[_0x6bba('0x9')](),controller[_0x6bba('0xf')]);module[_0x6bba('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 5a6f9af..f99c562 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 _0xae4c=['STRING','variable','sequelize','ENUM','string','customVariable','picklist'];(function(_0x5ee0ac,_0x20fd62){var _0xe3526c=function(_0x1a81ec){while(--_0x1a81ec){_0x5ee0ac['push'](_0x5ee0ac['shift']());}};_0xe3526c(++_0x20fd62);}(_0xae4c,0x1a6));var _0xcae4=function(_0x330bb0,_0x4f695f){_0x330bb0=_0x330bb0-0x0;var _0x442278=_0xae4c[_0x330bb0];return _0x442278;};'use strict';var Sequelize=require(_0xcae4('0x0'));module['exports']={'type':{'type':Sequelize[_0xcae4('0x1')](_0xcae4('0x2'),'variable',_0xcae4('0x3'),'keyValue',_0xcae4('0x4')),'defaultValue':_0xcae4('0x2')},'content':{'type':Sequelize[_0xcae4('0x5')]},'key':{'type':Sequelize[_0xcae4('0x5')]},'keyType':{'type':Sequelize[_0xcae4('0x1')](_0xcae4('0x2'),_0xcae4('0x6'),_0xcae4('0x3'))},'keyContent':{'type':Sequelize[_0xcae4('0x5')]},'idField':{'type':Sequelize[_0xcae4('0x5')]},'variableName':{'type':Sequelize[_0xcae4('0x5')]}}; \ No newline at end of file +var _0x704b=['variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x2028d2,_0x6cf9ff){var _0x3ec1fd=function(_0x49c742){while(--_0x49c742){_0x2028d2['push'](_0x2028d2['shift']());}};_0x3ec1fd(++_0x6cf9ff);}(_0x704b,0x12e));var _0xb704=function(_0x172feb,_0x4bb62f){_0x172feb=_0x172feb-0x0;var _0x5341af=_0x704b[_0x172feb];return _0x5341af;};'use strict';var Sequelize=require(_0xb704('0x0'));module[_0xb704('0x1')]={'type':{'type':Sequelize[_0xb704('0x2')](_0xb704('0x3'),_0xb704('0x4'),_0xb704('0x5'),_0xb704('0x6'),_0xb704('0x7')),'defaultValue':_0xb704('0x3')},'content':{'type':Sequelize[_0xb704('0x8')]},'key':{'type':Sequelize[_0xb704('0x8')]},'keyType':{'type':Sequelize[_0xb704('0x2')](_0xb704('0x3'),'variable',_0xb704('0x5'))},'keyContent':{'type':Sequelize[_0xb704('0x8')]},'idField':{'type':Sequelize[_0xb704('0x8')]},'variableName':{'type':Sequelize[_0xb704('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 9dd94d3..4da39b8 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 _0xc7da=['update','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','send','index','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','SalesforceField','includeAll','include','findAll','rows','show','params','options','find','catch','create'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xc7da,0xf2));var _0xac7d=function(_0x3281a7,_0x974720){_0x3281a7=_0x3281a7-0x0;var _0x1067fc=_0xc7da[_0x3281a7];return _0x1067fc;};'use strict';var emlformat=require(_0xac7d('0x0'));var rimraf=require(_0xac7d('0x1'));var zipdir=require(_0xac7d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac7d('0x3'));var moment=require(_0xac7d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xac7d('0x5'));var util=require(_0xac7d('0x6'));var path=require('path');var sox=require(_0xac7d('0x7'));var csv=require(_0xac7d('0x8'));var ejs=require(_0xac7d('0x9'));var fs=require('fs');var fs_extra=require(_0xac7d('0xa'));var _=require(_0xac7d('0xb'));var squel=require(_0xac7d('0xc'));var crypto=require('crypto');var jsforce=require(_0xac7d('0xd'));var deskjs=require(_0xac7d('0xe'));var toCsv=require(_0xac7d('0x8'));var querystring=require(_0xac7d('0xf'));var Papa=require(_0xac7d('0x10'));var Redis=require(_0xac7d('0x11'));var authService=require(_0xac7d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xac7d('0x13'));var hardwareService=require(_0xac7d('0x14'));var logger=require(_0xac7d('0x15'))('api');var utils=require(_0xac7d('0x16'));var config=require(_0xac7d('0x17'));var licenseUtil=require(_0xac7d('0x18'));var db=require(_0xac7d('0x19'))['db'];function respondWithStatusCode(_0x5a44f6,_0xe5de7e){_0xe5de7e=_0xe5de7e||0xcc;return function(_0x2b70a4){if(_0x2b70a4){return _0x5a44f6[_0xac7d('0x1a')](_0xe5de7e);}return _0x5a44f6[_0xac7d('0x1b')](_0xe5de7e)[_0xac7d('0x1c')]();};}function respondWithResult(_0x5678d7,_0x39ba25){_0x39ba25=_0x39ba25||0xc8;return function(_0x5b94e9){if(_0x5b94e9){return _0x5678d7[_0xac7d('0x1b')](_0x39ba25)[_0xac7d('0x1d')](_0x5b94e9);}};}function respondWithFilteredResult(_0x34980f,_0x355209){return function(_0x533bac){if(_0x533bac){var _0x19e7ba=typeof _0x355209[_0xac7d('0x1e')]===_0xac7d('0x1f')&&typeof _0x355209[_0xac7d('0x20')]===_0xac7d('0x1f');var _0x48ac86=_0x533bac[_0xac7d('0x21')];var _0x3cb12d=_0x19e7ba?0x0:_0x355209['offset'];var _0x2e4790=_0x19e7ba?_0x533bac[_0xac7d('0x21')]:_0x355209[_0xac7d('0x1e')]+_0x355209[_0xac7d('0x20')];var _0x4a5325;if(_0x2e4790>=_0x48ac86){_0x2e4790=_0x48ac86;_0x4a5325=0xc8;}else{_0x4a5325=0xce;}_0x34980f[_0xac7d('0x1b')](_0x4a5325);return _0x34980f[_0xac7d('0x22')](_0xac7d('0x23'),_0x3cb12d+'-'+_0x2e4790+'/'+_0x48ac86)['json'](_0x533bac);}return null;};}function patchUpdates(_0xd42c40){return function(_0x4f4e4e){try{jsonpatch[_0xac7d('0x24')](_0x4f4e4e,_0xd42c40,!![]);}catch(_0x3eedf8){return BPromise[_0xac7d('0x25')](_0x3eedf8);}return _0x4f4e4e[_0xac7d('0x26')]();};}function saveUpdates(_0x321689,_0x365269){return function(_0x5a006e){if(_0x5a006e){return _0x5a006e['update'](_0x321689)[_0xac7d('0x27')](function(_0x6d2c50){return _0x6d2c50;});}return null;};}function removeEntity(_0x5098bb,_0x4282d7){return function(_0x3966dd){if(_0x3966dd){return _0x3966dd[_0xac7d('0x28')]()[_0xac7d('0x27')](function(){_0x5098bb[_0xac7d('0x1b')](0xcc)[_0xac7d('0x1c')]();});}};}function handleEntityNotFound(_0x200562,_0x3bb7dd){return function(_0x42e313){if(!_0x42e313){_0x200562[_0xac7d('0x1a')](0x194);}return _0x42e313;};}function handleError(_0x594d6e,_0x229ecd){_0x229ecd=_0x229ecd||0x1f4;return function(_0x3216cb){logger[_0xac7d('0x29')](_0x3216cb[_0xac7d('0x2a')]);if(_0x3216cb['name']){delete _0x3216cb['name'];}_0x594d6e['status'](_0x229ecd)[_0xac7d('0x2b')](_0x3216cb);};}exports[_0xac7d('0x2c')]=function(_0xac3f87,_0x5bd39b){var _0x51df23={},_0x506b88={},_0x4e2456={'count':0x0,'rows':[]};var _0x5e5f12=_['map'](db['SalesforceField'][_0xac7d('0x2d')],function(_0x1109b1){return{'name':_0x1109b1[_0xac7d('0x2e')],'type':_0x1109b1[_0xac7d('0x2f')][_0xac7d('0x30')]};});_0x506b88['model']=_['map'](_0x5e5f12,_0xac7d('0x31'));_0x506b88[_0xac7d('0x32')]=_[_0xac7d('0x33')](_0xac3f87[_0xac7d('0x32')]);_0x506b88[_0xac7d('0x34')]=_[_0xac7d('0x35')](_0x506b88[_0xac7d('0x36')],_0x506b88[_0xac7d('0x32')]);_0x51df23[_0xac7d('0x37')]=_[_0xac7d('0x35')](_0x506b88[_0xac7d('0x36')],qs[_0xac7d('0x38')](_0xac3f87[_0xac7d('0x32')][_0xac7d('0x38')]));_0x51df23[_0xac7d('0x37')]=_0x51df23[_0xac7d('0x37')]['length']?_0x51df23[_0xac7d('0x37')]:_0x506b88[_0xac7d('0x36')];if(!_0xac3f87[_0xac7d('0x32')][_0xac7d('0x39')](_0xac7d('0x3a'))){_0x51df23['limit']=qs[_0xac7d('0x20')](_0xac3f87['query']['limit']);_0x51df23[_0xac7d('0x1e')]=qs[_0xac7d('0x1e')](_0xac3f87[_0xac7d('0x32')][_0xac7d('0x1e')]);}_0x51df23[_0xac7d('0x3b')]=qs[_0xac7d('0x3c')](_0xac3f87[_0xac7d('0x32')][_0xac7d('0x3c')]);_0x51df23[_0xac7d('0x3d')]=qs[_0xac7d('0x34')](_[_0xac7d('0x3e')](_0xac3f87['query'],_0x506b88['filters']),_0x5e5f12);if(_0xac3f87[_0xac7d('0x32')]['filter']){_0x51df23[_0xac7d('0x3d')]=_[_0xac7d('0x3f')](_0x51df23[_0xac7d('0x3d')],{'$or':_[_0xac7d('0x40')](_0x5e5f12,function(_0x550b7b){if(_0x550b7b['type']!==_0xac7d('0x41')){var _0x38bcfa={};_0x38bcfa[_0x550b7b[_0xac7d('0x31')]]={'$like':'%'+_0xac3f87[_0xac7d('0x32')][_0xac7d('0x42')]+'%'};return _0x38bcfa;}})});}_0x51df23=_['merge']({},_0x51df23,_0xac3f87['options']);var _0x2fa792={'where':_0x51df23['where']};return db[_0xac7d('0x43')][_0xac7d('0x21')](_0x2fa792)[_0xac7d('0x27')](function(_0x4984bd){_0x4e2456[_0xac7d('0x21')]=_0x4984bd;if(_0xac3f87[_0xac7d('0x32')][_0xac7d('0x44')]){_0x51df23[_0xac7d('0x45')]=[{'all':!![]}];}return db[_0xac7d('0x43')][_0xac7d('0x46')](_0x51df23);})['then'](function(_0x4d4e6e){_0x4e2456[_0xac7d('0x47')]=_0x4d4e6e;return _0x4e2456;})[_0xac7d('0x27')](respondWithFilteredResult(_0x5bd39b,_0x51df23))['catch'](handleError(_0x5bd39b,null));};exports[_0xac7d('0x48')]=function(_0x14a658,_0x355647){var _0x5978ea={'raw':!![],'where':{'id':_0x14a658[_0xac7d('0x49')]['id']}},_0x5f3b48={};_0x5f3b48['model']=_[_0xac7d('0x33')](db[_0xac7d('0x43')][_0xac7d('0x2d')]);_0x5f3b48[_0xac7d('0x32')]=_[_0xac7d('0x33')](_0x14a658[_0xac7d('0x32')]);_0x5f3b48[_0xac7d('0x34')]=_[_0xac7d('0x35')](_0x5f3b48[_0xac7d('0x36')],_0x5f3b48[_0xac7d('0x32')]);_0x5978ea['attributes']=_[_0xac7d('0x35')](_0x5f3b48[_0xac7d('0x36')],qs[_0xac7d('0x38')](_0x14a658[_0xac7d('0x32')][_0xac7d('0x38')]));_0x5978ea[_0xac7d('0x37')]=_0x5978ea[_0xac7d('0x37')]['length']?_0x5978ea[_0xac7d('0x37')]:_0x5f3b48[_0xac7d('0x36')];if(_0x14a658['query'][_0xac7d('0x44')]){_0x5978ea[_0xac7d('0x45')]=[{'all':!![]}];}_0x5978ea=_[_0xac7d('0x3f')]({},_0x5978ea,_0x14a658[_0xac7d('0x4a')]);return db[_0xac7d('0x43')][_0xac7d('0x4b')](_0x5978ea)[_0xac7d('0x27')](handleEntityNotFound(_0x355647,null))['then'](respondWithResult(_0x355647,null))[_0xac7d('0x4c')](handleError(_0x355647,null));};exports[_0xac7d('0x4d')]=function(_0x59d07e,_0x2231dd){return db[_0xac7d('0x43')][_0xac7d('0x4d')](_0x59d07e['body'],{})[_0xac7d('0x27')](respondWithResult(_0x2231dd,0xc9))[_0xac7d('0x4c')](handleError(_0x2231dd,null));};exports[_0xac7d('0x4e')]=function(_0x302794,_0x57e0c2){if(_0x302794[_0xac7d('0x4f')]['id']){delete _0x302794[_0xac7d('0x4f')]['id'];}return db[_0xac7d('0x43')][_0xac7d('0x4b')]({'where':{'id':_0x302794[_0xac7d('0x49')]['id']}})['then'](handleEntityNotFound(_0x57e0c2,null))['then'](saveUpdates(_0x302794[_0xac7d('0x4f')],null))[_0xac7d('0x27')](respondWithResult(_0x57e0c2,null))[_0xac7d('0x4c')](handleError(_0x57e0c2,null));};exports['destroy']=function(_0x1c2fc0,_0x55d683){return db[_0xac7d('0x43')][_0xac7d('0x4b')]({'where':{'id':_0x1c2fc0[_0xac7d('0x49')]['id']}})[_0xac7d('0x27')](handleEntityNotFound(_0x55d683,null))[_0xac7d('0x27')](removeEntity(_0x55d683,null))[_0xac7d('0x4c')](handleError(_0x55d683,null));}; \ No newline at end of file +var _0xf52e=['status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','options','SalesforceField','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end'];(function(_0x1d3272,_0x2c24b8){var _0x573b3b=function(_0x17d447){while(--_0x17d447){_0x1d3272['push'](_0x1d3272['shift']());}};_0x573b3b(++_0x2c24b8);}(_0xf52e,0x1ed));var _0xef52=function(_0x5923a0,_0x48d93e){_0x5923a0=_0x5923a0-0x0;var _0x268cb0=_0xf52e[_0x5923a0];return _0x268cb0;};'use strict';var emlformat=require(_0xef52('0x0'));var rimraf=require(_0xef52('0x1'));var zipdir=require(_0xef52('0x2'));var jsonpatch=require(_0xef52('0x3'));var rp=require(_0xef52('0x4'));var moment=require(_0xef52('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xef52('0x6'));var util=require('util');var path=require('path');var sox=require(_0xef52('0x7'));var csv=require(_0xef52('0x8'));var ejs=require(_0xef52('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xef52('0xa'));var squel=require('squel');var crypto=require(_0xef52('0xb'));var jsforce=require(_0xef52('0xc'));var deskjs=require(_0xef52('0xd'));var toCsv=require(_0xef52('0x8'));var querystring=require('querystring');var Papa=require(_0xef52('0xe'));var Redis=require(_0xef52('0xf'));var authService=require(_0xef52('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xef52('0x11'));var hardwareService=require(_0xef52('0x12'));var logger=require(_0xef52('0x13'))(_0xef52('0x14'));var utils=require(_0xef52('0x15'));var config=require(_0xef52('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xef52('0x17'))['db'];function respondWithStatusCode(_0x3b57ce,_0x2343d5){_0x2343d5=_0x2343d5||0xcc;return function(_0x41368a){if(_0x41368a){return _0x3b57ce['sendStatus'](_0x2343d5);}return _0x3b57ce['status'](_0x2343d5)[_0xef52('0x18')]();};}function respondWithResult(_0x6e31dd,_0xc12d21){_0xc12d21=_0xc12d21||0xc8;return function(_0x2266a5){if(_0x2266a5){return _0x6e31dd[_0xef52('0x19')](_0xc12d21)['json'](_0x2266a5);}};}function respondWithFilteredResult(_0x347108,_0x5a1588){return function(_0x2160fa){if(_0x2160fa){var _0x3c6f8b=typeof _0x5a1588['offset']===_0xef52('0x1a')&&typeof _0x5a1588[_0xef52('0x1b')]===_0xef52('0x1a');var _0xa59d96=_0x2160fa[_0xef52('0x1c')];var _0x4d221d=_0x3c6f8b?0x0:_0x5a1588[_0xef52('0x1d')];var _0x14f62a=_0x3c6f8b?_0x2160fa[_0xef52('0x1c')]:_0x5a1588[_0xef52('0x1d')]+_0x5a1588['limit'];var _0x537942;if(_0x14f62a>=_0xa59d96){_0x14f62a=_0xa59d96;_0x537942=0xc8;}else{_0x537942=0xce;}_0x347108[_0xef52('0x19')](_0x537942);return _0x347108[_0xef52('0x1e')](_0xef52('0x1f'),_0x4d221d+'-'+_0x14f62a+'/'+_0xa59d96)[_0xef52('0x20')](_0x2160fa);}return null;};}function patchUpdates(_0x3e88f3){return function(_0x5b78ba){try{jsonpatch[_0xef52('0x21')](_0x5b78ba,_0x3e88f3,!![]);}catch(_0x4375f6){return BPromise['reject'](_0x4375f6);}return _0x5b78ba[_0xef52('0x22')]();};}function saveUpdates(_0x137faa,_0x29355f){return function(_0x46c402){if(_0x46c402){return _0x46c402[_0xef52('0x23')](_0x137faa)[_0xef52('0x24')](function(_0x4755e0){return _0x4755e0;});}return null;};}function removeEntity(_0x40c704,_0x42119d){return function(_0x5a1dc9){if(_0x5a1dc9){return _0x5a1dc9[_0xef52('0x25')]()[_0xef52('0x24')](function(){_0x40c704[_0xef52('0x19')](0xcc)[_0xef52('0x18')]();});}};}function handleEntityNotFound(_0x270d3a,_0x582069){return function(_0x3f6e11){if(!_0x3f6e11){_0x270d3a[_0xef52('0x26')](0x194);}return _0x3f6e11;};}function handleError(_0x3afa14,_0x2ad124){_0x2ad124=_0x2ad124||0x1f4;return function(_0x493e08){logger[_0xef52('0x27')](_0x493e08[_0xef52('0x28')]);if(_0x493e08['name']){delete _0x493e08[_0xef52('0x29')];}_0x3afa14[_0xef52('0x19')](_0x2ad124)['send'](_0x493e08);};}exports[_0xef52('0x2a')]=function(_0x287e11,_0x46b090){var _0xec83a8={},_0x4f9505={},_0x385495={'count':0x0,'rows':[]};var _0x35aee9=_[_0xef52('0x2b')](db['SalesforceField'][_0xef52('0x2c')],function(_0x476678){return{'name':_0x476678[_0xef52('0x2d')],'type':_0x476678[_0xef52('0x2e')][_0xef52('0x2f')]};});_0x4f9505[_0xef52('0x30')]=_[_0xef52('0x2b')](_0x35aee9,_0xef52('0x29'));_0x4f9505['query']=_[_0xef52('0x31')](_0x287e11['query']);_0x4f9505[_0xef52('0x32')]=_[_0xef52('0x33')](_0x4f9505[_0xef52('0x30')],_0x4f9505[_0xef52('0x34')]);_0xec83a8[_0xef52('0x35')]=_[_0xef52('0x33')](_0x4f9505[_0xef52('0x30')],qs[_0xef52('0x36')](_0x287e11['query']['fields']));_0xec83a8[_0xef52('0x35')]=_0xec83a8[_0xef52('0x35')][_0xef52('0x37')]?_0xec83a8['attributes']:_0x4f9505['model'];if(!_0x287e11['query'][_0xef52('0x38')](_0xef52('0x39'))){_0xec83a8[_0xef52('0x1b')]=qs[_0xef52('0x1b')](_0x287e11[_0xef52('0x34')]['limit']);_0xec83a8[_0xef52('0x1d')]=qs[_0xef52('0x1d')](_0x287e11['query'][_0xef52('0x1d')]);}_0xec83a8[_0xef52('0x3a')]=qs['sort'](_0x287e11[_0xef52('0x34')]['sort']);_0xec83a8[_0xef52('0x3b')]=qs['filters'](_[_0xef52('0x3c')](_0x287e11[_0xef52('0x34')],_0x4f9505[_0xef52('0x32')]),_0x35aee9);if(_0x287e11[_0xef52('0x34')]['filter']){_0xec83a8[_0xef52('0x3b')]=_['merge'](_0xec83a8[_0xef52('0x3b')],{'$or':_[_0xef52('0x2b')](_0x35aee9,function(_0x5c4384){if(_0x5c4384[_0xef52('0x2e')]!=='VIRTUAL'){var _0x1d84f3={};_0x1d84f3[_0x5c4384['name']]={'$like':'%'+_0x287e11['query']['filter']+'%'};return _0x1d84f3;}})});}_0xec83a8=_[_0xef52('0x3d')]({},_0xec83a8,_0x287e11[_0xef52('0x3e')]);var _0xef418a={'where':_0xec83a8[_0xef52('0x3b')]};return db[_0xef52('0x3f')][_0xef52('0x1c')](_0xef418a)[_0xef52('0x24')](function(_0x24b1ec){_0x385495[_0xef52('0x1c')]=_0x24b1ec;if(_0x287e11['query'][_0xef52('0x40')]){_0xec83a8[_0xef52('0x41')]=[{'all':!![]}];}return db[_0xef52('0x3f')][_0xef52('0x42')](_0xec83a8);})['then'](function(_0x1d722b){_0x385495[_0xef52('0x43')]=_0x1d722b;return _0x385495;})[_0xef52('0x24')](respondWithFilteredResult(_0x46b090,_0xec83a8))[_0xef52('0x44')](handleError(_0x46b090,null));};exports[_0xef52('0x45')]=function(_0x25d83f,_0x49a488){var _0x32303c={'raw':!![],'where':{'id':_0x25d83f[_0xef52('0x46')]['id']}},_0x164aef={};_0x164aef['model']=_['keys'](db[_0xef52('0x3f')][_0xef52('0x2c')]);_0x164aef[_0xef52('0x34')]=_['keys'](_0x25d83f[_0xef52('0x34')]);_0x164aef[_0xef52('0x32')]=_[_0xef52('0x33')](_0x164aef['model'],_0x164aef[_0xef52('0x34')]);_0x32303c[_0xef52('0x35')]=_[_0xef52('0x33')](_0x164aef[_0xef52('0x30')],qs['fields'](_0x25d83f['query'][_0xef52('0x36')]));_0x32303c[_0xef52('0x35')]=_0x32303c[_0xef52('0x35')][_0xef52('0x37')]?_0x32303c[_0xef52('0x35')]:_0x164aef[_0xef52('0x30')];if(_0x25d83f[_0xef52('0x34')][_0xef52('0x40')]){_0x32303c[_0xef52('0x41')]=[{'all':!![]}];}_0x32303c=_[_0xef52('0x3d')]({},_0x32303c,_0x25d83f[_0xef52('0x3e')]);return db[_0xef52('0x3f')]['find'](_0x32303c)[_0xef52('0x24')](handleEntityNotFound(_0x49a488,null))['then'](respondWithResult(_0x49a488,null))['catch'](handleError(_0x49a488,null));};exports[_0xef52('0x47')]=function(_0x188e91,_0x4a5697){return db[_0xef52('0x3f')][_0xef52('0x47')](_0x188e91[_0xef52('0x48')],{})[_0xef52('0x24')](respondWithResult(_0x4a5697,0xc9))[_0xef52('0x44')](handleError(_0x4a5697,null));};exports[_0xef52('0x23')]=function(_0x2901aa,_0x73b891){if(_0x2901aa[_0xef52('0x48')]['id']){delete _0x2901aa[_0xef52('0x48')]['id'];}return db[_0xef52('0x3f')]['find']({'where':{'id':_0x2901aa['params']['id']}})[_0xef52('0x24')](handleEntityNotFound(_0x73b891,null))['then'](saveUpdates(_0x2901aa[_0xef52('0x48')],null))[_0xef52('0x24')](respondWithResult(_0x73b891,null))[_0xef52('0x44')](handleError(_0x73b891,null));};exports[_0xef52('0x25')]=function(_0x1afc0e,_0x4e3a2c){return db[_0xef52('0x3f')][_0xef52('0x49')]({'where':{'id':_0x1afc0e['params']['id']}})[_0xef52('0x24')](handleEntityNotFound(_0x4e3a2c,null))[_0xef52('0x24')](removeEntity(_0x4e3a2c,null))[_0xef52('0x44')](handleError(_0x4e3a2c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index b10ccd7..73364ef 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 _0xa011=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index'];(function(_0x267d8d,_0xe90f65){var _0x11a98f=function(_0x5703c9){while(--_0x5703c9){_0x267d8d['push'](_0x267d8d['shift']());}};_0x11a98f(++_0xe90f65);}(_0xa011,0x112));var _0x1a01=function(_0x4a69a8,_0x22faaa){_0x4a69a8=_0x4a69a8-0x0;var _0x92c343=_0xa011[_0x4a69a8];return _0x92c343;};'use strict';var _=require(_0x1a01('0x0'));var util=require(_0x1a01('0x1'));var logger=require(_0x1a01('0x2'))(_0x1a01('0x3'));var moment=require(_0x1a01('0x4'));var BPromise=require(_0x1a01('0x5'));var rp=require(_0x1a01('0x6'));var fs=require('fs');var path=require(_0x1a01('0x7'));var rimraf=require('rimraf');var config=require(_0x1a01('0x8'));var attributes=require(_0x1a01('0x9'));module[_0x1a01('0xa')]=function(_0x11f02c,_0x478486){return _0x11f02c[_0x1a01('0xb')](_0x1a01('0xc'),attributes,{'tableName':_0x1a01('0xd'),'paranoid':![],'indexes':[{'name':_0x1a01('0xe'),'fields':[_0x1a01('0xf'),_0x1a01('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa503=['moment','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId'];(function(_0x253b13,_0x247a2f){var _0x396bcc=function(_0x152c32){while(--_0x152c32){_0x253b13['push'](_0x253b13['shift']());}};_0x396bcc(++_0x247a2f);}(_0xa503,0xc0));var _0x3a50=function(_0x51ff38,_0x4c3fb9){_0x51ff38=_0x51ff38-0x0;var _0x54c6f7=_0xa503[_0x51ff38];return _0x54c6f7;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3a50('0x0'));var BPromise=require('bluebird');var rp=require(_0x3a50('0x1'));var fs=require('fs');var path=require(_0x3a50('0x2'));var rimraf=require(_0x3a50('0x3'));var config=require(_0x3a50('0x4'));var attributes=require(_0x3a50('0x5'));module['exports']=function(_0x597581,_0x344f66){return _0x597581[_0x3a50('0x6')](_0x3a50('0x7'),attributes,{'tableName':_0x3a50('0x8'),'paranoid':![],'indexes':[{'name':_0x3a50('0x9'),'fields':[_0x3a50('0xa'),_0x3a50('0xb')],'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 1069f03..5420194 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 _0x490d=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SalesforceField,\x20%s,\x20%s','util','bluebird','randomstring'];(function(_0x1d7853,_0x1f20c3){var _0xbdebec=function(_0x103253){while(--_0x103253){_0x1d7853['push'](_0x1d7853['shift']());}};_0xbdebec(++_0x1f20c3);}(_0x490d,0xbb));var _0xd490=function(_0x1c8f08,_0x32348c){_0x1c8f08=_0x1c8f08-0x0;var _0x33bdac=_0x490d[_0x1c8f08];return _0x33bdac;};'use strict';var _=require('lodash');var util=require(_0xd490('0x0'));var moment=require('moment');var BPromise=require(_0xd490('0x1'));var rs=require(_0xd490('0x2'));var fs=require('fs');var Redis=require(_0xd490('0x3'));var db=require(_0xd490('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd490('0x5'))(_0xd490('0x6'));var config=require(_0xd490('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd490('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10c57f,_0x19c7ba,_0x189bc5){return new BPromise(function(_0x479487,_0x5cb8dd){return client['request'](_0x10c57f,_0x189bc5)[_0xd490('0x9')](function(_0x4f7368){logger[_0xd490('0xa')]('SalesforceField,\x20%s,\x20%s',_0x19c7ba,_0xd490('0xb'));logger[_0xd490('0xc')](_0xd490('0xd'),_0x19c7ba,'request\x20sent',JSON[_0xd490('0xe')](_0x4f7368));if(_0x4f7368['error']){if(_0x4f7368[_0xd490('0xf')][_0xd490('0x10')]===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0x19c7ba,_0x4f7368[_0xd490('0xf')][_0xd490('0x11')]);return _0x5cb8dd(_0x4f7368[_0xd490('0xf')][_0xd490('0x11')]);}logger[_0xd490('0xf')]('SalesforceField,\x20%s,\x20%s',_0x19c7ba,_0x4f7368[_0xd490('0xf')]['message']);return _0x479487(_0x4f7368[_0xd490('0xf')][_0xd490('0x11')]);}else{logger[_0xd490('0xa')]('SalesforceField,\x20%s,\x20%s',_0x19c7ba,_0xd490('0xb'));_0x479487(_0x4f7368['result'][_0xd490('0x11')]);}})['catch'](function(_0x50e8c3){logger[_0xd490('0xf')](_0xd490('0x12'),_0x19c7ba,_0x50e8c3);_0x5cb8dd(_0x50e8c3);});});} \ No newline at end of file +var _0x08fe=['jayson/promise','client','then','info','debug','request\x20sent','stringify','error','message','SalesforceField,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x08fe,0x12a));var _0xe08f=function(_0x547bb6,_0x2d6f27){_0x547bb6=_0x547bb6-0x0;var _0x1a9154=_0x08fe[_0x547bb6];return _0x1a9154;};'use strict';var _=require(_0xe08f('0x0'));var util=require(_0xe08f('0x1'));var moment=require(_0xe08f('0x2'));var BPromise=require('bluebird');var rs=require(_0xe08f('0x3'));var fs=require('fs');var Redis=require(_0xe08f('0x4'));var db=require(_0xe08f('0x5'))['db'];var utils=require(_0xe08f('0x6'));var logger=require(_0xe08f('0x7'))(_0xe08f('0x8'));var config=require(_0xe08f('0x9'));var jayson=require(_0xe08f('0xa'));var client=jayson[_0xe08f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ad71a,_0x365e0c,_0x1bcf34){return new BPromise(function(_0x230161,_0x46f2cb){return client['request'](_0x1ad71a,_0x1bcf34)[_0xe08f('0xc')](function(_0x2556ca){logger[_0xe08f('0xd')]('SalesforceField,\x20%s,\x20%s',_0x365e0c,'request\x20sent');logger[_0xe08f('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x365e0c,_0xe08f('0xf'),JSON[_0xe08f('0x10')](_0x2556ca));if(_0x2556ca[_0xe08f('0x11')]){if(_0x2556ca['error']['code']===0x1f4){logger[_0xe08f('0x11')]('SalesforceField,\x20%s,\x20%s',_0x365e0c,_0x2556ca['error'][_0xe08f('0x12')]);return _0x46f2cb(_0x2556ca[_0xe08f('0x11')][_0xe08f('0x12')]);}logger[_0xe08f('0x11')](_0xe08f('0x13'),_0x365e0c,_0x2556ca[_0xe08f('0x11')][_0xe08f('0x12')]);return _0x230161(_0x2556ca[_0xe08f('0x11')][_0xe08f('0x12')]);}else{logger[_0xe08f('0xd')](_0xe08f('0x13'),_0x365e0c,_0xe08f('0xf'));_0x230161(_0x2556ca[_0xe08f('0x14')][_0xe08f('0x12')]);}})[_0xe08f('0x15')](function(_0x581c23){logger[_0xe08f('0x11')](_0xe08f('0x13'),_0x365e0c,_0x581c23);_0x46f2cb(_0x581c23);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 6b73883..3706250 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 _0xf31a=['/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf31a,0xaa));var _0xaf31=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xf31a[_0x1d24eb];return _0x1dc576;};'use strict';var multer=require('multer');var util=require(_0xaf31('0x0'));var path=require(_0xaf31('0x1'));var timeout=require(_0xaf31('0x2'));var express=require('express');var router=express[_0xaf31('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaf31('0x4'));var config=require(_0xaf31('0x5'));var controller=require('./intServicenowAccount.controller');router['get']('/',auth[_0xaf31('0x6')](),controller[_0xaf31('0x7')]);router[_0xaf31('0x8')](_0xaf31('0x9'),auth[_0xaf31('0x6')](),controller['show']);router[_0xaf31('0x8')](_0xaf31('0xa'),auth[_0xaf31('0x6')](),controller[_0xaf31('0xb')]);router[_0xaf31('0x8')](_0xaf31('0xc'),auth[_0xaf31('0x6')](),controller['getFields']);router[_0xaf31('0xd')]('/',auth[_0xaf31('0x6')](),controller[_0xaf31('0xe')]);router[_0xaf31('0xd')]('/:id/configurations',auth[_0xaf31('0x6')](),controller[_0xaf31('0xf')]);router['put'](_0xaf31('0x9'),auth[_0xaf31('0x6')](),controller[_0xaf31('0x10')]);router[_0xaf31('0x11')](_0xaf31('0x9'),auth[_0xaf31('0x6')](),controller[_0xaf31('0x12')]);module[_0xaf31('0x13')]=router; \ No newline at end of file +var _0xfc81=['put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration'];(function(_0x543e1d,_0x214a58){var _0x221d0b=function(_0x33c533){while(--_0x33c533){_0x543e1d['push'](_0x543e1d['shift']());}};_0x221d0b(++_0x214a58);}(_0xfc81,0x88));var _0x1fc8=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0xfc81[_0xcf5436];return _0xc4f5c8;};'use strict';var multer=require('multer');var util=require(_0x1fc8('0x0'));var path=require(_0x1fc8('0x1'));var timeout=require(_0x1fc8('0x2'));var express=require(_0x1fc8('0x3'));var router=express[_0x1fc8('0x4')]();var fs_extra=require(_0x1fc8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1fc8('0x6'));var config=require('../../config/environment');var controller=require(_0x1fc8('0x7'));router[_0x1fc8('0x8')]('/',auth[_0x1fc8('0x9')](),controller[_0x1fc8('0xa')]);router[_0x1fc8('0x8')](_0x1fc8('0xb'),auth[_0x1fc8('0x9')](),controller[_0x1fc8('0xc')]);router[_0x1fc8('0x8')](_0x1fc8('0xd'),auth[_0x1fc8('0x9')](),controller['getConfigurations']);router['get'](_0x1fc8('0xe'),auth[_0x1fc8('0x9')](),controller[_0x1fc8('0xf')]);router[_0x1fc8('0x10')]('/',auth[_0x1fc8('0x9')](),controller['create']);router[_0x1fc8('0x10')](_0x1fc8('0xd'),auth[_0x1fc8('0x9')](),controller[_0x1fc8('0x11')]);router[_0x1fc8('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x1fc8('0x13')]);router[_0x1fc8('0x14')](_0x1fc8('0xb'),auth[_0x1fc8('0x9')](),controller[_0x1fc8('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 fad702a..e44bd53 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 _0x12a7=['STRING','remoteUri','sequelize'];(function(_0xf89c3,_0x351bf1){var _0x274fc8=function(_0x5e0c91){while(--_0x5e0c91){_0xf89c3['push'](_0xf89c3['shift']());}};_0x274fc8(++_0x351bf1);}(_0x12a7,0x8f));var _0x712a=function(_0x21cfc8,_0x24ff3a){_0x21cfc8=_0x21cfc8-0x0;var _0xdcb25e=_0x12a7[_0x21cfc8];return _0xdcb25e;};'use strict';var Sequelize=require(_0x712a('0x0'));module['exports']={'name':{'type':Sequelize[_0x712a('0x1')]},'description':{'type':Sequelize[_0x712a('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x712a('0x2')},'serverUrl':{'type':Sequelize[_0x712a('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x81ee=['STRING','remoteUri','sequelize','exports'];(function(_0x1d1cf4,_0x53e367){var _0x385bb9=function(_0x30e64e){while(--_0x30e64e){_0x1d1cf4['push'](_0x1d1cf4['shift']());}};_0x385bb9(++_0x53e367);}(_0x81ee,0xde));var _0xe81e=function(_0x27f748,_0x52fdd1){_0x27f748=_0x27f748-0x0;var _0x7811b=_0x81ee[_0x27f748];return _0x7811b;};'use strict';var Sequelize=require(_0xe81e('0x0'));module[_0xe81e('0x1')]={'name':{'type':Sequelize[_0xe81e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe81e('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xe81e('0x2')]},'email':{'type':Sequelize[_0xe81e('0x2')]},'remoteUri':{'type':Sequelize[_0xe81e('0x2')],'unique':_0xe81e('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 006f08f..fcf7f12 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 _0xc1a3=['urgency','company','reassignment_count','assigned_to','comments','sla_due','approval','due_date','upon_approval','correlation_id','username','email','remoteUri','slice','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','GET','incident?sysparm_display_value=all','result','log','assign','remove','includes','forEach','internalType','label','TCL:\x20_object','push','concat','test','statusCode','Wrong\x20credentials','boolean','True','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','ServicenowAccount','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','keys','rawAttributes','fields','find','create','body','catch','destroy','getConfigurations','findOne','ServicenowConfiguration','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','made_sla','hold_reason','knowledge','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','rfc','expected_start','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','work_start','assignment_group','business_stc','description','calendar_duration','sys_class_name','closed_by','parent_incident','sys_id','reopened_by'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xc1a3,0xd8));var _0x3c1a=function(_0x324e86,_0x81b1cb){_0x324e86=_0x324e86-0x0;var _0x592846=_0xc1a3[_0x324e86];return _0x592846;};'use strict';var emlformat=require(_0x3c1a('0x0'));var rimraf=require(_0x3c1a('0x1'));var zipdir=require(_0x3c1a('0x2'));var jsonpatch=require(_0x3c1a('0x3'));var rp=require(_0x3c1a('0x4'));var moment=require(_0x3c1a('0x5'));var BPromise=require(_0x3c1a('0x6'));var Mustache=require(_0x3c1a('0x7'));var util=require('util');var path=require('path');var sox=require(_0x3c1a('0x8'));var csv=require(_0x3c1a('0x9'));var ejs=require(_0x3c1a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c1a('0xb'));var squel=require('squel');var crypto=require(_0x3c1a('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3c1a('0x9'));var querystring=require(_0x3c1a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3c1a('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c1a('0xf'));var logger=require(_0x3c1a('0x10'))(_0x3c1a('0x11'));var utils=require(_0x3c1a('0x12'));var config=require(_0x3c1a('0x13'));var licenseUtil=require(_0x3c1a('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x3c1a('0x15'));function respondWithStatusCode(_0x5c7dd7,_0x376fc5){_0x376fc5=_0x376fc5||0xcc;return function(_0x369c2c){if(_0x369c2c){return _0x5c7dd7[_0x3c1a('0x16')](_0x376fc5);}return _0x5c7dd7[_0x3c1a('0x17')](_0x376fc5)[_0x3c1a('0x18')]();};}function respondWithResult(_0x1d051d,_0x3fee7a){_0x3fee7a=_0x3fee7a||0xc8;return function(_0x4925ae){if(_0x4925ae){return _0x1d051d[_0x3c1a('0x17')](_0x3fee7a)[_0x3c1a('0x19')](_0x4925ae);}};}function respondWithFilteredResult(_0x59bd2c,_0x49fc6e){return function(_0x2e1621){if(_0x2e1621){var _0x1f88ce=typeof _0x49fc6e[_0x3c1a('0x1a')]==='undefined'&&typeof _0x49fc6e[_0x3c1a('0x1b')]===_0x3c1a('0x1c');var _0x696289=_0x2e1621[_0x3c1a('0x1d')];var _0x474d01=_0x1f88ce?0x0:_0x49fc6e[_0x3c1a('0x1a')];var _0x4de0cc=_0x1f88ce?_0x2e1621[_0x3c1a('0x1d')]:_0x49fc6e[_0x3c1a('0x1a')]+_0x49fc6e['limit'];var _0x5c8366;if(_0x4de0cc>=_0x696289){_0x4de0cc=_0x696289;_0x5c8366=0xc8;}else{_0x5c8366=0xce;}_0x59bd2c[_0x3c1a('0x17')](_0x5c8366);return _0x59bd2c[_0x3c1a('0x1e')](_0x3c1a('0x1f'),_0x474d01+'-'+_0x4de0cc+'/'+_0x696289)['json'](_0x2e1621);}return null;};}function patchUpdates(_0x5c9097){return function(_0x32500c){try{jsonpatch['apply'](_0x32500c,_0x5c9097,!![]);}catch(_0x202e57){return BPromise[_0x3c1a('0x20')](_0x202e57);}return _0x32500c[_0x3c1a('0x21')]();};}function saveUpdates(_0x16a0bd,_0x363f18){return function(_0x20f540){if(_0x20f540){return _0x20f540[_0x3c1a('0x22')](_0x16a0bd)['then'](function(_0x5baa38){return _0x5baa38;});}return null;};}function removeEntity(_0x52ffd7,_0x5bbd08){return function(_0x175824){if(_0x175824){return _0x175824['destroy']()[_0x3c1a('0x23')](function(){_0x52ffd7[_0x3c1a('0x17')](0xcc)[_0x3c1a('0x18')]();});}};}function handleEntityNotFound(_0x10ac0e,_0x53c833){return function(_0x5e4758){if(!_0x5e4758){_0x10ac0e[_0x3c1a('0x16')](0x194);}return _0x5e4758;};}function handleError(_0x36e1c5,_0x3d6de5){_0x3d6de5=_0x3d6de5||0x1f4;return function(_0x38fd14){logger[_0x3c1a('0x24')](_0x38fd14[_0x3c1a('0x25')]);if(_0x38fd14[_0x3c1a('0x26')]){delete _0x38fd14['name'];}_0x36e1c5[_0x3c1a('0x17')](_0x3d6de5)[_0x3c1a('0x27')](_0x38fd14);};}exports[_0x3c1a('0x28')]=function(_0x3e7e5b,_0x203625){var _0x327c67={},_0x492be3={},_0x202b67={'count':0x0,'rows':[]};var _0x15f357=_[_0x3c1a('0x29')](db[_0x3c1a('0x2a')]['rawAttributes'],function(_0x1e62a8){return{'name':_0x1e62a8[_0x3c1a('0x2b')],'type':_0x1e62a8[_0x3c1a('0x2c')][_0x3c1a('0x2d')]};});_0x492be3[_0x3c1a('0x2e')]=_['map'](_0x15f357,'name');_0x492be3[_0x3c1a('0x2f')]=_['keys'](_0x3e7e5b['query']);_0x492be3['filters']=_[_0x3c1a('0x30')](_0x492be3['model'],_0x492be3['query']);_0x327c67[_0x3c1a('0x31')]=_[_0x3c1a('0x30')](_0x492be3[_0x3c1a('0x2e')],qs['fields'](_0x3e7e5b['query']['fields']));_0x327c67['attributes']=_0x327c67[_0x3c1a('0x31')][_0x3c1a('0x32')]?_0x327c67[_0x3c1a('0x31')]:_0x492be3[_0x3c1a('0x2e')];if(!_0x3e7e5b[_0x3c1a('0x2f')][_0x3c1a('0x33')]('nolimit')){_0x327c67[_0x3c1a('0x1b')]=qs['limit'](_0x3e7e5b[_0x3c1a('0x2f')]['limit']);_0x327c67['offset']=qs[_0x3c1a('0x1a')](_0x3e7e5b[_0x3c1a('0x2f')][_0x3c1a('0x1a')]);}_0x327c67[_0x3c1a('0x34')]=qs['sort'](_0x3e7e5b[_0x3c1a('0x2f')][_0x3c1a('0x35')]);_0x327c67[_0x3c1a('0x36')]=qs[_0x3c1a('0x37')](_[_0x3c1a('0x38')](_0x3e7e5b[_0x3c1a('0x2f')],_0x492be3[_0x3c1a('0x37')]),_0x15f357);if(_0x3e7e5b[_0x3c1a('0x2f')][_0x3c1a('0x39')]){_0x327c67['where']=_['merge'](_0x327c67['where'],{'$or':_['map'](_0x15f357,function(_0x244897){if(_0x244897[_0x3c1a('0x2c')]!==_0x3c1a('0x3a')){var _0x45ae7a={};_0x45ae7a[_0x244897[_0x3c1a('0x26')]]={'$like':'%'+_0x3e7e5b[_0x3c1a('0x2f')][_0x3c1a('0x39')]+'%'};return _0x45ae7a;}})});}_0x327c67=_[_0x3c1a('0x3b')]({},_0x327c67,_0x3e7e5b[_0x3c1a('0x3c')]);var _0x3e0989={'where':_0x327c67[_0x3c1a('0x36')]};return db[_0x3c1a('0x2a')][_0x3c1a('0x1d')](_0x3e0989)[_0x3c1a('0x23')](function(_0x218621){_0x202b67['count']=_0x218621;if(_0x3e7e5b[_0x3c1a('0x2f')][_0x3c1a('0x3d')]){_0x327c67[_0x3c1a('0x3e')]=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x327c67);})[_0x3c1a('0x23')](function(_0x15b699){_0x202b67[_0x3c1a('0x3f')]=_0x15b699;return _0x202b67;})['then'](respondWithFilteredResult(_0x203625,_0x327c67))['catch'](handleError(_0x203625,null));};exports[_0x3c1a('0x40')]=function(_0x4d149b,_0x43667c){var _0x48d7e8={'raw':![],'where':{'id':_0x4d149b[_0x3c1a('0x41')]['id']}},_0xeaecfe={};_0xeaecfe[_0x3c1a('0x2e')]=_[_0x3c1a('0x42')](db['ServicenowAccount'][_0x3c1a('0x43')]);_0xeaecfe['query']=_[_0x3c1a('0x42')](_0x4d149b[_0x3c1a('0x2f')]);_0xeaecfe[_0x3c1a('0x37')]=_[_0x3c1a('0x30')](_0xeaecfe['model'],_0xeaecfe[_0x3c1a('0x2f')]);_0x48d7e8['attributes']=_['intersection'](_0xeaecfe[_0x3c1a('0x2e')],qs[_0x3c1a('0x44')](_0x4d149b[_0x3c1a('0x2f')][_0x3c1a('0x44')]));_0x48d7e8[_0x3c1a('0x31')]=_0x48d7e8['attributes'][_0x3c1a('0x32')]?_0x48d7e8[_0x3c1a('0x31')]:_0xeaecfe[_0x3c1a('0x2e')];if(_0x4d149b[_0x3c1a('0x2f')][_0x3c1a('0x3d')]){_0x48d7e8[_0x3c1a('0x3e')]=[{'all':!![]}];}_0x48d7e8=_[_0x3c1a('0x3b')]({},_0x48d7e8,_0x4d149b['options']);return db[_0x3c1a('0x2a')][_0x3c1a('0x45')](_0x48d7e8)[_0x3c1a('0x23')](handleEntityNotFound(_0x43667c,null))[_0x3c1a('0x23')](respondWithResult(_0x43667c,null))['catch'](handleError(_0x43667c,null));};exports[_0x3c1a('0x46')]=function(_0xc00a3c,_0x41151b){return db[_0x3c1a('0x2a')][_0x3c1a('0x46')](_0xc00a3c[_0x3c1a('0x47')],{})[_0x3c1a('0x23')](respondWithResult(_0x41151b,0xc9))['catch'](handleError(_0x41151b,null));};exports['update']=function(_0x4e385b,_0x25d334){if(_0x4e385b[_0x3c1a('0x47')]['id']){delete _0x4e385b['body']['id'];}return db[_0x3c1a('0x2a')][_0x3c1a('0x45')]({'where':{'id':_0x4e385b[_0x3c1a('0x41')]['id']}})[_0x3c1a('0x23')](handleEntityNotFound(_0x25d334,null))['then'](saveUpdates(_0x4e385b[_0x3c1a('0x47')],null))[_0x3c1a('0x23')](respondWithResult(_0x25d334,null))[_0x3c1a('0x48')](handleError(_0x25d334,null));};exports[_0x3c1a('0x49')]=function(_0x47e59d,_0x23fabc){return db['ServicenowAccount'][_0x3c1a('0x45')]({'where':{'id':_0x47e59d['params']['id']}})['then'](handleEntityNotFound(_0x23fabc,null))[_0x3c1a('0x23')](removeEntity(_0x23fabc,null))['catch'](handleError(_0x23fabc,null));};exports[_0x3c1a('0x4a')]=function(_0x3b61a7,_0x509e23,_0x1cd526){var _0x2d0daf={};var _0x32260a={};var _0x4a2948;var _0x2c3003;return db[_0x3c1a('0x2a')][_0x3c1a('0x4b')]({'where':{'id':_0x3b61a7[_0x3c1a('0x41')]['id']}})['then'](handleEntityNotFound(_0x509e23,null))[_0x3c1a('0x23')](function(_0x129f18){if(_0x129f18){_0x4a2948=_0x129f18;_0x32260a['model']=_[_0x3c1a('0x42')](db[_0x3c1a('0x4c')][_0x3c1a('0x43')]);_0x32260a[_0x3c1a('0x2f')]=_['keys'](_0x3b61a7[_0x3c1a('0x2f')]);_0x32260a[_0x3c1a('0x37')]=_['intersection'](_0x32260a['model'],_0x32260a['query']);_0x2d0daf[_0x3c1a('0x31')]=_[_0x3c1a('0x30')](_0x32260a['model'],qs[_0x3c1a('0x44')](_0x3b61a7[_0x3c1a('0x2f')]['fields']));_0x2d0daf['attributes']=_0x2d0daf[_0x3c1a('0x31')][_0x3c1a('0x32')]?_0x2d0daf[_0x3c1a('0x31')]:_0x32260a[_0x3c1a('0x2e')];_0x2d0daf[_0x3c1a('0x34')]=qs['sort'](_0x3b61a7[_0x3c1a('0x2f')][_0x3c1a('0x35')]);_0x2d0daf['where']=qs[_0x3c1a('0x37')](_['pick'](_0x3b61a7['query'],_0x32260a[_0x3c1a('0x37')]));if(_0x3b61a7[_0x3c1a('0x2f')][_0x3c1a('0x39')]){_0x2d0daf[_0x3c1a('0x36')]=_[_0x3c1a('0x3b')](_0x2d0daf[_0x3c1a('0x36')],{'$or':_['map'](_0x2d0daf[_0x3c1a('0x31')],function(_0x3392df){var _0x19cc0d={};_0x19cc0d[_0x3392df]={'$like':'%'+_0x3b61a7[_0x3c1a('0x2f')][_0x3c1a('0x39')]+'%'};return _0x19cc0d;})});}_0x2d0daf=_[_0x3c1a('0x3b')]({},_0x2d0daf,_0x3b61a7[_0x3c1a('0x3c')]);return _0x4a2948[_0x3c1a('0x4a')](_0x2d0daf);}})[_0x3c1a('0x23')](function(_0x5ba016){if(_0x5ba016){_0x2c3003=_0x5ba016[_0x3c1a('0x32')];if(!_0x3b61a7[_0x3c1a('0x2f')][_0x3c1a('0x33')](_0x3c1a('0x4d'))){_0x2d0daf[_0x3c1a('0x1b')]=qs['limit'](_0x3b61a7[_0x3c1a('0x2f')][_0x3c1a('0x1b')]);_0x2d0daf['offset']=qs[_0x3c1a('0x1a')](_0x3b61a7[_0x3c1a('0x2f')][_0x3c1a('0x1a')]);}return _0x4a2948[_0x3c1a('0x4a')](_0x2d0daf);}})[_0x3c1a('0x23')](function(_0x33bcb0){if(_0x33bcb0){return _0x33bcb0?{'count':_0x2c3003,'rows':_0x33bcb0}:null;}})[_0x3c1a('0x23')](respondWithResult(_0x509e23,null))['catch'](handleError(_0x509e23,null));};exports['addConfiguration']=function(_0x27a165,_0x26e19b,_0x438bfd){if(_0x27a165['body']['id']){delete _0x27a165[_0x3c1a('0x47')]['id'];}return db[_0x3c1a('0x2a')][_0x3c1a('0x4b')]({'where':{'id':_0x27a165['params']['id']}})[_0x3c1a('0x23')](handleEntityNotFound(_0x26e19b,null))[_0x3c1a('0x23')](function(_0xca91d1){if(_0xca91d1){_0x27a165[_0x3c1a('0x47')][_0x3c1a('0x4e')]=_0xca91d1['id'];_0x27a165['body'][_0x3c1a('0x4f')]=integrations[_0x3c1a('0x50')](_0x27a165[_0x3c1a('0x47')][_0x3c1a('0x51')],_0x27a165['body'][_0x3c1a('0x2c')]);_0x27a165[_0x3c1a('0x47')][_0x3c1a('0x52')]=integrations[_0x3c1a('0x53')](_0x27a165[_0x3c1a('0x47')]['channel'],_0x27a165['body'][_0x3c1a('0x2c')]);return db[_0x3c1a('0x4c')]['create'](_0x27a165[_0x3c1a('0x47')],{'include':[{'model':db[_0x3c1a('0x54')],'as':_0x3c1a('0x4f')},{'model':db[_0x3c1a('0x54')],'as':_0x3c1a('0x52')}]});}return null;})['then'](respondWithResult(_0x26e19b,null))[_0x3c1a('0x48')](handleError(_0x26e19b,null));};exports['getFields']=function(_0xc507d,_0x5c8ba8,_0x308367){var _0x5f1f78=[_0x3c1a('0x55'),_0x3c1a('0x56'),_0x3c1a('0x57'),'subcategory',_0x3c1a('0x58'),_0x3c1a('0x59'),_0x3c1a('0x5a'),_0x3c1a('0x5b'),_0x3c1a('0x5c')];var _0x55f2f2=[_0x3c1a('0x5d'),_0x3c1a('0x55'),_0x3c1a('0x5e'),_0x3c1a('0x5f'),_0x3c1a('0x60'),_0x3c1a('0x61'),_0x3c1a('0x62'),_0x3c1a('0x56'),_0x3c1a('0x63'),'number',_0x3c1a('0x64'),_0x3c1a('0x65'),'opened_by',_0x3c1a('0x66'),_0x3c1a('0x67'),_0x3c1a('0x68'),'state',_0x3c1a('0x69'),'knowledge',_0x3c1a('0x34'),'calendar_stc',_0x3c1a('0x6a'),_0x3c1a('0x6b'),_0x3c1a('0x6c'),_0x3c1a('0x6d'),_0x3c1a('0x6e'),_0x3c1a('0x6f'),_0x3c1a('0x70'),'priority',_0x3c1a('0x71'),_0x3c1a('0x72'),'time_worked',_0x3c1a('0x73'),'opened_at','business_duration',_0x3c1a('0x74'),_0x3c1a('0x75'),_0x3c1a('0x76'),_0x3c1a('0x77'),_0x3c1a('0x78'),_0x3c1a('0x79'),_0x3c1a('0x7a'),_0x3c1a('0x7b'),_0x3c1a('0x7c'),_0x3c1a('0x58'),_0x3c1a('0x7d'),'delivery_task',_0x3c1a('0x7e'),_0x3c1a('0x7f'),_0x3c1a('0x80'),'additional_assignee_list',_0x3c1a('0x81'),_0x3c1a('0x82'),_0x3c1a('0x59'),_0x3c1a('0x83'),'close_notes',_0x3c1a('0x84'),'follow_up',_0x3c1a('0x85'),_0x3c1a('0x86'),'contact_type',_0x3c1a('0x87'),_0x3c1a('0x5a'),_0x3c1a('0x88'),'problem_id',_0x3c1a('0x89'),_0x3c1a('0x8a'),'activity_due',_0x3c1a('0x8b'),'severity',_0x3c1a('0x8c'),_0x3c1a('0x8d'),_0x3c1a('0x8e'),'comments_and_work_notes',_0x3c1a('0x8f'),'sys_mod_count','reopen_count','sys_tags','escalation',_0x3c1a('0x90'),_0x3c1a('0x91'),'location','category'];var _0x428ccb='';var _0x45a000='';var _0x417f28=[];var _0x36377b='';var _0x27e8bd='';var _0xba573c=[];var _0x32d34c='';var _0x57831c='';var _0x169920={};var _0x46f72d='';return db[_0x3c1a('0x2a')]['findOne']({'where':{'id':_0xc507d[_0x3c1a('0x41')]['id']},'attributes':['id',_0x3c1a('0x92'),'password',_0x3c1a('0x93'),_0x3c1a('0x94'),'serverUrl']})[_0x3c1a('0x23')](handleEntityNotFound(_0x5c8ba8,null))['then'](function(_0x21f8a1){if(_0x21f8a1){_0x46f72d=_0x21f8a1[_0x3c1a('0x94')];var _0x462c10=_0x46f72d[_0x3c1a('0x95')](-0x1);if(_0x462c10==='/'){_0x46f72d=_0x46f72d['substring'](0x0,_0x46f72d['lastIndexOf'](_0x462c10));}_0x57831c=util[_0x3c1a('0x96')](_0x3c1a('0x97'),_0x46f72d);_0x32d34c=util[_0x3c1a('0x96')](_0x3c1a('0x98'),_0x46f72d);_0x169920={'user':_0x21f8a1['username'],'pass':_0x21f8a1[_0x3c1a('0x99')]};var _0x1eaf9f={'method':_0x3c1a('0x9a'),'uri':_0x57831c+_0x3c1a('0x9b'),'auth':_0x169920,'json':!![]};return rp(_0x1eaf9f);}})[_0x3c1a('0x23')](function(_0x2728fa){if(_0x2728fa[_0x3c1a('0x9c')][_0x3c1a('0x32')]>0x0){_0x428ccb=_0x2728fa[_0x3c1a('0x9c')];}console[_0x3c1a('0x9d')]('incident\x20table\x20objects',_0x428ccb);_0xba573c=[];_0x45a000=Object[_0x3c1a('0x9e')]([],_0x428ccb);_[_0x3c1a('0x9f')](_0x45a000,function(_0x4ed04c){return!_0x5f1f78[_0x3c1a('0xa0')](_0x4ed04c[_0x3c1a('0x26')]);});_0x45a000[_0x3c1a('0xa1')](function(_0x4f14f5){var _0x3091e1=createFieldObject(_0x32d34c,_0x169920,_0x4f14f5[_0x3c1a('0xa2')],_0x4f14f5[_0x3c1a('0x26')],_0x4f14f5[_0x3c1a('0xa3')],![]);_0xba573c['push'](_0x3091e1);});return Promise['all'](_0xba573c);})[_0x3c1a('0x23')](function(_0x4715e8){_0x417f28=_0x4715e8;_0x36377b=Object[_0x3c1a('0x9e')]([],_0x428ccb);console['log'](_0x3c1a('0xa4'),_0x428ccb);_[_0x3c1a('0x9f')](_0x36377b,function(_0x19bb2e){return _0x55f2f2[_0x3c1a('0xa0')](_0x19bb2e[_0x3c1a('0x26')]);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x36377b);_0xba573c=[];_0x36377b[_0x3c1a('0xa1')](function(_0x4530c7){var _0x244318=createFieldObject(_0x32d34c,_0x169920,_0x4530c7[_0x3c1a('0xa2')],_0x4530c7[_0x3c1a('0x26')],_0x4530c7[_0x3c1a('0xa3')],!![]);_0xba573c[_0x3c1a('0xa5')](_0x244318);});return Promise['all'](_0xba573c);})[_0x3c1a('0x23')](function(_0x23117a){_0x27e8bd=_0x23117a;var _0x245412=_0x417f28[_0x3c1a('0xa6')](_0x27e8bd);return{'count':_0x245412['length'],'rows':_0x245412};})[_0x3c1a('0x23')](respondWithResult(_0x5c8ba8,null))[_0x3c1a('0x48')](function(_0x4ceb62){console[_0x3c1a('0x9d')]('ServiceNow\x20error:\x20'+_0x4ceb62);var _0x4036bd=_0xc507d[_0x3c1a('0x2f')][_0x3c1a('0xa7')]?0x1f4:_0x4ceb62[_0x3c1a('0xa8')]||0x1f4;logger[_0x3c1a('0x24')](_0x4ceb62[_0x3c1a('0x25')]);delete _0x4ceb62[_0x3c1a('0x26')];if(_0x4036bd===0x191){_0x4036bd=0x190;}_0x5c8ba8[_0x3c1a('0x17')](_0x4036bd)[_0x3c1a('0x27')](_0xc507d[_0x3c1a('0x2f')][_0x3c1a('0xa7')]?{'message':_0x3c1a('0xa9'),'statusCode':_0x4ceb62[_0x3c1a('0xa8')]}:_0x4ceb62);});};function createFieldObject(_0x46f7ca,_0x3eac62,_0x41b770,_0x54f708,_0x12c46f,_0x1e8d2c){return new Promise(function(_0x569bb8,_0x4c614d){var _0x47b970={'id':_0x54f708,'name':_0x12c46f,'custom':_0x1e8d2c};if(_0x41b770===_0x3c1a('0xaa')){_0x47b970[_0x3c1a('0x3c')]=[{'name':_0x3c1a('0xab'),'value':'true'},{'name':'False','value':_0x3c1a('0xac')}];_0x569bb8(_0x47b970);}else{var _0x524a41={'method':_0x3c1a('0x9a'),'uri':_0x46f7ca+_0x3c1a('0xad')+_0x54f708,'auth':_0x3eac62,'json':!![]};return rp(_0x524a41)[_0x3c1a('0x23')](function(_0xe4a420){var _0x2b4143=[];if(_0xe4a420[_0x3c1a('0x9c')][_0x3c1a('0x32')]>0x0){_0xe4a420[_0x3c1a('0x9c')][_0x3c1a('0xa1')](function(_0x4752e1){if(_0x4752e1[_0x3c1a('0xae')]===_0x3c1a('0xac')){var _0x37764c={'name':_0x4752e1['label'],'value':_0x4752e1[_0x3c1a('0xaf')]};_0x2b4143[_0x3c1a('0xa5')](_0x37764c);}});}_0x47b970['options']=_0x2b4143;if(_0x47b970['options'][_0x3c1a('0x32')]>0x0){_0x569bb8(_0x47b970);}else{if(_0x1e8d2c==![]){_0x569bb8();}else{_0x569bb8(_0x47b970);}}});}});} \ No newline at end of file +var _0x5c04=['then','destroy','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','getConfigurations','addConfiguration','findOne','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','Subjects','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','caused_by','upon_reject','child_incidents','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','impact','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','approval','sys_mod_count','escalation','upon_approval','correlation_id','location','category','username','password','email','remoteUri','serverUrl','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','forEach','internalType','all','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','push','concat','ServiceNow\x20error:\x20','test','statusCode','error','boolean','True','true','False','false','inactive','value','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update'];(function(_0x5c0e2e,_0x1becd3){var _0x426c37=function(_0x332025){while(--_0x332025){_0x5c0e2e['push'](_0x5c0e2e['shift']());}};_0x426c37(++_0x1becd3);}(_0x5c04,0x143));var _0x45c0=function(_0x18f140,_0x3de293){_0x18f140=_0x18f140-0x0;var _0x387a89=_0x5c04[_0x18f140];return _0x387a89;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x45c0('0x0'));var zipdir=require(_0x45c0('0x1'));var jsonpatch=require(_0x45c0('0x2'));var rp=require(_0x45c0('0x3'));var moment=require(_0x45c0('0x4'));var BPromise=require(_0x45c0('0x5'));var Mustache=require(_0x45c0('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x45c0('0x7'));var ejs=require(_0x45c0('0x8'));var fs=require('fs');var fs_extra=require(_0x45c0('0x9'));var _=require(_0x45c0('0xa'));var squel=require('squel');var crypto=require(_0x45c0('0xb'));var jsforce=require(_0x45c0('0xc'));var deskjs=require(_0x45c0('0xd'));var toCsv=require(_0x45c0('0x7'));var querystring=require(_0x45c0('0xe'));var Papa=require('papaparse');var Redis=require(_0x45c0('0xf'));var authService=require(_0x45c0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x45c0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x45c0('0x12'))('api');var utils=require(_0x45c0('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x45c0('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x45c0('0x15'));function respondWithStatusCode(_0x1ee669,_0xb59ca1){_0xb59ca1=_0xb59ca1||0xcc;return function(_0x3a8a31){if(_0x3a8a31){return _0x1ee669[_0x45c0('0x16')](_0xb59ca1);}return _0x1ee669['status'](_0xb59ca1)[_0x45c0('0x17')]();};}function respondWithResult(_0x5a8a65,_0x3b015a){_0x3b015a=_0x3b015a||0xc8;return function(_0x55af5d){if(_0x55af5d){return _0x5a8a65[_0x45c0('0x18')](_0x3b015a)[_0x45c0('0x19')](_0x55af5d);}};}function respondWithFilteredResult(_0x51736d,_0x131fc2){return function(_0x1abc8e){if(_0x1abc8e){var _0x58514e=typeof _0x131fc2['offset']===_0x45c0('0x1a')&&typeof _0x131fc2[_0x45c0('0x1b')]===_0x45c0('0x1a');var _0x159289=_0x1abc8e[_0x45c0('0x1c')];var _0x3d743e=_0x58514e?0x0:_0x131fc2[_0x45c0('0x1d')];var _0x380d7f=_0x58514e?_0x1abc8e[_0x45c0('0x1c')]:_0x131fc2[_0x45c0('0x1d')]+_0x131fc2[_0x45c0('0x1b')];var _0x2d3858;if(_0x380d7f>=_0x159289){_0x380d7f=_0x159289;_0x2d3858=0xc8;}else{_0x2d3858=0xce;}_0x51736d[_0x45c0('0x18')](_0x2d3858);return _0x51736d[_0x45c0('0x1e')](_0x45c0('0x1f'),_0x3d743e+'-'+_0x380d7f+'/'+_0x159289)[_0x45c0('0x19')](_0x1abc8e);}return null;};}function patchUpdates(_0x4a352b){return function(_0x3270c3){try{jsonpatch['apply'](_0x3270c3,_0x4a352b,!![]);}catch(_0x1efda9){return BPromise[_0x45c0('0x20')](_0x1efda9);}return _0x3270c3[_0x45c0('0x21')]();};}function saveUpdates(_0x3b8a7b,_0x4f624b){return function(_0x310572){if(_0x310572){return _0x310572[_0x45c0('0x22')](_0x3b8a7b)[_0x45c0('0x23')](function(_0x454a8a){return _0x454a8a;});}return null;};}function removeEntity(_0x1ea933,_0x49c50b){return function(_0x31a6db){if(_0x31a6db){return _0x31a6db[_0x45c0('0x24')]()['then'](function(){_0x1ea933[_0x45c0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22611a,_0x580816){return function(_0x621130){if(!_0x621130){_0x22611a[_0x45c0('0x16')](0x194);}return _0x621130;};}function handleError(_0x52a70d,_0x32305d){_0x32305d=_0x32305d||0x1f4;return function(_0x2e27c6){logger['error'](_0x2e27c6[_0x45c0('0x25')]);if(_0x2e27c6['name']){delete _0x2e27c6[_0x45c0('0x26')];}_0x52a70d[_0x45c0('0x18')](_0x32305d)[_0x45c0('0x27')](_0x2e27c6);};}exports[_0x45c0('0x28')]=function(_0xf7ac0a,_0x609672){var _0x503ebc={},_0x3899e8={},_0x4ed869={'count':0x0,'rows':[]};var _0x5d03c8=_[_0x45c0('0x29')](db[_0x45c0('0x2a')][_0x45c0('0x2b')],function(_0x1ea4df){return{'name':_0x1ea4df[_0x45c0('0x2c')],'type':_0x1ea4df[_0x45c0('0x2d')][_0x45c0('0x2e')]};});_0x3899e8['model']=_[_0x45c0('0x29')](_0x5d03c8,_0x45c0('0x26'));_0x3899e8[_0x45c0('0x2f')]=_[_0x45c0('0x30')](_0xf7ac0a[_0x45c0('0x2f')]);_0x3899e8[_0x45c0('0x31')]=_['intersection'](_0x3899e8[_0x45c0('0x32')],_0x3899e8[_0x45c0('0x2f')]);_0x503ebc[_0x45c0('0x33')]=_[_0x45c0('0x34')](_0x3899e8['model'],qs[_0x45c0('0x35')](_0xf7ac0a[_0x45c0('0x2f')]['fields']));_0x503ebc[_0x45c0('0x33')]=_0x503ebc[_0x45c0('0x33')][_0x45c0('0x36')]?_0x503ebc[_0x45c0('0x33')]:_0x3899e8[_0x45c0('0x32')];if(!_0xf7ac0a[_0x45c0('0x2f')][_0x45c0('0x37')](_0x45c0('0x38'))){_0x503ebc[_0x45c0('0x1b')]=qs[_0x45c0('0x1b')](_0xf7ac0a[_0x45c0('0x2f')][_0x45c0('0x1b')]);_0x503ebc[_0x45c0('0x1d')]=qs['offset'](_0xf7ac0a['query'][_0x45c0('0x1d')]);}_0x503ebc[_0x45c0('0x39')]=qs[_0x45c0('0x3a')](_0xf7ac0a[_0x45c0('0x2f')]['sort']);_0x503ebc['where']=qs[_0x45c0('0x31')](_[_0x45c0('0x3b')](_0xf7ac0a[_0x45c0('0x2f')],_0x3899e8[_0x45c0('0x31')]),_0x5d03c8);if(_0xf7ac0a['query'][_0x45c0('0x3c')]){_0x503ebc[_0x45c0('0x3d')]=_[_0x45c0('0x3e')](_0x503ebc[_0x45c0('0x3d')],{'$or':_[_0x45c0('0x29')](_0x5d03c8,function(_0x49c556){if(_0x49c556[_0x45c0('0x2d')]!=='VIRTUAL'){var _0x4a516f={};_0x4a516f[_0x49c556[_0x45c0('0x26')]]={'$like':'%'+_0xf7ac0a[_0x45c0('0x2f')]['filter']+'%'};return _0x4a516f;}})});}_0x503ebc=_[_0x45c0('0x3e')]({},_0x503ebc,_0xf7ac0a[_0x45c0('0x3f')]);var _0x53c47f={'where':_0x503ebc['where']};return db[_0x45c0('0x2a')][_0x45c0('0x1c')](_0x53c47f)[_0x45c0('0x23')](function(_0x28eb8c){_0x4ed869[_0x45c0('0x1c')]=_0x28eb8c;if(_0xf7ac0a[_0x45c0('0x2f')][_0x45c0('0x40')]){_0x503ebc[_0x45c0('0x41')]=[{'all':!![]}];}return db[_0x45c0('0x2a')][_0x45c0('0x42')](_0x503ebc);})[_0x45c0('0x23')](function(_0x4c4793){_0x4ed869[_0x45c0('0x43')]=_0x4c4793;return _0x4ed869;})['then'](respondWithFilteredResult(_0x609672,_0x503ebc))[_0x45c0('0x44')](handleError(_0x609672,null));};exports['show']=function(_0x12804e,_0x3aa4b7){var _0x3f00e4={'raw':![],'where':{'id':_0x12804e[_0x45c0('0x45')]['id']}},_0xdcbaf0={};_0xdcbaf0[_0x45c0('0x32')]=_['keys'](db['ServicenowAccount']['rawAttributes']);_0xdcbaf0[_0x45c0('0x2f')]=_[_0x45c0('0x30')](_0x12804e[_0x45c0('0x2f')]);_0xdcbaf0[_0x45c0('0x31')]=_[_0x45c0('0x34')](_0xdcbaf0['model'],_0xdcbaf0[_0x45c0('0x2f')]);_0x3f00e4[_0x45c0('0x33')]=_[_0x45c0('0x34')](_0xdcbaf0['model'],qs['fields'](_0x12804e[_0x45c0('0x2f')][_0x45c0('0x35')]));_0x3f00e4['attributes']=_0x3f00e4[_0x45c0('0x33')][_0x45c0('0x36')]?_0x3f00e4[_0x45c0('0x33')]:_0xdcbaf0[_0x45c0('0x32')];if(_0x12804e['query'][_0x45c0('0x40')]){_0x3f00e4[_0x45c0('0x41')]=[{'all':!![]}];}_0x3f00e4=_[_0x45c0('0x3e')]({},_0x3f00e4,_0x12804e[_0x45c0('0x3f')]);return db['ServicenowAccount'][_0x45c0('0x46')](_0x3f00e4)[_0x45c0('0x23')](handleEntityNotFound(_0x3aa4b7,null))[_0x45c0('0x23')](respondWithResult(_0x3aa4b7,null))['catch'](handleError(_0x3aa4b7,null));};exports[_0x45c0('0x47')]=function(_0x52e025,_0xba89e5){return db[_0x45c0('0x2a')][_0x45c0('0x47')](_0x52e025[_0x45c0('0x48')],{})[_0x45c0('0x23')](respondWithResult(_0xba89e5,0xc9))[_0x45c0('0x44')](handleError(_0xba89e5,null));};exports['update']=function(_0xc33684,_0x10023d){if(_0xc33684[_0x45c0('0x48')]['id']){delete _0xc33684['body']['id'];}return db[_0x45c0('0x2a')][_0x45c0('0x46')]({'where':{'id':_0xc33684[_0x45c0('0x45')]['id']}})['then'](handleEntityNotFound(_0x10023d,null))['then'](saveUpdates(_0xc33684[_0x45c0('0x48')],null))['then'](respondWithResult(_0x10023d,null))[_0x45c0('0x44')](handleError(_0x10023d,null));};exports[_0x45c0('0x24')]=function(_0x24b033,_0x38c4e0){return db[_0x45c0('0x2a')][_0x45c0('0x46')]({'where':{'id':_0x24b033[_0x45c0('0x45')]['id']}})['then'](handleEntityNotFound(_0x38c4e0,null))[_0x45c0('0x23')](removeEntity(_0x38c4e0,null))['catch'](handleError(_0x38c4e0,null));};exports[_0x45c0('0x49')]=function(_0x5c6476,_0x280052,_0x433ee0){var _0x51e8ea={};var _0x2a16ac={};var _0x3b5530;var _0x442545;return db[_0x45c0('0x2a')]['findOne']({'where':{'id':_0x5c6476[_0x45c0('0x45')]['id']}})[_0x45c0('0x23')](handleEntityNotFound(_0x280052,null))[_0x45c0('0x23')](function(_0x41992b){if(_0x41992b){_0x3b5530=_0x41992b;_0x2a16ac['model']=_['keys'](db['ServicenowConfiguration'][_0x45c0('0x2b')]);_0x2a16ac[_0x45c0('0x2f')]=_['keys'](_0x5c6476[_0x45c0('0x2f')]);_0x2a16ac[_0x45c0('0x31')]=_[_0x45c0('0x34')](_0x2a16ac[_0x45c0('0x32')],_0x2a16ac['query']);_0x51e8ea[_0x45c0('0x33')]=_[_0x45c0('0x34')](_0x2a16ac[_0x45c0('0x32')],qs['fields'](_0x5c6476[_0x45c0('0x2f')][_0x45c0('0x35')]));_0x51e8ea[_0x45c0('0x33')]=_0x51e8ea[_0x45c0('0x33')]['length']?_0x51e8ea[_0x45c0('0x33')]:_0x2a16ac[_0x45c0('0x32')];_0x51e8ea[_0x45c0('0x39')]=qs['sort'](_0x5c6476['query'][_0x45c0('0x3a')]);_0x51e8ea['where']=qs['filters'](_[_0x45c0('0x3b')](_0x5c6476[_0x45c0('0x2f')],_0x2a16ac[_0x45c0('0x31')]));if(_0x5c6476[_0x45c0('0x2f')]['filter']){_0x51e8ea[_0x45c0('0x3d')]=_[_0x45c0('0x3e')](_0x51e8ea[_0x45c0('0x3d')],{'$or':_[_0x45c0('0x29')](_0x51e8ea['attributes'],function(_0xf0e8b3){var _0x366e50={};_0x366e50[_0xf0e8b3]={'$like':'%'+_0x5c6476[_0x45c0('0x2f')][_0x45c0('0x3c')]+'%'};return _0x366e50;})});}_0x51e8ea=_[_0x45c0('0x3e')]({},_0x51e8ea,_0x5c6476[_0x45c0('0x3f')]);return _0x3b5530['getConfigurations'](_0x51e8ea);}})['then'](function(_0x1b49e4){if(_0x1b49e4){_0x442545=_0x1b49e4[_0x45c0('0x36')];if(!_0x5c6476[_0x45c0('0x2f')]['hasOwnProperty']('nolimit')){_0x51e8ea['limit']=qs[_0x45c0('0x1b')](_0x5c6476[_0x45c0('0x2f')]['limit']);_0x51e8ea[_0x45c0('0x1d')]=qs[_0x45c0('0x1d')](_0x5c6476[_0x45c0('0x2f')][_0x45c0('0x1d')]);}return _0x3b5530[_0x45c0('0x49')](_0x51e8ea);}})[_0x45c0('0x23')](function(_0x58f3c4){if(_0x58f3c4){return _0x58f3c4?{'count':_0x442545,'rows':_0x58f3c4}:null;}})[_0x45c0('0x23')](respondWithResult(_0x280052,null))['catch'](handleError(_0x280052,null));};exports[_0x45c0('0x4a')]=function(_0x41341f,_0xdaacd5,_0x4b780f){if(_0x41341f['body']['id']){delete _0x41341f[_0x45c0('0x48')]['id'];}return db[_0x45c0('0x2a')][_0x45c0('0x4b')]({'where':{'id':_0x41341f[_0x45c0('0x45')]['id']}})['then'](handleEntityNotFound(_0xdaacd5,null))[_0x45c0('0x23')](function(_0xdbd994){if(_0xdbd994){_0x41341f[_0x45c0('0x48')]['AccountId']=_0xdbd994['id'];_0x41341f[_0x45c0('0x48')]['Subjects']=integrations[_0x45c0('0x4c')](_0x41341f['body'][_0x45c0('0x4d')],_0x41341f[_0x45c0('0x48')][_0x45c0('0x2d')]);_0x41341f[_0x45c0('0x48')][_0x45c0('0x4e')]=integrations[_0x45c0('0x4f')](_0x41341f['body']['channel'],_0x41341f[_0x45c0('0x48')]['type']);return db[_0x45c0('0x50')][_0x45c0('0x47')](_0x41341f['body'],{'include':[{'model':db[_0x45c0('0x51')],'as':_0x45c0('0x52')},{'model':db[_0x45c0('0x51')],'as':_0x45c0('0x4e')}]});}return null;})[_0x45c0('0x23')](respondWithResult(_0xdaacd5,null))[_0x45c0('0x44')](handleError(_0xdaacd5,null));};exports['getFields']=function(_0xb4fa14,_0xb5db53,_0xa5c20d){var _0x2c3442=[_0x45c0('0x53'),_0x45c0('0x54'),_0x45c0('0x55'),_0x45c0('0x56'),_0x45c0('0x57'),_0x45c0('0x58'),_0x45c0('0x59'),_0x45c0('0x5a'),'category'];var _0x356911=['parent',_0x45c0('0x53'),_0x45c0('0x5b'),'watch_list',_0x45c0('0x5c'),'sys_updated_on',_0x45c0('0x5d'),_0x45c0('0x54'),'approval_history',_0x45c0('0x5e'),_0x45c0('0x5f'),_0x45c0('0x60'),'opened_by',_0x45c0('0x61'),_0x45c0('0x62'),_0x45c0('0x63'),_0x45c0('0x64'),_0x45c0('0x65'),_0x45c0('0x55'),_0x45c0('0x39'),_0x45c0('0x66'),'closed_at','cmdb_ci','delivery_plan',_0x45c0('0x67'),_0x45c0('0x68'),_0x45c0('0x69'),_0x45c0('0x6a'),_0x45c0('0x6b'),_0x45c0('0x6c'),'rfc',_0x45c0('0x6d'),'expected_start',_0x45c0('0x6e'),'business_duration',_0x45c0('0x6f'),_0x45c0('0x70'),_0x45c0('0x71'),_0x45c0('0x72'),_0x45c0('0x73'),_0x45c0('0x74'),_0x45c0('0x56'),_0x45c0('0x75'),_0x45c0('0x76'),_0x45c0('0x57'),'correlation_display','delivery_task',_0x45c0('0x77'),_0x45c0('0x78'),_0x45c0('0x79'),_0x45c0('0x7a'),_0x45c0('0x7b'),_0x45c0('0x7c'),_0x45c0('0x58'),_0x45c0('0x7d'),_0x45c0('0x7e'),_0x45c0('0x7f'),_0x45c0('0x80'),_0x45c0('0x81'),_0x45c0('0x82'),_0x45c0('0x83'),'reopened_by',_0x45c0('0x59'),_0x45c0('0x84'),_0x45c0('0x85'),_0x45c0('0x86'),_0x45c0('0x87'),'activity_due',_0x45c0('0x88'),'severity',_0x45c0('0x89'),_0x45c0('0x8a'),_0x45c0('0x8b'),'comments_and_work_notes','due_date',_0x45c0('0x8c'),'reopen_count','sys_tags',_0x45c0('0x8d'),_0x45c0('0x8e'),_0x45c0('0x8f'),_0x45c0('0x90'),_0x45c0('0x91')];var _0x37a528='';var _0x3eb6d4='';var _0x4f7a9b=[];var _0x3f06f4='';var _0x5e6e96='';var _0x400474=[];var _0x2766ad='';var _0x1506b7='';var _0x141b48={};var _0x2787ed='';return db[_0x45c0('0x2a')][_0x45c0('0x4b')]({'where':{'id':_0xb4fa14[_0x45c0('0x45')]['id']},'attributes':['id',_0x45c0('0x92'),_0x45c0('0x93'),_0x45c0('0x94'),_0x45c0('0x95'),_0x45c0('0x96')]})[_0x45c0('0x23')](handleEntityNotFound(_0xb5db53,null))['then'](function(_0x43fd97){if(_0x43fd97){_0x2787ed=_0x43fd97[_0x45c0('0x95')];var _0x1e3cd4=_0x2787ed['slice'](-0x1);if(_0x1e3cd4==='/'){_0x2787ed=_0x2787ed['substring'](0x0,_0x2787ed['lastIndexOf'](_0x1e3cd4));}_0x1506b7=util[_0x45c0('0x97')]('%s/api/now/doc/table/schema/',_0x2787ed);_0x2766ad=util[_0x45c0('0x97')](_0x45c0('0x98'),_0x2787ed);_0x141b48={'user':_0x43fd97[_0x45c0('0x92')],'pass':_0x43fd97[_0x45c0('0x93')]};var _0x3ed10f={'method':_0x45c0('0x99'),'uri':_0x1506b7+_0x45c0('0x9a'),'auth':_0x141b48,'json':!![]};return rp(_0x3ed10f);}})[_0x45c0('0x23')](function(_0xcc62dd){if(_0xcc62dd[_0x45c0('0x9b')]['length']>0x0){_0x37a528=_0xcc62dd[_0x45c0('0x9b')];}console[_0x45c0('0x9c')](_0x45c0('0x9d'),_0x37a528);_0x400474=[];_0x3eb6d4=Object[_0x45c0('0x9e')]([],_0x37a528);_['remove'](_0x3eb6d4,function(_0x4be5db){return!_0x2c3442[_0x45c0('0x9f')](_0x4be5db['name']);});_0x3eb6d4[_0x45c0('0xa0')](function(_0x442cd1){var _0x37b4fa=createFieldObject(_0x2766ad,_0x141b48,_0x442cd1[_0x45c0('0xa1')],_0x442cd1[_0x45c0('0x26')],_0x442cd1['label'],![]);_0x400474['push'](_0x37b4fa);});return Promise[_0x45c0('0xa2')](_0x400474);})[_0x45c0('0x23')](function(_0x44b353){_0x4f7a9b=_0x44b353;_0x3f06f4=Object[_0x45c0('0x9e')]([],_0x37a528);console[_0x45c0('0x9c')]('TCL:\x20_object',_0x37a528);_[_0x45c0('0xa3')](_0x3f06f4,function(_0xd93438){return _0x356911[_0x45c0('0x9f')](_0xd93438[_0x45c0('0x26')]);});console[_0x45c0('0x9c')](_0x45c0('0xa4'),_0x3f06f4);_0x400474=[];_0x3f06f4['forEach'](function(_0x2dbdd4){var _0x4f8d53=createFieldObject(_0x2766ad,_0x141b48,_0x2dbdd4[_0x45c0('0xa1')],_0x2dbdd4[_0x45c0('0x26')],_0x2dbdd4[_0x45c0('0xa5')],!![]);_0x400474[_0x45c0('0xa6')](_0x4f8d53);});return Promise[_0x45c0('0xa2')](_0x400474);})['then'](function(_0x594de3){_0x5e6e96=_0x594de3;var _0x55f3dd=_0x4f7a9b[_0x45c0('0xa7')](_0x5e6e96);return{'count':_0x55f3dd[_0x45c0('0x36')],'rows':_0x55f3dd};})[_0x45c0('0x23')](respondWithResult(_0xb5db53,null))['catch'](function(_0x46abce){console[_0x45c0('0x9c')](_0x45c0('0xa8')+_0x46abce);var _0x56c65a=_0xb4fa14['query'][_0x45c0('0xa9')]?0x1f4:_0x46abce[_0x45c0('0xaa')]||0x1f4;logger[_0x45c0('0xab')](_0x46abce[_0x45c0('0x25')]);delete _0x46abce[_0x45c0('0x26')];if(_0x56c65a===0x191){_0x56c65a=0x190;}_0xb5db53[_0x45c0('0x18')](_0x56c65a)[_0x45c0('0x27')](_0xb4fa14[_0x45c0('0x2f')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x46abce[_0x45c0('0xaa')]}:_0x46abce);});};function createFieldObject(_0x46e61b,_0xafcda5,_0x406619,_0x57b2c9,_0x589c55,_0x48ce05){return new Promise(function(_0x1ae3aa,_0x2e38b2){var _0xe74ee3={'id':_0x57b2c9,'name':_0x589c55,'custom':_0x48ce05};if(_0x406619===_0x45c0('0xac')){_0xe74ee3[_0x45c0('0x3f')]=[{'name':_0x45c0('0xad'),'value':_0x45c0('0xae')},{'name':_0x45c0('0xaf'),'value':_0x45c0('0xb0')}];_0x1ae3aa(_0xe74ee3);}else{var _0x1e6377={'method':_0x45c0('0x99'),'uri':_0x46e61b+'sys_choice?sysparm_query=name=incident^element='+_0x57b2c9,'auth':_0xafcda5,'json':!![]};return rp(_0x1e6377)['then'](function(_0x51a677){var _0x5eca76=[];if(_0x51a677[_0x45c0('0x9b')][_0x45c0('0x36')]>0x0){_0x51a677['result']['forEach'](function(_0x21fd66){if(_0x21fd66[_0x45c0('0xb1')]===_0x45c0('0xb0')){var _0xb8b6ba={'name':_0x21fd66[_0x45c0('0xa5')],'value':_0x21fd66[_0x45c0('0xb2')]};_0x5eca76[_0x45c0('0xa6')](_0xb8b6ba);}});}_0xe74ee3[_0x45c0('0x3f')]=_0x5eca76;if(_0xe74ee3[_0x45c0('0x3f')][_0x45c0('0x36')]>0x0){_0x1ae3aa(_0xe74ee3);}else{if(_0x48ce05==![]){_0x1ae3aa();}else{_0x1ae3aa(_0xe74ee3);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 15f536c..3bbdf17 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 _0x4819=['request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x330ed5,_0x1e14ad){var _0x9ff44b=function(_0x2d5fcf){while(--_0x2d5fcf){_0x330ed5['push'](_0x330ed5['shift']());}};_0x9ff44b(++_0x1e14ad);}(_0x4819,0xcd));var _0x9481=function(_0x4c7232,_0x4109aa){_0x4c7232=_0x4c7232-0x0;var _0x2175ca=_0x4819[_0x4c7232];return _0x2175ca;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x9481('0xa')]=function(_0x5def07,_0x54cc78){return _0x5def07[_0x9481('0xb')](_0x9481('0xc'),attributes,{'tableName':_0x9481('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1623=['path','./intServicenowAccount.attributes','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','api','moment','bluebird','request-promise'];(function(_0x253499,_0x9208cb){var _0x5d585e=function(_0x4931c8){while(--_0x4931c8){_0x253499['push'](_0x253499['shift']());}};_0x5d585e(++_0x9208cb);}(_0x1623,0xab));var _0x3162=function(_0x2eafb9,_0x435192){_0x2eafb9=_0x2eafb9-0x0;var _0x508123=_0x1623[_0x2eafb9];return _0x508123;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3162('0x1'));var moment=require(_0x3162('0x2'));var BPromise=require(_0x3162('0x3'));var rp=require(_0x3162('0x4'));var fs=require('fs');var path=require(_0x3162('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3162('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x3162('0x7')]=function(_0x428de6,_0x53260d){return _0x428de6[_0x3162('0x8')](_0x3162('0x9'),attributes,{'tableName':_0x3162('0xa'),'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 4c6ee3e..6dbe6c0 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 _0x2d36=['code','message','catch','GetServicenowAccount','findAll','options','where','attributes','map','include','model','ShowServicenowAccount','ServicenowAccount','find','raw','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x203546,_0x2e18c1){var _0x276b46=function(_0x2a5d4e){while(--_0x2a5d4e){_0x203546['push'](_0x203546['shift']());}};_0x276b46(++_0x2e18c1);}(_0x2d36,0x141));var _0x62d3=function(_0x5415c9,_0x2cf6b8){_0x5415c9=_0x5415c9-0x0;var _0x19d0cd=_0x2d36[_0x5415c9];return _0x19d0cd;};'use strict';var _=require(_0x62d3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x62d3('0x1'));var rs=require(_0x62d3('0x2'));var fs=require('fs');var Redis=require(_0x62d3('0x3'));var db=require(_0x62d3('0x4'))['db'];var utils=require(_0x62d3('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x62d3('0x6'));var jayson=require(_0x62d3('0x7'));var client=jayson[_0x62d3('0x8')][_0x62d3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45c0c1,_0x406408,_0x4a4e0a){return new BPromise(function(_0x30cad6,_0x28df64){return client[_0x62d3('0xa')](_0x45c0c1,_0x4a4e0a)[_0x62d3('0xb')](function(_0x156139){logger[_0x62d3('0xc')](_0x62d3('0xd'),_0x406408,'request\x20sent');logger[_0x62d3('0xe')](_0x62d3('0xf'),_0x406408,_0x62d3('0x10'),JSON[_0x62d3('0x11')](_0x156139));if(_0x156139[_0x62d3('0x12')]){if(_0x156139['error'][_0x62d3('0x13')]===0x1f4){logger[_0x62d3('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x406408,_0x156139[_0x62d3('0x12')][_0x62d3('0x14')]);return _0x28df64(_0x156139[_0x62d3('0x12')][_0x62d3('0x14')]);}logger[_0x62d3('0x12')](_0x62d3('0xd'),_0x406408,_0x156139[_0x62d3('0x12')][_0x62d3('0x14')]);return _0x30cad6(_0x156139['error'][_0x62d3('0x14')]);}else{logger['info'](_0x62d3('0xd'),_0x406408,'request\x20sent');_0x30cad6(_0x156139['result'][_0x62d3('0x14')]);}})[_0x62d3('0x15')](function(_0xb86853){logger[_0x62d3('0x12')](_0x62d3('0xd'),_0x406408,_0xb86853);_0x28df64(_0xb86853);});});}exports[_0x62d3('0x16')]=function(_0x3e5f75){var _0x5606a6=this;return new Promise(function(_0x34c82d,_0x301219){return db['ServicenowAccount'][_0x62d3('0x17')]({'raw':_0x3e5f75['options']?_0x3e5f75[_0x62d3('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3e5f75[_0x62d3('0x18')]?_0x3e5f75[_0x62d3('0x18')][_0x62d3('0x19')]||null:null,'attributes':_0x3e5f75[_0x62d3('0x18')]?_0x3e5f75[_0x62d3('0x18')][_0x62d3('0x1a')]||null:null,'limit':_0x3e5f75['options']?_0x3e5f75['options']['limit']||null:null,'include':_0x3e5f75[_0x62d3('0x18')]?_0x3e5f75[_0x62d3('0x18')]['include']?_[_0x62d3('0x1b')](_0x3e5f75[_0x62d3('0x18')][_0x62d3('0x1c')],function(_0x427420){return{'model':db[_0x427420[_0x62d3('0x1d')]],'as':_0x427420['as'],'attributes':_0x427420[_0x62d3('0x1a')],'include':_0x427420[_0x62d3('0x1c')]?_['map'](_0x427420['include'],function(_0x4fb2d5){return{'model':db[_0x4fb2d5[_0x62d3('0x1d')]],'as':_0x4fb2d5['as'],'attributes':_0x4fb2d5['attributes'],'include':_0x4fb2d5['include']?_[_0x62d3('0x1b')](_0x4fb2d5['include'],function(_0x4fc057){return{'model':db[_0x4fc057[_0x62d3('0x1d')]],'as':_0x4fc057['as'],'attributes':_0x4fc057['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x45cc56){logger[_0x62d3('0xc')](_0x62d3('0x16'),_0x3e5f75);logger[_0x62d3('0xe')](_0x62d3('0x16'),_0x3e5f75,JSON[_0x62d3('0x11')](_0x45cc56));_0x34c82d(_0x45cc56);})['catch'](function(_0x5117e1){logger[_0x62d3('0x12')]('GetServicenowAccount',_0x5117e1[_0x62d3('0x14')],_0x3e5f75);_0x301219(_0x5606a6['error'](0x1f4,_0x5117e1['message']));});});};exports[_0x62d3('0x1e')]=function(_0x5f0445){var _0x1fbea1=this;return new Promise(function(_0x4747ed,_0x1d6f7b){return db[_0x62d3('0x1f')][_0x62d3('0x20')]({'raw':_0x5f0445[_0x62d3('0x18')]?_0x5f0445[_0x62d3('0x18')][_0x62d3('0x21')]===undefined?!![]:![]:!![],'where':_0x5f0445[_0x62d3('0x18')]?_0x5f0445[_0x62d3('0x18')][_0x62d3('0x19')]||null:null,'attributes':_0x5f0445[_0x62d3('0x18')]?_0x5f0445[_0x62d3('0x18')][_0x62d3('0x1a')]||null:null,'include':_0x5f0445['options']?_0x5f0445[_0x62d3('0x18')][_0x62d3('0x1c')]?_['map'](_0x5f0445[_0x62d3('0x18')][_0x62d3('0x1c')],function(_0x3be707){return{'model':db[_0x3be707['model']],'as':_0x3be707['as'],'attributes':_0x3be707['attributes'],'include':_0x3be707[_0x62d3('0x1c')]?_['map'](_0x3be707[_0x62d3('0x1c')],function(_0x46019c){return{'model':db[_0x46019c[_0x62d3('0x1d')]],'as':_0x46019c['as'],'attributes':_0x46019c[_0x62d3('0x1a')],'include':_0x46019c[_0x62d3('0x1c')]?_['map'](_0x46019c['include'],function(_0x32bbea){return{'model':db[_0x32bbea[_0x62d3('0x1d')]],'as':_0x32bbea['as'],'attributes':_0x32bbea['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x147d64){logger['info'](_0x62d3('0x1e'),_0x5f0445);logger['debug']('ShowServicenowAccount',_0x5f0445,JSON[_0x62d3('0x11')](_0x147d64));_0x4747ed(_0x147d64);})[_0x62d3('0x15')](function(_0x1f9bb2){logger['error'](_0x62d3('0x1e'),_0x1f9bb2['message'],_0x5f0445);_0x1d6f7b(_0x1fbea1[_0x62d3('0x12')](0x1f4,_0x1f9bb2[_0x62d3('0x14')]));});});}; \ No newline at end of file +var _0x5620=['catch','GetServicenowAccount','ServicenowAccount','options','raw','attributes','include','model','map','stringify','ShowServicenowAccount','find','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x4b4288,_0x21a90b){var _0x3912d5=function(_0x38ec9d){while(--_0x38ec9d){_0x4b4288['push'](_0x4b4288['shift']());}};_0x3912d5(++_0x21a90b);}(_0x5620,0xc6));var _0x0562=function(_0x48961c,_0x280e9d){_0x48961c=_0x48961c-0x0;var _0x1d895d=_0x5620[_0x48961c];return _0x1d895d;};'use strict';var _=require('lodash');var util=require(_0x0562('0x0'));var moment=require(_0x0562('0x1'));var BPromise=require(_0x0562('0x2'));var rs=require(_0x0562('0x3'));var fs=require('fs');var Redis=require(_0x0562('0x4'));var db=require(_0x0562('0x5'))['db'];var utils=require(_0x0562('0x6'));var logger=require(_0x0562('0x7'))(_0x0562('0x8'));var config=require(_0x0562('0x9'));var jayson=require(_0x0562('0xa'));var client=jayson[_0x0562('0xb')][_0x0562('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x457ac0,_0x6d65ce,_0x4182cb){return new BPromise(function(_0xa44663,_0x1e0e80){return client[_0x0562('0xd')](_0x457ac0,_0x4182cb)[_0x0562('0xe')](function(_0x27a02b){logger[_0x0562('0xf')](_0x0562('0x10'),_0x6d65ce,_0x0562('0x11'));logger[_0x0562('0x12')](_0x0562('0x13'),_0x6d65ce,_0x0562('0x11'),JSON['stringify'](_0x27a02b));if(_0x27a02b[_0x0562('0x14')]){if(_0x27a02b[_0x0562('0x14')][_0x0562('0x15')]===0x1f4){logger[_0x0562('0x14')](_0x0562('0x10'),_0x6d65ce,_0x27a02b[_0x0562('0x14')][_0x0562('0x16')]);return _0x1e0e80(_0x27a02b[_0x0562('0x14')][_0x0562('0x16')]);}logger[_0x0562('0x14')](_0x0562('0x10'),_0x6d65ce,_0x27a02b[_0x0562('0x14')]['message']);return _0xa44663(_0x27a02b[_0x0562('0x14')][_0x0562('0x16')]);}else{logger[_0x0562('0xf')](_0x0562('0x10'),_0x6d65ce,_0x0562('0x11'));_0xa44663(_0x27a02b[_0x0562('0x17')]['message']);}})[_0x0562('0x18')](function(_0x190ec0){logger[_0x0562('0x14')](_0x0562('0x10'),_0x6d65ce,_0x190ec0);_0x1e0e80(_0x190ec0);});});}exports[_0x0562('0x19')]=function(_0x3ae278){var _0x3bf3ca=this;return new Promise(function(_0x19694d,_0x56d6c9){return db[_0x0562('0x1a')]['findAll']({'raw':_0x3ae278[_0x0562('0x1b')]?_0x3ae278[_0x0562('0x1b')][_0x0562('0x1c')]===undefined?!![]:![]:!![],'where':_0x3ae278[_0x0562('0x1b')]?_0x3ae278[_0x0562('0x1b')]['where']||null:null,'attributes':_0x3ae278[_0x0562('0x1b')]?_0x3ae278[_0x0562('0x1b')][_0x0562('0x1d')]||null:null,'limit':_0x3ae278[_0x0562('0x1b')]?_0x3ae278['options']['limit']||null:null,'include':_0x3ae278[_0x0562('0x1b')]?_0x3ae278[_0x0562('0x1b')][_0x0562('0x1e')]?_['map'](_0x3ae278['options'][_0x0562('0x1e')],function(_0x392451){return{'model':db[_0x392451[_0x0562('0x1f')]],'as':_0x392451['as'],'attributes':_0x392451['attributes'],'include':_0x392451[_0x0562('0x1e')]?_[_0x0562('0x20')](_0x392451[_0x0562('0x1e')],function(_0x40f74a){return{'model':db[_0x40f74a['model']],'as':_0x40f74a['as'],'attributes':_0x40f74a[_0x0562('0x1d')],'include':_0x40f74a['include']?_['map'](_0x40f74a[_0x0562('0x1e')],function(_0x364d98){return{'model':db[_0x364d98[_0x0562('0x1f')]],'as':_0x364d98['as'],'attributes':_0x364d98[_0x0562('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x231c87){logger['info']('GetServicenowAccount',_0x3ae278);logger['debug'](_0x0562('0x19'),_0x3ae278,JSON[_0x0562('0x21')](_0x231c87));_0x19694d(_0x231c87);})['catch'](function(_0x3b604a){logger['error'](_0x0562('0x19'),_0x3b604a[_0x0562('0x16')],_0x3ae278);_0x56d6c9(_0x3bf3ca[_0x0562('0x14')](0x1f4,_0x3b604a[_0x0562('0x16')]));});});};exports[_0x0562('0x22')]=function(_0x2accd2){var _0x3a0639=this;return new Promise(function(_0x1a74d4,_0x34ccc4){return db['ServicenowAccount'][_0x0562('0x23')]({'raw':_0x2accd2['options']?_0x2accd2['options'][_0x0562('0x1c')]===undefined?!![]:![]:!![],'where':_0x2accd2[_0x0562('0x1b')]?_0x2accd2['options'][_0x0562('0x24')]||null:null,'attributes':_0x2accd2[_0x0562('0x1b')]?_0x2accd2['options'][_0x0562('0x1d')]||null:null,'include':_0x2accd2[_0x0562('0x1b')]?_0x2accd2[_0x0562('0x1b')][_0x0562('0x1e')]?_[_0x0562('0x20')](_0x2accd2['options'][_0x0562('0x1e')],function(_0x11afef){return{'model':db[_0x11afef[_0x0562('0x1f')]],'as':_0x11afef['as'],'attributes':_0x11afef[_0x0562('0x1d')],'include':_0x11afef[_0x0562('0x1e')]?_[_0x0562('0x20')](_0x11afef['include'],function(_0x2a5d7a){return{'model':db[_0x2a5d7a[_0x0562('0x1f')]],'as':_0x2a5d7a['as'],'attributes':_0x2a5d7a[_0x0562('0x1d')],'include':_0x2a5d7a[_0x0562('0x1e')]?_[_0x0562('0x20')](_0x2a5d7a[_0x0562('0x1e')],function(_0x199030){return{'model':db[_0x199030[_0x0562('0x1f')]],'as':_0x199030['as'],'attributes':_0x199030['attributes']};}):[]};}):[]};}):[]:[]})[_0x0562('0xe')](function(_0x5202f7){logger[_0x0562('0xf')](_0x0562('0x22'),_0x2accd2);logger[_0x0562('0x12')]('ShowServicenowAccount',_0x2accd2,JSON[_0x0562('0x21')](_0x5202f7));_0x1a74d4(_0x5202f7);})[_0x0562('0x18')](function(_0xb6fac4){logger['error']('ShowServicenowAccount',_0xb6fac4[_0x0562('0x16')],_0x2accd2);_0x34ccc4(_0x3a0639['error'](0x1f4,_0xb6fac4[_0x0562('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 2df10c6..b650575 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 _0xd76c=['/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x126860,_0x35b557){var _0x19555b=function(_0x5a0d1a){while(--_0x5a0d1a){_0x126860['push'](_0x126860['shift']());}};_0x19555b(++_0x35b557);}(_0xd76c,0x107));var _0xcd76=function(_0x3a7634,_0x2db384){_0x3a7634=_0x3a7634-0x0;var _0x23bbe9=_0xd76c[_0x3a7634];return _0x23bbe9;};'use strict';var multer=require(_0xcd76('0x0'));var util=require(_0xcd76('0x1'));var path=require(_0xcd76('0x2'));var timeout=require(_0xcd76('0x3'));var express=require('express');var router=express[_0xcd76('0x4')]();var fs_extra=require(_0xcd76('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcd76('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router[_0xcd76('0x7')]('/',auth[_0xcd76('0x8')](),controller[_0xcd76('0x9')]);router[_0xcd76('0x7')](_0xcd76('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xcd76('0x7')](_0xcd76('0xb'),auth['isAuthenticated'](),controller[_0xcd76('0xc')]);router[_0xcd76('0x7')]('/:id/subjects',auth[_0xcd76('0x8')](),controller[_0xcd76('0xd')]);router[_0xcd76('0x7')](_0xcd76('0xe'),auth[_0xcd76('0x8')](),controller['getDescriptions']);router[_0xcd76('0xf')]('/',auth[_0xcd76('0x8')](),controller[_0xcd76('0x10')]);router[_0xcd76('0x11')](_0xcd76('0xa'),auth['isAuthenticated'](),controller[_0xcd76('0x12')]);router[_0xcd76('0x13')](_0xcd76('0xa'),auth[_0xcd76('0x8')](),controller[_0xcd76('0x14')]);module['exports']=router; \ No newline at end of file +var _0xccb2=['get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x22be44,_0xff22cc){var _0x6634e4=function(_0x1d9ee5){while(--_0x1d9ee5){_0x22be44['push'](_0x22be44['shift']());}};_0x6634e4(++_0xff22cc);}(_0xccb2,0x1f0));var _0x2ccb=function(_0x3b35e4,_0x54216e){_0x3b35e4=_0x3b35e4-0x0;var _0x18f1bf=_0xccb2[_0x3b35e4];return _0x18f1bf;};'use strict';var multer=require(_0x2ccb('0x0'));var util=require(_0x2ccb('0x1'));var path=require(_0x2ccb('0x2'));var timeout=require(_0x2ccb('0x3'));var express=require(_0x2ccb('0x4'));var router=express['Router']();var fs_extra=require(_0x2ccb('0x5'));var auth=require(_0x2ccb('0x6'));var interaction=require(_0x2ccb('0x7'));var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router[_0x2ccb('0x8')]('/',auth[_0x2ccb('0x9')](),controller[_0x2ccb('0xa')]);router[_0x2ccb('0x8')](_0x2ccb('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x2ccb('0x8')](_0x2ccb('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x2ccb('0x8')](_0x2ccb('0xd'),auth['isAuthenticated'](),controller[_0x2ccb('0xe')]);router[_0x2ccb('0x8')]('/:id/descriptions',auth[_0x2ccb('0x9')](),controller['getDescriptions']);router[_0x2ccb('0xf')]('/',auth['isAuthenticated'](),controller[_0x2ccb('0x10')]);router[_0x2ccb('0x11')](_0x2ccb('0xb'),auth['isAuthenticated'](),controller[_0x2ccb('0x12')]);router[_0x2ccb('0x13')](_0x2ccb('0xb'),auth[_0x2ccb('0x9')](),controller[_0x2ccb('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index cf505c7..f4a5a42 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 _0x6c7a=['sequelize','STRING'];(function(_0x5502a7,_0x325618){var _0x3946fa=function(_0x1c8383){while(--_0x1c8383){_0x5502a7['push'](_0x5502a7['shift']());}};_0x3946fa(++_0x325618);}(_0x6c7a,0x1de));var _0xa6c7=function(_0x4e2a7d,_0x35f500){_0x4e2a7d=_0x4e2a7d-0x0;var _0x5830c0=_0x6c7a[_0x4e2a7d];return _0x5830c0;};'use strict';var Sequelize=require(_0xa6c7('0x0'));module['exports']={'name':{'type':Sequelize[_0xa6c7('0x1')]},'description':{'type':Sequelize[_0xa6c7('0x1')]}}; \ No newline at end of file +var _0xb03d=['exports','STRING','sequelize'];(function(_0x50f1c0,_0xa77c4e){var _0x25b47b=function(_0x17c18e){while(--_0x17c18e){_0x50f1c0['push'](_0x50f1c0['shift']());}};_0x25b47b(++_0xa77c4e);}(_0xb03d,0x1c7));var _0xdb03=function(_0x1b9eb7,_0x47c831){_0x1b9eb7=_0x1b9eb7-0x0;var _0x2ecb41=_0xb03d[_0x1b9eb7];return _0x2ecb41;};'use strict';var Sequelize=require(_0xdb03('0x0'));module[_0xdb03('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdb03('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 0272f67..40ae321 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 _0x8a4e=['create','body','ServicenowField','order','options','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','stack','name','index','map','rawAttributes','type','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','ServicenowConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','find'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8a4e,0x1a3));var _0xe8a4=function(_0x286ce0,_0x134339){_0x286ce0=_0x286ce0-0x0;var _0x217fe3=_0x8a4e[_0x286ce0];return _0x217fe3;};'use strict';var emlformat=require(_0xe8a4('0x0'));var rimraf=require(_0xe8a4('0x1'));var zipdir=require(_0xe8a4('0x2'));var jsonpatch=require(_0xe8a4('0x3'));var rp=require(_0xe8a4('0x4'));var moment=require(_0xe8a4('0x5'));var BPromise=require(_0xe8a4('0x6'));var Mustache=require('mustache');var util=require(_0xe8a4('0x7'));var path=require(_0xe8a4('0x8'));var sox=require(_0xe8a4('0x9'));var csv=require(_0xe8a4('0xa'));var ejs=require(_0xe8a4('0xb'));var fs=require('fs');var fs_extra=require(_0xe8a4('0xc'));var _=require(_0xe8a4('0xd'));var squel=require('squel');var crypto=require(_0xe8a4('0xe'));var jsforce=require(_0xe8a4('0xf'));var deskjs=require(_0xe8a4('0x10'));var toCsv=require(_0xe8a4('0xa'));var querystring=require(_0xe8a4('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe8a4('0x12'));var qs=require(_0xe8a4('0x13'));var as=require(_0xe8a4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8a4('0x15'))(_0xe8a4('0x16'));var utils=require(_0xe8a4('0x17'));var config=require(_0xe8a4('0x18'));var licenseUtil=require(_0xe8a4('0x19'));var db=require(_0xe8a4('0x1a'))['db'];function respondWithStatusCode(_0x3c2339,_0x2a7660){_0x2a7660=_0x2a7660||0xcc;return function(_0x2f13c0){if(_0x2f13c0){return _0x3c2339[_0xe8a4('0x1b')](_0x2a7660);}return _0x3c2339[_0xe8a4('0x1c')](_0x2a7660)[_0xe8a4('0x1d')]();};}function respondWithResult(_0x2e824c,_0x33f874){_0x33f874=_0x33f874||0xc8;return function(_0x3420bb){if(_0x3420bb){return _0x2e824c[_0xe8a4('0x1c')](_0x33f874)[_0xe8a4('0x1e')](_0x3420bb);}};}function respondWithFilteredResult(_0x12cbbd,_0x34094e){return function(_0x37f3b8){if(_0x37f3b8){var _0xeffbfa=typeof _0x34094e[_0xe8a4('0x1f')]===_0xe8a4('0x20')&&typeof _0x34094e[_0xe8a4('0x21')]==='undefined';var _0x4d1277=_0x37f3b8[_0xe8a4('0x22')];var _0x1d1982=_0xeffbfa?0x0:_0x34094e[_0xe8a4('0x1f')];var _0x26cbb4=_0xeffbfa?_0x37f3b8['count']:_0x34094e[_0xe8a4('0x1f')]+_0x34094e[_0xe8a4('0x21')];var _0x15150a;if(_0x26cbb4>=_0x4d1277){_0x26cbb4=_0x4d1277;_0x15150a=0xc8;}else{_0x15150a=0xce;}_0x12cbbd[_0xe8a4('0x1c')](_0x15150a);return _0x12cbbd['set'](_0xe8a4('0x23'),_0x1d1982+'-'+_0x26cbb4+'/'+_0x4d1277)[_0xe8a4('0x1e')](_0x37f3b8);}return null;};}function patchUpdates(_0x26c4ce){return function(_0x5c7fa7){try{jsonpatch[_0xe8a4('0x24')](_0x5c7fa7,_0x26c4ce,!![]);}catch(_0x155d85){return BPromise[_0xe8a4('0x25')](_0x155d85);}return _0x5c7fa7['save']();};}function saveUpdates(_0x37ddae,_0x51cfbb){return function(_0x16eb00){if(_0x16eb00){return _0x16eb00[_0xe8a4('0x26')](_0x37ddae)[_0xe8a4('0x27')](function(_0x533a5f){return _0x533a5f;});}return null;};}function removeEntity(_0x4ce053,_0x21bc7d){return function(_0x4f9074){if(_0x4f9074){return _0x4f9074[_0xe8a4('0x28')]()[_0xe8a4('0x27')](function(){_0x4ce053[_0xe8a4('0x1c')](0xcc)[_0xe8a4('0x1d')]();});}};}function handleEntityNotFound(_0x10da1a,_0x5592b7){return function(_0x3638d8){if(!_0x3638d8){_0x10da1a[_0xe8a4('0x1b')](0x194);}return _0x3638d8;};}function handleError(_0x37cc9d,_0xf586b3){_0xf586b3=_0xf586b3||0x1f4;return function(_0x1f25ef){logger['error'](_0x1f25ef[_0xe8a4('0x29')]);if(_0x1f25ef[_0xe8a4('0x2a')]){delete _0x1f25ef['name'];}_0x37cc9d[_0xe8a4('0x1c')](_0xf586b3)['send'](_0x1f25ef);};}exports[_0xe8a4('0x2b')]=function(_0x3ced2d,_0x380049){var _0x816e19={},_0x1fc661={},_0x2ef723={'count':0x0,'rows':[]};var _0xcf70e2=_[_0xe8a4('0x2c')](db['ServicenowConfiguration'][_0xe8a4('0x2d')],function(_0x5ea44f){return{'name':_0x5ea44f['fieldName'],'type':_0x5ea44f[_0xe8a4('0x2e')][_0xe8a4('0x2f')]};});_0x1fc661['model']=_[_0xe8a4('0x2c')](_0xcf70e2,'name');_0x1fc661[_0xe8a4('0x30')]=_['keys'](_0x3ced2d[_0xe8a4('0x30')]);_0x1fc661[_0xe8a4('0x31')]=_['intersection'](_0x1fc661['model'],_0x1fc661[_0xe8a4('0x30')]);_0x816e19[_0xe8a4('0x32')]=_[_0xe8a4('0x33')](_0x1fc661[_0xe8a4('0x34')],qs[_0xe8a4('0x35')](_0x3ced2d[_0xe8a4('0x30')][_0xe8a4('0x35')]));_0x816e19[_0xe8a4('0x32')]=_0x816e19[_0xe8a4('0x32')][_0xe8a4('0x36')]?_0x816e19[_0xe8a4('0x32')]:_0x1fc661['model'];if(!_0x3ced2d[_0xe8a4('0x30')][_0xe8a4('0x37')](_0xe8a4('0x38'))){_0x816e19[_0xe8a4('0x21')]=qs[_0xe8a4('0x21')](_0x3ced2d['query'][_0xe8a4('0x21')]);_0x816e19['offset']=qs[_0xe8a4('0x1f')](_0x3ced2d[_0xe8a4('0x30')]['offset']);}_0x816e19['order']=qs['sort'](_0x3ced2d['query'][_0xe8a4('0x39')]);_0x816e19[_0xe8a4('0x3a')]=qs[_0xe8a4('0x31')](_[_0xe8a4('0x3b')](_0x3ced2d['query'],_0x1fc661[_0xe8a4('0x31')]),_0xcf70e2);if(_0x3ced2d[_0xe8a4('0x30')][_0xe8a4('0x3c')]){_0x816e19[_0xe8a4('0x3a')]=_[_0xe8a4('0x3d')](_0x816e19[_0xe8a4('0x3a')],{'$or':_['map'](_0xcf70e2,function(_0x3a5f2d){if(_0x3a5f2d['type']!==_0xe8a4('0x3e')){var _0x43a625={};_0x43a625[_0x3a5f2d[_0xe8a4('0x2a')]]={'$like':'%'+_0x3ced2d[_0xe8a4('0x30')][_0xe8a4('0x3c')]+'%'};return _0x43a625;}})});}_0x816e19=_[_0xe8a4('0x3d')]({},_0x816e19,_0x3ced2d['options']);var _0x32cf97={'where':_0x816e19[_0xe8a4('0x3a')]};return db[_0xe8a4('0x3f')][_0xe8a4('0x22')](_0x32cf97)[_0xe8a4('0x27')](function(_0x2955bb){_0x2ef723[_0xe8a4('0x22')]=_0x2955bb;if(_0x3ced2d['query'][_0xe8a4('0x40')]){_0x816e19[_0xe8a4('0x41')]=[{'all':!![]}];}return db[_0xe8a4('0x3f')][_0xe8a4('0x42')](_0x816e19);})[_0xe8a4('0x27')](function(_0x476a02){_0x2ef723[_0xe8a4('0x43')]=_0x476a02;return _0x2ef723;})['then'](respondWithFilteredResult(_0x380049,_0x816e19))[_0xe8a4('0x44')](handleError(_0x380049,null));};exports[_0xe8a4('0x45')]=function(_0x22a944,_0xd901bd){var _0x320a7d={'raw':![],'where':{'id':_0x22a944[_0xe8a4('0x46')]['id']}},_0x33f09b={};_0x33f09b['model']=_[_0xe8a4('0x47')](db[_0xe8a4('0x3f')][_0xe8a4('0x2d')]);_0x33f09b[_0xe8a4('0x30')]=_[_0xe8a4('0x47')](_0x22a944['query']);_0x33f09b[_0xe8a4('0x31')]=_['intersection'](_0x33f09b['model'],_0x33f09b[_0xe8a4('0x30')]);_0x320a7d[_0xe8a4('0x32')]=_[_0xe8a4('0x33')](_0x33f09b[_0xe8a4('0x34')],qs[_0xe8a4('0x35')](_0x22a944[_0xe8a4('0x30')][_0xe8a4('0x35')]));_0x320a7d[_0xe8a4('0x32')]=_0x320a7d[_0xe8a4('0x32')][_0xe8a4('0x36')]?_0x320a7d[_0xe8a4('0x32')]:_0x33f09b[_0xe8a4('0x34')];if(_0x22a944[_0xe8a4('0x30')][_0xe8a4('0x40')]){_0x320a7d[_0xe8a4('0x41')]=[{'all':!![]}];}_0x320a7d=_[_0xe8a4('0x3d')]({},_0x320a7d,_0x22a944['options']);return db['ServicenowConfiguration'][_0xe8a4('0x48')](_0x320a7d)[_0xe8a4('0x27')](handleEntityNotFound(_0xd901bd,null))['then'](respondWithResult(_0xd901bd,null))[_0xe8a4('0x44')](handleError(_0xd901bd,null));};exports[_0xe8a4('0x49')]=function(_0x5c211e,_0x5dae2b){return db[_0xe8a4('0x3f')][_0xe8a4('0x49')](_0x5c211e[_0xe8a4('0x4a')],{})['then'](respondWithResult(_0x5dae2b,0xc9))[_0xe8a4('0x44')](handleError(_0x5dae2b,null));};exports[_0xe8a4('0x26')]=function(_0x281361,_0x1af142){if(_0x281361['body']['id']){delete _0x281361['body']['id'];}return db[_0xe8a4('0x3f')]['find']({'where':{'id':_0x281361['params']['id']}})['then'](handleEntityNotFound(_0x1af142,null))[_0xe8a4('0x27')](saveUpdates(_0x281361[_0xe8a4('0x4a')],null))[_0xe8a4('0x27')](respondWithResult(_0x1af142,null))['catch'](handleError(_0x1af142,null));};exports[_0xe8a4('0x28')]=function(_0x276b7c,_0x5cb422){return db[_0xe8a4('0x3f')][_0xe8a4('0x48')]({'where':{'id':_0x276b7c[_0xe8a4('0x46')]['id']}})[_0xe8a4('0x27')](handleEntityNotFound(_0x5cb422,null))[_0xe8a4('0x27')](removeEntity(_0x5cb422,null))[_0xe8a4('0x44')](handleError(_0x5cb422,null));};exports['getFields']=function(_0x4f4088,_0x4ff6a7,_0x3dafea){var _0x430dd2={};var _0x2f0f7b={};var _0x5b53ac;var _0x4f924a;return db[_0xe8a4('0x3f')]['findOne']({'where':{'id':_0x4f4088['params']['id']}})[_0xe8a4('0x27')](handleEntityNotFound(_0x4ff6a7,null))[_0xe8a4('0x27')](function(_0x96babd){if(_0x96babd){_0x5b53ac=_0x96babd;_0x2f0f7b[_0xe8a4('0x34')]=_[_0xe8a4('0x47')](db[_0xe8a4('0x4b')][_0xe8a4('0x2d')]);_0x2f0f7b[_0xe8a4('0x30')]=_[_0xe8a4('0x47')](_0x4f4088['query']);_0x2f0f7b[_0xe8a4('0x31')]=_[_0xe8a4('0x33')](_0x2f0f7b['model'],_0x2f0f7b[_0xe8a4('0x30')]);_0x430dd2['attributes']=_['intersection'](_0x2f0f7b[_0xe8a4('0x34')],qs[_0xe8a4('0x35')](_0x4f4088[_0xe8a4('0x30')]['fields']));_0x430dd2[_0xe8a4('0x32')]=_0x430dd2[_0xe8a4('0x32')][_0xe8a4('0x36')]?_0x430dd2[_0xe8a4('0x32')]:_0x2f0f7b[_0xe8a4('0x34')];_0x430dd2[_0xe8a4('0x4c')]=qs['sort'](_0x4f4088[_0xe8a4('0x30')][_0xe8a4('0x39')]);_0x430dd2['where']=qs[_0xe8a4('0x31')](_[_0xe8a4('0x3b')](_0x4f4088[_0xe8a4('0x30')],_0x2f0f7b[_0xe8a4('0x31')]));if(_0x4f4088['query']['filter']){_0x430dd2[_0xe8a4('0x3a')]=_['merge'](_0x430dd2[_0xe8a4('0x3a')],{'$or':_[_0xe8a4('0x2c')](_0x430dd2[_0xe8a4('0x32')],function(_0x45bcc6){var _0xc30870={};_0xc30870[_0x45bcc6]={'$like':'%'+_0x4f4088['query']['filter']+'%'};return _0xc30870;})});}_0x430dd2=_['merge']({},_0x430dd2,_0x4f4088[_0xe8a4('0x4d')]);return _0x5b53ac['getFields'](_0x430dd2);}})['then'](function(_0x64368c){if(_0x64368c){_0x4f924a=_0x64368c[_0xe8a4('0x36')];if(!_0x4f4088[_0xe8a4('0x30')][_0xe8a4('0x37')](_0xe8a4('0x38'))){_0x430dd2[_0xe8a4('0x21')]=qs[_0xe8a4('0x21')](_0x4f4088['query']['limit']);_0x430dd2[_0xe8a4('0x1f')]=qs[_0xe8a4('0x1f')](_0x4f4088[_0xe8a4('0x30')][_0xe8a4('0x1f')]);}return _0x5b53ac[_0xe8a4('0x4e')](_0x430dd2);}})[_0xe8a4('0x27')](function(_0x12ca3c){if(_0x12ca3c){return _0x12ca3c?{'count':_0x4f924a,'rows':_0x12ca3c}:null;}})['then'](respondWithResult(_0x4ff6a7,null))['catch'](handleError(_0x4ff6a7,null));};exports[_0xe8a4('0x4f')]=function(_0x473e2a,_0xf478e,_0x1f354e){var _0x4fabed={};var _0x4985a5={};var _0x5c2ffc;var _0x35dc29;return db[_0xe8a4('0x3f')][_0xe8a4('0x50')]({'where':{'id':_0x473e2a['params']['id']}})[_0xe8a4('0x27')](handleEntityNotFound(_0xf478e,null))[_0xe8a4('0x27')](function(_0x260472){if(_0x260472){_0x5c2ffc=_0x260472;_0x4985a5[_0xe8a4('0x34')]=_['keys'](db[_0xe8a4('0x4b')]['rawAttributes']);_0x4985a5['query']=_['keys'](_0x473e2a[_0xe8a4('0x30')]);_0x4985a5['filters']=_[_0xe8a4('0x33')](_0x4985a5[_0xe8a4('0x34')],_0x4985a5['query']);_0x4fabed[_0xe8a4('0x32')]=_[_0xe8a4('0x33')](_0x4985a5['model'],qs[_0xe8a4('0x35')](_0x473e2a[_0xe8a4('0x30')][_0xe8a4('0x35')]));_0x4fabed[_0xe8a4('0x32')]=_0x4fabed[_0xe8a4('0x32')][_0xe8a4('0x36')]?_0x4fabed['attributes']:_0x4985a5[_0xe8a4('0x34')];_0x4fabed['order']=qs[_0xe8a4('0x39')](_0x473e2a['query'][_0xe8a4('0x39')]);_0x4fabed[_0xe8a4('0x3a')]=qs[_0xe8a4('0x31')](_['pick'](_0x473e2a['query'],_0x4985a5['filters']));if(_0x473e2a[_0xe8a4('0x30')][_0xe8a4('0x3c')]){_0x4fabed[_0xe8a4('0x3a')]=_['merge'](_0x4fabed['where'],{'$or':_['map'](_0x4fabed['attributes'],function(_0x54cf07){var _0x3df583={};_0x3df583[_0x54cf07]={'$like':'%'+_0x473e2a[_0xe8a4('0x30')][_0xe8a4('0x3c')]+'%'};return _0x3df583;})});}_0x4fabed=_[_0xe8a4('0x3d')]({},_0x4fabed,_0x473e2a[_0xe8a4('0x4d')]);return _0x5c2ffc[_0xe8a4('0x4f')](_0x4fabed);}})[_0xe8a4('0x27')](function(_0x2d1bef){if(_0x2d1bef){_0x35dc29=_0x2d1bef[_0xe8a4('0x36')];if(!_0x473e2a[_0xe8a4('0x30')][_0xe8a4('0x37')](_0xe8a4('0x38'))){_0x4fabed[_0xe8a4('0x21')]=qs['limit'](_0x473e2a['query'][_0xe8a4('0x21')]);_0x4fabed[_0xe8a4('0x1f')]=qs[_0xe8a4('0x1f')](_0x473e2a[_0xe8a4('0x30')][_0xe8a4('0x1f')]);}return _0x5c2ffc['getSubjects'](_0x4fabed);}})[_0xe8a4('0x27')](function(_0xdada0a){if(_0xdada0a){return _0xdada0a?{'count':_0x35dc29,'rows':_0xdada0a}:null;}})[_0xe8a4('0x27')](respondWithResult(_0xf478e,null))[_0xe8a4('0x44')](handleError(_0xf478e,null));};exports['getDescriptions']=function(_0x1eaa67,_0x447d68,_0x722062){var _0x33b9b0={};var _0x2b567e={};var _0x45211a;var _0x2f725c;return db['ServicenowConfiguration'][_0xe8a4('0x50')]({'where':{'id':_0x1eaa67[_0xe8a4('0x46')]['id']}})[_0xe8a4('0x27')](handleEntityNotFound(_0x447d68,null))[_0xe8a4('0x27')](function(_0x4e5cef){if(_0x4e5cef){_0x45211a=_0x4e5cef;_0x2b567e[_0xe8a4('0x34')]=_[_0xe8a4('0x47')](db[_0xe8a4('0x4b')][_0xe8a4('0x2d')]);_0x2b567e[_0xe8a4('0x30')]=_['keys'](_0x1eaa67[_0xe8a4('0x30')]);_0x2b567e[_0xe8a4('0x31')]=_[_0xe8a4('0x33')](_0x2b567e['model'],_0x2b567e['query']);_0x33b9b0[_0xe8a4('0x32')]=_[_0xe8a4('0x33')](_0x2b567e['model'],qs['fields'](_0x1eaa67['query'][_0xe8a4('0x35')]));_0x33b9b0[_0xe8a4('0x32')]=_0x33b9b0[_0xe8a4('0x32')][_0xe8a4('0x36')]?_0x33b9b0[_0xe8a4('0x32')]:_0x2b567e[_0xe8a4('0x34')];_0x33b9b0[_0xe8a4('0x4c')]=qs['sort'](_0x1eaa67['query']['sort']);_0x33b9b0['where']=qs[_0xe8a4('0x31')](_[_0xe8a4('0x3b')](_0x1eaa67[_0xe8a4('0x30')],_0x2b567e[_0xe8a4('0x31')]));if(_0x1eaa67['query'][_0xe8a4('0x3c')]){_0x33b9b0['where']=_[_0xe8a4('0x3d')](_0x33b9b0['where'],{'$or':_[_0xe8a4('0x2c')](_0x33b9b0[_0xe8a4('0x32')],function(_0x18a333){var _0x37868b={};_0x37868b[_0x18a333]={'$like':'%'+_0x1eaa67[_0xe8a4('0x30')][_0xe8a4('0x3c')]+'%'};return _0x37868b;})});}_0x33b9b0=_[_0xe8a4('0x3d')]({},_0x33b9b0,_0x1eaa67[_0xe8a4('0x4d')]);return _0x45211a['getDescriptions'](_0x33b9b0);}})['then'](function(_0x58889a){if(_0x58889a){_0x2f725c=_0x58889a['length'];if(!_0x1eaa67[_0xe8a4('0x30')][_0xe8a4('0x37')](_0xe8a4('0x38'))){_0x33b9b0[_0xe8a4('0x21')]=qs[_0xe8a4('0x21')](_0x1eaa67[_0xe8a4('0x30')][_0xe8a4('0x21')]);_0x33b9b0['offset']=qs[_0xe8a4('0x1f')](_0x1eaa67['query'][_0xe8a4('0x1f')]);}return _0x45211a[_0xe8a4('0x51')](_0x33b9b0);}})[_0xe8a4('0x27')](function(_0x15caee){if(_0x15caee){return _0x15caee?{'count':_0x2f725c,'rows':_0x15caee}:null;}})[_0xe8a4('0x27')](respondWithResult(_0x447d68,null))[_0xe8a4('0x44')](handleError(_0x447d68,null));}; \ No newline at end of file +var _0x44b9=['offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','ServicenowConfiguration','include','findAll','rows','params','includeAll','find','create','body','catch','getFields','findOne','keys','ServicenowField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x391de1,_0xbd41be){var _0x13d33d=function(_0x9835d7){while(--_0x9835d7){_0x391de1['push'](_0x391de1['shift']());}};_0x13d33d(++_0xbd41be);}(_0x44b9,0x86));var _0x944b=function(_0x129db2,_0x5f2363){_0x129db2=_0x129db2-0x0;var _0x3c4776=_0x44b9[_0x129db2];return _0x3c4776;};'use strict';var emlformat=require(_0x944b('0x0'));var rimraf=require(_0x944b('0x1'));var zipdir=require(_0x944b('0x2'));var jsonpatch=require(_0x944b('0x3'));var rp=require('request-promise');var moment=require(_0x944b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x944b('0x5'));var util=require(_0x944b('0x6'));var path=require(_0x944b('0x7'));var sox=require('sox');var csv=require(_0x944b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x944b('0x9'));var _=require(_0x944b('0xa'));var squel=require(_0x944b('0xb'));var crypto=require('crypto');var jsforce=require(_0x944b('0xc'));var deskjs=require(_0x944b('0xd'));var toCsv=require(_0x944b('0x8'));var querystring=require(_0x944b('0xe'));var Papa=require('papaparse');var Redis=require(_0x944b('0xf'));var authService=require(_0x944b('0x10'));var qs=require(_0x944b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x944b('0x12'));var logger=require('../../config/logger')(_0x944b('0x13'));var utils=require(_0x944b('0x14'));var config=require(_0x944b('0x15'));var licenseUtil=require(_0x944b('0x16'));var db=require(_0x944b('0x17'))['db'];function respondWithStatusCode(_0x171234,_0x19e8f1){_0x19e8f1=_0x19e8f1||0xcc;return function(_0x2a64b4){if(_0x2a64b4){return _0x171234[_0x944b('0x18')](_0x19e8f1);}return _0x171234['status'](_0x19e8f1)[_0x944b('0x19')]();};}function respondWithResult(_0x163a3e,_0x5d2dc2){_0x5d2dc2=_0x5d2dc2||0xc8;return function(_0x120047){if(_0x120047){return _0x163a3e[_0x944b('0x1a')](_0x5d2dc2)[_0x944b('0x1b')](_0x120047);}};}function respondWithFilteredResult(_0x788cb5,_0x973763){return function(_0x210754){if(_0x210754){var _0xc75906=typeof _0x973763[_0x944b('0x1c')]===_0x944b('0x1d')&&typeof _0x973763[_0x944b('0x1e')]===_0x944b('0x1d');var _0x517e9d=_0x210754[_0x944b('0x1f')];var _0x344d51=_0xc75906?0x0:_0x973763[_0x944b('0x1c')];var _0x376d4d=_0xc75906?_0x210754[_0x944b('0x1f')]:_0x973763[_0x944b('0x1c')]+_0x973763['limit'];var _0xaeb81e;if(_0x376d4d>=_0x517e9d){_0x376d4d=_0x517e9d;_0xaeb81e=0xc8;}else{_0xaeb81e=0xce;}_0x788cb5[_0x944b('0x1a')](_0xaeb81e);return _0x788cb5[_0x944b('0x20')]('Content-Range',_0x344d51+'-'+_0x376d4d+'/'+_0x517e9d)['json'](_0x210754);}return null;};}function patchUpdates(_0x10b3d7){return function(_0x35d37b){try{jsonpatch[_0x944b('0x21')](_0x35d37b,_0x10b3d7,!![]);}catch(_0x366948){return BPromise[_0x944b('0x22')](_0x366948);}return _0x35d37b[_0x944b('0x23')]();};}function saveUpdates(_0xcdd8b0,_0x191dae){return function(_0x555964){if(_0x555964){return _0x555964[_0x944b('0x24')](_0xcdd8b0)[_0x944b('0x25')](function(_0xb9c97a){return _0xb9c97a;});}return null;};}function removeEntity(_0x4f3e83,_0x5aef23){return function(_0x5cf7ea){if(_0x5cf7ea){return _0x5cf7ea[_0x944b('0x26')]()['then'](function(){_0x4f3e83['status'](0xcc)[_0x944b('0x19')]();});}};}function handleEntityNotFound(_0x5d3a52,_0x427f72){return function(_0x58cb93){if(!_0x58cb93){_0x5d3a52[_0x944b('0x18')](0x194);}return _0x58cb93;};}function handleError(_0x13fd3a,_0x41cf7d){_0x41cf7d=_0x41cf7d||0x1f4;return function(_0x331f36){logger[_0x944b('0x27')](_0x331f36['stack']);if(_0x331f36[_0x944b('0x28')]){delete _0x331f36[_0x944b('0x28')];}_0x13fd3a[_0x944b('0x1a')](_0x41cf7d)[_0x944b('0x29')](_0x331f36);};}exports[_0x944b('0x2a')]=function(_0x2a4148,_0x43c01a){var _0x420ead={},_0x202baa={},_0xa3d2c9={'count':0x0,'rows':[]};var _0xbd38b6=_['map'](db['ServicenowConfiguration'][_0x944b('0x2b')],function(_0x40b0cb){return{'name':_0x40b0cb[_0x944b('0x2c')],'type':_0x40b0cb[_0x944b('0x2d')][_0x944b('0x2e')]};});_0x202baa[_0x944b('0x2f')]=_[_0x944b('0x30')](_0xbd38b6,'name');_0x202baa[_0x944b('0x31')]=_['keys'](_0x2a4148[_0x944b('0x31')]);_0x202baa['filters']=_[_0x944b('0x32')](_0x202baa[_0x944b('0x2f')],_0x202baa['query']);_0x420ead['attributes']=_[_0x944b('0x32')](_0x202baa[_0x944b('0x2f')],qs[_0x944b('0x33')](_0x2a4148[_0x944b('0x31')][_0x944b('0x33')]));_0x420ead[_0x944b('0x34')]=_0x420ead[_0x944b('0x34')][_0x944b('0x35')]?_0x420ead[_0x944b('0x34')]:_0x202baa['model'];if(!_0x2a4148['query'][_0x944b('0x36')](_0x944b('0x37'))){_0x420ead[_0x944b('0x1e')]=qs[_0x944b('0x1e')](_0x2a4148[_0x944b('0x31')][_0x944b('0x1e')]);_0x420ead['offset']=qs[_0x944b('0x1c')](_0x2a4148[_0x944b('0x31')][_0x944b('0x1c')]);}_0x420ead[_0x944b('0x38')]=qs[_0x944b('0x39')](_0x2a4148[_0x944b('0x31')][_0x944b('0x39')]);_0x420ead[_0x944b('0x3a')]=qs[_0x944b('0x3b')](_[_0x944b('0x3c')](_0x2a4148[_0x944b('0x31')],_0x202baa['filters']),_0xbd38b6);if(_0x2a4148[_0x944b('0x31')][_0x944b('0x3d')]){_0x420ead[_0x944b('0x3a')]=_[_0x944b('0x3e')](_0x420ead[_0x944b('0x3a')],{'$or':_['map'](_0xbd38b6,function(_0xd4d3a4){if(_0xd4d3a4[_0x944b('0x2d')]!==_0x944b('0x3f')){var _0x2e1b3a={};_0x2e1b3a[_0xd4d3a4[_0x944b('0x28')]]={'$like':'%'+_0x2a4148['query'][_0x944b('0x3d')]+'%'};return _0x2e1b3a;}})});}_0x420ead=_[_0x944b('0x3e')]({},_0x420ead,_0x2a4148[_0x944b('0x40')]);var _0x2e49d6={'where':_0x420ead[_0x944b('0x3a')]};return db[_0x944b('0x41')][_0x944b('0x1f')](_0x2e49d6)[_0x944b('0x25')](function(_0x192beb){_0xa3d2c9[_0x944b('0x1f')]=_0x192beb;if(_0x2a4148['query']['includeAll']){_0x420ead[_0x944b('0x42')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x944b('0x43')](_0x420ead);})[_0x944b('0x25')](function(_0x5995a2){_0xa3d2c9[_0x944b('0x44')]=_0x5995a2;return _0xa3d2c9;})['then'](respondWithFilteredResult(_0x43c01a,_0x420ead))['catch'](handleError(_0x43c01a,null));};exports['show']=function(_0x5806c6,_0x184a77){var _0x239921={'raw':![],'where':{'id':_0x5806c6[_0x944b('0x45')]['id']}},_0x6859f1={};_0x6859f1[_0x944b('0x2f')]=_['keys'](db[_0x944b('0x41')]['rawAttributes']);_0x6859f1[_0x944b('0x31')]=_['keys'](_0x5806c6[_0x944b('0x31')]);_0x6859f1['filters']=_[_0x944b('0x32')](_0x6859f1[_0x944b('0x2f')],_0x6859f1[_0x944b('0x31')]);_0x239921[_0x944b('0x34')]=_[_0x944b('0x32')](_0x6859f1[_0x944b('0x2f')],qs[_0x944b('0x33')](_0x5806c6[_0x944b('0x31')][_0x944b('0x33')]));_0x239921['attributes']=_0x239921[_0x944b('0x34')]['length']?_0x239921[_0x944b('0x34')]:_0x6859f1[_0x944b('0x2f')];if(_0x5806c6[_0x944b('0x31')][_0x944b('0x46')]){_0x239921[_0x944b('0x42')]=[{'all':!![]}];}_0x239921=_[_0x944b('0x3e')]({},_0x239921,_0x5806c6[_0x944b('0x40')]);return db[_0x944b('0x41')][_0x944b('0x47')](_0x239921)[_0x944b('0x25')](handleEntityNotFound(_0x184a77,null))[_0x944b('0x25')](respondWithResult(_0x184a77,null))['catch'](handleError(_0x184a77,null));};exports[_0x944b('0x48')]=function(_0x294013,_0x575151){return db[_0x944b('0x41')][_0x944b('0x48')](_0x294013[_0x944b('0x49')],{})[_0x944b('0x25')](respondWithResult(_0x575151,0xc9))[_0x944b('0x4a')](handleError(_0x575151,null));};exports[_0x944b('0x24')]=function(_0x1c2ee3,_0x33ab66){if(_0x1c2ee3['body']['id']){delete _0x1c2ee3[_0x944b('0x49')]['id'];}return db[_0x944b('0x41')][_0x944b('0x47')]({'where':{'id':_0x1c2ee3[_0x944b('0x45')]['id']}})[_0x944b('0x25')](handleEntityNotFound(_0x33ab66,null))[_0x944b('0x25')](saveUpdates(_0x1c2ee3[_0x944b('0x49')],null))[_0x944b('0x25')](respondWithResult(_0x33ab66,null))[_0x944b('0x4a')](handleError(_0x33ab66,null));};exports[_0x944b('0x26')]=function(_0x14cfd5,_0x5a9849){return db[_0x944b('0x41')][_0x944b('0x47')]({'where':{'id':_0x14cfd5['params']['id']}})[_0x944b('0x25')](handleEntityNotFound(_0x5a9849,null))[_0x944b('0x25')](removeEntity(_0x5a9849,null))[_0x944b('0x4a')](handleError(_0x5a9849,null));};exports[_0x944b('0x4b')]=function(_0x5c842f,_0xa6d7b2,_0x52652e){var _0x9ef2d1={};var _0x29b409={};var _0x3e3a8c;var _0x108ba6;return db['ServicenowConfiguration'][_0x944b('0x4c')]({'where':{'id':_0x5c842f[_0x944b('0x45')]['id']}})[_0x944b('0x25')](handleEntityNotFound(_0xa6d7b2,null))[_0x944b('0x25')](function(_0x5acac1){if(_0x5acac1){_0x3e3a8c=_0x5acac1;_0x29b409[_0x944b('0x2f')]=_[_0x944b('0x4d')](db[_0x944b('0x4e')][_0x944b('0x2b')]);_0x29b409[_0x944b('0x31')]=_[_0x944b('0x4d')](_0x5c842f['query']);_0x29b409[_0x944b('0x3b')]=_[_0x944b('0x32')](_0x29b409[_0x944b('0x2f')],_0x29b409[_0x944b('0x31')]);_0x9ef2d1[_0x944b('0x34')]=_[_0x944b('0x32')](_0x29b409[_0x944b('0x2f')],qs[_0x944b('0x33')](_0x5c842f[_0x944b('0x31')]['fields']));_0x9ef2d1[_0x944b('0x34')]=_0x9ef2d1[_0x944b('0x34')][_0x944b('0x35')]?_0x9ef2d1[_0x944b('0x34')]:_0x29b409[_0x944b('0x2f')];_0x9ef2d1['order']=qs[_0x944b('0x39')](_0x5c842f[_0x944b('0x31')][_0x944b('0x39')]);_0x9ef2d1['where']=qs[_0x944b('0x3b')](_['pick'](_0x5c842f['query'],_0x29b409[_0x944b('0x3b')]));if(_0x5c842f[_0x944b('0x31')][_0x944b('0x3d')]){_0x9ef2d1[_0x944b('0x3a')]=_[_0x944b('0x3e')](_0x9ef2d1['where'],{'$or':_[_0x944b('0x30')](_0x9ef2d1[_0x944b('0x34')],function(_0x471642){var _0x13eac8={};_0x13eac8[_0x471642]={'$like':'%'+_0x5c842f[_0x944b('0x31')][_0x944b('0x3d')]+'%'};return _0x13eac8;})});}_0x9ef2d1=_['merge']({},_0x9ef2d1,_0x5c842f['options']);return _0x3e3a8c[_0x944b('0x4b')](_0x9ef2d1);}})[_0x944b('0x25')](function(_0x3f84d8){if(_0x3f84d8){_0x108ba6=_0x3f84d8[_0x944b('0x35')];if(!_0x5c842f[_0x944b('0x31')][_0x944b('0x36')]('nolimit')){_0x9ef2d1[_0x944b('0x1e')]=qs[_0x944b('0x1e')](_0x5c842f[_0x944b('0x31')]['limit']);_0x9ef2d1['offset']=qs[_0x944b('0x1c')](_0x5c842f[_0x944b('0x31')][_0x944b('0x1c')]);}return _0x3e3a8c[_0x944b('0x4b')](_0x9ef2d1);}})['then'](function(_0x1a99c6){if(_0x1a99c6){return _0x1a99c6?{'count':_0x108ba6,'rows':_0x1a99c6}:null;}})[_0x944b('0x25')](respondWithResult(_0xa6d7b2,null))['catch'](handleError(_0xa6d7b2,null));};exports[_0x944b('0x4f')]=function(_0x1f9e85,_0xa4208d,_0x51c6ff){var _0x3c624f={};var _0x569830={};var _0x3ca945;var _0x2d9412;return db['ServicenowConfiguration'][_0x944b('0x4c')]({'where':{'id':_0x1f9e85[_0x944b('0x45')]['id']}})[_0x944b('0x25')](handleEntityNotFound(_0xa4208d,null))['then'](function(_0x1687c0){if(_0x1687c0){_0x3ca945=_0x1687c0;_0x569830['model']=_[_0x944b('0x4d')](db['ServicenowField']['rawAttributes']);_0x569830['query']=_[_0x944b('0x4d')](_0x1f9e85[_0x944b('0x31')]);_0x569830[_0x944b('0x3b')]=_[_0x944b('0x32')](_0x569830[_0x944b('0x2f')],_0x569830[_0x944b('0x31')]);_0x3c624f[_0x944b('0x34')]=_[_0x944b('0x32')](_0x569830[_0x944b('0x2f')],qs[_0x944b('0x33')](_0x1f9e85[_0x944b('0x31')][_0x944b('0x33')]));_0x3c624f[_0x944b('0x34')]=_0x3c624f[_0x944b('0x34')][_0x944b('0x35')]?_0x3c624f[_0x944b('0x34')]:_0x569830['model'];_0x3c624f[_0x944b('0x38')]=qs[_0x944b('0x39')](_0x1f9e85[_0x944b('0x31')][_0x944b('0x39')]);_0x3c624f[_0x944b('0x3a')]=qs[_0x944b('0x3b')](_['pick'](_0x1f9e85[_0x944b('0x31')],_0x569830[_0x944b('0x3b')]));if(_0x1f9e85['query'][_0x944b('0x3d')]){_0x3c624f['where']=_[_0x944b('0x3e')](_0x3c624f[_0x944b('0x3a')],{'$or':_['map'](_0x3c624f[_0x944b('0x34')],function(_0x129101){var _0x341e9b={};_0x341e9b[_0x129101]={'$like':'%'+_0x1f9e85[_0x944b('0x31')][_0x944b('0x3d')]+'%'};return _0x341e9b;})});}_0x3c624f=_[_0x944b('0x3e')]({},_0x3c624f,_0x1f9e85['options']);return _0x3ca945[_0x944b('0x4f')](_0x3c624f);}})[_0x944b('0x25')](function(_0x5f5125){if(_0x5f5125){_0x2d9412=_0x5f5125['length'];if(!_0x1f9e85[_0x944b('0x31')][_0x944b('0x36')](_0x944b('0x37'))){_0x3c624f['limit']=qs[_0x944b('0x1e')](_0x1f9e85[_0x944b('0x31')][_0x944b('0x1e')]);_0x3c624f[_0x944b('0x1c')]=qs[_0x944b('0x1c')](_0x1f9e85[_0x944b('0x31')][_0x944b('0x1c')]);}return _0x3ca945['getSubjects'](_0x3c624f);}})[_0x944b('0x25')](function(_0x5f4876){if(_0x5f4876){return _0x5f4876?{'count':_0x2d9412,'rows':_0x5f4876}:null;}})[_0x944b('0x25')](respondWithResult(_0xa4208d,null))[_0x944b('0x4a')](handleError(_0xa4208d,null));};exports[_0x944b('0x50')]=function(_0x173852,_0x22d055,_0x2ec8e3){var _0x29c307={};var _0x4493a2={};var _0x5a1cc4;var _0xaa3a9;return db[_0x944b('0x41')][_0x944b('0x4c')]({'where':{'id':_0x173852[_0x944b('0x45')]['id']}})[_0x944b('0x25')](handleEntityNotFound(_0x22d055,null))['then'](function(_0x4a2e3e){if(_0x4a2e3e){_0x5a1cc4=_0x4a2e3e;_0x4493a2['model']=_['keys'](db['ServicenowField'][_0x944b('0x2b')]);_0x4493a2['query']=_[_0x944b('0x4d')](_0x173852[_0x944b('0x31')]);_0x4493a2[_0x944b('0x3b')]=_[_0x944b('0x32')](_0x4493a2[_0x944b('0x2f')],_0x4493a2['query']);_0x29c307[_0x944b('0x34')]=_['intersection'](_0x4493a2[_0x944b('0x2f')],qs[_0x944b('0x33')](_0x173852[_0x944b('0x31')]['fields']));_0x29c307[_0x944b('0x34')]=_0x29c307['attributes'][_0x944b('0x35')]?_0x29c307['attributes']:_0x4493a2[_0x944b('0x2f')];_0x29c307[_0x944b('0x38')]=qs[_0x944b('0x39')](_0x173852[_0x944b('0x31')][_0x944b('0x39')]);_0x29c307[_0x944b('0x3a')]=qs[_0x944b('0x3b')](_[_0x944b('0x3c')](_0x173852['query'],_0x4493a2['filters']));if(_0x173852['query'][_0x944b('0x3d')]){_0x29c307['where']=_[_0x944b('0x3e')](_0x29c307[_0x944b('0x3a')],{'$or':_[_0x944b('0x30')](_0x29c307[_0x944b('0x34')],function(_0x16b5cc){var _0x4e8722={};_0x4e8722[_0x16b5cc]={'$like':'%'+_0x173852['query'][_0x944b('0x3d')]+'%'};return _0x4e8722;})});}_0x29c307=_['merge']({},_0x29c307,_0x173852['options']);return _0x5a1cc4[_0x944b('0x50')](_0x29c307);}})[_0x944b('0x25')](function(_0x402365){if(_0x402365){_0xaa3a9=_0x402365['length'];if(!_0x173852[_0x944b('0x31')][_0x944b('0x36')]('nolimit')){_0x29c307[_0x944b('0x1e')]=qs[_0x944b('0x1e')](_0x173852[_0x944b('0x31')][_0x944b('0x1e')]);_0x29c307['offset']=qs[_0x944b('0x1c')](_0x173852[_0x944b('0x31')][_0x944b('0x1c')]);}return _0x5a1cc4['getDescriptions'](_0x29c307);}})['then'](function(_0x201921){if(_0x201921){return _0x201921?{'count':_0xaa3a9,'rows':_0x201921}:null;}})[_0x944b('0x25')](respondWithResult(_0x22d055,null))[_0x944b('0x4a')](handleError(_0x22d055,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index b790665..a94117e 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 _0x4e7b=['exports','define','ServicenowConfiguration','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3108d5,_0x43e203){var _0x56374c=function(_0x2ee39a){while(--_0x2ee39a){_0x3108d5['push'](_0x3108d5['shift']());}};_0x56374c(++_0x43e203);}(_0x4e7b,0xf3));var _0xb4e7=function(_0x132c72,_0x18c286){_0x132c72=_0x132c72-0x0;var _0x237e53=_0x4e7b[_0x132c72];return _0x237e53;};'use strict';var _=require(_0xb4e7('0x0'));var util=require(_0xb4e7('0x1'));var logger=require('../../config/logger')(_0xb4e7('0x2'));var moment=require('moment');var BPromise=require(_0xb4e7('0x3'));var rp=require(_0xb4e7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb4e7('0x5'));var config=require(_0xb4e7('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xb4e7('0x7')]=function(_0x3351aa,_0x271dbf){return _0x3351aa[_0xb4e7('0x8')](_0xb4e7('0x9'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x135b=['request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','bluebird'];(function(_0x2373f3,_0x41ee8b){var _0x155c41=function(_0x1e860a){while(--_0x1e860a){_0x2373f3['push'](_0x2373f3['shift']());}};_0x155c41(++_0x41ee8b);}(_0x135b,0xaf));var _0xb135=function(_0x301ca3,_0x4233c5){_0x301ca3=_0x301ca3-0x0;var _0x131292=_0x135b[_0x301ca3];return _0x131292;};'use strict';var _=require(_0xb135('0x0'));var util=require(_0xb135('0x1'));var logger=require(_0xb135('0x2'))(_0xb135('0x3'));var moment=require('moment');var BPromise=require(_0xb135('0x4'));var rp=require(_0xb135('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb135('0x6'));var config=require(_0xb135('0x7'));var attributes=require(_0xb135('0x8'));module['exports']=function(_0x51a09c,_0x5b96fe){return _0x51a09c[_0xb135('0x9')](_0xb135('0xa'),attributes,{'tableName':_0xb135('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 86ca9d1..643cc3a 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 _0x1ccb=['result','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x3f7e8b,_0x7291d1){var _0x4eb892=function(_0x4ed54e){while(--_0x4ed54e){_0x3f7e8b['push'](_0x3f7e8b['shift']());}};_0x4eb892(++_0x7291d1);}(_0x1ccb,0x105));var _0xb1cc=function(_0x4552a7,_0x180e56){_0x4552a7=_0x4552a7-0x0;var _0x130232=_0x1ccb[_0x4552a7];return _0x130232;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb1cc('0x0'));var BPromise=require(_0xb1cc('0x1'));var rs=require(_0xb1cc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb1cc('0x3'))['db'];var utils=require(_0xb1cc('0x4'));var logger=require(_0xb1cc('0x5'))('rpc');var config=require(_0xb1cc('0x6'));var jayson=require(_0xb1cc('0x7'));var client=jayson[_0xb1cc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5062c1,_0xba68c9,_0x8a7855){return new BPromise(function(_0x1028d5,_0x173bbd){return client[_0xb1cc('0x9')](_0x5062c1,_0x8a7855)[_0xb1cc('0xa')](function(_0x33d3a3){logger['info'](_0xb1cc('0xb'),_0xba68c9,_0xb1cc('0xc'));logger[_0xb1cc('0xd')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0xba68c9,_0xb1cc('0xc'),JSON[_0xb1cc('0xe')](_0x33d3a3));if(_0x33d3a3[_0xb1cc('0xf')]){if(_0x33d3a3[_0xb1cc('0xf')][_0xb1cc('0x10')]===0x1f4){logger[_0xb1cc('0xf')](_0xb1cc('0xb'),_0xba68c9,_0x33d3a3[_0xb1cc('0xf')][_0xb1cc('0x11')]);return _0x173bbd(_0x33d3a3[_0xb1cc('0xf')][_0xb1cc('0x11')]);}logger[_0xb1cc('0xf')](_0xb1cc('0xb'),_0xba68c9,_0x33d3a3['error'][_0xb1cc('0x11')]);return _0x1028d5(_0x33d3a3['error'][_0xb1cc('0x11')]);}else{logger[_0xb1cc('0x12')](_0xb1cc('0xb'),_0xba68c9,_0xb1cc('0xc'));_0x1028d5(_0x33d3a3[_0xb1cc('0x13')][_0xb1cc('0x11')]);}})['catch'](function(_0x232ad3){logger[_0xb1cc('0xf')](_0xb1cc('0xb'),_0xba68c9,_0x232ad3);_0x173bbd(_0x232ad3);});});} \ No newline at end of file +var _0x83ff=['http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x21c8a9,_0x5687f4){var _0x1f8a72=function(_0x54f365){while(--_0x54f365){_0x21c8a9['push'](_0x21c8a9['shift']());}};_0x1f8a72(++_0x5687f4);}(_0x83ff,0x7c));var _0xf83f=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x83ff[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0xf83f('0x0'));var util=require(_0xf83f('0x1'));var moment=require(_0xf83f('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(_0xf83f('0x3'));var logger=require(_0xf83f('0x4'))('rpc');var config=require(_0xf83f('0x5'));var jayson=require(_0xf83f('0x6'));var client=jayson[_0xf83f('0x7')][_0xf83f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42e2ab,_0x4bbe90,_0x203313){return new BPromise(function(_0x47a50f,_0x4cb8a3){return client[_0xf83f('0x9')](_0x42e2ab,_0x203313)[_0xf83f('0xa')](function(_0x4433ad){logger[_0xf83f('0xb')](_0xf83f('0xc'),_0x4bbe90,_0xf83f('0xd'));logger[_0xf83f('0xe')](_0xf83f('0xf'),_0x4bbe90,_0xf83f('0xd'),JSON[_0xf83f('0x10')](_0x4433ad));if(_0x4433ad[_0xf83f('0x11')]){if(_0x4433ad[_0xf83f('0x11')][_0xf83f('0x12')]===0x1f4){logger['error'](_0xf83f('0xc'),_0x4bbe90,_0x4433ad[_0xf83f('0x11')][_0xf83f('0x13')]);return _0x4cb8a3(_0x4433ad[_0xf83f('0x11')]['message']);}logger[_0xf83f('0x11')](_0xf83f('0xc'),_0x4bbe90,_0x4433ad[_0xf83f('0x11')][_0xf83f('0x13')]);return _0x47a50f(_0x4433ad['error']['message']);}else{logger[_0xf83f('0xb')](_0xf83f('0xc'),_0x4bbe90,_0xf83f('0xd'));_0x47a50f(_0x4433ad[_0xf83f('0x14')][_0xf83f('0x13')]);}})[_0xf83f('0x15')](function(_0x42d24a){logger['error'](_0xf83f('0xc'),_0x4bbe90,_0x42d24a);_0x4cb8a3(_0x42d24a);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index c69c346..f32dcc8 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 _0x9326=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','create','put','delete','util','path'];(function(_0x21ecf5,_0xf4a39){var _0xbe05cd=function(_0x3210ab){while(--_0x3210ab){_0x21ecf5['push'](_0x21ecf5['shift']());}};_0xbe05cd(++_0xf4a39);}(_0x9326,0x12e));var _0x6932=function(_0x569fef,_0x49c37a){_0x569fef=_0x569fef-0x0;var _0x11f20b=_0x9326[_0x569fef];return _0x11f20b;};'use strict';var multer=require('multer');var util=require(_0x6932('0x0'));var path=require(_0x6932('0x1'));var timeout=require(_0x6932('0x2'));var express=require(_0x6932('0x3'));var router=express[_0x6932('0x4')]();var fs_extra=require(_0x6932('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6932('0x6'));var config=require('../../config/environment');var controller=require(_0x6932('0x7'));router[_0x6932('0x8')]('/',auth[_0x6932('0x9')](),controller[_0x6932('0xa')]);router['get'](_0x6932('0xb'),auth['isAuthenticated'](),controller[_0x6932('0xc')]);router['post']('/',auth[_0x6932('0x9')](),controller[_0x6932('0xd')]);router[_0x6932('0xe')](_0x6932('0xb'),auth[_0x6932('0x9')](),controller['update']);router[_0x6932('0xf')](_0x6932('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3813=['show','post','create','delete','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x3813,0xd2));var _0x3381=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3813[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3381('0x0'));var timeout=require(_0x3381('0x1'));var express=require(_0x3381('0x2'));var router=express[_0x3381('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3381('0x4'));var config=require(_0x3381('0x5'));var controller=require(_0x3381('0x6'));router[_0x3381('0x7')]('/',auth[_0x3381('0x8')](),controller[_0x3381('0x9')]);router['get'](_0x3381('0xa'),auth[_0x3381('0x8')](),controller[_0x3381('0xb')]);router[_0x3381('0xc')]('/',auth['isAuthenticated'](),controller[_0x3381('0xd')]);router['put'](_0x3381('0xa'),auth[_0x3381('0x8')](),controller['update']);router[_0x3381('0xe')]('/:id',auth[_0x3381('0x8')](),controller[_0x3381('0xf')]);module[_0x3381('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 4a1dfbc..1187555 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 _0x724a=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x427352,_0x1bce61){var _0x23e0e6=function(_0x2a42a9){while(--_0x2a42a9){_0x427352['push'](_0x427352['shift']());}};_0x23e0e6(++_0x1bce61);}(_0x724a,0xe1));var _0xa724=function(_0x38c699,_0x56fea7){_0x38c699=_0x38c699-0x0;var _0x3b1ded=_0x724a[_0x38c699];return _0x3b1ded;};'use strict';var Sequelize=require(_0xa724('0x0'));module[_0xa724('0x1')]={'type':{'type':Sequelize[_0xa724('0x2')](_0xa724('0x3'),_0xa724('0x4'),_0xa724('0x5'),_0xa724('0x6'),_0xa724('0x7')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa724('0x8')]},'keyType':{'type':Sequelize[_0xa724('0x2')]('string','variable',_0xa724('0x5'))},'keyContent':{'type':Sequelize[_0xa724('0x8')]},'idField':{'type':Sequelize[_0xa724('0x8')]},'nameField':{'type':Sequelize[_0xa724('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x90cc=['BOOLEAN','exports','ENUM','string','customVariable','keyValue','STRING','variable'];(function(_0x5e7b10,_0x14c110){var _0x56712d=function(_0x2bb04e){while(--_0x2bb04e){_0x5e7b10['push'](_0x5e7b10['shift']());}};_0x56712d(++_0x14c110);}(_0x90cc,0xa1));var _0xc90c=function(_0x409e99,_0x957631){_0x409e99=_0x409e99-0x0;var _0x124641=_0x90cc[_0x409e99];return _0x124641;};'use strict';var Sequelize=require('sequelize');module[_0xc90c('0x0')]={'type':{'type':Sequelize[_0xc90c('0x1')](_0xc90c('0x2'),'variable',_0xc90c('0x3'),_0xc90c('0x4'),'picklist'),'defaultValue':_0xc90c('0x2')},'content':{'type':Sequelize[_0xc90c('0x5')]},'key':{'type':Sequelize[_0xc90c('0x5')]},'keyType':{'type':Sequelize[_0xc90c('0x1')](_0xc90c('0x2'),_0xc90c('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xc90c('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc90c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc90c('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 94ffa33..8da36ee 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 _0x58ba=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowField','includeAll','include','findAll','rows','catch','show','params','create','update','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x41d9d3,_0x4604f0){var _0x41d714=function(_0x16bf74){while(--_0x16bf74){_0x41d9d3['push'](_0x41d9d3['shift']());}};_0x41d714(++_0x4604f0);}(_0x58ba,0x1c8));var _0xa58b=function(_0x2b6448,_0x4fa425){_0x2b6448=_0x2b6448-0x0;var _0x5cc0f1=_0x58ba[_0x2b6448];return _0x5cc0f1;};'use strict';var emlformat=require(_0xa58b('0x0'));var rimraf=require(_0xa58b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa58b('0x2'));var rp=require(_0xa58b('0x3'));var moment=require(_0xa58b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa58b('0x5'));var util=require(_0xa58b('0x6'));var path=require(_0xa58b('0x7'));var sox=require(_0xa58b('0x8'));var csv=require(_0xa58b('0x9'));var ejs=require(_0xa58b('0xa'));var fs=require('fs');var fs_extra=require(_0xa58b('0xb'));var _=require(_0xa58b('0xc'));var squel=require(_0xa58b('0xd'));var crypto=require(_0xa58b('0xe'));var jsforce=require(_0xa58b('0xf'));var deskjs=require(_0xa58b('0x10'));var toCsv=require(_0xa58b('0x9'));var querystring=require('querystring');var Papa=require(_0xa58b('0x11'));var Redis=require(_0xa58b('0x12'));var authService=require(_0xa58b('0x13'));var qs=require(_0xa58b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa58b('0x15'));var logger=require(_0xa58b('0x16'))('api');var utils=require(_0xa58b('0x17'));var config=require(_0xa58b('0x18'));var licenseUtil=require(_0xa58b('0x19'));var db=require(_0xa58b('0x1a'))['db'];function respondWithStatusCode(_0xd74e22,_0xa7f01){_0xa7f01=_0xa7f01||0xcc;return function(_0x27d1e1){if(_0x27d1e1){return _0xd74e22[_0xa58b('0x1b')](_0xa7f01);}return _0xd74e22[_0xa58b('0x1c')](_0xa7f01)[_0xa58b('0x1d')]();};}function respondWithResult(_0x2ed87b,_0x2b3097){_0x2b3097=_0x2b3097||0xc8;return function(_0x1ed06b){if(_0x1ed06b){return _0x2ed87b[_0xa58b('0x1c')](_0x2b3097)['json'](_0x1ed06b);}};}function respondWithFilteredResult(_0x55638d,_0x5a63a8){return function(_0x1048a0){if(_0x1048a0){var _0x3fe6c0=typeof _0x5a63a8[_0xa58b('0x1e')]===_0xa58b('0x1f')&&typeof _0x5a63a8[_0xa58b('0x20')]===_0xa58b('0x1f');var _0x524736=_0x1048a0[_0xa58b('0x21')];var _0x4ebe8c=_0x3fe6c0?0x0:_0x5a63a8['offset'];var _0x55a29c=_0x3fe6c0?_0x1048a0['count']:_0x5a63a8['offset']+_0x5a63a8[_0xa58b('0x20')];var _0x391306;if(_0x55a29c>=_0x524736){_0x55a29c=_0x524736;_0x391306=0xc8;}else{_0x391306=0xce;}_0x55638d[_0xa58b('0x1c')](_0x391306);return _0x55638d['set'](_0xa58b('0x22'),_0x4ebe8c+'-'+_0x55a29c+'/'+_0x524736)[_0xa58b('0x23')](_0x1048a0);}return null;};}function patchUpdates(_0x58f772){return function(_0x21b1dd){try{jsonpatch[_0xa58b('0x24')](_0x21b1dd,_0x58f772,!![]);}catch(_0x4b3ec6){return BPromise[_0xa58b('0x25')](_0x4b3ec6);}return _0x21b1dd[_0xa58b('0x26')]();};}function saveUpdates(_0xe464c4,_0x4b7567){return function(_0x2fd644){if(_0x2fd644){return _0x2fd644['update'](_0xe464c4)[_0xa58b('0x27')](function(_0x57ef5e){return _0x57ef5e;});}return null;};}function removeEntity(_0x2a1d26,_0xb32bd){return function(_0x12800f){if(_0x12800f){return _0x12800f[_0xa58b('0x28')]()[_0xa58b('0x27')](function(){_0x2a1d26['status'](0xcc)[_0xa58b('0x1d')]();});}};}function handleEntityNotFound(_0x2ab722,_0x17d1eb){return function(_0x4b0806){if(!_0x4b0806){_0x2ab722[_0xa58b('0x1b')](0x194);}return _0x4b0806;};}function handleError(_0x43f1fb,_0x22d7e6){_0x22d7e6=_0x22d7e6||0x1f4;return function(_0x27acd2){logger[_0xa58b('0x29')](_0x27acd2['stack']);if(_0x27acd2['name']){delete _0x27acd2[_0xa58b('0x2a')];}_0x43f1fb['status'](_0x22d7e6)[_0xa58b('0x2b')](_0x27acd2);};}exports[_0xa58b('0x2c')]=function(_0x2408a9,_0x1603c4){var _0x3a173e={},_0x1639ee={},_0x211fdf={'count':0x0,'rows':[]};var _0x334f5c=_[_0xa58b('0x2d')](db['ServicenowField'][_0xa58b('0x2e')],function(_0x10ca07){return{'name':_0x10ca07[_0xa58b('0x2f')],'type':_0x10ca07[_0xa58b('0x30')][_0xa58b('0x31')]};});_0x1639ee[_0xa58b('0x32')]=_[_0xa58b('0x2d')](_0x334f5c,_0xa58b('0x2a'));_0x1639ee[_0xa58b('0x33')]=_[_0xa58b('0x34')](_0x2408a9[_0xa58b('0x33')]);_0x1639ee[_0xa58b('0x35')]=_[_0xa58b('0x36')](_0x1639ee[_0xa58b('0x32')],_0x1639ee['query']);_0x3a173e['attributes']=_[_0xa58b('0x36')](_0x1639ee[_0xa58b('0x32')],qs[_0xa58b('0x37')](_0x2408a9['query'][_0xa58b('0x37')]));_0x3a173e[_0xa58b('0x38')]=_0x3a173e[_0xa58b('0x38')][_0xa58b('0x39')]?_0x3a173e['attributes']:_0x1639ee[_0xa58b('0x32')];if(!_0x2408a9[_0xa58b('0x33')][_0xa58b('0x3a')]('nolimit')){_0x3a173e[_0xa58b('0x20')]=qs['limit'](_0x2408a9['query'][_0xa58b('0x20')]);_0x3a173e['offset']=qs['offset'](_0x2408a9[_0xa58b('0x33')][_0xa58b('0x1e')]);}_0x3a173e[_0xa58b('0x3b')]=qs['sort'](_0x2408a9['query'][_0xa58b('0x3c')]);_0x3a173e[_0xa58b('0x3d')]=qs[_0xa58b('0x35')](_[_0xa58b('0x3e')](_0x2408a9[_0xa58b('0x33')],_0x1639ee['filters']),_0x334f5c);if(_0x2408a9[_0xa58b('0x33')][_0xa58b('0x3f')]){_0x3a173e[_0xa58b('0x3d')]=_[_0xa58b('0x40')](_0x3a173e[_0xa58b('0x3d')],{'$or':_[_0xa58b('0x2d')](_0x334f5c,function(_0x25eb51){if(_0x25eb51['type']!==_0xa58b('0x41')){var _0x1c227f={};_0x1c227f[_0x25eb51[_0xa58b('0x2a')]]={'$like':'%'+_0x2408a9['query'][_0xa58b('0x3f')]+'%'};return _0x1c227f;}})});}_0x3a173e=_[_0xa58b('0x40')]({},_0x3a173e,_0x2408a9[_0xa58b('0x42')]);var _0x33674e={'where':_0x3a173e[_0xa58b('0x3d')]};return db[_0xa58b('0x43')]['count'](_0x33674e)[_0xa58b('0x27')](function(_0x71efbc){_0x211fdf[_0xa58b('0x21')]=_0x71efbc;if(_0x2408a9[_0xa58b('0x33')][_0xa58b('0x44')]){_0x3a173e[_0xa58b('0x45')]=[{'all':!![]}];}return db['ServicenowField'][_0xa58b('0x46')](_0x3a173e);})[_0xa58b('0x27')](function(_0x2f06be){_0x211fdf[_0xa58b('0x47')]=_0x2f06be;return _0x211fdf;})[_0xa58b('0x27')](respondWithFilteredResult(_0x1603c4,_0x3a173e))[_0xa58b('0x48')](handleError(_0x1603c4,null));};exports[_0xa58b('0x49')]=function(_0x2baab2,_0x3bc295){var _0x835e71={'raw':!![],'where':{'id':_0x2baab2[_0xa58b('0x4a')]['id']}},_0x11bb0b={};_0x11bb0b[_0xa58b('0x32')]=_[_0xa58b('0x34')](db['ServicenowField'][_0xa58b('0x2e')]);_0x11bb0b[_0xa58b('0x33')]=_['keys'](_0x2baab2[_0xa58b('0x33')]);_0x11bb0b['filters']=_[_0xa58b('0x36')](_0x11bb0b[_0xa58b('0x32')],_0x11bb0b[_0xa58b('0x33')]);_0x835e71[_0xa58b('0x38')]=_['intersection'](_0x11bb0b['model'],qs[_0xa58b('0x37')](_0x2baab2[_0xa58b('0x33')][_0xa58b('0x37')]));_0x835e71['attributes']=_0x835e71['attributes']['length']?_0x835e71['attributes']:_0x11bb0b[_0xa58b('0x32')];if(_0x2baab2[_0xa58b('0x33')][_0xa58b('0x44')]){_0x835e71[_0xa58b('0x45')]=[{'all':!![]}];}_0x835e71=_[_0xa58b('0x40')]({},_0x835e71,_0x2baab2[_0xa58b('0x42')]);return db[_0xa58b('0x43')]['find'](_0x835e71)[_0xa58b('0x27')](handleEntityNotFound(_0x3bc295,null))['then'](respondWithResult(_0x3bc295,null))[_0xa58b('0x48')](handleError(_0x3bc295,null));};exports[_0xa58b('0x4b')]=function(_0x241230,_0x6e9d6b){return db['ServicenowField'][_0xa58b('0x4b')](_0x241230['body'],{})[_0xa58b('0x27')](respondWithResult(_0x6e9d6b,0xc9))[_0xa58b('0x48')](handleError(_0x6e9d6b,null));};exports[_0xa58b('0x4c')]=function(_0x3bf21d,_0x11fe06){if(_0x3bf21d[_0xa58b('0x4d')]['id']){delete _0x3bf21d[_0xa58b('0x4d')]['id'];}return db['ServicenowField'][_0xa58b('0x4e')]({'where':{'id':_0x3bf21d[_0xa58b('0x4a')]['id']}})[_0xa58b('0x27')](handleEntityNotFound(_0x11fe06,null))[_0xa58b('0x27')](saveUpdates(_0x3bf21d[_0xa58b('0x4d')],null))['then'](respondWithResult(_0x11fe06,null))['catch'](handleError(_0x11fe06,null));};exports[_0xa58b('0x28')]=function(_0x2e78db,_0x186c98){return db[_0xa58b('0x43')]['find']({'where':{'id':_0x2e78db['params']['id']}})[_0xa58b('0x27')](handleEntityNotFound(_0x186c98,null))[_0xa58b('0x27')](removeEntity(_0x186c98,null))[_0xa58b('0x48')](handleError(_0x186c98,null));}; \ No newline at end of file +var _0xb2d3=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/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','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','show','params','intersection','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir'];(function(_0x206b24,_0x15fefb){var _0x41fb12=function(_0xa5e205){while(--_0xa5e205){_0x206b24['push'](_0x206b24['shift']());}};_0x41fb12(++_0x15fefb);}(_0xb2d3,0x197));var _0x3b2d=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xb2d3[_0x2c7618];return _0x5ce3f0;};'use strict';var emlformat=require(_0x3b2d('0x0'));var rimraf=require(_0x3b2d('0x1'));var zipdir=require(_0x3b2d('0x2'));var jsonpatch=require(_0x3b2d('0x3'));var rp=require(_0x3b2d('0x4'));var moment=require('moment');var BPromise=require(_0x3b2d('0x5'));var Mustache=require(_0x3b2d('0x6'));var util=require(_0x3b2d('0x7'));var path=require(_0x3b2d('0x8'));var sox=require(_0x3b2d('0x9'));var csv=require(_0x3b2d('0xa'));var ejs=require(_0x3b2d('0xb'));var fs=require('fs');var fs_extra=require(_0x3b2d('0xc'));var _=require(_0x3b2d('0xd'));var squel=require(_0x3b2d('0xe'));var crypto=require(_0x3b2d('0xf'));var jsforce=require(_0x3b2d('0x10'));var deskjs=require(_0x3b2d('0x11'));var toCsv=require(_0x3b2d('0xa'));var querystring=require(_0x3b2d('0x12'));var Papa=require(_0x3b2d('0x13'));var Redis=require(_0x3b2d('0x14'));var authService=require(_0x3b2d('0x15'));var qs=require(_0x3b2d('0x16'));var as=require(_0x3b2d('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3b2d('0x18'))(_0x3b2d('0x19'));var utils=require(_0x3b2d('0x1a'));var config=require(_0x3b2d('0x1b'));var licenseUtil=require(_0x3b2d('0x1c'));var db=require(_0x3b2d('0x1d'))['db'];function respondWithStatusCode(_0xd302ae,_0x150dfc){_0x150dfc=_0x150dfc||0xcc;return function(_0x4e26c6){if(_0x4e26c6){return _0xd302ae[_0x3b2d('0x1e')](_0x150dfc);}return _0xd302ae[_0x3b2d('0x1f')](_0x150dfc)[_0x3b2d('0x20')]();};}function respondWithResult(_0x201c03,_0x5d9ea2){_0x5d9ea2=_0x5d9ea2||0xc8;return function(_0x113bd4){if(_0x113bd4){return _0x201c03[_0x3b2d('0x1f')](_0x5d9ea2)[_0x3b2d('0x21')](_0x113bd4);}};}function respondWithFilteredResult(_0x1abe6b,_0x453ef3){return function(_0x3c27a2){if(_0x3c27a2){var _0x67e953=typeof _0x453ef3[_0x3b2d('0x22')]===_0x3b2d('0x23')&&typeof _0x453ef3[_0x3b2d('0x24')]===_0x3b2d('0x23');var _0x5d73fa=_0x3c27a2[_0x3b2d('0x25')];var _0x553cce=_0x67e953?0x0:_0x453ef3[_0x3b2d('0x22')];var _0x33ec43=_0x67e953?_0x3c27a2['count']:_0x453ef3[_0x3b2d('0x22')]+_0x453ef3[_0x3b2d('0x24')];var _0x239c25;if(_0x33ec43>=_0x5d73fa){_0x33ec43=_0x5d73fa;_0x239c25=0xc8;}else{_0x239c25=0xce;}_0x1abe6b[_0x3b2d('0x1f')](_0x239c25);return _0x1abe6b[_0x3b2d('0x26')](_0x3b2d('0x27'),_0x553cce+'-'+_0x33ec43+'/'+_0x5d73fa)['json'](_0x3c27a2);}return null;};}function patchUpdates(_0x5e04ac){return function(_0x4db88f){try{jsonpatch[_0x3b2d('0x28')](_0x4db88f,_0x5e04ac,!![]);}catch(_0x439696){return BPromise[_0x3b2d('0x29')](_0x439696);}return _0x4db88f[_0x3b2d('0x2a')]();};}function saveUpdates(_0x26235a,_0x322ecd){return function(_0x2f9956){if(_0x2f9956){return _0x2f9956[_0x3b2d('0x2b')](_0x26235a)['then'](function(_0x32d784){return _0x32d784;});}return null;};}function removeEntity(_0x37cb74,_0x542fcf){return function(_0x5b6d04){if(_0x5b6d04){return _0x5b6d04[_0x3b2d('0x2c')]()[_0x3b2d('0x2d')](function(){_0x37cb74[_0x3b2d('0x1f')](0xcc)[_0x3b2d('0x20')]();});}};}function handleEntityNotFound(_0xed91d0,_0x2218b2){return function(_0x3b8e62){if(!_0x3b8e62){_0xed91d0['sendStatus'](0x194);}return _0x3b8e62;};}function handleError(_0x3cdb29,_0x253798){_0x253798=_0x253798||0x1f4;return function(_0x113658){logger[_0x3b2d('0x2e')](_0x113658['stack']);if(_0x113658['name']){delete _0x113658[_0x3b2d('0x2f')];}_0x3cdb29[_0x3b2d('0x1f')](_0x253798)[_0x3b2d('0x30')](_0x113658);};}exports[_0x3b2d('0x31')]=function(_0x3889f8,_0x2cb5d1){var _0x499fde={},_0x16c19e={},_0x42ac33={'count':0x0,'rows':[]};var _0x5f193a=_[_0x3b2d('0x32')](db[_0x3b2d('0x33')][_0x3b2d('0x34')],function(_0x3736ff){return{'name':_0x3736ff[_0x3b2d('0x35')],'type':_0x3736ff[_0x3b2d('0x36')][_0x3b2d('0x37')]};});_0x16c19e[_0x3b2d('0x38')]=_[_0x3b2d('0x32')](_0x5f193a,_0x3b2d('0x2f'));_0x16c19e['query']=_[_0x3b2d('0x39')](_0x3889f8[_0x3b2d('0x3a')]);_0x16c19e[_0x3b2d('0x3b')]=_['intersection'](_0x16c19e[_0x3b2d('0x38')],_0x16c19e['query']);_0x499fde[_0x3b2d('0x3c')]=_['intersection'](_0x16c19e[_0x3b2d('0x38')],qs[_0x3b2d('0x3d')](_0x3889f8[_0x3b2d('0x3a')][_0x3b2d('0x3d')]));_0x499fde[_0x3b2d('0x3c')]=_0x499fde['attributes'][_0x3b2d('0x3e')]?_0x499fde[_0x3b2d('0x3c')]:_0x16c19e[_0x3b2d('0x38')];if(!_0x3889f8['query'][_0x3b2d('0x3f')](_0x3b2d('0x40'))){_0x499fde['limit']=qs[_0x3b2d('0x24')](_0x3889f8[_0x3b2d('0x3a')][_0x3b2d('0x24')]);_0x499fde[_0x3b2d('0x22')]=qs[_0x3b2d('0x22')](_0x3889f8[_0x3b2d('0x3a')]['offset']);}_0x499fde[_0x3b2d('0x41')]=qs[_0x3b2d('0x42')](_0x3889f8[_0x3b2d('0x3a')][_0x3b2d('0x42')]);_0x499fde[_0x3b2d('0x43')]=qs['filters'](_['pick'](_0x3889f8[_0x3b2d('0x3a')],_0x16c19e['filters']),_0x5f193a);if(_0x3889f8['query'][_0x3b2d('0x44')]){_0x499fde[_0x3b2d('0x43')]=_['merge'](_0x499fde['where'],{'$or':_[_0x3b2d('0x32')](_0x5f193a,function(_0x5b4dc0){if(_0x5b4dc0[_0x3b2d('0x36')]!=='VIRTUAL'){var _0x572af4={};_0x572af4[_0x5b4dc0[_0x3b2d('0x2f')]]={'$like':'%'+_0x3889f8['query'][_0x3b2d('0x44')]+'%'};return _0x572af4;}})});}_0x499fde=_[_0x3b2d('0x45')]({},_0x499fde,_0x3889f8[_0x3b2d('0x46')]);var _0x254c8e={'where':_0x499fde['where']};return db['ServicenowField']['count'](_0x254c8e)[_0x3b2d('0x2d')](function(_0x18e48e){_0x42ac33[_0x3b2d('0x25')]=_0x18e48e;if(_0x3889f8[_0x3b2d('0x3a')]['includeAll']){_0x499fde[_0x3b2d('0x47')]=[{'all':!![]}];}return db[_0x3b2d('0x33')][_0x3b2d('0x48')](_0x499fde);})[_0x3b2d('0x2d')](function(_0x3f7b10){_0x42ac33[_0x3b2d('0x49')]=_0x3f7b10;return _0x42ac33;})['then'](respondWithFilteredResult(_0x2cb5d1,_0x499fde))['catch'](handleError(_0x2cb5d1,null));};exports[_0x3b2d('0x4a')]=function(_0x521254,_0x52fb39){var _0x54a764={'raw':!![],'where':{'id':_0x521254[_0x3b2d('0x4b')]['id']}},_0x247ba5={};_0x247ba5[_0x3b2d('0x38')]=_[_0x3b2d('0x39')](db['ServicenowField'][_0x3b2d('0x34')]);_0x247ba5[_0x3b2d('0x3a')]=_[_0x3b2d('0x39')](_0x521254['query']);_0x247ba5[_0x3b2d('0x3b')]=_[_0x3b2d('0x4c')](_0x247ba5[_0x3b2d('0x38')],_0x247ba5['query']);_0x54a764[_0x3b2d('0x3c')]=_[_0x3b2d('0x4c')](_0x247ba5['model'],qs[_0x3b2d('0x3d')](_0x521254[_0x3b2d('0x3a')][_0x3b2d('0x3d')]));_0x54a764[_0x3b2d('0x3c')]=_0x54a764[_0x3b2d('0x3c')]['length']?_0x54a764[_0x3b2d('0x3c')]:_0x247ba5[_0x3b2d('0x38')];if(_0x521254['query'][_0x3b2d('0x4d')]){_0x54a764['include']=[{'all':!![]}];}_0x54a764=_['merge']({},_0x54a764,_0x521254[_0x3b2d('0x46')]);return db[_0x3b2d('0x33')][_0x3b2d('0x4e')](_0x54a764)[_0x3b2d('0x2d')](handleEntityNotFound(_0x52fb39,null))[_0x3b2d('0x2d')](respondWithResult(_0x52fb39,null))[_0x3b2d('0x4f')](handleError(_0x52fb39,null));};exports[_0x3b2d('0x50')]=function(_0xd7a500,_0x47d69f){return db[_0x3b2d('0x33')][_0x3b2d('0x50')](_0xd7a500[_0x3b2d('0x51')],{})[_0x3b2d('0x2d')](respondWithResult(_0x47d69f,0xc9))[_0x3b2d('0x4f')](handleError(_0x47d69f,null));};exports[_0x3b2d('0x2b')]=function(_0x4fb3cc,_0x4d8112){if(_0x4fb3cc['body']['id']){delete _0x4fb3cc['body']['id'];}return db[_0x3b2d('0x33')][_0x3b2d('0x4e')]({'where':{'id':_0x4fb3cc[_0x3b2d('0x4b')]['id']}})[_0x3b2d('0x2d')](handleEntityNotFound(_0x4d8112,null))[_0x3b2d('0x2d')](saveUpdates(_0x4fb3cc[_0x3b2d('0x51')],null))[_0x3b2d('0x2d')](respondWithResult(_0x4d8112,null))[_0x3b2d('0x4f')](handleError(_0x4d8112,null));};exports[_0x3b2d('0x2c')]=function(_0x3f0bc0,_0x3e06a3){return db[_0x3b2d('0x33')][_0x3b2d('0x4e')]({'where':{'id':_0x3f0bc0[_0x3b2d('0x4b')]['id']}})[_0x3b2d('0x2d')](handleEntityNotFound(_0x3e06a3,null))['then'](removeEntity(_0x3e06a3,null))[_0x3b2d('0x4f')](handleError(_0x3e06a3,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 8fdd03a..0797725 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 _0x0a19=['exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes'];(function(_0xe206ed,_0x179821){var _0x4423ab=function(_0x2668d2){while(--_0x2668d2){_0xe206ed['push'](_0xe206ed['shift']());}};_0x4423ab(++_0x179821);}(_0x0a19,0x86));var _0x90a1=function(_0x10f6e8,_0x351db6){_0x10f6e8=_0x10f6e8-0x0;var _0x35bb3c=_0x0a19[_0x10f6e8];return _0x35bb3c;};'use strict';var _=require(_0x90a1('0x0'));var util=require('util');var logger=require(_0x90a1('0x1'))('api');var moment=require(_0x90a1('0x2'));var BPromise=require(_0x90a1('0x3'));var rp=require(_0x90a1('0x4'));var fs=require('fs');var path=require(_0x90a1('0x5'));var rimraf=require(_0x90a1('0x6'));var config=require(_0x90a1('0x7'));var attributes=require(_0x90a1('0x8'));module[_0x90a1('0x9')]=function(_0x19017a,_0x2bf608){return _0x19017a['define'](_0x90a1('0xa'),attributes,{'tableName':_0x90a1('0xb'),'paranoid':![],'indexes':[{'name':_0x90a1('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0760=['define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowField.attributes'];(function(_0x49ae8f,_0x1cfb08){var _0x1bc83b=function(_0x5ec284){while(--_0x5ec284){_0x49ae8f['push'](_0x49ae8f['shift']());}};_0x1bc83b(++_0x1cfb08);}(_0x0760,0xc9));var _0x0076=function(_0x5ed96d,_0x390d0f){_0x5ed96d=_0x5ed96d-0x0;var _0x24dd4d=_0x0760[_0x5ed96d];return _0x24dd4d;};'use strict';var _=require(_0x0076('0x0'));var util=require(_0x0076('0x1'));var logger=require('../../config/logger')(_0x0076('0x2'));var moment=require(_0x0076('0x3'));var BPromise=require(_0x0076('0x4'));var rp=require(_0x0076('0x5'));var fs=require('fs');var path=require(_0x0076('0x6'));var rimraf=require('rimraf');var config=require(_0x0076('0x7'));var attributes=require(_0x0076('0x8'));module['exports']=function(_0x48a38e,_0x55fef2){return _0x48a38e[_0x0076('0x9')](_0x0076('0xa'),attributes,{'tableName':_0x0076('0xb'),'paranoid':![],'indexes':[{'name':_0x0076('0xc'),'fields':[_0x0076('0xd'),_0x0076('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 4e50587..2ee44a1 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['code','message','ServicenowField,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x988285,_0x4af6d7){var _0x59cf3a=function(_0x390a38){while(--_0x390a38){_0x988285['push'](_0x988285['shift']());}};_0x59cf3a(++_0x4af6d7);}(_0x9bde,0xe1));var _0xe9bd=function(_0x430f04,_0x3b5931){_0x430f04=_0x430f04-0x0;var _0x1c16c0=_0x9bde[_0x430f04];return _0x1c16c0;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('ServicenowField,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('ServicenowField,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('ServicenowField,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('ServicenowField,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file +var _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\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(_0x3173ef,_0x1c543e){var _0xfe9682=function(_0x555c2f){while(--_0x555c2f){_0x3173ef['push'](_0x3173ef['shift']());}};_0xfe9682(++_0x1c543e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index b3fc189..6e5c7d8 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(_0x134280,_0x3c2345){var _0x298dc2=function(_0x1d411b){while(--_0x1d411b){_0x134280['push'](_0x134280['shift']());}};_0x298dc2(++_0x3c2345);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x15f50b,_0x11fccb){var _0x233a84=function(_0x2002a4){while(--_0x2002a4){_0x15f50b['push'](_0x15f50b['shift']());}};_0x233a84(++_0x11fccb);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index ae068d5..a7eddd1 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(_0x403c60,_0x106c88){var _0x17c3a9=function(_0x258de2){while(--_0x258de2){_0x403c60['push'](_0x403c60['shift']());}};_0x17c3a9(++_0x106c88);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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(_0xaaf593,_0x13925c){var _0x34aa15=function(_0x44af51){while(--_0x44af51){_0xaaf593['push'](_0xaaf593['shift']());}};_0x34aa15(++_0x13925c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 f17bf35..838daad 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 _0x12f9=['getDescriptions','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','password','PLAIN','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','module_fields','remove','includes','endsWith','values','value','test','statusCode','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','catch','show','include','find','create','body','params','destroy','getConfigurations','findOne','SugarcrmConfiguration','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions'];(function(_0x5e3763,_0x1b6078){var _0x4a24a8=function(_0xd5647d){while(--_0xd5647d){_0x5e3763['push'](_0x5e3763['shift']());}};_0x4a24a8(++_0x1b6078);}(_0x12f9,0x11b));var _0x912f=function(_0x4dbe36,_0x344271){_0x4dbe36=_0x4dbe36-0x0;var _0x12fe6b=_0x12f9[_0x4dbe36];return _0x12fe6b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x912f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x912f('0x1'));var rp=require(_0x912f('0x2'));var moment=require(_0x912f('0x3'));var BPromise=require(_0x912f('0x4'));var Mustache=require('mustache');var util=require(_0x912f('0x5'));var path=require(_0x912f('0x6'));var sox=require(_0x912f('0x7'));var csv=require(_0x912f('0x8'));var ejs=require(_0x912f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x912f('0xa'));var crypto=require(_0x912f('0xb'));var jsforce=require(_0x912f('0xc'));var deskjs=require(_0x912f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x912f('0xe'));var Papa=require(_0x912f('0xf'));var Redis=require(_0x912f('0x10'));var authService=require(_0x912f('0x11'));var qs=require(_0x912f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x912f('0x13'));var logger=require(_0x912f('0x14'))(_0x912f('0x15'));var utils=require(_0x912f('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x912f('0x17'))['db'];var integrations=require(_0x912f('0x18'));function respondWithStatusCode(_0x211084,_0x5b260c){_0x5b260c=_0x5b260c||0xcc;return function(_0x3d98b8){if(_0x3d98b8){return _0x211084[_0x912f('0x19')](_0x5b260c);}return _0x211084[_0x912f('0x1a')](_0x5b260c)[_0x912f('0x1b')]();};}function respondWithResult(_0x1a1ebd,_0x2fce48){_0x2fce48=_0x2fce48||0xc8;return function(_0x516b9b){if(_0x516b9b){return _0x1a1ebd[_0x912f('0x1a')](_0x2fce48)[_0x912f('0x1c')](_0x516b9b);}};}function respondWithFilteredResult(_0x1324bc,_0x2c905c){return function(_0x1b80e8){if(_0x1b80e8){var _0x31f5ad=typeof _0x2c905c[_0x912f('0x1d')]===_0x912f('0x1e')&&typeof _0x2c905c[_0x912f('0x1f')]===_0x912f('0x1e');var _0x30ad18=_0x1b80e8[_0x912f('0x20')];var _0x42bcad=_0x31f5ad?0x0:_0x2c905c['offset'];var _0x137d06=_0x31f5ad?_0x1b80e8[_0x912f('0x20')]:_0x2c905c['offset']+_0x2c905c[_0x912f('0x1f')];var _0x34c476;if(_0x137d06>=_0x30ad18){_0x137d06=_0x30ad18;_0x34c476=0xc8;}else{_0x34c476=0xce;}_0x1324bc['status'](_0x34c476);return _0x1324bc[_0x912f('0x21')](_0x912f('0x22'),_0x42bcad+'-'+_0x137d06+'/'+_0x30ad18)[_0x912f('0x1c')](_0x1b80e8);}return null;};}function patchUpdates(_0x2af588){return function(_0x2cd330){try{jsonpatch['apply'](_0x2cd330,_0x2af588,!![]);}catch(_0xc8376c){return BPromise[_0x912f('0x23')](_0xc8376c);}return _0x2cd330['save']();};}function saveUpdates(_0x1643be,_0xa445ae){return function(_0x398d56){if(_0x398d56){return _0x398d56[_0x912f('0x24')](_0x1643be)[_0x912f('0x25')](function(_0x402d57){return _0x402d57;});}return null;};}function removeEntity(_0x3dc53e,_0x3d385f){return function(_0x4280c8){if(_0x4280c8){return _0x4280c8['destroy']()['then'](function(){_0x3dc53e[_0x912f('0x1a')](0xcc)[_0x912f('0x1b')]();});}};}function handleEntityNotFound(_0x51b831,_0x320f79){return function(_0x344246){if(!_0x344246){_0x51b831[_0x912f('0x19')](0x194);}return _0x344246;};}function handleError(_0x238dcc,_0x396834){_0x396834=_0x396834||0x1f4;return function(_0x49d57d){logger[_0x912f('0x26')](_0x49d57d[_0x912f('0x27')]);if(_0x49d57d['name']){delete _0x49d57d[_0x912f('0x28')];}_0x238dcc[_0x912f('0x1a')](_0x396834)[_0x912f('0x29')](_0x49d57d);};}exports[_0x912f('0x2a')]=function(_0x161b48,_0x35914e){var _0x3a0b95={},_0x5e634e={},_0x4bfcda={'count':0x0,'rows':[]};var _0x57f15b=_[_0x912f('0x2b')](db[_0x912f('0x2c')][_0x912f('0x2d')],function(_0x4caa10){return{'name':_0x4caa10['fieldName'],'type':_0x4caa10[_0x912f('0x2e')][_0x912f('0x2f')]};});_0x5e634e['model']=_['map'](_0x57f15b,_0x912f('0x28'));_0x5e634e[_0x912f('0x30')]=_[_0x912f('0x31')](_0x161b48[_0x912f('0x30')]);_0x5e634e[_0x912f('0x32')]=_['intersection'](_0x5e634e[_0x912f('0x33')],_0x5e634e[_0x912f('0x30')]);_0x3a0b95[_0x912f('0x34')]=_[_0x912f('0x35')](_0x5e634e['model'],qs['fields'](_0x161b48['query'][_0x912f('0x36')]));_0x3a0b95[_0x912f('0x34')]=_0x3a0b95[_0x912f('0x34')][_0x912f('0x37')]?_0x3a0b95[_0x912f('0x34')]:_0x5e634e['model'];if(!_0x161b48[_0x912f('0x30')][_0x912f('0x38')]('nolimit')){_0x3a0b95['limit']=qs[_0x912f('0x1f')](_0x161b48[_0x912f('0x30')][_0x912f('0x1f')]);_0x3a0b95['offset']=qs[_0x912f('0x1d')](_0x161b48[_0x912f('0x30')]['offset']);}_0x3a0b95[_0x912f('0x39')]=qs[_0x912f('0x3a')](_0x161b48[_0x912f('0x30')][_0x912f('0x3a')]);_0x3a0b95[_0x912f('0x3b')]=qs[_0x912f('0x32')](_[_0x912f('0x3c')](_0x161b48[_0x912f('0x30')],_0x5e634e[_0x912f('0x32')]),_0x57f15b);if(_0x161b48[_0x912f('0x30')]['filter']){_0x3a0b95[_0x912f('0x3b')]=_['merge'](_0x3a0b95[_0x912f('0x3b')],{'$or':_[_0x912f('0x2b')](_0x57f15b,function(_0x176257){if(_0x176257[_0x912f('0x2e')]!==_0x912f('0x3d')){var _0x526d32={};_0x526d32[_0x176257[_0x912f('0x28')]]={'$like':'%'+_0x161b48[_0x912f('0x30')][_0x912f('0x3e')]+'%'};return _0x526d32;}})});}_0x3a0b95=_[_0x912f('0x3f')]({},_0x3a0b95,_0x161b48[_0x912f('0x40')]);var _0x45d9c7={'where':_0x3a0b95[_0x912f('0x3b')]};return db[_0x912f('0x2c')][_0x912f('0x20')](_0x45d9c7)[_0x912f('0x25')](function(_0x4aa882){_0x4bfcda[_0x912f('0x20')]=_0x4aa882;if(_0x161b48[_0x912f('0x30')][_0x912f('0x41')]){_0x3a0b95['include']=[{'all':!![]}];}return db[_0x912f('0x2c')]['findAll'](_0x3a0b95);})[_0x912f('0x25')](function(_0x52829f){_0x4bfcda['rows']=_0x52829f;return _0x4bfcda;})[_0x912f('0x25')](respondWithFilteredResult(_0x35914e,_0x3a0b95))[_0x912f('0x42')](handleError(_0x35914e,null));};exports[_0x912f('0x43')]=function(_0x528248,_0x1f9b8c){var _0xc60a71={'raw':![],'where':{'id':_0x528248['params']['id']}},_0x537dce={};_0x537dce[_0x912f('0x33')]=_[_0x912f('0x31')](db['SugarcrmAccount'][_0x912f('0x2d')]);_0x537dce['query']=_['keys'](_0x528248['query']);_0x537dce['filters']=_[_0x912f('0x35')](_0x537dce[_0x912f('0x33')],_0x537dce['query']);_0xc60a71[_0x912f('0x34')]=_[_0x912f('0x35')](_0x537dce['model'],qs['fields'](_0x528248[_0x912f('0x30')][_0x912f('0x36')]));_0xc60a71[_0x912f('0x34')]=_0xc60a71[_0x912f('0x34')][_0x912f('0x37')]?_0xc60a71[_0x912f('0x34')]:_0x537dce[_0x912f('0x33')];if(_0x528248['query'][_0x912f('0x41')]){_0xc60a71[_0x912f('0x44')]=[{'all':!![]}];}_0xc60a71=_[_0x912f('0x3f')]({},_0xc60a71,_0x528248[_0x912f('0x40')]);return db[_0x912f('0x2c')][_0x912f('0x45')](_0xc60a71)['then'](handleEntityNotFound(_0x1f9b8c,null))['then'](respondWithResult(_0x1f9b8c,null))[_0x912f('0x42')](handleError(_0x1f9b8c,null));};exports['create']=function(_0x557e75,_0x26bf12){return db[_0x912f('0x2c')][_0x912f('0x46')](_0x557e75['body'],{})[_0x912f('0x25')](respondWithResult(_0x26bf12,0xc9))[_0x912f('0x42')](handleError(_0x26bf12,null));};exports[_0x912f('0x24')]=function(_0x566552,_0x7f23d2){if(_0x566552['body']['id']){delete _0x566552[_0x912f('0x47')]['id'];}return db[_0x912f('0x2c')][_0x912f('0x45')]({'where':{'id':_0x566552[_0x912f('0x48')]['id']}})['then'](handleEntityNotFound(_0x7f23d2,null))[_0x912f('0x25')](saveUpdates(_0x566552[_0x912f('0x47')],null))['then'](respondWithResult(_0x7f23d2,null))['catch'](handleError(_0x7f23d2,null));};exports[_0x912f('0x49')]=function(_0x840116,_0x1e4924){return db[_0x912f('0x2c')][_0x912f('0x45')]({'where':{'id':_0x840116[_0x912f('0x48')]['id']}})[_0x912f('0x25')](handleEntityNotFound(_0x1e4924,null))[_0x912f('0x25')](removeEntity(_0x1e4924,null))[_0x912f('0x42')](handleError(_0x1e4924,null));};exports[_0x912f('0x4a')]=function(_0xe04eee,_0x1e663d,_0x517773){var _0x550ee7={};var _0x61d872={};var _0x192a2f;var _0x50efe1;return db[_0x912f('0x2c')][_0x912f('0x4b')]({'where':{'id':_0xe04eee[_0x912f('0x48')]['id']}})[_0x912f('0x25')](handleEntityNotFound(_0x1e663d,null))[_0x912f('0x25')](function(_0x148dba){if(_0x148dba){_0x192a2f=_0x148dba;_0x61d872[_0x912f('0x33')]=_[_0x912f('0x31')](db[_0x912f('0x4c')][_0x912f('0x2d')]);_0x61d872[_0x912f('0x30')]=_[_0x912f('0x31')](_0xe04eee['query']);_0x61d872[_0x912f('0x32')]=_['intersection'](_0x61d872['model'],_0x61d872[_0x912f('0x30')]);_0x550ee7['attributes']=_[_0x912f('0x35')](_0x61d872[_0x912f('0x33')],qs[_0x912f('0x36')](_0xe04eee[_0x912f('0x30')]['fields']));_0x550ee7[_0x912f('0x34')]=_0x550ee7['attributes'][_0x912f('0x37')]?_0x550ee7[_0x912f('0x34')]:_0x61d872['model'];_0x550ee7['order']=qs[_0x912f('0x3a')](_0xe04eee['query'][_0x912f('0x3a')]);_0x550ee7[_0x912f('0x3b')]=qs['filters'](_[_0x912f('0x3c')](_0xe04eee[_0x912f('0x30')],_0x61d872[_0x912f('0x32')]));if(_0xe04eee['query'][_0x912f('0x3e')]){_0x550ee7[_0x912f('0x3b')]=_[_0x912f('0x3f')](_0x550ee7[_0x912f('0x3b')],{'$or':_[_0x912f('0x2b')](_0x550ee7[_0x912f('0x34')],function(_0x84230){var _0x33a6ca={};_0x33a6ca[_0x84230]={'$like':'%'+_0xe04eee['query'][_0x912f('0x3e')]+'%'};return _0x33a6ca;})});}_0x550ee7=_['merge']({},_0x550ee7,_0xe04eee[_0x912f('0x40')]);return _0x192a2f[_0x912f('0x4a')](_0x550ee7);}})[_0x912f('0x25')](function(_0xe639e6){if(_0xe639e6){_0x50efe1=_0xe639e6['length'];if(!_0xe04eee[_0x912f('0x30')][_0x912f('0x38')](_0x912f('0x4d'))){_0x550ee7[_0x912f('0x1f')]=qs[_0x912f('0x1f')](_0xe04eee[_0x912f('0x30')][_0x912f('0x1f')]);_0x550ee7['offset']=qs[_0x912f('0x1d')](_0xe04eee[_0x912f('0x30')][_0x912f('0x1d')]);}return _0x192a2f[_0x912f('0x4a')](_0x550ee7);}})[_0x912f('0x25')](function(_0x19f161){if(_0x19f161){return _0x19f161?{'count':_0x50efe1,'rows':_0x19f161}:null;}})[_0x912f('0x25')](respondWithResult(_0x1e663d,null))[_0x912f('0x42')](handleError(_0x1e663d,null));};exports[_0x912f('0x4e')]=function(_0x1852f2,_0x6ff93d,_0x1a0852){if(_0x1852f2['body']['id']){delete _0x1852f2[_0x912f('0x47')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x1852f2[_0x912f('0x48')]['id']}})[_0x912f('0x25')](handleEntityNotFound(_0x6ff93d,null))[_0x912f('0x25')](function(_0x450884){if(_0x450884){_0x1852f2[_0x912f('0x47')][_0x912f('0x4f')]=_0x450884['id'];_0x1852f2[_0x912f('0x47')]['Subjects']=integrations[_0x912f('0x50')](_0x1852f2[_0x912f('0x47')][_0x912f('0x51')],_0x1852f2[_0x912f('0x47')]['type']);_0x1852f2[_0x912f('0x47')][_0x912f('0x52')]=integrations[_0x912f('0x53')](_0x1852f2[_0x912f('0x47')][_0x912f('0x51')],_0x1852f2[_0x912f('0x47')][_0x912f('0x2e')]);return db[_0x912f('0x4c')]['create'](_0x1852f2[_0x912f('0x47')],{'include':[{'model':db[_0x912f('0x54')],'as':_0x912f('0x55')},{'model':db['SugarcrmField'],'as':_0x912f('0x52')}]});}return null;})[_0x912f('0x25')](respondWithResult(_0x6ff93d,null))['catch'](handleError(_0x6ff93d,null));};exports[_0x912f('0x56')]=function(_0x3ac1fa,_0x391777,_0x182868){var _0x3b968e='';var _0x2e2b9b=['id',_0x912f('0x28'),_0x912f('0x57'),_0x912f('0x58'),_0x912f('0x59'),'date_start',_0x912f('0x5a'),_0x912f('0x5b'),_0x912f('0x5c'),'parent_type',_0x912f('0x5d'),_0x912f('0x5e')];return db[_0x912f('0x2c')][_0x912f('0x4b')]({'where':{'id':_0x3ac1fa['params']['id']},'attributes':['id',_0x912f('0x5f'),'password',_0x912f('0x60')]})[_0x912f('0x25')](handleEntityNotFound(_0x391777,null))[_0x912f('0x25')](function(_0x49b9de){if(_0x49b9de){_0x3b968e=_0x49b9de['remoteUri'];var _0x3d5b5f=_0x3b968e[_0x912f('0x61')](-0x1);if(_0x3d5b5f==='/'){_0x3b968e=_0x3b968e[_0x912f('0x62')](0x0,_0x3b968e[_0x912f('0x63')](_0x3d5b5f));}return rp({'method':_0x912f('0x64'),'uri':util[_0x912f('0x65')](_0x912f('0x66'),_0x3b968e,_0x912f('0x67')),'json':!![],'form':{'method':_0x912f('0x68'),'input_type':_0x912f('0x69'),'response_type':_0x912f('0x69'),'rest_data':JSON[_0x912f('0x6a')]({'user_auth':{'user_name':_0x49b9de['username'],'password':_0x49b9de[_0x912f('0x6b')],'encryption':_0x912f('0x6c')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x912f('0x25')](function(_0x14027d){if(_0x14027d&&_0x14027d[_0x912f('0x28')]!==_0x912f('0x6d')&&_0x14027d[_0x912f('0x28')]!==_0x912f('0x6e')){return rp({'method':_0x912f('0x64'),'uri':util[_0x912f('0x65')]('%s%s',_0x3b968e,_0x912f('0x67')),'json':!![],'form':{'method':_0x912f('0x6f'),'input_type':'JSON','response_type':_0x912f('0x69'),'rest_data':JSON[_0x912f('0x6a')]({'session':_0x14027d['id'],'module_name':_0x912f('0x70')})}})[_0x912f('0x25')](function(_0x177e2e){if(_0x177e2e){var _0x2fabf6=_['values'](_0x177e2e[_0x912f('0x71')]);_[_0x912f('0x72')](_0x2fabf6,function(_0xe061aa){return _0x2e2b9b[_0x912f('0x73')](_0xe061aa[_0x912f('0x28')]);});return{'count':_0x2fabf6[_0x912f('0x37')],'rows':_[_0x912f('0x2b')](_0x2fabf6,function(_0x240100){return{'id':_0x240100[_0x912f('0x28')],'name':_0x240100['label'],'custom':_[_0x912f('0x74')](_0x240100[_0x912f('0x28')],'_c')?!![]:![],'options':_0x240100['options']?_['map'](_[_0x912f('0x75')](_0x240100[_0x912f('0x40')]),function(_0x38988a){return{'name':_0x38988a[_0x912f('0x76')],'value':_0x38988a[_0x912f('0x28')]};}):[]};})};}})[_0x912f('0x25')](respondWithResult(_0x391777,null))['catch'](function(_0x66bdcf){var _0x4c117f=_0x3ac1fa[_0x912f('0x30')][_0x912f('0x77')]?0x1f4:_0x66bdcf[_0x912f('0x78')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x912f('0x56'),_0x4c117f,JSON[_0x912f('0x6a')](_0x66bdcf));delete _0x66bdcf['name'];if(_0x4c117f===0x191){_0x4c117f=0x190;}_0x391777[_0x912f('0x1a')](_0x4c117f)[_0x912f('0x29')](_0x3ac1fa[_0x912f('0x30')][_0x912f('0x77')]?{'message':_0x912f('0x79'),'statusCode':_0x66bdcf['statusCode']}:_0x66bdcf);});}else{var _0x3186bb=0x1f4;_0x391777[_0x912f('0x1a')](_0x3186bb)[_0x912f('0x29')]({'message':_0x912f('0x79'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xd192=['date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','username','password','remoteUri','substring','format','%s%s','/service/v4_1/rest.php','JSON','Invalid\x20Login','Password\x20Expired','get_module_fields','stringify','Calls','module_fields','remove','label','values','value','statusCode','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','then','destroy','error','stack','name','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','where','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','keys','find','create','body','getConfigurations','sort','pick','nolimit','addConfiguration','findOne','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','description'];(function(_0x5a6e62,_0x3fd2c5){var _0x15e072=function(_0x142fe0){while(--_0x142fe0){_0x5a6e62['push'](_0x5a6e62['shift']());}};_0x15e072(++_0x3fd2c5);}(_0xd192,0x8d));var _0x2d19=function(_0x34f366,_0x472d41){_0x34f366=_0x34f366-0x0;var _0x3fcedb=_0xd192[_0x34f366];return _0x3fcedb;};'use strict';var emlformat=require(_0x2d19('0x0'));var rimraf=require(_0x2d19('0x1'));var zipdir=require(_0x2d19('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2d19('0x3'));var BPromise=require(_0x2d19('0x4'));var Mustache=require('mustache');var util=require(_0x2d19('0x5'));var path=require(_0x2d19('0x6'));var sox=require(_0x2d19('0x7'));var csv=require(_0x2d19('0x8'));var ejs=require(_0x2d19('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d19('0xa'));var squel=require(_0x2d19('0xb'));var crypto=require(_0x2d19('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2d19('0xd'));var toCsv=require(_0x2d19('0x8'));var querystring=require(_0x2d19('0xe'));var Papa=require(_0x2d19('0xf'));var Redis=require(_0x2d19('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2d19('0x11'));var as=require(_0x2d19('0x12'));var hardwareService=require(_0x2d19('0x13'));var logger=require(_0x2d19('0x14'))(_0x2d19('0x15'));var utils=require(_0x2d19('0x16'));var config=require(_0x2d19('0x17'));var licenseUtil=require(_0x2d19('0x18'));var db=require(_0x2d19('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xcb742,_0x46a1d3){_0x46a1d3=_0x46a1d3||0xcc;return function(_0x23196b){if(_0x23196b){return _0xcb742[_0x2d19('0x1a')](_0x46a1d3);}return _0xcb742['status'](_0x46a1d3)[_0x2d19('0x1b')]();};}function respondWithResult(_0x29f78f,_0x2a8053){_0x2a8053=_0x2a8053||0xc8;return function(_0x50dd05){if(_0x50dd05){return _0x29f78f[_0x2d19('0x1c')](_0x2a8053)['json'](_0x50dd05);}};}function respondWithFilteredResult(_0x36d8bf,_0x4d6a4f){return function(_0x25ab60){if(_0x25ab60){var _0xae40c0=typeof _0x4d6a4f[_0x2d19('0x1d')]===_0x2d19('0x1e')&&typeof _0x4d6a4f[_0x2d19('0x1f')]===_0x2d19('0x1e');var _0x32aac8=_0x25ab60[_0x2d19('0x20')];var _0x1b2865=_0xae40c0?0x0:_0x4d6a4f['offset'];var _0x4f9186=_0xae40c0?_0x25ab60[_0x2d19('0x20')]:_0x4d6a4f[_0x2d19('0x1d')]+_0x4d6a4f['limit'];var _0x3a9a95;if(_0x4f9186>=_0x32aac8){_0x4f9186=_0x32aac8;_0x3a9a95=0xc8;}else{_0x3a9a95=0xce;}_0x36d8bf[_0x2d19('0x1c')](_0x3a9a95);return _0x36d8bf['set'](_0x2d19('0x21'),_0x1b2865+'-'+_0x4f9186+'/'+_0x32aac8)[_0x2d19('0x22')](_0x25ab60);}return null;};}function patchUpdates(_0x3e5f6e){return function(_0x1cd264){try{jsonpatch[_0x2d19('0x23')](_0x1cd264,_0x3e5f6e,!![]);}catch(_0x1e1154){return BPromise[_0x2d19('0x24')](_0x1e1154);}return _0x1cd264['save']();};}function saveUpdates(_0x26c2ee,_0x38885b){return function(_0x324957){if(_0x324957){return _0x324957['update'](_0x26c2ee)[_0x2d19('0x25')](function(_0x4756d8){return _0x4756d8;});}return null;};}function removeEntity(_0x2e9e08,_0x344f31){return function(_0x1a0c79){if(_0x1a0c79){return _0x1a0c79[_0x2d19('0x26')]()[_0x2d19('0x25')](function(){_0x2e9e08[_0x2d19('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a9551,_0x2d1c00){return function(_0x369e0c){if(!_0x369e0c){_0x2a9551[_0x2d19('0x1a')](0x194);}return _0x369e0c;};}function handleError(_0x2ae3ca,_0x59de91){_0x59de91=_0x59de91||0x1f4;return function(_0x4e090e){logger[_0x2d19('0x27')](_0x4e090e[_0x2d19('0x28')]);if(_0x4e090e[_0x2d19('0x29')]){delete _0x4e090e[_0x2d19('0x29')];}_0x2ae3ca[_0x2d19('0x1c')](_0x59de91)['send'](_0x4e090e);};}exports['index']=function(_0x3b8467,_0xfcafec){var _0x3cd93c={},_0x576559={},_0x46a919={'count':0x0,'rows':[]};var _0x189f38=_[_0x2d19('0x2a')](db[_0x2d19('0x2b')][_0x2d19('0x2c')],function(_0x556fa3){return{'name':_0x556fa3[_0x2d19('0x2d')],'type':_0x556fa3[_0x2d19('0x2e')][_0x2d19('0x2f')]};});_0x576559[_0x2d19('0x30')]=_['map'](_0x189f38,_0x2d19('0x29'));_0x576559['query']=_['keys'](_0x3b8467[_0x2d19('0x31')]);_0x576559[_0x2d19('0x32')]=_['intersection'](_0x576559['model'],_0x576559[_0x2d19('0x31')]);_0x3cd93c[_0x2d19('0x33')]=_[_0x2d19('0x34')](_0x576559[_0x2d19('0x30')],qs[_0x2d19('0x35')](_0x3b8467[_0x2d19('0x31')][_0x2d19('0x35')]));_0x3cd93c[_0x2d19('0x33')]=_0x3cd93c[_0x2d19('0x33')][_0x2d19('0x36')]?_0x3cd93c[_0x2d19('0x33')]:_0x576559[_0x2d19('0x30')];if(!_0x3b8467[_0x2d19('0x31')][_0x2d19('0x37')]('nolimit')){_0x3cd93c[_0x2d19('0x1f')]=qs['limit'](_0x3b8467[_0x2d19('0x31')][_0x2d19('0x1f')]);_0x3cd93c[_0x2d19('0x1d')]=qs[_0x2d19('0x1d')](_0x3b8467['query'][_0x2d19('0x1d')]);}_0x3cd93c[_0x2d19('0x38')]=qs['sort'](_0x3b8467[_0x2d19('0x31')]['sort']);_0x3cd93c[_0x2d19('0x39')]=qs[_0x2d19('0x32')](_['pick'](_0x3b8467[_0x2d19('0x31')],_0x576559[_0x2d19('0x32')]),_0x189f38);if(_0x3b8467[_0x2d19('0x31')][_0x2d19('0x3a')]){_0x3cd93c[_0x2d19('0x39')]=_['merge'](_0x3cd93c[_0x2d19('0x39')],{'$or':_[_0x2d19('0x2a')](_0x189f38,function(_0x5d7f58){if(_0x5d7f58[_0x2d19('0x2e')]!==_0x2d19('0x3b')){var _0x271aeb={};_0x271aeb[_0x5d7f58[_0x2d19('0x29')]]={'$like':'%'+_0x3b8467[_0x2d19('0x31')]['filter']+'%'};return _0x271aeb;}})});}_0x3cd93c=_[_0x2d19('0x3c')]({},_0x3cd93c,_0x3b8467[_0x2d19('0x3d')]);var _0x5759e5={'where':_0x3cd93c[_0x2d19('0x39')]};return db[_0x2d19('0x2b')][_0x2d19('0x20')](_0x5759e5)[_0x2d19('0x25')](function(_0x5cf113){_0x46a919['count']=_0x5cf113;if(_0x3b8467[_0x2d19('0x31')]['includeAll']){_0x3cd93c[_0x2d19('0x3e')]=[{'all':!![]}];}return db[_0x2d19('0x2b')][_0x2d19('0x3f')](_0x3cd93c);})[_0x2d19('0x25')](function(_0x5012e0){_0x46a919['rows']=_0x5012e0;return _0x46a919;})[_0x2d19('0x25')](respondWithFilteredResult(_0xfcafec,_0x3cd93c))[_0x2d19('0x40')](handleError(_0xfcafec,null));};exports[_0x2d19('0x41')]=function(_0x47770b,_0x3e060e){var _0x35c9e8={'raw':![],'where':{'id':_0x47770b[_0x2d19('0x42')]['id']}},_0x100dfd={};_0x100dfd[_0x2d19('0x30')]=_[_0x2d19('0x43')](db[_0x2d19('0x2b')][_0x2d19('0x2c')]);_0x100dfd['query']=_['keys'](_0x47770b[_0x2d19('0x31')]);_0x100dfd['filters']=_[_0x2d19('0x34')](_0x100dfd[_0x2d19('0x30')],_0x100dfd[_0x2d19('0x31')]);_0x35c9e8['attributes']=_[_0x2d19('0x34')](_0x100dfd['model'],qs[_0x2d19('0x35')](_0x47770b[_0x2d19('0x31')][_0x2d19('0x35')]));_0x35c9e8[_0x2d19('0x33')]=_0x35c9e8[_0x2d19('0x33')][_0x2d19('0x36')]?_0x35c9e8[_0x2d19('0x33')]:_0x100dfd[_0x2d19('0x30')];if(_0x47770b['query']['includeAll']){_0x35c9e8[_0x2d19('0x3e')]=[{'all':!![]}];}_0x35c9e8=_[_0x2d19('0x3c')]({},_0x35c9e8,_0x47770b[_0x2d19('0x3d')]);return db[_0x2d19('0x2b')][_0x2d19('0x44')](_0x35c9e8)['then'](handleEntityNotFound(_0x3e060e,null))[_0x2d19('0x25')](respondWithResult(_0x3e060e,null))[_0x2d19('0x40')](handleError(_0x3e060e,null));};exports[_0x2d19('0x45')]=function(_0xade053,_0x373269){return db['SugarcrmAccount']['create'](_0xade053[_0x2d19('0x46')],{})[_0x2d19('0x25')](respondWithResult(_0x373269,0xc9))[_0x2d19('0x40')](handleError(_0x373269,null));};exports['update']=function(_0x5bc8f9,_0x439cf9){if(_0x5bc8f9[_0x2d19('0x46')]['id']){delete _0x5bc8f9[_0x2d19('0x46')]['id'];}return db[_0x2d19('0x2b')][_0x2d19('0x44')]({'where':{'id':_0x5bc8f9[_0x2d19('0x42')]['id']}})['then'](handleEntityNotFound(_0x439cf9,null))[_0x2d19('0x25')](saveUpdates(_0x5bc8f9[_0x2d19('0x46')],null))[_0x2d19('0x25')](respondWithResult(_0x439cf9,null))['catch'](handleError(_0x439cf9,null));};exports[_0x2d19('0x26')]=function(_0x22fa63,_0x457b3a){return db[_0x2d19('0x2b')][_0x2d19('0x44')]({'where':{'id':_0x22fa63[_0x2d19('0x42')]['id']}})[_0x2d19('0x25')](handleEntityNotFound(_0x457b3a,null))[_0x2d19('0x25')](removeEntity(_0x457b3a,null))[_0x2d19('0x40')](handleError(_0x457b3a,null));};exports[_0x2d19('0x47')]=function(_0x3f3d66,_0xedf666,_0x371207){var _0xd4cc92={};var _0x4cd38d={};var _0x40e7b5;var _0xbea0b8;return db[_0x2d19('0x2b')]['findOne']({'where':{'id':_0x3f3d66[_0x2d19('0x42')]['id']}})[_0x2d19('0x25')](handleEntityNotFound(_0xedf666,null))['then'](function(_0x39578a){if(_0x39578a){_0x40e7b5=_0x39578a;_0x4cd38d[_0x2d19('0x30')]=_[_0x2d19('0x43')](db['SugarcrmConfiguration'][_0x2d19('0x2c')]);_0x4cd38d[_0x2d19('0x31')]=_[_0x2d19('0x43')](_0x3f3d66['query']);_0x4cd38d[_0x2d19('0x32')]=_[_0x2d19('0x34')](_0x4cd38d[_0x2d19('0x30')],_0x4cd38d[_0x2d19('0x31')]);_0xd4cc92['attributes']=_[_0x2d19('0x34')](_0x4cd38d[_0x2d19('0x30')],qs[_0x2d19('0x35')](_0x3f3d66['query']['fields']));_0xd4cc92[_0x2d19('0x33')]=_0xd4cc92[_0x2d19('0x33')][_0x2d19('0x36')]?_0xd4cc92['attributes']:_0x4cd38d[_0x2d19('0x30')];_0xd4cc92[_0x2d19('0x38')]=qs[_0x2d19('0x48')](_0x3f3d66['query'][_0x2d19('0x48')]);_0xd4cc92[_0x2d19('0x39')]=qs[_0x2d19('0x32')](_[_0x2d19('0x49')](_0x3f3d66[_0x2d19('0x31')],_0x4cd38d[_0x2d19('0x32')]));if(_0x3f3d66[_0x2d19('0x31')][_0x2d19('0x3a')]){_0xd4cc92[_0x2d19('0x39')]=_[_0x2d19('0x3c')](_0xd4cc92['where'],{'$or':_[_0x2d19('0x2a')](_0xd4cc92['attributes'],function(_0xdf6f3d){var _0x3384f1={};_0x3384f1[_0xdf6f3d]={'$like':'%'+_0x3f3d66[_0x2d19('0x31')][_0x2d19('0x3a')]+'%'};return _0x3384f1;})});}_0xd4cc92=_[_0x2d19('0x3c')]({},_0xd4cc92,_0x3f3d66['options']);return _0x40e7b5[_0x2d19('0x47')](_0xd4cc92);}})[_0x2d19('0x25')](function(_0x5b32fe){if(_0x5b32fe){_0xbea0b8=_0x5b32fe[_0x2d19('0x36')];if(!_0x3f3d66[_0x2d19('0x31')][_0x2d19('0x37')](_0x2d19('0x4a'))){_0xd4cc92[_0x2d19('0x1f')]=qs[_0x2d19('0x1f')](_0x3f3d66['query']['limit']);_0xd4cc92[_0x2d19('0x1d')]=qs[_0x2d19('0x1d')](_0x3f3d66[_0x2d19('0x31')][_0x2d19('0x1d')]);}return _0x40e7b5[_0x2d19('0x47')](_0xd4cc92);}})['then'](function(_0x4b49ae){if(_0x4b49ae){return _0x4b49ae?{'count':_0xbea0b8,'rows':_0x4b49ae}:null;}})[_0x2d19('0x25')](respondWithResult(_0xedf666,null))[_0x2d19('0x40')](handleError(_0xedf666,null));};exports[_0x2d19('0x4b')]=function(_0xbb056,_0x11fef8,_0x67cf3e){if(_0xbb056[_0x2d19('0x46')]['id']){delete _0xbb056['body']['id'];}return db['SugarcrmAccount'][_0x2d19('0x4c')]({'where':{'id':_0xbb056[_0x2d19('0x42')]['id']}})[_0x2d19('0x25')](handleEntityNotFound(_0x11fef8,null))[_0x2d19('0x25')](function(_0x303d4e){if(_0x303d4e){_0xbb056[_0x2d19('0x46')]['AccountId']=_0x303d4e['id'];_0xbb056[_0x2d19('0x46')]['Subjects']=integrations[_0x2d19('0x4d')](_0xbb056['body'][_0x2d19('0x4e')],_0xbb056[_0x2d19('0x46')][_0x2d19('0x2e')]);_0xbb056[_0x2d19('0x46')][_0x2d19('0x4f')]=integrations[_0x2d19('0x50')](_0xbb056[_0x2d19('0x46')][_0x2d19('0x4e')],_0xbb056[_0x2d19('0x46')][_0x2d19('0x2e')]);return db[_0x2d19('0x51')][_0x2d19('0x45')](_0xbb056[_0x2d19('0x46')],{'include':[{'model':db[_0x2d19('0x52')],'as':'Subjects'},{'model':db[_0x2d19('0x52')],'as':'Descriptions'}]});}return null;})[_0x2d19('0x25')](respondWithResult(_0x11fef8,null))['catch'](handleError(_0x11fef8,null));};exports[_0x2d19('0x53')]=function(_0x10becd,_0x4d17af,_0x119567){var _0x45ba43='';var _0x535925=['id','name','assigned_user_id','created_by',_0x2d19('0x54'),_0x2d19('0x55'),_0x2d19('0x56'),_0x2d19('0x57'),_0x2d19('0x58'),_0x2d19('0x59'),_0x2d19('0x5a'),'direction'];return db[_0x2d19('0x2b')][_0x2d19('0x4c')]({'where':{'id':_0x10becd[_0x2d19('0x42')]['id']},'attributes':['id',_0x2d19('0x5b'),_0x2d19('0x5c'),'remoteUri']})['then'](handleEntityNotFound(_0x4d17af,null))['then'](function(_0x5b3a29){if(_0x5b3a29){_0x45ba43=_0x5b3a29[_0x2d19('0x5d')];var _0x3eff63=_0x45ba43['slice'](-0x1);if(_0x3eff63==='/'){_0x45ba43=_0x45ba43[_0x2d19('0x5e')](0x0,_0x45ba43['lastIndexOf'](_0x3eff63));}return rp({'method':'POST','uri':util[_0x2d19('0x5f')](_0x2d19('0x60'),_0x45ba43,_0x2d19('0x61')),'json':!![],'form':{'method':'login','input_type':_0x2d19('0x62'),'response_type':_0x2d19('0x62'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5b3a29[_0x2d19('0x5b')],'password':_0x5b3a29['password'],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x6f0e11){if(_0x6f0e11&&_0x6f0e11[_0x2d19('0x29')]!==_0x2d19('0x63')&&_0x6f0e11['name']!==_0x2d19('0x64')){return rp({'method':'POST','uri':util[_0x2d19('0x5f')](_0x2d19('0x60'),_0x45ba43,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x2d19('0x65'),'input_type':_0x2d19('0x62'),'response_type':_0x2d19('0x62'),'rest_data':JSON[_0x2d19('0x66')]({'session':_0x6f0e11['id'],'module_name':_0x2d19('0x67')})}})[_0x2d19('0x25')](function(_0x327364){if(_0x327364){var _0x3df06c=_['values'](_0x327364[_0x2d19('0x68')]);_[_0x2d19('0x69')](_0x3df06c,function(_0x569212){return _0x535925['includes'](_0x569212['name']);});return{'count':_0x3df06c[_0x2d19('0x36')],'rows':_[_0x2d19('0x2a')](_0x3df06c,function(_0x46d35a){return{'id':_0x46d35a[_0x2d19('0x29')],'name':_0x46d35a[_0x2d19('0x6a')],'custom':_['endsWith'](_0x46d35a[_0x2d19('0x29')],'_c')?!![]:![],'options':_0x46d35a[_0x2d19('0x3d')]?_[_0x2d19('0x2a')](_[_0x2d19('0x6b')](_0x46d35a['options']),function(_0x2260cf){return{'name':_0x2260cf[_0x2d19('0x6c')],'value':_0x2260cf[_0x2d19('0x29')]};}):[]};})};}})[_0x2d19('0x25')](respondWithResult(_0x4d17af,null))[_0x2d19('0x40')](function(_0x15789d){var _0x41827a=_0x10becd['query']['test']?0x1f4:_0x15789d[_0x2d19('0x6d')]||0x1f4;logger[_0x2d19('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x2d19('0x53'),_0x41827a,JSON[_0x2d19('0x66')](_0x15789d));delete _0x15789d[_0x2d19('0x29')];if(_0x41827a===0x191){_0x41827a=0x190;}_0x4d17af[_0x2d19('0x1c')](_0x41827a)[_0x2d19('0x6e')](_0x10becd['query'][_0x2d19('0x6f')]?{'message':_0x2d19('0x70'),'statusCode':_0x15789d[_0x2d19('0x6d')]}:_0x15789d);});}else{var _0x1dbd90=0x1f4;_0x4d17af['status'](_0x1dbd90)[_0x2d19('0x6e')]({'message':_0x2d19('0x70'),'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 f2edba1..ab3a1c0 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 _0x7353=['api','moment','bluebird','path','./intSugarcrmAccount.attributes','../../components/integrations/configuration','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x7353,0x1f2));var _0x3735=function(_0x802f6f,_0x439657){_0x802f6f=_0x802f6f-0x0;var _0x34f4b0=_0x7353[_0x802f6f];return _0x34f4b0;};'use strict';var _=require('lodash');var util=require(_0x3735('0x0'));var logger=require(_0x3735('0x1'))(_0x3735('0x2'));var moment=require(_0x3735('0x3'));var BPromise=require(_0x3735('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3735('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3735('0x6'));var integrations=require(_0x3735('0x7'));module['exports']=function(_0x208d67,_0x242efe){return _0x208d67['define'](_0x3735('0x8'),attributes,{'tableName':_0x3735('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95c9=['path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','../../config/logger','moment','request-promise'];(function(_0x4b69a1,_0xdd2aab){var _0x29f522=function(_0x2a2c87){while(--_0x2a2c87){_0x4b69a1['push'](_0x4b69a1['shift']());}};_0x29f522(++_0xdd2aab);}(_0x95c9,0x1e7));var _0x995c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x95c9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x995c('0x0'))('api');var moment=require(_0x995c('0x1'));var BPromise=require('bluebird');var rp=require(_0x995c('0x2'));var fs=require('fs');var path=require(_0x995c('0x3'));var rimraf=require(_0x995c('0x4'));var config=require(_0x995c('0x5'));var attributes=require(_0x995c('0x6'));var integrations=require(_0x995c('0x7'));module[_0x995c('0x8')]=function(_0x213269,_0x540865){return _0x213269[_0x995c('0x9')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index b4a5675..03c9852 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 _0xdf18=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','where','attributes','limit','include','map','model','raw','ShowSugarcrmAccount','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x1904fb,_0x36f4c6){var _0x385e58=function(_0x16b9f0){while(--_0x16b9f0){_0x1904fb['push'](_0x1904fb['shift']());}};_0x385e58(++_0x36f4c6);}(_0xdf18,0x1aa));var _0x8df1=function(_0x4e4e19,_0x4855f0){_0x4e4e19=_0x4e4e19-0x0;var _0xe82eb3=_0xdf18[_0x4e4e19];return _0xe82eb3;};'use strict';var _=require(_0x8df1('0x0'));var util=require(_0x8df1('0x1'));var moment=require(_0x8df1('0x2'));var BPromise=require(_0x8df1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8df1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8df1('0x5'));var logger=require(_0x8df1('0x6'))(_0x8df1('0x7'));var config=require(_0x8df1('0x8'));var jayson=require(_0x8df1('0x9'));var client=jayson[_0x8df1('0xa')][_0x8df1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x485c78,_0x21f1cc,_0x466ffc){return new BPromise(function(_0x20a878,_0x33d76b){return client[_0x8df1('0xc')](_0x485c78,_0x466ffc)[_0x8df1('0xd')](function(_0xa2b18c){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x21f1cc,_0x8df1('0xe'));logger[_0x8df1('0xf')](_0x8df1('0x10'),_0x21f1cc,_0x8df1('0xe'),JSON[_0x8df1('0x11')](_0xa2b18c));if(_0xa2b18c[_0x8df1('0x12')]){if(_0xa2b18c[_0x8df1('0x12')][_0x8df1('0x13')]===0x1f4){logger[_0x8df1('0x12')](_0x8df1('0x14'),_0x21f1cc,_0xa2b18c[_0x8df1('0x12')][_0x8df1('0x15')]);return _0x33d76b(_0xa2b18c['error'][_0x8df1('0x15')]);}logger[_0x8df1('0x12')](_0x8df1('0x14'),_0x21f1cc,_0xa2b18c['error'][_0x8df1('0x15')]);return _0x20a878(_0xa2b18c[_0x8df1('0x12')]['message']);}else{logger[_0x8df1('0x16')]('SugarcrmAccount,\x20%s,\x20%s',_0x21f1cc,'request\x20sent');_0x20a878(_0xa2b18c[_0x8df1('0x17')][_0x8df1('0x15')]);}})[_0x8df1('0x18')](function(_0x36f401){logger[_0x8df1('0x12')](_0x8df1('0x14'),_0x21f1cc,_0x36f401);_0x33d76b(_0x36f401);});});}exports[_0x8df1('0x19')]=function(_0x39c6ef){var _0x5406ce=this;return new Promise(function(_0x4d33e8,_0x57848f){return db[_0x8df1('0x1a')]['findAll']({'raw':_0x39c6ef[_0x8df1('0x1b')]?_0x39c6ef[_0x8df1('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x39c6ef[_0x8df1('0x1b')]?_0x39c6ef[_0x8df1('0x1b')][_0x8df1('0x1c')]||null:null,'attributes':_0x39c6ef[_0x8df1('0x1b')]?_0x39c6ef[_0x8df1('0x1b')][_0x8df1('0x1d')]||null:null,'limit':_0x39c6ef[_0x8df1('0x1b')]?_0x39c6ef[_0x8df1('0x1b')][_0x8df1('0x1e')]||null:null,'include':_0x39c6ef[_0x8df1('0x1b')]?_0x39c6ef['options'][_0x8df1('0x1f')]?_[_0x8df1('0x20')](_0x39c6ef[_0x8df1('0x1b')][_0x8df1('0x1f')],function(_0x4ba0ad){return{'model':db[_0x4ba0ad[_0x8df1('0x21')]],'as':_0x4ba0ad['as'],'attributes':_0x4ba0ad['attributes'],'include':_0x4ba0ad[_0x8df1('0x1f')]?_[_0x8df1('0x20')](_0x4ba0ad[_0x8df1('0x1f')],function(_0x410a2d){return{'model':db[_0x410a2d['model']],'as':_0x410a2d['as'],'attributes':_0x410a2d[_0x8df1('0x1d')],'include':_0x410a2d[_0x8df1('0x1f')]?_[_0x8df1('0x20')](_0x410a2d['include'],function(_0x4cd568){return{'model':db[_0x4cd568[_0x8df1('0x21')]],'as':_0x4cd568['as'],'attributes':_0x4cd568[_0x8df1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8df1('0xd')](function(_0x4112de){logger[_0x8df1('0x16')](_0x8df1('0x19'),_0x39c6ef);logger[_0x8df1('0xf')](_0x8df1('0x19'),_0x39c6ef,JSON[_0x8df1('0x11')](_0x4112de));_0x4d33e8(_0x4112de);})['catch'](function(_0x1685b8){logger['error'](_0x8df1('0x19'),_0x1685b8['message'],_0x39c6ef);_0x57848f(_0x5406ce[_0x8df1('0x12')](0x1f4,_0x1685b8['message']));});});};exports['ShowSugarcrmAccount']=function(_0x1ba2cb){var _0x5b4978=this;return new Promise(function(_0x1b63cd,_0x49c8ac){return db[_0x8df1('0x1a')]['find']({'raw':_0x1ba2cb['options']?_0x1ba2cb[_0x8df1('0x1b')][_0x8df1('0x22')]===undefined?!![]:![]:!![],'where':_0x1ba2cb[_0x8df1('0x1b')]?_0x1ba2cb[_0x8df1('0x1b')][_0x8df1('0x1c')]||null:null,'attributes':_0x1ba2cb[_0x8df1('0x1b')]?_0x1ba2cb[_0x8df1('0x1b')][_0x8df1('0x1d')]||null:null,'include':_0x1ba2cb[_0x8df1('0x1b')]?_0x1ba2cb[_0x8df1('0x1b')][_0x8df1('0x1f')]?_[_0x8df1('0x20')](_0x1ba2cb[_0x8df1('0x1b')][_0x8df1('0x1f')],function(_0x21412a){return{'model':db[_0x21412a[_0x8df1('0x21')]],'as':_0x21412a['as'],'attributes':_0x21412a[_0x8df1('0x1d')],'include':_0x21412a[_0x8df1('0x1f')]?_[_0x8df1('0x20')](_0x21412a[_0x8df1('0x1f')],function(_0x26a68e){return{'model':db[_0x26a68e[_0x8df1('0x21')]],'as':_0x26a68e['as'],'attributes':_0x26a68e['attributes'],'include':_0x26a68e['include']?_[_0x8df1('0x20')](_0x26a68e[_0x8df1('0x1f')],function(_0xf83e35){return{'model':db[_0xf83e35[_0x8df1('0x21')]],'as':_0xf83e35['as'],'attributes':_0xf83e35[_0x8df1('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21e5a8){logger['info'](_0x8df1('0x23'),_0x1ba2cb);logger[_0x8df1('0xf')](_0x8df1('0x23'),_0x1ba2cb,JSON[_0x8df1('0x11')](_0x21e5a8));_0x1b63cd(_0x21e5a8);})[_0x8df1('0x18')](function(_0x183686){logger[_0x8df1('0x12')](_0x8df1('0x23'),_0x183686[_0x8df1('0x15')],_0x1ba2cb);_0x49c8ac(_0x5b4978[_0x8df1('0x12')](0x1f4,_0x183686[_0x8df1('0x15')]));});});}; \ No newline at end of file +var _0xd1d9=['limit','include','map','model','attributes','stringify','ShowSugarcrmAccount','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where'];(function(_0xb99421,_0xaab133){var _0x4b3ec7=function(_0x591d1a){while(--_0x591d1a){_0xb99421['push'](_0xb99421['shift']());}};_0x4b3ec7(++_0xaab133);}(_0xd1d9,0xb7));var _0x9d1d=function(_0xc4b308,_0x965288){_0xc4b308=_0xc4b308-0x0;var _0x2c90fc=_0xd1d9[_0xc4b308];return _0x2c90fc;};'use strict';var _=require(_0x9d1d('0x0'));var util=require(_0x9d1d('0x1'));var moment=require('moment');var BPromise=require(_0x9d1d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d1d('0x3'));var db=require(_0x9d1d('0x4'))['db'];var utils=require(_0x9d1d('0x5'));var logger=require(_0x9d1d('0x6'))('rpc');var config=require(_0x9d1d('0x7'));var jayson=require(_0x9d1d('0x8'));var client=jayson[_0x9d1d('0x9')][_0x9d1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e9905,_0x3d0a6e,_0x2483b3){return new BPromise(function(_0x244918,_0x428bd5){return client[_0x9d1d('0xb')](_0x5e9905,_0x2483b3)[_0x9d1d('0xc')](function(_0x3ff40c){logger[_0x9d1d('0xd')](_0x9d1d('0xe'),_0x3d0a6e,'request\x20sent');logger[_0x9d1d('0xf')](_0x9d1d('0x10'),_0x3d0a6e,_0x9d1d('0x11'),JSON['stringify'](_0x3ff40c));if(_0x3ff40c[_0x9d1d('0x12')]){if(_0x3ff40c[_0x9d1d('0x12')]['code']===0x1f4){logger['error'](_0x9d1d('0xe'),_0x3d0a6e,_0x3ff40c[_0x9d1d('0x12')][_0x9d1d('0x13')]);return _0x428bd5(_0x3ff40c[_0x9d1d('0x12')][_0x9d1d('0x13')]);}logger[_0x9d1d('0x12')](_0x9d1d('0xe'),_0x3d0a6e,_0x3ff40c[_0x9d1d('0x12')][_0x9d1d('0x13')]);return _0x244918(_0x3ff40c['error'][_0x9d1d('0x13')]);}else{logger[_0x9d1d('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x3d0a6e,_0x9d1d('0x11'));_0x244918(_0x3ff40c['result'][_0x9d1d('0x13')]);}})[_0x9d1d('0x14')](function(_0x3d32ec){logger[_0x9d1d('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x3d0a6e,_0x3d32ec);_0x428bd5(_0x3d32ec);});});}exports[_0x9d1d('0x15')]=function(_0x1fe1ac){var _0x3d68ad=this;return new Promise(function(_0x4f7197,_0x19e99a){return db[_0x9d1d('0x16')][_0x9d1d('0x17')]({'raw':_0x1fe1ac[_0x9d1d('0x18')]?_0x1fe1ac['options'][_0x9d1d('0x19')]===undefined?!![]:![]:!![],'where':_0x1fe1ac['options']?_0x1fe1ac[_0x9d1d('0x18')][_0x9d1d('0x1a')]||null:null,'attributes':_0x1fe1ac['options']?_0x1fe1ac['options']['attributes']||null:null,'limit':_0x1fe1ac[_0x9d1d('0x18')]?_0x1fe1ac[_0x9d1d('0x18')][_0x9d1d('0x1b')]||null:null,'include':_0x1fe1ac[_0x9d1d('0x18')]?_0x1fe1ac['options'][_0x9d1d('0x1c')]?_[_0x9d1d('0x1d')](_0x1fe1ac['options']['include'],function(_0x135a0a){return{'model':db[_0x135a0a[_0x9d1d('0x1e')]],'as':_0x135a0a['as'],'attributes':_0x135a0a[_0x9d1d('0x1f')],'include':_0x135a0a[_0x9d1d('0x1c')]?_[_0x9d1d('0x1d')](_0x135a0a[_0x9d1d('0x1c')],function(_0x39234c){return{'model':db[_0x39234c[_0x9d1d('0x1e')]],'as':_0x39234c['as'],'attributes':_0x39234c[_0x9d1d('0x1f')],'include':_0x39234c[_0x9d1d('0x1c')]?_[_0x9d1d('0x1d')](_0x39234c[_0x9d1d('0x1c')],function(_0x264867){return{'model':db[_0x264867['model']],'as':_0x264867['as'],'attributes':_0x264867['attributes']};}):[]};}):[]};}):[]:[]})[_0x9d1d('0xc')](function(_0x5825e3){logger[_0x9d1d('0xd')](_0x9d1d('0x15'),_0x1fe1ac);logger['debug'](_0x9d1d('0x15'),_0x1fe1ac,JSON[_0x9d1d('0x20')](_0x5825e3));_0x4f7197(_0x5825e3);})['catch'](function(_0x8a653c){logger['error']('GetSugarcrmAccount',_0x8a653c['message'],_0x1fe1ac);_0x19e99a(_0x3d68ad['error'](0x1f4,_0x8a653c[_0x9d1d('0x13')]));});});};exports[_0x9d1d('0x21')]=function(_0x594a4b){var _0x3d6008=this;return new Promise(function(_0x4b864f,_0x412eb0){return db['SugarcrmAccount'][_0x9d1d('0x22')]({'raw':_0x594a4b['options']?_0x594a4b[_0x9d1d('0x18')][_0x9d1d('0x19')]===undefined?!![]:![]:!![],'where':_0x594a4b[_0x9d1d('0x18')]?_0x594a4b[_0x9d1d('0x18')][_0x9d1d('0x1a')]||null:null,'attributes':_0x594a4b[_0x9d1d('0x18')]?_0x594a4b[_0x9d1d('0x18')][_0x9d1d('0x1f')]||null:null,'include':_0x594a4b[_0x9d1d('0x18')]?_0x594a4b[_0x9d1d('0x18')][_0x9d1d('0x1c')]?_['map'](_0x594a4b[_0x9d1d('0x18')][_0x9d1d('0x1c')],function(_0x586e8f){return{'model':db[_0x586e8f[_0x9d1d('0x1e')]],'as':_0x586e8f['as'],'attributes':_0x586e8f[_0x9d1d('0x1f')],'include':_0x586e8f[_0x9d1d('0x1c')]?_['map'](_0x586e8f[_0x9d1d('0x1c')],function(_0x1873d8){return{'model':db[_0x1873d8['model']],'as':_0x1873d8['as'],'attributes':_0x1873d8['attributes'],'include':_0x1873d8[_0x9d1d('0x1c')]?_[_0x9d1d('0x1d')](_0x1873d8['include'],function(_0x41efe3){return{'model':db[_0x41efe3[_0x9d1d('0x1e')]],'as':_0x41efe3['as'],'attributes':_0x41efe3[_0x9d1d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9d1d('0xc')](function(_0xa503f2){logger[_0x9d1d('0xd')](_0x9d1d('0x21'),_0x594a4b);logger[_0x9d1d('0xf')](_0x9d1d('0x21'),_0x594a4b,JSON[_0x9d1d('0x20')](_0xa503f2));_0x4b864f(_0xa503f2);})[_0x9d1d('0x14')](function(_0xa07e34){logger[_0x9d1d('0x12')](_0x9d1d('0x21'),_0xa07e34[_0x9d1d('0x13')],_0x594a4b);_0x412eb0(_0x3d6008[_0x9d1d('0x12')](0x1f4,_0xa07e34['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index f8a2797..764299d 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 _0xa616=['getDescriptions','post','create','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xa616,0x1ae));var _0x6a61=function(_0xa89d9c,_0x375f83){_0xa89d9c=_0xa89d9c-0x0;var _0x2cfe5e=_0xa616[_0xa89d9c];return _0x2cfe5e;};'use strict';var multer=require(_0x6a61('0x0'));var util=require('util');var path=require(_0x6a61('0x1'));var timeout=require(_0x6a61('0x2'));var express=require(_0x6a61('0x3'));var router=express[_0x6a61('0x4')]();var fs_extra=require(_0x6a61('0x5'));var auth=require(_0x6a61('0x6'));var interaction=require(_0x6a61('0x7'));var config=require(_0x6a61('0x8'));var controller=require(_0x6a61('0x9'));router[_0x6a61('0xa')]('/',auth['isAuthenticated'](),controller[_0x6a61('0xb')]);router['get'](_0x6a61('0xc'),auth[_0x6a61('0xd')](),controller[_0x6a61('0xe')]);router[_0x6a61('0xa')](_0x6a61('0xf'),auth[_0x6a61('0xd')](),controller[_0x6a61('0x10')]);router[_0x6a61('0xa')](_0x6a61('0x11'),auth[_0x6a61('0xd')](),controller[_0x6a61('0x12')]);router[_0x6a61('0xa')](_0x6a61('0x13'),auth[_0x6a61('0xd')](),controller[_0x6a61('0x14')]);router[_0x6a61('0x15')]('/',auth[_0x6a61('0xd')](),controller[_0x6a61('0x16')]);router['put'](_0x6a61('0xc'),auth[_0x6a61('0xd')](),controller['update']);router['delete'](_0x6a61('0xc'),auth['isAuthenticated'](),controller[_0x6a61('0x17')]);module[_0x6a61('0x18')]=router; \ No newline at end of file +var _0x53c7=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','create','delete','destroy'];(function(_0x30f2d1,_0x5710ac){var _0x44605d=function(_0x46d60b){while(--_0x46d60b){_0x30f2d1['push'](_0x30f2d1['shift']());}};_0x44605d(++_0x5710ac);}(_0x53c7,0x191));var _0x753c=function(_0x4b7802,_0x42e9c1){_0x4b7802=_0x4b7802-0x0;var _0x505a7f=_0x53c7[_0x4b7802];return _0x505a7f;};'use strict';var multer=require(_0x753c('0x0'));var util=require('util');var path=require(_0x753c('0x1'));var timeout=require(_0x753c('0x2'));var express=require(_0x753c('0x3'));var router=express[_0x753c('0x4')]();var fs_extra=require(_0x753c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x753c('0x6'));var controller=require(_0x753c('0x7'));router[_0x753c('0x8')]('/',auth[_0x753c('0x9')](),controller['index']);router[_0x753c('0x8')](_0x753c('0xa'),auth[_0x753c('0x9')](),controller[_0x753c('0xb')]);router[_0x753c('0x8')](_0x753c('0xc'),auth[_0x753c('0x9')](),controller[_0x753c('0xd')]);router[_0x753c('0x8')]('/:id/subjects',auth[_0x753c('0x9')](),controller[_0x753c('0xe')]);router[_0x753c('0x8')](_0x753c('0xf'),auth[_0x753c('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0x753c('0x9')](),controller[_0x753c('0x10')]);router['put']('/:id',auth[_0x753c('0x9')](),controller['update']);router[_0x753c('0x11')](_0x753c('0xa'),auth['isAuthenticated'](),controller[_0x753c('0x12')]);module[_0x753c('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 3835a5b..c9d477a 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 _0xf364=['STRING','exports'];(function(_0x4c589f,_0x37ff18){var _0xbf2358=function(_0x1b23e1){while(--_0x1b23e1){_0x4c589f['push'](_0x4c589f['shift']());}};_0xbf2358(++_0x37ff18);}(_0xf364,0x1db));var _0x4f36=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xf364[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require('sequelize');module[_0x4f36('0x0')]={'name':{'type':Sequelize[_0x4f36('0x1')]},'description':{'type':Sequelize[_0x4f36('0x1')]}}; \ No newline at end of file +var _0xfa40=['exports','STRING','sequelize'];(function(_0x3f7407,_0x3692a1){var _0x2bc899=function(_0x5b8924){while(--_0x5b8924){_0x3f7407['push'](_0x3f7407['shift']());}};_0x2bc899(++_0x3692a1);}(_0xfa40,0x119));var _0x0fa4=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xfa40[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x0fa4('0x0'));module[_0x0fa4('0x1')]={'name':{'type':Sequelize[_0x0fa4('0x2')]},'description':{'type':Sequelize[_0x0fa4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 493bf7e..f9b25bb 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 _0xda17=['destroy','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','merge','find','create','catch','body','params','findOne','getFields','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then'];(function(_0x1044e5,_0x498e01){var _0x5ad0dd=function(_0x458548){while(--_0x458548){_0x1044e5['push'](_0x1044e5['shift']());}};_0x5ad0dd(++_0x498e01);}(_0xda17,0x79));var _0x7da1=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xda17[_0x618414];return _0x21c19a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7da1('0x0'));var zipdir=require(_0x7da1('0x1'));var jsonpatch=require(_0x7da1('0x2'));var rp=require(_0x7da1('0x3'));var moment=require(_0x7da1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7da1('0x5'));var util=require(_0x7da1('0x6'));var path=require(_0x7da1('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7da1('0x8'));var fs=require('fs');var fs_extra=require(_0x7da1('0x9'));var _=require(_0x7da1('0xa'));var squel=require(_0x7da1('0xb'));var crypto=require(_0x7da1('0xc'));var jsforce=require(_0x7da1('0xd'));var deskjs=require(_0x7da1('0xe'));var toCsv=require(_0x7da1('0xf'));var querystring=require(_0x7da1('0x10'));var Papa=require(_0x7da1('0x11'));var Redis=require('ioredis');var authService=require(_0x7da1('0x12'));var qs=require(_0x7da1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7da1('0x14'));var config=require(_0x7da1('0x15'));var licenseUtil=require(_0x7da1('0x16'));var db=require(_0x7da1('0x17'))['db'];function respondWithStatusCode(_0x21af27,_0x4a86bd){_0x4a86bd=_0x4a86bd||0xcc;return function(_0x36c2eb){if(_0x36c2eb){return _0x21af27[_0x7da1('0x18')](_0x4a86bd);}return _0x21af27[_0x7da1('0x19')](_0x4a86bd)[_0x7da1('0x1a')]();};}function respondWithResult(_0x5230a4,_0x58bb94){_0x58bb94=_0x58bb94||0xc8;return function(_0x50b599){if(_0x50b599){return _0x5230a4[_0x7da1('0x19')](_0x58bb94)[_0x7da1('0x1b')](_0x50b599);}};}function respondWithFilteredResult(_0x52348f,_0x269e45){return function(_0x381f24){if(_0x381f24){var _0x2ebfce=typeof _0x269e45[_0x7da1('0x1c')]===_0x7da1('0x1d')&&typeof _0x269e45['limit']===_0x7da1('0x1d');var _0x3acf26=_0x381f24[_0x7da1('0x1e')];var _0x1a14a4=_0x2ebfce?0x0:_0x269e45[_0x7da1('0x1c')];var _0x2951d3=_0x2ebfce?_0x381f24[_0x7da1('0x1e')]:_0x269e45['offset']+_0x269e45[_0x7da1('0x1f')];var _0x2f18bc;if(_0x2951d3>=_0x3acf26){_0x2951d3=_0x3acf26;_0x2f18bc=0xc8;}else{_0x2f18bc=0xce;}_0x52348f[_0x7da1('0x19')](_0x2f18bc);return _0x52348f['set'](_0x7da1('0x20'),_0x1a14a4+'-'+_0x2951d3+'/'+_0x3acf26)[_0x7da1('0x1b')](_0x381f24);}return null;};}function patchUpdates(_0x482bf9){return function(_0x3cc613){try{jsonpatch['apply'](_0x3cc613,_0x482bf9,!![]);}catch(_0xf5495e){return BPromise[_0x7da1('0x21')](_0xf5495e);}return _0x3cc613[_0x7da1('0x22')]();};}function saveUpdates(_0x4a872a,_0x38cebb){return function(_0x35de45){if(_0x35de45){return _0x35de45[_0x7da1('0x23')](_0x4a872a)[_0x7da1('0x24')](function(_0xacd84a){return _0xacd84a;});}return null;};}function removeEntity(_0x4de35c,_0x27553e){return function(_0x4ef089){if(_0x4ef089){return _0x4ef089[_0x7da1('0x25')]()[_0x7da1('0x24')](function(){_0x4de35c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x759d4c,_0x4e29bd){return function(_0x5c4f60){if(!_0x5c4f60){_0x759d4c[_0x7da1('0x18')](0x194);}return _0x5c4f60;};}function handleError(_0x4718a2,_0x2cd3f9){_0x2cd3f9=_0x2cd3f9||0x1f4;return function(_0x231ddb){logger[_0x7da1('0x26')](_0x231ddb[_0x7da1('0x27')]);if(_0x231ddb[_0x7da1('0x28')]){delete _0x231ddb[_0x7da1('0x28')];}_0x4718a2[_0x7da1('0x19')](_0x2cd3f9)[_0x7da1('0x29')](_0x231ddb);};}exports[_0x7da1('0x2a')]=function(_0xeaac1b,_0x11ddc2){var _0x1b4a25={},_0xda4906={},_0x4dc271={'count':0x0,'rows':[]};var _0x115106=_[_0x7da1('0x2b')](db[_0x7da1('0x2c')][_0x7da1('0x2d')],function(_0x4c2218){return{'name':_0x4c2218[_0x7da1('0x2e')],'type':_0x4c2218['type'][_0x7da1('0x2f')]};});_0xda4906['model']=_[_0x7da1('0x2b')](_0x115106,_0x7da1('0x28'));_0xda4906['query']=_[_0x7da1('0x30')](_0xeaac1b[_0x7da1('0x31')]);_0xda4906[_0x7da1('0x32')]=_[_0x7da1('0x33')](_0xda4906[_0x7da1('0x34')],_0xda4906['query']);_0x1b4a25['attributes']=_[_0x7da1('0x33')](_0xda4906[_0x7da1('0x34')],qs['fields'](_0xeaac1b[_0x7da1('0x31')][_0x7da1('0x35')]));_0x1b4a25['attributes']=_0x1b4a25[_0x7da1('0x36')][_0x7da1('0x37')]?_0x1b4a25[_0x7da1('0x36')]:_0xda4906[_0x7da1('0x34')];if(!_0xeaac1b[_0x7da1('0x31')][_0x7da1('0x38')](_0x7da1('0x39'))){_0x1b4a25[_0x7da1('0x1f')]=qs[_0x7da1('0x1f')](_0xeaac1b[_0x7da1('0x31')][_0x7da1('0x1f')]);_0x1b4a25[_0x7da1('0x1c')]=qs[_0x7da1('0x1c')](_0xeaac1b['query'][_0x7da1('0x1c')]);}_0x1b4a25[_0x7da1('0x3a')]=qs[_0x7da1('0x3b')](_0xeaac1b[_0x7da1('0x31')][_0x7da1('0x3b')]);_0x1b4a25[_0x7da1('0x3c')]=qs['filters'](_[_0x7da1('0x3d')](_0xeaac1b['query'],_0xda4906[_0x7da1('0x32')]),_0x115106);if(_0xeaac1b[_0x7da1('0x31')][_0x7da1('0x3e')]){_0x1b4a25[_0x7da1('0x3c')]=_['merge'](_0x1b4a25[_0x7da1('0x3c')],{'$or':_[_0x7da1('0x2b')](_0x115106,function(_0x31f840){if(_0x31f840[_0x7da1('0x3f')]!==_0x7da1('0x40')){var _0x16a7e4={};_0x16a7e4[_0x31f840[_0x7da1('0x28')]]={'$like':'%'+_0xeaac1b['query'][_0x7da1('0x3e')]+'%'};return _0x16a7e4;}})});}_0x1b4a25=_['merge']({},_0x1b4a25,_0xeaac1b[_0x7da1('0x41')]);var _0x35fc54={'where':_0x1b4a25[_0x7da1('0x3c')]};return db[_0x7da1('0x2c')][_0x7da1('0x1e')](_0x35fc54)[_0x7da1('0x24')](function(_0x5b69d7){_0x4dc271['count']=_0x5b69d7;if(_0xeaac1b[_0x7da1('0x31')][_0x7da1('0x42')]){_0x1b4a25[_0x7da1('0x43')]=[{'all':!![]}];}return db[_0x7da1('0x2c')][_0x7da1('0x44')](_0x1b4a25);})['then'](function(_0x18ee3c){_0x4dc271[_0x7da1('0x45')]=_0x18ee3c;return _0x4dc271;})['then'](respondWithFilteredResult(_0x11ddc2,_0x1b4a25))['catch'](handleError(_0x11ddc2,null));};exports['show']=function(_0x42aa82,_0x3fccb0){var _0x19baaa={'raw':![],'where':{'id':_0x42aa82['params']['id']}},_0x66cd3b={};_0x66cd3b[_0x7da1('0x34')]=_[_0x7da1('0x30')](db['SugarcrmConfiguration']['rawAttributes']);_0x66cd3b[_0x7da1('0x31')]=_[_0x7da1('0x30')](_0x42aa82[_0x7da1('0x31')]);_0x66cd3b['filters']=_[_0x7da1('0x33')](_0x66cd3b[_0x7da1('0x34')],_0x66cd3b['query']);_0x19baaa[_0x7da1('0x36')]=_[_0x7da1('0x33')](_0x66cd3b['model'],qs[_0x7da1('0x35')](_0x42aa82[_0x7da1('0x31')][_0x7da1('0x35')]));_0x19baaa[_0x7da1('0x36')]=_0x19baaa['attributes']['length']?_0x19baaa[_0x7da1('0x36')]:_0x66cd3b['model'];if(_0x42aa82[_0x7da1('0x31')]['includeAll']){_0x19baaa['include']=[{'all':!![]}];}_0x19baaa=_[_0x7da1('0x46')]({},_0x19baaa,_0x42aa82['options']);return db[_0x7da1('0x2c')][_0x7da1('0x47')](_0x19baaa)[_0x7da1('0x24')](handleEntityNotFound(_0x3fccb0,null))['then'](respondWithResult(_0x3fccb0,null))['catch'](handleError(_0x3fccb0,null));};exports[_0x7da1('0x48')]=function(_0x4afaf8,_0x2f9b68){return db[_0x7da1('0x2c')]['create'](_0x4afaf8['body'],{})[_0x7da1('0x24')](respondWithResult(_0x2f9b68,0xc9))[_0x7da1('0x49')](handleError(_0x2f9b68,null));};exports['update']=function(_0x47aab3,_0x4123bc){if(_0x47aab3[_0x7da1('0x4a')]['id']){delete _0x47aab3[_0x7da1('0x4a')]['id'];}return db['SugarcrmConfiguration'][_0x7da1('0x47')]({'where':{'id':_0x47aab3[_0x7da1('0x4b')]['id']}})[_0x7da1('0x24')](handleEntityNotFound(_0x4123bc,null))[_0x7da1('0x24')](saveUpdates(_0x47aab3[_0x7da1('0x4a')],null))[_0x7da1('0x24')](respondWithResult(_0x4123bc,null))[_0x7da1('0x49')](handleError(_0x4123bc,null));};exports[_0x7da1('0x25')]=function(_0x52fd8c,_0x58ec74){return db[_0x7da1('0x2c')]['find']({'where':{'id':_0x52fd8c['params']['id']}})[_0x7da1('0x24')](handleEntityNotFound(_0x58ec74,null))[_0x7da1('0x24')](removeEntity(_0x58ec74,null))[_0x7da1('0x49')](handleError(_0x58ec74,null));};exports['getFields']=function(_0x4eac5b,_0x5a55c0,_0x498bf6){var _0x206deb={};var _0x3b3c0e={};var _0x3428bc;var _0x5f44ae;return db['SugarcrmConfiguration'][_0x7da1('0x4c')]({'where':{'id':_0x4eac5b['params']['id']}})[_0x7da1('0x24')](handleEntityNotFound(_0x5a55c0,null))[_0x7da1('0x24')](function(_0x2c66e6){if(_0x2c66e6){_0x3428bc=_0x2c66e6;_0x3b3c0e[_0x7da1('0x34')]=_[_0x7da1('0x30')](db['SugarcrmField'][_0x7da1('0x2d')]);_0x3b3c0e[_0x7da1('0x31')]=_[_0x7da1('0x30')](_0x4eac5b[_0x7da1('0x31')]);_0x3b3c0e[_0x7da1('0x32')]=_['intersection'](_0x3b3c0e[_0x7da1('0x34')],_0x3b3c0e[_0x7da1('0x31')]);_0x206deb['attributes']=_['intersection'](_0x3b3c0e['model'],qs['fields'](_0x4eac5b[_0x7da1('0x31')][_0x7da1('0x35')]));_0x206deb[_0x7da1('0x36')]=_0x206deb['attributes'][_0x7da1('0x37')]?_0x206deb['attributes']:_0x3b3c0e['model'];_0x206deb[_0x7da1('0x3a')]=qs[_0x7da1('0x3b')](_0x4eac5b['query'][_0x7da1('0x3b')]);_0x206deb[_0x7da1('0x3c')]=qs['filters'](_[_0x7da1('0x3d')](_0x4eac5b[_0x7da1('0x31')],_0x3b3c0e[_0x7da1('0x32')]));if(_0x4eac5b['query']['filter']){_0x206deb[_0x7da1('0x3c')]=_[_0x7da1('0x46')](_0x206deb[_0x7da1('0x3c')],{'$or':_[_0x7da1('0x2b')](_0x206deb[_0x7da1('0x36')],function(_0x45b1cc){var _0x2d8084={};_0x2d8084[_0x45b1cc]={'$like':'%'+_0x4eac5b[_0x7da1('0x31')][_0x7da1('0x3e')]+'%'};return _0x2d8084;})});}_0x206deb=_[_0x7da1('0x46')]({},_0x206deb,_0x4eac5b[_0x7da1('0x41')]);return _0x3428bc[_0x7da1('0x4d')](_0x206deb);}})[_0x7da1('0x24')](function(_0x2f89cf){if(_0x2f89cf){_0x5f44ae=_0x2f89cf[_0x7da1('0x37')];if(!_0x4eac5b[_0x7da1('0x31')][_0x7da1('0x38')](_0x7da1('0x39'))){_0x206deb['limit']=qs[_0x7da1('0x1f')](_0x4eac5b[_0x7da1('0x31')][_0x7da1('0x1f')]);_0x206deb[_0x7da1('0x1c')]=qs[_0x7da1('0x1c')](_0x4eac5b[_0x7da1('0x31')]['offset']);}return _0x3428bc[_0x7da1('0x4d')](_0x206deb);}})[_0x7da1('0x24')](function(_0x545ff7){if(_0x545ff7){return _0x545ff7?{'count':_0x5f44ae,'rows':_0x545ff7}:null;}})[_0x7da1('0x24')](respondWithResult(_0x5a55c0,null))[_0x7da1('0x49')](handleError(_0x5a55c0,null));};exports['getSubjects']=function(_0x1c6e24,_0xeeaf05,_0xf580){var _0x4d8f30={};var _0x21753c={};var _0x53ea32;var _0x551f11;return db[_0x7da1('0x2c')]['findOne']({'where':{'id':_0x1c6e24[_0x7da1('0x4b')]['id']}})[_0x7da1('0x24')](handleEntityNotFound(_0xeeaf05,null))['then'](function(_0x1d395f){if(_0x1d395f){_0x53ea32=_0x1d395f;_0x21753c[_0x7da1('0x34')]=_[_0x7da1('0x30')](db['SugarcrmField'][_0x7da1('0x2d')]);_0x21753c[_0x7da1('0x31')]=_['keys'](_0x1c6e24[_0x7da1('0x31')]);_0x21753c[_0x7da1('0x32')]=_[_0x7da1('0x33')](_0x21753c[_0x7da1('0x34')],_0x21753c[_0x7da1('0x31')]);_0x4d8f30['attributes']=_['intersection'](_0x21753c[_0x7da1('0x34')],qs[_0x7da1('0x35')](_0x1c6e24['query'][_0x7da1('0x35')]));_0x4d8f30['attributes']=_0x4d8f30['attributes']['length']?_0x4d8f30[_0x7da1('0x36')]:_0x21753c[_0x7da1('0x34')];_0x4d8f30[_0x7da1('0x3a')]=qs[_0x7da1('0x3b')](_0x1c6e24['query'][_0x7da1('0x3b')]);_0x4d8f30[_0x7da1('0x3c')]=qs[_0x7da1('0x32')](_[_0x7da1('0x3d')](_0x1c6e24[_0x7da1('0x31')],_0x21753c['filters']));if(_0x1c6e24['query'][_0x7da1('0x3e')]){_0x4d8f30['where']=_['merge'](_0x4d8f30[_0x7da1('0x3c')],{'$or':_['map'](_0x4d8f30[_0x7da1('0x36')],function(_0x3767ac){var _0x48304e={};_0x48304e[_0x3767ac]={'$like':'%'+_0x1c6e24['query'][_0x7da1('0x3e')]+'%'};return _0x48304e;})});}_0x4d8f30=_['merge']({},_0x4d8f30,_0x1c6e24[_0x7da1('0x41')]);return _0x53ea32['getSubjects'](_0x4d8f30);}})[_0x7da1('0x24')](function(_0x2c9db4){if(_0x2c9db4){_0x551f11=_0x2c9db4['length'];if(!_0x1c6e24[_0x7da1('0x31')]['hasOwnProperty'](_0x7da1('0x39'))){_0x4d8f30[_0x7da1('0x1f')]=qs[_0x7da1('0x1f')](_0x1c6e24[_0x7da1('0x31')][_0x7da1('0x1f')]);_0x4d8f30[_0x7da1('0x1c')]=qs[_0x7da1('0x1c')](_0x1c6e24['query'][_0x7da1('0x1c')]);}return _0x53ea32['getSubjects'](_0x4d8f30);}})[_0x7da1('0x24')](function(_0x1b9d7d){if(_0x1b9d7d){return _0x1b9d7d?{'count':_0x551f11,'rows':_0x1b9d7d}:null;}})[_0x7da1('0x24')](respondWithResult(_0xeeaf05,null))[_0x7da1('0x49')](handleError(_0xeeaf05,null));};exports[_0x7da1('0x4e')]=function(_0x53e950,_0x3a748e,_0x4ca7cd){var _0x3a7384={};var _0x364468={};var _0xa7362a;var _0x5d9ea0;return db[_0x7da1('0x2c')][_0x7da1('0x4c')]({'where':{'id':_0x53e950[_0x7da1('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3a748e,null))[_0x7da1('0x24')](function(_0x44c143){if(_0x44c143){_0xa7362a=_0x44c143;_0x364468[_0x7da1('0x34')]=_[_0x7da1('0x30')](db['SugarcrmField']['rawAttributes']);_0x364468[_0x7da1('0x31')]=_[_0x7da1('0x30')](_0x53e950['query']);_0x364468[_0x7da1('0x32')]=_[_0x7da1('0x33')](_0x364468[_0x7da1('0x34')],_0x364468[_0x7da1('0x31')]);_0x3a7384[_0x7da1('0x36')]=_[_0x7da1('0x33')](_0x364468[_0x7da1('0x34')],qs['fields'](_0x53e950[_0x7da1('0x31')][_0x7da1('0x35')]));_0x3a7384['attributes']=_0x3a7384[_0x7da1('0x36')][_0x7da1('0x37')]?_0x3a7384[_0x7da1('0x36')]:_0x364468['model'];_0x3a7384['order']=qs[_0x7da1('0x3b')](_0x53e950[_0x7da1('0x31')][_0x7da1('0x3b')]);_0x3a7384['where']=qs[_0x7da1('0x32')](_[_0x7da1('0x3d')](_0x53e950[_0x7da1('0x31')],_0x364468[_0x7da1('0x32')]));if(_0x53e950[_0x7da1('0x31')]['filter']){_0x3a7384['where']=_[_0x7da1('0x46')](_0x3a7384[_0x7da1('0x3c')],{'$or':_[_0x7da1('0x2b')](_0x3a7384[_0x7da1('0x36')],function(_0x43ec7){var _0xbc71e1={};_0xbc71e1[_0x43ec7]={'$like':'%'+_0x53e950[_0x7da1('0x31')][_0x7da1('0x3e')]+'%'};return _0xbc71e1;})});}_0x3a7384=_[_0x7da1('0x46')]({},_0x3a7384,_0x53e950[_0x7da1('0x41')]);return _0xa7362a[_0x7da1('0x4e')](_0x3a7384);}})[_0x7da1('0x24')](function(_0xaaabc2){if(_0xaaabc2){_0x5d9ea0=_0xaaabc2['length'];if(!_0x53e950[_0x7da1('0x31')][_0x7da1('0x38')]('nolimit')){_0x3a7384[_0x7da1('0x1f')]=qs[_0x7da1('0x1f')](_0x53e950[_0x7da1('0x31')]['limit']);_0x3a7384[_0x7da1('0x1c')]=qs['offset'](_0x53e950[_0x7da1('0x31')]['offset']);}return _0xa7362a['getDescriptions'](_0x3a7384);}})[_0x7da1('0x24')](function(_0x599ed0){if(_0x599ed0){return _0x599ed0?{'count':_0x5d9ea0,'rows':_0x599ed0}:null;}})[_0x7da1('0x24')](respondWithResult(_0x3a748e,null))[_0x7da1('0x49')](handleError(_0x3a748e,null));}; \ No newline at end of file +var _0x50b7=['find','create','body','getFields','findOne','SugarcrmField','pick','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','end','name','send','index','SugarcrmConfiguration','rawAttributes','type','model','map','query','keys','attributes','intersection','fields','length','order','sort','where','filters','filter','merge','options','include','findAll','catch','show','params','includeAll'];(function(_0x401bc1,_0x593774){var _0x531154=function(_0x4ce8f8){while(--_0x4ce8f8){_0x401bc1['push'](_0x401bc1['shift']());}};_0x531154(++_0x593774);}(_0x50b7,0x16e));var _0x750b=function(_0x208223,_0x369914){_0x208223=_0x208223-0x0;var _0xaa5608=_0x50b7[_0x208223];return _0xaa5608;};'use strict';var emlformat=require(_0x750b('0x0'));var rimraf=require(_0x750b('0x1'));var zipdir=require(_0x750b('0x2'));var jsonpatch=require(_0x750b('0x3'));var rp=require(_0x750b('0x4'));var moment=require(_0x750b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x750b('0x6'));var util=require('util');var path=require(_0x750b('0x7'));var sox=require('sox');var csv=require(_0x750b('0x8'));var ejs=require(_0x750b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x750b('0xa'));var squel=require(_0x750b('0xb'));var crypto=require(_0x750b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x750b('0xd'));var toCsv=require(_0x750b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x750b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x750b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x750b('0x10'));var logger=require('../../config/logger')(_0x750b('0x11'));var utils=require(_0x750b('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b2b5a,_0x378814){_0x378814=_0x378814||0xcc;return function(_0x3f27c5){if(_0x3f27c5){return _0x4b2b5a[_0x750b('0x13')](_0x378814);}return _0x4b2b5a[_0x750b('0x14')](_0x378814)['end']();};}function respondWithResult(_0x4b315d,_0x39f982){_0x39f982=_0x39f982||0xc8;return function(_0x206a1c){if(_0x206a1c){return _0x4b315d[_0x750b('0x14')](_0x39f982)[_0x750b('0x15')](_0x206a1c);}};}function respondWithFilteredResult(_0x2505dc,_0x19da27){return function(_0x3a77a1){if(_0x3a77a1){var _0x252c1a=typeof _0x19da27[_0x750b('0x16')]===_0x750b('0x17')&&typeof _0x19da27[_0x750b('0x18')]===_0x750b('0x17');var _0x5389d3=_0x3a77a1[_0x750b('0x19')];var _0x3a2800=_0x252c1a?0x0:_0x19da27[_0x750b('0x16')];var _0x38ecc0=_0x252c1a?_0x3a77a1[_0x750b('0x19')]:_0x19da27[_0x750b('0x16')]+_0x19da27[_0x750b('0x18')];var _0x5c625d;if(_0x38ecc0>=_0x5389d3){_0x38ecc0=_0x5389d3;_0x5c625d=0xc8;}else{_0x5c625d=0xce;}_0x2505dc[_0x750b('0x14')](_0x5c625d);return _0x2505dc[_0x750b('0x1a')]('Content-Range',_0x3a2800+'-'+_0x38ecc0+'/'+_0x5389d3)['json'](_0x3a77a1);}return null;};}function patchUpdates(_0xf2019b){return function(_0x8a38ca){try{jsonpatch[_0x750b('0x1b')](_0x8a38ca,_0xf2019b,!![]);}catch(_0x5e2fd7){return BPromise['reject'](_0x5e2fd7);}return _0x8a38ca[_0x750b('0x1c')]();};}function saveUpdates(_0x3bc8e7,_0x1dfdee){return function(_0x425a0c){if(_0x425a0c){return _0x425a0c[_0x750b('0x1d')](_0x3bc8e7)['then'](function(_0x1cc7ba){return _0x1cc7ba;});}return null;};}function removeEntity(_0x4a935b,_0x1a5c06){return function(_0x5baa71){if(_0x5baa71){return _0x5baa71[_0x750b('0x1e')]()[_0x750b('0x1f')](function(){_0x4a935b['status'](0xcc)[_0x750b('0x20')]();});}};}function handleEntityNotFound(_0x5cac2e,_0x3fbfbf){return function(_0x592b){if(!_0x592b){_0x5cac2e['sendStatus'](0x194);}return _0x592b;};}function handleError(_0x7b1af8,_0x3f9175){_0x3f9175=_0x3f9175||0x1f4;return function(_0x532f05){logger['error'](_0x532f05['stack']);if(_0x532f05[_0x750b('0x21')]){delete _0x532f05[_0x750b('0x21')];}_0x7b1af8['status'](_0x3f9175)[_0x750b('0x22')](_0x532f05);};}exports[_0x750b('0x23')]=function(_0x684df7,_0x4b0d5c){var _0x870e43={},_0x29ce1f={},_0x2534d7={'count':0x0,'rows':[]};var _0x32e994=_['map'](db[_0x750b('0x24')][_0x750b('0x25')],function(_0x28deaa){return{'name':_0x28deaa['fieldName'],'type':_0x28deaa[_0x750b('0x26')]['key']};});_0x29ce1f[_0x750b('0x27')]=_[_0x750b('0x28')](_0x32e994,_0x750b('0x21'));_0x29ce1f[_0x750b('0x29')]=_[_0x750b('0x2a')](_0x684df7[_0x750b('0x29')]);_0x29ce1f['filters']=_['intersection'](_0x29ce1f['model'],_0x29ce1f[_0x750b('0x29')]);_0x870e43[_0x750b('0x2b')]=_[_0x750b('0x2c')](_0x29ce1f[_0x750b('0x27')],qs[_0x750b('0x2d')](_0x684df7[_0x750b('0x29')][_0x750b('0x2d')]));_0x870e43[_0x750b('0x2b')]=_0x870e43['attributes'][_0x750b('0x2e')]?_0x870e43['attributes']:_0x29ce1f[_0x750b('0x27')];if(!_0x684df7[_0x750b('0x29')]['hasOwnProperty']('nolimit')){_0x870e43[_0x750b('0x18')]=qs[_0x750b('0x18')](_0x684df7['query'][_0x750b('0x18')]);_0x870e43[_0x750b('0x16')]=qs['offset'](_0x684df7['query'][_0x750b('0x16')]);}_0x870e43[_0x750b('0x2f')]=qs[_0x750b('0x30')](_0x684df7[_0x750b('0x29')][_0x750b('0x30')]);_0x870e43[_0x750b('0x31')]=qs[_0x750b('0x32')](_['pick'](_0x684df7[_0x750b('0x29')],_0x29ce1f[_0x750b('0x32')]),_0x32e994);if(_0x684df7[_0x750b('0x29')][_0x750b('0x33')]){_0x870e43[_0x750b('0x31')]=_['merge'](_0x870e43[_0x750b('0x31')],{'$or':_[_0x750b('0x28')](_0x32e994,function(_0x3598ec){if(_0x3598ec[_0x750b('0x26')]!=='VIRTUAL'){var _0x5d9421={};_0x5d9421[_0x3598ec[_0x750b('0x21')]]={'$like':'%'+_0x684df7[_0x750b('0x29')][_0x750b('0x33')]+'%'};return _0x5d9421;}})});}_0x870e43=_[_0x750b('0x34')]({},_0x870e43,_0x684df7[_0x750b('0x35')]);var _0x565dff={'where':_0x870e43[_0x750b('0x31')]};return db[_0x750b('0x24')][_0x750b('0x19')](_0x565dff)[_0x750b('0x1f')](function(_0x24ebc0){_0x2534d7['count']=_0x24ebc0;if(_0x684df7[_0x750b('0x29')]['includeAll']){_0x870e43[_0x750b('0x36')]=[{'all':!![]}];}return db[_0x750b('0x24')][_0x750b('0x37')](_0x870e43);})['then'](function(_0xc51bad){_0x2534d7['rows']=_0xc51bad;return _0x2534d7;})[_0x750b('0x1f')](respondWithFilteredResult(_0x4b0d5c,_0x870e43))[_0x750b('0x38')](handleError(_0x4b0d5c,null));};exports[_0x750b('0x39')]=function(_0x24459e,_0x1070be){var _0x33a0a5={'raw':![],'where':{'id':_0x24459e[_0x750b('0x3a')]['id']}},_0x38cb2d={};_0x38cb2d[_0x750b('0x27')]=_[_0x750b('0x2a')](db[_0x750b('0x24')]['rawAttributes']);_0x38cb2d[_0x750b('0x29')]=_[_0x750b('0x2a')](_0x24459e[_0x750b('0x29')]);_0x38cb2d[_0x750b('0x32')]=_['intersection'](_0x38cb2d[_0x750b('0x27')],_0x38cb2d[_0x750b('0x29')]);_0x33a0a5[_0x750b('0x2b')]=_[_0x750b('0x2c')](_0x38cb2d[_0x750b('0x27')],qs[_0x750b('0x2d')](_0x24459e[_0x750b('0x29')]['fields']));_0x33a0a5[_0x750b('0x2b')]=_0x33a0a5[_0x750b('0x2b')]['length']?_0x33a0a5['attributes']:_0x38cb2d[_0x750b('0x27')];if(_0x24459e[_0x750b('0x29')][_0x750b('0x3b')]){_0x33a0a5[_0x750b('0x36')]=[{'all':!![]}];}_0x33a0a5=_[_0x750b('0x34')]({},_0x33a0a5,_0x24459e[_0x750b('0x35')]);return db[_0x750b('0x24')][_0x750b('0x3c')](_0x33a0a5)[_0x750b('0x1f')](handleEntityNotFound(_0x1070be,null))['then'](respondWithResult(_0x1070be,null))[_0x750b('0x38')](handleError(_0x1070be,null));};exports[_0x750b('0x3d')]=function(_0x134873,_0x47dfdb){return db[_0x750b('0x24')][_0x750b('0x3d')](_0x134873[_0x750b('0x3e')],{})[_0x750b('0x1f')](respondWithResult(_0x47dfdb,0xc9))[_0x750b('0x38')](handleError(_0x47dfdb,null));};exports[_0x750b('0x1d')]=function(_0x27740d,_0x4e1ae3){if(_0x27740d[_0x750b('0x3e')]['id']){delete _0x27740d[_0x750b('0x3e')]['id'];}return db[_0x750b('0x24')][_0x750b('0x3c')]({'where':{'id':_0x27740d[_0x750b('0x3a')]['id']}})[_0x750b('0x1f')](handleEntityNotFound(_0x4e1ae3,null))[_0x750b('0x1f')](saveUpdates(_0x27740d[_0x750b('0x3e')],null))['then'](respondWithResult(_0x4e1ae3,null))[_0x750b('0x38')](handleError(_0x4e1ae3,null));};exports[_0x750b('0x1e')]=function(_0xbe94bc,_0x59d2d7){return db[_0x750b('0x24')]['find']({'where':{'id':_0xbe94bc['params']['id']}})['then'](handleEntityNotFound(_0x59d2d7,null))[_0x750b('0x1f')](removeEntity(_0x59d2d7,null))[_0x750b('0x38')](handleError(_0x59d2d7,null));};exports[_0x750b('0x3f')]=function(_0xe2e4,_0x4249a2,_0x5a7b6d){var _0x399285={};var _0x3a5912={};var _0x1c6d47;var _0x49bb5e;return db[_0x750b('0x24')][_0x750b('0x40')]({'where':{'id':_0xe2e4[_0x750b('0x3a')]['id']}})[_0x750b('0x1f')](handleEntityNotFound(_0x4249a2,null))[_0x750b('0x1f')](function(_0x23798a){if(_0x23798a){_0x1c6d47=_0x23798a;_0x3a5912[_0x750b('0x27')]=_[_0x750b('0x2a')](db[_0x750b('0x41')]['rawAttributes']);_0x3a5912['query']=_['keys'](_0xe2e4[_0x750b('0x29')]);_0x3a5912[_0x750b('0x32')]=_[_0x750b('0x2c')](_0x3a5912['model'],_0x3a5912[_0x750b('0x29')]);_0x399285['attributes']=_[_0x750b('0x2c')](_0x3a5912['model'],qs[_0x750b('0x2d')](_0xe2e4[_0x750b('0x29')][_0x750b('0x2d')]));_0x399285[_0x750b('0x2b')]=_0x399285[_0x750b('0x2b')][_0x750b('0x2e')]?_0x399285[_0x750b('0x2b')]:_0x3a5912[_0x750b('0x27')];_0x399285[_0x750b('0x2f')]=qs[_0x750b('0x30')](_0xe2e4[_0x750b('0x29')][_0x750b('0x30')]);_0x399285[_0x750b('0x31')]=qs['filters'](_[_0x750b('0x42')](_0xe2e4[_0x750b('0x29')],_0x3a5912[_0x750b('0x32')]));if(_0xe2e4[_0x750b('0x29')][_0x750b('0x33')]){_0x399285[_0x750b('0x31')]=_['merge'](_0x399285[_0x750b('0x31')],{'$or':_[_0x750b('0x28')](_0x399285['attributes'],function(_0x2ed8f4){var _0x316a31={};_0x316a31[_0x2ed8f4]={'$like':'%'+_0xe2e4[_0x750b('0x29')][_0x750b('0x33')]+'%'};return _0x316a31;})});}_0x399285=_[_0x750b('0x34')]({},_0x399285,_0xe2e4[_0x750b('0x35')]);return _0x1c6d47[_0x750b('0x3f')](_0x399285);}})['then'](function(_0x270610){if(_0x270610){_0x49bb5e=_0x270610['length'];if(!_0xe2e4[_0x750b('0x29')][_0x750b('0x43')](_0x750b('0x44'))){_0x399285[_0x750b('0x18')]=qs[_0x750b('0x18')](_0xe2e4[_0x750b('0x29')]['limit']);_0x399285[_0x750b('0x16')]=qs['offset'](_0xe2e4['query'][_0x750b('0x16')]);}return _0x1c6d47['getFields'](_0x399285);}})['then'](function(_0x12a327){if(_0x12a327){return _0x12a327?{'count':_0x49bb5e,'rows':_0x12a327}:null;}})[_0x750b('0x1f')](respondWithResult(_0x4249a2,null))['catch'](handleError(_0x4249a2,null));};exports[_0x750b('0x45')]=function(_0x487e65,_0x1d1787,_0x5151d7){var _0x20caa9={};var _0x4ccb23={};var _0x24d26c;var _0x3d7178;return db[_0x750b('0x24')]['findOne']({'where':{'id':_0x487e65[_0x750b('0x3a')]['id']}})[_0x750b('0x1f')](handleEntityNotFound(_0x1d1787,null))[_0x750b('0x1f')](function(_0x3f8e3e){if(_0x3f8e3e){_0x24d26c=_0x3f8e3e;_0x4ccb23[_0x750b('0x27')]=_[_0x750b('0x2a')](db[_0x750b('0x41')][_0x750b('0x25')]);_0x4ccb23[_0x750b('0x29')]=_[_0x750b('0x2a')](_0x487e65['query']);_0x4ccb23[_0x750b('0x32')]=_[_0x750b('0x2c')](_0x4ccb23[_0x750b('0x27')],_0x4ccb23[_0x750b('0x29')]);_0x20caa9[_0x750b('0x2b')]=_[_0x750b('0x2c')](_0x4ccb23[_0x750b('0x27')],qs[_0x750b('0x2d')](_0x487e65['query'][_0x750b('0x2d')]));_0x20caa9[_0x750b('0x2b')]=_0x20caa9['attributes'][_0x750b('0x2e')]?_0x20caa9[_0x750b('0x2b')]:_0x4ccb23['model'];_0x20caa9[_0x750b('0x2f')]=qs[_0x750b('0x30')](_0x487e65[_0x750b('0x29')][_0x750b('0x30')]);_0x20caa9['where']=qs[_0x750b('0x32')](_[_0x750b('0x42')](_0x487e65['query'],_0x4ccb23['filters']));if(_0x487e65[_0x750b('0x29')]['filter']){_0x20caa9[_0x750b('0x31')]=_[_0x750b('0x34')](_0x20caa9[_0x750b('0x31')],{'$or':_[_0x750b('0x28')](_0x20caa9[_0x750b('0x2b')],function(_0x287635){var _0x5d7334={};_0x5d7334[_0x287635]={'$like':'%'+_0x487e65[_0x750b('0x29')][_0x750b('0x33')]+'%'};return _0x5d7334;})});}_0x20caa9=_[_0x750b('0x34')]({},_0x20caa9,_0x487e65[_0x750b('0x35')]);return _0x24d26c[_0x750b('0x45')](_0x20caa9);}})[_0x750b('0x1f')](function(_0x2f52eb){if(_0x2f52eb){_0x3d7178=_0x2f52eb[_0x750b('0x2e')];if(!_0x487e65['query'][_0x750b('0x43')](_0x750b('0x44'))){_0x20caa9[_0x750b('0x18')]=qs['limit'](_0x487e65[_0x750b('0x29')][_0x750b('0x18')]);_0x20caa9['offset']=qs['offset'](_0x487e65['query'][_0x750b('0x16')]);}return _0x24d26c[_0x750b('0x45')](_0x20caa9);}})[_0x750b('0x1f')](function(_0x44bd3f){if(_0x44bd3f){return _0x44bd3f?{'count':_0x3d7178,'rows':_0x44bd3f}:null;}})[_0x750b('0x1f')](respondWithResult(_0x1d1787,null))[_0x750b('0x38')](handleError(_0x1d1787,null));};exports[_0x750b('0x46')]=function(_0x31d4e5,_0x3d78a7,_0x5ddcde){var _0x240f37={};var _0xe26c3b={};var _0x13e878;var _0x3266a2;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x31d4e5[_0x750b('0x3a')]['id']}})[_0x750b('0x1f')](handleEntityNotFound(_0x3d78a7,null))['then'](function(_0x3762c2){if(_0x3762c2){_0x13e878=_0x3762c2;_0xe26c3b[_0x750b('0x27')]=_['keys'](db[_0x750b('0x41')][_0x750b('0x25')]);_0xe26c3b[_0x750b('0x29')]=_[_0x750b('0x2a')](_0x31d4e5[_0x750b('0x29')]);_0xe26c3b[_0x750b('0x32')]=_['intersection'](_0xe26c3b['model'],_0xe26c3b[_0x750b('0x29')]);_0x240f37[_0x750b('0x2b')]=_[_0x750b('0x2c')](_0xe26c3b['model'],qs[_0x750b('0x2d')](_0x31d4e5[_0x750b('0x29')][_0x750b('0x2d')]));_0x240f37[_0x750b('0x2b')]=_0x240f37['attributes'][_0x750b('0x2e')]?_0x240f37[_0x750b('0x2b')]:_0xe26c3b[_0x750b('0x27')];_0x240f37[_0x750b('0x2f')]=qs['sort'](_0x31d4e5[_0x750b('0x29')][_0x750b('0x30')]);_0x240f37[_0x750b('0x31')]=qs[_0x750b('0x32')](_[_0x750b('0x42')](_0x31d4e5[_0x750b('0x29')],_0xe26c3b['filters']));if(_0x31d4e5['query']['filter']){_0x240f37['where']=_[_0x750b('0x34')](_0x240f37[_0x750b('0x31')],{'$or':_[_0x750b('0x28')](_0x240f37[_0x750b('0x2b')],function(_0x4d8db3){var _0x3a0c39={};_0x3a0c39[_0x4d8db3]={'$like':'%'+_0x31d4e5[_0x750b('0x29')][_0x750b('0x33')]+'%'};return _0x3a0c39;})});}_0x240f37=_[_0x750b('0x34')]({},_0x240f37,_0x31d4e5[_0x750b('0x35')]);return _0x13e878[_0x750b('0x46')](_0x240f37);}})[_0x750b('0x1f')](function(_0x1c2739){if(_0x1c2739){_0x3266a2=_0x1c2739['length'];if(!_0x31d4e5[_0x750b('0x29')][_0x750b('0x43')]('nolimit')){_0x240f37[_0x750b('0x18')]=qs[_0x750b('0x18')](_0x31d4e5[_0x750b('0x29')][_0x750b('0x18')]);_0x240f37[_0x750b('0x16')]=qs['offset'](_0x31d4e5['query']['offset']);}return _0x13e878[_0x750b('0x46')](_0x240f37);}})['then'](function(_0x4ea926){if(_0x4ea926){return _0x4ea926?{'count':_0x3266a2,'rows':_0x4ea926}:null;}})[_0x750b('0x1f')](respondWithResult(_0x3d78a7,null))[_0x750b('0x38')](handleError(_0x3d78a7,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 9fba7fe..5a2d4d3 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 _0x6081=['SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x5e9a8d,_0x36ae4f){var _0x5e16e8=function(_0x58994a){while(--_0x58994a){_0x5e9a8d['push'](_0x5e9a8d['shift']());}};_0x5e16e8(++_0x36ae4f);}(_0x6081,0x84));var _0x1608=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6081[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1608('0x0'));var util=require('util');var logger=require(_0x1608('0x1'))(_0x1608('0x2'));var moment=require(_0x1608('0x3'));var BPromise=require(_0x1608('0x4'));var rp=require(_0x1608('0x5'));var fs=require('fs');var path=require(_0x1608('0x6'));var rimraf=require(_0x1608('0x7'));var config=require(_0x1608('0x8'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x1608('0x9')]=function(_0x2e9f12,_0x1c438c){return _0x2e9f12[_0x1608('0xa')](_0x1608('0xb'),attributes,{'tableName':_0x1608('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa86f=['int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration'];(function(_0x22e0be,_0x2cd85b){var _0x4b1d8e=function(_0x412a23){while(--_0x412a23){_0x22e0be['push'](_0x22e0be['shift']());}};_0x4b1d8e(++_0x2cd85b);}(_0xa86f,0x115));var _0xfa86=function(_0x278e78,_0x482823){_0x278e78=_0x278e78-0x0;var _0x1228a0=_0xa86f[_0x278e78];return _0x1228a0;};'use strict';var _=require(_0xfa86('0x0'));var util=require(_0xfa86('0x1'));var logger=require(_0xfa86('0x2'))(_0xfa86('0x3'));var moment=require(_0xfa86('0x4'));var BPromise=require(_0xfa86('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa86('0x6'));var rimraf=require(_0xfa86('0x7'));var config=require('../../config/environment');var attributes=require(_0xfa86('0x8'));module[_0xfa86('0x9')]=function(_0x1079aa,_0x2536f4){return _0x1079aa['define'](_0xfa86('0xa'),attributes,{'tableName':_0xfa86('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 ec65fdd..40d0f5f 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 _0x51a4=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x51a4,0x1cb));var _0x451a=function(_0x55face,_0x54385a){_0x55face=_0x55face-0x0;var _0x5e3ad2=_0x51a4[_0x55face];return _0x5e3ad2;};'use strict';var _=require(_0x451a('0x0'));var util=require('util');var moment=require(_0x451a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x451a('0x2'));var db=require(_0x451a('0x3'))['db'];var utils=require(_0x451a('0x4'));var logger=require(_0x451a('0x5'))('rpc');var config=require(_0x451a('0x6'));var jayson=require(_0x451a('0x7'));var client=jayson[_0x451a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe87d64,_0x5c02e0,_0x3db8d6){return new BPromise(function(_0x580b10,_0x1ddb2f){return client[_0x451a('0x9')](_0xe87d64,_0x3db8d6)[_0x451a('0xa')](function(_0x4eb48c){logger[_0x451a('0xb')](_0x451a('0xc'),_0x5c02e0,'request\x20sent');logger[_0x451a('0xd')](_0x451a('0xe'),_0x5c02e0,_0x451a('0xf'),JSON[_0x451a('0x10')](_0x4eb48c));if(_0x4eb48c[_0x451a('0x11')]){if(_0x4eb48c[_0x451a('0x11')]['code']===0x1f4){logger['error'](_0x451a('0xc'),_0x5c02e0,_0x4eb48c[_0x451a('0x11')][_0x451a('0x12')]);return _0x1ddb2f(_0x4eb48c['error'][_0x451a('0x12')]);}logger['error'](_0x451a('0xc'),_0x5c02e0,_0x4eb48c[_0x451a('0x11')][_0x451a('0x12')]);return _0x580b10(_0x4eb48c['error'][_0x451a('0x12')]);}else{logger[_0x451a('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5c02e0,'request\x20sent');_0x580b10(_0x4eb48c[_0x451a('0x13')][_0x451a('0x12')]);}})['catch'](function(_0x57dbf9){logger[_0x451a('0x11')](_0x451a('0xc'),_0x5c02e0,_0x57dbf9);_0x1ddb2f(_0x57dbf9);});});} \ No newline at end of file +var _0x8ddb=['../../config/environment','jayson/promise','http','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x4d45c6,_0x38ce1a){var _0x27d7de=function(_0x504201){while(--_0x504201){_0x4d45c6['push'](_0x4d45c6['shift']());}};_0x27d7de(++_0x38ce1a);}(_0x8ddb,0x111));var _0xb8dd=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x8ddb[_0x288f5e];return _0x476cc9;};'use strict';var _=require(_0xb8dd('0x0'));var util=require(_0xb8dd('0x1'));var moment=require(_0xb8dd('0x2'));var BPromise=require(_0xb8dd('0x3'));var rs=require(_0xb8dd('0x4'));var fs=require('fs');var Redis=require(_0xb8dd('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb8dd('0x6'))('rpc');var config=require(_0xb8dd('0x7'));var jayson=require(_0xb8dd('0x8'));var client=jayson['client'][_0xb8dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f9ca0,_0x20feac,_0x4d5bcb){return new BPromise(function(_0x2a3515,_0x8b2f5e){return client['request'](_0x4f9ca0,_0x4d5bcb)['then'](function(_0x34fe4e){logger[_0xb8dd('0xa')](_0xb8dd('0xb'),_0x20feac,_0xb8dd('0xc'));logger[_0xb8dd('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x20feac,'request\x20sent',JSON[_0xb8dd('0xe')](_0x34fe4e));if(_0x34fe4e[_0xb8dd('0xf')]){if(_0x34fe4e[_0xb8dd('0xf')][_0xb8dd('0x10')]===0x1f4){logger[_0xb8dd('0xf')](_0xb8dd('0xb'),_0x20feac,_0x34fe4e[_0xb8dd('0xf')][_0xb8dd('0x11')]);return _0x8b2f5e(_0x34fe4e[_0xb8dd('0xf')]['message']);}logger['error'](_0xb8dd('0xb'),_0x20feac,_0x34fe4e['error'][_0xb8dd('0x11')]);return _0x2a3515(_0x34fe4e[_0xb8dd('0xf')][_0xb8dd('0x11')]);}else{logger[_0xb8dd('0xa')](_0xb8dd('0xb'),_0x20feac,_0xb8dd('0xc'));_0x2a3515(_0x34fe4e[_0xb8dd('0x12')][_0xb8dd('0x11')]);}})[_0xb8dd('0x13')](function(_0x218d9f){logger[_0xb8dd('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x20feac,_0x218d9f);_0x8b2f5e(_0x218d9f);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index b824e5a..33cfb94 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 _0x9be7=['./intSugarcrmField.controller','get','/:id','isAuthenticated','post','create','put','delete','exports','multer','path','express','Router','fs-extra','../../config/environment'];(function(_0x1c6ef2,_0x8d926a){var _0x404b8c=function(_0x4fdf1e){while(--_0x4fdf1e){_0x1c6ef2['push'](_0x1c6ef2['shift']());}};_0x404b8c(++_0x8d926a);}(_0x9be7,0x126));var _0x79be=function(_0x595013,_0x65a215){_0x595013=_0x595013-0x0;var _0x2a29e3=_0x9be7[_0x595013];return _0x2a29e3;};'use strict';var multer=require(_0x79be('0x0'));var util=require('util');var path=require(_0x79be('0x1'));var timeout=require('connect-timeout');var express=require(_0x79be('0x2'));var router=express[_0x79be('0x3')]();var fs_extra=require(_0x79be('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x79be('0x5'));var controller=require(_0x79be('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x79be('0x7')](_0x79be('0x8'),auth[_0x79be('0x9')](),controller['show']);router[_0x79be('0xa')]('/',auth[_0x79be('0x9')](),controller[_0x79be('0xb')]);router[_0x79be('0xc')](_0x79be('0x8'),auth[_0x79be('0x9')](),controller['update']);router[_0x79be('0xd')]('/:id',auth[_0x79be('0x9')](),controller['destroy']);module[_0x79be('0xe')]=router; \ No newline at end of file +var _0x387c=['./intSugarcrmField.controller','get','isAuthenticated','index','show','create','/:id','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4e5552,_0x19ec4e){var _0x60a338=function(_0x40c70e){while(--_0x40c70e){_0x4e5552['push'](_0x4e5552['shift']());}};_0x60a338(++_0x19ec4e);}(_0x387c,0xc6));var _0xc387=function(_0x5ce15c,_0x19c917){_0x5ce15c=_0x5ce15c-0x0;var _0x36e4f5=_0x387c[_0x5ce15c];return _0x36e4f5;};'use strict';var multer=require(_0xc387('0x0'));var util=require('util');var path=require(_0xc387('0x1'));var timeout=require('connect-timeout');var express=require(_0xc387('0x2'));var router=express[_0xc387('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc387('0x4'));var interaction=require(_0xc387('0x5'));var config=require('../../config/environment');var controller=require(_0xc387('0x6'));router[_0xc387('0x7')]('/',auth[_0xc387('0x8')](),controller[_0xc387('0x9')]);router[_0xc387('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xc387('0xa')]);router['post']('/',auth[_0xc387('0x8')](),controller[_0xc387('0xb')]);router['put'](_0xc387('0xc'),auth[_0xc387('0x8')](),controller[_0xc387('0xd')]);router[_0xc387('0xe')](_0xc387('0xc'),auth[_0xc387('0x8')](),controller[_0xc387('0xf')]);module[_0xc387('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index a290c3b..05ff414 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 _0x65c1=['customVariable','STRING','sequelize','ENUM','string','variable'];(function(_0x2f494a,_0x2d39b5){var _0x26d29d=function(_0x19cced){while(--_0x19cced){_0x2f494a['push'](_0x2f494a['shift']());}};_0x26d29d(++_0x2d39b5);}(_0x65c1,0x1d0));var _0x165c=function(_0x29d2d2,_0x3344){_0x29d2d2=_0x29d2d2-0x0;var _0x3f6476=_0x65c1[_0x29d2d2];return _0x3f6476;};'use strict';var Sequelize=require(_0x165c('0x0'));module['exports']={'type':{'type':Sequelize[_0x165c('0x1')](_0x165c('0x2'),_0x165c('0x3'),_0x165c('0x4'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x165c('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x165c('0x1')]('string','variable',_0x165c('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x407a=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x1db920,_0x270acc){var _0x3230e0=function(_0xc60d28){while(--_0xc60d28){_0x1db920['push'](_0x1db920['shift']());}};_0x3230e0(++_0x270acc);}(_0x407a,0x127));var _0xa407=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x407a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xa407('0x0'));module[_0xa407('0x1')]={'type':{'type':Sequelize[_0xa407('0x2')](_0xa407('0x3'),_0xa407('0x4'),_0xa407('0x5'),_0xa407('0x6'),_0xa407('0x7')),'defaultValue':_0xa407('0x3')},'content':{'type':Sequelize[_0xa407('0x8')]},'key':{'type':Sequelize[_0xa407('0x8')]},'keyType':{'type':Sequelize[_0xa407('0x2')](_0xa407('0x3'),_0xa407('0x4'),_0xa407('0x5'))},'keyContent':{'type':Sequelize[_0xa407('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa407('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa407('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index b6044d8..0f666da 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 _0x6d7d=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','rimraf','zip-dir','request-promise','moment','util','path','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','filters','intersection'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x6d7d,0x1c0));var _0xd6d7=function(_0xce6a78,_0x574329){_0xce6a78=_0xce6a78-0x0;var _0x1938c3=_0x6d7d[_0xce6a78];return _0x1938c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6d7('0x0'));var zipdir=require(_0xd6d7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd6d7('0x2'));var moment=require(_0xd6d7('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd6d7('0x4'));var path=require(_0xd6d7('0x5'));var sox=require('sox');var csv=require(_0xd6d7('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd6d7('0x7'));var _=require(_0xd6d7('0x8'));var squel=require('squel');var crypto=require(_0xd6d7('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd6d7('0xa'));var toCsv=require(_0xd6d7('0x6'));var querystring=require('querystring');var Papa=require(_0xd6d7('0xb'));var Redis=require(_0xd6d7('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xd6d7('0xd'));var as=require(_0xd6d7('0xe'));var hardwareService=require(_0xd6d7('0xf'));var logger=require('../../config/logger')(_0xd6d7('0x10'));var utils=require('../../config/utils');var config=require(_0xd6d7('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xd6d7('0x12'))['db'];function respondWithStatusCode(_0xcfe390,_0x271fe6){_0x271fe6=_0x271fe6||0xcc;return function(_0x3d6c9e){if(_0x3d6c9e){return _0xcfe390[_0xd6d7('0x13')](_0x271fe6);}return _0xcfe390[_0xd6d7('0x14')](_0x271fe6)[_0xd6d7('0x15')]();};}function respondWithResult(_0x428841,_0x4fca33){_0x4fca33=_0x4fca33||0xc8;return function(_0x4f4d59){if(_0x4f4d59){return _0x428841[_0xd6d7('0x14')](_0x4fca33)[_0xd6d7('0x16')](_0x4f4d59);}};}function respondWithFilteredResult(_0x3067ff,_0x4c7665){return function(_0x1d0b62){if(_0x1d0b62){var _0x1bec08=typeof _0x4c7665[_0xd6d7('0x17')]===_0xd6d7('0x18')&&typeof _0x4c7665[_0xd6d7('0x19')]===_0xd6d7('0x18');var _0x304363=_0x1d0b62['count'];var _0x2723c8=_0x1bec08?0x0:_0x4c7665[_0xd6d7('0x17')];var _0x6aaaa9=_0x1bec08?_0x1d0b62[_0xd6d7('0x1a')]:_0x4c7665[_0xd6d7('0x17')]+_0x4c7665[_0xd6d7('0x19')];var _0x4c12d5;if(_0x6aaaa9>=_0x304363){_0x6aaaa9=_0x304363;_0x4c12d5=0xc8;}else{_0x4c12d5=0xce;}_0x3067ff[_0xd6d7('0x14')](_0x4c12d5);return _0x3067ff[_0xd6d7('0x1b')](_0xd6d7('0x1c'),_0x2723c8+'-'+_0x6aaaa9+'/'+_0x304363)['json'](_0x1d0b62);}return null;};}function patchUpdates(_0x559d43){return function(_0x272357){try{jsonpatch[_0xd6d7('0x1d')](_0x272357,_0x559d43,!![]);}catch(_0x155ce9){return BPromise[_0xd6d7('0x1e')](_0x155ce9);}return _0x272357['save']();};}function saveUpdates(_0x3b3891,_0x403f9a){return function(_0x1e3920){if(_0x1e3920){return _0x1e3920[_0xd6d7('0x1f')](_0x3b3891)['then'](function(_0x3fb237){return _0x3fb237;});}return null;};}function removeEntity(_0x2796be,_0x3493ca){return function(_0x40651b){if(_0x40651b){return _0x40651b[_0xd6d7('0x20')]()[_0xd6d7('0x21')](function(){_0x2796be[_0xd6d7('0x14')](0xcc)[_0xd6d7('0x15')]();});}};}function handleEntityNotFound(_0x4e010b,_0x2e0913){return function(_0x5be889){if(!_0x5be889){_0x4e010b['sendStatus'](0x194);}return _0x5be889;};}function handleError(_0x31f41a,_0x4fcc6e){_0x4fcc6e=_0x4fcc6e||0x1f4;return function(_0x50ee50){logger[_0xd6d7('0x22')](_0x50ee50[_0xd6d7('0x23')]);if(_0x50ee50[_0xd6d7('0x24')]){delete _0x50ee50['name'];}_0x31f41a[_0xd6d7('0x14')](_0x4fcc6e)[_0xd6d7('0x25')](_0x50ee50);};}exports[_0xd6d7('0x26')]=function(_0x5c93fb,_0x1b91a1){var _0x43e50e={},_0x867d81={},_0x58f26b={'count':0x0,'rows':[]};var _0x4164bf=_[_0xd6d7('0x27')](db[_0xd6d7('0x28')][_0xd6d7('0x29')],function(_0x1949b1){return{'name':_0x1949b1[_0xd6d7('0x2a')],'type':_0x1949b1[_0xd6d7('0x2b')][_0xd6d7('0x2c')]};});_0x867d81[_0xd6d7('0x2d')]=_['map'](_0x4164bf,_0xd6d7('0x24'));_0x867d81[_0xd6d7('0x2e')]=_['keys'](_0x5c93fb[_0xd6d7('0x2e')]);_0x867d81[_0xd6d7('0x2f')]=_[_0xd6d7('0x30')](_0x867d81[_0xd6d7('0x2d')],_0x867d81[_0xd6d7('0x2e')]);_0x43e50e[_0xd6d7('0x31')]=_[_0xd6d7('0x30')](_0x867d81['model'],qs[_0xd6d7('0x32')](_0x5c93fb[_0xd6d7('0x2e')]['fields']));_0x43e50e[_0xd6d7('0x31')]=_0x43e50e[_0xd6d7('0x31')][_0xd6d7('0x33')]?_0x43e50e['attributes']:_0x867d81['model'];if(!_0x5c93fb[_0xd6d7('0x2e')][_0xd6d7('0x34')](_0xd6d7('0x35'))){_0x43e50e[_0xd6d7('0x19')]=qs[_0xd6d7('0x19')](_0x5c93fb['query'][_0xd6d7('0x19')]);_0x43e50e['offset']=qs['offset'](_0x5c93fb[_0xd6d7('0x2e')][_0xd6d7('0x17')]);}_0x43e50e[_0xd6d7('0x36')]=qs[_0xd6d7('0x37')](_0x5c93fb[_0xd6d7('0x2e')][_0xd6d7('0x37')]);_0x43e50e[_0xd6d7('0x38')]=qs[_0xd6d7('0x2f')](_[_0xd6d7('0x39')](_0x5c93fb[_0xd6d7('0x2e')],_0x867d81[_0xd6d7('0x2f')]),_0x4164bf);if(_0x5c93fb[_0xd6d7('0x2e')]['filter']){_0x43e50e[_0xd6d7('0x38')]=_[_0xd6d7('0x3a')](_0x43e50e['where'],{'$or':_['map'](_0x4164bf,function(_0x210416){if(_0x210416[_0xd6d7('0x2b')]!=='VIRTUAL'){var _0x202fe3={};_0x202fe3[_0x210416[_0xd6d7('0x24')]]={'$like':'%'+_0x5c93fb[_0xd6d7('0x2e')]['filter']+'%'};return _0x202fe3;}})});}_0x43e50e=_['merge']({},_0x43e50e,_0x5c93fb[_0xd6d7('0x3b')]);var _0x423800={'where':_0x43e50e[_0xd6d7('0x38')]};return db[_0xd6d7('0x28')]['count'](_0x423800)['then'](function(_0x3430ce){_0x58f26b[_0xd6d7('0x1a')]=_0x3430ce;if(_0x5c93fb[_0xd6d7('0x2e')][_0xd6d7('0x3c')]){_0x43e50e[_0xd6d7('0x3d')]=[{'all':!![]}];}return db[_0xd6d7('0x28')][_0xd6d7('0x3e')](_0x43e50e);})[_0xd6d7('0x21')](function(_0x3c7bfe){_0x58f26b[_0xd6d7('0x3f')]=_0x3c7bfe;return _0x58f26b;})['then'](respondWithFilteredResult(_0x1b91a1,_0x43e50e))[_0xd6d7('0x40')](handleError(_0x1b91a1,null));};exports[_0xd6d7('0x41')]=function(_0x4e4280,_0x51c87f){var _0x351b13={'raw':!![],'where':{'id':_0x4e4280[_0xd6d7('0x42')]['id']}},_0x2304ad={};_0x2304ad[_0xd6d7('0x2d')]=_[_0xd6d7('0x43')](db[_0xd6d7('0x28')]['rawAttributes']);_0x2304ad[_0xd6d7('0x2e')]=_[_0xd6d7('0x43')](_0x4e4280[_0xd6d7('0x2e')]);_0x2304ad[_0xd6d7('0x2f')]=_[_0xd6d7('0x30')](_0x2304ad[_0xd6d7('0x2d')],_0x2304ad[_0xd6d7('0x2e')]);_0x351b13[_0xd6d7('0x31')]=_[_0xd6d7('0x30')](_0x2304ad['model'],qs[_0xd6d7('0x32')](_0x4e4280['query'][_0xd6d7('0x32')]));_0x351b13['attributes']=_0x351b13[_0xd6d7('0x31')][_0xd6d7('0x33')]?_0x351b13[_0xd6d7('0x31')]:_0x2304ad[_0xd6d7('0x2d')];if(_0x4e4280[_0xd6d7('0x2e')][_0xd6d7('0x3c')]){_0x351b13[_0xd6d7('0x3d')]=[{'all':!![]}];}_0x351b13=_[_0xd6d7('0x3a')]({},_0x351b13,_0x4e4280[_0xd6d7('0x3b')]);return db['SugarcrmField'][_0xd6d7('0x44')](_0x351b13)['then'](handleEntityNotFound(_0x51c87f,null))[_0xd6d7('0x21')](respondWithResult(_0x51c87f,null))[_0xd6d7('0x40')](handleError(_0x51c87f,null));};exports[_0xd6d7('0x45')]=function(_0x16009c,_0x39fd81){return db[_0xd6d7('0x28')][_0xd6d7('0x45')](_0x16009c[_0xd6d7('0x46')],{})['then'](respondWithResult(_0x39fd81,0xc9))[_0xd6d7('0x40')](handleError(_0x39fd81,null));};exports['update']=function(_0x4ae16b,_0x56d2b7){if(_0x4ae16b[_0xd6d7('0x46')]['id']){delete _0x4ae16b[_0xd6d7('0x46')]['id'];}return db[_0xd6d7('0x28')][_0xd6d7('0x44')]({'where':{'id':_0x4ae16b['params']['id']}})[_0xd6d7('0x21')](handleEntityNotFound(_0x56d2b7,null))[_0xd6d7('0x21')](saveUpdates(_0x4ae16b[_0xd6d7('0x46')],null))[_0xd6d7('0x21')](respondWithResult(_0x56d2b7,null))[_0xd6d7('0x40')](handleError(_0x56d2b7,null));};exports[_0xd6d7('0x20')]=function(_0x30790d,_0x3c7416){return db[_0xd6d7('0x28')][_0xd6d7('0x44')]({'where':{'id':_0x30790d[_0xd6d7('0x42')]['id']}})[_0xd6d7('0x21')](handleEntityNotFound(_0x3c7416,null))[_0xd6d7('0x21')](removeEntity(_0x3c7416,null))[_0xd6d7('0x40')](handleError(_0x3c7416,null));}; \ No newline at end of file +var _0x904d=['reject','save','update','destroy','then','sendStatus','name','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','pick','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','length','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','limit','count','set','Content-Range','apply'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x904d,0xb2));var _0xd904=function(_0x4dbcd6,_0x34326c){_0x4dbcd6=_0x4dbcd6-0x0;var _0x541e55=_0x904d[_0x4dbcd6];return _0x541e55;};'use strict';var emlformat=require(_0xd904('0x0'));var rimraf=require(_0xd904('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd904('0x2'));var rp=require(_0xd904('0x3'));var moment=require(_0xd904('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd904('0x5'));var path=require(_0xd904('0x6'));var sox=require(_0xd904('0x7'));var csv=require(_0xd904('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd904('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd904('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd904('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd904('0xb'));var authService=require(_0xd904('0xc'));var qs=require(_0xd904('0xd'));var as=require(_0xd904('0xe'));var hardwareService=require(_0xd904('0xf'));var logger=require(_0xd904('0x10'))(_0xd904('0x11'));var utils=require(_0xd904('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xd904('0x13'));var db=require(_0xd904('0x14'))['db'];function respondWithStatusCode(_0x51514c,_0x14e28a){_0x14e28a=_0x14e28a||0xcc;return function(_0xd9277d){if(_0xd9277d){return _0x51514c['sendStatus'](_0x14e28a);}return _0x51514c[_0xd904('0x15')](_0x14e28a)['end']();};}function respondWithResult(_0x1a514e,_0x580f5b){_0x580f5b=_0x580f5b||0xc8;return function(_0x5cd7cc){if(_0x5cd7cc){return _0x1a514e[_0xd904('0x15')](_0x580f5b)[_0xd904('0x16')](_0x5cd7cc);}};}function respondWithFilteredResult(_0x56e3be,_0x3d89e2){return function(_0x4ceee8){if(_0x4ceee8){var _0x4f0e73=typeof _0x3d89e2[_0xd904('0x17')]==='undefined'&&typeof _0x3d89e2[_0xd904('0x18')]==='undefined';var _0x51c54a=_0x4ceee8[_0xd904('0x19')];var _0x44db66=_0x4f0e73?0x0:_0x3d89e2[_0xd904('0x17')];var _0x40684b=_0x4f0e73?_0x4ceee8['count']:_0x3d89e2[_0xd904('0x17')]+_0x3d89e2[_0xd904('0x18')];var _0x3dafd0;if(_0x40684b>=_0x51c54a){_0x40684b=_0x51c54a;_0x3dafd0=0xc8;}else{_0x3dafd0=0xce;}_0x56e3be[_0xd904('0x15')](_0x3dafd0);return _0x56e3be[_0xd904('0x1a')](_0xd904('0x1b'),_0x44db66+'-'+_0x40684b+'/'+_0x51c54a)[_0xd904('0x16')](_0x4ceee8);}return null;};}function patchUpdates(_0x47cc26){return function(_0x27de4a){try{jsonpatch[_0xd904('0x1c')](_0x27de4a,_0x47cc26,!![]);}catch(_0x2d03bb){return BPromise[_0xd904('0x1d')](_0x2d03bb);}return _0x27de4a[_0xd904('0x1e')]();};}function saveUpdates(_0x29c869,_0x1dac1f){return function(_0x5584b9){if(_0x5584b9){return _0x5584b9[_0xd904('0x1f')](_0x29c869)['then'](function(_0x1c5f63){return _0x1c5f63;});}return null;};}function removeEntity(_0x9884f9,_0x3c695f){return function(_0x59f7b1){if(_0x59f7b1){return _0x59f7b1[_0xd904('0x20')]()[_0xd904('0x21')](function(){_0x9884f9[_0xd904('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ebf22,_0x1b0218){return function(_0x178e5c){if(!_0x178e5c){_0x3ebf22[_0xd904('0x22')](0x194);}return _0x178e5c;};}function handleError(_0x253bda,_0x136464){_0x136464=_0x136464||0x1f4;return function(_0x366393){logger['error'](_0x366393['stack']);if(_0x366393[_0xd904('0x23')]){delete _0x366393[_0xd904('0x23')];}_0x253bda[_0xd904('0x15')](_0x136464)['send'](_0x366393);};}exports[_0xd904('0x24')]=function(_0x4a53b3,_0x54ee62){var _0x393fe0={},_0x374472={},_0x104d8b={'count':0x0,'rows':[]};var _0x335dbc=_[_0xd904('0x25')](db[_0xd904('0x26')][_0xd904('0x27')],function(_0x562cc7){return{'name':_0x562cc7[_0xd904('0x28')],'type':_0x562cc7[_0xd904('0x29')][_0xd904('0x2a')]};});_0x374472[_0xd904('0x2b')]=_['map'](_0x335dbc,_0xd904('0x23'));_0x374472[_0xd904('0x2c')]=_[_0xd904('0x2d')](_0x4a53b3[_0xd904('0x2c')]);_0x374472[_0xd904('0x2e')]=_['intersection'](_0x374472[_0xd904('0x2b')],_0x374472[_0xd904('0x2c')]);_0x393fe0['attributes']=_[_0xd904('0x2f')](_0x374472['model'],qs['fields'](_0x4a53b3[_0xd904('0x2c')][_0xd904('0x30')]));_0x393fe0[_0xd904('0x31')]=_0x393fe0[_0xd904('0x31')]['length']?_0x393fe0[_0xd904('0x31')]:_0x374472['model'];if(!_0x4a53b3[_0xd904('0x2c')][_0xd904('0x32')](_0xd904('0x33'))){_0x393fe0[_0xd904('0x18')]=qs[_0xd904('0x18')](_0x4a53b3[_0xd904('0x2c')][_0xd904('0x18')]);_0x393fe0[_0xd904('0x17')]=qs[_0xd904('0x17')](_0x4a53b3[_0xd904('0x2c')][_0xd904('0x17')]);}_0x393fe0[_0xd904('0x34')]=qs['sort'](_0x4a53b3['query']['sort']);_0x393fe0['where']=qs[_0xd904('0x2e')](_[_0xd904('0x35')](_0x4a53b3['query'],_0x374472['filters']),_0x335dbc);if(_0x4a53b3['query']['filter']){_0x393fe0[_0xd904('0x36')]=_[_0xd904('0x37')](_0x393fe0[_0xd904('0x36')],{'$or':_[_0xd904('0x25')](_0x335dbc,function(_0x2a68a0){if(_0x2a68a0[_0xd904('0x29')]!==_0xd904('0x38')){var _0x30baaf={};_0x30baaf[_0x2a68a0['name']]={'$like':'%'+_0x4a53b3[_0xd904('0x2c')][_0xd904('0x39')]+'%'};return _0x30baaf;}})});}_0x393fe0=_['merge']({},_0x393fe0,_0x4a53b3[_0xd904('0x3a')]);var _0x4affde={'where':_0x393fe0[_0xd904('0x36')]};return db[_0xd904('0x26')][_0xd904('0x19')](_0x4affde)[_0xd904('0x21')](function(_0xd8c43f){_0x104d8b[_0xd904('0x19')]=_0xd8c43f;if(_0x4a53b3[_0xd904('0x2c')][_0xd904('0x3b')]){_0x393fe0['include']=[{'all':!![]}];}return db[_0xd904('0x26')]['findAll'](_0x393fe0);})[_0xd904('0x21')](function(_0x2f8219){_0x104d8b[_0xd904('0x3c')]=_0x2f8219;return _0x104d8b;})[_0xd904('0x21')](respondWithFilteredResult(_0x54ee62,_0x393fe0))[_0xd904('0x3d')](handleError(_0x54ee62,null));};exports[_0xd904('0x3e')]=function(_0x2b6585,_0x5ef08c){var _0x143094={'raw':!![],'where':{'id':_0x2b6585[_0xd904('0x3f')]['id']}},_0x2787a0={};_0x2787a0[_0xd904('0x2b')]=_['keys'](db[_0xd904('0x26')][_0xd904('0x27')]);_0x2787a0['query']=_[_0xd904('0x2d')](_0x2b6585[_0xd904('0x2c')]);_0x2787a0[_0xd904('0x2e')]=_[_0xd904('0x2f')](_0x2787a0[_0xd904('0x2b')],_0x2787a0[_0xd904('0x2c')]);_0x143094['attributes']=_[_0xd904('0x2f')](_0x2787a0[_0xd904('0x2b')],qs[_0xd904('0x30')](_0x2b6585[_0xd904('0x2c')]['fields']));_0x143094[_0xd904('0x31')]=_0x143094[_0xd904('0x31')][_0xd904('0x40')]?_0x143094[_0xd904('0x31')]:_0x2787a0[_0xd904('0x2b')];if(_0x2b6585['query'][_0xd904('0x3b')]){_0x143094[_0xd904('0x41')]=[{'all':!![]}];}_0x143094=_['merge']({},_0x143094,_0x2b6585[_0xd904('0x3a')]);return db['SugarcrmField'][_0xd904('0x42')](_0x143094)['then'](handleEntityNotFound(_0x5ef08c,null))[_0xd904('0x21')](respondWithResult(_0x5ef08c,null))[_0xd904('0x3d')](handleError(_0x5ef08c,null));};exports[_0xd904('0x43')]=function(_0x15b1de,_0x5c4fa3){return db[_0xd904('0x26')][_0xd904('0x43')](_0x15b1de['body'],{})['then'](respondWithResult(_0x5c4fa3,0xc9))[_0xd904('0x3d')](handleError(_0x5c4fa3,null));};exports['update']=function(_0x18983f,_0x103914){if(_0x18983f[_0xd904('0x44')]['id']){delete _0x18983f[_0xd904('0x44')]['id'];}return db[_0xd904('0x26')][_0xd904('0x42')]({'where':{'id':_0x18983f['params']['id']}})[_0xd904('0x21')](handleEntityNotFound(_0x103914,null))['then'](saveUpdates(_0x18983f[_0xd904('0x44')],null))[_0xd904('0x21')](respondWithResult(_0x103914,null))[_0xd904('0x3d')](handleError(_0x103914,null));};exports[_0xd904('0x20')]=function(_0x4dd7d7,_0x47b3f5){return db[_0xd904('0x26')]['find']({'where':{'id':_0x4dd7d7[_0xd904('0x3f')]['id']}})[_0xd904('0x21')](handleEntityNotFound(_0x47b3f5,null))[_0xd904('0x21')](removeEntity(_0x47b3f5,null))[_0xd904('0x3d')](handleError(_0x47b3f5,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 1536936..34e9ed6 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 _0xabc5=['rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','FieldId','../../config/logger','api','moment','request-promise','path'];(function(_0x3b5e02,_0x535469){var _0x59464c=function(_0x2d11cb){while(--_0x2d11cb){_0x3b5e02['push'](_0x3b5e02['shift']());}};_0x59464c(++_0x535469);}(_0xabc5,0xe5));var _0x5abc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xabc5[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5abc('0x0'))(_0x5abc('0x1'));var moment=require(_0x5abc('0x2'));var BPromise=require('bluebird');var rp=require(_0x5abc('0x3'));var fs=require('fs');var path=require(_0x5abc('0x4'));var rimraf=require(_0x5abc('0x5'));var config=require(_0x5abc('0x6'));var attributes=require(_0x5abc('0x7'));module[_0x5abc('0x8')]=function(_0x48d942,_0x3355cc){return _0x48d942[_0x5abc('0x9')](_0x5abc('0xa'),attributes,{'tableName':_0x5abc('0xb'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0x5abc('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x063b=['define','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','../../config/logger','api','moment','bluebird','../../config/environment','./intSugarcrmField.attributes','exports'];(function(_0x590faa,_0x267c23){var _0x4180d7=function(_0x449c4b){while(--_0x449c4b){_0x590faa['push'](_0x590faa['shift']());}};_0x4180d7(++_0x267c23);}(_0x063b,0x159));var _0xb063=function(_0x3be8a9,_0x3bb958){_0x3be8a9=_0x3be8a9-0x0;var _0x426497=_0x063b[_0x3be8a9];return _0x426497;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb063('0x0'))(_0xb063('0x1'));var moment=require(_0xb063('0x2'));var BPromise=require(_0xb063('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb063('0x4'));var attributes=require(_0xb063('0x5'));module[_0xb063('0x6')]=function(_0x5f421b,_0x3e0833){return _0x5f421b[_0xb063('0x7')]('SugarcrmField',attributes,{'tableName':_0xb063('0x8'),'paranoid':![],'indexes':[{'name':_0xb063('0x9'),'fields':['idField',_0xb063('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 159d019..25775c3 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 _0x1902=['error','SugarcrmField,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','info','code'];(function(_0x146347,_0x413ffc){var _0x42bcc3=function(_0x19b73b){while(--_0x19b73b){_0x146347['push'](_0x146347['shift']());}};_0x42bcc3(++_0x413ffc);}(_0x1902,0x189));var _0x2190=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1902[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2190('0x0'));var util=require(_0x2190('0x1'));var moment=require(_0x2190('0x2'));var BPromise=require(_0x2190('0x3'));var rs=require(_0x2190('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2190('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2190('0x6'));var jayson=require(_0x2190('0x7'));var client=jayson[_0x2190('0x8')][_0x2190('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x373cce,_0x39e591,_0x4dfe25){return new BPromise(function(_0x41edc5,_0x21851c){return client['request'](_0x373cce,_0x4dfe25)['then'](function(_0x325171){logger[_0x2190('0xa')]('SugarcrmField,\x20%s,\x20%s',_0x39e591,'request\x20sent');logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x39e591,'request\x20sent',JSON['stringify'](_0x325171));if(_0x325171['error']){if(_0x325171['error'][_0x2190('0xb')]===0x1f4){logger[_0x2190('0xc')](_0x2190('0xd'),_0x39e591,_0x325171[_0x2190('0xc')]['message']);return _0x21851c(_0x325171[_0x2190('0xc')]['message']);}logger[_0x2190('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x39e591,_0x325171['error'][_0x2190('0xe')]);return _0x41edc5(_0x325171['error'][_0x2190('0xe')]);}else{logger[_0x2190('0xa')]('SugarcrmField,\x20%s,\x20%s',_0x39e591,'request\x20sent');_0x41edc5(_0x325171['result'][_0x2190('0xe')]);}})['catch'](function(_0x22bd59){logger['error'](_0x2190('0xd'),_0x39e591,_0x22bd59);_0x21851c(_0x22bd59);});});} \ No newline at end of file +var _0x5a7e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','lodash','util'];(function(_0x1ffb10,_0x28ce2c){var _0x390ad0=function(_0x1d1c1c){while(--_0x1d1c1c){_0x1ffb10['push'](_0x1ffb10['shift']());}};_0x390ad0(++_0x28ce2c);}(_0x5a7e,0xcd));var _0xe5a7=function(_0x4df224,_0x31c3d6){_0x4df224=_0x4df224-0x0;var _0x3e3bcd=_0x5a7e[_0x4df224];return _0x3e3bcd;};'use strict';var _=require(_0xe5a7('0x0'));var util=require(_0xe5a7('0x1'));var moment=require(_0xe5a7('0x2'));var BPromise=require(_0xe5a7('0x3'));var rs=require(_0xe5a7('0x4'));var fs=require('fs');var Redis=require(_0xe5a7('0x5'));var db=require(_0xe5a7('0x6'))['db'];var utils=require(_0xe5a7('0x7'));var logger=require('../../config/logger')(_0xe5a7('0x8'));var config=require(_0xe5a7('0x9'));var jayson=require(_0xe5a7('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x10e47e,_0x3ac481,_0x25050a){return new BPromise(function(_0x4e799f,_0x1f2e94){return client[_0xe5a7('0xb')](_0x10e47e,_0x25050a)[_0xe5a7('0xc')](function(_0x4e1c46){logger[_0xe5a7('0xd')](_0xe5a7('0xe'),_0x3ac481,'request\x20sent');logger[_0xe5a7('0xf')](_0xe5a7('0x10'),_0x3ac481,'request\x20sent',JSON[_0xe5a7('0x11')](_0x4e1c46));if(_0x4e1c46['error']){if(_0x4e1c46['error'][_0xe5a7('0x12')]===0x1f4){logger[_0xe5a7('0x13')](_0xe5a7('0xe'),_0x3ac481,_0x4e1c46[_0xe5a7('0x13')][_0xe5a7('0x14')]);return _0x1f2e94(_0x4e1c46[_0xe5a7('0x13')]['message']);}logger[_0xe5a7('0x13')](_0xe5a7('0xe'),_0x3ac481,_0x4e1c46[_0xe5a7('0x13')][_0xe5a7('0x14')]);return _0x4e799f(_0x4e1c46['error'][_0xe5a7('0x14')]);}else{logger[_0xe5a7('0xd')](_0xe5a7('0xe'),_0x3ac481,_0xe5a7('0x15'));_0x4e799f(_0x4e1c46[_0xe5a7('0x16')][_0xe5a7('0x14')]);}})['catch'](function(_0xc05619){logger[_0xe5a7('0x13')](_0xe5a7('0xe'),_0x3ac481,_0xc05619);_0x1f2e94(_0xc05619);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 68e1453..29100e8 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 _0x6c4b=['update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x2d4b55,_0x44df45){var _0x3d2acc=function(_0x3f2169){while(--_0x3f2169){_0x2d4b55['push'](_0x2d4b55['shift']());}};_0x3d2acc(++_0x44df45);}(_0x6c4b,0x93));var _0xb6c4=function(_0xd85e0d,_0x3de3de){_0xd85e0d=_0xd85e0d-0x0;var _0x3cd371=_0x6c4b[_0xd85e0d];return _0x3cd371;};'use strict';var multer=require(_0xb6c4('0x0'));var util=require(_0xb6c4('0x1'));var path=require(_0xb6c4('0x2'));var timeout=require('connect-timeout');var express=require(_0xb6c4('0x3'));var router=express[_0xb6c4('0x4')]();var fs_extra=require(_0xb6c4('0x5'));var auth=require(_0xb6c4('0x6'));var interaction=require(_0xb6c4('0x7'));var config=require(_0xb6c4('0x8'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0xb6c4('0x9')](),controller['index']);router[_0xb6c4('0xa')](_0xb6c4('0xb'),auth['isAuthenticated'](),controller[_0xb6c4('0xc')]);router[_0xb6c4('0xa')](_0xb6c4('0xd'),auth[_0xb6c4('0x9')](),controller[_0xb6c4('0xe')]);router[_0xb6c4('0xa')](_0xb6c4('0xf'),auth['isAuthenticated'](),controller[_0xb6c4('0x10')]);router[_0xb6c4('0x11')]('/',auth[_0xb6c4('0x9')](),controller[_0xb6c4('0x12')]);router['post'](_0xb6c4('0xd'),auth[_0xb6c4('0x9')](),controller[_0xb6c4('0x13')]);router[_0xb6c4('0x14')](_0xb6c4('0xb'),auth[_0xb6c4('0x9')](),controller[_0xb6c4('0x15')]);router[_0xb6c4('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xb6c4('0x17')]);module['exports']=router; \ No newline at end of file +var _0xa5fd=['post','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/configurations','/:id/fields','getFields'];(function(_0xfd3905,_0x41c8b7){var _0x1fd91d=function(_0x515bb4){while(--_0x515bb4){_0xfd3905['push'](_0xfd3905['shift']());}};_0x1fd91d(++_0x41c8b7);}(_0xa5fd,0x90));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xda5f('0x0'));var util=require('util');var path=require(_0xda5f('0x1'));var timeout=require(_0xda5f('0x2'));var express=require(_0xda5f('0x3'));var router=express['Router']();var fs_extra=require(_0xda5f('0x4'));var auth=require(_0xda5f('0x5'));var interaction=require(_0xda5f('0x6'));var config=require(_0xda5f('0x7'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0xda5f('0x8')](),controller[_0xda5f('0x9')]);router[_0xda5f('0xa')](_0xda5f('0xb'),auth[_0xda5f('0x8')](),controller[_0xda5f('0xc')]);router['get'](_0xda5f('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0xda5f('0xe'),auth['isAuthenticated'](),controller[_0xda5f('0xf')]);router[_0xda5f('0x10')]('/',auth[_0xda5f('0x8')](),controller['create']);router[_0xda5f('0x10')](_0xda5f('0xd'),auth[_0xda5f('0x8')](),controller['addConfiguration']);router['put'](_0xda5f('0xb'),auth[_0xda5f('0x8')](),controller[_0xda5f('0x11')]);router[_0xda5f('0x12')]('/:id',auth[_0xda5f('0x8')](),controller[_0xda5f('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 152be6e..323e3ae 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 _0xa0ea=['STRING','HelpDesk','sequelize','exports'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xa0ea,0x102));var _0xaa0e=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0xa0ea[_0x1d1d09];return _0x8827e;};'use strict';var Sequelize=require(_0xaa0e('0x0'));module[_0xaa0e('0x1')]={'name':{'type':Sequelize[_0xaa0e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xaa0e('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xaa0e('0x2')],'allowNull':![],'defaultValue':_0xaa0e('0x3')},'remoteUri':{'type':Sequelize[_0xaa0e('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xaa0e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1065=['sequelize','exports','STRING','HelpDesk'];(function(_0x434f67,_0x347396){var _0x5bd85e=function(_0x3cc620){while(--_0x3cc620){_0x434f67['push'](_0x434f67['shift']());}};_0x5bd85e(++_0x347396);}(_0x1065,0xec));var _0x5106=function(_0x3dd531,_0xedaa84){_0x3dd531=_0x3dd531-0x0;var _0x299141=_0x1065[_0x3dd531];return _0x299141;};'use strict';var Sequelize=require(_0x5106('0x0'));module[_0x5106('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5106('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5106('0x3')},'remoteUri':{'type':Sequelize[_0x5106('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x5106('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 395b441..77b2f5b 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 _0x16fb=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','VtigerAccount','findAll','rows','show','params','include','find','create','catch','body','getConfigurations','findOne','VtigerConfiguration','nolimit','addConfiguration','Subjects','channel','type','Descriptions','getDescriptions','VtigerField','md5','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','format','%s/webservice.php','getchallenge','login','result','success','GET','sessionName','autogenerated','reference','remove','includes','label','startsWith','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs'];(function(_0x517ad3,_0x6181f5){var _0x4dbff4=function(_0x10f378){while(--_0x10f378){_0x517ad3['push'](_0x517ad3['shift']());}};_0x4dbff4(++_0x6181f5);}(_0x16fb,0x159));var _0xb16f=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x16fb[_0x432fca];return _0x3adba4;};'use strict';var emlformat=require(_0xb16f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb16f('0x1'));var jsonpatch=require(_0xb16f('0x2'));var rp=require('request-promise');var moment=require(_0xb16f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb16f('0x4'));var util=require(_0xb16f('0x5'));var path=require(_0xb16f('0x6'));var sox=require('sox');var csv=require(_0xb16f('0x7'));var ejs=require(_0xb16f('0x8'));var fs=require('fs');var fs_extra=require(_0xb16f('0x9'));var _=require(_0xb16f('0xa'));var squel=require(_0xb16f('0xb'));var crypto=require(_0xb16f('0xc'));var jsforce=require(_0xb16f('0xd'));var deskjs=require(_0xb16f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb16f('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb16f('0x10'));var qs=require(_0xb16f('0x11'));var as=require(_0xb16f('0x12'));var hardwareService=require(_0xb16f('0x13'));var logger=require(_0xb16f('0x14'))(_0xb16f('0x15'));var utils=require('../../config/utils');var config=require(_0xb16f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb16f('0x17'))['db'];var integrations=require(_0xb16f('0x18'));function respondWithStatusCode(_0x4c7f34,_0x449e30){_0x449e30=_0x449e30||0xcc;return function(_0x4f2752){if(_0x4f2752){return _0x4c7f34['sendStatus'](_0x449e30);}return _0x4c7f34[_0xb16f('0x19')](_0x449e30)[_0xb16f('0x1a')]();};}function respondWithResult(_0x830221,_0x45b22b){_0x45b22b=_0x45b22b||0xc8;return function(_0x3e41ab){if(_0x3e41ab){return _0x830221[_0xb16f('0x19')](_0x45b22b)[_0xb16f('0x1b')](_0x3e41ab);}};}function respondWithFilteredResult(_0x869394,_0x52f310){return function(_0x22af6b){if(_0x22af6b){var _0x18ae6b=typeof _0x52f310[_0xb16f('0x1c')]===_0xb16f('0x1d')&&typeof _0x52f310[_0xb16f('0x1e')]===_0xb16f('0x1d');var _0x3433fc=_0x22af6b[_0xb16f('0x1f')];var _0x160a5a=_0x18ae6b?0x0:_0x52f310['offset'];var _0xc0e8d7=_0x18ae6b?_0x22af6b[_0xb16f('0x1f')]:_0x52f310[_0xb16f('0x1c')]+_0x52f310[_0xb16f('0x1e')];var _0x157671;if(_0xc0e8d7>=_0x3433fc){_0xc0e8d7=_0x3433fc;_0x157671=0xc8;}else{_0x157671=0xce;}_0x869394[_0xb16f('0x19')](_0x157671);return _0x869394[_0xb16f('0x20')]('Content-Range',_0x160a5a+'-'+_0xc0e8d7+'/'+_0x3433fc)['json'](_0x22af6b);}return null;};}function patchUpdates(_0x46916a){return function(_0x5adf05){try{jsonpatch[_0xb16f('0x21')](_0x5adf05,_0x46916a,!![]);}catch(_0x2eb783){return BPromise[_0xb16f('0x22')](_0x2eb783);}return _0x5adf05['save']();};}function saveUpdates(_0x51dcd4,_0x51c27a){return function(_0x509399){if(_0x509399){return _0x509399['update'](_0x51dcd4)[_0xb16f('0x23')](function(_0x511495){return _0x511495;});}return null;};}function removeEntity(_0x37c251,_0x1e558e){return function(_0x323603){if(_0x323603){return _0x323603[_0xb16f('0x24')]()[_0xb16f('0x23')](function(){_0x37c251['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56a10b,_0x56ebca){return function(_0x5f4406){if(!_0x5f4406){_0x56a10b[_0xb16f('0x25')](0x194);}return _0x5f4406;};}function handleError(_0x2f1e45,_0x4097d4){_0x4097d4=_0x4097d4||0x1f4;return function(_0x19f91c){logger[_0xb16f('0x26')](_0x19f91c['stack']);if(_0x19f91c['name']){delete _0x19f91c[_0xb16f('0x27')];}_0x2f1e45[_0xb16f('0x19')](_0x4097d4)[_0xb16f('0x28')](_0x19f91c);};}exports[_0xb16f('0x29')]=function(_0x555dc0,_0x57a986){var _0x1acb0e={},_0x4b5dee={},_0x373285={'count':0x0,'rows':[]};var _0x32c9c5=_[_0xb16f('0x2a')](db['VtigerAccount'][_0xb16f('0x2b')],function(_0x105977){return{'name':_0x105977[_0xb16f('0x2c')],'type':_0x105977['type'][_0xb16f('0x2d')]};});_0x4b5dee[_0xb16f('0x2e')]=_['map'](_0x32c9c5,'name');_0x4b5dee[_0xb16f('0x2f')]=_[_0xb16f('0x30')](_0x555dc0[_0xb16f('0x2f')]);_0x4b5dee[_0xb16f('0x31')]=_[_0xb16f('0x32')](_0x4b5dee[_0xb16f('0x2e')],_0x4b5dee[_0xb16f('0x2f')]);_0x1acb0e[_0xb16f('0x33')]=_[_0xb16f('0x32')](_0x4b5dee['model'],qs['fields'](_0x555dc0[_0xb16f('0x2f')][_0xb16f('0x34')]));_0x1acb0e[_0xb16f('0x33')]=_0x1acb0e[_0xb16f('0x33')][_0xb16f('0x35')]?_0x1acb0e[_0xb16f('0x33')]:_0x4b5dee[_0xb16f('0x2e')];if(!_0x555dc0['query'][_0xb16f('0x36')]('nolimit')){_0x1acb0e[_0xb16f('0x1e')]=qs['limit'](_0x555dc0[_0xb16f('0x2f')][_0xb16f('0x1e')]);_0x1acb0e[_0xb16f('0x1c')]=qs[_0xb16f('0x1c')](_0x555dc0['query'][_0xb16f('0x1c')]);}_0x1acb0e[_0xb16f('0x37')]=qs[_0xb16f('0x38')](_0x555dc0[_0xb16f('0x2f')]['sort']);_0x1acb0e[_0xb16f('0x39')]=qs[_0xb16f('0x31')](_[_0xb16f('0x3a')](_0x555dc0[_0xb16f('0x2f')],_0x4b5dee['filters']),_0x32c9c5);if(_0x555dc0['query'][_0xb16f('0x3b')]){_0x1acb0e[_0xb16f('0x39')]=_[_0xb16f('0x3c')](_0x1acb0e[_0xb16f('0x39')],{'$or':_[_0xb16f('0x2a')](_0x32c9c5,function(_0x36bcb2){if(_0x36bcb2['type']!==_0xb16f('0x3d')){var _0x291177={};_0x291177[_0x36bcb2[_0xb16f('0x27')]]={'$like':'%'+_0x555dc0['query'][_0xb16f('0x3b')]+'%'};return _0x291177;}})});}_0x1acb0e=_[_0xb16f('0x3c')]({},_0x1acb0e,_0x555dc0[_0xb16f('0x3e')]);var _0x165231={'where':_0x1acb0e[_0xb16f('0x39')]};return db['VtigerAccount'][_0xb16f('0x1f')](_0x165231)[_0xb16f('0x23')](function(_0x4dc23e){_0x373285['count']=_0x4dc23e;if(_0x555dc0[_0xb16f('0x2f')][_0xb16f('0x3f')]){_0x1acb0e['include']=[{'all':!![]}];}return db[_0xb16f('0x40')][_0xb16f('0x41')](_0x1acb0e);})[_0xb16f('0x23')](function(_0x262cc8){_0x373285[_0xb16f('0x42')]=_0x262cc8;return _0x373285;})[_0xb16f('0x23')](respondWithFilteredResult(_0x57a986,_0x1acb0e))['catch'](handleError(_0x57a986,null));};exports[_0xb16f('0x43')]=function(_0x119425,_0x51ff3b){var _0x10b65f={'raw':![],'where':{'id':_0x119425[_0xb16f('0x44')]['id']}},_0x1ab3a2={};_0x1ab3a2[_0xb16f('0x2e')]=_[_0xb16f('0x30')](db[_0xb16f('0x40')]['rawAttributes']);_0x1ab3a2['query']=_[_0xb16f('0x30')](_0x119425['query']);_0x1ab3a2[_0xb16f('0x31')]=_['intersection'](_0x1ab3a2[_0xb16f('0x2e')],_0x1ab3a2[_0xb16f('0x2f')]);_0x10b65f[_0xb16f('0x33')]=_[_0xb16f('0x32')](_0x1ab3a2[_0xb16f('0x2e')],qs['fields'](_0x119425[_0xb16f('0x2f')][_0xb16f('0x34')]));_0x10b65f['attributes']=_0x10b65f['attributes'][_0xb16f('0x35')]?_0x10b65f['attributes']:_0x1ab3a2[_0xb16f('0x2e')];if(_0x119425[_0xb16f('0x2f')]['includeAll']){_0x10b65f[_0xb16f('0x45')]=[{'all':!![]}];}_0x10b65f=_[_0xb16f('0x3c')]({},_0x10b65f,_0x119425[_0xb16f('0x3e')]);return db[_0xb16f('0x40')][_0xb16f('0x46')](_0x10b65f)[_0xb16f('0x23')](handleEntityNotFound(_0x51ff3b,null))[_0xb16f('0x23')](respondWithResult(_0x51ff3b,null))['catch'](handleError(_0x51ff3b,null));};exports[_0xb16f('0x47')]=function(_0x2476b8,_0x2b2aac){return db[_0xb16f('0x40')][_0xb16f('0x47')](_0x2476b8['body'],{})['then'](respondWithResult(_0x2b2aac,0xc9))[_0xb16f('0x48')](handleError(_0x2b2aac,null));};exports['update']=function(_0x4277d9,_0x4dea01){if(_0x4277d9[_0xb16f('0x49')]['id']){delete _0x4277d9['body']['id'];}return db[_0xb16f('0x40')][_0xb16f('0x46')]({'where':{'id':_0x4277d9[_0xb16f('0x44')]['id']}})[_0xb16f('0x23')](handleEntityNotFound(_0x4dea01,null))['then'](saveUpdates(_0x4277d9[_0xb16f('0x49')],null))['then'](respondWithResult(_0x4dea01,null))['catch'](handleError(_0x4dea01,null));};exports[_0xb16f('0x24')]=function(_0x3b8ffc,_0x1a318a){return db[_0xb16f('0x40')]['find']({'where':{'id':_0x3b8ffc[_0xb16f('0x44')]['id']}})['then'](handleEntityNotFound(_0x1a318a,null))[_0xb16f('0x23')](removeEntity(_0x1a318a,null))[_0xb16f('0x48')](handleError(_0x1a318a,null));};exports[_0xb16f('0x4a')]=function(_0x11c642,_0x34586a,_0x3a39cc){var _0x55ca97={};var _0x258134={};var _0x1e2a16;var _0xd56549;return db['VtigerAccount'][_0xb16f('0x4b')]({'where':{'id':_0x11c642['params']['id']}})[_0xb16f('0x23')](handleEntityNotFound(_0x34586a,null))[_0xb16f('0x23')](function(_0x4bb67b){if(_0x4bb67b){_0x1e2a16=_0x4bb67b;_0x258134[_0xb16f('0x2e')]=_[_0xb16f('0x30')](db[_0xb16f('0x4c')]['rawAttributes']);_0x258134[_0xb16f('0x2f')]=_[_0xb16f('0x30')](_0x11c642['query']);_0x258134[_0xb16f('0x31')]=_[_0xb16f('0x32')](_0x258134[_0xb16f('0x2e')],_0x258134['query']);_0x55ca97[_0xb16f('0x33')]=_[_0xb16f('0x32')](_0x258134[_0xb16f('0x2e')],qs[_0xb16f('0x34')](_0x11c642[_0xb16f('0x2f')][_0xb16f('0x34')]));_0x55ca97['attributes']=_0x55ca97[_0xb16f('0x33')][_0xb16f('0x35')]?_0x55ca97[_0xb16f('0x33')]:_0x258134[_0xb16f('0x2e')];_0x55ca97[_0xb16f('0x37')]=qs[_0xb16f('0x38')](_0x11c642['query']['sort']);_0x55ca97[_0xb16f('0x39')]=qs['filters'](_['pick'](_0x11c642[_0xb16f('0x2f')],_0x258134[_0xb16f('0x31')]));if(_0x11c642[_0xb16f('0x2f')][_0xb16f('0x3b')]){_0x55ca97[_0xb16f('0x39')]=_['merge'](_0x55ca97[_0xb16f('0x39')],{'$or':_[_0xb16f('0x2a')](_0x55ca97[_0xb16f('0x33')],function(_0x5d1a6f){var _0x12753d={};_0x12753d[_0x5d1a6f]={'$like':'%'+_0x11c642[_0xb16f('0x2f')][_0xb16f('0x3b')]+'%'};return _0x12753d;})});}_0x55ca97=_[_0xb16f('0x3c')]({},_0x55ca97,_0x11c642[_0xb16f('0x3e')]);return _0x1e2a16[_0xb16f('0x4a')](_0x55ca97);}})[_0xb16f('0x23')](function(_0x4fd1d0){if(_0x4fd1d0){_0xd56549=_0x4fd1d0[_0xb16f('0x35')];if(!_0x11c642[_0xb16f('0x2f')]['hasOwnProperty'](_0xb16f('0x4d'))){_0x55ca97[_0xb16f('0x1e')]=qs[_0xb16f('0x1e')](_0x11c642[_0xb16f('0x2f')][_0xb16f('0x1e')]);_0x55ca97[_0xb16f('0x1c')]=qs[_0xb16f('0x1c')](_0x11c642['query'][_0xb16f('0x1c')]);}return _0x1e2a16[_0xb16f('0x4a')](_0x55ca97);}})[_0xb16f('0x23')](function(_0x5c6833){if(_0x5c6833){return _0x5c6833?{'count':_0xd56549,'rows':_0x5c6833}:null;}})[_0xb16f('0x23')](respondWithResult(_0x34586a,null))[_0xb16f('0x48')](handleError(_0x34586a,null));};exports[_0xb16f('0x4e')]=function(_0x6cb5e6,_0x3bd5db,_0x24bd64){if(_0x6cb5e6[_0xb16f('0x49')]['id']){delete _0x6cb5e6[_0xb16f('0x49')]['id'];}return db['VtigerAccount'][_0xb16f('0x4b')]({'where':{'id':_0x6cb5e6[_0xb16f('0x44')]['id']}})[_0xb16f('0x23')](handleEntityNotFound(_0x3bd5db,null))['then'](function(_0x3a422b){if(_0x3a422b){_0x6cb5e6[_0xb16f('0x49')]['AccountId']=_0x3a422b['id'];_0x6cb5e6[_0xb16f('0x49')][_0xb16f('0x4f')]=integrations['getSubjects'](_0x6cb5e6[_0xb16f('0x49')][_0xb16f('0x50')],_0x6cb5e6[_0xb16f('0x49')][_0xb16f('0x51')]);_0x6cb5e6[_0xb16f('0x49')][_0xb16f('0x52')]=integrations[_0xb16f('0x53')](_0x6cb5e6['body'][_0xb16f('0x50')],_0x6cb5e6['body'][_0xb16f('0x51')]);return db[_0xb16f('0x4c')][_0xb16f('0x47')](_0x6cb5e6[_0xb16f('0x49')],{'include':[{'model':db[_0xb16f('0x54')],'as':_0xb16f('0x4f')},{'model':db[_0xb16f('0x54')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x3bd5db,null))['catch'](handleError(_0x3bd5db,null));};var md5=require(_0xb16f('0x55'));exports['getFields']=function(_0x361fa6,_0x44d868,_0x17ada1){var _0x227db0=null;var _0x3d1995=null;var _0x31ed95=null;var _0x19bd7c=null;var _0x35b6fd='';return db['VtigerAccount']['findOne']({'where':{'id':_0x361fa6[_0xb16f('0x44')]['id']},'attributes':['id',_0xb16f('0x27'),_0xb16f('0x56'),_0xb16f('0x57'),_0xb16f('0x58'),_0xb16f('0x59'),_0xb16f('0x5a'),_0xb16f('0x5b')]})[_0xb16f('0x23')](handleEntityNotFound(_0x44d868,null))['then'](function(_0x100973){if(_0x100973){_0x227db0=_0x100973[_0xb16f('0x56')];_0x3d1995=_0x100973[_0xb16f('0x5b')];_0x31ed95=_0x100973[_0xb16f('0x58')];_0x35b6fd=_0x100973[_0xb16f('0x59')];var _0x422c5b=_0x35b6fd['slice'](-0x1);if(_0x422c5b==='/'){_0x35b6fd=_0x35b6fd[_0xb16f('0x5c')](0x0,_0x35b6fd['lastIndexOf'](_0x422c5b));}_0x19bd7c=util[_0xb16f('0x5d')](_0xb16f('0x5e'),_0x35b6fd);var _0x37ad34={'method':'GET','uri':_0x19bd7c,'qs':{'operation':_0xb16f('0x5f'),'username':_0x100973['username']},'json':!![]};return rp(_0x37ad34);}})[_0xb16f('0x23')](function(_0x5a9fd3){if(_0x5a9fd3['success']){var _0x41ce3d={'method':'POST','uri':_0x19bd7c,'form':{'operation':_0xb16f('0x60'),'username':_0x227db0,'accessKey':md5(_0x5a9fd3[_0xb16f('0x61')]['token']+_0x3d1995)},'json':!![]};return rp(_0x41ce3d);}})[_0xb16f('0x23')](function(_0x4699d4){if(_0x4699d4[_0xb16f('0x62')]){var _0x3e9ea4={'method':_0xb16f('0x63'),'uri':_0x19bd7c,'qs':{'operation':'describe','username':_0x227db0,'sessionName':_0x4699d4[_0xb16f('0x61')][_0xb16f('0x64')],'elementType':_0x31ed95},'json':!![]};return rp(_0x3e9ea4);}})['then'](function(_0x3410f8){if(_0x3410f8[_0xb16f('0x62')]){var _0x443d6e=[_0xb16f('0x65'),_0xb16f('0x66'),'owner'];_[_0xb16f('0x67')](_0x3410f8[_0xb16f('0x61')][_0xb16f('0x34')],function(_0xa5ad6){return _0x443d6e[_0xb16f('0x68')](_0xa5ad6[_0xb16f('0x51')]['name']);});_[_0xb16f('0x67')](_0x3410f8[_0xb16f('0x61')][_0xb16f('0x34')],function(_0x1ef4b2){return _0x1ef4b2['editable']==='false';});return{'count':_0x3410f8[_0xb16f('0x61')][_0xb16f('0x34')][_0xb16f('0x35')],'rows':_[_0xb16f('0x2a')](_0x3410f8[_0xb16f('0x61')][_0xb16f('0x34')],function(_0x186282){return{'id':_0x186282[_0xb16f('0x27')],'name':_0x186282[_0xb16f('0x69')],'custom':_[_0xb16f('0x6a')](_0x186282[_0xb16f('0x27')],_0xb16f('0x6b'))?!![]:![],'options':_0x186282[_0xb16f('0x51')][_0xb16f('0x27')]===_0xb16f('0x6c')&&_0x186282[_0xb16f('0x51')][_0xb16f('0x6d')]['length']>0x0?_[_0xb16f('0x2a')](_0x186282[_0xb16f('0x51')]['picklistValues'],function(_0x4117dd){return{'name':_0x4117dd[_0xb16f('0x69')],'value':_0x4117dd[_0xb16f('0x6e')]};}):[]};})};}})[_0xb16f('0x23')](respondWithResult(_0x44d868,null))[_0xb16f('0x48')](function(_0xd472be){console['log'](_0xb16f('0x6f')+_0xd472be);var _0x7a6648=_0x361fa6[_0xb16f('0x2f')][_0xb16f('0x70')]?0x1f4:_0xd472be['statusCode']||0x1f4;logger[_0xb16f('0x26')](_0xb16f('0x71'),_0xb16f('0x72'),_0x7a6648,JSON[_0xb16f('0x73')](_0xd472be));delete _0xd472be[_0xb16f('0x27')];if(_0x7a6648===0x191){_0x7a6648=0x190;}_0x44d868[_0xb16f('0x19')](_0x7a6648)[_0xb16f('0x28')](_0x361fa6[_0xb16f('0x2f')][_0xb16f('0x70')]?{'message':_0xb16f('0x74'),'statusCode':_0xd472be[_0xb16f('0x75')]}:_0xd472be);});}; \ No newline at end of file +var _0xea34=['undefined','limit','offset','count','set','Content-Range','apply','save','then','destroy','stack','name','send','map','VtigerAccount','fieldName','model','query','keys','filters','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','merge','options','include','findAll','catch','params','rawAttributes','attributes','includeAll','create','body','update','find','getConfigurations','VtigerConfiguration','length','order','pick','addConfiguration','findOne','Subjects','getSubjects','getDescriptions','VtigerField','Descriptions','getFields','username','description','serverUrl','accessKey','moduleName','remoteUri','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','result','token','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x4db2e7,_0x10db77){var _0x519ee4=function(_0x3e518c){while(--_0x3e518c){_0x4db2e7['push'](_0x4db2e7['shift']());}};_0x519ee4(++_0x10db77);}(_0xea34,0x14b));var _0x4ea3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xea34[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x4ea3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4ea3('0x1'));var jsonpatch=require(_0x4ea3('0x2'));var rp=require('request-promise');var moment=require(_0x4ea3('0x3'));var BPromise=require(_0x4ea3('0x4'));var Mustache=require(_0x4ea3('0x5'));var util=require('util');var path=require(_0x4ea3('0x6'));var sox=require(_0x4ea3('0x7'));var csv=require('to-csv');var ejs=require(_0x4ea3('0x8'));var fs=require('fs');var fs_extra=require(_0x4ea3('0x9'));var _=require(_0x4ea3('0xa'));var squel=require('squel');var crypto=require(_0x4ea3('0xb'));var jsforce=require(_0x4ea3('0xc'));var deskjs=require(_0x4ea3('0xd'));var toCsv=require(_0x4ea3('0xe'));var querystring=require(_0x4ea3('0xf'));var Papa=require(_0x4ea3('0x10'));var Redis=require(_0x4ea3('0x11'));var authService=require(_0x4ea3('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ea3('0x13'));var logger=require(_0x4ea3('0x14'))('api');var utils=require(_0x4ea3('0x15'));var config=require(_0x4ea3('0x16'));var licenseUtil=require(_0x4ea3('0x17'));var db=require(_0x4ea3('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xf08402,_0x2ba550){_0x2ba550=_0x2ba550||0xcc;return function(_0x2ee7d8){if(_0x2ee7d8){return _0xf08402[_0x4ea3('0x19')](_0x2ba550);}return _0xf08402[_0x4ea3('0x1a')](_0x2ba550)[_0x4ea3('0x1b')]();};}function respondWithResult(_0x468bfd,_0x582c8e){_0x582c8e=_0x582c8e||0xc8;return function(_0x2ba0ac){if(_0x2ba0ac){return _0x468bfd[_0x4ea3('0x1a')](_0x582c8e)[_0x4ea3('0x1c')](_0x2ba0ac);}};}function respondWithFilteredResult(_0x32f27f,_0x39df04){return function(_0x1f2fb3){if(_0x1f2fb3){var _0x329708=typeof _0x39df04['offset']===_0x4ea3('0x1d')&&typeof _0x39df04[_0x4ea3('0x1e')]===_0x4ea3('0x1d');var _0x2a7c76=_0x1f2fb3['count'];var _0x47cb2b=_0x329708?0x0:_0x39df04[_0x4ea3('0x1f')];var _0x559335=_0x329708?_0x1f2fb3[_0x4ea3('0x20')]:_0x39df04[_0x4ea3('0x1f')]+_0x39df04[_0x4ea3('0x1e')];var _0x245738;if(_0x559335>=_0x2a7c76){_0x559335=_0x2a7c76;_0x245738=0xc8;}else{_0x245738=0xce;}_0x32f27f[_0x4ea3('0x1a')](_0x245738);return _0x32f27f[_0x4ea3('0x21')](_0x4ea3('0x22'),_0x47cb2b+'-'+_0x559335+'/'+_0x2a7c76)[_0x4ea3('0x1c')](_0x1f2fb3);}return null;};}function patchUpdates(_0x54a4f5){return function(_0x569624){try{jsonpatch[_0x4ea3('0x23')](_0x569624,_0x54a4f5,!![]);}catch(_0x234d02){return BPromise['reject'](_0x234d02);}return _0x569624[_0x4ea3('0x24')]();};}function saveUpdates(_0x453ad2,_0x4e73dc){return function(_0x159935){if(_0x159935){return _0x159935['update'](_0x453ad2)[_0x4ea3('0x25')](function(_0x4b81cf){return _0x4b81cf;});}return null;};}function removeEntity(_0x37cac4,_0xe31c31){return function(_0x1172f7){if(_0x1172f7){return _0x1172f7[_0x4ea3('0x26')]()['then'](function(){_0x37cac4[_0x4ea3('0x1a')](0xcc)[_0x4ea3('0x1b')]();});}};}function handleEntityNotFound(_0x4ca7f7,_0x4eb3a8){return function(_0x40b7b3){if(!_0x40b7b3){_0x4ca7f7[_0x4ea3('0x19')](0x194);}return _0x40b7b3;};}function handleError(_0x38b158,_0x547b7f){_0x547b7f=_0x547b7f||0x1f4;return function(_0x5aae53){logger['error'](_0x5aae53[_0x4ea3('0x27')]);if(_0x5aae53[_0x4ea3('0x28')]){delete _0x5aae53['name'];}_0x38b158[_0x4ea3('0x1a')](_0x547b7f)[_0x4ea3('0x29')](_0x5aae53);};}exports['index']=function(_0x25eb83,_0x4051f4){var _0x1e647f={},_0x5d9984={},_0x639188={'count':0x0,'rows':[]};var _0x30aa4a=_[_0x4ea3('0x2a')](db[_0x4ea3('0x2b')]['rawAttributes'],function(_0xc0967d){return{'name':_0xc0967d[_0x4ea3('0x2c')],'type':_0xc0967d['type']['key']};});_0x5d9984[_0x4ea3('0x2d')]=_[_0x4ea3('0x2a')](_0x30aa4a,_0x4ea3('0x28'));_0x5d9984[_0x4ea3('0x2e')]=_[_0x4ea3('0x2f')](_0x25eb83[_0x4ea3('0x2e')]);_0x5d9984[_0x4ea3('0x30')]=_[_0x4ea3('0x31')](_0x5d9984['model'],_0x5d9984[_0x4ea3('0x2e')]);_0x1e647f['attributes']=_[_0x4ea3('0x31')](_0x5d9984['model'],qs[_0x4ea3('0x32')](_0x25eb83[_0x4ea3('0x2e')][_0x4ea3('0x32')]));_0x1e647f['attributes']=_0x1e647f['attributes']['length']?_0x1e647f['attributes']:_0x5d9984[_0x4ea3('0x2d')];if(!_0x25eb83[_0x4ea3('0x2e')][_0x4ea3('0x33')](_0x4ea3('0x34'))){_0x1e647f[_0x4ea3('0x1e')]=qs[_0x4ea3('0x1e')](_0x25eb83[_0x4ea3('0x2e')][_0x4ea3('0x1e')]);_0x1e647f[_0x4ea3('0x1f')]=qs[_0x4ea3('0x1f')](_0x25eb83['query']['offset']);}_0x1e647f['order']=qs['sort'](_0x25eb83[_0x4ea3('0x2e')][_0x4ea3('0x35')]);_0x1e647f[_0x4ea3('0x36')]=qs[_0x4ea3('0x30')](_['pick'](_0x25eb83[_0x4ea3('0x2e')],_0x5d9984[_0x4ea3('0x30')]),_0x30aa4a);if(_0x25eb83[_0x4ea3('0x2e')][_0x4ea3('0x37')]){_0x1e647f[_0x4ea3('0x36')]=_['merge'](_0x1e647f[_0x4ea3('0x36')],{'$or':_['map'](_0x30aa4a,function(_0x18e38a){if(_0x18e38a[_0x4ea3('0x38')]!==_0x4ea3('0x39')){var _0x287eec={};_0x287eec[_0x18e38a['name']]={'$like':'%'+_0x25eb83[_0x4ea3('0x2e')][_0x4ea3('0x37')]+'%'};return _0x287eec;}})});}_0x1e647f=_[_0x4ea3('0x3a')]({},_0x1e647f,_0x25eb83[_0x4ea3('0x3b')]);var _0x2748cc={'where':_0x1e647f[_0x4ea3('0x36')]};return db[_0x4ea3('0x2b')][_0x4ea3('0x20')](_0x2748cc)['then'](function(_0x212a23){_0x639188[_0x4ea3('0x20')]=_0x212a23;if(_0x25eb83[_0x4ea3('0x2e')]['includeAll']){_0x1e647f[_0x4ea3('0x3c')]=[{'all':!![]}];}return db[_0x4ea3('0x2b')][_0x4ea3('0x3d')](_0x1e647f);})[_0x4ea3('0x25')](function(_0x194ad3){_0x639188['rows']=_0x194ad3;return _0x639188;})[_0x4ea3('0x25')](respondWithFilteredResult(_0x4051f4,_0x1e647f))[_0x4ea3('0x3e')](handleError(_0x4051f4,null));};exports['show']=function(_0x2d54fb,_0x113d9d){var _0x5d0ccf={'raw':![],'where':{'id':_0x2d54fb[_0x4ea3('0x3f')]['id']}},_0x48e31a={};_0x48e31a['model']=_[_0x4ea3('0x2f')](db['VtigerAccount'][_0x4ea3('0x40')]);_0x48e31a[_0x4ea3('0x2e')]=_[_0x4ea3('0x2f')](_0x2d54fb[_0x4ea3('0x2e')]);_0x48e31a[_0x4ea3('0x30')]=_[_0x4ea3('0x31')](_0x48e31a[_0x4ea3('0x2d')],_0x48e31a[_0x4ea3('0x2e')]);_0x5d0ccf[_0x4ea3('0x41')]=_['intersection'](_0x48e31a[_0x4ea3('0x2d')],qs[_0x4ea3('0x32')](_0x2d54fb[_0x4ea3('0x2e')][_0x4ea3('0x32')]));_0x5d0ccf[_0x4ea3('0x41')]=_0x5d0ccf['attributes']['length']?_0x5d0ccf['attributes']:_0x48e31a[_0x4ea3('0x2d')];if(_0x2d54fb[_0x4ea3('0x2e')][_0x4ea3('0x42')]){_0x5d0ccf[_0x4ea3('0x3c')]=[{'all':!![]}];}_0x5d0ccf=_['merge']({},_0x5d0ccf,_0x2d54fb['options']);return db[_0x4ea3('0x2b')]['find'](_0x5d0ccf)[_0x4ea3('0x25')](handleEntityNotFound(_0x113d9d,null))[_0x4ea3('0x25')](respondWithResult(_0x113d9d,null))['catch'](handleError(_0x113d9d,null));};exports[_0x4ea3('0x43')]=function(_0x197c17,_0x5278c8){return db['VtigerAccount'][_0x4ea3('0x43')](_0x197c17[_0x4ea3('0x44')],{})[_0x4ea3('0x25')](respondWithResult(_0x5278c8,0xc9))[_0x4ea3('0x3e')](handleError(_0x5278c8,null));};exports[_0x4ea3('0x45')]=function(_0xd1c210,_0x59d31b){if(_0xd1c210[_0x4ea3('0x44')]['id']){delete _0xd1c210['body']['id'];}return db['VtigerAccount'][_0x4ea3('0x46')]({'where':{'id':_0xd1c210[_0x4ea3('0x3f')]['id']}})[_0x4ea3('0x25')](handleEntityNotFound(_0x59d31b,null))[_0x4ea3('0x25')](saveUpdates(_0xd1c210[_0x4ea3('0x44')],null))['then'](respondWithResult(_0x59d31b,null))[_0x4ea3('0x3e')](handleError(_0x59d31b,null));};exports[_0x4ea3('0x26')]=function(_0x450af3,_0x144815){return db[_0x4ea3('0x2b')][_0x4ea3('0x46')]({'where':{'id':_0x450af3['params']['id']}})[_0x4ea3('0x25')](handleEntityNotFound(_0x144815,null))[_0x4ea3('0x25')](removeEntity(_0x144815,null))[_0x4ea3('0x3e')](handleError(_0x144815,null));};exports[_0x4ea3('0x47')]=function(_0x4f3c6d,_0x36e2e5,_0x2e2dac){var _0x1d72a6={};var _0x349d67={};var _0x4db14a;var _0x2222ce;return db[_0x4ea3('0x2b')]['findOne']({'where':{'id':_0x4f3c6d[_0x4ea3('0x3f')]['id']}})[_0x4ea3('0x25')](handleEntityNotFound(_0x36e2e5,null))[_0x4ea3('0x25')](function(_0x22c1db){if(_0x22c1db){_0x4db14a=_0x22c1db;_0x349d67[_0x4ea3('0x2d')]=_[_0x4ea3('0x2f')](db[_0x4ea3('0x48')][_0x4ea3('0x40')]);_0x349d67[_0x4ea3('0x2e')]=_[_0x4ea3('0x2f')](_0x4f3c6d[_0x4ea3('0x2e')]);_0x349d67['filters']=_[_0x4ea3('0x31')](_0x349d67['model'],_0x349d67[_0x4ea3('0x2e')]);_0x1d72a6['attributes']=_[_0x4ea3('0x31')](_0x349d67[_0x4ea3('0x2d')],qs[_0x4ea3('0x32')](_0x4f3c6d[_0x4ea3('0x2e')][_0x4ea3('0x32')]));_0x1d72a6[_0x4ea3('0x41')]=_0x1d72a6[_0x4ea3('0x41')][_0x4ea3('0x49')]?_0x1d72a6['attributes']:_0x349d67[_0x4ea3('0x2d')];_0x1d72a6[_0x4ea3('0x4a')]=qs[_0x4ea3('0x35')](_0x4f3c6d[_0x4ea3('0x2e')][_0x4ea3('0x35')]);_0x1d72a6['where']=qs[_0x4ea3('0x30')](_[_0x4ea3('0x4b')](_0x4f3c6d[_0x4ea3('0x2e')],_0x349d67[_0x4ea3('0x30')]));if(_0x4f3c6d['query'][_0x4ea3('0x37')]){_0x1d72a6[_0x4ea3('0x36')]=_['merge'](_0x1d72a6[_0x4ea3('0x36')],{'$or':_['map'](_0x1d72a6['attributes'],function(_0x792589){var _0x66bb24={};_0x66bb24[_0x792589]={'$like':'%'+_0x4f3c6d[_0x4ea3('0x2e')][_0x4ea3('0x37')]+'%'};return _0x66bb24;})});}_0x1d72a6=_[_0x4ea3('0x3a')]({},_0x1d72a6,_0x4f3c6d[_0x4ea3('0x3b')]);return _0x4db14a[_0x4ea3('0x47')](_0x1d72a6);}})[_0x4ea3('0x25')](function(_0x2c12c6){if(_0x2c12c6){_0x2222ce=_0x2c12c6['length'];if(!_0x4f3c6d[_0x4ea3('0x2e')]['hasOwnProperty']('nolimit')){_0x1d72a6[_0x4ea3('0x1e')]=qs[_0x4ea3('0x1e')](_0x4f3c6d[_0x4ea3('0x2e')][_0x4ea3('0x1e')]);_0x1d72a6[_0x4ea3('0x1f')]=qs[_0x4ea3('0x1f')](_0x4f3c6d['query'][_0x4ea3('0x1f')]);}return _0x4db14a[_0x4ea3('0x47')](_0x1d72a6);}})[_0x4ea3('0x25')](function(_0x14c0d7){if(_0x14c0d7){return _0x14c0d7?{'count':_0x2222ce,'rows':_0x14c0d7}:null;}})[_0x4ea3('0x25')](respondWithResult(_0x36e2e5,null))['catch'](handleError(_0x36e2e5,null));};exports[_0x4ea3('0x4c')]=function(_0x1ae35f,_0x8b111a,_0x21a2a8){if(_0x1ae35f['body']['id']){delete _0x1ae35f[_0x4ea3('0x44')]['id'];}return db[_0x4ea3('0x2b')][_0x4ea3('0x4d')]({'where':{'id':_0x1ae35f['params']['id']}})['then'](handleEntityNotFound(_0x8b111a,null))['then'](function(_0x2e435d){if(_0x2e435d){_0x1ae35f['body']['AccountId']=_0x2e435d['id'];_0x1ae35f[_0x4ea3('0x44')][_0x4ea3('0x4e')]=integrations[_0x4ea3('0x4f')](_0x1ae35f['body']['channel'],_0x1ae35f[_0x4ea3('0x44')][_0x4ea3('0x38')]);_0x1ae35f[_0x4ea3('0x44')]['Descriptions']=integrations[_0x4ea3('0x50')](_0x1ae35f['body']['channel'],_0x1ae35f['body'][_0x4ea3('0x38')]);return db[_0x4ea3('0x48')]['create'](_0x1ae35f[_0x4ea3('0x44')],{'include':[{'model':db['VtigerField'],'as':_0x4ea3('0x4e')},{'model':db[_0x4ea3('0x51')],'as':_0x4ea3('0x52')}]});}return null;})['then'](respondWithResult(_0x8b111a,null))[_0x4ea3('0x3e')](handleError(_0x8b111a,null));};var md5=require('md5');exports[_0x4ea3('0x53')]=function(_0x5db9a2,_0x2bcc62,_0x5e9604){var _0x1082af=null;var _0x252369=null;var _0x525eab=null;var _0x35f491=null;var _0x9bc524='';return db[_0x4ea3('0x2b')]['findOne']({'where':{'id':_0x5db9a2[_0x4ea3('0x3f')]['id']},'attributes':['id',_0x4ea3('0x28'),_0x4ea3('0x54'),_0x4ea3('0x55'),'moduleName','remoteUri',_0x4ea3('0x56'),_0x4ea3('0x57')]})[_0x4ea3('0x25')](handleEntityNotFound(_0x2bcc62,null))[_0x4ea3('0x25')](function(_0x5cade0){if(_0x5cade0){_0x1082af=_0x5cade0[_0x4ea3('0x54')];_0x252369=_0x5cade0[_0x4ea3('0x57')];_0x525eab=_0x5cade0[_0x4ea3('0x58')];_0x9bc524=_0x5cade0[_0x4ea3('0x59')];var _0x374ed1=_0x9bc524[_0x4ea3('0x5a')](-0x1);if(_0x374ed1==='/'){_0x9bc524=_0x9bc524[_0x4ea3('0x5b')](0x0,_0x9bc524[_0x4ea3('0x5c')](_0x374ed1));}_0x35f491=util[_0x4ea3('0x5d')](_0x4ea3('0x5e'),_0x9bc524);var _0x1d898b={'method':'GET','uri':_0x35f491,'qs':{'operation':_0x4ea3('0x5f'),'username':_0x5cade0['username']},'json':!![]};return rp(_0x1d898b);}})[_0x4ea3('0x25')](function(_0x32a82f){if(_0x32a82f[_0x4ea3('0x60')]){var _0x101777={'method':_0x4ea3('0x61'),'uri':_0x35f491,'form':{'operation':_0x4ea3('0x62'),'username':_0x1082af,'accessKey':md5(_0x32a82f[_0x4ea3('0x63')][_0x4ea3('0x64')]+_0x252369)},'json':!![]};return rp(_0x101777);}})[_0x4ea3('0x25')](function(_0x53f047){if(_0x53f047['success']){var _0x4b9233={'method':'GET','uri':_0x35f491,'qs':{'operation':_0x4ea3('0x65'),'username':_0x1082af,'sessionName':_0x53f047[_0x4ea3('0x63')][_0x4ea3('0x66')],'elementType':_0x525eab},'json':!![]};return rp(_0x4b9233);}})['then'](function(_0x2c4642){if(_0x2c4642[_0x4ea3('0x60')]){var _0x397e48=[_0x4ea3('0x67'),_0x4ea3('0x68'),_0x4ea3('0x69')];_[_0x4ea3('0x6a')](_0x2c4642['result'][_0x4ea3('0x32')],function(_0x1b7259){return _0x397e48[_0x4ea3('0x6b')](_0x1b7259[_0x4ea3('0x38')][_0x4ea3('0x28')]);});_[_0x4ea3('0x6a')](_0x2c4642[_0x4ea3('0x63')][_0x4ea3('0x32')],function(_0x505325){return _0x505325[_0x4ea3('0x6c')]===_0x4ea3('0x6d');});return{'count':_0x2c4642['result']['fields'][_0x4ea3('0x49')],'rows':_[_0x4ea3('0x2a')](_0x2c4642[_0x4ea3('0x63')]['fields'],function(_0x17eda1){return{'id':_0x17eda1[_0x4ea3('0x28')],'name':_0x17eda1[_0x4ea3('0x6e')],'custom':_[_0x4ea3('0x6f')](_0x17eda1[_0x4ea3('0x28')],_0x4ea3('0x70'))?!![]:![],'options':_0x17eda1[_0x4ea3('0x38')][_0x4ea3('0x28')]===_0x4ea3('0x71')&&_0x17eda1['type'][_0x4ea3('0x72')][_0x4ea3('0x49')]>0x0?_[_0x4ea3('0x2a')](_0x17eda1[_0x4ea3('0x38')][_0x4ea3('0x72')],function(_0x47e7e6){return{'name':_0x47e7e6[_0x4ea3('0x6e')],'value':_0x47e7e6['value']};}):[]};})};}})['then'](respondWithResult(_0x2bcc62,null))['catch'](function(_0x18e56a){console[_0x4ea3('0x73')](_0x4ea3('0x74')+_0x18e56a);var _0x12f03c=_0x5db9a2[_0x4ea3('0x2e')][_0x4ea3('0x75')]?0x1f4:_0x18e56a[_0x4ea3('0x76')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x4ea3('0x53'),_0x12f03c,JSON['stringify'](_0x18e56a));delete _0x18e56a[_0x4ea3('0x28')];if(_0x12f03c===0x191){_0x12f03c=0x190;}_0x2bcc62[_0x4ea3('0x1a')](_0x12f03c)['send'](_0x5db9a2['query'][_0x4ea3('0x75')]?{'message':_0x4ea3('0x77'),'statusCode':_0x18e56a[_0x4ea3('0x76')]}:_0x18e56a);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 8caafdd..b266bae 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 _0x407e=['../../components/integrations/configuration','exports','int_vtiger_accounts','lodash','bluebird','../../config/environment','./intVtigerAccount.attributes'];(function(_0x602436,_0xbf433){var _0x504c33=function(_0x4770a0){while(--_0x4770a0){_0x602436['push'](_0x602436['shift']());}};_0x504c33(++_0xbf433);}(_0x407e,0xb9));var _0xe407=function(_0x13b3b5,_0x52d8d8){_0x13b3b5=_0x13b3b5-0x0;var _0x337cd0=_0x407e[_0x13b3b5];return _0x337cd0;};'use strict';var _=require(_0xe407('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe407('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe407('0x2'));var attributes=require(_0xe407('0x3'));var integrations=require(_0xe407('0x4'));module[_0xe407('0x5')]=function(_0x256d1b,_0x3d4b76){return _0x256d1b['define']('VtigerAccount',attributes,{'tableName':_0xe407('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa52d=['../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','util','../../config/logger','moment','path','rimraf','../../config/environment','./intVtigerAccount.attributes'];(function(_0x41ff52,_0x327e2b){var _0x2e859e=function(_0x49b84c){while(--_0x49b84c){_0x41ff52['push'](_0x41ff52['shift']());}};_0x2e859e(++_0x327e2b);}(_0xa52d,0xad));var _0xda52=function(_0x28b0a1,_0x99bd0a){_0x28b0a1=_0x28b0a1-0x0;var _0x21470c=_0xa52d[_0x28b0a1];return _0x21470c;};'use strict';var _=require('lodash');var util=require(_0xda52('0x0'));var logger=require(_0xda52('0x1'))('api');var moment=require(_0xda52('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xda52('0x3'));var rimraf=require(_0xda52('0x4'));var config=require(_0xda52('0x5'));var attributes=require(_0xda52('0x6'));var integrations=require(_0xda52('0x7'));module[_0xda52('0x8')]=function(_0xda7cd9,_0x208eaf){return _0xda7cd9[_0xda52('0x9')](_0xda52('0xa'),attributes,{'tableName':_0xda52('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 1fd6b7f..9338480 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 _0x69d3=['debug','stringify','error','code','message','result','catch','VtigerAccount','options','raw','attributes','limit','include','model','map','then','GetVtigerAccount','ShowVtigerAccount','find','where','lodash','util','moment','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1f7367,_0x2bc8e6){var _0xb41671=function(_0x444bca){while(--_0x444bca){_0x1f7367['push'](_0x1f7367['shift']());}};_0xb41671(++_0x2bc8e6);}(_0x69d3,0xda));var _0x369d=function(_0x43d607,_0x1be6e5){_0x43d607=_0x43d607-0x0;var _0xca9539=_0x69d3[_0x43d607];return _0xca9539;};'use strict';var _=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var moment=require(_0x369d('0x2'));var BPromise=require('bluebird');var rs=require(_0x369d('0x3'));var fs=require('fs');var Redis=require(_0x369d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x369d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x369d('0x6'));var client=jayson[_0x369d('0x7')][_0x369d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x424d8c,_0x1bd94c,_0x186302){return new BPromise(function(_0x3adb26,_0x2ac0ec){return client[_0x369d('0x9')](_0x424d8c,_0x186302)['then'](function(_0x5d2ded){logger[_0x369d('0xa')](_0x369d('0xb'),_0x1bd94c,_0x369d('0xc'));logger[_0x369d('0xd')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x1bd94c,'request\x20sent',JSON[_0x369d('0xe')](_0x5d2ded));if(_0x5d2ded[_0x369d('0xf')]){if(_0x5d2ded[_0x369d('0xf')][_0x369d('0x10')]===0x1f4){logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x5d2ded['error'][_0x369d('0x11')]);return _0x2ac0ec(_0x5d2ded[_0x369d('0xf')][_0x369d('0x11')]);}logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x5d2ded['error']['message']);return _0x3adb26(_0x5d2ded['error'][_0x369d('0x11')]);}else{logger[_0x369d('0xa')](_0x369d('0xb'),_0x1bd94c,'request\x20sent');_0x3adb26(_0x5d2ded[_0x369d('0x12')][_0x369d('0x11')]);}})[_0x369d('0x13')](function(_0x4e234e){logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x4e234e);_0x2ac0ec(_0x4e234e);});});}exports['GetVtigerAccount']=function(_0x572513){var _0x597b67=this;return new Promise(function(_0x2946be,_0x4494b3){return db[_0x369d('0x14')]['findAll']({'raw':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')][_0x369d('0x16')]===undefined?!![]:![]:!![],'where':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')]['where']||null:null,'attributes':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')][_0x369d('0x17')]||null:null,'limit':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')][_0x369d('0x18')]||null:null,'include':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')]['include']?_['map'](_0x572513[_0x369d('0x15')][_0x369d('0x19')],function(_0xf7bc3a){return{'model':db[_0xf7bc3a[_0x369d('0x1a')]],'as':_0xf7bc3a['as'],'attributes':_0xf7bc3a[_0x369d('0x17')],'include':_0xf7bc3a[_0x369d('0x19')]?_[_0x369d('0x1b')](_0xf7bc3a['include'],function(_0x4dfe83){return{'model':db[_0x4dfe83[_0x369d('0x1a')]],'as':_0x4dfe83['as'],'attributes':_0x4dfe83[_0x369d('0x17')],'include':_0x4dfe83[_0x369d('0x19')]?_[_0x369d('0x1b')](_0x4dfe83[_0x369d('0x19')],function(_0x41e0cf){return{'model':db[_0x41e0cf[_0x369d('0x1a')]],'as':_0x41e0cf['as'],'attributes':_0x41e0cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x369d('0x1c')](function(_0xe95742){logger[_0x369d('0xa')](_0x369d('0x1d'),_0x572513);logger[_0x369d('0xd')](_0x369d('0x1d'),_0x572513,JSON[_0x369d('0xe')](_0xe95742));_0x2946be(_0xe95742);})['catch'](function(_0x157291){logger['error']('GetVtigerAccount',_0x157291[_0x369d('0x11')],_0x572513);_0x4494b3(_0x597b67[_0x369d('0xf')](0x1f4,_0x157291['message']));});});};exports[_0x369d('0x1e')]=function(_0x5a14ce){var _0x37274f=this;return new Promise(function(_0x39d656,_0xe45219){return db[_0x369d('0x14')][_0x369d('0x1f')]({'raw':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')][_0x369d('0x20')]||null:null,'attributes':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')][_0x369d('0x17')]||null:null,'include':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')]['include']?_[_0x369d('0x1b')](_0x5a14ce[_0x369d('0x15')][_0x369d('0x19')],function(_0x1b4453){return{'model':db[_0x1b4453[_0x369d('0x1a')]],'as':_0x1b4453['as'],'attributes':_0x1b4453['attributes'],'include':_0x1b4453[_0x369d('0x19')]?_[_0x369d('0x1b')](_0x1b4453[_0x369d('0x19')],function(_0x3a0277){return{'model':db[_0x3a0277[_0x369d('0x1a')]],'as':_0x3a0277['as'],'attributes':_0x3a0277[_0x369d('0x17')],'include':_0x3a0277['include']?_[_0x369d('0x1b')](_0x3a0277[_0x369d('0x19')],function(_0x40afb2){return{'model':db[_0x40afb2[_0x369d('0x1a')]],'as':_0x40afb2['as'],'attributes':_0x40afb2[_0x369d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x369d('0x1c')](function(_0xfa13da){logger[_0x369d('0xa')](_0x369d('0x1e'),_0x5a14ce);logger[_0x369d('0xd')](_0x369d('0x1e'),_0x5a14ce,JSON[_0x369d('0xe')](_0xfa13da));_0x39d656(_0xfa13da);})[_0x369d('0x13')](function(_0x43d734){logger[_0x369d('0xf')](_0x369d('0x1e'),_0x43d734[_0x369d('0x11')],_0x5a14ce);_0xe45219(_0x37274f[_0x369d('0xf')](0x1f4,_0x43d734[_0x369d('0x11')]));});});}; \ No newline at end of file +var _0xb58b=['model','map','debug','catch','ShowVtigerAccount','find','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','attributes','limit','include'];(function(_0x2085f3,_0x50105b){var _0x384e3c=function(_0x235fa0){while(--_0x235fa0){_0x2085f3['push'](_0x2085f3['shift']());}};_0x384e3c(++_0x50105b);}(_0xb58b,0x1f1));var _0xbb58=function(_0x3e6406,_0x597408){_0x3e6406=_0x3e6406-0x0;var _0x508ec7=_0xb58b[_0x3e6406];return _0x508ec7;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var moment=require(_0xbb58('0x1'));var BPromise=require(_0xbb58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb58('0x3'));var db=require(_0xbb58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb58('0x5'))('rpc');var config=require(_0xbb58('0x6'));var jayson=require(_0xbb58('0x7'));var client=jayson[_0xbb58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27cbda,_0x323066,_0xe874f2){return new BPromise(function(_0x5d7fe8,_0xd94f1){return client[_0xbb58('0x9')](_0x27cbda,_0xe874f2)[_0xbb58('0xa')](function(_0x36ca50){logger[_0xbb58('0xb')](_0xbb58('0xc'),_0x323066,_0xbb58('0xd'));logger['debug'](_0xbb58('0xe'),_0x323066,'request\x20sent',JSON[_0xbb58('0xf')](_0x36ca50));if(_0x36ca50[_0xbb58('0x10')]){if(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x11')]===0x1f4){logger['error'](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0xd94f1(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}logger[_0xbb58('0x10')](_0xbb58('0xc'),_0x323066,_0x36ca50[_0xbb58('0x10')]['message']);return _0x5d7fe8(_0x36ca50[_0xbb58('0x10')][_0xbb58('0x12')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x323066,_0xbb58('0xd'));_0x5d7fe8(_0x36ca50[_0xbb58('0x13')][_0xbb58('0x12')]);}})['catch'](function(_0x5edc97){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x323066,_0x5edc97);_0xd94f1(_0x5edc97);});});}exports[_0xbb58('0x14')]=function(_0x3134ea){var _0x48f3e0=this;return new Promise(function(_0xbee66,_0x497653){return db[_0xbb58('0x15')][_0xbb58('0x16')]({'raw':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x18')]===undefined?!![]:![]:!![],'where':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')]['where']||null:null,'attributes':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x19')]||null:null,'limit':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x1a')]||null:null,'include':_0x3134ea[_0xbb58('0x17')]?_0x3134ea[_0xbb58('0x17')][_0xbb58('0x1b')]?_['map'](_0x3134ea[_0xbb58('0x17')]['include'],function(_0x21964d){return{'model':db[_0x21964d[_0xbb58('0x1c')]],'as':_0x21964d['as'],'attributes':_0x21964d[_0xbb58('0x19')],'include':_0x21964d[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x21964d[_0xbb58('0x1b')],function(_0x2d556a){return{'model':db[_0x2d556a[_0xbb58('0x1c')]],'as':_0x2d556a['as'],'attributes':_0x2d556a['attributes'],'include':_0x2d556a[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x2d556a[_0xbb58('0x1b')],function(_0x129094){return{'model':db[_0x129094[_0xbb58('0x1c')]],'as':_0x129094['as'],'attributes':_0x129094[_0xbb58('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbb58('0xa')](function(_0x2ce7c3){logger[_0xbb58('0xb')](_0xbb58('0x14'),_0x3134ea);logger[_0xbb58('0x1e')](_0xbb58('0x14'),_0x3134ea,JSON[_0xbb58('0xf')](_0x2ce7c3));_0xbee66(_0x2ce7c3);})[_0xbb58('0x1f')](function(_0x3559b6){logger['error'](_0xbb58('0x14'),_0x3559b6[_0xbb58('0x12')],_0x3134ea);_0x497653(_0x48f3e0[_0xbb58('0x10')](0x1f4,_0x3559b6[_0xbb58('0x12')]));});});};exports[_0xbb58('0x20')]=function(_0x9d379f){var _0x1ba526=this;return new Promise(function(_0x643e0e,_0x3f8db3){return db['VtigerAccount'][_0xbb58('0x21')]({'raw':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x18')]===undefined?!![]:![]:!![],'where':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x22')]||null:null,'attributes':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x19')]||null:null,'include':_0x9d379f[_0xbb58('0x17')]?_0x9d379f[_0xbb58('0x17')][_0xbb58('0x1b')]?_['map'](_0x9d379f['options']['include'],function(_0x1def9f){return{'model':db[_0x1def9f[_0xbb58('0x1c')]],'as':_0x1def9f['as'],'attributes':_0x1def9f[_0xbb58('0x19')],'include':_0x1def9f[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x1def9f[_0xbb58('0x1b')],function(_0x3093bf){return{'model':db[_0x3093bf[_0xbb58('0x1c')]],'as':_0x3093bf['as'],'attributes':_0x3093bf['attributes'],'include':_0x3093bf[_0xbb58('0x1b')]?_[_0xbb58('0x1d')](_0x3093bf['include'],function(_0x33ec68){return{'model':db[_0x33ec68['model']],'as':_0x33ec68['as'],'attributes':_0x33ec68[_0xbb58('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x86372e){logger[_0xbb58('0xb')]('ShowVtigerAccount',_0x9d379f);logger[_0xbb58('0x1e')](_0xbb58('0x20'),_0x9d379f,JSON[_0xbb58('0xf')](_0x86372e));_0x643e0e(_0x86372e);})[_0xbb58('0x1f')](function(_0x1b86a6){logger[_0xbb58('0x10')](_0xbb58('0x20'),_0x1b86a6[_0xbb58('0x12')],_0x9d379f);_0x3f8db3(_0x1ba526['error'](0x1f4,_0x1b86a6[_0xbb58('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 4e0e606..3e1c6cf 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 _0xd6b4=['create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x419e17,_0x7fe78c){var _0x1f2044=function(_0x3723e6){while(--_0x3723e6){_0x419e17['push'](_0x419e17['shift']());}};_0x1f2044(++_0x7fe78c);}(_0xd6b4,0x87));var _0x4d6b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd6b4[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x4d6b('0x0'));var util=require(_0x4d6b('0x1'));var path=require(_0x4d6b('0x2'));var timeout=require(_0x4d6b('0x3'));var express=require(_0x4d6b('0x4'));var router=express[_0x4d6b('0x5')]();var fs_extra=require(_0x4d6b('0x6'));var auth=require(_0x4d6b('0x7'));var interaction=require(_0x4d6b('0x8'));var config=require(_0x4d6b('0x9'));var controller=require(_0x4d6b('0xa'));router[_0x4d6b('0xb')]('/',auth[_0x4d6b('0xc')](),controller[_0x4d6b('0xd')]);router[_0x4d6b('0xb')](_0x4d6b('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x4d6b('0xb')](_0x4d6b('0xf'),auth[_0x4d6b('0xc')](),controller[_0x4d6b('0x10')]);router[_0x4d6b('0xb')](_0x4d6b('0x11'),auth[_0x4d6b('0xc')](),controller[_0x4d6b('0x12')]);router[_0x4d6b('0xb')](_0x4d6b('0x13'),auth[_0x4d6b('0xc')](),controller[_0x4d6b('0x14')]);router['post']('/',auth[_0x4d6b('0xc')](),controller[_0x4d6b('0x15')]);router[_0x4d6b('0x16')]('/:id',auth[_0x4d6b('0xc')](),controller[_0x4d6b('0x17')]);router[_0x4d6b('0x18')](_0x4d6b('0xe'),auth[_0x4d6b('0xc')](),controller[_0x4d6b('0x19')]);module['exports']=router; \ No newline at end of file +var _0xd898=['update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x30ecb8,_0x235cde){var _0x2127b8=function(_0x280853){while(--_0x280853){_0x30ecb8['push'](_0x30ecb8['shift']());}};_0x2127b8(++_0x235cde);}(_0xd898,0x8d));var _0x8d89=function(_0x3bc17b,_0x3a3782){_0x3bc17b=_0x3bc17b-0x0;var _0x115843=_0xd898[_0x3bc17b];return _0x115843;};'use strict';var multer=require(_0x8d89('0x0'));var util=require(_0x8d89('0x1'));var path=require(_0x8d89('0x2'));var timeout=require('connect-timeout');var express=require(_0x8d89('0x3'));var router=express[_0x8d89('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8d89('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8d89('0x6'));var controller=require(_0x8d89('0x7'));router['get']('/',auth[_0x8d89('0x8')](),controller[_0x8d89('0x9')]);router[_0x8d89('0xa')](_0x8d89('0xb'),auth[_0x8d89('0x8')](),controller[_0x8d89('0xc')]);router[_0x8d89('0xa')](_0x8d89('0xd'),auth['isAuthenticated'](),controller[_0x8d89('0xe')]);router[_0x8d89('0xa')](_0x8d89('0xf'),auth[_0x8d89('0x8')](),controller[_0x8d89('0x10')]);router[_0x8d89('0xa')](_0x8d89('0x11'),auth[_0x8d89('0x8')](),controller[_0x8d89('0x12')]);router[_0x8d89('0x13')]('/',auth[_0x8d89('0x8')](),controller['create']);router['put'](_0x8d89('0xb'),auth[_0x8d89('0x8')](),controller[_0x8d89('0x14')]);router[_0x8d89('0x15')](_0x8d89('0xb'),auth[_0x8d89('0x8')](),controller[_0x8d89('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 331d614..8be3560 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 _0xa31d=['STRING','sequelize','exports'];(function(_0x16bb78,_0x1c425a){var _0xe4dd46=function(_0x456f79){while(--_0x456f79){_0x16bb78['push'](_0x16bb78['shift']());}};_0xe4dd46(++_0x1c425a);}(_0xa31d,0x12a));var _0xda31=function(_0x523adf,_0x3e1620){_0x523adf=_0x523adf-0x0;var _0x283870=_0xa31d[_0x523adf];return _0x283870;};'use strict';var Sequelize=require(_0xda31('0x0'));module[_0xda31('0x1')]={'name':{'type':Sequelize[_0xda31('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3830=['STRING','sequelize','exports'];(function(_0x1d5cfa,_0x57efb0){var _0x19a273=function(_0x2fe3f5){while(--_0x2fe3f5){_0x1d5cfa['push'](_0x1d5cfa['shift']());}};_0x19a273(++_0x57efb0);}(_0x3830,0x7c));var _0x0383=function(_0x39caaa,_0x1f37bc){_0x39caaa=_0x39caaa-0x0;var _0x9b9c7d=_0x3830[_0x39caaa];return _0x9b9c7d;};'use strict';var Sequelize=require(_0x0383('0x0'));module[_0x0383('0x1')]={'name':{'type':Sequelize[_0x0383('0x2')]},'description':{'type':Sequelize[_0x0383('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 7f86e58..89864dc 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 _0xf2c9=['getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','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','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','then','destroy','error','name','send','index','VtigerConfiguration','rawAttributes','type','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','params','keys','includeAll','include','find','catch','create','body','update','getFields','findOne','VtigerField','length','pick','nolimit'];(function(_0x3d38ae,_0x51102b){var _0x3757ee=function(_0x22bac8){while(--_0x22bac8){_0x3d38ae['push'](_0x3d38ae['shift']());}};_0x3757ee(++_0x51102b);}(_0xf2c9,0xa4));var _0x9f2c=function(_0x549fb4,_0x57140c){_0x549fb4=_0x549fb4-0x0;var _0xc64c37=_0xf2c9[_0x549fb4];return _0xc64c37;};'use strict';var emlformat=require(_0x9f2c('0x0'));var rimraf=require(_0x9f2c('0x1'));var zipdir=require(_0x9f2c('0x2'));var jsonpatch=require(_0x9f2c('0x3'));var rp=require(_0x9f2c('0x4'));var moment=require('moment');var BPromise=require(_0x9f2c('0x5'));var Mustache=require(_0x9f2c('0x6'));var util=require(_0x9f2c('0x7'));var path=require(_0x9f2c('0x8'));var sox=require(_0x9f2c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f2c('0xa'));var _=require(_0x9f2c('0xb'));var squel=require('squel');var crypto=require(_0x9f2c('0xc'));var jsforce=require(_0x9f2c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9f2c('0xe'));var querystring=require(_0x9f2c('0xf'));var Papa=require(_0x9f2c('0x10'));var Redis=require(_0x9f2c('0x11'));var authService=require(_0x9f2c('0x12'));var qs=require(_0x9f2c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f2c('0x14'));var logger=require(_0x9f2c('0x15'))(_0x9f2c('0x16'));var utils=require(_0x9f2c('0x17'));var config=require(_0x9f2c('0x18'));var licenseUtil=require(_0x9f2c('0x19'));var db=require(_0x9f2c('0x1a'))['db'];function respondWithStatusCode(_0x5433fe,_0x2978b8){_0x2978b8=_0x2978b8||0xcc;return function(_0x342009){if(_0x342009){return _0x5433fe[_0x9f2c('0x1b')](_0x2978b8);}return _0x5433fe[_0x9f2c('0x1c')](_0x2978b8)['end']();};}function respondWithResult(_0x1a3c92,_0x546d57){_0x546d57=_0x546d57||0xc8;return function(_0xc10036){if(_0xc10036){return _0x1a3c92[_0x9f2c('0x1c')](_0x546d57)[_0x9f2c('0x1d')](_0xc10036);}};}function respondWithFilteredResult(_0x235412,_0x16c962){return function(_0x27c782){if(_0x27c782){var _0x196ae9=typeof _0x16c962['offset']==='undefined'&&typeof _0x16c962[_0x9f2c('0x1e')]===_0x9f2c('0x1f');var _0xbf5fad=_0x27c782[_0x9f2c('0x20')];var _0x404817=_0x196ae9?0x0:_0x16c962[_0x9f2c('0x21')];var _0x574be6=_0x196ae9?_0x27c782[_0x9f2c('0x20')]:_0x16c962[_0x9f2c('0x21')]+_0x16c962[_0x9f2c('0x1e')];var _0xc45e6;if(_0x574be6>=_0xbf5fad){_0x574be6=_0xbf5fad;_0xc45e6=0xc8;}else{_0xc45e6=0xce;}_0x235412[_0x9f2c('0x1c')](_0xc45e6);return _0x235412[_0x9f2c('0x22')](_0x9f2c('0x23'),_0x404817+'-'+_0x574be6+'/'+_0xbf5fad)['json'](_0x27c782);}return null;};}function patchUpdates(_0x461898){return function(_0x5dcc7e){try{jsonpatch['apply'](_0x5dcc7e,_0x461898,!![]);}catch(_0x1c7132){return BPromise[_0x9f2c('0x24')](_0x1c7132);}return _0x5dcc7e[_0x9f2c('0x25')]();};}function saveUpdates(_0x3d07aa,_0x2bc352){return function(_0x1e9906){if(_0x1e9906){return _0x1e9906['update'](_0x3d07aa)[_0x9f2c('0x26')](function(_0x59f3e2){return _0x59f3e2;});}return null;};}function removeEntity(_0x43e82c,_0x31af91){return function(_0x1638f5){if(_0x1638f5){return _0x1638f5[_0x9f2c('0x27')]()['then'](function(){_0x43e82c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ee5fd,_0x1b0507){return function(_0x43f8f9){if(!_0x43f8f9){_0x3ee5fd['sendStatus'](0x194);}return _0x43f8f9;};}function handleError(_0x31e957,_0x35ac78){_0x35ac78=_0x35ac78||0x1f4;return function(_0x33d5de){logger[_0x9f2c('0x28')](_0x33d5de['stack']);if(_0x33d5de[_0x9f2c('0x29')]){delete _0x33d5de[_0x9f2c('0x29')];}_0x31e957[_0x9f2c('0x1c')](_0x35ac78)[_0x9f2c('0x2a')](_0x33d5de);};}exports[_0x9f2c('0x2b')]=function(_0x2571f9,_0x42e169){var _0x3d33db={},_0x8bb87e={},_0x3a072d={'count':0x0,'rows':[]};var _0x443f3a=_['map'](db[_0x9f2c('0x2c')][_0x9f2c('0x2d')],function(_0x1d0d17){return{'name':_0x1d0d17['fieldName'],'type':_0x1d0d17[_0x9f2c('0x2e')]['key']};});_0x8bb87e[_0x9f2c('0x2f')]=_[_0x9f2c('0x30')](_0x443f3a,'name');_0x8bb87e[_0x9f2c('0x31')]=_['keys'](_0x2571f9['query']);_0x8bb87e[_0x9f2c('0x32')]=_[_0x9f2c('0x33')](_0x8bb87e['model'],_0x8bb87e[_0x9f2c('0x31')]);_0x3d33db['attributes']=_['intersection'](_0x8bb87e[_0x9f2c('0x2f')],qs[_0x9f2c('0x34')](_0x2571f9[_0x9f2c('0x31')][_0x9f2c('0x34')]));_0x3d33db[_0x9f2c('0x35')]=_0x3d33db[_0x9f2c('0x35')]['length']?_0x3d33db[_0x9f2c('0x35')]:_0x8bb87e[_0x9f2c('0x2f')];if(!_0x2571f9[_0x9f2c('0x31')][_0x9f2c('0x36')]('nolimit')){_0x3d33db[_0x9f2c('0x1e')]=qs['limit'](_0x2571f9['query'][_0x9f2c('0x1e')]);_0x3d33db[_0x9f2c('0x21')]=qs[_0x9f2c('0x21')](_0x2571f9[_0x9f2c('0x31')][_0x9f2c('0x21')]);}_0x3d33db[_0x9f2c('0x37')]=qs[_0x9f2c('0x38')](_0x2571f9['query']['sort']);_0x3d33db[_0x9f2c('0x39')]=qs[_0x9f2c('0x32')](_['pick'](_0x2571f9[_0x9f2c('0x31')],_0x8bb87e['filters']),_0x443f3a);if(_0x2571f9['query']['filter']){_0x3d33db['where']=_[_0x9f2c('0x3a')](_0x3d33db[_0x9f2c('0x39')],{'$or':_[_0x9f2c('0x30')](_0x443f3a,function(_0x8f9a7){if(_0x8f9a7['type']!==_0x9f2c('0x3b')){var _0x1030d7={};_0x1030d7[_0x8f9a7[_0x9f2c('0x29')]]={'$like':'%'+_0x2571f9['query'][_0x9f2c('0x3c')]+'%'};return _0x1030d7;}})});}_0x3d33db=_[_0x9f2c('0x3a')]({},_0x3d33db,_0x2571f9[_0x9f2c('0x3d')]);var _0x44a92d={'where':_0x3d33db['where']};return db['VtigerConfiguration'][_0x9f2c('0x20')](_0x44a92d)[_0x9f2c('0x26')](function(_0x32dd41){_0x3a072d[_0x9f2c('0x20')]=_0x32dd41;if(_0x2571f9[_0x9f2c('0x31')]['includeAll']){_0x3d33db['include']=[{'all':!![]}];}return db[_0x9f2c('0x2c')][_0x9f2c('0x3e')](_0x3d33db);})[_0x9f2c('0x26')](function(_0x43de61){_0x3a072d[_0x9f2c('0x3f')]=_0x43de61;return _0x3a072d;})['then'](respondWithFilteredResult(_0x42e169,_0x3d33db))['catch'](handleError(_0x42e169,null));};exports['show']=function(_0x2c27cf,_0x3f7aef){var _0x1233ab={'raw':![],'where':{'id':_0x2c27cf[_0x9f2c('0x40')]['id']}},_0x321f2c={};_0x321f2c[_0x9f2c('0x2f')]=_[_0x9f2c('0x41')](db[_0x9f2c('0x2c')][_0x9f2c('0x2d')]);_0x321f2c[_0x9f2c('0x31')]=_['keys'](_0x2c27cf[_0x9f2c('0x31')]);_0x321f2c[_0x9f2c('0x32')]=_[_0x9f2c('0x33')](_0x321f2c[_0x9f2c('0x2f')],_0x321f2c[_0x9f2c('0x31')]);_0x1233ab[_0x9f2c('0x35')]=_[_0x9f2c('0x33')](_0x321f2c[_0x9f2c('0x2f')],qs['fields'](_0x2c27cf[_0x9f2c('0x31')]['fields']));_0x1233ab['attributes']=_0x1233ab[_0x9f2c('0x35')]['length']?_0x1233ab[_0x9f2c('0x35')]:_0x321f2c[_0x9f2c('0x2f')];if(_0x2c27cf[_0x9f2c('0x31')][_0x9f2c('0x42')]){_0x1233ab[_0x9f2c('0x43')]=[{'all':!![]}];}_0x1233ab=_[_0x9f2c('0x3a')]({},_0x1233ab,_0x2c27cf[_0x9f2c('0x3d')]);return db[_0x9f2c('0x2c')][_0x9f2c('0x44')](_0x1233ab)['then'](handleEntityNotFound(_0x3f7aef,null))[_0x9f2c('0x26')](respondWithResult(_0x3f7aef,null))[_0x9f2c('0x45')](handleError(_0x3f7aef,null));};exports['create']=function(_0x3c71d2,_0x35f839){return db[_0x9f2c('0x2c')][_0x9f2c('0x46')](_0x3c71d2[_0x9f2c('0x47')],{})[_0x9f2c('0x26')](respondWithResult(_0x35f839,0xc9))['catch'](handleError(_0x35f839,null));};exports[_0x9f2c('0x48')]=function(_0x15b3ef,_0x30dee3){if(_0x15b3ef[_0x9f2c('0x47')]['id']){delete _0x15b3ef[_0x9f2c('0x47')]['id'];}return db[_0x9f2c('0x2c')][_0x9f2c('0x44')]({'where':{'id':_0x15b3ef['params']['id']}})[_0x9f2c('0x26')](handleEntityNotFound(_0x30dee3,null))[_0x9f2c('0x26')](saveUpdates(_0x15b3ef['body'],null))[_0x9f2c('0x26')](respondWithResult(_0x30dee3,null))[_0x9f2c('0x45')](handleError(_0x30dee3,null));};exports['destroy']=function(_0x3b955a,_0x3a43f6){return db[_0x9f2c('0x2c')]['find']({'where':{'id':_0x3b955a[_0x9f2c('0x40')]['id']}})[_0x9f2c('0x26')](handleEntityNotFound(_0x3a43f6,null))[_0x9f2c('0x26')](removeEntity(_0x3a43f6,null))['catch'](handleError(_0x3a43f6,null));};exports[_0x9f2c('0x49')]=function(_0x3f4dcc,_0x50d080,_0x2b14a2){var _0x19b6cb={};var _0x2eaed8={};var _0x81ae51;var _0xa17668;return db['VtigerConfiguration'][_0x9f2c('0x4a')]({'where':{'id':_0x3f4dcc[_0x9f2c('0x40')]['id']}})[_0x9f2c('0x26')](handleEntityNotFound(_0x50d080,null))['then'](function(_0x2d44c0){if(_0x2d44c0){_0x81ae51=_0x2d44c0;_0x2eaed8[_0x9f2c('0x2f')]=_[_0x9f2c('0x41')](db[_0x9f2c('0x4b')][_0x9f2c('0x2d')]);_0x2eaed8[_0x9f2c('0x31')]=_[_0x9f2c('0x41')](_0x3f4dcc[_0x9f2c('0x31')]);_0x2eaed8[_0x9f2c('0x32')]=_[_0x9f2c('0x33')](_0x2eaed8[_0x9f2c('0x2f')],_0x2eaed8[_0x9f2c('0x31')]);_0x19b6cb[_0x9f2c('0x35')]=_[_0x9f2c('0x33')](_0x2eaed8[_0x9f2c('0x2f')],qs[_0x9f2c('0x34')](_0x3f4dcc['query'][_0x9f2c('0x34')]));_0x19b6cb[_0x9f2c('0x35')]=_0x19b6cb[_0x9f2c('0x35')][_0x9f2c('0x4c')]?_0x19b6cb['attributes']:_0x2eaed8[_0x9f2c('0x2f')];_0x19b6cb[_0x9f2c('0x37')]=qs[_0x9f2c('0x38')](_0x3f4dcc['query'][_0x9f2c('0x38')]);_0x19b6cb[_0x9f2c('0x39')]=qs['filters'](_[_0x9f2c('0x4d')](_0x3f4dcc[_0x9f2c('0x31')],_0x2eaed8[_0x9f2c('0x32')]));if(_0x3f4dcc[_0x9f2c('0x31')][_0x9f2c('0x3c')]){_0x19b6cb[_0x9f2c('0x39')]=_[_0x9f2c('0x3a')](_0x19b6cb[_0x9f2c('0x39')],{'$or':_[_0x9f2c('0x30')](_0x19b6cb[_0x9f2c('0x35')],function(_0x592ede){var _0x55bd4d={};_0x55bd4d[_0x592ede]={'$like':'%'+_0x3f4dcc[_0x9f2c('0x31')]['filter']+'%'};return _0x55bd4d;})});}_0x19b6cb=_['merge']({},_0x19b6cb,_0x3f4dcc[_0x9f2c('0x3d')]);return _0x81ae51[_0x9f2c('0x49')](_0x19b6cb);}})[_0x9f2c('0x26')](function(_0x3fed54){if(_0x3fed54){_0xa17668=_0x3fed54['length'];if(!_0x3f4dcc['query'][_0x9f2c('0x36')](_0x9f2c('0x4e'))){_0x19b6cb[_0x9f2c('0x1e')]=qs[_0x9f2c('0x1e')](_0x3f4dcc['query']['limit']);_0x19b6cb[_0x9f2c('0x21')]=qs[_0x9f2c('0x21')](_0x3f4dcc[_0x9f2c('0x31')][_0x9f2c('0x21')]);}return _0x81ae51[_0x9f2c('0x49')](_0x19b6cb);}})[_0x9f2c('0x26')](function(_0xe6e1fd){if(_0xe6e1fd){return _0xe6e1fd?{'count':_0xa17668,'rows':_0xe6e1fd}:null;}})['then'](respondWithResult(_0x50d080,null))[_0x9f2c('0x45')](handleError(_0x50d080,null));};exports[_0x9f2c('0x4f')]=function(_0x321e28,_0x2217ca,_0x17024b){var _0x379a0d={};var _0x5c267a={};var _0x504401;var _0x49d3b9;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x321e28[_0x9f2c('0x40')]['id']}})[_0x9f2c('0x26')](handleEntityNotFound(_0x2217ca,null))[_0x9f2c('0x26')](function(_0x280f17){if(_0x280f17){_0x504401=_0x280f17;_0x5c267a[_0x9f2c('0x2f')]=_[_0x9f2c('0x41')](db[_0x9f2c('0x4b')][_0x9f2c('0x2d')]);_0x5c267a['query']=_[_0x9f2c('0x41')](_0x321e28[_0x9f2c('0x31')]);_0x5c267a[_0x9f2c('0x32')]=_[_0x9f2c('0x33')](_0x5c267a['model'],_0x5c267a[_0x9f2c('0x31')]);_0x379a0d[_0x9f2c('0x35')]=_[_0x9f2c('0x33')](_0x5c267a[_0x9f2c('0x2f')],qs['fields'](_0x321e28[_0x9f2c('0x31')][_0x9f2c('0x34')]));_0x379a0d[_0x9f2c('0x35')]=_0x379a0d['attributes'][_0x9f2c('0x4c')]?_0x379a0d['attributes']:_0x5c267a[_0x9f2c('0x2f')];_0x379a0d[_0x9f2c('0x37')]=qs[_0x9f2c('0x38')](_0x321e28[_0x9f2c('0x31')][_0x9f2c('0x38')]);_0x379a0d[_0x9f2c('0x39')]=qs[_0x9f2c('0x32')](_[_0x9f2c('0x4d')](_0x321e28[_0x9f2c('0x31')],_0x5c267a['filters']));if(_0x321e28[_0x9f2c('0x31')][_0x9f2c('0x3c')]){_0x379a0d[_0x9f2c('0x39')]=_[_0x9f2c('0x3a')](_0x379a0d[_0x9f2c('0x39')],{'$or':_[_0x9f2c('0x30')](_0x379a0d['attributes'],function(_0x1c0c58){var _0x3ae67a={};_0x3ae67a[_0x1c0c58]={'$like':'%'+_0x321e28['query'][_0x9f2c('0x3c')]+'%'};return _0x3ae67a;})});}_0x379a0d=_[_0x9f2c('0x3a')]({},_0x379a0d,_0x321e28[_0x9f2c('0x3d')]);return _0x504401[_0x9f2c('0x4f')](_0x379a0d);}})[_0x9f2c('0x26')](function(_0x38b4d0){if(_0x38b4d0){_0x49d3b9=_0x38b4d0[_0x9f2c('0x4c')];if(!_0x321e28[_0x9f2c('0x31')][_0x9f2c('0x36')](_0x9f2c('0x4e'))){_0x379a0d[_0x9f2c('0x1e')]=qs[_0x9f2c('0x1e')](_0x321e28['query'][_0x9f2c('0x1e')]);_0x379a0d[_0x9f2c('0x21')]=qs[_0x9f2c('0x21')](_0x321e28['query']['offset']);}return _0x504401[_0x9f2c('0x4f')](_0x379a0d);}})['then'](function(_0x389462){if(_0x389462){return _0x389462?{'count':_0x49d3b9,'rows':_0x389462}:null;}})[_0x9f2c('0x26')](respondWithResult(_0x2217ca,null))[_0x9f2c('0x45')](handleError(_0x2217ca,null));};exports[_0x9f2c('0x50')]=function(_0x151643,_0x409fbf,_0x1610b8){var _0x3c38b7={};var _0x140b9d={};var _0xecb2e3;var _0x562db6;return db[_0x9f2c('0x2c')][_0x9f2c('0x4a')]({'where':{'id':_0x151643[_0x9f2c('0x40')]['id']}})[_0x9f2c('0x26')](handleEntityNotFound(_0x409fbf,null))[_0x9f2c('0x26')](function(_0x48ae2b){if(_0x48ae2b){_0xecb2e3=_0x48ae2b;_0x140b9d[_0x9f2c('0x2f')]=_['keys'](db[_0x9f2c('0x4b')][_0x9f2c('0x2d')]);_0x140b9d[_0x9f2c('0x31')]=_[_0x9f2c('0x41')](_0x151643[_0x9f2c('0x31')]);_0x140b9d[_0x9f2c('0x32')]=_[_0x9f2c('0x33')](_0x140b9d[_0x9f2c('0x2f')],_0x140b9d['query']);_0x3c38b7['attributes']=_[_0x9f2c('0x33')](_0x140b9d[_0x9f2c('0x2f')],qs[_0x9f2c('0x34')](_0x151643['query'][_0x9f2c('0x34')]));_0x3c38b7['attributes']=_0x3c38b7[_0x9f2c('0x35')][_0x9f2c('0x4c')]?_0x3c38b7['attributes']:_0x140b9d[_0x9f2c('0x2f')];_0x3c38b7[_0x9f2c('0x37')]=qs[_0x9f2c('0x38')](_0x151643[_0x9f2c('0x31')][_0x9f2c('0x38')]);_0x3c38b7['where']=qs['filters'](_['pick'](_0x151643[_0x9f2c('0x31')],_0x140b9d[_0x9f2c('0x32')]));if(_0x151643[_0x9f2c('0x31')]['filter']){_0x3c38b7[_0x9f2c('0x39')]=_[_0x9f2c('0x3a')](_0x3c38b7['where'],{'$or':_[_0x9f2c('0x30')](_0x3c38b7['attributes'],function(_0x562ae0){var _0x96999d={};_0x96999d[_0x562ae0]={'$like':'%'+_0x151643['query']['filter']+'%'};return _0x96999d;})});}_0x3c38b7=_[_0x9f2c('0x3a')]({},_0x3c38b7,_0x151643[_0x9f2c('0x3d')]);return _0xecb2e3[_0x9f2c('0x50')](_0x3c38b7);}})['then'](function(_0x1f8b8c){if(_0x1f8b8c){_0x562db6=_0x1f8b8c['length'];if(!_0x151643[_0x9f2c('0x31')][_0x9f2c('0x36')](_0x9f2c('0x4e'))){_0x3c38b7[_0x9f2c('0x1e')]=qs[_0x9f2c('0x1e')](_0x151643[_0x9f2c('0x31')][_0x9f2c('0x1e')]);_0x3c38b7[_0x9f2c('0x21')]=qs[_0x9f2c('0x21')](_0x151643[_0x9f2c('0x31')][_0x9f2c('0x21')]);}return _0xecb2e3[_0x9f2c('0x50')](_0x3c38b7);}})[_0x9f2c('0x26')](function(_0x4171a7){if(_0x4171a7){return _0x4171a7?{'count':_0x562db6,'rows':_0x4171a7}:null;}})['then'](respondWithResult(_0x409fbf,null))[_0x9f2c('0x45')](handleError(_0x409fbf,null));}; \ No newline at end of file +var _0x9bea=['params','include','find','create','body','findOne','VtigerField','order','hasOwnProperty','getFields','getSubjects','rawAttributes','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','sendStatus','error','stack','name','send','index','map','VtigerConfiguration','fieldName','type','key','query','keys','model','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9bea,0x1f3));var _0xa9be=function(_0xe0c1d2,_0x13dd37){_0xe0c1d2=_0xe0c1d2-0x0;var _0x51d6ef=_0x9bea[_0xe0c1d2];return _0x51d6ef;};'use strict';var emlformat=require(_0xa9be('0x0'));var rimraf=require(_0xa9be('0x1'));var zipdir=require(_0xa9be('0x2'));var jsonpatch=require(_0xa9be('0x3'));var rp=require(_0xa9be('0x4'));var moment=require(_0xa9be('0x5'));var BPromise=require(_0xa9be('0x6'));var Mustache=require('mustache');var util=require(_0xa9be('0x7'));var path=require(_0xa9be('0x8'));var sox=require(_0xa9be('0x9'));var csv=require(_0xa9be('0xa'));var ejs=require(_0xa9be('0xb'));var fs=require('fs');var fs_extra=require(_0xa9be('0xc'));var _=require(_0xa9be('0xd'));var squel=require(_0xa9be('0xe'));var crypto=require('crypto');var jsforce=require(_0xa9be('0xf'));var deskjs=require(_0xa9be('0x10'));var toCsv=require(_0xa9be('0xa'));var querystring=require('querystring');var Papa=require(_0xa9be('0x11'));var Redis=require(_0xa9be('0x12'));var authService=require(_0xa9be('0x13'));var qs=require(_0xa9be('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa9be('0x15'));var utils=require(_0xa9be('0x16'));var config=require(_0xa9be('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa9be('0x18'))['db'];function respondWithStatusCode(_0x4c3ae2,_0x38a4fe){_0x38a4fe=_0x38a4fe||0xcc;return function(_0x3b7344){if(_0x3b7344){return _0x4c3ae2['sendStatus'](_0x38a4fe);}return _0x4c3ae2[_0xa9be('0x19')](_0x38a4fe)[_0xa9be('0x1a')]();};}function respondWithResult(_0x41dbca,_0x1f6f82){_0x1f6f82=_0x1f6f82||0xc8;return function(_0x25b5bc){if(_0x25b5bc){return _0x41dbca['status'](_0x1f6f82)[_0xa9be('0x1b')](_0x25b5bc);}};}function respondWithFilteredResult(_0x1bad16,_0x303999){return function(_0x5c6d08){if(_0x5c6d08){var _0x1b5bb2=typeof _0x303999[_0xa9be('0x1c')]===_0xa9be('0x1d')&&typeof _0x303999[_0xa9be('0x1e')]===_0xa9be('0x1d');var _0x1bfce5=_0x5c6d08[_0xa9be('0x1f')];var _0x40a044=_0x1b5bb2?0x0:_0x303999[_0xa9be('0x1c')];var _0x47e421=_0x1b5bb2?_0x5c6d08['count']:_0x303999['offset']+_0x303999[_0xa9be('0x1e')];var _0x2ee535;if(_0x47e421>=_0x1bfce5){_0x47e421=_0x1bfce5;_0x2ee535=0xc8;}else{_0x2ee535=0xce;}_0x1bad16['status'](_0x2ee535);return _0x1bad16['set'](_0xa9be('0x20'),_0x40a044+'-'+_0x47e421+'/'+_0x1bfce5)[_0xa9be('0x1b')](_0x5c6d08);}return null;};}function patchUpdates(_0x490d06){return function(_0x56fe16){try{jsonpatch['apply'](_0x56fe16,_0x490d06,!![]);}catch(_0xb182f1){return BPromise[_0xa9be('0x21')](_0xb182f1);}return _0x56fe16['save']();};}function saveUpdates(_0x2adeb1,_0x2d02f7){return function(_0x7566c8){if(_0x7566c8){return _0x7566c8[_0xa9be('0x22')](_0x2adeb1)[_0xa9be('0x23')](function(_0x57fcac){return _0x57fcac;});}return null;};}function removeEntity(_0x24bed9,_0x246c1f){return function(_0x422f72){if(_0x422f72){return _0x422f72['destroy']()[_0xa9be('0x23')](function(){_0x24bed9['status'](0xcc)[_0xa9be('0x1a')]();});}};}function handleEntityNotFound(_0xc84101,_0x48156a){return function(_0x40641b){if(!_0x40641b){_0xc84101[_0xa9be('0x24')](0x194);}return _0x40641b;};}function handleError(_0x64ccfb,_0x2a8668){_0x2a8668=_0x2a8668||0x1f4;return function(_0x2b94a6){logger[_0xa9be('0x25')](_0x2b94a6[_0xa9be('0x26')]);if(_0x2b94a6[_0xa9be('0x27')]){delete _0x2b94a6[_0xa9be('0x27')];}_0x64ccfb[_0xa9be('0x19')](_0x2a8668)[_0xa9be('0x28')](_0x2b94a6);};}exports[_0xa9be('0x29')]=function(_0x410486,_0x4a31d2){var _0x51c742={},_0xf25d11={},_0x9c8dd8={'count':0x0,'rows':[]};var _0xd3aba9=_[_0xa9be('0x2a')](db[_0xa9be('0x2b')]['rawAttributes'],function(_0x5e8f78){return{'name':_0x5e8f78[_0xa9be('0x2c')],'type':_0x5e8f78[_0xa9be('0x2d')][_0xa9be('0x2e')]};});_0xf25d11['model']=_[_0xa9be('0x2a')](_0xd3aba9,'name');_0xf25d11[_0xa9be('0x2f')]=_[_0xa9be('0x30')](_0x410486['query']);_0xf25d11['filters']=_['intersection'](_0xf25d11[_0xa9be('0x31')],_0xf25d11[_0xa9be('0x2f')]);_0x51c742['attributes']=_[_0xa9be('0x32')](_0xf25d11[_0xa9be('0x31')],qs[_0xa9be('0x33')](_0x410486[_0xa9be('0x2f')][_0xa9be('0x33')]));_0x51c742[_0xa9be('0x34')]=_0x51c742[_0xa9be('0x34')][_0xa9be('0x35')]?_0x51c742[_0xa9be('0x34')]:_0xf25d11['model'];if(!_0x410486[_0xa9be('0x2f')]['hasOwnProperty'](_0xa9be('0x36'))){_0x51c742[_0xa9be('0x1e')]=qs['limit'](_0x410486[_0xa9be('0x2f')][_0xa9be('0x1e')]);_0x51c742[_0xa9be('0x1c')]=qs['offset'](_0x410486['query']['offset']);}_0x51c742['order']=qs[_0xa9be('0x37')](_0x410486[_0xa9be('0x2f')][_0xa9be('0x37')]);_0x51c742[_0xa9be('0x38')]=qs[_0xa9be('0x39')](_[_0xa9be('0x3a')](_0x410486[_0xa9be('0x2f')],_0xf25d11['filters']),_0xd3aba9);if(_0x410486[_0xa9be('0x2f')][_0xa9be('0x3b')]){_0x51c742['where']=_[_0xa9be('0x3c')](_0x51c742[_0xa9be('0x38')],{'$or':_[_0xa9be('0x2a')](_0xd3aba9,function(_0x327534){if(_0x327534[_0xa9be('0x2d')]!==_0xa9be('0x3d')){var _0x427497={};_0x427497[_0x327534['name']]={'$like':'%'+_0x410486[_0xa9be('0x2f')][_0xa9be('0x3b')]+'%'};return _0x427497;}})});}_0x51c742=_[_0xa9be('0x3c')]({},_0x51c742,_0x410486[_0xa9be('0x3e')]);var _0x416cbf={'where':_0x51c742[_0xa9be('0x38')]};return db['VtigerConfiguration']['count'](_0x416cbf)[_0xa9be('0x23')](function(_0x2a59ee){_0x9c8dd8[_0xa9be('0x1f')]=_0x2a59ee;if(_0x410486[_0xa9be('0x2f')][_0xa9be('0x3f')]){_0x51c742['include']=[{'all':!![]}];}return db['VtigerConfiguration'][_0xa9be('0x40')](_0x51c742);})[_0xa9be('0x23')](function(_0x2cbb01){_0x9c8dd8[_0xa9be('0x41')]=_0x2cbb01;return _0x9c8dd8;})['then'](respondWithFilteredResult(_0x4a31d2,_0x51c742))[_0xa9be('0x42')](handleError(_0x4a31d2,null));};exports[_0xa9be('0x43')]=function(_0xb821de,_0x5a243e){var _0x2aa336={'raw':![],'where':{'id':_0xb821de[_0xa9be('0x44')]['id']}},_0x24499d={};_0x24499d['model']=_[_0xa9be('0x30')](db[_0xa9be('0x2b')]['rawAttributes']);_0x24499d[_0xa9be('0x2f')]=_[_0xa9be('0x30')](_0xb821de['query']);_0x24499d[_0xa9be('0x39')]=_[_0xa9be('0x32')](_0x24499d['model'],_0x24499d[_0xa9be('0x2f')]);_0x2aa336[_0xa9be('0x34')]=_[_0xa9be('0x32')](_0x24499d[_0xa9be('0x31')],qs['fields'](_0xb821de[_0xa9be('0x2f')]['fields']));_0x2aa336[_0xa9be('0x34')]=_0x2aa336['attributes'][_0xa9be('0x35')]?_0x2aa336[_0xa9be('0x34')]:_0x24499d[_0xa9be('0x31')];if(_0xb821de['query'][_0xa9be('0x3f')]){_0x2aa336[_0xa9be('0x45')]=[{'all':!![]}];}_0x2aa336=_[_0xa9be('0x3c')]({},_0x2aa336,_0xb821de[_0xa9be('0x3e')]);return db['VtigerConfiguration'][_0xa9be('0x46')](_0x2aa336)[_0xa9be('0x23')](handleEntityNotFound(_0x5a243e,null))[_0xa9be('0x23')](respondWithResult(_0x5a243e,null))[_0xa9be('0x42')](handleError(_0x5a243e,null));};exports[_0xa9be('0x47')]=function(_0x2008a6,_0x12b18a){return db[_0xa9be('0x2b')][_0xa9be('0x47')](_0x2008a6[_0xa9be('0x48')],{})[_0xa9be('0x23')](respondWithResult(_0x12b18a,0xc9))[_0xa9be('0x42')](handleError(_0x12b18a,null));};exports['update']=function(_0x2259c7,_0x3b81f3){if(_0x2259c7[_0xa9be('0x48')]['id']){delete _0x2259c7[_0xa9be('0x48')]['id'];}return db[_0xa9be('0x2b')]['find']({'where':{'id':_0x2259c7[_0xa9be('0x44')]['id']}})[_0xa9be('0x23')](handleEntityNotFound(_0x3b81f3,null))['then'](saveUpdates(_0x2259c7[_0xa9be('0x48')],null))[_0xa9be('0x23')](respondWithResult(_0x3b81f3,null))[_0xa9be('0x42')](handleError(_0x3b81f3,null));};exports['destroy']=function(_0x2b7120,_0x53ad27){return db['VtigerConfiguration'][_0xa9be('0x46')]({'where':{'id':_0x2b7120[_0xa9be('0x44')]['id']}})[_0xa9be('0x23')](handleEntityNotFound(_0x53ad27,null))[_0xa9be('0x23')](removeEntity(_0x53ad27,null))[_0xa9be('0x42')](handleError(_0x53ad27,null));};exports['getFields']=function(_0x321b8c,_0x10d12a,_0x21f12f){var _0x34a479={};var _0x14bb22={};var _0x4017aa;var _0x4f20cf;return db[_0xa9be('0x2b')][_0xa9be('0x49')]({'where':{'id':_0x321b8c['params']['id']}})[_0xa9be('0x23')](handleEntityNotFound(_0x10d12a,null))['then'](function(_0x45296e){if(_0x45296e){_0x4017aa=_0x45296e;_0x14bb22[_0xa9be('0x31')]=_[_0xa9be('0x30')](db[_0xa9be('0x4a')]['rawAttributes']);_0x14bb22['query']=_[_0xa9be('0x30')](_0x321b8c[_0xa9be('0x2f')]);_0x14bb22['filters']=_[_0xa9be('0x32')](_0x14bb22[_0xa9be('0x31')],_0x14bb22['query']);_0x34a479[_0xa9be('0x34')]=_[_0xa9be('0x32')](_0x14bb22[_0xa9be('0x31')],qs[_0xa9be('0x33')](_0x321b8c['query'][_0xa9be('0x33')]));_0x34a479['attributes']=_0x34a479[_0xa9be('0x34')][_0xa9be('0x35')]?_0x34a479[_0xa9be('0x34')]:_0x14bb22[_0xa9be('0x31')];_0x34a479[_0xa9be('0x4b')]=qs[_0xa9be('0x37')](_0x321b8c[_0xa9be('0x2f')][_0xa9be('0x37')]);_0x34a479[_0xa9be('0x38')]=qs[_0xa9be('0x39')](_[_0xa9be('0x3a')](_0x321b8c['query'],_0x14bb22[_0xa9be('0x39')]));if(_0x321b8c['query'][_0xa9be('0x3b')]){_0x34a479['where']=_['merge'](_0x34a479[_0xa9be('0x38')],{'$or':_[_0xa9be('0x2a')](_0x34a479['attributes'],function(_0x5befcd){var _0x8bfaaf={};_0x8bfaaf[_0x5befcd]={'$like':'%'+_0x321b8c['query'][_0xa9be('0x3b')]+'%'};return _0x8bfaaf;})});}_0x34a479=_[_0xa9be('0x3c')]({},_0x34a479,_0x321b8c['options']);return _0x4017aa['getFields'](_0x34a479);}})[_0xa9be('0x23')](function(_0x4e895e){if(_0x4e895e){_0x4f20cf=_0x4e895e[_0xa9be('0x35')];if(!_0x321b8c[_0xa9be('0x2f')][_0xa9be('0x4c')](_0xa9be('0x36'))){_0x34a479[_0xa9be('0x1e')]=qs[_0xa9be('0x1e')](_0x321b8c[_0xa9be('0x2f')]['limit']);_0x34a479['offset']=qs[_0xa9be('0x1c')](_0x321b8c[_0xa9be('0x2f')][_0xa9be('0x1c')]);}return _0x4017aa[_0xa9be('0x4d')](_0x34a479);}})[_0xa9be('0x23')](function(_0x539329){if(_0x539329){return _0x539329?{'count':_0x4f20cf,'rows':_0x539329}:null;}})[_0xa9be('0x23')](respondWithResult(_0x10d12a,null))[_0xa9be('0x42')](handleError(_0x10d12a,null));};exports[_0xa9be('0x4e')]=function(_0x3eb07b,_0x535257,_0x337b36){var _0x131fed={};var _0xf41489={};var _0x2e1979;var _0x3fd24e;return db[_0xa9be('0x2b')][_0xa9be('0x49')]({'where':{'id':_0x3eb07b[_0xa9be('0x44')]['id']}})[_0xa9be('0x23')](handleEntityNotFound(_0x535257,null))[_0xa9be('0x23')](function(_0x43ae65){if(_0x43ae65){_0x2e1979=_0x43ae65;_0xf41489[_0xa9be('0x31')]=_['keys'](db[_0xa9be('0x4a')]['rawAttributes']);_0xf41489[_0xa9be('0x2f')]=_[_0xa9be('0x30')](_0x3eb07b[_0xa9be('0x2f')]);_0xf41489['filters']=_[_0xa9be('0x32')](_0xf41489[_0xa9be('0x31')],_0xf41489[_0xa9be('0x2f')]);_0x131fed[_0xa9be('0x34')]=_[_0xa9be('0x32')](_0xf41489['model'],qs[_0xa9be('0x33')](_0x3eb07b['query'][_0xa9be('0x33')]));_0x131fed[_0xa9be('0x34')]=_0x131fed[_0xa9be('0x34')]['length']?_0x131fed[_0xa9be('0x34')]:_0xf41489['model'];_0x131fed[_0xa9be('0x4b')]=qs[_0xa9be('0x37')](_0x3eb07b['query'][_0xa9be('0x37')]);_0x131fed['where']=qs[_0xa9be('0x39')](_['pick'](_0x3eb07b[_0xa9be('0x2f')],_0xf41489[_0xa9be('0x39')]));if(_0x3eb07b[_0xa9be('0x2f')]['filter']){_0x131fed[_0xa9be('0x38')]=_[_0xa9be('0x3c')](_0x131fed[_0xa9be('0x38')],{'$or':_[_0xa9be('0x2a')](_0x131fed[_0xa9be('0x34')],function(_0x1a8214){var _0x5bf9a8={};_0x5bf9a8[_0x1a8214]={'$like':'%'+_0x3eb07b[_0xa9be('0x2f')]['filter']+'%'};return _0x5bf9a8;})});}_0x131fed=_[_0xa9be('0x3c')]({},_0x131fed,_0x3eb07b['options']);return _0x2e1979[_0xa9be('0x4e')](_0x131fed);}})['then'](function(_0x157094){if(_0x157094){_0x3fd24e=_0x157094[_0xa9be('0x35')];if(!_0x3eb07b[_0xa9be('0x2f')]['hasOwnProperty'](_0xa9be('0x36'))){_0x131fed['limit']=qs[_0xa9be('0x1e')](_0x3eb07b[_0xa9be('0x2f')]['limit']);_0x131fed['offset']=qs[_0xa9be('0x1c')](_0x3eb07b[_0xa9be('0x2f')][_0xa9be('0x1c')]);}return _0x2e1979[_0xa9be('0x4e')](_0x131fed);}})[_0xa9be('0x23')](function(_0x43af67){if(_0x43af67){return _0x43af67?{'count':_0x3fd24e,'rows':_0x43af67}:null;}})['then'](respondWithResult(_0x535257,null))[_0xa9be('0x42')](handleError(_0x535257,null));};exports['getDescriptions']=function(_0x14dcd0,_0x1a8834,_0x2390f6){var _0x293723={};var _0x21aec5={};var _0x5a8d85;var _0x426a63;return db[_0xa9be('0x2b')][_0xa9be('0x49')]({'where':{'id':_0x14dcd0[_0xa9be('0x44')]['id']}})[_0xa9be('0x23')](handleEntityNotFound(_0x1a8834,null))[_0xa9be('0x23')](function(_0x511b6e){if(_0x511b6e){_0x5a8d85=_0x511b6e;_0x21aec5[_0xa9be('0x31')]=_['keys'](db[_0xa9be('0x4a')][_0xa9be('0x4f')]);_0x21aec5[_0xa9be('0x2f')]=_['keys'](_0x14dcd0[_0xa9be('0x2f')]);_0x21aec5[_0xa9be('0x39')]=_[_0xa9be('0x32')](_0x21aec5[_0xa9be('0x31')],_0x21aec5[_0xa9be('0x2f')]);_0x293723[_0xa9be('0x34')]=_['intersection'](_0x21aec5['model'],qs[_0xa9be('0x33')](_0x14dcd0['query'][_0xa9be('0x33')]));_0x293723[_0xa9be('0x34')]=_0x293723[_0xa9be('0x34')]['length']?_0x293723[_0xa9be('0x34')]:_0x21aec5[_0xa9be('0x31')];_0x293723[_0xa9be('0x4b')]=qs[_0xa9be('0x37')](_0x14dcd0[_0xa9be('0x2f')][_0xa9be('0x37')]);_0x293723[_0xa9be('0x38')]=qs['filters'](_[_0xa9be('0x3a')](_0x14dcd0['query'],_0x21aec5['filters']));if(_0x14dcd0['query'][_0xa9be('0x3b')]){_0x293723[_0xa9be('0x38')]=_[_0xa9be('0x3c')](_0x293723[_0xa9be('0x38')],{'$or':_[_0xa9be('0x2a')](_0x293723[_0xa9be('0x34')],function(_0x536cd9){var _0x2e23ff={};_0x2e23ff[_0x536cd9]={'$like':'%'+_0x14dcd0[_0xa9be('0x2f')][_0xa9be('0x3b')]+'%'};return _0x2e23ff;})});}_0x293723=_['merge']({},_0x293723,_0x14dcd0[_0xa9be('0x3e')]);return _0x5a8d85[_0xa9be('0x50')](_0x293723);}})[_0xa9be('0x23')](function(_0x4390a2){if(_0x4390a2){_0x426a63=_0x4390a2[_0xa9be('0x35')];if(!_0x14dcd0[_0xa9be('0x2f')][_0xa9be('0x4c')](_0xa9be('0x36'))){_0x293723[_0xa9be('0x1e')]=qs['limit'](_0x14dcd0[_0xa9be('0x2f')][_0xa9be('0x1e')]);_0x293723[_0xa9be('0x1c')]=qs[_0xa9be('0x1c')](_0x14dcd0[_0xa9be('0x2f')][_0xa9be('0x1c')]);}return _0x5a8d85['getDescriptions'](_0x293723);}})[_0xa9be('0x23')](function(_0x1b1117){if(_0x1b1117){return _0x1b1117?{'count':_0x426a63,'rows':_0x1b1117}:null;}})[_0xa9be('0x23')](respondWithResult(_0x1a8834,null))['catch'](handleError(_0x1a8834,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index c9ddaed..125732e 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 _0x84f2=['moment','bluebird','request-promise','path','define','lodash','../../config/logger','api'];(function(_0x72a932,_0x2a9072){var _0xed4a1c=function(_0x3097e1){while(--_0x3097e1){_0x72a932['push'](_0x72a932['shift']());}};_0xed4a1c(++_0x2a9072);}(_0x84f2,0xad));var _0x284f=function(_0x1d046a,_0x30db41){_0x1d046a=_0x1d046a-0x0;var _0x2c0b0c=_0x84f2[_0x1d046a];return _0x2c0b0c;};'use strict';var _=require(_0x284f('0x0'));var util=require('util');var logger=require(_0x284f('0x1'))(_0x284f('0x2'));var moment=require(_0x284f('0x3'));var BPromise=require(_0x284f('0x4'));var rp=require(_0x284f('0x5'));var fs=require('fs');var path=require(_0x284f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x55abfd,_0xaf3b4){return _0x55abfd[_0x284f('0x7')]('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37c2=['exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x2d2ae2,_0x4024f3){var _0x145d00=function(_0x2b263d){while(--_0x2b263d){_0x2d2ae2['push'](_0x2d2ae2['shift']());}};_0x145d00(++_0x4024f3);}(_0x37c2,0x9e));var _0x237c=function(_0x29c070,_0x547cee){_0x29c070=_0x29c070-0x0;var _0xbb6586=_0x37c2[_0x29c070];return _0xbb6586;};'use strict';var _=require(_0x237c('0x0'));var util=require(_0x237c('0x1'));var logger=require(_0x237c('0x2'))(_0x237c('0x3'));var moment=require(_0x237c('0x4'));var BPromise=require(_0x237c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x237c('0x6'));var rimraf=require(_0x237c('0x7'));var config=require(_0x237c('0x8'));var attributes=require(_0x237c('0x9'));module[_0x237c('0xa')]=function(_0x156240,_0x30c5b0){return _0x156240[_0x237c('0xb')](_0x237c('0xc'),attributes,{'tableName':_0x237c('0xd'),'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 9758eb4..953e16d 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 _0x22d9=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x22d9,0xbc));var _0x922d=function(_0x3309f6,_0xfda848){_0x3309f6=_0x3309f6-0x0;var _0x22cc52=_0x22d9[_0x3309f6];return _0x22cc52;};'use strict';var _=require('lodash');var util=require(_0x922d('0x0'));var moment=require(_0x922d('0x1'));var BPromise=require(_0x922d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x922d('0x3'));var db=require(_0x922d('0x4'))['db'];var utils=require(_0x922d('0x5'));var logger=require('../../config/logger')(_0x922d('0x6'));var config=require(_0x922d('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x388e00,_0x79a265,_0x32b199){return new BPromise(function(_0x142eaf,_0x20d1b1){return client['request'](_0x388e00,_0x32b199)[_0x922d('0x8')](function(_0x4a163d){logger[_0x922d('0x9')](_0x922d('0xa'),_0x79a265,_0x922d('0xb'));logger[_0x922d('0xc')](_0x922d('0xd'),_0x79a265,'request\x20sent',JSON['stringify'](_0x4a163d));if(_0x4a163d['error']){if(_0x4a163d[_0x922d('0xe')][_0x922d('0xf')]===0x1f4){logger[_0x922d('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x79a265,_0x4a163d[_0x922d('0xe')][_0x922d('0x10')]);return _0x20d1b1(_0x4a163d[_0x922d('0xe')][_0x922d('0x10')]);}logger[_0x922d('0xe')](_0x922d('0xa'),_0x79a265,_0x4a163d[_0x922d('0xe')][_0x922d('0x10')]);return _0x142eaf(_0x4a163d['error'][_0x922d('0x10')]);}else{logger[_0x922d('0x9')]('VtigerConfiguration,\x20%s,\x20%s',_0x79a265,_0x922d('0xb'));_0x142eaf(_0x4a163d[_0x922d('0x11')][_0x922d('0x10')]);}})[_0x922d('0x12')](function(_0x5d2e46){logger[_0x922d('0xe')](_0x922d('0xa'),_0x79a265,_0x5d2e46);_0x20d1b1(_0x5d2e46);});});} \ No newline at end of file +var _0x1a41=['code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0x1a41,0x1e8));var _0x11a4=function(_0x49f1ee,_0xb7693f){_0x49f1ee=_0x49f1ee-0x0;var _0x4070a4=_0x1a41[_0x49f1ee];return _0x4070a4;};'use strict';var _=require(_0x11a4('0x0'));var util=require(_0x11a4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x11a4('0x2'));var fs=require('fs');var Redis=require(_0x11a4('0x3'));var db=require(_0x11a4('0x4'))['db'];var utils=require(_0x11a4('0x5'));var logger=require(_0x11a4('0x6'))(_0x11a4('0x7'));var config=require(_0x11a4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x11a4('0x9')][_0x11a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fd3ef,_0x2e79de,_0x364f36){return new BPromise(function(_0x529ed4,_0x171bba){return client['request'](_0x2fd3ef,_0x364f36)[_0x11a4('0xb')](function(_0x4be104){logger[_0x11a4('0xc')](_0x11a4('0xd'),_0x2e79de,_0x11a4('0xe'));logger[_0x11a4('0xf')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x2e79de,_0x11a4('0xe'),JSON[_0x11a4('0x10')](_0x4be104));if(_0x4be104[_0x11a4('0x11')]){if(_0x4be104['error'][_0x11a4('0x12')]===0x1f4){logger[_0x11a4('0x11')](_0x11a4('0xd'),_0x2e79de,_0x4be104[_0x11a4('0x11')]['message']);return _0x171bba(_0x4be104[_0x11a4('0x11')]['message']);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x2e79de,_0x4be104[_0x11a4('0x11')][_0x11a4('0x13')]);return _0x529ed4(_0x4be104[_0x11a4('0x11')][_0x11a4('0x13')]);}else{logger['info'](_0x11a4('0xd'),_0x2e79de,_0x11a4('0xe'));_0x529ed4(_0x4be104[_0x11a4('0x14')]['message']);}})[_0x11a4('0x15')](function(_0x4fd0bb){logger[_0x11a4('0x11')](_0x11a4('0xd'),_0x2e79de,_0x4fd0bb);_0x171bba(_0x4fd0bb);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 3172b41..80393eb 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 _0x8910=['path','express','fs-extra','../../components/interaction/service','./intVtigerField.controller','get','show','create','put','isAuthenticated','update','delete','/:id','destroy','exports','multer','util'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x8910,0x163));var _0x0891=function(_0x37656f,_0x350ac6){_0x37656f=_0x37656f-0x0;var _0x5cd9d8=_0x8910[_0x37656f];return _0x5cd9d8;};'use strict';var multer=require(_0x0891('0x0'));var util=require(_0x0891('0x1'));var path=require(_0x0891('0x2'));var timeout=require('connect-timeout');var express=require(_0x0891('0x3'));var router=express['Router']();var fs_extra=require(_0x0891('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0891('0x5'));var config=require('../../config/environment');var controller=require(_0x0891('0x6'));router[_0x0891('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0891('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x0891('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0891('0x9')]);router[_0x0891('0xa')]('/:id',auth[_0x0891('0xb')](),controller[_0x0891('0xc')]);router[_0x0891('0xd')](_0x0891('0xe'),auth[_0x0891('0xb')](),controller[_0x0891('0xf')]);module[_0x0891('0x10')]=router; \ No newline at end of file +var _0x1cca=['delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id','show','post','create','put','update'];(function(_0x3d73f4,_0x3aec37){var _0x2a71d7=function(_0xd01d09){while(--_0xd01d09){_0x3d73f4['push'](_0x3d73f4['shift']());}};_0x2a71d7(++_0x3aec37);}(_0x1cca,0x17c));var _0xa1cc=function(_0x4b937e,_0x342ddf){_0x4b937e=_0x4b937e-0x0;var _0x169c3c=_0x1cca[_0x4b937e];return _0x169c3c;};'use strict';var multer=require(_0xa1cc('0x0'));var util=require(_0xa1cc('0x1'));var path=require('path');var timeout=require(_0xa1cc('0x2'));var express=require(_0xa1cc('0x3'));var router=express[_0xa1cc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa1cc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa1cc('0x6'));var controller=require(_0xa1cc('0x7'));router[_0xa1cc('0x8')]('/',auth[_0xa1cc('0x9')](),controller['index']);router[_0xa1cc('0x8')](_0xa1cc('0xa'),auth['isAuthenticated'](),controller[_0xa1cc('0xb')]);router[_0xa1cc('0xc')]('/',auth[_0xa1cc('0x9')](),controller[_0xa1cc('0xd')]);router[_0xa1cc('0xe')](_0xa1cc('0xa'),auth[_0xa1cc('0x9')](),controller[_0xa1cc('0xf')]);router[_0xa1cc('0x10')]('/:id',auth[_0xa1cc('0x9')](),controller[_0xa1cc('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index e66cf1f..3ecfbba 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 _0x93e4=['keyValue','picklist','string','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x50a4b8,_0x7bd61b){var _0xb4942b=function(_0x46e7a8){while(--_0x46e7a8){_0x50a4b8['push'](_0x50a4b8['shift']());}};_0xb4942b(++_0x7bd61b);}(_0x93e4,0x196));var _0x493e=function(_0xb540a0,_0x3d855e){_0xb540a0=_0xb540a0-0x0;var _0x4afe15=_0x93e4[_0xb540a0];return _0x4afe15;};'use strict';var Sequelize=require(_0x493e('0x0'));module[_0x493e('0x1')]={'type':{'type':Sequelize[_0x493e('0x2')]('string',_0x493e('0x3'),'customVariable',_0x493e('0x4'),_0x493e('0x5')),'defaultValue':_0x493e('0x6')},'content':{'type':Sequelize[_0x493e('0x7')]},'key':{'type':Sequelize[_0x493e('0x7')]},'keyType':{'type':Sequelize[_0x493e('0x2')](_0x493e('0x6'),_0x493e('0x3'),_0x493e('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x493e('0x7')]},'nameField':{'type':Sequelize[_0x493e('0x7')]},'customField':{'type':Sequelize[_0x493e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x493e('0x7')]}}; \ No newline at end of file +var _0xc016=['keyValue','picklist','string','STRING','sequelize','exports','ENUM','variable','customVariable'];(function(_0x9119f3,_0x5364d3){var _0x336cc3=function(_0x3c8cd6){while(--_0x3c8cd6){_0x9119f3['push'](_0x9119f3['shift']());}};_0x336cc3(++_0x5364d3);}(_0xc016,0x112));var _0x6c01=function(_0x2b1a59,_0x1dafa5){_0x2b1a59=_0x2b1a59-0x0;var _0x21a2f2=_0xc016[_0x2b1a59];return _0x21a2f2;};'use strict';var Sequelize=require(_0x6c01('0x0'));module[_0x6c01('0x1')]={'type':{'type':Sequelize[_0x6c01('0x2')]('string',_0x6c01('0x3'),_0x6c01('0x4'),_0x6c01('0x5'),_0x6c01('0x6')),'defaultValue':_0x6c01('0x7')},'content':{'type':Sequelize[_0x6c01('0x8')]},'key':{'type':Sequelize[_0x6c01('0x8')]},'keyType':{'type':Sequelize[_0x6c01('0x2')](_0x6c01('0x7'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x6c01('0x8')]},'idField':{'type':Sequelize[_0x6c01('0x8')]},'nameField':{'type':Sequelize[_0x6c01('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6c01('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 282bec6..404e7fb 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 _0xc6c8=['request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','end','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','options','create','body','params','find','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x362061,_0x12491f){var _0x17c444=function(_0x415662){while(--_0x415662){_0x362061['push'](_0x362061['shift']());}};_0x17c444(++_0x12491f);}(_0xc6c8,0x1d0));var _0x8c6c=function(_0x3ad0f8,_0x118031){_0x3ad0f8=_0x3ad0f8-0x0;var _0x22f8e3=_0xc6c8[_0x3ad0f8];return _0x22f8e3;};'use strict';var emlformat=require(_0x8c6c('0x0'));var rimraf=require(_0x8c6c('0x1'));var zipdir=require(_0x8c6c('0x2'));var jsonpatch=require(_0x8c6c('0x3'));var rp=require(_0x8c6c('0x4'));var moment=require(_0x8c6c('0x5'));var BPromise=require(_0x8c6c('0x6'));var Mustache=require('mustache');var util=require(_0x8c6c('0x7'));var path=require(_0x8c6c('0x8'));var sox=require(_0x8c6c('0x9'));var csv=require(_0x8c6c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8c6c('0xb'));var _=require(_0x8c6c('0xc'));var squel=require(_0x8c6c('0xd'));var crypto=require('crypto');var jsforce=require(_0x8c6c('0xe'));var deskjs=require(_0x8c6c('0xf'));var toCsv=require(_0x8c6c('0xa'));var querystring=require('querystring');var Papa=require(_0x8c6c('0x10'));var Redis=require(_0x8c6c('0x11'));var authService=require(_0x8c6c('0x12'));var qs=require(_0x8c6c('0x13'));var as=require(_0x8c6c('0x14'));var hardwareService=require(_0x8c6c('0x15'));var logger=require('../../config/logger')(_0x8c6c('0x16'));var utils=require(_0x8c6c('0x17'));var config=require(_0x8c6c('0x18'));var licenseUtil=require(_0x8c6c('0x19'));var db=require(_0x8c6c('0x1a'))['db'];function respondWithStatusCode(_0x3cbeb4,_0x516e47){_0x516e47=_0x516e47||0xcc;return function(_0x22e3fc){if(_0x22e3fc){return _0x3cbeb4[_0x8c6c('0x1b')](_0x516e47);}return _0x3cbeb4[_0x8c6c('0x1c')](_0x516e47)['end']();};}function respondWithResult(_0xffa40f,_0x70103c){_0x70103c=_0x70103c||0xc8;return function(_0x4e0d15){if(_0x4e0d15){return _0xffa40f[_0x8c6c('0x1c')](_0x70103c)[_0x8c6c('0x1d')](_0x4e0d15);}};}function respondWithFilteredResult(_0xea7543,_0x4ddf6a){return function(_0x41aaab){if(_0x41aaab){var _0x5453aa=typeof _0x4ddf6a[_0x8c6c('0x1e')]===_0x8c6c('0x1f')&&typeof _0x4ddf6a[_0x8c6c('0x20')]==='undefined';var _0x5580fe=_0x41aaab['count'];var _0x13c4d8=_0x5453aa?0x0:_0x4ddf6a['offset'];var _0x45f59f=_0x5453aa?_0x41aaab[_0x8c6c('0x21')]:_0x4ddf6a[_0x8c6c('0x1e')]+_0x4ddf6a['limit'];var _0x469910;if(_0x45f59f>=_0x5580fe){_0x45f59f=_0x5580fe;_0x469910=0xc8;}else{_0x469910=0xce;}_0xea7543[_0x8c6c('0x1c')](_0x469910);return _0xea7543[_0x8c6c('0x22')](_0x8c6c('0x23'),_0x13c4d8+'-'+_0x45f59f+'/'+_0x5580fe)['json'](_0x41aaab);}return null;};}function patchUpdates(_0x491c0f){return function(_0x4554f2){try{jsonpatch['apply'](_0x4554f2,_0x491c0f,!![]);}catch(_0x128cbd){return BPromise['reject'](_0x128cbd);}return _0x4554f2[_0x8c6c('0x24')]();};}function saveUpdates(_0x2eae77,_0x52437a){return function(_0x49ab8b){if(_0x49ab8b){return _0x49ab8b[_0x8c6c('0x25')](_0x2eae77)['then'](function(_0x312c8a){return _0x312c8a;});}return null;};}function removeEntity(_0x1f086b,_0x34ed4b){return function(_0x3e2497){if(_0x3e2497){return _0x3e2497[_0x8c6c('0x26')]()[_0x8c6c('0x27')](function(){_0x1f086b[_0x8c6c('0x1c')](0xcc)[_0x8c6c('0x28')]();});}};}function handleEntityNotFound(_0x5261c5,_0x4eefce){return function(_0x133d4d){if(!_0x133d4d){_0x5261c5['sendStatus'](0x194);}return _0x133d4d;};}function handleError(_0x144510,_0x215f54){_0x215f54=_0x215f54||0x1f4;return function(_0x29d98e){logger[_0x8c6c('0x29')](_0x29d98e[_0x8c6c('0x2a')]);if(_0x29d98e[_0x8c6c('0x2b')]){delete _0x29d98e[_0x8c6c('0x2b')];}_0x144510[_0x8c6c('0x1c')](_0x215f54)[_0x8c6c('0x2c')](_0x29d98e);};}exports[_0x8c6c('0x2d')]=function(_0x2f6076,_0x535960){var _0x5e0c62={},_0x35b176={},_0x3358f3={'count':0x0,'rows':[]};var _0x49d81a=_[_0x8c6c('0x2e')](db[_0x8c6c('0x2f')][_0x8c6c('0x30')],function(_0x16b521){return{'name':_0x16b521[_0x8c6c('0x31')],'type':_0x16b521[_0x8c6c('0x32')][_0x8c6c('0x33')]};});_0x35b176[_0x8c6c('0x34')]=_['map'](_0x49d81a,'name');_0x35b176['query']=_[_0x8c6c('0x35')](_0x2f6076['query']);_0x35b176[_0x8c6c('0x36')]=_[_0x8c6c('0x37')](_0x35b176['model'],_0x35b176[_0x8c6c('0x38')]);_0x5e0c62[_0x8c6c('0x39')]=_[_0x8c6c('0x37')](_0x35b176[_0x8c6c('0x34')],qs['fields'](_0x2f6076[_0x8c6c('0x38')][_0x8c6c('0x3a')]));_0x5e0c62['attributes']=_0x5e0c62[_0x8c6c('0x39')][_0x8c6c('0x3b')]?_0x5e0c62[_0x8c6c('0x39')]:_0x35b176[_0x8c6c('0x34')];if(!_0x2f6076['query'][_0x8c6c('0x3c')](_0x8c6c('0x3d'))){_0x5e0c62['limit']=qs[_0x8c6c('0x20')](_0x2f6076['query']['limit']);_0x5e0c62[_0x8c6c('0x1e')]=qs[_0x8c6c('0x1e')](_0x2f6076['query'][_0x8c6c('0x1e')]);}_0x5e0c62[_0x8c6c('0x3e')]=qs[_0x8c6c('0x3f')](_0x2f6076[_0x8c6c('0x38')][_0x8c6c('0x3f')]);_0x5e0c62[_0x8c6c('0x40')]=qs['filters'](_[_0x8c6c('0x41')](_0x2f6076[_0x8c6c('0x38')],_0x35b176['filters']),_0x49d81a);if(_0x2f6076[_0x8c6c('0x38')][_0x8c6c('0x42')]){_0x5e0c62[_0x8c6c('0x40')]=_[_0x8c6c('0x43')](_0x5e0c62['where'],{'$or':_[_0x8c6c('0x2e')](_0x49d81a,function(_0x3e34dc){if(_0x3e34dc[_0x8c6c('0x32')]!==_0x8c6c('0x44')){var _0x3b76d0={};_0x3b76d0[_0x3e34dc['name']]={'$like':'%'+_0x2f6076[_0x8c6c('0x38')]['filter']+'%'};return _0x3b76d0;}})});}_0x5e0c62=_[_0x8c6c('0x43')]({},_0x5e0c62,_0x2f6076['options']);var _0x211915={'where':_0x5e0c62['where']};return db[_0x8c6c('0x2f')]['count'](_0x211915)['then'](function(_0x56a9d7){_0x3358f3[_0x8c6c('0x21')]=_0x56a9d7;if(_0x2f6076[_0x8c6c('0x38')]['includeAll']){_0x5e0c62[_0x8c6c('0x45')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x5e0c62);})[_0x8c6c('0x27')](function(_0xdbfef4){_0x3358f3[_0x8c6c('0x46')]=_0xdbfef4;return _0x3358f3;})['then'](respondWithFilteredResult(_0x535960,_0x5e0c62))[_0x8c6c('0x47')](handleError(_0x535960,null));};exports[_0x8c6c('0x48')]=function(_0x16c473,_0x429d38){var _0x1563bb={'raw':!![],'where':{'id':_0x16c473['params']['id']}},_0x42ca22={};_0x42ca22[_0x8c6c('0x34')]=_[_0x8c6c('0x35')](db[_0x8c6c('0x2f')]['rawAttributes']);_0x42ca22[_0x8c6c('0x38')]=_['keys'](_0x16c473['query']);_0x42ca22[_0x8c6c('0x36')]=_[_0x8c6c('0x37')](_0x42ca22[_0x8c6c('0x34')],_0x42ca22[_0x8c6c('0x38')]);_0x1563bb[_0x8c6c('0x39')]=_['intersection'](_0x42ca22[_0x8c6c('0x34')],qs['fields'](_0x16c473[_0x8c6c('0x38')][_0x8c6c('0x3a')]));_0x1563bb[_0x8c6c('0x39')]=_0x1563bb[_0x8c6c('0x39')]['length']?_0x1563bb[_0x8c6c('0x39')]:_0x42ca22['model'];if(_0x16c473['query']['includeAll']){_0x1563bb[_0x8c6c('0x45')]=[{'all':!![]}];}_0x1563bb=_[_0x8c6c('0x43')]({},_0x1563bb,_0x16c473[_0x8c6c('0x49')]);return db[_0x8c6c('0x2f')]['find'](_0x1563bb)['then'](handleEntityNotFound(_0x429d38,null))[_0x8c6c('0x27')](respondWithResult(_0x429d38,null))[_0x8c6c('0x47')](handleError(_0x429d38,null));};exports['create']=function(_0x5174e4,_0x2ada8e){return db[_0x8c6c('0x2f')][_0x8c6c('0x4a')](_0x5174e4[_0x8c6c('0x4b')],{})[_0x8c6c('0x27')](respondWithResult(_0x2ada8e,0xc9))[_0x8c6c('0x47')](handleError(_0x2ada8e,null));};exports[_0x8c6c('0x25')]=function(_0x2c32dd,_0x1bd018){if(_0x2c32dd[_0x8c6c('0x4b')]['id']){delete _0x2c32dd[_0x8c6c('0x4b')]['id'];}return db[_0x8c6c('0x2f')]['find']({'where':{'id':_0x2c32dd[_0x8c6c('0x4c')]['id']}})[_0x8c6c('0x27')](handleEntityNotFound(_0x1bd018,null))['then'](saveUpdates(_0x2c32dd[_0x8c6c('0x4b')],null))[_0x8c6c('0x27')](respondWithResult(_0x1bd018,null))[_0x8c6c('0x47')](handleError(_0x1bd018,null));};exports[_0x8c6c('0x26')]=function(_0x5e7227,_0x3af43f){return db[_0x8c6c('0x2f')][_0x8c6c('0x4d')]({'where':{'id':_0x5e7227[_0x8c6c('0x4c')]['id']}})[_0x8c6c('0x27')](handleEntityNotFound(_0x3af43f,null))[_0x8c6c('0x27')](removeEntity(_0x3af43f,null))[_0x8c6c('0x47')](handleError(_0x3af43f,null));}; \ No newline at end of file +var _0x425c=['attributes','intersection','fields','order','sort','where','pick','filter','merge','type','VtigerField','includeAll','findAll','catch','length','include','find','create','body','params','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json','undefined','count','offset','limit','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters'];(function(_0xb52530,_0x3d9473){var _0x21a602=function(_0x58c10f){while(--_0x58c10f){_0xb52530['push'](_0xb52530['shift']());}};_0x21a602(++_0x3d9473);}(_0x425c,0x163));var _0xc425=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x425c[_0x3e5086];return _0xfeb102;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc425('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc425('0x1'));var rp=require(_0xc425('0x2'));var moment=require('moment');var BPromise=require(_0xc425('0x3'));var Mustache=require('mustache');var util=require(_0xc425('0x4'));var path=require(_0xc425('0x5'));var sox=require(_0xc425('0x6'));var csv=require(_0xc425('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc425('0x8'));var squel=require(_0xc425('0x9'));var crypto=require('crypto');var jsforce=require(_0xc425('0xa'));var deskjs=require(_0xc425('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc425('0xc'));var Papa=require(_0xc425('0xd'));var Redis=require(_0xc425('0xe'));var authService=require(_0xc425('0xf'));var qs=require(_0xc425('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc425('0x11'));var logger=require(_0xc425('0x12'))(_0xc425('0x13'));var utils=require('../../config/utils');var config=require(_0xc425('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42a047,_0xc12d85){_0xc12d85=_0xc12d85||0xcc;return function(_0x58866a){if(_0x58866a){return _0x42a047['sendStatus'](_0xc12d85);}return _0x42a047[_0xc425('0x15')](_0xc12d85)[_0xc425('0x16')]();};}function respondWithResult(_0xc47093,_0x2110e9){_0x2110e9=_0x2110e9||0xc8;return function(_0x59e938){if(_0x59e938){return _0xc47093[_0xc425('0x15')](_0x2110e9)[_0xc425('0x17')](_0x59e938);}};}function respondWithFilteredResult(_0x43214b,_0x322460){return function(_0x29471e){if(_0x29471e){var _0x1f8c72=typeof _0x322460['offset']===_0xc425('0x18')&&typeof _0x322460['limit']===_0xc425('0x18');var _0x29310a=_0x29471e[_0xc425('0x19')];var _0x564f24=_0x1f8c72?0x0:_0x322460[_0xc425('0x1a')];var _0x3ff8cf=_0x1f8c72?_0x29471e['count']:_0x322460[_0xc425('0x1a')]+_0x322460[_0xc425('0x1b')];var _0x5ad486;if(_0x3ff8cf>=_0x29310a){_0x3ff8cf=_0x29310a;_0x5ad486=0xc8;}else{_0x5ad486=0xce;}_0x43214b[_0xc425('0x15')](_0x5ad486);return _0x43214b['set']('Content-Range',_0x564f24+'-'+_0x3ff8cf+'/'+_0x29310a)[_0xc425('0x17')](_0x29471e);}return null;};}function patchUpdates(_0x500fb1){return function(_0x889338){try{jsonpatch[_0xc425('0x1c')](_0x889338,_0x500fb1,!![]);}catch(_0x53f1c0){return BPromise[_0xc425('0x1d')](_0x53f1c0);}return _0x889338[_0xc425('0x1e')]();};}function saveUpdates(_0x337934,_0x53b117){return function(_0x5376d5){if(_0x5376d5){return _0x5376d5[_0xc425('0x1f')](_0x337934)[_0xc425('0x20')](function(_0x28a445){return _0x28a445;});}return null;};}function removeEntity(_0x3befde,_0x4ff4d1){return function(_0x5128a9){if(_0x5128a9){return _0x5128a9[_0xc425('0x21')]()[_0xc425('0x20')](function(){_0x3befde['status'](0xcc)[_0xc425('0x16')]();});}};}function handleEntityNotFound(_0x143b71,_0x587493){return function(_0x3d0bee){if(!_0x3d0bee){_0x143b71[_0xc425('0x22')](0x194);}return _0x3d0bee;};}function handleError(_0xbbe25e,_0x66adeb){_0x66adeb=_0x66adeb||0x1f4;return function(_0xd90d89){logger['error'](_0xd90d89[_0xc425('0x23')]);if(_0xd90d89[_0xc425('0x24')]){delete _0xd90d89[_0xc425('0x24')];}_0xbbe25e[_0xc425('0x15')](_0x66adeb)[_0xc425('0x25')](_0xd90d89);};}exports[_0xc425('0x26')]=function(_0xe96a4c,_0x3c8f89){var _0x291e0f={},_0x32c521={},_0x420c04={'count':0x0,'rows':[]};var _0x3b4248=_[_0xc425('0x27')](db['VtigerField'][_0xc425('0x28')],function(_0x3e6039){return{'name':_0x3e6039[_0xc425('0x29')],'type':_0x3e6039['type'][_0xc425('0x2a')]};});_0x32c521[_0xc425('0x2b')]=_[_0xc425('0x27')](_0x3b4248,_0xc425('0x24'));_0x32c521[_0xc425('0x2c')]=_[_0xc425('0x2d')](_0xe96a4c[_0xc425('0x2c')]);_0x32c521[_0xc425('0x2e')]=_['intersection'](_0x32c521[_0xc425('0x2b')],_0x32c521['query']);_0x291e0f[_0xc425('0x2f')]=_[_0xc425('0x30')](_0x32c521[_0xc425('0x2b')],qs[_0xc425('0x31')](_0xe96a4c['query']['fields']));_0x291e0f[_0xc425('0x2f')]=_0x291e0f['attributes']['length']?_0x291e0f['attributes']:_0x32c521[_0xc425('0x2b')];if(!_0xe96a4c['query']['hasOwnProperty']('nolimit')){_0x291e0f[_0xc425('0x1b')]=qs[_0xc425('0x1b')](_0xe96a4c[_0xc425('0x2c')][_0xc425('0x1b')]);_0x291e0f['offset']=qs[_0xc425('0x1a')](_0xe96a4c['query']['offset']);}_0x291e0f[_0xc425('0x32')]=qs[_0xc425('0x33')](_0xe96a4c[_0xc425('0x2c')][_0xc425('0x33')]);_0x291e0f[_0xc425('0x34')]=qs['filters'](_[_0xc425('0x35')](_0xe96a4c['query'],_0x32c521[_0xc425('0x2e')]),_0x3b4248);if(_0xe96a4c['query'][_0xc425('0x36')]){_0x291e0f[_0xc425('0x34')]=_[_0xc425('0x37')](_0x291e0f[_0xc425('0x34')],{'$or':_[_0xc425('0x27')](_0x3b4248,function(_0x4623cd){if(_0x4623cd[_0xc425('0x38')]!=='VIRTUAL'){var _0x3f696e={};_0x3f696e[_0x4623cd[_0xc425('0x24')]]={'$like':'%'+_0xe96a4c[_0xc425('0x2c')]['filter']+'%'};return _0x3f696e;}})});}_0x291e0f=_[_0xc425('0x37')]({},_0x291e0f,_0xe96a4c['options']);var _0x4f6008={'where':_0x291e0f[_0xc425('0x34')]};return db[_0xc425('0x39')][_0xc425('0x19')](_0x4f6008)[_0xc425('0x20')](function(_0x2fd6cf){_0x420c04[_0xc425('0x19')]=_0x2fd6cf;if(_0xe96a4c['query'][_0xc425('0x3a')]){_0x291e0f['include']=[{'all':!![]}];}return db[_0xc425('0x39')][_0xc425('0x3b')](_0x291e0f);})['then'](function(_0xdee64c){_0x420c04['rows']=_0xdee64c;return _0x420c04;})[_0xc425('0x20')](respondWithFilteredResult(_0x3c8f89,_0x291e0f))[_0xc425('0x3c')](handleError(_0x3c8f89,null));};exports['show']=function(_0x2c2485,_0x14b634){var _0x17fd33={'raw':!![],'where':{'id':_0x2c2485['params']['id']}},_0x4a7404={};_0x4a7404[_0xc425('0x2b')]=_[_0xc425('0x2d')](db[_0xc425('0x39')]['rawAttributes']);_0x4a7404[_0xc425('0x2c')]=_[_0xc425('0x2d')](_0x2c2485[_0xc425('0x2c')]);_0x4a7404[_0xc425('0x2e')]=_[_0xc425('0x30')](_0x4a7404[_0xc425('0x2b')],_0x4a7404['query']);_0x17fd33[_0xc425('0x2f')]=_[_0xc425('0x30')](_0x4a7404[_0xc425('0x2b')],qs[_0xc425('0x31')](_0x2c2485[_0xc425('0x2c')]['fields']));_0x17fd33[_0xc425('0x2f')]=_0x17fd33[_0xc425('0x2f')][_0xc425('0x3d')]?_0x17fd33[_0xc425('0x2f')]:_0x4a7404[_0xc425('0x2b')];if(_0x2c2485[_0xc425('0x2c')][_0xc425('0x3a')]){_0x17fd33[_0xc425('0x3e')]=[{'all':!![]}];}_0x17fd33=_[_0xc425('0x37')]({},_0x17fd33,_0x2c2485['options']);return db[_0xc425('0x39')][_0xc425('0x3f')](_0x17fd33)[_0xc425('0x20')](handleEntityNotFound(_0x14b634,null))[_0xc425('0x20')](respondWithResult(_0x14b634,null))[_0xc425('0x3c')](handleError(_0x14b634,null));};exports[_0xc425('0x40')]=function(_0x10581c,_0x494295){return db[_0xc425('0x39')][_0xc425('0x40')](_0x10581c['body'],{})[_0xc425('0x20')](respondWithResult(_0x494295,0xc9))[_0xc425('0x3c')](handleError(_0x494295,null));};exports[_0xc425('0x1f')]=function(_0x22ec28,_0x54edcb){if(_0x22ec28[_0xc425('0x41')]['id']){delete _0x22ec28['body']['id'];}return db[_0xc425('0x39')][_0xc425('0x3f')]({'where':{'id':_0x22ec28[_0xc425('0x42')]['id']}})['then'](handleEntityNotFound(_0x54edcb,null))[_0xc425('0x20')](saveUpdates(_0x22ec28['body'],null))['then'](respondWithResult(_0x54edcb,null))['catch'](handleError(_0x54edcb,null));};exports[_0xc425('0x21')]=function(_0x4263c3,_0x5630c5){return db['VtigerField'][_0xc425('0x3f')]({'where':{'id':_0x4263c3[_0xc425('0x42')]['id']}})[_0xc425('0x20')](handleEntityNotFound(_0x5630c5,null))[_0xc425('0x20')](removeEntity(_0x5630c5,null))[_0xc425('0x3c')](handleError(_0x5630c5,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 9bf71e4..6aa8935 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 _0x0ef8=['request-promise','path','rimraf','../../config/environment','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','FieldId','lodash','api','moment','bluebird'];(function(_0x147888,_0x26804b){var _0x27edbf=function(_0x1ff27b){while(--_0x1ff27b){_0x147888['push'](_0x147888['shift']());}};_0x27edbf(++_0x26804b);}(_0x0ef8,0x6c));var _0x80ef=function(_0x188216,_0x32edd9){_0x188216=_0x188216-0x0;var _0x4ac14e=_0x0ef8[_0x188216];return _0x4ac14e;};'use strict';var _=require(_0x80ef('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x80ef('0x1'));var moment=require(_0x80ef('0x2'));var BPromise=require(_0x80ef('0x3'));var rp=require(_0x80ef('0x4'));var fs=require('fs');var path=require(_0x80ef('0x5'));var rimraf=require(_0x80ef('0x6'));var config=require(_0x80ef('0x7'));var attributes=require('./intVtigerField.attributes');module[_0x80ef('0x8')]=function(_0x12ce39,_0x184a7c){return _0x12ce39[_0x80ef('0x9')](_0x80ef('0xa'),attributes,{'tableName':_0x80ef('0xb'),'paranoid':![],'indexes':[{'name':_0x80ef('0xc'),'fields':['idField',_0x80ef('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbb43=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util'];(function(_0x5d7700,_0x4de584){var _0x5322cc=function(_0x418245){while(--_0x418245){_0x5d7700['push'](_0x5d7700['shift']());}};_0x5322cc(++_0x4de584);}(_0xbb43,0x12e));var _0x3bb4=function(_0x54ccd7,_0x3bc3ce){_0x54ccd7=_0x54ccd7-0x0;var _0x4e667b=_0xbb43[_0x54ccd7];return _0x4e667b;};'use strict';var _=require(_0x3bb4('0x0'));var util=require(_0x3bb4('0x1'));var logger=require('../../config/logger')(_0x3bb4('0x2'));var moment=require(_0x3bb4('0x3'));var BPromise=require(_0x3bb4('0x4'));var rp=require(_0x3bb4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3bb4('0x6'));var config=require(_0x3bb4('0x7'));var attributes=require(_0x3bb4('0x8'));module[_0x3bb4('0x9')]=function(_0x4f6bc5,_0x27048c){return _0x4f6bc5[_0x3bb4('0xa')](_0x3bb4('0xb'),attributes,{'tableName':_0x3bb4('0xc'),'paranoid':![],'indexes':[{'name':_0x3bb4('0xd'),'fields':[_0x3bb4('0xe'),_0x3bb4('0xf')],'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 4ca1d61..b045512 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 _0x0de4=['info','result','catch','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','VtigerField,\x20%s,\x20%s','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x0de4,0xe7));var _0x40de=function(_0x4b44f3,_0x29fd9c){_0x4b44f3=_0x4b44f3-0x0;var _0x347b30=_0x0de4[_0x4b44f3];return _0x347b30;};'use strict';var _=require(_0x40de('0x0'));var util=require(_0x40de('0x1'));var moment=require(_0x40de('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x40de('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x40de('0x4'))(_0x40de('0x5'));var config=require(_0x40de('0x6'));var jayson=require(_0x40de('0x7'));var client=jayson['client'][_0x40de('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x412f34,_0x519143,_0x194616){return new BPromise(function(_0x1bad54,_0x2819ac){return client['request'](_0x412f34,_0x194616)[_0x40de('0x9')](function(_0x482e6d){logger['info'](_0x40de('0xa'),_0x519143,'request\x20sent');logger['debug'](_0x40de('0xb'),_0x519143,_0x40de('0xc'),JSON['stringify'](_0x482e6d));if(_0x482e6d['error']){if(_0x482e6d[_0x40de('0xd')][_0x40de('0xe')]===0x1f4){logger['error'](_0x40de('0xa'),_0x519143,_0x482e6d[_0x40de('0xd')][_0x40de('0xf')]);return _0x2819ac(_0x482e6d[_0x40de('0xd')][_0x40de('0xf')]);}logger[_0x40de('0xd')](_0x40de('0xa'),_0x519143,_0x482e6d['error']['message']);return _0x1bad54(_0x482e6d['error'][_0x40de('0xf')]);}else{logger[_0x40de('0x10')](_0x40de('0xa'),_0x519143,_0x40de('0xc'));_0x1bad54(_0x482e6d[_0x40de('0x11')]['message']);}})[_0x40de('0x12')](function(_0x2cfccc){logger[_0x40de('0xd')](_0x40de('0xa'),_0x519143,_0x2cfccc);_0x2819ac(_0x2cfccc);});});} \ No newline at end of file +var _0x56b2=['code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x322016,_0x338bca){var _0x3c0fea=function(_0x2ab703){while(--_0x2ab703){_0x322016['push'](_0x322016['shift']());}};_0x3c0fea(++_0x338bca);}(_0x56b2,0x1d0));var _0x256b=function(_0x1f6d87,_0x42edb6){_0x1f6d87=_0x1f6d87-0x0;var _0x283b0a=_0x56b2[_0x1f6d87];return _0x283b0a;};'use strict';var _=require(_0x256b('0x0'));var util=require('util');var moment=require(_0x256b('0x1'));var BPromise=require('bluebird');var rs=require(_0x256b('0x2'));var fs=require('fs');var Redis=require(_0x256b('0x3'));var db=require(_0x256b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x256b('0x5'))(_0x256b('0x6'));var config=require(_0x256b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x256b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c09ea,_0x3bfacd,_0x558ed7){return new BPromise(function(_0x3eeff9,_0x45f44a){return client['request'](_0x5c09ea,_0x558ed7)[_0x256b('0x9')](function(_0x3a93aa){logger[_0x256b('0xa')](_0x256b('0xb'),_0x3bfacd,'request\x20sent');logger[_0x256b('0xc')](_0x256b('0xd'),_0x3bfacd,_0x256b('0xe'),JSON['stringify'](_0x3a93aa));if(_0x3a93aa[_0x256b('0xf')]){if(_0x3a93aa['error'][_0x256b('0x10')]===0x1f4){logger[_0x256b('0xf')]('VtigerField,\x20%s,\x20%s',_0x3bfacd,_0x3a93aa[_0x256b('0xf')]['message']);return _0x45f44a(_0x3a93aa[_0x256b('0xf')][_0x256b('0x11')]);}logger[_0x256b('0xf')]('VtigerField,\x20%s,\x20%s',_0x3bfacd,_0x3a93aa[_0x256b('0xf')][_0x256b('0x11')]);return _0x3eeff9(_0x3a93aa[_0x256b('0xf')][_0x256b('0x11')]);}else{logger['info'](_0x256b('0xb'),_0x3bfacd,_0x256b('0xe'));_0x3eeff9(_0x3a93aa[_0x256b('0x12')][_0x256b('0x11')]);}})[_0x256b('0x13')](function(_0x5f1810){logger[_0x256b('0xf')]('VtigerField,\x20%s,\x20%s',_0x3bfacd,_0x5f1810);_0x45f44a(_0x5f1810);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 1070d0e..290ceb6 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 _0x0858=['/:id/configurations','addConfiguration','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','post','create'];(function(_0x4ed227,_0x3effbb){var _0x374345=function(_0x49cc97){while(--_0x49cc97){_0x4ed227['push'](_0x4ed227['shift']());}};_0x374345(++_0x3effbb);}(_0x0858,0x192));var _0x8085=function(_0x512375,_0x53e0db){_0x512375=_0x512375-0x0;var _0x2bb4db=_0x0858[_0x512375];return _0x2bb4db;};'use strict';var multer=require('multer');var util=require(_0x8085('0x0'));var path=require(_0x8085('0x1'));var timeout=require(_0x8085('0x2'));var express=require(_0x8085('0x3'));var router=express[_0x8085('0x4')]();var fs_extra=require(_0x8085('0x5'));var auth=require(_0x8085('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0x8085('0x7')](),controller[_0x8085('0x8')]);router[_0x8085('0x9')](_0x8085('0xa'),auth[_0x8085('0x7')](),controller[_0x8085('0xb')]);router[_0x8085('0x9')]('/:id/configurations',auth[_0x8085('0x7')](),controller['getConfigurations']);router[_0x8085('0x9')](_0x8085('0xc'),auth[_0x8085('0x7')](),controller[_0x8085('0xd')]);router[_0x8085('0xe')]('/',auth[_0x8085('0x7')](),controller[_0x8085('0xf')]);router[_0x8085('0xe')](_0x8085('0x10'),auth[_0x8085('0x7')](),controller[_0x8085('0x11')]);router[_0x8085('0x12')](_0x8085('0xa'),auth[_0x8085('0x7')](),controller['update']);router[_0x8085('0x13')](_0x8085('0xa'),auth[_0x8085('0x7')](),controller[_0x8085('0x14')]);module[_0x8085('0x15')]=router; \ No newline at end of file +var _0x5465=['getFields','create','post','addConfiguration','update','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x10bf5d,_0x10a3a9){var _0x27f511=function(_0x209cf3){while(--_0x209cf3){_0x10bf5d['push'](_0x10bf5d['shift']());}};_0x27f511(++_0x10a3a9);}(_0x5465,0x150));var _0x5546=function(_0xa3582e,_0x16ebb7){_0xa3582e=_0xa3582e-0x0;var _0x262a3a=_0x5465[_0xa3582e];return _0x262a3a;};'use strict';var multer=require(_0x5546('0x0'));var util=require(_0x5546('0x1'));var path=require(_0x5546('0x2'));var timeout=require(_0x5546('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5546('0x4'));var interaction=require(_0x5546('0x5'));var config=require(_0x5546('0x6'));var controller=require(_0x5546('0x7'));router[_0x5546('0x8')]('/',auth[_0x5546('0x9')](),controller[_0x5546('0xa')]);router['get'](_0x5546('0xb'),auth[_0x5546('0x9')](),controller[_0x5546('0xc')]);router[_0x5546('0x8')](_0x5546('0xd'),auth['isAuthenticated'](),controller[_0x5546('0xe')]);router[_0x5546('0x8')](_0x5546('0xf'),auth[_0x5546('0x9')](),controller[_0x5546('0x10')]);router['post']('/',auth[_0x5546('0x9')](),controller[_0x5546('0x11')]);router[_0x5546('0x12')](_0x5546('0xd'),auth[_0x5546('0x9')](),controller[_0x5546('0x13')]);router['put']('/:id',auth[_0x5546('0x9')](),controller[_0x5546('0x14')]);router['delete'](_0x5546('0xb'),auth[_0x5546('0x9')](),controller[_0x5546('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 9d49f4a..518173e 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 _0x4910=['ENUM','password','token','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x2b2b26,_0x2e097c){var _0x33aa70=function(_0xe25d02){while(--_0xe25d02){_0x2b2b26['push'](_0x2b2b26['shift']());}};_0x33aa70(++_0x2e097c);}(_0x4910,0x1d9));var _0x0491=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4910[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x0491('0x0'));module[_0x0491('0x1')]={'name':{'type':Sequelize[_0x0491('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x0491('0x2')],'unique':_0x0491('0x3')},'password':{'type':Sequelize[_0x0491('0x2')]},'token':{'type':Sequelize[_0x0491('0x2')]},'remoteUri':{'type':Sequelize[_0x0491('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x0491('0x4')](_0x0491('0x5'),_0x0491('0x6')),'defaultValue':_0x0491('0x5')},'serverUrl':{'type':Sequelize[_0x0491('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0491('0x7'),_0x0491('0x8')),'defaultValue':_0x0491('0x7')}}; \ No newline at end of file +var _0x14b2=['username','remoteUri','token','password','ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0x14b2,0x1a1));var _0x214b=function(_0x42deb8,_0x45e3c6){_0x42deb8=_0x42deb8-0x0;var _0x6a961=_0x14b2[_0x42deb8];return _0x6a961;};'use strict';var Sequelize=require(_0x214b('0x0'));module[_0x214b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x214b('0x2')]},'username':{'type':Sequelize[_0x214b('0x2')],'unique':_0x214b('0x3')},'password':{'type':Sequelize[_0x214b('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x214b('0x2')],'unique':_0x214b('0x4')},'authType':{'type':Sequelize['ENUM']('password',_0x214b('0x5')),'defaultValue':_0x214b('0x6')},'serverUrl':{'type':Sequelize[_0x214b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x214b('0x7')](_0x214b('0x8'),_0x214b('0x9')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index cf63b9e..26718a4 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 _0x44a3=['save','update','then','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','getConfigurations','ZendeskConfiguration','addConfiguration','Subjects','getSubjects','Descriptions','ZendeskField','getFields','username','password','token','remoteUri','slice','substring','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','Sequelize','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','title','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x44a3,0x1a9));var _0x344a=function(_0x1e7bdd,_0x216b81){_0x1e7bdd=_0x1e7bdd-0x0;var _0xcd343d=_0x44a3[_0x1e7bdd];return _0xcd343d;};'use strict';var emlformat=require(_0x344a('0x0'));var rimraf=require(_0x344a('0x1'));var zipdir=require(_0x344a('0x2'));var jsonpatch=require(_0x344a('0x3'));var rp=require(_0x344a('0x4'));var moment=require(_0x344a('0x5'));var BPromise=require(_0x344a('0x6'));var Mustache=require(_0x344a('0x7'));var util=require('util');var path=require(_0x344a('0x8'));var sox=require(_0x344a('0x9'));var csv=require(_0x344a('0xa'));var ejs=require(_0x344a('0xb'));var fs=require('fs');var fs_extra=require(_0x344a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x344a('0xd'));var toCsv=require(_0x344a('0xa'));var querystring=require(_0x344a('0xe'));var Papa=require(_0x344a('0xf'));var Redis=require(_0x344a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x344a('0x11'));var as=require(_0x344a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x344a('0x13'))('api');var utils=require(_0x344a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x344a('0x15'));var db=require(_0x344a('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4a69ea,_0x304b70){_0x304b70=_0x304b70||0xcc;return function(_0x2ad7eb){if(_0x2ad7eb){return _0x4a69ea[_0x344a('0x17')](_0x304b70);}return _0x4a69ea[_0x344a('0x18')](_0x304b70)[_0x344a('0x19')]();};}function respondWithResult(_0x133ad4,_0x4ee562){_0x4ee562=_0x4ee562||0xc8;return function(_0x4032d7){if(_0x4032d7){return _0x133ad4[_0x344a('0x18')](_0x4ee562)[_0x344a('0x1a')](_0x4032d7);}};}function respondWithFilteredResult(_0x6e1639,_0x58c8cd){return function(_0x54a643){if(_0x54a643){var _0x3609ce=typeof _0x58c8cd[_0x344a('0x1b')]===_0x344a('0x1c')&&typeof _0x58c8cd[_0x344a('0x1d')]==='undefined';var _0x397de6=_0x54a643[_0x344a('0x1e')];var _0x49b55f=_0x3609ce?0x0:_0x58c8cd[_0x344a('0x1b')];var _0x274016=_0x3609ce?_0x54a643[_0x344a('0x1e')]:_0x58c8cd[_0x344a('0x1b')]+_0x58c8cd[_0x344a('0x1d')];var _0x43fa0f;if(_0x274016>=_0x397de6){_0x274016=_0x397de6;_0x43fa0f=0xc8;}else{_0x43fa0f=0xce;}_0x6e1639[_0x344a('0x18')](_0x43fa0f);return _0x6e1639[_0x344a('0x1f')](_0x344a('0x20'),_0x49b55f+'-'+_0x274016+'/'+_0x397de6)[_0x344a('0x1a')](_0x54a643);}return null;};}function patchUpdates(_0x4b3552){return function(_0x16c0fe){try{jsonpatch[_0x344a('0x21')](_0x16c0fe,_0x4b3552,!![]);}catch(_0xe0bdd4){return BPromise[_0x344a('0x22')](_0xe0bdd4);}return _0x16c0fe[_0x344a('0x23')]();};}function saveUpdates(_0x80ae12,_0x185303){return function(_0x976bcf){if(_0x976bcf){return _0x976bcf[_0x344a('0x24')](_0x80ae12)[_0x344a('0x25')](function(_0x90070c){return _0x90070c;});}return null;};}function removeEntity(_0x3b2ab9,_0x5ce9da){return function(_0x266fce){if(_0x266fce){return _0x266fce['destroy']()[_0x344a('0x25')](function(){_0x3b2ab9['status'](0xcc)[_0x344a('0x19')]();});}};}function handleEntityNotFound(_0x484f97,_0x36c920){return function(_0x8bf0b0){if(!_0x8bf0b0){_0x484f97[_0x344a('0x17')](0x194);}return _0x8bf0b0;};}function handleError(_0x16d404,_0x26f059){_0x26f059=_0x26f059||0x1f4;return function(_0x28749b){logger[_0x344a('0x26')](_0x28749b[_0x344a('0x27')]);if(_0x28749b['name']){delete _0x28749b[_0x344a('0x28')];}_0x16d404[_0x344a('0x18')](_0x26f059)[_0x344a('0x29')](_0x28749b);};}exports[_0x344a('0x2a')]=function(_0x14bd54,_0x2d72c9){var _0x5b877d={},_0x3d25fe={},_0x49bbf8={'count':0x0,'rows':[]};var _0x593cf6=_[_0x344a('0x2b')](db[_0x344a('0x2c')][_0x344a('0x2d')],function(_0x4803db){return{'name':_0x4803db['fieldName'],'type':_0x4803db['type'][_0x344a('0x2e')]};});_0x3d25fe[_0x344a('0x2f')]=_[_0x344a('0x2b')](_0x593cf6,'name');_0x3d25fe[_0x344a('0x30')]=_[_0x344a('0x31')](_0x14bd54[_0x344a('0x30')]);_0x3d25fe[_0x344a('0x32')]=_[_0x344a('0x33')](_0x3d25fe[_0x344a('0x2f')],_0x3d25fe[_0x344a('0x30')]);_0x5b877d['attributes']=_[_0x344a('0x33')](_0x3d25fe['model'],qs['fields'](_0x14bd54['query'][_0x344a('0x34')]));_0x5b877d[_0x344a('0x35')]=_0x5b877d[_0x344a('0x35')][_0x344a('0x36')]?_0x5b877d[_0x344a('0x35')]:_0x3d25fe[_0x344a('0x2f')];if(!_0x14bd54['query'][_0x344a('0x37')](_0x344a('0x38'))){_0x5b877d[_0x344a('0x1d')]=qs['limit'](_0x14bd54[_0x344a('0x30')][_0x344a('0x1d')]);_0x5b877d[_0x344a('0x1b')]=qs[_0x344a('0x1b')](_0x14bd54[_0x344a('0x30')]['offset']);}_0x5b877d[_0x344a('0x39')]=qs[_0x344a('0x3a')](_0x14bd54[_0x344a('0x30')][_0x344a('0x3a')]);_0x5b877d[_0x344a('0x3b')]=qs['filters'](_[_0x344a('0x3c')](_0x14bd54[_0x344a('0x30')],_0x3d25fe[_0x344a('0x32')]),_0x593cf6);if(_0x14bd54[_0x344a('0x30')][_0x344a('0x3d')]){_0x5b877d['where']=_[_0x344a('0x3e')](_0x5b877d[_0x344a('0x3b')],{'$or':_[_0x344a('0x2b')](_0x593cf6,function(_0x3356fb){if(_0x3356fb[_0x344a('0x3f')]!==_0x344a('0x40')){var _0x335a0a={};_0x335a0a[_0x3356fb[_0x344a('0x28')]]={'$like':'%'+_0x14bd54['query'][_0x344a('0x3d')]+'%'};return _0x335a0a;}})});}_0x5b877d=_[_0x344a('0x3e')]({},_0x5b877d,_0x14bd54[_0x344a('0x41')]);var _0x28bad9={'where':_0x5b877d[_0x344a('0x3b')]};return db['ZendeskAccount'][_0x344a('0x1e')](_0x28bad9)[_0x344a('0x25')](function(_0x7a33d7){_0x49bbf8[_0x344a('0x1e')]=_0x7a33d7;if(_0x14bd54[_0x344a('0x30')][_0x344a('0x42')]){_0x5b877d[_0x344a('0x43')]=[{'all':!![]}];}return db[_0x344a('0x2c')][_0x344a('0x44')](_0x5b877d);})['then'](function(_0x115a9c){_0x49bbf8[_0x344a('0x45')]=_0x115a9c;return _0x49bbf8;})[_0x344a('0x25')](respondWithFilteredResult(_0x2d72c9,_0x5b877d))[_0x344a('0x46')](handleError(_0x2d72c9,null));};exports['show']=function(_0x32bfa6,_0x3069ca){var _0x2b0ee9={'raw':![],'where':{'id':_0x32bfa6[_0x344a('0x47')]['id']}},_0x41f25b={};_0x41f25b[_0x344a('0x2f')]=_[_0x344a('0x31')](db[_0x344a('0x2c')][_0x344a('0x2d')]);_0x41f25b[_0x344a('0x30')]=_[_0x344a('0x31')](_0x32bfa6['query']);_0x41f25b[_0x344a('0x32')]=_[_0x344a('0x33')](_0x41f25b['model'],_0x41f25b[_0x344a('0x30')]);_0x2b0ee9[_0x344a('0x35')]=_['intersection'](_0x41f25b[_0x344a('0x2f')],qs[_0x344a('0x34')](_0x32bfa6['query'][_0x344a('0x34')]));_0x2b0ee9[_0x344a('0x35')]=_0x2b0ee9[_0x344a('0x35')]['length']?_0x2b0ee9[_0x344a('0x35')]:_0x41f25b['model'];if(_0x32bfa6[_0x344a('0x30')][_0x344a('0x42')]){_0x2b0ee9[_0x344a('0x43')]=[{'all':!![]}];}_0x2b0ee9=_[_0x344a('0x3e')]({},_0x2b0ee9,_0x32bfa6['options']);return db['ZendeskAccount'][_0x344a('0x48')](_0x2b0ee9)[_0x344a('0x25')](handleEntityNotFound(_0x3069ca,null))[_0x344a('0x25')](respondWithResult(_0x3069ca,null))[_0x344a('0x46')](handleError(_0x3069ca,null));};exports[_0x344a('0x49')]=function(_0xa3c8f0,_0x44962b){return db[_0x344a('0x2c')][_0x344a('0x49')](_0xa3c8f0[_0x344a('0x4a')],{})['then'](respondWithResult(_0x44962b,0xc9))[_0x344a('0x46')](handleError(_0x44962b,null));};exports[_0x344a('0x24')]=function(_0x6fad37,_0xbad7ca){if(_0x6fad37['body']['id']){delete _0x6fad37[_0x344a('0x4a')]['id'];}return db['ZendeskAccount']['find']({'where':{'id':_0x6fad37[_0x344a('0x47')]['id']}})[_0x344a('0x25')](handleEntityNotFound(_0xbad7ca,null))['then'](saveUpdates(_0x6fad37[_0x344a('0x4a')],null))[_0x344a('0x25')](respondWithResult(_0xbad7ca,null))[_0x344a('0x46')](handleError(_0xbad7ca,null));};exports[_0x344a('0x4b')]=function(_0x51e411,_0x225fce){return db[_0x344a('0x2c')][_0x344a('0x48')]({'where':{'id':_0x51e411[_0x344a('0x47')]['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x225fce,null))[_0x344a('0x25')](removeEntity(_0x225fce,null))[_0x344a('0x46')](handleError(_0x225fce,null));};exports[_0x344a('0x4c')]=function(_0x292357,_0x1911d0,_0x5e0885){var _0x15928a={};var _0x47ce9c={};var _0x1b7f6c;var _0xb744c6;return db[_0x344a('0x2c')]['findOne']({'where':{'id':_0x292357[_0x344a('0x47')]['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x1911d0,null))[_0x344a('0x25')](function(_0x14921e){if(_0x14921e){_0x1b7f6c=_0x14921e;_0x47ce9c[_0x344a('0x2f')]=_[_0x344a('0x31')](db[_0x344a('0x4d')][_0x344a('0x2d')]);_0x47ce9c[_0x344a('0x30')]=_['keys'](_0x292357[_0x344a('0x30')]);_0x47ce9c[_0x344a('0x32')]=_[_0x344a('0x33')](_0x47ce9c[_0x344a('0x2f')],_0x47ce9c[_0x344a('0x30')]);_0x15928a['attributes']=_[_0x344a('0x33')](_0x47ce9c[_0x344a('0x2f')],qs[_0x344a('0x34')](_0x292357[_0x344a('0x30')]['fields']));_0x15928a[_0x344a('0x35')]=_0x15928a[_0x344a('0x35')]['length']?_0x15928a[_0x344a('0x35')]:_0x47ce9c[_0x344a('0x2f')];_0x15928a[_0x344a('0x39')]=qs[_0x344a('0x3a')](_0x292357[_0x344a('0x30')][_0x344a('0x3a')]);_0x15928a[_0x344a('0x3b')]=qs['filters'](_['pick'](_0x292357['query'],_0x47ce9c[_0x344a('0x32')]));if(_0x292357[_0x344a('0x30')][_0x344a('0x3d')]){_0x15928a[_0x344a('0x3b')]=_['merge'](_0x15928a[_0x344a('0x3b')],{'$or':_['map'](_0x15928a['attributes'],function(_0x57241e){var _0x56b562={};_0x56b562[_0x57241e]={'$like':'%'+_0x292357[_0x344a('0x30')][_0x344a('0x3d')]+'%'};return _0x56b562;})});}_0x15928a=_[_0x344a('0x3e')]({},_0x15928a,_0x292357[_0x344a('0x41')]);return _0x1b7f6c['getConfigurations'](_0x15928a);}})['then'](function(_0x56e76e){if(_0x56e76e){_0xb744c6=_0x56e76e[_0x344a('0x36')];if(!_0x292357[_0x344a('0x30')][_0x344a('0x37')](_0x344a('0x38'))){_0x15928a[_0x344a('0x1d')]=qs['limit'](_0x292357[_0x344a('0x30')][_0x344a('0x1d')]);_0x15928a[_0x344a('0x1b')]=qs['offset'](_0x292357[_0x344a('0x30')]['offset']);}return _0x1b7f6c['getConfigurations'](_0x15928a);}})[_0x344a('0x25')](function(_0x532bcf){if(_0x532bcf){return _0x532bcf?{'count':_0xb744c6,'rows':_0x532bcf}:null;}})['then'](respondWithResult(_0x1911d0,null))[_0x344a('0x46')](handleError(_0x1911d0,null));};exports[_0x344a('0x4e')]=function(_0x4f2e35,_0x1bf894,_0x5808f2){if(_0x4f2e35[_0x344a('0x4a')]['id']){delete _0x4f2e35[_0x344a('0x4a')]['id'];}return db[_0x344a('0x2c')]['findOne']({'where':{'id':_0x4f2e35['params']['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x1bf894,null))[_0x344a('0x25')](function(_0xb4ddd7){if(_0xb4ddd7){_0x4f2e35[_0x344a('0x4a')]['AccountId']=_0xb4ddd7['id'];_0x4f2e35['body'][_0x344a('0x4f')]=integrations[_0x344a('0x50')](_0x4f2e35[_0x344a('0x4a')]['channel'],_0x4f2e35[_0x344a('0x4a')][_0x344a('0x3f')]);_0x4f2e35['body'][_0x344a('0x51')]=integrations['getDescriptions'](_0x4f2e35[_0x344a('0x4a')]['channel'],_0x4f2e35['body']['type']);return db[_0x344a('0x4d')][_0x344a('0x49')](_0x4f2e35[_0x344a('0x4a')],{'include':[{'model':db[_0x344a('0x52')],'as':_0x344a('0x4f')},{'model':db[_0x344a('0x52')],'as':'Descriptions'}]});}return null;})[_0x344a('0x25')](respondWithResult(_0x1bf894,null))[_0x344a('0x46')](handleError(_0x1bf894,null));};exports[_0x344a('0x53')]=function(_0x1c4284,_0x26688e,_0x523774){var _0x23a761='';return db[_0x344a('0x2c')]['findOne']({'where':{'id':_0x1c4284[_0x344a('0x47')]['id']},'attributes':['id',_0x344a('0x54'),_0x344a('0x55'),_0x344a('0x56'),'authType',_0x344a('0x57')]})[_0x344a('0x25')](handleEntityNotFound(_0x26688e,null))[_0x344a('0x25')](function(_0x42e1c0){if(_0x42e1c0){_0x23a761=_0x42e1c0[_0x344a('0x57')];var _0x421a09=_0x23a761[_0x344a('0x58')](-0x1);if(_0x421a09==='/'){_0x23a761=_0x23a761[_0x344a('0x59')](0x0,_0x23a761['lastIndexOf'](_0x421a09));}var _0x33113e={'method':_0x344a('0x5a'),'uri':util[_0x344a('0x5b')](_0x344a('0x5c'),_0x23a761,_0x344a('0x5d')),'json':!![]};switch(_0x42e1c0[_0x344a('0x5e')]){case _0x344a('0x55'):_0x33113e[_0x344a('0x5f')]={'Authorization':util['format'](_0x344a('0x60'),new Buffer(util[_0x344a('0x5b')](_0x344a('0x61'),_0x42e1c0[_0x344a('0x54')],_0x42e1c0['password']))[_0x344a('0x62')](_0x344a('0x63')))};break;case _0x344a('0x56'):_0x33113e[_0x344a('0x5f')]={'Authorization':util[_0x344a('0x5b')](_0x344a('0x60'),new Buffer(util[_0x344a('0x5b')](_0x344a('0x64'),_0x42e1c0['username'],_0x42e1c0[_0x344a('0x56')]))[_0x344a('0x62')](_0x344a('0x63')))};break;default:throw new db[(_0x344a('0x65'))]['ValidationError'](_0x344a('0x66'));}return rp(_0x33113e);}})[_0x344a('0x25')](function(_0x1d0025){if(_0x1d0025){var _0x2ff11d=[_0x344a('0x67'),_0x344a('0x68'),'group',_0x344a('0x69')];_[_0x344a('0x6a')](_0x1d0025[_0x344a('0x5d')],function(_0x5584d5){return _0x2ff11d[_0x344a('0x6b')](_0x5584d5[_0x344a('0x3f')]);});return{'count':_0x1d0025[_0x344a('0x5d')][_0x344a('0x36')],'rows':_[_0x344a('0x2b')](_0x1d0025['ticket_fields'],function(_0x15aadb){return{'id':_0x15aadb['id'],'name':_0x15aadb[_0x344a('0x6c')]>0x7?_0x15aadb[_0x344a('0x6d')]:_0x15aadb['type'],'custom':_0x15aadb[_0x344a('0x6c')]>0x7?!![]:![],'options':_0x15aadb['system_field_options']?_0x15aadb['system_field_options']:_0x15aadb[_0x344a('0x6e')]?_0x15aadb[_0x344a('0x6e')]:[]};})};}})[_0x344a('0x25')](respondWithResult(_0x26688e,null))[_0x344a('0x46')](function(_0x375c34){var _0x5e8df4=_0x1c4284[_0x344a('0x30')][_0x344a('0x6f')]?0x1f4:_0x375c34['statusCode']||0x1f4;logger[_0x344a('0x26')](_0x344a('0x70'),'getFields',_0x5e8df4,JSON['stringify'](_0x375c34));delete _0x375c34[_0x344a('0x28')];if(_0x5e8df4===0x191){_0x5e8df4=0x190;}_0x26688e[_0x344a('0x18')](_0x5e8df4)[_0x344a('0x29')](_0x1c4284[_0x344a('0x30')]['test']?{'message':_0x344a('0x71'),'statusCode':_0x375c34[_0x344a('0x72')]}:_0x375c34);});}; \ No newline at end of file +var _0x0102=['VIRTUAL','options','ZendeskAccount','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','ZendeskConfiguration','ZendeskField','getFields','password','token','authType','remoteUri','slice','lastIndexOf','format','%s/%s','ticket_fields','headers','%s:%s','toString','base64','Basic\x20%s','%s/token:%s','username','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','remove','includes','title','system_field_options','custom_field_options','test','statusCode','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','limit','count','json','apply','reject','then','sendStatus','error','stack','name','send','index','map','type','key','query','keys','intersection','model','fields','attributes','length','order','sort','where','pick','filters','filter','merge'];(function(_0x246851,_0x2fdedf){var _0x56c737=function(_0x1a2bc1){while(--_0x1a2bc1){_0x246851['push'](_0x246851['shift']());}};_0x56c737(++_0x2fdedf);}(_0x0102,0x186));var _0x2010=function(_0x40140f,_0x5090ee){_0x40140f=_0x40140f-0x0;var _0xc43e9d=_0x0102[_0x40140f];return _0xc43e9d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2010('0x0'));var zipdir=require(_0x2010('0x1'));var jsonpatch=require(_0x2010('0x2'));var rp=require(_0x2010('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2010('0x4'));var csv=require(_0x2010('0x5'));var ejs=require(_0x2010('0x6'));var fs=require('fs');var fs_extra=require(_0x2010('0x7'));var _=require('lodash');var squel=require(_0x2010('0x8'));var crypto=require('crypto');var jsforce=require(_0x2010('0x9'));var deskjs=require(_0x2010('0xa'));var toCsv=require('to-csv');var querystring=require(_0x2010('0xb'));var Papa=require(_0x2010('0xc'));var Redis=require(_0x2010('0xd'));var authService=require(_0x2010('0xe'));var qs=require(_0x2010('0xf'));var as=require(_0x2010('0x10'));var hardwareService=require(_0x2010('0x11'));var logger=require(_0x2010('0x12'))(_0x2010('0x13'));var utils=require(_0x2010('0x14'));var config=require(_0x2010('0x15'));var licenseUtil=require(_0x2010('0x16'));var db=require(_0x2010('0x17'))['db'];var integrations=require(_0x2010('0x18'));function respondWithStatusCode(_0x3e8624,_0x388991){_0x388991=_0x388991||0xcc;return function(_0x528a38){if(_0x528a38){return _0x3e8624['sendStatus'](_0x388991);}return _0x3e8624[_0x2010('0x19')](_0x388991)[_0x2010('0x1a')]();};}function respondWithResult(_0x2e8ec2,_0x10b587){_0x10b587=_0x10b587||0xc8;return function(_0x32d791){if(_0x32d791){return _0x2e8ec2[_0x2010('0x19')](_0x10b587)['json'](_0x32d791);}};}function respondWithFilteredResult(_0x3195fa,_0x136418){return function(_0x5ad412){if(_0x5ad412){var _0x41e267=typeof _0x136418[_0x2010('0x1b')]===_0x2010('0x1c')&&typeof _0x136418[_0x2010('0x1d')]===_0x2010('0x1c');var _0x11bd28=_0x5ad412[_0x2010('0x1e')];var _0x1476c0=_0x41e267?0x0:_0x136418[_0x2010('0x1b')];var _0x569de2=_0x41e267?_0x5ad412['count']:_0x136418[_0x2010('0x1b')]+_0x136418[_0x2010('0x1d')];var _0x3f9d62;if(_0x569de2>=_0x11bd28){_0x569de2=_0x11bd28;_0x3f9d62=0xc8;}else{_0x3f9d62=0xce;}_0x3195fa[_0x2010('0x19')](_0x3f9d62);return _0x3195fa['set']('Content-Range',_0x1476c0+'-'+_0x569de2+'/'+_0x11bd28)[_0x2010('0x1f')](_0x5ad412);}return null;};}function patchUpdates(_0x171e45){return function(_0x37b51b){try{jsonpatch[_0x2010('0x20')](_0x37b51b,_0x171e45,!![]);}catch(_0x103bbc){return BPromise[_0x2010('0x21')](_0x103bbc);}return _0x37b51b['save']();};}function saveUpdates(_0x3db13d,_0x1cfa57){return function(_0x58ff30){if(_0x58ff30){return _0x58ff30['update'](_0x3db13d)['then'](function(_0x424453){return _0x424453;});}return null;};}function removeEntity(_0x574719,_0x277dcc){return function(_0x5f4233){if(_0x5f4233){return _0x5f4233['destroy']()[_0x2010('0x22')](function(){_0x574719[_0x2010('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x99ebe0,_0x4cff59){return function(_0x2a12ee){if(!_0x2a12ee){_0x99ebe0[_0x2010('0x23')](0x194);}return _0x2a12ee;};}function handleError(_0x3929d9,_0x3dcea4){_0x3dcea4=_0x3dcea4||0x1f4;return function(_0x3c5862){logger[_0x2010('0x24')](_0x3c5862[_0x2010('0x25')]);if(_0x3c5862[_0x2010('0x26')]){delete _0x3c5862[_0x2010('0x26')];}_0x3929d9[_0x2010('0x19')](_0x3dcea4)[_0x2010('0x27')](_0x3c5862);};}exports[_0x2010('0x28')]=function(_0x499cbe,_0x2a4691){var _0x52fe5e={},_0x5b52fb={},_0x147a5a={'count':0x0,'rows':[]};var _0xd16c04=_[_0x2010('0x29')](db['ZendeskAccount']['rawAttributes'],function(_0x136d5f){return{'name':_0x136d5f['fieldName'],'type':_0x136d5f[_0x2010('0x2a')][_0x2010('0x2b')]};});_0x5b52fb['model']=_[_0x2010('0x29')](_0xd16c04,_0x2010('0x26'));_0x5b52fb[_0x2010('0x2c')]=_[_0x2010('0x2d')](_0x499cbe[_0x2010('0x2c')]);_0x5b52fb['filters']=_[_0x2010('0x2e')](_0x5b52fb[_0x2010('0x2f')],_0x5b52fb[_0x2010('0x2c')]);_0x52fe5e['attributes']=_['intersection'](_0x5b52fb[_0x2010('0x2f')],qs[_0x2010('0x30')](_0x499cbe[_0x2010('0x2c')]['fields']));_0x52fe5e['attributes']=_0x52fe5e[_0x2010('0x31')][_0x2010('0x32')]?_0x52fe5e[_0x2010('0x31')]:_0x5b52fb[_0x2010('0x2f')];if(!_0x499cbe[_0x2010('0x2c')]['hasOwnProperty']('nolimit')){_0x52fe5e['limit']=qs[_0x2010('0x1d')](_0x499cbe[_0x2010('0x2c')][_0x2010('0x1d')]);_0x52fe5e['offset']=qs[_0x2010('0x1b')](_0x499cbe[_0x2010('0x2c')][_0x2010('0x1b')]);}_0x52fe5e[_0x2010('0x33')]=qs['sort'](_0x499cbe[_0x2010('0x2c')][_0x2010('0x34')]);_0x52fe5e[_0x2010('0x35')]=qs['filters'](_[_0x2010('0x36')](_0x499cbe['query'],_0x5b52fb[_0x2010('0x37')]),_0xd16c04);if(_0x499cbe[_0x2010('0x2c')][_0x2010('0x38')]){_0x52fe5e[_0x2010('0x35')]=_[_0x2010('0x39')](_0x52fe5e[_0x2010('0x35')],{'$or':_['map'](_0xd16c04,function(_0x1e4460){if(_0x1e4460['type']!==_0x2010('0x3a')){var _0x157c73={};_0x157c73[_0x1e4460[_0x2010('0x26')]]={'$like':'%'+_0x499cbe[_0x2010('0x2c')][_0x2010('0x38')]+'%'};return _0x157c73;}})});}_0x52fe5e=_[_0x2010('0x39')]({},_0x52fe5e,_0x499cbe[_0x2010('0x3b')]);var _0x36ff3e={'where':_0x52fe5e[_0x2010('0x35')]};return db[_0x2010('0x3c')][_0x2010('0x1e')](_0x36ff3e)[_0x2010('0x22')](function(_0x1c2b13){_0x147a5a[_0x2010('0x1e')]=_0x1c2b13;if(_0x499cbe['query']['includeAll']){_0x52fe5e[_0x2010('0x3d')]=[{'all':!![]}];}return db[_0x2010('0x3c')][_0x2010('0x3e')](_0x52fe5e);})[_0x2010('0x22')](function(_0x3d5906){_0x147a5a[_0x2010('0x3f')]=_0x3d5906;return _0x147a5a;})[_0x2010('0x22')](respondWithFilteredResult(_0x2a4691,_0x52fe5e))['catch'](handleError(_0x2a4691,null));};exports[_0x2010('0x40')]=function(_0x578645,_0x27fd64){var _0x3ff496={'raw':![],'where':{'id':_0x578645[_0x2010('0x41')]['id']}},_0x16db82={};_0x16db82[_0x2010('0x2f')]=_['keys'](db[_0x2010('0x3c')][_0x2010('0x42')]);_0x16db82[_0x2010('0x2c')]=_[_0x2010('0x2d')](_0x578645['query']);_0x16db82[_0x2010('0x37')]=_['intersection'](_0x16db82['model'],_0x16db82['query']);_0x3ff496[_0x2010('0x31')]=_[_0x2010('0x2e')](_0x16db82[_0x2010('0x2f')],qs[_0x2010('0x30')](_0x578645[_0x2010('0x2c')][_0x2010('0x30')]));_0x3ff496['attributes']=_0x3ff496[_0x2010('0x31')][_0x2010('0x32')]?_0x3ff496[_0x2010('0x31')]:_0x16db82['model'];if(_0x578645['query'][_0x2010('0x43')]){_0x3ff496['include']=[{'all':!![]}];}_0x3ff496=_[_0x2010('0x39')]({},_0x3ff496,_0x578645[_0x2010('0x3b')]);return db[_0x2010('0x3c')][_0x2010('0x44')](_0x3ff496)['then'](handleEntityNotFound(_0x27fd64,null))[_0x2010('0x22')](respondWithResult(_0x27fd64,null))[_0x2010('0x45')](handleError(_0x27fd64,null));};exports[_0x2010('0x46')]=function(_0x231db7,_0x3ec24c){return db[_0x2010('0x3c')]['create'](_0x231db7[_0x2010('0x47')],{})[_0x2010('0x22')](respondWithResult(_0x3ec24c,0xc9))[_0x2010('0x45')](handleError(_0x3ec24c,null));};exports['update']=function(_0x30e5d0,_0x1dd027){if(_0x30e5d0['body']['id']){delete _0x30e5d0[_0x2010('0x47')]['id'];}return db[_0x2010('0x3c')][_0x2010('0x44')]({'where':{'id':_0x30e5d0[_0x2010('0x41')]['id']}})[_0x2010('0x22')](handleEntityNotFound(_0x1dd027,null))[_0x2010('0x22')](saveUpdates(_0x30e5d0[_0x2010('0x47')],null))[_0x2010('0x22')](respondWithResult(_0x1dd027,null))['catch'](handleError(_0x1dd027,null));};exports['destroy']=function(_0xc9f070,_0xe1721f){return db['ZendeskAccount'][_0x2010('0x44')]({'where':{'id':_0xc9f070[_0x2010('0x41')]['id']}})[_0x2010('0x22')](handleEntityNotFound(_0xe1721f,null))[_0x2010('0x22')](removeEntity(_0xe1721f,null))[_0x2010('0x45')](handleError(_0xe1721f,null));};exports['getConfigurations']=function(_0x5f4e98,_0x3fca06,_0x137452){var _0x4694e7={};var _0x3b89de={};var _0x38e596;var _0x2d8164;return db[_0x2010('0x3c')][_0x2010('0x48')]({'where':{'id':_0x5f4e98[_0x2010('0x41')]['id']}})[_0x2010('0x22')](handleEntityNotFound(_0x3fca06,null))[_0x2010('0x22')](function(_0x5313b5){if(_0x5313b5){_0x38e596=_0x5313b5;_0x3b89de[_0x2010('0x2f')]=_[_0x2010('0x2d')](db['ZendeskConfiguration'][_0x2010('0x42')]);_0x3b89de[_0x2010('0x2c')]=_[_0x2010('0x2d')](_0x5f4e98[_0x2010('0x2c')]);_0x3b89de[_0x2010('0x37')]=_[_0x2010('0x2e')](_0x3b89de[_0x2010('0x2f')],_0x3b89de[_0x2010('0x2c')]);_0x4694e7[_0x2010('0x31')]=_[_0x2010('0x2e')](_0x3b89de[_0x2010('0x2f')],qs[_0x2010('0x30')](_0x5f4e98[_0x2010('0x2c')][_0x2010('0x30')]));_0x4694e7[_0x2010('0x31')]=_0x4694e7[_0x2010('0x31')][_0x2010('0x32')]?_0x4694e7[_0x2010('0x31')]:_0x3b89de[_0x2010('0x2f')];_0x4694e7[_0x2010('0x33')]=qs[_0x2010('0x34')](_0x5f4e98[_0x2010('0x2c')][_0x2010('0x34')]);_0x4694e7['where']=qs[_0x2010('0x37')](_['pick'](_0x5f4e98['query'],_0x3b89de[_0x2010('0x37')]));if(_0x5f4e98[_0x2010('0x2c')]['filter']){_0x4694e7[_0x2010('0x35')]=_[_0x2010('0x39')](_0x4694e7[_0x2010('0x35')],{'$or':_[_0x2010('0x29')](_0x4694e7['attributes'],function(_0x3c6484){var _0x44816e={};_0x44816e[_0x3c6484]={'$like':'%'+_0x5f4e98[_0x2010('0x2c')][_0x2010('0x38')]+'%'};return _0x44816e;})});}_0x4694e7=_['merge']({},_0x4694e7,_0x5f4e98[_0x2010('0x3b')]);return _0x38e596['getConfigurations'](_0x4694e7);}})[_0x2010('0x22')](function(_0x2bc708){if(_0x2bc708){_0x2d8164=_0x2bc708[_0x2010('0x32')];if(!_0x5f4e98[_0x2010('0x2c')]['hasOwnProperty']('nolimit')){_0x4694e7[_0x2010('0x1d')]=qs[_0x2010('0x1d')](_0x5f4e98['query']['limit']);_0x4694e7[_0x2010('0x1b')]=qs[_0x2010('0x1b')](_0x5f4e98[_0x2010('0x2c')][_0x2010('0x1b')]);}return _0x38e596['getConfigurations'](_0x4694e7);}})[_0x2010('0x22')](function(_0x5a2c7e){if(_0x5a2c7e){return _0x5a2c7e?{'count':_0x2d8164,'rows':_0x5a2c7e}:null;}})[_0x2010('0x22')](respondWithResult(_0x3fca06,null))[_0x2010('0x45')](handleError(_0x3fca06,null));};exports[_0x2010('0x49')]=function(_0x1d81e1,_0x4bde43,_0x340882){if(_0x1d81e1[_0x2010('0x47')]['id']){delete _0x1d81e1['body']['id'];}return db[_0x2010('0x3c')][_0x2010('0x48')]({'where':{'id':_0x1d81e1[_0x2010('0x41')]['id']}})[_0x2010('0x22')](handleEntityNotFound(_0x4bde43,null))[_0x2010('0x22')](function(_0x8df400){if(_0x8df400){_0x1d81e1[_0x2010('0x47')][_0x2010('0x4a')]=_0x8df400['id'];_0x1d81e1[_0x2010('0x47')][_0x2010('0x4b')]=integrations[_0x2010('0x4c')](_0x1d81e1[_0x2010('0x47')]['channel'],_0x1d81e1[_0x2010('0x47')][_0x2010('0x2a')]);_0x1d81e1[_0x2010('0x47')]['Descriptions']=integrations['getDescriptions'](_0x1d81e1[_0x2010('0x47')][_0x2010('0x4d')],_0x1d81e1[_0x2010('0x47')][_0x2010('0x2a')]);return db[_0x2010('0x4e')][_0x2010('0x46')](_0x1d81e1['body'],{'include':[{'model':db[_0x2010('0x4f')],'as':_0x2010('0x4b')},{'model':db[_0x2010('0x4f')],'as':'Descriptions'}]});}return null;})[_0x2010('0x22')](respondWithResult(_0x4bde43,null))[_0x2010('0x45')](handleError(_0x4bde43,null));};exports[_0x2010('0x50')]=function(_0x5182b2,_0x20dea1,_0x22f654){var _0x4adc1c='';return db['ZendeskAccount'][_0x2010('0x48')]({'where':{'id':_0x5182b2['params']['id']},'attributes':['id','username',_0x2010('0x51'),_0x2010('0x52'),_0x2010('0x53'),_0x2010('0x54')]})[_0x2010('0x22')](handleEntityNotFound(_0x20dea1,null))[_0x2010('0x22')](function(_0xdf6767){if(_0xdf6767){_0x4adc1c=_0xdf6767[_0x2010('0x54')];var _0xee7084=_0x4adc1c[_0x2010('0x55')](-0x1);if(_0xee7084==='/'){_0x4adc1c=_0x4adc1c['substring'](0x0,_0x4adc1c[_0x2010('0x56')](_0xee7084));}var _0x1c1373={'method':'GET','uri':util[_0x2010('0x57')](_0x2010('0x58'),_0x4adc1c,_0x2010('0x59')),'json':!![]};switch(_0xdf6767[_0x2010('0x53')]){case'password':_0x1c1373[_0x2010('0x5a')]={'Authorization':util[_0x2010('0x57')]('Basic\x20%s',new Buffer(util['format'](_0x2010('0x5b'),_0xdf6767['username'],_0xdf6767[_0x2010('0x51')]))[_0x2010('0x5c')](_0x2010('0x5d')))};break;case _0x2010('0x52'):_0x1c1373[_0x2010('0x5a')]={'Authorization':util[_0x2010('0x57')](_0x2010('0x5e'),new Buffer(util['format'](_0x2010('0x5f'),_0xdf6767[_0x2010('0x60')],_0xdf6767[_0x2010('0x52')]))['toString'](_0x2010('0x5d')))};break;default:throw new db[(_0x2010('0x61'))][(_0x2010('0x62'))](_0x2010('0x63'));}return rp(_0x1c1373);}})[_0x2010('0x22')](function(_0x41c3cc){if(_0x41c3cc){var _0x40885b=[_0x2010('0x64'),'description',_0x2010('0x65'),_0x2010('0x66')];_[_0x2010('0x67')](_0x41c3cc['ticket_fields'],function(_0xb6ba3f){return _0x40885b[_0x2010('0x68')](_0xb6ba3f['type']);});return{'count':_0x41c3cc[_0x2010('0x59')][_0x2010('0x32')],'rows':_[_0x2010('0x29')](_0x41c3cc[_0x2010('0x59')],function(_0x38e733){return{'id':_0x38e733['id'],'name':_0x38e733['position']>0x7?_0x38e733[_0x2010('0x69')]:_0x38e733[_0x2010('0x2a')],'custom':_0x38e733['position']>0x7?!![]:![],'options':_0x38e733[_0x2010('0x6a')]?_0x38e733[_0x2010('0x6a')]:_0x38e733['custom_field_options']?_0x38e733[_0x2010('0x6b')]:[]};})};}})['then'](respondWithResult(_0x20dea1,null))['catch'](function(_0x44e47e){var _0x17f7c5=_0x5182b2[_0x2010('0x2c')][_0x2010('0x6c')]?0x1f4:_0x44e47e[_0x2010('0x6d')]||0x1f4;logger[_0x2010('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x2010('0x50'),_0x17f7c5,JSON[_0x2010('0x6e')](_0x44e47e));delete _0x44e47e[_0x2010('0x26')];if(_0x17f7c5===0x191){_0x17f7c5=0x190;}_0x20dea1[_0x2010('0x19')](_0x17f7c5)['send'](_0x5182b2[_0x2010('0x2c')]['test']?{'message':_0x2010('0x6f'),'statusCode':_0x44e47e[_0x2010('0x6d')]}:_0x44e47e);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 1b6b9b3..571e8c3 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 _0x7a8e=['define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0xdb5036,_0x914c61){var _0x58fb12=function(_0x5deae1){while(--_0x5deae1){_0xdb5036['push'](_0xdb5036['shift']());}};_0x58fb12(++_0x914c61);}(_0x7a8e,0x139));var _0xe7a8=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0x7a8e[_0x396466];return _0x5e9ab4;};'use strict';var _=require(_0xe7a8('0x0'));var util=require(_0xe7a8('0x1'));var logger=require(_0xe7a8('0x2'))(_0xe7a8('0x3'));var moment=require(_0xe7a8('0x4'));var BPromise=require(_0xe7a8('0x5'));var rp=require(_0xe7a8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe7a8('0x7'));var config=require(_0xe7a8('0x8'));var attributes=require(_0xe7a8('0x9'));var integrations=require(_0xe7a8('0xa'));module[_0xe7a8('0xb')]=function(_0x34e38a,_0x576787){return _0x34e38a[_0xe7a8('0xc')]('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3dd8=['int_zendesk_accounts','lodash','util','../../config/logger','bluebird','request-promise','rimraf','exports','define','ZendeskAccount'];(function(_0x312359,_0x2c41a4){var _0x306241=function(_0x137026){while(--_0x137026){_0x312359['push'](_0x312359['shift']());}};_0x306241(++_0x2c41a4);}(_0x3dd8,0x1c3));var _0x83dd=function(_0x2e031a,_0x27c856){_0x2e031a=_0x2e031a-0x0;var _0x5249be=_0x3dd8[_0x2e031a];return _0x5249be;};'use strict';var _=require(_0x83dd('0x0'));var util=require(_0x83dd('0x1'));var logger=require(_0x83dd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x83dd('0x3'));var rp=require(_0x83dd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x83dd('0x5'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x83dd('0x6')]=function(_0x505c0a,_0x55c63d){return _0x505c0a[_0x83dd('0x7')](_0x83dd('0x8'),attributes,{'tableName':_0x83dd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 712bfe9..e0f8f91 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 _0x72d6=['../../config/environment','client','http','then','info','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','ZendeskAccount','findAll','raw','options','attributes','include','map','model','GetZendeskAccount','debug','ShowZendeskAccount','find','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x52e3b5,_0x3f7471){var _0x8934a2=function(_0x53c1ef){while(--_0x53c1ef){_0x52e3b5['push'](_0x52e3b5['shift']());}};_0x8934a2(++_0x3f7471);}(_0x72d6,0x1bf));var _0x672d=function(_0x4c55ba,_0x542e34){_0x4c55ba=_0x4c55ba-0x0;var _0x5ac408=_0x72d6[_0x4c55ba];return _0x5ac408;};'use strict';var _=require(_0x672d('0x0'));var util=require(_0x672d('0x1'));var moment=require(_0x672d('0x2'));var BPromise=require('bluebird');var rs=require(_0x672d('0x3'));var fs=require('fs');var Redis=require(_0x672d('0x4'));var db=require(_0x672d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x672d('0x6'))(_0x672d('0x7'));var config=require(_0x672d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x672d('0x9')][_0x672d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x189dcf,_0x41e327,_0x6899e3){return new BPromise(function(_0xee82f8,_0x21c534){return client['request'](_0x189dcf,_0x6899e3)[_0x672d('0xb')](function(_0x588f93){logger[_0x672d('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0x41e327,_0x672d('0xd'));logger['debug'](_0x672d('0xe'),_0x41e327,_0x672d('0xd'),JSON[_0x672d('0xf')](_0x588f93));if(_0x588f93[_0x672d('0x10')]){if(_0x588f93['error'][_0x672d('0x11')]===0x1f4){logger[_0x672d('0x10')](_0x672d('0x12'),_0x41e327,_0x588f93['error'][_0x672d('0x13')]);return _0x21c534(_0x588f93[_0x672d('0x10')]['message']);}logger[_0x672d('0x10')](_0x672d('0x12'),_0x41e327,_0x588f93[_0x672d('0x10')]['message']);return _0xee82f8(_0x588f93['error'][_0x672d('0x13')]);}else{logger[_0x672d('0xc')](_0x672d('0x12'),_0x41e327,_0x672d('0xd'));_0xee82f8(_0x588f93[_0x672d('0x14')][_0x672d('0x13')]);}})[_0x672d('0x15')](function(_0x316ffb){logger[_0x672d('0x10')](_0x672d('0x12'),_0x41e327,_0x316ffb);_0x21c534(_0x316ffb);});});}exports['GetZendeskAccount']=function(_0x32b9e1){var _0x41e635=this;return new Promise(function(_0x308458,_0x5d40d8){return db[_0x672d('0x16')][_0x672d('0x17')]({'raw':_0x32b9e1['options']?_0x32b9e1['options'][_0x672d('0x18')]===undefined?!![]:![]:!![],'where':_0x32b9e1[_0x672d('0x19')]?_0x32b9e1['options']['where']||null:null,'attributes':_0x32b9e1[_0x672d('0x19')]?_0x32b9e1['options'][_0x672d('0x1a')]||null:null,'limit':_0x32b9e1[_0x672d('0x19')]?_0x32b9e1[_0x672d('0x19')]['limit']||null:null,'include':_0x32b9e1['options']?_0x32b9e1['options'][_0x672d('0x1b')]?_[_0x672d('0x1c')](_0x32b9e1['options'][_0x672d('0x1b')],function(_0x5625b5){return{'model':db[_0x5625b5[_0x672d('0x1d')]],'as':_0x5625b5['as'],'attributes':_0x5625b5[_0x672d('0x1a')],'include':_0x5625b5['include']?_['map'](_0x5625b5['include'],function(_0x1aa0b8){return{'model':db[_0x1aa0b8[_0x672d('0x1d')]],'as':_0x1aa0b8['as'],'attributes':_0x1aa0b8[_0x672d('0x1a')],'include':_0x1aa0b8[_0x672d('0x1b')]?_['map'](_0x1aa0b8[_0x672d('0x1b')],function(_0x3ff514){return{'model':db[_0x3ff514[_0x672d('0x1d')]],'as':_0x3ff514['as'],'attributes':_0x3ff514[_0x672d('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a92ce){logger[_0x672d('0xc')](_0x672d('0x1e'),_0x32b9e1);logger[_0x672d('0x1f')](_0x672d('0x1e'),_0x32b9e1,JSON[_0x672d('0xf')](_0x3a92ce));_0x308458(_0x3a92ce);})[_0x672d('0x15')](function(_0x5a156f){logger[_0x672d('0x10')](_0x672d('0x1e'),_0x5a156f[_0x672d('0x13')],_0x32b9e1);_0x5d40d8(_0x41e635['error'](0x1f4,_0x5a156f[_0x672d('0x13')]));});});};exports[_0x672d('0x20')]=function(_0x28acee){var _0x44b9d9=this;return new Promise(function(_0x594f36,_0x189dd0){return db[_0x672d('0x16')][_0x672d('0x21')]({'raw':_0x28acee[_0x672d('0x19')]?_0x28acee[_0x672d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x28acee[_0x672d('0x19')]?_0x28acee[_0x672d('0x19')][_0x672d('0x22')]||null:null,'attributes':_0x28acee[_0x672d('0x19')]?_0x28acee[_0x672d('0x19')]['attributes']||null:null,'include':_0x28acee[_0x672d('0x19')]?_0x28acee['options'][_0x672d('0x1b')]?_['map'](_0x28acee['options']['include'],function(_0x4b0003){return{'model':db[_0x4b0003[_0x672d('0x1d')]],'as':_0x4b0003['as'],'attributes':_0x4b0003['attributes'],'include':_0x4b0003[_0x672d('0x1b')]?_[_0x672d('0x1c')](_0x4b0003[_0x672d('0x1b')],function(_0x5559d9){return{'model':db[_0x5559d9[_0x672d('0x1d')]],'as':_0x5559d9['as'],'attributes':_0x5559d9[_0x672d('0x1a')],'include':_0x5559d9[_0x672d('0x1b')]?_[_0x672d('0x1c')](_0x5559d9[_0x672d('0x1b')],function(_0x5bacf8){return{'model':db[_0x5bacf8['model']],'as':_0x5bacf8['as'],'attributes':_0x5bacf8[_0x672d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x672d('0xb')](function(_0x22c9cf){logger['info'](_0x672d('0x20'),_0x28acee);logger[_0x672d('0x1f')](_0x672d('0x20'),_0x28acee,JSON['stringify'](_0x22c9cf));_0x594f36(_0x22c9cf);})[_0x672d('0x15')](function(_0x472313){logger[_0x672d('0x10')]('ShowZendeskAccount',_0x472313['message'],_0x28acee);_0x189dd0(_0x44b9d9[_0x672d('0x10')](0x1f4,_0x472313[_0x672d('0x13')]));});});}; \ No newline at end of file +var _0xcc76=['ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowZendeskAccount','find','lodash','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','http','request','then','info'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xcc76,0x78));var _0x6cc7=function(_0x4cd4f8,_0x1f7438){_0x4cd4f8=_0x4cd4f8-0x0;var _0x5a736f=_0xcc76[_0x4cd4f8];return _0x5a736f;};'use strict';var _=require(_0x6cc7('0x0'));var util=require('util');var moment=require(_0x6cc7('0x1'));var BPromise=require(_0x6cc7('0x2'));var rs=require(_0x6cc7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6cc7('0x4'));var logger=require('../../config/logger')(_0x6cc7('0x5'));var config=require('../../config/environment');var jayson=require(_0x6cc7('0x6'));var client=jayson[_0x6cc7('0x7')][_0x6cc7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b9f2c,_0x540321,_0x435cdc){return new BPromise(function(_0x1869d2,_0x10c735){return client[_0x6cc7('0x9')](_0x1b9f2c,_0x435cdc)[_0x6cc7('0xa')](function(_0x470819){logger[_0x6cc7('0xb')](_0x6cc7('0xc'),_0x540321,_0x6cc7('0xd'));logger[_0x6cc7('0xe')](_0x6cc7('0xf'),_0x540321,_0x6cc7('0xd'),JSON[_0x6cc7('0x10')](_0x470819));if(_0x470819[_0x6cc7('0x11')]){if(_0x470819['error'][_0x6cc7('0x12')]===0x1f4){logger[_0x6cc7('0x11')](_0x6cc7('0xc'),_0x540321,_0x470819['error'][_0x6cc7('0x13')]);return _0x10c735(_0x470819[_0x6cc7('0x11')][_0x6cc7('0x13')]);}logger[_0x6cc7('0x11')](_0x6cc7('0xc'),_0x540321,_0x470819[_0x6cc7('0x11')]['message']);return _0x1869d2(_0x470819['error']['message']);}else{logger[_0x6cc7('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x540321,_0x6cc7('0xd'));_0x1869d2(_0x470819['result']['message']);}})['catch'](function(_0x429404){logger[_0x6cc7('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x540321,_0x429404);_0x10c735(_0x429404);});});}exports[_0x6cc7('0x14')]=function(_0x1e0e30){var _0x132932=this;return new Promise(function(_0xb90b75,_0x301b00){return db['ZendeskAccount'][_0x6cc7('0x15')]({'raw':_0x1e0e30[_0x6cc7('0x16')]?_0x1e0e30[_0x6cc7('0x16')][_0x6cc7('0x17')]===undefined?!![]:![]:!![],'where':_0x1e0e30['options']?_0x1e0e30['options'][_0x6cc7('0x18')]||null:null,'attributes':_0x1e0e30[_0x6cc7('0x16')]?_0x1e0e30['options'][_0x6cc7('0x19')]||null:null,'limit':_0x1e0e30[_0x6cc7('0x16')]?_0x1e0e30[_0x6cc7('0x16')][_0x6cc7('0x1a')]||null:null,'include':_0x1e0e30[_0x6cc7('0x16')]?_0x1e0e30['options'][_0x6cc7('0x1b')]?_[_0x6cc7('0x1c')](_0x1e0e30['options']['include'],function(_0x345434){return{'model':db[_0x345434['model']],'as':_0x345434['as'],'attributes':_0x345434[_0x6cc7('0x19')],'include':_0x345434['include']?_[_0x6cc7('0x1c')](_0x345434[_0x6cc7('0x1b')],function(_0x511e10){return{'model':db[_0x511e10[_0x6cc7('0x1d')]],'as':_0x511e10['as'],'attributes':_0x511e10[_0x6cc7('0x19')],'include':_0x511e10[_0x6cc7('0x1b')]?_[_0x6cc7('0x1c')](_0x511e10[_0x6cc7('0x1b')],function(_0x525fa3){return{'model':db[_0x525fa3[_0x6cc7('0x1d')]],'as':_0x525fa3['as'],'attributes':_0x525fa3[_0x6cc7('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6cc7('0xa')](function(_0x3e1d5d){logger[_0x6cc7('0xb')](_0x6cc7('0x14'),_0x1e0e30);logger[_0x6cc7('0xe')](_0x6cc7('0x14'),_0x1e0e30,JSON[_0x6cc7('0x10')](_0x3e1d5d));_0xb90b75(_0x3e1d5d);})[_0x6cc7('0x1e')](function(_0x5eec96){logger['error'](_0x6cc7('0x14'),_0x5eec96[_0x6cc7('0x13')],_0x1e0e30);_0x301b00(_0x132932['error'](0x1f4,_0x5eec96[_0x6cc7('0x13')]));});});};exports[_0x6cc7('0x1f')]=function(_0x5eb7c5){var _0x1cdac3=this;return new Promise(function(_0x5c7676,_0x34af6c){return db['ZendeskAccount'][_0x6cc7('0x20')]({'raw':_0x5eb7c5[_0x6cc7('0x16')]?_0x5eb7c5[_0x6cc7('0x16')][_0x6cc7('0x17')]===undefined?!![]:![]:!![],'where':_0x5eb7c5['options']?_0x5eb7c5[_0x6cc7('0x16')][_0x6cc7('0x18')]||null:null,'attributes':_0x5eb7c5[_0x6cc7('0x16')]?_0x5eb7c5['options'][_0x6cc7('0x19')]||null:null,'include':_0x5eb7c5[_0x6cc7('0x16')]?_0x5eb7c5[_0x6cc7('0x16')]['include']?_[_0x6cc7('0x1c')](_0x5eb7c5[_0x6cc7('0x16')]['include'],function(_0x2a52e5){return{'model':db[_0x2a52e5[_0x6cc7('0x1d')]],'as':_0x2a52e5['as'],'attributes':_0x2a52e5[_0x6cc7('0x19')],'include':_0x2a52e5[_0x6cc7('0x1b')]?_[_0x6cc7('0x1c')](_0x2a52e5[_0x6cc7('0x1b')],function(_0x35cae4){return{'model':db[_0x35cae4[_0x6cc7('0x1d')]],'as':_0x35cae4['as'],'attributes':_0x35cae4[_0x6cc7('0x19')],'include':_0x35cae4[_0x6cc7('0x1b')]?_[_0x6cc7('0x1c')](_0x35cae4[_0x6cc7('0x1b')],function(_0x1fd076){return{'model':db[_0x1fd076[_0x6cc7('0x1d')]],'as':_0x1fd076['as'],'attributes':_0x1fd076[_0x6cc7('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6cc7('0xa')](function(_0x5ef1d2){logger[_0x6cc7('0xb')](_0x6cc7('0x1f'),_0x5eb7c5);logger[_0x6cc7('0xe')](_0x6cc7('0x1f'),_0x5eb7c5,JSON[_0x6cc7('0x10')](_0x5ef1d2));_0x5c7676(_0x5ef1d2);})[_0x6cc7('0x1e')](function(_0x14f353){logger['error'](_0x6cc7('0x1f'),_0x14f353['message'],_0x5eb7c5);_0x34af6c(_0x1cdac3[_0x6cc7('0x11')](0x1f4,_0x14f353[_0x6cc7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index fd4bb25..619c475 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 _0xbdb7=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','index','get','show','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getTags','/:id/tags','update','delete','/:id'];(function(_0x3bef2c,_0x5a86fd){var _0x331503=function(_0x463430){while(--_0x463430){_0x3bef2c['push'](_0x3bef2c['shift']());}};_0x331503(++_0x5a86fd);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x3b2f12,_0x1e7128){_0x3b2f12=_0x3b2f12-0x0;var _0x36a818=_0xbdb7[_0x3b2f12];return _0x36a818;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xb')](_0x7bdb('0xe'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0xb')](_0x7bdb('0x11'),auth[_0x7bdb('0xf')](),controller['getDescriptions']);router['get']('/:id/tags',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x12')]);router['post']('/',auth[_0x7bdb('0xf')](),controller['create']);router['post'](_0x7bdb('0x13'),auth[_0x7bdb('0xf')](),controller['setTags']);router['put']('/:id',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x14')]);router[_0x7bdb('0x15')](_0x7bdb('0x16'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x17')]);module[_0x7bdb('0x18')]=router; \ No newline at end of file +var _0xbaf0=['isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get'];(function(_0x1f9d53,_0x224330){var _0x531072=function(_0x31ac5f){while(--_0x31ac5f){_0x1f9d53['push'](_0x1f9d53['shift']());}};_0x531072(++_0x224330);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0x9')]('/:id/fields',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0x9')](_0x0baf('0xe'),auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x9')](_0x0baf('0x10'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x11')]);router[_0x0baf('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0x14')]);router['post'](_0x0baf('0x15'),auth['isAuthenticated'](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);module[_0x0baf('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 c35c72d..c783741 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 _0x5fa7=['exports','STRING','sequelize'];(function(_0x1d8a68,_0x26dd4c){var _0x362b32=function(_0x556e52){while(--_0x556e52){_0x1d8a68['push'](_0x1d8a68['shift']());}};_0x362b32(++_0x26dd4c);}(_0x5fa7,0x161));var _0x75fa=function(_0x49a019,_0x5be224){_0x49a019=_0x49a019-0x0;var _0x26d586=_0x5fa7[_0x49a019];return _0x26d586;};'use strict';var Sequelize=require(_0x75fa('0x0'));module[_0x75fa('0x1')]={'name':{'type':Sequelize[_0x75fa('0x2')]},'description':{'type':Sequelize[_0x75fa('0x2')]}}; \ No newline at end of file +var _0xe63d=['sequelize','exports','STRING'];(function(_0x2375e1,_0x3d125a){var _0x2ccc7d=function(_0x343bb6){while(--_0x343bb6){_0x2375e1['push'](_0x2375e1['shift']());}};_0x2ccc7d(++_0x3d125a);}(_0xe63d,0x84));var _0xde63=function(_0x1ff2ec,_0x386e86){_0x1ff2ec=_0x1ff2ec-0x0;var _0x405683=_0xe63d[_0x1ff2ec];return _0x405683;};'use strict';var Sequelize=require(_0xde63('0x0'));module[_0xde63('0x1')]={'name':{'type':Sequelize[_0xde63('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index d3498b4..4c96d36 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 _0x8544=['to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','ZendeskConfiguration','fieldName','type','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','catch','params','keys','rawAttributes','create','body','find','ZendeskField','pick','getFields','nolimit','getSubjects','findOne','getDescriptions','Tag','getTags','setTags','ids','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox'];(function(_0x18b2e9,_0x3d3f7e){var _0x41aee4=function(_0x5f1b00){while(--_0x5f1b00){_0x18b2e9['push'](_0x18b2e9['shift']());}};_0x41aee4(++_0x3d3f7e);}(_0x8544,0x9c));var _0x4854=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x8544[_0x4e9d3c];return _0x2d0825;};'use strict';var emlformat=require(_0x4854('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4854('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4854('0x2'));var moment=require(_0x4854('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4854('0x4'));var util=require(_0x4854('0x5'));var path=require(_0x4854('0x6'));var sox=require(_0x4854('0x7'));var csv=require(_0x4854('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4854('0x9'));var _=require(_0x4854('0xa'));var squel=require(_0x4854('0xb'));var crypto=require(_0x4854('0xc'));var jsforce=require(_0x4854('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4854('0xe'));var Redis=require(_0x4854('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4854('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4854('0x11'));var utils=require(_0x4854('0x12'));var config=require(_0x4854('0x13'));var licenseUtil=require(_0x4854('0x14'));var db=require(_0x4854('0x15'))['db'];function respondWithStatusCode(_0x32e48b,_0x296fee){_0x296fee=_0x296fee||0xcc;return function(_0x243bb0){if(_0x243bb0){return _0x32e48b['sendStatus'](_0x296fee);}return _0x32e48b[_0x4854('0x16')](_0x296fee)[_0x4854('0x17')]();};}function respondWithResult(_0x1ec3a7,_0x228d86){_0x228d86=_0x228d86||0xc8;return function(_0x1944d9){if(_0x1944d9){return _0x1ec3a7[_0x4854('0x16')](_0x228d86)['json'](_0x1944d9);}};}function respondWithFilteredResult(_0x21edc3,_0x3dac78){return function(_0x131b5e){if(_0x131b5e){var _0x43bdad=typeof _0x3dac78[_0x4854('0x18')]==='undefined'&&typeof _0x3dac78['limit']===_0x4854('0x19');var _0x5b953e=_0x131b5e[_0x4854('0x1a')];var _0xa4d392=_0x43bdad?0x0:_0x3dac78[_0x4854('0x18')];var _0x57dc3c=_0x43bdad?_0x131b5e[_0x4854('0x1a')]:_0x3dac78[_0x4854('0x18')]+_0x3dac78[_0x4854('0x1b')];var _0x36f5d5;if(_0x57dc3c>=_0x5b953e){_0x57dc3c=_0x5b953e;_0x36f5d5=0xc8;}else{_0x36f5d5=0xce;}_0x21edc3[_0x4854('0x16')](_0x36f5d5);return _0x21edc3[_0x4854('0x1c')]('Content-Range',_0xa4d392+'-'+_0x57dc3c+'/'+_0x5b953e)[_0x4854('0x1d')](_0x131b5e);}return null;};}function patchUpdates(_0x4d04e6){return function(_0x3888df){try{jsonpatch[_0x4854('0x1e')](_0x3888df,_0x4d04e6,!![]);}catch(_0x578ad8){return BPromise[_0x4854('0x1f')](_0x578ad8);}return _0x3888df[_0x4854('0x20')]();};}function saveUpdates(_0x377f4b,_0x1d2269){return function(_0x27ad6e){if(_0x27ad6e){return _0x27ad6e[_0x4854('0x21')](_0x377f4b)[_0x4854('0x22')](function(_0x132a0a){return _0x132a0a;});}return null;};}function removeEntity(_0x3cec41,_0x58d1bb){return function(_0x573f6c){if(_0x573f6c){return _0x573f6c[_0x4854('0x23')]()['then'](function(){_0x3cec41[_0x4854('0x16')](0xcc)[_0x4854('0x17')]();});}};}function handleEntityNotFound(_0x4898a4,_0x184245){return function(_0x21a3b3){if(!_0x21a3b3){_0x4898a4[_0x4854('0x24')](0x194);}return _0x21a3b3;};}function handleError(_0x52c629,_0x4b2d52){_0x4b2d52=_0x4b2d52||0x1f4;return function(_0x1e3da2){logger[_0x4854('0x25')](_0x1e3da2[_0x4854('0x26')]);if(_0x1e3da2[_0x4854('0x27')]){delete _0x1e3da2['name'];}_0x52c629[_0x4854('0x16')](_0x4b2d52)[_0x4854('0x28')](_0x1e3da2);};}exports[_0x4854('0x29')]=function(_0x61b02c,_0x4da741){var _0x5419a3={},_0x2a072f={},_0x50b52b={'count':0x0,'rows':[]};var _0xd3e4a4=_['map'](db[_0x4854('0x2a')]['rawAttributes'],function(_0xa32267){return{'name':_0xa32267[_0x4854('0x2b')],'type':_0xa32267[_0x4854('0x2c')][_0x4854('0x2d')]};});_0x2a072f[_0x4854('0x2e')]=_[_0x4854('0x2f')](_0xd3e4a4,_0x4854('0x27'));_0x2a072f[_0x4854('0x30')]=_['keys'](_0x61b02c['query']);_0x2a072f['filters']=_['intersection'](_0x2a072f[_0x4854('0x2e')],_0x2a072f['query']);_0x5419a3[_0x4854('0x31')]=_[_0x4854('0x32')](_0x2a072f[_0x4854('0x2e')],qs[_0x4854('0x33')](_0x61b02c[_0x4854('0x30')]['fields']));_0x5419a3[_0x4854('0x31')]=_0x5419a3[_0x4854('0x31')][_0x4854('0x34')]?_0x5419a3['attributes']:_0x2a072f['model'];if(!_0x61b02c[_0x4854('0x30')][_0x4854('0x35')]('nolimit')){_0x5419a3[_0x4854('0x1b')]=qs[_0x4854('0x1b')](_0x61b02c[_0x4854('0x30')][_0x4854('0x1b')]);_0x5419a3[_0x4854('0x18')]=qs[_0x4854('0x18')](_0x61b02c['query'][_0x4854('0x18')]);}_0x5419a3[_0x4854('0x36')]=qs[_0x4854('0x37')](_0x61b02c[_0x4854('0x30')][_0x4854('0x37')]);_0x5419a3[_0x4854('0x38')]=qs[_0x4854('0x39')](_['pick'](_0x61b02c[_0x4854('0x30')],_0x2a072f[_0x4854('0x39')]),_0xd3e4a4);if(_0x61b02c[_0x4854('0x30')][_0x4854('0x3a')]){_0x5419a3['where']=_[_0x4854('0x3b')](_0x5419a3[_0x4854('0x38')],{'$or':_[_0x4854('0x2f')](_0xd3e4a4,function(_0x18b719){if(_0x18b719[_0x4854('0x2c')]!=='VIRTUAL'){var _0x21f4b1={};_0x21f4b1[_0x18b719[_0x4854('0x27')]]={'$like':'%'+_0x61b02c[_0x4854('0x30')][_0x4854('0x3a')]+'%'};return _0x21f4b1;}})});}_0x5419a3=_[_0x4854('0x3b')]({},_0x5419a3,_0x61b02c[_0x4854('0x3c')]);var _0x1f34ee={'where':_0x5419a3[_0x4854('0x38')]};return db[_0x4854('0x2a')][_0x4854('0x1a')](_0x1f34ee)['then'](function(_0x157666){_0x50b52b[_0x4854('0x1a')]=_0x157666;if(_0x61b02c[_0x4854('0x30')][_0x4854('0x3d')]){_0x5419a3[_0x4854('0x3e')]=[{'all':!![]}];}return db[_0x4854('0x2a')][_0x4854('0x3f')](_0x5419a3);})['then'](function(_0x9d63c5){_0x50b52b['rows']=_0x9d63c5;return _0x50b52b;})[_0x4854('0x22')](respondWithFilteredResult(_0x4da741,_0x5419a3))[_0x4854('0x40')](handleError(_0x4da741,null));};exports['show']=function(_0x1f4935,_0x256b32){var _0x43c03d={'raw':![],'where':{'id':_0x1f4935[_0x4854('0x41')]['id']}},_0x5a202b={};_0x5a202b[_0x4854('0x2e')]=_[_0x4854('0x42')](db[_0x4854('0x2a')][_0x4854('0x43')]);_0x5a202b[_0x4854('0x30')]=_[_0x4854('0x42')](_0x1f4935[_0x4854('0x30')]);_0x5a202b[_0x4854('0x39')]=_[_0x4854('0x32')](_0x5a202b[_0x4854('0x2e')],_0x5a202b[_0x4854('0x30')]);_0x43c03d[_0x4854('0x31')]=_[_0x4854('0x32')](_0x5a202b[_0x4854('0x2e')],qs[_0x4854('0x33')](_0x1f4935[_0x4854('0x30')][_0x4854('0x33')]));_0x43c03d[_0x4854('0x31')]=_0x43c03d[_0x4854('0x31')]['length']?_0x43c03d[_0x4854('0x31')]:_0x5a202b['model'];if(_0x1f4935['query'][_0x4854('0x3d')]){_0x43c03d[_0x4854('0x3e')]=[{'all':!![]}];}_0x43c03d=_['merge']({},_0x43c03d,_0x1f4935[_0x4854('0x3c')]);return db['ZendeskConfiguration']['find'](_0x43c03d)[_0x4854('0x22')](handleEntityNotFound(_0x256b32,null))[_0x4854('0x22')](respondWithResult(_0x256b32,null))[_0x4854('0x40')](handleError(_0x256b32,null));};exports['create']=function(_0x5e9924,_0x12b190){return db[_0x4854('0x2a')][_0x4854('0x44')](_0x5e9924['body'],{})[_0x4854('0x22')](respondWithResult(_0x12b190,0xc9))['catch'](handleError(_0x12b190,null));};exports[_0x4854('0x21')]=function(_0x11aa3a,_0x5c5cec){if(_0x11aa3a['body']['id']){delete _0x11aa3a[_0x4854('0x45')]['id'];}return db[_0x4854('0x2a')][_0x4854('0x46')]({'where':{'id':_0x11aa3a[_0x4854('0x41')]['id']}})['then'](handleEntityNotFound(_0x5c5cec,null))[_0x4854('0x22')](saveUpdates(_0x11aa3a[_0x4854('0x45')],null))['then'](respondWithResult(_0x5c5cec,null))[_0x4854('0x40')](handleError(_0x5c5cec,null));};exports['destroy']=function(_0x261685,_0x49fba7){return db['ZendeskConfiguration'][_0x4854('0x46')]({'where':{'id':_0x261685[_0x4854('0x41')]['id']}})['then'](handleEntityNotFound(_0x49fba7,null))[_0x4854('0x22')](removeEntity(_0x49fba7,null))['catch'](handleError(_0x49fba7,null));};exports['getFields']=function(_0x2c5dd6,_0x5e93c7,_0x1e78a6){var _0x2959c4={};var _0x18227e={};var _0x192c76;var _0x130bc3;return db[_0x4854('0x2a')]['findOne']({'where':{'id':_0x2c5dd6[_0x4854('0x41')]['id']}})[_0x4854('0x22')](handleEntityNotFound(_0x5e93c7,null))[_0x4854('0x22')](function(_0x286cb8){if(_0x286cb8){_0x192c76=_0x286cb8;_0x18227e[_0x4854('0x2e')]=_['keys'](db[_0x4854('0x47')][_0x4854('0x43')]);_0x18227e[_0x4854('0x30')]=_['keys'](_0x2c5dd6[_0x4854('0x30')]);_0x18227e[_0x4854('0x39')]=_[_0x4854('0x32')](_0x18227e[_0x4854('0x2e')],_0x18227e[_0x4854('0x30')]);_0x2959c4['attributes']=_[_0x4854('0x32')](_0x18227e[_0x4854('0x2e')],qs[_0x4854('0x33')](_0x2c5dd6[_0x4854('0x30')][_0x4854('0x33')]));_0x2959c4[_0x4854('0x31')]=_0x2959c4[_0x4854('0x31')][_0x4854('0x34')]?_0x2959c4['attributes']:_0x18227e[_0x4854('0x2e')];_0x2959c4[_0x4854('0x36')]=qs[_0x4854('0x37')](_0x2c5dd6[_0x4854('0x30')][_0x4854('0x37')]);_0x2959c4[_0x4854('0x38')]=qs[_0x4854('0x39')](_[_0x4854('0x48')](_0x2c5dd6[_0x4854('0x30')],_0x18227e[_0x4854('0x39')]));if(_0x2c5dd6[_0x4854('0x30')][_0x4854('0x3a')]){_0x2959c4[_0x4854('0x38')]=_[_0x4854('0x3b')](_0x2959c4['where'],{'$or':_['map'](_0x2959c4[_0x4854('0x31')],function(_0x42b2a9){var _0x1812f9={};_0x1812f9[_0x42b2a9]={'$like':'%'+_0x2c5dd6[_0x4854('0x30')][_0x4854('0x3a')]+'%'};return _0x1812f9;})});}_0x2959c4=_[_0x4854('0x3b')]({},_0x2959c4,_0x2c5dd6[_0x4854('0x3c')]);return _0x192c76[_0x4854('0x49')](_0x2959c4);}})[_0x4854('0x22')](function(_0x1ca9db){if(_0x1ca9db){_0x130bc3=_0x1ca9db[_0x4854('0x34')];if(!_0x2c5dd6[_0x4854('0x30')][_0x4854('0x35')](_0x4854('0x4a'))){_0x2959c4[_0x4854('0x1b')]=qs['limit'](_0x2c5dd6[_0x4854('0x30')][_0x4854('0x1b')]);_0x2959c4[_0x4854('0x18')]=qs[_0x4854('0x18')](_0x2c5dd6['query'][_0x4854('0x18')]);}return _0x192c76[_0x4854('0x49')](_0x2959c4);}})[_0x4854('0x22')](function(_0x3645fd){if(_0x3645fd){return _0x3645fd?{'count':_0x130bc3,'rows':_0x3645fd}:null;}})[_0x4854('0x22')](respondWithResult(_0x5e93c7,null))['catch'](handleError(_0x5e93c7,null));};exports[_0x4854('0x4b')]=function(_0x2cd4b0,_0x2376de,_0x33696b){var _0x13df9c={};var _0x46bb78={};var _0x13e48b;var _0x37f1f1;return db['ZendeskConfiguration'][_0x4854('0x4c')]({'where':{'id':_0x2cd4b0[_0x4854('0x41')]['id']}})[_0x4854('0x22')](handleEntityNotFound(_0x2376de,null))[_0x4854('0x22')](function(_0x4ac008){if(_0x4ac008){_0x13e48b=_0x4ac008;_0x46bb78[_0x4854('0x2e')]=_['keys'](db['ZendeskField'][_0x4854('0x43')]);_0x46bb78[_0x4854('0x30')]=_['keys'](_0x2cd4b0[_0x4854('0x30')]);_0x46bb78[_0x4854('0x39')]=_[_0x4854('0x32')](_0x46bb78[_0x4854('0x2e')],_0x46bb78['query']);_0x13df9c[_0x4854('0x31')]=_[_0x4854('0x32')](_0x46bb78[_0x4854('0x2e')],qs[_0x4854('0x33')](_0x2cd4b0[_0x4854('0x30')][_0x4854('0x33')]));_0x13df9c[_0x4854('0x31')]=_0x13df9c[_0x4854('0x31')][_0x4854('0x34')]?_0x13df9c[_0x4854('0x31')]:_0x46bb78['model'];_0x13df9c['order']=qs[_0x4854('0x37')](_0x2cd4b0['query'][_0x4854('0x37')]);_0x13df9c[_0x4854('0x38')]=qs['filters'](_['pick'](_0x2cd4b0['query'],_0x46bb78[_0x4854('0x39')]));if(_0x2cd4b0['query'][_0x4854('0x3a')]){_0x13df9c['where']=_[_0x4854('0x3b')](_0x13df9c[_0x4854('0x38')],{'$or':_[_0x4854('0x2f')](_0x13df9c[_0x4854('0x31')],function(_0x31ef0b){var _0x485182={};_0x485182[_0x31ef0b]={'$like':'%'+_0x2cd4b0[_0x4854('0x30')][_0x4854('0x3a')]+'%'};return _0x485182;})});}_0x13df9c=_[_0x4854('0x3b')]({},_0x13df9c,_0x2cd4b0[_0x4854('0x3c')]);return _0x13e48b[_0x4854('0x4b')](_0x13df9c);}})[_0x4854('0x22')](function(_0x144607){if(_0x144607){_0x37f1f1=_0x144607[_0x4854('0x34')];if(!_0x2cd4b0[_0x4854('0x30')][_0x4854('0x35')](_0x4854('0x4a'))){_0x13df9c[_0x4854('0x1b')]=qs[_0x4854('0x1b')](_0x2cd4b0[_0x4854('0x30')][_0x4854('0x1b')]);_0x13df9c[_0x4854('0x18')]=qs['offset'](_0x2cd4b0[_0x4854('0x30')][_0x4854('0x18')]);}return _0x13e48b[_0x4854('0x4b')](_0x13df9c);}})[_0x4854('0x22')](function(_0x4d9c1c){if(_0x4d9c1c){return _0x4d9c1c?{'count':_0x37f1f1,'rows':_0x4d9c1c}:null;}})[_0x4854('0x22')](respondWithResult(_0x2376de,null))['catch'](handleError(_0x2376de,null));};exports[_0x4854('0x4d')]=function(_0x536cf4,_0x408335,_0x249109){var _0xd0f3fa={};var _0x4f2c4f={};var _0x991db7;var _0x14220e;return db['ZendeskConfiguration'][_0x4854('0x4c')]({'where':{'id':_0x536cf4['params']['id']}})[_0x4854('0x22')](handleEntityNotFound(_0x408335,null))[_0x4854('0x22')](function(_0x13b3f8){if(_0x13b3f8){_0x991db7=_0x13b3f8;_0x4f2c4f[_0x4854('0x2e')]=_['keys'](db[_0x4854('0x47')]['rawAttributes']);_0x4f2c4f[_0x4854('0x30')]=_[_0x4854('0x42')](_0x536cf4[_0x4854('0x30')]);_0x4f2c4f[_0x4854('0x39')]=_[_0x4854('0x32')](_0x4f2c4f[_0x4854('0x2e')],_0x4f2c4f[_0x4854('0x30')]);_0xd0f3fa[_0x4854('0x31')]=_[_0x4854('0x32')](_0x4f2c4f[_0x4854('0x2e')],qs['fields'](_0x536cf4[_0x4854('0x30')][_0x4854('0x33')]));_0xd0f3fa['attributes']=_0xd0f3fa[_0x4854('0x31')]['length']?_0xd0f3fa[_0x4854('0x31')]:_0x4f2c4f[_0x4854('0x2e')];_0xd0f3fa[_0x4854('0x36')]=qs[_0x4854('0x37')](_0x536cf4[_0x4854('0x30')][_0x4854('0x37')]);_0xd0f3fa[_0x4854('0x38')]=qs['filters'](_[_0x4854('0x48')](_0x536cf4[_0x4854('0x30')],_0x4f2c4f['filters']));if(_0x536cf4[_0x4854('0x30')][_0x4854('0x3a')]){_0xd0f3fa[_0x4854('0x38')]=_[_0x4854('0x3b')](_0xd0f3fa['where'],{'$or':_[_0x4854('0x2f')](_0xd0f3fa[_0x4854('0x31')],function(_0x4f1ba7){var _0x590660={};_0x590660[_0x4f1ba7]={'$like':'%'+_0x536cf4[_0x4854('0x30')][_0x4854('0x3a')]+'%'};return _0x590660;})});}_0xd0f3fa=_[_0x4854('0x3b')]({},_0xd0f3fa,_0x536cf4[_0x4854('0x3c')]);return _0x991db7[_0x4854('0x4d')](_0xd0f3fa);}})[_0x4854('0x22')](function(_0x2c4447){if(_0x2c4447){_0x14220e=_0x2c4447['length'];if(!_0x536cf4['query'][_0x4854('0x35')](_0x4854('0x4a'))){_0xd0f3fa[_0x4854('0x1b')]=qs[_0x4854('0x1b')](_0x536cf4['query'][_0x4854('0x1b')]);_0xd0f3fa[_0x4854('0x18')]=qs[_0x4854('0x18')](_0x536cf4[_0x4854('0x30')]['offset']);}return _0x991db7[_0x4854('0x4d')](_0xd0f3fa);}})[_0x4854('0x22')](function(_0x2b19e4){if(_0x2b19e4){return _0x2b19e4?{'count':_0x14220e,'rows':_0x2b19e4}:null;}})[_0x4854('0x22')](respondWithResult(_0x408335,null))[_0x4854('0x40')](handleError(_0x408335,null));};exports['getTags']=function(_0x119de9,_0x15715,_0x55e8a2){var _0x52eb5c={};var _0x1c6c05={};var _0x2e9b2b;var _0x4ad13b;return db[_0x4854('0x2a')]['findOne']({'where':{'id':_0x119de9['params']['id']}})['then'](handleEntityNotFound(_0x15715,null))[_0x4854('0x22')](function(_0x576b9c){if(_0x576b9c){_0x2e9b2b=_0x576b9c;_0x1c6c05['model']=_[_0x4854('0x42')](db[_0x4854('0x4e')]['rawAttributes']);_0x1c6c05[_0x4854('0x30')]=_[_0x4854('0x42')](_0x119de9[_0x4854('0x30')]);_0x1c6c05[_0x4854('0x39')]=_[_0x4854('0x32')](_0x1c6c05['model'],_0x1c6c05[_0x4854('0x30')]);_0x52eb5c['attributes']=_[_0x4854('0x32')](_0x1c6c05['model'],qs[_0x4854('0x33')](_0x119de9[_0x4854('0x30')][_0x4854('0x33')]));_0x52eb5c[_0x4854('0x31')]=_0x52eb5c[_0x4854('0x31')][_0x4854('0x34')]?_0x52eb5c[_0x4854('0x31')]:_0x1c6c05[_0x4854('0x2e')];_0x52eb5c[_0x4854('0x36')]=qs[_0x4854('0x37')](_0x119de9[_0x4854('0x30')]['sort']);_0x52eb5c[_0x4854('0x38')]=qs[_0x4854('0x39')](_[_0x4854('0x48')](_0x119de9[_0x4854('0x30')],_0x1c6c05[_0x4854('0x39')]));if(_0x119de9[_0x4854('0x30')][_0x4854('0x3a')]){_0x52eb5c['where']=_[_0x4854('0x3b')](_0x52eb5c[_0x4854('0x38')],{'$or':_['map'](_0x52eb5c['attributes'],function(_0x450085){var _0x34ab3e={};_0x34ab3e[_0x450085]={'$like':'%'+_0x119de9[_0x4854('0x30')]['filter']+'%'};return _0x34ab3e;})});}_0x52eb5c=_['merge']({},_0x52eb5c,_0x119de9['options']);return _0x2e9b2b[_0x4854('0x4f')](_0x52eb5c);}})['then'](function(_0x279639){if(_0x279639){_0x4ad13b=_0x279639[_0x4854('0x34')];if(!_0x119de9[_0x4854('0x30')][_0x4854('0x35')]('nolimit')){_0x52eb5c['limit']=qs[_0x4854('0x1b')](_0x119de9[_0x4854('0x30')][_0x4854('0x1b')]);_0x52eb5c[_0x4854('0x18')]=qs[_0x4854('0x18')](_0x119de9[_0x4854('0x30')][_0x4854('0x18')]);}return _0x2e9b2b['getTags'](_0x52eb5c);}})[_0x4854('0x22')](function(_0xdc7b75){if(_0xdc7b75){return _0xdc7b75?{'count':_0x4ad13b,'rows':_0xdc7b75}:null;}})[_0x4854('0x22')](respondWithResult(_0x15715,null))[_0x4854('0x40')](handleError(_0x15715,null));};exports['setTags']=function(_0x5cb444,_0xa2c18d,_0x453a23){if(_0x5cb444['body']['id']){delete _0x5cb444[_0x4854('0x45')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x5cb444['params']['id']}})[_0x4854('0x22')](handleEntityNotFound(_0xa2c18d,null))[_0x4854('0x22')](function(_0x5741b0){if(_0x5741b0){return _0x5741b0[_0x4854('0x50')](_0x5cb444[_0x4854('0x45')][_0x4854('0x51')]||[]);}return null;})[_0x4854('0x22')](respondWithResult(_0xa2c18d,null))[_0x4854('0x40')](handleError(_0xa2c18d,null));}; \ No newline at end of file +var _0xd634=['offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','find','create','body','params','ZendeskField','getFields','nolimit','getSubjects','findOne','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json'];(function(_0x1a7e4b,_0x2fbd40){var _0x37a8fd=function(_0x4eaa73){while(--_0x4eaa73){_0x1a7e4b['push'](_0x1a7e4b['shift']());}};_0x37a8fd(++_0x2fbd40);}(_0xd634,0xdf));var _0x4d63=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0xd634[_0x2c3255];return _0x282aba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4d63('0x0'));var zipdir=require(_0x4d63('0x1'));var jsonpatch=require(_0x4d63('0x2'));var rp=require(_0x4d63('0x3'));var moment=require(_0x4d63('0x4'));var BPromise=require(_0x4d63('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4d63('0x6'));var sox=require(_0x4d63('0x7'));var csv=require('to-csv');var ejs=require(_0x4d63('0x8'));var fs=require('fs');var fs_extra=require(_0x4d63('0x9'));var _=require(_0x4d63('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4d63('0xb'));var toCsv=require(_0x4d63('0xc'));var querystring=require(_0x4d63('0xd'));var Papa=require(_0x4d63('0xe'));var Redis=require('ioredis');var authService=require(_0x4d63('0xf'));var qs=require(_0x4d63('0x10'));var as=require(_0x4d63('0x11'));var hardwareService=require(_0x4d63('0x12'));var logger=require(_0x4d63('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4d63('0x14'));var licenseUtil=require(_0x4d63('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4395fa,_0x4714ca){_0x4714ca=_0x4714ca||0xcc;return function(_0x56bbe2){if(_0x56bbe2){return _0x4395fa[_0x4d63('0x16')](_0x4714ca);}return _0x4395fa[_0x4d63('0x17')](_0x4714ca)[_0x4d63('0x18')]();};}function respondWithResult(_0x425b82,_0xb57910){_0xb57910=_0xb57910||0xc8;return function(_0xa9dd90){if(_0xa9dd90){return _0x425b82[_0x4d63('0x17')](_0xb57910)[_0x4d63('0x19')](_0xa9dd90);}};}function respondWithFilteredResult(_0x42be3f,_0x23f3e1){return function(_0x49af86){if(_0x49af86){var _0x725b09=typeof _0x23f3e1[_0x4d63('0x1a')]===_0x4d63('0x1b')&&typeof _0x23f3e1[_0x4d63('0x1c')]===_0x4d63('0x1b');var _0x428ae0=_0x49af86['count'];var _0x125bcd=_0x725b09?0x0:_0x23f3e1[_0x4d63('0x1a')];var _0x574439=_0x725b09?_0x49af86[_0x4d63('0x1d')]:_0x23f3e1[_0x4d63('0x1a')]+_0x23f3e1[_0x4d63('0x1c')];var _0x58f39d;if(_0x574439>=_0x428ae0){_0x574439=_0x428ae0;_0x58f39d=0xc8;}else{_0x58f39d=0xce;}_0x42be3f[_0x4d63('0x17')](_0x58f39d);return _0x42be3f[_0x4d63('0x1e')]('Content-Range',_0x125bcd+'-'+_0x574439+'/'+_0x428ae0)[_0x4d63('0x19')](_0x49af86);}return null;};}function patchUpdates(_0x2b73f7){return function(_0x1978d4){try{jsonpatch[_0x4d63('0x1f')](_0x1978d4,_0x2b73f7,!![]);}catch(_0x6e56c9){return BPromise[_0x4d63('0x20')](_0x6e56c9);}return _0x1978d4[_0x4d63('0x21')]();};}function saveUpdates(_0x153bb9,_0x5bc97f){return function(_0x2d393e){if(_0x2d393e){return _0x2d393e[_0x4d63('0x22')](_0x153bb9)['then'](function(_0x5c0acc){return _0x5c0acc;});}return null;};}function removeEntity(_0x14e6e7,_0x3fe9ee){return function(_0x412cf2){if(_0x412cf2){return _0x412cf2[_0x4d63('0x23')]()[_0x4d63('0x24')](function(){_0x14e6e7[_0x4d63('0x17')](0xcc)[_0x4d63('0x18')]();});}};}function handleEntityNotFound(_0x11d2d8,_0x12f124){return function(_0x52d930){if(!_0x52d930){_0x11d2d8[_0x4d63('0x16')](0x194);}return _0x52d930;};}function handleError(_0x1524eb,_0x54ea36){_0x54ea36=_0x54ea36||0x1f4;return function(_0x2e81d7){logger[_0x4d63('0x25')](_0x2e81d7[_0x4d63('0x26')]);if(_0x2e81d7['name']){delete _0x2e81d7[_0x4d63('0x27')];}_0x1524eb['status'](_0x54ea36)[_0x4d63('0x28')](_0x2e81d7);};}exports[_0x4d63('0x29')]=function(_0x2094c1,_0x1b5e09){var _0x56ff88={},_0x39f214={},_0x4c8536={'count':0x0,'rows':[]};var _0x296ac4=_[_0x4d63('0x2a')](db[_0x4d63('0x2b')][_0x4d63('0x2c')],function(_0x3a01d6){return{'name':_0x3a01d6[_0x4d63('0x2d')],'type':_0x3a01d6[_0x4d63('0x2e')][_0x4d63('0x2f')]};});_0x39f214[_0x4d63('0x30')]=_[_0x4d63('0x2a')](_0x296ac4,_0x4d63('0x27'));_0x39f214[_0x4d63('0x31')]=_[_0x4d63('0x32')](_0x2094c1[_0x4d63('0x31')]);_0x39f214[_0x4d63('0x33')]=_[_0x4d63('0x34')](_0x39f214[_0x4d63('0x30')],_0x39f214[_0x4d63('0x31')]);_0x56ff88[_0x4d63('0x35')]=_[_0x4d63('0x34')](_0x39f214[_0x4d63('0x30')],qs[_0x4d63('0x36')](_0x2094c1[_0x4d63('0x31')][_0x4d63('0x36')]));_0x56ff88[_0x4d63('0x35')]=_0x56ff88[_0x4d63('0x35')][_0x4d63('0x37')]?_0x56ff88[_0x4d63('0x35')]:_0x39f214[_0x4d63('0x30')];if(!_0x2094c1['query'][_0x4d63('0x38')]('nolimit')){_0x56ff88['limit']=qs[_0x4d63('0x1c')](_0x2094c1['query'][_0x4d63('0x1c')]);_0x56ff88[_0x4d63('0x1a')]=qs[_0x4d63('0x1a')](_0x2094c1[_0x4d63('0x31')][_0x4d63('0x1a')]);}_0x56ff88[_0x4d63('0x39')]=qs[_0x4d63('0x3a')](_0x2094c1['query']['sort']);_0x56ff88[_0x4d63('0x3b')]=qs[_0x4d63('0x33')](_[_0x4d63('0x3c')](_0x2094c1[_0x4d63('0x31')],_0x39f214[_0x4d63('0x33')]),_0x296ac4);if(_0x2094c1[_0x4d63('0x31')][_0x4d63('0x3d')]){_0x56ff88[_0x4d63('0x3b')]=_[_0x4d63('0x3e')](_0x56ff88['where'],{'$or':_['map'](_0x296ac4,function(_0x1d4694){if(_0x1d4694[_0x4d63('0x2e')]!==_0x4d63('0x3f')){var _0x4b0cc4={};_0x4b0cc4[_0x1d4694['name']]={'$like':'%'+_0x2094c1[_0x4d63('0x31')][_0x4d63('0x3d')]+'%'};return _0x4b0cc4;}})});}_0x56ff88=_['merge']({},_0x56ff88,_0x2094c1[_0x4d63('0x40')]);var _0x8bb180={'where':_0x56ff88[_0x4d63('0x3b')]};return db['ZendeskConfiguration'][_0x4d63('0x1d')](_0x8bb180)[_0x4d63('0x24')](function(_0x1c8a3c){_0x4c8536['count']=_0x1c8a3c;if(_0x2094c1[_0x4d63('0x31')]['includeAll']){_0x56ff88[_0x4d63('0x41')]=[{'all':!![]}];}return db[_0x4d63('0x2b')][_0x4d63('0x42')](_0x56ff88);})[_0x4d63('0x24')](function(_0x895d89){_0x4c8536[_0x4d63('0x43')]=_0x895d89;return _0x4c8536;})[_0x4d63('0x24')](respondWithFilteredResult(_0x1b5e09,_0x56ff88))[_0x4d63('0x44')](handleError(_0x1b5e09,null));};exports[_0x4d63('0x45')]=function(_0x32d8aa,_0x3cc0ab){var _0x2ec933={'raw':![],'where':{'id':_0x32d8aa['params']['id']}},_0x18a1c9={};_0x18a1c9['model']=_[_0x4d63('0x32')](db[_0x4d63('0x2b')][_0x4d63('0x2c')]);_0x18a1c9['query']=_[_0x4d63('0x32')](_0x32d8aa[_0x4d63('0x31')]);_0x18a1c9[_0x4d63('0x33')]=_[_0x4d63('0x34')](_0x18a1c9[_0x4d63('0x30')],_0x18a1c9[_0x4d63('0x31')]);_0x2ec933[_0x4d63('0x35')]=_[_0x4d63('0x34')](_0x18a1c9[_0x4d63('0x30')],qs['fields'](_0x32d8aa['query']['fields']));_0x2ec933[_0x4d63('0x35')]=_0x2ec933[_0x4d63('0x35')][_0x4d63('0x37')]?_0x2ec933[_0x4d63('0x35')]:_0x18a1c9[_0x4d63('0x30')];if(_0x32d8aa['query']['includeAll']){_0x2ec933[_0x4d63('0x41')]=[{'all':!![]}];}_0x2ec933=_['merge']({},_0x2ec933,_0x32d8aa[_0x4d63('0x40')]);return db[_0x4d63('0x2b')][_0x4d63('0x46')](_0x2ec933)['then'](handleEntityNotFound(_0x3cc0ab,null))['then'](respondWithResult(_0x3cc0ab,null))[_0x4d63('0x44')](handleError(_0x3cc0ab,null));};exports[_0x4d63('0x47')]=function(_0x4fa43b,_0x198d87){return db[_0x4d63('0x2b')][_0x4d63('0x47')](_0x4fa43b[_0x4d63('0x48')],{})[_0x4d63('0x24')](respondWithResult(_0x198d87,0xc9))['catch'](handleError(_0x198d87,null));};exports[_0x4d63('0x22')]=function(_0x42fbc6,_0x14dc80){if(_0x42fbc6[_0x4d63('0x48')]['id']){delete _0x42fbc6[_0x4d63('0x48')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x42fbc6['params']['id']}})[_0x4d63('0x24')](handleEntityNotFound(_0x14dc80,null))[_0x4d63('0x24')](saveUpdates(_0x42fbc6[_0x4d63('0x48')],null))[_0x4d63('0x24')](respondWithResult(_0x14dc80,null))[_0x4d63('0x44')](handleError(_0x14dc80,null));};exports[_0x4d63('0x23')]=function(_0x1c1ea4,_0xe70068){return db['ZendeskConfiguration'][_0x4d63('0x46')]({'where':{'id':_0x1c1ea4[_0x4d63('0x49')]['id']}})[_0x4d63('0x24')](handleEntityNotFound(_0xe70068,null))[_0x4d63('0x24')](removeEntity(_0xe70068,null))[_0x4d63('0x44')](handleError(_0xe70068,null));};exports['getFields']=function(_0x1c4bb0,_0xcefdc,_0x550304){var _0x3e5305={};var _0x4ba510={};var _0x393081;var _0x1f9fa4;return db[_0x4d63('0x2b')]['findOne']({'where':{'id':_0x1c4bb0['params']['id']}})[_0x4d63('0x24')](handleEntityNotFound(_0xcefdc,null))[_0x4d63('0x24')](function(_0x2bb6ac){if(_0x2bb6ac){_0x393081=_0x2bb6ac;_0x4ba510['model']=_[_0x4d63('0x32')](db[_0x4d63('0x4a')][_0x4d63('0x2c')]);_0x4ba510['query']=_[_0x4d63('0x32')](_0x1c4bb0['query']);_0x4ba510['filters']=_[_0x4d63('0x34')](_0x4ba510[_0x4d63('0x30')],_0x4ba510[_0x4d63('0x31')]);_0x3e5305[_0x4d63('0x35')]=_[_0x4d63('0x34')](_0x4ba510[_0x4d63('0x30')],qs['fields'](_0x1c4bb0[_0x4d63('0x31')][_0x4d63('0x36')]));_0x3e5305[_0x4d63('0x35')]=_0x3e5305[_0x4d63('0x35')]['length']?_0x3e5305[_0x4d63('0x35')]:_0x4ba510[_0x4d63('0x30')];_0x3e5305[_0x4d63('0x39')]=qs[_0x4d63('0x3a')](_0x1c4bb0[_0x4d63('0x31')][_0x4d63('0x3a')]);_0x3e5305['where']=qs['filters'](_[_0x4d63('0x3c')](_0x1c4bb0[_0x4d63('0x31')],_0x4ba510[_0x4d63('0x33')]));if(_0x1c4bb0[_0x4d63('0x31')][_0x4d63('0x3d')]){_0x3e5305[_0x4d63('0x3b')]=_[_0x4d63('0x3e')](_0x3e5305[_0x4d63('0x3b')],{'$or':_[_0x4d63('0x2a')](_0x3e5305['attributes'],function(_0x3e58f7){var _0x319c32={};_0x319c32[_0x3e58f7]={'$like':'%'+_0x1c4bb0[_0x4d63('0x31')]['filter']+'%'};return _0x319c32;})});}_0x3e5305=_[_0x4d63('0x3e')]({},_0x3e5305,_0x1c4bb0[_0x4d63('0x40')]);return _0x393081[_0x4d63('0x4b')](_0x3e5305);}})['then'](function(_0x3b8933){if(_0x3b8933){_0x1f9fa4=_0x3b8933['length'];if(!_0x1c4bb0[_0x4d63('0x31')][_0x4d63('0x38')](_0x4d63('0x4c'))){_0x3e5305[_0x4d63('0x1c')]=qs[_0x4d63('0x1c')](_0x1c4bb0[_0x4d63('0x31')]['limit']);_0x3e5305['offset']=qs[_0x4d63('0x1a')](_0x1c4bb0[_0x4d63('0x31')][_0x4d63('0x1a')]);}return _0x393081[_0x4d63('0x4b')](_0x3e5305);}})[_0x4d63('0x24')](function(_0x4d3c2f){if(_0x4d3c2f){return _0x4d3c2f?{'count':_0x1f9fa4,'rows':_0x4d3c2f}:null;}})['then'](respondWithResult(_0xcefdc,null))[_0x4d63('0x44')](handleError(_0xcefdc,null));};exports[_0x4d63('0x4d')]=function(_0x120a90,_0x2bd607,_0x390e88){var _0x2555aa={};var _0x1cd170={};var _0x10d3ac;var _0x2dde3a;return db[_0x4d63('0x2b')][_0x4d63('0x4e')]({'where':{'id':_0x120a90['params']['id']}})[_0x4d63('0x24')](handleEntityNotFound(_0x2bd607,null))[_0x4d63('0x24')](function(_0x3f266f){if(_0x3f266f){_0x10d3ac=_0x3f266f;_0x1cd170[_0x4d63('0x30')]=_[_0x4d63('0x32')](db[_0x4d63('0x4a')][_0x4d63('0x2c')]);_0x1cd170[_0x4d63('0x31')]=_[_0x4d63('0x32')](_0x120a90['query']);_0x1cd170[_0x4d63('0x33')]=_[_0x4d63('0x34')](_0x1cd170[_0x4d63('0x30')],_0x1cd170[_0x4d63('0x31')]);_0x2555aa['attributes']=_['intersection'](_0x1cd170['model'],qs[_0x4d63('0x36')](_0x120a90[_0x4d63('0x31')][_0x4d63('0x36')]));_0x2555aa[_0x4d63('0x35')]=_0x2555aa['attributes'][_0x4d63('0x37')]?_0x2555aa[_0x4d63('0x35')]:_0x1cd170[_0x4d63('0x30')];_0x2555aa[_0x4d63('0x39')]=qs['sort'](_0x120a90[_0x4d63('0x31')][_0x4d63('0x3a')]);_0x2555aa[_0x4d63('0x3b')]=qs[_0x4d63('0x33')](_[_0x4d63('0x3c')](_0x120a90[_0x4d63('0x31')],_0x1cd170[_0x4d63('0x33')]));if(_0x120a90[_0x4d63('0x31')][_0x4d63('0x3d')]){_0x2555aa['where']=_[_0x4d63('0x3e')](_0x2555aa[_0x4d63('0x3b')],{'$or':_['map'](_0x2555aa[_0x4d63('0x35')],function(_0x1c87c4){var _0x37f559={};_0x37f559[_0x1c87c4]={'$like':'%'+_0x120a90['query'][_0x4d63('0x3d')]+'%'};return _0x37f559;})});}_0x2555aa=_[_0x4d63('0x3e')]({},_0x2555aa,_0x120a90[_0x4d63('0x40')]);return _0x10d3ac[_0x4d63('0x4d')](_0x2555aa);}})[_0x4d63('0x24')](function(_0xca5c5e){if(_0xca5c5e){_0x2dde3a=_0xca5c5e[_0x4d63('0x37')];if(!_0x120a90['query']['hasOwnProperty'](_0x4d63('0x4c'))){_0x2555aa[_0x4d63('0x1c')]=qs[_0x4d63('0x1c')](_0x120a90[_0x4d63('0x31')][_0x4d63('0x1c')]);_0x2555aa[_0x4d63('0x1a')]=qs[_0x4d63('0x1a')](_0x120a90['query'][_0x4d63('0x1a')]);}return _0x10d3ac['getSubjects'](_0x2555aa);}})[_0x4d63('0x24')](function(_0x1594d0){if(_0x1594d0){return _0x1594d0?{'count':_0x2dde3a,'rows':_0x1594d0}:null;}})[_0x4d63('0x24')](respondWithResult(_0x2bd607,null))[_0x4d63('0x44')](handleError(_0x2bd607,null));};exports['getDescriptions']=function(_0x40ad3b,_0x123ee7,_0x30a040){var _0x475e39={};var _0x1f7490={};var _0x5344b0;var _0x3310db;return db[_0x4d63('0x2b')][_0x4d63('0x4e')]({'where':{'id':_0x40ad3b['params']['id']}})[_0x4d63('0x24')](handleEntityNotFound(_0x123ee7,null))['then'](function(_0x4be0f5){if(_0x4be0f5){_0x5344b0=_0x4be0f5;_0x1f7490[_0x4d63('0x30')]=_[_0x4d63('0x32')](db[_0x4d63('0x4a')][_0x4d63('0x2c')]);_0x1f7490[_0x4d63('0x31')]=_[_0x4d63('0x32')](_0x40ad3b[_0x4d63('0x31')]);_0x1f7490['filters']=_[_0x4d63('0x34')](_0x1f7490[_0x4d63('0x30')],_0x1f7490[_0x4d63('0x31')]);_0x475e39[_0x4d63('0x35')]=_['intersection'](_0x1f7490['model'],qs[_0x4d63('0x36')](_0x40ad3b[_0x4d63('0x31')][_0x4d63('0x36')]));_0x475e39['attributes']=_0x475e39[_0x4d63('0x35')][_0x4d63('0x37')]?_0x475e39[_0x4d63('0x35')]:_0x1f7490[_0x4d63('0x30')];_0x475e39['order']=qs[_0x4d63('0x3a')](_0x40ad3b[_0x4d63('0x31')][_0x4d63('0x3a')]);_0x475e39[_0x4d63('0x3b')]=qs[_0x4d63('0x33')](_[_0x4d63('0x3c')](_0x40ad3b['query'],_0x1f7490[_0x4d63('0x33')]));if(_0x40ad3b['query'][_0x4d63('0x3d')]){_0x475e39['where']=_[_0x4d63('0x3e')](_0x475e39['where'],{'$or':_[_0x4d63('0x2a')](_0x475e39[_0x4d63('0x35')],function(_0x90cdb9){var _0x417571={};_0x417571[_0x90cdb9]={'$like':'%'+_0x40ad3b[_0x4d63('0x31')][_0x4d63('0x3d')]+'%'};return _0x417571;})});}_0x475e39=_[_0x4d63('0x3e')]({},_0x475e39,_0x40ad3b[_0x4d63('0x40')]);return _0x5344b0['getDescriptions'](_0x475e39);}})['then'](function(_0x55a28e){if(_0x55a28e){_0x3310db=_0x55a28e[_0x4d63('0x37')];if(!_0x40ad3b[_0x4d63('0x31')][_0x4d63('0x38')](_0x4d63('0x4c'))){_0x475e39[_0x4d63('0x1c')]=qs[_0x4d63('0x1c')](_0x40ad3b[_0x4d63('0x31')][_0x4d63('0x1c')]);_0x475e39[_0x4d63('0x1a')]=qs[_0x4d63('0x1a')](_0x40ad3b[_0x4d63('0x31')][_0x4d63('0x1a')]);}return _0x5344b0[_0x4d63('0x4f')](_0x475e39);}})[_0x4d63('0x24')](function(_0x3cf6c0){if(_0x3cf6c0){return _0x3cf6c0?{'count':_0x3310db,'rows':_0x3cf6c0}:null;}})['then'](respondWithResult(_0x123ee7,null))[_0x4d63('0x44')](handleError(_0x123ee7,null));};exports['getTags']=function(_0x787db6,_0x298d5c,_0x1eeefe){var _0x2e4de6={};var _0x10d8bc={};var _0xac325;var _0x495ae8;return db[_0x4d63('0x2b')][_0x4d63('0x4e')]({'where':{'id':_0x787db6[_0x4d63('0x49')]['id']}})[_0x4d63('0x24')](handleEntityNotFound(_0x298d5c,null))[_0x4d63('0x24')](function(_0x2a97e2){if(_0x2a97e2){_0xac325=_0x2a97e2;_0x10d8bc[_0x4d63('0x30')]=_[_0x4d63('0x32')](db['Tag']['rawAttributes']);_0x10d8bc[_0x4d63('0x31')]=_[_0x4d63('0x32')](_0x787db6[_0x4d63('0x31')]);_0x10d8bc[_0x4d63('0x33')]=_[_0x4d63('0x34')](_0x10d8bc[_0x4d63('0x30')],_0x10d8bc[_0x4d63('0x31')]);_0x2e4de6[_0x4d63('0x35')]=_[_0x4d63('0x34')](_0x10d8bc[_0x4d63('0x30')],qs[_0x4d63('0x36')](_0x787db6[_0x4d63('0x31')]['fields']));_0x2e4de6['attributes']=_0x2e4de6[_0x4d63('0x35')][_0x4d63('0x37')]?_0x2e4de6[_0x4d63('0x35')]:_0x10d8bc[_0x4d63('0x30')];_0x2e4de6[_0x4d63('0x39')]=qs[_0x4d63('0x3a')](_0x787db6[_0x4d63('0x31')]['sort']);_0x2e4de6[_0x4d63('0x3b')]=qs[_0x4d63('0x33')](_[_0x4d63('0x3c')](_0x787db6[_0x4d63('0x31')],_0x10d8bc['filters']));if(_0x787db6[_0x4d63('0x31')][_0x4d63('0x3d')]){_0x2e4de6[_0x4d63('0x3b')]=_[_0x4d63('0x3e')](_0x2e4de6[_0x4d63('0x3b')],{'$or':_[_0x4d63('0x2a')](_0x2e4de6[_0x4d63('0x35')],function(_0x48fa3f){var _0x15171b={};_0x15171b[_0x48fa3f]={'$like':'%'+_0x787db6[_0x4d63('0x31')][_0x4d63('0x3d')]+'%'};return _0x15171b;})});}_0x2e4de6=_[_0x4d63('0x3e')]({},_0x2e4de6,_0x787db6[_0x4d63('0x40')]);return _0xac325[_0x4d63('0x50')](_0x2e4de6);}})['then'](function(_0x39937e){if(_0x39937e){_0x495ae8=_0x39937e[_0x4d63('0x37')];if(!_0x787db6[_0x4d63('0x31')][_0x4d63('0x38')](_0x4d63('0x4c'))){_0x2e4de6['limit']=qs[_0x4d63('0x1c')](_0x787db6[_0x4d63('0x31')][_0x4d63('0x1c')]);_0x2e4de6[_0x4d63('0x1a')]=qs[_0x4d63('0x1a')](_0x787db6[_0x4d63('0x31')][_0x4d63('0x1a')]);}return _0xac325[_0x4d63('0x50')](_0x2e4de6);}})[_0x4d63('0x24')](function(_0x37ea21){if(_0x37ea21){return _0x37ea21?{'count':_0x495ae8,'rows':_0x37ea21}:null;}})[_0x4d63('0x24')](respondWithResult(_0x298d5c,null))[_0x4d63('0x44')](handleError(_0x298d5c,null));};exports['setTags']=function(_0x229b59,_0x1c698a,_0x4001d5){if(_0x229b59[_0x4d63('0x48')]['id']){delete _0x229b59['body']['id'];}return db[_0x4d63('0x2b')][_0x4d63('0x4e')]({'where':{'id':_0x229b59[_0x4d63('0x49')]['id']}})[_0x4d63('0x24')](handleEntityNotFound(_0x1c698a,null))[_0x4d63('0x24')](function(_0x3ecc54){if(_0x3ecc54){return _0x3ecc54[_0x4d63('0x51')](_0x229b59[_0x4d63('0x48')][_0x4d63('0x52')]||[]);}return null;})[_0x4d63('0x24')](respondWithResult(_0x1c698a,null))[_0x4d63('0x44')](handleError(_0x1c698a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 6a14b3b..8c4688a 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 _0x4cf8=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x40e157,_0x1fdc84){var _0x4e333c=function(_0x1ebb7a){while(--_0x1ebb7a){_0x40e157['push'](_0x40e157['shift']());}};_0x4e333c(++_0x1fdc84);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x1aa049,_0x9ae13c){_0x1aa049=_0x1aa049-0x0;var _0x357f29=_0x4cf8[_0x1aa049];return _0x357f29;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var logger=require(_0x84cf('0x2'))(_0x84cf('0x3'));var moment=require(_0x84cf('0x4'));var BPromise=require(_0x84cf('0x5'));var rp=require(_0x84cf('0x6'));var fs=require('fs');var path=require(_0x84cf('0x7'));var rimraf=require(_0x84cf('0x8'));var config=require(_0x84cf('0x9'));var attributes=require(_0x84cf('0xa'));module[_0x84cf('0xb')]=function(_0x50ade2,_0x4af3f1){return _0x50ade2[_0x84cf('0xc')]('ZendeskConfiguration',attributes,{'tableName':_0x84cf('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe820=['exports','define','ZendeskConfiguration','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x4b7e4f,_0x4cca29){var _0x2dbef4=function(_0x4a5354){while(--_0x4a5354){_0x4b7e4f['push'](_0x4b7e4f['shift']());}};_0x2dbef4(++_0x4cca29);}(_0xe820,0xd2));var _0x0e82=function(_0x43dec2,_0x2173e1){_0x43dec2=_0x43dec2-0x0;var _0x2006dd=_0xe820[_0x43dec2];return _0x2006dd;};'use strict';var _=require(_0x0e82('0x0'));var util=require('util');var logger=require(_0x0e82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0e82('0x2'));var rp=require(_0x0e82('0x3'));var fs=require('fs');var path=require(_0x0e82('0x4'));var rimraf=require('rimraf');var config=require(_0x0e82('0x5'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x0e82('0x6')]=function(_0x105e3c,_0x69e27f){return _0x105e3c[_0x0e82('0x7')](_0x0e82('0x8'),attributes,{'tableName':'int_zendesk_configurations','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 0e6ee37..404d8f3 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 _0x75eb=['message','info','catch','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3eda5d,_0x2320c4){var _0x5cdebc=function(_0x1de022){while(--_0x1de022){_0x3eda5d['push'](_0x3eda5d['shift']());}};_0x5cdebc(++_0x2320c4);}(_0x75eb,0x137));var _0xb75e=function(_0x425e0b,_0x3fc147){_0x425e0b=_0x425e0b-0x0;var _0x30831b=_0x75eb[_0x425e0b];return _0x30831b;};'use strict';var _=require(_0xb75e('0x0'));var util=require('util');var moment=require(_0xb75e('0x1'));var BPromise=require(_0xb75e('0x2'));var rs=require(_0xb75e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb75e('0x4'))(_0xb75e('0x5'));var config=require(_0xb75e('0x6'));var jayson=require(_0xb75e('0x7'));var client=jayson[_0xb75e('0x8')][_0xb75e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ae9fa,_0x13443c,_0x3f9182){return new BPromise(function(_0x2f2736,_0x1e27e1){return client[_0xb75e('0xa')](_0x2ae9fa,_0x3f9182)[_0xb75e('0xb')](function(_0xd0c8fd){logger['info'](_0xb75e('0xc'),_0x13443c,'request\x20sent');logger[_0xb75e('0xd')](_0xb75e('0xe'),_0x13443c,_0xb75e('0xf'),JSON[_0xb75e('0x10')](_0xd0c8fd));if(_0xd0c8fd['error']){if(_0xd0c8fd[_0xb75e('0x11')][_0xb75e('0x12')]===0x1f4){logger[_0xb75e('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x13443c,_0xd0c8fd[_0xb75e('0x11')][_0xb75e('0x13')]);return _0x1e27e1(_0xd0c8fd[_0xb75e('0x11')][_0xb75e('0x13')]);}logger[_0xb75e('0x11')](_0xb75e('0xc'),_0x13443c,_0xd0c8fd[_0xb75e('0x11')][_0xb75e('0x13')]);return _0x2f2736(_0xd0c8fd[_0xb75e('0x11')][_0xb75e('0x13')]);}else{logger[_0xb75e('0x14')](_0xb75e('0xc'),_0x13443c,_0xb75e('0xf'));_0x2f2736(_0xd0c8fd['result']['message']);}})[_0xb75e('0x15')](function(_0x3765e3){logger[_0xb75e('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x13443c,_0x3765e3);_0x1e27e1(_0x3765e3);});});} \ No newline at end of file +var _0xc993=['client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x3966de,_0x2fd143){var _0x44b513=function(_0x3edb40){while(--_0x3edb40){_0x3966de['push'](_0x3966de['shift']());}};_0x44b513(++_0x2fd143);}(_0xc993,0xc6));var _0x3c99=function(_0x475e68,_0x2552b8){_0x475e68=_0x475e68-0x0;var _0x4ed805=_0xc993[_0x475e68];return _0x4ed805;};'use strict';var _=require(_0x3c99('0x0'));var util=require('util');var moment=require(_0x3c99('0x1'));var BPromise=require('bluebird');var rs=require(_0x3c99('0x2'));var fs=require('fs');var Redis=require(_0x3c99('0x3'));var db=require(_0x3c99('0x4'))['db'];var utils=require(_0x3c99('0x5'));var logger=require(_0x3c99('0x6'))('rpc');var config=require(_0x3c99('0x7'));var jayson=require(_0x3c99('0x8'));var client=jayson[_0x3c99('0x9')][_0x3c99('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49e1dd,_0x2df5ad,_0x30bf3c){return new BPromise(function(_0x1ebae1,_0x1f9d95){return client[_0x3c99('0xb')](_0x49e1dd,_0x30bf3c)[_0x3c99('0xc')](function(_0x5d57ff){logger[_0x3c99('0xd')](_0x3c99('0xe'),_0x2df5ad,'request\x20sent');logger['debug'](_0x3c99('0xf'),_0x2df5ad,_0x3c99('0x10'),JSON[_0x3c99('0x11')](_0x5d57ff));if(_0x5d57ff[_0x3c99('0x12')]){if(_0x5d57ff['error'][_0x3c99('0x13')]===0x1f4){logger[_0x3c99('0x12')](_0x3c99('0xe'),_0x2df5ad,_0x5d57ff[_0x3c99('0x12')][_0x3c99('0x14')]);return _0x1f9d95(_0x5d57ff[_0x3c99('0x12')][_0x3c99('0x14')]);}logger[_0x3c99('0x12')](_0x3c99('0xe'),_0x2df5ad,_0x5d57ff[_0x3c99('0x12')][_0x3c99('0x14')]);return _0x1ebae1(_0x5d57ff['error'][_0x3c99('0x14')]);}else{logger[_0x3c99('0xd')](_0x3c99('0xe'),_0x2df5ad,_0x3c99('0x10'));_0x1ebae1(_0x5d57ff[_0x3c99('0x15')]['message']);}})[_0x3c99('0x16')](function(_0x3c5b72){logger[_0x3c99('0x12')](_0x3c99('0xe'),_0x2df5ad,_0x3c5b72);_0x1f9d95(_0x3c5b72);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 0fde4d1..e1739ac 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 _0xc71c=['post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','/:id','isAuthenticated','show'];(function(_0x1a8df4,_0x52274e){var _0x3207f8=function(_0x52be01){while(--_0x52be01){_0x1a8df4['push'](_0x1a8df4['shift']());}};_0x3207f8(++_0x52274e);}(_0xc71c,0xa7));var _0xcc71=function(_0x4e119b,_0x533da0){_0x4e119b=_0x4e119b-0x0;var _0x4a9be5=_0xc71c[_0x4e119b];return _0x4a9be5;};'use strict';var multer=require(_0xcc71('0x0'));var util=require(_0xcc71('0x1'));var path=require('path');var timeout=require(_0xcc71('0x2'));var express=require(_0xcc71('0x3'));var router=express[_0xcc71('0x4')]();var fs_extra=require(_0xcc71('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcc71('0x6'));var config=require(_0xcc71('0x7'));var controller=require(_0xcc71('0x8'));router[_0xcc71('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xcc71('0xa'),auth[_0xcc71('0xb')](),controller[_0xcc71('0xc')]);router[_0xcc71('0xd')]('/',auth[_0xcc71('0xb')](),controller[_0xcc71('0xe')]);router[_0xcc71('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xcc71('0x10')]);router[_0xcc71('0x11')](_0xcc71('0xa'),auth[_0xcc71('0xb')](),controller[_0xcc71('0x12')]);module[_0xcc71('0x13')]=router; \ No newline at end of file +var _0x03e1=['update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','/:id','isAuthenticated','post','put'];(function(_0x8197a7,_0x1f946d){var _0x1c2f28=function(_0x4ad15){while(--_0x4ad15){_0x8197a7['push'](_0x8197a7['shift']());}};_0x1c2f28(++_0x1f946d);}(_0x03e1,0x1e8));var _0x103e=function(_0x5bd490,_0x21fe3b){_0x5bd490=_0x5bd490-0x0;var _0x1fc61f=_0x03e1[_0x5bd490];return _0x1fc61f;};'use strict';var multer=require(_0x103e('0x0'));var util=require(_0x103e('0x1'));var path=require('path');var timeout=require(_0x103e('0x2'));var express=require(_0x103e('0x3'));var router=express[_0x103e('0x4')]();var fs_extra=require(_0x103e('0x5'));var auth=require(_0x103e('0x6'));var interaction=require(_0x103e('0x7'));var config=require(_0x103e('0x8'));var controller=require(_0x103e('0x9'));router[_0x103e('0xa')]('/',auth['isAuthenticated'](),controller[_0x103e('0xb')]);router[_0x103e('0xa')](_0x103e('0xc'),auth[_0x103e('0xd')](),controller['show']);router[_0x103e('0xe')]('/',auth[_0x103e('0xd')](),controller['create']);router[_0x103e('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x103e('0x10')]);router[_0x103e('0x11')](_0x103e('0xc'),auth[_0x103e('0xd')](),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 4a5fc46..4f529f0 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 _0x8bdd=['sequelize','exports','ENUM','string','STRING','variable','customVariable','BOOLEAN'];(function(_0x1673f1,_0x16f559){var _0x140170=function(_0x94ec6d){while(--_0x94ec6d){_0x1673f1['push'](_0x1673f1['shift']());}};_0x140170(++_0x16f559);}(_0x8bdd,0x118));var _0xd8bd=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8bdd[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xd8bd('0x0'));module[_0xd8bd('0x1')]={'type':{'type':Sequelize[_0xd8bd('0x2')](_0xd8bd('0x3'),'variable','customVariable','keyValue','picklist'),'defaultValue':_0xd8bd('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd8bd('0x4')]},'keyType':{'type':Sequelize[_0xd8bd('0x2')]('string',_0xd8bd('0x5'),_0xd8bd('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd8bd('0x4')]},'customField':{'type':Sequelize[_0xd8bd('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd8bd('0x4')]}}; \ No newline at end of file +var _0xa238=['variable','sequelize','exports','ENUM','keyValue','picklist','string','STRING'];(function(_0x3cc9d9,_0x69ed38){var _0x1a425d=function(_0x44d109){while(--_0x44d109){_0x3cc9d9['push'](_0x3cc9d9['shift']());}};_0x1a425d(++_0x69ed38);}(_0xa238,0x189));var _0x8a23=function(_0x4447f1,_0x843fda){_0x4447f1=_0x4447f1-0x0;var _0x12f540=_0xa238[_0x4447f1];return _0x12f540;};'use strict';var Sequelize=require(_0x8a23('0x0'));module[_0x8a23('0x1')]={'type':{'type':Sequelize[_0x8a23('0x2')]('string','variable','customVariable',_0x8a23('0x3'),_0x8a23('0x4')),'defaultValue':_0x8a23('0x5')},'content':{'type':Sequelize[_0x8a23('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8a23('0x2')](_0x8a23('0x5'),_0x8a23('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x8a23('0x6')]},'idField':{'type':Sequelize[_0x8a23('0x6')]},'nameField':{'type':Sequelize[_0x8a23('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8a23('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 37c15ae..70f21ce 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 _0x0c29=['map','ZendeskField','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','params','keys','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index'];(function(_0x1a5397,_0x30cb20){var _0x22c911=function(_0x5cc3d4){while(--_0x5cc3d4){_0x1a5397['push'](_0x1a5397['shift']());}};_0x22c911(++_0x30cb20);}(_0x0c29,0x69));var _0x90c2=function(_0x3e6b2f,_0x1ffa07){_0x3e6b2f=_0x3e6b2f-0x0;var _0x323215=_0x0c29[_0x3e6b2f];return _0x323215;};'use strict';var emlformat=require(_0x90c2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x90c2('0x1'));var jsonpatch=require(_0x90c2('0x2'));var rp=require(_0x90c2('0x3'));var moment=require(_0x90c2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x90c2('0x5'));var sox=require(_0x90c2('0x6'));var csv=require(_0x90c2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x90c2('0x8'));var squel=require(_0x90c2('0x9'));var crypto=require(_0x90c2('0xa'));var jsforce=require(_0x90c2('0xb'));var deskjs=require(_0x90c2('0xc'));var toCsv=require('to-csv');var querystring=require(_0x90c2('0xd'));var Papa=require('papaparse');var Redis=require(_0x90c2('0xe'));var authService=require(_0x90c2('0xf'));var qs=require(_0x90c2('0x10'));var as=require(_0x90c2('0x11'));var hardwareService=require(_0x90c2('0x12'));var logger=require(_0x90c2('0x13'))(_0x90c2('0x14'));var utils=require('../../config/utils');var config=require(_0x90c2('0x15'));var licenseUtil=require(_0x90c2('0x16'));var db=require(_0x90c2('0x17'))['db'];function respondWithStatusCode(_0x4f23f3,_0x1fa5ff){_0x1fa5ff=_0x1fa5ff||0xcc;return function(_0x1f66fb){if(_0x1f66fb){return _0x4f23f3[_0x90c2('0x18')](_0x1fa5ff);}return _0x4f23f3[_0x90c2('0x19')](_0x1fa5ff)[_0x90c2('0x1a')]();};}function respondWithResult(_0x6b2a5,_0x131469){_0x131469=_0x131469||0xc8;return function(_0x47982a){if(_0x47982a){return _0x6b2a5[_0x90c2('0x19')](_0x131469)['json'](_0x47982a);}};}function respondWithFilteredResult(_0x5e35fb,_0x29e8b1){return function(_0x44e43f){if(_0x44e43f){var _0x402c6c=typeof _0x29e8b1[_0x90c2('0x1b')]==='undefined'&&typeof _0x29e8b1[_0x90c2('0x1c')]===_0x90c2('0x1d');var _0x49f6a6=_0x44e43f[_0x90c2('0x1e')];var _0xe8b6a9=_0x402c6c?0x0:_0x29e8b1['offset'];var _0x5097ec=_0x402c6c?_0x44e43f[_0x90c2('0x1e')]:_0x29e8b1[_0x90c2('0x1b')]+_0x29e8b1['limit'];var _0x5aa646;if(_0x5097ec>=_0x49f6a6){_0x5097ec=_0x49f6a6;_0x5aa646=0xc8;}else{_0x5aa646=0xce;}_0x5e35fb['status'](_0x5aa646);return _0x5e35fb[_0x90c2('0x1f')](_0x90c2('0x20'),_0xe8b6a9+'-'+_0x5097ec+'/'+_0x49f6a6)['json'](_0x44e43f);}return null;};}function patchUpdates(_0x348db2){return function(_0x3fae93){try{jsonpatch[_0x90c2('0x21')](_0x3fae93,_0x348db2,!![]);}catch(_0x5ccdff){return BPromise[_0x90c2('0x22')](_0x5ccdff);}return _0x3fae93['save']();};}function saveUpdates(_0x38cb22,_0x2184d4){return function(_0x4691f0){if(_0x4691f0){return _0x4691f0[_0x90c2('0x23')](_0x38cb22)[_0x90c2('0x24')](function(_0x5b9f31){return _0x5b9f31;});}return null;};}function removeEntity(_0x1a9c1b,_0x2d14ff){return function(_0x409baf){if(_0x409baf){return _0x409baf[_0x90c2('0x25')]()[_0x90c2('0x24')](function(){_0x1a9c1b['status'](0xcc)[_0x90c2('0x1a')]();});}};}function handleEntityNotFound(_0x3ebcd1,_0x26ab62){return function(_0x3ecd9c){if(!_0x3ecd9c){_0x3ebcd1[_0x90c2('0x18')](0x194);}return _0x3ecd9c;};}function handleError(_0x67c7c,_0x17b39f){_0x17b39f=_0x17b39f||0x1f4;return function(_0x3f4fe1){logger[_0x90c2('0x26')](_0x3f4fe1[_0x90c2('0x27')]);if(_0x3f4fe1[_0x90c2('0x28')]){delete _0x3f4fe1[_0x90c2('0x28')];}_0x67c7c['status'](_0x17b39f)[_0x90c2('0x29')](_0x3f4fe1);};}exports[_0x90c2('0x2a')]=function(_0x446e1c,_0x1e5463){var _0x21f91d={},_0xa3c02b={},_0x154edb={'count':0x0,'rows':[]};var _0x4512e3=_[_0x90c2('0x2b')](db[_0x90c2('0x2c')][_0x90c2('0x2d')],function(_0x5efb53){return{'name':_0x5efb53[_0x90c2('0x2e')],'type':_0x5efb53[_0x90c2('0x2f')][_0x90c2('0x30')]};});_0xa3c02b['model']=_[_0x90c2('0x2b')](_0x4512e3,'name');_0xa3c02b[_0x90c2('0x31')]=_['keys'](_0x446e1c[_0x90c2('0x31')]);_0xa3c02b[_0x90c2('0x32')]=_[_0x90c2('0x33')](_0xa3c02b[_0x90c2('0x34')],_0xa3c02b[_0x90c2('0x31')]);_0x21f91d['attributes']=_[_0x90c2('0x33')](_0xa3c02b[_0x90c2('0x34')],qs[_0x90c2('0x35')](_0x446e1c[_0x90c2('0x31')][_0x90c2('0x35')]));_0x21f91d[_0x90c2('0x36')]=_0x21f91d[_0x90c2('0x36')][_0x90c2('0x37')]?_0x21f91d['attributes']:_0xa3c02b[_0x90c2('0x34')];if(!_0x446e1c['query'][_0x90c2('0x38')]('nolimit')){_0x21f91d[_0x90c2('0x1c')]=qs[_0x90c2('0x1c')](_0x446e1c[_0x90c2('0x31')]['limit']);_0x21f91d['offset']=qs[_0x90c2('0x1b')](_0x446e1c['query']['offset']);}_0x21f91d[_0x90c2('0x39')]=qs[_0x90c2('0x3a')](_0x446e1c['query'][_0x90c2('0x3a')]);_0x21f91d[_0x90c2('0x3b')]=qs[_0x90c2('0x32')](_[_0x90c2('0x3c')](_0x446e1c[_0x90c2('0x31')],_0xa3c02b[_0x90c2('0x32')]),_0x4512e3);if(_0x446e1c[_0x90c2('0x31')][_0x90c2('0x3d')]){_0x21f91d[_0x90c2('0x3b')]=_['merge'](_0x21f91d[_0x90c2('0x3b')],{'$or':_['map'](_0x4512e3,function(_0x50f415){if(_0x50f415[_0x90c2('0x2f')]!==_0x90c2('0x3e')){var _0x2204fe={};_0x2204fe[_0x50f415['name']]={'$like':'%'+_0x446e1c[_0x90c2('0x31')]['filter']+'%'};return _0x2204fe;}})});}_0x21f91d=_[_0x90c2('0x3f')]({},_0x21f91d,_0x446e1c['options']);var _0x19b15b={'where':_0x21f91d[_0x90c2('0x3b')]};return db[_0x90c2('0x2c')][_0x90c2('0x1e')](_0x19b15b)[_0x90c2('0x24')](function(_0x4f4539){_0x154edb[_0x90c2('0x1e')]=_0x4f4539;if(_0x446e1c['query'][_0x90c2('0x40')]){_0x21f91d[_0x90c2('0x41')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x21f91d);})[_0x90c2('0x24')](function(_0x2a3f57){_0x154edb[_0x90c2('0x42')]=_0x2a3f57;return _0x154edb;})['then'](respondWithFilteredResult(_0x1e5463,_0x21f91d))[_0x90c2('0x43')](handleError(_0x1e5463,null));};exports['show']=function(_0x50d468,_0x4a717f){var _0x1bfa97={'raw':!![],'where':{'id':_0x50d468[_0x90c2('0x44')]['id']}},_0x232353={};_0x232353[_0x90c2('0x34')]=_[_0x90c2('0x45')](db[_0x90c2('0x2c')][_0x90c2('0x2d')]);_0x232353['query']=_[_0x90c2('0x45')](_0x50d468[_0x90c2('0x31')]);_0x232353[_0x90c2('0x32')]=_[_0x90c2('0x33')](_0x232353[_0x90c2('0x34')],_0x232353[_0x90c2('0x31')]);_0x1bfa97[_0x90c2('0x36')]=_[_0x90c2('0x33')](_0x232353['model'],qs[_0x90c2('0x35')](_0x50d468[_0x90c2('0x31')][_0x90c2('0x35')]));_0x1bfa97['attributes']=_0x1bfa97[_0x90c2('0x36')][_0x90c2('0x37')]?_0x1bfa97[_0x90c2('0x36')]:_0x232353[_0x90c2('0x34')];if(_0x50d468[_0x90c2('0x31')][_0x90c2('0x40')]){_0x1bfa97['include']=[{'all':!![]}];}_0x1bfa97=_[_0x90c2('0x3f')]({},_0x1bfa97,_0x50d468[_0x90c2('0x46')]);return db[_0x90c2('0x2c')][_0x90c2('0x47')](_0x1bfa97)['then'](handleEntityNotFound(_0x4a717f,null))['then'](respondWithResult(_0x4a717f,null))[_0x90c2('0x43')](handleError(_0x4a717f,null));};exports['create']=function(_0x42208a,_0x36da51){return db['ZendeskField'][_0x90c2('0x48')](_0x42208a['body'],{})[_0x90c2('0x24')](respondWithResult(_0x36da51,0xc9))[_0x90c2('0x43')](handleError(_0x36da51,null));};exports[_0x90c2('0x23')]=function(_0x2ee67a,_0x2d951d){if(_0x2ee67a[_0x90c2('0x49')]['id']){delete _0x2ee67a[_0x90c2('0x49')]['id'];}return db[_0x90c2('0x2c')][_0x90c2('0x47')]({'where':{'id':_0x2ee67a['params']['id']}})[_0x90c2('0x24')](handleEntityNotFound(_0x2d951d,null))[_0x90c2('0x24')](saveUpdates(_0x2ee67a[_0x90c2('0x49')],null))['then'](respondWithResult(_0x2d951d,null))[_0x90c2('0x43')](handleError(_0x2d951d,null));};exports[_0x90c2('0x25')]=function(_0x35ed97,_0x36bad3){return db[_0x90c2('0x2c')][_0x90c2('0x47')]({'where':{'id':_0x35ed97['params']['id']}})['then'](handleEntityNotFound(_0x36bad3,null))[_0x90c2('0x24')](removeEntity(_0x36bad3,null))[_0x90c2('0x43')](handleError(_0x36bad3,null));}; \ No newline at end of file +var _0x7b79=['lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','filters','fields','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0x7b79,0x1b6));var _0x97b7=function(_0x2b53ba,_0x54c027){_0x2b53ba=_0x2b53ba-0x0;var _0x5d933e=_0x7b79[_0x2b53ba];return _0x5d933e;};'use strict';var emlformat=require(_0x97b7('0x0'));var rimraf=require(_0x97b7('0x1'));var zipdir=require(_0x97b7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97b7('0x3'));var moment=require(_0x97b7('0x4'));var BPromise=require(_0x97b7('0x5'));var Mustache=require(_0x97b7('0x6'));var util=require('util');var path=require(_0x97b7('0x7'));var sox=require(_0x97b7('0x8'));var csv=require(_0x97b7('0x9'));var ejs=require(_0x97b7('0xa'));var fs=require('fs');var fs_extra=require(_0x97b7('0xb'));var _=require(_0x97b7('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x97b7('0x9'));var querystring=require(_0x97b7('0xd'));var Papa=require(_0x97b7('0xe'));var Redis=require(_0x97b7('0xf'));var authService=require(_0x97b7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x97b7('0x11'));var hardwareService=require(_0x97b7('0x12'));var logger=require('../../config/logger')(_0x97b7('0x13'));var utils=require(_0x97b7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x97b7('0x15'));var db=require(_0x97b7('0x16'))['db'];function respondWithStatusCode(_0x17d3b1,_0x54cf0c){_0x54cf0c=_0x54cf0c||0xcc;return function(_0x1c0d09){if(_0x1c0d09){return _0x17d3b1[_0x97b7('0x17')](_0x54cf0c);}return _0x17d3b1[_0x97b7('0x18')](_0x54cf0c)[_0x97b7('0x19')]();};}function respondWithResult(_0x2a8602,_0x3d2dbb){_0x3d2dbb=_0x3d2dbb||0xc8;return function(_0xcd061e){if(_0xcd061e){return _0x2a8602[_0x97b7('0x18')](_0x3d2dbb)['json'](_0xcd061e);}};}function respondWithFilteredResult(_0xcd4293,_0x2f2c45){return function(_0x4914ec){if(_0x4914ec){var _0x3714f0=typeof _0x2f2c45[_0x97b7('0x1a')]===_0x97b7('0x1b')&&typeof _0x2f2c45[_0x97b7('0x1c')]===_0x97b7('0x1b');var _0x535415=_0x4914ec[_0x97b7('0x1d')];var _0x14890a=_0x3714f0?0x0:_0x2f2c45[_0x97b7('0x1a')];var _0x1859aa=_0x3714f0?_0x4914ec[_0x97b7('0x1d')]:_0x2f2c45['offset']+_0x2f2c45['limit'];var _0x1fe50e;if(_0x1859aa>=_0x535415){_0x1859aa=_0x535415;_0x1fe50e=0xc8;}else{_0x1fe50e=0xce;}_0xcd4293[_0x97b7('0x18')](_0x1fe50e);return _0xcd4293[_0x97b7('0x1e')](_0x97b7('0x1f'),_0x14890a+'-'+_0x1859aa+'/'+_0x535415)[_0x97b7('0x20')](_0x4914ec);}return null;};}function patchUpdates(_0x25447f){return function(_0xf3462b){try{jsonpatch[_0x97b7('0x21')](_0xf3462b,_0x25447f,!![]);}catch(_0x1ea827){return BPromise[_0x97b7('0x22')](_0x1ea827);}return _0xf3462b[_0x97b7('0x23')]();};}function saveUpdates(_0x15f129,_0x444fd6){return function(_0x223453){if(_0x223453){return _0x223453[_0x97b7('0x24')](_0x15f129)[_0x97b7('0x25')](function(_0xd85940){return _0xd85940;});}return null;};}function removeEntity(_0x114982,_0x32f2fb){return function(_0x47ef91){if(_0x47ef91){return _0x47ef91[_0x97b7('0x26')]()['then'](function(){_0x114982['status'](0xcc)[_0x97b7('0x19')]();});}};}function handleEntityNotFound(_0x5887af,_0x15ef36){return function(_0x21c0c2){if(!_0x21c0c2){_0x5887af[_0x97b7('0x17')](0x194);}return _0x21c0c2;};}function handleError(_0x79f056,_0x2d07f7){_0x2d07f7=_0x2d07f7||0x1f4;return function(_0x119640){logger[_0x97b7('0x27')](_0x119640[_0x97b7('0x28')]);if(_0x119640[_0x97b7('0x29')]){delete _0x119640['name'];}_0x79f056[_0x97b7('0x18')](_0x2d07f7)[_0x97b7('0x2a')](_0x119640);};}exports[_0x97b7('0x2b')]=function(_0x289035,_0x1d33d5){var _0x2534f6={},_0x39a451={},_0x94ed14={'count':0x0,'rows':[]};var _0x1ff39b=_[_0x97b7('0x2c')](db[_0x97b7('0x2d')][_0x97b7('0x2e')],function(_0x3c96a8){return{'name':_0x3c96a8[_0x97b7('0x2f')],'type':_0x3c96a8['type']['key']};});_0x39a451[_0x97b7('0x30')]=_[_0x97b7('0x2c')](_0x1ff39b,_0x97b7('0x29'));_0x39a451['query']=_[_0x97b7('0x31')](_0x289035[_0x97b7('0x32')]);_0x39a451['filters']=_[_0x97b7('0x33')](_0x39a451['model'],_0x39a451[_0x97b7('0x32')]);_0x2534f6['attributes']=_[_0x97b7('0x33')](_0x39a451[_0x97b7('0x30')],qs['fields'](_0x289035['query']['fields']));_0x2534f6[_0x97b7('0x34')]=_0x2534f6[_0x97b7('0x34')][_0x97b7('0x35')]?_0x2534f6[_0x97b7('0x34')]:_0x39a451[_0x97b7('0x30')];if(!_0x289035[_0x97b7('0x32')][_0x97b7('0x36')](_0x97b7('0x37'))){_0x2534f6[_0x97b7('0x1c')]=qs[_0x97b7('0x1c')](_0x289035[_0x97b7('0x32')][_0x97b7('0x1c')]);_0x2534f6[_0x97b7('0x1a')]=qs[_0x97b7('0x1a')](_0x289035[_0x97b7('0x32')][_0x97b7('0x1a')]);}_0x2534f6[_0x97b7('0x38')]=qs[_0x97b7('0x39')](_0x289035[_0x97b7('0x32')][_0x97b7('0x39')]);_0x2534f6[_0x97b7('0x3a')]=qs['filters'](_['pick'](_0x289035[_0x97b7('0x32')],_0x39a451['filters']),_0x1ff39b);if(_0x289035[_0x97b7('0x32')][_0x97b7('0x3b')]){_0x2534f6[_0x97b7('0x3a')]=_[_0x97b7('0x3c')](_0x2534f6[_0x97b7('0x3a')],{'$or':_['map'](_0x1ff39b,function(_0x53149b){if(_0x53149b[_0x97b7('0x3d')]!==_0x97b7('0x3e')){var _0x1e31c1={};_0x1e31c1[_0x53149b[_0x97b7('0x29')]]={'$like':'%'+_0x289035[_0x97b7('0x32')][_0x97b7('0x3b')]+'%'};return _0x1e31c1;}})});}_0x2534f6=_[_0x97b7('0x3c')]({},_0x2534f6,_0x289035[_0x97b7('0x3f')]);var _0x561268={'where':_0x2534f6[_0x97b7('0x3a')]};return db[_0x97b7('0x2d')][_0x97b7('0x1d')](_0x561268)['then'](function(_0x51c060){_0x94ed14[_0x97b7('0x1d')]=_0x51c060;if(_0x289035[_0x97b7('0x32')][_0x97b7('0x40')]){_0x2534f6[_0x97b7('0x41')]=[{'all':!![]}];}return db[_0x97b7('0x2d')][_0x97b7('0x42')](_0x2534f6);})[_0x97b7('0x25')](function(_0x56b561){_0x94ed14['rows']=_0x56b561;return _0x94ed14;})[_0x97b7('0x25')](respondWithFilteredResult(_0x1d33d5,_0x2534f6))[_0x97b7('0x43')](handleError(_0x1d33d5,null));};exports[_0x97b7('0x44')]=function(_0x22a809,_0x2ba566){var _0x49da28={'raw':!![],'where':{'id':_0x22a809['params']['id']}},_0x20b295={};_0x20b295[_0x97b7('0x30')]=_[_0x97b7('0x31')](db[_0x97b7('0x2d')]['rawAttributes']);_0x20b295['query']=_[_0x97b7('0x31')](_0x22a809['query']);_0x20b295[_0x97b7('0x45')]=_['intersection'](_0x20b295[_0x97b7('0x30')],_0x20b295[_0x97b7('0x32')]);_0x49da28[_0x97b7('0x34')]=_['intersection'](_0x20b295['model'],qs[_0x97b7('0x46')](_0x22a809['query'][_0x97b7('0x46')]));_0x49da28['attributes']=_0x49da28['attributes'][_0x97b7('0x35')]?_0x49da28[_0x97b7('0x34')]:_0x20b295[_0x97b7('0x30')];if(_0x22a809[_0x97b7('0x32')][_0x97b7('0x40')]){_0x49da28['include']=[{'all':!![]}];}_0x49da28=_[_0x97b7('0x3c')]({},_0x49da28,_0x22a809[_0x97b7('0x3f')]);return db['ZendeskField'][_0x97b7('0x47')](_0x49da28)[_0x97b7('0x25')](handleEntityNotFound(_0x2ba566,null))['then'](respondWithResult(_0x2ba566,null))['catch'](handleError(_0x2ba566,null));};exports[_0x97b7('0x48')]=function(_0xa7af48,_0x1493a7){return db[_0x97b7('0x2d')][_0x97b7('0x48')](_0xa7af48['body'],{})[_0x97b7('0x25')](respondWithResult(_0x1493a7,0xc9))[_0x97b7('0x43')](handleError(_0x1493a7,null));};exports[_0x97b7('0x24')]=function(_0x40103d,_0x4ea470){if(_0x40103d[_0x97b7('0x49')]['id']){delete _0x40103d[_0x97b7('0x49')]['id'];}return db['ZendeskField']['find']({'where':{'id':_0x40103d[_0x97b7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4ea470,null))['then'](saveUpdates(_0x40103d[_0x97b7('0x49')],null))[_0x97b7('0x25')](respondWithResult(_0x4ea470,null))[_0x97b7('0x43')](handleError(_0x4ea470,null));};exports[_0x97b7('0x26')]=function(_0xe9d86e,_0x30c085){return db[_0x97b7('0x2d')][_0x97b7('0x47')]({'where':{'id':_0xe9d86e[_0x97b7('0x4a')]['id']}})[_0x97b7('0x25')](handleEntityNotFound(_0x30c085,null))['then'](removeEntity(_0x30c085,null))[_0x97b7('0x43')](handleError(_0x30c085,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 23b2d7b..58ba813 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 _0x0b98=['lodash','api','moment','path','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','idField','FieldId'];(function(_0x221238,_0x498b22){var _0xe4a300=function(_0x3149f7){while(--_0x3149f7){_0x221238['push'](_0x221238['shift']());}};_0xe4a300(++_0x498b22);}(_0x0b98,0x1ad));var _0x80b9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b98[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x80b9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x80b9('0x1'));var moment=require(_0x80b9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x80b9('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x80b9('0x4'));module[_0x80b9('0x5')]=function(_0xd9575c,_0x1c8ac4){return _0xd9575c[_0x80b9('0x6')](_0x80b9('0x7'),attributes,{'tableName':_0x80b9('0x8'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x80b9('0x9'),_0x80b9('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x73eb=['request-promise','path','rimraf','./intZendeskField.attributes','define','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0x73eb,0x1ba));var _0xb73e=function(_0x14a232,_0x5d103c){_0x14a232=_0x14a232-0x0;var _0x4e3e39=_0x73eb[_0x14a232];return _0x4e3e39;};'use strict';var _=require(_0xb73e('0x0'));var util=require(_0xb73e('0x1'));var logger=require(_0xb73e('0x2'))(_0xb73e('0x3'));var moment=require(_0xb73e('0x4'));var BPromise=require(_0xb73e('0x5'));var rp=require(_0xb73e('0x6'));var fs=require('fs');var path=require(_0xb73e('0x7'));var rimraf=require(_0xb73e('0x8'));var config=require('../../config/environment');var attributes=require(_0xb73e('0x9'));module['exports']=function(_0x2047e8,_0x498b68){return _0x2047e8[_0xb73e('0xa')]('ZendeskField',attributes,{'tableName':_0xb73e('0xb'),'paranoid':![],'indexes':[{'name':_0xb73e('0xc'),'fields':['idField',_0xb73e('0xd')],'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 ce4f1c1..db5b11f 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 _0xb7dd=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x3d9ff9,_0x1a5a4c){var _0x34f987=function(_0x4c39f3){while(--_0x4c39f3){_0x3d9ff9['push'](_0x3d9ff9['shift']());}};_0x34f987(++_0x1a5a4c);}(_0xb7dd,0xc3));var _0xdb7d=function(_0x1a2938,_0x4a08d7){_0x1a2938=_0x1a2938-0x0;var _0x38c624=_0xb7dd[_0x1a2938];return _0x38c624;};'use strict';var _=require(_0xdb7d('0x0'));var util=require(_0xdb7d('0x1'));var moment=require(_0xdb7d('0x2'));var BPromise=require(_0xdb7d('0x3'));var rs=require(_0xdb7d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb7d('0x5'))['db'];var utils=require(_0xdb7d('0x6'));var logger=require(_0xdb7d('0x7'))(_0xdb7d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdb7d('0x9')][_0xdb7d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x458631,_0x2a5e68,_0x3368f8){return new BPromise(function(_0x1e3352,_0x565dd8){return client['request'](_0x458631,_0x3368f8)[_0xdb7d('0xb')](function(_0x175e21){logger[_0xdb7d('0xc')](_0xdb7d('0xd'),_0x2a5e68,'request\x20sent');logger[_0xdb7d('0xe')](_0xdb7d('0xf'),_0x2a5e68,'request\x20sent',JSON[_0xdb7d('0x10')](_0x175e21));if(_0x175e21['error']){if(_0x175e21[_0xdb7d('0x11')][_0xdb7d('0x12')]===0x1f4){logger[_0xdb7d('0x11')](_0xdb7d('0xd'),_0x2a5e68,_0x175e21[_0xdb7d('0x11')]['message']);return _0x565dd8(_0x175e21[_0xdb7d('0x11')][_0xdb7d('0x13')]);}logger['error'](_0xdb7d('0xd'),_0x2a5e68,_0x175e21['error'][_0xdb7d('0x13')]);return _0x1e3352(_0x175e21[_0xdb7d('0x11')][_0xdb7d('0x13')]);}else{logger[_0xdb7d('0xc')]('ZendeskField,\x20%s,\x20%s',_0x2a5e68,'request\x20sent');_0x1e3352(_0x175e21[_0xdb7d('0x14')][_0xdb7d('0x13')]);}})[_0xdb7d('0x15')](function(_0x603449){logger[_0xdb7d('0x11')]('ZendeskField,\x20%s,\x20%s',_0x2a5e68,_0x603449);_0x565dd8(_0x603449);});});} \ No newline at end of file +var _0xf7e8=['message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0xf7e8,0x1ce));var _0x8f7e=function(_0x4eaa32,_0x3c5d38){_0x4eaa32=_0x4eaa32-0x0;var _0x3cfd8b=_0xf7e8[_0x4eaa32];return _0x3cfd8b;};'use strict';var _=require(_0x8f7e('0x0'));var util=require(_0x8f7e('0x1'));var moment=require(_0x8f7e('0x2'));var BPromise=require(_0x8f7e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f7e('0x4'));var db=require(_0x8f7e('0x5'))['db'];var utils=require(_0x8f7e('0x6'));var logger=require(_0x8f7e('0x7'))(_0x8f7e('0x8'));var config=require('../../config/environment');var jayson=require(_0x8f7e('0x9'));var client=jayson[_0x8f7e('0xa')][_0x8f7e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ebbce,_0x23380b,_0x30e47c){return new BPromise(function(_0x1536aa,_0x1c0335){return client[_0x8f7e('0xc')](_0x4ebbce,_0x30e47c)['then'](function(_0x25178d){logger[_0x8f7e('0xd')](_0x8f7e('0xe'),_0x23380b,'request\x20sent');logger[_0x8f7e('0xf')](_0x8f7e('0x10'),_0x23380b,_0x8f7e('0x11'),JSON[_0x8f7e('0x12')](_0x25178d));if(_0x25178d[_0x8f7e('0x13')]){if(_0x25178d[_0x8f7e('0x13')][_0x8f7e('0x14')]===0x1f4){logger[_0x8f7e('0x13')](_0x8f7e('0xe'),_0x23380b,_0x25178d[_0x8f7e('0x13')][_0x8f7e('0x15')]);return _0x1c0335(_0x25178d['error']['message']);}logger[_0x8f7e('0x13')]('ZendeskField,\x20%s,\x20%s',_0x23380b,_0x25178d[_0x8f7e('0x13')]['message']);return _0x1536aa(_0x25178d['error'][_0x8f7e('0x15')]);}else{logger[_0x8f7e('0xd')](_0x8f7e('0xe'),_0x23380b,_0x8f7e('0x11'));_0x1536aa(_0x25178d['result'][_0x8f7e('0x15')]);}})[_0x8f7e('0x16')](function(_0x269737){logger['error'](_0x8f7e('0xe'),_0x23380b,_0x269737);_0x1c0335(_0x269737);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index b7ae8be..ebcbb10 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 _0x3b01=['create','addConfiguration','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','getFields'];(function(_0x273517,_0x50b234){var _0x2c6334=function(_0x26c055){while(--_0x26c055){_0x273517['push'](_0x273517['shift']());}};_0x2c6334(++_0x50b234);}(_0x3b01,0xb8));var _0x13b0=function(_0x117bf7,_0x28979c){_0x117bf7=_0x117bf7-0x0;var _0x455b9c=_0x3b01[_0x117bf7];return _0x455b9c;};'use strict';var multer=require(_0x13b0('0x0'));var util=require(_0x13b0('0x1'));var path=require(_0x13b0('0x2'));var timeout=require(_0x13b0('0x3'));var express=require(_0x13b0('0x4'));var router=express[_0x13b0('0x5')]();var fs_extra=require(_0x13b0('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x13b0('0x7'));var config=require(_0x13b0('0x8'));var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0x13b0('0x9')](),controller[_0x13b0('0xa')]);router[_0x13b0('0xb')](_0x13b0('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x13b0('0xd'),auth[_0x13b0('0x9')](),controller[_0x13b0('0xe')]);router[_0x13b0('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0x13b0('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x13b0('0x10')]);router['post'](_0x13b0('0xd'),auth[_0x13b0('0x9')](),controller[_0x13b0('0x11')]);router['put'](_0x13b0('0xc'),auth[_0x13b0('0x9')](),controller['update']);router['delete'](_0x13b0('0xc'),auth['isAuthenticated'](),controller[_0x13b0('0x12')]);module[_0x13b0('0x13')]=router; \ No newline at end of file +var _0xa292=['isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index'];(function(_0x36a236,_0x3cc5fc){var _0xa4ab27=function(_0xac60ea){while(--_0xac60ea){_0x36a236['push'](_0x36a236['shift']());}};_0xa4ab27(++_0x3cc5fc);}(_0xa292,0x80));var _0x2a29=function(_0x959591,_0x5aa72b){_0x959591=_0x959591-0x0;var _0xc85623=_0xa292[_0x959591];return _0xc85623;};'use strict';var multer=require(_0x2a29('0x0'));var util=require(_0x2a29('0x1'));var path=require(_0x2a29('0x2'));var timeout=require(_0x2a29('0x3'));var express=require(_0x2a29('0x4'));var router=express[_0x2a29('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2a29('0x6'));var config=require(_0x2a29('0x7'));var controller=require('./intZohoAccount.controller');router[_0x2a29('0x8')]('/',auth['isAuthenticated'](),controller[_0x2a29('0x9')]);router['get']('/:id',auth[_0x2a29('0xa')](),controller['show']);router[_0x2a29('0x8')](_0x2a29('0xb'),auth[_0x2a29('0xa')](),controller[_0x2a29('0xc')]);router[_0x2a29('0x8')](_0x2a29('0xd'),auth[_0x2a29('0xa')](),controller[_0x2a29('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2a29('0xf')]);router[_0x2a29('0x10')](_0x2a29('0xb'),auth[_0x2a29('0xa')](),controller[_0x2a29('0x11')]);router[_0x2a29('0x12')]('/:id',auth[_0x2a29('0xa')](),controller[_0x2a29('0x13')]);router[_0x2a29('0x14')](_0x2a29('0x15'),auth[_0x2a29('0xa')](),controller['destroy']);module[_0x2a29('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index f1c8fd7..c96a29f 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 _0x702d=['sequelize','exports','STRING'];(function(_0x5e210b,_0x5f4a2d){var _0x2e2486=function(_0x21e87f){while(--_0x21e87f){_0x5e210b['push'](_0x5e210b['shift']());}};_0x2e2486(++_0x5f4a2d);}(_0x702d,0x147));var _0xd702=function(_0x258f21,_0x13de63){_0x258f21=_0x258f21-0x0;var _0xaed1e=_0x702d[_0x258f21];return _0xaed1e;};'use strict';var Sequelize=require(_0xd702('0x0'));module[_0xd702('0x1')]={'name':{'type':Sequelize[_0xd702('0x2')]},'description':{'type':Sequelize[_0xd702('0x2')]},'host':{'type':Sequelize[_0xd702('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xd702('0x2')]},'clientSecret':{'type':Sequelize[_0xd702('0x2')]},'serverUrl':{'type':Sequelize[_0xd702('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xd702('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd2ea=['sequelize','exports','STRING'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0xd2ea,0x15f));var _0xad2e=function(_0x2c133b,_0x3a5dc7){_0x2c133b=_0x2c133b-0x0;var _0x339eac=_0xd2ea[_0x2c133b];return _0x339eac;};'use strict';var Sequelize=require(_0xad2e('0x0'));module[_0xad2e('0x1')]={'name':{'type':Sequelize[_0xad2e('0x2')]},'description':{'type':Sequelize[_0xad2e('0x2')]},'host':{'type':Sequelize[_0xad2e('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xad2e('0x2')]},'clientSecret':{'type':Sequelize[_0xad2e('0x2')]},'serverUrl':{'type':Sequelize[_0xad2e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xad2e('0x2')]},'refreshToken':{'type':Sequelize[_0xad2e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 7699c7b..c2a1b52 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 _0x2e9a=['fieldName','keys','query','filters','intersection','model','attributes','fields','limit','order','sort','pick','filter','merge','map','VIRTUAL','options','where','includeAll','include','rows','catch','params','length','find','create','body','getConfigurations','findOne','ZohoConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com.au','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','update','destroy','then','error','stack','name','ZohoAccount','rawAttributes'];(function(_0x4f2945,_0x30e8af){var _0x33e5e9=function(_0x5ae803){while(--_0x5ae803){_0x4f2945['push'](_0x4f2945['shift']());}};_0x33e5e9(++_0x30e8af);}(_0x2e9a,0x151));var _0xa2e9=function(_0x55a415,_0xff9f71){_0x55a415=_0x55a415-0x0;var _0x3e7659=_0x2e9a[_0x55a415];return _0x3e7659;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa2e9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa2e9('0x1'));var rp=require(_0xa2e9('0x2'));var moment=require('moment');var BPromise=require(_0xa2e9('0x3'));var Mustache=require(_0xa2e9('0x4'));var util=require(_0xa2e9('0x5'));var path=require(_0xa2e9('0x6'));var sox=require(_0xa2e9('0x7'));var csv=require(_0xa2e9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa2e9('0x9'));var _=require('lodash');var squel=require(_0xa2e9('0xa'));var crypto=require(_0xa2e9('0xb'));var jsforce=require(_0xa2e9('0xc'));var deskjs=require(_0xa2e9('0xd'));var toCsv=require(_0xa2e9('0x8'));var querystring=require('querystring');var Papa=require(_0xa2e9('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa2e9('0xf'));var hardwareService=require(_0xa2e9('0x10'));var logger=require('../../config/logger')(_0xa2e9('0x11'));var utils=require(_0xa2e9('0x12'));var config=require(_0xa2e9('0x13'));var licenseUtil=require(_0xa2e9('0x14'));var db=require(_0xa2e9('0x15'))['db'];var integrations=require(_0xa2e9('0x16'));function respondWithStatusCode(_0xa93bed,_0x19796e){_0x19796e=_0x19796e||0xcc;return function(_0xb153c4){if(_0xb153c4){return _0xa93bed[_0xa2e9('0x17')](_0x19796e);}return _0xa93bed[_0xa2e9('0x18')](_0x19796e)[_0xa2e9('0x19')]();};}function respondWithResult(_0x529d93,_0x50f7ae){_0x50f7ae=_0x50f7ae||0xc8;return function(_0x5a0e45){if(_0x5a0e45){return _0x529d93[_0xa2e9('0x18')](_0x50f7ae)['json'](_0x5a0e45);}};}function respondWithFilteredResult(_0xbf9277,_0x342b69){return function(_0x1267a5){if(_0x1267a5){var _0x3c2476=typeof _0x342b69[_0xa2e9('0x1a')]===_0xa2e9('0x1b')&&typeof _0x342b69['limit']==='undefined';var _0x4fb005=_0x1267a5[_0xa2e9('0x1c')];var _0x388fe7=_0x3c2476?0x0:_0x342b69[_0xa2e9('0x1a')];var _0x26ab85=_0x3c2476?_0x1267a5[_0xa2e9('0x1c')]:_0x342b69[_0xa2e9('0x1a')]+_0x342b69['limit'];var _0x21b04a;if(_0x26ab85>=_0x4fb005){_0x26ab85=_0x4fb005;_0x21b04a=0xc8;}else{_0x21b04a=0xce;}_0xbf9277['status'](_0x21b04a);return _0xbf9277['set'](_0xa2e9('0x1d'),_0x388fe7+'-'+_0x26ab85+'/'+_0x4fb005)[_0xa2e9('0x1e')](_0x1267a5);}return null;};}function patchUpdates(_0x41bfd0){return function(_0x4182a6){try{jsonpatch[_0xa2e9('0x1f')](_0x4182a6,_0x41bfd0,!![]);}catch(_0x6cd81e){return BPromise[_0xa2e9('0x20')](_0x6cd81e);}return _0x4182a6['save']();};}function saveUpdates(_0x245195,_0x301b8c){return function(_0x1e4b0f){if(_0x1e4b0f){return _0x1e4b0f[_0xa2e9('0x21')](_0x245195)['then'](function(_0x65a63c){return _0x65a63c;});}return null;};}function removeEntity(_0x457734,_0x34d82a){return function(_0x383b93){if(_0x383b93){return _0x383b93[_0xa2e9('0x22')]()[_0xa2e9('0x23')](function(){_0x457734[_0xa2e9('0x18')](0xcc)[_0xa2e9('0x19')]();});}};}function handleEntityNotFound(_0x298134,_0x5acb0d){return function(_0x3f451a){if(!_0x3f451a){_0x298134[_0xa2e9('0x17')](0x194);}return _0x3f451a;};}function handleError(_0x23afdc,_0x170b1e){_0x170b1e=_0x170b1e||0x1f4;return function(_0x2d28e8){logger[_0xa2e9('0x24')](_0x2d28e8[_0xa2e9('0x25')]);if(_0x2d28e8['name']){delete _0x2d28e8[_0xa2e9('0x26')];}_0x23afdc[_0xa2e9('0x18')](_0x170b1e)['send'](_0x2d28e8);};}exports['index']=function(_0x565714,_0x304b68){var _0x35fe81={},_0x3df3e6={},_0x307c89={'count':0x0,'rows':[]};var _0x3d43e9=_['map'](db[_0xa2e9('0x27')][_0xa2e9('0x28')],function(_0x3060fe){return{'name':_0x3060fe[_0xa2e9('0x29')],'type':_0x3060fe['type']['key']};});_0x3df3e6['model']=_['map'](_0x3d43e9,'name');_0x3df3e6['query']=_[_0xa2e9('0x2a')](_0x565714[_0xa2e9('0x2b')]);_0x3df3e6[_0xa2e9('0x2c')]=_[_0xa2e9('0x2d')](_0x3df3e6[_0xa2e9('0x2e')],_0x3df3e6[_0xa2e9('0x2b')]);_0x35fe81[_0xa2e9('0x2f')]=_[_0xa2e9('0x2d')](_0x3df3e6[_0xa2e9('0x2e')],qs[_0xa2e9('0x30')](_0x565714[_0xa2e9('0x2b')][_0xa2e9('0x30')]));_0x35fe81['attributes']=_0x35fe81[_0xa2e9('0x2f')]['length']?_0x35fe81[_0xa2e9('0x2f')]:_0x3df3e6[_0xa2e9('0x2e')];if(!_0x565714[_0xa2e9('0x2b')]['hasOwnProperty']('nolimit')){_0x35fe81[_0xa2e9('0x31')]=qs['limit'](_0x565714[_0xa2e9('0x2b')]['limit']);_0x35fe81[_0xa2e9('0x1a')]=qs[_0xa2e9('0x1a')](_0x565714[_0xa2e9('0x2b')]['offset']);}_0x35fe81[_0xa2e9('0x32')]=qs[_0xa2e9('0x33')](_0x565714[_0xa2e9('0x2b')][_0xa2e9('0x33')]);_0x35fe81['where']=qs[_0xa2e9('0x2c')](_[_0xa2e9('0x34')](_0x565714[_0xa2e9('0x2b')],_0x3df3e6[_0xa2e9('0x2c')]),_0x3d43e9);if(_0x565714[_0xa2e9('0x2b')][_0xa2e9('0x35')]){_0x35fe81['where']=_[_0xa2e9('0x36')](_0x35fe81['where'],{'$or':_[_0xa2e9('0x37')](_0x3d43e9,function(_0x42d2eb){if(_0x42d2eb['type']!==_0xa2e9('0x38')){var _0x2122ba={};_0x2122ba[_0x42d2eb[_0xa2e9('0x26')]]={'$like':'%'+_0x565714[_0xa2e9('0x2b')]['filter']+'%'};return _0x2122ba;}})});}_0x35fe81=_[_0xa2e9('0x36')]({},_0x35fe81,_0x565714[_0xa2e9('0x39')]);var _0x2d48ed={'where':_0x35fe81[_0xa2e9('0x3a')]};return db[_0xa2e9('0x27')]['count'](_0x2d48ed)[_0xa2e9('0x23')](function(_0x32bd1e){_0x307c89[_0xa2e9('0x1c')]=_0x32bd1e;if(_0x565714[_0xa2e9('0x2b')][_0xa2e9('0x3b')]){_0x35fe81[_0xa2e9('0x3c')]=[{'all':!![]}];}return db['ZohoAccount']['findAll'](_0x35fe81);})['then'](function(_0x50b0e5){_0x307c89[_0xa2e9('0x3d')]=_0x50b0e5;return _0x307c89;})[_0xa2e9('0x23')](respondWithFilteredResult(_0x304b68,_0x35fe81))[_0xa2e9('0x3e')](handleError(_0x304b68,null));};exports['show']=function(_0x11c03f,_0x1c0a65){var _0x1fbef7={'raw':![],'where':{'id':_0x11c03f[_0xa2e9('0x3f')]['id']}},_0x162874={};_0x162874[_0xa2e9('0x2e')]=_[_0xa2e9('0x2a')](db[_0xa2e9('0x27')][_0xa2e9('0x28')]);_0x162874[_0xa2e9('0x2b')]=_[_0xa2e9('0x2a')](_0x11c03f[_0xa2e9('0x2b')]);_0x162874['filters']=_[_0xa2e9('0x2d')](_0x162874['model'],_0x162874[_0xa2e9('0x2b')]);_0x1fbef7[_0xa2e9('0x2f')]=_[_0xa2e9('0x2d')](_0x162874[_0xa2e9('0x2e')],qs['fields'](_0x11c03f['query'][_0xa2e9('0x30')]));_0x1fbef7[_0xa2e9('0x2f')]=_0x1fbef7[_0xa2e9('0x2f')][_0xa2e9('0x40')]?_0x1fbef7['attributes']:_0x162874[_0xa2e9('0x2e')];if(_0x11c03f['query'][_0xa2e9('0x3b')]){_0x1fbef7[_0xa2e9('0x3c')]=[{'all':!![]}];}_0x1fbef7=_['merge']({},_0x1fbef7,_0x11c03f['options']);return db[_0xa2e9('0x27')][_0xa2e9('0x41')](_0x1fbef7)[_0xa2e9('0x23')](handleEntityNotFound(_0x1c0a65,null))[_0xa2e9('0x23')](respondWithResult(_0x1c0a65,null))[_0xa2e9('0x3e')](handleError(_0x1c0a65,null));};exports[_0xa2e9('0x42')]=function(_0x306de6,_0x3bb019){return db[_0xa2e9('0x27')]['create'](_0x306de6[_0xa2e9('0x43')],{})['then'](respondWithResult(_0x3bb019,0xc9))['catch'](handleError(_0x3bb019,null));};exports[_0xa2e9('0x21')]=function(_0x3c823a,_0x3ed420){if(_0x3c823a[_0xa2e9('0x43')]['id']){delete _0x3c823a['body']['id'];}return db[_0xa2e9('0x27')][_0xa2e9('0x41')]({'where':{'id':_0x3c823a[_0xa2e9('0x3f')]['id']}})[_0xa2e9('0x23')](handleEntityNotFound(_0x3ed420,null))[_0xa2e9('0x23')](saveUpdates(_0x3c823a[_0xa2e9('0x43')],null))['then'](respondWithResult(_0x3ed420,null))[_0xa2e9('0x3e')](handleError(_0x3ed420,null));};exports['destroy']=function(_0x184b05,_0x2de325){return db['ZohoAccount'][_0xa2e9('0x41')]({'where':{'id':_0x184b05[_0xa2e9('0x3f')]['id']}})[_0xa2e9('0x23')](handleEntityNotFound(_0x2de325,null))[_0xa2e9('0x23')](removeEntity(_0x2de325,null))[_0xa2e9('0x3e')](handleError(_0x2de325,null));};exports[_0xa2e9('0x44')]=function(_0x50e650,_0x1e5c82,_0x55f91a){var _0x53f140={};var _0x116fd1={};var _0x43245a;var _0x5bbd07;return db[_0xa2e9('0x27')][_0xa2e9('0x45')]({'where':{'id':_0x50e650['params']['id']}})[_0xa2e9('0x23')](handleEntityNotFound(_0x1e5c82,null))[_0xa2e9('0x23')](function(_0x3b9b59){if(_0x3b9b59){_0x43245a=_0x3b9b59;_0x116fd1[_0xa2e9('0x2e')]=_[_0xa2e9('0x2a')](db[_0xa2e9('0x46')][_0xa2e9('0x28')]);_0x116fd1[_0xa2e9('0x2b')]=_['keys'](_0x50e650[_0xa2e9('0x2b')]);_0x116fd1[_0xa2e9('0x2c')]=_['intersection'](_0x116fd1[_0xa2e9('0x2e')],_0x116fd1[_0xa2e9('0x2b')]);_0x53f140['attributes']=_['intersection'](_0x116fd1['model'],qs['fields'](_0x50e650[_0xa2e9('0x2b')]['fields']));_0x53f140['attributes']=_0x53f140[_0xa2e9('0x2f')][_0xa2e9('0x40')]?_0x53f140[_0xa2e9('0x2f')]:_0x116fd1[_0xa2e9('0x2e')];_0x53f140['order']=qs[_0xa2e9('0x33')](_0x50e650[_0xa2e9('0x2b')][_0xa2e9('0x33')]);_0x53f140[_0xa2e9('0x3a')]=qs['filters'](_[_0xa2e9('0x34')](_0x50e650[_0xa2e9('0x2b')],_0x116fd1[_0xa2e9('0x2c')]));if(_0x50e650[_0xa2e9('0x2b')][_0xa2e9('0x35')]){_0x53f140[_0xa2e9('0x3a')]=_[_0xa2e9('0x36')](_0x53f140[_0xa2e9('0x3a')],{'$or':_[_0xa2e9('0x37')](_0x53f140[_0xa2e9('0x2f')],function(_0x534b4f){var _0x5cb9cd={};_0x5cb9cd[_0x534b4f]={'$like':'%'+_0x50e650[_0xa2e9('0x2b')]['filter']+'%'};return _0x5cb9cd;})});}_0x53f140=_[_0xa2e9('0x36')]({},_0x53f140,_0x50e650[_0xa2e9('0x39')]);return _0x43245a[_0xa2e9('0x44')](_0x53f140);}})[_0xa2e9('0x23')](function(_0x4773df){if(_0x4773df){_0x5bbd07=_0x4773df[_0xa2e9('0x40')];if(!_0x50e650[_0xa2e9('0x2b')][_0xa2e9('0x47')](_0xa2e9('0x48'))){_0x53f140[_0xa2e9('0x31')]=qs[_0xa2e9('0x31')](_0x50e650[_0xa2e9('0x2b')][_0xa2e9('0x31')]);_0x53f140['offset']=qs['offset'](_0x50e650[_0xa2e9('0x2b')]['offset']);}return _0x43245a[_0xa2e9('0x44')](_0x53f140);}})['then'](function(_0x37c02a){if(_0x37c02a){return _0x37c02a?{'count':_0x5bbd07,'rows':_0x37c02a}:null;}})[_0xa2e9('0x23')](respondWithResult(_0x1e5c82,null))[_0xa2e9('0x3e')](handleError(_0x1e5c82,null));};exports[_0xa2e9('0x49')]=function(_0x2eb76a,_0x290245,_0x228d1d){if(_0x2eb76a[_0xa2e9('0x43')]['id']){delete _0x2eb76a['body']['id'];}return db[_0xa2e9('0x27')][_0xa2e9('0x45')]({'where':{'id':_0x2eb76a[_0xa2e9('0x3f')]['id']}})[_0xa2e9('0x23')](handleEntityNotFound(_0x290245,null))['then'](function(_0x4d465a){if(_0x4d465a){_0x2eb76a[_0xa2e9('0x43')][_0xa2e9('0x4a')]=_0x4d465a['id'];_0x2eb76a['body'][_0xa2e9('0x4b')]=integrations[_0xa2e9('0x4c')](_0x2eb76a['body'][_0xa2e9('0x4d')],_0x2eb76a[_0xa2e9('0x43')][_0xa2e9('0x4e')]);_0x2eb76a[_0xa2e9('0x43')][_0xa2e9('0x4f')]=integrations[_0xa2e9('0x50')](_0x2eb76a['body']['channel'],_0x2eb76a['body'][_0xa2e9('0x4e')]);return db[_0xa2e9('0x46')][_0xa2e9('0x42')](_0x2eb76a[_0xa2e9('0x43')],{'include':[{'model':db[_0xa2e9('0x51')],'as':'Subjects'},{'model':db[_0xa2e9('0x51')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x290245,null))['catch'](handleError(_0x290245,null));};function getAccessToken(_0x2c1300){return new Promise(function(_0x17fd9c,_0x3e381d){var _0x501cd7;switch(_0x2c1300['zone']){case'US':_0x501cd7='https://accounts.zoho.com';break;case'AU':_0x501cd7=_0xa2e9('0x52');break;case'EU':_0x501cd7=_0xa2e9('0x53');break;case'IN':_0x501cd7='https://accounts.zoho.in';break;case'CN':_0x501cd7='https://accounts.zoho.com.cn';break;default:_0x501cd7=_0xa2e9('0x53');break;}var _0x2b636b={'method':'POST','uri':_0x501cd7+_0xa2e9('0x54'),'qs':{'refresh_token':_0x2c1300[_0xa2e9('0x55')],'client_id':_0x2c1300[_0xa2e9('0x56')],'client_secret':_0x2c1300[_0xa2e9('0x57')],'grant_type':_0xa2e9('0x58')},'json':!![]};return rp(_0x2b636b)[_0xa2e9('0x23')](function(_0x18c0f4){if(_0x18c0f4['access_token']){_0x17fd9c(_0x18c0f4[_0xa2e9('0x59')]);}else{_0x3e381d(_0xa2e9('0x5a'));}})[_0xa2e9('0x3e')](function(_0x5e19e2){_0x3e381d(_0x5e19e2);});});}exports[_0xa2e9('0x5b')]=function(_0x1296d6,_0x406adc,_0x1f2bf5){var _0x2da569,_0x315534,_0x5b80b9,_0x58a207,_0x26fbc8;return db['ZohoAccount'][_0xa2e9('0x45')]({'where':{'id':_0x1296d6['params']['id']},'attributes':['id',_0xa2e9('0x5c'),_0xa2e9('0x5d'),_0xa2e9('0x56'),_0xa2e9('0x57'),_0xa2e9('0x5e'),_0xa2e9('0x5f'),_0xa2e9('0x55')]})['then'](handleEntityNotFound(_0x406adc,null))[_0xa2e9('0x23')](function(_0x9b7ab0){_0x26fbc8=_0x9b7ab0;_0x2da569=_0x26fbc8[_0xa2e9('0x5c')];_0x315534=_0x2da569===_0xa2e9('0x60')?'eu':_0xa2e9('0x61');_0x5b80b9=_0x26fbc8[_0xa2e9('0x5e')];var _0x22b558=_0x5b80b9[_0xa2e9('0x62')](-0x1);if(_0x22b558==='/'||_0x22b558==='\x5c'||_0x22b558===':'){_0x5b80b9=_0x5b80b9[_0xa2e9('0x63')](0x0,_0x5b80b9[_0xa2e9('0x64')](_0x22b558));}if(!_0x26fbc8[_0xa2e9('0x55')]){throw new Error(_0xa2e9('0x65'));}return getAccessToken(_0x26fbc8);})['then'](function(_0x33acc3){if(_0x33acc3){return rp({'method':_0xa2e9('0x66'),'uri':util['format'](_0xa2e9('0x67'),_0x315534),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x33acc3},'json':!![]});}})[_0xa2e9('0x23')](function(_0x1ee3f4){if(_0x1ee3f4){if(_0x1ee3f4[_0xa2e9('0x68')]&&_0x1ee3f4['response']['error']){throw new Error(_0x1ee3f4[_0xa2e9('0x68')][_0xa2e9('0x24')][_0xa2e9('0x69')]);}var _0x11249c=[];var _0x2501ed=[];var _0x429599=[_0xa2e9('0x6a'),_0xa2e9('0x6b'),_0xa2e9('0x6c'),_0xa2e9('0x6d'),_0xa2e9('0x6e'),'Call_Result','Call_Start_Time',_0xa2e9('0x6f')];_0x2501ed=_[_0xa2e9('0x70')](_0x1ee3f4[_0xa2e9('0x30')],function(_0x573290){return _0x429599[_0xa2e9('0x71')](_0x573290[_0xa2e9('0x72')]);});for(var _0xbecc00=0x0;_0xbecc00<_0x2501ed[_0xa2e9('0x40')];_0xbecc00++){if(_0x2501ed[_0xbecc00][_0xa2e9('0x73')]===![]){_0x11249c[_0xa2e9('0x74')]({'id':_0x2501ed[_0xbecc00]['id'],'name':_0x2501ed[_0xbecc00][_0xa2e9('0x75')],'custom':_0x2501ed[_0xbecc00][_0xa2e9('0x76')],'options':_0x2501ed[_0xbecc00]['data_type']===_0xa2e9('0x77')&&_0x2501ed[_0xbecc00][_0xa2e9('0x78')][_0xa2e9('0x40')]>-0x1?_[_0xa2e9('0x37')](_0x2501ed[_0xbecc00]['pick_list_values'],function(_0x469b26){return{'name':_0x469b26,'value':_0x469b26};}):[]});}}return{'count':_0x11249c[_0xa2e9('0x40')],'rows':_0x11249c};}else{return{'count':0x0,'rows':[]};}})[_0xa2e9('0x23')](respondWithResult(_0x406adc,null))[_0xa2e9('0x3e')](function(_0x42be51){var _0x551f20=_0x1296d6[_0xa2e9('0x2b')][_0xa2e9('0x79')]?0x1f4:_0x42be51[_0xa2e9('0x7a')]||0x1f4;logger[_0xa2e9('0x24')](_0xa2e9('0x7b'),_0xa2e9('0x5b'),_0x551f20,JSON[_0xa2e9('0x7c')](_0x42be51));delete _0x42be51[_0xa2e9('0x26')];if(_0x551f20===0x191){_0x551f20=0x190;}_0x406adc[_0xa2e9('0x18')](_0x551f20)[_0xa2e9('0x7d')](_0x1296d6[_0xa2e9('0x2b')][_0xa2e9('0x79')]?{'message':'Wrong\x20credentials','statusCode':_0x42be51[_0xa2e9('0x7a')]}:_0x42be51);});}; \ No newline at end of file +var _0xe463=['intersection','model','fields','attributes','length','query','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','create','body','find','params','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','com','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Owner','Subject','Description','WhoId','Call_Type','remove','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','keys','filters'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe463,0x1cd));var _0x3e46=function(_0x161017,_0x43c140){_0x161017=_0x161017-0x0;var _0xc83ff2=_0xe463[_0x161017];return _0xc83ff2;};'use strict';var emlformat=require(_0x3e46('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3e46('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3e46('0x2'));var moment=require(_0x3e46('0x3'));var BPromise=require(_0x3e46('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3e46('0x5'));var sox=require(_0x3e46('0x6'));var csv=require('to-csv');var ejs=require(_0x3e46('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3e46('0x8'));var squel=require(_0x3e46('0x9'));var crypto=require(_0x3e46('0xa'));var jsforce=require(_0x3e46('0xb'));var deskjs=require(_0x3e46('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3e46('0xd'));var Redis=require(_0x3e46('0xe'));var authService=require(_0x3e46('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3e46('0x10'));var hardwareService=require(_0x3e46('0x11'));var logger=require(_0x3e46('0x12'))(_0x3e46('0x13'));var utils=require(_0x3e46('0x14'));var config=require(_0x3e46('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3e46('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4605d1,_0x6a724b){_0x6a724b=_0x6a724b||0xcc;return function(_0x486ca6){if(_0x486ca6){return _0x4605d1[_0x3e46('0x17')](_0x6a724b);}return _0x4605d1[_0x3e46('0x18')](_0x6a724b)[_0x3e46('0x19')]();};}function respondWithResult(_0x5e7bb0,_0x301427){_0x301427=_0x301427||0xc8;return function(_0x520926){if(_0x520926){return _0x5e7bb0[_0x3e46('0x18')](_0x301427)[_0x3e46('0x1a')](_0x520926);}};}function respondWithFilteredResult(_0x4f2e84,_0x1ab437){return function(_0x4a82b3){if(_0x4a82b3){var _0x5f295f=typeof _0x1ab437[_0x3e46('0x1b')]==='undefined'&&typeof _0x1ab437[_0x3e46('0x1c')]===_0x3e46('0x1d');var _0x2eb192=_0x4a82b3[_0x3e46('0x1e')];var _0x53913a=_0x5f295f?0x0:_0x1ab437[_0x3e46('0x1b')];var _0x32c1bb=_0x5f295f?_0x4a82b3[_0x3e46('0x1e')]:_0x1ab437[_0x3e46('0x1b')]+_0x1ab437['limit'];var _0x4160fb;if(_0x32c1bb>=_0x2eb192){_0x32c1bb=_0x2eb192;_0x4160fb=0xc8;}else{_0x4160fb=0xce;}_0x4f2e84['status'](_0x4160fb);return _0x4f2e84[_0x3e46('0x1f')](_0x3e46('0x20'),_0x53913a+'-'+_0x32c1bb+'/'+_0x2eb192)[_0x3e46('0x1a')](_0x4a82b3);}return null;};}function patchUpdates(_0xeada6e){return function(_0x710f86){try{jsonpatch[_0x3e46('0x21')](_0x710f86,_0xeada6e,!![]);}catch(_0x46f905){return BPromise[_0x3e46('0x22')](_0x46f905);}return _0x710f86[_0x3e46('0x23')]();};}function saveUpdates(_0x5cb3b4,_0x4e8bc5){return function(_0x3f5e00){if(_0x3f5e00){return _0x3f5e00[_0x3e46('0x24')](_0x5cb3b4)['then'](function(_0x4a7913){return _0x4a7913;});}return null;};}function removeEntity(_0x11c2ed,_0x370c37){return function(_0x2fc65c){if(_0x2fc65c){return _0x2fc65c[_0x3e46('0x25')]()[_0x3e46('0x26')](function(){_0x11c2ed[_0x3e46('0x18')](0xcc)[_0x3e46('0x19')]();});}};}function handleEntityNotFound(_0x45d6f5,_0x3e7c6b){return function(_0x4d805c){if(!_0x4d805c){_0x45d6f5['sendStatus'](0x194);}return _0x4d805c;};}function handleError(_0x4e76cb,_0x47d3f3){_0x47d3f3=_0x47d3f3||0x1f4;return function(_0x6c8744){logger[_0x3e46('0x27')](_0x6c8744['stack']);if(_0x6c8744['name']){delete _0x6c8744[_0x3e46('0x28')];}_0x4e76cb['status'](_0x47d3f3)[_0x3e46('0x29')](_0x6c8744);};}exports[_0x3e46('0x2a')]=function(_0xa021d,_0x1ffacf){var _0x13ca7a={},_0x269fec={},_0x2025ec={'count':0x0,'rows':[]};var _0x49d2dc=_[_0x3e46('0x2b')](db[_0x3e46('0x2c')][_0x3e46('0x2d')],function(_0x1689ae){return{'name':_0x1689ae[_0x3e46('0x2e')],'type':_0x1689ae[_0x3e46('0x2f')][_0x3e46('0x30')]};});_0x269fec['model']=_[_0x3e46('0x2b')](_0x49d2dc,_0x3e46('0x28'));_0x269fec['query']=_[_0x3e46('0x31')](_0xa021d['query']);_0x269fec[_0x3e46('0x32')]=_['intersection'](_0x269fec['model'],_0x269fec['query']);_0x13ca7a['attributes']=_[_0x3e46('0x33')](_0x269fec[_0x3e46('0x34')],qs[_0x3e46('0x35')](_0xa021d['query'][_0x3e46('0x35')]));_0x13ca7a[_0x3e46('0x36')]=_0x13ca7a['attributes'][_0x3e46('0x37')]?_0x13ca7a[_0x3e46('0x36')]:_0x269fec[_0x3e46('0x34')];if(!_0xa021d[_0x3e46('0x38')][_0x3e46('0x39')](_0x3e46('0x3a'))){_0x13ca7a[_0x3e46('0x1c')]=qs[_0x3e46('0x1c')](_0xa021d[_0x3e46('0x38')]['limit']);_0x13ca7a[_0x3e46('0x1b')]=qs[_0x3e46('0x1b')](_0xa021d[_0x3e46('0x38')][_0x3e46('0x1b')]);}_0x13ca7a[_0x3e46('0x3b')]=qs[_0x3e46('0x3c')](_0xa021d[_0x3e46('0x38')][_0x3e46('0x3c')]);_0x13ca7a[_0x3e46('0x3d')]=qs[_0x3e46('0x32')](_[_0x3e46('0x3e')](_0xa021d['query'],_0x269fec['filters']),_0x49d2dc);if(_0xa021d[_0x3e46('0x38')][_0x3e46('0x3f')]){_0x13ca7a[_0x3e46('0x3d')]=_[_0x3e46('0x40')](_0x13ca7a[_0x3e46('0x3d')],{'$or':_[_0x3e46('0x2b')](_0x49d2dc,function(_0x59e1f1){if(_0x59e1f1[_0x3e46('0x2f')]!==_0x3e46('0x41')){var _0x546c2e={};_0x546c2e[_0x59e1f1['name']]={'$like':'%'+_0xa021d[_0x3e46('0x38')][_0x3e46('0x3f')]+'%'};return _0x546c2e;}})});}_0x13ca7a=_[_0x3e46('0x40')]({},_0x13ca7a,_0xa021d[_0x3e46('0x42')]);var _0x573f86={'where':_0x13ca7a[_0x3e46('0x3d')]};return db['ZohoAccount'][_0x3e46('0x1e')](_0x573f86)[_0x3e46('0x26')](function(_0x458ef6){_0x2025ec['count']=_0x458ef6;if(_0xa021d[_0x3e46('0x38')][_0x3e46('0x43')]){_0x13ca7a['include']=[{'all':!![]}];}return db[_0x3e46('0x2c')][_0x3e46('0x44')](_0x13ca7a);})[_0x3e46('0x26')](function(_0x206168){_0x2025ec[_0x3e46('0x45')]=_0x206168;return _0x2025ec;})[_0x3e46('0x26')](respondWithFilteredResult(_0x1ffacf,_0x13ca7a))[_0x3e46('0x46')](handleError(_0x1ffacf,null));};exports[_0x3e46('0x47')]=function(_0x2f9698,_0x4cf377){var _0x342b77={'raw':![],'where':{'id':_0x2f9698['params']['id']}},_0x498dbd={};_0x498dbd['model']=_[_0x3e46('0x31')](db[_0x3e46('0x2c')][_0x3e46('0x2d')]);_0x498dbd[_0x3e46('0x38')]=_[_0x3e46('0x31')](_0x2f9698['query']);_0x498dbd[_0x3e46('0x32')]=_[_0x3e46('0x33')](_0x498dbd[_0x3e46('0x34')],_0x498dbd['query']);_0x342b77[_0x3e46('0x36')]=_[_0x3e46('0x33')](_0x498dbd['model'],qs[_0x3e46('0x35')](_0x2f9698[_0x3e46('0x38')][_0x3e46('0x35')]));_0x342b77['attributes']=_0x342b77[_0x3e46('0x36')]['length']?_0x342b77['attributes']:_0x498dbd['model'];if(_0x2f9698[_0x3e46('0x38')][_0x3e46('0x43')]){_0x342b77[_0x3e46('0x48')]=[{'all':!![]}];}_0x342b77=_[_0x3e46('0x40')]({},_0x342b77,_0x2f9698[_0x3e46('0x42')]);return db[_0x3e46('0x2c')]['find'](_0x342b77)['then'](handleEntityNotFound(_0x4cf377,null))[_0x3e46('0x26')](respondWithResult(_0x4cf377,null))[_0x3e46('0x46')](handleError(_0x4cf377,null));};exports[_0x3e46('0x49')]=function(_0x5e22be,_0x20a183){return db[_0x3e46('0x2c')][_0x3e46('0x49')](_0x5e22be['body'],{})[_0x3e46('0x26')](respondWithResult(_0x20a183,0xc9))[_0x3e46('0x46')](handleError(_0x20a183,null));};exports[_0x3e46('0x24')]=function(_0x18a700,_0x212c96){if(_0x18a700[_0x3e46('0x4a')]['id']){delete _0x18a700[_0x3e46('0x4a')]['id'];}return db[_0x3e46('0x2c')]['find']({'where':{'id':_0x18a700['params']['id']}})[_0x3e46('0x26')](handleEntityNotFound(_0x212c96,null))[_0x3e46('0x26')](saveUpdates(_0x18a700[_0x3e46('0x4a')],null))[_0x3e46('0x26')](respondWithResult(_0x212c96,null))[_0x3e46('0x46')](handleError(_0x212c96,null));};exports[_0x3e46('0x25')]=function(_0x11f493,_0x553bfa){return db[_0x3e46('0x2c')][_0x3e46('0x4b')]({'where':{'id':_0x11f493[_0x3e46('0x4c')]['id']}})['then'](handleEntityNotFound(_0x553bfa,null))['then'](removeEntity(_0x553bfa,null))[_0x3e46('0x46')](handleError(_0x553bfa,null));};exports[_0x3e46('0x4d')]=function(_0x1d0162,_0x1087b5,_0x11be6c){var _0x227a45={};var _0x2a3e06={};var _0x4a7c63;var _0x291fb2;return db['ZohoAccount'][_0x3e46('0x4e')]({'where':{'id':_0x1d0162[_0x3e46('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1087b5,null))[_0x3e46('0x26')](function(_0x3cb74b){if(_0x3cb74b){_0x4a7c63=_0x3cb74b;_0x2a3e06[_0x3e46('0x34')]=_[_0x3e46('0x31')](db[_0x3e46('0x4f')][_0x3e46('0x2d')]);_0x2a3e06[_0x3e46('0x38')]=_[_0x3e46('0x31')](_0x1d0162[_0x3e46('0x38')]);_0x2a3e06[_0x3e46('0x32')]=_[_0x3e46('0x33')](_0x2a3e06['model'],_0x2a3e06[_0x3e46('0x38')]);_0x227a45[_0x3e46('0x36')]=_[_0x3e46('0x33')](_0x2a3e06['model'],qs[_0x3e46('0x35')](_0x1d0162[_0x3e46('0x38')][_0x3e46('0x35')]));_0x227a45[_0x3e46('0x36')]=_0x227a45[_0x3e46('0x36')][_0x3e46('0x37')]?_0x227a45['attributes']:_0x2a3e06['model'];_0x227a45[_0x3e46('0x3b')]=qs[_0x3e46('0x3c')](_0x1d0162[_0x3e46('0x38')][_0x3e46('0x3c')]);_0x227a45[_0x3e46('0x3d')]=qs[_0x3e46('0x32')](_[_0x3e46('0x3e')](_0x1d0162[_0x3e46('0x38')],_0x2a3e06['filters']));if(_0x1d0162[_0x3e46('0x38')]['filter']){_0x227a45['where']=_['merge'](_0x227a45[_0x3e46('0x3d')],{'$or':_[_0x3e46('0x2b')](_0x227a45['attributes'],function(_0x8c0702){var _0x5a52b6={};_0x5a52b6[_0x8c0702]={'$like':'%'+_0x1d0162[_0x3e46('0x38')]['filter']+'%'};return _0x5a52b6;})});}_0x227a45=_['merge']({},_0x227a45,_0x1d0162[_0x3e46('0x42')]);return _0x4a7c63[_0x3e46('0x4d')](_0x227a45);}})['then'](function(_0x426d1d){if(_0x426d1d){_0x291fb2=_0x426d1d[_0x3e46('0x37')];if(!_0x1d0162[_0x3e46('0x38')]['hasOwnProperty'](_0x3e46('0x3a'))){_0x227a45['limit']=qs['limit'](_0x1d0162[_0x3e46('0x38')][_0x3e46('0x1c')]);_0x227a45[_0x3e46('0x1b')]=qs[_0x3e46('0x1b')](_0x1d0162[_0x3e46('0x38')]['offset']);}return _0x4a7c63[_0x3e46('0x4d')](_0x227a45);}})['then'](function(_0xaeb535){if(_0xaeb535){return _0xaeb535?{'count':_0x291fb2,'rows':_0xaeb535}:null;}})[_0x3e46('0x26')](respondWithResult(_0x1087b5,null))[_0x3e46('0x46')](handleError(_0x1087b5,null));};exports[_0x3e46('0x50')]=function(_0x152156,_0x4d96a6,_0x3027ee){if(_0x152156[_0x3e46('0x4a')]['id']){delete _0x152156[_0x3e46('0x4a')]['id'];}return db[_0x3e46('0x2c')][_0x3e46('0x4e')]({'where':{'id':_0x152156[_0x3e46('0x4c')]['id']}})[_0x3e46('0x26')](handleEntityNotFound(_0x4d96a6,null))[_0x3e46('0x26')](function(_0x1e4bfc){if(_0x1e4bfc){_0x152156['body'][_0x3e46('0x51')]=_0x1e4bfc['id'];_0x152156['body'][_0x3e46('0x52')]=integrations[_0x3e46('0x53')](_0x152156[_0x3e46('0x4a')][_0x3e46('0x54')],_0x152156[_0x3e46('0x4a')][_0x3e46('0x2f')]);_0x152156[_0x3e46('0x4a')]['Descriptions']=integrations['getDescriptions'](_0x152156[_0x3e46('0x4a')][_0x3e46('0x54')],_0x152156[_0x3e46('0x4a')][_0x3e46('0x2f')]);return db[_0x3e46('0x4f')]['create'](_0x152156['body'],{'include':[{'model':db[_0x3e46('0x55')],'as':_0x3e46('0x52')},{'model':db[_0x3e46('0x55')],'as':_0x3e46('0x56')}]});}return null;})[_0x3e46('0x26')](respondWithResult(_0x4d96a6,null))[_0x3e46('0x46')](handleError(_0x4d96a6,null));};function getAccessToken(_0x30e15a){return new Promise(function(_0x4e2c64,_0x5c40cf){var _0x8e03c6;switch(_0x30e15a[_0x3e46('0x57')]){case'US':_0x8e03c6=_0x3e46('0x58');break;case'AU':_0x8e03c6=_0x3e46('0x59');break;case'EU':_0x8e03c6=_0x3e46('0x5a');break;case'IN':_0x8e03c6=_0x3e46('0x5b');break;case'CN':_0x8e03c6=_0x3e46('0x5c');break;default:_0x8e03c6='https://accounts.zoho.eu';break;}var _0x28b0be={'method':_0x3e46('0x5d'),'uri':_0x8e03c6+_0x3e46('0x5e'),'qs':{'refresh_token':_0x30e15a[_0x3e46('0x5f')],'client_id':_0x30e15a[_0x3e46('0x60')],'client_secret':_0x30e15a[_0x3e46('0x61')],'grant_type':_0x3e46('0x62')},'json':!![]};return rp(_0x28b0be)['then'](function(_0x1ef22b){if(_0x1ef22b[_0x3e46('0x63')]){_0x4e2c64(_0x1ef22b['access_token']);}else{_0x5c40cf('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x142f77){_0x5c40cf(_0x142f77);});});}exports[_0x3e46('0x64')]=function(_0x2d2b7d,_0x1e33ad,_0x2ef610){var _0x414a53,_0x28caa6,_0x15fa56,_0x4ec6b3,_0x321f79;return db[_0x3e46('0x2c')][_0x3e46('0x4e')]({'where':{'id':_0x2d2b7d[_0x3e46('0x4c')]['id']},'attributes':['id',_0x3e46('0x65'),_0x3e46('0x57'),_0x3e46('0x60'),_0x3e46('0x61'),_0x3e46('0x66'),'code','refreshToken']})[_0x3e46('0x26')](handleEntityNotFound(_0x1e33ad,null))[_0x3e46('0x26')](function(_0x360550){_0x321f79=_0x360550;_0x414a53=_0x321f79[_0x3e46('0x65')];_0x28caa6=_0x414a53==='zoho.eu'?'eu':_0x3e46('0x67');_0x15fa56=_0x321f79[_0x3e46('0x66')];var _0x17b93e=_0x15fa56['slice'](-0x1);if(_0x17b93e==='/'||_0x17b93e==='\x5c'||_0x17b93e===':'){_0x15fa56=_0x15fa56['substring'](0x0,_0x15fa56['lastIndexOf'](_0x17b93e));}if(!_0x321f79['refreshToken']){throw new Error(_0x3e46('0x68'));}return getAccessToken(_0x321f79);})['then'](function(_0x1036fd){if(_0x1036fd){return rp({'method':'GET','uri':util[_0x3e46('0x69')](_0x3e46('0x6a'),_0x28caa6),'qs':{'module':_0x3e46('0x6b')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1036fd},'json':!![]});}})[_0x3e46('0x26')](function(_0x42f75d){if(_0x42f75d){if(_0x42f75d[_0x3e46('0x6c')]&&_0x42f75d[_0x3e46('0x6c')][_0x3e46('0x27')]){throw new Error(_0x42f75d[_0x3e46('0x6c')]['error'][_0x3e46('0x6d')]);}var _0x178b53=[];var _0x58df57=[];var _0x253b47=[_0x3e46('0x6e'),_0x3e46('0x6f'),_0x3e46('0x70'),_0x3e46('0x71'),'Call_Duration','Call_Result','Call_Start_Time',_0x3e46('0x72')];_0x58df57=_[_0x3e46('0x73')](_0x42f75d[_0x3e46('0x35')],function(_0x51f9a6){return _0x253b47['includes'](_0x51f9a6[_0x3e46('0x74')]);});for(var _0x5efe1e=0x0;_0x5efe1e<_0x58df57['length'];_0x5efe1e++){if(_0x58df57[_0x5efe1e][_0x3e46('0x75')]===![]){_0x178b53[_0x3e46('0x76')]({'id':_0x58df57[_0x5efe1e]['id'],'name':_0x58df57[_0x5efe1e][_0x3e46('0x77')],'custom':_0x58df57[_0x5efe1e][_0x3e46('0x78')],'options':_0x58df57[_0x5efe1e][_0x3e46('0x79')]===_0x3e46('0x7a')&&_0x58df57[_0x5efe1e][_0x3e46('0x7b')][_0x3e46('0x37')]>-0x1?_['map'](_0x58df57[_0x5efe1e]['pick_list_values'],function(_0x11dd60){return{'name':_0x11dd60,'value':_0x11dd60};}):[]});}}return{'count':_0x178b53[_0x3e46('0x37')],'rows':_0x178b53};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x1e33ad,null))['catch'](function(_0x15649e){var _0x1d3bf3=_0x2d2b7d[_0x3e46('0x38')][_0x3e46('0x7c')]?0x1f4:_0x15649e['statusCode']||0x1f4;logger[_0x3e46('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x3e46('0x64'),_0x1d3bf3,JSON[_0x3e46('0x7d')](_0x15649e));delete _0x15649e['name'];if(_0x1d3bf3===0x191){_0x1d3bf3=0x190;}_0x1e33ad[_0x3e46('0x18')](_0x1d3bf3)[_0x3e46('0x29')](_0x2d2b7d[_0x3e46('0x38')]['test']?{'message':_0x3e46('0x7e'),'statusCode':_0x15649e[_0x3e46('0x7f')]}:_0x15649e);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 2f5c67d..a5beaf6 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 _0x02c8=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','then','parse','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','inspect','catch','error','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','refreshToken','util'];(function(_0x5b049f,_0x4b03d8){var _0x14c5d8=function(_0x167cdc){while(--_0x167cdc){_0x5b049f['push'](_0x5b049f['shift']());}};_0x14c5d8(++_0x4b03d8);}(_0x02c8,0x13f));var _0x802c=function(_0x4b8596,_0x265231){_0x4b8596=_0x4b8596-0x0;var _0xe41f07=_0x02c8[_0x4b8596];return _0xe41f07;};'use strict';var _=require('lodash');var util=require(_0x802c('0x0'));var logger=require('../../config/logger')(_0x802c('0x1'));var moment=require('moment');var BPromise=require(_0x802c('0x2'));var rp=require(_0x802c('0x3'));var fs=require('fs');var path=require(_0x802c('0x4'));var rimraf=require(_0x802c('0x5'));var config=require(_0x802c('0x6'));var attributes=require(_0x802c('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x802c('0x8')]=function(_0x1563d1,_0xd1c94f){return _0x1563d1[_0x802c('0x9')]('ZohoAccount',attributes,{'tableName':_0x802c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2e6bbc,_0x1c46cb,_0x3ba21e){if(_0x2e6bbc[_0x802c('0xb')](_0x802c('0xc'))||_0x2e6bbc[_0x802c('0xb')](_0x802c('0xd'))||_0x2e6bbc['changed'](_0x802c('0xe'))||_0x2e6bbc[_0x802c('0xb')](_0x802c('0xf'))||_0x2e6bbc['changed'](_0x802c('0x10'))||_0x2e6bbc[_0x802c('0xb')](_0x802c('0x11'))){var _0x168042,_0x3b2ef4;_0x168042=_0x2e6bbc['serverUrl'];var _0x548dd1=_0x168042['slice'](-0x1);if(_0x548dd1==='/'||_0x548dd1==='\x5c'||_0x548dd1===':'){_0x168042=_0x168042[_0x802c('0x12')](0x0,_0x168042[_0x802c('0x13')](_0x548dd1));}switch(_0x2e6bbc[_0x802c('0xc')]){case'US':_0x3b2ef4=_0x802c('0x14');break;case'AU':_0x3b2ef4=_0x802c('0x15');break;case'IN':_0x3b2ef4=_0x802c('0x16');break;case'CN':_0x3b2ef4='https://accounts.zoho.com.cn';break;default:_0x3b2ef4=_0x802c('0x17');break;}var _0x4cb504={'method':_0x802c('0x18'),'uri':_0x3b2ef4+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x2e6bbc[_0x802c('0xe')],'client_secret':_0x2e6bbc[_0x802c('0xf')],'redirect_uri':_0x2e6bbc[_0x802c('0xd')],'code':_0x2e6bbc['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x4cb504)[_0x802c('0x19')](function(_0x136858){var _0x2edbca=JSON[_0x802c('0x1a')](_0x136858);if(_0x2edbca['refresh_token']){_0x2e6bbc['refreshToken']=_0x2edbca[_0x802c('0x1b')];logger[_0x802c('0x1c')](util[_0x802c('0x1d')](_0x802c('0x1e'),_0x2e6bbc[_0x802c('0x1f')],_0x2e6bbc['id']));}else{logger['error'](util[_0x802c('0x1d')](_0x802c('0x20'),_0x2e6bbc[_0x802c('0x1f')],_0x2e6bbc['id']),util[_0x802c('0x21')](_0x2edbca,{'showHidden':![],'depth':null}));}return _0x3ba21e(null,_0x1c46cb);})[_0x802c('0x22')](function(_0x359a5c){logger[_0x802c('0x23')](util[_0x802c('0x1d')](_0x802c('0x20'),_0x2e6bbc[_0x802c('0x1f')],_0x2e6bbc['id']),util[_0x802c('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x3ba21e(_0x359a5c);});}else{return _0x3ba21e(null,_0x1c46cb);}},'beforeUpdate':function(_0x19b33b,_0x457147,_0x29fef0){if(_0x19b33b['changed'](_0x802c('0xc'))||_0x19b33b[_0x802c('0xb')]('serverUrl')||_0x19b33b[_0x802c('0xb')](_0x802c('0xe'))||_0x19b33b[_0x802c('0xb')](_0x802c('0xf'))||_0x19b33b['changed'](_0x802c('0x10'))||_0x19b33b[_0x802c('0xb')]('host')){var _0x3e2fa4,_0x247fe6;_0x3e2fa4=_0x19b33b[_0x802c('0xd')];var _0x18ff7d=_0x3e2fa4['slice'](-0x1);if(_0x18ff7d==='/'||_0x18ff7d==='\x5c'||_0x18ff7d===':'){_0x3e2fa4=_0x3e2fa4[_0x802c('0x12')](0x0,_0x3e2fa4['lastIndexOf'](_0x18ff7d));}switch(_0x19b33b[_0x802c('0xc')]){case'US':_0x247fe6='https://accounts.zoho.com';break;case'AU':_0x247fe6=_0x802c('0x15');break;case'IN':_0x247fe6=_0x802c('0x16');break;case'CN':_0x247fe6='https://accounts.zoho.com.cn';break;default:_0x247fe6=_0x802c('0x17');break;}var _0x2d7009={'method':_0x802c('0x18'),'uri':_0x247fe6+_0x802c('0x24'),'form':{'grant_type':_0x802c('0x25'),'client_id':_0x19b33b['clientId'],'client_secret':_0x19b33b[_0x802c('0xf')],'redirect_uri':_0x19b33b[_0x802c('0xd')],'code':_0x19b33b[_0x802c('0x10')]},'headers':{'Content-Type':_0x802c('0x26')}};return rp(_0x2d7009)['then'](function(_0x47b49b){var _0x5b07cc=JSON['parse'](_0x47b49b);if(_0x5b07cc['refresh_token']){_0x19b33b[_0x802c('0x27')]=_0x5b07cc[_0x802c('0x1b')];logger[_0x802c('0x1c')](util[_0x802c('0x1d')](_0x802c('0x1e'),_0x19b33b[_0x802c('0x1f')],_0x19b33b['id']));}else{logger['error'](util[_0x802c('0x1d')](_0x802c('0x20'),_0x19b33b[_0x802c('0x1f')],_0x19b33b['id']),util[_0x802c('0x21')](_0x5b07cc,{'showHidden':![],'depth':null}));}return _0x29fef0(null,_0x457147);})['catch'](function(_0x99778f){logger[_0x802c('0x23')](util[_0x802c('0x1d')](_0x802c('0x20'),_0x19b33b[_0x802c('0x1f')],_0x19b33b['id']),util[_0x802c('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x29fef0(_0x99778f);});}else{return _0x29fef0(null,_0x457147);}}}});}; \ No newline at end of file +var _0xbd32=['host','serverUrl','slice','substring','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','lastIndexOf','authorization_code','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','define','int_zoho_accounts','changed','zone','clientId','clientSecret','code'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xbd32,0x6a));var _0x2bd3=function(_0x13c307,_0x380d64){_0x13c307=_0x13c307-0x0;var _0x495b57=_0xbd32[_0x13c307];return _0x495b57;};'use strict';var _=require(_0x2bd3('0x0'));var util=require('util');var logger=require(_0x2bd3('0x1'))(_0x2bd3('0x2'));var moment=require(_0x2bd3('0x3'));var BPromise=require(_0x2bd3('0x4'));var rp=require(_0x2bd3('0x5'));var fs=require('fs');var path=require(_0x2bd3('0x6'));var rimraf=require(_0x2bd3('0x7'));var config=require('../../config/environment');var attributes=require(_0x2bd3('0x8'));var integrations=require(_0x2bd3('0x9'));module['exports']=function(_0x1ebf6a,_0x3f8b11){return _0x1ebf6a[_0x2bd3('0xa')]('ZohoAccount',attributes,{'tableName':_0x2bd3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4cd2cd,_0x228282,_0x2f3da8){if(_0x4cd2cd[_0x2bd3('0xc')](_0x2bd3('0xd'))||_0x4cd2cd[_0x2bd3('0xc')]('serverUrl')||_0x4cd2cd[_0x2bd3('0xc')](_0x2bd3('0xe'))||_0x4cd2cd['changed'](_0x2bd3('0xf'))||_0x4cd2cd['changed'](_0x2bd3('0x10'))||_0x4cd2cd['changed'](_0x2bd3('0x11'))){var _0x219aa0,_0x354fc3;_0x219aa0=_0x4cd2cd[_0x2bd3('0x12')];var _0x1f3286=_0x219aa0[_0x2bd3('0x13')](-0x1);if(_0x1f3286==='/'||_0x1f3286==='\x5c'||_0x1f3286===':'){_0x219aa0=_0x219aa0[_0x2bd3('0x14')](0x0,_0x219aa0['lastIndexOf'](_0x1f3286));}switch(_0x4cd2cd[_0x2bd3('0xd')]){case'US':_0x354fc3=_0x2bd3('0x15');break;case'AU':_0x354fc3='https://accounts.zoho.com.au';break;case'IN':_0x354fc3=_0x2bd3('0x16');break;case'CN':_0x354fc3=_0x2bd3('0x17');break;default:_0x354fc3=_0x2bd3('0x18');break;}var _0x207f0f={'method':_0x2bd3('0x19'),'uri':_0x354fc3+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x4cd2cd[_0x2bd3('0xe')],'client_secret':_0x4cd2cd[_0x2bd3('0xf')],'redirect_uri':_0x4cd2cd[_0x2bd3('0x12')],'code':_0x4cd2cd[_0x2bd3('0x10')]},'headers':{'Content-Type':_0x2bd3('0x1a')}};return rp(_0x207f0f)[_0x2bd3('0x1b')](function(_0xbfb119){var _0x53a941=JSON[_0x2bd3('0x1c')](_0xbfb119);if(_0x53a941['refresh_token']){_0x4cd2cd[_0x2bd3('0x1d')]=_0x53a941[_0x2bd3('0x1e')];logger[_0x2bd3('0x1f')](util[_0x2bd3('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4cd2cd[_0x2bd3('0x21')],_0x4cd2cd['id']));}else{logger[_0x2bd3('0x22')](util[_0x2bd3('0x20')](_0x2bd3('0x23'),_0x4cd2cd[_0x2bd3('0x21')],_0x4cd2cd['id']),util[_0x2bd3('0x24')](_0x53a941,{'showHidden':![],'depth':null}));}return _0x2f3da8(null,_0x228282);})[_0x2bd3('0x25')](function(_0x239a82){logger['error'](util['format'](_0x2bd3('0x23'),_0x4cd2cd[_0x2bd3('0x21')],_0x4cd2cd['id']),util[_0x2bd3('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x2f3da8(_0x239a82);});}else{return _0x2f3da8(null,_0x228282);}},'beforeUpdate':function(_0x5c0314,_0x574c31,_0x4879d2){if(_0x5c0314[_0x2bd3('0xc')](_0x2bd3('0xd'))||_0x5c0314[_0x2bd3('0xc')](_0x2bd3('0x12'))||_0x5c0314[_0x2bd3('0xc')]('clientId')||_0x5c0314['changed']('clientSecret')||_0x5c0314['changed']('code')||_0x5c0314['changed'](_0x2bd3('0x11'))){var _0x3e958e,_0x2ff143;_0x3e958e=_0x5c0314[_0x2bd3('0x12')];var _0x23792d=_0x3e958e['slice'](-0x1);if(_0x23792d==='/'||_0x23792d==='\x5c'||_0x23792d===':'){_0x3e958e=_0x3e958e[_0x2bd3('0x14')](0x0,_0x3e958e[_0x2bd3('0x26')](_0x23792d));}switch(_0x5c0314['zone']){case'US':_0x2ff143=_0x2bd3('0x15');break;case'AU':_0x2ff143='https://accounts.zoho.com.au';break;case'IN':_0x2ff143=_0x2bd3('0x16');break;case'CN':_0x2ff143=_0x2bd3('0x17');break;default:_0x2ff143=_0x2bd3('0x18');break;}var _0x5afc9d={'method':'POST','uri':_0x2ff143+'/oauth/v2/token','form':{'grant_type':_0x2bd3('0x27'),'client_id':_0x5c0314[_0x2bd3('0xe')],'client_secret':_0x5c0314[_0x2bd3('0xf')],'redirect_uri':_0x5c0314['serverUrl'],'code':_0x5c0314[_0x2bd3('0x10')]},'headers':{'Content-Type':_0x2bd3('0x1a')}};return rp(_0x5afc9d)['then'](function(_0x469cd6){var _0x2c9d44=JSON['parse'](_0x469cd6);if(_0x2c9d44[_0x2bd3('0x1e')]){_0x5c0314[_0x2bd3('0x1d')]=_0x2c9d44[_0x2bd3('0x1e')];logger[_0x2bd3('0x1f')](util['format'](_0x2bd3('0x28'),_0x5c0314[_0x2bd3('0x21')],_0x5c0314['id']));}else{logger['error'](util['format'](_0x2bd3('0x23'),_0x5c0314[_0x2bd3('0x21')],_0x5c0314['id']),util[_0x2bd3('0x24')](_0x2c9d44,{'showHidden':![],'depth':null}));}return _0x4879d2(null,_0x574c31);})['catch'](function(_0x1243c7){logger[_0x2bd3('0x22')](util[_0x2bd3('0x20')](_0x2bd3('0x23'),_0x5c0314[_0x2bd3('0x21')],_0x5c0314['id']),util[_0x2bd3('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x4879d2(_0x1243c7);});}else{return _0x4879d2(null,_0x574c31);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index cd9ef21..7a7bd31 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 _0x57b7=['rpc','../../config/environment','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetZohoAccount','stringify','ShowZohoAccount','ZohoAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x57b7,0x160));var _0x757b=function(_0x581f9c,_0x164552){_0x581f9c=_0x581f9c-0x0;var _0x3da083=_0x57b7[_0x581f9c];return _0x3da083;};'use strict';var _=require(_0x757b('0x0'));var util=require(_0x757b('0x1'));var moment=require(_0x757b('0x2'));var BPromise=require(_0x757b('0x3'));var rs=require(_0x757b('0x4'));var fs=require('fs');var Redis=require(_0x757b('0x5'));var db=require(_0x757b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x757b('0x7'))(_0x757b('0x8'));var config=require(_0x757b('0x9'));var jayson=require(_0x757b('0xa'));var client=jayson['client'][_0x757b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8528c7,_0x36c83c,_0x224503){return new BPromise(function(_0x18b130,_0x1845cf){return client[_0x757b('0xc')](_0x8528c7,_0x224503)[_0x757b('0xd')](function(_0x53a1ce){logger[_0x757b('0xe')](_0x757b('0xf'),_0x36c83c,'request\x20sent');logger[_0x757b('0x10')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x36c83c,_0x757b('0x11'),JSON['stringify'](_0x53a1ce));if(_0x53a1ce[_0x757b('0x12')]){if(_0x53a1ce[_0x757b('0x12')]['code']===0x1f4){logger[_0x757b('0x12')](_0x757b('0xf'),_0x36c83c,_0x53a1ce['error'][_0x757b('0x13')]);return _0x1845cf(_0x53a1ce['error'][_0x757b('0x13')]);}logger[_0x757b('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x36c83c,_0x53a1ce[_0x757b('0x12')]['message']);return _0x18b130(_0x53a1ce[_0x757b('0x12')][_0x757b('0x13')]);}else{logger[_0x757b('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x36c83c,_0x757b('0x11'));_0x18b130(_0x53a1ce[_0x757b('0x14')]['message']);}})[_0x757b('0x15')](function(_0x493286){logger['error'](_0x757b('0xf'),_0x36c83c,_0x493286);_0x1845cf(_0x493286);});});}exports['GetZohoAccount']=function(_0x7c892c){var _0x267b5d=this;return new Promise(function(_0x3bd3ab,_0x5eaa15){return db['ZohoAccount'][_0x757b('0x16')]({'raw':_0x7c892c[_0x757b('0x17')]?_0x7c892c[_0x757b('0x17')][_0x757b('0x18')]===undefined?!![]:![]:!![],'where':_0x7c892c[_0x757b('0x17')]?_0x7c892c[_0x757b('0x17')][_0x757b('0x19')]||null:null,'attributes':_0x7c892c[_0x757b('0x17')]?_0x7c892c[_0x757b('0x17')][_0x757b('0x1a')]||null:null,'limit':_0x7c892c['options']?_0x7c892c[_0x757b('0x17')][_0x757b('0x1b')]||null:null,'include':_0x7c892c[_0x757b('0x17')]?_0x7c892c[_0x757b('0x17')][_0x757b('0x1c')]?_[_0x757b('0x1d')](_0x7c892c['options'][_0x757b('0x1c')],function(_0x4f7d6a){return{'model':db[_0x4f7d6a[_0x757b('0x1e')]],'as':_0x4f7d6a['as'],'attributes':_0x4f7d6a[_0x757b('0x1a')],'include':_0x4f7d6a[_0x757b('0x1c')]?_[_0x757b('0x1d')](_0x4f7d6a[_0x757b('0x1c')],function(_0x1181e8){return{'model':db[_0x1181e8['model']],'as':_0x1181e8['as'],'attributes':_0x1181e8['attributes'],'include':_0x1181e8['include']?_[_0x757b('0x1d')](_0x1181e8[_0x757b('0x1c')],function(_0x13c242){return{'model':db[_0x13c242['model']],'as':_0x13c242['as'],'attributes':_0x13c242[_0x757b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x757b('0xd')](function(_0x1ef05b){logger[_0x757b('0xe')](_0x757b('0x1f'),_0x7c892c);logger[_0x757b('0x10')]('GetZohoAccount',_0x7c892c,JSON[_0x757b('0x20')](_0x1ef05b));_0x3bd3ab(_0x1ef05b);})[_0x757b('0x15')](function(_0x176454){logger[_0x757b('0x12')]('GetZohoAccount',_0x176454['message'],_0x7c892c);_0x5eaa15(_0x267b5d['error'](0x1f4,_0x176454[_0x757b('0x13')]));});});};exports[_0x757b('0x21')]=function(_0x11ec53){var _0x374512=this;return new Promise(function(_0x308820,_0x257900){return db[_0x757b('0x22')][_0x757b('0x23')]({'raw':_0x11ec53[_0x757b('0x17')]?_0x11ec53[_0x757b('0x17')][_0x757b('0x18')]===undefined?!![]:![]:!![],'where':_0x11ec53[_0x757b('0x17')]?_0x11ec53[_0x757b('0x17')][_0x757b('0x19')]||null:null,'attributes':_0x11ec53['options']?_0x11ec53['options'][_0x757b('0x1a')]||null:null,'include':_0x11ec53[_0x757b('0x17')]?_0x11ec53[_0x757b('0x17')][_0x757b('0x1c')]?_[_0x757b('0x1d')](_0x11ec53[_0x757b('0x17')]['include'],function(_0x5672db){return{'model':db[_0x5672db[_0x757b('0x1e')]],'as':_0x5672db['as'],'attributes':_0x5672db[_0x757b('0x1a')],'include':_0x5672db[_0x757b('0x1c')]?_['map'](_0x5672db['include'],function(_0x1d815e){return{'model':db[_0x1d815e[_0x757b('0x1e')]],'as':_0x1d815e['as'],'attributes':_0x1d815e['attributes'],'include':_0x1d815e[_0x757b('0x1c')]?_[_0x757b('0x1d')](_0x1d815e[_0x757b('0x1c')],function(_0x45f958){return{'model':db[_0x45f958[_0x757b('0x1e')]],'as':_0x45f958['as'],'attributes':_0x45f958[_0x757b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x757b('0xd')](function(_0x652b74){logger[_0x757b('0xe')](_0x757b('0x21'),_0x11ec53);logger[_0x757b('0x10')](_0x757b('0x21'),_0x11ec53,JSON[_0x757b('0x20')](_0x652b74));_0x308820(_0x652b74);})[_0x757b('0x15')](function(_0x4df2b6){logger[_0x757b('0x12')]('ShowZohoAccount',_0x4df2b6['message'],_0x11ec53);_0x257900(_0x374512[_0x757b('0x12')](0x1f4,_0x4df2b6[_0x757b('0x13')]));});});}; \ No newline at end of file +var _0x4959=['request','then','ZohoAccount,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetZohoAccount','ZohoAccount','options','where','attributes','limit','include','map','model','info','ShowZohoAccount','find','raw','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x37e227,_0x31179f){var _0x16c5de=function(_0x1bb1ba){while(--_0x1bb1ba){_0x37e227['push'](_0x37e227['shift']());}};_0x16c5de(++_0x31179f);}(_0x4959,0x9b));var _0x9495=function(_0x518a68,_0xef1bfd){_0x518a68=_0x518a68-0x0;var _0x699842=_0x4959[_0x518a68];return _0x699842;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9495('0x0'));var BPromise=require(_0x9495('0x1'));var rs=require(_0x9495('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9495('0x3'))['db'];var utils=require(_0x9495('0x4'));var logger=require(_0x9495('0x5'))(_0x9495('0x6'));var config=require('../../config/environment');var jayson=require(_0x9495('0x7'));var client=jayson[_0x9495('0x8')][_0x9495('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21f4e7,_0xd77231,_0x34744d){return new BPromise(function(_0x2a4754,_0x19f08c){return client[_0x9495('0xa')](_0x21f4e7,_0x34744d)[_0x9495('0xb')](function(_0x6b1466){logger['info'](_0x9495('0xc'),_0xd77231,'request\x20sent');logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0xd77231,'request\x20sent',JSON[_0x9495('0xd')](_0x6b1466));if(_0x6b1466[_0x9495('0xe')]){if(_0x6b1466[_0x9495('0xe')][_0x9495('0xf')]===0x1f4){logger[_0x9495('0xe')](_0x9495('0xc'),_0xd77231,_0x6b1466[_0x9495('0xe')][_0x9495('0x10')]);return _0x19f08c(_0x6b1466[_0x9495('0xe')][_0x9495('0x10')]);}logger[_0x9495('0xe')](_0x9495('0xc'),_0xd77231,_0x6b1466[_0x9495('0xe')][_0x9495('0x10')]);return _0x2a4754(_0x6b1466[_0x9495('0xe')][_0x9495('0x10')]);}else{logger['info'](_0x9495('0xc'),_0xd77231,_0x9495('0x11'));_0x2a4754(_0x6b1466[_0x9495('0x12')][_0x9495('0x10')]);}})[_0x9495('0x13')](function(_0x4c1d9d){logger[_0x9495('0xe')](_0x9495('0xc'),_0xd77231,_0x4c1d9d);_0x19f08c(_0x4c1d9d);});});}exports[_0x9495('0x14')]=function(_0x7ca882){var _0x22feb8=this;return new Promise(function(_0x502562,_0x213bab){return db[_0x9495('0x15')]['findAll']({'raw':_0x7ca882['options']?_0x7ca882['options']['raw']===undefined?!![]:![]:!![],'where':_0x7ca882[_0x9495('0x16')]?_0x7ca882[_0x9495('0x16')][_0x9495('0x17')]||null:null,'attributes':_0x7ca882[_0x9495('0x16')]?_0x7ca882[_0x9495('0x16')][_0x9495('0x18')]||null:null,'limit':_0x7ca882[_0x9495('0x16')]?_0x7ca882[_0x9495('0x16')][_0x9495('0x19')]||null:null,'include':_0x7ca882[_0x9495('0x16')]?_0x7ca882['options'][_0x9495('0x1a')]?_[_0x9495('0x1b')](_0x7ca882[_0x9495('0x16')][_0x9495('0x1a')],function(_0x40d9d1){return{'model':db[_0x40d9d1[_0x9495('0x1c')]],'as':_0x40d9d1['as'],'attributes':_0x40d9d1[_0x9495('0x18')],'include':_0x40d9d1[_0x9495('0x1a')]?_[_0x9495('0x1b')](_0x40d9d1['include'],function(_0x224e5e){return{'model':db[_0x224e5e[_0x9495('0x1c')]],'as':_0x224e5e['as'],'attributes':_0x224e5e[_0x9495('0x18')],'include':_0x224e5e[_0x9495('0x1a')]?_[_0x9495('0x1b')](_0x224e5e[_0x9495('0x1a')],function(_0xaa5ab4){return{'model':db[_0xaa5ab4[_0x9495('0x1c')]],'as':_0xaa5ab4['as'],'attributes':_0xaa5ab4['attributes']};}):[]};}):[]};}):[]:[]})[_0x9495('0xb')](function(_0x13b1b6){logger[_0x9495('0x1d')](_0x9495('0x14'),_0x7ca882);logger['debug'](_0x9495('0x14'),_0x7ca882,JSON[_0x9495('0xd')](_0x13b1b6));_0x502562(_0x13b1b6);})[_0x9495('0x13')](function(_0x5f3d6e){logger[_0x9495('0xe')](_0x9495('0x14'),_0x5f3d6e[_0x9495('0x10')],_0x7ca882);_0x213bab(_0x22feb8[_0x9495('0xe')](0x1f4,_0x5f3d6e[_0x9495('0x10')]));});});};exports[_0x9495('0x1e')]=function(_0x4770ed){var _0x5e2d9e=this;return new Promise(function(_0x3f6df9,_0x1d641b){return db[_0x9495('0x15')][_0x9495('0x1f')]({'raw':_0x4770ed[_0x9495('0x16')]?_0x4770ed[_0x9495('0x16')][_0x9495('0x20')]===undefined?!![]:![]:!![],'where':_0x4770ed[_0x9495('0x16')]?_0x4770ed['options'][_0x9495('0x17')]||null:null,'attributes':_0x4770ed['options']?_0x4770ed['options']['attributes']||null:null,'include':_0x4770ed[_0x9495('0x16')]?_0x4770ed[_0x9495('0x16')][_0x9495('0x1a')]?_[_0x9495('0x1b')](_0x4770ed[_0x9495('0x16')][_0x9495('0x1a')],function(_0x3f724e){return{'model':db[_0x3f724e[_0x9495('0x1c')]],'as':_0x3f724e['as'],'attributes':_0x3f724e[_0x9495('0x18')],'include':_0x3f724e[_0x9495('0x1a')]?_[_0x9495('0x1b')](_0x3f724e[_0x9495('0x1a')],function(_0x1e151a){return{'model':db[_0x1e151a['model']],'as':_0x1e151a['as'],'attributes':_0x1e151a[_0x9495('0x18')],'include':_0x1e151a[_0x9495('0x1a')]?_[_0x9495('0x1b')](_0x1e151a[_0x9495('0x1a')],function(_0x312f5c){return{'model':db[_0x312f5c[_0x9495('0x1c')]],'as':_0x312f5c['as'],'attributes':_0x312f5c[_0x9495('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b1650){logger[_0x9495('0x1d')](_0x9495('0x1e'),_0x4770ed);logger['debug'](_0x9495('0x1e'),_0x4770ed,JSON[_0x9495('0xd')](_0x5b1650));_0x3f6df9(_0x5b1650);})['catch'](function(_0x3f053f){logger[_0x9495('0xe')]('ShowZohoAccount',_0x3f053f[_0x9495('0x10')],_0x4770ed);_0x1d641b(_0x5e2d9e[_0x9495('0xe')](0x1f4,_0x3f053f[_0x9495('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index bf6a498..422a3fb 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 _0x774b=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','update','delete','destroy','exports'];(function(_0x32e2c3,_0x385208){var _0x31c812=function(_0x221924){while(--_0x221924){_0x32e2c3['push'](_0x32e2c3['shift']());}};_0x31c812(++_0x385208);}(_0x774b,0xfa));var _0xb774=function(_0x4c3531,_0x58ec6d){_0x4c3531=_0x4c3531-0x0;var _0x195225=_0x774b[_0x4c3531];return _0x195225;};'use strict';var multer=require(_0xb774('0x0'));var util=require(_0xb774('0x1'));var path=require(_0xb774('0x2'));var timeout=require(_0xb774('0x3'));var express=require(_0xb774('0x4'));var router=express[_0xb774('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb774('0x6'));var config=require(_0xb774('0x7'));var controller=require(_0xb774('0x8'));router['get']('/',auth[_0xb774('0x9')](),controller[_0xb774('0xa')]);router[_0xb774('0xb')](_0xb774('0xc'),auth[_0xb774('0x9')](),controller[_0xb774('0xd')]);router[_0xb774('0xb')](_0xb774('0xe'),auth[_0xb774('0x9')](),controller[_0xb774('0xf')]);router[_0xb774('0xb')](_0xb774('0x10'),auth['isAuthenticated'](),controller[_0xb774('0x11')]);router['get'](_0xb774('0x12'),auth[_0xb774('0x9')](),controller['getDescriptions']);router[_0xb774('0x13')]('/',auth[_0xb774('0x9')](),controller[_0xb774('0x14')]);router['put'](_0xb774('0xc'),auth[_0xb774('0x9')](),controller[_0xb774('0x15')]);router[_0xb774('0x16')](_0xb774('0xc'),auth[_0xb774('0x9')](),controller[_0xb774('0x17')]);module[_0xb774('0x18')]=router; \ No newline at end of file +var _0xae6d=['show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','create','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x4eafd8,_0x4aa4aa){var _0x19cda0=function(_0x5bc986){while(--_0x5bc986){_0x4eafd8['push'](_0x4eafd8['shift']());}};_0x19cda0(++_0x4aa4aa);}(_0xae6d,0x1ac));var _0xdae6=function(_0x3fcc20,_0x57c31b){_0x3fcc20=_0x3fcc20-0x0;var _0x15d3ce=_0xae6d[_0x3fcc20];return _0x15d3ce;};'use strict';var multer=require(_0xdae6('0x0'));var util=require(_0xdae6('0x1'));var path=require('path');var timeout=require(_0xdae6('0x2'));var express=require(_0xdae6('0x3'));var router=express[_0xdae6('0x4')]();var fs_extra=require(_0xdae6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdae6('0x6'));var controller=require(_0xdae6('0x7'));router[_0xdae6('0x8')]('/',auth[_0xdae6('0x9')](),controller[_0xdae6('0xa')]);router[_0xdae6('0x8')](_0xdae6('0xb'),auth[_0xdae6('0x9')](),controller[_0xdae6('0xc')]);router[_0xdae6('0x8')](_0xdae6('0xd'),auth[_0xdae6('0x9')](),controller['getFields']);router[_0xdae6('0x8')](_0xdae6('0xe'),auth[_0xdae6('0x9')](),controller[_0xdae6('0xf')]);router[_0xdae6('0x8')](_0xdae6('0x10'),auth[_0xdae6('0x9')](),controller['getDescriptions']);router[_0xdae6('0x11')]('/',auth[_0xdae6('0x9')](),controller[_0xdae6('0x12')]);router['put'](_0xdae6('0xb'),auth[_0xdae6('0x9')](),controller[_0xdae6('0x13')]);router[_0xdae6('0x14')](_0xdae6('0xb'),auth[_0xdae6('0x9')](),controller[_0xdae6('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 56433be..acb1315 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 _0x1c17=['sequelize','exports','STRING','ENUM','contact','nothing','lead','contact_lead'];(function(_0x169ac6,_0x3a19d6){var _0x5c63ea=function(_0x27fadf){while(--_0x27fadf){_0x169ac6['push'](_0x169ac6['shift']());}};_0x5c63ea(++_0x3a19d6);}(_0x1c17,0x158));var _0x71c1=function(_0x2e0215,_0x36fb0e){_0x2e0215=_0x2e0215-0x0;var _0x1d05d5=_0x1c17[_0x2e0215];return _0x1d05d5;};'use strict';var Sequelize=require(_0x71c1('0x0'));module[_0x71c1('0x1')]={'name':{'type':Sequelize[_0x71c1('0x2')]},'moduleCreate':{'type':Sequelize[_0x71c1('0x3')]('lead',_0x71c1('0x4'),_0x71c1('0x5')),'defaultValue':_0x71c1('0x6')},'moduleSearch':{'type':Sequelize['ENUM'](_0x71c1('0x7'),_0x71c1('0x4'),_0x71c1('0x6')),'defaultValue':_0x71c1('0x7')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x659d=['lead','nothing','contact','contact_lead','exports','STRING'];(function(_0x1c3e2d,_0x1c937a){var _0x386f67=function(_0x27570a){while(--_0x27570a){_0x1c3e2d['push'](_0x1c3e2d['shift']());}};_0x386f67(++_0x1c937a);}(_0x659d,0x64));var _0xd659=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0x659d[_0x1bc0ae];return _0x501104;};'use strict';var Sequelize=require('sequelize');module[_0xd659('0x0')]={'name':{'type':Sequelize[_0xd659('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xd659('0x2'),'contact',_0xd659('0x3')),'defaultValue':_0xd659('0x2')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xd659('0x4'),_0xd659('0x2')),'defaultValue':_0xd659('0x5')},'description':{'type':Sequelize[_0xd659('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index a168bf7..bef6d11 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 _0x254a=['rawAttributes','fieldName','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','ZohoConfiguration','include','findAll','catch','show','params','keys','includeAll','options','find','create','body','findOne','ZohoField','pick','getFields','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','destroy','then','name','send','index','map'];(function(_0x4fec6a,_0x385d3b){var _0x471be2=function(_0x5b8c11){while(--_0x5b8c11){_0x4fec6a['push'](_0x4fec6a['shift']());}};_0x471be2(++_0x385d3b);}(_0x254a,0xc1));var _0xa254=function(_0x25b444,_0x20da5e){_0x25b444=_0x25b444-0x0;var _0x425f88=_0x254a[_0x25b444];return _0x425f88;};'use strict';var emlformat=require(_0xa254('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa254('0x1'));var jsonpatch=require(_0xa254('0x2'));var rp=require(_0xa254('0x3'));var moment=require(_0xa254('0x4'));var BPromise=require(_0xa254('0x5'));var Mustache=require('mustache');var util=require(_0xa254('0x6'));var path=require('path');var sox=require(_0xa254('0x7'));var csv=require(_0xa254('0x8'));var ejs=require(_0xa254('0x9'));var fs=require('fs');var fs_extra=require(_0xa254('0xa'));var _=require(_0xa254('0xb'));var squel=require(_0xa254('0xc'));var crypto=require('crypto');var jsforce=require(_0xa254('0xd'));var deskjs=require(_0xa254('0xe'));var toCsv=require(_0xa254('0x8'));var querystring=require(_0xa254('0xf'));var Papa=require(_0xa254('0x10'));var Redis=require('ioredis');var authService=require(_0xa254('0x11'));var qs=require(_0xa254('0x12'));var as=require(_0xa254('0x13'));var hardwareService=require(_0xa254('0x14'));var logger=require(_0xa254('0x15'))('api');var utils=require(_0xa254('0x16'));var config=require(_0xa254('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2914bd,_0x1abf00){_0x1abf00=_0x1abf00||0xcc;return function(_0x4d6e64){if(_0x4d6e64){return _0x2914bd[_0xa254('0x18')](_0x1abf00);}return _0x2914bd[_0xa254('0x19')](_0x1abf00)[_0xa254('0x1a')]();};}function respondWithResult(_0x436631,_0x5dc2d4){_0x5dc2d4=_0x5dc2d4||0xc8;return function(_0x6356b){if(_0x6356b){return _0x436631[_0xa254('0x19')](_0x5dc2d4)[_0xa254('0x1b')](_0x6356b);}};}function respondWithFilteredResult(_0x13c1bc,_0x54ccc1){return function(_0x3557e3){if(_0x3557e3){var _0x46500e=typeof _0x54ccc1[_0xa254('0x1c')]===_0xa254('0x1d')&&typeof _0x54ccc1[_0xa254('0x1e')]==='undefined';var _0x3a22a3=_0x3557e3[_0xa254('0x1f')];var _0x1bf7f0=_0x46500e?0x0:_0x54ccc1[_0xa254('0x1c')];var _0x1c589e=_0x46500e?_0x3557e3[_0xa254('0x1f')]:_0x54ccc1[_0xa254('0x1c')]+_0x54ccc1[_0xa254('0x1e')];var _0x9abe62;if(_0x1c589e>=_0x3a22a3){_0x1c589e=_0x3a22a3;_0x9abe62=0xc8;}else{_0x9abe62=0xce;}_0x13c1bc[_0xa254('0x19')](_0x9abe62);return _0x13c1bc['set'](_0xa254('0x20'),_0x1bf7f0+'-'+_0x1c589e+'/'+_0x3a22a3)[_0xa254('0x1b')](_0x3557e3);}return null;};}function patchUpdates(_0x1c9718){return function(_0x1cf1eb){try{jsonpatch[_0xa254('0x21')](_0x1cf1eb,_0x1c9718,!![]);}catch(_0x5371e9){return BPromise['reject'](_0x5371e9);}return _0x1cf1eb['save']();};}function saveUpdates(_0x1ad3bb,_0x532f16){return function(_0x2bdf11){if(_0x2bdf11){return _0x2bdf11[_0xa254('0x22')](_0x1ad3bb)['then'](function(_0x2adaf4){return _0x2adaf4;});}return null;};}function removeEntity(_0x356955,_0xe6e845){return function(_0x57818e){if(_0x57818e){return _0x57818e[_0xa254('0x23')]()[_0xa254('0x24')](function(){_0x356955['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55df27,_0x32b8fc){return function(_0x6f15a5){if(!_0x6f15a5){_0x55df27[_0xa254('0x18')](0x194);}return _0x6f15a5;};}function handleError(_0x46c957,_0x2bbc19){_0x2bbc19=_0x2bbc19||0x1f4;return function(_0x3c9fb3){logger['error'](_0x3c9fb3['stack']);if(_0x3c9fb3[_0xa254('0x25')]){delete _0x3c9fb3[_0xa254('0x25')];}_0x46c957['status'](_0x2bbc19)[_0xa254('0x26')](_0x3c9fb3);};}exports[_0xa254('0x27')]=function(_0x7e19cb,_0x2b0b3a){var _0x47dbeb={},_0x33356a={},_0x34d750={'count':0x0,'rows':[]};var _0xc4fe08=_[_0xa254('0x28')](db['ZohoConfiguration'][_0xa254('0x29')],function(_0x2a11e1){return{'name':_0x2a11e1[_0xa254('0x2a')],'type':_0x2a11e1['type'][_0xa254('0x2b')]};});_0x33356a[_0xa254('0x2c')]=_['map'](_0xc4fe08,_0xa254('0x25'));_0x33356a[_0xa254('0x2d')]=_['keys'](_0x7e19cb[_0xa254('0x2d')]);_0x33356a['filters']=_['intersection'](_0x33356a[_0xa254('0x2c')],_0x33356a[_0xa254('0x2d')]);_0x47dbeb[_0xa254('0x2e')]=_[_0xa254('0x2f')](_0x33356a[_0xa254('0x2c')],qs[_0xa254('0x30')](_0x7e19cb[_0xa254('0x2d')][_0xa254('0x30')]));_0x47dbeb[_0xa254('0x2e')]=_0x47dbeb[_0xa254('0x2e')][_0xa254('0x31')]?_0x47dbeb[_0xa254('0x2e')]:_0x33356a['model'];if(!_0x7e19cb[_0xa254('0x2d')][_0xa254('0x32')](_0xa254('0x33'))){_0x47dbeb[_0xa254('0x1e')]=qs[_0xa254('0x1e')](_0x7e19cb['query'][_0xa254('0x1e')]);_0x47dbeb['offset']=qs[_0xa254('0x1c')](_0x7e19cb['query'][_0xa254('0x1c')]);}_0x47dbeb[_0xa254('0x34')]=qs[_0xa254('0x35')](_0x7e19cb[_0xa254('0x2d')][_0xa254('0x35')]);_0x47dbeb[_0xa254('0x36')]=qs[_0xa254('0x37')](_['pick'](_0x7e19cb[_0xa254('0x2d')],_0x33356a['filters']),_0xc4fe08);if(_0x7e19cb[_0xa254('0x2d')][_0xa254('0x38')]){_0x47dbeb[_0xa254('0x36')]=_[_0xa254('0x39')](_0x47dbeb[_0xa254('0x36')],{'$or':_['map'](_0xc4fe08,function(_0x40555d){if(_0x40555d[_0xa254('0x3a')]!==_0xa254('0x3b')){var _0x1b2920={};_0x1b2920[_0x40555d[_0xa254('0x25')]]={'$like':'%'+_0x7e19cb[_0xa254('0x2d')][_0xa254('0x38')]+'%'};return _0x1b2920;}})});}_0x47dbeb=_['merge']({},_0x47dbeb,_0x7e19cb['options']);var _0x3a2af1={'where':_0x47dbeb[_0xa254('0x36')]};return db[_0xa254('0x3c')]['count'](_0x3a2af1)[_0xa254('0x24')](function(_0x1ddee4){_0x34d750[_0xa254('0x1f')]=_0x1ddee4;if(_0x7e19cb[_0xa254('0x2d')]['includeAll']){_0x47dbeb[_0xa254('0x3d')]=[{'all':!![]}];}return db[_0xa254('0x3c')][_0xa254('0x3e')](_0x47dbeb);})['then'](function(_0x569b53){_0x34d750['rows']=_0x569b53;return _0x34d750;})[_0xa254('0x24')](respondWithFilteredResult(_0x2b0b3a,_0x47dbeb))[_0xa254('0x3f')](handleError(_0x2b0b3a,null));};exports[_0xa254('0x40')]=function(_0x113970,_0x2cd803){var _0x5ef5ed={'raw':![],'where':{'id':_0x113970[_0xa254('0x41')]['id']}},_0x579c96={};_0x579c96[_0xa254('0x2c')]=_[_0xa254('0x42')](db[_0xa254('0x3c')][_0xa254('0x29')]);_0x579c96[_0xa254('0x2d')]=_[_0xa254('0x42')](_0x113970[_0xa254('0x2d')]);_0x579c96[_0xa254('0x37')]=_['intersection'](_0x579c96[_0xa254('0x2c')],_0x579c96[_0xa254('0x2d')]);_0x5ef5ed['attributes']=_[_0xa254('0x2f')](_0x579c96['model'],qs[_0xa254('0x30')](_0x113970[_0xa254('0x2d')][_0xa254('0x30')]));_0x5ef5ed[_0xa254('0x2e')]=_0x5ef5ed['attributes']['length']?_0x5ef5ed[_0xa254('0x2e')]:_0x579c96[_0xa254('0x2c')];if(_0x113970[_0xa254('0x2d')][_0xa254('0x43')]){_0x5ef5ed[_0xa254('0x3d')]=[{'all':!![]}];}_0x5ef5ed=_[_0xa254('0x39')]({},_0x5ef5ed,_0x113970[_0xa254('0x44')]);return db[_0xa254('0x3c')][_0xa254('0x45')](_0x5ef5ed)[_0xa254('0x24')](handleEntityNotFound(_0x2cd803,null))['then'](respondWithResult(_0x2cd803,null))[_0xa254('0x3f')](handleError(_0x2cd803,null));};exports['create']=function(_0x1e3702,_0x4a1dee){return db[_0xa254('0x3c')][_0xa254('0x46')](_0x1e3702[_0xa254('0x47')],{})[_0xa254('0x24')](respondWithResult(_0x4a1dee,0xc9))['catch'](handleError(_0x4a1dee,null));};exports[_0xa254('0x22')]=function(_0x254149,_0x4c53cc){if(_0x254149[_0xa254('0x47')]['id']){delete _0x254149[_0xa254('0x47')]['id'];}return db[_0xa254('0x3c')][_0xa254('0x45')]({'where':{'id':_0x254149['params']['id']}})[_0xa254('0x24')](handleEntityNotFound(_0x4c53cc,null))[_0xa254('0x24')](saveUpdates(_0x254149['body'],null))['then'](respondWithResult(_0x4c53cc,null))[_0xa254('0x3f')](handleError(_0x4c53cc,null));};exports[_0xa254('0x23')]=function(_0x18ff21,_0xadb09){return db['ZohoConfiguration'][_0xa254('0x45')]({'where':{'id':_0x18ff21[_0xa254('0x41')]['id']}})[_0xa254('0x24')](handleEntityNotFound(_0xadb09,null))[_0xa254('0x24')](removeEntity(_0xadb09,null))[_0xa254('0x3f')](handleError(_0xadb09,null));};exports['getFields']=function(_0x79c443,_0x2da515,_0x22d13d){var _0x314026={};var _0x468baa={};var _0x1ac4e1;var _0x36aa28;return db['ZohoConfiguration'][_0xa254('0x48')]({'where':{'id':_0x79c443[_0xa254('0x41')]['id']}})['then'](handleEntityNotFound(_0x2da515,null))['then'](function(_0x3eb134){if(_0x3eb134){_0x1ac4e1=_0x3eb134;_0x468baa[_0xa254('0x2c')]=_[_0xa254('0x42')](db[_0xa254('0x49')]['rawAttributes']);_0x468baa[_0xa254('0x2d')]=_[_0xa254('0x42')](_0x79c443[_0xa254('0x2d')]);_0x468baa[_0xa254('0x37')]=_['intersection'](_0x468baa[_0xa254('0x2c')],_0x468baa[_0xa254('0x2d')]);_0x314026[_0xa254('0x2e')]=_['intersection'](_0x468baa['model'],qs[_0xa254('0x30')](_0x79c443[_0xa254('0x2d')][_0xa254('0x30')]));_0x314026[_0xa254('0x2e')]=_0x314026[_0xa254('0x2e')]['length']?_0x314026[_0xa254('0x2e')]:_0x468baa[_0xa254('0x2c')];_0x314026[_0xa254('0x34')]=qs[_0xa254('0x35')](_0x79c443['query']['sort']);_0x314026[_0xa254('0x36')]=qs['filters'](_[_0xa254('0x4a')](_0x79c443[_0xa254('0x2d')],_0x468baa[_0xa254('0x37')]));if(_0x79c443[_0xa254('0x2d')][_0xa254('0x38')]){_0x314026[_0xa254('0x36')]=_['merge'](_0x314026['where'],{'$or':_[_0xa254('0x28')](_0x314026[_0xa254('0x2e')],function(_0x14cf3f){var _0xdc6eae={};_0xdc6eae[_0x14cf3f]={'$like':'%'+_0x79c443[_0xa254('0x2d')][_0xa254('0x38')]+'%'};return _0xdc6eae;})});}_0x314026=_[_0xa254('0x39')]({},_0x314026,_0x79c443[_0xa254('0x44')]);return _0x1ac4e1[_0xa254('0x4b')](_0x314026);}})[_0xa254('0x24')](function(_0x59b5a2){if(_0x59b5a2){_0x36aa28=_0x59b5a2[_0xa254('0x31')];if(!_0x79c443['query'][_0xa254('0x32')](_0xa254('0x33'))){_0x314026[_0xa254('0x1e')]=qs[_0xa254('0x1e')](_0x79c443['query'][_0xa254('0x1e')]);_0x314026[_0xa254('0x1c')]=qs[_0xa254('0x1c')](_0x79c443[_0xa254('0x2d')][_0xa254('0x1c')]);}return _0x1ac4e1[_0xa254('0x4b')](_0x314026);}})['then'](function(_0x11c246){if(_0x11c246){return _0x11c246?{'count':_0x36aa28,'rows':_0x11c246}:null;}})[_0xa254('0x24')](respondWithResult(_0x2da515,null))[_0xa254('0x3f')](handleError(_0x2da515,null));};exports['getSubjects']=function(_0x4329ef,_0x15201c,_0x368cb7){var _0x57336b={};var _0x188aac={};var _0x48b846;var _0x43324c;return db[_0xa254('0x3c')]['findOne']({'where':{'id':_0x4329ef[_0xa254('0x41')]['id']}})[_0xa254('0x24')](handleEntityNotFound(_0x15201c,null))[_0xa254('0x24')](function(_0x1860d8){if(_0x1860d8){_0x48b846=_0x1860d8;_0x188aac['model']=_[_0xa254('0x42')](db[_0xa254('0x49')][_0xa254('0x29')]);_0x188aac['query']=_['keys'](_0x4329ef[_0xa254('0x2d')]);_0x188aac[_0xa254('0x37')]=_[_0xa254('0x2f')](_0x188aac['model'],_0x188aac[_0xa254('0x2d')]);_0x57336b[_0xa254('0x2e')]=_['intersection'](_0x188aac[_0xa254('0x2c')],qs['fields'](_0x4329ef['query'][_0xa254('0x30')]));_0x57336b['attributes']=_0x57336b[_0xa254('0x2e')][_0xa254('0x31')]?_0x57336b[_0xa254('0x2e')]:_0x188aac['model'];_0x57336b[_0xa254('0x34')]=qs[_0xa254('0x35')](_0x4329ef[_0xa254('0x2d')][_0xa254('0x35')]);_0x57336b[_0xa254('0x36')]=qs[_0xa254('0x37')](_[_0xa254('0x4a')](_0x4329ef[_0xa254('0x2d')],_0x188aac['filters']));if(_0x4329ef[_0xa254('0x2d')]['filter']){_0x57336b[_0xa254('0x36')]=_[_0xa254('0x39')](_0x57336b[_0xa254('0x36')],{'$or':_['map'](_0x57336b[_0xa254('0x2e')],function(_0x3e8157){var _0x35e3e0={};_0x35e3e0[_0x3e8157]={'$like':'%'+_0x4329ef[_0xa254('0x2d')][_0xa254('0x38')]+'%'};return _0x35e3e0;})});}_0x57336b=_[_0xa254('0x39')]({},_0x57336b,_0x4329ef[_0xa254('0x44')]);return _0x48b846[_0xa254('0x4c')](_0x57336b);}})['then'](function(_0x533918){if(_0x533918){_0x43324c=_0x533918['length'];if(!_0x4329ef[_0xa254('0x2d')]['hasOwnProperty'](_0xa254('0x33'))){_0x57336b['limit']=qs['limit'](_0x4329ef['query'][_0xa254('0x1e')]);_0x57336b[_0xa254('0x1c')]=qs['offset'](_0x4329ef[_0xa254('0x2d')][_0xa254('0x1c')]);}return _0x48b846[_0xa254('0x4c')](_0x57336b);}})[_0xa254('0x24')](function(_0x228a90){if(_0x228a90){return _0x228a90?{'count':_0x43324c,'rows':_0x228a90}:null;}})[_0xa254('0x24')](respondWithResult(_0x15201c,null))[_0xa254('0x3f')](handleError(_0x15201c,null));};exports[_0xa254('0x4d')]=function(_0x5b7d08,_0xee9771,_0x3b4cf0){var _0x8b8ddb={};var _0x5f0317={};var _0x2b7442;var _0x50dead;return db[_0xa254('0x3c')][_0xa254('0x48')]({'where':{'id':_0x5b7d08[_0xa254('0x41')]['id']}})[_0xa254('0x24')](handleEntityNotFound(_0xee9771,null))[_0xa254('0x24')](function(_0x429ea4){if(_0x429ea4){_0x2b7442=_0x429ea4;_0x5f0317[_0xa254('0x2c')]=_[_0xa254('0x42')](db['ZohoField'][_0xa254('0x29')]);_0x5f0317[_0xa254('0x2d')]=_[_0xa254('0x42')](_0x5b7d08[_0xa254('0x2d')]);_0x5f0317[_0xa254('0x37')]=_[_0xa254('0x2f')](_0x5f0317[_0xa254('0x2c')],_0x5f0317['query']);_0x8b8ddb[_0xa254('0x2e')]=_[_0xa254('0x2f')](_0x5f0317[_0xa254('0x2c')],qs['fields'](_0x5b7d08[_0xa254('0x2d')][_0xa254('0x30')]));_0x8b8ddb[_0xa254('0x2e')]=_0x8b8ddb['attributes']['length']?_0x8b8ddb[_0xa254('0x2e')]:_0x5f0317[_0xa254('0x2c')];_0x8b8ddb[_0xa254('0x34')]=qs[_0xa254('0x35')](_0x5b7d08[_0xa254('0x2d')][_0xa254('0x35')]);_0x8b8ddb['where']=qs[_0xa254('0x37')](_[_0xa254('0x4a')](_0x5b7d08['query'],_0x5f0317[_0xa254('0x37')]));if(_0x5b7d08[_0xa254('0x2d')][_0xa254('0x38')]){_0x8b8ddb[_0xa254('0x36')]=_[_0xa254('0x39')](_0x8b8ddb[_0xa254('0x36')],{'$or':_['map'](_0x8b8ddb[_0xa254('0x2e')],function(_0x375162){var _0x237ba8={};_0x237ba8[_0x375162]={'$like':'%'+_0x5b7d08[_0xa254('0x2d')][_0xa254('0x38')]+'%'};return _0x237ba8;})});}_0x8b8ddb=_[_0xa254('0x39')]({},_0x8b8ddb,_0x5b7d08[_0xa254('0x44')]);return _0x2b7442[_0xa254('0x4d')](_0x8b8ddb);}})['then'](function(_0x3510da){if(_0x3510da){_0x50dead=_0x3510da[_0xa254('0x31')];if(!_0x5b7d08[_0xa254('0x2d')][_0xa254('0x32')](_0xa254('0x33'))){_0x8b8ddb[_0xa254('0x1e')]=qs[_0xa254('0x1e')](_0x5b7d08[_0xa254('0x2d')]['limit']);_0x8b8ddb[_0xa254('0x1c')]=qs['offset'](_0x5b7d08[_0xa254('0x2d')]['offset']);}return _0x2b7442[_0xa254('0x4d')](_0x8b8ddb);}})[_0xa254('0x24')](function(_0x62953a){if(_0x62953a){return _0x62953a?{'count':_0x50dead,'rows':_0x62953a}:null;}})[_0xa254('0x24')](respondWithResult(_0xee9771,null))[_0xa254('0x3f')](handleError(_0xee9771,null));}; \ No newline at end of file +var _0x9a17=['error','name','send','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','params','include','find','create','body','catch','destroy','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','undefined','offset','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x46cf00,_0x457a43){var _0x3974dc=function(_0x4b5d0a){while(--_0x4b5d0a){_0x46cf00['push'](_0x46cf00['shift']());}};_0x3974dc(++_0x457a43);}(_0x9a17,0x124));var _0x79a1=function(_0x43a669,_0x13e07a){_0x43a669=_0x43a669-0x0;var _0x30200a=_0x9a17[_0x43a669];return _0x30200a;};'use strict';var emlformat=require(_0x79a1('0x0'));var rimraf=require(_0x79a1('0x1'));var zipdir=require(_0x79a1('0x2'));var jsonpatch=require(_0x79a1('0x3'));var rp=require(_0x79a1('0x4'));var moment=require(_0x79a1('0x5'));var BPromise=require(_0x79a1('0x6'));var Mustache=require('mustache');var util=require(_0x79a1('0x7'));var path=require(_0x79a1('0x8'));var sox=require(_0x79a1('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x79a1('0xa'));var _=require(_0x79a1('0xb'));var squel=require(_0x79a1('0xc'));var crypto=require(_0x79a1('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x79a1('0xe'));var toCsv=require(_0x79a1('0xf'));var querystring=require(_0x79a1('0x10'));var Papa=require(_0x79a1('0x11'));var Redis=require('ioredis');var authService=require(_0x79a1('0x12'));var qs=require(_0x79a1('0x13'));var as=require(_0x79a1('0x14'));var hardwareService=require(_0x79a1('0x15'));var logger=require(_0x79a1('0x16'))(_0x79a1('0x17'));var utils=require(_0x79a1('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x79a1('0x19'));var db=require(_0x79a1('0x1a'))['db'];function respondWithStatusCode(_0x4f6ee5,_0x8a6550){_0x8a6550=_0x8a6550||0xcc;return function(_0x1e5866){if(_0x1e5866){return _0x4f6ee5['sendStatus'](_0x8a6550);}return _0x4f6ee5['status'](_0x8a6550)[_0x79a1('0x1b')]();};}function respondWithResult(_0x1d406d,_0x3d7b9e){_0x3d7b9e=_0x3d7b9e||0xc8;return function(_0x5a76d6){if(_0x5a76d6){return _0x1d406d[_0x79a1('0x1c')](_0x3d7b9e)[_0x79a1('0x1d')](_0x5a76d6);}};}function respondWithFilteredResult(_0x11b6c2,_0xa0ee0){return function(_0x3e01e5){if(_0x3e01e5){var _0x315fec=typeof _0xa0ee0['offset']===_0x79a1('0x1e')&&typeof _0xa0ee0['limit']===_0x79a1('0x1e');var _0x12d05a=_0x3e01e5['count'];var _0x3609dc=_0x315fec?0x0:_0xa0ee0[_0x79a1('0x1f')];var _0x7f3a5b=_0x315fec?_0x3e01e5[_0x79a1('0x20')]:_0xa0ee0['offset']+_0xa0ee0['limit'];var _0x251532;if(_0x7f3a5b>=_0x12d05a){_0x7f3a5b=_0x12d05a;_0x251532=0xc8;}else{_0x251532=0xce;}_0x11b6c2[_0x79a1('0x1c')](_0x251532);return _0x11b6c2[_0x79a1('0x21')](_0x79a1('0x22'),_0x3609dc+'-'+_0x7f3a5b+'/'+_0x12d05a)['json'](_0x3e01e5);}return null;};}function patchUpdates(_0x5c3cd0){return function(_0x33aa32){try{jsonpatch[_0x79a1('0x23')](_0x33aa32,_0x5c3cd0,!![]);}catch(_0x366c23){return BPromise[_0x79a1('0x24')](_0x366c23);}return _0x33aa32[_0x79a1('0x25')]();};}function saveUpdates(_0xa4569b,_0x4f3d50){return function(_0x386a1f){if(_0x386a1f){return _0x386a1f[_0x79a1('0x26')](_0xa4569b)[_0x79a1('0x27')](function(_0x941c72){return _0x941c72;});}return null;};}function removeEntity(_0x23e6e7,_0x45774f){return function(_0x5a258d){if(_0x5a258d){return _0x5a258d['destroy']()[_0x79a1('0x27')](function(){_0x23e6e7[_0x79a1('0x1c')](0xcc)[_0x79a1('0x1b')]();});}};}function handleEntityNotFound(_0x3022e7,_0x42730d){return function(_0x3a5e89){if(!_0x3a5e89){_0x3022e7['sendStatus'](0x194);}return _0x3a5e89;};}function handleError(_0x584964,_0x43641a){_0x43641a=_0x43641a||0x1f4;return function(_0x38e1ea){logger[_0x79a1('0x28')](_0x38e1ea['stack']);if(_0x38e1ea[_0x79a1('0x29')]){delete _0x38e1ea[_0x79a1('0x29')];}_0x584964['status'](_0x43641a)[_0x79a1('0x2a')](_0x38e1ea);};}exports['index']=function(_0xb0a746,_0x2bacd8){var _0x18a672={},_0x28c1f5={},_0x2ad8bf={'count':0x0,'rows':[]};var _0xb664c3=_[_0x79a1('0x2b')](db[_0x79a1('0x2c')][_0x79a1('0x2d')],function(_0x4c5466){return{'name':_0x4c5466[_0x79a1('0x2e')],'type':_0x4c5466[_0x79a1('0x2f')][_0x79a1('0x30')]};});_0x28c1f5[_0x79a1('0x31')]=_[_0x79a1('0x2b')](_0xb664c3,_0x79a1('0x29'));_0x28c1f5['query']=_[_0x79a1('0x32')](_0xb0a746[_0x79a1('0x33')]);_0x28c1f5[_0x79a1('0x34')]=_[_0x79a1('0x35')](_0x28c1f5['model'],_0x28c1f5[_0x79a1('0x33')]);_0x18a672[_0x79a1('0x36')]=_['intersection'](_0x28c1f5['model'],qs[_0x79a1('0x37')](_0xb0a746[_0x79a1('0x33')][_0x79a1('0x37')]));_0x18a672['attributes']=_0x18a672['attributes'][_0x79a1('0x38')]?_0x18a672[_0x79a1('0x36')]:_0x28c1f5[_0x79a1('0x31')];if(!_0xb0a746[_0x79a1('0x33')][_0x79a1('0x39')](_0x79a1('0x3a'))){_0x18a672[_0x79a1('0x3b')]=qs[_0x79a1('0x3b')](_0xb0a746[_0x79a1('0x33')][_0x79a1('0x3b')]);_0x18a672[_0x79a1('0x1f')]=qs[_0x79a1('0x1f')](_0xb0a746[_0x79a1('0x33')][_0x79a1('0x1f')]);}_0x18a672[_0x79a1('0x3c')]=qs[_0x79a1('0x3d')](_0xb0a746[_0x79a1('0x33')][_0x79a1('0x3d')]);_0x18a672[_0x79a1('0x3e')]=qs[_0x79a1('0x34')](_[_0x79a1('0x3f')](_0xb0a746[_0x79a1('0x33')],_0x28c1f5[_0x79a1('0x34')]),_0xb664c3);if(_0xb0a746[_0x79a1('0x33')]['filter']){_0x18a672[_0x79a1('0x3e')]=_[_0x79a1('0x40')](_0x18a672['where'],{'$or':_[_0x79a1('0x2b')](_0xb664c3,function(_0x458701){if(_0x458701[_0x79a1('0x2f')]!==_0x79a1('0x41')){var _0x6fb39f={};_0x6fb39f[_0x458701['name']]={'$like':'%'+_0xb0a746[_0x79a1('0x33')][_0x79a1('0x42')]+'%'};return _0x6fb39f;}})});}_0x18a672=_[_0x79a1('0x40')]({},_0x18a672,_0xb0a746[_0x79a1('0x43')]);var _0x5b700f={'where':_0x18a672[_0x79a1('0x3e')]};return db[_0x79a1('0x2c')][_0x79a1('0x20')](_0x5b700f)['then'](function(_0x29230f){_0x2ad8bf['count']=_0x29230f;if(_0xb0a746[_0x79a1('0x33')][_0x79a1('0x44')]){_0x18a672['include']=[{'all':!![]}];}return db[_0x79a1('0x2c')][_0x79a1('0x45')](_0x18a672);})[_0x79a1('0x27')](function(_0x4e1d6d){_0x2ad8bf[_0x79a1('0x46')]=_0x4e1d6d;return _0x2ad8bf;})[_0x79a1('0x27')](respondWithFilteredResult(_0x2bacd8,_0x18a672))['catch'](handleError(_0x2bacd8,null));};exports['show']=function(_0x531bac,_0x56ad0d){var _0xc5751={'raw':![],'where':{'id':_0x531bac[_0x79a1('0x47')]['id']}},_0x421380={};_0x421380[_0x79a1('0x31')]=_[_0x79a1('0x32')](db[_0x79a1('0x2c')][_0x79a1('0x2d')]);_0x421380[_0x79a1('0x33')]=_['keys'](_0x531bac[_0x79a1('0x33')]);_0x421380[_0x79a1('0x34')]=_[_0x79a1('0x35')](_0x421380[_0x79a1('0x31')],_0x421380[_0x79a1('0x33')]);_0xc5751[_0x79a1('0x36')]=_['intersection'](_0x421380[_0x79a1('0x31')],qs[_0x79a1('0x37')](_0x531bac[_0x79a1('0x33')][_0x79a1('0x37')]));_0xc5751[_0x79a1('0x36')]=_0xc5751['attributes'][_0x79a1('0x38')]?_0xc5751[_0x79a1('0x36')]:_0x421380[_0x79a1('0x31')];if(_0x531bac['query'][_0x79a1('0x44')]){_0xc5751[_0x79a1('0x48')]=[{'all':!![]}];}_0xc5751=_[_0x79a1('0x40')]({},_0xc5751,_0x531bac[_0x79a1('0x43')]);return db[_0x79a1('0x2c')][_0x79a1('0x49')](_0xc5751)[_0x79a1('0x27')](handleEntityNotFound(_0x56ad0d,null))[_0x79a1('0x27')](respondWithResult(_0x56ad0d,null))['catch'](handleError(_0x56ad0d,null));};exports[_0x79a1('0x4a')]=function(_0x33ad49,_0x5d5c93){return db[_0x79a1('0x2c')][_0x79a1('0x4a')](_0x33ad49[_0x79a1('0x4b')],{})['then'](respondWithResult(_0x5d5c93,0xc9))[_0x79a1('0x4c')](handleError(_0x5d5c93,null));};exports[_0x79a1('0x26')]=function(_0x444af1,_0x4db325){if(_0x444af1['body']['id']){delete _0x444af1['body']['id'];}return db[_0x79a1('0x2c')]['find']({'where':{'id':_0x444af1[_0x79a1('0x47')]['id']}})[_0x79a1('0x27')](handleEntityNotFound(_0x4db325,null))[_0x79a1('0x27')](saveUpdates(_0x444af1[_0x79a1('0x4b')],null))['then'](respondWithResult(_0x4db325,null))[_0x79a1('0x4c')](handleError(_0x4db325,null));};exports[_0x79a1('0x4d')]=function(_0x503ec0,_0x30ced8){return db[_0x79a1('0x2c')][_0x79a1('0x49')]({'where':{'id':_0x503ec0['params']['id']}})[_0x79a1('0x27')](handleEntityNotFound(_0x30ced8,null))[_0x79a1('0x27')](removeEntity(_0x30ced8,null))[_0x79a1('0x4c')](handleError(_0x30ced8,null));};exports[_0x79a1('0x4e')]=function(_0x28b8d9,_0x34ec5e,_0x12294c){var _0x431ccd={};var _0x18a46c={};var _0x1a1733;var _0x41e791;return db[_0x79a1('0x2c')][_0x79a1('0x4f')]({'where':{'id':_0x28b8d9[_0x79a1('0x47')]['id']}})[_0x79a1('0x27')](handleEntityNotFound(_0x34ec5e,null))[_0x79a1('0x27')](function(_0x5a80a5){if(_0x5a80a5){_0x1a1733=_0x5a80a5;_0x18a46c[_0x79a1('0x31')]=_[_0x79a1('0x32')](db[_0x79a1('0x50')][_0x79a1('0x2d')]);_0x18a46c['query']=_[_0x79a1('0x32')](_0x28b8d9[_0x79a1('0x33')]);_0x18a46c[_0x79a1('0x34')]=_[_0x79a1('0x35')](_0x18a46c[_0x79a1('0x31')],_0x18a46c[_0x79a1('0x33')]);_0x431ccd[_0x79a1('0x36')]=_[_0x79a1('0x35')](_0x18a46c[_0x79a1('0x31')],qs[_0x79a1('0x37')](_0x28b8d9[_0x79a1('0x33')]['fields']));_0x431ccd['attributes']=_0x431ccd[_0x79a1('0x36')][_0x79a1('0x38')]?_0x431ccd[_0x79a1('0x36')]:_0x18a46c[_0x79a1('0x31')];_0x431ccd['order']=qs[_0x79a1('0x3d')](_0x28b8d9[_0x79a1('0x33')][_0x79a1('0x3d')]);_0x431ccd[_0x79a1('0x3e')]=qs[_0x79a1('0x34')](_[_0x79a1('0x3f')](_0x28b8d9[_0x79a1('0x33')],_0x18a46c[_0x79a1('0x34')]));if(_0x28b8d9['query'][_0x79a1('0x42')]){_0x431ccd['where']=_[_0x79a1('0x40')](_0x431ccd[_0x79a1('0x3e')],{'$or':_[_0x79a1('0x2b')](_0x431ccd[_0x79a1('0x36')],function(_0x2bec0e){var _0xc6c310={};_0xc6c310[_0x2bec0e]={'$like':'%'+_0x28b8d9[_0x79a1('0x33')][_0x79a1('0x42')]+'%'};return _0xc6c310;})});}_0x431ccd=_[_0x79a1('0x40')]({},_0x431ccd,_0x28b8d9[_0x79a1('0x43')]);return _0x1a1733[_0x79a1('0x4e')](_0x431ccd);}})[_0x79a1('0x27')](function(_0x59f500){if(_0x59f500){_0x41e791=_0x59f500['length'];if(!_0x28b8d9[_0x79a1('0x33')][_0x79a1('0x39')]('nolimit')){_0x431ccd[_0x79a1('0x3b')]=qs[_0x79a1('0x3b')](_0x28b8d9['query']['limit']);_0x431ccd['offset']=qs['offset'](_0x28b8d9[_0x79a1('0x33')][_0x79a1('0x1f')]);}return _0x1a1733['getFields'](_0x431ccd);}})[_0x79a1('0x27')](function(_0x5d8cdf){if(_0x5d8cdf){return _0x5d8cdf?{'count':_0x41e791,'rows':_0x5d8cdf}:null;}})[_0x79a1('0x27')](respondWithResult(_0x34ec5e,null))['catch'](handleError(_0x34ec5e,null));};exports['getSubjects']=function(_0x293638,_0x57dc7f,_0x152d64){var _0x4dd82d={};var _0x1c944b={};var _0x48afcb;var _0x458075;return db['ZohoConfiguration'][_0x79a1('0x4f')]({'where':{'id':_0x293638[_0x79a1('0x47')]['id']}})[_0x79a1('0x27')](handleEntityNotFound(_0x57dc7f,null))[_0x79a1('0x27')](function(_0x2317de){if(_0x2317de){_0x48afcb=_0x2317de;_0x1c944b[_0x79a1('0x31')]=_['keys'](db[_0x79a1('0x50')][_0x79a1('0x2d')]);_0x1c944b[_0x79a1('0x33')]=_['keys'](_0x293638[_0x79a1('0x33')]);_0x1c944b[_0x79a1('0x34')]=_[_0x79a1('0x35')](_0x1c944b[_0x79a1('0x31')],_0x1c944b['query']);_0x4dd82d[_0x79a1('0x36')]=_['intersection'](_0x1c944b['model'],qs[_0x79a1('0x37')](_0x293638[_0x79a1('0x33')]['fields']));_0x4dd82d[_0x79a1('0x36')]=_0x4dd82d[_0x79a1('0x36')][_0x79a1('0x38')]?_0x4dd82d[_0x79a1('0x36')]:_0x1c944b['model'];_0x4dd82d[_0x79a1('0x3c')]=qs[_0x79a1('0x3d')](_0x293638[_0x79a1('0x33')][_0x79a1('0x3d')]);_0x4dd82d['where']=qs[_0x79a1('0x34')](_[_0x79a1('0x3f')](_0x293638[_0x79a1('0x33')],_0x1c944b[_0x79a1('0x34')]));if(_0x293638['query'][_0x79a1('0x42')]){_0x4dd82d[_0x79a1('0x3e')]=_[_0x79a1('0x40')](_0x4dd82d[_0x79a1('0x3e')],{'$or':_['map'](_0x4dd82d[_0x79a1('0x36')],function(_0x2b8781){var _0x186f5e={};_0x186f5e[_0x2b8781]={'$like':'%'+_0x293638[_0x79a1('0x33')]['filter']+'%'};return _0x186f5e;})});}_0x4dd82d=_['merge']({},_0x4dd82d,_0x293638[_0x79a1('0x43')]);return _0x48afcb[_0x79a1('0x51')](_0x4dd82d);}})[_0x79a1('0x27')](function(_0x80e7c8){if(_0x80e7c8){_0x458075=_0x80e7c8[_0x79a1('0x38')];if(!_0x293638[_0x79a1('0x33')][_0x79a1('0x39')](_0x79a1('0x3a'))){_0x4dd82d[_0x79a1('0x3b')]=qs['limit'](_0x293638['query'][_0x79a1('0x3b')]);_0x4dd82d[_0x79a1('0x1f')]=qs[_0x79a1('0x1f')](_0x293638[_0x79a1('0x33')][_0x79a1('0x1f')]);}return _0x48afcb[_0x79a1('0x51')](_0x4dd82d);}})[_0x79a1('0x27')](function(_0x193ff2){if(_0x193ff2){return _0x193ff2?{'count':_0x458075,'rows':_0x193ff2}:null;}})[_0x79a1('0x27')](respondWithResult(_0x57dc7f,null))['catch'](handleError(_0x57dc7f,null));};exports[_0x79a1('0x52')]=function(_0x327257,_0x4e17c9,_0x3f0b84){var _0x25c9c6={};var _0x16249b={};var _0x59d582;var _0x2fbd26;return db['ZohoConfiguration'][_0x79a1('0x4f')]({'where':{'id':_0x327257[_0x79a1('0x47')]['id']}})['then'](handleEntityNotFound(_0x4e17c9,null))[_0x79a1('0x27')](function(_0x252330){if(_0x252330){_0x59d582=_0x252330;_0x16249b['model']=_['keys'](db[_0x79a1('0x50')]['rawAttributes']);_0x16249b['query']=_[_0x79a1('0x32')](_0x327257[_0x79a1('0x33')]);_0x16249b['filters']=_[_0x79a1('0x35')](_0x16249b[_0x79a1('0x31')],_0x16249b[_0x79a1('0x33')]);_0x25c9c6[_0x79a1('0x36')]=_[_0x79a1('0x35')](_0x16249b[_0x79a1('0x31')],qs[_0x79a1('0x37')](_0x327257[_0x79a1('0x33')][_0x79a1('0x37')]));_0x25c9c6[_0x79a1('0x36')]=_0x25c9c6['attributes'][_0x79a1('0x38')]?_0x25c9c6[_0x79a1('0x36')]:_0x16249b[_0x79a1('0x31')];_0x25c9c6['order']=qs[_0x79a1('0x3d')](_0x327257[_0x79a1('0x33')][_0x79a1('0x3d')]);_0x25c9c6[_0x79a1('0x3e')]=qs['filters'](_[_0x79a1('0x3f')](_0x327257[_0x79a1('0x33')],_0x16249b['filters']));if(_0x327257[_0x79a1('0x33')]['filter']){_0x25c9c6['where']=_[_0x79a1('0x40')](_0x25c9c6['where'],{'$or':_['map'](_0x25c9c6['attributes'],function(_0x2ca98d){var _0x5d6418={};_0x5d6418[_0x2ca98d]={'$like':'%'+_0x327257[_0x79a1('0x33')][_0x79a1('0x42')]+'%'};return _0x5d6418;})});}_0x25c9c6=_['merge']({},_0x25c9c6,_0x327257[_0x79a1('0x43')]);return _0x59d582['getDescriptions'](_0x25c9c6);}})[_0x79a1('0x27')](function(_0x25972c){if(_0x25972c){_0x2fbd26=_0x25972c[_0x79a1('0x38')];if(!_0x327257[_0x79a1('0x33')][_0x79a1('0x39')](_0x79a1('0x3a'))){_0x25c9c6[_0x79a1('0x3b')]=qs[_0x79a1('0x3b')](_0x327257[_0x79a1('0x33')]['limit']);_0x25c9c6[_0x79a1('0x1f')]=qs[_0x79a1('0x1f')](_0x327257['query'][_0x79a1('0x1f')]);}return _0x59d582[_0x79a1('0x52')](_0x25c9c6);}})[_0x79a1('0x27')](function(_0x199201){if(_0x199201){return _0x199201?{'count':_0x2fbd26,'rows':_0x199201}:null;}})[_0x79a1('0x27')](respondWithResult(_0x4e17c9,null))[_0x79a1('0x4c')](handleError(_0x4e17c9,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 2a7a9d7..4baa64e 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 _0x6e1c=['exports','define','ZohoConfiguration','int_zoho_configurations','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes'];(function(_0xe283ba,_0x3c5fd0){var _0x1753ca=function(_0x47c247){while(--_0x47c247){_0xe283ba['push'](_0xe283ba['shift']());}};_0x1753ca(++_0x3c5fd0);}(_0x6e1c,0x1e5));var _0xc6e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6e1c[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc6e1('0x0'))(_0xc6e1('0x1'));var moment=require(_0xc6e1('0x2'));var BPromise=require(_0xc6e1('0x3'));var rp=require(_0xc6e1('0x4'));var fs=require('fs');var path=require(_0xc6e1('0x5'));var rimraf=require(_0xc6e1('0x6'));var config=require(_0xc6e1('0x7'));var attributes=require(_0xc6e1('0x8'));module[_0xc6e1('0x9')]=function(_0x1dec4c,_0x1b0e11){return _0x1dec4c[_0xc6e1('0xa')](_0xc6e1('0xb'),attributes,{'tableName':_0xc6e1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb37e=['moment','bluebird','path','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xb37e,0x96));var _0xeb37=function(_0x7be865,_0x3dab14){_0x7be865=_0x7be865-0x0;var _0x1ff086=_0xb37e[_0x7be865];return _0x1ff086;};'use strict';var _=require(_0xeb37('0x0'));var util=require(_0xeb37('0x1'));var logger=require(_0xeb37('0x2'))(_0xeb37('0x3'));var moment=require(_0xeb37('0x4'));var BPromise=require(_0xeb37('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb37('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0xeb37('0x7')]=function(_0x589690,_0x14d305){return _0x589690[_0xeb37('0x8')](_0xeb37('0x9'),attributes,{'tableName':_0xeb37('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index cfff39b..8802823 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 _0x6690=['then','info','request\x20sent','error','code','message','ZohoConfiguration,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2a3c4d,_0x9c6b37){var _0x55c390=function(_0x4871cf){while(--_0x4871cf){_0x2a3c4d['push'](_0x2a3c4d['shift']());}};_0x55c390(++_0x9c6b37);}(_0x6690,0x119));var _0x0669=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x6690[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x0669('0x0'));var util=require('util');var moment=require(_0x0669('0x1'));var BPromise=require(_0x0669('0x2'));var rs=require(_0x0669('0x3'));var fs=require('fs');var Redis=require(_0x0669('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0669('0x5'));var logger=require(_0x0669('0x6'))(_0x0669('0x7'));var config=require(_0x0669('0x8'));var jayson=require(_0x0669('0x9'));var client=jayson[_0x0669('0xa')][_0x0669('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a851e,_0x2d6fbd,_0x4cdc3f){return new BPromise(function(_0x421a9d,_0x2d8124){return client[_0x0669('0xc')](_0x5a851e,_0x4cdc3f)[_0x0669('0xd')](function(_0x621ccd){logger[_0x0669('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x2d6fbd,_0x0669('0xf'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x2d6fbd,_0x0669('0xf'),JSON['stringify'](_0x621ccd));if(_0x621ccd[_0x0669('0x10')]){if(_0x621ccd[_0x0669('0x10')][_0x0669('0x11')]===0x1f4){logger[_0x0669('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x2d6fbd,_0x621ccd[_0x0669('0x10')][_0x0669('0x12')]);return _0x2d8124(_0x621ccd[_0x0669('0x10')]['message']);}logger[_0x0669('0x10')](_0x0669('0x13'),_0x2d6fbd,_0x621ccd[_0x0669('0x10')][_0x0669('0x12')]);return _0x421a9d(_0x621ccd[_0x0669('0x10')][_0x0669('0x12')]);}else{logger[_0x0669('0xe')](_0x0669('0x13'),_0x2d6fbd,_0x0669('0xf'));_0x421a9d(_0x621ccd[_0x0669('0x14')][_0x0669('0x12')]);}})['catch'](function(_0x35d46c){logger[_0x0669('0x10')](_0x0669('0x13'),_0x2d6fbd,_0x35d46c);_0x2d8124(_0x35d46c);});});} \ No newline at end of file +var _0x499c=['then','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request'];(function(_0x4fa665,_0x1ae12a){var _0x62ccff=function(_0x4f0bb8){while(--_0x4f0bb8){_0x4fa665['push'](_0x4fa665['shift']());}};_0x62ccff(++_0x1ae12a);}(_0x499c,0x199));var _0xc499=function(_0x3259eb,_0xac7843){_0x3259eb=_0x3259eb-0x0;var _0x461ef0=_0x499c[_0x3259eb];return _0x461ef0;};'use strict';var _=require(_0xc499('0x0'));var util=require(_0xc499('0x1'));var moment=require(_0xc499('0x2'));var BPromise=require(_0xc499('0x3'));var rs=require(_0xc499('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc499('0x5'))['db'];var utils=require(_0xc499('0x6'));var logger=require('../../config/logger')(_0xc499('0x7'));var config=require('../../config/environment');var jayson=require(_0xc499('0x8'));var client=jayson[_0xc499('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e868c,_0x3bfd09,_0x42ddf7){return new BPromise(function(_0x4f9011,_0x217dc8){return client[_0xc499('0xa')](_0x2e868c,_0x42ddf7)[_0xc499('0xb')](function(_0x2b9816){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x3bfd09,_0xc499('0xc'));logger['debug'](_0xc499('0xd'),_0x3bfd09,'request\x20sent',JSON[_0xc499('0xe')](_0x2b9816));if(_0x2b9816['error']){if(_0x2b9816[_0xc499('0xf')][_0xc499('0x10')]===0x1f4){logger['error'](_0xc499('0x11'),_0x3bfd09,_0x2b9816[_0xc499('0xf')][_0xc499('0x12')]);return _0x217dc8(_0x2b9816[_0xc499('0xf')][_0xc499('0x12')]);}logger[_0xc499('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x3bfd09,_0x2b9816['error'][_0xc499('0x12')]);return _0x4f9011(_0x2b9816[_0xc499('0xf')][_0xc499('0x12')]);}else{logger[_0xc499('0x13')](_0xc499('0x11'),_0x3bfd09,'request\x20sent');_0x4f9011(_0x2b9816['result'][_0xc499('0x12')]);}})[_0xc499('0x14')](function(_0x14ef82){logger[_0xc499('0xf')](_0xc499('0x11'),_0x3bfd09,_0x14ef82);_0x217dc8(_0x14ef82);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index b74d96e..74f97e8 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 _0x4fe2=['create','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0xfdd130,_0x167c04){var _0x14b8ea=function(_0x1f2be2){while(--_0x1f2be2){_0xfdd130['push'](_0xfdd130['shift']());}};_0x14b8ea(++_0x167c04);}(_0x4fe2,0x1ad));var _0x24fe=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x4fe2[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x24fe('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x24fe('0x1'));var express=require('express');var router=express[_0x24fe('0x2')]();var fs_extra=require(_0x24fe('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x24fe('0x4'));var config=require(_0x24fe('0x5'));var controller=require(_0x24fe('0x6'));router[_0x24fe('0x7')]('/',auth[_0x24fe('0x8')](),controller[_0x24fe('0x9')]);router[_0x24fe('0x7')](_0x24fe('0xa'),auth['isAuthenticated'](),controller[_0x24fe('0xb')]);router[_0x24fe('0xc')]('/',auth[_0x24fe('0x8')](),controller[_0x24fe('0xd')]);router['put'](_0x24fe('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x24fe('0xe')](_0x24fe('0xa'),auth[_0x24fe('0x8')](),controller[_0x24fe('0xf')]);module[_0x24fe('0x10')]=router; \ No newline at end of file +var _0x00cc=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','update','delete','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x00cc,0x121));var _0xc00c=function(_0x44f7a2,_0x1ceac1){_0x44f7a2=_0x44f7a2-0x0;var _0x3f1493=_0x00cc[_0x44f7a2];return _0x3f1493;};'use strict';var multer=require(_0xc00c('0x0'));var util=require(_0xc00c('0x1'));var path=require(_0xc00c('0x2'));var timeout=require(_0xc00c('0x3'));var express=require(_0xc00c('0x4'));var router=express[_0xc00c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc00c('0x6'));var interaction=require(_0xc00c('0x7'));var config=require(_0xc00c('0x8'));var controller=require('./intZohoField.controller');router[_0xc00c('0x9')]('/',auth[_0xc00c('0xa')](),controller[_0xc00c('0xb')]);router[_0xc00c('0x9')](_0xc00c('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xc00c('0xd')]('/',auth[_0xc00c('0xa')](),controller['create']);router['put'](_0xc00c('0xc'),auth[_0xc00c('0xa')](),controller[_0xc00c('0xe')]);router[_0xc00c('0xf')]('/:id',auth[_0xc00c('0xa')](),controller['destroy']);module[_0xc00c('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 8eaefe8..476d89a 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 _0x71f2=['string','variable','keyValue','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x48072d,_0x526ab8){var _0x5f220f=function(_0x47c63e){while(--_0x47c63e){_0x48072d['push'](_0x48072d['shift']());}};_0x5f220f(++_0x526ab8);}(_0x71f2,0xa8));var _0x271f=function(_0x3c36a6,_0x594d9e){_0x3c36a6=_0x3c36a6-0x0;var _0x267290=_0x71f2[_0x3c36a6];return _0x267290;};'use strict';var Sequelize=require(_0x271f('0x0'));module[_0x271f('0x1')]={'type':{'type':Sequelize[_0x271f('0x2')](_0x271f('0x3'),_0x271f('0x4'),'customVariable',_0x271f('0x5'),'picklist'),'defaultValue':_0x271f('0x3')},'content':{'type':Sequelize[_0x271f('0x6')]},'key':{'type':Sequelize[_0x271f('0x6')]},'keyType':{'type':Sequelize[_0x271f('0x2')]('string',_0x271f('0x4'),_0x271f('0x7'))},'keyContent':{'type':Sequelize[_0x271f('0x6')]},'idField':{'type':Sequelize[_0x271f('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x271f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x271f('0x6')]}}; \ No newline at end of file +var _0x7956=['customVariable','BOOLEAN','exports','ENUM','variable','keyValue','picklist','STRING','string'];(function(_0x714494,_0x13f8b7){var _0xff7918=function(_0x47d55e){while(--_0x47d55e){_0x714494['push'](_0x714494['shift']());}};_0xff7918(++_0x13f8b7);}(_0x7956,0x1a9));var _0x6795=function(_0xf6ede2,_0x25a5c){_0xf6ede2=_0xf6ede2-0x0;var _0x4cce6b=_0x7956[_0xf6ede2];return _0x4cce6b;};'use strict';var Sequelize=require('sequelize');module[_0x6795('0x0')]={'type':{'type':Sequelize[_0x6795('0x1')]('string',_0x6795('0x2'),'customVariable',_0x6795('0x3'),_0x6795('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6795('0x5')]},'key':{'type':Sequelize[_0x6795('0x5')]},'keyType':{'type':Sequelize[_0x6795('0x1')](_0x6795('0x6'),_0x6795('0x2'),_0x6795('0x7'))},'keyContent':{'type':Sequelize[_0x6795('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6795('0x5')]},'customField':{'type':Sequelize[_0x6795('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6795('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 17fd340..704f627 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 _0x36be=['type','VIRTUAL','options','ZohoField','includeAll','include','catch','show','create','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','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','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map'];(function(_0x9a570c,_0x3fd28b){var _0x2ab871=function(_0x2d1a5a){while(--_0x2d1a5a){_0x9a570c['push'](_0x9a570c['shift']());}};_0x2ab871(++_0x3fd28b);}(_0x36be,0x1ce));var _0xe36b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x36be[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xe36b('0x0'));var rimraf=require(_0xe36b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe36b('0x2'));var rp=require(_0xe36b('0x3'));var moment=require(_0xe36b('0x4'));var BPromise=require(_0xe36b('0x5'));var Mustache=require('mustache');var util=require(_0xe36b('0x6'));var path=require(_0xe36b('0x7'));var sox=require(_0xe36b('0x8'));var csv=require(_0xe36b('0x9'));var ejs=require(_0xe36b('0xa'));var fs=require('fs');var fs_extra=require(_0xe36b('0xb'));var _=require(_0xe36b('0xc'));var squel=require('squel');var crypto=require(_0xe36b('0xd'));var jsforce=require(_0xe36b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe36b('0x9'));var querystring=require('querystring');var Papa=require(_0xe36b('0xf'));var Redis=require(_0xe36b('0x10'));var authService=require(_0xe36b('0x11'));var qs=require(_0xe36b('0x12'));var as=require(_0xe36b('0x13'));var hardwareService=require(_0xe36b('0x14'));var logger=require(_0xe36b('0x15'))('api');var utils=require(_0xe36b('0x16'));var config=require(_0xe36b('0x17'));var licenseUtil=require(_0xe36b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1030c6,_0x290eee){_0x290eee=_0x290eee||0xcc;return function(_0x235088){if(_0x235088){return _0x1030c6['sendStatus'](_0x290eee);}return _0x1030c6[_0xe36b('0x19')](_0x290eee)['end']();};}function respondWithResult(_0x5b5681,_0x2bc78e){_0x2bc78e=_0x2bc78e||0xc8;return function(_0x2c4c39){if(_0x2c4c39){return _0x5b5681['status'](_0x2bc78e)[_0xe36b('0x1a')](_0x2c4c39);}};}function respondWithFilteredResult(_0x53c9e3,_0x471199){return function(_0xe8652b){if(_0xe8652b){var _0x33f09f=typeof _0x471199[_0xe36b('0x1b')]==='undefined'&&typeof _0x471199[_0xe36b('0x1c')]===_0xe36b('0x1d');var _0x5a61c6=_0xe8652b[_0xe36b('0x1e')];var _0x5beae0=_0x33f09f?0x0:_0x471199[_0xe36b('0x1b')];var _0x5e5f64=_0x33f09f?_0xe8652b[_0xe36b('0x1e')]:_0x471199['offset']+_0x471199[_0xe36b('0x1c')];var _0x49d53a;if(_0x5e5f64>=_0x5a61c6){_0x5e5f64=_0x5a61c6;_0x49d53a=0xc8;}else{_0x49d53a=0xce;}_0x53c9e3[_0xe36b('0x19')](_0x49d53a);return _0x53c9e3[_0xe36b('0x1f')](_0xe36b('0x20'),_0x5beae0+'-'+_0x5e5f64+'/'+_0x5a61c6)[_0xe36b('0x1a')](_0xe8652b);}return null;};}function patchUpdates(_0x23599e){return function(_0x22bf7e){try{jsonpatch[_0xe36b('0x21')](_0x22bf7e,_0x23599e,!![]);}catch(_0x5ec6fd){return BPromise[_0xe36b('0x22')](_0x5ec6fd);}return _0x22bf7e[_0xe36b('0x23')]();};}function saveUpdates(_0x36465b,_0xfc62df){return function(_0x38120b){if(_0x38120b){return _0x38120b[_0xe36b('0x24')](_0x36465b)[_0xe36b('0x25')](function(_0x596a1e){return _0x596a1e;});}return null;};}function removeEntity(_0x5aca7e,_0x91daae){return function(_0x5dae91){if(_0x5dae91){return _0x5dae91[_0xe36b('0x26')]()['then'](function(){_0x5aca7e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x21f0b3,_0x4ca68a){return function(_0x1720c3){if(!_0x1720c3){_0x21f0b3[_0xe36b('0x27')](0x194);}return _0x1720c3;};}function handleError(_0x6c1f93,_0xced3d2){_0xced3d2=_0xced3d2||0x1f4;return function(_0x113652){logger['error'](_0x113652[_0xe36b('0x28')]);if(_0x113652['name']){delete _0x113652[_0xe36b('0x29')];}_0x6c1f93['status'](_0xced3d2)[_0xe36b('0x2a')](_0x113652);};}exports[_0xe36b('0x2b')]=function(_0x32e66d,_0x226ebc){var _0x1ff770={},_0x2c74fd={},_0x322930={'count':0x0,'rows':[]};var _0x511f36=_['map'](db['ZohoField'][_0xe36b('0x2c')],function(_0x585479){return{'name':_0x585479[_0xe36b('0x2d')],'type':_0x585479['type'][_0xe36b('0x2e')]};});_0x2c74fd[_0xe36b('0x2f')]=_['map'](_0x511f36,'name');_0x2c74fd[_0xe36b('0x30')]=_[_0xe36b('0x31')](_0x32e66d['query']);_0x2c74fd[_0xe36b('0x32')]=_['intersection'](_0x2c74fd[_0xe36b('0x2f')],_0x2c74fd[_0xe36b('0x30')]);_0x1ff770[_0xe36b('0x33')]=_[_0xe36b('0x34')](_0x2c74fd[_0xe36b('0x2f')],qs[_0xe36b('0x35')](_0x32e66d[_0xe36b('0x30')][_0xe36b('0x35')]));_0x1ff770[_0xe36b('0x33')]=_0x1ff770[_0xe36b('0x33')][_0xe36b('0x36')]?_0x1ff770[_0xe36b('0x33')]:_0x2c74fd['model'];if(!_0x32e66d[_0xe36b('0x30')][_0xe36b('0x37')](_0xe36b('0x38'))){_0x1ff770[_0xe36b('0x1c')]=qs[_0xe36b('0x1c')](_0x32e66d[_0xe36b('0x30')][_0xe36b('0x1c')]);_0x1ff770['offset']=qs[_0xe36b('0x1b')](_0x32e66d['query'][_0xe36b('0x1b')]);}_0x1ff770[_0xe36b('0x39')]=qs[_0xe36b('0x3a')](_0x32e66d['query'][_0xe36b('0x3a')]);_0x1ff770[_0xe36b('0x3b')]=qs[_0xe36b('0x32')](_['pick'](_0x32e66d['query'],_0x2c74fd[_0xe36b('0x32')]),_0x511f36);if(_0x32e66d[_0xe36b('0x30')][_0xe36b('0x3c')]){_0x1ff770[_0xe36b('0x3b')]=_[_0xe36b('0x3d')](_0x1ff770[_0xe36b('0x3b')],{'$or':_[_0xe36b('0x3e')](_0x511f36,function(_0x2a668a){if(_0x2a668a[_0xe36b('0x3f')]!==_0xe36b('0x40')){var _0x1db986={};_0x1db986[_0x2a668a['name']]={'$like':'%'+_0x32e66d['query'][_0xe36b('0x3c')]+'%'};return _0x1db986;}})});}_0x1ff770=_[_0xe36b('0x3d')]({},_0x1ff770,_0x32e66d[_0xe36b('0x41')]);var _0xe9238e={'where':_0x1ff770[_0xe36b('0x3b')]};return db[_0xe36b('0x42')][_0xe36b('0x1e')](_0xe9238e)[_0xe36b('0x25')](function(_0x46c41a){_0x322930['count']=_0x46c41a;if(_0x32e66d[_0xe36b('0x30')][_0xe36b('0x43')]){_0x1ff770[_0xe36b('0x44')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x1ff770);})[_0xe36b('0x25')](function(_0x67e126){_0x322930['rows']=_0x67e126;return _0x322930;})[_0xe36b('0x25')](respondWithFilteredResult(_0x226ebc,_0x1ff770))[_0xe36b('0x45')](handleError(_0x226ebc,null));};exports[_0xe36b('0x46')]=function(_0x392d09,_0x315ccc){var _0x124749={'raw':!![],'where':{'id':_0x392d09['params']['id']}},_0x15379b={};_0x15379b['model']=_[_0xe36b('0x31')](db[_0xe36b('0x42')][_0xe36b('0x2c')]);_0x15379b[_0xe36b('0x30')]=_[_0xe36b('0x31')](_0x392d09[_0xe36b('0x30')]);_0x15379b[_0xe36b('0x32')]=_[_0xe36b('0x34')](_0x15379b[_0xe36b('0x2f')],_0x15379b[_0xe36b('0x30')]);_0x124749[_0xe36b('0x33')]=_[_0xe36b('0x34')](_0x15379b[_0xe36b('0x2f')],qs['fields'](_0x392d09[_0xe36b('0x30')][_0xe36b('0x35')]));_0x124749[_0xe36b('0x33')]=_0x124749[_0xe36b('0x33')][_0xe36b('0x36')]?_0x124749[_0xe36b('0x33')]:_0x15379b['model'];if(_0x392d09[_0xe36b('0x30')][_0xe36b('0x43')]){_0x124749['include']=[{'all':!![]}];}_0x124749=_[_0xe36b('0x3d')]({},_0x124749,_0x392d09[_0xe36b('0x41')]);return db[_0xe36b('0x42')]['find'](_0x124749)['then'](handleEntityNotFound(_0x315ccc,null))['then'](respondWithResult(_0x315ccc,null))['catch'](handleError(_0x315ccc,null));};exports[_0xe36b('0x47')]=function(_0x256ca5,_0x2a75b2){return db[_0xe36b('0x42')][_0xe36b('0x47')](_0x256ca5[_0xe36b('0x48')],{})['then'](respondWithResult(_0x2a75b2,0xc9))['catch'](handleError(_0x2a75b2,null));};exports[_0xe36b('0x24')]=function(_0x5690a8,_0x1ff500){if(_0x5690a8[_0xe36b('0x48')]['id']){delete _0x5690a8[_0xe36b('0x48')]['id'];}return db[_0xe36b('0x42')][_0xe36b('0x49')]({'where':{'id':_0x5690a8[_0xe36b('0x4a')]['id']}})[_0xe36b('0x25')](handleEntityNotFound(_0x1ff500,null))['then'](saveUpdates(_0x5690a8[_0xe36b('0x48')],null))['then'](respondWithResult(_0x1ff500,null))['catch'](handleError(_0x1ff500,null));};exports[_0xe36b('0x26')]=function(_0x1bf88e,_0x4c1421){return db[_0xe36b('0x42')][_0xe36b('0x49')]({'where':{'id':_0x1bf88e['params']['id']}})[_0xe36b('0x25')](handleEntityNotFound(_0x4c1421,null))[_0xe36b('0x25')](removeEntity(_0x4c1421,null))['catch'](handleError(_0x4c1421,null));}; \ No newline at end of file +var _0xcbcd=['merge','VIRTUAL','includeAll','rows','catch','show','params','keys','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter'];(function(_0x5562c7,_0x19b0ea){var _0x244381=function(_0x3fc31e){while(--_0x3fc31e){_0x5562c7['push'](_0x5562c7['shift']());}};_0x244381(++_0x19b0ea);}(_0xcbcd,0x1bb));var _0xdcbc=function(_0x5e1e25,_0xdc1421){_0x5e1e25=_0x5e1e25-0x0;var _0x548e5f=_0xcbcd[_0x5e1e25];return _0x548e5f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdcbc('0x0'));var zipdir=require(_0xdcbc('0x1'));var jsonpatch=require(_0xdcbc('0x2'));var rp=require(_0xdcbc('0x3'));var moment=require(_0xdcbc('0x4'));var BPromise=require(_0xdcbc('0x5'));var Mustache=require('mustache');var util=require(_0xdcbc('0x6'));var path=require(_0xdcbc('0x7'));var sox=require(_0xdcbc('0x8'));var csv=require(_0xdcbc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdcbc('0xa'));var _=require(_0xdcbc('0xb'));var squel=require('squel');var crypto=require(_0xdcbc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdcbc('0xd'));var toCsv=require(_0xdcbc('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdcbc('0xe'));var authService=require(_0xdcbc('0xf'));var qs=require(_0xdcbc('0x10'));var as=require(_0xdcbc('0x11'));var hardwareService=require(_0xdcbc('0x12'));var logger=require(_0xdcbc('0x13'))(_0xdcbc('0x14'));var utils=require(_0xdcbc('0x15'));var config=require(_0xdcbc('0x16'));var licenseUtil=require(_0xdcbc('0x17'));var db=require(_0xdcbc('0x18'))['db'];function respondWithStatusCode(_0x9791d2,_0x1c8246){_0x1c8246=_0x1c8246||0xcc;return function(_0x5f0a86){if(_0x5f0a86){return _0x9791d2[_0xdcbc('0x19')](_0x1c8246);}return _0x9791d2[_0xdcbc('0x1a')](_0x1c8246)[_0xdcbc('0x1b')]();};}function respondWithResult(_0x1df334,_0x43db4d){_0x43db4d=_0x43db4d||0xc8;return function(_0x541ee7){if(_0x541ee7){return _0x1df334[_0xdcbc('0x1a')](_0x43db4d)[_0xdcbc('0x1c')](_0x541ee7);}};}function respondWithFilteredResult(_0x332753,_0x3f48aa){return function(_0x20c12b){if(_0x20c12b){var _0x37155f=typeof _0x3f48aa[_0xdcbc('0x1d')]===_0xdcbc('0x1e')&&typeof _0x3f48aa['limit']===_0xdcbc('0x1e');var _0x5b21fb=_0x20c12b['count'];var _0x2dc69c=_0x37155f?0x0:_0x3f48aa['offset'];var _0x8a2197=_0x37155f?_0x20c12b[_0xdcbc('0x1f')]:_0x3f48aa[_0xdcbc('0x1d')]+_0x3f48aa[_0xdcbc('0x20')];var _0x26dc7b;if(_0x8a2197>=_0x5b21fb){_0x8a2197=_0x5b21fb;_0x26dc7b=0xc8;}else{_0x26dc7b=0xce;}_0x332753[_0xdcbc('0x1a')](_0x26dc7b);return _0x332753['set'](_0xdcbc('0x21'),_0x2dc69c+'-'+_0x8a2197+'/'+_0x5b21fb)[_0xdcbc('0x1c')](_0x20c12b);}return null;};}function patchUpdates(_0x12e818){return function(_0x220718){try{jsonpatch[_0xdcbc('0x22')](_0x220718,_0x12e818,!![]);}catch(_0x321316){return BPromise[_0xdcbc('0x23')](_0x321316);}return _0x220718['save']();};}function saveUpdates(_0x1cc8db,_0x826c1b){return function(_0x2ac39b){if(_0x2ac39b){return _0x2ac39b[_0xdcbc('0x24')](_0x1cc8db)[_0xdcbc('0x25')](function(_0x4ce2cd){return _0x4ce2cd;});}return null;};}function removeEntity(_0x30cb5a,_0x25b732){return function(_0x38426f){if(_0x38426f){return _0x38426f[_0xdcbc('0x26')]()[_0xdcbc('0x25')](function(){_0x30cb5a[_0xdcbc('0x1a')](0xcc)[_0xdcbc('0x1b')]();});}};}function handleEntityNotFound(_0x1893f6,_0xa839cf){return function(_0x49d260){if(!_0x49d260){_0x1893f6[_0xdcbc('0x19')](0x194);}return _0x49d260;};}function handleError(_0x23538f,_0x31e4ec){_0x31e4ec=_0x31e4ec||0x1f4;return function(_0x9c99f4){logger[_0xdcbc('0x27')](_0x9c99f4[_0xdcbc('0x28')]);if(_0x9c99f4[_0xdcbc('0x29')]){delete _0x9c99f4[_0xdcbc('0x29')];}_0x23538f['status'](_0x31e4ec)['send'](_0x9c99f4);};}exports[_0xdcbc('0x2a')]=function(_0x3da22b,_0x413220){var _0x4df13d={},_0xb2a26e={},_0x1827a3={'count':0x0,'rows':[]};var _0x5d6a49=_[_0xdcbc('0x2b')](db[_0xdcbc('0x2c')][_0xdcbc('0x2d')],function(_0x1d35ea){return{'name':_0x1d35ea[_0xdcbc('0x2e')],'type':_0x1d35ea[_0xdcbc('0x2f')][_0xdcbc('0x30')]};});_0xb2a26e[_0xdcbc('0x31')]=_[_0xdcbc('0x2b')](_0x5d6a49,_0xdcbc('0x29'));_0xb2a26e[_0xdcbc('0x32')]=_['keys'](_0x3da22b[_0xdcbc('0x32')]);_0xb2a26e[_0xdcbc('0x33')]=_[_0xdcbc('0x34')](_0xb2a26e[_0xdcbc('0x31')],_0xb2a26e[_0xdcbc('0x32')]);_0x4df13d['attributes']=_[_0xdcbc('0x34')](_0xb2a26e[_0xdcbc('0x31')],qs['fields'](_0x3da22b[_0xdcbc('0x32')][_0xdcbc('0x35')]));_0x4df13d[_0xdcbc('0x36')]=_0x4df13d['attributes'][_0xdcbc('0x37')]?_0x4df13d[_0xdcbc('0x36')]:_0xb2a26e[_0xdcbc('0x31')];if(!_0x3da22b['query'][_0xdcbc('0x38')]('nolimit')){_0x4df13d[_0xdcbc('0x20')]=qs[_0xdcbc('0x20')](_0x3da22b[_0xdcbc('0x32')]['limit']);_0x4df13d[_0xdcbc('0x1d')]=qs['offset'](_0x3da22b[_0xdcbc('0x32')]['offset']);}_0x4df13d[_0xdcbc('0x39')]=qs[_0xdcbc('0x3a')](_0x3da22b[_0xdcbc('0x32')]['sort']);_0x4df13d[_0xdcbc('0x3b')]=qs['filters'](_['pick'](_0x3da22b[_0xdcbc('0x32')],_0xb2a26e[_0xdcbc('0x33')]),_0x5d6a49);if(_0x3da22b[_0xdcbc('0x32')][_0xdcbc('0x3c')]){_0x4df13d[_0xdcbc('0x3b')]=_[_0xdcbc('0x3d')](_0x4df13d['where'],{'$or':_['map'](_0x5d6a49,function(_0x5c5320){if(_0x5c5320[_0xdcbc('0x2f')]!==_0xdcbc('0x3e')){var _0x1eb413={};_0x1eb413[_0x5c5320[_0xdcbc('0x29')]]={'$like':'%'+_0x3da22b[_0xdcbc('0x32')][_0xdcbc('0x3c')]+'%'};return _0x1eb413;}})});}_0x4df13d=_[_0xdcbc('0x3d')]({},_0x4df13d,_0x3da22b['options']);var _0x3bdb2f={'where':_0x4df13d[_0xdcbc('0x3b')]};return db[_0xdcbc('0x2c')][_0xdcbc('0x1f')](_0x3bdb2f)['then'](function(_0x3ed9c0){_0x1827a3[_0xdcbc('0x1f')]=_0x3ed9c0;if(_0x3da22b[_0xdcbc('0x32')][_0xdcbc('0x3f')]){_0x4df13d['include']=[{'all':!![]}];}return db[_0xdcbc('0x2c')]['findAll'](_0x4df13d);})[_0xdcbc('0x25')](function(_0x4d683a){_0x1827a3[_0xdcbc('0x40')]=_0x4d683a;return _0x1827a3;})['then'](respondWithFilteredResult(_0x413220,_0x4df13d))[_0xdcbc('0x41')](handleError(_0x413220,null));};exports[_0xdcbc('0x42')]=function(_0x5c8d96,_0x4c200a){var _0x44f1b7={'raw':!![],'where':{'id':_0x5c8d96[_0xdcbc('0x43')]['id']}},_0x165610={};_0x165610['model']=_[_0xdcbc('0x44')](db['ZohoField']['rawAttributes']);_0x165610[_0xdcbc('0x32')]=_['keys'](_0x5c8d96['query']);_0x165610[_0xdcbc('0x33')]=_['intersection'](_0x165610['model'],_0x165610['query']);_0x44f1b7[_0xdcbc('0x36')]=_[_0xdcbc('0x34')](_0x165610[_0xdcbc('0x31')],qs[_0xdcbc('0x35')](_0x5c8d96[_0xdcbc('0x32')][_0xdcbc('0x35')]));_0x44f1b7[_0xdcbc('0x36')]=_0x44f1b7[_0xdcbc('0x36')]['length']?_0x44f1b7[_0xdcbc('0x36')]:_0x165610['model'];if(_0x5c8d96['query'][_0xdcbc('0x3f')]){_0x44f1b7['include']=[{'all':!![]}];}_0x44f1b7=_[_0xdcbc('0x3d')]({},_0x44f1b7,_0x5c8d96['options']);return db[_0xdcbc('0x2c')][_0xdcbc('0x45')](_0x44f1b7)[_0xdcbc('0x25')](handleEntityNotFound(_0x4c200a,null))[_0xdcbc('0x25')](respondWithResult(_0x4c200a,null))[_0xdcbc('0x41')](handleError(_0x4c200a,null));};exports[_0xdcbc('0x46')]=function(_0xf19f62,_0x1afcb6){return db[_0xdcbc('0x2c')][_0xdcbc('0x46')](_0xf19f62[_0xdcbc('0x47')],{})[_0xdcbc('0x25')](respondWithResult(_0x1afcb6,0xc9))['catch'](handleError(_0x1afcb6,null));};exports[_0xdcbc('0x24')]=function(_0xdd7402,_0x10b529){if(_0xdd7402[_0xdcbc('0x47')]['id']){delete _0xdd7402[_0xdcbc('0x47')]['id'];}return db[_0xdcbc('0x2c')][_0xdcbc('0x45')]({'where':{'id':_0xdd7402[_0xdcbc('0x43')]['id']}})[_0xdcbc('0x25')](handleEntityNotFound(_0x10b529,null))[_0xdcbc('0x25')](saveUpdates(_0xdd7402[_0xdcbc('0x47')],null))[_0xdcbc('0x25')](respondWithResult(_0x10b529,null))[_0xdcbc('0x41')](handleError(_0x10b529,null));};exports[_0xdcbc('0x26')]=function(_0x6b94ba,_0x4dfcf4){return db[_0xdcbc('0x2c')]['find']({'where':{'id':_0x6b94ba[_0xdcbc('0x43')]['id']}})[_0xdcbc('0x25')](handleEntityNotFound(_0x4dfcf4,null))['then'](removeEntity(_0x4dfcf4,null))[_0xdcbc('0x41')](handleError(_0x4dfcf4,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 4773c86..b1839fa 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 _0x47c5=['ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intZohoField.attributes','exports','define'];(function(_0x54f8cb,_0xa8994e){var _0x4a1d18=function(_0x4ac6d1){while(--_0x4ac6d1){_0x54f8cb['push'](_0x54f8cb['shift']());}};_0x4a1d18(++_0xa8994e);}(_0x47c5,0x165));var _0x547c=function(_0x26557a,_0x578d08){_0x26557a=_0x26557a-0x0;var _0x53d1fb=_0x47c5[_0x26557a];return _0x53d1fb;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var logger=require(_0x547c('0x2'))(_0x547c('0x3'));var moment=require(_0x547c('0x4'));var BPromise=require(_0x547c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x547c('0x6'));var rimraf=require(_0x547c('0x7'));var config=require('../../config/environment');var attributes=require(_0x547c('0x8'));module[_0x547c('0x9')]=function(_0x51ab7f,_0x2e5b57){return _0x51ab7f[_0x547c('0xa')](_0x547c('0xb'),attributes,{'tableName':_0x547c('0xc'),'paranoid':![],'indexes':[{'name':_0x547c('0xd'),'fields':[_0x547c('0xe'),_0x547c('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash'];(function(_0x1dcd8d,_0x10d1ed){var _0x589dfd=function(_0x3802c1){while(--_0x3802c1){_0x1dcd8d['push'](_0x1dcd8d['shift']());}};_0x589dfd(++_0x10d1ed);}(_0x4975,0x86));var _0x5497=function(_0x452be9,_0xc46e68){_0x452be9=_0x452be9-0x0;var _0x42a7c4=_0x4975[_0x452be9];return _0x42a7c4;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['idField',_0x5497('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 061cad0..b505b35 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 _0x67cd=['util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x20c5f3,_0x1de81c){var _0x410711=function(_0x96a7c9){while(--_0x96a7c9){_0x20c5f3['push'](_0x20c5f3['shift']());}};_0x410711(++_0x1de81c);}(_0x67cd,0x133));var _0xd67c=function(_0x5400b,_0x55943a){_0x5400b=_0x5400b-0x0;var _0x36a39b=_0x67cd[_0x5400b];return _0x36a39b;};'use strict';var _=require(_0xd67c('0x0'));var util=require(_0xd67c('0x1'));var moment=require(_0xd67c('0x2'));var BPromise=require('bluebird');var rs=require(_0xd67c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd67c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd67c('0x5'))(_0xd67c('0x6'));var config=require(_0xd67c('0x7'));var jayson=require(_0xd67c('0x8'));var client=jayson[_0xd67c('0x9')][_0xd67c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dd7dd,_0x3bbfc9,_0x30847d){return new BPromise(function(_0x358bad,_0x58d9ae){return client['request'](_0x4dd7dd,_0x30847d)['then'](function(_0x175fa2){logger[_0xd67c('0xb')](_0xd67c('0xc'),_0x3bbfc9,_0xd67c('0xd'));logger[_0xd67c('0xe')](_0xd67c('0xf'),_0x3bbfc9,_0xd67c('0xd'),JSON[_0xd67c('0x10')](_0x175fa2));if(_0x175fa2[_0xd67c('0x11')]){if(_0x175fa2[_0xd67c('0x11')][_0xd67c('0x12')]===0x1f4){logger['error'](_0xd67c('0xc'),_0x3bbfc9,_0x175fa2[_0xd67c('0x11')][_0xd67c('0x13')]);return _0x58d9ae(_0x175fa2['error'][_0xd67c('0x13')]);}logger['error'](_0xd67c('0xc'),_0x3bbfc9,_0x175fa2[_0xd67c('0x11')][_0xd67c('0x13')]);return _0x358bad(_0x175fa2['error'][_0xd67c('0x13')]);}else{logger['info'](_0xd67c('0xc'),_0x3bbfc9,_0xd67c('0xd'));_0x358bad(_0x175fa2[_0xd67c('0x14')][_0xd67c('0x13')]);}})[_0xd67c('0x15')](function(_0x14e8a9){logger[_0xd67c('0x11')](_0xd67c('0xc'),_0x3bbfc9,_0x14e8a9);_0x58d9ae(_0x14e8a9);});});} \ No newline at end of file +var _0xf1cc=['randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xf1cc,0x147));var _0xcf1c=function(_0x265cbe,_0x14044d){_0x265cbe=_0x265cbe-0x0;var _0x1837da=_0xf1cc[_0x265cbe];return _0x1837da;};'use strict';var _=require('lodash');var util=require(_0xcf1c('0x0'));var moment=require(_0xcf1c('0x1'));var BPromise=require(_0xcf1c('0x2'));var rs=require(_0xcf1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf1c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcf1c('0x5'));var config=require(_0xcf1c('0x6'));var jayson=require(_0xcf1c('0x7'));var client=jayson[_0xcf1c('0x8')][_0xcf1c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2529ab,_0x480276,_0x32ce4a){return new BPromise(function(_0x51be32,_0x850d6){return client[_0xcf1c('0xa')](_0x2529ab,_0x32ce4a)[_0xcf1c('0xb')](function(_0x362cc0){logger[_0xcf1c('0xc')](_0xcf1c('0xd'),_0x480276,'request\x20sent');logger[_0xcf1c('0xe')](_0xcf1c('0xf'),_0x480276,_0xcf1c('0x10'),JSON[_0xcf1c('0x11')](_0x362cc0));if(_0x362cc0[_0xcf1c('0x12')]){if(_0x362cc0[_0xcf1c('0x12')][_0xcf1c('0x13')]===0x1f4){logger[_0xcf1c('0x12')](_0xcf1c('0xd'),_0x480276,_0x362cc0['error'][_0xcf1c('0x14')]);return _0x850d6(_0x362cc0[_0xcf1c('0x12')]['message']);}logger['error']('ZohoField,\x20%s,\x20%s',_0x480276,_0x362cc0['error'][_0xcf1c('0x14')]);return _0x51be32(_0x362cc0[_0xcf1c('0x12')][_0xcf1c('0x14')]);}else{logger[_0xcf1c('0xc')](_0xcf1c('0xd'),_0x480276,'request\x20sent');_0x51be32(_0x362cc0[_0xcf1c('0x15')]['message']);}})['catch'](function(_0x3e1f73){logger[_0xcf1c('0x12')](_0xcf1c('0xd'),_0x480276,_0x3e1f73);_0x850d6(_0x3e1f73);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 85cdee7..7d5c1ed 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4f2de4,_0x298aab){var _0x46bb91=function(_0x30b166){while(--_0x30b166){_0x4f2de4['push'](_0x4f2de4['shift']());}};_0x46bb91(++_0x298aab);}(_0xe706,0xa3));var _0x6e70=function(_0x350396,_0x391ad2){_0x350396=_0x350396-0x0;var _0xf306b1=_0xe706[_0x350396];return _0xf306b1;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4de391,_0x193b01){var _0x25d6f0=function(_0x55f3){while(--_0x55f3){_0x4de391['push'](_0x4de391['shift']());}};_0x25d6f0(++_0x193b01);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2fdf82,_0x322e7c){_0x2fdf82=_0x2fdf82-0x0;var _0x2382f5=_0xcb91[_0x2fdf82];return _0x2382f5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 719283c..b750ddb 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 _0xd920=['BOOLEAN','state','exports','STRING','unique_name_and_version','app.js'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xd920,0x1ee));var _0x0d92=function(_0x279368,_0x41c002){_0x279368=_0x279368-0x0;var _0x40b6d0=_0xd920[_0x279368];return _0x40b6d0;};'use strict';var Sequelize=require('sequelize');module[_0x0d92('0x0')]={'name':{'type':Sequelize[_0x0d92('0x1')],'allowNull':![],'unique':_0x0d92('0x2')},'version':{'type':Sequelize[_0x0d92('0x1')],'allowNull':![],'unique':_0x0d92('0x2')},'main':{'type':Sequelize[_0x0d92('0x1')],'defaultValue':_0x0d92('0x3')},'filename':{'type':Sequelize[_0x0d92('0x1')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0d92('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x0d92('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x0d92('0x1')]},'logo':{'type':Sequelize[_0x0d92('0x1')]},'state':{'type':Sequelize[_0x0d92('0x1')],'unique':_0x0d92('0x5')},'description':{'type':Sequelize[_0x0d92('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x0d92('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x98ab=['unique_name_and_version','STRING','INTEGER','BOOLEAN','state','exports'];(function(_0x15e3d3,_0x7c233a){var _0x1d17b0=function(_0x3d052d){while(--_0x3d052d){_0x15e3d3['push'](_0x15e3d3['shift']());}};_0x1d17b0(++_0x7c233a);}(_0x98ab,0x16d));var _0xb98a=function(_0x2b8ecb,_0x42ec28){_0x2b8ecb=_0x2b8ecb-0x0;var _0x2090ff=_0x98ab[_0x2b8ecb];return _0x2090ff;};'use strict';var Sequelize=require('sequelize');module[_0xb98a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb98a('0x1')},'version':{'type':Sequelize[_0xb98a('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xb98a('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xb98a('0x2')]},'path':{'type':Sequelize[_0xb98a('0x2')]},'type':{'type':Sequelize[_0xb98a('0x2')]},'size':{'type':Sequelize[_0xb98a('0x3')]},'active':{'type':Sequelize[_0xb98a('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xb98a('0x2')]},'logo':{'type':Sequelize[_0xb98a('0x2')]},'state':{'type':Sequelize[_0xb98a('0x2')],'unique':_0xb98a('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xb98a('0x2')]},'remoteUri':{'type':Sequelize[_0xb98a('0x2')]},'link':{'type':Sequelize[_0xb98a('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 34bd93e..cf41fbb 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 _0xc4aa=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../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','Integration','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xc4aa[_0x11005e];return _0x29338f;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}exports[_0xac4a('0x2a')]=function(_0x42a33c,_0x2772fe){var _0x116700={},_0x4a5a9e={},_0x47f49c={'count':0x0,'rows':[]};var _0xdb7e=_[_0xac4a('0x2b')](db[_0xac4a('0x2c')]['rawAttributes'],function(_0x4bda1f){return{'name':_0x4bda1f[_0xac4a('0x2d')],'type':_0x4bda1f[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x4a5a9e[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0xdb7e,'name');_0x4a5a9e[_0xac4a('0x31')]=_['keys'](_0x42a33c[_0xac4a('0x31')]);_0x4a5a9e['filters']=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],_0x4a5a9e[_0xac4a('0x31')]);_0x116700[_0xac4a('0x33')]=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x34')]));_0x116700[_0xac4a('0x33')]=_0x116700[_0xac4a('0x33')][_0xac4a('0x35')]?_0x116700[_0xac4a('0x33')]:_0x4a5a9e[_0xac4a('0x30')];if(!_0x42a33c['query'][_0xac4a('0x36')](_0xac4a('0x37'))){_0x116700['limit']=qs[_0xac4a('0x1d')](_0x42a33c[_0xac4a('0x31')]['limit']);_0x116700['offset']=qs[_0xac4a('0x1b')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x1b')]);}_0x116700[_0xac4a('0x38')]=qs['sort'](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x39')]);_0x116700['where']=qs[_0xac4a('0x3a')](_[_0xac4a('0x3b')](_0x42a33c[_0xac4a('0x31')],_0x4a5a9e['filters']),_0xdb7e);if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x3c')]){_0x116700[_0xac4a('0x3d')]=_['merge'](_0x116700[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2b')](_0xdb7e,function(_0x4b9faf){if(_0x4b9faf['type']!==_0xac4a('0x3e')){var _0x5e0926={};_0x5e0926[_0x4b9faf['name']]={'$like':'%'+_0x42a33c['query']['filter']+'%'};return _0x5e0926;}})});}_0x116700=_[_0xac4a('0x3f')]({},_0x116700,_0x42a33c[_0xac4a('0x40')]);var _0x37834b={'where':_0x116700[_0xac4a('0x3d')]};return db[_0xac4a('0x2c')][_0xac4a('0x1e')](_0x37834b)[_0xac4a('0x24')](function(_0x2b16f0){_0x47f49c[_0xac4a('0x1e')]=_0x2b16f0;if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x41')]){_0x116700[_0xac4a('0x42')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x116700);})['then'](function(_0x1e1cc5){_0x47f49c[_0xac4a('0x43')]=_0x1e1cc5;return _0x47f49c;})[_0xac4a('0x24')](respondWithFilteredResult(_0x2772fe,_0x116700))[_0xac4a('0x44')](handleError(_0x2772fe,null));};exports[_0xac4a('0x45')]=function(_0x411543,_0x8febf0){var _0x3441f2={'raw':![],'where':{'id':_0x411543[_0xac4a('0x46')]['id']}},_0x3e9973={};_0x3e9973['model']=_[_0xac4a('0x47')](db[_0xac4a('0x2c')][_0xac4a('0x48')]);_0x3e9973[_0xac4a('0x31')]=_[_0xac4a('0x47')](_0x411543['query']);_0x3e9973[_0xac4a('0x3a')]=_[_0xac4a('0x32')](_0x3e9973['model'],_0x3e9973[_0xac4a('0x31')]);_0x3441f2['attributes']=_[_0xac4a('0x32')](_0x3e9973[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x411543[_0xac4a('0x31')][_0xac4a('0x34')]));_0x3441f2[_0xac4a('0x33')]=_0x3441f2[_0xac4a('0x33')][_0xac4a('0x35')]?_0x3441f2[_0xac4a('0x33')]:_0x3e9973[_0xac4a('0x30')];if(_0x411543[_0xac4a('0x31')][_0xac4a('0x41')]){_0x3441f2['include']=[{'all':!![]}];}_0x3441f2=_[_0xac4a('0x3f')]({},_0x3441f2,_0x411543[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x3441f2)[_0xac4a('0x24')](handleEntityNotFound(_0x8febf0,null))[_0xac4a('0x24')](respondWithResult(_0x8febf0,null))['catch'](handleError(_0x8febf0,null));};exports[_0xac4a('0x49')]=function(_0x5a7f6e,_0x244950){return db[_0xac4a('0x2c')][_0xac4a('0x49')](_0x5a7f6e['body'],{})['then'](respondWithResult(_0x244950,0xc9))[_0xac4a('0x44')](handleError(_0x244950,null));};exports['update']=function(_0x18ae96,_0x566258){if(_0x18ae96[_0xac4a('0x4a')]['id']){delete _0x18ae96['body']['id'];}return db[_0xac4a('0x2c')][_0xac4a('0x4b')]({'where':{'id':_0x18ae96[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x566258,null))['then'](saveUpdates(_0x18ae96[_0xac4a('0x4a')],null))[_0xac4a('0x24')](respondWithResult(_0x566258,null))[_0xac4a('0x44')](handleError(_0x566258,null));};exports[_0xac4a('0x25')]=function(_0x2f30e2,_0x138876){return db[_0xac4a('0x2c')]['find']({'where':{'id':_0x2f30e2[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x138876,null))['then'](removeEntity(_0x138876,null))[_0xac4a('0x44')](handleError(_0x138876,null));}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','Integration','model','map','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','create','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x1261,0x144));var _0x1126=function(_0x33925b,_0x95cfc6){_0x33925b=_0x33925b-0x0;var _0x375e21=_0x1261[_0x33925b];return _0x375e21;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['Integration'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['Integration']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')](_0x512f60['body'],{})[_0x1126('0x25')](respondWithResult(_0x5111d3,0xc9))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports['update']=function(_0x3e4eeb,_0xbdde58){if(_0x3e4eeb[_0x1126('0x44')]['id']){delete _0x3e4eeb['body']['id'];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x3e4eeb[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0xbdde58,null))[_0x1126('0x25')](saveUpdates(_0x3e4eeb[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0xbdde58,null))[_0x1126('0x43')](handleError(_0xbdde58,null));};exports['destroy']=function(_0x1b8b83,_0x5a2287){return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x1b8b83['params']['id']}})['then'](handleEntityNotFound(_0x5a2287,null))[_0x1126('0x25')](removeEntity(_0x5a2287,null))[_0x1126('0x43')](handleError(_0x5a2287,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index f28d51a..9b8b56b 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 _0x88ff=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Integration','integrations'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x88ff,0xfc));var _0xf88f=function(_0x5db996,_0x28a3ae){_0x5db996=_0x5db996-0x0;var _0x5c9498=_0x88ff[_0x5db996];return _0x5c9498;};'use strict';var _=require(_0xf88f('0x0'));var util=require(_0xf88f('0x1'));var logger=require('../../config/logger')(_0xf88f('0x2'));var moment=require(_0xf88f('0x3'));var BPromise=require(_0xf88f('0x4'));var rp=require(_0xf88f('0x5'));var fs=require('fs');var path=require(_0xf88f('0x6'));var rimraf=require(_0xf88f('0x7'));var config=require(_0xf88f('0x8'));var attributes=require('./integration.attributes');module['exports']=function(_0x3d2df2,_0x5b6744){return _0x3d2df2[_0xf88f('0x9')](_0xf88f('0xa'),attributes,{'tableName':_0xf88f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7876=['./integration.attributes','define','Integration','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x32254c,_0x1d4934){var _0x43708f=function(_0x377c72){while(--_0x377c72){_0x32254c['push'](_0x32254c['shift']());}};_0x43708f(++_0x1d4934);}(_0x7876,0x1f2));var _0x6787=function(_0x1d3046,_0x8b14e1){_0x1d3046=_0x1d3046-0x0;var _0x3b9b62=_0x7876[_0x1d3046];return _0x3b9b62;};'use strict';var _=require(_0x6787('0x0'));var util=require('util');var logger=require(_0x6787('0x1'))(_0x6787('0x2'));var moment=require(_0x6787('0x3'));var BPromise=require(_0x6787('0x4'));var rp=require(_0x6787('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6787('0x6'));var config=require(_0x6787('0x7'));var attributes=require(_0x6787('0x8'));module['exports']=function(_0x42ca02,_0x327f7d){return _0x42ca02[_0x6787('0x9')](_0x6787('0xa'),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 e485ef9..e0b836f 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Integration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x5e57e5,_0x6d0a1b){var _0x49aa48=function(_0x1d50ba){while(--_0x1d50ba){_0x5e57e5['push'](_0x5e57e5['shift']());}};_0x49aa48(++_0x6d0a1b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x27887d,_0x110e27){_0x27887d=_0x27887d-0x0;var _0x16b836=_0x5f2f[_0x27887d];return _0x16b836;};'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')]('Integration,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x57ca=['client','http','request','info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xf11a2e,_0x1f91cb){var _0x3fa8aa=function(_0x1a26a8){while(--_0x1a26a8){_0xf11a2e['push'](_0xf11a2e['shift']());}};_0x3fa8aa(++_0x1f91cb);}(_0x57ca,0x108));var _0xa57c=function(_0x4987b4,_0x2a4ad1){_0x4987b4=_0x4987b4-0x0;var _0x2682f5=_0x57ca[_0x4987b4];return _0x2682f5;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('Integration,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('Integration,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 95cda93..8b2de28 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 _0x955f=['post','create','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x71c7f3,_0xda02fd){var _0x4062c8=function(_0x1238ba){while(--_0x1238ba){_0x71c7f3['push'](_0x71c7f3['shift']());}};_0x4062c8(++_0xda02fd);}(_0x955f,0x1eb));var _0xf955=function(_0x1bbc6e,_0x31a791){_0x1bbc6e=_0x1bbc6e-0x0;var _0x3b8c29=_0x955f[_0x1bbc6e];return _0x3b8c29;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./integrationReport.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['describe']);router[_0xf955('0x7')](_0xf955('0xb'),auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['put'](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);router[_0xf955('0x10')](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0x11')]);module['exports']=router; \ No newline at end of file +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(_0x1955da,_0x3daff1){var _0x217810=function(_0x37edf9){while(--_0x37edf9){_0x1955da['push'](_0x1955da['shift']());}};_0x217810(++_0x3daff1);}(_0x2542,0x169));var _0x2254=function(_0x93eeaf,_0x24f92b){_0x93eeaf=_0x93eeaf-0x0;var _0x3d2a7a=_0x2542[_0x93eeaf];return _0x3d2a7a;};'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 diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 80d6012..3b1b0ce 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 _0x457b=['TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x457b,0x87));var _0xb457=function(_0x9ea15f,_0x271a81){_0x9ea15f=_0x9ea15f-0x0;var _0x281a3b=_0x457b[_0x9ea15f];return _0x281a3b;};'use strict';var Sequelize=require(_0xb457('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xb457('0x1')]},'exitStatus':{'type':Sequelize[_0xb457('0x1')]},'ticketId':{'type':Sequelize[_0xb457('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xb457('0x1')]},'uniqueid':{'type':Sequelize[_0xb457('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb457('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xb457('0x2')]},'holdtime':{'type':Sequelize[_0xb457('0x3')]},'agentcomplete':{'type':Sequelize[_0xb457('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xb457('0x3')]},'agentacw':{'type':Sequelize[_0xb457('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb457('0x3')]},'reason':{'type':Sequelize[_0xb457('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xb457('0x2')]},'agentdump':{'type':Sequelize[_0xb457('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xb457('0x2')]},'lastevent':{'type':Sequelize[_0xb457('0x1')]},'channel':{'type':Sequelize[_0xb457('0x1')]},'channelstate':{'type':Sequelize[_0xb457('0x3')]},'channelstatedesc':{'type':Sequelize[_0xb457('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb457('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb457('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xb457('0x1')]},'priority':{'type':Sequelize[_0xb457('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xb457('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb457('0x1')]},'destcalleridname':{'type':Sequelize[_0xb457('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xb457('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xb457('0x1')]},'destcontext':{'type':Sequelize[_0xb457('0x1')]},'destexten':{'type':Sequelize[_0xb457('0x1')]},'destpriority':{'type':Sequelize[_0xb457('0x1')]},'destuniqueid':{'type':Sequelize[_0xb457('0x1')]},'messageId':{'type':Sequelize[_0xb457('0x1')]},'inReplyTo':{'type':Sequelize[_0xb457('0x1')]},'subject':{'type':Sequelize[_0xb457('0x1')]},'from':{'type':Sequelize[_0xb457('0x1')]},'to':{'type':Sequelize[_0xb457('0x1')]},'cc':{'type':Sequelize[_0xb457('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xb457('0x5')]},'text':{'type':Sequelize[_0xb457('0x5')]},'status':{'type':Sequelize[_0xb457('0x6')](_0xb457('0x7'),'SENDING',_0xb457('0x8'),_0xb457('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xb457('0x1')]},'appdata':{'type':Sequelize[_0xb457('0x1')]},'projectId':{'type':Sequelize[_0xb457('0x3')]}}; \ No newline at end of file +var _0xc512=['SENDING','RECEIVED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x1b4c32,_0x341394){var _0x4da345=function(_0x1ac395){while(--_0x1ac395){_0x1b4c32['push'](_0x1b4c32['shift']());}};_0x4da345(++_0x341394);}(_0xc512,0xf2));var _0x2c51=function(_0x51bf91,_0x5340e0){_0x51bf91=_0x51bf91-0x0;var _0x200627=_0xc512[_0x51bf91];return _0x200627;};'use strict';var Sequelize=require('sequelize');module[_0x2c51('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x2c51('0x1')]},'exitStatus':{'type':Sequelize[_0x2c51('0x1')]},'ticketId':{'type':Sequelize[_0x2c51('0x1')]},'integrationId':{'type':Sequelize[_0x2c51('0x2')]},'contacts':{'type':Sequelize[_0x2c51('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2c51('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x2c51('0x1')]},'membername':{'type':Sequelize[_0x2c51('0x1')]},'agentcalledAt':{'type':Sequelize[_0x2c51('0x3')]},'agentconnectAt':{'type':Sequelize[_0x2c51('0x3')]},'holdtime':{'type':Sequelize[_0x2c51('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x2c51('0x3')]},'talktime':{'type':Sequelize[_0x2c51('0x2')]},'agentacw':{'type':Sequelize[_0x2c51('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2c51('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x2c51('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x2c51('0x3')]},'lastevent':{'type':Sequelize[_0x2c51('0x1')]},'channel':{'type':Sequelize[_0x2c51('0x1')]},'channelstate':{'type':Sequelize[_0x2c51('0x2')]},'channelstatedesc':{'type':Sequelize[_0x2c51('0x1')]},'connectedlinenum':{'type':Sequelize[_0x2c51('0x1')]},'connectedlinename':{'type':Sequelize[_0x2c51('0x1')]},'language':{'type':Sequelize[_0x2c51('0x1')]},'accountcode':{'type':Sequelize[_0x2c51('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x2c51('0x1')]},'priority':{'type':Sequelize[_0x2c51('0x1')]},'destchannel':{'type':Sequelize[_0x2c51('0x1')]},'destchannelstate':{'type':Sequelize[_0x2c51('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x2c51('0x1')]},'destcalleridname':{'type':Sequelize[_0x2c51('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x2c51('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x2c51('0x1')]},'destlanguage':{'type':Sequelize[_0x2c51('0x1')]},'destaccountcode':{'type':Sequelize[_0x2c51('0x1')]},'destcontext':{'type':Sequelize[_0x2c51('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x2c51('0x1')]},'destuniqueid':{'type':Sequelize[_0x2c51('0x1')]},'messageId':{'type':Sequelize[_0x2c51('0x1')]},'inReplyTo':{'type':Sequelize[_0x2c51('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x2c51('0x1')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x2c51('0x5')]},'html':{'type':Sequelize[_0x2c51('0x5')]},'text':{'type':Sequelize[_0x2c51('0x5')]},'status':{'type':Sequelize[_0x2c51('0x6')](_0x2c51('0x7'),_0x2c51('0x8'),_0x2c51('0x9'),'FAILED')},'url':{'type':Sequelize[_0x2c51('0x1')]},'app':{'type':Sequelize[_0x2c51('0x1')]},'appdata':{'type':Sequelize[_0x2c51('0x1')]},'projectId':{'type':Sequelize[_0x2c51('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 5d3c8f6..c6c0831 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 _0xd71a=['filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','filter','options','include','findAll','rows','show','params','keys','includeAll','find','catch','create','body','update','describe','rimraf','zip-dir','bluebird','util','path','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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','index','map','IntegrationReport','rawAttributes','key','query'];(function(_0x4a1c49,_0x16920a){var _0x4ba92d=function(_0x36dfe0){while(--_0x36dfe0){_0x4a1c49['push'](_0x4a1c49['shift']());}};_0x4ba92d(++_0x16920a);}(_0xd71a,0x18e));var _0xad71=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd71a[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xad71('0x0'));var zipdir=require(_0xad71('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xad71('0x2'));var Mustache=require('mustache');var util=require(_0xad71('0x3'));var path=require(_0xad71('0x4'));var sox=require('sox');var csv=require(_0xad71('0x5'));var ejs=require(_0xad71('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xad71('0x7'));var squel=require(_0xad71('0x8'));var crypto=require(_0xad71('0x9'));var jsforce=require(_0xad71('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xad71('0x5'));var querystring=require(_0xad71('0xb'));var Papa=require(_0xad71('0xc'));var Redis=require(_0xad71('0xd'));var authService=require(_0xad71('0xe'));var qs=require(_0xad71('0xf'));var as=require(_0xad71('0x10'));var hardwareService=require(_0xad71('0x11'));var logger=require('../../config/logger')(_0xad71('0x12'));var utils=require(_0xad71('0x13'));var config=require(_0xad71('0x14'));var licenseUtil=require(_0xad71('0x15'));var db=require(_0xad71('0x16'))['db'];function respondWithStatusCode(_0x2bdca2,_0x423acf){_0x423acf=_0x423acf||0xcc;return function(_0x13aab9){if(_0x13aab9){return _0x2bdca2[_0xad71('0x17')](_0x423acf);}return _0x2bdca2[_0xad71('0x18')](_0x423acf)[_0xad71('0x19')]();};}function respondWithResult(_0x270574,_0x2fa93a){_0x2fa93a=_0x2fa93a||0xc8;return function(_0x2abbc5){if(_0x2abbc5){return _0x270574[_0xad71('0x18')](_0x2fa93a)[_0xad71('0x1a')](_0x2abbc5);}};}function respondWithFilteredResult(_0x2efb05,_0x35fa4b){return function(_0x3f3c90){if(_0x3f3c90){var _0x17cf07=typeof _0x35fa4b[_0xad71('0x1b')]===_0xad71('0x1c')&&typeof _0x35fa4b[_0xad71('0x1d')]===_0xad71('0x1c');var _0x5eae0c=_0x3f3c90['count'];var _0x28bce2=_0x17cf07?0x0:_0x35fa4b[_0xad71('0x1b')];var _0x303fe0=_0x17cf07?_0x3f3c90[_0xad71('0x1e')]:_0x35fa4b['offset']+_0x35fa4b['limit'];var _0x579d0b;if(_0x303fe0>=_0x5eae0c){_0x303fe0=_0x5eae0c;_0x579d0b=0xc8;}else{_0x579d0b=0xce;}_0x2efb05['status'](_0x579d0b);return _0x2efb05[_0xad71('0x1f')](_0xad71('0x20'),_0x28bce2+'-'+_0x303fe0+'/'+_0x5eae0c)[_0xad71('0x1a')](_0x3f3c90);}return null;};}function patchUpdates(_0x3b4239){return function(_0x61c145){try{jsonpatch[_0xad71('0x21')](_0x61c145,_0x3b4239,!![]);}catch(_0x19d8e0){return BPromise[_0xad71('0x22')](_0x19d8e0);}return _0x61c145['save']();};}function saveUpdates(_0x39efea,_0x5661f3){return function(_0xdace8){if(_0xdace8){return _0xdace8['update'](_0x39efea)[_0xad71('0x23')](function(_0x26b5a6){return _0x26b5a6;});}return null;};}function removeEntity(_0x1170e3,_0x2aeb30){return function(_0x592db6){if(_0x592db6){return _0x592db6[_0xad71('0x24')]()[_0xad71('0x23')](function(){_0x1170e3['status'](0xcc)[_0xad71('0x19')]();});}};}function handleEntityNotFound(_0x375250,_0x25db29){return function(_0x46432e){if(!_0x46432e){_0x375250[_0xad71('0x17')](0x194);}return _0x46432e;};}function handleError(_0x554b7d,_0x482656){_0x482656=_0x482656||0x1f4;return function(_0x102f58){logger[_0xad71('0x25')](_0x102f58[_0xad71('0x26')]);if(_0x102f58['name']){delete _0x102f58[_0xad71('0x27')];}_0x554b7d[_0xad71('0x18')](_0x482656)['send'](_0x102f58);};}exports[_0xad71('0x28')]=function(_0x52d1d2,_0x80dabc){var _0x1fad55={},_0xc2a000={},_0x1f1547={'count':0x0,'rows':[]};var _0x2bfd5e=_[_0xad71('0x29')](db[_0xad71('0x2a')][_0xad71('0x2b')],function(_0x5cc9c6){return{'name':_0x5cc9c6['fieldName'],'type':_0x5cc9c6['type'][_0xad71('0x2c')]};});_0xc2a000['model']=_[_0xad71('0x29')](_0x2bfd5e,_0xad71('0x27'));_0xc2a000[_0xad71('0x2d')]=_['keys'](_0x52d1d2[_0xad71('0x2d')]);_0xc2a000[_0xad71('0x2e')]=_[_0xad71('0x2f')](_0xc2a000[_0xad71('0x30')],_0xc2a000['query']);_0x1fad55[_0xad71('0x31')]=_['intersection'](_0xc2a000[_0xad71('0x30')],qs['fields'](_0x52d1d2[_0xad71('0x2d')][_0xad71('0x32')]));_0x1fad55[_0xad71('0x31')]=_0x1fad55[_0xad71('0x31')][_0xad71('0x33')]?_0x1fad55[_0xad71('0x31')]:_0xc2a000['model'];if(!_0x52d1d2[_0xad71('0x2d')][_0xad71('0x34')]('nolimit')){_0x1fad55[_0xad71('0x1d')]=qs[_0xad71('0x1d')](_0x52d1d2[_0xad71('0x2d')][_0xad71('0x1d')]);_0x1fad55[_0xad71('0x1b')]=qs['offset'](_0x52d1d2[_0xad71('0x2d')][_0xad71('0x1b')]);}_0x1fad55[_0xad71('0x35')]=qs[_0xad71('0x36')](_0x52d1d2['query'][_0xad71('0x36')]);_0x1fad55[_0xad71('0x37')]=qs[_0xad71('0x2e')](_[_0xad71('0x38')](_0x52d1d2[_0xad71('0x2d')],_0xc2a000[_0xad71('0x2e')]),_0x2bfd5e);if(_0x52d1d2['query']['filter']){_0x1fad55['where']=_[_0xad71('0x39')](_0x1fad55[_0xad71('0x37')],{'$or':_[_0xad71('0x29')](_0x2bfd5e,function(_0x593af5){if(_0x593af5[_0xad71('0x3a')]!=='VIRTUAL'){var _0x51fcc8={};_0x51fcc8[_0x593af5[_0xad71('0x27')]]={'$like':'%'+_0x52d1d2['query'][_0xad71('0x3b')]+'%'};return _0x51fcc8;}})});}_0x1fad55=_['merge']({},_0x1fad55,_0x52d1d2[_0xad71('0x3c')]);var _0x5c7acb={'where':_0x1fad55['where']};return db[_0xad71('0x2a')][_0xad71('0x1e')](_0x5c7acb)['then'](function(_0x21685d){_0x1f1547[_0xad71('0x1e')]=_0x21685d;if(_0x52d1d2[_0xad71('0x2d')]['includeAll']){_0x1fad55[_0xad71('0x3d')]=[{'all':!![]}];}return db['IntegrationReport'][_0xad71('0x3e')](_0x1fad55);})['then'](function(_0x5c4c2d){_0x1f1547[_0xad71('0x3f')]=_0x5c4c2d;return _0x1f1547;})[_0xad71('0x23')](respondWithFilteredResult(_0x80dabc,_0x1fad55))['catch'](handleError(_0x80dabc,null));};exports[_0xad71('0x40')]=function(_0x5b8228,_0x482763){var _0x1e3ab8={'raw':![],'where':{'id':_0x5b8228[_0xad71('0x41')]['id']}},_0x273c61={};_0x273c61[_0xad71('0x30')]=_[_0xad71('0x42')](db[_0xad71('0x2a')]['rawAttributes']);_0x273c61[_0xad71('0x2d')]=_[_0xad71('0x42')](_0x5b8228[_0xad71('0x2d')]);_0x273c61[_0xad71('0x2e')]=_['intersection'](_0x273c61[_0xad71('0x30')],_0x273c61[_0xad71('0x2d')]);_0x1e3ab8['attributes']=_[_0xad71('0x2f')](_0x273c61[_0xad71('0x30')],qs['fields'](_0x5b8228[_0xad71('0x2d')]['fields']));_0x1e3ab8[_0xad71('0x31')]=_0x1e3ab8[_0xad71('0x31')][_0xad71('0x33')]?_0x1e3ab8[_0xad71('0x31')]:_0x273c61['model'];if(_0x5b8228[_0xad71('0x2d')][_0xad71('0x43')]){_0x1e3ab8['include']=[{'all':!![]}];}_0x1e3ab8=_[_0xad71('0x39')]({},_0x1e3ab8,_0x5b8228[_0xad71('0x3c')]);return db[_0xad71('0x2a')][_0xad71('0x44')](_0x1e3ab8)[_0xad71('0x23')](handleEntityNotFound(_0x482763,null))[_0xad71('0x23')](respondWithResult(_0x482763,null))[_0xad71('0x45')](handleError(_0x482763,null));};exports[_0xad71('0x46')]=function(_0x462290,_0x1a6778){return db[_0xad71('0x2a')][_0xad71('0x46')](_0x462290[_0xad71('0x47')],{})[_0xad71('0x23')](respondWithResult(_0x1a6778,0xc9))['catch'](handleError(_0x1a6778,null));};exports[_0xad71('0x48')]=function(_0x3ef63e,_0x4dcb2f){if(_0x3ef63e[_0xad71('0x47')]['id']){delete _0x3ef63e[_0xad71('0x47')]['id'];}return db['IntegrationReport'][_0xad71('0x44')]({'where':{'id':_0x3ef63e[_0xad71('0x41')]['id']}})[_0xad71('0x23')](handleEntityNotFound(_0x4dcb2f,null))['then'](saveUpdates(_0x3ef63e[_0xad71('0x47')],null))[_0xad71('0x23')](respondWithResult(_0x4dcb2f,null))[_0xad71('0x45')](handleError(_0x4dcb2f,null));};exports[_0xad71('0x24')]=function(_0x42d1aa,_0x3833e2){return db[_0xad71('0x2a')]['find']({'where':{'id':_0x42d1aa[_0xad71('0x41')]['id']}})[_0xad71('0x23')](handleEntityNotFound(_0x3833e2,null))['then'](removeEntity(_0x3833e2,null))[_0xad71('0x45')](handleError(_0x3833e2,null));};exports['describe']=function(_0x45ba59,_0x27eb2a){return db['IntegrationReport'][_0xad71('0x49')]()[_0xad71('0x23')](respondWithResult(_0x27eb2a,null))['catch'](handleError(_0x27eb2a,null));}; \ No newline at end of file +var _0xcc29=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','destroy','then','end','sendStatus','stack','name','send','index','IntegrationReport','rawAttributes','fieldName','type','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','length','options','find','create','body','catch','describe','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x3a19b0,_0x2847a3){var _0x5add50=function(_0x245efd){while(--_0x245efd){_0x3a19b0['push'](_0x3a19b0['shift']());}};_0x5add50(++_0x2847a3);}(_0xcc29,0x1ae));var _0x9cc2=function(_0x1fc80b,_0x98bfe9){_0x1fc80b=_0x1fc80b-0x0;var _0x28da77=_0xcc29[_0x1fc80b];return _0x28da77;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9cc2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9cc2('0x1'));var rp=require(_0x9cc2('0x2'));var moment=require('moment');var BPromise=require(_0x9cc2('0x3'));var Mustache=require(_0x9cc2('0x4'));var util=require(_0x9cc2('0x5'));var path=require(_0x9cc2('0x6'));var sox=require('sox');var csv=require(_0x9cc2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9cc2('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9cc2('0x9'));var jsforce=require(_0x9cc2('0xa'));var deskjs=require(_0x9cc2('0xb'));var toCsv=require(_0x9cc2('0x7'));var querystring=require(_0x9cc2('0xc'));var Papa=require(_0x9cc2('0xd'));var Redis=require(_0x9cc2('0xe'));var authService=require(_0x9cc2('0xf'));var qs=require(_0x9cc2('0x10'));var as=require(_0x9cc2('0x11'));var hardwareService=require(_0x9cc2('0x12'));var logger=require(_0x9cc2('0x13'))(_0x9cc2('0x14'));var utils=require('../../config/utils');var config=require(_0x9cc2('0x15'));var licenseUtil=require(_0x9cc2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x533e62,_0x45ad01){_0x45ad01=_0x45ad01||0xcc;return function(_0x2322c1){if(_0x2322c1){return _0x533e62['sendStatus'](_0x45ad01);}return _0x533e62[_0x9cc2('0x17')](_0x45ad01)['end']();};}function respondWithResult(_0x4a6e19,_0xe5bf33){_0xe5bf33=_0xe5bf33||0xc8;return function(_0x5a40bc){if(_0x5a40bc){return _0x4a6e19[_0x9cc2('0x17')](_0xe5bf33)[_0x9cc2('0x18')](_0x5a40bc);}};}function respondWithFilteredResult(_0x43d532,_0x5a6b8f){return function(_0x452b1c){if(_0x452b1c){var _0x305d03=typeof _0x5a6b8f[_0x9cc2('0x19')]==='undefined'&&typeof _0x5a6b8f[_0x9cc2('0x1a')]===_0x9cc2('0x1b');var _0x383715=_0x452b1c[_0x9cc2('0x1c')];var _0x5ea378=_0x305d03?0x0:_0x5a6b8f[_0x9cc2('0x19')];var _0x44f87f=_0x305d03?_0x452b1c[_0x9cc2('0x1c')]:_0x5a6b8f[_0x9cc2('0x19')]+_0x5a6b8f[_0x9cc2('0x1a')];var _0x503b24;if(_0x44f87f>=_0x383715){_0x44f87f=_0x383715;_0x503b24=0xc8;}else{_0x503b24=0xce;}_0x43d532[_0x9cc2('0x17')](_0x503b24);return _0x43d532[_0x9cc2('0x1d')](_0x9cc2('0x1e'),_0x5ea378+'-'+_0x44f87f+'/'+_0x383715)[_0x9cc2('0x18')](_0x452b1c);}return null;};}function patchUpdates(_0x52a1bb){return function(_0x4598cf){try{jsonpatch['apply'](_0x4598cf,_0x52a1bb,!![]);}catch(_0x56b0f9){return BPromise[_0x9cc2('0x1f')](_0x56b0f9);}return _0x4598cf[_0x9cc2('0x20')]();};}function saveUpdates(_0x3407d0,_0x2e29e9){return function(_0x59fc4e){if(_0x59fc4e){return _0x59fc4e['update'](_0x3407d0)['then'](function(_0x11d683){return _0x11d683;});}return null;};}function removeEntity(_0x26349d,_0x47dec8){return function(_0x176ce1){if(_0x176ce1){return _0x176ce1[_0x9cc2('0x21')]()[_0x9cc2('0x22')](function(){_0x26349d['status'](0xcc)[_0x9cc2('0x23')]();});}};}function handleEntityNotFound(_0x2b3578,_0x47ac15){return function(_0x2b99a3){if(!_0x2b99a3){_0x2b3578[_0x9cc2('0x24')](0x194);}return _0x2b99a3;};}function handleError(_0x2d6a82,_0x29ac45){_0x29ac45=_0x29ac45||0x1f4;return function(_0x1a6b84){logger['error'](_0x1a6b84[_0x9cc2('0x25')]);if(_0x1a6b84[_0x9cc2('0x26')]){delete _0x1a6b84['name'];}_0x2d6a82[_0x9cc2('0x17')](_0x29ac45)[_0x9cc2('0x27')](_0x1a6b84);};}exports[_0x9cc2('0x28')]=function(_0x2849a8,_0x135d3f){var _0x8eeb27={},_0x3fa4c2={},_0x44bbab={'count':0x0,'rows':[]};var _0x27389c=_['map'](db[_0x9cc2('0x29')][_0x9cc2('0x2a')],function(_0x49ec86){return{'name':_0x49ec86[_0x9cc2('0x2b')],'type':_0x49ec86[_0x9cc2('0x2c')]['key']};});_0x3fa4c2[_0x9cc2('0x2d')]=_[_0x9cc2('0x2e')](_0x27389c,'name');_0x3fa4c2['query']=_[_0x9cc2('0x2f')](_0x2849a8[_0x9cc2('0x30')]);_0x3fa4c2['filters']=_[_0x9cc2('0x31')](_0x3fa4c2['model'],_0x3fa4c2['query']);_0x8eeb27[_0x9cc2('0x32')]=_[_0x9cc2('0x31')](_0x3fa4c2[_0x9cc2('0x2d')],qs[_0x9cc2('0x33')](_0x2849a8[_0x9cc2('0x30')][_0x9cc2('0x33')]));_0x8eeb27[_0x9cc2('0x32')]=_0x8eeb27[_0x9cc2('0x32')]['length']?_0x8eeb27['attributes']:_0x3fa4c2['model'];if(!_0x2849a8[_0x9cc2('0x30')][_0x9cc2('0x34')](_0x9cc2('0x35'))){_0x8eeb27[_0x9cc2('0x1a')]=qs[_0x9cc2('0x1a')](_0x2849a8['query'][_0x9cc2('0x1a')]);_0x8eeb27[_0x9cc2('0x19')]=qs[_0x9cc2('0x19')](_0x2849a8['query']['offset']);}_0x8eeb27['order']=qs['sort'](_0x2849a8[_0x9cc2('0x30')][_0x9cc2('0x36')]);_0x8eeb27[_0x9cc2('0x37')]=qs[_0x9cc2('0x38')](_[_0x9cc2('0x39')](_0x2849a8[_0x9cc2('0x30')],_0x3fa4c2[_0x9cc2('0x38')]),_0x27389c);if(_0x2849a8['query'][_0x9cc2('0x3a')]){_0x8eeb27['where']=_[_0x9cc2('0x3b')](_0x8eeb27[_0x9cc2('0x37')],{'$or':_[_0x9cc2('0x2e')](_0x27389c,function(_0x2259e5){if(_0x2259e5[_0x9cc2('0x2c')]!==_0x9cc2('0x3c')){var _0x4877f4={};_0x4877f4[_0x2259e5[_0x9cc2('0x26')]]={'$like':'%'+_0x2849a8[_0x9cc2('0x30')][_0x9cc2('0x3a')]+'%'};return _0x4877f4;}})});}_0x8eeb27=_[_0x9cc2('0x3b')]({},_0x8eeb27,_0x2849a8['options']);var _0x4c4bfa={'where':_0x8eeb27['where']};return db[_0x9cc2('0x29')][_0x9cc2('0x1c')](_0x4c4bfa)[_0x9cc2('0x22')](function(_0x27c056){_0x44bbab[_0x9cc2('0x1c')]=_0x27c056;if(_0x2849a8[_0x9cc2('0x30')][_0x9cc2('0x3d')]){_0x8eeb27[_0x9cc2('0x3e')]=[{'all':!![]}];}return db['IntegrationReport'][_0x9cc2('0x3f')](_0x8eeb27);})[_0x9cc2('0x22')](function(_0x376205){_0x44bbab[_0x9cc2('0x40')]=_0x376205;return _0x44bbab;})[_0x9cc2('0x22')](respondWithFilteredResult(_0x135d3f,_0x8eeb27))['catch'](handleError(_0x135d3f,null));};exports[_0x9cc2('0x41')]=function(_0x4755a3,_0x1f7a2e){var _0x39d417={'raw':![],'where':{'id':_0x4755a3[_0x9cc2('0x42')]['id']}},_0x392b79={};_0x392b79['model']=_[_0x9cc2('0x2f')](db[_0x9cc2('0x29')][_0x9cc2('0x2a')]);_0x392b79[_0x9cc2('0x30')]=_[_0x9cc2('0x2f')](_0x4755a3['query']);_0x392b79[_0x9cc2('0x38')]=_[_0x9cc2('0x31')](_0x392b79[_0x9cc2('0x2d')],_0x392b79[_0x9cc2('0x30')]);_0x39d417[_0x9cc2('0x32')]=_[_0x9cc2('0x31')](_0x392b79[_0x9cc2('0x2d')],qs['fields'](_0x4755a3[_0x9cc2('0x30')][_0x9cc2('0x33')]));_0x39d417[_0x9cc2('0x32')]=_0x39d417[_0x9cc2('0x32')][_0x9cc2('0x43')]?_0x39d417[_0x9cc2('0x32')]:_0x392b79[_0x9cc2('0x2d')];if(_0x4755a3[_0x9cc2('0x30')][_0x9cc2('0x3d')]){_0x39d417['include']=[{'all':!![]}];}_0x39d417=_[_0x9cc2('0x3b')]({},_0x39d417,_0x4755a3[_0x9cc2('0x44')]);return db['IntegrationReport'][_0x9cc2('0x45')](_0x39d417)[_0x9cc2('0x22')](handleEntityNotFound(_0x1f7a2e,null))['then'](respondWithResult(_0x1f7a2e,null))['catch'](handleError(_0x1f7a2e,null));};exports[_0x9cc2('0x46')]=function(_0x86a0f5,_0x32cf11){return db['IntegrationReport']['create'](_0x86a0f5[_0x9cc2('0x47')],{})[_0x9cc2('0x22')](respondWithResult(_0x32cf11,0xc9))['catch'](handleError(_0x32cf11,null));};exports['update']=function(_0x357c26,_0xe79112){if(_0x357c26[_0x9cc2('0x47')]['id']){delete _0x357c26[_0x9cc2('0x47')]['id'];}return db[_0x9cc2('0x29')][_0x9cc2('0x45')]({'where':{'id':_0x357c26['params']['id']}})['then'](handleEntityNotFound(_0xe79112,null))[_0x9cc2('0x22')](saveUpdates(_0x357c26['body'],null))[_0x9cc2('0x22')](respondWithResult(_0xe79112,null))[_0x9cc2('0x48')](handleError(_0xe79112,null));};exports['destroy']=function(_0x2d82d8,_0x257a2a){return db[_0x9cc2('0x29')][_0x9cc2('0x45')]({'where':{'id':_0x2d82d8['params']['id']}})[_0x9cc2('0x22')](handleEntityNotFound(_0x257a2a,null))[_0x9cc2('0x22')](removeEntity(_0x257a2a,null))['catch'](handleError(_0x257a2a,null));};exports[_0x9cc2('0x49')]=function(_0x5cb50e,_0xd6e33b){return db[_0x9cc2('0x29')][_0x9cc2('0x49')]()[_0x9cc2('0x22')](respondWithResult(_0xd6e33b,null))['catch'](handleError(_0xd6e33b,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 2199489..7782ee7 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 _0x61d7=['define','IntegrationReport','report_integration','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x2c688c,_0x18a5a5){var _0x44b97a=function(_0x37166b){while(--_0x37166b){_0x2c688c['push'](_0x2c688c['shift']());}};_0x44b97a(++_0x18a5a5);}(_0x61d7,0x137));var _0x761d=function(_0x13b58b,_0x3fac0b){_0x13b58b=_0x13b58b-0x0;var _0x4c0d91=_0x61d7[_0x13b58b];return _0x4c0d91;};'use strict';var _=require('lodash');var util=require(_0x761d('0x0'));var logger=require(_0x761d('0x1'))(_0x761d('0x2'));var moment=require('moment');var BPromise=require(_0x761d('0x3'));var rp=require(_0x761d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x761d('0x5'));var config=require(_0x761d('0x6'));var attributes=require('./integrationReport.attributes');module[_0x761d('0x7')]=function(_0xf0f38d,_0x41e00a){return _0xf0f38d[_0x761d('0x8')](_0x761d('0x9'),attributes,{'tableName':_0x761d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb8c=['request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','util','../../config/logger','api','moment','bluebird'];(function(_0xea9af8,_0x277842){var _0x19ff0b=function(_0x27675a){while(--_0x27675a){_0xea9af8['push'](_0xea9af8['shift']());}};_0x19ff0b(++_0x277842);}(_0xfb8c,0x18e));var _0xcfb8=function(_0x552f93,_0x5a47ce){_0x552f93=_0x552f93-0x0;var _0x1bbbbb=_0xfb8c[_0x552f93];return _0x1bbbbb;};'use strict';var _=require('lodash');var util=require(_0xcfb8('0x0'));var logger=require(_0xcfb8('0x1'))(_0xcfb8('0x2'));var moment=require(_0xcfb8('0x3'));var BPromise=require(_0xcfb8('0x4'));var rp=require(_0xcfb8('0x5'));var fs=require('fs');var path=require(_0xcfb8('0x6'));var rimraf=require(_0xcfb8('0x7'));var config=require(_0xcfb8('0x8'));var attributes=require(_0xcfb8('0x9'));module[_0xcfb8('0xa')]=function(_0x578979,_0x12c8a2){return _0x578979[_0xcfb8('0xb')](_0xcfb8('0xc'),attributes,{'tableName':'report_integration','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 4fb1013..e848818 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 _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','IntegrationReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0x4137,0xf8));var _0x7413=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4137[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file +var _0x2542=['info','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\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(_0x328856,_0x2b5499){var _0x184ffb=function(_0x349fe1){while(--_0x349fe1){_0x328856['push'](_0x328856['shift']());}};_0x184ffb(++_0x2b5499);}(_0x2542,0x169));var _0x2254=function(_0x4a7bf8,_0x56bfe3){_0x4a7bf8=_0x4a7bf8-0x0;var _0x150de7=_0x2542[_0x4a7bf8];return _0x150de7;};'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/interval/index.js b/server/api/interval/index.js index 9a4a72d..fb3c4c2 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 _0xf569=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./interval.controller','isAuthenticated','index','/:id','get','/:id/sub_intervals','create','addInterval','put','update','delete','destroy','exports','util','path'];(function(_0x4c098f,_0x1738b7){var _0x1b8c99=function(_0x307659){while(--_0x307659){_0x4c098f['push'](_0x4c098f['shift']());}};_0x1b8c99(++_0x1738b7);}(_0xf569,0xd0));var _0x9f56=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xf569[_0xd0b415];return _0x2bdf2c;};'use strict';var multer=require('multer');var util=require(_0x9f56('0x0'));var path=require(_0x9f56('0x1'));var timeout=require(_0x9f56('0x2'));var express=require(_0x9f56('0x3'));var router=express[_0x9f56('0x4')]();var fs_extra=require(_0x9f56('0x5'));var auth=require(_0x9f56('0x6'));var interaction=require(_0x9f56('0x7'));var config=require('../../config/environment');var controller=require(_0x9f56('0x8'));router['get']('/',auth[_0x9f56('0x9')](),controller[_0x9f56('0xa')]);router['get'](_0x9f56('0xb'),auth[_0x9f56('0x9')](),controller['show']);router[_0x9f56('0xc')](_0x9f56('0xd'),auth[_0x9f56('0x9')](),controller['getIntervals']);router['post']('/',auth[_0x9f56('0x9')](),controller[_0x9f56('0xe')]);router['post'](_0x9f56('0xd'),auth[_0x9f56('0x9')](),controller[_0x9f56('0xf')]);router['post']('/:id/sub_intervals/create_many',auth[_0x9f56('0x9')](),controller['addIntervals']);router[_0x9f56('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9f56('0x11')]);router[_0x9f56('0x12')]('/:id',auth[_0x9f56('0x9')](),controller[_0x9f56('0x13')]);module[_0x9f56('0x14')]=router; \ No newline at end of file +var _0x7580=['isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addIntervals','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','./interval.controller','index','get','/:id'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x7580,0x14b));var _0x0758=function(_0x34b9d0,_0x18ea7f){_0x34b9d0=_0x34b9d0-0x0;var _0x9a8cca=_0x7580[_0x34b9d0];return _0x9a8cca;};'use strict';var multer=require('multer');var util=require(_0x0758('0x0'));var path=require('path');var timeout=require(_0x0758('0x1'));var express=require('express');var router=express[_0x0758('0x2')]();var fs_extra=require(_0x0758('0x3'));var auth=require(_0x0758('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0758('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x0758('0x6')]);router[_0x0758('0x7')](_0x0758('0x8'),auth[_0x0758('0x9')](),controller[_0x0758('0xa')]);router[_0x0758('0x7')](_0x0758('0xb'),auth[_0x0758('0x9')](),controller[_0x0758('0xc')]);router[_0x0758('0xd')]('/',auth[_0x0758('0x9')](),controller[_0x0758('0xe')]);router['post'](_0x0758('0xb'),auth[_0x0758('0x9')](),controller['addInterval']);router[_0x0758('0xd')]('/:id/sub_intervals/create_many',auth[_0x0758('0x9')](),controller[_0x0758('0xf')]);router['put'](_0x0758('0x8'),auth['isAuthenticated'](),controller[_0x0758('0x10')]);router[_0x0758('0x11')]('/:id',auth[_0x0758('0x9')](),controller[_0x0758('0x12')]);module[_0x0758('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 5396494..ac2a9f9 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 _0xec6e=['exports','STRING','sequelize'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xec6e,0x113));var _0xeec6=function(_0x289a67,_0x1e5a3c){_0x289a67=_0x289a67-0x0;var _0x572b49=_0xec6e[_0x289a67];return _0x572b49;};'use strict';var Sequelize=require(_0xeec6('0x0'));module[_0xeec6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xeec6('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xb9b0=['STRING','exports'];(function(_0xddb4af,_0x408696){var _0x52ada4=function(_0x31e664){while(--_0x31e664){_0xddb4af['push'](_0xddb4af['shift']());}};_0x52ada4(++_0x408696);}(_0xb9b0,0x67));var _0x0b9b=function(_0x3ed18c,_0x1f8340){_0x3ed18c=_0x3ed18c-0x0;var _0x4d635f=_0xb9b0[_0x3ed18c];return _0x4d635f;};'use strict';var Sequelize=require('sequelize');module[_0x0b9b('0x0')]={'name':{'type':Sequelize[_0x0b9b('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index af16d7d..246394a 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 _0xfdc5=['fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Interval','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','findOne','addIntervals','sequelize','transaction','bulkCreate','eml-format','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','offset','undefined','limit','count','json','apply','reject','save','update','destroy','get','Intervals','then','end','error','stack','name','map','rawAttributes','type','key','query','keys','filters','model','attributes','intersection'];(function(_0x8c8f86,_0x429aeb){var _0x5cc8e5=function(_0x27275f){while(--_0x27275f){_0x8c8f86['push'](_0x8c8f86['shift']());}};_0x5cc8e5(++_0x429aeb);}(_0xfdc5,0x1d7));var _0x5fdc=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xfdc5[_0x122096];return _0x3d1966;};'use strict';var emlformat=require(_0x5fdc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5fdc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5fdc('0x2'));var BPromise=require(_0x5fdc('0x3'));var Mustache=require(_0x5fdc('0x4'));var util=require('util');var path=require('path');var sox=require(_0x5fdc('0x5'));var csv=require(_0x5fdc('0x6'));var ejs=require(_0x5fdc('0x7'));var fs=require('fs');var fs_extra=require(_0x5fdc('0x8'));var _=require(_0x5fdc('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5fdc('0xa'));var deskjs=require(_0x5fdc('0xb'));var toCsv=require(_0x5fdc('0x6'));var querystring=require(_0x5fdc('0xc'));var Papa=require(_0x5fdc('0xd'));var Redis=require(_0x5fdc('0xe'));var authService=require(_0x5fdc('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5fdc('0x10'));var logger=require('../../config/logger')(_0x5fdc('0x11'));var utils=require(_0x5fdc('0x12'));var config=require(_0x5fdc('0x13'));var licenseUtil=require(_0x5fdc('0x14'));var db=require('../../mysqldb')['db'];var extensions=require(_0x5fdc('0x15'));function respondWithStatusCode(_0x3df06f,_0x5dc7ad){_0x5dc7ad=_0x5dc7ad||0xcc;return function(_0x112837){if(_0x112837){return _0x3df06f[_0x5fdc('0x16')](_0x5dc7ad);}return _0x3df06f[_0x5fdc('0x17')](_0x5dc7ad)['end']();};}function respondWithResult(_0x2daaf2,_0x4d7273){_0x4d7273=_0x4d7273||0xc8;return function(_0x178e90){if(_0x178e90){return _0x2daaf2[_0x5fdc('0x17')](_0x4d7273)['json'](_0x178e90);}};}function respondWithFilteredResult(_0x4d0510,_0x706977){return function(_0x511dc9){if(_0x511dc9){var _0x2e5de4=typeof _0x706977[_0x5fdc('0x18')]===_0x5fdc('0x19')&&typeof _0x706977[_0x5fdc('0x1a')]===_0x5fdc('0x19');var _0x2383e8=_0x511dc9[_0x5fdc('0x1b')];var _0x3109d9=_0x2e5de4?0x0:_0x706977['offset'];var _0x1d3ca7=_0x2e5de4?_0x511dc9[_0x5fdc('0x1b')]:_0x706977[_0x5fdc('0x18')]+_0x706977['limit'];var _0x1b9527;if(_0x1d3ca7>=_0x2383e8){_0x1d3ca7=_0x2383e8;_0x1b9527=0xc8;}else{_0x1b9527=0xce;}_0x4d0510[_0x5fdc('0x17')](_0x1b9527);return _0x4d0510['set']('Content-Range',_0x3109d9+'-'+_0x1d3ca7+'/'+_0x2383e8)[_0x5fdc('0x1c')](_0x511dc9);}return null;};}function patchUpdates(_0x337516){return function(_0x5eb8ca){try{jsonpatch[_0x5fdc('0x1d')](_0x5eb8ca,_0x337516,!![]);}catch(_0x54d095){return BPromise[_0x5fdc('0x1e')](_0x54d095);}return _0x5eb8ca[_0x5fdc('0x1f')]();};}function saveUpdates(_0x170fdc,_0x4555e4){return function(_0x532f42){if(_0x532f42){return _0x532f42[_0x5fdc('0x20')](_0x170fdc)['then'](function(_0x100b22){return _0x100b22;});}return null;};}function removeEntity(_0xbb17c,_0x152952){return function(_0x25765b){if(_0x25765b){return _0x25765b[_0x5fdc('0x21')]()['then'](function(){var _0x1976c4=_0x25765b[_0x5fdc('0x22')]({'plain':!![]});var _0x5316cd=_0x5fdc('0x23');return db['UserProfileResource'][_0x5fdc('0x21')]({'where':{'type':_0x5316cd,'resourceId':_0x1976c4['id']}})[_0x5fdc('0x24')](function(){return _0x25765b;});})['then'](function(){_0xbb17c['status'](0xcc)[_0x5fdc('0x25')]();});}};}function handleEntityNotFound(_0x29991e,_0x43c580){return function(_0x594e18){if(!_0x594e18){_0x29991e[_0x5fdc('0x16')](0x194);}return _0x594e18;};}function handleError(_0x37498d,_0x15eb44){_0x15eb44=_0x15eb44||0x1f4;return function(_0x25c6b2){logger[_0x5fdc('0x26')](_0x25c6b2[_0x5fdc('0x27')]);if(_0x25c6b2[_0x5fdc('0x28')]){delete _0x25c6b2[_0x5fdc('0x28')];}_0x37498d['status'](_0x15eb44)['send'](_0x25c6b2);};}exports['index']=function(_0x155b89,_0x2957b7){var _0x343aa6={},_0x26af77={},_0x1dc9fd={'count':0x0,'rows':[]};var _0x9fe3e4=_[_0x5fdc('0x29')](db['Interval'][_0x5fdc('0x2a')],function(_0x30208a){return{'name':_0x30208a['fieldName'],'type':_0x30208a[_0x5fdc('0x2b')][_0x5fdc('0x2c')]};});_0x26af77['model']=_[_0x5fdc('0x29')](_0x9fe3e4,_0x5fdc('0x28'));_0x26af77[_0x5fdc('0x2d')]=_[_0x5fdc('0x2e')](_0x155b89[_0x5fdc('0x2d')]);_0x26af77[_0x5fdc('0x2f')]=_['intersection'](_0x26af77[_0x5fdc('0x30')],_0x26af77[_0x5fdc('0x2d')]);_0x343aa6[_0x5fdc('0x31')]=_[_0x5fdc('0x32')](_0x26af77[_0x5fdc('0x30')],qs['fields'](_0x155b89[_0x5fdc('0x2d')][_0x5fdc('0x33')]));_0x343aa6[_0x5fdc('0x31')]=_0x343aa6[_0x5fdc('0x31')]['length']?_0x343aa6[_0x5fdc('0x31')]:_0x26af77[_0x5fdc('0x30')];if(!_0x155b89['query'][_0x5fdc('0x34')](_0x5fdc('0x35'))){_0x343aa6[_0x5fdc('0x1a')]=qs[_0x5fdc('0x1a')](_0x155b89[_0x5fdc('0x2d')][_0x5fdc('0x1a')]);_0x343aa6['offset']=qs[_0x5fdc('0x18')](_0x155b89[_0x5fdc('0x2d')]['offset']);}_0x343aa6['order']=qs[_0x5fdc('0x36')](_0x155b89[_0x5fdc('0x2d')][_0x5fdc('0x36')]);_0x343aa6[_0x5fdc('0x37')]=qs['filters'](_[_0x5fdc('0x38')](_0x155b89[_0x5fdc('0x2d')],_0x26af77[_0x5fdc('0x2f')]),_0x9fe3e4);if(_0x155b89[_0x5fdc('0x2d')][_0x5fdc('0x39')]){_0x343aa6['where']=_[_0x5fdc('0x3a')](_0x343aa6[_0x5fdc('0x37')],{'$or':_[_0x5fdc('0x29')](_0x9fe3e4,function(_0x59654f){if(_0x59654f[_0x5fdc('0x2b')]!==_0x5fdc('0x3b')){var _0x46b3a3={};_0x46b3a3[_0x59654f['name']]={'$like':'%'+_0x155b89['query']['filter']+'%'};return _0x46b3a3;}})});}_0x343aa6=_[_0x5fdc('0x3a')]({},_0x343aa6,_0x155b89[_0x5fdc('0x3c')]);var _0x131097={'where':_0x343aa6[_0x5fdc('0x37')]};return db[_0x5fdc('0x3d')][_0x5fdc('0x1b')](_0x131097)['then'](function(_0x36be6d){_0x1dc9fd['count']=_0x36be6d;if(_0x155b89['query'][_0x5fdc('0x3e')]){_0x343aa6[_0x5fdc('0x3f')]=[{'all':!![]}];}return db[_0x5fdc('0x3d')][_0x5fdc('0x40')](_0x343aa6);})[_0x5fdc('0x24')](function(_0x4ceb5f){_0x1dc9fd[_0x5fdc('0x41')]=_0x4ceb5f;return _0x1dc9fd;})[_0x5fdc('0x24')](respondWithFilteredResult(_0x2957b7,_0x343aa6))[_0x5fdc('0x42')](handleError(_0x2957b7,null));};exports[_0x5fdc('0x43')]=function(_0x49a633,_0x17d427){var _0xdc15f9={'raw':!![],'where':{'id':_0x49a633[_0x5fdc('0x44')]['id']}},_0x2edb0c={};_0x2edb0c['model']=_[_0x5fdc('0x2e')](db[_0x5fdc('0x3d')][_0x5fdc('0x2a')]);_0x2edb0c[_0x5fdc('0x2d')]=_['keys'](_0x49a633[_0x5fdc('0x2d')]);_0x2edb0c[_0x5fdc('0x2f')]=_['intersection'](_0x2edb0c[_0x5fdc('0x30')],_0x2edb0c[_0x5fdc('0x2d')]);_0xdc15f9[_0x5fdc('0x31')]=_['intersection'](_0x2edb0c[_0x5fdc('0x30')],qs['fields'](_0x49a633[_0x5fdc('0x2d')][_0x5fdc('0x33')]));_0xdc15f9[_0x5fdc('0x31')]=_0xdc15f9[_0x5fdc('0x31')][_0x5fdc('0x45')]?_0xdc15f9[_0x5fdc('0x31')]:_0x2edb0c[_0x5fdc('0x30')];if(_0x49a633['query'][_0x5fdc('0x3e')]){_0xdc15f9[_0x5fdc('0x3f')]=[{'all':!![]}];}_0xdc15f9=_['merge']({},_0xdc15f9,_0x49a633[_0x5fdc('0x3c')]);return db[_0x5fdc('0x3d')][_0x5fdc('0x46')](_0xdc15f9)[_0x5fdc('0x24')](handleEntityNotFound(_0x17d427,null))[_0x5fdc('0x24')](respondWithResult(_0x17d427,null))[_0x5fdc('0x42')](handleError(_0x17d427,null));};exports[_0x5fdc('0x47')]=function(_0x232388,_0x556060){return db['Interval'][_0x5fdc('0x47')](_0x232388[_0x5fdc('0x48')],{})[_0x5fdc('0x24')](function(_0x4da480){var _0x306153=_0x232388[_0x5fdc('0x49')][_0x5fdc('0x22')]({'plain':!![]});if(!_0x306153)throw new Error(_0x5fdc('0x4a'));if(_0x306153['role']===_0x5fdc('0x49')){var _0x1811d5=_0x4da480['get']({'plain':!![]});var _0xf81973=_0x5fdc('0x23');return db[_0x5fdc('0x4b')][_0x5fdc('0x46')]({'where':{'name':_0xf81973,'userProfileId':_0x306153[_0x5fdc('0x4c')]},'raw':!![]})[_0x5fdc('0x24')](function(_0x498df8){if(_0x498df8&&_0x498df8[_0x5fdc('0x4d')]===0x0){return db[_0x5fdc('0x4e')][_0x5fdc('0x47')]({'name':_0x1811d5[_0x5fdc('0x28')],'resourceId':_0x1811d5['id'],'type':_0x498df8[_0x5fdc('0x28')],'sectionId':_0x498df8['id']},{})[_0x5fdc('0x24')](function(){return _0x4da480;});}else{return _0x4da480;}})['catch'](function(_0x8f9bdb){logger[_0x5fdc('0x26')](_0x5fdc('0x4f'),_0x8f9bdb);throw _0x8f9bdb;});}return _0x4da480;})[_0x5fdc('0x24')](respondWithResult(_0x556060,0xc9))[_0x5fdc('0x42')](handleError(_0x556060,null));};exports[_0x5fdc('0x20')]=function(_0x2c0963,_0x1eb391){if(_0x2c0963['body']['id']){delete _0x2c0963[_0x5fdc('0x48')]['id'];}return db[_0x5fdc('0x3d')]['find']({'where':{'id':_0x2c0963[_0x5fdc('0x44')]['id']}})[_0x5fdc('0x24')](handleEntityNotFound(_0x1eb391,null))[_0x5fdc('0x24')](saveUpdates(_0x2c0963['body'],null))[_0x5fdc('0x24')](respondWithResult(_0x1eb391,null))[_0x5fdc('0x42')](handleError(_0x1eb391,null));};exports[_0x5fdc('0x21')]=function(_0x2f1df1,_0x103636){return db[_0x5fdc('0x3d')][_0x5fdc('0x46')]({'where':{'id':_0x2f1df1[_0x5fdc('0x44')]['id']}})[_0x5fdc('0x24')](handleEntityNotFound(_0x103636,null))['then'](removeEntity(_0x103636,null))[_0x5fdc('0x42')](handleError(_0x103636,null));};exports[_0x5fdc('0x50')]=function(_0x99650,_0x1e25c1,_0x59175f){if(_0x99650[_0x5fdc('0x48')]['id']){delete _0x99650['body']['id'];}return db[_0x5fdc('0x3d')]['find']({'where':{'id':_0x99650[_0x5fdc('0x44')]['id']}})[_0x5fdc('0x24')](handleEntityNotFound(_0x1e25c1,null))['then'](function(_0x470bc9){if(_0x470bc9){_0x99650[_0x5fdc('0x48')]['IntervalId']=_0x470bc9['id'];return db[_0x5fdc('0x3d')][_0x5fdc('0x47')](_0x99650[_0x5fdc('0x48')]);}})[_0x5fdc('0x24')](respondWithResult(_0x1e25c1,null))[_0x5fdc('0x42')](handleError(_0x1e25c1,null));};exports[_0x5fdc('0x51')]=function(_0x3bf7fa,_0xddd252,_0x13b297){var _0x9cc21f={};var _0x5ae011={};var _0x5f4c97;var _0x174f7f;return db[_0x5fdc('0x3d')][_0x5fdc('0x52')]({'where':{'id':_0x3bf7fa[_0x5fdc('0x44')]['id']}})[_0x5fdc('0x24')](handleEntityNotFound(_0xddd252,null))[_0x5fdc('0x24')](function(_0xfd226){if(_0xfd226){_0x5f4c97=_0xfd226;_0x5ae011[_0x5fdc('0x30')]=_[_0x5fdc('0x2e')](db[_0x5fdc('0x3d')][_0x5fdc('0x2a')]);_0x5ae011[_0x5fdc('0x2d')]=_[_0x5fdc('0x2e')](_0x3bf7fa[_0x5fdc('0x2d')]);_0x5ae011[_0x5fdc('0x2f')]=_[_0x5fdc('0x32')](_0x5ae011[_0x5fdc('0x30')],_0x5ae011['query']);_0x9cc21f[_0x5fdc('0x31')]=_[_0x5fdc('0x32')](_0x5ae011['model'],qs[_0x5fdc('0x33')](_0x3bf7fa[_0x5fdc('0x2d')]['fields']));_0x9cc21f[_0x5fdc('0x31')]=_0x9cc21f[_0x5fdc('0x31')][_0x5fdc('0x45')]?_0x9cc21f['attributes']:_0x5ae011['model'];_0x9cc21f['order']=qs[_0x5fdc('0x36')](_0x3bf7fa[_0x5fdc('0x2d')][_0x5fdc('0x36')]);_0x9cc21f['where']=qs[_0x5fdc('0x2f')](_['pick'](_0x3bf7fa['query'],_0x5ae011[_0x5fdc('0x2f')]));if(_0x3bf7fa[_0x5fdc('0x2d')][_0x5fdc('0x39')]){_0x9cc21f[_0x5fdc('0x37')]=_[_0x5fdc('0x3a')](_0x9cc21f[_0x5fdc('0x37')],{'$or':_['map'](_0x9cc21f[_0x5fdc('0x31')],function(_0x841b00){var _0x11430b={};_0x11430b[_0x841b00]={'$like':'%'+_0x3bf7fa[_0x5fdc('0x2d')]['filter']+'%'};return _0x11430b;})});}_0x9cc21f=_[_0x5fdc('0x3a')]({},_0x9cc21f,_0x3bf7fa[_0x5fdc('0x3c')]);return _0x5f4c97[_0x5fdc('0x51')](_0x9cc21f);}})[_0x5fdc('0x24')](function(_0x5f2040){if(_0x5f2040){_0x174f7f=_0x5f2040[_0x5fdc('0x45')];if(!_0x3bf7fa[_0x5fdc('0x2d')][_0x5fdc('0x34')](_0x5fdc('0x35'))){_0x9cc21f[_0x5fdc('0x1a')]=qs[_0x5fdc('0x1a')](_0x3bf7fa[_0x5fdc('0x2d')][_0x5fdc('0x1a')]);_0x9cc21f[_0x5fdc('0x18')]=qs[_0x5fdc('0x18')](_0x3bf7fa[_0x5fdc('0x2d')][_0x5fdc('0x18')]);}return _0x5f4c97[_0x5fdc('0x51')](_0x9cc21f);}})[_0x5fdc('0x24')](function(_0x36becf){if(_0x36becf){return _0x36becf?{'count':_0x174f7f,'rows':_0x36becf}:null;}})['then'](respondWithResult(_0xddd252,null))['catch'](handleError(_0xddd252,null));};exports[_0x5fdc('0x53')]=function(_0x712828,_0x3533c6,_0x4b0dda){return db['Interval']['findOne']({'where':{'id':_0x712828[_0x5fdc('0x44')]['id']}})[_0x5fdc('0x24')](handleEntityNotFound(_0x3533c6,null))['then'](function(_0x4c97cc){if(_0x4c97cc){return db[_0x5fdc('0x54')][_0x5fdc('0x55')](function(_0x4c6a0c){return db[_0x5fdc('0x3d')][_0x5fdc('0x21')]({'where':{'IntervalId':_0x712828[_0x5fdc('0x44')]['id']},'transaction':_0x4c6a0c})[_0x5fdc('0x24')](function(_0x2297c1){var _0x3bedae=_[_0x5fdc('0x29')](_0x712828['body'],function(_0x4344ea){delete _0x4344ea['id'];_0x4344ea['IntervalId']=_0x712828['params']['id'];return _0x4344ea;});return db[_0x5fdc('0x3d')][_0x5fdc('0x56')](_0x3bedae,{'transaction':_0x4c6a0c});});})[_0x5fdc('0x24')](function(){return db[_0x5fdc('0x3d')][_0x5fdc('0x40')]({'where':{'IntervalId':_0x712828[_0x5fdc('0x44')]['id']}});});}})['then'](respondWithResult(_0x3533c6,null))[_0x5fdc('0x42')](handleError(_0x3533c6,null));}; \ No newline at end of file +var _0xa2e5=['reject','update','then','UserProfileResource','destroy','sendStatus','error','name','send','map','Interval','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','user','get','Intervals','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','addIntervals','findOne','sequelize','transaction','bulkCreate','eml-format','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','end','status','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x13acc2,_0x26c6b9){var _0x5e4feb=function(_0x1f91a3){while(--_0x1f91a3){_0x13acc2['push'](_0x13acc2['shift']());}};_0x5e4feb(++_0x26c6b9);}(_0xa2e5,0xee));var _0x5a2e=function(_0x18bb54,_0x568517){_0x18bb54=_0x18bb54-0x0;var _0x58acaf=_0xa2e5[_0x18bb54];return _0x58acaf;};'use strict';var emlformat=require(_0x5a2e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a2e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5a2e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5a2e('0x3'));var util=require(_0x5a2e('0x4'));var path=require(_0x5a2e('0x5'));var sox=require(_0x5a2e('0x6'));var csv=require(_0x5a2e('0x7'));var ejs=require(_0x5a2e('0x8'));var fs=require('fs');var fs_extra=require(_0x5a2e('0x9'));var _=require(_0x5a2e('0xa'));var squel=require('squel');var crypto=require(_0x5a2e('0xb'));var jsforce=require(_0x5a2e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5a2e('0xd'));var Papa=require(_0x5a2e('0xe'));var Redis=require(_0x5a2e('0xf'));var authService=require(_0x5a2e('0x10'));var qs=require(_0x5a2e('0x11'));var as=require(_0x5a2e('0x12'));var hardwareService=require(_0x5a2e('0x13'));var logger=require('../../config/logger')(_0x5a2e('0x14'));var utils=require(_0x5a2e('0x15'));var config=require(_0x5a2e('0x16'));var licenseUtil=require(_0x5a2e('0x17'));var db=require(_0x5a2e('0x18'))['db'];var extensions=require(_0x5a2e('0x19'));function respondWithStatusCode(_0x2bb840,_0x3e3a37){_0x3e3a37=_0x3e3a37||0xcc;return function(_0x5ee3d1){if(_0x5ee3d1){return _0x2bb840['sendStatus'](_0x3e3a37);}return _0x2bb840['status'](_0x3e3a37)[_0x5a2e('0x1a')]();};}function respondWithResult(_0xaa69a1,_0x1fb24b){_0x1fb24b=_0x1fb24b||0xc8;return function(_0x1b345e){if(_0x1b345e){return _0xaa69a1[_0x5a2e('0x1b')](_0x1fb24b)[_0x5a2e('0x1c')](_0x1b345e);}};}function respondWithFilteredResult(_0x5e4225,_0x245895){return function(_0xd91427){if(_0xd91427){var _0x50a3e4=typeof _0x245895[_0x5a2e('0x1d')]==='undefined'&&typeof _0x245895[_0x5a2e('0x1e')]===_0x5a2e('0x1f');var _0x551702=_0xd91427[_0x5a2e('0x20')];var _0x343fa5=_0x50a3e4?0x0:_0x245895[_0x5a2e('0x1d')];var _0x33ab4f=_0x50a3e4?_0xd91427[_0x5a2e('0x20')]:_0x245895[_0x5a2e('0x1d')]+_0x245895[_0x5a2e('0x1e')];var _0x401907;if(_0x33ab4f>=_0x551702){_0x33ab4f=_0x551702;_0x401907=0xc8;}else{_0x401907=0xce;}_0x5e4225[_0x5a2e('0x1b')](_0x401907);return _0x5e4225[_0x5a2e('0x21')](_0x5a2e('0x22'),_0x343fa5+'-'+_0x33ab4f+'/'+_0x551702)['json'](_0xd91427);}return null;};}function patchUpdates(_0x58503c){return function(_0x38e11){try{jsonpatch['apply'](_0x38e11,_0x58503c,!![]);}catch(_0x48e460){return BPromise[_0x5a2e('0x23')](_0x48e460);}return _0x38e11['save']();};}function saveUpdates(_0x1e1f36,_0x33b021){return function(_0x4ca4d2){if(_0x4ca4d2){return _0x4ca4d2[_0x5a2e('0x24')](_0x1e1f36)[_0x5a2e('0x25')](function(_0x444261){return _0x444261;});}return null;};}function removeEntity(_0x2cf0df,_0x24b608){return function(_0x254308){if(_0x254308){return _0x254308['destroy']()[_0x5a2e('0x25')](function(){var _0x333242=_0x254308['get']({'plain':!![]});var _0x446a84='Intervals';return db[_0x5a2e('0x26')][_0x5a2e('0x27')]({'where':{'type':_0x446a84,'resourceId':_0x333242['id']}})[_0x5a2e('0x25')](function(){return _0x254308;});})[_0x5a2e('0x25')](function(){_0x2cf0df['status'](0xcc)[_0x5a2e('0x1a')]();});}};}function handleEntityNotFound(_0x3a75cc,_0x30aadf){return function(_0xadd0dc){if(!_0xadd0dc){_0x3a75cc[_0x5a2e('0x28')](0x194);}return _0xadd0dc;};}function handleError(_0x238e22,_0x41ce15){_0x41ce15=_0x41ce15||0x1f4;return function(_0x540188){logger[_0x5a2e('0x29')](_0x540188['stack']);if(_0x540188[_0x5a2e('0x2a')]){delete _0x540188[_0x5a2e('0x2a')];}_0x238e22['status'](_0x41ce15)[_0x5a2e('0x2b')](_0x540188);};}exports['index']=function(_0x3485a0,_0x1c8ee6){var _0x242413={},_0x350066={},_0x531824={'count':0x0,'rows':[]};var _0x464425=_[_0x5a2e('0x2c')](db[_0x5a2e('0x2d')][_0x5a2e('0x2e')],function(_0x1db78d){return{'name':_0x1db78d[_0x5a2e('0x2f')],'type':_0x1db78d[_0x5a2e('0x30')][_0x5a2e('0x31')]};});_0x350066['model']=_[_0x5a2e('0x2c')](_0x464425,_0x5a2e('0x2a'));_0x350066[_0x5a2e('0x32')]=_[_0x5a2e('0x33')](_0x3485a0['query']);_0x350066[_0x5a2e('0x34')]=_[_0x5a2e('0x35')](_0x350066[_0x5a2e('0x36')],_0x350066[_0x5a2e('0x32')]);_0x242413[_0x5a2e('0x37')]=_[_0x5a2e('0x35')](_0x350066['model'],qs[_0x5a2e('0x38')](_0x3485a0[_0x5a2e('0x32')][_0x5a2e('0x38')]));_0x242413[_0x5a2e('0x37')]=_0x242413[_0x5a2e('0x37')][_0x5a2e('0x39')]?_0x242413['attributes']:_0x350066['model'];if(!_0x3485a0[_0x5a2e('0x32')][_0x5a2e('0x3a')](_0x5a2e('0x3b'))){_0x242413[_0x5a2e('0x1e')]=qs['limit'](_0x3485a0[_0x5a2e('0x32')]['limit']);_0x242413[_0x5a2e('0x1d')]=qs['offset'](_0x3485a0['query']['offset']);}_0x242413[_0x5a2e('0x3c')]=qs['sort'](_0x3485a0[_0x5a2e('0x32')][_0x5a2e('0x3d')]);_0x242413['where']=qs[_0x5a2e('0x34')](_[_0x5a2e('0x3e')](_0x3485a0[_0x5a2e('0x32')],_0x350066[_0x5a2e('0x34')]),_0x464425);if(_0x3485a0[_0x5a2e('0x32')][_0x5a2e('0x3f')]){_0x242413[_0x5a2e('0x40')]=_[_0x5a2e('0x41')](_0x242413[_0x5a2e('0x40')],{'$or':_[_0x5a2e('0x2c')](_0x464425,function(_0x24cdad){if(_0x24cdad[_0x5a2e('0x30')]!==_0x5a2e('0x42')){var _0x39f2a6={};_0x39f2a6[_0x24cdad[_0x5a2e('0x2a')]]={'$like':'%'+_0x3485a0[_0x5a2e('0x32')][_0x5a2e('0x3f')]+'%'};return _0x39f2a6;}})});}_0x242413=_[_0x5a2e('0x41')]({},_0x242413,_0x3485a0['options']);var _0xb61ae7={'where':_0x242413[_0x5a2e('0x40')]};return db[_0x5a2e('0x2d')][_0x5a2e('0x20')](_0xb61ae7)[_0x5a2e('0x25')](function(_0x5a7e3b){_0x531824[_0x5a2e('0x20')]=_0x5a7e3b;if(_0x3485a0[_0x5a2e('0x32')][_0x5a2e('0x43')]){_0x242413[_0x5a2e('0x44')]=[{'all':!![]}];}return db['Interval'][_0x5a2e('0x45')](_0x242413);})[_0x5a2e('0x25')](function(_0x14e298){_0x531824[_0x5a2e('0x46')]=_0x14e298;return _0x531824;})['then'](respondWithFilteredResult(_0x1c8ee6,_0x242413))[_0x5a2e('0x47')](handleError(_0x1c8ee6,null));};exports['show']=function(_0x4c972b,_0x5a48dd){var _0x21a08b={'raw':!![],'where':{'id':_0x4c972b[_0x5a2e('0x48')]['id']}},_0x3e1e87={};_0x3e1e87[_0x5a2e('0x36')]=_['keys'](db['Interval']['rawAttributes']);_0x3e1e87[_0x5a2e('0x32')]=_[_0x5a2e('0x33')](_0x4c972b[_0x5a2e('0x32')]);_0x3e1e87[_0x5a2e('0x34')]=_['intersection'](_0x3e1e87[_0x5a2e('0x36')],_0x3e1e87[_0x5a2e('0x32')]);_0x21a08b[_0x5a2e('0x37')]=_[_0x5a2e('0x35')](_0x3e1e87[_0x5a2e('0x36')],qs[_0x5a2e('0x38')](_0x4c972b['query'][_0x5a2e('0x38')]));_0x21a08b[_0x5a2e('0x37')]=_0x21a08b['attributes']['length']?_0x21a08b['attributes']:_0x3e1e87[_0x5a2e('0x36')];if(_0x4c972b[_0x5a2e('0x32')][_0x5a2e('0x43')]){_0x21a08b[_0x5a2e('0x44')]=[{'all':!![]}];}_0x21a08b=_[_0x5a2e('0x41')]({},_0x21a08b,_0x4c972b[_0x5a2e('0x49')]);return db[_0x5a2e('0x2d')][_0x5a2e('0x4a')](_0x21a08b)[_0x5a2e('0x25')](handleEntityNotFound(_0x5a48dd,null))[_0x5a2e('0x25')](respondWithResult(_0x5a48dd,null))[_0x5a2e('0x47')](handleError(_0x5a48dd,null));};exports[_0x5a2e('0x4b')]=function(_0x34158b,_0x168855){return db[_0x5a2e('0x2d')][_0x5a2e('0x4b')](_0x34158b[_0x5a2e('0x4c')],{})[_0x5a2e('0x25')](function(_0xf3a95e){var _0x4bb077=_0x34158b[_0x5a2e('0x4d')][_0x5a2e('0x4e')]({'plain':!![]});if(!_0x4bb077)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4bb077['role']===_0x5a2e('0x4d')){var _0x3a8230=_0xf3a95e['get']({'plain':!![]});var _0x1df463=_0x5a2e('0x4f');return db[_0x5a2e('0x50')][_0x5a2e('0x4a')]({'where':{'name':_0x1df463,'userProfileId':_0x4bb077['userProfileId']},'raw':!![]})[_0x5a2e('0x25')](function(_0x33dcd3){if(_0x33dcd3&&_0x33dcd3[_0x5a2e('0x51')]===0x0){return db[_0x5a2e('0x26')][_0x5a2e('0x4b')]({'name':_0x3a8230[_0x5a2e('0x2a')],'resourceId':_0x3a8230['id'],'type':_0x33dcd3['name'],'sectionId':_0x33dcd3['id']},{})[_0x5a2e('0x25')](function(){return _0xf3a95e;});}else{return _0xf3a95e;}})[_0x5a2e('0x47')](function(_0x470968){logger['error'](_0x5a2e('0x52'),_0x470968);throw _0x470968;});}return _0xf3a95e;})[_0x5a2e('0x25')](respondWithResult(_0x168855,0xc9))['catch'](handleError(_0x168855,null));};exports[_0x5a2e('0x24')]=function(_0x308bb6,_0x170b51){if(_0x308bb6[_0x5a2e('0x4c')]['id']){delete _0x308bb6['body']['id'];}return db[_0x5a2e('0x2d')][_0x5a2e('0x4a')]({'where':{'id':_0x308bb6[_0x5a2e('0x48')]['id']}})[_0x5a2e('0x25')](handleEntityNotFound(_0x170b51,null))[_0x5a2e('0x25')](saveUpdates(_0x308bb6[_0x5a2e('0x4c')],null))[_0x5a2e('0x25')](respondWithResult(_0x170b51,null))[_0x5a2e('0x47')](handleError(_0x170b51,null));};exports[_0x5a2e('0x27')]=function(_0x445bdf,_0x182b70){return db[_0x5a2e('0x2d')]['find']({'where':{'id':_0x445bdf['params']['id']}})[_0x5a2e('0x25')](handleEntityNotFound(_0x182b70,null))['then'](removeEntity(_0x182b70,null))[_0x5a2e('0x47')](handleError(_0x182b70,null));};exports[_0x5a2e('0x53')]=function(_0x2a0799,_0x142248,_0x1f0478){if(_0x2a0799[_0x5a2e('0x4c')]['id']){delete _0x2a0799['body']['id'];}return db[_0x5a2e('0x2d')][_0x5a2e('0x4a')]({'where':{'id':_0x2a0799[_0x5a2e('0x48')]['id']}})[_0x5a2e('0x25')](handleEntityNotFound(_0x142248,null))[_0x5a2e('0x25')](function(_0x39217a){if(_0x39217a){_0x2a0799[_0x5a2e('0x4c')][_0x5a2e('0x54')]=_0x39217a['id'];return db[_0x5a2e('0x2d')][_0x5a2e('0x4b')](_0x2a0799[_0x5a2e('0x4c')]);}})['then'](respondWithResult(_0x142248,null))['catch'](handleError(_0x142248,null));};exports[_0x5a2e('0x55')]=function(_0x511e13,_0x5eba1f,_0x3663dd){var _0x192e36={};var _0x3b40b3={};var _0x270bb0;var _0x5bc2ee;return db[_0x5a2e('0x2d')]['findOne']({'where':{'id':_0x511e13[_0x5a2e('0x48')]['id']}})[_0x5a2e('0x25')](handleEntityNotFound(_0x5eba1f,null))[_0x5a2e('0x25')](function(_0x145678){if(_0x145678){_0x270bb0=_0x145678;_0x3b40b3[_0x5a2e('0x36')]=_[_0x5a2e('0x33')](db[_0x5a2e('0x2d')][_0x5a2e('0x2e')]);_0x3b40b3[_0x5a2e('0x32')]=_[_0x5a2e('0x33')](_0x511e13['query']);_0x3b40b3[_0x5a2e('0x34')]=_[_0x5a2e('0x35')](_0x3b40b3[_0x5a2e('0x36')],_0x3b40b3[_0x5a2e('0x32')]);_0x192e36[_0x5a2e('0x37')]=_[_0x5a2e('0x35')](_0x3b40b3['model'],qs[_0x5a2e('0x38')](_0x511e13[_0x5a2e('0x32')]['fields']));_0x192e36[_0x5a2e('0x37')]=_0x192e36[_0x5a2e('0x37')][_0x5a2e('0x39')]?_0x192e36['attributes']:_0x3b40b3['model'];_0x192e36['order']=qs[_0x5a2e('0x3d')](_0x511e13[_0x5a2e('0x32')][_0x5a2e('0x3d')]);_0x192e36[_0x5a2e('0x40')]=qs[_0x5a2e('0x34')](_[_0x5a2e('0x3e')](_0x511e13['query'],_0x3b40b3['filters']));if(_0x511e13['query'][_0x5a2e('0x3f')]){_0x192e36[_0x5a2e('0x40')]=_[_0x5a2e('0x41')](_0x192e36[_0x5a2e('0x40')],{'$or':_[_0x5a2e('0x2c')](_0x192e36[_0x5a2e('0x37')],function(_0x5d8413){var _0x389bde={};_0x389bde[_0x5d8413]={'$like':'%'+_0x511e13[_0x5a2e('0x32')][_0x5a2e('0x3f')]+'%'};return _0x389bde;})});}_0x192e36=_[_0x5a2e('0x41')]({},_0x192e36,_0x511e13['options']);return _0x270bb0[_0x5a2e('0x55')](_0x192e36);}})['then'](function(_0x209dc1){if(_0x209dc1){_0x5bc2ee=_0x209dc1['length'];if(!_0x511e13['query'][_0x5a2e('0x3a')]('nolimit')){_0x192e36[_0x5a2e('0x1e')]=qs['limit'](_0x511e13[_0x5a2e('0x32')][_0x5a2e('0x1e')]);_0x192e36[_0x5a2e('0x1d')]=qs[_0x5a2e('0x1d')](_0x511e13['query'][_0x5a2e('0x1d')]);}return _0x270bb0[_0x5a2e('0x55')](_0x192e36);}})[_0x5a2e('0x25')](function(_0x49cbcf){if(_0x49cbcf){return _0x49cbcf?{'count':_0x5bc2ee,'rows':_0x49cbcf}:null;}})[_0x5a2e('0x25')](respondWithResult(_0x5eba1f,null))[_0x5a2e('0x47')](handleError(_0x5eba1f,null));};exports[_0x5a2e('0x56')]=function(_0x80155,_0x5ddd66,_0x1acb7d){return db['Interval'][_0x5a2e('0x57')]({'where':{'id':_0x80155[_0x5a2e('0x48')]['id']}})[_0x5a2e('0x25')](handleEntityNotFound(_0x5ddd66,null))[_0x5a2e('0x25')](function(_0x54071b){if(_0x54071b){return db[_0x5a2e('0x58')][_0x5a2e('0x59')](function(_0x4b3f30){return db[_0x5a2e('0x2d')][_0x5a2e('0x27')]({'where':{'IntervalId':_0x80155[_0x5a2e('0x48')]['id']},'transaction':_0x4b3f30})[_0x5a2e('0x25')](function(_0x555b99){var _0x39f7a8=_[_0x5a2e('0x2c')](_0x80155['body'],function(_0x1ee5c3){delete _0x1ee5c3['id'];_0x1ee5c3[_0x5a2e('0x54')]=_0x80155[_0x5a2e('0x48')]['id'];return _0x1ee5c3;});return db['Interval'][_0x5a2e('0x5a')](_0x39f7a8,{'transaction':_0x4b3f30});});})[_0x5a2e('0x25')](function(){return db[_0x5a2e('0x2d')][_0x5a2e('0x45')]({'where':{'IntervalId':_0x80155[_0x5a2e('0x48')]['id']}});});}})['then'](respondWithResult(_0x5ddd66,null))[_0x5a2e('0x47')](handleError(_0x5ddd66,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index e803f15..4a57060 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 _0xdf3a=['exports','define','Interval','tools_intervals','rewrite','string','interval','then','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime'];(function(_0x4689d0,_0x5a28c5){var _0xb61270=function(_0x290db1){while(--_0x290db1){_0x4689d0['push'](_0x4689d0['shift']());}};_0xb61270(++_0x5a28c5);}(_0xdf3a,0x14c));var _0xadf3=function(_0x53d6ef,_0x4aad84){_0x53d6ef=_0x53d6ef-0x0;var _0x267cf6=_0xdf3a[_0x53d6ef];return _0x267cf6;};'use strict';var attributes=require(_0xadf3('0x0'));var extensions=require(_0xadf3('0x1'));var iftime=require(_0xadf3('0x2'))[_0xadf3('0x3')];module[_0xadf3('0x4')]=function(_0x4ecb96){return _0x4ecb96[_0xadf3('0x5')](_0xadf3('0x6'),attributes,{'tableName':_0xadf3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d7226){extensions[_0xadf3('0x8')](_0x4ecb96,_0x5d7226);},'afterBulkCreate':function(_0x2fecd5,_0x59a504,_0x18d177){_0x18d177();extensions['rewrite'](_0x4ecb96,_0x2fecd5[0x0]);},'afterUpdate':function(_0x3f9a8a){extensions[_0xadf3('0x8')](_0x4ecb96,_0x3f9a8a);},'afterDestroy':function(_0x52c2e9){extensions[_0xadf3('0x8')](_0x4ecb96,_0x52c2e9);}},'instanceMethods':{'ifTime':function(_0x1a9ae0=undefined,_0x570398=new Date()){if(typeof this['interval']===_0xadf3('0x9')){return iftime(this[_0xadf3('0xa')],_0x1a9ae0,_0x570398);}else{return this['getIntervals']()[_0xadf3('0xb')](function(_0x47fae3){return Promise['all'](_0x47fae3['map'](function(_0x649696){return _0x649696[_0xadf3('0xc')](_0x1a9ae0,_0x570398);}));})[_0xadf3('0xb')](function(_0x264049){return _0x264049[_0xadf3('0xd')](function(_0x3d6a1a,_0x224705){return _0x3d6a1a||_0x224705;},![]);});}}}});}; \ No newline at end of file +var _0x0082=['map','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','Interval','tools_intervals','rewrite','interval','string','getIntervals','all'];(function(_0x58736a,_0x5d0121){var _0x4518e2=function(_0x2d9433){while(--_0x2d9433){_0x58736a['push'](_0x58736a['shift']());}};_0x4518e2(++_0x5d0121);}(_0x0082,0x183));var _0x2008=function(_0x431894,_0xc3fb09){_0x431894=_0x431894-0x0;var _0x301052=_0x0082[_0x431894];return _0x301052;};'use strict';var attributes=require(_0x2008('0x0'));var extensions=require(_0x2008('0x1'));var iftime=require(_0x2008('0x2'))[_0x2008('0x3')];module[_0x2008('0x4')]=function(_0x3eaf99){return _0x3eaf99[_0x2008('0x5')](_0x2008('0x6'),attributes,{'tableName':_0x2008('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x20cb3b){extensions[_0x2008('0x8')](_0x3eaf99,_0x20cb3b);},'afterBulkCreate':function(_0x238ca2,_0x53c3b9,_0x3a91f0){_0x3a91f0();extensions[_0x2008('0x8')](_0x3eaf99,_0x238ca2[0x0]);},'afterUpdate':function(_0x4d12fe){extensions[_0x2008('0x8')](_0x3eaf99,_0x4d12fe);},'afterDestroy':function(_0x270a33){extensions[_0x2008('0x8')](_0x3eaf99,_0x270a33);}},'instanceMethods':{'ifTime':function(_0x1a1f52=undefined,_0x3cc0a6=new Date()){if(typeof this[_0x2008('0x9')]===_0x2008('0xa')){return iftime(this[_0x2008('0x9')],_0x1a1f52,_0x3cc0a6);}else{return this[_0x2008('0xb')]()['then'](function(_0xda2e42){return Promise[_0x2008('0xc')](_0xda2e42[_0x2008('0xd')](function(_0x4110b6){return _0x4110b6[_0x2008('0xe')](_0x1a1f52,_0x3cc0a6);}));})['then'](function(_0x3f0206){return _0x3f0206[_0x2008('0xf')](function(_0x2a6f05,_0x97775){return _0x2a6f05||_0x97775;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index b072ea1..46eeadf 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 _0x5b5e=['name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','timezone','length','Iftime','silly','resolve','catch','lodash','util','../../utils/iftime','iftime','rpc','Interval','findAll','options','raw','where','limit','include','map','model','attributes','then','GetInterval','debug','stringify','error','message','info','ShowInterval','all','ifTime','format'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x5b5e,0x14e));var _0xe5b5=function(_0x22ed8a,_0x20b088){_0x22ed8a=_0x22ed8a-0x0;var _0x1f84aa=_0x5b5e[_0x22ed8a];return _0x1f84aa;};'use strict';var _=require(_0xe5b5('0x0'));var util=require(_0xe5b5('0x1'));var db=require('../../mysqldb')['db'];var iftime=require(_0xe5b5('0x2'))[_0xe5b5('0x3')];var logger=require('../../config/logger')(_0xe5b5('0x4'));exports['GetInterval']=function(_0x415e3a){var _0x29fb96=this;return new Promise(function(_0x2d499a,_0x5d3643){return db[_0xe5b5('0x5')][_0xe5b5('0x6')]({'raw':_0x415e3a[_0xe5b5('0x7')]?_0x415e3a['options'][_0xe5b5('0x8')]===undefined?!![]:![]:!![],'where':_0x415e3a[_0xe5b5('0x7')]?_0x415e3a[_0xe5b5('0x7')][_0xe5b5('0x9')]||null:null,'attributes':_0x415e3a[_0xe5b5('0x7')]?_0x415e3a[_0xe5b5('0x7')]['attributes']||null:null,'limit':_0x415e3a['options']?_0x415e3a[_0xe5b5('0x7')][_0xe5b5('0xa')]||null:null,'include':_0x415e3a[_0xe5b5('0x7')]?_0x415e3a['options'][_0xe5b5('0xb')]?_[_0xe5b5('0xc')](_0x415e3a['options'][_0xe5b5('0xb')],function(_0x24a7db){return{'model':db[_0x24a7db['model']],'as':_0x24a7db['as'],'attributes':_0x24a7db['attributes'],'include':_0x24a7db[_0xe5b5('0xb')]?_[_0xe5b5('0xc')](_0x24a7db[_0xe5b5('0xb')],function(_0x18c615){return{'model':db[_0x18c615[_0xe5b5('0xd')]],'as':_0x18c615['as'],'attributes':_0x18c615[_0xe5b5('0xe')],'include':_0x18c615[_0xe5b5('0xb')]?_[_0xe5b5('0xc')](_0x18c615[_0xe5b5('0xb')],function(_0x18833e){return{'model':db[_0x18833e['model']],'as':_0x18833e['as'],'attributes':_0x18833e['attributes']};}):[]};}):[]};}):[]:[]})[_0xe5b5('0xf')](function(_0x507e84){logger['info'](_0xe5b5('0x10'),_0x415e3a);logger[_0xe5b5('0x11')]('GetInterval',_0x415e3a,JSON[_0xe5b5('0x12')](_0x507e84));_0x2d499a(_0x507e84);})['catch'](function(_0x396a8c){logger[_0xe5b5('0x13')](_0xe5b5('0x10'),_0x396a8c[_0xe5b5('0x14')],_0x415e3a);_0x5d3643(_0x29fb96['error'](0x1f4,_0x396a8c['message']));});});};exports['ShowInterval']=function(_0x13a7c6){var _0x111c35=this;return new Promise(function(_0x3c77e8,_0x223b2e){return db[_0xe5b5('0x5')]['find']({'raw':_0x13a7c6[_0xe5b5('0x7')]?_0x13a7c6['options'][_0xe5b5('0x8')]===undefined?!![]:![]:!![],'where':_0x13a7c6[_0xe5b5('0x7')]?_0x13a7c6[_0xe5b5('0x7')][_0xe5b5('0x9')]||null:null,'attributes':_0x13a7c6[_0xe5b5('0x7')]?_0x13a7c6[_0xe5b5('0x7')][_0xe5b5('0xe')]||null:null,'include':_0x13a7c6['options']?_0x13a7c6[_0xe5b5('0x7')]['include']?_[_0xe5b5('0xc')](_0x13a7c6['options'][_0xe5b5('0xb')],function(_0x58c5ce){return{'model':db[_0x58c5ce[_0xe5b5('0xd')]],'as':_0x58c5ce['as'],'attributes':_0x58c5ce['attributes'],'include':_0x58c5ce[_0xe5b5('0xb')]?_[_0xe5b5('0xc')](_0x58c5ce['include'],function(_0x466f03){return{'model':db[_0x466f03[_0xe5b5('0xd')]],'as':_0x466f03['as'],'attributes':_0x466f03[_0xe5b5('0xe')],'include':_0x466f03[_0xe5b5('0xb')]?_['map'](_0x466f03[_0xe5b5('0xb')],function(_0x45bc07){return{'model':db[_0x45bc07[_0xe5b5('0xd')]],'as':_0x45bc07['as'],'attributes':_0x45bc07[_0xe5b5('0xe')]};}):[]};}):[]};}):[]:[]})[_0xe5b5('0xf')](function(_0x5eb951){logger[_0xe5b5('0x15')](_0xe5b5('0x16'),_0x13a7c6);logger['debug'](_0xe5b5('0x16'),_0x13a7c6,JSON[_0xe5b5('0x12')](_0x5eb951));_0x3c77e8(_0x5eb951);})['catch'](function(_0x4d1973){logger['error'](_0xe5b5('0x16'),_0x4d1973[_0xe5b5('0x14')],_0x13a7c6);_0x223b2e(_0x111c35[_0xe5b5('0x13')](0x1f4,_0x4d1973[_0xe5b5('0x14')]));});});};function checkArrayOfIntervals(_0x5cc806,_0x38cc31){var _0x534bec=[];return db[_0xe5b5('0x5')][_0xe5b5('0x6')]({'where':{'id':_0x5cc806}})[_0xe5b5('0xf')](function(_0x20daf2){_0x534bec=_0x20daf2;return Promise[_0xe5b5('0x17')](_0x534bec['map'](function(_0x3a5614){return _0x3a5614[_0xe5b5('0x18')](_0x38cc31);}));})[_0xe5b5('0xf')](function(_0x3eb650){var _0x5857e3=_0x3eb650['reduce'](function(_0x351eee,_0x4f40b4){return _0x351eee||_0x4f40b4;},![]);logger['info'](util[_0xe5b5('0x19')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x534bec[_0xe5b5('0xc')](function(_0x539fae){return _0x539fae[_0xe5b5('0x1a')];})[_0xe5b5('0x1b')](',\x20'),_0x534bec[_0xe5b5('0xc')](function(_0x5f3199){return _0x5f3199['id'];})[_0xe5b5('0x1b')](',\x20')));return _0x5857e3;});}function checkSingleInterval(_0x55869b,_0x32d7f0){return db[_0xe5b5('0x5')][_0xe5b5('0x1c')](_0x55869b)[_0xe5b5('0xf')](function(_0x4a9f05){if(_0x4a9f05){logger[_0xe5b5('0x15')](util[_0xe5b5('0x19')](_0xe5b5('0x1d'),_0x4a9f05['name'],_0x4a9f05['id']));return _0x4a9f05['ifTime'](_0x32d7f0);}});}exports[_0xe5b5('0x1e')]=function(_0x2dc1c2){var _0x5e3fdd=_0x2dc1c2[_0xe5b5('0x1f')];var _0x5a5b55=Array[_0xe5b5('0x20')](_0x2dc1c2['intervals'])?_0x2dc1c2[_0xe5b5('0x21')]:typeof _0x2dc1c2[_0xe5b5('0x21')]==='string'?[_0x2dc1c2[_0xe5b5('0x21')]]:[];var _0x1f1980=_0x2dc1c2[_0xe5b5('0x22')]||undefined;var _0x25fdb6=![];if(_0x5a5b55[_0xe5b5('0x23')]){logger[_0xe5b5('0x15')](util[_0xe5b5('0x19')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x5a5b55[_0xe5b5('0x1b')](';\x20')));}if(_0x1f1980){logger[_0xe5b5('0x15')](util[_0xe5b5('0x19')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x1f1980));}logger[_0xe5b5('0x11')](_0xe5b5('0x24'),_0x25fdb6);logger[_0xe5b5('0x25')](_0xe5b5('0x1e'),_0x2dc1c2);return Promise[_0xe5b5('0x26')]()[_0xe5b5('0xf')](function(){if(Array['isArray'](_0x5e3fdd)){return checkArrayOfIntervals(_0x5e3fdd,_0x1f1980);}else if(_0x5e3fdd){return checkSingleInterval(_0x5e3fdd,_0x1f1980);}})[_0xe5b5('0xf')](function(_0x1474eb){var _0x3e6fd2=_0x5a5b55['reduce'](function(_0x4cffd1,_0x3482bb){return _0x4cffd1||iftime(_0x3482bb,_0x1f1980);},![]);_0x25fdb6=_0x1474eb||_0x3e6fd2;return _0x25fdb6;})[_0xe5b5('0x27')](function(_0x19929e){logger[_0xe5b5('0x13')](_0xe5b5('0x1e'),_0x2dc1c2,_0x19929e);throw this['error'](0x1f4,_0x19929e['message']);});}; \ No newline at end of file +var _0x4b83=['silly','resolve','reduce','lodash','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','raw','options','where','limit','include','map','model','attributes','then','info','debug','stringify','catch','error','message','ShowInterval','Interval','find','findAll','all','ifTime','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','string','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime'];(function(_0x4f738a,_0x3b28fa){var _0x23f5e8=function(_0x5c366a){while(--_0x5c366a){_0x4f738a['push'](_0x4f738a['shift']());}};_0x23f5e8(++_0x3b28fa);}(_0x4b83,0x1e7));var _0x34b8=function(_0x5d37ac,_0x19d434){_0x5d37ac=_0x5d37ac-0x0;var _0x58dd9a=_0x4b83[_0x5d37ac];return _0x58dd9a;};'use strict';var _=require(_0x34b8('0x0'));var util=require('util');var db=require(_0x34b8('0x1'))['db'];var iftime=require(_0x34b8('0x2'))[_0x34b8('0x3')];var logger=require(_0x34b8('0x4'))(_0x34b8('0x5'));exports[_0x34b8('0x6')]=function(_0x3d2ef4){var _0x457d86=this;return new Promise(function(_0x2210ea,_0xc9f670){return db['Interval']['findAll']({'raw':_0x3d2ef4['options']?_0x3d2ef4['options'][_0x34b8('0x7')]===undefined?!![]:![]:!![],'where':_0x3d2ef4[_0x34b8('0x8')]?_0x3d2ef4[_0x34b8('0x8')][_0x34b8('0x9')]||null:null,'attributes':_0x3d2ef4[_0x34b8('0x8')]?_0x3d2ef4[_0x34b8('0x8')]['attributes']||null:null,'limit':_0x3d2ef4[_0x34b8('0x8')]?_0x3d2ef4['options'][_0x34b8('0xa')]||null:null,'include':_0x3d2ef4[_0x34b8('0x8')]?_0x3d2ef4[_0x34b8('0x8')][_0x34b8('0xb')]?_[_0x34b8('0xc')](_0x3d2ef4[_0x34b8('0x8')]['include'],function(_0x2afb14){return{'model':db[_0x2afb14[_0x34b8('0xd')]],'as':_0x2afb14['as'],'attributes':_0x2afb14[_0x34b8('0xe')],'include':_0x2afb14[_0x34b8('0xb')]?_['map'](_0x2afb14[_0x34b8('0xb')],function(_0x451e3c){return{'model':db[_0x451e3c[_0x34b8('0xd')]],'as':_0x451e3c['as'],'attributes':_0x451e3c[_0x34b8('0xe')],'include':_0x451e3c[_0x34b8('0xb')]?_['map'](_0x451e3c[_0x34b8('0xb')],function(_0x2a2d3b){return{'model':db[_0x2a2d3b[_0x34b8('0xd')]],'as':_0x2a2d3b['as'],'attributes':_0x2a2d3b['attributes']};}):[]};}):[]};}):[]:[]})[_0x34b8('0xf')](function(_0x4df845){logger[_0x34b8('0x10')](_0x34b8('0x6'),_0x3d2ef4);logger[_0x34b8('0x11')](_0x34b8('0x6'),_0x3d2ef4,JSON[_0x34b8('0x12')](_0x4df845));_0x2210ea(_0x4df845);})[_0x34b8('0x13')](function(_0x43a621){logger[_0x34b8('0x14')](_0x34b8('0x6'),_0x43a621['message'],_0x3d2ef4);_0xc9f670(_0x457d86[_0x34b8('0x14')](0x1f4,_0x43a621[_0x34b8('0x15')]));});});};exports[_0x34b8('0x16')]=function(_0x2fbf7f){var _0x5a3309=this;return new Promise(function(_0x3bcaec,_0x36cbf4){return db[_0x34b8('0x17')][_0x34b8('0x18')]({'raw':_0x2fbf7f[_0x34b8('0x8')]?_0x2fbf7f[_0x34b8('0x8')][_0x34b8('0x7')]===undefined?!![]:![]:!![],'where':_0x2fbf7f[_0x34b8('0x8')]?_0x2fbf7f[_0x34b8('0x8')][_0x34b8('0x9')]||null:null,'attributes':_0x2fbf7f[_0x34b8('0x8')]?_0x2fbf7f[_0x34b8('0x8')][_0x34b8('0xe')]||null:null,'include':_0x2fbf7f[_0x34b8('0x8')]?_0x2fbf7f[_0x34b8('0x8')]['include']?_['map'](_0x2fbf7f['options']['include'],function(_0x3ac8ec){return{'model':db[_0x3ac8ec[_0x34b8('0xd')]],'as':_0x3ac8ec['as'],'attributes':_0x3ac8ec[_0x34b8('0xe')],'include':_0x3ac8ec[_0x34b8('0xb')]?_['map'](_0x3ac8ec['include'],function(_0x1bd5e9){return{'model':db[_0x1bd5e9[_0x34b8('0xd')]],'as':_0x1bd5e9['as'],'attributes':_0x1bd5e9[_0x34b8('0xe')],'include':_0x1bd5e9[_0x34b8('0xb')]?_[_0x34b8('0xc')](_0x1bd5e9[_0x34b8('0xb')],function(_0x5d89e3){return{'model':db[_0x5d89e3['model']],'as':_0x5d89e3['as'],'attributes':_0x5d89e3[_0x34b8('0xe')]};}):[]};}):[]};}):[]:[]})[_0x34b8('0xf')](function(_0x126b4e){logger['info'](_0x34b8('0x16'),_0x2fbf7f);logger[_0x34b8('0x11')]('ShowInterval',_0x2fbf7f,JSON[_0x34b8('0x12')](_0x126b4e));_0x3bcaec(_0x126b4e);})[_0x34b8('0x13')](function(_0x4a4e32){logger[_0x34b8('0x14')](_0x34b8('0x16'),_0x4a4e32['message'],_0x2fbf7f);_0x36cbf4(_0x5a3309[_0x34b8('0x14')](0x1f4,_0x4a4e32[_0x34b8('0x15')]));});});};function checkArrayOfIntervals(_0x30c3ae,_0x2eea96){var _0x32df4a=[];return db[_0x34b8('0x17')][_0x34b8('0x19')]({'where':{'id':_0x30c3ae}})[_0x34b8('0xf')](function(_0x17e1f1){_0x32df4a=_0x17e1f1;return Promise[_0x34b8('0x1a')](_0x32df4a['map'](function(_0x3a9f18){return _0x3a9f18[_0x34b8('0x1b')](_0x2eea96);}));})['then'](function(_0x1e42f2){var _0x1d7fea=_0x1e42f2['reduce'](function(_0x3519df,_0x3b1a45){return _0x3519df||_0x3b1a45;},![]);logger[_0x34b8('0x10')](util['format'](_0x34b8('0x1c'),_0x32df4a['map'](function(_0x49ddd5){return _0x49ddd5['name'];})[_0x34b8('0x1d')](',\x20'),_0x32df4a[_0x34b8('0xc')](function(_0x2db194){return _0x2db194['id'];})[_0x34b8('0x1d')](',\x20')));return _0x1d7fea;});}function checkSingleInterval(_0x265c69,_0x211d99){return db[_0x34b8('0x17')][_0x34b8('0x1e')](_0x265c69)[_0x34b8('0xf')](function(_0x5e8ca7){if(_0x5e8ca7){logger['info'](util[_0x34b8('0x1f')](_0x34b8('0x20'),_0x5e8ca7['name'],_0x5e8ca7['id']));return _0x5e8ca7[_0x34b8('0x1b')](_0x211d99);}});}exports[_0x34b8('0x21')]=function(_0x45bb49){var _0x3e2acb=_0x45bb49[_0x34b8('0x22')];var _0x13e1e3=Array[_0x34b8('0x23')](_0x45bb49['intervals'])?_0x45bb49[_0x34b8('0x24')]:typeof _0x45bb49[_0x34b8('0x24')]===_0x34b8('0x25')?[_0x45bb49[_0x34b8('0x24')]]:[];var _0x2d98d8=_0x45bb49['timezone']||undefined;var _0xc5bcea=![];if(_0x13e1e3['length']){logger[_0x34b8('0x10')](util[_0x34b8('0x1f')](_0x34b8('0x26'),_0x13e1e3[_0x34b8('0x1d')](';\x20')));}if(_0x2d98d8){logger[_0x34b8('0x10')](util[_0x34b8('0x1f')](_0x34b8('0x27'),_0x2d98d8));}logger[_0x34b8('0x11')](_0x34b8('0x28'),_0xc5bcea);logger[_0x34b8('0x29')](_0x34b8('0x21'),_0x45bb49);return Promise[_0x34b8('0x2a')]()[_0x34b8('0xf')](function(){if(Array['isArray'](_0x3e2acb)){return checkArrayOfIntervals(_0x3e2acb,_0x2d98d8);}else if(_0x3e2acb){return checkSingleInterval(_0x3e2acb,_0x2d98d8);}})[_0x34b8('0xf')](function(_0x38082d){var _0x21825c=_0x13e1e3[_0x34b8('0x2b')](function(_0xa4a8be,_0x1b55fc){return _0xa4a8be||iftime(_0x1b55fc,_0x2d98d8);},![]);_0xc5bcea=_0x38082d||_0x21825c;return _0xc5bcea;})[_0x34b8('0x13')](function(_0x1ecb7d){logger[_0x34b8('0x14')](_0x34b8('0x21'),_0x45bb49,_0x1ecb7d);throw this[_0x34b8('0x14')](0x1f4,_0x1ecb7d['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 46133d1..66d088e 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0x0b0e[_0x2fee96];return _0x2e6ad1;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file +var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x2a4026,_0x1a4ae6){var _0x5b841f=function(_0x3b9287){while(--_0x3b9287){_0x2a4026['push'](_0x2a4026['shift']());}};_0x5b841f(++_0x1a4ae6);}(_0xadb5,0xad));var _0x5adb=function(_0x14bfd7,_0x78eb77){_0x14bfd7=_0x14bfd7-0x0;var _0x32256=_0xadb5[_0x14bfd7];return _0x32256;};'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 d69db53..58fe3fd 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 _0x72bb=['error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','body','bluebird','../../config/logger','api','support','MOTGUI','Report','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','customfield_11503','customfield_11504','customfield_10102','/rest/api/2/issue','POST','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','statusCode','json'];(function(_0x3d8ca8,_0x1a9764){var _0x517e45=function(_0x641ad9){while(--_0x641ad9){_0x3d8ca8['push'](_0x3d8ca8['shift']());}};_0x517e45(++_0x1a9764);}(_0x72bb,0x15c));var _0xb72b=function(_0x5ebf44,_0x4e543e){_0x5ebf44=_0x5ebf44-0x0;var _0x2fef12=_0x72bb[_0x5ebf44];return _0x2fef12;};'use strict';var BPromise=require(_0xb72b('0x0'));var https=require('https');var logger=require(_0xb72b('0x1'))(_0xb72b('0x2'));var USERNAME=_0xb72b('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x52f676,_0x1f146b){var _0x45a026={'fields':{'project':{'key':_0x52f676['key']||_0xb72b('0x4')},'summary':(_0x52f676['summary']||_0xb72b('0x5'))+_0xb72b('0x6')+_0x52f676['ip'],'description':_0x52f676['description']||JSON[_0xb72b('0x7')](_0x52f676),'issuetype':{'name':_0x52f676[_0xb72b('0x8')]||_0xb72b('0x9')}}};_0x45a026[_0xb72b('0xa')][_0xb72b('0xb')]=_0x52f676[_0xb72b('0xc')];_0x45a026[_0xb72b('0xa')][_0xb72b('0xd')]=_0x52f676['oldToken'];_0x45a026[_0xb72b('0xa')][_0xb72b('0xe')]=_0x52f676['newToken'];_0x45a026[_0xb72b('0xa')][_0xb72b('0xf')]=_0x52f676['name'];_0x45a026[_0xb72b('0xa')][_0xb72b('0x10')]=_0x52f676['reason'];_0x45a026[_0xb72b('0xa')][_0xb72b('0x11')]=_0x52f676['ip'];var _0x44cbfc={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xb72b('0x12'),'method':_0xb72b('0x13'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xb72b('0x14')+new Buffer(USERNAME+':'+PASSWORD)[_0xb72b('0x15')](_0xb72b('0x16'))}};var _0x47aa9e=JSON[_0xb72b('0x7')](_0x45a026);var _0x4697fe=https[_0xb72b('0x17')](_0x44cbfc,function(_0x457591){_0x457591[_0xb72b('0x18')](_0xb72b('0x19'));var _0x16c018='';_0x457591['on'](_0xb72b('0x1a'),function(_0x3aed80){_0x16c018+=_0x3aed80;});_0x457591['on'](_0xb72b('0x1b'),function(){if(_0x1f146b){return _0x1f146b['status'](_0x457591[_0xb72b('0x1c')])[_0xb72b('0x1d')](JSON['parse'](_0x16c018));}});});_0x4697fe['on'](_0xb72b('0x1e'),function(_0x1829c9){if(_0x1f146b){return _0x1f146b[_0xb72b('0x1f')](0x1f4)[_0xb72b('0x1d')]({'errors':[{'message':_0xb72b('0x20'),'type':_0xb72b('0x21')}]});}});_0x4697fe[_0xb72b('0x22')](_0x47aa9e);_0x4697fe[_0xb72b('0x1b')]();}exports[_0xb72b('0x23')]=openIssue;exports[_0xb72b('0x24')]=function(_0x3e6f55,_0x471146){_0x3e6f55['body']['ip']=_0x3e6f55[_0xb72b('0x25')][_0xb72b('0x26')]||_0x3e6f55[_0xb72b('0x27')][_0xb72b('0x28')]||_0x3e6f55['socket']['remoteAddress']||_0x3e6f55[_0xb72b('0x27')]['socket'][_0xb72b('0x28')];return openIssue(_0x3e6f55[_0xb72b('0x29')],_0x471146);}; \ No newline at end of file +var _0xf441=['remoteAddress','socket','connection','bluebird','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','\x20from\x20','description','stringify','issuetype','Bug','customfield_11500','email','fields','customfield_11501','oldToken','customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','toString','base64','request','utf8','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','end','body','headers','x-forwarded-for'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf441,0xda));var _0x1f44=function(_0xdc4996,_0x15bedc){_0xdc4996=_0xdc4996-0x0;var _0x20fbb9=_0xf441[_0xdc4996];return _0x20fbb9;};'use strict';var BPromise=require(_0x1f44('0x0'));var https=require('https');var logger=require(_0x1f44('0x1'))(_0x1f44('0x2'));var USERNAME=_0x1f44('0x3');var PASSWORD=_0x1f44('0x4');function openIssue(_0x2e89f4,_0x104eb7){var _0x43f7c0={'fields':{'project':{'key':_0x2e89f4[_0x1f44('0x5')]||_0x1f44('0x6')},'summary':(_0x2e89f4['summary']||'Report')+_0x1f44('0x7')+_0x2e89f4['ip'],'description':_0x2e89f4[_0x1f44('0x8')]||JSON[_0x1f44('0x9')](_0x2e89f4),'issuetype':{'name':_0x2e89f4[_0x1f44('0xa')]||_0x1f44('0xb')}}};_0x43f7c0['fields'][_0x1f44('0xc')]=_0x2e89f4[_0x1f44('0xd')];_0x43f7c0[_0x1f44('0xe')][_0x1f44('0xf')]=_0x2e89f4[_0x1f44('0x10')];_0x43f7c0['fields'][_0x1f44('0x11')]=_0x2e89f4['newToken'];_0x43f7c0[_0x1f44('0xe')][_0x1f44('0x12')]=_0x2e89f4[_0x1f44('0x13')];_0x43f7c0[_0x1f44('0xe')][_0x1f44('0x14')]=_0x2e89f4[_0x1f44('0x15')];_0x43f7c0[_0x1f44('0xe')][_0x1f44('0x16')]=_0x2e89f4['ip'];var _0x59ed65={'host':_0x1f44('0x17'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x1f44('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x1f44('0x19'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x1f44('0x1a')](_0x1f44('0x1b'))}};var _0x3fc4b3=JSON['stringify'](_0x43f7c0);var _0x3c6848=https[_0x1f44('0x1c')](_0x59ed65,function(_0x31565b){_0x31565b['setEncoding'](_0x1f44('0x1d'));var _0xe4afb5='';_0x31565b['on']('data',function(_0x45b588){_0xe4afb5+=_0x45b588;});_0x31565b['on']('end',function(){if(_0x104eb7){return _0x104eb7[_0x1f44('0x1e')](_0x31565b[_0x1f44('0x1f')])[_0x1f44('0x20')](JSON[_0x1f44('0x21')](_0xe4afb5));}});});_0x3c6848['on']('error',function(_0x1e243c){if(_0x104eb7){return _0x104eb7[_0x1f44('0x1e')](0x1f4)[_0x1f44('0x20')]({'errors':[{'message':_0x1f44('0x22'),'type':'api.jira'}]});}});_0x3c6848[_0x1f44('0x23')](_0x3fc4b3);_0x3c6848[_0x1f44('0x24')]();}exports['openIssue']=openIssue;exports['send']=function(_0x354be9,_0x3d2d36){_0x354be9[_0x1f44('0x25')]['ip']=_0x354be9[_0x1f44('0x26')][_0x1f44('0x27')]||_0x354be9['connection'][_0x1f44('0x28')]||_0x354be9[_0x1f44('0x29')][_0x1f44('0x28')]||_0x354be9[_0x1f44('0x2a')][_0x1f44('0x29')][_0x1f44('0x28')];return openIssue(_0x354be9[_0x1f44('0x25')],_0x3d2d36);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index b7dabcc..9d68aa3 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 _0xda55=['../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','get','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util','express','Router','fs-extra'];(function(_0xf0ec6e,_0xa183d3){var _0x8bbc27=function(_0x39822b){while(--_0x39822b){_0xf0ec6e['push'](_0xf0ec6e['shift']());}};_0x8bbc27(++_0xa183d3);}(_0xda55,0x6d));var _0x5da5=function(_0x5ef8f7,_0xcefb41){_0x5ef8f7=_0x5ef8f7-0x0;var _0x8616ef=_0xda55[_0x5ef8f7];return _0x8616ef;};'use strict';var multer=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5da5('0x2'));var router=express[_0x5da5('0x3')]();var fs_extra=require(_0x5da5('0x4'));var auth=require(_0x5da5('0x5'));var interaction=require(_0x5da5('0x6'));var config=require('../../config/environment');var controller=require(_0x5da5('0x7'));router['get']('/',auth[_0x5da5('0x8')](),controller['index']);router[_0x5da5('0x9')](_0x5da5('0xa'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xb')]);router[_0x5da5('0x9')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xd')]);router['post']('/',auth[_0x5da5('0x8')](),controller[_0x5da5('0xe')]);router[_0x5da5('0xf')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0x10')]);router[_0x5da5('0x11')]('/:id',auth[_0x5da5('0x8')](),controller[_0x5da5('0x12')]);module['exports']=router; \ No newline at end of file +var _0xcb91=['get','index','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller'];(function(_0x1d31d0,_0x4fdb24){var _0x445ade=function(_0x68f482){while(--_0x68f482){_0x1d31d0['push'](_0x1d31d0['shift']());}};_0x445ade(++_0x4fdb24);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0xcb91[_0x3712e2];return _0x1faff4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0xe')](_0x1cb9('0xb'),auth['isAuthenticated'](),controller[_0x1cb9('0xf')]);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 6504543..260328f 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(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x7a54,0x106));var _0x47a5=function(_0x331283,_0x19ed83){_0x331283=_0x331283-0x0;var _0x257d15=_0x7a54[_0x331283];return _0x257d15;};'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(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x7a54,0x106));var _0x47a5=function(_0x379d98,_0x3e3b27){_0x379d98=_0x379d98-0x0;var _0x435ab2=_0x7a54[_0x379d98];return _0x435ab2;};'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 518fef9..cea8195 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 _0x9576=['rows','catch','show','params','intersection','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','include','findAll'];(function(_0x32cca2,_0x3ad320){var _0x4a8600=function(_0x463d0a){while(--_0x463d0a){_0x32cca2['push'](_0x32cca2['shift']());}};_0x4a8600(++_0x3ad320);}(_0x9576,0x182));var _0x6957=function(_0x12c7ec,_0x559ae1){_0x12c7ec=_0x12c7ec-0x0;var _0x3c80ab=_0x9576[_0x12c7ec];return _0x3c80ab;};'use strict';var emlformat=require(_0x6957('0x0'));var rimraf=require(_0x6957('0x1'));var zipdir=require(_0x6957('0x2'));var jsonpatch=require(_0x6957('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6957('0x4'));var Mustache=require(_0x6957('0x5'));var util=require(_0x6957('0x6'));var path=require(_0x6957('0x7'));var sox=require(_0x6957('0x8'));var csv=require(_0x6957('0x9'));var ejs=require(_0x6957('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6957('0xb'));var squel=require(_0x6957('0xc'));var crypto=require(_0x6957('0xd'));var jsforce=require(_0x6957('0xe'));var deskjs=require(_0x6957('0xf'));var toCsv=require(_0x6957('0x9'));var querystring=require('querystring');var Papa=require(_0x6957('0x10'));var Redis=require(_0x6957('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6957('0x12'));var hardwareService=require(_0x6957('0x13'));var logger=require(_0x6957('0x14'))(_0x6957('0x15'));var utils=require(_0x6957('0x16'));var config=require(_0x6957('0x17'));var licenseUtil=require(_0x6957('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5888d6,_0x548647){_0x548647=_0x548647||0xcc;return function(_0x3f40f0){if(_0x3f40f0){return _0x5888d6[_0x6957('0x19')](_0x548647);}return _0x5888d6[_0x6957('0x1a')](_0x548647)[_0x6957('0x1b')]();};}function respondWithResult(_0x345c3e,_0x1fd3d9){_0x1fd3d9=_0x1fd3d9||0xc8;return function(_0x25d32e){if(_0x25d32e){return _0x345c3e['status'](_0x1fd3d9)['json'](_0x25d32e);}};}function respondWithFilteredResult(_0x4f82cb,_0x35fffc){return function(_0x256ac7){if(_0x256ac7){var _0x228f76=typeof _0x35fffc[_0x6957('0x1c')]==='undefined'&&typeof _0x35fffc[_0x6957('0x1d')]==='undefined';var _0x2a39b5=_0x256ac7[_0x6957('0x1e')];var _0x49aa31=_0x228f76?0x0:_0x35fffc[_0x6957('0x1c')];var _0x448ff6=_0x228f76?_0x256ac7[_0x6957('0x1e')]:_0x35fffc['offset']+_0x35fffc[_0x6957('0x1d')];var _0x2c103c;if(_0x448ff6>=_0x2a39b5){_0x448ff6=_0x2a39b5;_0x2c103c=0xc8;}else{_0x2c103c=0xce;}_0x4f82cb[_0x6957('0x1a')](_0x2c103c);return _0x4f82cb[_0x6957('0x1f')](_0x6957('0x20'),_0x49aa31+'-'+_0x448ff6+'/'+_0x2a39b5)[_0x6957('0x21')](_0x256ac7);}return null;};}function patchUpdates(_0x35ee5b){return function(_0x3081b2){try{jsonpatch['apply'](_0x3081b2,_0x35ee5b,!![]);}catch(_0x5ee3f8){return BPromise[_0x6957('0x22')](_0x5ee3f8);}return _0x3081b2[_0x6957('0x23')]();};}function saveUpdates(_0x18037f,_0x2569f4){return function(_0x3591fa){if(_0x3591fa){return _0x3591fa[_0x6957('0x24')](_0x18037f)[_0x6957('0x25')](function(_0x310a5e){return _0x310a5e;});}return null;};}function removeEntity(_0x56b0ba,_0x2b2dcd){return function(_0x3c9de7){if(_0x3c9de7){return _0x3c9de7[_0x6957('0x26')]()[_0x6957('0x25')](function(){_0x56b0ba['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa1e6af,_0x2a57b6){return function(_0x5c4e49){if(!_0x5c4e49){_0xa1e6af['sendStatus'](0x194);}return _0x5c4e49;};}function handleError(_0x320e7d,_0xa2f92f){_0xa2f92f=_0xa2f92f||0x1f4;return function(_0x3bc22f){logger['error'](_0x3bc22f[_0x6957('0x27')]);if(_0x3bc22f[_0x6957('0x28')]){delete _0x3bc22f[_0x6957('0x28')];}_0x320e7d[_0x6957('0x1a')](_0xa2f92f)[_0x6957('0x29')](_0x3bc22f);};}exports[_0x6957('0x2a')]=function(_0x2d33ef,_0x320e1a){var _0x595770={},_0x2e7fe1={},_0x3a6e07={'count':0x0,'rows':[]};var _0xd02a9=_[_0x6957('0x2b')](db[_0x6957('0x2c')][_0x6957('0x2d')],function(_0x3f8745){return{'name':_0x3f8745[_0x6957('0x2e')],'type':_0x3f8745[_0x6957('0x2f')][_0x6957('0x30')]};});_0x2e7fe1[_0x6957('0x31')]=_['map'](_0xd02a9,'name');_0x2e7fe1[_0x6957('0x32')]=_[_0x6957('0x33')](_0x2d33ef[_0x6957('0x32')]);_0x2e7fe1[_0x6957('0x34')]=_['intersection'](_0x2e7fe1[_0x6957('0x31')],_0x2e7fe1[_0x6957('0x32')]);_0x595770[_0x6957('0x35')]=_['intersection'](_0x2e7fe1['model'],qs[_0x6957('0x36')](_0x2d33ef[_0x6957('0x32')][_0x6957('0x36')]));_0x595770['attributes']=_0x595770[_0x6957('0x35')][_0x6957('0x37')]?_0x595770[_0x6957('0x35')]:_0x2e7fe1[_0x6957('0x31')];if(!_0x2d33ef[_0x6957('0x32')][_0x6957('0x38')](_0x6957('0x39'))){_0x595770[_0x6957('0x1d')]=qs[_0x6957('0x1d')](_0x2d33ef['query'][_0x6957('0x1d')]);_0x595770[_0x6957('0x1c')]=qs[_0x6957('0x1c')](_0x2d33ef['query']['offset']);}_0x595770['order']=qs[_0x6957('0x3a')](_0x2d33ef['query']['sort']);_0x595770[_0x6957('0x3b')]=qs[_0x6957('0x34')](_['pick'](_0x2d33ef['query'],_0x2e7fe1[_0x6957('0x34')]),_0xd02a9);if(_0x2d33ef[_0x6957('0x32')][_0x6957('0x3c')]){_0x595770[_0x6957('0x3b')]=_[_0x6957('0x3d')](_0x595770['where'],{'$or':_[_0x6957('0x2b')](_0xd02a9,function(_0x5c9be3){if(_0x5c9be3['type']!=='VIRTUAL'){var _0x5ab079={};_0x5ab079[_0x5c9be3['name']]={'$like':'%'+_0x2d33ef['query']['filter']+'%'};return _0x5ab079;}})});}_0x595770=_['merge']({},_0x595770,_0x2d33ef['options']);var _0x20caa3={'where':_0x595770[_0x6957('0x3b')]};return db[_0x6957('0x2c')][_0x6957('0x1e')](_0x20caa3)[_0x6957('0x25')](function(_0x51b189){_0x3a6e07[_0x6957('0x1e')]=_0x51b189;if(_0x2d33ef[_0x6957('0x32')]['includeAll']){_0x595770[_0x6957('0x3e')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x6957('0x3f')](_0x595770);})[_0x6957('0x25')](function(_0x22ec26){_0x3a6e07[_0x6957('0x40')]=_0x22ec26;return _0x3a6e07;})[_0x6957('0x25')](respondWithFilteredResult(_0x320e1a,_0x595770))[_0x6957('0x41')](handleError(_0x320e1a,null));};exports[_0x6957('0x42')]=function(_0x16575e,_0x18fb2a){var _0x35fa2d={'raw':!![],'where':{'id':_0x16575e[_0x6957('0x43')]['id']}},_0x421526={};_0x421526[_0x6957('0x31')]=_[_0x6957('0x33')](db[_0x6957('0x2c')][_0x6957('0x2d')]);_0x421526['query']=_[_0x6957('0x33')](_0x16575e['query']);_0x421526['filters']=_[_0x6957('0x44')](_0x421526['model'],_0x421526['query']);_0x35fa2d[_0x6957('0x35')]=_[_0x6957('0x44')](_0x421526[_0x6957('0x31')],qs[_0x6957('0x36')](_0x16575e[_0x6957('0x32')][_0x6957('0x36')]));_0x35fa2d[_0x6957('0x35')]=_0x35fa2d[_0x6957('0x35')][_0x6957('0x37')]?_0x35fa2d[_0x6957('0x35')]:_0x421526['model'];if(_0x16575e['query'][_0x6957('0x45')]){_0x35fa2d['include']=[{'all':!![]}];}_0x35fa2d=_[_0x6957('0x3d')]({},_0x35fa2d,_0x16575e[_0x6957('0x46')]);return db['JscriptyAnswerReport'][_0x6957('0x47')](_0x35fa2d)[_0x6957('0x25')](handleEntityNotFound(_0x18fb2a,null))[_0x6957('0x25')](respondWithResult(_0x18fb2a,null))[_0x6957('0x41')](handleError(_0x18fb2a,null));};exports[_0x6957('0x48')]=function(_0x497e99,_0x9763aa){return db[_0x6957('0x2c')][_0x6957('0x48')](_0x497e99[_0x6957('0x49')],{})['then'](respondWithResult(_0x9763aa,0xc9))[_0x6957('0x41')](handleError(_0x9763aa,null));};exports[_0x6957('0x24')]=function(_0x5c5d5b,_0x1768ba){if(_0x5c5d5b[_0x6957('0x49')]['id']){delete _0x5c5d5b[_0x6957('0x49')]['id'];}return db[_0x6957('0x2c')]['find']({'where':{'id':_0x5c5d5b['params']['id']}})[_0x6957('0x25')](handleEntityNotFound(_0x1768ba,null))[_0x6957('0x25')](saveUpdates(_0x5c5d5b[_0x6957('0x49')],null))[_0x6957('0x25')](respondWithResult(_0x1768ba,null))['catch'](handleError(_0x1768ba,null));};exports[_0x6957('0x26')]=function(_0x4ca6dc,_0x10fac5){return db['JscriptyAnswerReport'][_0x6957('0x47')]({'where':{'id':_0x4ca6dc['params']['id']}})[_0x6957('0x25')](handleEntityNotFound(_0x10fac5,null))['then'](removeEntity(_0x10fac5,null))['catch'](handleError(_0x10fac5,null));};exports[_0x6957('0x4a')]=function(_0x371e29,_0x38e917){return db[_0x6957('0x2c')][_0x6957('0x4a')]()[_0x6957('0x25')](respondWithResult(_0x38e917,null))[_0x6957('0x41')](handleError(_0x38e917,null));}; \ No newline at end of file +var _0x4873=['lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','name','send','index','rawAttributes','type','key','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','JscriptyAnswerReport','catch','show','model','fields','includeAll','find','create','body','destroy','params','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x4873,0x1df));var _0x3487=function(_0x189363,_0x5e71b9){_0x189363=_0x189363-0x0;var _0xce107d=_0x4873[_0x189363];return _0xce107d;};'use strict';var emlformat=require(_0x3487('0x0'));var rimraf=require(_0x3487('0x1'));var zipdir=require(_0x3487('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3487('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3487('0x4'));var util=require(_0x3487('0x5'));var path=require(_0x3487('0x6'));var sox=require(_0x3487('0x7'));var csv=require(_0x3487('0x8'));var ejs=require(_0x3487('0x9'));var fs=require('fs');var fs_extra=require(_0x3487('0xa'));var _=require(_0x3487('0xb'));var squel=require('squel');var crypto=require(_0x3487('0xc'));var jsforce=require(_0x3487('0xd'));var deskjs=require(_0x3487('0xe'));var toCsv=require(_0x3487('0x8'));var querystring=require(_0x3487('0xf'));var Papa=require('papaparse');var Redis=require(_0x3487('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3487('0x11'));var as=require(_0x3487('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3487('0x13'));var utils=require(_0x3487('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3487('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x557d64,_0x395774){_0x395774=_0x395774||0xcc;return function(_0x1be2e0){if(_0x1be2e0){return _0x557d64[_0x3487('0x16')](_0x395774);}return _0x557d64[_0x3487('0x17')](_0x395774)[_0x3487('0x18')]();};}function respondWithResult(_0x1e468b,_0x4fbd63){_0x4fbd63=_0x4fbd63||0xc8;return function(_0x23ce3b){if(_0x23ce3b){return _0x1e468b[_0x3487('0x17')](_0x4fbd63)[_0x3487('0x19')](_0x23ce3b);}};}function respondWithFilteredResult(_0x4f79f0,_0x156e80){return function(_0x1b19c4){if(_0x1b19c4){var _0x38c0c1=typeof _0x156e80[_0x3487('0x1a')]===_0x3487('0x1b')&&typeof _0x156e80[_0x3487('0x1c')]===_0x3487('0x1b');var _0x32ecde=_0x1b19c4[_0x3487('0x1d')];var _0x2fa630=_0x38c0c1?0x0:_0x156e80[_0x3487('0x1a')];var _0x41795b=_0x38c0c1?_0x1b19c4[_0x3487('0x1d')]:_0x156e80[_0x3487('0x1a')]+_0x156e80['limit'];var _0x320349;if(_0x41795b>=_0x32ecde){_0x41795b=_0x32ecde;_0x320349=0xc8;}else{_0x320349=0xce;}_0x4f79f0['status'](_0x320349);return _0x4f79f0[_0x3487('0x1e')](_0x3487('0x1f'),_0x2fa630+'-'+_0x41795b+'/'+_0x32ecde)[_0x3487('0x19')](_0x1b19c4);}return null;};}function patchUpdates(_0x29546f){return function(_0xd788f8){try{jsonpatch[_0x3487('0x20')](_0xd788f8,_0x29546f,!![]);}catch(_0x479354){return BPromise[_0x3487('0x21')](_0x479354);}return _0xd788f8[_0x3487('0x22')]();};}function saveUpdates(_0x28f8f7,_0x97013d){return function(_0x11437c){if(_0x11437c){return _0x11437c[_0x3487('0x23')](_0x28f8f7)['then'](function(_0x384792){return _0x384792;});}return null;};}function removeEntity(_0x3e63e8,_0x25ed9f){return function(_0x482551){if(_0x482551){return _0x482551['destroy']()[_0x3487('0x24')](function(){_0x3e63e8[_0x3487('0x17')](0xcc)[_0x3487('0x18')]();});}};}function handleEntityNotFound(_0x3a9d76,_0x4c6882){return function(_0x79a183){if(!_0x79a183){_0x3a9d76[_0x3487('0x16')](0x194);}return _0x79a183;};}function handleError(_0x5484f6,_0x1e7126){_0x1e7126=_0x1e7126||0x1f4;return function(_0x3fb245){logger['error'](_0x3fb245['stack']);if(_0x3fb245[_0x3487('0x25')]){delete _0x3fb245[_0x3487('0x25')];}_0x5484f6[_0x3487('0x17')](_0x1e7126)[_0x3487('0x26')](_0x3fb245);};}exports[_0x3487('0x27')]=function(_0x1a02d6,_0x1c5bd6){var _0x38af4a={},_0x25e123={},_0x4dada9={'count':0x0,'rows':[]};var _0x24532a=_['map'](db['JscriptyAnswerReport'][_0x3487('0x28')],function(_0x56ee54){return{'name':_0x56ee54['fieldName'],'type':_0x56ee54[_0x3487('0x29')][_0x3487('0x2a')]};});_0x25e123['model']=_['map'](_0x24532a,_0x3487('0x25'));_0x25e123[_0x3487('0x2b')]=_[_0x3487('0x2c')](_0x1a02d6['query']);_0x25e123[_0x3487('0x2d')]=_['intersection'](_0x25e123['model'],_0x25e123['query']);_0x38af4a[_0x3487('0x2e')]=_[_0x3487('0x2f')](_0x25e123['model'],qs['fields'](_0x1a02d6[_0x3487('0x2b')]['fields']));_0x38af4a['attributes']=_0x38af4a[_0x3487('0x2e')][_0x3487('0x30')]?_0x38af4a[_0x3487('0x2e')]:_0x25e123['model'];if(!_0x1a02d6[_0x3487('0x2b')][_0x3487('0x31')](_0x3487('0x32'))){_0x38af4a[_0x3487('0x1c')]=qs['limit'](_0x1a02d6[_0x3487('0x2b')][_0x3487('0x1c')]);_0x38af4a['offset']=qs[_0x3487('0x1a')](_0x1a02d6[_0x3487('0x2b')][_0x3487('0x1a')]);}_0x38af4a[_0x3487('0x33')]=qs[_0x3487('0x34')](_0x1a02d6[_0x3487('0x2b')][_0x3487('0x34')]);_0x38af4a[_0x3487('0x35')]=qs[_0x3487('0x2d')](_['pick'](_0x1a02d6[_0x3487('0x2b')],_0x25e123[_0x3487('0x2d')]),_0x24532a);if(_0x1a02d6['query']['filter']){_0x38af4a[_0x3487('0x35')]=_[_0x3487('0x36')](_0x38af4a[_0x3487('0x35')],{'$or':_['map'](_0x24532a,function(_0x58006c){if(_0x58006c['type']!==_0x3487('0x37')){var _0x268674={};_0x268674[_0x58006c['name']]={'$like':'%'+_0x1a02d6[_0x3487('0x2b')][_0x3487('0x38')]+'%'};return _0x268674;}})});}_0x38af4a=_[_0x3487('0x36')]({},_0x38af4a,_0x1a02d6[_0x3487('0x39')]);var _0x106393={'where':_0x38af4a[_0x3487('0x35')]};return db[_0x3487('0x3a')][_0x3487('0x1d')](_0x106393)[_0x3487('0x24')](function(_0x565cb2){_0x4dada9[_0x3487('0x1d')]=_0x565cb2;if(_0x1a02d6[_0x3487('0x2b')]['includeAll']){_0x38af4a['include']=[{'all':!![]}];}return db[_0x3487('0x3a')]['findAll'](_0x38af4a);})['then'](function(_0x3eb68c){_0x4dada9['rows']=_0x3eb68c;return _0x4dada9;})['then'](respondWithFilteredResult(_0x1c5bd6,_0x38af4a))[_0x3487('0x3b')](handleError(_0x1c5bd6,null));};exports[_0x3487('0x3c')]=function(_0x58a4c8,_0x51b69c){var _0xc04317={'raw':!![],'where':{'id':_0x58a4c8['params']['id']}},_0x8cd06f={};_0x8cd06f[_0x3487('0x3d')]=_[_0x3487('0x2c')](db['JscriptyAnswerReport'][_0x3487('0x28')]);_0x8cd06f[_0x3487('0x2b')]=_[_0x3487('0x2c')](_0x58a4c8['query']);_0x8cd06f[_0x3487('0x2d')]=_[_0x3487('0x2f')](_0x8cd06f[_0x3487('0x3d')],_0x8cd06f[_0x3487('0x2b')]);_0xc04317[_0x3487('0x2e')]=_[_0x3487('0x2f')](_0x8cd06f[_0x3487('0x3d')],qs[_0x3487('0x3e')](_0x58a4c8['query'][_0x3487('0x3e')]));_0xc04317[_0x3487('0x2e')]=_0xc04317[_0x3487('0x2e')][_0x3487('0x30')]?_0xc04317[_0x3487('0x2e')]:_0x8cd06f[_0x3487('0x3d')];if(_0x58a4c8[_0x3487('0x2b')][_0x3487('0x3f')]){_0xc04317['include']=[{'all':!![]}];}_0xc04317=_['merge']({},_0xc04317,_0x58a4c8[_0x3487('0x39')]);return db[_0x3487('0x3a')][_0x3487('0x40')](_0xc04317)[_0x3487('0x24')](handleEntityNotFound(_0x51b69c,null))['then'](respondWithResult(_0x51b69c,null))['catch'](handleError(_0x51b69c,null));};exports[_0x3487('0x41')]=function(_0x122456,_0x3fe91f){return db[_0x3487('0x3a')][_0x3487('0x41')](_0x122456[_0x3487('0x42')],{})[_0x3487('0x24')](respondWithResult(_0x3fe91f,0xc9))[_0x3487('0x3b')](handleError(_0x3fe91f,null));};exports['update']=function(_0x585a44,_0x320351){if(_0x585a44[_0x3487('0x42')]['id']){delete _0x585a44['body']['id'];}return db[_0x3487('0x3a')]['find']({'where':{'id':_0x585a44['params']['id']}})[_0x3487('0x24')](handleEntityNotFound(_0x320351,null))[_0x3487('0x24')](saveUpdates(_0x585a44['body'],null))[_0x3487('0x24')](respondWithResult(_0x320351,null))[_0x3487('0x3b')](handleError(_0x320351,null));};exports[_0x3487('0x43')]=function(_0x4ab5f8,_0x761f95){return db[_0x3487('0x3a')][_0x3487('0x40')]({'where':{'id':_0x4ab5f8[_0x3487('0x44')]['id']}})['then'](handleEntityNotFound(_0x761f95,null))[_0x3487('0x24')](removeEntity(_0x761f95,null))[_0x3487('0x3b')](handleError(_0x761f95,null));};exports[_0x3487('0x45')]=function(_0x33e826,_0x11125d){return db[_0x3487('0x3a')][_0x3487('0x45')]()['then'](respondWithResult(_0x11125d,null))[_0x3487('0x3b')](handleError(_0x11125d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index dc35edb..303e158 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 _0xc7e3=['../../config/environment','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','moment','bluebird','request-promise','path'];(function(_0x3986f3,_0x42e5fe){var _0xaea355=function(_0x2ffe89){while(--_0x2ffe89){_0x3986f3['push'](_0x3986f3['shift']());}};_0xaea355(++_0x42e5fe);}(_0xc7e3,0x89));var _0x3c7e=function(_0x4dded0,_0x3a4585){_0x4dded0=_0x4dded0-0x0;var _0x20002b=_0xc7e3[_0x4dded0];return _0x20002b;};'use strict';var _=require(_0x3c7e('0x0'));var util=require(_0x3c7e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3c7e('0x2'));var BPromise=require(_0x3c7e('0x3'));var rp=require(_0x3c7e('0x4'));var fs=require('fs');var path=require(_0x3c7e('0x5'));var rimraf=require('rimraf');var config=require(_0x3c7e('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x3c7e('0x7')]=function(_0x77a5ba,_0x51aec9){return _0x77a5ba[_0x3c7e('0x8')](_0x3c7e('0x9'),attributes,{'tableName':_0x3c7e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb27e=['define','JscriptyAnswerReport','report_jscripty_answers','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports'];(function(_0x50e540,_0x1bc892){var _0x2755db=function(_0x8b3b2c){while(--_0x8b3b2c){_0x50e540['push'](_0x50e540['shift']());}};_0x2755db(++_0x1bc892);}(_0xb27e,0xff));var _0xeb27=function(_0x177b14,_0x216d9b){_0x177b14=_0x177b14-0x0;var _0x275c61=_0xb27e[_0x177b14];return _0x275c61;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeb27('0x0'))(_0xeb27('0x1'));var moment=require(_0xeb27('0x2'));var BPromise=require(_0xeb27('0x3'));var rp=require(_0xeb27('0x4'));var fs=require('fs');var path=require(_0xeb27('0x5'));var rimraf=require(_0xeb27('0x6'));var config=require('../../config/environment');var attributes=require(_0xeb27('0x7'));module[_0xeb27('0x8')]=function(_0x356be4,_0x37592c){return _0x356be4[_0xeb27('0x9')](_0xeb27('0xa'),attributes,{'tableName':_0xeb27('0xb'),'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 2905200..147a272 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 _0x4df2=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','debug','request\x20sent','stringify','error','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x480e76,_0x4416c8){var _0x18d52a=function(_0x215bad){while(--_0x215bad){_0x480e76['push'](_0x480e76['shift']());}};_0x18d52a(++_0x4416c8);}(_0x4df2,0x176));var _0x24df=function(_0x82bc73,_0x1a5f4b){_0x82bc73=_0x82bc73-0x0;var _0x4e7c85=_0x4df2[_0x82bc73];return _0x4e7c85;};'use strict';var _=require(_0x24df('0x0'));var util=require(_0x24df('0x1'));var moment=require(_0x24df('0x2'));var BPromise=require(_0x24df('0x3'));var rs=require(_0x24df('0x4'));var fs=require('fs');var Redis=require(_0x24df('0x5'));var db=require(_0x24df('0x6'))['db'];var utils=require(_0x24df('0x7'));var logger=require('../../config/logger')(_0x24df('0x8'));var config=require(_0x24df('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x24df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2258bb,_0x260cb9,_0x360f16){return new BPromise(function(_0x50bfda,_0x17c1b7){return client[_0x24df('0xb')](_0x2258bb,_0x360f16)[_0x24df('0xc')](function(_0x406e7b){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x260cb9,'request\x20sent');logger[_0x24df('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x260cb9,_0x24df('0xe'),JSON[_0x24df('0xf')](_0x406e7b));if(_0x406e7b[_0x24df('0x10')]){if(_0x406e7b['error']['code']===0x1f4){logger[_0x24df('0x10')](_0x24df('0x11'),_0x260cb9,_0x406e7b[_0x24df('0x10')]['message']);return _0x17c1b7(_0x406e7b[_0x24df('0x10')][_0x24df('0x12')]);}logger[_0x24df('0x10')](_0x24df('0x11'),_0x260cb9,_0x406e7b[_0x24df('0x10')][_0x24df('0x12')]);return _0x50bfda(_0x406e7b[_0x24df('0x10')][_0x24df('0x12')]);}else{logger['info'](_0x24df('0x11'),_0x260cb9,'request\x20sent');_0x50bfda(_0x406e7b[_0x24df('0x13')][_0x24df('0x12')]);}})[_0x24df('0x14')](function(_0x219c51){logger[_0x24df('0x10')](_0x24df('0x11'),_0x260cb9,_0x219c51);_0x17c1b7(_0x219c51);});});} \ No newline at end of file +var _0xabb1=['request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0xabb1,0x161));var _0x1abb=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xabb1[_0x346737];return _0x1ade2e;};'use strict';var _=require('lodash');var util=require(_0x1abb('0x0'));var moment=require(_0x1abb('0x1'));var BPromise=require(_0x1abb('0x2'));var rs=require(_0x1abb('0x3'));var fs=require('fs');var Redis=require(_0x1abb('0x4'));var db=require(_0x1abb('0x5'))['db'];var utils=require(_0x1abb('0x6'));var logger=require(_0x1abb('0x7'))('rpc');var config=require(_0x1abb('0x8'));var jayson=require(_0x1abb('0x9'));var client=jayson[_0x1abb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f68b3,_0x598360,_0x4d1a39){return new BPromise(function(_0x4c8457,_0x3e8c50){return client[_0x1abb('0xb')](_0x2f68b3,_0x4d1a39)[_0x1abb('0xc')](function(_0x92627a){logger[_0x1abb('0xd')](_0x1abb('0xe'),_0x598360,_0x1abb('0xf'));logger[_0x1abb('0x10')](_0x1abb('0x11'),_0x598360,'request\x20sent',JSON[_0x1abb('0x12')](_0x92627a));if(_0x92627a['error']){if(_0x92627a[_0x1abb('0x13')]['code']===0x1f4){logger[_0x1abb('0x13')](_0x1abb('0xe'),_0x598360,_0x92627a[_0x1abb('0x13')][_0x1abb('0x14')]);return _0x3e8c50(_0x92627a['error'][_0x1abb('0x14')]);}logger[_0x1abb('0x13')](_0x1abb('0xe'),_0x598360,_0x92627a[_0x1abb('0x13')][_0x1abb('0x14')]);return _0x4c8457(_0x92627a[_0x1abb('0x13')][_0x1abb('0x14')]);}else{logger[_0x1abb('0xd')](_0x1abb('0xe'),_0x598360,_0x1abb('0xf'));_0x4c8457(_0x92627a[_0x1abb('0x15')]['message']);}})[_0x1abb('0x16')](function(_0x4f6a51){logger[_0x1abb('0x13')](_0x1abb('0xe'),_0x598360,_0x4f6a51);_0x3e8c50(_0x4f6a51);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 2506fea..1783372 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 _0x5835=['delete','/:id','destroy','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','create','/:id/clone','clone'];(function(_0x20cb20,_0x256051){var _0x2fcf4b=function(_0x26200b){while(--_0x26200b){_0x20cb20['push'](_0x20cb20['shift']());}};_0x2fcf4b(++_0x256051);}(_0x5835,0x145));var _0x5583=function(_0x318e86,_0x5e2629){_0x318e86=_0x318e86-0x0;var _0x4b8eb1=_0x5835[_0x318e86];return _0x4b8eb1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5583('0x0'));var timeout=require('connect-timeout');var express=require(_0x5583('0x1'));var router=express[_0x5583('0x2')]();var fs_extra=require(_0x5583('0x3'));var auth=require(_0x5583('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5583('0x5'));var controller=require(_0x5583('0x6'));router[_0x5583('0x7')]('/',auth[_0x5583('0x8')](),controller[_0x5583('0x9')]);router[_0x5583('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x5583('0xa')]);router[_0x5583('0x7')](_0x5583('0xb'),auth['isAuthenticated'](),controller[_0x5583('0xc')]);router['get'](_0x5583('0xd'),auth[_0x5583('0x8')](),controller[_0x5583('0xe')]);router[_0x5583('0x7')](_0x5583('0xf'),auth['isAuthenticated'](),timeout(_0x5583('0x10')),controller['getSummary']);router['post']('/',auth[_0x5583('0x8')](),controller[_0x5583('0x11')]);router['post'](_0x5583('0x12'),auth[_0x5583('0x8')](),controller[_0x5583('0x13')]);router['put']('/:id',auth[_0x5583('0x8')](),controller['update']);router[_0x5583('0x14')](_0x5583('0x15'),auth[_0x5583('0x8')](),controller[_0x5583('0x16')]);module['exports']=router; \ No newline at end of file +var _0x265f=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','/:id','isAuthenticated','getSessions','/:id/answers','getSummary','post','create','/:id/clone','put','delete','destroy'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x265f,0x121));var _0xf265=function(_0x5b674c,_0xc560b){_0x5b674c=_0x5b674c-0x0;var _0x3da567=_0x265f[_0x5b674c];return _0x3da567;};'use strict';var multer=require(_0xf265('0x0'));var util=require(_0xf265('0x1'));var path=require(_0xf265('0x2'));var timeout=require(_0xf265('0x3'));var express=require(_0xf265('0x4'));var router=express[_0xf265('0x5')]();var fs_extra=require(_0xf265('0x6'));var auth=require(_0xf265('0x7'));var interaction=require(_0xf265('0x8'));var config=require(_0xf265('0x9'));var controller=require(_0xf265('0xa'));router[_0xf265('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf265('0xb')](_0xf265('0xc'),auth[_0xf265('0xd')](),controller['show']);router[_0xf265('0xb')]('/:id/sessions',auth['isAuthenticated'](),controller[_0xf265('0xe')]);router['get'](_0xf265('0xf'),auth[_0xf265('0xd')](),controller['getAnswers']);router[_0xf265('0xb')]('/:id/summary',auth[_0xf265('0xd')](),timeout('30s'),controller[_0xf265('0x10')]);router[_0xf265('0x11')]('/',auth['isAuthenticated'](),controller[_0xf265('0x12')]);router[_0xf265('0x11')](_0xf265('0x13'),auth['isAuthenticated'](),controller['clone']);router[_0xf265('0x14')](_0xf265('0xc'),auth[_0xf265('0xd')](),controller['update']);router[_0xf265('0x15')](_0xf265('0xc'),auth[_0xf265('0xd')](),controller[_0xf265('0x16')]);module[_0xf265('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index c67334a..b5af27e 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 _0x01b4=['{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash','STRING','name','TEXT','setDataValue','formData','stringify','format'];(function(_0x16dbfd,_0x2f9431){var _0x382254=function(_0x19dade){while(--_0x19dade){_0x16dbfd['push'](_0x16dbfd['shift']());}};_0x382254(++_0x2f9431);}(_0x01b4,0x1e4));var _0x401b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x01b4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var _=require(_0x401b('0x0'));var util=require('util');module['exports']={'name':{'type':Sequelize[_0x401b('0x1')],'unique':_0x401b('0x2')},'description':{'type':Sequelize[_0x401b('0x1')]},'formData':{'type':Sequelize[_0x401b('0x3')]('long'),'set':function(_0x53f02a){if(_['isObjectLike'](_0x53f02a)){this[_0x401b('0x4')](_0x401b('0x5'),JSON[_0x401b('0x6')](_0x53f02a));}else if(_['isString'](_0x53f02a)){this[_0x401b('0x4')](_0x401b('0x5'),_0x53f02a);}else{this[_0x401b('0x4')]('formData',util[_0x401b('0x7')](_0x401b('0x8'),this[_0x401b('0x9')]('name')||'',this[_0x401b('0x9')](_0x401b('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x401b('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x401b('0xb')],'defaultValue':![]}}; \ No newline at end of file +var _0x9a9f=['isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','STRING','name','TEXT','isObjectLike','setDataValue','formData','stringify'];(function(_0x49b720,_0x10e9f2){var _0x290c1b=function(_0x3d056a){while(--_0x3d056a){_0x49b720['push'](_0x49b720['shift']());}};_0x290c1b(++_0x10e9f2);}(_0x9a9f,0xb6));var _0xf9a9=function(_0x455753,_0x247ae2){_0x455753=_0x455753-0x0;var _0x316806=_0x9a9f[_0x455753];return _0x316806;};'use strict';var Sequelize=require(_0xf9a9('0x0'));var _=require(_0xf9a9('0x1'));var util=require(_0xf9a9('0x2'));module['exports']={'name':{'type':Sequelize[_0xf9a9('0x3')],'unique':_0xf9a9('0x4')},'description':{'type':Sequelize[_0xf9a9('0x3')]},'formData':{'type':Sequelize[_0xf9a9('0x5')]('long'),'set':function(_0x5ce2ec){if(_[_0xf9a9('0x6')](_0x5ce2ec)){this[_0xf9a9('0x7')](_0xf9a9('0x8'),JSON[_0xf9a9('0x9')](_0x5ce2ec));}else if(_[_0xf9a9('0xa')](_0x5ce2ec)){this['setDataValue'](_0xf9a9('0x8'),_0x5ce2ec);}else{this[_0xf9a9('0x7')](_0xf9a9('0x8'),util[_0xf9a9('0xb')](_0xf9a9('0xc'),this[_0xf9a9('0xd')](_0xf9a9('0x4'))||'',this[_0xf9a9('0xd')](_0xf9a9('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xf9a9('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 6180524..d0d1f33 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 _0xb2a6=['question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','questionId','answer','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Jscripty_Project_%d_Summary_%s.csv','setHeader','text/csv','download','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','update','destroy','then','get','Projects','UserProfileResource','stack','name','send','index','map','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','JscriptyProject','include','rows','params','rawAttributes','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','catch','error','clone','omit','createdAt','body','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','order','findAll','JscriptyAnswerReport','ProjectId','number','apply','toString','indexOf','replace','getSummary','startTime'];(function(_0x49783e,_0x1e1733){var _0x47290e=function(_0x31c8f4){while(--_0x31c8f4){_0x49783e['push'](_0x49783e['shift']());}};_0x47290e(++_0x1e1733);}(_0xb2a6,0xf0));var _0x6b2a=function(_0x3140a9,_0xc24b35){_0x3140a9=_0x3140a9-0x0;var _0x32ac53=_0xb2a6[_0x3140a9];return _0x32ac53;};'use strict';var emlformat=require(_0x6b2a('0x0'));var rimraf=require(_0x6b2a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b2a('0x2'));var rp=require('request-promise');var moment=require(_0x6b2a('0x3'));var BPromise=require(_0x6b2a('0x4'));var Mustache=require(_0x6b2a('0x5'));var util=require(_0x6b2a('0x6'));var path=require(_0x6b2a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b2a('0x8'));var _=require(_0x6b2a('0x9'));var squel=require(_0x6b2a('0xa'));var crypto=require(_0x6b2a('0xb'));var jsforce=require(_0x6b2a('0xc'));var deskjs=require(_0x6b2a('0xd'));var toCsv=require(_0x6b2a('0xe'));var querystring=require(_0x6b2a('0xf'));var Papa=require('papaparse');var Redis=require(_0x6b2a('0x10'));var authService=require(_0x6b2a('0x11'));var qs=require(_0x6b2a('0x12'));var as=require(_0x6b2a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b2a('0x14'))(_0x6b2a('0x15'));var utils=require(_0x6b2a('0x16'));var config=require(_0x6b2a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b2a('0x18'))['db'];function respondWithStatusCode(_0x2e8f05,_0x57047a){_0x57047a=_0x57047a||0xcc;return function(_0x461c95){if(_0x461c95){return _0x2e8f05[_0x6b2a('0x19')](_0x57047a);}return _0x2e8f05[_0x6b2a('0x1a')](_0x57047a)[_0x6b2a('0x1b')]();};}function respondWithResult(_0xb6c388,_0x246f92){_0x246f92=_0x246f92||0xc8;return function(_0x1ad2b1){if(_0x1ad2b1){return _0xb6c388['status'](_0x246f92)[_0x6b2a('0x1c')](_0x1ad2b1);}};}function respondWithFilteredResult(_0x261727,_0x20c428){return function(_0xd8c0f3){if(_0xd8c0f3){var _0x1f4d73=typeof _0x20c428['offset']==='undefined'&&typeof _0x20c428[_0x6b2a('0x1d')]===_0x6b2a('0x1e');var _0x3579a0=_0xd8c0f3[_0x6b2a('0x1f')];var _0x10b26e=_0x1f4d73?0x0:_0x20c428[_0x6b2a('0x20')];var _0x5c0788=_0x1f4d73?_0xd8c0f3['count']:_0x20c428[_0x6b2a('0x20')]+_0x20c428['limit'];var _0xfe576e;if(_0x5c0788>=_0x3579a0){_0x5c0788=_0x3579a0;_0xfe576e=0xc8;}else{_0xfe576e=0xce;}_0x261727[_0x6b2a('0x1a')](_0xfe576e);return _0x261727['set'](_0x6b2a('0x21'),_0x10b26e+'-'+_0x5c0788+'/'+_0x3579a0)[_0x6b2a('0x1c')](_0xd8c0f3);}return null;};}function patchUpdates(_0x9a61d8){return function(_0x180726){try{jsonpatch['apply'](_0x180726,_0x9a61d8,!![]);}catch(_0x166662){return BPromise[_0x6b2a('0x22')](_0x166662);}return _0x180726['save']();};}function saveUpdates(_0x32fa10,_0x5ebf6a){return function(_0x2fbfd8){if(_0x2fbfd8){return _0x2fbfd8[_0x6b2a('0x23')](_0x32fa10)['then'](function(_0x3b4bd3){return _0x3b4bd3;});}return null;};}function removeEntity(_0x373d24,_0x5b669f){return function(_0x30e47c){if(_0x30e47c){return _0x30e47c[_0x6b2a('0x24')]()[_0x6b2a('0x25')](function(){var _0x1d92ad=_0x30e47c[_0x6b2a('0x26')]({'plain':!![]});var _0x2284a3=_0x6b2a('0x27');return db[_0x6b2a('0x28')][_0x6b2a('0x24')]({'where':{'type':_0x2284a3,'resourceId':_0x1d92ad['id']}})[_0x6b2a('0x25')](function(){return _0x30e47c;});})[_0x6b2a('0x25')](function(){_0x373d24[_0x6b2a('0x1a')](0xcc)[_0x6b2a('0x1b')]();});}};}function handleEntityNotFound(_0x193e5a,_0xd01fdc){return function(_0x1b51f0){if(!_0x1b51f0){_0x193e5a[_0x6b2a('0x19')](0x194);}return _0x1b51f0;};}function handleError(_0x5acbbf,_0x97b9b2){_0x97b9b2=_0x97b9b2||0x1f4;return function(_0x470684){logger['error'](_0x470684[_0x6b2a('0x29')]);if(_0x470684['name']){delete _0x470684[_0x6b2a('0x2a')];}_0x5acbbf[_0x6b2a('0x1a')](_0x97b9b2)[_0x6b2a('0x2b')](_0x470684);};}exports[_0x6b2a('0x2c')]=function(_0x321103,_0x16e871){var _0xbd7951={},_0x9faacb={},_0x2e768a={'count':0x0,'rows':[]};var _0x13b0df=_[_0x6b2a('0x2d')](db['JscriptyProject']['rawAttributes'],function(_0x14879b){return{'name':_0x14879b[_0x6b2a('0x2e')],'type':_0x14879b[_0x6b2a('0x2f')]['key']};});_0x9faacb['model']=_[_0x6b2a('0x2d')](_0x13b0df,_0x6b2a('0x2a'));_0x9faacb[_0x6b2a('0x30')]=_[_0x6b2a('0x31')](_0x321103[_0x6b2a('0x30')]);_0x9faacb[_0x6b2a('0x32')]=_[_0x6b2a('0x33')](_0x9faacb[_0x6b2a('0x34')],_0x9faacb[_0x6b2a('0x30')]);_0xbd7951[_0x6b2a('0x35')]=_[_0x6b2a('0x33')](_0x9faacb[_0x6b2a('0x34')],qs[_0x6b2a('0x36')](_0x321103[_0x6b2a('0x30')][_0x6b2a('0x36')]));_0xbd7951['attributes']=_0xbd7951[_0x6b2a('0x35')][_0x6b2a('0x37')]?_0xbd7951[_0x6b2a('0x35')]:_0x9faacb['model'];if(!_0x321103[_0x6b2a('0x30')][_0x6b2a('0x38')](_0x6b2a('0x39'))){_0xbd7951['limit']=qs[_0x6b2a('0x1d')](_0x321103[_0x6b2a('0x30')][_0x6b2a('0x1d')]);_0xbd7951['offset']=qs['offset'](_0x321103['query']['offset']);}_0xbd7951['order']=qs[_0x6b2a('0x3a')](_0x321103['query'][_0x6b2a('0x3a')]);_0xbd7951[_0x6b2a('0x3b')]=qs[_0x6b2a('0x32')](_[_0x6b2a('0x3c')](_0x321103['query'],_0x9faacb[_0x6b2a('0x32')]),_0x13b0df);if(_0x321103[_0x6b2a('0x30')][_0x6b2a('0x3d')]){_0xbd7951[_0x6b2a('0x3b')]=_[_0x6b2a('0x3e')](_0xbd7951['where'],{'$or':_['map'](_0x13b0df,function(_0x486ce9){if(_0x486ce9[_0x6b2a('0x2f')]!=='VIRTUAL'){var _0x2d38de={};_0x2d38de[_0x486ce9[_0x6b2a('0x2a')]]={'$like':'%'+_0x321103[_0x6b2a('0x30')]['filter']+'%'};return _0x2d38de;}})});}_0xbd7951=_['merge']({},_0xbd7951,_0x321103['options']);var _0x5e9b37={'where':_0xbd7951[_0x6b2a('0x3b')]};return db[_0x6b2a('0x3f')][_0x6b2a('0x1f')](_0x5e9b37)['then'](function(_0x4a83e3){_0x2e768a[_0x6b2a('0x1f')]=_0x4a83e3;if(_0x321103['query']['includeAll']){_0xbd7951[_0x6b2a('0x40')]=[{'all':!![]}];}return db[_0x6b2a('0x3f')]['findAll'](_0xbd7951);})[_0x6b2a('0x25')](function(_0x18e96f){_0x2e768a[_0x6b2a('0x41')]=_0x18e96f;return _0x2e768a;})[_0x6b2a('0x25')](respondWithFilteredResult(_0x16e871,_0xbd7951))['catch'](handleError(_0x16e871,null));};exports['show']=function(_0x5f3cb2,_0x593ab3){var _0x2bd678={'raw':![],'where':{'id':_0x5f3cb2[_0x6b2a('0x42')]['id']}},_0x4db482={};_0x4db482['model']=_[_0x6b2a('0x31')](db[_0x6b2a('0x3f')][_0x6b2a('0x43')]);_0x4db482[_0x6b2a('0x30')]=_[_0x6b2a('0x31')](_0x5f3cb2['query']);_0x4db482[_0x6b2a('0x32')]=_[_0x6b2a('0x33')](_0x4db482[_0x6b2a('0x34')],_0x4db482[_0x6b2a('0x30')]);_0x2bd678[_0x6b2a('0x35')]=_[_0x6b2a('0x33')](_0x4db482[_0x6b2a('0x34')],qs[_0x6b2a('0x36')](_0x5f3cb2[_0x6b2a('0x30')][_0x6b2a('0x36')]));_0x2bd678[_0x6b2a('0x35')]=_0x2bd678[_0x6b2a('0x35')]['length']?_0x2bd678[_0x6b2a('0x35')]:_0x4db482[_0x6b2a('0x34')];if(_0x5f3cb2[_0x6b2a('0x30')][_0x6b2a('0x44')]){_0x2bd678['include']=[{'all':!![]}];}_0x2bd678=_[_0x6b2a('0x3e')]({},_0x2bd678,_0x5f3cb2[_0x6b2a('0x45')]);return db[_0x6b2a('0x3f')][_0x6b2a('0x46')](_0x2bd678)[_0x6b2a('0x25')](handleEntityNotFound(_0x593ab3,null))[_0x6b2a('0x25')](respondWithResult(_0x593ab3,null))['catch'](handleError(_0x593ab3,null));};exports[_0x6b2a('0x47')]=function(_0x123a25,_0x2818eb){return db[_0x6b2a('0x3f')][_0x6b2a('0x47')](_0x123a25['body'],{})[_0x6b2a('0x25')](function(_0x23ae55){var _0x2fb896=_0x123a25[_0x6b2a('0x48')][_0x6b2a('0x26')]({'plain':!![]});if(!_0x2fb896)throw new Error(_0x6b2a('0x49'));if(_0x2fb896['role']===_0x6b2a('0x48')){var _0x5474b6=_0x23ae55[_0x6b2a('0x26')]({'plain':!![]});var _0x4560b6='Projects';return db[_0x6b2a('0x4a')][_0x6b2a('0x46')]({'where':{'name':_0x4560b6,'userProfileId':_0x2fb896['userProfileId']},'raw':!![]})[_0x6b2a('0x25')](function(_0x7c59cc){if(_0x7c59cc&&_0x7c59cc[_0x6b2a('0x4b')]===0x0){return db[_0x6b2a('0x28')][_0x6b2a('0x47')]({'name':_0x5474b6[_0x6b2a('0x2a')],'resourceId':_0x5474b6['id'],'type':_0x7c59cc['name'],'sectionId':_0x7c59cc['id']},{})['then'](function(){return _0x23ae55;});}else{return _0x23ae55;}})[_0x6b2a('0x4c')](function(_0x47e192){logger[_0x6b2a('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47e192);throw _0x47e192;});}return _0x23ae55;})[_0x6b2a('0x25')](respondWithResult(_0x2818eb,0xc9))[_0x6b2a('0x4c')](handleError(_0x2818eb,null));};exports[_0x6b2a('0x4e')]=function(_0x523551,_0x58f45d){var _0x9f1d88={'where':{'id':_0x523551[_0x6b2a('0x42')]['id']}},_0x6bc801={};_0x6bc801['model']=_[_0x6b2a('0x31')](db[_0x6b2a('0x3f')][_0x6b2a('0x43')]);_0x9f1d88[_0x6b2a('0x35')]=_[_0x6b2a('0x33')](_0x6bc801['model'],qs[_0x6b2a('0x36')](_0x523551[_0x6b2a('0x30')][_0x6b2a('0x36')]));_0x9f1d88[_0x6b2a('0x35')]=_0x9f1d88[_0x6b2a('0x35')][_0x6b2a('0x37')]?_0x9f1d88[_0x6b2a('0x35')]:_0x6bc801[_0x6b2a('0x34')];if(_0x523551[_0x6b2a('0x30')]['includeAll']){_0x9f1d88[_0x6b2a('0x40')]=[{'all':!![]}];}_0x9f1d88=_[_0x6b2a('0x3e')]({},_0x9f1d88,_0x523551[_0x6b2a('0x45')]);return db[_0x6b2a('0x3f')][_0x6b2a('0x46')](_0x9f1d88)[_0x6b2a('0x25')](handleEntityNotFound(_0x58f45d,null))[_0x6b2a('0x25')](function(_0x1e8a80){if(_0x1e8a80){var _0x273843=_0x1e8a80[_0x6b2a('0x26')]({'plain':!![]});_0x273843=qs[_0x6b2a('0x4f')](_0x273843,['id',_0x6b2a('0x50'),'updatedAt']);_0x523551[_0x6b2a('0x51')]=_['omit'](_0x523551['body'],['id',_0x6b2a('0x50'),'updatedAt']);return db['JscriptyProject']['create'](_[_0x6b2a('0x3e')](_0x273843,_0x523551['body']),{'include':_0x523551[_0x6b2a('0x30')]['includeAll']?[{'all':!![]}]:undefined})[_0x6b2a('0x25')](function(_0x4131c9){var _0x342caa=_0x523551[_0x6b2a('0x48')]['get']({'plain':!![]});if(!_0x342caa)throw new Error(_0x6b2a('0x49'));if(_0x342caa[_0x6b2a('0x52')]==='user'){var _0x454cdb=_0x4131c9[_0x6b2a('0x26')]({'plain':!![]});var _0x5965cb='Projects';return db[_0x6b2a('0x4a')]['find']({'where':{'name':_0x5965cb,'userProfileId':_0x342caa[_0x6b2a('0x53')]},'raw':!![]})[_0x6b2a('0x25')](function(_0x3a31b2){if(_0x3a31b2&&_0x3a31b2[_0x6b2a('0x4b')]===0x0){return db['UserProfileResource'][_0x6b2a('0x47')]({'name':_0x454cdb[_0x6b2a('0x2a')],'resourceId':_0x454cdb['id'],'type':_0x3a31b2[_0x6b2a('0x2a')],'sectionId':_0x3a31b2['id']},{})[_0x6b2a('0x25')](function(){return _0x4131c9;});}else{return _0x4131c9;}})[_0x6b2a('0x4c')](function(_0xb458a2){logger[_0x6b2a('0x4d')](_0x6b2a('0x54'),_0xb458a2);throw _0xb458a2;});}return _0x4131c9;});}})[_0x6b2a('0x25')](respondWithResult(_0x58f45d,0xc9))[_0x6b2a('0x4c')](handleError(_0x58f45d,null));};exports[_0x6b2a('0x23')]=function(_0x550d80,_0x925c89){if(_0x550d80[_0x6b2a('0x51')]['id']){delete _0x550d80[_0x6b2a('0x51')]['id'];}return db[_0x6b2a('0x3f')][_0x6b2a('0x46')]({'where':{'id':_0x550d80[_0x6b2a('0x42')]['id']}})[_0x6b2a('0x25')](handleEntityNotFound(_0x925c89,null))['then'](saveUpdates(_0x550d80[_0x6b2a('0x51')],null))[_0x6b2a('0x25')](respondWithResult(_0x925c89,null))[_0x6b2a('0x4c')](handleError(_0x925c89,null));};exports[_0x6b2a('0x24')]=function(_0x36a29b,_0x414612){return db[_0x6b2a('0x3f')][_0x6b2a('0x46')]({'where':{'id':_0x36a29b['params']['id']}})[_0x6b2a('0x25')](handleEntityNotFound(_0x414612,null))['then'](removeEntity(_0x414612,null))[_0x6b2a('0x4c')](handleError(_0x414612,null));};exports[_0x6b2a('0x55')]=function(_0x33c024,_0x5cd3f6,_0xd5b529){var _0x29c092={'raw':!![],'where':{}};var _0x324982={};var _0x367366={'count':0x0,'rows':[]};return db[_0x6b2a('0x3f')][_0x6b2a('0x56')]({'where':{'id':_0x33c024[_0x6b2a('0x42')]['id']}})['then'](handleEntityNotFound(_0x5cd3f6,null))[_0x6b2a('0x25')](function(_0x5b3e87){if(_0x5b3e87){_0x324982[_0x6b2a('0x34')]=_[_0x6b2a('0x31')](db[_0x6b2a('0x57')]['rawAttributes']);_0x324982[_0x6b2a('0x30')]=_[_0x6b2a('0x31')](_0x33c024[_0x6b2a('0x30')]);_0x324982[_0x6b2a('0x32')]=_[_0x6b2a('0x33')](_0x324982[_0x6b2a('0x34')],_0x324982['query']);_0x29c092[_0x6b2a('0x35')]=_['intersection'](_0x324982[_0x6b2a('0x34')],qs[_0x6b2a('0x36')](_0x33c024['query']['fields']));_0x29c092[_0x6b2a('0x35')]=_0x29c092[_0x6b2a('0x35')][_0x6b2a('0x37')]?_0x29c092['attributes']:_0x324982['model'];if(!_0x33c024[_0x6b2a('0x30')][_0x6b2a('0x38')](_0x6b2a('0x39'))){_0x29c092[_0x6b2a('0x1d')]=qs[_0x6b2a('0x1d')](_0x33c024[_0x6b2a('0x30')][_0x6b2a('0x1d')]);_0x29c092[_0x6b2a('0x20')]=qs[_0x6b2a('0x20')](_0x33c024[_0x6b2a('0x30')][_0x6b2a('0x20')]);}_0x29c092[_0x6b2a('0x58')]=qs[_0x6b2a('0x3a')](_0x33c024[_0x6b2a('0x30')]['sort']);_0x29c092[_0x6b2a('0x3b')]=qs['filters'](_[_0x6b2a('0x3c')](_0x33c024[_0x6b2a('0x30')],_0x324982['filters']));_0x29c092[_0x6b2a('0x3b')]['ProjectId']=_0x5b3e87['id'];if(_0x33c024['query']['filter']){_0x29c092['where']=_['merge'](_0x29c092[_0x6b2a('0x3b')],{'$or':_[_0x6b2a('0x2d')](_0x29c092[_0x6b2a('0x35')],function(_0xd984f9){var _0xd6ac23={};_0xd6ac23[_0xd984f9]={'$like':'%'+_0x33c024[_0x6b2a('0x30')][_0x6b2a('0x3d')]+'%'};return _0xd6ac23;})});}_0x29c092=_[_0x6b2a('0x3e')]({},_0x29c092,_0x33c024[_0x6b2a('0x45')]);return db['JscriptySessionReport'][_0x6b2a('0x1f')]({'where':_0x29c092[_0x6b2a('0x3b')]})[_0x6b2a('0x25')](function(_0x1babf4){_0x367366[_0x6b2a('0x1f')]=_0x1babf4;if(_0x33c024[_0x6b2a('0x30')][_0x6b2a('0x44')]){_0x29c092['include']=[{'all':!![]}];}return db[_0x6b2a('0x57')][_0x6b2a('0x59')](_0x29c092);})[_0x6b2a('0x25')](function(_0x5b3919){_0x367366[_0x6b2a('0x41')]=_0x5b3919;return _0x367366;});}})[_0x6b2a('0x25')](respondWithFilteredResult(_0x5cd3f6,_0x29c092))['catch'](handleError(_0x5cd3f6,null));};exports['getAnswers']=function(_0x116519,_0x3624ed,_0x47317f){var _0x2cfaf5={'raw':!![],'where':{}};var _0x1a5810={};var _0x3dc7a1={'count':0x0,'rows':[]};return db[_0x6b2a('0x3f')]['findOne']({'where':{'id':_0x116519[_0x6b2a('0x42')]['id']}})['then'](handleEntityNotFound(_0x3624ed,null))[_0x6b2a('0x25')](function(_0x2335dc){if(_0x2335dc){_0x1a5810[_0x6b2a('0x34')]=_[_0x6b2a('0x31')](db[_0x6b2a('0x5a')][_0x6b2a('0x43')]);_0x1a5810[_0x6b2a('0x30')]=_[_0x6b2a('0x31')](_0x116519[_0x6b2a('0x30')]);_0x1a5810[_0x6b2a('0x32')]=_[_0x6b2a('0x33')](_0x1a5810['model'],_0x1a5810[_0x6b2a('0x30')]);_0x2cfaf5[_0x6b2a('0x35')]=_[_0x6b2a('0x33')](_0x1a5810[_0x6b2a('0x34')],qs[_0x6b2a('0x36')](_0x116519[_0x6b2a('0x30')]['fields']));_0x2cfaf5[_0x6b2a('0x35')]=_0x2cfaf5['attributes'][_0x6b2a('0x37')]?_0x2cfaf5[_0x6b2a('0x35')]:_0x1a5810['model'];if(!_0x116519['query'][_0x6b2a('0x38')]('nolimit')){_0x2cfaf5['limit']=qs[_0x6b2a('0x1d')](_0x116519[_0x6b2a('0x30')][_0x6b2a('0x1d')]);_0x2cfaf5[_0x6b2a('0x20')]=qs[_0x6b2a('0x20')](_0x116519[_0x6b2a('0x30')][_0x6b2a('0x20')]);}_0x2cfaf5['order']=qs['sort'](_0x116519[_0x6b2a('0x30')][_0x6b2a('0x3a')]);_0x2cfaf5[_0x6b2a('0x3b')]=qs[_0x6b2a('0x32')](_['pick'](_0x116519[_0x6b2a('0x30')],_0x1a5810[_0x6b2a('0x32')]));_0x2cfaf5[_0x6b2a('0x3b')][_0x6b2a('0x5b')]=_0x2335dc['id'];if(_0x116519[_0x6b2a('0x30')]['filter']){_0x2cfaf5[_0x6b2a('0x3b')]=_[_0x6b2a('0x3e')](_0x2cfaf5['where'],{'$or':_[_0x6b2a('0x2d')](_0x2cfaf5[_0x6b2a('0x35')],function(_0x1895a5){var _0x1509ca={};_0x1509ca[_0x1895a5]={'$like':'%'+_0x116519['query']['filter']+'%'};return _0x1509ca;})});}_0x2cfaf5=_[_0x6b2a('0x3e')]({},_0x2cfaf5,_0x116519[_0x6b2a('0x45')]);return db['JscriptyAnswerReport'][_0x6b2a('0x1f')]({'where':_0x2cfaf5[_0x6b2a('0x3b')]})[_0x6b2a('0x25')](function(_0x20992c){_0x3dc7a1[_0x6b2a('0x1f')]=_0x20992c;if(_0x116519['query'][_0x6b2a('0x44')]){_0x2cfaf5[_0x6b2a('0x40')]=[{'all':!![]}];}return db[_0x6b2a('0x5a')][_0x6b2a('0x59')](_0x2cfaf5);})['then'](function(_0x1a8790){_0x3dc7a1[_0x6b2a('0x41')]=_0x1a8790;return _0x3dc7a1;});}})[_0x6b2a('0x25')](respondWithFilteredResult(_0x3624ed,_0x2cfaf5))[_0x6b2a('0x4c')](handleError(_0x3624ed,null));};function char(_0x13979d){return _0x6b2a('0x5c')===typeof _0x13979d?String['fromCharCode'][_0x6b2a('0x5d')](null,arguments):_0x13979d;}function needsEncapsulation(_0x342d55){return!!_0x342d55&&(_0x342d55[_0x6b2a('0x5e')]()['indexOf'](char(0xd))>=0x0||_0x342d55[_0x6b2a('0x5e')]()[_0x6b2a('0x5f')](char(0xa))>=0x0||_0x342d55[_0x6b2a('0x5e')]()[_0x6b2a('0x5f')](char(0x2c))>=0x0||_0x342d55[_0x6b2a('0x5e')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x2b7e83){var _0x14f42f=char(0x22),_0x1363a0='\x5c'+char(0x22),_0x4db402=_0x2b7e83[_0x6b2a('0x5e')]()[_0x6b2a('0x60')](new RegExp(_0x14f42f,'g'),_0x1363a0);return _0x14f42f+_0x4db402+_0x14f42f;}exports[_0x6b2a('0x61')]=function(_0x541d71,_0x224691,_0x1a681b){var _0x54ce29,_0x3bc69e;var _0x5292de={'where':{'ProjectId':_0x541d71[_0x6b2a('0x42')]['id']}};if(_0x541d71[_0x6b2a('0x30')][_0x6b2a('0x62')]){_0x5292de['where']['starttime']=JSON['parse'](_0x541d71['query']['startTime']);}return db['JscriptySessionReport'][_0x6b2a('0x59')](_0x5292de)['then'](handleEntityNotFound(_0x224691,null))[_0x6b2a('0x25')](function(_0x43aa74){if(_0x43aa74){_0x54ce29=_0x43aa74;return db['JscriptyQuestionReport'][_0x6b2a('0x59')]({'where':{'SessionId':{'$in':_['map'](_0x54ce29,'id')},'ProjectId':_0x541d71['params']['id']},'order':'-createdAt'});}})[_0x6b2a('0x25')](handleEntityNotFound(_0x224691,null))[_0x6b2a('0x25')](function(_0xfe59f7){if(_0xfe59f7){_0x3bc69e=_0xfe59f7;var _0x14e4bb={};for(var _0xd3f372=0x0,_0x32e52e=_0x3bc69e[_0x6b2a('0x37')];_0xd3f372<_0x32e52e;_0xd3f372++){if(!_0x14e4bb[_0x6b2a('0x38')](_0x3bc69e[_0xd3f372]['questionId'])){_0x14e4bb[_0x3bc69e[_0xd3f372]['questionId']]=needsEncapsulation(_0x3bc69e[_0xd3f372][_0x6b2a('0x63')])?encapsulate(_0x3bc69e[_0xd3f372][_0x6b2a('0x63')]):_0x3bc69e[_0xd3f372][_0x6b2a('0x63')];}}var _0x1b94f0=[],_0xbb57a0={};for(var _0x5b2e2f=0x0,_0x2c18c7=_0x54ce29[_0x6b2a('0x37')];_0x5b2e2f<_0x2c18c7;_0x5b2e2f++){_0xbb57a0={'ProjectId':_0x541d71[_0x6b2a('0x42')]['id'],'SessionId':_0x54ce29[_0x5b2e2f]['id'],'StartTime':moment(_0x54ce29[_0x5b2e2f][_0x6b2a('0x64')])[_0x6b2a('0x65')](_0x6b2a('0x66'))};for(var _0x338ce6=0x0,_0x32c000=_0x3bc69e[_0x6b2a('0x37')];_0x338ce6<_0x32c000;_0x338ce6++){if(_0x3bc69e[_0x338ce6][_0x6b2a('0x67')]==_0x54ce29[_0x5b2e2f]['id']&&_0x14e4bb[_0x6b2a('0x38')](_0x3bc69e[_0x338ce6][_0x6b2a('0x68')])){_0xbb57a0[_0x14e4bb[_0x3bc69e[_0x338ce6][_0x6b2a('0x68')]]]=_0x3bc69e[_0x338ce6][_0x6b2a('0x69')];}}for(var _0x3be469 in _0x14e4bb){if(!_0xbb57a0[_0x6b2a('0x38')](_0x14e4bb[_0x3be469])){_0xbb57a0[_0x14e4bb[_0x3be469]]=null;}}_0x1b94f0['push'](_0xbb57a0);}return _0x1b94f0;}})[_0x6b2a('0x25')](function(_0x283048){if(!_['isEmpty'](_0x283048)){var _0x3610b9=toCsv(_0x283048);var _0x1c7d7d=Date[_0x6b2a('0x6a')]();fs[_0x6b2a('0x6b')](util[_0x6b2a('0x65')](_0x6b2a('0x6c'),_0x541d71[_0x6b2a('0x42')]['id'],_0x1c7d7d),_0x3610b9);_0x224691['setHeader']('Content-disposition','attachment;\x20filename='+util[_0x6b2a('0x65')](_0x6b2a('0x6d'),_0x541d71['params']['id'],_0x1c7d7d));_0x224691[_0x6b2a('0x6e')]('Content-type',_0x6b2a('0x6f'));return _0x224691[_0x6b2a('0x70')](util[_0x6b2a('0x65')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x541d71[_0x6b2a('0x42')]['id'],_0x1c7d7d));}else{return _0x224691[_0x6b2a('0x19')](0xcc);}})['catch'](handleError(_0x224691,null));}; \ No newline at end of file +var _0x2964=['indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','get','UserProfileResource','name','send','index','map','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','JscriptyProject','includeAll','include','rows','catch','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Projects','UserProfileSection','userProfileId','omit','updatedAt','createdAt','autoAssociation','update','destroy','findOne','ProjectId','JscriptySessionReport','findAll','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString'];(function(_0x6a5d4b,_0x4f4e6){var _0x1cad4c=function(_0x299be9){while(--_0x299be9){_0x6a5d4b['push'](_0x6a5d4b['shift']());}};_0x1cad4c(++_0x4f4e6);}(_0x2964,0x108));var _0x4296=function(_0x673ec4,_0x274a45){_0x673ec4=_0x673ec4-0x0;var _0xa3e21e=_0x2964[_0x673ec4];return _0xa3e21e;};'use strict';var emlformat=require(_0x4296('0x0'));var rimraf=require(_0x4296('0x1'));var zipdir=require(_0x4296('0x2'));var jsonpatch=require(_0x4296('0x3'));var rp=require(_0x4296('0x4'));var moment=require(_0x4296('0x5'));var BPromise=require(_0x4296('0x6'));var Mustache=require(_0x4296('0x7'));var util=require(_0x4296('0x8'));var path=require('path');var sox=require(_0x4296('0x9'));var csv=require(_0x4296('0xa'));var ejs=require(_0x4296('0xb'));var fs=require('fs');var fs_extra=require(_0x4296('0xc'));var _=require(_0x4296('0xd'));var squel=require(_0x4296('0xe'));var crypto=require('crypto');var jsforce=require(_0x4296('0xf'));var deskjs=require(_0x4296('0x10'));var toCsv=require(_0x4296('0xa'));var querystring=require(_0x4296('0x11'));var Papa=require(_0x4296('0x12'));var Redis=require(_0x4296('0x13'));var authService=require(_0x4296('0x14'));var qs=require(_0x4296('0x15'));var as=require(_0x4296('0x16'));var hardwareService=require(_0x4296('0x17'));var logger=require(_0x4296('0x18'))(_0x4296('0x19'));var utils=require('../../config/utils');var config=require(_0x4296('0x1a'));var licenseUtil=require(_0x4296('0x1b'));var db=require(_0x4296('0x1c'))['db'];function respondWithStatusCode(_0x367c95,_0x23ba5a){_0x23ba5a=_0x23ba5a||0xcc;return function(_0x676674){if(_0x676674){return _0x367c95[_0x4296('0x1d')](_0x23ba5a);}return _0x367c95['status'](_0x23ba5a)[_0x4296('0x1e')]();};}function respondWithResult(_0x350b4b,_0x3574da){_0x3574da=_0x3574da||0xc8;return function(_0x56b6d7){if(_0x56b6d7){return _0x350b4b[_0x4296('0x1f')](_0x3574da)[_0x4296('0x20')](_0x56b6d7);}};}function respondWithFilteredResult(_0x3f4699,_0x53af4b){return function(_0x182910){if(_0x182910){var _0x2e63c4=typeof _0x53af4b[_0x4296('0x21')]==='undefined'&&typeof _0x53af4b[_0x4296('0x22')]===_0x4296('0x23');var _0x8c0539=_0x182910[_0x4296('0x24')];var _0x7a226f=_0x2e63c4?0x0:_0x53af4b['offset'];var _0x2decf5=_0x2e63c4?_0x182910[_0x4296('0x24')]:_0x53af4b[_0x4296('0x21')]+_0x53af4b['limit'];var _0x13f40f;if(_0x2decf5>=_0x8c0539){_0x2decf5=_0x8c0539;_0x13f40f=0xc8;}else{_0x13f40f=0xce;}_0x3f4699[_0x4296('0x1f')](_0x13f40f);return _0x3f4699[_0x4296('0x25')](_0x4296('0x26'),_0x7a226f+'-'+_0x2decf5+'/'+_0x8c0539)[_0x4296('0x20')](_0x182910);}return null;};}function patchUpdates(_0x336894){return function(_0x4ca11f){try{jsonpatch[_0x4296('0x27')](_0x4ca11f,_0x336894,!![]);}catch(_0x2243ee){return BPromise['reject'](_0x2243ee);}return _0x4ca11f[_0x4296('0x28')]();};}function saveUpdates(_0x3de482,_0x257f51){return function(_0x3c899f){if(_0x3c899f){return _0x3c899f['update'](_0x3de482)['then'](function(_0x2fb2b4){return _0x2fb2b4;});}return null;};}function removeEntity(_0x3902b5,_0x4ce761){return function(_0x179e5d){if(_0x179e5d){return _0x179e5d['destroy']()[_0x4296('0x29')](function(){var _0xd620fa=_0x179e5d[_0x4296('0x2a')]({'plain':!![]});var _0x3d2028='Projects';return db[_0x4296('0x2b')]['destroy']({'where':{'type':_0x3d2028,'resourceId':_0xd620fa['id']}})[_0x4296('0x29')](function(){return _0x179e5d;});})['then'](function(){_0x3902b5['status'](0xcc)[_0x4296('0x1e')]();});}};}function handleEntityNotFound(_0x38a83c,_0x2a2903){return function(_0x4ce4ed){if(!_0x4ce4ed){_0x38a83c[_0x4296('0x1d')](0x194);}return _0x4ce4ed;};}function handleError(_0x3aa23e,_0x5015ce){_0x5015ce=_0x5015ce||0x1f4;return function(_0x30fa22){logger['error'](_0x30fa22['stack']);if(_0x30fa22[_0x4296('0x2c')]){delete _0x30fa22[_0x4296('0x2c')];}_0x3aa23e[_0x4296('0x1f')](_0x5015ce)[_0x4296('0x2d')](_0x30fa22);};}exports[_0x4296('0x2e')]=function(_0x2f9dcd,_0x33df03){var _0x9ac120={},_0x599a74={},_0x1a9b51={'count':0x0,'rows':[]};var _0x584ca4=_[_0x4296('0x2f')](db['JscriptyProject']['rawAttributes'],function(_0x1afd71){return{'name':_0x1afd71['fieldName'],'type':_0x1afd71[_0x4296('0x30')][_0x4296('0x31')]};});_0x599a74[_0x4296('0x32')]=_[_0x4296('0x2f')](_0x584ca4,_0x4296('0x2c'));_0x599a74[_0x4296('0x33')]=_[_0x4296('0x34')](_0x2f9dcd[_0x4296('0x33')]);_0x599a74[_0x4296('0x35')]=_[_0x4296('0x36')](_0x599a74[_0x4296('0x32')],_0x599a74['query']);_0x9ac120['attributes']=_[_0x4296('0x36')](_0x599a74[_0x4296('0x32')],qs[_0x4296('0x37')](_0x2f9dcd[_0x4296('0x33')]['fields']));_0x9ac120['attributes']=_0x9ac120[_0x4296('0x38')][_0x4296('0x39')]?_0x9ac120[_0x4296('0x38')]:_0x599a74[_0x4296('0x32')];if(!_0x2f9dcd['query'][_0x4296('0x3a')](_0x4296('0x3b'))){_0x9ac120['limit']=qs['limit'](_0x2f9dcd['query'][_0x4296('0x22')]);_0x9ac120[_0x4296('0x21')]=qs['offset'](_0x2f9dcd[_0x4296('0x33')][_0x4296('0x21')]);}_0x9ac120[_0x4296('0x3c')]=qs[_0x4296('0x3d')](_0x2f9dcd[_0x4296('0x33')][_0x4296('0x3d')]);_0x9ac120[_0x4296('0x3e')]=qs[_0x4296('0x35')](_[_0x4296('0x3f')](_0x2f9dcd[_0x4296('0x33')],_0x599a74[_0x4296('0x35')]),_0x584ca4);if(_0x2f9dcd[_0x4296('0x33')][_0x4296('0x40')]){_0x9ac120['where']=_[_0x4296('0x41')](_0x9ac120[_0x4296('0x3e')],{'$or':_[_0x4296('0x2f')](_0x584ca4,function(_0x2d153c){if(_0x2d153c[_0x4296('0x30')]!==_0x4296('0x42')){var _0x552bdc={};_0x552bdc[_0x2d153c[_0x4296('0x2c')]]={'$like':'%'+_0x2f9dcd[_0x4296('0x33')][_0x4296('0x40')]+'%'};return _0x552bdc;}})});}_0x9ac120=_['merge']({},_0x9ac120,_0x2f9dcd[_0x4296('0x43')]);var _0x53a825={'where':_0x9ac120[_0x4296('0x3e')]};return db[_0x4296('0x44')][_0x4296('0x24')](_0x53a825)[_0x4296('0x29')](function(_0x344eb5){_0x1a9b51[_0x4296('0x24')]=_0x344eb5;if(_0x2f9dcd['query'][_0x4296('0x45')]){_0x9ac120[_0x4296('0x46')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x9ac120);})[_0x4296('0x29')](function(_0x3fffd3){_0x1a9b51[_0x4296('0x47')]=_0x3fffd3;return _0x1a9b51;})[_0x4296('0x29')](respondWithFilteredResult(_0x33df03,_0x9ac120))[_0x4296('0x48')](handleError(_0x33df03,null));};exports['show']=function(_0x504227,_0x456c19){var _0x28a74b={'raw':![],'where':{'id':_0x504227[_0x4296('0x49')]['id']}},_0x2d86a1={};_0x2d86a1[_0x4296('0x32')]=_[_0x4296('0x34')](db[_0x4296('0x44')][_0x4296('0x4a')]);_0x2d86a1[_0x4296('0x33')]=_['keys'](_0x504227[_0x4296('0x33')]);_0x2d86a1[_0x4296('0x35')]=_[_0x4296('0x36')](_0x2d86a1['model'],_0x2d86a1[_0x4296('0x33')]);_0x28a74b[_0x4296('0x38')]=_['intersection'](_0x2d86a1['model'],qs[_0x4296('0x37')](_0x504227[_0x4296('0x33')][_0x4296('0x37')]));_0x28a74b['attributes']=_0x28a74b['attributes']['length']?_0x28a74b[_0x4296('0x38')]:_0x2d86a1[_0x4296('0x32')];if(_0x504227[_0x4296('0x33')]['includeAll']){_0x28a74b['include']=[{'all':!![]}];}_0x28a74b=_[_0x4296('0x41')]({},_0x28a74b,_0x504227[_0x4296('0x43')]);return db[_0x4296('0x44')][_0x4296('0x4b')](_0x28a74b)[_0x4296('0x29')](handleEntityNotFound(_0x456c19,null))[_0x4296('0x29')](respondWithResult(_0x456c19,null))[_0x4296('0x48')](handleError(_0x456c19,null));};exports[_0x4296('0x4c')]=function(_0x598292,_0x419cab){return db[_0x4296('0x44')][_0x4296('0x4c')](_0x598292[_0x4296('0x4d')],{})[_0x4296('0x29')](function(_0x42de58){var _0x5ac423=_0x598292['user']['get']({'plain':!![]});if(!_0x5ac423)throw new Error(_0x4296('0x4e'));if(_0x5ac423[_0x4296('0x4f')]===_0x4296('0x50')){var _0x33a02b=_0x42de58['get']({'plain':!![]});var _0x2ac96d=_0x4296('0x51');return db[_0x4296('0x52')][_0x4296('0x4b')]({'where':{'name':_0x2ac96d,'userProfileId':_0x5ac423[_0x4296('0x53')]},'raw':!![]})[_0x4296('0x29')](function(_0x218136){if(_0x218136&&_0x218136['autoAssociation']===0x0){return db[_0x4296('0x2b')]['create']({'name':_0x33a02b['name'],'resourceId':_0x33a02b['id'],'type':_0x218136[_0x4296('0x2c')],'sectionId':_0x218136['id']},{})[_0x4296('0x29')](function(){return _0x42de58;});}else{return _0x42de58;}})['catch'](function(_0x17e212){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17e212);throw _0x17e212;});}return _0x42de58;})[_0x4296('0x29')](respondWithResult(_0x419cab,0xc9))[_0x4296('0x48')](handleError(_0x419cab,null));};exports['clone']=function(_0x4faac4,_0x4691b4){var _0x2b82b1={'where':{'id':_0x4faac4[_0x4296('0x49')]['id']}},_0x57e01f={};_0x57e01f[_0x4296('0x32')]=_['keys'](db[_0x4296('0x44')][_0x4296('0x4a')]);_0x2b82b1['attributes']=_[_0x4296('0x36')](_0x57e01f[_0x4296('0x32')],qs[_0x4296('0x37')](_0x4faac4[_0x4296('0x33')][_0x4296('0x37')]));_0x2b82b1[_0x4296('0x38')]=_0x2b82b1['attributes'][_0x4296('0x39')]?_0x2b82b1[_0x4296('0x38')]:_0x57e01f[_0x4296('0x32')];if(_0x4faac4[_0x4296('0x33')]['includeAll']){_0x2b82b1['include']=[{'all':!![]}];}_0x2b82b1=_[_0x4296('0x41')]({},_0x2b82b1,_0x4faac4[_0x4296('0x43')]);return db['JscriptyProject'][_0x4296('0x4b')](_0x2b82b1)[_0x4296('0x29')](handleEntityNotFound(_0x4691b4,null))[_0x4296('0x29')](function(_0x45673f){if(_0x45673f){var _0x467a14=_0x45673f['get']({'plain':!![]});_0x467a14=qs[_0x4296('0x54')](_0x467a14,['id','createdAt',_0x4296('0x55')]);_0x4faac4['body']=_[_0x4296('0x54')](_0x4faac4[_0x4296('0x4d')],['id',_0x4296('0x56'),_0x4296('0x55')]);return db[_0x4296('0x44')][_0x4296('0x4c')](_[_0x4296('0x41')](_0x467a14,_0x4faac4[_0x4296('0x4d')]),{'include':_0x4faac4['query'][_0x4296('0x45')]?[{'all':!![]}]:undefined})[_0x4296('0x29')](function(_0x128f96){var _0x40dbcc=_0x4faac4['user'][_0x4296('0x2a')]({'plain':!![]});if(!_0x40dbcc)throw new Error(_0x4296('0x4e'));if(_0x40dbcc[_0x4296('0x4f')]===_0x4296('0x50')){var _0xd84151=_0x128f96[_0x4296('0x2a')]({'plain':!![]});var _0x309389=_0x4296('0x51');return db[_0x4296('0x52')][_0x4296('0x4b')]({'where':{'name':_0x309389,'userProfileId':_0x40dbcc[_0x4296('0x53')]},'raw':!![]})[_0x4296('0x29')](function(_0x3841c1){if(_0x3841c1&&_0x3841c1[_0x4296('0x57')]===0x0){return db[_0x4296('0x2b')]['create']({'name':_0xd84151[_0x4296('0x2c')],'resourceId':_0xd84151['id'],'type':_0x3841c1[_0x4296('0x2c')],'sectionId':_0x3841c1['id']},{})[_0x4296('0x29')](function(){return _0x128f96;});}else{return _0x128f96;}})[_0x4296('0x48')](function(_0x6e3e2e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x6e3e2e);throw _0x6e3e2e;});}return _0x128f96;});}})[_0x4296('0x29')](respondWithResult(_0x4691b4,0xc9))[_0x4296('0x48')](handleError(_0x4691b4,null));};exports[_0x4296('0x58')]=function(_0x24054b,_0x36aee5){if(_0x24054b[_0x4296('0x4d')]['id']){delete _0x24054b[_0x4296('0x4d')]['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x24054b['params']['id']}})[_0x4296('0x29')](handleEntityNotFound(_0x36aee5,null))[_0x4296('0x29')](saveUpdates(_0x24054b[_0x4296('0x4d')],null))['then'](respondWithResult(_0x36aee5,null))[_0x4296('0x48')](handleError(_0x36aee5,null));};exports[_0x4296('0x59')]=function(_0x281628,_0x1753d4){return db['JscriptyProject'][_0x4296('0x4b')]({'where':{'id':_0x281628[_0x4296('0x49')]['id']}})[_0x4296('0x29')](handleEntityNotFound(_0x1753d4,null))['then'](removeEntity(_0x1753d4,null))[_0x4296('0x48')](handleError(_0x1753d4,null));};exports['getSessions']=function(_0x912d9b,_0x538228,_0x5b76e8){var _0x3147da={'raw':!![],'where':{}};var _0x522a45={};var _0x171ffb={'count':0x0,'rows':[]};return db[_0x4296('0x44')][_0x4296('0x5a')]({'where':{'id':_0x912d9b[_0x4296('0x49')]['id']}})[_0x4296('0x29')](handleEntityNotFound(_0x538228,null))[_0x4296('0x29')](function(_0x7984a8){if(_0x7984a8){_0x522a45['model']=_[_0x4296('0x34')](db['JscriptySessionReport'][_0x4296('0x4a')]);_0x522a45['query']=_['keys'](_0x912d9b[_0x4296('0x33')]);_0x522a45['filters']=_[_0x4296('0x36')](_0x522a45['model'],_0x522a45['query']);_0x3147da[_0x4296('0x38')]=_[_0x4296('0x36')](_0x522a45['model'],qs[_0x4296('0x37')](_0x912d9b[_0x4296('0x33')]['fields']));_0x3147da[_0x4296('0x38')]=_0x3147da[_0x4296('0x38')]['length']?_0x3147da[_0x4296('0x38')]:_0x522a45[_0x4296('0x32')];if(!_0x912d9b[_0x4296('0x33')][_0x4296('0x3a')](_0x4296('0x3b'))){_0x3147da[_0x4296('0x22')]=qs['limit'](_0x912d9b[_0x4296('0x33')][_0x4296('0x22')]);_0x3147da[_0x4296('0x21')]=qs[_0x4296('0x21')](_0x912d9b[_0x4296('0x33')][_0x4296('0x21')]);}_0x3147da[_0x4296('0x3c')]=qs['sort'](_0x912d9b[_0x4296('0x33')][_0x4296('0x3d')]);_0x3147da[_0x4296('0x3e')]=qs[_0x4296('0x35')](_[_0x4296('0x3f')](_0x912d9b[_0x4296('0x33')],_0x522a45[_0x4296('0x35')]));_0x3147da[_0x4296('0x3e')][_0x4296('0x5b')]=_0x7984a8['id'];if(_0x912d9b[_0x4296('0x33')][_0x4296('0x40')]){_0x3147da['where']=_[_0x4296('0x41')](_0x3147da[_0x4296('0x3e')],{'$or':_[_0x4296('0x2f')](_0x3147da[_0x4296('0x38')],function(_0x4a901b){var _0x26754f={};_0x26754f[_0x4a901b]={'$like':'%'+_0x912d9b['query'][_0x4296('0x40')]+'%'};return _0x26754f;})});}_0x3147da=_[_0x4296('0x41')]({},_0x3147da,_0x912d9b[_0x4296('0x43')]);return db['JscriptySessionReport']['count']({'where':_0x3147da[_0x4296('0x3e')]})['then'](function(_0x515193){_0x171ffb[_0x4296('0x24')]=_0x515193;if(_0x912d9b[_0x4296('0x33')][_0x4296('0x45')]){_0x3147da[_0x4296('0x46')]=[{'all':!![]}];}return db[_0x4296('0x5c')][_0x4296('0x5d')](_0x3147da);})[_0x4296('0x29')](function(_0x4eea76){_0x171ffb['rows']=_0x4eea76;return _0x171ffb;});}})[_0x4296('0x29')](respondWithFilteredResult(_0x538228,_0x3147da))[_0x4296('0x48')](handleError(_0x538228,null));};exports[_0x4296('0x5e')]=function(_0x8f0bd6,_0x532980,_0x294dc7){var _0x33d0fa={'raw':!![],'where':{}};var _0x21b0e7={};var _0x1dadb6={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x4296('0x5a')]({'where':{'id':_0x8f0bd6[_0x4296('0x49')]['id']}})[_0x4296('0x29')](handleEntityNotFound(_0x532980,null))[_0x4296('0x29')](function(_0x43316b){if(_0x43316b){_0x21b0e7[_0x4296('0x32')]=_[_0x4296('0x34')](db[_0x4296('0x5f')][_0x4296('0x4a')]);_0x21b0e7[_0x4296('0x33')]=_[_0x4296('0x34')](_0x8f0bd6[_0x4296('0x33')]);_0x21b0e7[_0x4296('0x35')]=_[_0x4296('0x36')](_0x21b0e7[_0x4296('0x32')],_0x21b0e7[_0x4296('0x33')]);_0x33d0fa[_0x4296('0x38')]=_[_0x4296('0x36')](_0x21b0e7[_0x4296('0x32')],qs[_0x4296('0x37')](_0x8f0bd6[_0x4296('0x33')][_0x4296('0x37')]));_0x33d0fa['attributes']=_0x33d0fa['attributes']['length']?_0x33d0fa[_0x4296('0x38')]:_0x21b0e7[_0x4296('0x32')];if(!_0x8f0bd6['query'][_0x4296('0x3a')](_0x4296('0x3b'))){_0x33d0fa[_0x4296('0x22')]=qs[_0x4296('0x22')](_0x8f0bd6['query'][_0x4296('0x22')]);_0x33d0fa[_0x4296('0x21')]=qs['offset'](_0x8f0bd6[_0x4296('0x33')][_0x4296('0x21')]);}_0x33d0fa['order']=qs[_0x4296('0x3d')](_0x8f0bd6[_0x4296('0x33')][_0x4296('0x3d')]);_0x33d0fa['where']=qs[_0x4296('0x35')](_[_0x4296('0x3f')](_0x8f0bd6[_0x4296('0x33')],_0x21b0e7[_0x4296('0x35')]));_0x33d0fa[_0x4296('0x3e')]['ProjectId']=_0x43316b['id'];if(_0x8f0bd6[_0x4296('0x33')][_0x4296('0x40')]){_0x33d0fa['where']=_[_0x4296('0x41')](_0x33d0fa[_0x4296('0x3e')],{'$or':_['map'](_0x33d0fa['attributes'],function(_0x12d001){var _0x46a875={};_0x46a875[_0x12d001]={'$like':'%'+_0x8f0bd6['query']['filter']+'%'};return _0x46a875;})});}_0x33d0fa=_[_0x4296('0x41')]({},_0x33d0fa,_0x8f0bd6['options']);return db['JscriptyAnswerReport'][_0x4296('0x24')]({'where':_0x33d0fa['where']})[_0x4296('0x29')](function(_0x5e0cdb){_0x1dadb6[_0x4296('0x24')]=_0x5e0cdb;if(_0x8f0bd6[_0x4296('0x33')]['includeAll']){_0x33d0fa[_0x4296('0x46')]=[{'all':!![]}];}return db[_0x4296('0x5f')][_0x4296('0x5d')](_0x33d0fa);})[_0x4296('0x29')](function(_0x2c4917){_0x1dadb6[_0x4296('0x47')]=_0x2c4917;return _0x1dadb6;});}})[_0x4296('0x29')](respondWithFilteredResult(_0x532980,_0x33d0fa))[_0x4296('0x48')](handleError(_0x532980,null));};function char(_0x3cfdac){return _0x4296('0x60')===typeof _0x3cfdac?String[_0x4296('0x61')]['apply'](null,arguments):_0x3cfdac;}function needsEncapsulation(_0x14b928){return!!_0x14b928&&(_0x14b928[_0x4296('0x62')]()['indexOf'](char(0xd))>=0x0||_0x14b928[_0x4296('0x62')]()[_0x4296('0x63')](char(0xa))>=0x0||_0x14b928[_0x4296('0x62')]()[_0x4296('0x63')](char(0x2c))>=0x0||_0x14b928[_0x4296('0x62')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x158102){var _0x4f0aa3=char(0x22),_0x50fb34='\x5c'+char(0x22),_0x2823d6=_0x158102[_0x4296('0x62')]()[_0x4296('0x64')](new RegExp(_0x4f0aa3,'g'),_0x50fb34);return _0x4f0aa3+_0x2823d6+_0x4f0aa3;}exports[_0x4296('0x65')]=function(_0x834988,_0x34f748,_0x53c8f0){var _0x466c75,_0x58b411;var _0x59fbc3={'where':{'ProjectId':_0x834988[_0x4296('0x49')]['id']}};if(_0x834988[_0x4296('0x33')][_0x4296('0x66')]){_0x59fbc3['where']['starttime']=JSON[_0x4296('0x67')](_0x834988[_0x4296('0x33')]['startTime']);}return db[_0x4296('0x5c')][_0x4296('0x5d')](_0x59fbc3)['then'](handleEntityNotFound(_0x34f748,null))['then'](function(_0x1f7ff8){if(_0x1f7ff8){_0x466c75=_0x1f7ff8;return db[_0x4296('0x68')][_0x4296('0x5d')]({'where':{'SessionId':{'$in':_[_0x4296('0x2f')](_0x466c75,'id')},'ProjectId':_0x834988['params']['id']},'order':_0x4296('0x69')});}})[_0x4296('0x29')](handleEntityNotFound(_0x34f748,null))['then'](function(_0x29f3a7){if(_0x29f3a7){_0x58b411=_0x29f3a7;var _0x4e8540={};for(var _0x1dfd3a=0x0,_0x465ce2=_0x58b411[_0x4296('0x39')];_0x1dfd3a<_0x465ce2;_0x1dfd3a++){if(!_0x4e8540['hasOwnProperty'](_0x58b411[_0x1dfd3a]['questionId'])){_0x4e8540[_0x58b411[_0x1dfd3a][_0x4296('0x6a')]]=needsEncapsulation(_0x58b411[_0x1dfd3a][_0x4296('0x6b')])?encapsulate(_0x58b411[_0x1dfd3a][_0x4296('0x6b')]):_0x58b411[_0x1dfd3a][_0x4296('0x6b')];}}var _0x912ddf=[],_0x3c50dc={};for(var _0x859b54=0x0,_0x4487bc=_0x466c75['length'];_0x859b54<_0x4487bc;_0x859b54++){_0x3c50dc={'ProjectId':_0x834988[_0x4296('0x49')]['id'],'SessionId':_0x466c75[_0x859b54]['id'],'StartTime':moment(_0x466c75[_0x859b54]['starttime'])[_0x4296('0x6c')](_0x4296('0x6d'))};for(var _0x47af12=0x0,_0x14d612=_0x58b411[_0x4296('0x39')];_0x47af12<_0x14d612;_0x47af12++){if(_0x58b411[_0x47af12]['SessionId']==_0x466c75[_0x859b54]['id']&&_0x4e8540[_0x4296('0x3a')](_0x58b411[_0x47af12]['questionId'])){_0x3c50dc[_0x4e8540[_0x58b411[_0x47af12][_0x4296('0x6a')]]]=_0x58b411[_0x47af12][_0x4296('0x6e')];}}for(var _0x4b5fa0 in _0x4e8540){if(!_0x3c50dc[_0x4296('0x3a')](_0x4e8540[_0x4b5fa0])){_0x3c50dc[_0x4e8540[_0x4b5fa0]]=null;}}_0x912ddf[_0x4296('0x6f')](_0x3c50dc);}return _0x912ddf;}})[_0x4296('0x29')](function(_0x404174){if(!_[_0x4296('0x70')](_0x404174)){var _0xb5e199=toCsv(_0x404174);var _0x404703=Date[_0x4296('0x71')]();fs[_0x4296('0x72')](util['format'](_0x4296('0x73'),_0x834988[_0x4296('0x49')]['id'],_0x404703),_0xb5e199);_0x34f748['setHeader'](_0x4296('0x74'),'attachment;\x20filename='+util['format'](_0x4296('0x75'),_0x834988[_0x4296('0x49')]['id'],_0x404703));_0x34f748[_0x4296('0x76')](_0x4296('0x77'),'text/csv');return _0x34f748[_0x4296('0x78')](util[_0x4296('0x6c')](_0x4296('0x73'),_0x834988[_0x4296('0x49')]['id'],_0x404703));}else{return _0x34f748[_0x4296('0x1d')](0xcc);}})['catch'](handleError(_0x34f748,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index e0e5178..f1866fc 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 _0x8a9c=['JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./jscriptyProject.attributes','exports','define'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8a9c,0x12d));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc8a9('0x0'));var util=require(_0xc8a9('0x1'));var logger=require(_0xc8a9('0x2'))(_0xc8a9('0x3'));var moment=require(_0xc8a9('0x4'));var BPromise=require('bluebird');var rp=require(_0xc8a9('0x5'));var fs=require('fs');var path=require(_0xc8a9('0x6'));var rimraf=require('rimraf');var config=require(_0xc8a9('0x7'));var attributes=require(_0xc8a9('0x8'));module[_0xc8a9('0x9')]=function(_0x4c1e04,_0xb4340b){return _0x4c1e04[_0xc8a9('0xa')](_0xc8a9('0xb'),attributes,{'tableName':_0xc8a9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafdd=['request-promise','path','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x379d1c,_0x57d0f9){var _0x7c2dc0=function(_0x5f296a){while(--_0x5f296a){_0x379d1c['push'](_0x379d1c['shift']());}};_0x7c2dc0(++_0x57d0f9);}(_0xafdd,0x19a));var _0xdafd=function(_0x36154a,_0x2cf98c){_0x36154a=_0x36154a-0x0;var _0x61104e=_0xafdd[_0x36154a];return _0x61104e;};'use strict';var _=require(_0xdafd('0x0'));var util=require(_0xdafd('0x1'));var logger=require(_0xdafd('0x2'))(_0xdafd('0x3'));var moment=require(_0xdafd('0x4'));var BPromise=require(_0xdafd('0x5'));var rp=require(_0xdafd('0x6'));var fs=require('fs');var path=require(_0xdafd('0x7'));var rimraf=require('rimraf');var config=require(_0xdafd('0x8'));var attributes=require(_0xdafd('0x9'));module[_0xdafd('0xa')]=function(_0x37f05a,_0xfa4ad6){return _0x37f05a[_0xdafd('0xb')](_0xdafd('0xc'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 9a7506d..0defed9 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 _0xbdb7=['request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','JscriptyProject,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x19e08e,_0x178f46){_0x19e08e=_0x19e08e-0x0;var _0x14c229=_0xbdb7[_0x19e08e];return _0x14c229;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x6f8972,_0x343da7){var _0x5677d9=function(_0x5eb51f){while(--_0x5eb51f){_0x6f8972['push'](_0x6f8972['shift']());}};_0x5677d9(++_0x343da7);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 1c77fbd..1f9f8a0 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 _0x85db=['multer','util','path','connect-timeout','express','Router','../../config/environment','./jscriptyQuestionReport.controller','get','index','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x2d1e0d,_0x16c139){var _0x4aa36e=function(_0x5f35d7){while(--_0x5f35d7){_0x2d1e0d['push'](_0x2d1e0d['shift']());}};_0x4aa36e(++_0x16c139);}(_0x85db,0x104));var _0xb85d=function(_0x1347f8,_0x233feb){_0x1347f8=_0x1347f8-0x0;var _0x218368=_0x85db[_0x1347f8];return _0x218368;};'use strict';var multer=require(_0xb85d('0x0'));var util=require(_0xb85d('0x1'));var path=require(_0xb85d('0x2'));var timeout=require(_0xb85d('0x3'));var express=require(_0xb85d('0x4'));var router=express[_0xb85d('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb85d('0x6'));var controller=require(_0xb85d('0x7'));router[_0xb85d('0x8')]('/',auth['isAuthenticated'](),controller[_0xb85d('0x9')]);router[_0xb85d('0x8')]('/describe',auth[_0xb85d('0xa')](),controller[_0xb85d('0xb')]);router[_0xb85d('0x8')](_0xb85d('0xc'),auth[_0xb85d('0xa')](),controller[_0xb85d('0xd')]);router[_0xb85d('0xe')]('/',auth[_0xb85d('0xa')](),controller[_0xb85d('0xf')]);router[_0xb85d('0x10')]('/:id',auth[_0xb85d('0xa')](),controller[_0xb85d('0x11')]);router[_0xb85d('0x12')](_0xb85d('0xc'),auth[_0xb85d('0xa')](),controller[_0xb85d('0x13')]);module['exports']=router; \ No newline at end of file +var _0xa404=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa404,0x102));var _0x4a40=function(_0x1c41e1,_0x12e0b1){_0x1c41e1=_0x1c41e1-0x0;var _0x34233f=_0xa404[_0x1c41e1];return _0x34233f;};'use strict';var multer=require('multer');var util=require(_0x4a40('0x0'));var path=require(_0x4a40('0x1'));var timeout=require(_0x4a40('0x2'));var express=require(_0x4a40('0x3'));var router=express[_0x4a40('0x4')]();var fs_extra=require(_0x4a40('0x5'));var auth=require(_0x4a40('0x6'));var interaction=require(_0x4a40('0x7'));var config=require(_0x4a40('0x8'));var controller=require('./jscriptyQuestionReport.controller');router[_0x4a40('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4a40('0x9')]('/describe',auth[_0x4a40('0xa')](),controller['describe']);router[_0x4a40('0x9')](_0x4a40('0xb'),auth[_0x4a40('0xa')](),controller[_0x4a40('0xc')]);router[_0x4a40('0xd')]('/',auth[_0x4a40('0xa')](),controller[_0x4a40('0xe')]);router[_0x4a40('0xf')]('/:id',auth[_0x4a40('0xa')](),controller['update']);router[_0x4a40('0x10')]('/:id',auth[_0x4a40('0xa')](),controller[_0x4a40('0x11')]);module[_0x4a40('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 7c835c0..32786f6 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(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x7a54,0x106));var _0x47a5=function(_0x53b7a,_0x509ec9){_0x53b7a=_0x53b7a-0x0;var _0x108e36=_0x7a54[_0x53b7a];return _0x108e36;};'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(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x7a54,0x106));var _0x47a5=function(_0x9b7f4,_0x2bd290){_0x9b7f4=_0x9b7f4-0x0;var _0x3cbc94=_0x7a54[_0x9b7f4];return _0x3cbc94;};'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 48eb0df..9e4c5c0 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 _0xc0e4=['limit','count','Content-Range','apply','update','then','sendStatus','error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','type','map','query','keys','model','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','params','length','include','find','create','body','destroy','describe','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc0e4,0x1dc));var _0x4c0e=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0xc0e4[_0x454018];return _0x24697d;};'use strict';var emlformat=require(_0x4c0e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4c0e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c0e('0x2'));var moment=require(_0x4c0e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4c0e('0x4'));var util=require(_0x4c0e('0x5'));var path=require(_0x4c0e('0x6'));var sox=require(_0x4c0e('0x7'));var csv=require(_0x4c0e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4c0e('0x9'));var squel=require('squel');var crypto=require(_0x4c0e('0xa'));var jsforce=require(_0x4c0e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4c0e('0x8'));var querystring=require(_0x4c0e('0xc'));var Papa=require(_0x4c0e('0xd'));var Redis=require(_0x4c0e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4c0e('0xf'));var as=require(_0x4c0e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c0e('0x11'))(_0x4c0e('0x12'));var utils=require(_0x4c0e('0x13'));var config=require(_0x4c0e('0x14'));var licenseUtil=require(_0x4c0e('0x15'));var db=require(_0x4c0e('0x16'))['db'];function respondWithStatusCode(_0x6cd03d,_0x17bd4e){_0x17bd4e=_0x17bd4e||0xcc;return function(_0x204603){if(_0x204603){return _0x6cd03d['sendStatus'](_0x17bd4e);}return _0x6cd03d[_0x4c0e('0x17')](_0x17bd4e)[_0x4c0e('0x18')]();};}function respondWithResult(_0x4a415d,_0x52ef99){_0x52ef99=_0x52ef99||0xc8;return function(_0x5e5fd0){if(_0x5e5fd0){return _0x4a415d['status'](_0x52ef99)[_0x4c0e('0x19')](_0x5e5fd0);}};}function respondWithFilteredResult(_0x435a33,_0x231102){return function(_0x476fda){if(_0x476fda){var _0x517c71=typeof _0x231102[_0x4c0e('0x1a')]===_0x4c0e('0x1b')&&typeof _0x231102[_0x4c0e('0x1c')]===_0x4c0e('0x1b');var _0xfa295a=_0x476fda['count'];var _0x95f8b9=_0x517c71?0x0:_0x231102['offset'];var _0x2156f4=_0x517c71?_0x476fda[_0x4c0e('0x1d')]:_0x231102[_0x4c0e('0x1a')]+_0x231102['limit'];var _0x401d1c;if(_0x2156f4>=_0xfa295a){_0x2156f4=_0xfa295a;_0x401d1c=0xc8;}else{_0x401d1c=0xce;}_0x435a33[_0x4c0e('0x17')](_0x401d1c);return _0x435a33['set'](_0x4c0e('0x1e'),_0x95f8b9+'-'+_0x2156f4+'/'+_0xfa295a)[_0x4c0e('0x19')](_0x476fda);}return null;};}function patchUpdates(_0x5c7b1c){return function(_0x4a9e6f){try{jsonpatch[_0x4c0e('0x1f')](_0x4a9e6f,_0x5c7b1c,!![]);}catch(_0x24ac06){return BPromise['reject'](_0x24ac06);}return _0x4a9e6f['save']();};}function saveUpdates(_0x3505b3,_0x35935b){return function(_0x36624d){if(_0x36624d){return _0x36624d[_0x4c0e('0x20')](_0x3505b3)[_0x4c0e('0x21')](function(_0x36a855){return _0x36a855;});}return null;};}function removeEntity(_0xa63f9f,_0x895026){return function(_0x5cdd17){if(_0x5cdd17){return _0x5cdd17['destroy']()[_0x4c0e('0x21')](function(){_0xa63f9f[_0x4c0e('0x17')](0xcc)[_0x4c0e('0x18')]();});}};}function handleEntityNotFound(_0x20d1d9,_0x274c14){return function(_0x13dcda){if(!_0x13dcda){_0x20d1d9[_0x4c0e('0x22')](0x194);}return _0x13dcda;};}function handleError(_0x191a66,_0x367eb8){_0x367eb8=_0x367eb8||0x1f4;return function(_0x47e662){logger[_0x4c0e('0x23')](_0x47e662[_0x4c0e('0x24')]);if(_0x47e662[_0x4c0e('0x25')]){delete _0x47e662[_0x4c0e('0x25')];}_0x191a66[_0x4c0e('0x17')](_0x367eb8)[_0x4c0e('0x26')](_0x47e662);};}exports[_0x4c0e('0x27')]=function(_0x9fedc,_0x122b1d){var _0x315691={},_0x1c3c85={},_0x1857c5={'count':0x0,'rows':[]};var _0x10e3f4=_['map'](db[_0x4c0e('0x28')][_0x4c0e('0x29')],function(_0x4800af){return{'name':_0x4800af[_0x4c0e('0x2a')],'type':_0x4800af[_0x4c0e('0x2b')]['key']};});_0x1c3c85['model']=_[_0x4c0e('0x2c')](_0x10e3f4,'name');_0x1c3c85[_0x4c0e('0x2d')]=_[_0x4c0e('0x2e')](_0x9fedc[_0x4c0e('0x2d')]);_0x1c3c85['filters']=_['intersection'](_0x1c3c85[_0x4c0e('0x2f')],_0x1c3c85[_0x4c0e('0x2d')]);_0x315691[_0x4c0e('0x30')]=_[_0x4c0e('0x31')](_0x1c3c85[_0x4c0e('0x2f')],qs['fields'](_0x9fedc['query'][_0x4c0e('0x32')]));_0x315691[_0x4c0e('0x30')]=_0x315691['attributes']['length']?_0x315691[_0x4c0e('0x30')]:_0x1c3c85['model'];if(!_0x9fedc[_0x4c0e('0x2d')][_0x4c0e('0x33')]('nolimit')){_0x315691[_0x4c0e('0x1c')]=qs[_0x4c0e('0x1c')](_0x9fedc['query'][_0x4c0e('0x1c')]);_0x315691[_0x4c0e('0x1a')]=qs[_0x4c0e('0x1a')](_0x9fedc[_0x4c0e('0x2d')][_0x4c0e('0x1a')]);}_0x315691[_0x4c0e('0x34')]=qs[_0x4c0e('0x35')](_0x9fedc['query'][_0x4c0e('0x35')]);_0x315691[_0x4c0e('0x36')]=qs[_0x4c0e('0x37')](_[_0x4c0e('0x38')](_0x9fedc[_0x4c0e('0x2d')],_0x1c3c85[_0x4c0e('0x37')]),_0x10e3f4);if(_0x9fedc[_0x4c0e('0x2d')][_0x4c0e('0x39')]){_0x315691['where']=_['merge'](_0x315691['where'],{'$or':_['map'](_0x10e3f4,function(_0x2a190f){if(_0x2a190f[_0x4c0e('0x2b')]!==_0x4c0e('0x3a')){var _0x3890a4={};_0x3890a4[_0x2a190f[_0x4c0e('0x25')]]={'$like':'%'+_0x9fedc['query'][_0x4c0e('0x39')]+'%'};return _0x3890a4;}})});}_0x315691=_[_0x4c0e('0x3b')]({},_0x315691,_0x9fedc['options']);var _0x162f87={'where':_0x315691['where']};return db[_0x4c0e('0x28')][_0x4c0e('0x1d')](_0x162f87)[_0x4c0e('0x21')](function(_0x5eda21){_0x1857c5['count']=_0x5eda21;if(_0x9fedc[_0x4c0e('0x2d')][_0x4c0e('0x3c')]){_0x315691['include']=[{'all':!![]}];}return db[_0x4c0e('0x28')][_0x4c0e('0x3d')](_0x315691);})[_0x4c0e('0x21')](function(_0xb02e72){_0x1857c5[_0x4c0e('0x3e')]=_0xb02e72;return _0x1857c5;})[_0x4c0e('0x21')](respondWithFilteredResult(_0x122b1d,_0x315691))[_0x4c0e('0x3f')](handleError(_0x122b1d,null));};exports['show']=function(_0x1e720d,_0x2adfa6){var _0x44d14a={'raw':!![],'where':{'id':_0x1e720d[_0x4c0e('0x40')]['id']}},_0x35a8b8={};_0x35a8b8[_0x4c0e('0x2f')]=_['keys'](db[_0x4c0e('0x28')][_0x4c0e('0x29')]);_0x35a8b8[_0x4c0e('0x2d')]=_[_0x4c0e('0x2e')](_0x1e720d[_0x4c0e('0x2d')]);_0x35a8b8[_0x4c0e('0x37')]=_['intersection'](_0x35a8b8[_0x4c0e('0x2f')],_0x35a8b8['query']);_0x44d14a['attributes']=_[_0x4c0e('0x31')](_0x35a8b8[_0x4c0e('0x2f')],qs[_0x4c0e('0x32')](_0x1e720d[_0x4c0e('0x2d')][_0x4c0e('0x32')]));_0x44d14a[_0x4c0e('0x30')]=_0x44d14a[_0x4c0e('0x30')][_0x4c0e('0x41')]?_0x44d14a['attributes']:_0x35a8b8[_0x4c0e('0x2f')];if(_0x1e720d[_0x4c0e('0x2d')][_0x4c0e('0x3c')]){_0x44d14a[_0x4c0e('0x42')]=[{'all':!![]}];}_0x44d14a=_[_0x4c0e('0x3b')]({},_0x44d14a,_0x1e720d['options']);return db[_0x4c0e('0x28')][_0x4c0e('0x43')](_0x44d14a)['then'](handleEntityNotFound(_0x2adfa6,null))['then'](respondWithResult(_0x2adfa6,null))[_0x4c0e('0x3f')](handleError(_0x2adfa6,null));};exports['create']=function(_0x3ad376,_0x38fc53){return db[_0x4c0e('0x28')][_0x4c0e('0x44')](_0x3ad376[_0x4c0e('0x45')],{})[_0x4c0e('0x21')](respondWithResult(_0x38fc53,0xc9))[_0x4c0e('0x3f')](handleError(_0x38fc53,null));};exports[_0x4c0e('0x20')]=function(_0x22a5f0,_0x1426b3){if(_0x22a5f0[_0x4c0e('0x45')]['id']){delete _0x22a5f0[_0x4c0e('0x45')]['id'];}return db['JscriptyQuestionReport'][_0x4c0e('0x43')]({'where':{'id':_0x22a5f0['params']['id']}})[_0x4c0e('0x21')](handleEntityNotFound(_0x1426b3,null))[_0x4c0e('0x21')](saveUpdates(_0x22a5f0[_0x4c0e('0x45')],null))[_0x4c0e('0x21')](respondWithResult(_0x1426b3,null))[_0x4c0e('0x3f')](handleError(_0x1426b3,null));};exports[_0x4c0e('0x46')]=function(_0x3902a8,_0x169b9c){return db[_0x4c0e('0x28')]['find']({'where':{'id':_0x3902a8[_0x4c0e('0x40')]['id']}})[_0x4c0e('0x21')](handleEntityNotFound(_0x169b9c,null))[_0x4c0e('0x21')](removeEntity(_0x169b9c,null))[_0x4c0e('0x3f')](handleError(_0x169b9c,null));};exports[_0x4c0e('0x47')]=function(_0xdb69cf,_0x161f16){return db[_0x4c0e('0x28')][_0x4c0e('0x47')]()['then'](respondWithResult(_0x161f16,null))[_0x4c0e('0x3f')](handleError(_0x161f16,null));}; \ No newline at end of file +var _0xa17e=['findAll','catch','params','fields','includeAll','options','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','include'];(function(_0x36b154,_0x53620a){var _0x518e21=function(_0x46b04c){while(--_0x46b04c){_0x36b154['push'](_0x36b154['shift']());}};_0x518e21(++_0x53620a);}(_0xa17e,0xf2));var _0xea17=function(_0x456807,_0x165dcf){_0x456807=_0x456807-0x0;var _0x15afb3=_0xa17e[_0x456807];return _0x15afb3;};'use strict';var emlformat=require(_0xea17('0x0'));var rimraf=require(_0xea17('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xea17('0x2'));var rp=require(_0xea17('0x3'));var moment=require('moment');var BPromise=require(_0xea17('0x4'));var Mustache=require(_0xea17('0x5'));var util=require(_0xea17('0x6'));var path=require('path');var sox=require(_0xea17('0x7'));var csv=require(_0xea17('0x8'));var ejs=require(_0xea17('0x9'));var fs=require('fs');var fs_extra=require(_0xea17('0xa'));var _=require(_0xea17('0xb'));var squel=require(_0xea17('0xc'));var crypto=require('crypto');var jsforce=require(_0xea17('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xea17('0x8'));var querystring=require(_0xea17('0xe'));var Papa=require(_0xea17('0xf'));var Redis=require(_0xea17('0x10'));var authService=require(_0xea17('0x11'));var qs=require(_0xea17('0x12'));var as=require(_0xea17('0x13'));var hardwareService=require(_0xea17('0x14'));var logger=require(_0xea17('0x15'))(_0xea17('0x16'));var utils=require('../../config/utils');var config=require(_0xea17('0x17'));var licenseUtil=require(_0xea17('0x18'));var db=require(_0xea17('0x19'))['db'];function respondWithStatusCode(_0x3a51da,_0x1055a1){_0x1055a1=_0x1055a1||0xcc;return function(_0x203bb2){if(_0x203bb2){return _0x3a51da[_0xea17('0x1a')](_0x1055a1);}return _0x3a51da[_0xea17('0x1b')](_0x1055a1)[_0xea17('0x1c')]();};}function respondWithResult(_0x5bdf03,_0x287660){_0x287660=_0x287660||0xc8;return function(_0x52dbc5){if(_0x52dbc5){return _0x5bdf03[_0xea17('0x1b')](_0x287660)[_0xea17('0x1d')](_0x52dbc5);}};}function respondWithFilteredResult(_0x5b44b1,_0x3b545e){return function(_0x45be24){if(_0x45be24){var _0x357364=typeof _0x3b545e[_0xea17('0x1e')]===_0xea17('0x1f')&&typeof _0x3b545e[_0xea17('0x20')]===_0xea17('0x1f');var _0x5a4916=_0x45be24[_0xea17('0x21')];var _0x437b15=_0x357364?0x0:_0x3b545e['offset'];var _0xbadb40=_0x357364?_0x45be24[_0xea17('0x21')]:_0x3b545e[_0xea17('0x1e')]+_0x3b545e[_0xea17('0x20')];var _0x2f4cca;if(_0xbadb40>=_0x5a4916){_0xbadb40=_0x5a4916;_0x2f4cca=0xc8;}else{_0x2f4cca=0xce;}_0x5b44b1[_0xea17('0x1b')](_0x2f4cca);return _0x5b44b1[_0xea17('0x22')](_0xea17('0x23'),_0x437b15+'-'+_0xbadb40+'/'+_0x5a4916)[_0xea17('0x1d')](_0x45be24);}return null;};}function patchUpdates(_0x353f5e){return function(_0x444198){try{jsonpatch[_0xea17('0x24')](_0x444198,_0x353f5e,!![]);}catch(_0x8bbcfe){return BPromise[_0xea17('0x25')](_0x8bbcfe);}return _0x444198[_0xea17('0x26')]();};}function saveUpdates(_0x5e141e,_0x342388){return function(_0x12b87b){if(_0x12b87b){return _0x12b87b[_0xea17('0x27')](_0x5e141e)[_0xea17('0x28')](function(_0x28b9f0){return _0x28b9f0;});}return null;};}function removeEntity(_0x1194b0,_0x247e91){return function(_0x2ac11b){if(_0x2ac11b){return _0x2ac11b['destroy']()[_0xea17('0x28')](function(){_0x1194b0[_0xea17('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x311305,_0xd04c5b){return function(_0x281936){if(!_0x281936){_0x311305[_0xea17('0x1a')](0x194);}return _0x281936;};}function handleError(_0x46951b,_0x4b18e6){_0x4b18e6=_0x4b18e6||0x1f4;return function(_0x55c36c){logger['error'](_0x55c36c[_0xea17('0x29')]);if(_0x55c36c[_0xea17('0x2a')]){delete _0x55c36c[_0xea17('0x2a')];}_0x46951b['status'](_0x4b18e6)[_0xea17('0x2b')](_0x55c36c);};}exports[_0xea17('0x2c')]=function(_0x425972,_0x3619f7){var _0xc32d61={},_0x102299={},_0x4b0af5={'count':0x0,'rows':[]};var _0xd05c04=_[_0xea17('0x2d')](db[_0xea17('0x2e')][_0xea17('0x2f')],function(_0x44aaf3){return{'name':_0x44aaf3['fieldName'],'type':_0x44aaf3[_0xea17('0x30')][_0xea17('0x31')]};});_0x102299[_0xea17('0x32')]=_['map'](_0xd05c04,_0xea17('0x2a'));_0x102299[_0xea17('0x33')]=_[_0xea17('0x34')](_0x425972[_0xea17('0x33')]);_0x102299['filters']=_[_0xea17('0x35')](_0x102299[_0xea17('0x32')],_0x102299[_0xea17('0x33')]);_0xc32d61[_0xea17('0x36')]=_[_0xea17('0x35')](_0x102299[_0xea17('0x32')],qs['fields'](_0x425972[_0xea17('0x33')]['fields']));_0xc32d61['attributes']=_0xc32d61['attributes'][_0xea17('0x37')]?_0xc32d61[_0xea17('0x36')]:_0x102299[_0xea17('0x32')];if(!_0x425972[_0xea17('0x33')][_0xea17('0x38')]('nolimit')){_0xc32d61['limit']=qs['limit'](_0x425972['query']['limit']);_0xc32d61[_0xea17('0x1e')]=qs['offset'](_0x425972[_0xea17('0x33')]['offset']);}_0xc32d61[_0xea17('0x39')]=qs[_0xea17('0x3a')](_0x425972[_0xea17('0x33')][_0xea17('0x3a')]);_0xc32d61[_0xea17('0x3b')]=qs['filters'](_[_0xea17('0x3c')](_0x425972[_0xea17('0x33')],_0x102299[_0xea17('0x3d')]),_0xd05c04);if(_0x425972[_0xea17('0x33')][_0xea17('0x3e')]){_0xc32d61['where']=_[_0xea17('0x3f')](_0xc32d61[_0xea17('0x3b')],{'$or':_[_0xea17('0x2d')](_0xd05c04,function(_0xea0404){if(_0xea0404['type']!==_0xea17('0x40')){var _0x3dbd5d={};_0x3dbd5d[_0xea0404[_0xea17('0x2a')]]={'$like':'%'+_0x425972[_0xea17('0x33')][_0xea17('0x3e')]+'%'};return _0x3dbd5d;}})});}_0xc32d61=_[_0xea17('0x3f')]({},_0xc32d61,_0x425972['options']);var _0xdb5ecc={'where':_0xc32d61[_0xea17('0x3b')]};return db['JscriptyQuestionReport'][_0xea17('0x21')](_0xdb5ecc)['then'](function(_0x78cae2){_0x4b0af5[_0xea17('0x21')]=_0x78cae2;if(_0x425972[_0xea17('0x33')]['includeAll']){_0xc32d61[_0xea17('0x41')]=[{'all':!![]}];}return db[_0xea17('0x2e')][_0xea17('0x42')](_0xc32d61);})[_0xea17('0x28')](function(_0x1ad746){_0x4b0af5['rows']=_0x1ad746;return _0x4b0af5;})['then'](respondWithFilteredResult(_0x3619f7,_0xc32d61))[_0xea17('0x43')](handleError(_0x3619f7,null));};exports['show']=function(_0xb5300,_0x1cbef8){var _0x190140={'raw':!![],'where':{'id':_0xb5300[_0xea17('0x44')]['id']}},_0x269a0c={};_0x269a0c['model']=_['keys'](db[_0xea17('0x2e')]['rawAttributes']);_0x269a0c['query']=_[_0xea17('0x34')](_0xb5300[_0xea17('0x33')]);_0x269a0c['filters']=_['intersection'](_0x269a0c[_0xea17('0x32')],_0x269a0c[_0xea17('0x33')]);_0x190140['attributes']=_['intersection'](_0x269a0c['model'],qs[_0xea17('0x45')](_0xb5300[_0xea17('0x33')][_0xea17('0x45')]));_0x190140[_0xea17('0x36')]=_0x190140[_0xea17('0x36')]['length']?_0x190140[_0xea17('0x36')]:_0x269a0c[_0xea17('0x32')];if(_0xb5300[_0xea17('0x33')][_0xea17('0x46')]){_0x190140[_0xea17('0x41')]=[{'all':!![]}];}_0x190140=_[_0xea17('0x3f')]({},_0x190140,_0xb5300[_0xea17('0x47')]);return db[_0xea17('0x2e')][_0xea17('0x48')](_0x190140)['then'](handleEntityNotFound(_0x1cbef8,null))['then'](respondWithResult(_0x1cbef8,null))[_0xea17('0x43')](handleError(_0x1cbef8,null));};exports[_0xea17('0x49')]=function(_0xc6e6a8,_0x37ba06){return db[_0xea17('0x2e')][_0xea17('0x49')](_0xc6e6a8['body'],{})[_0xea17('0x28')](respondWithResult(_0x37ba06,0xc9))['catch'](handleError(_0x37ba06,null));};exports[_0xea17('0x27')]=function(_0x2bf638,_0x31c58b){if(_0x2bf638[_0xea17('0x4a')]['id']){delete _0x2bf638[_0xea17('0x4a')]['id'];}return db[_0xea17('0x2e')][_0xea17('0x48')]({'where':{'id':_0x2bf638['params']['id']}})[_0xea17('0x28')](handleEntityNotFound(_0x31c58b,null))[_0xea17('0x28')](saveUpdates(_0x2bf638[_0xea17('0x4a')],null))[_0xea17('0x28')](respondWithResult(_0x31c58b,null))[_0xea17('0x43')](handleError(_0x31c58b,null));};exports[_0xea17('0x4b')]=function(_0x56c97d,_0x3f2769){return db[_0xea17('0x2e')]['find']({'where':{'id':_0x56c97d[_0xea17('0x44')]['id']}})[_0xea17('0x28')](handleEntityNotFound(_0x3f2769,null))[_0xea17('0x28')](removeEntity(_0x3f2769,null))[_0xea17('0x43')](handleError(_0x3f2769,null));};exports['describe']=function(_0x560279,_0x268c1f){return db['JscriptyQuestionReport'][_0xea17('0x4c')]()['then'](respondWithResult(_0x268c1f,null))['catch'](handleError(_0x268c1f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index bac104a..ce6186f 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 _0xae18=['JscriptyQuestionReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define'];(function(_0x199575,_0x2a864c){var _0x450415=function(_0x2c40c6){while(--_0x2c40c6){_0x199575['push'](_0x199575['shift']());}};_0x450415(++_0x2a864c);}(_0xae18,0x1cf));var _0x8ae1=function(_0x204cb4,_0x307c71){_0x204cb4=_0x204cb4-0x0;var _0x327082=_0xae18[_0x204cb4];return _0x327082;};'use strict';var _=require(_0x8ae1('0x0'));var util=require(_0x8ae1('0x1'));var logger=require(_0x8ae1('0x2'))(_0x8ae1('0x3'));var moment=require(_0x8ae1('0x4'));var BPromise=require(_0x8ae1('0x5'));var rp=require(_0x8ae1('0x6'));var fs=require('fs');var path=require(_0x8ae1('0x7'));var rimraf=require(_0x8ae1('0x8'));var config=require(_0x8ae1('0x9'));var attributes=require(_0x8ae1('0xa'));module[_0x8ae1('0xb')]=function(_0x1ce9c8,_0x54a816){return _0x1ce9c8[_0x8ae1('0xc')](_0x8ae1('0xd'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ffc=['rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2f1b55,_0xc81e02){var _0x423a51=function(_0x5c4ecc){while(--_0x5c4ecc){_0x2f1b55['push'](_0x2f1b55['shift']());}};_0x423a51(++_0xc81e02);}(_0x3ffc,0x1a6));var _0xc3ff=function(_0x4ec805,_0x3b8515){_0x4ec805=_0x4ec805-0x0;var _0x386805=_0x3ffc[_0x4ec805];return _0x386805;};'use strict';var _=require(_0xc3ff('0x0'));var util=require('util');var logger=require(_0xc3ff('0x1'))(_0xc3ff('0x2'));var moment=require(_0xc3ff('0x3'));var BPromise=require(_0xc3ff('0x4'));var rp=require(_0xc3ff('0x5'));var fs=require('fs');var path=require(_0xc3ff('0x6'));var rimraf=require(_0xc3ff('0x7'));var config=require(_0xc3ff('0x8'));var attributes=require(_0xc3ff('0x9'));module[_0xc3ff('0xa')]=function(_0x2d062f,_0x61c14a){return _0x2d062f[_0xc3ff('0xb')]('JscriptyQuestionReport',attributes,{'tableName':_0xc3ff('0xc'),'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 92b63e6..8bd0863 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 _0x44da=['http','request','info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','JscriptyQuestionReport,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x9f740c,_0x3381e4){var _0x4883b0=function(_0x29371b){while(--_0x29371b){_0x9f740c['push'](_0x9f740c['shift']());}};_0x4883b0(++_0x3381e4);}(_0x44da,0xe7));var _0xa44d=function(_0x36e81f,_0x1631b8){_0x36e81f=_0x36e81f-0x0;var _0x51d1f2=_0x44da[_0x36e81f];return _0x51d1f2;};'use strict';var _=require(_0xa44d('0x0'));var util=require('util');var moment=require(_0xa44d('0x1'));var BPromise=require(_0xa44d('0x2'));var rs=require(_0xa44d('0x3'));var fs=require('fs');var Redis=require(_0xa44d('0x4'));var db=require(_0xa44d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa44d('0x6'))(_0xa44d('0x7'));var config=require(_0xa44d('0x8'));var jayson=require(_0xa44d('0x9'));var client=jayson[_0xa44d('0xa')][_0xa44d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a5957,_0x27aa7c,_0x8f27ad){return new BPromise(function(_0x54a559,_0x5c2ce0){return client[_0xa44d('0xc')](_0x5a5957,_0x8f27ad)['then'](function(_0x3b4072){logger[_0xa44d('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x27aa7c,_0xa44d('0xe'));logger[_0xa44d('0xf')](_0xa44d('0x10'),_0x27aa7c,_0xa44d('0xe'),JSON[_0xa44d('0x11')](_0x3b4072));if(_0x3b4072[_0xa44d('0x12')]){if(_0x3b4072['error']['code']===0x1f4){logger[_0xa44d('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x27aa7c,_0x3b4072[_0xa44d('0x12')][_0xa44d('0x13')]);return _0x5c2ce0(_0x3b4072['error'][_0xa44d('0x13')]);}logger['error'](_0xa44d('0x14'),_0x27aa7c,_0x3b4072[_0xa44d('0x12')][_0xa44d('0x13')]);return _0x54a559(_0x3b4072[_0xa44d('0x12')][_0xa44d('0x13')]);}else{logger[_0xa44d('0xd')](_0xa44d('0x14'),_0x27aa7c,_0xa44d('0xe'));_0x54a559(_0x3b4072['result']['message']);}})[_0xa44d('0x15')](function(_0x465dc4){logger[_0xa44d('0x12')](_0xa44d('0x14'),_0x27aa7c,_0x465dc4);_0x5c2ce0(_0x465dc4);});});} \ No newline at end of file +var _0x112c=['debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x42351a,_0x1ac026){var _0x429224=function(_0x3602e9){while(--_0x3602e9){_0x42351a['push'](_0x42351a['shift']());}};_0x429224(++_0x1ac026);}(_0x112c,0x165));var _0xc112=function(_0x4fab85,_0x3fb6af){_0x4fab85=_0x4fab85-0x0;var _0x399b0f=_0x112c[_0x4fab85];return _0x399b0f;};'use strict';var _=require(_0xc112('0x0'));var util=require(_0xc112('0x1'));var moment=require(_0xc112('0x2'));var BPromise=require(_0xc112('0x3'));var rs=require(_0xc112('0x4'));var fs=require('fs');var Redis=require(_0xc112('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc112('0x6'));var logger=require(_0xc112('0x7'))(_0xc112('0x8'));var config=require(_0xc112('0x9'));var jayson=require(_0xc112('0xa'));var client=jayson[_0xc112('0xb')][_0xc112('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xffd99f,_0x2ce6d8,_0x5d1559){return new BPromise(function(_0x1bfde7,_0x148860){return client[_0xc112('0xd')](_0xffd99f,_0x5d1559)[_0xc112('0xe')](function(_0x33b923){logger[_0xc112('0xf')](_0xc112('0x10'),_0x2ce6d8,_0xc112('0x11'));logger[_0xc112('0x12')](_0xc112('0x13'),_0x2ce6d8,_0xc112('0x11'),JSON[_0xc112('0x14')](_0x33b923));if(_0x33b923[_0xc112('0x15')]){if(_0x33b923['error'][_0xc112('0x16')]===0x1f4){logger[_0xc112('0x15')](_0xc112('0x10'),_0x2ce6d8,_0x33b923[_0xc112('0x15')][_0xc112('0x17')]);return _0x148860(_0x33b923[_0xc112('0x15')]['message']);}logger[_0xc112('0x15')](_0xc112('0x10'),_0x2ce6d8,_0x33b923[_0xc112('0x15')][_0xc112('0x17')]);return _0x1bfde7(_0x33b923['error'][_0xc112('0x17')]);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x2ce6d8,_0xc112('0x11'));_0x1bfde7(_0x33b923[_0xc112('0x18')][_0xc112('0x17')]);}})['catch'](function(_0x3770d5){logger[_0xc112('0x15')](_0xc112('0x10'),_0x2ce6d8,_0x3770d5);_0x148860(_0x3770d5);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 9e4a99f..125b64f 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 _0xc76e=['destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getQuestions','post','create','put','delete'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc76e,0x1e6));var _0xec76=function(_0x37089b,_0x3550dd){_0x37089b=_0x37089b-0x0;var _0x4bf15f=_0xc76e[_0x37089b];return _0x4bf15f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xec76('0x0'));var timeout=require(_0xec76('0x1'));var express=require('express');var router=express[_0xec76('0x2')]();var fs_extra=require(_0xec76('0x3'));var auth=require(_0xec76('0x4'));var interaction=require(_0xec76('0x5'));var config=require(_0xec76('0x6'));var controller=require(_0xec76('0x7'));router[_0xec76('0x8')]('/',auth[_0xec76('0x9')](),controller[_0xec76('0xa')]);router[_0xec76('0x8')](_0xec76('0xb'),auth[_0xec76('0x9')](),controller[_0xec76('0xc')]);router[_0xec76('0x8')](_0xec76('0xd'),auth[_0xec76('0x9')](),controller[_0xec76('0xe')]);router['get']('/:id/questions',auth[_0xec76('0x9')](),controller[_0xec76('0xf')]);router[_0xec76('0x10')]('/',auth['isAuthenticated'](),controller[_0xec76('0x11')]);router[_0xec76('0x12')](_0xec76('0xd'),auth[_0xec76('0x9')](),controller['update']);router[_0xec76('0x13')](_0xec76('0xd'),auth['isAuthenticated'](),controller[_0xec76('0x14')]);module[_0xec76('0x15')]=router; \ No newline at end of file +var _0xca0d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','getQuestions','post','/:id','update','destroy','util','path','connect-timeout','express','Router'];(function(_0xe9ed1,_0x2209ee){var _0x468c7d=function(_0x7bd2db){while(--_0x7bd2db){_0xe9ed1['push'](_0xe9ed1['shift']());}};_0x468c7d(++_0x2209ee);}(_0xca0d,0x1e9));var _0xdca0=function(_0x2d33b9,_0xc280bb){_0x2d33b9=_0x2d33b9-0x0;var _0x4e12d6=_0xca0d[_0x2d33b9];return _0x4e12d6;};'use strict';var multer=require('multer');var util=require(_0xdca0('0x0'));var path=require(_0xdca0('0x1'));var timeout=require(_0xdca0('0x2'));var express=require(_0xdca0('0x3'));var router=express[_0xdca0('0x4')]();var fs_extra=require(_0xdca0('0x5'));var auth=require(_0xdca0('0x6'));var interaction=require(_0xdca0('0x7'));var config=require(_0xdca0('0x8'));var controller=require('./jscriptySessionReport.controller');router[_0xdca0('0x9')]('/',auth[_0xdca0('0xa')](),controller[_0xdca0('0xb')]);router[_0xdca0('0x9')](_0xdca0('0xc'),auth['isAuthenticated'](),controller[_0xdca0('0xd')]);router[_0xdca0('0x9')]('/:id',auth[_0xdca0('0xa')](),controller['show']);router[_0xdca0('0x9')]('/:id/questions',auth['isAuthenticated'](),controller[_0xdca0('0xe')]);router[_0xdca0('0xf')]('/',auth[_0xdca0('0xa')](),controller['create']);router['put'](_0xdca0('0x10'),auth[_0xdca0('0xa')](),controller[_0xdca0('0x11')]);router['delete'](_0xdca0('0x10'),auth['isAuthenticated'](),controller[_0xdca0('0x12')]);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 2a04aa2..f8326ee 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 _0xcb74=['STRING','moment','sequelize','exports','DATE','starttime','setDataValue','endtime','format'];(function(_0x903cb5,_0x5db988){var _0x53e2b6=function(_0x4cd0f4){while(--_0x4cd0f4){_0x903cb5['push'](_0x903cb5['shift']());}};_0x53e2b6(++_0x5db988);}(_0xcb74,0x7f));var _0x4cb7=function(_0x5dfaa8,_0x11c0f4){_0x5dfaa8=_0x5dfaa8-0x0;var _0x3adb96=_0xcb74[_0x5dfaa8];return _0x3adb96;};'use strict';var moment=require(_0x4cb7('0x0'));var Sequelize=require(_0x4cb7('0x1'));module[_0x4cb7('0x2')]={'starttime':{'type':Sequelize[_0x4cb7('0x3')],'set':function(_0x33fab6){this['setDataValue'](_0x4cb7('0x4'),_0x33fab6);this[_0x4cb7('0x5')](_0x4cb7('0x6'),moment()[_0x4cb7('0x7')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x4cb7('0x3')]},'membername':{'type':Sequelize[_0x4cb7('0x8')]},'projectname':{'type':Sequelize[_0x4cb7('0x8')]},'queue':{'type':Sequelize[_0x4cb7('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4cb7('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6370=['moment','sequelize','DATE','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x4b899d,_0xaa6efe){var _0x1e791b=function(_0x5aad95){while(--_0x5aad95){_0x4b899d['push'](_0x4b899d['shift']());}};_0x1e791b(++_0xaa6efe);}(_0x6370,0x99));var _0x0637=function(_0x50b634,_0x1a9974){_0x50b634=_0x50b634-0x0;var _0xcbb832=_0x6370[_0x50b634];return _0xcbb832;};'use strict';var moment=require(_0x0637('0x0'));var Sequelize=require(_0x0637('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x0637('0x2')],'set':function(_0x2e5fca){this[_0x0637('0x3')]('starttime',_0x2e5fca);this[_0x0637('0x3')](_0x0637('0x4'),moment()[_0x0637('0x5')](_0x0637('0x6')));}},'endtime':{'type':Sequelize[_0x0637('0x2')]},'membername':{'type':Sequelize[_0x0637('0x7')]},'projectname':{'type':Sequelize[_0x0637('0x7')]},'queue':{'type':Sequelize[_0x0637('0x7')]},'uniqueid':{'type':Sequelize[_0x0637('0x7')]},'calleridname':{'type':Sequelize[_0x0637('0x7')]},'calleridnum':{'type':Sequelize[_0x0637('0x7')]},'completed':{'type':Sequelize[_0x0637('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index d79c760..12748c4 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 _0x2744=['JscriptySessionReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','type','merge','options','where','include','findAll','rows','catch','params','length','includeAll','find','create','body','describe','getQuestions','findOne','hasOwnProperty','JscriptyQuestionReport','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','map'];(function(_0x1ab40e,_0x16d1e8){var _0x19cb83=function(_0x49eda7){while(--_0x49eda7){_0x1ab40e['push'](_0x1ab40e['shift']());}};_0x19cb83(++_0x16d1e8);}(_0x2744,0x1f1));var _0x4274=function(_0x4eb9d3,_0x379b7e){_0x4eb9d3=_0x4eb9d3-0x0;var _0x2533da=_0x2744[_0x4eb9d3];return _0x2533da;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4274('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4274('0x1'));var rp=require('request-promise');var moment=require(_0x4274('0x2'));var BPromise=require(_0x4274('0x3'));var Mustache=require(_0x4274('0x4'));var util=require(_0x4274('0x5'));var path=require(_0x4274('0x6'));var sox=require('sox');var csv=require(_0x4274('0x7'));var ejs=require(_0x4274('0x8'));var fs=require('fs');var fs_extra=require(_0x4274('0x9'));var _=require(_0x4274('0xa'));var squel=require(_0x4274('0xb'));var crypto=require(_0x4274('0xc'));var jsforce=require(_0x4274('0xd'));var deskjs=require(_0x4274('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4274('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4274('0x10'));var as=require(_0x4274('0x11'));var hardwareService=require(_0x4274('0x12'));var logger=require(_0x4274('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4274('0x14'));var licenseUtil=require(_0x4274('0x15'));var db=require(_0x4274('0x16'))['db'];function respondWithStatusCode(_0xc3d8ce,_0x31116f){_0x31116f=_0x31116f||0xcc;return function(_0xeaf44c){if(_0xeaf44c){return _0xc3d8ce[_0x4274('0x17')](_0x31116f);}return _0xc3d8ce[_0x4274('0x18')](_0x31116f)[_0x4274('0x19')]();};}function respondWithResult(_0x5c33f9,_0x39bf9e){_0x39bf9e=_0x39bf9e||0xc8;return function(_0xd35ade){if(_0xd35ade){return _0x5c33f9['status'](_0x39bf9e)[_0x4274('0x1a')](_0xd35ade);}};}function respondWithFilteredResult(_0x41ef64,_0x1dec7c){return function(_0x39b2cf){if(_0x39b2cf){var _0x2998cc=typeof _0x1dec7c[_0x4274('0x1b')]===_0x4274('0x1c')&&typeof _0x1dec7c['limit']===_0x4274('0x1c');var _0x203bea=_0x39b2cf[_0x4274('0x1d')];var _0x47907f=_0x2998cc?0x0:_0x1dec7c[_0x4274('0x1b')];var _0x1cbe50=_0x2998cc?_0x39b2cf['count']:_0x1dec7c[_0x4274('0x1b')]+_0x1dec7c[_0x4274('0x1e')];var _0xc2bb09;if(_0x1cbe50>=_0x203bea){_0x1cbe50=_0x203bea;_0xc2bb09=0xc8;}else{_0xc2bb09=0xce;}_0x41ef64['status'](_0xc2bb09);return _0x41ef64[_0x4274('0x1f')](_0x4274('0x20'),_0x47907f+'-'+_0x1cbe50+'/'+_0x203bea)['json'](_0x39b2cf);}return null;};}function patchUpdates(_0x3fbcd9){return function(_0x348d7a){try{jsonpatch['apply'](_0x348d7a,_0x3fbcd9,!![]);}catch(_0xb1e3e3){return BPromise[_0x4274('0x21')](_0xb1e3e3);}return _0x348d7a['save']();};}function saveUpdates(_0x32ac8a,_0x4f6b8d){return function(_0x5b9cb9){if(_0x5b9cb9){return _0x5b9cb9[_0x4274('0x22')](_0x32ac8a)[_0x4274('0x23')](function(_0xde4eaa){return _0xde4eaa;});}return null;};}function removeEntity(_0x22f633,_0x43db24){return function(_0x35980a){if(_0x35980a){return _0x35980a[_0x4274('0x24')]()[_0x4274('0x23')](function(){_0x22f633[_0x4274('0x18')](0xcc)[_0x4274('0x19')]();});}};}function handleEntityNotFound(_0x592799,_0xdad225){return function(_0x539fe4){if(!_0x539fe4){_0x592799[_0x4274('0x17')](0x194);}return _0x539fe4;};}function handleError(_0x4e3fbc,_0x58fce3){_0x58fce3=_0x58fce3||0x1f4;return function(_0x236d37){logger[_0x4274('0x25')](_0x236d37[_0x4274('0x26')]);if(_0x236d37[_0x4274('0x27')]){delete _0x236d37[_0x4274('0x27')];}_0x4e3fbc[_0x4274('0x18')](_0x58fce3)[_0x4274('0x28')](_0x236d37);};}exports['index']=function(_0x3e0a12,_0xee0845){var _0x362965={},_0x29d0a1={},_0x3cb132={'count':0x0,'rows':[]};var _0x135883=_[_0x4274('0x29')](db[_0x4274('0x2a')][_0x4274('0x2b')],function(_0xf6500c){return{'name':_0xf6500c[_0x4274('0x2c')],'type':_0xf6500c['type'][_0x4274('0x2d')]};});_0x29d0a1[_0x4274('0x2e')]=_[_0x4274('0x29')](_0x135883,_0x4274('0x27'));_0x29d0a1[_0x4274('0x2f')]=_[_0x4274('0x30')](_0x3e0a12[_0x4274('0x2f')]);_0x29d0a1[_0x4274('0x31')]=_[_0x4274('0x32')](_0x29d0a1[_0x4274('0x2e')],_0x29d0a1[_0x4274('0x2f')]);_0x362965[_0x4274('0x33')]=_[_0x4274('0x32')](_0x29d0a1[_0x4274('0x2e')],qs['fields'](_0x3e0a12[_0x4274('0x2f')][_0x4274('0x34')]));_0x362965[_0x4274('0x33')]=_0x362965[_0x4274('0x33')]['length']?_0x362965['attributes']:_0x29d0a1['model'];if(!_0x3e0a12[_0x4274('0x2f')]['hasOwnProperty'](_0x4274('0x35'))){_0x362965['limit']=qs[_0x4274('0x1e')](_0x3e0a12[_0x4274('0x2f')][_0x4274('0x1e')]);_0x362965['offset']=qs[_0x4274('0x1b')](_0x3e0a12[_0x4274('0x2f')][_0x4274('0x1b')]);}_0x362965[_0x4274('0x36')]=qs[_0x4274('0x37')](_0x3e0a12['query'][_0x4274('0x37')]);_0x362965['where']=qs[_0x4274('0x31')](_[_0x4274('0x38')](_0x3e0a12[_0x4274('0x2f')],_0x29d0a1['filters']),_0x135883);if(_0x3e0a12[_0x4274('0x2f')][_0x4274('0x39')]){_0x362965['where']=_['merge'](_0x362965['where'],{'$or':_['map'](_0x135883,function(_0x53c02f){if(_0x53c02f[_0x4274('0x3a')]!=='VIRTUAL'){var _0x525fb0={};_0x525fb0[_0x53c02f['name']]={'$like':'%'+_0x3e0a12[_0x4274('0x2f')][_0x4274('0x39')]+'%'};return _0x525fb0;}})});}_0x362965=_[_0x4274('0x3b')]({},_0x362965,_0x3e0a12[_0x4274('0x3c')]);var _0x46f807={'where':_0x362965[_0x4274('0x3d')]};return db[_0x4274('0x2a')][_0x4274('0x1d')](_0x46f807)[_0x4274('0x23')](function(_0x3cb0aa){_0x3cb132[_0x4274('0x1d')]=_0x3cb0aa;if(_0x3e0a12['query']['includeAll']){_0x362965[_0x4274('0x3e')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x4274('0x3f')](_0x362965);})[_0x4274('0x23')](function(_0x3b401b){_0x3cb132[_0x4274('0x40')]=_0x3b401b;return _0x3cb132;})[_0x4274('0x23')](respondWithFilteredResult(_0xee0845,_0x362965))[_0x4274('0x41')](handleError(_0xee0845,null));};exports['show']=function(_0x2866c3,_0x2a0ce5){var _0xffdeed={'raw':!![],'where':{'id':_0x2866c3[_0x4274('0x42')]['id']}},_0x392dfc={};_0x392dfc[_0x4274('0x2e')]=_[_0x4274('0x30')](db[_0x4274('0x2a')][_0x4274('0x2b')]);_0x392dfc[_0x4274('0x2f')]=_['keys'](_0x2866c3[_0x4274('0x2f')]);_0x392dfc[_0x4274('0x31')]=_['intersection'](_0x392dfc[_0x4274('0x2e')],_0x392dfc[_0x4274('0x2f')]);_0xffdeed[_0x4274('0x33')]=_[_0x4274('0x32')](_0x392dfc['model'],qs['fields'](_0x2866c3['query'][_0x4274('0x34')]));_0xffdeed[_0x4274('0x33')]=_0xffdeed[_0x4274('0x33')][_0x4274('0x43')]?_0xffdeed[_0x4274('0x33')]:_0x392dfc[_0x4274('0x2e')];if(_0x2866c3[_0x4274('0x2f')][_0x4274('0x44')]){_0xffdeed[_0x4274('0x3e')]=[{'all':!![]}];}_0xffdeed=_[_0x4274('0x3b')]({},_0xffdeed,_0x2866c3['options']);return db[_0x4274('0x2a')][_0x4274('0x45')](_0xffdeed)[_0x4274('0x23')](handleEntityNotFound(_0x2a0ce5,null))[_0x4274('0x23')](respondWithResult(_0x2a0ce5,null))[_0x4274('0x41')](handleError(_0x2a0ce5,null));};exports[_0x4274('0x46')]=function(_0x5a6220,_0x312926){return db['JscriptySessionReport']['create'](_0x5a6220[_0x4274('0x47')],{})[_0x4274('0x23')](respondWithResult(_0x312926,0xc9))['catch'](handleError(_0x312926,null));};exports['update']=function(_0x3e1f12,_0x80c605){if(_0x3e1f12[_0x4274('0x47')]['id']){delete _0x3e1f12[_0x4274('0x47')]['id'];}return db[_0x4274('0x2a')][_0x4274('0x45')]({'where':{'id':_0x3e1f12[_0x4274('0x42')]['id']}})['then'](handleEntityNotFound(_0x80c605,null))[_0x4274('0x23')](saveUpdates(_0x3e1f12['body'],null))[_0x4274('0x23')](respondWithResult(_0x80c605,null))[_0x4274('0x41')](handleError(_0x80c605,null));};exports[_0x4274('0x24')]=function(_0x57ae87,_0x4d15e4){return db[_0x4274('0x2a')][_0x4274('0x45')]({'where':{'id':_0x57ae87['params']['id']}})[_0x4274('0x23')](handleEntityNotFound(_0x4d15e4,null))[_0x4274('0x23')](removeEntity(_0x4d15e4,null))[_0x4274('0x41')](handleError(_0x4d15e4,null));};exports[_0x4274('0x48')]=function(_0x3bbb75,_0x3cd5f9){return db[_0x4274('0x2a')][_0x4274('0x48')]()[_0x4274('0x23')](respondWithResult(_0x3cd5f9,null))[_0x4274('0x41')](handleError(_0x3cd5f9,null));};exports[_0x4274('0x49')]=function(_0x50145b,_0x233560,_0x206b8b){var _0x42abf9={'raw':!![],'where':{}};var _0x291ccd={};var _0x13087c={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x4274('0x4a')]({'where':{'id':_0x50145b[_0x4274('0x42')]['id']}})[_0x4274('0x23')](handleEntityNotFound(_0x233560,null))['then'](function(_0x1fa9a6){if(_0x1fa9a6){_0x291ccd['model']=_[_0x4274('0x30')](db['JscriptyQuestionReport'][_0x4274('0x2b')]);_0x291ccd[_0x4274('0x2f')]=_[_0x4274('0x30')](_0x50145b[_0x4274('0x2f')]);_0x291ccd[_0x4274('0x31')]=_[_0x4274('0x32')](_0x291ccd[_0x4274('0x2e')],_0x291ccd['query']);_0x42abf9[_0x4274('0x33')]=_[_0x4274('0x32')](_0x291ccd[_0x4274('0x2e')],qs[_0x4274('0x34')](_0x50145b['query']['fields']));_0x42abf9[_0x4274('0x33')]=_0x42abf9['attributes'][_0x4274('0x43')]?_0x42abf9[_0x4274('0x33')]:_0x291ccd[_0x4274('0x2e')];if(!_0x50145b[_0x4274('0x2f')][_0x4274('0x4b')](_0x4274('0x35'))){_0x42abf9['limit']=qs[_0x4274('0x1e')](_0x50145b[_0x4274('0x2f')]['limit']);_0x42abf9[_0x4274('0x1b')]=qs[_0x4274('0x1b')](_0x50145b[_0x4274('0x2f')][_0x4274('0x1b')]);}_0x42abf9['order']=qs[_0x4274('0x37')](_0x50145b['query'][_0x4274('0x37')]);_0x42abf9[_0x4274('0x3d')]=qs[_0x4274('0x31')](_[_0x4274('0x38')](_0x50145b[_0x4274('0x2f')],_0x291ccd[_0x4274('0x31')]));_0x42abf9[_0x4274('0x3d')]['SessionId']=_0x1fa9a6['id'];if(_0x50145b['query'][_0x4274('0x39')]){_0x42abf9['where']=_['merge'](_0x42abf9[_0x4274('0x3d')],{'$or':_[_0x4274('0x29')](_0x42abf9[_0x4274('0x33')],function(_0x36248d){var _0x2cdd93={};_0x2cdd93[_0x36248d]={'$like':'%'+_0x50145b[_0x4274('0x2f')][_0x4274('0x39')]+'%'};return _0x2cdd93;})});}_0x42abf9=_['merge']({},_0x42abf9,_0x50145b['options']);return db[_0x4274('0x4c')][_0x4274('0x1d')]({'where':_0x42abf9[_0x4274('0x3d')]})[_0x4274('0x23')](function(_0x409a77){_0x13087c[_0x4274('0x1d')]=_0x409a77;if(_0x50145b[_0x4274('0x2f')]['includeAll']){_0x42abf9[_0x4274('0x3e')]=[{'all':!![]}];}return db[_0x4274('0x4c')][_0x4274('0x3f')](_0x42abf9);})[_0x4274('0x23')](function(_0x37035b){_0x13087c[_0x4274('0x40')]=_0x37035b;return _0x13087c;});}})[_0x4274('0x23')](respondWithFilteredResult(_0x233560,_0x42abf9))[_0x4274('0x41')](handleError(_0x233560,null));}; \ No newline at end of file +var _0x77c3=['rows','rimraf','zip-dir','moment','mustache','util','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','limit','count','status','set','apply','reject','save','update','destroy','then','end','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','JscriptySessionReport','include','findAll','params','length','includeAll','find','catch','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty'];(function(_0xcd7bba,_0x2e3c48){var _0xe0e52d=function(_0x22fcf9){while(--_0x22fcf9){_0xcd7bba['push'](_0xcd7bba['shift']());}};_0xe0e52d(++_0x2e3c48);}(_0x77c3,0x17d));var _0x377c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77c3[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x377c('0x0'));var zipdir=require(_0x377c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x377c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x377c('0x3'));var util=require(_0x377c('0x4'));var path=require('path');var sox=require(_0x377c('0x5'));var csv=require(_0x377c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x377c('0x7'));var _=require('lodash');var squel=require(_0x377c('0x8'));var crypto=require(_0x377c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x377c('0xa'));var toCsv=require(_0x377c('0x6'));var querystring=require(_0x377c('0xb'));var Papa=require(_0x377c('0xc'));var Redis=require(_0x377c('0xd'));var authService=require(_0x377c('0xe'));var qs=require(_0x377c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x377c('0x10'));var logger=require('../../config/logger')(_0x377c('0x11'));var utils=require(_0x377c('0x12'));var config=require(_0x377c('0x13'));var licenseUtil=require(_0x377c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x343849,_0x1066b6){_0x1066b6=_0x1066b6||0xcc;return function(_0x12b760){if(_0x12b760){return _0x343849[_0x377c('0x15')](_0x1066b6);}return _0x343849['status'](_0x1066b6)['end']();};}function respondWithResult(_0x5742d9,_0x123e58){_0x123e58=_0x123e58||0xc8;return function(_0x5d906c){if(_0x5d906c){return _0x5742d9['status'](_0x123e58)[_0x377c('0x16')](_0x5d906c);}};}function respondWithFilteredResult(_0x5e45ba,_0x38b4fb){return function(_0x482b46){if(_0x482b46){var _0x533633=typeof _0x38b4fb[_0x377c('0x17')]===_0x377c('0x18')&&typeof _0x38b4fb[_0x377c('0x19')]==='undefined';var _0x40ab1f=_0x482b46[_0x377c('0x1a')];var _0xeb4c61=_0x533633?0x0:_0x38b4fb[_0x377c('0x17')];var _0x59fc2f=_0x533633?_0x482b46[_0x377c('0x1a')]:_0x38b4fb['offset']+_0x38b4fb['limit'];var _0xf6256a;if(_0x59fc2f>=_0x40ab1f){_0x59fc2f=_0x40ab1f;_0xf6256a=0xc8;}else{_0xf6256a=0xce;}_0x5e45ba[_0x377c('0x1b')](_0xf6256a);return _0x5e45ba[_0x377c('0x1c')]('Content-Range',_0xeb4c61+'-'+_0x59fc2f+'/'+_0x40ab1f)[_0x377c('0x16')](_0x482b46);}return null;};}function patchUpdates(_0x1a6e88){return function(_0x2e67b7){try{jsonpatch[_0x377c('0x1d')](_0x2e67b7,_0x1a6e88,!![]);}catch(_0x1b6d99){return BPromise[_0x377c('0x1e')](_0x1b6d99);}return _0x2e67b7[_0x377c('0x1f')]();};}function saveUpdates(_0x55eeff,_0x3a6b1a){return function(_0x4d1558){if(_0x4d1558){return _0x4d1558[_0x377c('0x20')](_0x55eeff)['then'](function(_0x84c619){return _0x84c619;});}return null;};}function removeEntity(_0x49256b,_0x58e833){return function(_0x545bf9){if(_0x545bf9){return _0x545bf9[_0x377c('0x21')]()[_0x377c('0x22')](function(){_0x49256b['status'](0xcc)[_0x377c('0x23')]();});}};}function handleEntityNotFound(_0x2139e5,_0x44b698){return function(_0x3a2682){if(!_0x3a2682){_0x2139e5[_0x377c('0x15')](0x194);}return _0x3a2682;};}function handleError(_0x2f1447,_0x3853e2){_0x3853e2=_0x3853e2||0x1f4;return function(_0x91d3b){logger[_0x377c('0x24')](_0x91d3b[_0x377c('0x25')]);if(_0x91d3b[_0x377c('0x26')]){delete _0x91d3b['name'];}_0x2f1447['status'](_0x3853e2)['send'](_0x91d3b);};}exports[_0x377c('0x27')]=function(_0x3f6593,_0x501386){var _0x326b2a={},_0xc4a4cb={},_0x51c2f7={'count':0x0,'rows':[]};var _0xe2d1d1=_['map'](db['JscriptySessionReport'][_0x377c('0x28')],function(_0x5c963e){return{'name':_0x5c963e[_0x377c('0x29')],'type':_0x5c963e[_0x377c('0x2a')][_0x377c('0x2b')]};});_0xc4a4cb[_0x377c('0x2c')]=_[_0x377c('0x2d')](_0xe2d1d1,_0x377c('0x26'));_0xc4a4cb[_0x377c('0x2e')]=_[_0x377c('0x2f')](_0x3f6593[_0x377c('0x2e')]);_0xc4a4cb[_0x377c('0x30')]=_[_0x377c('0x31')](_0xc4a4cb['model'],_0xc4a4cb[_0x377c('0x2e')]);_0x326b2a[_0x377c('0x32')]=_['intersection'](_0xc4a4cb['model'],qs[_0x377c('0x33')](_0x3f6593[_0x377c('0x2e')][_0x377c('0x33')]));_0x326b2a[_0x377c('0x32')]=_0x326b2a[_0x377c('0x32')]['length']?_0x326b2a['attributes']:_0xc4a4cb[_0x377c('0x2c')];if(!_0x3f6593[_0x377c('0x2e')]['hasOwnProperty'](_0x377c('0x34'))){_0x326b2a[_0x377c('0x19')]=qs[_0x377c('0x19')](_0x3f6593['query'][_0x377c('0x19')]);_0x326b2a[_0x377c('0x17')]=qs[_0x377c('0x17')](_0x3f6593[_0x377c('0x2e')][_0x377c('0x17')]);}_0x326b2a[_0x377c('0x35')]=qs['sort'](_0x3f6593[_0x377c('0x2e')][_0x377c('0x36')]);_0x326b2a[_0x377c('0x37')]=qs[_0x377c('0x30')](_[_0x377c('0x38')](_0x3f6593[_0x377c('0x2e')],_0xc4a4cb['filters']),_0xe2d1d1);if(_0x3f6593[_0x377c('0x2e')][_0x377c('0x39')]){_0x326b2a[_0x377c('0x37')]=_[_0x377c('0x3a')](_0x326b2a[_0x377c('0x37')],{'$or':_[_0x377c('0x2d')](_0xe2d1d1,function(_0x51bb98){if(_0x51bb98[_0x377c('0x2a')]!=='VIRTUAL'){var _0x2cc15b={};_0x2cc15b[_0x51bb98[_0x377c('0x26')]]={'$like':'%'+_0x3f6593[_0x377c('0x2e')][_0x377c('0x39')]+'%'};return _0x2cc15b;}})});}_0x326b2a=_[_0x377c('0x3a')]({},_0x326b2a,_0x3f6593[_0x377c('0x3b')]);var _0x531069={'where':_0x326b2a[_0x377c('0x37')]};return db[_0x377c('0x3c')][_0x377c('0x1a')](_0x531069)[_0x377c('0x22')](function(_0xfc163f){_0x51c2f7[_0x377c('0x1a')]=_0xfc163f;if(_0x3f6593['query']['includeAll']){_0x326b2a[_0x377c('0x3d')]=[{'all':!![]}];}return db[_0x377c('0x3c')][_0x377c('0x3e')](_0x326b2a);})[_0x377c('0x22')](function(_0x2903e8){_0x51c2f7['rows']=_0x2903e8;return _0x51c2f7;})[_0x377c('0x22')](respondWithFilteredResult(_0x501386,_0x326b2a))['catch'](handleError(_0x501386,null));};exports['show']=function(_0x35e2ad,_0x5bda4c){var _0x5a1538={'raw':!![],'where':{'id':_0x35e2ad[_0x377c('0x3f')]['id']}},_0x50e007={};_0x50e007['model']=_['keys'](db[_0x377c('0x3c')][_0x377c('0x28')]);_0x50e007[_0x377c('0x2e')]=_[_0x377c('0x2f')](_0x35e2ad['query']);_0x50e007['filters']=_[_0x377c('0x31')](_0x50e007[_0x377c('0x2c')],_0x50e007[_0x377c('0x2e')]);_0x5a1538['attributes']=_['intersection'](_0x50e007[_0x377c('0x2c')],qs[_0x377c('0x33')](_0x35e2ad[_0x377c('0x2e')][_0x377c('0x33')]));_0x5a1538[_0x377c('0x32')]=_0x5a1538['attributes'][_0x377c('0x40')]?_0x5a1538[_0x377c('0x32')]:_0x50e007[_0x377c('0x2c')];if(_0x35e2ad[_0x377c('0x2e')][_0x377c('0x41')]){_0x5a1538['include']=[{'all':!![]}];}_0x5a1538=_[_0x377c('0x3a')]({},_0x5a1538,_0x35e2ad[_0x377c('0x3b')]);return db[_0x377c('0x3c')][_0x377c('0x42')](_0x5a1538)[_0x377c('0x22')](handleEntityNotFound(_0x5bda4c,null))[_0x377c('0x22')](respondWithResult(_0x5bda4c,null))[_0x377c('0x43')](handleError(_0x5bda4c,null));};exports[_0x377c('0x44')]=function(_0x1d4fab,_0x40da36){return db[_0x377c('0x3c')]['create'](_0x1d4fab[_0x377c('0x45')],{})[_0x377c('0x22')](respondWithResult(_0x40da36,0xc9))[_0x377c('0x43')](handleError(_0x40da36,null));};exports[_0x377c('0x20')]=function(_0x3e2263,_0x18a15d){if(_0x3e2263[_0x377c('0x45')]['id']){delete _0x3e2263[_0x377c('0x45')]['id'];}return db[_0x377c('0x3c')][_0x377c('0x42')]({'where':{'id':_0x3e2263[_0x377c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x18a15d,null))['then'](saveUpdates(_0x3e2263[_0x377c('0x45')],null))['then'](respondWithResult(_0x18a15d,null))['catch'](handleError(_0x18a15d,null));};exports[_0x377c('0x21')]=function(_0x1212b9,_0x5b8409){return db[_0x377c('0x3c')][_0x377c('0x42')]({'where':{'id':_0x1212b9[_0x377c('0x3f')]['id']}})[_0x377c('0x22')](handleEntityNotFound(_0x5b8409,null))[_0x377c('0x22')](removeEntity(_0x5b8409,null))[_0x377c('0x43')](handleError(_0x5b8409,null));};exports[_0x377c('0x46')]=function(_0x20f5de,_0x1d3a43){return db['JscriptySessionReport']['describe']()['then'](respondWithResult(_0x1d3a43,null))[_0x377c('0x43')](handleError(_0x1d3a43,null));};exports[_0x377c('0x47')]=function(_0x5b61cb,_0x16f5be,_0x3269c9){var _0x312a67={'raw':!![],'where':{}};var _0x3f8e76={};var _0x4800c4={'count':0x0,'rows':[]};return db[_0x377c('0x3c')][_0x377c('0x48')]({'where':{'id':_0x5b61cb[_0x377c('0x3f')]['id']}})[_0x377c('0x22')](handleEntityNotFound(_0x16f5be,null))['then'](function(_0x4f7a75){if(_0x4f7a75){_0x3f8e76[_0x377c('0x2c')]=_[_0x377c('0x2f')](db[_0x377c('0x49')][_0x377c('0x28')]);_0x3f8e76[_0x377c('0x2e')]=_[_0x377c('0x2f')](_0x5b61cb[_0x377c('0x2e')]);_0x3f8e76[_0x377c('0x30')]=_['intersection'](_0x3f8e76[_0x377c('0x2c')],_0x3f8e76[_0x377c('0x2e')]);_0x312a67['attributes']=_['intersection'](_0x3f8e76[_0x377c('0x2c')],qs[_0x377c('0x33')](_0x5b61cb['query']['fields']));_0x312a67[_0x377c('0x32')]=_0x312a67[_0x377c('0x32')]['length']?_0x312a67[_0x377c('0x32')]:_0x3f8e76[_0x377c('0x2c')];if(!_0x5b61cb['query'][_0x377c('0x4a')](_0x377c('0x34'))){_0x312a67[_0x377c('0x19')]=qs[_0x377c('0x19')](_0x5b61cb[_0x377c('0x2e')][_0x377c('0x19')]);_0x312a67['offset']=qs[_0x377c('0x17')](_0x5b61cb[_0x377c('0x2e')][_0x377c('0x17')]);}_0x312a67[_0x377c('0x35')]=qs[_0x377c('0x36')](_0x5b61cb[_0x377c('0x2e')][_0x377c('0x36')]);_0x312a67['where']=qs[_0x377c('0x30')](_[_0x377c('0x38')](_0x5b61cb[_0x377c('0x2e')],_0x3f8e76['filters']));_0x312a67['where']['SessionId']=_0x4f7a75['id'];if(_0x5b61cb[_0x377c('0x2e')]['filter']){_0x312a67['where']=_[_0x377c('0x3a')](_0x312a67[_0x377c('0x37')],{'$or':_['map'](_0x312a67[_0x377c('0x32')],function(_0x3718f7){var _0x10ca13={};_0x10ca13[_0x3718f7]={'$like':'%'+_0x5b61cb[_0x377c('0x2e')]['filter']+'%'};return _0x10ca13;})});}_0x312a67=_[_0x377c('0x3a')]({},_0x312a67,_0x5b61cb[_0x377c('0x3b')]);return db[_0x377c('0x49')][_0x377c('0x1a')]({'where':_0x312a67['where']})[_0x377c('0x22')](function(_0x257b6e){_0x4800c4[_0x377c('0x1a')]=_0x257b6e;if(_0x5b61cb[_0x377c('0x2e')][_0x377c('0x41')]){_0x312a67['include']=[{'all':!![]}];}return db[_0x377c('0x49')]['findAll'](_0x312a67);})[_0x377c('0x22')](function(_0x1d0bc0){_0x4800c4[_0x377c('0x4b')]=_0x1d0bc0;return _0x4800c4;});}})[_0x377c('0x22')](respondWithFilteredResult(_0x16f5be,_0x312a67))[_0x377c('0x43')](handleError(_0x16f5be,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 7f2f88f..eb2506d 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 _0x7dfd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0x8a8990,_0x332eeb){var _0x58a572=function(_0x51d1ae){while(--_0x51d1ae){_0x8a8990['push'](_0x8a8990['shift']());}};_0x58a572(++_0x332eeb);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var logger=require(_0xd7df('0x2'))(_0xd7df('0x3'));var moment=require(_0xd7df('0x4'));var BPromise=require(_0xd7df('0x5'));var rp=require(_0xd7df('0x6'));var fs=require('fs');var path=require(_0xd7df('0x7'));var rimraf=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var attributes=require(_0xd7df('0xa'));module[_0xd7df('0xb')]=function(_0x36cf0f,_0x39ce98){return _0x36cf0f[_0xd7df('0xc')](_0xd7df('0xd'),attributes,{'tableName':_0xd7df('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash'];(function(_0x13ca32,_0x2bf3fb){var _0x5c6fdd=function(_0x5c0449){while(--_0x5c0449){_0x13ca32['push'](_0x13ca32['shift']());}};_0x5c6fdd(++_0x2bf3fb);}(_0x5496,0x175));var _0x6549=function(_0x18a9f7,_0x23e2a7){_0x18a9f7=_0x18a9f7-0x0;var _0x75dede=_0x5496[_0x18a9f7];return _0x75dede;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('JscriptySessionReport',attributes,{'tableName':_0x6549('0xa'),'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 f1921fe..f31f626 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 _0x187d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x25c368,_0x4206d1){var _0x3b5f48=function(_0x39805d){while(--_0x39805d){_0x25c368['push'](_0x25c368['shift']());}};_0x3b5f48(++_0x4206d1);}(_0x187d,0x93));var _0xd187=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x187d[_0x4bb66f];return _0xf2772f;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x582628,_0x45dc5d){var _0x4dfea5=function(_0x2ed090){while(--_0x2ed090){_0x582628['push'](_0x582628['shift']());}};_0x4dfea5(++_0x45dc5d);}(_0xadb5,0xad));var _0x5adb=function(_0x260d38,_0x4f8f12){_0x260d38=_0x260d38-0x0;var _0x2cc7d7=_0xadb5[_0x260d38];return _0x2cc7d7;};'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']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 8ef88ea..45f2ec6 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 _0x6986=['/download_log_file','isAuthenticated','downloadLogFile','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id','update'];(function(_0x464f12,_0x453bf1){var _0x3dacd1=function(_0x5e4f90){while(--_0x5e4f90){_0x464f12['push'](_0x464f12['shift']());}};_0x3dacd1(++_0x453bf1);}(_0x6986,0x1cf));var _0x6698=function(_0x2a276d,_0x482b0c){_0x2a276d=_0x2a276d-0x0;var _0x2914cd=_0x6986[_0x2a276d];return _0x2914cd;};'use strict';var multer=require(_0x6698('0x0'));var util=require('util');var path=require(_0x6698('0x1'));var timeout=require(_0x6698('0x2'));var express=require(_0x6698('0x3'));var router=express['Router']();var fs_extra=require(_0x6698('0x4'));var auth=require(_0x6698('0x5'));var interaction=require(_0x6698('0x6'));var config=require(_0x6698('0x7'));var controller=require(_0x6698('0x8'));router[_0x6698('0x9')]('/',controller['index']);router[_0x6698('0xa')](_0x6698('0xb'),auth['isAuthenticated'](),controller[_0x6698('0xc')]);router[_0x6698('0x9')](_0x6698('0xd'),auth[_0x6698('0xe')](),controller[_0x6698('0xf')]);module[_0x6698('0x10')]=router; \ No newline at end of file +var _0xd8f3=['./license.controller','index','/:id','isAuthenticated','update','get','/download_log_file','downloadLogFile','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xd8f3,0xc4));var _0x3d8f=function(_0x34f4db,_0x1cbb42){_0x34f4db=_0x34f4db-0x0;var _0x501a68=_0xd8f3[_0x34f4db];return _0x501a68;};'use strict';var multer=require(_0x3d8f('0x0'));var util=require(_0x3d8f('0x1'));var path=require(_0x3d8f('0x2'));var timeout=require(_0x3d8f('0x3'));var express=require(_0x3d8f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3d8f('0x5'));var interaction=require(_0x3d8f('0x6'));var config=require(_0x3d8f('0x7'));var controller=require(_0x3d8f('0x8'));router['get']('/',controller[_0x3d8f('0x9')]);router['put'](_0x3d8f('0xa'),auth[_0x3d8f('0xb')](),controller[_0x3d8f('0xc')]);router[_0x3d8f('0xd')](_0x3d8f('0xe'),auth['isAuthenticated'](),controller[_0x3d8f('0xf')]);module[_0x3d8f('0x10')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index fd63ff8..2c91647 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 _0xd439=['sequelize','TEXT','STRING','INTEGER'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xd439,0xa0));var _0x9d43=function(_0x2272dc,_0x28e180){_0x2272dc=_0x2272dc-0x0;var _0x25190d=_0xd439[_0x2272dc];return _0x25190d;};'use strict';var Sequelize=require(_0x9d43('0x0'));module['exports']={'license':{'type':Sequelize[_0x9d43('0x1')]},'data1':{'type':Sequelize[_0x9d43('0x2')]},'data2':{'type':Sequelize[_0x9d43('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x9d43('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfb3b=['exports','TEXT','STRING','sequelize'];(function(_0x1dc474,_0x1ecc88){var _0xfcd4fd=function(_0x550281){while(--_0x550281){_0x1dc474['push'](_0x1dc474['shift']());}};_0xfcd4fd(++_0x1ecc88);}(_0xfb3b,0x1af));var _0xbfb3=function(_0x395e33,_0x3eb06f){_0x395e33=_0x395e33-0x0;var _0x3094d8=_0xfb3b[_0x395e33];return _0x3094d8;};'use strict';var Sequelize=require(_0xbfb3('0x0'));module[_0xbfb3('0x1')]={'license':{'type':Sequelize[_0xbfb3('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xbfb3('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 5e29e54..a2f9d5f 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 _0x4f66=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','destroy','then','error','stack','name','index','model','keys','License','rawAttributes','query','filters','attributes','fields','length','merge','getLicense','catch','update','body','params','get','checkLicense','key','demo','downloadLogFile','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','fs-extra'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x4f66,0x8c));var _0x64f6=function(_0x9a4911,_0x4ac37c){_0x9a4911=_0x9a4911-0x0;var _0x3b0e56=_0x4f66[_0x9a4911];return _0x3b0e56;};'use strict';var emlformat=require(_0x64f6('0x0'));var rimraf=require(_0x64f6('0x1'));var zipdir=require(_0x64f6('0x2'));var jsonpatch=require(_0x64f6('0x3'));var rp=require(_0x64f6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x64f6('0x5'));var util=require(_0x64f6('0x6'));var path=require(_0x64f6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x64f6('0x8'));var fs=require('fs');var fs_extra=require(_0x64f6('0x9'));var _=require(_0x64f6('0xa'));var squel=require(_0x64f6('0xb'));var crypto=require(_0x64f6('0xc'));var jsforce=require(_0x64f6('0xd'));var deskjs=require(_0x64f6('0xe'));var toCsv=require(_0x64f6('0xf'));var querystring=require(_0x64f6('0x10'));var Papa=require(_0x64f6('0x11'));var Redis=require(_0x64f6('0x12'));var authService=require(_0x64f6('0x13'));var qs=require(_0x64f6('0x14'));var as=require(_0x64f6('0x15'));var hardwareService=require(_0x64f6('0x16'));var logger=require(_0x64f6('0x17'))(_0x64f6('0x18'));var utils=require('../../config/utils');var config=require(_0x64f6('0x19'));var licenseUtil=require(_0x64f6('0x1a'));var db=require(_0x64f6('0x1b'))['db'];function respondWithStatusCode(_0x3b600d,_0x1cd680){_0x1cd680=_0x1cd680||0xcc;return function(_0x3dac41){if(_0x3dac41){return _0x3b600d[_0x64f6('0x1c')](_0x1cd680);}return _0x3b600d['status'](_0x1cd680)[_0x64f6('0x1d')]();};}function respondWithResult(_0x579c13,_0x3f7bbd){_0x3f7bbd=_0x3f7bbd||0xc8;return function(_0x1edcca){if(_0x1edcca){return _0x579c13[_0x64f6('0x1e')](_0x3f7bbd)['json'](_0x1edcca);}};}function respondWithFilteredResult(_0x1f057f,_0x5236fb){return function(_0x4a3667){if(_0x4a3667){var _0x21be8b=typeof _0x5236fb[_0x64f6('0x1f')]===_0x64f6('0x20')&&typeof _0x5236fb[_0x64f6('0x21')]===_0x64f6('0x20');var _0x5c8ce9=_0x4a3667[_0x64f6('0x22')];var _0x28dceb=_0x21be8b?0x0:_0x5236fb[_0x64f6('0x1f')];var _0x34106d=_0x21be8b?_0x4a3667[_0x64f6('0x22')]:_0x5236fb[_0x64f6('0x1f')]+_0x5236fb[_0x64f6('0x21')];var _0xb099ce;if(_0x34106d>=_0x5c8ce9){_0x34106d=_0x5c8ce9;_0xb099ce=0xc8;}else{_0xb099ce=0xce;}_0x1f057f[_0x64f6('0x1e')](_0xb099ce);return _0x1f057f[_0x64f6('0x23')](_0x64f6('0x24'),_0x28dceb+'-'+_0x34106d+'/'+_0x5c8ce9)[_0x64f6('0x25')](_0x4a3667);}return null;};}function patchUpdates(_0x4edaf2){return function(_0x42049c){try{jsonpatch[_0x64f6('0x26')](_0x42049c,_0x4edaf2,!![]);}catch(_0x20dc02){return BPromise['reject'](_0x20dc02);}return _0x42049c[_0x64f6('0x27')]();};}function saveUpdates(_0x3ab377,_0xdd2694){return function(_0x3bc7cf){if(_0x3bc7cf){return _0x3bc7cf['update'](_0x3ab377)['then'](function(_0x5777a0){return _0x5777a0;});}return null;};}function removeEntity(_0x3e551,_0x2d5bfe){return function(_0x297602){if(_0x297602){return _0x297602[_0x64f6('0x28')]()[_0x64f6('0x29')](function(){_0x3e551[_0x64f6('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3da7ba,_0x1ed378){return function(_0x326dfe){if(!_0x326dfe){_0x3da7ba['sendStatus'](0x194);}return _0x326dfe;};}function handleError(_0x4c3d45,_0xd39319){_0xd39319=_0xd39319||0x1f4;return function(_0x49322c){logger[_0x64f6('0x2a')](_0x49322c[_0x64f6('0x2b')]);if(_0x49322c['name']){delete _0x49322c[_0x64f6('0x2c')];}_0x4c3d45['status'](_0xd39319)['send'](_0x49322c);};}var utilLicense=require('../../config/license/util');exports[_0x64f6('0x2d')]=function(_0x53297b,_0x19d60b){var _0x408f69={'raw':!![],'where':{'id':0x1}},_0x1bc5ea={};_0x1bc5ea[_0x64f6('0x2e')]=_[_0x64f6('0x2f')](db[_0x64f6('0x30')][_0x64f6('0x31')]);_0x1bc5ea[_0x64f6('0x32')]=_['keys'](_0x53297b[_0x64f6('0x32')]);_0x1bc5ea[_0x64f6('0x33')]=_['intersection'](_0x1bc5ea[_0x64f6('0x2e')],_0x1bc5ea[_0x64f6('0x32')]);_0x408f69[_0x64f6('0x34')]=_['intersection'](_0x1bc5ea[_0x64f6('0x2e')],qs[_0x64f6('0x35')](_0x53297b[_0x64f6('0x32')][_0x64f6('0x35')]));_0x408f69[_0x64f6('0x34')]=_0x408f69[_0x64f6('0x34')][_0x64f6('0x36')]?_0x408f69[_0x64f6('0x34')]:_0x1bc5ea[_0x64f6('0x2e')];_0x408f69=_[_0x64f6('0x37')]({},_0x408f69,_0x53297b['options']);return utilLicense[_0x64f6('0x38')](_0x408f69)['then'](respondWithResult(_0x19d60b,null))[_0x64f6('0x39')](handleError(_0x19d60b,null));};exports[_0x64f6('0x3a')]=function(_0x31041a,_0xc6dcdd){if(_0x31041a[_0x64f6('0x3b')]['id']){delete _0x31041a[_0x64f6('0x3b')]['id'];}return db['License']['find']({'where':{'id':_0x31041a[_0x64f6('0x3c')]['id']}})[_0x64f6('0x29')](handleEntityNotFound(_0xc6dcdd,null))[_0x64f6('0x29')](function(_0x57c210){var _0x4cc220=_0x57c210[_0x64f6('0x3d')]({'plain':!![]});return utilLicense[_0x64f6('0x3e')](_0x4cc220,_0x31041a[_0x64f6('0x3b')][_0x64f6('0x3f')]);})[_0x64f6('0x29')](function(_0x124af9){if(!_0x124af9[_0x64f6('0x40')]){return saveUpdates(_0x31041a[_0x64f6('0x3b')],null);}return _0x124af9;})[_0x64f6('0x29')](respondWithResult(_0xc6dcdd,null))[_0x64f6('0x39')](handleError(_0xc6dcdd,null));};exports[_0x64f6('0x41')]=function(_0x4d890a,_0x445b8d){var _0x1a2013='license-info.log';var _0x2059b8=path[_0x64f6('0x42')](_0x64f6('0x43'),_0x64f6('0x44'),_0x64f6('0x45'),_0x1a2013);_0x445b8d[_0x64f6('0x46')](_0x64f6('0x47'),_0x64f6('0x48')+_0x1a2013);_0x445b8d[_0x64f6('0x23')](_0x64f6('0x49'),'text/plain');_0x445b8d[_0x64f6('0x4a')](_0x2059b8);}; \ No newline at end of file +var _0xff2f=['key','demo','downloadLogFile','license-info.log','join','/var','xcally','setHeader','Content-disposition','attachment;\x20filename=','text/plain','download','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','model','keys','License','rawAttributes','query','filters','intersection','fields','attributes','length','options','getLicense','catch','body','get','checkLicense'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xff2f,0x9e));var _0xfff2=function(_0x1eb7b7,_0x3cc652){_0x1eb7b7=_0x1eb7b7-0x0;var _0x509dba=_0xff2f[_0x1eb7b7];return _0x509dba;};'use strict';var emlformat=require(_0xfff2('0x0'));var rimraf=require(_0xfff2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfff2('0x2'));var rp=require(_0xfff2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfff2('0x4'));var util=require(_0xfff2('0x5'));var path=require(_0xfff2('0x6'));var sox=require(_0xfff2('0x7'));var csv=require('to-csv');var ejs=require(_0xfff2('0x8'));var fs=require('fs');var fs_extra=require(_0xfff2('0x9'));var _=require(_0xfff2('0xa'));var squel=require('squel');var crypto=require(_0xfff2('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfff2('0xc'));var Papa=require(_0xfff2('0xd'));var Redis=require(_0xfff2('0xe'));var authService=require(_0xfff2('0xf'));var qs=require(_0xfff2('0x10'));var as=require(_0xfff2('0x11'));var hardwareService=require(_0xfff2('0x12'));var logger=require(_0xfff2('0x13'))(_0xfff2('0x14'));var utils=require(_0xfff2('0x15'));var config=require(_0xfff2('0x16'));var licenseUtil=require(_0xfff2('0x17'));var db=require(_0xfff2('0x18'))['db'];function respondWithStatusCode(_0x1e54af,_0x5b19d7){_0x5b19d7=_0x5b19d7||0xcc;return function(_0x32fd3f){if(_0x32fd3f){return _0x1e54af[_0xfff2('0x19')](_0x5b19d7);}return _0x1e54af[_0xfff2('0x1a')](_0x5b19d7)[_0xfff2('0x1b')]();};}function respondWithResult(_0x352450,_0x2ab9c8){_0x2ab9c8=_0x2ab9c8||0xc8;return function(_0x2f538c){if(_0x2f538c){return _0x352450[_0xfff2('0x1a')](_0x2ab9c8)[_0xfff2('0x1c')](_0x2f538c);}};}function respondWithFilteredResult(_0x907f51,_0x5f0861){return function(_0x145179){if(_0x145179){var _0x5e2d34=typeof _0x5f0861[_0xfff2('0x1d')]===_0xfff2('0x1e')&&typeof _0x5f0861[_0xfff2('0x1f')]===_0xfff2('0x1e');var _0x36aefb=_0x145179['count'];var _0x3ace04=_0x5e2d34?0x0:_0x5f0861['offset'];var _0xa3a0c8=_0x5e2d34?_0x145179[_0xfff2('0x20')]:_0x5f0861[_0xfff2('0x1d')]+_0x5f0861['limit'];var _0x4bd165;if(_0xa3a0c8>=_0x36aefb){_0xa3a0c8=_0x36aefb;_0x4bd165=0xc8;}else{_0x4bd165=0xce;}_0x907f51['status'](_0x4bd165);return _0x907f51[_0xfff2('0x21')](_0xfff2('0x22'),_0x3ace04+'-'+_0xa3a0c8+'/'+_0x36aefb)['json'](_0x145179);}return null;};}function patchUpdates(_0x33a7b9){return function(_0x4be5c8){try{jsonpatch[_0xfff2('0x23')](_0x4be5c8,_0x33a7b9,!![]);}catch(_0x19c3ce){return BPromise[_0xfff2('0x24')](_0x19c3ce);}return _0x4be5c8[_0xfff2('0x25')]();};}function saveUpdates(_0x210ea8,_0xf89ab8){return function(_0x2621a6){if(_0x2621a6){return _0x2621a6[_0xfff2('0x26')](_0x210ea8)[_0xfff2('0x27')](function(_0x510975){return _0x510975;});}return null;};}function removeEntity(_0x13397d,_0x370bb9){return function(_0x547a59){if(_0x547a59){return _0x547a59[_0xfff2('0x28')]()[_0xfff2('0x27')](function(){_0x13397d[_0xfff2('0x1a')](0xcc)[_0xfff2('0x1b')]();});}};}function handleEntityNotFound(_0x1ffa74,_0x543e0f){return function(_0x173cf8){if(!_0x173cf8){_0x1ffa74['sendStatus'](0x194);}return _0x173cf8;};}function handleError(_0x1fdae8,_0x4e69f9){_0x4e69f9=_0x4e69f9||0x1f4;return function(_0x1c0db5){logger[_0xfff2('0x29')](_0x1c0db5[_0xfff2('0x2a')]);if(_0x1c0db5[_0xfff2('0x2b')]){delete _0x1c0db5['name'];}_0x1fdae8[_0xfff2('0x1a')](_0x4e69f9)[_0xfff2('0x2c')](_0x1c0db5);};}var utilLicense=require(_0xfff2('0x17'));exports['index']=function(_0xeced54,_0x47c884){var _0xce3e5d={'raw':!![],'where':{'id':0x1}},_0xea41e2={};_0xea41e2[_0xfff2('0x2d')]=_[_0xfff2('0x2e')](db[_0xfff2('0x2f')][_0xfff2('0x30')]);_0xea41e2[_0xfff2('0x31')]=_[_0xfff2('0x2e')](_0xeced54[_0xfff2('0x31')]);_0xea41e2[_0xfff2('0x32')]=_[_0xfff2('0x33')](_0xea41e2[_0xfff2('0x2d')],_0xea41e2[_0xfff2('0x31')]);_0xce3e5d['attributes']=_[_0xfff2('0x33')](_0xea41e2['model'],qs[_0xfff2('0x34')](_0xeced54['query'][_0xfff2('0x34')]));_0xce3e5d[_0xfff2('0x35')]=_0xce3e5d[_0xfff2('0x35')][_0xfff2('0x36')]?_0xce3e5d[_0xfff2('0x35')]:_0xea41e2['model'];_0xce3e5d=_['merge']({},_0xce3e5d,_0xeced54[_0xfff2('0x37')]);return utilLicense[_0xfff2('0x38')](_0xce3e5d)['then'](respondWithResult(_0x47c884,null))[_0xfff2('0x39')](handleError(_0x47c884,null));};exports[_0xfff2('0x26')]=function(_0x3ce5a9,_0x171499){if(_0x3ce5a9[_0xfff2('0x3a')]['id']){delete _0x3ce5a9['body']['id'];}return db[_0xfff2('0x2f')]['find']({'where':{'id':_0x3ce5a9['params']['id']}})['then'](handleEntityNotFound(_0x171499,null))[_0xfff2('0x27')](function(_0x49284e){var _0x277ac4=_0x49284e[_0xfff2('0x3b')]({'plain':!![]});return utilLicense[_0xfff2('0x3c')](_0x277ac4,_0x3ce5a9[_0xfff2('0x3a')][_0xfff2('0x3d')]);})[_0xfff2('0x27')](function(_0x90d8c2){if(!_0x90d8c2[_0xfff2('0x3e')]){return saveUpdates(_0x3ce5a9[_0xfff2('0x3a')],null);}return _0x90d8c2;})['then'](respondWithResult(_0x171499,null))['catch'](handleError(_0x171499,null));};exports[_0xfff2('0x3f')]=function(_0x2c063a,_0x52eb10){var _0x23d76f=_0xfff2('0x40');var _0x440abe=path[_0xfff2('0x41')](_0xfff2('0x42'),'log',_0xfff2('0x43'),_0x23d76f);_0x52eb10[_0xfff2('0x44')](_0xfff2('0x45'),_0xfff2('0x46')+_0x23d76f);_0x52eb10[_0xfff2('0x21')]('Content-Type',_0xfff2('0x47'));_0x52eb10[_0xfff2('0x48')](_0x440abe);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 93baa3b..b43b5ea 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 _0x3a5d=['../../config/environment','./license.attributes','define','License','license','lodash','util','../../config/logger','api','bluebird','rimraf'];(function(_0x26ec8e,_0x100a12){var _0x4afb00=function(_0x4e565){while(--_0x4e565){_0x26ec8e['push'](_0x26ec8e['shift']());}};_0x4afb00(++_0x100a12);}(_0x3a5d,0xf7));var _0xd3a5=function(_0x39d19e,_0x1925b8){_0x39d19e=_0x39d19e-0x0;var _0x18ab95=_0x3a5d[_0x39d19e];return _0x18ab95;};'use strict';var _=require(_0xd3a5('0x0'));var util=require(_0xd3a5('0x1'));var logger=require(_0xd3a5('0x2'))(_0xd3a5('0x3'));var moment=require('moment');var BPromise=require(_0xd3a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd3a5('0x5'));var config=require(_0xd3a5('0x6'));var attributes=require(_0xd3a5('0x7'));module['exports']=function(_0x554b2b,_0x549797){return _0x554b2b[_0xd3a5('0x8')](_0xd3a5('0x9'),attributes,{'tableName':_0xd3a5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54de=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./license.attributes','exports','define','License'];(function(_0x42d22a,_0xf11dd4){var _0x173c1b=function(_0x2fb329){while(--_0x2fb329){_0x42d22a['push'](_0x42d22a['shift']());}};_0x173c1b(++_0xf11dd4);}(_0x54de,0x18c));var _0xe54d=function(_0x28a71e,_0x1cb610){_0x28a71e=_0x28a71e-0x0;var _0x3afe2c=_0x54de[_0x28a71e];return _0x3afe2c;};'use strict';var _=require(_0xe54d('0x0'));var util=require(_0xe54d('0x1'));var logger=require(_0xe54d('0x2'))(_0xe54d('0x3'));var moment=require(_0xe54d('0x4'));var BPromise=require('bluebird');var rp=require(_0xe54d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe54d('0x6'));var config=require(_0xe54d('0x7'));var attributes=require(_0xe54d('0x8'));module[_0xe54d('0x9')]=function(_0x569090,_0x21a1ad){return _0x569090[_0xe54d('0xa')](_0xe54d('0xb'),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 7f3d20a..0d33a87 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 _0xd012=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result'];(function(_0x3b0491,_0x23f524){var _0x3ee467=function(_0x31a9eb){while(--_0x31a9eb){_0x3b0491['push'](_0x3b0491['shift']());}};_0x3ee467(++_0x23f524);}(_0xd012,0xe7));var _0x2d01=function(_0x2846f9,_0x286ebb){_0x2846f9=_0x2846f9-0x0;var _0x2f3113=_0xd012[_0x2846f9];return _0x2f3113;};'use strict';var _=require(_0x2d01('0x0'));var util=require(_0x2d01('0x1'));var moment=require(_0x2d01('0x2'));var BPromise=require(_0x2d01('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d01('0x4'));var db=require(_0x2d01('0x5'))['db'];var utils=require(_0x2d01('0x6'));var logger=require(_0x2d01('0x7'))('rpc');var config=require(_0x2d01('0x8'));var jayson=require(_0x2d01('0x9'));var client=jayson[_0x2d01('0xa')][_0x2d01('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42a023,_0x2a5485,_0x3f0ef2){return new BPromise(function(_0x19299e,_0x2414ec){return client[_0x2d01('0xc')](_0x42a023,_0x3f0ef2)[_0x2d01('0xd')](function(_0x4dea2d){logger[_0x2d01('0xe')](_0x2d01('0xf'),_0x2a5485,'request\x20sent');logger[_0x2d01('0x10')]('License,\x20%s,\x20%s,\x20%s',_0x2a5485,_0x2d01('0x11'),JSON['stringify'](_0x4dea2d));if(_0x4dea2d['error']){if(_0x4dea2d[_0x2d01('0x12')][_0x2d01('0x13')]===0x1f4){logger[_0x2d01('0x12')](_0x2d01('0xf'),_0x2a5485,_0x4dea2d['error']['message']);return _0x2414ec(_0x4dea2d[_0x2d01('0x12')]['message']);}logger[_0x2d01('0x12')]('License,\x20%s,\x20%s',_0x2a5485,_0x4dea2d[_0x2d01('0x12')][_0x2d01('0x14')]);return _0x19299e(_0x4dea2d[_0x2d01('0x12')][_0x2d01('0x14')]);}else{logger[_0x2d01('0xe')]('License,\x20%s,\x20%s',_0x2a5485,_0x2d01('0x11'));_0x19299e(_0x4dea2d[_0x2d01('0x15')][_0x2d01('0x14')]);}})[_0x2d01('0x16')](function(_0x14b960){logger['error']('License,\x20%s,\x20%s',_0x2a5485,_0x14b960);_0x2414ec(_0x14b960);});});} \ No newline at end of file +var _0x56ee=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','debug','stringify','error'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x56ee,0xf6));var _0xe56e=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0x56ee[_0x25e109];return _0xc0f7d6;};'use strict';var _=require(_0xe56e('0x0'));var util=require(_0xe56e('0x1'));var moment=require(_0xe56e('0x2'));var BPromise=require(_0xe56e('0x3'));var rs=require(_0xe56e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe56e('0x5'))['db'];var utils=require(_0xe56e('0x6'));var logger=require(_0xe56e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe56e('0x8'));var client=jayson[_0xe56e('0x9')][_0xe56e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a3edb,_0x24a75a,_0x2de207){return new BPromise(function(_0x1055bb,_0x264bdc){return client[_0xe56e('0xb')](_0x3a3edb,_0x2de207)[_0xe56e('0xc')](function(_0x44a081){logger[_0xe56e('0xd')](_0xe56e('0xe'),_0x24a75a,'request\x20sent');logger[_0xe56e('0xf')]('License,\x20%s,\x20%s,\x20%s',_0x24a75a,'request\x20sent',JSON[_0xe56e('0x10')](_0x44a081));if(_0x44a081[_0xe56e('0x11')]){if(_0x44a081[_0xe56e('0x11')][_0xe56e('0x12')]===0x1f4){logger[_0xe56e('0x11')](_0xe56e('0xe'),_0x24a75a,_0x44a081[_0xe56e('0x11')][_0xe56e('0x13')]);return _0x264bdc(_0x44a081[_0xe56e('0x11')][_0xe56e('0x13')]);}logger['error']('License,\x20%s,\x20%s',_0x24a75a,_0x44a081[_0xe56e('0x11')]['message']);return _0x1055bb(_0x44a081['error'][_0xe56e('0x13')]);}else{logger[_0xe56e('0xd')](_0xe56e('0xe'),_0x24a75a,'request\x20sent');_0x1055bb(_0x44a081[_0xe56e('0x14')][_0xe56e('0x13')]);}})[_0xe56e('0x15')](function(_0x4b3032){logger[_0xe56e('0x11')](_0xe56e('0xe'),_0x24a75a,_0x4b3032);_0x264bdc(_0x4b3032);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 9004079..6a58c34 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 _0x42d5=['put','update','delete','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','post','addDisposition','addAnswer','create','addImap','addSmtp','/:id/interactions','addInteraction','/:id/applications','/:id/send','send','addAgents'];(function(_0x3f82e6,_0x2587b6){var _0x161830=function(_0x270d5b){while(--_0x270d5b){_0x3f82e6['push'](_0x3f82e6['shift']());}};_0x161830(++_0x2587b6);}(_0x42d5,0xc4));var _0x542d=function(_0xd4d95b,_0x9f0cf1){_0xd4d95b=_0xd4d95b-0x0;var _0x5efc4d=_0x42d5[_0xd4d95b];return _0x5efc4d;};'use strict';var multer=require(_0x542d('0x0'));var util=require(_0x542d('0x1'));var path=require(_0x542d('0x2'));var timeout=require(_0x542d('0x3'));var express=require(_0x542d('0x4'));var router=express[_0x542d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x542d('0x6'));var interaction=require(_0x542d('0x7'));var config=require('../../config/environment');var controller=require(_0x542d('0x8'));router[_0x542d('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x542d('0xa'),auth[_0x542d('0xb')](),controller[_0x542d('0xc')]);router['get'](_0x542d('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x542d('0x9')](_0x542d('0xe'),auth[_0x542d('0xb')](),controller[_0x542d('0xf')]);router['get'](_0x542d('0x10'),auth[_0x542d('0xb')](),controller[_0x542d('0x11')]);router['get'](_0x542d('0x12'),auth[_0x542d('0xb')](),controller[_0x542d('0x13')]);router['get'](_0x542d('0x14'),auth[_0x542d('0xb')](),controller[_0x542d('0x15')]);router[_0x542d('0x9')]('/:id/interactions',auth[_0x542d('0xb')](),controller['getInteractions']);router[_0x542d('0x9')]('/:id/applications',auth[_0x542d('0xb')](),controller[_0x542d('0x16')]);router[_0x542d('0x9')](_0x542d('0x17'),auth[_0x542d('0xb')](),controller[_0x542d('0x18')]);router[_0x542d('0x9')]('/:id/verify',auth['isAuthenticated'](),controller[_0x542d('0x19')]);router[_0x542d('0x9')](_0x542d('0x1a'),auth[_0x542d('0xb')](),controller['getAgents']);router[_0x542d('0x1b')](_0x542d('0xe'),auth['isAuthenticated'](),controller[_0x542d('0x1c')]);router[_0x542d('0x1b')](_0x542d('0x10'),auth['isAuthenticated'](),controller[_0x542d('0x1d')]);router[_0x542d('0x1b')]('/',auth[_0x542d('0xb')](),controller[_0x542d('0x1e')]);router[_0x542d('0x1b')]('/:id/in_servers',auth[_0x542d('0xb')](),controller[_0x542d('0x1f')]);router[_0x542d('0x1b')](_0x542d('0x14'),auth['isAuthenticated'](),controller[_0x542d('0x20')]);router['post'](_0x542d('0x21'),auth[_0x542d('0xb')](),controller[_0x542d('0x22')]);router[_0x542d('0x1b')](_0x542d('0x23'),auth['isAuthenticated'](),controller['addApplications']);router[_0x542d('0x1b')](_0x542d('0x24'),auth[_0x542d('0xb')](),controller[_0x542d('0x25')]);router[_0x542d('0x1b')](_0x542d('0x1a'),auth['isAuthenticated'](),controller[_0x542d('0x26')]);router[_0x542d('0x27')](_0x542d('0xd'),auth['isAuthenticated'](),controller[_0x542d('0x28')]);router['delete'](_0x542d('0xe'),auth[_0x542d('0xb')](),controller['removeDispositions']);router[_0x542d('0x29')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x542d('0x29')]('/:id/in_servers',auth[_0x542d('0xb')](),controller[_0x542d('0x2a')]);router['delete'](_0x542d('0x14'),auth[_0x542d('0xb')](),controller[_0x542d('0x2b')]);router[_0x542d('0x29')](_0x542d('0xd'),auth[_0x542d('0xb')](),controller[_0x542d('0x2c')]);router['delete']('/:id/users',auth[_0x542d('0xb')](),controller[_0x542d('0x2d')]);module[_0x542d('0x2e')]=router; \ No newline at end of file +var _0x3a92=['/:id/applications','addApplications','/:id/send','send','put','update','delete','removeAnswers','removeImap','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','create','addImap','/:id/out_servers','addSmtp','addInteraction'];(function(_0x47eb10,_0x18c02e){var _0x3cbf8c=function(_0x431170){while(--_0x431170){_0x47eb10['push'](_0x47eb10['shift']());}};_0x3cbf8c(++_0x18c02e);}(_0x3a92,0xa4));var _0x23a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a92[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x23a9('0x0'));var util=require(_0x23a9('0x1'));var path=require(_0x23a9('0x2'));var timeout=require(_0x23a9('0x3'));var express=require('express');var router=express[_0x23a9('0x4')]();var fs_extra=require(_0x23a9('0x5'));var auth=require(_0x23a9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x23a9('0x7'));var controller=require(_0x23a9('0x8'));router[_0x23a9('0x9')]('/',auth[_0x23a9('0xa')](),controller[_0x23a9('0xb')]);router['get'](_0x23a9('0xc'),auth[_0x23a9('0xa')](),controller[_0x23a9('0xd')]);router[_0x23a9('0x9')](_0x23a9('0xe'),auth[_0x23a9('0xa')](),controller[_0x23a9('0xf')]);router['get']('/:id/dispositions',auth[_0x23a9('0xa')](),controller[_0x23a9('0x10')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x23a9('0x11')]);router[_0x23a9('0x9')](_0x23a9('0x12'),auth[_0x23a9('0xa')](),controller[_0x23a9('0x13')]);router[_0x23a9('0x9')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x23a9('0x14')]);router[_0x23a9('0x9')](_0x23a9('0x15'),auth[_0x23a9('0xa')](),controller[_0x23a9('0x16')]);router[_0x23a9('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0x23a9('0x17')]);router[_0x23a9('0x9')](_0x23a9('0x18'),auth[_0x23a9('0xa')](),controller[_0x23a9('0x19')]);router[_0x23a9('0x9')](_0x23a9('0x1a'),auth['isAuthenticated'](),controller[_0x23a9('0x1b')]);router[_0x23a9('0x9')](_0x23a9('0x1c'),auth[_0x23a9('0xa')](),controller[_0x23a9('0x1d')]);router[_0x23a9('0x1e')](_0x23a9('0x1f'),auth[_0x23a9('0xa')](),controller[_0x23a9('0x20')]);router[_0x23a9('0x1e')](_0x23a9('0x21'),auth[_0x23a9('0xa')](),controller[_0x23a9('0x22')]);router['post']('/',auth[_0x23a9('0xa')](),controller[_0x23a9('0x23')]);router[_0x23a9('0x1e')]('/:id/in_servers',auth[_0x23a9('0xa')](),controller[_0x23a9('0x24')]);router[_0x23a9('0x1e')](_0x23a9('0x25'),auth['isAuthenticated'](),controller[_0x23a9('0x26')]);router['post'](_0x23a9('0x15'),auth[_0x23a9('0xa')](),controller[_0x23a9('0x27')]);router[_0x23a9('0x1e')](_0x23a9('0x28'),auth[_0x23a9('0xa')](),controller[_0x23a9('0x29')]);router['post'](_0x23a9('0x2a'),auth['isAuthenticated'](),controller[_0x23a9('0x2b')]);router['post'](_0x23a9('0x1c'),auth[_0x23a9('0xa')](),controller['addAgents']);router[_0x23a9('0x2c')]('/:id',auth[_0x23a9('0xa')](),controller[_0x23a9('0x2d')]);router[_0x23a9('0x2e')]('/:id/dispositions',auth[_0x23a9('0xa')](),controller['removeDispositions']);router[_0x23a9('0x2e')](_0x23a9('0x21'),auth[_0x23a9('0xa')](),controller[_0x23a9('0x2f')]);router['delete'](_0x23a9('0x12'),auth[_0x23a9('0xa')](),controller[_0x23a9('0x30')]);router[_0x23a9('0x2e')]('/:id/out_servers',auth[_0x23a9('0xa')](),controller['removeSmtp']);router[_0x23a9('0x2e')](_0x23a9('0xe'),auth['isAuthenticated'](),controller[_0x23a9('0x31')]);router[_0x23a9('0x2e')](_0x23a9('0x1c'),auth[_0x23a9('0xa')](),controller['removeAgents']);module[_0x23a9('0x32')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 2ee90b4..92235a2 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 _0x099c=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','gmail','hotmail','yahoo','outlook365','getDataValue','custom','provider','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif'];(function(_0x2ce6c4,_0x1493e0){var _0x3fa5ef=function(_0x462a6a){while(--_0x462a6a){_0x2ce6c4['push'](_0x2ce6c4['shift']());}};_0x3fa5ef(++_0x1493e0);}(_0x099c,0x79));var _0xc099=function(_0x224436,_0x13088b){_0x224436=_0x224436-0x0;var _0x3c694a=_0x099c[_0x224436];return _0x3c694a;};'use strict';var Sequelize=require(_0xc099('0x0'));module[_0xc099('0x1')]={'description':{'type':Sequelize[_0xc099('0x2')]},'name':{'type':Sequelize[_0xc099('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xc099('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xc099('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xc099('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xc099('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xc099('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc099('0x4')},'fontSize':{'type':Sequelize[_0xc099('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xc099('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc099('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc099('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc099('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc099('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc099('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc099('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc099('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xc099('0x6')},'mandatoryDisposition':{'type':Sequelize[_0xc099('0x3')],'defaultValue':![],'comment':_0xc099('0x7'),'set':function(_0x4678fd){if(!_0x4678fd)this[_0xc099('0x8')](_0xc099('0x9'),null);this['setDataValue'](_0xc099('0xa'),_0x4678fd);}},'provider':{'type':Sequelize['ENUM'](_0xc099('0xb'),_0xc099('0xc'),_0xc099('0xd'),_0xc099('0xe')),'defaultValue':null,'get':function(){var _0x54d80b=this[_0xc099('0xf')]('provider');return _0x54d80b||_0xc099('0x10');},'set':function(_0x4bea81){if(_0x4bea81===_0xc099('0x10')){_0x4bea81=null;}return this[_0xc099('0x8')](_0xc099('0x11'),_0x4bea81);}}}; \ No newline at end of file +var _0x1c2e=['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','ENUM','gmail','hotmail','outlook365','getDataValue','custom','provider','sequelize','exports','STRING','BOOLEAN','TEXT','INTEGER'];(function(_0xa30766,_0x6f613e){var _0x24e780=function(_0x3d58fb){while(--_0x3d58fb){_0xa30766['push'](_0xa30766['shift']());}};_0x24e780(++_0x6f613e);}(_0x1c2e,0x1aa));var _0xe1c2=function(_0x4e364d,_0x845bf6){_0x4e364d=_0x4e364d-0x0;var _0x96d48e=_0x1c2e[_0x4e364d];return _0x96d48e;};'use strict';var Sequelize=require(_0xe1c2('0x0'));module[_0xe1c2('0x1')]={'description':{'type':Sequelize[_0xe1c2('0x2')]},'name':{'type':Sequelize[_0xe1c2('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xe1c2('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xe1c2('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xe1c2('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xe1c2('0x4')]},'markAsUnread':{'type':Sequelize[_0xe1c2('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xe1c2('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xe1c2('0x5')](0x2)[_0xe1c2('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xe1c2('0x4')],'defaultValue':function(){return _0xe1c2('0x7');}},'notificationSound':{'type':Sequelize[_0xe1c2('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe1c2('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe1c2('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe1c2('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe1c2('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe1c2('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xe1c2('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xe1c2('0x3')],'defaultValue':![],'comment':_0xe1c2('0x9'),'set':function(_0x1a4508){if(!_0x1a4508)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xe1c2('0xa')]('mandatoryDisposition',_0x1a4508);}},'provider':{'type':Sequelize[_0xe1c2('0xb')](_0xe1c2('0xc'),_0xe1c2('0xd'),'yahoo',_0xe1c2('0xe')),'defaultValue':null,'get':function(){var _0x53ee39=this[_0xe1c2('0xf')]('provider');return _0x53ee39||_0xe1c2('0x10');},'set':function(_0x1e7bf1){if(_0x1e7bf1===_0xe1c2('0x10')){_0x1e7bf1=null;}return this['setDataValue'](_0xe1c2('0x11'),_0x1e7bf1);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 7aa20c2..bdac3bc 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 _0x77f1=['path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','register','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','user','username','pass','password','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','key','model','map','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','MailServerIn','keys','length','find','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','getInteractions','CmContact','User','fullname','Tag','Tags','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','MailApplication','findAndCountAll','stack','finally','sendStatus','getApplications','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','CmList','List','Contacts','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','email','attachments','root','server/files/attachments','getSmtpOptions','SendMail','List\x20not\x20found','defaults','ListId','messageId','subject','out','Interaction','Messages','VerifySmtp','Sequelize','ValidationError','addAgents','userMailAccount:save','removeAgents','emit','userMailAccount:remove','getAgents','moment'];(function(_0x3ccb68,_0x87431){var _0x278978=function(_0x38f2be){while(--_0x38f2be){_0x3ccb68['push'](_0x3ccb68['shift']());}};_0x278978(++_0x87431);}(_0x77f1,0xbc));var _0x177f=function(_0x134136,_0x42193a){_0x134136=_0x134136-0x0;var _0x5ed78d=_0x77f1[_0x134136];return _0x5ed78d;};'use strict';var moment=require(_0x177f('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x177f('0x1'));var _=require(_0x177f('0x2'));var juice=require(_0x177f('0x3'));var Redis=require(_0x177f('0x4'));var qs=require(_0x177f('0x5'));var logger=require(_0x177f('0x6'))(_0x177f('0x7'));var config=require('../../config/environment');var db=require(_0x177f('0x8'))['db'];config['redis']=_['defaults'](config[_0x177f('0x9')],{'host':_0x177f('0xa'),'port':0x18eb});var socket=require(_0x177f('0xb'))(new Redis(config[_0x177f('0x9')]));require(_0x177f('0xc'))[_0x177f('0xd')](socket);var jayson=require('jayson/promise');var client=jayson[_0x177f('0xe')][_0x177f('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x18cce7,_0x523d86,_0x44b922,_0x28b6d4){return new BPromise(function(_0x777a2d,_0x5d83b4){var _0x522bba=_0x28b6d4||client;return _0x522bba[_0x177f('0x10')](_0x18cce7,_0x44b922)[_0x177f('0x11')](function(_0x1ec2e8){logger[_0x177f('0x12')](_0x177f('0x13'),_0x523d86,_0x177f('0x14'));logger[_0x177f('0x15')](_0x177f('0x16'),_0x523d86,_0x177f('0x14'),JSON[_0x177f('0x17')](_0x1ec2e8));if(_0x1ec2e8[_0x177f('0x18')]){if(_0x1ec2e8[_0x177f('0x18')]['code']===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x523d86,_0x1ec2e8[_0x177f('0x18')]['message']);return _0x5d83b4(_0x1ec2e8[_0x177f('0x18')]['message']);}logger[_0x177f('0x18')](_0x177f('0x13'),_0x523d86,_0x1ec2e8[_0x177f('0x18')][_0x177f('0x19')]);return _0x777a2d(_0x1ec2e8[_0x177f('0x18')][_0x177f('0x19')]);}else{logger[_0x177f('0x12')]('MailAccount,\x20%s,\x20%s',_0x523d86,_0x177f('0x14'));_0x777a2d(_0x1ec2e8['result'][_0x177f('0x19')]);}})[_0x177f('0x1a')](function(_0x5703c8){logger[_0x177f('0x18')](_0x177f('0x13'),_0x523d86,_0x5703c8);_0x5d83b4(_0x5703c8);});});}function respondWithStatusCode(_0x229239,_0x4109a1){_0x4109a1=_0x4109a1||0xcc;return function(_0x56050e){if(_0x56050e){return _0x229239['sendStatus'](_0x4109a1);}return _0x229239[_0x177f('0x1b')](_0x4109a1)[_0x177f('0x1c')]();};}function respondWithResult(_0x5e0d32,_0x311295){_0x311295=_0x311295||0xc8;return function(_0x21be15){if(_0x21be15){return _0x5e0d32[_0x177f('0x1b')](_0x311295)[_0x177f('0x1d')](_0x21be15);}};}function respondWithFilteredResult(_0x55f46b,_0x1bc281){return function(_0x26e2d6){if(_0x26e2d6){var _0x1a763c=typeof _0x1bc281[_0x177f('0x1e')]===_0x177f('0x1f')&&typeof _0x1bc281['limit']===_0x177f('0x1f');var _0xc17ea7=_0x26e2d6[_0x177f('0x20')];var _0x50f4bb=_0x1a763c?0x0:_0x1bc281['offset'];var _0x4e7913=_0x1a763c?_0x26e2d6[_0x177f('0x20')]:_0x1bc281[_0x177f('0x1e')]+_0x1bc281[_0x177f('0x21')];var _0x23181e;if(_0x4e7913>=_0xc17ea7){_0x4e7913=_0xc17ea7;_0x23181e=0xc8;}else{_0x23181e=0xce;}_0x55f46b[_0x177f('0x1b')](_0x23181e);return _0x55f46b[_0x177f('0x22')](_0x177f('0x23'),_0x50f4bb+'-'+_0x4e7913+'/'+_0xc17ea7)[_0x177f('0x1d')](_0x26e2d6);}return null;};}function saveUpdates(_0x11326f){return function(_0x2f5ced){if(_0x2f5ced){return _0x2f5ced[_0x177f('0x24')](_0x11326f)[_0x177f('0x11')](function(_0x151f91){return _0x151f91;});}return null;};}function removeEntity(_0x3e40a1){return function(_0x1786dc){if(_0x1786dc){return _0x1786dc[_0x177f('0x25')]()[_0x177f('0x11')](function(){var _0x25f69f=_0x1786dc[_0x177f('0x26')]({'plain':!![]});var _0x3d9aef=_0x177f('0x27');return db[_0x177f('0x28')][_0x177f('0x25')]({'where':{'type':_0x3d9aef,'resourceId':_0x25f69f['id']}})[_0x177f('0x11')](function(){return _0x1786dc;});})['then'](function(){_0x3e40a1[_0x177f('0x1b')](0xcc)[_0x177f('0x1c')]();});}};}function handleEntityNotFound(_0x5c2cfe){return function(_0xe53a8e){if(!_0xe53a8e){_0x5c2cfe['sendStatus'](0x194);}return _0xe53a8e;};}function handleError(_0x5d47fd,_0x2fc27b){_0x2fc27b=_0x2fc27b||0x1f4;return function(_0x32330c){logger[_0x177f('0x18')](_0x32330c['stack']);if(_0x32330c['name']){delete _0x32330c[_0x177f('0x29')];}_0x5d47fd[_0x177f('0x1b')](_0x2fc27b)[_0x177f('0x2a')](_0x32330c);};}function getImapHost(_0x3cdd31){switch(_0x3cdd31){case _0x177f('0x2b'):return _0x177f('0x2c');case _0x177f('0x2d'):return _0x177f('0x2e');case _0x177f('0x2f'):return'imap-mail.outlook.com';case _0x177f('0x30'):return _0x177f('0x31');}throw new Error(_0x177f('0x32'),_0x3cdd31);}function getSmtpHost(_0x112f76){switch(_0x112f76){case _0x177f('0x2b'):return'smtp.gmail.com';case _0x177f('0x2d'):return'smtp.mail.yahoo.com';case _0x177f('0x2f'):return'smtp-mail.outlook.com';case'outlook365':return'smtp.office365.com';}throw new Error(_0x177f('0x32'),_0x112f76);}function getAuthenticationOptions(_0x17e047,_0x433ca7){var _0x4d5dac={};var _0xd088cd={};if(_0x17e047){_0x4d5dac[_0x177f('0x33')]=_0xd088cd[_0x177f('0x33')]=_0x433ca7[_0x177f('0x34')];_0x4d5dac['password']=_0xd088cd[_0x177f('0x35')]=_0x433ca7[_0x177f('0x36')];if(_0x433ca7[_0x177f('0x37')]){_0x4d5dac[_0x177f('0x37')]=_0xd088cd[_0x177f('0x37')]=!![];_0x4d5dac['CloudProviderId']=_0xd088cd[_0x177f('0x38')]=_0x433ca7[_0x177f('0x38')];_0x4d5dac[_0x177f('0x36')]=_0xd088cd['pass']=null;}else{_0x4d5dac['CloudProviderId']=_0xd088cd[_0x177f('0x38')]=null;}_0x4d5dac[_0x177f('0x39')]=getImapHost(_0x17e047);_0x4d5dac[_0x177f('0x3a')]=0x3e1;_0xd088cd['host']=getSmtpHost(_0x17e047);_0xd088cd[_0x177f('0x3a')]=0x24b;_0xd088cd[_0x177f('0x3b')]=![];_0x4d5dac[_0x177f('0x3c')]=_0xd088cd[_0x177f('0x3c')]=null;}else{if(_0x433ca7['authentication']){_0x4d5dac[_0x177f('0x33')]=_0xd088cd[_0x177f('0x33')]=_0x433ca7[_0x177f('0x34')];_0x4d5dac[_0x177f('0x36')]=_0xd088cd['pass']=_0x433ca7['password'];}else{_0x4d5dac['authentication']=_0xd088cd[_0x177f('0x3d')]=![];_0x4d5dac['user']=_0xd088cd[_0x177f('0x33')]=null;_0x4d5dac[_0x177f('0x36')]=_0xd088cd['pass']=null;}_0x4d5dac['host']=_0x433ca7[_0x177f('0x3e')][_0x177f('0x39')];_0x4d5dac[_0x177f('0x3a')]=_0x433ca7['Imap'][_0x177f('0x3a')];_0xd088cd[_0x177f('0x39')]=_0x433ca7[_0x177f('0x3f')][_0x177f('0x39')];_0xd088cd[_0x177f('0x3a')]=_0x433ca7[_0x177f('0x3f')][_0x177f('0x3a')];}return{'Imap':_0x4d5dac,'Smtp':_0xd088cd};}exports[_0x177f('0x40')]=function(_0x1d3a3e,_0x4337d1){var _0x1304d0={'include':[{'model':db['MailServerIn'],'as':_0x177f('0x3e')},{'model':db[_0x177f('0x41')],'as':_0x177f('0x3f')},{'model':db[_0x177f('0x42')],'as':_0x177f('0x43')}]},_0x304be8={},_0x555a5d={'count':0x0,'rows':[]};var _0x55f4b3=_['map'](db[_0x177f('0x44')][_0x177f('0x45')],function(_0x2b6afd){return{'name':_0x2b6afd[_0x177f('0x46')],'type':_0x2b6afd['type'][_0x177f('0x47')]};});_0x304be8[_0x177f('0x48')]=_[_0x177f('0x49')](_0x55f4b3,_0x177f('0x29'));_0x304be8[_0x177f('0x4a')]=_['keys'](_0x1d3a3e[_0x177f('0x4a')]);_0x304be8['filters']=_[_0x177f('0x4b')](_0x304be8['model'],_0x304be8[_0x177f('0x4a')]);_0x1304d0['attributes']=_[_0x177f('0x4b')](_0x304be8[_0x177f('0x48')],qs[_0x177f('0x4c')](_0x1d3a3e['query'][_0x177f('0x4c')]));_0x1304d0[_0x177f('0x4d')]=_0x1304d0[_0x177f('0x4d')]['length']?_0x1304d0[_0x177f('0x4d')]:_0x304be8[_0x177f('0x48')];if(!_0x1d3a3e['query'][_0x177f('0x4e')]('nolimit')){_0x1304d0[_0x177f('0x21')]=qs[_0x177f('0x21')](_0x1d3a3e[_0x177f('0x4a')][_0x177f('0x21')]);_0x1304d0[_0x177f('0x1e')]=qs[_0x177f('0x1e')](_0x1d3a3e['query'][_0x177f('0x1e')]);}_0x1304d0[_0x177f('0x4f')]=qs['sort'](_0x1d3a3e[_0x177f('0x4a')][_0x177f('0x50')]);_0x1304d0[_0x177f('0x51')]=qs['filters'](_[_0x177f('0x52')](_0x1d3a3e[_0x177f('0x4a')],_0x304be8[_0x177f('0x53')]),_0x55f4b3);if(_0x1d3a3e[_0x177f('0x4a')][_0x177f('0x54')]){_0x1304d0['where']=_[_0x177f('0x55')](_0x1304d0['where'],{'$or':_[_0x177f('0x49')](_0x55f4b3,function(_0x5d9f62){if(_0x5d9f62[_0x177f('0x56')]!==_0x177f('0x57')){var _0x51014a={};_0x51014a[_0x5d9f62[_0x177f('0x29')]]={'$like':'%'+_0x1d3a3e[_0x177f('0x4a')][_0x177f('0x54')]+'%'};return _0x51014a;}})});}_0x1304d0=_['merge']({},_0x1304d0,_0x1d3a3e[_0x177f('0x58')]);var _0x3d7ae5={'where':_0x1304d0[_0x177f('0x51')]};return db['MailAccount'][_0x177f('0x20')](_0x3d7ae5)['then'](function(_0x685d63){_0x555a5d[_0x177f('0x20')]=_0x685d63;if(_0x1d3a3e[_0x177f('0x4a')][_0x177f('0x59')]){_0x1304d0[_0x177f('0x5a')]=[{'all':!![]}];}return db[_0x177f('0x44')][_0x177f('0x5b')](_0x1304d0);})[_0x177f('0x11')](function(_0x4127b3){_0x555a5d[_0x177f('0x5c')]=_0x4127b3;return _0x555a5d;})['then'](respondWithFilteredResult(_0x4337d1,_0x1304d0))['catch'](handleError(_0x4337d1,null));};exports[_0x177f('0x5d')]=function(_0x1aa906,_0x126310){var _0x3b53b8={'raw':![],'where':{'id':_0x1aa906[_0x177f('0x5e')]['id']},'include':[{'model':db[_0x177f('0x5f')],'as':_0x177f('0x3e')},{'model':db[_0x177f('0x41')],'as':_0x177f('0x3f')},{'model':db[_0x177f('0x42')],'as':_0x177f('0x43')}]},_0x3d0911={};_0x3d0911[_0x177f('0x48')]=_[_0x177f('0x60')](db[_0x177f('0x44')][_0x177f('0x45')]);_0x3d0911[_0x177f('0x4a')]=_['keys'](_0x1aa906['query']);_0x3d0911['filters']=_['intersection'](_0x3d0911[_0x177f('0x48')],_0x3d0911[_0x177f('0x4a')]);_0x3b53b8['attributes']=_[_0x177f('0x4b')](_0x3d0911[_0x177f('0x48')],qs[_0x177f('0x4c')](_0x1aa906[_0x177f('0x4a')][_0x177f('0x4c')]));_0x3b53b8[_0x177f('0x4d')]=_0x3b53b8[_0x177f('0x4d')][_0x177f('0x61')]?_0x3b53b8[_0x177f('0x4d')]:_0x3d0911[_0x177f('0x48')];if(_0x1aa906['query']['includeAll']){_0x3b53b8[_0x177f('0x5a')]=[{'all':!![]}];}_0x3b53b8=_[_0x177f('0x55')]({},_0x3b53b8,_0x1aa906['options']);return db[_0x177f('0x44')][_0x177f('0x62')](_0x3b53b8)[_0x177f('0x11')](handleEntityNotFound(_0x126310,null))[_0x177f('0x11')](respondWithResult(_0x126310,null))[_0x177f('0x1a')](handleError(_0x126310,null));};exports[_0x177f('0x24')]=function(_0x476af4,_0x113651){if(_0x476af4[_0x177f('0x63')]['id']){delete _0x476af4[_0x177f('0x63')]['id'];}var _0x26008c=_0x476af4[_0x177f('0x63')][_0x177f('0x64')]===_0x177f('0x65')?null:_0x476af4[_0x177f('0x63')]['provider'];var _0x3fdeee=_0x476af4[_0x177f('0x63')][_0x177f('0x3e')]||{};var _0x1dab16=_0x476af4[_0x177f('0x63')][_0x177f('0x3f')]||{};if(_0x26008c){_0x3fdeee[_0x177f('0x39')]=getImapHost(_0x26008c);_0x3fdeee[_0x177f('0x3a')]=0x3e1;_0x1dab16[_0x177f('0x39')]=getSmtpHost(_0x26008c);_0x1dab16['port']=0x24b;_0x1dab16[_0x177f('0x3b')]=![];}if(_0x1dab16[_0x177f('0x37')]){_0x1dab16['secure']=![];}else{_0x1dab16[_0x177f('0x38')]=null;}if(!_0x3fdeee['modernAuthentication'])_0x3fdeee[_0x177f('0x38')]=null;_0x476af4[_0x177f('0x63')][_0x177f('0x3e')]=_0x3fdeee;_0x476af4[_0x177f('0x63')][_0x177f('0x3f')]=_0x1dab16;return db[_0x177f('0x44')][_0x177f('0x62')]({'where':{'id':_0x476af4[_0x177f('0x5e')]['id']},'include':[{'model':db[_0x177f('0x5f')],'as':'Imap'},{'model':db[_0x177f('0x41')],'as':'Smtp'},{'model':db[_0x177f('0x42')],'as':_0x177f('0x43')}]})[_0x177f('0x11')](handleEntityNotFound(_0x113651,null))['then'](function(_0x39e4e6){if(!_0x39e4e6)throw new Error(_0x177f('0x66'));if(_0x39e4e6[_0x177f('0x3c')])delete _0x476af4[_0x177f('0x63')]['Imap'];return _0x39e4e6;})['then'](saveUpdates(_0x476af4[_0x177f('0x63')],null))[_0x177f('0x11')](function(_0x46be58){if(!_0x476af4[_0x177f('0x63')][_0x177f('0x3e')])return _0x46be58;return db[_0x177f('0x5f')]['update'](_0x476af4[_0x177f('0x63')][_0x177f('0x3e')],{'where':{'MailAccountId':_0x46be58['id']}})[_0x177f('0x11')](function(){return _0x46be58;});})['then'](function(_0x5d1e70){if(!_0x476af4['body'][_0x177f('0x3f')])return _0x5d1e70;return db['MailServerOut'][_0x177f('0x24')](_0x476af4['body']['Smtp'],{'where':{'MailAccountId':_0x5d1e70['id']}})['then'](function(){return _0x5d1e70;});})['then'](respondWithResult(_0x113651,null))[_0x177f('0x1a')](handleError(_0x113651,null));};exports[_0x177f('0x67')]=function(_0x1d88e4,_0x97a915){return db[_0x177f('0x44')][_0x177f('0x67')]()[_0x177f('0x11')](respondWithResult(_0x97a915,null))[_0x177f('0x1a')](handleError(_0x97a915,null));};exports[_0x177f('0x68')]=function(_0x4cea8a,_0x1b3fbb){if(_0x4cea8a[_0x177f('0x63')]['id']){delete _0x4cea8a[_0x177f('0x63')]['id'];}return db[_0x177f('0x44')][_0x177f('0x62')]({'where':{'id':_0x4cea8a[_0x177f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1b3fbb,null))[_0x177f('0x11')](function(_0x115fba){if(_0x115fba){_0x4cea8a['body'][_0x177f('0x69')]=_0x115fba['id'];return db[_0x177f('0x6a')][_0x177f('0x6b')](_0x4cea8a[_0x177f('0x63')]);}})[_0x177f('0x11')](respondWithResult(_0x1b3fbb,null))[_0x177f('0x1a')](handleError(_0x1b3fbb,null));};exports[_0x177f('0x6c')]=function(_0x1fdd63,_0x550004){var _0x5348ea={'raw':![],'where':{}};var _0x4b3add={};var _0x4d023c={'count':0x0,'rows':[]};return db[_0x177f('0x44')]['findOne']({'where':{'id':_0x1fdd63[_0x177f('0x5e')]['id']}})[_0x177f('0x11')](handleEntityNotFound(_0x550004,null))[_0x177f('0x11')](function(_0x49ca2a){if(_0x49ca2a){_0x4b3add[_0x177f('0x48')]=_[_0x177f('0x60')](db['Disposition'][_0x177f('0x45')]);_0x4b3add[_0x177f('0x4a')]=_['keys'](_0x1fdd63[_0x177f('0x4a')]);_0x4b3add[_0x177f('0x53')]=_[_0x177f('0x4b')](_0x4b3add[_0x177f('0x48')],_0x4b3add[_0x177f('0x4a')]);_0x5348ea['attributes']=_[_0x177f('0x4b')](_0x4b3add[_0x177f('0x48')],qs['fields'](_0x1fdd63[_0x177f('0x4a')]['fields']));_0x5348ea['attributes']=_0x5348ea[_0x177f('0x4d')][_0x177f('0x61')]?_0x5348ea[_0x177f('0x4d')]:_0x4b3add['model'];if(!_0x1fdd63['query'][_0x177f('0x4e')](_0x177f('0x6d'))){_0x5348ea[_0x177f('0x21')]=qs[_0x177f('0x21')](_0x1fdd63['query'][_0x177f('0x21')]);_0x5348ea[_0x177f('0x1e')]=qs[_0x177f('0x1e')](_0x1fdd63[_0x177f('0x4a')][_0x177f('0x1e')]);}_0x5348ea[_0x177f('0x4f')]=qs[_0x177f('0x50')](_0x1fdd63[_0x177f('0x4a')][_0x177f('0x50')]);_0x5348ea[_0x177f('0x51')]=qs[_0x177f('0x53')](_['pick'](_0x1fdd63['query'],_0x4b3add[_0x177f('0x53')]));_0x5348ea['where'][_0x177f('0x69')]=_0x49ca2a['id'];if(_0x1fdd63['query'][_0x177f('0x54')]){_0x5348ea[_0x177f('0x51')]=_[_0x177f('0x55')](_0x5348ea[_0x177f('0x51')],{'$or':_['map'](_0x5348ea[_0x177f('0x4d')],function(_0x1536aa){var _0x43e086={};_0x43e086[_0x1536aa]={'$like':'%'+_0x1fdd63[_0x177f('0x4a')][_0x177f('0x54')]+'%'};return _0x43e086;})});}_0x5348ea=_[_0x177f('0x55')]({},_0x5348ea,_0x1fdd63[_0x177f('0x58')]);return db[_0x177f('0x6a')]['count']({'where':_0x5348ea[_0x177f('0x51')]})['then'](function(_0x3ea5ae){_0x4d023c[_0x177f('0x20')]=_0x3ea5ae;if(_0x1fdd63['query'][_0x177f('0x59')]){_0x5348ea[_0x177f('0x5a')]=[{'all':!![]}];}return db[_0x177f('0x6a')]['findAll'](_0x5348ea);})['then'](function(_0xd0b936){_0x4d023c['rows']=_0xd0b936;return _0x4d023c;});}})[_0x177f('0x11')](respondWithFilteredResult(_0x550004,_0x5348ea))['catch'](handleError(_0x550004,null));};exports[_0x177f('0x6e')]=function(_0x7cdf92,_0x19df54){return db[_0x177f('0x44')]['find']({'where':{'id':_0x7cdf92[_0x177f('0x5e')]['id']}})[_0x177f('0x11')](handleEntityNotFound(_0x19df54,null))[_0x177f('0x11')](function(_0x4c673c){if(_0x4c673c){return _0x4c673c[_0x177f('0x6e')](_0x7cdf92['query'][_0x177f('0x6f')]);}})[_0x177f('0x11')](respondWithStatusCode(_0x19df54,null))[_0x177f('0x1a')](handleError(_0x19df54,null));};exports[_0x177f('0x70')]=function(_0x5acf54,_0x41881e){if(_0x5acf54[_0x177f('0x63')]['id']){delete _0x5acf54[_0x177f('0x63')]['id'];}return db[_0x177f('0x44')][_0x177f('0x62')]({'where':{'id':_0x5acf54[_0x177f('0x5e')]['id']}})[_0x177f('0x11')](handleEntityNotFound(_0x41881e,null))[_0x177f('0x11')](function(_0x205827){if(_0x205827){_0x5acf54['body']['MailAccountId']=_0x205827['id'];return db[_0x177f('0x71')][_0x177f('0x6b')](_0x5acf54[_0x177f('0x63')]);}})['then'](respondWithResult(_0x41881e,null))[_0x177f('0x1a')](handleError(_0x41881e,null));};exports[_0x177f('0x72')]=function(_0x567765,_0x1dcdf9){var _0x17f71d={'raw':![],'where':{}};var _0x259bfa={};var _0x1f41d6={'count':0x0,'rows':[]};return db['MailAccount'][_0x177f('0x73')]({'where':{'id':_0x567765['params']['id']}})[_0x177f('0x11')](handleEntityNotFound(_0x1dcdf9,null))[_0x177f('0x11')](function(_0x1ba477){if(_0x1ba477){_0x259bfa['model']=_[_0x177f('0x60')](db[_0x177f('0x71')][_0x177f('0x45')]);_0x259bfa[_0x177f('0x4a')]=_['keys'](_0x567765[_0x177f('0x4a')]);_0x259bfa[_0x177f('0x53')]=_['intersection'](_0x259bfa[_0x177f('0x48')],_0x259bfa[_0x177f('0x4a')]);_0x17f71d['attributes']=_['intersection'](_0x259bfa[_0x177f('0x48')],qs[_0x177f('0x4c')](_0x567765[_0x177f('0x4a')][_0x177f('0x4c')]));_0x17f71d[_0x177f('0x4d')]=_0x17f71d[_0x177f('0x4d')][_0x177f('0x61')]?_0x17f71d['attributes']:_0x259bfa[_0x177f('0x48')];if(!_0x567765[_0x177f('0x4a')]['hasOwnProperty'](_0x177f('0x6d'))){_0x17f71d[_0x177f('0x21')]=qs[_0x177f('0x21')](_0x567765[_0x177f('0x4a')][_0x177f('0x21')]);_0x17f71d[_0x177f('0x1e')]=qs[_0x177f('0x1e')](_0x567765[_0x177f('0x4a')][_0x177f('0x1e')]);}_0x17f71d[_0x177f('0x4f')]=qs['sort'](_0x567765[_0x177f('0x4a')]['sort']);_0x17f71d[_0x177f('0x51')]=qs[_0x177f('0x53')](_[_0x177f('0x52')](_0x567765[_0x177f('0x4a')],_0x259bfa[_0x177f('0x53')]));_0x17f71d[_0x177f('0x51')]['MailAccountId']=_0x1ba477['id'];if(_0x567765[_0x177f('0x4a')]['filter']){_0x17f71d['where']=_[_0x177f('0x55')](_0x17f71d[_0x177f('0x51')],{'$or':_['map'](_0x17f71d[_0x177f('0x4d')],function(_0x33ee3e){var _0x211e13={};_0x211e13[_0x33ee3e]={'$like':'%'+_0x567765[_0x177f('0x4a')]['filter']+'%'};return _0x211e13;})});}_0x17f71d=_[_0x177f('0x55')]({},_0x17f71d,_0x567765['options']);return db['CannedAnswer'][_0x177f('0x20')]({'where':_0x17f71d['where']})[_0x177f('0x11')](function(_0x32dff8){_0x1f41d6['count']=_0x32dff8;if(_0x567765[_0x177f('0x4a')]['includeAll']){_0x17f71d[_0x177f('0x5a')]=[{'all':!![]}];}return db[_0x177f('0x71')]['findAll'](_0x17f71d);})[_0x177f('0x11')](function(_0x46a78e){_0x1f41d6[_0x177f('0x5c')]=_0x46a78e;return _0x1f41d6;});}})[_0x177f('0x11')](respondWithFilteredResult(_0x1dcdf9,_0x17f71d))[_0x177f('0x1a')](handleError(_0x1dcdf9,null));};exports['removeAnswers']=function(_0x185540,_0x4f6652){return db[_0x177f('0x44')][_0x177f('0x62')]({'where':{'id':_0x185540[_0x177f('0x5e')]['id']}})[_0x177f('0x11')](handleEntityNotFound(_0x4f6652,null))[_0x177f('0x11')](function(_0x316908){if(_0x316908){return _0x316908[_0x177f('0x74')](_0x185540[_0x177f('0x4a')][_0x177f('0x6f')]);}})[_0x177f('0x11')](respondWithStatusCode(_0x4f6652,null))['catch'](handleError(_0x4f6652,null));};exports[_0x177f('0x6b')]=function(_0x3b7c11,_0x4d513a){var _0x4f8c95={'name':_0x3b7c11['body'][_0x177f('0x29')],'key':_0x3b7c11['body'][_0x177f('0x47')],'provider':_0x3b7c11[_0x177f('0x63')][_0x177f('0x64')]===_0x177f('0x65')?null:_0x3b7c11[_0x177f('0x63')][_0x177f('0x64')],'email':_0x3b7c11[_0x177f('0x63')]['email'],'ListId':_0x3b7c11[_0x177f('0x63')]['ListId'],'active':!_[_0x177f('0x75')](_0x3b7c11[_0x177f('0x63')]['active'])?_0x3b7c11[_0x177f('0x63')][_0x177f('0x76')]:!![],'description':_0x3b7c11[_0x177f('0x63')][_0x177f('0x77')]||null};var _0x5aa262=getAuthenticationOptions(_0x4f8c95[_0x177f('0x64')],_0x3b7c11[_0x177f('0x63')]);_0x4f8c95[_0x177f('0x3e')]=_0x5aa262[_0x177f('0x3e')];_0x4f8c95[_0x177f('0x3f')]=_0x5aa262[_0x177f('0x3f')];return db['MailAccount'][_0x177f('0x6b')](_0x4f8c95,{'include':[{'model':db[_0x177f('0x41')],'as':_0x177f('0x3f')},{'model':db[_0x177f('0x5f')],'as':_0x177f('0x3e')}]})[_0x177f('0x11')](function(_0x134dc8){var _0x37227b=_0x3b7c11[_0x177f('0x33')][_0x177f('0x26')]({'plain':!![]});if(!_0x37227b)throw new Error(_0x177f('0x78'));if(_0x37227b['role']===_0x177f('0x33')){var _0x1feebc=_0x134dc8[_0x177f('0x26')]({'plain':!![]});return db[_0x177f('0x79')][_0x177f('0x62')]({'where':{'name':'MailAccounts','userProfileId':_0x37227b['userProfileId']},'raw':!![]})[_0x177f('0x11')](function(_0x483d6c){if(_0x483d6c&&_0x483d6c[_0x177f('0x7a')]===0x0){return db[_0x177f('0x28')][_0x177f('0x6b')]({'name':_0x1feebc[_0x177f('0x29')],'resourceId':_0x1feebc['id'],'type':_0x483d6c[_0x177f('0x29')],'sectionId':_0x483d6c['id']},{})['then'](function(){return _0x134dc8;});}else{return _0x134dc8;}})['catch'](function(_0x1b2306){logger['error'](_0x177f('0x7b'),_0x1b2306);throw _0x1b2306;});}return _0x134dc8;})[_0x177f('0x11')](respondWithResult(_0x4d513a,0xc9))[_0x177f('0x1a')](handleError(_0x4d513a,null));};exports[_0x177f('0x7c')]=function(_0x427cd4,_0x30d681){return db[_0x177f('0x44')][_0x177f('0x73')]({'where':{'id':_0x427cd4[_0x177f('0x5e')]['id']}})[_0x177f('0x11')](handleEntityNotFound(_0x30d681,null))[_0x177f('0x11')](function(_0x2c5bfa){if(_0x2c5bfa){return _0x2c5bfa['getImap']();}return null;})[_0x177f('0x11')](respondWithResult(_0x30d681,null))['catch'](handleError(_0x30d681,null));};exports[_0x177f('0x7d')]=function(_0x59cd83,_0x4d8629){if(_0x59cd83[_0x177f('0x63')]['id']){delete _0x59cd83[_0x177f('0x63')]['id'];}return db[_0x177f('0x44')][_0x177f('0x62')]({'where':{'id':_0x59cd83[_0x177f('0x5e')]['id']}})[_0x177f('0x11')](handleEntityNotFound(_0x4d8629,null))['then'](function(_0x1eacc5){if(_0x1eacc5){_0x59cd83['body'][_0x177f('0x69')]=_0x1eacc5['id'];return db[_0x177f('0x5f')][_0x177f('0x6b')](_0x59cd83[_0x177f('0x63')]);}})[_0x177f('0x11')](respondWithResult(_0x4d8629,null))[_0x177f('0x1a')](handleError(_0x4d8629,null));};exports['removeImap']=function(_0x5ad694,_0x56c48e){return db['MailAccount']['findOne']({'where':{'id':_0x5ad694[_0x177f('0x5e')]['id']}})[_0x177f('0x11')](handleEntityNotFound(_0x56c48e,null))[_0x177f('0x11')](function(_0x44828a){if(_0x44828a){return _0x44828a[_0x177f('0x7e')](null);}return null;})['then'](respondWithStatusCode(_0x56c48e,null))[_0x177f('0x1a')](handleError(_0x56c48e,null));};exports[_0x177f('0x7f')]=function(_0x33cb0b,_0x480a5b){return db[_0x177f('0x44')][_0x177f('0x73')]({'where':{'id':_0x33cb0b[_0x177f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x480a5b,null))['then'](function(_0x2795c5){if(_0x2795c5){return _0x2795c5[_0x177f('0x7f')]();}return null;})[_0x177f('0x11')](respondWithResult(_0x480a5b,null))[_0x177f('0x1a')](handleError(_0x480a5b,null));};exports[_0x177f('0x80')]=function(_0x4324f9,_0x5aee03){if(_0x4324f9['body']['id']){delete _0x4324f9['body']['id'];}return db[_0x177f('0x44')][_0x177f('0x62')]({'where':{'id':_0x4324f9[_0x177f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5aee03,null))['then'](function(_0x3ef2c1){if(_0x3ef2c1){_0x4324f9[_0x177f('0x63')][_0x177f('0x69')]=_0x3ef2c1['id'];return db[_0x177f('0x41')]['create'](_0x4324f9['body']);}})['then'](respondWithResult(_0x5aee03,null))[_0x177f('0x1a')](handleError(_0x5aee03,null));};exports[_0x177f('0x81')]=function(_0x198b41,_0x59bd97){return db[_0x177f('0x44')][_0x177f('0x73')]({'where':{'id':_0x198b41[_0x177f('0x5e')]['id']}})[_0x177f('0x11')](handleEntityNotFound(_0x59bd97,null))[_0x177f('0x11')](function(_0x39422c){if(_0x39422c){return _0x39422c['setSmtp'](null);}return null;})[_0x177f('0x11')](respondWithStatusCode(_0x59bd97,null))[_0x177f('0x1a')](handleError(_0x59bd97,null));};exports[_0x177f('0x82')]=function(_0x56c9dc,_0x47ecc0){return db[_0x177f('0x83')][_0x177f('0x62')]({'where':{'id':_0x56c9dc[_0x177f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x47ecc0,null))[_0x177f('0x11')](function(_0x5b012e){if(_0x5b012e){return _0x5b012e['addInteraction'](_0x56c9dc[_0x177f('0x63')][_0x177f('0x6f')],_['omit'](_0x56c9dc[_0x177f('0x63')],[_0x177f('0x6f'),'id'])||{});}})[_0x177f('0x11')](respondWithResult(_0x47ecc0,null))[_0x177f('0x1a')](handleError(_0x47ecc0,null));};exports[_0x177f('0x84')]=function(_0x58a851,_0x450a79){var _0x5f457d={'raw':![],'where':{}};var _0x3a4ead={};var _0x40446a={'count':0x0,'rows':[]};return db[_0x177f('0x44')][_0x177f('0x73')]({'where':{'id':_0x58a851[_0x177f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x450a79,null))[_0x177f('0x11')](function(_0x443b89){if(_0x443b89){_0x3a4ead[_0x177f('0x48')]=_[_0x177f('0x60')](db[_0x177f('0x83')][_0x177f('0x45')]);_0x3a4ead['query']=_[_0x177f('0x60')](_0x58a851[_0x177f('0x4a')]);_0x3a4ead[_0x177f('0x53')]=_[_0x177f('0x4b')](_0x3a4ead['model'],_0x3a4ead[_0x177f('0x4a')]);_0x5f457d[_0x177f('0x4d')]=_[_0x177f('0x4b')](_0x3a4ead[_0x177f('0x48')],qs[_0x177f('0x4c')](_0x58a851[_0x177f('0x4a')][_0x177f('0x4c')]));_0x5f457d[_0x177f('0x4d')]=_0x5f457d[_0x177f('0x4d')][_0x177f('0x61')]?_0x5f457d[_0x177f('0x4d')]:_0x3a4ead[_0x177f('0x48')];if(!_0x58a851['query']['hasOwnProperty']('nolimit')){_0x5f457d[_0x177f('0x21')]=qs[_0x177f('0x21')](_0x58a851[_0x177f('0x4a')][_0x177f('0x21')]);_0x5f457d[_0x177f('0x1e')]=qs['offset'](_0x58a851[_0x177f('0x4a')][_0x177f('0x1e')]);}_0x5f457d[_0x177f('0x4f')]=qs[_0x177f('0x50')](_0x58a851[_0x177f('0x4a')]['sort']);_0x5f457d[_0x177f('0x51')]=qs[_0x177f('0x53')](_[_0x177f('0x52')](_0x58a851[_0x177f('0x4a')],_0x3a4ead[_0x177f('0x53')]));_0x5f457d[_0x177f('0x51')][_0x177f('0x69')]=_0x443b89['id'];if(_0x58a851[_0x177f('0x4a')]['filter']){_0x5f457d[_0x177f('0x51')]=_[_0x177f('0x55')](_0x5f457d[_0x177f('0x51')],{'$or':_[_0x177f('0x49')](_0x5f457d[_0x177f('0x4d')],function(_0x4a8a87){var _0x1bfdc3={};_0x1bfdc3[_0x4a8a87]={'$like':'%'+_0x58a851['query']['filter']+'%'};return _0x1bfdc3;})});}_0x5f457d=_[_0x177f('0x55')]({},_0x5f457d,_0x58a851[_0x177f('0x58')]);return db['MailInteraction'][_0x177f('0x20')]({'where':_0x5f457d[_0x177f('0x51')]})[_0x177f('0x11')](function(_0x2b4f3a){_0x40446a['count']=_0x2b4f3a;if(_0x58a851[_0x177f('0x4a')][_0x177f('0x59')]){_0x5f457d['include']=[{'model':db[_0x177f('0x85')],'as':'Contact','required':![]},{'model':db[_0x177f('0x86')],'as':'Owner','attributes':[_0x177f('0x29'),_0x177f('0x87'),'internal'],'required':![]},{'model':db[_0x177f('0x88')],'as':_0x177f('0x89'),'attributes':['id','name','color'],'where':_0x58a851['query'][_0x177f('0x8a')]?{'id':_0x58a851[_0x177f('0x4a')][_0x177f('0x8a')]}:undefined,'required':_0x58a851[_0x177f('0x4a')][_0x177f('0x8a')]?!![]:![]}];}return db[_0x177f('0x83')][_0x177f('0x5b')](_0x5f457d);})[_0x177f('0x11')](function(_0x2e9272){_0x40446a[_0x177f('0x5c')]=_0x2e9272;return _0x40446a;});}})[_0x177f('0x11')](respondWithFilteredResult(_0x450a79,_0x5f457d))[_0x177f('0x1a')](handleError(_0x450a79,null));};exports['addApplications']=function addApplications(_0x2c011a,_0x27326b){var _0x486b28=_0x2c011a['params']['id'];var _0x2654de=_0x2c011a[_0x177f('0x63')];var _0x39dbc9=0xc8;var _0x4a3875=null;return db[_0x177f('0x8b')][_0x177f('0x8c')]({'isolationLevel':db[_0x177f('0x8b')][_0x177f('0x8d')][_0x177f('0x8e')][_0x177f('0x8f')]},function(_0x162a1c){return db[_0x177f('0x44')][_0x177f('0x73')]({'where':{'id':_0x486b28},'transaction':_0x162a1c})[_0x177f('0x11')](function(_0x591031){if(_0x591031){return db['MailApplication'][_0x177f('0x25')]({'where':{'MailAccountId':_0x486b28},'transaction':_0x162a1c})[_0x177f('0x11')](function(){var _0x421d09=_[_0x177f('0x49')](_0x2654de,function(_0x38969a){_0x38969a[_0x177f('0x69')]=_0x486b28;return _0x38969a;});return db['MailApplication'][_0x177f('0x90')](_0x421d09,{'transaction':_0x162a1c});});}else{_0x39dbc9=0x194;_0x4a3875=[];}});})[_0x177f('0x11')](function(){if(_0x39dbc9!==0x194){return db[_0x177f('0x91')][_0x177f('0x92')]({'where':{'MailAccountId':_0x486b28},'order':'priority'})[_0x177f('0x11')](function(_0xb781c5){_0x4a3875=_0xb781c5;});}})[_0x177f('0x1a')](function(_0x353bf3){_0x39dbc9=0x1f4;logger['error'](_0x353bf3[_0x177f('0x93')]);if(_0x353bf3['name']){delete _0x353bf3['name'];}_0x4a3875=_0x353bf3;})[_0x177f('0x94')](function(){if(_0x4a3875===null){_0x27326b[_0x177f('0x95')](_0x39dbc9);}else{if(_0x39dbc9===0x1f4){_0x27326b[_0x177f('0x1b')](_0x39dbc9)[_0x177f('0x2a')](_0x4a3875);}else{_0x27326b[_0x177f('0x1b')](_0x39dbc9)['json'](_0x4a3875);}}});};exports[_0x177f('0x96')]=function(_0x5d5203,_0xa2caca){var _0x13e147={};var _0x43fd89={};var _0x2eccbf;var _0x199673;return db[_0x177f('0x44')]['findOne']({'where':{'id':_0x5d5203['params']['id']}})['then'](handleEntityNotFound(_0xa2caca,null))[_0x177f('0x11')](function(_0x197ae5){if(_0x197ae5){_0x2eccbf=_0x197ae5;_0x43fd89[_0x177f('0x48')]=_[_0x177f('0x60')](db[_0x177f('0x91')][_0x177f('0x45')]);_0x43fd89['query']=_[_0x177f('0x60')](_0x5d5203['query']);_0x43fd89[_0x177f('0x53')]=_[_0x177f('0x4b')](_0x43fd89[_0x177f('0x48')],_0x43fd89[_0x177f('0x4a')]);_0x13e147[_0x177f('0x4d')]=_[_0x177f('0x4b')](_0x43fd89[_0x177f('0x48')],qs['fields'](_0x5d5203[_0x177f('0x4a')]['fields']));_0x13e147[_0x177f('0x4d')]=_0x13e147[_0x177f('0x4d')][_0x177f('0x61')]?_0x13e147[_0x177f('0x4d')]:_0x43fd89[_0x177f('0x48')];_0x13e147[_0x177f('0x4f')]=qs[_0x177f('0x50')](_0x5d5203['query'][_0x177f('0x50')]);_0x13e147[_0x177f('0x51')]=qs['filters'](_[_0x177f('0x52')](_0x5d5203[_0x177f('0x4a')],_0x43fd89[_0x177f('0x53')]));if(_0x5d5203[_0x177f('0x4a')]['filter']){_0x13e147[_0x177f('0x51')]=_[_0x177f('0x55')](_0x13e147[_0x177f('0x51')],{'$or':_[_0x177f('0x49')](_0x13e147[_0x177f('0x4d')],function(_0x550d59){var _0x111f8c={};_0x111f8c[_0x550d59]={'$like':'%'+_0x5d5203['query'][_0x177f('0x54')]+'%'};return _0x111f8c;})});}_0x13e147=_[_0x177f('0x55')]({},_0x13e147,_0x5d5203[_0x177f('0x58')]);return _0x2eccbf[_0x177f('0x96')](_0x13e147);}})[_0x177f('0x11')](function(_0xe4cab3){if(_0xe4cab3){_0x199673=_0xe4cab3[_0x177f('0x61')];if(!_0x5d5203['query'][_0x177f('0x4e')](_0x177f('0x6d'))){_0x13e147['limit']=qs[_0x177f('0x21')](_0x5d5203[_0x177f('0x4a')][_0x177f('0x21')]);_0x13e147[_0x177f('0x1e')]=qs['offset'](_0x5d5203[_0x177f('0x4a')]['offset']);}return _0x2eccbf[_0x177f('0x96')](_0x13e147);}})[_0x177f('0x11')](function(_0x9a3831){if(_0x9a3831){return _0x9a3831?{'count':_0x199673,'rows':_0x9a3831}:null;}})['then'](respondWithResult(_0xa2caca,null))[_0x177f('0x1a')](handleError(_0xa2caca,null));};exports['getMessages']=function(_0x1c1828,_0x1588a3){var _0x18c2b9={'raw':!![],'where':{}};var _0x4275b2={};var _0x3aff3d={'count':0x0,'rows':[]};return db[_0x177f('0x44')]['findOne']({'where':{'id':_0x1c1828[_0x177f('0x5e')]['id']}})[_0x177f('0x11')](handleEntityNotFound(_0x1588a3,null))[_0x177f('0x11')](function(_0x181d5d){if(_0x181d5d){_0x4275b2[_0x177f('0x48')]=_['keys'](db['MailMessage']['rawAttributes']);_0x4275b2[_0x177f('0x4a')]=_[_0x177f('0x60')](_0x1c1828['query']);_0x4275b2[_0x177f('0x53')]=_[_0x177f('0x4b')](_0x4275b2[_0x177f('0x48')],_0x4275b2['query']);_0x18c2b9[_0x177f('0x4d')]=_[_0x177f('0x4b')](_0x4275b2[_0x177f('0x48')],qs[_0x177f('0x4c')](_0x1c1828[_0x177f('0x4a')][_0x177f('0x4c')]));_0x18c2b9[_0x177f('0x4d')]=_0x18c2b9[_0x177f('0x4d')]['length']?_0x18c2b9[_0x177f('0x4d')]:_0x4275b2['model'];if(!_0x1c1828[_0x177f('0x4a')]['hasOwnProperty'](_0x177f('0x6d'))){_0x18c2b9['limit']=qs[_0x177f('0x21')](_0x1c1828[_0x177f('0x4a')][_0x177f('0x21')]);_0x18c2b9[_0x177f('0x1e')]=qs[_0x177f('0x1e')](_0x1c1828[_0x177f('0x4a')][_0x177f('0x1e')]);}_0x18c2b9['order']=qs[_0x177f('0x50')](_0x1c1828[_0x177f('0x4a')][_0x177f('0x50')]);_0x18c2b9[_0x177f('0x51')]=qs['filters'](_[_0x177f('0x52')](_0x1c1828[_0x177f('0x4a')],_0x4275b2[_0x177f('0x53')]));_0x18c2b9[_0x177f('0x51')]['MailAccountId']=_0x181d5d['id'];if(_0x1c1828[_0x177f('0x4a')][_0x177f('0x54')]){_0x18c2b9[_0x177f('0x51')]=_[_0x177f('0x55')](_0x18c2b9[_0x177f('0x51')],{'$or':_[_0x177f('0x49')](_0x18c2b9[_0x177f('0x4d')],function(_0x3beb6b){var _0x4af43d={};_0x4af43d[_0x3beb6b]={'$like':'%'+_0x1c1828[_0x177f('0x4a')]['filter']+'%'};return _0x4af43d;})});}if(_0x1c1828[_0x177f('0x4a')][_0x177f('0x97')]){var _0x54e0e8=_0x1c1828['query'][_0x177f('0x97')][_0x177f('0x98')](',');var _0xecd26={};_0xecd26[_0x54e0e8[0x0]]={'$gte':moment(_0x54e0e8[0x1])[_0x177f('0x99')](_0x177f('0x9a'))};_0x18c2b9[_0x177f('0x51')]=_[_0x177f('0x55')](_0x18c2b9['where'],_0xecd26);}_0x18c2b9=_[_0x177f('0x55')]({},_0x18c2b9,_0x1c1828[_0x177f('0x58')]);return db['MailMessage']['count']({'where':_0x18c2b9[_0x177f('0x51')]})[_0x177f('0x11')](function(_0x4d39d9){_0x3aff3d[_0x177f('0x20')]=_0x4d39d9;if(_0x1c1828[_0x177f('0x4a')][_0x177f('0x59')]){_0x18c2b9['include']=[{'all':!![]}];}return db[_0x177f('0x9b')]['findAll'](_0x18c2b9);})['then'](function(_0x4fe72e){if(_0x1c1828[_0x177f('0x4a')][_0x177f('0x9c')]===_0x177f('0x9d')){for(var _0x5ab338=0x0;_0x5ab338<_0x4fe72e[_0x177f('0x61')];_0x5ab338++){_0x4fe72e[_0x5ab338][_0x177f('0x63')]=juice(_0x4fe72e[_0x5ab338][_0x177f('0x63')]);}}_0x3aff3d[_0x177f('0x5c')]=_0x4fe72e;return _0x3aff3d;});}})[_0x177f('0x11')](respondWithFilteredResult(_0x1588a3,_0x18c2b9))[_0x177f('0x1a')](handleError(_0x1588a3,null));};exports['send']=function(_0x1238ba,_0x45d265){var _0x44bc26,_0x17742d={},_0x189486;if(_0x1238ba['body']['to']){_0x189486=_0x1238ba[_0x177f('0x63')]['to'][_0x177f('0x98')](',')[0x0];}return db[_0x177f('0x44')][_0x177f('0x62')]({'where':{'id':_0x1238ba[_0x177f('0x5e')]['id']},'include':[{'model':db[_0x177f('0x9e')],'as':_0x177f('0x9f'),'include':[{'model':db[_0x177f('0x85')],'as':_0x177f('0xa0'),'where':{'email':_0x189486},'limit':0x1,'order':[['updatedAt',_0x177f('0xa1')]]}]},{'model':db[_0x177f('0x41')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x177f('0xa2')],'as':_0x177f('0xa2'),'raw':!![]}]}]})[_0x177f('0x11')](handleEntityNotFound(_0x45d265,null))[_0x177f('0x11')](function(_0x4b51fa){if(!_0x4b51fa)return;_0x44bc26=_0x4b51fa;if(!_0x4b51fa['Smtp'])throw new Error(_0x177f('0xa3'));if(_['isNil'](_0x1238ba[_0x177f('0x63')][_0x177f('0xa4')])){_0x1238ba[_0x177f('0x63')][_0x177f('0xa4')]=util[_0x177f('0x99')](_0x177f('0xa5'),_0x4b51fa[_0x177f('0x29')],_0x4b51fa[_0x177f('0xa6')]||_0x4b51fa[_0x177f('0x3f')]['user']);}if(_0x1238ba[_0x177f('0x63')]['attachments']&&_0x1238ba[_0x177f('0x63')][_0x177f('0xa7')][_0x177f('0x61')]){for(var _0x5ef4da=0x0;_0x5ef4da<_0x1238ba['body'][_0x177f('0xa7')][_0x177f('0x61')];_0x5ef4da+=0x1){_0x1238ba['body']['attachments'][_0x5ef4da]={'filename':_0x1238ba[_0x177f('0x63')]['attachments'][_0x5ef4da][_0x177f('0x29')],'path':path['join'](config[_0x177f('0xa8')],_0x177f('0xa9'),_0x1238ba[_0x177f('0x63')][_0x177f('0xa7')][_0x5ef4da]['basename'])};}}var _0x5e05b1=_0x4b51fa[_0x177f('0xaa')]();return respondWithRpcPromise(_0x177f('0xab'),'sendMail',{'account':_0x5e05b1,'message':_0x1238ba['body']});})[_0x177f('0x11')](function(_0x49fe01){if(!_0x49fe01)return;_0x17742d=_0x49fe01;if(!_0x44bc26['List'])throw new Error(_0x177f('0xac'));if(_0x44bc26[_0x177f('0x9f')][_0x177f('0xa0')]['length'])return _0x44bc26[_0x177f('0x9f')][_0x177f('0xa0')][0x0];return db['CmContact']['create'](_[_0x177f('0xad')](_0x1238ba['body'],{'firstName':_0x1238ba[_0x177f('0x63')]['to'],'email':_0x1238ba[_0x177f('0x63')]['to'],'phone':_0x1238ba[_0x177f('0x63')]['to'],'ListId':_0x44bc26[_0x177f('0xae')]}));})[_0x177f('0x11')](function(_0x46eac5){if(!_0x46eac5)return;var _0x547121={'UserId':_0x1238ba[_0x177f('0x33')]['id'],'ContactId':_0x46eac5['id'],'MailAccountId':_0x44bc26['id'],'inReplyTo':_0x17742d[_0x177f('0xaf')],'to':_0x1238ba['body'][_0x177f('0xa4')],'cc':_0x1238ba[_0x177f('0x63')]['cc'],'subject':_0x1238ba['body'][_0x177f('0xb0')],'attach':_0x1238ba['body']['attach'],'firstMsgDirection':_0x177f('0xb1'),'lastMsgAt':moment()[_0x177f('0x99')](_0x177f('0x9a')),'lastMsgDirection':_0x177f('0xb1'),'Messages':[_[_0x177f('0x55')](_0x1238ba[_0x177f('0x63')],{'messageId':_0x17742d[_0x177f('0xaf')],'sentAt':moment()[_0x177f('0x99')](_0x177f('0x9a')),'read':!![],'MailAccountId':_0x44bc26['id'],'UserId':_0x1238ba[_0x177f('0x33')]['id'],'ContactId':_0x46eac5['id']})]};if(_0x1238ba[_0x177f('0x63')][_0x177f('0xb2')]){_0x547121=_[_0x177f('0x55')](_0x547121,_0x1238ba[_0x177f('0x63')][_0x177f('0xb2')]);}return db[_0x177f('0x83')][_0x177f('0x6b')](_0x547121,{'include':[{'model':db[_0x177f('0x9b')],'as':_0x177f('0xb3')}]});})['then'](respondWithResult(_0x45d265,null))[_0x177f('0x1a')](handleError(_0x45d265,null));};exports['verifySmtp']=function(_0x566270,_0x1fa116){return db['MailAccount'][_0x177f('0x62')]({'where':{'id':_0x566270[_0x177f('0x5e')]['id']},'include':[{'model':db[_0x177f('0x41')],'as':_0x177f('0x3f'),'raw':!![],'include':[{'model':db[_0x177f('0xa2')],'as':_0x177f('0xa2'),'raw':!![]}]}]})[_0x177f('0x11')](handleEntityNotFound(_0x1fa116,null))['then'](function(_0x42345b){if(!_0x42345b[_0x177f('0x3f')])return;var _0x3dc08f=_0x42345b['getSmtpOptions']();return respondWithRpcPromise(_0x177f('0xb4'),'verifySmtp',{'account':_0x3dc08f});})[_0x177f('0x11')](respondWithResult(_0x1fa116,null))['catch'](handleError(_0x1fa116,null));};exports[_0x177f('0x25')]=function(_0x505ac2,_0x2efee2){return db[_0x177f('0x44')][_0x177f('0x62')]({'where':{'id':_0x505ac2[_0x177f('0x5e')]['id']}})[_0x177f('0x11')](handleEntityNotFound(_0x2efee2,null))[_0x177f('0x11')](function(_0xc1dccb){if(_0xc1dccb&&_0xc1dccb[_0x177f('0x3c')]){throw new db[(_0x177f('0xb5'))][(_0x177f('0xb6'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0xc1dccb;})[_0x177f('0x11')](removeEntity(_0x2efee2,null))['catch'](handleError(_0x2efee2,null));};exports[_0x177f('0xb7')]=function(_0x4c992f,_0x59da23){return db[_0x177f('0x44')][_0x177f('0x62')]({'where':{'id':_0x4c992f[_0x177f('0x5e')]['id']}})[_0x177f('0x11')](handleEntityNotFound(_0x59da23,null))[_0x177f('0x11')](function(_0x3809b1){if(_0x3809b1){return _0x3809b1[_0x177f('0xb7')](_0x4c992f[_0x177f('0x63')]['ids'],_['omit'](_0x4c992f[_0x177f('0x63')],[_0x177f('0x6f'),'id'])||{})['spread'](function(_0x24c134){for(var _0x54f6bf=0x0;_0x54f6bf<_0x4c992f['body'][_0x177f('0x6f')][_0x177f('0x61')];_0x54f6bf+=0x1){socket['emit'](_0x177f('0xb8'),{'UserId':Number(_0x4c992f[_0x177f('0x63')][_0x177f('0x6f')][_0x54f6bf]),'MailAccountId':Number(_0x4c992f['params']['id'])});}return _0x24c134;});}})[_0x177f('0x11')](respondWithResult(_0x59da23,null))[_0x177f('0x1a')](handleError(_0x59da23,null));};exports[_0x177f('0xb9')]=function(_0x4ec845,_0x52e3e7){return db['MailAccount'][_0x177f('0x62')]({'where':{'id':_0x4ec845[_0x177f('0x5e')]['id']}})[_0x177f('0x11')](handleEntityNotFound(_0x52e3e7,null))[_0x177f('0x11')](function(_0x3280ae){if(_0x3280ae){return _0x3280ae['removeAgents'](_0x4ec845[_0x177f('0x4a')][_0x177f('0x6f')])[_0x177f('0x11')](function(){if(_['isArray'](_0x4ec845[_0x177f('0x4a')][_0x177f('0x6f')])){for(var _0x476761=0x0;_0x476761<_0x4ec845[_0x177f('0x4a')][_0x177f('0x6f')][_0x177f('0x61')];_0x476761+=0x1){socket[_0x177f('0xba')]('userMailAccount:remove',{'UserId':Number(_0x4ec845[_0x177f('0x4a')]['ids'][_0x476761]),'MailAccountId':Number(_0x4ec845[_0x177f('0x5e')]['id'])});}}else{socket[_0x177f('0xba')](_0x177f('0xbb'),{'UserId':Number(_0x4ec845[_0x177f('0x4a')][_0x177f('0x6f')]),'MailAccountId':Number(_0x4ec845[_0x177f('0x5e')]['id'])});}});}})[_0x177f('0x11')](respondWithStatusCode(_0x52e3e7,null))[_0x177f('0x1a')](handleError(_0x52e3e7,null));};exports[_0x177f('0xbc')]=function(_0x40e59a,_0x40c19a){var _0x161403={};var _0x2f7c2c={};var _0x3ee5f1;var _0xfced1f;return db[_0x177f('0x44')][_0x177f('0x73')]({'where':{'id':_0x40e59a[_0x177f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x40c19a,null))[_0x177f('0x11')](function(_0x301390){if(_0x301390){_0x3ee5f1=_0x301390;_0x2f7c2c[_0x177f('0x48')]=_['keys'](db['User'][_0x177f('0x45')]);_0x2f7c2c[_0x177f('0x4a')]=_[_0x177f('0x60')](_0x40e59a['query']);_0x2f7c2c[_0x177f('0x53')]=_['intersection'](_0x2f7c2c[_0x177f('0x48')],_0x2f7c2c[_0x177f('0x4a')]);_0x161403['attributes']=_['intersection'](_0x2f7c2c['model'],qs['fields'](_0x40e59a[_0x177f('0x4a')][_0x177f('0x4c')]));_0x161403[_0x177f('0x4d')]=_0x161403[_0x177f('0x4d')][_0x177f('0x61')]?_0x161403[_0x177f('0x4d')]:_0x2f7c2c[_0x177f('0x48')];_0x161403[_0x177f('0x4f')]=qs[_0x177f('0x50')](_0x40e59a['query'][_0x177f('0x50')]);_0x161403['where']=qs[_0x177f('0x53')](_[_0x177f('0x52')](_0x40e59a[_0x177f('0x4a')],_0x2f7c2c[_0x177f('0x53')]));if(_0x40e59a[_0x177f('0x4a')][_0x177f('0x54')]){_0x161403[_0x177f('0x51')]=_['merge'](_0x161403['where'],{'$or':_[_0x177f('0x49')](_0x161403[_0x177f('0x4d')],function(_0x269f9d){var _0x4677fb={};_0x4677fb[_0x269f9d]={'$like':'%'+_0x40e59a[_0x177f('0x4a')][_0x177f('0x54')]+'%'};return _0x4677fb;})});}_0x161403=_[_0x177f('0x55')]({},_0x161403,_0x40e59a[_0x177f('0x58')]);return _0x3ee5f1['getAgents'](_0x161403);}})[_0x177f('0x11')](function(_0xa7041b){if(_0xa7041b){_0xfced1f=_0xa7041b[_0x177f('0x61')];if(!_0x40e59a[_0x177f('0x4a')]['hasOwnProperty'](_0x177f('0x6d'))){_0x161403[_0x177f('0x21')]=qs['limit'](_0x40e59a[_0x177f('0x4a')]['limit']);_0x161403[_0x177f('0x1e')]=qs[_0x177f('0x1e')](_0x40e59a[_0x177f('0x4a')][_0x177f('0x1e')]);}return _0x3ee5f1[_0x177f('0xbc')](_0x161403);}})[_0x177f('0x11')](function(_0xfb5876){if(_0xfb5876){return _0xfb5876?{'count':_0xfced1f,'rows':_0xfb5876}:null;}})['then'](respondWithResult(_0x40c19a,null))[_0x177f('0x1a')](handleError(_0x40c19a,null));}; \ No newline at end of file +var _0x8af6=['type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','MailAccount','include','findAll','rows','show','MailServerOut','mandatoryDispositionPause','rawAttributes','includeAll','find','body','provider','custom','params','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','findOne','removeDispositions','ids','addAnswer','CannedAnswer','create','getAnswers','removeAnswers','email','isNil','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','CmContact','Contact','User','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','send','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','sendMail','List\x20not\x20found','ListId','messageId','subject','attach','out','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','path','lodash','../../components/parsers/qs','api','redis','defaults','localhost','./mailAccount.socket','jayson/promise','http','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','Content-Range','update','then','destroy','get','end','stack','name','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','password','modernAuthentication','CloudProviderId','pass','host','port','secure','service','username','authentication','Imap','Smtp','MailServerIn','Pause','map','fieldName'];(function(_0x2a2d6f,_0x161240){var _0x586744=function(_0x2607c0){while(--_0x2607c0){_0x2a2d6f['push'](_0x2a2d6f['shift']());}};_0x586744(++_0x161240);}(_0x8af6,0x13b));var _0x68af=function(_0x382059,_0x976e90){_0x382059=_0x382059-0x0;var _0x64bab6=_0x8af6[_0x382059];return _0x64bab6;};'use strict';var moment=require(_0x68af('0x0'));var BPromise=require(_0x68af('0x1'));var util=require('util');var path=require(_0x68af('0x2'));var _=require(_0x68af('0x3'));var juice=require('juice');var Redis=require('ioredis');var qs=require(_0x68af('0x4'));var logger=require('../../config/logger')(_0x68af('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x68af('0x6')]=_[_0x68af('0x7')](config[_0x68af('0x6')],{'host':_0x68af('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x68af('0x6')]));require(_0x68af('0x9'))['register'](socket);var jayson=require(_0x68af('0xa'));var client=jayson['client'][_0x68af('0xb')]({'port':0x232b});function respondWithRpcPromise(_0x1f4402,_0x2a3cf7,_0x7bb1e5,_0x5c5d28){return new BPromise(function(_0x2d0b4e,_0x2a66a9){var _0x4642c1=_0x5c5d28||client;return _0x4642c1['request'](_0x1f4402,_0x7bb1e5)['then'](function(_0x47db90){logger[_0x68af('0xc')](_0x68af('0xd'),_0x2a3cf7,_0x68af('0xe'));logger[_0x68af('0xf')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x2a3cf7,_0x68af('0xe'),JSON['stringify'](_0x47db90));if(_0x47db90[_0x68af('0x10')]){if(_0x47db90[_0x68af('0x10')][_0x68af('0x11')]===0x1f4){logger[_0x68af('0x10')](_0x68af('0xd'),_0x2a3cf7,_0x47db90[_0x68af('0x10')][_0x68af('0x12')]);return _0x2a66a9(_0x47db90[_0x68af('0x10')]['message']);}logger[_0x68af('0x10')](_0x68af('0xd'),_0x2a3cf7,_0x47db90[_0x68af('0x10')]['message']);return _0x2d0b4e(_0x47db90[_0x68af('0x10')]['message']);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x2a3cf7,_0x68af('0xe'));_0x2d0b4e(_0x47db90[_0x68af('0x13')][_0x68af('0x12')]);}})[_0x68af('0x14')](function(_0x4b5e58){logger[_0x68af('0x10')](_0x68af('0xd'),_0x2a3cf7,_0x4b5e58);_0x2a66a9(_0x4b5e58);});});}function respondWithStatusCode(_0x5526d2,_0x247dd4){_0x247dd4=_0x247dd4||0xcc;return function(_0x408e02){if(_0x408e02){return _0x5526d2[_0x68af('0x15')](_0x247dd4);}return _0x5526d2[_0x68af('0x16')](_0x247dd4)['end']();};}function respondWithResult(_0x4a610f,_0x4dec77){_0x4dec77=_0x4dec77||0xc8;return function(_0x5ee4e3){if(_0x5ee4e3){return _0x4a610f[_0x68af('0x16')](_0x4dec77)[_0x68af('0x17')](_0x5ee4e3);}};}function respondWithFilteredResult(_0x371c13,_0x2cf8a0){return function(_0x337e47){if(_0x337e47){var _0x17fe2f=typeof _0x2cf8a0[_0x68af('0x18')]==='undefined'&&typeof _0x2cf8a0[_0x68af('0x19')]===_0x68af('0x1a');var _0x758da0=_0x337e47[_0x68af('0x1b')];var _0x31131a=_0x17fe2f?0x0:_0x2cf8a0['offset'];var _0x168199=_0x17fe2f?_0x337e47[_0x68af('0x1b')]:_0x2cf8a0[_0x68af('0x18')]+_0x2cf8a0[_0x68af('0x19')];var _0x1c209d;if(_0x168199>=_0x758da0){_0x168199=_0x758da0;_0x1c209d=0xc8;}else{_0x1c209d=0xce;}_0x371c13['status'](_0x1c209d);return _0x371c13['set'](_0x68af('0x1c'),_0x31131a+'-'+_0x168199+'/'+_0x758da0)[_0x68af('0x17')](_0x337e47);}return null;};}function saveUpdates(_0x56e75e){return function(_0x10ec06){if(_0x10ec06){return _0x10ec06[_0x68af('0x1d')](_0x56e75e)[_0x68af('0x1e')](function(_0x3722cb){return _0x3722cb;});}return null;};}function removeEntity(_0x4fbb84){return function(_0x4b6510){if(_0x4b6510){return _0x4b6510[_0x68af('0x1f')]()[_0x68af('0x1e')](function(){var _0x59f5c7=_0x4b6510[_0x68af('0x20')]({'plain':!![]});var _0x2be0b1='MailAccounts';return db['UserProfileResource'][_0x68af('0x1f')]({'where':{'type':_0x2be0b1,'resourceId':_0x59f5c7['id']}})[_0x68af('0x1e')](function(){return _0x4b6510;});})[_0x68af('0x1e')](function(){_0x4fbb84[_0x68af('0x16')](0xcc)[_0x68af('0x21')]();});}};}function handleEntityNotFound(_0xd7b8e1){return function(_0x5859f1){if(!_0x5859f1){_0xd7b8e1['sendStatus'](0x194);}return _0x5859f1;};}function handleError(_0xcca090,_0x35403e){_0x35403e=_0x35403e||0x1f4;return function(_0x26f936){logger[_0x68af('0x10')](_0x26f936[_0x68af('0x22')]);if(_0x26f936[_0x68af('0x23')]){delete _0x26f936['name'];}_0xcca090['status'](_0x35403e)['send'](_0x26f936);};}function getImapHost(_0x2ba404){switch(_0x2ba404){case _0x68af('0x24'):return _0x68af('0x25');case _0x68af('0x26'):return _0x68af('0x27');case _0x68af('0x28'):return _0x68af('0x29');case'outlook365':return'outlook.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x2ba404);}function getSmtpHost(_0x3a5e31){switch(_0x3a5e31){case _0x68af('0x24'):return _0x68af('0x2a');case'yahoo':return _0x68af('0x2b');case _0x68af('0x28'):return _0x68af('0x2c');case'outlook365':return _0x68af('0x2d');}throw new Error('Unknown\x20email\x20service\x20provider',_0x3a5e31);}function getAuthenticationOptions(_0x3f093a,_0x3269d3){var _0x1532cb={};var _0x3ff86d={};if(_0x3f093a){_0x1532cb[_0x68af('0x2e')]=_0x3ff86d[_0x68af('0x2e')]=_0x3269d3['username'];_0x1532cb['password']=_0x3ff86d['pass']=_0x3269d3[_0x68af('0x2f')];if(_0x3269d3[_0x68af('0x30')]){_0x1532cb[_0x68af('0x30')]=_0x3ff86d[_0x68af('0x30')]=!![];_0x1532cb[_0x68af('0x31')]=_0x3ff86d[_0x68af('0x31')]=_0x3269d3['CloudProviderId'];_0x1532cb[_0x68af('0x2f')]=_0x3ff86d[_0x68af('0x32')]=null;}else{_0x1532cb[_0x68af('0x31')]=_0x3ff86d[_0x68af('0x31')]=null;}_0x1532cb[_0x68af('0x33')]=getImapHost(_0x3f093a);_0x1532cb[_0x68af('0x34')]=0x3e1;_0x3ff86d[_0x68af('0x33')]=getSmtpHost(_0x3f093a);_0x3ff86d[_0x68af('0x34')]=0x24b;_0x3ff86d[_0x68af('0x35')]=![];_0x1532cb[_0x68af('0x36')]=_0x3ff86d[_0x68af('0x36')]=null;}else{if(_0x3269d3['authentication']){_0x1532cb[_0x68af('0x2e')]=_0x3ff86d[_0x68af('0x2e')]=_0x3269d3[_0x68af('0x37')];_0x1532cb[_0x68af('0x2f')]=_0x3ff86d['pass']=_0x3269d3['password'];}else{_0x1532cb['authentication']=_0x3ff86d[_0x68af('0x38')]=![];_0x1532cb[_0x68af('0x2e')]=_0x3ff86d['user']=null;_0x1532cb[_0x68af('0x2f')]=_0x3ff86d['pass']=null;}_0x1532cb['host']=_0x3269d3[_0x68af('0x39')]['host'];_0x1532cb['port']=_0x3269d3['Imap'][_0x68af('0x34')];_0x3ff86d[_0x68af('0x33')]=_0x3269d3[_0x68af('0x3a')][_0x68af('0x33')];_0x3ff86d[_0x68af('0x34')]=_0x3269d3[_0x68af('0x3a')][_0x68af('0x34')];}return{'Imap':_0x1532cb,'Smtp':_0x3ff86d};}exports['index']=function(_0x39173c,_0x25b3c9){var _0x366837={'include':[{'model':db[_0x68af('0x3b')],'as':_0x68af('0x39')},{'model':db['MailServerOut'],'as':_0x68af('0x3a')},{'model':db[_0x68af('0x3c')],'as':'mandatoryDispositionPause'}]},_0x4ad311={},_0xc6ded9={'count':0x0,'rows':[]};var _0x4dd24f=_[_0x68af('0x3d')](db['MailAccount']['rawAttributes'],function(_0x2b40a4){return{'name':_0x2b40a4[_0x68af('0x3e')],'type':_0x2b40a4[_0x68af('0x3f')][_0x68af('0x40')]};});_0x4ad311['model']=_[_0x68af('0x3d')](_0x4dd24f,_0x68af('0x23'));_0x4ad311[_0x68af('0x41')]=_[_0x68af('0x42')](_0x39173c['query']);_0x4ad311[_0x68af('0x43')]=_[_0x68af('0x44')](_0x4ad311[_0x68af('0x45')],_0x4ad311['query']);_0x366837['attributes']=_[_0x68af('0x44')](_0x4ad311[_0x68af('0x45')],qs[_0x68af('0x46')](_0x39173c[_0x68af('0x41')][_0x68af('0x46')]));_0x366837[_0x68af('0x47')]=_0x366837[_0x68af('0x47')][_0x68af('0x48')]?_0x366837[_0x68af('0x47')]:_0x4ad311['model'];if(!_0x39173c[_0x68af('0x41')][_0x68af('0x49')](_0x68af('0x4a'))){_0x366837['limit']=qs[_0x68af('0x19')](_0x39173c[_0x68af('0x41')]['limit']);_0x366837[_0x68af('0x18')]=qs['offset'](_0x39173c[_0x68af('0x41')][_0x68af('0x18')]);}_0x366837[_0x68af('0x4b')]=qs[_0x68af('0x4c')](_0x39173c['query'][_0x68af('0x4c')]);_0x366837['where']=qs[_0x68af('0x43')](_[_0x68af('0x4d')](_0x39173c['query'],_0x4ad311[_0x68af('0x43')]),_0x4dd24f);if(_0x39173c[_0x68af('0x41')][_0x68af('0x4e')]){_0x366837['where']=_[_0x68af('0x4f')](_0x366837[_0x68af('0x50')],{'$or':_[_0x68af('0x3d')](_0x4dd24f,function(_0x1ddc97){if(_0x1ddc97['type']!==_0x68af('0x51')){var _0x4ceddf={};_0x4ceddf[_0x1ddc97[_0x68af('0x23')]]={'$like':'%'+_0x39173c[_0x68af('0x41')]['filter']+'%'};return _0x4ceddf;}})});}_0x366837=_[_0x68af('0x4f')]({},_0x366837,_0x39173c[_0x68af('0x52')]);var _0xd963bb={'where':_0x366837[_0x68af('0x50')]};return db[_0x68af('0x53')]['count'](_0xd963bb)['then'](function(_0x5bab97){_0xc6ded9[_0x68af('0x1b')]=_0x5bab97;if(_0x39173c[_0x68af('0x41')]['includeAll']){_0x366837[_0x68af('0x54')]=[{'all':!![]}];}return db[_0x68af('0x53')][_0x68af('0x55')](_0x366837);})[_0x68af('0x1e')](function(_0xe665){_0xc6ded9[_0x68af('0x56')]=_0xe665;return _0xc6ded9;})[_0x68af('0x1e')](respondWithFilteredResult(_0x25b3c9,_0x366837))[_0x68af('0x14')](handleError(_0x25b3c9,null));};exports[_0x68af('0x57')]=function(_0x38fd04,_0x5464fd){var _0x1297e3={'raw':![],'where':{'id':_0x38fd04['params']['id']},'include':[{'model':db[_0x68af('0x3b')],'as':_0x68af('0x39')},{'model':db[_0x68af('0x58')],'as':_0x68af('0x3a')},{'model':db['Pause'],'as':_0x68af('0x59')}]},_0x28f183={};_0x28f183[_0x68af('0x45')]=_[_0x68af('0x42')](db[_0x68af('0x53')][_0x68af('0x5a')]);_0x28f183['query']=_['keys'](_0x38fd04[_0x68af('0x41')]);_0x28f183['filters']=_[_0x68af('0x44')](_0x28f183[_0x68af('0x45')],_0x28f183['query']);_0x1297e3['attributes']=_[_0x68af('0x44')](_0x28f183[_0x68af('0x45')],qs[_0x68af('0x46')](_0x38fd04[_0x68af('0x41')][_0x68af('0x46')]));_0x1297e3['attributes']=_0x1297e3[_0x68af('0x47')][_0x68af('0x48')]?_0x1297e3[_0x68af('0x47')]:_0x28f183[_0x68af('0x45')];if(_0x38fd04[_0x68af('0x41')][_0x68af('0x5b')]){_0x1297e3['include']=[{'all':!![]}];}_0x1297e3=_[_0x68af('0x4f')]({},_0x1297e3,_0x38fd04['options']);return db[_0x68af('0x53')][_0x68af('0x5c')](_0x1297e3)[_0x68af('0x1e')](handleEntityNotFound(_0x5464fd,null))[_0x68af('0x1e')](respondWithResult(_0x5464fd,null))['catch'](handleError(_0x5464fd,null));};exports[_0x68af('0x1d')]=function(_0x86d05d,_0x5d85f1){if(_0x86d05d[_0x68af('0x5d')]['id']){delete _0x86d05d[_0x68af('0x5d')]['id'];}var _0x3ba824=_0x86d05d[_0x68af('0x5d')][_0x68af('0x5e')]===_0x68af('0x5f')?null:_0x86d05d[_0x68af('0x5d')][_0x68af('0x5e')];var _0x4636be=_0x86d05d['body'][_0x68af('0x39')]||{};var _0x31d8e8=_0x86d05d[_0x68af('0x5d')]['Smtp']||{};if(_0x3ba824){_0x4636be[_0x68af('0x33')]=getImapHost(_0x3ba824);_0x4636be['port']=0x3e1;_0x31d8e8[_0x68af('0x33')]=getSmtpHost(_0x3ba824);_0x31d8e8[_0x68af('0x34')]=0x24b;_0x31d8e8['secure']=![];}if(_0x31d8e8['modernAuthentication']){_0x31d8e8['secure']=![];}else{_0x31d8e8[_0x68af('0x31')]=null;}if(!_0x4636be['modernAuthentication'])_0x4636be[_0x68af('0x31')]=null;_0x86d05d['body'][_0x68af('0x39')]=_0x4636be;_0x86d05d['body'][_0x68af('0x3a')]=_0x31d8e8;return db[_0x68af('0x53')][_0x68af('0x5c')]({'where':{'id':_0x86d05d[_0x68af('0x60')]['id']},'include':[{'model':db[_0x68af('0x3b')],'as':_0x68af('0x39')},{'model':db[_0x68af('0x58')],'as':'Smtp'},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x68af('0x1e')](handleEntityNotFound(_0x5d85f1,null))[_0x68af('0x1e')](function(_0x4b4fe4){if(!_0x4b4fe4)throw new Error(_0x68af('0x61'));if(_0x4b4fe4[_0x68af('0x36')])delete _0x86d05d[_0x68af('0x5d')]['Imap'];return _0x4b4fe4;})[_0x68af('0x1e')](saveUpdates(_0x86d05d[_0x68af('0x5d')],null))[_0x68af('0x1e')](function(_0x21481e){if(!_0x86d05d['body']['Imap'])return _0x21481e;return db[_0x68af('0x3b')][_0x68af('0x1d')](_0x86d05d[_0x68af('0x5d')][_0x68af('0x39')],{'where':{'MailAccountId':_0x21481e['id']}})[_0x68af('0x1e')](function(){return _0x21481e;});})[_0x68af('0x1e')](function(_0x3f3a61){if(!_0x86d05d[_0x68af('0x5d')][_0x68af('0x3a')])return _0x3f3a61;return db[_0x68af('0x58')]['update'](_0x86d05d[_0x68af('0x5d')]['Smtp'],{'where':{'MailAccountId':_0x3f3a61['id']}})['then'](function(){return _0x3f3a61;});})[_0x68af('0x1e')](respondWithResult(_0x5d85f1,null))['catch'](handleError(_0x5d85f1,null));};exports[_0x68af('0x62')]=function(_0x2efeec,_0xd3b80b){return db['MailAccount']['describe']()[_0x68af('0x1e')](respondWithResult(_0xd3b80b,null))['catch'](handleError(_0xd3b80b,null));};exports[_0x68af('0x63')]=function(_0x1fa8a6,_0x5d9761){if(_0x1fa8a6[_0x68af('0x5d')]['id']){delete _0x1fa8a6[_0x68af('0x5d')]['id'];}return db[_0x68af('0x53')][_0x68af('0x5c')]({'where':{'id':_0x1fa8a6[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x5d9761,null))[_0x68af('0x1e')](function(_0x18703c){if(_0x18703c){_0x1fa8a6[_0x68af('0x5d')][_0x68af('0x64')]=_0x18703c['id'];return db[_0x68af('0x65')]['create'](_0x1fa8a6[_0x68af('0x5d')]);}})['then'](respondWithResult(_0x5d9761,null))[_0x68af('0x14')](handleError(_0x5d9761,null));};exports['getDispositions']=function(_0x22004d,_0x27533d){var _0x2f41f8={'raw':![],'where':{}};var _0x27f1eb={};var _0x46f7b={'count':0x0,'rows':[]};return db[_0x68af('0x53')][_0x68af('0x66')]({'where':{'id':_0x22004d[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x27533d,null))[_0x68af('0x1e')](function(_0xe43b39){if(_0xe43b39){_0x27f1eb['model']=_[_0x68af('0x42')](db[_0x68af('0x65')][_0x68af('0x5a')]);_0x27f1eb[_0x68af('0x41')]=_['keys'](_0x22004d[_0x68af('0x41')]);_0x27f1eb[_0x68af('0x43')]=_[_0x68af('0x44')](_0x27f1eb['model'],_0x27f1eb[_0x68af('0x41')]);_0x2f41f8['attributes']=_[_0x68af('0x44')](_0x27f1eb[_0x68af('0x45')],qs['fields'](_0x22004d[_0x68af('0x41')][_0x68af('0x46')]));_0x2f41f8[_0x68af('0x47')]=_0x2f41f8[_0x68af('0x47')][_0x68af('0x48')]?_0x2f41f8[_0x68af('0x47')]:_0x27f1eb[_0x68af('0x45')];if(!_0x22004d['query'][_0x68af('0x49')]('nolimit')){_0x2f41f8['limit']=qs[_0x68af('0x19')](_0x22004d[_0x68af('0x41')][_0x68af('0x19')]);_0x2f41f8['offset']=qs['offset'](_0x22004d[_0x68af('0x41')][_0x68af('0x18')]);}_0x2f41f8[_0x68af('0x4b')]=qs['sort'](_0x22004d['query'][_0x68af('0x4c')]);_0x2f41f8[_0x68af('0x50')]=qs[_0x68af('0x43')](_[_0x68af('0x4d')](_0x22004d[_0x68af('0x41')],_0x27f1eb['filters']));_0x2f41f8['where'][_0x68af('0x64')]=_0xe43b39['id'];if(_0x22004d[_0x68af('0x41')][_0x68af('0x4e')]){_0x2f41f8[_0x68af('0x50')]=_[_0x68af('0x4f')](_0x2f41f8['where'],{'$or':_['map'](_0x2f41f8[_0x68af('0x47')],function(_0x310734){var _0x366595={};_0x366595[_0x310734]={'$like':'%'+_0x22004d[_0x68af('0x41')]['filter']+'%'};return _0x366595;})});}_0x2f41f8=_[_0x68af('0x4f')]({},_0x2f41f8,_0x22004d['options']);return db[_0x68af('0x65')]['count']({'where':_0x2f41f8[_0x68af('0x50')]})[_0x68af('0x1e')](function(_0x1ebea4){_0x46f7b[_0x68af('0x1b')]=_0x1ebea4;if(_0x22004d[_0x68af('0x41')][_0x68af('0x5b')]){_0x2f41f8['include']=[{'all':!![]}];}return db[_0x68af('0x65')][_0x68af('0x55')](_0x2f41f8);})['then'](function(_0x14dabc){_0x46f7b[_0x68af('0x56')]=_0x14dabc;return _0x46f7b;});}})[_0x68af('0x1e')](respondWithFilteredResult(_0x27533d,_0x2f41f8))['catch'](handleError(_0x27533d,null));};exports[_0x68af('0x67')]=function(_0x3da817,_0xe7bbd5){return db[_0x68af('0x53')][_0x68af('0x5c')]({'where':{'id':_0x3da817[_0x68af('0x60')]['id']}})['then'](handleEntityNotFound(_0xe7bbd5,null))[_0x68af('0x1e')](function(_0x4a275d){if(_0x4a275d){return _0x4a275d['removeDispositions'](_0x3da817[_0x68af('0x41')][_0x68af('0x68')]);}})[_0x68af('0x1e')](respondWithStatusCode(_0xe7bbd5,null))[_0x68af('0x14')](handleError(_0xe7bbd5,null));};exports[_0x68af('0x69')]=function(_0x2629f1,_0x4f0726){if(_0x2629f1[_0x68af('0x5d')]['id']){delete _0x2629f1['body']['id'];}return db[_0x68af('0x53')]['find']({'where':{'id':_0x2629f1[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x4f0726,null))[_0x68af('0x1e')](function(_0x318a94){if(_0x318a94){_0x2629f1[_0x68af('0x5d')][_0x68af('0x64')]=_0x318a94['id'];return db[_0x68af('0x6a')][_0x68af('0x6b')](_0x2629f1[_0x68af('0x5d')]);}})[_0x68af('0x1e')](respondWithResult(_0x4f0726,null))[_0x68af('0x14')](handleError(_0x4f0726,null));};exports[_0x68af('0x6c')]=function(_0x516464,_0x1ffbc5){var _0x492b90={'raw':![],'where':{}};var _0x7f8b59={};var _0x4cf038={'count':0x0,'rows':[]};return db[_0x68af('0x53')][_0x68af('0x66')]({'where':{'id':_0x516464[_0x68af('0x60')]['id']}})['then'](handleEntityNotFound(_0x1ffbc5,null))['then'](function(_0x16fd06){if(_0x16fd06){_0x7f8b59[_0x68af('0x45')]=_[_0x68af('0x42')](db[_0x68af('0x6a')][_0x68af('0x5a')]);_0x7f8b59[_0x68af('0x41')]=_['keys'](_0x516464[_0x68af('0x41')]);_0x7f8b59['filters']=_[_0x68af('0x44')](_0x7f8b59[_0x68af('0x45')],_0x7f8b59[_0x68af('0x41')]);_0x492b90['attributes']=_['intersection'](_0x7f8b59[_0x68af('0x45')],qs['fields'](_0x516464[_0x68af('0x41')][_0x68af('0x46')]));_0x492b90['attributes']=_0x492b90[_0x68af('0x47')]['length']?_0x492b90['attributes']:_0x7f8b59[_0x68af('0x45')];if(!_0x516464['query']['hasOwnProperty'](_0x68af('0x4a'))){_0x492b90['limit']=qs[_0x68af('0x19')](_0x516464[_0x68af('0x41')][_0x68af('0x19')]);_0x492b90[_0x68af('0x18')]=qs[_0x68af('0x18')](_0x516464[_0x68af('0x41')][_0x68af('0x18')]);}_0x492b90[_0x68af('0x4b')]=qs['sort'](_0x516464[_0x68af('0x41')][_0x68af('0x4c')]);_0x492b90[_0x68af('0x50')]=qs['filters'](_[_0x68af('0x4d')](_0x516464[_0x68af('0x41')],_0x7f8b59['filters']));_0x492b90[_0x68af('0x50')][_0x68af('0x64')]=_0x16fd06['id'];if(_0x516464[_0x68af('0x41')][_0x68af('0x4e')]){_0x492b90[_0x68af('0x50')]=_['merge'](_0x492b90['where'],{'$or':_[_0x68af('0x3d')](_0x492b90[_0x68af('0x47')],function(_0x40c0da){var _0x3097a5={};_0x3097a5[_0x40c0da]={'$like':'%'+_0x516464[_0x68af('0x41')][_0x68af('0x4e')]+'%'};return _0x3097a5;})});}_0x492b90=_['merge']({},_0x492b90,_0x516464[_0x68af('0x52')]);return db[_0x68af('0x6a')][_0x68af('0x1b')]({'where':_0x492b90[_0x68af('0x50')]})[_0x68af('0x1e')](function(_0x44b026){_0x4cf038[_0x68af('0x1b')]=_0x44b026;if(_0x516464[_0x68af('0x41')][_0x68af('0x5b')]){_0x492b90[_0x68af('0x54')]=[{'all':!![]}];}return db[_0x68af('0x6a')]['findAll'](_0x492b90);})['then'](function(_0x34da9f){_0x4cf038['rows']=_0x34da9f;return _0x4cf038;});}})[_0x68af('0x1e')](respondWithFilteredResult(_0x1ffbc5,_0x492b90))[_0x68af('0x14')](handleError(_0x1ffbc5,null));};exports[_0x68af('0x6d')]=function(_0x3375ff,_0x2ab51b){return db[_0x68af('0x53')][_0x68af('0x5c')]({'where':{'id':_0x3375ff[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x2ab51b,null))[_0x68af('0x1e')](function(_0x307846){if(_0x307846){return _0x307846[_0x68af('0x6d')](_0x3375ff[_0x68af('0x41')]['ids']);}})[_0x68af('0x1e')](respondWithStatusCode(_0x2ab51b,null))['catch'](handleError(_0x2ab51b,null));};exports[_0x68af('0x6b')]=function(_0x3ee1f9,_0x3b4cb7){var _0x76f4b5={'name':_0x3ee1f9[_0x68af('0x5d')][_0x68af('0x23')],'key':_0x3ee1f9[_0x68af('0x5d')][_0x68af('0x40')],'provider':_0x3ee1f9[_0x68af('0x5d')][_0x68af('0x5e')]==='custom'?null:_0x3ee1f9[_0x68af('0x5d')][_0x68af('0x5e')],'email':_0x3ee1f9[_0x68af('0x5d')][_0x68af('0x6e')],'ListId':_0x3ee1f9[_0x68af('0x5d')]['ListId'],'active':!_[_0x68af('0x6f')](_0x3ee1f9['body']['active'])?_0x3ee1f9[_0x68af('0x5d')]['active']:!![],'description':_0x3ee1f9[_0x68af('0x5d')][_0x68af('0x70')]||null};var _0x344f28=getAuthenticationOptions(_0x76f4b5[_0x68af('0x5e')],_0x3ee1f9[_0x68af('0x5d')]);_0x76f4b5[_0x68af('0x39')]=_0x344f28['Imap'];_0x76f4b5['Smtp']=_0x344f28[_0x68af('0x3a')];return db['MailAccount']['create'](_0x76f4b5,{'include':[{'model':db[_0x68af('0x58')],'as':_0x68af('0x3a')},{'model':db['MailServerIn'],'as':_0x68af('0x39')}]})['then'](function(_0x2cfa66){var _0x4dd07b=_0x3ee1f9[_0x68af('0x2e')][_0x68af('0x20')]({'plain':!![]});if(!_0x4dd07b)throw new Error(_0x68af('0x71'));if(_0x4dd07b['role']===_0x68af('0x2e')){var _0x407f4e=_0x2cfa66['get']({'plain':!![]});return db['UserProfileSection'][_0x68af('0x5c')]({'where':{'name':'MailAccounts','userProfileId':_0x4dd07b['userProfileId']},'raw':!![]})['then'](function(_0x23366e){if(_0x23366e&&_0x23366e[_0x68af('0x72')]===0x0){return db[_0x68af('0x73')]['create']({'name':_0x407f4e[_0x68af('0x23')],'resourceId':_0x407f4e['id'],'type':_0x23366e['name'],'sectionId':_0x23366e['id']},{})[_0x68af('0x1e')](function(){return _0x2cfa66;});}else{return _0x2cfa66;}})[_0x68af('0x14')](function(_0x100268){logger[_0x68af('0x10')](_0x68af('0x74'),_0x100268);throw _0x100268;});}return _0x2cfa66;})[_0x68af('0x1e')](respondWithResult(_0x3b4cb7,0xc9))[_0x68af('0x14')](handleError(_0x3b4cb7,null));};exports[_0x68af('0x75')]=function(_0x22af90,_0x5c42c6){return db[_0x68af('0x53')][_0x68af('0x66')]({'where':{'id':_0x22af90[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x5c42c6,null))['then'](function(_0x654466){if(_0x654466){return _0x654466[_0x68af('0x75')]();}return null;})[_0x68af('0x1e')](respondWithResult(_0x5c42c6,null))[_0x68af('0x14')](handleError(_0x5c42c6,null));};exports[_0x68af('0x76')]=function(_0x45f221,_0x213148){if(_0x45f221[_0x68af('0x5d')]['id']){delete _0x45f221[_0x68af('0x5d')]['id'];}return db[_0x68af('0x53')][_0x68af('0x5c')]({'where':{'id':_0x45f221[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x213148,null))['then'](function(_0x27f58f){if(_0x27f58f){_0x45f221['body'][_0x68af('0x64')]=_0x27f58f['id'];return db[_0x68af('0x3b')][_0x68af('0x6b')](_0x45f221[_0x68af('0x5d')]);}})['then'](respondWithResult(_0x213148,null))[_0x68af('0x14')](handleError(_0x213148,null));};exports[_0x68af('0x77')]=function(_0x38fe63,_0x2b2369){return db[_0x68af('0x53')]['findOne']({'where':{'id':_0x38fe63['params']['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x2b2369,null))[_0x68af('0x1e')](function(_0x10783e){if(_0x10783e){return _0x10783e[_0x68af('0x78')](null);}return null;})['then'](respondWithStatusCode(_0x2b2369,null))[_0x68af('0x14')](handleError(_0x2b2369,null));};exports[_0x68af('0x79')]=function(_0x4c3692,_0x2b4cc9){return db['MailAccount']['findOne']({'where':{'id':_0x4c3692[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x2b4cc9,null))[_0x68af('0x1e')](function(_0xfb9d22){if(_0xfb9d22){return _0xfb9d22[_0x68af('0x79')]();}return null;})[_0x68af('0x1e')](respondWithResult(_0x2b4cc9,null))[_0x68af('0x14')](handleError(_0x2b4cc9,null));};exports['addSmtp']=function(_0x261cb9,_0x7355fd){if(_0x261cb9[_0x68af('0x5d')]['id']){delete _0x261cb9['body']['id'];}return db[_0x68af('0x53')][_0x68af('0x5c')]({'where':{'id':_0x261cb9[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x7355fd,null))[_0x68af('0x1e')](function(_0x14b4f5){if(_0x14b4f5){_0x261cb9['body'][_0x68af('0x64')]=_0x14b4f5['id'];return db[_0x68af('0x58')]['create'](_0x261cb9[_0x68af('0x5d')]);}})[_0x68af('0x1e')](respondWithResult(_0x7355fd,null))[_0x68af('0x14')](handleError(_0x7355fd,null));};exports[_0x68af('0x7a')]=function(_0x308277,_0x493310){return db[_0x68af('0x53')][_0x68af('0x66')]({'where':{'id':_0x308277[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x493310,null))['then'](function(_0x26f294){if(_0x26f294){return _0x26f294[_0x68af('0x7b')](null);}return null;})['then'](respondWithStatusCode(_0x493310,null))[_0x68af('0x14')](handleError(_0x493310,null));};exports['addInteraction']=function(_0x195686,_0x4921d4){return db[_0x68af('0x7c')][_0x68af('0x5c')]({'where':{'id':_0x195686[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x4921d4,null))[_0x68af('0x1e')](function(_0xc70409){if(_0xc70409){return _0xc70409[_0x68af('0x7d')](_0x195686['body'][_0x68af('0x68')],_[_0x68af('0x7e')](_0x195686[_0x68af('0x5d')],[_0x68af('0x68'),'id'])||{});}})['then'](respondWithResult(_0x4921d4,null))[_0x68af('0x14')](handleError(_0x4921d4,null));};exports['getInteractions']=function(_0x501142,_0x203500){var _0x335a54={'raw':![],'where':{}};var _0xda12a5={};var _0x4c38e7={'count':0x0,'rows':[]};return db[_0x68af('0x53')]['findOne']({'where':{'id':_0x501142[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x203500,null))[_0x68af('0x1e')](function(_0x26f531){if(_0x26f531){_0xda12a5[_0x68af('0x45')]=_[_0x68af('0x42')](db[_0x68af('0x7c')][_0x68af('0x5a')]);_0xda12a5[_0x68af('0x41')]=_['keys'](_0x501142[_0x68af('0x41')]);_0xda12a5[_0x68af('0x43')]=_[_0x68af('0x44')](_0xda12a5[_0x68af('0x45')],_0xda12a5[_0x68af('0x41')]);_0x335a54[_0x68af('0x47')]=_[_0x68af('0x44')](_0xda12a5[_0x68af('0x45')],qs[_0x68af('0x46')](_0x501142[_0x68af('0x41')]['fields']));_0x335a54[_0x68af('0x47')]=_0x335a54[_0x68af('0x47')][_0x68af('0x48')]?_0x335a54[_0x68af('0x47')]:_0xda12a5['model'];if(!_0x501142[_0x68af('0x41')][_0x68af('0x49')](_0x68af('0x4a'))){_0x335a54[_0x68af('0x19')]=qs[_0x68af('0x19')](_0x501142[_0x68af('0x41')][_0x68af('0x19')]);_0x335a54[_0x68af('0x18')]=qs[_0x68af('0x18')](_0x501142[_0x68af('0x41')]['offset']);}_0x335a54[_0x68af('0x4b')]=qs[_0x68af('0x4c')](_0x501142[_0x68af('0x41')][_0x68af('0x4c')]);_0x335a54[_0x68af('0x50')]=qs[_0x68af('0x43')](_[_0x68af('0x4d')](_0x501142['query'],_0xda12a5[_0x68af('0x43')]));_0x335a54['where']['MailAccountId']=_0x26f531['id'];if(_0x501142['query'][_0x68af('0x4e')]){_0x335a54[_0x68af('0x50')]=_['merge'](_0x335a54[_0x68af('0x50')],{'$or':_[_0x68af('0x3d')](_0x335a54[_0x68af('0x47')],function(_0x33e2a9){var _0x37deb8={};_0x37deb8[_0x33e2a9]={'$like':'%'+_0x501142[_0x68af('0x41')]['filter']+'%'};return _0x37deb8;})});}_0x335a54=_[_0x68af('0x4f')]({},_0x335a54,_0x501142[_0x68af('0x52')]);return db[_0x68af('0x7c')][_0x68af('0x1b')]({'where':_0x335a54[_0x68af('0x50')]})[_0x68af('0x1e')](function(_0x35eaf4){_0x4c38e7['count']=_0x35eaf4;if(_0x501142[_0x68af('0x41')]['includeAll']){_0x335a54[_0x68af('0x54')]=[{'model':db[_0x68af('0x7f')],'as':_0x68af('0x80'),'required':![]},{'model':db[_0x68af('0x81')],'as':'Owner','attributes':['name',_0x68af('0x82'),_0x68af('0x83')],'required':![]},{'model':db['Tag'],'as':_0x68af('0x84'),'attributes':['id',_0x68af('0x23'),_0x68af('0x85')],'where':_0x501142[_0x68af('0x41')][_0x68af('0x86')]?{'id':_0x501142['query']['tag']}:undefined,'required':_0x501142[_0x68af('0x41')][_0x68af('0x86')]?!![]:![]}];}return db[_0x68af('0x7c')][_0x68af('0x55')](_0x335a54);})['then'](function(_0x1d7c1a){_0x4c38e7['rows']=_0x1d7c1a;return _0x4c38e7;});}})['then'](respondWithFilteredResult(_0x203500,_0x335a54))['catch'](handleError(_0x203500,null));};exports[_0x68af('0x87')]=function addApplications(_0x590ea5,_0x1570e8){var _0xe0228c=_0x590ea5[_0x68af('0x60')]['id'];var _0x968a59=_0x590ea5[_0x68af('0x5d')];var _0x5abcf3=0xc8;var _0x487408=null;return db[_0x68af('0x88')][_0x68af('0x89')]({'isolationLevel':db[_0x68af('0x88')][_0x68af('0x8a')]['ISOLATION_LEVELS'][_0x68af('0x8b')]},function(_0x74e3e){return db['MailAccount']['findOne']({'where':{'id':_0xe0228c},'transaction':_0x74e3e})['then'](function(_0x1378cf){if(_0x1378cf){return db[_0x68af('0x8c')]['destroy']({'where':{'MailAccountId':_0xe0228c},'transaction':_0x74e3e})[_0x68af('0x1e')](function(){var _0x2bea79=_['map'](_0x968a59,function(_0x4dfbba){_0x4dfbba[_0x68af('0x64')]=_0xe0228c;return _0x4dfbba;});return db['MailApplication']['bulkCreate'](_0x2bea79,{'transaction':_0x74e3e});});}else{_0x5abcf3=0x194;_0x487408=[];}});})[_0x68af('0x1e')](function(){if(_0x5abcf3!==0x194){return db[_0x68af('0x8c')][_0x68af('0x8d')]({'where':{'MailAccountId':_0xe0228c},'order':_0x68af('0x8e')})[_0x68af('0x1e')](function(_0x418bc0){_0x487408=_0x418bc0;});}})[_0x68af('0x14')](function(_0x3c03fd){_0x5abcf3=0x1f4;logger[_0x68af('0x10')](_0x3c03fd[_0x68af('0x22')]);if(_0x3c03fd[_0x68af('0x23')]){delete _0x3c03fd[_0x68af('0x23')];}_0x487408=_0x3c03fd;})[_0x68af('0x8f')](function(){if(_0x487408===null){_0x1570e8[_0x68af('0x15')](_0x5abcf3);}else{if(_0x5abcf3===0x1f4){_0x1570e8['status'](_0x5abcf3)[_0x68af('0x90')](_0x487408);}else{_0x1570e8[_0x68af('0x16')](_0x5abcf3)[_0x68af('0x17')](_0x487408);}}});};exports[_0x68af('0x91')]=function(_0x413c85,_0x575be5){var _0x107a64={};var _0x94dabd={};var _0x21af5f;var _0x4bd40b;return db[_0x68af('0x53')][_0x68af('0x66')]({'where':{'id':_0x413c85[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x575be5,null))['then'](function(_0x13f39d){if(_0x13f39d){_0x21af5f=_0x13f39d;_0x94dabd[_0x68af('0x45')]=_[_0x68af('0x42')](db[_0x68af('0x8c')][_0x68af('0x5a')]);_0x94dabd['query']=_[_0x68af('0x42')](_0x413c85[_0x68af('0x41')]);_0x94dabd['filters']=_[_0x68af('0x44')](_0x94dabd[_0x68af('0x45')],_0x94dabd['query']);_0x107a64[_0x68af('0x47')]=_['intersection'](_0x94dabd[_0x68af('0x45')],qs[_0x68af('0x46')](_0x413c85[_0x68af('0x41')][_0x68af('0x46')]));_0x107a64[_0x68af('0x47')]=_0x107a64[_0x68af('0x47')]['length']?_0x107a64[_0x68af('0x47')]:_0x94dabd[_0x68af('0x45')];_0x107a64[_0x68af('0x4b')]=qs[_0x68af('0x4c')](_0x413c85[_0x68af('0x41')][_0x68af('0x4c')]);_0x107a64[_0x68af('0x50')]=qs[_0x68af('0x43')](_[_0x68af('0x4d')](_0x413c85[_0x68af('0x41')],_0x94dabd[_0x68af('0x43')]));if(_0x413c85['query']['filter']){_0x107a64[_0x68af('0x50')]=_[_0x68af('0x4f')](_0x107a64[_0x68af('0x50')],{'$or':_[_0x68af('0x3d')](_0x107a64[_0x68af('0x47')],function(_0x20dad5){var _0x3e40bb={};_0x3e40bb[_0x20dad5]={'$like':'%'+_0x413c85[_0x68af('0x41')][_0x68af('0x4e')]+'%'};return _0x3e40bb;})});}_0x107a64=_[_0x68af('0x4f')]({},_0x107a64,_0x413c85[_0x68af('0x52')]);return _0x21af5f['getApplications'](_0x107a64);}})['then'](function(_0x80911){if(_0x80911){_0x4bd40b=_0x80911[_0x68af('0x48')];if(!_0x413c85[_0x68af('0x41')][_0x68af('0x49')](_0x68af('0x4a'))){_0x107a64[_0x68af('0x19')]=qs['limit'](_0x413c85[_0x68af('0x41')][_0x68af('0x19')]);_0x107a64[_0x68af('0x18')]=qs[_0x68af('0x18')](_0x413c85[_0x68af('0x41')]['offset']);}return _0x21af5f[_0x68af('0x91')](_0x107a64);}})['then'](function(_0x1d5604){if(_0x1d5604){return _0x1d5604?{'count':_0x4bd40b,'rows':_0x1d5604}:null;}})[_0x68af('0x1e')](respondWithResult(_0x575be5,null))[_0x68af('0x14')](handleError(_0x575be5,null));};exports[_0x68af('0x92')]=function(_0x2d867e,_0x1b6179){var _0xd52d07={'raw':!![],'where':{}};var _0x5773f9={};var _0x25702c={'count':0x0,'rows':[]};return db[_0x68af('0x53')][_0x68af('0x66')]({'where':{'id':_0x2d867e[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x1b6179,null))[_0x68af('0x1e')](function(_0xa71319){if(_0xa71319){_0x5773f9['model']=_['keys'](db['MailMessage'][_0x68af('0x5a')]);_0x5773f9[_0x68af('0x41')]=_[_0x68af('0x42')](_0x2d867e[_0x68af('0x41')]);_0x5773f9[_0x68af('0x43')]=_[_0x68af('0x44')](_0x5773f9[_0x68af('0x45')],_0x5773f9[_0x68af('0x41')]);_0xd52d07[_0x68af('0x47')]=_[_0x68af('0x44')](_0x5773f9['model'],qs['fields'](_0x2d867e[_0x68af('0x41')][_0x68af('0x46')]));_0xd52d07['attributes']=_0xd52d07['attributes'][_0x68af('0x48')]?_0xd52d07[_0x68af('0x47')]:_0x5773f9['model'];if(!_0x2d867e[_0x68af('0x41')][_0x68af('0x49')](_0x68af('0x4a'))){_0xd52d07[_0x68af('0x19')]=qs[_0x68af('0x19')](_0x2d867e[_0x68af('0x41')]['limit']);_0xd52d07['offset']=qs[_0x68af('0x18')](_0x2d867e[_0x68af('0x41')][_0x68af('0x18')]);}_0xd52d07[_0x68af('0x4b')]=qs[_0x68af('0x4c')](_0x2d867e[_0x68af('0x41')][_0x68af('0x4c')]);_0xd52d07[_0x68af('0x50')]=qs[_0x68af('0x43')](_['pick'](_0x2d867e['query'],_0x5773f9[_0x68af('0x43')]));_0xd52d07[_0x68af('0x50')][_0x68af('0x64')]=_0xa71319['id'];if(_0x2d867e[_0x68af('0x41')][_0x68af('0x4e')]){_0xd52d07[_0x68af('0x50')]=_[_0x68af('0x4f')](_0xd52d07[_0x68af('0x50')],{'$or':_[_0x68af('0x3d')](_0xd52d07[_0x68af('0x47')],function(_0x445107){var _0x192a21={};_0x192a21[_0x445107]={'$like':'%'+_0x2d867e[_0x68af('0x41')]['filter']+'%'};return _0x192a21;})});}if(_0x2d867e[_0x68af('0x41')][_0x68af('0x93')]){var _0x2a8b1a=_0x2d867e[_0x68af('0x41')][_0x68af('0x93')][_0x68af('0x94')](',');var _0x526a2f={};_0x526a2f[_0x2a8b1a[0x0]]={'$gte':moment(_0x2a8b1a[0x1])[_0x68af('0x95')](_0x68af('0x96'))};_0xd52d07[_0x68af('0x50')]=_[_0x68af('0x4f')](_0xd52d07[_0x68af('0x50')],_0x526a2f);}_0xd52d07=_['merge']({},_0xd52d07,_0x2d867e[_0x68af('0x52')]);return db[_0x68af('0x97')][_0x68af('0x1b')]({'where':_0xd52d07[_0x68af('0x50')]})['then'](function(_0x7c8eb7){_0x25702c['count']=_0x7c8eb7;if(_0x2d867e[_0x68af('0x41')]['includeAll']){_0xd52d07[_0x68af('0x54')]=[{'all':!![]}];}return db[_0x68af('0x97')][_0x68af('0x55')](_0xd52d07);})['then'](function(_0x8054bb){if(_0x2d867e['query'][_0x68af('0x98')]==='true'){for(var _0x4c5b6c=0x0;_0x4c5b6c<_0x8054bb[_0x68af('0x48')];_0x4c5b6c++){_0x8054bb[_0x4c5b6c]['body']=juice(_0x8054bb[_0x4c5b6c][_0x68af('0x5d')]);}}_0x25702c[_0x68af('0x56')]=_0x8054bb;return _0x25702c;});}})[_0x68af('0x1e')](respondWithFilteredResult(_0x1b6179,_0xd52d07))[_0x68af('0x14')](handleError(_0x1b6179,null));};exports['send']=function(_0x84d35f,_0x64a0e6){var _0x556b37,_0x2099aa={},_0x46c42a;if(_0x84d35f['body']['to']){_0x46c42a=_0x84d35f[_0x68af('0x5d')]['to'][_0x68af('0x94')](',')[0x0];}return db[_0x68af('0x53')]['find']({'where':{'id':_0x84d35f[_0x68af('0x60')]['id']},'include':[{'model':db[_0x68af('0x99')],'as':_0x68af('0x9a'),'include':[{'model':db[_0x68af('0x7f')],'as':_0x68af('0x9b'),'where':{'email':_0x46c42a},'limit':0x1,'order':[[_0x68af('0x9c'),_0x68af('0x9d')]]}]},{'model':db[_0x68af('0x58')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x68af('0x9e')],'as':_0x68af('0x9e'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x64a0e6,null))[_0x68af('0x1e')](function(_0x17c6d8){if(!_0x17c6d8)return;_0x556b37=_0x17c6d8;if(!_0x17c6d8['Smtp'])throw new Error(_0x68af('0x9f'));if(_['isNil'](_0x84d35f[_0x68af('0x5d')][_0x68af('0xa0')])){_0x84d35f['body'][_0x68af('0xa0')]=util[_0x68af('0x95')](_0x68af('0xa1'),_0x17c6d8[_0x68af('0x23')],_0x17c6d8[_0x68af('0x6e')]||_0x17c6d8[_0x68af('0x3a')][_0x68af('0x2e')]);}if(_0x84d35f[_0x68af('0x5d')][_0x68af('0xa2')]&&_0x84d35f[_0x68af('0x5d')]['attachments']['length']){for(var _0x4e2c7b=0x0;_0x4e2c7b<_0x84d35f['body'][_0x68af('0xa2')][_0x68af('0x48')];_0x4e2c7b+=0x1){_0x84d35f[_0x68af('0x5d')][_0x68af('0xa2')][_0x4e2c7b]={'filename':_0x84d35f['body'][_0x68af('0xa2')][_0x4e2c7b][_0x68af('0x23')],'path':path[_0x68af('0xa3')](config[_0x68af('0xa4')],_0x68af('0xa5'),_0x84d35f[_0x68af('0x5d')]['attachments'][_0x4e2c7b][_0x68af('0xa6')])};}}var _0x4b4d14=_0x17c6d8['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0x68af('0xa7'),{'account':_0x4b4d14,'message':_0x84d35f[_0x68af('0x5d')]});})[_0x68af('0x1e')](function(_0x4dacf8){if(!_0x4dacf8)return;_0x2099aa=_0x4dacf8;if(!_0x556b37[_0x68af('0x9a')])throw new Error(_0x68af('0xa8'));if(_0x556b37[_0x68af('0x9a')][_0x68af('0x9b')]['length'])return _0x556b37['List'][_0x68af('0x9b')][0x0];return db[_0x68af('0x7f')]['create'](_[_0x68af('0x7')](_0x84d35f[_0x68af('0x5d')],{'firstName':_0x84d35f['body']['to'],'email':_0x84d35f['body']['to'],'phone':_0x84d35f[_0x68af('0x5d')]['to'],'ListId':_0x556b37[_0x68af('0xa9')]}));})[_0x68af('0x1e')](function(_0x323503){if(!_0x323503)return;var _0x1759f2={'UserId':_0x84d35f[_0x68af('0x2e')]['id'],'ContactId':_0x323503['id'],'MailAccountId':_0x556b37['id'],'inReplyTo':_0x2099aa[_0x68af('0xaa')],'to':_0x84d35f[_0x68af('0x5d')]['from'],'cc':_0x84d35f['body']['cc'],'subject':_0x84d35f[_0x68af('0x5d')][_0x68af('0xab')],'attach':_0x84d35f[_0x68af('0x5d')][_0x68af('0xac')],'firstMsgDirection':_0x68af('0xad'),'lastMsgAt':moment()[_0x68af('0x95')](_0x68af('0x96')),'lastMsgDirection':_0x68af('0xad'),'Messages':[_[_0x68af('0x4f')](_0x84d35f[_0x68af('0x5d')],{'messageId':_0x2099aa[_0x68af('0xaa')],'sentAt':moment()[_0x68af('0x95')](_0x68af('0x96')),'read':!![],'MailAccountId':_0x556b37['id'],'UserId':_0x84d35f['user']['id'],'ContactId':_0x323503['id']})]};if(_0x84d35f[_0x68af('0x5d')][_0x68af('0xae')]){_0x1759f2=_[_0x68af('0x4f')](_0x1759f2,_0x84d35f[_0x68af('0x5d')][_0x68af('0xae')]);}return db[_0x68af('0x7c')]['create'](_0x1759f2,{'include':[{'model':db[_0x68af('0x97')],'as':_0x68af('0xaf')}]});})[_0x68af('0x1e')](respondWithResult(_0x64a0e6,null))[_0x68af('0x14')](handleError(_0x64a0e6,null));};exports[_0x68af('0xb0')]=function(_0x3a3089,_0x1186e7){return db['MailAccount'][_0x68af('0x5c')]({'where':{'id':_0x3a3089['params']['id']},'include':[{'model':db[_0x68af('0x58')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x68af('0x9e')],'as':'CloudProvider','raw':!![]}]}]})[_0x68af('0x1e')](handleEntityNotFound(_0x1186e7,null))[_0x68af('0x1e')](function(_0x1bd704){if(!_0x1bd704[_0x68af('0x3a')])return;var _0x5a4d22=_0x1bd704[_0x68af('0xb1')]();return respondWithRpcPromise(_0x68af('0xb2'),'verifySmtp',{'account':_0x5a4d22});})[_0x68af('0x1e')](respondWithResult(_0x1186e7,null))[_0x68af('0x14')](handleError(_0x1186e7,null));};exports[_0x68af('0x1f')]=function(_0x462a71,_0x38405d){return db[_0x68af('0x53')][_0x68af('0x5c')]({'where':{'id':_0x462a71[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x38405d,null))[_0x68af('0x1e')](function(_0x152176){if(_0x152176&&_0x152176[_0x68af('0x36')]){throw new db[(_0x68af('0xb3'))][(_0x68af('0xb4'))](_0x68af('0xb5'));}return _0x152176;})[_0x68af('0x1e')](removeEntity(_0x38405d,null))['catch'](handleError(_0x38405d,null));};exports[_0x68af('0xb6')]=function(_0x5520d7,_0x149a68){return db[_0x68af('0x53')][_0x68af('0x5c')]({'where':{'id':_0x5520d7[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x149a68,null))['then'](function(_0x2fb118){if(_0x2fb118){return _0x2fb118[_0x68af('0xb6')](_0x5520d7[_0x68af('0x5d')][_0x68af('0x68')],_[_0x68af('0x7e')](_0x5520d7['body'],[_0x68af('0x68'),'id'])||{})['spread'](function(_0x5478ed){for(var _0x32ff28=0x0;_0x32ff28<_0x5520d7[_0x68af('0x5d')][_0x68af('0x68')]['length'];_0x32ff28+=0x1){socket[_0x68af('0xb7')](_0x68af('0xb8'),{'UserId':Number(_0x5520d7[_0x68af('0x5d')][_0x68af('0x68')][_0x32ff28]),'MailAccountId':Number(_0x5520d7[_0x68af('0x60')]['id'])});}return _0x5478ed;});}})[_0x68af('0x1e')](respondWithResult(_0x149a68,null))[_0x68af('0x14')](handleError(_0x149a68,null));};exports[_0x68af('0xb9')]=function(_0x1cf053,_0x423564){return db[_0x68af('0x53')][_0x68af('0x5c')]({'where':{'id':_0x1cf053['params']['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0x423564,null))[_0x68af('0x1e')](function(_0x10e93e){if(_0x10e93e){return _0x10e93e[_0x68af('0xb9')](_0x1cf053[_0x68af('0x41')]['ids'])[_0x68af('0x1e')](function(){if(_[_0x68af('0xba')](_0x1cf053[_0x68af('0x41')][_0x68af('0x68')])){for(var _0x43127f=0x0;_0x43127f<_0x1cf053[_0x68af('0x41')][_0x68af('0x68')][_0x68af('0x48')];_0x43127f+=0x1){socket[_0x68af('0xb7')](_0x68af('0xbb'),{'UserId':Number(_0x1cf053[_0x68af('0x41')][_0x68af('0x68')][_0x43127f]),'MailAccountId':Number(_0x1cf053[_0x68af('0x60')]['id'])});}}else{socket[_0x68af('0xb7')]('userMailAccount:remove',{'UserId':Number(_0x1cf053[_0x68af('0x41')][_0x68af('0x68')]),'MailAccountId':Number(_0x1cf053['params']['id'])});}});}})[_0x68af('0x1e')](respondWithStatusCode(_0x423564,null))['catch'](handleError(_0x423564,null));};exports['getAgents']=function(_0x3ba766,_0xccac38){var _0x1c5670={};var _0x21b426={};var _0x209ddd;var _0x630318;return db[_0x68af('0x53')]['findOne']({'where':{'id':_0x3ba766[_0x68af('0x60')]['id']}})[_0x68af('0x1e')](handleEntityNotFound(_0xccac38,null))[_0x68af('0x1e')](function(_0x3bbf0a){if(_0x3bbf0a){_0x209ddd=_0x3bbf0a;_0x21b426[_0x68af('0x45')]=_[_0x68af('0x42')](db[_0x68af('0x81')][_0x68af('0x5a')]);_0x21b426[_0x68af('0x41')]=_[_0x68af('0x42')](_0x3ba766[_0x68af('0x41')]);_0x21b426[_0x68af('0x43')]=_['intersection'](_0x21b426[_0x68af('0x45')],_0x21b426[_0x68af('0x41')]);_0x1c5670[_0x68af('0x47')]=_[_0x68af('0x44')](_0x21b426[_0x68af('0x45')],qs[_0x68af('0x46')](_0x3ba766[_0x68af('0x41')][_0x68af('0x46')]));_0x1c5670['attributes']=_0x1c5670['attributes'][_0x68af('0x48')]?_0x1c5670[_0x68af('0x47')]:_0x21b426[_0x68af('0x45')];_0x1c5670[_0x68af('0x4b')]=qs['sort'](_0x3ba766[_0x68af('0x41')][_0x68af('0x4c')]);_0x1c5670[_0x68af('0x50')]=qs['filters'](_[_0x68af('0x4d')](_0x3ba766['query'],_0x21b426[_0x68af('0x43')]));if(_0x3ba766[_0x68af('0x41')][_0x68af('0x4e')]){_0x1c5670['where']=_[_0x68af('0x4f')](_0x1c5670[_0x68af('0x50')],{'$or':_[_0x68af('0x3d')](_0x1c5670[_0x68af('0x47')],function(_0x2673ea){var _0x21f8ac={};_0x21f8ac[_0x2673ea]={'$like':'%'+_0x3ba766[_0x68af('0x41')][_0x68af('0x4e')]+'%'};return _0x21f8ac;})});}_0x1c5670=_[_0x68af('0x4f')]({},_0x1c5670,_0x3ba766[_0x68af('0x52')]);return _0x209ddd[_0x68af('0xbc')](_0x1c5670);}})[_0x68af('0x1e')](function(_0x2b2667){if(_0x2b2667){_0x630318=_0x2b2667[_0x68af('0x48')];if(!_0x3ba766[_0x68af('0x41')]['hasOwnProperty'](_0x68af('0x4a'))){_0x1c5670[_0x68af('0x19')]=qs[_0x68af('0x19')](_0x3ba766[_0x68af('0x41')][_0x68af('0x19')]);_0x1c5670['offset']=qs[_0x68af('0x18')](_0x3ba766[_0x68af('0x41')]['offset']);}return _0x209ddd['getAgents'](_0x1c5670);}})['then'](function(_0x5c72b0){if(_0x5c72b0){return _0x5c72b0?{'count':_0x630318,'rows':_0x5c72b0}:null;}})['then'](respondWithResult(_0xccac38,null))[_0x68af('0x14')](handleError(_0xccac38,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 1bcd89b..4fccdc4 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 _0x8173=['setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x13f9aa,_0x3c7417){var _0x1fbde9=function(_0x4051be){while(--_0x4051be){_0x13f9aa['push'](_0x13f9aa['shift']());}};_0x1fbde9(++_0x3c7417);}(_0x8173,0x1db));var _0x3817=function(_0x727428,_0xc15f){_0x727428=_0x727428-0x0;var _0x588b97=_0x8173[_0x727428];return _0x588b97;};'use strict';var EventEmitter=require(_0x3817('0x0'));var MailAccount=require(_0x3817('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x3817('0x2')](0x0);var events={'afterCreate':_0x3817('0x3'),'afterUpdate':_0x3817('0x4'),'afterDestroy':_0x3817('0x5')};function emitEvent(_0x4bb032){return function(_0x165280,_0x4b47df,_0x37c046){MailAccountEvents['emit'](_0x4bb032+':'+_0x165280['id'],_0x165280);MailAccountEvents['emit'](_0x4bb032,_0x165280);_0x37c046(null);};}for(var e in events){if(events[_0x3817('0x6')](e)){var event=events[e];MailAccount[_0x3817('0x7')](e,emitEvent(event));}}module[_0x3817('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x620b=['../../mysqldb','MailAccount','emit','hook','exports','events'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x620b,0x167));var _0xb620=function(_0x1aa689,_0x4ddd88){_0x1aa689=_0x1aa689-0x0;var _0x3839a8=_0x620b[_0x1aa689];return _0x3839a8;};'use strict';var EventEmitter=require(_0xb620('0x0'));var MailAccount=require(_0xb620('0x1'))['db'][_0xb620('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1b4a54){return function(_0x4f7e01,_0x1b9eda,_0x54bf79){MailAccountEvents['emit'](_0x1b4a54+':'+_0x4f7e01['id'],_0x4f7e01);MailAccountEvents[_0xb620('0x3')](_0x1b4a54,_0x4f7e01);_0x54bf79(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xb620('0x4')](e,emitEvent(event));}}module[_0xb620('0x5')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 4cca239..3722c73 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 _0x4653=['modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','CloudProvider','data5','user','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','custom','service','host','Smtp','port','secure','authentication'];(function(_0x29e2ce,_0x51f83c){var _0x25682b=function(_0x4d8a18){while(--_0x4d8a18){_0x29e2ce['push'](_0x29e2ce['shift']());}};_0x25682b(++_0x51f83c);}(_0x4653,0x120));var _0x3465=function(_0x49edda,_0x8e48b0){_0x49edda=_0x49edda-0x0;var _0x341e67=_0x4653[_0x49edda];return _0x341e67;};'use strict';var attributes=require(_0x3465('0x0'));module[_0x3465('0x1')]=function(_0x2877ae){return _0x2877ae[_0x3465('0x2')](_0x3465('0x3'),attributes,{'tableName':_0x3465('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x3a3858=this;var _0x540bfb={'id':_0x3a3858['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3a3858['provider']!==_0x3465('0x5')){_0x540bfb[_0x3465('0x6')]=_0x3a3858['provider'];}else{_0x540bfb[_0x3465('0x7')]=_0x3a3858[_0x3465('0x8')][_0x3465('0x7')];_0x540bfb[_0x3465('0x9')]=_0x3a3858[_0x3465('0x8')][_0x3465('0x9')];_0x540bfb[_0x3465('0xa')]=_0x3a3858[_0x3465('0x8')]['secure'];}if(_0x3a3858[_0x3465('0x8')][_0x3465('0xb')]){if(_0x3a3858[_0x3465('0x8')][_0x3465('0xc')]){if(!_0x3a3858[_0x3465('0x8')]['CloudProvider'])throw new Error(_0x3465('0xd'));_0x540bfb[_0x3465('0xe')]={'type':_0x3465('0xf'),'user':_0x3a3858[_0x3465('0x8')]['user'],'accessToken':_0x3a3858[_0x3465('0x8')][_0x3465('0x10')][_0x3465('0x11')]};}else{_0x540bfb[_0x3465('0xe')]={'user':_0x3a3858[_0x3465('0x8')][_0x3465('0x12')],'pass':_0x3a3858[_0x3465('0x8')][_0x3465('0x13')]};}}return _0x540bfb;}}});}; \ No newline at end of file +var _0x6494=['MailAccount','mail_accounts','provider','custom','port','secure','Smtp','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','user','CloudProvider','data5','auth','pass','./mailAccount.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6494,0x185));var _0x4649=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6494[_0x20a584];return _0x4b41a8;};'use strict';var attributes=require(_0x4649('0x0'));module[_0x4649('0x1')]=function(_0x321fb4){return _0x321fb4['define'](_0x4649('0x2'),attributes,{'tableName':_0x4649('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x3e51d4=this;var _0x52be4a={'id':_0x3e51d4['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3e51d4[_0x4649('0x4')]!==_0x4649('0x5')){_0x52be4a['service']=_0x3e51d4[_0x4649('0x4')];}else{_0x52be4a['host']=_0x3e51d4['Smtp']['host'];_0x52be4a[_0x4649('0x6')]=_0x3e51d4['Smtp'][_0x4649('0x6')];_0x52be4a[_0x4649('0x7')]=_0x3e51d4[_0x4649('0x8')][_0x4649('0x7')];}if(_0x3e51d4[_0x4649('0x8')][_0x4649('0x9')]){if(_0x3e51d4[_0x4649('0x8')][_0x4649('0xa')]){if(!_0x3e51d4[_0x4649('0x8')]['CloudProvider'])throw new Error(_0x4649('0xb'));_0x52be4a['auth']={'type':'OAuth2','user':_0x3e51d4[_0x4649('0x8')][_0x4649('0xc')],'accessToken':_0x3e51d4[_0x4649('0x8')][_0x4649('0xd')][_0x4649('0xe')]};}else{_0x52be4a[_0x4649('0xf')]={'user':_0x3e51d4['Smtp']['user'],'pass':_0x3e51d4[_0x4649('0x8')][_0x4649('0x10')]};}}return _0x52be4a;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index aaccf95..f684828 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 _0x8ca9=['autoclose','push','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','attach','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','subject','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','bcc','Email','ChatOfflineMessageId','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','raw','options','limit','include','map','model','attributes','debug','ShowMailAccount','find','where','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','CmList','List','CmContact','Contacts','DESC','MailApplication','Applications','MailServerOut','CloudProvider','get','omit','list','applications','priority','asc'];(function(_0x5d99dd,_0x4bb40b){var _0x148a26=function(_0x25df5f){while(--_0x25df5f){_0x5d99dd['push'](_0x5d99dd['shift']());}};_0x148a26(++_0x4bb40b);}(_0x8ca9,0x9c));var _0x98ca=function(_0x466611,_0x421a63){_0x466611=_0x466611-0x0;var _0x4112c4=_0x8ca9[_0x466611];return _0x4112c4;};'use strict';var _=require(_0x98ca('0x0'));var moment=require(_0x98ca('0x1'));var BPromise=require(_0x98ca('0x2'));var rs=require(_0x98ca('0x3'));var Redis=require(_0x98ca('0x4'));var db=require(_0x98ca('0x5'))['db'];var logger=require(_0x98ca('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x98ca('0x7'));var client=jayson['client'][_0x98ca('0x8')]({'port':0x232c});config['redis']=_[_0x98ca('0x9')](config[_0x98ca('0xa')],{'host':_0x98ca('0xb'),'port':0x18eb});var socket=require(_0x98ca('0xc'))(new Redis(config[_0x98ca('0xa')]));require(_0x98ca('0xd'))[_0x98ca('0xe')](socket);function respondWithRpcPromise(_0x210234,_0x277c29,_0x404cc1){return new BPromise(function(_0x572858,_0x2074fb){return client[_0x98ca('0xf')](_0x210234,_0x404cc1)[_0x98ca('0x10')](function(_0x220a97){logger[_0x98ca('0x11')](_0x98ca('0x12'),_0x277c29,_0x98ca('0x13'));logger['debug'](_0x98ca('0x14'),_0x277c29,_0x98ca('0x13'),JSON[_0x98ca('0x15')](_0x220a97));if(_0x220a97[_0x98ca('0x16')]){if(_0x220a97['error'][_0x98ca('0x17')]===0x1f4){logger[_0x98ca('0x16')](_0x98ca('0x12'),_0x277c29,_0x220a97[_0x98ca('0x16')][_0x98ca('0x18')]);return _0x2074fb(_0x220a97[_0x98ca('0x16')][_0x98ca('0x18')]);}logger['error'](_0x98ca('0x12'),_0x277c29,_0x220a97[_0x98ca('0x16')][_0x98ca('0x18')]);return _0x572858(_0x220a97[_0x98ca('0x16')]['message']);}else{logger[_0x98ca('0x11')](_0x98ca('0x12'),_0x277c29,_0x98ca('0x13'));_0x572858(_0x220a97[_0x98ca('0x19')][_0x98ca('0x18')]);}})[_0x98ca('0x1a')](function(_0x28c8a6){logger[_0x98ca('0x16')](_0x98ca('0x12'),_0x277c29,_0x28c8a6);_0x2074fb(_0x28c8a6);});});}exports[_0x98ca('0x1b')]=function(_0x1b2c69){var _0x4806a3=this;return new Promise(function(_0x626b37,_0x49298d){return db[_0x98ca('0x1c')][_0x98ca('0x1d')]({'raw':_0x1b2c69['options']?_0x1b2c69['options'][_0x98ca('0x1e')]===undefined?!![]:![]:!![],'where':_0x1b2c69[_0x98ca('0x1f')]?_0x1b2c69[_0x98ca('0x1f')]['where']||null:null,'attributes':_0x1b2c69[_0x98ca('0x1f')]?_0x1b2c69[_0x98ca('0x1f')]['attributes']||null:null,'limit':_0x1b2c69[_0x98ca('0x1f')]?_0x1b2c69['options'][_0x98ca('0x20')]||null:null,'include':_0x1b2c69[_0x98ca('0x1f')]?_0x1b2c69[_0x98ca('0x1f')][_0x98ca('0x21')]?_[_0x98ca('0x22')](_0x1b2c69[_0x98ca('0x1f')][_0x98ca('0x21')],function(_0x50b1a2){return{'model':db[_0x50b1a2[_0x98ca('0x23')]],'as':_0x50b1a2['as'],'attributes':_0x50b1a2['attributes'],'include':_0x50b1a2[_0x98ca('0x21')]?_[_0x98ca('0x22')](_0x50b1a2['include'],function(_0x1f569b){return{'model':db[_0x1f569b['model']],'as':_0x1f569b['as'],'attributes':_0x1f569b[_0x98ca('0x24')],'include':_0x1f569b['include']?_['map'](_0x1f569b[_0x98ca('0x21')],function(_0x540f45){return{'model':db[_0x540f45[_0x98ca('0x23')]],'as':_0x540f45['as'],'attributes':_0x540f45[_0x98ca('0x24')]};}):[]};}):[]};}):[]:[]})[_0x98ca('0x10')](function(_0x21a12a){logger[_0x98ca('0x11')](_0x98ca('0x1b'),_0x1b2c69);logger[_0x98ca('0x25')](_0x98ca('0x1b'),_0x1b2c69,JSON[_0x98ca('0x15')](_0x21a12a));_0x626b37(_0x21a12a);})['catch'](function(_0x2ebf28){logger['error'](_0x98ca('0x1b'),_0x2ebf28[_0x98ca('0x18')],_0x1b2c69);_0x49298d(_0x4806a3['error'](0x1f4,_0x2ebf28['message']));});});};exports[_0x98ca('0x26')]=function(_0x4b37b4){var _0x3990d7=this;return new Promise(function(_0x4f1622,_0x2aaf39){return db['MailAccount'][_0x98ca('0x27')]({'raw':_0x4b37b4[_0x98ca('0x1f')]?_0x4b37b4['options'][_0x98ca('0x1e')]===undefined?!![]:![]:!![],'where':_0x4b37b4[_0x98ca('0x1f')]?_0x4b37b4['options'][_0x98ca('0x28')]||null:null,'attributes':_0x4b37b4[_0x98ca('0x1f')]?_0x4b37b4['options'][_0x98ca('0x24')]||null:null,'include':_0x4b37b4[_0x98ca('0x1f')]?_0x4b37b4[_0x98ca('0x1f')][_0x98ca('0x21')]?_[_0x98ca('0x22')](_0x4b37b4['options'][_0x98ca('0x21')],function(_0x430a37){return{'model':db[_0x430a37['model']],'as':_0x430a37['as'],'attributes':_0x430a37[_0x98ca('0x24')],'include':_0x430a37[_0x98ca('0x21')]?_[_0x98ca('0x22')](_0x430a37['include'],function(_0x1ef3ff){return{'model':db[_0x1ef3ff[_0x98ca('0x23')]],'as':_0x1ef3ff['as'],'attributes':_0x1ef3ff[_0x98ca('0x24')],'include':_0x1ef3ff['include']?_[_0x98ca('0x22')](_0x1ef3ff[_0x98ca('0x21')],function(_0x10cbe0){return{'model':db[_0x10cbe0['model']],'as':_0x10cbe0['as'],'attributes':_0x10cbe0['attributes']};}):[]};}):[]};}):[]:[]})[_0x98ca('0x10')](function(_0xe77d02){if(_0x4b37b4[_0x98ca('0x1f')]['smtp']===!![])_0xe77d02[_0x98ca('0x29')](_0x98ca('0x2a'),_0xe77d02[_0x98ca('0x2b')]());logger['info'](_0x98ca('0x26'),_0x4b37b4);logger[_0x98ca('0x25')](_0x98ca('0x26'),_0x4b37b4,JSON[_0x98ca('0x15')](_0xe77d02));_0x4f1622(_0xe77d02);})[_0x98ca('0x1a')](function(_0x5d924c){logger['error']('ShowMailAccount',_0x5d924c[_0x98ca('0x18')],_0x4b37b4);_0x2aaf39(_0x3990d7[_0x98ca('0x16')](0x1f4,_0x5d924c[_0x98ca('0x18')]));});});};exports[_0x98ca('0x2c')]=function(_0x43ba26){var _0xda0db1=this;return new Promise(function(_0x29801f,_0x570afe){var _0x4900ed={'body':_0x43ba26[_0x98ca('0x2d')],'channel':_0x98ca('0x2e')};var _0x31424f=_[_0x98ca('0x2f')](_[_0x98ca('0x30')](db['CmContact']['rawAttributes']),['createdAt',_0x98ca('0x31'),_0x98ca('0x32'),_0x98ca('0x33')]);var _0x3f260b=![];if(_0x43ba26['body']['id']){delete _0x43ba26['body']['id'];}if(_[_0x98ca('0x34')](_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x35')])){return _0x570afe(_0xda0db1[_0x98ca('0x16')](0x1f4,_0x98ca('0x36')));}if(_[_0x98ca('0x34')](_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x2d')])||_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x2d')]===''){return _0x570afe(_0xda0db1[_0x98ca('0x16')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x98ca('0x34')](_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x37')])){return _0x570afe(_0xda0db1[_0x98ca('0x16')](0x1f4,_0x98ca('0x38')+_0x31424f));}if(!_[_0x98ca('0x39')](_0x31424f,_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x37')])){return _0x570afe(_0xda0db1[_0x98ca('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x31424f));}var _0x2a4d0a={};_0x2a4d0a[_0x43ba26[_0x98ca('0x2d')]['mapKey']]=_0x43ba26[_0x98ca('0x2d')]['from'];return db[_0x98ca('0x1c')][_0x98ca('0x27')]({'where':{'id':_0x43ba26[_0x98ca('0x3a')]['id']},'include':[{'model':db[_0x98ca('0x3b')],'as':_0x98ca('0x3c'),'include':[{'model':db[_0x98ca('0x3d')],'as':_0x98ca('0x3e'),'where':_0x2a4d0a,'limit':0x1,'order':[[_0x98ca('0x31'),_0x98ca('0x3f')]]}]},{'model':db[_0x98ca('0x40')],'as':_0x98ca('0x41')},{'model':db[_0x98ca('0x42')],'as':'Smtp','include':[{'model':db[_0x98ca('0x43')],'as':_0x98ca('0x43')}]}]})[_0x98ca('0x10')](function(_0x19dc39){if(_0x19dc39&&_0x19dc39['List']){var _0xec9f92=_0x19dc39[_0x98ca('0x44')]({'plain':!![]});_0x4900ed[_0x98ca('0x3a')]=_[_0x98ca('0x45')](_0xec9f92,[_0x98ca('0x41'),_0x98ca('0x3c')]);_0x4900ed[_0x98ca('0x3a')]['smtpOptions']=_0x19dc39['getSmtpOptions']();_0x4900ed['applications']=_0xec9f92[_0x98ca('0x41')];_0x4900ed[_0x98ca('0x46')]=_0xec9f92[_0x98ca('0x3c')];_0x4900ed[_0x98ca('0x47')]=_['orderBy'](_0x4900ed['applications'],[_0x98ca('0x48')],[_0x98ca('0x49')]);if(_0x4900ed[_0x98ca('0x3a')]&&_0x4900ed[_0x98ca('0x3a')][_0x98ca('0x4a')]){_0x4900ed[_0x98ca('0x47')][_0x98ca('0x4b')]({'id':0x0,'priority':_0x4900ed[_0x98ca('0x47')][_0x98ca('0x4c')]+0x1,'app':_0x98ca('0x4d'),'appdata':_0x98ca('0x4a'),'interval':_0x98ca('0x4e')});}if(_0x4900ed[_0x98ca('0x3a')]['Applications']){delete _0x4900ed[_0x98ca('0x3a')]['Applications'];}if(_0x4900ed[_0x98ca('0x3a')][_0x98ca('0x3c')]){delete _0x4900ed[_0x98ca('0x3a')][_0x98ca('0x3c')];}if(_0xec9f92[_0x98ca('0x3c')]['Contacts'][_0x98ca('0x4c')]){return _0xec9f92[_0x98ca('0x3c')]['Contacts'][0x0];}var _0x19473e=_[_0x98ca('0x9')](_0x43ba26[_0x98ca('0x2d')],{'firstName':_0x43ba26['body'][_0x98ca('0x35')],'ListId':_0xec9f92[_0x98ca('0x33')]});_0x19473e[_0x43ba26['body'][_0x98ca('0x37')]]=_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x35')];return db[_0x98ca('0x3d')][_0x98ca('0x4f')](_0x19473e);}else{throw new Error(_0x98ca('0x50'));}})[_0x98ca('0x10')](function(_0x594d82){_0x4900ed[_0x98ca('0x51')]=_0x594d82;if(_0x594d82){if(!_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')]['messageId']){_0x43ba26['body'][_0x98ca('0x18')][_0x98ca('0x52')]=rs[_0x98ca('0x53')]()+'\x20'+_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x35')];}var _0x3dc32e={'ContactId':_0x594d82['id'],'MailAccountId':_0x43ba26[_0x98ca('0x3a')]['id'],'inReplyTo':_0x43ba26['body'][_0x98ca('0x18')]['messageId'],'to':_0x43ba26['body'][_0x98ca('0x18')][_0x98ca('0x35')],'cc':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')]['cc'],'subject':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')]['subject'],'attach':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x54')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x98ca('0x55')][_0x98ca('0x27')]({'where':{'closed':![],'MailAccountId':_0x43ba26[_0x98ca('0x3a')]['id']},'include':[{'model':db[_0x98ca('0x56')],'as':_0x98ca('0x57'),'attributes':[_0x98ca('0x52')],'where':{'messageId':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x58')]}}]})[_0x98ca('0x10')](function(_0x40c799){if(_0x40c799){return[_0x40c799,![]];}return db[_0x98ca('0x55')]['create'](_0x3dc32e)[_0x98ca('0x10')](function(_0xb7b30e){return[_0xb7b30e,!![]];});});}else{throw new Error(_0x98ca('0x59'));}})[_0x98ca('0x5a')](function(_0x1082f4,_0x23344b){if(_0x1082f4){_0x3f260b=_0x23344b;if(!_0x23344b){return _0x1082f4[_0x98ca('0x5b')]({'inReplyTo':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')]['messageId'],'to':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x35')],'cc':_0x43ba26['body'][_0x98ca('0x18')]['cc'],'subject':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x5c')],'attach':_0x1082f4[_0x98ca('0x54')]?_0x1082f4['attach']:_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')]['attach'],'substatus':null,'substatusAt':moment()[_0x98ca('0x5d')](_0x98ca('0x5e')),'lastMsgAt':moment()[_0x98ca('0x5d')](_0x98ca('0x5e')),'lastMsgDirection':'in'});}else{return _0x1082f4;}}})[_0x98ca('0x10')](function(_0x20fcc9){_0x4900ed['interaction']=_0x20fcc9[_0x98ca('0x44')]({'plain':!![]});_0x4900ed[_0x98ca('0x5f')][_0x98ca('0x60')]=_0x3f260b;return db[_0x98ca('0x56')]['create']({'body':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x2d')],'MailAccountId':_0x43ba26['account']['id'],'MailInteractionId':_0x20fcc9['id'],'direction':'in','ContactId':_0x4900ed[_0x98ca('0x51')]['id'],'messageId':_0x43ba26[_0x98ca('0x2d')]['message'][_0x98ca('0x52')],'from':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x35')],'to':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')]['to'],'cc':_0x43ba26['body'][_0x98ca('0x18')]['cc'],'subject':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x5c')],'attach':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x54')],'Attachments':_0x43ba26['body'][_0x98ca('0x18')][_0x98ca('0x61')],'originTo':_0x43ba26[_0x98ca('0x2d')]['message'][_0x98ca('0x62')],'originCc':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')]['originCc'],'bcc':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x63')],'ChatWebsiteId':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')]['ChatWebsiteId']||null,'originChannel':_0x43ba26['body'][_0x98ca('0x18')]['originChannel']||_0x98ca('0x64'),'ChatOfflineMessageId':_0x43ba26[_0x98ca('0x2d')][_0x98ca('0x18')][_0x98ca('0x65')]||null},{'include':[{'model':db['Attachment'],'as':_0x98ca('0x66')}]});})[_0x98ca('0x10')](function(_0x55c8c3){_0x4900ed[_0x98ca('0x18')]=_0x55c8c3;if(!_0x4900ed[_0x98ca('0x5f')][_0x98ca('0x67')]){return;}return db[_0x98ca('0x68')][_0x98ca('0x27')]({'attributes':['id',_0x98ca('0x69')],'where':{'id':_0x4900ed[_0x98ca('0x5f')][_0x98ca('0x67')]}});})[_0x98ca('0x10')](function(_0x13114b){if(_0x13114b){_0x4900ed[_0x98ca('0x47')][_0x98ca('0x6a')]({'id':0x0,'priority':0x0,'app':_0x98ca('0x6b'),'appdata':_0x13114b[_0x98ca('0x69')]+','+(_0x4900ed[_0x98ca('0x3a')][_0x98ca('0x6c')]||0xa),'interval':_0x98ca('0x4e')});}if(!_0x4900ed[_0x98ca('0x5f')][_0x98ca('0x6d')]){return;}return db[_0x98ca('0x6e')][_0x98ca('0x27')]({'attributes':['id','name'],'where':{'id':_0x4900ed[_0x98ca('0x5f')][_0x98ca('0x6d')]}});})['then'](function(_0x34c7b7){if(_0x34c7b7){_0x4900ed[_0x98ca('0x47')]['unshift']({'id':0x0,'priority':0x1,'app':_0x98ca('0x6f'),'appdata':_0x34c7b7['name']+','+(_0x4900ed[_0x98ca('0x3a')][_0x98ca('0x70')]||0x12c),'interval':_0x98ca('0x4e')});}return respondWithRpcPromise(_0x98ca('0x71'),_0x98ca('0x72'),_0x4900ed);})['then'](function(_0x54975d){_0x29801f(_0x54975d);})[_0x98ca('0x1a')](function(_0x3f1057){_0x570afe(_0xda0db1[_0x98ca('0x16')](0x1f4,_0x3f1057[_0x98ca('0x18')]));});});}; \ No newline at end of file +var _0x3c17=['findAll','options','raw','attributes','limit','include','model','map','ShowMailAccount','where','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','difference','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','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','mapKey','from','find','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','applications','list','asc','close','autoclose','length','CmContact','contact','messageId','generate','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','subject','format','interaction','created','attachments','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','User','name','UserId','waitForTheAssignedAgent','*,*,*,*','queueId','MailQueue','waitForTheAssignedQueue','Start','startRouting','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetMailAccount','MailAccount'];(function(_0x25c4f6,_0x1d79a6){var _0x1279a7=function(_0x50102f){while(--_0x50102f){_0x25c4f6['push'](_0x25c4f6['shift']());}};_0x1279a7(++_0x1d79a6);}(_0x3c17,0x1a1));var _0x73c1=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x3c17[_0x31cb5f];return _0x586042;};'use strict';var _=require(_0x73c1('0x0'));var moment=require('moment');var BPromise=require(_0x73c1('0x1'));var rs=require('randomstring');var Redis=require(_0x73c1('0x2'));var db=require(_0x73c1('0x3'))['db'];var logger=require(_0x73c1('0x4'))('rpc');var config=require(_0x73c1('0x5'));var jayson=require(_0x73c1('0x6'));var client=jayson[_0x73c1('0x7')][_0x73c1('0x8')]({'port':0x232c});config['redis']=_[_0x73c1('0x9')](config['redis'],{'host':_0x73c1('0xa'),'port':0x18eb});var socket=require(_0x73c1('0xb'))(new Redis(config[_0x73c1('0xc')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x176227,_0x2eb6fe,_0x400875){return new BPromise(function(_0x16c774,_0x2b2578){return client[_0x73c1('0xd')](_0x176227,_0x400875)[_0x73c1('0xe')](function(_0x4e5bc6){logger['info'](_0x73c1('0xf'),_0x2eb6fe,_0x73c1('0x10'));logger[_0x73c1('0x11')](_0x73c1('0x12'),_0x2eb6fe,'request\x20sent',JSON[_0x73c1('0x13')](_0x4e5bc6));if(_0x4e5bc6['error']){if(_0x4e5bc6[_0x73c1('0x14')]['code']===0x1f4){logger[_0x73c1('0x14')](_0x73c1('0xf'),_0x2eb6fe,_0x4e5bc6['error']['message']);return _0x2b2578(_0x4e5bc6[_0x73c1('0x14')]['message']);}logger[_0x73c1('0x14')]('MailAccount,\x20%s,\x20%s',_0x2eb6fe,_0x4e5bc6[_0x73c1('0x14')]['message']);return _0x16c774(_0x4e5bc6[_0x73c1('0x14')][_0x73c1('0x15')]);}else{logger[_0x73c1('0x16')](_0x73c1('0xf'),_0x2eb6fe,_0x73c1('0x10'));_0x16c774(_0x4e5bc6[_0x73c1('0x17')][_0x73c1('0x15')]);}})[_0x73c1('0x18')](function(_0x1ce19e){logger['error'](_0x73c1('0xf'),_0x2eb6fe,_0x1ce19e);_0x2b2578(_0x1ce19e);});});}exports[_0x73c1('0x19')]=function(_0x28df60){var _0x121bef=this;return new Promise(function(_0x4b1b94,_0x3fbaea){return db[_0x73c1('0x1a')][_0x73c1('0x1b')]({'raw':_0x28df60[_0x73c1('0x1c')]?_0x28df60[_0x73c1('0x1c')][_0x73c1('0x1d')]===undefined?!![]:![]:!![],'where':_0x28df60[_0x73c1('0x1c')]?_0x28df60[_0x73c1('0x1c')]['where']||null:null,'attributes':_0x28df60[_0x73c1('0x1c')]?_0x28df60[_0x73c1('0x1c')][_0x73c1('0x1e')]||null:null,'limit':_0x28df60['options']?_0x28df60[_0x73c1('0x1c')][_0x73c1('0x1f')]||null:null,'include':_0x28df60[_0x73c1('0x1c')]?_0x28df60[_0x73c1('0x1c')][_0x73c1('0x20')]?_['map'](_0x28df60[_0x73c1('0x1c')]['include'],function(_0x54feeb){return{'model':db[_0x54feeb[_0x73c1('0x21')]],'as':_0x54feeb['as'],'attributes':_0x54feeb[_0x73c1('0x1e')],'include':_0x54feeb[_0x73c1('0x20')]?_[_0x73c1('0x22')](_0x54feeb[_0x73c1('0x20')],function(_0x30ec73){return{'model':db[_0x30ec73[_0x73c1('0x21')]],'as':_0x30ec73['as'],'attributes':_0x30ec73[_0x73c1('0x1e')],'include':_0x30ec73[_0x73c1('0x20')]?_[_0x73c1('0x22')](_0x30ec73[_0x73c1('0x20')],function(_0x460b69){return{'model':db[_0x460b69[_0x73c1('0x21')]],'as':_0x460b69['as'],'attributes':_0x460b69[_0x73c1('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b2996){logger[_0x73c1('0x16')](_0x73c1('0x19'),_0x28df60);logger[_0x73c1('0x11')](_0x73c1('0x19'),_0x28df60,JSON[_0x73c1('0x13')](_0x2b2996));_0x4b1b94(_0x2b2996);})[_0x73c1('0x18')](function(_0x45c411){logger[_0x73c1('0x14')]('GetMailAccount',_0x45c411['message'],_0x28df60);_0x3fbaea(_0x121bef[_0x73c1('0x14')](0x1f4,_0x45c411[_0x73c1('0x15')]));});});};exports[_0x73c1('0x23')]=function(_0x2a9ff8){var _0x52a05e=this;return new Promise(function(_0x3e54b2,_0x11432d){return db[_0x73c1('0x1a')]['find']({'raw':_0x2a9ff8[_0x73c1('0x1c')]?_0x2a9ff8[_0x73c1('0x1c')][_0x73c1('0x1d')]===undefined?!![]:![]:!![],'where':_0x2a9ff8[_0x73c1('0x1c')]?_0x2a9ff8[_0x73c1('0x1c')][_0x73c1('0x24')]||null:null,'attributes':_0x2a9ff8['options']?_0x2a9ff8[_0x73c1('0x1c')][_0x73c1('0x1e')]||null:null,'include':_0x2a9ff8[_0x73c1('0x1c')]?_0x2a9ff8[_0x73c1('0x1c')][_0x73c1('0x20')]?_[_0x73c1('0x22')](_0x2a9ff8[_0x73c1('0x1c')][_0x73c1('0x20')],function(_0x3103ec){return{'model':db[_0x3103ec[_0x73c1('0x21')]],'as':_0x3103ec['as'],'attributes':_0x3103ec['attributes'],'include':_0x3103ec[_0x73c1('0x20')]?_['map'](_0x3103ec[_0x73c1('0x20')],function(_0x25e2f6){return{'model':db[_0x25e2f6[_0x73c1('0x21')]],'as':_0x25e2f6['as'],'attributes':_0x25e2f6[_0x73c1('0x1e')],'include':_0x25e2f6['include']?_['map'](_0x25e2f6['include'],function(_0x26ab79){return{'model':db[_0x26ab79['model']],'as':_0x26ab79['as'],'attributes':_0x26ab79[_0x73c1('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x73c1('0xe')](function(_0x2dcdc4){if(_0x2a9ff8[_0x73c1('0x1c')][_0x73c1('0x25')]===!![])_0x2dcdc4[_0x73c1('0x26')](_0x73c1('0x27'),_0x2dcdc4[_0x73c1('0x28')]());logger[_0x73c1('0x16')](_0x73c1('0x23'),_0x2a9ff8);logger[_0x73c1('0x11')]('ShowMailAccount',_0x2a9ff8,JSON[_0x73c1('0x13')](_0x2dcdc4));_0x3e54b2(_0x2dcdc4);})[_0x73c1('0x18')](function(_0x4728e2){logger[_0x73c1('0x14')](_0x73c1('0x23'),_0x4728e2[_0x73c1('0x15')],_0x2a9ff8);_0x11432d(_0x52a05e['error'](0x1f4,_0x4728e2[_0x73c1('0x15')]));});});};exports[_0x73c1('0x29')]=function(_0x3c6b35){var _0x2411bb=this;return new Promise(function(_0x21feb9,_0x20668f){var _0x4d87fb={'body':_0x3c6b35[_0x73c1('0x2a')],'channel':'mail'};var _0x3fdc4f=_[_0x73c1('0x2b')](_['keys'](db['CmContact'][_0x73c1('0x2c')]),[_0x73c1('0x2d'),_0x73c1('0x2e'),_0x73c1('0x2f'),_0x73c1('0x30')]);var _0x282b73=![];if(_0x3c6b35['body']['id']){delete _0x3c6b35['body']['id'];}if(_[_0x73c1('0x31')](_0x3c6b35[_0x73c1('0x2a')]['from'])){return _0x20668f(_0x2411bb['error'](0x1f4,_0x73c1('0x32')));}if(_['isNil'](_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x2a')])||_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x2a')]===''){return _0x20668f(_0x2411bb[_0x73c1('0x14')](0x1f4,_0x73c1('0x33')));}if(_[_0x73c1('0x31')](_0x3c6b35[_0x73c1('0x2a')]['mapKey'])){return _0x20668f(_0x2411bb['error'](0x1f4,_0x73c1('0x34')+_0x3fdc4f));}if(!_[_0x73c1('0x35')](_0x3fdc4f,_0x3c6b35[_0x73c1('0x2a')]['mapKey'])){return _0x20668f(_0x2411bb[_0x73c1('0x14')](0x1f4,_0x73c1('0x36')+_0x3fdc4f));}var _0x3c504d={};_0x3c504d[_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x37')]]=_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x38')];return db[_0x73c1('0x1a')][_0x73c1('0x39')]({'where':{'id':_0x3c6b35[_0x73c1('0x3a')]['id']},'include':[{'model':db[_0x73c1('0x3b')],'as':_0x73c1('0x3c'),'include':[{'model':db['CmContact'],'as':_0x73c1('0x3d'),'where':_0x3c504d,'limit':0x1,'order':[['updatedAt',_0x73c1('0x3e')]]}]},{'model':db[_0x73c1('0x3f')],'as':_0x73c1('0x40')},{'model':db[_0x73c1('0x41')],'as':_0x73c1('0x42'),'include':[{'model':db[_0x73c1('0x43')],'as':'CloudProvider'}]}]})[_0x73c1('0xe')](function(_0x2ccd11){if(_0x2ccd11&&_0x2ccd11[_0x73c1('0x3c')]){var _0x4c1f5f=_0x2ccd11[_0x73c1('0x44')]({'plain':!![]});_0x4d87fb[_0x73c1('0x3a')]=_[_0x73c1('0x45')](_0x4c1f5f,[_0x73c1('0x40'),_0x73c1('0x3c')]);_0x4d87fb[_0x73c1('0x3a')][_0x73c1('0x27')]=_0x2ccd11[_0x73c1('0x28')]();_0x4d87fb[_0x73c1('0x46')]=_0x4c1f5f['Applications'];_0x4d87fb[_0x73c1('0x47')]=_0x4c1f5f['List'];_0x4d87fb['applications']=_['orderBy'](_0x4d87fb['applications'],['priority'],[_0x73c1('0x48')]);if(_0x4d87fb['account']&&_0x4d87fb[_0x73c1('0x3a')]['autoclose']){_0x4d87fb['applications']['push']({'id':0x0,'priority':_0x4d87fb[_0x73c1('0x46')]['length']+0x1,'app':_0x73c1('0x49'),'appdata':_0x73c1('0x4a'),'interval':'*,*,*,*'});}if(_0x4d87fb[_0x73c1('0x3a')][_0x73c1('0x40')]){delete _0x4d87fb[_0x73c1('0x3a')][_0x73c1('0x40')];}if(_0x4d87fb[_0x73c1('0x3a')][_0x73c1('0x3c')]){delete _0x4d87fb[_0x73c1('0x3a')][_0x73c1('0x3c')];}if(_0x4c1f5f[_0x73c1('0x3c')][_0x73c1('0x3d')][_0x73c1('0x4b')]){return _0x4c1f5f[_0x73c1('0x3c')][_0x73c1('0x3d')][0x0];}var _0x2cb41b=_[_0x73c1('0x9')](_0x3c6b35[_0x73c1('0x2a')],{'firstName':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x38')],'ListId':_0x4c1f5f[_0x73c1('0x30')]});_0x2cb41b[_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x37')]]=_0x3c6b35['body']['from'];return db[_0x73c1('0x4c')]['create'](_0x2cb41b);}else{throw new Error('List\x20not\x20found');}})[_0x73c1('0xe')](function(_0x854ef6){_0x4d87fb[_0x73c1('0x4d')]=_0x854ef6;if(_0x854ef6){if(!_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')][_0x73c1('0x4e')]){_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')][_0x73c1('0x4e')]=rs[_0x73c1('0x4f')]()+'\x20'+_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')]['from'];}var _0x385817={'ContactId':_0x854ef6['id'],'MailAccountId':_0x3c6b35[_0x73c1('0x3a')]['id'],'inReplyTo':_0x3c6b35[_0x73c1('0x2a')]['message'][_0x73c1('0x4e')],'to':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')]['from'],'cc':_0x3c6b35['body']['message']['cc'],'subject':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')]['subject'],'attach':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')][_0x73c1('0x50')],'lastMsgAt':moment()['format'](_0x73c1('0x51')),'lastMsgDirection':'in'};return db[_0x73c1('0x52')][_0x73c1('0x39')]({'where':{'closed':![],'MailAccountId':_0x3c6b35[_0x73c1('0x3a')]['id']},'include':[{'model':db[_0x73c1('0x53')],'as':_0x73c1('0x54'),'attributes':[_0x73c1('0x4e')],'where':{'messageId':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')][_0x73c1('0x55')]}}]})[_0x73c1('0xe')](function(_0x1575f4){if(_0x1575f4){return[_0x1575f4,![]];}return db[_0x73c1('0x52')]['create'](_0x385817)[_0x73c1('0xe')](function(_0x5517e3){return[_0x5517e3,!![]];});});}else{throw new Error(_0x73c1('0x56'));}})[_0x73c1('0x57')](function(_0x595086,_0x2295c5){if(_0x595086){_0x282b73=_0x2295c5;if(!_0x2295c5){return _0x595086[_0x73c1('0x58')]({'inReplyTo':_0x3c6b35['body'][_0x73c1('0x15')]['messageId'],'to':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')][_0x73c1('0x38')],'cc':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')]['cc'],'subject':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')][_0x73c1('0x59')],'attach':_0x595086[_0x73c1('0x50')]?_0x595086[_0x73c1('0x50')]:_0x3c6b35['body'][_0x73c1('0x15')][_0x73c1('0x50')],'substatus':null,'substatusAt':moment()[_0x73c1('0x5a')](_0x73c1('0x51')),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x595086;}}})[_0x73c1('0xe')](function(_0x466f4d){_0x4d87fb[_0x73c1('0x5b')]=_0x466f4d[_0x73c1('0x44')]({'plain':!![]});_0x4d87fb[_0x73c1('0x5b')][_0x73c1('0x5c')]=_0x282b73;return db[_0x73c1('0x53')]['create']({'body':_0x3c6b35[_0x73c1('0x2a')]['body'],'MailAccountId':_0x3c6b35[_0x73c1('0x3a')]['id'],'MailInteractionId':_0x466f4d['id'],'direction':'in','ContactId':_0x4d87fb[_0x73c1('0x4d')]['id'],'messageId':_0x3c6b35['body'][_0x73c1('0x15')][_0x73c1('0x4e')],'from':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')]['from'],'to':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')]['to'],'cc':_0x3c6b35['body']['message']['cc'],'subject':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')]['subject'],'attach':_0x3c6b35['body'][_0x73c1('0x15')][_0x73c1('0x50')],'Attachments':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')][_0x73c1('0x5d')],'originTo':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')]['originTo'],'originCc':_0x3c6b35['body'][_0x73c1('0x15')][_0x73c1('0x5e')],'bcc':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')]['bcc'],'ChatWebsiteId':_0x3c6b35['body'][_0x73c1('0x15')][_0x73c1('0x5f')]||null,'originChannel':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')][_0x73c1('0x60')]||_0x73c1('0x61'),'ChatOfflineMessageId':_0x3c6b35[_0x73c1('0x2a')][_0x73c1('0x15')][_0x73c1('0x62')]||null},{'include':[{'model':db[_0x73c1('0x63')],'as':_0x73c1('0x64')}]});})[_0x73c1('0xe')](function(_0xa8ed18){_0x4d87fb[_0x73c1('0x15')]=_0xa8ed18;if(!_0x4d87fb[_0x73c1('0x5b')]['UserId']){return;}return db[_0x73c1('0x65')]['find']({'attributes':['id',_0x73c1('0x66')],'where':{'id':_0x4d87fb['interaction'][_0x73c1('0x67')]}});})[_0x73c1('0xe')](function(_0x3ae4d7){if(_0x3ae4d7){_0x4d87fb[_0x73c1('0x46')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3ae4d7[_0x73c1('0x66')]+','+(_0x4d87fb[_0x73c1('0x3a')][_0x73c1('0x68')]||0xa),'interval':_0x73c1('0x69')});}if(!_0x4d87fb[_0x73c1('0x5b')][_0x73c1('0x6a')]){return;}return db[_0x73c1('0x6b')][_0x73c1('0x39')]({'attributes':['id',_0x73c1('0x66')],'where':{'id':_0x4d87fb['interaction'][_0x73c1('0x6a')]}});})[_0x73c1('0xe')](function(_0x281310){if(_0x281310){_0x4d87fb[_0x73c1('0x46')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x281310[_0x73c1('0x66')]+','+(_0x4d87fb[_0x73c1('0x3a')][_0x73c1('0x6c')]||0x12c),'interval':_0x73c1('0x69')});}return respondWithRpcPromise(_0x73c1('0x6d'),_0x73c1('0x6e'),_0x4d87fb);})[_0x73c1('0xe')](function(_0x5458e1){_0x21feb9(_0x5458e1);})[_0x73c1('0x18')](function(_0x1040b4){_0x20668f(_0x2411bb[_0x73c1('0x14')](0x1f4,_0x1040b4[_0x73c1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 68b478c..f8bbcec 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 _0x9af6=['removeListener','length','mailAccount:','./mailAccount.events','save','remove'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x9af6,0x1d7));var _0x69af=function(_0x2e150b,_0x2a4339){_0x2e150b=_0x2e150b-0x0;var _0x5abd42=_0x9af6[_0x2e150b];return _0x5abd42;};'use strict';var MailAccountEvents=require(_0x69af('0x0'));var events=[_0x69af('0x1'),_0x69af('0x2'),'update'];function createListener(_0x5cdef7,_0x3c6ca8){return function(_0x4ed59b){_0x3c6ca8['emit'](_0x5cdef7,_0x4ed59b);};}function removeListener(_0x185b85,_0x11f0e4){return function(){MailAccountEvents[_0x69af('0x3')](_0x185b85,_0x11f0e4);};}exports['register']=function(_0x3848c6){for(var _0x54e2f1=0x0,_0x1073cb=events[_0x69af('0x4')];_0x54e2f1<_0x1073cb;_0x54e2f1++){var _0x408d57=events[_0x54e2f1];var _0x17353a=createListener(_0x69af('0x5')+_0x408d57,_0x3848c6);MailAccountEvents['on'](_0x408d57,_0x17353a);}}; \ No newline at end of file +var _0x95a7=['length','./mailAccount.events','save','update','removeListener'];(function(_0x5ccbb8,_0x35cbe3){var _0x318270=function(_0x5cc118){while(--_0x5cc118){_0x5ccbb8['push'](_0x5ccbb8['shift']());}};_0x318270(++_0x35cbe3);}(_0x95a7,0x6a));var _0x795a=function(_0x1e0414,_0x2f755a){_0x1e0414=_0x1e0414-0x0;var _0x84b43=_0x95a7[_0x1e0414];return _0x84b43;};'use strict';var MailAccountEvents=require(_0x795a('0x0'));var events=[_0x795a('0x1'),'remove',_0x795a('0x2')];function createListener(_0x232e15,_0x203a1a){return function(_0x43da53){_0x203a1a['emit'](_0x232e15,_0x43da53);};}function removeListener(_0x16d402,_0x2a87c8){return function(){MailAccountEvents[_0x795a('0x3')](_0x16d402,_0x2a87c8);};}exports['register']=function(_0x1d922d){for(var _0x289f4a=0x0,_0x4de856=events[_0x795a('0x4')];_0x289f4a<_0x4de856;_0x289f4a++){var _0x10da2f=events[_0x289f4a];var _0x559391=createListener('mailAccount:'+_0x10da2f,_0x1d922d);MailAccountEvents['on'](_0x10da2f,_0x559391);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index ce47a0c..d0aa0f9 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 _0x5dfd=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','isAuthenticated','show','/:id','update','destroy','multer','util','path','connect-timeout'];(function(_0x22eac9,_0x4f4406){var _0x26a10c=function(_0xbb22cc){while(--_0xbb22cc){_0x22eac9['push'](_0x22eac9['shift']());}};_0x26a10c(++_0x4f4406);}(_0x5dfd,0xc8));var _0xd5df=function(_0x673722,_0x275d7e){_0x673722=_0x673722-0x0;var _0x21249c=_0x5dfd[_0x673722];return _0x21249c;};'use strict';var multer=require(_0xd5df('0x0'));var util=require(_0xd5df('0x1'));var path=require(_0xd5df('0x2'));var timeout=require(_0xd5df('0x3'));var express=require(_0xd5df('0x4'));var router=express[_0xd5df('0x5')]();var fs_extra=require(_0xd5df('0x6'));var auth=require(_0xd5df('0x7'));var interaction=require(_0xd5df('0x8'));var config=require(_0xd5df('0x9'));var controller=require(_0xd5df('0xa'));router[_0xd5df('0xb')]('/:id',auth[_0xd5df('0xc')](),controller[_0xd5df('0xd')]);router['put'](_0xd5df('0xe'),auth[_0xd5df('0xc')](),controller[_0xd5df('0xf')]);router['delete'](_0xd5df('0xe'),auth['isAuthenticated'](),controller[_0xd5df('0x10')]);module['exports']=router; \ No newline at end of file +var _0x6feb=['isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','show'];(function(_0x2c3498,_0x42ec6d){var _0x5d005c=function(_0x2c7609){while(--_0x2c7609){_0x2c3498['push'](_0x2c3498['shift']());}};_0x5d005c(++_0x42ec6d);}(_0x6feb,0x19d));var _0xb6fe=function(_0x4be874,_0x399f04){_0x4be874=_0x4be874-0x0;var _0x147c2a=_0x6feb[_0x4be874];return _0x147c2a;};'use strict';var multer=require('multer');var util=require(_0xb6fe('0x0'));var path=require(_0xb6fe('0x1'));var timeout=require(_0xb6fe('0x2'));var express=require(_0xb6fe('0x3'));var router=express[_0xb6fe('0x4')]();var fs_extra=require(_0xb6fe('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb6fe('0x6'));var config=require(_0xb6fe('0x7'));var controller=require(_0xb6fe('0x8'));router[_0xb6fe('0x9')](_0xb6fe('0xa'),auth['isAuthenticated'](),controller[_0xb6fe('0xb')]);router['put'](_0xb6fe('0xa'),auth[_0xb6fe('0xc')](),controller[_0xb6fe('0xd')]);router[_0xb6fe('0xe')](_0xb6fe('0xa'),auth[_0xb6fe('0xc')](),controller[_0xb6fe('0xf')]);module[_0xb6fe('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 a2b7f2b..65943e9 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 _0x45fd=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x45fd,0xac));var _0xd45f=function(_0x2a3efa,_0x4f7e71){_0x2a3efa=_0x2a3efa-0x0;var _0x55d8ae=_0x45fd[_0x2a3efa];return _0x55d8ae;};'use strict';var Sequelize=require(_0xd45f('0x0'));module[_0xd45f('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd45f('0x2')],'allowNull':![],'defaultValue':_0xd45f('0x3')},'appdata':{'type':Sequelize[_0xd45f('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd45f('0x2')],'defaultValue':_0xd45f('0x5')}}; \ No newline at end of file +var _0x8d97=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0xdbd4f7,_0x4e3bdd){var _0x5c3f9d=function(_0xa7a35a){while(--_0xa7a35a){_0xdbd4f7['push'](_0xdbd4f7['shift']());}};_0x5c3f9d(++_0x4e3bdd);}(_0x8d97,0x1d4));var _0x78d9=function(_0x3b9791,_0x468e33){_0x3b9791=_0x3b9791-0x0;var _0x18da41=_0x8d97[_0x3b9791];return _0x18da41;};'use strict';var Sequelize=require(_0x78d9('0x0'));module[_0x78d9('0x1')]={'priority':{'type':Sequelize[_0x78d9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x78d9('0x3')],'allowNull':![],'defaultValue':_0x78d9('0x4')},'appdata':{'type':Sequelize[_0x78d9('0x5')]()},'description':{'type':Sequelize[_0x78d9('0x3')]},'interval':{'type':Sequelize[_0x78d9('0x3')],'defaultValue':_0x78d9('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index d5cea49..8d13748 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 _0x54ef=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','show','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','options','MailApplication','find','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x37daff,_0x3e77db){var _0xff71e4=function(_0x1c456c){while(--_0x1c456c){_0x37daff['push'](_0x37daff['shift']());}};_0xff71e4(++_0x3e77db);}(_0x54ef,0x112));var _0xf54e=function(_0x57da17,_0x1de716){_0x57da17=_0x57da17-0x0;var _0x26ea2c=_0x54ef[_0x57da17];return _0x26ea2c;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];function respondWithStatusCode(_0x4b0ee1,_0x4bd828){_0x4bd828=_0x4bd828||0xcc;return function(_0x15a9d4){if(_0x15a9d4){return _0x4b0ee1[_0xf54e('0x19')](_0x4bd828);}return _0x4b0ee1[_0xf54e('0x1a')](_0x4bd828)[_0xf54e('0x1b')]();};}function respondWithResult(_0x5644aa,_0x331732){_0x331732=_0x331732||0xc8;return function(_0x1bbeaa){if(_0x1bbeaa){return _0x5644aa[_0xf54e('0x1a')](_0x331732)[_0xf54e('0x1c')](_0x1bbeaa);}};}function respondWithFilteredResult(_0x56828e,_0x2366ee){return function(_0x389abc){if(_0x389abc){var _0x3eb415=typeof _0x2366ee['offset']==='undefined'&&typeof _0x2366ee[_0xf54e('0x1d')]===_0xf54e('0x1e');var _0x1c02e7=_0x389abc[_0xf54e('0x1f')];var _0x15cc48=_0x3eb415?0x0:_0x2366ee[_0xf54e('0x20')];var _0x2e27b6=_0x3eb415?_0x389abc[_0xf54e('0x1f')]:_0x2366ee[_0xf54e('0x20')]+_0x2366ee[_0xf54e('0x1d')];var _0x226c96;if(_0x2e27b6>=_0x1c02e7){_0x2e27b6=_0x1c02e7;_0x226c96=0xc8;}else{_0x226c96=0xce;}_0x56828e['status'](_0x226c96);return _0x56828e['set'](_0xf54e('0x21'),_0x15cc48+'-'+_0x2e27b6+'/'+_0x1c02e7)['json'](_0x389abc);}return null;};}function patchUpdates(_0x3e1556){return function(_0x1bfe99){try{jsonpatch[_0xf54e('0x22')](_0x1bfe99,_0x3e1556,!![]);}catch(_0x9903fc){return BPromise[_0xf54e('0x23')](_0x9903fc);}return _0x1bfe99[_0xf54e('0x24')]();};}function saveUpdates(_0x388aa0,_0x11985e){return function(_0x3c0169){if(_0x3c0169){return _0x3c0169[_0xf54e('0x25')](_0x388aa0)[_0xf54e('0x26')](function(_0x5b83df){return _0x5b83df;});}return null;};}function removeEntity(_0x6f6d29,_0x54f914){return function(_0x264a8f){if(_0x264a8f){return _0x264a8f[_0xf54e('0x27')]()[_0xf54e('0x26')](function(){_0x6f6d29[_0xf54e('0x1a')](0xcc)[_0xf54e('0x1b')]();});}};}function handleEntityNotFound(_0x160160,_0x1e08d1){return function(_0x43488d){if(!_0x43488d){_0x160160[_0xf54e('0x19')](0x194);}return _0x43488d;};}function handleError(_0x33457f,_0xf6cdd7){_0xf6cdd7=_0xf6cdd7||0x1f4;return function(_0x39c0ae){logger[_0xf54e('0x28')](_0x39c0ae['stack']);if(_0x39c0ae[_0xf54e('0x29')]){delete _0x39c0ae['name'];}_0x33457f[_0xf54e('0x1a')](_0xf6cdd7)['send'](_0x39c0ae);};}exports[_0xf54e('0x2a')]=function(_0x269f47,_0x21ba00){var _0xa13cd0={'raw':!![],'where':{'id':_0x269f47[_0xf54e('0x2b')]['id']}},_0x25b643={};_0x25b643[_0xf54e('0x2c')]=_['keys'](db['MailApplication'][_0xf54e('0x2d')]);_0x25b643[_0xf54e('0x2e')]=_[_0xf54e('0x2f')](_0x269f47[_0xf54e('0x2e')]);_0x25b643[_0xf54e('0x30')]=_[_0xf54e('0x31')](_0x25b643[_0xf54e('0x2c')],_0x25b643[_0xf54e('0x2e')]);_0xa13cd0[_0xf54e('0x32')]=_[_0xf54e('0x31')](_0x25b643['model'],qs['fields'](_0x269f47[_0xf54e('0x2e')][_0xf54e('0x33')]));_0xa13cd0['attributes']=_0xa13cd0[_0xf54e('0x32')][_0xf54e('0x34')]?_0xa13cd0[_0xf54e('0x32')]:_0x25b643[_0xf54e('0x2c')];if(_0x269f47['query']['includeAll']){_0xa13cd0['include']=[{'all':!![]}];}_0xa13cd0=_[_0xf54e('0x35')]({},_0xa13cd0,_0x269f47[_0xf54e('0x36')]);return db[_0xf54e('0x37')][_0xf54e('0x38')](_0xa13cd0)[_0xf54e('0x26')](handleEntityNotFound(_0x21ba00,null))[_0xf54e('0x26')](respondWithResult(_0x21ba00,null))['catch'](handleError(_0x21ba00,null));};exports['update']=function(_0x530cee,_0xc04e04){if(_0x530cee[_0xf54e('0x39')]['id']){delete _0x530cee['body']['id'];}return db['MailApplication'][_0xf54e('0x38')]({'where':{'id':_0x530cee[_0xf54e('0x2b')]['id']}})[_0xf54e('0x26')](handleEntityNotFound(_0xc04e04,null))['then'](saveUpdates(_0x530cee[_0xf54e('0x39')],null))[_0xf54e('0x26')](respondWithResult(_0xc04e04,null))['catch'](handleError(_0xc04e04,null));};exports[_0xf54e('0x27')]=function(_0x6e5bdf,_0x5af03){return db[_0xf54e('0x37')][_0xf54e('0x38')]({'where':{'id':_0x6e5bdf[_0xf54e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5af03,null))['then'](removeEntity(_0x5af03,null))[_0xf54e('0x3a')](handleError(_0x5af03,null));}; \ No newline at end of file +var _0xe706=['limit','count','offset','set','Content-Range','json','apply','save','update','then','end','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','body','catch','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined'];(function(_0x285fff,_0x4fb54f){var _0x44e78f=function(_0x1b64c8){while(--_0x1b64c8){_0x285fff['push'](_0x285fff['shift']());}};_0x44e78f(++_0x4fb54f);}(_0xe706,0xa3));var _0x6e70=function(_0x4e65cd,_0x13674b){_0x4e65cd=_0x4e65cd-0x0;var _0x524a1c=_0xe706[_0x4e65cd];return _0x524a1c;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];function respondWithStatusCode(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xcc;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x1d')](_0x3b38f3);}return _0x27dd9b[_0x6e70('0x1e')](_0x3b38f3)['end']();};}function respondWithResult(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0xc8;return function(_0x257e81){if(_0x257e81){return _0x52737e['status'](_0x48bc72)['json'](_0x257e81);}};}function respondWithFilteredResult(_0x304716,_0x22c50c){return function(_0x5d9263){if(_0x5d9263){var _0x24f3ac=typeof _0x22c50c['offset']===_0x6e70('0x1f')&&typeof _0x22c50c[_0x6e70('0x20')]==='undefined';var _0x49029f=_0x5d9263[_0x6e70('0x21')];var _0x5ea7a5=_0x24f3ac?0x0:_0x22c50c[_0x6e70('0x22')];var _0x173afe=_0x24f3ac?_0x5d9263['count']:_0x22c50c['offset']+_0x22c50c[_0x6e70('0x20')];var _0x208e21;if(_0x173afe>=_0x49029f){_0x173afe=_0x49029f;_0x208e21=0xc8;}else{_0x208e21=0xce;}_0x304716[_0x6e70('0x1e')](_0x208e21);return _0x304716[_0x6e70('0x23')](_0x6e70('0x24'),_0x5ea7a5+'-'+_0x173afe+'/'+_0x49029f)[_0x6e70('0x25')](_0x5d9263);}return null;};}function patchUpdates(_0x1b2453){return function(_0x44a49f){try{jsonpatch[_0x6e70('0x26')](_0x44a49f,_0x1b2453,!![]);}catch(_0xb29a2a){return BPromise['reject'](_0xb29a2a);}return _0x44a49f[_0x6e70('0x27')]();};}function saveUpdates(_0x344b65,_0x27b294){return function(_0x502b2d){if(_0x502b2d){return _0x502b2d[_0x6e70('0x28')](_0x344b65)[_0x6e70('0x29')](function(_0x3337a6){return _0x3337a6;});}return null;};}function removeEntity(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(_0x538b9c){return _0x538b9c['destroy']()['then'](function(){_0x50da2c[_0x6e70('0x1e')](0xcc)[_0x6e70('0x2a')]();});}};}function handleEntityNotFound(_0x51d292,_0x3ecdf1){return function(_0x1196ed){if(!_0x1196ed){_0x51d292['sendStatus'](0x194);}return _0x1196ed;};}function handleError(_0x338ad6,_0x67fb43){_0x67fb43=_0x67fb43||0x1f4;return function(_0x2bb231){logger['error'](_0x2bb231['stack']);if(_0x2bb231[_0x6e70('0x2b')]){delete _0x2bb231[_0x6e70('0x2b')];}_0x338ad6[_0x6e70('0x1e')](_0x67fb43)[_0x6e70('0x2c')](_0x2bb231);};}exports[_0x6e70('0x2d')]=function(_0x5d772a,_0x1952ea){var _0x406f29={'raw':!![],'where':{'id':_0x5d772a[_0x6e70('0x2e')]['id']}},_0xecf336={};_0xecf336[_0x6e70('0x2f')]=_[_0x6e70('0x30')](db[_0x6e70('0x31')][_0x6e70('0x32')]);_0xecf336[_0x6e70('0x33')]=_[_0x6e70('0x30')](_0x5d772a['query']);_0xecf336[_0x6e70('0x34')]=_['intersection'](_0xecf336[_0x6e70('0x2f')],_0xecf336['query']);_0x406f29[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0xecf336[_0x6e70('0x2f')],qs['fields'](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x37')]));_0x406f29['attributes']=_0x406f29[_0x6e70('0x35')][_0x6e70('0x38')]?_0x406f29['attributes']:_0xecf336[_0x6e70('0x2f')];if(_0x5d772a[_0x6e70('0x33')][_0x6e70('0x39')]){_0x406f29[_0x6e70('0x3a')]=[{'all':!![]}];}_0x406f29=_[_0x6e70('0x3b')]({},_0x406f29,_0x5d772a[_0x6e70('0x3c')]);return db[_0x6e70('0x31')][_0x6e70('0x3d')](_0x406f29)[_0x6e70('0x29')](handleEntityNotFound(_0x1952ea,null))[_0x6e70('0x29')](respondWithResult(_0x1952ea,null))['catch'](handleError(_0x1952ea,null));};exports[_0x6e70('0x28')]=function(_0x4795a0,_0x23cd1a){if(_0x4795a0[_0x6e70('0x3e')]['id']){delete _0x4795a0[_0x6e70('0x3e')]['id'];}return db[_0x6e70('0x31')][_0x6e70('0x3d')]({'where':{'id':_0x4795a0[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x23cd1a,null))[_0x6e70('0x29')](saveUpdates(_0x4795a0[_0x6e70('0x3e')],null))[_0x6e70('0x29')](respondWithResult(_0x23cd1a,null))[_0x6e70('0x3f')](handleError(_0x23cd1a,null));};exports[_0x6e70('0x40')]=function(_0x5594d3,_0x501b53){return db['MailApplication']['find']({'where':{'id':_0x5594d3[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x501b53,null))[_0x6e70('0x29')](removeEntity(_0x501b53,null))[_0x6e70('0x3f')](handleError(_0x501b53,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 3fe86af..dec2a6f 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 _0x0848=['bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x1585f2,_0x3aee02){var _0x1dbf99=function(_0x5a52e0){while(--_0x5a52e0){_0x1585f2['push'](_0x1585f2['shift']());}};_0x1dbf99(++_0x3aee02);}(_0x0848,0x18b));var _0x8084=function(_0x21eeb3,_0x18edf8){_0x21eeb3=_0x21eeb3-0x0;var _0xf66bc3=_0x0848[_0x21eeb3];return _0xf66bc3;};'use strict';var _=require(_0x8084('0x0'));var util=require(_0x8084('0x1'));var logger=require(_0x8084('0x2'))(_0x8084('0x3'));var moment=require(_0x8084('0x4'));var BPromise=require(_0x8084('0x5'));var rp=require(_0x8084('0x6'));var fs=require('fs');var path=require(_0x8084('0x7'));var rimraf=require(_0x8084('0x8'));var config=require(_0x8084('0x9'));var attributes=require(_0x8084('0xa'));module[_0x8084('0xb')]=function(_0x434c69,_0x20061e){return _0x434c69[_0x8084('0xc')](_0x8084('0xd'),attributes,{'tableName':_0x8084('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8084('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0c2d=['exports','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./mailApplication.attributes'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x0c2d,0x171));var _0xd0c2=function(_0x47d706,_0x47d085){_0x47d706=_0x47d706-0x0;var _0x5904b2=_0x0c2d[_0x47d706];return _0x5904b2;};'use strict';var _=require(_0xd0c2('0x0'));var util=require(_0xd0c2('0x1'));var logger=require(_0xd0c2('0x2'))(_0xd0c2('0x3'));var moment=require(_0xd0c2('0x4'));var BPromise=require(_0xd0c2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd0c2('0x6'));var config=require('../../config/environment');var attributes=require(_0xd0c2('0x7'));module[_0xd0c2('0x8')]=function(_0x25a552,_0x10c27b){return _0x25a552[_0xd0c2('0x9')]('MailApplication',attributes,{'tableName':_0xd0c2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd0c2('0xb'),'collate':_0xd0c2('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 12293f3..7ace2a6 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 _0xd75d=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','debug','request\x20sent','stringify','error','MailApplication,\x20%s,\x20%s','message','result','catch','MailApplication','body','options','raw','where','attributes','then','UpdateMailApplication','lodash'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xd75d,0x185));var _0xdd75=function(_0x4480f0,_0x1cefe5){_0x4480f0=_0x4480f0-0x0;var _0x3b2194=_0xd75d[_0x4480f0];return _0x3b2194;};'use strict';var _=require(_0xdd75('0x0'));var util=require(_0xdd75('0x1'));var moment=require(_0xdd75('0x2'));var BPromise=require('bluebird');var rs=require(_0xdd75('0x3'));var fs=require('fs');var Redis=require(_0xdd75('0x4'));var db=require(_0xdd75('0x5'))['db'];var utils=require(_0xdd75('0x6'));var logger=require(_0xdd75('0x7'))(_0xdd75('0x8'));var config=require(_0xdd75('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdd75('0xa')][_0xdd75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6ef64b,_0x93ba82,_0x2c8503){return new BPromise(function(_0x118d1c,_0x50eb4a){return client[_0xdd75('0xc')](_0x6ef64b,_0x2c8503)['then'](function(_0x1ce2f3){logger[_0xdd75('0xd')]('MailApplication,\x20%s,\x20%s',_0x93ba82,'request\x20sent');logger[_0xdd75('0xe')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x93ba82,_0xdd75('0xf'),JSON[_0xdd75('0x10')](_0x1ce2f3));if(_0x1ce2f3['error']){if(_0x1ce2f3[_0xdd75('0x11')]['code']===0x1f4){logger[_0xdd75('0x11')](_0xdd75('0x12'),_0x93ba82,_0x1ce2f3[_0xdd75('0x11')][_0xdd75('0x13')]);return _0x50eb4a(_0x1ce2f3[_0xdd75('0x11')][_0xdd75('0x13')]);}logger[_0xdd75('0x11')]('MailApplication,\x20%s,\x20%s',_0x93ba82,_0x1ce2f3['error'][_0xdd75('0x13')]);return _0x118d1c(_0x1ce2f3[_0xdd75('0x11')][_0xdd75('0x13')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x93ba82,_0xdd75('0xf'));_0x118d1c(_0x1ce2f3[_0xdd75('0x14')][_0xdd75('0x13')]);}})[_0xdd75('0x15')](function(_0x5b7bfc){logger['error'](_0xdd75('0x12'),_0x93ba82,_0x5b7bfc);_0x50eb4a(_0x5b7bfc);});});}exports['UpdateMailApplication']=function(_0x1bfb48){var _0x45f32c=this;return new Promise(function(_0x3e1c63,_0x45c92f){return db[_0xdd75('0x16')]['update'](_0x1bfb48[_0xdd75('0x17')],{'raw':_0x1bfb48[_0xdd75('0x18')]?_0x1bfb48['options'][_0xdd75('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bfb48[_0xdd75('0x18')]?_0x1bfb48[_0xdd75('0x18')][_0xdd75('0x1a')]||null:null,'attributes':_0x1bfb48['options']?_0x1bfb48['options'][_0xdd75('0x1b')]||null:null,'limit':_0x1bfb48[_0xdd75('0x18')]?_0x1bfb48['options']['limit']||null:null})[_0xdd75('0x1c')](function(_0x2374c4){logger[_0xdd75('0xd')]('UpdateMailApplication',_0x1bfb48);logger['debug'](_0xdd75('0x1d'),_0x1bfb48,JSON[_0xdd75('0x10')](_0x2374c4));_0x3e1c63(_0x2374c4);})[_0xdd75('0x15')](function(_0x37a51a){logger[_0xdd75('0x11')](_0xdd75('0x1d'),_0x37a51a[_0xdd75('0x13')],_0x1bfb48);_0x45c92f(_0x45f32c[_0xdd75('0x11')](0x1f4,_0x37a51a['message']));});});}; \ No newline at end of file +var _0xb5a6=['../../config/logger','jayson/promise','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','options','attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x444c10,_0x1aa154){var _0x3b49c5=function(_0x726f53){while(--_0x726f53){_0x444c10['push'](_0x444c10['shift']());}};_0x3b49c5(++_0x1aa154);}(_0xb5a6,0x159));var _0x6b5a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xb5a6[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x6b5a('0x0'));var util=require(_0x6b5a('0x1'));var moment=require('moment');var BPromise=require(_0x6b5a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b5a('0x3'));var db=require(_0x6b5a('0x4'))['db'];var utils=require(_0x6b5a('0x5'));var logger=require(_0x6b5a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6b5a('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13761c,_0x592a84,_0x240081){return new BPromise(function(_0x15e0c6,_0x391d67){return client[_0x6b5a('0x8')](_0x13761c,_0x240081)[_0x6b5a('0x9')](function(_0x1af2f0){logger[_0x6b5a('0xa')](_0x6b5a('0xb'),_0x592a84,_0x6b5a('0xc'));logger[_0x6b5a('0xd')](_0x6b5a('0xe'),_0x592a84,_0x6b5a('0xc'),JSON[_0x6b5a('0xf')](_0x1af2f0));if(_0x1af2f0[_0x6b5a('0x10')]){if(_0x1af2f0[_0x6b5a('0x10')][_0x6b5a('0x11')]===0x1f4){logger[_0x6b5a('0x10')](_0x6b5a('0xb'),_0x592a84,_0x1af2f0['error'][_0x6b5a('0x12')]);return _0x391d67(_0x1af2f0[_0x6b5a('0x10')][_0x6b5a('0x12')]);}logger['error'](_0x6b5a('0xb'),_0x592a84,_0x1af2f0[_0x6b5a('0x10')]['message']);return _0x15e0c6(_0x1af2f0['error'][_0x6b5a('0x12')]);}else{logger[_0x6b5a('0xa')](_0x6b5a('0xb'),_0x592a84,_0x6b5a('0xc'));_0x15e0c6(_0x1af2f0[_0x6b5a('0x13')][_0x6b5a('0x12')]);}})[_0x6b5a('0x14')](function(_0x4c70f8){logger[_0x6b5a('0x10')](_0x6b5a('0xb'),_0x592a84,_0x4c70f8);_0x391d67(_0x4c70f8);});});}exports[_0x6b5a('0x15')]=function(_0x40d29a){var _0x10bba3=this;return new Promise(function(_0x26a6c6,_0x260946){return db[_0x6b5a('0x16')][_0x6b5a('0x17')](_0x40d29a['body'],{'raw':_0x40d29a[_0x6b5a('0x18')]?_0x40d29a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40d29a[_0x6b5a('0x18')]?_0x40d29a[_0x6b5a('0x18')]['where']||null:null,'attributes':_0x40d29a['options']?_0x40d29a[_0x6b5a('0x18')][_0x6b5a('0x19')]||null:null,'limit':_0x40d29a[_0x6b5a('0x18')]?_0x40d29a[_0x6b5a('0x18')][_0x6b5a('0x1a')]||null:null})['then'](function(_0x505a74){logger[_0x6b5a('0xa')](_0x6b5a('0x15'),_0x40d29a);logger['debug'](_0x6b5a('0x15'),_0x40d29a,JSON[_0x6b5a('0xf')](_0x505a74));_0x26a6c6(_0x505a74);})['catch'](function(_0x1642c5){logger[_0x6b5a('0x10')]('UpdateMailApplication',_0x1642c5['message'],_0x40d29a);_0x260946(_0x10bba3[_0x6b5a('0x10')](0x1f4,_0x1642c5[_0x6b5a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 42c8f3b..3728820 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 _0x5c4b=['mailinteraction:destroy','/:id/tags','removeTags','exports','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','tracked','mail','mailinteraction:addtags','put','mailinteraction:update','update','delete'];(function(_0x5b6744,_0x49c9c2){var _0x43d97a=function(_0x55633e){while(--_0x55633e){_0x5b6744['push'](_0x5b6744['shift']());}};_0x43d97a(++_0x49c9c2);}(_0x5c4b,0xa0));var _0xb5c4=function(_0xfdf145,_0x58a334){_0xfdf145=_0xfdf145-0x0;var _0x14fe53=_0x5c4b[_0xfdf145];return _0x14fe53;};'use strict';var express=require('express');var router=express[_0xb5c4('0x0')]();var auth=require(_0xb5c4('0x1'));var interaction=require(_0xb5c4('0x2'));var controller=require(_0xb5c4('0x3'));router[_0xb5c4('0x4')]('/',auth[_0xb5c4('0x5')](),controller[_0xb5c4('0x6')]);router['get']('/describe',auth[_0xb5c4('0x5')](),controller['describe']);router[_0xb5c4('0x4')](_0xb5c4('0x7'),auth[_0xb5c4('0x5')](),controller[_0xb5c4('0x8')]);router[_0xb5c4('0x4')](_0xb5c4('0x9'),auth[_0xb5c4('0x5')](),controller[_0xb5c4('0xa')]);router[_0xb5c4('0x4')](_0xb5c4('0xb'),auth['isAuthenticated'](),controller[_0xb5c4('0xc')]);router[_0xb5c4('0xd')]('/',auth[_0xb5c4('0x5')](),controller[_0xb5c4('0xe')]);router[_0xb5c4('0xd')](_0xb5c4('0x9'),auth[_0xb5c4('0x5')](),controller['addMessage']);router['post']('/:id/tags',auth[_0xb5c4('0x5')](),interaction[_0xb5c4('0xf')](_0xb5c4('0x10'),_0xb5c4('0x11')),controller['addTags']);router[_0xb5c4('0x12')](_0xb5c4('0x7'),auth[_0xb5c4('0x5')](),interaction[_0xb5c4('0xf')](_0xb5c4('0x10'),_0xb5c4('0x13')),controller[_0xb5c4('0x14')]);router[_0xb5c4('0x15')]('/:id',auth['isAuthenticated'](),interaction[_0xb5c4('0xf')](_0xb5c4('0x10'),_0xb5c4('0x16')),controller['destroy']);router[_0xb5c4('0x15')](_0xb5c4('0x17'),auth['isAuthenticated'](),controller[_0xb5c4('0x18')]);module[_0xb5c4('0x19')]=router; \ No newline at end of file +var _0x4bb2=['express','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','update','delete','mailinteraction:destroy','removeTags','exports'];(function(_0x4ee698,_0x4b588f){var _0x503343=function(_0x385a5){while(--_0x385a5){_0x4ee698['push'](_0x4ee698['shift']());}};_0x503343(++_0x4b588f);}(_0x4bb2,0xa2));var _0x24bb=function(_0x25efe3,_0x3cf34a){_0x25efe3=_0x25efe3-0x0;var _0x4249d0=_0x4bb2[_0x25efe3];return _0x4249d0;};'use strict';var express=require(_0x24bb('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x24bb('0x1'));var controller=require(_0x24bb('0x2'));router['get']('/',auth[_0x24bb('0x3')](),controller['index']);router[_0x24bb('0x4')](_0x24bb('0x5'),auth[_0x24bb('0x3')](),controller[_0x24bb('0x6')]);router['get'](_0x24bb('0x7'),auth[_0x24bb('0x3')](),controller[_0x24bb('0x8')]);router[_0x24bb('0x4')](_0x24bb('0x9'),auth[_0x24bb('0x3')](),controller[_0x24bb('0xa')]);router[_0x24bb('0x4')](_0x24bb('0xb'),auth['isAuthenticated'](),controller[_0x24bb('0xc')]);router['post']('/',auth[_0x24bb('0x3')](),controller[_0x24bb('0xd')]);router[_0x24bb('0xe')]('/:id/messages',auth['isAuthenticated'](),controller[_0x24bb('0xf')]);router[_0x24bb('0xe')](_0x24bb('0x10'),auth[_0x24bb('0x3')](),interaction[_0x24bb('0x11')](_0x24bb('0x12'),_0x24bb('0x13')),controller[_0x24bb('0x14')]);router[_0x24bb('0x15')](_0x24bb('0x7'),auth[_0x24bb('0x3')](),interaction['tracked'](_0x24bb('0x12'),'mailinteraction:update'),controller[_0x24bb('0x16')]);router[_0x24bb('0x17')](_0x24bb('0x7'),auth[_0x24bb('0x3')](),interaction[_0x24bb('0x11')]('mail',_0x24bb('0x18')),controller['destroy']);router['delete'](_0x24bb('0x10'),auth[_0x24bb('0x3')](),controller[_0x24bb('0x19')]);module[_0x24bb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 3a4c7a5..0ff85f4 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 _0xf267=['BOOLEAN','DATE','STRING','TEXT','long','out','INTEGER','sequelize','exports'];(function(_0x524849,_0x4d419c){var _0x5643fb=function(_0x5abf2b){while(--_0x5abf2b){_0x524849['push'](_0x524849['shift']());}};_0x5643fb(++_0x4d419c);}(_0xf267,0xf1));var _0x7f26=function(_0x19494d,_0x563cff){_0x19494d=_0x19494d-0x0;var _0x35f654=_0xf267[_0x19494d];return _0x35f654;};'use strict';var Sequelize=require(_0x7f26('0x0'));var iconv=require('iconv');module[_0x7f26('0x1')]={'closed':{'type':Sequelize[_0x7f26('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7f26('0x3')]},'disposition':{'type':Sequelize[_0x7f26('0x4')]},'secondDisposition':{'type':Sequelize[_0x7f26('0x4')]},'thirdDisposition':{'type':Sequelize[_0x7f26('0x4')]},'note':{'type':Sequelize[_0x7f26('0x4')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x7f26('0x4')]},'cc':{'type':Sequelize[_0x7f26('0x5')](_0x7f26('0x6'))},'subject':{'type':Sequelize[_0x7f26('0x5')]()},'attach':{'type':Sequelize[_0x7f26('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x7f26('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x7f26('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x7f26('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7f26('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7f26('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7f26('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7f26('0x8')]}}; \ No newline at end of file +var _0x388c=['DATE','STRING','TEXT','out','ENUM','INTEGER','sequelize','BOOLEAN'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x388c,0x8e));var _0xc388=function(_0x39941c,_0x4ad1bb){_0x39941c=_0x39941c-0x0;var _0x52d9c7=_0x388c[_0x39941c];return _0x52d9c7;};'use strict';var Sequelize=require(_0xc388('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0xc388('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc388('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc388('0x3')]},'thirdDisposition':{'type':Sequelize[_0xc388('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xc388('0x4')]('long')},'subject':{'type':Sequelize[_0xc388('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xc388('0x2')]},'substatus':{'type':Sequelize[_0xc388('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xc388('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xc388('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc388('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xc388('0x6')]('in',_0xc388('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc388('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index a532483..767ee47 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 _0x1aac=['model','attributes','fields','length','includeAll','include','merge','create','body','find','destroy','addMessage','MailMessage','ids','omit','getMessages','rawAttributes','nolimit','sort','where','pick','MailInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','rows','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','join','root','files','tmp','server','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','subject','get','mkdirSync','from','missing.recipient@your.company.com','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','attachments','readFileSync','writeFileSync','unlinkSync','rimraf','zip-dir','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','stack','name','send','index','map','getOptions','findAll','mail','query','catch','show','params','keys','MailInteraction','filters','intersection'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x1aac,0x1ef));var _0xc1aa=function(_0x38f915,_0x1f037f){_0x38f915=_0x38f915-0x0;var _0x22e924=_0x1aac[_0x38f915];return _0x22e924;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1aa('0x0'));var zipdir=require(_0xc1aa('0x1'));var moment=require(_0xc1aa('0x2'));var BPromise=require('bluebird');var util=require(_0xc1aa('0x3'));var path=require(_0xc1aa('0x4'));var fs=require('fs');var _=require(_0xc1aa('0x5'));var juice=require('juice');var Redis=require(_0xc1aa('0x6'));var interaction=require(_0xc1aa('0x7'));var qs=require(_0xc1aa('0x8'));var logger=require(_0xc1aa('0x9'))(_0xc1aa('0xa'));var config=require(_0xc1aa('0xb'));var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config[_0xc1aa('0xc')]=_[_0xc1aa('0xd')](config[_0xc1aa('0xc')],{'host':_0xc1aa('0xe'),'port':0x18eb});var socket=require(_0xc1aa('0xf'))(new Redis(config['redis']));require(_0xc1aa('0x10'))[_0xc1aa('0x11')](socket);function respondWithStatusCode(_0x3e5509,_0x83b044){_0x83b044=_0x83b044||0xcc;return function(_0x2cc251){if(_0x2cc251){return _0x3e5509[_0xc1aa('0x12')](_0x83b044);}return _0x3e5509[_0xc1aa('0x13')](_0x83b044)[_0xc1aa('0x14')]();};}function respondWithResult(_0x15a5d6,_0x83e4ea){_0x83e4ea=_0x83e4ea||0xc8;return function(_0x372c98){if(_0x372c98){return _0x15a5d6[_0xc1aa('0x13')](_0x83e4ea)[_0xc1aa('0x15')](_0x372c98);}};}function respondWithFilteredResult(_0x45e2b6,_0x34f2ee){return function(_0x58f2f7){if(_0x58f2f7){var _0x332ab9=typeof _0x34f2ee[_0xc1aa('0x16')]===_0xc1aa('0x17')&&typeof _0x34f2ee[_0xc1aa('0x18')]===_0xc1aa('0x17');var _0x41bbbb=_0x58f2f7[_0xc1aa('0x19')];var _0x48ffad=_0x332ab9?0x0:_0x34f2ee['offset'];var _0x10c59a=_0x332ab9?_0x58f2f7['count']:_0x34f2ee[_0xc1aa('0x16')]+_0x34f2ee[_0xc1aa('0x18')];var _0x2d92d1;if(_0x10c59a>=_0x41bbbb){_0x10c59a=_0x41bbbb;_0x2d92d1=0xc8;}else{_0x2d92d1=0xce;}_0x45e2b6[_0xc1aa('0x13')](_0x2d92d1);return _0x45e2b6['set'](_0xc1aa('0x1a'),_0x48ffad+'-'+_0x10c59a+'/'+_0x41bbbb)[_0xc1aa('0x15')](_0x58f2f7);}return null;};}function saveUpdates(_0x508813){return function(_0x251a7a){if(_0x251a7a){return _0x251a7a[_0xc1aa('0x1b')](_0x508813)[_0xc1aa('0x1c')](function(_0x269775){return _0x269775;});}return null;};}function removeEntity(_0x254bbd){return function(_0x3c45f8){if(_0x3c45f8){return _0x3c45f8['destroy']()['then'](function(){_0x254bbd[_0xc1aa('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x281eac){return function(_0x2b268c){if(!_0x2b268c){_0x281eac['sendStatus'](0x194);}return _0x2b268c;};}function handleError(_0x5cf2b0,_0x2d1630){_0x2d1630=_0x2d1630||0x1f4;return function(_0x12e69a){logger['error'](_0x12e69a[_0xc1aa('0x1d')]);if(_0x12e69a[_0xc1aa('0x1e')]){delete _0x12e69a['name'];}_0x5cf2b0['status'](_0x2d1630)[_0xc1aa('0x1f')](_0x12e69a);};}exports[_0xc1aa('0x20')]=function(_0x50dc71,_0x313b6e){var _0x3c9e03={};var _0x21adb8=_[_0xc1aa('0x21')](db['MailInteraction']['rawAttributes'],function(_0x1f03bd){return{'name':_0x1f03bd['fieldName'],'type':_0x1f03bd['type']['key']};});_0x3c9e03=qs[_0xc1aa('0x22')](_0x21adb8,_0x50dc71);return interaction[_0xc1aa('0x23')](_0xc1aa('0x24'),_0x50dc71[_0xc1aa('0x25')],_0x50dc71['user'],_0x3c9e03,_0x21adb8)['then'](respondWithFilteredResult(_0x313b6e,_0x3c9e03))[_0xc1aa('0x26')](handleError(_0x313b6e,null));};exports[_0xc1aa('0x27')]=function(_0x3ca811,_0x6b594b){var _0xe557ed={'raw':![],'where':{'id':_0x3ca811[_0xc1aa('0x28')]['id']}},_0xaebe58={};_0xaebe58['model']=_[_0xc1aa('0x29')](db[_0xc1aa('0x2a')]['rawAttributes']);_0xaebe58[_0xc1aa('0x25')]=_[_0xc1aa('0x29')](_0x3ca811[_0xc1aa('0x25')]);_0xaebe58[_0xc1aa('0x2b')]=_[_0xc1aa('0x2c')](_0xaebe58[_0xc1aa('0x2d')],_0xaebe58[_0xc1aa('0x25')]);_0xe557ed[_0xc1aa('0x2e')]=_[_0xc1aa('0x2c')](_0xaebe58[_0xc1aa('0x2d')],qs[_0xc1aa('0x2f')](_0x3ca811[_0xc1aa('0x25')][_0xc1aa('0x2f')]));_0xe557ed[_0xc1aa('0x2e')]=_0xe557ed[_0xc1aa('0x2e')][_0xc1aa('0x30')]?_0xe557ed[_0xc1aa('0x2e')]:_0xaebe58[_0xc1aa('0x2d')];if(_0x3ca811[_0xc1aa('0x25')][_0xc1aa('0x31')]){_0xe557ed[_0xc1aa('0x32')]=[{'all':!![]}];}_0xe557ed=_[_0xc1aa('0x33')]({},_0xe557ed,_0x3ca811['options']);return db[_0xc1aa('0x2a')]['find'](_0xe557ed)[_0xc1aa('0x1c')](handleEntityNotFound(_0x6b594b,null))[_0xc1aa('0x1c')](respondWithResult(_0x6b594b,null))[_0xc1aa('0x26')](handleError(_0x6b594b,null));};exports[_0xc1aa('0x34')]=function(_0x451d57,_0x5253f6){return db[_0xc1aa('0x2a')][_0xc1aa('0x34')](_0x451d57['body'],{})[_0xc1aa('0x1c')](respondWithResult(_0x5253f6,0xc9))[_0xc1aa('0x26')](handleError(_0x5253f6,null));};exports[_0xc1aa('0x1b')]=function(_0x612965,_0x201be8){if(_0x612965[_0xc1aa('0x35')]['id']){delete _0x612965['body']['id'];}return db['MailInteraction'][_0xc1aa('0x36')]({'where':{'id':_0x612965[_0xc1aa('0x28')]['id']}})[_0xc1aa('0x1c')](handleEntityNotFound(_0x201be8,null))[_0xc1aa('0x1c')](saveUpdates(_0x612965[_0xc1aa('0x35')],null))[_0xc1aa('0x1c')](respondWithResult(_0x201be8,null))[_0xc1aa('0x26')](handleError(_0x201be8,null));};exports[_0xc1aa('0x37')]=function(_0x4eca97,_0x70695c){return db['MailInteraction'][_0xc1aa('0x36')]({'where':{'id':_0x4eca97[_0xc1aa('0x28')]['id']}})[_0xc1aa('0x1c')](handleEntityNotFound(_0x70695c,null))['then'](removeEntity(_0x70695c,null))['catch'](handleError(_0x70695c,null));};exports['describe']=function(_0xe8e493,_0x1d8414){return db['MailInteraction']['describe']()['then'](respondWithResult(_0x1d8414,null))[_0xc1aa('0x26')](handleError(_0x1d8414,null));};exports[_0xc1aa('0x38')]=function(_0x45e675,_0x18ba7a){return db[_0xc1aa('0x39')][_0xc1aa('0x36')]({'where':{'id':_0x45e675[_0xc1aa('0x28')]['id']}})[_0xc1aa('0x1c')](handleEntityNotFound(_0x18ba7a,null))[_0xc1aa('0x1c')](function(_0x43ba4c){if(_0x43ba4c){return _0x43ba4c[_0xc1aa('0x38')](_0x45e675['body'][_0xc1aa('0x3a')],_[_0xc1aa('0x3b')](_0x45e675[_0xc1aa('0x35')],['ids','id'])||{});}})[_0xc1aa('0x1c')](respondWithResult(_0x18ba7a,null))[_0xc1aa('0x26')](handleError(_0x18ba7a,null));};exports[_0xc1aa('0x3c')]=function(_0x3a7fd4,_0x3b36bf){var _0x48a572={'raw':![],'where':{}};var _0x25bc8b={};var _0xcdd9d4={'count':0x0,'rows':[]};return db[_0xc1aa('0x2a')]['findOne']({'where':{'id':_0x3a7fd4['params']['id']}})[_0xc1aa('0x1c')](handleEntityNotFound(_0x3b36bf,null))[_0xc1aa('0x1c')](function(_0x1a81b7){if(_0x1a81b7){_0x25bc8b[_0xc1aa('0x2d')]=_[_0xc1aa('0x29')](db['MailMessage'][_0xc1aa('0x3d')]);_0x25bc8b[_0xc1aa('0x25')]=_[_0xc1aa('0x29')](_0x3a7fd4[_0xc1aa('0x25')]);_0x25bc8b[_0xc1aa('0x2b')]=_[_0xc1aa('0x2c')](_0x25bc8b[_0xc1aa('0x2d')],_0x25bc8b[_0xc1aa('0x25')]);_0x48a572[_0xc1aa('0x2e')]=_[_0xc1aa('0x2c')](_0x25bc8b[_0xc1aa('0x2d')],qs[_0xc1aa('0x2f')](_0x3a7fd4[_0xc1aa('0x25')]['fields']));_0x48a572[_0xc1aa('0x2e')]=_0x48a572[_0xc1aa('0x2e')][_0xc1aa('0x30')]?_0x48a572[_0xc1aa('0x2e')]:_0x25bc8b[_0xc1aa('0x2d')];if(!_0x3a7fd4[_0xc1aa('0x25')]['hasOwnProperty'](_0xc1aa('0x3e'))){_0x48a572[_0xc1aa('0x18')]=qs['limit'](_0x3a7fd4[_0xc1aa('0x25')][_0xc1aa('0x18')]);_0x48a572[_0xc1aa('0x16')]=qs['offset'](_0x3a7fd4[_0xc1aa('0x25')][_0xc1aa('0x16')]);}_0x48a572['order']=qs[_0xc1aa('0x3f')](_0x3a7fd4[_0xc1aa('0x25')][_0xc1aa('0x3f')]);_0x48a572[_0xc1aa('0x40')]=qs['filters'](_[_0xc1aa('0x41')](_0x3a7fd4[_0xc1aa('0x25')],_0x25bc8b['filters']));_0x48a572[_0xc1aa('0x40')][_0xc1aa('0x42')]=_0x1a81b7['id'];if(_0x3a7fd4[_0xc1aa('0x25')][_0xc1aa('0x43')]){_0x48a572[_0xc1aa('0x40')]=_['merge'](_0x48a572[_0xc1aa('0x40')],{'$or':_[_0xc1aa('0x21')](_0x48a572[_0xc1aa('0x2e')],function(_0x252393){var _0x1e3fb2={};_0x1e3fb2[_0x252393]={'$like':'%'+_0x3a7fd4[_0xc1aa('0x25')][_0xc1aa('0x43')]+'%'};return _0x1e3fb2;})});}if(_0x3a7fd4[_0xc1aa('0x25')][_0xc1aa('0x44')]){var _0x29aa7b=_0x3a7fd4[_0xc1aa('0x25')][_0xc1aa('0x44')]['split'](',');var _0xd101d8={};_0xd101d8[_0x29aa7b[0x0]]={'$gte':moment(_0x29aa7b[0x1])[_0xc1aa('0x45')](_0xc1aa('0x46'))};_0x48a572[_0xc1aa('0x40')]=_[_0xc1aa('0x33')](_0x48a572[_0xc1aa('0x40')],_0xd101d8);}_0x48a572=_['merge']({},_0x48a572,_0x3a7fd4['options']);return db[_0xc1aa('0x39')][_0xc1aa('0x19')]({'where':_0x48a572['where']})[_0xc1aa('0x1c')](function(_0x26cab9){_0xcdd9d4[_0xc1aa('0x19')]=_0x26cab9;if(_0x3a7fd4[_0xc1aa('0x25')][_0xc1aa('0x31')]){_0x48a572['include']=[{'all':!![]}];}return db[_0xc1aa('0x39')]['findAll'](_0x48a572);})['then'](function(_0x42b12c){if(_0x3a7fd4[_0xc1aa('0x25')][_0xc1aa('0x47')]===_0xc1aa('0x48')){for(var _0x3bba4b=0x0;_0x3bba4b<_0x42b12c[_0xc1aa('0x30')];_0x3bba4b++){_0x42b12c[_0x3bba4b][_0xc1aa('0x35')]=juice(_0x42b12c[_0x3bba4b]['body']);}}_0xcdd9d4[_0xc1aa('0x49')]=_0x42b12c;return _0xcdd9d4;});}})[_0xc1aa('0x1c')](respondWithFilteredResult(_0x3b36bf,_0x48a572))[_0xc1aa('0x26')](handleError(_0x3b36bf,null));};exports[_0xc1aa('0x4a')]=function(_0x5cdd20,_0x32dcaa){return db[_0xc1aa('0x2a')][_0xc1aa('0x36')]({'where':{'id':_0x5cdd20[_0xc1aa('0x28')]['id']}})[_0xc1aa('0x1c')](handleEntityNotFound(_0x32dcaa,null))['then'](function(_0x5f2b2e){if(_0x5f2b2e){return _0x5f2b2e[_0xc1aa('0x4b')](_0x5cdd20['body'][_0xc1aa('0x3a')],_['omit'](_0x5cdd20[_0xc1aa('0x35')],[_0xc1aa('0x3a'),'id'])||{})[_0xc1aa('0x4c')](function(){return db[_0xc1aa('0x4d')]['findAll']({'attributes':['id',_0xc1aa('0x1e'),_0xc1aa('0x4e')],'where':{'id':_0x5cdd20[_0xc1aa('0x35')][_0xc1aa('0x3a')]}});})['then'](function(_0x52d400){socket[_0xc1aa('0x4f')](_0xc1aa('0x50'),{'id':Number(_0x5cdd20[_0xc1aa('0x28')]['id']),'tags':_0x52d400||[]});return{'id':Number(_0x5cdd20[_0xc1aa('0x28')]['id']),'tags':_0x52d400||[]};});}})[_0xc1aa('0x1c')](respondWithResult(_0x32dcaa,null))[_0xc1aa('0x26')](handleError(_0x32dcaa,null));};exports['removeTags']=function(_0x2ac1be,_0x83d6cb){return db[_0xc1aa('0x2a')][_0xc1aa('0x36')]({'where':{'id':_0x2ac1be[_0xc1aa('0x28')]['id']}})[_0xc1aa('0x1c')](handleEntityNotFound(_0x83d6cb,null))[_0xc1aa('0x1c')](function(_0x18998a){if(_0x18998a){return _0x18998a[_0xc1aa('0x51')](_0x2ac1be[_0xc1aa('0x25')][_0xc1aa('0x3a')]);}})[_0xc1aa('0x1c')](respondWithStatusCode(_0x83d6cb,null))[_0xc1aa('0x26')](handleError(_0x83d6cb,null));};exports[_0xc1aa('0x52')]=function(_0x1c7b58,_0x11bb74){var _0x3d224d=moment()['unix']()['toString']();var _0x3a9635=path[_0xc1aa('0x53')](config[_0xc1aa('0x54')],'server',_0xc1aa('0x55'),_0xc1aa('0x56'));var _0x198749=path[_0xc1aa('0x53')](config[_0xc1aa('0x54')],_0xc1aa('0x57'),'files','attachments');var _0x53250a=path[_0xc1aa('0x53')](_0x3a9635,_0x3d224d);var _0x4efb7b=util['format'](_0xc1aa('0x58'),_0x1c7b58['params']['id'],_0x3d224d);var _0x56c716=path[_0xc1aa('0x53')](_0x3a9635,_0x4efb7b);var _0x292002=[];if(_0x1c7b58[_0xc1aa('0x25')]['attachments']){_0x292002[_0xc1aa('0x59')]({'model':db[_0xc1aa('0x5a')],'as':_0xc1aa('0x5b'),'raw':!![]});}var _0x5a18d8=[{'model':db[_0xc1aa('0x39')],'as':_0xc1aa('0x5c'),'attributes':['id',_0xc1aa('0x35'),'from','to','cc','bcc',_0xc1aa('0x5d'),'createdAt'],'where':{'secret':![]},'order':qs[_0xc1aa('0x3f')]('id'),'include':_0x292002}];return db[_0xc1aa('0x2a')][_0xc1aa('0x36')]({'where':{'id':_0x1c7b58[_0xc1aa('0x28')]['id']},'include':_0x5a18d8})[_0xc1aa('0x1c')](handleEntityNotFound(_0x11bb74,null))[_0xc1aa('0x1c')](function(_0x2c5848){if(_0x2c5848&&_0x2c5848[_0xc1aa('0x5c')]){var _0x21c6b9=_0x2c5848[_0xc1aa('0x5e')]({'plain':!![]});fs[_0xc1aa('0x5f')](_0x53250a);return BPromise['each'](_0x21c6b9['Messages'],function(_0x37b064,_0x1b13a3){var _0x2b84af={'from':_0x37b064[_0xc1aa('0x60')],'to':_0x37b064['to']||_0xc1aa('0x61'),'subject':_0x37b064['subject'],'html':htmlEntities['decode'](_0x37b064[_0xc1aa('0x35')]),'headers':{'Date':moment(_0x37b064[_0xc1aa('0x62')])['format'](_0xc1aa('0x63'))},'attachments':[]};if(_0x37b064['cc']){_0x2b84af[_0xc1aa('0x64')]['Cc']=_0x37b064['cc'];}if(_0x37b064[_0xc1aa('0x65')]){_0x2b84af[_0xc1aa('0x64')][_0xc1aa('0x66')]=_0x37b064[_0xc1aa('0x65')];}return new BPromise(function(_0x1b9c6b,_0x17538b){if(_0x37b064[_0xc1aa('0x5b')]){for(var _0x4944b8=0x0;_0x4944b8<_0x37b064[_0xc1aa('0x5b')][_0xc1aa('0x30')];_0x4944b8++){var _0x19981d=_0x37b064['Attachments'][_0x4944b8];var _0x4586b2=path[_0xc1aa('0x53')](_0x198749,_0x19981d[_0xc1aa('0x67')]);if(fs['existsSync'](_0x4586b2)){_0x2b84af[_0xc1aa('0x68')][_0xc1aa('0x59')]({'name':_0x19981d[_0xc1aa('0x1e')],'contentType':_0x19981d['type'],'data':fs[_0xc1aa('0x69')](_0x4586b2)});}}}emlformat['build'](_0x2b84af,function(_0x5c6a03,_0x120f93){if(_0x5c6a03)return _0x17538b(_0x5c6a03);fs[_0xc1aa('0x6a')](path[_0xc1aa('0x53')](_0x53250a,util[_0xc1aa('0x45')]('message%d.eml',_0x1b13a3)),_0x120f93);return _0x1b9c6b(_0x120f93);});});})[_0xc1aa('0x1c')](function(){return new BPromise(function(_0x3b5491,_0x13b7ec){zipdir(_0x53250a,{'saveTo':_0x56c716},function(_0x1d8558,_0x4cc882){if(_0x1d8558)return _0x13b7ec(_0x1d8558);return _0x3b5491(_0x4cc882);});})[_0xc1aa('0x1c')](function(){return new BPromise(function(_0x445503,_0x408a1f){rimraf(_0x53250a,function(_0x2cf2a8){if(_0x2cf2a8)_0x408a1f(_0x2cf2a8);return _0x445503();});});})[_0xc1aa('0x1c')](function(){return _0x11bb74[_0xc1aa('0x52')](_0x56c716,_0x4efb7b,function(_0x3cccf7){if(!_0x3cccf7)fs[_0xc1aa('0x6b')](_0x56c716);});});});}else{return _0x11bb74[_0xc1aa('0x12')](0xc8);}})['catch'](handleError(_0x11bb74,null));}; \ No newline at end of file +var _0x325f=['existsSync','name','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','moment','bluebird','util','path','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','end','error','stack','send','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','query','user','catch','show','params','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','MailMessage','ids','getMessages','findOne','keys','hasOwnProperty','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','rows','setTags','omit','spread','Tag','color','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','createdAt','get','mkdirSync','each','from','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename'];(function(_0x11bce2,_0x322e2a){var _0x1993a4=function(_0x4deacf){while(--_0x4deacf){_0x11bce2['push'](_0x11bce2['shift']());}};_0x1993a4(++_0x322e2a);}(_0x325f,0x1cf));var _0xf325=function(_0x4b997a,_0x5e9fcd){_0x4b997a=_0x4b997a-0x0;var _0x58fd5d=_0x325f[_0x4b997a];return _0x58fd5d;};'use strict';var emlformat=require(_0xf325('0x0'));var rimraf=require(_0xf325('0x1'));var zipdir=require('zip-dir');var moment=require(_0xf325('0x2'));var BPromise=require(_0xf325('0x3'));var util=require(_0xf325('0x4'));var path=require(_0xf325('0x5'));var fs=require('fs');var _=require(_0xf325('0x6'));var juice=require(_0xf325('0x7'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xf325('0x8'));var logger=require(_0xf325('0x9'))(_0xf325('0xa'));var config=require(_0xf325('0xb'));var db=require(_0xf325('0xc'))['db'];var htmlEntities=require('html-entities');config[_0xf325('0xd')]=_['defaults'](config[_0xf325('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xf325('0xe'))(new Redis(config[_0xf325('0xd')]));require(_0xf325('0xf'))[_0xf325('0x10')](socket);function respondWithStatusCode(_0x3c98e7,_0x437083){_0x437083=_0x437083||0xcc;return function(_0x3b482e){if(_0x3b482e){return _0x3c98e7[_0xf325('0x11')](_0x437083);}return _0x3c98e7['status'](_0x437083)['end']();};}function respondWithResult(_0x4bec88,_0x35e2f3){_0x35e2f3=_0x35e2f3||0xc8;return function(_0x45ece9){if(_0x45ece9){return _0x4bec88[_0xf325('0x12')](_0x35e2f3)[_0xf325('0x13')](_0x45ece9);}};}function respondWithFilteredResult(_0x5cb832,_0x39841d){return function(_0x3fc35e){if(_0x3fc35e){var _0x4dc784=typeof _0x39841d['offset']===_0xf325('0x14')&&typeof _0x39841d[_0xf325('0x15')]===_0xf325('0x14');var _0xafe9a8=_0x3fc35e[_0xf325('0x16')];var _0x239593=_0x4dc784?0x0:_0x39841d[_0xf325('0x17')];var _0x238d82=_0x4dc784?_0x3fc35e[_0xf325('0x16')]:_0x39841d[_0xf325('0x17')]+_0x39841d['limit'];var _0x5ae61e;if(_0x238d82>=_0xafe9a8){_0x238d82=_0xafe9a8;_0x5ae61e=0xc8;}else{_0x5ae61e=0xce;}_0x5cb832['status'](_0x5ae61e);return _0x5cb832[_0xf325('0x18')](_0xf325('0x19'),_0x239593+'-'+_0x238d82+'/'+_0xafe9a8)[_0xf325('0x13')](_0x3fc35e);}return null;};}function saveUpdates(_0xc28ed9){return function(_0x3f90f0){if(_0x3f90f0){return _0x3f90f0[_0xf325('0x1a')](_0xc28ed9)[_0xf325('0x1b')](function(_0x4926e6){return _0x4926e6;});}return null;};}function removeEntity(_0x1b5ac9){return function(_0x52ce14){if(_0x52ce14){return _0x52ce14[_0xf325('0x1c')]()[_0xf325('0x1b')](function(){_0x1b5ac9['status'](0xcc)[_0xf325('0x1d')]();});}};}function handleEntityNotFound(_0x18b960){return function(_0x958224){if(!_0x958224){_0x18b960[_0xf325('0x11')](0x194);}return _0x958224;};}function handleError(_0x2617bf,_0x148bac){_0x148bac=_0x148bac||0x1f4;return function(_0x3c6dcc){logger[_0xf325('0x1e')](_0x3c6dcc[_0xf325('0x1f')]);if(_0x3c6dcc['name']){delete _0x3c6dcc['name'];}_0x2617bf['status'](_0x148bac)[_0xf325('0x20')](_0x3c6dcc);};}exports['index']=function(_0x5cd274,_0x12a681){var _0x5bd192={};var _0x33c1ce=_[_0xf325('0x21')](db[_0xf325('0x22')][_0xf325('0x23')],function(_0x4451e9){return{'name':_0x4451e9[_0xf325('0x24')],'type':_0x4451e9[_0xf325('0x25')][_0xf325('0x26')]};});_0x5bd192=qs[_0xf325('0x27')](_0x33c1ce,_0x5cd274);return interaction['findAll']('mail',_0x5cd274[_0xf325('0x28')],_0x5cd274[_0xf325('0x29')],_0x5bd192,_0x33c1ce)[_0xf325('0x1b')](respondWithFilteredResult(_0x12a681,_0x5bd192))[_0xf325('0x2a')](handleError(_0x12a681,null));};exports[_0xf325('0x2b')]=function(_0x41b0cb,_0x172df9){var _0x432eaa={'raw':![],'where':{'id':_0x41b0cb[_0xf325('0x2c')]['id']}},_0x4863a9={};_0x4863a9['model']=_['keys'](db[_0xf325('0x22')][_0xf325('0x23')]);_0x4863a9[_0xf325('0x28')]=_['keys'](_0x41b0cb['query']);_0x4863a9[_0xf325('0x2d')]=_[_0xf325('0x2e')](_0x4863a9[_0xf325('0x2f')],_0x4863a9[_0xf325('0x28')]);_0x432eaa[_0xf325('0x30')]=_['intersection'](_0x4863a9[_0xf325('0x2f')],qs['fields'](_0x41b0cb['query'][_0xf325('0x31')]));_0x432eaa['attributes']=_0x432eaa[_0xf325('0x30')][_0xf325('0x32')]?_0x432eaa[_0xf325('0x30')]:_0x4863a9['model'];if(_0x41b0cb[_0xf325('0x28')][_0xf325('0x33')]){_0x432eaa[_0xf325('0x34')]=[{'all':!![]}];}_0x432eaa=_[_0xf325('0x35')]({},_0x432eaa,_0x41b0cb[_0xf325('0x36')]);return db[_0xf325('0x22')][_0xf325('0x37')](_0x432eaa)[_0xf325('0x1b')](handleEntityNotFound(_0x172df9,null))['then'](respondWithResult(_0x172df9,null))['catch'](handleError(_0x172df9,null));};exports[_0xf325('0x38')]=function(_0x5d45e7,_0x43a040){return db[_0xf325('0x22')][_0xf325('0x38')](_0x5d45e7[_0xf325('0x39')],{})[_0xf325('0x1b')](respondWithResult(_0x43a040,0xc9))[_0xf325('0x2a')](handleError(_0x43a040,null));};exports[_0xf325('0x1a')]=function(_0x3c0121,_0x22438a){if(_0x3c0121[_0xf325('0x39')]['id']){delete _0x3c0121['body']['id'];}return db[_0xf325('0x22')][_0xf325('0x37')]({'where':{'id':_0x3c0121['params']['id']}})[_0xf325('0x1b')](handleEntityNotFound(_0x22438a,null))[_0xf325('0x1b')](saveUpdates(_0x3c0121[_0xf325('0x39')],null))[_0xf325('0x1b')](respondWithResult(_0x22438a,null))[_0xf325('0x2a')](handleError(_0x22438a,null));};exports[_0xf325('0x1c')]=function(_0x3ff533,_0x3df746){return db['MailInteraction'][_0xf325('0x37')]({'where':{'id':_0x3ff533['params']['id']}})[_0xf325('0x1b')](handleEntityNotFound(_0x3df746,null))[_0xf325('0x1b')](removeEntity(_0x3df746,null))[_0xf325('0x2a')](handleError(_0x3df746,null));};exports[_0xf325('0x3a')]=function(_0x2f3c3f,_0x2cb9d0){return db['MailInteraction']['describe']()[_0xf325('0x1b')](respondWithResult(_0x2cb9d0,null))[_0xf325('0x2a')](handleError(_0x2cb9d0,null));};exports[_0xf325('0x3b')]=function(_0x261dc2,_0x4a3c77){return db[_0xf325('0x3c')][_0xf325('0x37')]({'where':{'id':_0x261dc2[_0xf325('0x2c')]['id']}})[_0xf325('0x1b')](handleEntityNotFound(_0x4a3c77,null))[_0xf325('0x1b')](function(_0x5697c4){if(_0x5697c4){return _0x5697c4[_0xf325('0x3b')](_0x261dc2[_0xf325('0x39')][_0xf325('0x3d')],_['omit'](_0x261dc2['body'],[_0xf325('0x3d'),'id'])||{});}})[_0xf325('0x1b')](respondWithResult(_0x4a3c77,null))[_0xf325('0x2a')](handleError(_0x4a3c77,null));};exports[_0xf325('0x3e')]=function(_0x5c585f,_0x8e0730){var _0x15491a={'raw':![],'where':{}};var _0x2bd178={};var _0x453068={'count':0x0,'rows':[]};return db[_0xf325('0x22')][_0xf325('0x3f')]({'where':{'id':_0x5c585f[_0xf325('0x2c')]['id']}})[_0xf325('0x1b')](handleEntityNotFound(_0x8e0730,null))[_0xf325('0x1b')](function(_0x2731a5){if(_0x2731a5){_0x2bd178['model']=_[_0xf325('0x40')](db[_0xf325('0x3c')][_0xf325('0x23')]);_0x2bd178['query']=_[_0xf325('0x40')](_0x5c585f[_0xf325('0x28')]);_0x2bd178[_0xf325('0x2d')]=_[_0xf325('0x2e')](_0x2bd178[_0xf325('0x2f')],_0x2bd178[_0xf325('0x28')]);_0x15491a[_0xf325('0x30')]=_[_0xf325('0x2e')](_0x2bd178[_0xf325('0x2f')],qs[_0xf325('0x31')](_0x5c585f[_0xf325('0x28')][_0xf325('0x31')]));_0x15491a['attributes']=_0x15491a['attributes'][_0xf325('0x32')]?_0x15491a[_0xf325('0x30')]:_0x2bd178[_0xf325('0x2f')];if(!_0x5c585f[_0xf325('0x28')][_0xf325('0x41')]('nolimit')){_0x15491a['limit']=qs[_0xf325('0x15')](_0x5c585f[_0xf325('0x28')]['limit']);_0x15491a[_0xf325('0x17')]=qs['offset'](_0x5c585f['query'][_0xf325('0x17')]);}_0x15491a['order']=qs[_0xf325('0x42')](_0x5c585f['query'][_0xf325('0x42')]);_0x15491a[_0xf325('0x43')]=qs[_0xf325('0x2d')](_[_0xf325('0x44')](_0x5c585f[_0xf325('0x28')],_0x2bd178[_0xf325('0x2d')]));_0x15491a[_0xf325('0x43')][_0xf325('0x45')]=_0x2731a5['id'];if(_0x5c585f['query'][_0xf325('0x46')]){_0x15491a[_0xf325('0x43')]=_[_0xf325('0x35')](_0x15491a[_0xf325('0x43')],{'$or':_['map'](_0x15491a[_0xf325('0x30')],function(_0x1bad6d){var _0x177fee={};_0x177fee[_0x1bad6d]={'$like':'%'+_0x5c585f[_0xf325('0x28')]['filter']+'%'};return _0x177fee;})});}if(_0x5c585f[_0xf325('0x28')][_0xf325('0x47')]){var _0x5e7b15=_0x5c585f[_0xf325('0x28')][_0xf325('0x47')][_0xf325('0x48')](',');var _0x585d71={};_0x585d71[_0x5e7b15[0x0]]={'$gte':moment(_0x5e7b15[0x1])[_0xf325('0x49')](_0xf325('0x4a'))};_0x15491a[_0xf325('0x43')]=_[_0xf325('0x35')](_0x15491a[_0xf325('0x43')],_0x585d71);}_0x15491a=_[_0xf325('0x35')]({},_0x15491a,_0x5c585f['options']);return db[_0xf325('0x3c')][_0xf325('0x16')]({'where':_0x15491a[_0xf325('0x43')]})[_0xf325('0x1b')](function(_0x1c8066){_0x453068['count']=_0x1c8066;if(_0x5c585f[_0xf325('0x28')]['includeAll']){_0x15491a[_0xf325('0x34')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x15491a);})['then'](function(_0x3cd4da){if(_0x5c585f['query']['inlineCss']===_0xf325('0x4b')){for(var _0x1b8ec7=0x0;_0x1b8ec7<_0x3cd4da[_0xf325('0x32')];_0x1b8ec7++){_0x3cd4da[_0x1b8ec7]['body']=juice(_0x3cd4da[_0x1b8ec7]['body']);}}_0x453068[_0xf325('0x4c')]=_0x3cd4da;return _0x453068;});}})[_0xf325('0x1b')](respondWithFilteredResult(_0x8e0730,_0x15491a))['catch'](handleError(_0x8e0730,null));};exports['addTags']=function(_0xe8c662,_0x14b76d){return db['MailInteraction'][_0xf325('0x37')]({'where':{'id':_0xe8c662[_0xf325('0x2c')]['id']}})[_0xf325('0x1b')](handleEntityNotFound(_0x14b76d,null))['then'](function(_0x41aea7){if(_0x41aea7){return _0x41aea7[_0xf325('0x4d')](_0xe8c662['body'][_0xf325('0x3d')],_[_0xf325('0x4e')](_0xe8c662[_0xf325('0x39')],[_0xf325('0x3d'),'id'])||{})[_0xf325('0x4f')](function(){return db[_0xf325('0x50')]['findAll']({'attributes':['id','name',_0xf325('0x51')],'where':{'id':_0xe8c662[_0xf325('0x39')]['ids']}});})['then'](function(_0x5de9fa){socket['emit'](_0xf325('0x52'),{'id':Number(_0xe8c662['params']['id']),'tags':_0x5de9fa||[]});return{'id':Number(_0xe8c662[_0xf325('0x2c')]['id']),'tags':_0x5de9fa||[]};});}})[_0xf325('0x1b')](respondWithResult(_0x14b76d,null))[_0xf325('0x2a')](handleError(_0x14b76d,null));};exports[_0xf325('0x53')]=function(_0x273988,_0x5c0a79){return db['MailInteraction']['find']({'where':{'id':_0x273988['params']['id']}})[_0xf325('0x1b')](handleEntityNotFound(_0x5c0a79,null))[_0xf325('0x1b')](function(_0x31a5c2){if(_0x31a5c2){return _0x31a5c2[_0xf325('0x53')](_0x273988[_0xf325('0x28')]['ids']);}})['then'](respondWithStatusCode(_0x5c0a79,null))['catch'](handleError(_0x5c0a79,null));};exports[_0xf325('0x54')]=function(_0x406dd3,_0x366913){var _0x5ceba1=moment()[_0xf325('0x55')]()[_0xf325('0x56')]();var _0x2fa1ad=path[_0xf325('0x57')](config[_0xf325('0x58')],_0xf325('0x59'),_0xf325('0x5a'),'tmp');var _0x33148f=path[_0xf325('0x57')](config[_0xf325('0x58')],_0xf325('0x59'),'files',_0xf325('0x5b'));var _0x12faac=path[_0xf325('0x57')](_0x2fa1ad,_0x5ceba1);var _0x5034e0=util[_0xf325('0x49')](_0xf325('0x5c'),_0x406dd3['params']['id'],_0x5ceba1);var _0x27461f=path['join'](_0x2fa1ad,_0x5034e0);var _0x2bdebf=[];if(_0x406dd3['query'][_0xf325('0x5b')]){_0x2bdebf['push']({'model':db[_0xf325('0x5d')],'as':_0xf325('0x5e'),'raw':!![]});}var _0xaf1f7e=[{'model':db[_0xf325('0x3c')],'as':_0xf325('0x5f'),'attributes':['id',_0xf325('0x39'),'from','to','cc',_0xf325('0x60'),_0xf325('0x61'),_0xf325('0x62')],'where':{'secret':![]},'order':qs[_0xf325('0x42')]('id'),'include':_0x2bdebf}];return db['MailInteraction'][_0xf325('0x37')]({'where':{'id':_0x406dd3[_0xf325('0x2c')]['id']},'include':_0xaf1f7e})[_0xf325('0x1b')](handleEntityNotFound(_0x366913,null))[_0xf325('0x1b')](function(_0x1ed173){if(_0x1ed173&&_0x1ed173[_0xf325('0x5f')]){var _0x3a5aa5=_0x1ed173[_0xf325('0x63')]({'plain':!![]});fs[_0xf325('0x64')](_0x12faac);return BPromise[_0xf325('0x65')](_0x3a5aa5[_0xf325('0x5f')],function(_0x2d522f,_0x1bb37b){var _0x2d9518={'from':_0x2d522f[_0xf325('0x66')],'to':_0x2d522f['to']||_0xf325('0x67'),'subject':_0x2d522f[_0xf325('0x61')],'html':htmlEntities['decode'](_0x2d522f[_0xf325('0x39')]),'headers':{'Date':moment(_0x2d522f['createdAt'])[_0xf325('0x49')](_0xf325('0x68'))},'attachments':[]};if(_0x2d522f['cc']){_0x2d9518['headers']['Cc']=_0x2d522f['cc'];}if(_0x2d522f[_0xf325('0x60')]){_0x2d9518[_0xf325('0x69')]['Bcc']=_0x2d522f[_0xf325('0x60')];}return new BPromise(function(_0x5f2dcd,_0x4f6e38){if(_0x2d522f[_0xf325('0x5e')]){for(var _0x4a0fa7=0x0;_0x4a0fa7<_0x2d522f[_0xf325('0x5e')][_0xf325('0x32')];_0x4a0fa7++){var _0x1b3cfe=_0x2d522f['Attachments'][_0x4a0fa7];var _0x11e900=path[_0xf325('0x57')](_0x33148f,_0x1b3cfe[_0xf325('0x6a')]);if(fs[_0xf325('0x6b')](_0x11e900)){_0x2d9518[_0xf325('0x5b')]['push']({'name':_0x1b3cfe[_0xf325('0x6c')],'contentType':_0x1b3cfe['type'],'data':fs[_0xf325('0x6d')](_0x11e900)});}}}emlformat[_0xf325('0x6e')](_0x2d9518,function(_0x3da042,_0x11704f){if(_0x3da042)return _0x4f6e38(_0x3da042);fs[_0xf325('0x6f')](path['join'](_0x12faac,util[_0xf325('0x49')](_0xf325('0x70'),_0x1bb37b)),_0x11704f);return _0x5f2dcd(_0x11704f);});});})['then'](function(){return new BPromise(function(_0x5c6d27,_0x186640){zipdir(_0x12faac,{'saveTo':_0x27461f},function(_0xb42986,_0x3c616d){if(_0xb42986)return _0x186640(_0xb42986);return _0x5c6d27(_0x3c616d);});})[_0xf325('0x1b')](function(){return new BPromise(function(_0x1a4d2e,_0x599fa7){rimraf(_0x12faac,function(_0x3bebdd){if(_0x3bebdd)_0x599fa7(_0x3bebdd);return _0x1a4d2e();});});})[_0xf325('0x1b')](function(){return _0x366913[_0xf325('0x54')](_0x27461f,_0x5034e0,function(_0x2e0863){if(!_0x2e0863)fs[_0xf325('0x71')](_0x27461f);});});});}else{return _0x366913[_0xf325('0x11')](0xc8);}})[_0xf325('0x2a')](handleError(_0x366913,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 6ebc26b..6d4e2d1 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 _0xbedb=['setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','then'];(function(_0x44b19b,_0x5d33cc){var _0x2d7858=function(_0x3b87ed){while(--_0x3b87ed){_0x44b19b['push'](_0x44b19b['shift']());}};_0x2d7858(++_0x5d33cc);}(_0xbedb,0x82));var _0xbbed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbedb[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xbbed('0x0'));var MailInteraction=require(_0xbbed('0x1'))['db'][_0xbbed('0x2')];var MailMessage=require(_0xbbed('0x1'))['db'][_0xbbed('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xbbed('0x4')](0x0);var events={'afterCreate':_0xbbed('0x5'),'afterUpdate':_0xbbed('0x6'),'afterDestroy':_0xbbed('0x7')};function emitEvent(_0x556a10){return function(_0x340f8d,_0x1fee03,_0x11506e){_0x340f8d[_0xbbed('0x8')]({'attributes':['id'],'raw':!![]})[_0xbbed('0x9')](function(_0x5f55b5){_0x340f8d[_0xbbed('0xa')](_0xbbed('0xb'),_0x5f55b5[_0xbbed('0xc')](function(_0x5b0ae3){return{'id':_0x5b0ae3['id']};}));return MailMessage[_0xbbed('0xd')]({'where':{'MailInteractionId':_0x340f8d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbbed('0x9')](function(_0x3478d2){_0x340f8d[_0xbbed('0xa')](_0xbbed('0xe'),_0x3478d2[_0xbbed('0xf')]);MailInteractionEvents[_0xbbed('0x10')](_0x556a10+':'+_0x340f8d['id'],_0x340f8d);MailInteractionEvents[_0xbbed('0x10')](_0x556a10,_0x340f8d);_0x11506e(null);})[_0xbbed('0x11')](_0x11506e(null));};}for(var e in events){if(events[_0xbbed('0x12')](e)){var event=events[e];MailInteraction[_0xbbed('0x13')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x8563=['update','remove','setDataValue','Users','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','save'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x8563,0xdb));var _0x3856=function(_0x17898e,_0x107361){_0x17898e=_0x17898e-0x0;var _0x79d444=_0x8563[_0x17898e];return _0x79d444;};'use strict';var EventEmitter=require(_0x3856('0x0'));var MailInteraction=require(_0x3856('0x1'))['db'][_0x3856('0x2')];var MailMessage=require(_0x3856('0x1'))['db'][_0x3856('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3856('0x4'),'afterUpdate':_0x3856('0x5'),'afterDestroy':_0x3856('0x6')};function emitEvent(_0x461e88){return function(_0x45ef21,_0x2cc0ca,_0x2d95e3){_0x45ef21['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x294a5f){_0x45ef21[_0x3856('0x7')](_0x3856('0x8'),_0x294a5f['map'](function(_0x5a8117){return{'id':_0x5a8117['id']};}));return MailMessage[_0x3856('0x9')]({'where':{'MailInteractionId':_0x45ef21['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x358bcc){_0x45ef21['setDataValue'](_0x3856('0xa'),_0x358bcc[_0x3856('0xb')]);MailInteractionEvents[_0x3856('0xc')](_0x461e88+':'+_0x45ef21['id'],_0x45ef21);MailInteractionEvents[_0x3856('0xc')](_0x461e88,_0x45ef21);_0x2d95e3(null);})['catch'](_0x2d95e3(null));};}for(var e in events){if(events[_0x3856('0xd')](e)){var event=events[e];MailInteraction[_0x3856('0xe')](e,emitEvent(event));}}module[_0x3856('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index c46efed..eb53d14 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 _0xcc55=['catch','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','substatusAt','closed','models','get','MailMessage','update','then'];(function(_0x225fd0,_0x1d2603){var _0x3337ab=function(_0x1a90e2){while(--_0x1a90e2){_0x225fd0['push'](_0x225fd0['shift']());}};_0x3337ab(++_0x1d2603);}(_0xcc55,0x1a6));var _0x5cc5=function(_0xc79dda,_0x3b29c2){_0xc79dda=_0xc79dda-0x0;var _0x5e2d76=_0xcc55[_0xc79dda];return _0x5e2d76;};'use strict';var _=require(_0x5cc5('0x0'));var util=require(_0x5cc5('0x1'));var logger=require(_0x5cc5('0x2'))(_0x5cc5('0x3'));var moment=require(_0x5cc5('0x4'));var BPromise=require(_0x5cc5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5cc5('0x6'));var rimraf=require(_0x5cc5('0x7'));var config=require(_0x5cc5('0x8'));var attributes=require(_0x5cc5('0x9'));module[_0x5cc5('0xa')]=function(_0x1f7dea,_0x350123){return _0x1f7dea['define'](_0x5cc5('0xb'),attributes,{'tableName':_0x5cc5('0xc'),'paranoid':![],'indexes':[{'name':_0x5cc5('0xd'),'fields':[_0x5cc5('0xe'),'to'],'type':_0x5cc5('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1b5051,_0x4c93e3,_0x49d3f4){if(_0x1b5051[_0x5cc5('0x10')]){_0x1b5051['substatusAt']=moment()[_0x5cc5('0x11')](_0x5cc5('0x12'));}if(_0x1b5051['closed']){_0x1b5051[_0x5cc5('0x13')]=moment()['format'](_0x5cc5('0x12'));}_0x49d3f4(null,_0x4c93e3);},'beforeUpdate':function(_0x2c7030,_0x22fb12,_0x58ebdd){if(_0x2c7030[_0x5cc5('0x14')](_0x5cc5('0x10'))){_0x2c7030[_0x5cc5('0x15')]=_0x2c7030[_0x5cc5('0x10')]?moment()[_0x5cc5('0x11')](_0x5cc5('0x12')):null;}if(_0x2c7030[_0x5cc5('0x14')](_0x5cc5('0x16'))){_0x2c7030[_0x5cc5('0x13')]=moment()[_0x5cc5('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c7030[_0x5cc5('0x10')]=null;_0x2c7030[_0x5cc5('0x15')]=null;}_0x58ebdd(null,_0x2c7030);},'afterUpdate':function(_0x18c78e,_0x4d45e9,_0x5909e2){var _0x1d1514=_0x1f7dea[_0x5cc5('0x17')];var _0x34c13e=_0x18c78e[_0x5cc5('0x18')]({'plain':!![]});if(_0x34c13e[_0x5cc5('0x16')]){return _0x1d1514[_0x5cc5('0x19')][_0x5cc5('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x34c13e['id']}})[_0x5cc5('0x1b')](function(){_0x5909e2();})[_0x5cc5('0x1c')](function(_0x248e99){_0x5909e2(_0x248e99);});}else{_0x5909e2();}}},'charset':_0x5cc5('0x1d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5b46=['get','MailMessage','update','then','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','fti_mail_interactions','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','substatusAt','models'];(function(_0x33f671,_0xbb4c5d){var _0xb14a7a=function(_0x540913){while(--_0x540913){_0x33f671['push'](_0x33f671['shift']());}};_0xb14a7a(++_0xbb4c5d);}(_0x5b46,0x149));var _0x65b4=function(_0x184f4a,_0x5922e8){_0x184f4a=_0x184f4a-0x0;var _0x340fba=_0x5b46[_0x184f4a];return _0x340fba;};'use strict';var _=require(_0x65b4('0x0'));var util=require(_0x65b4('0x1'));var logger=require(_0x65b4('0x2'))(_0x65b4('0x3'));var moment=require(_0x65b4('0x4'));var BPromise=require(_0x65b4('0x5'));var rp=require(_0x65b4('0x6'));var fs=require('fs');var path=require(_0x65b4('0x7'));var rimraf=require(_0x65b4('0x8'));var config=require(_0x65b4('0x9'));var attributes=require(_0x65b4('0xa'));module[_0x65b4('0xb')]=function(_0x33608f,_0x2ac6f8){return _0x33608f[_0x65b4('0xc')]('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x65b4('0xd'),'fields':['subject','to'],'type':_0x65b4('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x261131,_0xfa0ca3,_0xb604a7){if(_0x261131[_0x65b4('0xf')]){_0x261131['substatusAt']=moment()[_0x65b4('0x10')](_0x65b4('0x11'));}if(_0x261131['closed']){_0x261131[_0x65b4('0x12')]=moment()[_0x65b4('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0xb604a7(null,_0xfa0ca3);},'beforeUpdate':function(_0x331540,_0x2cdfd8,_0x21c3b0){if(_0x331540[_0x65b4('0x13')](_0x65b4('0xf'))){_0x331540[_0x65b4('0x14')]=_0x331540[_0x65b4('0xf')]?moment()[_0x65b4('0x10')](_0x65b4('0x11')):null;}if(_0x331540[_0x65b4('0x13')]('closed')){_0x331540[_0x65b4('0x12')]=moment()[_0x65b4('0x10')](_0x65b4('0x11'));_0x331540[_0x65b4('0xf')]=null;_0x331540['substatusAt']=null;}_0x21c3b0(null,_0x331540);},'afterUpdate':function(_0x412270,_0x5d34bd,_0x353e4b){var _0x559412=_0x33608f[_0x65b4('0x15')];var _0x3f5a76=_0x412270[_0x65b4('0x16')]({'plain':!![]});if(_0x3f5a76['closed']){return _0x559412[_0x65b4('0x17')][_0x65b4('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x3f5a76['id']}})[_0x65b4('0x19')](function(){_0x353e4b();})['catch'](function(_0x5073b3){_0x353e4b(_0x5073b3);});}else{_0x353e4b();}}},'charset':_0x65b4('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 2f380a6..cdec2a2 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 _0x0221=['http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','UpdateMailInteraction','MailInteraction','update','options','where','attributes','limit','AddTagsToMailInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','client'];(function(_0x535c93,_0x241c3e){var _0x652cee=function(_0x4e5209){while(--_0x4e5209){_0x535c93['push'](_0x535c93['shift']());}};_0x652cee(++_0x241c3e);}(_0x0221,0xc5));var _0x1022=function(_0x3affd4,_0x4b79d2){_0x3affd4=_0x3affd4-0x0;var _0x587bc8=_0x0221[_0x3affd4];return _0x587bc8;};'use strict';var _=require(_0x1022('0x0'));var util=require(_0x1022('0x1'));var moment=require(_0x1022('0x2'));var BPromise=require(_0x1022('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1022('0x4'));var db=require(_0x1022('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1022('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1022('0x7')][_0x1022('0x8')]({'port':0x232a});config[_0x1022('0x9')]=_[_0x1022('0xa')](config[_0x1022('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x1022('0xb'))(new Redis(config[_0x1022('0x9')]));require(_0x1022('0xc'))[_0x1022('0xd')](socket);function respondWithRpcPromise(_0x29d740,_0x61e470,_0x4976f5){return new BPromise(function(_0x3179d6,_0x455c43){return client[_0x1022('0xe')](_0x29d740,_0x4976f5)[_0x1022('0xf')](function(_0x37ee1a){logger[_0x1022('0x10')](_0x1022('0x11'),_0x61e470,'request\x20sent');logger[_0x1022('0x12')](_0x1022('0x13'),_0x61e470,'request\x20sent',JSON[_0x1022('0x14')](_0x37ee1a));if(_0x37ee1a[_0x1022('0x15')]){if(_0x37ee1a[_0x1022('0x15')]['code']===0x1f4){logger[_0x1022('0x15')]('MailInteraction,\x20%s,\x20%s',_0x61e470,_0x37ee1a[_0x1022('0x15')][_0x1022('0x16')]);return _0x455c43(_0x37ee1a[_0x1022('0x15')][_0x1022('0x16')]);}logger[_0x1022('0x15')](_0x1022('0x11'),_0x61e470,_0x37ee1a[_0x1022('0x15')][_0x1022('0x16')]);return _0x3179d6(_0x37ee1a['error']['message']);}else{logger[_0x1022('0x10')](_0x1022('0x11'),_0x61e470,_0x1022('0x17'));_0x3179d6(_0x37ee1a[_0x1022('0x18')][_0x1022('0x16')]);}})[_0x1022('0x19')](function(_0x2a1740){logger['error'](_0x1022('0x11'),_0x61e470,_0x2a1740);_0x455c43(_0x2a1740);});});}exports[_0x1022('0x1a')]=function(_0x449b40){var _0x135b28=this;return new Promise(function(_0x12a7e5,_0x6f73f9){return db[_0x1022('0x1b')][_0x1022('0x1c')](_0x449b40['body'],{'raw':_0x449b40['options']?_0x449b40[_0x1022('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x449b40[_0x1022('0x1d')]?_0x449b40['options'][_0x1022('0x1e')]||null:null,'attributes':_0x449b40[_0x1022('0x1d')]?_0x449b40[_0x1022('0x1d')][_0x1022('0x1f')]||null:null,'limit':_0x449b40[_0x1022('0x1d')]?_0x449b40['options'][_0x1022('0x20')]||null:null})[_0x1022('0xf')](function(_0x59c4ce){logger[_0x1022('0x10')](_0x1022('0x1a'),_0x449b40);logger['debug'](_0x1022('0x1a'),_0x449b40,JSON[_0x1022('0x14')](_0x59c4ce));_0x12a7e5(_0x59c4ce);})[_0x1022('0x19')](function(_0x28d142){logger[_0x1022('0x15')](_0x1022('0x1a'),_0x28d142['message'],_0x449b40);_0x6f73f9(_0x135b28[_0x1022('0x15')](0x1f4,_0x28d142[_0x1022('0x16')]));});});};exports[_0x1022('0x21')]=function(_0x5eb331){return new Promise(function(_0x3a8a44,_0x29e213){return db[_0x1022('0x1b')][_0x1022('0x22')]({'where':_0x5eb331[_0x1022('0x1d')]?_0x5eb331[_0x1022('0x1d')][_0x1022('0x1e')]||null:null})[_0x1022('0xf')](function(_0x2c31af){if(_0x2c31af){return _0x2c31af[_0x1022('0x23')](_0x5eb331[_0x1022('0x24')][_0x1022('0x25')],_[_0x1022('0x26')](_0x5eb331['body'],['ids','id'])||{});}})[_0x1022('0x27')](function(_0x43f8e5){logger[_0x1022('0x10')](_0x1022('0x28'),_0x5eb331);logger['debug']('AddTags',_0x5eb331,JSON[_0x1022('0x14')](_0x43f8e5));_0x3a8a44(_0x43f8e5);})['catch'](function(_0x412bf4){logger['error'](_0x1022('0x28'),_0x412bf4[_0x1022('0x16')],_0x5eb331);_0x29e213(_this['error'](0x1f4,_0x412bf4[_0x1022('0x16')]));});});}; \ No newline at end of file +var _0x69a0=['../../config/logger','jayson/promise','client','http','defaults','redis','localhost','./mailInteraction.socket','register','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','MailInteraction','body','options','raw','where','attributes','limit','UpdateMailInteraction','stringify','ids','omit','spread','AddTags','lodash','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1570a9,_0x83a6b){var _0x2af35c=function(_0x5da49d){while(--_0x5da49d){_0x1570a9['push'](_0x1570a9['shift']());}};_0x2af35c(++_0x83a6b);}(_0x69a0,0x181));var _0x069a=function(_0x338c58,_0x125310){_0x338c58=_0x338c58-0x0;var _0x2112d4=_0x69a0[_0x338c58];return _0x2112d4;};'use strict';var _=require(_0x069a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x069a('0x1'));var fs=require('fs');var Redis=require(_0x069a('0x2'));var db=require(_0x069a('0x3'))['db'];var utils=require(_0x069a('0x4'));var logger=require(_0x069a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x069a('0x6'));var client=jayson[_0x069a('0x7')][_0x069a('0x8')]({'port':0x232a});config['redis']=_[_0x069a('0x9')](config[_0x069a('0xa')],{'host':_0x069a('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x069a('0xa')]));require(_0x069a('0xc'))[_0x069a('0xd')](socket);function respondWithRpcPromise(_0x405114,_0x12aa2b,_0x2ce22c){return new BPromise(function(_0x4548af,_0x1de0ba){return client[_0x069a('0xe')](_0x405114,_0x2ce22c)[_0x069a('0xf')](function(_0x4c0480){logger[_0x069a('0x10')]('MailInteraction,\x20%s,\x20%s',_0x12aa2b,_0x069a('0x11'));logger[_0x069a('0x12')](_0x069a('0x13'),_0x12aa2b,_0x069a('0x11'),JSON['stringify'](_0x4c0480));if(_0x4c0480['error']){if(_0x4c0480[_0x069a('0x14')][_0x069a('0x15')]===0x1f4){logger[_0x069a('0x14')](_0x069a('0x16'),_0x12aa2b,_0x4c0480[_0x069a('0x14')][_0x069a('0x17')]);return _0x1de0ba(_0x4c0480[_0x069a('0x14')][_0x069a('0x17')]);}logger[_0x069a('0x14')](_0x069a('0x16'),_0x12aa2b,_0x4c0480[_0x069a('0x14')][_0x069a('0x17')]);return _0x4548af(_0x4c0480['error']['message']);}else{logger[_0x069a('0x10')](_0x069a('0x16'),_0x12aa2b,_0x069a('0x11'));_0x4548af(_0x4c0480[_0x069a('0x18')][_0x069a('0x17')]);}})[_0x069a('0x19')](function(_0x333aa3){logger[_0x069a('0x14')](_0x069a('0x16'),_0x12aa2b,_0x333aa3);_0x1de0ba(_0x333aa3);});});}exports['UpdateMailInteraction']=function(_0x63ca6a){var _0x49ef46=this;return new Promise(function(_0xd92ac,_0xd69a3){return db[_0x069a('0x1a')]['update'](_0x63ca6a[_0x069a('0x1b')],{'raw':_0x63ca6a['options']?_0x63ca6a[_0x069a('0x1c')][_0x069a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x63ca6a[_0x069a('0x1c')]?_0x63ca6a[_0x069a('0x1c')][_0x069a('0x1e')]||null:null,'attributes':_0x63ca6a['options']?_0x63ca6a[_0x069a('0x1c')][_0x069a('0x1f')]||null:null,'limit':_0x63ca6a[_0x069a('0x1c')]?_0x63ca6a[_0x069a('0x1c')][_0x069a('0x20')]||null:null})['then'](function(_0x4a14e6){logger[_0x069a('0x10')](_0x069a('0x21'),_0x63ca6a);logger[_0x069a('0x12')](_0x069a('0x21'),_0x63ca6a,JSON[_0x069a('0x22')](_0x4a14e6));_0xd92ac(_0x4a14e6);})[_0x069a('0x19')](function(_0xc8d40d){logger['error'](_0x069a('0x21'),_0xc8d40d[_0x069a('0x17')],_0x63ca6a);_0xd69a3(_0x49ef46[_0x069a('0x14')](0x1f4,_0xc8d40d[_0x069a('0x17')]));});});};exports['AddTagsToMailInteraction']=function(_0x34926c){return new Promise(function(_0x1207b4,_0x37d88a){return db['MailInteraction']['find']({'where':_0x34926c[_0x069a('0x1c')]?_0x34926c['options'][_0x069a('0x1e')]||null:null})[_0x069a('0xf')](function(_0x4d61e4){if(_0x4d61e4){return _0x4d61e4['addTags'](_0x34926c[_0x069a('0x1b')][_0x069a('0x23')],_[_0x069a('0x24')](_0x34926c[_0x069a('0x1b')],[_0x069a('0x23'),'id'])||{});}})[_0x069a('0x25')](function(_0x16f0f7){logger['info'](_0x069a('0x26'),_0x34926c);logger[_0x069a('0x12')](_0x069a('0x26'),_0x34926c,JSON['stringify'](_0x16f0f7));_0x1207b4(_0x16f0f7);})[_0x069a('0x19')](function(_0x421c0d){logger[_0x069a('0x14')](_0x069a('0x26'),_0x421c0d[_0x069a('0x17')],_0x34926c);_0x37d88a(_this[_0x069a('0x14')](0x1f4,_0x421c0d[_0x069a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 877fca5..da4c111 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 _0x37f6=['update','removeListener','length','./mailInteraction.events','save','remove'];(function(_0x1f519b,_0x28e59d){var _0x33460f=function(_0x37760d){while(--_0x37760d){_0x1f519b['push'](_0x1f519b['shift']());}};_0x33460f(++_0x28e59d);}(_0x37f6,0x1d1));var _0x637f=function(_0x4d18c2,_0x9b85d0){_0x4d18c2=_0x4d18c2-0x0;var _0x1cadf9=_0x37f6[_0x4d18c2];return _0x1cadf9;};'use strict';var MailInteractionEvents=require(_0x637f('0x0'));var events=[_0x637f('0x1'),_0x637f('0x2'),_0x637f('0x3')];function createListener(_0x9748ec,_0x1957f4){return function(_0x1cfb6c){_0x1957f4['emit'](_0x9748ec,_0x1cfb6c);};}function removeListener(_0x3f97f9,_0x402b60){return function(){MailInteractionEvents[_0x637f('0x4')](_0x3f97f9,_0x402b60);};}exports['register']=function(_0x37be54){for(var _0x1c5cae=0x0,_0x1ce4e4=events[_0x637f('0x5')];_0x1c5cae<_0x1ce4e4;_0x1c5cae++){var _0x5a1100=events[_0x1c5cae];var _0x188e71=createListener('mailInteraction:'+_0x5a1100,_0x37be54);MailInteractionEvents['on'](_0x5a1100,_0x188e71);}}; \ No newline at end of file +var _0x7dde=['./mailInteraction.events','save','register','length','mailInteraction:'];(function(_0x1bee7d,_0x346017){var _0x1d7881=function(_0x1000a6){while(--_0x1000a6){_0x1bee7d['push'](_0x1bee7d['shift']());}};_0x1d7881(++_0x346017);}(_0x7dde,0xf5));var _0xe7dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dde[_0x3dd15e];return _0x231fd0;};'use strict';var MailInteractionEvents=require(_0xe7dd('0x0'));var events=[_0xe7dd('0x1'),'remove','update'];function createListener(_0x577888,_0x24c96b){return function(_0x48bef1){_0x24c96b['emit'](_0x577888,_0x48bef1);};}function removeListener(_0x5625e3,_0x4aa08e){return function(){MailInteractionEvents['removeListener'](_0x5625e3,_0x4aa08e);};}exports[_0xe7dd('0x2')]=function(_0xf7269a){for(var _0x368a43=0x0,_0xe757ee=events[_0xe7dd('0x3')];_0x368a43<_0xe757ee;_0x368a43++){var _0x345e05=events[_0x368a43];var _0x5d55ae=createListener(_0xe7dd('0x4')+_0x345e05,_0xf7269a);MailInteractionEvents['on'](_0x345e05,_0x5d55ae);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index a0f113e..2c9cafb 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9fd4=['/describe','isAuthenticated','describe','exports','express','Router','../../components/auth/service','./mailInteractionHasTag.controller','get'];(function(_0xfc0976,_0x33776f){var _0x23579f=function(_0x4143d9){while(--_0x4143d9){_0xfc0976['push'](_0xfc0976['shift']());}};_0x23579f(++_0x33776f);}(_0x9fd4,0x16c));var _0x49fd=function(_0x22cf86,_0x9ecba2){_0x22cf86=_0x22cf86-0x0;var _0x2d1ea9=_0x9fd4[_0x22cf86];return _0x2d1ea9;};'use strict';var express=require(_0x49fd('0x0'));var router=express[_0x49fd('0x1')]();var auth=require(_0x49fd('0x2'));var controller=require(_0x49fd('0x3'));router[_0x49fd('0x4')](_0x49fd('0x5'),auth[_0x49fd('0x6')](),controller[_0x49fd('0x7')]);module[_0x49fd('0x8')]=router; \ No newline at end of file +var _0x496e=['exports','Router','../../components/auth/service','./mailInteractionHasTag.controller','get'];(function(_0x11a379,_0x572c80){var _0xc53c9f=function(_0x4fc488){while(--_0x4fc488){_0x11a379['push'](_0x11a379['shift']());}};_0xc53c9f(++_0x572c80);}(_0x496e,0x1a0));var _0xe496=function(_0x721e19,_0x4e57c0){_0x721e19=_0x721e19-0x0;var _0x159cfd=_0x496e[_0x721e19];return _0x159cfd;};'use strict';var express=require('express');var router=express[_0xe496('0x0')]();var auth=require(_0xe496('0x1'));var controller=require(_0xe496('0x2'));router[_0xe496('0x3')]('/describe',auth['isAuthenticated'](),controller['describe']);module[_0xe496('0x4')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 5d9415b..baa6070 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x163cda,_0x535120){var _0x219cb6=function(_0x5593f5){while(--_0x5593f5){_0x163cda['push'](_0x163cda['shift']());}};_0x219cb6(++_0x535120);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x28d860,_0x37b892){var _0x516d56=function(_0x3d3a0e){while(--_0x3d3a0e){_0x28d860['push'](_0x28d860['shift']());}};_0x516d56(++_0x37b892);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index e25adf7..835c7d8 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c60=['INTEGER','sequelize','exports'];(function(_0x51b744,_0x4f86d5){var _0x5d646d=function(_0x1982ca){while(--_0x1982ca){_0x51b744['push'](_0x51b744['shift']());}};_0x5d646d(++_0x4f86d5);}(_0x9c60,0xd9));var _0x09c6=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9c60[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x09c6('0x0'));module[_0x09c6('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x09c6('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x3df0=['exports','INTEGER'];(function(_0x162218,_0x10fd02){var _0x3b3b9a=function(_0x358cbe){while(--_0x358cbe){_0x162218['push'](_0x162218['shift']());}};_0x3b3b9a(++_0x10fd02);}(_0x3df0,0x116));var _0x03df=function(_0x3d4d54,_0xc9b2db){_0x3d4d54=_0x3d4d54-0x0;var _0x4c2878=_0x3df0[_0x3d4d54];return _0x4c2878;};'use strict';var Sequelize=require('sequelize');module[_0x03df('0x0')]={'MailInteractionId':{'type':Sequelize[_0x03df('0x1')],'primaryKey':!![]},'TagId':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index 301d49d..b5485d8 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x48e3=['MailInteractionHasTag','mail_interaction_has_tags'];(function(_0x2b39b9,_0x30bf30){var _0x8a6e9e=function(_0x1718ef){while(--_0x1718ef){_0x2b39b9['push'](_0x2b39b9['shift']());}};_0x8a6e9e(++_0x30bf30);}(_0x48e3,0x172));var _0x348e=function(_0x3dc080,_0x26a06d){_0x3dc080=_0x3dc080-0x0;var _0x427c24=_0x48e3[_0x3dc080];return _0x427c24;};'use strict';var attributes=require('./mailInteractionHasTag');module['exports']=function(_0x36a958){return _0x36a958['define'](_0x348e('0x0'),attributes,{'tableName':_0x348e('0x1'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x235c=['mail_interaction_has_tags','MailInteractionHasTag'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x235c,0x1e7));var _0xc235=function(_0x3162e3,_0x1753b7){_0x3162e3=_0x3162e3-0x0;var _0x38c9b5=_0x235c[_0x3162e3];return _0x38c9b5;};'use strict';var attributes=require('./mailInteractionHasTag');module['exports']=function(_0x425e43){return _0x425e43['define'](_0xc235('0x0'),attributes,{'tableName':_0xc235('0x1'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index e6854e1..5d41c03 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 _0x6ce9=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','describe','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','/:id','update','/:id/accept','accept','put','/:id/reject','reject','delete','destroy','exports','multer','util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6ce9,0x76));var _0x96ce=function(_0x40b1a3,_0x3d469b){_0x40b1a3=_0x40b1a3-0x0;var _0x3b6d73=_0x6ce9[_0x40b1a3];return _0x3b6d73;};'use strict';var multer=require(_0x96ce('0x0'));var util=require(_0x96ce('0x1'));var path=require(_0x96ce('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x96ce('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x96ce('0x4'));var interaction=require(_0x96ce('0x5'));var config=require(_0x96ce('0x6'));var controller=require(_0x96ce('0x7'));router['get']('/',auth[_0x96ce('0x8')](),controller[_0x96ce('0x9')]);router[_0x96ce('0xa')]('/describe',auth[_0x96ce('0x8')](),controller[_0x96ce('0xb')]);router[_0x96ce('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x96ce('0xc')]);router[_0x96ce('0xa')](_0x96ce('0xd'),auth[_0x96ce('0x8')](),controller[_0x96ce('0xe')]);router[_0x96ce('0xf')]('/',auth[_0x96ce('0x8')](),interaction[_0x96ce('0x10')](_0x96ce('0x11'),_0x96ce('0x12')),controller[_0x96ce('0x13')]);router['put'](_0x96ce('0x14'),auth[_0x96ce('0x8')](),controller[_0x96ce('0x15')]);router['put'](_0x96ce('0x16'),auth[_0x96ce('0x8')](),controller[_0x96ce('0x17')]);router[_0x96ce('0x18')](_0x96ce('0x19'),auth[_0x96ce('0x8')](),controller[_0x96ce('0x1a')]);router[_0x96ce('0x1b')](_0x96ce('0x14'),auth[_0x96ce('0x8')](),controller[_0x96ce('0x1c')]);module[_0x96ce('0x1d')]=router; \ No newline at end of file +var _0x1cf6=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','tracked','mailmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','destroy','exports'];(function(_0x5cd395,_0x507285){var _0x141227=function(_0x5893fe){while(--_0x5893fe){_0x5cd395['push'](_0x5cd395['shift']());}};_0x141227(++_0x507285);}(_0x1cf6,0x1a4));var _0x61cf=function(_0x447ede,_0xbad733){_0x447ede=_0x447ede-0x0;var _0xe684f7=_0x1cf6[_0x447ede];return _0xe684f7;};'use strict';var multer=require('multer');var util=require(_0x61cf('0x0'));var path=require(_0x61cf('0x1'));var timeout=require(_0x61cf('0x2'));var express=require(_0x61cf('0x3'));var router=express[_0x61cf('0x4')]();var fs_extra=require(_0x61cf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x61cf('0x6'));var config=require(_0x61cf('0x7'));var controller=require(_0x61cf('0x8'));router[_0x61cf('0x9')]('/',auth[_0x61cf('0xa')](),controller[_0x61cf('0xb')]);router[_0x61cf('0x9')](_0x61cf('0xc'),auth[_0x61cf('0xa')](),controller[_0x61cf('0xd')]);router[_0x61cf('0x9')](_0x61cf('0xe'),auth[_0x61cf('0xa')](),controller[_0x61cf('0xf')]);router[_0x61cf('0x9')](_0x61cf('0x10'),auth['isAuthenticated'](),controller[_0x61cf('0x11')]);router['post']('/',auth[_0x61cf('0xa')](),interaction[_0x61cf('0x12')]('mail',_0x61cf('0x13')),controller[_0x61cf('0x14')]);router[_0x61cf('0x15')](_0x61cf('0xe'),auth[_0x61cf('0xa')](),controller['update']);router['put'](_0x61cf('0x16'),auth[_0x61cf('0xa')](),controller[_0x61cf('0x17')]);router[_0x61cf('0x15')](_0x61cf('0x18'),auth[_0x61cf('0xa')](),controller[_0x61cf('0x19')]);router['delete'](_0x61cf('0xe'),auth[_0x61cf('0xa')](),controller[_0x61cf('0x1a')]);module[_0x61cf('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index b7ffe83..1f51828 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 _0xb3d3=['TEXT','long','BOOLEAN','ENUM','out','STRING','DATE','Email','Chat','sequelize','lodash','exports'];(function(_0x89238b,_0x374ec){var _0x597009=function(_0x23d3fb){while(--_0x23d3fb){_0x89238b['push'](_0x89238b['shift']());}};_0x597009(++_0x374ec);}(_0xb3d3,0x75));var _0x3b3d=function(_0x52ea08,_0x15d935){_0x52ea08=_0x52ea08-0x0;var _0x28d546=_0xb3d3[_0x52ea08];return _0x28d546;};'use strict';var Sequelize=require(_0x3b3d('0x0'));var _=require(_0x3b3d('0x1'));module[_0x3b3d('0x2')]={'body':{'type':Sequelize[_0x3b3d('0x3')](_0x3b3d('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x3b3d('0x3')]('medium')},'read':{'type':Sequelize[_0x3b3d('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3b3d('0x6')]('in',_0x3b3d('0x7')),'defaultValue':_0x3b3d('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3b3d('0x8')](0x1fe)},'from':{'type':Sequelize[_0x3b3d('0x8')]},'to':{'type':Sequelize[_0x3b3d('0x3')](_0x3b3d('0x4'))},'cc':{'type':Sequelize[_0x3b3d('0x3')](_0x3b3d('0x4'))},'bcc':{'type':Sequelize['TEXT'](_0x3b3d('0x4'))},'subject':{'type':Sequelize[_0x3b3d('0x3')]},'sentAt':{'type':Sequelize[_0x3b3d('0x9')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x3b3d('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x3b3d('0x9')]},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize[_0x3b3d('0x3')]('long')},'originChannel':{'type':Sequelize[_0x3b3d('0x6')](_0x3b3d('0xa'),_0x3b3d('0xb')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x8c50=['Chat','lodash','exports','long','TEXT','medium','BOOLEAN','ENUM','out','DATE','INTEGER','Email'];(function(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_0x8c50,0xcd));var _0x08c5=function(_0x21a3ee,_0x44d9ad){_0x21a3ee=_0x21a3ee-0x0;var _0x3f20fb=_0x8c50[_0x21a3ee];return _0x3f20fb;};'use strict';var Sequelize=require('sequelize');var _=require(_0x08c5('0x0'));module[_0x08c5('0x1')]={'body':{'type':Sequelize['TEXT'](_0x08c5('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x08c5('0x3')](_0x08c5('0x4'))},'read':{'type':Sequelize[_0x08c5('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x08c5('0x6')]('in','out'),'defaultValue':_0x08c5('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x08c5('0x3')](_0x08c5('0x2'))},'cc':{'type':Sequelize['TEXT'](_0x08c5('0x2'))},'bcc':{'type':Sequelize['TEXT'](_0x08c5('0x2'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x08c5('0x8')]},'attach':{'type':Sequelize[_0x08c5('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x08c5('0x8')]},'originTo':{'type':Sequelize[_0x08c5('0x3')](_0x08c5('0x2'))},'originCc':{'type':Sequelize[_0x08c5('0x3')](_0x08c5('0x2'))},'originChannel':{'type':Sequelize[_0x08c5('0x6')](_0x08c5('0xa'),_0x08c5('0xb')),'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 33d3e6b..cfed7e7 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 _0x2be1=['params','intersection','length','options','update','body','find','describe','direction','out','secret','split','MailAccount','findOne','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','Contacts','create','ListId','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','mail','format','user','agent','UserId','get','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','sequelize','Sequelize','contact','User','email','internal','manual','channel','event','accept','fromString','EventManager','acceptmessage','reject','MailInteraction','RejectMessage','ContactId','SELECT','fullname','interface','SIP/%s','motionChannel','rejectmessage','unix','toString','root','server','tmp','files','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','subject','decode','headers','Bcc','basename','existsSync','push','readFileSync','build','writeFileSync','eml-format','moment','bluebird','util','ioredis','html-to-text','../../components/parsers/qs','api','../../config/logger','mail-interactions','../../config/environment','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','offset','undefined','limit','count','set','then','destroy','end','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','MailMessage','includeAll','include','findAll','rows'];(function(_0x400fa0,_0x362945){var _0x3296b0=function(_0x3dfa35){while(--_0x3dfa35){_0x400fa0['push'](_0x400fa0['shift']());}};_0x3296b0(++_0x362945);}(_0x2be1,0xfc));var _0x12be=function(_0x56138f,_0x1e9ebb){_0x56138f=_0x56138f-0x0;var _0x1acaf7=_0x2be1[_0x56138f];return _0x1acaf7;};'use strict';var emlformat=require(_0x12be('0x0'));var moment=require(_0x12be('0x1'));var BPromise=require(_0x12be('0x2'));var util=require(_0x12be('0x3'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0x12be('0x4'));var htmlToText=require(_0x12be('0x5'));var qs=require(_0x12be('0x6'));var logger=require('../../config/logger')(_0x12be('0x7'));var interaction_log=require(_0x12be('0x8'))(_0x12be('0x9'));var config=require(_0x12be('0xa'));var db=require('../../mysqldb')['db'];config[_0x12be('0xb')]=_[_0x12be('0xc')](config[_0x12be('0xb')],{'host':_0x12be('0xd'),'port':0x18eb});var socket=require(_0x12be('0xe'))(new Redis(config[_0x12be('0xb')]));var htmlEntities=require(_0x12be('0xf'));require(_0x12be('0x10'))[_0x12be('0x11')](socket);var jayson=require(_0x12be('0x12'));var client=jayson[_0x12be('0x13')][_0x12be('0x14')]({'port':0x232c});var client9003=jayson[_0x12be('0x13')][_0x12be('0x14')]({'port':0x232b});var client9002=jayson[_0x12be('0x13')][_0x12be('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x298a6a,_0xdbfb52,_0x57a110,_0x299f21){return new BPromise(function(_0x3f6d2d,_0x390b15){var _0x191f60=_0x299f21||client;return _0x191f60['request'](_0x298a6a,_0x57a110)['then'](function(_0x2a512a){logger[_0x12be('0x15')](_0x12be('0x16'),_0xdbfb52,_0x12be('0x17'));logger[_0x12be('0x18')](_0x12be('0x19'),_0xdbfb52,_0x12be('0x17'),JSON[_0x12be('0x1a')](_0x2a512a));if(_0x2a512a[_0x12be('0x1b')]){if(_0x2a512a[_0x12be('0x1b')]['code']===0x1f4){logger[_0x12be('0x1b')](_0x12be('0x16'),_0xdbfb52,_0x2a512a['error'][_0x12be('0x1c')]);return _0x390b15(_0x2a512a[_0x12be('0x1b')][_0x12be('0x1c')]);}logger[_0x12be('0x1b')](_0x12be('0x16'),_0xdbfb52,_0x2a512a['error'][_0x12be('0x1c')]);return _0x3f6d2d(_0x2a512a[_0x12be('0x1b')][_0x12be('0x1c')]);}else{logger[_0x12be('0x15')]('MailMessage,\x20%s,\x20%s',_0xdbfb52,_0x12be('0x17'));_0x3f6d2d(_0x2a512a[_0x12be('0x1d')][_0x12be('0x1c')]);}})[_0x12be('0x1e')](function(_0x2f5452){logger[_0x12be('0x1b')](_0x12be('0x16'),_0xdbfb52,_0x2f5452);_0x390b15(_0x2f5452);});});}function respondWithResult(_0x57e772,_0x5500a3){_0x5500a3=_0x5500a3||0xc8;return function(_0x27875b){if(_0x27875b){return _0x57e772[_0x12be('0x1f')](_0x5500a3)[_0x12be('0x20')](_0x27875b);}};}function respondWithFilteredResult(_0x1f13ff,_0x1afda3){return function(_0x453962){if(_0x453962){var _0x30fb19=typeof _0x1afda3[_0x12be('0x21')]===_0x12be('0x22')&&typeof _0x1afda3[_0x12be('0x23')]===_0x12be('0x22');var _0x2a0ce6=_0x453962[_0x12be('0x24')];var _0x55ea4a=_0x30fb19?0x0:_0x1afda3['offset'];var _0xed6a09=_0x30fb19?_0x453962['count']:_0x1afda3[_0x12be('0x21')]+_0x1afda3[_0x12be('0x23')];var _0x161a76;if(_0xed6a09>=_0x2a0ce6){_0xed6a09=_0x2a0ce6;_0x161a76=0xc8;}else{_0x161a76=0xce;}_0x1f13ff[_0x12be('0x1f')](_0x161a76);return _0x1f13ff[_0x12be('0x25')]('Content-Range',_0x55ea4a+'-'+_0xed6a09+'/'+_0x2a0ce6)[_0x12be('0x20')](_0x453962);}return null;};}function saveUpdates(_0x216ef6){return function(_0x123a43){if(_0x123a43){return _0x123a43['update'](_0x216ef6)[_0x12be('0x26')](function(_0x1f46fa){return _0x1f46fa;});}return null;};}function removeEntity(_0x4eac76){return function(_0x434f00){if(_0x434f00){return _0x434f00[_0x12be('0x27')]()[_0x12be('0x26')](function(){_0x4eac76[_0x12be('0x1f')](0xcc)[_0x12be('0x28')]();});}};}function handleEntityNotFound(_0x56a8ec){return function(_0x1c374e){if(!_0x1c374e){_0x56a8ec[_0x12be('0x29')](0x194);}return _0x1c374e;};}function handleError(_0x6c2a65,_0x5581cb){_0x5581cb=_0x5581cb||0x1f4;return function(_0x4cd0b0){logger[_0x12be('0x1b')](_0x4cd0b0['stack']);if(_0x4cd0b0[_0x12be('0x2a')]){delete _0x4cd0b0['name'];}_0x6c2a65[_0x12be('0x1f')](_0x5581cb)[_0x12be('0x2b')](_0x4cd0b0);};}exports[_0x12be('0x2c')]=function(_0x4b949a,_0x2371cb){var _0x114a8f={},_0x281264={},_0x583e80={'count':0x0,'rows':[]};var _0x113a4d=_[_0x12be('0x2d')](db['MailMessage'][_0x12be('0x2e')],function(_0x319f6b){return{'name':_0x319f6b[_0x12be('0x2f')],'type':_0x319f6b[_0x12be('0x30')][_0x12be('0x31')]};});_0x281264['model']=_[_0x12be('0x2d')](_0x113a4d,_0x12be('0x2a'));_0x281264[_0x12be('0x32')]=_[_0x12be('0x33')](_0x4b949a[_0x12be('0x32')]);_0x281264[_0x12be('0x34')]=_['intersection'](_0x281264[_0x12be('0x35')],_0x281264[_0x12be('0x32')]);_0x114a8f[_0x12be('0x36')]=_['intersection'](_0x281264['model'],qs['fields'](_0x4b949a[_0x12be('0x32')][_0x12be('0x37')]));_0x114a8f[_0x12be('0x36')]=_0x114a8f[_0x12be('0x36')]['length']?_0x114a8f[_0x12be('0x36')]:_0x281264[_0x12be('0x35')];if(!_0x4b949a['query'][_0x12be('0x38')](_0x12be('0x39'))){_0x114a8f['limit']=qs['limit'](_0x4b949a[_0x12be('0x32')][_0x12be('0x23')]);_0x114a8f[_0x12be('0x21')]=qs['offset'](_0x4b949a[_0x12be('0x32')][_0x12be('0x21')]);}_0x114a8f[_0x12be('0x3a')]=qs[_0x12be('0x3b')](_0x4b949a[_0x12be('0x32')][_0x12be('0x3b')]);_0x114a8f[_0x12be('0x3c')]=qs[_0x12be('0x34')](_[_0x12be('0x3d')](_0x4b949a[_0x12be('0x32')],_0x281264['filters']),_0x113a4d);if(_0x4b949a[_0x12be('0x32')]['filter']){_0x114a8f[_0x12be('0x3c')]=_[_0x12be('0x3e')](_0x114a8f[_0x12be('0x3c')],{'$or':_[_0x12be('0x2d')](_0x113a4d,function(_0x58382a){if(_0x58382a[_0x12be('0x30')]!==_0x12be('0x3f')){var _0x28d0e8={};_0x28d0e8[_0x58382a[_0x12be('0x2a')]]={'$like':'%'+_0x4b949a[_0x12be('0x32')][_0x12be('0x40')]+'%'};return _0x28d0e8;}})});}_0x114a8f=_[_0x12be('0x3e')]({},_0x114a8f,_0x4b949a['options']);var _0x21c6b8={'where':_0x114a8f['where']};return db[_0x12be('0x41')][_0x12be('0x24')](_0x21c6b8)[_0x12be('0x26')](function(_0x507af1){_0x583e80[_0x12be('0x24')]=_0x507af1;if(_0x4b949a['query'][_0x12be('0x42')]){_0x114a8f[_0x12be('0x43')]=[{'all':!![]}];}return db[_0x12be('0x41')][_0x12be('0x44')](_0x114a8f);})['then'](function(_0x7fb9c0){_0x583e80[_0x12be('0x45')]=_0x7fb9c0;return _0x583e80;})[_0x12be('0x26')](respondWithFilteredResult(_0x2371cb,_0x114a8f))['catch'](handleError(_0x2371cb,null));};exports['show']=function(_0x2f1956,_0x2ceedf){var _0x50f5de={'raw':!![],'where':{'id':_0x2f1956[_0x12be('0x46')]['id']}},_0x40f355={};_0x40f355[_0x12be('0x35')]=_['keys'](db['MailMessage'][_0x12be('0x2e')]);_0x40f355[_0x12be('0x32')]=_['keys'](_0x2f1956[_0x12be('0x32')]);_0x40f355[_0x12be('0x34')]=_['intersection'](_0x40f355['model'],_0x40f355[_0x12be('0x32')]);_0x50f5de[_0x12be('0x36')]=_[_0x12be('0x47')](_0x40f355[_0x12be('0x35')],qs[_0x12be('0x37')](_0x2f1956[_0x12be('0x32')][_0x12be('0x37')]));_0x50f5de[_0x12be('0x36')]=_0x50f5de['attributes'][_0x12be('0x48')]?_0x50f5de['attributes']:_0x40f355[_0x12be('0x35')];if(_0x2f1956['query'][_0x12be('0x42')]){_0x50f5de['include']=[{'all':!![]}];}_0x50f5de=_[_0x12be('0x3e')]({},_0x50f5de,_0x2f1956[_0x12be('0x49')]);return db['MailMessage']['find'](_0x50f5de)[_0x12be('0x26')](handleEntityNotFound(_0x2ceedf,null))['then'](respondWithResult(_0x2ceedf,null))[_0x12be('0x1e')](handleError(_0x2ceedf,null));};exports[_0x12be('0x4a')]=function(_0x51d564,_0x37966e){if(_0x51d564[_0x12be('0x4b')]['id']){delete _0x51d564[_0x12be('0x4b')]['id'];}return db[_0x12be('0x41')][_0x12be('0x4c')]({'where':{'id':_0x51d564[_0x12be('0x46')]['id']}})['then'](handleEntityNotFound(_0x37966e,null))[_0x12be('0x26')](saveUpdates(_0x51d564[_0x12be('0x4b')],null))[_0x12be('0x26')](respondWithResult(_0x37966e,null))[_0x12be('0x1e')](handleError(_0x37966e,null));};exports[_0x12be('0x27')]=function(_0x28aedf,_0x5f1df5){return db[_0x12be('0x41')][_0x12be('0x4c')]({'where':{'id':_0x28aedf['params']['id']}})[_0x12be('0x26')](handleEntityNotFound(_0x5f1df5,null))[_0x12be('0x26')](removeEntity(_0x5f1df5,null))['catch'](handleError(_0x5f1df5,null));};exports[_0x12be('0x4d')]=function(_0x5c40fc,_0x5b2b6a){return db[_0x12be('0x41')][_0x12be('0x4d')]()[_0x12be('0x26')](respondWithResult(_0x5b2b6a,null))[_0x12be('0x1e')](handleError(_0x5b2b6a,null));};exports['create']=function(_0x305dbc,_0x158758){return db[_0x12be('0x41')]['create'](_0x305dbc[_0x12be('0x4b')])['then'](function(_0x3a0ffd){if(_0x3a0ffd){if(_0x3a0ffd[_0x12be('0x4e')]===_0x12be('0x4f')&&!_0x3a0ffd[_0x12be('0x50')]){var _0x122f3b,_0x3c2ae2,_0x27bfe1;if(_0x305dbc[_0x12be('0x4b')]['to']){_0x3c2ae2=_0x305dbc[_0x12be('0x4b')]['to'][_0x12be('0x51')](',')[0x0];}return db[_0x12be('0x52')][_0x12be('0x53')]({'where':{'id':_0x3a0ffd['MailAccountId']},'include':[{'model':db['CmList'],'as':_0x12be('0x54'),'include':[{'model':db[_0x12be('0x55')],'as':'Contacts','where':{'email':_0x3c2ae2},'limit':0x1,'order':[[_0x12be('0x56'),_0x12be('0x57')]]}]},{'model':db[_0x12be('0x58')],'as':_0x12be('0x59'),'raw':!![],'include':[{'model':db[_0x12be('0x5a')],'as':'CloudProvider','raw':!![]}]}]})[_0x12be('0x26')](function(_0x2e8903){_0x122f3b=_0x2e8903;if(!_0x122f3b||!_0x122f3b[_0x12be('0x59')])return;var _0x1bfeea=_0x122f3b[_0x12be('0x5b')]();if(_0x305dbc[_0x12be('0x4b')][_0x12be('0x5c')]&&_0x305dbc['body'][_0x12be('0x5c')][_0x12be('0x48')]){for(var _0x372aaf=0x0;_0x372aaf<_0x305dbc['body'][_0x12be('0x5c')][_0x12be('0x48')];_0x372aaf+=0x1){_0x305dbc['body']['attachments'][_0x372aaf]={'filename':_0x305dbc[_0x12be('0x4b')]['attachments'][_0x372aaf][_0x12be('0x2a')],'path':path[_0x12be('0x5d')](config['root'],'server/files/attachments',_0x305dbc['body'][_0x12be('0x5c')][_0x372aaf]['basename'])};}}_0x27bfe1={'account':_0x1bfeea,'message':_0x305dbc[_0x12be('0x4b')]};return;})[_0x12be('0x26')](function(){if(_0x122f3b[_0x12be('0x54')]){if(_0x122f3b[_0x12be('0x54')]['Contacts'][_0x12be('0x48')]){return _0x122f3b['List'][_0x12be('0x5e')][0x0];}else{return db['CmContact'][_0x12be('0x5f')](_[_0x12be('0xc')](_0x305dbc[_0x12be('0x4b')],{'firstName':_0x305dbc[_0x12be('0x4b')]['to'],'email':_0x305dbc[_0x12be('0x4b')]['to'],'phone':_0x305dbc[_0x12be('0x4b')]['to'],'ListId':_0x122f3b[_0x12be('0x60')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x12be('0x26')](function(){if(_0x27bfe1){return respondWithRpcPromise(_0x12be('0x61'),_0x12be('0x62'),_0x27bfe1,client9003)[_0x12be('0x26')](function(_0x49c047){return _0x3a0ffd['update']({'read':!![],'messageId':_0x49c047[_0x12be('0x63')],'sentAt':moment()['format'](_0x12be('0x64'))});})[_0x12be('0x1e')](function(_0x53b421){logger[_0x12be('0x1b')]('%s',JSON[_0x12be('0x1a')](_0x53b421));return _0x3a0ffd;});}return _0x3a0ffd;});}return _0x3a0ffd;}})[_0x12be('0x26')](respondWithResult(_0x158758,0xc9))[_0x12be('0x1e')](handleError(_0x158758,null));};exports['accept']=function(_0x16fe35,_0x2673e9){var _0x2399fd={'agent':{},'channel':_0x12be('0x65')};if(_0x16fe35[_0x12be('0x4b')]['id']){delete _0x16fe35[_0x12be('0x4b')]['id'];}_0x16fe35[_0x12be('0x4b')]['read']=!![];_0x16fe35['body']['readAt']=moment()[_0x12be('0x66')](_0x12be('0x64'));_0x16fe35[_0x12be('0x4b')]['UserId']=_0x16fe35[_0x12be('0x4b')]['UserId']||_0x16fe35[_0x12be('0x67')]['id'];_0x2399fd[_0x12be('0x68')]['id']=_0x16fe35['body'][_0x12be('0x69')];return db['MailMessage']['find']({'where':{'id':_0x16fe35[_0x12be('0x46')]['id'],'UserId':null}})[_0x12be('0x26')](handleEntityNotFound(_0x2673e9,null))[_0x12be('0x26')](saveUpdates(_0x16fe35[_0x12be('0x4b')],null))[_0x12be('0x26')](function(_0x31de3f){if(_0x31de3f){_0x2399fd['message']=_0x31de3f[_0x12be('0x6a')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x31de3f[_0x12be('0x6b')]}});}return null;})[_0x12be('0x26')](handleEntityNotFound(_0x2673e9,null))['then'](function(_0x1807ae){if(_0x1807ae){return _0x1807ae[_0x12be('0x4a')]({'UserId':_0x16fe35[_0x12be('0x4b')][_0x12be('0x69')],'read1stAt':_[_0x12be('0x6c')](_0x1807ae[_0x12be('0x6d')])?moment()[_0x12be('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x12be('0x26')](function(_0x48acb3){if(_0x48acb3){_0x2399fd[_0x12be('0x6e')]=_0x48acb3['get']({'plain':!![]});interaction_log[_0x12be('0x15')](_0x12be('0x6f'),_0x16fe35['user']['id'],_0x16fe35[_0x12be('0x67')]['name'],_0x16fe35['user'][_0x12be('0x70')],_0x2399fd[_0x12be('0x6e')]['id'],_0x16fe35['body']?JSON[_0x12be('0x1a')](_0x16fe35['body']):_0x12be('0x71'));return respondWithRpcPromise(_0x12be('0x72'),_0x12be('0x73'),_0x2399fd);}return null;})['then'](function(_0x2043ee){var _0x3cb5e1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2043ee[_0x12be('0x1c')]['ContactId'];return db[_0x12be('0x74')][_0x12be('0x32')](_0x3cb5e1,{'type':db[_0x12be('0x75')]['QueryTypes']['SELECT'],'raw':!![]})[_0x12be('0x26')](function(_0x552f32){return _0x552f32;});})[_0x12be('0x26')](function(_0x23c301){if(_0x23c301){_0x2399fd[_0x12be('0x1c')][_0x12be('0x76')]=_0x23c301[0x0];if(!_0x16fe35[_0x12be('0x4b')][_0x12be('0x69')])return;return db[_0x12be('0x77')]['find']({'where':{'id':_0x16fe35[_0x12be('0x4b')]['UserId'],'role':_0x12be('0x68')},'attributes':['id','name','fullname',_0x12be('0x78'),_0x12be('0x79')],'raw':!![]});}return null;})[_0x12be('0x26')](function(_0x54192b){if(!_0x54192b)return null;_0x2399fd[_0x12be('0x1c')][_0x12be('0x68')]=_0x54192b;return _0x2399fd;})[_0x12be('0x26')](function(_0xec5a24){if(_0xec5a24){if(_0x16fe35[_0x12be('0x4b')][_0x12be('0x7a')]){_0x2399fd['message']['interface']=util['format']('SIP/%s',_0x16fe35[_0x12be('0x67')][_0x12be('0x2a')]);_0x2399fd[_0x12be('0x1c')][_0x12be('0x7b')]=_0x2399fd[_0x12be('0x7b')];_0x2399fd[_0x12be('0x1c')]['motionChannel']=_0x2399fd[_0x12be('0x7b')];_0x2399fd[_0x12be('0x1c')][_0x12be('0x7c')]=_0x12be('0x7d');_0x2399fd[_0x12be('0x1c')][_0x12be('0x4b')]=htmlToText[_0x12be('0x7e')](_0x2399fd['message'][_0x12be('0x4b')]);return respondWithRpcPromise(_0x12be('0x7f'),_0x12be('0x7f'),{'event':_0x12be('0x80'),'message':_0x2399fd[_0x12be('0x1c')]},client9002)[_0x12be('0x26')](function(){return _0x2399fd;});}return _0x2399fd;}return null;})[_0x12be('0x26')](respondWithResult(_0x2673e9,null))[_0x12be('0x1e')](handleError(_0x2673e9,null));};exports[_0x12be('0x81')]=function(_0x5804aa,_0x5aca93){var _0x9a536e={'agent':{},'channel':'mail'};if(_0x5804aa['body']['id']){delete _0x5804aa[_0x12be('0x4b')]['id'];}_0x5804aa[_0x12be('0x4b')][_0x12be('0x69')]=_0x5804aa[_0x12be('0x4b')][_0x12be('0x69')]||_0x5804aa[_0x12be('0x67')]['id'];_0x9a536e['agent']['id']=_0x5804aa[_0x12be('0x4b')][_0x12be('0x69')];return db[_0x12be('0x41')][_0x12be('0x4c')]({'where':{'id':_0x5804aa[_0x12be('0x46')]['id'],'UserId':null}})[_0x12be('0x26')](handleEntityNotFound(_0x5aca93,null))[_0x12be('0x26')](function(_0x3ac0e1){if(_0x3ac0e1){_0x9a536e['message']=_0x3ac0e1[_0x12be('0x6a')]({'plain':!![]});return db[_0x12be('0x82')][_0x12be('0x4c')]({'where':{'id':_0x3ac0e1[_0x12be('0x6b')]}});}return null;})[_0x12be('0x26')](handleEntityNotFound(_0x5aca93,null))[_0x12be('0x26')](function(_0x5c37fc){if(_0x5c37fc){_0x9a536e[_0x12be('0x6e')]=_0x5c37fc[_0x12be('0x6a')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5804aa[_0x12be('0x67')]['id'],_0x5804aa[_0x12be('0x67')]['name'],_0x5804aa[_0x12be('0x67')]['role'],_0x9a536e[_0x12be('0x6e')]['id'],_0x5804aa[_0x12be('0x4b')]?JSON[_0x12be('0x1a')](_0x5804aa['body']):_0x12be('0x71'));return respondWithRpcPromise(_0x12be('0x83'),'rejectMessage',_0x9a536e);}return null;})['then'](function(_0x4eacd2){var _0x4e7b10='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4eacd2[_0x12be('0x1c')][_0x12be('0x84')];return db[_0x12be('0x74')][_0x12be('0x32')](_0x4e7b10,{'type':db['Sequelize']['QueryTypes'][_0x12be('0x85')],'raw':!![]})[_0x12be('0x26')](function(_0x33cb4b){return _0x33cb4b;});})['then'](function(_0x410bff){if(_0x410bff){_0x9a536e[_0x12be('0x1c')][_0x12be('0x76')]=_0x410bff[0x0];if(!_0x5804aa[_0x12be('0x4b')]['UserId'])return;return db['User'][_0x12be('0x4c')]({'where':{'id':_0x5804aa[_0x12be('0x4b')][_0x12be('0x69')],'role':'agent'},'attributes':['id','name',_0x12be('0x86'),_0x12be('0x78'),'internal'],'raw':!![]});}return null;})[_0x12be('0x26')](function(_0x44b328){if(!_0x44b328)return null;_0x9a536e[_0x12be('0x1c')][_0x12be('0x68')]=_0x44b328;return _0x9a536e;})[_0x12be('0x26')](function(_0x2ec0d9){if(_0x2ec0d9){_0x2ec0d9[_0x12be('0x1c')][_0x12be('0x87')]=util[_0x12be('0x66')](_0x12be('0x88'),_0x5804aa[_0x12be('0x67')][_0x12be('0x2a')]);_0x2ec0d9[_0x12be('0x1c')][_0x12be('0x7b')]=_0x9a536e[_0x12be('0x7b')];_0x2ec0d9['message'][_0x12be('0x89')]=_0x9a536e[_0x12be('0x7b')];_0x2ec0d9['message'][_0x12be('0x7c')]=_0x12be('0x81');_0x2ec0d9[_0x12be('0x1c')]['body']=htmlToText['fromString'](_0x9a536e[_0x12be('0x1c')][_0x12be('0x4b')]);respondWithRpcPromise(_0x12be('0x7f'),'EventManager',{'event':_0x12be('0x8a'),'message':_0x2ec0d9['message']},client9002);return _0x9a536e;}return null;})[_0x12be('0x26')](respondWithResult(_0x5aca93,null))[_0x12be('0x1e')](handleError(_0x5aca93,null));};exports['download']=function(_0x4cf454,_0x21a1b8){var _0x23e90e=moment()[_0x12be('0x8b')]()[_0x12be('0x8c')]();var _0x23c2db=path['join'](config[_0x12be('0x8d')],_0x12be('0x8e'),'files',_0x12be('0x8f'));var _0x4a4d1c=path[_0x12be('0x5d')](config[_0x12be('0x8d')],_0x12be('0x8e'),_0x12be('0x90'),'attachments');var _0x13aa6c=util[_0x12be('0x66')](_0x12be('0x91'),_0x23e90e);return db[_0x12be('0x41')][_0x12be('0x4c')]({'where':{'id':_0x4cf454[_0x12be('0x46')]['id']},'attributes':['id','body',_0x12be('0x92'),'to','cc',_0x12be('0x93'),'subject',_0x12be('0x94')],'include':_0x4cf454[_0x12be('0x32')][_0x12be('0x5c')]?[{'model':db[_0x12be('0x95')],'as':_0x12be('0x96')}]:undefined})[_0x12be('0x26')](handleEntityNotFound(_0x21a1b8,null))[_0x12be('0x26')](function(_0xa92962){if(_0xa92962){var _0x408f14=_0xa92962;var _0x44b8ab={'from':_0x408f14[_0x12be('0x92')],'to':_0x408f14['to'],'subject':_0x408f14[_0x12be('0x97')],'html':htmlEntities[_0x12be('0x98')](_0x408f14[_0x12be('0x4b')]),'headers':{'Date':moment(_0x408f14[_0x12be('0x94')])[_0x12be('0x66')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0xa92962['cc']){_0x44b8ab['headers']['Cc']=_0xa92962['cc'];}if(_0xa92962[_0x12be('0x93')]){_0x44b8ab[_0x12be('0x99')][_0x12be('0x9a')]=_0xa92962[_0x12be('0x93')];}return new BPromise(function(_0x28f153,_0x1024b4){if(_0xa92962[_0x12be('0x96')]){for(var _0xb0c83c=0x0;_0xb0c83c<_0xa92962[_0x12be('0x96')]['length'];_0xb0c83c++){var _0x4817b7=_0xa92962[_0x12be('0x96')][_0xb0c83c];var _0x476de2=path[_0x12be('0x5d')](_0x4a4d1c,_0x4817b7[_0x12be('0x9b')]);if(fs[_0x12be('0x9c')](_0x476de2)){_0x44b8ab[_0x12be('0x5c')][_0x12be('0x9d')]({'name':_0x4817b7[_0x12be('0x2a')],'contentType':_0x4817b7[_0x12be('0x30')],'data':fs[_0x12be('0x9e')](_0x476de2)});}}}emlformat[_0x12be('0x9f')](_0x44b8ab,function(_0x5a83dd,_0x7d6890){if(_0x5a83dd)return _0x1024b4(_0x5a83dd);fs[_0x12be('0xa0')](path[_0x12be('0x5d')](_0x23c2db,_0x13aa6c),_0x7d6890);return _0x28f153(_0x7d6890);});});}})['then'](function(_0x2ffe32){if(_0x2ffe32){return _0x21a1b8['download'](path[_0x12be('0x5d')](_0x23c2db,_0x13aa6c),_0x13aa6c,function(_0x1eab9d){if(!_0x1eab9d)fs['unlinkSync'](path[_0x12be('0x5d')](_0x23c2db,_0x13aa6c));});}})[_0x12be('0x1e')](handleError(_0x21a1b8,null));}; \ No newline at end of file +var _0xeacd=['offset','set','Content-Range','json','update','end','sendStatus','name','send','index','MailMessage','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','body','find','destroy','describe','create','direction','out','secret','split','findOne','MailAccountId','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','basename','Contacts','ListId','List\x20not\x20found','SendMail','sendMail','YYYY-MM-DD\x20HH:mm:ss','stringify','mail','readAt','UserId','agent','get','MailInteraction','isNil','read1stAt','format','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','channel','event','accept','fromString','EventManager','reject','MailInteractionId','info','role','SIP/%s','motionChannel','rejectmessage','unix','toString','root','files','server','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','writeFileSync','download','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','redis','defaults','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','undefined','limit'];(function(_0x24f326,_0x616a7){var _0x488e2d=function(_0x293d9a){while(--_0x293d9a){_0x24f326['push'](_0x24f326['shift']());}};_0x488e2d(++_0x616a7);}(_0xeacd,0x1ba));var _0xdeac=function(_0x4d3b24,_0x32d325){_0x4d3b24=_0x4d3b24-0x0;var _0x45eab1=_0xeacd[_0x4d3b24];return _0x45eab1;};'use strict';var emlformat=require('eml-format');var moment=require(_0xdeac('0x0'));var BPromise=require(_0xdeac('0x1'));var util=require(_0xdeac('0x2'));var path=require(_0xdeac('0x3'));var fs=require('fs');var _=require(_0xdeac('0x4'));var Redis=require(_0xdeac('0x5'));var htmlToText=require(_0xdeac('0x6'));var qs=require(_0xdeac('0x7'));var logger=require(_0xdeac('0x8'))(_0xdeac('0x9'));var interaction_log=require(_0xdeac('0x8'))(_0xdeac('0xa'));var config=require(_0xdeac('0xb'));var db=require('../../mysqldb')['db'];config[_0xdeac('0xc')]=_[_0xdeac('0xd')](config[_0xdeac('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdeac('0xe'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require(_0xdeac('0xf'))['register'](socket);var jayson=require(_0xdeac('0x10'));var client=jayson[_0xdeac('0x11')][_0xdeac('0x12')]({'port':0x232c});var client9003=jayson[_0xdeac('0x11')][_0xdeac('0x12')]({'port':0x232b});var client9002=jayson['client'][_0xdeac('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x28c77a,_0x4a2075,_0x13ffe6,_0x55e4e8){return new BPromise(function(_0x572152,_0x25a204){var _0x44bdf8=_0x55e4e8||client;return _0x44bdf8[_0xdeac('0x13')](_0x28c77a,_0x13ffe6)[_0xdeac('0x14')](function(_0x21b7fd){logger['info'](_0xdeac('0x15'),_0x4a2075,_0xdeac('0x16'));logger[_0xdeac('0x17')](_0xdeac('0x18'),_0x4a2075,_0xdeac('0x16'),JSON['stringify'](_0x21b7fd));if(_0x21b7fd[_0xdeac('0x19')]){if(_0x21b7fd[_0xdeac('0x19')]['code']===0x1f4){logger[_0xdeac('0x19')](_0xdeac('0x15'),_0x4a2075,_0x21b7fd['error']['message']);return _0x25a204(_0x21b7fd[_0xdeac('0x19')][_0xdeac('0x1a')]);}logger[_0xdeac('0x19')](_0xdeac('0x15'),_0x4a2075,_0x21b7fd['error']['message']);return _0x572152(_0x21b7fd[_0xdeac('0x19')][_0xdeac('0x1a')]);}else{logger['info'](_0xdeac('0x15'),_0x4a2075,'request\x20sent');_0x572152(_0x21b7fd[_0xdeac('0x1b')]['message']);}})[_0xdeac('0x1c')](function(_0x2ffa8a){logger[_0xdeac('0x19')](_0xdeac('0x15'),_0x4a2075,_0x2ffa8a);_0x25a204(_0x2ffa8a);});});}function respondWithResult(_0x4bac0c,_0x4fa84d){_0x4fa84d=_0x4fa84d||0xc8;return function(_0x3e3132){if(_0x3e3132){return _0x4bac0c[_0xdeac('0x1d')](_0x4fa84d)['json'](_0x3e3132);}};}function respondWithFilteredResult(_0x15f68c,_0x1b7c13){return function(_0x1af216){if(_0x1af216){var _0x2f2f4b=typeof _0x1b7c13['offset']===_0xdeac('0x1e')&&typeof _0x1b7c13[_0xdeac('0x1f')]===_0xdeac('0x1e');var _0x1c06ba=_0x1af216['count'];var _0x28219e=_0x2f2f4b?0x0:_0x1b7c13['offset'];var _0x5a090c=_0x2f2f4b?_0x1af216['count']:_0x1b7c13[_0xdeac('0x20')]+_0x1b7c13['limit'];var _0x426bb4;if(_0x5a090c>=_0x1c06ba){_0x5a090c=_0x1c06ba;_0x426bb4=0xc8;}else{_0x426bb4=0xce;}_0x15f68c['status'](_0x426bb4);return _0x15f68c[_0xdeac('0x21')](_0xdeac('0x22'),_0x28219e+'-'+_0x5a090c+'/'+_0x1c06ba)[_0xdeac('0x23')](_0x1af216);}return null;};}function saveUpdates(_0x4bb600){return function(_0x3d197b){if(_0x3d197b){return _0x3d197b[_0xdeac('0x24')](_0x4bb600)[_0xdeac('0x14')](function(_0x30b410){return _0x30b410;});}return null;};}function removeEntity(_0xd4d4f2){return function(_0x4f03a1){if(_0x4f03a1){return _0x4f03a1['destroy']()[_0xdeac('0x14')](function(){_0xd4d4f2[_0xdeac('0x1d')](0xcc)[_0xdeac('0x25')]();});}};}function handleEntityNotFound(_0x3f888c){return function(_0x3a73b8){if(!_0x3a73b8){_0x3f888c[_0xdeac('0x26')](0x194);}return _0x3a73b8;};}function handleError(_0x128327,_0x4e4983){_0x4e4983=_0x4e4983||0x1f4;return function(_0x24f91c){logger[_0xdeac('0x19')](_0x24f91c['stack']);if(_0x24f91c[_0xdeac('0x27')]){delete _0x24f91c[_0xdeac('0x27')];}_0x128327[_0xdeac('0x1d')](_0x4e4983)[_0xdeac('0x28')](_0x24f91c);};}exports[_0xdeac('0x29')]=function(_0x2a6e70,_0x452908){var _0x1af247={},_0xa85030={},_0x1fc446={'count':0x0,'rows':[]};var _0x4b52d4=_['map'](db[_0xdeac('0x2a')]['rawAttributes'],function(_0x31650a){return{'name':_0x31650a[_0xdeac('0x2b')],'type':_0x31650a['type']['key']};});_0xa85030[_0xdeac('0x2c')]=_[_0xdeac('0x2d')](_0x4b52d4,_0xdeac('0x27'));_0xa85030[_0xdeac('0x2e')]=_[_0xdeac('0x2f')](_0x2a6e70[_0xdeac('0x2e')]);_0xa85030[_0xdeac('0x30')]=_[_0xdeac('0x31')](_0xa85030[_0xdeac('0x2c')],_0xa85030[_0xdeac('0x2e')]);_0x1af247[_0xdeac('0x32')]=_[_0xdeac('0x31')](_0xa85030[_0xdeac('0x2c')],qs[_0xdeac('0x33')](_0x2a6e70[_0xdeac('0x2e')][_0xdeac('0x33')]));_0x1af247[_0xdeac('0x32')]=_0x1af247['attributes'][_0xdeac('0x34')]?_0x1af247[_0xdeac('0x32')]:_0xa85030['model'];if(!_0x2a6e70[_0xdeac('0x2e')][_0xdeac('0x35')](_0xdeac('0x36'))){_0x1af247[_0xdeac('0x1f')]=qs[_0xdeac('0x1f')](_0x2a6e70[_0xdeac('0x2e')]['limit']);_0x1af247['offset']=qs[_0xdeac('0x20')](_0x2a6e70['query'][_0xdeac('0x20')]);}_0x1af247['order']=qs[_0xdeac('0x37')](_0x2a6e70['query'][_0xdeac('0x37')]);_0x1af247[_0xdeac('0x38')]=qs['filters'](_[_0xdeac('0x39')](_0x2a6e70['query'],_0xa85030['filters']),_0x4b52d4);if(_0x2a6e70[_0xdeac('0x2e')][_0xdeac('0x3a')]){_0x1af247[_0xdeac('0x38')]=_['merge'](_0x1af247[_0xdeac('0x38')],{'$or':_[_0xdeac('0x2d')](_0x4b52d4,function(_0xae45cd){if(_0xae45cd[_0xdeac('0x3b')]!==_0xdeac('0x3c')){var _0xf4c716={};_0xf4c716[_0xae45cd[_0xdeac('0x27')]]={'$like':'%'+_0x2a6e70[_0xdeac('0x2e')][_0xdeac('0x3a')]+'%'};return _0xf4c716;}})});}_0x1af247=_[_0xdeac('0x3d')]({},_0x1af247,_0x2a6e70[_0xdeac('0x3e')]);var _0x190640={'where':_0x1af247[_0xdeac('0x38')]};return db['MailMessage']['count'](_0x190640)[_0xdeac('0x14')](function(_0x147906){_0x1fc446[_0xdeac('0x3f')]=_0x147906;if(_0x2a6e70['query'][_0xdeac('0x40')]){_0x1af247[_0xdeac('0x41')]=[{'all':!![]}];}return db[_0xdeac('0x2a')][_0xdeac('0x42')](_0x1af247);})['then'](function(_0x4a0f2a){_0x1fc446[_0xdeac('0x43')]=_0x4a0f2a;return _0x1fc446;})[_0xdeac('0x14')](respondWithFilteredResult(_0x452908,_0x1af247))[_0xdeac('0x1c')](handleError(_0x452908,null));};exports[_0xdeac('0x44')]=function(_0x1539a4,_0x21e2c4){var _0x19fc50={'raw':!![],'where':{'id':_0x1539a4[_0xdeac('0x45')]['id']}},_0x2b8ffb={};_0x2b8ffb[_0xdeac('0x2c')]=_[_0xdeac('0x2f')](db[_0xdeac('0x2a')][_0xdeac('0x46')]);_0x2b8ffb[_0xdeac('0x2e')]=_[_0xdeac('0x2f')](_0x1539a4['query']);_0x2b8ffb[_0xdeac('0x30')]=_[_0xdeac('0x31')](_0x2b8ffb[_0xdeac('0x2c')],_0x2b8ffb['query']);_0x19fc50[_0xdeac('0x32')]=_['intersection'](_0x2b8ffb['model'],qs[_0xdeac('0x33')](_0x1539a4['query'][_0xdeac('0x33')]));_0x19fc50[_0xdeac('0x32')]=_0x19fc50[_0xdeac('0x32')][_0xdeac('0x34')]?_0x19fc50['attributes']:_0x2b8ffb[_0xdeac('0x2c')];if(_0x1539a4[_0xdeac('0x2e')][_0xdeac('0x40')]){_0x19fc50[_0xdeac('0x41')]=[{'all':!![]}];}_0x19fc50=_[_0xdeac('0x3d')]({},_0x19fc50,_0x1539a4['options']);return db[_0xdeac('0x2a')]['find'](_0x19fc50)[_0xdeac('0x14')](handleEntityNotFound(_0x21e2c4,null))[_0xdeac('0x14')](respondWithResult(_0x21e2c4,null))['catch'](handleError(_0x21e2c4,null));};exports[_0xdeac('0x24')]=function(_0x5f454c,_0x35e2a8){if(_0x5f454c[_0xdeac('0x47')]['id']){delete _0x5f454c[_0xdeac('0x47')]['id'];}return db['MailMessage'][_0xdeac('0x48')]({'where':{'id':_0x5f454c['params']['id']}})[_0xdeac('0x14')](handleEntityNotFound(_0x35e2a8,null))['then'](saveUpdates(_0x5f454c[_0xdeac('0x47')],null))[_0xdeac('0x14')](respondWithResult(_0x35e2a8,null))[_0xdeac('0x1c')](handleError(_0x35e2a8,null));};exports[_0xdeac('0x49')]=function(_0x59e024,_0x59d919){return db[_0xdeac('0x2a')][_0xdeac('0x48')]({'where':{'id':_0x59e024['params']['id']}})[_0xdeac('0x14')](handleEntityNotFound(_0x59d919,null))[_0xdeac('0x14')](removeEntity(_0x59d919,null))['catch'](handleError(_0x59d919,null));};exports['describe']=function(_0x406da3,_0x3ca2d8){return db[_0xdeac('0x2a')][_0xdeac('0x4a')]()[_0xdeac('0x14')](respondWithResult(_0x3ca2d8,null))[_0xdeac('0x1c')](handleError(_0x3ca2d8,null));};exports[_0xdeac('0x4b')]=function(_0x439abe,_0x25881f){return db[_0xdeac('0x2a')][_0xdeac('0x4b')](_0x439abe[_0xdeac('0x47')])[_0xdeac('0x14')](function(_0x5d4ab9){if(_0x5d4ab9){if(_0x5d4ab9[_0xdeac('0x4c')]===_0xdeac('0x4d')&&!_0x5d4ab9[_0xdeac('0x4e')]){var _0x32b549,_0x38259b,_0x360fdc;if(_0x439abe['body']['to']){_0x38259b=_0x439abe['body']['to'][_0xdeac('0x4f')](',')[0x0];}return db['MailAccount'][_0xdeac('0x50')]({'where':{'id':_0x5d4ab9[_0xdeac('0x51')]},'include':[{'model':db['CmList'],'as':_0xdeac('0x52'),'include':[{'model':db[_0xdeac('0x53')],'as':'Contacts','where':{'email':_0x38259b},'limit':0x1,'order':[[_0xdeac('0x54'),_0xdeac('0x55')]]}]},{'model':db[_0xdeac('0x56')],'as':_0xdeac('0x57'),'raw':!![],'include':[{'model':db[_0xdeac('0x58')],'as':_0xdeac('0x58'),'raw':!![]}]}]})[_0xdeac('0x14')](function(_0x58e216){_0x32b549=_0x58e216;if(!_0x32b549||!_0x32b549[_0xdeac('0x57')])return;var _0x3ffc4d=_0x32b549[_0xdeac('0x59')]();if(_0x439abe[_0xdeac('0x47')][_0xdeac('0x5a')]&&_0x439abe['body'][_0xdeac('0x5a')][_0xdeac('0x34')]){for(var _0x53650b=0x0;_0x53650b<_0x439abe['body']['attachments']['length'];_0x53650b+=0x1){_0x439abe['body'][_0xdeac('0x5a')][_0x53650b]={'filename':_0x439abe['body'][_0xdeac('0x5a')][_0x53650b]['name'],'path':path[_0xdeac('0x5b')](config['root'],_0xdeac('0x5c'),_0x439abe['body'][_0xdeac('0x5a')][_0x53650b][_0xdeac('0x5d')])};}}_0x360fdc={'account':_0x3ffc4d,'message':_0x439abe['body']};return;})[_0xdeac('0x14')](function(){if(_0x32b549[_0xdeac('0x52')]){if(_0x32b549[_0xdeac('0x52')][_0xdeac('0x5e')][_0xdeac('0x34')]){return _0x32b549[_0xdeac('0x52')]['Contacts'][0x0];}else{return db[_0xdeac('0x53')]['create'](_['defaults'](_0x439abe[_0xdeac('0x47')],{'firstName':_0x439abe[_0xdeac('0x47')]['to'],'email':_0x439abe[_0xdeac('0x47')]['to'],'phone':_0x439abe['body']['to'],'ListId':_0x32b549[_0xdeac('0x5f')]}));}}else{throw new Error(_0xdeac('0x60'));}})[_0xdeac('0x14')](function(){if(_0x360fdc){return respondWithRpcPromise(_0xdeac('0x61'),_0xdeac('0x62'),_0x360fdc,client9003)[_0xdeac('0x14')](function(_0x33e21d){return _0x5d4ab9[_0xdeac('0x24')]({'read':!![],'messageId':_0x33e21d['messageId'],'sentAt':moment()['format'](_0xdeac('0x63'))});})[_0xdeac('0x1c')](function(_0x32e8ac){logger[_0xdeac('0x19')]('%s',JSON[_0xdeac('0x64')](_0x32e8ac));return _0x5d4ab9;});}return _0x5d4ab9;});}return _0x5d4ab9;}})[_0xdeac('0x14')](respondWithResult(_0x25881f,0xc9))[_0xdeac('0x1c')](handleError(_0x25881f,null));};exports['accept']=function(_0x56d056,_0x2cafc2){var _0x1bb2aa={'agent':{},'channel':_0xdeac('0x65')};if(_0x56d056[_0xdeac('0x47')]['id']){delete _0x56d056[_0xdeac('0x47')]['id'];}_0x56d056[_0xdeac('0x47')]['read']=!![];_0x56d056[_0xdeac('0x47')][_0xdeac('0x66')]=moment()['format'](_0xdeac('0x63'));_0x56d056[_0xdeac('0x47')][_0xdeac('0x67')]=_0x56d056[_0xdeac('0x47')][_0xdeac('0x67')]||_0x56d056['user']['id'];_0x1bb2aa[_0xdeac('0x68')]['id']=_0x56d056[_0xdeac('0x47')][_0xdeac('0x67')];return db[_0xdeac('0x2a')]['find']({'where':{'id':_0x56d056[_0xdeac('0x45')]['id'],'UserId':null}})[_0xdeac('0x14')](handleEntityNotFound(_0x2cafc2,null))[_0xdeac('0x14')](saveUpdates(_0x56d056['body'],null))[_0xdeac('0x14')](function(_0x581d7d){if(_0x581d7d){_0x1bb2aa['message']=_0x581d7d[_0xdeac('0x69')]({'plain':!![]});return db[_0xdeac('0x6a')][_0xdeac('0x48')]({'where':{'id':_0x581d7d['MailInteractionId']}});}return null;})[_0xdeac('0x14')](handleEntityNotFound(_0x2cafc2,null))[_0xdeac('0x14')](function(_0x1675b5){if(_0x1675b5){return _0x1675b5[_0xdeac('0x24')]({'UserId':_0x56d056[_0xdeac('0x47')][_0xdeac('0x67')],'read1stAt':_[_0xdeac('0x6b')](_0x1675b5[_0xdeac('0x6c')])?moment()[_0xdeac('0x6d')](_0xdeac('0x63')):undefined});}return null;})[_0xdeac('0x14')](function(_0x1f6577){if(_0x1f6577){_0x1bb2aa[_0xdeac('0x6e')]=_0x1f6577['get']({'plain':!![]});interaction_log['info'](_0xdeac('0x6f'),_0x56d056[_0xdeac('0x70')]['id'],_0x56d056[_0xdeac('0x70')][_0xdeac('0x27')],_0x56d056[_0xdeac('0x70')]['role'],_0x1bb2aa[_0xdeac('0x6e')]['id'],_0x56d056[_0xdeac('0x47')]?JSON[_0xdeac('0x64')](_0x56d056[_0xdeac('0x47')]):_0xdeac('0x71'));return respondWithRpcPromise(_0xdeac('0x72'),'acceptMessage',_0x1bb2aa);}return null;})[_0xdeac('0x14')](function(_0xe1f5f9){var _0x3920d9=_0xdeac('0x73')+_0xe1f5f9['message'][_0xdeac('0x74')];return db['sequelize'][_0xdeac('0x2e')](_0x3920d9,{'type':db['Sequelize'][_0xdeac('0x75')][_0xdeac('0x76')],'raw':!![]})['then'](function(_0x5b9121){return _0x5b9121;});})[_0xdeac('0x14')](function(_0x242e11){if(_0x242e11){_0x1bb2aa[_0xdeac('0x1a')][_0xdeac('0x77')]=_0x242e11[0x0];if(!_0x56d056[_0xdeac('0x47')][_0xdeac('0x67')])return;return db[_0xdeac('0x78')]['find']({'where':{'id':_0x56d056['body'][_0xdeac('0x67')],'role':_0xdeac('0x68')},'attributes':['id',_0xdeac('0x27'),_0xdeac('0x79'),_0xdeac('0x7a'),'internal'],'raw':!![]});}return null;})['then'](function(_0x354613){if(!_0x354613)return null;_0x1bb2aa[_0xdeac('0x1a')][_0xdeac('0x68')]=_0x354613;return _0x1bb2aa;})[_0xdeac('0x14')](function(_0x27bbe8){if(_0x27bbe8){if(_0x56d056[_0xdeac('0x47')][_0xdeac('0x7b')]){_0x1bb2aa[_0xdeac('0x1a')][_0xdeac('0x7c')]=util[_0xdeac('0x6d')]('SIP/%s',_0x56d056[_0xdeac('0x70')][_0xdeac('0x27')]);_0x1bb2aa[_0xdeac('0x1a')][_0xdeac('0x7d')]=_0x1bb2aa[_0xdeac('0x7d')];_0x1bb2aa[_0xdeac('0x1a')]['motionChannel']=_0x1bb2aa[_0xdeac('0x7d')];_0x1bb2aa[_0xdeac('0x1a')][_0xdeac('0x7e')]=_0xdeac('0x7f');_0x1bb2aa[_0xdeac('0x1a')][_0xdeac('0x47')]=htmlToText[_0xdeac('0x80')](_0x1bb2aa[_0xdeac('0x1a')][_0xdeac('0x47')]);return respondWithRpcPromise(_0xdeac('0x81'),'EventManager',{'event':'acceptmessage','message':_0x1bb2aa[_0xdeac('0x1a')]},client9002)[_0xdeac('0x14')](function(){return _0x1bb2aa;});}return _0x1bb2aa;}return null;})[_0xdeac('0x14')](respondWithResult(_0x2cafc2,null))[_0xdeac('0x1c')](handleError(_0x2cafc2,null));};exports[_0xdeac('0x82')]=function(_0x1f008f,_0x3b1a24){var _0x58143b={'agent':{},'channel':_0xdeac('0x65')};if(_0x1f008f[_0xdeac('0x47')]['id']){delete _0x1f008f[_0xdeac('0x47')]['id'];}_0x1f008f[_0xdeac('0x47')][_0xdeac('0x67')]=_0x1f008f['body'][_0xdeac('0x67')]||_0x1f008f['user']['id'];_0x58143b[_0xdeac('0x68')]['id']=_0x1f008f['body'][_0xdeac('0x67')];return db[_0xdeac('0x2a')][_0xdeac('0x48')]({'where':{'id':_0x1f008f[_0xdeac('0x45')]['id'],'UserId':null}})[_0xdeac('0x14')](handleEntityNotFound(_0x3b1a24,null))[_0xdeac('0x14')](function(_0x59d486){if(_0x59d486){_0x58143b[_0xdeac('0x1a')]=_0x59d486[_0xdeac('0x69')]({'plain':!![]});return db['MailInteraction'][_0xdeac('0x48')]({'where':{'id':_0x59d486[_0xdeac('0x83')]}});}return null;})[_0xdeac('0x14')](handleEntityNotFound(_0x3b1a24,null))['then'](function(_0x1a317f){if(_0x1a317f){_0x58143b[_0xdeac('0x6e')]=_0x1a317f['get']({'plain':!![]});interaction_log[_0xdeac('0x84')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1f008f[_0xdeac('0x70')]['id'],_0x1f008f[_0xdeac('0x70')][_0xdeac('0x27')],_0x1f008f[_0xdeac('0x70')][_0xdeac('0x85')],_0x58143b[_0xdeac('0x6e')]['id'],_0x1f008f[_0xdeac('0x47')]?JSON[_0xdeac('0x64')](_0x1f008f[_0xdeac('0x47')]):_0xdeac('0x71'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x58143b);}return null;})[_0xdeac('0x14')](function(_0x38668d){var _0x2e076e=_0xdeac('0x73')+_0x38668d['message'][_0xdeac('0x74')];return db['sequelize'][_0xdeac('0x2e')](_0x2e076e,{'type':db['Sequelize'][_0xdeac('0x75')][_0xdeac('0x76')],'raw':!![]})[_0xdeac('0x14')](function(_0x66fad3){return _0x66fad3;});})[_0xdeac('0x14')](function(_0x5d2b57){if(_0x5d2b57){_0x58143b[_0xdeac('0x1a')][_0xdeac('0x77')]=_0x5d2b57[0x0];if(!_0x1f008f[_0xdeac('0x47')][_0xdeac('0x67')])return;return db['User'][_0xdeac('0x48')]({'where':{'id':_0x1f008f['body'][_0xdeac('0x67')],'role':_0xdeac('0x68')},'attributes':['id',_0xdeac('0x27'),_0xdeac('0x79'),_0xdeac('0x7a'),'internal'],'raw':!![]});}return null;})[_0xdeac('0x14')](function(_0x11a68e){if(!_0x11a68e)return null;_0x58143b['message'][_0xdeac('0x68')]=_0x11a68e;return _0x58143b;})[_0xdeac('0x14')](function(_0x1cbddb){if(_0x1cbddb){_0x1cbddb[_0xdeac('0x1a')][_0xdeac('0x7c')]=util[_0xdeac('0x6d')](_0xdeac('0x86'),_0x1f008f[_0xdeac('0x70')][_0xdeac('0x27')]);_0x1cbddb[_0xdeac('0x1a')][_0xdeac('0x7d')]=_0x58143b[_0xdeac('0x7d')];_0x1cbddb[_0xdeac('0x1a')][_0xdeac('0x87')]=_0x58143b[_0xdeac('0x7d')];_0x1cbddb[_0xdeac('0x1a')][_0xdeac('0x7e')]='reject';_0x1cbddb[_0xdeac('0x1a')][_0xdeac('0x47')]=htmlToText[_0xdeac('0x80')](_0x58143b['message']['body']);respondWithRpcPromise(_0xdeac('0x81'),'EventManager',{'event':_0xdeac('0x88'),'message':_0x1cbddb[_0xdeac('0x1a')]},client9002);return _0x58143b;}return null;})['then'](respondWithResult(_0x3b1a24,null))[_0xdeac('0x1c')](handleError(_0x3b1a24,null));};exports['download']=function(_0x14716b,_0x3c5977){var _0x3c1880=moment()[_0xdeac('0x89')]()[_0xdeac('0x8a')]();var _0x3ee31e=path[_0xdeac('0x5b')](config[_0xdeac('0x8b')],'server',_0xdeac('0x8c'),'tmp');var _0x398192=path['join'](config[_0xdeac('0x8b')],_0xdeac('0x8d'),_0xdeac('0x8c'),_0xdeac('0x5a'));var _0x187f8f=util[_0xdeac('0x6d')](_0xdeac('0x8e'),_0x3c1880);return db[_0xdeac('0x2a')][_0xdeac('0x48')]({'where':{'id':_0x14716b['params']['id']},'attributes':['id',_0xdeac('0x47'),_0xdeac('0x8f'),'to','cc',_0xdeac('0x90'),_0xdeac('0x91'),_0xdeac('0x92')],'include':_0x14716b[_0xdeac('0x2e')][_0xdeac('0x5a')]?[{'model':db[_0xdeac('0x93')],'as':_0xdeac('0x94')}]:undefined})[_0xdeac('0x14')](handleEntityNotFound(_0x3c5977,null))['then'](function(_0x47acba){if(_0x47acba){var _0x1cd69e=_0x47acba;var _0x5326df={'from':_0x1cd69e[_0xdeac('0x8f')],'to':_0x1cd69e['to'],'subject':_0x1cd69e[_0xdeac('0x91')],'html':htmlEntities[_0xdeac('0x95')](_0x1cd69e[_0xdeac('0x47')]),'headers':{'Date':moment(_0x1cd69e[_0xdeac('0x92')])[_0xdeac('0x6d')](_0xdeac('0x96'))},'attachments':[]};if(_0x47acba['cc']){_0x5326df[_0xdeac('0x97')]['Cc']=_0x47acba['cc'];}if(_0x47acba[_0xdeac('0x90')]){_0x5326df[_0xdeac('0x97')][_0xdeac('0x98')]=_0x47acba[_0xdeac('0x90')];}return new BPromise(function(_0x38940c,_0x47f3b1){if(_0x47acba[_0xdeac('0x94')]){for(var _0x30e1eb=0x0;_0x30e1eb<_0x47acba[_0xdeac('0x94')][_0xdeac('0x34')];_0x30e1eb++){var _0x21227e=_0x47acba[_0xdeac('0x94')][_0x30e1eb];var _0x452995=path[_0xdeac('0x5b')](_0x398192,_0x21227e[_0xdeac('0x5d')]);if(fs[_0xdeac('0x99')](_0x452995)){_0x5326df[_0xdeac('0x5a')][_0xdeac('0x9a')]({'name':_0x21227e[_0xdeac('0x27')],'contentType':_0x21227e[_0xdeac('0x3b')],'data':fs[_0xdeac('0x9b')](_0x452995)});}}}emlformat['build'](_0x5326df,function(_0x3b1362,_0x9702b6){if(_0x3b1362)return _0x47f3b1(_0x3b1362);fs[_0xdeac('0x9c')](path['join'](_0x3ee31e,_0x187f8f),_0x9702b6);return _0x38940c(_0x9702b6);});});}})[_0xdeac('0x14')](function(_0x3608fe){if(_0x3608fe){return _0x3c5977[_0xdeac('0x9d')](path[_0xdeac('0x5b')](_0x3ee31e,_0x187f8f),_0x187f8f,function(_0x2f0e50){if(!_0x2f0e50)fs['unlinkSync'](path[_0xdeac('0x5b')](_0x3ee31e,_0x187f8f));});}})[_0xdeac('0x1c')](handleError(_0x3c5977,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 7348e3b..ec5301d 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 _0xc591=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x4124b8,_0x39a5fb){var _0xdd927=function(_0x2fb8ab){while(--_0x2fb8ab){_0x4124b8['push'](_0x4124b8['shift']());}};_0xdd927(++_0x39a5fb);}(_0xc591,0xe0));var _0x1c59=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xc591[_0xdc37a1];return _0x99b4fe;};'use strict';var EventEmitter=require(_0x1c59('0x0'));var MailMessage=require(_0x1c59('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x1c59('0x2')](0x0);var events={'afterCreate':_0x1c59('0x3'),'afterUpdate':_0x1c59('0x4'),'afterDestroy':'remove'};function emitEvent(_0x52061c){return function(_0x561d7e,_0x1391e2,_0x6ad3aa){MailMessageEvents[_0x1c59('0x5')](_0x52061c+':'+_0x561d7e['id'],_0x561d7e);MailMessageEvents[_0x1c59('0x5')](_0x52061c,_0x561d7e);_0x6ad3aa(null);};}for(var e in events){if(events[_0x1c59('0x6')](e)){var event=events[e];MailMessage[_0x1c59('0x7')](e,emitEvent(event));}}module[_0x1c59('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x6a86=['emit','hook','../../mysqldb','MailMessage','setMaxListeners','save','update'];(function(_0x2c3255,_0x4e00ae){var _0x282aba=function(_0x5721d5){while(--_0x5721d5){_0x2c3255['push'](_0x2c3255['shift']());}};_0x282aba(++_0x4e00ae);}(_0x6a86,0x183));var _0x66a8=function(_0x1f45e2,_0x22a2c9){_0x1f45e2=_0x1f45e2-0x0;var _0x423083=_0x6a86[_0x1f45e2];return _0x423083;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x66a8('0x0'))['db'][_0x66a8('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x66a8('0x2')](0x0);var events={'afterCreate':_0x66a8('0x3'),'afterUpdate':_0x66a8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2a8992){return function(_0x3d3476,_0x39f826,_0x3d6f57){MailMessageEvents[_0x66a8('0x5')](_0x2a8992+':'+_0x3d3476['id'],_0x3d3476);MailMessageEvents[_0x66a8('0x5')](_0x2a8992,_0x3d3476);_0x3d6f57(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x66a8('0x6')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 9696ec1..914f8f0 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 _0x94fc=['mail_messages','messageId','plainBody','subject','FULLTEXT','body','fromString','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','html-to-text','../../config/environment','exports','define','MailMessage'];(function(_0x30dabe,_0xdc04be){var _0x2255fd=function(_0xd04884){while(--_0xd04884){_0x30dabe['push'](_0x30dabe['shift']());}};_0x2255fd(++_0xdc04be);}(_0x94fc,0x196));var _0xc94f=function(_0x45cd10,_0x41ea34){_0x45cd10=_0x45cd10-0x0;var _0x315229=_0x94fc[_0x45cd10];return _0x315229;};'use strict';var _=require(_0xc94f('0x0'));var util=require('util');var logger=require(_0xc94f('0x1'))('api');var moment=require(_0xc94f('0x2'));var BPromise=require(_0xc94f('0x3'));var rp=require(_0xc94f('0x4'));var htmlToText=require(_0xc94f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc94f('0x6'));var attributes=require('./mailMessage.attributes');module[_0xc94f('0x7')]=function(_0x1b160b,_0x213f8c){return _0x1b160b[_0xc94f('0x8')](_0xc94f('0x9'),attributes,{'tableName':_0xc94f('0xa'),'paranoid':![],'indexes':[{'name':_0xc94f('0xb'),'fields':[_0xc94f('0xb')]},{'name':'fti_mail_messages','fields':[_0xc94f('0xc'),_0xc94f('0xd')],'type':_0xc94f('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5886af,_0x3add39,_0x1f92ef){if(_0x5886af[_0xc94f('0xf')]){_0x5886af[_0xc94f('0xc')]=htmlToText[_0xc94f('0x10')](_0x5886af['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1f92ef(null,_0x3add39);},'afterCreate':function(_0x447b37,_0x4b9cb7,_0x292d91){var _0x1f94b3=_0x1b160b['models'];var _0x93f16e=_0x447b37['get']({'plain':!![]});if(_0x93f16e[_0xc94f('0x11')][_0xc94f('0x12')]()==='in'||_0x93f16e[_0xc94f('0x11')][_0xc94f('0x12')]()===_0xc94f('0x13')&&!_0x93f16e[_0xc94f('0x14')]&&!_[_0xc94f('0x15')](_0x93f16e[_0xc94f('0x16')])){_0x1f94b3[_0xc94f('0x17')]['findOne']({'where':{'id':_0x93f16e[_0xc94f('0x18')]}})[_0xc94f('0x19')](function(_0x572eea){if(_0x572eea){_0x572eea[_0xc94f('0x1a')]({'lastMsgAt':_0x93f16e[_0xc94f('0x1b')],'lastMsgDirection':_0x93f16e[_0xc94f('0x11')][_0xc94f('0x12')]()});}})[_0xc94f('0x1c')](function(_0x40b6a5){console[_0xc94f('0x1d')](_0x40b6a5);});}_0x292d91();}},'charset':_0xc94f('0x1e'),'collate':_0xc94f('0x1f')});}; \ No newline at end of file +var _0x4e3c=['models','get','toLowerCase','out','secret','isNil','MailInteraction','findOne','then','update','createdAt','direction','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','FULLTEXT','body'];(function(_0x4f4e2e,_0x3e9028){var _0x44393b=function(_0x1cd757){while(--_0x1cd757){_0x4f4e2e['push'](_0x4f4e2e['shift']());}};_0x44393b(++_0x3e9028);}(_0x4e3c,0x159));var _0xc4e3=function(_0x5d09d9,_0x181abf){_0x5d09d9=_0x5d09d9-0x0;var _0x7ce182=_0x4e3c[_0x5d09d9];return _0x7ce182;};'use strict';var _=require(_0xc4e3('0x0'));var util=require(_0xc4e3('0x1'));var logger=require(_0xc4e3('0x2'))(_0xc4e3('0x3'));var moment=require(_0xc4e3('0x4'));var BPromise=require(_0xc4e3('0x5'));var rp=require(_0xc4e3('0x6'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xc4e3('0x7'));var rimraf=require(_0xc4e3('0x8'));var config=require('../../config/environment');var attributes=require(_0xc4e3('0x9'));module[_0xc4e3('0xa')]=function(_0x3e19df,_0x572698){return _0x3e19df[_0xc4e3('0xb')](_0xc4e3('0xc'),attributes,{'tableName':_0xc4e3('0xd'),'paranoid':![],'indexes':[{'name':_0xc4e3('0xe'),'fields':[_0xc4e3('0xe')]},{'name':_0xc4e3('0xf'),'fields':['plainBody','subject'],'type':_0xc4e3('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x41a591,_0x43603e,_0x37389e){if(_0x41a591[_0xc4e3('0x11')]){_0x41a591['plainBody']=htmlToText['fromString'](_0x41a591['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x37389e(null,_0x43603e);},'afterCreate':function(_0x4badca,_0x35c686,_0x48c906){var _0x51b98c=_0x3e19df[_0xc4e3('0x12')];var _0x1a0342=_0x4badca[_0xc4e3('0x13')]({'plain':!![]});if(_0x1a0342['direction']['toLowerCase']()==='in'||_0x1a0342['direction'][_0xc4e3('0x14')]()===_0xc4e3('0x15')&&!_0x1a0342[_0xc4e3('0x16')]&&!_[_0xc4e3('0x17')](_0x1a0342['UserId'])){_0x51b98c[_0xc4e3('0x18')][_0xc4e3('0x19')]({'where':{'id':_0x1a0342['MailInteractionId']}})[_0xc4e3('0x1a')](function(_0x206a1b){if(_0x206a1b){_0x206a1b[_0xc4e3('0x1b')]({'lastMsgAt':_0x1a0342[_0xc4e3('0x1c')],'lastMsgDirection':_0x1a0342[_0xc4e3('0x1d')]['toLowerCase']()});}})[_0xc4e3('0x1e')](function(_0x266ba7){console['error'](_0x266ba7);});}_0x48c906();}},'charset':_0xc4e3('0x1f'),'collate':_0xc4e3('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index ecdd359..462dca6 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 _0x4325=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateMailMessage','MailMessage','create','body','options','debug','lodash','util'];(function(_0x35c5a8,_0x8ecb48){var _0x34782c=function(_0x1b23ec){while(--_0x1b23ec){_0x35c5a8['push'](_0x35c5a8['shift']());}};_0x34782c(++_0x8ecb48);}(_0x4325,0x1da));var _0x5432=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4325[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var rs=require(_0x5432('0x3'));var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5432('0x5'))(_0x5432('0x6'));var config=require(_0x5432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5432('0x8')][_0x5432('0x9')]({'port':0x232a});config['redis']=_[_0x5432('0xa')](config['redis'],{'host':_0x5432('0xb'),'port':0x18eb});var socket=require(_0x5432('0xc'))(new Redis(config[_0x5432('0xd')]));require(_0x5432('0xe'))[_0x5432('0xf')](socket);function respondWithRpcPromise(_0x4a9a51,_0xcc52a,_0x58348a){return new BPromise(function(_0x28ff19,_0x35faac){return client[_0x5432('0x10')](_0x4a9a51,_0x58348a)[_0x5432('0x11')](function(_0x4ac11f){logger['info'](_0x5432('0x12'),_0xcc52a,_0x5432('0x13'));logger['debug'](_0x5432('0x14'),_0xcc52a,_0x5432('0x13'),JSON[_0x5432('0x15')](_0x4ac11f));if(_0x4ac11f[_0x5432('0x16')]){if(_0x4ac11f[_0x5432('0x16')][_0x5432('0x17')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0xcc52a,_0x4ac11f[_0x5432('0x16')][_0x5432('0x18')]);return _0x35faac(_0x4ac11f[_0x5432('0x16')][_0x5432('0x18')]);}logger[_0x5432('0x16')](_0x5432('0x12'),_0xcc52a,_0x4ac11f['error'][_0x5432('0x18')]);return _0x28ff19(_0x4ac11f['error'][_0x5432('0x18')]);}else{logger[_0x5432('0x19')](_0x5432('0x12'),_0xcc52a,_0x5432('0x13'));_0x28ff19(_0x4ac11f[_0x5432('0x1a')]['message']);}})[_0x5432('0x1b')](function(_0x22f030){logger[_0x5432('0x16')](_0x5432('0x12'),_0xcc52a,_0x22f030);_0x35faac(_0x22f030);});});}exports[_0x5432('0x1c')]=function(_0x451de4){var _0x29e699=this;return new Promise(function(_0x5da6ea,_0x66911a){return db[_0x5432('0x1d')][_0x5432('0x1e')](_0x451de4[_0x5432('0x1f')],{'raw':_0x451de4[_0x5432('0x20')]?_0x451de4['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x61827e){logger[_0x5432('0x19')](_0x5432('0x1c'),_0x451de4);logger[_0x5432('0x21')]('CreateMailMessage',_0x451de4,JSON['stringify'](_0x61827e));_0x5da6ea(_0x61827e);})[_0x5432('0x1b')](function(_0x8ed74b){logger['error'](_0x5432('0x1c'),_0x8ed74b[_0x5432('0x18')],_0x451de4);_0x66911a(_0x29e699[_0x5432('0x16')](0x1f4,_0x8ed74b['message']));});});}; \ No newline at end of file +var _0xdd4f=['request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s'];(function(_0x303064,_0x12f0c2){var _0x5a1d3d=function(_0x5b9d81){while(--_0x5b9d81){_0x303064['push'](_0x303064['shift']());}};_0x5a1d3d(++_0x12f0c2);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x3cf92f,_0x16172b){_0x3cf92f=_0x3cf92f-0x0;var _0x5a82f4=_0xdd4f[_0x3cf92f];return _0x5a82f4;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfdd4('0x1'));var fs=require('fs');var Redis=require(_0xfdd4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfdd4('0x3'));var logger=require(_0xfdd4('0x4'))(_0xfdd4('0x5'));var config=require('../../config/environment');var jayson=require(_0xfdd4('0x6'));var client=jayson[_0xfdd4('0x7')][_0xfdd4('0x8')]({'port':0x232a});config[_0xfdd4('0x9')]=_[_0xfdd4('0xa')](config['redis'],{'host':_0xfdd4('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfdd4('0x9')]));require(_0xfdd4('0xc'))[_0xfdd4('0xd')](socket);function respondWithRpcPromise(_0x4ee02f,_0x3d06c9,_0x4b4f1d){return new BPromise(function(_0x27a9f3,_0x3ce77a){return client[_0xfdd4('0xe')](_0x4ee02f,_0x4b4f1d)[_0xfdd4('0xf')](function(_0x35e22d){logger[_0xfdd4('0x10')](_0xfdd4('0x11'),_0x3d06c9,_0xfdd4('0x12'));logger[_0xfdd4('0x13')](_0xfdd4('0x14'),_0x3d06c9,_0xfdd4('0x12'),JSON['stringify'](_0x35e22d));if(_0x35e22d[_0xfdd4('0x15')]){if(_0x35e22d[_0xfdd4('0x15')][_0xfdd4('0x16')]===0x1f4){logger['error'](_0xfdd4('0x11'),_0x3d06c9,_0x35e22d['error'][_0xfdd4('0x17')]);return _0x3ce77a(_0x35e22d[_0xfdd4('0x15')][_0xfdd4('0x17')]);}logger[_0xfdd4('0x15')](_0xfdd4('0x11'),_0x3d06c9,_0x35e22d['error']['message']);return _0x27a9f3(_0x35e22d['error'][_0xfdd4('0x17')]);}else{logger[_0xfdd4('0x10')](_0xfdd4('0x11'),_0x3d06c9,_0xfdd4('0x12'));_0x27a9f3(_0x35e22d[_0xfdd4('0x18')][_0xfdd4('0x17')]);}})[_0xfdd4('0x19')](function(_0x2ffd5f){logger[_0xfdd4('0x15')]('MailMessage,\x20%s,\x20%s',_0x3d06c9,_0x2ffd5f);_0x3ce77a(_0x2ffd5f);});});}exports[_0xfdd4('0x1a')]=function(_0x3e8eac){var _0x2dc51c=this;return new Promise(function(_0x36e611,_0x1454f1){return db[_0xfdd4('0x1b')][_0xfdd4('0x1c')](_0x3e8eac[_0xfdd4('0x1d')],{'raw':_0x3e8eac['options']?_0x3e8eac[_0xfdd4('0x1e')][_0xfdd4('0x1f')]===undefined?!![]:![]:!![]})[_0xfdd4('0xf')](function(_0x16e81b){logger[_0xfdd4('0x10')](_0xfdd4('0x1a'),_0x3e8eac);logger[_0xfdd4('0x13')](_0xfdd4('0x1a'),_0x3e8eac,JSON['stringify'](_0x16e81b));_0x36e611(_0x16e81b);})[_0xfdd4('0x19')](function(_0x1112e8){logger[_0xfdd4('0x15')]('CreateMailMessage',_0x1112e8[_0xfdd4('0x17')],_0x3e8eac);_0x1454f1(_0x2dc51c[_0xfdd4('0x15')](0x1f4,_0x1112e8[_0xfdd4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 5813666..010725b 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 _0x71ec=['length','mailMessage:','./mailMessage.events','remove','update'];(function(_0x3f2d02,_0x2c7deb){var _0x54092b=function(_0x427ff8){while(--_0x427ff8){_0x3f2d02['push'](_0x3f2d02['shift']());}};_0x54092b(++_0x2c7deb);}(_0x71ec,0x13d));var _0xc71e=function(_0x2c63a4,_0x18a34f){_0x2c63a4=_0x2c63a4-0x0;var _0x210eb8=_0x71ec[_0x2c63a4];return _0x210eb8;};'use strict';var MailMessageEvents=require(_0xc71e('0x0'));var events=['save',_0xc71e('0x1'),_0xc71e('0x2')];function createListener(_0x3b5be1,_0x7fd728){return function(_0x22d438){_0x7fd728['emit'](_0x3b5be1,_0x22d438);};}function removeListener(_0x9a710,_0x1f9c32){return function(){MailMessageEvents['removeListener'](_0x9a710,_0x1f9c32);};}exports['register']=function(_0x236732){for(var _0x4ba5a9=0x0,_0x3a9b0f=events[_0xc71e('0x3')];_0x4ba5a9<_0x3a9b0f;_0x4ba5a9++){var _0x1c3e1f=events[_0x4ba5a9];var _0x2b6ca3=createListener(_0xc71e('0x4')+_0x1c3e1f,_0x236732);MailMessageEvents['on'](_0x1c3e1f,_0x2b6ca3);}}; \ No newline at end of file +var _0xc92c=['removeListener','register','mailMessage:','./mailMessage.events','save','remove','emit'];(function(_0x350aaa,_0x267dbe){var _0xb03443=function(_0x156ab2){while(--_0x156ab2){_0x350aaa['push'](_0x350aaa['shift']());}};_0xb03443(++_0x267dbe);}(_0xc92c,0x176));var _0xcc92=function(_0x508af2,_0xdb8ab4){_0x508af2=_0x508af2-0x0;var _0x2add9b=_0xc92c[_0x508af2];return _0x2add9b;};'use strict';var MailMessageEvents=require(_0xcc92('0x0'));var events=[_0xcc92('0x1'),_0xcc92('0x2'),'update'];function createListener(_0x3d233a,_0xb4cb3b){return function(_0x502e19){_0xb4cb3b[_0xcc92('0x3')](_0x3d233a,_0x502e19);};}function removeListener(_0x371c1e,_0x353503){return function(){MailMessageEvents[_0xcc92('0x4')](_0x371c1e,_0x353503);};}exports[_0xcc92('0x5')]=function(_0x1fbefa){for(var _0x598bfb=0x0,_0x20aab7=events['length'];_0x598bfb<_0x20aab7;_0x598bfb++){var _0x3c4ddb=events[_0x598bfb];var _0x16a898=createListener(_0xcc92('0x6')+_0x3c4ddb,_0x1fbefa);MailMessageEvents['on'](_0x3c4ddb,_0x16a898);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index f384a21..cd6c08d 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 _0x9092=['removeTeams','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','/:id','update','delete','destroy'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x9092,0x1b1));var _0x2909=function(_0x2f9aad,_0x20d136){_0x2f9aad=_0x2f9aad-0x0;var _0xb193cd=_0x9092[_0x2f9aad];return _0xb193cd;};'use strict';var multer=require(_0x2909('0x0'));var util=require(_0x2909('0x1'));var path=require(_0x2909('0x2'));var timeout=require('connect-timeout');var express=require(_0x2909('0x3'));var router=express[_0x2909('0x4')]();var fs_extra=require(_0x2909('0x5'));var auth=require(_0x2909('0x6'));var interaction=require(_0x2909('0x7'));var config=require(_0x2909('0x8'));var controller=require('./mailQueue.controller');router[_0x2909('0x9')]('/',auth[_0x2909('0xa')](),controller[_0x2909('0xb')]);router['get']('/describe',auth[_0x2909('0xa')](),controller[_0x2909('0xc')]);router['get']('/:id',auth[_0x2909('0xa')](),controller[_0x2909('0xd')]);router[_0x2909('0x9')]('/:id/members',auth[_0x2909('0xa')](),controller['getMembers']);router[_0x2909('0x9')](_0x2909('0xe'),auth[_0x2909('0xa')](),controller[_0x2909('0xf')]);router['get'](_0x2909('0x10'),auth[_0x2909('0xa')](),controller[_0x2909('0x11')]);router[_0x2909('0x12')]('/',auth[_0x2909('0xa')](),controller[_0x2909('0x13')]);router['post'](_0x2909('0xe'),auth[_0x2909('0xa')](),controller[_0x2909('0x14')]);router[_0x2909('0x12')](_0x2909('0x10'),auth[_0x2909('0xa')](),controller[_0x2909('0x15')]);router['put'](_0x2909('0x16'),auth[_0x2909('0xa')](),controller[_0x2909('0x17')]);router[_0x2909('0x18')](_0x2909('0x16'),auth[_0x2909('0xa')](),controller[_0x2909('0x19')]);router[_0x2909('0x18')](_0x2909('0xe'),auth[_0x2909('0xa')](),controller[_0x2909('0x1a')]);router[_0x2909('0x18')](_0x2909('0x10'),auth[_0x2909('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x19d7=['/:id/users','post','create','addTeams','delete','removeTeams','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','isAuthenticated','index','get','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams'];(function(_0x5c8b19,_0x47d79a){var _0x2ff0cd=function(_0x3c1f53){while(--_0x3c1f53){_0x5c8b19['push'](_0x5c8b19['shift']());}};_0x2ff0cd(++_0x47d79a);}(_0x19d7,0x126));var _0x719d=function(_0x88735b,_0x416173){_0x88735b=_0x88735b-0x0;var _0x36ed4b=_0x19d7[_0x88735b];return _0x36ed4b;};'use strict';var multer=require(_0x719d('0x0'));var util=require(_0x719d('0x1'));var path=require(_0x719d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x719d('0x3')]();var fs_extra=require(_0x719d('0x4'));var auth=require(_0x719d('0x5'));var interaction=require(_0x719d('0x6'));var config=require('../../config/environment');var controller=require(_0x719d('0x7'));router['get']('/',auth[_0x719d('0x8')](),controller[_0x719d('0x9')]);router[_0x719d('0xa')](_0x719d('0xb'),auth[_0x719d('0x8')](),controller[_0x719d('0xc')]);router[_0x719d('0xa')]('/:id',auth[_0x719d('0x8')](),controller[_0x719d('0xd')]);router[_0x719d('0xa')](_0x719d('0xe'),auth[_0x719d('0x8')](),controller[_0x719d('0xf')]);router[_0x719d('0xa')](_0x719d('0x10'),auth['isAuthenticated'](),controller[_0x719d('0x11')]);router[_0x719d('0xa')](_0x719d('0x12'),auth[_0x719d('0x8')](),controller['getAgents']);router[_0x719d('0x13')]('/',auth[_0x719d('0x8')](),controller[_0x719d('0x14')]);router[_0x719d('0x13')]('/:id/teams',auth[_0x719d('0x8')](),controller[_0x719d('0x15')]);router[_0x719d('0x13')](_0x719d('0x12'),auth[_0x719d('0x8')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x719d('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x719d('0x16')](_0x719d('0x10'),auth[_0x719d('0x8')](),controller[_0x719d('0x17')]);router['delete'](_0x719d('0x12'),auth[_0x719d('0x8')](),controller[_0x719d('0x18')]);module[_0x719d('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index f7bfbcc..44bafb8 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 _0xe344=['rrmemory','roundrobin','sequelize','name','STRING','INTEGER','ENUM'];(function(_0x4f83ea,_0x4b484e){var _0x3e41f6=function(_0x5cfcdc){while(--_0x5cfcdc){_0x4f83ea['push'](_0x4f83ea['shift']());}};_0x3e41f6(++_0x4b484e);}(_0xe344,0x1a6));var _0x4e34=function(_0x27783d,_0x2dba3e){_0x27783d=_0x27783d-0x0;var _0xf1d97c=_0xe344[_0x27783d];return _0xf1d97c;};'use strict';var Sequelize=require(_0x4e34('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x4e34('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4e34('0x2')]},'timeout':{'type':Sequelize[_0x4e34('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4e34('0x4')](_0x4e34('0x5'),'beepall',_0x4e34('0x6'))}}; \ No newline at end of file +var _0x7a74=['roundrobin','sequelize','exports','STRING','name','ENUM','beepall'];(function(_0x281a38,_0x20fe7d){var _0x11ad45=function(_0x48d84e){while(--_0x48d84e){_0x281a38['push'](_0x281a38['shift']());}};_0x11ad45(++_0x20fe7d);}(_0x7a74,0xf6));var _0x47a7=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x7a74[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require(_0x47a7('0x0'));module[_0x47a7('0x1')]={'name':{'type':Sequelize[_0x47a7('0x2')],'unique':_0x47a7('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x47a7('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x47a7('0x4')]('rrmemory',_0x47a7('0x5'),_0x47a7('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index a33de08..19f5221 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 _0x861f=['transaction','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','api','redis','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','destroy','get','MailQueues','UserProfileResource','then','error','name','index','map','MailQueue','fieldName','type','key','getOptions','where','include','query','findAll','catch','show','model','keys','rawAttributes','intersection','attributes','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','findOne','UserMailQueue','filters','fields','length','hasOwnProperty','nolimit','sort','pick','MailQueueId','filter','options','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','rows','%s/%s','Team','order','getTeams','addTeams','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userMailQueue:save','ids','User','field','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','union','compact','value'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0x861f,0xf2));var _0xf861=function(_0x2f48cd,_0x46a75a){_0x2f48cd=_0x2f48cd-0x0;var _0x193ae2=_0x861f[_0x2f48cd];return _0x193ae2;};'use strict';var BPromise=require(_0xf861('0x0'));var util=require(_0xf861('0x1'));var _=require('lodash');var squel=require(_0xf861('0x2'));var Redis=require(_0xf861('0x3'));var qs=require(_0xf861('0x4'));var logger=require('../../config/logger')(_0xf861('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf861('0x6')]=_[_0xf861('0x7')](config[_0xf861('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xf861('0x8'))(new Redis(config[_0xf861('0x6')]));require(_0xf861('0x9'))[_0xf861('0xa')](socket);function respondWithStatusCode(_0x357dfe,_0x57a080){_0x57a080=_0x57a080||0xcc;return function(_0x5040b5){if(_0x5040b5){return _0x357dfe[_0xf861('0xb')](_0x57a080);}return _0x357dfe['status'](_0x57a080)['end']();};}function respondWithResult(_0x3f8602,_0x3afd27){_0x3afd27=_0x3afd27||0xc8;return function(_0x571bd5){if(_0x571bd5){return _0x3f8602[_0xf861('0xc')](_0x3afd27)[_0xf861('0xd')](_0x571bd5);}};}function respondWithFilteredResult(_0x449e2d,_0x24e21d){return function(_0x4e6605){if(_0x4e6605){var _0x488c20=typeof _0x24e21d[_0xf861('0xe')]===_0xf861('0xf')&&typeof _0x24e21d[_0xf861('0x10')]===_0xf861('0xf');var _0x10b55f=_0x4e6605[_0xf861('0x11')];var _0x26e59d=_0x488c20?0x0:_0x24e21d['offset'];var _0x1fe367=_0x488c20?_0x4e6605[_0xf861('0x11')]:_0x24e21d[_0xf861('0xe')]+_0x24e21d['limit'];var _0x5fb20d;if(_0x1fe367>=_0x10b55f){_0x1fe367=_0x10b55f;_0x5fb20d=0xc8;}else{_0x5fb20d=0xce;}_0x449e2d[_0xf861('0xc')](_0x5fb20d);return _0x449e2d[_0xf861('0x12')]('Content-Range',_0x26e59d+'-'+_0x1fe367+'/'+_0x10b55f)[_0xf861('0xd')](_0x4e6605);}return null;};}function saveUpdates(_0x288e59){return function(_0x134ec7){if(_0x134ec7){return _0x134ec7['update'](_0x288e59)['then'](function(_0xb1e44){return _0xb1e44;});}return null;};}function removeEntity(_0x1030aa){return function(_0x22567b){if(_0x22567b){return _0x22567b[_0xf861('0x13')]()['then'](function(){var _0x3b7424=_0x22567b[_0xf861('0x14')]({'plain':!![]});var _0x412e94=_0xf861('0x15');return db[_0xf861('0x16')]['destroy']({'where':{'type':_0x412e94,'resourceId':_0x3b7424['id']}})[_0xf861('0x17')](function(){return _0x22567b;});})[_0xf861('0x17')](function(){_0x1030aa[_0xf861('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5051ea){return function(_0x544b17){if(!_0x544b17){_0x5051ea[_0xf861('0xb')](0x194);}return _0x544b17;};}function handleError(_0x20fe45,_0x2d3676){_0x2d3676=_0x2d3676||0x1f4;return function(_0x4bc3fd){logger[_0xf861('0x18')](_0x4bc3fd['stack']);if(_0x4bc3fd['name']){delete _0x4bc3fd[_0xf861('0x19')];}_0x20fe45[_0xf861('0xc')](_0x2d3676)['send'](_0x4bc3fd);};}exports[_0xf861('0x1a')]=function(_0x244e37,_0x14f4f5){var _0x53654b={};var _0x4cdef3={'count':0x0,'rows':[]};var _0x5c578f=_[_0xf861('0x1b')](db[_0xf861('0x1c')]['rawAttributes'],function(_0x36a290){return{'name':_0x36a290[_0xf861('0x1d')],'type':_0x36a290[_0xf861('0x1e')][_0xf861('0x1f')]};});_0x53654b=qs[_0xf861('0x20')](_0x5c578f,_0x244e37);var _0x8af7e3={'where':_0x53654b[_0xf861('0x21')]};return db[_0xf861('0x1c')][_0xf861('0x11')](_0x8af7e3)[_0xf861('0x17')](function(_0x4fd832){_0x4cdef3['count']=_0x4fd832;_0x53654b[_0xf861('0x22')]=qs[_0xf861('0x22')](_0x244e37[_0xf861('0x23')]);return db[_0xf861('0x1c')][_0xf861('0x24')](_0x53654b);})[_0xf861('0x17')](function(_0x5b2518){_0x4cdef3['rows']=_0x5b2518;return _0x4cdef3;})[_0xf861('0x17')](respondWithFilteredResult(_0x14f4f5,_0x53654b))[_0xf861('0x25')](handleError(_0x14f4f5,null));};exports[_0xf861('0x26')]=function(_0x474b7e,_0x4d93f8){var _0x5496c3={'raw':!![],'where':{'id':_0x474b7e['params']['id']}},_0xcaa8d9={};_0xcaa8d9[_0xf861('0x27')]=_[_0xf861('0x28')](db[_0xf861('0x1c')][_0xf861('0x29')]);_0xcaa8d9[_0xf861('0x23')]=_['keys'](_0x474b7e['query']);_0xcaa8d9['filters']=_[_0xf861('0x2a')](_0xcaa8d9[_0xf861('0x27')],_0xcaa8d9['query']);_0x5496c3['attributes']=_[_0xf861('0x2a')](_0xcaa8d9[_0xf861('0x27')],qs['fields'](_0x474b7e['query']['fields']));_0x5496c3['attributes']=_0x5496c3[_0xf861('0x2b')]['length']?_0x5496c3[_0xf861('0x2b')]:_0xcaa8d9[_0xf861('0x27')];if(_0x474b7e[_0xf861('0x23')][_0xf861('0x2c')]){_0x5496c3[_0xf861('0x22')]=[{'all':!![]}];}_0x5496c3=_[_0xf861('0x2d')]({},_0x5496c3,_0x474b7e['options']);return db['MailQueue'][_0xf861('0x2e')](_0x5496c3)['then'](handleEntityNotFound(_0x4d93f8,null))[_0xf861('0x17')](respondWithResult(_0x4d93f8,null))[_0xf861('0x25')](handleError(_0x4d93f8,null));};exports[_0xf861('0x2f')]=function(_0x15f41d,_0x43ac19){return db[_0xf861('0x1c')][_0xf861('0x2f')](_0x15f41d[_0xf861('0x30')],{})['then'](function(_0x1a8d31){var _0x2534aa=_0x15f41d[_0xf861('0x31')][_0xf861('0x14')]({'plain':!![]});if(!_0x2534aa)throw new Error(_0xf861('0x32'));if(_0x2534aa[_0xf861('0x33')]===_0xf861('0x31')){var _0x338d1d=_0x1a8d31[_0xf861('0x14')]({'plain':!![]});var _0x35e298=_0xf861('0x15');return db[_0xf861('0x34')][_0xf861('0x2e')]({'where':{'name':_0x35e298,'userProfileId':_0x2534aa['userProfileId']},'raw':!![]})[_0xf861('0x17')](function(_0x19151d){if(_0x19151d&&_0x19151d[_0xf861('0x35')]===0x0){return db['UserProfileResource'][_0xf861('0x2f')]({'name':_0x338d1d[_0xf861('0x19')],'resourceId':_0x338d1d['id'],'type':_0x19151d['name'],'sectionId':_0x19151d['id']},{})[_0xf861('0x17')](function(){return _0x1a8d31;});}else{return _0x1a8d31;}})['catch'](function(_0x438722){logger['error'](_0xf861('0x36'),_0x438722);throw _0x438722;});}return _0x1a8d31;})[_0xf861('0x17')](respondWithResult(_0x43ac19,0xc9))['catch'](handleError(_0x43ac19,null));};exports[_0xf861('0x37')]=function(_0x2a08e4,_0xde6a5a){if(_0x2a08e4['body']['id']){delete _0x2a08e4['body']['id'];}return db[_0xf861('0x1c')]['find']({'where':{'id':_0x2a08e4[_0xf861('0x38')]['id']}})[_0xf861('0x17')](handleEntityNotFound(_0xde6a5a,null))['then'](saveUpdates(_0x2a08e4[_0xf861('0x30')],null))['then'](respondWithResult(_0xde6a5a,null))[_0xf861('0x25')](handleError(_0xde6a5a,null));};exports[_0xf861('0x13')]=function(_0x1b2f6f,_0x347146){return db['MailQueue'][_0xf861('0x2e')]({'where':{'id':_0x1b2f6f[_0xf861('0x38')]['id']}})[_0xf861('0x17')](handleEntityNotFound(_0x347146,null))[_0xf861('0x17')](removeEntity(_0x347146,null))[_0xf861('0x25')](handleError(_0x347146,null));};exports['describe']=function(_0x35eeba,_0x21b0b3){return db['MailQueue'][_0xf861('0x39')]()['then'](respondWithResult(_0x21b0b3,null))[_0xf861('0x25')](handleError(_0x21b0b3,null));};exports['getMembers']=function(_0x1fde40,_0x42a664){var _0x14e8f8={'raw':!![],'where':{}},_0x4fc776={},_0x42b917;return db[_0xf861('0x1c')][_0xf861('0x3a')]({'where':{'id':_0x1fde40[_0xf861('0x38')]['id']}})[_0xf861('0x17')](handleEntityNotFound(_0x42a664,null))[_0xf861('0x17')](function(_0x228a55){if(_0x228a55){_0x42b917=_0x228a55[_0xf861('0x14')]({'plain':!![]});_0x4fc776[_0xf861('0x27')]=_[_0xf861('0x28')](db[_0xf861('0x3b')][_0xf861('0x29')]);_0x4fc776[_0xf861('0x23')]=_['keys'](_0x1fde40[_0xf861('0x23')]);_0x4fc776[_0xf861('0x3c')]=_[_0xf861('0x2a')](_0x4fc776[_0xf861('0x27')],_0x4fc776[_0xf861('0x23')]);_0x14e8f8[_0xf861('0x2b')]=_['intersection'](_0x4fc776[_0xf861('0x27')],qs[_0xf861('0x3d')](_0x1fde40[_0xf861('0x23')][_0xf861('0x3d')]));_0x14e8f8[_0xf861('0x2b')]=_0x14e8f8['attributes'][_0xf861('0x3e')]?_0x14e8f8['attributes']:_0x4fc776['model'];if(!_0x1fde40[_0xf861('0x23')][_0xf861('0x3f')](_0xf861('0x40'))){_0x14e8f8['limit']=qs[_0xf861('0x10')](_0x1fde40['query']['limit']);_0x14e8f8['offset']=qs[_0xf861('0xe')](_0x1fde40[_0xf861('0x23')][_0xf861('0xe')]);}_0x14e8f8['order']=qs[_0xf861('0x41')](_0x1fde40[_0xf861('0x23')][_0xf861('0x41')]);_0x14e8f8['where']=qs[_0xf861('0x3c')](_[_0xf861('0x42')](_0x1fde40['query'],_0x4fc776[_0xf861('0x3c')]));_0x14e8f8[_0xf861('0x21')][_0xf861('0x43')]=_0x228a55['id'];if(_0x1fde40[_0xf861('0x23')][_0xf861('0x44')]){_0x14e8f8['where']=_[_0xf861('0x2d')](_0x14e8f8[_0xf861('0x21')],{'$or':_['map'](_0x14e8f8[_0xf861('0x2b')],function(_0x22de2e){var _0x576e61={};_0x576e61[_0x22de2e]={'$like':'%'+_0x1fde40[_0xf861('0x23')][_0xf861('0x44')]+'%'};return _0x576e61;})});}_0x14e8f8=_['merge']({},_0x14e8f8,_0x1fde40[_0xf861('0x45')]);return db['UserMailQueue'][_0xf861('0x24')](_0x14e8f8);}})[_0xf861('0x17')](function(_0x24dbc5){if(_0x24dbc5){return db['User'][_0xf861('0x46')]({'where':{'id':_[_0xf861('0x1b')](_0x24dbc5,_0xf861('0x47')),'role':_0xf861('0x48')},'attributes':['id','name',_0xf861('0x49'),_0xf861('0x4a'),_0xf861('0x4b')]});}})['then'](function(_0x497d60){if(_0x497d60){return{'count':_0x497d60['count'],'rows':_['map'](_0x497d60[_0xf861('0x4c')],function(_0x4db73b){return{'membername':_0x4db73b['name'],'UserId':_0x4db73b['id'],'queue_name':_0x42b917[_0xf861('0x19')],'MailQueueId':_0x42b917['id'],'interface':util['format'](_0xf861('0x4d'),'SIP',_0x4db73b[_0xf861('0x19')]),'penalty':0x0,'paused':_0x4db73b['mailPause'],'createdAt':_0x4db73b[_0xf861('0x4b')],'updatedAt':_0x4db73b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xf861('0x17')](respondWithFilteredResult(_0x42a664,_0x14e8f8))[_0xf861('0x25')](handleError(_0x42a664,null));};exports['getTeams']=function(_0xad5cb8,_0x292f4d){var _0x45e14d={};var _0x45992b={};var _0x185afb;var _0x16f47f;return db['MailQueue'][_0xf861('0x3a')]({'where':{'id':_0xad5cb8[_0xf861('0x38')]['id']}})[_0xf861('0x17')](handleEntityNotFound(_0x292f4d,null))[_0xf861('0x17')](function(_0x2abb13){if(_0x2abb13){_0x185afb=_0x2abb13;_0x45992b['model']=_[_0xf861('0x28')](db[_0xf861('0x4e')][_0xf861('0x29')]);_0x45992b[_0xf861('0x23')]=_['keys'](_0xad5cb8[_0xf861('0x23')]);_0x45992b[_0xf861('0x3c')]=_[_0xf861('0x2a')](_0x45992b['model'],_0x45992b['query']);_0x45e14d[_0xf861('0x2b')]=_[_0xf861('0x2a')](_0x45992b[_0xf861('0x27')],qs[_0xf861('0x3d')](_0xad5cb8[_0xf861('0x23')][_0xf861('0x3d')]));_0x45e14d[_0xf861('0x2b')]=_0x45e14d['attributes']['length']?_0x45e14d['attributes']:_0x45992b[_0xf861('0x27')];_0x45e14d[_0xf861('0x4f')]=qs[_0xf861('0x41')](_0xad5cb8[_0xf861('0x23')][_0xf861('0x41')]);_0x45e14d['where']=qs[_0xf861('0x3c')](_['pick'](_0xad5cb8[_0xf861('0x23')],_0x45992b[_0xf861('0x3c')]));if(_0xad5cb8[_0xf861('0x23')]['filter']){_0x45e14d[_0xf861('0x21')]=_['merge'](_0x45e14d[_0xf861('0x21')],{'$or':_[_0xf861('0x1b')](_0x45e14d[_0xf861('0x2b')],function(_0x535cb4){var _0x5c2ff5={};_0x5c2ff5[_0x535cb4]={'$like':'%'+_0xad5cb8[_0xf861('0x23')][_0xf861('0x44')]+'%'};return _0x5c2ff5;})});}_0x45e14d=_[_0xf861('0x2d')]({},_0x45e14d,_0xad5cb8[_0xf861('0x45')]);return _0x185afb[_0xf861('0x50')](_0x45e14d);}})[_0xf861('0x17')](function(_0x54b290){if(_0x54b290){_0x16f47f=_0x54b290[_0xf861('0x3e')];if(!_0xad5cb8[_0xf861('0x23')]['hasOwnProperty'](_0xf861('0x40'))){_0x45e14d[_0xf861('0x10')]=qs[_0xf861('0x10')](_0xad5cb8[_0xf861('0x23')][_0xf861('0x10')]);_0x45e14d[_0xf861('0xe')]=qs['offset'](_0xad5cb8[_0xf861('0x23')][_0xf861('0xe')]);}return _0x185afb[_0xf861('0x50')](_0x45e14d);}})['then'](function(_0x2931f3){if(_0x2931f3){return _0x2931f3?{'count':_0x16f47f,'rows':_0x2931f3}:null;}})[_0xf861('0x17')](respondWithResult(_0x292f4d,null))[_0xf861('0x25')](handleError(_0x292f4d,null));};exports[_0xf861('0x51')]=function(_0xf0d9e3,_0x490a29){var _0xc11130=_0xf0d9e3['body']['ids'];return db['Team'][_0xf861('0x24')]({'where':{'id':_0xc11130},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf861('0x52'),'attributes':['id',_0xf861('0x19'),'online',_0xf861('0x53'),_0xf861('0x54')],'raw':!![]}]})[_0xf861('0x17')](function(_0xbc9318){if(_0xbc9318){var _0x25fd37=_[_0xf861('0x55')](_0xbc9318,function(_0x4ceb16){var _0x3c1992=_0x4ceb16['get']({'plain':!![]});return _0x3c1992[_0xf861('0x52')];});return db[_0xf861('0x1c')][_0xf861('0x2e')]({'where':{'id':_0xf0d9e3[_0xf861('0x38')]['id']}})[_0xf861('0x17')](function(_0x50a77f){return db[_0xf861('0x56')]['transaction'](function(_0x3e8b57){return _0x50a77f[_0xf861('0x51')](_0xc11130,{'transaction':_0x3e8b57})[_0xf861('0x17')](function(){return BPromise[_0xf861('0x57')](_0x25fd37,function(_0x447f42){return db[_0xf861('0x3b')][_0xf861('0x58')]({'where':{'UserId':_0x447f42['id'],'MailQueueId':_0xf0d9e3[_0xf861('0x38')]['id']},'transaction':_0x3e8b57});});})[_0xf861('0x17')](function(){_0x25fd37[_0xf861('0x59')](function(_0x437707){socket[_0xf861('0x5a')](_0xf861('0x5b'),{'UserId':_0x437707['id'],'MailQueueId':_0x50a77f['id']});});});});});}})[_0xf861('0x17')](respondWithStatusCode(_0x490a29,null))[_0xf861('0x25')](handleError(_0x490a29,null));};exports['removeTeams']=function(_0xc684da,_0x36f8ef){return db['Team'][_0xf861('0x24')]({'where':{'id':_0xc684da[_0xf861('0x23')][_0xf861('0x5c')]},'attributes':['id'],'include':[{'model':db[_0xf861('0x5d')],'as':_0xf861('0x52'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x36f8ef,null))['then'](function(_0x5193cc){var _0x52fa1d=_[_0xf861('0x1b')](_0x5193cc,'id');var _0x417900=[];var _0x5c64a6=[];var _0x101ac1=squel['select']();_0x101ac1[_0xf861('0x5e')]('tq.TeamId')['from']('team_has_mail_queues','tq')['join']('user_has_teams','ut',_0xf861('0x5f'))[_0xf861('0x21')]('MailQueueId\x20=\x20?',_0xc684da[_0xf861('0x38')]['id']);for(var _0x1ec04e=0x0;_0x1ec04e<_0x5193cc[_0xf861('0x3e')];_0x1ec04e+=0x1){let _0x5ef212=_0x5193cc[_0x1ec04e];for(var _0x5ab8d3=0x0;_0x5ab8d3<_0x5ef212[_0xf861('0x52')]['length'];_0x5ab8d3+=0x1){let _0x94548a=_0x5ef212[_0xf861('0x52')][_0x5ab8d3];var _0x2354e2=_0x101ac1[_0xf861('0x60')]();_0x2354e2[_0xf861('0x21')](_0xf861('0x61'),_0x94548a['id']);_0x5c64a6[_0xf861('0x62')](db['sequelize'][_0xf861('0x23')](_0x2354e2['toString'](),{'type':db[_0xf861('0x56')][_0xf861('0x63')][_0xf861('0x64')]})[_0xf861('0x17')](function(_0x36f22b){if(_0x36f22b[_0xf861('0x3e')]===0x1){return _0x94548a['id'];}else{var _0x15d5ab=_[_0xf861('0x65')](_['map'](_0x36f22b,'TeamId'),function(_0x12e589){return _[_0xf861('0x66')](_0x52fa1d,_0x12e589);});if(_0x15d5ab){return _0x94548a['id'];}}}));}}return BPromise['all'](_0x5c64a6)['then'](function(_0x454a0f){_0x417900=_(_0x417900)[_0xf861('0x67')](_0x454a0f)[_0xf861('0x68')]()[_0xf861('0x69')]();return db[_0xf861('0x1c')][_0xf861('0x2e')]({'where':{'id':_0xc684da[_0xf861('0x38')]['id']}})[_0xf861('0x17')](function(_0x3a156c){return db[_0xf861('0x56')][_0xf861('0x6a')](function(_0x1c382e){return _0x3a156c[_0xf861('0x6b')](_0xc684da['query'][_0xf861('0x5c')],{'transaction':_0x1c382e})['then'](function(){if(!_[_0xf861('0x6c')](_0x417900)){return _0x3a156c[_0xf861('0x6d')](_0x417900,{'transaction':_0x1c382e});}})[_0xf861('0x17')](function(){_0x417900[_0xf861('0x59')](function(_0xc36e2c){socket['emit'](_0xf861('0x6e'),{'UserId':_0xc36e2c,'MailQueueId':_0x3a156c['id']});});});});});});})['then'](respondWithStatusCode(_0x36f8ef,null))['catch'](handleError(_0x36f8ef,null));};exports['addAgents']=function(_0x3e757a,_0x2c3a88){return db['MailQueue']['find']({'where':{'id':_0x3e757a['params']['id']}})[_0xf861('0x17')](handleEntityNotFound(_0x2c3a88,null))[_0xf861('0x17')](function(_0x5c5909){if(_0x5c5909){return _0x5c5909[_0xf861('0x6f')](_0x3e757a[_0xf861('0x30')][_0xf861('0x5c')],_[_0xf861('0x70')](_0x3e757a[_0xf861('0x30')],['ids','id'])||{})[_0xf861('0x71')](function(_0x40db1e){for(var _0x2f1591=0x0;_0x2f1591<_0x3e757a[_0xf861('0x30')]['ids'][_0xf861('0x3e')];_0x2f1591+=0x1){socket[_0xf861('0x5a')](_0xf861('0x5b'),{'UserId':Number(_0x3e757a[_0xf861('0x30')][_0xf861('0x5c')][_0x2f1591]),'MailQueueId':Number(_0x3e757a['params']['id'])});}return _0x40db1e;});}})['then'](respondWithResult(_0x2c3a88,null))['catch'](handleError(_0x2c3a88,null));};exports['removeAgents']=function(_0x3f0372,_0x19e300){return db['MailQueue'][_0xf861('0x2e')]({'where':{'id':_0x3f0372['params']['id']}})[_0xf861('0x17')](handleEntityNotFound(_0x19e300,null))[_0xf861('0x17')](function(_0x1e8c53){if(_0x1e8c53){return _0x1e8c53[_0xf861('0x6d')](_0x3f0372[_0xf861('0x23')][_0xf861('0x5c')])['then'](function(){if(_[_0xf861('0x72')](_0x3f0372[_0xf861('0x23')][_0xf861('0x5c')])){for(var _0x5a80e3=0x0;_0x5a80e3<_0x3f0372[_0xf861('0x23')][_0xf861('0x5c')]['length'];_0x5a80e3+=0x1){socket[_0xf861('0x5a')](_0xf861('0x6e'),{'UserId':Number(_0x3f0372[_0xf861('0x23')][_0xf861('0x5c')][_0x5a80e3]),'MailQueueId':Number(_0x3f0372[_0xf861('0x38')]['id'])});}}else{socket[_0xf861('0x5a')](_0xf861('0x6e'),{'UserId':Number(_0x3f0372['query'][_0xf861('0x5c')]),'MailQueueId':Number(_0x3f0372[_0xf861('0x38')]['id'])});}});}})['then'](respondWithStatusCode(_0x19e300,null))[_0xf861('0x25')](handleError(_0x19e300,null));};exports['getAgents']=function(_0x15e38d,_0x4f7416){var _0x245e88={};var _0x385874={};var _0x5609b2;var _0x5df15a;return db[_0xf861('0x1c')][_0xf861('0x3a')]({'where':{'id':_0x15e38d['params']['id']}})[_0xf861('0x17')](handleEntityNotFound(_0x4f7416,null))['then'](function(_0x556cab){if(_0x556cab){_0x5609b2=_0x556cab;_0x385874[_0xf861('0x27')]=_['keys'](db['User'][_0xf861('0x29')]);_0x385874[_0xf861('0x23')]=_[_0xf861('0x28')](_0x15e38d[_0xf861('0x23')]);_0x385874[_0xf861('0x3c')]=_['intersection'](_0x385874[_0xf861('0x27')],_0x385874['query']);_0x245e88[_0xf861('0x2b')]=_[_0xf861('0x2a')](_0x385874[_0xf861('0x27')],qs[_0xf861('0x3d')](_0x15e38d[_0xf861('0x23')][_0xf861('0x3d')]));_0x245e88['attributes']=_0x245e88[_0xf861('0x2b')][_0xf861('0x3e')]?_0x245e88[_0xf861('0x2b')]:_0x385874[_0xf861('0x27')];_0x245e88[_0xf861('0x4f')]=qs['sort'](_0x15e38d[_0xf861('0x23')][_0xf861('0x41')]);_0x245e88[_0xf861('0x21')]=qs[_0xf861('0x3c')](_['pick'](_0x15e38d[_0xf861('0x23')],_0x385874[_0xf861('0x3c')]));if(_0x15e38d[_0xf861('0x23')]['filter']){_0x245e88['where']=_[_0xf861('0x2d')](_0x245e88[_0xf861('0x21')],{'$or':_[_0xf861('0x1b')](_0x245e88[_0xf861('0x2b')],function(_0x5c4e5f){var _0x105cef={};_0x105cef[_0x5c4e5f]={'$like':'%'+_0x15e38d[_0xf861('0x23')][_0xf861('0x44')]+'%'};return _0x105cef;})});}_0x245e88=_[_0xf861('0x2d')]({},_0x245e88,_0x15e38d[_0xf861('0x45')]);return _0x5609b2['getAgents'](_0x245e88);}})[_0xf861('0x17')](function(_0x302c77){if(_0x302c77){_0x5df15a=_0x302c77['length'];if(!_0x15e38d[_0xf861('0x23')]['hasOwnProperty'](_0xf861('0x40'))){_0x245e88[_0xf861('0x10')]=qs['limit'](_0x15e38d[_0xf861('0x23')][_0xf861('0x10')]);_0x245e88[_0xf861('0xe')]=qs[_0xf861('0xe')](_0x15e38d[_0xf861('0x23')][_0xf861('0xe')]);}return _0x5609b2[_0xf861('0x73')](_0x245e88);}})[_0xf861('0x17')](function(_0x494477){if(_0x494477){return _0x494477?{'count':_0x5df15a,'rows':_0x494477}:null;}})['then'](respondWithResult(_0x4f7416,null))[_0xf861('0x25')](handleError(_0x4f7416,null));}; \ No newline at end of file +var _0x6cfc=['filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','filter','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','mailPause','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','status','end','json','undefined','count','offset','limit','Content-Range','update','then','destroy','MailQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','key','getOptions','where','include','rows','catch','show','params','model','keys','query'];(function(_0x567703,_0x4b1cfa){var _0x1cd94a=function(_0x25dcfe){while(--_0x25dcfe){_0x567703['push'](_0x567703['shift']());}};_0x1cd94a(++_0x4b1cfa);}(_0x6cfc,0x142));var _0xc6cf=function(_0x1fc4e2,_0x493c3b){_0x1fc4e2=_0x1fc4e2-0x0;var _0x2ba184=_0x6cfc[_0x1fc4e2];return _0x2ba184;};'use strict';var BPromise=require(_0xc6cf('0x0'));var util=require('util');var _=require(_0xc6cf('0x1'));var squel=require(_0xc6cf('0x2'));var Redis=require(_0xc6cf('0x3'));var qs=require(_0xc6cf('0x4'));var logger=require('../../config/logger')(_0xc6cf('0x5'));var config=require(_0xc6cf('0x6'));var db=require(_0xc6cf('0x7'))['db'];config[_0xc6cf('0x8')]=_[_0xc6cf('0x9')](config[_0xc6cf('0x8')],{'host':_0xc6cf('0xa'),'port':0x18eb});var socket=require(_0xc6cf('0xb'))(new Redis(config[_0xc6cf('0x8')]));require(_0xc6cf('0xc'))['register'](socket);function respondWithStatusCode(_0x4302a9,_0x565a9d){_0x565a9d=_0x565a9d||0xcc;return function(_0x5294a8){if(_0x5294a8){return _0x4302a9['sendStatus'](_0x565a9d);}return _0x4302a9[_0xc6cf('0xd')](_0x565a9d)[_0xc6cf('0xe')]();};}function respondWithResult(_0x3a75a6,_0x53ed83){_0x53ed83=_0x53ed83||0xc8;return function(_0xdca71){if(_0xdca71){return _0x3a75a6[_0xc6cf('0xd')](_0x53ed83)[_0xc6cf('0xf')](_0xdca71);}};}function respondWithFilteredResult(_0x1c4f52,_0x34ff2b){return function(_0x35a0c6){if(_0x35a0c6){var _0x40795e=typeof _0x34ff2b['offset']===_0xc6cf('0x10')&&typeof _0x34ff2b['limit']===_0xc6cf('0x10');var _0x5bd7bd=_0x35a0c6[_0xc6cf('0x11')];var _0x5cbf39=_0x40795e?0x0:_0x34ff2b['offset'];var _0x5c6824=_0x40795e?_0x35a0c6['count']:_0x34ff2b[_0xc6cf('0x12')]+_0x34ff2b[_0xc6cf('0x13')];var _0x4a7108;if(_0x5c6824>=_0x5bd7bd){_0x5c6824=_0x5bd7bd;_0x4a7108=0xc8;}else{_0x4a7108=0xce;}_0x1c4f52[_0xc6cf('0xd')](_0x4a7108);return _0x1c4f52['set'](_0xc6cf('0x14'),_0x5cbf39+'-'+_0x5c6824+'/'+_0x5bd7bd)[_0xc6cf('0xf')](_0x35a0c6);}return null;};}function saveUpdates(_0x3a8954){return function(_0x8f421d){if(_0x8f421d){return _0x8f421d[_0xc6cf('0x15')](_0x3a8954)[_0xc6cf('0x16')](function(_0x2ef534){return _0x2ef534;});}return null;};}function removeEntity(_0x528ee6){return function(_0xf0d7bc){if(_0xf0d7bc){return _0xf0d7bc[_0xc6cf('0x17')]()[_0xc6cf('0x16')](function(){var _0x997f1e=_0xf0d7bc['get']({'plain':!![]});var _0x35c1f1=_0xc6cf('0x18');return db[_0xc6cf('0x19')][_0xc6cf('0x17')]({'where':{'type':_0x35c1f1,'resourceId':_0x997f1e['id']}})[_0xc6cf('0x16')](function(){return _0xf0d7bc;});})[_0xc6cf('0x16')](function(){_0x528ee6[_0xc6cf('0xd')](0xcc)[_0xc6cf('0xe')]();});}};}function handleEntityNotFound(_0x33f1ac){return function(_0x4a1919){if(!_0x4a1919){_0x33f1ac[_0xc6cf('0x1a')](0x194);}return _0x4a1919;};}function handleError(_0x2d1348,_0x26a302){_0x26a302=_0x26a302||0x1f4;return function(_0xdbabd0){logger[_0xc6cf('0x1b')](_0xdbabd0[_0xc6cf('0x1c')]);if(_0xdbabd0[_0xc6cf('0x1d')]){delete _0xdbabd0[_0xc6cf('0x1d')];}_0x2d1348[_0xc6cf('0xd')](_0x26a302)[_0xc6cf('0x1e')](_0xdbabd0);};}exports[_0xc6cf('0x1f')]=function(_0x3561cb,_0x4df727){var _0x356043={};var _0x41a4ec={'count':0x0,'rows':[]};var _0x5b13bf=_[_0xc6cf('0x20')](db[_0xc6cf('0x21')][_0xc6cf('0x22')],function(_0x10fc33){return{'name':_0x10fc33[_0xc6cf('0x23')],'type':_0x10fc33['type'][_0xc6cf('0x24')]};});_0x356043=qs[_0xc6cf('0x25')](_0x5b13bf,_0x3561cb);var _0x25c296={'where':_0x356043[_0xc6cf('0x26')]};return db[_0xc6cf('0x21')][_0xc6cf('0x11')](_0x25c296)[_0xc6cf('0x16')](function(_0x3ba061){_0x41a4ec[_0xc6cf('0x11')]=_0x3ba061;_0x356043[_0xc6cf('0x27')]=qs[_0xc6cf('0x27')](_0x3561cb['query']);return db[_0xc6cf('0x21')]['findAll'](_0x356043);})[_0xc6cf('0x16')](function(_0xb3387a){_0x41a4ec[_0xc6cf('0x28')]=_0xb3387a;return _0x41a4ec;})[_0xc6cf('0x16')](respondWithFilteredResult(_0x4df727,_0x356043))[_0xc6cf('0x29')](handleError(_0x4df727,null));};exports[_0xc6cf('0x2a')]=function(_0x45832f,_0x51d062){var _0x579c3f={'raw':!![],'where':{'id':_0x45832f[_0xc6cf('0x2b')]['id']}},_0x4ebd56={};_0x4ebd56[_0xc6cf('0x2c')]=_[_0xc6cf('0x2d')](db['MailQueue'][_0xc6cf('0x22')]);_0x4ebd56[_0xc6cf('0x2e')]=_[_0xc6cf('0x2d')](_0x45832f[_0xc6cf('0x2e')]);_0x4ebd56[_0xc6cf('0x2f')]=_[_0xc6cf('0x30')](_0x4ebd56[_0xc6cf('0x2c')],_0x4ebd56[_0xc6cf('0x2e')]);_0x579c3f[_0xc6cf('0x31')]=_['intersection'](_0x4ebd56[_0xc6cf('0x2c')],qs[_0xc6cf('0x32')](_0x45832f['query']['fields']));_0x579c3f[_0xc6cf('0x31')]=_0x579c3f['attributes'][_0xc6cf('0x33')]?_0x579c3f[_0xc6cf('0x31')]:_0x4ebd56['model'];if(_0x45832f[_0xc6cf('0x2e')][_0xc6cf('0x34')]){_0x579c3f['include']=[{'all':!![]}];}_0x579c3f=_[_0xc6cf('0x35')]({},_0x579c3f,_0x45832f[_0xc6cf('0x36')]);return db[_0xc6cf('0x21')][_0xc6cf('0x37')](_0x579c3f)[_0xc6cf('0x16')](handleEntityNotFound(_0x51d062,null))['then'](respondWithResult(_0x51d062,null))[_0xc6cf('0x29')](handleError(_0x51d062,null));};exports[_0xc6cf('0x38')]=function(_0x11d5ec,_0x1db36c){return db[_0xc6cf('0x21')][_0xc6cf('0x38')](_0x11d5ec['body'],{})[_0xc6cf('0x16')](function(_0x29a2a9){var _0xff78d8=_0x11d5ec['user']['get']({'plain':!![]});if(!_0xff78d8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xff78d8['role']===_0xc6cf('0x39')){var _0x54fa84=_0x29a2a9[_0xc6cf('0x3a')]({'plain':!![]});var _0x410858=_0xc6cf('0x18');return db[_0xc6cf('0x3b')][_0xc6cf('0x37')]({'where':{'name':_0x410858,'userProfileId':_0xff78d8[_0xc6cf('0x3c')]},'raw':!![]})[_0xc6cf('0x16')](function(_0x3d0a7b){if(_0x3d0a7b&&_0x3d0a7b[_0xc6cf('0x3d')]===0x0){return db['UserProfileResource'][_0xc6cf('0x38')]({'name':_0x54fa84['name'],'resourceId':_0x54fa84['id'],'type':_0x3d0a7b[_0xc6cf('0x1d')],'sectionId':_0x3d0a7b['id']},{})[_0xc6cf('0x16')](function(){return _0x29a2a9;});}else{return _0x29a2a9;}})[_0xc6cf('0x29')](function(_0x4d1d87){logger['error'](_0xc6cf('0x3e'),_0x4d1d87);throw _0x4d1d87;});}return _0x29a2a9;})[_0xc6cf('0x16')](respondWithResult(_0x1db36c,0xc9))['catch'](handleError(_0x1db36c,null));};exports[_0xc6cf('0x15')]=function(_0x4100da,_0x115161){if(_0x4100da[_0xc6cf('0x3f')]['id']){delete _0x4100da[_0xc6cf('0x3f')]['id'];}return db[_0xc6cf('0x21')][_0xc6cf('0x37')]({'where':{'id':_0x4100da[_0xc6cf('0x2b')]['id']}})[_0xc6cf('0x16')](handleEntityNotFound(_0x115161,null))[_0xc6cf('0x16')](saveUpdates(_0x4100da[_0xc6cf('0x3f')],null))['then'](respondWithResult(_0x115161,null))[_0xc6cf('0x29')](handleError(_0x115161,null));};exports[_0xc6cf('0x17')]=function(_0x59225b,_0x474c7d){return db['MailQueue'][_0xc6cf('0x37')]({'where':{'id':_0x59225b[_0xc6cf('0x2b')]['id']}})['then'](handleEntityNotFound(_0x474c7d,null))[_0xc6cf('0x16')](removeEntity(_0x474c7d,null))['catch'](handleError(_0x474c7d,null));};exports['describe']=function(_0x354893,_0x216718){return db['MailQueue'][_0xc6cf('0x40')]()[_0xc6cf('0x16')](respondWithResult(_0x216718,null))[_0xc6cf('0x29')](handleError(_0x216718,null));};exports[_0xc6cf('0x41')]=function(_0x3b6e9f,_0x1d5fcd){var _0x514396={'raw':!![],'where':{}},_0x5bdfbf={},_0x353b0d;return db['MailQueue'][_0xc6cf('0x42')]({'where':{'id':_0x3b6e9f['params']['id']}})[_0xc6cf('0x16')](handleEntityNotFound(_0x1d5fcd,null))['then'](function(_0x4de440){if(_0x4de440){_0x353b0d=_0x4de440[_0xc6cf('0x3a')]({'plain':!![]});_0x5bdfbf['model']=_[_0xc6cf('0x2d')](db[_0xc6cf('0x43')][_0xc6cf('0x22')]);_0x5bdfbf[_0xc6cf('0x2e')]=_[_0xc6cf('0x2d')](_0x3b6e9f[_0xc6cf('0x2e')]);_0x5bdfbf[_0xc6cf('0x2f')]=_['intersection'](_0x5bdfbf[_0xc6cf('0x2c')],_0x5bdfbf[_0xc6cf('0x2e')]);_0x514396[_0xc6cf('0x31')]=_[_0xc6cf('0x30')](_0x5bdfbf[_0xc6cf('0x2c')],qs[_0xc6cf('0x32')](_0x3b6e9f['query'][_0xc6cf('0x32')]));_0x514396[_0xc6cf('0x31')]=_0x514396[_0xc6cf('0x31')][_0xc6cf('0x33')]?_0x514396[_0xc6cf('0x31')]:_0x5bdfbf[_0xc6cf('0x2c')];if(!_0x3b6e9f[_0xc6cf('0x2e')][_0xc6cf('0x44')](_0xc6cf('0x45'))){_0x514396[_0xc6cf('0x13')]=qs[_0xc6cf('0x13')](_0x3b6e9f['query'][_0xc6cf('0x13')]);_0x514396[_0xc6cf('0x12')]=qs[_0xc6cf('0x12')](_0x3b6e9f[_0xc6cf('0x2e')][_0xc6cf('0x12')]);}_0x514396[_0xc6cf('0x46')]=qs[_0xc6cf('0x47')](_0x3b6e9f['query'][_0xc6cf('0x47')]);_0x514396[_0xc6cf('0x26')]=qs['filters'](_[_0xc6cf('0x48')](_0x3b6e9f[_0xc6cf('0x2e')],_0x5bdfbf['filters']));_0x514396[_0xc6cf('0x26')][_0xc6cf('0x49')]=_0x4de440['id'];if(_0x3b6e9f[_0xc6cf('0x2e')][_0xc6cf('0x4a')]){_0x514396[_0xc6cf('0x26')]=_[_0xc6cf('0x35')](_0x514396[_0xc6cf('0x26')],{'$or':_['map'](_0x514396[_0xc6cf('0x31')],function(_0x3322d8){var _0x4f076a={};_0x4f076a[_0x3322d8]={'$like':'%'+_0x3b6e9f['query'][_0xc6cf('0x4a')]+'%'};return _0x4f076a;})});}_0x514396=_['merge']({},_0x514396,_0x3b6e9f[_0xc6cf('0x36')]);return db[_0xc6cf('0x43')][_0xc6cf('0x4b')](_0x514396);}})[_0xc6cf('0x16')](function(_0x316172){if(_0x316172){return db[_0xc6cf('0x4c')][_0xc6cf('0x4d')]({'where':{'id':_[_0xc6cf('0x20')](_0x316172,_0xc6cf('0x4e')),'role':_0xc6cf('0x4f')},'attributes':['id',_0xc6cf('0x1d'),'mailPause',_0xc6cf('0x50'),_0xc6cf('0x51')]});}})['then'](function(_0x8db913){if(_0x8db913){return{'count':_0x8db913['count'],'rows':_['map'](_0x8db913['rows'],function(_0x455c73){return{'membername':_0x455c73[_0xc6cf('0x1d')],'UserId':_0x455c73['id'],'queue_name':_0x353b0d[_0xc6cf('0x1d')],'MailQueueId':_0x353b0d['id'],'interface':util[_0xc6cf('0x52')](_0xc6cf('0x53'),'SIP',_0x455c73[_0xc6cf('0x1d')]),'penalty':0x0,'paused':_0x455c73[_0xc6cf('0x54')],'createdAt':_0x455c73['createdAt'],'updatedAt':_0x455c73[_0xc6cf('0x50')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc6cf('0x16')](respondWithFilteredResult(_0x1d5fcd,_0x514396))['catch'](handleError(_0x1d5fcd,null));};exports[_0xc6cf('0x55')]=function(_0x22e8e2,_0x52d019){var _0x224edb={};var _0x4f2ae5={};var _0x1ebd80;var _0x3c0e81;return db['MailQueue']['findOne']({'where':{'id':_0x22e8e2[_0xc6cf('0x2b')]['id']}})['then'](handleEntityNotFound(_0x52d019,null))['then'](function(_0x4f9bb3){if(_0x4f9bb3){_0x1ebd80=_0x4f9bb3;_0x4f2ae5[_0xc6cf('0x2c')]=_[_0xc6cf('0x2d')](db[_0xc6cf('0x56')][_0xc6cf('0x22')]);_0x4f2ae5[_0xc6cf('0x2e')]=_[_0xc6cf('0x2d')](_0x22e8e2['query']);_0x4f2ae5['filters']=_[_0xc6cf('0x30')](_0x4f2ae5[_0xc6cf('0x2c')],_0x4f2ae5[_0xc6cf('0x2e')]);_0x224edb[_0xc6cf('0x31')]=_[_0xc6cf('0x30')](_0x4f2ae5[_0xc6cf('0x2c')],qs[_0xc6cf('0x32')](_0x22e8e2[_0xc6cf('0x2e')][_0xc6cf('0x32')]));_0x224edb['attributes']=_0x224edb[_0xc6cf('0x31')]['length']?_0x224edb['attributes']:_0x4f2ae5[_0xc6cf('0x2c')];_0x224edb[_0xc6cf('0x46')]=qs[_0xc6cf('0x47')](_0x22e8e2['query'][_0xc6cf('0x47')]);_0x224edb[_0xc6cf('0x26')]=qs[_0xc6cf('0x2f')](_[_0xc6cf('0x48')](_0x22e8e2[_0xc6cf('0x2e')],_0x4f2ae5[_0xc6cf('0x2f')]));if(_0x22e8e2[_0xc6cf('0x2e')][_0xc6cf('0x4a')]){_0x224edb[_0xc6cf('0x26')]=_[_0xc6cf('0x35')](_0x224edb[_0xc6cf('0x26')],{'$or':_[_0xc6cf('0x20')](_0x224edb[_0xc6cf('0x31')],function(_0x5db79d){var _0x474182={};_0x474182[_0x5db79d]={'$like':'%'+_0x22e8e2[_0xc6cf('0x2e')]['filter']+'%'};return _0x474182;})});}_0x224edb=_[_0xc6cf('0x35')]({},_0x224edb,_0x22e8e2[_0xc6cf('0x36')]);return _0x1ebd80[_0xc6cf('0x55')](_0x224edb);}})[_0xc6cf('0x16')](function(_0xd1905c){if(_0xd1905c){_0x3c0e81=_0xd1905c[_0xc6cf('0x33')];if(!_0x22e8e2[_0xc6cf('0x2e')][_0xc6cf('0x44')](_0xc6cf('0x45'))){_0x224edb['limit']=qs[_0xc6cf('0x13')](_0x22e8e2[_0xc6cf('0x2e')][_0xc6cf('0x13')]);_0x224edb[_0xc6cf('0x12')]=qs[_0xc6cf('0x12')](_0x22e8e2[_0xc6cf('0x2e')][_0xc6cf('0x12')]);}return _0x1ebd80[_0xc6cf('0x55')](_0x224edb);}})[_0xc6cf('0x16')](function(_0x54b4c0){if(_0x54b4c0){return _0x54b4c0?{'count':_0x3c0e81,'rows':_0x54b4c0}:null;}})['then'](respondWithResult(_0x52d019,null))[_0xc6cf('0x29')](handleError(_0x52d019,null));};exports[_0xc6cf('0x57')]=function(_0x5b39a9,_0x1f9095){var _0xe04770=_0x5b39a9['body'][_0xc6cf('0x58')];return db[_0xc6cf('0x56')]['findAll']({'where':{'id':_0xe04770},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc6cf('0x59'),'attributes':['id',_0xc6cf('0x1d'),_0xc6cf('0x5a'),'voicePause',_0xc6cf('0x5b')],'raw':!![]}]})['then'](function(_0x44dce6){if(_0x44dce6){var _0x303851=_[_0xc6cf('0x5c')](_0x44dce6,function(_0x4f44e1){var _0x5e7169=_0x4f44e1['get']({'plain':!![]});return _0x5e7169[_0xc6cf('0x59')];});return db[_0xc6cf('0x21')][_0xc6cf('0x37')]({'where':{'id':_0x5b39a9[_0xc6cf('0x2b')]['id']}})[_0xc6cf('0x16')](function(_0x53e834){return db[_0xc6cf('0x5d')][_0xc6cf('0x5e')](function(_0x4efb71){return _0x53e834[_0xc6cf('0x57')](_0xe04770,{'transaction':_0x4efb71})[_0xc6cf('0x16')](function(){return BPromise[_0xc6cf('0x5f')](_0x303851,function(_0x1cad81){return db['UserMailQueue'][_0xc6cf('0x60')]({'where':{'UserId':_0x1cad81['id'],'MailQueueId':_0x5b39a9[_0xc6cf('0x2b')]['id']},'transaction':_0x4efb71});});})[_0xc6cf('0x16')](function(){_0x303851[_0xc6cf('0x61')](function(_0x37092e){socket[_0xc6cf('0x62')](_0xc6cf('0x63'),{'UserId':_0x37092e['id'],'MailQueueId':_0x53e834['id']});});});});});}})[_0xc6cf('0x16')](respondWithStatusCode(_0x1f9095,null))[_0xc6cf('0x29')](handleError(_0x1f9095,null));};exports[_0xc6cf('0x64')]=function(_0x57a9f6,_0x46df6e){return db[_0xc6cf('0x56')][_0xc6cf('0x4b')]({'where':{'id':_0x57a9f6[_0xc6cf('0x2e')][_0xc6cf('0x58')]},'attributes':['id'],'include':[{'model':db[_0xc6cf('0x4c')],'as':_0xc6cf('0x59'),'attributes':['id'],'raw':!![]}]})[_0xc6cf('0x16')](handleEntityNotFound(_0x46df6e,null))[_0xc6cf('0x16')](function(_0x1f41d3){var _0x40b5a9=_['map'](_0x1f41d3,'id');var _0x3affd0=[];var _0x2799ea=[];var _0x5af6d0=squel[_0xc6cf('0x65')]();_0x5af6d0['field']('tq.TeamId')['from']('team_has_mail_queues','tq')[_0xc6cf('0x66')](_0xc6cf('0x67'),'ut',_0xc6cf('0x68'))['where'](_0xc6cf('0x69'),_0x57a9f6['params']['id']);for(var _0x468aa6=0x0;_0x468aa6<_0x1f41d3[_0xc6cf('0x33')];_0x468aa6+=0x1){let _0x31045e=_0x1f41d3[_0x468aa6];for(var _0x2d9643=0x0;_0x2d9643<_0x31045e[_0xc6cf('0x59')][_0xc6cf('0x33')];_0x2d9643+=0x1){let _0x181edd=_0x31045e[_0xc6cf('0x59')][_0x2d9643];var _0x449856=_0x5af6d0[_0xc6cf('0x6a')]();_0x449856[_0xc6cf('0x26')](_0xc6cf('0x6b'),_0x181edd['id']);_0x2799ea[_0xc6cf('0x6c')](db[_0xc6cf('0x5d')][_0xc6cf('0x2e')](_0x449856['toString'](),{'type':db['sequelize'][_0xc6cf('0x6d')]['SELECT']})[_0xc6cf('0x16')](function(_0x38daad){if(_0x38daad[_0xc6cf('0x33')]===0x1){return _0x181edd['id'];}else{var _0x42ef25=_[_0xc6cf('0x6e')](_[_0xc6cf('0x20')](_0x38daad,_0xc6cf('0x6f')),function(_0x22aad4){return _[_0xc6cf('0x70')](_0x40b5a9,_0x22aad4);});if(_0x42ef25){return _0x181edd['id'];}}}));}}return BPromise[_0xc6cf('0x71')](_0x2799ea)['then'](function(_0x401d94){_0x3affd0=_(_0x3affd0)[_0xc6cf('0x72')](_0x401d94)[_0xc6cf('0x73')]()[_0xc6cf('0x74')]();return db[_0xc6cf('0x21')][_0xc6cf('0x37')]({'where':{'id':_0x57a9f6[_0xc6cf('0x2b')]['id']}})['then'](function(_0x24677c){return db[_0xc6cf('0x5d')][_0xc6cf('0x5e')](function(_0x3a5c1e){return _0x24677c[_0xc6cf('0x64')](_0x57a9f6[_0xc6cf('0x2e')]['ids'],{'transaction':_0x3a5c1e})[_0xc6cf('0x16')](function(){if(!_[_0xc6cf('0x75')](_0x3affd0)){return _0x24677c[_0xc6cf('0x76')](_0x3affd0,{'transaction':_0x3a5c1e});}})[_0xc6cf('0x16')](function(){_0x3affd0['forEach'](function(_0x2a5f0e){socket[_0xc6cf('0x62')](_0xc6cf('0x77'),{'UserId':_0x2a5f0e,'MailQueueId':_0x24677c['id']});});});});});});})['then'](respondWithStatusCode(_0x46df6e,null))[_0xc6cf('0x29')](handleError(_0x46df6e,null));};exports[_0xc6cf('0x78')]=function(_0x5db3f2,_0x3c059e){return db['MailQueue']['find']({'where':{'id':_0x5db3f2[_0xc6cf('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3c059e,null))[_0xc6cf('0x16')](function(_0xa83bed){if(_0xa83bed){return _0xa83bed['addAgents'](_0x5db3f2[_0xc6cf('0x3f')][_0xc6cf('0x58')],_['omit'](_0x5db3f2['body'],[_0xc6cf('0x58'),'id'])||{})[_0xc6cf('0x79')](function(_0x25fb21){for(var _0x27b118=0x0;_0x27b118<_0x5db3f2[_0xc6cf('0x3f')][_0xc6cf('0x58')][_0xc6cf('0x33')];_0x27b118+=0x1){socket[_0xc6cf('0x62')](_0xc6cf('0x63'),{'UserId':Number(_0x5db3f2[_0xc6cf('0x3f')][_0xc6cf('0x58')][_0x27b118]),'MailQueueId':Number(_0x5db3f2[_0xc6cf('0x2b')]['id'])});}return _0x25fb21;});}})[_0xc6cf('0x16')](respondWithResult(_0x3c059e,null))[_0xc6cf('0x29')](handleError(_0x3c059e,null));};exports[_0xc6cf('0x76')]=function(_0x5ac47f,_0x351544){return db[_0xc6cf('0x21')][_0xc6cf('0x37')]({'where':{'id':_0x5ac47f[_0xc6cf('0x2b')]['id']}})[_0xc6cf('0x16')](handleEntityNotFound(_0x351544,null))['then'](function(_0x586b7c){if(_0x586b7c){return _0x586b7c[_0xc6cf('0x76')](_0x5ac47f[_0xc6cf('0x2e')][_0xc6cf('0x58')])['then'](function(){if(_['isArray'](_0x5ac47f[_0xc6cf('0x2e')][_0xc6cf('0x58')])){for(var _0x2f325f=0x0;_0x2f325f<_0x5ac47f[_0xc6cf('0x2e')][_0xc6cf('0x58')][_0xc6cf('0x33')];_0x2f325f+=0x1){socket[_0xc6cf('0x62')](_0xc6cf('0x77'),{'UserId':Number(_0x5ac47f[_0xc6cf('0x2e')][_0xc6cf('0x58')][_0x2f325f]),'MailQueueId':Number(_0x5ac47f[_0xc6cf('0x2b')]['id'])});}}else{socket[_0xc6cf('0x62')](_0xc6cf('0x77'),{'UserId':Number(_0x5ac47f[_0xc6cf('0x2e')][_0xc6cf('0x58')]),'MailQueueId':Number(_0x5ac47f['params']['id'])});}});}})[_0xc6cf('0x16')](respondWithStatusCode(_0x351544,null))['catch'](handleError(_0x351544,null));};exports[_0xc6cf('0x7a')]=function(_0x2acb93,_0x17eafd){var _0x4b7cea={};var _0x3e8b86={};var _0x580407;var _0x30a771;return db[_0xc6cf('0x21')][_0xc6cf('0x42')]({'where':{'id':_0x2acb93[_0xc6cf('0x2b')]['id']}})['then'](handleEntityNotFound(_0x17eafd,null))['then'](function(_0x261d6f){if(_0x261d6f){_0x580407=_0x261d6f;_0x3e8b86[_0xc6cf('0x2c')]=_[_0xc6cf('0x2d')](db['User']['rawAttributes']);_0x3e8b86['query']=_[_0xc6cf('0x2d')](_0x2acb93['query']);_0x3e8b86['filters']=_['intersection'](_0x3e8b86[_0xc6cf('0x2c')],_0x3e8b86['query']);_0x4b7cea['attributes']=_['intersection'](_0x3e8b86[_0xc6cf('0x2c')],qs[_0xc6cf('0x32')](_0x2acb93[_0xc6cf('0x2e')][_0xc6cf('0x32')]));_0x4b7cea[_0xc6cf('0x31')]=_0x4b7cea['attributes'][_0xc6cf('0x33')]?_0x4b7cea[_0xc6cf('0x31')]:_0x3e8b86['model'];_0x4b7cea[_0xc6cf('0x46')]=qs[_0xc6cf('0x47')](_0x2acb93[_0xc6cf('0x2e')][_0xc6cf('0x47')]);_0x4b7cea['where']=qs[_0xc6cf('0x2f')](_[_0xc6cf('0x48')](_0x2acb93['query'],_0x3e8b86[_0xc6cf('0x2f')]));if(_0x2acb93[_0xc6cf('0x2e')][_0xc6cf('0x4a')]){_0x4b7cea[_0xc6cf('0x26')]=_[_0xc6cf('0x35')](_0x4b7cea[_0xc6cf('0x26')],{'$or':_[_0xc6cf('0x20')](_0x4b7cea[_0xc6cf('0x31')],function(_0x106c51){var _0x1616d3={};_0x1616d3[_0x106c51]={'$like':'%'+_0x2acb93[_0xc6cf('0x2e')][_0xc6cf('0x4a')]+'%'};return _0x1616d3;})});}_0x4b7cea=_[_0xc6cf('0x35')]({},_0x4b7cea,_0x2acb93[_0xc6cf('0x36')]);return _0x580407[_0xc6cf('0x7a')](_0x4b7cea);}})[_0xc6cf('0x16')](function(_0x2be094){if(_0x2be094){_0x30a771=_0x2be094[_0xc6cf('0x33')];if(!_0x2acb93[_0xc6cf('0x2e')][_0xc6cf('0x44')](_0xc6cf('0x45'))){_0x4b7cea[_0xc6cf('0x13')]=qs[_0xc6cf('0x13')](_0x2acb93['query']['limit']);_0x4b7cea[_0xc6cf('0x12')]=qs[_0xc6cf('0x12')](_0x2acb93[_0xc6cf('0x2e')]['offset']);}return _0x580407[_0xc6cf('0x7a')](_0x4b7cea);}})[_0xc6cf('0x16')](function(_0x4eb176){if(_0x4eb176){return _0x4eb176?{'count':_0x30a771,'rows':_0x4eb176}:null;}})[_0xc6cf('0x16')](respondWithResult(_0x17eafd,null))['catch'](handleError(_0x17eafd,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 22b1dbb..21abed1 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 _0x3333=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x3333,0x12c));var _0x3333=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0x3333[_0x2a7b8e];return _0x29b5c8;};'use strict';var EventEmitter=require(_0x3333('0x0'));var MailQueue=require(_0x3333('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x3333('0x2')](0x0);var events={'afterCreate':_0x3333('0x3'),'afterUpdate':'update','afterDestroy':_0x3333('0x4')};function emitEvent(_0x278825){return function(_0x545019,_0x472de0,_0xd80100){MailQueueEvents[_0x3333('0x5')](_0x278825+':'+_0x545019['id'],_0x545019);MailQueueEvents['emit'](_0x278825,_0x545019);_0xd80100(null);};}for(var e in events){if(events[_0x3333('0x6')](e)){var event=events[e];MailQueue[_0x3333('0x7')](e,emitEvent(event));}}module[_0x3333('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x6de5=['save','update','remove','emit','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x3ef2d5,_0x423d46){var _0x2fefb2=function(_0x54f82f){while(--_0x54f82f){_0x3ef2d5['push'](_0x3ef2d5['shift']());}};_0x2fefb2(++_0x423d46);}(_0x6de5,0x1b4));var _0x56de=function(_0x182cbc,_0x341d97){_0x182cbc=_0x182cbc-0x0;var _0x3bb31d=_0x6de5[_0x182cbc];return _0x3bb31d;};'use strict';var EventEmitter=require(_0x56de('0x0'));var MailQueue=require(_0x56de('0x1'))['db'][_0x56de('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x56de('0x3')](0x0);var events={'afterCreate':_0x56de('0x4'),'afterUpdate':_0x56de('0x5'),'afterDestroy':_0x56de('0x6')};function emitEvent(_0x4d32e5){return function(_0x5dd0ac,_0x23c53f,_0x96367b){MailQueueEvents[_0x56de('0x7')](_0x4d32e5+':'+_0x5dd0ac['id'],_0x5dd0ac);MailQueueEvents[_0x56de('0x7')](_0x4d32e5,_0x5dd0ac);_0x96367b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x56de('0x8')](e,emitEvent(event));}}module[_0x56de('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 9311c41..074184e 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 _0x775a=['../../config/environment','exports','define','MailQueue','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x12eb9e,_0x163858){var _0x480c7d=function(_0x449437){while(--_0x449437){_0x12eb9e['push'](_0x12eb9e['shift']());}};_0x480c7d(++_0x163858);}(_0x775a,0x14e));var _0xa775=function(_0x52f224,_0x5bfae7){_0x52f224=_0x52f224-0x0;var _0x17ee3d=_0x775a[_0x52f224];return _0x17ee3d;};'use strict';var _=require(_0xa775('0x0'));var util=require(_0xa775('0x1'));var logger=require(_0xa775('0x2'))(_0xa775('0x3'));var moment=require(_0xa775('0x4'));var BPromise=require('bluebird');var rp=require(_0xa775('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa775('0x6'));var config=require(_0xa775('0x7'));var attributes=require('./mailQueue.attributes');module[_0xa775('0x8')]=function(_0x4cfbb2,_0x980843){return _0x4cfbb2[_0xa775('0x9')](_0xa775('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49fd=['rimraf','../../config/environment','./mailQueue.attributes','MailQueue','mail_queues','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x49fd,0x9f));var _0xd49f=function(_0x47d64f,_0x1a69b6){_0x47d64f=_0x47d64f-0x0;var _0x142e4c=_0x49fd[_0x47d64f];return _0x142e4c;};'use strict';var _=require(_0xd49f('0x0'));var util=require(_0xd49f('0x1'));var logger=require(_0xd49f('0x2'))('api');var moment=require(_0xd49f('0x3'));var BPromise=require(_0xd49f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd49f('0x5'));var rimraf=require(_0xd49f('0x6'));var config=require(_0xd49f('0x7'));var attributes=require(_0xd49f('0x8'));module['exports']=function(_0x370092,_0x1f2821){return _0x370092['define'](_0xd49f('0x9'),attributes,{'tableName':_0xd49f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 02194f1..67cdfb6 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 _0xd90e=['raw','where','limit','include','map','model','attributes','debug','stringify','ShowMailQueue','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','then','info','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options'];(function(_0x14b8c7,_0x4839ea){var _0x4bb5a3=function(_0x17cf53){while(--_0x17cf53){_0x14b8c7['push'](_0x14b8c7['shift']());}};_0x4bb5a3(++_0x4839ea);}(_0xd90e,0x17c));var _0xed90=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd90e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xed90('0x0'));var util=require('util');var moment=require(_0xed90('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed90('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xed90('0x3'));var logger=require(_0xed90('0x4'))(_0xed90('0x5'));var config=require(_0xed90('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xed90('0x7')]['http']({'port':0x232a});config[_0xed90('0x8')]=_[_0xed90('0x9')](config[_0xed90('0x8')],{'host':_0xed90('0xa'),'port':0x18eb});var socket=require(_0xed90('0xb'))(new Redis(config['redis']));require('./mailQueue.socket')[_0xed90('0xc')](socket);function respondWithRpcPromise(_0x4c29f6,_0x294906,_0x448a04){return new BPromise(function(_0x2b9f09,_0x34848e){return client['request'](_0x4c29f6,_0x448a04)[_0xed90('0xd')](function(_0x51d1cf){logger[_0xed90('0xe')](_0xed90('0xf'),_0x294906,'request\x20sent');logger['debug'](_0xed90('0x10'),_0x294906,_0xed90('0x11'),JSON['stringify'](_0x51d1cf));if(_0x51d1cf[_0xed90('0x12')]){if(_0x51d1cf[_0xed90('0x12')][_0xed90('0x13')]===0x1f4){logger[_0xed90('0x12')](_0xed90('0xf'),_0x294906,_0x51d1cf[_0xed90('0x12')][_0xed90('0x14')]);return _0x34848e(_0x51d1cf['error'][_0xed90('0x14')]);}logger[_0xed90('0x12')]('MailQueue,\x20%s,\x20%s',_0x294906,_0x51d1cf['error'][_0xed90('0x14')]);return _0x2b9f09(_0x51d1cf[_0xed90('0x12')]['message']);}else{logger[_0xed90('0xe')](_0xed90('0xf'),_0x294906,'request\x20sent');_0x2b9f09(_0x51d1cf[_0xed90('0x15')][_0xed90('0x14')]);}})[_0xed90('0x16')](function(_0x208d7e){logger[_0xed90('0x12')](_0xed90('0xf'),_0x294906,_0x208d7e);_0x34848e(_0x208d7e);});});}exports[_0xed90('0x17')]=function(_0x2c159c){var _0x3f0dbf=this;return new Promise(function(_0x3823b1,_0x75a0eb){return db[_0xed90('0x18')][_0xed90('0x19')]({'raw':_0x2c159c[_0xed90('0x1a')]?_0x2c159c[_0xed90('0x1a')][_0xed90('0x1b')]===undefined?!![]:![]:!![],'where':_0x2c159c[_0xed90('0x1a')]?_0x2c159c['options'][_0xed90('0x1c')]||null:null,'attributes':_0x2c159c[_0xed90('0x1a')]?_0x2c159c[_0xed90('0x1a')]['attributes']||null:null,'limit':_0x2c159c['options']?_0x2c159c[_0xed90('0x1a')][_0xed90('0x1d')]||null:null,'include':_0x2c159c[_0xed90('0x1a')]?_0x2c159c[_0xed90('0x1a')][_0xed90('0x1e')]?_[_0xed90('0x1f')](_0x2c159c[_0xed90('0x1a')][_0xed90('0x1e')],function(_0x21ffee){return{'model':db[_0x21ffee[_0xed90('0x20')]],'as':_0x21ffee['as'],'attributes':_0x21ffee[_0xed90('0x21')],'include':_0x21ffee[_0xed90('0x1e')]?_[_0xed90('0x1f')](_0x21ffee[_0xed90('0x1e')],function(_0x24cd08){return{'model':db[_0x24cd08[_0xed90('0x20')]],'as':_0x24cd08['as'],'attributes':_0x24cd08['attributes'],'include':_0x24cd08['include']?_[_0xed90('0x1f')](_0x24cd08[_0xed90('0x1e')],function(_0x22f3ca){return{'model':db[_0x22f3ca[_0xed90('0x20')]],'as':_0x22f3ca['as'],'attributes':_0x22f3ca['attributes']};}):[]};}):[]};}):[]:[]})[_0xed90('0xd')](function(_0x351daf){logger[_0xed90('0xe')](_0xed90('0x17'),_0x2c159c);logger[_0xed90('0x22')](_0xed90('0x17'),_0x2c159c,JSON[_0xed90('0x23')](_0x351daf));_0x3823b1(_0x351daf);})[_0xed90('0x16')](function(_0x562b65){logger[_0xed90('0x12')]('GetMailQueue',_0x562b65[_0xed90('0x14')],_0x2c159c);_0x75a0eb(_0x3f0dbf['error'](0x1f4,_0x562b65[_0xed90('0x14')]));});});};exports[_0xed90('0x24')]=function(_0x36780b){var _0x55bc66=this;return new Promise(function(_0x4bc1fc,_0x1ed2a8){return db[_0xed90('0x18')]['find']({'raw':_0x36780b[_0xed90('0x1a')]?_0x36780b['options']['raw']===undefined?!![]:![]:!![],'where':_0x36780b[_0xed90('0x1a')]?_0x36780b['options']['where']||null:null,'attributes':_0x36780b[_0xed90('0x1a')]?_0x36780b[_0xed90('0x1a')][_0xed90('0x21')]||null:null,'include':_0x36780b[_0xed90('0x1a')]?_0x36780b[_0xed90('0x1a')][_0xed90('0x1e')]?_['map'](_0x36780b[_0xed90('0x1a')]['include'],function(_0x22ae16){return{'model':db[_0x22ae16[_0xed90('0x20')]],'as':_0x22ae16['as'],'attributes':_0x22ae16['attributes'],'include':_0x22ae16[_0xed90('0x1e')]?_[_0xed90('0x1f')](_0x22ae16[_0xed90('0x1e')],function(_0x25bf46){return{'model':db[_0x25bf46[_0xed90('0x20')]],'as':_0x25bf46['as'],'attributes':_0x25bf46['attributes'],'include':_0x25bf46[_0xed90('0x1e')]?_['map'](_0x25bf46['include'],function(_0x1bb7d3){return{'model':db[_0x1bb7d3[_0xed90('0x20')]],'as':_0x1bb7d3['as'],'attributes':_0x1bb7d3[_0xed90('0x21')]};}):[]};}):[]};}):[]:[]})[_0xed90('0xd')](function(_0x12e58f){logger[_0xed90('0xe')](_0xed90('0x24'),_0x36780b);logger[_0xed90('0x22')]('ShowMailQueue',_0x36780b,JSON['stringify'](_0x12e58f));_0x4bc1fc(_0x12e58f);})['catch'](function(_0x20f46d){logger[_0xed90('0x12')](_0xed90('0x24'),_0x20f46d[_0xed90('0x14')],_0x36780b);_0x1ed2a8(_0x55bc66['error'](0x1f4,_0x20f46d[_0xed90('0x14')]));});});}; \ No newline at end of file +var _0x7008=['request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','result','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','info','GetMailQueue','debug','find','ShowMailQueue','catch','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then'];(function(_0x108a64,_0x2c86b1){var _0x495fa5=function(_0x3b37ea){while(--_0x3b37ea){_0x108a64['push'](_0x108a64['shift']());}};_0x495fa5(++_0x2c86b1);}(_0x7008,0x1ec));var _0x8700=function(_0x6959b7,_0x9b0a33){_0x6959b7=_0x6959b7-0x0;var _0x2057e9=_0x7008[_0x6959b7];return _0x2057e9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8700('0x0'));var BPromise=require('bluebird');var rs=require(_0x8700('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8700('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x8700('0x3'))(_0x8700('0x4'));var config=require('../../config/environment');var jayson=require(_0x8700('0x5'));var client=jayson[_0x8700('0x6')][_0x8700('0x7')]({'port':0x232a});config[_0x8700('0x8')]=_['defaults'](config[_0x8700('0x8')],{'host':_0x8700('0x9'),'port':0x18eb});var socket=require(_0x8700('0xa'))(new Redis(config[_0x8700('0x8')]));require(_0x8700('0xb'))[_0x8700('0xc')](socket);function respondWithRpcPromise(_0x5d3dde,_0x488e49,_0xfd483e){return new BPromise(function(_0x3e91a1,_0x39cf33){return client[_0x8700('0xd')](_0x5d3dde,_0xfd483e)[_0x8700('0xe')](function(_0x3dea95){logger['info']('MailQueue,\x20%s,\x20%s',_0x488e49,_0x8700('0xf'));logger['debug'](_0x8700('0x10'),_0x488e49,_0x8700('0xf'),JSON[_0x8700('0x11')](_0x3dea95));if(_0x3dea95[_0x8700('0x12')]){if(_0x3dea95[_0x8700('0x12')][_0x8700('0x13')]===0x1f4){logger[_0x8700('0x12')](_0x8700('0x14'),_0x488e49,_0x3dea95[_0x8700('0x12')][_0x8700('0x15')]);return _0x39cf33(_0x3dea95['error'][_0x8700('0x15')]);}logger[_0x8700('0x12')](_0x8700('0x14'),_0x488e49,_0x3dea95[_0x8700('0x12')][_0x8700('0x15')]);return _0x3e91a1(_0x3dea95[_0x8700('0x12')][_0x8700('0x15')]);}else{logger['info'](_0x8700('0x14'),_0x488e49,_0x8700('0xf'));_0x3e91a1(_0x3dea95[_0x8700('0x16')][_0x8700('0x15')]);}})['catch'](function(_0x18eb68){logger['error'](_0x8700('0x14'),_0x488e49,_0x18eb68);_0x39cf33(_0x18eb68);});});}exports['GetMailQueue']=function(_0x2511fd){var _0x565009=this;return new Promise(function(_0x1fb611,_0x4125a2){return db[_0x8700('0x17')][_0x8700('0x18')]({'raw':_0x2511fd[_0x8700('0x19')]?_0x2511fd[_0x8700('0x19')][_0x8700('0x1a')]===undefined?!![]:![]:!![],'where':_0x2511fd[_0x8700('0x19')]?_0x2511fd[_0x8700('0x19')][_0x8700('0x1b')]||null:null,'attributes':_0x2511fd['options']?_0x2511fd['options'][_0x8700('0x1c')]||null:null,'limit':_0x2511fd[_0x8700('0x19')]?_0x2511fd[_0x8700('0x19')][_0x8700('0x1d')]||null:null,'include':_0x2511fd[_0x8700('0x19')]?_0x2511fd[_0x8700('0x19')][_0x8700('0x1e')]?_['map'](_0x2511fd[_0x8700('0x19')][_0x8700('0x1e')],function(_0x25bc66){return{'model':db[_0x25bc66['model']],'as':_0x25bc66['as'],'attributes':_0x25bc66[_0x8700('0x1c')],'include':_0x25bc66[_0x8700('0x1e')]?_[_0x8700('0x1f')](_0x25bc66[_0x8700('0x1e')],function(_0x463b9c){return{'model':db[_0x463b9c[_0x8700('0x20')]],'as':_0x463b9c['as'],'attributes':_0x463b9c[_0x8700('0x1c')],'include':_0x463b9c['include']?_[_0x8700('0x1f')](_0x463b9c['include'],function(_0x33bc74){return{'model':db[_0x33bc74[_0x8700('0x20')]],'as':_0x33bc74['as'],'attributes':_0x33bc74['attributes']};}):[]};}):[]};}):[]:[]})[_0x8700('0xe')](function(_0x4d4624){logger[_0x8700('0x21')](_0x8700('0x22'),_0x2511fd);logger[_0x8700('0x23')](_0x8700('0x22'),_0x2511fd,JSON[_0x8700('0x11')](_0x4d4624));_0x1fb611(_0x4d4624);})['catch'](function(_0x57827a){logger[_0x8700('0x12')](_0x8700('0x22'),_0x57827a[_0x8700('0x15')],_0x2511fd);_0x4125a2(_0x565009['error'](0x1f4,_0x57827a['message']));});});};exports['ShowMailQueue']=function(_0x14c2cb){var _0x353dd2=this;return new Promise(function(_0xc9bffc,_0x5a06a6){return db[_0x8700('0x17')][_0x8700('0x24')]({'raw':_0x14c2cb[_0x8700('0x19')]?_0x14c2cb[_0x8700('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x14c2cb[_0x8700('0x19')]?_0x14c2cb[_0x8700('0x19')]['where']||null:null,'attributes':_0x14c2cb[_0x8700('0x19')]?_0x14c2cb[_0x8700('0x19')][_0x8700('0x1c')]||null:null,'include':_0x14c2cb['options']?_0x14c2cb[_0x8700('0x19')][_0x8700('0x1e')]?_[_0x8700('0x1f')](_0x14c2cb[_0x8700('0x19')]['include'],function(_0x770fe1){return{'model':db[_0x770fe1[_0x8700('0x20')]],'as':_0x770fe1['as'],'attributes':_0x770fe1[_0x8700('0x1c')],'include':_0x770fe1[_0x8700('0x1e')]?_['map'](_0x770fe1[_0x8700('0x1e')],function(_0x28920e){return{'model':db[_0x28920e[_0x8700('0x20')]],'as':_0x28920e['as'],'attributes':_0x28920e[_0x8700('0x1c')],'include':_0x28920e['include']?_['map'](_0x28920e[_0x8700('0x1e')],function(_0x28c70c){return{'model':db[_0x28c70c[_0x8700('0x20')]],'as':_0x28c70c['as'],'attributes':_0x28c70c[_0x8700('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8700('0xe')](function(_0x1ee304){logger[_0x8700('0x21')](_0x8700('0x25'),_0x14c2cb);logger[_0x8700('0x23')]('ShowMailQueue',_0x14c2cb,JSON[_0x8700('0x11')](_0x1ee304));_0xc9bffc(_0x1ee304);})[_0x8700('0x26')](function(_0x3e8225){logger['error']('ShowMailQueue',_0x3e8225['message'],_0x14c2cb);_0x5a06a6(_0x353dd2[_0x8700('0x12')](0x1f4,_0x3e8225['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index bd6a9a7..0c3a4f8 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 _0x6e6c=['save','update','emit','register','length','mailQueue:','./mailQueue.events'];(function(_0x2f9007,_0x15d4d2){var _0xbf3aab=function(_0x57c412){while(--_0x57c412){_0x2f9007['push'](_0x2f9007['shift']());}};_0xbf3aab(++_0x15d4d2);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var MailQueueEvents=require(_0xc6e6('0x0'));var events=[_0xc6e6('0x1'),'remove',_0xc6e6('0x2')];function createListener(_0x1b63fe,_0x58f303){return function(_0x550e47){_0x58f303[_0xc6e6('0x3')](_0x1b63fe,_0x550e47);};}function removeListener(_0x5a9e2b,_0x40b7e1){return function(){MailQueueEvents['removeListener'](_0x5a9e2b,_0x40b7e1);};}exports[_0xc6e6('0x4')]=function(_0x1182c7){for(var _0x4bf906=0x0,_0x301f55=events[_0xc6e6('0x5')];_0x4bf906<_0x301f55;_0x4bf906++){var _0x4da7bd=events[_0x4bf906];var _0x324706=createListener(_0xc6e6('0x6')+_0x4da7bd,_0x1182c7);MailQueueEvents['on'](_0x4da7bd,_0x324706);}}; \ No newline at end of file +var _0xcce8=['length','./mailQueue.events','save','remove','update','emit','register'];(function(_0x5ceb6f,_0x28522e){var _0x5aa54f=function(_0x92f843){while(--_0x92f843){_0x5ceb6f['push'](_0x5ceb6f['shift']());}};_0x5aa54f(++_0x28522e);}(_0xcce8,0x1a5));var _0x8cce=function(_0x5208df,_0x2e3e19){_0x5208df=_0x5208df-0x0;var _0x1e0ee7=_0xcce8[_0x5208df];return _0x1e0ee7;};'use strict';var MailQueueEvents=require(_0x8cce('0x0'));var events=[_0x8cce('0x1'),_0x8cce('0x2'),_0x8cce('0x3')];function createListener(_0x67fcf1,_0x445acd){return function(_0x1ce3fb){_0x445acd[_0x8cce('0x4')](_0x67fcf1,_0x1ce3fb);};}function removeListener(_0x323aac,_0x2d8b95){return function(){MailQueueEvents['removeListener'](_0x323aac,_0x2d8b95);};}exports[_0x8cce('0x5')]=function(_0x30554a){for(var _0x2a008a=0x0,_0xca15a9=events[_0x8cce('0x6')];_0x2a008a<_0xca15a9;_0x2a008a++){var _0x1421b3=events[_0x2a008a];var _0x5244e1=createListener('mailQueue:'+_0x1421b3,_0x30554a);MailQueueEvents['on'](_0x1421b3,_0x5244e1);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 7aa6436..295060f 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 _0xd269=['put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x2e18bc,_0x4c2f9c){var _0x125431=function(_0x238036){while(--_0x238036){_0x2e18bc['push'](_0x2e18bc['shift']());}};_0x125431(++_0x4c2f9c);}(_0xd269,0xee));var _0x9d26=function(_0x325221,_0x205b5f){_0x325221=_0x325221-0x0;var _0x396fc8=_0xd269[_0x325221];return _0x396fc8;};'use strict';var multer=require(_0x9d26('0x0'));var util=require(_0x9d26('0x1'));var path=require('path');var timeout=require(_0x9d26('0x2'));var express=require(_0x9d26('0x3'));var router=express[_0x9d26('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9d26('0x5'));var interaction=require(_0x9d26('0x6'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router[_0x9d26('0x7')]('/',auth[_0x9d26('0x8')](),controller[_0x9d26('0x9')]);router[_0x9d26('0x7')](_0x9d26('0xa'),auth[_0x9d26('0x8')](),controller[_0x9d26('0xb')]);router[_0x9d26('0x7')](_0x9d26('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x9d26('0xd')]('/',auth[_0x9d26('0x8')](),controller['create']);router[_0x9d26('0xe')](_0x9d26('0xc'),auth['isAuthenticated'](),controller[_0x9d26('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9d26('0x10')]);module[_0x9d26('0x11')]=router; \ No newline at end of file +var _0x7f89=['isAuthenticated','index','/describe','describe','show','create','/:id','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get'];(function(_0x12742e,_0x43f6fa){var _0x173452=function(_0x500743){while(--_0x500743){_0x12742e['push'](_0x12742e['shift']());}};_0x173452(++_0x43f6fa);}(_0x7f89,0x13a));var _0x97f8=function(_0x491468,_0x42f169){_0x491468=_0x491468-0x0;var _0x5b8c22=_0x7f89[_0x491468];return _0x5b8c22;};'use strict';var multer=require('multer');var util=require(_0x97f8('0x0'));var path=require(_0x97f8('0x1'));var timeout=require(_0x97f8('0x2'));var express=require(_0x97f8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x97f8('0x4'));var interaction=require(_0x97f8('0x5'));var config=require(_0x97f8('0x6'));var controller=require(_0x97f8('0x7'));router[_0x97f8('0x8')]('/',auth[_0x97f8('0x9')](),controller[_0x97f8('0xa')]);router[_0x97f8('0x8')](_0x97f8('0xb'),auth['isAuthenticated'](),controller[_0x97f8('0xc')]);router[_0x97f8('0x8')]('/:id',auth[_0x97f8('0x9')](),controller[_0x97f8('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x97f8('0xe')]);router['put'](_0x97f8('0xf'),auth[_0x97f8('0x9')](),controller[_0x97f8('0x10')]);router['delete'](_0x97f8('0xf'),auth['isAuthenticated'](),controller[_0x97f8('0x11')]);module[_0x97f8('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index e82edea..cc465c0 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 _0x5d08=['moment','sequelize','exports','STRING','DATE'];(function(_0x324fe8,_0x1ccb46){var _0x4a1cd9=function(_0x506af2){while(--_0x506af2){_0x324fe8['push'](_0x324fe8['shift']());}};_0x4a1cd9(++_0x1ccb46);}(_0x5d08,0x1e0));var _0x85d0=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5d08[_0x4565bf];return _0x5610ba;};'use strict';var moment=require(_0x85d0('0x0'));var Sequelize=require(_0x85d0('0x1'));module[_0x85d0('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x85d0('0x3')]},'joinAt':{'type':Sequelize[_0x85d0('0x4')]},'leaveAt':{'type':Sequelize[_0x85d0('0x4')]},'acceptAt':{'type':Sequelize[_0x85d0('0x4')]},'exitAt':{'type':Sequelize[_0x85d0('0x4')]},'reason':{'type':Sequelize[_0x85d0('0x3')]}}; \ No newline at end of file +var _0x00a8=['exports','STRING','DATE','moment'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0x00a8,0xb3));var _0x800a=function(_0xfc97c2,_0x1232ea){_0xfc97c2=_0xfc97c2-0x0;var _0x10811e=_0x00a8[_0xfc97c2];return _0x10811e;};'use strict';var moment=require(_0x800a('0x0'));var Sequelize=require('sequelize');module[_0x800a('0x1')]={'uniqueid':{'type':Sequelize[_0x800a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x800a('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x800a('0x3')]},'acceptAt':{'type':Sequelize[_0x800a('0x3')]},'exitAt':{'type':Sequelize[_0x800a('0x3')]},'reason':{'type':Sequelize[_0x800a('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 6184a5d..b10decd 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 _0x81c6=['includeAll','include','findAll','rows','catch','show','keys','fields','length','create','body','find','params','describe','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','end','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','MailQueueReport'];(function(_0x2d1a9b,_0x3a94de){var _0x2b17a6=function(_0x2fbf91){while(--_0x2fbf91){_0x2d1a9b['push'](_0x2d1a9b['shift']());}};_0x2b17a6(++_0x3a94de);}(_0x81c6,0x1d5));var _0x681c=function(_0x44f280,_0x4a1dad){_0x44f280=_0x44f280-0x0;var _0x4ee19d=_0x81c6[_0x44f280];return _0x4ee19d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x681c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x681c('0x1'));var BPromise=require(_0x681c('0x2'));var Mustache=require(_0x681c('0x3'));var util=require('util');var path=require(_0x681c('0x4'));var sox=require(_0x681c('0x5'));var csv=require(_0x681c('0x6'));var ejs=require(_0x681c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x681c('0x8'));var squel=require(_0x681c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x681c('0xa'));var toCsv=require(_0x681c('0x6'));var querystring=require(_0x681c('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x681c('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x681c('0xd'));var hardwareService=require(_0x681c('0xe'));var logger=require(_0x681c('0xf'))(_0x681c('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x681c('0x11'));var db=require(_0x681c('0x12'))['db'];function respondWithStatusCode(_0x2d379b,_0x50cae8){_0x50cae8=_0x50cae8||0xcc;return function(_0x2e4651){if(_0x2e4651){return _0x2d379b['sendStatus'](_0x50cae8);}return _0x2d379b[_0x681c('0x13')](_0x50cae8)['end']();};}function respondWithResult(_0x2c059e,_0x27c3a2){_0x27c3a2=_0x27c3a2||0xc8;return function(_0xe8bb4d){if(_0xe8bb4d){return _0x2c059e[_0x681c('0x13')](_0x27c3a2)[_0x681c('0x14')](_0xe8bb4d);}};}function respondWithFilteredResult(_0x2bc3fb,_0x50a4ec){return function(_0x2b0939){if(_0x2b0939){var _0x1135c9=typeof _0x50a4ec[_0x681c('0x15')]===_0x681c('0x16')&&typeof _0x50a4ec[_0x681c('0x17')]===_0x681c('0x16');var _0x4e7df2=_0x2b0939[_0x681c('0x18')];var _0x42f506=_0x1135c9?0x0:_0x50a4ec[_0x681c('0x15')];var _0x42304f=_0x1135c9?_0x2b0939['count']:_0x50a4ec[_0x681c('0x15')]+_0x50a4ec[_0x681c('0x17')];var _0x54d27f;if(_0x42304f>=_0x4e7df2){_0x42304f=_0x4e7df2;_0x54d27f=0xc8;}else{_0x54d27f=0xce;}_0x2bc3fb[_0x681c('0x13')](_0x54d27f);return _0x2bc3fb['set'](_0x681c('0x19'),_0x42f506+'-'+_0x42304f+'/'+_0x4e7df2)[_0x681c('0x14')](_0x2b0939);}return null;};}function patchUpdates(_0x11d68d){return function(_0x33c495){try{jsonpatch[_0x681c('0x1a')](_0x33c495,_0x11d68d,!![]);}catch(_0x51d626){return BPromise['reject'](_0x51d626);}return _0x33c495['save']();};}function saveUpdates(_0x2e5331,_0x39c8b7){return function(_0x3adfe3){if(_0x3adfe3){return _0x3adfe3[_0x681c('0x1b')](_0x2e5331)[_0x681c('0x1c')](function(_0x29f3fa){return _0x29f3fa;});}return null;};}function removeEntity(_0x415a0a,_0x3d0297){return function(_0x1b3d2b){if(_0x1b3d2b){return _0x1b3d2b[_0x681c('0x1d')]()[_0x681c('0x1c')](function(){_0x415a0a[_0x681c('0x13')](0xcc)[_0x681c('0x1e')]();});}};}function handleEntityNotFound(_0x218410,_0x3237ed){return function(_0x228f59){if(!_0x228f59){_0x218410['sendStatus'](0x194);}return _0x228f59;};}function handleError(_0x11063b,_0x5705a7){_0x5705a7=_0x5705a7||0x1f4;return function(_0x5f8d64){logger['error'](_0x5f8d64['stack']);if(_0x5f8d64[_0x681c('0x1f')]){delete _0x5f8d64[_0x681c('0x1f')];}_0x11063b[_0x681c('0x13')](_0x5705a7)[_0x681c('0x20')](_0x5f8d64);};}exports['index']=function(_0x3b1031,_0x39fca3){var _0x2fde4b={},_0x936fce={},_0x147cda={'count':0x0,'rows':[]};var _0x204006=_[_0x681c('0x21')](db['MailQueueReport'][_0x681c('0x22')],function(_0x390be5){return{'name':_0x390be5[_0x681c('0x23')],'type':_0x390be5['type'][_0x681c('0x24')]};});_0x936fce[_0x681c('0x25')]=_[_0x681c('0x21')](_0x204006,'name');_0x936fce[_0x681c('0x26')]=_['keys'](_0x3b1031['query']);_0x936fce[_0x681c('0x27')]=_[_0x681c('0x28')](_0x936fce[_0x681c('0x25')],_0x936fce['query']);_0x2fde4b[_0x681c('0x29')]=_['intersection'](_0x936fce[_0x681c('0x25')],qs['fields'](_0x3b1031['query']['fields']));_0x2fde4b[_0x681c('0x29')]=_0x2fde4b[_0x681c('0x29')]['length']?_0x2fde4b[_0x681c('0x29')]:_0x936fce['model'];if(!_0x3b1031['query'][_0x681c('0x2a')]('nolimit')){_0x2fde4b[_0x681c('0x17')]=qs[_0x681c('0x17')](_0x3b1031[_0x681c('0x26')]['limit']);_0x2fde4b['offset']=qs[_0x681c('0x15')](_0x3b1031[_0x681c('0x26')]['offset']);}_0x2fde4b[_0x681c('0x2b')]=qs[_0x681c('0x2c')](_0x3b1031[_0x681c('0x26')]['sort']);_0x2fde4b[_0x681c('0x2d')]=qs[_0x681c('0x27')](_['pick'](_0x3b1031[_0x681c('0x26')],_0x936fce[_0x681c('0x27')]),_0x204006);if(_0x3b1031[_0x681c('0x26')][_0x681c('0x2e')]){_0x2fde4b[_0x681c('0x2d')]=_['merge'](_0x2fde4b['where'],{'$or':_[_0x681c('0x21')](_0x204006,function(_0x373f33){if(_0x373f33['type']!==_0x681c('0x2f')){var _0x183f13={};_0x183f13[_0x373f33['name']]={'$like':'%'+_0x3b1031[_0x681c('0x26')][_0x681c('0x2e')]+'%'};return _0x183f13;}})});}_0x2fde4b=_[_0x681c('0x30')]({},_0x2fde4b,_0x3b1031[_0x681c('0x31')]);var _0x3b258b={'where':_0x2fde4b[_0x681c('0x2d')]};return db[_0x681c('0x32')][_0x681c('0x18')](_0x3b258b)[_0x681c('0x1c')](function(_0x1ece6f){_0x147cda['count']=_0x1ece6f;if(_0x3b1031[_0x681c('0x26')][_0x681c('0x33')]){_0x2fde4b[_0x681c('0x34')]=[{'all':!![]}];}return db[_0x681c('0x32')][_0x681c('0x35')](_0x2fde4b);})[_0x681c('0x1c')](function(_0x542c02){_0x147cda[_0x681c('0x36')]=_0x542c02;return _0x147cda;})[_0x681c('0x1c')](respondWithFilteredResult(_0x39fca3,_0x2fde4b))[_0x681c('0x37')](handleError(_0x39fca3,null));};exports[_0x681c('0x38')]=function(_0x30abe8,_0x5dd2f4){var _0x2143a9={'raw':!![],'where':{'id':_0x30abe8['params']['id']}},_0x5d7031={};_0x5d7031[_0x681c('0x25')]=_[_0x681c('0x39')](db[_0x681c('0x32')][_0x681c('0x22')]);_0x5d7031['query']=_[_0x681c('0x39')](_0x30abe8['query']);_0x5d7031['filters']=_[_0x681c('0x28')](_0x5d7031[_0x681c('0x25')],_0x5d7031[_0x681c('0x26')]);_0x2143a9[_0x681c('0x29')]=_[_0x681c('0x28')](_0x5d7031[_0x681c('0x25')],qs['fields'](_0x30abe8[_0x681c('0x26')][_0x681c('0x3a')]));_0x2143a9['attributes']=_0x2143a9['attributes'][_0x681c('0x3b')]?_0x2143a9['attributes']:_0x5d7031[_0x681c('0x25')];if(_0x30abe8['query']['includeAll']){_0x2143a9['include']=[{'all':!![]}];}_0x2143a9=_[_0x681c('0x30')]({},_0x2143a9,_0x30abe8[_0x681c('0x31')]);return db[_0x681c('0x32')]['find'](_0x2143a9)[_0x681c('0x1c')](handleEntityNotFound(_0x5dd2f4,null))[_0x681c('0x1c')](respondWithResult(_0x5dd2f4,null))['catch'](handleError(_0x5dd2f4,null));};exports[_0x681c('0x3c')]=function(_0x17bb48,_0x15d1c0){return db[_0x681c('0x32')]['create'](_0x17bb48[_0x681c('0x3d')],{})['then'](respondWithResult(_0x15d1c0,0xc9))[_0x681c('0x37')](handleError(_0x15d1c0,null));};exports[_0x681c('0x1b')]=function(_0xa56f20,_0x5731f0){if(_0xa56f20[_0x681c('0x3d')]['id']){delete _0xa56f20[_0x681c('0x3d')]['id'];}return db[_0x681c('0x32')][_0x681c('0x3e')]({'where':{'id':_0xa56f20[_0x681c('0x3f')]['id']}})[_0x681c('0x1c')](handleEntityNotFound(_0x5731f0,null))[_0x681c('0x1c')](saveUpdates(_0xa56f20[_0x681c('0x3d')],null))[_0x681c('0x1c')](respondWithResult(_0x5731f0,null))[_0x681c('0x37')](handleError(_0x5731f0,null));};exports[_0x681c('0x1d')]=function(_0x37bdf6,_0x4cae41){return db[_0x681c('0x32')][_0x681c('0x3e')]({'where':{'id':_0x37bdf6['params']['id']}})[_0x681c('0x1c')](handleEntityNotFound(_0x4cae41,null))[_0x681c('0x1c')](removeEntity(_0x4cae41,null))['catch'](handleError(_0x4cae41,null));};exports[_0x681c('0x40')]=function(_0x5e58bf,_0x38daf8){return db[_0x681c('0x32')][_0x681c('0x40')]()['then'](respondWithResult(_0x38daf8,null))[_0x681c('0x37')](handleError(_0x38daf8,null));}; \ No newline at end of file +var _0x4bd3=['reject','save','destroy','then','error','name','send','index','map','MailQueueReport','fieldName','type','key','query','keys','intersection','model','attributes','length','nolimit','order','sort','filters','where','VIRTUAL','filter','options','includeAll','show','params','include','catch','create','update','body','find','describe','eml-format','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x235cda,_0x18afdc){var _0x5d2cb8=function(_0x9f077d){while(--_0x9f077d){_0x235cda['push'](_0x235cda['shift']());}};_0x5d2cb8(++_0x18afdc);}(_0x4bd3,0x174));var _0x34bd=function(_0x593763,_0x342291){_0x593763=_0x593763-0x0;var _0x2b42e9=_0x4bd3[_0x593763];return _0x2b42e9;};'use strict';var emlformat=require(_0x34bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x34bd('0x1'));var jsonpatch=require(_0x34bd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x34bd('0x3'));var util=require(_0x34bd('0x4'));var path=require(_0x34bd('0x5'));var sox=require('sox');var csv=require(_0x34bd('0x6'));var ejs=require(_0x34bd('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34bd('0x8'));var squel=require(_0x34bd('0x9'));var crypto=require('crypto');var jsforce=require(_0x34bd('0xa'));var deskjs=require(_0x34bd('0xb'));var toCsv=require(_0x34bd('0x6'));var querystring=require(_0x34bd('0xc'));var Papa=require(_0x34bd('0xd'));var Redis=require(_0x34bd('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x34bd('0xf'));var as=require(_0x34bd('0x10'));var hardwareService=require(_0x34bd('0x11'));var logger=require(_0x34bd('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x34bd('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x275d80,_0x1f19b9){_0x1f19b9=_0x1f19b9||0xcc;return function(_0x282af4){if(_0x282af4){return _0x275d80[_0x34bd('0x14')](_0x1f19b9);}return _0x275d80[_0x34bd('0x15')](_0x1f19b9)[_0x34bd('0x16')]();};}function respondWithResult(_0x4134ee,_0x236f6b){_0x236f6b=_0x236f6b||0xc8;return function(_0xf6d2f2){if(_0xf6d2f2){return _0x4134ee['status'](_0x236f6b)[_0x34bd('0x17')](_0xf6d2f2);}};}function respondWithFilteredResult(_0x4d4955,_0x4e3886){return function(_0x6638ed){if(_0x6638ed){var _0x30b3f2=typeof _0x4e3886[_0x34bd('0x18')]===_0x34bd('0x19')&&typeof _0x4e3886[_0x34bd('0x1a')]===_0x34bd('0x19');var _0xd39d72=_0x6638ed[_0x34bd('0x1b')];var _0x3b4bf8=_0x30b3f2?0x0:_0x4e3886[_0x34bd('0x18')];var _0x4b5ebb=_0x30b3f2?_0x6638ed['count']:_0x4e3886[_0x34bd('0x18')]+_0x4e3886[_0x34bd('0x1a')];var _0x265e70;if(_0x4b5ebb>=_0xd39d72){_0x4b5ebb=_0xd39d72;_0x265e70=0xc8;}else{_0x265e70=0xce;}_0x4d4955[_0x34bd('0x15')](_0x265e70);return _0x4d4955[_0x34bd('0x1c')](_0x34bd('0x1d'),_0x3b4bf8+'-'+_0x4b5ebb+'/'+_0xd39d72)[_0x34bd('0x17')](_0x6638ed);}return null;};}function patchUpdates(_0x3d5f76){return function(_0x130bd0){try{jsonpatch['apply'](_0x130bd0,_0x3d5f76,!![]);}catch(_0x15c0d1){return BPromise[_0x34bd('0x1e')](_0x15c0d1);}return _0x130bd0[_0x34bd('0x1f')]();};}function saveUpdates(_0x14254b,_0x463224){return function(_0x5e0c06){if(_0x5e0c06){return _0x5e0c06['update'](_0x14254b)['then'](function(_0x4edf84){return _0x4edf84;});}return null;};}function removeEntity(_0x3dafe8,_0x503a60){return function(_0x10fc4b){if(_0x10fc4b){return _0x10fc4b[_0x34bd('0x20')]()[_0x34bd('0x21')](function(){_0x3dafe8['status'](0xcc)[_0x34bd('0x16')]();});}};}function handleEntityNotFound(_0x14479a,_0x4f0dff){return function(_0x457006){if(!_0x457006){_0x14479a['sendStatus'](0x194);}return _0x457006;};}function handleError(_0x29bda8,_0xb256e8){_0xb256e8=_0xb256e8||0x1f4;return function(_0x264c94){logger[_0x34bd('0x22')](_0x264c94['stack']);if(_0x264c94[_0x34bd('0x23')]){delete _0x264c94[_0x34bd('0x23')];}_0x29bda8['status'](_0xb256e8)[_0x34bd('0x24')](_0x264c94);};}exports[_0x34bd('0x25')]=function(_0x16581f,_0x3f675c){var _0x26b8e7={},_0x4500c8={},_0x177d43={'count':0x0,'rows':[]};var _0x58b431=_[_0x34bd('0x26')](db[_0x34bd('0x27')]['rawAttributes'],function(_0x5d1662){return{'name':_0x5d1662[_0x34bd('0x28')],'type':_0x5d1662[_0x34bd('0x29')][_0x34bd('0x2a')]};});_0x4500c8['model']=_['map'](_0x58b431,_0x34bd('0x23'));_0x4500c8[_0x34bd('0x2b')]=_[_0x34bd('0x2c')](_0x16581f[_0x34bd('0x2b')]);_0x4500c8['filters']=_[_0x34bd('0x2d')](_0x4500c8[_0x34bd('0x2e')],_0x4500c8[_0x34bd('0x2b')]);_0x26b8e7[_0x34bd('0x2f')]=_[_0x34bd('0x2d')](_0x4500c8[_0x34bd('0x2e')],qs['fields'](_0x16581f[_0x34bd('0x2b')]['fields']));_0x26b8e7[_0x34bd('0x2f')]=_0x26b8e7[_0x34bd('0x2f')][_0x34bd('0x30')]?_0x26b8e7['attributes']:_0x4500c8[_0x34bd('0x2e')];if(!_0x16581f[_0x34bd('0x2b')]['hasOwnProperty'](_0x34bd('0x31'))){_0x26b8e7[_0x34bd('0x1a')]=qs[_0x34bd('0x1a')](_0x16581f['query'][_0x34bd('0x1a')]);_0x26b8e7[_0x34bd('0x18')]=qs['offset'](_0x16581f[_0x34bd('0x2b')][_0x34bd('0x18')]);}_0x26b8e7[_0x34bd('0x32')]=qs[_0x34bd('0x33')](_0x16581f[_0x34bd('0x2b')][_0x34bd('0x33')]);_0x26b8e7['where']=qs['filters'](_['pick'](_0x16581f[_0x34bd('0x2b')],_0x4500c8[_0x34bd('0x34')]),_0x58b431);if(_0x16581f['query']['filter']){_0x26b8e7[_0x34bd('0x35')]=_['merge'](_0x26b8e7['where'],{'$or':_[_0x34bd('0x26')](_0x58b431,function(_0xb5a456){if(_0xb5a456[_0x34bd('0x29')]!==_0x34bd('0x36')){var _0x2af1af={};_0x2af1af[_0xb5a456['name']]={'$like':'%'+_0x16581f['query'][_0x34bd('0x37')]+'%'};return _0x2af1af;}})});}_0x26b8e7=_['merge']({},_0x26b8e7,_0x16581f[_0x34bd('0x38')]);var _0x2c9b7a={'where':_0x26b8e7[_0x34bd('0x35')]};return db[_0x34bd('0x27')][_0x34bd('0x1b')](_0x2c9b7a)['then'](function(_0x282297){_0x177d43[_0x34bd('0x1b')]=_0x282297;if(_0x16581f[_0x34bd('0x2b')][_0x34bd('0x39')]){_0x26b8e7['include']=[{'all':!![]}];}return db[_0x34bd('0x27')]['findAll'](_0x26b8e7);})[_0x34bd('0x21')](function(_0x560282){_0x177d43['rows']=_0x560282;return _0x177d43;})[_0x34bd('0x21')](respondWithFilteredResult(_0x3f675c,_0x26b8e7))['catch'](handleError(_0x3f675c,null));};exports[_0x34bd('0x3a')]=function(_0x3d3b96,_0x18e9f6){var _0x42a424={'raw':!![],'where':{'id':_0x3d3b96[_0x34bd('0x3b')]['id']}},_0x26d73e={};_0x26d73e[_0x34bd('0x2e')]=_['keys'](db['MailQueueReport']['rawAttributes']);_0x26d73e[_0x34bd('0x2b')]=_[_0x34bd('0x2c')](_0x3d3b96[_0x34bd('0x2b')]);_0x26d73e[_0x34bd('0x34')]=_['intersection'](_0x26d73e[_0x34bd('0x2e')],_0x26d73e[_0x34bd('0x2b')]);_0x42a424[_0x34bd('0x2f')]=_[_0x34bd('0x2d')](_0x26d73e[_0x34bd('0x2e')],qs['fields'](_0x3d3b96[_0x34bd('0x2b')]['fields']));_0x42a424['attributes']=_0x42a424[_0x34bd('0x2f')]['length']?_0x42a424[_0x34bd('0x2f')]:_0x26d73e[_0x34bd('0x2e')];if(_0x3d3b96[_0x34bd('0x2b')][_0x34bd('0x39')]){_0x42a424[_0x34bd('0x3c')]=[{'all':!![]}];}_0x42a424=_['merge']({},_0x42a424,_0x3d3b96['options']);return db[_0x34bd('0x27')]['find'](_0x42a424)[_0x34bd('0x21')](handleEntityNotFound(_0x18e9f6,null))[_0x34bd('0x21')](respondWithResult(_0x18e9f6,null))[_0x34bd('0x3d')](handleError(_0x18e9f6,null));};exports['create']=function(_0x4ad00c,_0x4f96dd){return db['MailQueueReport'][_0x34bd('0x3e')](_0x4ad00c['body'],{})[_0x34bd('0x21')](respondWithResult(_0x4f96dd,0xc9))['catch'](handleError(_0x4f96dd,null));};exports[_0x34bd('0x3f')]=function(_0x1d01d7,_0x1fa341){if(_0x1d01d7[_0x34bd('0x40')]['id']){delete _0x1d01d7[_0x34bd('0x40')]['id'];}return db['MailQueueReport'][_0x34bd('0x41')]({'where':{'id':_0x1d01d7[_0x34bd('0x3b')]['id']}})[_0x34bd('0x21')](handleEntityNotFound(_0x1fa341,null))[_0x34bd('0x21')](saveUpdates(_0x1d01d7[_0x34bd('0x40')],null))['then'](respondWithResult(_0x1fa341,null))[_0x34bd('0x3d')](handleError(_0x1fa341,null));};exports[_0x34bd('0x20')]=function(_0x5bcce5,_0x1fc735){return db[_0x34bd('0x27')]['find']({'where':{'id':_0x5bcce5['params']['id']}})[_0x34bd('0x21')](handleEntityNotFound(_0x1fc735,null))['then'](removeEntity(_0x1fc735,null))['catch'](handleError(_0x1fc735,null));};exports[_0x34bd('0x42')]=function(_0x5df6a5,_0x556ce8){return db['MailQueueReport']['describe']()['then'](respondWithResult(_0x556ce8,null))[_0x34bd('0x3d')](handleError(_0x556ce8,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index d78c2c7..ef91312 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 _0xb5aa=['request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1a1b32,_0x50ae31){var _0x3fda93=function(_0x15905e){while(--_0x15905e){_0x1a1b32['push'](_0x1a1b32['shift']());}};_0x3fda93(++_0x50ae31);}(_0xb5aa,0x121));var _0xab5a=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xb5aa[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0xab5a('0x0'));var util=require('util');var logger=require(_0xab5a('0x1'))(_0xab5a('0x2'));var moment=require(_0xab5a('0x3'));var BPromise=require(_0xab5a('0x4'));var rp=require(_0xab5a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xab5a('0x6'));var config=require(_0xab5a('0x7'));var attributes=require(_0xab5a('0x8'));module[_0xab5a('0x9')]=function(_0x5b0075,_0x14236e){return _0x5b0075[_0xab5a('0xa')](_0xab5a('0xb'),attributes,{'tableName':_0xab5a('0xc'),'paranoid':![],'indexes':[{'name':_0xab5a('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4364=['MailQueueReport','uniqueid','lodash','moment','bluebird','path','../../config/environment','./mailQueueReport.attributes','exports','define'];(function(_0x5cf93c,_0x2b5075){var _0x56aa24=function(_0x20b2ee){while(--_0x20b2ee){_0x5cf93c['push'](_0x5cf93c['shift']());}};_0x56aa24(++_0x2b5075);}(_0x4364,0x1b0));var _0x4436=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x4364[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x4436('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4436('0x1'));var BPromise=require(_0x4436('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4436('0x3'));var rimraf=require('rimraf');var config=require(_0x4436('0x4'));var attributes=require(_0x4436('0x5'));module[_0x4436('0x6')]=function(_0x2cd47e,_0x23713d){return _0x2cd47e[_0x4436('0x7')](_0x4436('0x8'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x4436('0x9'),'fields':[_0x4436('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 8e9cd21..25f6bd3 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 _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x3c4b44,_0x1f4994){var _0xd6a408=function(_0x440421){while(--_0x440421){_0x3c4b44['push'](_0x3c4b44['shift']());}};_0xd6a408(++_0x1f4994);}(_0x2ef3,0xba));var _0x32ef=function(_0x5276d3,_0x3d4377){_0x5276d3=_0x5276d3-0x0;var _0x4e3c48=_0x2ef3[_0x5276d3];return _0x4e3c48;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +var _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x51d908,_0x5ec571){var _0x452914=function(_0x25da37){while(--_0x25da37){_0x51d908['push'](_0x51d908['shift']());}};_0x452914(++_0x5ec571);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1b8b95,_0x3ea343){_0x1b8b95=_0x1b8b95-0x0;var _0x3657ae=_0x5f2f[_0x1b8b95];return _0x3657ae;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 27b1206..e5b797a 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4dfb0b,_0x5c3651){var _0x3132cf=function(_0x1e10e9){while(--_0x1e10e9){_0x4dfb0b['push'](_0x4dfb0b['shift']());}};_0x3132cf(++_0x5c3651);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4a0ebf,_0x55ba40){var _0x181f1e=function(_0x3e421f){while(--_0x3e421f){_0x4a0ebf['push'](_0x4a0ebf['shift']());}};_0x181f1e(++_0x55ba40);}(_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'));module[_0x0a9e('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 925cc0b..2be8e59 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 _0x69b6=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x12bce7,_0x48f9e7){var _0x4ad611=function(_0x3cefd4){while(--_0x3cefd4){_0x12bce7['push'](_0x12bce7['shift']());}};_0x4ad611(++_0x48f9e7);}(_0x69b6,0xa3));var _0x669b=function(_0x3f8d95,_0xf30c58){_0x3f8d95=_0x3f8d95-0x0;var _0x50d325=_0x69b6[_0x3f8d95];return _0x50d325;};'use strict';var Sequelize=require(_0x669b('0x0'));module[_0x669b('0x1')]={'description':{'type':Sequelize[_0x669b('0x2')]},'host':{'type':Sequelize[_0x669b('0x2')]},'authentication':{'type':Sequelize[_0x669b('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x669b('0x2')]},'password':{'type':Sequelize[_0x669b('0x2')]},'port':{'type':Sequelize[_0x669b('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x669b('0x2')],'defaultValue':_0x669b('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x669b('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x669b('0x2')]},'modernAuthentication':{'type':Sequelize[_0x669b('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x448d=['BOOLEAN','INBOX','INTEGER','sequelize','exports','STRING'];(function(_0x587dc0,_0x2a409f){var _0x4abb3e=function(_0x3fdcec){while(--_0x3fdcec){_0x587dc0['push'](_0x587dc0['shift']());}};_0x4abb3e(++_0x2a409f);}(_0x448d,0xf9));var _0xd448=function(_0x7da20d,_0x47bb37){_0x7da20d=_0x7da20d-0x0;var _0x36eb6b=_0x448d[_0x7da20d];return _0x36eb6b;};'use strict';var Sequelize=require(_0xd448('0x0'));module[_0xd448('0x1')]={'description':{'type':Sequelize[_0xd448('0x2')]},'host':{'type':Sequelize[_0xd448('0x2')]},'authentication':{'type':Sequelize[_0xd448('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xd448('0x2')]},'password':{'type':Sequelize[_0xd448('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xd448('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xd448('0x4')},'connTimeout':{'type':Sequelize[_0xd448('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xd448('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 21a654a..850fff7 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 _0x5356=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','lodash'];(function(_0x12619e,_0xfcf0d6){var _0x447fa5=function(_0x1945b5){while(--_0x1945b5){_0x12619e['push'](_0x12619e['shift']());}};_0x447fa5(++_0xfcf0d6);}(_0x5356,0xa7));var _0x6535=function(_0x325673,_0x13c10b){_0x325673=_0x325673-0x0;var _0x741c5b=_0x5356[_0x325673];return _0x741c5b;};'use strict';var _=require(_0x6535('0x0'));var util=require(_0x6535('0x1'));var logger=require(_0x6535('0x2'))(_0x6535('0x3'));var moment=require(_0x6535('0x4'));var BPromise=require(_0x6535('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6535('0x6'));var config=require(_0x6535('0x7'));var attributes=require(_0x6535('0x8'));module[_0x6535('0x9')]=function(_0x46a5f9,_0x4b541e){return _0x46a5f9['define'](_0x6535('0xa'),attributes,{'tableName':_0x6535('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef1b=['bluebird','request-promise','path','rimraf','exports','define','MailServerIn','mail_servers_in','lodash','../../config/logger','api','moment'];(function(_0x5eced5,_0x3443d0){var _0x17af0c=function(_0x5ae2bc){while(--_0x5ae2bc){_0x5eced5['push'](_0x5eced5['shift']());}};_0x17af0c(++_0x3443d0);}(_0xef1b,0x80));var _0xbef1=function(_0x59445c,_0x225a42){_0x59445c=_0x59445c-0x0;var _0x40bb98=_0xef1b[_0x59445c];return _0x40bb98;};'use strict';var _=require(_0xbef1('0x0'));var util=require('util');var logger=require(_0xbef1('0x1'))(_0xbef1('0x2'));var moment=require(_0xbef1('0x3'));var BPromise=require(_0xbef1('0x4'));var rp=require(_0xbef1('0x5'));var fs=require('fs');var path=require(_0xbef1('0x6'));var rimraf=require(_0xbef1('0x7'));var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module[_0xbef1('0x8')]=function(_0x548e25,_0x7f7467){return _0x548e25[_0xbef1('0x9')](_0xbef1('0xa'),attributes,{'tableName':_0xbef1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index cc07b56..5645085 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 _0xb7ef=['info','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x3452c5,_0x11829a){var _0x3d2172=function(_0x57478f){while(--_0x57478f){_0x3452c5['push'](_0x3452c5['shift']());}};_0x3d2172(++_0x11829a);}(_0xb7ef,0x1ac));var _0xfb7e=function(_0x2b5099,_0xcb331e){_0x2b5099=_0x2b5099-0x0;var _0x34a002=_0xb7ef[_0x2b5099];return _0x34a002;};'use strict';var _=require(_0xfb7e('0x0'));var util=require(_0xfb7e('0x1'));var moment=require(_0xfb7e('0x2'));var BPromise=require(_0xfb7e('0x3'));var rs=require(_0xfb7e('0x4'));var fs=require('fs');var Redis=require(_0xfb7e('0x5'));var db=require(_0xfb7e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfb7e('0x7'))(_0xfb7e('0x8'));var config=require('../../config/environment');var jayson=require(_0xfb7e('0x9'));var client=jayson[_0xfb7e('0xa')][_0xfb7e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34bee8,_0x1556b7,_0x17af21){return new BPromise(function(_0x567e8f,_0x21fc1a){return client[_0xfb7e('0xc')](_0x34bee8,_0x17af21)[_0xfb7e('0xd')](function(_0x23a825){logger[_0xfb7e('0xe')]('MailServerIn,\x20%s,\x20%s',_0x1556b7,'request\x20sent');logger[_0xfb7e('0xf')](_0xfb7e('0x10'),_0x1556b7,_0xfb7e('0x11'),JSON[_0xfb7e('0x12')](_0x23a825));if(_0x23a825[_0xfb7e('0x13')]){if(_0x23a825['error']['code']===0x1f4){logger[_0xfb7e('0x13')](_0xfb7e('0x14'),_0x1556b7,_0x23a825[_0xfb7e('0x13')]['message']);return _0x21fc1a(_0x23a825[_0xfb7e('0x13')][_0xfb7e('0x15')]);}logger[_0xfb7e('0x13')]('MailServerIn,\x20%s,\x20%s',_0x1556b7,_0x23a825[_0xfb7e('0x13')]['message']);return _0x567e8f(_0x23a825[_0xfb7e('0x13')][_0xfb7e('0x15')]);}else{logger[_0xfb7e('0xe')](_0xfb7e('0x14'),_0x1556b7,_0xfb7e('0x11'));_0x567e8f(_0x23a825[_0xfb7e('0x16')][_0xfb7e('0x15')]);}})[_0xfb7e('0x17')](function(_0x3db5d8){logger[_0xfb7e('0x13')](_0xfb7e('0x14'),_0x1556b7,_0x3db5d8);_0x21fc1a(_0x3db5d8);});});}exports[_0xfb7e('0x18')]=function(_0xbde748){var _0x1a9b04=this;return new Promise(function(_0x4da47f,_0x47b882){return db[_0xfb7e('0x19')][_0xfb7e('0x1a')]({'raw':_0xbde748['options']?_0xbde748[_0xfb7e('0x1b')][_0xfb7e('0x1c')]===undefined?!![]:![]:!![],'where':_0xbde748[_0xfb7e('0x1b')]?_0xbde748[_0xfb7e('0x1b')][_0xfb7e('0x1d')]||null:null,'attributes':_0xbde748[_0xfb7e('0x1b')]?_0xbde748[_0xfb7e('0x1b')][_0xfb7e('0x1e')]||null:null,'limit':_0xbde748['options']?_0xbde748[_0xfb7e('0x1b')][_0xfb7e('0x1f')]||null:null,'include':_0xbde748[_0xfb7e('0x1b')]?_0xbde748['options']['include']?_['map'](_0xbde748[_0xfb7e('0x1b')][_0xfb7e('0x20')],function(_0x23c2bb){return{'model':db[_0x23c2bb['model']],'as':_0x23c2bb['as'],'attributes':_0x23c2bb[_0xfb7e('0x1e')],'include':_0x23c2bb['include']?_['map'](_0x23c2bb['include'],function(_0x496d08){return{'model':db[_0x496d08[_0xfb7e('0x21')]],'as':_0x496d08['as'],'attributes':_0x496d08[_0xfb7e('0x1e')],'include':_0x496d08[_0xfb7e('0x20')]?_['map'](_0x496d08[_0xfb7e('0x20')],function(_0x227c35){return{'model':db[_0x227c35[_0xfb7e('0x21')]],'as':_0x227c35['as'],'attributes':_0x227c35[_0xfb7e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfb7e('0xd')](function(_0x38e4f5){logger[_0xfb7e('0xe')]('GetMailServerIn',_0xbde748);logger[_0xfb7e('0xf')]('GetMailServerIn',_0xbde748,JSON[_0xfb7e('0x12')](_0x38e4f5));_0x4da47f(_0x38e4f5);})[_0xfb7e('0x17')](function(_0x3d59bc){logger[_0xfb7e('0x13')](_0xfb7e('0x18'),_0x3d59bc['message'],_0xbde748);_0x47b882(_0x1a9b04[_0xfb7e('0x13')](0x1f4,_0x3d59bc[_0xfb7e('0x15')]));});});}; \ No newline at end of file +var _0x979e=['message','result','GetMailServerIn','MailServerIn','options','raw','where','attributes','limit','map','include','model','then','stringify','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x979e,0x17a));var _0xe979=function(_0x254111,_0x291f54){_0x254111=_0x254111-0x0;var _0x36c9ed=_0x979e[_0x254111];return _0x36c9ed;};'use strict';var _=require(_0xe979('0x0'));var util=require(_0xe979('0x1'));var moment=require('moment');var BPromise=require(_0xe979('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe979('0x3'))['db'];var utils=require(_0xe979('0x4'));var logger=require(_0xe979('0x5'))(_0xe979('0x6'));var config=require(_0xe979('0x7'));var jayson=require(_0xe979('0x8'));var client=jayson[_0xe979('0x9')][_0xe979('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2024ce,_0x10b854,_0x56fccd){return new BPromise(function(_0x64dd06,_0x24d817){return client['request'](_0x2024ce,_0x56fccd)['then'](function(_0x123352){logger[_0xe979('0xb')](_0xe979('0xc'),_0x10b854,'request\x20sent');logger[_0xe979('0xd')](_0xe979('0xe'),_0x10b854,_0xe979('0xf'),JSON['stringify'](_0x123352));if(_0x123352[_0xe979('0x10')]){if(_0x123352[_0xe979('0x10')][_0xe979('0x11')]===0x1f4){logger['error'](_0xe979('0xc'),_0x10b854,_0x123352[_0xe979('0x10')][_0xe979('0x12')]);return _0x24d817(_0x123352['error'][_0xe979('0x12')]);}logger['error'](_0xe979('0xc'),_0x10b854,_0x123352[_0xe979('0x10')]['message']);return _0x64dd06(_0x123352[_0xe979('0x10')][_0xe979('0x12')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x10b854,_0xe979('0xf'));_0x64dd06(_0x123352[_0xe979('0x13')][_0xe979('0x12')]);}})['catch'](function(_0x53d9f4){logger[_0xe979('0x10')](_0xe979('0xc'),_0x10b854,_0x53d9f4);_0x24d817(_0x53d9f4);});});}exports[_0xe979('0x14')]=function(_0x3e3c76){var _0x3ebb66=this;return new Promise(function(_0x499f4b,_0x322ad4){return db[_0xe979('0x15')]['findAll']({'raw':_0x3e3c76[_0xe979('0x16')]?_0x3e3c76[_0xe979('0x16')][_0xe979('0x17')]===undefined?!![]:![]:!![],'where':_0x3e3c76[_0xe979('0x16')]?_0x3e3c76[_0xe979('0x16')][_0xe979('0x18')]||null:null,'attributes':_0x3e3c76[_0xe979('0x16')]?_0x3e3c76[_0xe979('0x16')][_0xe979('0x19')]||null:null,'limit':_0x3e3c76[_0xe979('0x16')]?_0x3e3c76[_0xe979('0x16')][_0xe979('0x1a')]||null:null,'include':_0x3e3c76['options']?_0x3e3c76[_0xe979('0x16')]['include']?_[_0xe979('0x1b')](_0x3e3c76['options'][_0xe979('0x1c')],function(_0x1b7825){return{'model':db[_0x1b7825['model']],'as':_0x1b7825['as'],'attributes':_0x1b7825[_0xe979('0x19')],'include':_0x1b7825[_0xe979('0x1c')]?_[_0xe979('0x1b')](_0x1b7825[_0xe979('0x1c')],function(_0x37d5d8){return{'model':db[_0x37d5d8['model']],'as':_0x37d5d8['as'],'attributes':_0x37d5d8[_0xe979('0x19')],'include':_0x37d5d8[_0xe979('0x1c')]?_[_0xe979('0x1b')](_0x37d5d8[_0xe979('0x1c')],function(_0x787aa6){return{'model':db[_0x787aa6[_0xe979('0x1d')]],'as':_0x787aa6['as'],'attributes':_0x787aa6[_0xe979('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe979('0x1e')](function(_0x5631cf){logger[_0xe979('0xb')](_0xe979('0x14'),_0x3e3c76);logger[_0xe979('0xd')]('GetMailServerIn',_0x3e3c76,JSON[_0xe979('0x1f')](_0x5631cf));_0x499f4b(_0x5631cf);})[_0xe979('0x20')](function(_0x4c03a9){logger[_0xe979('0x10')](_0xe979('0x14'),_0x4c03a9[_0xe979('0x12')],_0x3e3c76);_0x322ad4(_0x3ebb66[_0xe979('0x10')](0x1f4,_0x4c03a9[_0xe979('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 4c4570f..e996340 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(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +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(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 801f593..3b710ee 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 _0xac4a=['exports','STRING','BOOLEAN','sequelize'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xac4a,0x13f));var _0xaac4=function(_0x3a06d5,_0x119ff2){_0x3a06d5=_0x3a06d5-0x0;var _0xa199c4=_0xac4a[_0x3a06d5];return _0xa199c4;};'use strict';var Sequelize=require(_0xaac4('0x0'));module[_0xaac4('0x1')]={'description':{'type':Sequelize[_0xaac4('0x2')]},'host':{'type':Sequelize[_0xaac4('0x2')]},'user':{'type':Sequelize[_0xaac4('0x2')]},'pass':{'type':Sequelize[_0xaac4('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xaac4('0x2')]},'authentication':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xaac4('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xc788=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x4e8d24,_0x80f7ad){var _0x52f58b=function(_0x51a5fa){while(--_0x51a5fa){_0x4e8d24['push'](_0x4e8d24['shift']());}};_0x52f58b(++_0x80f7ad);}(_0xc788,0xc4));var _0x8c78=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0xc788[_0x1b70e3];return _0x1452ab;};'use strict';var Sequelize=require(_0x8c78('0x0'));module[_0x8c78('0x1')]={'description':{'type':Sequelize[_0x8c78('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x8c78('0x2')]},'port':{'type':Sequelize[_0x8c78('0x3')]},'secure':{'type':Sequelize[_0x8c78('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x8c78('0x2')]},'authentication':{'type':Sequelize[_0x8c78('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index b6b7200..fddcccc 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 _0xe103=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','length','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs'];(function(_0x1e5758,_0x43d2fb){var _0x3d71f0=function(_0x42ddc2){while(--_0x42ddc2){_0x1e5758['push'](_0x1e5758['shift']());}};_0x3d71f0(++_0x43d2fb);}(_0xe103,0x1af));var _0x3e10=function(_0x56f444,_0x5a578e){_0x56f444=_0x56f444-0x0;var _0x404131=_0xe103[_0x56f444];return _0x404131;};'use strict';var emlformat=require(_0x3e10('0x0'));var rimraf=require(_0x3e10('0x1'));var zipdir=require(_0x3e10('0x2'));var jsonpatch=require(_0x3e10('0x3'));var rp=require(_0x3e10('0x4'));var moment=require(_0x3e10('0x5'));var BPromise=require(_0x3e10('0x6'));var Mustache=require(_0x3e10('0x7'));var util=require(_0x3e10('0x8'));var path=require(_0x3e10('0x9'));var sox=require(_0x3e10('0xa'));var csv=require(_0x3e10('0xb'));var ejs=require(_0x3e10('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3e10('0xd'));var squel=require(_0x3e10('0xe'));var crypto=require('crypto');var jsforce=require(_0x3e10('0xf'));var deskjs=require(_0x3e10('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3e10('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3e10('0x12'));var as=require(_0x3e10('0x13'));var hardwareService=require(_0x3e10('0x14'));var logger=require(_0x3e10('0x15'))('api');var utils=require(_0x3e10('0x16'));var config=require(_0x3e10('0x17'));var licenseUtil=require(_0x3e10('0x18'));var db=require(_0x3e10('0x19'))['db'];function respondWithStatusCode(_0x56ccb2,_0x54777e){_0x54777e=_0x54777e||0xcc;return function(_0x1dfc9c){if(_0x1dfc9c){return _0x56ccb2[_0x3e10('0x1a')](_0x54777e);}return _0x56ccb2['status'](_0x54777e)[_0x3e10('0x1b')]();};}function respondWithResult(_0x14d9c7,_0x5c9f3c){_0x5c9f3c=_0x5c9f3c||0xc8;return function(_0x579552){if(_0x579552){return _0x14d9c7['status'](_0x5c9f3c)[_0x3e10('0x1c')](_0x579552);}};}function respondWithFilteredResult(_0x58dc70,_0x16b93e){return function(_0x7df2d1){if(_0x7df2d1){var _0x27ead3=typeof _0x16b93e[_0x3e10('0x1d')]===_0x3e10('0x1e')&&typeof _0x16b93e[_0x3e10('0x1f')]===_0x3e10('0x1e');var _0x1e9ca5=_0x7df2d1[_0x3e10('0x20')];var _0x223d24=_0x27ead3?0x0:_0x16b93e[_0x3e10('0x1d')];var _0x3cdbfa=_0x27ead3?_0x7df2d1[_0x3e10('0x20')]:_0x16b93e[_0x3e10('0x1d')]+_0x16b93e['limit'];var _0x3c2960;if(_0x3cdbfa>=_0x1e9ca5){_0x3cdbfa=_0x1e9ca5;_0x3c2960=0xc8;}else{_0x3c2960=0xce;}_0x58dc70[_0x3e10('0x21')](_0x3c2960);return _0x58dc70[_0x3e10('0x22')]('Content-Range',_0x223d24+'-'+_0x3cdbfa+'/'+_0x1e9ca5)['json'](_0x7df2d1);}return null;};}function patchUpdates(_0xf6afcb){return function(_0x2e6eda){try{jsonpatch[_0x3e10('0x23')](_0x2e6eda,_0xf6afcb,!![]);}catch(_0x5a5749){return BPromise[_0x3e10('0x24')](_0x5a5749);}return _0x2e6eda['save']();};}function saveUpdates(_0x504d00,_0x1adbea){return function(_0x19824b){if(_0x19824b){return _0x19824b[_0x3e10('0x25')](_0x504d00)[_0x3e10('0x26')](function(_0x361ba1){return _0x361ba1;});}return null;};}function removeEntity(_0x363cdd,_0x412fd3){return function(_0x4a6eac){if(_0x4a6eac){return _0x4a6eac[_0x3e10('0x27')]()[_0x3e10('0x26')](function(){_0x363cdd[_0x3e10('0x21')](0xcc)[_0x3e10('0x1b')]();});}};}function handleEntityNotFound(_0x3eab18,_0x2f5702){return function(_0x1d98ab){if(!_0x1d98ab){_0x3eab18['sendStatus'](0x194);}return _0x1d98ab;};}function handleError(_0x3d415c,_0x4f92b0){_0x4f92b0=_0x4f92b0||0x1f4;return function(_0x5394eb){logger[_0x3e10('0x28')](_0x5394eb[_0x3e10('0x29')]);if(_0x5394eb[_0x3e10('0x2a')]){delete _0x5394eb['name'];}_0x3d415c['status'](_0x4f92b0)[_0x3e10('0x2b')](_0x5394eb);};}exports[_0x3e10('0x2c')]=function(_0x46d2f6,_0x2f94e2){var _0x3528d2={},_0x369b26={},_0x154413={'count':0x0,'rows':[]};var _0x50e4b4=_[_0x3e10('0x2d')](db[_0x3e10('0x2e')][_0x3e10('0x2f')],function(_0x4c6850){return{'name':_0x4c6850[_0x3e10('0x30')],'type':_0x4c6850[_0x3e10('0x31')][_0x3e10('0x32')]};});_0x369b26[_0x3e10('0x33')]=_[_0x3e10('0x2d')](_0x50e4b4,_0x3e10('0x2a'));_0x369b26['query']=_[_0x3e10('0x34')](_0x46d2f6[_0x3e10('0x35')]);_0x369b26[_0x3e10('0x36')]=_[_0x3e10('0x37')](_0x369b26[_0x3e10('0x33')],_0x369b26[_0x3e10('0x35')]);_0x3528d2[_0x3e10('0x38')]=_['intersection'](_0x369b26['model'],qs[_0x3e10('0x39')](_0x46d2f6[_0x3e10('0x35')]['fields']));_0x3528d2[_0x3e10('0x38')]=_0x3528d2[_0x3e10('0x38')]['length']?_0x3528d2[_0x3e10('0x38')]:_0x369b26[_0x3e10('0x33')];if(!_0x46d2f6[_0x3e10('0x35')]['hasOwnProperty']('nolimit')){_0x3528d2[_0x3e10('0x1f')]=qs[_0x3e10('0x1f')](_0x46d2f6[_0x3e10('0x35')][_0x3e10('0x1f')]);_0x3528d2[_0x3e10('0x1d')]=qs[_0x3e10('0x1d')](_0x46d2f6[_0x3e10('0x35')]['offset']);}_0x3528d2[_0x3e10('0x3a')]=qs[_0x3e10('0x3b')](_0x46d2f6[_0x3e10('0x35')][_0x3e10('0x3b')]);_0x3528d2[_0x3e10('0x3c')]=qs[_0x3e10('0x36')](_[_0x3e10('0x3d')](_0x46d2f6['query'],_0x369b26[_0x3e10('0x36')]),_0x50e4b4);if(_0x46d2f6[_0x3e10('0x35')][_0x3e10('0x3e')]){_0x3528d2[_0x3e10('0x3c')]=_[_0x3e10('0x3f')](_0x3528d2[_0x3e10('0x3c')],{'$or':_['map'](_0x50e4b4,function(_0x359219){if(_0x359219[_0x3e10('0x31')]!==_0x3e10('0x40')){var _0x4298b1={};_0x4298b1[_0x359219[_0x3e10('0x2a')]]={'$like':'%'+_0x46d2f6[_0x3e10('0x35')]['filter']+'%'};return _0x4298b1;}})});}_0x3528d2=_[_0x3e10('0x3f')]({},_0x3528d2,_0x46d2f6['options']);var _0x565918={'where':_0x3528d2['where']};return db[_0x3e10('0x2e')][_0x3e10('0x20')](_0x565918)[_0x3e10('0x26')](function(_0x5acb20){_0x154413[_0x3e10('0x20')]=_0x5acb20;if(_0x46d2f6[_0x3e10('0x35')][_0x3e10('0x41')]){_0x3528d2['include']=[{'all':!![]}];}return db['MailServerOut'][_0x3e10('0x42')](_0x3528d2);})[_0x3e10('0x26')](function(_0x2b5bd8){_0x154413['rows']=_0x2b5bd8;return _0x154413;})['then'](respondWithFilteredResult(_0x2f94e2,_0x3528d2))[_0x3e10('0x43')](handleError(_0x2f94e2,null));};exports[_0x3e10('0x44')]=function(_0x3cc7cb,_0x56ff7b){var _0x168bfa={'raw':!![],'where':{'id':_0x3cc7cb[_0x3e10('0x45')]['id']}},_0x307ac7={};_0x307ac7[_0x3e10('0x33')]=_[_0x3e10('0x34')](db[_0x3e10('0x2e')][_0x3e10('0x2f')]);_0x307ac7[_0x3e10('0x35')]=_[_0x3e10('0x34')](_0x3cc7cb[_0x3e10('0x35')]);_0x307ac7[_0x3e10('0x36')]=_['intersection'](_0x307ac7[_0x3e10('0x33')],_0x307ac7[_0x3e10('0x35')]);_0x168bfa['attributes']=_[_0x3e10('0x37')](_0x307ac7[_0x3e10('0x33')],qs[_0x3e10('0x39')](_0x3cc7cb[_0x3e10('0x35')]['fields']));_0x168bfa[_0x3e10('0x38')]=_0x168bfa[_0x3e10('0x38')][_0x3e10('0x46')]?_0x168bfa[_0x3e10('0x38')]:_0x307ac7[_0x3e10('0x33')];if(_0x3cc7cb[_0x3e10('0x35')][_0x3e10('0x41')]){_0x168bfa['include']=[{'all':!![]}];}_0x168bfa=_[_0x3e10('0x3f')]({},_0x168bfa,_0x3cc7cb[_0x3e10('0x47')]);return db['MailServerOut'][_0x3e10('0x48')](_0x168bfa)[_0x3e10('0x26')](handleEntityNotFound(_0x56ff7b,null))[_0x3e10('0x26')](respondWithResult(_0x56ff7b,null))['catch'](handleError(_0x56ff7b,null));};exports[_0x3e10('0x49')]=function(_0x3398c2,_0x58ed2a){return db[_0x3e10('0x2e')][_0x3e10('0x49')](_0x3398c2[_0x3e10('0x4a')],{})[_0x3e10('0x26')](respondWithResult(_0x58ed2a,0xc9))[_0x3e10('0x43')](handleError(_0x58ed2a,null));};exports['update']=function(_0x4f4184,_0x21ebe5){if(_0x4f4184[_0x3e10('0x4a')]['id']){delete _0x4f4184[_0x3e10('0x4a')]['id'];}return db[_0x3e10('0x2e')][_0x3e10('0x48')]({'where':{'id':_0x4f4184[_0x3e10('0x45')]['id']}})[_0x3e10('0x26')](handleEntityNotFound(_0x21ebe5,null))[_0x3e10('0x26')](saveUpdates(_0x4f4184[_0x3e10('0x4a')],null))[_0x3e10('0x26')](respondWithResult(_0x21ebe5,null))[_0x3e10('0x43')](handleError(_0x21ebe5,null));};exports[_0x3e10('0x27')]=function(_0x5aaddf,_0x51539b){return db[_0x3e10('0x2e')][_0x3e10('0x48')]({'where':{'id':_0x5aaddf[_0x3e10('0x45')]['id']}})['then'](handleEntityNotFound(_0x51539b,null))['then'](removeEntity(_0x51539b,null))['catch'](handleError(_0x51539b,null));}; \ No newline at end of file +var _0x212f=['show','params','keys','merge','create','body','find','destroy','rimraf','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','options','includeAll','include','findAll','catch'];(function(_0x2c5388,_0x27a87f){var _0x2e040a=function(_0xbd9998){while(--_0xbd9998){_0x2c5388['push'](_0x2c5388['shift']());}};_0x2e040a(++_0x27a87f);}(_0x212f,0x1b2));var _0xf212=function(_0x59ba2b,_0x95b584){_0x59ba2b=_0x59ba2b-0x0;var _0x2e5f42=_0x212f[_0x59ba2b];return _0x2e5f42;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf212('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf212('0x1'));var moment=require(_0xf212('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf212('0x3'));var path=require(_0xf212('0x4'));var sox=require('sox');var csv=require(_0xf212('0x5'));var ejs=require(_0xf212('0x6'));var fs=require('fs');var fs_extra=require(_0xf212('0x7'));var _=require('lodash');var squel=require(_0xf212('0x8'));var crypto=require(_0xf212('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xf212('0xa'));var toCsv=require(_0xf212('0x5'));var querystring=require(_0xf212('0xb'));var Papa=require('papaparse');var Redis=require(_0xf212('0xc'));var authService=require(_0xf212('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xf212('0xe'));var hardwareService=require(_0xf212('0xf'));var logger=require(_0xf212('0x10'))(_0xf212('0x11'));var utils=require('../../config/utils');var config=require(_0xf212('0x12'));var licenseUtil=require(_0xf212('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c6c4b,_0x3af5ca){_0x3af5ca=_0x3af5ca||0xcc;return function(_0x6ef2b9){if(_0x6ef2b9){return _0x3c6c4b[_0xf212('0x14')](_0x3af5ca);}return _0x3c6c4b['status'](_0x3af5ca)[_0xf212('0x15')]();};}function respondWithResult(_0x3df562,_0x5b0341){_0x5b0341=_0x5b0341||0xc8;return function(_0x3cd776){if(_0x3cd776){return _0x3df562[_0xf212('0x16')](_0x5b0341)[_0xf212('0x17')](_0x3cd776);}};}function respondWithFilteredResult(_0x21cb71,_0x711210){return function(_0x515e63){if(_0x515e63){var _0x33cd4a=typeof _0x711210[_0xf212('0x18')]===_0xf212('0x19')&&typeof _0x711210[_0xf212('0x1a')]===_0xf212('0x19');var _0x2cfff1=_0x515e63[_0xf212('0x1b')];var _0x3fad78=_0x33cd4a?0x0:_0x711210[_0xf212('0x18')];var _0x48e28f=_0x33cd4a?_0x515e63[_0xf212('0x1b')]:_0x711210[_0xf212('0x18')]+_0x711210[_0xf212('0x1a')];var _0x1afc73;if(_0x48e28f>=_0x2cfff1){_0x48e28f=_0x2cfff1;_0x1afc73=0xc8;}else{_0x1afc73=0xce;}_0x21cb71[_0xf212('0x16')](_0x1afc73);return _0x21cb71['set']('Content-Range',_0x3fad78+'-'+_0x48e28f+'/'+_0x2cfff1)['json'](_0x515e63);}return null;};}function patchUpdates(_0x49c812){return function(_0x210e1b){try{jsonpatch[_0xf212('0x1c')](_0x210e1b,_0x49c812,!![]);}catch(_0x26be7c){return BPromise[_0xf212('0x1d')](_0x26be7c);}return _0x210e1b[_0xf212('0x1e')]();};}function saveUpdates(_0x56d883,_0xbe0c89){return function(_0x3b3d3d){if(_0x3b3d3d){return _0x3b3d3d[_0xf212('0x1f')](_0x56d883)['then'](function(_0x37e3db){return _0x37e3db;});}return null;};}function removeEntity(_0x1f65d0,_0xa7892e){return function(_0x164223){if(_0x164223){return _0x164223['destroy']()[_0xf212('0x20')](function(){_0x1f65d0[_0xf212('0x16')](0xcc)[_0xf212('0x15')]();});}};}function handleEntityNotFound(_0x7d25cd,_0x239965){return function(_0x2c4db5){if(!_0x2c4db5){_0x7d25cd['sendStatus'](0x194);}return _0x2c4db5;};}function handleError(_0x114285,_0x1e6e5a){_0x1e6e5a=_0x1e6e5a||0x1f4;return function(_0x48fb2b){logger[_0xf212('0x21')](_0x48fb2b[_0xf212('0x22')]);if(_0x48fb2b[_0xf212('0x23')]){delete _0x48fb2b[_0xf212('0x23')];}_0x114285[_0xf212('0x16')](_0x1e6e5a)[_0xf212('0x24')](_0x48fb2b);};}exports[_0xf212('0x25')]=function(_0x3c67c4,_0x5d4a59){var _0x5d1526={},_0x595dd7={},_0x35ea8b={'count':0x0,'rows':[]};var _0x215093=_[_0xf212('0x26')](db[_0xf212('0x27')][_0xf212('0x28')],function(_0x1d1b8b){return{'name':_0x1d1b8b[_0xf212('0x29')],'type':_0x1d1b8b[_0xf212('0x2a')][_0xf212('0x2b')]};});_0x595dd7[_0xf212('0x2c')]=_[_0xf212('0x26')](_0x215093,_0xf212('0x23'));_0x595dd7['query']=_['keys'](_0x3c67c4[_0xf212('0x2d')]);_0x595dd7[_0xf212('0x2e')]=_[_0xf212('0x2f')](_0x595dd7['model'],_0x595dd7[_0xf212('0x2d')]);_0x5d1526[_0xf212('0x30')]=_[_0xf212('0x2f')](_0x595dd7[_0xf212('0x2c')],qs[_0xf212('0x31')](_0x3c67c4['query'][_0xf212('0x31')]));_0x5d1526[_0xf212('0x30')]=_0x5d1526['attributes'][_0xf212('0x32')]?_0x5d1526[_0xf212('0x30')]:_0x595dd7[_0xf212('0x2c')];if(!_0x3c67c4['query'][_0xf212('0x33')](_0xf212('0x34'))){_0x5d1526[_0xf212('0x1a')]=qs['limit'](_0x3c67c4[_0xf212('0x2d')][_0xf212('0x1a')]);_0x5d1526[_0xf212('0x18')]=qs['offset'](_0x3c67c4[_0xf212('0x2d')][_0xf212('0x18')]);}_0x5d1526[_0xf212('0x35')]=qs[_0xf212('0x36')](_0x3c67c4[_0xf212('0x2d')][_0xf212('0x36')]);_0x5d1526['where']=qs['filters'](_[_0xf212('0x37')](_0x3c67c4[_0xf212('0x2d')],_0x595dd7[_0xf212('0x2e')]),_0x215093);if(_0x3c67c4['query'][_0xf212('0x38')]){_0x5d1526[_0xf212('0x39')]=_['merge'](_0x5d1526[_0xf212('0x39')],{'$or':_[_0xf212('0x26')](_0x215093,function(_0x48945c){if(_0x48945c[_0xf212('0x2a')]!=='VIRTUAL'){var _0x1fc92f={};_0x1fc92f[_0x48945c[_0xf212('0x23')]]={'$like':'%'+_0x3c67c4[_0xf212('0x2d')][_0xf212('0x38')]+'%'};return _0x1fc92f;}})});}_0x5d1526=_['merge']({},_0x5d1526,_0x3c67c4[_0xf212('0x3a')]);var _0x343ccb={'where':_0x5d1526[_0xf212('0x39')]};return db[_0xf212('0x27')][_0xf212('0x1b')](_0x343ccb)[_0xf212('0x20')](function(_0xa66f0a){_0x35ea8b[_0xf212('0x1b')]=_0xa66f0a;if(_0x3c67c4[_0xf212('0x2d')][_0xf212('0x3b')]){_0x5d1526[_0xf212('0x3c')]=[{'all':!![]}];}return db['MailServerOut'][_0xf212('0x3d')](_0x5d1526);})[_0xf212('0x20')](function(_0x3d1631){_0x35ea8b['rows']=_0x3d1631;return _0x35ea8b;})['then'](respondWithFilteredResult(_0x5d4a59,_0x5d1526))[_0xf212('0x3e')](handleError(_0x5d4a59,null));};exports[_0xf212('0x3f')]=function(_0x2846a1,_0x28adae){var _0x32dcc3={'raw':!![],'where':{'id':_0x2846a1[_0xf212('0x40')]['id']}},_0x153f71={};_0x153f71[_0xf212('0x2c')]=_[_0xf212('0x41')](db[_0xf212('0x27')][_0xf212('0x28')]);_0x153f71[_0xf212('0x2d')]=_[_0xf212('0x41')](_0x2846a1[_0xf212('0x2d')]);_0x153f71[_0xf212('0x2e')]=_[_0xf212('0x2f')](_0x153f71[_0xf212('0x2c')],_0x153f71['query']);_0x32dcc3[_0xf212('0x30')]=_['intersection'](_0x153f71[_0xf212('0x2c')],qs[_0xf212('0x31')](_0x2846a1[_0xf212('0x2d')][_0xf212('0x31')]));_0x32dcc3[_0xf212('0x30')]=_0x32dcc3[_0xf212('0x30')][_0xf212('0x32')]?_0x32dcc3[_0xf212('0x30')]:_0x153f71[_0xf212('0x2c')];if(_0x2846a1[_0xf212('0x2d')]['includeAll']){_0x32dcc3[_0xf212('0x3c')]=[{'all':!![]}];}_0x32dcc3=_[_0xf212('0x42')]({},_0x32dcc3,_0x2846a1['options']);return db['MailServerOut']['find'](_0x32dcc3)['then'](handleEntityNotFound(_0x28adae,null))[_0xf212('0x20')](respondWithResult(_0x28adae,null))[_0xf212('0x3e')](handleError(_0x28adae,null));};exports[_0xf212('0x43')]=function(_0x4e2dbb,_0x31ef82){return db[_0xf212('0x27')][_0xf212('0x43')](_0x4e2dbb[_0xf212('0x44')],{})['then'](respondWithResult(_0x31ef82,0xc9))[_0xf212('0x3e')](handleError(_0x31ef82,null));};exports[_0xf212('0x1f')]=function(_0x174f4c,_0x3d217c){if(_0x174f4c[_0xf212('0x44')]['id']){delete _0x174f4c['body']['id'];}return db[_0xf212('0x27')][_0xf212('0x45')]({'where':{'id':_0x174f4c[_0xf212('0x40')]['id']}})[_0xf212('0x20')](handleEntityNotFound(_0x3d217c,null))[_0xf212('0x20')](saveUpdates(_0x174f4c[_0xf212('0x44')],null))[_0xf212('0x20')](respondWithResult(_0x3d217c,null))['catch'](handleError(_0x3d217c,null));};exports[_0xf212('0x46')]=function(_0x154f55,_0x1b0cdd){return db[_0xf212('0x27')]['find']({'where':{'id':_0x154f55[_0xf212('0x40')]['id']}})['then'](handleEntityNotFound(_0x1b0cdd,null))[_0xf212('0x20')](removeEntity(_0x1b0cdd,null))[_0xf212('0x3e')](handleError(_0x1b0cdd,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 6a07436..a549e8a 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 _0x4de6=['api','request-promise','path','rimraf','../../config/environment','define','mail_servers_out','lodash','util'];(function(_0x22835e,_0x14ffec){var _0xb85ef9=function(_0x358f09){while(--_0x358f09){_0x22835e['push'](_0x22835e['shift']());}};_0xb85ef9(++_0x14ffec);}(_0x4de6,0x130));var _0x64de=function(_0x6a4cc5,_0x39e349){_0x6a4cc5=_0x6a4cc5-0x0;var _0x54ef6e=_0x4de6[_0x6a4cc5];return _0x54ef6e;};'use strict';var _=require(_0x64de('0x0'));var util=require(_0x64de('0x1'));var logger=require('../../config/logger')(_0x64de('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x64de('0x3'));var fs=require('fs');var path=require(_0x64de('0x4'));var rimraf=require(_0x64de('0x5'));var config=require(_0x64de('0x6'));var attributes=require('./mailServerOut.attributes');module['exports']=function(_0x14a8ec,_0xd7137d){return _0x14a8ec[_0x64de('0x7')]('MailServerOut',attributes,{'tableName':_0x64de('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x614b=['moment','bluebird','path','../../config/environment','./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','lodash','util'];(function(_0x382826,_0x163563){var _0x1dc986=function(_0x52e873){while(--_0x52e873){_0x382826['push'](_0x382826['shift']());}};_0x1dc986(++_0x163563);}(_0x614b,0xd0));var _0xb614=function(_0x212e93,_0x2ac33d){_0x212e93=_0x212e93-0x0;var _0x2d270c=_0x614b[_0x212e93];return _0x2d270c;};'use strict';var _=require(_0xb614('0x0'));var util=require(_0xb614('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb614('0x2'));var BPromise=require(_0xb614('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb614('0x4'));var rimraf=require('rimraf');var config=require(_0xb614('0x5'));var attributes=require(_0xb614('0x6'));module[_0xb614('0x7')]=function(_0x33890f,_0x495dce){return _0x33890f['define'](_0xb614('0x8'),attributes,{'tableName':_0xb614('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 a576132..aeacd9b 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x552201,_0x17b56b){var _0x4e9e57=function(_0x3e58ab){while(--_0x3e58ab){_0x552201['push'](_0x552201['shift']());}};_0x4e9e57(++_0x17b56b);}(_0xadb5,0xad));var _0x5adb=function(_0x102270,_0xb67e8e){_0x102270=_0x102270-0x0;var _0x366c51=_0xadb5[_0x102270];return _0x366c51;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x7a54=['info','MailServerOut,\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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x30812e,_0x43c1bb){_0x30812e=_0x30812e-0x0;var _0x5e27bd=_0x7a54[_0x30812e];return _0x5e27bd;};'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')]('MailServerOut,\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/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index d35379f..2a9c022 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 _0x5ef3=['Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','post','create','update','delete','destroy','multer','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5ef3,0x174));var _0x35ef=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x5ef3[_0x17406a];return _0x1501ff;};'use strict';var multer=require(_0x35ef('0x0'));var util=require(_0x35ef('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x35ef('0x2')]();var fs_extra=require(_0x35ef('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x35ef('0x4'));var config=require(_0x35ef('0x5'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x35ef('0x6')](),controller[_0x35ef('0x7')]);router[_0x35ef('0x8')](_0x35ef('0x9'),auth[_0x35ef('0x6')](),controller['describe']);router[_0x35ef('0x8')](_0x35ef('0xa'),auth['isAuthenticated'](),controller[_0x35ef('0xb')]);router[_0x35ef('0xc')]('/',auth[_0x35ef('0x6')](),controller[_0x35ef('0xd')]);router['put'](_0x35ef('0xa'),auth['isAuthenticated'](),controller[_0x35ef('0xe')]);router[_0x35ef('0xf')](_0x35ef('0xa'),auth[_0x35ef('0x6')](),controller[_0x35ef('0x10')]);module['exports']=router; \ No newline at end of file +var _0xa430=['/describe','isAuthenticated','describe','/:id','show','create','update','delete','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','get','index'];(function(_0x1aa54a,_0x26265d){var _0x550f30=function(_0x3df959){while(--_0x3df959){_0x1aa54a['push'](_0x1aa54a['shift']());}};_0x550f30(++_0x26265d);}(_0xa430,0x12a));var _0x0a43=function(_0x165788,_0x3f0645){_0x165788=_0x165788-0x0;var _0x267137=_0xa430[_0x165788];return _0x267137;};'use strict';var multer=require(_0x0a43('0x0'));var util=require(_0x0a43('0x1'));var path=require(_0x0a43('0x2'));var timeout=require(_0x0a43('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0a43('0x4'));var config=require(_0x0a43('0x5'));var controller=require('./mailSubstatus.controller');router[_0x0a43('0x6')]('/',auth['isAuthenticated'](),controller[_0x0a43('0x7')]);router[_0x0a43('0x6')](_0x0a43('0x8'),auth[_0x0a43('0x9')](),controller[_0x0a43('0xa')]);router[_0x0a43('0x6')](_0x0a43('0xb'),auth[_0x0a43('0x9')](),controller[_0x0a43('0xc')]);router['post']('/',auth[_0x0a43('0x9')](),controller[_0x0a43('0xd')]);router['put']('/:id',auth[_0x0a43('0x9')](),controller[_0x0a43('0xe')]);router[_0x0a43('0xf')](_0x0a43('0xb'),auth[_0x0a43('0x9')](),controller['destroy']);module[_0x0a43('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 47bd737..66dacb2 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 _0x446c=['STRING','name','sequelize','exports'];(function(_0x81d043,_0x55573d){var _0x1641b8=function(_0x1d5315){while(--_0x1d5315){_0x81d043['push'](_0x81d043['shift']());}};_0x1641b8(++_0x55573d);}(_0x446c,0x156));var _0xc446=function(_0x525b28,_0x5cf5a0){_0x525b28=_0x525b28-0x0;var _0x180178=_0x446c[_0x525b28];return _0x180178;};'use strict';var Sequelize=require(_0xc446('0x0'));module[_0xc446('0x1')]={'name':{'type':Sequelize[_0xc446('0x2')],'unique':_0xc446('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0295=['sequelize','name'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x0295,0x1f0));var _0x5029=function(_0x562cd7,_0x5ae8e7){_0x562cd7=_0x562cd7-0x0;var _0x30f50d=_0x0295[_0x562cd7];return _0x30f50d;};'use strict';var Sequelize=require(_0x5029('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5029('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 59472eb..5554ab7 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 _0x7b90=['../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment'];(function(_0x11ba83,_0xd5611a){var _0x3f3925=function(_0x3d7cb0){while(--_0x3d7cb0){_0x11ba83['push'](_0x11ba83['shift']());}};_0x3f3925(++_0xd5611a);}(_0x7b90,0x126));var _0x07b9=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x7b90[_0x126558];return _0x1f6d14;};'use strict';var emlformat=require(_0x07b9('0x0'));var rimraf=require(_0x07b9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x07b9('0x2'));var rp=require(_0x07b9('0x3'));var moment=require(_0x07b9('0x4'));var BPromise=require(_0x07b9('0x5'));var Mustache=require(_0x07b9('0x6'));var util=require(_0x07b9('0x7'));var path=require(_0x07b9('0x8'));var sox=require(_0x07b9('0x9'));var csv=require('to-csv');var ejs=require(_0x07b9('0xa'));var fs=require('fs');var fs_extra=require(_0x07b9('0xb'));var _=require(_0x07b9('0xc'));var squel=require(_0x07b9('0xd'));var crypto=require('crypto');var jsforce=require(_0x07b9('0xe'));var deskjs=require(_0x07b9('0xf'));var toCsv=require(_0x07b9('0x10'));var querystring=require(_0x07b9('0x11'));var Papa=require(_0x07b9('0x12'));var Redis=require(_0x07b9('0x13'));var authService=require(_0x07b9('0x14'));var qs=require(_0x07b9('0x15'));var as=require(_0x07b9('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x07b9('0x17'))(_0x07b9('0x18'));var utils=require('../../config/utils');var config=require(_0x07b9('0x19'));var licenseUtil=require(_0x07b9('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ac46c,_0x4452a0){_0x4452a0=_0x4452a0||0xcc;return function(_0x395047){if(_0x395047){return _0x3ac46c[_0x07b9('0x1b')](_0x4452a0);}return _0x3ac46c[_0x07b9('0x1c')](_0x4452a0)[_0x07b9('0x1d')]();};}function respondWithResult(_0x5e6e7c,_0x39af11){_0x39af11=_0x39af11||0xc8;return function(_0x319729){if(_0x319729){return _0x5e6e7c[_0x07b9('0x1c')](_0x39af11)[_0x07b9('0x1e')](_0x319729);}};}function respondWithFilteredResult(_0x47515d,_0x562746){return function(_0xe08a85){if(_0xe08a85){var _0x4dedab=typeof _0x562746[_0x07b9('0x1f')]===_0x07b9('0x20')&&typeof _0x562746[_0x07b9('0x21')]===_0x07b9('0x20');var _0x31caf8=_0xe08a85[_0x07b9('0x22')];var _0x59fdbd=_0x4dedab?0x0:_0x562746[_0x07b9('0x1f')];var _0x261c30=_0x4dedab?_0xe08a85[_0x07b9('0x22')]:_0x562746['offset']+_0x562746[_0x07b9('0x21')];var _0x3ee7c4;if(_0x261c30>=_0x31caf8){_0x261c30=_0x31caf8;_0x3ee7c4=0xc8;}else{_0x3ee7c4=0xce;}_0x47515d[_0x07b9('0x1c')](_0x3ee7c4);return _0x47515d[_0x07b9('0x23')](_0x07b9('0x24'),_0x59fdbd+'-'+_0x261c30+'/'+_0x31caf8)[_0x07b9('0x1e')](_0xe08a85);}return null;};}function patchUpdates(_0x37279c){return function(_0x2c0dc7){try{jsonpatch['apply'](_0x2c0dc7,_0x37279c,!![]);}catch(_0x411829){return BPromise[_0x07b9('0x25')](_0x411829);}return _0x2c0dc7[_0x07b9('0x26')]();};}function saveUpdates(_0x29d73a,_0x1a0648){return function(_0x8a5bb6){if(_0x8a5bb6){return _0x8a5bb6[_0x07b9('0x27')](_0x29d73a)['then'](function(_0x3cabf0){return _0x3cabf0;});}return null;};}function removeEntity(_0x3581d8,_0x75966a){return function(_0x1379d5){if(_0x1379d5){return _0x1379d5[_0x07b9('0x28')]()[_0x07b9('0x29')](function(){_0x3581d8[_0x07b9('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d6394,_0x28a418){return function(_0x58e0d){if(!_0x58e0d){_0x5d6394[_0x07b9('0x1b')](0x194);}return _0x58e0d;};}function handleError(_0x155d93,_0xe3dbe0){_0xe3dbe0=_0xe3dbe0||0x1f4;return function(_0x208b18){logger['error'](_0x208b18[_0x07b9('0x2a')]);if(_0x208b18['name']){delete _0x208b18[_0x07b9('0x2b')];}_0x155d93[_0x07b9('0x1c')](_0xe3dbe0)[_0x07b9('0x2c')](_0x208b18);};}exports[_0x07b9('0x2d')]=function(_0x475ad1,_0x2fb1b6){var _0x33e0cb={},_0x24ca7c={},_0x44f345={'count':0x0,'rows':[]};var _0x332471=_[_0x07b9('0x2e')](db[_0x07b9('0x2f')][_0x07b9('0x30')],function(_0xd15bff){return{'name':_0xd15bff[_0x07b9('0x31')],'type':_0xd15bff['type'][_0x07b9('0x32')]};});_0x24ca7c[_0x07b9('0x33')]=_['map'](_0x332471,'name');_0x24ca7c[_0x07b9('0x34')]=_[_0x07b9('0x35')](_0x475ad1['query']);_0x24ca7c[_0x07b9('0x36')]=_[_0x07b9('0x37')](_0x24ca7c[_0x07b9('0x33')],_0x24ca7c['query']);_0x33e0cb[_0x07b9('0x38')]=_[_0x07b9('0x37')](_0x24ca7c[_0x07b9('0x33')],qs[_0x07b9('0x39')](_0x475ad1[_0x07b9('0x34')][_0x07b9('0x39')]));_0x33e0cb[_0x07b9('0x38')]=_0x33e0cb[_0x07b9('0x38')]['length']?_0x33e0cb[_0x07b9('0x38')]:_0x24ca7c[_0x07b9('0x33')];if(!_0x475ad1['query'][_0x07b9('0x3a')](_0x07b9('0x3b'))){_0x33e0cb[_0x07b9('0x21')]=qs[_0x07b9('0x21')](_0x475ad1[_0x07b9('0x34')]['limit']);_0x33e0cb['offset']=qs[_0x07b9('0x1f')](_0x475ad1[_0x07b9('0x34')]['offset']);}_0x33e0cb[_0x07b9('0x3c')]=qs['sort'](_0x475ad1[_0x07b9('0x34')][_0x07b9('0x3d')]);_0x33e0cb['where']=qs[_0x07b9('0x36')](_[_0x07b9('0x3e')](_0x475ad1['query'],_0x24ca7c[_0x07b9('0x36')]),_0x332471);if(_0x475ad1[_0x07b9('0x34')][_0x07b9('0x3f')]){_0x33e0cb[_0x07b9('0x40')]=_[_0x07b9('0x41')](_0x33e0cb[_0x07b9('0x40')],{'$or':_['map'](_0x332471,function(_0x35bd75){if(_0x35bd75[_0x07b9('0x42')]!=='VIRTUAL'){var _0x53f358={};_0x53f358[_0x35bd75['name']]={'$like':'%'+_0x475ad1[_0x07b9('0x34')][_0x07b9('0x3f')]+'%'};return _0x53f358;}})});}_0x33e0cb=_[_0x07b9('0x41')]({},_0x33e0cb,_0x475ad1[_0x07b9('0x43')]);var _0x2aa7ef={'where':_0x33e0cb[_0x07b9('0x40')]};return db[_0x07b9('0x2f')][_0x07b9('0x22')](_0x2aa7ef)['then'](function(_0x58a6f3){_0x44f345['count']=_0x58a6f3;if(_0x475ad1[_0x07b9('0x34')][_0x07b9('0x44')]){_0x33e0cb[_0x07b9('0x45')]=[{'all':!![]}];}return db[_0x07b9('0x2f')][_0x07b9('0x46')](_0x33e0cb);})[_0x07b9('0x29')](function(_0x2cefaf){_0x44f345[_0x07b9('0x47')]=_0x2cefaf;return _0x44f345;})['then'](respondWithFilteredResult(_0x2fb1b6,_0x33e0cb))['catch'](handleError(_0x2fb1b6,null));};exports[_0x07b9('0x48')]=function(_0x3b002e,_0x715ae6){var _0x283cd7={'raw':!![],'where':{'id':_0x3b002e[_0x07b9('0x49')]['id']}},_0x4b1b1b={};_0x4b1b1b[_0x07b9('0x33')]=_['keys'](db[_0x07b9('0x2f')][_0x07b9('0x30')]);_0x4b1b1b[_0x07b9('0x34')]=_[_0x07b9('0x35')](_0x3b002e['query']);_0x4b1b1b[_0x07b9('0x36')]=_[_0x07b9('0x37')](_0x4b1b1b[_0x07b9('0x33')],_0x4b1b1b[_0x07b9('0x34')]);_0x283cd7[_0x07b9('0x38')]=_[_0x07b9('0x37')](_0x4b1b1b[_0x07b9('0x33')],qs[_0x07b9('0x39')](_0x3b002e['query']['fields']));_0x283cd7[_0x07b9('0x38')]=_0x283cd7[_0x07b9('0x38')][_0x07b9('0x4a')]?_0x283cd7['attributes']:_0x4b1b1b[_0x07b9('0x33')];if(_0x3b002e[_0x07b9('0x34')]['includeAll']){_0x283cd7[_0x07b9('0x45')]=[{'all':!![]}];}_0x283cd7=_['merge']({},_0x283cd7,_0x3b002e[_0x07b9('0x43')]);return db['MailSubstatus'][_0x07b9('0x4b')](_0x283cd7)[_0x07b9('0x29')](handleEntityNotFound(_0x715ae6,null))[_0x07b9('0x29')](respondWithResult(_0x715ae6,null))[_0x07b9('0x4c')](handleError(_0x715ae6,null));};exports[_0x07b9('0x4d')]=function(_0x15acf4,_0x3408c2){return db[_0x07b9('0x2f')][_0x07b9('0x4d')](_0x15acf4[_0x07b9('0x4e')],{})[_0x07b9('0x29')](respondWithResult(_0x3408c2,0xc9))[_0x07b9('0x4c')](handleError(_0x3408c2,null));};exports[_0x07b9('0x27')]=function(_0x68bec2,_0x4c0169){if(_0x68bec2[_0x07b9('0x4e')]['id']){delete _0x68bec2[_0x07b9('0x4e')]['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x68bec2[_0x07b9('0x49')]['id']}})[_0x07b9('0x29')](handleEntityNotFound(_0x4c0169,null))[_0x07b9('0x29')](saveUpdates(_0x68bec2[_0x07b9('0x4e')],null))[_0x07b9('0x29')](respondWithResult(_0x4c0169,null))[_0x07b9('0x4c')](handleError(_0x4c0169,null));};exports[_0x07b9('0x28')]=function(_0x4063fd,_0x228fab){return db['MailSubstatus'][_0x07b9('0x4b')]({'where':{'id':_0x4063fd['params']['id']}})[_0x07b9('0x29')](handleEntityNotFound(_0x228fab,null))[_0x07b9('0x29')](removeEntity(_0x228fab,null))['catch'](handleError(_0x228fab,null));};exports[_0x07b9('0x4f')]=function(_0x3ca40b,_0x1daa43){return db[_0x07b9('0x2f')]['describe']()['then'](respondWithResult(_0x1daa43,null))[_0x07b9('0x4c')](handleError(_0x1daa43,null));}; \ No newline at end of file +var _0xfaaf=['VIRTUAL','options','MailSubstatus','include','findAll','rows','catch','show','params','rawAttributes','keys','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','error','name','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xfaaf,0x128));var _0xffaa=function(_0x500611,_0x179481){_0x500611=_0x500611-0x0;var _0x379d32=_0xfaaf[_0x500611];return _0x379d32;};'use strict';var emlformat=require(_0xffaa('0x0'));var rimraf=require(_0xffaa('0x1'));var zipdir=require(_0xffaa('0x2'));var jsonpatch=require(_0xffaa('0x3'));var rp=require(_0xffaa('0x4'));var moment=require(_0xffaa('0x5'));var BPromise=require(_0xffaa('0x6'));var Mustache=require(_0xffaa('0x7'));var util=require('util');var path=require(_0xffaa('0x8'));var sox=require(_0xffaa('0x9'));var csv=require(_0xffaa('0xa'));var ejs=require(_0xffaa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xffaa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xffaa('0xa'));var querystring=require(_0xffaa('0xd'));var Papa=require(_0xffaa('0xe'));var Redis=require('ioredis');var authService=require(_0xffaa('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xffaa('0x10'));var logger=require('../../config/logger')(_0xffaa('0x11'));var utils=require(_0xffaa('0x12'));var config=require(_0xffaa('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xffaa('0x14'))['db'];function respondWithStatusCode(_0x2b4e51,_0x1ab564){_0x1ab564=_0x1ab564||0xcc;return function(_0x23d73c){if(_0x23d73c){return _0x2b4e51['sendStatus'](_0x1ab564);}return _0x2b4e51[_0xffaa('0x15')](_0x1ab564)[_0xffaa('0x16')]();};}function respondWithResult(_0x5476aa,_0x4bae62){_0x4bae62=_0x4bae62||0xc8;return function(_0x2cb444){if(_0x2cb444){return _0x5476aa[_0xffaa('0x15')](_0x4bae62)[_0xffaa('0x17')](_0x2cb444);}};}function respondWithFilteredResult(_0x59a892,_0x3540c3){return function(_0x4e10e6){if(_0x4e10e6){var _0x3c0266=typeof _0x3540c3['offset']===_0xffaa('0x18')&&typeof _0x3540c3[_0xffaa('0x19')]===_0xffaa('0x18');var _0x45d819=_0x4e10e6['count'];var _0x3be695=_0x3c0266?0x0:_0x3540c3[_0xffaa('0x1a')];var _0x3328ba=_0x3c0266?_0x4e10e6[_0xffaa('0x1b')]:_0x3540c3['offset']+_0x3540c3[_0xffaa('0x19')];var _0x2b8e50;if(_0x3328ba>=_0x45d819){_0x3328ba=_0x45d819;_0x2b8e50=0xc8;}else{_0x2b8e50=0xce;}_0x59a892[_0xffaa('0x15')](_0x2b8e50);return _0x59a892[_0xffaa('0x1c')](_0xffaa('0x1d'),_0x3be695+'-'+_0x3328ba+'/'+_0x45d819)[_0xffaa('0x17')](_0x4e10e6);}return null;};}function patchUpdates(_0x521c1e){return function(_0x36e9a1){try{jsonpatch[_0xffaa('0x1e')](_0x36e9a1,_0x521c1e,!![]);}catch(_0x163763){return BPromise['reject'](_0x163763);}return _0x36e9a1[_0xffaa('0x1f')]();};}function saveUpdates(_0x190adf,_0x4dbe76){return function(_0x42051c){if(_0x42051c){return _0x42051c[_0xffaa('0x20')](_0x190adf)[_0xffaa('0x21')](function(_0x20a5f8){return _0x20a5f8;});}return null;};}function removeEntity(_0x4f0ce1,_0x3d09e8){return function(_0x447023){if(_0x447023){return _0x447023[_0xffaa('0x22')]()['then'](function(){_0x4f0ce1[_0xffaa('0x15')](0xcc)[_0xffaa('0x16')]();});}};}function handleEntityNotFound(_0xc07791,_0x289de7){return function(_0x16b3e8){if(!_0x16b3e8){_0xc07791['sendStatus'](0x194);}return _0x16b3e8;};}function handleError(_0x5ee4a6,_0x1cdd39){_0x1cdd39=_0x1cdd39||0x1f4;return function(_0x17aa7f){logger[_0xffaa('0x23')](_0x17aa7f['stack']);if(_0x17aa7f[_0xffaa('0x24')]){delete _0x17aa7f[_0xffaa('0x24')];}_0x5ee4a6['status'](_0x1cdd39)['send'](_0x17aa7f);};}exports['index']=function(_0x268aa6,_0x1b6637){var _0x8ae849={},_0x415f44={},_0x5f54bf={'count':0x0,'rows':[]};var _0x486765=_[_0xffaa('0x25')](db['MailSubstatus']['rawAttributes'],function(_0x345469){return{'name':_0x345469[_0xffaa('0x26')],'type':_0x345469[_0xffaa('0x27')][_0xffaa('0x28')]};});_0x415f44[_0xffaa('0x29')]=_['map'](_0x486765,_0xffaa('0x24'));_0x415f44[_0xffaa('0x2a')]=_['keys'](_0x268aa6['query']);_0x415f44[_0xffaa('0x2b')]=_[_0xffaa('0x2c')](_0x415f44[_0xffaa('0x29')],_0x415f44['query']);_0x8ae849[_0xffaa('0x2d')]=_[_0xffaa('0x2c')](_0x415f44[_0xffaa('0x29')],qs[_0xffaa('0x2e')](_0x268aa6['query'][_0xffaa('0x2e')]));_0x8ae849[_0xffaa('0x2d')]=_0x8ae849[_0xffaa('0x2d')]['length']?_0x8ae849['attributes']:_0x415f44[_0xffaa('0x29')];if(!_0x268aa6[_0xffaa('0x2a')]['hasOwnProperty'](_0xffaa('0x2f'))){_0x8ae849[_0xffaa('0x19')]=qs['limit'](_0x268aa6[_0xffaa('0x2a')][_0xffaa('0x19')]);_0x8ae849['offset']=qs[_0xffaa('0x1a')](_0x268aa6[_0xffaa('0x2a')][_0xffaa('0x1a')]);}_0x8ae849[_0xffaa('0x30')]=qs[_0xffaa('0x31')](_0x268aa6[_0xffaa('0x2a')][_0xffaa('0x31')]);_0x8ae849[_0xffaa('0x32')]=qs[_0xffaa('0x2b')](_[_0xffaa('0x33')](_0x268aa6['query'],_0x415f44[_0xffaa('0x2b')]),_0x486765);if(_0x268aa6[_0xffaa('0x2a')][_0xffaa('0x34')]){_0x8ae849[_0xffaa('0x32')]=_[_0xffaa('0x35')](_0x8ae849['where'],{'$or':_[_0xffaa('0x25')](_0x486765,function(_0x1bbcfb){if(_0x1bbcfb[_0xffaa('0x27')]!==_0xffaa('0x36')){var _0x120508={};_0x120508[_0x1bbcfb[_0xffaa('0x24')]]={'$like':'%'+_0x268aa6[_0xffaa('0x2a')][_0xffaa('0x34')]+'%'};return _0x120508;}})});}_0x8ae849=_[_0xffaa('0x35')]({},_0x8ae849,_0x268aa6[_0xffaa('0x37')]);var _0x2956ac={'where':_0x8ae849['where']};return db[_0xffaa('0x38')][_0xffaa('0x1b')](_0x2956ac)[_0xffaa('0x21')](function(_0x36e4a4){_0x5f54bf[_0xffaa('0x1b')]=_0x36e4a4;if(_0x268aa6[_0xffaa('0x2a')]['includeAll']){_0x8ae849[_0xffaa('0x39')]=[{'all':!![]}];}return db[_0xffaa('0x38')][_0xffaa('0x3a')](_0x8ae849);})[_0xffaa('0x21')](function(_0x92ff44){_0x5f54bf[_0xffaa('0x3b')]=_0x92ff44;return _0x5f54bf;})['then'](respondWithFilteredResult(_0x1b6637,_0x8ae849))[_0xffaa('0x3c')](handleError(_0x1b6637,null));};exports[_0xffaa('0x3d')]=function(_0x458cd3,_0x4192b3){var _0x4ccb4e={'raw':!![],'where':{'id':_0x458cd3[_0xffaa('0x3e')]['id']}},_0x3534f1={};_0x3534f1[_0xffaa('0x29')]=_['keys'](db[_0xffaa('0x38')][_0xffaa('0x3f')]);_0x3534f1[_0xffaa('0x2a')]=_[_0xffaa('0x40')](_0x458cd3['query']);_0x3534f1[_0xffaa('0x2b')]=_[_0xffaa('0x2c')](_0x3534f1[_0xffaa('0x29')],_0x3534f1[_0xffaa('0x2a')]);_0x4ccb4e[_0xffaa('0x2d')]=_['intersection'](_0x3534f1[_0xffaa('0x29')],qs[_0xffaa('0x2e')](_0x458cd3[_0xffaa('0x2a')][_0xffaa('0x2e')]));_0x4ccb4e[_0xffaa('0x2d')]=_0x4ccb4e[_0xffaa('0x2d')]['length']?_0x4ccb4e['attributes']:_0x3534f1[_0xffaa('0x29')];if(_0x458cd3['query'][_0xffaa('0x41')]){_0x4ccb4e['include']=[{'all':!![]}];}_0x4ccb4e=_[_0xffaa('0x35')]({},_0x4ccb4e,_0x458cd3[_0xffaa('0x37')]);return db[_0xffaa('0x38')]['find'](_0x4ccb4e)[_0xffaa('0x21')](handleEntityNotFound(_0x4192b3,null))[_0xffaa('0x21')](respondWithResult(_0x4192b3,null))[_0xffaa('0x3c')](handleError(_0x4192b3,null));};exports[_0xffaa('0x42')]=function(_0x587276,_0x48fc6e){return db['MailSubstatus'][_0xffaa('0x42')](_0x587276[_0xffaa('0x43')],{})[_0xffaa('0x21')](respondWithResult(_0x48fc6e,0xc9))[_0xffaa('0x3c')](handleError(_0x48fc6e,null));};exports[_0xffaa('0x20')]=function(_0xa2c4ae,_0x4a6b4a){if(_0xa2c4ae[_0xffaa('0x43')]['id']){delete _0xa2c4ae[_0xffaa('0x43')]['id'];}return db[_0xffaa('0x38')][_0xffaa('0x44')]({'where':{'id':_0xa2c4ae[_0xffaa('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4a6b4a,null))[_0xffaa('0x21')](saveUpdates(_0xa2c4ae['body'],null))[_0xffaa('0x21')](respondWithResult(_0x4a6b4a,null))[_0xffaa('0x3c')](handleError(_0x4a6b4a,null));};exports[_0xffaa('0x22')]=function(_0x33fbad,_0x4d0769){return db[_0xffaa('0x38')]['find']({'where':{'id':_0x33fbad[_0xffaa('0x3e')]['id']}})[_0xffaa('0x21')](handleEntityNotFound(_0x4d0769,null))[_0xffaa('0x21')](removeEntity(_0x4d0769,null))[_0xffaa('0x3c')](handleError(_0x4d0769,null));};exports[_0xffaa('0x45')]=function(_0x3e2f52,_0x482ca8){return db[_0xffaa('0x38')][_0xffaa('0x45')]()[_0xffaa('0x21')](respondWithResult(_0x482ca8,null))['catch'](handleError(_0x482ca8,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index cba021c..ad0e6fe 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd87c=['emit','hasOwnProperty','hook','exports','events','MailSubstatus','setMaxListeners','update'];(function(_0x4017cf,_0x180d24){var _0x226512=function(_0x3e7a3e){while(--_0x3e7a3e){_0x4017cf['push'](_0x4017cf['shift']());}};_0x226512(++_0x180d24);}(_0xd87c,0x74));var _0xcd87=function(_0xf3f4aa,_0x1cac46){_0xf3f4aa=_0xf3f4aa-0x0;var _0x305ac9=_0xd87c[_0xf3f4aa];return _0x305ac9;};'use strict';var EventEmitter=require(_0xcd87('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0xcd87('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xcd87('0x2')](0x0);var events={'afterUpdate':_0xcd87('0x3')};function emitEvent(_0x391a0d){return function(_0x4b6ead,_0x1f7f4c,_0x42492b){MailSubstatusEvents['emit'](_0x391a0d+':'+_0x4b6ead['id'],_0x4b6ead);MailSubstatusEvents[_0xcd87('0x4')](_0x391a0d,_0x4b6ead);_0x42492b(null);};}for(var e in events){if(events[_0xcd87('0x5')](e)){var event=events[e];MailSubstatus[_0xcd87('0x6')](e,emitEvent(event));}}module[_0xcd87('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0x6cd5=['exports','events','MailSubstatus','setMaxListeners','emit','hasOwnProperty','hook'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x6cd5,0xfd));var _0x56cd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6cd5[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x56cd('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x56cd('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x56cd('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x5cfe9d){return function(_0xcb3338,_0x77cd91,_0x440f1a){MailSubstatusEvents[_0x56cd('0x3')](_0x5cfe9d+':'+_0xcb3338['id'],_0xcb3338);MailSubstatusEvents['emit'](_0x5cfe9d,_0xcb3338);_0x440f1a(null);};}for(var e in events){if(events[_0x56cd('0x4')](e)){var event=events[e];MailSubstatus[_0x56cd('0x5')](e,emitEvent(event));}}module[_0x56cd('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 5d6769c..7f51f78 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 _0x31bb=['mailSubstatus','then','catch','exports','models','mail_substatuses','Condition','name'];(function(_0x8d548b,_0x597247){var _0x148333=function(_0x33123){while(--_0x33123){_0x8d548b['push'](_0x8d548b['shift']());}};_0x148333(++_0x597247);}(_0x31bb,0xab));var _0xb31b=function(_0x4e7991,_0x4e4e44){_0x4e7991=_0x4e7991-0x0;var _0xf440f7=_0x31bb[_0x4e7991];return _0xf440f7;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0xb31b('0x0')]=function(_0x3af0e2){var _0xe49c1b=_0x3af0e2[_0xb31b('0x1')];return _0x3af0e2['define']('MailSubstatus',attributes,{'tableName':_0xb31b('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x48df44,_0x4b2b44,_0x592840){return _0xe49c1b[_0xb31b('0x3')]['update']({'value':_0x48df44[_0xb31b('0x4')]},{'where':{'field':_0xb31b('0x5'),'value':_0x48df44['_previousDataValues']['name']}})[_0xb31b('0x6')](function(){_0x592840();})[_0xb31b('0x7')](function(_0x3b7f19){_0x592840(_0x3b7f19);});}}});}; \ No newline at end of file +var _0x5f23=['mailSubstatus','name','then','catch','./mailSubstatus.attributes','exports','define','mail_substatuses','Condition','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f23,0x7c));var _0x35f2=function(_0x355da5,_0x210f7a){_0x355da5=_0x355da5-0x0;var _0x4cd60d=_0x5f23[_0x355da5];return _0x4cd60d;};'use strict';var attributes=require(_0x35f2('0x0'));module[_0x35f2('0x1')]=function(_0x2cd0f3){var _0xb8aaf=_0x2cd0f3['models'];return _0x2cd0f3[_0x35f2('0x2')]('MailSubstatus',attributes,{'tableName':_0x35f2('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x19e704,_0x404767,_0x2cc58a){return _0xb8aaf[_0x35f2('0x4')][_0x35f2('0x5')]({'value':_0x19e704['name']},{'where':{'field':_0x35f2('0x6'),'value':_0x19e704['_previousDataValues'][_0x35f2('0x7')]}})[_0x35f2('0x8')](function(){_0x2cc58a();})[_0x35f2('0x9')](function(_0xb2b4dc){_0x2cc58a(_0xb2b4dc);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 1eda6df..c80b0db 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 _0x8b30=['../../config/environment','jayson/promise','client','http','info','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1f535b,_0xc42523){var _0x5bb329=function(_0xcaa78d){while(--_0xcaa78d){_0x1f535b['push'](_0x1f535b['shift']());}};_0x5bb329(++_0xc42523);}(_0x8b30,0x1dc));var _0x08b3=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x8b30[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require('lodash');var util=require(_0x08b3('0x0'));var moment=require(_0x08b3('0x1'));var BPromise=require(_0x08b3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x08b3('0x3'));var db=require(_0x08b3('0x4'))['db'];var utils=require(_0x08b3('0x5'));var logger=require('../../config/logger')(_0x08b3('0x6'));var config=require(_0x08b3('0x7'));var jayson=require(_0x08b3('0x8'));var client=jayson[_0x08b3('0x9')][_0x08b3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36272a,_0x969245,_0x39caf1){return new BPromise(function(_0x3f4758,_0x49d95d){return client['request'](_0x36272a,_0x39caf1)['then'](function(_0x21703b){logger[_0x08b3('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x969245,'request\x20sent');logger[_0x08b3('0xc')](_0x08b3('0xd'),_0x969245,_0x08b3('0xe'),JSON[_0x08b3('0xf')](_0x21703b));if(_0x21703b[_0x08b3('0x10')]){if(_0x21703b[_0x08b3('0x10')][_0x08b3('0x11')]===0x1f4){logger['error'](_0x08b3('0x12'),_0x969245,_0x21703b['error'][_0x08b3('0x13')]);return _0x49d95d(_0x21703b[_0x08b3('0x10')]['message']);}logger[_0x08b3('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x969245,_0x21703b[_0x08b3('0x10')][_0x08b3('0x13')]);return _0x3f4758(_0x21703b['error']['message']);}else{logger[_0x08b3('0xb')](_0x08b3('0x12'),_0x969245,_0x08b3('0xe'));_0x3f4758(_0x21703b['result'][_0x08b3('0x13')]);}})[_0x08b3('0x14')](function(_0x244266){logger[_0x08b3('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x969245,_0x244266);_0x49d95d(_0x244266);});});} \ No newline at end of file +var _0xdb4d=['then','info','MailSubstatus,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x44e08d,_0x8cb7bc){var _0x1763b6=function(_0x3622b3){while(--_0x3622b3){_0x44e08d['push'](_0x44e08d['shift']());}};_0x1763b6(++_0x8cb7bc);}(_0xdb4d,0x1d7));var _0xddb4=function(_0x5b5db7,_0x19263d){_0x5b5db7=_0x5b5db7-0x0;var _0x1f4f6c=_0xdb4d[_0x5b5db7];return _0x1f4f6c;};'use strict';var _=require(_0xddb4('0x0'));var util=require(_0xddb4('0x1'));var moment=require(_0xddb4('0x2'));var BPromise=require(_0xddb4('0x3'));var rs=require(_0xddb4('0x4'));var fs=require('fs');var Redis=require(_0xddb4('0x5'));var db=require(_0xddb4('0x6'))['db'];var utils=require(_0xddb4('0x7'));var logger=require(_0xddb4('0x8'))('rpc');var config=require(_0xddb4('0x9'));var jayson=require(_0xddb4('0xa'));var client=jayson[_0xddb4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xef8f1c,_0x526e79,_0xfdc205){return new BPromise(function(_0x4a08a7,_0x1a94bd){return client[_0xddb4('0xc')](_0xef8f1c,_0xfdc205)[_0xddb4('0xd')](function(_0x334656){logger[_0xddb4('0xe')](_0xddb4('0xf'),_0x526e79,'request\x20sent');logger[_0xddb4('0x10')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x526e79,_0xddb4('0x11'),JSON['stringify'](_0x334656));if(_0x334656['error']){if(_0x334656[_0xddb4('0x12')]['code']===0x1f4){logger[_0xddb4('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x526e79,_0x334656[_0xddb4('0x12')][_0xddb4('0x13')]);return _0x1a94bd(_0x334656[_0xddb4('0x12')][_0xddb4('0x13')]);}logger[_0xddb4('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x526e79,_0x334656[_0xddb4('0x12')][_0xddb4('0x13')]);return _0x4a08a7(_0x334656[_0xddb4('0x12')][_0xddb4('0x13')]);}else{logger[_0xddb4('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x526e79,_0xddb4('0x11'));_0x4a08a7(_0x334656[_0xddb4('0x14')][_0xddb4('0x13')]);}})[_0xddb4('0x15')](function(_0x255025){logger[_0xddb4('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x526e79,_0x255025);_0x1a94bd(_0x255025);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index aa58bc7..adecca5 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 _0x7a1b=['create','put','update','delete','/:id','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','describe','show','post'];(function(_0x52a3b8,_0x274c67){var _0x423fab=function(_0x2c73d9){while(--_0x2c73d9){_0x52a3b8['push'](_0x52a3b8['shift']());}};_0x423fab(++_0x274c67);}(_0x7a1b,0x157));var _0xb7a1=function(_0x4588d9,_0x1de073){_0x4588d9=_0x4588d9-0x0;var _0x52fe7d=_0x7a1b[_0x4588d9];return _0x52fe7d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb7a1('0x0'));var timeout=require(_0xb7a1('0x1'));var express=require('express');var router=express[_0xb7a1('0x2')]();var fs_extra=require(_0xb7a1('0x3'));var auth=require(_0xb7a1('0x4'));var interaction=require(_0xb7a1('0x5'));var config=require(_0xb7a1('0x6'));var controller=require(_0xb7a1('0x7'));router[_0xb7a1('0x8')]('/',auth[_0xb7a1('0x9')](),controller[_0xb7a1('0xa')]);router[_0xb7a1('0x8')]('/describe',auth[_0xb7a1('0x9')](),controller[_0xb7a1('0xb')]);router[_0xb7a1('0x8')]('/:id',auth[_0xb7a1('0x9')](),controller[_0xb7a1('0xc')]);router[_0xb7a1('0xd')]('/',auth[_0xb7a1('0x9')](),controller[_0xb7a1('0xe')]);router[_0xb7a1('0xf')]('/:id',auth[_0xb7a1('0x9')](),controller[_0xb7a1('0x10')]);router[_0xb7a1('0x11')](_0xb7a1('0x12'),auth[_0xb7a1('0x9')](),controller[_0xb7a1('0x13')]);module[_0xb7a1('0x14')]=router; \ No newline at end of file +var _0x94ab=['/:id','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','show','post','create'];(function(_0x3279bb,_0x4cbaee){var _0x29a01b=function(_0x251303){while(--_0x251303){_0x3279bb['push'](_0x3279bb['shift']());}};_0x29a01b(++_0x4cbaee);}(_0x94ab,0x9b));var _0xb94a=function(_0x41e19f,_0x1c6491){_0x41e19f=_0x41e19f-0x0;var _0x2acfa2=_0x94ab[_0x41e19f];return _0x2acfa2;};'use strict';var multer=require('multer');var util=require(_0xb94a('0x0'));var path=require(_0xb94a('0x1'));var timeout=require(_0xb94a('0x2'));var express=require(_0xb94a('0x3'));var router=express[_0xb94a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb94a('0x5'));var interaction=require(_0xb94a('0x6'));var config=require(_0xb94a('0x7'));var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0xb94a('0x8')](),controller[_0xb94a('0x9')]);router['get'](_0xb94a('0xa'),auth[_0xb94a('0x8')](),controller[_0xb94a('0xb')]);router[_0xb94a('0xc')]('/:id',auth[_0xb94a('0x8')](),controller[_0xb94a('0xd')]);router[_0xb94a('0xe')]('/',auth[_0xb94a('0x8')](),controller[_0xb94a('0xf')]);router['put'](_0xb94a('0x10'),auth[_0xb94a('0x8')](),controller['update']);router[_0xb94a('0x11')](_0xb94a('0x10'),auth[_0xb94a('0x8')](),controller[_0xb94a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index ec595dc..6aeff9b 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x279bf6,_0x8f7c07){var _0x57b9c4=function(_0x58b270){while(--_0x58b270){_0x279bf6['push'](_0x279bf6['shift']());}};_0x57b9c4(++_0x8f7c07);}(_0xaa88,0x137));var _0x8aa8=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0xaa88[_0x120376];return _0x28c529;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x57314d,_0x3d168e){var _0x5cd6e4=function(_0x251f46){while(--_0x251f46){_0x57314d['push'](_0x57314d['shift']());}};_0x5cd6e4(++_0x3d168e);}(_0x00bb,0x1d8));var _0xb00b=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x00bb[_0x311c35];return _0x5cc50c;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 0f655b4..9ab660e 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 _0x14f7=['reject','save','update','destroy','then','error','stack','send','map','fieldName','type','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','MailTransferReport','rows','catch','show','rawAttributes','includeAll','find','create','params','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','Content-Range'];(function(_0x383523,_0x262138){var _0x29c502=function(_0x3e64cd){while(--_0x3e64cd){_0x383523['push'](_0x383523['shift']());}};_0x29c502(++_0x262138);}(_0x14f7,0x71));var _0x714f=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x14f7[_0x30ae5e];return _0x1f2e93;};'use strict';var emlformat=require(_0x714f('0x0'));var rimraf=require(_0x714f('0x1'));var zipdir=require(_0x714f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x714f('0x3'));var moment=require(_0x714f('0x4'));var BPromise=require(_0x714f('0x5'));var Mustache=require(_0x714f('0x6'));var util=require(_0x714f('0x7'));var path=require('path');var sox=require(_0x714f('0x8'));var csv=require(_0x714f('0x9'));var ejs=require(_0x714f('0xa'));var fs=require('fs');var fs_extra=require(_0x714f('0xb'));var _=require('lodash');var squel=require(_0x714f('0xc'));var crypto=require(_0x714f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x714f('0xe'));var toCsv=require(_0x714f('0x9'));var querystring=require(_0x714f('0xf'));var Papa=require(_0x714f('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x714f('0x11'));var as=require(_0x714f('0x12'));var hardwareService=require(_0x714f('0x13'));var logger=require(_0x714f('0x14'))(_0x714f('0x15'));var utils=require('../../config/utils');var config=require(_0x714f('0x16'));var licenseUtil=require(_0x714f('0x17'));var db=require(_0x714f('0x18'))['db'];function respondWithStatusCode(_0x246c16,_0x36dcb3){_0x36dcb3=_0x36dcb3||0xcc;return function(_0x4c4573){if(_0x4c4573){return _0x246c16[_0x714f('0x19')](_0x36dcb3);}return _0x246c16['status'](_0x36dcb3)[_0x714f('0x1a')]();};}function respondWithResult(_0x149eab,_0x38fd7f){_0x38fd7f=_0x38fd7f||0xc8;return function(_0x304fe4){if(_0x304fe4){return _0x149eab[_0x714f('0x1b')](_0x38fd7f)[_0x714f('0x1c')](_0x304fe4);}};}function respondWithFilteredResult(_0x4bdd13,_0x3ebbc6){return function(_0x4ee275){if(_0x4ee275){var _0x15253e=typeof _0x3ebbc6[_0x714f('0x1d')]==='undefined'&&typeof _0x3ebbc6[_0x714f('0x1e')]==='undefined';var _0x5e37aa=_0x4ee275[_0x714f('0x1f')];var _0x394259=_0x15253e?0x0:_0x3ebbc6[_0x714f('0x1d')];var _0x15f83b=_0x15253e?_0x4ee275['count']:_0x3ebbc6[_0x714f('0x1d')]+_0x3ebbc6[_0x714f('0x1e')];var _0x46ae85;if(_0x15f83b>=_0x5e37aa){_0x15f83b=_0x5e37aa;_0x46ae85=0xc8;}else{_0x46ae85=0xce;}_0x4bdd13['status'](_0x46ae85);return _0x4bdd13['set'](_0x714f('0x20'),_0x394259+'-'+_0x15f83b+'/'+_0x5e37aa)[_0x714f('0x1c')](_0x4ee275);}return null;};}function patchUpdates(_0xbe1a90){return function(_0x18ac93){try{jsonpatch['apply'](_0x18ac93,_0xbe1a90,!![]);}catch(_0x169229){return BPromise[_0x714f('0x21')](_0x169229);}return _0x18ac93[_0x714f('0x22')]();};}function saveUpdates(_0x2824de,_0x4f6fb4){return function(_0x572d02){if(_0x572d02){return _0x572d02[_0x714f('0x23')](_0x2824de)['then'](function(_0x517eae){return _0x517eae;});}return null;};}function removeEntity(_0x12280d,_0x282155){return function(_0x155e46){if(_0x155e46){return _0x155e46[_0x714f('0x24')]()[_0x714f('0x25')](function(){_0x12280d[_0x714f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x357362,_0x1db5f1){return function(_0x50b4c0){if(!_0x50b4c0){_0x357362[_0x714f('0x19')](0x194);}return _0x50b4c0;};}function handleError(_0x4c0338,_0x20f68e){_0x20f68e=_0x20f68e||0x1f4;return function(_0xc4120a){logger[_0x714f('0x26')](_0xc4120a[_0x714f('0x27')]);if(_0xc4120a['name']){delete _0xc4120a['name'];}_0x4c0338[_0x714f('0x1b')](_0x20f68e)[_0x714f('0x28')](_0xc4120a);};}exports['index']=function(_0x47effb,_0x22a598){var _0x4bbcbd={},_0x3a05e3={},_0x2ff9ba={'count':0x0,'rows':[]};var _0x1e4034=_[_0x714f('0x29')](db['MailTransferReport']['rawAttributes'],function(_0x390e3f){return{'name':_0x390e3f[_0x714f('0x2a')],'type':_0x390e3f[_0x714f('0x2b')]['key']};});_0x3a05e3[_0x714f('0x2c')]=_[_0x714f('0x29')](_0x1e4034,_0x714f('0x2d'));_0x3a05e3[_0x714f('0x2e')]=_[_0x714f('0x2f')](_0x47effb[_0x714f('0x2e')]);_0x3a05e3[_0x714f('0x30')]=_[_0x714f('0x31')](_0x3a05e3[_0x714f('0x2c')],_0x3a05e3['query']);_0x4bbcbd['attributes']=_[_0x714f('0x31')](_0x3a05e3[_0x714f('0x2c')],qs[_0x714f('0x32')](_0x47effb[_0x714f('0x2e')]['fields']));_0x4bbcbd['attributes']=_0x4bbcbd[_0x714f('0x33')][_0x714f('0x34')]?_0x4bbcbd['attributes']:_0x3a05e3[_0x714f('0x2c')];if(!_0x47effb[_0x714f('0x2e')][_0x714f('0x35')](_0x714f('0x36'))){_0x4bbcbd[_0x714f('0x1e')]=qs[_0x714f('0x1e')](_0x47effb['query']['limit']);_0x4bbcbd[_0x714f('0x1d')]=qs[_0x714f('0x1d')](_0x47effb['query'][_0x714f('0x1d')]);}_0x4bbcbd['order']=qs['sort'](_0x47effb[_0x714f('0x2e')][_0x714f('0x37')]);_0x4bbcbd[_0x714f('0x38')]=qs[_0x714f('0x30')](_['pick'](_0x47effb[_0x714f('0x2e')],_0x3a05e3[_0x714f('0x30')]),_0x1e4034);if(_0x47effb[_0x714f('0x2e')][_0x714f('0x39')]){_0x4bbcbd[_0x714f('0x38')]=_[_0x714f('0x3a')](_0x4bbcbd[_0x714f('0x38')],{'$or':_[_0x714f('0x29')](_0x1e4034,function(_0x409d79){if(_0x409d79['type']!==_0x714f('0x3b')){var _0x2063ec={};_0x2063ec[_0x409d79[_0x714f('0x2d')]]={'$like':'%'+_0x47effb[_0x714f('0x2e')]['filter']+'%'};return _0x2063ec;}})});}_0x4bbcbd=_[_0x714f('0x3a')]({},_0x4bbcbd,_0x47effb[_0x714f('0x3c')]);var _0x21f0ed={'where':_0x4bbcbd[_0x714f('0x38')]};return db['MailTransferReport'][_0x714f('0x1f')](_0x21f0ed)[_0x714f('0x25')](function(_0x25fd67){_0x2ff9ba[_0x714f('0x1f')]=_0x25fd67;if(_0x47effb[_0x714f('0x2e')]['includeAll']){_0x4bbcbd[_0x714f('0x3d')]=[{'all':!![]}];}return db[_0x714f('0x3e')]['findAll'](_0x4bbcbd);})[_0x714f('0x25')](function(_0x2ee53a){_0x2ff9ba[_0x714f('0x3f')]=_0x2ee53a;return _0x2ff9ba;})[_0x714f('0x25')](respondWithFilteredResult(_0x22a598,_0x4bbcbd))[_0x714f('0x40')](handleError(_0x22a598,null));};exports[_0x714f('0x41')]=function(_0x2ff13a,_0x32c27e){var _0x45b4e0={'raw':!![],'where':{'id':_0x2ff13a['params']['id']}},_0x146614={};_0x146614[_0x714f('0x2c')]=_['keys'](db[_0x714f('0x3e')][_0x714f('0x42')]);_0x146614['query']=_[_0x714f('0x2f')](_0x2ff13a[_0x714f('0x2e')]);_0x146614[_0x714f('0x30')]=_['intersection'](_0x146614[_0x714f('0x2c')],_0x146614[_0x714f('0x2e')]);_0x45b4e0['attributes']=_[_0x714f('0x31')](_0x146614[_0x714f('0x2c')],qs[_0x714f('0x32')](_0x2ff13a[_0x714f('0x2e')][_0x714f('0x32')]));_0x45b4e0[_0x714f('0x33')]=_0x45b4e0[_0x714f('0x33')]['length']?_0x45b4e0[_0x714f('0x33')]:_0x146614['model'];if(_0x2ff13a[_0x714f('0x2e')][_0x714f('0x43')]){_0x45b4e0[_0x714f('0x3d')]=[{'all':!![]}];}_0x45b4e0=_[_0x714f('0x3a')]({},_0x45b4e0,_0x2ff13a[_0x714f('0x3c')]);return db[_0x714f('0x3e')][_0x714f('0x44')](_0x45b4e0)[_0x714f('0x25')](handleEntityNotFound(_0x32c27e,null))['then'](respondWithResult(_0x32c27e,null))[_0x714f('0x40')](handleError(_0x32c27e,null));};exports[_0x714f('0x45')]=function(_0x4c7b87,_0x5d9548){return db['MailTransferReport'][_0x714f('0x45')](_0x4c7b87['body'],{})[_0x714f('0x25')](respondWithResult(_0x5d9548,0xc9))[_0x714f('0x40')](handleError(_0x5d9548,null));};exports[_0x714f('0x23')]=function(_0x3190f3,_0x430628){if(_0x3190f3['body']['id']){delete _0x3190f3['body']['id'];}return db[_0x714f('0x3e')]['find']({'where':{'id':_0x3190f3[_0x714f('0x46')]['id']}})['then'](handleEntityNotFound(_0x430628,null))[_0x714f('0x25')](saveUpdates(_0x3190f3[_0x714f('0x47')],null))[_0x714f('0x25')](respondWithResult(_0x430628,null))[_0x714f('0x40')](handleError(_0x430628,null));};exports[_0x714f('0x24')]=function(_0x1ca3a4,_0x5dd3fb){return db[_0x714f('0x3e')][_0x714f('0x44')]({'where':{'id':_0x1ca3a4['params']['id']}})[_0x714f('0x25')](handleEntityNotFound(_0x5dd3fb,null))['then'](removeEntity(_0x5dd3fb,null))[_0x714f('0x40')](handleError(_0x5dd3fb,null));};exports[_0x714f('0x48')]=function(_0x209cfd,_0x182556){return db[_0x714f('0x3e')][_0x714f('0x48')]()['then'](respondWithResult(_0x182556,null))['catch'](handleError(_0x182556,null));}; \ No newline at end of file +var _0x952f=['name','send','index','type','key','model','map','query','keys','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','MailTransferReport','rawAttributes','intersection','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy'];(function(_0x349edb,_0x2fc4b1){var _0x517f7e=function(_0x57397f){while(--_0x57397f){_0x349edb['push'](_0x349edb['shift']());}};_0x517f7e(++_0x2fc4b1);}(_0x952f,0x1d5));var _0xf952=function(_0x911353,_0x1648ed){_0x911353=_0x911353-0x0;var _0x2f05fa=_0x952f[_0x911353];return _0x2f05fa;};'use strict';var emlformat=require(_0xf952('0x0'));var rimraf=require(_0xf952('0x1'));var zipdir=require(_0xf952('0x2'));var jsonpatch=require(_0xf952('0x3'));var rp=require(_0xf952('0x4'));var moment=require(_0xf952('0x5'));var BPromise=require(_0xf952('0x6'));var Mustache=require(_0xf952('0x7'));var util=require('util');var path=require(_0xf952('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf952('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf952('0xa'));var crypto=require(_0xf952('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf952('0xc'));var Papa=require(_0xf952('0xd'));var Redis=require('ioredis');var authService=require(_0xf952('0xe'));var qs=require(_0xf952('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf952('0x10'));var logger=require('../../config/logger')(_0xf952('0x11'));var utils=require(_0xf952('0x12'));var config=require(_0xf952('0x13'));var licenseUtil=require(_0xf952('0x14'));var db=require(_0xf952('0x15'))['db'];function respondWithStatusCode(_0x13b7e4,_0x1ae068){_0x1ae068=_0x1ae068||0xcc;return function(_0x534182){if(_0x534182){return _0x13b7e4[_0xf952('0x16')](_0x1ae068);}return _0x13b7e4[_0xf952('0x17')](_0x1ae068)['end']();};}function respondWithResult(_0x547f86,_0x2cf1a5){_0x2cf1a5=_0x2cf1a5||0xc8;return function(_0x507a8e){if(_0x507a8e){return _0x547f86['status'](_0x2cf1a5)[_0xf952('0x18')](_0x507a8e);}};}function respondWithFilteredResult(_0xc56462,_0x1988f8){return function(_0x527b52){if(_0x527b52){var _0x1aa9c7=typeof _0x1988f8['offset']===_0xf952('0x19')&&typeof _0x1988f8[_0xf952('0x1a')]===_0xf952('0x19');var _0x5544db=_0x527b52[_0xf952('0x1b')];var _0x32ddae=_0x1aa9c7?0x0:_0x1988f8['offset'];var _0x384388=_0x1aa9c7?_0x527b52[_0xf952('0x1b')]:_0x1988f8[_0xf952('0x1c')]+_0x1988f8[_0xf952('0x1a')];var _0x2bced4;if(_0x384388>=_0x5544db){_0x384388=_0x5544db;_0x2bced4=0xc8;}else{_0x2bced4=0xce;}_0xc56462[_0xf952('0x17')](_0x2bced4);return _0xc56462[_0xf952('0x1d')](_0xf952('0x1e'),_0x32ddae+'-'+_0x384388+'/'+_0x5544db)[_0xf952('0x18')](_0x527b52);}return null;};}function patchUpdates(_0x125805){return function(_0x560c6b){try{jsonpatch[_0xf952('0x1f')](_0x560c6b,_0x125805,!![]);}catch(_0x9db693){return BPromise['reject'](_0x9db693);}return _0x560c6b[_0xf952('0x20')]();};}function saveUpdates(_0x5dcb5d,_0x34a0e4){return function(_0x476dc1){if(_0x476dc1){return _0x476dc1['update'](_0x5dcb5d)[_0xf952('0x21')](function(_0x55ab55){return _0x55ab55;});}return null;};}function removeEntity(_0x223d4e,_0x48a437){return function(_0x398a29){if(_0x398a29){return _0x398a29[_0xf952('0x22')]()['then'](function(){_0x223d4e[_0xf952('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b188a,_0x3d662b){return function(_0x1c608d){if(!_0x1c608d){_0x3b188a[_0xf952('0x16')](0x194);}return _0x1c608d;};}function handleError(_0x3c7f0e,_0x2c0b32){_0x2c0b32=_0x2c0b32||0x1f4;return function(_0x19d92a){logger['error'](_0x19d92a['stack']);if(_0x19d92a[_0xf952('0x23')]){delete _0x19d92a[_0xf952('0x23')];}_0x3c7f0e[_0xf952('0x17')](_0x2c0b32)[_0xf952('0x24')](_0x19d92a);};}exports[_0xf952('0x25')]=function(_0x1d2b09,_0x16c028){var _0x45e64f={},_0x27a26c={},_0x1b1854={'count':0x0,'rows':[]};var _0x2e8c14=_['map'](db['MailTransferReport']['rawAttributes'],function(_0x50b8b6){return{'name':_0x50b8b6['fieldName'],'type':_0x50b8b6[_0xf952('0x26')][_0xf952('0x27')]};});_0x27a26c[_0xf952('0x28')]=_[_0xf952('0x29')](_0x2e8c14,_0xf952('0x23'));_0x27a26c[_0xf952('0x2a')]=_[_0xf952('0x2b')](_0x1d2b09[_0xf952('0x2a')]);_0x27a26c['filters']=_['intersection'](_0x27a26c[_0xf952('0x28')],_0x27a26c[_0xf952('0x2a')]);_0x45e64f[_0xf952('0x2c')]=_['intersection'](_0x27a26c[_0xf952('0x28')],qs[_0xf952('0x2d')](_0x1d2b09[_0xf952('0x2a')]['fields']));_0x45e64f[_0xf952('0x2c')]=_0x45e64f[_0xf952('0x2c')]['length']?_0x45e64f[_0xf952('0x2c')]:_0x27a26c['model'];if(!_0x1d2b09[_0xf952('0x2a')][_0xf952('0x2e')](_0xf952('0x2f'))){_0x45e64f['limit']=qs[_0xf952('0x1a')](_0x1d2b09[_0xf952('0x2a')]['limit']);_0x45e64f[_0xf952('0x1c')]=qs[_0xf952('0x1c')](_0x1d2b09['query']['offset']);}_0x45e64f[_0xf952('0x30')]=qs[_0xf952('0x31')](_0x1d2b09[_0xf952('0x2a')]['sort']);_0x45e64f[_0xf952('0x32')]=qs[_0xf952('0x33')](_[_0xf952('0x34')](_0x1d2b09[_0xf952('0x2a')],_0x27a26c[_0xf952('0x33')]),_0x2e8c14);if(_0x1d2b09[_0xf952('0x2a')][_0xf952('0x35')]){_0x45e64f[_0xf952('0x32')]=_[_0xf952('0x36')](_0x45e64f[_0xf952('0x32')],{'$or':_[_0xf952('0x29')](_0x2e8c14,function(_0x3cf222){if(_0x3cf222['type']!==_0xf952('0x37')){var _0x2650fc={};_0x2650fc[_0x3cf222['name']]={'$like':'%'+_0x1d2b09[_0xf952('0x2a')][_0xf952('0x35')]+'%'};return _0x2650fc;}})});}_0x45e64f=_[_0xf952('0x36')]({},_0x45e64f,_0x1d2b09[_0xf952('0x38')]);var _0x528319={'where':_0x45e64f[_0xf952('0x32')]};return db['MailTransferReport']['count'](_0x528319)[_0xf952('0x21')](function(_0x2af800){_0x1b1854[_0xf952('0x1b')]=_0x2af800;if(_0x1d2b09[_0xf952('0x2a')][_0xf952('0x39')]){_0x45e64f[_0xf952('0x3a')]=[{'all':!![]}];}return db['MailTransferReport'][_0xf952('0x3b')](_0x45e64f);})[_0xf952('0x21')](function(_0x19f927){_0x1b1854[_0xf952('0x3c')]=_0x19f927;return _0x1b1854;})['then'](respondWithFilteredResult(_0x16c028,_0x45e64f))[_0xf952('0x3d')](handleError(_0x16c028,null));};exports[_0xf952('0x3e')]=function(_0x59c401,_0x34ac4a){var _0xf146bf={'raw':!![],'where':{'id':_0x59c401['params']['id']}},_0x4650a0={};_0x4650a0[_0xf952('0x28')]=_[_0xf952('0x2b')](db[_0xf952('0x3f')][_0xf952('0x40')]);_0x4650a0[_0xf952('0x2a')]=_[_0xf952('0x2b')](_0x59c401[_0xf952('0x2a')]);_0x4650a0[_0xf952('0x33')]=_[_0xf952('0x41')](_0x4650a0[_0xf952('0x28')],_0x4650a0['query']);_0xf146bf['attributes']=_['intersection'](_0x4650a0['model'],qs[_0xf952('0x2d')](_0x59c401['query'][_0xf952('0x2d')]));_0xf146bf[_0xf952('0x2c')]=_0xf146bf[_0xf952('0x2c')]['length']?_0xf146bf[_0xf952('0x2c')]:_0x4650a0[_0xf952('0x28')];if(_0x59c401[_0xf952('0x2a')][_0xf952('0x39')]){_0xf146bf[_0xf952('0x3a')]=[{'all':!![]}];}_0xf146bf=_[_0xf952('0x36')]({},_0xf146bf,_0x59c401[_0xf952('0x38')]);return db[_0xf952('0x3f')][_0xf952('0x42')](_0xf146bf)[_0xf952('0x21')](handleEntityNotFound(_0x34ac4a,null))[_0xf952('0x21')](respondWithResult(_0x34ac4a,null))[_0xf952('0x3d')](handleError(_0x34ac4a,null));};exports[_0xf952('0x43')]=function(_0xa45ff8,_0x24a60c){return db[_0xf952('0x3f')][_0xf952('0x43')](_0xa45ff8[_0xf952('0x44')],{})[_0xf952('0x21')](respondWithResult(_0x24a60c,0xc9))['catch'](handleError(_0x24a60c,null));};exports[_0xf952('0x45')]=function(_0x590e78,_0x34984c){if(_0x590e78[_0xf952('0x44')]['id']){delete _0x590e78[_0xf952('0x44')]['id'];}return db[_0xf952('0x3f')]['find']({'where':{'id':_0x590e78['params']['id']}})[_0xf952('0x21')](handleEntityNotFound(_0x34984c,null))['then'](saveUpdates(_0x590e78[_0xf952('0x44')],null))[_0xf952('0x21')](respondWithResult(_0x34984c,null))[_0xf952('0x3d')](handleError(_0x34984c,null));};exports[_0xf952('0x22')]=function(_0x345c39,_0x56a9ca){return db[_0xf952('0x3f')][_0xf952('0x42')]({'where':{'id':_0x345c39[_0xf952('0x46')]['id']}})[_0xf952('0x21')](handleEntityNotFound(_0x56a9ca,null))[_0xf952('0x21')](removeEntity(_0x56a9ca,null))[_0xf952('0x3d')](handleError(_0x56a9ca,null));};exports[_0xf952('0x47')]=function(_0x5e0a84,_0x5a068d){return db[_0xf952('0x3f')][_0xf952('0x47')]()['then'](respondWithResult(_0x5a068d,null))[_0xf952('0x3d')](handleError(_0x5a068d,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index bef3aaf..b4afb7b 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 _0x3821=['exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','api','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes'];(function(_0xfa141e,_0x3cd094){var _0x3cd3e6=function(_0x442f03){while(--_0x442f03){_0xfa141e['push'](_0xfa141e['shift']());}};_0x3cd3e6(++_0x3cd094);}(_0x3821,0xf7));var _0x1382=function(_0x4bb68a,_0x377620){_0x4bb68a=_0x4bb68a-0x0;var _0x1bb46b=_0x3821[_0x4bb68a];return _0x1bb46b;};'use strict';var _=require(_0x1382('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1382('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1382('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1382('0x3'));var config=require(_0x1382('0x4'));var attributes=require(_0x1382('0x5'));module[_0x1382('0x6')]=function(_0x17c87e,_0x23f39d){return _0x17c87e[_0x1382('0x7')](_0x1382('0x8'),attributes,{'tableName':_0x1382('0x9'),'paranoid':![],'indexes':[{'name':_0x1382('0xa'),'fields':[_0x1382('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0207=['../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x5e9d79,_0x14c3a7){var _0x329563=function(_0x4e957e){while(--_0x4e957e){_0x5e9d79['push'](_0x5e9d79['shift']());}};_0x329563(++_0x14c3a7);}(_0x0207,0x162));var _0x7020=function(_0xc91d20,_0x5712f6){_0xc91d20=_0xc91d20-0x0;var _0x46d8ca=_0x0207[_0xc91d20];return _0x46d8ca;};'use strict';var _=require('lodash');var util=require(_0x7020('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7020('0x1'));var BPromise=require(_0x7020('0x2'));var rp=require(_0x7020('0x3'));var fs=require('fs');var path=require(_0x7020('0x4'));var rimraf=require(_0x7020('0x5'));var config=require(_0x7020('0x6'));var attributes=require(_0x7020('0x7'));module['exports']=function(_0x5074d7,_0x38c320){return _0x5074d7[_0x7020('0x8')](_0x7020('0x9'),attributes,{'tableName':_0x7020('0xa'),'paranoid':![],'indexes':[{'name':_0x7020('0xb'),'fields':[_0x7020('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 8ca458e..03a1cb4 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 _0x5140=['request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','MailTransferReport,\x20%s,\x20%s'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x5140,0xe5));var _0x0514=function(_0x35cc52,_0x4d44d7){_0x35cc52=_0x35cc52-0x0;var _0x43b8b7=_0x5140[_0x35cc52];return _0x43b8b7;};'use strict';var _=require(_0x0514('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0514('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0514('0x2'));var db=require(_0x0514('0x3'))['db'];var utils=require(_0x0514('0x4'));var logger=require(_0x0514('0x5'))(_0x0514('0x6'));var config=require('../../config/environment');var jayson=require(_0x0514('0x7'));var client=jayson[_0x0514('0x8')][_0x0514('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ccfab,_0x52b780,_0x585e27){return new BPromise(function(_0x4c3a24,_0x55d392){return client[_0x0514('0xa')](_0x1ccfab,_0x585e27)[_0x0514('0xb')](function(_0xdc6d3e){logger['info'](_0x0514('0xc'),_0x52b780,_0x0514('0xd'));logger[_0x0514('0xe')](_0x0514('0xf'),_0x52b780,_0x0514('0xd'),JSON[_0x0514('0x10')](_0xdc6d3e));if(_0xdc6d3e[_0x0514('0x11')]){if(_0xdc6d3e['error'][_0x0514('0x12')]===0x1f4){logger[_0x0514('0x11')](_0x0514('0xc'),_0x52b780,_0xdc6d3e[_0x0514('0x11')]['message']);return _0x55d392(_0xdc6d3e[_0x0514('0x11')][_0x0514('0x13')]);}logger[_0x0514('0x11')](_0x0514('0xc'),_0x52b780,_0xdc6d3e[_0x0514('0x11')]['message']);return _0x4c3a24(_0xdc6d3e[_0x0514('0x11')][_0x0514('0x13')]);}else{logger[_0x0514('0x14')](_0x0514('0xc'),_0x52b780,_0x0514('0xd'));_0x4c3a24(_0xdc6d3e[_0x0514('0x15')][_0x0514('0x13')]);}})['catch'](function(_0x575693){logger[_0x0514('0x11')](_0x0514('0xc'),_0x52b780,_0x575693);_0x55d392(_0x575693);});});} \ No newline at end of file +var _0xebd0=['../../config/logger','rpc','jayson/promise','client','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x229317,_0x42d0db){var _0x5378d7=function(_0x5b78ad){while(--_0x5b78ad){_0x229317['push'](_0x229317['shift']());}};_0x5378d7(++_0x42d0db);}(_0xebd0,0x149));var _0x0ebd=function(_0x42b5a3,_0x2205df){_0x42b5a3=_0x42b5a3-0x0;var _0x144123=_0xebd0[_0x42b5a3];return _0x144123;};'use strict';var _=require(_0x0ebd('0x0'));var util=require(_0x0ebd('0x1'));var moment=require(_0x0ebd('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ebd('0x3'));var fs=require('fs');var Redis=require(_0x0ebd('0x4'));var db=require(_0x0ebd('0x5'))['db'];var utils=require(_0x0ebd('0x6'));var logger=require(_0x0ebd('0x7'))(_0x0ebd('0x8'));var config=require('../../config/environment');var jayson=require(_0x0ebd('0x9'));var client=jayson[_0x0ebd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20f3eb,_0x3037d1,_0xd91292){return new BPromise(function(_0x4a48d1,_0x4df660){return client[_0x0ebd('0xb')](_0x20f3eb,_0xd91292)[_0x0ebd('0xc')](function(_0x4e7a9b){logger[_0x0ebd('0xd')](_0x0ebd('0xe'),_0x3037d1,_0x0ebd('0xf'));logger[_0x0ebd('0x10')](_0x0ebd('0x11'),_0x3037d1,_0x0ebd('0xf'),JSON[_0x0ebd('0x12')](_0x4e7a9b));if(_0x4e7a9b[_0x0ebd('0x13')]){if(_0x4e7a9b[_0x0ebd('0x13')][_0x0ebd('0x14')]===0x1f4){logger[_0x0ebd('0x13')](_0x0ebd('0xe'),_0x3037d1,_0x4e7a9b[_0x0ebd('0x13')]['message']);return _0x4df660(_0x4e7a9b['error'][_0x0ebd('0x15')]);}logger[_0x0ebd('0x13')](_0x0ebd('0xe'),_0x3037d1,_0x4e7a9b[_0x0ebd('0x13')][_0x0ebd('0x15')]);return _0x4a48d1(_0x4e7a9b[_0x0ebd('0x13')][_0x0ebd('0x15')]);}else{logger[_0x0ebd('0xd')](_0x0ebd('0xe'),_0x3037d1,_0x0ebd('0xf'));_0x4a48d1(_0x4e7a9b[_0x0ebd('0x16')][_0x0ebd('0x15')]);}})[_0x0ebd('0x17')](function(_0x2f34f8){logger['error'](_0x0ebd('0xe'),_0x3037d1,_0x2f34f8);_0x4df660(_0x2f34f8);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index ed953b4..6beedd4 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 _0x5226=['post','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x2acdfe,_0x34b234){var _0x5a977b=function(_0x1bcba9){while(--_0x1bcba9){_0x2acdfe['push'](_0x2acdfe['shift']());}};_0x5a977b(++_0x34b234);}(_0x5226,0x84));var _0x6522=function(_0x3a723d,_0x941d4d){_0x3a723d=_0x3a723d-0x0;var _0x366470=_0x5226[_0x3a723d];return _0x366470;};'use strict';var multer=require('multer');var util=require(_0x6522('0x0'));var path=require(_0x6522('0x1'));var timeout=require(_0x6522('0x2'));var express=require('express');var router=express[_0x6522('0x3')]();var fs_extra=require(_0x6522('0x4'));var auth=require(_0x6522('0x5'));var interaction=require(_0x6522('0x6'));var config=require(_0x6522('0x7'));var controller=require(_0x6522('0x8'));router[_0x6522('0x9')]('/',auth['isAuthenticated'](),controller[_0x6522('0xa')]);router[_0x6522('0x9')](_0x6522('0xb'),auth[_0x6522('0xc')](),controller[_0x6522('0xd')]);router[_0x6522('0x9')](_0x6522('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x6522('0xf')]('/',auth[_0x6522('0xc')](),controller['create']);router[_0x6522('0x10')](_0x6522('0xe'),auth[_0x6522('0xc')](),controller[_0x6522('0x11')]);router[_0x6522('0x12')]('/:id',auth[_0x6522('0xc')](),controller[_0x6522('0x13')]);module[_0x6522('0x14')]=router; \ No newline at end of file +var _0x3fe6=['describe','/:id','show','create','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe'];(function(_0x37b3e5,_0x33b516){var _0x207f20=function(_0x5237fa){while(--_0x5237fa){_0x37b3e5['push'](_0x37b3e5['shift']());}};_0x207f20(++_0x33b516);}(_0x3fe6,0x15e));var _0x63fe=function(_0x2c1aa8,_0x3e0609){_0x2c1aa8=_0x2c1aa8-0x0;var _0x4019f5=_0x3fe6[_0x2c1aa8];return _0x4019f5;};'use strict';var multer=require(_0x63fe('0x0'));var util=require(_0x63fe('0x1'));var path=require(_0x63fe('0x2'));var timeout=require('connect-timeout');var express=require(_0x63fe('0x3'));var router=express[_0x63fe('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x63fe('0x5'));var interaction=require(_0x63fe('0x6'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0x63fe('0x7')]('/',auth[_0x63fe('0x8')](),controller['index']);router[_0x63fe('0x7')](_0x63fe('0x9'),auth['isAuthenticated'](),controller[_0x63fe('0xa')]);router[_0x63fe('0x7')](_0x63fe('0xb'),auth[_0x63fe('0x8')](),controller[_0x63fe('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x63fe('0xd')]);router[_0x63fe('0xe')]('/:id',auth[_0x63fe('0x8')](),controller[_0x63fe('0xf')]);router[_0x63fe('0x10')](_0x63fe('0xb'),auth[_0x63fe('0x8')](),controller['destroy']);module[_0x63fe('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 7218d1f..a4c9797 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 _0xb0c3=['LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','diff','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING'];(function(_0x3fe3d2,_0x3dfdb2){var _0x5d70b7=function(_0x14138c){while(--_0x14138c){_0x3fe3d2['push'](_0x3fe3d2['shift']());}};_0x5d70b7(++_0x3dfdb2);}(_0xb0c3,0x12e));var _0x3b0c=function(_0x56d444,_0x2ee7c8){_0x56d444=_0x56d444-0x0;var _0x4cbca1=_0xb0c3[_0x56d444];return _0x4cbca1;};'use strict';var Sequelize=require(_0x3b0c('0x0'));var moment=require(_0x3b0c('0x1'));module[_0x3b0c('0x2')]={'channel':{'type':Sequelize[_0x3b0c('0x3')]},'membername':{'type':Sequelize[_0x3b0c('0x3')]},'interface':{'type':Sequelize[_0x3b0c('0x3')]},'type':{'type':Sequelize[_0x3b0c('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x3b0c('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x3b0c('0x5')]},'exitAt':{'type':Sequelize[_0x3b0c('0x5')],'set':function(_0x2eb1a7){var _0xa2b972=moment(_0x2eb1a7);var _0x1682c1=moment(this[_0x3b0c('0x6')]('enterAt'));var _0x27b290=_0xa2b972[_0x3b0c('0x7')](_0x1682c1,'seconds');this[_0x3b0c('0x8')](_0x3b0c('0x9'),_0x2eb1a7);this[_0x3b0c('0x8')](_0x3b0c('0xa'),_0x27b290>=0x0?_0x27b290:null);}},'data1':{'type':Sequelize[_0x3b0c('0x3')],'comment':_0x3b0c('0xb')},'data2':{'type':Sequelize[_0x3b0c('0x3')],'comment':_0x3b0c('0xc')},'data3':{'type':Sequelize[_0x3b0c('0x3')],'comment':_0x3b0c('0xd')},'data4':{'type':Sequelize[_0x3b0c('0x3')],'comment':_0x3b0c('0xe')},'data5':{'type':Sequelize[_0x3b0c('0x3')],'comment':_0x3b0c('0xf')},'role':{'type':Sequelize[_0x3b0c('0x3')]},'internal':{'type':Sequelize[_0x3b0c('0x10')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x79fe=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','exitAt','setDataValue','duration'];(function(_0x591cfd,_0x501204){var _0x4d0100=function(_0xb9ff0c){while(--_0xb9ff0c){_0x591cfd['push'](_0x591cfd['shift']());}};_0x4d0100(++_0x501204);}(_0x79fe,0xa6));var _0xe79f=function(_0x4d2e94,_0x38e9d0){_0x4d2e94=_0x4d2e94-0x0;var _0x46a397=_0x79fe[_0x4d2e94];return _0x46a397;};'use strict';var Sequelize=require(_0xe79f('0x0'));var moment=require(_0xe79f('0x1'));module[_0xe79f('0x2')]={'channel':{'type':Sequelize[_0xe79f('0x3')]},'membername':{'type':Sequelize[_0xe79f('0x3')]},'interface':{'type':Sequelize[_0xe79f('0x3')]},'type':{'type':Sequelize[_0xe79f('0x3')],'defaultValue':_0xe79f('0x4'),'comment':_0xe79f('0x5')},'duration':{'type':Sequelize[_0xe79f('0x6')]},'enterAt':{'type':Sequelize[_0xe79f('0x7')]},'exitAt':{'type':Sequelize[_0xe79f('0x7')],'set':function(_0x3228fc){var _0xd9c20a=moment(_0x3228fc);var _0x4448dd=moment(this[_0xe79f('0x8')](_0xe79f('0x9')));var _0xebbf89=_0xd9c20a[_0xe79f('0xa')](_0x4448dd,'seconds');this['setDataValue'](_0xe79f('0xb'),_0x3228fc);this[_0xe79f('0xc')](_0xe79f('0xd'),_0xebbf89>=0x0?_0xebbf89:null);}},'data1':{'type':Sequelize[_0xe79f('0x3')],'comment':_0xe79f('0xe')},'data2':{'type':Sequelize['STRING'],'comment':_0xe79f('0xf')},'data3':{'type':Sequelize['STRING'],'comment':_0xe79f('0x10')},'data4':{'type':Sequelize[_0xe79f('0x3')],'comment':_0xe79f('0x11')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xe79f('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index ce84dd9..b4ef954 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 _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','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','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x27478a,_0x121424){var _0x3d1130=function(_0x4f3abf){while(--_0x4f3abf){_0x27478a['push'](_0x27478a['shift']());}};_0x3d1130(++_0x121424);}(_0x3e74,0x175));var _0x43e7=function(_0x41fd7b,_0x3d5370){_0x41fd7b=_0x41fd7b-0x0;var _0x2914a4=_0x3e74[_0x41fd7b];return _0x2914a4;};'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('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file +var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0x34e8,0x12c));var _0x834e=function(_0x549375,_0x520ca6){_0x549375=_0x549375-0x0;var _0x166f3f=_0x34e8[_0x549375];return _0x166f3f;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index e5a5a6a..42c846e 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 _0x8832=['util','../../config/logger','api','moment','bluebird','path','./memberReport.attributes','MemberReport','membername_interface','membername','lodash'];(function(_0x274bd5,_0x58f753){var _0x2bfb3c=function(_0x1fc66a){while(--_0x1fc66a){_0x274bd5['push'](_0x274bd5['shift']());}};_0x2bfb3c(++_0x58f753);}(_0x8832,0x1d8));var _0x2883=function(_0x3da72a,_0x26c4e0){_0x3da72a=_0x3da72a-0x0;var _0x5ab5f9=_0x8832[_0x3da72a];return _0x5ab5f9;};'use strict';var _=require(_0x2883('0x0'));var util=require(_0x2883('0x1'));var logger=require(_0x2883('0x2'))(_0x2883('0x3'));var moment=require(_0x2883('0x4'));var BPromise=require(_0x2883('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2883('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2883('0x7'));module['exports']=function(_0x2fcab8,_0x35d815){return _0x2fcab8['define'](_0x2883('0x8'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x2883('0x9'),'fields':[_0x2883('0xa'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9505=['report_member','membername_interface','membername','interface','lodash','util','api','moment','bluebird','request-promise','path','./memberReport.attributes','exports'];(function(_0xf77fa6,_0x4c9df8){var _0x5bd317=function(_0x4af34a){while(--_0x4af34a){_0xf77fa6['push'](_0xf77fa6['shift']());}};_0x5bd317(++_0x4c9df8);}(_0x9505,0x1e5));var _0x5950=function(_0x5319d7,_0x17479d){_0x5319d7=_0x5319d7-0x0;var _0x2b3c51=_0x9505[_0x5319d7];return _0x2b3c51;};'use strict';var _=require(_0x5950('0x0'));var util=require(_0x5950('0x1'));var logger=require('../../config/logger')(_0x5950('0x2'));var moment=require(_0x5950('0x3'));var BPromise=require(_0x5950('0x4'));var rp=require(_0x5950('0x5'));var fs=require('fs');var path=require(_0x5950('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5950('0x7'));module[_0x5950('0x8')]=function(_0x3ac153,_0x3a5973){return _0x3ac153['define']('MemberReport',attributes,{'tableName':_0x5950('0x9'),'paranoid':![],'indexes':[{'name':_0x5950('0xa'),'fields':[_0x5950('0xb'),_0x5950('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 8b8495c..69bf29b 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 _0x44c2=['options','where','attributes','limit','include','map','model','then','info','debug','CreateMemberReport','create','body','raw','update','UpdateMemberReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','code','error','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','MemberReport','findAll'];(function(_0x3ce674,_0x5dac29){var _0x20d66d=function(_0x50d133){while(--_0x50d133){_0x3ce674['push'](_0x3ce674['shift']());}};_0x20d66d(++_0x5dac29);}(_0x44c2,0x100));var _0x244c=function(_0x5e7514,_0x30c2e1){_0x5e7514=_0x5e7514-0x0;var _0x12f472=_0x44c2[_0x5e7514];return _0x12f472;};'use strict';var _=require(_0x244c('0x0'));var util=require(_0x244c('0x1'));var moment=require(_0x244c('0x2'));var BPromise=require(_0x244c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x244c('0x4'));var db=require(_0x244c('0x5'))['db'];var utils=require(_0x244c('0x6'));var logger=require(_0x244c('0x7'))(_0x244c('0x8'));var config=require(_0x244c('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x244c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c758e,_0x18491b,_0x5b49a1){return new BPromise(function(_0x54b673,_0x1a0f7d){return client[_0x244c('0xb')](_0x4c758e,_0x5b49a1)['then'](function(_0xf5430e){logger['info']('MemberReport,\x20%s,\x20%s',_0x18491b,_0x244c('0xc'));logger['debug'](_0x244c('0xd'),_0x18491b,'request\x20sent',JSON[_0x244c('0xe')](_0xf5430e));if(_0xf5430e['error']){if(_0xf5430e['error'][_0x244c('0xf')]===0x1f4){logger[_0x244c('0x10')](_0x244c('0x11'),_0x18491b,_0xf5430e['error'][_0x244c('0x12')]);return _0x1a0f7d(_0xf5430e[_0x244c('0x10')][_0x244c('0x12')]);}logger[_0x244c('0x10')](_0x244c('0x11'),_0x18491b,_0xf5430e[_0x244c('0x10')][_0x244c('0x12')]);return _0x54b673(_0xf5430e['error'][_0x244c('0x12')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0x18491b,_0x244c('0xc'));_0x54b673(_0xf5430e[_0x244c('0x13')][_0x244c('0x12')]);}})[_0x244c('0x14')](function(_0x5f2a11){logger[_0x244c('0x10')](_0x244c('0x11'),_0x18491b,_0x5f2a11);_0x1a0f7d(_0x5f2a11);});});}exports[_0x244c('0x15')]=function(_0x1c339f){var _0x1ba203=this;return new Promise(function(_0x4ee7b2,_0x3531b){return db[_0x244c('0x16')][_0x244c('0x17')]({'raw':_0x1c339f['options']?_0x1c339f['options']['raw']===undefined?!![]:![]:!![],'where':_0x1c339f[_0x244c('0x18')]?_0x1c339f[_0x244c('0x18')][_0x244c('0x19')]||null:null,'attributes':_0x1c339f[_0x244c('0x18')]?_0x1c339f[_0x244c('0x18')][_0x244c('0x1a')]||null:null,'limit':_0x1c339f['options']?_0x1c339f[_0x244c('0x18')][_0x244c('0x1b')]||null:null,'include':_0x1c339f[_0x244c('0x18')]?_0x1c339f['options'][_0x244c('0x1c')]?_['map'](_0x1c339f['options'][_0x244c('0x1c')],function(_0x6aa1f4){return{'model':db[_0x6aa1f4['model']],'as':_0x6aa1f4['as'],'attributes':_0x6aa1f4[_0x244c('0x1a')],'include':_0x6aa1f4[_0x244c('0x1c')]?_[_0x244c('0x1d')](_0x6aa1f4[_0x244c('0x1c')],function(_0x54b7ae){return{'model':db[_0x54b7ae[_0x244c('0x1e')]],'as':_0x54b7ae['as'],'attributes':_0x54b7ae[_0x244c('0x1a')],'include':_0x54b7ae[_0x244c('0x1c')]?_[_0x244c('0x1d')](_0x54b7ae[_0x244c('0x1c')],function(_0x584d44){return{'model':db[_0x584d44['model']],'as':_0x584d44['as'],'attributes':_0x584d44[_0x244c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x244c('0x1f')](function(_0x193c50){logger[_0x244c('0x20')](_0x244c('0x15'),_0x1c339f);logger[_0x244c('0x21')](_0x244c('0x15'),_0x1c339f,JSON[_0x244c('0xe')](_0x193c50));_0x4ee7b2(_0x193c50);})[_0x244c('0x14')](function(_0x3dc983){logger['error']('GetMemberReport',_0x3dc983[_0x244c('0x12')],_0x1c339f);_0x3531b(_0x1ba203[_0x244c('0x10')](0x1f4,_0x3dc983[_0x244c('0x12')]));});});};exports[_0x244c('0x22')]=function(_0xf82c11){var _0x1e7340=this;return new Promise(function(_0x53d882,_0x33b062){return db[_0x244c('0x16')][_0x244c('0x23')](_0xf82c11[_0x244c('0x24')],{'raw':_0xf82c11[_0x244c('0x18')]?_0xf82c11[_0x244c('0x18')][_0x244c('0x25')]===undefined?!![]:![]:!![]})[_0x244c('0x1f')](function(_0x15aeaf){logger[_0x244c('0x20')](_0x244c('0x22'),_0xf82c11);logger[_0x244c('0x21')]('CreateMemberReport',_0xf82c11,JSON[_0x244c('0xe')](_0x15aeaf));_0x53d882(_0x15aeaf);})[_0x244c('0x14')](function(_0x38da69){logger[_0x244c('0x10')](_0x244c('0x22'),_0x38da69[_0x244c('0x12')],_0xf82c11);_0x33b062(_0x1e7340[_0x244c('0x10')](0x1f4,_0x38da69[_0x244c('0x12')]));});});};exports['UpdateMemberReport']=function(_0x2e6a88){var _0x14c830=this;return new Promise(function(_0x4dd3a3,_0x3025a4){return db[_0x244c('0x16')][_0x244c('0x26')](_0x2e6a88[_0x244c('0x24')],{'raw':_0x2e6a88[_0x244c('0x18')]?_0x2e6a88[_0x244c('0x18')][_0x244c('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e6a88[_0x244c('0x18')]?_0x2e6a88[_0x244c('0x18')][_0x244c('0x19')]||null:null,'attributes':_0x2e6a88['options']?_0x2e6a88[_0x244c('0x18')][_0x244c('0x1a')]||null:null,'limit':_0x2e6a88[_0x244c('0x18')]?_0x2e6a88[_0x244c('0x18')][_0x244c('0x1b')]||null:null})['then'](function(_0x5e1596){logger[_0x244c('0x20')]('UpdateMemberReport',_0x2e6a88);logger[_0x244c('0x21')](_0x244c('0x27'),_0x2e6a88,JSON[_0x244c('0xe')](_0x5e1596));_0x4dd3a3(_0x5e1596);})[_0x244c('0x14')](function(_0x1c69ab){logger[_0x244c('0x10')]('UpdateMemberReport',_0x1c69ab['message'],_0x2e6a88);_0x3025a4(_0x14c830[_0x244c('0x10')](0x1f4,_0x1c69ab[_0x244c('0x12')]));});});}; \ No newline at end of file +var _0xdf70=['request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetMemberReport','MemberReport','options','where','limit','include','map','model','attributes','body','raw','CreateMemberReport','update','UpdateMemberReport','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x4f240d,_0x13a89a){var _0x5b92cc=function(_0x33fb91){while(--_0x33fb91){_0x4f240d['push'](_0x4f240d['shift']());}};_0x5b92cc(++_0x13a89a);}(_0xdf70,0x86));var _0x0df7=function(_0x31c798,_0x2f1872){_0x31c798=_0x31c798-0x0;var _0x5e508d=_0xdf70[_0x31c798];return _0x5e508d;};'use strict';var _=require(_0x0df7('0x0'));var util=require(_0x0df7('0x1'));var moment=require(_0x0df7('0x2'));var BPromise=require('bluebird');var rs=require(_0x0df7('0x3'));var fs=require('fs');var Redis=require(_0x0df7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0df7('0x5'));var logger=require('../../config/logger')(_0x0df7('0x6'));var config=require(_0x0df7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0df7('0x8')][_0x0df7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42090d,_0x5c1a5b,_0x1f1680){return new BPromise(function(_0x392337,_0x44c4fb){return client[_0x0df7('0xa')](_0x42090d,_0x1f1680)[_0x0df7('0xb')](function(_0x411e73){logger['info'](_0x0df7('0xc'),_0x5c1a5b,_0x0df7('0xd'));logger[_0x0df7('0xe')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x5c1a5b,_0x0df7('0xd'),JSON[_0x0df7('0xf')](_0x411e73));if(_0x411e73[_0x0df7('0x10')]){if(_0x411e73['error'][_0x0df7('0x11')]===0x1f4){logger[_0x0df7('0x10')](_0x0df7('0xc'),_0x5c1a5b,_0x411e73['error'][_0x0df7('0x12')]);return _0x44c4fb(_0x411e73['error']['message']);}logger[_0x0df7('0x10')](_0x0df7('0xc'),_0x5c1a5b,_0x411e73[_0x0df7('0x10')][_0x0df7('0x12')]);return _0x392337(_0x411e73['error'][_0x0df7('0x12')]);}else{logger[_0x0df7('0x13')](_0x0df7('0xc'),_0x5c1a5b,_0x0df7('0xd'));_0x392337(_0x411e73[_0x0df7('0x14')]['message']);}})[_0x0df7('0x15')](function(_0x4161d1){logger['error'](_0x0df7('0xc'),_0x5c1a5b,_0x4161d1);_0x44c4fb(_0x4161d1);});});}exports[_0x0df7('0x16')]=function(_0xffad67){var _0x124582=this;return new Promise(function(_0x32b3bd,_0x29ac87){return db[_0x0df7('0x17')]['findAll']({'raw':_0xffad67[_0x0df7('0x18')]?_0xffad67[_0x0df7('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xffad67[_0x0df7('0x18')]?_0xffad67['options'][_0x0df7('0x19')]||null:null,'attributes':_0xffad67[_0x0df7('0x18')]?_0xffad67[_0x0df7('0x18')]['attributes']||null:null,'limit':_0xffad67['options']?_0xffad67[_0x0df7('0x18')][_0x0df7('0x1a')]||null:null,'include':_0xffad67[_0x0df7('0x18')]?_0xffad67['options'][_0x0df7('0x1b')]?_[_0x0df7('0x1c')](_0xffad67[_0x0df7('0x18')]['include'],function(_0x462cad){return{'model':db[_0x462cad[_0x0df7('0x1d')]],'as':_0x462cad['as'],'attributes':_0x462cad['attributes'],'include':_0x462cad[_0x0df7('0x1b')]?_[_0x0df7('0x1c')](_0x462cad[_0x0df7('0x1b')],function(_0x23f064){return{'model':db[_0x23f064['model']],'as':_0x23f064['as'],'attributes':_0x23f064[_0x0df7('0x1e')],'include':_0x23f064[_0x0df7('0x1b')]?_[_0x0df7('0x1c')](_0x23f064['include'],function(_0xd7b64b){return{'model':db[_0xd7b64b[_0x0df7('0x1d')]],'as':_0xd7b64b['as'],'attributes':_0xd7b64b['attributes']};}):[]};}):[]};}):[]:[]})[_0x0df7('0xb')](function(_0x4a6241){logger[_0x0df7('0x13')]('GetMemberReport',_0xffad67);logger[_0x0df7('0xe')](_0x0df7('0x16'),_0xffad67,JSON[_0x0df7('0xf')](_0x4a6241));_0x32b3bd(_0x4a6241);})[_0x0df7('0x15')](function(_0x1b5ce0){logger[_0x0df7('0x10')](_0x0df7('0x16'),_0x1b5ce0[_0x0df7('0x12')],_0xffad67);_0x29ac87(_0x124582[_0x0df7('0x10')](0x1f4,_0x1b5ce0[_0x0df7('0x12')]));});});};exports['CreateMemberReport']=function(_0x14d31c){var _0x1e88a9=this;return new Promise(function(_0x2f7ada,_0x19d002){return db[_0x0df7('0x17')]['create'](_0x14d31c[_0x0df7('0x1f')],{'raw':_0x14d31c[_0x0df7('0x18')]?_0x14d31c[_0x0df7('0x18')][_0x0df7('0x20')]===undefined?!![]:![]:!![]})[_0x0df7('0xb')](function(_0x14f399){logger[_0x0df7('0x13')](_0x0df7('0x21'),_0x14d31c);logger[_0x0df7('0xe')](_0x0df7('0x21'),_0x14d31c,JSON[_0x0df7('0xf')](_0x14f399));_0x2f7ada(_0x14f399);})[_0x0df7('0x15')](function(_0x4cd5d8){logger[_0x0df7('0x10')]('CreateMemberReport',_0x4cd5d8[_0x0df7('0x12')],_0x14d31c);_0x19d002(_0x1e88a9['error'](0x1f4,_0x4cd5d8[_0x0df7('0x12')]));});});};exports['UpdateMemberReport']=function(_0x4122ec){var _0x3cf43e=this;return new Promise(function(_0x371d5b,_0x47a9e3){return db[_0x0df7('0x17')][_0x0df7('0x22')](_0x4122ec[_0x0df7('0x1f')],{'raw':_0x4122ec[_0x0df7('0x18')]?_0x4122ec[_0x0df7('0x18')][_0x0df7('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4122ec[_0x0df7('0x18')]?_0x4122ec['options']['where']||null:null,'attributes':_0x4122ec['options']?_0x4122ec['options']['attributes']||null:null,'limit':_0x4122ec[_0x0df7('0x18')]?_0x4122ec['options']['limit']||null:null})['then'](function(_0x374dc1){logger[_0x0df7('0x13')](_0x0df7('0x23'),_0x4122ec);logger[_0x0df7('0xe')](_0x0df7('0x23'),_0x4122ec,JSON['stringify'](_0x374dc1));_0x371d5b(_0x374dc1);})[_0x0df7('0x15')](function(_0x29f940){logger['error'](_0x0df7('0x23'),_0x29f940[_0x0df7('0x12')],_0x4122ec);_0x47a9e3(_0x3cf43e[_0x0df7('0x10')](0x1f4,_0x29f940[_0x0df7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 6278312..470e602 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 _0x27f9=['./migration.controller','index','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x209ba4,_0x11aee){var _0x336e86=function(_0x46b455){while(--_0x46b455){_0x209ba4['push'](_0x209ba4['shift']());}};_0x336e86(++_0x11aee);}(_0x27f9,0x1e3));var _0x927f=function(_0x583caf,_0x1c74d0){_0x583caf=_0x583caf-0x0;var _0x2f45d6=_0x27f9[_0x583caf];return _0x2f45d6;};'use strict';var multer=require(_0x927f('0x0'));var util=require(_0x927f('0x1'));var path=require(_0x927f('0x2'));var timeout=require('connect-timeout');var express=require(_0x927f('0x3'));var router=express[_0x927f('0x4')]();var fs_extra=require(_0x927f('0x5'));var auth=require(_0x927f('0x6'));var interaction=require(_0x927f('0x7'));var config=require(_0x927f('0x8'));var controller=require(_0x927f('0x9'));router['get']('/',controller[_0x927f('0xa')]);module[_0x927f('0xb')]=router; \ No newline at end of file +var _0x8f5d=['express','fs-extra','../../components/auth/service','../../config/environment','./migration.controller','get','index','exports','multer','path','connect-timeout'];(function(_0x2f3b86,_0x1fffad){var _0x9741a0=function(_0x654b64){while(--_0x654b64){_0x2f3b86['push'](_0x2f3b86['shift']());}};_0x9741a0(++_0x1fffad);}(_0x8f5d,0xb8));var _0xd8f5=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x8f5d[_0x565ed7];return _0x183ad7;};'use strict';var multer=require(_0xd8f5('0x0'));var util=require('util');var path=require(_0xd8f5('0x1'));var timeout=require(_0xd8f5('0x2'));var express=require(_0xd8f5('0x3'));var router=express['Router']();var fs_extra=require(_0xd8f5('0x4'));var auth=require(_0xd8f5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd8f5('0x6'));var controller=require(_0xd8f5('0x7'));router[_0xd8f5('0x8')]('/',controller[_0xd8f5('0x9')]);module[_0xd8f5('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 b0c16f1..3e669ff 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 _0x1362=['sequelize','exports','version'];(function(_0xceaad4,_0x1aa3ce){var _0xeb234=function(_0x4f0150){while(--_0x4f0150){_0xceaad4['push'](_0xceaad4['shift']());}};_0xeb234(++_0x1aa3ce);}(_0x1362,0x19e));var _0x2136=function(_0x1dbf6f,_0x59d8c3){_0x1dbf6f=_0x1dbf6f-0x0;var _0x3639cf=_0x1362[_0x1dbf6f];return _0x3639cf;};'use strict';var Sequelize=require(_0x2136('0x0'));module[_0x2136('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x2136('0x2')}}; \ No newline at end of file +var _0x4fd1=['sequelize','exports','version'];(function(_0x7870ff,_0x21c985){var _0x5d66d6=function(_0x411e71){while(--_0x411e71){_0x7870ff['push'](_0x7870ff['shift']());}};_0x5d66d6(++_0x21c985);}(_0x4fd1,0x1ce));var _0x14fd=function(_0x37e466,_0x4a096e){_0x37e466=_0x37e466-0x0;var _0x2007f7=_0x4fd1[_0x37e466];return _0x2007f7;};'use strict';var Sequelize=require(_0x14fd('0x0'));module[_0x14fd('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x14fd('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 4889b22..1a519be 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 _0x77e5=['request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','destroy','then','name','send','index','map','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Migration','includeAll','findAll','rows','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x2c81c3,_0x2ab258){var _0x2badc2=function(_0x1a3314){while(--_0x1a3314){_0x2c81c3['push'](_0x2c81c3['shift']());}};_0x2badc2(++_0x2ab258);}(_0x77e5,0xc8));var _0x577e=function(_0x57f03b,_0x385182){_0x57f03b=_0x57f03b-0x0;var _0xbdcbfb=_0x77e5[_0x57f03b];return _0xbdcbfb;};'use strict';var emlformat=require(_0x577e('0x0'));var rimraf=require(_0x577e('0x1'));var zipdir=require(_0x577e('0x2'));var jsonpatch=require(_0x577e('0x3'));var rp=require(_0x577e('0x4'));var moment=require('moment');var BPromise=require(_0x577e('0x5'));var Mustache=require(_0x577e('0x6'));var util=require(_0x577e('0x7'));var path=require(_0x577e('0x8'));var sox=require(_0x577e('0x9'));var csv=require(_0x577e('0xa'));var ejs=require(_0x577e('0xb'));var fs=require('fs');var fs_extra=require(_0x577e('0xc'));var _=require(_0x577e('0xd'));var squel=require(_0x577e('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x577e('0xf'));var Papa=require(_0x577e('0x10'));var Redis=require(_0x577e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x577e('0x12'));var as=require(_0x577e('0x13'));var hardwareService=require(_0x577e('0x14'));var logger=require(_0x577e('0x15'))(_0x577e('0x16'));var utils=require(_0x577e('0x17'));var config=require(_0x577e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x577e('0x19'))['db'];function respondWithStatusCode(_0x21c560,_0x3d830d){_0x3d830d=_0x3d830d||0xcc;return function(_0x470c45){if(_0x470c45){return _0x21c560[_0x577e('0x1a')](_0x3d830d);}return _0x21c560['status'](_0x3d830d)[_0x577e('0x1b')]();};}function respondWithResult(_0x54ebc6,_0x4fa2a5){_0x4fa2a5=_0x4fa2a5||0xc8;return function(_0x47e614){if(_0x47e614){return _0x54ebc6['status'](_0x4fa2a5)[_0x577e('0x1c')](_0x47e614);}};}function respondWithFilteredResult(_0x5518bb,_0x17d706){return function(_0xdaad6d){if(_0xdaad6d){var _0x57634d=typeof _0x17d706[_0x577e('0x1d')]===_0x577e('0x1e')&&typeof _0x17d706[_0x577e('0x1f')]===_0x577e('0x1e');var _0x4938ba=_0xdaad6d[_0x577e('0x20')];var _0x2d742e=_0x57634d?0x0:_0x17d706[_0x577e('0x1d')];var _0xc67cda=_0x57634d?_0xdaad6d[_0x577e('0x20')]:_0x17d706[_0x577e('0x1d')]+_0x17d706['limit'];var _0x5c58d2;if(_0xc67cda>=_0x4938ba){_0xc67cda=_0x4938ba;_0x5c58d2=0xc8;}else{_0x5c58d2=0xce;}_0x5518bb[_0x577e('0x21')](_0x5c58d2);return _0x5518bb[_0x577e('0x22')](_0x577e('0x23'),_0x2d742e+'-'+_0xc67cda+'/'+_0x4938ba)[_0x577e('0x1c')](_0xdaad6d);}return null;};}function patchUpdates(_0x3361f3){return function(_0x58a84f){try{jsonpatch[_0x577e('0x24')](_0x58a84f,_0x3361f3,!![]);}catch(_0x329669){return BPromise[_0x577e('0x25')](_0x329669);}return _0x58a84f['save']();};}function saveUpdates(_0xd92f22,_0x19e359){return function(_0x3e9694){if(_0x3e9694){return _0x3e9694[_0x577e('0x26')](_0xd92f22)['then'](function(_0x55e361){return _0x55e361;});}return null;};}function removeEntity(_0x3a0472,_0x28c969){return function(_0x565ba0){if(_0x565ba0){return _0x565ba0[_0x577e('0x27')]()[_0x577e('0x28')](function(){_0x3a0472[_0x577e('0x21')](0xcc)[_0x577e('0x1b')]();});}};}function handleEntityNotFound(_0x3242c2,_0x2270d6){return function(_0x5a37a6){if(!_0x5a37a6){_0x3242c2[_0x577e('0x1a')](0x194);}return _0x5a37a6;};}function handleError(_0x586fae,_0x7c226){_0x7c226=_0x7c226||0x1f4;return function(_0x2ebb4f){logger['error'](_0x2ebb4f['stack']);if(_0x2ebb4f[_0x577e('0x29')]){delete _0x2ebb4f[_0x577e('0x29')];}_0x586fae['status'](_0x7c226)[_0x577e('0x2a')](_0x2ebb4f);};}exports[_0x577e('0x2b')]=function(_0x2ed762,_0x3eb992){var _0x1b9d6d={},_0x19dea9={},_0x5cca03={'count':0x0,'rows':[]};var _0x67fc3c=_[_0x577e('0x2c')](db['Migration']['rawAttributes'],function(_0x2bb54e){return{'name':_0x2bb54e[_0x577e('0x2d')],'type':_0x2bb54e[_0x577e('0x2e')]['key']};});_0x19dea9['model']=_[_0x577e('0x2c')](_0x67fc3c,_0x577e('0x29'));_0x19dea9[_0x577e('0x2f')]=_[_0x577e('0x30')](_0x2ed762[_0x577e('0x2f')]);_0x19dea9[_0x577e('0x31')]=_[_0x577e('0x32')](_0x19dea9[_0x577e('0x33')],_0x19dea9[_0x577e('0x2f')]);_0x1b9d6d[_0x577e('0x34')]=_[_0x577e('0x32')](_0x19dea9[_0x577e('0x33')],qs[_0x577e('0x35')](_0x2ed762[_0x577e('0x2f')]['fields']));_0x1b9d6d[_0x577e('0x34')]=_0x1b9d6d[_0x577e('0x34')][_0x577e('0x36')]?_0x1b9d6d[_0x577e('0x34')]:_0x19dea9[_0x577e('0x33')];if(!_0x2ed762['query']['hasOwnProperty'](_0x577e('0x37'))){_0x1b9d6d[_0x577e('0x1f')]=qs[_0x577e('0x1f')](_0x2ed762['query']['limit']);_0x1b9d6d[_0x577e('0x1d')]=qs[_0x577e('0x1d')](_0x2ed762['query'][_0x577e('0x1d')]);}_0x1b9d6d[_0x577e('0x38')]=qs[_0x577e('0x39')](_0x2ed762['query'][_0x577e('0x39')]);_0x1b9d6d['where']=qs[_0x577e('0x31')](_[_0x577e('0x3a')](_0x2ed762[_0x577e('0x2f')],_0x19dea9[_0x577e('0x31')]),_0x67fc3c);if(_0x2ed762[_0x577e('0x2f')][_0x577e('0x3b')]){_0x1b9d6d[_0x577e('0x3c')]=_[_0x577e('0x3d')](_0x1b9d6d[_0x577e('0x3c')],{'$or':_[_0x577e('0x2c')](_0x67fc3c,function(_0x1ba343){if(_0x1ba343[_0x577e('0x2e')]!==_0x577e('0x3e')){var _0x77f375={};_0x77f375[_0x1ba343[_0x577e('0x29')]]={'$like':'%'+_0x2ed762[_0x577e('0x2f')][_0x577e('0x3b')]+'%'};return _0x77f375;}})});}_0x1b9d6d=_[_0x577e('0x3d')]({},_0x1b9d6d,_0x2ed762[_0x577e('0x3f')]);var _0x36387b={'where':_0x1b9d6d[_0x577e('0x3c')]};return db[_0x577e('0x40')][_0x577e('0x20')](_0x36387b)['then'](function(_0x47246a){_0x5cca03[_0x577e('0x20')]=_0x47246a;if(_0x2ed762[_0x577e('0x2f')][_0x577e('0x41')]){_0x1b9d6d['include']=[{'all':!![]}];}return db['Migration'][_0x577e('0x42')](_0x1b9d6d);})['then'](function(_0x2451b5){_0x5cca03[_0x577e('0x43')]=_0x2451b5;return _0x5cca03;})[_0x577e('0x28')](respondWithFilteredResult(_0x3eb992,_0x1b9d6d))['catch'](handleError(_0x3eb992,null));}; \ No newline at end of file +var _0x5d10=['includeAll','include','rows','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options'];(function(_0x12be00,_0x9eb6a1){var _0x591d3d=function(_0x2df653){while(--_0x2df653){_0x12be00['push'](_0x12be00['shift']());}};_0x591d3d(++_0x9eb6a1);}(_0x5d10,0x8c));var _0x05d1=function(_0x1cb825,_0x909dc6){_0x1cb825=_0x1cb825-0x0;var _0x596088=_0x5d10[_0x1cb825];return _0x596088;};'use strict';var emlformat=require(_0x05d1('0x0'));var rimraf=require(_0x05d1('0x1'));var zipdir=require(_0x05d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05d1('0x3'));var moment=require(_0x05d1('0x4'));var BPromise=require(_0x05d1('0x5'));var Mustache=require(_0x05d1('0x6'));var util=require(_0x05d1('0x7'));var path=require('path');var sox=require(_0x05d1('0x8'));var csv=require(_0x05d1('0x9'));var ejs=require(_0x05d1('0xa'));var fs=require('fs');var fs_extra=require(_0x05d1('0xb'));var _=require(_0x05d1('0xc'));var squel=require(_0x05d1('0xd'));var crypto=require(_0x05d1('0xe'));var jsforce=require(_0x05d1('0xf'));var deskjs=require(_0x05d1('0x10'));var toCsv=require(_0x05d1('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x05d1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x05d1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x05d1('0x13'));var logger=require(_0x05d1('0x14'))(_0x05d1('0x15'));var utils=require(_0x05d1('0x16'));var config=require(_0x05d1('0x17'));var licenseUtil=require(_0x05d1('0x18'));var db=require(_0x05d1('0x19'))['db'];function respondWithStatusCode(_0x22700f,_0x50f50f){_0x50f50f=_0x50f50f||0xcc;return function(_0x60f64c){if(_0x60f64c){return _0x22700f[_0x05d1('0x1a')](_0x50f50f);}return _0x22700f[_0x05d1('0x1b')](_0x50f50f)[_0x05d1('0x1c')]();};}function respondWithResult(_0x4f2c25,_0x3d1dd8){_0x3d1dd8=_0x3d1dd8||0xc8;return function(_0x4a4f97){if(_0x4a4f97){return _0x4f2c25['status'](_0x3d1dd8)['json'](_0x4a4f97);}};}function respondWithFilteredResult(_0x33e51a,_0x44b13e){return function(_0x3769f7){if(_0x3769f7){var _0x248a01=typeof _0x44b13e[_0x05d1('0x1d')]==='undefined'&&typeof _0x44b13e[_0x05d1('0x1e')]===_0x05d1('0x1f');var _0x3f690c=_0x3769f7[_0x05d1('0x20')];var _0x3598fc=_0x248a01?0x0:_0x44b13e[_0x05d1('0x1d')];var _0x2cb212=_0x248a01?_0x3769f7[_0x05d1('0x20')]:_0x44b13e[_0x05d1('0x1d')]+_0x44b13e['limit'];var _0x34dc41;if(_0x2cb212>=_0x3f690c){_0x2cb212=_0x3f690c;_0x34dc41=0xc8;}else{_0x34dc41=0xce;}_0x33e51a[_0x05d1('0x1b')](_0x34dc41);return _0x33e51a['set'](_0x05d1('0x21'),_0x3598fc+'-'+_0x2cb212+'/'+_0x3f690c)['json'](_0x3769f7);}return null;};}function patchUpdates(_0x1e8bb7){return function(_0x12e17a){try{jsonpatch[_0x05d1('0x22')](_0x12e17a,_0x1e8bb7,!![]);}catch(_0x577a99){return BPromise[_0x05d1('0x23')](_0x577a99);}return _0x12e17a['save']();};}function saveUpdates(_0x2f96c5,_0x5b21ad){return function(_0x4c64c3){if(_0x4c64c3){return _0x4c64c3['update'](_0x2f96c5)[_0x05d1('0x24')](function(_0x1c615a){return _0x1c615a;});}return null;};}function removeEntity(_0x331726,_0x514e51){return function(_0x10ecd8){if(_0x10ecd8){return _0x10ecd8[_0x05d1('0x25')]()[_0x05d1('0x24')](function(){_0x331726[_0x05d1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33a656,_0x1ba352){return function(_0x7ea5b7){if(!_0x7ea5b7){_0x33a656[_0x05d1('0x1a')](0x194);}return _0x7ea5b7;};}function handleError(_0x76480b,_0x2d3050){_0x2d3050=_0x2d3050||0x1f4;return function(_0x12806){logger[_0x05d1('0x26')](_0x12806[_0x05d1('0x27')]);if(_0x12806['name']){delete _0x12806[_0x05d1('0x28')];}_0x76480b[_0x05d1('0x1b')](_0x2d3050)[_0x05d1('0x29')](_0x12806);};}exports[_0x05d1('0x2a')]=function(_0x5441b5,_0x127db5){var _0x38beef={},_0x4ecece={},_0x2d4b62={'count':0x0,'rows':[]};var _0x5ae2f3=_[_0x05d1('0x2b')](db[_0x05d1('0x2c')][_0x05d1('0x2d')],function(_0x5a086c){return{'name':_0x5a086c[_0x05d1('0x2e')],'type':_0x5a086c['type'][_0x05d1('0x2f')]};});_0x4ecece[_0x05d1('0x30')]=_[_0x05d1('0x2b')](_0x5ae2f3,_0x05d1('0x28'));_0x4ecece[_0x05d1('0x31')]=_[_0x05d1('0x32')](_0x5441b5[_0x05d1('0x31')]);_0x4ecece[_0x05d1('0x33')]=_[_0x05d1('0x34')](_0x4ecece['model'],_0x4ecece[_0x05d1('0x31')]);_0x38beef[_0x05d1('0x35')]=_[_0x05d1('0x34')](_0x4ecece[_0x05d1('0x30')],qs['fields'](_0x5441b5[_0x05d1('0x31')]['fields']));_0x38beef['attributes']=_0x38beef[_0x05d1('0x35')]['length']?_0x38beef[_0x05d1('0x35')]:_0x4ecece[_0x05d1('0x30')];if(!_0x5441b5[_0x05d1('0x31')][_0x05d1('0x36')](_0x05d1('0x37'))){_0x38beef[_0x05d1('0x1e')]=qs[_0x05d1('0x1e')](_0x5441b5[_0x05d1('0x31')]['limit']);_0x38beef[_0x05d1('0x1d')]=qs[_0x05d1('0x1d')](_0x5441b5[_0x05d1('0x31')][_0x05d1('0x1d')]);}_0x38beef[_0x05d1('0x38')]=qs[_0x05d1('0x39')](_0x5441b5['query']['sort']);_0x38beef[_0x05d1('0x3a')]=qs[_0x05d1('0x33')](_['pick'](_0x5441b5['query'],_0x4ecece[_0x05d1('0x33')]),_0x5ae2f3);if(_0x5441b5['query']['filter']){_0x38beef[_0x05d1('0x3a')]=_['merge'](_0x38beef['where'],{'$or':_[_0x05d1('0x2b')](_0x5ae2f3,function(_0x20e646){if(_0x20e646[_0x05d1('0x3b')]!==_0x05d1('0x3c')){var _0x257c5d={};_0x257c5d[_0x20e646[_0x05d1('0x28')]]={'$like':'%'+_0x5441b5[_0x05d1('0x31')][_0x05d1('0x3d')]+'%'};return _0x257c5d;}})});}_0x38beef=_[_0x05d1('0x3e')]({},_0x38beef,_0x5441b5[_0x05d1('0x3f')]);var _0x56d481={'where':_0x38beef[_0x05d1('0x3a')]};return db[_0x05d1('0x2c')][_0x05d1('0x20')](_0x56d481)[_0x05d1('0x24')](function(_0x4599b4){_0x2d4b62[_0x05d1('0x20')]=_0x4599b4;if(_0x5441b5[_0x05d1('0x31')][_0x05d1('0x40')]){_0x38beef[_0x05d1('0x41')]=[{'all':!![]}];}return db['Migration']['findAll'](_0x38beef);})['then'](function(_0x2cd57d){_0x2d4b62[_0x05d1('0x42')]=_0x2cd57d;return _0x2d4b62;})['then'](respondWithFilteredResult(_0x127db5,_0x38beef))[_0x05d1('0x43')](handleError(_0x127db5,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 4d30dca..a4fbbef 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 _0x23ed=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','define','Migration','migrations','../../config/logger','api'];(function(_0x1e7335,_0x480ef0){var _0x4b6cc1=function(_0x3a1ce7){while(--_0x3a1ce7){_0x1e7335['push'](_0x1e7335['shift']());}};_0x4b6cc1(++_0x480ef0);}(_0x23ed,0x196));var _0xd23e=function(_0x24bbe2,_0x290f3a){_0x24bbe2=_0x24bbe2-0x0;var _0xcad547=_0x23ed[_0x24bbe2];return _0xcad547;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd23e('0x0'))(_0xd23e('0x1'));var moment=require(_0xd23e('0x2'));var BPromise=require(_0xd23e('0x3'));var rp=require(_0xd23e('0x4'));var fs=require('fs');var path=require(_0xd23e('0x5'));var rimraf=require(_0xd23e('0x6'));var config=require(_0xd23e('0x7'));var attributes=require(_0xd23e('0x8'));module['exports']=function(_0x506c87,_0xcc7be5){return _0x506c87[_0xd23e('0x9')](_0xd23e('0xa'),attributes,{'tableName':_0xd23e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c16=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Migration','../../config/logger'];(function(_0x2bcc84,_0x11ede9){var _0x4e0c74=function(_0x1196c7){while(--_0x1196c7){_0x2bcc84['push'](_0x2bcc84['shift']());}};_0x4e0c74(++_0x11ede9);}(_0x1c16,0x1d5));var _0x61c1=function(_0x20e555,_0x40aea6){_0x20e555=_0x20e555-0x0;var _0x182077=_0x1c16[_0x20e555];return _0x182077;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x61c1('0x0'))(_0x61c1('0x1'));var moment=require(_0x61c1('0x2'));var BPromise=require(_0x61c1('0x3'));var rp=require(_0x61c1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x61c1('0x5'));var config=require(_0x61c1('0x6'));var attributes=require('./migration.attributes');module[_0x61c1('0x7')]=function(_0x136f70,_0x1cef43){return _0x136f70[_0x61c1('0x8')](_0x61c1('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index e05a469..4927ef7 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 _0x5397=['info','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Migration,\x20%s,\x20%s','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x5397,0x105));var _0x7539=function(_0x12c5ad,_0x586102){_0x12c5ad=_0x12c5ad-0x0;var _0xf7c02d=_0x5397[_0x12c5ad];return _0xf7c02d;};'use strict';var _=require('lodash');var util=require(_0x7539('0x0'));var moment=require(_0x7539('0x1'));var BPromise=require(_0x7539('0x2'));var rs=require(_0x7539('0x3'));var fs=require('fs');var Redis=require(_0x7539('0x4'));var db=require(_0x7539('0x5'))['db'];var utils=require(_0x7539('0x6'));var logger=require(_0x7539('0x7'))(_0x7539('0x8'));var config=require('../../config/environment');var jayson=require(_0x7539('0x9'));var client=jayson[_0x7539('0xa')][_0x7539('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e3897,_0x2e3dad,_0x55b824){return new BPromise(function(_0x18ba43,_0x4e49e9){return client[_0x7539('0xc')](_0x2e3897,_0x55b824)[_0x7539('0xd')](function(_0xe34cd9){logger[_0x7539('0xe')]('Migration,\x20%s,\x20%s',_0x2e3dad,'request\x20sent');logger[_0x7539('0xf')](_0x7539('0x10'),_0x2e3dad,_0x7539('0x11'),JSON[_0x7539('0x12')](_0xe34cd9));if(_0xe34cd9[_0x7539('0x13')]){if(_0xe34cd9['error'][_0x7539('0x14')]===0x1f4){logger[_0x7539('0x13')]('Migration,\x20%s,\x20%s',_0x2e3dad,_0xe34cd9[_0x7539('0x13')][_0x7539('0x15')]);return _0x4e49e9(_0xe34cd9['error'][_0x7539('0x15')]);}logger[_0x7539('0x13')]('Migration,\x20%s,\x20%s',_0x2e3dad,_0xe34cd9[_0x7539('0x13')][_0x7539('0x15')]);return _0x18ba43(_0xe34cd9[_0x7539('0x13')][_0x7539('0x15')]);}else{logger[_0x7539('0xe')]('Migration,\x20%s,\x20%s',_0x2e3dad,_0x7539('0x11'));_0x18ba43(_0xe34cd9[_0x7539('0x16')][_0x7539('0x15')]);}})[_0x7539('0x17')](function(_0x515710){logger[_0x7539('0x13')](_0x7539('0x18'),_0x2e3dad,_0x515710);_0x4e49e9(_0x515710);});});} \ No newline at end of file +var _0xb575=['bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x22369a,_0x100d86){var _0x5d0ae9=function(_0x4c97e7){while(--_0x4c97e7){_0x22369a['push'](_0x22369a['shift']());}};_0x5d0ae9(++_0x100d86);}(_0xb575,0xda));var _0x5b57=function(_0x1c26e7,_0x39c7d6){_0x1c26e7=_0x1c26e7-0x0;var _0x3b5dfe=_0xb575[_0x1c26e7];return _0x3b5dfe;};'use strict';var _=require(_0x5b57('0x0'));var util=require(_0x5b57('0x1'));var moment=require('moment');var BPromise=require(_0x5b57('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5b57('0x3'));var logger=require(_0x5b57('0x4'))('rpc');var config=require(_0x5b57('0x5'));var jayson=require(_0x5b57('0x6'));var client=jayson[_0x5b57('0x7')][_0x5b57('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x672beb,_0x5d223d,_0x4232d0){return new BPromise(function(_0x5dd0c7,_0x2f9789){return client[_0x5b57('0x9')](_0x672beb,_0x4232d0)[_0x5b57('0xa')](function(_0x49ce3a){logger[_0x5b57('0xb')](_0x5b57('0xc'),_0x5d223d,_0x5b57('0xd'));logger['debug'](_0x5b57('0xe'),_0x5d223d,_0x5b57('0xd'),JSON['stringify'](_0x49ce3a));if(_0x49ce3a['error']){if(_0x49ce3a[_0x5b57('0xf')][_0x5b57('0x10')]===0x1f4){logger[_0x5b57('0xf')](_0x5b57('0xc'),_0x5d223d,_0x49ce3a[_0x5b57('0xf')][_0x5b57('0x11')]);return _0x2f9789(_0x49ce3a[_0x5b57('0xf')][_0x5b57('0x11')]);}logger[_0x5b57('0xf')](_0x5b57('0xc'),_0x5d223d,_0x49ce3a['error'][_0x5b57('0x11')]);return _0x5dd0c7(_0x49ce3a[_0x5b57('0xf')][_0x5b57('0x11')]);}else{logger['info'](_0x5b57('0xc'),_0x5d223d,_0x5b57('0xd'));_0x5dd0c7(_0x49ce3a[_0x5b57('0x12')][_0x5b57('0x11')]);}})[_0x5b57('0x13')](function(_0x1e7cc0){logger[_0x5b57('0xf')](_0x5b57('0xc'),_0x5d223d,_0x1e7cc0);_0x2f9789(_0x1e7cc0);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index bf6c682..8bcd5f4 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 _0xcf98=['/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index'];(function(_0x3949bb,_0x49fe77){var _0x3c9117=function(_0x9cb927){while(--_0x9cb927){_0x3949bb['push'](_0x3949bb['shift']());}};_0x3c9117(++_0x49fe77);}(_0xcf98,0x8d));var _0x8cf9=function(_0x5e716d,_0x429ca8){_0x5e716d=_0x5e716d-0x0;var _0x1e4c4b=_0xcf98[_0x5e716d];return _0x1e4c4b;};'use strict';var multer=require('multer');var util=require(_0x8cf9('0x0'));var path=require(_0x8cf9('0x1'));var timeout=require(_0x8cf9('0x2'));var express=require(_0x8cf9('0x3'));var router=express[_0x8cf9('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8cf9('0x5'));var config=require(_0x8cf9('0x6'));var controller=require(_0x8cf9('0x7'));router[_0x8cf9('0x8')]('/',auth[_0x8cf9('0x9')](),controller[_0x8cf9('0xa')]);router[_0x8cf9('0x8')](_0x8cf9('0xb'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0xc')]);router[_0x8cf9('0xd')]('/',auth['isAuthenticated'](),controller[_0x8cf9('0xe')]);router[_0x8cf9('0xf')]('/:id',auth[_0x8cf9('0x9')](),controller['update']);router[_0x8cf9('0x10')](_0x8cf9('0xb'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0x11')]);module[_0x8cf9('0x12')]=router; \ No newline at end of file +var _0xb5bf=['update','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x3f8743,_0x33973f){var _0x1f844c=function(_0x568841){while(--_0x568841){_0x3f8743['push'](_0x3f8743['shift']());}};_0x1f844c(++_0x33973f);}(_0xb5bf,0x1d7));var _0xfb5b=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xb5bf[_0x2235bf];return _0x4c3a64;};'use strict';var multer=require(_0xfb5b('0x0'));var util=require(_0xfb5b('0x1'));var path=require(_0xfb5b('0x2'));var timeout=require('connect-timeout');var express=require(_0xfb5b('0x3'));var router=express['Router']();var fs_extra=require(_0xfb5b('0x4'));var auth=require(_0xfb5b('0x5'));var interaction=require(_0xfb5b('0x6'));var config=require(_0xfb5b('0x7'));var controller=require(_0xfb5b('0x8'));router[_0xfb5b('0x9')]('/',auth['isAuthenticated'](),controller[_0xfb5b('0xa')]);router[_0xfb5b('0x9')](_0xfb5b('0xb'),auth[_0xfb5b('0xc')](),controller[_0xfb5b('0xd')]);router[_0xfb5b('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xfb5b('0xb'),auth['isAuthenticated'](),controller[_0xfb5b('0xf')]);router['delete']('/:id',auth[_0xfb5b('0xc')](),controller[_0xfb5b('0x10')]);module[_0xfb5b('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 344765f..c19e700 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 _0xf1f4=['STRING','exports','ENUM','localnet','externip','stun','turn'];(function(_0x3a9f3c,_0x419061){var _0x4959d4=function(_0x55a477){while(--_0x55a477){_0x3a9f3c['push'](_0x3a9f3c['shift']());}};_0x4959d4(++_0x419061);}(_0xf1f4,0x1c1));var _0x4f1f=function(_0x3d3a50,_0x12e2ec){_0x3d3a50=_0x3d3a50-0x0;var _0x55eee0=_0xf1f4[_0x3d3a50];return _0x55eee0;};'use strict';var Sequelize=require('sequelize');module[_0x4f1f('0x0')]={'type':{'type':Sequelize[_0x4f1f('0x1')](_0x4f1f('0x2'),_0x4f1f('0x3'),_0x4f1f('0x4'),_0x4f1f('0x5'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x4f1f('0x6')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x882f=['externip','stun','turn','STRING','sequelize','ENUM'];(function(_0x12966b,_0x30d9b9){var _0x5c7b4b=function(_0x4d6609){while(--_0x4d6609){_0x12966b['push'](_0x12966b['shift']());}};_0x5c7b4b(++_0x30d9b9);}(_0x882f,0xee));var _0xf882=function(_0x508acd,_0x852c77){_0x508acd=_0x508acd-0x0;var _0x4e8524=_0x882f[_0x508acd];return _0x4e8524;};'use strict';var Sequelize=require(_0xf882('0x0'));module['exports']={'type':{'type':Sequelize[_0xf882('0x1')]('localnet',_0xf882('0x2'),_0xf882('0x3'),_0xf882('0x4'))},'value':{'type':Sequelize[_0xf882('0x5')]},'username':{'type':Sequelize[_0xf882('0x5')]},'password':{'type':Sequelize[_0xf882('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 6968daa..cb58fd4 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 _0xf5bc=['server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','utf8','TURN','/etc/asterisk/turn_xcally.conf','util','path','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','sendStatus','stack','name','send','index','type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','Network','include','findAll','rows','show','params','rawAttributes','includeAll','find','create','body','toUpperCase','STUN','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','readFileSync','join'];(function(_0x32f436,_0x15b880){var _0x4e97b8=function(_0x3d9031){while(--_0x3d9031){_0x32f436['push'](_0x32f436['shift']());}};_0x4e97b8(++_0x15b880);}(_0xf5bc,0x1a8));var _0xcf5b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xf5bc[_0x3b380d];return _0x54502b;};'use strict';var util=require(_0xcf5b('0x0'));var path=require(_0xcf5b('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var qs=require(_0xcf5b('0x2'));var logger=require(_0xcf5b('0x3'))(_0xcf5b('0x4'));var config=require(_0xcf5b('0x5'));var db=require(_0xcf5b('0x6'))['db'];var jayson=require(_0xcf5b('0x7'));var client=jayson[_0xcf5b('0x8')][_0xcf5b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48fc58,_0x5db241,_0x34e3e8,_0x4b2590){return new Promise(function(_0x2fb2c7,_0x1dd1f8){var _0xaa368c=_0x4b2590||client;return _0xaa368c[_0xcf5b('0xa')](_0x48fc58,_0x34e3e8)[_0xcf5b('0xb')](function(_0x2fcae0){logger[_0xcf5b('0xc')](_0xcf5b('0xd'),_0x5db241,_0xcf5b('0xe'));logger['debug'](_0xcf5b('0xf'),_0x5db241,_0xcf5b('0xe'),JSON['stringify'](_0x2fcae0));if(_0x2fcae0[_0xcf5b('0x10')]){if(_0x2fcae0[_0xcf5b('0x10')][_0xcf5b('0x11')]===0x1f4){logger[_0xcf5b('0x10')]('Network,\x20%s,\x20%s',_0x5db241,_0x2fcae0['error']['message']);return _0x1dd1f8(_0x2fcae0[_0xcf5b('0x10')][_0xcf5b('0x12')]);}logger[_0xcf5b('0x10')]('Network,\x20%s,\x20%s',_0x5db241,_0x2fcae0['error'][_0xcf5b('0x12')]);return _0x2fb2c7(_0x2fcae0['error']['message']);}else{logger[_0xcf5b('0xc')]('Network,\x20%s,\x20%s',_0x5db241,_0xcf5b('0xe'));_0x2fb2c7(_0x2fcae0[_0xcf5b('0x13')][_0xcf5b('0x12')]);}})[_0xcf5b('0x14')](function(_0x41e00c){logger[_0xcf5b('0x10')](_0xcf5b('0xd'),_0x5db241,_0x41e00c);_0x1dd1f8(_0x41e00c);});});}function respondWithResult(_0x2ea638,_0x741e77){_0x741e77=_0x741e77||0xc8;return function(_0x3a2395){if(_0x3a2395){return _0x2ea638[_0xcf5b('0x15')](_0x741e77)['json'](_0x3a2395);}};}function respondWithFilteredResult(_0x151de1,_0xd2fe47){return function(_0x11c0f7){if(_0x11c0f7){var _0x20ff38=typeof _0xd2fe47[_0xcf5b('0x16')]===_0xcf5b('0x17')&&typeof _0xd2fe47[_0xcf5b('0x18')]==='undefined';var _0x4216b4=_0x11c0f7[_0xcf5b('0x19')];var _0xa109a1=_0x20ff38?0x0:_0xd2fe47[_0xcf5b('0x16')];var _0x361e38=_0x20ff38?_0x11c0f7[_0xcf5b('0x19')]:_0xd2fe47[_0xcf5b('0x16')]+_0xd2fe47[_0xcf5b('0x18')];var _0x70c123;if(_0x361e38>=_0x4216b4){_0x361e38=_0x4216b4;_0x70c123=0xc8;}else{_0x70c123=0xce;}_0x151de1[_0xcf5b('0x15')](_0x70c123);return _0x151de1[_0xcf5b('0x1a')](_0xcf5b('0x1b'),_0xa109a1+'-'+_0x361e38+'/'+_0x4216b4)[_0xcf5b('0x1c')](_0x11c0f7);}return null;};}function saveUpdates(_0x4b4ce8){return function(_0x5e5dae){if(_0x5e5dae){return _0x5e5dae[_0xcf5b('0x1d')](_0x4b4ce8)[_0xcf5b('0xb')](function(_0x176fd3){return _0x176fd3;});}return null;};}function removeEntity(_0x167364){return function(_0x47e579){if(_0x47e579){return _0x47e579[_0xcf5b('0x1e')]()[_0xcf5b('0xb')](function(){_0x167364[_0xcf5b('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23d893){return function(_0x5b8ff3){if(!_0x5b8ff3){_0x23d893[_0xcf5b('0x1f')](0x194);}return _0x5b8ff3;};}function handleError(_0x311066,_0xa25b0e){_0xa25b0e=_0xa25b0e||0x1f4;return function(_0x5e62ae){logger['error'](_0x5e62ae[_0xcf5b('0x20')]);if(_0x5e62ae[_0xcf5b('0x21')]){delete _0x5e62ae['name'];}_0x311066['status'](_0xa25b0e)[_0xcf5b('0x22')](_0x5e62ae);};}exports[_0xcf5b('0x23')]=function(_0x3005c9,_0x249743){var _0x5765a2={},_0x160b71={},_0x22dd9e={'count':0x0,'rows':[]};var _0x3cd056=_['map'](db['Network']['rawAttributes'],function(_0x3c363a){return{'name':_0x3c363a['fieldName'],'type':_0x3c363a[_0xcf5b('0x24')]['key']};});_0x160b71[_0xcf5b('0x25')]=_[_0xcf5b('0x26')](_0x3cd056,_0xcf5b('0x21'));_0x160b71['query']=_[_0xcf5b('0x27')](_0x3005c9[_0xcf5b('0x28')]);_0x160b71[_0xcf5b('0x29')]=_[_0xcf5b('0x2a')](_0x160b71[_0xcf5b('0x25')],_0x160b71[_0xcf5b('0x28')]);_0x5765a2['attributes']=_[_0xcf5b('0x2a')](_0x160b71[_0xcf5b('0x25')],qs[_0xcf5b('0x2b')](_0x3005c9[_0xcf5b('0x28')]['fields']));_0x5765a2[_0xcf5b('0x2c')]=_0x5765a2[_0xcf5b('0x2c')][_0xcf5b('0x2d')]?_0x5765a2[_0xcf5b('0x2c')]:_0x160b71['model'];if(!_0x3005c9['query'][_0xcf5b('0x2e')](_0xcf5b('0x2f'))){_0x5765a2[_0xcf5b('0x18')]=qs[_0xcf5b('0x18')](_0x3005c9[_0xcf5b('0x28')][_0xcf5b('0x18')]);_0x5765a2[_0xcf5b('0x16')]=qs[_0xcf5b('0x16')](_0x3005c9[_0xcf5b('0x28')][_0xcf5b('0x16')]);}_0x5765a2['order']=qs[_0xcf5b('0x30')](_0x3005c9[_0xcf5b('0x28')][_0xcf5b('0x30')]);_0x5765a2[_0xcf5b('0x31')]=qs[_0xcf5b('0x29')](_['pick'](_0x3005c9[_0xcf5b('0x28')],_0x160b71['filters']),_0x3cd056);if(_0x3005c9[_0xcf5b('0x28')][_0xcf5b('0x32')]){_0x5765a2[_0xcf5b('0x31')]=_['merge'](_0x5765a2['where'],{'$or':_['map'](_0x3cd056,function(_0x3225b1){if(_0x3225b1['type']!==_0xcf5b('0x33')){var _0x438798={};_0x438798[_0x3225b1[_0xcf5b('0x21')]]={'$like':'%'+_0x3005c9[_0xcf5b('0x28')][_0xcf5b('0x32')]+'%'};return _0x438798;}})});}_0x5765a2=_['merge']({},_0x5765a2,_0x3005c9['options']);var _0x51ef04={'where':_0x5765a2[_0xcf5b('0x31')]};return db[_0xcf5b('0x34')][_0xcf5b('0x19')](_0x51ef04)[_0xcf5b('0xb')](function(_0x346566){_0x22dd9e[_0xcf5b('0x19')]=_0x346566;if(_0x3005c9[_0xcf5b('0x28')]['includeAll']){_0x5765a2[_0xcf5b('0x35')]=[{'all':!![]}];}return db[_0xcf5b('0x34')][_0xcf5b('0x36')](_0x5765a2);})[_0xcf5b('0xb')](function(_0x1c8034){_0x22dd9e[_0xcf5b('0x37')]=_0x1c8034;return _0x22dd9e;})[_0xcf5b('0xb')](respondWithFilteredResult(_0x249743,_0x5765a2))[_0xcf5b('0x14')](handleError(_0x249743,null));};exports[_0xcf5b('0x38')]=function(_0x2243dc,_0x264713){var _0x1aac71={'raw':!![],'where':{'id':_0x2243dc[_0xcf5b('0x39')]['id']}},_0x253d94={};_0x253d94['model']=_['keys'](db[_0xcf5b('0x34')][_0xcf5b('0x3a')]);_0x253d94[_0xcf5b('0x28')]=_[_0xcf5b('0x27')](_0x2243dc['query']);_0x253d94[_0xcf5b('0x29')]=_[_0xcf5b('0x2a')](_0x253d94[_0xcf5b('0x25')],_0x253d94[_0xcf5b('0x28')]);_0x1aac71[_0xcf5b('0x2c')]=_[_0xcf5b('0x2a')](_0x253d94[_0xcf5b('0x25')],qs[_0xcf5b('0x2b')](_0x2243dc[_0xcf5b('0x28')]['fields']));_0x1aac71[_0xcf5b('0x2c')]=_0x1aac71['attributes'][_0xcf5b('0x2d')]?_0x1aac71[_0xcf5b('0x2c')]:_0x253d94[_0xcf5b('0x25')];if(_0x2243dc[_0xcf5b('0x28')][_0xcf5b('0x3b')]){_0x1aac71[_0xcf5b('0x35')]=[{'all':!![]}];}_0x1aac71=_['merge']({},_0x1aac71,_0x2243dc['options']);return db[_0xcf5b('0x34')][_0xcf5b('0x3c')](_0x1aac71)[_0xcf5b('0xb')](handleEntityNotFound(_0x264713,null))['then'](respondWithResult(_0x264713,null))['catch'](handleError(_0x264713,null));};exports[_0xcf5b('0x3d')]=function(_0x393f14,_0x967d20){var _0x3b29de;return db[_0xcf5b('0x34')][_0xcf5b('0x3d')](_0x393f14[_0xcf5b('0x3e')],{'raw':!![]})['then'](function(_0x444fc4){_0x3b29de=_0x444fc4;return db[_0xcf5b('0x34')][_0xcf5b('0x36')]({'where':{'type':_0x393f14['body']['type']},'raw':!![]});})[_0xcf5b('0xb')](function(_0x55d125){if(_0x3b29de[_0xcf5b('0x24')][_0xcf5b('0x3f')]()==_0xcf5b('0x40')){var _0x383f1d=fs['readFileSync'](path['join'](config[_0xcf5b('0x41')],_0xcf5b('0x42')),'utf8');var _0x5c75b4=ejs[_0xcf5b('0x43')](_0x383f1d,{'networks':_0x55d125||[]});fs[_0xcf5b('0x44')](_0xcf5b('0x45'),_0x5c75b4);return respondWithRpcPromise(_0xcf5b('0x46'),_0xcf5b('0x3d'),{'module':_0xcf5b('0x47')});}else if(_0x3b29de[_0xcf5b('0x24')][_0xcf5b('0x3f')]()=='TURN'){var _0x880a68=fs[_0xcf5b('0x48')](path[_0xcf5b('0x49')](config[_0xcf5b('0x41')],_0xcf5b('0x4a')),'utf8');var _0x155d28=ejs[_0xcf5b('0x43')](_0x880a68,{'networks':_0x55d125||[]});fs[_0xcf5b('0x44')]('/etc/asterisk/turn_xcally.conf',_0x155d28);return respondWithRpcPromise(_0xcf5b('0x46'),_0xcf5b('0x3d'),{'module':_0xcf5b('0x47')});}else{var _0xc2637=fs[_0xcf5b('0x48')](path[_0xcf5b('0x49')](config[_0xcf5b('0x41')],_0xcf5b('0x4b')),'utf8');var _0x308015=ejs[_0xcf5b('0x43')](_0xc2637,{'networks':_0x55d125||[]});fs[_0xcf5b('0x44')](util[_0xcf5b('0x4c')](_0xcf5b('0x4d'),_0x393f14[_0xcf5b('0x3e')][_0xcf5b('0x24')][_0xcf5b('0x4e')]()),_0x308015);return respondWithRpcPromise(_0xcf5b('0x46'),_0xcf5b('0x3d'),{'module':_0xcf5b('0x4f')});}})[_0xcf5b('0xb')](function(){return _0x3b29de;})['then'](respondWithResult(_0x967d20,0xc9))[_0xcf5b('0x14')](handleError(_0x967d20,null));};exports['update']=function(_0x509954,_0x55a2bf){var _0x514f83;return db[_0xcf5b('0x34')][_0xcf5b('0x3c')]({'where':{'id':_0x509954[_0xcf5b('0x39')]['id']}})['then'](handleEntityNotFound(_0x55a2bf,null))[_0xcf5b('0xb')](saveUpdates(_0x509954['body'],null))[_0xcf5b('0xb')](function(_0x2fa812){if(_0x2fa812){_0x514f83=_0x2fa812;return db['Network'][_0xcf5b('0x36')]({'where':{'type':_0x514f83[_0xcf5b('0x24')]},'raw':!![]});}return null;})[_0xcf5b('0xb')](function(_0x3e2275){if(_0x514f83[_0xcf5b('0x24')][_0xcf5b('0x3f')]()==_0xcf5b('0x40')){var _0x12cf0f=fs[_0xcf5b('0x48')](path[_0xcf5b('0x49')](config[_0xcf5b('0x41')],_0xcf5b('0x42')),_0xcf5b('0x50'));var _0x171817=ejs[_0xcf5b('0x43')](_0x12cf0f,{'networks':_0x3e2275||[]});fs['writeFileSync'](_0xcf5b('0x45'),_0x171817);return respondWithRpcPromise(_0xcf5b('0x46'),_0xcf5b('0x1d'),{'module':_0xcf5b('0x47')});}else if(_0x514f83[_0xcf5b('0x24')][_0xcf5b('0x3f')]()==_0xcf5b('0x51')){var _0x1f3c21=fs[_0xcf5b('0x48')](path['join'](config[_0xcf5b('0x41')],_0xcf5b('0x4a')),'utf8');var _0x5035bc=ejs[_0xcf5b('0x43')](_0x1f3c21,{'networks':_0x3e2275||[]});fs[_0xcf5b('0x44')](_0xcf5b('0x52'),_0x5035bc);return respondWithRpcPromise(_0xcf5b('0x46'),_0xcf5b('0x1d'),{'module':_0xcf5b('0x47')});}else{var _0x31080e=fs[_0xcf5b('0x48')](path[_0xcf5b('0x49')](config[_0xcf5b('0x41')],_0xcf5b('0x4b')),_0xcf5b('0x50'));var _0x409915=ejs[_0xcf5b('0x43')](_0x31080e,{'networks':_0x3e2275||[]});fs[_0xcf5b('0x44')](util['format'](_0xcf5b('0x4d'),_0x509954[_0xcf5b('0x3e')]['type'][_0xcf5b('0x4e')]()),_0x409915);return respondWithRpcPromise(_0xcf5b('0x46'),_0xcf5b('0x1d'),{'module':'chan_sip.so'});}})[_0xcf5b('0xb')](function(_0x4f436c){if(_0x4f436c){return _0x514f83;}return null;})[_0xcf5b('0xb')](respondWithResult(_0x55a2bf,null))[_0xcf5b('0x14')](handleError(_0x55a2bf,null));};exports['destroy']=function(_0x28deb3,_0x1baac1){var _0x3073f3;return db['Network'][_0xcf5b('0x3c')]({'where':{'id':_0x28deb3[_0xcf5b('0x39')]['id']}})['then'](function(_0x2ed7a6){_0x3073f3=_0x2ed7a6;return _0x2ed7a6;})['then'](handleEntityNotFound(_0x1baac1,null))['then'](removeEntity(_0x1baac1,null))[_0xcf5b('0xb')](function(){if(_0x3073f3){return db[_0xcf5b('0x34')]['findAll']({'where':{'type':_0x3073f3['type']},'raw':!![]});}})[_0xcf5b('0xb')](function(_0xbe4350){if(_0x3073f3[_0xcf5b('0x24')]['toUpperCase']()==_0xcf5b('0x40')){var _0x5993d0=fs['readFileSync'](path[_0xcf5b('0x49')](config['root'],_0xcf5b('0x42')),_0xcf5b('0x50'));var _0x421e68=ejs[_0xcf5b('0x43')](_0x5993d0,{'networks':_0xbe4350||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x421e68);return respondWithRpcPromise('Reload',_0xcf5b('0x1e'),{'module':_0xcf5b('0x47')});}else if(_0x3073f3[_0xcf5b('0x24')][_0xcf5b('0x3f')]()=='TURN'){var _0x60c7b4=fs[_0xcf5b('0x48')](path[_0xcf5b('0x49')](config[_0xcf5b('0x41')],'server/files/templates/turn_multiple.ejs'),_0xcf5b('0x50'));var _0x3b4146=ejs[_0xcf5b('0x43')](_0x60c7b4,{'networks':_0xbe4350||[]});fs[_0xcf5b('0x44')](_0xcf5b('0x52'),_0x3b4146);return respondWithRpcPromise(_0xcf5b('0x46'),_0xcf5b('0x1e'),{'module':_0xcf5b('0x47')});}else{var _0x5425b6=fs[_0xcf5b('0x48')](path[_0xcf5b('0x49')](config[_0xcf5b('0x41')],'server/files/templates/network.ejs'),'utf8');var _0x195a5b=ejs['render'](_0x5425b6,{'networks':_0xbe4350||[]});fs[_0xcf5b('0x44')](util[_0xcf5b('0x4c')](_0xcf5b('0x4d'),_0x3073f3[_0xcf5b('0x24')][_0xcf5b('0x4e')]()),_0x195a5b);return respondWithRpcPromise(_0xcf5b('0x46'),_0xcf5b('0x1e'),{'module':_0xcf5b('0x4f')});}})[_0xcf5b('0x14')](handleError(_0x1baac1,null));}; \ No newline at end of file +var _0x5ab2=['/etc/asterisk/stun_xcally.conf','lodash','../../components/parsers/qs','api','jayson/promise','client','http','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','offset','limit','undefined','count','set','Content-Range','json','update','destroy','end','stack','name','send','index','map','Network','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','findAll','then','rows','show','params','length','include','find','create','body','type','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','res_stun_monitor.so','TURN','readFileSync','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so'];(function(_0x309051,_0x8c0738){var _0x37f311=function(_0x1540e2){while(--_0x1540e2){_0x309051['push'](_0x309051['shift']());}};_0x37f311(++_0x8c0738);}(_0x5ab2,0x1ed));var _0x25ab=function(_0x23f624,_0x43bce3){_0x23f624=_0x23f624-0x0;var _0x4bf6f9=_0x5ab2[_0x23f624];return _0x4bf6f9;};'use strict';var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x25ab('0x0'));var qs=require(_0x25ab('0x1'));var logger=require('../../config/logger')(_0x25ab('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x25ab('0x3'));var client=jayson[_0x25ab('0x4')][_0x25ab('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x436d82,_0x41c00e,_0x366be5,_0x411d44){return new Promise(function(_0x31b2fd,_0x3be0cf){var _0xb90c7e=_0x411d44||client;return _0xb90c7e['request'](_0x436d82,_0x366be5)['then'](function(_0x4ed0a6){logger[_0x25ab('0x6')](_0x25ab('0x7'),_0x41c00e,'request\x20sent');logger[_0x25ab('0x8')](_0x25ab('0x9'),_0x41c00e,_0x25ab('0xa'),JSON[_0x25ab('0xb')](_0x4ed0a6));if(_0x4ed0a6[_0x25ab('0xc')]){if(_0x4ed0a6[_0x25ab('0xc')][_0x25ab('0xd')]===0x1f4){logger[_0x25ab('0xc')](_0x25ab('0x7'),_0x41c00e,_0x4ed0a6[_0x25ab('0xc')][_0x25ab('0xe')]);return _0x3be0cf(_0x4ed0a6[_0x25ab('0xc')][_0x25ab('0xe')]);}logger['error'](_0x25ab('0x7'),_0x41c00e,_0x4ed0a6[_0x25ab('0xc')]['message']);return _0x31b2fd(_0x4ed0a6[_0x25ab('0xc')][_0x25ab('0xe')]);}else{logger['info'](_0x25ab('0x7'),_0x41c00e,_0x25ab('0xa'));_0x31b2fd(_0x4ed0a6[_0x25ab('0xf')]['message']);}})[_0x25ab('0x10')](function(_0x126bb7){logger['error']('Network,\x20%s,\x20%s',_0x41c00e,_0x126bb7);_0x3be0cf(_0x126bb7);});});}function respondWithResult(_0x4d2929,_0x4b8101){_0x4b8101=_0x4b8101||0xc8;return function(_0x2ad2d6){if(_0x2ad2d6){return _0x4d2929[_0x25ab('0x11')](_0x4b8101)['json'](_0x2ad2d6);}};}function respondWithFilteredResult(_0x21d156,_0x4b95fd){return function(_0x1883be){if(_0x1883be){var _0x26d2d8=typeof _0x4b95fd[_0x25ab('0x12')]==='undefined'&&typeof _0x4b95fd[_0x25ab('0x13')]===_0x25ab('0x14');var _0x39dae1=_0x1883be[_0x25ab('0x15')];var _0x448ae8=_0x26d2d8?0x0:_0x4b95fd['offset'];var _0x2fca5f=_0x26d2d8?_0x1883be[_0x25ab('0x15')]:_0x4b95fd[_0x25ab('0x12')]+_0x4b95fd['limit'];var _0x1f629f;if(_0x2fca5f>=_0x39dae1){_0x2fca5f=_0x39dae1;_0x1f629f=0xc8;}else{_0x1f629f=0xce;}_0x21d156['status'](_0x1f629f);return _0x21d156[_0x25ab('0x16')](_0x25ab('0x17'),_0x448ae8+'-'+_0x2fca5f+'/'+_0x39dae1)[_0x25ab('0x18')](_0x1883be);}return null;};}function saveUpdates(_0x5d070f){return function(_0x540a11){if(_0x540a11){return _0x540a11[_0x25ab('0x19')](_0x5d070f)['then'](function(_0x1286c6){return _0x1286c6;});}return null;};}function removeEntity(_0x4c4887){return function(_0xa42724){if(_0xa42724){return _0xa42724[_0x25ab('0x1a')]()['then'](function(){_0x4c4887[_0x25ab('0x11')](0xcc)[_0x25ab('0x1b')]();});}};}function handleEntityNotFound(_0x1a343c){return function(_0x32ba1d){if(!_0x32ba1d){_0x1a343c['sendStatus'](0x194);}return _0x32ba1d;};}function handleError(_0x2f95c3,_0x2d6430){_0x2d6430=_0x2d6430||0x1f4;return function(_0x218171){logger[_0x25ab('0xc')](_0x218171[_0x25ab('0x1c')]);if(_0x218171[_0x25ab('0x1d')]){delete _0x218171[_0x25ab('0x1d')];}_0x2f95c3[_0x25ab('0x11')](_0x2d6430)[_0x25ab('0x1e')](_0x218171);};}exports[_0x25ab('0x1f')]=function(_0x3f3471,_0x39c2fc){var _0x18cd36={},_0x1a9597={},_0x4ee8fe={'count':0x0,'rows':[]};var _0x2e72d2=_[_0x25ab('0x20')](db[_0x25ab('0x21')][_0x25ab('0x22')],function(_0x14347d){return{'name':_0x14347d['fieldName'],'type':_0x14347d['type'][_0x25ab('0x23')]};});_0x1a9597[_0x25ab('0x24')]=_[_0x25ab('0x20')](_0x2e72d2,_0x25ab('0x1d'));_0x1a9597[_0x25ab('0x25')]=_[_0x25ab('0x26')](_0x3f3471[_0x25ab('0x25')]);_0x1a9597[_0x25ab('0x27')]=_[_0x25ab('0x28')](_0x1a9597['model'],_0x1a9597[_0x25ab('0x25')]);_0x18cd36['attributes']=_[_0x25ab('0x28')](_0x1a9597[_0x25ab('0x24')],qs[_0x25ab('0x29')](_0x3f3471[_0x25ab('0x25')][_0x25ab('0x29')]));_0x18cd36[_0x25ab('0x2a')]=_0x18cd36[_0x25ab('0x2a')]['length']?_0x18cd36[_0x25ab('0x2a')]:_0x1a9597[_0x25ab('0x24')];if(!_0x3f3471[_0x25ab('0x25')]['hasOwnProperty'](_0x25ab('0x2b'))){_0x18cd36['limit']=qs[_0x25ab('0x13')](_0x3f3471['query']['limit']);_0x18cd36[_0x25ab('0x12')]=qs[_0x25ab('0x12')](_0x3f3471[_0x25ab('0x25')]['offset']);}_0x18cd36['order']=qs[_0x25ab('0x2c')](_0x3f3471[_0x25ab('0x25')][_0x25ab('0x2c')]);_0x18cd36['where']=qs[_0x25ab('0x27')](_[_0x25ab('0x2d')](_0x3f3471[_0x25ab('0x25')],_0x1a9597[_0x25ab('0x27')]),_0x2e72d2);if(_0x3f3471['query']['filter']){_0x18cd36[_0x25ab('0x2e')]=_[_0x25ab('0x2f')](_0x18cd36[_0x25ab('0x2e')],{'$or':_[_0x25ab('0x20')](_0x2e72d2,function(_0x4f7dd9){if(_0x4f7dd9['type']!==_0x25ab('0x30')){var _0x1acbd0={};_0x1acbd0[_0x4f7dd9[_0x25ab('0x1d')]]={'$like':'%'+_0x3f3471[_0x25ab('0x25')][_0x25ab('0x31')]+'%'};return _0x1acbd0;}})});}_0x18cd36=_[_0x25ab('0x2f')]({},_0x18cd36,_0x3f3471[_0x25ab('0x32')]);var _0x24b19f={'where':_0x18cd36[_0x25ab('0x2e')]};return db['Network'][_0x25ab('0x15')](_0x24b19f)['then'](function(_0x31e959){_0x4ee8fe['count']=_0x31e959;if(_0x3f3471[_0x25ab('0x25')]['includeAll']){_0x18cd36['include']=[{'all':!![]}];}return db['Network'][_0x25ab('0x33')](_0x18cd36);})[_0x25ab('0x34')](function(_0x308ea2){_0x4ee8fe[_0x25ab('0x35')]=_0x308ea2;return _0x4ee8fe;})[_0x25ab('0x34')](respondWithFilteredResult(_0x39c2fc,_0x18cd36))[_0x25ab('0x10')](handleError(_0x39c2fc,null));};exports[_0x25ab('0x36')]=function(_0x201218,_0x194b8b){var _0x329741={'raw':!![],'where':{'id':_0x201218[_0x25ab('0x37')]['id']}},_0x1af5a2={};_0x1af5a2['model']=_[_0x25ab('0x26')](db[_0x25ab('0x21')][_0x25ab('0x22')]);_0x1af5a2[_0x25ab('0x25')]=_[_0x25ab('0x26')](_0x201218[_0x25ab('0x25')]);_0x1af5a2['filters']=_[_0x25ab('0x28')](_0x1af5a2[_0x25ab('0x24')],_0x1af5a2[_0x25ab('0x25')]);_0x329741[_0x25ab('0x2a')]=_['intersection'](_0x1af5a2[_0x25ab('0x24')],qs['fields'](_0x201218[_0x25ab('0x25')][_0x25ab('0x29')]));_0x329741['attributes']=_0x329741[_0x25ab('0x2a')][_0x25ab('0x38')]?_0x329741[_0x25ab('0x2a')]:_0x1af5a2[_0x25ab('0x24')];if(_0x201218['query']['includeAll']){_0x329741[_0x25ab('0x39')]=[{'all':!![]}];}_0x329741=_[_0x25ab('0x2f')]({},_0x329741,_0x201218[_0x25ab('0x32')]);return db[_0x25ab('0x21')][_0x25ab('0x3a')](_0x329741)[_0x25ab('0x34')](handleEntityNotFound(_0x194b8b,null))[_0x25ab('0x34')](respondWithResult(_0x194b8b,null))[_0x25ab('0x10')](handleError(_0x194b8b,null));};exports[_0x25ab('0x3b')]=function(_0x9a360b,_0x2abd29){var _0x4757b7;return db[_0x25ab('0x21')]['create'](_0x9a360b[_0x25ab('0x3c')],{'raw':!![]})['then'](function(_0x16da21){_0x4757b7=_0x16da21;return db[_0x25ab('0x21')][_0x25ab('0x33')]({'where':{'type':_0x9a360b[_0x25ab('0x3c')][_0x25ab('0x3d')]},'raw':!![]});})[_0x25ab('0x34')](function(_0x4a20b7){if(_0x4757b7[_0x25ab('0x3d')][_0x25ab('0x3e')]()==_0x25ab('0x3f')){var _0x45dad4=fs['readFileSync'](path[_0x25ab('0x40')](config[_0x25ab('0x41')],_0x25ab('0x42')),_0x25ab('0x43'));var _0x15fd73=ejs['render'](_0x45dad4,{'networks':_0x4a20b7||[]});fs[_0x25ab('0x44')]('/etc/asterisk/stun_xcally.conf',_0x15fd73);return respondWithRpcPromise('Reload',_0x25ab('0x3b'),{'module':_0x25ab('0x45')});}else if(_0x4757b7[_0x25ab('0x3d')][_0x25ab('0x3e')]()==_0x25ab('0x46')){var _0x16f8e6=fs[_0x25ab('0x47')](path[_0x25ab('0x40')](config['root'],_0x25ab('0x48')),_0x25ab('0x43'));var _0x5a62a6=ejs[_0x25ab('0x49')](_0x16f8e6,{'networks':_0x4a20b7||[]});fs[_0x25ab('0x44')](_0x25ab('0x4a'),_0x5a62a6);return respondWithRpcPromise(_0x25ab('0x4b'),_0x25ab('0x3b'),{'module':'res_stun_monitor.so'});}else{var _0x47cc9b=fs[_0x25ab('0x47')](path[_0x25ab('0x40')](config[_0x25ab('0x41')],_0x25ab('0x4c')),'utf8');var _0x4728eb=ejs[_0x25ab('0x49')](_0x47cc9b,{'networks':_0x4a20b7||[]});fs[_0x25ab('0x44')](util[_0x25ab('0x4d')](_0x25ab('0x4e'),_0x9a360b[_0x25ab('0x3c')]['type'][_0x25ab('0x4f')]()),_0x4728eb);return respondWithRpcPromise('Reload','create',{'module':_0x25ab('0x50')});}})[_0x25ab('0x34')](function(){return _0x4757b7;})[_0x25ab('0x34')](respondWithResult(_0x2abd29,0xc9))[_0x25ab('0x10')](handleError(_0x2abd29,null));};exports[_0x25ab('0x19')]=function(_0x34500d,_0x17fbcd){var _0x5ba929;return db['Network']['find']({'where':{'id':_0x34500d[_0x25ab('0x37')]['id']}})['then'](handleEntityNotFound(_0x17fbcd,null))[_0x25ab('0x34')](saveUpdates(_0x34500d[_0x25ab('0x3c')],null))[_0x25ab('0x34')](function(_0x33cf16){if(_0x33cf16){_0x5ba929=_0x33cf16;return db['Network']['findAll']({'where':{'type':_0x5ba929[_0x25ab('0x3d')]},'raw':!![]});}return null;})[_0x25ab('0x34')](function(_0x311e2e){if(_0x5ba929['type'][_0x25ab('0x3e')]()=='STUN'){var _0x37bbcd=fs[_0x25ab('0x47')](path[_0x25ab('0x40')](config[_0x25ab('0x41')],_0x25ab('0x42')),_0x25ab('0x43'));var _0x4c99ac=ejs[_0x25ab('0x49')](_0x37bbcd,{'networks':_0x311e2e||[]});fs['writeFileSync'](_0x25ab('0x51'),_0x4c99ac);return respondWithRpcPromise(_0x25ab('0x4b'),_0x25ab('0x19'),{'module':_0x25ab('0x45')});}else if(_0x5ba929[_0x25ab('0x3d')]['toUpperCase']()==_0x25ab('0x46')){var _0x343dfe=fs[_0x25ab('0x47')](path[_0x25ab('0x40')](config[_0x25ab('0x41')],_0x25ab('0x48')),_0x25ab('0x43'));var _0x4a4513=ejs[_0x25ab('0x49')](_0x343dfe,{'networks':_0x311e2e||[]});fs[_0x25ab('0x44')](_0x25ab('0x4a'),_0x4a4513);return respondWithRpcPromise(_0x25ab('0x4b'),_0x25ab('0x19'),{'module':'res_stun_monitor.so'});}else{var _0xaa9a82=fs[_0x25ab('0x47')](path[_0x25ab('0x40')](config[_0x25ab('0x41')],_0x25ab('0x4c')),_0x25ab('0x43'));var _0x1506b8=ejs[_0x25ab('0x49')](_0xaa9a82,{'networks':_0x311e2e||[]});fs[_0x25ab('0x44')](util[_0x25ab('0x4d')](_0x25ab('0x4e'),_0x34500d['body'][_0x25ab('0x3d')][_0x25ab('0x4f')]()),_0x1506b8);return respondWithRpcPromise(_0x25ab('0x4b'),_0x25ab('0x19'),{'module':_0x25ab('0x50')});}})[_0x25ab('0x34')](function(_0x1f710d){if(_0x1f710d){return _0x5ba929;}return null;})[_0x25ab('0x34')](respondWithResult(_0x17fbcd,null))[_0x25ab('0x10')](handleError(_0x17fbcd,null));};exports[_0x25ab('0x1a')]=function(_0x7f876f,_0x33d9d0){var _0x2c4e8c;return db[_0x25ab('0x21')][_0x25ab('0x3a')]({'where':{'id':_0x7f876f['params']['id']}})['then'](function(_0x89aa6){_0x2c4e8c=_0x89aa6;return _0x89aa6;})[_0x25ab('0x34')](handleEntityNotFound(_0x33d9d0,null))[_0x25ab('0x34')](removeEntity(_0x33d9d0,null))[_0x25ab('0x34')](function(){if(_0x2c4e8c){return db['Network'][_0x25ab('0x33')]({'where':{'type':_0x2c4e8c[_0x25ab('0x3d')]},'raw':!![]});}})['then'](function(_0x5475ff){if(_0x2c4e8c[_0x25ab('0x3d')]['toUpperCase']()==_0x25ab('0x3f')){var _0x588e01=fs['readFileSync'](path[_0x25ab('0x40')](config[_0x25ab('0x41')],_0x25ab('0x42')),_0x25ab('0x43'));var _0x286eee=ejs[_0x25ab('0x49')](_0x588e01,{'networks':_0x5475ff||[]});fs[_0x25ab('0x44')](_0x25ab('0x51'),_0x286eee);return respondWithRpcPromise(_0x25ab('0x4b'),_0x25ab('0x1a'),{'module':'res_stun_monitor.so'});}else if(_0x2c4e8c[_0x25ab('0x3d')][_0x25ab('0x3e')]()==_0x25ab('0x46')){var _0x33f97b=fs['readFileSync'](path[_0x25ab('0x40')](config[_0x25ab('0x41')],_0x25ab('0x48')),_0x25ab('0x43'));var _0x3d668a=ejs[_0x25ab('0x49')](_0x33f97b,{'networks':_0x5475ff||[]});fs[_0x25ab('0x44')](_0x25ab('0x4a'),_0x3d668a);return respondWithRpcPromise('Reload',_0x25ab('0x1a'),{'module':'res_stun_monitor.so'});}else{var _0x453f77=fs[_0x25ab('0x47')](path[_0x25ab('0x40')](config[_0x25ab('0x41')],_0x25ab('0x4c')),'utf8');var _0x96e00=ejs['render'](_0x453f77,{'networks':_0x5475ff||[]});fs['writeFileSync'](util[_0x25ab('0x4d')]('/etc/asterisk/sip_xcally_%s.conf',_0x2c4e8c[_0x25ab('0x3d')][_0x25ab('0x4f')]()),_0x96e00);return respondWithRpcPromise(_0x25ab('0x4b'),_0x25ab('0x1a'),{'module':'chan_sip.so'});}})[_0x25ab('0x10')](handleError(_0x33d9d0,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index a5c6522..5ab3f2b 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 _0xd547=['define','../../config/logger','api','moment','bluebird','rimraf','./network.attributes'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xd547,0x1c1));var _0x7d54=function(_0x47f395,_0x18a997){_0x47f395=_0x47f395-0x0;var _0x577a61=_0xd547[_0x47f395];return _0x577a61;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7d54('0x0'))(_0x7d54('0x1'));var moment=require(_0x7d54('0x2'));var BPromise=require(_0x7d54('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7d54('0x4'));var config=require('../../config/environment');var attributes=require(_0x7d54('0x5'));module['exports']=function(_0x296dd6,_0x37defc){return _0x296dd6[_0x7d54('0x6')]('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd87e=['moment','bluebird','path','../../config/environment','./network.attributes','Network','network','lodash','util','api'];(function(_0x9212a2,_0x241265){var _0x514fb8=function(_0x63c840){while(--_0x63c840){_0x9212a2['push'](_0x9212a2['shift']());}};_0x514fb8(++_0x241265);}(_0xd87e,0x1bf));var _0xed87=function(_0x3b64ae,_0x2c4e93){_0x3b64ae=_0x3b64ae-0x0;var _0x1506b8=_0xd87e[_0x3b64ae];return _0x1506b8;};'use strict';var _=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var logger=require('../../config/logger')(_0xed87('0x2'));var moment=require(_0xed87('0x3'));var BPromise=require(_0xed87('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed87('0x5'));var rimraf=require('rimraf');var config=require(_0xed87('0x6'));var attributes=require(_0xed87('0x7'));module['exports']=function(_0x17adfe,_0x589fb9){return _0x17adfe['define'](_0xed87('0x8'),attributes,{'tableName':_0xed87('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 06457cd..a56afb5 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2b26cc,_0xa807f8){var _0x1c2e98=function(_0x4724c1){while(--_0x4724c1){_0x2b26cc['push'](_0x2b26cc['shift']());}};_0x1c2e98(++_0xa807f8);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x4f60d9,_0x3da5dc){_0x4f60d9=_0x4f60d9-0x0;var _0x5f99a0=_0x7a54[_0x4f60d9];return _0x5f99a0;};'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 5e9e23e..302d5ac 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 _0x3de3=['send','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/users','getAgents','post','create','addDisposition','addAnswer','notify','addApplications','addAgents','/:id/send'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3de3,0x1ce));var _0x33de=function(_0xedcb82,_0x1c4ccd){_0xedcb82=_0xedcb82-0x0;var _0x530e1d=_0x3de3[_0xedcb82];return _0x530e1d;};'use strict';var multer=require(_0x33de('0x0'));var util=require('util');var path=require(_0x33de('0x1'));var timeout=require(_0x33de('0x2'));var express=require('express');var router=express[_0x33de('0x3')]();var fs_extra=require(_0x33de('0x4'));var auth=require(_0x33de('0x5'));var interaction=require(_0x33de('0x6'));var config=require('../../config/environment');var controller=require(_0x33de('0x7'));router[_0x33de('0x8')]('/',auth['isAuthenticated'](),controller[_0x33de('0x9')]);router['get'](_0x33de('0xa'),auth[_0x33de('0xb')](),controller[_0x33de('0xc')]);router['get'](_0x33de('0xd'),auth[_0x33de('0xb')](),controller[_0x33de('0xe')]);router['get'](_0x33de('0xf'),auth[_0x33de('0xb')](),controller[_0x33de('0x10')]);router[_0x33de('0x8')](_0x33de('0x11'),auth[_0x33de('0xb')](),controller[_0x33de('0x12')]);router[_0x33de('0x8')](_0x33de('0x13'),auth[_0x33de('0xb')](),controller[_0x33de('0x14')]);router['get'](_0x33de('0x15'),auth[_0x33de('0xb')](),controller['getInteractions']);router['get'](_0x33de('0x16'),auth[_0x33de('0xb')](),controller[_0x33de('0x17')]);router[_0x33de('0x18')]('/',auth['isAuthenticated'](),controller[_0x33de('0x19')]);router[_0x33de('0x18')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x33de('0x1a')]);router[_0x33de('0x18')](_0x33de('0x11'),auth['isAuthenticated'](),controller[_0x33de('0x1b')]);router[_0x33de('0x18')]('/:id/notify',controller[_0x33de('0x1c')]);router[_0x33de('0x18')]('/:id/applications',auth['isAuthenticated'](),controller[_0x33de('0x1d')]);router['post'](_0x33de('0x16'),auth[_0x33de('0xb')](),controller[_0x33de('0x1e')]);router[_0x33de('0x18')](_0x33de('0x1f'),auth[_0x33de('0xb')](),controller[_0x33de('0x20')]);router['put']('/:id',auth[_0x33de('0xb')](),controller['update']);router[_0x33de('0x21')]('/:id',auth[_0x33de('0xb')](),controller[_0x33de('0x22')]);router['delete'](_0x33de('0xf'),auth['isAuthenticated'](),controller[_0x33de('0x23')]);router['delete'](_0x33de('0x11'),auth[_0x33de('0xb')](),controller[_0x33de('0x24')]);router['delete'](_0x33de('0x16'),auth[_0x33de('0xb')](),controller[_0x33de('0x25')]);module['exports']=router; \ No newline at end of file +var _0xd7d1=['update','destroy','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getAnswers','/:id/applications','getApplications','getInteractions','getAgents','post','create','/:id/canned_answers','addAnswer','notify','addApplications','/:id/users','addAgents','send','put'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0xa49f66,_0x160622){_0xa49f66=_0xa49f66-0x0;var _0x568ccf=_0xd7d1[_0xa49f66];return _0x568ccf;};'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('0xb')](_0x1d7d('0xf'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x10')]);router[_0x1d7d('0xb')](_0x1d7d('0x11'),auth[_0x1d7d('0xc')](),controller['getDispositions']);router[_0x1d7d('0xb')]('/:id/canned_answers',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x12')]);router[_0x1d7d('0xb')](_0x1d7d('0x13'),auth['isAuthenticated'](),controller[_0x1d7d('0x14')]);router['get']('/:id/interactions',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x15')]);router['get']('/:id/users',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x16')]);router[_0x1d7d('0x17')]('/',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x18')]);router['post'](_0x1d7d('0x11'),auth[_0x1d7d('0xc')](),controller['addDisposition']);router[_0x1d7d('0x17')](_0x1d7d('0x19'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x1a')]);router[_0x1d7d('0x17')]('/:id/notify',controller[_0x1d7d('0x1b')]);router[_0x1d7d('0x17')]('/:id/applications',auth['isAuthenticated'](),controller[_0x1d7d('0x1c')]);router[_0x1d7d('0x17')](_0x1d7d('0x1d'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x1e')]);router[_0x1d7d('0x17')]('/:id/send',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x1f')]);router[_0x1d7d('0x20')]('/:id',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x21')]);router['delete']('/:id',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x22')]);router[_0x1d7d('0x23')]('/:id/dispositions',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x24')]);router[_0x1d7d('0x23')](_0x1d7d('0x19'),auth['isAuthenticated'](),controller[_0x1d7d('0x25')]);router[_0x1d7d('0x23')]('/:id/users',auth['isAuthenticated'](),controller[_0x1d7d('0x26')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 41f1e75..74fa974 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 _0x4405=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x1c9133,_0x507c33){var _0x5e3bff=function(_0x4b2de0){while(--_0x4b2de0){_0x1c9133['push'](_0x1c9133['shift']());}};_0x5e3bff(++_0x507c33);}(_0x4405,0x16e));var _0x5440=function(_0x20dae8,_0x14d4a9){_0x20dae8=_0x20dae8-0x0;var _0x1b7b0a=_0x4405[_0x20dae8];return _0x1b7b0a;};'use strict';var Sequelize=require(_0x5440('0x0'));var rs=require(_0x5440('0x1'));module[_0x5440('0x2')]={'name':{'type':Sequelize[_0x5440('0x3')],'unique':_0x5440('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x5440('0x3')]},'token':{'type':Sequelize[_0x5440('0x3')],'defaultValue':function(){return rs[_0x5440('0x5')]();}},'replyUri':{'type':Sequelize[_0x5440('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x5440('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5440('0x6')],'defaultValue':function(){return _0x5440('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5440('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5440('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5440('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x5440('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5440('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5440('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x5440('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x5440('0x8')],'defaultValue':![],'comment':_0x5440('0xb'),'set':function(_0x1db9b4){if(!_0x1db9b4)this['setDataValue'](_0x5440('0xc'),null);this[_0x5440('0xd')](_0x5440('0xe'),_0x1db9b4);}}}; \ No newline at end of file +var _0x8342=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','name','STRING'];(function(_0x4da034,_0x1d3b8e){var _0xe3577d=function(_0x58f825){while(--_0x58f825){_0x4da034['push'](_0x4da034['shift']());}};_0xe3577d(++_0x1d3b8e);}(_0x8342,0x1d0));var _0x2834=function(_0x290b68,_0x1f82af){_0x290b68=_0x290b68-0x0;var _0x2f23af=_0x8342[_0x290b68];return _0x2f23af;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x2834('0x0'));module[_0x2834('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2834('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x2834('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x2834('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x2834('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2834('0x4')],'defaultValue':function(){return _0x2834('0x5');}},'notificationSound':{'type':Sequelize[_0x2834('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2834('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2834('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x2834('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2834('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2834('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2834('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2834('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x2834('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4c0bf3){if(!_0x4c0bf3)this[_0x2834('0x9')](_0x2834('0xa'),null);this[_0x2834('0x9')](_0x2834('0xb'),_0x4c0bf3);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 6e20140..c832958 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 _0x2a76=['bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','User','Owner','fullname','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','body\x20is\x20mandatory\x20and\x20not\x20empty','DESC','ListId','user','out','Messages','push','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','destroy','get','OpenchannelAccounts','UserProfileResource','end','sendStatus','stack','name','send','index','Pause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','getDispositions','length','order','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','openchannel','CmContact','Sequelize','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','ValidationError','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','OpenchannelApplication','Applications','account','applications','list','Contacts','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','update','interaction','created','autoclose','OpenchannelMessage','AttachmentId','UserId','unshift','agent','*,*,*,*','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne'];(function(_0x1eef8b,_0x1f8ab9){var _0x3c3368=function(_0x4f71b1){while(--_0x4f71b1){_0x1eef8b['push'](_0x1eef8b['shift']());}};_0x3c3368(++_0x1f8ab9);}(_0x2a76,0xde));var _0x62a7=function(_0x552f5d,_0x52cf3d){_0x552f5d=_0x552f5d-0x0;var _0x187dde=_0x2a76[_0x552f5d];return _0x187dde;};'use strict';var emlformat=require(_0x62a7('0x0'));var rimraf=require(_0x62a7('0x1'));var zipdir=require(_0x62a7('0x2'));var jsonpatch=require(_0x62a7('0x3'));var rp=require(_0x62a7('0x4'));var moment=require(_0x62a7('0x5'));var BPromise=require(_0x62a7('0x6'));var Mustache=require(_0x62a7('0x7'));var util=require(_0x62a7('0x8'));var path=require(_0x62a7('0x9'));var sox=require(_0x62a7('0xa'));var csv=require('to-csv');var ejs=require(_0x62a7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x62a7('0xc'));var squel=require(_0x62a7('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x62a7('0xe'));var toCsv=require(_0x62a7('0xf'));var querystring=require(_0x62a7('0x10'));var Papa=require('papaparse');var Redis=require(_0x62a7('0x11'));var authService=require(_0x62a7('0x12'));var qs=require(_0x62a7('0x13'));var as=require(_0x62a7('0x14'));var hardwareService=require(_0x62a7('0x15'));var logger=require(_0x62a7('0x16'))(_0x62a7('0x17'));var utils=require('../../config/utils');var config=require(_0x62a7('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x62a7('0x19'))['db'];config[_0x62a7('0x1a')]=_[_0x62a7('0x1b')](config['redis'],{'host':_0x62a7('0x1c'),'port':0x18eb});var socket=require(_0x62a7('0x1d'))(new Redis(config[_0x62a7('0x1a')]));require('./openchannelAccount.socket')[_0x62a7('0x1e')](socket);var jayson=require(_0x62a7('0x1f'));var client=jayson[_0x62a7('0x20')]['http']({'port':0x232c});var client9002=jayson[_0x62a7('0x20')][_0x62a7('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x54b57e,_0x2d9e5a,_0x511e5b,_0xe57f10){return new BPromise(function(_0x27d115,_0xe30f11){var _0x1cf901=_0xe57f10||client;return _0x1cf901[_0x62a7('0x22')](_0x54b57e,_0x511e5b)[_0x62a7('0x23')](function(_0x3d9951){logger[_0x62a7('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x2d9e5a,_0x62a7('0x25'));logger[_0x62a7('0x26')](_0x62a7('0x27'),_0x2d9e5a,'request\x20sent',JSON[_0x62a7('0x28')](_0x3d9951));if(_0x3d9951[_0x62a7('0x29')]){if(_0x3d9951[_0x62a7('0x29')][_0x62a7('0x2a')]===0x1f4){logger[_0x62a7('0x29')](_0x62a7('0x2b'),_0x2d9e5a,_0x3d9951[_0x62a7('0x29')][_0x62a7('0x2c')]);return _0xe30f11(_0x3d9951[_0x62a7('0x29')][_0x62a7('0x2c')]);}logger[_0x62a7('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x2d9e5a,_0x3d9951[_0x62a7('0x29')][_0x62a7('0x2c')]);return _0x27d115(_0x3d9951['error']['message']);}else{logger[_0x62a7('0x24')](_0x62a7('0x2b'),_0x2d9e5a,_0x62a7('0x25'));_0x27d115(_0x3d9951[_0x62a7('0x2d')][_0x62a7('0x2c')]);}})[_0x62a7('0x2e')](function(_0x1f7587){logger[_0x62a7('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x2d9e5a,_0x1f7587);_0xe30f11(_0x1f7587);});});}function respondWithStatusCode(_0x46c498,_0x35814f){_0x35814f=_0x35814f||0xcc;return function(_0x47a15a){if(_0x47a15a){return _0x46c498['sendStatus'](_0x35814f);}return _0x46c498['status'](_0x35814f)['end']();};}function respondWithResult(_0x2c19a1,_0x5eec07){_0x5eec07=_0x5eec07||0xc8;return function(_0x6e5dba){if(_0x6e5dba){return _0x2c19a1[_0x62a7('0x2f')](_0x5eec07)[_0x62a7('0x30')](_0x6e5dba);}};}function respondWithFilteredResult(_0x2e6ed7,_0x153d22){return function(_0x42a918){if(_0x42a918){var _0x5ed431=typeof _0x153d22[_0x62a7('0x31')]==='undefined'&&typeof _0x153d22[_0x62a7('0x32')]===_0x62a7('0x33');var _0x55f3c2=_0x42a918[_0x62a7('0x34')];var _0x176618=_0x5ed431?0x0:_0x153d22[_0x62a7('0x31')];var _0xfac823=_0x5ed431?_0x42a918[_0x62a7('0x34')]:_0x153d22[_0x62a7('0x31')]+_0x153d22['limit'];var _0xeac066;if(_0xfac823>=_0x55f3c2){_0xfac823=_0x55f3c2;_0xeac066=0xc8;}else{_0xeac066=0xce;}_0x2e6ed7['status'](_0xeac066);return _0x2e6ed7[_0x62a7('0x35')](_0x62a7('0x36'),_0x176618+'-'+_0xfac823+'/'+_0x55f3c2)[_0x62a7('0x30')](_0x42a918);}return null;};}function patchUpdates(_0xe1ba48){return function(_0x520222){try{jsonpatch['apply'](_0x520222,_0xe1ba48,!![]);}catch(_0x5b0c5f){return BPromise[_0x62a7('0x37')](_0x5b0c5f);}return _0x520222[_0x62a7('0x38')]();};}function saveUpdates(_0x173760,_0x3a808a){return function(_0x1ea81d){if(_0x1ea81d){return _0x1ea81d['update'](_0x173760)[_0x62a7('0x23')](function(_0x417542){return _0x417542;});}return null;};}function removeEntity(_0x29ff17,_0xb4e397){return function(_0x70d9b5){if(_0x70d9b5){return _0x70d9b5[_0x62a7('0x39')]()[_0x62a7('0x23')](function(){var _0x373d61=_0x70d9b5[_0x62a7('0x3a')]({'plain':!![]});var _0x98185=_0x62a7('0x3b');return db[_0x62a7('0x3c')]['destroy']({'where':{'type':_0x98185,'resourceId':_0x373d61['id']}})['then'](function(){return _0x70d9b5;});})['then'](function(){_0x29ff17[_0x62a7('0x2f')](0xcc)[_0x62a7('0x3d')]();});}};}function handleEntityNotFound(_0x2cdbec,_0x295c9a){return function(_0x1da97a){if(!_0x1da97a){_0x2cdbec[_0x62a7('0x3e')](0x194);}return _0x1da97a;};}function handleError(_0x5c5abe,_0x2a9e5b){_0x2a9e5b=_0x2a9e5b||0x1f4;return function(_0x19d715){logger[_0x62a7('0x29')](_0x19d715[_0x62a7('0x3f')]);if(_0x19d715['name']){delete _0x19d715[_0x62a7('0x40')];}_0x5c5abe[_0x62a7('0x2f')](_0x2a9e5b)[_0x62a7('0x41')](_0x19d715);};}exports[_0x62a7('0x42')]=function(_0x41488f,_0x3cc287){var _0x1a9ddd={'include':[{'model':db[_0x62a7('0x43')],'as':'mandatoryDispositionPause'}]},_0x509a55={},_0x43fc56={'count':0x0,'rows':[]};var _0xf1114c=_[_0x62a7('0x44')](db[_0x62a7('0x45')][_0x62a7('0x46')],function(_0x537eaa){return{'name':_0x537eaa[_0x62a7('0x47')],'type':_0x537eaa[_0x62a7('0x48')]['key']};});_0x509a55[_0x62a7('0x49')]=_[_0x62a7('0x44')](_0xf1114c,_0x62a7('0x40'));_0x509a55['query']=_['keys'](_0x41488f[_0x62a7('0x4a')]);_0x509a55[_0x62a7('0x4b')]=_[_0x62a7('0x4c')](_0x509a55[_0x62a7('0x49')],_0x509a55[_0x62a7('0x4a')]);_0x1a9ddd[_0x62a7('0x4d')]=_['intersection'](_0x509a55[_0x62a7('0x49')],qs[_0x62a7('0x4e')](_0x41488f[_0x62a7('0x4a')][_0x62a7('0x4e')]));_0x1a9ddd[_0x62a7('0x4d')]=_0x1a9ddd[_0x62a7('0x4d')]['length']?_0x1a9ddd[_0x62a7('0x4d')]:_0x509a55[_0x62a7('0x49')];if(!_0x41488f[_0x62a7('0x4a')][_0x62a7('0x4f')](_0x62a7('0x50'))){_0x1a9ddd['limit']=qs['limit'](_0x41488f['query'][_0x62a7('0x32')]);_0x1a9ddd['offset']=qs[_0x62a7('0x31')](_0x41488f[_0x62a7('0x4a')]['offset']);}_0x1a9ddd['order']=qs[_0x62a7('0x51')](_0x41488f['query'][_0x62a7('0x51')]);_0x1a9ddd[_0x62a7('0x52')]=qs[_0x62a7('0x4b')](_[_0x62a7('0x53')](_0x41488f[_0x62a7('0x4a')],_0x509a55[_0x62a7('0x4b')]),_0xf1114c);if(_0x41488f[_0x62a7('0x4a')]['filter']){_0x1a9ddd[_0x62a7('0x52')]=_[_0x62a7('0x54')](_0x1a9ddd['where'],{'$or':_['map'](_0xf1114c,function(_0x11971c){if(_0x11971c[_0x62a7('0x48')]!==_0x62a7('0x55')){var _0x2a4b52={};_0x2a4b52[_0x11971c[_0x62a7('0x40')]]={'$like':'%'+_0x41488f[_0x62a7('0x4a')][_0x62a7('0x56')]+'%'};return _0x2a4b52;}})});}_0x1a9ddd=_[_0x62a7('0x54')]({},_0x1a9ddd,_0x41488f[_0x62a7('0x57')]);var _0x2d109b={'where':_0x1a9ddd[_0x62a7('0x52')]};return db[_0x62a7('0x45')]['count'](_0x2d109b)['then'](function(_0xc9e8dc){_0x43fc56['count']=_0xc9e8dc;if(_0x41488f[_0x62a7('0x4a')][_0x62a7('0x58')]){_0x1a9ddd[_0x62a7('0x59')]=[{'all':!![]}];}return db[_0x62a7('0x45')][_0x62a7('0x5a')](_0x1a9ddd);})[_0x62a7('0x23')](function(_0xb74be7){_0x43fc56[_0x62a7('0x5b')]=_0xb74be7;return _0x43fc56;})[_0x62a7('0x23')](respondWithFilteredResult(_0x3cc287,_0x1a9ddd))['catch'](handleError(_0x3cc287,null));};exports[_0x62a7('0x5c')]=function(_0x13cc57,_0x1b65a7){var _0x52035a={'raw':![],'where':{'id':_0x13cc57[_0x62a7('0x5d')]['id']},'include':[{'model':db[_0x62a7('0x43')],'as':_0x62a7('0x5e')}]},_0x26e9c3={};_0x26e9c3[_0x62a7('0x49')]=_['keys'](db[_0x62a7('0x45')][_0x62a7('0x46')]);_0x26e9c3[_0x62a7('0x4a')]=_[_0x62a7('0x5f')](_0x13cc57[_0x62a7('0x4a')]);_0x26e9c3[_0x62a7('0x4b')]=_[_0x62a7('0x4c')](_0x26e9c3[_0x62a7('0x49')],_0x26e9c3[_0x62a7('0x4a')]);_0x52035a[_0x62a7('0x4d')]=_[_0x62a7('0x4c')](_0x26e9c3['model'],qs['fields'](_0x13cc57['query'][_0x62a7('0x4e')]));_0x52035a[_0x62a7('0x4d')]=_0x52035a[_0x62a7('0x4d')]['length']?_0x52035a[_0x62a7('0x4d')]:_0x26e9c3[_0x62a7('0x49')];if(_0x13cc57[_0x62a7('0x4a')][_0x62a7('0x58')]){_0x52035a[_0x62a7('0x59')]=[{'all':!![]}];}_0x52035a=_[_0x62a7('0x54')]({},_0x52035a,_0x13cc57[_0x62a7('0x57')]);return db[_0x62a7('0x45')][_0x62a7('0x60')](_0x52035a)[_0x62a7('0x23')](handleEntityNotFound(_0x1b65a7,null))[_0x62a7('0x23')](respondWithResult(_0x1b65a7,null))['catch'](handleError(_0x1b65a7,null));};exports['create']=function(_0x1f19a4,_0xbd0c69){return db['OpenchannelAccount'][_0x62a7('0x61')](_0x1f19a4[_0x62a7('0x62')],{})[_0x62a7('0x23')](function(_0x4ac1c1){var _0x24cf67=_0x1f19a4['user'][_0x62a7('0x3a')]({'plain':!![]});if(!_0x24cf67)throw new Error(_0x62a7('0x63'));if(_0x24cf67[_0x62a7('0x64')]==='user'){var _0x4b55c7=_0x4ac1c1['get']({'plain':!![]});var _0x7bd567='OpenchannelAccounts';return db[_0x62a7('0x65')][_0x62a7('0x60')]({'where':{'name':_0x7bd567,'userProfileId':_0x24cf67[_0x62a7('0x66')]},'raw':!![]})['then'](function(_0x45a4d8){if(_0x45a4d8&&_0x45a4d8['autoAssociation']===0x0){return db[_0x62a7('0x3c')][_0x62a7('0x61')]({'name':_0x4b55c7[_0x62a7('0x40')],'resourceId':_0x4b55c7['id'],'type':_0x45a4d8[_0x62a7('0x40')],'sectionId':_0x45a4d8['id']},{})['then'](function(){return _0x4ac1c1;});}else{return _0x4ac1c1;}})[_0x62a7('0x2e')](function(_0xe1f5e0){logger[_0x62a7('0x29')](_0x62a7('0x67'),_0xe1f5e0);throw _0xe1f5e0;});}return _0x4ac1c1;})[_0x62a7('0x23')](respondWithResult(_0xbd0c69,0xc9))['catch'](handleError(_0xbd0c69,null));};exports['update']=function(_0x250dad,_0x41db21){if(_0x250dad['body']['id']){delete _0x250dad[_0x62a7('0x62')]['id'];}return db[_0x62a7('0x45')]['find']({'where':{'id':_0x250dad[_0x62a7('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0x62a7('0x5e')}]})[_0x62a7('0x23')](handleEntityNotFound(_0x41db21,null))['then'](saveUpdates(_0x250dad['body'],null))[_0x62a7('0x23')](respondWithResult(_0x41db21,null))[_0x62a7('0x2e')](handleError(_0x41db21,null));};exports[_0x62a7('0x39')]=function(_0x5873e9,_0x20b1a5){return db['OpenchannelAccount'][_0x62a7('0x60')]({'where':{'id':_0x5873e9['params']['id']}})[_0x62a7('0x23')](handleEntityNotFound(_0x20b1a5,null))[_0x62a7('0x23')](removeEntity(_0x20b1a5,null))['catch'](handleError(_0x20b1a5,null));};exports[_0x62a7('0x68')]=function(_0x102b4d,_0x5bd535){return db[_0x62a7('0x45')]['describe']()[_0x62a7('0x23')](respondWithResult(_0x5bd535,null))[_0x62a7('0x2e')](handleError(_0x5bd535,null));};exports[_0x62a7('0x69')]=function(_0x1186a9,_0x428032,_0x138d40){if(_0x1186a9[_0x62a7('0x62')]['id']){delete _0x1186a9[_0x62a7('0x62')]['id'];}return db['OpenchannelAccount'][_0x62a7('0x60')]({'where':{'id':_0x1186a9[_0x62a7('0x5d')]['id']}})['then'](handleEntityNotFound(_0x428032,null))[_0x62a7('0x23')](function(_0x1f222f){if(_0x1f222f){_0x1186a9[_0x62a7('0x62')][_0x62a7('0x6a')]=_0x1f222f['id'];return db['Disposition'][_0x62a7('0x61')](_0x1186a9['body']);}})['then'](respondWithResult(_0x428032,null))[_0x62a7('0x2e')](handleError(_0x428032,null));};exports[_0x62a7('0x6b')]=function(_0x122192,_0x5483b4,_0x4248d7){var _0x10f90d={'raw':![],'where':{}};var _0x3c8a3b={};var _0x13d3ba={'count':0x0,'rows':[]};return db[_0x62a7('0x45')]['findOne']({'where':{'id':_0x122192[_0x62a7('0x5d')]['id']}})[_0x62a7('0x23')](handleEntityNotFound(_0x5483b4,null))[_0x62a7('0x23')](function(_0x171eef){if(_0x171eef){_0x3c8a3b[_0x62a7('0x49')]=_[_0x62a7('0x5f')](db['Disposition'][_0x62a7('0x46')]);_0x3c8a3b['query']=_[_0x62a7('0x5f')](_0x122192[_0x62a7('0x4a')]);_0x3c8a3b[_0x62a7('0x4b')]=_[_0x62a7('0x4c')](_0x3c8a3b['model'],_0x3c8a3b[_0x62a7('0x4a')]);_0x10f90d['attributes']=_[_0x62a7('0x4c')](_0x3c8a3b['model'],qs['fields'](_0x122192[_0x62a7('0x4a')]['fields']));_0x10f90d['attributes']=_0x10f90d[_0x62a7('0x4d')][_0x62a7('0x6c')]?_0x10f90d[_0x62a7('0x4d')]:_0x3c8a3b[_0x62a7('0x49')];if(!_0x122192['query'][_0x62a7('0x4f')](_0x62a7('0x50'))){_0x10f90d['limit']=qs[_0x62a7('0x32')](_0x122192['query'][_0x62a7('0x32')]);_0x10f90d['offset']=qs[_0x62a7('0x31')](_0x122192['query'][_0x62a7('0x31')]);}_0x10f90d[_0x62a7('0x6d')]=qs[_0x62a7('0x51')](_0x122192['query']['sort']);_0x10f90d[_0x62a7('0x52')]=qs[_0x62a7('0x4b')](_[_0x62a7('0x53')](_0x122192[_0x62a7('0x4a')],_0x3c8a3b[_0x62a7('0x4b')]));_0x10f90d[_0x62a7('0x52')][_0x62a7('0x6a')]=_0x171eef['id'];if(_0x122192[_0x62a7('0x4a')]['filter']){_0x10f90d['where']=_['merge'](_0x10f90d[_0x62a7('0x52')],{'$or':_[_0x62a7('0x44')](_0x10f90d[_0x62a7('0x4d')],function(_0x582295){var _0x1b16f9={};_0x1b16f9[_0x582295]={'$like':'%'+_0x122192[_0x62a7('0x4a')][_0x62a7('0x56')]+'%'};return _0x1b16f9;})});}_0x10f90d=_['merge']({},_0x10f90d,_0x122192[_0x62a7('0x57')]);return db[_0x62a7('0x6e')]['count']({'where':_0x10f90d['where']})[_0x62a7('0x23')](function(_0x389c4f){_0x13d3ba['count']=_0x389c4f;if(_0x122192['query'][_0x62a7('0x58')]){_0x10f90d[_0x62a7('0x59')]=[{'all':!![]}];}return db[_0x62a7('0x6e')][_0x62a7('0x5a')](_0x10f90d);})[_0x62a7('0x23')](function(_0x10b4b2){_0x13d3ba[_0x62a7('0x5b')]=_0x10b4b2;return _0x13d3ba;});}})[_0x62a7('0x23')](respondWithFilteredResult(_0x5483b4,_0x10f90d))['catch'](handleError(_0x5483b4,null));};exports[_0x62a7('0x6f')]=function(_0x3a1744,_0x2f6a95,_0x85b0c3){return db['OpenchannelAccount'][_0x62a7('0x60')]({'where':{'id':_0x3a1744[_0x62a7('0x5d')]['id']}})[_0x62a7('0x23')](handleEntityNotFound(_0x2f6a95,null))[_0x62a7('0x23')](function(_0x4868b1){if(_0x4868b1){return _0x4868b1['removeDispositions'](_0x3a1744[_0x62a7('0x4a')][_0x62a7('0x70')]);}})[_0x62a7('0x23')](respondWithStatusCode(_0x2f6a95,null))['catch'](handleError(_0x2f6a95,null));};exports[_0x62a7('0x71')]=function(_0x2fbb28,_0x3103b6,_0x175343){if(_0x2fbb28[_0x62a7('0x62')]['id']){delete _0x2fbb28[_0x62a7('0x62')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x2fbb28['params']['id']}})[_0x62a7('0x23')](handleEntityNotFound(_0x3103b6,null))[_0x62a7('0x23')](function(_0x2a07e4){if(_0x2a07e4){_0x2fbb28[_0x62a7('0x62')]['OpenchannelAccountId']=_0x2a07e4['id'];return db[_0x62a7('0x72')]['create'](_0x2fbb28[_0x62a7('0x62')]);}})[_0x62a7('0x23')](respondWithResult(_0x3103b6,null))['catch'](handleError(_0x3103b6,null));};exports[_0x62a7('0x73')]=function(_0x2909a7,_0x30dbe5,_0x5a8612){var _0x293bc6={'raw':![],'where':{}};var _0x53bfff={};var _0xef9003={'count':0x0,'rows':[]};return db[_0x62a7('0x45')]['findOne']({'where':{'id':_0x2909a7[_0x62a7('0x5d')]['id']}})['then'](handleEntityNotFound(_0x30dbe5,null))[_0x62a7('0x23')](function(_0x1755fd){if(_0x1755fd){_0x53bfff[_0x62a7('0x49')]=_[_0x62a7('0x5f')](db[_0x62a7('0x72')][_0x62a7('0x46')]);_0x53bfff['query']=_[_0x62a7('0x5f')](_0x2909a7[_0x62a7('0x4a')]);_0x53bfff[_0x62a7('0x4b')]=_[_0x62a7('0x4c')](_0x53bfff[_0x62a7('0x49')],_0x53bfff[_0x62a7('0x4a')]);_0x293bc6[_0x62a7('0x4d')]=_[_0x62a7('0x4c')](_0x53bfff[_0x62a7('0x49')],qs[_0x62a7('0x4e')](_0x2909a7[_0x62a7('0x4a')][_0x62a7('0x4e')]));_0x293bc6[_0x62a7('0x4d')]=_0x293bc6[_0x62a7('0x4d')][_0x62a7('0x6c')]?_0x293bc6['attributes']:_0x53bfff['model'];if(!_0x2909a7[_0x62a7('0x4a')][_0x62a7('0x4f')](_0x62a7('0x50'))){_0x293bc6[_0x62a7('0x32')]=qs[_0x62a7('0x32')](_0x2909a7[_0x62a7('0x4a')]['limit']);_0x293bc6['offset']=qs['offset'](_0x2909a7[_0x62a7('0x4a')][_0x62a7('0x31')]);}_0x293bc6['order']=qs[_0x62a7('0x51')](_0x2909a7[_0x62a7('0x4a')][_0x62a7('0x51')]);_0x293bc6['where']=qs[_0x62a7('0x4b')](_[_0x62a7('0x53')](_0x2909a7['query'],_0x53bfff['filters']));_0x293bc6[_0x62a7('0x52')]['OpenchannelAccountId']=_0x1755fd['id'];if(_0x2909a7[_0x62a7('0x4a')][_0x62a7('0x56')]){_0x293bc6[_0x62a7('0x52')]=_[_0x62a7('0x54')](_0x293bc6['where'],{'$or':_['map'](_0x293bc6[_0x62a7('0x4d')],function(_0x362fe1){var _0x204e20={};_0x204e20[_0x362fe1]={'$like':'%'+_0x2909a7['query'][_0x62a7('0x56')]+'%'};return _0x204e20;})});}_0x293bc6=_['merge']({},_0x293bc6,_0x2909a7['options']);return db[_0x62a7('0x72')][_0x62a7('0x34')]({'where':_0x293bc6[_0x62a7('0x52')]})[_0x62a7('0x23')](function(_0x4f389e){_0xef9003['count']=_0x4f389e;if(_0x2909a7[_0x62a7('0x4a')][_0x62a7('0x58')]){_0x293bc6[_0x62a7('0x59')]=[{'all':!![]}];}return db[_0x62a7('0x72')][_0x62a7('0x5a')](_0x293bc6);})['then'](function(_0x13f2a8){_0xef9003['rows']=_0x13f2a8;return _0xef9003;});}})[_0x62a7('0x23')](respondWithFilteredResult(_0x30dbe5,_0x293bc6))[_0x62a7('0x2e')](handleError(_0x30dbe5,null));};exports[_0x62a7('0x74')]=function(_0x5957f4,_0x3a81fc,_0x27dda0){return db[_0x62a7('0x45')]['find']({'where':{'id':_0x5957f4['params']['id']}})[_0x62a7('0x23')](handleEntityNotFound(_0x3a81fc,null))[_0x62a7('0x23')](function(_0xd5f91c){if(_0xd5f91c){return _0xd5f91c[_0x62a7('0x74')](_0x5957f4[_0x62a7('0x4a')]['ids']);}})[_0x62a7('0x23')](respondWithStatusCode(_0x3a81fc,null))[_0x62a7('0x2e')](handleError(_0x3a81fc,null));};exports['notify']=function(_0x1f8d5c,_0x3a42c7,_0x439fcd){var _0x720726={'body':_0x1f8d5c['body'],'channel':_0x62a7('0x75')};var _0x3befdc=[];var _0x3287f6=[];var _0x573cbe={};var _0x1327aa=![];return db[_0x62a7('0x76')][_0x62a7('0x68')]()[_0x62a7('0x23')](function(_0xea88e4){if(!_0xea88e4){throw new db[(_0x62a7('0x77'))]['ValidationError'](_0x62a7('0x78'));}_0x3befdc=_['difference'](_[_0x62a7('0x5f')](_0xea88e4),[_0x62a7('0x79'),'updatedAt']);_0x3287f6=_[_0x62a7('0x7a')](_[_0x62a7('0x5f')](_0xea88e4),[_0x62a7('0x79'),_0x62a7('0x7b'),_0x62a7('0x7c'),'ListId']);if(_0x1f8d5c[_0x62a7('0x62')]['id']){delete _0x1f8d5c[_0x62a7('0x62')]['id'];}if(_[_0x62a7('0x7d')](_0x1f8d5c[_0x62a7('0x62')][_0x62a7('0x7e')])){throw new db[(_0x62a7('0x77'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x1f8d5c[_0x62a7('0x62')][_0x62a7('0x62')])||_0x1f8d5c[_0x62a7('0x62')][_0x62a7('0x62')]===''){throw new db[(_0x62a7('0x77'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x62a7('0x7d')](_0x1f8d5c[_0x62a7('0x62')][_0x62a7('0x7f')])){throw new db[(_0x62a7('0x77'))]['ValidationError'](_0x62a7('0x80')+_0x3287f6);}if(!_['includes'](_0x3287f6,_0x1f8d5c[_0x62a7('0x62')][_0x62a7('0x7f')])){throw new db[(_0x62a7('0x77'))][(_0x62a7('0x81'))](_0x62a7('0x82')+_0x3287f6);}_0x573cbe[_0x1f8d5c[_0x62a7('0x62')][_0x62a7('0x7f')]]=_0x1f8d5c[_0x62a7('0x62')][_0x62a7('0x7e')];})[_0x62a7('0x23')](function(){return db[_0x62a7('0x45')][_0x62a7('0x60')]({'where':{'id':_0x1f8d5c[_0x62a7('0x5d')]['id']},'include':[{'model':db[_0x62a7('0x83')],'as':_0x62a7('0x84'),'include':[{'model':db[_0x62a7('0x76')],'as':'Contacts','where':_0x573cbe,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x62a7('0x85')],'as':_0x62a7('0x86')}]});})['then'](handleEntityNotFound(_0x3a42c7,null))[_0x62a7('0x23')](function(_0x22d605){if(_0x22d605&&_0x22d605[_0x62a7('0x84')]){_0x720726[_0x62a7('0x87')]=_0x22d605;_0x720726[_0x62a7('0x88')]=_0x22d605[_0x62a7('0x86')];_0x720726[_0x62a7('0x89')]=_0x22d605[_0x62a7('0x84')];_0x720726[_0x62a7('0x88')]=_['orderBy'](_0x720726[_0x62a7('0x88')],['priority'],['asc']);if(_0x720726['account']['Applications']){delete _0x720726[_0x62a7('0x87')][_0x62a7('0x86')];}if(_0x720726[_0x62a7('0x87')][_0x62a7('0x84')]&&_0x720726[_0x62a7('0x87')][_0x62a7('0x84')][_0x62a7('0x8a')][_0x62a7('0x6c')]){return _0x720726[_0x62a7('0x87')][_0x62a7('0x84')]['Contacts'][0x0];}var _0x5f15b4=_['defaults'](_0x1f8d5c['body'],{'firstName':_0x1f8d5c[_0x62a7('0x62')][_0x62a7('0x7e')],'ListId':_0x22d605['ListId']});_0x5f15b4[_0x1f8d5c[_0x62a7('0x62')][_0x62a7('0x7f')]]=_0x1f8d5c['body'][_0x62a7('0x7e')];return db[_0x62a7('0x76')][_0x62a7('0x61')](_0x5f15b4,{'fields':_0x3befdc,'raw':!![]});}})[_0x62a7('0x23')](handleEntityNotFound(_0x3a42c7,null))[_0x62a7('0x23')](function(_0x58273a){_0x720726[_0x62a7('0x8b')]=_0x58273a;if(_0x58273a){var _0x46148c={'ContactId':_0x58273a['id'],'OpenchannelAccountId':_0x1f8d5c[_0x62a7('0x5d')]['id'],'from':(_0x58273a[_0x62a7('0x8c')]||'')+'\x20'+(_0x58273a[_0x62a7('0x8d')]||'')};var _0x613f56={'OpenchannelAccountId':_0x1f8d5c[_0x62a7('0x5d')]['id'],'closed':![]};if(_0x1f8d5c['body'][_0x62a7('0x8e')]){_0x613f56[_0x62a7('0x8e')]=_0x1f8d5c[_0x62a7('0x62')][_0x62a7('0x8e')];return db[_0x62a7('0x8f')][_0x62a7('0x60')]({'where':_0x613f56})[_0x62a7('0x23')](function(_0x34f32){if(_0x34f32){return[_0x34f32,![]];}_0x46148c[_0x62a7('0x8e')]=_0x1f8d5c[_0x62a7('0x62')][_0x62a7('0x8e')];_0x46148c['externalUrl']=_0x1f8d5c['body'][_0x62a7('0x90')];return db[_0x62a7('0x8f')]['create'](_0x46148c)['then'](function(_0x1bc193){return[_0x1bc193,!![]];});});}else{_0x613f56['threadId']=null;}_0x613f56[_0x62a7('0x91')]=_0x58273a['id'];return db[_0x62a7('0x8f')][_0x62a7('0x60')]({'where':_0x613f56})[_0x62a7('0x23')](function(_0x52601a){if(_0x52601a){return[_0x52601a,![]];}return db['OpenchannelInteraction'][_0x62a7('0x61')](_0x46148c)['then'](function(_0x1ca2d5){return[_0x1ca2d5,!![]];});});}})[_0x62a7('0x92')](function(_0x157593,_0x55aa65){if(_0x157593){_0x1327aa=_0x55aa65;if(!_0x55aa65){var _0x51b2cc={'from':(_0x720726[_0x62a7('0x8b')][_0x62a7('0x8c')]||'')+'\x20'+(_0x720726[_0x62a7('0x8b')][_0x62a7('0x8d')]||'')};if(_0x1f8d5c[_0x62a7('0x62')][_0x62a7('0x8e')]&&_0x1f8d5c['body'][_0x62a7('0x93')]&&_0x1f8d5c['body'][_0x62a7('0x8e')]!=_0x1f8d5c['body'][_0x62a7('0x93')]){_0x51b2cc['threadId']=_0x1f8d5c['body'][_0x62a7('0x93')];}return _0x157593[_0x62a7('0x94')](_0x51b2cc);}else{return _0x157593;}}})[_0x62a7('0x23')](function(_0x22ae83){_0x720726[_0x62a7('0x95')]=_0x22ae83[_0x62a7('0x3a')]({'plain':!![]});_0x720726['interaction'][_0x62a7('0x96')]=_0x1327aa;if(_0x720726[_0x62a7('0x95')][_0x62a7('0x96')]){if(_0x720726[_0x62a7('0x87')][_0x62a7('0x97')]){_0x720726[_0x62a7('0x88')]['push']({'id':0x0,'priority':_0x720726[_0x62a7('0x88')][_0x62a7('0x6c')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x62a7('0x98')][_0x62a7('0x61')]({'body':_0x1f8d5c['body'][_0x62a7('0x62')],'OpenchannelAccountId':_0x1f8d5c[_0x62a7('0x5d')]['id'],'OpenchannelInteractionId':_0x22ae83['id'],'direction':'in','ContactId':_0x720726[_0x62a7('0x8b')]['id'],'AttachmentId':_0x1f8d5c['body'][_0x62a7('0x99')]});})[_0x62a7('0x23')](function(_0x15e7e4){_0x720726[_0x62a7('0x2c')]=_0x15e7e4;if(!_0x720726[_0x62a7('0x95')][_0x62a7('0x9a')])return;return db['User']['find']({'attributes':['id',_0x62a7('0x40')],'where':{'id':_0x720726[_0x62a7('0x95')][_0x62a7('0x9a')]}});})[_0x62a7('0x23')](function(_0x2d4eb1){if(_0x2d4eb1){_0x720726[_0x62a7('0x88')][_0x62a7('0x9b')]({'id':0x0,'priority':0x0,'app':_0x62a7('0x9c'),'appdata':_0x2d4eb1[_0x62a7('0x40')]+','+(_0x720726[_0x62a7('0x87')]['waitForTheAssignedAgent']||0xa),'interval':_0x62a7('0x9d')});}if(!_0x720726[_0x62a7('0x95')][_0x62a7('0x9e')])return;return db[_0x62a7('0x9f')]['find']({'attributes':['id',_0x62a7('0x40')],'where':{'id':_0x720726[_0x62a7('0x95')][_0x62a7('0x9e')]}});})[_0x62a7('0x23')](function(_0x4fad95){if(_0x4fad95){_0x720726['applications'][_0x62a7('0x9b')]({'id':0x0,'priority':0x1,'app':_0x62a7('0xa0'),'appdata':_0x4fad95['name']+','+(_0x720726[_0x62a7('0x87')][_0x62a7('0xa1')]||0x12c),'interval':_0x62a7('0x9d')});}return respondWithRpcPromise('Start',_0x62a7('0xa2'),_0x720726);})['then'](function(_0x36416d){respondWithRpcPromise('EventManager',_0x62a7('0xa3'),{'event':'notify','message':_0x36416d},client9002);return _0x36416d;})[_0x62a7('0x23')](respondWithResult(_0x3a42c7,null))[_0x62a7('0x2e')](handleError(_0x3a42c7,null));};exports[_0x62a7('0xa4')]=function(_0x516942,_0x9d9178){var _0x1bd356=_0x516942[_0x62a7('0x5d')]['id'];var _0x1ce990=_0x516942['body'];var _0x5fb920=0xc8;var _0x145e05=null;return db[_0x62a7('0xa5')][_0x62a7('0xa6')]({'isolationLevel':db[_0x62a7('0xa5')]['Transaction'][_0x62a7('0xa7')][_0x62a7('0xa8')]},function(_0x583acd){return db[_0x62a7('0x45')][_0x62a7('0xa9')]({'where':{'id':_0x1bd356},'transaction':_0x583acd})[_0x62a7('0x23')](function(_0x5260af){if(_0x5260af){return db[_0x62a7('0x85')][_0x62a7('0x39')]({'where':{'OpenchannelAccountId':_0x1bd356},'transaction':_0x583acd})[_0x62a7('0x23')](function(){var _0x78bd9e=_[_0x62a7('0x44')](_0x1ce990,function(_0xede4ae){_0xede4ae['OpenchannelAccountId']=_0x1bd356;return _0xede4ae;});return db[_0x62a7('0x85')][_0x62a7('0xaa')](_0x78bd9e,{'transaction':_0x583acd});});}else{_0x5fb920=0x194;_0x145e05=[];}});})[_0x62a7('0x23')](function(){if(_0x5fb920!==0x194){return db['OpenchannelApplication'][_0x62a7('0xab')]({'where':{'OpenchannelAccountId':_0x1bd356},'order':'priority'})['then'](function(_0x207531){_0x145e05=_0x207531;});}})['catch'](function(_0x38743e){_0x5fb920=0x1f4;logger[_0x62a7('0x29')](_0x38743e['stack']);if(_0x38743e[_0x62a7('0x40')]){delete _0x38743e[_0x62a7('0x40')];}_0x145e05=_0x38743e;})['finally'](function(){if(_0x145e05===null){_0x9d9178[_0x62a7('0x3e')](_0x5fb920);}else{if(_0x5fb920===0x1f4){_0x9d9178[_0x62a7('0x2f')](_0x5fb920)[_0x62a7('0x41')](_0x145e05);}else{_0x9d9178[_0x62a7('0x2f')](_0x5fb920)[_0x62a7('0x30')](_0x145e05);}}});};exports[_0x62a7('0xac')]=function(_0x2bcd51,_0x451b1e,_0x463381){var _0x1deef9={};var _0xe1407={};var _0x3dc22a;var _0x5ab521;return db[_0x62a7('0x45')][_0x62a7('0xa9')]({'where':{'id':_0x2bcd51[_0x62a7('0x5d')]['id']}})[_0x62a7('0x23')](handleEntityNotFound(_0x451b1e,null))[_0x62a7('0x23')](function(_0x2a337d){if(_0x2a337d){_0x3dc22a=_0x2a337d;_0xe1407[_0x62a7('0x49')]=_['keys'](db[_0x62a7('0x85')][_0x62a7('0x46')]);_0xe1407[_0x62a7('0x4a')]=_[_0x62a7('0x5f')](_0x2bcd51[_0x62a7('0x4a')]);_0xe1407['filters']=_[_0x62a7('0x4c')](_0xe1407[_0x62a7('0x49')],_0xe1407[_0x62a7('0x4a')]);_0x1deef9[_0x62a7('0x4d')]=_[_0x62a7('0x4c')](_0xe1407[_0x62a7('0x49')],qs['fields'](_0x2bcd51[_0x62a7('0x4a')]['fields']));_0x1deef9[_0x62a7('0x4d')]=_0x1deef9[_0x62a7('0x4d')][_0x62a7('0x6c')]?_0x1deef9[_0x62a7('0x4d')]:_0xe1407[_0x62a7('0x49')];_0x1deef9[_0x62a7('0x6d')]=qs['sort'](_0x2bcd51[_0x62a7('0x4a')][_0x62a7('0x51')]);_0x1deef9[_0x62a7('0x52')]=qs[_0x62a7('0x4b')](_[_0x62a7('0x53')](_0x2bcd51[_0x62a7('0x4a')],_0xe1407[_0x62a7('0x4b')]));if(_0x2bcd51['query'][_0x62a7('0x56')]){_0x1deef9[_0x62a7('0x52')]=_['merge'](_0x1deef9[_0x62a7('0x52')],{'$or':_['map'](_0x1deef9['attributes'],function(_0x39f618){var _0x5a487e={};_0x5a487e[_0x39f618]={'$like':'%'+_0x2bcd51[_0x62a7('0x4a')]['filter']+'%'};return _0x5a487e;})});}_0x1deef9=_[_0x62a7('0x54')]({},_0x1deef9,_0x2bcd51['options']);return _0x3dc22a[_0x62a7('0xac')](_0x1deef9);}})[_0x62a7('0x23')](function(_0x56a428){if(_0x56a428){_0x5ab521=_0x56a428['length'];if(!_0x2bcd51[_0x62a7('0x4a')]['hasOwnProperty'](_0x62a7('0x50'))){_0x1deef9[_0x62a7('0x32')]=qs[_0x62a7('0x32')](_0x2bcd51['query'][_0x62a7('0x32')]);_0x1deef9['offset']=qs[_0x62a7('0x31')](_0x2bcd51['query'][_0x62a7('0x31')]);}return _0x3dc22a[_0x62a7('0xac')](_0x1deef9);}})[_0x62a7('0x23')](function(_0x32c808){if(_0x32c808){return _0x32c808?{'count':_0x5ab521,'rows':_0x32c808}:null;}})[_0x62a7('0x23')](respondWithResult(_0x451b1e,null))['catch'](handleError(_0x451b1e,null));};exports[_0x62a7('0xad')]=function(_0x415853,_0x3c2f5b,_0x233882){var _0x3c5531={'raw':![],'where':{}};var _0x257ff7={};var _0x468669={'count':0x0,'rows':[]};return db[_0x62a7('0x45')][_0x62a7('0xa9')]({'where':{'id':_0x415853[_0x62a7('0x5d')]['id']}})[_0x62a7('0x23')](handleEntityNotFound(_0x3c2f5b,null))[_0x62a7('0x23')](function(_0x3fc19a){if(_0x3fc19a){_0x257ff7[_0x62a7('0x49')]=_[_0x62a7('0x5f')](db[_0x62a7('0x8f')][_0x62a7('0x46')]);_0x257ff7[_0x62a7('0x4a')]=_[_0x62a7('0x5f')](_0x415853[_0x62a7('0x4a')]);_0x257ff7[_0x62a7('0x4b')]=_[_0x62a7('0x4c')](_0x257ff7[_0x62a7('0x49')],_0x257ff7['query']);_0x3c5531[_0x62a7('0x4d')]=_['intersection'](_0x257ff7[_0x62a7('0x49')],qs[_0x62a7('0x4e')](_0x415853[_0x62a7('0x4a')][_0x62a7('0x4e')]));_0x3c5531['attributes']=_0x3c5531[_0x62a7('0x4d')][_0x62a7('0x6c')]?_0x3c5531['attributes']:_0x257ff7[_0x62a7('0x49')];if(!_0x415853[_0x62a7('0x4a')][_0x62a7('0x4f')](_0x62a7('0x50'))){_0x3c5531['limit']=qs[_0x62a7('0x32')](_0x415853[_0x62a7('0x4a')][_0x62a7('0x32')]);_0x3c5531[_0x62a7('0x31')]=qs[_0x62a7('0x31')](_0x415853[_0x62a7('0x4a')][_0x62a7('0x31')]);}_0x3c5531['order']=qs[_0x62a7('0x51')](_0x415853[_0x62a7('0x4a')][_0x62a7('0x51')]);_0x3c5531[_0x62a7('0x52')]=qs[_0x62a7('0x4b')](_[_0x62a7('0x53')](_0x415853[_0x62a7('0x4a')],_0x257ff7['filters']));_0x3c5531['where'][_0x62a7('0x6a')]=_0x3fc19a['id'];if(_0x415853[_0x62a7('0x4a')]['filter']){_0x3c5531[_0x62a7('0x52')]=_[_0x62a7('0x54')](_0x3c5531['where'],{'$or':_[_0x62a7('0x44')](_0x3c5531['attributes'],function(_0x2ae71f){var _0x98c8ae={};_0x98c8ae[_0x2ae71f]={'$like':'%'+_0x415853[_0x62a7('0x4a')][_0x62a7('0x56')]+'%'};return _0x98c8ae;})});}_0x3c5531=_['merge']({},_0x3c5531,_0x415853[_0x62a7('0x57')]);return db[_0x62a7('0x8f')][_0x62a7('0x34')]({'where':_0x3c5531[_0x62a7('0x52')]})[_0x62a7('0x23')](function(_0xc617e4){_0x468669[_0x62a7('0x34')]=_0xc617e4;if(_0x415853['query'][_0x62a7('0x58')]){_0x3c5531['include']=[{'model':db[_0x62a7('0x76')],'as':_0x62a7('0xae'),'required':![]},{'model':db[_0x62a7('0xaf')],'as':_0x62a7('0xb0'),'attributes':[_0x62a7('0x40'),_0x62a7('0xb1'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x62a7('0xb2'),'attributes':['id',_0x62a7('0x40'),_0x62a7('0xb3')],'where':_0x415853[_0x62a7('0x4a')][_0x62a7('0xb4')]?{'id':_0x415853['query'][_0x62a7('0xb4')]}:undefined,'required':_0x415853['query']['tag']?!![]:![]}];}return db[_0x62a7('0x8f')]['findAll'](_0x3c5531);})[_0x62a7('0x23')](function(_0x5800af){_0x468669[_0x62a7('0x5b')]=_0x5800af;return _0x468669;});}})['then'](respondWithFilteredResult(_0x3c2f5b,_0x3c5531))[_0x62a7('0x2e')](handleError(_0x3c2f5b,null));};exports['addAgents']=function(_0x5c2170,_0x35be65,_0x1d85df){return db[_0x62a7('0x45')][_0x62a7('0x60')]({'where':{'id':_0x5c2170['params']['id']}})[_0x62a7('0x23')](handleEntityNotFound(_0x35be65,null))[_0x62a7('0x23')](function(_0x4f3194){if(_0x4f3194){return _0x4f3194[_0x62a7('0xb5')](_0x5c2170['body'][_0x62a7('0x70')],_[_0x62a7('0xb6')](_0x5c2170['body'],['ids','id'])||{})[_0x62a7('0x92')](function(_0x1b16f2){for(var _0x5995e8=0x0;_0x5995e8<_0x5c2170[_0x62a7('0x62')][_0x62a7('0x70')][_0x62a7('0x6c')];_0x5995e8+=0x1){socket['emit'](_0x62a7('0xb7'),{'UserId':Number(_0x5c2170[_0x62a7('0x62')][_0x62a7('0x70')][_0x5995e8]),'OpenchannelAccountId':Number(_0x5c2170[_0x62a7('0x5d')]['id'])});}return _0x1b16f2;});}})[_0x62a7('0x23')](respondWithResult(_0x35be65,null))[_0x62a7('0x2e')](handleError(_0x35be65,null));};exports['removeAgents']=function(_0x58693c,_0x2e8ee4,_0x5f46e1){return db['OpenchannelAccount'][_0x62a7('0x60')]({'where':{'id':_0x58693c[_0x62a7('0x5d')]['id']}})[_0x62a7('0x23')](handleEntityNotFound(_0x2e8ee4,null))[_0x62a7('0x23')](function(_0x47e612){if(_0x47e612){return _0x47e612[_0x62a7('0xb8')](_0x58693c[_0x62a7('0x4a')][_0x62a7('0x70')])[_0x62a7('0x23')](function(){if(_[_0x62a7('0xb9')](_0x58693c[_0x62a7('0x4a')][_0x62a7('0x70')])){for(var _0x4a9abd=0x0;_0x4a9abd<_0x58693c[_0x62a7('0x4a')][_0x62a7('0x70')]['length'];_0x4a9abd+=0x1){socket[_0x62a7('0xba')](_0x62a7('0xbb'),{'UserId':Number(_0x58693c[_0x62a7('0x4a')][_0x62a7('0x70')][_0x4a9abd]),'OpenchannelAccountId':Number(_0x58693c[_0x62a7('0x5d')]['id'])});}}else{socket[_0x62a7('0xba')](_0x62a7('0xbb'),{'UserId':Number(_0x58693c[_0x62a7('0x4a')]['ids']),'OpenchannelAccountId':Number(_0x58693c[_0x62a7('0x5d')]['id'])});}});}})[_0x62a7('0x23')](respondWithStatusCode(_0x2e8ee4,null))[_0x62a7('0x2e')](handleError(_0x2e8ee4,null));};exports['getAgents']=function(_0x50239d,_0x14cdfc,_0x285fdb){var _0x46e884={};var _0x510688={};var _0x42f586;var _0x1e31d1;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x50239d[_0x62a7('0x5d')]['id']}})[_0x62a7('0x23')](handleEntityNotFound(_0x14cdfc,null))[_0x62a7('0x23')](function(_0x36fe1b){if(_0x36fe1b){_0x42f586=_0x36fe1b;_0x510688[_0x62a7('0x49')]=_[_0x62a7('0x5f')](db[_0x62a7('0xaf')][_0x62a7('0x46')]);_0x510688[_0x62a7('0x4a')]=_[_0x62a7('0x5f')](_0x50239d[_0x62a7('0x4a')]);_0x510688[_0x62a7('0x4b')]=_[_0x62a7('0x4c')](_0x510688[_0x62a7('0x49')],_0x510688[_0x62a7('0x4a')]);_0x46e884[_0x62a7('0x4d')]=_['intersection'](_0x510688[_0x62a7('0x49')],qs[_0x62a7('0x4e')](_0x50239d[_0x62a7('0x4a')][_0x62a7('0x4e')]));_0x46e884['attributes']=_0x46e884[_0x62a7('0x4d')][_0x62a7('0x6c')]?_0x46e884['attributes']:_0x510688['model'];_0x46e884[_0x62a7('0x6d')]=qs[_0x62a7('0x51')](_0x50239d[_0x62a7('0x4a')][_0x62a7('0x51')]);_0x46e884[_0x62a7('0x52')]=qs['filters'](_[_0x62a7('0x53')](_0x50239d[_0x62a7('0x4a')],_0x510688[_0x62a7('0x4b')]));if(_0x50239d[_0x62a7('0x4a')][_0x62a7('0x56')]){_0x46e884['where']=_[_0x62a7('0x54')](_0x46e884[_0x62a7('0x52')],{'$or':_[_0x62a7('0x44')](_0x46e884[_0x62a7('0x4d')],function(_0x2de61e){var _0x35538c={};_0x35538c[_0x2de61e]={'$like':'%'+_0x50239d['query'][_0x62a7('0x56')]+'%'};return _0x35538c;})});}_0x46e884=_[_0x62a7('0x54')]({},_0x46e884,_0x50239d[_0x62a7('0x57')]);return _0x42f586['getAgents'](_0x46e884);}})[_0x62a7('0x23')](function(_0x30afd9){if(_0x30afd9){_0x1e31d1=_0x30afd9[_0x62a7('0x6c')];if(!_0x50239d[_0x62a7('0x4a')][_0x62a7('0x4f')](_0x62a7('0x50'))){_0x46e884[_0x62a7('0x32')]=qs[_0x62a7('0x32')](_0x50239d['query']['limit']);_0x46e884['offset']=qs[_0x62a7('0x31')](_0x50239d[_0x62a7('0x4a')][_0x62a7('0x31')]);}return _0x42f586['getAgents'](_0x46e884);}})['then'](function(_0xb7aab6){if(_0xb7aab6){return _0xb7aab6?{'count':_0x1e31d1,'rows':_0xb7aab6}:null;}})[_0x62a7('0x23')](respondWithResult(_0x14cdfc,null))[_0x62a7('0x2e')](handleError(_0x14cdfc,null));};exports[_0x62a7('0x41')]=function(_0x1978f0,_0x11cdf5,_0x228dcc){var _0x452499,_0x54ea2e,_0x1cc0d2;if(_[_0x62a7('0x7d')](_0x1978f0[_0x62a7('0x62')][_0x62a7('0x62')])||_0x1978f0[_0x62a7('0x62')][_0x62a7('0x62')]===''){throw new db[(_0x62a7('0x77'))][(_0x62a7('0x81'))](_0x62a7('0xbc'));}if(_['isNil'](_0x1978f0[_0x62a7('0x62')]['to'])){}_0x452499=_0x1978f0['body']['to'];return db['OpenchannelAccount'][_0x62a7('0xa9')]({'where':{'id':_0x1978f0[_0x62a7('0x5d')]['id']}})[_0x62a7('0x23')](handleEntityNotFound(_0x11cdf5,null))[_0x62a7('0x23')](function(_0x4cb8fc){if(_0x4cb8fc){return db['OpenchannelAccount'][_0x62a7('0x60')]({'where':{'id':_0x4cb8fc['id']},'include':[{'model':db[_0x62a7('0x83')],'as':_0x62a7('0x84'),'include':[{'model':db[_0x62a7('0x76')],'as':_0x62a7('0x8a'),'where':{[_0x4cb8fc[_0x62a7('0x7f')]]:_0x452499},'limit':0x1,'order':[[_0x62a7('0x7b'),_0x62a7('0xbd')]]}]}]})[_0x62a7('0x23')](handleEntityNotFound(_0x11cdf5,null))[_0x62a7('0x23')](function(_0x15b86c){if(_0x15b86c&&_0x15b86c[_0x62a7('0x84')]){_0x54ea2e=_0x15b86c['get']({'plain':!![]});if(_0x54ea2e[_0x62a7('0x84')]&&_0x54ea2e[_0x62a7('0x84')][_0x62a7('0x8a')]['length']){return _0x54ea2e['List']['Contacts'][0x0];}return db[_0x62a7('0x76')]['create'](_['defaults'](_0x1978f0['body'],{'firstName':_0x452499,[_0x15b86c[_0x62a7('0x7f')]]:_0x452499,'phone':_0x452499,'ListId':_0x54ea2e[_0x62a7('0xbe')]}));}})[_0x62a7('0x23')](handleEntityNotFound(_0x11cdf5,null))[_0x62a7('0x23')](function(_0x10767b){if(_0x10767b){_0x1cc0d2=_0x10767b;return db[_0x62a7('0x8f')][_0x62a7('0x60')]({'where':{'ContactId':_0x1cc0d2['id'],'closed':![],'OpenchannelAccountId':_0x54ea2e['id']}})[_0x62a7('0x23')](function(_0xb75096){if(_0xb75096){return[_0xb75096,![]];}return db['OpenchannelInteraction'][_0x62a7('0x61')]({'UserId':_0x1978f0[_0x62a7('0xbf')]['id'],'ContactId':_0x1cc0d2['id'],'OpenchannelAccountId':_0x54ea2e['id'],'lastMsgDirection':'out','firstMsgDirection':_0x62a7('0xc0'),'Messages':[_[_0x62a7('0x54')](_0x1978f0[_0x62a7('0x62')],{'read':![],'body':_0x1978f0[_0x62a7('0x62')][_0x62a7('0x62')],'OpenchannelAccountId':_0x54ea2e['id'],'UserId':_0x1978f0[_0x62a7('0xbf')]['id'],'ContactId':_0x1cc0d2['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x62a7('0xc1')}]})['then'](function(_0x416101){return[_0x416101,!![]];});});}})[_0x62a7('0x92')](function(_0x57ed3a,_0x53f0f5){if(_0x53f0f5){return _0x57ed3a;}return db[_0x62a7('0x98')][_0x62a7('0x61')](_[_0x62a7('0x54')](_0x1978f0['body'],{'read':![],'body':_0x1978f0[_0x62a7('0x62')][_0x62a7('0x62')],'OpenchannelAccountId':_0x54ea2e['id'],'OpenchannelInteractionId':_0x57ed3a['id'],'UserId':_0x1978f0['user']['id'],'ContactId':_0x1cc0d2['id']}))[_0x62a7('0x23')](function(_0x426028){_0x57ed3a['dataValues'][_0x62a7('0xc1')]=[];_0x57ed3a['dataValues'][_0x62a7('0xc1')][_0x62a7('0xc2')](_0x426028[_0x62a7('0xc3')]);return _0x57ed3a;});});}})[_0x62a7('0x23')](respondWithResult(_0x11cdf5,null))[_0x62a7('0x2e')](handleError(_0x11cdf5,null));}; \ No newline at end of file +var _0x67d1=['*,*,*,*','User','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','priority','finally','send','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','getAgents','CmList','out','OpenchannelMessage','Messages','dataValues','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','OpenchannelAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','Pause','keys','intersection','length','options','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','openchannel','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','asc','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','interaction','created','autoclose','push','unmanaged'];(function(_0x1a9fe4,_0x2771e6){var _0x59fb68=function(_0x3cfbc0){while(--_0x3cfbc0){_0x1a9fe4['push'](_0x1a9fe4['shift']());}};_0x59fb68(++_0x2771e6);}(_0x67d1,0xf1));var _0x167d=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x67d1[_0x7e2eb0];return _0xd92de4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x167d('0x0'));var zipdir=require(_0x167d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x167d('0x2'));var moment=require(_0x167d('0x3'));var BPromise=require(_0x167d('0x4'));var Mustache=require(_0x167d('0x5'));var util=require('util');var path=require(_0x167d('0x6'));var sox=require(_0x167d('0x7'));var csv=require(_0x167d('0x8'));var ejs=require(_0x167d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x167d('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x167d('0xb'));var deskjs=require(_0x167d('0xc'));var toCsv=require(_0x167d('0x8'));var querystring=require(_0x167d('0xd'));var Papa=require(_0x167d('0xe'));var Redis=require(_0x167d('0xf'));var authService=require(_0x167d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x167d('0x11'));var hardwareService=require(_0x167d('0x12'));var logger=require(_0x167d('0x13'))(_0x167d('0x14'));var utils=require(_0x167d('0x15'));var config=require(_0x167d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x167d('0x17'))['db'];config['redis']=_[_0x167d('0x18')](config[_0x167d('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x167d('0x1a'))(new Redis(config[_0x167d('0x19')]));require(_0x167d('0x1b'))[_0x167d('0x1c')](socket);var jayson=require(_0x167d('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x167d('0x1e')][_0x167d('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x9752ed,_0x5191bc,_0xdaeefe,_0x47ee94){return new BPromise(function(_0x43fd94,_0x4f056b){var _0xc35ee9=_0x47ee94||client;return _0xc35ee9[_0x167d('0x20')](_0x9752ed,_0xdaeefe)[_0x167d('0x21')](function(_0x49e343){logger[_0x167d('0x22')](_0x167d('0x23'),_0x5191bc,_0x167d('0x24'));logger['debug'](_0x167d('0x25'),_0x5191bc,_0x167d('0x24'),JSON[_0x167d('0x26')](_0x49e343));if(_0x49e343[_0x167d('0x27')]){if(_0x49e343[_0x167d('0x27')][_0x167d('0x28')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x5191bc,_0x49e343[_0x167d('0x27')]['message']);return _0x4f056b(_0x49e343[_0x167d('0x27')][_0x167d('0x29')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x5191bc,_0x49e343[_0x167d('0x27')][_0x167d('0x29')]);return _0x43fd94(_0x49e343[_0x167d('0x27')][_0x167d('0x29')]);}else{logger['info'](_0x167d('0x23'),_0x5191bc,_0x167d('0x24'));_0x43fd94(_0x49e343[_0x167d('0x2a')][_0x167d('0x29')]);}})['catch'](function(_0x36fda8){logger[_0x167d('0x27')](_0x167d('0x23'),_0x5191bc,_0x36fda8);_0x4f056b(_0x36fda8);});});}function respondWithStatusCode(_0x3b1ad3,_0x4530eb){_0x4530eb=_0x4530eb||0xcc;return function(_0x4f09ab){if(_0x4f09ab){return _0x3b1ad3[_0x167d('0x2b')](_0x4530eb);}return _0x3b1ad3['status'](_0x4530eb)[_0x167d('0x2c')]();};}function respondWithResult(_0x143a31,_0x3d5b1c){_0x3d5b1c=_0x3d5b1c||0xc8;return function(_0xb531ce){if(_0xb531ce){return _0x143a31[_0x167d('0x2d')](_0x3d5b1c)[_0x167d('0x2e')](_0xb531ce);}};}function respondWithFilteredResult(_0x581fea,_0x276e1d){return function(_0x481e18){if(_0x481e18){var _0x382851=typeof _0x276e1d[_0x167d('0x2f')]==='undefined'&&typeof _0x276e1d[_0x167d('0x30')]===_0x167d('0x31');var _0x510d13=_0x481e18[_0x167d('0x32')];var _0x5dafc5=_0x382851?0x0:_0x276e1d[_0x167d('0x2f')];var _0x1ab301=_0x382851?_0x481e18[_0x167d('0x32')]:_0x276e1d[_0x167d('0x2f')]+_0x276e1d['limit'];var _0x511118;if(_0x1ab301>=_0x510d13){_0x1ab301=_0x510d13;_0x511118=0xc8;}else{_0x511118=0xce;}_0x581fea[_0x167d('0x2d')](_0x511118);return _0x581fea[_0x167d('0x33')](_0x167d('0x34'),_0x5dafc5+'-'+_0x1ab301+'/'+_0x510d13)[_0x167d('0x2e')](_0x481e18);}return null;};}function patchUpdates(_0x56a230){return function(_0x5d08b0){try{jsonpatch['apply'](_0x5d08b0,_0x56a230,!![]);}catch(_0x287a24){return BPromise[_0x167d('0x35')](_0x287a24);}return _0x5d08b0['save']();};}function saveUpdates(_0x1d1ae0,_0x598912){return function(_0x3d15d3){if(_0x3d15d3){return _0x3d15d3[_0x167d('0x36')](_0x1d1ae0)[_0x167d('0x21')](function(_0x4d7031){return _0x4d7031;});}return null;};}function removeEntity(_0x6fd6dd,_0xaf739c){return function(_0xf0ff0d){if(_0xf0ff0d){return _0xf0ff0d[_0x167d('0x37')]()['then'](function(){var _0x232328=_0xf0ff0d['get']({'plain':!![]});var _0x2f9a9d=_0x167d('0x38');return db[_0x167d('0x39')][_0x167d('0x37')]({'where':{'type':_0x2f9a9d,'resourceId':_0x232328['id']}})[_0x167d('0x21')](function(){return _0xf0ff0d;});})['then'](function(){_0x6fd6dd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x841298,_0x316c06){return function(_0x1df4b4){if(!_0x1df4b4){_0x841298[_0x167d('0x2b')](0x194);}return _0x1df4b4;};}function handleError(_0x2a1723,_0xcb3217){_0xcb3217=_0xcb3217||0x1f4;return function(_0x16fac2){logger[_0x167d('0x27')](_0x16fac2[_0x167d('0x3a')]);if(_0x16fac2[_0x167d('0x3b')]){delete _0x16fac2['name'];}_0x2a1723[_0x167d('0x2d')](_0xcb3217)['send'](_0x16fac2);};}exports[_0x167d('0x3c')]=function(_0xa3ef44,_0x183a4e){var _0x1b6b52={'include':[{'model':db['Pause'],'as':_0x167d('0x3d')}]},_0x2e8c7c={},_0x2c39c7={'count':0x0,'rows':[]};var _0xee6f7a=_[_0x167d('0x3e')](db[_0x167d('0x3f')][_0x167d('0x40')],function(_0x1048d3){return{'name':_0x1048d3[_0x167d('0x41')],'type':_0x1048d3[_0x167d('0x42')]['key']};});_0x2e8c7c[_0x167d('0x43')]=_[_0x167d('0x3e')](_0xee6f7a,_0x167d('0x3b'));_0x2e8c7c[_0x167d('0x44')]=_['keys'](_0xa3ef44[_0x167d('0x44')]);_0x2e8c7c[_0x167d('0x45')]=_['intersection'](_0x2e8c7c['model'],_0x2e8c7c[_0x167d('0x44')]);_0x1b6b52[_0x167d('0x46')]=_['intersection'](_0x2e8c7c[_0x167d('0x43')],qs['fields'](_0xa3ef44[_0x167d('0x44')][_0x167d('0x47')]));_0x1b6b52['attributes']=_0x1b6b52[_0x167d('0x46')]['length']?_0x1b6b52[_0x167d('0x46')]:_0x2e8c7c[_0x167d('0x43')];if(!_0xa3ef44[_0x167d('0x44')][_0x167d('0x48')](_0x167d('0x49'))){_0x1b6b52[_0x167d('0x30')]=qs[_0x167d('0x30')](_0xa3ef44[_0x167d('0x44')][_0x167d('0x30')]);_0x1b6b52[_0x167d('0x2f')]=qs['offset'](_0xa3ef44[_0x167d('0x44')][_0x167d('0x2f')]);}_0x1b6b52[_0x167d('0x4a')]=qs[_0x167d('0x4b')](_0xa3ef44[_0x167d('0x44')][_0x167d('0x4b')]);_0x1b6b52[_0x167d('0x4c')]=qs[_0x167d('0x45')](_[_0x167d('0x4d')](_0xa3ef44[_0x167d('0x44')],_0x2e8c7c[_0x167d('0x45')]),_0xee6f7a);if(_0xa3ef44[_0x167d('0x44')][_0x167d('0x4e')]){_0x1b6b52['where']=_[_0x167d('0x4f')](_0x1b6b52[_0x167d('0x4c')],{'$or':_[_0x167d('0x3e')](_0xee6f7a,function(_0x258a94){if(_0x258a94[_0x167d('0x42')]!==_0x167d('0x50')){var _0x4a94ec={};_0x4a94ec[_0x258a94['name']]={'$like':'%'+_0xa3ef44[_0x167d('0x44')]['filter']+'%'};return _0x4a94ec;}})});}_0x1b6b52=_[_0x167d('0x4f')]({},_0x1b6b52,_0xa3ef44['options']);var _0x10e1b9={'where':_0x1b6b52[_0x167d('0x4c')]};return db[_0x167d('0x3f')][_0x167d('0x32')](_0x10e1b9)[_0x167d('0x21')](function(_0x390e4f){_0x2c39c7[_0x167d('0x32')]=_0x390e4f;if(_0xa3ef44['query'][_0x167d('0x51')]){_0x1b6b52[_0x167d('0x52')]=[{'all':!![]}];}return db[_0x167d('0x3f')][_0x167d('0x53')](_0x1b6b52);})['then'](function(_0x3b5797){_0x2c39c7[_0x167d('0x54')]=_0x3b5797;return _0x2c39c7;})[_0x167d('0x21')](respondWithFilteredResult(_0x183a4e,_0x1b6b52))[_0x167d('0x55')](handleError(_0x183a4e,null));};exports[_0x167d('0x56')]=function(_0x2afd3c,_0x2cb32b){var _0x1cb5d8={'raw':![],'where':{'id':_0x2afd3c[_0x167d('0x57')]['id']},'include':[{'model':db[_0x167d('0x58')],'as':_0x167d('0x3d')}]},_0x216221={};_0x216221[_0x167d('0x43')]=_[_0x167d('0x59')](db[_0x167d('0x3f')][_0x167d('0x40')]);_0x216221[_0x167d('0x44')]=_['keys'](_0x2afd3c[_0x167d('0x44')]);_0x216221[_0x167d('0x45')]=_['intersection'](_0x216221[_0x167d('0x43')],_0x216221[_0x167d('0x44')]);_0x1cb5d8[_0x167d('0x46')]=_[_0x167d('0x5a')](_0x216221[_0x167d('0x43')],qs[_0x167d('0x47')](_0x2afd3c[_0x167d('0x44')]['fields']));_0x1cb5d8[_0x167d('0x46')]=_0x1cb5d8[_0x167d('0x46')][_0x167d('0x5b')]?_0x1cb5d8[_0x167d('0x46')]:_0x216221[_0x167d('0x43')];if(_0x2afd3c['query'][_0x167d('0x51')]){_0x1cb5d8[_0x167d('0x52')]=[{'all':!![]}];}_0x1cb5d8=_['merge']({},_0x1cb5d8,_0x2afd3c[_0x167d('0x5c')]);return db[_0x167d('0x3f')][_0x167d('0x5d')](_0x1cb5d8)[_0x167d('0x21')](handleEntityNotFound(_0x2cb32b,null))[_0x167d('0x21')](respondWithResult(_0x2cb32b,null))[_0x167d('0x55')](handleError(_0x2cb32b,null));};exports[_0x167d('0x5e')]=function(_0x2a7ebb,_0x375ca4){return db['OpenchannelAccount'][_0x167d('0x5e')](_0x2a7ebb['body'],{})[_0x167d('0x21')](function(_0x2ddcb6){var _0x51e87e=_0x2a7ebb['user'][_0x167d('0x5f')]({'plain':!![]});if(!_0x51e87e)throw new Error(_0x167d('0x60'));if(_0x51e87e['role']===_0x167d('0x61')){var _0x52b2e5=_0x2ddcb6[_0x167d('0x5f')]({'plain':!![]});var _0x28cd07=_0x167d('0x38');return db[_0x167d('0x62')][_0x167d('0x5d')]({'where':{'name':_0x28cd07,'userProfileId':_0x51e87e[_0x167d('0x63')]},'raw':!![]})['then'](function(_0x425f8f){if(_0x425f8f&&_0x425f8f[_0x167d('0x64')]===0x0){return db[_0x167d('0x39')][_0x167d('0x5e')]({'name':_0x52b2e5[_0x167d('0x3b')],'resourceId':_0x52b2e5['id'],'type':_0x425f8f['name'],'sectionId':_0x425f8f['id']},{})['then'](function(){return _0x2ddcb6;});}else{return _0x2ddcb6;}})[_0x167d('0x55')](function(_0x26475a){logger[_0x167d('0x27')](_0x167d('0x65'),_0x26475a);throw _0x26475a;});}return _0x2ddcb6;})[_0x167d('0x21')](respondWithResult(_0x375ca4,0xc9))[_0x167d('0x55')](handleError(_0x375ca4,null));};exports['update']=function(_0xc86e2,_0x2cec70){if(_0xc86e2[_0x167d('0x66')]['id']){delete _0xc86e2[_0x167d('0x66')]['id'];}return db[_0x167d('0x3f')][_0x167d('0x5d')]({'where':{'id':_0xc86e2[_0x167d('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x167d('0x3d')}]})[_0x167d('0x21')](handleEntityNotFound(_0x2cec70,null))[_0x167d('0x21')](saveUpdates(_0xc86e2[_0x167d('0x66')],null))['then'](respondWithResult(_0x2cec70,null))[_0x167d('0x55')](handleError(_0x2cec70,null));};exports[_0x167d('0x37')]=function(_0x53c2da,_0x1a1598){return db[_0x167d('0x3f')][_0x167d('0x5d')]({'where':{'id':_0x53c2da[_0x167d('0x57')]['id']}})[_0x167d('0x21')](handleEntityNotFound(_0x1a1598,null))['then'](removeEntity(_0x1a1598,null))[_0x167d('0x55')](handleError(_0x1a1598,null));};exports['describe']=function(_0x2dc53d,_0x42b194){return db[_0x167d('0x3f')]['describe']()[_0x167d('0x21')](respondWithResult(_0x42b194,null))[_0x167d('0x55')](handleError(_0x42b194,null));};exports[_0x167d('0x67')]=function(_0x4370ff,_0x106d77,_0x37cf06){if(_0x4370ff[_0x167d('0x66')]['id']){delete _0x4370ff[_0x167d('0x66')]['id'];}return db[_0x167d('0x3f')][_0x167d('0x5d')]({'where':{'id':_0x4370ff['params']['id']}})['then'](handleEntityNotFound(_0x106d77,null))[_0x167d('0x21')](function(_0x1745ed){if(_0x1745ed){_0x4370ff[_0x167d('0x66')][_0x167d('0x68')]=_0x1745ed['id'];return db[_0x167d('0x69')][_0x167d('0x5e')](_0x4370ff[_0x167d('0x66')]);}})[_0x167d('0x21')](respondWithResult(_0x106d77,null))[_0x167d('0x55')](handleError(_0x106d77,null));};exports[_0x167d('0x6a')]=function(_0x5b9e22,_0x59ee26,_0x18c1df){var _0x3aac77={'raw':![],'where':{}};var _0x25f79e={};var _0x556bf5={'count':0x0,'rows':[]};return db[_0x167d('0x3f')][_0x167d('0x6b')]({'where':{'id':_0x5b9e22['params']['id']}})['then'](handleEntityNotFound(_0x59ee26,null))[_0x167d('0x21')](function(_0x21b941){if(_0x21b941){_0x25f79e[_0x167d('0x43')]=_['keys'](db[_0x167d('0x69')][_0x167d('0x40')]);_0x25f79e[_0x167d('0x44')]=_[_0x167d('0x59')](_0x5b9e22[_0x167d('0x44')]);_0x25f79e[_0x167d('0x45')]=_[_0x167d('0x5a')](_0x25f79e[_0x167d('0x43')],_0x25f79e[_0x167d('0x44')]);_0x3aac77[_0x167d('0x46')]=_['intersection'](_0x25f79e['model'],qs[_0x167d('0x47')](_0x5b9e22[_0x167d('0x44')][_0x167d('0x47')]));_0x3aac77[_0x167d('0x46')]=_0x3aac77[_0x167d('0x46')][_0x167d('0x5b')]?_0x3aac77[_0x167d('0x46')]:_0x25f79e[_0x167d('0x43')];if(!_0x5b9e22[_0x167d('0x44')][_0x167d('0x48')](_0x167d('0x49'))){_0x3aac77[_0x167d('0x30')]=qs['limit'](_0x5b9e22[_0x167d('0x44')][_0x167d('0x30')]);_0x3aac77[_0x167d('0x2f')]=qs[_0x167d('0x2f')](_0x5b9e22[_0x167d('0x44')][_0x167d('0x2f')]);}_0x3aac77[_0x167d('0x4a')]=qs[_0x167d('0x4b')](_0x5b9e22['query']['sort']);_0x3aac77[_0x167d('0x4c')]=qs[_0x167d('0x45')](_[_0x167d('0x4d')](_0x5b9e22[_0x167d('0x44')],_0x25f79e[_0x167d('0x45')]));_0x3aac77[_0x167d('0x4c')][_0x167d('0x68')]=_0x21b941['id'];if(_0x5b9e22[_0x167d('0x44')][_0x167d('0x4e')]){_0x3aac77[_0x167d('0x4c')]=_['merge'](_0x3aac77[_0x167d('0x4c')],{'$or':_['map'](_0x3aac77[_0x167d('0x46')],function(_0x4957f5){var _0x449a97={};_0x449a97[_0x4957f5]={'$like':'%'+_0x5b9e22[_0x167d('0x44')]['filter']+'%'};return _0x449a97;})});}_0x3aac77=_['merge']({},_0x3aac77,_0x5b9e22[_0x167d('0x5c')]);return db[_0x167d('0x69')]['count']({'where':_0x3aac77['where']})[_0x167d('0x21')](function(_0x1aa2c2){_0x556bf5[_0x167d('0x32')]=_0x1aa2c2;if(_0x5b9e22[_0x167d('0x44')][_0x167d('0x51')]){_0x3aac77[_0x167d('0x52')]=[{'all':!![]}];}return db[_0x167d('0x69')][_0x167d('0x53')](_0x3aac77);})['then'](function(_0x3f8b23){_0x556bf5[_0x167d('0x54')]=_0x3f8b23;return _0x556bf5;});}})[_0x167d('0x21')](respondWithFilteredResult(_0x59ee26,_0x3aac77))['catch'](handleError(_0x59ee26,null));};exports[_0x167d('0x6c')]=function(_0x5724e0,_0x577a7f,_0x1924bb){return db[_0x167d('0x3f')][_0x167d('0x5d')]({'where':{'id':_0x5724e0[_0x167d('0x57')]['id']}})[_0x167d('0x21')](handleEntityNotFound(_0x577a7f,null))[_0x167d('0x21')](function(_0x358d55){if(_0x358d55){return _0x358d55['removeDispositions'](_0x5724e0[_0x167d('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x577a7f,null))[_0x167d('0x55')](handleError(_0x577a7f,null));};exports[_0x167d('0x6d')]=function(_0x2e775f,_0x1d5f82,_0x7b5ae4){if(_0x2e775f[_0x167d('0x66')]['id']){delete _0x2e775f[_0x167d('0x66')]['id'];}return db['OpenchannelAccount'][_0x167d('0x5d')]({'where':{'id':_0x2e775f['params']['id']}})[_0x167d('0x21')](handleEntityNotFound(_0x1d5f82,null))[_0x167d('0x21')](function(_0x340d7b){if(_0x340d7b){_0x2e775f[_0x167d('0x66')][_0x167d('0x68')]=_0x340d7b['id'];return db[_0x167d('0x6e')]['create'](_0x2e775f[_0x167d('0x66')]);}})['then'](respondWithResult(_0x1d5f82,null))[_0x167d('0x55')](handleError(_0x1d5f82,null));};exports[_0x167d('0x6f')]=function(_0x2e48a7,_0x418d8c,_0xd25798){var _0x35f399={'raw':![],'where':{}};var _0x3bcb2d={};var _0x55ddb6={'count':0x0,'rows':[]};return db[_0x167d('0x3f')][_0x167d('0x6b')]({'where':{'id':_0x2e48a7[_0x167d('0x57')]['id']}})[_0x167d('0x21')](handleEntityNotFound(_0x418d8c,null))['then'](function(_0x3bbcee){if(_0x3bbcee){_0x3bcb2d[_0x167d('0x43')]=_['keys'](db['CannedAnswer'][_0x167d('0x40')]);_0x3bcb2d['query']=_['keys'](_0x2e48a7[_0x167d('0x44')]);_0x3bcb2d['filters']=_[_0x167d('0x5a')](_0x3bcb2d['model'],_0x3bcb2d[_0x167d('0x44')]);_0x35f399[_0x167d('0x46')]=_['intersection'](_0x3bcb2d[_0x167d('0x43')],qs[_0x167d('0x47')](_0x2e48a7[_0x167d('0x44')][_0x167d('0x47')]));_0x35f399[_0x167d('0x46')]=_0x35f399[_0x167d('0x46')][_0x167d('0x5b')]?_0x35f399[_0x167d('0x46')]:_0x3bcb2d['model'];if(!_0x2e48a7[_0x167d('0x44')]['hasOwnProperty'](_0x167d('0x49'))){_0x35f399[_0x167d('0x30')]=qs['limit'](_0x2e48a7[_0x167d('0x44')][_0x167d('0x30')]);_0x35f399[_0x167d('0x2f')]=qs['offset'](_0x2e48a7['query']['offset']);}_0x35f399[_0x167d('0x4a')]=qs[_0x167d('0x4b')](_0x2e48a7[_0x167d('0x44')][_0x167d('0x4b')]);_0x35f399['where']=qs[_0x167d('0x45')](_[_0x167d('0x4d')](_0x2e48a7[_0x167d('0x44')],_0x3bcb2d['filters']));_0x35f399[_0x167d('0x4c')][_0x167d('0x68')]=_0x3bbcee['id'];if(_0x2e48a7['query']['filter']){_0x35f399['where']=_[_0x167d('0x4f')](_0x35f399['where'],{'$or':_[_0x167d('0x3e')](_0x35f399['attributes'],function(_0xdcd0f6){var _0x306aee={};_0x306aee[_0xdcd0f6]={'$like':'%'+_0x2e48a7[_0x167d('0x44')][_0x167d('0x4e')]+'%'};return _0x306aee;})});}_0x35f399=_[_0x167d('0x4f')]({},_0x35f399,_0x2e48a7[_0x167d('0x5c')]);return db[_0x167d('0x6e')][_0x167d('0x32')]({'where':_0x35f399[_0x167d('0x4c')]})[_0x167d('0x21')](function(_0x3f55a5){_0x55ddb6[_0x167d('0x32')]=_0x3f55a5;if(_0x2e48a7[_0x167d('0x44')][_0x167d('0x51')]){_0x35f399[_0x167d('0x52')]=[{'all':!![]}];}return db[_0x167d('0x6e')]['findAll'](_0x35f399);})[_0x167d('0x21')](function(_0x480068){_0x55ddb6[_0x167d('0x54')]=_0x480068;return _0x55ddb6;});}})['then'](respondWithFilteredResult(_0x418d8c,_0x35f399))['catch'](handleError(_0x418d8c,null));};exports['removeAnswers']=function(_0x110f26,_0x359dab,_0x2a2f50){return db[_0x167d('0x3f')][_0x167d('0x5d')]({'where':{'id':_0x110f26['params']['id']}})['then'](handleEntityNotFound(_0x359dab,null))[_0x167d('0x21')](function(_0x30f482){if(_0x30f482){return _0x30f482[_0x167d('0x70')](_0x110f26[_0x167d('0x44')][_0x167d('0x71')]);}})[_0x167d('0x21')](respondWithStatusCode(_0x359dab,null))[_0x167d('0x55')](handleError(_0x359dab,null));};exports[_0x167d('0x72')]=function(_0x533fa5,_0x377c38,_0x36dff7){var _0x3ad5bf={'body':_0x533fa5[_0x167d('0x66')],'channel':_0x167d('0x73')};var _0x492176=[];var _0x33508f=[];var _0x4b0522={};var _0x533b48=![];return db[_0x167d('0x74')][_0x167d('0x75')]()[_0x167d('0x21')](function(_0x4518f0){if(!_0x4518f0){throw new db['Sequelize'][(_0x167d('0x76'))](_0x167d('0x77'));}_0x492176=_[_0x167d('0x78')](_['keys'](_0x4518f0),[_0x167d('0x79'),_0x167d('0x7a')]);_0x33508f=_[_0x167d('0x78')](_[_0x167d('0x59')](_0x4518f0),['createdAt','updatedAt',_0x167d('0x7b'),_0x167d('0x7c')]);if(_0x533fa5[_0x167d('0x66')]['id']){delete _0x533fa5[_0x167d('0x66')]['id'];}if(_[_0x167d('0x7d')](_0x533fa5[_0x167d('0x66')][_0x167d('0x7e')])){throw new db[(_0x167d('0x7f'))][(_0x167d('0x76'))](_0x167d('0x80'));}if(_[_0x167d('0x7d')](_0x533fa5[_0x167d('0x66')][_0x167d('0x66')])||_0x533fa5[_0x167d('0x66')]['body']===''){throw new db[(_0x167d('0x7f'))][(_0x167d('0x76'))](_0x167d('0x81'));}if(_['isNil'](_0x533fa5[_0x167d('0x66')][_0x167d('0x82')])){throw new db['Sequelize'][(_0x167d('0x76'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x33508f);}if(!_[_0x167d('0x83')](_0x33508f,_0x533fa5[_0x167d('0x66')]['mapKey'])){throw new db[(_0x167d('0x7f'))][(_0x167d('0x76'))](_0x167d('0x84')+_0x33508f);}_0x4b0522[_0x533fa5[_0x167d('0x66')]['mapKey']]=_0x533fa5['body'][_0x167d('0x7e')];})[_0x167d('0x21')](function(){return db['OpenchannelAccount'][_0x167d('0x5d')]({'where':{'id':_0x533fa5[_0x167d('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0x167d('0x85'),'include':[{'model':db[_0x167d('0x74')],'as':_0x167d('0x86'),'where':_0x4b0522,'limit':0x1,'order':[[_0x167d('0x7a'),_0x167d('0x87')]]}]},{'model':db[_0x167d('0x88')],'as':_0x167d('0x89')}]});})[_0x167d('0x21')](handleEntityNotFound(_0x377c38,null))[_0x167d('0x21')](function(_0x2c19dc){if(_0x2c19dc&&_0x2c19dc[_0x167d('0x85')]){_0x3ad5bf[_0x167d('0x8a')]=_0x2c19dc;_0x3ad5bf[_0x167d('0x8b')]=_0x2c19dc[_0x167d('0x89')];_0x3ad5bf[_0x167d('0x8c')]=_0x2c19dc[_0x167d('0x85')];_0x3ad5bf[_0x167d('0x8b')]=_[_0x167d('0x8d')](_0x3ad5bf[_0x167d('0x8b')],['priority'],[_0x167d('0x8e')]);if(_0x3ad5bf[_0x167d('0x8a')]['Applications']){delete _0x3ad5bf[_0x167d('0x8a')][_0x167d('0x89')];}if(_0x3ad5bf[_0x167d('0x8a')][_0x167d('0x85')]&&_0x3ad5bf['account'][_0x167d('0x85')][_0x167d('0x86')]['length']){return _0x3ad5bf['account'][_0x167d('0x85')][_0x167d('0x86')][0x0];}var _0x584afa=_[_0x167d('0x18')](_0x533fa5[_0x167d('0x66')],{'firstName':_0x533fa5[_0x167d('0x66')]['from'],'ListId':_0x2c19dc[_0x167d('0x7c')]});_0x584afa[_0x533fa5[_0x167d('0x66')][_0x167d('0x82')]]=_0x533fa5[_0x167d('0x66')][_0x167d('0x7e')];return db[_0x167d('0x74')]['create'](_0x584afa,{'fields':_0x492176,'raw':!![]});}})[_0x167d('0x21')](handleEntityNotFound(_0x377c38,null))[_0x167d('0x21')](function(_0x2bad69){_0x3ad5bf[_0x167d('0x8f')]=_0x2bad69;if(_0x2bad69){var _0x5163d0={'ContactId':_0x2bad69['id'],'OpenchannelAccountId':_0x533fa5[_0x167d('0x57')]['id'],'from':(_0x2bad69[_0x167d('0x90')]||'')+'\x20'+(_0x2bad69['lastName']||'')};var _0x441163={'OpenchannelAccountId':_0x533fa5[_0x167d('0x57')]['id'],'closed':![]};if(_0x533fa5[_0x167d('0x66')][_0x167d('0x91')]){_0x441163['threadId']=_0x533fa5[_0x167d('0x66')]['threadId'];return db[_0x167d('0x92')][_0x167d('0x5d')]({'where':_0x441163})['then'](function(_0x55e0df){if(_0x55e0df){return[_0x55e0df,![]];}_0x5163d0['threadId']=_0x533fa5['body']['threadId'];_0x5163d0[_0x167d('0x93')]=_0x533fa5[_0x167d('0x66')]['externalUrl'];return db[_0x167d('0x92')][_0x167d('0x5e')](_0x5163d0)[_0x167d('0x21')](function(_0x29bcd5){return[_0x29bcd5,!![]];});});}else{_0x441163['threadId']=null;}_0x441163[_0x167d('0x94')]=_0x2bad69['id'];return db[_0x167d('0x92')]['find']({'where':_0x441163})[_0x167d('0x21')](function(_0x73f554){if(_0x73f554){return[_0x73f554,![]];}return db[_0x167d('0x92')][_0x167d('0x5e')](_0x5163d0)[_0x167d('0x21')](function(_0x2b26f0){return[_0x2b26f0,!![]];});});}})[_0x167d('0x95')](function(_0x3289d0,_0x5f46e0){if(_0x3289d0){_0x533b48=_0x5f46e0;if(!_0x5f46e0){var _0x139d4c={'from':(_0x3ad5bf[_0x167d('0x8f')][_0x167d('0x90')]||'')+'\x20'+(_0x3ad5bf[_0x167d('0x8f')][_0x167d('0x96')]||'')};if(_0x533fa5[_0x167d('0x66')]['threadId']&&_0x533fa5[_0x167d('0x66')][_0x167d('0x97')]&&_0x533fa5[_0x167d('0x66')][_0x167d('0x91')]!=_0x533fa5[_0x167d('0x66')][_0x167d('0x97')]){_0x139d4c[_0x167d('0x91')]=_0x533fa5['body'][_0x167d('0x97')];}return _0x3289d0[_0x167d('0x36')](_0x139d4c);}else{return _0x3289d0;}}})[_0x167d('0x21')](function(_0x3802bc){_0x3ad5bf[_0x167d('0x98')]=_0x3802bc[_0x167d('0x5f')]({'plain':!![]});_0x3ad5bf['interaction'][_0x167d('0x99')]=_0x533b48;if(_0x3ad5bf[_0x167d('0x98')][_0x167d('0x99')]){if(_0x3ad5bf['account'][_0x167d('0x9a')]){_0x3ad5bf[_0x167d('0x8b')][_0x167d('0x9b')]({'id':0x0,'priority':_0x3ad5bf[_0x167d('0x8b')]['length']+0x1,'app':'close','appdata':_0x167d('0x9c'),'interval':_0x167d('0x9d')});}}return db['OpenchannelMessage'][_0x167d('0x5e')]({'body':_0x533fa5['body'][_0x167d('0x66')],'OpenchannelAccountId':_0x533fa5[_0x167d('0x57')]['id'],'OpenchannelInteractionId':_0x3802bc['id'],'direction':'in','ContactId':_0x3ad5bf[_0x167d('0x8f')]['id'],'AttachmentId':_0x533fa5['body']['AttachmentId']});})['then'](function(_0x367c1a){_0x3ad5bf[_0x167d('0x29')]=_0x367c1a;if(!_0x3ad5bf[_0x167d('0x98')]['UserId'])return;return db[_0x167d('0x9e')][_0x167d('0x5d')]({'attributes':['id','name'],'where':{'id':_0x3ad5bf[_0x167d('0x98')]['UserId']}});})['then'](function(_0x14b8ad){if(_0x14b8ad){_0x3ad5bf[_0x167d('0x8b')][_0x167d('0x9f')]({'id':0x0,'priority':0x0,'app':_0x167d('0xa0'),'appdata':_0x14b8ad['name']+','+(_0x3ad5bf[_0x167d('0x8a')][_0x167d('0xa1')]||0xa),'interval':_0x167d('0x9d')});}if(!_0x3ad5bf[_0x167d('0x98')][_0x167d('0xa2')])return;return db[_0x167d('0xa3')][_0x167d('0x5d')]({'attributes':['id',_0x167d('0x3b')],'where':{'id':_0x3ad5bf[_0x167d('0x98')][_0x167d('0xa2')]}});})['then'](function(_0x2e3e85){if(_0x2e3e85){_0x3ad5bf['applications'][_0x167d('0x9f')]({'id':0x0,'priority':0x1,'app':_0x167d('0xa4'),'appdata':_0x2e3e85[_0x167d('0x3b')]+','+(_0x3ad5bf['account'][_0x167d('0xa5')]||0x12c),'interval':_0x167d('0x9d')});}return respondWithRpcPromise(_0x167d('0xa6'),_0x167d('0xa7'),_0x3ad5bf);})[_0x167d('0x21')](function(_0xb84580){respondWithRpcPromise(_0x167d('0xa8'),_0x167d('0xa8'),{'event':_0x167d('0x72'),'message':_0xb84580},client9002);return _0xb84580;})[_0x167d('0x21')](respondWithResult(_0x377c38,null))['catch'](handleError(_0x377c38,null));};exports[_0x167d('0xa9')]=function(_0x32fd95,_0x3666f2){var _0x45293a=_0x32fd95[_0x167d('0x57')]['id'];var _0x2e21b=_0x32fd95[_0x167d('0x66')];var _0x5e4c02=0xc8;var _0x14a53a=null;return db[_0x167d('0xaa')][_0x167d('0xab')]({'isolationLevel':db[_0x167d('0xaa')][_0x167d('0xac')][_0x167d('0xad')][_0x167d('0xae')]},function(_0x5e8c43){return db[_0x167d('0x3f')][_0x167d('0x6b')]({'where':{'id':_0x45293a},'transaction':_0x5e8c43})['then'](function(_0x105f63){if(_0x105f63){return db[_0x167d('0x88')][_0x167d('0x37')]({'where':{'OpenchannelAccountId':_0x45293a},'transaction':_0x5e8c43})[_0x167d('0x21')](function(){var _0x4a1ca3=_[_0x167d('0x3e')](_0x2e21b,function(_0x70f681){_0x70f681[_0x167d('0x68')]=_0x45293a;return _0x70f681;});return db[_0x167d('0x88')]['bulkCreate'](_0x4a1ca3,{'transaction':_0x5e8c43});});}else{_0x5e4c02=0x194;_0x14a53a=[];}});})[_0x167d('0x21')](function(){if(_0x5e4c02!==0x194){return db['OpenchannelApplication'][_0x167d('0xaf')]({'where':{'OpenchannelAccountId':_0x45293a},'order':_0x167d('0xb0')})[_0x167d('0x21')](function(_0x1aceb0){_0x14a53a=_0x1aceb0;});}})[_0x167d('0x55')](function(_0x4c6484){_0x5e4c02=0x1f4;logger[_0x167d('0x27')](_0x4c6484[_0x167d('0x3a')]);if(_0x4c6484[_0x167d('0x3b')]){delete _0x4c6484[_0x167d('0x3b')];}_0x14a53a=_0x4c6484;})[_0x167d('0xb1')](function(){if(_0x14a53a===null){_0x3666f2[_0x167d('0x2b')](_0x5e4c02);}else{if(_0x5e4c02===0x1f4){_0x3666f2['status'](_0x5e4c02)[_0x167d('0xb2')](_0x14a53a);}else{_0x3666f2[_0x167d('0x2d')](_0x5e4c02)['json'](_0x14a53a);}}});};exports[_0x167d('0xb3')]=function(_0x5b5002,_0xabdd4e,_0x255fb1){var _0x3df0bf={};var _0x4af6e4={};var _0x6d0578;var _0x312ff6;return db['OpenchannelAccount'][_0x167d('0x6b')]({'where':{'id':_0x5b5002[_0x167d('0x57')]['id']}})['then'](handleEntityNotFound(_0xabdd4e,null))[_0x167d('0x21')](function(_0x38c6df){if(_0x38c6df){_0x6d0578=_0x38c6df;_0x4af6e4[_0x167d('0x43')]=_[_0x167d('0x59')](db[_0x167d('0x88')][_0x167d('0x40')]);_0x4af6e4['query']=_[_0x167d('0x59')](_0x5b5002[_0x167d('0x44')]);_0x4af6e4['filters']=_[_0x167d('0x5a')](_0x4af6e4['model'],_0x4af6e4[_0x167d('0x44')]);_0x3df0bf['attributes']=_[_0x167d('0x5a')](_0x4af6e4[_0x167d('0x43')],qs[_0x167d('0x47')](_0x5b5002[_0x167d('0x44')][_0x167d('0x47')]));_0x3df0bf[_0x167d('0x46')]=_0x3df0bf[_0x167d('0x46')]['length']?_0x3df0bf['attributes']:_0x4af6e4[_0x167d('0x43')];_0x3df0bf[_0x167d('0x4a')]=qs[_0x167d('0x4b')](_0x5b5002[_0x167d('0x44')][_0x167d('0x4b')]);_0x3df0bf[_0x167d('0x4c')]=qs[_0x167d('0x45')](_['pick'](_0x5b5002['query'],_0x4af6e4[_0x167d('0x45')]));if(_0x5b5002[_0x167d('0x44')][_0x167d('0x4e')]){_0x3df0bf[_0x167d('0x4c')]=_[_0x167d('0x4f')](_0x3df0bf[_0x167d('0x4c')],{'$or':_[_0x167d('0x3e')](_0x3df0bf[_0x167d('0x46')],function(_0x26954d){var _0x5b7649={};_0x5b7649[_0x26954d]={'$like':'%'+_0x5b5002[_0x167d('0x44')]['filter']+'%'};return _0x5b7649;})});}_0x3df0bf=_['merge']({},_0x3df0bf,_0x5b5002[_0x167d('0x5c')]);return _0x6d0578[_0x167d('0xb3')](_0x3df0bf);}})[_0x167d('0x21')](function(_0x2882cf){if(_0x2882cf){_0x312ff6=_0x2882cf[_0x167d('0x5b')];if(!_0x5b5002['query'][_0x167d('0x48')](_0x167d('0x49'))){_0x3df0bf[_0x167d('0x30')]=qs[_0x167d('0x30')](_0x5b5002[_0x167d('0x44')][_0x167d('0x30')]);_0x3df0bf[_0x167d('0x2f')]=qs[_0x167d('0x2f')](_0x5b5002['query'][_0x167d('0x2f')]);}return _0x6d0578[_0x167d('0xb3')](_0x3df0bf);}})[_0x167d('0x21')](function(_0x1fe657){if(_0x1fe657){return _0x1fe657?{'count':_0x312ff6,'rows':_0x1fe657}:null;}})[_0x167d('0x21')](respondWithResult(_0xabdd4e,null))[_0x167d('0x55')](handleError(_0xabdd4e,null));};exports[_0x167d('0xb4')]=function(_0x5a7db7,_0x17d09b,_0x5ad587){var _0xf8072f={'raw':![],'where':{}};var _0x129cb1={};var _0x19b3a3={'count':0x0,'rows':[]};return db[_0x167d('0x3f')]['findOne']({'where':{'id':_0x5a7db7[_0x167d('0x57')]['id']}})[_0x167d('0x21')](handleEntityNotFound(_0x17d09b,null))[_0x167d('0x21')](function(_0x16ae8c){if(_0x16ae8c){_0x129cb1[_0x167d('0x43')]=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x129cb1[_0x167d('0x44')]=_[_0x167d('0x59')](_0x5a7db7[_0x167d('0x44')]);_0x129cb1[_0x167d('0x45')]=_[_0x167d('0x5a')](_0x129cb1[_0x167d('0x43')],_0x129cb1[_0x167d('0x44')]);_0xf8072f[_0x167d('0x46')]=_[_0x167d('0x5a')](_0x129cb1[_0x167d('0x43')],qs[_0x167d('0x47')](_0x5a7db7['query']['fields']));_0xf8072f[_0x167d('0x46')]=_0xf8072f['attributes']['length']?_0xf8072f['attributes']:_0x129cb1[_0x167d('0x43')];if(!_0x5a7db7[_0x167d('0x44')][_0x167d('0x48')](_0x167d('0x49'))){_0xf8072f['limit']=qs[_0x167d('0x30')](_0x5a7db7[_0x167d('0x44')]['limit']);_0xf8072f[_0x167d('0x2f')]=qs[_0x167d('0x2f')](_0x5a7db7['query'][_0x167d('0x2f')]);}_0xf8072f[_0x167d('0x4a')]=qs['sort'](_0x5a7db7[_0x167d('0x44')][_0x167d('0x4b')]);_0xf8072f[_0x167d('0x4c')]=qs['filters'](_[_0x167d('0x4d')](_0x5a7db7['query'],_0x129cb1[_0x167d('0x45')]));_0xf8072f[_0x167d('0x4c')][_0x167d('0x68')]=_0x16ae8c['id'];if(_0x5a7db7[_0x167d('0x44')]['filter']){_0xf8072f[_0x167d('0x4c')]=_[_0x167d('0x4f')](_0xf8072f[_0x167d('0x4c')],{'$or':_[_0x167d('0x3e')](_0xf8072f['attributes'],function(_0x261faa){var _0x5bf95e={};_0x5bf95e[_0x261faa]={'$like':'%'+_0x5a7db7[_0x167d('0x44')][_0x167d('0x4e')]+'%'};return _0x5bf95e;})});}_0xf8072f=_['merge']({},_0xf8072f,_0x5a7db7['options']);return db['OpenchannelInteraction'][_0x167d('0x32')]({'where':_0xf8072f[_0x167d('0x4c')]})[_0x167d('0x21')](function(_0x1b3ece){_0x19b3a3[_0x167d('0x32')]=_0x1b3ece;if(_0x5a7db7[_0x167d('0x44')][_0x167d('0x51')]){_0xf8072f[_0x167d('0x52')]=[{'model':db[_0x167d('0x74')],'as':_0x167d('0xb5'),'required':![]},{'model':db[_0x167d('0x9e')],'as':_0x167d('0xb6'),'attributes':[_0x167d('0x3b'),_0x167d('0xb7'),_0x167d('0xb8')],'required':![]},{'model':db['Tag'],'as':_0x167d('0xb9'),'attributes':['id',_0x167d('0x3b'),_0x167d('0xba')],'where':_0x5a7db7[_0x167d('0x44')]['tag']?{'id':_0x5a7db7[_0x167d('0x44')]['tag']}:undefined,'required':_0x5a7db7[_0x167d('0x44')][_0x167d('0xbb')]?!![]:![]}];}return db[_0x167d('0x92')][_0x167d('0x53')](_0xf8072f);})['then'](function(_0xefe99c){_0x19b3a3['rows']=_0xefe99c;return _0x19b3a3;});}})['then'](respondWithFilteredResult(_0x17d09b,_0xf8072f))['catch'](handleError(_0x17d09b,null));};exports[_0x167d('0xbc')]=function(_0x430f1c,_0x45c412,_0x13bc4e){return db[_0x167d('0x3f')][_0x167d('0x5d')]({'where':{'id':_0x430f1c['params']['id']}})[_0x167d('0x21')](handleEntityNotFound(_0x45c412,null))['then'](function(_0x2ca645){if(_0x2ca645){return _0x2ca645[_0x167d('0xbc')](_0x430f1c[_0x167d('0x66')][_0x167d('0x71')],_[_0x167d('0xbd')](_0x430f1c[_0x167d('0x66')],[_0x167d('0x71'),'id'])||{})['spread'](function(_0x2a443c){for(var _0x3714eb=0x0;_0x3714eb<_0x430f1c['body']['ids']['length'];_0x3714eb+=0x1){socket[_0x167d('0xbe')]('userOpenchannelAccount:save',{'UserId':Number(_0x430f1c[_0x167d('0x66')][_0x167d('0x71')][_0x3714eb]),'OpenchannelAccountId':Number(_0x430f1c[_0x167d('0x57')]['id'])});}return _0x2a443c;});}})[_0x167d('0x21')](respondWithResult(_0x45c412,null))[_0x167d('0x55')](handleError(_0x45c412,null));};exports['removeAgents']=function(_0x2bf911,_0x3208d3,_0x4c8bd9){return db['OpenchannelAccount'][_0x167d('0x5d')]({'where':{'id':_0x2bf911[_0x167d('0x57')]['id']}})[_0x167d('0x21')](handleEntityNotFound(_0x3208d3,null))[_0x167d('0x21')](function(_0x306d35){if(_0x306d35){return _0x306d35[_0x167d('0xbf')](_0x2bf911[_0x167d('0x44')]['ids'])[_0x167d('0x21')](function(){if(_[_0x167d('0xc0')](_0x2bf911[_0x167d('0x44')][_0x167d('0x71')])){for(var _0x515c41=0x0;_0x515c41<_0x2bf911['query']['ids'][_0x167d('0x5b')];_0x515c41+=0x1){socket[_0x167d('0xbe')]('userOpenchannelAccount:remove',{'UserId':Number(_0x2bf911['query']['ids'][_0x515c41]),'OpenchannelAccountId':Number(_0x2bf911[_0x167d('0x57')]['id'])});}}else{socket[_0x167d('0xbe')]('userOpenchannelAccount:remove',{'UserId':Number(_0x2bf911[_0x167d('0x44')][_0x167d('0x71')]),'OpenchannelAccountId':Number(_0x2bf911[_0x167d('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x3208d3,null))['catch'](handleError(_0x3208d3,null));};exports[_0x167d('0xc1')]=function(_0x21cab2,_0x163758,_0x27f61e){var _0x57f405={};var _0x3994b3={};var _0x10dd42;var _0x231578;return db[_0x167d('0x3f')][_0x167d('0x6b')]({'where':{'id':_0x21cab2['params']['id']}})[_0x167d('0x21')](handleEntityNotFound(_0x163758,null))['then'](function(_0x1a66b1){if(_0x1a66b1){_0x10dd42=_0x1a66b1;_0x3994b3[_0x167d('0x43')]=_['keys'](db[_0x167d('0x9e')][_0x167d('0x40')]);_0x3994b3[_0x167d('0x44')]=_[_0x167d('0x59')](_0x21cab2[_0x167d('0x44')]);_0x3994b3[_0x167d('0x45')]=_['intersection'](_0x3994b3[_0x167d('0x43')],_0x3994b3[_0x167d('0x44')]);_0x57f405[_0x167d('0x46')]=_['intersection'](_0x3994b3[_0x167d('0x43')],qs[_0x167d('0x47')](_0x21cab2[_0x167d('0x44')]['fields']));_0x57f405[_0x167d('0x46')]=_0x57f405[_0x167d('0x46')]['length']?_0x57f405[_0x167d('0x46')]:_0x3994b3['model'];_0x57f405[_0x167d('0x4a')]=qs[_0x167d('0x4b')](_0x21cab2[_0x167d('0x44')]['sort']);_0x57f405[_0x167d('0x4c')]=qs[_0x167d('0x45')](_[_0x167d('0x4d')](_0x21cab2[_0x167d('0x44')],_0x3994b3[_0x167d('0x45')]));if(_0x21cab2[_0x167d('0x44')][_0x167d('0x4e')]){_0x57f405[_0x167d('0x4c')]=_[_0x167d('0x4f')](_0x57f405[_0x167d('0x4c')],{'$or':_[_0x167d('0x3e')](_0x57f405['attributes'],function(_0x2d7bf1){var _0x2a4ed1={};_0x2a4ed1[_0x2d7bf1]={'$like':'%'+_0x21cab2[_0x167d('0x44')][_0x167d('0x4e')]+'%'};return _0x2a4ed1;})});}_0x57f405=_[_0x167d('0x4f')]({},_0x57f405,_0x21cab2[_0x167d('0x5c')]);return _0x10dd42[_0x167d('0xc1')](_0x57f405);}})['then'](function(_0xa8c5b){if(_0xa8c5b){_0x231578=_0xa8c5b[_0x167d('0x5b')];if(!_0x21cab2['query'][_0x167d('0x48')](_0x167d('0x49'))){_0x57f405['limit']=qs[_0x167d('0x30')](_0x21cab2[_0x167d('0x44')][_0x167d('0x30')]);_0x57f405[_0x167d('0x2f')]=qs[_0x167d('0x2f')](_0x21cab2[_0x167d('0x44')][_0x167d('0x2f')]);}return _0x10dd42[_0x167d('0xc1')](_0x57f405);}})[_0x167d('0x21')](function(_0x9924b9){if(_0x9924b9){return _0x9924b9?{'count':_0x231578,'rows':_0x9924b9}:null;}})[_0x167d('0x21')](respondWithResult(_0x163758,null))[_0x167d('0x55')](handleError(_0x163758,null));};exports[_0x167d('0xb2')]=function(_0x152300,_0x4b3359,_0x383346){var _0x204c0a,_0x5504cf,_0x23f172;if(_[_0x167d('0x7d')](_0x152300[_0x167d('0x66')][_0x167d('0x66')])||_0x152300['body'][_0x167d('0x66')]===''){throw new db[(_0x167d('0x7f'))]['ValidationError'](_0x167d('0x81'));}if(_[_0x167d('0x7d')](_0x152300[_0x167d('0x66')]['to'])){}_0x204c0a=_0x152300[_0x167d('0x66')]['to'];return db[_0x167d('0x3f')]['findOne']({'where':{'id':_0x152300[_0x167d('0x57')]['id']}})[_0x167d('0x21')](handleEntityNotFound(_0x4b3359,null))[_0x167d('0x21')](function(_0xb63874){if(_0xb63874){return db[_0x167d('0x3f')]['find']({'where':{'id':_0xb63874['id']},'include':[{'model':db[_0x167d('0xc2')],'as':_0x167d('0x85'),'include':[{'model':db[_0x167d('0x74')],'as':_0x167d('0x86'),'where':{[_0xb63874['mapKey']]:_0x204c0a},'limit':0x1,'order':[[_0x167d('0x7a'),_0x167d('0x87')]]}]}]})[_0x167d('0x21')](handleEntityNotFound(_0x4b3359,null))[_0x167d('0x21')](function(_0x14d008){if(_0x14d008&&_0x14d008['List']){_0x5504cf=_0x14d008[_0x167d('0x5f')]({'plain':!![]});if(_0x5504cf[_0x167d('0x85')]&&_0x5504cf['List'][_0x167d('0x86')]['length']){return _0x5504cf['List'][_0x167d('0x86')][0x0];}return db[_0x167d('0x74')][_0x167d('0x5e')](_['defaults'](_0x152300['body'],{'firstName':_0x204c0a,[_0x14d008[_0x167d('0x82')]]:_0x204c0a,'phone':_0x204c0a,'ListId':_0x5504cf[_0x167d('0x7c')]}));}})[_0x167d('0x21')](handleEntityNotFound(_0x4b3359,null))[_0x167d('0x21')](function(_0x5837d4){if(_0x5837d4){_0x23f172=_0x5837d4;return db[_0x167d('0x92')][_0x167d('0x5d')]({'where':{'ContactId':_0x23f172['id'],'closed':![],'OpenchannelAccountId':_0x5504cf['id']}})['then'](function(_0x1116ed){if(_0x1116ed){return[_0x1116ed,![]];}return db[_0x167d('0x92')][_0x167d('0x5e')]({'UserId':_0x152300[_0x167d('0x61')]['id'],'ContactId':_0x23f172['id'],'OpenchannelAccountId':_0x5504cf['id'],'lastMsgDirection':_0x167d('0xc3'),'firstMsgDirection':_0x167d('0xc3'),'Messages':[_[_0x167d('0x4f')](_0x152300[_0x167d('0x66')],{'read':![],'body':_0x152300[_0x167d('0x66')][_0x167d('0x66')],'OpenchannelAccountId':_0x5504cf['id'],'UserId':_0x152300[_0x167d('0x61')]['id'],'ContactId':_0x23f172['id']})]},{'include':[{'model':db[_0x167d('0xc4')],'as':_0x167d('0xc5')}]})['then'](function(_0x1abafa){return[_0x1abafa,!![]];});});}})[_0x167d('0x95')](function(_0x1f1c0b,_0x3116f5){if(_0x3116f5){return _0x1f1c0b;}return db[_0x167d('0xc4')]['create'](_[_0x167d('0x4f')](_0x152300['body'],{'read':![],'body':_0x152300[_0x167d('0x66')][_0x167d('0x66')],'OpenchannelAccountId':_0x5504cf['id'],'OpenchannelInteractionId':_0x1f1c0b['id'],'UserId':_0x152300['user']['id'],'ContactId':_0x23f172['id']}))['then'](function(_0xe1348c){_0x1f1c0b[_0x167d('0xc6')][_0x167d('0xc5')]=[];_0x1f1c0b['dataValues'][_0x167d('0xc5')]['push'](_0xe1348c[_0x167d('0xc6')]);return _0x1f1c0b;});});}})[_0x167d('0x21')](respondWithResult(_0x4b3359,null))['catch'](handleError(_0x4b3359,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 40249fe..3f0608f 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 _0xaa88=['../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','hasOwnProperty','exports','events'];(function(_0x3964e5,_0x173d03){var _0x7ad0fc=function(_0x384ad1){while(--_0x384ad1){_0x3964e5['push'](_0x3964e5['shift']());}};_0x7ad0fc(++_0x173d03);}(_0xaa88,0x137));var _0x8aa8=function(_0x3cb152,_0x57eb54){_0x3cb152=_0x3cb152-0x0;var _0x4f54c3=_0xaa88[_0x3cb152];return _0x4f54c3;};'use strict';var EventEmitter=require(_0x8aa8('0x0'));var OpenchannelAccount=require(_0x8aa8('0x1'))['db'][_0x8aa8('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8aa8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8aa8('0x4'),'afterDestroy':_0x8aa8('0x5')};function emitEvent(_0x43f7e4){return function(_0x3b2c88,_0x3e3b70,_0x350e8b){OpenchannelAccountEvents['emit'](_0x43f7e4+':'+_0x3b2c88['id'],_0x3b2c88);OpenchannelAccountEvents['emit'](_0x43f7e4,_0x3b2c88);_0x350e8b(null);};}for(var e in events){if(events[_0x8aa8('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x8aa8('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xf109=['OpenchannelAccount','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x8fa30,_0x1a67f7){var _0x1721d3=function(_0x4bbdf3){while(--_0x4bbdf3){_0x8fa30['push'](_0x8fa30['shift']());}};_0x1721d3(++_0x1a67f7);}(_0xf109,0xce));var _0x9f10=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xf109[_0x36c5b0];return _0xf19333;};'use strict';var EventEmitter=require(_0x9f10('0x0'));var OpenchannelAccount=require(_0x9f10('0x1'))['db'][_0x9f10('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9f10('0x3')};function emitEvent(_0x74f517){return function(_0x74d0ee,_0x26f01c,_0x4027f4){OpenchannelAccountEvents[_0x9f10('0x4')](_0x74f517+':'+_0x74d0ee['id'],_0x74d0ee);OpenchannelAccountEvents[_0x9f10('0x4')](_0x74f517,_0x74d0ee);_0x4027f4(null);};}for(var e in events){if(events[_0x9f10('0x5')](e)){var event=events[e];OpenchannelAccount[_0x9f10('0x6')](e,emitEvent(event));}}module[_0x9f10('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 0735c74..e09c036 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(_0x13d1f5,_0x2ec706){var _0x2b9f8f=function(_0x16b0e5){while(--_0x16b0e5){_0x13d1f5['push'](_0x13d1f5['shift']());}};_0x2b9f8f(++_0x2ec706);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x3cb6d1,_0x1067f6){var _0x385ee7=function(_0x29d4d5){while(--_0x29d4d5){_0x3cb6d1['push'](_0x3cb6d1['shift']());}};_0x385ee7(++_0x1067f6);}(_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 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 4470b67..b1408c3 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 _0x6f7a=['then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register'];(function(_0x1014b7,_0x188980){var _0x1b4509=function(_0x2de9a5){while(--_0x2de9a5){_0x1014b7['push'](_0x1014b7['shift']());}};_0x1b4509(++_0x188980);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x1f288f,_0x58b64a){_0x1f288f=_0x1f288f-0x0;var _0x3cfd20=_0x6f7a[_0x1f288f];return _0x3cfd20;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var moment=require(_0xa6f7('0x2'));var BPromise=require(_0xa6f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6f7('0x4'));var db=require(_0xa6f7('0x5'))['db'];var utils=require(_0xa6f7('0x6'));var logger=require(_0xa6f7('0x7'))(_0xa6f7('0x8'));var config=require(_0xa6f7('0x9'));var jayson=require(_0xa6f7('0xa'));var client=jayson[_0xa6f7('0xb')][_0xa6f7('0xc')]({'port':0x232a});config[_0xa6f7('0xd')]=_[_0xa6f7('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa6f7('0xf'))(new Redis(config[_0xa6f7('0xd')]));require(_0xa6f7('0x10'))[_0xa6f7('0x11')](socket);function respondWithRpcPromise(_0x23bb05,_0x49a451,_0x5bdc9e){return new BPromise(function(_0x2fd1d0,_0x225da4){return client['request'](_0x23bb05,_0x5bdc9e)[_0xa6f7('0x12')](function(_0x5623bf){logger[_0xa6f7('0x13')](_0xa6f7('0x14'),_0x49a451,_0xa6f7('0x15'));logger[_0xa6f7('0x16')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x49a451,_0xa6f7('0x15'),JSON['stringify'](_0x5623bf));if(_0x5623bf[_0xa6f7('0x17')]){if(_0x5623bf[_0xa6f7('0x17')][_0xa6f7('0x18')]===0x1f4){logger['error'](_0xa6f7('0x14'),_0x49a451,_0x5623bf['error'][_0xa6f7('0x19')]);return _0x225da4(_0x5623bf['error'][_0xa6f7('0x19')]);}logger[_0xa6f7('0x17')](_0xa6f7('0x14'),_0x49a451,_0x5623bf['error'][_0xa6f7('0x19')]);return _0x2fd1d0(_0x5623bf[_0xa6f7('0x17')][_0xa6f7('0x19')]);}else{logger[_0xa6f7('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x49a451,'request\x20sent');_0x2fd1d0(_0x5623bf[_0xa6f7('0x1a')]['message']);}})[_0xa6f7('0x1b')](function(_0x369262){logger['error'](_0xa6f7('0x14'),_0x49a451,_0x369262);_0x225da4(_0x369262);});});} \ No newline at end of file +var _0x2884=['randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird'];(function(_0x2e067a,_0xab528c){var _0xc64976=function(_0x53a98e){while(--_0x53a98e){_0x2e067a['push'](_0x2e067a['shift']());}};_0xc64976(++_0xab528c);}(_0x2884,0x1eb));var _0x4288=function(_0x1ac002,_0x1f8b3d){_0x1ac002=_0x1ac002-0x0;var _0x5118d5=_0x2884[_0x1ac002];return _0x5118d5;};'use strict';var _=require(_0x4288('0x0'));var util=require('util');var moment=require(_0x4288('0x1'));var BPromise=require(_0x4288('0x2'));var rs=require(_0x4288('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4288('0x4'))['db'];var utils=require(_0x4288('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4288('0x6'));var jayson=require(_0x4288('0x7'));var client=jayson[_0x4288('0x8')]['http']({'port':0x232a});config['redis']=_[_0x4288('0x9')](config['redis'],{'host':_0x4288('0xa'),'port':0x18eb});var socket=require(_0x4288('0xb'))(new Redis(config['redis']));require(_0x4288('0xc'))[_0x4288('0xd')](socket);function respondWithRpcPromise(_0x41794a,_0x55c9ee,_0x55a4f7){return new BPromise(function(_0x5c0e2d,_0x42a234){return client[_0x4288('0xe')](_0x41794a,_0x55a4f7)[_0x4288('0xf')](function(_0x2445eb){logger[_0x4288('0x10')](_0x4288('0x11'),_0x55c9ee,'request\x20sent');logger[_0x4288('0x12')](_0x4288('0x13'),_0x55c9ee,_0x4288('0x14'),JSON[_0x4288('0x15')](_0x2445eb));if(_0x2445eb['error']){if(_0x2445eb[_0x4288('0x16')][_0x4288('0x17')]===0x1f4){logger['error'](_0x4288('0x11'),_0x55c9ee,_0x2445eb['error'][_0x4288('0x18')]);return _0x42a234(_0x2445eb['error'][_0x4288('0x18')]);}logger[_0x4288('0x16')](_0x4288('0x11'),_0x55c9ee,_0x2445eb[_0x4288('0x16')][_0x4288('0x18')]);return _0x5c0e2d(_0x2445eb[_0x4288('0x16')][_0x4288('0x18')]);}else{logger[_0x4288('0x10')](_0x4288('0x11'),_0x55c9ee,'request\x20sent');_0x5c0e2d(_0x2445eb[_0x4288('0x19')][_0x4288('0x18')]);}})['catch'](function(_0x479d52){logger['error'](_0x4288('0x11'),_0x55c9ee,_0x479d52);_0x42a234(_0x479d52);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 9392125..48d8a19 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 _0x1978=['openchannelAccount:','save','remove','update','emit','removeListener','length'];(function(_0xd2eeed,_0x5af164){var _0x953421=function(_0x16fae3){while(--_0x16fae3){_0xd2eeed['push'](_0xd2eeed['shift']());}};_0x953421(++_0x5af164);}(_0x1978,0x174));var _0x8197=function(_0x1a9343,_0x39f850){_0x1a9343=_0x1a9343-0x0;var _0x5e969a=_0x1978[_0x1a9343];return _0x5e969a;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x8197('0x0'),_0x8197('0x1'),_0x8197('0x2')];function createListener(_0x374b6a,_0x203bf1){return function(_0x2828d2){_0x203bf1[_0x8197('0x3')](_0x374b6a,_0x2828d2);};}function removeListener(_0x346978,_0x4003e1){return function(){OpenchannelAccountEvents[_0x8197('0x4')](_0x346978,_0x4003e1);};}exports['register']=function(_0x215d3c){for(var _0x1556ad=0x0,_0x117bf1=events[_0x8197('0x5')];_0x1556ad<_0x117bf1;_0x1556ad++){var _0x3e8799=events[_0x1556ad];var _0x1bc265=createListener(_0x8197('0x6')+_0x3e8799,_0x215d3c);OpenchannelAccountEvents['on'](_0x3e8799,_0x1bc265);}}; \ No newline at end of file +var _0x24cd=['update','emit','removeListener','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x14016f,_0x3edf9e){var _0x575dbc=function(_0x3e0a86){while(--_0x3e0a86){_0x14016f['push'](_0x14016f['shift']());}};_0x575dbc(++_0x3edf9e);}(_0x24cd,0x83));var _0xd24c=function(_0x5854c7,_0x3eb302){_0x5854c7=_0x5854c7-0x0;var _0x43b5b2=_0x24cd[_0x5854c7];return _0x43b5b2;};'use strict';var OpenchannelAccountEvents=require(_0xd24c('0x0'));var events=[_0xd24c('0x1'),'remove',_0xd24c('0x2')];function createListener(_0x4fcd89,_0x282e8f){return function(_0x30398b){_0x282e8f[_0xd24c('0x3')](_0x4fcd89,_0x30398b);};}function removeListener(_0x4d515c,_0x21a58c){return function(){OpenchannelAccountEvents[_0xd24c('0x4')](_0x4d515c,_0x21a58c);};}exports['register']=function(_0x1c30fc){for(var _0x2721be=0x0,_0x2a432a=events[_0xd24c('0x5')];_0x2721be<_0x2a432a;_0x2721be++){var _0x3d4d20=events[_0x2721be];var _0x411706=createListener(_0xd24c('0x6')+_0x3d4d20,_0x1c30fc);OpenchannelAccountEvents['on'](_0x3d4d20,_0x411706);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index fc70661..9c61b07 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 _0xdbba=['/:id','create','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','isAuthenticated','index','get'];(function(_0x1646fa,_0x4e5bd7){var _0x5a47a5=function(_0x2db820){while(--_0x2db820){_0x1646fa['push'](_0x1646fa['shift']());}};_0x5a47a5(++_0x4e5bd7);}(_0xdbba,0x7d));var _0xadbb=function(_0x2fc8b9,_0x2843cb){_0x2fc8b9=_0x2fc8b9-0x0;var _0x599fbe=_0xdbba[_0x2fc8b9];return _0x599fbe;};'use strict';var multer=require(_0xadbb('0x0'));var util=require('util');var path=require(_0xadbb('0x1'));var timeout=require(_0xadbb('0x2'));var express=require(_0xadbb('0x3'));var router=express['Router']();var fs_extra=require(_0xadbb('0x4'));var auth=require(_0xadbb('0x5'));var interaction=require(_0xadbb('0x6'));var config=require('../../config/environment');var controller=require(_0xadbb('0x7'));router['get']('/',auth[_0xadbb('0x8')](),controller[_0xadbb('0x9')]);router[_0xadbb('0xa')](_0xadbb('0xb'),auth[_0xadbb('0x8')](),controller['show']);router['post']('/',auth[_0xadbb('0x8')](),controller[_0xadbb('0xc')]);router['put'](_0xadbb('0xb'),auth[_0xadbb('0x8')](),controller[_0xadbb('0xd')]);router[_0xadbb('0xe')](_0xadbb('0xb'),auth[_0xadbb('0x8')](),controller[_0xadbb('0xf')]);module[_0xadbb('0x10')]=router; \ No newline at end of file +var _0xa67a=['post','create','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x485a38,_0x20dc6b){var _0x49f5c3=function(_0x5e9f05){while(--_0x5e9f05){_0x485a38['push'](_0x485a38['shift']());}};_0x49f5c3(++_0x20dc6b);}(_0xa67a,0xca));var _0xaa67=function(_0x24eaa5,_0xdfc98f){_0x24eaa5=_0x24eaa5-0x0;var _0x1bfacc=_0xa67a[_0x24eaa5];return _0x1bfacc;};'use strict';var multer=require(_0xaa67('0x0'));var util=require(_0xaa67('0x1'));var path=require('path');var timeout=require(_0xaa67('0x2'));var express=require('express');var router=express[_0xaa67('0x3')]();var fs_extra=require(_0xaa67('0x4'));var auth=require(_0xaa67('0x5'));var interaction=require(_0xaa67('0x6'));var config=require(_0xaa67('0x7'));var controller=require(_0xaa67('0x8'));router[_0xaa67('0x9')]('/',auth[_0xaa67('0xa')](),controller[_0xaa67('0xb')]);router['get'](_0xaa67('0xc'),auth['isAuthenticated'](),controller[_0xaa67('0xd')]);router[_0xaa67('0xe')]('/',auth['isAuthenticated'](),controller[_0xaa67('0xf')]);router['put'](_0xaa67('0xc'),auth[_0xaa67('0xa')](),controller['update']);router[_0xaa67('0x10')]('/:id',auth[_0xaa67('0xa')](),controller[_0xaa67('0x11')]);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 c5a4fcd..e26ead6 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 _0x806b=['sequelize','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x806b,0x12c));var _0xb806=function(_0x5e60eb,_0x5b71a8){_0x5e60eb=_0x5e60eb-0x0;var _0x35c3b8=_0x806b[_0x5e60eb];return _0x35c3b8;};'use strict';var Sequelize=require(_0xb806('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb806('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb806('0x2')},'appdata':{'type':Sequelize[_0xb806('0x3')]()},'description':{'type':Sequelize[_0xb806('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb806('0x5')}}; \ No newline at end of file +var _0x45df=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x135bc7,_0x54923a){var _0x3d3d54=function(_0x2117df){while(--_0x2117df){_0x135bc7['push'](_0x135bc7['shift']());}};_0x3d3d54(++_0x54923a);}(_0x45df,0x196));var _0xf45d=function(_0x3bb866,_0xba7019){_0x3bb866=_0x3bb866-0x0;var _0x2e7e75=_0x45df[_0x3bb866];return _0x2e7e75;};'use strict';var Sequelize=require(_0xf45d('0x0'));module[_0xf45d('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf45d('0x2')],'allowNull':![],'defaultValue':_0xf45d('0x3')},'appdata':{'type':Sequelize[_0xf45d('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf45d('0x2')],'defaultValue':_0xf45d('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index af954de..a529b35 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 _0xe65e=['model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','show','params','find','create','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','error','stack','name','send','index','map','OpenchannelApplication','fieldName','type','key'];(function(_0x53da0e,_0x2c4eb0){var _0x3a6ae7=function(_0xbcafb3){while(--_0xbcafb3){_0x53da0e['push'](_0x53da0e['shift']());}};_0x3a6ae7(++_0x2c4eb0);}(_0xe65e,0x1e3));var _0xee65=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xe65e[_0x255d5b];return _0x3e141a;};'use strict';var emlformat=require(_0xee65('0x0'));var rimraf=require(_0xee65('0x1'));var zipdir=require(_0xee65('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee65('0x3'));var moment=require(_0xee65('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xee65('0x5'));var path=require(_0xee65('0x6'));var sox=require('sox');var csv=require(_0xee65('0x7'));var ejs=require(_0xee65('0x8'));var fs=require('fs');var fs_extra=require(_0xee65('0x9'));var _=require(_0xee65('0xa'));var squel=require(_0xee65('0xb'));var crypto=require(_0xee65('0xc'));var jsforce=require(_0xee65('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xee65('0x7'));var querystring=require(_0xee65('0xe'));var Papa=require(_0xee65('0xf'));var Redis=require(_0xee65('0x10'));var authService=require(_0xee65('0x11'));var qs=require(_0xee65('0x12'));var as=require(_0xee65('0x13'));var hardwareService=require(_0xee65('0x14'));var logger=require(_0xee65('0x15'))('api');var utils=require(_0xee65('0x16'));var config=require(_0xee65('0x17'));var licenseUtil=require(_0xee65('0x18'));var db=require(_0xee65('0x19'))['db'];function respondWithStatusCode(_0x345914,_0x21951a){_0x21951a=_0x21951a||0xcc;return function(_0xaea9b1){if(_0xaea9b1){return _0x345914[_0xee65('0x1a')](_0x21951a);}return _0x345914['status'](_0x21951a)[_0xee65('0x1b')]();};}function respondWithResult(_0x2fa7ea,_0x43bec7){_0x43bec7=_0x43bec7||0xc8;return function(_0x170ecf){if(_0x170ecf){return _0x2fa7ea[_0xee65('0x1c')](_0x43bec7)[_0xee65('0x1d')](_0x170ecf);}};}function respondWithFilteredResult(_0x36c18e,_0xb3407b){return function(_0x4a8361){if(_0x4a8361){var _0x190181=typeof _0xb3407b[_0xee65('0x1e')]===_0xee65('0x1f')&&typeof _0xb3407b['limit']===_0xee65('0x1f');var _0x65463a=_0x4a8361['count'];var _0x2842fb=_0x190181?0x0:_0xb3407b[_0xee65('0x1e')];var _0x1f38c4=_0x190181?_0x4a8361[_0xee65('0x20')]:_0xb3407b['offset']+_0xb3407b[_0xee65('0x21')];var _0x13ac81;if(_0x1f38c4>=_0x65463a){_0x1f38c4=_0x65463a;_0x13ac81=0xc8;}else{_0x13ac81=0xce;}_0x36c18e[_0xee65('0x1c')](_0x13ac81);return _0x36c18e[_0xee65('0x22')](_0xee65('0x23'),_0x2842fb+'-'+_0x1f38c4+'/'+_0x65463a)[_0xee65('0x1d')](_0x4a8361);}return null;};}function patchUpdates(_0x1adf2c){return function(_0x2aea53){try{jsonpatch[_0xee65('0x24')](_0x2aea53,_0x1adf2c,!![]);}catch(_0x111c10){return BPromise['reject'](_0x111c10);}return _0x2aea53[_0xee65('0x25')]();};}function saveUpdates(_0x217b15,_0x1240ca){return function(_0x4c794e){if(_0x4c794e){return _0x4c794e['update'](_0x217b15)['then'](function(_0x450498){return _0x450498;});}return null;};}function removeEntity(_0xfd2cc1,_0x110c27){return function(_0x3cf009){if(_0x3cf009){return _0x3cf009[_0xee65('0x26')]()['then'](function(){_0xfd2cc1[_0xee65('0x1c')](0xcc)[_0xee65('0x1b')]();});}};}function handleEntityNotFound(_0x3cfa96,_0x4b64f1){return function(_0x43ad50){if(!_0x43ad50){_0x3cfa96[_0xee65('0x1a')](0x194);}return _0x43ad50;};}function handleError(_0x2c19f2,_0x261bb1){_0x261bb1=_0x261bb1||0x1f4;return function(_0x460c3f){logger[_0xee65('0x27')](_0x460c3f[_0xee65('0x28')]);if(_0x460c3f['name']){delete _0x460c3f[_0xee65('0x29')];}_0x2c19f2[_0xee65('0x1c')](_0x261bb1)[_0xee65('0x2a')](_0x460c3f);};}exports[_0xee65('0x2b')]=function(_0x3abae6,_0x1d8809){var _0x40d731={},_0x50e588={},_0x95292b={'count':0x0,'rows':[]};var _0x4d5395=_[_0xee65('0x2c')](db[_0xee65('0x2d')]['rawAttributes'],function(_0x2bac9c){return{'name':_0x2bac9c[_0xee65('0x2e')],'type':_0x2bac9c[_0xee65('0x2f')][_0xee65('0x30')]};});_0x50e588[_0xee65('0x31')]=_[_0xee65('0x2c')](_0x4d5395,_0xee65('0x29'));_0x50e588['query']=_[_0xee65('0x32')](_0x3abae6[_0xee65('0x33')]);_0x50e588[_0xee65('0x34')]=_[_0xee65('0x35')](_0x50e588['model'],_0x50e588['query']);_0x40d731[_0xee65('0x36')]=_[_0xee65('0x35')](_0x50e588[_0xee65('0x31')],qs[_0xee65('0x37')](_0x3abae6['query'][_0xee65('0x37')]));_0x40d731['attributes']=_0x40d731[_0xee65('0x36')][_0xee65('0x38')]?_0x40d731['attributes']:_0x50e588['model'];if(!_0x3abae6[_0xee65('0x33')]['hasOwnProperty'](_0xee65('0x39'))){_0x40d731[_0xee65('0x21')]=qs[_0xee65('0x21')](_0x3abae6[_0xee65('0x33')][_0xee65('0x21')]);_0x40d731[_0xee65('0x1e')]=qs[_0xee65('0x1e')](_0x3abae6[_0xee65('0x33')][_0xee65('0x1e')]);}_0x40d731[_0xee65('0x3a')]=qs[_0xee65('0x3b')](_0x3abae6[_0xee65('0x33')][_0xee65('0x3b')]);_0x40d731['where']=qs['filters'](_['pick'](_0x3abae6[_0xee65('0x33')],_0x50e588[_0xee65('0x34')]),_0x4d5395);if(_0x3abae6[_0xee65('0x33')][_0xee65('0x3c')]){_0x40d731[_0xee65('0x3d')]=_[_0xee65('0x3e')](_0x40d731['where'],{'$or':_[_0xee65('0x2c')](_0x4d5395,function(_0x12f6ef){if(_0x12f6ef[_0xee65('0x2f')]!==_0xee65('0x3f')){var _0x38e2cd={};_0x38e2cd[_0x12f6ef[_0xee65('0x29')]]={'$like':'%'+_0x3abae6[_0xee65('0x33')][_0xee65('0x3c')]+'%'};return _0x38e2cd;}})});}_0x40d731=_[_0xee65('0x3e')]({},_0x40d731,_0x3abae6[_0xee65('0x40')]);var _0x242c1f={'where':_0x40d731[_0xee65('0x3d')]};return db['OpenchannelApplication'][_0xee65('0x20')](_0x242c1f)[_0xee65('0x41')](function(_0x314307){_0x95292b['count']=_0x314307;if(_0x3abae6['query'][_0xee65('0x42')]){_0x40d731[_0xee65('0x43')]=[{'all':!![]}];}return db[_0xee65('0x2d')][_0xee65('0x44')](_0x40d731);})[_0xee65('0x41')](function(_0x5ec632){_0x95292b[_0xee65('0x45')]=_0x5ec632;return _0x95292b;})[_0xee65('0x41')](respondWithFilteredResult(_0x1d8809,_0x40d731))['catch'](handleError(_0x1d8809,null));};exports[_0xee65('0x46')]=function(_0x1ae46a,_0x4d79f1){var _0x5dc128={'raw':!![],'where':{'id':_0x1ae46a[_0xee65('0x47')]['id']}},_0x180eed={};_0x180eed['model']=_[_0xee65('0x32')](db[_0xee65('0x2d')]['rawAttributes']);_0x180eed[_0xee65('0x33')]=_['keys'](_0x1ae46a[_0xee65('0x33')]);_0x180eed[_0xee65('0x34')]=_[_0xee65('0x35')](_0x180eed[_0xee65('0x31')],_0x180eed[_0xee65('0x33')]);_0x5dc128[_0xee65('0x36')]=_['intersection'](_0x180eed[_0xee65('0x31')],qs['fields'](_0x1ae46a[_0xee65('0x33')][_0xee65('0x37')]));_0x5dc128[_0xee65('0x36')]=_0x5dc128['attributes'][_0xee65('0x38')]?_0x5dc128[_0xee65('0x36')]:_0x180eed[_0xee65('0x31')];if(_0x1ae46a[_0xee65('0x33')]['includeAll']){_0x5dc128[_0xee65('0x43')]=[{'all':!![]}];}_0x5dc128=_[_0xee65('0x3e')]({},_0x5dc128,_0x1ae46a[_0xee65('0x40')]);return db[_0xee65('0x2d')][_0xee65('0x48')](_0x5dc128)[_0xee65('0x41')](handleEntityNotFound(_0x4d79f1,null))['then'](respondWithResult(_0x4d79f1,null))['catch'](handleError(_0x4d79f1,null));};exports[_0xee65('0x49')]=function(_0x20ab6e,_0x22d8ed){return db[_0xee65('0x2d')][_0xee65('0x49')](_0x20ab6e[_0xee65('0x4a')],{})[_0xee65('0x41')](respondWithResult(_0x22d8ed,0xc9))[_0xee65('0x4b')](handleError(_0x22d8ed,null));};exports['update']=function(_0x16698c,_0x56ea6b){if(_0x16698c[_0xee65('0x4a')]['id']){delete _0x16698c['body']['id'];}return db[_0xee65('0x2d')]['find']({'where':{'id':_0x16698c['params']['id']}})[_0xee65('0x41')](handleEntityNotFound(_0x56ea6b,null))[_0xee65('0x41')](saveUpdates(_0x16698c[_0xee65('0x4a')],null))['then'](respondWithResult(_0x56ea6b,null))[_0xee65('0x4b')](handleError(_0x56ea6b,null));};exports[_0xee65('0x26')]=function(_0x2e1d59,_0x263d73){return db[_0xee65('0x2d')][_0xee65('0x48')]({'where':{'id':_0x2e1d59[_0xee65('0x47')]['id']}})[_0xee65('0x41')](handleEntityNotFound(_0x263d73,null))[_0xee65('0x41')](removeEntity(_0x263d73,null))['catch'](handleError(_0x263d73,null));}; \ No newline at end of file +var _0x06df=['find','create','body','eml-format','zip-dir','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','send','index','OpenchannelApplication','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','includeAll','include','findAll','catch','show','params'];(function(_0x147e76,_0xb1d526){var _0x3100b7=function(_0x436f36){while(--_0x436f36){_0x147e76['push'](_0x147e76['shift']());}};_0x3100b7(++_0xb1d526);}(_0x06df,0x184));var _0xf06d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x06df[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xf06d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf06d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf06d('0x2'));var moment=require(_0xf06d('0x3'));var BPromise=require(_0xf06d('0x4'));var Mustache=require('mustache');var util=require(_0xf06d('0x5'));var path=require(_0xf06d('0x6'));var sox=require(_0xf06d('0x7'));var csv=require(_0xf06d('0x8'));var ejs=require(_0xf06d('0x9'));var fs=require('fs');var fs_extra=require(_0xf06d('0xa'));var _=require('lodash');var squel=require(_0xf06d('0xb'));var crypto=require(_0xf06d('0xc'));var jsforce=require(_0xf06d('0xd'));var deskjs=require(_0xf06d('0xe'));var toCsv=require(_0xf06d('0x8'));var querystring=require(_0xf06d('0xf'));var Papa=require(_0xf06d('0x10'));var Redis=require('ioredis');var authService=require(_0xf06d('0x11'));var qs=require(_0xf06d('0x12'));var as=require(_0xf06d('0x13'));var hardwareService=require(_0xf06d('0x14'));var logger=require(_0xf06d('0x15'))(_0xf06d('0x16'));var utils=require('../../config/utils');var config=require(_0xf06d('0x17'));var licenseUtil=require(_0xf06d('0x18'));var db=require(_0xf06d('0x19'))['db'];function respondWithStatusCode(_0x5aa756,_0x2e10b7){_0x2e10b7=_0x2e10b7||0xcc;return function(_0x541039){if(_0x541039){return _0x5aa756['sendStatus'](_0x2e10b7);}return _0x5aa756[_0xf06d('0x1a')](_0x2e10b7)['end']();};}function respondWithResult(_0x27f6eb,_0x1f85c4){_0x1f85c4=_0x1f85c4||0xc8;return function(_0x344fff){if(_0x344fff){return _0x27f6eb[_0xf06d('0x1a')](_0x1f85c4)['json'](_0x344fff);}};}function respondWithFilteredResult(_0x292bac,_0x4ecdd4){return function(_0x45cdd6){if(_0x45cdd6){var _0x4c633a=typeof _0x4ecdd4[_0xf06d('0x1b')]===_0xf06d('0x1c')&&typeof _0x4ecdd4[_0xf06d('0x1d')]===_0xf06d('0x1c');var _0x3dfba8=_0x45cdd6[_0xf06d('0x1e')];var _0x410ccd=_0x4c633a?0x0:_0x4ecdd4[_0xf06d('0x1b')];var _0x24b511=_0x4c633a?_0x45cdd6[_0xf06d('0x1e')]:_0x4ecdd4[_0xf06d('0x1b')]+_0x4ecdd4['limit'];var _0x5c4619;if(_0x24b511>=_0x3dfba8){_0x24b511=_0x3dfba8;_0x5c4619=0xc8;}else{_0x5c4619=0xce;}_0x292bac[_0xf06d('0x1a')](_0x5c4619);return _0x292bac[_0xf06d('0x1f')](_0xf06d('0x20'),_0x410ccd+'-'+_0x24b511+'/'+_0x3dfba8)['json'](_0x45cdd6);}return null;};}function patchUpdates(_0x2f88ca){return function(_0x376279){try{jsonpatch[_0xf06d('0x21')](_0x376279,_0x2f88ca,!![]);}catch(_0x7d3762){return BPromise[_0xf06d('0x22')](_0x7d3762);}return _0x376279[_0xf06d('0x23')]();};}function saveUpdates(_0x17c83d,_0x42755e){return function(_0x338fe2){if(_0x338fe2){return _0x338fe2[_0xf06d('0x24')](_0x17c83d)[_0xf06d('0x25')](function(_0x963555){return _0x963555;});}return null;};}function removeEntity(_0x4b36e6,_0x290f70){return function(_0x3abc1d){if(_0x3abc1d){return _0x3abc1d[_0xf06d('0x26')]()[_0xf06d('0x25')](function(){_0x4b36e6[_0xf06d('0x1a')](0xcc)[_0xf06d('0x27')]();});}};}function handleEntityNotFound(_0x5a9521,_0x86cfe){return function(_0x5879a5){if(!_0x5879a5){_0x5a9521[_0xf06d('0x28')](0x194);}return _0x5879a5;};}function handleError(_0x222bf7,_0x4ab523){_0x4ab523=_0x4ab523||0x1f4;return function(_0x136978){logger[_0xf06d('0x29')](_0x136978[_0xf06d('0x2a')]);if(_0x136978['name']){delete _0x136978['name'];}_0x222bf7['status'](_0x4ab523)[_0xf06d('0x2b')](_0x136978);};}exports[_0xf06d('0x2c')]=function(_0x29e56a,_0x346ecf){var _0x476534={},_0x182674={},_0x3a612c={'count':0x0,'rows':[]};var _0x6ecf20=_['map'](db[_0xf06d('0x2d')][_0xf06d('0x2e')],function(_0x3fabcb){return{'name':_0x3fabcb[_0xf06d('0x2f')],'type':_0x3fabcb[_0xf06d('0x30')][_0xf06d('0x31')]};});_0x182674[_0xf06d('0x32')]=_['map'](_0x6ecf20,_0xf06d('0x33'));_0x182674[_0xf06d('0x34')]=_[_0xf06d('0x35')](_0x29e56a[_0xf06d('0x34')]);_0x182674[_0xf06d('0x36')]=_[_0xf06d('0x37')](_0x182674[_0xf06d('0x32')],_0x182674[_0xf06d('0x34')]);_0x476534[_0xf06d('0x38')]=_[_0xf06d('0x37')](_0x182674['model'],qs[_0xf06d('0x39')](_0x29e56a['query'][_0xf06d('0x39')]));_0x476534['attributes']=_0x476534[_0xf06d('0x38')][_0xf06d('0x3a')]?_0x476534[_0xf06d('0x38')]:_0x182674['model'];if(!_0x29e56a[_0xf06d('0x34')][_0xf06d('0x3b')](_0xf06d('0x3c'))){_0x476534['limit']=qs[_0xf06d('0x1d')](_0x29e56a[_0xf06d('0x34')]['limit']);_0x476534[_0xf06d('0x1b')]=qs[_0xf06d('0x1b')](_0x29e56a['query'][_0xf06d('0x1b')]);}_0x476534[_0xf06d('0x3d')]=qs[_0xf06d('0x3e')](_0x29e56a[_0xf06d('0x34')][_0xf06d('0x3e')]);_0x476534[_0xf06d('0x3f')]=qs[_0xf06d('0x36')](_['pick'](_0x29e56a[_0xf06d('0x34')],_0x182674[_0xf06d('0x36')]),_0x6ecf20);if(_0x29e56a['query'][_0xf06d('0x40')]){_0x476534[_0xf06d('0x3f')]=_[_0xf06d('0x41')](_0x476534[_0xf06d('0x3f')],{'$or':_[_0xf06d('0x42')](_0x6ecf20,function(_0x5f560d){if(_0x5f560d[_0xf06d('0x30')]!==_0xf06d('0x43')){var _0x3d913b={};_0x3d913b[_0x5f560d[_0xf06d('0x33')]]={'$like':'%'+_0x29e56a[_0xf06d('0x34')][_0xf06d('0x40')]+'%'};return _0x3d913b;}})});}_0x476534=_[_0xf06d('0x41')]({},_0x476534,_0x29e56a['options']);var _0x5615f2={'where':_0x476534[_0xf06d('0x3f')]};return db[_0xf06d('0x2d')][_0xf06d('0x1e')](_0x5615f2)[_0xf06d('0x25')](function(_0xead1c5){_0x3a612c['count']=_0xead1c5;if(_0x29e56a['query'][_0xf06d('0x44')]){_0x476534[_0xf06d('0x45')]=[{'all':!![]}];}return db[_0xf06d('0x2d')][_0xf06d('0x46')](_0x476534);})[_0xf06d('0x25')](function(_0x434762){_0x3a612c['rows']=_0x434762;return _0x3a612c;})[_0xf06d('0x25')](respondWithFilteredResult(_0x346ecf,_0x476534))[_0xf06d('0x47')](handleError(_0x346ecf,null));};exports[_0xf06d('0x48')]=function(_0x5ec2a5,_0xacb17e){var _0x1e3ece={'raw':!![],'where':{'id':_0x5ec2a5[_0xf06d('0x49')]['id']}},_0x5b8705={};_0x5b8705['model']=_[_0xf06d('0x35')](db[_0xf06d('0x2d')][_0xf06d('0x2e')]);_0x5b8705[_0xf06d('0x34')]=_[_0xf06d('0x35')](_0x5ec2a5[_0xf06d('0x34')]);_0x5b8705[_0xf06d('0x36')]=_[_0xf06d('0x37')](_0x5b8705[_0xf06d('0x32')],_0x5b8705[_0xf06d('0x34')]);_0x1e3ece['attributes']=_[_0xf06d('0x37')](_0x5b8705['model'],qs['fields'](_0x5ec2a5[_0xf06d('0x34')]['fields']));_0x1e3ece[_0xf06d('0x38')]=_0x1e3ece['attributes'][_0xf06d('0x3a')]?_0x1e3ece[_0xf06d('0x38')]:_0x5b8705[_0xf06d('0x32')];if(_0x5ec2a5[_0xf06d('0x34')][_0xf06d('0x44')]){_0x1e3ece[_0xf06d('0x45')]=[{'all':!![]}];}_0x1e3ece=_['merge']({},_0x1e3ece,_0x5ec2a5['options']);return db['OpenchannelApplication'][_0xf06d('0x4a')](_0x1e3ece)[_0xf06d('0x25')](handleEntityNotFound(_0xacb17e,null))[_0xf06d('0x25')](respondWithResult(_0xacb17e,null))[_0xf06d('0x47')](handleError(_0xacb17e,null));};exports['create']=function(_0x4cafd6,_0x22d42f){return db[_0xf06d('0x2d')][_0xf06d('0x4b')](_0x4cafd6['body'],{})[_0xf06d('0x25')](respondWithResult(_0x22d42f,0xc9))[_0xf06d('0x47')](handleError(_0x22d42f,null));};exports[_0xf06d('0x24')]=function(_0x283d48,_0x3f0c9e){if(_0x283d48[_0xf06d('0x4c')]['id']){delete _0x283d48[_0xf06d('0x4c')]['id'];}return db[_0xf06d('0x2d')]['find']({'where':{'id':_0x283d48['params']['id']}})['then'](handleEntityNotFound(_0x3f0c9e,null))[_0xf06d('0x25')](saveUpdates(_0x283d48[_0xf06d('0x4c')],null))[_0xf06d('0x25')](respondWithResult(_0x3f0c9e,null))[_0xf06d('0x47')](handleError(_0x3f0c9e,null));};exports['destroy']=function(_0x12d86a,_0xc18519){return db[_0xf06d('0x2d')][_0xf06d('0x4a')]({'where':{'id':_0x12d86a['params']['id']}})[_0xf06d('0x25')](handleEntityNotFound(_0xc18519,null))[_0xf06d('0x25')](removeEntity(_0xc18519,null))['catch'](handleError(_0xc18519,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 5807df5..e63327f 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 _0x5bbf=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x2dab7e,_0x4bceb1){var _0x5ce20c=function(_0x52a68c){while(--_0x52a68c){_0x2dab7e['push'](_0x2dab7e['shift']());}};_0x5ce20c(++_0x4bceb1);}(_0x5bbf,0x68));var _0xf5bb=function(_0x1f31cb,_0x49ed49){_0x1f31cb=_0x1f31cb-0x0;var _0x188f8d=_0x5bbf[_0x1f31cb];return _0x188f8d;};'use strict';var _=require(_0xf5bb('0x0'));var util=require(_0xf5bb('0x1'));var logger=require(_0xf5bb('0x2'))(_0xf5bb('0x3'));var moment=require(_0xf5bb('0x4'));var BPromise=require(_0xf5bb('0x5'));var rp=require(_0xf5bb('0x6'));var fs=require('fs');var path=require(_0xf5bb('0x7'));var rimraf=require(_0xf5bb('0x8'));var config=require(_0xf5bb('0x9'));var attributes=require(_0xf5bb('0xa'));module[_0xf5bb('0xb')]=function(_0x5ed88a,_0x4c7e93){return _0x5ed88a['define']('OpenchannelApplication',attributes,{'tableName':_0xf5bb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf5bb('0xd'),'collate':_0xf5bb('0xe')});}; \ No newline at end of file +var _0xa7d2=['api','moment','bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','lodash','../../config/logger'];(function(_0xddba19,_0x38e101){var _0x1b28e7=function(_0x49727d){while(--_0x49727d){_0xddba19['push'](_0xddba19['shift']());}};_0x1b28e7(++_0x38e101);}(_0xa7d2,0xae));var _0x2a7d=function(_0x229b30,_0x9d98eb){_0x229b30=_0x229b30-0x0;var _0x1d8669=_0xa7d2[_0x229b30];return _0x1d8669;};'use strict';var _=require(_0x2a7d('0x0'));var util=require('util');var logger=require(_0x2a7d('0x1'))(_0x2a7d('0x2'));var moment=require(_0x2a7d('0x3'));var BPromise=require(_0x2a7d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a7d('0x5'));var rimraf=require(_0x2a7d('0x6'));var config=require(_0x2a7d('0x7'));var attributes=require(_0x2a7d('0x8'));module['exports']=function(_0x4731b9,_0x2113a2){return _0x4731b9[_0x2a7d('0x9')](_0x2a7d('0xa'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 7e299f6..82f6379 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 _0x3883=['options','raw','where','attributes','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','catch','UpdateOpenchannelApplication','OpenchannelApplication'];(function(_0xe6d067,_0x5af043){var _0x213c54=function(_0x32e860){while(--_0x32e860){_0xe6d067['push'](_0xe6d067['shift']());}};_0x213c54(++_0x5af043);}(_0x3883,0x19a));var _0x3388=function(_0x773b6d,_0x15b9b4){_0x773b6d=_0x773b6d-0x0;var _0x2d4e3b=_0x3883[_0x773b6d];return _0x2d4e3b;};'use strict';var _=require(_0x3388('0x0'));var util=require(_0x3388('0x1'));var moment=require(_0x3388('0x2'));var BPromise=require(_0x3388('0x3'));var rs=require(_0x3388('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3388('0x5'));var logger=require(_0x3388('0x6'))(_0x3388('0x7'));var config=require(_0x3388('0x8'));var jayson=require(_0x3388('0x9'));var client=jayson[_0x3388('0xa')][_0x3388('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xae7ad6,_0x278538,_0x1a6ee){return new BPromise(function(_0x420cb0,_0x2df31a){return client[_0x3388('0xc')](_0xae7ad6,_0x1a6ee)[_0x3388('0xd')](function(_0x30f79b){logger[_0x3388('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x278538,_0x3388('0xf'));logger[_0x3388('0x10')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x278538,_0x3388('0xf'),JSON[_0x3388('0x11')](_0x30f79b));if(_0x30f79b['error']){if(_0x30f79b[_0x3388('0x12')][_0x3388('0x13')]===0x1f4){logger[_0x3388('0x12')](_0x3388('0x14'),_0x278538,_0x30f79b[_0x3388('0x12')][_0x3388('0x15')]);return _0x2df31a(_0x30f79b[_0x3388('0x12')][_0x3388('0x15')]);}logger[_0x3388('0x12')](_0x3388('0x14'),_0x278538,_0x30f79b[_0x3388('0x12')][_0x3388('0x15')]);return _0x420cb0(_0x30f79b[_0x3388('0x12')]['message']);}else{logger[_0x3388('0xe')](_0x3388('0x14'),_0x278538,_0x3388('0xf'));_0x420cb0(_0x30f79b['result'][_0x3388('0x15')]);}})[_0x3388('0x16')](function(_0x1af64d){logger[_0x3388('0x12')](_0x3388('0x14'),_0x278538,_0x1af64d);_0x2df31a(_0x1af64d);});});}exports[_0x3388('0x17')]=function(_0x28838b){var _0x19e334=this;return new Promise(function(_0x1a6cd9,_0x5b7d1c){return db[_0x3388('0x18')]['update'](_0x28838b['body'],{'raw':_0x28838b[_0x3388('0x19')]?_0x28838b[_0x3388('0x19')][_0x3388('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28838b['options']?_0x28838b['options'][_0x3388('0x1b')]||null:null,'attributes':_0x28838b['options']?_0x28838b['options'][_0x3388('0x1c')]||null:null,'limit':_0x28838b[_0x3388('0x19')]?_0x28838b['options']['limit']||null:null})[_0x3388('0xd')](function(_0x578ccc){logger[_0x3388('0xe')]('UpdateOpenchannelApplication',_0x28838b);logger['debug']('UpdateOpenchannelApplication',_0x28838b,JSON[_0x3388('0x11')](_0x578ccc));_0x1a6cd9(_0x578ccc);})['catch'](function(_0x57e103){logger['error'](_0x3388('0x17'),_0x57e103[_0x3388('0x15')],_0x28838b);_0x5b7d1c(_0x19e334[_0x3388('0x12')](0x1f4,_0x57e103['message']));});});}; \ No newline at end of file +var _0x482b=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','attributes','limit','debug','catch','util','moment','randomstring','ioredis'];(function(_0x4f5a1e,_0x5da98c){var _0x12fcd2=function(_0x5e8964){while(--_0x5e8964){_0x4f5a1e['push'](_0x4f5a1e['shift']());}};_0x12fcd2(++_0x5da98c);}(_0x482b,0x164));var _0xb482=function(_0x4ec1be,_0x50beed){_0x4ec1be=_0x4ec1be-0x0;var _0x35125b=_0x482b[_0x4ec1be];return _0x35125b;};'use strict';var _=require('lodash');var util=require(_0xb482('0x0'));var moment=require(_0xb482('0x1'));var BPromise=require('bluebird');var rs=require(_0xb482('0x2'));var fs=require('fs');var Redis=require(_0xb482('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb482('0x4'));var config=require(_0xb482('0x5'));var jayson=require(_0xb482('0x6'));var client=jayson[_0xb482('0x7')][_0xb482('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x244a3a,_0x1d0ba,_0x3cb3a1){return new BPromise(function(_0x54a290,_0x4ba0f0){return client[_0xb482('0x9')](_0x244a3a,_0x3cb3a1)[_0xb482('0xa')](function(_0x48a1f9){logger[_0xb482('0xb')](_0xb482('0xc'),_0x1d0ba,_0xb482('0xd'));logger['debug'](_0xb482('0xe'),_0x1d0ba,_0xb482('0xd'),JSON[_0xb482('0xf')](_0x48a1f9));if(_0x48a1f9[_0xb482('0x10')]){if(_0x48a1f9[_0xb482('0x10')][_0xb482('0x11')]===0x1f4){logger[_0xb482('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x1d0ba,_0x48a1f9[_0xb482('0x10')]['message']);return _0x4ba0f0(_0x48a1f9['error'][_0xb482('0x12')]);}logger[_0xb482('0x10')](_0xb482('0xc'),_0x1d0ba,_0x48a1f9[_0xb482('0x10')][_0xb482('0x12')]);return _0x54a290(_0x48a1f9[_0xb482('0x10')][_0xb482('0x12')]);}else{logger[_0xb482('0xb')](_0xb482('0xc'),_0x1d0ba,_0xb482('0xd'));_0x54a290(_0x48a1f9[_0xb482('0x13')]['message']);}})['catch'](function(_0x31d097){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x1d0ba,_0x31d097);_0x4ba0f0(_0x31d097);});});}exports[_0xb482('0x14')]=function(_0x237c3a){var _0x192a5e=this;return new Promise(function(_0x5b0d47,_0x4e7828){return db[_0xb482('0x15')][_0xb482('0x16')](_0x237c3a[_0xb482('0x17')],{'raw':_0x237c3a[_0xb482('0x18')]?_0x237c3a[_0xb482('0x18')][_0xb482('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x237c3a['options']?_0x237c3a[_0xb482('0x18')]['where']||null:null,'attributes':_0x237c3a[_0xb482('0x18')]?_0x237c3a[_0xb482('0x18')][_0xb482('0x1a')]||null:null,'limit':_0x237c3a[_0xb482('0x18')]?_0x237c3a[_0xb482('0x18')][_0xb482('0x1b')]||null:null})['then'](function(_0xa6ddb2){logger[_0xb482('0xb')](_0xb482('0x14'),_0x237c3a);logger[_0xb482('0x1c')](_0xb482('0x14'),_0x237c3a,JSON[_0xb482('0xf')](_0xa6ddb2));_0x5b0d47(_0xa6ddb2);})[_0xb482('0x1d')](function(_0x530823){logger[_0xb482('0x10')](_0xb482('0x14'),_0x530823[_0xb482('0x12')],_0x237c3a);_0x4e7828(_0x192a5e[_0xb482('0x10')](0x1f4,_0x530823[_0xb482('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 1470b74..d767429 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 _0x4f28=['/describe','isAuthenticated','describe','/:id','getMessages','download','post','create','/:id/messages','addMessage','openchannel','addTags','put','tracked','openchannelinteraction:destroy','destroy','delete','/:id/tags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get'];(function(_0x27fae4,_0x314bb9){var _0x41a996=function(_0x5d10eb){while(--_0x5d10eb){_0x27fae4['push'](_0x27fae4['shift']());}};_0x41a996(++_0x314bb9);}(_0x4f28,0x1b7));var _0x84f2=function(_0x3c97e3,_0x321677){_0x3c97e3=_0x3c97e3-0x0;var _0x9bb0ed=_0x4f28[_0x3c97e3];return _0x9bb0ed;};'use strict';var multer=require(_0x84f2('0x0'));var util=require(_0x84f2('0x1'));var path=require('path');var timeout=require(_0x84f2('0x2'));var express=require(_0x84f2('0x3'));var router=express[_0x84f2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x84f2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x84f2('0x6'));var controller=require(_0x84f2('0x7'));router[_0x84f2('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x84f2('0x8')](_0x84f2('0x9'),auth[_0x84f2('0xa')](),controller[_0x84f2('0xb')]);router['get'](_0x84f2('0xc'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/messages',auth[_0x84f2('0xa')](),controller[_0x84f2('0xd')]);router[_0x84f2('0x8')]('/:id/download',auth[_0x84f2('0xa')](),controller[_0x84f2('0xe')]);router[_0x84f2('0xf')]('/',auth[_0x84f2('0xa')](),controller[_0x84f2('0x10')]);router['post'](_0x84f2('0x11'),auth['isAuthenticated'](),controller[_0x84f2('0x12')]);router[_0x84f2('0xf')]('/:id/tags',auth[_0x84f2('0xa')](),interaction['tracked'](_0x84f2('0x13'),'openchannelinteraction:addtags'),controller[_0x84f2('0x14')]);router[_0x84f2('0x15')]('/:id',auth['isAuthenticated'](),interaction[_0x84f2('0x16')](_0x84f2('0x13'),'openchannelinteraction:update'),controller['update']);router['delete']('/:id',auth[_0x84f2('0xa')](),interaction['tracked'](_0x84f2('0x13'),_0x84f2('0x17')),controller[_0x84f2('0x18')]);router[_0x84f2('0x19')](_0x84f2('0x1a'),auth[_0x84f2('0xa')](),controller['removeTags']);module[_0x84f2('0x1b')]=router; \ No newline at end of file +var _0xb935=['post','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download'];(function(_0x261a16,_0x21ea02){var _0x201b83=function(_0x17c167){while(--_0x17c167){_0x261a16['push'](_0x261a16['shift']());}};_0x201b83(++_0x21ea02);}(_0xb935,0xfb));var _0x5b93=function(_0x2504d5,_0x24b6d9){_0x2504d5=_0x2504d5-0x0;var _0x22de78=_0xb935[_0x2504d5];return _0x22de78;};'use strict';var multer=require(_0x5b93('0x0'));var util=require(_0x5b93('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5b93('0x2'));var router=express[_0x5b93('0x3')]();var fs_extra=require(_0x5b93('0x4'));var auth=require(_0x5b93('0x5'));var interaction=require(_0x5b93('0x6'));var config=require(_0x5b93('0x7'));var controller=require(_0x5b93('0x8'));router[_0x5b93('0x9')]('/',auth[_0x5b93('0xa')](),controller[_0x5b93('0xb')]);router[_0x5b93('0x9')](_0x5b93('0xc'),auth[_0x5b93('0xa')](),controller[_0x5b93('0xd')]);router[_0x5b93('0x9')](_0x5b93('0xe'),auth[_0x5b93('0xa')](),controller[_0x5b93('0xf')]);router[_0x5b93('0x9')](_0x5b93('0x10'),auth[_0x5b93('0xa')](),controller[_0x5b93('0x11')]);router[_0x5b93('0x9')](_0x5b93('0x12'),auth[_0x5b93('0xa')](),controller['download']);router[_0x5b93('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5b93('0x13')]('/:id/messages',auth['isAuthenticated'](),controller[_0x5b93('0x14')]);router[_0x5b93('0x13')](_0x5b93('0x15'),auth[_0x5b93('0xa')](),interaction[_0x5b93('0x16')]('openchannel',_0x5b93('0x17')),controller[_0x5b93('0x18')]);router[_0x5b93('0x19')](_0x5b93('0xe'),auth[_0x5b93('0xa')](),interaction[_0x5b93('0x16')]('openchannel',_0x5b93('0x1a')),controller['update']);router[_0x5b93('0x1b')](_0x5b93('0xe'),auth[_0x5b93('0xa')](),interaction[_0x5b93('0x16')]('openchannel','openchannelinteraction:destroy'),controller[_0x5b93('0x1c')]);router[_0x5b93('0x1b')](_0x5b93('0x15'),auth[_0x5b93('0xa')](),controller['removeTags']);module[_0x5b93('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index dda1bdf..b565603 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 _0x2d65=['BOOLEAN','sequelize','exports','DATE','STRING','ENUM','out'];(function(_0x22ac5e,_0x5d8263){var _0x203b39=function(_0x1bbd26){while(--_0x1bbd26){_0x22ac5e['push'](_0x22ac5e['shift']());}};_0x203b39(++_0x5d8263);}(_0x2d65,0x1f2));var _0x52d6=function(_0x5c371d,_0x51dcb6){_0x5c371d=_0x5c371d-0x0;var _0xc178a4=_0x2d65[_0x5c371d];return _0xc178a4;};'use strict';var Sequelize=require(_0x52d6('0x0'));module[_0x52d6('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x52d6('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x52d6('0x3')]},'thirdDisposition':{'type':Sequelize[_0x52d6('0x3')]},'note':{'type':Sequelize[_0x52d6('0x3')]},'read1stAt':{'type':Sequelize[_0x52d6('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x52d6('0x3')]},'lastMsgAt':{'type':Sequelize[_0x52d6('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x52d6('0x4')]('in',_0x52d6('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x52d6('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x52d6('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x52d6('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xd3a8=['INTEGER','sequelize','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x52461e,_0x29427e){var _0x2df8f3=function(_0xd13f27){while(--_0xd13f27){_0x52461e['push'](_0x52461e['shift']());}};_0x2df8f3(++_0x29427e);}(_0xd3a8,0x135));var _0x8d3a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xd3a8[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0x8d3a('0x0'));module['exports']={'closed':{'type':Sequelize[_0x8d3a('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8d3a('0x2')]},'disposition':{'type':Sequelize[_0x8d3a('0x3')]},'secondDisposition':{'type':Sequelize[_0x8d3a('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8d3a('0x3')]},'read1stAt':{'type':Sequelize[_0x8d3a('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x8d3a('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8d3a('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x8d3a('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x8d3a('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x8d3a('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 4ceb910..17ee687 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 _0xa88d=['Private','map','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','lastName','secret','value','renderFile','views','downloadInteraction.ejs','Openchannel','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','util','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','then','error','name','send','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','query','user','catch','show','from','params','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','update','body','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelMessage','hasOwnProperty','nolimit','sort','where','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','color','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','push','User','fullname','CmContact','Contact','firstName','Attachment','Messages','createdAt','direction','read','OpenchannelAccount','Account','Owner','N.A.','toString','closedAt','disposition','threadId','Public'];(function(_0x5dea13,_0x1ea3cc){var _0x2c4fc6=function(_0xf79108){while(--_0xf79108){_0x5dea13['push'](_0x5dea13['shift']());}};_0x2c4fc6(++_0x1ea3cc);}(_0xa88d,0x10f));var _0xda88=function(_0x2411dd,_0x5eaf95){_0x2411dd=_0x2411dd-0x0;var _0x440f7a=_0xa88d[_0x2411dd];return _0x440f7a;};'use strict';var rimraf=require(_0xda88('0x0'));var zipdir=require(_0xda88('0x1'));var moment=require('moment');var util=require(_0xda88('0x2'));var path=require('path');var ejs=require(_0xda88('0x3'));var fs=require('fs');var _=require(_0xda88('0x4'));var Redis=require(_0xda88('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0xda88('0x6'));var pdf=require(_0xda88('0x7'));var logger=require(_0xda88('0x8'))(_0xda88('0x9'));var config=require(_0xda88('0xa'));var db=require('../../mysqldb')['db'];config[_0xda88('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xda88('0xc'))(new Redis(config[_0xda88('0xb')]));require(_0xda88('0xd'))['register'](socket);function respondWithStatusCode(_0x4774ad,_0x4a6ba9){_0x4a6ba9=_0x4a6ba9||0xcc;return function(_0x36c4fe){if(_0x36c4fe){return _0x4774ad[_0xda88('0xe')](_0x4a6ba9);}return _0x4774ad[_0xda88('0xf')](_0x4a6ba9)[_0xda88('0x10')]();};}function respondWithResult(_0x1f84b2,_0x1b556e){_0x1b556e=_0x1b556e||0xc8;return function(_0x10266c){if(_0x10266c){return _0x1f84b2['status'](_0x1b556e)['json'](_0x10266c);}};}function respondWithFilteredResult(_0x2acb26,_0x359883){return function(_0x263d1d){if(_0x263d1d){var _0xcc5923=typeof _0x359883[_0xda88('0x11')]==='undefined'&&typeof _0x359883[_0xda88('0x12')]===_0xda88('0x13');var _0x2fbdc4=_0x263d1d[_0xda88('0x14')];var _0x181d89=_0xcc5923?0x0:_0x359883[_0xda88('0x11')];var _0x59b3b9=_0xcc5923?_0x263d1d[_0xda88('0x14')]:_0x359883['offset']+_0x359883['limit'];var _0x1e7719;if(_0x59b3b9>=_0x2fbdc4){_0x59b3b9=_0x2fbdc4;_0x1e7719=0xc8;}else{_0x1e7719=0xce;}_0x2acb26['status'](_0x1e7719);return _0x2acb26[_0xda88('0x15')](_0xda88('0x16'),_0x181d89+'-'+_0x59b3b9+'/'+_0x2fbdc4)[_0xda88('0x17')](_0x263d1d);}return null;};}function saveUpdates(_0x2bf218){return function(_0x2f4cac){if(_0x2f4cac){return _0x2f4cac['update'](_0x2bf218)[_0xda88('0x18')](function(_0x1e1ec2){return _0x1e1ec2;});}return null;};}function removeEntity(_0x45ebf9){return function(_0x2440d0){if(_0x2440d0){return _0x2440d0['destroy']()[_0xda88('0x18')](function(){_0x45ebf9[_0xda88('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18c185){return function(_0x4ecacc){if(!_0x4ecacc){_0x18c185[_0xda88('0xe')](0x194);}return _0x4ecacc;};}function handleError(_0x535eba,_0x293f0a){_0x293f0a=_0x293f0a||0x1f4;return function(_0x4fa730){logger[_0xda88('0x19')](_0x4fa730['stack']);if(_0x4fa730[_0xda88('0x1a')]){delete _0x4fa730[_0xda88('0x1a')];}_0x535eba['status'](_0x293f0a)[_0xda88('0x1b')](_0x4fa730);};}exports['index']=function(_0x13daf2,_0x1104f5){var _0x2a4d0c={};var _0x3a977a=_['map'](db[_0xda88('0x1c')][_0xda88('0x1d')],function(_0x44d8d9){return{'name':_0x44d8d9[_0xda88('0x1e')],'type':_0x44d8d9[_0xda88('0x1f')][_0xda88('0x20')]};});_0x2a4d0c=qs[_0xda88('0x21')](_0x3a977a,_0x13daf2);return interaction[_0xda88('0x22')](_0xda88('0x23'),_0x13daf2[_0xda88('0x24')],_0x13daf2[_0xda88('0x25')],_0x2a4d0c,_0x3a977a)['then'](respondWithFilteredResult(_0x1104f5,_0x2a4d0c))[_0xda88('0x26')](handleError(_0x1104f5,null));};exports[_0xda88('0x27')]=function(_0x11f9a8,_0x4fb5aa){var _0x2b75fc={};if(_0x11f9a8['query'][_0xda88('0x1f')]&&_0x11f9a8[_0xda88('0x24')]['type']===_0xda88('0x28')){_0x2b75fc['from']=_0x11f9a8['params']['id'];}else{_0x2b75fc['id']=_0x11f9a8[_0xda88('0x29')]['id'];}var _0x14d723={'raw':![],'where':_0x2b75fc},_0x1530f4={};_0x1530f4['model']=_[_0xda88('0x2a')](db[_0xda88('0x1c')]['rawAttributes']);_0x1530f4[_0xda88('0x24')]=_[_0xda88('0x2a')](_0x11f9a8[_0xda88('0x24')]);_0x1530f4[_0xda88('0x2b')]=_[_0xda88('0x2c')](_0x1530f4[_0xda88('0x2d')],_0x1530f4[_0xda88('0x24')]);_0x14d723[_0xda88('0x2e')]=_[_0xda88('0x2c')](_0x1530f4['model'],qs[_0xda88('0x2f')](_0x11f9a8['query'][_0xda88('0x2f')]));_0x14d723[_0xda88('0x2e')]=_0x14d723[_0xda88('0x2e')][_0xda88('0x30')]?_0x14d723[_0xda88('0x2e')]:_0x1530f4[_0xda88('0x2d')];if(_0x11f9a8[_0xda88('0x24')][_0xda88('0x31')]){_0x14d723['include']=[{'all':!![]}];}_0x14d723=_[_0xda88('0x32')]({},_0x14d723,_0x11f9a8[_0xda88('0x33')]);return db['OpenchannelInteraction'][_0xda88('0x34')](_0x14d723)[_0xda88('0x18')](handleEntityNotFound(_0x4fb5aa,null))[_0xda88('0x18')](respondWithResult(_0x4fb5aa,null))[_0xda88('0x26')](handleError(_0x4fb5aa,null));};exports[_0xda88('0x35')]=function(_0x597e69,_0x51912a){return db[_0xda88('0x1c')][_0xda88('0x35')](_0x597e69['body'],{})[_0xda88('0x18')](respondWithResult(_0x51912a,0xc9))[_0xda88('0x26')](handleError(_0x51912a,null));};exports[_0xda88('0x36')]=function(_0x57eec6,_0x357b83){if(_0x57eec6[_0xda88('0x37')]['id']){delete _0x57eec6[_0xda88('0x37')]['id'];}return db['OpenchannelInteraction'][_0xda88('0x34')]({'where':{'id':_0x57eec6['params']['id']}})['then'](handleEntityNotFound(_0x357b83,null))[_0xda88('0x18')](saveUpdates(_0x57eec6['body'],null))[_0xda88('0x18')](respondWithResult(_0x357b83,null))[_0xda88('0x26')](handleError(_0x357b83,null));};exports['destroy']=function(_0x46bd77,_0x2aa66b){return db[_0xda88('0x1c')][_0xda88('0x34')]({'where':{'id':_0x46bd77['params']['id']}})['then'](handleEntityNotFound(_0x2aa66b,null))['then'](removeEntity(_0x2aa66b,null))[_0xda88('0x26')](handleError(_0x2aa66b,null));};exports['describe']=function(_0xf0eef8,_0x4be354){return db[_0xda88('0x1c')][_0xda88('0x38')]()[_0xda88('0x18')](respondWithResult(_0x4be354,null))[_0xda88('0x26')](handleError(_0x4be354,null));};exports[_0xda88('0x39')]=function(_0xba8eec,_0x3b3c55){return db['OpenchannelMessage'][_0xda88('0x34')]({'where':{'id':_0xba8eec[_0xda88('0x29')]['id']}})[_0xda88('0x18')](handleEntityNotFound(_0x3b3c55,null))[_0xda88('0x18')](function(_0x337f4a){if(_0x337f4a){return _0x337f4a[_0xda88('0x39')](_0xba8eec['body'][_0xda88('0x3a')],_[_0xda88('0x3b')](_0xba8eec[_0xda88('0x37')],[_0xda88('0x3a'),'id'])||{});}})[_0xda88('0x18')](respondWithResult(_0x3b3c55,null))[_0xda88('0x26')](handleError(_0x3b3c55,null));};exports[_0xda88('0x3c')]=function(_0x46be62,_0x15705a){var _0x35de2c={'raw':![],'where':{}};var _0x3444a9={};var _0x438ec4={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xda88('0x3d')]({'where':{'id':_0x46be62[_0xda88('0x29')]['id']}})[_0xda88('0x18')](handleEntityNotFound(_0x15705a,null))['then'](function(_0x5a49e9){if(_0x5a49e9){_0x3444a9['model']=_[_0xda88('0x2a')](db[_0xda88('0x3e')][_0xda88('0x1d')]);_0x3444a9[_0xda88('0x24')]=_[_0xda88('0x2a')](_0x46be62[_0xda88('0x24')]);_0x3444a9[_0xda88('0x2b')]=_[_0xda88('0x2c')](_0x3444a9[_0xda88('0x2d')],_0x3444a9[_0xda88('0x24')]);_0x35de2c[_0xda88('0x2e')]=_['intersection'](_0x3444a9[_0xda88('0x2d')],qs[_0xda88('0x2f')](_0x46be62[_0xda88('0x24')][_0xda88('0x2f')]));_0x35de2c[_0xda88('0x2e')]=_0x35de2c[_0xda88('0x2e')][_0xda88('0x30')]?_0x35de2c['attributes']:_0x3444a9[_0xda88('0x2d')];if(!_0x46be62[_0xda88('0x24')][_0xda88('0x3f')](_0xda88('0x40'))){_0x35de2c[_0xda88('0x12')]=qs[_0xda88('0x12')](_0x46be62[_0xda88('0x24')][_0xda88('0x12')]);_0x35de2c[_0xda88('0x11')]=qs[_0xda88('0x11')](_0x46be62[_0xda88('0x24')]['offset']);}_0x35de2c['order']=qs[_0xda88('0x41')](_0x46be62['query'][_0xda88('0x41')]);_0x35de2c[_0xda88('0x42')]=qs[_0xda88('0x2b')](_['pick'](_0x46be62[_0xda88('0x24')],_0x3444a9['filters']));_0x35de2c['where']['OpenchannelInteractionId']=_0x5a49e9['id'];if(_0x46be62[_0xda88('0x24')][_0xda88('0x43')]){_0x35de2c[_0xda88('0x42')]=_[_0xda88('0x32')](_0x35de2c[_0xda88('0x42')],{'$or':_['map'](_0x35de2c[_0xda88('0x2e')],function(_0x437971){var _0x39986e={};_0x39986e[_0x437971]={'$like':'%'+_0x46be62[_0xda88('0x24')][_0xda88('0x43')]+'%'};return _0x39986e;})});}if(_0x46be62[_0xda88('0x24')][_0xda88('0x44')]){var _0x128f4f=_0x46be62[_0xda88('0x24')][_0xda88('0x44')][_0xda88('0x45')](',');var _0x1222f5={};_0x1222f5[_0x128f4f[0x0]]={'$gte':moment(_0x128f4f[0x1])[_0xda88('0x46')](_0xda88('0x47'))};_0x35de2c[_0xda88('0x42')]=_['merge'](_0x35de2c[_0xda88('0x42')],_0x1222f5);}_0x35de2c=_[_0xda88('0x32')]({},_0x35de2c,_0x46be62[_0xda88('0x33')]);return db['OpenchannelMessage'][_0xda88('0x14')]({'where':_0x35de2c['where']})['then'](function(_0x315009){_0x438ec4[_0xda88('0x14')]=_0x315009;if(_0x46be62[_0xda88('0x24')][_0xda88('0x31')]){_0x35de2c['include']=[{'all':!![]}];}return db[_0xda88('0x3e')][_0xda88('0x22')](_0x35de2c);})['then'](function(_0x4d6a2b){_0x438ec4[_0xda88('0x48')]=_0x4d6a2b;return _0x438ec4;});}})[_0xda88('0x18')](respondWithFilteredResult(_0x15705a,_0x35de2c))[_0xda88('0x26')](handleError(_0x15705a,null));};exports[_0xda88('0x49')]=function(_0x523b72,_0x4770ab){return db[_0xda88('0x1c')][_0xda88('0x34')]({'where':{'id':_0x523b72[_0xda88('0x29')]['id']}})[_0xda88('0x18')](handleEntityNotFound(_0x4770ab,null))[_0xda88('0x18')](function(_0x40dd21){if(_0x40dd21){return _0x40dd21['setTags'](_0x523b72['body'][_0xda88('0x3a')],_[_0xda88('0x3b')](_0x523b72[_0xda88('0x37')],[_0xda88('0x3a'),'id'])||{})[_0xda88('0x4a')](function(){return db[_0xda88('0x4b')]['findAll']({'attributes':['id',_0xda88('0x1a'),_0xda88('0x4c')],'where':{'id':_0x523b72['body'][_0xda88('0x3a')]}});})[_0xda88('0x18')](function(_0x2de4ee){socket[_0xda88('0x4d')]('openchannelInteractionTags:save',{'id':Number(_0x523b72[_0xda88('0x29')]['id']),'tags':_0x2de4ee||[]});return{'id':Number(_0x523b72[_0xda88('0x29')]['id']),'tags':_0x2de4ee||[]};});}})[_0xda88('0x18')](respondWithResult(_0x4770ab,null))[_0xda88('0x26')](handleError(_0x4770ab,null));};exports[_0xda88('0x4e')]=function(_0x1f6c6d,_0x34c045){return db[_0xda88('0x1c')][_0xda88('0x34')]({'where':{'id':_0x1f6c6d[_0xda88('0x29')]['id']}})[_0xda88('0x18')](handleEntityNotFound(_0x34c045,null))[_0xda88('0x18')](function(_0x3ef492){if(_0x3ef492){return _0x3ef492[_0xda88('0x4e')](_0x1f6c6d[_0xda88('0x24')][_0xda88('0x3a')]);}})[_0xda88('0x18')](respondWithStatusCode(_0x34c045,null))['catch'](handleError(_0x34c045,null));};exports[_0xda88('0x4f')]=function(_0x5551ee,_0x3f27fa){var _0x3c0606=moment()[_0xda88('0x50')]()['toString']();var _0x4b1454=path[_0xda88('0x51')](config[_0xda88('0x52')],_0xda88('0x53'),_0xda88('0x54'),_0xda88('0x55'));var _0x365cd1=path[_0xda88('0x51')](config[_0xda88('0x52')],'server',_0xda88('0x54'),_0xda88('0x56'));var _0x183a13=path[_0xda88('0x51')](_0x4b1454,_0x3c0606);var _0x299f73=util[_0xda88('0x46')]('transcript-%d-%s.zip',_0x5551ee['params']['id'],_0x3c0606);var _0xfb0808=path[_0xda88('0x51')](_0x4b1454,_0x299f73);var _0x35ee73=[];_0x35ee73[_0xda88('0x57')]({'model':db[_0xda88('0x58')],'as':_0xda88('0x58'),'attributes':['id',_0xda88('0x59')],'raw':!![]});_0x35ee73[_0xda88('0x57')]({'model':db[_0xda88('0x5a')],'as':_0xda88('0x5b'),'attributes':['id',_0xda88('0x5c'),'lastName'],'raw':!![]});if(_0x5551ee[_0xda88('0x24')][_0xda88('0x56')]){_0x35ee73[_0xda88('0x57')]({'model':db[_0xda88('0x5d')],'as':_0xda88('0x5d'),'raw':!![]});}var _0x284635=[{'model':db[_0xda88('0x3e')],'as':_0xda88('0x5e'),'attributes':['id',_0xda88('0x37'),_0xda88('0x5f'),_0xda88('0x60'),'secret',_0xda88('0x61')],'include':_0x35ee73}];_0x284635[_0xda88('0x57')]({'model':db[_0xda88('0x62')],'as':_0xda88('0x63'),'attributes':['id','name']});_0x284635['push']({'model':db[_0xda88('0x58')],'as':_0xda88('0x64'),'attributes':['id',_0xda88('0x59')]});return db[_0xda88('0x1c')][_0xda88('0x34')]({'where':{'id':_0x5551ee[_0xda88('0x29')]['id']},'include':_0x284635})['then'](handleEntityNotFound(_0x3f27fa,null))[_0xda88('0x18')](function(_0x4ccb77){if(_0x4ccb77){var _0x250e48=_0x4ccb77['get']({'plain':!![]});fs['mkdirSync'](_0x183a13);var _0x59b4ee={'channel':'Openchannel','account':_0x250e48[_0xda88('0x63')][_0xda88('0x1a')],'agent':_0x250e48[_0xda88('0x64')]?_0x250e48[_0xda88('0x64')][_0xda88('0x59')]:_0xda88('0x65'),'createdAt':moment(_0x250e48[_0xda88('0x5f')])[_0xda88('0x46')](_0xda88('0x47'))[_0xda88('0x66')](),'closedAt':_0x250e48['closed']?moment(_0x250e48[_0xda88('0x67')])[_0xda88('0x46')](_0xda88('0x47'))[_0xda88('0x66')]():'','disposition':_0x250e48[_0xda88('0x68')],'visibility':_0x250e48[_0xda88('0x69')]?_0xda88('0x6a'):_0xda88('0x6b'),'messages':_(_0x250e48['Messages'])[_0xda88('0x43')]({'secret':![]})[_0xda88('0x6c')](function(_0x518f17){if(_0x518f17['Attachment']){var _0x5bad4f=path[_0xda88('0x51')](_0x365cd1,_0x518f17['Attachment'][_0xda88('0x6d')]);if(fs[_0xda88('0x6e')](_0x5bad4f)){fs[_0xda88('0x6f')](_0x5bad4f)[_0xda88('0x70')](fs[_0xda88('0x71')](path[_0xda88('0x51')](_0x183a13,_0x518f17[_0xda88('0x5d')]['basename'])));}}return{'date':moment(_0x518f17[_0xda88('0x5f')])[_0xda88('0x46')]('YYYY-MM-DD\x20HH:mm:ss')[_0xda88('0x66')](),'sender':_0x518f17[_0xda88('0x60')]===_0xda88('0x72')?_0x518f17['User']?_0x518f17['User']['fullname']:_0xda88('0x73'):_0x518f17[_0xda88('0x5b')][_0xda88('0x5c')]+(_0x518f17['Contact'][_0xda88('0x74')]?'\x20'+_0x518f17[_0xda88('0x5b')][_0xda88('0x74')]:''),'body':_0x518f17[_0xda88('0x5d')]?_0x518f17[_0xda88('0x5d')][_0xda88('0x6d')]:_0x518f17[_0xda88('0x37')],'direction':_0x518f17[_0xda88('0x60')]===_0xda88('0x72')?'A':'C','secret':_0x518f17[_0xda88('0x75')],'read':_0x518f17[_0xda88('0x61')],'attachment':_0x518f17[_0xda88('0x5d')]};})[_0xda88('0x76')]()};return ejs[_0xda88('0x77')](path[_0xda88('0x51')](config[_0xda88('0x52')],'server',_0xda88('0x78'),_0xda88('0x79')),{'interaction':_0x59b4ee})[_0xda88('0x18')](function(_0x10bc07){var _0x558168=path[_0xda88('0x51')](_0x183a13,'transcript-'+_0x250e48['id']+'-'+_0x3c0606+'.pdf');var _0x1ae88a={'path':_0x558168,'channel':_0xda88('0x7a'),'interactionId':_0x250e48['id']};return pdf[_0xda88('0x7b')](_0x10bc07,_0x1ae88a);})[_0xda88('0x18')](function(){return new Promise(function(_0xfc39fd,_0x311f3a){zipdir(_0x183a13,{'saveTo':_0xfb0808},function(_0x21a6cf,_0x16f843){if(_0x21a6cf)return _0x311f3a(_0x21a6cf);return _0xfc39fd(_0x16f843);});})[_0xda88('0x18')](function(){return new Promise(function(_0x33581c,_0x32c12d){rimraf(_0x183a13,function(_0x69e15a){if(_0x69e15a)_0x32c12d(_0x69e15a);return _0x33581c();});});})[_0xda88('0x18')](function(){return _0x3f27fa[_0xda88('0x4f')](_0xfb0808,_0x299f73,function(_0x920bdd){if(_0x920bdd){logger[_0xda88('0x19')](_0xda88('0x7c'),_0x920bdd);}else{fs[_0xda88('0x7d')](_0xfb0808);}});});});}else{return _0x3f27fa[_0xda88('0xe')](0xc8);}})[_0xda88('0x26')](handleError(_0x3f27fa,null));}; \ No newline at end of file +var _0xbf6d=['removeTags','download','toString','join','root','server','files','tmp','attachments','push','User','fullname','CmContact','Contact','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Owner','mkdirSync','Openchannel','Account','closed','closedAt','disposition','threadId','existsSync','pipe','createWriteStream','YYYY-MM-DD\x20HH:mm:ss','out','System','firstName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','unlinkSync','zip-dir','moment','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','key','getOptions','findAll','user','catch','query','type','from','params','model','keys','OpenchannelInteraction','intersection','fields','attributes','length','includeAll','include','options','find','create','body','describe','OpenchannelMessage','addMessage','ids','getMessages','findOne','filters','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','merge','$gte','split','format','rows','addTags','setTags','omit','Tag','color','openchannelInteractionTags:save'];(function(_0x599d4b,_0x1fc5e0){var _0x3ec5d0=function(_0x411950){while(--_0x411950){_0x599d4b['push'](_0x599d4b['shift']());}};_0x3ec5d0(++_0x1fc5e0);}(_0xbf6d,0xa9));var _0xdbf6=function(_0x139a23,_0x184a3f){_0x139a23=_0x139a23-0x0;var _0x4da424=_0xbf6d[_0x139a23];return _0x4da424;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xdbf6('0x0'));var moment=require(_0xdbf6('0x1'));var util=require(_0xdbf6('0x2'));var path=require('path');var ejs=require(_0xdbf6('0x3'));var fs=require('fs');var _=require(_0xdbf6('0x4'));var Redis=require(_0xdbf6('0x5'));var interaction=require(_0xdbf6('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0xdbf6('0x7'));var logger=require(_0xdbf6('0x8'))('api');var config=require(_0xdbf6('0x9'));var db=require(_0xdbf6('0xa'))['db'];config[_0xdbf6('0xb')]=_[_0xdbf6('0xc')](config[_0xdbf6('0xb')],{'host':_0xdbf6('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdbf6('0xb')]));require(_0xdbf6('0xe'))['register'](socket);function respondWithStatusCode(_0xb595d8,_0x293356){_0x293356=_0x293356||0xcc;return function(_0x5c030f){if(_0x5c030f){return _0xb595d8[_0xdbf6('0xf')](_0x293356);}return _0xb595d8[_0xdbf6('0x10')](_0x293356)[_0xdbf6('0x11')]();};}function respondWithResult(_0x35af19,_0x4a208f){_0x4a208f=_0x4a208f||0xc8;return function(_0x30af0f){if(_0x30af0f){return _0x35af19[_0xdbf6('0x10')](_0x4a208f)[_0xdbf6('0x12')](_0x30af0f);}};}function respondWithFilteredResult(_0x366a12,_0x4d4066){return function(_0x5f7c7b){if(_0x5f7c7b){var _0x3f5305=typeof _0x4d4066[_0xdbf6('0x13')]===_0xdbf6('0x14')&&typeof _0x4d4066[_0xdbf6('0x15')]===_0xdbf6('0x14');var _0x4cd5e3=_0x5f7c7b[_0xdbf6('0x16')];var _0x45b60a=_0x3f5305?0x0:_0x4d4066['offset'];var _0x441054=_0x3f5305?_0x5f7c7b[_0xdbf6('0x16')]:_0x4d4066[_0xdbf6('0x13')]+_0x4d4066[_0xdbf6('0x15')];var _0x4208ec;if(_0x441054>=_0x4cd5e3){_0x441054=_0x4cd5e3;_0x4208ec=0xc8;}else{_0x4208ec=0xce;}_0x366a12['status'](_0x4208ec);return _0x366a12['set'](_0xdbf6('0x17'),_0x45b60a+'-'+_0x441054+'/'+_0x4cd5e3)[_0xdbf6('0x12')](_0x5f7c7b);}return null;};}function saveUpdates(_0x1113fd){return function(_0x4ab2ec){if(_0x4ab2ec){return _0x4ab2ec[_0xdbf6('0x18')](_0x1113fd)[_0xdbf6('0x19')](function(_0x31f106){return _0x31f106;});}return null;};}function removeEntity(_0x5999b7){return function(_0x1b7485){if(_0x1b7485){return _0x1b7485[_0xdbf6('0x1a')]()[_0xdbf6('0x19')](function(){_0x5999b7[_0xdbf6('0x10')](0xcc)[_0xdbf6('0x11')]();});}};}function handleEntityNotFound(_0x14a5a3){return function(_0x162ecc){if(!_0x162ecc){_0x14a5a3['sendStatus'](0x194);}return _0x162ecc;};}function handleError(_0x3d36ad,_0x2bcf14){_0x2bcf14=_0x2bcf14||0x1f4;return function(_0x30e852){logger[_0xdbf6('0x1b')](_0x30e852[_0xdbf6('0x1c')]);if(_0x30e852[_0xdbf6('0x1d')]){delete _0x30e852[_0xdbf6('0x1d')];}_0x3d36ad[_0xdbf6('0x10')](_0x2bcf14)['send'](_0x30e852);};}exports['index']=function(_0x317f60,_0x4371e5){var _0x5100fd={};var _0x38f606=_[_0xdbf6('0x1e')](db['OpenchannelInteraction'][_0xdbf6('0x1f')],function(_0x70454e){return{'name':_0x70454e[_0xdbf6('0x20')],'type':_0x70454e['type'][_0xdbf6('0x21')]};});_0x5100fd=qs[_0xdbf6('0x22')](_0x38f606,_0x317f60);return interaction[_0xdbf6('0x23')]('openchannel',_0x317f60['query'],_0x317f60[_0xdbf6('0x24')],_0x5100fd,_0x38f606)[_0xdbf6('0x19')](respondWithFilteredResult(_0x4371e5,_0x5100fd))[_0xdbf6('0x25')](handleError(_0x4371e5,null));};exports['show']=function(_0x6bf304,_0x2462a2){var _0x3d564d={};if(_0x6bf304[_0xdbf6('0x26')][_0xdbf6('0x27')]&&_0x6bf304[_0xdbf6('0x26')][_0xdbf6('0x27')]===_0xdbf6('0x28')){_0x3d564d[_0xdbf6('0x28')]=_0x6bf304[_0xdbf6('0x29')]['id'];}else{_0x3d564d['id']=_0x6bf304[_0xdbf6('0x29')]['id'];}var _0x4dd052={'raw':![],'where':_0x3d564d},_0x3799bb={};_0x3799bb[_0xdbf6('0x2a')]=_[_0xdbf6('0x2b')](db[_0xdbf6('0x2c')][_0xdbf6('0x1f')]);_0x3799bb['query']=_[_0xdbf6('0x2b')](_0x6bf304[_0xdbf6('0x26')]);_0x3799bb['filters']=_[_0xdbf6('0x2d')](_0x3799bb['model'],_0x3799bb['query']);_0x4dd052['attributes']=_[_0xdbf6('0x2d')](_0x3799bb[_0xdbf6('0x2a')],qs['fields'](_0x6bf304[_0xdbf6('0x26')][_0xdbf6('0x2e')]));_0x4dd052['attributes']=_0x4dd052[_0xdbf6('0x2f')][_0xdbf6('0x30')]?_0x4dd052[_0xdbf6('0x2f')]:_0x3799bb[_0xdbf6('0x2a')];if(_0x6bf304[_0xdbf6('0x26')][_0xdbf6('0x31')]){_0x4dd052[_0xdbf6('0x32')]=[{'all':!![]}];}_0x4dd052=_['merge']({},_0x4dd052,_0x6bf304[_0xdbf6('0x33')]);return db[_0xdbf6('0x2c')][_0xdbf6('0x34')](_0x4dd052)[_0xdbf6('0x19')](handleEntityNotFound(_0x2462a2,null))['then'](respondWithResult(_0x2462a2,null))['catch'](handleError(_0x2462a2,null));};exports[_0xdbf6('0x35')]=function(_0xee1c60,_0x17f069){return db[_0xdbf6('0x2c')][_0xdbf6('0x35')](_0xee1c60[_0xdbf6('0x36')],{})[_0xdbf6('0x19')](respondWithResult(_0x17f069,0xc9))[_0xdbf6('0x25')](handleError(_0x17f069,null));};exports[_0xdbf6('0x18')]=function(_0x1046cb,_0x3a3ac2){if(_0x1046cb[_0xdbf6('0x36')]['id']){delete _0x1046cb[_0xdbf6('0x36')]['id'];}return db[_0xdbf6('0x2c')][_0xdbf6('0x34')]({'where':{'id':_0x1046cb['params']['id']}})[_0xdbf6('0x19')](handleEntityNotFound(_0x3a3ac2,null))[_0xdbf6('0x19')](saveUpdates(_0x1046cb[_0xdbf6('0x36')],null))[_0xdbf6('0x19')](respondWithResult(_0x3a3ac2,null))[_0xdbf6('0x25')](handleError(_0x3a3ac2,null));};exports[_0xdbf6('0x1a')]=function(_0x3bca39,_0x397d52){return db['OpenchannelInteraction']['find']({'where':{'id':_0x3bca39[_0xdbf6('0x29')]['id']}})[_0xdbf6('0x19')](handleEntityNotFound(_0x397d52,null))[_0xdbf6('0x19')](removeEntity(_0x397d52,null))[_0xdbf6('0x25')](handleError(_0x397d52,null));};exports[_0xdbf6('0x37')]=function(_0x2e7df8,_0x1965cf){return db[_0xdbf6('0x2c')][_0xdbf6('0x37')]()[_0xdbf6('0x19')](respondWithResult(_0x1965cf,null))[_0xdbf6('0x25')](handleError(_0x1965cf,null));};exports['addMessage']=function(_0x5cfc45,_0x5ee4c4){return db[_0xdbf6('0x38')][_0xdbf6('0x34')]({'where':{'id':_0x5cfc45[_0xdbf6('0x29')]['id']}})[_0xdbf6('0x19')](handleEntityNotFound(_0x5ee4c4,null))[_0xdbf6('0x19')](function(_0x37025c){if(_0x37025c){return _0x37025c[_0xdbf6('0x39')](_0x5cfc45['body'][_0xdbf6('0x3a')],_['omit'](_0x5cfc45['body'],[_0xdbf6('0x3a'),'id'])||{});}})[_0xdbf6('0x19')](respondWithResult(_0x5ee4c4,null))[_0xdbf6('0x25')](handleError(_0x5ee4c4,null));};exports[_0xdbf6('0x3b')]=function(_0x4b90a9,_0x56b3b4){var _0x4f17f9={'raw':![],'where':{}};var _0x5605fa={};var _0x3c5697={'count':0x0,'rows':[]};return db[_0xdbf6('0x2c')][_0xdbf6('0x3c')]({'where':{'id':_0x4b90a9['params']['id']}})[_0xdbf6('0x19')](handleEntityNotFound(_0x56b3b4,null))[_0xdbf6('0x19')](function(_0xc57f2){if(_0xc57f2){_0x5605fa[_0xdbf6('0x2a')]=_[_0xdbf6('0x2b')](db[_0xdbf6('0x38')][_0xdbf6('0x1f')]);_0x5605fa[_0xdbf6('0x26')]=_[_0xdbf6('0x2b')](_0x4b90a9[_0xdbf6('0x26')]);_0x5605fa[_0xdbf6('0x3d')]=_[_0xdbf6('0x2d')](_0x5605fa[_0xdbf6('0x2a')],_0x5605fa[_0xdbf6('0x26')]);_0x4f17f9[_0xdbf6('0x2f')]=_[_0xdbf6('0x2d')](_0x5605fa[_0xdbf6('0x2a')],qs[_0xdbf6('0x2e')](_0x4b90a9[_0xdbf6('0x26')][_0xdbf6('0x2e')]));_0x4f17f9[_0xdbf6('0x2f')]=_0x4f17f9[_0xdbf6('0x2f')][_0xdbf6('0x30')]?_0x4f17f9[_0xdbf6('0x2f')]:_0x5605fa[_0xdbf6('0x2a')];if(!_0x4b90a9[_0xdbf6('0x26')][_0xdbf6('0x3e')](_0xdbf6('0x3f'))){_0x4f17f9['limit']=qs[_0xdbf6('0x15')](_0x4b90a9['query'][_0xdbf6('0x15')]);_0x4f17f9[_0xdbf6('0x13')]=qs[_0xdbf6('0x13')](_0x4b90a9['query']['offset']);}_0x4f17f9[_0xdbf6('0x40')]=qs[_0xdbf6('0x41')](_0x4b90a9[_0xdbf6('0x26')][_0xdbf6('0x41')]);_0x4f17f9[_0xdbf6('0x42')]=qs['filters'](_[_0xdbf6('0x43')](_0x4b90a9[_0xdbf6('0x26')],_0x5605fa['filters']));_0x4f17f9[_0xdbf6('0x42')][_0xdbf6('0x44')]=_0xc57f2['id'];if(_0x4b90a9[_0xdbf6('0x26')][_0xdbf6('0x45')]){_0x4f17f9[_0xdbf6('0x42')]=_[_0xdbf6('0x46')](_0x4f17f9['where'],{'$or':_[_0xdbf6('0x1e')](_0x4f17f9['attributes'],function(_0x27d7d6){var _0x2185c3={};_0x2185c3[_0x27d7d6]={'$like':'%'+_0x4b90a9[_0xdbf6('0x26')][_0xdbf6('0x45')]+'%'};return _0x2185c3;})});}if(_0x4b90a9[_0xdbf6('0x26')][_0xdbf6('0x47')]){var _0x47bae5=_0x4b90a9['query']['$gte'][_0xdbf6('0x48')](',');var _0x579757={};_0x579757[_0x47bae5[0x0]]={'$gte':moment(_0x47bae5[0x1])[_0xdbf6('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4f17f9[_0xdbf6('0x42')]=_[_0xdbf6('0x46')](_0x4f17f9[_0xdbf6('0x42')],_0x579757);}_0x4f17f9=_[_0xdbf6('0x46')]({},_0x4f17f9,_0x4b90a9[_0xdbf6('0x33')]);return db['OpenchannelMessage'][_0xdbf6('0x16')]({'where':_0x4f17f9[_0xdbf6('0x42')]})['then'](function(_0xfef98a){_0x3c5697[_0xdbf6('0x16')]=_0xfef98a;if(_0x4b90a9['query'][_0xdbf6('0x31')]){_0x4f17f9[_0xdbf6('0x32')]=[{'all':!![]}];}return db[_0xdbf6('0x38')][_0xdbf6('0x23')](_0x4f17f9);})[_0xdbf6('0x19')](function(_0x428a2e){_0x3c5697[_0xdbf6('0x4a')]=_0x428a2e;return _0x3c5697;});}})[_0xdbf6('0x19')](respondWithFilteredResult(_0x56b3b4,_0x4f17f9))[_0xdbf6('0x25')](handleError(_0x56b3b4,null));};exports[_0xdbf6('0x4b')]=function(_0x104c58,_0x19a4e9){return db[_0xdbf6('0x2c')][_0xdbf6('0x34')]({'where':{'id':_0x104c58[_0xdbf6('0x29')]['id']}})[_0xdbf6('0x19')](handleEntityNotFound(_0x19a4e9,null))[_0xdbf6('0x19')](function(_0x3b45ec){if(_0x3b45ec){return _0x3b45ec[_0xdbf6('0x4c')](_0x104c58[_0xdbf6('0x36')][_0xdbf6('0x3a')],_[_0xdbf6('0x4d')](_0x104c58[_0xdbf6('0x36')],[_0xdbf6('0x3a'),'id'])||{})['spread'](function(){return db[_0xdbf6('0x4e')]['findAll']({'attributes':['id',_0xdbf6('0x1d'),_0xdbf6('0x4f')],'where':{'id':_0x104c58['body']['ids']}});})['then'](function(_0x2dff46){socket['emit'](_0xdbf6('0x50'),{'id':Number(_0x104c58[_0xdbf6('0x29')]['id']),'tags':_0x2dff46||[]});return{'id':Number(_0x104c58[_0xdbf6('0x29')]['id']),'tags':_0x2dff46||[]};});}})[_0xdbf6('0x19')](respondWithResult(_0x19a4e9,null))[_0xdbf6('0x25')](handleError(_0x19a4e9,null));};exports['removeTags']=function(_0x18fc6d,_0x281dc4){return db[_0xdbf6('0x2c')][_0xdbf6('0x34')]({'where':{'id':_0x18fc6d[_0xdbf6('0x29')]['id']}})[_0xdbf6('0x19')](handleEntityNotFound(_0x281dc4,null))['then'](function(_0x28647e){if(_0x28647e){return _0x28647e[_0xdbf6('0x51')](_0x18fc6d[_0xdbf6('0x26')][_0xdbf6('0x3a')]);}})[_0xdbf6('0x19')](respondWithStatusCode(_0x281dc4,null))[_0xdbf6('0x25')](handleError(_0x281dc4,null));};exports[_0xdbf6('0x52')]=function(_0x498e58,_0x35216b){var _0x58963a=moment()['unix']()[_0xdbf6('0x53')]();var _0x3a818a=path[_0xdbf6('0x54')](config[_0xdbf6('0x55')],_0xdbf6('0x56'),_0xdbf6('0x57'),_0xdbf6('0x58'));var _0x37a3fb=path[_0xdbf6('0x54')](config['root'],_0xdbf6('0x56'),_0xdbf6('0x57'),_0xdbf6('0x59'));var _0xbae957=path[_0xdbf6('0x54')](_0x3a818a,_0x58963a);var _0x5f1a99=util[_0xdbf6('0x49')]('transcript-%d-%s.zip',_0x498e58[_0xdbf6('0x29')]['id'],_0x58963a);var _0x517399=path[_0xdbf6('0x54')](_0x3a818a,_0x5f1a99);var _0x1a910a=[];_0x1a910a[_0xdbf6('0x5a')]({'model':db[_0xdbf6('0x5b')],'as':_0xdbf6('0x5b'),'attributes':['id',_0xdbf6('0x5c')],'raw':!![]});_0x1a910a['push']({'model':db[_0xdbf6('0x5d')],'as':_0xdbf6('0x5e'),'attributes':['id','firstName',_0xdbf6('0x5f')],'raw':!![]});if(_0x498e58[_0xdbf6('0x26')][_0xdbf6('0x59')]){_0x1a910a[_0xdbf6('0x5a')]({'model':db[_0xdbf6('0x60')],'as':_0xdbf6('0x60'),'raw':!![]});}var _0x516eda=[{'model':db[_0xdbf6('0x38')],'as':_0xdbf6('0x61'),'attributes':['id',_0xdbf6('0x36'),_0xdbf6('0x62'),_0xdbf6('0x63'),_0xdbf6('0x64'),_0xdbf6('0x65')],'include':_0x1a910a}];_0x516eda[_0xdbf6('0x5a')]({'model':db[_0xdbf6('0x66')],'as':'Account','attributes':['id','name']});_0x516eda['push']({'model':db[_0xdbf6('0x5b')],'as':_0xdbf6('0x67'),'attributes':['id',_0xdbf6('0x5c')]});return db[_0xdbf6('0x2c')]['find']({'where':{'id':_0x498e58[_0xdbf6('0x29')]['id']},'include':_0x516eda})['then'](handleEntityNotFound(_0x35216b,null))['then'](function(_0x5e8d08){if(_0x5e8d08){var _0x2599a1=_0x5e8d08['get']({'plain':!![]});fs[_0xdbf6('0x68')](_0xbae957);var _0x5202d4={'channel':_0xdbf6('0x69'),'account':_0x2599a1[_0xdbf6('0x6a')][_0xdbf6('0x1d')],'agent':_0x2599a1[_0xdbf6('0x67')]?_0x2599a1['Owner']['fullname']:'N.A.','createdAt':moment(_0x2599a1[_0xdbf6('0x62')])[_0xdbf6('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0xdbf6('0x53')](),'closedAt':_0x2599a1[_0xdbf6('0x6b')]?moment(_0x2599a1[_0xdbf6('0x6c')])[_0xdbf6('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0xdbf6('0x53')]():'','disposition':_0x2599a1[_0xdbf6('0x6d')],'visibility':_0x2599a1[_0xdbf6('0x6e')]?'Public':'Private','messages':_(_0x2599a1[_0xdbf6('0x61')])['filter']({'secret':![]})[_0xdbf6('0x1e')](function(_0x221463){if(_0x221463[_0xdbf6('0x60')]){var _0x45f8ea=path[_0xdbf6('0x54')](_0x37a3fb,_0x221463['Attachment']['basename']);if(fs[_0xdbf6('0x6f')](_0x45f8ea)){fs['createReadStream'](_0x45f8ea)[_0xdbf6('0x70')](fs[_0xdbf6('0x71')](path[_0xdbf6('0x54')](_0xbae957,_0x221463[_0xdbf6('0x60')]['basename'])));}}return{'date':moment(_0x221463[_0xdbf6('0x62')])[_0xdbf6('0x49')](_0xdbf6('0x72'))[_0xdbf6('0x53')](),'sender':_0x221463[_0xdbf6('0x63')]===_0xdbf6('0x73')?_0x221463['User']?_0x221463['User'][_0xdbf6('0x5c')]:_0xdbf6('0x74'):_0x221463[_0xdbf6('0x5e')][_0xdbf6('0x75')]+(_0x221463['Contact'][_0xdbf6('0x5f')]?'\x20'+_0x221463[_0xdbf6('0x5e')]['lastName']:''),'body':_0x221463[_0xdbf6('0x60')]?_0x221463[_0xdbf6('0x60')]['basename']:_0x221463[_0xdbf6('0x36')],'direction':_0x221463[_0xdbf6('0x63')]===_0xdbf6('0x73')?'A':'C','secret':_0x221463[_0xdbf6('0x64')],'read':_0x221463['read'],'attachment':_0x221463[_0xdbf6('0x60')]};})[_0xdbf6('0x76')]()};return ejs[_0xdbf6('0x77')](path['join'](config[_0xdbf6('0x55')],_0xdbf6('0x56'),_0xdbf6('0x78'),_0xdbf6('0x79')),{'interaction':_0x5202d4})[_0xdbf6('0x19')](function(_0x5b365f){var _0x5d4a84=path['join'](_0xbae957,_0xdbf6('0x7a')+_0x2599a1['id']+'-'+_0x58963a+_0xdbf6('0x7b'));var _0x76a59f={'path':_0x5d4a84,'channel':_0xdbf6('0x69'),'interactionId':_0x2599a1['id']};return pdf['createPdfFromHTML'](_0x5b365f,_0x76a59f);})['then'](function(){return new Promise(function(_0x4a1ee2,_0x2b990b){zipdir(_0xbae957,{'saveTo':_0x517399},function(_0x246fb6,_0x29e468){if(_0x246fb6)return _0x2b990b(_0x246fb6);return _0x4a1ee2(_0x29e468);});})[_0xdbf6('0x19')](function(){return new Promise(function(_0x28c04b,_0x402de5){rimraf(_0xbae957,function(_0x522003){if(_0x522003)_0x402de5(_0x522003);return _0x28c04b();});});})[_0xdbf6('0x19')](function(){return _0x35216b['download'](_0x517399,_0x5f1a99,function(_0x38979d){if(_0x38979d){logger[_0xdbf6('0x1b')]('Unable\x20to\x20delete\x20zip\x20file',_0x38979d);}else{fs[_0xdbf6('0x7c')](_0x517399);}});});});}else{return _0x35216b[_0xdbf6('0xf')](0xc8);}})[_0xdbf6('0x25')](handleError(_0x35216b,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 11b73c6..8034d4b 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 _0x42a7=['update','remove','then','Users','map','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save'];(function(_0x1ea377,_0x57d1b0){var _0x2ba96b=function(_0x401715){while(--_0x401715){_0x1ea377['push'](_0x1ea377['shift']());}};_0x2ba96b(++_0x57d1b0);}(_0x42a7,0x198));var _0x742a=function(_0x3434a8,_0x5571b1){_0x3434a8=_0x3434a8-0x0;var _0x555665=_0x42a7[_0x3434a8];return _0x555665;};'use strict';var EventEmitter=require(_0x742a('0x0'));var OpenchannelInteraction=require(_0x742a('0x1'))['db'][_0x742a('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x742a('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x742a('0x4')](0x0);var events={'afterCreate':_0x742a('0x5'),'afterUpdate':_0x742a('0x6'),'afterDestroy':_0x742a('0x7')};function emitEvent(_0x41a438){return function(_0x2effb4,_0x13583d,_0x53aa6b){_0x2effb4['getUsers']({'attributes':['id'],'raw':!![]})[_0x742a('0x8')](function(_0x50a1fa){_0x2effb4['setDataValue'](_0x742a('0x9'),_0x50a1fa[_0x742a('0xa')](function(_0x1abfa1){return{'id':_0x1abfa1['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x2effb4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x742a('0x8')](function(_0x32b955){_0x2effb4[_0x742a('0xb')](_0x742a('0xc'),_0x32b955[_0x742a('0xd')]);OpenchannelInteractionEvents[_0x742a('0xe')](_0x41a438+':'+_0x2effb4['id'],_0x2effb4);OpenchannelInteractionEvents[_0x742a('0xe')](_0x41a438,_0x2effb4);_0x53aa6b(null);})['catch'](_0x53aa6b(null));};}for(var e in events){if(events[_0x742a('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x742a('0x10')](e,emitEvent(event));}}module[_0x742a('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xcd8b=['remove','getUsers','then','setDataValue','map','unreadMessages','length','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcd8b,0xea));var _0xbcd8=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xcd8b[_0x2c91e9];return _0x13f0ff;};'use strict';var EventEmitter=require(_0xbcd8('0x0'));var OpenchannelInteraction=require(_0xbcd8('0x1'))['db'][_0xbcd8('0x2')];var OpenchannelMessage=require(_0xbcd8('0x1'))['db'][_0xbcd8('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xbcd8('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbcd8('0x5'),'afterDestroy':_0xbcd8('0x6')};function emitEvent(_0x2fbac9){return function(_0x5754d2,_0x15c1b7,_0x3faad2){_0x5754d2[_0xbcd8('0x7')]({'attributes':['id'],'raw':!![]})[_0xbcd8('0x8')](function(_0x4dbb3d){_0x5754d2[_0xbcd8('0x9')]('Users',_0x4dbb3d[_0xbcd8('0xa')](function(_0x297928){return{'id':_0x297928['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x5754d2['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbcd8('0x8')](function(_0x4335b1){_0x5754d2['setDataValue'](_0xbcd8('0xb'),_0x4335b1[_0xbcd8('0xc')]);OpenchannelInteractionEvents[_0xbcd8('0xd')](_0x2fbac9+':'+_0x5754d2['id'],_0x5754d2);OpenchannelInteractionEvents[_0xbcd8('0xd')](_0x2fbac9,_0x5754d2);_0x3faad2(null);})['catch'](_0x3faad2(null));};}for(var e in events){if(events[_0xbcd8('0xe')](e)){var event=events[e];OpenchannelInteraction[_0xbcd8('0xf')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 7dea389..9de9bc2 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 _0x2c24=['utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions'];(function(_0x5db1fd,_0x4877ef){var _0x2f70ec=function(_0x531817){while(--_0x531817){_0x5db1fd['push'](_0x5db1fd['shift']());}};_0x2f70ec(++_0x4877ef);}(_0x2c24,0x1e6));var _0x42c2=function(_0x5e40ef,_0x213b3e){_0x5e40ef=_0x5e40ef-0x0;var _0x5a1fc5=_0x2c24[_0x5e40ef];return _0x5a1fc5;};'use strict';var _=require(_0x42c2('0x0'));var util=require(_0x42c2('0x1'));var logger=require(_0x42c2('0x2'))(_0x42c2('0x3'));var moment=require(_0x42c2('0x4'));var BPromise=require(_0x42c2('0x5'));var rp=require(_0x42c2('0x6'));var fs=require('fs');var path=require(_0x42c2('0x7'));var rimraf=require(_0x42c2('0x8'));var config=require('../../config/environment');var attributes=require(_0x42c2('0x9'));module[_0x42c2('0xa')]=function(_0x4950c1,_0x20d310){return _0x4950c1[_0x42c2('0xb')](_0x42c2('0xc'),attributes,{'tableName':_0x42c2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x42c2('0xe'),'collate':_0x42c2('0xf'),'hooks':{'beforeUpdate':function(_0x322f88,_0x54bd4f,_0x4f259f){if(_0x322f88[_0x42c2('0x10')](_0x42c2('0x11'))){_0x322f88[_0x42c2('0x12')]=moment()['format'](_0x42c2('0x13'));}_0x4f259f(null,_0x322f88);}}});}; \ No newline at end of file +var _0xacbd=['closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','utf8mb4','utf8mb4_unicode_ci','changed'];(function(_0x30630a,_0x4f6bac){var _0x230c6f=function(_0x11cff7){while(--_0x11cff7){_0x30630a['push'](_0x30630a['shift']());}};_0x230c6f(++_0x4f6bac);}(_0xacbd,0x8a));var _0xdacb=function(_0x9f4df,_0x5ad149){_0x9f4df=_0x9f4df-0x0;var _0x4a79a3=_0xacbd[_0x9f4df];return _0x4a79a3;};'use strict';var _=require(_0xdacb('0x0'));var util=require('util');var logger=require(_0xdacb('0x1'))(_0xdacb('0x2'));var moment=require(_0xdacb('0x3'));var BPromise=require(_0xdacb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdacb('0x5'));var rimraf=require(_0xdacb('0x6'));var config=require(_0xdacb('0x7'));var attributes=require(_0xdacb('0x8'));module['exports']=function(_0x5d736c,_0x3f80e1){return _0x5d736c['define']('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdacb('0x9'),'collate':_0xdacb('0xa'),'hooks':{'beforeUpdate':function(_0x3de344,_0x53ea30,_0x4f8f96){if(_0x3de344[_0xdacb('0xb')](_0xdacb('0xc'))){_0x3de344[_0xdacb('0xd')]=moment()['format'](_0xdacb('0xe'));}_0x4f8f96(null,_0x3de344);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 4d65779..1bab8f3 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 _0x8430=['register','then','info','request\x20sent','debug','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToOpenchannelInteraction','find','addTags','ids','spread','AddTags','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket'];(function(_0x31bab3,_0x44554f){var _0x4fd382=function(_0x42b336){while(--_0x42b336){_0x31bab3['push'](_0x31bab3['shift']());}};_0x4fd382(++_0x44554f);}(_0x8430,0x13a));var _0x0843=function(_0x438fe1,_0x3308d5){_0x438fe1=_0x438fe1-0x0;var _0x3c8e1b=_0x8430[_0x438fe1];return _0x3c8e1b;};'use strict';var _=require(_0x0843('0x0'));var util=require('util');var moment=require(_0x0843('0x1'));var BPromise=require(_0x0843('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0843('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0843('0x4'));var logger=require('../../config/logger')(_0x0843('0x5'));var config=require(_0x0843('0x6'));var jayson=require(_0x0843('0x7'));var client=jayson['client'][_0x0843('0x8')]({'port':0x232a});config[_0x0843('0x9')]=_[_0x0843('0xa')](config['redis'],{'host':_0x0843('0xb'),'port':0x18eb});var socket=require(_0x0843('0xc'))(new Redis(config[_0x0843('0x9')]));require(_0x0843('0xd'))[_0x0843('0xe')](socket);function respondWithRpcPromise(_0x2a48d3,_0x19fae6,_0x24644a){return new BPromise(function(_0x20e75f,_0x390b1c){return client['request'](_0x2a48d3,_0x24644a)[_0x0843('0xf')](function(_0x1e0d2c){logger[_0x0843('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x19fae6,_0x0843('0x11'));logger[_0x0843('0x12')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x19fae6,_0x0843('0x11'),JSON['stringify'](_0x1e0d2c));if(_0x1e0d2c[_0x0843('0x13')]){if(_0x1e0d2c[_0x0843('0x13')][_0x0843('0x14')]===0x1f4){logger[_0x0843('0x13')](_0x0843('0x15'),_0x19fae6,_0x1e0d2c[_0x0843('0x13')][_0x0843('0x16')]);return _0x390b1c(_0x1e0d2c[_0x0843('0x13')]['message']);}logger['error'](_0x0843('0x15'),_0x19fae6,_0x1e0d2c['error'][_0x0843('0x16')]);return _0x20e75f(_0x1e0d2c[_0x0843('0x13')][_0x0843('0x16')]);}else{logger[_0x0843('0x10')](_0x0843('0x15'),_0x19fae6,_0x0843('0x11'));_0x20e75f(_0x1e0d2c[_0x0843('0x17')][_0x0843('0x16')]);}})[_0x0843('0x18')](function(_0x154854){logger[_0x0843('0x13')](_0x0843('0x15'),_0x19fae6,_0x154854);_0x390b1c(_0x154854);});});}exports[_0x0843('0x19')]=function(_0x3397c0){var _0x43b338=this;return new Promise(function(_0x434382,_0x5acf24){return db[_0x0843('0x1a')][_0x0843('0x1b')](_0x3397c0[_0x0843('0x1c')],{'raw':_0x3397c0[_0x0843('0x1d')]?_0x3397c0[_0x0843('0x1d')][_0x0843('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3397c0[_0x0843('0x1d')]?_0x3397c0[_0x0843('0x1d')][_0x0843('0x1f')]||null:null,'attributes':_0x3397c0[_0x0843('0x1d')]?_0x3397c0['options'][_0x0843('0x20')]||null:null,'limit':_0x3397c0['options']?_0x3397c0[_0x0843('0x1d')][_0x0843('0x21')]||null:null})['then'](function(_0x1c30a2){logger[_0x0843('0x10')]('UpdateOpenchannelInteraction',_0x3397c0);logger[_0x0843('0x12')](_0x0843('0x19'),_0x3397c0,JSON[_0x0843('0x22')](_0x1c30a2));_0x434382(_0x1c30a2);})[_0x0843('0x18')](function(_0x33cf37){logger[_0x0843('0x13')](_0x0843('0x19'),_0x33cf37[_0x0843('0x16')],_0x3397c0);_0x5acf24(_0x43b338['error'](0x1f4,_0x33cf37[_0x0843('0x16')]));});});};exports[_0x0843('0x23')]=function(_0x1158f4){return new Promise(function(_0x4f9cd9,_0x52230d){return db['OpenchannelInteraction'][_0x0843('0x24')]({'where':_0x1158f4[_0x0843('0x1d')]?_0x1158f4[_0x0843('0x1d')][_0x0843('0x1f')]||null:null})[_0x0843('0xf')](function(_0x3fdc9d){if(_0x3fdc9d){return _0x3fdc9d[_0x0843('0x25')](_0x1158f4['body'][_0x0843('0x26')],_['omit'](_0x1158f4[_0x0843('0x1c')],[_0x0843('0x26'),'id'])||{});}})[_0x0843('0x27')](function(_0x553777){logger[_0x0843('0x10')](_0x0843('0x28'),_0x1158f4);logger[_0x0843('0x12')](_0x0843('0x28'),_0x1158f4,JSON[_0x0843('0x22')](_0x553777));_0x4f9cd9(_0x553777);})[_0x0843('0x18')](function(_0x16dabe){logger[_0x0843('0x13')](_0x0843('0x28'),_0x16dabe[_0x0843('0x16')],_0x1158f4);_0x52230d(_this[_0x0843('0x13')](0x1f4,_0x16dabe[_0x0843('0x16')]));});});}; \ No newline at end of file +var _0xbed9=['code','message','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','find','addTags','body','ids','omit','AddTags','catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x7043ca,_0x4bf9e4){var _0x40376b=function(_0x54095a){while(--_0x54095a){_0x7043ca['push'](_0x7043ca['shift']());}};_0x40376b(++_0x4bf9e4);}(_0xbed9,0x129));var _0x9bed=function(_0x476157,_0x1d310b){_0x476157=_0x476157-0x0;var _0x171d27=_0xbed9[_0x476157];return _0x171d27;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9bed('0x0'));var fs=require('fs');var Redis=require(_0x9bed('0x1'));var db=require(_0x9bed('0x2'))['db'];var utils=require(_0x9bed('0x3'));var logger=require(_0x9bed('0x4'))(_0x9bed('0x5'));var config=require(_0x9bed('0x6'));var jayson=require(_0x9bed('0x7'));var client=jayson[_0x9bed('0x8')][_0x9bed('0x9')]({'port':0x232a});config[_0x9bed('0xa')]=_[_0x9bed('0xb')](config['redis'],{'host':_0x9bed('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9bed('0xa')]));require(_0x9bed('0xd'))['register'](socket);function respondWithRpcPromise(_0x1b96b6,_0x1ad402,_0x3a1dfd){return new BPromise(function(_0x3ff6fa,_0x4a356){return client[_0x9bed('0xe')](_0x1b96b6,_0x3a1dfd)[_0x9bed('0xf')](function(_0xa6c404){logger[_0x9bed('0x10')](_0x9bed('0x11'),_0x1ad402,_0x9bed('0x12'));logger[_0x9bed('0x13')](_0x9bed('0x14'),_0x1ad402,_0x9bed('0x12'),JSON[_0x9bed('0x15')](_0xa6c404));if(_0xa6c404[_0x9bed('0x16')]){if(_0xa6c404[_0x9bed('0x16')][_0x9bed('0x17')]===0x1f4){logger[_0x9bed('0x16')](_0x9bed('0x11'),_0x1ad402,_0xa6c404[_0x9bed('0x16')]['message']);return _0x4a356(_0xa6c404[_0x9bed('0x16')]['message']);}logger[_0x9bed('0x16')](_0x9bed('0x11'),_0x1ad402,_0xa6c404[_0x9bed('0x16')][_0x9bed('0x18')]);return _0x3ff6fa(_0xa6c404[_0x9bed('0x16')][_0x9bed('0x18')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x1ad402,'request\x20sent');_0x3ff6fa(_0xa6c404['result'][_0x9bed('0x18')]);}})['catch'](function(_0x36c6b1){logger[_0x9bed('0x16')](_0x9bed('0x11'),_0x1ad402,_0x36c6b1);_0x4a356(_0x36c6b1);});});}exports[_0x9bed('0x19')]=function(_0x58dda6){var _0x2c94cd=this;return new Promise(function(_0x2d6744,_0x567ec4){return db[_0x9bed('0x1a')]['update'](_0x58dda6['body'],{'raw':_0x58dda6[_0x9bed('0x1b')]?_0x58dda6[_0x9bed('0x1b')][_0x9bed('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58dda6[_0x9bed('0x1b')]?_0x58dda6[_0x9bed('0x1b')][_0x9bed('0x1d')]||null:null,'attributes':_0x58dda6[_0x9bed('0x1b')]?_0x58dda6['options'][_0x9bed('0x1e')]||null:null,'limit':_0x58dda6['options']?_0x58dda6[_0x9bed('0x1b')][_0x9bed('0x1f')]||null:null})[_0x9bed('0xf')](function(_0x153bd8){logger[_0x9bed('0x10')]('UpdateOpenchannelInteraction',_0x58dda6);logger[_0x9bed('0x13')](_0x9bed('0x19'),_0x58dda6,JSON[_0x9bed('0x15')](_0x153bd8));_0x2d6744(_0x153bd8);})['catch'](function(_0x4c75f6){logger[_0x9bed('0x16')](_0x9bed('0x19'),_0x4c75f6['message'],_0x58dda6);_0x567ec4(_0x2c94cd['error'](0x1f4,_0x4c75f6[_0x9bed('0x18')]));});});};exports[_0x9bed('0x20')]=function(_0x4c8884){return new Promise(function(_0x1f12f2,_0x706d9d){return db[_0x9bed('0x1a')][_0x9bed('0x21')]({'where':_0x4c8884['options']?_0x4c8884[_0x9bed('0x1b')][_0x9bed('0x1d')]||null:null})['then'](function(_0x12c56e){if(_0x12c56e){return _0x12c56e[_0x9bed('0x22')](_0x4c8884[_0x9bed('0x23')][_0x9bed('0x24')],_[_0x9bed('0x25')](_0x4c8884[_0x9bed('0x23')],[_0x9bed('0x24'),'id'])||{});}})['spread'](function(_0xdf6752){logger['info'](_0x9bed('0x26'),_0x4c8884);logger[_0x9bed('0x13')](_0x9bed('0x26'),_0x4c8884,JSON['stringify'](_0xdf6752));_0x1f12f2(_0xdf6752);})[_0x9bed('0x27')](function(_0x5c0e60){logger['error']('AddTags',_0x5c0e60[_0x9bed('0x18')],_0x4c8884);_0x706d9d(_this[_0x9bed('0x16')](0x1f4,_0x5c0e60[_0x9bed('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index cfc5665..588f9cd 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 _0x5b7f=['removeListener','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update'];(function(_0x4a3936,_0x36830f){var _0x1ac5da=function(_0x3058a9){while(--_0x3058a9){_0x4a3936['push'](_0x4a3936['shift']());}};_0x1ac5da(++_0x36830f);}(_0x5b7f,0xa4));var _0xf5b7=function(_0x3a18cf,_0x18ce1f){_0x3a18cf=_0x3a18cf-0x0;var _0x5be096=_0x5b7f[_0x3a18cf];return _0x5be096;};'use strict';var OpenchannelInteractionEvents=require(_0xf5b7('0x0'));var events=[_0xf5b7('0x1'),_0xf5b7('0x2'),_0xf5b7('0x3')];function createListener(_0x3b203d,_0x1ec40e){return function(_0x42a875){_0x1ec40e['emit'](_0x3b203d,_0x42a875);};}function removeListener(_0x55349d,_0x439185){return function(){OpenchannelInteractionEvents[_0xf5b7('0x4')](_0x55349d,_0x439185);};}exports['register']=function(_0x4c5107){for(var _0x5cb3ba=0x0,_0x14f15c=events[_0xf5b7('0x5')];_0x5cb3ba<_0x14f15c;_0x5cb3ba++){var _0x252099=events[_0x5cb3ba];var _0x1fc28b=createListener(_0xf5b7('0x6')+_0x252099,_0x4c5107);OpenchannelInteractionEvents['on'](_0x252099,_0x1fc28b);}}; \ No newline at end of file +var _0x0ee1=['register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x0ee1,0x1ce));var _0x10ee=function(_0x937379,_0x4688a0){_0x937379=_0x937379-0x0;var _0x465709=_0x0ee1[_0x937379];return _0x465709;};'use strict';var OpenchannelInteractionEvents=require(_0x10ee('0x0'));var events=[_0x10ee('0x1'),_0x10ee('0x2'),_0x10ee('0x3')];function createListener(_0x349dda,_0x21d5ae){return function(_0x9fc829){_0x21d5ae[_0x10ee('0x4')](_0x349dda,_0x9fc829);};}function removeListener(_0x509db4,_0xf84d38){return function(){OpenchannelInteractionEvents[_0x10ee('0x5')](_0x509db4,_0xf84d38);};}exports[_0x10ee('0x6')]=function(_0x52ac1c){for(var _0x1b8bd7=0x0,_0x1b756d=events[_0x10ee('0x7')];_0x1b8bd7<_0x1b756d;_0x1b8bd7++){var _0x11b09e=events[_0x1b8bd7];var _0x3e8beb=createListener(_0x10ee('0x8')+_0x11b09e,_0x52ac1c);OpenchannelInteractionEvents['on'](_0x11b09e,_0x3e8beb);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 52aeef9..62dbcc1 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x4815f7,_0x11bf81){var _0x5e1a79=function(_0x419851){while(--_0x419851){_0x4815f7['push'](_0x4815f7['shift']());}};_0x5e1a79(++_0x11bf81);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file +var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0xe3b60f,_0x457142){var _0x2ab617=function(_0x31921e){while(--_0x31921e){_0xe3b60f['push'](_0xe3b60f['shift']());}};_0x2ab617(++_0x457142);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index ac787c5..82c3f37 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 _0x93e6=['BOOLEAN','out','DATE','TEXT','sequelize','medium'];(function(_0x32f78d,_0x2f8b5a){var _0x37d4ec=function(_0x208148){while(--_0x208148){_0x32f78d['push'](_0x32f78d['shift']());}};_0x37d4ec(++_0x2f8b5a);}(_0x93e6,0x11e));var _0x693e=function(_0x55adee,_0x4d9108){_0x55adee=_0x55adee-0x0;var _0x5f0455=_0x93e6[_0x55adee];return _0x5f0455;};'use strict';var Sequelize=require(_0x693e('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x693e('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x693e('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x693e('0x3')),'defaultValue':_0x693e('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x693e('0x4')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x693e('0x5')]}}; \ No newline at end of file +var _0xc04a=['STRING','sequelize','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x179243,_0x5ecdd6){var _0x2777ad=function(_0x45bb52){while(--_0x45bb52){_0x179243['push'](_0x179243['shift']());}};_0x2777ad(++_0x5ecdd6);}(_0xc04a,0x12e));var _0xac04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc04a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xac04('0x0'));module['exports']={'body':{'type':Sequelize[_0xac04('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xac04('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xac04('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xac04('0x3')]('in','out'),'defaultValue':_0xac04('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xac04('0x5')]},'providerName':{'type':Sequelize[_0xac04('0x6')]},'providerResponse':{'type':Sequelize[_0xac04('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 2cbbb40..4b6457b 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 _0x995a=['ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','socket.io-emitter','redis','./openchannelMessage.socket','jayson/promise','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','end','stack','name','index','map','OpenchannelMessage','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','rows','length','includeAll','find','catch','create','body','params','describe','accept','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','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','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','reject','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','email','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0xfa02e1,_0x5ac154){var _0x10558f=function(_0x16b938){while(--_0x16b938){_0xfa02e1['push'](_0xfa02e1['shift']());}};_0x10558f(++_0x5ac154);}(_0x995a,0x176));var _0xa995=function(_0x1d42dd,_0x59abc9){_0x1d42dd=_0x1d42dd-0x0;var _0x4b36d7=_0x995a[_0x1d42dd];return _0x4b36d7;};'use strict';var emlformat=require(_0xa995('0x0'));var rimraf=require(_0xa995('0x1'));var zipdir=require(_0xa995('0x2'));var jsonpatch=require(_0xa995('0x3'));var rp=require(_0xa995('0x4'));var moment=require(_0xa995('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa995('0x6'));var util=require(_0xa995('0x7'));var path=require(_0xa995('0x8'));var sox=require(_0xa995('0x9'));var csv=require('to-csv');var ejs=require(_0xa995('0xa'));var fs=require('fs');var fs_extra=require(_0xa995('0xb'));var _=require(_0xa995('0xc'));var squel=require(_0xa995('0xd'));var crypto=require(_0xa995('0xe'));var jsforce=require(_0xa995('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa995('0x10'));var querystring=require(_0xa995('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa995('0x12'));var hardwareService=require(_0xa995('0x13'));var logger=require(_0xa995('0x14'))(_0xa995('0x15'));var utils=require(_0xa995('0x16'));var config=require(_0xa995('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xa995('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa995('0x19'))(new Redis(config[_0xa995('0x1a')]));require(_0xa995('0x1b'))['register'](socket);var jayson=require(_0xa995('0x1c'));var client=jayson['client'][_0xa995('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xa995('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x472336,_0x11a06e,_0x4bb88d,_0x1934f4){return new BPromise(function(_0x3ec2bd,_0x3f01a7){var _0x133a76=_0x1934f4||client;return _0x133a76[_0xa995('0x1e')](_0x472336,_0x4bb88d)[_0xa995('0x1f')](function(_0x18be65){logger['info'](_0xa995('0x20'),_0x11a06e,_0xa995('0x21'));logger[_0xa995('0x22')](_0xa995('0x23'),_0x11a06e,_0xa995('0x21'),JSON[_0xa995('0x24')](_0x18be65));if(_0x18be65[_0xa995('0x25')]){if(_0x18be65[_0xa995('0x25')][_0xa995('0x26')]===0x1f4){logger[_0xa995('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x11a06e,_0x18be65['error'][_0xa995('0x27')]);return _0x3f01a7(_0x18be65[_0xa995('0x25')]['message']);}logger[_0xa995('0x25')](_0xa995('0x20'),_0x11a06e,_0x18be65['error']['message']);return _0x3ec2bd(_0x18be65[_0xa995('0x25')]['message']);}else{logger[_0xa995('0x28')](_0xa995('0x20'),_0x11a06e,_0xa995('0x21'));_0x3ec2bd(_0x18be65['result'][_0xa995('0x27')]);}})['catch'](function(_0x25282f){logger[_0xa995('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x11a06e,_0x25282f);_0x3f01a7(_0x25282f);});});}function respondWithStatusCode(_0x3f4d0e,_0x18387b){_0x18387b=_0x18387b||0xcc;return function(_0x5a5523){if(_0x5a5523){return _0x3f4d0e[_0xa995('0x29')](_0x18387b);}return _0x3f4d0e[_0xa995('0x2a')](_0x18387b)['end']();};}function respondWithResult(_0x26d259,_0x3bf774){_0x3bf774=_0x3bf774||0xc8;return function(_0x32a0e1){if(_0x32a0e1){return _0x26d259[_0xa995('0x2a')](_0x3bf774)[_0xa995('0x2b')](_0x32a0e1);}};}function respondWithFilteredResult(_0x12cd02,_0xe76880){return function(_0x17e739){if(_0x17e739){var _0x47092d=typeof _0xe76880[_0xa995('0x2c')]===_0xa995('0x2d')&&typeof _0xe76880[_0xa995('0x2e')]===_0xa995('0x2d');var _0x473281=_0x17e739[_0xa995('0x2f')];var _0x1d41cd=_0x47092d?0x0:_0xe76880[_0xa995('0x2c')];var _0x19d811=_0x47092d?_0x17e739[_0xa995('0x2f')]:_0xe76880[_0xa995('0x2c')]+_0xe76880[_0xa995('0x2e')];var _0x143c23;if(_0x19d811>=_0x473281){_0x19d811=_0x473281;_0x143c23=0xc8;}else{_0x143c23=0xce;}_0x12cd02[_0xa995('0x2a')](_0x143c23);return _0x12cd02['set'](_0xa995('0x30'),_0x1d41cd+'-'+_0x19d811+'/'+_0x473281)['json'](_0x17e739);}return null;};}function patchUpdates(_0x5e4130){return function(_0x5b3f37){try{jsonpatch[_0xa995('0x31')](_0x5b3f37,_0x5e4130,!![]);}catch(_0x3da30b){return BPromise['reject'](_0x3da30b);}return _0x5b3f37[_0xa995('0x32')]();};}function saveUpdates(_0x5de28d,_0x42e516){return function(_0x34a3eb){if(_0x34a3eb){return _0x34a3eb[_0xa995('0x33')](_0x5de28d)[_0xa995('0x1f')](function(_0x4c8da8){return _0x4c8da8;});}return null;};}function removeEntity(_0x5b80ee,_0x2f1592){return function(_0x3b6e4c){if(_0x3b6e4c){return _0x3b6e4c[_0xa995('0x34')]()[_0xa995('0x1f')](function(){_0x5b80ee[_0xa995('0x2a')](0xcc)[_0xa995('0x35')]();});}};}function handleEntityNotFound(_0x4e77a4,_0x1854e1){return function(_0x5a70bb){if(!_0x5a70bb){_0x4e77a4[_0xa995('0x29')](0x194);}return _0x5a70bb;};}function handleError(_0x42c7e0,_0x148dd8){_0x148dd8=_0x148dd8||0x1f4;return function(_0xcafb4){logger[_0xa995('0x25')](_0xcafb4[_0xa995('0x36')]);if(_0xcafb4[_0xa995('0x37')]){delete _0xcafb4['name'];}_0x42c7e0[_0xa995('0x2a')](_0x148dd8)['send'](_0xcafb4);};}exports[_0xa995('0x38')]=function(_0x5f171c,_0x3064c0){var _0x38e86f={},_0x1a3780={},_0x1b975c={'count':0x0,'rows':[]};var _0x502f07=_[_0xa995('0x39')](db[_0xa995('0x3a')][_0xa995('0x3b')],function(_0x4cf016){return{'name':_0x4cf016[_0xa995('0x3c')],'type':_0x4cf016[_0xa995('0x3d')]['key']};});_0x1a3780['model']=_['map'](_0x502f07,_0xa995('0x37'));_0x1a3780[_0xa995('0x3e')]=_[_0xa995('0x3f')](_0x5f171c[_0xa995('0x3e')]);_0x1a3780[_0xa995('0x40')]=_[_0xa995('0x41')](_0x1a3780['model'],_0x1a3780[_0xa995('0x3e')]);_0x38e86f[_0xa995('0x42')]=_[_0xa995('0x41')](_0x1a3780[_0xa995('0x43')],qs[_0xa995('0x44')](_0x5f171c[_0xa995('0x3e')]['fields']));_0x38e86f[_0xa995('0x42')]=_0x38e86f[_0xa995('0x42')]['length']?_0x38e86f[_0xa995('0x42')]:_0x1a3780['model'];if(!_0x5f171c[_0xa995('0x3e')][_0xa995('0x45')]('nolimit')){_0x38e86f[_0xa995('0x2e')]=qs[_0xa995('0x2e')](_0x5f171c[_0xa995('0x3e')]['limit']);_0x38e86f[_0xa995('0x2c')]=qs['offset'](_0x5f171c['query'][_0xa995('0x2c')]);}_0x38e86f[_0xa995('0x46')]=qs[_0xa995('0x47')](_0x5f171c[_0xa995('0x3e')][_0xa995('0x47')]);_0x38e86f[_0xa995('0x48')]=qs[_0xa995('0x40')](_['pick'](_0x5f171c['query'],_0x1a3780['filters']),_0x502f07);if(_0x5f171c[_0xa995('0x3e')][_0xa995('0x49')]){_0x38e86f[_0xa995('0x48')]=_[_0xa995('0x4a')](_0x38e86f[_0xa995('0x48')],{'$or':_[_0xa995('0x39')](_0x502f07,function(_0x13abb6){if(_0x13abb6['type']!==_0xa995('0x4b')){var _0x3c6613={};_0x3c6613[_0x13abb6[_0xa995('0x37')]]={'$like':'%'+_0x5f171c[_0xa995('0x3e')][_0xa995('0x49')]+'%'};return _0x3c6613;}})});}_0x38e86f=_['merge']({},_0x38e86f,_0x5f171c[_0xa995('0x4c')]);var _0x2de2df={'where':_0x38e86f[_0xa995('0x48')]};return db['OpenchannelMessage']['count'](_0x2de2df)[_0xa995('0x1f')](function(_0x44e3de){_0x1b975c['count']=_0x44e3de;if(_0x5f171c[_0xa995('0x3e')]['includeAll']){_0x38e86f[_0xa995('0x4d')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x38e86f);})[_0xa995('0x1f')](function(_0x46821f){_0x1b975c[_0xa995('0x4e')]=_0x46821f;return _0x1b975c;})[_0xa995('0x1f')](respondWithFilteredResult(_0x3064c0,_0x38e86f))['catch'](handleError(_0x3064c0,null));};exports['show']=function(_0x1b5742,_0x65507b){var _0x49baaf={'raw':!![],'where':{'id':_0x1b5742['params']['id']}},_0x45b182={};_0x45b182['model']=_[_0xa995('0x3f')](db[_0xa995('0x3a')][_0xa995('0x3b')]);_0x45b182[_0xa995('0x3e')]=_[_0xa995('0x3f')](_0x1b5742[_0xa995('0x3e')]);_0x45b182[_0xa995('0x40')]=_[_0xa995('0x41')](_0x45b182[_0xa995('0x43')],_0x45b182[_0xa995('0x3e')]);_0x49baaf[_0xa995('0x42')]=_[_0xa995('0x41')](_0x45b182[_0xa995('0x43')],qs[_0xa995('0x44')](_0x1b5742[_0xa995('0x3e')][_0xa995('0x44')]));_0x49baaf[_0xa995('0x42')]=_0x49baaf[_0xa995('0x42')][_0xa995('0x4f')]?_0x49baaf[_0xa995('0x42')]:_0x45b182[_0xa995('0x43')];if(_0x1b5742[_0xa995('0x3e')][_0xa995('0x50')]){_0x49baaf['include']=[{'all':!![]}];}_0x49baaf=_[_0xa995('0x4a')]({},_0x49baaf,_0x1b5742[_0xa995('0x4c')]);return db['OpenchannelMessage'][_0xa995('0x51')](_0x49baaf)[_0xa995('0x1f')](handleEntityNotFound(_0x65507b,null))['then'](respondWithResult(_0x65507b,null))[_0xa995('0x52')](handleError(_0x65507b,null));};exports[_0xa995('0x53')]=function(_0x38af13,_0x23da70){return db[_0xa995('0x3a')]['create'](_0x38af13[_0xa995('0x54')],{})[_0xa995('0x1f')](respondWithResult(_0x23da70,0xc9))[_0xa995('0x52')](handleError(_0x23da70,null));};exports['update']=function(_0x28b56f,_0x1969ca){if(_0x28b56f[_0xa995('0x54')]['id']){delete _0x28b56f[_0xa995('0x54')]['id'];}return db['OpenchannelMessage'][_0xa995('0x51')]({'where':{'id':_0x28b56f[_0xa995('0x55')]['id']}})[_0xa995('0x1f')](handleEntityNotFound(_0x1969ca,null))[_0xa995('0x1f')](saveUpdates(_0x28b56f[_0xa995('0x54')],null))[_0xa995('0x1f')](respondWithResult(_0x1969ca,null))[_0xa995('0x52')](handleError(_0x1969ca,null));};exports['destroy']=function(_0x4c331f,_0x4427ba){return db['OpenchannelMessage'][_0xa995('0x51')]({'where':{'id':_0x4c331f[_0xa995('0x55')]['id']}})[_0xa995('0x1f')](handleEntityNotFound(_0x4427ba,null))[_0xa995('0x1f')](removeEntity(_0x4427ba,null))[_0xa995('0x52')](handleError(_0x4427ba,null));};exports[_0xa995('0x56')]=function(_0x35b5c4,_0x4c96e5){return db[_0xa995('0x3a')][_0xa995('0x56')]()[_0xa995('0x1f')](respondWithResult(_0x4c96e5,null))[_0xa995('0x52')](handleError(_0x4c96e5,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0xa995('0x57')]=function(_0xa17ce6,_0x5a172e,_0x2b8504){var _0x3616b0={'agent':{},'channel':_0xa995('0x58')};if(_0xa17ce6[_0xa995('0x54')]['id']){delete _0xa17ce6[_0xa995('0x54')]['id'];}_0xa17ce6['body'][_0xa995('0x59')]=!![];_0xa17ce6[_0xa995('0x54')]['readAt']=moment()[_0xa995('0x5a')](_0xa995('0x5b'));_0xa17ce6[_0xa995('0x54')][_0xa995('0x5c')]=_0xa17ce6[_0xa995('0x54')][_0xa995('0x5c')]||_0xa17ce6[_0xa995('0x5d')]['id'];_0x3616b0[_0xa995('0x5e')]['id']=_0xa17ce6[_0xa995('0x54')][_0xa995('0x5c')];return db[_0xa995('0x3a')][_0xa995('0x51')]({'where':{'id':_0xa17ce6[_0xa995('0x55')]['id'],'UserId':null}})[_0xa995('0x1f')](handleEntityNotFound(_0x5a172e,null))[_0xa995('0x1f')](saveUpdates(_0xa17ce6['body'],null))['then'](function(_0x149d80){if(_0x149d80){_0x3616b0[_0xa995('0x27')]=_0x149d80[_0xa995('0x5f')]({'plain':!![]});return db[_0xa995('0x60')][_0xa995('0x51')]({'where':{'id':_0x149d80[_0xa995('0x61')]}});}return null;})[_0xa995('0x1f')](handleEntityNotFound(_0x5a172e,null))[_0xa995('0x1f')](function(_0x238e46){if(_0x238e46){return _0x238e46[_0xa995('0x33')]({'UserId':_0xa17ce6[_0xa995('0x54')][_0xa995('0x5c')],'read1stAt':_[_0xa995('0x62')](_0x238e46['read1stAt'])?moment()[_0xa995('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xa995('0x1f')](function(_0x8ec8f){if(_0x8ec8f){_0x3616b0[_0xa995('0x63')]=_0x8ec8f[_0xa995('0x5f')]({'plain':!![]});interaction_log['info'](_0xa995('0x64'),_0xa17ce6[_0xa995('0x5d')]['id'],_0xa17ce6[_0xa995('0x5d')][_0xa995('0x37')],_0xa17ce6[_0xa995('0x5d')][_0xa995('0x65')],_0x3616b0['interaction']['id'],_0xa17ce6[_0xa995('0x54')]?JSON[_0xa995('0x24')](_0xa17ce6[_0xa995('0x54')]):'null');return respondWithRpcPromise(_0xa995('0x66'),_0xa995('0x67'),_0x3616b0);}return null;})[_0xa995('0x1f')](function(_0x7e2bcf){var _0x445561=_0xa995('0x68')+_0x7e2bcf[_0xa995('0x27')][_0xa995('0x69')];return db[_0xa995('0x6a')][_0xa995('0x3e')](_0x445561,{'type':db[_0xa995('0x6b')][_0xa995('0x6c')][_0xa995('0x6d')],'raw':!![]})[_0xa995('0x1f')](function(_0x4a0125){return _0x4a0125;});})[_0xa995('0x1f')](function(_0x31921d){if(_0x31921d){_0x3616b0['message'][_0xa995('0x6e')]=_0x31921d[0x0];if(!_0xa17ce6['body'][_0xa995('0x5c')])return;return db[_0xa995('0x6f')]['find']({'where':{'id':_0xa17ce6[_0xa995('0x54')][_0xa995('0x5c')],'role':'agent'},'attributes':['id','name',_0xa995('0x70'),'email',_0xa995('0x71')],'raw':!![]});}return null;})[_0xa995('0x1f')](function(_0x2deab8){if(!_0x2deab8)return null;_0x3616b0[_0xa995('0x27')]['agent']=_0x2deab8;return _0x3616b0;})['then'](function(_0x442fe1){if(_0x442fe1){if(_0xa17ce6[_0xa995('0x54')]['manual']){_0x3616b0[_0xa995('0x27')][_0xa995('0x72')]=util['format'](_0xa995('0x73'),_0xa17ce6['user'][_0xa995('0x37')]);_0x3616b0[_0xa995('0x27')][_0xa995('0x74')]=_0x3616b0['channel'];_0x3616b0[_0xa995('0x27')][_0xa995('0x75')]=_0x3616b0[_0xa995('0x74')];_0x3616b0[_0xa995('0x27')][_0xa995('0x76')]=_0xa995('0x57');return respondWithRpcPromise(_0xa995('0x77'),_0xa995('0x77'),{'event':_0xa995('0x78'),'message':_0x3616b0[_0xa995('0x27')]},client9002)['then'](function(){return _0x3616b0;});}return _0x3616b0;}return null;})[_0xa995('0x1f')](respondWithResult(_0x5a172e,null))['catch'](handleError(_0x5a172e,null));};var interaction_log=require('../../config/logger')(_0xa995('0x79'));exports[_0xa995('0x7a')]=function(_0x443fc5,_0x2caded,_0x32f3b5){var _0x33b37b={'agent':{},'channel':_0xa995('0x58')};if(_0x443fc5[_0xa995('0x54')]['id']){delete _0x443fc5[_0xa995('0x54')]['id'];}_0x443fc5['body'][_0xa995('0x5c')]=_0x443fc5[_0xa995('0x54')][_0xa995('0x5c')]||_0x443fc5[_0xa995('0x5d')]['id'];_0x33b37b[_0xa995('0x5e')]['id']=_0x443fc5[_0xa995('0x54')][_0xa995('0x5c')];return db[_0xa995('0x3a')][_0xa995('0x51')]({'where':{'id':_0x443fc5[_0xa995('0x55')]['id'],'UserId':null}})[_0xa995('0x1f')](handleEntityNotFound(_0x2caded,null))['then'](function(_0x59c429){if(_0x59c429){_0x33b37b['message']=_0x59c429[_0xa995('0x5f')]({'plain':!![]});return db[_0xa995('0x60')]['find']({'where':{'id':_0x59c429['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2caded,null))[_0xa995('0x1f')](function(_0x143a81){if(_0x143a81){_0x33b37b[_0xa995('0x63')]=_0x143a81[_0xa995('0x5f')]({'plain':!![]});interaction_log[_0xa995('0x28')](_0xa995('0x7b'),_0x443fc5[_0xa995('0x5d')]['id'],_0x443fc5['user'][_0xa995('0x37')],_0x443fc5[_0xa995('0x5d')]['role'],_0x33b37b[_0xa995('0x63')]['id'],_0x443fc5[_0xa995('0x54')]?JSON[_0xa995('0x24')](_0x443fc5['body']):_0xa995('0x7c'));return respondWithRpcPromise('RejectMessage',_0xa995('0x7d'),_0x33b37b);}return null;})[_0xa995('0x1f')](function(_0x487615){var _0x52fdab='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x487615[_0xa995('0x27')][_0xa995('0x69')];return db[_0xa995('0x6a')]['query'](_0x52fdab,{'type':db[_0xa995('0x6b')][_0xa995('0x6c')][_0xa995('0x6d')],'raw':!![]})[_0xa995('0x1f')](function(_0x1610d7){return _0x1610d7;});})[_0xa995('0x1f')](function(_0x51bdd7){if(_0x51bdd7){_0x33b37b[_0xa995('0x27')][_0xa995('0x6e')]=_0x51bdd7[0x0];if(!_0x443fc5[_0xa995('0x54')][_0xa995('0x5c')])return;return db['User'][_0xa995('0x51')]({'where':{'id':_0x443fc5[_0xa995('0x54')]['UserId'],'role':'agent'},'attributes':['id',_0xa995('0x37'),_0xa995('0x70'),_0xa995('0x7e'),_0xa995('0x71')],'raw':!![]});}return null;})[_0xa995('0x1f')](function(_0x1152b2){if(!_0x1152b2)return null;_0x33b37b[_0xa995('0x27')][_0xa995('0x5e')]=_0x1152b2;return _0x33b37b;})[_0xa995('0x1f')](function(_0x577dbc){if(_0x577dbc){_0x577dbc[_0xa995('0x27')]['interface']=util[_0xa995('0x5a')](_0xa995('0x73'),_0x443fc5[_0xa995('0x5d')][_0xa995('0x37')]);_0x577dbc[_0xa995('0x27')][_0xa995('0x74')]=_0x33b37b['channel'];_0x577dbc['message'][_0xa995('0x75')]=_0x33b37b['channel'];_0x577dbc[_0xa995('0x27')][_0xa995('0x76')]=_0xa995('0x7a');respondWithRpcPromise('EventManager',_0xa995('0x77'),{'event':_0xa995('0x7f'),'message':_0x577dbc['message']},client9002);return _0x33b37b;}return null;})[_0xa995('0x1f')](respondWithResult(_0x2caded,null))[_0xa995('0x52')](handleError(_0x2caded,null));}; \ No newline at end of file +var _0xd9d9=['UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','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','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','User','reject','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','stack','name','send','index','map','OpenchannelMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','update','describe','openchannel-interactions','readAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x233f66,_0x38ead8){var _0x24c124=function(_0x5a6c44){while(--_0x5a6c44){_0x233f66['push'](_0x233f66['shift']());}};_0x24c124(++_0x38ead8);}(_0xd9d9,0x11d));var _0x9d9d=function(_0x2c1f96,_0x3331ab){_0x2c1f96=_0x2c1f96-0x0;var _0x2b25e4=_0xd9d9[_0x2c1f96];return _0x2b25e4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d9d('0x0'));var zipdir=require(_0x9d9d('0x1'));var jsonpatch=require(_0x9d9d('0x2'));var rp=require(_0x9d9d('0x3'));var moment=require(_0x9d9d('0x4'));var BPromise=require(_0x9d9d('0x5'));var Mustache=require(_0x9d9d('0x6'));var util=require(_0x9d9d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x9d9d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9d9d('0x9'));var _=require('lodash');var squel=require(_0x9d9d('0xa'));var crypto=require(_0x9d9d('0xb'));var jsforce=require(_0x9d9d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9d9d('0x8'));var querystring=require(_0x9d9d('0xd'));var Papa=require(_0x9d9d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9d9d('0xf'));var as=require(_0x9d9d('0x10'));var hardwareService=require(_0x9d9d('0x11'));var logger=require('../../config/logger')(_0x9d9d('0x12'));var utils=require('../../config/utils');var config=require(_0x9d9d('0x13'));var licenseUtil=require(_0x9d9d('0x14'));var db=require('../../mysqldb')['db'];config[_0x9d9d('0x15')]=_['defaults'](config['redis'],{'host':_0x9d9d('0x16'),'port':0x18eb});var socket=require(_0x9d9d('0x17'))(new Redis(config['redis']));require(_0x9d9d('0x18'))[_0x9d9d('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x9d9d('0x1a')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x500adc,_0x367ab0,_0x48e3d2,_0x3297fd){return new BPromise(function(_0x2a4e1e,_0x3c2dab){var _0x27bbb3=_0x3297fd||client;return _0x27bbb3['request'](_0x500adc,_0x48e3d2)[_0x9d9d('0x1b')](function(_0x7825d4){logger[_0x9d9d('0x1c')](_0x9d9d('0x1d'),_0x367ab0,_0x9d9d('0x1e'));logger['debug'](_0x9d9d('0x1f'),_0x367ab0,_0x9d9d('0x1e'),JSON[_0x9d9d('0x20')](_0x7825d4));if(_0x7825d4[_0x9d9d('0x21')]){if(_0x7825d4[_0x9d9d('0x21')][_0x9d9d('0x22')]===0x1f4){logger[_0x9d9d('0x21')](_0x9d9d('0x1d'),_0x367ab0,_0x7825d4[_0x9d9d('0x21')][_0x9d9d('0x23')]);return _0x3c2dab(_0x7825d4[_0x9d9d('0x21')][_0x9d9d('0x23')]);}logger[_0x9d9d('0x21')](_0x9d9d('0x1d'),_0x367ab0,_0x7825d4[_0x9d9d('0x21')][_0x9d9d('0x23')]);return _0x2a4e1e(_0x7825d4[_0x9d9d('0x21')][_0x9d9d('0x23')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x367ab0,_0x9d9d('0x1e'));_0x2a4e1e(_0x7825d4['result'][_0x9d9d('0x23')]);}})['catch'](function(_0x1c3348){logger[_0x9d9d('0x21')](_0x9d9d('0x1d'),_0x367ab0,_0x1c3348);_0x3c2dab(_0x1c3348);});});}function respondWithStatusCode(_0x15af17,_0x101a48){_0x101a48=_0x101a48||0xcc;return function(_0x2649f3){if(_0x2649f3){return _0x15af17[_0x9d9d('0x24')](_0x101a48);}return _0x15af17[_0x9d9d('0x25')](_0x101a48)[_0x9d9d('0x26')]();};}function respondWithResult(_0x25798b,_0x4d0f68){_0x4d0f68=_0x4d0f68||0xc8;return function(_0x4ae8eb){if(_0x4ae8eb){return _0x25798b[_0x9d9d('0x25')](_0x4d0f68)[_0x9d9d('0x27')](_0x4ae8eb);}};}function respondWithFilteredResult(_0x181e0a,_0x4d168d){return function(_0x37e7cb){if(_0x37e7cb){var _0x54920c=typeof _0x4d168d[_0x9d9d('0x28')]===_0x9d9d('0x29')&&typeof _0x4d168d[_0x9d9d('0x2a')]===_0x9d9d('0x29');var _0x1c8d20=_0x37e7cb[_0x9d9d('0x2b')];var _0x543288=_0x54920c?0x0:_0x4d168d[_0x9d9d('0x28')];var _0x206efb=_0x54920c?_0x37e7cb[_0x9d9d('0x2b')]:_0x4d168d[_0x9d9d('0x28')]+_0x4d168d[_0x9d9d('0x2a')];var _0x357beb;if(_0x206efb>=_0x1c8d20){_0x206efb=_0x1c8d20;_0x357beb=0xc8;}else{_0x357beb=0xce;}_0x181e0a[_0x9d9d('0x25')](_0x357beb);return _0x181e0a[_0x9d9d('0x2c')](_0x9d9d('0x2d'),_0x543288+'-'+_0x206efb+'/'+_0x1c8d20)['json'](_0x37e7cb);}return null;};}function patchUpdates(_0x128876){return function(_0x5ad38f){try{jsonpatch[_0x9d9d('0x2e')](_0x5ad38f,_0x128876,!![]);}catch(_0x233ab2){return BPromise['reject'](_0x233ab2);}return _0x5ad38f[_0x9d9d('0x2f')]();};}function saveUpdates(_0x1031ff,_0x21d855){return function(_0x2b308f){if(_0x2b308f){return _0x2b308f['update'](_0x1031ff)[_0x9d9d('0x1b')](function(_0x497399){return _0x497399;});}return null;};}function removeEntity(_0x1ed1ff,_0x342e85){return function(_0x4b03cb){if(_0x4b03cb){return _0x4b03cb[_0x9d9d('0x30')]()[_0x9d9d('0x1b')](function(){_0x1ed1ff[_0x9d9d('0x25')](0xcc)[_0x9d9d('0x26')]();});}};}function handleEntityNotFound(_0x1c6288,_0x44f26a){return function(_0x205610){if(!_0x205610){_0x1c6288[_0x9d9d('0x24')](0x194);}return _0x205610;};}function handleError(_0x175e38,_0x45362f){_0x45362f=_0x45362f||0x1f4;return function(_0x11d2eb){logger['error'](_0x11d2eb[_0x9d9d('0x31')]);if(_0x11d2eb[_0x9d9d('0x32')]){delete _0x11d2eb[_0x9d9d('0x32')];}_0x175e38[_0x9d9d('0x25')](_0x45362f)[_0x9d9d('0x33')](_0x11d2eb);};}exports[_0x9d9d('0x34')]=function(_0x58be7e,_0x257aea){var _0x2fc589={},_0x2a2cab={},_0x177310={'count':0x0,'rows':[]};var _0x1331e=_[_0x9d9d('0x35')](db[_0x9d9d('0x36')]['rawAttributes'],function(_0x4b8cfa){return{'name':_0x4b8cfa[_0x9d9d('0x37')],'type':_0x4b8cfa[_0x9d9d('0x38')][_0x9d9d('0x39')]};});_0x2a2cab[_0x9d9d('0x3a')]=_['map'](_0x1331e,_0x9d9d('0x32'));_0x2a2cab[_0x9d9d('0x3b')]=_[_0x9d9d('0x3c')](_0x58be7e['query']);_0x2a2cab[_0x9d9d('0x3d')]=_[_0x9d9d('0x3e')](_0x2a2cab[_0x9d9d('0x3a')],_0x2a2cab['query']);_0x2fc589[_0x9d9d('0x3f')]=_[_0x9d9d('0x3e')](_0x2a2cab[_0x9d9d('0x3a')],qs[_0x9d9d('0x40')](_0x58be7e[_0x9d9d('0x3b')][_0x9d9d('0x40')]));_0x2fc589['attributes']=_0x2fc589[_0x9d9d('0x3f')]['length']?_0x2fc589[_0x9d9d('0x3f')]:_0x2a2cab['model'];if(!_0x58be7e[_0x9d9d('0x3b')][_0x9d9d('0x41')](_0x9d9d('0x42'))){_0x2fc589[_0x9d9d('0x2a')]=qs[_0x9d9d('0x2a')](_0x58be7e['query']['limit']);_0x2fc589[_0x9d9d('0x28')]=qs[_0x9d9d('0x28')](_0x58be7e[_0x9d9d('0x3b')][_0x9d9d('0x28')]);}_0x2fc589['order']=qs['sort'](_0x58be7e['query']['sort']);_0x2fc589[_0x9d9d('0x43')]=qs['filters'](_[_0x9d9d('0x44')](_0x58be7e[_0x9d9d('0x3b')],_0x2a2cab['filters']),_0x1331e);if(_0x58be7e[_0x9d9d('0x3b')][_0x9d9d('0x45')]){_0x2fc589[_0x9d9d('0x43')]=_['merge'](_0x2fc589[_0x9d9d('0x43')],{'$or':_[_0x9d9d('0x35')](_0x1331e,function(_0x1dbb7e){if(_0x1dbb7e[_0x9d9d('0x38')]!==_0x9d9d('0x46')){var _0x29a405={};_0x29a405[_0x1dbb7e[_0x9d9d('0x32')]]={'$like':'%'+_0x58be7e[_0x9d9d('0x3b')][_0x9d9d('0x45')]+'%'};return _0x29a405;}})});}_0x2fc589=_[_0x9d9d('0x47')]({},_0x2fc589,_0x58be7e[_0x9d9d('0x48')]);var _0x58f032={'where':_0x2fc589['where']};return db['OpenchannelMessage'][_0x9d9d('0x2b')](_0x58f032)[_0x9d9d('0x1b')](function(_0x5f144c){_0x177310[_0x9d9d('0x2b')]=_0x5f144c;if(_0x58be7e[_0x9d9d('0x3b')]['includeAll']){_0x2fc589[_0x9d9d('0x49')]=[{'all':!![]}];}return db[_0x9d9d('0x36')][_0x9d9d('0x4a')](_0x2fc589);})[_0x9d9d('0x1b')](function(_0x435a37){_0x177310[_0x9d9d('0x4b')]=_0x435a37;return _0x177310;})[_0x9d9d('0x1b')](respondWithFilteredResult(_0x257aea,_0x2fc589))[_0x9d9d('0x4c')](handleError(_0x257aea,null));};exports[_0x9d9d('0x4d')]=function(_0x20ec1a,_0x2845da){var _0x407755={'raw':!![],'where':{'id':_0x20ec1a[_0x9d9d('0x4e')]['id']}},_0x190a4e={};_0x190a4e[_0x9d9d('0x3a')]=_[_0x9d9d('0x3c')](db[_0x9d9d('0x36')][_0x9d9d('0x4f')]);_0x190a4e['query']=_['keys'](_0x20ec1a[_0x9d9d('0x3b')]);_0x190a4e[_0x9d9d('0x3d')]=_[_0x9d9d('0x3e')](_0x190a4e[_0x9d9d('0x3a')],_0x190a4e[_0x9d9d('0x3b')]);_0x407755[_0x9d9d('0x3f')]=_[_0x9d9d('0x3e')](_0x190a4e['model'],qs['fields'](_0x20ec1a[_0x9d9d('0x3b')]['fields']));_0x407755['attributes']=_0x407755[_0x9d9d('0x3f')]['length']?_0x407755[_0x9d9d('0x3f')]:_0x190a4e[_0x9d9d('0x3a')];if(_0x20ec1a[_0x9d9d('0x3b')][_0x9d9d('0x50')]){_0x407755['include']=[{'all':!![]}];}_0x407755=_[_0x9d9d('0x47')]({},_0x407755,_0x20ec1a[_0x9d9d('0x48')]);return db[_0x9d9d('0x36')][_0x9d9d('0x51')](_0x407755)[_0x9d9d('0x1b')](handleEntityNotFound(_0x2845da,null))['then'](respondWithResult(_0x2845da,null))[_0x9d9d('0x4c')](handleError(_0x2845da,null));};exports[_0x9d9d('0x52')]=function(_0x10c551,_0x2f8d1f){return db[_0x9d9d('0x36')][_0x9d9d('0x52')](_0x10c551[_0x9d9d('0x53')],{})[_0x9d9d('0x1b')](respondWithResult(_0x2f8d1f,0xc9))['catch'](handleError(_0x2f8d1f,null));};exports[_0x9d9d('0x54')]=function(_0x284b6a,_0xc57434){if(_0x284b6a[_0x9d9d('0x53')]['id']){delete _0x284b6a[_0x9d9d('0x53')]['id'];}return db[_0x9d9d('0x36')][_0x9d9d('0x51')]({'where':{'id':_0x284b6a[_0x9d9d('0x4e')]['id']}})['then'](handleEntityNotFound(_0xc57434,null))[_0x9d9d('0x1b')](saveUpdates(_0x284b6a['body'],null))['then'](respondWithResult(_0xc57434,null))[_0x9d9d('0x4c')](handleError(_0xc57434,null));};exports['destroy']=function(_0x464040,_0xcf98cb){return db[_0x9d9d('0x36')][_0x9d9d('0x51')]({'where':{'id':_0x464040['params']['id']}})[_0x9d9d('0x1b')](handleEntityNotFound(_0xcf98cb,null))[_0x9d9d('0x1b')](removeEntity(_0xcf98cb,null))[_0x9d9d('0x4c')](handleError(_0xcf98cb,null));};exports[_0x9d9d('0x55')]=function(_0x5cec2c,_0xd44f18){return db[_0x9d9d('0x36')][_0x9d9d('0x55')]()[_0x9d9d('0x1b')](respondWithResult(_0xd44f18,null))['catch'](handleError(_0xd44f18,null));};var interaction_log=require('../../config/logger')(_0x9d9d('0x56'));exports['accept']=function(_0x1fdb9d,_0x39f824,_0x1e88aa){var _0x582ba1={'agent':{},'channel':'openchannel'};if(_0x1fdb9d['body']['id']){delete _0x1fdb9d[_0x9d9d('0x53')]['id'];}_0x1fdb9d['body']['read']=!![];_0x1fdb9d[_0x9d9d('0x53')][_0x9d9d('0x57')]=moment()[_0x9d9d('0x58')](_0x9d9d('0x59'));_0x1fdb9d[_0x9d9d('0x53')][_0x9d9d('0x5a')]=_0x1fdb9d['body']['UserId']||_0x1fdb9d[_0x9d9d('0x5b')]['id'];_0x582ba1[_0x9d9d('0x5c')]['id']=_0x1fdb9d['body'][_0x9d9d('0x5a')];return db['OpenchannelMessage'][_0x9d9d('0x51')]({'where':{'id':_0x1fdb9d[_0x9d9d('0x4e')]['id'],'UserId':null}})[_0x9d9d('0x1b')](handleEntityNotFound(_0x39f824,null))[_0x9d9d('0x1b')](saveUpdates(_0x1fdb9d[_0x9d9d('0x53')],null))[_0x9d9d('0x1b')](function(_0x307d6a){if(_0x307d6a){_0x582ba1[_0x9d9d('0x23')]=_0x307d6a[_0x9d9d('0x5d')]({'plain':!![]});return db[_0x9d9d('0x5e')][_0x9d9d('0x51')]({'where':{'id':_0x307d6a[_0x9d9d('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x39f824,null))['then'](function(_0x8f63dd){if(_0x8f63dd){return _0x8f63dd['update']({'UserId':_0x1fdb9d['body']['UserId'],'read1stAt':_['isNil'](_0x8f63dd[_0x9d9d('0x60')])?moment()[_0x9d9d('0x58')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x9d9d('0x1b')](function(_0x14eb8c){if(_0x14eb8c){_0x582ba1[_0x9d9d('0x61')]=_0x14eb8c[_0x9d9d('0x5d')]({'plain':!![]});interaction_log['info'](_0x9d9d('0x62'),_0x1fdb9d[_0x9d9d('0x5b')]['id'],_0x1fdb9d[_0x9d9d('0x5b')][_0x9d9d('0x32')],_0x1fdb9d[_0x9d9d('0x5b')][_0x9d9d('0x63')],_0x582ba1[_0x9d9d('0x61')]['id'],_0x1fdb9d[_0x9d9d('0x53')]?JSON[_0x9d9d('0x20')](_0x1fdb9d[_0x9d9d('0x53')]):_0x9d9d('0x64'));return respondWithRpcPromise(_0x9d9d('0x65'),_0x9d9d('0x66'),_0x582ba1);}return null;})[_0x9d9d('0x1b')](function(_0x208278){var _0x12de57=_0x9d9d('0x67')+_0x208278['message']['ContactId'];return db[_0x9d9d('0x68')][_0x9d9d('0x3b')](_0x12de57,{'type':db[_0x9d9d('0x69')][_0x9d9d('0x6a')][_0x9d9d('0x6b')],'raw':!![]})[_0x9d9d('0x1b')](function(_0x4c3bc6){return _0x4c3bc6;});})['then'](function(_0x26ce81){if(_0x26ce81){_0x582ba1[_0x9d9d('0x23')][_0x9d9d('0x6c')]=_0x26ce81[0x0];if(!_0x1fdb9d[_0x9d9d('0x53')][_0x9d9d('0x5a')])return;return db['User'][_0x9d9d('0x51')]({'where':{'id':_0x1fdb9d[_0x9d9d('0x53')][_0x9d9d('0x5a')],'role':_0x9d9d('0x5c')},'attributes':['id',_0x9d9d('0x32'),_0x9d9d('0x6d'),_0x9d9d('0x6e'),'internal'],'raw':!![]});}return null;})[_0x9d9d('0x1b')](function(_0xdb8d24){if(!_0xdb8d24)return null;_0x582ba1[_0x9d9d('0x23')][_0x9d9d('0x5c')]=_0xdb8d24;return _0x582ba1;})['then'](function(_0x14abe8){if(_0x14abe8){if(_0x1fdb9d[_0x9d9d('0x53')][_0x9d9d('0x6f')]){_0x582ba1[_0x9d9d('0x23')][_0x9d9d('0x70')]=util['format'](_0x9d9d('0x71'),_0x1fdb9d['user']['name']);_0x582ba1[_0x9d9d('0x23')]['channel']=_0x582ba1[_0x9d9d('0x72')];_0x582ba1['message'][_0x9d9d('0x73')]=_0x582ba1[_0x9d9d('0x72')];_0x582ba1['message'][_0x9d9d('0x74')]='accept';return respondWithRpcPromise(_0x9d9d('0x75'),_0x9d9d('0x75'),{'event':'acceptmessage','message':_0x582ba1[_0x9d9d('0x23')]},client9002)[_0x9d9d('0x1b')](function(){return _0x582ba1;});}return _0x582ba1;}return null;})[_0x9d9d('0x1b')](respondWithResult(_0x39f824,null))[_0x9d9d('0x4c')](handleError(_0x39f824,null));};var interaction_log=require('../../config/logger')(_0x9d9d('0x56'));exports['reject']=function(_0x3208bc,_0x45a36a,_0x44a979){var _0x2b366f={'agent':{},'channel':_0x9d9d('0x76')};if(_0x3208bc[_0x9d9d('0x53')]['id']){delete _0x3208bc[_0x9d9d('0x53')]['id'];}_0x3208bc['body']['UserId']=_0x3208bc[_0x9d9d('0x53')][_0x9d9d('0x5a')]||_0x3208bc[_0x9d9d('0x5b')]['id'];_0x2b366f[_0x9d9d('0x5c')]['id']=_0x3208bc[_0x9d9d('0x53')]['UserId'];return db[_0x9d9d('0x36')][_0x9d9d('0x51')]({'where':{'id':_0x3208bc['params']['id'],'UserId':null}})[_0x9d9d('0x1b')](handleEntityNotFound(_0x45a36a,null))['then'](function(_0x3eb513){if(_0x3eb513){_0x2b366f[_0x9d9d('0x23')]=_0x3eb513[_0x9d9d('0x5d')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x3eb513['OpenchannelInteractionId']}});}return null;})[_0x9d9d('0x1b')](handleEntityNotFound(_0x45a36a,null))[_0x9d9d('0x1b')](function(_0x503804){if(_0x503804){_0x2b366f[_0x9d9d('0x61')]=_0x503804[_0x9d9d('0x5d')]({'plain':!![]});interaction_log[_0x9d9d('0x1c')](_0x9d9d('0x77'),_0x3208bc[_0x9d9d('0x5b')]['id'],_0x3208bc[_0x9d9d('0x5b')]['name'],_0x3208bc[_0x9d9d('0x5b')][_0x9d9d('0x63')],_0x2b366f[_0x9d9d('0x61')]['id'],_0x3208bc[_0x9d9d('0x53')]?JSON[_0x9d9d('0x20')](_0x3208bc['body']):_0x9d9d('0x64'));return respondWithRpcPromise(_0x9d9d('0x78'),'rejectMessage',_0x2b366f);}return null;})[_0x9d9d('0x1b')](function(_0x26ccd6){var _0x197e82=_0x9d9d('0x67')+_0x26ccd6[_0x9d9d('0x23')][_0x9d9d('0x79')];return db[_0x9d9d('0x68')][_0x9d9d('0x3b')](_0x197e82,{'type':db[_0x9d9d('0x69')][_0x9d9d('0x6a')][_0x9d9d('0x6b')],'raw':!![]})['then'](function(_0x3f8576){return _0x3f8576;});})[_0x9d9d('0x1b')](function(_0x410c66){if(_0x410c66){_0x2b366f[_0x9d9d('0x23')][_0x9d9d('0x6c')]=_0x410c66[0x0];if(!_0x3208bc[_0x9d9d('0x53')]['UserId'])return;return db[_0x9d9d('0x7a')][_0x9d9d('0x51')]({'where':{'id':_0x3208bc[_0x9d9d('0x53')]['UserId'],'role':'agent'},'attributes':['id',_0x9d9d('0x32'),_0x9d9d('0x6d'),_0x9d9d('0x6e'),'internal'],'raw':!![]});}return null;})[_0x9d9d('0x1b')](function(_0x489915){if(!_0x489915)return null;_0x2b366f[_0x9d9d('0x23')]['agent']=_0x489915;return _0x2b366f;})[_0x9d9d('0x1b')](function(_0x38df11){if(_0x38df11){_0x38df11[_0x9d9d('0x23')][_0x9d9d('0x70')]=util[_0x9d9d('0x58')](_0x9d9d('0x71'),_0x3208bc['user']['name']);_0x38df11[_0x9d9d('0x23')][_0x9d9d('0x72')]=_0x2b366f['channel'];_0x38df11[_0x9d9d('0x23')][_0x9d9d('0x73')]=_0x2b366f[_0x9d9d('0x72')];_0x38df11['message'][_0x9d9d('0x74')]=_0x9d9d('0x7b');respondWithRpcPromise(_0x9d9d('0x75'),_0x9d9d('0x75'),{'event':_0x9d9d('0x7c'),'message':_0x38df11[_0x9d9d('0x23')]},client9002);return _0x2b366f;}return null;})[_0x9d9d('0x1b')](respondWithResult(_0x45a36a,null))[_0x9d9d('0x4c')](handleError(_0x45a36a,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 0377d1a..f9faffc 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 _0xadf1=['hasOwnProperty','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xadf1,0xc5));var _0x1adf=function(_0x1cf5d1,_0x21d8a1){_0x1cf5d1=_0x1cf5d1-0x0;var _0x50d2e5=_0xadf1[_0x1cf5d1];return _0x50d2e5;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x1adf('0x0'))['db'][_0x1adf('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x1adf('0x2')](0x0);var events={'afterCreate':_0x1adf('0x3'),'afterUpdate':_0x1adf('0x4'),'afterDestroy':_0x1adf('0x5')};function emitEvent(_0x69a183){return function(_0x38811e,_0x5efcab,_0x4c76be){OpenchannelMessageEvents['emit'](_0x69a183+':'+_0x38811e['id'],_0x38811e);OpenchannelMessageEvents['emit'](_0x69a183,_0x38811e);_0x4c76be(null);};}for(var e in events){if(events[_0x1adf('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x0d38=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage'];(function(_0x340c13,_0x595d66){var _0x5a7d96=function(_0x250118){while(--_0x250118){_0x340c13['push'](_0x340c13['shift']());}};_0x5a7d96(++_0x595d66);}(_0x0d38,0x186));var _0x80d3=function(_0x188dec,_0x4fa5c6){_0x188dec=_0x188dec-0x0;var _0x185e41=_0x0d38[_0x188dec];return _0x185e41;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x80d3('0x0'))['db'][_0x80d3('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x80d3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x80d3('0x3')};function emitEvent(_0x2c1f52){return function(_0x2885ae,_0x140a2c,_0x18a6e4){OpenchannelMessageEvents['emit'](_0x2c1f52+':'+_0x2885ae['id'],_0x2885ae);OpenchannelMessageEvents[_0x80d3('0x4')](_0x2c1f52,_0x2885ae);_0x18a6e4(null);};}for(var e in events){if(events[_0x80d3('0x5')](e)){var event=events[e];OpenchannelMessage[_0x80d3('0x6')](e,emitEvent(event));}}module[_0x80d3('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index e1052e1..7b07ade 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 _0x8a51=['FULLTEXT','models','toLowerCase','direction','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','error','CmContact','find','OpenchannelAccountId','Interactions','Contact','keys','get','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','method','GET','POST','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','inspect','finally','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body'];(function(_0xa72345,_0x1fd304){var _0xbc82fb=function(_0xb1594f){while(--_0xb1594f){_0xa72345['push'](_0xa72345['shift']());}};_0xbc82fb(++_0x1fd304);}(_0x8a51,0x90));var _0x18a5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8a51[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x18a5('0x0'));var util=require(_0x18a5('0x1'));var logger=require(_0x18a5('0x2'))(_0x18a5('0x3'));var moment=require('moment');var BPromise=require(_0x18a5('0x4'));var rp=require(_0x18a5('0x5'));var fs=require('fs');var path=require(_0x18a5('0x6'));var rimraf=require(_0x18a5('0x7'));var config=require(_0x18a5('0x8'));var attributes=require(_0x18a5('0x9'));module[_0x18a5('0xa')]=function(_0x113595,_0x3564b1){return _0x113595['define'](_0x18a5('0xb'),attributes,{'tableName':_0x18a5('0xc'),'paranoid':![],'indexes':[{'name':_0x18a5('0xd'),'fields':[_0x18a5('0xe')],'type':_0x18a5('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xb908a1,_0x2faa00,_0xbb23d4){var _0x55db54=_0x113595[_0x18a5('0x10')];var _0x4c25b5=_0xb908a1['get']({'plain':!![]});if(_0x4c25b5['direction'][_0x18a5('0x11')]()==='in'||_0x4c25b5[_0x18a5('0x12')][_0x18a5('0x11')]()===_0x18a5('0x13')&&!_0x4c25b5[_0x18a5('0x14')]&&!_[_0x18a5('0x15')](_0x4c25b5[_0x18a5('0x16')])){_0x55db54[_0x18a5('0x17')][_0x18a5('0x18')]({'where':{'id':_0x4c25b5[_0x18a5('0x19')]}})[_0x18a5('0x1a')](function(_0x5ef6e4){if(_0x5ef6e4){_0x5ef6e4[_0x18a5('0x1b')]({'lastMsgAt':_0x4c25b5['createdAt'],'lastMsgDirection':_0x4c25b5[_0x18a5('0x12')]['toLowerCase']()});}})['catch'](function(_0x2beaa6){console[_0x18a5('0x1c')](_0x2beaa6);});}if(_0x4c25b5[_0x18a5('0x12')]===_0x18a5('0x13')&&!_0x4c25b5['secret']){var _0x329eab;_0x55db54[_0x18a5('0x1d')]['describe']()['then'](function(_0x2effa3){return _0x55db54['OpenchannelAccount'][_0x18a5('0x1e')]({'where':{'id':_0x4c25b5[_0x18a5('0x1f')]},'include':[{'model':_0x55db54[_0x18a5('0x17')],'as':_0x18a5('0x20'),'where':{'id':_0x4c25b5['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x55db54[_0x18a5('0x1d')],'as':_0x18a5('0x21'),'attributes':_[_0x18a5('0x22')](_0x2effa3)}]}]});})[_0x18a5('0x1a')](function(_0x2d5e1f){_0x329eab=_0x2d5e1f[_0x18a5('0x23')]({'plain':!![]});if(_0x329eab&&_0x329eab[_0x18a5('0x24')]){logger['info'](_0x18a5('0x25'),_0x18a5('0x26'),util[_0x18a5('0x27')](_0x18a5('0x28'),_0x4c25b5['id'],_0x329eab[_0x18a5('0x24')]));if(_0x329eab[_0x18a5('0x20')]&&_0x329eab[_0x18a5('0x20')][_0x18a5('0x29')]){_0x4c25b5[_0x18a5('0x2a')]=_['omit'](_0x329eab['Interactions'][0x0],_0x18a5('0x21'));_0x4c25b5[_0x18a5('0x21')]=_0x329eab[_0x18a5('0x20')][0x0]['Contact'];}var _0x2faa00={'method':'POST','uri':encodeURI(_0x329eab[_0x18a5('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2faa00[_0x18a5('0x2b')]){case _0x18a5('0x2c'):_0x2faa00['qs']=_0x4c25b5;break;case _0x18a5('0x2d'):_0x2faa00['body']=_0x4c25b5;break;}return rp(_0x2faa00)['then'](function(_0x22b81a){logger[_0x18a5('0x2e')](_0x18a5('0x25'),_0x18a5('0x26'),util[_0x18a5('0x27')](_0x18a5('0x2f'),_0x4c25b5['id'],_0x329eab[_0x18a5('0x24')]));if(_0x22b81a[_0x18a5('0xe')][_0x18a5('0x30')]&&_0x22b81a[_0x18a5('0xe')][_0x18a5('0x30')]!=_0x4c25b5[_0x18a5('0x2a')]['threadId']){return _0x55db54[_0x18a5('0x17')][_0x18a5('0x1b')]({'threadId':_0x22b81a[_0x18a5('0xe')][_0x18a5('0x30')]},{'where':{'id':_0x4c25b5[_0x18a5('0x2a')]['id']}});}else{return;}})[_0x18a5('0x1a')](function(){return _0xb908a1['update']({'read':!![]});})[_0x18a5('0x31')](function(_0x4aded3){logger[_0x18a5('0x1c')](_0x18a5('0x25'),_0x18a5('0x26'),util[_0x18a5('0x32')](_0x4aded3,{'showHidden':![],'depth':null}));_0xbb23d4();});}else{_0xbb23d4();}})[_0x18a5('0x33')](function(){_0xbb23d4();});}else{_0xbb23d4();}}},'charset':_0x18a5('0x34'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1ee7=['error','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','secret','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','Interaction','omit','replyUri','method','GET','POST','threadId'];(function(_0x33c37c,_0x271910){var _0x443c9f=function(_0x54c3e0){while(--_0x54c3e0){_0x33c37c['push'](_0x33c37c['shift']());}};_0x443c9f(++_0x271910);}(_0x1ee7,0xa0));var _0x71ee=function(_0x1d8831,_0x4f280c){_0x1d8831=_0x1d8831-0x0;var _0xfdc5f9=_0x1ee7[_0x1d8831];return _0xfdc5f9;};'use strict';var _=require(_0x71ee('0x0'));var util=require(_0x71ee('0x1'));var logger=require('../../config/logger')(_0x71ee('0x2'));var moment=require(_0x71ee('0x3'));var BPromise=require(_0x71ee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x71ee('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x71ee('0x6'));module[_0x71ee('0x7')]=function(_0x5e4b39,_0x518adf){return _0x5e4b39[_0x71ee('0x8')]('OpenchannelMessage',attributes,{'tableName':_0x71ee('0x9'),'paranoid':![],'indexes':[{'name':_0x71ee('0xa'),'fields':[_0x71ee('0xb')],'type':_0x71ee('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x11eefa,_0x3250ca,_0x57fa03){var _0x52d4f1=_0x5e4b39[_0x71ee('0xd')];var _0x45d861=_0x11eefa[_0x71ee('0xe')]({'plain':!![]});if(_0x45d861[_0x71ee('0xf')][_0x71ee('0x10')]()==='in'||_0x45d861[_0x71ee('0xf')][_0x71ee('0x10')]()===_0x71ee('0x11')&&!_0x45d861['secret']&&!_[_0x71ee('0x12')](_0x45d861[_0x71ee('0x13')])){_0x52d4f1[_0x71ee('0x14')][_0x71ee('0x15')]({'where':{'id':_0x45d861[_0x71ee('0x16')]}})[_0x71ee('0x17')](function(_0x49b21b){if(_0x49b21b){_0x49b21b[_0x71ee('0x18')]({'lastMsgAt':_0x45d861[_0x71ee('0x19')],'lastMsgDirection':_0x45d861[_0x71ee('0xf')][_0x71ee('0x10')]()});}})[_0x71ee('0x1a')](function(_0x524940){console['error'](_0x524940);});}if(_0x45d861[_0x71ee('0xf')]===_0x71ee('0x11')&&!_0x45d861[_0x71ee('0x1b')]){var _0xe33d45;_0x52d4f1[_0x71ee('0x1c')][_0x71ee('0x1d')]()[_0x71ee('0x17')](function(_0x2c7ba8){return _0x52d4f1[_0x71ee('0x1e')][_0x71ee('0x1f')]({'where':{'id':_0x45d861[_0x71ee('0x20')]},'include':[{'model':_0x52d4f1[_0x71ee('0x14')],'as':_0x71ee('0x21'),'where':{'id':_0x45d861[_0x71ee('0x16')]},'limit':0x1,'include':[{'model':_0x52d4f1['CmContact'],'as':_0x71ee('0x22'),'attributes':_[_0x71ee('0x23')](_0x2c7ba8)}]}]});})[_0x71ee('0x17')](function(_0x37bbf1){_0xe33d45=_0x37bbf1[_0x71ee('0xe')]({'plain':!![]});if(_0xe33d45&&_0xe33d45['replyUri']){logger[_0x71ee('0x24')](_0x71ee('0x25'),_0x71ee('0x26'),util[_0x71ee('0x27')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x45d861['id'],_0xe33d45['replyUri']));if(_0xe33d45[_0x71ee('0x21')]&&_0xe33d45[_0x71ee('0x21')][_0x71ee('0x28')]){_0x45d861[_0x71ee('0x29')]=_[_0x71ee('0x2a')](_0xe33d45['Interactions'][0x0],_0x71ee('0x22'));_0x45d861[_0x71ee('0x22')]=_0xe33d45[_0x71ee('0x21')][0x0][_0x71ee('0x22')];}var _0x3250ca={'method':'POST','uri':encodeURI(_0xe33d45[_0x71ee('0x2b')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3250ca[_0x71ee('0x2c')]){case _0x71ee('0x2d'):_0x3250ca['qs']=_0x45d861;break;case _0x71ee('0x2e'):_0x3250ca[_0x71ee('0xb')]=_0x45d861;break;}return rp(_0x3250ca)['then'](function(_0x329d11){logger[_0x71ee('0x24')](_0x71ee('0x25'),'afterCreate',util[_0x71ee('0x27')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x45d861['id'],_0xe33d45['replyUri']));if(_0x329d11['body'][_0x71ee('0x2f')]&&_0x329d11[_0x71ee('0xb')][_0x71ee('0x2f')]!=_0x45d861[_0x71ee('0x29')]['threadId']){return _0x52d4f1[_0x71ee('0x14')][_0x71ee('0x18')]({'threadId':_0x329d11['body'][_0x71ee('0x2f')]},{'where':{'id':_0x45d861[_0x71ee('0x29')]['id']}});}else{return;}})[_0x71ee('0x17')](function(){return _0x11eefa[_0x71ee('0x18')]({'read':!![]});})['catch'](function(_0x4acf22){logger[_0x71ee('0x30')](_0x71ee('0x25'),_0x71ee('0x26'),util['inspect'](_0x4acf22,{'showHidden':![],'depth':null}));_0x57fa03();});}else{_0x57fa03();}})[_0x71ee('0x31')](function(){_0x57fa03();});}else{_0x57fa03();}}},'charset':_0x71ee('0x32'),'collate':_0x71ee('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 6c40915..e00a21e 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x138bbe,_0xb0be94){var _0xe6a046=function(_0xb69fe){while(--_0xb69fe){_0x138bbe['push'](_0x138bbe['shift']());}};_0xe6a046(++_0xb0be94);}(_0xadb5,0xad));var _0x5adb=function(_0x328fe4,_0xbfc544){_0x328fe4=_0x328fe4-0x0;var _0x2117f3=_0xadb5[_0x328fe4];return _0x2117f3;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1df77b,_0x14950c){var _0x990a48=function(_0xa8f8ea){while(--_0xa8f8ea){_0x1df77b['push'](_0x1df77b['shift']());}};_0x990a48(++_0x14950c);}(_0x7a54,0x106));var _0x47a5=function(_0x2270d0,_0x482194){_0x2270d0=_0x2270d0-0x0;var _0x32856a=_0x7a54[_0x2270d0];return _0x32856a;};'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});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 89851b7..ff7c2b9 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 _0xfed6=['length','openchannelMessage:','./openchannelMessage.events','save','remove','update','removeListener','register'];(function(_0x51af72,_0x452087){var _0x46e192=function(_0x5972d2){while(--_0x5972d2){_0x51af72['push'](_0x51af72['shift']());}};_0x46e192(++_0x452087);}(_0xfed6,0x14a));var _0x6fed=function(_0x426706,_0x5a7138){_0x426706=_0x426706-0x0;var _0x2288d1=_0xfed6[_0x426706];return _0x2288d1;};'use strict';var OpenchannelMessageEvents=require(_0x6fed('0x0'));var events=[_0x6fed('0x1'),_0x6fed('0x2'),_0x6fed('0x3')];function createListener(_0x5d648f,_0x5876a0){return function(_0x22a07c){_0x5876a0['emit'](_0x5d648f,_0x22a07c);};}function removeListener(_0x36dcd2,_0x1a34fa){return function(){OpenchannelMessageEvents[_0x6fed('0x4')](_0x36dcd2,_0x1a34fa);};}exports[_0x6fed('0x5')]=function(_0x571665){for(var _0x27f596=0x0,_0x2ddaf0=events[_0x6fed('0x6')];_0x27f596<_0x2ddaf0;_0x27f596++){var _0x4b2d3c=events[_0x27f596];var _0x481db5=createListener(_0x6fed('0x7')+_0x4b2d3c,_0x571665);OpenchannelMessageEvents['on'](_0x4b2d3c,_0x481db5);}}; \ No newline at end of file +var _0xa381=['openchannelMessage:','./openchannelMessage.events','save','removeListener','register'];(function(_0x42efbe,_0xe47a8c){var _0x4b242d=function(_0xd8ec40){while(--_0xd8ec40){_0x42efbe['push'](_0x42efbe['shift']());}};_0x4b242d(++_0xe47a8c);}(_0xa381,0x79));var _0x1a38=function(_0x1a0557,_0x2a0db7){_0x1a0557=_0x1a0557-0x0;var _0x1ad015=_0xa381[_0x1a0557];return _0x1ad015;};'use strict';var OpenchannelMessageEvents=require(_0x1a38('0x0'));var events=[_0x1a38('0x1'),'remove','update'];function createListener(_0x41cdc2,_0xe2d8b3){return function(_0x2a069e){_0xe2d8b3['emit'](_0x41cdc2,_0x2a069e);};}function removeListener(_0x2a4353,_0x6cbf3){return function(){OpenchannelMessageEvents[_0x1a38('0x2')](_0x2a4353,_0x6cbf3);};}exports[_0x1a38('0x3')]=function(_0x4bb44f){for(var _0x411f6a=0x0,_0x569e9f=events['length'];_0x411f6a<_0x569e9f;_0x411f6a++){var _0x3d12f8=events[_0x411f6a];var _0x4df1db=createListener(_0x1a38('0x4')+_0x3d12f8,_0x4bb44f);OpenchannelMessageEvents['on'](_0x3d12f8,_0x4df1db);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index a53949f..28344f8 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 _0x99ae=['index','/describe','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addAgents','put','update','destroy','delete','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x3cd133,_0x222fcb){var _0x2512c8=function(_0x484491){while(--_0x484491){_0x3cd133['push'](_0x3cd133['shift']());}};_0x2512c8(++_0x222fcb);}(_0x99ae,0x156));var _0xe99a=function(_0x326899,_0x1b351a){_0x326899=_0x326899-0x0;var _0x5cc408=_0x99ae[_0x326899];return _0x5cc408;};'use strict';var multer=require(_0xe99a('0x0'));var util=require(_0xe99a('0x1'));var path=require(_0xe99a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe99a('0x3')]();var fs_extra=require(_0xe99a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe99a('0x5'));var config=require(_0xe99a('0x6'));var controller=require('./openchannelQueue.controller');router[_0xe99a('0x7')]('/',auth[_0xe99a('0x8')](),controller[_0xe99a('0x9')]);router[_0xe99a('0x7')](_0xe99a('0xa'),auth[_0xe99a('0x8')](),controller[_0xe99a('0xb')]);router[_0xe99a('0x7')](_0xe99a('0xc'),auth[_0xe99a('0x8')](),controller['show']);router[_0xe99a('0x7')](_0xe99a('0xd'),auth[_0xe99a('0x8')](),controller[_0xe99a('0xe')]);router[_0xe99a('0x7')]('/:id/teams',auth[_0xe99a('0x8')](),controller[_0xe99a('0xf')]);router['get'](_0xe99a('0x10'),auth[_0xe99a('0x8')](),controller[_0xe99a('0x11')]);router['post']('/',auth[_0xe99a('0x8')](),controller['create']);router[_0xe99a('0x12')](_0xe99a('0x13'),auth[_0xe99a('0x8')](),controller['addTeams']);router['post']('/:id/users',auth[_0xe99a('0x8')](),controller[_0xe99a('0x14')]);router[_0xe99a('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xe99a('0x16')]);router['delete'](_0xe99a('0xc'),auth[_0xe99a('0x8')](),controller[_0xe99a('0x17')]);router[_0xe99a('0x18')]('/:id/teams',auth[_0xe99a('0x8')](),controller['removeTeams']);router['delete'](_0xe99a('0x10'),auth[_0xe99a('0x8')](),controller[_0xe99a('0x19')]);module[_0xe99a('0x1a')]=router; \ No newline at end of file +var _0xe6d6=['delete','destroy','/:id/teams','removeTeams','/:id/users','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','/:id','/:id/members','getMembers','getTeams','getAgents','post','create','addAgents','update'];(function(_0x78409a,_0x15cdd1){var _0xabcc52=function(_0x374020){while(--_0x374020){_0x78409a['push'](_0x78409a['shift']());}};_0xabcc52(++_0x15cdd1);}(_0xe6d6,0xf7));var _0x6e6d=function(_0x41a60b,_0xc398d){_0x41a60b=_0x41a60b-0x0;var _0x10c95a=_0xe6d6[_0x41a60b];return _0x10c95a;};'use strict';var multer=require('multer');var util=require(_0x6e6d('0x0'));var path=require(_0x6e6d('0x1'));var timeout=require(_0x6e6d('0x2'));var express=require(_0x6e6d('0x3'));var router=express[_0x6e6d('0x4')]();var fs_extra=require(_0x6e6d('0x5'));var auth=require(_0x6e6d('0x6'));var interaction=require(_0x6e6d('0x7'));var config=require(_0x6e6d('0x8'));var controller=require(_0x6e6d('0x9'));router[_0x6e6d('0xa')]('/',auth[_0x6e6d('0xb')](),controller[_0x6e6d('0xc')]);router[_0x6e6d('0xa')](_0x6e6d('0xd'),auth[_0x6e6d('0xb')](),controller['describe']);router[_0x6e6d('0xa')](_0x6e6d('0xe'),auth[_0x6e6d('0xb')](),controller['show']);router[_0x6e6d('0xa')](_0x6e6d('0xf'),auth[_0x6e6d('0xb')](),controller[_0x6e6d('0x10')]);router[_0x6e6d('0xa')]('/:id/teams',auth['isAuthenticated'](),controller[_0x6e6d('0x11')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x6e6d('0x12')]);router[_0x6e6d('0x13')]('/',auth['isAuthenticated'](),controller[_0x6e6d('0x14')]);router['post']('/:id/teams',auth[_0x6e6d('0xb')](),controller['addTeams']);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x6e6d('0x15')]);router['put']('/:id',auth[_0x6e6d('0xb')](),controller[_0x6e6d('0x16')]);router[_0x6e6d('0x17')](_0x6e6d('0xe'),auth[_0x6e6d('0xb')](),controller[_0x6e6d('0x18')]);router[_0x6e6d('0x17')](_0x6e6d('0x19'),auth[_0x6e6d('0xb')](),controller[_0x6e6d('0x1a')]);router['delete'](_0x6e6d('0x1b'),auth[_0x6e6d('0xb')](),controller[_0x6e6d('0x1c')]);module[_0x6e6d('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 73ba841..4af1a8b 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 _0x9fee=['INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','STRING','name'];(function(_0x26c112,_0x41e2fd){var _0x4933d8=function(_0x5d33ab){while(--_0x5d33ab){_0x26c112['push'](_0x26c112['shift']());}};_0x4933d8(++_0x41e2fd);}(_0x9fee,0x105));var _0xe9fe=function(_0x116e47,_0x99861c){_0x116e47=_0x116e47-0x0;var _0x34dc24=_0x9fee[_0x116e47];return _0x34dc24;};'use strict';var Sequelize=require('sequelize');module[_0xe9fe('0x0')]={'name':{'type':Sequelize[_0xe9fe('0x1')],'unique':_0xe9fe('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xe9fe('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe9fe('0x4')](_0xe9fe('0x5'),_0xe9fe('0x6'),_0xe9fe('0x7'))}}; \ No newline at end of file +var _0xd875=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','name','STRING'];(function(_0x36d91c,_0x1cccf0){var _0x3f64c4=function(_0x5dd5d9){while(--_0x5dd5d9){_0x36d91c['push'](_0x36d91c['shift']());}};_0x3f64c4(++_0x1cccf0);}(_0xd875,0x175));var _0x5d87=function(_0x53c552,_0x129587){_0x53c552=_0x53c552-0x0;var _0x599000=_0xd875[_0x53c552];return _0x599000;};'use strict';var Sequelize=require(_0x5d87('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5d87('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5d87('0x2')]},'timeout':{'type':Sequelize[_0x5d87('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5d87('0x4')](_0x5d87('0x5'),_0x5d87('0x6'),_0x5d87('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index a1bbe3e..dcb9873 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 _0x3379=['OpenchannelQueues','UserProfileResource','stack','index','map','rawAttributes','fieldName','key','include','OpenchannelQueue','findAll','catch','params','model','keys','filters','intersection','query','attributes','fields','includeAll','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','name','body','getMembers','findOne','UserOpenchannelQueue','length','hasOwnProperty','nolimit','order','sort','where','OpenchannelQueueId','filter','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','rows','format','%s/%s','SIP','getTeams','Team','pick','ids','Agents','flatMap','sequelize','transaction','each','findOrCreate','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','toString','SELECT','every','includes','compact','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','spread','emit','getAgents','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','update','then','destroy','get'];(function(_0x392007,_0xea369c){var _0x373450=function(_0x1f60ef){while(--_0x1f60ef){_0x392007['push'](_0x392007['shift']());}};_0x373450(++_0xea369c);}(_0x3379,0x19b));var _0x9337=function(_0x31c3cb,_0x54353a){_0x31c3cb=_0x31c3cb-0x0;var _0x28bf1b=_0x3379[_0x31c3cb];return _0x28bf1b;};'use strict';var BPromise=require('bluebird');var util=require(_0x9337('0x0'));var _=require(_0x9337('0x1'));var squel=require('squel');var Redis=require(_0x9337('0x2'));var qs=require(_0x9337('0x3'));var logger=require(_0x9337('0x4'))(_0x9337('0x5'));var config=require(_0x9337('0x6'));var db=require(_0x9337('0x7'))['db'];config[_0x9337('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9337('0x9'))(new Redis(config[_0x9337('0x8')]));require(_0x9337('0xa'))['register'](socket);function respondWithStatusCode(_0x347aa7,_0x3d533c){_0x3d533c=_0x3d533c||0xcc;return function(_0x336fa3){if(_0x336fa3){return _0x347aa7[_0x9337('0xb')](_0x3d533c);}return _0x347aa7[_0x9337('0xc')](_0x3d533c)[_0x9337('0xd')]();};}function respondWithResult(_0xde8502,_0x9ae266){_0x9ae266=_0x9ae266||0xc8;return function(_0xd211d6){if(_0xd211d6){return _0xde8502[_0x9337('0xc')](_0x9ae266)['json'](_0xd211d6);}};}function respondWithFilteredResult(_0x13a30e,_0x54eee9){return function(_0x43d9bb){if(_0x43d9bb){var _0xa53472=typeof _0x54eee9['offset']===_0x9337('0xe')&&typeof _0x54eee9[_0x9337('0xf')]===_0x9337('0xe');var _0x122907=_0x43d9bb[_0x9337('0x10')];var _0x32f558=_0xa53472?0x0:_0x54eee9[_0x9337('0x11')];var _0x35d511=_0xa53472?_0x43d9bb[_0x9337('0x10')]:_0x54eee9[_0x9337('0x11')]+_0x54eee9[_0x9337('0xf')];var _0x5d6845;if(_0x35d511>=_0x122907){_0x35d511=_0x122907;_0x5d6845=0xc8;}else{_0x5d6845=0xce;}_0x13a30e[_0x9337('0xc')](_0x5d6845);return _0x13a30e[_0x9337('0x12')](_0x9337('0x13'),_0x32f558+'-'+_0x35d511+'/'+_0x122907)[_0x9337('0x14')](_0x43d9bb);}return null;};}function saveUpdates(_0x2fec45){return function(_0x124553){if(_0x124553){return _0x124553[_0x9337('0x15')](_0x2fec45)[_0x9337('0x16')](function(_0x326e0b){return _0x326e0b;});}return null;};}function removeEntity(_0x275798){return function(_0x4de18b){if(_0x4de18b){return _0x4de18b[_0x9337('0x17')]()[_0x9337('0x16')](function(){var _0x29bb3a=_0x4de18b[_0x9337('0x18')]({'plain':!![]});var _0x4c68ef=_0x9337('0x19');return db[_0x9337('0x1a')][_0x9337('0x17')]({'where':{'type':_0x4c68ef,'resourceId':_0x29bb3a['id']}})['then'](function(){return _0x4de18b;});})[_0x9337('0x16')](function(){_0x275798[_0x9337('0xc')](0xcc)[_0x9337('0xd')]();});}};}function handleEntityNotFound(_0x2d5aa5){return function(_0x3c3ef1){if(!_0x3c3ef1){_0x2d5aa5[_0x9337('0xb')](0x194);}return _0x3c3ef1;};}function handleError(_0x3815b8,_0x677286){_0x677286=_0x677286||0x1f4;return function(_0x495919){logger['error'](_0x495919[_0x9337('0x1b')]);if(_0x495919['name']){delete _0x495919['name'];}_0x3815b8['status'](_0x677286)['send'](_0x495919);};}exports[_0x9337('0x1c')]=function(_0x3c11d5,_0x54ac75){var _0x1da71e={};var _0x7d60e8={'count':0x0,'rows':[]};var _0x129518=_[_0x9337('0x1d')](db['OpenchannelQueue'][_0x9337('0x1e')],function(_0x400820){return{'name':_0x400820[_0x9337('0x1f')],'type':_0x400820['type'][_0x9337('0x20')]};});_0x1da71e=qs['getOptions'](_0x129518,_0x3c11d5);var _0x1c5aa3={'where':_0x1da71e['where']};return db['OpenchannelQueue']['count'](_0x1c5aa3)[_0x9337('0x16')](function(_0x5eca7f){_0x7d60e8[_0x9337('0x10')]=_0x5eca7f;_0x1da71e[_0x9337('0x21')]=qs[_0x9337('0x21')](_0x3c11d5['query']);return db[_0x9337('0x22')][_0x9337('0x23')](_0x1da71e);})['then'](function(_0x131e75){_0x7d60e8['rows']=_0x131e75;return _0x7d60e8;})[_0x9337('0x16')](respondWithFilteredResult(_0x54ac75,_0x1da71e))[_0x9337('0x24')](handleError(_0x54ac75,null));};exports['show']=function(_0x49ab1f,_0x426c2c){var _0x45006e={'raw':!![],'where':{'id':_0x49ab1f[_0x9337('0x25')]['id']}},_0xd73b14={};_0xd73b14[_0x9337('0x26')]=_['keys'](db['OpenchannelQueue'][_0x9337('0x1e')]);_0xd73b14['query']=_[_0x9337('0x27')](_0x49ab1f['query']);_0xd73b14[_0x9337('0x28')]=_[_0x9337('0x29')](_0xd73b14[_0x9337('0x26')],_0xd73b14[_0x9337('0x2a')]);_0x45006e[_0x9337('0x2b')]=_[_0x9337('0x29')](_0xd73b14[_0x9337('0x26')],qs[_0x9337('0x2c')](_0x49ab1f[_0x9337('0x2a')]['fields']));_0x45006e[_0x9337('0x2b')]=_0x45006e[_0x9337('0x2b')]['length']?_0x45006e[_0x9337('0x2b')]:_0xd73b14[_0x9337('0x26')];if(_0x49ab1f[_0x9337('0x2a')][_0x9337('0x2d')]){_0x45006e[_0x9337('0x21')]=[{'all':!![]}];}_0x45006e=_[_0x9337('0x2e')]({},_0x45006e,_0x49ab1f[_0x9337('0x2f')]);return db[_0x9337('0x22')][_0x9337('0x30')](_0x45006e)[_0x9337('0x16')](handleEntityNotFound(_0x426c2c,null))[_0x9337('0x16')](respondWithResult(_0x426c2c,null))['catch'](handleError(_0x426c2c,null));};exports[_0x9337('0x31')]=function(_0x145475,_0x372e54){return db[_0x9337('0x22')][_0x9337('0x31')](_0x145475['body'],{})[_0x9337('0x16')](function(_0x1d4f09){var _0x3ba44e=_0x145475['user']['get']({'plain':!![]});if(!_0x3ba44e)throw new Error(_0x9337('0x32'));if(_0x3ba44e['role']===_0x9337('0x33')){var _0x124b3d=_0x1d4f09[_0x9337('0x18')]({'plain':!![]});var _0x90beab=_0x9337('0x19');return db[_0x9337('0x34')][_0x9337('0x30')]({'where':{'name':_0x90beab,'userProfileId':_0x3ba44e[_0x9337('0x35')]},'raw':!![]})[_0x9337('0x16')](function(_0x10833c){if(_0x10833c&&_0x10833c['autoAssociation']===0x0){return db['UserProfileResource'][_0x9337('0x31')]({'name':_0x124b3d['name'],'resourceId':_0x124b3d['id'],'type':_0x10833c[_0x9337('0x36')],'sectionId':_0x10833c['id']},{})['then'](function(){return _0x1d4f09;});}else{return _0x1d4f09;}})[_0x9337('0x24')](function(_0x4841f5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4841f5);throw _0x4841f5;});}return _0x1d4f09;})['then'](respondWithResult(_0x372e54,0xc9))['catch'](handleError(_0x372e54,null));};exports[_0x9337('0x15')]=function(_0x44aff0,_0x5af5c2){if(_0x44aff0[_0x9337('0x37')]['id']){delete _0x44aff0[_0x9337('0x37')]['id'];}return db[_0x9337('0x22')]['find']({'where':{'id':_0x44aff0[_0x9337('0x25')]['id']}})[_0x9337('0x16')](handleEntityNotFound(_0x5af5c2,null))['then'](saveUpdates(_0x44aff0[_0x9337('0x37')],null))[_0x9337('0x16')](respondWithResult(_0x5af5c2,null))[_0x9337('0x24')](handleError(_0x5af5c2,null));};exports[_0x9337('0x17')]=function(_0x2d9e15,_0x5543b4){return db[_0x9337('0x22')][_0x9337('0x30')]({'where':{'id':_0x2d9e15[_0x9337('0x25')]['id']}})[_0x9337('0x16')](handleEntityNotFound(_0x5543b4,null))[_0x9337('0x16')](removeEntity(_0x5543b4,null))[_0x9337('0x24')](handleError(_0x5543b4,null));};exports['describe']=function(_0xe79ef,_0x57f9e5){return db[_0x9337('0x22')]['describe']()[_0x9337('0x16')](respondWithResult(_0x57f9e5,null))[_0x9337('0x24')](handleError(_0x57f9e5,null));};exports[_0x9337('0x38')]=function(_0x185610,_0x19c8c1){var _0x6084e7={'raw':!![],'where':{}},_0x36769c={},_0x999f5c;return db[_0x9337('0x22')][_0x9337('0x39')]({'where':{'id':_0x185610['params']['id']}})[_0x9337('0x16')](handleEntityNotFound(_0x19c8c1,null))[_0x9337('0x16')](function(_0x15cfc6){if(_0x15cfc6){_0x999f5c=_0x15cfc6[_0x9337('0x18')]({'plain':!![]});_0x36769c['model']=_['keys'](db[_0x9337('0x3a')][_0x9337('0x1e')]);_0x36769c[_0x9337('0x2a')]=_['keys'](_0x185610[_0x9337('0x2a')]);_0x36769c[_0x9337('0x28')]=_[_0x9337('0x29')](_0x36769c['model'],_0x36769c['query']);_0x6084e7[_0x9337('0x2b')]=_[_0x9337('0x29')](_0x36769c[_0x9337('0x26')],qs[_0x9337('0x2c')](_0x185610[_0x9337('0x2a')][_0x9337('0x2c')]));_0x6084e7[_0x9337('0x2b')]=_0x6084e7[_0x9337('0x2b')][_0x9337('0x3b')]?_0x6084e7['attributes']:_0x36769c[_0x9337('0x26')];if(!_0x185610[_0x9337('0x2a')][_0x9337('0x3c')](_0x9337('0x3d'))){_0x6084e7[_0x9337('0xf')]=qs[_0x9337('0xf')](_0x185610[_0x9337('0x2a')]['limit']);_0x6084e7[_0x9337('0x11')]=qs['offset'](_0x185610[_0x9337('0x2a')][_0x9337('0x11')]);}_0x6084e7[_0x9337('0x3e')]=qs[_0x9337('0x3f')](_0x185610['query'][_0x9337('0x3f')]);_0x6084e7[_0x9337('0x40')]=qs[_0x9337('0x28')](_['pick'](_0x185610['query'],_0x36769c[_0x9337('0x28')]));_0x6084e7[_0x9337('0x40')][_0x9337('0x41')]=_0x15cfc6['id'];if(_0x185610[_0x9337('0x2a')][_0x9337('0x42')]){_0x6084e7[_0x9337('0x40')]=_['merge'](_0x6084e7[_0x9337('0x40')],{'$or':_[_0x9337('0x1d')](_0x6084e7[_0x9337('0x2b')],function(_0x102e55){var _0x41ac12={};_0x41ac12[_0x102e55]={'$like':'%'+_0x185610['query'][_0x9337('0x42')]+'%'};return _0x41ac12;})});}_0x6084e7=_['merge']({},_0x6084e7,_0x185610[_0x9337('0x2f')]);return db[_0x9337('0x3a')][_0x9337('0x23')](_0x6084e7);}})[_0x9337('0x16')](function(_0x1dd358){if(_0x1dd358){return db[_0x9337('0x43')][_0x9337('0x44')]({'where':{'id':_[_0x9337('0x1d')](_0x1dd358,_0x9337('0x45')),'role':_0x9337('0x46')},'attributes':['id','name',_0x9337('0x47'),_0x9337('0x48'),'createdAt']});}})['then'](function(_0x50533e){if(_0x50533e){return{'count':_0x50533e[_0x9337('0x10')],'rows':_[_0x9337('0x1d')](_0x50533e[_0x9337('0x49')],function(_0x4600fe){return{'membername':_0x4600fe['name'],'UserId':_0x4600fe['id'],'queue_name':_0x999f5c[_0x9337('0x36')],'OpenchannelQueueId':_0x999f5c['id'],'interface':util[_0x9337('0x4a')](_0x9337('0x4b'),_0x9337('0x4c'),_0x4600fe['name']),'penalty':0x0,'paused':_0x4600fe[_0x9337('0x47')],'createdAt':_0x4600fe['createdAt'],'updatedAt':_0x4600fe[_0x9337('0x48')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9337('0x16')](respondWithFilteredResult(_0x19c8c1,_0x6084e7))['catch'](handleError(_0x19c8c1,null));};exports[_0x9337('0x4d')]=function(_0x5dc242,_0x4bde64){var _0x362774={};var _0x5970e5={};var _0x3fdc8e;var _0x5b7a28;return db[_0x9337('0x22')]['findOne']({'where':{'id':_0x5dc242['params']['id']}})[_0x9337('0x16')](handleEntityNotFound(_0x4bde64,null))[_0x9337('0x16')](function(_0x5c79cd){if(_0x5c79cd){_0x3fdc8e=_0x5c79cd;_0x5970e5[_0x9337('0x26')]=_[_0x9337('0x27')](db[_0x9337('0x4e')]['rawAttributes']);_0x5970e5['query']=_[_0x9337('0x27')](_0x5dc242['query']);_0x5970e5[_0x9337('0x28')]=_[_0x9337('0x29')](_0x5970e5[_0x9337('0x26')],_0x5970e5[_0x9337('0x2a')]);_0x362774['attributes']=_['intersection'](_0x5970e5['model'],qs['fields'](_0x5dc242[_0x9337('0x2a')][_0x9337('0x2c')]));_0x362774[_0x9337('0x2b')]=_0x362774['attributes'][_0x9337('0x3b')]?_0x362774[_0x9337('0x2b')]:_0x5970e5[_0x9337('0x26')];_0x362774[_0x9337('0x3e')]=qs[_0x9337('0x3f')](_0x5dc242[_0x9337('0x2a')]['sort']);_0x362774[_0x9337('0x40')]=qs[_0x9337('0x28')](_[_0x9337('0x4f')](_0x5dc242[_0x9337('0x2a')],_0x5970e5[_0x9337('0x28')]));if(_0x5dc242[_0x9337('0x2a')][_0x9337('0x42')]){_0x362774[_0x9337('0x40')]=_[_0x9337('0x2e')](_0x362774[_0x9337('0x40')],{'$or':_['map'](_0x362774['attributes'],function(_0x5e95c9){var _0x40af49={};_0x40af49[_0x5e95c9]={'$like':'%'+_0x5dc242[_0x9337('0x2a')][_0x9337('0x42')]+'%'};return _0x40af49;})});}_0x362774=_[_0x9337('0x2e')]({},_0x362774,_0x5dc242[_0x9337('0x2f')]);return _0x3fdc8e[_0x9337('0x4d')](_0x362774);}})['then'](function(_0x434b13){if(_0x434b13){_0x5b7a28=_0x434b13[_0x9337('0x3b')];if(!_0x5dc242[_0x9337('0x2a')][_0x9337('0x3c')](_0x9337('0x3d'))){_0x362774[_0x9337('0xf')]=qs['limit'](_0x5dc242['query'][_0x9337('0xf')]);_0x362774['offset']=qs['offset'](_0x5dc242[_0x9337('0x2a')][_0x9337('0x11')]);}return _0x3fdc8e[_0x9337('0x4d')](_0x362774);}})[_0x9337('0x16')](function(_0x1582f9){if(_0x1582f9){return _0x1582f9?{'count':_0x5b7a28,'rows':_0x1582f9}:null;}})[_0x9337('0x16')](respondWithResult(_0x4bde64,null))[_0x9337('0x24')](handleError(_0x4bde64,null));};exports['addTeams']=function(_0x5e6478,_0x15ced3){var _0x36a98e=_0x5e6478[_0x9337('0x37')][_0x9337('0x50')];return db[_0x9337('0x4e')][_0x9337('0x23')]({'where':{'id':_0x36a98e},'attributes':['id'],'include':[{'model':db[_0x9337('0x43')],'as':_0x9337('0x51'),'attributes':['id',_0x9337('0x36'),'online','voicePause','interface'],'raw':!![]}]})[_0x9337('0x16')](function(_0x5cc650){if(_0x5cc650){var _0x4b4728=_[_0x9337('0x52')](_0x5cc650,function(_0xdac052){var _0x31a6cd=_0xdac052[_0x9337('0x18')]({'plain':!![]});return _0x31a6cd['Agents'];});return db['OpenchannelQueue']['find']({'where':{'id':_0x5e6478[_0x9337('0x25')]['id']}})['then'](function(_0x2639fe){return db[_0x9337('0x53')][_0x9337('0x54')](function(_0x4f7291){return _0x2639fe['addTeams'](_0x36a98e,{'transaction':_0x4f7291})[_0x9337('0x16')](function(){return BPromise[_0x9337('0x55')](_0x4b4728,function(_0x2b336a){return db[_0x9337('0x3a')][_0x9337('0x56')]({'where':{'UserId':_0x2b336a['id'],'OpenchannelQueueId':_0x5e6478[_0x9337('0x25')]['id']},'transaction':_0x4f7291});});})[_0x9337('0x16')](function(){_0x4b4728['forEach'](function(_0x1f6153){socket['emit'](_0x9337('0x57'),{'UserId':_0x1f6153['id'],'OpenchannelQueueId':_0x2639fe['id']});});});});});}})['then'](respondWithStatusCode(_0x15ced3,null))['catch'](handleError(_0x15ced3,null));};exports[_0x9337('0x58')]=function(_0x1aaedf,_0x512549){return db[_0x9337('0x4e')]['findAll']({'where':{'id':_0x1aaedf[_0x9337('0x2a')][_0x9337('0x50')]},'attributes':['id'],'include':[{'model':db[_0x9337('0x43')],'as':_0x9337('0x51'),'attributes':['id'],'raw':!![]}]})[_0x9337('0x16')](handleEntityNotFound(_0x512549,null))[_0x9337('0x16')](function(_0xa85684){var _0x2f86f0=_[_0x9337('0x1d')](_0xa85684,'id');var _0x57bcc5=[];var _0x4fdfea=[];var _0x1f3df9=squel[_0x9337('0x59')]();_0x1f3df9[_0x9337('0x5a')](_0x9337('0x5b'))[_0x9337('0x5c')](_0x9337('0x5d'),'tq')['join']('user_has_teams','ut',_0x9337('0x5e'))['where'](_0x9337('0x5f'),_0x1aaedf[_0x9337('0x25')]['id']);for(var _0x32d79d=0x0;_0x32d79d<_0xa85684[_0x9337('0x3b')];_0x32d79d+=0x1){let _0x8183af=_0xa85684[_0x32d79d];for(var _0x5744f7=0x0;_0x5744f7<_0x8183af[_0x9337('0x51')][_0x9337('0x3b')];_0x5744f7+=0x1){let _0x598540=_0x8183af[_0x9337('0x51')][_0x5744f7];var _0x45ddf0=_0x1f3df9[_0x9337('0x60')]();_0x45ddf0[_0x9337('0x40')]('ut.UserId\x20=\x20?',_0x598540['id']);_0x4fdfea['push'](db['sequelize'][_0x9337('0x2a')](_0x45ddf0[_0x9337('0x61')](),{'type':db[_0x9337('0x53')]['QueryTypes'][_0x9337('0x62')]})[_0x9337('0x16')](function(_0x52df32){if(_0x52df32[_0x9337('0x3b')]===0x1){return _0x598540['id'];}else{var _0x57f6f3=_[_0x9337('0x63')](_[_0x9337('0x1d')](_0x52df32,'TeamId'),function(_0x395fec){return _[_0x9337('0x64')](_0x2f86f0,_0x395fec);});if(_0x57f6f3){return _0x598540['id'];}}}));}}return BPromise['all'](_0x4fdfea)[_0x9337('0x16')](function(_0x235fdf){_0x57bcc5=_(_0x57bcc5)['union'](_0x235fdf)[_0x9337('0x65')]()['value']();return db[_0x9337('0x22')][_0x9337('0x30')]({'where':{'id':_0x1aaedf[_0x9337('0x25')]['id']}})[_0x9337('0x16')](function(_0x4e96b2){return db['sequelize']['transaction'](function(_0x3c3f5d){return _0x4e96b2['removeTeams'](_0x1aaedf['query']['ids'],{'transaction':_0x3c3f5d})[_0x9337('0x16')](function(){if(!_[_0x9337('0x66')](_0x57bcc5)){return _0x4e96b2[_0x9337('0x67')](_0x57bcc5,{'transaction':_0x3c3f5d});}})[_0x9337('0x16')](function(){_0x57bcc5['forEach'](function(_0x40e61c){socket['emit'](_0x9337('0x68'),{'UserId':_0x40e61c,'OpenchannelQueueId':_0x4e96b2['id']});});});});});});})['then'](respondWithStatusCode(_0x512549,null))['catch'](handleError(_0x512549,null));};exports[_0x9337('0x69')]=function(_0x50b06b,_0x5ac996){return db[_0x9337('0x22')]['find']({'where':{'id':_0x50b06b[_0x9337('0x25')]['id']}})[_0x9337('0x16')](handleEntityNotFound(_0x5ac996,null))[_0x9337('0x16')](function(_0x579c7b){if(_0x579c7b){return _0x579c7b[_0x9337('0x69')](_0x50b06b[_0x9337('0x37')][_0x9337('0x50')],_['omit'](_0x50b06b['body'],[_0x9337('0x50'),'id'])||{})[_0x9337('0x6a')](function(_0x340e6f){for(var _0x295255=0x0;_0x295255<_0x50b06b[_0x9337('0x37')][_0x9337('0x50')][_0x9337('0x3b')];_0x295255+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x50b06b[_0x9337('0x37')][_0x9337('0x50')][_0x295255]),'OpenchannelQueueId':Number(_0x50b06b[_0x9337('0x25')]['id'])});}return _0x340e6f;});}})[_0x9337('0x16')](respondWithResult(_0x5ac996,null))['catch'](handleError(_0x5ac996,null));};exports[_0x9337('0x67')]=function(_0x49687c,_0x4b66e7){return db[_0x9337('0x22')][_0x9337('0x30')]({'where':{'id':_0x49687c['params']['id']}})[_0x9337('0x16')](handleEntityNotFound(_0x4b66e7,null))[_0x9337('0x16')](function(_0x2ba68e){if(_0x2ba68e){return _0x2ba68e[_0x9337('0x67')](_0x49687c['query']['ids'])[_0x9337('0x16')](function(){if(_['isArray'](_0x49687c['query'][_0x9337('0x50')])){for(var _0x12d9ad=0x0;_0x12d9ad<_0x49687c[_0x9337('0x2a')][_0x9337('0x50')][_0x9337('0x3b')];_0x12d9ad+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x49687c[_0x9337('0x2a')][_0x9337('0x50')][_0x12d9ad]),'OpenchannelQueueId':Number(_0x49687c[_0x9337('0x25')]['id'])});}}else{socket[_0x9337('0x6b')]('userOpenchannelQueue:remove',{'UserId':Number(_0x49687c[_0x9337('0x2a')][_0x9337('0x50')]),'OpenchannelQueueId':Number(_0x49687c[_0x9337('0x25')]['id'])});}});}})[_0x9337('0x16')](respondWithStatusCode(_0x4b66e7,null))['catch'](handleError(_0x4b66e7,null));};exports[_0x9337('0x6c')]=function(_0x5a60e0,_0x538c6a){var _0x628585={};var _0x190132={};var _0x2e0c02;var _0x4e3f72;return db['OpenchannelQueue'][_0x9337('0x39')]({'where':{'id':_0x5a60e0['params']['id']}})[_0x9337('0x16')](handleEntityNotFound(_0x538c6a,null))[_0x9337('0x16')](function(_0x4b6a20){if(_0x4b6a20){_0x2e0c02=_0x4b6a20;_0x190132[_0x9337('0x26')]=_[_0x9337('0x27')](db['User'][_0x9337('0x1e')]);_0x190132[_0x9337('0x2a')]=_[_0x9337('0x27')](_0x5a60e0[_0x9337('0x2a')]);_0x190132['filters']=_[_0x9337('0x29')](_0x190132['model'],_0x190132[_0x9337('0x2a')]);_0x628585[_0x9337('0x2b')]=_[_0x9337('0x29')](_0x190132['model'],qs['fields'](_0x5a60e0[_0x9337('0x2a')][_0x9337('0x2c')]));_0x628585[_0x9337('0x2b')]=_0x628585[_0x9337('0x2b')][_0x9337('0x3b')]?_0x628585[_0x9337('0x2b')]:_0x190132[_0x9337('0x26')];_0x628585[_0x9337('0x3e')]=qs[_0x9337('0x3f')](_0x5a60e0[_0x9337('0x2a')][_0x9337('0x3f')]);_0x628585[_0x9337('0x40')]=qs['filters'](_[_0x9337('0x4f')](_0x5a60e0[_0x9337('0x2a')],_0x190132[_0x9337('0x28')]));if(_0x5a60e0[_0x9337('0x2a')][_0x9337('0x42')]){_0x628585[_0x9337('0x40')]=_['merge'](_0x628585[_0x9337('0x40')],{'$or':_['map'](_0x628585[_0x9337('0x2b')],function(_0x1dc3a6){var _0x5c0c5f={};_0x5c0c5f[_0x1dc3a6]={'$like':'%'+_0x5a60e0['query'][_0x9337('0x42')]+'%'};return _0x5c0c5f;})});}_0x628585=_[_0x9337('0x2e')]({},_0x628585,_0x5a60e0['options']);return _0x2e0c02['getAgents'](_0x628585);}})['then'](function(_0x48f78b){if(_0x48f78b){_0x4e3f72=_0x48f78b[_0x9337('0x3b')];if(!_0x5a60e0[_0x9337('0x2a')][_0x9337('0x3c')]('nolimit')){_0x628585[_0x9337('0xf')]=qs[_0x9337('0xf')](_0x5a60e0[_0x9337('0x2a')]['limit']);_0x628585[_0x9337('0x11')]=qs['offset'](_0x5a60e0['query'][_0x9337('0x11')]);}return _0x2e0c02[_0x9337('0x6c')](_0x628585);}})[_0x9337('0x16')](function(_0x250f84){if(_0x250f84){return _0x250f84?{'count':_0x4e3f72,'rows':_0x250f84}:null;}})[_0x9337('0x16')](respondWithResult(_0x538c6a,null))['catch'](handleError(_0x538c6a,null));}; \ No newline at end of file +var _0xac12=['../../mysqldb','defaults','redis','./openchannelQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','OpenchannelQueues','UserProfileResource','stack','name','send','index','map','fieldName','type','key','getOptions','OpenchannelQueue','include','query','findAll','catch','show','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','order','sort','OpenchannelQueueId','where','filter','User','findAndCountAll','UserId','createdAt','rows','format','%s/%s','SIP','getTeams','Team','pick','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','bluebird','util','squel','../../components/parsers/qs','../../config/logger'];(function(_0x2f0bf1,_0x183ef1){var _0xf1df38=function(_0x56982a){while(--_0x56982a){_0x2f0bf1['push'](_0x2f0bf1['shift']());}};_0xf1df38(++_0x183ef1);}(_0xac12,0x163));var _0x2ac1=function(_0x3dca19,_0x47442b){_0x3dca19=_0x3dca19-0x0;var _0x58947d=_0xac12[_0x3dca19];return _0x58947d;};'use strict';var BPromise=require(_0x2ac1('0x0'));var util=require(_0x2ac1('0x1'));var _=require('lodash');var squel=require(_0x2ac1('0x2'));var Redis=require('ioredis');var qs=require(_0x2ac1('0x3'));var logger=require(_0x2ac1('0x4'))('api');var config=require('../../config/environment');var db=require(_0x2ac1('0x5'))['db'];config['redis']=_[_0x2ac1('0x6')](config[_0x2ac1('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2ac1('0x7')]));require(_0x2ac1('0x8'))[_0x2ac1('0x9')](socket);function respondWithStatusCode(_0x59c170,_0x21b06c){_0x21b06c=_0x21b06c||0xcc;return function(_0x2fb2bd){if(_0x2fb2bd){return _0x59c170['sendStatus'](_0x21b06c);}return _0x59c170[_0x2ac1('0xa')](_0x21b06c)[_0x2ac1('0xb')]();};}function respondWithResult(_0x53dec1,_0x3e8251){_0x3e8251=_0x3e8251||0xc8;return function(_0x132730){if(_0x132730){return _0x53dec1[_0x2ac1('0xa')](_0x3e8251)[_0x2ac1('0xc')](_0x132730);}};}function respondWithFilteredResult(_0x35b798,_0x67e0c4){return function(_0x5a3c93){if(_0x5a3c93){var _0x3cbdbd=typeof _0x67e0c4[_0x2ac1('0xd')]===_0x2ac1('0xe')&&typeof _0x67e0c4[_0x2ac1('0xf')]===_0x2ac1('0xe');var _0x34618a=_0x5a3c93[_0x2ac1('0x10')];var _0x34f40a=_0x3cbdbd?0x0:_0x67e0c4[_0x2ac1('0xd')];var _0x28e421=_0x3cbdbd?_0x5a3c93['count']:_0x67e0c4[_0x2ac1('0xd')]+_0x67e0c4[_0x2ac1('0xf')];var _0xe35c59;if(_0x28e421>=_0x34618a){_0x28e421=_0x34618a;_0xe35c59=0xc8;}else{_0xe35c59=0xce;}_0x35b798[_0x2ac1('0xa')](_0xe35c59);return _0x35b798[_0x2ac1('0x11')](_0x2ac1('0x12'),_0x34f40a+'-'+_0x28e421+'/'+_0x34618a)[_0x2ac1('0xc')](_0x5a3c93);}return null;};}function saveUpdates(_0x184eff){return function(_0x191020){if(_0x191020){return _0x191020[_0x2ac1('0x13')](_0x184eff)[_0x2ac1('0x14')](function(_0x146978){return _0x146978;});}return null;};}function removeEntity(_0xf2dec6){return function(_0x38656f){if(_0x38656f){return _0x38656f[_0x2ac1('0x15')]()[_0x2ac1('0x14')](function(){var _0xeea7ee=_0x38656f['get']({'plain':!![]});var _0x130949=_0x2ac1('0x16');return db[_0x2ac1('0x17')][_0x2ac1('0x15')]({'where':{'type':_0x130949,'resourceId':_0xeea7ee['id']}})[_0x2ac1('0x14')](function(){return _0x38656f;});})[_0x2ac1('0x14')](function(){_0xf2dec6[_0x2ac1('0xa')](0xcc)[_0x2ac1('0xb')]();});}};}function handleEntityNotFound(_0x305714){return function(_0x372cb2){if(!_0x372cb2){_0x305714['sendStatus'](0x194);}return _0x372cb2;};}function handleError(_0x419de9,_0x96ad2a){_0x96ad2a=_0x96ad2a||0x1f4;return function(_0x20ef3b){logger['error'](_0x20ef3b[_0x2ac1('0x18')]);if(_0x20ef3b['name']){delete _0x20ef3b[_0x2ac1('0x19')];}_0x419de9[_0x2ac1('0xa')](_0x96ad2a)[_0x2ac1('0x1a')](_0x20ef3b);};}exports[_0x2ac1('0x1b')]=function(_0x52f168,_0x4e94cf){var _0x44927f={};var _0x1172bf={'count':0x0,'rows':[]};var _0x51c5e0=_[_0x2ac1('0x1c')](db['OpenchannelQueue']['rawAttributes'],function(_0x222b26){return{'name':_0x222b26[_0x2ac1('0x1d')],'type':_0x222b26[_0x2ac1('0x1e')][_0x2ac1('0x1f')]};});_0x44927f=qs[_0x2ac1('0x20')](_0x51c5e0,_0x52f168);var _0x411db6={'where':_0x44927f['where']};return db[_0x2ac1('0x21')]['count'](_0x411db6)[_0x2ac1('0x14')](function(_0x84aa94){_0x1172bf[_0x2ac1('0x10')]=_0x84aa94;_0x44927f[_0x2ac1('0x22')]=qs[_0x2ac1('0x22')](_0x52f168[_0x2ac1('0x23')]);return db[_0x2ac1('0x21')][_0x2ac1('0x24')](_0x44927f);})['then'](function(_0x9cd847){_0x1172bf['rows']=_0x9cd847;return _0x1172bf;})[_0x2ac1('0x14')](respondWithFilteredResult(_0x4e94cf,_0x44927f))[_0x2ac1('0x25')](handleError(_0x4e94cf,null));};exports[_0x2ac1('0x26')]=function(_0x2b8076,_0x47c94f){var _0x46c338={'raw':!![],'where':{'id':_0x2b8076[_0x2ac1('0x27')]['id']}},_0x24b997={};_0x24b997[_0x2ac1('0x28')]=_[_0x2ac1('0x29')](db['OpenchannelQueue'][_0x2ac1('0x2a')]);_0x24b997[_0x2ac1('0x23')]=_['keys'](_0x2b8076[_0x2ac1('0x23')]);_0x24b997[_0x2ac1('0x2b')]=_[_0x2ac1('0x2c')](_0x24b997[_0x2ac1('0x28')],_0x24b997[_0x2ac1('0x23')]);_0x46c338[_0x2ac1('0x2d')]=_[_0x2ac1('0x2c')](_0x24b997['model'],qs['fields'](_0x2b8076[_0x2ac1('0x23')][_0x2ac1('0x2e')]));_0x46c338[_0x2ac1('0x2d')]=_0x46c338[_0x2ac1('0x2d')][_0x2ac1('0x2f')]?_0x46c338[_0x2ac1('0x2d')]:_0x24b997[_0x2ac1('0x28')];if(_0x2b8076[_0x2ac1('0x23')][_0x2ac1('0x30')]){_0x46c338[_0x2ac1('0x22')]=[{'all':!![]}];}_0x46c338=_[_0x2ac1('0x31')]({},_0x46c338,_0x2b8076[_0x2ac1('0x32')]);return db['OpenchannelQueue'][_0x2ac1('0x33')](_0x46c338)[_0x2ac1('0x14')](handleEntityNotFound(_0x47c94f,null))[_0x2ac1('0x14')](respondWithResult(_0x47c94f,null))[_0x2ac1('0x25')](handleError(_0x47c94f,null));};exports[_0x2ac1('0x34')]=function(_0x4b62d5,_0x5d9c7a){return db[_0x2ac1('0x21')][_0x2ac1('0x34')](_0x4b62d5[_0x2ac1('0x35')],{})[_0x2ac1('0x14')](function(_0x398166){var _0x34583c=_0x4b62d5[_0x2ac1('0x36')][_0x2ac1('0x37')]({'plain':!![]});if(!_0x34583c)throw new Error(_0x2ac1('0x38'));if(_0x34583c['role']===_0x2ac1('0x36')){var _0x163de9=_0x398166[_0x2ac1('0x37')]({'plain':!![]});var _0x2d182a=_0x2ac1('0x16');return db[_0x2ac1('0x39')][_0x2ac1('0x33')]({'where':{'name':_0x2d182a,'userProfileId':_0x34583c[_0x2ac1('0x3a')]},'raw':!![]})[_0x2ac1('0x14')](function(_0x5e509e){if(_0x5e509e&&_0x5e509e['autoAssociation']===0x0){return db[_0x2ac1('0x17')][_0x2ac1('0x34')]({'name':_0x163de9['name'],'resourceId':_0x163de9['id'],'type':_0x5e509e['name'],'sectionId':_0x5e509e['id']},{})['then'](function(){return _0x398166;});}else{return _0x398166;}})[_0x2ac1('0x25')](function(_0x428b06){logger['error'](_0x2ac1('0x3b'),_0x428b06);throw _0x428b06;});}return _0x398166;})[_0x2ac1('0x14')](respondWithResult(_0x5d9c7a,0xc9))[_0x2ac1('0x25')](handleError(_0x5d9c7a,null));};exports[_0x2ac1('0x13')]=function(_0x4ca8e0,_0x212409){if(_0x4ca8e0[_0x2ac1('0x35')]['id']){delete _0x4ca8e0[_0x2ac1('0x35')]['id'];}return db[_0x2ac1('0x21')][_0x2ac1('0x33')]({'where':{'id':_0x4ca8e0[_0x2ac1('0x27')]['id']}})[_0x2ac1('0x14')](handleEntityNotFound(_0x212409,null))[_0x2ac1('0x14')](saveUpdates(_0x4ca8e0['body'],null))['then'](respondWithResult(_0x212409,null))[_0x2ac1('0x25')](handleError(_0x212409,null));};exports[_0x2ac1('0x15')]=function(_0x695f67,_0x2c9f30){return db[_0x2ac1('0x21')]['find']({'where':{'id':_0x695f67[_0x2ac1('0x27')]['id']}})['then'](handleEntityNotFound(_0x2c9f30,null))[_0x2ac1('0x14')](removeEntity(_0x2c9f30,null))[_0x2ac1('0x25')](handleError(_0x2c9f30,null));};exports['describe']=function(_0x2cc94d,_0x5022c8){return db[_0x2ac1('0x21')][_0x2ac1('0x3c')]()['then'](respondWithResult(_0x5022c8,null))[_0x2ac1('0x25')](handleError(_0x5022c8,null));};exports[_0x2ac1('0x3d')]=function(_0x4e3a72,_0x456195){var _0x461ba7={'raw':!![],'where':{}},_0x257ae8={},_0x118c67;return db[_0x2ac1('0x21')][_0x2ac1('0x3e')]({'where':{'id':_0x4e3a72[_0x2ac1('0x27')]['id']}})['then'](handleEntityNotFound(_0x456195,null))[_0x2ac1('0x14')](function(_0x4beb92){if(_0x4beb92){_0x118c67=_0x4beb92[_0x2ac1('0x37')]({'plain':!![]});_0x257ae8['model']=_['keys'](db[_0x2ac1('0x3f')]['rawAttributes']);_0x257ae8[_0x2ac1('0x23')]=_['keys'](_0x4e3a72[_0x2ac1('0x23')]);_0x257ae8[_0x2ac1('0x2b')]=_[_0x2ac1('0x2c')](_0x257ae8[_0x2ac1('0x28')],_0x257ae8[_0x2ac1('0x23')]);_0x461ba7[_0x2ac1('0x2d')]=_['intersection'](_0x257ae8[_0x2ac1('0x28')],qs[_0x2ac1('0x2e')](_0x4e3a72[_0x2ac1('0x23')][_0x2ac1('0x2e')]));_0x461ba7[_0x2ac1('0x2d')]=_0x461ba7[_0x2ac1('0x2d')]['length']?_0x461ba7[_0x2ac1('0x2d')]:_0x257ae8[_0x2ac1('0x28')];if(!_0x4e3a72['query'][_0x2ac1('0x40')](_0x2ac1('0x41'))){_0x461ba7[_0x2ac1('0xf')]=qs[_0x2ac1('0xf')](_0x4e3a72[_0x2ac1('0x23')]['limit']);_0x461ba7['offset']=qs[_0x2ac1('0xd')](_0x4e3a72['query'][_0x2ac1('0xd')]);}_0x461ba7[_0x2ac1('0x42')]=qs[_0x2ac1('0x43')](_0x4e3a72['query'][_0x2ac1('0x43')]);_0x461ba7['where']=qs[_0x2ac1('0x2b')](_['pick'](_0x4e3a72['query'],_0x257ae8['filters']));_0x461ba7['where'][_0x2ac1('0x44')]=_0x4beb92['id'];if(_0x4e3a72['query']['filter']){_0x461ba7[_0x2ac1('0x45')]=_['merge'](_0x461ba7[_0x2ac1('0x45')],{'$or':_[_0x2ac1('0x1c')](_0x461ba7[_0x2ac1('0x2d')],function(_0x38daef){var _0x3acbcd={};_0x3acbcd[_0x38daef]={'$like':'%'+_0x4e3a72[_0x2ac1('0x23')][_0x2ac1('0x46')]+'%'};return _0x3acbcd;})});}_0x461ba7=_[_0x2ac1('0x31')]({},_0x461ba7,_0x4e3a72[_0x2ac1('0x32')]);return db[_0x2ac1('0x3f')][_0x2ac1('0x24')](_0x461ba7);}})[_0x2ac1('0x14')](function(_0x28cd66){if(_0x28cd66){return db[_0x2ac1('0x47')][_0x2ac1('0x48')]({'where':{'id':_['map'](_0x28cd66,_0x2ac1('0x49')),'role':'agent'},'attributes':['id','name','openchannelPause','updatedAt',_0x2ac1('0x4a')]});}})[_0x2ac1('0x14')](function(_0x109270){if(_0x109270){return{'count':_0x109270[_0x2ac1('0x10')],'rows':_[_0x2ac1('0x1c')](_0x109270[_0x2ac1('0x4b')],function(_0x1c6b34){return{'membername':_0x1c6b34[_0x2ac1('0x19')],'UserId':_0x1c6b34['id'],'queue_name':_0x118c67['name'],'OpenchannelQueueId':_0x118c67['id'],'interface':util[_0x2ac1('0x4c')](_0x2ac1('0x4d'),_0x2ac1('0x4e'),_0x1c6b34['name']),'penalty':0x0,'paused':_0x1c6b34['openchannelPause'],'createdAt':_0x1c6b34[_0x2ac1('0x4a')],'updatedAt':_0x1c6b34['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x456195,_0x461ba7))['catch'](handleError(_0x456195,null));};exports[_0x2ac1('0x4f')]=function(_0x3092fc,_0x43bd5f){var _0x5a0709={};var _0x15c731={};var _0x2eb581;var _0x5d2fae;return db[_0x2ac1('0x21')][_0x2ac1('0x3e')]({'where':{'id':_0x3092fc['params']['id']}})[_0x2ac1('0x14')](handleEntityNotFound(_0x43bd5f,null))['then'](function(_0xab4885){if(_0xab4885){_0x2eb581=_0xab4885;_0x15c731[_0x2ac1('0x28')]=_[_0x2ac1('0x29')](db[_0x2ac1('0x50')]['rawAttributes']);_0x15c731[_0x2ac1('0x23')]=_[_0x2ac1('0x29')](_0x3092fc[_0x2ac1('0x23')]);_0x15c731[_0x2ac1('0x2b')]=_['intersection'](_0x15c731[_0x2ac1('0x28')],_0x15c731['query']);_0x5a0709[_0x2ac1('0x2d')]=_[_0x2ac1('0x2c')](_0x15c731[_0x2ac1('0x28')],qs[_0x2ac1('0x2e')](_0x3092fc[_0x2ac1('0x23')][_0x2ac1('0x2e')]));_0x5a0709[_0x2ac1('0x2d')]=_0x5a0709[_0x2ac1('0x2d')][_0x2ac1('0x2f')]?_0x5a0709[_0x2ac1('0x2d')]:_0x15c731[_0x2ac1('0x28')];_0x5a0709['order']=qs[_0x2ac1('0x43')](_0x3092fc[_0x2ac1('0x23')]['sort']);_0x5a0709[_0x2ac1('0x45')]=qs[_0x2ac1('0x2b')](_[_0x2ac1('0x51')](_0x3092fc[_0x2ac1('0x23')],_0x15c731['filters']));if(_0x3092fc['query'][_0x2ac1('0x46')]){_0x5a0709[_0x2ac1('0x45')]=_[_0x2ac1('0x31')](_0x5a0709['where'],{'$or':_['map'](_0x5a0709['attributes'],function(_0xcea8df){var _0x3623fa={};_0x3623fa[_0xcea8df]={'$like':'%'+_0x3092fc['query'][_0x2ac1('0x46')]+'%'};return _0x3623fa;})});}_0x5a0709=_[_0x2ac1('0x31')]({},_0x5a0709,_0x3092fc[_0x2ac1('0x32')]);return _0x2eb581[_0x2ac1('0x4f')](_0x5a0709);}})[_0x2ac1('0x14')](function(_0x2b54df){if(_0x2b54df){_0x5d2fae=_0x2b54df[_0x2ac1('0x2f')];if(!_0x3092fc[_0x2ac1('0x23')]['hasOwnProperty'](_0x2ac1('0x41'))){_0x5a0709['limit']=qs[_0x2ac1('0xf')](_0x3092fc['query'][_0x2ac1('0xf')]);_0x5a0709[_0x2ac1('0xd')]=qs[_0x2ac1('0xd')](_0x3092fc[_0x2ac1('0x23')][_0x2ac1('0xd')]);}return _0x2eb581[_0x2ac1('0x4f')](_0x5a0709);}})[_0x2ac1('0x14')](function(_0x1d307e){if(_0x1d307e){return _0x1d307e?{'count':_0x5d2fae,'rows':_0x1d307e}:null;}})[_0x2ac1('0x14')](respondWithResult(_0x43bd5f,null))[_0x2ac1('0x25')](handleError(_0x43bd5f,null));};exports[_0x2ac1('0x52')]=function(_0x10a29e,_0x11a295){var _0xa7b2ab=_0x10a29e['body'][_0x2ac1('0x53')];return db[_0x2ac1('0x50')][_0x2ac1('0x24')]({'where':{'id':_0xa7b2ab},'attributes':['id'],'include':[{'model':db[_0x2ac1('0x47')],'as':_0x2ac1('0x54'),'attributes':['id',_0x2ac1('0x19'),_0x2ac1('0x55'),_0x2ac1('0x56'),_0x2ac1('0x57')],'raw':!![]}]})[_0x2ac1('0x14')](function(_0x369d93){if(_0x369d93){var _0x3470d7=_['flatMap'](_0x369d93,function(_0x46bc13){var _0x3e550a=_0x46bc13[_0x2ac1('0x37')]({'plain':!![]});return _0x3e550a[_0x2ac1('0x54')];});return db[_0x2ac1('0x21')][_0x2ac1('0x33')]({'where':{'id':_0x10a29e[_0x2ac1('0x27')]['id']}})[_0x2ac1('0x14')](function(_0x27cb6f){return db[_0x2ac1('0x58')][_0x2ac1('0x59')](function(_0xa590){return _0x27cb6f[_0x2ac1('0x52')](_0xa7b2ab,{'transaction':_0xa590})[_0x2ac1('0x14')](function(){return BPromise[_0x2ac1('0x5a')](_0x3470d7,function(_0x17dc35){return db['UserOpenchannelQueue'][_0x2ac1('0x5b')]({'where':{'UserId':_0x17dc35['id'],'OpenchannelQueueId':_0x10a29e['params']['id']},'transaction':_0xa590});});})[_0x2ac1('0x14')](function(){_0x3470d7[_0x2ac1('0x5c')](function(_0x186227){socket[_0x2ac1('0x5d')]('userOpenchannelQueue:save',{'UserId':_0x186227['id'],'OpenchannelQueueId':_0x27cb6f['id']});});});});});}})[_0x2ac1('0x14')](respondWithStatusCode(_0x11a295,null))[_0x2ac1('0x25')](handleError(_0x11a295,null));};exports[_0x2ac1('0x5e')]=function(_0x1b3123,_0x21a84c){return db['Team'][_0x2ac1('0x24')]({'where':{'id':_0x1b3123['query'][_0x2ac1('0x53')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2ac1('0x54'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x21a84c,null))[_0x2ac1('0x14')](function(_0x2d4877){var _0x92651b=_[_0x2ac1('0x1c')](_0x2d4877,'id');var _0xbfa9db=[];var _0x5f0998=[];var _0x5ee4ff=squel['select']();_0x5ee4ff['field'](_0x2ac1('0x5f'))[_0x2ac1('0x60')](_0x2ac1('0x61'),'tq')[_0x2ac1('0x62')]('user_has_teams','ut',_0x2ac1('0x63'))[_0x2ac1('0x45')](_0x2ac1('0x64'),_0x1b3123[_0x2ac1('0x27')]['id']);for(var _0x173f27=0x0;_0x173f27<_0x2d4877[_0x2ac1('0x2f')];_0x173f27+=0x1){let _0x588e9e=_0x2d4877[_0x173f27];for(var _0x234de8=0x0;_0x234de8<_0x588e9e[_0x2ac1('0x54')][_0x2ac1('0x2f')];_0x234de8+=0x1){let _0x1c2345=_0x588e9e[_0x2ac1('0x54')][_0x234de8];var _0x31d158=_0x5ee4ff[_0x2ac1('0x65')]();_0x31d158[_0x2ac1('0x45')](_0x2ac1('0x66'),_0x1c2345['id']);_0x5f0998[_0x2ac1('0x67')](db[_0x2ac1('0x58')][_0x2ac1('0x23')](_0x31d158[_0x2ac1('0x68')](),{'type':db[_0x2ac1('0x58')]['QueryTypes']['SELECT']})['then'](function(_0x4bddb4){if(_0x4bddb4[_0x2ac1('0x2f')]===0x1){return _0x1c2345['id'];}else{var _0x30940a=_[_0x2ac1('0x69')](_[_0x2ac1('0x1c')](_0x4bddb4,_0x2ac1('0x6a')),function(_0x434ddc){return _[_0x2ac1('0x6b')](_0x92651b,_0x434ddc);});if(_0x30940a){return _0x1c2345['id'];}}}));}}return BPromise['all'](_0x5f0998)[_0x2ac1('0x14')](function(_0x3854de){_0xbfa9db=_(_0xbfa9db)[_0x2ac1('0x6c')](_0x3854de)[_0x2ac1('0x6d')]()[_0x2ac1('0x6e')]();return db['OpenchannelQueue'][_0x2ac1('0x33')]({'where':{'id':_0x1b3123[_0x2ac1('0x27')]['id']}})[_0x2ac1('0x14')](function(_0x4ae7e1){return db[_0x2ac1('0x58')][_0x2ac1('0x59')](function(_0x335599){return _0x4ae7e1[_0x2ac1('0x5e')](_0x1b3123[_0x2ac1('0x23')][_0x2ac1('0x53')],{'transaction':_0x335599})[_0x2ac1('0x14')](function(){if(!_[_0x2ac1('0x6f')](_0xbfa9db)){return _0x4ae7e1[_0x2ac1('0x70')](_0xbfa9db,{'transaction':_0x335599});}})[_0x2ac1('0x14')](function(){_0xbfa9db[_0x2ac1('0x5c')](function(_0x4dee56){socket['emit'](_0x2ac1('0x71'),{'UserId':_0x4dee56,'OpenchannelQueueId':_0x4ae7e1['id']});});});});});});})['then'](respondWithStatusCode(_0x21a84c,null))[_0x2ac1('0x25')](handleError(_0x21a84c,null));};exports[_0x2ac1('0x72')]=function(_0xbc504b,_0x383930){return db['OpenchannelQueue'][_0x2ac1('0x33')]({'where':{'id':_0xbc504b[_0x2ac1('0x27')]['id']}})[_0x2ac1('0x14')](handleEntityNotFound(_0x383930,null))[_0x2ac1('0x14')](function(_0x7e9be5){if(_0x7e9be5){return _0x7e9be5[_0x2ac1('0x72')](_0xbc504b[_0x2ac1('0x35')]['ids'],_[_0x2ac1('0x73')](_0xbc504b[_0x2ac1('0x35')],[_0x2ac1('0x53'),'id'])||{})[_0x2ac1('0x74')](function(_0x4f0a5b){for(var _0x384688=0x0;_0x384688<_0xbc504b[_0x2ac1('0x35')][_0x2ac1('0x53')][_0x2ac1('0x2f')];_0x384688+=0x1){socket[_0x2ac1('0x5d')](_0x2ac1('0x75'),{'UserId':Number(_0xbc504b[_0x2ac1('0x35')][_0x2ac1('0x53')][_0x384688]),'OpenchannelQueueId':Number(_0xbc504b[_0x2ac1('0x27')]['id'])});}return _0x4f0a5b;});}})[_0x2ac1('0x14')](respondWithResult(_0x383930,null))['catch'](handleError(_0x383930,null));};exports[_0x2ac1('0x70')]=function(_0x343e6,_0x5a6a2b){return db[_0x2ac1('0x21')]['find']({'where':{'id':_0x343e6[_0x2ac1('0x27')]['id']}})[_0x2ac1('0x14')](handleEntityNotFound(_0x5a6a2b,null))['then'](function(_0x3967b4){if(_0x3967b4){return _0x3967b4['removeAgents'](_0x343e6[_0x2ac1('0x23')]['ids'])[_0x2ac1('0x14')](function(){if(_[_0x2ac1('0x76')](_0x343e6['query']['ids'])){for(var _0x2e12ec=0x0;_0x2e12ec<_0x343e6[_0x2ac1('0x23')][_0x2ac1('0x53')][_0x2ac1('0x2f')];_0x2e12ec+=0x1){socket[_0x2ac1('0x5d')]('userOpenchannelQueue:remove',{'UserId':Number(_0x343e6[_0x2ac1('0x23')][_0x2ac1('0x53')][_0x2e12ec]),'OpenchannelQueueId':Number(_0x343e6[_0x2ac1('0x27')]['id'])});}}else{socket[_0x2ac1('0x5d')](_0x2ac1('0x71'),{'UserId':Number(_0x343e6[_0x2ac1('0x23')][_0x2ac1('0x53')]),'OpenchannelQueueId':Number(_0x343e6['params']['id'])});}});}})[_0x2ac1('0x14')](respondWithStatusCode(_0x5a6a2b,null))['catch'](handleError(_0x5a6a2b,null));};exports[_0x2ac1('0x77')]=function(_0x570159,_0x2bda7f){var _0x34d70f={};var _0x2b0932={};var _0x3ee955;var _0x19c314;return db[_0x2ac1('0x21')][_0x2ac1('0x3e')]({'where':{'id':_0x570159[_0x2ac1('0x27')]['id']}})[_0x2ac1('0x14')](handleEntityNotFound(_0x2bda7f,null))[_0x2ac1('0x14')](function(_0x34e7d4){if(_0x34e7d4){_0x3ee955=_0x34e7d4;_0x2b0932['model']=_[_0x2ac1('0x29')](db[_0x2ac1('0x47')]['rawAttributes']);_0x2b0932['query']=_[_0x2ac1('0x29')](_0x570159[_0x2ac1('0x23')]);_0x2b0932[_0x2ac1('0x2b')]=_[_0x2ac1('0x2c')](_0x2b0932['model'],_0x2b0932[_0x2ac1('0x23')]);_0x34d70f[_0x2ac1('0x2d')]=_[_0x2ac1('0x2c')](_0x2b0932[_0x2ac1('0x28')],qs[_0x2ac1('0x2e')](_0x570159['query'][_0x2ac1('0x2e')]));_0x34d70f[_0x2ac1('0x2d')]=_0x34d70f[_0x2ac1('0x2d')][_0x2ac1('0x2f')]?_0x34d70f[_0x2ac1('0x2d')]:_0x2b0932['model'];_0x34d70f['order']=qs[_0x2ac1('0x43')](_0x570159[_0x2ac1('0x23')][_0x2ac1('0x43')]);_0x34d70f['where']=qs['filters'](_['pick'](_0x570159[_0x2ac1('0x23')],_0x2b0932['filters']));if(_0x570159[_0x2ac1('0x23')]['filter']){_0x34d70f[_0x2ac1('0x45')]=_['merge'](_0x34d70f[_0x2ac1('0x45')],{'$or':_[_0x2ac1('0x1c')](_0x34d70f[_0x2ac1('0x2d')],function(_0x175260){var _0x503dba={};_0x503dba[_0x175260]={'$like':'%'+_0x570159[_0x2ac1('0x23')]['filter']+'%'};return _0x503dba;})});}_0x34d70f=_[_0x2ac1('0x31')]({},_0x34d70f,_0x570159[_0x2ac1('0x32')]);return _0x3ee955['getAgents'](_0x34d70f);}})[_0x2ac1('0x14')](function(_0x90268b){if(_0x90268b){_0x19c314=_0x90268b[_0x2ac1('0x2f')];if(!_0x570159['query']['hasOwnProperty'](_0x2ac1('0x41'))){_0x34d70f[_0x2ac1('0xf')]=qs[_0x2ac1('0xf')](_0x570159[_0x2ac1('0x23')][_0x2ac1('0xf')]);_0x34d70f['offset']=qs[_0x2ac1('0xd')](_0x570159[_0x2ac1('0x23')][_0x2ac1('0xd')]);}return _0x3ee955[_0x2ac1('0x77')](_0x34d70f);}})[_0x2ac1('0x14')](function(_0x4f9de5){if(_0x4f9de5){return _0x4f9de5?{'count':_0x19c314,'rows':_0x4f9de5}:null;}})[_0x2ac1('0x14')](respondWithResult(_0x2bda7f,null))[_0x2ac1('0x25')](handleError(_0x2bda7f,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 457a4d6..45e5345 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 _0x1575=['save','update','remove','emit','hasOwnProperty','hook','exports','events','OpenchannelQueue','setMaxListeners'];(function(_0x2fc676,_0x4b50d1){var _0x41c442=function(_0x4c5073){while(--_0x4c5073){_0x2fc676['push'](_0x2fc676['shift']());}};_0x41c442(++_0x4b50d1);}(_0x1575,0x1f1));var _0x5157=function(_0x3f0bd7,_0x16284c){_0x3f0bd7=_0x3f0bd7-0x0;var _0x1cbb2f=_0x1575[_0x3f0bd7];return _0x1cbb2f;};'use strict';var EventEmitter=require(_0x5157('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x5157('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x5157('0x2')](0x0);var events={'afterCreate':_0x5157('0x3'),'afterUpdate':_0x5157('0x4'),'afterDestroy':_0x5157('0x5')};function emitEvent(_0x4a9712){return function(_0x592677,_0x1e83ff,_0x2a4b88){OpenchannelQueueEvents[_0x5157('0x6')](_0x4a9712+':'+_0x592677['id'],_0x592677);OpenchannelQueueEvents[_0x5157('0x6')](_0x4a9712,_0x592677);_0x2a4b88(null);};}for(var e in events){if(events[_0x5157('0x7')](e)){var event=events[e];OpenchannelQueue[_0x5157('0x8')](e,emitEvent(event));}}module[_0x5157('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xa76e=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','save','update','remove'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa76e,0x180));var _0xea76=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0xa76e[_0x454018];return _0x24697d;};'use strict';var EventEmitter=require(_0xea76('0x0'));var OpenchannelQueue=require(_0xea76('0x1'))['db'][_0xea76('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xea76('0x3'),'afterUpdate':_0xea76('0x4'),'afterDestroy':_0xea76('0x5')};function emitEvent(_0x40118c){return function(_0x214177,_0x364cbb,_0x4f9e3b){OpenchannelQueueEvents['emit'](_0x40118c+':'+_0x214177['id'],_0x214177);OpenchannelQueueEvents[_0xea76('0x6')](_0x40118c,_0x214177);_0x4f9e3b(null);};}for(var e in events){if(events[_0xea76('0x7')](e)){var event=events[e];OpenchannelQueue[_0xea76('0x8')](e,emitEvent(event));}}module[_0xea76('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 835e5e9..e30f7a3 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 _0x8e6b=['exports','define','OpenchannelQueue','openchannel_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes'];(function(_0x366f3f,_0xea4d85){var _0x5148bd=function(_0xa99207){while(--_0xa99207){_0x366f3f['push'](_0x366f3f['shift']());}};_0x5148bd(++_0xea4d85);}(_0x8e6b,0x115));var _0xb8e6=function(_0x514e04,_0x34e7f3){_0x514e04=_0x514e04-0x0;var _0x148bed=_0x8e6b[_0x514e04];return _0x148bed;};'use strict';var _=require('lodash');var util=require(_0xb8e6('0x0'));var logger=require(_0xb8e6('0x1'))(_0xb8e6('0x2'));var moment=require(_0xb8e6('0x3'));var BPromise=require('bluebird');var rp=require(_0xb8e6('0x4'));var fs=require('fs');var path=require(_0xb8e6('0x5'));var rimraf=require(_0xb8e6('0x6'));var config=require(_0xb8e6('0x7'));var attributes=require(_0xb8e6('0x8'));module[_0xb8e6('0x9')]=function(_0x452beb,_0xfcdd9f){return _0x452beb[_0xb8e6('0xa')](_0xb8e6('0xb'),attributes,{'tableName':_0xb8e6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d80=['moment','bluebird','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports','OpenchannelQueue','openchannel_queues','lodash','../../config/logger'];(function(_0x55cc58,_0x5ce0af){var _0x26062e=function(_0x59e29d){while(--_0x59e29d){_0x55cc58['push'](_0x55cc58['shift']());}};_0x26062e(++_0x5ce0af);}(_0x7d80,0x17f));var _0x07d8=function(_0x489b2a,_0xf9db5){_0x489b2a=_0x489b2a-0x0;var _0xf3a6ae=_0x7d80[_0x489b2a];return _0xf3a6ae;};'use strict';var _=require(_0x07d8('0x0'));var util=require('util');var logger=require(_0x07d8('0x1'))('api');var moment=require(_0x07d8('0x2'));var BPromise=require(_0x07d8('0x3'));var rp=require(_0x07d8('0x4'));var fs=require('fs');var path=require(_0x07d8('0x5'));var rimraf=require('rimraf');var config=require(_0x07d8('0x6'));var attributes=require(_0x07d8('0x7'));module[_0x07d8('0x8')]=function(_0xc22002,_0xb137){return _0xc22002['define'](_0x07d8('0x9'),attributes,{'tableName':_0x07d8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 801749e..f4a1159 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 _0x6f03=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','register','request','then','OpenchannelQueue,\x20%s,\x20%s','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelQueue','options','where','attributes','limit','include','map','model','GetOpenchannelQueue','find','debug','ShowOpenchannelQueue'];(function(_0x193116,_0x2cf50b){var _0x2b6421=function(_0x5b97fd){while(--_0x5b97fd){_0x193116['push'](_0x193116['shift']());}};_0x2b6421(++_0x2cf50b);}(_0x6f03,0x17c));var _0x36f0=function(_0x46adce,_0x14c0d4){_0x46adce=_0x46adce-0x0;var _0x122d13=_0x6f03[_0x46adce];return _0x122d13;};'use strict';var _=require(_0x36f0('0x0'));var util=require(_0x36f0('0x1'));var moment=require(_0x36f0('0x2'));var BPromise=require(_0x36f0('0x3'));var rs=require(_0x36f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x36f0('0x5'))['db'];var utils=require(_0x36f0('0x6'));var logger=require(_0x36f0('0x7'))(_0x36f0('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x36f0('0x9')][_0x36f0('0xa')]({'port':0x232a});config[_0x36f0('0xb')]=_['defaults'](config[_0x36f0('0xb')],{'host':_0x36f0('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x36f0('0xb')]));require('./openchannelQueue.socket')[_0x36f0('0xd')](socket);function respondWithRpcPromise(_0x15f334,_0x3b2648,_0x59088c){return new BPromise(function(_0x5c976b,_0x9abccd){return client[_0x36f0('0xe')](_0x15f334,_0x59088c)[_0x36f0('0xf')](function(_0x4eb0b8){logger['info'](_0x36f0('0x10'),_0x3b2648,'request\x20sent');logger['debug'](_0x36f0('0x11'),_0x3b2648,_0x36f0('0x12'),JSON[_0x36f0('0x13')](_0x4eb0b8));if(_0x4eb0b8[_0x36f0('0x14')]){if(_0x4eb0b8[_0x36f0('0x14')][_0x36f0('0x15')]===0x1f4){logger[_0x36f0('0x14')](_0x36f0('0x10'),_0x3b2648,_0x4eb0b8['error'][_0x36f0('0x16')]);return _0x9abccd(_0x4eb0b8[_0x36f0('0x14')][_0x36f0('0x16')]);}logger[_0x36f0('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x3b2648,_0x4eb0b8[_0x36f0('0x14')][_0x36f0('0x16')]);return _0x5c976b(_0x4eb0b8[_0x36f0('0x14')][_0x36f0('0x16')]);}else{logger[_0x36f0('0x17')](_0x36f0('0x10'),_0x3b2648,'request\x20sent');_0x5c976b(_0x4eb0b8[_0x36f0('0x18')]['message']);}})[_0x36f0('0x19')](function(_0x4e99fa){logger[_0x36f0('0x14')](_0x36f0('0x10'),_0x3b2648,_0x4e99fa);_0x9abccd(_0x4e99fa);});});}exports['GetOpenchannelQueue']=function(_0x4606f4){var _0x4a1950=this;return new Promise(function(_0x3e23e8,_0x8de06c){return db[_0x36f0('0x1a')]['findAll']({'raw':_0x4606f4['options']?_0x4606f4[_0x36f0('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4606f4['options']?_0x4606f4[_0x36f0('0x1b')][_0x36f0('0x1c')]||null:null,'attributes':_0x4606f4[_0x36f0('0x1b')]?_0x4606f4[_0x36f0('0x1b')][_0x36f0('0x1d')]||null:null,'limit':_0x4606f4[_0x36f0('0x1b')]?_0x4606f4[_0x36f0('0x1b')][_0x36f0('0x1e')]||null:null,'include':_0x4606f4[_0x36f0('0x1b')]?_0x4606f4[_0x36f0('0x1b')][_0x36f0('0x1f')]?_[_0x36f0('0x20')](_0x4606f4[_0x36f0('0x1b')][_0x36f0('0x1f')],function(_0x4e31db){return{'model':db[_0x4e31db[_0x36f0('0x21')]],'as':_0x4e31db['as'],'attributes':_0x4e31db[_0x36f0('0x1d')],'include':_0x4e31db['include']?_['map'](_0x4e31db[_0x36f0('0x1f')],function(_0x577163){return{'model':db[_0x577163[_0x36f0('0x21')]],'as':_0x577163['as'],'attributes':_0x577163[_0x36f0('0x1d')],'include':_0x577163[_0x36f0('0x1f')]?_[_0x36f0('0x20')](_0x577163['include'],function(_0xfd1476){return{'model':db[_0xfd1476[_0x36f0('0x21')]],'as':_0xfd1476['as'],'attributes':_0xfd1476[_0x36f0('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x6f4651){logger['info']('GetOpenchannelQueue',_0x4606f4);logger['debug'](_0x36f0('0x22'),_0x4606f4,JSON[_0x36f0('0x13')](_0x6f4651));_0x3e23e8(_0x6f4651);})['catch'](function(_0xbf316e){logger[_0x36f0('0x14')]('GetOpenchannelQueue',_0xbf316e['message'],_0x4606f4);_0x8de06c(_0x4a1950[_0x36f0('0x14')](0x1f4,_0xbf316e[_0x36f0('0x16')]));});});};exports['ShowOpenchannelQueue']=function(_0x230b09){var _0x2fb85d=this;return new Promise(function(_0x495431,_0x3b181d){return db[_0x36f0('0x1a')][_0x36f0('0x23')]({'raw':_0x230b09[_0x36f0('0x1b')]?_0x230b09[_0x36f0('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x230b09[_0x36f0('0x1b')]?_0x230b09[_0x36f0('0x1b')][_0x36f0('0x1c')]||null:null,'attributes':_0x230b09[_0x36f0('0x1b')]?_0x230b09[_0x36f0('0x1b')][_0x36f0('0x1d')]||null:null,'include':_0x230b09[_0x36f0('0x1b')]?_0x230b09['options'][_0x36f0('0x1f')]?_['map'](_0x230b09['options'][_0x36f0('0x1f')],function(_0x28f16f){return{'model':db[_0x28f16f['model']],'as':_0x28f16f['as'],'attributes':_0x28f16f[_0x36f0('0x1d')],'include':_0x28f16f['include']?_['map'](_0x28f16f[_0x36f0('0x1f')],function(_0x565da0){return{'model':db[_0x565da0[_0x36f0('0x21')]],'as':_0x565da0['as'],'attributes':_0x565da0[_0x36f0('0x1d')],'include':_0x565da0[_0x36f0('0x1f')]?_[_0x36f0('0x20')](_0x565da0[_0x36f0('0x1f')],function(_0x452e45){return{'model':db[_0x452e45[_0x36f0('0x21')]],'as':_0x452e45['as'],'attributes':_0x452e45[_0x36f0('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa5e52f){logger[_0x36f0('0x17')]('ShowOpenchannelQueue',_0x230b09);logger[_0x36f0('0x24')](_0x36f0('0x25'),_0x230b09,JSON[_0x36f0('0x13')](_0xa5e52f));_0x495431(_0xa5e52f);})[_0x36f0('0x19')](function(_0x534e58){logger['error'](_0x36f0('0x25'),_0x534e58[_0x36f0('0x16')],_0x230b09);_0x3b181d(_0x2fb85d[_0x36f0('0x14')](0x1f4,_0x534e58[_0x36f0('0x16')]));});});}; \ No newline at end of file +var _0x1d04=['where','limit','include','model','attributes','map','ShowOpenchannelQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./openchannelQueue.socket','register','then','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options'];(function(_0x1a84b1,_0x3ca6d8){var _0x161938=function(_0x44e888){while(--_0x44e888){_0x1a84b1['push'](_0x1a84b1['shift']());}};_0x161938(++_0x3ca6d8);}(_0x1d04,0xfe));var _0x41d0=function(_0x2c90c1,_0x446eda){_0x2c90c1=_0x2c90c1-0x0;var _0xcb55d4=_0x1d04[_0x2c90c1];return _0xcb55d4;};'use strict';var _=require(_0x41d0('0x0'));var util=require('util');var moment=require(_0x41d0('0x1'));var BPromise=require(_0x41d0('0x2'));var rs=require(_0x41d0('0x3'));var fs=require('fs');var Redis=require(_0x41d0('0x4'));var db=require(_0x41d0('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x41d0('0x6'));var config=require(_0x41d0('0x7'));var jayson=require(_0x41d0('0x8'));var client=jayson[_0x41d0('0x9')][_0x41d0('0xa')]({'port':0x232a});config['redis']=_[_0x41d0('0xb')](config['redis'],{'host':_0x41d0('0xc'),'port':0x18eb});var socket=require(_0x41d0('0xd'))(new Redis(config[_0x41d0('0xe')]));require(_0x41d0('0xf'))[_0x41d0('0x10')](socket);function respondWithRpcPromise(_0x1119e9,_0x506084,_0x4ccf0a){return new BPromise(function(_0x5e9128,_0x1b916a){return client['request'](_0x1119e9,_0x4ccf0a)[_0x41d0('0x11')](function(_0x454afc){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x506084,_0x41d0('0x12'));logger[_0x41d0('0x13')](_0x41d0('0x14'),_0x506084,_0x41d0('0x12'),JSON[_0x41d0('0x15')](_0x454afc));if(_0x454afc[_0x41d0('0x16')]){if(_0x454afc[_0x41d0('0x16')][_0x41d0('0x17')]===0x1f4){logger[_0x41d0('0x16')](_0x41d0('0x18'),_0x506084,_0x454afc[_0x41d0('0x16')]['message']);return _0x1b916a(_0x454afc[_0x41d0('0x16')][_0x41d0('0x19')]);}logger[_0x41d0('0x16')](_0x41d0('0x18'),_0x506084,_0x454afc['error'][_0x41d0('0x19')]);return _0x5e9128(_0x454afc[_0x41d0('0x16')]['message']);}else{logger[_0x41d0('0x1a')](_0x41d0('0x18'),_0x506084,_0x41d0('0x12'));_0x5e9128(_0x454afc[_0x41d0('0x1b')][_0x41d0('0x19')]);}})[_0x41d0('0x1c')](function(_0x3ae575){logger[_0x41d0('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x506084,_0x3ae575);_0x1b916a(_0x3ae575);});});}exports[_0x41d0('0x1d')]=function(_0x277cd6){var _0x1bcd92=this;return new Promise(function(_0x32e9f5,_0x34a31d){return db[_0x41d0('0x1e')][_0x41d0('0x1f')]({'raw':_0x277cd6[_0x41d0('0x20')]?_0x277cd6[_0x41d0('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x277cd6[_0x41d0('0x20')]?_0x277cd6[_0x41d0('0x20')][_0x41d0('0x21')]||null:null,'attributes':_0x277cd6[_0x41d0('0x20')]?_0x277cd6[_0x41d0('0x20')]['attributes']||null:null,'limit':_0x277cd6[_0x41d0('0x20')]?_0x277cd6[_0x41d0('0x20')][_0x41d0('0x22')]||null:null,'include':_0x277cd6['options']?_0x277cd6['options']['include']?_['map'](_0x277cd6['options'][_0x41d0('0x23')],function(_0x4e9991){return{'model':db[_0x4e9991[_0x41d0('0x24')]],'as':_0x4e9991['as'],'attributes':_0x4e9991[_0x41d0('0x25')],'include':_0x4e9991['include']?_[_0x41d0('0x26')](_0x4e9991['include'],function(_0x285564){return{'model':db[_0x285564['model']],'as':_0x285564['as'],'attributes':_0x285564[_0x41d0('0x25')],'include':_0x285564[_0x41d0('0x23')]?_[_0x41d0('0x26')](_0x285564[_0x41d0('0x23')],function(_0x257e7c){return{'model':db[_0x257e7c['model']],'as':_0x257e7c['as'],'attributes':_0x257e7c['attributes']};}):[]};}):[]};}):[]:[]})[_0x41d0('0x11')](function(_0x573077){logger[_0x41d0('0x1a')](_0x41d0('0x1d'),_0x277cd6);logger[_0x41d0('0x13')](_0x41d0('0x1d'),_0x277cd6,JSON[_0x41d0('0x15')](_0x573077));_0x32e9f5(_0x573077);})[_0x41d0('0x1c')](function(_0x396559){logger[_0x41d0('0x16')](_0x41d0('0x1d'),_0x396559[_0x41d0('0x19')],_0x277cd6);_0x34a31d(_0x1bcd92['error'](0x1f4,_0x396559[_0x41d0('0x19')]));});});};exports[_0x41d0('0x27')]=function(_0xcb19d2){var _0x3b36ab=this;return new Promise(function(_0x250499,_0x5ca06d){return db[_0x41d0('0x1e')][_0x41d0('0x28')]({'raw':_0xcb19d2[_0x41d0('0x20')]?_0xcb19d2['options']['raw']===undefined?!![]:![]:!![],'where':_0xcb19d2[_0x41d0('0x20')]?_0xcb19d2[_0x41d0('0x20')][_0x41d0('0x21')]||null:null,'attributes':_0xcb19d2[_0x41d0('0x20')]?_0xcb19d2['options'][_0x41d0('0x25')]||null:null,'include':_0xcb19d2[_0x41d0('0x20')]?_0xcb19d2[_0x41d0('0x20')][_0x41d0('0x23')]?_[_0x41d0('0x26')](_0xcb19d2[_0x41d0('0x20')]['include'],function(_0x481c61){return{'model':db[_0x481c61[_0x41d0('0x24')]],'as':_0x481c61['as'],'attributes':_0x481c61[_0x41d0('0x25')],'include':_0x481c61['include']?_['map'](_0x481c61[_0x41d0('0x23')],function(_0x118e58){return{'model':db[_0x118e58['model']],'as':_0x118e58['as'],'attributes':_0x118e58[_0x41d0('0x25')],'include':_0x118e58['include']?_[_0x41d0('0x26')](_0x118e58['include'],function(_0x32d7a4){return{'model':db[_0x32d7a4[_0x41d0('0x24')]],'as':_0x32d7a4['as'],'attributes':_0x32d7a4[_0x41d0('0x25')]};}):[]};}):[]};}):[]:[]})[_0x41d0('0x11')](function(_0xfbfaf7){logger[_0x41d0('0x1a')](_0x41d0('0x27'),_0xcb19d2);logger[_0x41d0('0x13')](_0x41d0('0x27'),_0xcb19d2,JSON['stringify'](_0xfbfaf7));_0x250499(_0xfbfaf7);})[_0x41d0('0x1c')](function(_0x34c03a){logger[_0x41d0('0x16')]('ShowOpenchannelQueue',_0x34c03a[_0x41d0('0x19')],_0xcb19d2);_0x5ca06d(_0x3b36ab[_0x41d0('0x16')](0x1f4,_0x34c03a[_0x41d0('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index c3af677..2542045 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 _0xb1f9=['removeListener','register','length','openchannelQueue:','./openchannelQueue.events','update','emit'];(function(_0x1ef4f1,_0x44b2f2){var _0x266bcc=function(_0x60eae6){while(--_0x60eae6){_0x1ef4f1['push'](_0x1ef4f1['shift']());}};_0x266bcc(++_0x44b2f2);}(_0xb1f9,0xcf));var _0x9b1f=function(_0x15eb48,_0x395a5b){_0x15eb48=_0x15eb48-0x0;var _0xa309d7=_0xb1f9[_0x15eb48];return _0xa309d7;};'use strict';var OpenchannelQueueEvents=require(_0x9b1f('0x0'));var events=['save','remove',_0x9b1f('0x1')];function createListener(_0x86597a,_0x1a1909){return function(_0x2b753e){_0x1a1909[_0x9b1f('0x2')](_0x86597a,_0x2b753e);};}function removeListener(_0x4b67a8,_0x945def){return function(){OpenchannelQueueEvents[_0x9b1f('0x3')](_0x4b67a8,_0x945def);};}exports[_0x9b1f('0x4')]=function(_0x241142){for(var _0x4d0908=0x0,_0x203a9e=events[_0x9b1f('0x5')];_0x4d0908<_0x203a9e;_0x4d0908++){var _0x50a95e=events[_0x4d0908];var _0x565481=createListener(_0x9b1f('0x6')+_0x50a95e,_0x241142);OpenchannelQueueEvents['on'](_0x50a95e,_0x565481);}}; \ No newline at end of file +var _0x52e0=['emit','removeListener','register','openchannelQueue:','./openchannelQueue.events','remove'];(function(_0x245f38,_0x50b39b){var _0x2e54ce=function(_0x32608c){while(--_0x32608c){_0x245f38['push'](_0x245f38['shift']());}};_0x2e54ce(++_0x50b39b);}(_0x52e0,0x10c));var _0x052e=function(_0x503a0c,_0xbc78c5){_0x503a0c=_0x503a0c-0x0;var _0x3b2e83=_0x52e0[_0x503a0c];return _0x3b2e83;};'use strict';var OpenchannelQueueEvents=require(_0x052e('0x0'));var events=['save',_0x052e('0x1'),'update'];function createListener(_0x57ae26,_0xe646eb){return function(_0x317e5a){_0xe646eb[_0x052e('0x2')](_0x57ae26,_0x317e5a);};}function removeListener(_0x5cbb93,_0x231bb4){return function(){OpenchannelQueueEvents[_0x052e('0x3')](_0x5cbb93,_0x231bb4);};}exports[_0x052e('0x4')]=function(_0x5db18c){for(var _0x108b2e=0x0,_0x23c29c=events['length'];_0x108b2e<_0x23c29c;_0x108b2e++){var _0x4792df=events[_0x108b2e];var _0x52831e=createListener(_0x052e('0x5')+_0x4792df,_0x5db18c);OpenchannelQueueEvents['on'](_0x4792df,_0x52831e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 186720b..ee9bbf9 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 _0x4c37=['/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','show','create','put'];(function(_0x5df07b,_0x3dfef5){var _0x19d99f=function(_0x286edd){while(--_0x286edd){_0x5df07b['push'](_0x5df07b['shift']());}};_0x19d99f(++_0x3dfef5);}(_0x4c37,0x1e7));var _0x74c3=function(_0x2466c3,_0x45535a){_0x2466c3=_0x2466c3-0x0;var _0x1ea8c0=_0x4c37[_0x2466c3];return _0x1ea8c0;};'use strict';var multer=require(_0x74c3('0x0'));var util=require(_0x74c3('0x1'));var path=require(_0x74c3('0x2'));var timeout=require(_0x74c3('0x3'));var express=require('express');var router=express[_0x74c3('0x4')]();var fs_extra=require(_0x74c3('0x5'));var auth=require(_0x74c3('0x6'));var interaction=require(_0x74c3('0x7'));var config=require('../../config/environment');var controller=require(_0x74c3('0x8'));router['get']('/',auth[_0x74c3('0x9')](),controller[_0x74c3('0xa')]);router[_0x74c3('0xb')](_0x74c3('0xc'),auth[_0x74c3('0x9')](),controller[_0x74c3('0xd')]);router['get']('/:id',auth[_0x74c3('0x9')](),controller[_0x74c3('0xe')]);router['post']('/',auth[_0x74c3('0x9')](),controller[_0x74c3('0xf')]);router[_0x74c3('0x10')](_0x74c3('0x11'),auth[_0x74c3('0x9')](),controller[_0x74c3('0x12')]);router['delete'](_0x74c3('0x11'),auth['isAuthenticated'](),controller[_0x74c3('0x13')]);module[_0x74c3('0x14')]=router; \ No newline at end of file +var _0xce75=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','create','put','update','delete','destroy'];(function(_0x246651,_0x358d99){var _0x1bbd82=function(_0x1eb811){while(--_0x1eb811){_0x246651['push'](_0x246651['shift']());}};_0x1bbd82(++_0x358d99);}(_0xce75,0x7e));var _0x5ce7=function(_0x4c8f2d,_0x10045d){_0x4c8f2d=_0x4c8f2d-0x0;var _0x134602=_0xce75[_0x4c8f2d];return _0x134602;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5ce7('0x0'));var timeout=require(_0x5ce7('0x1'));var express=require('express');var router=express[_0x5ce7('0x2')]();var fs_extra=require(_0x5ce7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5ce7('0x4'));var config=require(_0x5ce7('0x5'));var controller=require(_0x5ce7('0x6'));router[_0x5ce7('0x7')]('/',auth['isAuthenticated'](),controller[_0x5ce7('0x8')]);router[_0x5ce7('0x7')](_0x5ce7('0x9'),auth[_0x5ce7('0xa')](),controller[_0x5ce7('0xb')]);router[_0x5ce7('0x7')](_0x5ce7('0xc'),auth[_0x5ce7('0xa')](),controller['show']);router['post']('/',auth[_0x5ce7('0xa')](),controller[_0x5ce7('0xd')]);router[_0x5ce7('0xe')](_0x5ce7('0xc'),auth[_0x5ce7('0xa')](),controller[_0x5ce7('0xf')]);router[_0x5ce7('0x10')](_0x5ce7('0xc'),auth['isAuthenticated'](),controller[_0x5ce7('0x11')]);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 9954c1d..facb7a6 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 _0x2491=['sequelize','STRING','DATE','moment'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x2491,0x11f));var _0x1249=function(_0x4b1d00,_0x460b73){_0x4b1d00=_0x4b1d00-0x0;var _0x3319c3=_0x2491[_0x4b1d00];return _0x3319c3;};'use strict';var moment=require(_0x1249('0x0'));var Sequelize=require(_0x1249('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x1249('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x1249('0x2')]},'joinAt':{'type':Sequelize[_0x1249('0x3')]},'leaveAt':{'type':Sequelize[_0x1249('0x3')]},'acceptAt':{'type':Sequelize[_0x1249('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xed8e=['exports','STRING','DATE','moment','sequelize'];(function(_0x221466,_0x48420b){var _0x3c2231=function(_0x396193){while(--_0x396193){_0x221466['push'](_0x221466['shift']());}};_0x3c2231(++_0x48420b);}(_0xed8e,0x14d));var _0xeed8=function(_0x545519,_0x1a2c19){_0x545519=_0x545519-0x0;var _0x2fdf94=_0xed8e[_0x545519];return _0x2fdf94;};'use strict';var moment=require(_0xeed8('0x0'));var Sequelize=require(_0xeed8('0x1'));module[_0xeed8('0x2')]={'uniqueid':{'type':Sequelize[_0xeed8('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xeed8('0x3')]},'joinAt':{'type':Sequelize[_0xeed8('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xeed8('0x4')]},'exitAt':{'type':Sequelize[_0xeed8('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index ab87068..5aaeabc 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 _0x4ef4=['name','send','index','map','OpenchannelQueueReport','rawAttributes','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','include','findAll','catch','params','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack'];(function(_0x5475ae,_0x3e6b47){var _0x42133f=function(_0x2b65ca){while(--_0x2b65ca){_0x5475ae['push'](_0x5475ae['shift']());}};_0x42133f(++_0x3e6b47);}(_0x4ef4,0xfb));var _0x44ef=function(_0x4aabf2,_0x489ddf){_0x4aabf2=_0x4aabf2-0x0;var _0x44b8a6=_0x4ef4[_0x4aabf2];return _0x44b8a6;};'use strict';var emlformat=require(_0x44ef('0x0'));var rimraf=require(_0x44ef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x44ef('0x2'));var rp=require('request-promise');var moment=require(_0x44ef('0x3'));var BPromise=require(_0x44ef('0x4'));var Mustache=require(_0x44ef('0x5'));var util=require(_0x44ef('0x6'));var path=require(_0x44ef('0x7'));var sox=require(_0x44ef('0x8'));var csv=require(_0x44ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44ef('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x44ef('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x44ef('0xc'));var toCsv=require(_0x44ef('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x44ef('0xd'));var authService=require(_0x44ef('0xe'));var qs=require(_0x44ef('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x44ef('0x10'));var logger=require('../../config/logger')(_0x44ef('0x11'));var utils=require(_0x44ef('0x12'));var config=require(_0x44ef('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x44ef('0x14'))['db'];function respondWithStatusCode(_0x3b1760,_0x1f314c){_0x1f314c=_0x1f314c||0xcc;return function(_0x4bda4f){if(_0x4bda4f){return _0x3b1760[_0x44ef('0x15')](_0x1f314c);}return _0x3b1760[_0x44ef('0x16')](_0x1f314c)[_0x44ef('0x17')]();};}function respondWithResult(_0x2ce604,_0x542ab8){_0x542ab8=_0x542ab8||0xc8;return function(_0xf0e519){if(_0xf0e519){return _0x2ce604['status'](_0x542ab8)[_0x44ef('0x18')](_0xf0e519);}};}function respondWithFilteredResult(_0x226025,_0x27d0c5){return function(_0x845570){if(_0x845570){var _0x39d64f=typeof _0x27d0c5['offset']===_0x44ef('0x19')&&typeof _0x27d0c5[_0x44ef('0x1a')]===_0x44ef('0x19');var _0x360144=_0x845570[_0x44ef('0x1b')];var _0x1b8ec3=_0x39d64f?0x0:_0x27d0c5['offset'];var _0x288c6e=_0x39d64f?_0x845570[_0x44ef('0x1b')]:_0x27d0c5['offset']+_0x27d0c5[_0x44ef('0x1a')];var _0x12ee3c;if(_0x288c6e>=_0x360144){_0x288c6e=_0x360144;_0x12ee3c=0xc8;}else{_0x12ee3c=0xce;}_0x226025['status'](_0x12ee3c);return _0x226025['set'](_0x44ef('0x1c'),_0x1b8ec3+'-'+_0x288c6e+'/'+_0x360144)[_0x44ef('0x18')](_0x845570);}return null;};}function patchUpdates(_0x2c2766){return function(_0x4f01a3){try{jsonpatch[_0x44ef('0x1d')](_0x4f01a3,_0x2c2766,!![]);}catch(_0x348a33){return BPromise[_0x44ef('0x1e')](_0x348a33);}return _0x4f01a3[_0x44ef('0x1f')]();};}function saveUpdates(_0x21e16e,_0xa1cff2){return function(_0x3ef48c){if(_0x3ef48c){return _0x3ef48c[_0x44ef('0x20')](_0x21e16e)[_0x44ef('0x21')](function(_0x461e40){return _0x461e40;});}return null;};}function removeEntity(_0x41d473,_0x552c2f){return function(_0x2620bc){if(_0x2620bc){return _0x2620bc[_0x44ef('0x22')]()[_0x44ef('0x21')](function(){_0x41d473['status'](0xcc)[_0x44ef('0x17')]();});}};}function handleEntityNotFound(_0x63d651,_0x2f08d5){return function(_0x1b57f7){if(!_0x1b57f7){_0x63d651[_0x44ef('0x15')](0x194);}return _0x1b57f7;};}function handleError(_0x261138,_0x47dab0){_0x47dab0=_0x47dab0||0x1f4;return function(_0x45008e){logger[_0x44ef('0x23')](_0x45008e[_0x44ef('0x24')]);if(_0x45008e[_0x44ef('0x25')]){delete _0x45008e['name'];}_0x261138[_0x44ef('0x16')](_0x47dab0)[_0x44ef('0x26')](_0x45008e);};}exports[_0x44ef('0x27')]=function(_0x264a93,_0x12bd92){var _0x364001={},_0x45a2d5={},_0xcdf018={'count':0x0,'rows':[]};var _0x2fde2d=_[_0x44ef('0x28')](db[_0x44ef('0x29')][_0x44ef('0x2a')],function(_0x383d47){return{'name':_0x383d47['fieldName'],'type':_0x383d47[_0x44ef('0x2b')]['key']};});_0x45a2d5[_0x44ef('0x2c')]=_[_0x44ef('0x28')](_0x2fde2d,_0x44ef('0x25'));_0x45a2d5['query']=_[_0x44ef('0x2d')](_0x264a93[_0x44ef('0x2e')]);_0x45a2d5['filters']=_[_0x44ef('0x2f')](_0x45a2d5[_0x44ef('0x2c')],_0x45a2d5[_0x44ef('0x2e')]);_0x364001[_0x44ef('0x30')]=_[_0x44ef('0x2f')](_0x45a2d5[_0x44ef('0x2c')],qs['fields'](_0x264a93[_0x44ef('0x2e')][_0x44ef('0x31')]));_0x364001[_0x44ef('0x30')]=_0x364001['attributes'][_0x44ef('0x32')]?_0x364001[_0x44ef('0x30')]:_0x45a2d5[_0x44ef('0x2c')];if(!_0x264a93[_0x44ef('0x2e')][_0x44ef('0x33')](_0x44ef('0x34'))){_0x364001['limit']=qs[_0x44ef('0x1a')](_0x264a93[_0x44ef('0x2e')][_0x44ef('0x1a')]);_0x364001[_0x44ef('0x35')]=qs[_0x44ef('0x35')](_0x264a93[_0x44ef('0x2e')]['offset']);}_0x364001[_0x44ef('0x36')]=qs[_0x44ef('0x37')](_0x264a93[_0x44ef('0x2e')][_0x44ef('0x37')]);_0x364001['where']=qs[_0x44ef('0x38')](_[_0x44ef('0x39')](_0x264a93[_0x44ef('0x2e')],_0x45a2d5[_0x44ef('0x38')]),_0x2fde2d);if(_0x264a93['query'][_0x44ef('0x3a')]){_0x364001['where']=_[_0x44ef('0x3b')](_0x364001[_0x44ef('0x3c')],{'$or':_[_0x44ef('0x28')](_0x2fde2d,function(_0x5d9d15){if(_0x5d9d15[_0x44ef('0x2b')]!==_0x44ef('0x3d')){var _0x3aa225={};_0x3aa225[_0x5d9d15[_0x44ef('0x25')]]={'$like':'%'+_0x264a93['query']['filter']+'%'};return _0x3aa225;}})});}_0x364001=_[_0x44ef('0x3b')]({},_0x364001,_0x264a93[_0x44ef('0x3e')]);var _0x5326a1={'where':_0x364001['where']};return db[_0x44ef('0x29')]['count'](_0x5326a1)['then'](function(_0xa50fa4){_0xcdf018[_0x44ef('0x1b')]=_0xa50fa4;if(_0x264a93['query']['includeAll']){_0x364001[_0x44ef('0x3f')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x44ef('0x40')](_0x364001);})[_0x44ef('0x21')](function(_0x9dcce9){_0xcdf018['rows']=_0x9dcce9;return _0xcdf018;})[_0x44ef('0x21')](respondWithFilteredResult(_0x12bd92,_0x364001))[_0x44ef('0x41')](handleError(_0x12bd92,null));};exports['show']=function(_0xa69bea,_0xe8ae99){var _0x47b90e={'raw':!![],'where':{'id':_0xa69bea[_0x44ef('0x42')]['id']}},_0x2fbc7e={};_0x2fbc7e[_0x44ef('0x2c')]=_[_0x44ef('0x2d')](db[_0x44ef('0x29')][_0x44ef('0x2a')]);_0x2fbc7e[_0x44ef('0x2e')]=_[_0x44ef('0x2d')](_0xa69bea[_0x44ef('0x2e')]);_0x2fbc7e['filters']=_['intersection'](_0x2fbc7e['model'],_0x2fbc7e['query']);_0x47b90e[_0x44ef('0x30')]=_[_0x44ef('0x2f')](_0x2fbc7e[_0x44ef('0x2c')],qs[_0x44ef('0x31')](_0xa69bea[_0x44ef('0x2e')][_0x44ef('0x31')]));_0x47b90e[_0x44ef('0x30')]=_0x47b90e[_0x44ef('0x30')]['length']?_0x47b90e[_0x44ef('0x30')]:_0x2fbc7e[_0x44ef('0x2c')];if(_0xa69bea[_0x44ef('0x2e')][_0x44ef('0x43')]){_0x47b90e['include']=[{'all':!![]}];}_0x47b90e=_['merge']({},_0x47b90e,_0xa69bea[_0x44ef('0x3e')]);return db['OpenchannelQueueReport'][_0x44ef('0x44')](_0x47b90e)[_0x44ef('0x21')](handleEntityNotFound(_0xe8ae99,null))[_0x44ef('0x21')](respondWithResult(_0xe8ae99,null))[_0x44ef('0x41')](handleError(_0xe8ae99,null));};exports[_0x44ef('0x45')]=function(_0x281e30,_0x558cb8){return db[_0x44ef('0x29')][_0x44ef('0x45')](_0x281e30['body'],{})[_0x44ef('0x21')](respondWithResult(_0x558cb8,0xc9))[_0x44ef('0x41')](handleError(_0x558cb8,null));};exports[_0x44ef('0x20')]=function(_0x23edfa,_0xb6565a){if(_0x23edfa['body']['id']){delete _0x23edfa[_0x44ef('0x46')]['id'];}return db[_0x44ef('0x29')][_0x44ef('0x44')]({'where':{'id':_0x23edfa['params']['id']}})[_0x44ef('0x21')](handleEntityNotFound(_0xb6565a,null))['then'](saveUpdates(_0x23edfa[_0x44ef('0x46')],null))[_0x44ef('0x21')](respondWithResult(_0xb6565a,null))['catch'](handleError(_0xb6565a,null));};exports[_0x44ef('0x22')]=function(_0x13f633,_0x257a73){return db[_0x44ef('0x29')][_0x44ef('0x44')]({'where':{'id':_0x13f633[_0x44ef('0x42')]['id']}})[_0x44ef('0x21')](handleEntityNotFound(_0x257a73,null))[_0x44ef('0x21')](removeEntity(_0x257a73,null))['catch'](handleError(_0x257a73,null));};exports[_0x44ef('0x47')]=function(_0x2883df,_0x3ebd04){return db['OpenchannelQueueReport'][_0x44ef('0x47')]()[_0x44ef('0x21')](respondWithResult(_0x3ebd04,null))[_0x44ef('0x41')](handleError(_0x3ebd04,null));}; \ No newline at end of file +var _0xa582=['type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','length','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','../../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','reject','save','update','then','destroy','stack','name','map','OpenchannelQueueReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0xa582,0xa1));var _0x2a58=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xa582[_0x7e2eb0];return _0xd92de4;};'use strict';var emlformat=require(_0x2a58('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2a58('0x1'));var jsonpatch=require(_0x2a58('0x2'));var rp=require(_0x2a58('0x3'));var moment=require(_0x2a58('0x4'));var BPromise=require(_0x2a58('0x5'));var Mustache=require('mustache');var util=require(_0x2a58('0x6'));var path=require('path');var sox=require(_0x2a58('0x7'));var csv=require(_0x2a58('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2a58('0x9'));var _=require(_0x2a58('0xa'));var squel=require('squel');var crypto=require(_0x2a58('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2a58('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2a58('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2a58('0xe'));var hardwareService=require(_0x2a58('0xf'));var logger=require(_0x2a58('0x10'))(_0x2a58('0x11'));var utils=require(_0x2a58('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x2a58('0x13'));var db=require(_0x2a58('0x14'))['db'];function respondWithStatusCode(_0x44b1d6,_0xa40db7){_0xa40db7=_0xa40db7||0xcc;return function(_0x1bf8f7){if(_0x1bf8f7){return _0x44b1d6[_0x2a58('0x15')](_0xa40db7);}return _0x44b1d6['status'](_0xa40db7)[_0x2a58('0x16')]();};}function respondWithResult(_0x40dfc8,_0x5658a2){_0x5658a2=_0x5658a2||0xc8;return function(_0x5dc21f){if(_0x5dc21f){return _0x40dfc8[_0x2a58('0x17')](_0x5658a2)[_0x2a58('0x18')](_0x5dc21f);}};}function respondWithFilteredResult(_0x38882d,_0x1a70ef){return function(_0x4c992d){if(_0x4c992d){var _0x10195e=typeof _0x1a70ef[_0x2a58('0x19')]==='undefined'&&typeof _0x1a70ef[_0x2a58('0x1a')]===_0x2a58('0x1b');var _0x49ed47=_0x4c992d[_0x2a58('0x1c')];var _0x269129=_0x10195e?0x0:_0x1a70ef['offset'];var _0x54ec34=_0x10195e?_0x4c992d['count']:_0x1a70ef[_0x2a58('0x19')]+_0x1a70ef[_0x2a58('0x1a')];var _0x779dca;if(_0x54ec34>=_0x49ed47){_0x54ec34=_0x49ed47;_0x779dca=0xc8;}else{_0x779dca=0xce;}_0x38882d[_0x2a58('0x17')](_0x779dca);return _0x38882d[_0x2a58('0x1d')](_0x2a58('0x1e'),_0x269129+'-'+_0x54ec34+'/'+_0x49ed47)[_0x2a58('0x18')](_0x4c992d);}return null;};}function patchUpdates(_0x21f3ad){return function(_0x47808b){try{jsonpatch[_0x2a58('0x1f')](_0x47808b,_0x21f3ad,!![]);}catch(_0x85e98e){return BPromise[_0x2a58('0x20')](_0x85e98e);}return _0x47808b[_0x2a58('0x21')]();};}function saveUpdates(_0x44068e,_0x42b04e){return function(_0x1514c5){if(_0x1514c5){return _0x1514c5[_0x2a58('0x22')](_0x44068e)[_0x2a58('0x23')](function(_0x15ef75){return _0x15ef75;});}return null;};}function removeEntity(_0x4639ee,_0x13bea2){return function(_0xb26a04){if(_0xb26a04){return _0xb26a04[_0x2a58('0x24')]()[_0x2a58('0x23')](function(){_0x4639ee[_0x2a58('0x17')](0xcc)[_0x2a58('0x16')]();});}};}function handleEntityNotFound(_0xf88ebc,_0x221717){return function(_0x3d51b3){if(!_0x3d51b3){_0xf88ebc['sendStatus'](0x194);}return _0x3d51b3;};}function handleError(_0x342142,_0x329f7c){_0x329f7c=_0x329f7c||0x1f4;return function(_0x5f0f61){logger['error'](_0x5f0f61[_0x2a58('0x25')]);if(_0x5f0f61[_0x2a58('0x26')]){delete _0x5f0f61[_0x2a58('0x26')];}_0x342142[_0x2a58('0x17')](_0x329f7c)['send'](_0x5f0f61);};}exports['index']=function(_0x2e7602,_0x4bab56){var _0x5ce202={},_0x30abe3={},_0x16513c={'count':0x0,'rows':[]};var _0x497b0e=_[_0x2a58('0x27')](db[_0x2a58('0x28')][_0x2a58('0x29')],function(_0x407cdd){return{'name':_0x407cdd[_0x2a58('0x2a')],'type':_0x407cdd['type'][_0x2a58('0x2b')]};});_0x30abe3[_0x2a58('0x2c')]=_[_0x2a58('0x27')](_0x497b0e,_0x2a58('0x26'));_0x30abe3[_0x2a58('0x2d')]=_[_0x2a58('0x2e')](_0x2e7602[_0x2a58('0x2d')]);_0x30abe3['filters']=_[_0x2a58('0x2f')](_0x30abe3[_0x2a58('0x2c')],_0x30abe3[_0x2a58('0x2d')]);_0x5ce202[_0x2a58('0x30')]=_[_0x2a58('0x2f')](_0x30abe3[_0x2a58('0x2c')],qs['fields'](_0x2e7602[_0x2a58('0x2d')][_0x2a58('0x31')]));_0x5ce202['attributes']=_0x5ce202[_0x2a58('0x30')]['length']?_0x5ce202[_0x2a58('0x30')]:_0x30abe3[_0x2a58('0x2c')];if(!_0x2e7602[_0x2a58('0x2d')][_0x2a58('0x32')](_0x2a58('0x33'))){_0x5ce202[_0x2a58('0x1a')]=qs[_0x2a58('0x1a')](_0x2e7602[_0x2a58('0x2d')][_0x2a58('0x1a')]);_0x5ce202[_0x2a58('0x19')]=qs['offset'](_0x2e7602[_0x2a58('0x2d')][_0x2a58('0x19')]);}_0x5ce202[_0x2a58('0x34')]=qs[_0x2a58('0x35')](_0x2e7602[_0x2a58('0x2d')][_0x2a58('0x35')]);_0x5ce202[_0x2a58('0x36')]=qs[_0x2a58('0x37')](_[_0x2a58('0x38')](_0x2e7602[_0x2a58('0x2d')],_0x30abe3[_0x2a58('0x37')]),_0x497b0e);if(_0x2e7602[_0x2a58('0x2d')][_0x2a58('0x39')]){_0x5ce202['where']=_['merge'](_0x5ce202['where'],{'$or':_[_0x2a58('0x27')](_0x497b0e,function(_0x1199a1){if(_0x1199a1[_0x2a58('0x3a')]!==_0x2a58('0x3b')){var _0x2ae72a={};_0x2ae72a[_0x1199a1[_0x2a58('0x26')]]={'$like':'%'+_0x2e7602[_0x2a58('0x2d')][_0x2a58('0x39')]+'%'};return _0x2ae72a;}})});}_0x5ce202=_[_0x2a58('0x3c')]({},_0x5ce202,_0x2e7602[_0x2a58('0x3d')]);var _0x23932f={'where':_0x5ce202['where']};return db[_0x2a58('0x28')]['count'](_0x23932f)[_0x2a58('0x23')](function(_0x39d2df){_0x16513c[_0x2a58('0x1c')]=_0x39d2df;if(_0x2e7602[_0x2a58('0x2d')][_0x2a58('0x3e')]){_0x5ce202[_0x2a58('0x3f')]=[{'all':!![]}];}return db[_0x2a58('0x28')][_0x2a58('0x40')](_0x5ce202);})['then'](function(_0x442f03){_0x16513c['rows']=_0x442f03;return _0x16513c;})['then'](respondWithFilteredResult(_0x4bab56,_0x5ce202))[_0x2a58('0x41')](handleError(_0x4bab56,null));};exports[_0x2a58('0x42')]=function(_0x57ca85,_0xc7f79a){var _0x4fb61f={'raw':!![],'where':{'id':_0x57ca85['params']['id']}},_0x5f4797={};_0x5f4797[_0x2a58('0x2c')]=_[_0x2a58('0x2e')](db['OpenchannelQueueReport'][_0x2a58('0x29')]);_0x5f4797[_0x2a58('0x2d')]=_[_0x2a58('0x2e')](_0x57ca85['query']);_0x5f4797['filters']=_[_0x2a58('0x2f')](_0x5f4797['model'],_0x5f4797['query']);_0x4fb61f['attributes']=_[_0x2a58('0x2f')](_0x5f4797[_0x2a58('0x2c')],qs[_0x2a58('0x31')](_0x57ca85['query'][_0x2a58('0x31')]));_0x4fb61f[_0x2a58('0x30')]=_0x4fb61f['attributes'][_0x2a58('0x43')]?_0x4fb61f[_0x2a58('0x30')]:_0x5f4797[_0x2a58('0x2c')];if(_0x57ca85[_0x2a58('0x2d')][_0x2a58('0x3e')]){_0x4fb61f[_0x2a58('0x3f')]=[{'all':!![]}];}_0x4fb61f=_['merge']({},_0x4fb61f,_0x57ca85[_0x2a58('0x3d')]);return db[_0x2a58('0x28')]['find'](_0x4fb61f)[_0x2a58('0x23')](handleEntityNotFound(_0xc7f79a,null))[_0x2a58('0x23')](respondWithResult(_0xc7f79a,null))[_0x2a58('0x41')](handleError(_0xc7f79a,null));};exports[_0x2a58('0x44')]=function(_0x312662,_0x203df7){return db['OpenchannelQueueReport'][_0x2a58('0x44')](_0x312662[_0x2a58('0x45')],{})[_0x2a58('0x23')](respondWithResult(_0x203df7,0xc9))['catch'](handleError(_0x203df7,null));};exports['update']=function(_0x4483d0,_0x37ffb6){if(_0x4483d0[_0x2a58('0x45')]['id']){delete _0x4483d0[_0x2a58('0x45')]['id'];}return db[_0x2a58('0x28')]['find']({'where':{'id':_0x4483d0['params']['id']}})['then'](handleEntityNotFound(_0x37ffb6,null))['then'](saveUpdates(_0x4483d0[_0x2a58('0x45')],null))[_0x2a58('0x23')](respondWithResult(_0x37ffb6,null))[_0x2a58('0x41')](handleError(_0x37ffb6,null));};exports[_0x2a58('0x24')]=function(_0x4a6ed2,_0x91855f){return db[_0x2a58('0x28')][_0x2a58('0x46')]({'where':{'id':_0x4a6ed2[_0x2a58('0x47')]['id']}})[_0x2a58('0x23')](handleEntityNotFound(_0x91855f,null))[_0x2a58('0x23')](removeEntity(_0x91855f,null))[_0x2a58('0x41')](handleError(_0x91855f,null));};exports[_0x2a58('0x48')]=function(_0x38b2db,_0x47e9be){return db[_0x2a58('0x28')]['describe']()['then'](respondWithResult(_0x47e9be,null))[_0x2a58('0x41')](handleError(_0x47e9be,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 7004f70..19003bb 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x534254,_0x307b67){var _0x5eed7d=function(_0x811976){while(--_0x811976){_0x534254['push'](_0x534254['shift']());}};_0x5eed7d(++_0x307b67);}(_0x1261,0x144));var _0x1126=function(_0x51f2c0,_0xb7c46e){_0x51f2c0=_0x51f2c0-0x0;var _0x34ffd5=_0x1261[_0x51f2c0];return _0x34ffd5;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x54458e,_0x10c0eb){var _0x153788=function(_0x1ab866){while(--_0x1ab866){_0x54458e['push'](_0x54458e['shift']());}};_0x153788(++_0x10c0eb);}(_0x1261,0x144));var _0x1126=function(_0x4fa665,_0x1ae12a){_0x4fa665=_0x4fa665-0x0;var _0x62ccff=_0x1261[_0x4fa665];return _0x62ccff;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 319c243..3569b7e 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 _0x1c3d=['OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug'];(function(_0x35ae65,_0x758e07){var _0x1cf976=function(_0x465262){while(--_0x465262){_0x35ae65['push'](_0x35ae65['shift']());}};_0x1cf976(++_0x758e07);}(_0x1c3d,0x1b8));var _0xd1c3=function(_0xfe8bef,_0x453526){_0xfe8bef=_0xfe8bef-0x0;var _0x20659f=_0x1c3d[_0xfe8bef];return _0x20659f;};'use strict';var _=require('lodash');var util=require(_0xd1c3('0x0'));var moment=require(_0xd1c3('0x1'));var BPromise=require(_0xd1c3('0x2'));var rs=require(_0xd1c3('0x3'));var fs=require('fs');var Redis=require(_0xd1c3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd1c3('0x5'))(_0xd1c3('0x6'));var config=require(_0xd1c3('0x7'));var jayson=require(_0xd1c3('0x8'));var client=jayson[_0xd1c3('0x9')][_0xd1c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5adcb7,_0x398766,_0x420ab0){return new BPromise(function(_0x5db2f0,_0x1afc71){return client[_0xd1c3('0xb')](_0x5adcb7,_0x420ab0)[_0xd1c3('0xc')](function(_0x18556c){logger[_0xd1c3('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x398766,'request\x20sent');logger[_0xd1c3('0xe')](_0xd1c3('0xf'),_0x398766,_0xd1c3('0x10'),JSON[_0xd1c3('0x11')](_0x18556c));if(_0x18556c[_0xd1c3('0x12')]){if(_0x18556c[_0xd1c3('0x12')][_0xd1c3('0x13')]===0x1f4){logger[_0xd1c3('0x12')](_0xd1c3('0x14'),_0x398766,_0x18556c['error'][_0xd1c3('0x15')]);return _0x1afc71(_0x18556c['error']['message']);}logger[_0xd1c3('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x398766,_0x18556c[_0xd1c3('0x12')][_0xd1c3('0x15')]);return _0x5db2f0(_0x18556c[_0xd1c3('0x12')]['message']);}else{logger[_0xd1c3('0xd')](_0xd1c3('0x14'),_0x398766,_0xd1c3('0x10'));_0x5db2f0(_0x18556c[_0xd1c3('0x16')][_0xd1c3('0x15')]);}})[_0xd1c3('0x17')](function(_0x586fa7){logger[_0xd1c3('0x12')](_0xd1c3('0x14'),_0x398766,_0x586fa7);_0x1afc71(_0x586fa7);});});}exports[_0xd1c3('0x18')]=function(_0x5d26c2){var _0x53a5e1=this;return new Promise(function(_0x14f6cb,_0x3a1a74){return db[_0xd1c3('0x19')][_0xd1c3('0x1a')](_0x5d26c2[_0xd1c3('0x1b')],{'raw':_0x5d26c2['options']?_0x5d26c2[_0xd1c3('0x1c')][_0xd1c3('0x1d')]===undefined?!![]:![]:!![]})[_0xd1c3('0xc')](function(_0x588f4e){logger['info'](_0xd1c3('0x18'),_0x5d26c2);logger[_0xd1c3('0xe')]('CreateOpenchannelQueueReport',_0x5d26c2,JSON['stringify'](_0x588f4e));_0x14f6cb(_0x588f4e);})[_0xd1c3('0x17')](function(_0xc45d5d){logger[_0xd1c3('0x12')](_0xd1c3('0x18'),_0xc45d5d[_0xd1c3('0x15')],_0x5d26c2);_0x3a1a74(_0x53a5e1[_0xd1c3('0x12')](0x1f4,_0xc45d5d[_0xd1c3('0x15')]));});});};exports[_0xd1c3('0x1e')]=function(_0x33c380){var _0x218ef1=this;return new Promise(function(_0x5a9d5d,_0x56091a){return db[_0xd1c3('0x19')][_0xd1c3('0x1f')](_0x33c380[_0xd1c3('0x1b')],{'raw':_0x33c380[_0xd1c3('0x1c')]?_0x33c380['options'][_0xd1c3('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33c380[_0xd1c3('0x1c')]?_0x33c380['options'][_0xd1c3('0x20')]||null:null,'attributes':_0x33c380[_0xd1c3('0x1c')]?_0x33c380[_0xd1c3('0x1c')][_0xd1c3('0x21')]||null:null,'limit':_0x33c380[_0xd1c3('0x1c')]?_0x33c380[_0xd1c3('0x1c')][_0xd1c3('0x22')]||null:null})['then'](function(_0x57309e){logger[_0xd1c3('0xd')](_0xd1c3('0x1e'),_0x33c380);logger[_0xd1c3('0xe')](_0xd1c3('0x1e'),_0x33c380,JSON[_0xd1c3('0x11')](_0x57309e));_0x5a9d5d(_0x57309e);})['catch'](function(_0x331bad){logger[_0xd1c3('0x12')]('UpdateOpenchannelQueueReport',_0x331bad[_0xd1c3('0x15')],_0x33c380);_0x56091a(_0x218ef1['error'](0x1f4,_0x331bad[_0xd1c3('0x15')]));});});}; \ No newline at end of file +var _0x34b7=['create','body','options','raw','then','UpdateOpenchannelQueueReport','update','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport'];(function(_0x29291b,_0x25c06c){var _0xd53329=function(_0x27044e){while(--_0x27044e){_0x29291b['push'](_0x29291b['shift']());}};_0xd53329(++_0x25c06c);}(_0x34b7,0x196));var _0x734b=function(_0x3cc751,_0x38b8ff){_0x3cc751=_0x3cc751-0x0;var _0x3956a2=_0x34b7[_0x3cc751];return _0x3956a2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x734b('0x0'));var BPromise=require(_0x734b('0x1'));var rs=require(_0x734b('0x2'));var fs=require('fs');var Redis=require(_0x734b('0x3'));var db=require(_0x734b('0x4'))['db'];var utils=require(_0x734b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x734b('0x6'));var jayson=require(_0x734b('0x7'));var client=jayson[_0x734b('0x8')][_0x734b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28918a,_0x35d685,_0x58e2f1){return new BPromise(function(_0x1eb803,_0x2e7932){return client['request'](_0x28918a,_0x58e2f1)['then'](function(_0x5f4b3a){logger[_0x734b('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x35d685,_0x734b('0xb'));logger[_0x734b('0xc')](_0x734b('0xd'),_0x35d685,_0x734b('0xb'),JSON[_0x734b('0xe')](_0x5f4b3a));if(_0x5f4b3a[_0x734b('0xf')]){if(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x10')]===0x1f4){logger[_0x734b('0xf')](_0x734b('0x11'),_0x35d685,_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);return _0x2e7932(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);}logger['error'](_0x734b('0x11'),_0x35d685,_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);return _0x1eb803(_0x5f4b3a[_0x734b('0xf')][_0x734b('0x12')]);}else{logger[_0x734b('0xa')](_0x734b('0x11'),_0x35d685,_0x734b('0xb'));_0x1eb803(_0x5f4b3a[_0x734b('0x13')][_0x734b('0x12')]);}})[_0x734b('0x14')](function(_0x4d2d23){logger[_0x734b('0xf')](_0x734b('0x11'),_0x35d685,_0x4d2d23);_0x2e7932(_0x4d2d23);});});}exports[_0x734b('0x15')]=function(_0x5edbe9){var _0x4d3b9c=this;return new Promise(function(_0x56a95c,_0xcd12a1){return db[_0x734b('0x16')][_0x734b('0x17')](_0x5edbe9[_0x734b('0x18')],{'raw':_0x5edbe9[_0x734b('0x19')]?_0x5edbe9[_0x734b('0x19')][_0x734b('0x1a')]===undefined?!![]:![]:!![]})[_0x734b('0x1b')](function(_0x67eed){logger[_0x734b('0xa')](_0x734b('0x15'),_0x5edbe9);logger[_0x734b('0xc')](_0x734b('0x15'),_0x5edbe9,JSON[_0x734b('0xe')](_0x67eed));_0x56a95c(_0x67eed);})['catch'](function(_0x1e4dcc){logger[_0x734b('0xf')]('CreateOpenchannelQueueReport',_0x1e4dcc[_0x734b('0x12')],_0x5edbe9);_0xcd12a1(_0x4d3b9c[_0x734b('0xf')](0x1f4,_0x1e4dcc[_0x734b('0x12')]));});});};exports[_0x734b('0x1c')]=function(_0x46d432){var _0x26d118=this;return new Promise(function(_0x26eccf,_0x104fff){return db[_0x734b('0x16')][_0x734b('0x1d')](_0x46d432[_0x734b('0x18')],{'raw':_0x46d432[_0x734b('0x19')]?_0x46d432[_0x734b('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46d432['options']?_0x46d432[_0x734b('0x19')][_0x734b('0x1e')]||null:null,'attributes':_0x46d432['options']?_0x46d432[_0x734b('0x19')][_0x734b('0x1f')]||null:null,'limit':_0x46d432[_0x734b('0x19')]?_0x46d432[_0x734b('0x19')][_0x734b('0x20')]||null:null})[_0x734b('0x1b')](function(_0x3ba39c){logger['info'](_0x734b('0x1c'),_0x46d432);logger[_0x734b('0xc')](_0x734b('0x1c'),_0x46d432,JSON[_0x734b('0xe')](_0x3ba39c));_0x26eccf(_0x3ba39c);})[_0x734b('0x14')](function(_0x427c36){logger[_0x734b('0xf')](_0x734b('0x1c'),_0x427c36[_0x734b('0x12')],_0x46d432);_0x104fff(_0x26d118[_0x734b('0xf')](0x1f4,_0x427c36['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index e38bb41..df0799b 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 _0xef4a=['../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x18662a,_0x2c3a6a){var _0x294407=function(_0x516be0){while(--_0x516be0){_0x18662a['push'](_0x18662a['shift']());}};_0x294407(++_0x2c3a6a);}(_0xef4a,0x86));var _0xaef4=function(_0x17073a,_0x49b061){_0x17073a=_0x17073a-0x0;var _0x4c4259=_0xef4a[_0x17073a];return _0x4c4259;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaef4('0x0'));var timeout=require('connect-timeout');var express=require(_0xaef4('0x1'));var router=express[_0xaef4('0x2')]();var fs_extra=require(_0xaef4('0x3'));var auth=require(_0xaef4('0x4'));var interaction=require(_0xaef4('0x5'));var config=require(_0xaef4('0x6'));var controller=require('./openchannelTransferReport.controller');router[_0xaef4('0x7')]('/',auth['isAuthenticated'](),controller[_0xaef4('0x8')]);router[_0xaef4('0x7')](_0xaef4('0x9'),auth[_0xaef4('0xa')](),controller[_0xaef4('0xb')]);router[_0xaef4('0x7')](_0xaef4('0xc'),auth[_0xaef4('0xa')](),controller['show']);router[_0xaef4('0xd')]('/',auth[_0xaef4('0xa')](),controller[_0xaef4('0xe')]);router[_0xaef4('0xf')](_0xaef4('0xc'),auth[_0xaef4('0xa')](),controller[_0xaef4('0x10')]);router[_0xaef4('0x11')](_0xaef4('0xc'),auth['isAuthenticated'](),controller[_0xaef4('0x12')]);module[_0xaef4('0x13')]=router; \ No newline at end of file +var _0x1126=['delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','index','describe','/:id','isAuthenticated','show','post','update'];(function(_0x39f097,_0x17116b){var _0x544f6a=function(_0x457caf){while(--_0x457caf){_0x39f097['push'](_0x39f097['shift']());}};_0x544f6a(++_0x17116b);}(_0x1126,0xed));var _0x6112=function(_0x1181f3,_0xf81baa){_0x1181f3=_0x1181f3-0x0;var _0x37abb6=_0x1126[_0x1181f3];return _0x37abb6;};'use strict';var multer=require(_0x6112('0x0'));var util=require(_0x6112('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6112('0x2'));var router=express['Router']();var fs_extra=require(_0x6112('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6112('0x4'));var config=require(_0x6112('0x5'));var controller=require(_0x6112('0x6'));router[_0x6112('0x7')]('/',auth['isAuthenticated'](),controller[_0x6112('0x8')]);router[_0x6112('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x6112('0x9')]);router[_0x6112('0x7')](_0x6112('0xa'),auth[_0x6112('0xb')](),controller[_0x6112('0xc')]);router[_0x6112('0xd')]('/',auth[_0x6112('0xb')](),controller['create']);router['put'](_0x6112('0xa'),auth[_0x6112('0xb')](),controller[_0x6112('0xe')]);router[_0x6112('0xf')](_0x6112('0xa'),auth[_0x6112('0xb')](),controller[_0x6112('0x10')]);module[_0x6112('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 19b8b85..bebbe4a 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x348303,_0x791059){var _0x4a0bbd=function(_0x45f292){while(--_0x45f292){_0x348303['push'](_0x348303['shift']());}};_0x4a0bbd(++_0x791059);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x583e98,_0x5534f5){_0x583e98=_0x583e98-0x0;var _0x84cc30=_0xf3cd[_0x583e98];return _0x84cc30;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x20a21c,_0x1f66f8){var _0x5459e6=function(_0x30b917){while(--_0x30b917){_0x20a21c['push'](_0x20a21c['shift']());}};_0x5459e6(++_0x1f66f8);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x56ee15,_0x1effd1){_0x56ee15=_0x56ee15-0x0;var _0x94991f=_0xf3cd[_0x56ee15];return _0x94991f;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index a08458e..d04b493 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 _0xd7cc=['attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','VIRTUAL','include','findAll','catch','params','keys','includeAll','find','create','body','describe','rimraf','fast-json-patch','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/license/util','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','OpenchannelTransferReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','length'];(function(_0x267309,_0x83d8dd){var _0x28b24a=function(_0x68f667){while(--_0x68f667){_0x267309['push'](_0x267309['shift']());}};_0x28b24a(++_0x83d8dd);}(_0xd7cc,0x182));var _0xcd7c=function(_0x2ce322,_0x4f7f27){_0x2ce322=_0x2ce322-0x0;var _0x27abae=_0xd7cc[_0x2ce322];return _0x27abae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd7c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcd7c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcd7c('0x2'));var util=require(_0xcd7c('0x3'));var path=require(_0xcd7c('0x4'));var sox=require(_0xcd7c('0x5'));var csv=require(_0xcd7c('0x6'));var ejs=require(_0xcd7c('0x7'));var fs=require('fs');var fs_extra=require(_0xcd7c('0x8'));var _=require(_0xcd7c('0x9'));var squel=require('squel');var crypto=require(_0xcd7c('0xa'));var jsforce=require(_0xcd7c('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcd7c('0xc'));var Redis=require(_0xcd7c('0xd'));var authService=require(_0xcd7c('0xe'));var qs=require(_0xcd7c('0xf'));var as=require(_0xcd7c('0x10'));var hardwareService=require(_0xcd7c('0x11'));var logger=require(_0xcd7c('0x12'))(_0xcd7c('0x13'));var utils=require(_0xcd7c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xcd7c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31b09a,_0x5f0bdb){_0x5f0bdb=_0x5f0bdb||0xcc;return function(_0x219ca2){if(_0x219ca2){return _0x31b09a['sendStatus'](_0x5f0bdb);}return _0x31b09a['status'](_0x5f0bdb)[_0xcd7c('0x16')]();};}function respondWithResult(_0x26caec,_0x4958de){_0x4958de=_0x4958de||0xc8;return function(_0x35b02a){if(_0x35b02a){return _0x26caec[_0xcd7c('0x17')](_0x4958de)['json'](_0x35b02a);}};}function respondWithFilteredResult(_0x5fa9a1,_0x5eee33){return function(_0x58246b){if(_0x58246b){var _0x3a9ca4=typeof _0x5eee33[_0xcd7c('0x18')]===_0xcd7c('0x19')&&typeof _0x5eee33[_0xcd7c('0x1a')]==='undefined';var _0x654ee=_0x58246b['count'];var _0x3a1beb=_0x3a9ca4?0x0:_0x5eee33[_0xcd7c('0x18')];var _0x4d9463=_0x3a9ca4?_0x58246b[_0xcd7c('0x1b')]:_0x5eee33[_0xcd7c('0x18')]+_0x5eee33[_0xcd7c('0x1a')];var _0x2469a4;if(_0x4d9463>=_0x654ee){_0x4d9463=_0x654ee;_0x2469a4=0xc8;}else{_0x2469a4=0xce;}_0x5fa9a1['status'](_0x2469a4);return _0x5fa9a1[_0xcd7c('0x1c')](_0xcd7c('0x1d'),_0x3a1beb+'-'+_0x4d9463+'/'+_0x654ee)['json'](_0x58246b);}return null;};}function patchUpdates(_0x2a26a6){return function(_0x4c1412){try{jsonpatch[_0xcd7c('0x1e')](_0x4c1412,_0x2a26a6,!![]);}catch(_0x5511ec){return BPromise[_0xcd7c('0x1f')](_0x5511ec);}return _0x4c1412[_0xcd7c('0x20')]();};}function saveUpdates(_0x41c012,_0x2f83ee){return function(_0x38f2a1){if(_0x38f2a1){return _0x38f2a1[_0xcd7c('0x21')](_0x41c012)[_0xcd7c('0x22')](function(_0x3e9d98){return _0x3e9d98;});}return null;};}function removeEntity(_0x39770b,_0x23cd26){return function(_0x906bcb){if(_0x906bcb){return _0x906bcb[_0xcd7c('0x23')]()[_0xcd7c('0x22')](function(){_0x39770b[_0xcd7c('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12e763,_0x43955){return function(_0x55cced){if(!_0x55cced){_0x12e763[_0xcd7c('0x24')](0x194);}return _0x55cced;};}function handleError(_0x3ce566,_0x271c0a){_0x271c0a=_0x271c0a||0x1f4;return function(_0x116799){logger[_0xcd7c('0x25')](_0x116799[_0xcd7c('0x26')]);if(_0x116799[_0xcd7c('0x27')]){delete _0x116799[_0xcd7c('0x27')];}_0x3ce566[_0xcd7c('0x17')](_0x271c0a)[_0xcd7c('0x28')](_0x116799);};}exports[_0xcd7c('0x29')]=function(_0x512520,_0x241ae2){var _0x242a28={},_0x5bb827={},_0x551322={'count':0x0,'rows':[]};var _0x3ab233=_['map'](db[_0xcd7c('0x2a')][_0xcd7c('0x2b')],function(_0x557660){return{'name':_0x557660[_0xcd7c('0x2c')],'type':_0x557660['type'][_0xcd7c('0x2d')]};});_0x5bb827[_0xcd7c('0x2e')]=_['map'](_0x3ab233,_0xcd7c('0x27'));_0x5bb827[_0xcd7c('0x2f')]=_['keys'](_0x512520[_0xcd7c('0x2f')]);_0x5bb827[_0xcd7c('0x30')]=_['intersection'](_0x5bb827[_0xcd7c('0x2e')],_0x5bb827[_0xcd7c('0x2f')]);_0x242a28['attributes']=_[_0xcd7c('0x31')](_0x5bb827[_0xcd7c('0x2e')],qs[_0xcd7c('0x32')](_0x512520['query'][_0xcd7c('0x32')]));_0x242a28['attributes']=_0x242a28['attributes'][_0xcd7c('0x33')]?_0x242a28[_0xcd7c('0x34')]:_0x5bb827['model'];if(!_0x512520['query'][_0xcd7c('0x35')](_0xcd7c('0x36'))){_0x242a28[_0xcd7c('0x1a')]=qs[_0xcd7c('0x1a')](_0x512520[_0xcd7c('0x2f')]['limit']);_0x242a28[_0xcd7c('0x18')]=qs['offset'](_0x512520[_0xcd7c('0x2f')][_0xcd7c('0x18')]);}_0x242a28[_0xcd7c('0x37')]=qs[_0xcd7c('0x38')](_0x512520[_0xcd7c('0x2f')][_0xcd7c('0x38')]);_0x242a28[_0xcd7c('0x39')]=qs[_0xcd7c('0x30')](_[_0xcd7c('0x3a')](_0x512520['query'],_0x5bb827[_0xcd7c('0x30')]),_0x3ab233);if(_0x512520[_0xcd7c('0x2f')]['filter']){_0x242a28['where']=_[_0xcd7c('0x3b')](_0x242a28[_0xcd7c('0x39')],{'$or':_[_0xcd7c('0x3c')](_0x3ab233,function(_0x22772f){if(_0x22772f[_0xcd7c('0x3d')]!==_0xcd7c('0x3e')){var _0x132539={};_0x132539[_0x22772f[_0xcd7c('0x27')]]={'$like':'%'+_0x512520['query']['filter']+'%'};return _0x132539;}})});}_0x242a28=_['merge']({},_0x242a28,_0x512520['options']);var _0x117a5a={'where':_0x242a28[_0xcd7c('0x39')]};return db[_0xcd7c('0x2a')]['count'](_0x117a5a)[_0xcd7c('0x22')](function(_0x250e7b){_0x551322[_0xcd7c('0x1b')]=_0x250e7b;if(_0x512520[_0xcd7c('0x2f')]['includeAll']){_0x242a28[_0xcd7c('0x3f')]=[{'all':!![]}];}return db[_0xcd7c('0x2a')][_0xcd7c('0x40')](_0x242a28);})[_0xcd7c('0x22')](function(_0x186db7){_0x551322['rows']=_0x186db7;return _0x551322;})[_0xcd7c('0x22')](respondWithFilteredResult(_0x241ae2,_0x242a28))[_0xcd7c('0x41')](handleError(_0x241ae2,null));};exports['show']=function(_0x34e7ba,_0x602c39){var _0x5ec69a={'raw':!![],'where':{'id':_0x34e7ba[_0xcd7c('0x42')]['id']}},_0x4fe514={};_0x4fe514[_0xcd7c('0x2e')]=_[_0xcd7c('0x43')](db[_0xcd7c('0x2a')]['rawAttributes']);_0x4fe514[_0xcd7c('0x2f')]=_[_0xcd7c('0x43')](_0x34e7ba[_0xcd7c('0x2f')]);_0x4fe514['filters']=_[_0xcd7c('0x31')](_0x4fe514[_0xcd7c('0x2e')],_0x4fe514[_0xcd7c('0x2f')]);_0x5ec69a[_0xcd7c('0x34')]=_[_0xcd7c('0x31')](_0x4fe514['model'],qs[_0xcd7c('0x32')](_0x34e7ba[_0xcd7c('0x2f')][_0xcd7c('0x32')]));_0x5ec69a[_0xcd7c('0x34')]=_0x5ec69a[_0xcd7c('0x34')]['length']?_0x5ec69a[_0xcd7c('0x34')]:_0x4fe514['model'];if(_0x34e7ba['query'][_0xcd7c('0x44')]){_0x5ec69a[_0xcd7c('0x3f')]=[{'all':!![]}];}_0x5ec69a=_['merge']({},_0x5ec69a,_0x34e7ba['options']);return db[_0xcd7c('0x2a')][_0xcd7c('0x45')](_0x5ec69a)[_0xcd7c('0x22')](handleEntityNotFound(_0x602c39,null))[_0xcd7c('0x22')](respondWithResult(_0x602c39,null))['catch'](handleError(_0x602c39,null));};exports[_0xcd7c('0x46')]=function(_0x23722d,_0x416b3c){return db[_0xcd7c('0x2a')][_0xcd7c('0x46')](_0x23722d['body'],{})[_0xcd7c('0x22')](respondWithResult(_0x416b3c,0xc9))['catch'](handleError(_0x416b3c,null));};exports[_0xcd7c('0x21')]=function(_0x58f2f2,_0xc8a1a5){if(_0x58f2f2[_0xcd7c('0x47')]['id']){delete _0x58f2f2[_0xcd7c('0x47')]['id'];}return db[_0xcd7c('0x2a')][_0xcd7c('0x45')]({'where':{'id':_0x58f2f2[_0xcd7c('0x42')]['id']}})[_0xcd7c('0x22')](handleEntityNotFound(_0xc8a1a5,null))[_0xcd7c('0x22')](saveUpdates(_0x58f2f2[_0xcd7c('0x47')],null))[_0xcd7c('0x22')](respondWithResult(_0xc8a1a5,null))['catch'](handleError(_0xc8a1a5,null));};exports['destroy']=function(_0x2fea6c,_0x394294){return db[_0xcd7c('0x2a')][_0xcd7c('0x45')]({'where':{'id':_0x2fea6c['params']['id']}})[_0xcd7c('0x22')](handleEntityNotFound(_0x394294,null))[_0xcd7c('0x22')](removeEntity(_0x394294,null))[_0xcd7c('0x41')](handleError(_0x394294,null));};exports[_0xcd7c('0x48')]=function(_0x5dda88,_0x3d7cf5){return db['OpenchannelTransferReport'][_0xcd7c('0x48')]()[_0xcd7c('0x22')](respondWithResult(_0x3d7cf5,null))[_0xcd7c('0x41')](handleError(_0x3d7cf5,null));}; \ No newline at end of file +var _0x432f=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','update','describe','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query'];(function(_0x5b46e9,_0xa28a59){var _0x2b1d78=function(_0x441885){while(--_0x441885){_0x5b46e9['push'](_0x5b46e9['shift']());}};_0x2b1d78(++_0xa28a59);}(_0x432f,0xaf));var _0xf432=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x432f[_0x56482c];return _0x5aae7a;};'use strict';var emlformat=require(_0xf432('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf432('0x1'));var jsonpatch=require(_0xf432('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf432('0x3'));var Mustache=require('mustache');var util=require(_0xf432('0x4'));var path=require(_0xf432('0x5'));var sox=require(_0xf432('0x6'));var csv=require(_0xf432('0x7'));var ejs=require(_0xf432('0x8'));var fs=require('fs');var fs_extra=require(_0xf432('0x9'));var _=require('lodash');var squel=require(_0xf432('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf432('0xb'));var toCsv=require(_0xf432('0x7'));var querystring=require(_0xf432('0xc'));var Papa=require(_0xf432('0xd'));var Redis=require(_0xf432('0xe'));var authService=require(_0xf432('0xf'));var qs=require(_0xf432('0x10'));var as=require(_0xf432('0x11'));var hardwareService=require(_0xf432('0x12'));var logger=require(_0xf432('0x13'))(_0xf432('0x14'));var utils=require('../../config/utils');var config=require(_0xf432('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b3f56,_0x4db4f7){_0x4db4f7=_0x4db4f7||0xcc;return function(_0x415e02){if(_0x415e02){return _0x1b3f56[_0xf432('0x16')](_0x4db4f7);}return _0x1b3f56[_0xf432('0x17')](_0x4db4f7)[_0xf432('0x18')]();};}function respondWithResult(_0x1c2bdd,_0x2621a4){_0x2621a4=_0x2621a4||0xc8;return function(_0x7c89cd){if(_0x7c89cd){return _0x1c2bdd[_0xf432('0x17')](_0x2621a4)[_0xf432('0x19')](_0x7c89cd);}};}function respondWithFilteredResult(_0x205088,_0x2ba0d9){return function(_0x55ecc0){if(_0x55ecc0){var _0x3bd97e=typeof _0x2ba0d9[_0xf432('0x1a')]===_0xf432('0x1b')&&typeof _0x2ba0d9[_0xf432('0x1c')]===_0xf432('0x1b');var _0xce18cd=_0x55ecc0[_0xf432('0x1d')];var _0x30ef7c=_0x3bd97e?0x0:_0x2ba0d9[_0xf432('0x1a')];var _0x32bf74=_0x3bd97e?_0x55ecc0[_0xf432('0x1d')]:_0x2ba0d9[_0xf432('0x1a')]+_0x2ba0d9[_0xf432('0x1c')];var _0x2436fd;if(_0x32bf74>=_0xce18cd){_0x32bf74=_0xce18cd;_0x2436fd=0xc8;}else{_0x2436fd=0xce;}_0x205088['status'](_0x2436fd);return _0x205088[_0xf432('0x1e')]('Content-Range',_0x30ef7c+'-'+_0x32bf74+'/'+_0xce18cd)[_0xf432('0x19')](_0x55ecc0);}return null;};}function patchUpdates(_0x4ea224){return function(_0x5376d2){try{jsonpatch['apply'](_0x5376d2,_0x4ea224,!![]);}catch(_0x279e0e){return BPromise[_0xf432('0x1f')](_0x279e0e);}return _0x5376d2['save']();};}function saveUpdates(_0x26f66b,_0x10bb73){return function(_0x5b7f38){if(_0x5b7f38){return _0x5b7f38['update'](_0x26f66b)[_0xf432('0x20')](function(_0x2e3fda){return _0x2e3fda;});}return null;};}function removeEntity(_0x304ff4,_0x3d47ca){return function(_0xb93b5d){if(_0xb93b5d){return _0xb93b5d[_0xf432('0x21')]()[_0xf432('0x20')](function(){_0x304ff4[_0xf432('0x17')](0xcc)[_0xf432('0x18')]();});}};}function handleEntityNotFound(_0x26fa79,_0x58f8b8){return function(_0x3b3ab5){if(!_0x3b3ab5){_0x26fa79[_0xf432('0x16')](0x194);}return _0x3b3ab5;};}function handleError(_0xba4b47,_0x3692b5){_0x3692b5=_0x3692b5||0x1f4;return function(_0x5aa288){logger[_0xf432('0x22')](_0x5aa288[_0xf432('0x23')]);if(_0x5aa288[_0xf432('0x24')]){delete _0x5aa288[_0xf432('0x24')];}_0xba4b47[_0xf432('0x17')](_0x3692b5)[_0xf432('0x25')](_0x5aa288);};}exports[_0xf432('0x26')]=function(_0x58260f,_0x18bee9){var _0x22355a={},_0x4c8188={},_0x372a94={'count':0x0,'rows':[]};var _0x4db524=_[_0xf432('0x27')](db[_0xf432('0x28')][_0xf432('0x29')],function(_0x291bf6){return{'name':_0x291bf6[_0xf432('0x2a')],'type':_0x291bf6[_0xf432('0x2b')][_0xf432('0x2c')]};});_0x4c8188[_0xf432('0x2d')]=_[_0xf432('0x27')](_0x4db524,_0xf432('0x24'));_0x4c8188[_0xf432('0x2e')]=_[_0xf432('0x2f')](_0x58260f['query']);_0x4c8188[_0xf432('0x30')]=_[_0xf432('0x31')](_0x4c8188[_0xf432('0x2d')],_0x4c8188[_0xf432('0x2e')]);_0x22355a[_0xf432('0x32')]=_['intersection'](_0x4c8188[_0xf432('0x2d')],qs[_0xf432('0x33')](_0x58260f[_0xf432('0x2e')][_0xf432('0x33')]));_0x22355a[_0xf432('0x32')]=_0x22355a[_0xf432('0x32')][_0xf432('0x34')]?_0x22355a[_0xf432('0x32')]:_0x4c8188['model'];if(!_0x58260f[_0xf432('0x2e')][_0xf432('0x35')](_0xf432('0x36'))){_0x22355a['limit']=qs['limit'](_0x58260f[_0xf432('0x2e')][_0xf432('0x1c')]);_0x22355a['offset']=qs['offset'](_0x58260f[_0xf432('0x2e')]['offset']);}_0x22355a[_0xf432('0x37')]=qs['sort'](_0x58260f[_0xf432('0x2e')]['sort']);_0x22355a['where']=qs[_0xf432('0x30')](_[_0xf432('0x38')](_0x58260f[_0xf432('0x2e')],_0x4c8188[_0xf432('0x30')]),_0x4db524);if(_0x58260f[_0xf432('0x2e')][_0xf432('0x39')]){_0x22355a[_0xf432('0x3a')]=_[_0xf432('0x3b')](_0x22355a['where'],{'$or':_['map'](_0x4db524,function(_0x31a79e){if(_0x31a79e[_0xf432('0x2b')]!==_0xf432('0x3c')){var _0x536546={};_0x536546[_0x31a79e['name']]={'$like':'%'+_0x58260f[_0xf432('0x2e')][_0xf432('0x39')]+'%'};return _0x536546;}})});}_0x22355a=_[_0xf432('0x3b')]({},_0x22355a,_0x58260f['options']);var _0x579053={'where':_0x22355a['where']};return db['OpenchannelTransferReport']['count'](_0x579053)[_0xf432('0x20')](function(_0x56f2b7){_0x372a94[_0xf432('0x1d')]=_0x56f2b7;if(_0x58260f[_0xf432('0x2e')][_0xf432('0x3d')]){_0x22355a[_0xf432('0x3e')]=[{'all':!![]}];}return db[_0xf432('0x28')][_0xf432('0x3f')](_0x22355a);})[_0xf432('0x20')](function(_0x4cf2da){_0x372a94[_0xf432('0x40')]=_0x4cf2da;return _0x372a94;})[_0xf432('0x20')](respondWithFilteredResult(_0x18bee9,_0x22355a))['catch'](handleError(_0x18bee9,null));};exports[_0xf432('0x41')]=function(_0x241552,_0x51b93a){var _0x3d55f9={'raw':!![],'where':{'id':_0x241552[_0xf432('0x42')]['id']}},_0x2964de={};_0x2964de[_0xf432('0x2d')]=_[_0xf432('0x2f')](db['OpenchannelTransferReport'][_0xf432('0x29')]);_0x2964de[_0xf432('0x2e')]=_[_0xf432('0x2f')](_0x241552[_0xf432('0x2e')]);_0x2964de[_0xf432('0x30')]=_[_0xf432('0x31')](_0x2964de[_0xf432('0x2d')],_0x2964de[_0xf432('0x2e')]);_0x3d55f9[_0xf432('0x32')]=_['intersection'](_0x2964de['model'],qs[_0xf432('0x33')](_0x241552[_0xf432('0x2e')][_0xf432('0x33')]));_0x3d55f9[_0xf432('0x32')]=_0x3d55f9['attributes'][_0xf432('0x34')]?_0x3d55f9[_0xf432('0x32')]:_0x2964de[_0xf432('0x2d')];if(_0x241552[_0xf432('0x2e')]['includeAll']){_0x3d55f9['include']=[{'all':!![]}];}_0x3d55f9=_[_0xf432('0x3b')]({},_0x3d55f9,_0x241552[_0xf432('0x43')]);return db['OpenchannelTransferReport'][_0xf432('0x44')](_0x3d55f9)[_0xf432('0x20')](handleEntityNotFound(_0x51b93a,null))[_0xf432('0x20')](respondWithResult(_0x51b93a,null))[_0xf432('0x45')](handleError(_0x51b93a,null));};exports[_0xf432('0x46')]=function(_0x222da2,_0x1ba45c){return db['OpenchannelTransferReport'][_0xf432('0x46')](_0x222da2[_0xf432('0x47')],{})[_0xf432('0x20')](respondWithResult(_0x1ba45c,0xc9))['catch'](handleError(_0x1ba45c,null));};exports[_0xf432('0x48')]=function(_0x5d4d1f,_0x329557){if(_0x5d4d1f[_0xf432('0x47')]['id']){delete _0x5d4d1f[_0xf432('0x47')]['id'];}return db[_0xf432('0x28')][_0xf432('0x44')]({'where':{'id':_0x5d4d1f[_0xf432('0x42')]['id']}})[_0xf432('0x20')](handleEntityNotFound(_0x329557,null))[_0xf432('0x20')](saveUpdates(_0x5d4d1f[_0xf432('0x47')],null))[_0xf432('0x20')](respondWithResult(_0x329557,null))[_0xf432('0x45')](handleError(_0x329557,null));};exports['destroy']=function(_0x2a4ba8,_0x42db21){return db[_0xf432('0x28')][_0xf432('0x44')]({'where':{'id':_0x2a4ba8['params']['id']}})[_0xf432('0x20')](handleEntityNotFound(_0x42db21,null))[_0xf432('0x20')](removeEntity(_0x42db21,null))['catch'](handleError(_0x42db21,null));};exports[_0xf432('0x49')]=function(_0x83808d,_0x5b5ee2){return db[_0xf432('0x28')][_0xf432('0x49')]()[_0xf432('0x20')](respondWithResult(_0x5b5ee2,null))['catch'](handleError(_0x5b5ee2,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 1a854cc..62a07f7 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 _0x9326=['../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x22e9fe,_0x3d019f){var _0x47cd19=function(_0x8fd5fc){while(--_0x8fd5fc){_0x22e9fe['push'](_0x22e9fe['shift']());}};_0x47cd19(++_0x3d019f);}(_0x9326,0x1db));var _0x6932=function(_0xce9195,_0x1963e1){_0xce9195=_0xce9195-0x0;var _0x530fe6=_0x9326[_0xce9195];return _0x530fe6;};'use strict';var _=require(_0x6932('0x0'));var util=require(_0x6932('0x1'));var logger=require(_0x6932('0x2'))(_0x6932('0x3'));var moment=require('moment');var BPromise=require(_0x6932('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6932('0x5'));var attributes=require(_0x6932('0x6'));module[_0x6932('0x7')]=function(_0x55a682,_0x11d6a2){return _0x55a682[_0x6932('0x8')](_0x6932('0x9'),attributes,{'tableName':_0x6932('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6932('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf0c7=['exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x13bc1e,_0x15ebe7){var _0x51454b=function(_0x19e89a){while(--_0x19e89a){_0x13bc1e['push'](_0x13bc1e['shift']());}};_0x51454b(++_0x15ebe7);}(_0xf0c7,0x1cc));var _0x7f0c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0c7[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x7f0c('0x0'));var logger=require(_0x7f0c('0x1'))(_0x7f0c('0x2'));var moment=require('moment');var BPromise=require(_0x7f0c('0x3'));var rp=require(_0x7f0c('0x4'));var fs=require('fs');var path=require(_0x7f0c('0x5'));var rimraf=require('rimraf');var config=require(_0x7f0c('0x6'));var attributes=require(_0x7f0c('0x7'));module[_0x7f0c('0x8')]=function(_0xb4cc9,_0x305a36){return _0xb4cc9['define'](_0x7f0c('0x9'),attributes,{'tableName':_0x7f0c('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7f0c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 3fcccfe..7b0d903 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 _0x1db9=['../../config/utils','../../config/logger','jayson/promise','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3d3674,_0x2d64c5){var _0x14aa8a=function(_0x4073ca){while(--_0x4073ca){_0x3d3674['push'](_0x3d3674['shift']());}};_0x14aa8a(++_0x2d64c5);}(_0x1db9,0x176));var _0x91db=function(_0x44053f,_0x1ef12a){_0x44053f=_0x44053f-0x0;var _0x44c4d1=_0x1db9[_0x44053f];return _0x44c4d1;};'use strict';var _=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var moment=require(_0x91db('0x2'));var BPromise=require(_0x91db('0x3'));var rs=require(_0x91db('0x4'));var fs=require('fs');var Redis=require(_0x91db('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x91db('0x6'));var logger=require(_0x91db('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x91db('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x433c75,_0x3b0c53,_0x45fea0){return new BPromise(function(_0x2330c2,_0x2d89a1){return client['request'](_0x433c75,_0x45fea0)[_0x91db('0x9')](function(_0x58cda2){logger[_0x91db('0xa')](_0x91db('0xb'),_0x3b0c53,_0x91db('0xc'));logger['debug'](_0x91db('0xd'),_0x3b0c53,'request\x20sent',JSON['stringify'](_0x58cda2));if(_0x58cda2['error']){if(_0x58cda2[_0x91db('0xe')][_0x91db('0xf')]===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x3b0c53,_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);return _0x2d89a1(_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);}logger[_0x91db('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3b0c53,_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);return _0x2330c2(_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);}else{logger[_0x91db('0xa')](_0x91db('0xb'),_0x3b0c53,_0x91db('0xc'));_0x2330c2(_0x58cda2[_0x91db('0x11')][_0x91db('0x10')]);}})[_0x91db('0x12')](function(_0x1e9679){logger[_0x91db('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3b0c53,_0x1e9679);_0x2d89a1(_0x1e9679);});});} \ No newline at end of file +var _0x5785=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x5d4ca7,_0x19113b){var _0x3efc03=function(_0x59675b){while(--_0x59675b){_0x5d4ca7['push'](_0x5d4ca7['shift']());}};_0x3efc03(++_0x19113b);}(_0x5785,0x119));var _0x5578=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x5785[_0x220f3f];return _0x1f170e;};'use strict';var _=require(_0x5578('0x0'));var util=require(_0x5578('0x1'));var moment=require(_0x5578('0x2'));var BPromise=require(_0x5578('0x3'));var rs=require(_0x5578('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5578('0x5'))['db'];var utils=require(_0x5578('0x6'));var logger=require(_0x5578('0x7'))(_0x5578('0x8'));var config=require(_0x5578('0x9'));var jayson=require(_0x5578('0xa'));var client=jayson[_0x5578('0xb')][_0x5578('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x464ab2,_0x287860,_0x545581){return new BPromise(function(_0x520bbf,_0x3d37dc){return client[_0x5578('0xd')](_0x464ab2,_0x545581)['then'](function(_0x433ed0){logger['info'](_0x5578('0xe'),_0x287860,'request\x20sent');logger[_0x5578('0xf')](_0x5578('0x10'),_0x287860,_0x5578('0x11'),JSON['stringify'](_0x433ed0));if(_0x433ed0['error']){if(_0x433ed0[_0x5578('0x12')][_0x5578('0x13')]===0x1f4){logger[_0x5578('0x12')](_0x5578('0xe'),_0x287860,_0x433ed0[_0x5578('0x12')][_0x5578('0x14')]);return _0x3d37dc(_0x433ed0[_0x5578('0x12')][_0x5578('0x14')]);}logger[_0x5578('0x12')](_0x5578('0xe'),_0x287860,_0x433ed0['error'][_0x5578('0x14')]);return _0x520bbf(_0x433ed0[_0x5578('0x12')][_0x5578('0x14')]);}else{logger[_0x5578('0x15')](_0x5578('0xe'),_0x287860,_0x5578('0x11'));_0x520bbf(_0x433ed0[_0x5578('0x16')][_0x5578('0x14')]);}})[_0x5578('0x17')](function(_0xc9c5a4){logger['error'](_0x5578('0xe'),_0x287860,_0xc9c5a4);_0x3d37dc(_0xc9c5a4);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index ae9397c..a92afe3 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 _0xfc71=['exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x28bcdd,_0x25ff2d){var _0x700259=function(_0x3eec0e){while(--_0x3eec0e){_0x28bcdd['push'](_0x28bcdd['shift']());}};_0x700259(++_0x25ff2d);}(_0xfc71,0xd9));var _0x1fc7=function(_0x4f840d,_0x5d6218){_0x4f840d=_0x4f840d-0x0;var _0x315f81=_0xfc71[_0x4f840d];return _0x315f81;};'use strict';var multer=require('multer');var util=require(_0x1fc7('0x0'));var path=require('path');var timeout=require(_0x1fc7('0x1'));var express=require(_0x1fc7('0x2'));var router=express[_0x1fc7('0x3')]();var fs_extra=require(_0x1fc7('0x4'));var auth=require(_0x1fc7('0x5'));var interaction=require(_0x1fc7('0x6'));var config=require('../../config/environment');var controller=require(_0x1fc7('0x7'));router[_0x1fc7('0x8')]('/',auth[_0x1fc7('0x9')](),controller[_0x1fc7('0xa')]);router[_0x1fc7('0x8')](_0x1fc7('0xb'),auth['isAuthenticated'](),controller[_0x1fc7('0xc')]);router[_0x1fc7('0xd')]('/',auth[_0x1fc7('0x9')](),controller[_0x1fc7('0xe')]);router[_0x1fc7('0xf')](_0x1fc7('0xb'),auth[_0x1fc7('0x9')](),controller[_0x1fc7('0x10')]);router['delete'](_0x1fc7('0xb'),auth[_0x1fc7('0x9')](),controller['destroy']);module[_0x1fc7('0x11')]=router; \ No newline at end of file +var _0x1a1a=['../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','update','exports','multer','express','Router','fs-extra','../../components/auth/service'];(function(_0x411fac,_0xe650f9){var _0x4ef169=function(_0x1031c2){while(--_0x1031c2){_0x411fac['push'](_0x411fac['shift']());}};_0x4ef169(++_0xe650f9);}(_0x1a1a,0xb6));var _0xa1a1=function(_0x571c6b,_0x10fbbe){_0x571c6b=_0x571c6b-0x0;var _0x1a0d06=_0x1a1a[_0x571c6b];return _0x1a0d06;};'use strict';var multer=require(_0xa1a1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa1a1('0x1'));var router=express[_0xa1a1('0x2')]();var fs_extra=require(_0xa1a1('0x3'));var auth=require(_0xa1a1('0x4'));var interaction=require(_0xa1a1('0x5'));var config=require(_0xa1a1('0x6'));var controller=require(_0xa1a1('0x7'));router[_0xa1a1('0x8')]('/',auth[_0xa1a1('0x9')](),controller[_0xa1a1('0xa')]);router['get'](_0xa1a1('0xb'),auth[_0xa1a1('0x9')](),controller[_0xa1a1('0xc')]);router[_0xa1a1('0xd')]('/',auth['isAuthenticated'](),controller[_0xa1a1('0xe')]);router['put'](_0xa1a1('0xb'),auth[_0xa1a1('0x9')](),controller[_0xa1a1('0xf')]);router['delete'](_0xa1a1('0xb'),auth[_0xa1a1('0x9')](),controller['destroy']);module[_0xa1a1('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 0136f9e..66e7b08 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 _0x97a1=['STRING','exports','name'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x97a1,0x1c6));var _0x197a=function(_0xdfc9f7,_0x2d4949){_0xdfc9f7=_0xdfc9f7-0x0;var _0x32885e=_0x97a1[_0xdfc9f7];return _0x32885e;};'use strict';var Sequelize=require('sequelize');module[_0x197a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x197a('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x197a('0x2')]}}; \ No newline at end of file +var _0xe07a=['exports','STRING','sequelize'];(function(_0x14d233,_0x4289f7){var _0x2d4c76=function(_0x29ef14){while(--_0x29ef14){_0x14d233['push'](_0x14d233['shift']());}};_0x2d4c76(++_0x4289f7);}(_0xe07a,0x11c));var _0xae07=function(_0x44df50,_0x46e433){_0x44df50=_0x44df50-0x0;var _0x429548=_0xe07a[_0x44df50];return _0x429548;};'use strict';var Sequelize=require(_0xae07('0x0'));module[_0xae07('0x1')]={'name':{'type':Sequelize[_0xae07('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xae07('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index accfdf4..6240b33 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 _0x67be=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','Content-Range','json','reject','update','then','destroy','get','Pauses','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','query','keys','filters','intersection','fields','attributes','length','model','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','catch','show','params','options','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','create','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x4a82a5,_0x91c91){var _0x270338=function(_0x2ccfb5){while(--_0x2ccfb5){_0x4a82a5['push'](_0x4a82a5['shift']());}};_0x270338(++_0x91c91);}(_0x67be,0x183));var _0xe67b=function(_0x1efcfc,_0x4d3ab5){_0x1efcfc=_0x1efcfc-0x0;var _0x394ad1=_0x67be[_0x1efcfc];return _0x394ad1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe67b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe67b('0x1'));var moment=require(_0xe67b('0x2'));var BPromise=require(_0xe67b('0x3'));var Mustache=require('mustache');var util=require(_0xe67b('0x4'));var path=require(_0xe67b('0x5'));var sox=require(_0xe67b('0x6'));var csv=require(_0xe67b('0x7'));var ejs=require(_0xe67b('0x8'));var fs=require('fs');var fs_extra=require(_0xe67b('0x9'));var _=require(_0xe67b('0xa'));var squel=require('squel');var crypto=require(_0xe67b('0xb'));var jsforce=require(_0xe67b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe67b('0x7'));var querystring=require(_0xe67b('0xd'));var Papa=require(_0xe67b('0xe'));var Redis=require(_0xe67b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe67b('0x10'));var as=require(_0xe67b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe67b('0x12'));var utils=require('../../config/utils');var config=require(_0xe67b('0x13'));var licenseUtil=require(_0xe67b('0x14'));var db=require(_0xe67b('0x15'))['db'];function respondWithStatusCode(_0x28d03c,_0x5430aa){_0x5430aa=_0x5430aa||0xcc;return function(_0x56142e){if(_0x56142e){return _0x28d03c['sendStatus'](_0x5430aa);}return _0x28d03c[_0xe67b('0x16')](_0x5430aa)['end']();};}function respondWithResult(_0x4c503f,_0x14a199){_0x14a199=_0x14a199||0xc8;return function(_0x3e798e){if(_0x3e798e){return _0x4c503f['status'](_0x14a199)['json'](_0x3e798e);}};}function respondWithFilteredResult(_0x3c4316,_0xc502ce){return function(_0x3f3a24){if(_0x3f3a24){var _0x43e7bb=typeof _0xc502ce[_0xe67b('0x17')]===_0xe67b('0x18')&&typeof _0xc502ce[_0xe67b('0x19')]===_0xe67b('0x18');var _0x55f8f8=_0x3f3a24[_0xe67b('0x1a')];var _0x13c2a9=_0x43e7bb?0x0:_0xc502ce['offset'];var _0x33ee82=_0x43e7bb?_0x3f3a24[_0xe67b('0x1a')]:_0xc502ce[_0xe67b('0x17')]+_0xc502ce[_0xe67b('0x19')];var _0x1de031;if(_0x33ee82>=_0x55f8f8){_0x33ee82=_0x55f8f8;_0x1de031=0xc8;}else{_0x1de031=0xce;}_0x3c4316['status'](_0x1de031);return _0x3c4316['set'](_0xe67b('0x1b'),_0x13c2a9+'-'+_0x33ee82+'/'+_0x55f8f8)[_0xe67b('0x1c')](_0x3f3a24);}return null;};}function patchUpdates(_0x3ca29e){return function(_0x15c0ed){try{jsonpatch['apply'](_0x15c0ed,_0x3ca29e,!![]);}catch(_0x21bada){return BPromise[_0xe67b('0x1d')](_0x21bada);}return _0x15c0ed['save']();};}function saveUpdates(_0x411e9f,_0x15daad){return function(_0xb9de16){if(_0xb9de16){return _0xb9de16[_0xe67b('0x1e')](_0x411e9f)[_0xe67b('0x1f')](function(_0x48efb6){return _0x48efb6;});}return null;};}function removeEntity(_0x52f3c7,_0x302515){return function(_0x3bdf6d){if(_0x3bdf6d){return _0x3bdf6d[_0xe67b('0x20')]()['then'](function(){var _0x5e204d=_0x3bdf6d[_0xe67b('0x21')]({'plain':!![]});var _0x3c3699=_0xe67b('0x22');return db[_0xe67b('0x23')][_0xe67b('0x20')]({'where':{'type':_0x3c3699,'resourceId':_0x5e204d['id']}})[_0xe67b('0x1f')](function(){return _0x3bdf6d;});})[_0xe67b('0x1f')](function(){_0x52f3c7[_0xe67b('0x16')](0xcc)[_0xe67b('0x24')]();});}};}function handleEntityNotFound(_0x25291d,_0x8f88d7){return function(_0x5ed1f3){if(!_0x5ed1f3){_0x25291d[_0xe67b('0x25')](0x194);}return _0x5ed1f3;};}function handleError(_0x235090,_0x228e33){_0x228e33=_0x228e33||0x1f4;return function(_0x19aca9){logger[_0xe67b('0x26')](_0x19aca9[_0xe67b('0x27')]);if(_0x19aca9[_0xe67b('0x28')]){delete _0x19aca9[_0xe67b('0x28')];}_0x235090[_0xe67b('0x16')](_0x228e33)[_0xe67b('0x29')](_0x19aca9);};}exports[_0xe67b('0x2a')]=function(_0x4cc1e7,_0x30cd71){var _0x5071e4={},_0x4537e4={},_0x414127={'count':0x0,'rows':[]};var _0xae5fb4=_[_0xe67b('0x2b')](db[_0xe67b('0x2c')][_0xe67b('0x2d')],function(_0x7dd323){return{'name':_0x7dd323[_0xe67b('0x2e')],'type':_0x7dd323[_0xe67b('0x2f')][_0xe67b('0x30')]};});_0x4537e4['model']=_['map'](_0xae5fb4,'name');_0x4537e4[_0xe67b('0x31')]=_[_0xe67b('0x32')](_0x4cc1e7[_0xe67b('0x31')]);_0x4537e4[_0xe67b('0x33')]=_[_0xe67b('0x34')](_0x4537e4['model'],_0x4537e4[_0xe67b('0x31')]);_0x5071e4['attributes']=_['intersection'](_0x4537e4['model'],qs[_0xe67b('0x35')](_0x4cc1e7[_0xe67b('0x31')][_0xe67b('0x35')]));_0x5071e4['attributes']=_0x5071e4[_0xe67b('0x36')][_0xe67b('0x37')]?_0x5071e4[_0xe67b('0x36')]:_0x4537e4[_0xe67b('0x38')];if(!_0x4cc1e7[_0xe67b('0x31')]['hasOwnProperty'](_0xe67b('0x39'))){_0x5071e4[_0xe67b('0x19')]=qs[_0xe67b('0x19')](_0x4cc1e7[_0xe67b('0x31')][_0xe67b('0x19')]);_0x5071e4[_0xe67b('0x17')]=qs['offset'](_0x4cc1e7[_0xe67b('0x31')][_0xe67b('0x17')]);}_0x5071e4[_0xe67b('0x3a')]=qs['sort'](_0x4cc1e7['query'][_0xe67b('0x3b')]);_0x5071e4[_0xe67b('0x3c')]=qs[_0xe67b('0x33')](_[_0xe67b('0x3d')](_0x4cc1e7[_0xe67b('0x31')],_0x4537e4[_0xe67b('0x33')]),_0xae5fb4);if(_0x4cc1e7['query']['filter']){_0x5071e4['where']=_[_0xe67b('0x3e')](_0x5071e4[_0xe67b('0x3c')],{'$or':_['map'](_0xae5fb4,function(_0x5adcd6){if(_0x5adcd6[_0xe67b('0x2f')]!==_0xe67b('0x3f')){var _0x3863e9={};_0x3863e9[_0x5adcd6[_0xe67b('0x28')]]={'$like':'%'+_0x4cc1e7['query'][_0xe67b('0x40')]+'%'};return _0x3863e9;}})});}_0x5071e4=_[_0xe67b('0x3e')]({},_0x5071e4,_0x4cc1e7['options']);var _0x3722f9={'where':_0x5071e4[_0xe67b('0x3c')]};return db[_0xe67b('0x2c')][_0xe67b('0x1a')](_0x3722f9)[_0xe67b('0x1f')](function(_0x2f8585){_0x414127[_0xe67b('0x1a')]=_0x2f8585;if(_0x4cc1e7['query'][_0xe67b('0x41')]){_0x5071e4[_0xe67b('0x42')]=[{'all':!![]}];}return db[_0xe67b('0x2c')]['findAll'](_0x5071e4);})[_0xe67b('0x1f')](function(_0x31def2){_0x414127['rows']=_0x31def2;return _0x414127;})['then'](respondWithFilteredResult(_0x30cd71,_0x5071e4))[_0xe67b('0x43')](handleError(_0x30cd71,null));};exports[_0xe67b('0x44')]=function(_0x511041,_0x1c46a2){var _0x41280a={'raw':!![],'where':{'id':_0x511041[_0xe67b('0x45')]['id']}},_0x100e8b={};_0x100e8b[_0xe67b('0x38')]=_[_0xe67b('0x32')](db[_0xe67b('0x2c')][_0xe67b('0x2d')]);_0x100e8b[_0xe67b('0x31')]=_[_0xe67b('0x32')](_0x511041['query']);_0x100e8b[_0xe67b('0x33')]=_[_0xe67b('0x34')](_0x100e8b[_0xe67b('0x38')],_0x100e8b[_0xe67b('0x31')]);_0x41280a['attributes']=_[_0xe67b('0x34')](_0x100e8b[_0xe67b('0x38')],qs['fields'](_0x511041[_0xe67b('0x31')][_0xe67b('0x35')]));_0x41280a['attributes']=_0x41280a[_0xe67b('0x36')][_0xe67b('0x37')]?_0x41280a[_0xe67b('0x36')]:_0x100e8b[_0xe67b('0x38')];if(_0x511041[_0xe67b('0x31')]['includeAll']){_0x41280a[_0xe67b('0x42')]=[{'all':!![]}];}_0x41280a=_[_0xe67b('0x3e')]({},_0x41280a,_0x511041[_0xe67b('0x46')]);return db[_0xe67b('0x2c')]['find'](_0x41280a)[_0xe67b('0x1f')](handleEntityNotFound(_0x1c46a2,null))[_0xe67b('0x1f')](respondWithResult(_0x1c46a2,null))[_0xe67b('0x43')](handleError(_0x1c46a2,null));};exports['create']=function(_0x135f7f,_0x14574b){return db['Pause']['create'](_0x135f7f[_0xe67b('0x47')],{})['then'](function(_0x125ab2){var _0x5efe1d=_0x135f7f[_0xe67b('0x48')]['get']({'plain':!![]});if(!_0x5efe1d)throw new Error(_0xe67b('0x49'));if(_0x5efe1d[_0xe67b('0x4a')]===_0xe67b('0x48')){var _0xb1e5e6=_0x125ab2[_0xe67b('0x21')]({'plain':!![]});var _0x597dca=_0xe67b('0x22');return db[_0xe67b('0x4b')][_0xe67b('0x4c')]({'where':{'name':_0x597dca,'userProfileId':_0x5efe1d[_0xe67b('0x4d')]},'raw':!![]})[_0xe67b('0x1f')](function(_0x491fdd){if(_0x491fdd&&_0x491fdd[_0xe67b('0x4e')]===0x0){return db[_0xe67b('0x23')][_0xe67b('0x4f')]({'name':_0xb1e5e6['name'],'resourceId':_0xb1e5e6['id'],'type':_0x491fdd[_0xe67b('0x28')],'sectionId':_0x491fdd['id']},{})[_0xe67b('0x1f')](function(){return _0x125ab2;});}else{return _0x125ab2;}})[_0xe67b('0x43')](function(_0xcf563a){logger[_0xe67b('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcf563a);throw _0xcf563a;});}return _0x125ab2;})[_0xe67b('0x1f')](respondWithResult(_0x14574b,0xc9))[_0xe67b('0x43')](handleError(_0x14574b,null));};exports['update']=function(_0x311f3b,_0x456bff){if(_0x311f3b[_0xe67b('0x47')]['id']){delete _0x311f3b[_0xe67b('0x47')]['id'];}return db[_0xe67b('0x2c')][_0xe67b('0x4c')]({'where':{'id':_0x311f3b[_0xe67b('0x45')]['id']}})[_0xe67b('0x1f')](handleEntityNotFound(_0x456bff,null))[_0xe67b('0x1f')](saveUpdates(_0x311f3b[_0xe67b('0x47')],null))[_0xe67b('0x1f')](respondWithResult(_0x456bff,null))[_0xe67b('0x43')](handleError(_0x456bff,null));};exports[_0xe67b('0x20')]=function(_0x560190,_0x1c4b76){return db[_0xe67b('0x2c')]['find']({'where':{'id':_0x560190[_0xe67b('0x45')]['id']}})[_0xe67b('0x1f')](handleEntityNotFound(_0x1c4b76,null))['then'](removeEntity(_0x1c4b76,null))[_0xe67b('0x43')](handleError(_0x1c4b76,null));}; \ No newline at end of file +var _0x4556=['Pause','rawAttributes','key','model','map','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','intersection','fields','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Pauses','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','sendStatus','error','stack','name','send'];(function(_0x339137,_0x46f7a8){var _0x2e705e=function(_0x3826a0){while(--_0x3826a0){_0x339137['push'](_0x339137['shift']());}};_0x2e705e(++_0x46f7a8);}(_0x4556,0x166));var _0x6455=function(_0x3fd418,_0xba63e6){_0x3fd418=_0x3fd418-0x0;var _0x1c0036=_0x4556[_0x3fd418];return _0x1c0036;};'use strict';var emlformat=require(_0x6455('0x0'));var rimraf=require(_0x6455('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6455('0x2'));var rp=require(_0x6455('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6455('0x4'));var util=require(_0x6455('0x5'));var path=require(_0x6455('0x6'));var sox=require(_0x6455('0x7'));var csv=require('to-csv');var ejs=require(_0x6455('0x8'));var fs=require('fs');var fs_extra=require(_0x6455('0x9'));var _=require(_0x6455('0xa'));var squel=require(_0x6455('0xb'));var crypto=require('crypto');var jsforce=require(_0x6455('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6455('0xd'));var Redis=require(_0x6455('0xe'));var authService=require(_0x6455('0xf'));var qs=require(_0x6455('0x10'));var as=require(_0x6455('0x11'));var hardwareService=require(_0x6455('0x12'));var logger=require(_0x6455('0x13'))(_0x6455('0x14'));var utils=require('../../config/utils');var config=require(_0x6455('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6455('0x16'))['db'];function respondWithStatusCode(_0x21554e,_0x500416){_0x500416=_0x500416||0xcc;return function(_0x2e63ed){if(_0x2e63ed){return _0x21554e['sendStatus'](_0x500416);}return _0x21554e['status'](_0x500416)['end']();};}function respondWithResult(_0x202c8a,_0x3e1ab9){_0x3e1ab9=_0x3e1ab9||0xc8;return function(_0x2b4cf1){if(_0x2b4cf1){return _0x202c8a[_0x6455('0x17')](_0x3e1ab9)['json'](_0x2b4cf1);}};}function respondWithFilteredResult(_0x3ad20a,_0x576077){return function(_0x170845){if(_0x170845){var _0xa3a1bc=typeof _0x576077['offset']===_0x6455('0x18')&&typeof _0x576077[_0x6455('0x19')]==='undefined';var _0x1f0e3b=_0x170845['count'];var _0x42be81=_0xa3a1bc?0x0:_0x576077[_0x6455('0x1a')];var _0x1dbcd9=_0xa3a1bc?_0x170845[_0x6455('0x1b')]:_0x576077[_0x6455('0x1a')]+_0x576077[_0x6455('0x19')];var _0x40ddd7;if(_0x1dbcd9>=_0x1f0e3b){_0x1dbcd9=_0x1f0e3b;_0x40ddd7=0xc8;}else{_0x40ddd7=0xce;}_0x3ad20a[_0x6455('0x17')](_0x40ddd7);return _0x3ad20a[_0x6455('0x1c')](_0x6455('0x1d'),_0x42be81+'-'+_0x1dbcd9+'/'+_0x1f0e3b)['json'](_0x170845);}return null;};}function patchUpdates(_0x5b2691){return function(_0x3b90c0){try{jsonpatch[_0x6455('0x1e')](_0x3b90c0,_0x5b2691,!![]);}catch(_0x4425a0){return BPromise['reject'](_0x4425a0);}return _0x3b90c0[_0x6455('0x1f')]();};}function saveUpdates(_0x4fa387,_0x4937bc){return function(_0x4cbc9a){if(_0x4cbc9a){return _0x4cbc9a[_0x6455('0x20')](_0x4fa387)[_0x6455('0x21')](function(_0x9661a5){return _0x9661a5;});}return null;};}function removeEntity(_0x5eff3d,_0x2bee05){return function(_0x12a81a){if(_0x12a81a){return _0x12a81a['destroy']()[_0x6455('0x21')](function(){var _0x5423eb=_0x12a81a[_0x6455('0x22')]({'plain':!![]});var _0x5dd842='Pauses';return db[_0x6455('0x23')][_0x6455('0x24')]({'where':{'type':_0x5dd842,'resourceId':_0x5423eb['id']}})['then'](function(){return _0x12a81a;});})[_0x6455('0x21')](function(){_0x5eff3d[_0x6455('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2eb42f,_0x4a6a1b){return function(_0x2255c3){if(!_0x2255c3){_0x2eb42f[_0x6455('0x25')](0x194);}return _0x2255c3;};}function handleError(_0x2f214d,_0x504187){_0x504187=_0x504187||0x1f4;return function(_0x6932f1){logger[_0x6455('0x26')](_0x6932f1[_0x6455('0x27')]);if(_0x6932f1[_0x6455('0x28')]){delete _0x6932f1[_0x6455('0x28')];}_0x2f214d['status'](_0x504187)[_0x6455('0x29')](_0x6932f1);};}exports['index']=function(_0x4fffbb,_0x381519){var _0x2a5ca2={},_0x448653={},_0x4503b1={'count':0x0,'rows':[]};var _0x5c2030=_['map'](db[_0x6455('0x2a')][_0x6455('0x2b')],function(_0x1a16cd){return{'name':_0x1a16cd['fieldName'],'type':_0x1a16cd['type'][_0x6455('0x2c')]};});_0x448653[_0x6455('0x2d')]=_[_0x6455('0x2e')](_0x5c2030,'name');_0x448653[_0x6455('0x2f')]=_[_0x6455('0x30')](_0x4fffbb[_0x6455('0x2f')]);_0x448653[_0x6455('0x31')]=_['intersection'](_0x448653[_0x6455('0x2d')],_0x448653[_0x6455('0x2f')]);_0x2a5ca2['attributes']=_['intersection'](_0x448653['model'],qs['fields'](_0x4fffbb[_0x6455('0x2f')]['fields']));_0x2a5ca2[_0x6455('0x32')]=_0x2a5ca2[_0x6455('0x32')][_0x6455('0x33')]?_0x2a5ca2['attributes']:_0x448653[_0x6455('0x2d')];if(!_0x4fffbb[_0x6455('0x2f')][_0x6455('0x34')](_0x6455('0x35'))){_0x2a5ca2[_0x6455('0x19')]=qs['limit'](_0x4fffbb['query'][_0x6455('0x19')]);_0x2a5ca2['offset']=qs[_0x6455('0x1a')](_0x4fffbb[_0x6455('0x2f')][_0x6455('0x1a')]);}_0x2a5ca2[_0x6455('0x36')]=qs[_0x6455('0x37')](_0x4fffbb[_0x6455('0x2f')][_0x6455('0x37')]);_0x2a5ca2[_0x6455('0x38')]=qs[_0x6455('0x31')](_[_0x6455('0x39')](_0x4fffbb['query'],_0x448653[_0x6455('0x31')]),_0x5c2030);if(_0x4fffbb[_0x6455('0x2f')][_0x6455('0x3a')]){_0x2a5ca2[_0x6455('0x38')]=_[_0x6455('0x3b')](_0x2a5ca2[_0x6455('0x38')],{'$or':_[_0x6455('0x2e')](_0x5c2030,function(_0x1916f5){if(_0x1916f5[_0x6455('0x3c')]!==_0x6455('0x3d')){var _0x538548={};_0x538548[_0x1916f5['name']]={'$like':'%'+_0x4fffbb['query']['filter']+'%'};return _0x538548;}})});}_0x2a5ca2=_[_0x6455('0x3b')]({},_0x2a5ca2,_0x4fffbb['options']);var _0x294cd8={'where':_0x2a5ca2['where']};return db[_0x6455('0x2a')][_0x6455('0x1b')](_0x294cd8)['then'](function(_0x327b6a){_0x4503b1['count']=_0x327b6a;if(_0x4fffbb['query'][_0x6455('0x3e')]){_0x2a5ca2[_0x6455('0x3f')]=[{'all':!![]}];}return db[_0x6455('0x2a')][_0x6455('0x40')](_0x2a5ca2);})[_0x6455('0x21')](function(_0x1e99d1){_0x4503b1['rows']=_0x1e99d1;return _0x4503b1;})[_0x6455('0x21')](respondWithFilteredResult(_0x381519,_0x2a5ca2))[_0x6455('0x41')](handleError(_0x381519,null));};exports['show']=function(_0xd8537b,_0x21c9c5){var _0x447abc={'raw':!![],'where':{'id':_0xd8537b['params']['id']}},_0x58cbf4={};_0x58cbf4[_0x6455('0x2d')]=_[_0x6455('0x30')](db[_0x6455('0x2a')]['rawAttributes']);_0x58cbf4[_0x6455('0x2f')]=_[_0x6455('0x30')](_0xd8537b[_0x6455('0x2f')]);_0x58cbf4[_0x6455('0x31')]=_['intersection'](_0x58cbf4[_0x6455('0x2d')],_0x58cbf4[_0x6455('0x2f')]);_0x447abc[_0x6455('0x32')]=_[_0x6455('0x42')](_0x58cbf4[_0x6455('0x2d')],qs[_0x6455('0x43')](_0xd8537b[_0x6455('0x2f')]['fields']));_0x447abc[_0x6455('0x32')]=_0x447abc[_0x6455('0x32')][_0x6455('0x33')]?_0x447abc['attributes']:_0x58cbf4[_0x6455('0x2d')];if(_0xd8537b['query'][_0x6455('0x3e')]){_0x447abc[_0x6455('0x3f')]=[{'all':!![]}];}_0x447abc=_['merge']({},_0x447abc,_0xd8537b[_0x6455('0x44')]);return db['Pause']['find'](_0x447abc)[_0x6455('0x21')](handleEntityNotFound(_0x21c9c5,null))[_0x6455('0x21')](respondWithResult(_0x21c9c5,null))[_0x6455('0x41')](handleError(_0x21c9c5,null));};exports[_0x6455('0x45')]=function(_0x504c6f,_0x507344){return db[_0x6455('0x2a')][_0x6455('0x45')](_0x504c6f['body'],{})[_0x6455('0x21')](function(_0x2a2bbc){var _0x347898=_0x504c6f[_0x6455('0x46')][_0x6455('0x22')]({'plain':!![]});if(!_0x347898)throw new Error(_0x6455('0x47'));if(_0x347898['role']===_0x6455('0x46')){var _0x3b4de6=_0x2a2bbc['get']({'plain':!![]});var _0x23029e=_0x6455('0x48');return db[_0x6455('0x49')]['find']({'where':{'name':_0x23029e,'userProfileId':_0x347898[_0x6455('0x4a')]},'raw':!![]})[_0x6455('0x21')](function(_0x531d95){if(_0x531d95&&_0x531d95[_0x6455('0x4b')]===0x0){return db[_0x6455('0x23')]['create']({'name':_0x3b4de6[_0x6455('0x28')],'resourceId':_0x3b4de6['id'],'type':_0x531d95[_0x6455('0x28')],'sectionId':_0x531d95['id']},{})[_0x6455('0x21')](function(){return _0x2a2bbc;});}else{return _0x2a2bbc;}})[_0x6455('0x41')](function(_0x113e4a){logger[_0x6455('0x26')](_0x6455('0x4c'),_0x113e4a);throw _0x113e4a;});}return _0x2a2bbc;})['then'](respondWithResult(_0x507344,0xc9))[_0x6455('0x41')](handleError(_0x507344,null));};exports[_0x6455('0x20')]=function(_0x3232e5,_0x5e494b){if(_0x3232e5[_0x6455('0x4d')]['id']){delete _0x3232e5['body']['id'];}return db[_0x6455('0x2a')][_0x6455('0x4e')]({'where':{'id':_0x3232e5[_0x6455('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5e494b,null))['then'](saveUpdates(_0x3232e5[_0x6455('0x4d')],null))['then'](respondWithResult(_0x5e494b,null))[_0x6455('0x41')](handleError(_0x5e494b,null));};exports[_0x6455('0x24')]=function(_0x540119,_0x40baf6){return db[_0x6455('0x2a')][_0x6455('0x4e')]({'where':{'id':_0x540119[_0x6455('0x4f')]['id']}})[_0x6455('0x21')](handleEntityNotFound(_0x40baf6,null))[_0x6455('0x21')](removeEntity(_0x40baf6,null))[_0x6455('0x41')](handleError(_0x40baf6,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 5e5daa0..dc80dd1 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x539174,_0x179598){var _0x1ff298=function(_0x410551){while(--_0x410551){_0x539174['push'](_0x539174['shift']());}};_0x1ff298(++_0x179598);}(_0xe14b,0x93));var _0xbe14=function(_0x5bd010,_0x5bccb2){_0x5bd010=_0x5bd010-0x0;var _0x2f213e=_0xe14b[_0x5bd010];return _0x2f213e;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x284ae4,_0x246a17){var _0x5f10ca=function(_0x2fcf58){while(--_0x2fcf58){_0x284ae4['push'](_0x284ae4['shift']());}};_0x5f10ca(++_0x246a17);}(_0x814b,0x1a2));var _0xb814=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0x814b[_0x40b3f2];return _0x4ce90c;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),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 5600792..93bc509 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(_0xd84a0a,_0x453145){var _0x31bb6d=function(_0x49c7de){while(--_0x49c7de){_0xd84a0a['push'](_0xd84a0a['shift']());}};_0x31bb6d(++_0x453145);}(_0xb10b,0x12a));var _0xbb10=function(_0x44f0a1,_0x457d11){_0x44f0a1=_0x44f0a1-0x0;var _0x4af42e=_0xb10b[_0x44f0a1];return _0x4af42e;};'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(_0x59957e,_0x4825a1){var _0x36967e=function(_0x2ba5dc){while(--_0x2ba5dc){_0x59957e['push'](_0x59957e['shift']());}};_0x36967e(++_0x4825a1);}(_0xb10b,0x12a));var _0xbb10=function(_0xd0e677,_0x42939d){_0xd0e677=_0xd0e677-0x0;var _0x18aeb9=_0xb10b[_0xd0e677];return _0x18aeb9;};'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 5a40c9f..af15836 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 _0xc874=['originalname','extname','now','post','single','webhookPost','/:id','update','delete','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','index','/webhook','webhookGet','isAuthenticated','/:id/download','download','diskStorage','root','server/files/plugins','format','%s-%s%s','basename'];(function(_0x37c278,_0x444772){var _0x381888=function(_0x10ab1b){while(--_0x10ab1b){_0x37c278['push'](_0x37c278['shift']());}};_0x381888(++_0x444772);}(_0xc874,0x154));var _0x4c87=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0xc874[_0x26f1b2];return _0x1624a4;};'use strict';var multer=require(_0x4c87('0x0'));var util=require('util');var path=require(_0x4c87('0x1'));var timeout=require(_0x4c87('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4c87('0x3'));var auth=require(_0x4c87('0x4'));var interaction=require(_0x4c87('0x5'));var config=require('../../config/environment');var controller=require(_0x4c87('0x6'));router[_0x4c87('0x7')]('/',auth['isAuthenticated'](),controller[_0x4c87('0x8')]);router[_0x4c87('0x7')](_0x4c87('0x9'),controller[_0x4c87('0xa')]);router[_0x4c87('0x7')]('/:id',auth[_0x4c87('0xb')](),controller['show']);router[_0x4c87('0x7')](_0x4c87('0xc'),auth[_0x4c87('0xb')](),controller[_0x4c87('0xd')]);var upload=multer({'storage':multer[_0x4c87('0xe')]({'destination':function(_0x548e1a,_0x1fcc99,_0x2b82cb){_0x2b82cb(null,path['join'](config[_0x4c87('0xf')],_0x4c87('0x10')));},'filename':function(_0x1e0530,_0x3b01bb,_0x3a2aa2){_0x3b01bb['originalname']=_0x3b01bb['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3a2aa2(null,util[_0x4c87('0x11')](_0x4c87('0x12'),path[_0x4c87('0x13')](_0x3b01bb[_0x4c87('0x14')],path[_0x4c87('0x15')](_0x3b01bb[_0x4c87('0x14')])),Date[_0x4c87('0x16')](),path[_0x4c87('0x15')](_0x3b01bb['originalname'])));}})});router[_0x4c87('0x17')]('/',upload[_0x4c87('0x18')]('file'),controller['upload']);router[_0x4c87('0x17')](_0x4c87('0x9'),controller[_0x4c87('0x19')]);router['put'](_0x4c87('0x1a'),auth['isAuthenticated'](),controller[_0x4c87('0x1b')]);router[_0x4c87('0x1c')](_0x4c87('0x1a'),auth[_0x4c87('0xb')](),controller['delete']);module[_0x4c87('0x1d')]=router; \ No newline at end of file +var _0x9b9b=['single','file','webhookPost','put','delete','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','/:id/download','download','root','server/files/plugins','originalname','format','basename','extname','now','post'];(function(_0x193394,_0x77e174){var _0x576e1b=function(_0x2f71b5){while(--_0x2f71b5){_0x193394['push'](_0x193394['shift']());}};_0x576e1b(++_0x77e174);}(_0x9b9b,0x114));var _0xb9b9=function(_0x406e9f,_0x49adee){_0x406e9f=_0x406e9f-0x0;var _0x500565=_0x9b9b[_0x406e9f];return _0x500565;};'use strict';var multer=require('multer');var util=require(_0xb9b9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb9b9('0x1'));var router=express[_0xb9b9('0x2')]();var fs_extra=require(_0xb9b9('0x3'));var auth=require(_0xb9b9('0x4'));var interaction=require(_0xb9b9('0x5'));var config=require(_0xb9b9('0x6'));var controller=require(_0xb9b9('0x7'));router[_0xb9b9('0x8')]('/',auth[_0xb9b9('0x9')](),controller[_0xb9b9('0xa')]);router[_0xb9b9('0x8')](_0xb9b9('0xb'),controller[_0xb9b9('0xc')]);router[_0xb9b9('0x8')](_0xb9b9('0xd'),auth[_0xb9b9('0x9')](),controller['show']);router['get'](_0xb9b9('0xe'),auth[_0xb9b9('0x9')](),controller[_0xb9b9('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3949d0,_0x3b6bb9,_0x1122bb){_0x1122bb(null,path['join'](config[_0xb9b9('0x10')],_0xb9b9('0x11')));},'filename':function(_0xbc5a42,_0x26fa04,_0x230fea){_0x26fa04[_0xb9b9('0x12')]=_0x26fa04['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x230fea(null,util[_0xb9b9('0x13')]('%s-%s%s',path[_0xb9b9('0x14')](_0x26fa04['originalname'],path[_0xb9b9('0x15')](_0x26fa04[_0xb9b9('0x12')])),Date[_0xb9b9('0x16')](),path[_0xb9b9('0x15')](_0x26fa04[_0xb9b9('0x12')])));}})});router[_0xb9b9('0x17')]('/',upload[_0xb9b9('0x18')](_0xb9b9('0x19')),controller['upload']);router[_0xb9b9('0x17')]('/webhook',controller[_0xb9b9('0x1a')]);router[_0xb9b9('0x1b')](_0xb9b9('0xd'),auth[_0xb9b9('0x9')](),controller['update']);router[_0xb9b9('0x1c')](_0xb9b9('0xd'),auth[_0xb9b9('0x9')](),controller[_0xb9b9('0x1c')]);module[_0xb9b9('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 1513c40..506bea2 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 _0x1d6b=['always','never','sequelize','STRING','ENUM','html','script','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly'];(function(_0xcb672a,_0xc66d90){var _0x267580=function(_0x17344b){while(--_0x17344b){_0xcb672a['push'](_0xcb672a['shift']());}};_0x267580(++_0xc66d90);}(_0x1d6b,0x136));var _0xb1d6=function(_0x412dd8,_0x355780){_0x412dd8=_0x412dd8-0x0;var _0x47b96=_0x1d6b[_0x412dd8];return _0x47b96;};'use strict';var Sequelize=require(_0xb1d6('0x0'));module['exports']={'name':{'type':Sequelize[_0xb1d6('0x1')]},'type':{'type':Sequelize[_0xb1d6('0x2')](_0xb1d6('0x3'),_0xb1d6('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xb1d6('0x1')],'comment':_0xb1d6('0x5')},'active':{'type':Sequelize[_0xb1d6('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xb1d6('0x2')](_0xb1d6('0x7'),_0xb1d6('0x8'),_0xb1d6('0x9'),_0xb1d6('0xa')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xb1d6('0x1')]},'adminUrl':{'type':Sequelize[_0xb1d6('0x1')]},'agentUrl':{'type':Sequelize[_0xb1d6('0x1')]},'scriptName':{'type':Sequelize[_0xb1d6('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe8ac=['ENUM','TEXT','STRING','adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports'];(function(_0xe52d09,_0x33a6a8){var _0x16cc71=function(_0x1c1672){while(--_0x1c1672){_0xe52d09['push'](_0xe52d09['shift']());}};_0x16cc71(++_0x33a6a8);}(_0xe8ac,0x87));var _0xce8a=function(_0x5d5bdf,_0x4e7500){_0x5d5bdf=_0x5d5bdf-0x0;var _0x30a40c=_0xe8ac[_0x5d5bdf];return _0x30a40c;};'use strict';var Sequelize=require('sequelize');module[_0xce8a('0x0')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xce8a('0x1')]('html','script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xce8a('0x2')]},'path':{'type':Sequelize[_0xce8a('0x3')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0xce8a('0x4'),'agentOnly',_0xce8a('0x5'),_0xce8a('0x6')),'defaultValue':_0xce8a('0x5'),'comment':_0xce8a('0x7')},'icon':{'type':Sequelize[_0xce8a('0x3')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xce8a('0x3')]},'scriptName':{'type':Sequelize[_0xce8a('0x3')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index a430fc7..b513a6e 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 _0x43ec=['basename','createWriteStream','code','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','root','server/files/plugins','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','plugins','Warning:\x20agent\x20view\x20not\x20specified','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Extracted\x20folder\x20removed','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','encoding','method','headers','content-length','content-type','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','%s%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','get','Plugins','UserProfileResource','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','Plugin','include','findAll','rows','catch','show','params','includeAll','download','find','join','%s.zip'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x43ec,0x102));var _0xc43e=function(_0x4eae35,_0x3d9d32){_0x4eae35=_0x4eae35-0x0;var _0x174a7e=_0x43ec[_0x4eae35];return _0x174a7e;};'use strict';var emlformat=require(_0xc43e('0x0'));var rimraf=require(_0xc43e('0x1'));var zipdir=require(_0xc43e('0x2'));var jsonpatch=require(_0xc43e('0x3'));var rp=require('request-promise');var moment=require(_0xc43e('0x4'));var BPromise=require(_0xc43e('0x5'));var Mustache=require(_0xc43e('0x6'));var util=require(_0xc43e('0x7'));var path=require(_0xc43e('0x8'));var sox=require(_0xc43e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc43e('0xa'));var _=require(_0xc43e('0xb'));var squel=require(_0xc43e('0xc'));var crypto=require('crypto');var jsforce=require(_0xc43e('0xd'));var deskjs=require(_0xc43e('0xe'));var toCsv=require(_0xc43e('0xf'));var querystring=require(_0xc43e('0x10'));var Papa=require(_0xc43e('0x11'));var extract=require('extract-zip');var rimraf=require(_0xc43e('0x1'));var archiver=require(_0xc43e('0x12'));var Redis=require(_0xc43e('0x13'));var authService=require(_0xc43e('0x14'));var qs=require(_0xc43e('0x15'));var as=require(_0xc43e('0x16'));var hardwareService=require(_0xc43e('0x17'));var logger=require(_0xc43e('0x18'))('api');var utils=require(_0xc43e('0x19'));var config=require(_0xc43e('0x1a'));var licenseUtil=require(_0xc43e('0x1b'));var db=require(_0xc43e('0x1c'))['db'];config[_0xc43e('0x1d')]=_['defaults'](config[_0xc43e('0x1d')],{'host':_0xc43e('0x1e'),'port':0x18eb});var socket=require(_0xc43e('0x1f'))(new Redis(config[_0xc43e('0x1d')]));require(_0xc43e('0x20'))[_0xc43e('0x21')](socket);function respondWithStatusCode(_0x5bffa0,_0x5cc6a6){_0x5cc6a6=_0x5cc6a6||0xcc;return function(_0x1a4b2a){if(_0x1a4b2a){return _0x5bffa0[_0xc43e('0x22')](_0x5cc6a6);}return _0x5bffa0[_0xc43e('0x23')](_0x5cc6a6)[_0xc43e('0x24')]();};}function respondWithResult(_0x4eae0c,_0x50df81){_0x50df81=_0x50df81||0xc8;return function(_0x325607){if(_0x325607){return _0x4eae0c[_0xc43e('0x23')](_0x50df81)[_0xc43e('0x25')](_0x325607);}};}function respondWithFilteredResult(_0x20ffa9,_0xb5dca2){return function(_0x4ece8e){if(_0x4ece8e){var _0x294c0f=typeof _0xb5dca2[_0xc43e('0x26')]===_0xc43e('0x27')&&typeof _0xb5dca2['limit']===_0xc43e('0x27');var _0x5ea24d=_0x4ece8e['count'];var _0x54f097=_0x294c0f?0x0:_0xb5dca2[_0xc43e('0x26')];var _0x429573=_0x294c0f?_0x4ece8e[_0xc43e('0x28')]:_0xb5dca2[_0xc43e('0x26')]+_0xb5dca2[_0xc43e('0x29')];var _0x5401f7;if(_0x429573>=_0x5ea24d){_0x429573=_0x5ea24d;_0x5401f7=0xc8;}else{_0x5401f7=0xce;}_0x20ffa9[_0xc43e('0x23')](_0x5401f7);return _0x20ffa9[_0xc43e('0x2a')](_0xc43e('0x2b'),_0x54f097+'-'+_0x429573+'/'+_0x5ea24d)[_0xc43e('0x25')](_0x4ece8e);}return null;};}function patchUpdates(_0x40a387){return function(_0x575454){try{jsonpatch['apply'](_0x575454,_0x40a387,!![]);}catch(_0x29e680){return BPromise[_0xc43e('0x2c')](_0x29e680);}return _0x575454[_0xc43e('0x2d')]();};}function saveUpdates(_0x6a744e,_0x136411){return function(_0xf6b1b7){if(_0xf6b1b7){return _0xf6b1b7[_0xc43e('0x2e')](_0x6a744e)[_0xc43e('0x2f')](function(_0xfdd3b8){return _0xfdd3b8;});}return null;};}function removeEntity(_0xefdeb7,_0x1e2828){return function(_0x21e135){if(_0x21e135){return _0x21e135['destroy']()[_0xc43e('0x2f')](function(){var _0x365615=_0x21e135[_0xc43e('0x30')]({'plain':!![]});var _0x48ada3=_0xc43e('0x31');return db[_0xc43e('0x32')][_0xc43e('0x33')]({'where':{'type':_0x48ada3,'resourceId':_0x365615['id']}})['then'](function(){return _0x21e135;});})[_0xc43e('0x2f')](function(){_0xefdeb7[_0xc43e('0x23')](0xcc)[_0xc43e('0x24')]();});}};}function handleEntityNotFound(_0x103d8b,_0x57a376){return function(_0x795480){if(!_0x795480){_0x103d8b['sendStatus'](0x194);}return _0x795480;};}function handleError(_0x59f284,_0x11df4f){_0x11df4f=_0x11df4f||0x1f4;return function(_0x575d90){logger['error'](_0x575d90[_0xc43e('0x34')]);if(_0x575d90[_0xc43e('0x35')]){delete _0x575d90[_0xc43e('0x35')];}_0x59f284[_0xc43e('0x23')](_0x11df4f)['send'](_0x575d90);};}exports[_0xc43e('0x36')]=function(_0x7a20fd,_0x48152e){var _0xdd54e0={},_0x13def6={},_0x27b34a={'count':0x0,'rows':[]};var _0x28fe1b=_[_0xc43e('0x37')](db['Plugin'][_0xc43e('0x38')],function(_0x52134a){return{'name':_0x52134a[_0xc43e('0x39')],'type':_0x52134a[_0xc43e('0x3a')][_0xc43e('0x3b')]};});_0x13def6[_0xc43e('0x3c')]=_[_0xc43e('0x37')](_0x28fe1b,_0xc43e('0x35'));_0x13def6[_0xc43e('0x3d')]=_[_0xc43e('0x3e')](_0x7a20fd[_0xc43e('0x3d')]);_0x13def6[_0xc43e('0x3f')]=_[_0xc43e('0x40')](_0x13def6[_0xc43e('0x3c')],_0x13def6['query']);_0xdd54e0[_0xc43e('0x41')]=_[_0xc43e('0x40')](_0x13def6['model'],qs[_0xc43e('0x42')](_0x7a20fd['query'][_0xc43e('0x42')]));_0xdd54e0[_0xc43e('0x41')]=_0xdd54e0[_0xc43e('0x41')][_0xc43e('0x43')]?_0xdd54e0[_0xc43e('0x41')]:_0x13def6[_0xc43e('0x3c')];if(!_0x7a20fd[_0xc43e('0x3d')][_0xc43e('0x44')](_0xc43e('0x45'))){_0xdd54e0[_0xc43e('0x29')]=qs['limit'](_0x7a20fd[_0xc43e('0x3d')][_0xc43e('0x29')]);_0xdd54e0[_0xc43e('0x26')]=qs[_0xc43e('0x26')](_0x7a20fd['query'][_0xc43e('0x26')]);}_0xdd54e0[_0xc43e('0x46')]=qs[_0xc43e('0x47')](_0x7a20fd[_0xc43e('0x3d')][_0xc43e('0x47')]);_0xdd54e0['where']=qs[_0xc43e('0x3f')](_[_0xc43e('0x48')](_0x7a20fd[_0xc43e('0x3d')],_0x13def6[_0xc43e('0x3f')]),_0x28fe1b);if(_0x7a20fd[_0xc43e('0x3d')][_0xc43e('0x49')]){_0xdd54e0[_0xc43e('0x4a')]=_['merge'](_0xdd54e0[_0xc43e('0x4a')],{'$or':_[_0xc43e('0x37')](_0x28fe1b,function(_0x805407){if(_0x805407[_0xc43e('0x3a')]!==_0xc43e('0x4b')){var _0x272a9e={};_0x272a9e[_0x805407['name']]={'$like':'%'+_0x7a20fd[_0xc43e('0x3d')][_0xc43e('0x49')]+'%'};return _0x272a9e;}})});}_0xdd54e0=_[_0xc43e('0x4c')]({},_0xdd54e0,_0x7a20fd[_0xc43e('0x4d')]);var _0x448097={'where':_0xdd54e0[_0xc43e('0x4a')]};return db[_0xc43e('0x4e')][_0xc43e('0x28')](_0x448097)[_0xc43e('0x2f')](function(_0x2705c1){_0x27b34a[_0xc43e('0x28')]=_0x2705c1;if(_0x7a20fd[_0xc43e('0x3d')]['includeAll']){_0xdd54e0[_0xc43e('0x4f')]=[{'all':!![]}];}return db['Plugin'][_0xc43e('0x50')](_0xdd54e0);})[_0xc43e('0x2f')](function(_0x4ec629){_0x27b34a[_0xc43e('0x51')]=_0x4ec629;return _0x27b34a;})['then'](respondWithFilteredResult(_0x48152e,_0xdd54e0))[_0xc43e('0x52')](handleError(_0x48152e,null));};exports[_0xc43e('0x53')]=function(_0x4df8a6,_0x5485b4){var _0x583653={'raw':!![],'where':{'id':_0x4df8a6[_0xc43e('0x54')]['id']}},_0x213316={};_0x213316['model']=_[_0xc43e('0x3e')](db[_0xc43e('0x4e')]['rawAttributes']);_0x213316[_0xc43e('0x3d')]=_['keys'](_0x4df8a6['query']);_0x213316[_0xc43e('0x3f')]=_[_0xc43e('0x40')](_0x213316[_0xc43e('0x3c')],_0x213316[_0xc43e('0x3d')]);_0x583653[_0xc43e('0x41')]=_[_0xc43e('0x40')](_0x213316[_0xc43e('0x3c')],qs[_0xc43e('0x42')](_0x4df8a6[_0xc43e('0x3d')][_0xc43e('0x42')]));_0x583653['attributes']=_0x583653[_0xc43e('0x41')]['length']?_0x583653[_0xc43e('0x41')]:_0x213316[_0xc43e('0x3c')];if(_0x4df8a6['query'][_0xc43e('0x55')]){_0x583653[_0xc43e('0x4f')]=[{'all':!![]}];}_0x583653=_[_0xc43e('0x4c')]({},_0x583653,_0x4df8a6[_0xc43e('0x4d')]);return db['Plugin']['find'](_0x583653)[_0xc43e('0x2f')](handleEntityNotFound(_0x5485b4,null))['then'](respondWithResult(_0x5485b4,null))['catch'](handleError(_0x5485b4,null));};exports[_0xc43e('0x56')]=function(_0x17498b,_0x305e0d,_0x106147){return db[_0xc43e('0x4e')][_0xc43e('0x57')]({'where':{'id':_0x17498b[_0xc43e('0x54')]['id']},'attributes':['name',_0xc43e('0x8')],'raw':!![]})[_0xc43e('0x2f')](handleEntityNotFound(_0x305e0d,null))[_0xc43e('0x2f')](function(_0x2a8be2){if(_0x2a8be2){var _0x4562a1=path[_0xc43e('0x58')](config['root'],'server/files/plugins',util['format'](_0xc43e('0x59'),path[_0xc43e('0x5a')](_0x2a8be2[_0xc43e('0x8')])));var _0x191a37=fs[_0xc43e('0x5b')](_0x4562a1);var _0x427d89=archiver('zip',{'zlib':{'level':0x9}});_0x427d89['on']('warning',function(_0x2c5f76){if(_0x2c5f76[_0xc43e('0x5c')]===_0xc43e('0x5d')){logger[_0xc43e('0x5e')](_0x2c5f76);}else{throw new db[(_0xc43e('0x5f'))][(_0xc43e('0x60'))](_0xc43e('0x61'));}});_0x427d89['on'](_0xc43e('0x5e'),function(_0x43a955){throw new db[(_0xc43e('0x5f'))]['Error'](_0xc43e('0x61'));});_0x427d89['pipe'](_0x191a37);_0x427d89['glob']('**/*',{'cwd':path[_0xc43e('0x58')](config[_0xc43e('0x62')],_0xc43e('0x63'),path['dirname'](_0x2a8be2[_0xc43e('0x8')])),'ignore':[path[_0xc43e('0x58')](path[_0xc43e('0x5a')](_0x2a8be2['path']),_0xc43e('0x64')),path[_0xc43e('0x58')](path[_0xc43e('0x5a')](_0x2a8be2[_0xc43e('0x8')]),_0xc43e('0x65'))],'nodir':!![]})[_0xc43e('0x66')]();_0x191a37['on'](_0xc43e('0x67'),function(){if(!fs[_0xc43e('0x68')](_0x4562a1)){throw new db[(_0xc43e('0x5f'))][(_0xc43e('0x60'))](_0xc43e('0x69'));}return _0x305e0d['download'](_0x4562a1,util[_0xc43e('0x6a')]('%s.zip',path['basename'](_0x2a8be2[_0xc43e('0x8')])),function(_0x4421ab){if(_0x4421ab){throw new db[(_0xc43e('0x5f'))]['Error'](_0xc43e('0x6b'));}fs[_0xc43e('0x6c')](_0x4562a1);logger[_0xc43e('0x6d')](_0xc43e('0x6e'));logger[_0xc43e('0x6d')](_0xc43e('0x6f'));});});}return null;})['catch'](handleError(_0x305e0d,null));};exports['upload']=function(_0x406347,_0xbb2cfe,_0x203202){var _0x446601=path[_0xc43e('0x5a')](_0x406347[_0xc43e('0x70')][_0xc43e('0x71')],path['extname'](_0x406347['file']['filename']));var _0x11a112=path[_0xc43e('0x58')](config[_0xc43e('0x62')],_0xc43e('0x63'),_0x406347[_0xc43e('0x70')][_0xc43e('0x71')]);var _0x4a69b3=path[_0xc43e('0x58')](config[_0xc43e('0x62')],_0xc43e('0x63'),_0x446601);logger[_0xc43e('0x6d')](_0xc43e('0x72'),_0x11a112);logger['info'](_0xc43e('0x73'),_0x4a69b3);try{fs['chmodSync'](_0x11a112,parseInt('0777',0x8));extract(_0x11a112,{'dir':_0x4a69b3},function(_0x54e855){if(_0x54e855){logger[_0xc43e('0x5e')](_0x54e855);handleError(_0x54e855,!![]);};var _0x58ceb5=fs[_0xc43e('0x74')](_0x4a69b3);if(_0x58ceb5[_0xc43e('0x43')]>0x1){removeReferences(_0x11a112,_0x4a69b3);logger[_0xc43e('0x5e')](_0xc43e('0x75'));return _0x203202(new Error('Invalid\x20plugin\x20structure'));}var _0x43c973=fs[_0xc43e('0x76')](path[_0xc43e('0x58')](_0x4a69b3,_0x58ceb5[0x0]));if(_0x43c973[_0xc43e('0x77')]()){removeReferences(_0x11a112,_0x4a69b3);logger[_0xc43e('0x5e')](_0xc43e('0x75'));return _0x203202(new Error(_0xc43e('0x75')));}if(_0x43c973[_0xc43e('0x78')]()){var _0x44728c=fs[_0xc43e('0x74')](path[_0xc43e('0x58')](_0x4a69b3,_0x58ceb5[0x0]));if(_0x44728c[_0xc43e('0x43')]===0x0){removeReferences(_0x11a112,_0x4a69b3);logger[_0xc43e('0x5e')](_0xc43e('0x75'));return _0x203202(new Error(_0xc43e('0x75')));}var _0x5b51c7=_0x44728c[_0xc43e('0x79')](function(_0x55e37f){return _0x55e37f===_0xc43e('0x7a');});if(!_0x5b51c7){return _0x203202(new Error(_0xc43e('0x7b')));}var _0x4a8e20=fs[_0xc43e('0x7c')](path['join'](_0x4a69b3,_0x58ceb5[0x0],_0xc43e('0x7a')));var _0x4f551e=JSON['parse'](_0x4a8e20);if(_0xc43e('0x27')==typeof _0x4f551e[_0xc43e('0x35')]){return _0x203202(new Error(_0xc43e('0x7d')));}if(_0xc43e('0x27')==typeof _0x4f551e[_0xc43e('0x3a')]){return _0x203202(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xc43e('0x27')==typeof _0x4f551e[_0xc43e('0x7e')]){return _0x203202(new Error(_0xc43e('0x7f')));}if(_0xc43e('0x27')==typeof _0x4f551e[_0xc43e('0x80')]){return _0x203202(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x4f551e[_0xc43e('0x3a')]===_0xc43e('0x81')){if('undefined'==typeof _0x4f551e[_0xc43e('0x80')]['views']){return _0x203202(new Error(_0xc43e('0x82')));}if('undefined'==typeof _0x4f551e[_0xc43e('0x80')][_0xc43e('0x83')][_0xc43e('0x84')]&&_0xc43e('0x27')==typeof _0x4f551e[_0xc43e('0x80')]['views'][_0xc43e('0x85')]){return _0x203202(new Error(_0xc43e('0x86')));}}else if(_0x4f551e[_0xc43e('0x3a')]===_0xc43e('0x87')){if(_0xc43e('0x27')==typeof _0x4f551e[_0xc43e('0x80')]['scriptName']){return _0x203202(new Error(_0xc43e('0x88')));}if(_0xc43e('0x27')==typeof _0x4f551e[_0xc43e('0x80')][_0xc43e('0x89')]){return _0x203202(new Error(_0xc43e('0x8a')));}}else{return _0x203202(new Error(_0xc43e('0x8b')));}var _0x141bee=_0x4f551e[_0xc43e('0x35')];var _0x1e2d5d=_0x4f551e['description'];var _0x3a0d88=_0x4f551e[_0xc43e('0x3a')];var _0xb65de8=_0x4f551e[_0xc43e('0x8c')]?_0x4f551e[_0xc43e('0x8c')]:_0xc43e('0x8d');var _0x1c1850=_0x4f551e[_0xc43e('0x8e')]?_0x4f551e['icon']:_0xc43e('0x8f');var _0x3d8380='';var _0xf5044d='';var _0x124427='';var _0x323095='';var _0x4b31f8=_0x4f551e['version'];if(_0x3a0d88===_0xc43e('0x81')){if(_0xc43e('0x27')!=typeof _0x4f551e[_0xc43e('0x80')]['views'][_0xc43e('0x84')]){var _0x159def=_0x4f551e['parameters'][_0xc43e('0x83')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xc43e('0x90')](_0x159def)){_0x3d8380=path['join']('plugins',_0x446601,_0x58ceb5[0x0],_0x159def);}else{_0x3d8380=_0x159def;}}else{logger[_0xc43e('0x6d')](_0xc43e('0x91'));}if(_0xc43e('0x27')!=typeof _0x4f551e[_0xc43e('0x80')][_0xc43e('0x83')][_0xc43e('0x85')]){var _0x3e306c=_0x4f551e[_0xc43e('0x80')][_0xc43e('0x83')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xc43e('0x90')](_0x3e306c)){_0xf5044d=path[_0xc43e('0x58')](_0xc43e('0x92'),_0x446601,_0x58ceb5[0x0],_0x3e306c);}else{_0xf5044d=_0x3e306c;}}else{logger['info'](_0xc43e('0x93'));}}else if(_0x3a0d88===_0xc43e('0x87')){_0x124427=_0x4f551e[_0xc43e('0x80')]['scriptName'];_0x323095=_0x4f551e[_0xc43e('0x80')][_0xc43e('0x89')];if(_0xc43e('0x27')!=typeof _0x4f551e['parameters']['views']){if(_0xc43e('0x27')!=typeof _0x4f551e[_0xc43e('0x80')][_0xc43e('0x83')][_0xc43e('0x84')]){var _0x159def=_0x4f551e['parameters'][_0xc43e('0x83')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xc43e('0x90')](_0x159def)){_0x3d8380=path[_0xc43e('0x58')]('plugins',_0x446601,_0x58ceb5[0x0],_0x159def);}else{_0x3d8380=_0x159def;}}if(_0xc43e('0x27')!=typeof _0x4f551e['parameters'][_0xc43e('0x83')][_0xc43e('0x85')]){var _0x3e306c=_0x4f551e[_0xc43e('0x80')][_0xc43e('0x83')][_0xc43e('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3e306c)){_0xf5044d=path['join'](_0xc43e('0x92'),_0x446601,_0x58ceb5[0x0],_0x3e306c);}else{_0xf5044d=_0x3e306c;}}}}var _0x5bb1cf={'name':_0x141bee,'description':_0x1e2d5d,'path':path['join'](_0x446601,_0x58ceb5[0x0]),'type':_0x3a0d88,'sidebar':_0xb65de8,'icon':_0x1c1850,'adminUrl':_0x3d8380,'agentUrl':_0xf5044d,'scriptName':_0x124427,'scriptPath':_0x323095,'version':_0x4b31f8};removeReferences(_0x11a112,null);return db[_0xc43e('0x4e')]['create'](_0x5bb1cf)['then'](function(_0x1a32c5){var _0x326ab1={'role':_0x406347[_0xc43e('0x94')][_0xc43e('0x95')],'userProfileId':_0x406347[_0xc43e('0x94')][_0xc43e('0x96')]};if(!_0x326ab1)throw new Error(_0xc43e('0x97'));if(_0x326ab1[_0xc43e('0x95')]===_0xc43e('0x98')){var _0x355aa7=_0x1a32c5[_0xc43e('0x30')]({'plain':!![]});return db[_0xc43e('0x99')][_0xc43e('0x57')]({'where':{'name':_0xc43e('0x31'),'userProfileId':_0x326ab1['userProfileId']},'raw':!![]})[_0xc43e('0x2f')](function(_0x1fea63){if(_0x1fea63&&_0x1fea63[_0xc43e('0x9a')]===0x0){return db[_0xc43e('0x32')]['create']({'name':_0x355aa7[_0xc43e('0x35')],'resourceId':_0x355aa7['id'],'type':_0x1fea63['name'],'sectionId':_0x1fea63['id']},{})[_0xc43e('0x2f')](function(){return _0x1a32c5;});}else{return _0x1a32c5;}})[_0xc43e('0x52')](function(_0x56569b){logger[_0xc43e('0x5e')](_0xc43e('0x9b'),_0x56569b);throw _0x56569b;});}return _0x1a32c5;})['then'](respondWithResult(_0xbb2cfe,null))['catch'](handleError(_0xbb2cfe,null));}});}catch(_0x1968e7){_0xbb2cfe[_0xc43e('0x23')](0x1f4)[_0xc43e('0x9c')](_0x1968e7);}};function removeReferences(_0x397c47,_0x278d48){try{if(_0x397c47){fs[_0xc43e('0x6c')](_0x397c47);logger[_0xc43e('0x6d')]('Zip\x20archive\x20removed');}if(_0x278d48){rimraf(_0x278d48,function(){});logger['info'](_0xc43e('0x9d'));}}catch(_0xb5a9d7){logger[_0xc43e('0x5e')](_0xb5a9d7);}}exports[_0xc43e('0x2e')]=function(_0x2bd168,_0x574372,_0xe3f7){return db['Plugin'][_0xc43e('0x57')]({'where':{'id':_0x2bd168[_0xc43e('0x54')]['id']}})['then'](handleEntityNotFound(_0x574372,null))['then'](saveUpdates(_0x2bd168[_0xc43e('0x94')],null))['then'](respondWithResult(_0x574372,null))[_0xc43e('0x52')](handleError(_0x574372,null));};exports['delete']=function(_0x3de0eb,_0x149542,_0x20661d){return db[_0xc43e('0x4e')][_0xc43e('0x57')]({'where':{'id':_0x3de0eb[_0xc43e('0x54')]['id']}})['then'](function(_0x4f7bcb){if(_0x4f7bcb){return _0x4f7bcb[_0xc43e('0x33')]();}})[_0xc43e('0x2f')](function(_0x41e1a8){rimraf(path['join'](config[_0xc43e('0x62')],_0xc43e('0x63'),path[_0xc43e('0x9e')](_0x41e1a8[_0xc43e('0x8')])),function(){});return _0x41e1a8;})[_0xc43e('0x2f')](handleEntityNotFound(_0x149542,null))[_0xc43e('0x2f')](respondWithStatusCode(_0x149542,null))['catch'](handleError(_0x149542,null));};exports[_0xc43e('0x9f')]=function(_0x3fd8ba,_0x116a1f,_0x5bdc43){return BPromise[_0xc43e('0xa0')]()[_0xc43e('0x2f')](function(){if(!_0x3fd8ba[_0xc43e('0x3d')]['path']){throw new Error(_0xc43e('0xa1'));}if(!_0x3fd8ba[_0xc43e('0x3d')][_0xc43e('0xa2')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x22dab6=_0x3fd8ba[_0xc43e('0x3d')][_0xc43e('0xa3')]?_0x3fd8ba[_0xc43e('0x3d')]['hostname']+':'+_0x3fd8ba[_0xc43e('0x3d')][_0xc43e('0xa2')]:'http://localhost:'+_0x3fd8ba[_0xc43e('0x3d')][_0xc43e('0xa2')];var _0x3e171f=_0x3fd8ba[_0xc43e('0x3d')][_0xc43e('0x25')]?_0x3fd8ba['query'][_0xc43e('0x25')]:!![];var _0x336301=_0x3fd8ba[_0xc43e('0x3d')][_0xc43e('0xa4')]?_0x3fd8ba[_0xc43e('0x3d')]['encoding']:null;var _0x19c684={'method':_0x3fd8ba[_0xc43e('0xa5')],'uri':util[_0xc43e('0x6a')]('%s%s',_0x22dab6,_0x3fd8ba[_0xc43e('0x3d')][_0xc43e('0x8')]),'json':_0x3e171f,'resolveWithFullResponse':!![],'encoding':_0x336301,'qs':_0x3fd8ba[_0xc43e('0x3d')]};if(_0x3fd8ba['headers']){_0x19c684[_0xc43e('0xa6')]=_0x3fd8ba[_0xc43e('0xa6')];if(_0x19c684[_0xc43e('0xa6')][_0xc43e('0xa7')]){delete _0x19c684[_0xc43e('0xa6')]['content-length'];}}if(_0x19c684[_0xc43e('0xa6')][_0xc43e('0xa8')]){delete _0x19c684[_0xc43e('0xa6')]['content-type'];}return rp(_0x19c684);})[_0xc43e('0x2f')](function(_0x3bcfae){if(_0x3bcfae){_0x116a1f['set'](_0x3bcfae[_0xc43e('0xa6')]);logger[_0xc43e('0x6d')](_0x3bcfae[_0xc43e('0x94')]);if(_['endsWith'](_0x3fd8ba[_0xc43e('0x3d')][_0xc43e('0x8')],'download')&&_0x3bcfae[_0xc43e('0xa9')]==0x1f4){return _0x116a1f[_0xc43e('0x22')](_0x3bcfae['statusCode']);}else{return _0x116a1f[_0xc43e('0x23')](_0x3bcfae[_0xc43e('0xa9')])[_0xc43e('0x9c')](_0x3bcfae['body']);}}else{return _0x116a1f[_0xc43e('0x22')](0xc8);}})[_0xc43e('0x52')](handleError(_0x116a1f,null));};exports[_0xc43e('0xaa')]=function(_0x168173,_0x586084,_0x295906){return BPromise[_0xc43e('0xa0')]()['then'](function(){if(!_0x168173[_0xc43e('0x3d')][_0xc43e('0x8')]){throw new Error(_0xc43e('0xa1'));}if(!_0x168173[_0xc43e('0x3d')][_0xc43e('0xa2')]){throw new Error(_0xc43e('0xab'));}var _0x31d2f5=_0x168173[_0xc43e('0x3d')][_0xc43e('0xa3')]?_0x168173[_0xc43e('0x3d')][_0xc43e('0xa3')]+':'+_0x168173['query']['port']:_0xc43e('0xac')+_0x168173[_0xc43e('0x3d')][_0xc43e('0xa2')];var _0x186df8=_0x168173['query'][_0xc43e('0x25')]?_0x168173['query'][_0xc43e('0x25')]:!![];var _0x27329e=_0x168173['query']['encoding']?_0x168173[_0xc43e('0x3d')]['encoding']:null;var _0x27efe8={'method':_0x168173[_0xc43e('0xa5')],'uri':util[_0xc43e('0x6a')](_0xc43e('0xad'),_0x31d2f5,_0x168173[_0xc43e('0x3d')][_0xc43e('0x8')]),'json':_0x186df8,'resolveWithFullResponse':!![],'encoding':_0x27329e,'body':_0x168173[_0xc43e('0x94')]};if(_0x168173[_0xc43e('0xa6')]){_0x27efe8[_0xc43e('0xa6')]=_0x168173[_0xc43e('0xa6')];if(_0x27efe8[_0xc43e('0xa6')][_0xc43e('0xa7')]){delete _0x27efe8[_0xc43e('0xa6')]['content-length'];}}if(_0x27efe8['headers'][_0xc43e('0xa8')]){delete _0x27efe8[_0xc43e('0xa6')][_0xc43e('0xa8')];}return rp(_0x27efe8);})[_0xc43e('0x2f')](function(_0x2caaaf){if(_0x2caaaf){_0x586084['set'](_0x2caaaf[_0xc43e('0xa6')]);logger[_0xc43e('0x6d')](_0x2caaaf[_0xc43e('0x94')]);return _0x586084[_0xc43e('0x23')](_0x2caaaf[_0xc43e('0xa9')])[_0xc43e('0x9c')](_0x2caaaf[_0xc43e('0x94')]);}else{return _0x586084['sendStatus'](0xc8);}})[_0xc43e('0x52')](handleError(_0x586084,null));}; \ No newline at end of file +var _0x5d28=['Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','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','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','admin','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','test','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Plugins','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','headers','content-type','set','statusCode','webhookPost','%s%s','content-length','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','Plugin','includeAll','include','findAll','rows','catch','show','find','download','params','join','server/files/plugins','format','%s.zip','basename','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','root','dirname','node_modules/**/*','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info'];(function(_0x38a8b2,_0x2d6fa2){var _0x1b5a91=function(_0x3b9afb){while(--_0x3b9afb){_0x38a8b2['push'](_0x38a8b2['shift']());}};_0x1b5a91(++_0x2d6fa2);}(_0x5d28,0xe7));var _0x85d2=function(_0x255b5a,_0x3e0296){_0x255b5a=_0x255b5a-0x0;var _0x308f03=_0x5d28[_0x255b5a];return _0x308f03;};'use strict';var emlformat=require(_0x85d2('0x0'));var rimraf=require(_0x85d2('0x1'));var zipdir=require(_0x85d2('0x2'));var jsonpatch=require(_0x85d2('0x3'));var rp=require(_0x85d2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x85d2('0x5'));var util=require(_0x85d2('0x6'));var path=require(_0x85d2('0x7'));var sox=require(_0x85d2('0x8'));var csv=require(_0x85d2('0x9'));var ejs=require(_0x85d2('0xa'));var fs=require('fs');var fs_extra=require(_0x85d2('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x85d2('0xc'));var jsforce=require(_0x85d2('0xd'));var deskjs=require(_0x85d2('0xe'));var toCsv=require(_0x85d2('0x9'));var querystring=require(_0x85d2('0xf'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require(_0x85d2('0x10'));var Redis=require(_0x85d2('0x11'));var authService=require(_0x85d2('0x12'));var qs=require(_0x85d2('0x13'));var as=require(_0x85d2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x85d2('0x15'));var config=require(_0x85d2('0x16'));var licenseUtil=require(_0x85d2('0x17'));var db=require(_0x85d2('0x18'))['db'];config[_0x85d2('0x19')]=_['defaults'](config[_0x85d2('0x19')],{'host':_0x85d2('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85d2('0x19')]));require('./plugin.socket')[_0x85d2('0x1b')](socket);function respondWithStatusCode(_0x4e1856,_0x1560d4){_0x1560d4=_0x1560d4||0xcc;return function(_0x301f1c){if(_0x301f1c){return _0x4e1856[_0x85d2('0x1c')](_0x1560d4);}return _0x4e1856[_0x85d2('0x1d')](_0x1560d4)[_0x85d2('0x1e')]();};}function respondWithResult(_0x4ebf37,_0x3a4b58){_0x3a4b58=_0x3a4b58||0xc8;return function(_0x286907){if(_0x286907){return _0x4ebf37[_0x85d2('0x1d')](_0x3a4b58)['json'](_0x286907);}};}function respondWithFilteredResult(_0x1183c5,_0x102f93){return function(_0x9d5ebd){if(_0x9d5ebd){var _0x1b66a2=typeof _0x102f93[_0x85d2('0x1f')]===_0x85d2('0x20')&&typeof _0x102f93[_0x85d2('0x21')]===_0x85d2('0x20');var _0x10a974=_0x9d5ebd[_0x85d2('0x22')];var _0x55f3e3=_0x1b66a2?0x0:_0x102f93[_0x85d2('0x1f')];var _0x1b097f=_0x1b66a2?_0x9d5ebd[_0x85d2('0x22')]:_0x102f93[_0x85d2('0x1f')]+_0x102f93['limit'];var _0x5b9e12;if(_0x1b097f>=_0x10a974){_0x1b097f=_0x10a974;_0x5b9e12=0xc8;}else{_0x5b9e12=0xce;}_0x1183c5['status'](_0x5b9e12);return _0x1183c5['set'](_0x85d2('0x23'),_0x55f3e3+'-'+_0x1b097f+'/'+_0x10a974)[_0x85d2('0x24')](_0x9d5ebd);}return null;};}function patchUpdates(_0x9ea8fa){return function(_0x517990){try{jsonpatch[_0x85d2('0x25')](_0x517990,_0x9ea8fa,!![]);}catch(_0x33d312){return BPromise[_0x85d2('0x26')](_0x33d312);}return _0x517990[_0x85d2('0x27')]();};}function saveUpdates(_0x5c62bd,_0x40fafe){return function(_0x50f440){if(_0x50f440){return _0x50f440[_0x85d2('0x28')](_0x5c62bd)[_0x85d2('0x29')](function(_0x46644d){return _0x46644d;});}return null;};}function removeEntity(_0x168d23,_0x34cedb){return function(_0x52846d){if(_0x52846d){return _0x52846d['destroy']()[_0x85d2('0x29')](function(){var _0x2775d2=_0x52846d[_0x85d2('0x2a')]({'plain':!![]});var _0x3abde6='Plugins';return db[_0x85d2('0x2b')][_0x85d2('0x2c')]({'where':{'type':_0x3abde6,'resourceId':_0x2775d2['id']}})[_0x85d2('0x29')](function(){return _0x52846d;});})[_0x85d2('0x29')](function(){_0x168d23[_0x85d2('0x1d')](0xcc)[_0x85d2('0x1e')]();});}};}function handleEntityNotFound(_0x51ea31,_0x21fc7d){return function(_0x154255){if(!_0x154255){_0x51ea31['sendStatus'](0x194);}return _0x154255;};}function handleError(_0x2fafdf,_0x12db52){_0x12db52=_0x12db52||0x1f4;return function(_0xac5365){logger[_0x85d2('0x2d')](_0xac5365[_0x85d2('0x2e')]);if(_0xac5365['name']){delete _0xac5365[_0x85d2('0x2f')];}_0x2fafdf['status'](_0x12db52)[_0x85d2('0x30')](_0xac5365);};}exports[_0x85d2('0x31')]=function(_0x1b96bc,_0x3f55b6){var _0x41823a={},_0x2bd1e3={},_0x3393b2={'count':0x0,'rows':[]};var _0x3a5274=_[_0x85d2('0x32')](db['Plugin'][_0x85d2('0x33')],function(_0x6c4807){return{'name':_0x6c4807[_0x85d2('0x34')],'type':_0x6c4807[_0x85d2('0x35')]['key']};});_0x2bd1e3['model']=_[_0x85d2('0x32')](_0x3a5274,_0x85d2('0x2f'));_0x2bd1e3['query']=_[_0x85d2('0x36')](_0x1b96bc[_0x85d2('0x37')]);_0x2bd1e3[_0x85d2('0x38')]=_[_0x85d2('0x39')](_0x2bd1e3[_0x85d2('0x3a')],_0x2bd1e3[_0x85d2('0x37')]);_0x41823a[_0x85d2('0x3b')]=_[_0x85d2('0x39')](_0x2bd1e3[_0x85d2('0x3a')],qs[_0x85d2('0x3c')](_0x1b96bc['query'][_0x85d2('0x3c')]));_0x41823a[_0x85d2('0x3b')]=_0x41823a[_0x85d2('0x3b')][_0x85d2('0x3d')]?_0x41823a[_0x85d2('0x3b')]:_0x2bd1e3[_0x85d2('0x3a')];if(!_0x1b96bc['query'][_0x85d2('0x3e')](_0x85d2('0x3f'))){_0x41823a[_0x85d2('0x21')]=qs[_0x85d2('0x21')](_0x1b96bc[_0x85d2('0x37')]['limit']);_0x41823a[_0x85d2('0x1f')]=qs['offset'](_0x1b96bc['query'][_0x85d2('0x1f')]);}_0x41823a[_0x85d2('0x40')]=qs[_0x85d2('0x41')](_0x1b96bc[_0x85d2('0x37')][_0x85d2('0x41')]);_0x41823a['where']=qs[_0x85d2('0x38')](_[_0x85d2('0x42')](_0x1b96bc[_0x85d2('0x37')],_0x2bd1e3[_0x85d2('0x38')]),_0x3a5274);if(_0x1b96bc[_0x85d2('0x37')][_0x85d2('0x43')]){_0x41823a[_0x85d2('0x44')]=_['merge'](_0x41823a['where'],{'$or':_[_0x85d2('0x32')](_0x3a5274,function(_0x23d2bf){if(_0x23d2bf[_0x85d2('0x35')]!==_0x85d2('0x45')){var _0x465fa2={};_0x465fa2[_0x23d2bf['name']]={'$like':'%'+_0x1b96bc['query'][_0x85d2('0x43')]+'%'};return _0x465fa2;}})});}_0x41823a=_[_0x85d2('0x46')]({},_0x41823a,_0x1b96bc[_0x85d2('0x47')]);var _0x4cf881={'where':_0x41823a['where']};return db[_0x85d2('0x48')][_0x85d2('0x22')](_0x4cf881)[_0x85d2('0x29')](function(_0x350916){_0x3393b2[_0x85d2('0x22')]=_0x350916;if(_0x1b96bc[_0x85d2('0x37')][_0x85d2('0x49')]){_0x41823a[_0x85d2('0x4a')]=[{'all':!![]}];}return db[_0x85d2('0x48')][_0x85d2('0x4b')](_0x41823a);})[_0x85d2('0x29')](function(_0x48022b){_0x3393b2[_0x85d2('0x4c')]=_0x48022b;return _0x3393b2;})[_0x85d2('0x29')](respondWithFilteredResult(_0x3f55b6,_0x41823a))[_0x85d2('0x4d')](handleError(_0x3f55b6,null));};exports[_0x85d2('0x4e')]=function(_0x20d57e,_0x5daad6){var _0xea9cdb={'raw':!![],'where':{'id':_0x20d57e['params']['id']}},_0x1e5c4c={};_0x1e5c4c[_0x85d2('0x3a')]=_['keys'](db['Plugin'][_0x85d2('0x33')]);_0x1e5c4c['query']=_[_0x85d2('0x36')](_0x20d57e[_0x85d2('0x37')]);_0x1e5c4c['filters']=_[_0x85d2('0x39')](_0x1e5c4c[_0x85d2('0x3a')],_0x1e5c4c[_0x85d2('0x37')]);_0xea9cdb['attributes']=_['intersection'](_0x1e5c4c[_0x85d2('0x3a')],qs['fields'](_0x20d57e[_0x85d2('0x37')][_0x85d2('0x3c')]));_0xea9cdb['attributes']=_0xea9cdb[_0x85d2('0x3b')][_0x85d2('0x3d')]?_0xea9cdb[_0x85d2('0x3b')]:_0x1e5c4c[_0x85d2('0x3a')];if(_0x20d57e[_0x85d2('0x37')][_0x85d2('0x49')]){_0xea9cdb[_0x85d2('0x4a')]=[{'all':!![]}];}_0xea9cdb=_[_0x85d2('0x46')]({},_0xea9cdb,_0x20d57e['options']);return db[_0x85d2('0x48')][_0x85d2('0x4f')](_0xea9cdb)[_0x85d2('0x29')](handleEntityNotFound(_0x5daad6,null))[_0x85d2('0x29')](respondWithResult(_0x5daad6,null))[_0x85d2('0x4d')](handleError(_0x5daad6,null));};exports[_0x85d2('0x50')]=function(_0x14fec3,_0x1b7297,_0x17f0ab){return db['Plugin']['find']({'where':{'id':_0x14fec3[_0x85d2('0x51')]['id']},'attributes':[_0x85d2('0x2f'),'path'],'raw':!![]})[_0x85d2('0x29')](handleEntityNotFound(_0x1b7297,null))[_0x85d2('0x29')](function(_0x22a006){if(_0x22a006){var _0x4a8b7f=path[_0x85d2('0x52')](config['root'],_0x85d2('0x53'),util[_0x85d2('0x54')](_0x85d2('0x55'),path[_0x85d2('0x56')](_0x22a006['path'])));var _0x3d2aa2=fs['createWriteStream'](_0x4a8b7f);var _0x5c7cbb=archiver(_0x85d2('0x57'),{'zlib':{'level':0x9}});_0x5c7cbb['on'](_0x85d2('0x58'),function(_0x366829){if(_0x366829[_0x85d2('0x59')]===_0x85d2('0x5a')){logger[_0x85d2('0x2d')](_0x366829);}else{throw new db['Sequelize'][(_0x85d2('0x5b'))](_0x85d2('0x5c'));}});_0x5c7cbb['on'](_0x85d2('0x2d'),function(_0x1313fd){throw new db[(_0x85d2('0x5d'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x5c7cbb[_0x85d2('0x5e')](_0x3d2aa2);_0x5c7cbb['glob']('**/*',{'cwd':path[_0x85d2('0x52')](config[_0x85d2('0x5f')],_0x85d2('0x53'),path[_0x85d2('0x60')](_0x22a006[_0x85d2('0x7')])),'ignore':[path[_0x85d2('0x52')](path[_0x85d2('0x56')](_0x22a006[_0x85d2('0x7')]),_0x85d2('0x61')),path[_0x85d2('0x52')](path[_0x85d2('0x56')](_0x22a006['path']),'attachments/**/*')],'nodir':!![]})['finalize']();_0x3d2aa2['on'](_0x85d2('0x62'),function(){if(!fs[_0x85d2('0x63')](_0x4a8b7f)){throw new db[(_0x85d2('0x5d'))][(_0x85d2('0x5b'))](_0x85d2('0x64'));}return _0x1b7297['download'](_0x4a8b7f,util[_0x85d2('0x54')](_0x85d2('0x55'),path[_0x85d2('0x56')](_0x22a006['path'])),function(_0x42762f){if(_0x42762f){throw new db[(_0x85d2('0x5d'))][(_0x85d2('0x5b'))](_0x85d2('0x65'));}fs[_0x85d2('0x66')](_0x4a8b7f);logger['info'](_0x85d2('0x67'));logger[_0x85d2('0x68')](_0x85d2('0x69'));});});}return null;})['catch'](handleError(_0x1b7297,null));};exports['upload']=function(_0x259036,_0x5f162f,_0x2bd05c){var _0x3c2c9a=path['basename'](_0x259036[_0x85d2('0x6a')][_0x85d2('0x6b')],path[_0x85d2('0x6c')](_0x259036['file'][_0x85d2('0x6b')]));var _0xff49c3=path[_0x85d2('0x52')](config['root'],_0x85d2('0x53'),_0x259036[_0x85d2('0x6a')][_0x85d2('0x6b')]);var _0xbd1d30=path[_0x85d2('0x52')](config[_0x85d2('0x5f')],'server/files/plugins',_0x3c2c9a);logger[_0x85d2('0x68')](_0x85d2('0x6d'),_0xff49c3);logger[_0x85d2('0x68')](_0x85d2('0x6e'),_0xbd1d30);try{fs[_0x85d2('0x6f')](_0xff49c3,parseInt('0777',0x8));extract(_0xff49c3,{'dir':_0xbd1d30},function(_0x3bf7ca){if(_0x3bf7ca){logger[_0x85d2('0x2d')](_0x3bf7ca);handleError(_0x3bf7ca,!![]);};var _0x40282c=fs[_0x85d2('0x70')](_0xbd1d30);if(_0x40282c[_0x85d2('0x3d')]>0x1){removeReferences(_0xff49c3,_0xbd1d30);logger[_0x85d2('0x2d')](_0x85d2('0x71'));return _0x2bd05c(new Error(_0x85d2('0x71')));}var _0x59f79e=fs['lstatSync'](path['join'](_0xbd1d30,_0x40282c[0x0]));if(_0x59f79e[_0x85d2('0x72')]()){removeReferences(_0xff49c3,_0xbd1d30);logger[_0x85d2('0x2d')](_0x85d2('0x71'));return _0x2bd05c(new Error(_0x85d2('0x71')));}if(_0x59f79e[_0x85d2('0x73')]()){var _0x27c02e=fs[_0x85d2('0x70')](path[_0x85d2('0x52')](_0xbd1d30,_0x40282c[0x0]));if(_0x27c02e[_0x85d2('0x3d')]===0x0){removeReferences(_0xff49c3,_0xbd1d30);logger[_0x85d2('0x2d')](_0x85d2('0x71'));return _0x2bd05c(new Error(_0x85d2('0x71')));}var _0x5874a9=_0x27c02e['some'](function(_0x589249){return _0x589249===_0x85d2('0x74');});if(!_0x5874a9){return _0x2bd05c(new Error(_0x85d2('0x75')));}var _0x770945=fs['readFileSync'](path[_0x85d2('0x52')](_0xbd1d30,_0x40282c[0x0],_0x85d2('0x74')));var _0x461821=JSON['parse'](_0x770945);if('undefined'==typeof _0x461821['name']){return _0x2bd05c(new Error(_0x85d2('0x76')));}if('undefined'==typeof _0x461821[_0x85d2('0x35')]){return _0x2bd05c(new Error(_0x85d2('0x77')));}if(_0x85d2('0x20')==typeof _0x461821[_0x85d2('0x78')]){return _0x2bd05c(new Error(_0x85d2('0x79')));}if(_0x85d2('0x20')==typeof _0x461821[_0x85d2('0x7a')]){return _0x2bd05c(new Error(_0x85d2('0x7b')));}if(_0x461821['type']===_0x85d2('0x7c')){if('undefined'==typeof _0x461821[_0x85d2('0x7a')][_0x85d2('0x7d')]){return _0x2bd05c(new Error(_0x85d2('0x7e')));}if(_0x85d2('0x20')==typeof _0x461821['parameters']['views']['admin']&&_0x85d2('0x20')==typeof _0x461821[_0x85d2('0x7a')][_0x85d2('0x7d')]['agent']){return _0x2bd05c(new Error(_0x85d2('0x7f')));}}else if(_0x461821[_0x85d2('0x35')]===_0x85d2('0x80')){if('undefined'==typeof _0x461821[_0x85d2('0x7a')][_0x85d2('0x81')]){return _0x2bd05c(new Error(_0x85d2('0x82')));}if(_0x85d2('0x20')==typeof _0x461821[_0x85d2('0x7a')][_0x85d2('0x83')]){return _0x2bd05c(new Error(_0x85d2('0x84')));}}else{return _0x2bd05c(new Error(_0x85d2('0x85')));}var _0x50ecdf=_0x461821[_0x85d2('0x2f')];var _0x4d12a2=_0x461821[_0x85d2('0x86')];var _0x5ea993=_0x461821['type'];var _0x32085b=_0x461821[_0x85d2('0x87')]?_0x461821[_0x85d2('0x87')]:_0x85d2('0x88');var _0x346ac2=_0x461821[_0x85d2('0x89')]?_0x461821[_0x85d2('0x89')]:'icon-apps';var _0x5aff00='';var _0x31d466='';var _0x481223='';var _0x1132cc='';var _0x33a57c=_0x461821[_0x85d2('0x78')];if(_0x5ea993===_0x85d2('0x7c')){if(_0x85d2('0x20')!=typeof _0x461821[_0x85d2('0x7a')][_0x85d2('0x7d')][_0x85d2('0x8a')]){var _0x313ca9=_0x461821[_0x85d2('0x7a')][_0x85d2('0x7d')][_0x85d2('0x8a')];if(!/^(f|ht)tps?:\/\//i['test'](_0x313ca9)){_0x5aff00=path['join'](_0x85d2('0x8b'),_0x3c2c9a,_0x40282c[0x0],_0x313ca9);}else{_0x5aff00=_0x313ca9;}}else{logger[_0x85d2('0x68')](_0x85d2('0x8c'));}if('undefined'!=typeof _0x461821[_0x85d2('0x7a')][_0x85d2('0x7d')][_0x85d2('0x8d')]){var _0x1a3bb0=_0x461821[_0x85d2('0x7a')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x85d2('0x8e')](_0x1a3bb0)){_0x31d466=path[_0x85d2('0x52')](_0x85d2('0x8b'),_0x3c2c9a,_0x40282c[0x0],_0x1a3bb0);}else{_0x31d466=_0x1a3bb0;}}else{logger[_0x85d2('0x68')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x5ea993===_0x85d2('0x80')){_0x481223=_0x461821[_0x85d2('0x7a')][_0x85d2('0x81')];_0x1132cc=_0x461821[_0x85d2('0x7a')][_0x85d2('0x83')];if('undefined'!=typeof _0x461821[_0x85d2('0x7a')][_0x85d2('0x7d')]){if(_0x85d2('0x20')!=typeof _0x461821[_0x85d2('0x7a')]['views'][_0x85d2('0x8a')]){var _0x313ca9=_0x461821[_0x85d2('0x7a')]['views'][_0x85d2('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0x85d2('0x8e')](_0x313ca9)){_0x5aff00=path[_0x85d2('0x52')](_0x85d2('0x8b'),_0x3c2c9a,_0x40282c[0x0],_0x313ca9);}else{_0x5aff00=_0x313ca9;}}if(_0x85d2('0x20')!=typeof _0x461821[_0x85d2('0x7a')][_0x85d2('0x7d')][_0x85d2('0x8d')]){var _0x1a3bb0=_0x461821[_0x85d2('0x7a')][_0x85d2('0x7d')][_0x85d2('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0x85d2('0x8e')](_0x1a3bb0)){_0x31d466=path[_0x85d2('0x52')](_0x85d2('0x8b'),_0x3c2c9a,_0x40282c[0x0],_0x1a3bb0);}else{_0x31d466=_0x1a3bb0;}}}}var _0x2e65ac={'name':_0x50ecdf,'description':_0x4d12a2,'path':path[_0x85d2('0x52')](_0x3c2c9a,_0x40282c[0x0]),'type':_0x5ea993,'sidebar':_0x32085b,'icon':_0x346ac2,'adminUrl':_0x5aff00,'agentUrl':_0x31d466,'scriptName':_0x481223,'scriptPath':_0x1132cc,'version':_0x33a57c};removeReferences(_0xff49c3,null);return db[_0x85d2('0x48')]['create'](_0x2e65ac)[_0x85d2('0x29')](function(_0x5c062a){var _0x38e00c={'role':_0x259036['body'][_0x85d2('0x8f')],'userProfileId':_0x259036[_0x85d2('0x90')]['userProfileId']};if(!_0x38e00c)throw new Error(_0x85d2('0x91'));if(_0x38e00c[_0x85d2('0x8f')]===_0x85d2('0x92')){var _0x527783=_0x5c062a[_0x85d2('0x2a')]({'plain':!![]});return db['UserProfileSection'][_0x85d2('0x4f')]({'where':{'name':_0x85d2('0x93'),'userProfileId':_0x38e00c[_0x85d2('0x94')]},'raw':!![]})[_0x85d2('0x29')](function(_0x527fe1){if(_0x527fe1&&_0x527fe1[_0x85d2('0x95')]===0x0){return db[_0x85d2('0x2b')][_0x85d2('0x96')]({'name':_0x527783['name'],'resourceId':_0x527783['id'],'type':_0x527fe1[_0x85d2('0x2f')],'sectionId':_0x527fe1['id']},{})[_0x85d2('0x29')](function(){return _0x5c062a;});}else{return _0x5c062a;}})[_0x85d2('0x4d')](function(_0x21c5a5){logger[_0x85d2('0x2d')](_0x85d2('0x97'),_0x21c5a5);throw _0x21c5a5;});}return _0x5c062a;})['then'](respondWithResult(_0x5f162f,null))['catch'](handleError(_0x5f162f,null));}});}catch(_0x2003ad){_0x5f162f[_0x85d2('0x1d')](0x1f4)[_0x85d2('0x30')](_0x2003ad);}};function removeReferences(_0x52a991,_0x288b58){try{if(_0x52a991){fs[_0x85d2('0x66')](_0x52a991);logger[_0x85d2('0x68')]('Zip\x20archive\x20removed');}if(_0x288b58){rimraf(_0x288b58,function(){});logger[_0x85d2('0x68')](_0x85d2('0x98'));}}catch(_0x4145f3){logger[_0x85d2('0x2d')](_0x4145f3);}}exports['update']=function(_0x22f265,_0x5793f8,_0x5184d9){return db['Plugin']['find']({'where':{'id':_0x22f265[_0x85d2('0x51')]['id']}})[_0x85d2('0x29')](handleEntityNotFound(_0x5793f8,null))[_0x85d2('0x29')](saveUpdates(_0x22f265['body'],null))[_0x85d2('0x29')](respondWithResult(_0x5793f8,null))['catch'](handleError(_0x5793f8,null));};exports[_0x85d2('0x99')]=function(_0x331e7d,_0x2c621b,_0x4199f8){return db[_0x85d2('0x48')][_0x85d2('0x4f')]({'where':{'id':_0x331e7d[_0x85d2('0x51')]['id']}})[_0x85d2('0x29')](function(_0x232e15){if(_0x232e15){return _0x232e15[_0x85d2('0x2c')]();}})['then'](function(_0x4e8fbb){rimraf(path[_0x85d2('0x52')](config[_0x85d2('0x5f')],_0x85d2('0x53'),path['dirname'](_0x4e8fbb[_0x85d2('0x7')])),function(){});return _0x4e8fbb;})[_0x85d2('0x29')](handleEntityNotFound(_0x2c621b,null))[_0x85d2('0x29')](respondWithStatusCode(_0x2c621b,null))[_0x85d2('0x4d')](handleError(_0x2c621b,null));};exports[_0x85d2('0x9a')]=function(_0x14b92e,_0x3a2709,_0x1bf7c2){return BPromise['resolve']()[_0x85d2('0x29')](function(){if(!_0x14b92e[_0x85d2('0x37')][_0x85d2('0x7')]){throw new Error(_0x85d2('0x9b'));}if(!_0x14b92e[_0x85d2('0x37')][_0x85d2('0x9c')]){throw new Error(_0x85d2('0x9d'));}var _0x491258=_0x14b92e[_0x85d2('0x37')][_0x85d2('0x9e')]?_0x14b92e[_0x85d2('0x37')]['hostname']+':'+_0x14b92e[_0x85d2('0x37')][_0x85d2('0x9c')]:'http://localhost:'+_0x14b92e[_0x85d2('0x37')]['port'];var _0x33c1db=_0x14b92e['query'][_0x85d2('0x24')]?_0x14b92e[_0x85d2('0x37')][_0x85d2('0x24')]:!![];var _0x560260=_0x14b92e['query']['encoding']?_0x14b92e[_0x85d2('0x37')][_0x85d2('0x9f')]:null;var _0x327ceb={'method':_0x14b92e[_0x85d2('0xa0')],'uri':util[_0x85d2('0x54')]('%s%s',_0x491258,_0x14b92e[_0x85d2('0x37')]['path']),'json':_0x33c1db,'resolveWithFullResponse':!![],'encoding':_0x560260,'qs':_0x14b92e[_0x85d2('0x37')]};if(_0x14b92e[_0x85d2('0xa1')]){_0x327ceb[_0x85d2('0xa1')]=_0x14b92e['headers'];if(_0x327ceb[_0x85d2('0xa1')]['content-length']){delete _0x327ceb['headers']['content-length'];}}if(_0x327ceb[_0x85d2('0xa1')][_0x85d2('0xa2')]){delete _0x327ceb[_0x85d2('0xa1')][_0x85d2('0xa2')];}return rp(_0x327ceb);})['then'](function(_0x3cf279){if(_0x3cf279){_0x3a2709[_0x85d2('0xa3')](_0x3cf279[_0x85d2('0xa1')]);logger[_0x85d2('0x68')](_0x3cf279[_0x85d2('0x90')]);if(_['endsWith'](_0x14b92e[_0x85d2('0x37')][_0x85d2('0x7')],_0x85d2('0x50'))&&_0x3cf279['statusCode']==0x1f4){return _0x3a2709[_0x85d2('0x1c')](_0x3cf279[_0x85d2('0xa4')]);}else{return _0x3a2709['status'](_0x3cf279[_0x85d2('0xa4')])[_0x85d2('0x30')](_0x3cf279['body']);}}else{return _0x3a2709['sendStatus'](0xc8);}})[_0x85d2('0x4d')](handleError(_0x3a2709,null));};exports[_0x85d2('0xa5')]=function(_0x8c6084,_0x5f1508,_0x55ff83){return BPromise['resolve']()[_0x85d2('0x29')](function(){if(!_0x8c6084['query'][_0x85d2('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x8c6084[_0x85d2('0x37')][_0x85d2('0x9c')]){throw new Error(_0x85d2('0x9d'));}var _0x4fe8a9=_0x8c6084[_0x85d2('0x37')][_0x85d2('0x9e')]?_0x8c6084[_0x85d2('0x37')]['hostname']+':'+_0x8c6084[_0x85d2('0x37')][_0x85d2('0x9c')]:'http://localhost:'+_0x8c6084['query'][_0x85d2('0x9c')];var _0x1be963=_0x8c6084[_0x85d2('0x37')][_0x85d2('0x24')]?_0x8c6084[_0x85d2('0x37')][_0x85d2('0x24')]:!![];var _0x3572d9=_0x8c6084[_0x85d2('0x37')]['encoding']?_0x8c6084[_0x85d2('0x37')][_0x85d2('0x9f')]:null;var _0x21761d={'method':_0x8c6084[_0x85d2('0xa0')],'uri':util[_0x85d2('0x54')](_0x85d2('0xa6'),_0x4fe8a9,_0x8c6084['query'][_0x85d2('0x7')]),'json':_0x1be963,'resolveWithFullResponse':!![],'encoding':_0x3572d9,'body':_0x8c6084['body']};if(_0x8c6084['headers']){_0x21761d[_0x85d2('0xa1')]=_0x8c6084[_0x85d2('0xa1')];if(_0x21761d[_0x85d2('0xa1')][_0x85d2('0xa7')]){delete _0x21761d[_0x85d2('0xa1')][_0x85d2('0xa7')];}}if(_0x21761d[_0x85d2('0xa1')][_0x85d2('0xa2')]){delete _0x21761d[_0x85d2('0xa1')][_0x85d2('0xa2')];}return rp(_0x21761d);})[_0x85d2('0x29')](function(_0x2defc7){if(_0x2defc7){_0x5f1508[_0x85d2('0xa3')](_0x2defc7[_0x85d2('0xa1')]);logger[_0x85d2('0x68')](_0x2defc7[_0x85d2('0x90')]);return _0x5f1508[_0x85d2('0x1d')](_0x2defc7[_0x85d2('0xa4')])[_0x85d2('0x30')](_0x2defc7[_0x85d2('0x90')]);}else{return _0x5f1508['sendStatus'](0xc8);}})['catch'](handleError(_0x5f1508,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index aa3d6ff..1143586 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 _0x41fe=['events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x56410f,_0xd93c15){var _0x520c0c=function(_0x34b014){while(--_0x34b014){_0x56410f['push'](_0x56410f['shift']());}};_0x520c0c(++_0xd93c15);}(_0x41fe,0xd1));var _0xe41f=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x41fe[_0x59befa];return _0x1dd63d;};'use strict';var EventEmitter=require(_0xe41f('0x0'));var Plugin=require(_0xe41f('0x1'))['db'][_0xe41f('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xe41f('0x3')](0x0);var events={'afterCreate':_0xe41f('0x4'),'afterUpdate':_0xe41f('0x5'),'afterDestroy':_0xe41f('0x6')};function emitEvent(_0x2fad9a){return function(_0x2e580b,_0x1c9625,_0x456a8a){PluginEvents[_0xe41f('0x7')](_0x2fad9a+':'+_0x2e580b['id'],_0x2e580b);PluginEvents[_0xe41f('0x7')](_0x2fad9a,_0x2e580b);_0x456a8a(null);};}for(var e in events){if(events[_0xe41f('0x8')](e)){var event=events[e];Plugin[_0xe41f('0x9')](e,emitEvent(event));}}module[_0xe41f('0xa')]=PluginEvents; \ No newline at end of file +var _0xc627=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Plugin','setMaxListeners'];(function(_0x59322f,_0x4f19e9){var _0x5d623e=function(_0x2f0d9f){while(--_0x2f0d9f){_0x59322f['push'](_0x59322f['shift']());}};_0x5d623e(++_0x4f19e9);}(_0xc627,0x14a));var _0x7c62=function(_0x507c8d,_0x54f59b){_0x507c8d=_0x507c8d-0x0;var _0x6052ec=_0xc627[_0x507c8d];return _0x6052ec;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x7c62('0x0'))['db'][_0x7c62('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x7c62('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7c62('0x3'),'afterDestroy':_0x7c62('0x4')};function emitEvent(_0x2f79e5){return function(_0x313d80,_0x121766,_0x35859a){PluginEvents[_0x7c62('0x5')](_0x2f79e5+':'+_0x313d80['id'],_0x313d80);PluginEvents[_0x7c62('0x5')](_0x2f79e5,_0x313d80);_0x35859a(null);};}for(var e in events){if(events[_0x7c62('0x6')](e)){var event=events[e];Plugin[_0x7c62('0x7')](e,emitEvent(event));}}module[_0x7c62('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 78e8b23..37d6979 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 _0x9fcf=['../../config/logger','api','moment','request-promise','path','rimraf','./plugin.attributes','exports','define','Plugin','plugins','lodash','util'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x9fcf,0x73));var _0xf9fc=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x9fcf[_0x220f3f];return _0x1f170e;};'use strict';var _=require(_0xf9fc('0x0'));var util=require(_0xf9fc('0x1'));var logger=require(_0xf9fc('0x2'))(_0xf9fc('0x3'));var moment=require(_0xf9fc('0x4'));var BPromise=require('bluebird');var rp=require(_0xf9fc('0x5'));var fs=require('fs');var path=require(_0xf9fc('0x6'));var rimraf=require(_0xf9fc('0x7'));var config=require('../../config/environment');var attributes=require(_0xf9fc('0x8'));module[_0xf9fc('0x9')]=function(_0x4ce323,_0x1ecca0){return _0x4ce323[_0xf9fc('0xa')](_0xf9fc('0xb'),attributes,{'tableName':_0xf9fc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda8b=['request-promise','path','rimraf','../../config/environment','exports','define','plugins','lodash','util','moment','bluebird'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xda8b,0x96));var _0xbda8=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xda8b[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0xbda8('0x0'));var util=require(_0xbda8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbda8('0x2'));var BPromise=require(_0xbda8('0x3'));var rp=require(_0xbda8('0x4'));var fs=require('fs');var path=require(_0xbda8('0x5'));var rimraf=require(_0xbda8('0x6'));var config=require(_0xbda8('0x7'));var attributes=require('./plugin.attributes');module[_0xbda8('0x8')]=function(_0x5c1361,_0x5d0dbe){return _0x5c1361[_0xbda8('0x9')]('Plugin',attributes,{'tableName':_0xbda8('0xa'),'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 bb609f6..aba7f37 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 _0xb531=['Plugin','create','body','options','CreatePlugin','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify','error','code','Plugin,\x20%s,\x20%s','message','catch'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xb531,0x1d3));var _0x1b53=function(_0x4ce4f9,_0x1e6225){_0x4ce4f9=_0x4ce4f9-0x0;var _0x1c53f5=_0xb531[_0x4ce4f9];return _0x1c53f5;};'use strict';var _=require(_0x1b53('0x0'));var util=require(_0x1b53('0x1'));var moment=require(_0x1b53('0x2'));var BPromise=require(_0x1b53('0x3'));var rs=require(_0x1b53('0x4'));var fs=require('fs');var Redis=require(_0x1b53('0x5'));var db=require(_0x1b53('0x6'))['db'];var utils=require(_0x1b53('0x7'));var logger=require(_0x1b53('0x8'))(_0x1b53('0x9'));var config=require('../../config/environment');var jayson=require(_0x1b53('0xa'));var client=jayson[_0x1b53('0xb')][_0x1b53('0xc')]({'port':0x232a});config[_0x1b53('0xd')]=_[_0x1b53('0xe')](config[_0x1b53('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x1b53('0xf'))(new Redis(config[_0x1b53('0xd')]));require('./plugin.socket')[_0x1b53('0x10')](socket);function respondWithRpcPromise(_0x5a7ea4,_0x49cae5,_0x25bc5d){return new BPromise(function(_0x17c40e,_0x49bf9d){return client[_0x1b53('0x11')](_0x5a7ea4,_0x25bc5d)[_0x1b53('0x12')](function(_0x588b1e){logger[_0x1b53('0x13')]('Plugin,\x20%s,\x20%s',_0x49cae5,_0x1b53('0x14'));logger[_0x1b53('0x15')]('Plugin,\x20%s,\x20%s,\x20%s',_0x49cae5,_0x1b53('0x14'),JSON[_0x1b53('0x16')](_0x588b1e));if(_0x588b1e[_0x1b53('0x17')]){if(_0x588b1e[_0x1b53('0x17')][_0x1b53('0x18')]===0x1f4){logger[_0x1b53('0x17')](_0x1b53('0x19'),_0x49cae5,_0x588b1e[_0x1b53('0x17')][_0x1b53('0x1a')]);return _0x49bf9d(_0x588b1e[_0x1b53('0x17')][_0x1b53('0x1a')]);}logger[_0x1b53('0x17')](_0x1b53('0x19'),_0x49cae5,_0x588b1e['error'][_0x1b53('0x1a')]);return _0x17c40e(_0x588b1e[_0x1b53('0x17')][_0x1b53('0x1a')]);}else{logger[_0x1b53('0x13')](_0x1b53('0x19'),_0x49cae5,_0x1b53('0x14'));_0x17c40e(_0x588b1e['result'][_0x1b53('0x1a')]);}})[_0x1b53('0x1b')](function(_0x524d02){logger['error'](_0x1b53('0x19'),_0x49cae5,_0x524d02);_0x49bf9d(_0x524d02);});});}exports['CreatePlugin']=function(_0x1d6c09){var _0x3c9f6f=this;return new Promise(function(_0x2b8f03,_0x209206){return db[_0x1b53('0x1c')][_0x1b53('0x1d')](_0x1d6c09[_0x1b53('0x1e')],{'raw':_0x1d6c09[_0x1b53('0x1f')]?_0x1d6c09[_0x1b53('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x1b53('0x12')](function(_0x574ec8){logger['info'](_0x1b53('0x20'),_0x1d6c09);logger['debug'](_0x1b53('0x20'),_0x1d6c09,JSON[_0x1b53('0x16')](_0x574ec8));_0x2b8f03(_0x574ec8);})[_0x1b53('0x1b')](function(_0x58634b){logger[_0x1b53('0x17')](_0x1b53('0x20'),_0x58634b[_0x1b53('0x1a')],_0x1d6c09);_0x209206(_0x3c9f6f[_0x1b53('0x17')](0x1f4,_0x58634b[_0x1b53('0x1a')]));});});}; \ No newline at end of file +var _0xc6e4=['error','code','message','request\x20sent','result','catch','Plugin','create','options','raw','then','CreatePlugin','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','socket.io-emitter','redis','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','stringify'];(function(_0x28269a,_0x48ffe2){var _0x3f3c6d=function(_0x2004ae){while(--_0x2004ae){_0x28269a['push'](_0x28269a['shift']());}};_0x3f3c6d(++_0x48ffe2);}(_0xc6e4,0x1a5));var _0x4c6e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc6e4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4c6e('0x0'));var util=require('util');var moment=require(_0x4c6e('0x1'));var BPromise=require(_0x4c6e('0x2'));var rs=require(_0x4c6e('0x3'));var fs=require('fs');var Redis=require(_0x4c6e('0x4'));var db=require(_0x4c6e('0x5'))['db'];var utils=require(_0x4c6e('0x6'));var logger=require(_0x4c6e('0x7'))(_0x4c6e('0x8'));var config=require(_0x4c6e('0x9'));var jayson=require(_0x4c6e('0xa'));var client=jayson[_0x4c6e('0xb')]['http']({'port':0x232a});config['redis']=_[_0x4c6e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4c6e('0xd'))(new Redis(config[_0x4c6e('0xe')]));require(_0x4c6e('0xf'))[_0x4c6e('0x10')](socket);function respondWithRpcPromise(_0x37cb98,_0x561dbf,_0x3dbf48){return new BPromise(function(_0xb58fe9,_0xc8ab78){return client[_0x4c6e('0x11')](_0x37cb98,_0x3dbf48)['then'](function(_0x16615b){logger[_0x4c6e('0x12')](_0x4c6e('0x13'),_0x561dbf,'request\x20sent');logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x561dbf,'request\x20sent',JSON[_0x4c6e('0x14')](_0x16615b));if(_0x16615b[_0x4c6e('0x15')]){if(_0x16615b[_0x4c6e('0x15')][_0x4c6e('0x16')]===0x1f4){logger[_0x4c6e('0x15')](_0x4c6e('0x13'),_0x561dbf,_0x16615b[_0x4c6e('0x15')][_0x4c6e('0x17')]);return _0xc8ab78(_0x16615b['error']['message']);}logger[_0x4c6e('0x15')](_0x4c6e('0x13'),_0x561dbf,_0x16615b[_0x4c6e('0x15')][_0x4c6e('0x17')]);return _0xb58fe9(_0x16615b[_0x4c6e('0x15')][_0x4c6e('0x17')]);}else{logger[_0x4c6e('0x12')](_0x4c6e('0x13'),_0x561dbf,_0x4c6e('0x18'));_0xb58fe9(_0x16615b[_0x4c6e('0x19')][_0x4c6e('0x17')]);}})[_0x4c6e('0x1a')](function(_0x377abe){logger['error'](_0x4c6e('0x13'),_0x561dbf,_0x377abe);_0xc8ab78(_0x377abe);});});}exports['CreatePlugin']=function(_0x4ed15e){var _0x24ce03=this;return new Promise(function(_0x2f2a5c,_0x33d617){return db[_0x4c6e('0x1b')][_0x4c6e('0x1c')](_0x4ed15e['body'],{'raw':_0x4ed15e[_0x4c6e('0x1d')]?_0x4ed15e[_0x4c6e('0x1d')][_0x4c6e('0x1e')]===undefined?!![]:![]:!![]})[_0x4c6e('0x1f')](function(_0x91901f){logger[_0x4c6e('0x12')](_0x4c6e('0x20'),_0x4ed15e);logger[_0x4c6e('0x21')](_0x4c6e('0x20'),_0x4ed15e,JSON[_0x4c6e('0x14')](_0x91901f));_0x2f2a5c(_0x91901f);})[_0x4c6e('0x1a')](function(_0x290933){logger[_0x4c6e('0x15')](_0x4c6e('0x20'),_0x290933[_0x4c6e('0x17')],_0x4ed15e);_0x33d617(_0x24ce03[_0x4c6e('0x15')](0x1f4,_0x290933[_0x4c6e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 7f509a4..9eab2ed 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 _0x4148=['save','remove','emit','removeListener','register','length'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x4148,0x1b6));var _0x8414=function(_0x2bebb2,_0x321313){_0x2bebb2=_0x2bebb2-0x0;var _0x277503=_0x4148[_0x2bebb2];return _0x277503;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x8414('0x0'),_0x8414('0x1'),'update'];function createListener(_0x24492f,_0x44584a){return function(_0x5f5821){_0x44584a[_0x8414('0x2')](_0x24492f,_0x5f5821);};}function removeListener(_0x485bcb,_0x1d1043){return function(){PluginEvents[_0x8414('0x3')](_0x485bcb,_0x1d1043);};}exports[_0x8414('0x4')]=function(_0x4befd5){for(var _0x5c5b57=0x0,_0x2ad558=events[_0x8414('0x5')];_0x5c5b57<_0x2ad558;_0x5c5b57++){var _0x567200=events[_0x5c5b57];var _0x5ae26e=createListener('plugin:'+_0x567200,_0x4befd5);PluginEvents['on'](_0x567200,_0x5ae26e);}}; \ No newline at end of file +var _0x8445=['remove','update','emit','register','plugin:','./plugin.events','save'];(function(_0x4af835,_0x2d5645){var _0x3e3c19=function(_0x5eed0c){while(--_0x5eed0c){_0x4af835['push'](_0x4af835['shift']());}};_0x3e3c19(++_0x2d5645);}(_0x8445,0x1c5));var _0x5844=function(_0xc1c93f,_0x1fba71){_0xc1c93f=_0xc1c93f-0x0;var _0x3f81cb=_0x8445[_0xc1c93f];return _0x3f81cb;};'use strict';var PluginEvents=require(_0x5844('0x0'));var events=[_0x5844('0x1'),_0x5844('0x2'),_0x5844('0x3')];function createListener(_0x34a2a1,_0x2d0b8a){return function(_0x4d8e81){_0x2d0b8a[_0x5844('0x4')](_0x34a2a1,_0x4d8e81);};}function removeListener(_0x4ef246,_0x5cfb72){return function(){PluginEvents['removeListener'](_0x4ef246,_0x5cfb72);};}exports[_0x5844('0x5')]=function(_0x40d0cf){for(var _0x7c16b9=0x0,_0x4fb984=events['length'];_0x7c16b9<_0x4fb984;_0x7c16b9++){var _0x3c5a51=events[_0x7c16b9];var _0x540e5b=createListener(_0x5844('0x6')+_0x3c5a51,_0x40d0cf);PluginEvents['on'](_0x3c5a51,_0x540e5b);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index eba3bd1..963b405 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(_0x3b480a,_0x1f49bc){var _0x4492d7=function(_0x398412){while(--_0x398412){_0x3b480a['push'](_0x3b480a['shift']());}};_0x4492d7(++_0x1f49bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x47e906,_0x4febba){var _0x5704d2=function(_0x300997){while(--_0x300997){_0x47e906['push'](_0x47e906['shift']());}};_0x5704d2(++_0x4febba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 9a11cdd..e4f7b4a 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 _0xb58b=['Unknown\x20status','destroy','params','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','child_process','exec','sendStatus','status','json','error','stack','name','npm\x20install','info','list','then','reject','motion2','length','describe','catch','create','body','join','../../files/plugins','script','cwd','chdir','dirname','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty'];(function(_0x59e42b,_0x570d5a){var _0x4e3e71=function(_0x43d084){while(--_0x43d084){_0x59e42b['push'](_0x59e42b['shift']());}};_0x4e3e71(++_0x570d5a);}(_0xb58b,0x1f1));var _0xbb58=function(_0x338d23,_0xd2c02c){_0x338d23=_0x338d23-0x0;var _0x28e528=_0xb58b[_0x338d23];return _0x28e528;};'use strict';var _=require('lodash');var pm2=require(_0xbb58('0x0'));var logger=require(_0xbb58('0x1'))(_0xbb58('0x2'));var path=require('path');var exec=require(_0xbb58('0x3'))[_0xbb58('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x226363,_0x546510){return function(_0x2edb10){if(!_0x2edb10){_0x226363[_0xbb58('0x5')](0x194);;}return _0x2edb10;};}function respondWithResult(_0x33fe85,_0x5cf8b1){_0x5cf8b1=_0x5cf8b1||0xc8;return function(_0x27cbda){if(_0x27cbda){return _0x33fe85[_0xbb58('0x6')](_0x5cf8b1)[_0xbb58('0x7')](_0x27cbda);}return null;};}function handleError(_0x5d7fe8,_0xd94f1){_0xd94f1=_0xd94f1||0x1f4;return function(_0x3e3144){logger[_0xbb58('0x8')](_0x3e3144[_0xbb58('0x9')]);if(_0x3e3144[_0xbb58('0xa')]){delete _0x3e3144[_0xbb58('0xa')];}_0x5d7fe8[_0xbb58('0x6')](_0xd94f1)['send'](_0x3e3144);};}function execChildProcess(){return new BPromise(function(_0x80ab3a,_0x5c3bf7){exec(_0xbb58('0xb'),function(_0x440392,_0x26d8e6,_0x19d185){logger['info'](_0x26d8e6);logger[_0xbb58('0xc')](_0x19d185);if(_0x440392){logger[_0xbb58('0x8')](_0x440392);return _0x5c3bf7(_0x440392);}return _0x80ab3a(_0x26d8e6);});});}exports['index']=function(_0x132511,_0xdc68b9){return pm2[_0xbb58('0xd')]()[_0xbb58('0xe')](function(_0x19ceda){if(_0x19ceda){var _0x58245f=_[_0xbb58('0xf')](_0x19ceda,function(_0x23fd15){return _0x23fd15['name']==='express'||_0x23fd15[_0xbb58('0xa')]===_0xbb58('0x10');});return{'rows':_0x58245f,'count':_0x58245f[_0xbb58('0x11')]};}return null;})['then'](respondWithResult(_0xdc68b9,null))['catch'](handleError(_0xdc68b9,null));};exports['show']=function(_0x55156e,_0x28637b){return pm2[_0xbb58('0x12')](_0x55156e['params']['id'])[_0xbb58('0xe')](respondWithResult(_0x28637b,null))['then'](handleEntityNotFound(_0x28637b,null))[_0xbb58('0x13')](handleError(_0x28637b,null));};exports[_0xbb58('0x14')]=function(_0x3c33d9,_0xb8f982){if(_0x3c33d9[_0xbb58('0x15')][_0xbb58('0xa')]&&_0x3c33d9[_0xbb58('0x15')]['script']){var _0x84f34=path[_0xbb58('0x16')](__dirname,_0xbb58('0x17'),_0x3c33d9[_0xbb58('0x15')][_0xbb58('0x18')]);var _0x5d4a91=process[_0xbb58('0x19')]();process[_0xbb58('0x1a')](path[_0xbb58('0x1b')](_0x84f34));return execChildProcess()['then'](function(_0x27806d){process['chdir'](_0x5d4a91);return pm2[_0xbb58('0x1c')]({'name':_0x3c33d9[_0xbb58('0x15')][_0xbb58('0xa')],'script':_0x84f34});})[_0xbb58('0xe')](function(_0x2d111c){pm2[_0xbb58('0x1d')]();return _0x2d111c[0x0];})[_0xbb58('0xe')](respondWithResult(_0xb8f982,0xc9))[_0xbb58('0x13')](handleError(_0xb8f982,null));}else{return _0xb8f982['status'](0x1f4)[_0xbb58('0x1e')]({'message':_0xbb58('0x1f')});}};exports[_0xbb58('0x20')]=function(_0x129094,_0x8e9ed9){if(_0x129094[_0xbb58('0x15')]['id']){delete _0x129094[_0xbb58('0x15')]['id'];}var _0x2ce7c3={'online':_0xbb58('0x21'),'stopped':_0xbb58('0x22')};if(_0x2ce7c3[_0xbb58('0x23')](_0x129094[_0xbb58('0x15')][_0xbb58('0x6')])){return pm2[_0x2ce7c3[_0x129094[_0xbb58('0x15')][_0xbb58('0x6')]]](_0x129094['params']['id'])[_0xbb58('0xe')](respondWithResult(_0x8e9ed9,0xc8))[_0xbb58('0x13')](handleError(_0x8e9ed9,null));}else{return _0x8e9ed9[_0xbb58('0x6')](0x1f4)[_0xbb58('0x1e')]({'message':_0xbb58('0x24')});}};exports[_0xbb58('0x25')]=function(_0x1ba526,_0x643e0e){if(_0x1ba526[_0xbb58('0x15')]['id']){delete _0x1ba526['body']['id'];}if(_0x1ba526[_0xbb58('0x26')]['id']){return pm2[_0xbb58('0x27')](_0x1ba526[_0xbb58('0x26')]['id'])[_0xbb58('0xe')](function(_0xdbbe7b){pm2[_0xbb58('0x1d')]();return _0xdbbe7b[0x0];})[_0xbb58('0xe')](respondWithResult(_0x643e0e,null))[_0xbb58('0x13')](handleError(_0x643e0e,null));}else{return _0x643e0e[_0xbb58('0x6')](0x1f4)[_0xbb58('0x1e')]({'message':_0xbb58('0x28')});}}; \ No newline at end of file +var _0x68fc=['join','../../files/plugins','script','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','restart','stop','Unknown\x20status','destroy','lodash','../../config/pm2','../../config/logger','child_process','bluebird','sendStatus','json','error','stack','name','status','send','npm\x20install','info','index','then','reject','express','motion2','catch','show','describe','params','create','body'];(function(_0x2631f2,_0x44e391){var _0x389ebf=function(_0x17fea3){while(--_0x17fea3){_0x2631f2['push'](_0x2631f2['shift']());}};_0x389ebf(++_0x44e391);}(_0x68fc,0xa5));var _0xc68f=function(_0x3e46bc,_0x2cc5d2){_0x3e46bc=_0x3e46bc-0x0;var _0x253db8=_0x68fc[_0x3e46bc];return _0x253db8;};'use strict';var _=require(_0xc68f('0x0'));var pm2=require(_0xc68f('0x1'));var logger=require(_0xc68f('0x2'))('api');var path=require('path');var exec=require(_0xc68f('0x3'))['exec'];var BPromise=require(_0xc68f('0x4'));function handleEntityNotFound(_0x593648,_0x5899ea){return function(_0x3b2744){if(!_0x3b2744){_0x593648[_0xc68f('0x5')](0x194);;}return _0x3b2744;};}function respondWithResult(_0x1c6df9,_0x363cdf){_0x363cdf=_0x363cdf||0xc8;return function(_0x4fcce4){if(_0x4fcce4){return _0x1c6df9['status'](_0x363cdf)[_0xc68f('0x6')](_0x4fcce4);}return null;};}function handleError(_0x2bf3fd,_0x370977){_0x370977=_0x370977||0x1f4;return function(_0x17aaaa){logger[_0xc68f('0x7')](_0x17aaaa[_0xc68f('0x8')]);if(_0x17aaaa[_0xc68f('0x9')]){delete _0x17aaaa[_0xc68f('0x9')];}_0x2bf3fd[_0xc68f('0xa')](_0x370977)[_0xc68f('0xb')](_0x17aaaa);};}function execChildProcess(){return new BPromise(function(_0x5777f9,_0x3b1a43){exec(_0xc68f('0xc'),function(_0x1f2758,_0x1d4ae4,_0x2f0694){logger[_0xc68f('0xd')](_0x1d4ae4);logger[_0xc68f('0xd')](_0x2f0694);if(_0x1f2758){logger[_0xc68f('0x7')](_0x1f2758);return _0x3b1a43(_0x1f2758);}return _0x5777f9(_0x1d4ae4);});});}exports[_0xc68f('0xe')]=function(_0x4112df,_0x31fb86){return pm2['list']()[_0xc68f('0xf')](function(_0x90ccbd){if(_0x90ccbd){var _0x2b1d30=_[_0xc68f('0x10')](_0x90ccbd,function(_0x286ed4){return _0x286ed4[_0xc68f('0x9')]===_0xc68f('0x11')||_0x286ed4[_0xc68f('0x9')]===_0xc68f('0x12');});return{'rows':_0x2b1d30,'count':_0x2b1d30['length']};}return null;})['then'](respondWithResult(_0x31fb86,null))[_0xc68f('0x13')](handleError(_0x31fb86,null));};exports[_0xc68f('0x14')]=function(_0x171eea,_0x3714f7){return pm2[_0xc68f('0x15')](_0x171eea[_0xc68f('0x16')]['id'])['then'](respondWithResult(_0x3714f7,null))[_0xc68f('0xf')](handleEntityNotFound(_0x3714f7,null))[_0xc68f('0x13')](handleError(_0x3714f7,null));};exports[_0xc68f('0x17')]=function(_0x2c058c,_0x5068fd){if(_0x2c058c[_0xc68f('0x18')][_0xc68f('0x9')]&&_0x2c058c[_0xc68f('0x18')]['script']){var _0xcc11a3=path[_0xc68f('0x19')](__dirname,_0xc68f('0x1a'),_0x2c058c['body'][_0xc68f('0x1b')]);var _0x1daac5=process[_0xc68f('0x1c')]();process[_0xc68f('0x1d')](path[_0xc68f('0x1e')](_0xcc11a3));return execChildProcess()[_0xc68f('0xf')](function(_0x2412a9){process['chdir'](_0x1daac5);return pm2[_0xc68f('0x1f')]({'name':_0x2c058c[_0xc68f('0x18')]['name'],'script':_0xcc11a3});})[_0xc68f('0xf')](function(_0x8399e6){pm2[_0xc68f('0x20')]();return _0x8399e6[0x0];})[_0xc68f('0xf')](respondWithResult(_0x5068fd,0xc9))[_0xc68f('0x13')](handleError(_0x5068fd,null));}else{return _0x5068fd['status'](0x1f4)[_0xc68f('0xb')]({'message':_0xc68f('0x21')});}};exports['update']=function(_0x38b935,_0x27e5b8){if(_0x38b935['body']['id']){delete _0x38b935[_0xc68f('0x18')]['id'];}var _0xdde47e={'online':_0xc68f('0x22'),'stopped':_0xc68f('0x23')};if(_0xdde47e['hasOwnProperty'](_0x38b935[_0xc68f('0x18')][_0xc68f('0xa')])){return pm2[_0xdde47e[_0x38b935[_0xc68f('0x18')][_0xc68f('0xa')]]](_0x38b935[_0xc68f('0x16')]['id'])[_0xc68f('0xf')](respondWithResult(_0x27e5b8,0xc8))[_0xc68f('0x13')](handleError(_0x27e5b8,null));}else{return _0x27e5b8[_0xc68f('0xa')](0x1f4)['send']({'message':_0xc68f('0x24')});}};exports[_0xc68f('0x25')]=function(_0x4b64da,_0x323677){if(_0x4b64da[_0xc68f('0x18')]['id']){delete _0x4b64da[_0xc68f('0x18')]['id'];}if(_0x4b64da[_0xc68f('0x16')]['id']){return pm2['delete'](_0x4b64da[_0xc68f('0x16')]['id'])[_0xc68f('0xf')](function(_0x56a82e){pm2[_0xc68f('0x20')]();return _0x56a82e[0x0];})[_0xc68f('0xf')](respondWithResult(_0x323677,null))[_0xc68f('0x13')](handleError(_0x323677,null));}else{return _0x323677[_0xc68f('0xa')](0x1f4)[_0xc68f('0xb')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 3dfb85a..bb1f93a 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 _0xff9c=['/agents','isAuthenticated','getAgents','/queues','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get'];(function(_0x6b0a18,_0x5b26e6){var _0x1d522c=function(_0xb9bef9){while(--_0xb9bef9){_0x6b0a18['push'](_0x6b0a18['shift']());}};_0x1d522c(++_0x5b26e6);}(_0xff9c,0x150));var _0xcff9=function(_0x2b95cd,_0x518917){_0x2b95cd=_0x2b95cd-0x0;var _0x37469b=_0xff9c[_0x2b95cd];return _0x37469b;};'use strict';var express=require(_0xcff9('0x0'));var router=express[_0xcff9('0x1')]();var auth=require(_0xcff9('0x2'));var controller=require(_0xcff9('0x3'));router[_0xcff9('0x4')](_0xcff9('0x5'),auth[_0xcff9('0x6')](),controller[_0xcff9('0x7')]);router[_0xcff9('0x4')](_0xcff9('0x8'),auth[_0xcff9('0x6')](),controller[_0xcff9('0x9')]);module[_0xcff9('0xa')]=router; \ No newline at end of file +var _0xdeff=['getQueues','exports','express','Router','./realtime.controller','/agents','isAuthenticated','getAgents','get'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xdeff,0x1d6));var _0xfdef=function(_0x2a390b,_0xf49f9b){_0x2a390b=_0x2a390b-0x0;var _0x5df10a=_0xdeff[_0x2a390b];return _0x5df10a;};'use strict';var express=require(_0xfdef('0x0'));var router=express[_0xfdef('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xfdef('0x2'));router['get'](_0xfdef('0x3'),auth[_0xfdef('0x4')](),controller[_0xfdef('0x5')]);router[_0xfdef('0x6')]('/queues',auth[_0xfdef('0x4')](),controller[_0xfdef('0x7')]);module[_0xfdef('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index a16ddc1..2505f6c 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 _0x8708=['fieldName','type','key','role','agent','getOptions','raw','length','push','sequelize','literal','forEach','Pause','where','merge','user','userProfileId','online','assign','omit','UserProfile','getResources','findAndCountAll','find','filterAgentAttributes','getAgentStatus','pause','voiceStatus','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','resolve','format','startCase','Queue','rawAttributes','name','voice','outbound','dialMethod','QueueCampaigns','filter','getRealtimeQueues','initializeQueues','lodash','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','handleError','offset','undefined','count','limit','set','json','getAgents','getChannels','globalQueueFilter','query','globalStatusFilter','pauseTypeFilter','*pause','then','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','channel','toLowerCase','sort','includes','globalStatus','validateSortParameter','fields','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','map'];(function(_0x49c2d8,_0x463e0e){var _0x3252aa=function(_0x3ccd8b){while(--_0x3ccd8b){_0x49c2d8['push'](_0x49c2d8['shift']());}};_0x3252aa(++_0x463e0e);}(_0x8708,0xd7));var _0x8870=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x8708[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x8870('0x0'));var util=require('util');var rta=require(_0x8870('0x1'));var rtq=require(_0x8870('0x2'));var qs=require(_0x8870('0x3'));var utils=require(_0x8870('0x4'));var db=require(_0x8870('0x5'))['db'];var APIBadRequestError=require(_0x8870('0x6'))['APIBadRequestError'];var APIHandleError=require(_0x8870('0x6'))[_0x8870('0x7')];function respondWithFilteredResult(_0x504b37,_0x48f08d){return function(_0x1d9684){if(_0x1d9684){var _0x1e6e86=typeof _0x48f08d[_0x8870('0x8')]===_0x8870('0x9')&&typeof _0x48f08d['limit']===_0x8870('0x9');var _0x393d2a=_0x1d9684[_0x8870('0xa')];var _0x1a2b04=_0x1e6e86?0x0:_0x48f08d[_0x8870('0x8')];var _0x43fa30=_0x1e6e86?_0x1d9684[_0x8870('0xa')]:_0x48f08d[_0x8870('0x8')]+_0x48f08d[_0x8870('0xb')];var _0x31da93;if(_0x43fa30>=_0x393d2a){_0x43fa30=_0x393d2a;_0x31da93=0xc8;}else{_0x31da93=0xce;}_0x504b37['status'](_0x31da93);return _0x504b37[_0x8870('0xc')]('Content-Range',_0x1a2b04+'-'+_0x43fa30+'/'+_0x393d2a)[_0x8870('0xd')](_0x1d9684);}return null;};}exports[_0x8870('0xe')]=function(_0x41f068,_0x223c31){var _0x3464f4={'count':0x0,'rows':[]};var _0x185044={};var _0x5251d5;var _0x3bb4d4=utils[_0x8870('0xf')]();var _0x4b0ea7;var _0x44d8a9;var _0x1c55b0=_0x41f068['query'][_0x8870('0x10')];var _0x116ea3=_0x41f068[_0x8870('0x11')][_0x8870('0x12')];var _0x18358f=_0x41f068[_0x8870('0x11')][_0x8870('0x13')];var _0x8e2c98=_0x116ea3==='pause'||_0x116ea3===_0x8870('0x14')?!![]:![];var _0x49bebf=[];var _0x35f890;var _0x44d7e1;Promise['resolve']()[_0x8870('0x15')](function(){if(_0x41f068['query']['channel']){if(!utils[_0x8870('0x16')](_0x41f068[_0x8870('0x11')]['channel'])){throw new APIBadRequestError(util['format'](_0x8870('0x17'),_0x41f068[_0x8870('0x11')][_0x8870('0x18')]));}_0x5251d5=_0x41f068[_0x8870('0x11')][_0x8870('0x18')][_0x8870('0x19')]();}if(!_0x41f068[_0x8870('0x11')][_0x8870('0x1a')]||!_0x41f068[_0x8870('0x11')][_0x8870('0x1a')][_0x8870('0x1b')](_0x8870('0x1c'))){_0x41f068[_0x8870('0x11')]['sort']=rta[_0x8870('0x1d')](_0x41f068['query'][_0x8870('0x1a')]);return;}var _0x5a7e5c=rta['getUpdatedSortOptions'](_0x41f068[_0x8870('0x11')][_0x8870('0x1a')]);_0x41f068[_0x8870('0x11')][_0x8870('0x1a')]=_0x5a7e5c[_0x8870('0x1e')]['join'](',');_0x35f890=_0x5a7e5c[_0x8870('0x1f')];})['then'](function(){if(!_0x1c55b0){return[];}return rta[_0x8870('0x20')](_0x1c55b0,_0x5251d5);})['then'](function(_0x4327a2){_0x49bebf=_0x4327a2;return rta[_0x8870('0x21')]();})[_0x8870('0x15')](function(_0x3a408f){_0x44d8a9=_0x3a408f[_0x8870('0x22')];if((!_0x116ea3||_0x8e2c98)&&!_0x35f890){return _0x49bebf;}if(_0x35f890&&!_0x116ea3){return rta[_0x8870('0x23')](_0x44d8a9,_0x49bebf,_0x35f890);}else{return rta['getAgentIdsByStatus'](_0x44d8a9,_0x49bebf,_0x116ea3);}})[_0x8870('0x15')](function(_0x57c6af){_0x49bebf=_0x57c6af;var _0x201563=![];if(_0x49bebf['length']===0x0){if(_0x1c55b0||_0x116ea3){_0x201563=!![];}if(_0x8e2c98){_0x201563=![];}}if(_0x201563){return _0x3464f4;}var _0x582b13=_[_0x8870('0x24')](db['User']['rawAttributes'],function(_0x258017){return{'name':_0x258017[_0x8870('0x25')],'type':_0x258017[_0x8870('0x26')][_0x8870('0x27')]};});_0x41f068[_0x8870('0x11')][_0x8870('0x28')]=_0x8870('0x29');_0x185044=qs[_0x8870('0x2a')](_0x582b13,_0x41f068);_0x185044[_0x8870('0x2b')]=!![];var _0x40d12d=[];if(_0x49bebf[_0x8870('0x2c')]>0x0){_0x40d12d[_0x8870('0x2d')]({'id':{'$in':_0x49bebf}});if(_0x35f890&&!_0x116ea3){_0x44d7e1=[db[_0x8870('0x2e')][_0x8870('0x2f')]('FIELD(id,'+_0x49bebf+')')];_0x185044[_0x8870('0x1f')]=_0x44d7e1;}}if(_0x8e2c98){_0x3bb4d4[_0x8870('0x30')](function(_0x41f0c9){var _0x402e21=!![];if(_0x116ea3===_0x8870('0x14')&&_0x5251d5!==_0x41f0c9){_0x402e21=![];}_0x40d12d['push']({[_0x41f0c9+_0x8870('0x31')]:_0x402e21});});if(_0x18358f){_0x40d12d[_0x8870('0x2d')]({'pauseType':_0x18358f});}}else if(_0x116ea3){_0x3bb4d4[_0x8870('0x30')](function(_0x356a7e){_0x40d12d[_0x8870('0x2d')]({[_0x356a7e+'Pause']:![]});});}_0x185044[_0x8870('0x32')]=_[_0x8870('0x33')](_0x185044[_0x8870('0x32')],{'$and':_0x40d12d});if(_0x41f068[_0x8870('0x34')]['role']==='user'){var _0x3acac1={'params':{'id':_0x41f068[_0x8870('0x34')][_0x8870('0x35')]},'query':{'section':'Agents','role':_0x8870('0x29'),'raw':!![],'ids':_0x49bebf,'customSorting':_0x44d7e1}};if(_0x41f068[_0x8870('0x11')][_0x8870('0x36')]){_0x3acac1[_0x8870('0x11')][_0x8870('0x36')]=!![];}if(_0x8e2c98){_0x3acac1['query']['extraQueryConditions']=_0x40d12d;}_0x3acac1[_0x8870('0x11')]=Object[_0x8870('0x37')](_0x3acac1[_0x8870('0x11')],_[_0x8870('0x38')](_0x41f068[_0x8870('0x11')],'id'));return db[_0x8870('0x39')][_0x8870('0x3a')](_0x3acac1);}return db['User'][_0x8870('0x3b')](_0x185044);})[_0x8870('0x15')](function(_0x50d44a){_0x3464f4['count']=_0x50d44a[_0x8870('0xa')];_0x4b0ea7=_0x50d44a[_0x8870('0x22')];return _0x4b0ea7[_0x8870('0x24')](function(_0x51f01c){var _0x5612d3=_[_0x8870('0x3c')](_0x44d8a9,['id',_0x51f01c['id']]);if(_0x5612d3){var _0x469bf8=rta[_0x8870('0x3d')](_0x5612d3);_[_0x8870('0x33')](_0x51f01c,_0x469bf8);}_0x51f01c[_0x8870('0x1c')]=rta[_0x8870('0x3e')](_0x51f01c);if(_0x51f01c[_0x8870('0x1c')][_0x8870('0x1b')](_0x8870('0x3f'))){_0x3bb4d4[_0x8870('0x30')](function(_0x4d4686){if(_0x51f01c[_0x4d4686+'Pause']){if(_0x4d4686==='voice'){if(_0x51f01c[_0x8870('0x40')]!=='talking'){_0x51f01c['voiceStatus']='pause';}}else{_0x51f01c[_0x4d4686+_0x8870('0x41')]=_0x8870('0x3f');}}});}return _0x51f01c;});})[_0x8870('0x15')](function(_0x1f05ce){if(!_0x35f890||_0x44d7e1){return _0x1f05ce;}return rta[_0x8870('0x42')](_0x1f05ce,_0x35f890);})[_0x8870('0x15')](function(_0x56ae24){var _0xa0aff3=rta[_0x8870('0x43')]();_0x3464f4[_0x8870('0x22')]=_0x56ae24[_0x8870('0x24')](function(_0x3a3014){return _[_0x8870('0x44')](_0x3a3014,_0xa0aff3);});return _0x3464f4;})['then'](respondWithFilteredResult(_0x223c31,_0x185044))[_0x8870('0x45')](APIHandleError(_0x223c31));};exports[_0x8870('0x46')]=function(_0xfb1d9c,_0x1b33cd){var _0x46b170={'count':0x0,'rows':[]};var _0x14547e={};var _0xba6df2;var _0x2ab1fb;var _0x2517a7;Promise[_0x8870('0x47')]()[_0x8870('0x15')](function(){if(_0xfb1d9c[_0x8870('0x11')][_0x8870('0x18')]){if(!utils['isValidChannel'](_0xfb1d9c[_0x8870('0x11')]['channel'])){throw new APIBadRequestError(util[_0x8870('0x48')](_0x8870('0x17'),_0xfb1d9c[_0x8870('0x11')][_0x8870('0x18')]));}_0xba6df2=_0xfb1d9c[_0x8870('0x11')]['channel'][_0x8870('0x19')]();}var _0x3d433d=_[_0x8870('0x49')](_0xba6df2)+_0x8870('0x4a');var _0x1d3c44=_[_0x8870('0x24')](db[_0x3d433d][_0x8870('0x4b')],function(_0x527ace){return{'name':_0x527ace[_0x8870('0x25')],'type':_0x527ace[_0x8870('0x26')][_0x8870('0x27')]};});if(!_0xfb1d9c['query'][_0x8870('0x1e')]){var _0x325b13=['id',_0x8870('0x4c')];if(_0xba6df2===_0x8870('0x4d')){_0x325b13[_0x8870('0x2d')](_0x8870('0x26'));if(_0xfb1d9c[_0x8870('0x11')][_0x8870('0x26')]===_0x8870('0x4e')){_0x325b13[_0x8870('0x2d')](['dialActive',_0x8870('0x4f')]);}}_0xfb1d9c[_0x8870('0x11')][_0x8870('0x1e')]=_0x325b13['join'](',');}_0x14547e=qs[_0x8870('0x2a')](_0x1d3c44,_0xfb1d9c);if(_0xfb1d9c[_0x8870('0x34')]['role']===_0x8870('0x34')){var _0x1db0ec={'params':{'id':_0xfb1d9c[_0x8870('0x34')][_0x8870('0x35')]},'query':{'section':_0xba6df2===_0x8870('0x4d')&&_0xfb1d9c[_0x8870('0x11')][_0x8870('0x26')]==='outbound'?_0x8870('0x50'):_[_0x8870('0x49')](_0xba6df2)+'Queues','type':_0xfb1d9c['query']['type'],'nolimit':!![],'sort':_0x8870('0x4c'),'filter':_0xfb1d9c['query'][_0x8870('0x51')]}};_0x1db0ec[_0x8870('0x11')]=Object[_0x8870('0x37')](_0x1db0ec[_0x8870('0x11')],_0xfb1d9c['query']);delete _0x1db0ec['query']['id'];return db['UserProfile'][_0x8870('0x3a')](_0x1db0ec);}return db[_0x3d433d][_0x8870('0x3b')](_0x14547e);})['then'](function(_0x4f7af8){_0x46b170['count']=_0x4f7af8[_0x8870('0xa')];_0x2ab1fb=_0x4f7af8[_0x8870('0x22')];return rtq[_0x8870('0x52')](_0xfb1d9c,_0xba6df2);})[_0x8870('0x15')](function(_0x381ebc){_0x2517a7=_0x381ebc[_0x8870('0x22')];return rtq[_0x8870('0x53')](_0x2ab1fb,_0x2517a7,_0xba6df2,_0xfb1d9c['query'][_0x8870('0x26')]);})['then'](function(_0x11d847){_0x46b170[_0x8870('0x22')]=_0x11d847;return _0x46b170;})[_0x8870('0x15')](respondWithFilteredResult(_0x1b33cd,_0x14547e))[_0x8870('0x45')](APIHandleError(_0x1b33cd));}; \ No newline at end of file +var _0xe7da=['dialActive','dialMethod','QueueCampaigns','startCase','Queues','filter','util','../../components/realtime/agents','../../components/realtime/queues','../../config/utils','../../mysqldb','APIBadRequestError','../../errors/api','offset','limit','undefined','count','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','isValidChannel','channel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','then','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','length','push','sequelize','literal','forEach','Pause','where','merge','user','userProfileId','Agents','online','assign','omit','UserProfile','getResources','findAndCountAll','find','filterAgentAttributes','getAgentStatus','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','format','Queue','name','voice','outbound'];(function(_0x516510,_0x529cef){var _0x1dfde4=function(_0x7cb6d){while(--_0x7cb6d){_0x516510['push'](_0x516510['shift']());}};_0x1dfde4(++_0x529cef);}(_0xe7da,0x114));var _0xae7d=function(_0x5d89cb,_0x8129b4){_0x5d89cb=_0x5d89cb-0x0;var _0x47e564=_0xe7da[_0x5d89cb];return _0x47e564;};'use strict';var _=require('lodash');var util=require(_0xae7d('0x0'));var rta=require(_0xae7d('0x1'));var rtq=require(_0xae7d('0x2'));var qs=require('../../components/parsers/qs');var utils=require(_0xae7d('0x3'));var db=require(_0xae7d('0x4'))['db'];var APIBadRequestError=require('../../errors/api')[_0xae7d('0x5')];var APIHandleError=require(_0xae7d('0x6'))['handleError'];function respondWithFilteredResult(_0x9cee67,_0x5c17aa){return function(_0x3c33a8){if(_0x3c33a8){var _0x44db22=typeof _0x5c17aa[_0xae7d('0x7')]==='undefined'&&typeof _0x5c17aa[_0xae7d('0x8')]===_0xae7d('0x9');var _0x500e8e=_0x3c33a8[_0xae7d('0xa')];var _0x32796d=_0x44db22?0x0:_0x5c17aa[_0xae7d('0x7')];var _0x248fbb=_0x44db22?_0x3c33a8['count']:_0x5c17aa['offset']+_0x5c17aa[_0xae7d('0x8')];var _0x47c529;if(_0x248fbb>=_0x500e8e){_0x248fbb=_0x500e8e;_0x47c529=0xc8;}else{_0x47c529=0xce;}_0x9cee67[_0xae7d('0xb')](_0x47c529);return _0x9cee67[_0xae7d('0xc')](_0xae7d('0xd'),_0x32796d+'-'+_0x248fbb+'/'+_0x500e8e)[_0xae7d('0xe')](_0x3c33a8);}return null;};}exports[_0xae7d('0xf')]=function(_0x5f54e7,_0x406a5a){var _0x383ecc={'count':0x0,'rows':[]};var _0x34d023={};var _0x48bbd8;var _0x5d7168=utils[_0xae7d('0x10')]();var _0xe1416;var _0x1c28d5;var _0x593618=_0x5f54e7[_0xae7d('0x11')][_0xae7d('0x12')];var _0x4d53c4=_0x5f54e7[_0xae7d('0x11')][_0xae7d('0x13')];var _0x42fff0=_0x5f54e7[_0xae7d('0x11')][_0xae7d('0x14')];var _0x9a8a22=_0x4d53c4===_0xae7d('0x15')||_0x4d53c4===_0xae7d('0x16')?!![]:![];var _0x1418d7=[];var _0x39116b;var _0x3a9584;Promise[_0xae7d('0x17')]()['then'](function(){if(_0x5f54e7[_0xae7d('0x11')]['channel']){if(!utils[_0xae7d('0x18')](_0x5f54e7['query'][_0xae7d('0x19')])){throw new APIBadRequestError(util['format'](_0xae7d('0x1a'),_0x5f54e7[_0xae7d('0x11')][_0xae7d('0x19')]));}_0x48bbd8=_0x5f54e7[_0xae7d('0x11')][_0xae7d('0x19')][_0xae7d('0x1b')]();}if(!_0x5f54e7[_0xae7d('0x11')][_0xae7d('0x1c')]||!_0x5f54e7['query'][_0xae7d('0x1c')]['includes'](_0xae7d('0x1d'))){_0x5f54e7[_0xae7d('0x11')]['sort']=rta[_0xae7d('0x1e')](_0x5f54e7[_0xae7d('0x11')][_0xae7d('0x1c')]);return;}var _0x5b1bd2=rta[_0xae7d('0x1f')](_0x5f54e7['query'][_0xae7d('0x1c')]);_0x5f54e7['query'][_0xae7d('0x1c')]=_0x5b1bd2[_0xae7d('0x20')][_0xae7d('0x21')](',');_0x39116b=_0x5b1bd2[_0xae7d('0x22')];})[_0xae7d('0x23')](function(){if(!_0x593618){return[];}return rta[_0xae7d('0x24')](_0x593618,_0x48bbd8);})[_0xae7d('0x23')](function(_0x249559){_0x1418d7=_0x249559;return rta[_0xae7d('0x25')]();})[_0xae7d('0x23')](function(_0x2512bf){_0x1c28d5=_0x2512bf[_0xae7d('0x26')];if((!_0x4d53c4||_0x9a8a22)&&!_0x39116b){return _0x1418d7;}if(_0x39116b&&!_0x4d53c4){return rta[_0xae7d('0x27')](_0x1c28d5,_0x1418d7,_0x39116b);}else{return rta[_0xae7d('0x28')](_0x1c28d5,_0x1418d7,_0x4d53c4);}})[_0xae7d('0x23')](function(_0x3d1059){_0x1418d7=_0x3d1059;var _0x56738f=![];if(_0x1418d7['length']===0x0){if(_0x593618||_0x4d53c4){_0x56738f=!![];}if(_0x9a8a22){_0x56738f=![];}}if(_0x56738f){return _0x383ecc;}var _0x1cb2c5=_[_0xae7d('0x29')](db[_0xae7d('0x2a')][_0xae7d('0x2b')],function(_0xcc73ca){return{'name':_0xcc73ca[_0xae7d('0x2c')],'type':_0xcc73ca[_0xae7d('0x2d')][_0xae7d('0x2e')]};});_0x5f54e7[_0xae7d('0x11')][_0xae7d('0x2f')]=_0xae7d('0x30');_0x34d023=qs[_0xae7d('0x31')](_0x1cb2c5,_0x5f54e7);_0x34d023[_0xae7d('0x32')]=!![];var _0xead536=[];if(_0x1418d7[_0xae7d('0x33')]>0x0){_0xead536[_0xae7d('0x34')]({'id':{'$in':_0x1418d7}});if(_0x39116b&&!_0x4d53c4){_0x3a9584=[db[_0xae7d('0x35')][_0xae7d('0x36')]('FIELD(id,'+_0x1418d7+')')];_0x34d023[_0xae7d('0x22')]=_0x3a9584;}}if(_0x9a8a22){_0x5d7168[_0xae7d('0x37')](function(_0x289638){var _0x576594=!![];if(_0x4d53c4===_0xae7d('0x16')&&_0x48bbd8!==_0x289638){_0x576594=![];}_0xead536['push']({[_0x289638+_0xae7d('0x38')]:_0x576594});});if(_0x42fff0){_0xead536['push']({'pauseType':_0x42fff0});}}else if(_0x4d53c4){_0x5d7168[_0xae7d('0x37')](function(_0x91a6ae){_0xead536[_0xae7d('0x34')]({[_0x91a6ae+_0xae7d('0x38')]:![]});});}_0x34d023[_0xae7d('0x39')]=_[_0xae7d('0x3a')](_0x34d023[_0xae7d('0x39')],{'$and':_0xead536});if(_0x5f54e7['user'][_0xae7d('0x2f')]==='user'){var _0x1f42ae={'params':{'id':_0x5f54e7[_0xae7d('0x3b')][_0xae7d('0x3c')]},'query':{'section':_0xae7d('0x3d'),'role':_0xae7d('0x30'),'raw':!![],'ids':_0x1418d7,'customSorting':_0x3a9584}};if(_0x5f54e7['query']['online']){_0x1f42ae[_0xae7d('0x11')][_0xae7d('0x3e')]=!![];}if(_0x9a8a22){_0x1f42ae[_0xae7d('0x11')]['extraQueryConditions']=_0xead536;}_0x1f42ae['query']=Object[_0xae7d('0x3f')](_0x1f42ae[_0xae7d('0x11')],_[_0xae7d('0x40')](_0x5f54e7['query'],'id'));return db[_0xae7d('0x41')][_0xae7d('0x42')](_0x1f42ae);}return db[_0xae7d('0x2a')][_0xae7d('0x43')](_0x34d023);})[_0xae7d('0x23')](function(_0x4f8de1){_0x383ecc[_0xae7d('0xa')]=_0x4f8de1[_0xae7d('0xa')];_0xe1416=_0x4f8de1[_0xae7d('0x26')];return _0xe1416[_0xae7d('0x29')](function(_0x4f7887){var _0xe47d27=_[_0xae7d('0x44')](_0x1c28d5,['id',_0x4f7887['id']]);if(_0xe47d27){var _0x3d361d=rta[_0xae7d('0x45')](_0xe47d27);_['merge'](_0x4f7887,_0x3d361d);}_0x4f7887[_0xae7d('0x1d')]=rta[_0xae7d('0x46')](_0x4f7887);if(_0x4f7887[_0xae7d('0x1d')]['includes'](_0xae7d('0x15'))){_0x5d7168[_0xae7d('0x37')](function(_0x5d8a76){if(_0x4f7887[_0x5d8a76+_0xae7d('0x38')]){if(_0x5d8a76==='voice'){if(_0x4f7887[_0xae7d('0x47')]!==_0xae7d('0x48')){_0x4f7887['voiceStatus']='pause';}}else{_0x4f7887[_0x5d8a76+_0xae7d('0x49')]=_0xae7d('0x15');}}});}return _0x4f7887;});})[_0xae7d('0x23')](function(_0x5bde9f){if(!_0x39116b||_0x3a9584){return _0x5bde9f;}return rta[_0xae7d('0x4a')](_0x5bde9f,_0x39116b);})[_0xae7d('0x23')](function(_0x6c900b){var _0x355b5=rta[_0xae7d('0x4b')]();_0x383ecc[_0xae7d('0x26')]=_0x6c900b[_0xae7d('0x29')](function(_0x588585){return _[_0xae7d('0x4c')](_0x588585,_0x355b5);});return _0x383ecc;})[_0xae7d('0x23')](respondWithFilteredResult(_0x406a5a,_0x34d023))[_0xae7d('0x4d')](APIHandleError(_0x406a5a));};exports[_0xae7d('0x4e')]=function(_0x23ce29,_0x51b36c){var _0x330f00={'count':0x0,'rows':[]};var _0x20b484={};var _0x45591f;var _0xe76da0;var _0x4afe22;Promise[_0xae7d('0x17')]()['then'](function(){if(_0x23ce29['query']['channel']){if(!utils[_0xae7d('0x18')](_0x23ce29[_0xae7d('0x11')][_0xae7d('0x19')])){throw new APIBadRequestError(util[_0xae7d('0x4f')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x23ce29[_0xae7d('0x11')]['channel']));}_0x45591f=_0x23ce29[_0xae7d('0x11')][_0xae7d('0x19')][_0xae7d('0x1b')]();}var _0x4707e9=_['startCase'](_0x45591f)+_0xae7d('0x50');var _0x104e14=_['map'](db[_0x4707e9][_0xae7d('0x2b')],function(_0x31ac9b){return{'name':_0x31ac9b[_0xae7d('0x2c')],'type':_0x31ac9b['type'][_0xae7d('0x2e')]};});if(!_0x23ce29[_0xae7d('0x11')][_0xae7d('0x20')]){var _0x16a40e=['id',_0xae7d('0x51')];if(_0x45591f===_0xae7d('0x52')){_0x16a40e[_0xae7d('0x34')](_0xae7d('0x2d'));if(_0x23ce29[_0xae7d('0x11')][_0xae7d('0x2d')]===_0xae7d('0x53')){_0x16a40e['push']([_0xae7d('0x54'),_0xae7d('0x55')]);}}_0x23ce29[_0xae7d('0x11')][_0xae7d('0x20')]=_0x16a40e[_0xae7d('0x21')](',');}_0x20b484=qs[_0xae7d('0x31')](_0x104e14,_0x23ce29);if(_0x23ce29[_0xae7d('0x3b')][_0xae7d('0x2f')]===_0xae7d('0x3b')){var _0x8583ac={'params':{'id':_0x23ce29[_0xae7d('0x3b')][_0xae7d('0x3c')]},'query':{'section':_0x45591f===_0xae7d('0x52')&&_0x23ce29[_0xae7d('0x11')]['type']===_0xae7d('0x53')?_0xae7d('0x56'):_[_0xae7d('0x57')](_0x45591f)+_0xae7d('0x58'),'type':_0x23ce29['query'][_0xae7d('0x2d')],'nolimit':!![],'sort':'name','filter':_0x23ce29[_0xae7d('0x11')][_0xae7d('0x59')]}};_0x8583ac[_0xae7d('0x11')]=Object[_0xae7d('0x3f')](_0x8583ac['query'],_0x23ce29[_0xae7d('0x11')]);delete _0x8583ac['query']['id'];return db[_0xae7d('0x41')][_0xae7d('0x42')](_0x8583ac);}return db[_0x4707e9][_0xae7d('0x43')](_0x20b484);})[_0xae7d('0x23')](function(_0x214a1a){_0x330f00['count']=_0x214a1a[_0xae7d('0xa')];_0xe76da0=_0x214a1a[_0xae7d('0x26')];return rtq['getRealtimeQueues'](_0x23ce29,_0x45591f);})['then'](function(_0x3a7e12){_0x4afe22=_0x3a7e12[_0xae7d('0x26')];return rtq['initializeQueues'](_0xe76da0,_0x4afe22,_0x45591f,_0x23ce29[_0xae7d('0x11')][_0xae7d('0x2d')]);})['then'](function(_0x158839){_0x330f00[_0xae7d('0x26')]=_0x158839;return _0x330f00;})[_0xae7d('0x23')](respondWithFilteredResult(_0x51b36c,_0x20b484))[_0xae7d('0x4d')](APIHandleError(_0x51b36c));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index f8d136e..4099f4d 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x543078,_0x599b3f){var _0x1d7a64=function(_0x8ea43e){while(--_0x8ea43e){_0x543078['push'](_0x543078['shift']());}};_0x1d7a64(++_0x599b3f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5280f4,_0x3c36d0){_0x5280f4=_0x5280f4-0x0;var _0xba93e7=_0xcb91[_0x5280f4];return _0xba93e7;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2b91c4,_0x3f45f3){var _0x49b634=function(_0x5e0aa2){while(--_0x5e0aa2){_0x2b91c4['push'](_0x2b91c4['shift']());}};_0x49b634(++_0x3f45f3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1b5aea,_0x1afe6f){_0x1b5aea=_0x1b5aea-0x0;var _0x51cae9=_0xcb91[_0x1b5aea];return _0x51cae9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 4b9cc3a..9e026aa 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 _0x1623=['sequelize','STRING','DATE'];(function(_0x3f8f5c,_0x461c6e){var _0x51f351=function(_0x7cc97e){while(--_0x7cc97e){_0x3f8f5c['push'](_0x3f8f5c['shift']());}};_0x51f351(++_0x461c6e);}(_0x1623,0xab));var _0x3162=function(_0x381d3a,_0x384f3a){_0x381d3a=_0x381d3a-0x0;var _0x5ec67e=_0x1623[_0x381d3a];return _0x5ec67e;};'use strict';var Sequelize=require(_0x3162('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x3162('0x1')]},'scheduledat':{'type':Sequelize[_0x3162('0x2')]},'uniqueid':{'type':Sequelize[_0x3162('0x1')]},'starttime':{'type':Sequelize[_0x3162('0x2')]},'responsetime':{'type':Sequelize[_0x3162('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x3162('0x1')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x90b1=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x4a64a6,_0x8d107e){var _0x399583=function(_0x186a2a){while(--_0x186a2a){_0x4a64a6['push'](_0x4a64a6['shift']());}};_0x399583(++_0x8d107e);}(_0x90b1,0x1bb));var _0x190b=function(_0x1a0557,_0x2a0db7){_0x1a0557=_0x1a0557-0x0;var _0x1ad015=_0x90b1[_0x1a0557];return _0x1ad015;};'use strict';var Sequelize=require(_0x190b('0x0'));module[_0x190b('0x1')]={'state':{'type':Sequelize[_0x190b('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x190b('0x3')]},'starttime':{'type':Sequelize[_0x190b('0x4')]},'responsetime':{'type':Sequelize[_0x190b('0x4')]},'ringtime':{'type':Sequelize[_0x190b('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 7b91137..cd4887a 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 _0x0f2c=['moment','bluebird','request-promise','path','rimraf','exports','define','ReportAgentPreview','report_agent_preview','util','../../config/logger','api'];(function(_0x1d90fd,_0x415a11){var _0x548870=function(_0x1c1d8b){while(--_0x1c1d8b){_0x1d90fd['push'](_0x1d90fd['shift']());}};_0x548870(++_0x415a11);}(_0x0f2c,0x189));var _0xc0f2=function(_0x3d46e1,_0x118be0){_0x3d46e1=_0x3d46e1-0x0;var _0x3ae735=_0x0f2c[_0x3d46e1];return _0x3ae735;};'use strict';var _=require('lodash');var util=require(_0xc0f2('0x0'));var logger=require(_0xc0f2('0x1'))(_0xc0f2('0x2'));var moment=require(_0xc0f2('0x3'));var BPromise=require(_0xc0f2('0x4'));var rp=require(_0xc0f2('0x5'));var fs=require('fs');var path=require(_0xc0f2('0x6'));var rimraf=require(_0xc0f2('0x7'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module[_0xc0f2('0x8')]=function(_0x3628d4,_0x2674f5){return _0x3628d4[_0xc0f2('0x9')](_0xc0f2('0xa'),attributes,{'tableName':_0xc0f2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x45ed=['path','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash','util','api','moment','bluebird'];(function(_0x398a08,_0x1c53e9){var _0x250703=function(_0x14f64e){while(--_0x14f64e){_0x398a08['push'](_0x398a08['shift']());}};_0x250703(++_0x1c53e9);}(_0x45ed,0x1df));var _0xd45e=function(_0x5c9e08,_0x14a8e6){_0x5c9e08=_0x5c9e08-0x0;var _0x502e01=_0x45ed[_0x5c9e08];return _0x502e01;};'use strict';var _=require(_0xd45e('0x0'));var util=require(_0xd45e('0x1'));var logger=require('../../config/logger')(_0xd45e('0x2'));var moment=require(_0xd45e('0x3'));var BPromise=require(_0xd45e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd45e('0x5'));var rimraf=require('rimraf');var config=require(_0xd45e('0x6'));var attributes=require(_0xd45e('0x7'));module['exports']=function(_0xb0105,_0x3a09b9){return _0xb0105[_0xd45e('0x8')](_0xd45e('0x9'),attributes,{'tableName':_0xd45e('0xa'),'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 a57a57e..f6f9aee 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 _0x1799=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','lodash','moment','bluebird'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0x1799,0x19d));var _0x9179=function(_0x5cb49b,_0x564e5f){_0x5cb49b=_0x5cb49b-0x0;var _0x4b6c42=_0x1799[_0x5cb49b];return _0x4b6c42;};'use strict';var _=require(_0x9179('0x0'));var util=require('util');var moment=require(_0x9179('0x1'));var BPromise=require(_0x9179('0x2'));var rs=require(_0x9179('0x3'));var fs=require('fs');var Redis=require(_0x9179('0x4'));var db=require(_0x9179('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9179('0x6'))('rpc');var config=require(_0x9179('0x7'));var jayson=require(_0x9179('0x8'));var client=jayson['client'][_0x9179('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x240824,_0x893668,_0x48c29a){return new BPromise(function(_0x3b6684,_0x1ebc46){return client[_0x9179('0xa')](_0x240824,_0x48c29a)[_0x9179('0xb')](function(_0x4e9d5e){logger[_0x9179('0xc')](_0x9179('0xd'),_0x893668,_0x9179('0xe'));logger['debug'](_0x9179('0xf'),_0x893668,_0x9179('0xe'),JSON[_0x9179('0x10')](_0x4e9d5e));if(_0x4e9d5e[_0x9179('0x11')]){if(_0x4e9d5e['error']['code']===0x1f4){logger[_0x9179('0x11')](_0x9179('0xd'),_0x893668,_0x4e9d5e[_0x9179('0x11')]['message']);return _0x1ebc46(_0x4e9d5e[_0x9179('0x11')][_0x9179('0x12')]);}logger[_0x9179('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x893668,_0x4e9d5e['error'][_0x9179('0x12')]);return _0x3b6684(_0x4e9d5e[_0x9179('0x11')]['message']);}else{logger[_0x9179('0xc')](_0x9179('0xd'),_0x893668,_0x9179('0xe'));_0x3b6684(_0x4e9d5e[_0x9179('0x13')]['message']);}})[_0x9179('0x14')](function(_0x5c3663){logger[_0x9179('0x11')](_0x9179('0xd'),_0x893668,_0x5c3663);_0x1ebc46(_0x5c3663);});});}exports[_0x9179('0x15')]=function(_0x40c705){var _0x5c7391=this;return new Promise(function(_0x739110,_0x1c6b86){return db[_0x9179('0x16')][_0x9179('0x17')](_0x40c705[_0x9179('0x18')],{'raw':_0x40c705[_0x9179('0x19')]?_0x40c705[_0x9179('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x9179('0xb')](function(_0x585c4f){logger[_0x9179('0xc')](_0x9179('0x15'),_0x40c705);logger['debug'](_0x9179('0x15'),_0x40c705,JSON[_0x9179('0x10')](_0x585c4f));_0x739110(_0x585c4f);})[_0x9179('0x14')](function(_0x56fa68){logger[_0x9179('0x11')](_0x9179('0x15'),_0x56fa68[_0x9179('0x12')],_0x40c705);_0x1c6b86(_0x5c7391[_0x9179('0x11')](0x1f4,_0x56fa68[_0x9179('0x12')]));});});}; \ No newline at end of file +var _0x5238=['jayson/promise','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','body','options','raw','CreateReportAgentPreview','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x5982e2,_0x2b1f34){var _0x2d7f1b=function(_0x1614e1){while(--_0x1614e1){_0x5982e2['push'](_0x5982e2['shift']());}};_0x2d7f1b(++_0x2b1f34);}(_0x5238,0x198));var _0x8523=function(_0x4b05b6,_0x230371){_0x4b05b6=_0x4b05b6-0x0;var _0x17f96b=_0x5238[_0x4b05b6];return _0x17f96b;};'use strict';var _=require('lodash');var util=require(_0x8523('0x0'));var moment=require(_0x8523('0x1'));var BPromise=require(_0x8523('0x2'));var rs=require(_0x8523('0x3'));var fs=require('fs');var Redis=require(_0x8523('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8523('0x5'));var logger=require(_0x8523('0x6'))('rpc');var config=require(_0x8523('0x7'));var jayson=require(_0x8523('0x8'));var client=jayson['client'][_0x8523('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b50aa,_0x2124ee,_0x4677be){return new BPromise(function(_0x2b664f,_0x2ca71f){return client[_0x8523('0xa')](_0x1b50aa,_0x4677be)[_0x8523('0xb')](function(_0x22d14b){logger[_0x8523('0xc')](_0x8523('0xd'),_0x2124ee,_0x8523('0xe'));logger[_0x8523('0xf')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x2124ee,_0x8523('0xe'),JSON['stringify'](_0x22d14b));if(_0x22d14b[_0x8523('0x10')]){if(_0x22d14b['error'][_0x8523('0x11')]===0x1f4){logger[_0x8523('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x2124ee,_0x22d14b[_0x8523('0x10')]['message']);return _0x2ca71f(_0x22d14b['error']['message']);}logger['error'](_0x8523('0xd'),_0x2124ee,_0x22d14b[_0x8523('0x10')][_0x8523('0x12')]);return _0x2b664f(_0x22d14b['error'][_0x8523('0x12')]);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x2124ee,_0x8523('0xe'));_0x2b664f(_0x22d14b[_0x8523('0x13')][_0x8523('0x12')]);}})[_0x8523('0x14')](function(_0x1eb8bb){logger[_0x8523('0x10')](_0x8523('0xd'),_0x2124ee,_0x1eb8bb);_0x2ca71f(_0x1eb8bb);});});}exports['CreateReportAgentPreview']=function(_0x1a9557){var _0xbccc64=this;return new Promise(function(_0x532c8e,_0x226dbb){return db['ReportAgentPreview']['create'](_0x1a9557[_0x8523('0x15')],{'raw':_0x1a9557[_0x8523('0x16')]?_0x1a9557['options'][_0x8523('0x17')]===undefined?!![]:![]:!![]})[_0x8523('0xb')](function(_0x2a9e5c){logger[_0x8523('0xc')](_0x8523('0x18'),_0x1a9557);logger[_0x8523('0xf')](_0x8523('0x18'),_0x1a9557,JSON[_0x8523('0x19')](_0x2a9e5c));_0x532c8e(_0x2a9e5c);})['catch'](function(_0xb26cdb){logger[_0x8523('0x10')](_0x8523('0x18'),_0xb26cdb['message'],_0x1a9557);_0x226dbb(_0xbccc64[_0x8523('0x10')](0x1f4,_0xb26cdb[_0x8523('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 5ba7be0..3d17523 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 _0x1790=['faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','util','path','express','Router','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','/outbound','outbound','/agents','agents','/agents/:id/capacity','/telephones','trunks','/campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x1790,0x1a4));var _0x0179=function(_0x1a6de3,_0x2af93c){_0x1a6de3=_0x1a6de3-0x0;var _0x297303=_0x1790[_0x1a6de3];return _0x297303;};'use strict';var multer=require('multer');var util=require(_0x0179('0x0'));var path=require(_0x0179('0x1'));var express=require(_0x0179('0x2'));var router=express[_0x0179('0x3')]();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router[_0x0179('0x4')](_0x0179('0x5'),auth[_0x0179('0x6')](),controller[_0x0179('0x7')]);router[_0x0179('0x4')](_0x0179('0x8'),auth[_0x0179('0x6')](),controller[_0x0179('0x9')]);router['get'](_0x0179('0xa'),auth[_0x0179('0x6')](),controller['voiceChannelStopMixMonitor']);router[_0x0179('0x4')]('/voice/queues',auth[_0x0179('0x6')](),controller[_0x0179('0xb')]);router[_0x0179('0x4')]('/chat/queues',auth[_0x0179('0x6')](),controller[_0x0179('0xc')]);router[_0x0179('0x4')](_0x0179('0xd'),auth[_0x0179('0x6')](),controller[_0x0179('0xe')]);router[_0x0179('0x4')](_0x0179('0xf'),auth[_0x0179('0x6')](),controller[_0x0179('0x10')]);router['get'](_0x0179('0x11'),auth[_0x0179('0x6')](),controller[_0x0179('0x12')]);router[_0x0179('0x4')](_0x0179('0x13'),auth[_0x0179('0x6')](),controller[_0x0179('0x14')]);router[_0x0179('0x4')]('/whatsapp/queues',auth[_0x0179('0x6')](),controller[_0x0179('0x15')]);router[_0x0179('0x4')]('/fax/queues',auth[_0x0179('0x6')](),controller[_0x0179('0x16')]);router[_0x0179('0x4')](_0x0179('0x17'),auth[_0x0179('0x6')](),controller['voiceQueuesPreview']);router[_0x0179('0x4')](_0x0179('0x18'),auth[_0x0179('0x6')](),controller[_0x0179('0x19')]);router[_0x0179('0x4')]('/voice/queues/channels/:uniqueid',auth[_0x0179('0x6')](),controller[_0x0179('0x1a')]);router['get'](_0x0179('0x1b'),auth[_0x0179('0x6')](),controller[_0x0179('0x1c')]);router[_0x0179('0x4')](_0x0179('0x1d'),auth[_0x0179('0x6')](),controller[_0x0179('0x1e')]);router[_0x0179('0x4')](_0x0179('0x1f'),auth[_0x0179('0x6')](),controller['showVoiceQueues']);router[_0x0179('0x20')](_0x0179('0x1f'),auth[_0x0179('0x6')](),controller['updateVoiceQueue']);router[_0x0179('0x4')](_0x0179('0x21'),auth[_0x0179('0x6')](),controller[_0x0179('0x22')]);router[_0x0179('0x4')]('/outbound/channels',auth[_0x0179('0x6')](),controller['outboundChannels']);router[_0x0179('0x4')](_0x0179('0x23'),auth[_0x0179('0x6')](),controller[_0x0179('0x24')]);router[_0x0179('0x20')](_0x0179('0x25'),auth[_0x0179('0x6')](),controller['agentCapacity']);router[_0x0179('0x4')](_0x0179('0x26'),auth['isAuthenticated'](),controller['telephones']);router[_0x0179('0x4')]('/trunks',auth[_0x0179('0x6')](),controller[_0x0179('0x27')]);router[_0x0179('0x4')](_0x0179('0x28'),auth['isAuthenticated'](),controller['campaigns']);router[_0x0179('0x4')](_0x0179('0x29'),auth[_0x0179('0x6')](),controller[_0x0179('0x2a')]);router[_0x0179('0x4')]('/chat/queues/waitinginteractions',auth[_0x0179('0x6')](),controller[_0x0179('0x2b')]);router[_0x0179('0x4')](_0x0179('0x2c'),auth['isAuthenticated'](),controller[_0x0179('0x2d')]);router[_0x0179('0x4')](_0x0179('0x2e'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0x0179('0x4')](_0x0179('0x2f'),auth[_0x0179('0x6')](),controller[_0x0179('0x30')]);router['get'](_0x0179('0x31'),auth[_0x0179('0x6')](),controller[_0x0179('0x32')]);router[_0x0179('0x4')](_0x0179('0x33'),auth[_0x0179('0x6')](),controller[_0x0179('0x34')]);router[_0x0179('0x4')](_0x0179('0x35'),auth[_0x0179('0x6')](),controller[_0x0179('0x36')]);router[_0x0179('0x37')](_0x0179('0x38'),auth[_0x0179('0x6')](),controller[_0x0179('0x39')](_0x0179('0x3a')));router[_0x0179('0x4')](_0x0179('0x3b'),auth[_0x0179('0x6')](),controller[_0x0179('0x3c')]);router[_0x0179('0x37')](_0x0179('0x3d'),auth[_0x0179('0x6')](),controller[_0x0179('0x39')](_0x0179('0x3e')));router[_0x0179('0x4')]('/chat/queues/:id',auth[_0x0179('0x6')](),controller[_0x0179('0x3f')]);router['post'](_0x0179('0x40'),auth[_0x0179('0x6')](),controller['queueNotify']('fax'));router[_0x0179('0x4')]('/fax/queues/:id',auth['isAuthenticated'](),controller[_0x0179('0x41')]);router[_0x0179('0x37')](_0x0179('0x42'),auth[_0x0179('0x6')](),controller[_0x0179('0x39')](_0x0179('0x43')));router['get'](_0x0179('0x44'),auth[_0x0179('0x6')](),controller[_0x0179('0x45')]);router[_0x0179('0x37')](_0x0179('0x46'),auth[_0x0179('0x6')](),controller[_0x0179('0x39')]('sms'));router[_0x0179('0x37')](_0x0179('0x47'),auth[_0x0179('0x6')](),controller[_0x0179('0x39')](_0x0179('0x48')));router['get'](_0x0179('0x49'),auth[_0x0179('0x6')](),controller[_0x0179('0x4a')]);router[_0x0179('0x4')](_0x0179('0x4b'),auth[_0x0179('0x6')](),controller['showWhatsappQueues']);router[_0x0179('0x37')](_0x0179('0x4c'),auth[_0x0179('0x6')](),controller[_0x0179('0x4d')]);module[_0x0179('0x4e')]=router; \ No newline at end of file +var _0xc29e=['/outbound','agents','agentCapacity','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id','showMailQueues','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','Router','../../components/auth/service','./rpc.controller','/voice/channels','get','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','faxQueues','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue'];(function(_0x4704e1,_0x159a76){var _0x334d38=function(_0x531d02){while(--_0x531d02){_0x4704e1['push'](_0x4704e1['shift']());}};_0x334d38(++_0x159a76);}(_0xc29e,0x70));var _0xec29=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xc29e[_0x513aa5];return _0x1a1a7c;};'use strict';var multer=require(_0xec29('0x0'));var util=require(_0xec29('0x1'));var path=require(_0xec29('0x2'));var express=require('express');var router=express[_0xec29('0x3')]();var auth=require(_0xec29('0x4'));var controller=require(_0xec29('0x5'));router['get'](_0xec29('0x6'),auth['isAuthenticated'](),controller['voiceChannels']);router[_0xec29('0x7')](_0xec29('0x8'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0xec29('0x7')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xec29('0x9')](),controller[_0xec29('0xa')]);router[_0xec29('0x7')]('/voice/queues',auth['isAuthenticated'](),controller[_0xec29('0xb')]);router[_0xec29('0x7')](_0xec29('0xc'),auth['isAuthenticated'](),controller[_0xec29('0xd')]);router['get'](_0xec29('0xe'),auth[_0xec29('0x9')](),controller[_0xec29('0xf')]);router[_0xec29('0x7')]('/mail/accounts',auth[_0xec29('0x9')](),controller[_0xec29('0x10')]);router[_0xec29('0x7')](_0xec29('0x11'),auth[_0xec29('0x9')](),controller[_0xec29('0x12')]);router[_0xec29('0x7')]('/sms/queues',auth[_0xec29('0x9')](),controller[_0xec29('0x13')]);router[_0xec29('0x7')](_0xec29('0x14'),auth[_0xec29('0x9')](),controller['whatsappQueues']);router[_0xec29('0x7')]('/fax/queues',auth['isAuthenticated'](),controller[_0xec29('0x15')]);router[_0xec29('0x7')]('/voice/queues/preview/:id',auth[_0xec29('0x9')](),controller['voiceQueuesPreview']);router['get']('/voice/queues/channels',auth[_0xec29('0x9')](),controller[_0xec29('0x16')]);router[_0xec29('0x7')](_0xec29('0x17'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router['get']('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0xec29('0x18')]);router['get'](_0xec29('0x19'),auth[_0xec29('0x9')](),controller['voiceQueuesChannelRedirect']);router[_0xec29('0x7')](_0xec29('0x1a'),auth[_0xec29('0x9')](),controller[_0xec29('0x1b')]);router[_0xec29('0x1c')](_0xec29('0x1a'),auth[_0xec29('0x9')](),controller[_0xec29('0x1d')]);router['get'](_0xec29('0x1e'),auth['isAuthenticated'](),controller['outbound']);router[_0xec29('0x7')]('/outbound/channels',auth[_0xec29('0x9')](),controller['outboundChannels']);router[_0xec29('0x7')]('/agents',auth[_0xec29('0x9')](),controller[_0xec29('0x1f')]);router[_0xec29('0x1c')]('/agents/:id/capacity',auth[_0xec29('0x9')](),controller[_0xec29('0x20')]);router[_0xec29('0x7')]('/telephones',auth['isAuthenticated'](),controller[_0xec29('0x21')]);router[_0xec29('0x7')](_0xec29('0x22'),auth[_0xec29('0x9')](),controller[_0xec29('0x23')]);router['get'](_0xec29('0x24'),auth[_0xec29('0x9')](),controller[_0xec29('0x25')]);router[_0xec29('0x7')](_0xec29('0x26'),auth[_0xec29('0x9')](),controller[_0xec29('0x27')]);router[_0xec29('0x7')](_0xec29('0x28'),auth[_0xec29('0x9')](),controller['chatQueuesWaitingInteractions']);router[_0xec29('0x7')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xec29('0x29')]);router[_0xec29('0x7')](_0xec29('0x2a'),auth[_0xec29('0x9')](),controller[_0xec29('0x2b')]);router['get'](_0xec29('0x2c'),auth[_0xec29('0x9')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xec29('0x7')](_0xec29('0x2d'),auth[_0xec29('0x9')](),controller['smsQueuesWaitingInteractions']);router['get'](_0xec29('0x2e'),auth[_0xec29('0x9')](),controller[_0xec29('0x2f')]);router[_0xec29('0x7')](_0xec29('0x30'),auth[_0xec29('0x9')](),controller[_0xec29('0x31')]);router[_0xec29('0x32')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify']('mail'));router[_0xec29('0x7')](_0xec29('0x33'),auth[_0xec29('0x9')](),controller[_0xec29('0x34')]);router['post']('/chat/queues/:id/notify',auth[_0xec29('0x9')](),controller[_0xec29('0x35')](_0xec29('0x36')));router[_0xec29('0x7')](_0xec29('0x37'),auth['isAuthenticated'](),controller[_0xec29('0x38')]);router[_0xec29('0x32')](_0xec29('0x39'),auth[_0xec29('0x9')](),controller[_0xec29('0x35')]('fax'));router[_0xec29('0x7')](_0xec29('0x3a'),auth[_0xec29('0x9')](),controller[_0xec29('0x3b')]);router[_0xec29('0x32')](_0xec29('0x3c'),auth['isAuthenticated'](),controller[_0xec29('0x35')]('openchannel'));router[_0xec29('0x7')](_0xec29('0x3d'),auth[_0xec29('0x9')](),controller[_0xec29('0x3e')]);router[_0xec29('0x32')](_0xec29('0x3f'),auth['isAuthenticated'](),controller[_0xec29('0x35')](_0xec29('0x40')));router[_0xec29('0x32')](_0xec29('0x41'),auth[_0xec29('0x9')](),controller[_0xec29('0x35')]('whatsapp'));router[_0xec29('0x7')]('/sms/queues/:id',auth[_0xec29('0x9')](),controller[_0xec29('0x42')]);router[_0xec29('0x7')](_0xec29('0x43'),auth[_0xec29('0x9')](),controller[_0xec29('0x44')]);router[_0xec29('0x32')](_0xec29('0x45'),auth['isAuthenticated'](),controller[_0xec29('0x46')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index fe3449c..5305817 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 _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x52d17c,_0x211d5c){var _0x453e41=function(_0x4b3538){while(--_0x4b3538){_0x52d17c['push'](_0x52d17c['shift']());}};_0x453e41(++_0x211d5c);}(_0xe706,0xa3));var _0x6e70=function(_0x5089ea,_0x3d8378){_0x5089ea=_0x5089ea-0x0;var _0xabe953=_0xe706[_0x5089ea];return _0xabe953;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file +var _0xbaf0=['MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','Agent\x20not\x20found','InteractionId','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions'];(function(_0x705a26,_0x514596){var _0x3132df=function(_0x21b28f){while(--_0x21b28f){_0x705a26['push'](_0x705a26['shift']());}};_0x3132df(++_0x514596);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var db=require(_0x0baf('0x3'))['db'];var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232a});var mailClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232b});var routingClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){var _0x5f20aa=_0x1d0a0d?_0x1d0a0d:amiClient;return _0x5f20aa[_0x0baf('0x8')](_0x1a10b1,_0x2dcaac)[_0x0baf('0x9')](function(_0x465528){if(_0x465528[_0x0baf('0xa')]){if(_0x465528[_0x0baf('0xa')][_0x0baf('0xb')]===0x1f4){return _0x11b947(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}return _0x5f5030(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}else{_0x5f5030(_0x465528[_0x0baf('0xd')]);}})['catch'](function(_0x5a53e2){_0x11b947(_0x5a53e2);});});}function respondWithResult(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xc8;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0xe')](_0xe4378c)['json'](_0x5db689);}return _0x465dd7[_0x0baf('0xf')](0x194);};}function handleError(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0x1f4;return function(_0x1f50c3){logger[_0x0baf('0xa')](_0x1f50c3[_0x0baf('0x10')]);if(_0x1f50c3[_0x0baf('0x11')]){delete _0x1f50c3[_0x0baf('0x11')];}_0x49e44b['status'](_0x1c76a8)['send'](_0x1f50c3);};}function findById(_0x2312c7){return function(_0x38395b){if(!_[_0x0baf('0x12')](_0x2312c7)&&!_[_0x0baf('0x12')](_0x38395b)&&!_[_0x0baf('0x12')](_0x38395b[_0x0baf('0x13')])){return _['find'](_0x38395b[_0x0baf('0x13')],function(_0xfbecec){return _0xfbecec['id']==_0x2312c7;});}return null;};}exports[_0x0baf('0x14')]=function(_0x3e9cb4,_0x47070d){return respondWithRpcPromise(_0x0baf('0x15'),_0x3e9cb4['query'])['then'](respondWithResult(_0x47070d,null))[_0x0baf('0x16')](handleError(_0x47070d,null));};exports[_0x0baf('0x17')]=function(_0x32e839,_0x1848e8){return respondWithRpcPromise(_0x0baf('0x18'),_[_0x0baf('0x19')](_0x32e839[_0x0baf('0x1a')],_0x32e839[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1848e8,null))[_0x0baf('0x16')](handleError(_0x1848e8,null));};exports['voiceChannelStopMixMonitor']=function(_0x334bd6,_0x482522){return respondWithRpcPromise(_0x0baf('0x1c'),_['merge'](_0x334bd6['query'],_0x334bd6[_0x0baf('0x1b')]))['then'](respondWithResult(_0x482522,null))['catch'](handleError(_0x482522,null));};exports[_0x0baf('0x1d')]=function(_0x27b59c,_0x34e264){return respondWithRpcPromise(_0x0baf('0x1e'),_0x27b59c[_0x0baf('0x1a')])['then'](respondWithResult(_0x34e264,null))[_0x0baf('0x16')](handleError(_0x34e264,null));};exports[_0x0baf('0x1f')]=function(_0x1ca35a,_0x366e71){return respondWithRpcPromise(_0x0baf('0x1e'),_0x1ca35a[_0x0baf('0x1a')])[_0x0baf('0x9')](findById(_0x1ca35a['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x366e71,null))[_0x0baf('0x16')](handleError(_0x366e71,null));};exports[_0x0baf('0x20')]=function(_0x265915,_0x55c715){return respondWithRpcPromise(_0x0baf('0x21'),_[_0x0baf('0x19')](_0x265915['body'],_0x265915[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x55c715,null))[_0x0baf('0x16')](handleError(_0x55c715,null));};exports[_0x0baf('0x22')]=function(_0xd14f0f,_0x366924){return respondWithRpcPromise(_0x0baf('0x23'),_['merge'](_0xd14f0f[_0x0baf('0x1a')],_0xd14f0f[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x366924,null))[_0x0baf('0x16')](handleError(_0x366924,null));};exports[_0x0baf('0x24')]=function(_0x275ea1,_0x2fc983){return respondWithRpcPromise(_0x0baf('0x25'),_0x275ea1[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x2fc983,null))[_0x0baf('0x16')](handleError(_0x2fc983,null));};exports[_0x0baf('0x26')]=function(_0x45294a,_0x3a3353){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0baf('0x19')](_0x45294a['query'],_0x45294a[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x3a3353,null))[_0x0baf('0x16')](handleError(_0x3a3353,null));};exports[_0x0baf('0x27')]=function(_0x5300a5,_0x1a2b03){return respondWithRpcPromise(_0x0baf('0x28'),_['merge'](_0x5300a5[_0x0baf('0x1a')],_0x5300a5[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1a2b03,null))[_0x0baf('0x16')](handleError(_0x1a2b03,null));};exports[_0x0baf('0x29')]=function(_0x1b0991,_0xe03d82){return respondWithRpcPromise(_0x0baf('0x2a'),_['merge'](_0x1b0991[_0x0baf('0x1a')],_0x1b0991[_0x0baf('0x1b')]))['then'](respondWithResult(_0xe03d82,null))[_0x0baf('0x16')](handleError(_0xe03d82,null));};exports['outbound']=function(_0x5c545f,_0x11bc49){return respondWithRpcPromise(_0x0baf('0x2b'),_0x5c545f['query'])['then'](respondWithResult(_0x11bc49,null))[_0x0baf('0x16')](handleError(_0x11bc49,null));};exports[_0x0baf('0x2c')]=function(_0x3412bc,_0xb2d9ab){return respondWithRpcPromise(_0x0baf('0x2d'),_0x3412bc[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0xb2d9ab,null))[_0x0baf('0x16')](handleError(_0xb2d9ab,null));};exports[_0x0baf('0x2e')]=function(_0x36c6d2,_0x200864){var _0x148540;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2[_0x0baf('0x1a')])['then'](function(_0x3573ce){_0x148540=_0x3573ce;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2['query'],routingClient);})[_0x0baf('0x9')](function(_0x324369){return _[_0x0baf('0x19')]({},_0x324369,_0x148540);})[_0x0baf('0x9')](respondWithResult(_0x200864,null))[_0x0baf('0x16')](handleError(_0x200864,null));};exports[_0x0baf('0x30')]=function(_0x57b581,_0x23ad34){if(_0x57b581[_0x0baf('0x31')]&&_0x57b581['body'][_0x0baf('0x32')]&&_0x57b581[_0x0baf('0x33')]&&_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]){for(var _0x504031 in _0x57b581[_0x0baf('0x31')][_0x0baf('0x32')]){if(_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x0baf('0x34')](_0x504031)){db[_0x0baf('0x35')][_0x0baf('0x36')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':_0x0baf('0x37'),'exitAt':null,'uniqueid':_0x57b581['body'][_0x0baf('0x32')][_0x504031]&&_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')]?{'$notIn':_0x57b581[_0x0baf('0x31')]['interaction'][_0x504031]}:{'$ne':null}}})[_0x0baf('0x9')](function(_0x310240){var _0x27c3ee=moment()[_0x0baf('0x39')](_0x0baf('0x3a'));for(var _0x54ed41=0x0,_0x2a0924=_0x310240[_0x0baf('0x38')];_0x54ed41<_0x2a0924;_0x54ed41+=0x1){_0x310240[_0x54ed41][_0x0baf('0x3b')]({'exitAt':_0x27c3ee});}});for(var _0x1522b0=0x0;_0x1522b0<_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')];_0x1522b0+=0x1){db['MemberReport'][_0x0baf('0x3c')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':'INTERACTION','uniqueid':_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x1522b0],'exitAt':null},'defaults':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'interface':_[_0x0baf('0x12')](_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')])?util['format'](_0x0baf('0x3e'),_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]):_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')],'type':_0x0baf('0x37'),'enterAt':moment()[_0x0baf('0x39')](_0x0baf('0x3a')),'role':_0x0baf('0x3f'),'internal':_0x57b581[_0x0baf('0x33')][_0x0baf('0x40')],'uniqueid':_0x57b581['body']['interaction'][_0x504031][_0x1522b0]}});}}}}return respondWithRpcPromise(_0x0baf('0x41'),{'id':_0x57b581[_0x0baf('0x1b')]['id'],'capacity':_0x57b581[_0x0baf('0x31')][_0x0baf('0x42')]},routingClient)[_0x0baf('0x9')](respondWithResult(_0x23ad34,null))[_0x0baf('0x16')](handleError(_0x23ad34,null));};exports[_0x0baf('0x43')]=function(_0x4b492c,_0x3fe534){return respondWithRpcPromise(_0x0baf('0x44'),_0x4b492c[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x3fe534,null))[_0x0baf('0x16')](handleError(_0x3fe534,null));};exports[_0x0baf('0x45')]=function(_0x5e1849,_0x3eebe5){return respondWithRpcPromise('Trunks',_0x5e1849[_0x0baf('0x1a')])['then'](respondWithResult(_0x3eebe5,null))[_0x0baf('0x16')](handleError(_0x3eebe5,null));};exports['campaigns']=function(_0x35b1a5,_0x4c035b){return respondWithRpcPromise(_0x0baf('0x46'),_0x35b1a5[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x4c035b,null))[_0x0baf('0x16')](handleError(_0x4c035b,null));};exports[_0x0baf('0x47')]=function(_0x576475,_0x21f179){return respondWithRpcPromise(_0x0baf('0x48'),_0x576475[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21f179,null))[_0x0baf('0x16')](handleError(_0x21f179,null));};exports[_0x0baf('0x49')]=function(_0x480834,_0x402f4d){return respondWithRpcPromise(_0x0baf('0x48'),_0x480834[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x480834[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x402f4d,null))[_0x0baf('0x16')](handleError(_0x402f4d,null));};exports['mailQueues']=function(_0x48e855,_0x23f6ea){return respondWithRpcPromise(_0x0baf('0x4a'),_0x48e855[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x23f6ea,null))[_0x0baf('0x16')](handleError(_0x23f6ea,null));};exports[_0x0baf('0x4b')]=function(_0xaa4293,_0x14a667){return respondWithRpcPromise(_0x0baf('0x4a'),_0xaa4293['query'],routingClient)[_0x0baf('0x9')](findById(_0xaa4293[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x14a667,null))[_0x0baf('0x16')](handleError(_0x14a667,null));};exports[_0x0baf('0x4c')]=function(_0xebfc0c,_0x26f5c9){return respondWithRpcPromise('MailAccounts',_0xebfc0c[_0x0baf('0x1a')],mailClient)[_0x0baf('0x9')](respondWithResult(_0x26f5c9,null))[_0x0baf('0x16')](handleError(_0x26f5c9,null));};exports[_0x0baf('0x4d')]=function(_0x1c7d88,_0x1a6d22){return respondWithRpcPromise(_0x0baf('0x4e'),_0x1c7d88[_0x0baf('0x1a')],routingClient)['then'](respondWithResult(_0x1a6d22,null))[_0x0baf('0x16')](handleError(_0x1a6d22,null));};exports['showOpenchannelQueues']=function(_0x3c00e7,_0x5f2fbe){return respondWithRpcPromise('OpenchannelQueues',_0x3c00e7[_0x0baf('0x1a')],routingClient)['then'](findById(_0x3c00e7[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x5f2fbe,null))['catch'](handleError(_0x5f2fbe,null));};exports[_0x0baf('0x4f')]=function(_0xfb6708,_0x156572){return respondWithRpcPromise('SmsQueues',_0xfb6708['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x156572,null))[_0x0baf('0x16')](handleError(_0x156572,null));};exports[_0x0baf('0x50')]=function(_0x7f49e,_0x784e1a){return respondWithRpcPromise('SmsQueues',_0x7f49e[_0x0baf('0x1a')],routingClient)['then'](findById(_0x7f49e['params']['id']))['then'](respondWithResult(_0x784e1a,null))[_0x0baf('0x16')](handleError(_0x784e1a,null));};exports['whatsappQueues']=function(_0x4946d4,_0x11a81e){return respondWithRpcPromise(_0x0baf('0x51'),_0x4946d4[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x11a81e,null))[_0x0baf('0x16')](handleError(_0x11a81e,null));};exports[_0x0baf('0x52')]=function(_0x4c05d6,_0xec3b32){return respondWithRpcPromise(_0x0baf('0x51'),_0x4c05d6[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x4c05d6[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0xec3b32,null))['catch'](handleError(_0xec3b32,null));};exports[_0x0baf('0x53')]=function(_0x468363,_0x29fd46){return respondWithRpcPromise('FaxQueues',_0x468363[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x29fd46,null))[_0x0baf('0x16')](handleError(_0x29fd46,null));};exports[_0x0baf('0x54')]=function(_0x125906,_0x27a959){return respondWithRpcPromise(_0x0baf('0x55'),_0x125906['query'],routingClient)['then'](findById(_0x125906['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x27a959,null))[_0x0baf('0x16')](handleError(_0x27a959,null));};exports[_0x0baf('0x56')]=function(_0x12b9b5,_0x3e65d4){return respondWithRpcPromise(_0x0baf('0x57'),_0x12b9b5['query'])['then'](respondWithResult(_0x3e65d4,null))[_0x0baf('0x16')](handleError(_0x3e65d4,null));};exports['chatQueuesWaitingInteractions']=function(_0x22cd07,_0x3e9b79){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x22cd07[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x3e9b79,null))[_0x0baf('0x16')](handleError(_0x3e9b79,null));};exports[_0x0baf('0x58')]=function(_0x115ff5,_0x33a5af){return respondWithRpcPromise(_0x0baf('0x59'),_0x115ff5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x33a5af,null))['catch'](handleError(_0x33a5af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x58a079,_0x493784){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58a079[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x493784,null))[_0x0baf('0x16')](handleError(_0x493784,null));};exports[_0x0baf('0x5a')]=function(_0x5093f5,_0x1be7f2){return respondWithRpcPromise(_0x0baf('0x5b'),_0x5093f5['query'],routingClient)['then'](function(_0x43aecd){if(_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')]!==undefined){var _0x442e5f=_(_0x43aecd[_0x0baf('0x13')])[_0x0baf('0x5d')]([_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')],_0x5093f5['params']['id']])[_0x0baf('0x5e')](_0x0baf('0x5f'))['uniq']()[_0x0baf('0x60')]();return _0x43aecd[_0x0baf('0x13')]['filter'](function(_0x97d385){return _0x442e5f[_0x0baf('0x61')](_0x97d385[_0x0baf('0x5f')])>-0x1;});}else{return _0x43aecd[_0x0baf('0x13')][_0x0baf('0x5d')](function(_0x4fc5af){return _0x4fc5af['queue_id']===parseInt(_0x5093f5[_0x0baf('0x1b')]['id']);});}})[_0x0baf('0x9')](respondWithResult(_0x1be7f2,null))['catch'](handleError(_0x1be7f2,null));};exports[_0x0baf('0x62')]=function(_0x59dad5,_0x21ad25){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x59dad5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21ad25,null))[_0x0baf('0x16')](handleError(_0x21ad25,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3c2bc1,_0x5008c5){return respondWithRpcPromise(_0x0baf('0x63'),_0x3c2bc1[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x5008c5,null))[_0x0baf('0x16')](handleError(_0x5008c5,null));};exports[_0x0baf('0x64')]=function(_0x52e845,_0x866e6e){return respondWithRpcPromise(_0x0baf('0x65'),_0x52e845['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x866e6e,null))[_0x0baf('0x16')](handleError(_0x866e6e,null));};exports[_0x0baf('0x66')]=function(_0x379c54){return function(_0x1cbbcc,_0x250df2){var _0xa4fd1b,_0x1cda78;var _0x44ef57=_[_0x0baf('0x67')](_0x379c54);var _0x3b7abf=_0x379c54===_0x0baf('0x68')?'Website':'Account';return db[_0x44ef57+_0x0baf('0x69')][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1cbbcc[_0x0baf('0x1b')]['id']}})['then'](function(_0x507783){if(_[_0x0baf('0x12')](_0x507783)){throw new Error(_0x44ef57+_0x0baf('0x6b'));}_0xa4fd1b=_0x507783;return db[_0x44ef57+_0x0baf('0x6c')][_0x0baf('0x6a')]({'where':{'id':_0x1cbbcc[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x44ef57+_0x0baf('0x6e')],'as':_0x0baf('0x6e')},{'model':db[_0x44ef57+_0x3b7abf],'as':_0x0baf('0x6f')}]});})['then'](function(_0x1590a5){if(_[_0x0baf('0x12')](_0x1590a5)){throw new Error(_0x44ef57+_0x0baf('0x70'));}_0x1cda78=_0x1590a5;return _0x1590a5[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5d26e6={'uniqueid':_0x379c54+'.'+_0x1cda78['id']+'.'+_0x1cda78['Interaction']['id'],'FromUserId':_0x1cbbcc[_0x0baf('0x33')]['id'],'type':_0x0baf('0x72')};_0x5d26e6[_0x44ef57+'MessageId']=_0x1cda78['id'];_0x5d26e6[_0x44ef57+'InteractionId']=_0x1cda78[_0x0baf('0x6e')]['id'];_0x5d26e6[_0x0baf('0x73')+_0x44ef57+_0x3b7abf+'Id']=_0x1cda78['Account']['id'];_0x5d26e6['To'+_0x44ef57+_0x0baf('0x74')]=_0xa4fd1b['id'];return db[_0x44ef57+_0x0baf('0x75')][_0x0baf('0x76')](_0x5d26e6);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x379c54,'interaction':_0x1cda78[_0x0baf('0x6e')],'message':_0x1cda78,'account':_0x1cda78[_0x0baf('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0baf('0x72'),'appdata':_0xa4fd1b[_0x0baf('0x11')]+','+(_0x1cda78[_0x0baf('0x6f')][_0x0baf('0x78')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x250df2,null))[_0x0baf('0x16')](handleError(_0x250df2,null));};};exports[_0x0baf('0x7a')]=function(_0x1e1adb,_0x3bd15b){var _0x3c37b4,_0x195303;if(_['isNil'](_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x7b')])){throw new Error(_0x0baf('0x7c'));}var _0x457ae8=_0x1e1adb[_0x0baf('0x31')]['channel'];var _0x3761b5=_[_0x0baf('0x67')](_0x457ae8);var _0x2eae1b=_0x457ae8===_0x0baf('0x68')?_0x0baf('0x7d'):'Account';return db['User'][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1e1adb['params']['id'],'role':_0x0baf('0x3f')}})['then'](function(_0x32d8b6){if(_[_0x0baf('0x12')](_0x32d8b6)){throw new Error(_0x0baf('0x7e'));}_0x3c37b4=_0x32d8b6;return db[_0x3761b5+_0x0baf('0x6c')]['findOne']({'where':{'id':_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x3761b5+_0x0baf('0x6e')],'as':'Interaction'},{'model':db[_0x3761b5+_0x2eae1b],'as':'Account'}]});})['then'](function(_0x4d4884){if(_[_0x0baf('0x12')](_0x4d4884)){throw new Error(_0x3761b5+_0x0baf('0x70'));}_0x195303=_0x4d4884;return _0x4d4884[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0baf('0x9')](function(){var _0x597830={'uniqueid':_0x457ae8+'.'+_0x195303['id']+'.'+_0x195303[_0x0baf('0x6e')]['id'],'FromUserId':_0x1e1adb[_0x0baf('0x33')]['id'],'type':_0x0baf('0x3f'),'ToUserId':_0x3c37b4['id']};_0x597830[_0x3761b5+'MessageId']=_0x195303['id'];_0x597830[_0x3761b5+_0x0baf('0x7f')]=_0x195303[_0x0baf('0x6e')]['id'];_0x597830['From'+_0x3761b5+_0x2eae1b+'Id']=_0x195303[_0x0baf('0x6f')]['id'];return db[_0x3761b5+'TransferReport'][_0x0baf('0x76')](_0x597830);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x457ae8,'interaction':_0x195303[_0x0baf('0x6e')],'message':_0x195303,'account':_0x195303['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3c37b4[_0x0baf('0x11')]+','+(_0x195303['Account'][_0x0baf('0x80')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})[_0x0baf('0x9')](respondWithResult(_0x3bd15b,null))[_0x0baf('0x16')](handleError(_0x3bd15b,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index d5d79f8..71d236a 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 _0xe40a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/run','run','post','create','put','/:id','update','destroy','util','connect-timeout','express','Router'];(function(_0x171541,_0x8bbe81){var _0x5aeef2=function(_0x441af9){while(--_0x441af9){_0x171541['push'](_0x171541['shift']());}};_0x5aeef2(++_0x8bbe81);}(_0xe40a,0x150));var _0xae40=function(_0xa6c8d5,_0x1beb77){_0xa6c8d5=_0xa6c8d5-0x0;var _0xc210fa=_0xe40a[_0xa6c8d5];return _0xc210fa;};'use strict';var multer=require('multer');var util=require(_0xae40('0x0'));var path=require('path');var timeout=require(_0xae40('0x1'));var express=require(_0xae40('0x2'));var router=express[_0xae40('0x3')]();var fs_extra=require(_0xae40('0x4'));var auth=require(_0xae40('0x5'));var interaction=require(_0xae40('0x6'));var config=require(_0xae40('0x7'));var controller=require('./schedule.controller');router[_0xae40('0x8')]('/',auth[_0xae40('0x9')](),controller[_0xae40('0xa')]);router[_0xae40('0x8')]('/:id',auth[_0xae40('0x9')](),controller[_0xae40('0xb')]);router[_0xae40('0x8')](_0xae40('0xc'),auth[_0xae40('0x9')](),controller[_0xae40('0xd')]);router[_0xae40('0xe')]('/',auth[_0xae40('0x9')](),controller[_0xae40('0xf')]);router[_0xae40('0x10')](_0xae40('0x11'),auth['isAuthenticated'](),controller[_0xae40('0x12')]);router['delete'](_0xae40('0x11'),auth['isAuthenticated'](),controller[_0xae40('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6869=['/:id/run','run','post','create','put','/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','show'];(function(_0x390ef6,_0x1d401c){var _0x2fdaac=function(_0x692ab7){while(--_0x692ab7){_0x390ef6['push'](_0x390ef6['shift']());}};_0x2fdaac(++_0x1d401c);}(_0x6869,0xab));var _0x9686=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6869[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x9686('0x0'));var util=require(_0x9686('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9686('0x2'));var router=express[_0x9686('0x3')]();var fs_extra=require(_0x9686('0x4'));var auth=require(_0x9686('0x5'));var interaction=require(_0x9686('0x6'));var config=require(_0x9686('0x7'));var controller=require(_0x9686('0x8'));router[_0x9686('0x9')]('/',auth[_0x9686('0xa')](),controller[_0x9686('0xb')]);router['get']('/:id',auth[_0x9686('0xa')](),controller[_0x9686('0xc')]);router[_0x9686('0x9')](_0x9686('0xd'),auth[_0x9686('0xa')](),controller[_0x9686('0xe')]);router[_0x9686('0xf')]('/',auth['isAuthenticated'](),controller[_0x9686('0x10')]);router[_0x9686('0x11')](_0x9686('0x12'),auth['isAuthenticated'](),controller[_0x9686('0x13')]);router[_0x9686('0x14')](_0x9686('0x12'),auth['isAuthenticated'](),controller[_0x9686('0x15')]);module[_0x9686('0x16')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index bdeea58..0160f0e 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 _0x4360=['xlsx','custom','default','TEXT','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','minutes','pdf'];(function(_0x15a99d,_0x4486ea){var _0x2cb908=function(_0x1243c1){while(--_0x1243c1){_0x15a99d['push'](_0x15a99d['shift']());}};_0x2cb908(++_0x4486ea);}(_0x4360,0xe4));var _0x0436=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4360[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x0436('0x0')]},'active':{'type':Sequelize[_0x0436('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x0436('0x0')],'allowNull':![],'defaultValue':_0x0436('0x2')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x0436('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x0436('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x0436('0x5')](_0x0436('0x6'),_0x0436('0x7'),_0x0436('0x8'),_0x0436('0x9'),'days','hours',_0x0436('0xa')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM']('csv',_0x0436('0xb'),_0x0436('0xc')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x0436('0x5')](_0x0436('0xd'),_0x0436('0xe')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x0436('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x0436('0x0')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x0436('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x0436('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe384=['pdf','xlsx','csv','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours','minutes'];(function(_0x54d84b,_0x3ab478){var _0x34fce4=function(_0x3e564f){while(--_0x3e564f){_0x54d84b['push'](_0x54d84b['shift']());}};_0x34fce4(++_0x3ab478);}(_0xe384,0x1e6));var _0x4e38=function(_0x495dec,_0x16242e){_0x495dec=_0x495dec-0x0;var _0x248e69=_0xe384[_0x495dec];return _0x248e69;};'use strict';var Sequelize=require(_0x4e38('0x0'));module[_0x4e38('0x1')]={'name':{'type':Sequelize[_0x4e38('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x4e38('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x4e38('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x4e38('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x4e38('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x4e38('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x4e38('0x6')](_0x4e38('0x7'),_0x4e38('0x8'),_0x4e38('0x9'),_0x4e38('0xa'),_0x4e38('0xb'),_0x4e38('0xc'),_0x4e38('0xd')),'allowNull':![],'defaultValue':_0x4e38('0xb')},'output':{'type':Sequelize['ENUM']('csv',_0x4e38('0xe'),_0x4e38('0xf')),'allowNull':![],'defaultValue':_0x4e38('0x10')},'type':{'type':Sequelize['ENUM'](_0x4e38('0x11'),_0x4e38('0x12')),'allowNull':![],'defaultValue':_0x4e38('0x11')},'sendMail':{'type':Sequelize[_0x4e38('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x4e38('0x2')]},'cc':{'type':Sequelize[_0x4e38('0x13')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x4e38('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index d9e0a8c..159c292 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 _0xbf6d=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','run','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../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','apply','save','update','then','Scheduler','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','Schedule','includeAll','include','findAll','rows','show','params','catch','create'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xbf6d,0x10d));var _0xdbf6=function(_0x484fae,_0x37c7ed){_0x484fae=_0x484fae-0x0;var _0x2df2a7=_0xbf6d[_0x484fae];return _0x2df2a7;};'use strict';var emlformat=require(_0xdbf6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdbf6('0x1'));var jsonpatch=require(_0xdbf6('0x2'));var rp=require('request-promise');var moment=require(_0xdbf6('0x3'));var BPromise=require(_0xdbf6('0x4'));var Mustache=require(_0xdbf6('0x5'));var util=require(_0xdbf6('0x6'));var path=require(_0xdbf6('0x7'));var sox=require(_0xdbf6('0x8'));var csv=require(_0xdbf6('0x9'));var ejs=require(_0xdbf6('0xa'));var fs=require('fs');var fs_extra=require(_0xdbf6('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdbf6('0xc'));var deskjs=require(_0xdbf6('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdbf6('0xe'));var Papa=require(_0xdbf6('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdbf6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdbf6('0x11'))(_0xdbf6('0x12'));var utils=require(_0xdbf6('0x13'));var config=require(_0xdbf6('0x14'));var licenseUtil=require(_0xdbf6('0x15'));var db=require(_0xdbf6('0x16'))['db'];function respondWithStatusCode(_0x3641e2,_0x557a0e){_0x557a0e=_0x557a0e||0xcc;return function(_0x572743){if(_0x572743){return _0x3641e2[_0xdbf6('0x17')](_0x557a0e);}return _0x3641e2[_0xdbf6('0x18')](_0x557a0e)[_0xdbf6('0x19')]();};}function respondWithResult(_0xb42130,_0x5c466c){_0x5c466c=_0x5c466c||0xc8;return function(_0x2d57df){if(_0x2d57df){return _0xb42130[_0xdbf6('0x18')](_0x5c466c)[_0xdbf6('0x1a')](_0x2d57df);}};}function respondWithFilteredResult(_0x49cd80,_0x474439){return function(_0x382a2e){if(_0x382a2e){var _0x4f249e=typeof _0x474439['offset']===_0xdbf6('0x1b')&&typeof _0x474439['limit']===_0xdbf6('0x1b');var _0x523a02=_0x382a2e[_0xdbf6('0x1c')];var _0x8047f5=_0x4f249e?0x0:_0x474439[_0xdbf6('0x1d')];var _0x5de08a=_0x4f249e?_0x382a2e['count']:_0x474439['offset']+_0x474439[_0xdbf6('0x1e')];var _0x47642f;if(_0x5de08a>=_0x523a02){_0x5de08a=_0x523a02;_0x47642f=0xc8;}else{_0x47642f=0xce;}_0x49cd80['status'](_0x47642f);return _0x49cd80[_0xdbf6('0x1f')](_0xdbf6('0x20'),_0x8047f5+'-'+_0x5de08a+'/'+_0x523a02)['json'](_0x382a2e);}return null;};}function patchUpdates(_0x44687f){return function(_0x377f19){try{jsonpatch[_0xdbf6('0x21')](_0x377f19,_0x44687f,!![]);}catch(_0x53a7ed){return BPromise['reject'](_0x53a7ed);}return _0x377f19[_0xdbf6('0x22')]();};}function saveUpdates(_0x588553,_0x2acf42){return function(_0x16e0a7){if(_0x16e0a7){return _0x16e0a7[_0xdbf6('0x23')](_0x588553)['then'](function(_0x353bc1){return _0x353bc1;});}return null;};}function removeEntity(_0x54eb26,_0x4502dc){return function(_0x384af6){if(_0x384af6){return _0x384af6['destroy']()[_0xdbf6('0x24')](function(){var _0x1b228c=_0x384af6['get']({'plain':!![]});var _0x2cdc12=_0xdbf6('0x25');return db['UserProfileResource'][_0xdbf6('0x26')]({'where':{'type':_0x2cdc12,'resourceId':_0x1b228c['id']}})[_0xdbf6('0x24')](function(){return _0x384af6;});})[_0xdbf6('0x24')](function(){_0x54eb26[_0xdbf6('0x18')](0xcc)[_0xdbf6('0x19')]();});}};}function handleEntityNotFound(_0x17213a,_0x147b9b){return function(_0x580117){if(!_0x580117){_0x17213a[_0xdbf6('0x17')](0x194);}return _0x580117;};}function handleError(_0x44b287,_0x1b0f2e){_0x1b0f2e=_0x1b0f2e||0x1f4;return function(_0x34d7b1){logger[_0xdbf6('0x27')](_0x34d7b1[_0xdbf6('0x28')]);if(_0x34d7b1['name']){delete _0x34d7b1[_0xdbf6('0x29')];}_0x44b287[_0xdbf6('0x18')](_0x1b0f2e)[_0xdbf6('0x2a')](_0x34d7b1);};}exports[_0xdbf6('0x2b')]=function(_0x48cd1e,_0x524c91){var _0x4a59d7={},_0x135626={},_0xdca274={'count':0x0,'rows':[]};var _0x2ec2fe=_[_0xdbf6('0x2c')](db['Schedule'][_0xdbf6('0x2d')],function(_0x5e694d){return{'name':_0x5e694d['fieldName'],'type':_0x5e694d[_0xdbf6('0x2e')][_0xdbf6('0x2f')]};});_0x135626[_0xdbf6('0x30')]=_[_0xdbf6('0x2c')](_0x2ec2fe,_0xdbf6('0x29'));_0x135626['query']=_[_0xdbf6('0x31')](_0x48cd1e[_0xdbf6('0x32')]);_0x135626['filters']=_[_0xdbf6('0x33')](_0x135626[_0xdbf6('0x30')],_0x135626[_0xdbf6('0x32')]);_0x4a59d7[_0xdbf6('0x34')]=_[_0xdbf6('0x33')](_0x135626['model'],qs[_0xdbf6('0x35')](_0x48cd1e[_0xdbf6('0x32')][_0xdbf6('0x35')]));_0x4a59d7[_0xdbf6('0x34')]=_0x4a59d7[_0xdbf6('0x34')][_0xdbf6('0x36')]?_0x4a59d7[_0xdbf6('0x34')]:_0x135626[_0xdbf6('0x30')];if(!_0x48cd1e[_0xdbf6('0x32')][_0xdbf6('0x37')](_0xdbf6('0x38'))){_0x4a59d7['limit']=qs[_0xdbf6('0x1e')](_0x48cd1e['query'][_0xdbf6('0x1e')]);_0x4a59d7[_0xdbf6('0x1d')]=qs['offset'](_0x48cd1e['query'][_0xdbf6('0x1d')]);}_0x4a59d7[_0xdbf6('0x39')]=qs[_0xdbf6('0x3a')](_0x48cd1e[_0xdbf6('0x32')][_0xdbf6('0x3a')]);_0x4a59d7[_0xdbf6('0x3b')]=qs[_0xdbf6('0x3c')](_[_0xdbf6('0x3d')](_0x48cd1e[_0xdbf6('0x32')],_0x135626[_0xdbf6('0x3c')]),_0x2ec2fe);if(_0x48cd1e[_0xdbf6('0x32')]['filter']){_0x4a59d7['where']=_[_0xdbf6('0x3e')](_0x4a59d7[_0xdbf6('0x3b')],{'$or':_[_0xdbf6('0x2c')](_0x2ec2fe,function(_0x447ea5){if(_0x447ea5[_0xdbf6('0x2e')]!==_0xdbf6('0x3f')){var _0x5446cf={};_0x5446cf[_0x447ea5[_0xdbf6('0x29')]]={'$like':'%'+_0x48cd1e['query'][_0xdbf6('0x40')]+'%'};return _0x5446cf;}})});}_0x4a59d7=_[_0xdbf6('0x3e')]({},_0x4a59d7,_0x48cd1e[_0xdbf6('0x41')]);var _0x5c33a7={'where':_0x4a59d7['where']};return db[_0xdbf6('0x42')][_0xdbf6('0x1c')](_0x5c33a7)[_0xdbf6('0x24')](function(_0x4b7c75){_0xdca274[_0xdbf6('0x1c')]=_0x4b7c75;if(_0x48cd1e[_0xdbf6('0x32')][_0xdbf6('0x43')]){_0x4a59d7[_0xdbf6('0x44')]=[{'all':!![]}];}return db[_0xdbf6('0x42')][_0xdbf6('0x45')](_0x4a59d7);})['then'](function(_0x5001c2){_0xdca274[_0xdbf6('0x46')]=_0x5001c2;return _0xdca274;})[_0xdbf6('0x24')](respondWithFilteredResult(_0x524c91,_0x4a59d7))['catch'](handleError(_0x524c91,null));};exports[_0xdbf6('0x47')]=function(_0x1669d3,_0xb5fbe1){var _0x57f9b8={'raw':![],'where':{'id':_0x1669d3[_0xdbf6('0x48')]['id']}},_0x4fa9c0={};_0x4fa9c0[_0xdbf6('0x30')]=_[_0xdbf6('0x31')](db[_0xdbf6('0x42')][_0xdbf6('0x2d')]);_0x4fa9c0[_0xdbf6('0x32')]=_[_0xdbf6('0x31')](_0x1669d3[_0xdbf6('0x32')]);_0x4fa9c0[_0xdbf6('0x3c')]=_[_0xdbf6('0x33')](_0x4fa9c0['model'],_0x4fa9c0[_0xdbf6('0x32')]);_0x57f9b8[_0xdbf6('0x34')]=_[_0xdbf6('0x33')](_0x4fa9c0[_0xdbf6('0x30')],qs[_0xdbf6('0x35')](_0x1669d3['query']['fields']));_0x57f9b8['attributes']=_0x57f9b8[_0xdbf6('0x34')][_0xdbf6('0x36')]?_0x57f9b8[_0xdbf6('0x34')]:_0x4fa9c0[_0xdbf6('0x30')];if(_0x1669d3[_0xdbf6('0x32')][_0xdbf6('0x43')]){_0x57f9b8[_0xdbf6('0x44')]=[{'all':!![]}];}_0x57f9b8=_['merge']({},_0x57f9b8,_0x1669d3[_0xdbf6('0x41')]);return db[_0xdbf6('0x42')]['find'](_0x57f9b8)[_0xdbf6('0x24')](handleEntityNotFound(_0xb5fbe1,null))[_0xdbf6('0x24')](respondWithResult(_0xb5fbe1,null))[_0xdbf6('0x49')](handleError(_0xb5fbe1,null));};exports['create']=function(_0x17cc6b,_0x47c66f){return db[_0xdbf6('0x42')][_0xdbf6('0x4a')](_0x17cc6b['body'],{})['then'](function(_0x21fb1d){var _0x2e5fbb=_0x17cc6b[_0xdbf6('0x4b')]['get']({'plain':!![]});if(!_0x2e5fbb)throw new Error(_0xdbf6('0x4c'));if(_0x2e5fbb[_0xdbf6('0x4d')]===_0xdbf6('0x4b')){var _0xc6b144=_0x21fb1d['get']({'plain':!![]});var _0x23c40f=_0xdbf6('0x25');return db[_0xdbf6('0x4e')]['find']({'where':{'name':_0x23c40f,'userProfileId':_0x2e5fbb[_0xdbf6('0x4f')]},'raw':!![]})[_0xdbf6('0x24')](function(_0x590e0f){if(_0x590e0f&&_0x590e0f[_0xdbf6('0x50')]===0x0){return db[_0xdbf6('0x51')]['create']({'name':_0xc6b144[_0xdbf6('0x29')],'resourceId':_0xc6b144['id'],'type':_0x590e0f[_0xdbf6('0x29')],'sectionId':_0x590e0f['id']},{})[_0xdbf6('0x24')](function(){return _0x21fb1d;});}else{return _0x21fb1d;}})[_0xdbf6('0x49')](function(_0x45873c){logger[_0xdbf6('0x27')](_0xdbf6('0x52'),_0x45873c);throw _0x45873c;});}return _0x21fb1d;})[_0xdbf6('0x24')](respondWithResult(_0x47c66f,0xc9))[_0xdbf6('0x49')](handleError(_0x47c66f,null));};exports['update']=function(_0x1ede85,_0x73dbbc){if(_0x1ede85['body']['id']){delete _0x1ede85['body']['id'];}return db[_0xdbf6('0x42')]['find']({'where':{'id':_0x1ede85[_0xdbf6('0x48')]['id']}})[_0xdbf6('0x24')](handleEntityNotFound(_0x73dbbc,null))[_0xdbf6('0x24')](saveUpdates(_0x1ede85[_0xdbf6('0x53')],null))['then'](respondWithResult(_0x73dbbc,null))[_0xdbf6('0x49')](handleError(_0x73dbbc,null));};exports[_0xdbf6('0x26')]=function(_0x4b245d,_0x3e3d38){return db[_0xdbf6('0x42')][_0xdbf6('0x54')]({'where':{'id':_0x4b245d[_0xdbf6('0x48')]['id']}})[_0xdbf6('0x24')](handleEntityNotFound(_0x3e3d38,null))[_0xdbf6('0x24')](removeEntity(_0x3e3d38,null))['catch'](handleError(_0x3e3d38,null));};exports[_0xdbf6('0x55')]=function(_0x39dedc,_0x4fd37c,_0x399cb2){var _0x31a1a8=require('../../config/schedule');return db['Schedule'][_0xdbf6('0x54')]({'where':{'id':_0x39dedc[_0xdbf6('0x48')]['id']},'raw':!![]})[_0xdbf6('0x24')](handleEntityNotFound(_0x4fd37c,null))['then'](function(){_0x31a1a8[_0xdbf6('0x55')](_0x39dedc['params']['id']);})[_0xdbf6('0x24')](respondWithStatusCode(_0x4fd37c,null))[_0xdbf6('0x49')](handleError(_0x4fd37c,null));}; \ No newline at end of file +var _0xd2b6=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','get','Scheduler','UserProfileResource','error','stack','index','map','rawAttributes','type','model','name','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','Schedule','includeAll','findAll','rows','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','run','../../config/schedule','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x5890ef,_0x5502b1){var _0xdb00f1=function(_0x3d53a8){while(--_0x3d53a8){_0x5890ef['push'](_0x5890ef['shift']());}};_0xdb00f1(++_0x5502b1);}(_0xd2b6,0x94));var _0x6d2b=function(_0x36393b,_0x35252a){_0x36393b=_0x36393b-0x0;var _0xb397e6=_0xd2b6[_0x36393b];return _0xb397e6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6d2b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6d2b('0x1'));var moment=require('moment');var BPromise=require(_0x6d2b('0x2'));var Mustache=require('mustache');var util=require(_0x6d2b('0x3'));var path=require(_0x6d2b('0x4'));var sox=require('sox');var csv=require(_0x6d2b('0x5'));var ejs=require(_0x6d2b('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6d2b('0x7'));var squel=require(_0x6d2b('0x8'));var crypto=require(_0x6d2b('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x6d2b('0xa'));var toCsv=require(_0x6d2b('0x5'));var querystring=require(_0x6d2b('0xb'));var Papa=require(_0x6d2b('0xc'));var Redis=require('ioredis');var authService=require(_0x6d2b('0xd'));var qs=require(_0x6d2b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6d2b('0xf'));var logger=require(_0x6d2b('0x10'))(_0x6d2b('0x11'));var utils=require(_0x6d2b('0x12'));var config=require(_0x6d2b('0x13'));var licenseUtil=require(_0x6d2b('0x14'));var db=require(_0x6d2b('0x15'))['db'];function respondWithStatusCode(_0x250618,_0x5c7449){_0x5c7449=_0x5c7449||0xcc;return function(_0x2c5551){if(_0x2c5551){return _0x250618[_0x6d2b('0x16')](_0x5c7449);}return _0x250618[_0x6d2b('0x17')](_0x5c7449)[_0x6d2b('0x18')]();};}function respondWithResult(_0x347b1b,_0x40df14){_0x40df14=_0x40df14||0xc8;return function(_0x34bd8e){if(_0x34bd8e){return _0x347b1b['status'](_0x40df14)['json'](_0x34bd8e);}};}function respondWithFilteredResult(_0x49e1e8,_0x403095){return function(_0x5e8dcd){if(_0x5e8dcd){var _0x207c4d=typeof _0x403095['offset']===_0x6d2b('0x19')&&typeof _0x403095['limit']===_0x6d2b('0x19');var _0x79c360=_0x5e8dcd[_0x6d2b('0x1a')];var _0xe535e6=_0x207c4d?0x0:_0x403095[_0x6d2b('0x1b')];var _0x205879=_0x207c4d?_0x5e8dcd['count']:_0x403095[_0x6d2b('0x1b')]+_0x403095['limit'];var _0x355027;if(_0x205879>=_0x79c360){_0x205879=_0x79c360;_0x355027=0xc8;}else{_0x355027=0xce;}_0x49e1e8[_0x6d2b('0x17')](_0x355027);return _0x49e1e8[_0x6d2b('0x1c')](_0x6d2b('0x1d'),_0xe535e6+'-'+_0x205879+'/'+_0x79c360)[_0x6d2b('0x1e')](_0x5e8dcd);}return null;};}function patchUpdates(_0x32dac5){return function(_0xe2c71e){try{jsonpatch[_0x6d2b('0x1f')](_0xe2c71e,_0x32dac5,!![]);}catch(_0x3b93b7){return BPromise[_0x6d2b('0x20')](_0x3b93b7);}return _0xe2c71e[_0x6d2b('0x21')]();};}function saveUpdates(_0x226364,_0xb06714){return function(_0x41872b){if(_0x41872b){return _0x41872b['update'](_0x226364)[_0x6d2b('0x22')](function(_0x1faac1){return _0x1faac1;});}return null;};}function removeEntity(_0x95b3f,_0x593370){return function(_0x2bd584){if(_0x2bd584){return _0x2bd584[_0x6d2b('0x23')]()[_0x6d2b('0x22')](function(){var _0x26a1bf=_0x2bd584[_0x6d2b('0x24')]({'plain':!![]});var _0x92f4ff=_0x6d2b('0x25');return db[_0x6d2b('0x26')][_0x6d2b('0x23')]({'where':{'type':_0x92f4ff,'resourceId':_0x26a1bf['id']}})[_0x6d2b('0x22')](function(){return _0x2bd584;});})[_0x6d2b('0x22')](function(){_0x95b3f[_0x6d2b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x475dd3,_0x2c0ffb){return function(_0x14ba53){if(!_0x14ba53){_0x475dd3[_0x6d2b('0x16')](0x194);}return _0x14ba53;};}function handleError(_0x71a54b,_0x59bf28){_0x59bf28=_0x59bf28||0x1f4;return function(_0x34a73e){logger[_0x6d2b('0x27')](_0x34a73e[_0x6d2b('0x28')]);if(_0x34a73e['name']){delete _0x34a73e['name'];}_0x71a54b[_0x6d2b('0x17')](_0x59bf28)['send'](_0x34a73e);};}exports[_0x6d2b('0x29')]=function(_0x3ab668,_0x6779d8){var _0x10ded3={},_0x48258e={},_0x287d76={'count':0x0,'rows':[]};var _0x228444=_[_0x6d2b('0x2a')](db['Schedule'][_0x6d2b('0x2b')],function(_0xea4dda){return{'name':_0xea4dda['fieldName'],'type':_0xea4dda[_0x6d2b('0x2c')]['key']};});_0x48258e[_0x6d2b('0x2d')]=_[_0x6d2b('0x2a')](_0x228444,_0x6d2b('0x2e'));_0x48258e[_0x6d2b('0x2f')]=_[_0x6d2b('0x30')](_0x3ab668[_0x6d2b('0x2f')]);_0x48258e[_0x6d2b('0x31')]=_[_0x6d2b('0x32')](_0x48258e[_0x6d2b('0x2d')],_0x48258e[_0x6d2b('0x2f')]);_0x10ded3['attributes']=_[_0x6d2b('0x32')](_0x48258e[_0x6d2b('0x2d')],qs[_0x6d2b('0x33')](_0x3ab668[_0x6d2b('0x2f')][_0x6d2b('0x33')]));_0x10ded3['attributes']=_0x10ded3['attributes'][_0x6d2b('0x34')]?_0x10ded3[_0x6d2b('0x35')]:_0x48258e[_0x6d2b('0x2d')];if(!_0x3ab668[_0x6d2b('0x2f')][_0x6d2b('0x36')](_0x6d2b('0x37'))){_0x10ded3[_0x6d2b('0x38')]=qs[_0x6d2b('0x38')](_0x3ab668[_0x6d2b('0x2f')][_0x6d2b('0x38')]);_0x10ded3[_0x6d2b('0x1b')]=qs[_0x6d2b('0x1b')](_0x3ab668[_0x6d2b('0x2f')][_0x6d2b('0x1b')]);}_0x10ded3[_0x6d2b('0x39')]=qs[_0x6d2b('0x3a')](_0x3ab668[_0x6d2b('0x2f')][_0x6d2b('0x3a')]);_0x10ded3[_0x6d2b('0x3b')]=qs[_0x6d2b('0x31')](_['pick'](_0x3ab668[_0x6d2b('0x2f')],_0x48258e[_0x6d2b('0x31')]),_0x228444);if(_0x3ab668['query'][_0x6d2b('0x3c')]){_0x10ded3[_0x6d2b('0x3b')]=_[_0x6d2b('0x3d')](_0x10ded3[_0x6d2b('0x3b')],{'$or':_[_0x6d2b('0x2a')](_0x228444,function(_0x171104){if(_0x171104['type']!=='VIRTUAL'){var _0x1086c6={};_0x1086c6[_0x171104[_0x6d2b('0x2e')]]={'$like':'%'+_0x3ab668[_0x6d2b('0x2f')][_0x6d2b('0x3c')]+'%'};return _0x1086c6;}})});}_0x10ded3=_[_0x6d2b('0x3d')]({},_0x10ded3,_0x3ab668[_0x6d2b('0x3e')]);var _0x52898={'where':_0x10ded3['where']};return db[_0x6d2b('0x3f')]['count'](_0x52898)[_0x6d2b('0x22')](function(_0x5d4ab6){_0x287d76[_0x6d2b('0x1a')]=_0x5d4ab6;if(_0x3ab668[_0x6d2b('0x2f')][_0x6d2b('0x40')]){_0x10ded3['include']=[{'all':!![]}];}return db[_0x6d2b('0x3f')][_0x6d2b('0x41')](_0x10ded3);})['then'](function(_0x2ee311){_0x287d76[_0x6d2b('0x42')]=_0x2ee311;return _0x287d76;})[_0x6d2b('0x22')](respondWithFilteredResult(_0x6779d8,_0x10ded3))[_0x6d2b('0x43')](handleError(_0x6779d8,null));};exports[_0x6d2b('0x44')]=function(_0x5a6717,_0xc81dac){var _0x2237b1={'raw':![],'where':{'id':_0x5a6717['params']['id']}},_0x754ca5={};_0x754ca5[_0x6d2b('0x2d')]=_['keys'](db[_0x6d2b('0x3f')][_0x6d2b('0x2b')]);_0x754ca5[_0x6d2b('0x2f')]=_[_0x6d2b('0x30')](_0x5a6717['query']);_0x754ca5[_0x6d2b('0x31')]=_['intersection'](_0x754ca5[_0x6d2b('0x2d')],_0x754ca5[_0x6d2b('0x2f')]);_0x2237b1[_0x6d2b('0x35')]=_['intersection'](_0x754ca5[_0x6d2b('0x2d')],qs[_0x6d2b('0x33')](_0x5a6717[_0x6d2b('0x2f')]['fields']));_0x2237b1['attributes']=_0x2237b1[_0x6d2b('0x35')][_0x6d2b('0x34')]?_0x2237b1[_0x6d2b('0x35')]:_0x754ca5[_0x6d2b('0x2d')];if(_0x5a6717[_0x6d2b('0x2f')][_0x6d2b('0x40')]){_0x2237b1[_0x6d2b('0x45')]=[{'all':!![]}];}_0x2237b1=_[_0x6d2b('0x3d')]({},_0x2237b1,_0x5a6717[_0x6d2b('0x3e')]);return db[_0x6d2b('0x3f')][_0x6d2b('0x46')](_0x2237b1)['then'](handleEntityNotFound(_0xc81dac,null))[_0x6d2b('0x22')](respondWithResult(_0xc81dac,null))[_0x6d2b('0x43')](handleError(_0xc81dac,null));};exports[_0x6d2b('0x47')]=function(_0x33b0f4,_0x913210){return db[_0x6d2b('0x3f')][_0x6d2b('0x47')](_0x33b0f4[_0x6d2b('0x48')],{})[_0x6d2b('0x22')](function(_0xaa4167){var _0x3f0530=_0x33b0f4[_0x6d2b('0x49')]['get']({'plain':!![]});if(!_0x3f0530)throw new Error(_0x6d2b('0x4a'));if(_0x3f0530['role']===_0x6d2b('0x49')){var _0x47ccb7=_0xaa4167[_0x6d2b('0x24')]({'plain':!![]});var _0x48a02e=_0x6d2b('0x25');return db[_0x6d2b('0x4b')][_0x6d2b('0x46')]({'where':{'name':_0x48a02e,'userProfileId':_0x3f0530['userProfileId']},'raw':!![]})[_0x6d2b('0x22')](function(_0x2abac7){if(_0x2abac7&&_0x2abac7[_0x6d2b('0x4c')]===0x0){return db['UserProfileResource'][_0x6d2b('0x47')]({'name':_0x47ccb7[_0x6d2b('0x2e')],'resourceId':_0x47ccb7['id'],'type':_0x2abac7[_0x6d2b('0x2e')],'sectionId':_0x2abac7['id']},{})[_0x6d2b('0x22')](function(){return _0xaa4167;});}else{return _0xaa4167;}})['catch'](function(_0x4263ba){logger['error'](_0x6d2b('0x4d'),_0x4263ba);throw _0x4263ba;});}return _0xaa4167;})['then'](respondWithResult(_0x913210,0xc9))[_0x6d2b('0x43')](handleError(_0x913210,null));};exports[_0x6d2b('0x4e')]=function(_0x1001dd,_0x2ae143){if(_0x1001dd[_0x6d2b('0x48')]['id']){delete _0x1001dd[_0x6d2b('0x48')]['id'];}return db[_0x6d2b('0x3f')]['find']({'where':{'id':_0x1001dd[_0x6d2b('0x4f')]['id']}})[_0x6d2b('0x22')](handleEntityNotFound(_0x2ae143,null))[_0x6d2b('0x22')](saveUpdates(_0x1001dd[_0x6d2b('0x48')],null))['then'](respondWithResult(_0x2ae143,null))[_0x6d2b('0x43')](handleError(_0x2ae143,null));};exports[_0x6d2b('0x23')]=function(_0x198a69,_0x4b2cc3){return db[_0x6d2b('0x3f')][_0x6d2b('0x46')]({'where':{'id':_0x198a69[_0x6d2b('0x4f')]['id']}})[_0x6d2b('0x22')](handleEntityNotFound(_0x4b2cc3,null))[_0x6d2b('0x22')](removeEntity(_0x4b2cc3,null))[_0x6d2b('0x43')](handleError(_0x4b2cc3,null));};exports[_0x6d2b('0x50')]=function(_0x51fd0e,_0xb77f9c,_0x2cc10e){var _0x5a1c4c=require(_0x6d2b('0x51'));return db['Schedule'][_0x6d2b('0x46')]({'where':{'id':_0x51fd0e[_0x6d2b('0x4f')]['id']},'raw':!![]})[_0x6d2b('0x22')](handleEntityNotFound(_0xb77f9c,null))['then'](function(){_0x5a1c4c[_0x6d2b('0x50')](_0x51fd0e[_0x6d2b('0x4f')]['id']);})[_0x6d2b('0x22')](respondWithStatusCode(_0xb77f9c,null))[_0x6d2b('0x43')](handleError(_0xb77f9c,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 1421a46..aa6d189 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 _0x9316=['./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x677852,_0x1f10e3){var _0x3446c0=function(_0x55f682){while(--_0x55f682){_0x677852['push'](_0x677852['shift']());}};_0x3446c0(++_0x1f10e3);}(_0x9316,0x163));var _0x6931=function(_0x1e0f66,_0x19c0fb){_0x1e0f66=_0x1e0f66-0x0;var _0xbffdca=_0x9316[_0x1e0f66];return _0xbffdca;};'use strict';var _=require(_0x6931('0x0'));var util=require('util');var logger=require(_0x6931('0x1'))(_0x6931('0x2'));var moment=require(_0x6931('0x3'));var BPromise=require(_0x6931('0x4'));var rp=require(_0x6931('0x5'));var fs=require('fs');var path=require(_0x6931('0x6'));var rimraf=require(_0x6931('0x7'));var config=require(_0x6931('0x8'));var attributes=require(_0x6931('0x9'));module[_0x6931('0xa')]=function(_0x4f325b,_0x1b961f){return _0x4f325b[_0x6931('0xb')](_0x6931('0xc'),attributes,{'tableName':_0x6931('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf2c=['rimraf','../../config/environment','./schedule.attributes','exports','define','tools_schedules','lodash','../../config/logger','api','bluebird','path'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xdf2c,0x15b));var _0xcdf2=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xdf2c[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xcdf2('0x0'));var util=require('util');var logger=require(_0xcdf2('0x1'))(_0xcdf2('0x2'));var moment=require('moment');var BPromise=require(_0xcdf2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcdf2('0x4'));var rimraf=require(_0xcdf2('0x5'));var config=require(_0xcdf2('0x6'));var attributes=require(_0xcdf2('0x7'));module[_0xcdf2('0x8')]=function(_0x3b3b63,_0x30cf14){return _0x3b3b63[_0xcdf2('0x9')]('Schedule',attributes,{'tableName':_0xcdf2('0xa'),'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 1330122..bc19be9 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 _0xf0da=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','stringify','error','code','Schedule,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2419f1,_0x2edfe7){var _0x56bb6f=function(_0x16c877){while(--_0x16c877){_0x2419f1['push'](_0x2419f1['shift']());}};_0x56bb6f(++_0x2edfe7);}(_0xf0da,0x6a));var _0xaf0d=function(_0x3a5482,_0x291544){_0x3a5482=_0x3a5482-0x0;var _0x208b23=_0xf0da[_0x3a5482];return _0x208b23;};'use strict';var _=require(_0xaf0d('0x0'));var util=require(_0xaf0d('0x1'));var moment=require(_0xaf0d('0x2'));var BPromise=require(_0xaf0d('0x3'));var rs=require(_0xaf0d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf0d('0x5'))['db'];var utils=require(_0xaf0d('0x6'));var logger=require(_0xaf0d('0x7'))('rpc');var config=require(_0xaf0d('0x8'));var jayson=require(_0xaf0d('0x9'));var client=jayson[_0xaf0d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32aff6,_0x56e7d8,_0x28d7ab){return new BPromise(function(_0x2dd079,_0x5bf8d9){return client['request'](_0x32aff6,_0x28d7ab)[_0xaf0d('0xb')](function(_0x253f87){logger[_0xaf0d('0xc')]('Schedule,\x20%s,\x20%s',_0x56e7d8,_0xaf0d('0xd'));logger[_0xaf0d('0xe')]('Schedule,\x20%s,\x20%s,\x20%s',_0x56e7d8,_0xaf0d('0xd'),JSON[_0xaf0d('0xf')](_0x253f87));if(_0x253f87[_0xaf0d('0x10')]){if(_0x253f87[_0xaf0d('0x10')][_0xaf0d('0x11')]===0x1f4){logger[_0xaf0d('0x10')](_0xaf0d('0x12'),_0x56e7d8,_0x253f87[_0xaf0d('0x10')][_0xaf0d('0x13')]);return _0x5bf8d9(_0x253f87[_0xaf0d('0x10')][_0xaf0d('0x13')]);}logger[_0xaf0d('0x10')]('Schedule,\x20%s,\x20%s',_0x56e7d8,_0x253f87['error'][_0xaf0d('0x13')]);return _0x2dd079(_0x253f87[_0xaf0d('0x10')][_0xaf0d('0x13')]);}else{logger[_0xaf0d('0xc')]('Schedule,\x20%s,\x20%s',_0x56e7d8,_0xaf0d('0xd'));_0x2dd079(_0x253f87[_0xaf0d('0x14')]['message']);}})[_0xaf0d('0x15')](function(_0x58579a){logger[_0xaf0d('0x10')](_0xaf0d('0x12'),_0x56e7d8,_0x58579a);_0x5bf8d9(_0x58579a);});});} \ No newline at end of file +var _0x3961=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','code','message','Schedule,\x20%s,\x20%s','result','util','moment','bluebird'];(function(_0x4be8ba,_0x5d10ba){var _0x1af822=function(_0x40ed8a){while(--_0x40ed8a){_0x4be8ba['push'](_0x4be8ba['shift']());}};_0x1af822(++_0x5d10ba);}(_0x3961,0x15d));var _0x1396=function(_0x4eb7e6,_0x451464){_0x4eb7e6=_0x4eb7e6-0x0;var _0x3cf508=_0x3961[_0x4eb7e6];return _0x3cf508;};'use strict';var _=require('lodash');var util=require(_0x1396('0x0'));var moment=require(_0x1396('0x1'));var BPromise=require(_0x1396('0x2'));var rs=require(_0x1396('0x3'));var fs=require('fs');var Redis=require(_0x1396('0x4'));var db=require(_0x1396('0x5'))['db'];var utils=require(_0x1396('0x6'));var logger=require(_0x1396('0x7'))(_0x1396('0x8'));var config=require('../../config/environment');var jayson=require(_0x1396('0x9'));var client=jayson[_0x1396('0xa')][_0x1396('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24961b,_0x503176,_0x4b2bb1){return new BPromise(function(_0x14798c,_0x37d7e6){return client[_0x1396('0xc')](_0x24961b,_0x4b2bb1)[_0x1396('0xd')](function(_0x319b6a){logger[_0x1396('0xe')]('Schedule,\x20%s,\x20%s',_0x503176,'request\x20sent');logger[_0x1396('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x503176,_0x1396('0x10'),JSON['stringify'](_0x319b6a));if(_0x319b6a['error']){if(_0x319b6a[_0x1396('0x11')][_0x1396('0x12')]===0x1f4){logger[_0x1396('0x11')]('Schedule,\x20%s,\x20%s',_0x503176,_0x319b6a[_0x1396('0x11')][_0x1396('0x13')]);return _0x37d7e6(_0x319b6a[_0x1396('0x11')][_0x1396('0x13')]);}logger[_0x1396('0x11')](_0x1396('0x14'),_0x503176,_0x319b6a[_0x1396('0x11')][_0x1396('0x13')]);return _0x14798c(_0x319b6a[_0x1396('0x11')][_0x1396('0x13')]);}else{logger[_0x1396('0xe')]('Schedule,\x20%s,\x20%s',_0x503176,_0x1396('0x10'));_0x14798c(_0x319b6a[_0x1396('0x15')][_0x1396('0x13')]);}})['catch'](function(_0x4a8290){logger[_0x1396('0x11')]('Schedule,\x20%s,\x20%s',_0x503176,_0x4a8290);_0x37d7e6(_0x4a8290);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index c7ab402..b35c7ad 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 _0xa84f=['/describe','describe','/:id/download','download','post','put','update','delete','/:id','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x4fa44e,_0x4fb8be){var _0x2757f6=function(_0x773de9){while(--_0x773de9){_0x4fa44e['push'](_0x4fa44e['shift']());}};_0x2757f6(++_0x4fb8be);}(_0xa84f,0xa5));var _0xfa84=function(_0x32b894,_0x14c458){_0x32b894=_0x32b894-0x0;var _0x1f4d76=_0xa84f[_0x32b894];return _0x1f4d76;};'use strict';var multer=require(_0xfa84('0x0'));var util=require('util');var path=require(_0xfa84('0x1'));var timeout=require('connect-timeout');var express=require(_0xfa84('0x2'));var router=express[_0xfa84('0x3')]();var fs_extra=require(_0xfa84('0x4'));var auth=require(_0xfa84('0x5'));var interaction=require(_0xfa84('0x6'));var config=require(_0xfa84('0x7'));var controller=require('./screenRecording.controller');router[_0xfa84('0x8')]('/',auth[_0xfa84('0x9')](),controller[_0xfa84('0xa')]);router[_0xfa84('0x8')](_0xfa84('0xb'),auth[_0xfa84('0x9')](),controller[_0xfa84('0xc')]);router[_0xfa84('0x8')]('/:id',auth[_0xfa84('0x9')](),controller['show']);router[_0xfa84('0x8')](_0xfa84('0xd'),auth[_0xfa84('0x9')](),controller[_0xfa84('0xe')]);router[_0xfa84('0xf')]('/',auth[_0xfa84('0x9')](),controller['create']);router[_0xfa84('0x10')]('/:id',auth[_0xfa84('0x9')](),controller[_0xfa84('0x11')]);router[_0xfa84('0x12')](_0xfa84('0x13'),auth[_0xfa84('0x9')](),controller[_0xfa84('0x14')]);module[_0xfa84('0x15')]=router; \ No newline at end of file +var _0xc9c7=['../../config/environment','./screenRecording.controller','get','isAuthenticated','describe','/:id','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x42b661,_0x5de688){var _0xc9e134=function(_0x5ae345){while(--_0x5ae345){_0x42b661['push'](_0x42b661['shift']());}};_0xc9e134(++_0x5de688);}(_0xc9c7,0x101));var _0x7c9c=function(_0x38f15b,_0x8badc4){_0x38f15b=_0x38f15b-0x0;var _0x579f57=_0xc9c7[_0x38f15b];return _0x579f57;};'use strict';var multer=require(_0x7c9c('0x0'));var util=require(_0x7c9c('0x1'));var path=require(_0x7c9c('0x2'));var timeout=require(_0x7c9c('0x3'));var express=require(_0x7c9c('0x4'));var router=express['Router']();var fs_extra=require(_0x7c9c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7c9c('0x6'));var config=require(_0x7c9c('0x7'));var controller=require(_0x7c9c('0x8'));router[_0x7c9c('0x9')]('/',auth[_0x7c9c('0xa')](),controller['index']);router[_0x7c9c('0x9')]('/describe',auth[_0x7c9c('0xa')](),controller[_0x7c9c('0xb')]);router[_0x7c9c('0x9')](_0x7c9c('0xc'),auth[_0x7c9c('0xa')](),controller['show']);router['get'](_0x7c9c('0xd'),auth['isAuthenticated'](),controller[_0x7c9c('0xe')]);router[_0x7c9c('0xf')]('/',auth[_0x7c9c('0xa')](),controller[_0x7c9c('0x10')]);router[_0x7c9c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x7c9c('0x12')]);router[_0x7c9c('0x13')](_0x7c9c('0xc'),auth[_0x7c9c('0xa')](),controller[_0x7c9c('0x14')]);module[_0x7c9c('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 53e2e1d..748969a 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 _0x5532=['INTEGER','startedAt','subtract','duration','DATE','format','closedAt','MM-DD-YYYY\x20HH:mm','createdAt','toString','updatedAt','sequelize','moment','path','exports','getDataValue','value','extname','STRING','replace','setDataValue'];(function(_0x1c188b,_0x4edd30){var _0x37456a=function(_0x5c87de){while(--_0x5c87de){_0x1c188b['push'](_0x1c188b['shift']());}};_0x37456a(++_0x4edd30);}(_0x5532,0x19a));var _0x2553=function(_0x362c9a,_0x279764){_0x362c9a=_0x362c9a-0x0;var _0x35c9f9=_0x5532[_0x362c9a];return _0x35c9f9;};'use strict';var Sequelize=require(_0x2553('0x0'));var moment=require(_0x2553('0x1'));var path=require(_0x2553('0x2'));var config=require('../../config/environment');module[_0x2553('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x2553('0x4')](_0x2553('0x5'))?path[_0x2553('0x6')](this['getDataValue'](_0x2553('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x2553('0x7')],'set':function(_0x2d718e){var _0x568778=_0x2d718e[_0x2553('0x8')](/\\/g,'/');this[_0x2553('0x9')](_0x2553('0x5'),_0x568778);}},'rating':{'type':Sequelize[_0x2553('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x2553('0xa')],'set':function(_0x183d20){this[_0x2553('0x9')](_0x2553('0xb'),moment()[_0x2553('0xc')](_0x183d20,'ms'));this[_0x2553('0x9')]('closedAt',moment());this[_0x2553('0x9')](_0x2553('0xd'),_0x183d20);}},'startedAt':{'type':Sequelize[_0x2553('0xe')],'get':function(){return moment(this['getDataValue'](_0x2553('0xb')))[_0x2553('0xf')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize[_0x2553('0xe')],'get':function(){return moment(this['getDataValue'](_0x2553('0x10')))[_0x2553('0xf')](_0x2553('0x11'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x2553('0x4')](_0x2553('0x12')))[_0x2553('0xf')](_0x2553('0x11'))[_0x2553('0x13')]();}},'updatedAt':{'type':Sequelize[_0x2553('0xe')],'get':function(){return moment(this['getDataValue'](_0x2553('0x14')))[_0x2553('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x2553('0x13')]();}}}; \ No newline at end of file +var _0x57b7=['VIRTUAL','getDataValue','extname','value','STRING','replace','setDataValue','INTEGER','startedAt','DATE','format','MM-DD-YYYY\x20HH:mm','closedAt','toString','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x57b7,0x160));var _0x757b=function(_0x14e363,_0x7d1071){_0x14e363=_0x14e363-0x0;var _0x2c07a3=_0x57b7[_0x14e363];return _0x2c07a3;};'use strict';var Sequelize=require(_0x757b('0x0'));var moment=require(_0x757b('0x1'));var path=require(_0x757b('0x2'));var config=require(_0x757b('0x3'));module[_0x757b('0x4')]={'format':{'type':Sequelize[_0x757b('0x5')],'get':function(){return this[_0x757b('0x6')]('value')?path[_0x757b('0x7')](this[_0x757b('0x6')](_0x757b('0x8'))):undefined;}},'interactionid':{'type':Sequelize[_0x757b('0x9')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x757b('0x9')],'set':function(_0x8528c7){var _0x36c83c=_0x8528c7[_0x757b('0xa')](/\\/g,'/');this[_0x757b('0xb')](_0x757b('0x8'),_0x36c83c);}},'rating':{'type':Sequelize[_0x757b('0xc')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x757b('0xc')],'set':function(_0x53a1ce){this[_0x757b('0xb')](_0x757b('0xd'),moment()['subtract'](_0x53a1ce,'ms'));this[_0x757b('0xb')]('closedAt',moment());this[_0x757b('0xb')]('duration',_0x53a1ce);}},'startedAt':{'type':Sequelize[_0x757b('0xe')],'get':function(){return moment(this[_0x757b('0x6')]('startedAt'))[_0x757b('0xf')](_0x757b('0x10'))['toString']();}},'closedAt':{'type':Sequelize[_0x757b('0xe')],'get':function(){return moment(this['getDataValue'](_0x757b('0x11')))[_0x757b('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x757b('0x12')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x757b('0x6')](_0x757b('0x13')))[_0x757b('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x757b('0x12')]();}},'updatedAt':{'type':Sequelize[_0x757b('0xe')],'get':function(){return moment(this['getDataValue'](_0x757b('0x14')))['format']('MM-DD-YYYY\x20HH:mm')[_0x757b('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 6db759a..3e575ae 100644 --- a/server/api/screenRecording/screenRecording.controller.js +++ b/server/api/screenRecording/screenRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2ca=['ScreenRecording','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','rows','show','params','keys','find','create','catch','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','%s.cypher','existsSync','secrets','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','error','stack','name','send','index','map'];(function(_0x30b547,_0x5b89e9){var _0xab9618=function(_0x2259f2){while(--_0x2259f2){_0x30b547['push'](_0x30b547['shift']());}};_0xab9618(++_0x5b89e9);}(_0xf2ca,0x16a));var _0xaf2c=function(_0xcb6d2b,_0x1a56ac){_0xcb6d2b=_0xcb6d2b-0x0;var _0x2c3687=_0xf2ca[_0xcb6d2b];return _0x2c3687;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x3c1ae6,_0xe929b5){return function(_0xff396f){if(!_0xff396f){_0x3c1ae6[_0xaf2c('0x18')](0x194);}return _0xff396f;};}function handleError(_0x4a8dd8,_0x29f8b0){_0x29f8b0=_0x29f8b0||0x1f4;return function(_0x2051be){logger[_0xaf2c('0x24')](_0x2051be[_0xaf2c('0x25')]);if(_0x2051be['name']){delete _0x2051be[_0xaf2c('0x26')];}_0x4a8dd8['status'](_0x29f8b0)[_0xaf2c('0x27')](_0x2051be);};}exports[_0xaf2c('0x28')]=function(_0x15466b,_0x5d685a){var _0x2747bb={},_0x2ea490={},_0x3baee2={'count':0x0,'rows':[]};var _0x4a96d2=_[_0xaf2c('0x29')](db[_0xaf2c('0x2a')][_0xaf2c('0x2b')],function(_0x19364e){return{'name':_0x19364e['fieldName'],'type':_0x19364e[_0xaf2c('0x2c')][_0xaf2c('0x2d')]};});_0x2ea490[_0xaf2c('0x2e')]=_['differenceBy'](_['map'](_0x4a96d2,_0xaf2c('0x26')),['format']);_0x2ea490[_0xaf2c('0x2f')]=_['keys'](_0x15466b[_0xaf2c('0x2f')]);_0x2ea490[_0xaf2c('0x30')]=_['intersection'](_0x2ea490[_0xaf2c('0x2e')],_0x2ea490[_0xaf2c('0x2f')]);_0x2747bb['attributes']=_[_0xaf2c('0x31')](_0x2ea490[_0xaf2c('0x2e')],qs[_0xaf2c('0x32')](_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x32')]));_0x2747bb[_0xaf2c('0x33')]=_0x2747bb['attributes'][_0xaf2c('0x34')]?_0x2747bb['attributes']:_0x2ea490[_0xaf2c('0x2e')];if(!_0x15466b['query'][_0xaf2c('0x35')]('nolimit')){_0x2747bb[_0xaf2c('0x1e')]=qs['limit'](_0x15466b[_0xaf2c('0x2f')]['limit']);_0x2747bb[_0xaf2c('0x1c')]=qs[_0xaf2c('0x1c')](_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x1c')]);}_0x2747bb[_0xaf2c('0x36')]=qs['sort'](_0x15466b['query'][_0xaf2c('0x37')]);_0x2747bb[_0xaf2c('0x38')]=qs[_0xaf2c('0x30')](_[_0xaf2c('0x39')](_0x15466b[_0xaf2c('0x2f')],_0x2ea490[_0xaf2c('0x30')]),_0x4a96d2);if(_0x15466b['query'][_0xaf2c('0x3a')]){_0x2747bb[_0xaf2c('0x38')]=_['merge'](_0x2747bb[_0xaf2c('0x38')],{'$or':_[_0xaf2c('0x29')](_0x4a96d2,function(_0x25bebd){if(_0x25bebd[_0xaf2c('0x2c')]!==_0xaf2c('0x3b')){var _0x1e8eaf={};_0x1e8eaf[_0x25bebd[_0xaf2c('0x26')]]={'$like':'%'+_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x3a')]+'%'};return _0x1e8eaf;}})});}_0x2747bb=_[_0xaf2c('0x3c')]({},_0x2747bb,_0x15466b[_0xaf2c('0x3d')]);var _0x43f606={'where':_0x2747bb[_0xaf2c('0x38')]};return db['ScreenRecording']['count'](_0x43f606)['then'](function(_0x189809){_0x3baee2[_0xaf2c('0x3e')]=_0x189809;if(_0x15466b[_0xaf2c('0x2f')][_0xaf2c('0x3f')]){_0x2747bb[_0xaf2c('0x40')]=[{'all':!![]}];}return db[_0xaf2c('0x2a')]['findAll'](_0x2747bb);})[_0xaf2c('0x23')](function(_0x78632a){_0x3baee2[_0xaf2c('0x41')]=_0x78632a;return _0x3baee2;})['then'](respondWithFilteredResult(_0x5d685a,_0x2747bb))['catch'](handleError(_0x5d685a,null));};exports[_0xaf2c('0x42')]=function(_0x4f8440,_0x181787){var _0x25ba26={'raw':![],'where':{'id':_0x4f8440[_0xaf2c('0x43')]['id']}},_0x20fb99={};_0x20fb99['model']=_[_0xaf2c('0x44')](db['ScreenRecording'][_0xaf2c('0x2b')]);_0x20fb99[_0xaf2c('0x2f')]=_['keys'](_0x4f8440[_0xaf2c('0x2f')]);_0x20fb99['filters']=_[_0xaf2c('0x31')](_0x20fb99[_0xaf2c('0x2e')],_0x20fb99[_0xaf2c('0x2f')]);_0x25ba26[_0xaf2c('0x33')]=_[_0xaf2c('0x31')](_0x20fb99[_0xaf2c('0x2e')],qs[_0xaf2c('0x32')](_0x4f8440[_0xaf2c('0x2f')][_0xaf2c('0x32')]));_0x25ba26['attributes']=_0x25ba26['attributes'][_0xaf2c('0x34')]?_0x25ba26['attributes']:_0x20fb99['model'];if(_0x4f8440['query'][_0xaf2c('0x3f')]){_0x25ba26[_0xaf2c('0x40')]=[{'all':!![]}];}_0x25ba26=_[_0xaf2c('0x3c')]({},_0x25ba26,_0x4f8440[_0xaf2c('0x3d')]);return db['ScreenRecording'][_0xaf2c('0x45')](_0x25ba26)['then'](handleEntityNotFound(_0x181787,null))[_0xaf2c('0x23')](respondWithResult(_0x181787,null))['catch'](handleError(_0x181787,null));};exports[_0xaf2c('0x46')]=function(_0x133e8c,_0x2d01b7){return db[_0xaf2c('0x2a')][_0xaf2c('0x46')](_0x133e8c['body'],{})[_0xaf2c('0x23')](respondWithResult(_0x2d01b7,0xc9))[_0xaf2c('0x47')](handleError(_0x2d01b7,null));};exports['update']=function(_0x4e8efd,_0x367b30){if(_0x4e8efd['body']['id']){delete _0x4e8efd[_0xaf2c('0x48')]['id'];}delete _0x4e8efd[_0xaf2c('0x48')][_0xaf2c('0x49')];delete _0x4e8efd[_0xaf2c('0x48')][_0xaf2c('0x4a')];delete _0x4e8efd[_0xaf2c('0x48')][_0xaf2c('0x4b')];delete _0x4e8efd[_0xaf2c('0x48')][_0xaf2c('0x4c')];return db[_0xaf2c('0x2a')][_0xaf2c('0x45')]({'where':{'id':_0x4e8efd['params']['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x367b30,null))[_0xaf2c('0x23')](saveUpdates(_0x4e8efd['body'],null))['then'](respondWithResult(_0x367b30,null))['catch'](handleError(_0x367b30,null));};exports[_0xaf2c('0x4d')]=function(_0x1f6907,_0x551061){return db[_0xaf2c('0x2a')][_0xaf2c('0x4d')]()[_0xaf2c('0x23')](respondWithResult(_0x551061,null))[_0xaf2c('0x47')](handleError(_0x551061,null));};exports[_0xaf2c('0x4e')]=function(_0x170e67,_0x22b1fc,_0x490b95){var _0x2df52e=require(_0xaf2c('0x4f'));var _0x5771e5=![];var _0x245797={};if(_0x170e67[_0xaf2c('0x2f')][_0xaf2c('0x2c')]&&_0x170e67[_0xaf2c('0x2f')][_0xaf2c('0x2c')]===_0xaf2c('0x50')){_0x245797[_0xaf2c('0x50')]=_0x170e67[_0xaf2c('0x43')]['id'];}else{_0x245797['id']=_0x170e67[_0xaf2c('0x43')]['id'];}return db[_0xaf2c('0x2a')][_0xaf2c('0x45')]({'where':_0x245797,'attributes':['id',_0xaf2c('0x4c')],'raw':!![]})[_0xaf2c('0x23')](handleEntityNotFound(_0x22b1fc,null))[_0xaf2c('0x23')](function(_0x297a22){if(_0x297a22){var _0x2d6677=path[_0xaf2c('0x51')](config[_0xaf2c('0x52')],_0xaf2c('0x53'),_0x297a22[_0xaf2c('0x4c')]);var _0x5321c3=util[_0xaf2c('0x54')](_0xaf2c('0x55'),_0x2d6677);if(fs[_0xaf2c('0x56')](_0x5321c3)){_0x5771e5=!![];return _0x2df52e['decryptFile'](_0x5321c3,_0x2d6677,config[_0xaf2c('0x57')]['recording'])[_0xaf2c('0x23')](function(){return _0x297a22;});}return _0x297a22;}})[_0xaf2c('0x23')](function(_0xb3ad9){if(_0xb3ad9){var _0x45918b=path[_0xaf2c('0x51')](config[_0xaf2c('0x52')],_0xaf2c('0x53'),_0xb3ad9[_0xaf2c('0x4c')]);if(!fs[_0xaf2c('0x56')](_0x45918b)){throw new db['Sequelize'][(_0xaf2c('0x58'))](_0xaf2c('0x59'));}if(_0xb3ad9[_0xaf2c('0x5a')]){return _0x22b1fc[_0xaf2c('0x4e')](_0x45918b,_0xb3ad9[_0xaf2c('0x5a')]+path['extname'](_0x45918b),function(){if(_0x5771e5){fs[_0xaf2c('0x5b')](_0x45918b);}});}else{return _0x22b1fc[_0xaf2c('0x4e')](_0x45918b,function(_0x506000){if(_0x5771e5){fs[_0xaf2c('0x5b')](_0x45918b);}});}}})[_0xaf2c('0x47')](function(_0x4b7070){if(_0x4b7070['message']===_0xaf2c('0x59')){_0x22b1fc[_0xaf2c('0x19')](0x194)[_0xaf2c('0x27')](_0xaf2c('0x5c'));}else{return handleError(_0x22b1fc,null);}});};exports['destroy']=function(_0x36b6f0,_0x3f48f1){return db['ScreenRecording'][_0xaf2c('0x45')]({'where':{'id':_0x36b6f0['params']['id']}})[_0xaf2c('0x23')](function(_0xe6a251){if(_[_0xaf2c('0x5d')](_0xe6a251)){throw new ReferenceError(_0xaf2c('0x5e'));}return _0xe6a251;})[_0xaf2c('0x23')](function(_0x348f7e){var _0x1c9639=path[_0xaf2c('0x51')](config[_0xaf2c('0x52')],_0xaf2c('0x53'),_0x348f7e['value']);logger[_0xaf2c('0x5f')](_0xaf2c('0x60'),_0x1c9639);if(!_[_0xaf2c('0x5d')](_0x348f7e[_0xaf2c('0x4c')])&&fs[_0xaf2c('0x56')](_0x1c9639)){logger['info'](_0xaf2c('0x61')+_0x1c9639+_0xaf2c('0x62'));fs[_0xaf2c('0x63')](_0x1c9639);}_0x1c9639=_0x1c9639+_0xaf2c('0x64');if(!_[_0xaf2c('0x5d')](_0x348f7e['value'])&&fs['existsSync'](_0x1c9639)){logger[_0xaf2c('0x5f')](_0xaf2c('0x61')+_0x1c9639+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xaf2c('0x63')](_0x1c9639);}return _0x348f7e;})[_0xaf2c('0x23')](function(_0x2e189b){if(!_0x2e189b)throw new InternalError();return _0x2e189b['destroy']();})[_0xaf2c('0x23')](function(){_0x3f48f1[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();})[_0xaf2c('0x47')](handleError(_0x3f48f1,null));}; \ No newline at end of file +var _0x4b84=['query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','ScreenRecording','includeAll','include','findAll','rows','show','params','find','catch','create','body','duration','createdAt','closedAt','value','download','uniqueid','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','join','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','send','Not\x20found','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','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','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','rawAttributes','fieldName','type','key','model','differenceBy','map','format'];(function(_0x2a975f,_0x1c5652){var _0x543a3d=function(_0x467f1c){while(--_0x467f1c){_0x2a975f['push'](_0x2a975f['shift']());}};_0x543a3d(++_0x1c5652);}(_0x4b84,0x1cc));var _0x44b8=function(_0x32c012,_0xe3c576){_0x32c012=_0x32c012-0x0;var _0x48562e=_0x4b84[_0x32c012];return _0x48562e;};'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(){_0x1418db[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();});}};}function handleEntityNotFound(_0x25a0c1,_0x47689e){return function(_0x230a3d){if(!_0x230a3d){_0x25a0c1['sendStatus'](0x194);}return _0x230a3d;};}function handleError(_0x474f01,_0x502acf){_0x502acf=_0x502acf||0x1f4;return function(_0x41d673){logger[_0x44b8('0x22')](_0x41d673['stack']);if(_0x41d673[_0x44b8('0x23')]){delete _0x41d673[_0x44b8('0x23')];}_0x474f01[_0x44b8('0x14')](_0x502acf)['send'](_0x41d673);};}exports[_0x44b8('0x24')]=function(_0x242342,_0x53d9c7){var _0x2e0174={},_0x4a182d={},_0xfb0028={'count':0x0,'rows':[]};var _0x5a544c=_['map'](db['ScreenRecording'][_0x44b8('0x25')],function(_0x29b18d){return{'name':_0x29b18d[_0x44b8('0x26')],'type':_0x29b18d[_0x44b8('0x27')][_0x44b8('0x28')]};});_0x4a182d[_0x44b8('0x29')]=_[_0x44b8('0x2a')](_[_0x44b8('0x2b')](_0x5a544c,_0x44b8('0x23')),[_0x44b8('0x2c')]);_0x4a182d[_0x44b8('0x2d')]=_[_0x44b8('0x2e')](_0x242342[_0x44b8('0x2d')]);_0x4a182d['filters']=_[_0x44b8('0x2f')](_0x4a182d['model'],_0x4a182d[_0x44b8('0x2d')]);_0x2e0174[_0x44b8('0x30')]=_[_0x44b8('0x2f')](_0x4a182d[_0x44b8('0x29')],qs[_0x44b8('0x31')](_0x242342['query'][_0x44b8('0x31')]));_0x2e0174[_0x44b8('0x30')]=_0x2e0174[_0x44b8('0x30')][_0x44b8('0x32')]?_0x2e0174[_0x44b8('0x30')]:_0x4a182d['model'];if(!_0x242342[_0x44b8('0x2d')][_0x44b8('0x33')](_0x44b8('0x34'))){_0x2e0174[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x242342[_0x44b8('0x2d')][_0x44b8('0x17')]);_0x2e0174[_0x44b8('0x19')]=qs[_0x44b8('0x19')](_0x242342[_0x44b8('0x2d')][_0x44b8('0x19')]);}_0x2e0174[_0x44b8('0x35')]=qs[_0x44b8('0x36')](_0x242342[_0x44b8('0x2d')][_0x44b8('0x36')]);_0x2e0174[_0x44b8('0x37')]=qs[_0x44b8('0x38')](_[_0x44b8('0x39')](_0x242342[_0x44b8('0x2d')],_0x4a182d[_0x44b8('0x38')]),_0x5a544c);if(_0x242342[_0x44b8('0x2d')][_0x44b8('0x3a')]){_0x2e0174['where']=_[_0x44b8('0x3b')](_0x2e0174[_0x44b8('0x37')],{'$or':_['map'](_0x5a544c,function(_0x25688b){if(_0x25688b[_0x44b8('0x27')]!==_0x44b8('0x3c')){var _0x332c2b={};_0x332c2b[_0x25688b['name']]={'$like':'%'+_0x242342[_0x44b8('0x2d')][_0x44b8('0x3a')]+'%'};return _0x332c2b;}})});}_0x2e0174=_[_0x44b8('0x3b')]({},_0x2e0174,_0x242342[_0x44b8('0x3d')]);var _0x9cb2a={'where':_0x2e0174[_0x44b8('0x37')]};return db[_0x44b8('0x3e')][_0x44b8('0x18')](_0x9cb2a)[_0x44b8('0x20')](function(_0x3d1be1){_0xfb0028[_0x44b8('0x18')]=_0x3d1be1;if(_0x242342[_0x44b8('0x2d')][_0x44b8('0x3f')]){_0x2e0174[_0x44b8('0x40')]=[{'all':!![]}];}return db[_0x44b8('0x3e')][_0x44b8('0x41')](_0x2e0174);})['then'](function(_0x12a0a4){_0xfb0028[_0x44b8('0x42')]=_0x12a0a4;return _0xfb0028;})[_0x44b8('0x20')](respondWithFilteredResult(_0x53d9c7,_0x2e0174))['catch'](handleError(_0x53d9c7,null));};exports[_0x44b8('0x43')]=function(_0x1054c5,_0x229cc9){var _0x585a16={'raw':![],'where':{'id':_0x1054c5[_0x44b8('0x44')]['id']}},_0xbad4bb={};_0xbad4bb[_0x44b8('0x29')]=_[_0x44b8('0x2e')](db[_0x44b8('0x3e')]['rawAttributes']);_0xbad4bb['query']=_[_0x44b8('0x2e')](_0x1054c5[_0x44b8('0x2d')]);_0xbad4bb[_0x44b8('0x38')]=_[_0x44b8('0x2f')](_0xbad4bb[_0x44b8('0x29')],_0xbad4bb[_0x44b8('0x2d')]);_0x585a16[_0x44b8('0x30')]=_[_0x44b8('0x2f')](_0xbad4bb[_0x44b8('0x29')],qs[_0x44b8('0x31')](_0x1054c5[_0x44b8('0x2d')][_0x44b8('0x31')]));_0x585a16[_0x44b8('0x30')]=_0x585a16[_0x44b8('0x30')][_0x44b8('0x32')]?_0x585a16[_0x44b8('0x30')]:_0xbad4bb[_0x44b8('0x29')];if(_0x1054c5[_0x44b8('0x2d')][_0x44b8('0x3f')]){_0x585a16['include']=[{'all':!![]}];}_0x585a16=_['merge']({},_0x585a16,_0x1054c5[_0x44b8('0x3d')]);return db[_0x44b8('0x3e')][_0x44b8('0x45')](_0x585a16)[_0x44b8('0x20')](handleEntityNotFound(_0x229cc9,null))[_0x44b8('0x20')](respondWithResult(_0x229cc9,null))[_0x44b8('0x46')](handleError(_0x229cc9,null));};exports[_0x44b8('0x47')]=function(_0x4fe73f,_0x156070){return db['ScreenRecording'][_0x44b8('0x47')](_0x4fe73f[_0x44b8('0x48')],{})[_0x44b8('0x20')](respondWithResult(_0x156070,0xc9))[_0x44b8('0x46')](handleError(_0x156070,null));};exports[_0x44b8('0x1f')]=function(_0x35ca19,_0x491600){if(_0x35ca19[_0x44b8('0x48')]['id']){delete _0x35ca19[_0x44b8('0x48')]['id'];}delete _0x35ca19[_0x44b8('0x48')][_0x44b8('0x49')];delete _0x35ca19['body'][_0x44b8('0x4a')];delete _0x35ca19[_0x44b8('0x48')][_0x44b8('0x4b')];delete _0x35ca19[_0x44b8('0x48')][_0x44b8('0x4c')];return db[_0x44b8('0x3e')]['find']({'where':{'id':_0x35ca19[_0x44b8('0x44')]['id']}})[_0x44b8('0x20')](handleEntityNotFound(_0x491600,null))[_0x44b8('0x20')](saveUpdates(_0x35ca19[_0x44b8('0x48')],null))[_0x44b8('0x20')](respondWithResult(_0x491600,null))['catch'](handleError(_0x491600,null));};exports['describe']=function(_0x2516fc,_0x4eb344){return db[_0x44b8('0x3e')]['describe']()[_0x44b8('0x20')](respondWithResult(_0x4eb344,null))[_0x44b8('0x46')](handleError(_0x4eb344,null));};exports[_0x44b8('0x4d')]=function(_0x15f4c6,_0x2fa6b4,_0x32f588){var _0xdc67e8=require('../../components/encryptor');var _0x3ad278=![];var _0x37b2c2={};if(_0x15f4c6[_0x44b8('0x2d')]['type']&&_0x15f4c6[_0x44b8('0x2d')][_0x44b8('0x27')]===_0x44b8('0x4e')){_0x37b2c2[_0x44b8('0x4e')]=_0x15f4c6['params']['id'];}else{_0x37b2c2['id']=_0x15f4c6[_0x44b8('0x44')]['id'];}return db[_0x44b8('0x3e')]['find']({'where':_0x37b2c2,'attributes':['id',_0x44b8('0x4c')],'raw':!![]})[_0x44b8('0x20')](handleEntityNotFound(_0x2fa6b4,null))[_0x44b8('0x20')](function(_0x3df6aa){if(_0x3df6aa){var _0xe86e34=path['join'](config['root'],_0x44b8('0x4f'),_0x3df6aa[_0x44b8('0x4c')]);var _0xa30834=util[_0x44b8('0x2c')](_0x44b8('0x50'),_0xe86e34);if(fs[_0x44b8('0x51')](_0xa30834)){_0x3ad278=!![];return _0xdc67e8[_0x44b8('0x52')](_0xa30834,_0xe86e34,config[_0x44b8('0x53')][_0x44b8('0x54')])[_0x44b8('0x20')](function(){return _0x3df6aa;});}return _0x3df6aa;}})[_0x44b8('0x20')](function(_0x3f7576){if(_0x3f7576){var _0x5af3e6=path[_0x44b8('0x55')](config[_0x44b8('0x56')],_0x44b8('0x4f'),_0x3f7576[_0x44b8('0x4c')]);if(!fs[_0x44b8('0x51')](_0x5af3e6)){throw new db[(_0x44b8('0x57'))][(_0x44b8('0x58'))](_0x44b8('0x59'));}if(_0x3f7576[_0x44b8('0x5a')]){return _0x2fa6b4[_0x44b8('0x4d')](_0x5af3e6,_0x3f7576[_0x44b8('0x5a')]+path[_0x44b8('0x5b')](_0x5af3e6),function(){if(_0x3ad278){fs[_0x44b8('0x5c')](_0x5af3e6);}});}else{return _0x2fa6b4[_0x44b8('0x4d')](_0x5af3e6,function(_0x2250bb){if(_0x3ad278){fs[_0x44b8('0x5c')](_0x5af3e6);}});}}})[_0x44b8('0x46')](function(_0x20e563){if(_0x20e563['message']===_0x44b8('0x59')){_0x2fa6b4[_0x44b8('0x14')](0x194)[_0x44b8('0x5d')](_0x44b8('0x5e'));}else{return handleError(_0x2fa6b4,null);}});};exports[_0x44b8('0x21')]=function(_0x29ed5d,_0x2ecf65){return db['ScreenRecording'][_0x44b8('0x45')]({'where':{'id':_0x29ed5d[_0x44b8('0x44')]['id']}})['then'](function(_0x2a95f6){if(_[_0x44b8('0x5f')](_0x2a95f6)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2a95f6;})[_0x44b8('0x20')](function(_0x454fe6){var _0x370618=path['join'](config[_0x44b8('0x56')],'server/files/screen_recordings',_0x454fe6[_0x44b8('0x4c')]);logger['info'](_0x44b8('0x60'),_0x370618);if(!_[_0x44b8('0x5f')](_0x454fe6[_0x44b8('0x4c')])&&fs[_0x44b8('0x51')](_0x370618)){logger[_0x44b8('0x61')](_0x44b8('0x62')+_0x370618+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x44b8('0x63')](_0x370618);}_0x370618=_0x370618+'.cypher';if(!_[_0x44b8('0x5f')](_0x454fe6[_0x44b8('0x4c')])&&fs['existsSync'](_0x370618)){logger[_0x44b8('0x61')](_0x44b8('0x62')+_0x370618+_0x44b8('0x64'));fs[_0x44b8('0x63')](_0x370618);}return _0x454fe6;})[_0x44b8('0x20')](function(_0x3774fe){if(!_0x3774fe)throw new InternalError();return _0x3774fe[_0x44b8('0x21')]();})[_0x44b8('0x20')](function(){_0x2ecf65[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();})[_0x44b8('0x46')](handleError(_0x2ecf65,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 43a0e66..150e815 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 _0x4c2a=['api','moment','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid'];(function(_0xe229c3,_0x360e35){var _0x2e5bf3=function(_0x3ed15b){while(--_0x3ed15b){_0xe229c3['push'](_0xe229c3['shift']());}};_0x2e5bf3(++_0x360e35);}(_0x4c2a,0x15c));var _0xa4c2=function(_0x4a5c11,_0x204ec0){_0x4a5c11=_0x4a5c11-0x0;var _0x230f14=_0x4c2a[_0x4a5c11];return _0x230f14;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa4c2('0x0'));var moment=require(_0xa4c2('0x1'));var BPromise=require('bluebird');var rp=require(_0xa4c2('0x2'));var fs=require('fs');var path=require(_0xa4c2('0x3'));var rimraf=require(_0xa4c2('0x4'));var config=require(_0xa4c2('0x5'));var attributes=require(_0xa4c2('0x6'));module[_0xa4c2('0x7')]=function(_0x24ce0c,_0x279d5b){return _0x24ce0c[_0xa4c2('0x8')](_0xa4c2('0x9'),attributes,{'tableName':_0xa4c2('0xa'),'paranoid':![],'indexes':[{'name':_0xa4c2('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbb0b=['bluebird','request-promise','path','rimraf','./screenRecording.attributes','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb0b,0xb1));var _0xbbb0=function(_0x3fb2b4,_0x274e23){_0x3fb2b4=_0x3fb2b4-0x0;var _0x526434=_0xbb0b[_0x3fb2b4];return _0x526434;};'use strict';var _=require(_0xbbb0('0x0'));var util=require(_0xbbb0('0x1'));var logger=require(_0xbbb0('0x2'))(_0xbbb0('0x3'));var moment=require(_0xbbb0('0x4'));var BPromise=require(_0xbbb0('0x5'));var rp=require(_0xbbb0('0x6'));var fs=require('fs');var path=require(_0xbbb0('0x7'));var rimraf=require(_0xbbb0('0x8'));var config=require('../../config/environment');var attributes=require(_0xbbb0('0x9'));module['exports']=function(_0x7d23ca,_0x5e4cba){return _0x7d23ca[_0xbbb0('0xa')](_0xbbb0('0xb'),attributes,{'tableName':_0xbbb0('0xc'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xbbb0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 04290e5..aeb3576 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 _0xf2a6=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x516c23,_0x6ebaef){var _0x4d466d=function(_0x39b115){while(--_0x39b115){_0x516c23['push'](_0x516c23['shift']());}};_0x4d466d(++_0x6ebaef);}(_0xf2a6,0x11e));var _0x6f2a=function(_0x351f4f,_0x47dc30){_0x351f4f=_0x351f4f-0x0;var _0x538b9e=_0xf2a6[_0x351f4f];return _0x538b9e;};'use strict';var _=require(_0x6f2a('0x0'));var util=require(_0x6f2a('0x1'));var moment=require(_0x6f2a('0x2'));var BPromise=require(_0x6f2a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f2a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f2a('0x5'));var logger=require(_0x6f2a('0x6'))(_0x6f2a('0x7'));var config=require(_0x6f2a('0x8'));var jayson=require(_0x6f2a('0x9'));var client=jayson[_0x6f2a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b02ab,_0x6ea0c6,_0x3eba73){return new BPromise(function(_0x1b3c34,_0x1d7ef5){return client[_0x6f2a('0xb')](_0x2b02ab,_0x3eba73)[_0x6f2a('0xc')](function(_0x1cdaa0){logger[_0x6f2a('0xd')](_0x6f2a('0xe'),_0x6ea0c6,_0x6f2a('0xf'));logger[_0x6f2a('0x10')](_0x6f2a('0x11'),_0x6ea0c6,_0x6f2a('0xf'),JSON[_0x6f2a('0x12')](_0x1cdaa0));if(_0x1cdaa0[_0x6f2a('0x13')]){if(_0x1cdaa0['error'][_0x6f2a('0x14')]===0x1f4){logger[_0x6f2a('0x13')](_0x6f2a('0xe'),_0x6ea0c6,_0x1cdaa0[_0x6f2a('0x13')][_0x6f2a('0x15')]);return _0x1d7ef5(_0x1cdaa0[_0x6f2a('0x13')][_0x6f2a('0x15')]);}logger['error'](_0x6f2a('0xe'),_0x6ea0c6,_0x1cdaa0[_0x6f2a('0x13')][_0x6f2a('0x15')]);return _0x1b3c34(_0x1cdaa0['error'][_0x6f2a('0x15')]);}else{logger[_0x6f2a('0xd')](_0x6f2a('0xe'),_0x6ea0c6,_0x6f2a('0xf'));_0x1b3c34(_0x1cdaa0[_0x6f2a('0x16')]['message']);}})[_0x6f2a('0x17')](function(_0x14ad70){logger[_0x6f2a('0x13')](_0x6f2a('0xe'),_0x6ea0c6,_0x14ad70);_0x1d7ef5(_0x14ad70);});});} \ No newline at end of file +var _0xcc83=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','ScreenRecording,\x20%s,\x20%s','message','result'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xcc83,0x161));var _0x3cc8=function(_0x2012a5,_0x3465e4){_0x2012a5=_0x2012a5-0x0;var _0x21bdf6=_0xcc83[_0x2012a5];return _0x21bdf6;};'use strict';var _=require(_0x3cc8('0x0'));var util=require(_0x3cc8('0x1'));var moment=require(_0x3cc8('0x2'));var BPromise=require(_0x3cc8('0x3'));var rs=require(_0x3cc8('0x4'));var fs=require('fs');var Redis=require(_0x3cc8('0x5'));var db=require(_0x3cc8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3cc8('0x7'))(_0x3cc8('0x8'));var config=require(_0x3cc8('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc136,_0x247669,_0x37f0b5){return new BPromise(function(_0x5aed78,_0x59f526){return client[_0x3cc8('0xa')](_0x3dc136,_0x37f0b5)['then'](function(_0x245180){logger[_0x3cc8('0xb')]('ScreenRecording,\x20%s,\x20%s',_0x247669,_0x3cc8('0xc'));logger[_0x3cc8('0xd')](_0x3cc8('0xe'),_0x247669,'request\x20sent',JSON[_0x3cc8('0xf')](_0x245180));if(_0x245180[_0x3cc8('0x10')]){if(_0x245180[_0x3cc8('0x10')][_0x3cc8('0x11')]===0x1f4){logger[_0x3cc8('0x10')](_0x3cc8('0x12'),_0x247669,_0x245180[_0x3cc8('0x10')]['message']);return _0x59f526(_0x245180['error'][_0x3cc8('0x13')]);}logger[_0x3cc8('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x247669,_0x245180[_0x3cc8('0x10')][_0x3cc8('0x13')]);return _0x5aed78(_0x245180[_0x3cc8('0x10')][_0x3cc8('0x13')]);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x247669,_0x3cc8('0xc'));_0x5aed78(_0x245180[_0x3cc8('0x14')]['message']);}})[_0x3cc8('0x15')](function(_0x2873d9){logger[_0x3cc8('0x10')](_0x3cc8('0x12'),_0x247669,_0x2873d9);_0x59f526(_0x2873d9);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index d89c7ee..15d3edc 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 _0x8045=['isAuthenticated','index','/now','/:id','show','getLogo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','/:id/logo','single','file','addLogo','diskStorage','join','favicon','put','update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x5dc45d,_0x55f90f){var _0x4ce697=function(_0x4e6e21){while(--_0x4e6e21){_0x5dc45d['push'](_0x5dc45d['shift']());}};_0x4ce697(++_0x55f90f);}(_0x8045,0x94));var _0x5804=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x8045[_0xb24a3e];return _0x4038d7;};'use strict';var multer=require(_0x5804('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5804('0x1'));var express=require(_0x5804('0x2'));var router=express[_0x5804('0x3')]();var fs_extra=require(_0x5804('0x4'));var auth=require(_0x5804('0x5'));var interaction=require(_0x5804('0x6'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0x5804('0x7')]('/',auth[_0x5804('0x8')](),controller[_0x5804('0x9')]);router[_0x5804('0x7')](_0x5804('0xa'),controller['getDate']);router[_0x5804('0x7')](_0x5804('0xb'),controller[_0x5804('0xc')]);router[_0x5804('0x7')]('/:id/logo',controller[_0x5804('0xd')]);router[_0x5804('0x7')](_0x5804('0xe'),controller[_0x5804('0xf')]);router[_0x5804('0x7')]('/:id/gdpr',controller[_0x5804('0x10')]);router['get'](_0x5804('0x11'),controller[_0x5804('0x12')]);router['get'](_0x5804('0x13'),controller[_0x5804('0x14')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4f3a7b,_0x7a76ac,_0x4656ca){_0x4656ca(null,path['join'](config[_0x5804('0x15')],_0x5804('0x16')));},'filename':function(_0x83c942,_0x5a8633,_0x337dcf){_0x337dcf(null,util[_0x5804('0x17')](_0x5804('0x18'),_0x5804('0x19'),path[_0x5804('0x1a')](_0x5a8633[_0x5804('0x1b')])));}})});router[_0x5804('0x1c')](_0x5804('0x1d'),upload[_0x5804('0x1e')](_0x5804('0x1f')),controller[_0x5804('0x20')]);var upload=multer({'storage':multer[_0x5804('0x21')]({'destination':function(_0x68876f,_0x3d3a4d,_0x37b0b8){_0x37b0b8(null,path[_0x5804('0x22')](config[_0x5804('0x15')],_0x5804('0x16')));},'filename':function(_0x44a815,_0x1f2668,_0x5c9dc7){_0x5c9dc7(null,util[_0x5804('0x17')](_0x5804('0x18'),'logologin',path[_0x5804('0x1a')](_0x1f2668['originalname'])));}})});router[_0x5804('0x1c')]('/:id/logo_login',upload['single'](_0x5804('0x1f')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5d307d,_0x4597f0,_0x1af262){_0x1af262(null,path[_0x5804('0x22')](config[_0x5804('0x15')],_0x5804('0x16')));},'filename':function(_0x2af1c2,_0x46d7d9,_0x1fe29f){_0x1fe29f(null,util[_0x5804('0x17')](_0x5804('0x18'),'preferred',path[_0x5804('0x1a')](_0x46d7d9[_0x5804('0x1b')])));}})});router[_0x5804('0x1c')]('/:id/preferred',upload[_0x5804('0x1e')](_0x5804('0x1f')),controller['addPreferred']);var upload=multer({'storage':multer[_0x5804('0x21')]({'destination':function(_0x1d0ee9,_0x85d562,_0x4f5c73){_0x4f5c73(null,path[_0x5804('0x22')](config[_0x5804('0x15')],'server/files/images/logos/'));},'filename':function(_0x2620e1,_0x14bc51,_0xc61ba0){_0xc61ba0(null,util[_0x5804('0x17')](_0x5804('0x18'),_0x5804('0x23'),path[_0x5804('0x1a')](_0x14bc51[_0x5804('0x1b')])));}})});router['post'](_0x5804('0x13'),upload[_0x5804('0x1e')](_0x5804('0x1f')),controller['addFavicon']);router[_0x5804('0x24')]('/:id',auth[_0x5804('0x8')](),controller[_0x5804('0x25')]);module[_0x5804('0x26')]=router; \ No newline at end of file +var _0x0963=['diskStorage','join','root','format','%s%s','logo','extname','originalname','post','single','file','server/files/images/logos/','logologin','addLogoLogin','preferred','favicon','addFavicon','update','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','./setting.controller','get','isAuthenticated','index','/now','/:id','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon'];(function(_0x163f1f,_0x24762b){var _0x2e5b9c=function(_0x140dfa){while(--_0x140dfa){_0x163f1f['push'](_0x163f1f['shift']());}};_0x2e5b9c(++_0x24762b);}(_0x0963,0x142));var _0x3096=function(_0x368682,_0x56698f){_0x368682=_0x368682-0x0;var _0x2bc428=_0x0963[_0x368682];return _0x2bc428;};'use strict';var multer=require(_0x3096('0x0'));var util=require(_0x3096('0x1'));var path=require('path');var timeout=require(_0x3096('0x2'));var express=require(_0x3096('0x3'));var router=express['Router']();var fs_extra=require(_0x3096('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3096('0x5'));var config=require('../../config/environment');var controller=require(_0x3096('0x6'));router[_0x3096('0x7')]('/',auth[_0x3096('0x8')](),controller[_0x3096('0x9')]);router[_0x3096('0x7')](_0x3096('0xa'),controller['getDate']);router['get'](_0x3096('0xb'),controller['show']);router[_0x3096('0x7')](_0x3096('0xc'),controller[_0x3096('0xd')]);router[_0x3096('0x7')](_0x3096('0xe'),controller['getLogoLogin']);router['get'](_0x3096('0xf'),controller['gdpr']);router[_0x3096('0x7')](_0x3096('0x10'),controller[_0x3096('0x11')]);router['get'](_0x3096('0x12'),controller[_0x3096('0x13')]);var upload=multer({'storage':multer[_0x3096('0x14')]({'destination':function(_0x6f316d,_0x1d507d,_0x3116be){_0x3116be(null,path[_0x3096('0x15')](config[_0x3096('0x16')],'server/files/images/logos/'));},'filename':function(_0x5e0554,_0x2e77e9,_0x517dec){_0x517dec(null,util[_0x3096('0x17')](_0x3096('0x18'),_0x3096('0x19'),path[_0x3096('0x1a')](_0x2e77e9[_0x3096('0x1b')])));}})});router[_0x3096('0x1c')]('/:id/logo',upload[_0x3096('0x1d')](_0x3096('0x1e')),controller['addLogo']);var upload=multer({'storage':multer[_0x3096('0x14')]({'destination':function(_0x4962c5,_0x54db25,_0x131bb5){_0x131bb5(null,path[_0x3096('0x15')](config[_0x3096('0x16')],_0x3096('0x1f')));},'filename':function(_0x170741,_0x4be5fe,_0x4e550c){_0x4e550c(null,util[_0x3096('0x17')](_0x3096('0x18'),_0x3096('0x20'),path[_0x3096('0x1a')](_0x4be5fe[_0x3096('0x1b')])));}})});router['post'](_0x3096('0xe'),upload[_0x3096('0x1d')](_0x3096('0x1e')),controller[_0x3096('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5a0092,_0x7ea605,_0x182fc4){_0x182fc4(null,path[_0x3096('0x15')](config[_0x3096('0x16')],'server/files/images/logos/'));},'filename':function(_0x2dc8ab,_0x2eb3ad,_0xeb14b8){_0xeb14b8(null,util[_0x3096('0x17')](_0x3096('0x18'),_0x3096('0x22'),path[_0x3096('0x1a')](_0x2eb3ad[_0x3096('0x1b')])));}})});router['post'](_0x3096('0x10'),upload[_0x3096('0x1d')]('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0x3096('0x14')]({'destination':function(_0x3d76c2,_0x4b877c,_0x2f7a86){_0x2f7a86(null,path[_0x3096('0x15')](config[_0x3096('0x16')],'server/files/images/logos/'));},'filename':function(_0x3c2690,_0x2a4a86,_0x1340dd){_0x1340dd(null,util[_0x3096('0x17')]('%s%s',_0x3096('0x23'),path[_0x3096('0x1a')](_0x2a4a86['originalname'])));}})});router[_0x3096('0x1c')](_0x3096('0x12'),upload['single'](_0x3096('0x1e')),controller[_0x3096('0x24')]);router['put'](_0x3096('0xb'),auth[_0x3096('0x8')](),controller[_0x3096('0x25')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index f9fe776..c74b8c5 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 _0xfc09=['BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','INTEGER','min_internal','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0xfc09,0x67));var _0x9fc0=function(_0x55659d,_0x59013c){_0x55659d=_0x55659d-0x0;var _0x331b37=_0xfc09[_0x55659d];return _0x331b37;};'use strict';var Sequelize=require(_0x9fc0('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x9fc0('0x1')](0xb),'unique':_0x9fc0('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x9fc0('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x9fc0('0x3')],'defaultValue':_0x9fc0('0x4')},'logo':{'type':Sequelize[_0x9fc0('0x3')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x9fc0('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0x9fc0('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x9fc0('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x9fc0('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x9fc0('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x9fc0('0x3')]},'turnaddr':{'type':Sequelize[_0x9fc0('0x3')]},'turnusername':{'type':Sequelize[_0x9fc0('0x3')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x9fc0('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x9fc0('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x9fc0('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x9fc0('0x3')],'defaultValue':_0x9fc0('0x6')},'enableEmailPreview':{'type':Sequelize[_0x9fc0('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x9fc0('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x9fc0('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x9fc0('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x9fc0('0x3')],'defaultValue':_0x9fc0('0x7')},'chatTimeout':{'type':Sequelize[_0x9fc0('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x9fc0('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x9fc0('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x9fc0('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x9fc0('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0x9fc0('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x9fc0('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x9fc0('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x9fc0('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x9fc0('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x9fc0('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x9fc0('0x1')]},'transcribeRegion':{'type':Sequelize[_0x9fc0('0x3')]},'sentiment':{'type':Sequelize[_0x9fc0('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x9fc0('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x9fc0('0x1')]},'sentimentRegion':{'type':Sequelize[_0x9fc0('0x3')]},'language':{'type':Sequelize[_0x9fc0('0x3')]},'bucket':{'type':Sequelize[_0x9fc0('0x3')]},'googleSsoEnabled':{'type':Sequelize[_0x9fc0('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x9fc0('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x9fc0('0x1')](0x2)[_0x9fc0('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x9fc0('0x1')](0x2)[_0x9fc0('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x9fc0('0x1')](0x2)[_0x9fc0('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x9fc0('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x9fc0('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x9fc0('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x9fc0('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x9fc0('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x9fc0('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x9fc0('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x9fc0('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x9fc0('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x9fc0('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x9fc0('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x9fc0('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x9fc0('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0xe124=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','INTEGER','min_internal'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xe124,0xa0));var _0x4e12=function(_0x3351b7,_0x448982){_0x3351b7=_0x3351b7-0x0;var _0x44a44f=_0xe124[_0x3351b7];return _0x44a44f;};'use strict';var Sequelize=require('sequelize');module['exports']={'min_internal':{'type':Sequelize[_0x4e12('0x0')](0xb),'unique':_0x4e12('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x4e12('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x4e12('0x0')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x4e12('0x3')],'defaultValue':_0x4e12('0x4')},'logo':{'type':Sequelize[_0x4e12('0x3')]},'defaultLogo':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x4e12('0x3')]},'turnaddr':{'type':Sequelize[_0x4e12('0x3')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x4e12('0x3')]},'pageTitle':{'type':Sequelize[_0x4e12('0x3')]},'defaultPageTitle':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x4e12('0x0')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x4e12('0x3')],'defaultValue':_0x4e12('0x6')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x4e12('0x0')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x4e12('0x0')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x4e12('0x3')],'defaultValue':_0x4e12('0x7')},'chatTimeout':{'type':Sequelize[_0x4e12('0x0')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x4e12('0x3')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x4e12('0x3')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x4e12('0x3')]},'defaultFavicon':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x4e12('0x0')]},'transcribeRegion':{'type':Sequelize[_0x4e12('0x3')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x4e12('0x0')]},'sentimentRegion':{'type':Sequelize[_0x4e12('0x3')]},'language':{'type':Sequelize[_0x4e12('0x3')]},'bucket':{'type':Sequelize[_0x4e12('0x3')]},'googleSsoEnabled':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x4e12('0x0')](0x2)[_0x4e12('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x4e12('0x0')](0x2)[_0x4e12('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x4e12('0x0')](0x2)[_0x4e12('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x4e12('0x0')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x4e12('0x0')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x4e12('0x0')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x4e12('0x0')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x4e12('0x0')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x4e12('0x0')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x4e12('0x0')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x4e12('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 4408f7f..a00cacb 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 _0xbe02=['pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','intersection','body','find','addLogo','file','filename','logo','addLogoLogin','getLogo','server/files/images/logos','getLicense','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','join','root','toLower','default_logo.svg','default','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','getLogoLogin','existsSync','default_loginLogo.svg','custom','securePassword','addPreferred','getPreferred','defaultFavicon','default_preferred.png','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','Setting,\x20%s,\x20%s','message','result','status','end','offset','undefined','limit','count','set','apply','save','update','sendStatus','name','send','map','Setting','rawAttributes','fieldName','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','order','sort','where'];(function(_0x289872,_0x458582){var _0x4a8c2d=function(_0x156562){while(--_0x156562){_0x289872['push'](_0x289872['shift']());}};_0x4a8c2d(++_0x458582);}(_0xbe02,0x124));var _0x2be0=function(_0x2ee303,_0xc88680){_0x2ee303=_0x2ee303-0x0;var _0x1ca9e7=_0xbe02[_0x2ee303];return _0x1ca9e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2be0('0x0'));var zipdir=require(_0x2be0('0x1'));var jsonpatch=require(_0x2be0('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2be0('0x3'));var Mustache=require(_0x2be0('0x4'));var util=require('util');var path=require(_0x2be0('0x5'));var sox=require(_0x2be0('0x6'));var csv=require(_0x2be0('0x7'));var ejs=require(_0x2be0('0x8'));var fs=require('fs');var fs_extra=require(_0x2be0('0x9'));var _=require(_0x2be0('0xa'));var squel=require(_0x2be0('0xb'));var crypto=require('crypto');var jsforce=require(_0x2be0('0xc'));var deskjs=require(_0x2be0('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2be0('0xe'));var Redis=require('ioredis');var authService=require(_0x2be0('0xf'));var qs=require(_0x2be0('0x10'));var as=require(_0x2be0('0x11'));var hardwareService=require(_0x2be0('0x12'));var logger=require(_0x2be0('0x13'))('api');var utils=require(_0x2be0('0x14'));var config=require(_0x2be0('0x15'));var licenseUtil=require(_0x2be0('0x16'));var db=require(_0x2be0('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x2be0('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3baa57,_0x47e18b,_0x3d9b69,_0x4ff137){return new BPromise(function(_0x44d709,_0x44fb9f){var _0x3c5bca=_0x4ff137||client;return _0x3c5bca[_0x2be0('0x19')](_0x3baa57,_0x3d9b69)[_0x2be0('0x1a')](function(_0x5c0807){logger[_0x2be0('0x1b')]('Setting,\x20%s,\x20%s',_0x47e18b,_0x2be0('0x1c'));logger[_0x2be0('0x1d')](_0x2be0('0x1e'),_0x47e18b,_0x2be0('0x1c'),JSON[_0x2be0('0x1f')](_0x5c0807));if(_0x5c0807['error']){if(_0x5c0807[_0x2be0('0x20')]['code']===0x1f4){logger[_0x2be0('0x20')](_0x2be0('0x21'),_0x47e18b,_0x5c0807[_0x2be0('0x20')][_0x2be0('0x22')]);return _0x44fb9f(_0x5c0807[_0x2be0('0x20')][_0x2be0('0x22')]);}logger[_0x2be0('0x20')](_0x2be0('0x21'),_0x47e18b,_0x5c0807[_0x2be0('0x20')]['message']);return _0x44d709(_0x5c0807[_0x2be0('0x20')][_0x2be0('0x22')]);}else{logger[_0x2be0('0x1b')](_0x2be0('0x21'),_0x47e18b,'request\x20sent');_0x44d709(_0x5c0807[_0x2be0('0x23')][_0x2be0('0x22')]);}})['catch'](function(_0x4b02a2){logger[_0x2be0('0x20')]('Setting,\x20%s,\x20%s',_0x47e18b,_0x4b02a2);_0x44fb9f(_0x4b02a2);});});}function respondWithStatusCode(_0x20eb86,_0x4beef5){_0x4beef5=_0x4beef5||0xcc;return function(_0x23f224){if(_0x23f224){return _0x20eb86['sendStatus'](_0x4beef5);}return _0x20eb86[_0x2be0('0x24')](_0x4beef5)[_0x2be0('0x25')]();};}function respondWithResult(_0xab3a77,_0x29bc1d){_0x29bc1d=_0x29bc1d||0xc8;return function(_0x3813c7){if(_0x3813c7){return _0xab3a77[_0x2be0('0x24')](_0x29bc1d)['json'](_0x3813c7);}};}function respondWithFilteredResult(_0x23ae3f,_0x378ce4){return function(_0x416e84){if(_0x416e84){var _0x353f7d=typeof _0x378ce4[_0x2be0('0x26')]===_0x2be0('0x27')&&typeof _0x378ce4[_0x2be0('0x28')]===_0x2be0('0x27');var _0x134521=_0x416e84[_0x2be0('0x29')];var _0x131dfb=_0x353f7d?0x0:_0x378ce4[_0x2be0('0x26')];var _0x1a9ca3=_0x353f7d?_0x416e84[_0x2be0('0x29')]:_0x378ce4[_0x2be0('0x26')]+_0x378ce4[_0x2be0('0x28')];var _0x3ef9e2;if(_0x1a9ca3>=_0x134521){_0x1a9ca3=_0x134521;_0x3ef9e2=0xc8;}else{_0x3ef9e2=0xce;}_0x23ae3f[_0x2be0('0x24')](_0x3ef9e2);return _0x23ae3f[_0x2be0('0x2a')]('Content-Range',_0x131dfb+'-'+_0x1a9ca3+'/'+_0x134521)['json'](_0x416e84);}return null;};}function patchUpdates(_0x36ab07){return function(_0x263479){try{jsonpatch[_0x2be0('0x2b')](_0x263479,_0x36ab07,!![]);}catch(_0x5eb7ad){return BPromise['reject'](_0x5eb7ad);}return _0x263479[_0x2be0('0x2c')]();};}function saveUpdates(_0x53020e,_0x316d9f){return function(_0x3e2e31){if(_0x3e2e31){return _0x3e2e31[_0x2be0('0x2d')](_0x53020e)[_0x2be0('0x1a')](function(_0x77236a){return _0x77236a;});}return null;};}function removeEntity(_0x22b58d,_0x44e36b){return function(_0x6e7317){if(_0x6e7317){return _0x6e7317['destroy']()[_0x2be0('0x1a')](function(){_0x22b58d['status'](0xcc)[_0x2be0('0x25')]();});}};}function handleEntityNotFound(_0x2dcb7b,_0x2bcf47){return function(_0x267b57){if(!_0x267b57){_0x2dcb7b[_0x2be0('0x2e')](0x194);}return _0x267b57;};}function handleError(_0x3de30c,_0x27df46){_0x27df46=_0x27df46||0x1f4;return function(_0x148d62){logger['error'](_0x148d62['stack']);if(_0x148d62[_0x2be0('0x2f')]){delete _0x148d62['name'];}_0x3de30c[_0x2be0('0x24')](_0x27df46)[_0x2be0('0x30')](_0x148d62);};}exports['index']=function(_0x525161,_0x27d189){var _0x111dc0={},_0x4096b8={},_0x31457d={'count':0x0,'rows':[]};var _0x206ffa=_[_0x2be0('0x31')](db[_0x2be0('0x32')][_0x2be0('0x33')],function(_0x2eaf3b){return{'name':_0x2eaf3b[_0x2be0('0x34')],'type':_0x2eaf3b['type'][_0x2be0('0x35')]};});_0x4096b8['model']=_['map'](_0x206ffa,_0x2be0('0x2f'));_0x4096b8[_0x2be0('0x36')]=_[_0x2be0('0x37')](_0x525161['query']);_0x4096b8[_0x2be0('0x38')]=_['intersection'](_0x4096b8[_0x2be0('0x39')],_0x4096b8[_0x2be0('0x36')]);_0x111dc0[_0x2be0('0x3a')]=_['intersection'](_0x4096b8[_0x2be0('0x39')],qs[_0x2be0('0x3b')](_0x525161['query']['fields']));_0x111dc0[_0x2be0('0x3a')]=_0x111dc0[_0x2be0('0x3a')][_0x2be0('0x3c')]?_0x111dc0[_0x2be0('0x3a')]:_0x4096b8[_0x2be0('0x39')];if(!_0x525161[_0x2be0('0x36')][_0x2be0('0x3d')]('nolimit')){_0x111dc0[_0x2be0('0x28')]=qs[_0x2be0('0x28')](_0x525161[_0x2be0('0x36')][_0x2be0('0x28')]);_0x111dc0[_0x2be0('0x26')]=qs['offset'](_0x525161[_0x2be0('0x36')]['offset']);}_0x111dc0[_0x2be0('0x3e')]=qs[_0x2be0('0x3f')](_0x525161['query'][_0x2be0('0x3f')]);_0x111dc0[_0x2be0('0x40')]=qs['filters'](_[_0x2be0('0x41')](_0x525161['query'],_0x4096b8[_0x2be0('0x38')]),_0x206ffa);if(_0x525161[_0x2be0('0x36')]['filter']){_0x111dc0[_0x2be0('0x40')]=_[_0x2be0('0x42')](_0x111dc0[_0x2be0('0x40')],{'$or':_[_0x2be0('0x31')](_0x206ffa,function(_0x39355e){if(_0x39355e[_0x2be0('0x43')]!=='VIRTUAL'){var _0x4a7393={};_0x4a7393[_0x39355e[_0x2be0('0x2f')]]={'$like':'%'+_0x525161['query'][_0x2be0('0x44')]+'%'};return _0x4a7393;}})});}_0x111dc0=_[_0x2be0('0x42')]({},_0x111dc0,_0x525161[_0x2be0('0x45')]);var _0x44e13c={'where':_0x111dc0[_0x2be0('0x40')]};return db[_0x2be0('0x32')]['count'](_0x44e13c)[_0x2be0('0x1a')](function(_0x1b613e){_0x31457d['count']=_0x1b613e;if(_0x525161[_0x2be0('0x36')][_0x2be0('0x46')]){_0x111dc0[_0x2be0('0x47')]=[{'all':!![]}];}return db['Setting'][_0x2be0('0x48')](_0x111dc0);})[_0x2be0('0x1a')](function(_0x43845){_0x31457d[_0x2be0('0x49')]=_0x43845;return _0x31457d;})[_0x2be0('0x1a')](respondWithFilteredResult(_0x27d189,_0x111dc0))[_0x2be0('0x4a')](handleError(_0x27d189,null));};exports[_0x2be0('0x4b')]=function(_0x328852,_0x42ed0e){var _0x25dbc0={'raw':![],'where':{'id':_0x328852[_0x2be0('0x4c')]['id']}},_0x5c9265={};_0x5c9265[_0x2be0('0x39')]=_[_0x2be0('0x37')](db[_0x2be0('0x32')][_0x2be0('0x33')]);_0x5c9265[_0x2be0('0x36')]=_[_0x2be0('0x37')](_0x328852[_0x2be0('0x36')]);_0x5c9265['filters']=_[_0x2be0('0x4d')](_0x5c9265[_0x2be0('0x39')],_0x5c9265[_0x2be0('0x36')]);_0x25dbc0[_0x2be0('0x3a')]=_[_0x2be0('0x4d')](_0x5c9265[_0x2be0('0x39')],qs[_0x2be0('0x3b')](_0x328852[_0x2be0('0x36')][_0x2be0('0x3b')]));_0x25dbc0['attributes']=_0x25dbc0[_0x2be0('0x3a')][_0x2be0('0x3c')]?_0x25dbc0[_0x2be0('0x3a')]:_0x5c9265[_0x2be0('0x39')];if(_0x328852[_0x2be0('0x36')][_0x2be0('0x46')]){_0x25dbc0[_0x2be0('0x47')]=[{'all':!![]}];}_0x25dbc0=_[_0x2be0('0x42')]({},_0x25dbc0,_0x328852[_0x2be0('0x45')]);return db[_0x2be0('0x32')]['find'](_0x25dbc0)[_0x2be0('0x1a')](handleEntityNotFound(_0x42ed0e,null))[_0x2be0('0x1a')](respondWithResult(_0x42ed0e,null))[_0x2be0('0x4a')](handleError(_0x42ed0e,null));};exports[_0x2be0('0x2d')]=function(_0x113470,_0x11135b){if(_0x113470[_0x2be0('0x4e')]['id']){delete _0x113470[_0x2be0('0x4e')]['id'];}return db[_0x2be0('0x32')][_0x2be0('0x4f')]({'where':{'id':_0x113470[_0x2be0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x11135b,null))[_0x2be0('0x1a')](saveUpdates(_0x113470['body'],null))[_0x2be0('0x1a')](respondWithResult(_0x11135b,null))[_0x2be0('0x4a')](handleError(_0x11135b,null));};exports[_0x2be0('0x50')]=function(_0x26b23f,_0x43aa30,_0x1cdb82){if(_0x26b23f['file']&&_0x26b23f[_0x2be0('0x51')][_0x2be0('0x52')]){_0x26b23f[_0x2be0('0x4e')][_0x2be0('0x53')]=_0x26b23f[_0x2be0('0x51')][_0x2be0('0x52')];}return db[_0x2be0('0x32')][_0x2be0('0x4f')]({'where':{'id':_0x26b23f[_0x2be0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x43aa30,null))['then'](saveUpdates(_0x26b23f[_0x2be0('0x4e')],null))[_0x2be0('0x1a')](respondWithResult(_0x43aa30,null))[_0x2be0('0x4a')](handleError(_0x43aa30,null));};exports[_0x2be0('0x54')]=function(_0x411fcf,_0x1b73d5,_0x364355){if(_0x411fcf[_0x2be0('0x51')]&&_0x411fcf[_0x2be0('0x51')][_0x2be0('0x52')]){_0x411fcf[_0x2be0('0x4e')]['loginLogo']=_0x411fcf[_0x2be0('0x51')][_0x2be0('0x52')];}return db['Setting'][_0x2be0('0x4f')]({'where':{'id':_0x411fcf[_0x2be0('0x4c')]['id']}})[_0x2be0('0x1a')](handleEntityNotFound(_0x1b73d5,null))[_0x2be0('0x1a')](saveUpdates(_0x411fcf[_0x2be0('0x4e')],null))[_0x2be0('0x1a')](respondWithResult(_0x1b73d5,null))[_0x2be0('0x4a')](handleError(_0x1b73d5,null));};var utilLicense=require('../../config/license/util');exports[_0x2be0('0x55')]=function(_0x5b4d27,_0x2cfcae,_0xd45cb6){var _0x138876=_0x2be0('0x56');var _0x4503bc={'custom':![]};return utilLicense[_0x2be0('0x57')]()[_0x2be0('0x1a')](function(_0x1d323c){if(_0x1d323c){_0x4503bc=_0x1d323c;}return db['Setting'][_0x2be0('0x4f')]({'where':{'id':_0x5b4d27[_0x2be0('0x4c')]['id']},'attributes':['logo',_0x2be0('0x58'),_0x2be0('0x59'),_0x2be0('0x5a'),_0x2be0('0x5b'),_0x2be0('0x5c'),_0x2be0('0x5d'),'defaultFavicon'],'raw':!![]});})[_0x2be0('0x1a')](handleEntityNotFound(_0x2cfcae,null))[_0x2be0('0x1a')](function(_0x16ae0d){if(_0x16ae0d){var _0x4ed963=_0x16ae0d[_0x2be0('0x53')]&&fs['existsSync'](path[_0x2be0('0x5e')](config[_0x2be0('0x5f')],_0x138876,_['toLower'](_0x16ae0d['logo'])))?path[_0x2be0('0x5e')](config[_0x2be0('0x5f')],_0x138876,_['toLower'](_0x16ae0d['logo'])):path[_0x2be0('0x5e')](config[_0x2be0('0x5f')],_0x138876,_[_0x2be0('0x60')](_0x2be0('0x61')));var _0x27397d=_0x2be0('0x62')+_['upperFirst']('logo');if(_0x16ae0d[_0x27397d]||!_0x4503bc['custom']){_0x4ed963=path['join'](config[_0x2be0('0x5f')],_0x138876,_['toLower'](_0x2be0('0x61')));}if(!fs['existsSync'](_0x4ed963)){throw new db[(_0x2be0('0x63'))][(_0x2be0('0x64'))](_[_0x2be0('0x65')](_0x2be0('0x53'))+_0x2be0('0x66'));}return _0x2cfcae[_0x2be0('0x67')](_0x4ed963);}})['catch'](handleError(_0x2cfcae,null));};var utilLicense=require(_0x2be0('0x16'));exports[_0x2be0('0x68')]=function(_0x2719c4,_0x2ff513,_0xc6aaef){var _0x401460='server/files/images/logos';var _0x48ce60={'custom':![]};return utilLicense[_0x2be0('0x57')]()[_0x2be0('0x1a')](function(_0x11a493){if(_0x11a493){_0x48ce60=_0x11a493;}return db[_0x2be0('0x32')][_0x2be0('0x4f')]({'where':{'id':_0x2719c4[_0x2be0('0x4c')]['id']},'attributes':[_0x2be0('0x53'),_0x2be0('0x58'),_0x2be0('0x59'),'favicon',_0x2be0('0x5b'),_0x2be0('0x5c'),_0x2be0('0x5d'),'defaultFavicon'],'raw':!![]});})[_0x2be0('0x1a')](handleEntityNotFound(_0x2ff513,null))['then'](function(_0x46aee5){if(_0x46aee5){var _0x4ad6b8=_0x46aee5[_0x2be0('0x58')]&&fs[_0x2be0('0x69')](path[_0x2be0('0x5e')](config[_0x2be0('0x5f')],_0x401460,_['toLower'](_0x46aee5['loginLogo'])))?path[_0x2be0('0x5e')](config[_0x2be0('0x5f')],_0x401460,_['toLower'](_0x46aee5[_0x2be0('0x58')])):path[_0x2be0('0x5e')](config['root'],_0x401460,_[_0x2be0('0x60')](_0x2be0('0x6a')));var _0x543c78=_0x2be0('0x62')+_[_0x2be0('0x65')](_0x2be0('0x58'));if(_0x46aee5[_0x543c78]||!_0x48ce60[_0x2be0('0x6b')]){_0x4ad6b8=path['join'](config[_0x2be0('0x5f')],_0x401460,_['toLower'](_0x2be0('0x6a')));}if(!fs['existsSync'](_0x4ad6b8)){throw new db['Sequelize']['ValidationError'](_[_0x2be0('0x65')](_0x2be0('0x58'))+_0x2be0('0x66'));}return _0x2ff513[_0x2be0('0x67')](_0x4ad6b8);}})[_0x2be0('0x4a')](handleError(_0x2ff513,null));};exports['gdpr']=function(_0x3428e9,_0x61d2b7){return db[_0x2be0('0x32')]['find']({'where':{'id':_0x3428e9[_0x2be0('0x4c')]['id']},'attributes':[_0x2be0('0x6c')]})[_0x2be0('0x1a')](respondWithResult(_0x61d2b7,null))[_0x2be0('0x4a')](handleError(_0x61d2b7,null));};exports[_0x2be0('0x6d')]=function(_0x5dbd9b,_0x4c7b84,_0x23b05d){if(_0x5dbd9b[_0x2be0('0x51')]&&_0x5dbd9b[_0x2be0('0x51')]['filename']){_0x5dbd9b[_0x2be0('0x4e')][_0x2be0('0x59')]=_0x5dbd9b['file'][_0x2be0('0x52')];}return db[_0x2be0('0x32')][_0x2be0('0x4f')]({'where':{'id':_0x5dbd9b[_0x2be0('0x4c')]['id']}})[_0x2be0('0x1a')](handleEntityNotFound(_0x4c7b84,null))[_0x2be0('0x1a')](saveUpdates(_0x5dbd9b[_0x2be0('0x4e')],null))['then'](respondWithResult(_0x4c7b84,null))[_0x2be0('0x4a')](handleError(_0x4c7b84,null));};var utilLicense=require('../../config/license/util');exports[_0x2be0('0x6e')]=function(_0x1485af,_0x56969b,_0x118255){var _0x5d1789='server/files/images/logos';var _0xdc7f77={'custom':![]};return utilLicense['getLicense']()[_0x2be0('0x1a')](function(_0x1c4930){if(_0x1c4930){_0xdc7f77=_0x1c4930;}return db[_0x2be0('0x32')][_0x2be0('0x4f')]({'where':{'id':_0x1485af[_0x2be0('0x4c')]['id']},'attributes':[_0x2be0('0x53'),'loginLogo',_0x2be0('0x59'),_0x2be0('0x5a'),'defaultLogo',_0x2be0('0x5c'),_0x2be0('0x5d'),_0x2be0('0x6f')],'raw':!![]});})[_0x2be0('0x1a')](handleEntityNotFound(_0x56969b,null))[_0x2be0('0x1a')](function(_0x422234){if(_0x422234){var _0x4a658f=_0x422234['preferred']&&fs[_0x2be0('0x69')](path[_0x2be0('0x5e')](config[_0x2be0('0x5f')],_0x5d1789,_[_0x2be0('0x60')](_0x422234[_0x2be0('0x59')])))?path[_0x2be0('0x5e')](config[_0x2be0('0x5f')],_0x5d1789,_[_0x2be0('0x60')](_0x422234['preferred'])):path[_0x2be0('0x5e')](config[_0x2be0('0x5f')],_0x5d1789,_[_0x2be0('0x60')](_0x2be0('0x70')));var _0xd329=_0x2be0('0x62')+_[_0x2be0('0x65')]('preferred');if(_0x422234[_0xd329]||!_0xdc7f77[_0x2be0('0x6b')]||!_0xdc7f77[_0x2be0('0x59')]){_0x4a658f=path[_0x2be0('0x5e')](config['root'],_0x5d1789,_[_0x2be0('0x60')](_0x2be0('0x70')));}if(!fs[_0x2be0('0x69')](_0x4a658f)){throw new db['Sequelize'][(_0x2be0('0x64'))](_['upperFirst']('preferred')+_0x2be0('0x66'));}return _0x56969b['download'](_0x4a658f);}})[_0x2be0('0x4a')](handleError(_0x56969b,null));};exports['addFavicon']=function(_0x3af5d0,_0x7a6ea8,_0x2e14f3){if(_0x3af5d0[_0x2be0('0x51')]&&_0x3af5d0[_0x2be0('0x51')][_0x2be0('0x52')]){_0x3af5d0[_0x2be0('0x4e')][_0x2be0('0x5a')]=_0x3af5d0[_0x2be0('0x51')]['filename'];}return db['Setting'][_0x2be0('0x4f')]({'where':{'id':_0x3af5d0[_0x2be0('0x4c')]['id']}})[_0x2be0('0x1a')](handleEntityNotFound(_0x7a6ea8,null))[_0x2be0('0x1a')](saveUpdates(_0x3af5d0[_0x2be0('0x4e')],null))[_0x2be0('0x1a')](respondWithResult(_0x7a6ea8,null))[_0x2be0('0x4a')](handleError(_0x7a6ea8,null));};var utilLicense=require(_0x2be0('0x16'));exports[_0x2be0('0x71')]=function(_0x46432b,_0x2c86d8,_0x2c7f60){var _0x575b1b='server/files/images/logos';var _0x52dcc1={'custom':![]};return utilLicense[_0x2be0('0x57')]()[_0x2be0('0x1a')](function(_0x4d32f3){if(_0x4d32f3){_0x52dcc1=_0x4d32f3;}return db['Setting'][_0x2be0('0x4f')]({'where':{'id':_0x46432b[_0x2be0('0x4c')]['id']},'attributes':[_0x2be0('0x53'),_0x2be0('0x58'),'preferred',_0x2be0('0x5a'),_0x2be0('0x5b'),_0x2be0('0x5c'),'defaultPreferred',_0x2be0('0x6f')],'raw':!![]});})[_0x2be0('0x1a')](handleEntityNotFound(_0x2c86d8,null))[_0x2be0('0x1a')](function(_0x29d029){if(_0x29d029){var _0x1ffece=_0x29d029['favicon']&&fs['existsSync'](path['join'](config[_0x2be0('0x5f')],_0x575b1b,_[_0x2be0('0x60')](_0x29d029[_0x2be0('0x5a')])))?path[_0x2be0('0x5e')](config[_0x2be0('0x5f')],_0x575b1b,_[_0x2be0('0x60')](_0x29d029[_0x2be0('0x5a')])):path[_0x2be0('0x5e')](config[_0x2be0('0x5f')],_0x575b1b,_['toLower'](_0x2be0('0x72')));var _0x3df9e5='default'+_[_0x2be0('0x65')](_0x2be0('0x5a'));if(_0x29d029[_0x3df9e5]||!_0x52dcc1[_0x2be0('0x6b')]){_0x1ffece=path['join'](config[_0x2be0('0x5f')],_0x575b1b,_['toLower'](_0x2be0('0x72')));}if(!fs[_0x2be0('0x69')](_0x1ffece)){throw new db[(_0x2be0('0x63'))][(_0x2be0('0x64'))](_[_0x2be0('0x65')](_0x2be0('0x5a'))+_0x2be0('0x66'));}return _0x2c86d8['download'](_0x1ffece);}})[_0x2be0('0x4a')](handleError(_0x2c86d8,null));};exports[_0x2be0('0x73')]=function(_0x56db28,_0x1a6a30){var _0x271a08={'offset':moment()[_0x2be0('0x74')]()};_0x271a08[_0x2be0('0x75')]=moment()[_0x2be0('0x74')](_0x271a08['offset'])[_0x2be0('0x76')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x1a6a30[_0x2be0('0x24')](0xc8)[_0x2be0('0x30')](_0x271a08);}; \ No newline at end of file +var _0x4e8e=['preferred','defaultLogo','defaultLoginLogo','defaultPreferred','logo','existsSync','join','root','toLower','default_logo.svg','default','custom','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','getLogoLogin','defaultFavicon','default_loginLogo.svg','securePassword','default_preferred.png','addFavicon','favicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','stack','name','send','index','rawAttributes','fieldName','type','model','map','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','Setting','includeAll','include','findAll','show','params','intersection','options','find','body','filename','file','addLogoLogin','loginLogo','server/files/images/logos','getLicense'];(function(_0x10170b,_0x67f13c){var _0x13b147=function(_0x49c38e){while(--_0x49c38e){_0x10170b['push'](_0x10170b['shift']());}};_0x13b147(++_0x67f13c);}(_0x4e8e,0x95));var _0xe4e8=function(_0x2674c4,_0x165702){_0x2674c4=_0x2674c4-0x0;var _0x10f9c9=_0x4e8e[_0x2674c4];return _0x10f9c9;};'use strict';var emlformat=require(_0xe4e8('0x0'));var rimraf=require(_0xe4e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe4e8('0x2'));var moment=require(_0xe4e8('0x3'));var BPromise=require(_0xe4e8('0x4'));var Mustache=require(_0xe4e8('0x5'));var util=require('util');var path=require(_0xe4e8('0x6'));var sox=require(_0xe4e8('0x7'));var csv=require(_0xe4e8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe4e8('0x9'));var _=require(_0xe4e8('0xa'));var squel=require(_0xe4e8('0xb'));var crypto=require(_0xe4e8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe4e8('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe4e8('0xe'));var Papa=require(_0xe4e8('0xf'));var Redis=require(_0xe4e8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe4e8('0x11'));var as=require(_0xe4e8('0x12'));var hardwareService=require(_0xe4e8('0x13'));var logger=require(_0xe4e8('0x14'))(_0xe4e8('0x15'));var utils=require(_0xe4e8('0x16'));var config=require(_0xe4e8('0x17'));var licenseUtil=require(_0xe4e8('0x18'));var db=require(_0xe4e8('0x19'))['db'];var jayson=require(_0xe4e8('0x1a'));var client=jayson[_0xe4e8('0x1b')][_0xe4e8('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2f8a43,_0x5ba8ea,_0x30750d,_0x522d39){return new BPromise(function(_0x291488,_0x12ecc0){var _0x8ccbed=_0x522d39||client;return _0x8ccbed['request'](_0x2f8a43,_0x30750d)['then'](function(_0x413aec){logger['info'](_0xe4e8('0x1d'),_0x5ba8ea,'request\x20sent');logger[_0xe4e8('0x1e')](_0xe4e8('0x1f'),_0x5ba8ea,_0xe4e8('0x20'),JSON[_0xe4e8('0x21')](_0x413aec));if(_0x413aec[_0xe4e8('0x22')]){if(_0x413aec['error'][_0xe4e8('0x23')]===0x1f4){logger[_0xe4e8('0x22')](_0xe4e8('0x1d'),_0x5ba8ea,_0x413aec['error'][_0xe4e8('0x24')]);return _0x12ecc0(_0x413aec[_0xe4e8('0x22')][_0xe4e8('0x24')]);}logger[_0xe4e8('0x22')](_0xe4e8('0x1d'),_0x5ba8ea,_0x413aec[_0xe4e8('0x22')][_0xe4e8('0x24')]);return _0x291488(_0x413aec[_0xe4e8('0x22')]['message']);}else{logger[_0xe4e8('0x25')](_0xe4e8('0x1d'),_0x5ba8ea,_0xe4e8('0x20'));_0x291488(_0x413aec['result'][_0xe4e8('0x24')]);}})[_0xe4e8('0x26')](function(_0x4ca479){logger['error'](_0xe4e8('0x1d'),_0x5ba8ea,_0x4ca479);_0x12ecc0(_0x4ca479);});});}function respondWithStatusCode(_0x2e010f,_0x4292af){_0x4292af=_0x4292af||0xcc;return function(_0x1ed3e6){if(_0x1ed3e6){return _0x2e010f[_0xe4e8('0x27')](_0x4292af);}return _0x2e010f[_0xe4e8('0x28')](_0x4292af)['end']();};}function respondWithResult(_0x478c5f,_0x1c26d8){_0x1c26d8=_0x1c26d8||0xc8;return function(_0x54952f){if(_0x54952f){return _0x478c5f[_0xe4e8('0x28')](_0x1c26d8)[_0xe4e8('0x29')](_0x54952f);}};}function respondWithFilteredResult(_0x1e6bcb,_0xb7deb){return function(_0x457b3e){if(_0x457b3e){var _0x32be1e=typeof _0xb7deb[_0xe4e8('0x2a')]===_0xe4e8('0x2b')&&typeof _0xb7deb[_0xe4e8('0x2c')]===_0xe4e8('0x2b');var _0x1174c5=_0x457b3e['count'];var _0x3553d=_0x32be1e?0x0:_0xb7deb['offset'];var _0x13db82=_0x32be1e?_0x457b3e[_0xe4e8('0x2d')]:_0xb7deb[_0xe4e8('0x2a')]+_0xb7deb[_0xe4e8('0x2c')];var _0x3084e9;if(_0x13db82>=_0x1174c5){_0x13db82=_0x1174c5;_0x3084e9=0xc8;}else{_0x3084e9=0xce;}_0x1e6bcb[_0xe4e8('0x28')](_0x3084e9);return _0x1e6bcb[_0xe4e8('0x2e')](_0xe4e8('0x2f'),_0x3553d+'-'+_0x13db82+'/'+_0x1174c5)[_0xe4e8('0x29')](_0x457b3e);}return null;};}function patchUpdates(_0x455c92){return function(_0x36e3c0){try{jsonpatch['apply'](_0x36e3c0,_0x455c92,!![]);}catch(_0x5a6811){return BPromise[_0xe4e8('0x30')](_0x5a6811);}return _0x36e3c0['save']();};}function saveUpdates(_0x25f58a,_0x2de6bf){return function(_0x425d22){if(_0x425d22){return _0x425d22[_0xe4e8('0x31')](_0x25f58a)['then'](function(_0x39af87){return _0x39af87;});}return null;};}function removeEntity(_0x29acf1,_0xd70b97){return function(_0x34ea19){if(_0x34ea19){return _0x34ea19[_0xe4e8('0x32')]()[_0xe4e8('0x33')](function(){_0x29acf1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x158f82,_0xb0046f){return function(_0x4a4bf4){if(!_0x4a4bf4){_0x158f82['sendStatus'](0x194);}return _0x4a4bf4;};}function handleError(_0x491d64,_0x459ad1){_0x459ad1=_0x459ad1||0x1f4;return function(_0xb59928){logger['error'](_0xb59928[_0xe4e8('0x34')]);if(_0xb59928[_0xe4e8('0x35')]){delete _0xb59928[_0xe4e8('0x35')];}_0x491d64[_0xe4e8('0x28')](_0x459ad1)[_0xe4e8('0x36')](_0xb59928);};}exports[_0xe4e8('0x37')]=function(_0x489f4c,_0xcc7bc4){var _0x5f5633={},_0x1ce25b={},_0x61b72c={'count':0x0,'rows':[]};var _0x33ca17=_['map'](db['Setting'][_0xe4e8('0x38')],function(_0xf7b4af){return{'name':_0xf7b4af[_0xe4e8('0x39')],'type':_0xf7b4af[_0xe4e8('0x3a')]['key']};});_0x1ce25b[_0xe4e8('0x3b')]=_[_0xe4e8('0x3c')](_0x33ca17,_0xe4e8('0x35'));_0x1ce25b['query']=_[_0xe4e8('0x3d')](_0x489f4c[_0xe4e8('0x3e')]);_0x1ce25b['filters']=_['intersection'](_0x1ce25b[_0xe4e8('0x3b')],_0x1ce25b[_0xe4e8('0x3e')]);_0x5f5633[_0xe4e8('0x3f')]=_['intersection'](_0x1ce25b['model'],qs[_0xe4e8('0x40')](_0x489f4c[_0xe4e8('0x3e')][_0xe4e8('0x40')]));_0x5f5633[_0xe4e8('0x3f')]=_0x5f5633[_0xe4e8('0x3f')][_0xe4e8('0x41')]?_0x5f5633[_0xe4e8('0x3f')]:_0x1ce25b['model'];if(!_0x489f4c[_0xe4e8('0x3e')][_0xe4e8('0x42')](_0xe4e8('0x43'))){_0x5f5633[_0xe4e8('0x2c')]=qs[_0xe4e8('0x2c')](_0x489f4c['query'][_0xe4e8('0x2c')]);_0x5f5633[_0xe4e8('0x2a')]=qs[_0xe4e8('0x2a')](_0x489f4c['query'][_0xe4e8('0x2a')]);}_0x5f5633[_0xe4e8('0x44')]=qs['sort'](_0x489f4c['query'][_0xe4e8('0x45')]);_0x5f5633[_0xe4e8('0x46')]=qs[_0xe4e8('0x47')](_[_0xe4e8('0x48')](_0x489f4c['query'],_0x1ce25b['filters']),_0x33ca17);if(_0x489f4c[_0xe4e8('0x3e')][_0xe4e8('0x49')]){_0x5f5633[_0xe4e8('0x46')]=_[_0xe4e8('0x4a')](_0x5f5633['where'],{'$or':_[_0xe4e8('0x3c')](_0x33ca17,function(_0x2789a0){if(_0x2789a0[_0xe4e8('0x3a')]!=='VIRTUAL'){var _0x548e60={};_0x548e60[_0x2789a0[_0xe4e8('0x35')]]={'$like':'%'+_0x489f4c[_0xe4e8('0x3e')][_0xe4e8('0x49')]+'%'};return _0x548e60;}})});}_0x5f5633=_[_0xe4e8('0x4a')]({},_0x5f5633,_0x489f4c['options']);var _0x132c31={'where':_0x5f5633[_0xe4e8('0x46')]};return db[_0xe4e8('0x4b')][_0xe4e8('0x2d')](_0x132c31)[_0xe4e8('0x33')](function(_0x142aae){_0x61b72c[_0xe4e8('0x2d')]=_0x142aae;if(_0x489f4c[_0xe4e8('0x3e')][_0xe4e8('0x4c')]){_0x5f5633[_0xe4e8('0x4d')]=[{'all':!![]}];}return db['Setting'][_0xe4e8('0x4e')](_0x5f5633);})[_0xe4e8('0x33')](function(_0x1023d0){_0x61b72c['rows']=_0x1023d0;return _0x61b72c;})[_0xe4e8('0x33')](respondWithFilteredResult(_0xcc7bc4,_0x5f5633))[_0xe4e8('0x26')](handleError(_0xcc7bc4,null));};exports[_0xe4e8('0x4f')]=function(_0x3f4efa,_0x81a9f9){var _0x19ff10={'raw':![],'where':{'id':_0x3f4efa[_0xe4e8('0x50')]['id']}},_0x59c95c={};_0x59c95c[_0xe4e8('0x3b')]=_[_0xe4e8('0x3d')](db[_0xe4e8('0x4b')][_0xe4e8('0x38')]);_0x59c95c[_0xe4e8('0x3e')]=_[_0xe4e8('0x3d')](_0x3f4efa[_0xe4e8('0x3e')]);_0x59c95c[_0xe4e8('0x47')]=_[_0xe4e8('0x51')](_0x59c95c[_0xe4e8('0x3b')],_0x59c95c[_0xe4e8('0x3e')]);_0x19ff10[_0xe4e8('0x3f')]=_[_0xe4e8('0x51')](_0x59c95c[_0xe4e8('0x3b')],qs['fields'](_0x3f4efa[_0xe4e8('0x3e')][_0xe4e8('0x40')]));_0x19ff10['attributes']=_0x19ff10[_0xe4e8('0x3f')][_0xe4e8('0x41')]?_0x19ff10[_0xe4e8('0x3f')]:_0x59c95c[_0xe4e8('0x3b')];if(_0x3f4efa['query'][_0xe4e8('0x4c')]){_0x19ff10[_0xe4e8('0x4d')]=[{'all':!![]}];}_0x19ff10=_['merge']({},_0x19ff10,_0x3f4efa[_0xe4e8('0x52')]);return db[_0xe4e8('0x4b')][_0xe4e8('0x53')](_0x19ff10)[_0xe4e8('0x33')](handleEntityNotFound(_0x81a9f9,null))[_0xe4e8('0x33')](respondWithResult(_0x81a9f9,null))[_0xe4e8('0x26')](handleError(_0x81a9f9,null));};exports[_0xe4e8('0x31')]=function(_0x7f603,_0x51e27f){if(_0x7f603[_0xe4e8('0x54')]['id']){delete _0x7f603[_0xe4e8('0x54')]['id'];}return db[_0xe4e8('0x4b')][_0xe4e8('0x53')]({'where':{'id':_0x7f603[_0xe4e8('0x50')]['id']}})[_0xe4e8('0x33')](handleEntityNotFound(_0x51e27f,null))[_0xe4e8('0x33')](saveUpdates(_0x7f603[_0xe4e8('0x54')],null))[_0xe4e8('0x33')](respondWithResult(_0x51e27f,null))[_0xe4e8('0x26')](handleError(_0x51e27f,null));};exports['addLogo']=function(_0x4d0540,_0x40d20d,_0x5ea2fd){if(_0x4d0540['file']&&_0x4d0540['file'][_0xe4e8('0x55')]){_0x4d0540['body']['logo']=_0x4d0540[_0xe4e8('0x56')][_0xe4e8('0x55')];}return db[_0xe4e8('0x4b')][_0xe4e8('0x53')]({'where':{'id':_0x4d0540['params']['id']}})['then'](handleEntityNotFound(_0x40d20d,null))[_0xe4e8('0x33')](saveUpdates(_0x4d0540[_0xe4e8('0x54')],null))[_0xe4e8('0x33')](respondWithResult(_0x40d20d,null))[_0xe4e8('0x26')](handleError(_0x40d20d,null));};exports[_0xe4e8('0x57')]=function(_0x3caa2f,_0x143a24,_0x235474){if(_0x3caa2f[_0xe4e8('0x56')]&&_0x3caa2f['file'][_0xe4e8('0x55')]){_0x3caa2f[_0xe4e8('0x54')][_0xe4e8('0x58')]=_0x3caa2f['file'][_0xe4e8('0x55')];}return db[_0xe4e8('0x4b')][_0xe4e8('0x53')]({'where':{'id':_0x3caa2f['params']['id']}})[_0xe4e8('0x33')](handleEntityNotFound(_0x143a24,null))[_0xe4e8('0x33')](saveUpdates(_0x3caa2f[_0xe4e8('0x54')],null))['then'](respondWithResult(_0x143a24,null))[_0xe4e8('0x26')](handleError(_0x143a24,null));};var utilLicense=require(_0xe4e8('0x18'));exports['getLogo']=function(_0x40d251,_0x1b2f64,_0x5982fe){var _0x3eb620=_0xe4e8('0x59');var _0x3e66a3={'custom':![]};return utilLicense[_0xe4e8('0x5a')]()['then'](function(_0x51d0c3){if(_0x51d0c3){_0x3e66a3=_0x51d0c3;}return db[_0xe4e8('0x4b')]['find']({'where':{'id':_0x40d251[_0xe4e8('0x50')]['id']},'attributes':['logo','loginLogo',_0xe4e8('0x5b'),'favicon',_0xe4e8('0x5c'),_0xe4e8('0x5d'),_0xe4e8('0x5e'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x1b2f64,null))[_0xe4e8('0x33')](function(_0x34dea9){if(_0x34dea9){var _0x5a7733=_0x34dea9[_0xe4e8('0x5f')]&&fs[_0xe4e8('0x60')](path[_0xe4e8('0x61')](config[_0xe4e8('0x62')],_0x3eb620,_['toLower'](_0x34dea9['logo'])))?path['join'](config[_0xe4e8('0x62')],_0x3eb620,_['toLower'](_0x34dea9[_0xe4e8('0x5f')])):path[_0xe4e8('0x61')](config[_0xe4e8('0x62')],_0x3eb620,_[_0xe4e8('0x63')](_0xe4e8('0x64')));var _0x3a1308=_0xe4e8('0x65')+_['upperFirst'](_0xe4e8('0x5f'));if(_0x34dea9[_0x3a1308]||!_0x3e66a3[_0xe4e8('0x66')]){_0x5a7733=path['join'](config['root'],_0x3eb620,_[_0xe4e8('0x63')](_0xe4e8('0x64')));}if(!fs['existsSync'](_0x5a7733)){throw new db[(_0xe4e8('0x67'))][(_0xe4e8('0x68'))](_[_0xe4e8('0x69')](_0xe4e8('0x5f'))+_0xe4e8('0x6a'));}return _0x1b2f64[_0xe4e8('0x6b')](_0x5a7733);}})[_0xe4e8('0x26')](handleError(_0x1b2f64,null));};var utilLicense=require(_0xe4e8('0x18'));exports[_0xe4e8('0x6c')]=function(_0x5d095b,_0x3e0144,_0x5cffd5){var _0x50aa03=_0xe4e8('0x59');var _0xad8396={'custom':![]};return utilLicense[_0xe4e8('0x5a')]()[_0xe4e8('0x33')](function(_0x5df30c){if(_0x5df30c){_0xad8396=_0x5df30c;}return db[_0xe4e8('0x4b')][_0xe4e8('0x53')]({'where':{'id':_0x5d095b[_0xe4e8('0x50')]['id']},'attributes':[_0xe4e8('0x5f'),_0xe4e8('0x58'),'preferred','favicon',_0xe4e8('0x5c'),_0xe4e8('0x5d'),'defaultPreferred',_0xe4e8('0x6d')],'raw':!![]});})[_0xe4e8('0x33')](handleEntityNotFound(_0x3e0144,null))[_0xe4e8('0x33')](function(_0x41b87b){if(_0x41b87b){var _0x51f7b7=_0x41b87b[_0xe4e8('0x58')]&&fs[_0xe4e8('0x60')](path[_0xe4e8('0x61')](config[_0xe4e8('0x62')],_0x50aa03,_[_0xe4e8('0x63')](_0x41b87b['loginLogo'])))?path['join'](config[_0xe4e8('0x62')],_0x50aa03,_[_0xe4e8('0x63')](_0x41b87b[_0xe4e8('0x58')])):path[_0xe4e8('0x61')](config[_0xe4e8('0x62')],_0x50aa03,_['toLower']('default_loginLogo.svg'));var _0x10d8e2=_0xe4e8('0x65')+_[_0xe4e8('0x69')](_0xe4e8('0x58'));if(_0x41b87b[_0x10d8e2]||!_0xad8396['custom']){_0x51f7b7=path[_0xe4e8('0x61')](config[_0xe4e8('0x62')],_0x50aa03,_[_0xe4e8('0x63')](_0xe4e8('0x6e')));}if(!fs['existsSync'](_0x51f7b7)){throw new db['Sequelize'][(_0xe4e8('0x68'))](_[_0xe4e8('0x69')]('loginLogo')+_0xe4e8('0x6a'));}return _0x3e0144[_0xe4e8('0x6b')](_0x51f7b7);}})[_0xe4e8('0x26')](handleError(_0x3e0144,null));};exports['gdpr']=function(_0x24db93,_0x4b91bd){return db[_0xe4e8('0x4b')][_0xe4e8('0x53')]({'where':{'id':_0x24db93[_0xe4e8('0x50')]['id']},'attributes':[_0xe4e8('0x6f')]})['then'](respondWithResult(_0x4b91bd,null))['catch'](handleError(_0x4b91bd,null));};exports['addPreferred']=function(_0x52539f,_0x10ac9d,_0x2710e4){if(_0x52539f[_0xe4e8('0x56')]&&_0x52539f['file'][_0xe4e8('0x55')]){_0x52539f['body'][_0xe4e8('0x5b')]=_0x52539f[_0xe4e8('0x56')][_0xe4e8('0x55')];}return db['Setting'][_0xe4e8('0x53')]({'where':{'id':_0x52539f[_0xe4e8('0x50')]['id']}})[_0xe4e8('0x33')](handleEntityNotFound(_0x10ac9d,null))['then'](saveUpdates(_0x52539f[_0xe4e8('0x54')],null))[_0xe4e8('0x33')](respondWithResult(_0x10ac9d,null))[_0xe4e8('0x26')](handleError(_0x10ac9d,null));};var utilLicense=require(_0xe4e8('0x18'));exports['getPreferred']=function(_0x2221e4,_0x21eff5,_0x50f55f){var _0x4275cc=_0xe4e8('0x59');var _0x587088={'custom':![]};return utilLicense['getLicense']()[_0xe4e8('0x33')](function(_0x532c56){if(_0x532c56){_0x587088=_0x532c56;}return db['Setting']['find']({'where':{'id':_0x2221e4['params']['id']},'attributes':[_0xe4e8('0x5f'),_0xe4e8('0x58'),'preferred','favicon','defaultLogo',_0xe4e8('0x5d'),'defaultPreferred',_0xe4e8('0x6d')],'raw':!![]});})['then'](handleEntityNotFound(_0x21eff5,null))['then'](function(_0x256924){if(_0x256924){var _0x707e56=_0x256924[_0xe4e8('0x5b')]&&fs[_0xe4e8('0x60')](path[_0xe4e8('0x61')](config[_0xe4e8('0x62')],_0x4275cc,_['toLower'](_0x256924[_0xe4e8('0x5b')])))?path[_0xe4e8('0x61')](config[_0xe4e8('0x62')],_0x4275cc,_[_0xe4e8('0x63')](_0x256924['preferred'])):path['join'](config[_0xe4e8('0x62')],_0x4275cc,_[_0xe4e8('0x63')](_0xe4e8('0x70')));var _0x1ed7da='default'+_['upperFirst'](_0xe4e8('0x5b'));if(_0x256924[_0x1ed7da]||!_0x587088['custom']||!_0x587088[_0xe4e8('0x5b')]){_0x707e56=path[_0xe4e8('0x61')](config[_0xe4e8('0x62')],_0x4275cc,_['toLower'](_0xe4e8('0x70')));}if(!fs[_0xe4e8('0x60')](_0x707e56)){throw new db[(_0xe4e8('0x67'))][(_0xe4e8('0x68'))](_[_0xe4e8('0x69')](_0xe4e8('0x5b'))+_0xe4e8('0x6a'));}return _0x21eff5[_0xe4e8('0x6b')](_0x707e56);}})['catch'](handleError(_0x21eff5,null));};exports[_0xe4e8('0x71')]=function(_0x493d9c,_0x31031e,_0x485324){if(_0x493d9c[_0xe4e8('0x56')]&&_0x493d9c[_0xe4e8('0x56')]['filename']){_0x493d9c[_0xe4e8('0x54')][_0xe4e8('0x72')]=_0x493d9c['file']['filename'];}return db[_0xe4e8('0x4b')]['find']({'where':{'id':_0x493d9c[_0xe4e8('0x50')]['id']}})['then'](handleEntityNotFound(_0x31031e,null))[_0xe4e8('0x33')](saveUpdates(_0x493d9c[_0xe4e8('0x54')],null))[_0xe4e8('0x33')](respondWithResult(_0x31031e,null))[_0xe4e8('0x26')](handleError(_0x31031e,null));};var utilLicense=require(_0xe4e8('0x18'));exports['getFavicon']=function(_0x3043a8,_0x2d9091,_0xad2c4a){var _0x49d9e4=_0xe4e8('0x59');var _0x2290a5={'custom':![]};return utilLicense[_0xe4e8('0x5a')]()[_0xe4e8('0x33')](function(_0x335c41){if(_0x335c41){_0x2290a5=_0x335c41;}return db[_0xe4e8('0x4b')][_0xe4e8('0x53')]({'where':{'id':_0x3043a8[_0xe4e8('0x50')]['id']},'attributes':[_0xe4e8('0x5f'),_0xe4e8('0x58'),_0xe4e8('0x5b'),_0xe4e8('0x72'),_0xe4e8('0x5c'),_0xe4e8('0x5d'),_0xe4e8('0x5e'),_0xe4e8('0x6d')],'raw':!![]});})[_0xe4e8('0x33')](handleEntityNotFound(_0x2d9091,null))[_0xe4e8('0x33')](function(_0x435499){if(_0x435499){var _0x6db895=_0x435499[_0xe4e8('0x72')]&&fs[_0xe4e8('0x60')](path['join'](config[_0xe4e8('0x62')],_0x49d9e4,_['toLower'](_0x435499[_0xe4e8('0x72')])))?path['join'](config['root'],_0x49d9e4,_[_0xe4e8('0x63')](_0x435499[_0xe4e8('0x72')])):path[_0xe4e8('0x61')](config['root'],_0x49d9e4,_['toLower'](_0xe4e8('0x73')));var _0x545840=_0xe4e8('0x65')+_[_0xe4e8('0x69')](_0xe4e8('0x72'));if(_0x435499[_0x545840]||!_0x2290a5[_0xe4e8('0x66')]){_0x6db895=path[_0xe4e8('0x61')](config[_0xe4e8('0x62')],_0x49d9e4,_[_0xe4e8('0x63')](_0xe4e8('0x73')));}if(!fs['existsSync'](_0x6db895)){throw new db[(_0xe4e8('0x67'))][(_0xe4e8('0x68'))](_['upperFirst'](_0xe4e8('0x72'))+'\x20not\x20found');}return _0x2d9091[_0xe4e8('0x6b')](_0x6db895);}})[_0xe4e8('0x26')](handleError(_0x2d9091,null));};exports['getDate']=function(_0x4c2efb,_0x118cd9){var _0x727943={'offset':moment()[_0xe4e8('0x74')]()};_0x727943[_0xe4e8('0x75')]=moment()[_0xe4e8('0x74')](_0x727943[_0xe4e8('0x2a')])[_0xe4e8('0x76')](_0xe4e8('0x77'));return _0x118cd9['status'](0xc8)[_0xe4e8('0x36')](_0x727943);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index cc1f958..2e514cf 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(_0x406e46,_0x5799cb){var _0x4a3742=function(_0x1fa435){while(--_0x1fa435){_0x406e46['push'](_0x406e46['shift']());}};_0x4a3742(++_0x5799cb);}(_0x7217,0x19e));var _0x7721=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x7217[_0x1c546c];return _0x2cc384;};'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 _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x292f93,_0x2c6e8e){var _0x5a94b1=function(_0x25735e){while(--_0x25735e){_0x292f93['push'](_0x292f93['shift']());}};_0x5a94b1(++_0x2c6e8e);}(_0x55ca,0x126));var _0xa55c=function(_0x432b47,_0x24d3b7){_0x432b47=_0x432b47-0x0;var _0xb74e85=_0x55ca[_0x432b47];return _0xb74e85;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'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 a3af906..687699b 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 _0x8713=['include','map','model','attributes','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ShowSetting','Setting','find','options','raw','where'];(function(_0x4e7c29,_0x5b0961){var _0x1f12ca=function(_0x3c1b54){while(--_0x3c1b54){_0x4e7c29['push'](_0x4e7c29['shift']());}};_0x1f12ca(++_0x5b0961);}(_0x8713,0x13a));var _0x3871=function(_0x4da5fc,_0x2c451b){_0x4da5fc=_0x4da5fc-0x0;var _0x43a6df=_0x8713[_0x4da5fc];return _0x43a6df;};'use strict';var _=require(_0x3871('0x0'));var util=require(_0x3871('0x1'));var moment=require('moment');var BPromise=require(_0x3871('0x2'));var rs=require(_0x3871('0x3'));var fs=require('fs');var Redis=require(_0x3871('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3871('0x5'));var logger=require(_0x3871('0x6'))(_0x3871('0x7'));var config=require(_0x3871('0x8'));var jayson=require(_0x3871('0x9'));var client=jayson[_0x3871('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2152e3,_0x28bdcf,_0x1844ed){return new BPromise(function(_0x5b8869,_0x5b7bbd){return client['request'](_0x2152e3,_0x1844ed)[_0x3871('0xb')](function(_0x2e0be2){logger[_0x3871('0xc')](_0x3871('0xd'),_0x28bdcf,_0x3871('0xe'));logger[_0x3871('0xf')](_0x3871('0x10'),_0x28bdcf,'request\x20sent',JSON[_0x3871('0x11')](_0x2e0be2));if(_0x2e0be2['error']){if(_0x2e0be2[_0x3871('0x12')]['code']===0x1f4){logger[_0x3871('0x12')](_0x3871('0xd'),_0x28bdcf,_0x2e0be2[_0x3871('0x12')][_0x3871('0x13')]);return _0x5b7bbd(_0x2e0be2['error'][_0x3871('0x13')]);}logger['error'](_0x3871('0xd'),_0x28bdcf,_0x2e0be2['error']['message']);return _0x5b8869(_0x2e0be2['error'][_0x3871('0x13')]);}else{logger[_0x3871('0xc')](_0x3871('0xd'),_0x28bdcf,_0x3871('0xe'));_0x5b8869(_0x2e0be2['result'][_0x3871('0x13')]);}})[_0x3871('0x14')](function(_0x1c6496){logger[_0x3871('0x12')](_0x3871('0xd'),_0x28bdcf,_0x1c6496);_0x5b7bbd(_0x1c6496);});});}exports[_0x3871('0x15')]=function(_0x281633){var _0x1d3eb5=this;return new Promise(function(_0x3e6a59,_0x4f0bdc){return db[_0x3871('0x16')][_0x3871('0x17')]({'raw':_0x281633[_0x3871('0x18')]?_0x281633['options'][_0x3871('0x19')]===undefined?!![]:![]:!![],'where':_0x281633['options']?_0x281633[_0x3871('0x18')][_0x3871('0x1a')]||null:null,'attributes':_0x281633[_0x3871('0x18')]?_0x281633[_0x3871('0x18')]['attributes']||null:null,'include':_0x281633[_0x3871('0x18')]?_0x281633['options'][_0x3871('0x1b')]?_[_0x3871('0x1c')](_0x281633[_0x3871('0x18')][_0x3871('0x1b')],function(_0x3255db){return{'model':db[_0x3255db[_0x3871('0x1d')]],'as':_0x3255db['as'],'attributes':_0x3255db[_0x3871('0x1e')],'include':_0x3255db[_0x3871('0x1b')]?_['map'](_0x3255db[_0x3871('0x1b')],function(_0x3c11d3){return{'model':db[_0x3c11d3[_0x3871('0x1d')]],'as':_0x3c11d3['as'],'attributes':_0x3c11d3['attributes'],'include':_0x3c11d3[_0x3871('0x1b')]?_[_0x3871('0x1c')](_0x3c11d3[_0x3871('0x1b')],function(_0x4d13de){return{'model':db[_0x4d13de[_0x3871('0x1d')]],'as':_0x4d13de['as'],'attributes':_0x4d13de[_0x3871('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3871('0xb')](function(_0x2a0b31){logger[_0x3871('0xc')](_0x3871('0x15'),_0x281633);logger['debug'](_0x3871('0x15'),_0x281633,JSON[_0x3871('0x11')](_0x2a0b31));_0x3e6a59(_0x2a0b31);})[_0x3871('0x14')](function(_0x2f3b1c){logger[_0x3871('0x12')](_0x3871('0x15'),_0x2f3b1c['message'],_0x281633);_0x4f0bdc(_0x1d3eb5[_0x3871('0x12')](0x1f4,_0x2f3b1c[_0x3871('0x13')]));});});}; \ No newline at end of file +var _0x6d2e=['result','Setting','find','options','include','model','attributes','map','then','ShowSetting','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5a6294,_0x2312b0){var _0x3e153f=function(_0xd8539){while(--_0xd8539){_0x5a6294['push'](_0x5a6294['shift']());}};_0x3e153f(++_0x2312b0);}(_0x6d2e,0x18a));var _0xe6d2=function(_0x5979e7,_0x2a8391){_0x5979e7=_0x5979e7-0x0;var _0x5b08be=_0x6d2e[_0x5979e7];return _0x5b08be;};'use strict';var _=require(_0xe6d2('0x0'));var util=require(_0xe6d2('0x1'));var moment=require(_0xe6d2('0x2'));var BPromise=require(_0xe6d2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe6d2('0x4'));var db=require(_0xe6d2('0x5'))['db'];var utils=require(_0xe6d2('0x6'));var logger=require(_0xe6d2('0x7'))(_0xe6d2('0x8'));var config=require('../../config/environment');var jayson=require(_0xe6d2('0x9'));var client=jayson[_0xe6d2('0xa')][_0xe6d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dbd52,_0x438093,_0x56d52c){return new BPromise(function(_0x56c127,_0x2754d5){return client[_0xe6d2('0xc')](_0x5dbd52,_0x56d52c)['then'](function(_0x127503){logger[_0xe6d2('0xd')](_0xe6d2('0xe'),_0x438093,_0xe6d2('0xf'));logger[_0xe6d2('0x10')](_0xe6d2('0x11'),_0x438093,_0xe6d2('0xf'),JSON[_0xe6d2('0x12')](_0x127503));if(_0x127503[_0xe6d2('0x13')]){if(_0x127503[_0xe6d2('0x13')][_0xe6d2('0x14')]===0x1f4){logger[_0xe6d2('0x13')](_0xe6d2('0xe'),_0x438093,_0x127503['error'][_0xe6d2('0x15')]);return _0x2754d5(_0x127503[_0xe6d2('0x13')][_0xe6d2('0x15')]);}logger['error'](_0xe6d2('0xe'),_0x438093,_0x127503['error'][_0xe6d2('0x15')]);return _0x56c127(_0x127503[_0xe6d2('0x13')]['message']);}else{logger[_0xe6d2('0xd')](_0xe6d2('0xe'),_0x438093,_0xe6d2('0xf'));_0x56c127(_0x127503[_0xe6d2('0x16')][_0xe6d2('0x15')]);}})['catch'](function(_0x1123f9){logger['error'](_0xe6d2('0xe'),_0x438093,_0x1123f9);_0x2754d5(_0x1123f9);});});}exports['ShowSetting']=function(_0x2cbbca){var _0x23a96b=this;return new Promise(function(_0x1353f4,_0x1ec7e1){return db[_0xe6d2('0x17')][_0xe6d2('0x18')]({'raw':_0x2cbbca[_0xe6d2('0x19')]?_0x2cbbca[_0xe6d2('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2cbbca[_0xe6d2('0x19')]?_0x2cbbca[_0xe6d2('0x19')]['where']||null:null,'attributes':_0x2cbbca[_0xe6d2('0x19')]?_0x2cbbca['options']['attributes']||null:null,'include':_0x2cbbca[_0xe6d2('0x19')]?_0x2cbbca['options'][_0xe6d2('0x1a')]?_['map'](_0x2cbbca[_0xe6d2('0x19')][_0xe6d2('0x1a')],function(_0x5e8659){return{'model':db[_0x5e8659[_0xe6d2('0x1b')]],'as':_0x5e8659['as'],'attributes':_0x5e8659[_0xe6d2('0x1c')],'include':_0x5e8659['include']?_[_0xe6d2('0x1d')](_0x5e8659[_0xe6d2('0x1a')],function(_0x4d8f75){return{'model':db[_0x4d8f75[_0xe6d2('0x1b')]],'as':_0x4d8f75['as'],'attributes':_0x4d8f75[_0xe6d2('0x1c')],'include':_0x4d8f75[_0xe6d2('0x1a')]?_[_0xe6d2('0x1d')](_0x4d8f75[_0xe6d2('0x1a')],function(_0x4f1e5d){return{'model':db[_0x4f1e5d['model']],'as':_0x4f1e5d['as'],'attributes':_0x4f1e5d[_0xe6d2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe6d2('0x1e')](function(_0x16b878){logger[_0xe6d2('0xd')](_0xe6d2('0x1f'),_0x2cbbca);logger[_0xe6d2('0x10')](_0xe6d2('0x1f'),_0x2cbbca,JSON[_0xe6d2('0x12')](_0x16b878));_0x1353f4(_0x16b878);})['catch'](function(_0x18b464){logger[_0xe6d2('0x13')](_0xe6d2('0x1f'),_0x18b464['message'],_0x2cbbca);_0x1ec7e1(_0x23a96b[_0xe6d2('0x13')](0x1f4,_0x18b464[_0xe6d2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 291637c..740eafb 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 _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x4a3e35,_0x3cc69d){var _0x30757e=function(_0x360603){while(--_0x360603){_0x4a3e35['push'](_0x4a3e35['shift']());}};_0x30757e(++_0x3cc69d);}(_0x7a54,0x106));var _0x47a5=function(_0x4deb99,_0x1eb9de){_0x4deb99=_0x4deb99-0x0;var _0xa29ab7=_0x7a54[_0x4deb99];return _0xa29ab7;};'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['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x5267c4,_0x4cbeb3){var _0x2fa640=function(_0x136d80){while(--_0x136d80){_0x5267c4['push'](_0x5267c4['shift']());}};_0x2fa640(++_0x4cbeb3);}(_0x7a54,0x106));var _0x47a5=function(_0x58a6e0,_0x1648b5){_0x58a6e0=_0x58a6e0-0x0;var _0x90cca0=_0x7a54[_0x58a6e0];return _0x90cca0;};'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['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 0fafda2..752c67b 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 _0xd418=['BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','csc','infobip'];(function(_0x2c9e51,_0x1e4ad6){var _0x139893=function(_0x290c12){while(--_0x290c12){_0x2c9e51['push'](_0x2c9e51['shift']());}};_0x139893(++_0x1e4ad6);}(_0xd418,0x1c1));var _0x8d41=function(_0x1a2295,_0x3ce2fa){_0x1a2295=_0x1a2295-0x0;var _0x70920b=_0xd418[_0x1a2295];return _0x70920b;};'use strict';var Sequelize=require(_0x8d41('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x8d41('0x1')],'unique':_0x8d41('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x8d41('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x8d41('0x1')],'defaultValue':function(){return rs[_0x8d41('0x3')]();}},'phone':{'type':Sequelize[_0x8d41('0x1')]},'type':{'type':Sequelize[_0x8d41('0x4')](_0x8d41('0x5'),_0x8d41('0x6'),_0x8d41('0x7'),_0x8d41('0x8'),_0x8d41('0x9'),_0x8d41('0xa'),'bandwidth',_0x8d41('0xb'),_0x8d41('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0x8d41('0x1')]},'authId':{'type':Sequelize[_0x8d41('0x1')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x8d41('0x4')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x8d41('0x1')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x8d41('0x1')]},'senderString':{'type':Sequelize[_0x8d41('0x1')]},'deliveryReport':{'type':Sequelize[_0x8d41('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x8d41('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x8d41('0xe');}},'notificationSound':{'type':Sequelize[_0x8d41('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8d41('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8d41('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8d41('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8d41('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x8d41('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x8d41('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x8d41('0xd')],'defaultValue':![],'comment':_0x8d41('0x11'),'set':function(_0x8f7840){if(!_0x8f7840)this[_0x8d41('0x12')](_0x8d41('0x13'),null);this[_0x8d41('0x12')](_0x8d41('0x14'),_0x8f7840);}}}; \ No newline at end of file +var _0x9d0a=['generate','ENUM','twilio','skebby','plivo','clickatell','bandwidth','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','setDataValue','mandatoryDisposition','sequelize','STRING','name'];(function(_0x243530,_0x21dede){var _0x2fe74e=function(_0x3fcd51){while(--_0x3fcd51){_0x243530['push'](_0x243530['shift']());}};_0x2fe74e(++_0x21dede);}(_0x9d0a,0xa8));var _0xa9d0=function(_0x2e1af3,_0x2a077b){_0x2e1af3=_0x2e1af3-0x0;var _0x4150cd=_0x9d0a[_0x2e1af3];return _0x4150cd;};'use strict';var Sequelize=require(_0xa9d0('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xa9d0('0x1')],'unique':_0xa9d0('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xa9d0('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xa9d0('0x1')],'defaultValue':function(){return rs[_0xa9d0('0x3')]();}},'phone':{'type':Sequelize[_0xa9d0('0x1')]},'type':{'type':Sequelize[_0xa9d0('0x4')](_0xa9d0('0x5'),_0xa9d0('0x6'),'connectel','clicksend',_0xa9d0('0x7'),_0xa9d0('0x8'),_0xa9d0('0x9'),'csc',_0xa9d0('0xa'),_0xa9d0('0xb'))},'accountSid':{'type':Sequelize[_0xa9d0('0x1')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xa9d0('0x1')]},'password':{'type':Sequelize[_0xa9d0('0x1')]},'apiKey':{'type':Sequelize[_0xa9d0('0x1')]},'applicationId':{'type':Sequelize[_0xa9d0('0x1')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xa9d0('0x1')]},'deliveryReport':{'type':Sequelize[_0xa9d0('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0xa9d0('0x1')]},'notificationTemplate':{'type':Sequelize[_0xa9d0('0xd')],'defaultValue':function(){return _0xa9d0('0xe');}},'notificationSound':{'type':Sequelize[_0xa9d0('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa9d0('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa9d0('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa9d0('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa9d0('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa9d0('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xa9d0('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa9d0('0xf')],'comment':_0xa9d0('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xa9d0('0xc')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3d4103){if(!_0x3d4103)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xa9d0('0x11')](_0xa9d0('0x12'),_0x3d4103);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 1c71d39..f5319fe 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 _0x4488=['SmsAccountId','removeAnswers','ids','notify','sms','SmsApplication','Applications','account','priority','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','Body','MessageSid','skebby','sender','clicksend','messageId','message_id','plivo','From','Text','MessageUUID','infobip','results','text','csc','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','ValidationError','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','Contacts','DESC','omit','SmsInteraction','spread','interaction','created','applications','push','close','SmsMessage','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','waitForTheAssignedQueue','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','getInteractions','Contact','fullname','Tag','Tags','color','tag','send','CmList','List','out','Messages','dataValues','debug','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','statusInt','requestid','status_code','groupName','DELIVERED','redif','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','client','request','then','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','UserProfileResource','name','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','Pause','options','find','create','body','user','SmsAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','rows','removeDispositions','CannedAnswer','getAnswers'];(function(_0x43f4c8,_0x22a037){var _0x3a2e0c=function(_0x182023){while(--_0x182023){_0x43f4c8['push'](_0x43f4c8['shift']());}};_0x3a2e0c(++_0x22a037);}(_0x4488,0x168));var _0x8448=function(_0x107ad4,_0xab04b2){_0x107ad4=_0x107ad4-0x0;var _0x24b7e3=_0x4488[_0x107ad4];return _0x24b7e3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8448('0x0'));var zipdir=require(_0x8448('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8448('0x2'));var moment=require(_0x8448('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8448('0x4'));var util=require(_0x8448('0x5'));var path=require(_0x8448('0x6'));var sox=require(_0x8448('0x7'));var csv=require('to-csv');var ejs=require(_0x8448('0x8'));var fs=require('fs');var fs_extra=require(_0x8448('0x9'));var _=require(_0x8448('0xa'));var squel=require('squel');var crypto=require(_0x8448('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8448('0xc'));var toCsv=require(_0x8448('0xd'));var querystring=require(_0x8448('0xe'));var Papa=require('papaparse');var Redis=require(_0x8448('0xf'));var authService=require(_0x8448('0x10'));var qs=require(_0x8448('0x11'));var as=require(_0x8448('0x12'));var hardwareService=require(_0x8448('0x13'));var logger=require(_0x8448('0x14'))(_0x8448('0x15'));var utils=require(_0x8448('0x16'));var config=require(_0x8448('0x17'));var licenseUtil=require(_0x8448('0x18'));var db=require(_0x8448('0x19'))['db'];config[_0x8448('0x1a')]=_[_0x8448('0x1b')](config[_0x8448('0x1a')],{'host':_0x8448('0x1c'),'port':0x18eb});var socket=require(_0x8448('0x1d'))(new Redis(config[_0x8448('0x1a')]));require(_0x8448('0x1e'))[_0x8448('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8448('0x20')]['http']({'port':0x232c});function respondWithRpcPromise(_0x387ee9,_0x406632,_0x4c4a8d,_0x1de79d){return new BPromise(function(_0x100a34,_0xfc6a1a){var _0x318bb4=_0x1de79d||client;return _0x318bb4[_0x8448('0x21')](_0x387ee9,_0x4c4a8d)[_0x8448('0x22')](function(_0x2499e2){logger[_0x8448('0x23')]('SmsAccount,\x20%s,\x20%s',_0x406632,_0x8448('0x24'));logger['debug'](_0x8448('0x25'),_0x406632,_0x8448('0x24'),JSON[_0x8448('0x26')](_0x2499e2));if(_0x2499e2['error']){if(_0x2499e2['error'][_0x8448('0x27')]===0x1f4){logger[_0x8448('0x28')](_0x8448('0x29'),_0x406632,_0x2499e2[_0x8448('0x28')][_0x8448('0x2a')]);return _0xfc6a1a(_0x2499e2[_0x8448('0x28')][_0x8448('0x2a')]);}logger[_0x8448('0x28')]('SmsAccount,\x20%s,\x20%s',_0x406632,_0x2499e2[_0x8448('0x28')][_0x8448('0x2a')]);return _0x100a34(_0x2499e2[_0x8448('0x28')]['message']);}else{logger[_0x8448('0x23')]('SmsAccount,\x20%s,\x20%s',_0x406632,_0x8448('0x24'));_0x100a34(_0x2499e2[_0x8448('0x2b')]['message']);}})[_0x8448('0x2c')](function(_0x504d7e){logger[_0x8448('0x28')]('SmsAccount,\x20%s,\x20%s',_0x406632,_0x504d7e);_0xfc6a1a(_0x504d7e);});});}function respondWithStatusCode(_0x2085c2,_0x36ec94){_0x36ec94=_0x36ec94||0xcc;return function(_0x37a4ee){if(_0x37a4ee){return _0x2085c2[_0x8448('0x2d')](_0x36ec94);}return _0x2085c2[_0x8448('0x2e')](_0x36ec94)[_0x8448('0x2f')]();};}function respondWithResult(_0x26076e,_0x3d8e95){_0x3d8e95=_0x3d8e95||0xc8;return function(_0xfb4ede){if(_0xfb4ede){return _0x26076e[_0x8448('0x2e')](_0x3d8e95)[_0x8448('0x30')](_0xfb4ede);}};}function respondWithFilteredResult(_0x4f29cb,_0x84d249){return function(_0x410ecb){if(_0x410ecb){var _0x2b28a4=typeof _0x84d249[_0x8448('0x31')]===_0x8448('0x32')&&typeof _0x84d249[_0x8448('0x33')]==='undefined';var _0x52fb9b=_0x410ecb[_0x8448('0x34')];var _0x3f00da=_0x2b28a4?0x0:_0x84d249[_0x8448('0x31')];var _0x38d1d2=_0x2b28a4?_0x410ecb[_0x8448('0x34')]:_0x84d249[_0x8448('0x31')]+_0x84d249[_0x8448('0x33')];var _0x2c01da;if(_0x38d1d2>=_0x52fb9b){_0x38d1d2=_0x52fb9b;_0x2c01da=0xc8;}else{_0x2c01da=0xce;}_0x4f29cb['status'](_0x2c01da);return _0x4f29cb[_0x8448('0x35')](_0x8448('0x36'),_0x3f00da+'-'+_0x38d1d2+'/'+_0x52fb9b)[_0x8448('0x30')](_0x410ecb);}return null;};}function patchUpdates(_0x400702){return function(_0x4e5bbf){try{jsonpatch['apply'](_0x4e5bbf,_0x400702,!![]);}catch(_0x11d68b){return BPromise[_0x8448('0x37')](_0x11d68b);}return _0x4e5bbf[_0x8448('0x38')]();};}function saveUpdates(_0x189baf,_0x3ad514){return function(_0x28d0d3){if(_0x28d0d3){return _0x28d0d3[_0x8448('0x39')](_0x189baf)[_0x8448('0x22')](function(_0x43f81b){return _0x43f81b;});}return null;};}function removeEntity(_0x4ea218,_0xba0db8){return function(_0x223882){if(_0x223882){return _0x223882[_0x8448('0x3a')]()[_0x8448('0x22')](function(){var _0x6f28a9=_0x223882[_0x8448('0x3b')]({'plain':!![]});var _0x5cb9ec='SmsAccounts';return db[_0x8448('0x3c')]['destroy']({'where':{'type':_0x5cb9ec,'resourceId':_0x6f28a9['id']}})[_0x8448('0x22')](function(){return _0x223882;});})[_0x8448('0x22')](function(){_0x4ea218[_0x8448('0x2e')](0xcc)[_0x8448('0x2f')]();});}};}function handleEntityNotFound(_0x130db1,_0x57da0a){return function(_0x4003b0){if(!_0x4003b0){_0x130db1['sendStatus'](0x194);}return _0x4003b0;};}function handleError(_0x7eef52,_0x26b939){_0x26b939=_0x26b939||0x1f4;return function(_0x3e1ffd){logger[_0x8448('0x28')](_0x3e1ffd['stack']);if(_0x3e1ffd[_0x8448('0x3d')]){delete _0x3e1ffd[_0x8448('0x3d')];}_0x7eef52['status'](_0x26b939)['send'](_0x3e1ffd);};}exports[_0x8448('0x3e')]=function(_0x1cf614,_0x555758){var _0x3ad3ff={'include':[{'model':db['Pause'],'as':_0x8448('0x3f')}]},_0x1310d2={},_0x137751={'count':0x0,'rows':[]};var _0x1e4b90=_[_0x8448('0x40')](db[_0x8448('0x41')][_0x8448('0x42')],function(_0x999c7f){return{'name':_0x999c7f[_0x8448('0x43')],'type':_0x999c7f[_0x8448('0x44')]['key']};});_0x1310d2[_0x8448('0x45')]=_['map'](_0x1e4b90,_0x8448('0x3d'));_0x1310d2[_0x8448('0x46')]=_[_0x8448('0x47')](_0x1cf614['query']);_0x1310d2[_0x8448('0x48')]=_[_0x8448('0x49')](_0x1310d2[_0x8448('0x45')],_0x1310d2['query']);_0x3ad3ff['attributes']=_[_0x8448('0x49')](_0x1310d2[_0x8448('0x45')],qs[_0x8448('0x4a')](_0x1cf614[_0x8448('0x46')][_0x8448('0x4a')]));_0x3ad3ff[_0x8448('0x4b')]=_0x3ad3ff['attributes'][_0x8448('0x4c')]?_0x3ad3ff['attributes']:_0x1310d2[_0x8448('0x45')];if(!_0x1cf614[_0x8448('0x46')]['hasOwnProperty']('nolimit')){_0x3ad3ff['limit']=qs[_0x8448('0x33')](_0x1cf614[_0x8448('0x46')][_0x8448('0x33')]);_0x3ad3ff[_0x8448('0x31')]=qs[_0x8448('0x31')](_0x1cf614['query']['offset']);}_0x3ad3ff[_0x8448('0x4d')]=qs['sort'](_0x1cf614['query'][_0x8448('0x4e')]);_0x3ad3ff[_0x8448('0x4f')]=qs[_0x8448('0x48')](_[_0x8448('0x50')](_0x1cf614['query'],_0x1310d2[_0x8448('0x48')]),_0x1e4b90);if(_0x1cf614[_0x8448('0x46')][_0x8448('0x51')]){_0x3ad3ff[_0x8448('0x4f')]=_[_0x8448('0x52')](_0x3ad3ff[_0x8448('0x4f')],{'$or':_[_0x8448('0x40')](_0x1e4b90,function(_0x5340e7){if(_0x5340e7['type']!==_0x8448('0x53')){var _0x2ab8ba={};_0x2ab8ba[_0x5340e7[_0x8448('0x3d')]]={'$like':'%'+_0x1cf614[_0x8448('0x46')]['filter']+'%'};return _0x2ab8ba;}})});}_0x3ad3ff=_[_0x8448('0x52')]({},_0x3ad3ff,_0x1cf614['options']);var _0x329319={'where':_0x3ad3ff[_0x8448('0x4f')]};return db[_0x8448('0x41')][_0x8448('0x34')](_0x329319)['then'](function(_0x3e7003){_0x137751[_0x8448('0x34')]=_0x3e7003;if(_0x1cf614[_0x8448('0x46')][_0x8448('0x54')]){_0x3ad3ff[_0x8448('0x55')]=[{'all':!![]}];}return db['SmsAccount'][_0x8448('0x56')](_0x3ad3ff);})[_0x8448('0x22')](function(_0x530373){_0x137751['rows']=_0x530373;return _0x137751;})[_0x8448('0x22')](respondWithFilteredResult(_0x555758,_0x3ad3ff))[_0x8448('0x2c')](handleError(_0x555758,null));};exports[_0x8448('0x57')]=function(_0x4ce638,_0x572607){var _0x1adda7={'raw':![],'where':{'id':_0x4ce638[_0x8448('0x58')]['id']},'include':[{'model':db[_0x8448('0x59')],'as':_0x8448('0x3f')}]},_0x5d2ee1={};_0x5d2ee1[_0x8448('0x45')]=_['keys'](db['SmsAccount']['rawAttributes']);_0x5d2ee1[_0x8448('0x46')]=_[_0x8448('0x47')](_0x4ce638[_0x8448('0x46')]);_0x5d2ee1[_0x8448('0x48')]=_['intersection'](_0x5d2ee1['model'],_0x5d2ee1[_0x8448('0x46')]);_0x1adda7[_0x8448('0x4b')]=_[_0x8448('0x49')](_0x5d2ee1['model'],qs[_0x8448('0x4a')](_0x4ce638[_0x8448('0x46')][_0x8448('0x4a')]));_0x1adda7[_0x8448('0x4b')]=_0x1adda7[_0x8448('0x4b')]['length']?_0x1adda7[_0x8448('0x4b')]:_0x5d2ee1['model'];if(_0x4ce638['query'][_0x8448('0x54')]){_0x1adda7[_0x8448('0x55')]=[{'all':!![]}];}_0x1adda7=_[_0x8448('0x52')]({},_0x1adda7,_0x4ce638[_0x8448('0x5a')]);return db['SmsAccount'][_0x8448('0x5b')](_0x1adda7)['then'](handleEntityNotFound(_0x572607,null))[_0x8448('0x22')](respondWithResult(_0x572607,null))[_0x8448('0x2c')](handleError(_0x572607,null));};exports[_0x8448('0x5c')]=function(_0xffbf02,_0x19b951){return db[_0x8448('0x41')][_0x8448('0x5c')](_0xffbf02[_0x8448('0x5d')],{})['then'](function(_0x2e6b0c){var _0x151f4f=_0xffbf02[_0x8448('0x5e')][_0x8448('0x3b')]({'plain':!![]});if(!_0x151f4f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x151f4f['role']==='user'){var _0x4dc84c=_0x2e6b0c[_0x8448('0x3b')]({'plain':!![]});var _0x514bc6=_0x8448('0x5f');return db[_0x8448('0x60')]['find']({'where':{'name':_0x514bc6,'userProfileId':_0x151f4f['userProfileId']},'raw':!![]})[_0x8448('0x22')](function(_0x21a258){if(_0x21a258&&_0x21a258[_0x8448('0x61')]===0x0){return db[_0x8448('0x3c')]['create']({'name':_0x4dc84c['name'],'resourceId':_0x4dc84c['id'],'type':_0x21a258[_0x8448('0x3d')],'sectionId':_0x21a258['id']},{})[_0x8448('0x22')](function(){return _0x2e6b0c;});}else{return _0x2e6b0c;}})[_0x8448('0x2c')](function(_0xf04211){logger[_0x8448('0x28')](_0x8448('0x62'),_0xf04211);throw _0xf04211;});}return _0x2e6b0c;})[_0x8448('0x22')](respondWithResult(_0x19b951,0xc9))[_0x8448('0x2c')](handleError(_0x19b951,null));};exports[_0x8448('0x39')]=function(_0x35df57,_0x1116b8){if(_0x35df57[_0x8448('0x5d')]['id']){delete _0x35df57['body']['id'];}return db[_0x8448('0x41')][_0x8448('0x5b')]({'where':{'id':_0x35df57[_0x8448('0x58')]['id']},'include':[{'model':db[_0x8448('0x59')],'as':_0x8448('0x3f')}]})['then'](handleEntityNotFound(_0x1116b8,null))[_0x8448('0x22')](saveUpdates(_0x35df57[_0x8448('0x5d')],null))[_0x8448('0x22')](respondWithResult(_0x1116b8,null))[_0x8448('0x2c')](handleError(_0x1116b8,null));};exports[_0x8448('0x3a')]=function(_0xe64edd,_0x3e1d35){return db[_0x8448('0x41')][_0x8448('0x5b')]({'where':{'id':_0xe64edd['params']['id']}})[_0x8448('0x22')](handleEntityNotFound(_0x3e1d35,null))['then'](removeEntity(_0x3e1d35,null))[_0x8448('0x2c')](handleError(_0x3e1d35,null));};exports['describe']=function(_0x323950,_0x5cc9b4){return db[_0x8448('0x41')][_0x8448('0x63')]()[_0x8448('0x22')](respondWithResult(_0x5cc9b4,null))[_0x8448('0x2c')](handleError(_0x5cc9b4,null));};exports[_0x8448('0x64')]=function(_0x4e3e88,_0x253036,_0xb8aab9){if(_0x4e3e88[_0x8448('0x5d')]['id']){delete _0x4e3e88[_0x8448('0x5d')]['id'];}return db[_0x8448('0x41')][_0x8448('0x5b')]({'where':{'id':_0x4e3e88[_0x8448('0x58')]['id']}})[_0x8448('0x22')](handleEntityNotFound(_0x253036,null))['then'](function(_0x5536b6){if(_0x5536b6){_0x4e3e88['body']['SmsAccountId']=_0x5536b6['id'];return db[_0x8448('0x65')][_0x8448('0x5c')](_0x4e3e88[_0x8448('0x5d')]);}})[_0x8448('0x22')](respondWithResult(_0x253036,null))[_0x8448('0x2c')](handleError(_0x253036,null));};exports[_0x8448('0x66')]=function(_0x29606a,_0x1ab175,_0x4a5e5f){var _0x3b957c={'raw':![],'where':{}};var _0x4f18d7={};var _0x3ed8dc={'count':0x0,'rows':[]};return db[_0x8448('0x41')][_0x8448('0x67')]({'where':{'id':_0x29606a[_0x8448('0x58')]['id']}})[_0x8448('0x22')](handleEntityNotFound(_0x1ab175,null))['then'](function(_0x530f4d){if(_0x530f4d){_0x4f18d7['model']=_[_0x8448('0x47')](db[_0x8448('0x65')]['rawAttributes']);_0x4f18d7['query']=_[_0x8448('0x47')](_0x29606a[_0x8448('0x46')]);_0x4f18d7[_0x8448('0x48')]=_[_0x8448('0x49')](_0x4f18d7[_0x8448('0x45')],_0x4f18d7[_0x8448('0x46')]);_0x3b957c['attributes']=_[_0x8448('0x49')](_0x4f18d7[_0x8448('0x45')],qs[_0x8448('0x4a')](_0x29606a['query'][_0x8448('0x4a')]));_0x3b957c[_0x8448('0x4b')]=_0x3b957c['attributes'][_0x8448('0x4c')]?_0x3b957c[_0x8448('0x4b')]:_0x4f18d7[_0x8448('0x45')];if(!_0x29606a[_0x8448('0x46')][_0x8448('0x68')](_0x8448('0x69'))){_0x3b957c[_0x8448('0x33')]=qs[_0x8448('0x33')](_0x29606a[_0x8448('0x46')][_0x8448('0x33')]);_0x3b957c[_0x8448('0x31')]=qs[_0x8448('0x31')](_0x29606a[_0x8448('0x46')][_0x8448('0x31')]);}_0x3b957c[_0x8448('0x4d')]=qs['sort'](_0x29606a[_0x8448('0x46')]['sort']);_0x3b957c[_0x8448('0x4f')]=qs['filters'](_[_0x8448('0x50')](_0x29606a[_0x8448('0x46')],_0x4f18d7[_0x8448('0x48')]));_0x3b957c[_0x8448('0x4f')]['SmsAccountId']=_0x530f4d['id'];if(_0x29606a[_0x8448('0x46')]['filter']){_0x3b957c[_0x8448('0x4f')]=_[_0x8448('0x52')](_0x3b957c[_0x8448('0x4f')],{'$or':_[_0x8448('0x40')](_0x3b957c[_0x8448('0x4b')],function(_0x2465eb){var _0x3ba9a1={};_0x3ba9a1[_0x2465eb]={'$like':'%'+_0x29606a['query'][_0x8448('0x51')]+'%'};return _0x3ba9a1;})});}_0x3b957c=_[_0x8448('0x52')]({},_0x3b957c,_0x29606a['options']);return db[_0x8448('0x65')]['count']({'where':_0x3b957c[_0x8448('0x4f')]})[_0x8448('0x22')](function(_0x495865){_0x3ed8dc[_0x8448('0x34')]=_0x495865;if(_0x29606a[_0x8448('0x46')]['includeAll']){_0x3b957c[_0x8448('0x55')]=[{'all':!![]}];}return db[_0x8448('0x65')]['findAll'](_0x3b957c);})[_0x8448('0x22')](function(_0x23a2e4){_0x3ed8dc[_0x8448('0x6a')]=_0x23a2e4;return _0x3ed8dc;});}})[_0x8448('0x22')](respondWithFilteredResult(_0x1ab175,_0x3b957c))[_0x8448('0x2c')](handleError(_0x1ab175,null));};exports[_0x8448('0x6b')]=function(_0x314b0a,_0x5598da,_0x2b4a21){return db[_0x8448('0x41')][_0x8448('0x5b')]({'where':{'id':_0x314b0a[_0x8448('0x58')]['id']}})[_0x8448('0x22')](handleEntityNotFound(_0x5598da,null))[_0x8448('0x22')](function(_0x5e1cae){if(_0x5e1cae){return _0x5e1cae[_0x8448('0x6b')](_0x314b0a[_0x8448('0x46')]['ids']);}})[_0x8448('0x22')](respondWithStatusCode(_0x5598da,null))['catch'](handleError(_0x5598da,null));};exports['addAnswer']=function(_0x1114e0,_0x279e58,_0x1dc56c){if(_0x1114e0[_0x8448('0x5d')]['id']){delete _0x1114e0[_0x8448('0x5d')]['id'];}return db[_0x8448('0x41')][_0x8448('0x5b')]({'where':{'id':_0x1114e0[_0x8448('0x58')]['id']}})['then'](handleEntityNotFound(_0x279e58,null))[_0x8448('0x22')](function(_0x4c33c3){if(_0x4c33c3){_0x1114e0[_0x8448('0x5d')]['SmsAccountId']=_0x4c33c3['id'];return db[_0x8448('0x6c')][_0x8448('0x5c')](_0x1114e0[_0x8448('0x5d')]);}})[_0x8448('0x22')](respondWithResult(_0x279e58,null))[_0x8448('0x2c')](handleError(_0x279e58,null));};exports[_0x8448('0x6d')]=function(_0x4011e0,_0x4cafd7,_0x3d81cf){var _0x332de2={'raw':![],'where':{}};var _0x38ac02={};var _0x11cb97={'count':0x0,'rows':[]};return db[_0x8448('0x41')][_0x8448('0x67')]({'where':{'id':_0x4011e0[_0x8448('0x58')]['id']}})[_0x8448('0x22')](handleEntityNotFound(_0x4cafd7,null))['then'](function(_0x301106){if(_0x301106){_0x38ac02[_0x8448('0x45')]=_[_0x8448('0x47')](db['CannedAnswer'][_0x8448('0x42')]);_0x38ac02[_0x8448('0x46')]=_[_0x8448('0x47')](_0x4011e0[_0x8448('0x46')]);_0x38ac02['filters']=_['intersection'](_0x38ac02[_0x8448('0x45')],_0x38ac02[_0x8448('0x46')]);_0x332de2['attributes']=_['intersection'](_0x38ac02[_0x8448('0x45')],qs[_0x8448('0x4a')](_0x4011e0[_0x8448('0x46')][_0x8448('0x4a')]));_0x332de2[_0x8448('0x4b')]=_0x332de2[_0x8448('0x4b')][_0x8448('0x4c')]?_0x332de2[_0x8448('0x4b')]:_0x38ac02['model'];if(!_0x4011e0[_0x8448('0x46')][_0x8448('0x68')](_0x8448('0x69'))){_0x332de2['limit']=qs['limit'](_0x4011e0[_0x8448('0x46')][_0x8448('0x33')]);_0x332de2[_0x8448('0x31')]=qs[_0x8448('0x31')](_0x4011e0[_0x8448('0x46')][_0x8448('0x31')]);}_0x332de2[_0x8448('0x4d')]=qs[_0x8448('0x4e')](_0x4011e0[_0x8448('0x46')][_0x8448('0x4e')]);_0x332de2[_0x8448('0x4f')]=qs[_0x8448('0x48')](_[_0x8448('0x50')](_0x4011e0[_0x8448('0x46')],_0x38ac02[_0x8448('0x48')]));_0x332de2[_0x8448('0x4f')][_0x8448('0x6e')]=_0x301106['id'];if(_0x4011e0['query'][_0x8448('0x51')]){_0x332de2[_0x8448('0x4f')]=_[_0x8448('0x52')](_0x332de2[_0x8448('0x4f')],{'$or':_['map'](_0x332de2['attributes'],function(_0x2b4c71){var _0x1621be={};_0x1621be[_0x2b4c71]={'$like':'%'+_0x4011e0[_0x8448('0x46')]['filter']+'%'};return _0x1621be;})});}_0x332de2=_[_0x8448('0x52')]({},_0x332de2,_0x4011e0[_0x8448('0x5a')]);return db['CannedAnswer'][_0x8448('0x34')]({'where':_0x332de2[_0x8448('0x4f')]})[_0x8448('0x22')](function(_0x3c8d2f){_0x11cb97[_0x8448('0x34')]=_0x3c8d2f;if(_0x4011e0[_0x8448('0x46')][_0x8448('0x54')]){_0x332de2[_0x8448('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8448('0x56')](_0x332de2);})['then'](function(_0x43fa8f){_0x11cb97[_0x8448('0x6a')]=_0x43fa8f;return _0x11cb97;});}})[_0x8448('0x22')](respondWithFilteredResult(_0x4cafd7,_0x332de2))[_0x8448('0x2c')](handleError(_0x4cafd7,null));};exports[_0x8448('0x6f')]=function(_0x420753,_0x50d944,_0x428579){return db[_0x8448('0x41')][_0x8448('0x5b')]({'where':{'id':_0x420753[_0x8448('0x58')]['id']}})[_0x8448('0x22')](handleEntityNotFound(_0x50d944,null))['then'](function(_0x4679f0){if(_0x4679f0){return _0x4679f0[_0x8448('0x6f')](_0x420753['query'][_0x8448('0x70')]);}})[_0x8448('0x22')](respondWithStatusCode(_0x50d944,null))[_0x8448('0x2c')](handleError(_0x50d944,null));};exports[_0x8448('0x71')]=function(_0x34d0f3,_0x3b5646,_0x44adb6){var _0x5cd28c={'channel':_0x8448('0x72')};var _0x3dde6c=[];var _0x2f5eac=[];var _0x4aff01={};return db[_0x8448('0x41')][_0x8448('0x5b')]({'where':{'id':_0x34d0f3['params']['id']},'include':[{'model':db[_0x8448('0x73')],'as':_0x8448('0x74')}]})[_0x8448('0x22')](handleEntityNotFound(_0x3b5646,null))['then'](function(_0xe8cdd){_0x5cd28c[_0x8448('0x75')]=_0xe8cdd;_0x5cd28c['applications']=_['orderBy'](_0xe8cdd[_0x8448('0x74')],[_0x8448('0x76')],[_0x8448('0x77')]);if(_0x5cd28c[_0x8448('0x75')]['Applications']){delete _0x5cd28c['account']['Applications'];}return db[_0x8448('0x78')]['describe']();})[_0x8448('0x22')](function(_0x1fcadd){if(!_0x1fcadd){throw new db[(_0x8448('0x79'))]['ValidationError'](_0x8448('0x7a'));}_0x3dde6c=_[_0x8448('0x7b')](_[_0x8448('0x47')](_0x1fcadd),[_0x8448('0x7c'),_0x8448('0x7d')]);_0x2f5eac=_[_0x8448('0x7b')](_['keys'](_0x1fcadd),['createdAt','updatedAt',_0x8448('0x7e'),_0x8448('0x7f')]);_0x5cd28c['body']={'mapKey':'mobile'};if(_0x5cd28c[_0x8448('0x75')][_0x8448('0x44')]){switch(_0x5cd28c[_0x8448('0x75')][_0x8448('0x44')]){case _0x8448('0x80'):_0x5cd28c[_0x8448('0x5d')][_0x8448('0x81')]=_0x34d0f3[_0x8448('0x5d')]['From'];_0x5cd28c[_0x8448('0x5d')][_0x8448('0x5d')]=_0x34d0f3[_0x8448('0x5d')][_0x8448('0x82')];_0x5cd28c[_0x8448('0x5d')]['messageId']=_0x34d0f3[_0x8448('0x5d')][_0x8448('0x83')];break;case _0x8448('0x84'):_0x5cd28c[_0x8448('0x5d')][_0x8448('0x81')]='+'+_0x34d0f3[_0x8448('0x5d')][_0x8448('0x85')];_0x5cd28c[_0x8448('0x5d')][_0x8448('0x5d')]=_0x34d0f3['body']['text'];break;case'connectel':_0x5cd28c['body'][_0x8448('0x81')]=_0x34d0f3[_0x8448('0x5d')]['from'];_0x5cd28c[_0x8448('0x5d')][_0x8448('0x5d')]=_0x34d0f3[_0x8448('0x5d')][_0x8448('0x2a')];break;case _0x8448('0x86'):_0x5cd28c[_0x8448('0x5d')]['from']=_0x34d0f3['body'][_0x8448('0x81')];_0x5cd28c[_0x8448('0x5d')]['body']=_0x34d0f3[_0x8448('0x5d')][_0x8448('0x5d')];_0x5cd28c[_0x8448('0x5d')][_0x8448('0x87')]=_0x34d0f3[_0x8448('0x5d')][_0x8448('0x88')];break;case _0x8448('0x89'):_0x5cd28c[_0x8448('0x5d')]['from']=_0x34d0f3[_0x8448('0x5d')][_0x8448('0x8a')];_0x5cd28c['body'][_0x8448('0x5d')]=_0x34d0f3[_0x8448('0x5d')][_0x8448('0x8b')];_0x5cd28c[_0x8448('0x5d')][_0x8448('0x87')]=_0x34d0f3[_0x8448('0x5d')][_0x8448('0x8c')];break;case _0x8448('0x8d'):_0x5cd28c['body'][_0x8448('0x81')]='+'+_0x34d0f3[_0x8448('0x5d')][_0x8448('0x8e')][0x0][_0x8448('0x81')];_0x5cd28c[_0x8448('0x5d')][_0x8448('0x5d')]=_0x34d0f3[_0x8448('0x5d')][_0x8448('0x8e')][0x0][_0x8448('0x8f')];_0x5cd28c[_0x8448('0x5d')]['messageId']=_0x34d0f3[_0x8448('0x5d')][_0x8448('0x8e')][0x0][_0x8448('0x87')];break;case _0x8448('0x90'):_0x5cd28c[_0x8448('0x5d')]['from']=_0x34d0f3['body'][_0x8448('0x91')];_0x5cd28c[_0x8448('0x5d')][_0x8448('0x5d')]=_0x34d0f3['body']['segmentedMessage'][_0x8448('0x2a')];break;case _0x8448('0x92'):_0x5cd28c[_0x8448('0x5d')][_0x8448('0x81')]=_0x34d0f3['body'][_0x8448('0x93')];_0x5cd28c[_0x8448('0x5d')][_0x8448('0x5d')]=_0x34d0f3[_0x8448('0x5d')][_0x8448('0x8f')];_0x5cd28c['body']['messageId']=_0x34d0f3[_0x8448('0x5d')][_0x8448('0x94')];break;case _0x8448('0x95'):_0x5cd28c[_0x8448('0x5d')]['messageId']=_0x34d0f3[_0x8448('0x5d')][0x0][_0x8448('0x2a')]['id'];_0x5cd28c[_0x8448('0x5d')][_0x8448('0x81')]=_0x34d0f3[_0x8448('0x5d')][0x0][_0x8448('0x2a')]['from'];_0x5cd28c[_0x8448('0x5d')][_0x8448('0x5d')]=_0x34d0f3[_0x8448('0x5d')][0x0][_0x8448('0x2a')][_0x8448('0x8f')];break;case _0x8448('0x96'):_0x5cd28c['body'][_0x8448('0x81')]=_0x34d0f3[_0x8448('0x5d')][_0x8448('0x81')];_0x5cd28c[_0x8448('0x5d')][_0x8448('0x5d')]=_0x34d0f3[_0x8448('0x5d')][_0x8448('0x2a')];_0x5cd28c['body'][_0x8448('0x87')]=_0x34d0f3[_0x8448('0x5d')][_0x8448('0x97')];break;}}if(_0x5cd28c[_0x8448('0x5d')]['id']){delete _0x5cd28c['body']['id'];}if(_[_0x8448('0x98')](_0x5cd28c[_0x8448('0x5d')][_0x8448('0x81')])){throw new db[(_0x8448('0x79'))][(_0x8448('0x99'))](_0x8448('0x9a'));}if(_[_0x8448('0x98')](_0x5cd28c['body'][_0x8448('0x5d')])||_0x5cd28c[_0x8448('0x5d')][_0x8448('0x5d')]===''){throw new db[(_0x8448('0x79'))]['ValidationError'](_0x8448('0x9b'));}if(_[_0x8448('0x98')](_0x5cd28c[_0x8448('0x5d')][_0x8448('0x9c')])){throw new db[(_0x8448('0x79'))][(_0x8448('0x99'))](_0x8448('0x9d')+_0x2f5eac);}if(!_[_0x8448('0x9e')](_0x2f5eac,_0x5cd28c[_0x8448('0x5d')]['mapKey'])){throw new db[(_0x8448('0x79'))][(_0x8448('0x99'))](_0x8448('0x9f')+_0x2f5eac);}_0x4aff01[_0x5cd28c[_0x8448('0x5d')]['mapKey']]=_0x5cd28c[_0x8448('0x5d')][_0x8448('0x81')];return db['CmList'][_0x8448('0x5b')]({'where':{'id':_0x5cd28c['account'][_0x8448('0x7f')]},'include':[{'model':db['CmContact'],'as':_0x8448('0xa0'),'where':_0x4aff01,'limit':0x1,'order':[[_0x8448('0x7d'),_0x8448('0xa1')]]}]});})[_0x8448('0x22')](handleEntityNotFound(_0x3b5646,null))[_0x8448('0x22')](function(_0x4926d1){if(_0x4926d1){_0x5cd28c['list']=_[_0x8448('0xa2')](_0x4926d1,[_0x8448('0xa0')]);if(_0x4926d1[_0x8448('0xa0')][_0x8448('0x4c')]){return _0x4926d1['Contacts'][0x0];}var _0x3159f6=_[_0x8448('0x1b')](_0x5cd28c[_0x8448('0x5d')],{'firstName':_0x5cd28c[_0x8448('0x5d')][_0x8448('0x81')],'ListId':_0x4926d1['id']});_0x3159f6[_0x5cd28c['body'][_0x8448('0x9c')]]=_0x5cd28c[_0x8448('0x5d')]['from'];return db[_0x8448('0x78')][_0x8448('0x5c')](_0x3159f6,{'fields':_0x3dde6c,'raw':!![]});}})['then'](handleEntityNotFound(_0x3b5646,null))[_0x8448('0x22')](function(_0x2ad485){if(_0x2ad485){_0x5cd28c['contact']=_0x2ad485;var _0x442670={'ContactId':_0x2ad485['id'],'phone':_0x5cd28c[_0x8448('0x5d')]['from'],'SmsAccountId':_0x34d0f3['params']['id']};var _0x537153={'ContactId':_0x2ad485['id'],'SmsAccountId':_0x34d0f3[_0x8448('0x58')]['id'],'closed':![]};return db[_0x8448('0xa3')][_0x8448('0x5b')]({'where':_0x537153})['then'](function(_0x2fcf57){if(_0x2fcf57){return[_0x2fcf57,![]];}return db['SmsInteraction'][_0x8448('0x5c')](_0x442670)[_0x8448('0x22')](function(_0x28c492){return[_0x28c492,!![]];});});}})[_0x8448('0xa4')](function(_0x46db17,_0x20cbad){_0x5cd28c[_0x8448('0xa5')]=_0x46db17['get']({'plain':!![]});_0x5cd28c['interaction'][_0x8448('0xa6')]=![];if(_0x20cbad){if(_0x5cd28c[_0x8448('0x75')]['autoclose']){_0x5cd28c[_0x8448('0xa7')][_0x8448('0xa8')]({'id':0x0,'priority':_0x5cd28c['applications'][_0x8448('0x4c')]+0x1,'app':_0x8448('0xa9'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x5cd28c[_0x8448('0xa5')]['created']=!![];}return db[_0x8448('0xaa')][_0x8448('0x5c')]({'phone':_0x5cd28c[_0x8448('0x5d')][_0x8448('0x81')],'messageId':_0x5cd28c[_0x8448('0x5d')][_0x8448('0x87')],'body':_0x5cd28c[_0x8448('0x5d')][_0x8448('0x5d')],'SmsAccountId':_0x34d0f3[_0x8448('0x58')]['id'],'SmsInteractionId':_0x46db17['id'],'direction':'in','ContactId':_0x46db17[_0x8448('0xab')],'AttachmentId':_0x5cd28c['body'][_0x8448('0xac')]});})[_0x8448('0x22')](function(_0x3f53ad){_0x5cd28c[_0x8448('0x2a')]=_0x3f53ad;if(!_0x5cd28c[_0x8448('0xa5')]['UserId'])return;return db[_0x8448('0xad')]['find']({'attributes':['id',_0x8448('0x3d')],'where':{'id':_0x5cd28c[_0x8448('0xa5')][_0x8448('0xae')]}});})[_0x8448('0x22')](function(_0x378668){if(_0x378668){_0x5cd28c[_0x8448('0xa7')][_0x8448('0xaf')]({'id':0x0,'priority':0x0,'app':_0x8448('0xb0'),'appdata':_0x378668['name']+','+(_0x5cd28c[_0x8448('0x75')][_0x8448('0xb1')]||0xa),'interval':_0x8448('0xb2')});}if(!_0x5cd28c['interaction']['queueId'])return;return db['SmsQueue']['find']({'attributes':['id',_0x8448('0x3d')],'where':{'id':_0x5cd28c[_0x8448('0xa5')]['queueId']}});})[_0x8448('0x22')](function(_0x22a717){if(_0x22a717){_0x5cd28c[_0x8448('0xa7')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x22a717[_0x8448('0x3d')]+','+(_0x5cd28c[_0x8448('0x75')][_0x8448('0xb3')]||0x12c),'interval':_0x8448('0xb2')});}return respondWithRpcPromise(_0x8448('0xb4'),'startRouting',_0x5cd28c);})[_0x8448('0x22')](function(_0x535e19){if(_0x535e19){var _0x671d8c=0xc8;var _0x5e2ac2=_0x8448('0xb5');logger[_0x8448('0x23')](_0x8448('0x25'),_0x5e2ac2,_0x671d8c,_0x8448('0xb6'));logger['debug'](_0x8448('0xb7'),_0x5e2ac2,_0x671d8c,'entity\x20found',JSON[_0x8448('0x26')](_0x535e19));if(_0x5cd28c[_0x8448('0x75')][_0x8448('0x44')]===_0x8448('0x80')){return _0x3b5646['status'](_0x671d8c)[_0x8448('0x35')](_0x8448('0xb8'),_0x8448('0xb9'))['send'](_0x8448('0xba'));}else{return _0x3b5646[_0x8448('0x2e')](_0x671d8c)[_0x8448('0x30')](_0x535e19);}}})[_0x8448('0x2c')](handleError(_0x3b5646,null));};exports[_0x8448('0xbb')]=function(_0x26db4f,_0x335304){var _0x3ce3f6=_0x26db4f['params']['id'];var _0x1150dd=_0x26db4f[_0x8448('0x5d')];var _0x3010e4=0xc8;var _0x7bbe21=null;return db['sequelize'][_0x8448('0xbc')]({'isolationLevel':db[_0x8448('0xbd')][_0x8448('0xbe')][_0x8448('0xbf')][_0x8448('0xc0')]},function(_0x529f44){return db[_0x8448('0x41')][_0x8448('0x67')]({'where':{'id':_0x3ce3f6},'transaction':_0x529f44})[_0x8448('0x22')](function(_0x5ab399){if(_0x5ab399){return db[_0x8448('0x73')][_0x8448('0x3a')]({'where':{'SmsAccountId':_0x3ce3f6},'transaction':_0x529f44})[_0x8448('0x22')](function(){var _0x4e97da=_[_0x8448('0x40')](_0x1150dd,function(_0x20c4b6){_0x20c4b6[_0x8448('0x6e')]=_0x3ce3f6;return _0x20c4b6;});return db[_0x8448('0x73')][_0x8448('0xc1')](_0x4e97da,{'transaction':_0x529f44});});}else{_0x3010e4=0x194;_0x7bbe21=[];}});})[_0x8448('0x22')](function(){if(_0x3010e4!==0x194){return db[_0x8448('0x73')][_0x8448('0xc2')]({'where':{'SmsAccountId':_0x3ce3f6},'order':_0x8448('0x76')})[_0x8448('0x22')](function(_0x583971){_0x7bbe21=_0x583971;});}})[_0x8448('0x2c')](function(_0x1b4fe2){_0x3010e4=0x1f4;logger[_0x8448('0x28')](_0x1b4fe2[_0x8448('0xc3')]);if(_0x1b4fe2[_0x8448('0x3d')]){delete _0x1b4fe2[_0x8448('0x3d')];}_0x7bbe21=_0x1b4fe2;})[_0x8448('0xc4')](function(){if(_0x7bbe21===null){_0x335304['sendStatus'](_0x3010e4);}else{if(_0x3010e4===0x1f4){_0x335304[_0x8448('0x2e')](_0x3010e4)['send'](_0x7bbe21);}else{_0x335304['status'](_0x3010e4)[_0x8448('0x30')](_0x7bbe21);}}});};exports['getApplications']=function(_0x470cf8,_0x38e11c,_0x5cbdc1){var _0x10c354={};var _0x4704b8={};var _0x56eb92;var _0x51cd5e;return db[_0x8448('0x41')][_0x8448('0x67')]({'where':{'id':_0x470cf8['params']['id']}})['then'](handleEntityNotFound(_0x38e11c,null))[_0x8448('0x22')](function(_0x318b2c){if(_0x318b2c){_0x56eb92=_0x318b2c;_0x4704b8[_0x8448('0x45')]=_['keys'](db['SmsApplication']['rawAttributes']);_0x4704b8[_0x8448('0x46')]=_[_0x8448('0x47')](_0x470cf8['query']);_0x4704b8[_0x8448('0x48')]=_['intersection'](_0x4704b8[_0x8448('0x45')],_0x4704b8[_0x8448('0x46')]);_0x10c354[_0x8448('0x4b')]=_[_0x8448('0x49')](_0x4704b8[_0x8448('0x45')],qs[_0x8448('0x4a')](_0x470cf8[_0x8448('0x46')][_0x8448('0x4a')]));_0x10c354[_0x8448('0x4b')]=_0x10c354[_0x8448('0x4b')][_0x8448('0x4c')]?_0x10c354[_0x8448('0x4b')]:_0x4704b8[_0x8448('0x45')];_0x10c354['order']=qs['sort'](_0x470cf8[_0x8448('0x46')][_0x8448('0x4e')]);_0x10c354[_0x8448('0x4f')]=qs[_0x8448('0x48')](_[_0x8448('0x50')](_0x470cf8['query'],_0x4704b8[_0x8448('0x48')]));if(_0x470cf8[_0x8448('0x46')][_0x8448('0x51')]){_0x10c354[_0x8448('0x4f')]=_[_0x8448('0x52')](_0x10c354[_0x8448('0x4f')],{'$or':_[_0x8448('0x40')](_0x10c354[_0x8448('0x4b')],function(_0x6ab3b){var _0x23de27={};_0x23de27[_0x6ab3b]={'$like':'%'+_0x470cf8[_0x8448('0x46')][_0x8448('0x51')]+'%'};return _0x23de27;})});}_0x10c354=_[_0x8448('0x52')]({},_0x10c354,_0x470cf8[_0x8448('0x5a')]);return _0x56eb92['getApplications'](_0x10c354);}})['then'](function(_0x73fe4){if(_0x73fe4){_0x51cd5e=_0x73fe4[_0x8448('0x4c')];if(!_0x470cf8['query'][_0x8448('0x68')](_0x8448('0x69'))){_0x10c354[_0x8448('0x33')]=qs[_0x8448('0x33')](_0x470cf8[_0x8448('0x46')]['limit']);_0x10c354[_0x8448('0x31')]=qs[_0x8448('0x31')](_0x470cf8['query'][_0x8448('0x31')]);}return _0x56eb92['getApplications'](_0x10c354);}})[_0x8448('0x22')](function(_0x53e22c){if(_0x53e22c){return _0x53e22c?{'count':_0x51cd5e,'rows':_0x53e22c}:null;}})['then'](respondWithResult(_0x38e11c,null))[_0x8448('0x2c')](handleError(_0x38e11c,null));};exports[_0x8448('0xc5')]=function(_0x1ef533,_0x1bbdea,_0x405d77){var _0x28b5d4={'raw':![],'where':{}};var _0x5488b5={};var _0x443580={'count':0x0,'rows':[]};return db[_0x8448('0x41')][_0x8448('0x67')]({'where':{'id':_0x1ef533[_0x8448('0x58')]['id']}})[_0x8448('0x22')](handleEntityNotFound(_0x1bbdea,null))[_0x8448('0x22')](function(_0x20fc2f){if(_0x20fc2f){_0x5488b5[_0x8448('0x45')]=_[_0x8448('0x47')](db['SmsInteraction'][_0x8448('0x42')]);_0x5488b5['query']=_[_0x8448('0x47')](_0x1ef533['query']);_0x5488b5[_0x8448('0x48')]=_[_0x8448('0x49')](_0x5488b5['model'],_0x5488b5['query']);_0x28b5d4[_0x8448('0x4b')]=_[_0x8448('0x49')](_0x5488b5['model'],qs[_0x8448('0x4a')](_0x1ef533[_0x8448('0x46')][_0x8448('0x4a')]));_0x28b5d4[_0x8448('0x4b')]=_0x28b5d4[_0x8448('0x4b')][_0x8448('0x4c')]?_0x28b5d4[_0x8448('0x4b')]:_0x5488b5[_0x8448('0x45')];if(!_0x1ef533[_0x8448('0x46')][_0x8448('0x68')](_0x8448('0x69'))){_0x28b5d4['limit']=qs[_0x8448('0x33')](_0x1ef533[_0x8448('0x46')][_0x8448('0x33')]);_0x28b5d4['offset']=qs[_0x8448('0x31')](_0x1ef533[_0x8448('0x46')]['offset']);}_0x28b5d4['order']=qs[_0x8448('0x4e')](_0x1ef533['query']['sort']);_0x28b5d4['where']=qs[_0x8448('0x48')](_['pick'](_0x1ef533[_0x8448('0x46')],_0x5488b5[_0x8448('0x48')]));_0x28b5d4[_0x8448('0x4f')]['SmsAccountId']=_0x20fc2f['id'];if(_0x1ef533[_0x8448('0x46')]['filter']){_0x28b5d4['where']=_['merge'](_0x28b5d4[_0x8448('0x4f')],{'$or':_[_0x8448('0x40')](_0x28b5d4[_0x8448('0x4b')],function(_0x3dccc7){var _0x2ca3fe={};_0x2ca3fe[_0x3dccc7]={'$like':'%'+_0x1ef533['query'][_0x8448('0x51')]+'%'};return _0x2ca3fe;})});}_0x28b5d4=_[_0x8448('0x52')]({},_0x28b5d4,_0x1ef533[_0x8448('0x5a')]);return db[_0x8448('0xa3')][_0x8448('0x34')]({'where':_0x28b5d4[_0x8448('0x4f')]})[_0x8448('0x22')](function(_0x4d1012){_0x443580['count']=_0x4d1012;if(_0x1ef533[_0x8448('0x46')][_0x8448('0x54')]){_0x28b5d4['include']=[{'model':db[_0x8448('0x78')],'as':_0x8448('0xc6'),'required':![]},{'model':db[_0x8448('0xad')],'as':'Owner','attributes':[_0x8448('0x3d'),_0x8448('0xc7'),'internal'],'required':![]},{'model':db[_0x8448('0xc8')],'as':_0x8448('0xc9'),'attributes':['id',_0x8448('0x3d'),_0x8448('0xca')],'where':_0x1ef533['query'][_0x8448('0xcb')]?{'id':_0x1ef533[_0x8448('0x46')]['tag']}:undefined,'required':_0x1ef533[_0x8448('0x46')]['tag']?!![]:![]}];}return db[_0x8448('0xa3')][_0x8448('0x56')](_0x28b5d4);})[_0x8448('0x22')](function(_0x135624){_0x443580[_0x8448('0x6a')]=_0x135624;return _0x443580;});}})[_0x8448('0x22')](respondWithFilteredResult(_0x1bbdea,_0x28b5d4))[_0x8448('0x2c')](handleError(_0x1bbdea,null));};exports[_0x8448('0xcc')]=function(_0x13817e,_0x2bd6bd,_0x4e4016){var _0x2301c4,_0x1aa8cb,_0x11fe1d;if(_[_0x8448('0x98')](_0x13817e[_0x8448('0x5d')]['body'])||_0x13817e[_0x8448('0x5d')][_0x8448('0x5d')]===''){throw new db['Sequelize'][(_0x8448('0x99'))](_0x8448('0x9b'));}if(_[_0x8448('0x98')](_0x13817e['body']['to'])){throw new db[(_0x8448('0x79'))]['ValidationError']('to\x20is\x20mandatory');}_0x2301c4=_0x13817e[_0x8448('0x5d')]['to'];return db[_0x8448('0x41')]['find']({'where':{'id':_0x13817e[_0x8448('0x58')]['id']},'include':[{'model':db[_0x8448('0xcd')],'as':_0x8448('0xce'),'include':[{'model':db[_0x8448('0x78')],'as':_0x8448('0xa0'),'where':{'mobile':_0x2301c4},'limit':0x1,'order':[[_0x8448('0x7d'),_0x8448('0xa1')]]}]}]})[_0x8448('0x22')](handleEntityNotFound(_0x2bd6bd,null))[_0x8448('0x22')](function(_0x214fd5){if(_0x214fd5&&_0x214fd5['List']){_0x1aa8cb=_0x214fd5[_0x8448('0x3b')]({'plain':!![]});if(_0x1aa8cb[_0x8448('0xce')]&&_0x1aa8cb[_0x8448('0xce')][_0x8448('0xa0')][_0x8448('0x4c')]){return _0x1aa8cb['List'][_0x8448('0xa0')][0x0];}return db[_0x8448('0x78')][_0x8448('0x5c')](_[_0x8448('0x1b')](_0x13817e[_0x8448('0x5d')],{'firstName':_0x2301c4,'mobile':_0x2301c4,'phone':_0x2301c4,'ListId':_0x1aa8cb['ListId']}));}})[_0x8448('0x22')](handleEntityNotFound(_0x2bd6bd,null))['then'](function(_0x28c3b6){if(_0x28c3b6){_0x11fe1d=_0x28c3b6;return db[_0x8448('0xa3')]['find']({'where':{'ContactId':_0x11fe1d['id'],'closed':![],'SmsAccountId':_0x1aa8cb['id']}})['then'](function(_0x9f9767){if(_0x9f9767){return[_0x9f9767,![]];}return db[_0x8448('0xa3')]['create']({'UserId':_0x13817e['user']['id'],'ContactId':_0x11fe1d['id'],'SmsAccountId':_0x1aa8cb['id'],'phone':_0x2301c4,'firstMsgDirection':_0x8448('0xcf'),'Messages':[_[_0x8448('0x52')](_0x13817e['body'],{'read':![],'body':_0x13817e[_0x8448('0x5d')][_0x8448('0x5d')],'phone':_0x2301c4,'SmsAccountId':_0x1aa8cb['id'],'UserId':_0x13817e[_0x8448('0x5e')]['id'],'ContactId':_0x11fe1d['id']})]},{'include':[{'model':db[_0x8448('0xaa')],'as':_0x8448('0xd0')}]})[_0x8448('0x22')](function(_0x2ccbfb){return[_0x2ccbfb,!![]];});});}})[_0x8448('0xa4')](function(_0x13c656,_0x4f71aa){if(_0x4f71aa){return _0x13c656;}return db[_0x8448('0xaa')][_0x8448('0x5c')](_[_0x8448('0x52')](_0x13817e[_0x8448('0x5d')],{'read':![],'body':_0x13817e[_0x8448('0x5d')][_0x8448('0x5d')],'phone':_0x2301c4,'SmsAccountId':_0x1aa8cb['id'],'SmsInteractionId':_0x13c656['id'],'UserId':_0x13817e[_0x8448('0x5e')]['id'],'ContactId':_0x11fe1d['id']}))['then'](function(_0x32ad55){_0x13c656[_0x8448('0xd1')]['Messages']=[];_0x13c656[_0x8448('0xd1')]['Messages'][_0x8448('0xa8')](_0x32ad55[_0x8448('0xd1')]);return _0x13c656;});})[_0x8448('0x22')](respondWithResult(_0x2bd6bd,null))[_0x8448('0x2c')](handleError(_0x2bd6bd,null));};exports[_0x8448('0x2e')]=function(_0x4e8d1e,_0x5ace11,_0x1b0fd4){if(_0x4e8d1e[_0x8448('0x5d')]['id']){delete _0x4e8d1e[_0x8448('0x5d')]['id'];}var _0x1192e8,_0x454fd4,_0x32b8d8;return db['SmsAccount'][_0x8448('0x5b')]({'where':{'id':_0x4e8d1e['params']['id']}})[_0x8448('0x22')](handleEntityNotFound(_0x5ace11,null))[_0x8448('0x22')](function(_0x33db2b){if(_0x33db2b){_0x32b8d8=_0x33db2b;logger[_0x8448('0xd2')](_0x8448('0x25'),_0x8448('0x2e'),_0x8448('0xd3'),_0x33db2b[_0x8448('0x44')],util[_0x8448('0xd4')](_0x4e8d1e[_0x8448('0x5d')],{'showHidden':![],'depth':null}));switch(_0x33db2b[_0x8448('0x44')]){case'skebby':if(_0x4e8d1e[_0x8448('0x5d')][_0x8448('0xd5')]&&_0x4e8d1e[_0x8448('0x5d')][_0x8448('0x2e')]){_0x454fd4=_0x4e8d1e[_0x8448('0x5d')][_0x8448('0x2e')];return db[_0x8448('0xaa')][_0x8448('0x5b')]({'where':{'messageId':_0x4e8d1e[_0x8448('0x5d')][_0x8448('0xd5')]}});}break;case _0x8448('0xd6'):if(_0x4e8d1e[_0x8448('0x5d')]['requestid']&&_0x4e8d1e['body'][_0x8448('0xd7')]){_0x454fd4=_0x4e8d1e[_0x8448('0x5d')]['statusInt'];return db[_0x8448('0xaa')][_0x8448('0x5b')]({'where':{'messageId':_0x4e8d1e[_0x8448('0x5d')][_0x8448('0xd8')]}});}break;case _0x8448('0x86'):if(_0x4e8d1e['body']['message_id']&&_0x4e8d1e[_0x8448('0x5d')][_0x8448('0xd9')]){_0x454fd4=_0x4e8d1e[_0x8448('0x5d')]['status_code'];return db[_0x8448('0xaa')][_0x8448('0x5b')]({'where':{'messageId':_0x4e8d1e[_0x8448('0x5d')][_0x8448('0x88')]}});}break;case'infobip':var _0x39dafc=_0x4e8d1e[_0x8448('0x5d')][_0x8448('0x8e')][0x0];if(_0x39dafc[_0x8448('0x87')]&&_0x39dafc['status'][_0x8448('0xda')]===_0x8448('0xdb')){_0x454fd4=_0x39dafc[_0x8448('0x2e')][_0x8448('0xda')];return db[_0x8448('0xaa')][_0x8448('0x5b')]({'where':{'messageId':_0x39dafc[_0x8448('0x87')]}});}break;case _0x8448('0x92'):if(_0x4e8d1e['body'][_0x8448('0x87')]&&_0x4e8d1e['body'][_0x8448('0x2e')]){_0x454fd4=_0x4e8d1e[_0x8448('0x5d')]['status'];return db[_0x8448('0xaa')]['find']({'where':{'messageId':_0x4e8d1e[_0x8448('0x5d')][_0x8448('0x87')]}});}break;case _0x8448('0x95'):if(_0x4e8d1e['body'][0x0][_0x8448('0x2a')]['id']){_0x454fd4=_0x4e8d1e['body'][0x0][_0x8448('0x44')];return db['SmsMessage'][_0x8448('0x5b')]({'where':{'messageId':_0x4e8d1e[_0x8448('0x5d')][0x0]['message']['id']}});}break;case'intelepeer':if(_0x4e8d1e[_0x8448('0x5d')][_0x8448('0xdc')]&&_0x4e8d1e[_0x8448('0x5d')][_0x8448('0x2e')]){_0x454fd4=_0x4e8d1e['body'][_0x8448('0x2e')];return db['SmsMessage']['find']({'where':{'messageId':_0x4e8d1e[_0x8448('0x5d')][_0x8448('0xdc')]}});}break;}}})[_0x8448('0x22')](handleEntityNotFound(_0x5ace11,null))[_0x8448('0x22')](function(_0xc53f45){if(_0xc53f45){_0x1192e8=_0xc53f45;switch(_0x32b8d8[_0x8448('0x44')]){case _0x8448('0x84'):if(_0x454fd4===_0x8448('0xdb')){return _0x1192e8['update']({'read':!![]});}else{logger[_0x8448('0x28')](_0x8448('0x25'),_0x8448('0x2e'),_0x8448('0x84'),util[_0x8448('0xd4')](_0x4e8d1e[_0x8448('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x8448('0xd6'):if(_0x454fd4==='1'){return _0x1192e8[_0x8448('0x39')]({'read':!![]});}else{logger[_0x8448('0x28')](_0x8448('0x25'),_0x8448('0x2e'),_0x8448('0x84'),util[_0x8448('0xd4')](_0x4e8d1e[_0x8448('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x8448('0x86'):if(!_0x4e8d1e[_0x8448('0x5d')]['error_code']&&_0x454fd4>=0xc8&&_0x454fd4<=0xce){return _0x1192e8[_0x8448('0x39')]({'read':!![]});}else{logger['error'](_0x8448('0x25'),_0x8448('0x2e'),_0x8448('0x86'),util[_0x8448('0xd4')](_0x4e8d1e[_0x8448('0x5d')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3d7b43=_0x4e8d1e[_0x8448('0x5d')][_0x8448('0x8e')][0x0];if(_0x3d7b43[_0x8448('0x2e')][_0x8448('0xda')]===_0x8448('0xdb')){return _0x1192e8[_0x8448('0x39')]({'read':!![]});}else{logger[_0x8448('0x28')](_0x8448('0x25'),_0x8448('0x2e'),_0x8448('0x8d'),util[_0x8448('0xd4')](_0x4e8d1e[_0x8448('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x8448('0x92'):if(_0x454fd4==_0x8448('0xdd')||_0x454fd4=='RECEIVED_BY_RECIPIENT'){return _0x1192e8[_0x8448('0x39')]({'read':!![]});}else{logger[_0x8448('0x28')](_0x8448('0x25'),'status',_0x8448('0x92'),util['inspect'](_0x4e8d1e[_0x8448('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x8448('0x95'):if(_0x454fd4==_0x8448('0xde')){return _0x1192e8['update']({'read':!![]});}else{logger[_0x8448('0x28')](_0x8448('0x25'),_0x8448('0x2e'),'bandwidth',util[_0x8448('0xd4')](_0x4e8d1e[_0x8448('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x8448('0x96'):if(_0x454fd4===_0x8448('0xdf')||_0x454fd4===_0x8448('0xe0')){return _0x1192e8['update']({'read':!![]});}else{logger[_0x8448('0x28')](_0x8448('0x25'),_0x8448('0x2e'),_0x8448('0x96'),util[_0x8448('0xd4')](_0x4e8d1e[_0x8448('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x1192e8;}})['then'](respondWithResult(_0x5ace11,null))['catch'](handleError(_0x5ace11,null));};exports[_0x8448('0xe1')]=function(_0x2f1f14,_0xaf57a,_0x4075a2){var _0x8e0d23,_0x5c4761,_0x345093;return db[_0x8448('0x41')]['find']({'where':{'id':_0x2f1f14[_0x8448('0x58')]['id']}})[_0x8448('0x22')](handleEntityNotFound(_0xaf57a,null))[_0x8448('0x22')](function(_0x3e4d74){if(_0x3e4d74){_0x345093=_0x3e4d74;logger[_0x8448('0xd2')](_0x8448('0x25'),_0x8448('0x2e'),_0x8448('0xd3'),_0x3e4d74[_0x8448('0x44')],util[_0x8448('0xd4')](_0x2f1f14['query'],{'showHidden':![],'depth':null}));switch(_0x3e4d74[_0x8448('0x44')]){case _0x8448('0x90'):if(_0x2f1f14[_0x8448('0x46')]['message-id']&&_0x2f1f14[_0x8448('0x46')][_0x8448('0xe2')]){_0x5c4761=_0x2f1f14[_0x8448('0x46')][_0x8448('0xe2')];return db['SmsMessage']['find']({'where':{'messageId':_0x2f1f14[_0x8448('0x46')][_0x8448('0xe3')]}});}break;}}})[_0x8448('0x22')](handleEntityNotFound(_0xaf57a,null))[_0x8448('0x22')](function(_0x30a4a7){if(_0x30a4a7){_0x8e0d23=_0x30a4a7;switch(_0x345093['type']){case _0x8448('0x90'):if(_0x5c4761==='2'||_0x5c4761==='6'){return _0x8e0d23[_0x8448('0x39')]({'read':!![]});}else{logger[_0x8448('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8448('0x2e'),_0x8448('0x90'),util[_0x8448('0xd4')](_0x2f1f14[_0x8448('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x8e0d23;}})[_0x8448('0x22')](respondWithResult(_0xaf57a,null))[_0x8448('0x2c')](handleError(_0xaf57a,null));};exports['addAgents']=function(_0x359154,_0x2b9e95,_0x162d0f){return db[_0x8448('0x41')][_0x8448('0x5b')]({'where':{'id':_0x359154['params']['id']}})[_0x8448('0x22')](handleEntityNotFound(_0x2b9e95,null))[_0x8448('0x22')](function(_0x47850f){if(_0x47850f){return _0x47850f[_0x8448('0xe4')](_0x359154['body'][_0x8448('0x70')],_['omit'](_0x359154[_0x8448('0x5d')],[_0x8448('0x70'),'id'])||{})[_0x8448('0xa4')](function(_0xdf881a){for(var _0x4d3875=0x0;_0x4d3875<_0x359154[_0x8448('0x5d')][_0x8448('0x70')][_0x8448('0x4c')];_0x4d3875+=0x1){socket[_0x8448('0xe5')](_0x8448('0xe6'),{'UserId':Number(_0x359154['body'][_0x8448('0x70')][_0x4d3875]),'SmsAccountId':Number(_0x359154[_0x8448('0x58')]['id'])});}return _0xdf881a;});}})[_0x8448('0x22')](respondWithResult(_0x2b9e95,null))[_0x8448('0x2c')](handleError(_0x2b9e95,null));};exports['removeAgents']=function(_0x3cb38b,_0x412f5a,_0xf2c24c){return db[_0x8448('0x41')][_0x8448('0x5b')]({'where':{'id':_0x3cb38b[_0x8448('0x58')]['id']}})[_0x8448('0x22')](handleEntityNotFound(_0x412f5a,null))['then'](function(_0x2199f1){if(_0x2199f1){return _0x2199f1[_0x8448('0xe7')](_0x3cb38b[_0x8448('0x46')]['ids'])['then'](function(){if(_[_0x8448('0xe8')](_0x3cb38b[_0x8448('0x46')][_0x8448('0x70')])){for(var _0x3cf7cf=0x0;_0x3cf7cf<_0x3cb38b[_0x8448('0x46')][_0x8448('0x70')][_0x8448('0x4c')];_0x3cf7cf+=0x1){socket[_0x8448('0xe5')](_0x8448('0xe9'),{'UserId':Number(_0x3cb38b[_0x8448('0x46')]['ids'][_0x3cf7cf]),'SmsAccountId':Number(_0x3cb38b[_0x8448('0x58')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x3cb38b[_0x8448('0x46')][_0x8448('0x70')]),'SmsAccountId':Number(_0x3cb38b[_0x8448('0x58')]['id'])});}});}})[_0x8448('0x22')](respondWithStatusCode(_0x412f5a,null))[_0x8448('0x2c')](handleError(_0x412f5a,null));};exports[_0x8448('0xea')]=function(_0x5b6311,_0x32e1f5,_0xc04a5){var _0x37c1a5={};var _0x4f8819={};var _0x2a32d6;var _0x49d735;return db[_0x8448('0x41')][_0x8448('0x67')]({'where':{'id':_0x5b6311['params']['id']}})[_0x8448('0x22')](handleEntityNotFound(_0x32e1f5,null))[_0x8448('0x22')](function(_0x240e80){if(_0x240e80){_0x2a32d6=_0x240e80;_0x4f8819[_0x8448('0x45')]=_[_0x8448('0x47')](db['User'][_0x8448('0x42')]);_0x4f8819[_0x8448('0x46')]=_['keys'](_0x5b6311[_0x8448('0x46')]);_0x4f8819[_0x8448('0x48')]=_[_0x8448('0x49')](_0x4f8819[_0x8448('0x45')],_0x4f8819['query']);_0x37c1a5[_0x8448('0x4b')]=_[_0x8448('0x49')](_0x4f8819[_0x8448('0x45')],qs[_0x8448('0x4a')](_0x5b6311[_0x8448('0x46')][_0x8448('0x4a')]));_0x37c1a5['attributes']=_0x37c1a5[_0x8448('0x4b')][_0x8448('0x4c')]?_0x37c1a5[_0x8448('0x4b')]:_0x4f8819[_0x8448('0x45')];_0x37c1a5[_0x8448('0x4d')]=qs['sort'](_0x5b6311[_0x8448('0x46')]['sort']);_0x37c1a5['where']=qs[_0x8448('0x48')](_[_0x8448('0x50')](_0x5b6311[_0x8448('0x46')],_0x4f8819[_0x8448('0x48')]));if(_0x5b6311[_0x8448('0x46')][_0x8448('0x51')]){_0x37c1a5[_0x8448('0x4f')]=_['merge'](_0x37c1a5['where'],{'$or':_[_0x8448('0x40')](_0x37c1a5[_0x8448('0x4b')],function(_0x17e9a2){var _0x7bd7a3={};_0x7bd7a3[_0x17e9a2]={'$like':'%'+_0x5b6311['query'][_0x8448('0x51')]+'%'};return _0x7bd7a3;})});}_0x37c1a5=_[_0x8448('0x52')]({},_0x37c1a5,_0x5b6311[_0x8448('0x5a')]);return _0x2a32d6[_0x8448('0xea')](_0x37c1a5);}})[_0x8448('0x22')](function(_0x36faa1){if(_0x36faa1){_0x49d735=_0x36faa1[_0x8448('0x4c')];if(!_0x5b6311[_0x8448('0x46')][_0x8448('0x68')]('nolimit')){_0x37c1a5[_0x8448('0x33')]=qs[_0x8448('0x33')](_0x5b6311[_0x8448('0x46')][_0x8448('0x33')]);_0x37c1a5[_0x8448('0x31')]=qs[_0x8448('0x31')](_0x5b6311[_0x8448('0x46')]['offset']);}return _0x2a32d6[_0x8448('0xea')](_0x37c1a5);}})[_0x8448('0x22')](function(_0x2f9b47){if(_0x2f9b47){return _0x2f9b47?{'count':_0x49d735,'rows':_0x2f9b47}:null;}})[_0x8448('0x22')](respondWithResult(_0x32e1f5,null))[_0x8448('0x2c')](handleError(_0x32e1f5,null));}; \ No newline at end of file +var _0x098e=['DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','intelepeer','DELIVRD','ACCEPTD','statusGet','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','SmsAccount','fieldName','type','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','mandatoryDispositionPause','rawAttributes','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','order','removeAnswers','SmsApplication','Applications','account','orderBy','priority','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','messageId','skebby','text','connectel','clicksend','message_id','Text','MessageUUID','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','ValidationError','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','contact','spread','interaction','created','autoclose','applications','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','waitForTheAssignedQueue','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','sequelize','transaction','ISOLATION_LEVELS','bulkCreate','finally','getApplications','getInteractions','findOne','SmsInteraction','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','user','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','infobip','groupName'];(function(_0x5bbc71,_0x154d40){var _0x3fd157=function(_0x4d6fcb){while(--_0x4d6fcb){_0x5bbc71['push'](_0x5bbc71['shift']());}};_0x3fd157(++_0x154d40);}(_0x098e,0xf7));var _0xe098=function(_0x5da21d,_0x1d8d3a){_0x5da21d=_0x5da21d-0x0;var _0x41dac=_0x098e[_0x5da21d];return _0x41dac;};'use strict';var emlformat=require(_0xe098('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe098('0x1'));var jsonpatch=require(_0xe098('0x2'));var rp=require(_0xe098('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe098('0x4'));var util=require(_0xe098('0x5'));var path=require('path');var sox=require(_0xe098('0x6'));var csv=require('to-csv');var ejs=require(_0xe098('0x7'));var fs=require('fs');var fs_extra=require(_0xe098('0x8'));var _=require(_0xe098('0x9'));var squel=require(_0xe098('0xa'));var crypto=require(_0xe098('0xb'));var jsforce=require(_0xe098('0xc'));var deskjs=require(_0xe098('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe098('0xe'));var Redis=require(_0xe098('0xf'));var authService=require(_0xe098('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe098('0x11'));var hardwareService=require(_0xe098('0x12'));var logger=require(_0xe098('0x13'))('api');var utils=require(_0xe098('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe098('0x15'))['db'];config[_0xe098('0x16')]=_[_0xe098('0x17')](config[_0xe098('0x16')],{'host':_0xe098('0x18'),'port':0x18eb});var socket=require(_0xe098('0x19'))(new Redis(config[_0xe098('0x16')]));require(_0xe098('0x1a'))[_0xe098('0x1b')](socket);var jayson=require(_0xe098('0x1c'));var client=jayson[_0xe098('0x1d')][_0xe098('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x2cc3d0,_0x597954,_0x3a32c3,_0x3e222c){return new BPromise(function(_0x3d3643,_0x15a683){var _0x58bc3d=_0x3e222c||client;return _0x58bc3d['request'](_0x2cc3d0,_0x3a32c3)[_0xe098('0x1f')](function(_0x198ee8){logger[_0xe098('0x20')](_0xe098('0x21'),_0x597954,_0xe098('0x22'));logger[_0xe098('0x23')](_0xe098('0x24'),_0x597954,'request\x20sent',JSON[_0xe098('0x25')](_0x198ee8));if(_0x198ee8[_0xe098('0x26')]){if(_0x198ee8['error'][_0xe098('0x27')]===0x1f4){logger[_0xe098('0x26')](_0xe098('0x21'),_0x597954,_0x198ee8[_0xe098('0x26')][_0xe098('0x28')]);return _0x15a683(_0x198ee8[_0xe098('0x26')][_0xe098('0x28')]);}logger[_0xe098('0x26')](_0xe098('0x21'),_0x597954,_0x198ee8[_0xe098('0x26')]['message']);return _0x3d3643(_0x198ee8[_0xe098('0x26')][_0xe098('0x28')]);}else{logger[_0xe098('0x20')](_0xe098('0x21'),_0x597954,_0xe098('0x22'));_0x3d3643(_0x198ee8[_0xe098('0x29')]['message']);}})[_0xe098('0x2a')](function(_0x5afa97){logger[_0xe098('0x26')]('SmsAccount,\x20%s,\x20%s',_0x597954,_0x5afa97);_0x15a683(_0x5afa97);});});}function respondWithStatusCode(_0x499ff8,_0x7de6f7){_0x7de6f7=_0x7de6f7||0xcc;return function(_0x4ef4c0){if(_0x4ef4c0){return _0x499ff8[_0xe098('0x2b')](_0x7de6f7);}return _0x499ff8[_0xe098('0x2c')](_0x7de6f7)[_0xe098('0x2d')]();};}function respondWithResult(_0x48c922,_0x13641c){_0x13641c=_0x13641c||0xc8;return function(_0x12554a){if(_0x12554a){return _0x48c922[_0xe098('0x2c')](_0x13641c)[_0xe098('0x2e')](_0x12554a);}};}function respondWithFilteredResult(_0x41590f,_0x3d0dc9){return function(_0x5205b1){if(_0x5205b1){var _0xaa3ffe=typeof _0x3d0dc9['offset']===_0xe098('0x2f')&&typeof _0x3d0dc9[_0xe098('0x30')]===_0xe098('0x2f');var _0xe13f01=_0x5205b1[_0xe098('0x31')];var _0x5b099f=_0xaa3ffe?0x0:_0x3d0dc9[_0xe098('0x32')];var _0x128c7c=_0xaa3ffe?_0x5205b1[_0xe098('0x31')]:_0x3d0dc9[_0xe098('0x32')]+_0x3d0dc9[_0xe098('0x30')];var _0x165a9c;if(_0x128c7c>=_0xe13f01){_0x128c7c=_0xe13f01;_0x165a9c=0xc8;}else{_0x165a9c=0xce;}_0x41590f[_0xe098('0x2c')](_0x165a9c);return _0x41590f[_0xe098('0x33')](_0xe098('0x34'),_0x5b099f+'-'+_0x128c7c+'/'+_0xe13f01)[_0xe098('0x2e')](_0x5205b1);}return null;};}function patchUpdates(_0x413f10){return function(_0x27b4dd){try{jsonpatch[_0xe098('0x35')](_0x27b4dd,_0x413f10,!![]);}catch(_0x29f192){return BPromise[_0xe098('0x36')](_0x29f192);}return _0x27b4dd['save']();};}function saveUpdates(_0x1df7b8,_0x3beff4){return function(_0x490918){if(_0x490918){return _0x490918[_0xe098('0x37')](_0x1df7b8)[_0xe098('0x1f')](function(_0x1b3b66){return _0x1b3b66;});}return null;};}function removeEntity(_0x2f1ccd,_0x2e7652){return function(_0x2a5db8){if(_0x2a5db8){return _0x2a5db8[_0xe098('0x38')]()['then'](function(){var _0x3c8e85=_0x2a5db8[_0xe098('0x39')]({'plain':!![]});var _0x545866='SmsAccounts';return db[_0xe098('0x3a')][_0xe098('0x38')]({'where':{'type':_0x545866,'resourceId':_0x3c8e85['id']}})['then'](function(){return _0x2a5db8;});})[_0xe098('0x1f')](function(){_0x2f1ccd[_0xe098('0x2c')](0xcc)[_0xe098('0x2d')]();});}};}function handleEntityNotFound(_0x1de555,_0x50e085){return function(_0x5a3fec){if(!_0x5a3fec){_0x1de555[_0xe098('0x2b')](0x194);}return _0x5a3fec;};}function handleError(_0x2280d9,_0x490ef9){_0x490ef9=_0x490ef9||0x1f4;return function(_0x3c133d){logger[_0xe098('0x26')](_0x3c133d[_0xe098('0x3b')]);if(_0x3c133d[_0xe098('0x3c')]){delete _0x3c133d[_0xe098('0x3c')];}_0x2280d9['status'](_0x490ef9)[_0xe098('0x3d')](_0x3c133d);};}exports[_0xe098('0x3e')]=function(_0x38e9fc,_0x1333f5){var _0x3441af={'include':[{'model':db[_0xe098('0x3f')],'as':'mandatoryDispositionPause'}]},_0xc52d={},_0x2a87f7={'count':0x0,'rows':[]};var _0x247930=_['map'](db[_0xe098('0x40')]['rawAttributes'],function(_0x5823fd){return{'name':_0x5823fd[_0xe098('0x41')],'type':_0x5823fd[_0xe098('0x42')]['key']};});_0xc52d[_0xe098('0x43')]=_[_0xe098('0x44')](_0x247930,_0xe098('0x3c'));_0xc52d['query']=_[_0xe098('0x45')](_0x38e9fc['query']);_0xc52d['filters']=_['intersection'](_0xc52d[_0xe098('0x43')],_0xc52d[_0xe098('0x46')]);_0x3441af[_0xe098('0x47')]=_[_0xe098('0x48')](_0xc52d['model'],qs[_0xe098('0x49')](_0x38e9fc[_0xe098('0x46')][_0xe098('0x49')]));_0x3441af[_0xe098('0x47')]=_0x3441af['attributes'][_0xe098('0x4a')]?_0x3441af['attributes']:_0xc52d['model'];if(!_0x38e9fc[_0xe098('0x46')][_0xe098('0x4b')](_0xe098('0x4c'))){_0x3441af[_0xe098('0x30')]=qs[_0xe098('0x30')](_0x38e9fc[_0xe098('0x46')][_0xe098('0x30')]);_0x3441af[_0xe098('0x32')]=qs[_0xe098('0x32')](_0x38e9fc[_0xe098('0x46')][_0xe098('0x32')]);}_0x3441af['order']=qs[_0xe098('0x4d')](_0x38e9fc[_0xe098('0x46')]['sort']);_0x3441af[_0xe098('0x4e')]=qs[_0xe098('0x4f')](_[_0xe098('0x50')](_0x38e9fc['query'],_0xc52d[_0xe098('0x4f')]),_0x247930);if(_0x38e9fc[_0xe098('0x46')][_0xe098('0x51')]){_0x3441af[_0xe098('0x4e')]=_[_0xe098('0x52')](_0x3441af[_0xe098('0x4e')],{'$or':_[_0xe098('0x44')](_0x247930,function(_0x53e49b){if(_0x53e49b[_0xe098('0x42')]!==_0xe098('0x53')){var _0x38483a={};_0x38483a[_0x53e49b[_0xe098('0x3c')]]={'$like':'%'+_0x38e9fc['query'][_0xe098('0x51')]+'%'};return _0x38483a;}})});}_0x3441af=_[_0xe098('0x52')]({},_0x3441af,_0x38e9fc[_0xe098('0x54')]);var _0x4e1219={'where':_0x3441af['where']};return db[_0xe098('0x40')]['count'](_0x4e1219)[_0xe098('0x1f')](function(_0x4799b7){_0x2a87f7['count']=_0x4799b7;if(_0x38e9fc[_0xe098('0x46')][_0xe098('0x55')]){_0x3441af['include']=[{'all':!![]}];}return db['SmsAccount'][_0xe098('0x56')](_0x3441af);})[_0xe098('0x1f')](function(_0x42d974){_0x2a87f7[_0xe098('0x57')]=_0x42d974;return _0x2a87f7;})[_0xe098('0x1f')](respondWithFilteredResult(_0x1333f5,_0x3441af))[_0xe098('0x2a')](handleError(_0x1333f5,null));};exports[_0xe098('0x58')]=function(_0x904f66,_0x289f52){var _0x8d6398={'raw':![],'where':{'id':_0x904f66[_0xe098('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0xe098('0x5a')}]},_0x3bd67d={};_0x3bd67d[_0xe098('0x43')]=_[_0xe098('0x45')](db[_0xe098('0x40')][_0xe098('0x5b')]);_0x3bd67d[_0xe098('0x46')]=_['keys'](_0x904f66[_0xe098('0x46')]);_0x3bd67d[_0xe098('0x4f')]=_[_0xe098('0x48')](_0x3bd67d[_0xe098('0x43')],_0x3bd67d['query']);_0x8d6398[_0xe098('0x47')]=_['intersection'](_0x3bd67d['model'],qs['fields'](_0x904f66[_0xe098('0x46')]['fields']));_0x8d6398[_0xe098('0x47')]=_0x8d6398[_0xe098('0x47')][_0xe098('0x4a')]?_0x8d6398[_0xe098('0x47')]:_0x3bd67d[_0xe098('0x43')];if(_0x904f66[_0xe098('0x46')][_0xe098('0x55')]){_0x8d6398[_0xe098('0x5c')]=[{'all':!![]}];}_0x8d6398=_[_0xe098('0x52')]({},_0x8d6398,_0x904f66['options']);return db[_0xe098('0x40')][_0xe098('0x5d')](_0x8d6398)['then'](handleEntityNotFound(_0x289f52,null))['then'](respondWithResult(_0x289f52,null))['catch'](handleError(_0x289f52,null));};exports[_0xe098('0x5e')]=function(_0x2627c9,_0x187658){return db[_0xe098('0x40')][_0xe098('0x5e')](_0x2627c9[_0xe098('0x5f')],{})['then'](function(_0x1681bf){var _0x9454dc=_0x2627c9['user']['get']({'plain':!![]});if(!_0x9454dc)throw new Error(_0xe098('0x60'));if(_0x9454dc[_0xe098('0x61')]==='user'){var _0x45edc3=_0x1681bf[_0xe098('0x39')]({'plain':!![]});var _0x5d85e8='SmsAccounts';return db[_0xe098('0x62')]['find']({'where':{'name':_0x5d85e8,'userProfileId':_0x9454dc[_0xe098('0x63')]},'raw':!![]})['then'](function(_0x101bf9){if(_0x101bf9&&_0x101bf9[_0xe098('0x64')]===0x0){return db[_0xe098('0x3a')][_0xe098('0x5e')]({'name':_0x45edc3[_0xe098('0x3c')],'resourceId':_0x45edc3['id'],'type':_0x101bf9[_0xe098('0x3c')],'sectionId':_0x101bf9['id']},{})[_0xe098('0x1f')](function(){return _0x1681bf;});}else{return _0x1681bf;}})[_0xe098('0x2a')](function(_0x44c09e){logger[_0xe098('0x26')](_0xe098('0x65'),_0x44c09e);throw _0x44c09e;});}return _0x1681bf;})[_0xe098('0x1f')](respondWithResult(_0x187658,0xc9))[_0xe098('0x2a')](handleError(_0x187658,null));};exports[_0xe098('0x37')]=function(_0x53f6aa,_0x227a3c){if(_0x53f6aa[_0xe098('0x5f')]['id']){delete _0x53f6aa['body']['id'];}return db[_0xe098('0x40')]['find']({'where':{'id':_0x53f6aa[_0xe098('0x59')]['id']},'include':[{'model':db[_0xe098('0x3f')],'as':_0xe098('0x5a')}]})[_0xe098('0x1f')](handleEntityNotFound(_0x227a3c,null))[_0xe098('0x1f')](saveUpdates(_0x53f6aa[_0xe098('0x5f')],null))[_0xe098('0x1f')](respondWithResult(_0x227a3c,null))['catch'](handleError(_0x227a3c,null));};exports['destroy']=function(_0x557e9b,_0x4213d8){return db[_0xe098('0x40')][_0xe098('0x5d')]({'where':{'id':_0x557e9b['params']['id']}})[_0xe098('0x1f')](handleEntityNotFound(_0x4213d8,null))[_0xe098('0x1f')](removeEntity(_0x4213d8,null))[_0xe098('0x2a')](handleError(_0x4213d8,null));};exports[_0xe098('0x66')]=function(_0x35c007,_0x3575e7){return db[_0xe098('0x40')]['describe']()[_0xe098('0x1f')](respondWithResult(_0x3575e7,null))[_0xe098('0x2a')](handleError(_0x3575e7,null));};exports[_0xe098('0x67')]=function(_0x13cbdc,_0x2a33c6,_0x2efd9c){if(_0x13cbdc['body']['id']){delete _0x13cbdc['body']['id'];}return db[_0xe098('0x40')][_0xe098('0x5d')]({'where':{'id':_0x13cbdc[_0xe098('0x59')]['id']}})[_0xe098('0x1f')](handleEntityNotFound(_0x2a33c6,null))['then'](function(_0x3f49af){if(_0x3f49af){_0x13cbdc['body'][_0xe098('0x68')]=_0x3f49af['id'];return db[_0xe098('0x69')][_0xe098('0x5e')](_0x13cbdc[_0xe098('0x5f')]);}})['then'](respondWithResult(_0x2a33c6,null))[_0xe098('0x2a')](handleError(_0x2a33c6,null));};exports[_0xe098('0x6a')]=function(_0xdf1b19,_0x44e42a,_0x18b549){var _0x44c680={'raw':![],'where':{}};var _0x1cf077={};var _0x5520b3={'count':0x0,'rows':[]};return db[_0xe098('0x40')]['findOne']({'where':{'id':_0xdf1b19['params']['id']}})['then'](handleEntityNotFound(_0x44e42a,null))['then'](function(_0x47821e){if(_0x47821e){_0x1cf077[_0xe098('0x43')]=_['keys'](db[_0xe098('0x69')][_0xe098('0x5b')]);_0x1cf077['query']=_[_0xe098('0x45')](_0xdf1b19[_0xe098('0x46')]);_0x1cf077[_0xe098('0x4f')]=_[_0xe098('0x48')](_0x1cf077['model'],_0x1cf077[_0xe098('0x46')]);_0x44c680[_0xe098('0x47')]=_[_0xe098('0x48')](_0x1cf077[_0xe098('0x43')],qs['fields'](_0xdf1b19[_0xe098('0x46')][_0xe098('0x49')]));_0x44c680[_0xe098('0x47')]=_0x44c680[_0xe098('0x47')]['length']?_0x44c680[_0xe098('0x47')]:_0x1cf077['model'];if(!_0xdf1b19[_0xe098('0x46')]['hasOwnProperty'](_0xe098('0x4c'))){_0x44c680[_0xe098('0x30')]=qs[_0xe098('0x30')](_0xdf1b19[_0xe098('0x46')][_0xe098('0x30')]);_0x44c680[_0xe098('0x32')]=qs[_0xe098('0x32')](_0xdf1b19[_0xe098('0x46')][_0xe098('0x32')]);}_0x44c680['order']=qs[_0xe098('0x4d')](_0xdf1b19['query'][_0xe098('0x4d')]);_0x44c680[_0xe098('0x4e')]=qs[_0xe098('0x4f')](_[_0xe098('0x50')](_0xdf1b19[_0xe098('0x46')],_0x1cf077['filters']));_0x44c680[_0xe098('0x4e')]['SmsAccountId']=_0x47821e['id'];if(_0xdf1b19['query']['filter']){_0x44c680[_0xe098('0x4e')]=_[_0xe098('0x52')](_0x44c680['where'],{'$or':_['map'](_0x44c680[_0xe098('0x47')],function(_0x413bf3){var _0x4ecbcc={};_0x4ecbcc[_0x413bf3]={'$like':'%'+_0xdf1b19['query']['filter']+'%'};return _0x4ecbcc;})});}_0x44c680=_[_0xe098('0x52')]({},_0x44c680,_0xdf1b19[_0xe098('0x54')]);return db[_0xe098('0x69')][_0xe098('0x31')]({'where':_0x44c680[_0xe098('0x4e')]})[_0xe098('0x1f')](function(_0x19277c){_0x5520b3[_0xe098('0x31')]=_0x19277c;if(_0xdf1b19[_0xe098('0x46')][_0xe098('0x55')]){_0x44c680['include']=[{'all':!![]}];}return db[_0xe098('0x69')][_0xe098('0x56')](_0x44c680);})[_0xe098('0x1f')](function(_0x4016b0){_0x5520b3[_0xe098('0x57')]=_0x4016b0;return _0x5520b3;});}})[_0xe098('0x1f')](respondWithFilteredResult(_0x44e42a,_0x44c680))[_0xe098('0x2a')](handleError(_0x44e42a,null));};exports['removeDispositions']=function(_0x357444,_0x2f9a9a,_0x33322a){return db[_0xe098('0x40')]['find']({'where':{'id':_0x357444[_0xe098('0x59')]['id']}})[_0xe098('0x1f')](handleEntityNotFound(_0x2f9a9a,null))['then'](function(_0x284b79){if(_0x284b79){return _0x284b79[_0xe098('0x6b')](_0x357444[_0xe098('0x46')][_0xe098('0x6c')]);}})['then'](respondWithStatusCode(_0x2f9a9a,null))['catch'](handleError(_0x2f9a9a,null));};exports[_0xe098('0x6d')]=function(_0x8d462a,_0x220fb2,_0x294f2e){if(_0x8d462a['body']['id']){delete _0x8d462a[_0xe098('0x5f')]['id'];}return db['SmsAccount'][_0xe098('0x5d')]({'where':{'id':_0x8d462a['params']['id']}})[_0xe098('0x1f')](handleEntityNotFound(_0x220fb2,null))[_0xe098('0x1f')](function(_0x570ed0){if(_0x570ed0){_0x8d462a[_0xe098('0x5f')][_0xe098('0x68')]=_0x570ed0['id'];return db['CannedAnswer']['create'](_0x8d462a[_0xe098('0x5f')]);}})[_0xe098('0x1f')](respondWithResult(_0x220fb2,null))[_0xe098('0x2a')](handleError(_0x220fb2,null));};exports['getAnswers']=function(_0x371b91,_0x1019ac,_0x1e69ad){var _0x22a1ed={'raw':![],'where':{}};var _0x4eb3c0={};var _0x578824={'count':0x0,'rows':[]};return db[_0xe098('0x40')]['findOne']({'where':{'id':_0x371b91[_0xe098('0x59')]['id']}})[_0xe098('0x1f')](handleEntityNotFound(_0x1019ac,null))[_0xe098('0x1f')](function(_0x7273db){if(_0x7273db){_0x4eb3c0[_0xe098('0x43')]=_[_0xe098('0x45')](db[_0xe098('0x6e')][_0xe098('0x5b')]);_0x4eb3c0[_0xe098('0x46')]=_[_0xe098('0x45')](_0x371b91[_0xe098('0x46')]);_0x4eb3c0[_0xe098('0x4f')]=_['intersection'](_0x4eb3c0[_0xe098('0x43')],_0x4eb3c0['query']);_0x22a1ed[_0xe098('0x47')]=_['intersection'](_0x4eb3c0[_0xe098('0x43')],qs['fields'](_0x371b91[_0xe098('0x46')][_0xe098('0x49')]));_0x22a1ed[_0xe098('0x47')]=_0x22a1ed[_0xe098('0x47')][_0xe098('0x4a')]?_0x22a1ed['attributes']:_0x4eb3c0[_0xe098('0x43')];if(!_0x371b91[_0xe098('0x46')][_0xe098('0x4b')](_0xe098('0x4c'))){_0x22a1ed[_0xe098('0x30')]=qs[_0xe098('0x30')](_0x371b91[_0xe098('0x46')][_0xe098('0x30')]);_0x22a1ed['offset']=qs['offset'](_0x371b91['query'][_0xe098('0x32')]);}_0x22a1ed[_0xe098('0x6f')]=qs[_0xe098('0x4d')](_0x371b91['query'][_0xe098('0x4d')]);_0x22a1ed[_0xe098('0x4e')]=qs[_0xe098('0x4f')](_[_0xe098('0x50')](_0x371b91[_0xe098('0x46')],_0x4eb3c0[_0xe098('0x4f')]));_0x22a1ed['where'][_0xe098('0x68')]=_0x7273db['id'];if(_0x371b91[_0xe098('0x46')][_0xe098('0x51')]){_0x22a1ed[_0xe098('0x4e')]=_[_0xe098('0x52')](_0x22a1ed['where'],{'$or':_['map'](_0x22a1ed[_0xe098('0x47')],function(_0x240433){var _0x354ae9={};_0x354ae9[_0x240433]={'$like':'%'+_0x371b91[_0xe098('0x46')][_0xe098('0x51')]+'%'};return _0x354ae9;})});}_0x22a1ed=_[_0xe098('0x52')]({},_0x22a1ed,_0x371b91[_0xe098('0x54')]);return db[_0xe098('0x6e')][_0xe098('0x31')]({'where':_0x22a1ed['where']})[_0xe098('0x1f')](function(_0xe334f9){_0x578824[_0xe098('0x31')]=_0xe334f9;if(_0x371b91[_0xe098('0x46')][_0xe098('0x55')]){_0x22a1ed['include']=[{'all':!![]}];}return db[_0xe098('0x6e')][_0xe098('0x56')](_0x22a1ed);})[_0xe098('0x1f')](function(_0x1d6e36){_0x578824[_0xe098('0x57')]=_0x1d6e36;return _0x578824;});}})['then'](respondWithFilteredResult(_0x1019ac,_0x22a1ed))[_0xe098('0x2a')](handleError(_0x1019ac,null));};exports['removeAnswers']=function(_0x5436c7,_0x275086,_0xb0c965){return db[_0xe098('0x40')][_0xe098('0x5d')]({'where':{'id':_0x5436c7[_0xe098('0x59')]['id']}})[_0xe098('0x1f')](handleEntityNotFound(_0x275086,null))[_0xe098('0x1f')](function(_0x116218){if(_0x116218){return _0x116218[_0xe098('0x70')](_0x5436c7['query'][_0xe098('0x6c')]);}})[_0xe098('0x1f')](respondWithStatusCode(_0x275086,null))[_0xe098('0x2a')](handleError(_0x275086,null));};exports['notify']=function(_0x4d8275,_0x9036b1,_0x1eaf93){var _0x1e0b7a={'channel':'sms'};var _0x55ba50=[];var _0x3e88b5=[];var _0x4e0a28={};return db[_0xe098('0x40')][_0xe098('0x5d')]({'where':{'id':_0x4d8275[_0xe098('0x59')]['id']},'include':[{'model':db[_0xe098('0x71')],'as':_0xe098('0x72')}]})[_0xe098('0x1f')](handleEntityNotFound(_0x9036b1,null))[_0xe098('0x1f')](function(_0x2059e9){_0x1e0b7a[_0xe098('0x73')]=_0x2059e9;_0x1e0b7a['applications']=_[_0xe098('0x74')](_0x2059e9['Applications'],[_0xe098('0x75')],['asc']);if(_0x1e0b7a[_0xe098('0x73')][_0xe098('0x72')]){delete _0x1e0b7a['account']['Applications'];}return db[_0xe098('0x76')][_0xe098('0x66')]();})[_0xe098('0x1f')](function(_0x361980){if(!_0x361980){throw new db[(_0xe098('0x77'))]['ValidationError']('no\x20available\x20attributes');}_0x55ba50=_[_0xe098('0x78')](_[_0xe098('0x45')](_0x361980),[_0xe098('0x79'),_0xe098('0x7a')]);_0x3e88b5=_['difference'](_[_0xe098('0x45')](_0x361980),[_0xe098('0x79'),_0xe098('0x7a'),_0xe098('0x7b'),_0xe098('0x7c')]);_0x1e0b7a[_0xe098('0x5f')]={'mapKey':'mobile'};if(_0x1e0b7a[_0xe098('0x73')][_0xe098('0x42')]){switch(_0x1e0b7a[_0xe098('0x73')][_0xe098('0x42')]){case _0xe098('0x7d'):_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x7e')]=_0x4d8275['body'][_0xe098('0x7f')];_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x5f')]=_0x4d8275[_0xe098('0x5f')]['Body'];_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x80')]=_0x4d8275[_0xe098('0x5f')]['MessageSid'];break;case _0xe098('0x81'):_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x7e')]='+'+_0x4d8275[_0xe098('0x5f')]['sender'];_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x5f')]=_0x4d8275[_0xe098('0x5f')][_0xe098('0x82')];break;case _0xe098('0x83'):_0x1e0b7a['body'][_0xe098('0x7e')]=_0x4d8275[_0xe098('0x5f')][_0xe098('0x7e')];_0x1e0b7a['body']['body']=_0x4d8275[_0xe098('0x5f')][_0xe098('0x28')];break;case _0xe098('0x84'):_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x7e')]=_0x4d8275[_0xe098('0x5f')]['from'];_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x5f')]=_0x4d8275[_0xe098('0x5f')][_0xe098('0x5f')];_0x1e0b7a[_0xe098('0x5f')]['messageId']=_0x4d8275['body'][_0xe098('0x85')];break;case'plivo':_0x1e0b7a['body'][_0xe098('0x7e')]=_0x4d8275[_0xe098('0x5f')][_0xe098('0x7f')];_0x1e0b7a[_0xe098('0x5f')]['body']=_0x4d8275[_0xe098('0x5f')][_0xe098('0x86')];_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x80')]=_0x4d8275['body'][_0xe098('0x87')];break;case'infobip':_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x7e')]='+'+_0x4d8275[_0xe098('0x5f')][_0xe098('0x88')][0x0][_0xe098('0x7e')];_0x1e0b7a[_0xe098('0x5f')]['body']=_0x4d8275[_0xe098('0x5f')][_0xe098('0x88')][0x0][_0xe098('0x82')];_0x1e0b7a['body'][_0xe098('0x80')]=_0x4d8275[_0xe098('0x5f')]['results'][0x0][_0xe098('0x80')];break;case _0xe098('0x89'):_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x7e')]=_0x4d8275['body'][_0xe098('0x8a')];_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x5f')]=_0x4d8275[_0xe098('0x5f')][_0xe098('0x8b')][_0xe098('0x28')];break;case _0xe098('0x8c'):_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x7e')]=_0x4d8275[_0xe098('0x5f')][_0xe098('0x8d')];_0x1e0b7a[_0xe098('0x5f')]['body']=_0x4d8275[_0xe098('0x5f')][_0xe098('0x82')];_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x80')]=_0x4d8275[_0xe098('0x5f')]['replyMessageId'];break;case _0xe098('0x8e'):_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x80')]=_0x4d8275[_0xe098('0x5f')][0x0][_0xe098('0x28')]['id'];_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x7e')]=_0x4d8275[_0xe098('0x5f')][0x0]['message']['from'];_0x1e0b7a[_0xe098('0x5f')]['body']=_0x4d8275[_0xe098('0x5f')][0x0][_0xe098('0x28')][_0xe098('0x82')];break;case'intelepeer':_0x1e0b7a[_0xe098('0x5f')]['from']=_0x4d8275[_0xe098('0x5f')]['from'];_0x1e0b7a[_0xe098('0x5f')]['body']=_0x4d8275['body'][_0xe098('0x28')];_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x80')]=_0x4d8275[_0xe098('0x5f')]['refid'];break;}}if(_0x1e0b7a[_0xe098('0x5f')]['id']){delete _0x1e0b7a[_0xe098('0x5f')]['id'];}if(_[_0xe098('0x8f')](_0x1e0b7a[_0xe098('0x5f')]['from'])){throw new db[(_0xe098('0x77'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xe098('0x8f')](_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x5f')])||_0x1e0b7a['body'][_0xe098('0x5f')]===''){throw new db[(_0xe098('0x77'))]['ValidationError'](_0xe098('0x90'));}if(_['isNil'](_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x91')])){throw new db[(_0xe098('0x77'))][(_0xe098('0x92'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3e88b5);}if(!_[_0xe098('0x93')](_0x3e88b5,_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x91')])){throw new db[(_0xe098('0x77'))][(_0xe098('0x92'))](_0xe098('0x94')+_0x3e88b5);}_0x4e0a28[_0x1e0b7a['body'][_0xe098('0x91')]]=_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x7e')];return db[_0xe098('0x95')]['find']({'where':{'id':_0x1e0b7a[_0xe098('0x73')][_0xe098('0x7c')]},'include':[{'model':db[_0xe098('0x76')],'as':'Contacts','where':_0x4e0a28,'limit':0x1,'order':[[_0xe098('0x7a'),_0xe098('0x96')]]}]});})[_0xe098('0x1f')](handleEntityNotFound(_0x9036b1,null))[_0xe098('0x1f')](function(_0x41823d){if(_0x41823d){_0x1e0b7a[_0xe098('0x97')]=_[_0xe098('0x98')](_0x41823d,[_0xe098('0x99')]);if(_0x41823d['Contacts'][_0xe098('0x4a')]){return _0x41823d[_0xe098('0x99')][0x0];}var _0x4ad4f2=_['defaults'](_0x1e0b7a[_0xe098('0x5f')],{'firstName':_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x7e')],'ListId':_0x41823d['id']});_0x4ad4f2[_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x91')]]=_0x1e0b7a[_0xe098('0x5f')]['from'];return db['CmContact'][_0xe098('0x5e')](_0x4ad4f2,{'fields':_0x55ba50,'raw':!![]});}})[_0xe098('0x1f')](handleEntityNotFound(_0x9036b1,null))[_0xe098('0x1f')](function(_0x2445e4){if(_0x2445e4){_0x1e0b7a[_0xe098('0x9a')]=_0x2445e4;var _0x4258b9={'ContactId':_0x2445e4['id'],'phone':_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x7e')],'SmsAccountId':_0x4d8275[_0xe098('0x59')]['id']};var _0x27b7c1={'ContactId':_0x2445e4['id'],'SmsAccountId':_0x4d8275[_0xe098('0x59')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x27b7c1})[_0xe098('0x1f')](function(_0x273f84){if(_0x273f84){return[_0x273f84,![]];}return db['SmsInteraction']['create'](_0x4258b9)['then'](function(_0x5af233){return[_0x5af233,!![]];});});}})[_0xe098('0x9b')](function(_0x2fa1ec,_0x813d2a){_0x1e0b7a[_0xe098('0x9c')]=_0x2fa1ec[_0xe098('0x39')]({'plain':!![]});_0x1e0b7a[_0xe098('0x9c')][_0xe098('0x9d')]=![];if(_0x813d2a){if(_0x1e0b7a[_0xe098('0x73')][_0xe098('0x9e')]){_0x1e0b7a[_0xe098('0x9f')]['push']({'id':0x0,'priority':_0x1e0b7a[_0xe098('0x9f')][_0xe098('0x4a')]+0x1,'app':_0xe098('0xa0'),'appdata':_0xe098('0xa1'),'interval':_0xe098('0xa2')});}_0x1e0b7a[_0xe098('0x9c')][_0xe098('0x9d')]=!![];}return db[_0xe098('0xa3')][_0xe098('0x5e')]({'phone':_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x7e')],'messageId':_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x80')],'body':_0x1e0b7a[_0xe098('0x5f')][_0xe098('0x5f')],'SmsAccountId':_0x4d8275[_0xe098('0x59')]['id'],'SmsInteractionId':_0x2fa1ec['id'],'direction':'in','ContactId':_0x2fa1ec[_0xe098('0xa4')],'AttachmentId':_0x1e0b7a[_0xe098('0x5f')][_0xe098('0xa5')]});})[_0xe098('0x1f')](function(_0x8912cb){_0x1e0b7a[_0xe098('0x28')]=_0x8912cb;if(!_0x1e0b7a[_0xe098('0x9c')][_0xe098('0xa6')])return;return db[_0xe098('0xa7')]['find']({'attributes':['id',_0xe098('0x3c')],'where':{'id':_0x1e0b7a[_0xe098('0x9c')][_0xe098('0xa6')]}});})[_0xe098('0x1f')](function(_0x4135c0){if(_0x4135c0){_0x1e0b7a[_0xe098('0x9f')][_0xe098('0xa8')]({'id':0x0,'priority':0x0,'app':_0xe098('0xa9'),'appdata':_0x4135c0[_0xe098('0x3c')]+','+(_0x1e0b7a[_0xe098('0x73')][_0xe098('0xaa')]||0xa),'interval':_0xe098('0xa2')});}if(!_0x1e0b7a[_0xe098('0x9c')][_0xe098('0xab')])return;return db[_0xe098('0xac')][_0xe098('0x5d')]({'attributes':['id',_0xe098('0x3c')],'where':{'id':_0x1e0b7a[_0xe098('0x9c')]['queueId']}});})[_0xe098('0x1f')](function(_0x22f01d){if(_0x22f01d){_0x1e0b7a[_0xe098('0x9f')][_0xe098('0xa8')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x22f01d[_0xe098('0x3c')]+','+(_0x1e0b7a[_0xe098('0x73')][_0xe098('0xad')]||0x12c),'interval':_0xe098('0xa2')});}return respondWithRpcPromise('Start',_0xe098('0xae'),_0x1e0b7a);})['then'](function(_0x56e5a8){if(_0x56e5a8){var _0x5147bb=0xc8;var _0x4826d4='receiveMessage';logger[_0xe098('0x20')](_0xe098('0x24'),_0x4826d4,_0x5147bb,_0xe098('0xaf'));logger[_0xe098('0x23')](_0xe098('0xb0'),_0x4826d4,_0x5147bb,_0xe098('0xaf'),JSON['stringify'](_0x56e5a8));if(_0x1e0b7a['account'][_0xe098('0x42')]===_0xe098('0x7d')){return _0x9036b1[_0xe098('0x2c')](_0x5147bb)[_0xe098('0x33')](_0xe098('0xb1'),_0xe098('0xb2'))[_0xe098('0x3d')](_0xe098('0xb3'));}else{return _0x9036b1[_0xe098('0x2c')](_0x5147bb)[_0xe098('0x2e')](_0x56e5a8);}}})[_0xe098('0x2a')](handleError(_0x9036b1,null));};exports['addApplications']=function(_0x42e38d,_0x590d09){var _0x1b50ae=_0x42e38d['params']['id'];var _0x59740d=_0x42e38d[_0xe098('0x5f')];var _0x486d33=0xc8;var _0x2e3e1d=null;return db[_0xe098('0xb4')][_0xe098('0xb5')]({'isolationLevel':db['sequelize']['Transaction'][_0xe098('0xb6')]['READ_COMMITTED']},function(_0x1d9dcf){return db[_0xe098('0x40')]['findOne']({'where':{'id':_0x1b50ae},'transaction':_0x1d9dcf})['then'](function(_0x3117ba){if(_0x3117ba){return db[_0xe098('0x71')][_0xe098('0x38')]({'where':{'SmsAccountId':_0x1b50ae},'transaction':_0x1d9dcf})[_0xe098('0x1f')](function(){var _0x293697=_['map'](_0x59740d,function(_0x5afd65){_0x5afd65['SmsAccountId']=_0x1b50ae;return _0x5afd65;});return db[_0xe098('0x71')][_0xe098('0xb7')](_0x293697,{'transaction':_0x1d9dcf});});}else{_0x486d33=0x194;_0x2e3e1d=[];}});})['then'](function(){if(_0x486d33!==0x194){return db[_0xe098('0x71')]['findAndCountAll']({'where':{'SmsAccountId':_0x1b50ae},'order':_0xe098('0x75')})['then'](function(_0xf2a72e){_0x2e3e1d=_0xf2a72e;});}})[_0xe098('0x2a')](function(_0x3f9516){_0x486d33=0x1f4;logger[_0xe098('0x26')](_0x3f9516[_0xe098('0x3b')]);if(_0x3f9516[_0xe098('0x3c')]){delete _0x3f9516[_0xe098('0x3c')];}_0x2e3e1d=_0x3f9516;})[_0xe098('0xb8')](function(){if(_0x2e3e1d===null){_0x590d09['sendStatus'](_0x486d33);}else{if(_0x486d33===0x1f4){_0x590d09[_0xe098('0x2c')](_0x486d33)[_0xe098('0x3d')](_0x2e3e1d);}else{_0x590d09[_0xe098('0x2c')](_0x486d33)[_0xe098('0x2e')](_0x2e3e1d);}}});};exports[_0xe098('0xb9')]=function(_0x5ab97f,_0x53f7a7,_0x4ccb44){var _0x4cac44={};var _0x5352c9={};var _0x5a9e1e;var _0x2becca;return db[_0xe098('0x40')]['findOne']({'where':{'id':_0x5ab97f[_0xe098('0x59')]['id']}})[_0xe098('0x1f')](handleEntityNotFound(_0x53f7a7,null))['then'](function(_0x47d8c7){if(_0x47d8c7){_0x5a9e1e=_0x47d8c7;_0x5352c9[_0xe098('0x43')]=_[_0xe098('0x45')](db[_0xe098('0x71')][_0xe098('0x5b')]);_0x5352c9['query']=_[_0xe098('0x45')](_0x5ab97f['query']);_0x5352c9[_0xe098('0x4f')]=_[_0xe098('0x48')](_0x5352c9[_0xe098('0x43')],_0x5352c9[_0xe098('0x46')]);_0x4cac44[_0xe098('0x47')]=_['intersection'](_0x5352c9['model'],qs[_0xe098('0x49')](_0x5ab97f['query'][_0xe098('0x49')]));_0x4cac44['attributes']=_0x4cac44[_0xe098('0x47')][_0xe098('0x4a')]?_0x4cac44['attributes']:_0x5352c9[_0xe098('0x43')];_0x4cac44[_0xe098('0x6f')]=qs[_0xe098('0x4d')](_0x5ab97f['query']['sort']);_0x4cac44[_0xe098('0x4e')]=qs[_0xe098('0x4f')](_[_0xe098('0x50')](_0x5ab97f[_0xe098('0x46')],_0x5352c9[_0xe098('0x4f')]));if(_0x5ab97f[_0xe098('0x46')][_0xe098('0x51')]){_0x4cac44[_0xe098('0x4e')]=_[_0xe098('0x52')](_0x4cac44['where'],{'$or':_[_0xe098('0x44')](_0x4cac44['attributes'],function(_0x2c9120){var _0x463b2f={};_0x463b2f[_0x2c9120]={'$like':'%'+_0x5ab97f['query'][_0xe098('0x51')]+'%'};return _0x463b2f;})});}_0x4cac44=_[_0xe098('0x52')]({},_0x4cac44,_0x5ab97f[_0xe098('0x54')]);return _0x5a9e1e[_0xe098('0xb9')](_0x4cac44);}})['then'](function(_0x5c678b){if(_0x5c678b){_0x2becca=_0x5c678b['length'];if(!_0x5ab97f['query'][_0xe098('0x4b')](_0xe098('0x4c'))){_0x4cac44[_0xe098('0x30')]=qs[_0xe098('0x30')](_0x5ab97f[_0xe098('0x46')][_0xe098('0x30')]);_0x4cac44[_0xe098('0x32')]=qs[_0xe098('0x32')](_0x5ab97f[_0xe098('0x46')]['offset']);}return _0x5a9e1e[_0xe098('0xb9')](_0x4cac44);}})[_0xe098('0x1f')](function(_0x1b1132){if(_0x1b1132){return _0x1b1132?{'count':_0x2becca,'rows':_0x1b1132}:null;}})[_0xe098('0x1f')](respondWithResult(_0x53f7a7,null))['catch'](handleError(_0x53f7a7,null));};exports[_0xe098('0xba')]=function(_0x348217,_0x13f03c,_0x2f398e){var _0x243667={'raw':![],'where':{}};var _0x55f756={};var _0xaa0339={'count':0x0,'rows':[]};return db[_0xe098('0x40')][_0xe098('0xbb')]({'where':{'id':_0x348217['params']['id']}})[_0xe098('0x1f')](handleEntityNotFound(_0x13f03c,null))[_0xe098('0x1f')](function(_0x3063a3){if(_0x3063a3){_0x55f756[_0xe098('0x43')]=_[_0xe098('0x45')](db[_0xe098('0xbc')][_0xe098('0x5b')]);_0x55f756[_0xe098('0x46')]=_[_0xe098('0x45')](_0x348217[_0xe098('0x46')]);_0x55f756[_0xe098('0x4f')]=_[_0xe098('0x48')](_0x55f756[_0xe098('0x43')],_0x55f756[_0xe098('0x46')]);_0x243667[_0xe098('0x47')]=_[_0xe098('0x48')](_0x55f756[_0xe098('0x43')],qs['fields'](_0x348217[_0xe098('0x46')][_0xe098('0x49')]));_0x243667[_0xe098('0x47')]=_0x243667[_0xe098('0x47')][_0xe098('0x4a')]?_0x243667[_0xe098('0x47')]:_0x55f756[_0xe098('0x43')];if(!_0x348217[_0xe098('0x46')][_0xe098('0x4b')]('nolimit')){_0x243667[_0xe098('0x30')]=qs['limit'](_0x348217['query'][_0xe098('0x30')]);_0x243667[_0xe098('0x32')]=qs[_0xe098('0x32')](_0x348217[_0xe098('0x46')]['offset']);}_0x243667['order']=qs['sort'](_0x348217['query'][_0xe098('0x4d')]);_0x243667['where']=qs['filters'](_[_0xe098('0x50')](_0x348217[_0xe098('0x46')],_0x55f756[_0xe098('0x4f')]));_0x243667[_0xe098('0x4e')][_0xe098('0x68')]=_0x3063a3['id'];if(_0x348217[_0xe098('0x46')][_0xe098('0x51')]){_0x243667[_0xe098('0x4e')]=_[_0xe098('0x52')](_0x243667[_0xe098('0x4e')],{'$or':_[_0xe098('0x44')](_0x243667[_0xe098('0x47')],function(_0x4203d5){var _0x8e108d={};_0x8e108d[_0x4203d5]={'$like':'%'+_0x348217[_0xe098('0x46')][_0xe098('0x51')]+'%'};return _0x8e108d;})});}_0x243667=_[_0xe098('0x52')]({},_0x243667,_0x348217[_0xe098('0x54')]);return db[_0xe098('0xbc')]['count']({'where':_0x243667['where']})[_0xe098('0x1f')](function(_0x11ef24){_0xaa0339[_0xe098('0x31')]=_0x11ef24;if(_0x348217[_0xe098('0x46')][_0xe098('0x55')]){_0x243667[_0xe098('0x5c')]=[{'model':db[_0xe098('0x76')],'as':_0xe098('0xbd'),'required':![]},{'model':db[_0xe098('0xa7')],'as':_0xe098('0xbe'),'attributes':['name',_0xe098('0xbf'),_0xe098('0xc0')],'required':![]},{'model':db[_0xe098('0xc1')],'as':_0xe098('0xc2'),'attributes':['id',_0xe098('0x3c'),_0xe098('0xc3')],'where':_0x348217[_0xe098('0x46')]['tag']?{'id':_0x348217[_0xe098('0x46')]['tag']}:undefined,'required':_0x348217[_0xe098('0x46')][_0xe098('0xc4')]?!![]:![]}];}return db[_0xe098('0xbc')][_0xe098('0x56')](_0x243667);})[_0xe098('0x1f')](function(_0x325b7d){_0xaa0339['rows']=_0x325b7d;return _0xaa0339;});}})[_0xe098('0x1f')](respondWithFilteredResult(_0x13f03c,_0x243667))[_0xe098('0x2a')](handleError(_0x13f03c,null));};exports['send']=function(_0x3247b5,_0x2fd047,_0x512c60){var _0x1af5f2,_0x59c3c9,_0x58ce43;if(_[_0xe098('0x8f')](_0x3247b5[_0xe098('0x5f')]['body'])||_0x3247b5['body']['body']===''){throw new db[(_0xe098('0x77'))]['ValidationError'](_0xe098('0x90'));}if(_['isNil'](_0x3247b5[_0xe098('0x5f')]['to'])){throw new db[(_0xe098('0x77'))][(_0xe098('0x92'))](_0xe098('0xc5'));}_0x1af5f2=_0x3247b5[_0xe098('0x5f')]['to'];return db[_0xe098('0x40')][_0xe098('0x5d')]({'where':{'id':_0x3247b5[_0xe098('0x59')]['id']},'include':[{'model':db[_0xe098('0x95')],'as':'List','include':[{'model':db[_0xe098('0x76')],'as':'Contacts','where':{'mobile':_0x1af5f2},'limit':0x1,'order':[['updatedAt',_0xe098('0x96')]]}]}]})[_0xe098('0x1f')](handleEntityNotFound(_0x2fd047,null))['then'](function(_0x18b739){if(_0x18b739&&_0x18b739[_0xe098('0xc6')]){_0x59c3c9=_0x18b739[_0xe098('0x39')]({'plain':!![]});if(_0x59c3c9[_0xe098('0xc6')]&&_0x59c3c9[_0xe098('0xc6')][_0xe098('0x99')][_0xe098('0x4a')]){return _0x59c3c9[_0xe098('0xc6')]['Contacts'][0x0];}return db['CmContact'][_0xe098('0x5e')](_[_0xe098('0x17')](_0x3247b5['body'],{'firstName':_0x1af5f2,'mobile':_0x1af5f2,'phone':_0x1af5f2,'ListId':_0x59c3c9['ListId']}));}})[_0xe098('0x1f')](handleEntityNotFound(_0x2fd047,null))[_0xe098('0x1f')](function(_0x1b4bf9){if(_0x1b4bf9){_0x58ce43=_0x1b4bf9;return db[_0xe098('0xbc')][_0xe098('0x5d')]({'where':{'ContactId':_0x58ce43['id'],'closed':![],'SmsAccountId':_0x59c3c9['id']}})[_0xe098('0x1f')](function(_0x7f42d7){if(_0x7f42d7){return[_0x7f42d7,![]];}return db['SmsInteraction'][_0xe098('0x5e')]({'UserId':_0x3247b5[_0xe098('0xc7')]['id'],'ContactId':_0x58ce43['id'],'SmsAccountId':_0x59c3c9['id'],'phone':_0x1af5f2,'firstMsgDirection':_0xe098('0xc8'),'Messages':[_['merge'](_0x3247b5[_0xe098('0x5f')],{'read':![],'body':_0x3247b5[_0xe098('0x5f')][_0xe098('0x5f')],'phone':_0x1af5f2,'SmsAccountId':_0x59c3c9['id'],'UserId':_0x3247b5[_0xe098('0xc7')]['id'],'ContactId':_0x58ce43['id']})]},{'include':[{'model':db[_0xe098('0xa3')],'as':'Messages'}]})[_0xe098('0x1f')](function(_0x57773d){return[_0x57773d,!![]];});});}})[_0xe098('0x9b')](function(_0x1ede64,_0x4c3251){if(_0x4c3251){return _0x1ede64;}return db[_0xe098('0xa3')][_0xe098('0x5e')](_[_0xe098('0x52')](_0x3247b5['body'],{'read':![],'body':_0x3247b5['body'][_0xe098('0x5f')],'phone':_0x1af5f2,'SmsAccountId':_0x59c3c9['id'],'SmsInteractionId':_0x1ede64['id'],'UserId':_0x3247b5['user']['id'],'ContactId':_0x58ce43['id']}))[_0xe098('0x1f')](function(_0x407552){_0x1ede64['dataValues'][_0xe098('0xc9')]=[];_0x1ede64[_0xe098('0xca')]['Messages']['push'](_0x407552[_0xe098('0xca')]);return _0x1ede64;});})['then'](respondWithResult(_0x2fd047,null))[_0xe098('0x2a')](handleError(_0x2fd047,null));};exports['status']=function(_0x666c75,_0x497b84,_0x4c9475){if(_0x666c75[_0xe098('0x5f')]['id']){delete _0x666c75['body']['id'];}var _0x566fe4,_0x24a3cb,_0x1af6ca;return db[_0xe098('0x40')]['find']({'where':{'id':_0x666c75[_0xe098('0x59')]['id']}})[_0xe098('0x1f')](handleEntityNotFound(_0x497b84,null))[_0xe098('0x1f')](function(_0x1bd027){if(_0x1bd027){_0x1af6ca=_0x1bd027;logger[_0xe098('0x23')](_0xe098('0x24'),_0xe098('0x2c'),_0xe098('0xcb'),_0x1bd027[_0xe098('0x42')],util[_0xe098('0xcc')](_0x666c75[_0xe098('0x5f')],{'showHidden':![],'depth':null}));switch(_0x1bd027[_0xe098('0x42')]){case _0xe098('0x81'):if(_0x666c75[_0xe098('0x5f')]['skebby_dispatch_id']&&_0x666c75[_0xe098('0x5f')]['status']){_0x24a3cb=_0x666c75[_0xe098('0x5f')][_0xe098('0x2c')];return db[_0xe098('0xa3')][_0xe098('0x5d')]({'where':{'messageId':_0x666c75['body'][_0xe098('0xcd')]}});}break;case'connectel':if(_0x666c75[_0xe098('0x5f')]['requestid']&&_0x666c75['body'][_0xe098('0xce')]){_0x24a3cb=_0x666c75['body'][_0xe098('0xce')];return db[_0xe098('0xa3')][_0xe098('0x5d')]({'where':{'messageId':_0x666c75[_0xe098('0x5f')][_0xe098('0xcf')]}});}break;case _0xe098('0x84'):if(_0x666c75[_0xe098('0x5f')][_0xe098('0x85')]&&_0x666c75['body'][_0xe098('0xd0')]){_0x24a3cb=_0x666c75[_0xe098('0x5f')][_0xe098('0xd0')];return db[_0xe098('0xa3')][_0xe098('0x5d')]({'where':{'messageId':_0x666c75[_0xe098('0x5f')]['message_id']}});}break;case _0xe098('0xd1'):var _0x1668f3=_0x666c75[_0xe098('0x5f')][_0xe098('0x88')][0x0];if(_0x1668f3[_0xe098('0x80')]&&_0x1668f3[_0xe098('0x2c')][_0xe098('0xd2')]===_0xe098('0xd3')){_0x24a3cb=_0x1668f3['status'][_0xe098('0xd2')];return db['SmsMessage'][_0xe098('0x5d')]({'where':{'messageId':_0x1668f3[_0xe098('0x80')]}});}break;case'clickatell':if(_0x666c75[_0xe098('0x5f')][_0xe098('0x80')]&&_0x666c75[_0xe098('0x5f')][_0xe098('0x2c')]){_0x24a3cb=_0x666c75[_0xe098('0x5f')][_0xe098('0x2c')];return db[_0xe098('0xa3')]['find']({'where':{'messageId':_0x666c75['body'][_0xe098('0x80')]}});}break;case'bandwidth':if(_0x666c75[_0xe098('0x5f')][0x0][_0xe098('0x28')]['id']){_0x24a3cb=_0x666c75[_0xe098('0x5f')][0x0][_0xe098('0x42')];return db['SmsMessage'][_0xe098('0x5d')]({'where':{'messageId':_0x666c75['body'][0x0][_0xe098('0x28')]['id']}});}break;case'intelepeer':if(_0x666c75[_0xe098('0x5f')][_0xe098('0xd4')]&&_0x666c75['body'][_0xe098('0x2c')]){_0x24a3cb=_0x666c75[_0xe098('0x5f')][_0xe098('0x2c')];return db[_0xe098('0xa3')]['find']({'where':{'messageId':_0x666c75[_0xe098('0x5f')][_0xe098('0xd4')]}});}break;}}})['then'](handleEntityNotFound(_0x497b84,null))[_0xe098('0x1f')](function(_0x4ddcc0){if(_0x4ddcc0){_0x566fe4=_0x4ddcc0;switch(_0x1af6ca[_0xe098('0x42')]){case'skebby':if(_0x24a3cb===_0xe098('0xd3')){return _0x566fe4[_0xe098('0x37')]({'read':!![]});}else{logger[_0xe098('0x26')](_0xe098('0x24'),_0xe098('0x2c'),_0xe098('0x81'),util[_0xe098('0xcc')](_0x666c75[_0xe098('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xe098('0x83'):if(_0x24a3cb==='1'){return _0x566fe4[_0xe098('0x37')]({'read':!![]});}else{logger[_0xe098('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','skebby',util[_0xe098('0xcc')](_0x666c75[_0xe098('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xe098('0x84'):if(!_0x666c75[_0xe098('0x5f')][_0xe098('0xd5')]&&_0x24a3cb>=0xc8&&_0x24a3cb<=0xce){return _0x566fe4['update']({'read':!![]});}else{logger[_0xe098('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','clicksend',util[_0xe098('0xcc')](_0x666c75[_0xe098('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xe098('0xd1'):var _0x546697=_0x666c75[_0xe098('0x5f')][_0xe098('0x88')][0x0];if(_0x546697['status'][_0xe098('0xd2')]===_0xe098('0xd3')){return _0x566fe4['update']({'read':!![]});}else{logger[_0xe098('0x26')](_0xe098('0x24'),_0xe098('0x2c'),'infobip',util[_0xe098('0xcc')](_0x666c75[_0xe098('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xe098('0x8c'):if(_0x24a3cb==_0xe098('0xd6')||_0x24a3cb==_0xe098('0xd7')){return _0x566fe4['update']({'read':!![]});}else{logger[_0xe098('0x26')](_0xe098('0x24'),_0xe098('0x2c'),_0xe098('0x8c'),util[_0xe098('0xcc')](_0x666c75[_0xe098('0x5f')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x24a3cb==_0xe098('0xd8')){return _0x566fe4['update']({'read':!![]});}else{logger[_0xe098('0x26')](_0xe098('0x24'),_0xe098('0x2c'),_0xe098('0x8e'),util[_0xe098('0xcc')](_0x666c75['body'],{'showHidden':![],'depth':null}));}break;case _0xe098('0xd9'):if(_0x24a3cb===_0xe098('0xda')||_0x24a3cb===_0xe098('0xdb')){return _0x566fe4[_0xe098('0x37')]({'read':!![]});}else{logger[_0xe098('0x26')](_0xe098('0x24'),'status',_0xe098('0xd9'),util['inspect'](_0x666c75[_0xe098('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x566fe4;}})['then'](respondWithResult(_0x497b84,null))[_0xe098('0x2a')](handleError(_0x497b84,null));};exports[_0xe098('0xdc')]=function(_0x5a23f2,_0x32366c,_0x1780fb){var _0xdd42da,_0x127f52,_0x173096;return db['SmsAccount'][_0xe098('0x5d')]({'where':{'id':_0x5a23f2['params']['id']}})[_0xe098('0x1f')](handleEntityNotFound(_0x32366c,null))['then'](function(_0x35119d){if(_0x35119d){_0x173096=_0x35119d;logger[_0xe098('0x23')](_0xe098('0x24'),'status',_0xe098('0xcb'),_0x35119d[_0xe098('0x42')],util[_0xe098('0xcc')](_0x5a23f2[_0xe098('0x46')],{'showHidden':![],'depth':null}));switch(_0x35119d[_0xe098('0x42')]){case _0xe098('0x89'):if(_0x5a23f2[_0xe098('0x46')]['message-id']&&_0x5a23f2[_0xe098('0x46')][_0xe098('0xdd')]){_0x127f52=_0x5a23f2[_0xe098('0x46')][_0xe098('0xdd')];return db[_0xe098('0xa3')]['find']({'where':{'messageId':_0x5a23f2[_0xe098('0x46')][_0xe098('0xde')]}});}break;}}})['then'](handleEntityNotFound(_0x32366c,null))['then'](function(_0x7f3d8e){if(_0x7f3d8e){_0xdd42da=_0x7f3d8e;switch(_0x173096[_0xe098('0x42')]){case _0xe098('0x89'):if(_0x127f52==='2'||_0x127f52==='6'){return _0xdd42da['update']({'read':!![]});}else{logger[_0xe098('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe098('0x2c'),_0xe098('0x89'),util['inspect'](_0x5a23f2['query'],{'showHidden':![],'depth':null}));};break;}return _0xdd42da;}})['then'](respondWithResult(_0x32366c,null))['catch'](handleError(_0x32366c,null));};exports[_0xe098('0xdf')]=function(_0x47e453,_0x234c67,_0x2e38ad){return db[_0xe098('0x40')][_0xe098('0x5d')]({'where':{'id':_0x47e453[_0xe098('0x59')]['id']}})['then'](handleEntityNotFound(_0x234c67,null))[_0xe098('0x1f')](function(_0x56f2c7){if(_0x56f2c7){return _0x56f2c7['addAgents'](_0x47e453['body'][_0xe098('0x6c')],_[_0xe098('0x98')](_0x47e453[_0xe098('0x5f')],[_0xe098('0x6c'),'id'])||{})[_0xe098('0x9b')](function(_0x1062d9){for(var _0x3424be=0x0;_0x3424be<_0x47e453[_0xe098('0x5f')][_0xe098('0x6c')]['length'];_0x3424be+=0x1){socket[_0xe098('0xe0')](_0xe098('0xe1'),{'UserId':Number(_0x47e453[_0xe098('0x5f')][_0xe098('0x6c')][_0x3424be]),'SmsAccountId':Number(_0x47e453[_0xe098('0x59')]['id'])});}return _0x1062d9;});}})[_0xe098('0x1f')](respondWithResult(_0x234c67,null))[_0xe098('0x2a')](handleError(_0x234c67,null));};exports[_0xe098('0xe2')]=function(_0x57baee,_0x38b9bd,_0x3905da){return db['SmsAccount'][_0xe098('0x5d')]({'where':{'id':_0x57baee[_0xe098('0x59')]['id']}})[_0xe098('0x1f')](handleEntityNotFound(_0x38b9bd,null))['then'](function(_0xbf39dc){if(_0xbf39dc){return _0xbf39dc[_0xe098('0xe2')](_0x57baee[_0xe098('0x46')][_0xe098('0x6c')])[_0xe098('0x1f')](function(){if(_[_0xe098('0xe3')](_0x57baee[_0xe098('0x46')][_0xe098('0x6c')])){for(var _0x358671=0x0;_0x358671<_0x57baee[_0xe098('0x46')]['ids'][_0xe098('0x4a')];_0x358671+=0x1){socket[_0xe098('0xe0')]('userSmsAccount:remove',{'UserId':Number(_0x57baee['query'][_0xe098('0x6c')][_0x358671]),'SmsAccountId':Number(_0x57baee[_0xe098('0x59')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x57baee['query'][_0xe098('0x6c')]),'SmsAccountId':Number(_0x57baee[_0xe098('0x59')]['id'])});}});}})[_0xe098('0x1f')](respondWithStatusCode(_0x38b9bd,null))[_0xe098('0x2a')](handleError(_0x38b9bd,null));};exports[_0xe098('0xe4')]=function(_0x572e32,_0x363ae3,_0x138e1c){var _0x333975={};var _0x498496={};var _0x356344;var _0x44128b;return db[_0xe098('0x40')][_0xe098('0xbb')]({'where':{'id':_0x572e32['params']['id']}})[_0xe098('0x1f')](handleEntityNotFound(_0x363ae3,null))['then'](function(_0x8a0d39){if(_0x8a0d39){_0x356344=_0x8a0d39;_0x498496[_0xe098('0x43')]=_[_0xe098('0x45')](db[_0xe098('0xa7')]['rawAttributes']);_0x498496[_0xe098('0x46')]=_[_0xe098('0x45')](_0x572e32['query']);_0x498496[_0xe098('0x4f')]=_[_0xe098('0x48')](_0x498496[_0xe098('0x43')],_0x498496['query']);_0x333975[_0xe098('0x47')]=_[_0xe098('0x48')](_0x498496[_0xe098('0x43')],qs[_0xe098('0x49')](_0x572e32['query'][_0xe098('0x49')]));_0x333975[_0xe098('0x47')]=_0x333975[_0xe098('0x47')][_0xe098('0x4a')]?_0x333975['attributes']:_0x498496[_0xe098('0x43')];_0x333975[_0xe098('0x6f')]=qs[_0xe098('0x4d')](_0x572e32[_0xe098('0x46')][_0xe098('0x4d')]);_0x333975[_0xe098('0x4e')]=qs['filters'](_['pick'](_0x572e32[_0xe098('0x46')],_0x498496[_0xe098('0x4f')]));if(_0x572e32['query'][_0xe098('0x51')]){_0x333975[_0xe098('0x4e')]=_[_0xe098('0x52')](_0x333975[_0xe098('0x4e')],{'$or':_[_0xe098('0x44')](_0x333975[_0xe098('0x47')],function(_0x3b5e57){var _0x11a7d9={};_0x11a7d9[_0x3b5e57]={'$like':'%'+_0x572e32['query'][_0xe098('0x51')]+'%'};return _0x11a7d9;})});}_0x333975=_[_0xe098('0x52')]({},_0x333975,_0x572e32[_0xe098('0x54')]);return _0x356344[_0xe098('0xe4')](_0x333975);}})[_0xe098('0x1f')](function(_0x1e53d6){if(_0x1e53d6){_0x44128b=_0x1e53d6[_0xe098('0x4a')];if(!_0x572e32[_0xe098('0x46')]['hasOwnProperty'](_0xe098('0x4c'))){_0x333975[_0xe098('0x30')]=qs[_0xe098('0x30')](_0x572e32[_0xe098('0x46')][_0xe098('0x30')]);_0x333975[_0xe098('0x32')]=qs['offset'](_0x572e32[_0xe098('0x46')][_0xe098('0x32')]);}return _0x356344['getAgents'](_0x333975);}})[_0xe098('0x1f')](function(_0x4c5885){if(_0x4c5885){return _0x4c5885?{'count':_0x44128b,'rows':_0x4c5885}:null;}})[_0xe098('0x1f')](respondWithResult(_0x363ae3,null))[_0xe098('0x2a')](handleError(_0x363ae3,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 9916ea1..3ebc0df 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 _0xa8c7=['../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x24ad71,_0x40f3a4){var _0x33c66a=function(_0x120213){while(--_0x120213){_0x24ad71['push'](_0x24ad71['shift']());}};_0x33c66a(++_0x40f3a4);}(_0xa8c7,0x19a));var _0x7a8c=function(_0x312af7,_0x58604c){_0x312af7=_0x312af7-0x0;var _0x54c56e=_0xa8c7[_0x312af7];return _0x54c56e;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x7a8c('0x0'))['db'][_0x7a8c('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x7a8c('0x2')](0x0);var events={'afterCreate':_0x7a8c('0x3'),'afterUpdate':_0x7a8c('0x4'),'afterDestroy':_0x7a8c('0x5')};function emitEvent(_0xafcbf1){return function(_0x47c343,_0x31e17d,_0x35f18d){SmsAccountEvents[_0x7a8c('0x6')](_0xafcbf1+':'+_0x47c343['id'],_0x47c343);SmsAccountEvents[_0x7a8c('0x6')](_0xafcbf1,_0x47c343);_0x35f18d(null);};}for(var e in events){if(events[_0x7a8c('0x7')](e)){var event=events[e];SmsAccount[_0x7a8c('0x8')](e,emitEvent(event));}}module[_0x7a8c('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0xd228=['events','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2f63a3,_0x23453d){var _0x2b2a22=function(_0x5b1357){while(--_0x5b1357){_0x2f63a3['push'](_0x2f63a3['shift']());}};_0x2b2a22(++_0x23453d);}(_0xd228,0x1c2));var _0x8d22=function(_0x35b87c,_0x166a8c){_0x35b87c=_0x35b87c-0x0;var _0x24795b=_0xd228[_0x35b87c];return _0x24795b;};'use strict';var EventEmitter=require(_0x8d22('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x8d22('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x8d22('0x2')](0x0);var events={'afterCreate':_0x8d22('0x3'),'afterUpdate':_0x8d22('0x4'),'afterDestroy':_0x8d22('0x5')};function emitEvent(_0x4b5fce){return function(_0x11702e,_0x41bb65,_0x5b1f16){SmsAccountEvents[_0x8d22('0x6')](_0x4b5fce+':'+_0x11702e['id'],_0x11702e);SmsAccountEvents[_0x8d22('0x6')](_0x4b5fce,_0x11702e);_0x5b1f16(null);};}for(var e in events){if(events[_0x8d22('0x7')](e)){var event=events[e];SmsAccount[_0x8d22('0x8')](e,emitEvent(event));}}module[_0x8d22('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index d3864bc..8618638 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 _0x1eee=['path','../../config/environment','./smsAccount.attributes','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5cf8ff,_0x5e8627){var _0x2c37e6=function(_0x450cd4){while(--_0x450cd4){_0x5cf8ff['push'](_0x5cf8ff['shift']());}};_0x2c37e6(++_0x5e8627);}(_0x1eee,0x162));var _0xe1ee=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x1eee[_0xa6cc5c];return _0x44803d;};'use strict';var _=require(_0xe1ee('0x0'));var util=require(_0xe1ee('0x1'));var logger=require(_0xe1ee('0x2'))(_0xe1ee('0x3'));var moment=require(_0xe1ee('0x4'));var BPromise=require(_0xe1ee('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe1ee('0x6'));var rimraf=require('rimraf');var config=require(_0xe1ee('0x7'));var attributes=require(_0xe1ee('0x8'));module['exports']=function(_0x18b965,_0x3dc5d6){return _0x18b965[_0xe1ee('0x9')](_0xe1ee('0xa'),attributes,{'tableName':_0xe1ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13ac=['api','moment','bluebird','request-promise','path','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util'];(function(_0x2122da,_0x3e0d3b){var _0x4b8adc=function(_0x44d842){while(--_0x44d842){_0x2122da['push'](_0x2122da['shift']());}};_0x4b8adc(++_0x3e0d3b);}(_0x13ac,0xfa));var _0xc13a=function(_0x511457,_0x1d891c){_0x511457=_0x511457-0x0;var _0x29d138=_0x13ac[_0x511457];return _0x29d138;};'use strict';var _=require(_0xc13a('0x0'));var util=require(_0xc13a('0x1'));var logger=require('../../config/logger')(_0xc13a('0x2'));var moment=require(_0xc13a('0x3'));var BPromise=require(_0xc13a('0x4'));var rp=require(_0xc13a('0x5'));var fs=require('fs');var path=require(_0xc13a('0x6'));var rimraf=require('rimraf');var config=require(_0xc13a('0x7'));var attributes=require(_0xc13a('0x8'));module[_0xc13a('0x9')]=function(_0x289d4d,_0xd8f7af){return _0x289d4d[_0xc13a('0xa')](_0xc13a('0xb'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index b4afa6f..580d54c 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 _0xefe2=['result','catch','ShowSmsAccount','SmsAccount','find','options','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent'];(function(_0x16e87d,_0x1efd3b){var _0x12a89e=function(_0x16dd4e){while(--_0x16dd4e){_0x16e87d['push'](_0x16e87d['shift']());}};_0x12a89e(++_0x1efd3b);}(_0xefe2,0x10e));var _0x2efe=function(_0x2decbd,_0x560f03){_0x2decbd=_0x2decbd-0x0;var _0x1ace10=_0xefe2[_0x2decbd];return _0x1ace10;};'use strict';var _=require(_0x2efe('0x0'));var util=require(_0x2efe('0x1'));var moment=require(_0x2efe('0x2'));var BPromise=require(_0x2efe('0x3'));var rs=require(_0x2efe('0x4'));var fs=require('fs');var Redis=require(_0x2efe('0x5'));var db=require(_0x2efe('0x6'))['db'];var utils=require(_0x2efe('0x7'));var logger=require(_0x2efe('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2efe('0x9'));var client=jayson[_0x2efe('0xa')][_0x2efe('0xb')]({'port':0x232a});config[_0x2efe('0xc')]=_[_0x2efe('0xd')](config[_0x2efe('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x2efe('0xe'))(new Redis(config['redis']));require(_0x2efe('0xf'))[_0x2efe('0x10')](socket);function respondWithRpcPromise(_0x554ced,_0x67f943,_0xbc6a22){return new BPromise(function(_0x33e549,_0x369755){return client[_0x2efe('0x11')](_0x554ced,_0xbc6a22)[_0x2efe('0x12')](function(_0x570b66){logger['info'](_0x2efe('0x13'),_0x67f943,'request\x20sent');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x67f943,'request\x20sent',JSON[_0x2efe('0x14')](_0x570b66));if(_0x570b66[_0x2efe('0x15')]){if(_0x570b66['error'][_0x2efe('0x16')]===0x1f4){logger[_0x2efe('0x15')]('SmsAccount,\x20%s,\x20%s',_0x67f943,_0x570b66[_0x2efe('0x15')][_0x2efe('0x17')]);return _0x369755(_0x570b66['error']['message']);}logger[_0x2efe('0x15')](_0x2efe('0x13'),_0x67f943,_0x570b66['error'][_0x2efe('0x17')]);return _0x33e549(_0x570b66['error'][_0x2efe('0x17')]);}else{logger[_0x2efe('0x18')](_0x2efe('0x13'),_0x67f943,_0x2efe('0x19'));_0x33e549(_0x570b66[_0x2efe('0x1a')][_0x2efe('0x17')]);}})[_0x2efe('0x1b')](function(_0x55c70e){logger[_0x2efe('0x15')](_0x2efe('0x13'),_0x67f943,_0x55c70e);_0x369755(_0x55c70e);});});}exports[_0x2efe('0x1c')]=function(_0x5d3f90){var _0x4b5d16=this;return new Promise(function(_0x2870ad,_0x5a3b9c){return db[_0x2efe('0x1d')][_0x2efe('0x1e')]({'raw':_0x5d3f90[_0x2efe('0x1f')]?_0x5d3f90[_0x2efe('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x5d3f90[_0x2efe('0x1f')]?_0x5d3f90[_0x2efe('0x1f')][_0x2efe('0x20')]||null:null,'attributes':_0x5d3f90[_0x2efe('0x1f')]?_0x5d3f90[_0x2efe('0x1f')][_0x2efe('0x21')]||null:null,'include':_0x5d3f90[_0x2efe('0x1f')]?_0x5d3f90[_0x2efe('0x1f')][_0x2efe('0x22')]?_[_0x2efe('0x23')](_0x5d3f90[_0x2efe('0x1f')][_0x2efe('0x22')],function(_0x44de5d){return{'model':db[_0x44de5d[_0x2efe('0x24')]],'as':_0x44de5d['as'],'attributes':_0x44de5d[_0x2efe('0x21')],'include':_0x44de5d['include']?_['map'](_0x44de5d[_0x2efe('0x22')],function(_0x4cfa78){return{'model':db[_0x4cfa78[_0x2efe('0x24')]],'as':_0x4cfa78['as'],'attributes':_0x4cfa78[_0x2efe('0x21')],'include':_0x4cfa78[_0x2efe('0x22')]?_[_0x2efe('0x23')](_0x4cfa78[_0x2efe('0x22')],function(_0x23454f){return{'model':db[_0x23454f[_0x2efe('0x24')]],'as':_0x23454f['as'],'attributes':_0x23454f[_0x2efe('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa550d9){logger[_0x2efe('0x18')](_0x2efe('0x1c'),_0x5d3f90);logger['debug'](_0x2efe('0x1c'),_0x5d3f90,JSON[_0x2efe('0x14')](_0xa550d9));_0x2870ad(_0xa550d9);})[_0x2efe('0x1b')](function(_0x55758a){logger[_0x2efe('0x15')](_0x2efe('0x1c'),_0x55758a[_0x2efe('0x17')],_0x5d3f90);_0x5a3b9c(_0x4b5d16['error'](0x1f4,_0x55758a['message']));});});}; \ No newline at end of file +var _0xc5b3=['bluebird','randomstring','ioredis','../../config/logger','client','http','redis','defaults','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','include','model','attributes','lodash','util'];(function(_0x163f5d,_0x2b8dea){var _0x80de1e=function(_0x4bf8dc){while(--_0x4bf8dc){_0x163f5d['push'](_0x163f5d['shift']());}};_0x80de1e(++_0x2b8dea);}(_0xc5b3,0xa3));var _0x3c5b=function(_0x50cd41,_0x4874a7){_0x50cd41=_0x50cd41-0x0;var _0x399475=_0xc5b3[_0x50cd41];return _0x399475;};'use strict';var _=require(_0x3c5b('0x0'));var util=require(_0x3c5b('0x1'));var moment=require('moment');var BPromise=require(_0x3c5b('0x2'));var rs=require(_0x3c5b('0x3'));var fs=require('fs');var Redis=require(_0x3c5b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3c5b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3c5b('0x6')][_0x3c5b('0x7')]({'port':0x232a});config[_0x3c5b('0x8')]=_[_0x3c5b('0x9')](config[_0x3c5b('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x3c5b('0xa'))(new Redis(config[_0x3c5b('0x8')]));require(_0x3c5b('0xb'))[_0x3c5b('0xc')](socket);function respondWithRpcPromise(_0x320641,_0x2948e3,_0x56f7d1){return new BPromise(function(_0x3af39f,_0x59b196){return client['request'](_0x320641,_0x56f7d1)[_0x3c5b('0xd')](function(_0x26a080){logger[_0x3c5b('0xe')](_0x3c5b('0xf'),_0x2948e3,_0x3c5b('0x10'));logger[_0x3c5b('0x11')](_0x3c5b('0x12'),_0x2948e3,_0x3c5b('0x10'),JSON[_0x3c5b('0x13')](_0x26a080));if(_0x26a080[_0x3c5b('0x14')]){if(_0x26a080[_0x3c5b('0x14')][_0x3c5b('0x15')]===0x1f4){logger[_0x3c5b('0x14')](_0x3c5b('0xf'),_0x2948e3,_0x26a080['error'][_0x3c5b('0x16')]);return _0x59b196(_0x26a080[_0x3c5b('0x14')][_0x3c5b('0x16')]);}logger[_0x3c5b('0x14')]('SmsAccount,\x20%s,\x20%s',_0x2948e3,_0x26a080[_0x3c5b('0x14')]['message']);return _0x3af39f(_0x26a080[_0x3c5b('0x14')][_0x3c5b('0x16')]);}else{logger[_0x3c5b('0xe')](_0x3c5b('0xf'),_0x2948e3,_0x3c5b('0x10'));_0x3af39f(_0x26a080['result'][_0x3c5b('0x16')]);}})[_0x3c5b('0x17')](function(_0xf3ea8e){logger[_0x3c5b('0x14')]('SmsAccount,\x20%s,\x20%s',_0x2948e3,_0xf3ea8e);_0x59b196(_0xf3ea8e);});});}exports[_0x3c5b('0x18')]=function(_0x57d10a){var _0x1c1f36=this;return new Promise(function(_0x24420a,_0x11e415){return db[_0x3c5b('0x19')][_0x3c5b('0x1a')]({'raw':_0x57d10a[_0x3c5b('0x1b')]?_0x57d10a[_0x3c5b('0x1b')][_0x3c5b('0x1c')]===undefined?!![]:![]:!![],'where':_0x57d10a[_0x3c5b('0x1b')]?_0x57d10a[_0x3c5b('0x1b')][_0x3c5b('0x1d')]||null:null,'attributes':_0x57d10a['options']?_0x57d10a[_0x3c5b('0x1b')]['attributes']||null:null,'include':_0x57d10a['options']?_0x57d10a[_0x3c5b('0x1b')][_0x3c5b('0x1e')]?_['map'](_0x57d10a[_0x3c5b('0x1b')][_0x3c5b('0x1e')],function(_0x2ae4a2){return{'model':db[_0x2ae4a2[_0x3c5b('0x1f')]],'as':_0x2ae4a2['as'],'attributes':_0x2ae4a2[_0x3c5b('0x20')],'include':_0x2ae4a2[_0x3c5b('0x1e')]?_['map'](_0x2ae4a2[_0x3c5b('0x1e')],function(_0x2a0f59){return{'model':db[_0x2a0f59[_0x3c5b('0x1f')]],'as':_0x2a0f59['as'],'attributes':_0x2a0f59[_0x3c5b('0x20')],'include':_0x2a0f59['include']?_['map'](_0x2a0f59['include'],function(_0x3fba50){return{'model':db[_0x3fba50['model']],'as':_0x3fba50['as'],'attributes':_0x3fba50[_0x3c5b('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2de444){logger[_0x3c5b('0xe')]('ShowSmsAccount',_0x57d10a);logger[_0x3c5b('0x11')](_0x3c5b('0x18'),_0x57d10a,JSON[_0x3c5b('0x13')](_0x2de444));_0x24420a(_0x2de444);})[_0x3c5b('0x17')](function(_0x1210f1){logger[_0x3c5b('0x14')](_0x3c5b('0x18'),_0x1210f1['message'],_0x57d10a);_0x11e415(_0x1c1f36['error'](0x1f4,_0x1210f1[_0x3c5b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 668fbfe..4735303 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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 5af14b1..84a1c89 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 _0xe14b=['/:id','create','put','exports','multer','util','express','Router','../../components/auth/service','./smsApplication.controller','get','isAuthenticated','index'];(function(_0x5a7446,_0x58c954){var _0x2a164a=function(_0x11a0f5){while(--_0x11a0f5){_0x5a7446['push'](_0x5a7446['shift']());}};_0x2a164a(++_0x58c954);}(_0xe14b,0x93));var _0xbe14=function(_0x41e1ed,_0x1e4ed2){_0x41e1ed=_0x41e1ed-0x0;var _0x3d14b1=_0xe14b[_0x41e1ed];return _0x3d14b1;};'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['post']('/',auth['isAuthenticated'](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router['delete'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['destroy']);module[_0xbe14('0xc')]=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(_0x519ea7,_0x26a415){var _0x2b5043=function(_0x180324){while(--_0x180324){_0x519ea7['push'](_0x519ea7['shift']());}};_0x2b5043(++_0x26a415);}(_0x34e8,0x12c));var _0x834e=function(_0x4c8439,_0x503791){_0x4c8439=_0x4c8439-0x0;var _0x16597e=_0x34e8[_0x4c8439];return _0x16597e;};'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 1cb2039..733ed95 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 _0x1580=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0x11872a,_0x186205){var _0x46b427=function(_0x4bb196){while(--_0x4bb196){_0x11872a['push'](_0x11872a['shift']());}};_0x46b427(++_0x186205);}(_0x1580,0x93));var _0x0158=function(_0x108e0e,_0xe8fd31){_0x108e0e=_0x108e0e-0x0;var _0x11166b=_0x1580[_0x108e0e];return _0x11166b;};'use strict';var Sequelize=require(_0x0158('0x0'));module[_0x0158('0x1')]={'priority':{'type':Sequelize[_0x0158('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0158('0x3')],'allowNull':![],'defaultValue':_0x0158('0x4')},'appdata':{'type':Sequelize[_0x0158('0x5')]()},'description':{'type':Sequelize[_0x0158('0x3')]},'interval':{'type':Sequelize[_0x0158('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x064b=['TEXT','sequelize','exports','STRING','noop'];(function(_0xff66e3,_0x5083e3){var _0xa45719=function(_0x2d31ee){while(--_0x2d31ee){_0xff66e3['push'](_0xff66e3['shift']());}};_0xa45719(++_0x5083e3);}(_0x064b,0xa6));var _0xb064=function(_0x46622b,_0x39c3ef){_0x46622b=_0x46622b-0x0;var _0x3835eb=_0x064b[_0x46622b];return _0x3835eb;};'use strict';var Sequelize=require(_0xb064('0x0'));module[_0xb064('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb064('0x2')],'allowNull':![],'defaultValue':_0xb064('0x3')},'appdata':{'type':Sequelize[_0xb064('0x4')]()},'description':{'type':Sequelize[_0xb064('0x2')]},'interval':{'type':Sequelize[_0xb064('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index fd9ea68..00abf68 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 _0xfa41=['set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa41,0xc3));var _0x1fa4=function(_0x907c3d,_0x1e8850){_0x907c3d=_0x907c3d-0x0;var _0x16684c=_0xfa41[_0x907c3d];return _0x16684c;};'use strict';var emlformat=require(_0x1fa4('0x0'));var rimraf=require(_0x1fa4('0x1'));var zipdir=require(_0x1fa4('0x2'));var jsonpatch=require(_0x1fa4('0x3'));var rp=require(_0x1fa4('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1fa4('0x5'));var util=require('util');var path=require(_0x1fa4('0x6'));var sox=require(_0x1fa4('0x7'));var csv=require(_0x1fa4('0x8'));var ejs=require(_0x1fa4('0x9'));var fs=require('fs');var fs_extra=require(_0x1fa4('0xa'));var _=require('lodash');var squel=require(_0x1fa4('0xb'));var crypto=require(_0x1fa4('0xc'));var jsforce=require(_0x1fa4('0xd'));var deskjs=require(_0x1fa4('0xe'));var toCsv=require(_0x1fa4('0x8'));var querystring=require(_0x1fa4('0xf'));var Papa=require(_0x1fa4('0x10'));var Redis=require('ioredis');var authService=require(_0x1fa4('0x11'));var qs=require(_0x1fa4('0x12'));var as=require(_0x1fa4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1fa4('0x14'))(_0x1fa4('0x15'));var utils=require('../../config/utils');var config=require(_0x1fa4('0x16'));var licenseUtil=require(_0x1fa4('0x17'));var db=require(_0x1fa4('0x18'))['db'];function respondWithStatusCode(_0x404035,_0x30dda1){_0x30dda1=_0x30dda1||0xcc;return function(_0x16d2c4){if(_0x16d2c4){return _0x404035[_0x1fa4('0x19')](_0x30dda1);}return _0x404035[_0x1fa4('0x1a')](_0x30dda1)[_0x1fa4('0x1b')]();};}function respondWithResult(_0x3819f9,_0x17e753){_0x17e753=_0x17e753||0xc8;return function(_0x11a859){if(_0x11a859){return _0x3819f9['status'](_0x17e753)[_0x1fa4('0x1c')](_0x11a859);}};}function respondWithFilteredResult(_0x47fd6a,_0x2f99c2){return function(_0x12f51e){if(_0x12f51e){var _0x52817f=typeof _0x2f99c2['offset']===_0x1fa4('0x1d')&&typeof _0x2f99c2['limit']===_0x1fa4('0x1d');var _0x160f9b=_0x12f51e['count'];var _0xdb5c50=_0x52817f?0x0:_0x2f99c2[_0x1fa4('0x1e')];var _0x11d99c=_0x52817f?_0x12f51e[_0x1fa4('0x1f')]:_0x2f99c2[_0x1fa4('0x1e')]+_0x2f99c2[_0x1fa4('0x20')];var _0x2cb058;if(_0x11d99c>=_0x160f9b){_0x11d99c=_0x160f9b;_0x2cb058=0xc8;}else{_0x2cb058=0xce;}_0x47fd6a[_0x1fa4('0x1a')](_0x2cb058);return _0x47fd6a[_0x1fa4('0x21')](_0x1fa4('0x22'),_0xdb5c50+'-'+_0x11d99c+'/'+_0x160f9b)[_0x1fa4('0x1c')](_0x12f51e);}return null;};}function patchUpdates(_0x4602e4){return function(_0x1fbeb8){try{jsonpatch[_0x1fa4('0x23')](_0x1fbeb8,_0x4602e4,!![]);}catch(_0x4d51bc){return BPromise['reject'](_0x4d51bc);}return _0x1fbeb8[_0x1fa4('0x24')]();};}function saveUpdates(_0x76e949,_0x998dc5){return function(_0x182add){if(_0x182add){return _0x182add[_0x1fa4('0x25')](_0x76e949)[_0x1fa4('0x26')](function(_0x21e5ce){return _0x21e5ce;});}return null;};}function removeEntity(_0x30ad38,_0x33305d){return function(_0x22bea5){if(_0x22bea5){return _0x22bea5[_0x1fa4('0x27')]()[_0x1fa4('0x26')](function(){_0x30ad38[_0x1fa4('0x1a')](0xcc)[_0x1fa4('0x1b')]();});}};}function handleEntityNotFound(_0x24daf2,_0x15c833){return function(_0x381311){if(!_0x381311){_0x24daf2[_0x1fa4('0x19')](0x194);}return _0x381311;};}function handleError(_0x58230c,_0x1ac02c){_0x1ac02c=_0x1ac02c||0x1f4;return function(_0x4e516a){logger['error'](_0x4e516a[_0x1fa4('0x28')]);if(_0x4e516a[_0x1fa4('0x29')]){delete _0x4e516a['name'];}_0x58230c[_0x1fa4('0x1a')](_0x1ac02c)[_0x1fa4('0x2a')](_0x4e516a);};}exports[_0x1fa4('0x2b')]=function(_0x39a8a1,_0x374572){var _0x224fcf={},_0x5c2872={},_0x3e7568={'count':0x0,'rows':[]};var _0x5608d4=_[_0x1fa4('0x2c')](db[_0x1fa4('0x2d')][_0x1fa4('0x2e')],function(_0x13dd65){return{'name':_0x13dd65[_0x1fa4('0x2f')],'type':_0x13dd65[_0x1fa4('0x30')][_0x1fa4('0x31')]};});_0x5c2872[_0x1fa4('0x32')]=_['map'](_0x5608d4,'name');_0x5c2872[_0x1fa4('0x33')]=_[_0x1fa4('0x34')](_0x39a8a1[_0x1fa4('0x33')]);_0x5c2872['filters']=_[_0x1fa4('0x35')](_0x5c2872[_0x1fa4('0x32')],_0x5c2872[_0x1fa4('0x33')]);_0x224fcf[_0x1fa4('0x36')]=_[_0x1fa4('0x35')](_0x5c2872[_0x1fa4('0x32')],qs['fields'](_0x39a8a1[_0x1fa4('0x33')][_0x1fa4('0x37')]));_0x224fcf[_0x1fa4('0x36')]=_0x224fcf[_0x1fa4('0x36')][_0x1fa4('0x38')]?_0x224fcf[_0x1fa4('0x36')]:_0x5c2872['model'];if(!_0x39a8a1[_0x1fa4('0x33')][_0x1fa4('0x39')](_0x1fa4('0x3a'))){_0x224fcf[_0x1fa4('0x20')]=qs[_0x1fa4('0x20')](_0x39a8a1[_0x1fa4('0x33')][_0x1fa4('0x20')]);_0x224fcf['offset']=qs[_0x1fa4('0x1e')](_0x39a8a1[_0x1fa4('0x33')][_0x1fa4('0x1e')]);}_0x224fcf[_0x1fa4('0x3b')]=qs[_0x1fa4('0x3c')](_0x39a8a1['query'][_0x1fa4('0x3c')]);_0x224fcf[_0x1fa4('0x3d')]=qs[_0x1fa4('0x3e')](_[_0x1fa4('0x3f')](_0x39a8a1[_0x1fa4('0x33')],_0x5c2872[_0x1fa4('0x3e')]),_0x5608d4);if(_0x39a8a1['query'][_0x1fa4('0x40')]){_0x224fcf['where']=_[_0x1fa4('0x41')](_0x224fcf[_0x1fa4('0x3d')],{'$or':_[_0x1fa4('0x2c')](_0x5608d4,function(_0x5c4656){if(_0x5c4656[_0x1fa4('0x30')]!==_0x1fa4('0x42')){var _0x4c7ce0={};_0x4c7ce0[_0x5c4656['name']]={'$like':'%'+_0x39a8a1['query'][_0x1fa4('0x40')]+'%'};return _0x4c7ce0;}})});}_0x224fcf=_[_0x1fa4('0x41')]({},_0x224fcf,_0x39a8a1['options']);var _0x1f7634={'where':_0x224fcf[_0x1fa4('0x3d')]};return db[_0x1fa4('0x2d')]['count'](_0x1f7634)[_0x1fa4('0x26')](function(_0x2151d2){_0x3e7568[_0x1fa4('0x1f')]=_0x2151d2;if(_0x39a8a1[_0x1fa4('0x33')][_0x1fa4('0x43')]){_0x224fcf['include']=[{'all':!![]}];}return db['SmsApplication'][_0x1fa4('0x44')](_0x224fcf);})[_0x1fa4('0x26')](function(_0x1f1488){_0x3e7568['rows']=_0x1f1488;return _0x3e7568;})[_0x1fa4('0x26')](respondWithFilteredResult(_0x374572,_0x224fcf))[_0x1fa4('0x45')](handleError(_0x374572,null));};exports[_0x1fa4('0x46')]=function(_0xc52271,_0x40c84e){var _0x397e8b={'raw':!![],'where':{'id':_0xc52271[_0x1fa4('0x47')]['id']}},_0xa305c4={};_0xa305c4['model']=_[_0x1fa4('0x34')](db[_0x1fa4('0x2d')]['rawAttributes']);_0xa305c4[_0x1fa4('0x33')]=_['keys'](_0xc52271['query']);_0xa305c4[_0x1fa4('0x3e')]=_[_0x1fa4('0x35')](_0xa305c4[_0x1fa4('0x32')],_0xa305c4[_0x1fa4('0x33')]);_0x397e8b[_0x1fa4('0x36')]=_[_0x1fa4('0x35')](_0xa305c4[_0x1fa4('0x32')],qs[_0x1fa4('0x37')](_0xc52271[_0x1fa4('0x33')]['fields']));_0x397e8b['attributes']=_0x397e8b[_0x1fa4('0x36')]['length']?_0x397e8b['attributes']:_0xa305c4[_0x1fa4('0x32')];if(_0xc52271[_0x1fa4('0x33')]['includeAll']){_0x397e8b['include']=[{'all':!![]}];}_0x397e8b=_[_0x1fa4('0x41')]({},_0x397e8b,_0xc52271[_0x1fa4('0x48')]);return db[_0x1fa4('0x2d')]['find'](_0x397e8b)[_0x1fa4('0x26')](handleEntityNotFound(_0x40c84e,null))[_0x1fa4('0x26')](respondWithResult(_0x40c84e,null))[_0x1fa4('0x45')](handleError(_0x40c84e,null));};exports[_0x1fa4('0x49')]=function(_0x27d976,_0x4687e0){return db[_0x1fa4('0x2d')][_0x1fa4('0x49')](_0x27d976[_0x1fa4('0x4a')],{})[_0x1fa4('0x26')](respondWithResult(_0x4687e0,0xc9))['catch'](handleError(_0x4687e0,null));};exports[_0x1fa4('0x25')]=function(_0x5dd739,_0x2277c3){if(_0x5dd739['body']['id']){delete _0x5dd739[_0x1fa4('0x4a')]['id'];}return db[_0x1fa4('0x2d')][_0x1fa4('0x4b')]({'where':{'id':_0x5dd739[_0x1fa4('0x47')]['id']}})[_0x1fa4('0x26')](handleEntityNotFound(_0x2277c3,null))[_0x1fa4('0x26')](saveUpdates(_0x5dd739[_0x1fa4('0x4a')],null))[_0x1fa4('0x26')](respondWithResult(_0x2277c3,null))['catch'](handleError(_0x2277c3,null));};exports[_0x1fa4('0x27')]=function(_0x1bb8d9,_0x10a596){return db['SmsApplication'][_0x1fa4('0x4b')]({'where':{'id':_0x1bb8d9[_0x1fa4('0x47')]['id']}})[_0x1fa4('0x26')](handleEntityNotFound(_0x10a596,null))[_0x1fa4('0x26')](removeEntity(_0x10a596,null))['catch'](handleError(_0x10a596,null));}; \ No newline at end of file +var _0xc860=['include','rows','catch','show','params','rawAttributes','fields','length','options','create','update','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','name','send','index','SmsApplication','fieldName','model','map','query','keys','intersection','attributes','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc860,0x17a));var _0x0c86=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xc860[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x0c86('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0c86('0x1'));var jsonpatch=require(_0x0c86('0x2'));var rp=require(_0x0c86('0x3'));var moment=require(_0x0c86('0x4'));var BPromise=require(_0x0c86('0x5'));var Mustache=require(_0x0c86('0x6'));var util=require(_0x0c86('0x7'));var path=require(_0x0c86('0x8'));var sox=require(_0x0c86('0x9'));var csv=require(_0x0c86('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c86('0xb'));var _=require(_0x0c86('0xc'));var squel=require(_0x0c86('0xd'));var crypto=require('crypto');var jsforce=require(_0x0c86('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0c86('0xa'));var querystring=require(_0x0c86('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0c86('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0c86('0x11'));var hardwareService=require(_0x0c86('0x12'));var logger=require(_0x0c86('0x13'))(_0x0c86('0x14'));var utils=require(_0x0c86('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0c86('0x16'));var db=require(_0x0c86('0x17'))['db'];function respondWithStatusCode(_0x18cbba,_0x5e8bc9){_0x5e8bc9=_0x5e8bc9||0xcc;return function(_0x4fc106){if(_0x4fc106){return _0x18cbba[_0x0c86('0x18')](_0x5e8bc9);}return _0x18cbba[_0x0c86('0x19')](_0x5e8bc9)[_0x0c86('0x1a')]();};}function respondWithResult(_0x5e87dd,_0x5b716b){_0x5b716b=_0x5b716b||0xc8;return function(_0xad8a2a){if(_0xad8a2a){return _0x5e87dd['status'](_0x5b716b)[_0x0c86('0x1b')](_0xad8a2a);}};}function respondWithFilteredResult(_0x17f071,_0x5a76cb){return function(_0x3450b1){if(_0x3450b1){var _0x4311c1=typeof _0x5a76cb[_0x0c86('0x1c')]===_0x0c86('0x1d')&&typeof _0x5a76cb[_0x0c86('0x1e')]==='undefined';var _0x567af7=_0x3450b1[_0x0c86('0x1f')];var _0x16f64b=_0x4311c1?0x0:_0x5a76cb['offset'];var _0x458f45=_0x4311c1?_0x3450b1['count']:_0x5a76cb[_0x0c86('0x1c')]+_0x5a76cb[_0x0c86('0x1e')];var _0x102ebe;if(_0x458f45>=_0x567af7){_0x458f45=_0x567af7;_0x102ebe=0xc8;}else{_0x102ebe=0xce;}_0x17f071[_0x0c86('0x19')](_0x102ebe);return _0x17f071[_0x0c86('0x20')]('Content-Range',_0x16f64b+'-'+_0x458f45+'/'+_0x567af7)[_0x0c86('0x1b')](_0x3450b1);}return null;};}function patchUpdates(_0xa94106){return function(_0x8e7aa2){try{jsonpatch[_0x0c86('0x21')](_0x8e7aa2,_0xa94106,!![]);}catch(_0x1fd0ae){return BPromise[_0x0c86('0x22')](_0x1fd0ae);}return _0x8e7aa2[_0x0c86('0x23')]();};}function saveUpdates(_0x114d98,_0x56f032){return function(_0x312c98){if(_0x312c98){return _0x312c98['update'](_0x114d98)[_0x0c86('0x24')](function(_0x3ed6ed){return _0x3ed6ed;});}return null;};}function removeEntity(_0x145904,_0x59fb50){return function(_0xcc818d){if(_0xcc818d){return _0xcc818d[_0x0c86('0x25')]()[_0x0c86('0x24')](function(){_0x145904[_0x0c86('0x19')](0xcc)[_0x0c86('0x1a')]();});}};}function handleEntityNotFound(_0x2805ba,_0x5cfb46){return function(_0x4ab593){if(!_0x4ab593){_0x2805ba[_0x0c86('0x18')](0x194);}return _0x4ab593;};}function handleError(_0x134d18,_0x1e3cb4){_0x1e3cb4=_0x1e3cb4||0x1f4;return function(_0x279c94){logger[_0x0c86('0x26')](_0x279c94['stack']);if(_0x279c94[_0x0c86('0x27')]){delete _0x279c94[_0x0c86('0x27')];}_0x134d18[_0x0c86('0x19')](_0x1e3cb4)[_0x0c86('0x28')](_0x279c94);};}exports[_0x0c86('0x29')]=function(_0x19f682,_0x20efe5){var _0x54fe6f={},_0x4fbeb6={},_0x1d55e2={'count':0x0,'rows':[]};var _0x40df82=_['map'](db[_0x0c86('0x2a')]['rawAttributes'],function(_0x296b71){return{'name':_0x296b71[_0x0c86('0x2b')],'type':_0x296b71['type']['key']};});_0x4fbeb6[_0x0c86('0x2c')]=_[_0x0c86('0x2d')](_0x40df82,_0x0c86('0x27'));_0x4fbeb6[_0x0c86('0x2e')]=_[_0x0c86('0x2f')](_0x19f682[_0x0c86('0x2e')]);_0x4fbeb6['filters']=_[_0x0c86('0x30')](_0x4fbeb6[_0x0c86('0x2c')],_0x4fbeb6['query']);_0x54fe6f[_0x0c86('0x31')]=_[_0x0c86('0x30')](_0x4fbeb6[_0x0c86('0x2c')],qs['fields'](_0x19f682[_0x0c86('0x2e')]['fields']));_0x54fe6f['attributes']=_0x54fe6f['attributes']['length']?_0x54fe6f[_0x0c86('0x31')]:_0x4fbeb6['model'];if(!_0x19f682[_0x0c86('0x2e')]['hasOwnProperty'](_0x0c86('0x32'))){_0x54fe6f[_0x0c86('0x1e')]=qs[_0x0c86('0x1e')](_0x19f682[_0x0c86('0x2e')][_0x0c86('0x1e')]);_0x54fe6f[_0x0c86('0x1c')]=qs[_0x0c86('0x1c')](_0x19f682[_0x0c86('0x2e')][_0x0c86('0x1c')]);}_0x54fe6f[_0x0c86('0x33')]=qs[_0x0c86('0x34')](_0x19f682[_0x0c86('0x2e')][_0x0c86('0x34')]);_0x54fe6f[_0x0c86('0x35')]=qs[_0x0c86('0x36')](_[_0x0c86('0x37')](_0x19f682[_0x0c86('0x2e')],_0x4fbeb6[_0x0c86('0x36')]),_0x40df82);if(_0x19f682[_0x0c86('0x2e')][_0x0c86('0x38')]){_0x54fe6f[_0x0c86('0x35')]=_[_0x0c86('0x39')](_0x54fe6f[_0x0c86('0x35')],{'$or':_[_0x0c86('0x2d')](_0x40df82,function(_0x1e209a){if(_0x1e209a[_0x0c86('0x3a')]!==_0x0c86('0x3b')){var _0x3365d8={};_0x3365d8[_0x1e209a[_0x0c86('0x27')]]={'$like':'%'+_0x19f682[_0x0c86('0x2e')][_0x0c86('0x38')]+'%'};return _0x3365d8;}})});}_0x54fe6f=_[_0x0c86('0x39')]({},_0x54fe6f,_0x19f682['options']);var _0x4874eb={'where':_0x54fe6f['where']};return db[_0x0c86('0x2a')][_0x0c86('0x1f')](_0x4874eb)[_0x0c86('0x24')](function(_0x44410b){_0x1d55e2['count']=_0x44410b;if(_0x19f682['query']['includeAll']){_0x54fe6f[_0x0c86('0x3c')]=[{'all':!![]}];}return db[_0x0c86('0x2a')]['findAll'](_0x54fe6f);})[_0x0c86('0x24')](function(_0x6fa5c3){_0x1d55e2[_0x0c86('0x3d')]=_0x6fa5c3;return _0x1d55e2;})[_0x0c86('0x24')](respondWithFilteredResult(_0x20efe5,_0x54fe6f))[_0x0c86('0x3e')](handleError(_0x20efe5,null));};exports[_0x0c86('0x3f')]=function(_0x443298,_0x1c2d0f){var _0x321b36={'raw':!![],'where':{'id':_0x443298[_0x0c86('0x40')]['id']}},_0x428f0c={};_0x428f0c['model']=_['keys'](db['SmsApplication'][_0x0c86('0x41')]);_0x428f0c[_0x0c86('0x2e')]=_[_0x0c86('0x2f')](_0x443298[_0x0c86('0x2e')]);_0x428f0c[_0x0c86('0x36')]=_['intersection'](_0x428f0c[_0x0c86('0x2c')],_0x428f0c[_0x0c86('0x2e')]);_0x321b36['attributes']=_['intersection'](_0x428f0c[_0x0c86('0x2c')],qs['fields'](_0x443298[_0x0c86('0x2e')][_0x0c86('0x42')]));_0x321b36[_0x0c86('0x31')]=_0x321b36[_0x0c86('0x31')][_0x0c86('0x43')]?_0x321b36[_0x0c86('0x31')]:_0x428f0c[_0x0c86('0x2c')];if(_0x443298[_0x0c86('0x2e')]['includeAll']){_0x321b36['include']=[{'all':!![]}];}_0x321b36=_[_0x0c86('0x39')]({},_0x321b36,_0x443298[_0x0c86('0x44')]);return db['SmsApplication']['find'](_0x321b36)[_0x0c86('0x24')](handleEntityNotFound(_0x1c2d0f,null))[_0x0c86('0x24')](respondWithResult(_0x1c2d0f,null))['catch'](handleError(_0x1c2d0f,null));};exports[_0x0c86('0x45')]=function(_0x5603a4,_0x5654c5){return db['SmsApplication'][_0x0c86('0x45')](_0x5603a4['body'],{})[_0x0c86('0x24')](respondWithResult(_0x5654c5,0xc9))[_0x0c86('0x3e')](handleError(_0x5654c5,null));};exports[_0x0c86('0x46')]=function(_0x1b88c3,_0x20515b){if(_0x1b88c3[_0x0c86('0x47')]['id']){delete _0x1b88c3[_0x0c86('0x47')]['id'];}return db[_0x0c86('0x2a')][_0x0c86('0x48')]({'where':{'id':_0x1b88c3[_0x0c86('0x40')]['id']}})[_0x0c86('0x24')](handleEntityNotFound(_0x20515b,null))[_0x0c86('0x24')](saveUpdates(_0x1b88c3['body'],null))['then'](respondWithResult(_0x20515b,null))[_0x0c86('0x3e')](handleError(_0x20515b,null));};exports[_0x0c86('0x25')]=function(_0x19bd1e,_0xcfbfc6){return db['SmsApplication'][_0x0c86('0x48')]({'where':{'id':_0x19bd1e['params']['id']}})[_0x0c86('0x24')](handleEntityNotFound(_0xcfbfc6,null))['then'](removeEntity(_0xcfbfc6,null))['catch'](handleError(_0xcfbfc6,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 7f756d0..844ad26 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 _0xb39f=['path','../../config/environment','./smsApplication.attributes','define','SmsApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x52d6d7,_0xe2f108){var _0x479d30=function(_0x2a5c81){while(--_0x2a5c81){_0x52d6d7['push'](_0x52d6d7['shift']());}};_0x479d30(++_0xe2f108);}(_0xb39f,0x1e6));var _0xfb39=function(_0x158156,_0xeb582e){_0x158156=_0x158156-0x0;var _0x5a59d0=_0xb39f[_0x158156];return _0x5a59d0;};'use strict';var _=require(_0xfb39('0x0'));var util=require(_0xfb39('0x1'));var logger=require(_0xfb39('0x2'))(_0xfb39('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb39('0x4'));var rimraf=require('rimraf');var config=require(_0xfb39('0x5'));var attributes=require(_0xfb39('0x6'));module['exports']=function(_0x1619f6,_0x455dbe){return _0x1619f6[_0xfb39('0x7')](_0xfb39('0x8'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xfb39('0x9')});}; \ No newline at end of file +var _0x8cbe=['api','moment','bluebird','request-promise','path','./smsApplication.attributes','exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x55017f,_0x177712){var _0x5e9af9=function(_0x48b096){while(--_0x48b096){_0x55017f['push'](_0x55017f['shift']());}};_0x5e9af9(++_0x177712);}(_0x8cbe,0x1a1));var _0xe8cb=function(_0x103b63,_0x57e863){_0x103b63=_0x103b63-0x0;var _0x72de84=_0x8cbe[_0x103b63];return _0x72de84;};'use strict';var _=require(_0xe8cb('0x0'));var util=require(_0xe8cb('0x1'));var logger=require(_0xe8cb('0x2'))(_0xe8cb('0x3'));var moment=require(_0xe8cb('0x4'));var BPromise=require(_0xe8cb('0x5'));var rp=require(_0xe8cb('0x6'));var fs=require('fs');var path=require(_0xe8cb('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe8cb('0x8'));module[_0xe8cb('0x9')]=function(_0x4f6590,_0x239ef0){return _0x4f6590[_0xe8cb('0xa')]('SmsApplication',attributes,{'tableName':_0xe8cb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe8cb('0xc'),'collate':_0xe8cb('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 41e42c0..0ba42a1 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 _0x97db=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','then','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','ioredis'];(function(_0xa67830,_0x13e0a2){var _0x5ce311=function(_0x412d8c){while(--_0x412d8c){_0xa67830['push'](_0xa67830['shift']());}};_0x5ce311(++_0x13e0a2);}(_0x97db,0x1b4));var _0xb97d=function(_0x13abf9,_0xd1e545){_0x13abf9=_0x13abf9-0x0;var _0x403ed3=_0x97db[_0x13abf9];return _0x403ed3;};'use strict';var _=require(_0xb97d('0x0'));var util=require(_0xb97d('0x1'));var moment=require(_0xb97d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb97d('0x3'));var db=require(_0xb97d('0x4'))['db'];var utils=require(_0xb97d('0x5'));var logger=require(_0xb97d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb97d('0x7'));var client=jayson[_0xb97d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x533149,_0x2ff80e,_0x57cbd4){return new BPromise(function(_0x20f1e1,_0x2e1230){return client['request'](_0x533149,_0x57cbd4)[_0xb97d('0x9')](function(_0xe9acff){logger[_0xb97d('0xa')](_0xb97d('0xb'),_0x2ff80e,'request\x20sent');logger[_0xb97d('0xc')](_0xb97d('0xd'),_0x2ff80e,_0xb97d('0xe'),JSON[_0xb97d('0xf')](_0xe9acff));if(_0xe9acff[_0xb97d('0x10')]){if(_0xe9acff[_0xb97d('0x10')][_0xb97d('0x11')]===0x1f4){logger[_0xb97d('0x10')](_0xb97d('0xb'),_0x2ff80e,_0xe9acff[_0xb97d('0x10')][_0xb97d('0x12')]);return _0x2e1230(_0xe9acff[_0xb97d('0x10')][_0xb97d('0x12')]);}logger[_0xb97d('0x10')](_0xb97d('0xb'),_0x2ff80e,_0xe9acff[_0xb97d('0x10')][_0xb97d('0x12')]);return _0x20f1e1(_0xe9acff[_0xb97d('0x10')]['message']);}else{logger[_0xb97d('0xa')](_0xb97d('0xb'),_0x2ff80e,_0xb97d('0xe'));_0x20f1e1(_0xe9acff[_0xb97d('0x13')][_0xb97d('0x12')]);}})['catch'](function(_0x416d6a){logger[_0xb97d('0x10')](_0xb97d('0xb'),_0x2ff80e,_0x416d6a);_0x2e1230(_0x416d6a);});});} \ No newline at end of file +var _0x39d2=['SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3c4322,_0x145a37){var _0x225310=function(_0x51a0a2){while(--_0x51a0a2){_0x3c4322['push'](_0x3c4322['shift']());}};_0x225310(++_0x145a37);}(_0x39d2,0xf5));var _0x239d=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0x39d2[_0x10df18];return _0x1f9a1d;};'use strict';var _=require(_0x239d('0x0'));var util=require('util');var moment=require(_0x239d('0x1'));var BPromise=require(_0x239d('0x2'));var rs=require(_0x239d('0x3'));var fs=require('fs');var Redis=require(_0x239d('0x4'));var db=require(_0x239d('0x5'))['db'];var utils=require(_0x239d('0x6'));var logger=require(_0x239d('0x7'))(_0x239d('0x8'));var config=require(_0x239d('0x9'));var jayson=require(_0x239d('0xa'));var client=jayson[_0x239d('0xb')][_0x239d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f0947,_0x53d457,_0x262efe){return new BPromise(function(_0x2a6811,_0x3f9948){return client[_0x239d('0xd')](_0x1f0947,_0x262efe)[_0x239d('0xe')](function(_0x3d7f32){logger[_0x239d('0xf')](_0x239d('0x10'),_0x53d457,_0x239d('0x11'));logger[_0x239d('0x12')](_0x239d('0x13'),_0x53d457,_0x239d('0x11'),JSON[_0x239d('0x14')](_0x3d7f32));if(_0x3d7f32[_0x239d('0x15')]){if(_0x3d7f32[_0x239d('0x15')]['code']===0x1f4){logger['error'](_0x239d('0x10'),_0x53d457,_0x3d7f32[_0x239d('0x15')][_0x239d('0x16')]);return _0x3f9948(_0x3d7f32[_0x239d('0x15')][_0x239d('0x16')]);}logger[_0x239d('0x15')](_0x239d('0x10'),_0x53d457,_0x3d7f32[_0x239d('0x15')][_0x239d('0x16')]);return _0x2a6811(_0x3d7f32['error'][_0x239d('0x16')]);}else{logger[_0x239d('0xf')](_0x239d('0x10'),_0x53d457,_0x239d('0x11'));_0x2a6811(_0x3d7f32[_0x239d('0x17')]['message']);}})['catch'](function(_0x141582){logger['error'](_0x239d('0x10'),_0x53d457,_0x141582);_0x3f9948(_0x141582);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index e8aab3b..553eea1 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 _0x96cc=['smsinteraction:destroy','delete','removeTags','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','/describe','describe','/:id','/:id/messages','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update'];(function(_0x408771,_0x22cc50){var _0x11087c=function(_0x3d008a){while(--_0x3d008a){_0x408771['push'](_0x408771['shift']());}};_0x11087c(++_0x22cc50);}(_0x96cc,0x16c));var _0xc96c=function(_0x5c380f,_0x2bf568){_0x5c380f=_0x5c380f-0x0;var _0x1cb483=_0x96cc[_0x5c380f];return _0x1cb483;};'use strict';var multer=require(_0xc96c('0x0'));var util=require('util');var path=require(_0xc96c('0x1'));var timeout=require('connect-timeout');var express=require(_0xc96c('0x2'));var router=express[_0xc96c('0x3')]();var fs_extra=require(_0xc96c('0x4'));var auth=require(_0xc96c('0x5'));var interaction=require(_0xc96c('0x6'));var config=require(_0xc96c('0x7'));var controller=require(_0xc96c('0x8'));router[_0xc96c('0x9')]('/',auth[_0xc96c('0xa')](),controller['index']);router[_0xc96c('0x9')](_0xc96c('0xb'),auth[_0xc96c('0xa')](),controller[_0xc96c('0xc')]);router[_0xc96c('0x9')](_0xc96c('0xd'),auth[_0xc96c('0xa')](),controller['show']);router[_0xc96c('0x9')](_0xc96c('0xe'),auth[_0xc96c('0xa')](),controller['getMessages']);router[_0xc96c('0x9')]('/:id/download',auth[_0xc96c('0xa')](),controller['download']);router[_0xc96c('0xf')]('/',auth[_0xc96c('0xa')](),controller[_0xc96c('0x10')]);router[_0xc96c('0xf')]('/:id/messages',auth[_0xc96c('0xa')](),controller[_0xc96c('0x11')]);router[_0xc96c('0xf')](_0xc96c('0x12'),auth['isAuthenticated'](),interaction[_0xc96c('0x13')](_0xc96c('0x14'),_0xc96c('0x15')),controller[_0xc96c('0x16')]);router[_0xc96c('0x17')](_0xc96c('0xd'),auth[_0xc96c('0xa')](),interaction[_0xc96c('0x13')](_0xc96c('0x14'),_0xc96c('0x18')),controller[_0xc96c('0x19')]);router['delete']('/:id',auth[_0xc96c('0xa')](),interaction[_0xc96c('0x13')](_0xc96c('0x14'),_0xc96c('0x1a')),controller['destroy']);router[_0xc96c('0x1b')](_0xc96c('0x12'),auth[_0xc96c('0xa')](),controller[_0xc96c('0x1c')]);module[_0xc96c('0x1d')]=router; \ No newline at end of file +var _0x757a=['smsinteraction:update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','post','tracked','sms','smsinteraction:addtags','addTags','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x757a,0xde));var _0xa757=function(_0x394685,_0x4c4820){_0x394685=_0x394685-0x0;var _0x25054c=_0x757a[_0x394685];return _0x25054c;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/describe',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['show']);router[_0xa757('0x7')](_0xa757('0xc'),auth[_0xa757('0x9')](),controller[_0xa757('0xd')]);router[_0xa757('0x7')](_0xa757('0xe'),auth[_0xa757('0x9')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xa757('0xc'),auth['isAuthenticated'](),controller['addMessage']);router[_0xa757('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xa757('0x10')](_0xa757('0x11'),_0xa757('0x12')),controller[_0xa757('0x13')]);router[_0xa757('0x14')](_0xa757('0xb'),auth[_0xa757('0x9')](),interaction[_0xa757('0x10')](_0xa757('0x11'),_0xa757('0x15')),controller['update']);router[_0xa757('0x16')](_0xa757('0xb'),auth[_0xa757('0x9')](),interaction['tracked']('sms',_0xa757('0x17')),controller[_0xa757('0x18')]);router[_0xa757('0x16')](_0xa757('0x19'),auth[_0xa757('0x9')](),controller[_0xa757('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 89c727d..fb5cf26 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 _0xc224=['moment','exports','DATE','STRING','ENUM','out','BOOLEAN','INTEGER','sequelize'];(function(_0x425024,_0x223496){var _0x474aed=function(_0x33e311){while(--_0x33e311){_0x425024['push'](_0x425024['shift']());}};_0x474aed(++_0x223496);}(_0xc224,0x1af));var _0x4c22=function(_0x1189fe,_0x1de621){_0x1189fe=_0x1189fe-0x0;var _0x319a9a=_0xc224[_0x1189fe];return _0x319a9a;};'use strict';var Sequelize=require(_0x4c22('0x0'));var moment=require(_0x4c22('0x1'));module[_0x4c22('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4c22('0x3')]},'disposition':{'type':Sequelize[_0x4c22('0x4')]},'secondDisposition':{'type':Sequelize[_0x4c22('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4c22('0x4')]},'note':{'type':Sequelize[_0x4c22('0x4')]},'phone':{'type':Sequelize[_0x4c22('0x4')]},'read1stAt':{'type':Sequelize[_0x4c22('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4c22('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x4c22('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4c22('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x4c22('0x8')]}}; \ No newline at end of file +var _0x3870=['exports','DATE','STRING','ENUM','out','BOOLEAN','sequelize','moment'];(function(_0x1dc493,_0x4ca11a){var _0x49fe7e=function(_0x4c9b64){while(--_0x4c9b64){_0x1dc493['push'](_0x1dc493['shift']());}};_0x49fe7e(++_0x4ca11a);}(_0x3870,0x146));var _0x0387=function(_0x4634dc,_0x400d5f){_0x4634dc=_0x4634dc-0x0;var _0x51321e=_0x3870[_0x4634dc];return _0x51321e;};'use strict';var Sequelize=require(_0x0387('0x0'));var moment=require(_0x0387('0x1'));module[_0x0387('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0387('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0387('0x4')]},'thirdDisposition':{'type':Sequelize[_0x0387('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0387('0x4')]},'read1stAt':{'type':Sequelize[_0x0387('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0387('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0387('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0387('0x5')]('in',_0x0387('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0387('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index c43a671..999e56f 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 _0xd7f8=['Messages','createdAt','direction','secret','Account','Owner','get','Sms','N.A.','closed','closedAt','disposition','out','fullname','System','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','unlinkSync','rimraf','zip-dir','moment','bluebird','util','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','update','then','destroy','stack','name','send','index','SmsInteraction','rawAttributes','type','key','getOptions','sms','query','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','pick','where','SmsInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','SmsMessage','rows','setTags','Tag','color','smsInteractionTags:save','unix','toString','join','root','server','files','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName'];(function(_0xb3ef20,_0x313d7d){var _0x17ccd=function(_0x2fc247){while(--_0x2fc247){_0xb3ef20['push'](_0xb3ef20['shift']());}};_0x17ccd(++_0x313d7d);}(_0xd7f8,0x16d));var _0x8d7f=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0xd7f8[_0x454165];return _0x56db53;};'use strict';var rimraf=require(_0x8d7f('0x0'));var zipdir=require(_0x8d7f('0x1'));var moment=require(_0x8d7f('0x2'));var BPromise=require(_0x8d7f('0x3'));var util=require(_0x8d7f('0x4'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x8d7f('0x5'));var interaction=require(_0x8d7f('0x6'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x8d7f('0x7'))(_0x8d7f('0x8'));var config=require(_0x8d7f('0x9'));var db=require(_0x8d7f('0xa'))['db'];config['redis']=_['defaults'](config[_0x8d7f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8d7f('0xc'))(new Redis(config[_0x8d7f('0xb')]));require(_0x8d7f('0xd'))[_0x8d7f('0xe')](socket);function respondWithStatusCode(_0x32483c,_0x4de0b2){_0x4de0b2=_0x4de0b2||0xcc;return function(_0x23aa89){if(_0x23aa89){return _0x32483c[_0x8d7f('0xf')](_0x4de0b2);}return _0x32483c['status'](_0x4de0b2)[_0x8d7f('0x10')]();};}function respondWithResult(_0x3b805f,_0x22c4c2){_0x22c4c2=_0x22c4c2||0xc8;return function(_0x4a1bb1){if(_0x4a1bb1){return _0x3b805f[_0x8d7f('0x11')](_0x22c4c2)[_0x8d7f('0x12')](_0x4a1bb1);}};}function respondWithFilteredResult(_0x2fd8df,_0x510e1a){return function(_0x215ca9){if(_0x215ca9){var _0x4a4928=typeof _0x510e1a[_0x8d7f('0x13')]===_0x8d7f('0x14')&&typeof _0x510e1a['limit']===_0x8d7f('0x14');var _0x306450=_0x215ca9[_0x8d7f('0x15')];var _0x1de3e3=_0x4a4928?0x0:_0x510e1a[_0x8d7f('0x13')];var _0x2b65d8=_0x4a4928?_0x215ca9[_0x8d7f('0x15')]:_0x510e1a[_0x8d7f('0x13')]+_0x510e1a[_0x8d7f('0x16')];var _0xe8d8d9;if(_0x2b65d8>=_0x306450){_0x2b65d8=_0x306450;_0xe8d8d9=0xc8;}else{_0xe8d8d9=0xce;}_0x2fd8df['status'](_0xe8d8d9);return _0x2fd8df[_0x8d7f('0x17')]('Content-Range',_0x1de3e3+'-'+_0x2b65d8+'/'+_0x306450)[_0x8d7f('0x12')](_0x215ca9);}return null;};}function saveUpdates(_0xf3d8a8){return function(_0x38f414){if(_0x38f414){return _0x38f414[_0x8d7f('0x18')](_0xf3d8a8)[_0x8d7f('0x19')](function(_0x29d13e){return _0x29d13e;});}return null;};}function removeEntity(_0x22ecc1){return function(_0x451fa5){if(_0x451fa5){return _0x451fa5[_0x8d7f('0x1a')]()['then'](function(){_0x22ecc1[_0x8d7f('0x11')](0xcc)[_0x8d7f('0x10')]();});}};}function handleEntityNotFound(_0x3e63b0){return function(_0x4ff614){if(!_0x4ff614){_0x3e63b0['sendStatus'](0x194);}return _0x4ff614;};}function handleError(_0x185227,_0xa225d5){_0xa225d5=_0xa225d5||0x1f4;return function(_0x5e912a){logger['error'](_0x5e912a[_0x8d7f('0x1b')]);if(_0x5e912a[_0x8d7f('0x1c')]){delete _0x5e912a[_0x8d7f('0x1c')];}_0x185227[_0x8d7f('0x11')](_0xa225d5)[_0x8d7f('0x1d')](_0x5e912a);};}exports[_0x8d7f('0x1e')]=function(_0x265837,_0x5e3a02){var _0x9e91f1={};var _0x32c427=_['map'](db[_0x8d7f('0x1f')][_0x8d7f('0x20')],function(_0x5a1f33){return{'name':_0x5a1f33['fieldName'],'type':_0x5a1f33[_0x8d7f('0x21')][_0x8d7f('0x22')]};});_0x9e91f1=qs[_0x8d7f('0x23')](_0x32c427,_0x265837);return interaction['findAll'](_0x8d7f('0x24'),_0x265837[_0x8d7f('0x25')],_0x265837['user'],_0x9e91f1,_0x32c427)[_0x8d7f('0x19')](respondWithFilteredResult(_0x5e3a02,_0x9e91f1))[_0x8d7f('0x26')](handleError(_0x5e3a02,null));};exports['show']=function(_0x40e3f9,_0x433d6e){var _0x14138c={'raw':![],'where':{'id':_0x40e3f9[_0x8d7f('0x27')]['id']}},_0x1e080f={};_0x1e080f[_0x8d7f('0x28')]=_[_0x8d7f('0x29')](db[_0x8d7f('0x1f')][_0x8d7f('0x20')]);_0x1e080f[_0x8d7f('0x25')]=_[_0x8d7f('0x29')](_0x40e3f9[_0x8d7f('0x25')]);_0x1e080f[_0x8d7f('0x2a')]=_[_0x8d7f('0x2b')](_0x1e080f[_0x8d7f('0x28')],_0x1e080f[_0x8d7f('0x25')]);_0x14138c[_0x8d7f('0x2c')]=_['intersection'](_0x1e080f[_0x8d7f('0x28')],qs['fields'](_0x40e3f9[_0x8d7f('0x25')][_0x8d7f('0x2d')]));_0x14138c[_0x8d7f('0x2c')]=_0x14138c[_0x8d7f('0x2c')][_0x8d7f('0x2e')]?_0x14138c['attributes']:_0x1e080f['model'];if(_0x40e3f9[_0x8d7f('0x25')][_0x8d7f('0x2f')]){_0x14138c[_0x8d7f('0x30')]=[{'all':!![]}];}_0x14138c=_[_0x8d7f('0x31')]({},_0x14138c,_0x40e3f9[_0x8d7f('0x32')]);return db[_0x8d7f('0x1f')][_0x8d7f('0x33')](_0x14138c)[_0x8d7f('0x19')](handleEntityNotFound(_0x433d6e,null))[_0x8d7f('0x19')](respondWithResult(_0x433d6e,null))[_0x8d7f('0x26')](handleError(_0x433d6e,null));};exports[_0x8d7f('0x34')]=function(_0x1a4889,_0x31f6ee){return db[_0x8d7f('0x1f')][_0x8d7f('0x34')](_0x1a4889[_0x8d7f('0x35')],{})['then'](respondWithResult(_0x31f6ee,0xc9))[_0x8d7f('0x26')](handleError(_0x31f6ee,null));};exports[_0x8d7f('0x18')]=function(_0xb4f049,_0x550871){if(_0xb4f049['body']['id']){delete _0xb4f049[_0x8d7f('0x35')]['id'];}return db[_0x8d7f('0x1f')][_0x8d7f('0x33')]({'where':{'id':_0xb4f049['params']['id']}})[_0x8d7f('0x19')](handleEntityNotFound(_0x550871,null))[_0x8d7f('0x19')](saveUpdates(_0xb4f049[_0x8d7f('0x35')],null))[_0x8d7f('0x19')](respondWithResult(_0x550871,null))['catch'](handleError(_0x550871,null));};exports[_0x8d7f('0x1a')]=function(_0x268dee,_0x90faaf){return db[_0x8d7f('0x1f')][_0x8d7f('0x33')]({'where':{'id':_0x268dee[_0x8d7f('0x27')]['id']}})['then'](handleEntityNotFound(_0x90faaf,null))[_0x8d7f('0x19')](removeEntity(_0x90faaf,null))['catch'](handleError(_0x90faaf,null));};exports[_0x8d7f('0x36')]=function(_0x3864ef,_0x9dfda8){return db[_0x8d7f('0x1f')][_0x8d7f('0x36')]()['then'](respondWithResult(_0x9dfda8,null))[_0x8d7f('0x26')](handleError(_0x9dfda8,null));};exports['addMessage']=function(_0x22cf78,_0x4d2e16){return db['SmsMessage'][_0x8d7f('0x33')]({'where':{'id':_0x22cf78[_0x8d7f('0x27')]['id']}})[_0x8d7f('0x19')](handleEntityNotFound(_0x4d2e16,null))[_0x8d7f('0x19')](function(_0x2296a){if(_0x2296a){return _0x2296a['addMessage'](_0x22cf78[_0x8d7f('0x35')][_0x8d7f('0x37')],_[_0x8d7f('0x38')](_0x22cf78[_0x8d7f('0x35')],[_0x8d7f('0x37'),'id'])||{});}})[_0x8d7f('0x19')](respondWithResult(_0x4d2e16,null))[_0x8d7f('0x26')](handleError(_0x4d2e16,null));};exports[_0x8d7f('0x39')]=function(_0x349e58,_0x3a1332){var _0x3c4205={'raw':![],'where':{}};var _0x561e8e={};var _0x5b8f83={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x8d7f('0x3a')]({'where':{'id':_0x349e58[_0x8d7f('0x27')]['id']}})[_0x8d7f('0x19')](handleEntityNotFound(_0x3a1332,null))[_0x8d7f('0x19')](function(_0x64884a){if(_0x64884a){_0x561e8e[_0x8d7f('0x28')]=_['keys'](db['SmsMessage']['rawAttributes']);_0x561e8e[_0x8d7f('0x25')]=_['keys'](_0x349e58[_0x8d7f('0x25')]);_0x561e8e[_0x8d7f('0x2a')]=_[_0x8d7f('0x2b')](_0x561e8e[_0x8d7f('0x28')],_0x561e8e[_0x8d7f('0x25')]);_0x3c4205[_0x8d7f('0x2c')]=_[_0x8d7f('0x2b')](_0x561e8e['model'],qs[_0x8d7f('0x2d')](_0x349e58[_0x8d7f('0x25')][_0x8d7f('0x2d')]));_0x3c4205[_0x8d7f('0x2c')]=_0x3c4205[_0x8d7f('0x2c')][_0x8d7f('0x2e')]?_0x3c4205['attributes']:_0x561e8e[_0x8d7f('0x28')];if(!_0x349e58['query'][_0x8d7f('0x3b')](_0x8d7f('0x3c'))){_0x3c4205[_0x8d7f('0x16')]=qs[_0x8d7f('0x16')](_0x349e58[_0x8d7f('0x25')][_0x8d7f('0x16')]);_0x3c4205['offset']=qs[_0x8d7f('0x13')](_0x349e58[_0x8d7f('0x25')][_0x8d7f('0x13')]);}_0x3c4205[_0x8d7f('0x3d')]=qs['sort'](_0x349e58[_0x8d7f('0x25')][_0x8d7f('0x3e')]);_0x3c4205['where']=qs[_0x8d7f('0x2a')](_[_0x8d7f('0x3f')](_0x349e58[_0x8d7f('0x25')],_0x561e8e[_0x8d7f('0x2a')]));_0x3c4205[_0x8d7f('0x40')][_0x8d7f('0x41')]=_0x64884a['id'];if(_0x349e58[_0x8d7f('0x25')][_0x8d7f('0x42')]){_0x3c4205[_0x8d7f('0x40')]=_['merge'](_0x3c4205[_0x8d7f('0x40')],{'$or':_[_0x8d7f('0x43')](_0x3c4205[_0x8d7f('0x2c')],function(_0x5d9619){var _0x3efbd9={};_0x3efbd9[_0x5d9619]={'$like':'%'+_0x349e58['query'][_0x8d7f('0x42')]+'%'};return _0x3efbd9;})});}if(_0x349e58[_0x8d7f('0x25')]['$gte']){var _0x3102a2=_0x349e58['query'][_0x8d7f('0x44')][_0x8d7f('0x45')](',');var _0x591e3e={};_0x591e3e[_0x3102a2[0x0]]={'$gte':moment(_0x3102a2[0x1])[_0x8d7f('0x46')](_0x8d7f('0x47'))};_0x3c4205['where']=_[_0x8d7f('0x31')](_0x3c4205[_0x8d7f('0x40')],_0x591e3e);}_0x3c4205=_[_0x8d7f('0x31')]({},_0x3c4205,_0x349e58[_0x8d7f('0x32')]);return db[_0x8d7f('0x48')][_0x8d7f('0x15')]({'where':_0x3c4205[_0x8d7f('0x40')]})['then'](function(_0x465ff6){_0x5b8f83[_0x8d7f('0x15')]=_0x465ff6;if(_0x349e58['query'][_0x8d7f('0x2f')]){_0x3c4205[_0x8d7f('0x30')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x3c4205);})['then'](function(_0x2c7587){_0x5b8f83[_0x8d7f('0x49')]=_0x2c7587;return _0x5b8f83;});}})[_0x8d7f('0x19')](respondWithFilteredResult(_0x3a1332,_0x3c4205))[_0x8d7f('0x26')](handleError(_0x3a1332,null));};exports['addTags']=function(_0x12aa1f,_0x26268f){return db[_0x8d7f('0x1f')][_0x8d7f('0x33')]({'where':{'id':_0x12aa1f['params']['id']}})[_0x8d7f('0x19')](handleEntityNotFound(_0x26268f,null))[_0x8d7f('0x19')](function(_0x18c138){if(_0x18c138){return _0x18c138[_0x8d7f('0x4a')](_0x12aa1f['body'][_0x8d7f('0x37')],_[_0x8d7f('0x38')](_0x12aa1f[_0x8d7f('0x35')],[_0x8d7f('0x37'),'id'])||{})['spread'](function(){return db[_0x8d7f('0x4b')]['findAll']({'attributes':['id',_0x8d7f('0x1c'),_0x8d7f('0x4c')],'where':{'id':_0x12aa1f[_0x8d7f('0x35')]['ids']}});})[_0x8d7f('0x19')](function(_0x4f16d8){socket['emit'](_0x8d7f('0x4d'),{'id':Number(_0x12aa1f[_0x8d7f('0x27')]['id']),'tags':_0x4f16d8||[]});return{'id':Number(_0x12aa1f[_0x8d7f('0x27')]['id']),'tags':_0x4f16d8||[]};});}})[_0x8d7f('0x19')](respondWithResult(_0x26268f,null))[_0x8d7f('0x26')](handleError(_0x26268f,null));};exports['removeTags']=function(_0x494779,_0x4cfb31){return db['SmsInteraction']['find']({'where':{'id':_0x494779['params']['id']}})[_0x8d7f('0x19')](handleEntityNotFound(_0x4cfb31,null))[_0x8d7f('0x19')](function(_0x193776){if(_0x193776){return _0x193776['removeTags'](_0x494779['query'][_0x8d7f('0x37')]);}})[_0x8d7f('0x19')](respondWithStatusCode(_0x4cfb31,null))[_0x8d7f('0x26')](handleError(_0x4cfb31,null));};exports['download']=function(_0x396089,_0x58ab0a){var _0x22f731=moment()[_0x8d7f('0x4e')]()[_0x8d7f('0x4f')]();var _0x40ad50=path[_0x8d7f('0x50')](config[_0x8d7f('0x51')],_0x8d7f('0x52'),_0x8d7f('0x53'),'tmp');var _0x5242b1=path[_0x8d7f('0x50')](_0x40ad50,_0x22f731);var _0x7c70d3=util[_0x8d7f('0x46')](_0x8d7f('0x54'),_0x396089['params']['id'],_0x22f731);var _0x4d968a=path[_0x8d7f('0x50')](_0x40ad50,_0x7c70d3);var _0x7369ec=[];_0x7369ec[_0x8d7f('0x55')]({'model':db[_0x8d7f('0x56')],'as':_0x8d7f('0x56'),'attributes':['id','fullname'],'raw':!![]});_0x7369ec[_0x8d7f('0x55')]({'model':db[_0x8d7f('0x57')],'as':_0x8d7f('0x58'),'attributes':['id',_0x8d7f('0x59'),_0x8d7f('0x5a')],'raw':!![]});var _0x33dddd=[{'model':db[_0x8d7f('0x48')],'as':_0x8d7f('0x5b'),'attributes':['id',_0x8d7f('0x35'),_0x8d7f('0x5c'),_0x8d7f('0x5d'),_0x8d7f('0x5e'),'read'],'include':_0x7369ec}];_0x33dddd[_0x8d7f('0x55')]({'model':db['SmsAccount'],'as':_0x8d7f('0x5f'),'attributes':['id',_0x8d7f('0x1c')]});_0x33dddd[_0x8d7f('0x55')]({'model':db[_0x8d7f('0x56')],'as':_0x8d7f('0x60'),'attributes':['id','fullname']});return db[_0x8d7f('0x1f')][_0x8d7f('0x33')]({'where':{'id':_0x396089[_0x8d7f('0x27')]['id']},'include':_0x33dddd})[_0x8d7f('0x19')](handleEntityNotFound(_0x58ab0a,null))[_0x8d7f('0x19')](function(_0x136e8e){if(_0x136e8e){var _0x5868d7=_0x136e8e[_0x8d7f('0x61')]({'plain':!![]});fs['mkdirSync'](_0x5242b1);var _0x1d3b24={'channel':_0x8d7f('0x62'),'account':_0x5868d7[_0x8d7f('0x5f')][_0x8d7f('0x1c')],'agent':_0x5868d7[_0x8d7f('0x60')]?_0x5868d7[_0x8d7f('0x60')]['fullname']:_0x8d7f('0x63'),'createdAt':moment(_0x5868d7[_0x8d7f('0x5c')])[_0x8d7f('0x46')](_0x8d7f('0x47'))[_0x8d7f('0x4f')](),'closedAt':_0x5868d7[_0x8d7f('0x64')]?moment(_0x5868d7[_0x8d7f('0x65')])[_0x8d7f('0x46')](_0x8d7f('0x47'))[_0x8d7f('0x4f')]():'','disposition':_0x5868d7[_0x8d7f('0x66')],'messages':_(_0x5868d7[_0x8d7f('0x5b')])[_0x8d7f('0x42')]({'secret':![]})[_0x8d7f('0x43')](function(_0x5e14b0){return{'date':moment(_0x5e14b0['createdAt'])['format'](_0x8d7f('0x47'))[_0x8d7f('0x4f')](),'sender':_0x5e14b0[_0x8d7f('0x5d')]===_0x8d7f('0x67')?_0x5e14b0['User']?_0x5e14b0[_0x8d7f('0x56')][_0x8d7f('0x68')]:_0x8d7f('0x69'):_0x5e14b0[_0x8d7f('0x58')][_0x8d7f('0x59')]+(_0x5e14b0[_0x8d7f('0x58')]['lastName']?'\x20'+_0x5e14b0[_0x8d7f('0x58')][_0x8d7f('0x5a')]:''),'body':_0x5e14b0[_0x8d7f('0x35')],'direction':_0x5e14b0['direction']===_0x8d7f('0x67')?'A':'C','secret':_0x5e14b0['secret'],'read':_0x5e14b0[_0x8d7f('0x6a')]};})[_0x8d7f('0x6b')]()};return ejs[_0x8d7f('0x6c')](path[_0x8d7f('0x50')](config[_0x8d7f('0x51')],_0x8d7f('0x52'),_0x8d7f('0x6d'),_0x8d7f('0x6e')),{'interaction':_0x1d3b24})[_0x8d7f('0x19')](function(_0x224385){var _0x37b13c=path[_0x8d7f('0x50')](_0x5242b1,_0x8d7f('0x6f')+_0x5868d7['id']+'-'+_0x22f731+_0x8d7f('0x70'));var _0x450b05={'path':_0x37b13c,'channel':'Sms','interactionId':_0x5868d7['id']};return pdf['createPdfFromHTML'](_0x224385,_0x450b05);})['then'](function(){return new BPromise(function(_0x3715ca,_0x4dc4ff){zipdir(_0x5242b1,{'saveTo':_0x4d968a},function(_0x1ec637,_0x2dde4b){if(_0x1ec637)return _0x4dc4ff(_0x1ec637);return _0x3715ca(_0x2dde4b);});})[_0x8d7f('0x19')](function(){return new BPromise(function(_0xd7f469,_0x528cf3){rimraf(_0x5242b1,function(_0x15321d){if(_0x15321d)_0x528cf3(_0x15321d);return _0xd7f469();});});})[_0x8d7f('0x19')](function(){return _0x58ab0a['download'](_0x4d968a,_0x7c70d3,function(_0x218ec2){if(_0x218ec2){console['log']('err',_0x218ec2);}else{fs[_0x8d7f('0x71')](_0x4d968a);}});});});}else{return _0x58ab0a[_0x8d7f('0xf')](0xc8);}})[_0x8d7f('0x26')](handleError(_0x58ab0a,null));}; \ No newline at end of file +var _0x6122=['format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','color','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','direction','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','createdAt','closedAt','Messages','out','System','secret','value','renderFile','views','transcript-','.pdf','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','SmsInteraction','rawAttributes','type','getOptions','findAll','sms','query','show','model','keys','filters','intersection','fields','attributes','length','includeAll','include','options','find','create','body','catch','params','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','merge','filter','$gte','split'];(function(_0x30f68b,_0xfa973){var _0x140739=function(_0x44e025){while(--_0x44e025){_0x30f68b['push'](_0x30f68b['shift']());}};_0x140739(++_0xfa973);}(_0x6122,0xaa));var _0x2612=function(_0x10c4f9,_0x100fb4){_0x10c4f9=_0x10c4f9-0x0;var _0x522b09=_0x6122[_0x10c4f9];return _0x522b09;};'use strict';var rimraf=require(_0x2612('0x0'));var zipdir=require(_0x2612('0x1'));var moment=require(_0x2612('0x2'));var BPromise=require(_0x2612('0x3'));var util=require(_0x2612('0x4'));var path=require('path');var ejs=require(_0x2612('0x5'));var fs=require('fs');var _=require(_0x2612('0x6'));var Redis=require('ioredis');var interaction=require(_0x2612('0x7'));var qs=require(_0x2612('0x8'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x2612('0x9'));var config=require(_0x2612('0xa'));var db=require(_0x2612('0xb'))['db'];config[_0x2612('0xc')]=_[_0x2612('0xd')](config[_0x2612('0xc')],{'host':_0x2612('0xe'),'port':0x18eb});var socket=require(_0x2612('0xf'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0x2612('0x10')](socket);function respondWithStatusCode(_0x4a618b,_0x57a862){_0x57a862=_0x57a862||0xcc;return function(_0x50f313){if(_0x50f313){return _0x4a618b[_0x2612('0x11')](_0x57a862);}return _0x4a618b[_0x2612('0x12')](_0x57a862)['end']();};}function respondWithResult(_0x16afce,_0x190bbb){_0x190bbb=_0x190bbb||0xc8;return function(_0x231c71){if(_0x231c71){return _0x16afce[_0x2612('0x12')](_0x190bbb)[_0x2612('0x13')](_0x231c71);}};}function respondWithFilteredResult(_0x54d21a,_0x38ec1b){return function(_0x570f8d){if(_0x570f8d){var _0x38f2c9=typeof _0x38ec1b['offset']===_0x2612('0x14')&&typeof _0x38ec1b[_0x2612('0x15')]===_0x2612('0x14');var _0x5f509a=_0x570f8d[_0x2612('0x16')];var _0x4240b7=_0x38f2c9?0x0:_0x38ec1b[_0x2612('0x17')];var _0xd1eead=_0x38f2c9?_0x570f8d[_0x2612('0x16')]:_0x38ec1b[_0x2612('0x17')]+_0x38ec1b[_0x2612('0x15')];var _0x3cfaa6;if(_0xd1eead>=_0x5f509a){_0xd1eead=_0x5f509a;_0x3cfaa6=0xc8;}else{_0x3cfaa6=0xce;}_0x54d21a[_0x2612('0x12')](_0x3cfaa6);return _0x54d21a[_0x2612('0x18')](_0x2612('0x19'),_0x4240b7+'-'+_0xd1eead+'/'+_0x5f509a)['json'](_0x570f8d);}return null;};}function saveUpdates(_0x763776){return function(_0x10a278){if(_0x10a278){return _0x10a278[_0x2612('0x1a')](_0x763776)[_0x2612('0x1b')](function(_0xf0f042){return _0xf0f042;});}return null;};}function removeEntity(_0x55b1ce){return function(_0x19c1ad){if(_0x19c1ad){return _0x19c1ad[_0x2612('0x1c')]()['then'](function(){_0x55b1ce[_0x2612('0x12')](0xcc)[_0x2612('0x1d')]();});}};}function handleEntityNotFound(_0x5caad7){return function(_0x180d62){if(!_0x180d62){_0x5caad7['sendStatus'](0x194);}return _0x180d62;};}function handleError(_0x179c77,_0x9c076f){_0x9c076f=_0x9c076f||0x1f4;return function(_0x20b8f2){logger['error'](_0x20b8f2[_0x2612('0x1e')]);if(_0x20b8f2[_0x2612('0x1f')]){delete _0x20b8f2[_0x2612('0x1f')];}_0x179c77[_0x2612('0x12')](_0x9c076f)[_0x2612('0x20')](_0x20b8f2);};}exports[_0x2612('0x21')]=function(_0x52a164,_0x2db678){var _0x31707c={};var _0x4556ba=_[_0x2612('0x22')](db[_0x2612('0x23')][_0x2612('0x24')],function(_0x2cceab){return{'name':_0x2cceab['fieldName'],'type':_0x2cceab[_0x2612('0x25')]['key']};});_0x31707c=qs[_0x2612('0x26')](_0x4556ba,_0x52a164);return interaction[_0x2612('0x27')](_0x2612('0x28'),_0x52a164[_0x2612('0x29')],_0x52a164['user'],_0x31707c,_0x4556ba)[_0x2612('0x1b')](respondWithFilteredResult(_0x2db678,_0x31707c))['catch'](handleError(_0x2db678,null));};exports[_0x2612('0x2a')]=function(_0xa2657f,_0x1aede1){var _0x54161d={'raw':![],'where':{'id':_0xa2657f['params']['id']}},_0x18f2d2={};_0x18f2d2[_0x2612('0x2b')]=_[_0x2612('0x2c')](db[_0x2612('0x23')][_0x2612('0x24')]);_0x18f2d2[_0x2612('0x29')]=_['keys'](_0xa2657f[_0x2612('0x29')]);_0x18f2d2[_0x2612('0x2d')]=_[_0x2612('0x2e')](_0x18f2d2['model'],_0x18f2d2[_0x2612('0x29')]);_0x54161d['attributes']=_[_0x2612('0x2e')](_0x18f2d2[_0x2612('0x2b')],qs[_0x2612('0x2f')](_0xa2657f['query'][_0x2612('0x2f')]));_0x54161d['attributes']=_0x54161d[_0x2612('0x30')][_0x2612('0x31')]?_0x54161d[_0x2612('0x30')]:_0x18f2d2[_0x2612('0x2b')];if(_0xa2657f[_0x2612('0x29')][_0x2612('0x32')]){_0x54161d[_0x2612('0x33')]=[{'all':!![]}];}_0x54161d=_['merge']({},_0x54161d,_0xa2657f[_0x2612('0x34')]);return db[_0x2612('0x23')][_0x2612('0x35')](_0x54161d)[_0x2612('0x1b')](handleEntityNotFound(_0x1aede1,null))['then'](respondWithResult(_0x1aede1,null))['catch'](handleError(_0x1aede1,null));};exports[_0x2612('0x36')]=function(_0x501df7,_0x3b99ab){return db[_0x2612('0x23')][_0x2612('0x36')](_0x501df7[_0x2612('0x37')],{})['then'](respondWithResult(_0x3b99ab,0xc9))[_0x2612('0x38')](handleError(_0x3b99ab,null));};exports[_0x2612('0x1a')]=function(_0x25aee2,_0x20e0c2){if(_0x25aee2[_0x2612('0x37')]['id']){delete _0x25aee2[_0x2612('0x37')]['id'];}return db[_0x2612('0x23')][_0x2612('0x35')]({'where':{'id':_0x25aee2[_0x2612('0x39')]['id']}})[_0x2612('0x1b')](handleEntityNotFound(_0x20e0c2,null))[_0x2612('0x1b')](saveUpdates(_0x25aee2[_0x2612('0x37')],null))[_0x2612('0x1b')](respondWithResult(_0x20e0c2,null))[_0x2612('0x38')](handleError(_0x20e0c2,null));};exports[_0x2612('0x1c')]=function(_0x1e4b78,_0x13412f){return db['SmsInteraction'][_0x2612('0x35')]({'where':{'id':_0x1e4b78[_0x2612('0x39')]['id']}})['then'](handleEntityNotFound(_0x13412f,null))[_0x2612('0x1b')](removeEntity(_0x13412f,null))['catch'](handleError(_0x13412f,null));};exports['describe']=function(_0x20e7e9,_0x2efaef){return db[_0x2612('0x23')][_0x2612('0x3a')]()[_0x2612('0x1b')](respondWithResult(_0x2efaef,null))[_0x2612('0x38')](handleError(_0x2efaef,null));};exports[_0x2612('0x3b')]=function(_0x1e60d6,_0x4633af){return db[_0x2612('0x3c')][_0x2612('0x35')]({'where':{'id':_0x1e60d6[_0x2612('0x39')]['id']}})['then'](handleEntityNotFound(_0x4633af,null))[_0x2612('0x1b')](function(_0x4b0741){if(_0x4b0741){return _0x4b0741[_0x2612('0x3b')](_0x1e60d6[_0x2612('0x37')][_0x2612('0x3d')],_[_0x2612('0x3e')](_0x1e60d6[_0x2612('0x37')],['ids','id'])||{});}})['then'](respondWithResult(_0x4633af,null))['catch'](handleError(_0x4633af,null));};exports[_0x2612('0x3f')]=function(_0x25c856,_0x125256){var _0x473cdc={'raw':![],'where':{}};var _0x526fb1={};var _0x1691a3={'count':0x0,'rows':[]};return db[_0x2612('0x23')][_0x2612('0x40')]({'where':{'id':_0x25c856[_0x2612('0x39')]['id']}})[_0x2612('0x1b')](handleEntityNotFound(_0x125256,null))[_0x2612('0x1b')](function(_0x2c7e04){if(_0x2c7e04){_0x526fb1[_0x2612('0x2b')]=_[_0x2612('0x2c')](db[_0x2612('0x3c')][_0x2612('0x24')]);_0x526fb1[_0x2612('0x29')]=_[_0x2612('0x2c')](_0x25c856[_0x2612('0x29')]);_0x526fb1[_0x2612('0x2d')]=_[_0x2612('0x2e')](_0x526fb1[_0x2612('0x2b')],_0x526fb1[_0x2612('0x29')]);_0x473cdc[_0x2612('0x30')]=_['intersection'](_0x526fb1[_0x2612('0x2b')],qs[_0x2612('0x2f')](_0x25c856['query'][_0x2612('0x2f')]));_0x473cdc['attributes']=_0x473cdc[_0x2612('0x30')][_0x2612('0x31')]?_0x473cdc[_0x2612('0x30')]:_0x526fb1[_0x2612('0x2b')];if(!_0x25c856[_0x2612('0x29')][_0x2612('0x41')](_0x2612('0x42'))){_0x473cdc[_0x2612('0x15')]=qs[_0x2612('0x15')](_0x25c856['query'][_0x2612('0x15')]);_0x473cdc[_0x2612('0x17')]=qs[_0x2612('0x17')](_0x25c856[_0x2612('0x29')][_0x2612('0x17')]);}_0x473cdc[_0x2612('0x43')]=qs[_0x2612('0x44')](_0x25c856[_0x2612('0x29')][_0x2612('0x44')]);_0x473cdc[_0x2612('0x45')]=qs[_0x2612('0x2d')](_[_0x2612('0x46')](_0x25c856[_0x2612('0x29')],_0x526fb1['filters']));_0x473cdc[_0x2612('0x45')][_0x2612('0x47')]=_0x2c7e04['id'];if(_0x25c856[_0x2612('0x29')]['filter']){_0x473cdc[_0x2612('0x45')]=_[_0x2612('0x48')](_0x473cdc['where'],{'$or':_[_0x2612('0x22')](_0x473cdc['attributes'],function(_0x2d542f){var _0x546012={};_0x546012[_0x2d542f]={'$like':'%'+_0x25c856[_0x2612('0x29')][_0x2612('0x49')]+'%'};return _0x546012;})});}if(_0x25c856['query'][_0x2612('0x4a')]){var _0x10aee2=_0x25c856[_0x2612('0x29')][_0x2612('0x4a')][_0x2612('0x4b')](',');var _0xe5a212={};_0xe5a212[_0x10aee2[0x0]]={'$gte':moment(_0x10aee2[0x1])[_0x2612('0x4c')](_0x2612('0x4d'))};_0x473cdc[_0x2612('0x45')]=_[_0x2612('0x48')](_0x473cdc[_0x2612('0x45')],_0xe5a212);}_0x473cdc=_['merge']({},_0x473cdc,_0x25c856[_0x2612('0x34')]);return db[_0x2612('0x3c')][_0x2612('0x16')]({'where':_0x473cdc[_0x2612('0x45')]})['then'](function(_0x375bf2){_0x1691a3['count']=_0x375bf2;if(_0x25c856[_0x2612('0x29')][_0x2612('0x32')]){_0x473cdc[_0x2612('0x33')]=[{'all':!![]}];}return db[_0x2612('0x3c')][_0x2612('0x27')](_0x473cdc);})[_0x2612('0x1b')](function(_0x3bfe91){_0x1691a3[_0x2612('0x4e')]=_0x3bfe91;return _0x1691a3;});}})['then'](respondWithFilteredResult(_0x125256,_0x473cdc))[_0x2612('0x38')](handleError(_0x125256,null));};exports[_0x2612('0x4f')]=function(_0x180ad5,_0x26cf6b){return db[_0x2612('0x23')][_0x2612('0x35')]({'where':{'id':_0x180ad5['params']['id']}})[_0x2612('0x1b')](handleEntityNotFound(_0x26cf6b,null))[_0x2612('0x1b')](function(_0x3364ca){if(_0x3364ca){return _0x3364ca[_0x2612('0x50')](_0x180ad5[_0x2612('0x37')][_0x2612('0x3d')],_['omit'](_0x180ad5[_0x2612('0x37')],[_0x2612('0x3d'),'id'])||{})['spread'](function(){return db[_0x2612('0x51')][_0x2612('0x27')]({'attributes':['id',_0x2612('0x1f'),_0x2612('0x52')],'where':{'id':_0x180ad5[_0x2612('0x37')][_0x2612('0x3d')]}});})['then'](function(_0x22a051){socket['emit'](_0x2612('0x53'),{'id':Number(_0x180ad5['params']['id']),'tags':_0x22a051||[]});return{'id':Number(_0x180ad5[_0x2612('0x39')]['id']),'tags':_0x22a051||[]};});}})[_0x2612('0x1b')](respondWithResult(_0x26cf6b,null))[_0x2612('0x38')](handleError(_0x26cf6b,null));};exports['removeTags']=function(_0x55f9c6,_0x1d9720){return db['SmsInteraction'][_0x2612('0x35')]({'where':{'id':_0x55f9c6[_0x2612('0x39')]['id']}})[_0x2612('0x1b')](handleEntityNotFound(_0x1d9720,null))[_0x2612('0x1b')](function(_0x2bb2d2){if(_0x2bb2d2){return _0x2bb2d2[_0x2612('0x54')](_0x55f9c6[_0x2612('0x29')][_0x2612('0x3d')]);}})[_0x2612('0x1b')](respondWithStatusCode(_0x1d9720,null))[_0x2612('0x38')](handleError(_0x1d9720,null));};exports[_0x2612('0x55')]=function(_0x447747,_0x261914){var _0x5d74b7=moment()[_0x2612('0x56')]()[_0x2612('0x57')]();var _0x2fed09=path[_0x2612('0x58')](config[_0x2612('0x59')],_0x2612('0x5a'),_0x2612('0x5b'),_0x2612('0x5c'));var _0x614dd2=path['join'](_0x2fed09,_0x5d74b7);var _0x44ee83=util[_0x2612('0x4c')](_0x2612('0x5d'),_0x447747['params']['id'],_0x5d74b7);var _0x3b3617=path[_0x2612('0x58')](_0x2fed09,_0x44ee83);var _0x5ab064=[];_0x5ab064[_0x2612('0x5e')]({'model':db[_0x2612('0x5f')],'as':_0x2612('0x5f'),'attributes':['id',_0x2612('0x60')],'raw':!![]});_0x5ab064[_0x2612('0x5e')]({'model':db['CmContact'],'as':_0x2612('0x61'),'attributes':['id',_0x2612('0x62'),_0x2612('0x63')],'raw':!![]});var _0x518b38=[{'model':db[_0x2612('0x3c')],'as':'Messages','attributes':['id',_0x2612('0x37'),'createdAt',_0x2612('0x64'),'secret',_0x2612('0x65')],'include':_0x5ab064}];_0x518b38['push']({'model':db[_0x2612('0x66')],'as':_0x2612('0x67'),'attributes':['id','name']});_0x518b38[_0x2612('0x5e')]({'model':db[_0x2612('0x5f')],'as':_0x2612('0x68'),'attributes':['id',_0x2612('0x60')]});return db[_0x2612('0x23')][_0x2612('0x35')]({'where':{'id':_0x447747[_0x2612('0x39')]['id']},'include':_0x518b38})[_0x2612('0x1b')](handleEntityNotFound(_0x261914,null))[_0x2612('0x1b')](function(_0x196f49){if(_0x196f49){var _0x5ed122=_0x196f49[_0x2612('0x69')]({'plain':!![]});fs[_0x2612('0x6a')](_0x614dd2);var _0x11ff30={'channel':_0x2612('0x6b'),'account':_0x5ed122[_0x2612('0x67')][_0x2612('0x1f')],'agent':_0x5ed122[_0x2612('0x68')]?_0x5ed122[_0x2612('0x68')][_0x2612('0x60')]:_0x2612('0x6c'),'createdAt':moment(_0x5ed122[_0x2612('0x6d')])[_0x2612('0x4c')](_0x2612('0x4d'))[_0x2612('0x57')](),'closedAt':_0x5ed122['closed']?moment(_0x5ed122[_0x2612('0x6e')])[_0x2612('0x4c')](_0x2612('0x4d'))[_0x2612('0x57')]():'','disposition':_0x5ed122['disposition'],'messages':_(_0x5ed122[_0x2612('0x6f')])[_0x2612('0x49')]({'secret':![]})[_0x2612('0x22')](function(_0x246e2e){return{'date':moment(_0x246e2e[_0x2612('0x6d')])[_0x2612('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2612('0x57')](),'sender':_0x246e2e[_0x2612('0x64')]===_0x2612('0x70')?_0x246e2e['User']?_0x246e2e['User'][_0x2612('0x60')]:_0x2612('0x71'):_0x246e2e[_0x2612('0x61')][_0x2612('0x62')]+(_0x246e2e['Contact'][_0x2612('0x63')]?'\x20'+_0x246e2e[_0x2612('0x61')]['lastName']:''),'body':_0x246e2e['body'],'direction':_0x246e2e[_0x2612('0x64')]===_0x2612('0x70')?'A':'C','secret':_0x246e2e[_0x2612('0x72')],'read':_0x246e2e[_0x2612('0x65')]};})[_0x2612('0x73')]()};return ejs[_0x2612('0x74')](path[_0x2612('0x58')](config['root'],'server',_0x2612('0x75'),'downloadInteraction.ejs'),{'interaction':_0x11ff30})['then'](function(_0x5128e6){var _0x3a588d=path[_0x2612('0x58')](_0x614dd2,_0x2612('0x76')+_0x5ed122['id']+'-'+_0x5d74b7+_0x2612('0x77'));var _0x51b2e8={'path':_0x3a588d,'channel':_0x2612('0x6b'),'interactionId':_0x5ed122['id']};return pdf['createPdfFromHTML'](_0x5128e6,_0x51b2e8);})[_0x2612('0x1b')](function(){return new BPromise(function(_0x436575,_0x21137e){zipdir(_0x614dd2,{'saveTo':_0x3b3617},function(_0x21a9f3,_0x5f1dbf){if(_0x21a9f3)return _0x21137e(_0x21a9f3);return _0x436575(_0x5f1dbf);});})[_0x2612('0x1b')](function(){return new BPromise(function(_0x387253,_0x42bbee){rimraf(_0x614dd2,function(_0x14f6a4){if(_0x14f6a4)_0x42bbee(_0x14f6a4);return _0x387253();});});})[_0x2612('0x1b')](function(){return _0x261914[_0x2612('0x55')](_0x3b3617,_0x44ee83,function(_0x285d7c){if(_0x285d7c){console[_0x2612('0x78')](_0x2612('0x79'),_0x285d7c);}else{fs[_0x2612('0x7a')](_0x3b3617);}});});});}else{return _0x261914[_0x2612('0x11')](0xc8);}})['catch'](handleError(_0x261914,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 858ec68..ec53142 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 _0x1775=['map','findAll','length','emit','catch','hasOwnProperty','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x44a9b1,_0x5e0d7b){var _0x1a47f3=function(_0x168317){while(--_0x168317){_0x44a9b1['push'](_0x44a9b1['shift']());}};_0x1a47f3(++_0x5e0d7b);}(_0x1775,0x1db));var _0x5177=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1775[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x5177('0x0'))['db'][_0x5177('0x1')];var SmsMessage=require(_0x5177('0x0'))['db'][_0x5177('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5177('0x3')](0x0);var events={'afterCreate':_0x5177('0x4'),'afterUpdate':_0x5177('0x5'),'afterDestroy':_0x5177('0x6')};function emitEvent(_0x359401){return function(_0x51275f,_0x159a20,_0x2c5c42){_0x51275f[_0x5177('0x7')]({'attributes':['id'],'raw':!![]})[_0x5177('0x8')](function(_0x300b43){_0x51275f[_0x5177('0x9')](_0x5177('0xa'),_0x300b43[_0x5177('0xb')](function(_0x16e7a7){return{'id':_0x16e7a7['id']};}));return SmsMessage[_0x5177('0xc')]({'where':{'SmsInteractionId':_0x51275f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5177('0x8')](function(_0x206035){_0x51275f['setDataValue']('unreadMessages',_0x206035[_0x5177('0xd')]);SmsInteractionEvents[_0x5177('0xe')](_0x359401+':'+_0x51275f['id'],_0x51275f);SmsInteractionEvents[_0x5177('0xe')](_0x359401,_0x51275f);_0x2c5c42(null);})[_0x5177('0xf')](_0x2c5c42(null));};}for(var e in events){if(events[_0x5177('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5177('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x28f2=['update','remove','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x28f2,0x193));var _0x228f=function(_0x4e41de,_0x2e18c8){_0x4e41de=_0x4e41de-0x0;var _0x400904=_0x28f2[_0x4e41de];return _0x400904;};'use strict';var EventEmitter=require(_0x228f('0x0'));var SmsInteraction=require(_0x228f('0x1'))['db'][_0x228f('0x2')];var SmsMessage=require(_0x228f('0x1'))['db'][_0x228f('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x228f('0x4'),'afterUpdate':_0x228f('0x5'),'afterDestroy':_0x228f('0x6')};function emitEvent(_0x4303c3){return function(_0x2bb7d7,_0x3439f5,_0x32c5c3){_0x2bb7d7['getUsers']({'attributes':['id'],'raw':!![]})[_0x228f('0x7')](function(_0x4a4a44){_0x2bb7d7[_0x228f('0x8')](_0x228f('0x9'),_0x4a4a44[_0x228f('0xa')](function(_0x5f406c){return{'id':_0x5f406c['id']};}));return SmsMessage[_0x228f('0xb')]({'where':{'SmsInteractionId':_0x2bb7d7['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x212c90){_0x2bb7d7[_0x228f('0x8')]('unreadMessages',_0x212c90[_0x228f('0xc')]);SmsInteractionEvents[_0x228f('0xd')](_0x4303c3+':'+_0x2bb7d7['id'],_0x2bb7d7);SmsInteractionEvents[_0x228f('0xd')](_0x4303c3,_0x2bb7d7);_0x32c5c3(null);})[_0x228f('0xe')](_0x32c5c3(null));};}for(var e in events){if(events[_0x228f('0xf')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x228f('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 6014e00..d2dbf1f 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 _0x3a95=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','request-promise','path','../../config/environment','define','closedAt'];(function(_0x1de022,_0x483b9b){var _0x40b924=function(_0x16e9f3){while(--_0x16e9f3){_0x1de022['push'](_0x1de022['shift']());}};_0x40b924(++_0x483b9b);}(_0x3a95,0x1b0));var _0x53a9=function(_0x23f86b,_0x32c5d4){_0x23f86b=_0x23f86b-0x0;var _0x366042=_0x3a95[_0x23f86b];return _0x366042;};'use strict';var _=require(_0x53a9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x53a9('0x1'));var moment=require(_0x53a9('0x2'));var BPromise=require('bluebird');var rp=require(_0x53a9('0x3'));var fs=require('fs');var path=require(_0x53a9('0x4'));var rimraf=require('rimraf');var config=require(_0x53a9('0x5'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x5b22f7,_0x3dd0b3){return _0x5b22f7[_0x53a9('0x6')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x42d5a0,_0x4dee26,_0xe38cbd){if(_0x42d5a0['changed']('closed')){_0x42d5a0[_0x53a9('0x7')]=moment()[_0x53a9('0x8')](_0x53a9('0x9'));}_0xe38cbd(null,_0x42d5a0);}}});}; \ No newline at end of file +var _0xf5e6=['./smsInteraction.attributes','exports','sms_interactions','changed','closed','closedAt','format','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5484b1,_0x2bd562){var _0x43e83f=function(_0x186c4e){while(--_0x186c4e){_0x5484b1['push'](_0x5484b1['shift']());}};_0x43e83f(++_0x2bd562);}(_0xf5e6,0x97));var _0x6f5e=function(_0x1acc21,_0x323e67){_0x1acc21=_0x1acc21-0x0;var _0x16031a=_0xf5e6[_0x1acc21];return _0x16031a;};'use strict';var _=require(_0x6f5e('0x0'));var util=require(_0x6f5e('0x1'));var logger=require(_0x6f5e('0x2'))(_0x6f5e('0x3'));var moment=require(_0x6f5e('0x4'));var BPromise=require(_0x6f5e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f5e('0x6'));var rimraf=require(_0x6f5e('0x7'));var config=require(_0x6f5e('0x8'));var attributes=require(_0x6f5e('0x9'));module[_0x6f5e('0xa')]=function(_0x218eac,_0x516cd5){return _0x218eac['define']('SmsInteraction',attributes,{'tableName':_0x6f5e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xf51f16,_0x41b2ab,_0x25317e){if(_0xf51f16[_0x6f5e('0xc')](_0x6f5e('0xd'))){_0xf51f16[_0x6f5e('0xe')]=moment()[_0x6f5e('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x25317e(null,_0xf51f16);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index d73965a..d1781f4 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 _0xb191=['then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','UpdateSmsInteraction','update','options','raw','where','AddTagsToSmsInteraction','find','addTags','ids','omit','body','spread','AddTags','lodash','moment','bluebird','randomstring','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request'];(function(_0x183b21,_0x271b8e){var _0x4dbe1b=function(_0x32e3e2){while(--_0x32e3e2){_0x183b21['push'](_0x183b21['shift']());}};_0x4dbe1b(++_0x271b8e);}(_0xb191,0x1c5));var _0x1b19=function(_0x4ffb89,_0x31d1ec){_0x4ffb89=_0x4ffb89-0x0;var _0x16015a=_0xb191[_0x4ffb89];return _0x16015a;};'use strict';var _=require(_0x1b19('0x0'));var util=require('util');var moment=require(_0x1b19('0x1'));var BPromise=require(_0x1b19('0x2'));var rs=require(_0x1b19('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b19('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1b19('0x5'));var client=jayson[_0x1b19('0x6')][_0x1b19('0x7')]({'port':0x232a});config[_0x1b19('0x8')]=_[_0x1b19('0x9')](config[_0x1b19('0x8')],{'host':_0x1b19('0xa'),'port':0x18eb});var socket=require(_0x1b19('0xb'))(new Redis(config[_0x1b19('0x8')]));require(_0x1b19('0xc'))[_0x1b19('0xd')](socket);function respondWithRpcPromise(_0x2d024d,_0x3e3721,_0x2efc36){return new BPromise(function(_0x48bd89,_0x53113d){return client[_0x1b19('0xe')](_0x2d024d,_0x2efc36)[_0x1b19('0xf')](function(_0x59d6e8){logger['info'](_0x1b19('0x10'),_0x3e3721,_0x1b19('0x11'));logger[_0x1b19('0x12')](_0x1b19('0x13'),_0x3e3721,'request\x20sent',JSON[_0x1b19('0x14')](_0x59d6e8));if(_0x59d6e8[_0x1b19('0x15')]){if(_0x59d6e8[_0x1b19('0x15')][_0x1b19('0x16')]===0x1f4){logger[_0x1b19('0x15')](_0x1b19('0x10'),_0x3e3721,_0x59d6e8[_0x1b19('0x15')][_0x1b19('0x17')]);return _0x53113d(_0x59d6e8[_0x1b19('0x15')]['message']);}logger[_0x1b19('0x15')](_0x1b19('0x10'),_0x3e3721,_0x59d6e8['error'][_0x1b19('0x17')]);return _0x48bd89(_0x59d6e8[_0x1b19('0x15')][_0x1b19('0x17')]);}else{logger[_0x1b19('0x18')](_0x1b19('0x10'),_0x3e3721,'request\x20sent');_0x48bd89(_0x59d6e8['result'][_0x1b19('0x17')]);}})[_0x1b19('0x19')](function(_0x32c261){logger[_0x1b19('0x15')](_0x1b19('0x10'),_0x3e3721,_0x32c261);_0x53113d(_0x32c261);});});}exports[_0x1b19('0x1a')]=function(_0x4dd351){var _0x4682ef=this;return new Promise(function(_0x15b661,_0x4d25d){return db['SmsInteraction'][_0x1b19('0x1b')](_0x4dd351['body'],{'raw':_0x4dd351[_0x1b19('0x1c')]?_0x4dd351['options'][_0x1b19('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4dd351['options']?_0x4dd351[_0x1b19('0x1c')][_0x1b19('0x1e')]||null:null,'attributes':_0x4dd351[_0x1b19('0x1c')]?_0x4dd351[_0x1b19('0x1c')]['attributes']||null:null,'limit':_0x4dd351['options']?_0x4dd351[_0x1b19('0x1c')]['limit']||null:null})[_0x1b19('0xf')](function(_0x4a7c9e){logger[_0x1b19('0x18')](_0x1b19('0x1a'),_0x4dd351);logger[_0x1b19('0x12')](_0x1b19('0x1a'),_0x4dd351,JSON[_0x1b19('0x14')](_0x4a7c9e));_0x15b661(_0x4a7c9e);})[_0x1b19('0x19')](function(_0x29e24b){logger[_0x1b19('0x15')]('UpdateSmsInteraction',_0x29e24b[_0x1b19('0x17')],_0x4dd351);_0x4d25d(_0x4682ef[_0x1b19('0x15')](0x1f4,_0x29e24b['message']));});});};exports[_0x1b19('0x1f')]=function(_0x2d0e6c){return new Promise(function(_0x530782,_0x1a7094){return db['SmsInteraction'][_0x1b19('0x20')]({'where':_0x2d0e6c[_0x1b19('0x1c')]?_0x2d0e6c[_0x1b19('0x1c')][_0x1b19('0x1e')]||null:null})[_0x1b19('0xf')](function(_0x16bd04){if(_0x16bd04){return _0x16bd04[_0x1b19('0x21')](_0x2d0e6c['body'][_0x1b19('0x22')],_[_0x1b19('0x23')](_0x2d0e6c[_0x1b19('0x24')],[_0x1b19('0x22'),'id'])||{});}})[_0x1b19('0x25')](function(_0x3932a4){logger[_0x1b19('0x18')](_0x1b19('0x26'),_0x2d0e6c);logger[_0x1b19('0x12')](_0x1b19('0x26'),_0x2d0e6c,JSON[_0x1b19('0x14')](_0x3932a4));_0x530782(_0x3932a4);})[_0x1b19('0x19')](function(_0x1ca524){logger['error']('AddTags',_0x1ca524[_0x1b19('0x17')],_0x2d0e6c);_0x1a7094(_this[_0x1b19('0x15')](0x1f4,_0x1ca524['message']));});});}; \ No newline at end of file +var _0x67a2=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./smsInteraction.socket','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','attributes','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','randomstring'];(function(_0x152b4f,_0x2fdc9b){var _0x13e49a=function(_0x4fe84b){while(--_0x4fe84b){_0x152b4f['push'](_0x152b4f['shift']());}};_0x13e49a(++_0x2fdc9b);}(_0x67a2,0x12c));var _0x267a=function(_0x13aa7e,_0x775d0e){_0x13aa7e=_0x13aa7e-0x0;var _0x387b57=_0x67a2[_0x13aa7e];return _0x387b57;};'use strict';var _=require(_0x267a('0x0'));var util=require(_0x267a('0x1'));var moment=require(_0x267a('0x2'));var BPromise=require('bluebird');var rs=require(_0x267a('0x3'));var fs=require('fs');var Redis=require(_0x267a('0x4'));var db=require(_0x267a('0x5'))['db'];var utils=require(_0x267a('0x6'));var logger=require('../../config/logger')(_0x267a('0x7'));var config=require(_0x267a('0x8'));var jayson=require(_0x267a('0x9'));var client=jayson['client'][_0x267a('0xa')]({'port':0x232a});config[_0x267a('0xb')]=_['defaults'](config[_0x267a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x267a('0xc'))(new Redis(config[_0x267a('0xb')]));require(_0x267a('0xd'))['register'](socket);function respondWithRpcPromise(_0x4cf8e1,_0x2775a3,_0x2c0cc8){return new BPromise(function(_0x4a1928,_0x3c315f){return client['request'](_0x4cf8e1,_0x2c0cc8)[_0x267a('0xe')](function(_0x57111b){logger[_0x267a('0xf')](_0x267a('0x10'),_0x2775a3,_0x267a('0x11'));logger[_0x267a('0x12')](_0x267a('0x13'),_0x2775a3,_0x267a('0x11'),JSON[_0x267a('0x14')](_0x57111b));if(_0x57111b['error']){if(_0x57111b['error'][_0x267a('0x15')]===0x1f4){logger['error'](_0x267a('0x10'),_0x2775a3,_0x57111b[_0x267a('0x16')][_0x267a('0x17')]);return _0x3c315f(_0x57111b[_0x267a('0x16')][_0x267a('0x17')]);}logger[_0x267a('0x16')](_0x267a('0x10'),_0x2775a3,_0x57111b[_0x267a('0x16')][_0x267a('0x17')]);return _0x4a1928(_0x57111b[_0x267a('0x16')][_0x267a('0x17')]);}else{logger['info'](_0x267a('0x10'),_0x2775a3,_0x267a('0x11'));_0x4a1928(_0x57111b[_0x267a('0x18')][_0x267a('0x17')]);}})[_0x267a('0x19')](function(_0x4bba4a){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x2775a3,_0x4bba4a);_0x3c315f(_0x4bba4a);});});}exports[_0x267a('0x1a')]=function(_0x42b80c){var _0x579895=this;return new Promise(function(_0x1912ad,_0x4a9714){return db[_0x267a('0x1b')]['update'](_0x42b80c[_0x267a('0x1c')],{'raw':_0x42b80c['options']?_0x42b80c[_0x267a('0x1d')][_0x267a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42b80c[_0x267a('0x1d')]?_0x42b80c[_0x267a('0x1d')]['where']||null:null,'attributes':_0x42b80c[_0x267a('0x1d')]?_0x42b80c['options'][_0x267a('0x1f')]||null:null,'limit':_0x42b80c[_0x267a('0x1d')]?_0x42b80c[_0x267a('0x1d')]['limit']||null:null})[_0x267a('0xe')](function(_0x15fb50){logger[_0x267a('0xf')](_0x267a('0x1a'),_0x42b80c);logger['debug']('UpdateSmsInteraction',_0x42b80c,JSON['stringify'](_0x15fb50));_0x1912ad(_0x15fb50);})[_0x267a('0x19')](function(_0x316ed1){logger[_0x267a('0x16')](_0x267a('0x1a'),_0x316ed1[_0x267a('0x17')],_0x42b80c);_0x4a9714(_0x579895[_0x267a('0x16')](0x1f4,_0x316ed1['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x5554b8){return new Promise(function(_0x3bf7cc,_0x56afcd){return db[_0x267a('0x1b')][_0x267a('0x20')]({'where':_0x5554b8[_0x267a('0x1d')]?_0x5554b8['options']['where']||null:null})[_0x267a('0xe')](function(_0x4b2d6b){if(_0x4b2d6b){return _0x4b2d6b[_0x267a('0x21')](_0x5554b8[_0x267a('0x1c')]['ids'],_[_0x267a('0x22')](_0x5554b8[_0x267a('0x1c')],[_0x267a('0x23'),'id'])||{});}})[_0x267a('0x24')](function(_0x315490){logger['info'](_0x267a('0x25'),_0x5554b8);logger['debug']('AddTags',_0x5554b8,JSON[_0x267a('0x14')](_0x315490));_0x3bf7cc(_0x315490);})['catch'](function(_0x1ece20){logger[_0x267a('0x16')](_0x267a('0x25'),_0x1ece20[_0x267a('0x17')],_0x5554b8);_0x56afcd(_this[_0x267a('0x16')](0x1f4,_0x1ece20[_0x267a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 4d8a734..18f3c23 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 _0x6395=['remove','update','removeListener','register','length','smsInteraction:','./smsInteraction.events','save'];(function(_0x4f4720,_0x2aec33){var _0x127fbc=function(_0x2b271c){while(--_0x2b271c){_0x4f4720['push'](_0x4f4720['shift']());}};_0x127fbc(++_0x2aec33);}(_0x6395,0x186));var _0x5639=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6395[_0x19e35c];return _0x3e1fe8;};'use strict';var SmsInteractionEvents=require(_0x5639('0x0'));var events=[_0x5639('0x1'),_0x5639('0x2'),_0x5639('0x3')];function createListener(_0x4477dc,_0x1d5472){return function(_0x1844fc){_0x1d5472['emit'](_0x4477dc,_0x1844fc);};}function removeListener(_0x1dffff,_0x282606){return function(){SmsInteractionEvents[_0x5639('0x4')](_0x1dffff,_0x282606);};}exports[_0x5639('0x5')]=function(_0x50ae67){for(var _0x3f97d1=0x0,_0x21de19=events[_0x5639('0x6')];_0x3f97d1<_0x21de19;_0x3f97d1++){var _0x1567cc=events[_0x3f97d1];var _0x536e88=createListener(_0x5639('0x7')+_0x1567cc,_0x50ae67);SmsInteractionEvents['on'](_0x1567cc,_0x536e88);}}; \ No newline at end of file +var _0xb786=['register','smsInteraction:','./smsInteraction.events','save','remove','update','removeListener'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xb786,0x80));var _0x6b78=function(_0x42ecc9,_0xcd4e01){_0x42ecc9=_0x42ecc9-0x0;var _0x988bce=_0xb786[_0x42ecc9];return _0x988bce;};'use strict';var SmsInteractionEvents=require(_0x6b78('0x0'));var events=[_0x6b78('0x1'),_0x6b78('0x2'),_0x6b78('0x3')];function createListener(_0x312edb,_0x4a505b){return function(_0x142448){_0x4a505b['emit'](_0x312edb,_0x142448);};}function removeListener(_0x4ced84,_0x7924ab){return function(){SmsInteractionEvents[_0x6b78('0x4')](_0x4ced84,_0x7924ab);};}exports[_0x6b78('0x5')]=function(_0x2b4c13){for(var _0x160485=0x0,_0x50f93e=events['length'];_0x160485<_0x50f93e;_0x160485++){var _0x30ded2=events[_0x160485];var _0x4d04d7=createListener(_0x6b78('0x6')+_0x30ded2,_0x2b4c13);SmsInteractionEvents['on'](_0x30ded2,_0x4d04d7);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 389c826..6d23a60 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 _0xb10d=['create','/:id/status','status','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create'];(function(_0x4b7b69,_0x3ab075){var _0x173b4c=function(_0x234d5f){while(--_0x234d5f){_0x4b7b69['push'](_0x4b7b69['shift']());}};_0x173b4c(++_0x3ab075);}(_0xb10d,0x17f));var _0xdb10=function(_0x1e08b6,_0x4b7c2c){_0x1e08b6=_0x1e08b6-0x0;var _0x466b8a=_0xb10d[_0x1e08b6];return _0x466b8a;};'use strict';var multer=require(_0xdb10('0x0'));var util=require('util');var path=require(_0xdb10('0x1'));var timeout=require(_0xdb10('0x2'));var express=require(_0xdb10('0x3'));var router=express[_0xdb10('0x4')]();var fs_extra=require(_0xdb10('0x5'));var auth=require(_0xdb10('0x6'));var interaction=require(_0xdb10('0x7'));var config=require(_0xdb10('0x8'));var controller=require(_0xdb10('0x9'));router[_0xdb10('0xa')]('/',auth[_0xdb10('0xb')](),controller['index']);router[_0xdb10('0xa')](_0xdb10('0xc'),auth[_0xdb10('0xb')](),controller[_0xdb10('0xd')]);router[_0xdb10('0xa')](_0xdb10('0xe'),auth[_0xdb10('0xb')](),controller[_0xdb10('0xf')]);router[_0xdb10('0x10')]('/',auth[_0xdb10('0xb')](),interaction[_0xdb10('0x11')](_0xdb10('0x12'),_0xdb10('0x13')),controller[_0xdb10('0x14')]);router[_0xdb10('0x10')](_0xdb10('0x15'),controller[_0xdb10('0x16')]);router[_0xdb10('0x17')](_0xdb10('0xe'),auth[_0xdb10('0xb')](),controller[_0xdb10('0x18')]);router[_0xdb10('0x17')](_0xdb10('0x19'),auth[_0xdb10('0xb')](),controller['accept']);router[_0xdb10('0x17')](_0xdb10('0x1a'),auth[_0xdb10('0xb')](),controller[_0xdb10('0x1b')]);router[_0xdb10('0x1c')](_0xdb10('0xe'),auth['isAuthenticated'](),controller[_0xdb10('0x1d')]);module[_0xdb10('0x1e')]=router; \ No newline at end of file +var _0x2ef8=['index','/describe','describe','/:id','show','tracked','sms','smsmessage:create','create','post','/:id/status','status','put','/:id/accept','accept','/:id/reject','reject','delete','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4b7dfb,_0xbbed3e){var _0x1392df=function(_0x3d7f8a){while(--_0x3d7f8a){_0x4b7dfb['push'](_0x4b7dfb['shift']());}};_0x1392df(++_0xbbed3e);}(_0x2ef8,0x162));var _0x82ef=function(_0x4adf06,_0x23beb5){_0x4adf06=_0x4adf06-0x0;var _0x42d1eb=_0x2ef8[_0x4adf06];return _0x42d1eb;};'use strict';var multer=require('multer');var util=require(_0x82ef('0x0'));var path=require(_0x82ef('0x1'));var timeout=require('connect-timeout');var express=require(_0x82ef('0x2'));var router=express[_0x82ef('0x3')]();var fs_extra=require(_0x82ef('0x4'));var auth=require(_0x82ef('0x5'));var interaction=require(_0x82ef('0x6'));var config=require(_0x82ef('0x7'));var controller=require('./smsMessage.controller');router[_0x82ef('0x8')]('/',auth[_0x82ef('0x9')](),controller[_0x82ef('0xa')]);router[_0x82ef('0x8')](_0x82ef('0xb'),auth[_0x82ef('0x9')](),controller[_0x82ef('0xc')]);router[_0x82ef('0x8')](_0x82ef('0xd'),auth[_0x82ef('0x9')](),controller[_0x82ef('0xe')]);router['post']('/',auth[_0x82ef('0x9')](),interaction[_0x82ef('0xf')](_0x82ef('0x10'),_0x82ef('0x11')),controller[_0x82ef('0x12')]);router[_0x82ef('0x13')](_0x82ef('0x14'),controller[_0x82ef('0x15')]);router[_0x82ef('0x16')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x82ef('0x16')](_0x82ef('0x17'),auth['isAuthenticated'](),controller[_0x82ef('0x18')]);router[_0x82ef('0x16')](_0x82ef('0x19'),auth[_0x82ef('0x9')](),controller[_0x82ef('0x1a')]);router[_0x82ef('0x1b')](_0x82ef('0xd'),auth[_0x82ef('0x9')](),controller['destroy']);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 8f5ae35..41ea5d7 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 _0x5af0=['ENUM','out','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x3cca3e,_0x950fc5){var _0x382338=function(_0x5dc3fe){while(--_0x5dc3fe){_0x3cca3e['push'](_0x3cca3e['shift']());}};_0x382338(++_0x950fc5);}(_0x5af0,0x1eb));var _0x05af=function(_0x18ff02,_0x8d1caf){_0x18ff02=_0x18ff02-0x0;var _0x4f3115=_0x5af0[_0x18ff02];return _0x4f3115;};'use strict';var Sequelize=require(_0x05af('0x0'));module[_0x05af('0x1')]={'body':{'type':Sequelize[_0x05af('0x2')](_0x05af('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x05af('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x05af('0x5')]('in',_0x05af('0x6')),'defaultValue':_0x05af('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x05af('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x05af('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x05af('0x7')]},'providerResponse':{'type':Sequelize[_0x05af('0x2')]}}; \ No newline at end of file +var _0x8dfa=['exports','TEXT','medium','BOOLEAN','out','STRING','DATE'];(function(_0x2b2ed8,_0x67088a){var _0x363324=function(_0x4fc8a0){while(--_0x4fc8a0){_0x2b2ed8['push'](_0x2b2ed8['shift']());}};_0x363324(++_0x67088a);}(_0x8dfa,0x118));var _0xa8df=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0x8dfa[_0x120376];return _0x28c529;};'use strict';var Sequelize=require('sequelize');module[_0xa8df('0x0')]={'body':{'type':Sequelize[_0xa8df('0x1')](_0xa8df('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa8df('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa8df('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xa8df('0x5')]},'readAt':{'type':Sequelize[_0xa8df('0x6')]},'secret':{'type':Sequelize[_0xa8df('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xa8df('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 4eefef0..210ea2d 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 _0x6d4b=['SmsInteraction','SmsInteractionId','isNil','interaction','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','motionChannel','channel','event','EventManager','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','sent','Status','plivio','inspect','infobip','groupName','DELIVERED','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','redis','defaults','localhost','./smsMessage.socket','jayson/promise','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','apply','reject','save','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','filter','options','includeAll','include','findAll','rows','length','find','create','body','update','params','describe','../../config/logger','sms-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get'];(function(_0x26c243,_0x57e479){var _0x353789=function(_0x6731c8){while(--_0x6731c8){_0x26c243['push'](_0x26c243['shift']());}};_0x353789(++_0x57e479);}(_0x6d4b,0xbf));var _0xb6d4=function(_0x18ba84,_0x54e9e1){_0x18ba84=_0x18ba84-0x0;var _0x14cbe3=_0x6d4b[_0x18ba84];return _0x14cbe3;};'use strict';var emlformat=require(_0xb6d4('0x0'));var rimraf=require(_0xb6d4('0x1'));var zipdir=require(_0xb6d4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb6d4('0x3'));var moment=require(_0xb6d4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb6d4('0x5'));var path=require(_0xb6d4('0x6'));var sox=require(_0xb6d4('0x7'));var csv=require(_0xb6d4('0x8'));var ejs=require(_0xb6d4('0x9'));var fs=require('fs');var fs_extra=require(_0xb6d4('0xa'));var _=require(_0xb6d4('0xb'));var squel=require(_0xb6d4('0xc'));var crypto=require('crypto');var jsforce=require(_0xb6d4('0xd'));var deskjs=require(_0xb6d4('0xe'));var toCsv=require(_0xb6d4('0x8'));var querystring=require(_0xb6d4('0xf'));var Papa=require(_0xb6d4('0x10'));var Redis=require(_0xb6d4('0x11'));var authService=require(_0xb6d4('0x12'));var qs=require(_0xb6d4('0x13'));var as=require(_0xb6d4('0x14'));var hardwareService=require(_0xb6d4('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb6d4('0x16'));var db=require('../../mysqldb')['db'];config[_0xb6d4('0x17')]=_[_0xb6d4('0x18')](config[_0xb6d4('0x17')],{'host':_0xb6d4('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb6d4('0x17')]));require(_0xb6d4('0x1a'))['register'](socket);var jayson=require(_0xb6d4('0x1b'));var client=jayson['client'][_0xb6d4('0x1c')]({'port':0x232c});var client9002=jayson[_0xb6d4('0x1d')][_0xb6d4('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1b0dab,_0x9813c8,_0x247c1c,_0x77fba0){return new BPromise(function(_0x5e3b0f,_0x35f16e){var _0x14f314=_0x77fba0||client;return _0x14f314[_0xb6d4('0x1e')](_0x1b0dab,_0x247c1c)[_0xb6d4('0x1f')](function(_0x43ba1f){logger[_0xb6d4('0x20')](_0xb6d4('0x21'),_0x9813c8,_0xb6d4('0x22'));logger[_0xb6d4('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9813c8,'request\x20sent',JSON[_0xb6d4('0x24')](_0x43ba1f));if(_0x43ba1f[_0xb6d4('0x25')]){if(_0x43ba1f[_0xb6d4('0x25')][_0xb6d4('0x26')]===0x1f4){logger[_0xb6d4('0x25')]('SmsMessage,\x20%s,\x20%s',_0x9813c8,_0x43ba1f[_0xb6d4('0x25')][_0xb6d4('0x27')]);return _0x35f16e(_0x43ba1f[_0xb6d4('0x25')]['message']);}logger[_0xb6d4('0x25')]('SmsMessage,\x20%s,\x20%s',_0x9813c8,_0x43ba1f['error'][_0xb6d4('0x27')]);return _0x5e3b0f(_0x43ba1f[_0xb6d4('0x25')]['message']);}else{logger['info'](_0xb6d4('0x21'),_0x9813c8,_0xb6d4('0x22'));_0x5e3b0f(_0x43ba1f[_0xb6d4('0x28')][_0xb6d4('0x27')]);}})[_0xb6d4('0x29')](function(_0x223ca0){logger[_0xb6d4('0x25')](_0xb6d4('0x21'),_0x9813c8,_0x223ca0);_0x35f16e(_0x223ca0);});});}function respondWithStatusCode(_0x93c3b1,_0x3aedc7){_0x3aedc7=_0x3aedc7||0xcc;return function(_0xe67526){if(_0xe67526){return _0x93c3b1[_0xb6d4('0x2a')](_0x3aedc7);}return _0x93c3b1['status'](_0x3aedc7)[_0xb6d4('0x2b')]();};}function respondWithResult(_0xac7c48,_0x54ddeb){_0x54ddeb=_0x54ddeb||0xc8;return function(_0x242a44){if(_0x242a44){return _0xac7c48['status'](_0x54ddeb)[_0xb6d4('0x2c')](_0x242a44);}};}function respondWithFilteredResult(_0x3f2e8b,_0x346d4d){return function(_0x3191d2){if(_0x3191d2){var _0x1a311d=typeof _0x346d4d[_0xb6d4('0x2d')]===_0xb6d4('0x2e')&&typeof _0x346d4d[_0xb6d4('0x2f')]==='undefined';var _0x2aea11=_0x3191d2[_0xb6d4('0x30')];var _0x112d10=_0x1a311d?0x0:_0x346d4d['offset'];var _0x417d70=_0x1a311d?_0x3191d2[_0xb6d4('0x30')]:_0x346d4d['offset']+_0x346d4d[_0xb6d4('0x2f')];var _0x2a40ad;if(_0x417d70>=_0x2aea11){_0x417d70=_0x2aea11;_0x2a40ad=0xc8;}else{_0x2a40ad=0xce;}_0x3f2e8b[_0xb6d4('0x31')](_0x2a40ad);return _0x3f2e8b['set']('Content-Range',_0x112d10+'-'+_0x417d70+'/'+_0x2aea11)['json'](_0x3191d2);}return null;};}function patchUpdates(_0x13458e){return function(_0x11cf0){try{jsonpatch[_0xb6d4('0x32')](_0x11cf0,_0x13458e,!![]);}catch(_0x42a4af){return BPromise[_0xb6d4('0x33')](_0x42a4af);}return _0x11cf0[_0xb6d4('0x34')]();};}function saveUpdates(_0x52638f,_0x59e433){return function(_0x43436f){if(_0x43436f){return _0x43436f['update'](_0x52638f)['then'](function(_0x4a4572){return _0x4a4572;});}return null;};}function removeEntity(_0x5b7771,_0x3ca0d2){return function(_0x1a8201){if(_0x1a8201){return _0x1a8201['destroy']()[_0xb6d4('0x1f')](function(){_0x5b7771['status'](0xcc)[_0xb6d4('0x2b')]();});}};}function handleEntityNotFound(_0x879877,_0x389943){return function(_0x2ac83f){if(!_0x2ac83f){_0x879877[_0xb6d4('0x2a')](0x194);}return _0x2ac83f;};}function handleError(_0x3f452,_0x2b024a){_0x2b024a=_0x2b024a||0x1f4;return function(_0x55d323){logger[_0xb6d4('0x25')](_0x55d323[_0xb6d4('0x35')]);if(_0x55d323[_0xb6d4('0x36')]){delete _0x55d323['name'];}_0x3f452['status'](_0x2b024a)[_0xb6d4('0x37')](_0x55d323);};}exports[_0xb6d4('0x38')]=function(_0x12a3dc,_0x3a8d0e){var _0x7c5b7e={},_0x522a44={},_0x4167bf={'count':0x0,'rows':[]};var _0x54639e=_[_0xb6d4('0x39')](db[_0xb6d4('0x3a')][_0xb6d4('0x3b')],function(_0x4e0ac2){return{'name':_0x4e0ac2[_0xb6d4('0x3c')],'type':_0x4e0ac2['type']['key']};});_0x522a44[_0xb6d4('0x3d')]=_[_0xb6d4('0x39')](_0x54639e,_0xb6d4('0x36'));_0x522a44[_0xb6d4('0x3e')]=_[_0xb6d4('0x3f')](_0x12a3dc[_0xb6d4('0x3e')]);_0x522a44['filters']=_[_0xb6d4('0x40')](_0x522a44['model'],_0x522a44[_0xb6d4('0x3e')]);_0x7c5b7e['attributes']=_[_0xb6d4('0x40')](_0x522a44[_0xb6d4('0x3d')],qs[_0xb6d4('0x41')](_0x12a3dc[_0xb6d4('0x3e')][_0xb6d4('0x41')]));_0x7c5b7e['attributes']=_0x7c5b7e[_0xb6d4('0x42')]['length']?_0x7c5b7e[_0xb6d4('0x42')]:_0x522a44[_0xb6d4('0x3d')];if(!_0x12a3dc[_0xb6d4('0x3e')][_0xb6d4('0x43')](_0xb6d4('0x44'))){_0x7c5b7e[_0xb6d4('0x2f')]=qs['limit'](_0x12a3dc[_0xb6d4('0x3e')]['limit']);_0x7c5b7e[_0xb6d4('0x2d')]=qs[_0xb6d4('0x2d')](_0x12a3dc[_0xb6d4('0x3e')][_0xb6d4('0x2d')]);}_0x7c5b7e[_0xb6d4('0x45')]=qs[_0xb6d4('0x46')](_0x12a3dc['query']['sort']);_0x7c5b7e[_0xb6d4('0x47')]=qs['filters'](_['pick'](_0x12a3dc[_0xb6d4('0x3e')],_0x522a44[_0xb6d4('0x48')]),_0x54639e);if(_0x12a3dc[_0xb6d4('0x3e')]['filter']){_0x7c5b7e['where']=_[_0xb6d4('0x49')](_0x7c5b7e[_0xb6d4('0x47')],{'$or':_[_0xb6d4('0x39')](_0x54639e,function(_0x13d1cb){if(_0x13d1cb[_0xb6d4('0x4a')]!=='VIRTUAL'){var _0x1a3328={};_0x1a3328[_0x13d1cb[_0xb6d4('0x36')]]={'$like':'%'+_0x12a3dc[_0xb6d4('0x3e')][_0xb6d4('0x4b')]+'%'};return _0x1a3328;}})});}_0x7c5b7e=_[_0xb6d4('0x49')]({},_0x7c5b7e,_0x12a3dc[_0xb6d4('0x4c')]);var _0x5df729={'where':_0x7c5b7e['where']};return db[_0xb6d4('0x3a')]['count'](_0x5df729)['then'](function(_0x2f6f4f){_0x4167bf[_0xb6d4('0x30')]=_0x2f6f4f;if(_0x12a3dc[_0xb6d4('0x3e')][_0xb6d4('0x4d')]){_0x7c5b7e[_0xb6d4('0x4e')]=[{'all':!![]}];}return db[_0xb6d4('0x3a')][_0xb6d4('0x4f')](_0x7c5b7e);})['then'](function(_0x862453){_0x4167bf[_0xb6d4('0x50')]=_0x862453;return _0x4167bf;})[_0xb6d4('0x1f')](respondWithFilteredResult(_0x3a8d0e,_0x7c5b7e))[_0xb6d4('0x29')](handleError(_0x3a8d0e,null));};exports['show']=function(_0x59c32f,_0x59bbdf){var _0x496e0a={'raw':!![],'where':{'id':_0x59c32f['params']['id']}},_0x39a718={};_0x39a718[_0xb6d4('0x3d')]=_[_0xb6d4('0x3f')](db[_0xb6d4('0x3a')][_0xb6d4('0x3b')]);_0x39a718[_0xb6d4('0x3e')]=_[_0xb6d4('0x3f')](_0x59c32f['query']);_0x39a718['filters']=_[_0xb6d4('0x40')](_0x39a718[_0xb6d4('0x3d')],_0x39a718['query']);_0x496e0a[_0xb6d4('0x42')]=_[_0xb6d4('0x40')](_0x39a718[_0xb6d4('0x3d')],qs[_0xb6d4('0x41')](_0x59c32f[_0xb6d4('0x3e')]['fields']));_0x496e0a['attributes']=_0x496e0a['attributes'][_0xb6d4('0x51')]?_0x496e0a[_0xb6d4('0x42')]:_0x39a718[_0xb6d4('0x3d')];if(_0x59c32f[_0xb6d4('0x3e')][_0xb6d4('0x4d')]){_0x496e0a['include']=[{'all':!![]}];}_0x496e0a=_[_0xb6d4('0x49')]({},_0x496e0a,_0x59c32f['options']);return db[_0xb6d4('0x3a')][_0xb6d4('0x52')](_0x496e0a)[_0xb6d4('0x1f')](handleEntityNotFound(_0x59bbdf,null))['then'](respondWithResult(_0x59bbdf,null))[_0xb6d4('0x29')](handleError(_0x59bbdf,null));};exports[_0xb6d4('0x53')]=function(_0x554f44,_0x57374a){return db['SmsMessage']['create'](_0x554f44[_0xb6d4('0x54')],{})['then'](respondWithResult(_0x57374a,0xc9))[_0xb6d4('0x29')](handleError(_0x57374a,null));};exports[_0xb6d4('0x55')]=function(_0x505c69,_0x3efa2e){if(_0x505c69['body']['id']){delete _0x505c69[_0xb6d4('0x54')]['id'];}return db[_0xb6d4('0x3a')][_0xb6d4('0x52')]({'where':{'id':_0x505c69[_0xb6d4('0x56')]['id']}})[_0xb6d4('0x1f')](handleEntityNotFound(_0x3efa2e,null))['then'](saveUpdates(_0x505c69[_0xb6d4('0x54')],null))[_0xb6d4('0x1f')](respondWithResult(_0x3efa2e,null))[_0xb6d4('0x29')](handleError(_0x3efa2e,null));};exports['destroy']=function(_0x36a584,_0x50495e){return db[_0xb6d4('0x3a')][_0xb6d4('0x52')]({'where':{'id':_0x36a584['params']['id']}})[_0xb6d4('0x1f')](handleEntityNotFound(_0x50495e,null))[_0xb6d4('0x1f')](removeEntity(_0x50495e,null))[_0xb6d4('0x29')](handleError(_0x50495e,null));};exports[_0xb6d4('0x57')]=function(_0x54aa86,_0x580dbd){return db[_0xb6d4('0x3a')][_0xb6d4('0x57')]()['then'](respondWithResult(_0x580dbd,null))['catch'](handleError(_0x580dbd,null));};var interaction_log=require(_0xb6d4('0x58'))(_0xb6d4('0x59'));exports[_0xb6d4('0x5a')]=function(_0x57466e,_0x58628a,_0x2929ac){var _0x466d80={'agent':{},'channel':'sms'};if(_0x57466e[_0xb6d4('0x54')]['id']){delete _0x57466e[_0xb6d4('0x54')]['id'];}_0x57466e[_0xb6d4('0x54')][_0xb6d4('0x5b')]=!![];_0x57466e[_0xb6d4('0x54')][_0xb6d4('0x5c')]=moment()[_0xb6d4('0x5d')](_0xb6d4('0x5e'));_0x57466e[_0xb6d4('0x54')][_0xb6d4('0x5f')]=_0x57466e[_0xb6d4('0x54')][_0xb6d4('0x5f')]||_0x57466e[_0xb6d4('0x60')]['id'];_0x466d80[_0xb6d4('0x61')]['id']=_0x57466e[_0xb6d4('0x54')][_0xb6d4('0x5f')];return db[_0xb6d4('0x3a')][_0xb6d4('0x52')]({'where':{'id':_0x57466e[_0xb6d4('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x58628a,null))[_0xb6d4('0x1f')](saveUpdates(_0x57466e[_0xb6d4('0x54')],null))[_0xb6d4('0x1f')](function(_0x35541c){if(_0x35541c){_0x466d80[_0xb6d4('0x27')]=_0x35541c[_0xb6d4('0x62')]({'plain':!![]});return db[_0xb6d4('0x63')][_0xb6d4('0x52')]({'where':{'id':_0x35541c[_0xb6d4('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x58628a,null))[_0xb6d4('0x1f')](function(_0x12bea9){if(_0x12bea9){return _0x12bea9[_0xb6d4('0x55')]({'UserId':_0x57466e[_0xb6d4('0x54')]['UserId'],'read1stAt':_[_0xb6d4('0x65')](_0x12bea9['read1stAt'])?moment()[_0xb6d4('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x205a81){if(_0x205a81){_0x466d80[_0xb6d4('0x66')]=_0x205a81[_0xb6d4('0x62')]({'plain':!![]});interaction_log[_0xb6d4('0x20')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x57466e[_0xb6d4('0x60')]['id'],_0x57466e[_0xb6d4('0x60')][_0xb6d4('0x36')],_0x57466e[_0xb6d4('0x60')][_0xb6d4('0x67')],_0x466d80[_0xb6d4('0x66')]['id'],_0x57466e['body']?JSON['stringify'](_0x57466e[_0xb6d4('0x54')]):_0xb6d4('0x68'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x466d80);}return null;})[_0xb6d4('0x1f')](function(_0x92b9eb){var _0x2c8ad2=_0xb6d4('0x69')+_0x92b9eb[_0xb6d4('0x27')][_0xb6d4('0x6a')];return db[_0xb6d4('0x6b')][_0xb6d4('0x3e')](_0x2c8ad2,{'type':db['Sequelize'][_0xb6d4('0x6c')][_0xb6d4('0x6d')],'raw':!![]})['then'](function(_0x3fb752){return _0x3fb752;});})[_0xb6d4('0x1f')](function(_0x4898a6){if(_0x4898a6){_0x466d80[_0xb6d4('0x27')][_0xb6d4('0x6e')]=_0x4898a6[0x0];if(!_0x57466e[_0xb6d4('0x54')][_0xb6d4('0x5f')])return;return db[_0xb6d4('0x6f')][_0xb6d4('0x52')]({'where':{'id':_0x57466e[_0xb6d4('0x54')][_0xb6d4('0x5f')],'role':_0xb6d4('0x61')},'attributes':['id',_0xb6d4('0x36'),_0xb6d4('0x70'),_0xb6d4('0x71'),_0xb6d4('0x72')],'raw':!![]});}return null;})[_0xb6d4('0x1f')](function(_0x43249a){if(!_0x43249a)return null;_0x466d80[_0xb6d4('0x27')]['agent']=_0x43249a;return _0x466d80;})['then'](function(_0x5b0a3b){if(_0x5b0a3b){if(_0x57466e[_0xb6d4('0x54')][_0xb6d4('0x73')]){_0x466d80[_0xb6d4('0x27')][_0xb6d4('0x74')]=util[_0xb6d4('0x5d')](_0xb6d4('0x75'),_0x57466e[_0xb6d4('0x60')][_0xb6d4('0x36')]);_0x466d80[_0xb6d4('0x27')]['channel']=_0x466d80['channel'];_0x466d80['message'][_0xb6d4('0x76')]=_0x466d80[_0xb6d4('0x77')];_0x466d80[_0xb6d4('0x27')][_0xb6d4('0x78')]=_0xb6d4('0x5a');return respondWithRpcPromise(_0xb6d4('0x79'),_0xb6d4('0x79'),{'event':'acceptmessage','message':_0x466d80[_0xb6d4('0x27')]},client9002)[_0xb6d4('0x1f')](function(){return _0x466d80;});}return _0x466d80;}return null;})['then'](respondWithResult(_0x58628a,null))['catch'](handleError(_0x58628a,null));};var interaction_log=require(_0xb6d4('0x58'))(_0xb6d4('0x59'));exports[_0xb6d4('0x33')]=function(_0x44de4f,_0x4ea278,_0xea4ed8){var _0x30e4dc={'agent':{},'channel':_0xb6d4('0x7a')};if(_0x44de4f[_0xb6d4('0x54')]['id']){delete _0x44de4f[_0xb6d4('0x54')]['id'];}_0x44de4f[_0xb6d4('0x54')][_0xb6d4('0x5f')]=_0x44de4f['body']['UserId']||_0x44de4f[_0xb6d4('0x60')]['id'];_0x30e4dc[_0xb6d4('0x61')]['id']=_0x44de4f[_0xb6d4('0x54')][_0xb6d4('0x5f')];return db[_0xb6d4('0x3a')][_0xb6d4('0x52')]({'where':{'id':_0x44de4f[_0xb6d4('0x56')]['id'],'UserId':null}})[_0xb6d4('0x1f')](handleEntityNotFound(_0x4ea278,null))[_0xb6d4('0x1f')](function(_0x47e108){if(_0x47e108){_0x30e4dc['message']=_0x47e108['get']({'plain':!![]});return db[_0xb6d4('0x63')][_0xb6d4('0x52')]({'where':{'id':_0x47e108[_0xb6d4('0x64')]}});}return null;})[_0xb6d4('0x1f')](handleEntityNotFound(_0x4ea278,null))['then'](function(_0x3e20a6){if(_0x3e20a6){_0x30e4dc[_0xb6d4('0x66')]=_0x3e20a6[_0xb6d4('0x62')]({'plain':!![]});interaction_log[_0xb6d4('0x20')](_0xb6d4('0x7b'),_0x44de4f['user']['id'],_0x44de4f['user'][_0xb6d4('0x36')],_0x44de4f[_0xb6d4('0x60')][_0xb6d4('0x67')],_0x30e4dc[_0xb6d4('0x66')]['id'],_0x44de4f[_0xb6d4('0x54')]?JSON['stringify'](_0x44de4f['body']):_0xb6d4('0x68'));return respondWithRpcPromise(_0xb6d4('0x7c'),_0xb6d4('0x7d'),_0x30e4dc);}return null;})[_0xb6d4('0x1f')](function(_0x3a1f88){var _0x403cfe=_0xb6d4('0x69')+_0x3a1f88[_0xb6d4('0x27')][_0xb6d4('0x6a')];return db['sequelize'][_0xb6d4('0x3e')](_0x403cfe,{'type':db[_0xb6d4('0x7e')][_0xb6d4('0x6c')]['SELECT'],'raw':!![]})[_0xb6d4('0x1f')](function(_0x28a16f){return _0x28a16f;});})[_0xb6d4('0x1f')](function(_0x149966){if(_0x149966){_0x30e4dc[_0xb6d4('0x27')][_0xb6d4('0x6e')]=_0x149966[0x0];if(!_0x44de4f[_0xb6d4('0x54')]['UserId'])return;return db[_0xb6d4('0x6f')]['find']({'where':{'id':_0x44de4f[_0xb6d4('0x54')][_0xb6d4('0x5f')],'role':'agent'},'attributes':['id','name','fullname',_0xb6d4('0x71'),_0xb6d4('0x72')],'raw':!![]});}return null;})['then'](function(_0x1d5abe){if(!_0x1d5abe)return null;_0x30e4dc[_0xb6d4('0x27')][_0xb6d4('0x61')]=_0x1d5abe;return _0x30e4dc;})['then'](function(_0x581a24){if(_0x581a24){_0x581a24[_0xb6d4('0x27')][_0xb6d4('0x74')]=util[_0xb6d4('0x5d')](_0xb6d4('0x75'),_0x44de4f[_0xb6d4('0x60')][_0xb6d4('0x36')]);_0x581a24[_0xb6d4('0x27')][_0xb6d4('0x77')]=_0x30e4dc[_0xb6d4('0x77')];_0x581a24[_0xb6d4('0x27')]['motionChannel']=_0x30e4dc[_0xb6d4('0x77')];_0x581a24[_0xb6d4('0x27')][_0xb6d4('0x78')]=_0xb6d4('0x33');respondWithRpcPromise('EventManager',_0xb6d4('0x79'),{'event':'rejectmessage','message':_0x581a24[_0xb6d4('0x27')]},client9002);return _0x30e4dc;}return null;})[_0xb6d4('0x1f')](respondWithResult(_0x4ea278,null))['catch'](handleError(_0x4ea278,null));};exports[_0xb6d4('0x31')]=function(_0x486298,_0x464b43,_0x1e16b2){if(_0x486298[_0xb6d4('0x54')]['id']){delete _0x486298['body']['id'];}var _0xc6b737;return db[_0xb6d4('0x3a')]['find']({'where':{'id':_0x486298[_0xb6d4('0x56')]['id']}})[_0xb6d4('0x1f')](handleEntityNotFound(_0x464b43,null))[_0xb6d4('0x1f')](function(_0x505424){if(_0x505424){_0xc6b737=_0x505424;return db[_0xb6d4('0x7f')][_0xb6d4('0x52')]({'where':{'id':_0x505424[_0xb6d4('0x80')]}});}})['then'](handleEntityNotFound(_0x464b43,null))[_0xb6d4('0x1f')](function(_0x11f68d){if(_0x11f68d){logger[_0xb6d4('0x23')](_0xb6d4('0x81'),_0xb6d4('0x31'),_0xb6d4('0x82'),_0x11f68d[_0xb6d4('0x4a')],util['inspect'](_0x486298['body'],{'showHidden':![],'depth':null}));switch(_0x11f68d[_0xb6d4('0x4a')]){case'twilio':if(_0x486298[_0xb6d4('0x54')]['MessageSid']&&_0x486298[_0xb6d4('0x54')][_0xb6d4('0x83')]===_0xc6b737[_0xb6d4('0x84')]){return _0xc6b737[_0xb6d4('0x55')]({'read':!![]});}else{logger[_0xb6d4('0x25')](_0xb6d4('0x85'),_0xb6d4('0x31'),_0xb6d4('0x86'),util['inspect'](_0x486298[_0xb6d4('0x54')],{'showHidden':![],'depth':null}));}break;case _0xb6d4('0x87'):if(_0x486298[_0xb6d4('0x54')][_0xb6d4('0x88')]&&_0x486298[_0xb6d4('0x54')][_0xb6d4('0x88')]===_0xc6b737[_0xb6d4('0x84')]&&_[_0xb6d4('0x89')]([_0xb6d4('0x8a'),'delivered'],_0x486298[_0xb6d4('0x54')][_0xb6d4('0x8b')])>=0x0){return _0xc6b737['update']({'read':!![]});}else{logger['error'](_0xb6d4('0x85'),_0xb6d4('0x31'),_0xb6d4('0x8c'),util[_0xb6d4('0x8d')](_0x486298[_0xb6d4('0x54')],{'showHidden':![],'depth':null}));}break;case _0xb6d4('0x8e'):var _0x57852a=_0x486298[_0xb6d4('0x54')]['results'][0x0];if(_0x57852a[_0xb6d4('0x31')][_0xb6d4('0x8f')]===_0xb6d4('0x90')){return _0xc6b737[_0xb6d4('0x55')]({'read':!![]});}else{logger[_0xb6d4('0x25')](_0xb6d4('0x85'),_0xb6d4('0x31'),_0xb6d4('0x8e'),util[_0xb6d4('0x8d')](_0x486298[_0xb6d4('0x54')],{'showHidden':![],'depth':null}));}break;}return _0xc6b737;}})[_0xb6d4('0x1f')](respondWithResult(_0x464b43,null))['catch'](handleError(_0x464b43,null));}; \ No newline at end of file +var _0x9a2a=['SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','MessageUUID','indexOf','Status','plivio','results','groupName','DELIVERED','infobip','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','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','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','SmsMessage','findAll','rows','params','include','find','create','body','sms-interactions','accept','read','readAt','UserId','get','SmsInteraction','SmsInteractionId','update','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','rejectmessage','SmsAccount'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9a2a,0xa7));var _0xa9a2=function(_0x263b4c,_0x2820bf){_0x263b4c=_0x263b4c-0x0;var _0x149bb1=_0x9a2a[_0x263b4c];return _0x149bb1;};'use strict';var emlformat=require(_0xa9a2('0x0'));var rimraf=require(_0xa9a2('0x1'));var zipdir=require(_0xa9a2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa9a2('0x3'));var Mustache=require(_0xa9a2('0x4'));var util=require(_0xa9a2('0x5'));var path=require(_0xa9a2('0x6'));var sox=require(_0xa9a2('0x7'));var csv=require(_0xa9a2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa9a2('0x9'));var squel=require(_0xa9a2('0xa'));var crypto=require(_0xa9a2('0xb'));var jsforce=require(_0xa9a2('0xc'));var deskjs=require(_0xa9a2('0xd'));var toCsv=require(_0xa9a2('0x8'));var querystring=require(_0xa9a2('0xe'));var Papa=require(_0xa9a2('0xf'));var Redis=require(_0xa9a2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa9a2('0x11'));var as=require(_0xa9a2('0x12'));var hardwareService=require(_0xa9a2('0x13'));var logger=require(_0xa9a2('0x14'))(_0xa9a2('0x15'));var utils=require(_0xa9a2('0x16'));var config=require(_0xa9a2('0x17'));var licenseUtil=require(_0xa9a2('0x18'));var db=require(_0xa9a2('0x19'))['db'];config[_0xa9a2('0x1a')]=_['defaults'](config[_0xa9a2('0x1a')],{'host':_0xa9a2('0x1b'),'port':0x18eb});var socket=require(_0xa9a2('0x1c'))(new Redis(config[_0xa9a2('0x1a')]));require(_0xa9a2('0x1d'))[_0xa9a2('0x1e')](socket);var jayson=require(_0xa9a2('0x1f'));var client=jayson[_0xa9a2('0x20')][_0xa9a2('0x21')]({'port':0x232c});var client9002=jayson[_0xa9a2('0x20')][_0xa9a2('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x9a2b5f,_0x1c2ae9,_0x47fec4,_0x20037e){return new BPromise(function(_0xbb6546,_0x232665){var _0x44cfb7=_0x20037e||client;return _0x44cfb7[_0xa9a2('0x22')](_0x9a2b5f,_0x47fec4)[_0xa9a2('0x23')](function(_0x4e3f13){logger[_0xa9a2('0x24')](_0xa9a2('0x25'),_0x1c2ae9,_0xa9a2('0x26'));logger[_0xa9a2('0x27')](_0xa9a2('0x28'),_0x1c2ae9,_0xa9a2('0x26'),JSON[_0xa9a2('0x29')](_0x4e3f13));if(_0x4e3f13[_0xa9a2('0x2a')]){if(_0x4e3f13[_0xa9a2('0x2a')]['code']===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x1c2ae9,_0x4e3f13[_0xa9a2('0x2a')][_0xa9a2('0x2b')]);return _0x232665(_0x4e3f13[_0xa9a2('0x2a')]['message']);}logger[_0xa9a2('0x2a')]('SmsMessage,\x20%s,\x20%s',_0x1c2ae9,_0x4e3f13['error'][_0xa9a2('0x2b')]);return _0xbb6546(_0x4e3f13['error'][_0xa9a2('0x2b')]);}else{logger[_0xa9a2('0x24')]('SmsMessage,\x20%s,\x20%s',_0x1c2ae9,_0xa9a2('0x26'));_0xbb6546(_0x4e3f13[_0xa9a2('0x2c')][_0xa9a2('0x2b')]);}})[_0xa9a2('0x2d')](function(_0x21078c){logger['error'](_0xa9a2('0x25'),_0x1c2ae9,_0x21078c);_0x232665(_0x21078c);});});}function respondWithStatusCode(_0x2ab71,_0x512010){_0x512010=_0x512010||0xcc;return function(_0x41391f){if(_0x41391f){return _0x2ab71[_0xa9a2('0x2e')](_0x512010);}return _0x2ab71[_0xa9a2('0x2f')](_0x512010)[_0xa9a2('0x30')]();};}function respondWithResult(_0x3fd6e0,_0x52d7e3){_0x52d7e3=_0x52d7e3||0xc8;return function(_0x287c53){if(_0x287c53){return _0x3fd6e0['status'](_0x52d7e3)[_0xa9a2('0x31')](_0x287c53);}};}function respondWithFilteredResult(_0x56d01b,_0x4bb549){return function(_0x56f120){if(_0x56f120){var _0x4b2d65=typeof _0x4bb549['offset']===_0xa9a2('0x32')&&typeof _0x4bb549[_0xa9a2('0x33')]===_0xa9a2('0x32');var _0x3da3ca=_0x56f120[_0xa9a2('0x34')];var _0x34e754=_0x4b2d65?0x0:_0x4bb549[_0xa9a2('0x35')];var _0x3c035c=_0x4b2d65?_0x56f120['count']:_0x4bb549[_0xa9a2('0x35')]+_0x4bb549[_0xa9a2('0x33')];var _0x41ca6e;if(_0x3c035c>=_0x3da3ca){_0x3c035c=_0x3da3ca;_0x41ca6e=0xc8;}else{_0x41ca6e=0xce;}_0x56d01b[_0xa9a2('0x2f')](_0x41ca6e);return _0x56d01b[_0xa9a2('0x36')](_0xa9a2('0x37'),_0x34e754+'-'+_0x3c035c+'/'+_0x3da3ca)[_0xa9a2('0x31')](_0x56f120);}return null;};}function patchUpdates(_0x487bb0){return function(_0x13a3ce){try{jsonpatch[_0xa9a2('0x38')](_0x13a3ce,_0x487bb0,!![]);}catch(_0x358bb9){return BPromise[_0xa9a2('0x39')](_0x358bb9);}return _0x13a3ce[_0xa9a2('0x3a')]();};}function saveUpdates(_0x55fe73,_0x33a9f7){return function(_0x40e307){if(_0x40e307){return _0x40e307['update'](_0x55fe73)['then'](function(_0x13ea5e){return _0x13ea5e;});}return null;};}function removeEntity(_0x1b9e8c,_0x41b4a7){return function(_0x106914){if(_0x106914){return _0x106914[_0xa9a2('0x3b')]()['then'](function(){_0x1b9e8c[_0xa9a2('0x2f')](0xcc)[_0xa9a2('0x30')]();});}};}function handleEntityNotFound(_0x21f818,_0x5a2183){return function(_0x2d7f9a){if(!_0x2d7f9a){_0x21f818[_0xa9a2('0x2e')](0x194);}return _0x2d7f9a;};}function handleError(_0xb96fe,_0x539881){_0x539881=_0x539881||0x1f4;return function(_0x2580f2){logger[_0xa9a2('0x2a')](_0x2580f2[_0xa9a2('0x3c')]);if(_0x2580f2[_0xa9a2('0x3d')]){delete _0x2580f2[_0xa9a2('0x3d')];}_0xb96fe[_0xa9a2('0x2f')](_0x539881)[_0xa9a2('0x3e')](_0x2580f2);};}exports[_0xa9a2('0x3f')]=function(_0x152c6f,_0xe22d8c){var _0x87e99b={},_0x199469={},_0x38b3c2={'count':0x0,'rows':[]};var _0x1ef9f0=_['map'](db['SmsMessage'][_0xa9a2('0x40')],function(_0x13b6fc){return{'name':_0x13b6fc[_0xa9a2('0x41')],'type':_0x13b6fc[_0xa9a2('0x42')]['key']};});_0x199469[_0xa9a2('0x43')]=_[_0xa9a2('0x44')](_0x1ef9f0,_0xa9a2('0x3d'));_0x199469[_0xa9a2('0x45')]=_[_0xa9a2('0x46')](_0x152c6f['query']);_0x199469[_0xa9a2('0x47')]=_[_0xa9a2('0x48')](_0x199469[_0xa9a2('0x43')],_0x199469['query']);_0x87e99b['attributes']=_[_0xa9a2('0x48')](_0x199469['model'],qs[_0xa9a2('0x49')](_0x152c6f[_0xa9a2('0x45')][_0xa9a2('0x49')]));_0x87e99b[_0xa9a2('0x4a')]=_0x87e99b[_0xa9a2('0x4a')][_0xa9a2('0x4b')]?_0x87e99b[_0xa9a2('0x4a')]:_0x199469[_0xa9a2('0x43')];if(!_0x152c6f[_0xa9a2('0x45')][_0xa9a2('0x4c')](_0xa9a2('0x4d'))){_0x87e99b['limit']=qs[_0xa9a2('0x33')](_0x152c6f[_0xa9a2('0x45')][_0xa9a2('0x33')]);_0x87e99b[_0xa9a2('0x35')]=qs[_0xa9a2('0x35')](_0x152c6f[_0xa9a2('0x45')][_0xa9a2('0x35')]);}_0x87e99b[_0xa9a2('0x4e')]=qs[_0xa9a2('0x4f')](_0x152c6f[_0xa9a2('0x45')]['sort']);_0x87e99b[_0xa9a2('0x50')]=qs[_0xa9a2('0x47')](_['pick'](_0x152c6f[_0xa9a2('0x45')],_0x199469[_0xa9a2('0x47')]),_0x1ef9f0);if(_0x152c6f['query'][_0xa9a2('0x51')]){_0x87e99b[_0xa9a2('0x50')]=_['merge'](_0x87e99b[_0xa9a2('0x50')],{'$or':_['map'](_0x1ef9f0,function(_0x550ed6){if(_0x550ed6[_0xa9a2('0x42')]!==_0xa9a2('0x52')){var _0x3140de={};_0x3140de[_0x550ed6[_0xa9a2('0x3d')]]={'$like':'%'+_0x152c6f[_0xa9a2('0x45')][_0xa9a2('0x51')]+'%'};return _0x3140de;}})});}_0x87e99b=_[_0xa9a2('0x53')]({},_0x87e99b,_0x152c6f[_0xa9a2('0x54')]);var _0x3a0934={'where':_0x87e99b[_0xa9a2('0x50')]};return db['SmsMessage'][_0xa9a2('0x34')](_0x3a0934)[_0xa9a2('0x23')](function(_0x523c8e){_0x38b3c2['count']=_0x523c8e;if(_0x152c6f[_0xa9a2('0x45')]['includeAll']){_0x87e99b['include']=[{'all':!![]}];}return db[_0xa9a2('0x55')][_0xa9a2('0x56')](_0x87e99b);})[_0xa9a2('0x23')](function(_0x381cae){_0x38b3c2[_0xa9a2('0x57')]=_0x381cae;return _0x38b3c2;})[_0xa9a2('0x23')](respondWithFilteredResult(_0xe22d8c,_0x87e99b))[_0xa9a2('0x2d')](handleError(_0xe22d8c,null));};exports['show']=function(_0x1c5549,_0x1f8742){var _0x4cb57e={'raw':!![],'where':{'id':_0x1c5549[_0xa9a2('0x58')]['id']}},_0x25a5dd={};_0x25a5dd['model']=_[_0xa9a2('0x46')](db[_0xa9a2('0x55')][_0xa9a2('0x40')]);_0x25a5dd['query']=_[_0xa9a2('0x46')](_0x1c5549['query']);_0x25a5dd['filters']=_[_0xa9a2('0x48')](_0x25a5dd[_0xa9a2('0x43')],_0x25a5dd[_0xa9a2('0x45')]);_0x4cb57e['attributes']=_[_0xa9a2('0x48')](_0x25a5dd[_0xa9a2('0x43')],qs[_0xa9a2('0x49')](_0x1c5549[_0xa9a2('0x45')]['fields']));_0x4cb57e[_0xa9a2('0x4a')]=_0x4cb57e['attributes'][_0xa9a2('0x4b')]?_0x4cb57e[_0xa9a2('0x4a')]:_0x25a5dd['model'];if(_0x1c5549['query']['includeAll']){_0x4cb57e[_0xa9a2('0x59')]=[{'all':!![]}];}_0x4cb57e=_[_0xa9a2('0x53')]({},_0x4cb57e,_0x1c5549['options']);return db[_0xa9a2('0x55')][_0xa9a2('0x5a')](_0x4cb57e)[_0xa9a2('0x23')](handleEntityNotFound(_0x1f8742,null))[_0xa9a2('0x23')](respondWithResult(_0x1f8742,null))[_0xa9a2('0x2d')](handleError(_0x1f8742,null));};exports[_0xa9a2('0x5b')]=function(_0x11a0d0,_0x19486b){return db[_0xa9a2('0x55')][_0xa9a2('0x5b')](_0x11a0d0[_0xa9a2('0x5c')],{})[_0xa9a2('0x23')](respondWithResult(_0x19486b,0xc9))['catch'](handleError(_0x19486b,null));};exports['update']=function(_0x21071f,_0x4c7f02){if(_0x21071f[_0xa9a2('0x5c')]['id']){delete _0x21071f[_0xa9a2('0x5c')]['id'];}return db[_0xa9a2('0x55')][_0xa9a2('0x5a')]({'where':{'id':_0x21071f[_0xa9a2('0x58')]['id']}})[_0xa9a2('0x23')](handleEntityNotFound(_0x4c7f02,null))[_0xa9a2('0x23')](saveUpdates(_0x21071f[_0xa9a2('0x5c')],null))['then'](respondWithResult(_0x4c7f02,null))[_0xa9a2('0x2d')](handleError(_0x4c7f02,null));};exports['destroy']=function(_0x1a3f4b,_0x411b27){return db[_0xa9a2('0x55')][_0xa9a2('0x5a')]({'where':{'id':_0x1a3f4b[_0xa9a2('0x58')]['id']}})[_0xa9a2('0x23')](handleEntityNotFound(_0x411b27,null))['then'](removeEntity(_0x411b27,null))[_0xa9a2('0x2d')](handleError(_0x411b27,null));};exports['describe']=function(_0x55dba8,_0x42cbf8){return db[_0xa9a2('0x55')]['describe']()[_0xa9a2('0x23')](respondWithResult(_0x42cbf8,null))[_0xa9a2('0x2d')](handleError(_0x42cbf8,null));};var interaction_log=require(_0xa9a2('0x14'))(_0xa9a2('0x5d'));exports[_0xa9a2('0x5e')]=function(_0x199276,_0x13a62a,_0x4e2acc){var _0x3d76c3={'agent':{},'channel':'sms'};if(_0x199276['body']['id']){delete _0x199276[_0xa9a2('0x5c')]['id'];}_0x199276[_0xa9a2('0x5c')][_0xa9a2('0x5f')]=!![];_0x199276[_0xa9a2('0x5c')][_0xa9a2('0x60')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x199276[_0xa9a2('0x5c')][_0xa9a2('0x61')]=_0x199276['body'][_0xa9a2('0x61')]||_0x199276['user']['id'];_0x3d76c3['agent']['id']=_0x199276[_0xa9a2('0x5c')][_0xa9a2('0x61')];return db['SmsMessage'][_0xa9a2('0x5a')]({'where':{'id':_0x199276[_0xa9a2('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x13a62a,null))['then'](saveUpdates(_0x199276[_0xa9a2('0x5c')],null))[_0xa9a2('0x23')](function(_0x2143de){if(_0x2143de){_0x3d76c3[_0xa9a2('0x2b')]=_0x2143de[_0xa9a2('0x62')]({'plain':!![]});return db[_0xa9a2('0x63')][_0xa9a2('0x5a')]({'where':{'id':_0x2143de[_0xa9a2('0x64')]}});}return null;})[_0xa9a2('0x23')](handleEntityNotFound(_0x13a62a,null))[_0xa9a2('0x23')](function(_0x231c2e){if(_0x231c2e){return _0x231c2e[_0xa9a2('0x65')]({'UserId':_0x199276[_0xa9a2('0x5c')][_0xa9a2('0x61')],'read1stAt':_[_0xa9a2('0x66')](_0x231c2e[_0xa9a2('0x67')])?moment()[_0xa9a2('0x68')](_0xa9a2('0x69')):undefined});}return null;})['then'](function(_0x1571b3){if(_0x1571b3){_0x3d76c3[_0xa9a2('0x6a')]=_0x1571b3[_0xa9a2('0x62')]({'plain':!![]});interaction_log[_0xa9a2('0x24')](_0xa9a2('0x6b'),_0x199276['user']['id'],_0x199276[_0xa9a2('0x6c')][_0xa9a2('0x3d')],_0x199276[_0xa9a2('0x6c')][_0xa9a2('0x6d')],_0x3d76c3[_0xa9a2('0x6a')]['id'],_0x199276[_0xa9a2('0x5c')]?JSON[_0xa9a2('0x29')](_0x199276[_0xa9a2('0x5c')]):_0xa9a2('0x6e'));return respondWithRpcPromise(_0xa9a2('0x6f'),_0xa9a2('0x70'),_0x3d76c3);}return null;})[_0xa9a2('0x23')](function(_0x291992){var _0x147db1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x291992['message'][_0xa9a2('0x71')];return db['sequelize'][_0xa9a2('0x45')](_0x147db1,{'type':db[_0xa9a2('0x72')][_0xa9a2('0x73')][_0xa9a2('0x74')],'raw':!![]})['then'](function(_0x32ff1c){return _0x32ff1c;});})['then'](function(_0x424561){if(_0x424561){_0x3d76c3[_0xa9a2('0x2b')][_0xa9a2('0x75')]=_0x424561[0x0];if(!_0x199276[_0xa9a2('0x5c')][_0xa9a2('0x61')])return;return db[_0xa9a2('0x76')][_0xa9a2('0x5a')]({'where':{'id':_0x199276[_0xa9a2('0x5c')][_0xa9a2('0x61')],'role':_0xa9a2('0x77')},'attributes':['id',_0xa9a2('0x3d'),_0xa9a2('0x78'),_0xa9a2('0x79'),_0xa9a2('0x7a')],'raw':!![]});}return null;})[_0xa9a2('0x23')](function(_0x55b897){if(!_0x55b897)return null;_0x3d76c3[_0xa9a2('0x2b')][_0xa9a2('0x77')]=_0x55b897;return _0x3d76c3;})['then'](function(_0x27d40d){if(_0x27d40d){if(_0x199276[_0xa9a2('0x5c')][_0xa9a2('0x7b')]){_0x3d76c3[_0xa9a2('0x2b')][_0xa9a2('0x7c')]=util[_0xa9a2('0x68')](_0xa9a2('0x7d'),_0x199276['user']['name']);_0x3d76c3[_0xa9a2('0x2b')][_0xa9a2('0x7e')]=_0x3d76c3['channel'];_0x3d76c3['message'][_0xa9a2('0x7f')]=_0x3d76c3['channel'];_0x3d76c3[_0xa9a2('0x2b')]['event']=_0xa9a2('0x5e');return respondWithRpcPromise(_0xa9a2('0x80'),_0xa9a2('0x80'),{'event':'acceptmessage','message':_0x3d76c3[_0xa9a2('0x2b')]},client9002)[_0xa9a2('0x23')](function(){return _0x3d76c3;});}return _0x3d76c3;}return null;})[_0xa9a2('0x23')](respondWithResult(_0x13a62a,null))[_0xa9a2('0x2d')](handleError(_0x13a62a,null));};var interaction_log=require(_0xa9a2('0x14'))('sms-interactions');exports[_0xa9a2('0x39')]=function(_0x3aed96,_0x6bf49c,_0xf6a22c){var _0x79971d={'agent':{},'channel':_0xa9a2('0x81')};if(_0x3aed96[_0xa9a2('0x5c')]['id']){delete _0x3aed96['body']['id'];}_0x3aed96[_0xa9a2('0x5c')][_0xa9a2('0x61')]=_0x3aed96[_0xa9a2('0x5c')][_0xa9a2('0x61')]||_0x3aed96[_0xa9a2('0x6c')]['id'];_0x79971d['agent']['id']=_0x3aed96[_0xa9a2('0x5c')][_0xa9a2('0x61')];return db[_0xa9a2('0x55')]['find']({'where':{'id':_0x3aed96[_0xa9a2('0x58')]['id'],'UserId':null}})[_0xa9a2('0x23')](handleEntityNotFound(_0x6bf49c,null))[_0xa9a2('0x23')](function(_0x11dcb1){if(_0x11dcb1){_0x79971d[_0xa9a2('0x2b')]=_0x11dcb1[_0xa9a2('0x62')]({'plain':!![]});return db[_0xa9a2('0x63')][_0xa9a2('0x5a')]({'where':{'id':_0x11dcb1[_0xa9a2('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x6bf49c,null))[_0xa9a2('0x23')](function(_0x4a7336){if(_0x4a7336){_0x79971d[_0xa9a2('0x6a')]=_0x4a7336['get']({'plain':!![]});interaction_log[_0xa9a2('0x24')](_0xa9a2('0x82'),_0x3aed96[_0xa9a2('0x6c')]['id'],_0x3aed96[_0xa9a2('0x6c')][_0xa9a2('0x3d')],_0x3aed96[_0xa9a2('0x6c')][_0xa9a2('0x6d')],_0x79971d['interaction']['id'],_0x3aed96[_0xa9a2('0x5c')]?JSON['stringify'](_0x3aed96[_0xa9a2('0x5c')]):_0xa9a2('0x6e'));return respondWithRpcPromise(_0xa9a2('0x83'),_0xa9a2('0x84'),_0x79971d);}return null;})[_0xa9a2('0x23')](function(_0x1bc670){var _0x4b7c20=_0xa9a2('0x85')+_0x1bc670['message'][_0xa9a2('0x71')];return db[_0xa9a2('0x86')]['query'](_0x4b7c20,{'type':db['Sequelize']['QueryTypes'][_0xa9a2('0x74')],'raw':!![]})[_0xa9a2('0x23')](function(_0x4d57aa){return _0x4d57aa;});})[_0xa9a2('0x23')](function(_0x3ecb47){if(_0x3ecb47){_0x79971d['message'][_0xa9a2('0x75')]=_0x3ecb47[0x0];if(!_0x3aed96['body'][_0xa9a2('0x61')])return;return db[_0xa9a2('0x76')][_0xa9a2('0x5a')]({'where':{'id':_0x3aed96[_0xa9a2('0x5c')][_0xa9a2('0x61')],'role':_0xa9a2('0x77')},'attributes':['id',_0xa9a2('0x3d'),'fullname',_0xa9a2('0x79'),_0xa9a2('0x7a')],'raw':!![]});}return null;})[_0xa9a2('0x23')](function(_0x20cbf8){if(!_0x20cbf8)return null;_0x79971d[_0xa9a2('0x2b')][_0xa9a2('0x77')]=_0x20cbf8;return _0x79971d;})[_0xa9a2('0x23')](function(_0x1b19f9){if(_0x1b19f9){_0x1b19f9[_0xa9a2('0x2b')][_0xa9a2('0x7c')]=util[_0xa9a2('0x68')](_0xa9a2('0x7d'),_0x3aed96['user'][_0xa9a2('0x3d')]);_0x1b19f9['message'][_0xa9a2('0x7e')]=_0x79971d[_0xa9a2('0x7e')];_0x1b19f9['message']['motionChannel']=_0x79971d[_0xa9a2('0x7e')];_0x1b19f9[_0xa9a2('0x2b')]['event']='reject';respondWithRpcPromise('EventManager',_0xa9a2('0x80'),{'event':_0xa9a2('0x87'),'message':_0x1b19f9[_0xa9a2('0x2b')]},client9002);return _0x79971d;}return null;})[_0xa9a2('0x23')](respondWithResult(_0x6bf49c,null))['catch'](handleError(_0x6bf49c,null));};exports['status']=function(_0x78055c,_0x3a0f59,_0x3f6d5c){if(_0x78055c['body']['id']){delete _0x78055c[_0xa9a2('0x5c')]['id'];}var _0x1cc54c;return db[_0xa9a2('0x55')]['find']({'where':{'id':_0x78055c[_0xa9a2('0x58')]['id']}})['then'](handleEntityNotFound(_0x3a0f59,null))[_0xa9a2('0x23')](function(_0x374a5d){if(_0x374a5d){_0x1cc54c=_0x374a5d;return db[_0xa9a2('0x88')][_0xa9a2('0x5a')]({'where':{'id':_0x374a5d[_0xa9a2('0x89')]}});}})[_0xa9a2('0x23')](handleEntityNotFound(_0x3a0f59,null))[_0xa9a2('0x23')](function(_0x71191f){if(_0x71191f){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa9a2('0x2f'),_0xa9a2('0x8a'),_0x71191f['type'],util['inspect'](_0x78055c[_0xa9a2('0x5c')],{'showHidden':![],'depth':null}));switch(_0x71191f['type']){case _0xa9a2('0x8b'):if(_0x78055c[_0xa9a2('0x5c')][_0xa9a2('0x8c')]&&_0x78055c[_0xa9a2('0x5c')][_0xa9a2('0x8c')]===_0x1cc54c[_0xa9a2('0x8d')]){return _0x1cc54c[_0xa9a2('0x65')]({'read':!![]});}else{logger[_0xa9a2('0x2a')](_0xa9a2('0x8e'),'status',_0xa9a2('0x8b'),util[_0xa9a2('0x8f')](_0x78055c[_0xa9a2('0x5c')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x78055c[_0xa9a2('0x5c')]['MessageUUID']&&_0x78055c['body'][_0xa9a2('0x90')]===_0x1cc54c['messageId']&&_[_0xa9a2('0x91')](['sent','delivered'],_0x78055c[_0xa9a2('0x5c')][_0xa9a2('0x92')])>=0x0){return _0x1cc54c[_0xa9a2('0x65')]({'read':!![]});}else{logger['error'](_0xa9a2('0x8e'),_0xa9a2('0x2f'),_0xa9a2('0x93'),util[_0xa9a2('0x8f')](_0x78055c[_0xa9a2('0x5c')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3eb16f=_0x78055c['body'][_0xa9a2('0x94')][0x0];if(_0x3eb16f['status'][_0xa9a2('0x95')]===_0xa9a2('0x96')){return _0x1cc54c['update']({'read':!![]});}else{logger[_0xa9a2('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xa9a2('0x97'),util['inspect'](_0x78055c[_0xa9a2('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x1cc54c;}})[_0xa9a2('0x23')](respondWithResult(_0x3a0f59,null))[_0xa9a2('0x2d')](handleError(_0x3a0f59,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 48969a6..1c6cf72 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 _0xbdbe=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xbdbe,0x1d0));var _0xebdb=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xbdbe[_0x5d6456];return _0x4d66c1;};'use strict';var EventEmitter=require(_0xebdb('0x0'));var SmsMessage=require(_0xebdb('0x1'))['db'][_0xebdb('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xebdb('0x3')](0x0);var events={'afterCreate':_0xebdb('0x4'),'afterUpdate':_0xebdb('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4a0af0){return function(_0x3fe136,_0x456d83,_0x352e08){SmsMessageEvents['emit'](_0x4a0af0+':'+_0x3fe136['id'],_0x3fe136);SmsMessageEvents[_0xebdb('0x6')](_0x4a0af0,_0x3fe136);_0x352e08(null);};}for(var e in events){if(events[_0xebdb('0x7')](e)){var event=events[e];SmsMessage[_0xebdb('0x8')](e,emitEvent(event));}}module[_0xebdb('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0x8097=['remove','emit','hasOwnProperty','events','../../mysqldb','SmsMessage','save'];(function(_0x59c32a,_0x3665ea){var _0x4c4751=function(_0x75ce32){while(--_0x75ce32){_0x59c32a['push'](_0x59c32a['shift']());}};_0x4c4751(++_0x3665ea);}(_0x8097,0x1f4));var _0x7809=function(_0xe1ad28,_0x182f9b){_0xe1ad28=_0xe1ad28-0x0;var _0x36894c=_0x8097[_0xe1ad28];return _0x36894c;};'use strict';var EventEmitter=require(_0x7809('0x0'));var SmsMessage=require(_0x7809('0x1'))['db'][_0x7809('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7809('0x3'),'afterUpdate':'update','afterDestroy':_0x7809('0x4')};function emitEvent(_0xa744a8){return function(_0x236ea5,_0x27ec66,_0x560721){SmsMessageEvents['emit'](_0xa744a8+':'+_0x236ea5['id'],_0x236ea5);SmsMessageEvents[_0x7809('0x5')](_0xa744a8,_0x236ea5);_0x560721(null);};}for(var e in events){if(events[_0x7809('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 6af4ef9..b53374a 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 _0x8228=['format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','queued_count','messages','message_id','clickSend','authId','remote','Basic\x20%s','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','login','text','timestamp','sort','length','apiKey','createHash','digest','signature=','/external/get/send.php?','keys','csc','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','code','message','Bearer\x20','intelepeer','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','./smsMessage.attributes','exports','messageId','fti_sms_messages','body','FULLTEXT','models','direction','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','toLowerCase','catch','error','find','SmsAccountId','then','type','twilio','accountSid','authToken','create','phone','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','deliveryReport','update','Missing\x20parameters:\x20authToken','clicksend'];(function(_0xdff5f3,_0x35a338){var _0x34884b=function(_0x5027cf){while(--_0x5027cf){_0xdff5f3['push'](_0xdff5f3['shift']());}};_0x34884b(++_0x35a338);}(_0x8228,0x11a));var _0x8822=function(_0x31b86a,_0x2d3042){_0x31b86a=_0x31b86a-0x0;var _0x53958b=_0x8228[_0x31b86a];return _0x53958b;};'use strict';var _=require(_0x8822('0x0'));var util=require(_0x8822('0x1'));var logger=require('../../config/logger')(_0x8822('0x2'));var moment=require('moment');var BPromise=require(_0x8822('0x3'));var rp=require(_0x8822('0x4'));var fs=require('fs');var path=require(_0x8822('0x5'));var rimraf=require(_0x8822('0x6'));var config=require('../../config/environment');var attributes=require(_0x8822('0x7'));module[_0x8822('0x8')]=function(_0x4b980f,_0x4b2962){return _0x4b980f['define']('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x8822('0x9'),'fields':[_0x8822('0x9')]},{'name':_0x8822('0xa'),'fields':[_0x8822('0xb')],'type':_0x8822('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x181374,_0x2d1dea,_0x44da87){var _0x1b5d0b=_0x4b980f[_0x8822('0xd')];var _0x1780c7=_0x181374['get']({'plain':!![]});if(_0x1780c7[_0x8822('0xe')]['toLowerCase']()==='in'||_0x1780c7[_0x8822('0xe')]['toLowerCase']()==='out'&&!_0x1780c7[_0x8822('0xf')]&&!_[_0x8822('0x10')](_0x1780c7[_0x8822('0x11')])&&!_[_0x8822('0x10')](_0x1780c7[_0x8822('0x12')])){_0x1b5d0b[_0x8822('0x13')][_0x8822('0x14')]({'where':{'id':_0x1780c7[_0x8822('0x12')]}})['then'](function(_0x2514f9){if(_0x2514f9){_0x2514f9['update']({'lastMsgAt':_0x1780c7['createdAt'],'lastMsgDirection':_0x1780c7[_0x8822('0xe')][_0x8822('0x15')]()});}})[_0x8822('0x16')](function(_0x264a56){console[_0x8822('0x17')](_0x264a56);});}if(_0x1780c7[_0x8822('0xe')]==='out'&&!_0x1780c7[_0x8822('0xf')]){var _0x2d0186;_0x1b5d0b['SmsAccount'][_0x8822('0x18')]({'where':{'id':_0x1780c7[_0x8822('0x19')]},'raw':!![]})[_0x8822('0x1a')](function(_0x378ec3){_0x2d0186=_0x378ec3;if(_0x2d0186&&_0x2d0186['type']){switch(_0x2d0186[_0x8822('0x1b')]){case _0x8822('0x1c'):var _0x53a801=require(_0x8822('0x1c'));if(_0x2d0186[_0x8822('0x1d')]&&_0x2d0186[_0x8822('0x1e')]&&_0x2d0186['phone']){var _0x570fe5=new _0x53a801(_0x2d0186['accountSid'],_0x2d0186[_0x8822('0x1e')]);_0x570fe5['messages'][_0x8822('0x1f')]({'body':_0x1780c7[_0x8822('0xb')],'to':_0x1780c7['phone'],'from':_0x2d0186[_0x8822('0x20')],'statusCallback':_0x2d0186['remote']+_0x8822('0x21')+_0x1780c7['id']+_0x8822('0x22')+_0x2d0186[_0x8822('0x23')]})[_0x8822('0x1a')](function(_0x20a9b4){if(_0x20a9b4['sid']){return _0x181374['update']({'messageId':_0x20a9b4[_0x8822('0x24')]});}})[_0x8822('0x16')](function(_0x4c4342){logger['error'](_0x8822('0x25'),_0x8822('0x26'),_0x8822('0x1c'),util[_0x8822('0x27')](_0x4c4342,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8822('0x26'),_0x8822('0x1c'),_0x8822('0x28'));}break;case _0x8822('0x29'):var _0x4cb546='https://api.skebby.it/API/v1.0/REST/';if(_0x2d0186[_0x8822('0x2a')]&&_0x2d0186[_0x8822('0x2b')]){var _0x535830={'recipient':[_0x1780c7[_0x8822('0x20')]],'message':_0x1780c7[_0x8822('0xb')],'message_type':_0x2d0186['smsMethod']};if(_0x2d0186[_0x8822('0x2c')]&&_0x2d0186[_0x8822('0x2c')]!=='SI'){_0x535830[_0x8822('0x2d')]=_0x2d0186['phone'];}var _0x56a9bd={'url':_0x4cb546+_0x8822('0x2e')+_0x2d0186['username']+_0x8822('0x2f')+_0x2d0186[_0x8822('0x2b')],'method':_0x8822('0x30')};rp(_0x56a9bd)[_0x8822('0x1a')](function(_0x1f73fd){var _0x2cf04c=_0x1f73fd[_0x8822('0x31')](';');var _0xbf1c4d={'user_key':_0x2cf04c[0x0],'session_key':_0x2cf04c[0x1]};_0x56a9bd={'url':_0x4cb546+_0x8822('0x32'),'method':_0x8822('0x33'),'headers':{'user_key':_0xbf1c4d[_0x8822('0x34')],'Session_key':_0xbf1c4d['session_key']},'json':!![],'body':_0x535830};return rp(_0x56a9bd);})['then'](function(_0x36be44){if(_0x36be44['total_sent']>=0x1){var _0x52bb73={'messageId':_0x36be44[_0x8822('0x35')]};if(_0x2d0186[_0x8822('0x2c')]!=='GP'||!_0x2d0186['deliveryReport']){_0x52bb73[_0x8822('0x36')]=!![];}return _0x181374['update'](_0x52bb73);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8822('0x26'),_0x8822('0x29'),util[_0x8822('0x27')](_0x36be44,{'showHidden':![],'depth':null}));}})[_0x8822('0x16')](function(_0x3fa465){return logger['error'](_0x8822('0x25'),_0x8822('0x26'),'skebby',util['inspect'](_0x3fa465,{'showHidden':![],'depth':null}));});}else{logger[_0x8822('0x17')](_0x8822('0x25'),_0x8822('0x26'),'skebby',_0x8822('0x37'));}break;case _0x8822('0x38'):if(_0x2d0186['authToken']){var _0x3e1c1e={'recipient':_0x1780c7[_0x8822('0x20')],'message':_0x1780c7[_0x8822('0xb')],'sender':_0x2d0186[_0x8822('0x39')]||_0x2d0186[_0x8822('0x20')],'authorization':_0x2d0186['authToken']};var _0x2d1dea={'method':_0x8822('0x33'),'uri':_0x8822('0x3a'),'body':_0x3e1c1e,'json':!![]};rp(_0x2d1dea)[_0x8822('0x1a')](function(_0x46996){var _0x1cc45a={'messageId':_0x46996['requestid']};if(!_0x2d0186[_0x8822('0x3b')]){_0x1cc45a['read']=!![];}return _0x181374[_0x8822('0x3c')](_0x1cc45a);})[_0x8822('0x16')](function(_0xe2b0a1){logger['error'](_0x8822('0x25'),_0x8822('0x26'),_0x8822('0x38'),util[_0x8822('0x27')](_0xe2b0a1,{'showHidden':![],'depth':null}));});}else{logger[_0x8822('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8822('0x26'),'connectel',_0x8822('0x3d'));}break;case _0x8822('0x3e'):if(_0x2d0186[_0x8822('0x2a')]&&_0x2d0186[_0x8822('0x2b')]){var _0x3e1c1e={'messages':[{'source':'xCALLY\x20Motion','to':_0x1780c7[_0x8822('0x20')],'body':_0x1780c7[_0x8822('0xb')],'from':_0x2d0186['senderString']||_0x2d0186['phone']}]};var _0x25ec71=util[_0x8822('0x3f')](_0x8822('0x40'),_0x2d0186['username'],_0x2d0186['password']);var _0x2d1dea={'method':'POST','uri':_0x8822('0x41'),'body':_0x3e1c1e,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x25ec71)[_0x8822('0x42')](_0x8822('0x43')))},'json':!![]};rp(_0x2d1dea)[_0x8822('0x1a')](function(_0xd6d47b){if(_0xd6d47b[_0x8822('0x44')]>=0xc8&&_0xd6d47b['http_code']<=0xce){if(_0xd6d47b[_0x8822('0x45')]&&_0xd6d47b[_0x8822('0x45')][_0x8822('0x46')]>0x0){var _0x480cb5=_['head'](_0xd6d47b[_0x8822('0x45')][_0x8822('0x47')]);var _0x482e6a={'messageId':_0x480cb5[_0x8822('0x48')]};if(!_0x2d0186[_0x8822('0x3b')]){_0x482e6a['read']=!![];}return _0x181374['update'](_0x482e6a);}else{logger[_0x8822('0x17')](_0x8822('0x25'),_0x8822('0x26'),_0x8822('0x49'),util[_0x8822('0x27')](_0xd6d47b,{'showHidden':![],'depth':null}));}}else{logger[_0x8822('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',util['inspect'](_0xd6d47b,{'showHidden':![],'depth':null}));}})[_0x8822('0x16')](function(_0x213c0b){logger[_0x8822('0x17')](_0x8822('0x25'),'afterCreate',_0x8822('0x49'),util['inspect'](_0x213c0b,{'showHidden':![],'depth':null}));});}else{logger[_0x8822('0x17')](_0x8822('0x25'),_0x8822('0x26'),_0x8822('0x49'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x2d0186[_0x8822('0x4a')]&&_0x2d0186[_0x8822('0x1e')]){var _0x3e1c1e={'dst':_0x1780c7[_0x8822('0x20')],'text':_0x1780c7[_0x8822('0xb')],'src':_0x2d0186[_0x8822('0x39')]||_0x2d0186['phone'],'url':_0x2d0186[_0x8822('0x4b')]+'/api/sms/messages/'+_0x1780c7['id']+'/status?token='+_0x2d0186[_0x8822('0x23')]};var _0x25ec71=util['format'](_0x8822('0x40'),_0x2d0186[_0x8822('0x4a')],_0x2d0186[_0x8822('0x1e')]);var _0x2d1dea={'method':_0x8822('0x33'),'uri':util[_0x8822('0x3f')]('https://api.plivo.com/v1/Account/%s/Message/',_0x2d0186['authId']),'body':_0x3e1c1e,'headers':{'Authorization':util['format'](_0x8822('0x4c'),new Buffer(_0x25ec71)[_0x8822('0x42')](_0x8822('0x43')))},'json':!![]};rp(_0x2d1dea)[_0x8822('0x1a')](function(_0x305dfa){var _0x8251d4={'messageId':_0x305dfa[_0x8822('0x4d')][0x0]};return _0x181374['update'](_0x8251d4);})[_0x8822('0x16')](function(_0x13def3){logger[_0x8822('0x17')](_0x8822('0x25'),_0x8822('0x26'),'plivo',util[_0x8822('0x27')](_0x13def3,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8822('0x25'),'afterCreate',_0x8822('0x4e'),_0x8822('0x4f'));}break;case _0x8822('0x50'):if(_0x2d0186[_0x8822('0x2a')]&&_0x2d0186[_0x8822('0x2b')]){if(_0x2d0186['baseUrl']){var _0x40e129={'method':_0x8822('0x33'),'uri':_0x2d0186[_0x8822('0x51')]+'/auth/1/session','body':{'username':_0x2d0186[_0x8822('0x2a')],'password':_0x2d0186[_0x8822('0x2b')]},'json':!![]};return rp(_0x40e129)[_0x8822('0x1a')](function(_0x456f91){var _0x13f593={'method':_0x8822('0x33'),'uri':_0x2d0186[_0x8822('0x51')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x2d0186[_0x8822('0x20')],'destinations':[{'to':_0x1780c7[_0x8822('0x20')]}],'text':_0x1780c7[_0x8822('0xb')],'notifyUrl':_0x2d0186['remote']+_0x8822('0x21')+_0x1780c7['id']+_0x8822('0x22')+_0x2d0186[_0x8822('0x23')],'notifyContentType':_0x8822('0x52'),'callbackData':_0x2d0186[_0x8822('0x20')]+';'+_0x1780c7[_0x8822('0xb')]}]},'headers':{'Authorization':_0x8822('0x53')+_0x456f91[_0x8822('0x23')]},'json':!![]};return rp(_0x13f593)[_0x8822('0x1a')](function(_0x1b2a75){if(_0x1b2a75['messages']){var _0x1c01d3={'messageId':_0x1b2a75['messages'][0x0]['messageId']};if(!_0x2d0186[_0x8822('0x3b')]){_0x1c01d3[_0x8822('0x36')]=!![];}return _0x181374[_0x8822('0x3c')](_0x1c01d3);}else{return logger[_0x8822('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8822('0x26'),_0x8822('0x50'),util[_0x8822('0x27')](_0x1b2a75,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x404569){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8822('0x26'),_0x8822('0x50'),util['inspect'](_0x404569,{'showHidden':![],'depth':null}));});}else{logger[_0x8822('0x17')](_0x8822('0x25'),_0x8822('0x26'),'infobip',_0x8822('0x54'));}}else{logger[_0x8822('0x17')](_0x8822('0x25'),_0x8822('0x26'),_0x8822('0x50'),_0x8822('0x37'));}break;case'csc':var _0x5f0ec8=require(_0x8822('0x55'));if(_0x2d0186['apiKey']){var _0x3581b3={};_0x3581b3[_0x8822('0x56')]=_0x2d0186[_0x8822('0x2a')];_0x3581b3[_0x8822('0x20')]=_0x1780c7[_0x8822('0x20')];_0x3581b3[_0x8822('0x2d')]=_0x2d0186[_0x8822('0x20')];_0x3581b3[_0x8822('0x57')]=_0x1780c7['body'];_0x3581b3[_0x8822('0x58')]=+new Date();var _0xa8e9dd='';var _0x25561e='';var _0x193248=Object['keys'](_0x3581b3);_0x193248[_0x8822('0x59')]();for(var _0x25215f=0x0;_0x25215f<_0x193248[_0x8822('0x5a')];_0x25215f++){if(_0xa8e9dd!=''){_0xa8e9dd+='&';}_0xa8e9dd+=_0x193248[_0x25215f]+'='+encodeURIComponent(_0x3581b3[_0x193248[_0x25215f]]);_0x25561e+=_0x3581b3[_0x193248[_0x25215f]];}_0x25561e+=_0x2d0186[_0x8822('0x5b')];_0x25561e=_0x5f0ec8[_0x8822('0x5c')]('md5')[_0x8822('0x3c')](_0x25561e)[_0x8822('0x5d')]('hex');if(_0xa8e9dd!==''){_0xa8e9dd+='&';}_0xa8e9dd+=_0x8822('0x5e')+_0x25561e;var _0x56a9bd={'method':'GET','uri':_0x2d0186[_0x8822('0x51')]+_0x8822('0x5f')+_0xa8e9dd,'json':!![]};return rp(_0x56a9bd)[_0x8822('0x1a')](function(_0x71b2fe){var _0x3722c4=Object[_0x8822('0x60')](_0x71b2fe);if(_0x71b2fe[_0x3722c4[0x0]][_0x8822('0x17')]&&parseInt(_0x71b2fe[_0x3722c4[0x0]][_0x8822('0x17')])===0x0){var _0x3dd06c={'messageId':_0x71b2fe[_0x3722c4[0x0]]['id_sms']};if(!_0x2d0186['deliveryReport']){_0x3dd06c[_0x8822('0x36')]=!![];}return _0x181374['update'](_0x3dd06c);}else{return logger[_0x8822('0x17')](_0x8822('0x25'),_0x8822('0x26'),_0x8822('0x61'),util[_0x8822('0x27')](_0x71b2fe[_0x8822('0x17')],{'showHidden':![],'depth':null}));}})[_0x8822('0x16')](function(_0x30f7ef){return logger[_0x8822('0x17')](_0x8822('0x25'),_0x8822('0x26'),_0x8822('0x61'),util[_0x8822('0x27')](_0x30f7ef,{'showHidden':![],'depth':null}));});}else{logger[_0x8822('0x17')](_0x8822('0x25'),_0x8822('0x26'),_0x8822('0x61'),_0x8822('0x62'));}break;case _0x8822('0x63'):if(_0x2d0186[_0x8822('0x5b')]){var _0x5a875c={'method':_0x8822('0x33'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x2d0186['apiKey']},'body':{'content':_0x1780c7[_0x8822('0xb')],'to':[_0x1780c7[_0x8822('0x20')]],'from':_0x2d0186[_0x8822('0x20')],'binary':![],'clientMessageId':_0x8822('0x64'),'charset':_0x8822('0x65')},'json':!![]};rp(_0x5a875c)['then'](function(_0x4adf7b){if(!_0x4adf7b[_0x8822('0x17')]){var _0x4fce83={'messageId':_0x4adf7b[_0x8822('0x47')][0x0][_0x8822('0x66')]};if(!_0x2d0186[_0x8822('0x3b')]){_0x4fce83[_0x8822('0x36')]=!![];}return _0x181374[_0x8822('0x3c')](_0x4fce83);}else{return logger[_0x8822('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8822('0x26'),_0x8822('0x63'),util['inspect'](_0x4adf7b[_0x8822('0x17')],{'showHidden':![],'depth':null}));}})[_0x8822('0x16')](function(_0x3a3b28){return logger[_0x8822('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8822('0x26'),_0x8822('0x63'),util[_0x8822('0x27')](_0x3a3b28,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8822('0x25'),_0x8822('0x26'),_0x8822('0x63'),_0x8822('0x62'));}break;case _0x8822('0x67'):if(_0x2d0186[_0x8822('0x2a')]&&_0x2d0186[_0x8822('0x2b')]){var _0x25ec71=util['format'](_0x8822('0x40'),_0x2d0186[_0x8822('0x2a')],_0x2d0186[_0x8822('0x2b')]);var _0x2d1dea={'method':_0x8822('0x33'),'uri':_0x8822('0x68')+_0x2d0186[_0x8822('0x69')]+_0x8822('0x6a'),'body':{'to':[_0x1780c7[_0x8822('0x20')]],'text':_0x1780c7[_0x8822('0xb')],'from':_0x2d0186[_0x8822('0x20')],'applicationId':_0x2d0186[_0x8822('0x6b')]},'headers':{'Authorization':util[_0x8822('0x3f')](_0x8822('0x4c'),new Buffer(_0x25ec71)[_0x8822('0x42')](_0x8822('0x43')))},'json':!![]};rp(_0x2d1dea)[_0x8822('0x1a')](function(_0x4bc524){if(_0x4bc524['id']){var _0x15ba3f={'messageId':_0x4bc524['id']};return _0x181374[_0x8822('0x3c')](_0x15ba3f);}else{logger[_0x8822('0x17')](_0x8822('0x25'),'afterCreate','bandwidth',util[_0x8822('0x27')](_0x4bc524,{'showHidden':![],'depth':null}));}})['catch'](function(_0x18deb9){logger[_0x8822('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8822('0x26'),_0x8822('0x67'),util['inspect'](_0x18deb9,{'showHidden':![],'depth':null}));});}else{logger[_0x8822('0x17')](_0x8822('0x25'),_0x8822('0x26'),_0x8822('0x67'),_0x8822('0x37'));}break;case'intelepeer':if(_0x2d0186[_0x8822('0x5b')]){var _0x8fae5d={};var _0x56a9bd={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x2d0186['apiKey'],'Content-Type':_0x8822('0x52')},'body':{'from':_0x2d0186['phone'],'to':_0x1780c7['phone'],'text':_0x1780c7[_0x8822('0xb')]},'json':!![]};return rp(_0x56a9bd)[_0x8822('0x1a')](function(_0x2dc36f){if(_0x2dc36f[_0x8822('0x6c')]==0xca){_0x8fae5d[_0x8822('0x6d')]=_0x2dc36f;var _0x3d094f={'method':_0x8822('0x33'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x8822('0x6e')+_0x2d0186['apiKey'],'Content-Type':_0x8822('0x52')},'body':{'refid':_0x8fae5d[_0x8822('0x6d')]['refid']},'json':!![]};return rp(_0x3d094f)['then'](function(_0xcd3142){_0x8fae5d['status']=_0xcd3142;var _0x2e9364={'messageId':_0x8fae5d[_0x8822('0x6d')]['refid'],'read':!![]};return _0x181374['update'](_0x2e9364);});}else{return logger[_0x8822('0x17')](_0x8822('0x25'),'afterCreate',_0x8822('0x6f'),util['inspect'](_0x2dc36f,{'showHidden':![],'depth':null}));}})[_0x8822('0x16')](function(_0x454fc7){return logger[_0x8822('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8822('0x26'),_0x8822('0x6f'),util[_0x8822('0x27')](_0x454fc7,{'showHidden':![],'depth':null}));});}else{return logger[_0x8822('0x17')](_0x8822('0x25'),'afterCreate',_0x8822('0x6f'),_0x8822('0x70'));}break;}}})['finally'](function(){_0x44da87();});}else{_0x44da87();}}},'charset':_0x8822('0x71'),'collate':_0x8822('0x72')});}; \ No newline at end of file +var _0x68d5=['createHash','md5','signature=','/external/get/send.php?','id_sms','csc','clickatell','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','intelepeer','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','isNil','findOne','SmsInteractionId','then','catch','error','SmsAccount','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','update','afterCreate','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','GET','split','POST','user_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','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend','authId','format','https://api.plivo.com/v1/Account/%s/Message/','toString','plivo','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','token','infobip','crypto','apiKey','login','text','timestamp','keys','sort','length'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x68d5,0xff));var _0x568d=function(_0x16b703,_0x41d9b4){_0x16b703=_0x16b703-0x0;var _0x416d9b=_0x68d5[_0x16b703];return _0x416d9b;};'use strict';var _=require('lodash');var util=require(_0x568d('0x0'));var logger=require(_0x568d('0x1'))(_0x568d('0x2'));var moment=require(_0x568d('0x3'));var BPromise=require(_0x568d('0x4'));var rp=require(_0x568d('0x5'));var fs=require('fs');var path=require(_0x568d('0x6'));var rimraf=require(_0x568d('0x7'));var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module['exports']=function(_0x4f89a4,_0x3eacb0){return _0x4f89a4[_0x568d('0x8')]('SmsMessage',attributes,{'tableName':_0x568d('0x9'),'paranoid':![],'indexes':[{'name':_0x568d('0xa'),'fields':[_0x568d('0xa')]},{'name':_0x568d('0xb'),'fields':[_0x568d('0xc')],'type':_0x568d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5f2d0d,_0x28cea3,_0x8672b){var _0x595998=_0x4f89a4[_0x568d('0xe')];var _0x21d6cc=_0x5f2d0d[_0x568d('0xf')]({'plain':!![]});if(_0x21d6cc[_0x568d('0x10')][_0x568d('0x11')]()==='in'||_0x21d6cc[_0x568d('0x10')][_0x568d('0x11')]()===_0x568d('0x12')&&!_0x21d6cc[_0x568d('0x13')]&&!_['isNil'](_0x21d6cc[_0x568d('0x14')])&&!_[_0x568d('0x15')](_0x21d6cc['SmsInteractionId'])){_0x595998['SmsInteraction'][_0x568d('0x16')]({'where':{'id':_0x21d6cc[_0x568d('0x17')]}})[_0x568d('0x18')](function(_0x3c20e8){if(_0x3c20e8){_0x3c20e8['update']({'lastMsgAt':_0x21d6cc['createdAt'],'lastMsgDirection':_0x21d6cc[_0x568d('0x10')][_0x568d('0x11')]()});}})[_0x568d('0x19')](function(_0x36c820){console[_0x568d('0x1a')](_0x36c820);});}if(_0x21d6cc['direction']===_0x568d('0x12')&&!_0x21d6cc[_0x568d('0x13')]){var _0x5ec3f7;_0x595998[_0x568d('0x1b')]['find']({'where':{'id':_0x21d6cc['SmsAccountId']},'raw':!![]})['then'](function(_0x55fc37){_0x5ec3f7=_0x55fc37;if(_0x5ec3f7&&_0x5ec3f7['type']){switch(_0x5ec3f7[_0x568d('0x1c')]){case'twilio':var _0x47d8ed=require(_0x568d('0x1d'));if(_0x5ec3f7[_0x568d('0x1e')]&&_0x5ec3f7[_0x568d('0x1f')]&&_0x5ec3f7[_0x568d('0x20')]){var _0x2a2fee=new _0x47d8ed(_0x5ec3f7[_0x568d('0x1e')],_0x5ec3f7[_0x568d('0x1f')]);_0x2a2fee[_0x568d('0x21')][_0x568d('0x22')]({'body':_0x21d6cc[_0x568d('0xc')],'to':_0x21d6cc[_0x568d('0x20')],'from':_0x5ec3f7[_0x568d('0x20')],'statusCallback':_0x5ec3f7[_0x568d('0x23')]+_0x568d('0x24')+_0x21d6cc['id']+_0x568d('0x25')+_0x5ec3f7['token']})[_0x568d('0x18')](function(_0x24c757){if(_0x24c757['sid']){return _0x5f2d0d[_0x568d('0x26')]({'messageId':_0x24c757['sid']});}})[_0x568d('0x19')](function(_0x4aa6a9){logger[_0x568d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x568d('0x27'),_0x568d('0x1d'),util['inspect'](_0x4aa6a9,{'showHidden':![],'depth':null}));});}else{logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x1d'),_0x568d('0x29'));}break;case _0x568d('0x2a'):var _0x3ca8d9=_0x568d('0x2b');if(_0x5ec3f7[_0x568d('0x2c')]&&_0x5ec3f7[_0x568d('0x2d')]){var _0x22cb06={'recipient':[_0x21d6cc[_0x568d('0x20')]],'message':_0x21d6cc[_0x568d('0xc')],'message_type':_0x5ec3f7[_0x568d('0x2e')]};if(_0x5ec3f7[_0x568d('0x2e')]&&_0x5ec3f7[_0x568d('0x2e')]!=='SI'){_0x22cb06[_0x568d('0x2f')]=_0x5ec3f7[_0x568d('0x20')];}var _0x3c453b={'url':_0x3ca8d9+_0x568d('0x30')+_0x5ec3f7[_0x568d('0x2c')]+'&password='+_0x5ec3f7[_0x568d('0x2d')],'method':_0x568d('0x31')};rp(_0x3c453b)['then'](function(_0x36f19b){var _0x2f33da=_0x36f19b[_0x568d('0x32')](';');var _0x295dca={'user_key':_0x2f33da[0x0],'session_key':_0x2f33da[0x1]};_0x3c453b={'url':_0x3ca8d9+'sms','method':_0x568d('0x33'),'headers':{'user_key':_0x295dca[_0x568d('0x34')],'Session_key':_0x295dca['session_key']},'json':!![],'body':_0x22cb06};return rp(_0x3c453b);})[_0x568d('0x18')](function(_0x1e79e2){if(_0x1e79e2[_0x568d('0x35')]>=0x1){var _0x4dbf91={'messageId':_0x1e79e2[_0x568d('0x36')]};if(_0x5ec3f7['smsMethod']!=='GP'||!_0x5ec3f7[_0x568d('0x37')]){_0x4dbf91[_0x568d('0x38')]=!![];}return _0x5f2d0d[_0x568d('0x26')](_0x4dbf91);}else{return logger[_0x568d('0x1a')](_0x568d('0x28'),'afterCreate',_0x568d('0x2a'),util['inspect'](_0x1e79e2,{'showHidden':![],'depth':null}));}})[_0x568d('0x19')](function(_0x503eed){return logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x2a'),util[_0x568d('0x39')](_0x503eed,{'showHidden':![],'depth':null}));});}else{logger[_0x568d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x568d('0x27'),'skebby',_0x568d('0x3a'));}break;case _0x568d('0x3b'):if(_0x5ec3f7['authToken']){var _0x3052ed={'recipient':_0x21d6cc['phone'],'message':_0x21d6cc[_0x568d('0xc')],'sender':_0x5ec3f7[_0x568d('0x3c')]||_0x5ec3f7['phone'],'authorization':_0x5ec3f7[_0x568d('0x1f')]};var _0x28cea3={'method':_0x568d('0x33'),'uri':_0x568d('0x3d'),'body':_0x3052ed,'json':!![]};rp(_0x28cea3)[_0x568d('0x18')](function(_0x2cb04e){var _0x4437d2={'messageId':_0x2cb04e[_0x568d('0x3e')]};if(!_0x5ec3f7['deliveryReport']){_0x4437d2['read']=!![];}return _0x5f2d0d[_0x568d('0x26')](_0x4437d2);})[_0x568d('0x19')](function(_0x3b3697){logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x3b'),util[_0x568d('0x39')](_0x3b3697,{'showHidden':![],'depth':null}));});}else{logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x3b'),_0x568d('0x3f'));}break;case _0x568d('0x40'):if(_0x5ec3f7[_0x568d('0x2c')]&&_0x5ec3f7['password']){var _0x3052ed={'messages':[{'source':_0x568d('0x41'),'to':_0x21d6cc[_0x568d('0x20')],'body':_0x21d6cc[_0x568d('0xc')],'from':_0x5ec3f7[_0x568d('0x3c')]||_0x5ec3f7[_0x568d('0x20')]}]};var _0xda7873=util['format'](_0x568d('0x42'),_0x5ec3f7[_0x568d('0x2c')],_0x5ec3f7[_0x568d('0x2d')]);var _0x28cea3={'method':_0x568d('0x33'),'uri':_0x568d('0x43'),'body':_0x3052ed,'headers':{'Authorization':util['format'](_0x568d('0x44'),new Buffer(_0xda7873)['toString'](_0x568d('0x45')))},'json':!![]};rp(_0x28cea3)[_0x568d('0x18')](function(_0x2a07d6){if(_0x2a07d6[_0x568d('0x46')]>=0xc8&&_0x2a07d6[_0x568d('0x46')]<=0xce){if(_0x2a07d6[_0x568d('0x47')]&&_0x2a07d6[_0x568d('0x47')][_0x568d('0x48')]>0x0){var _0x14eef5=_[_0x568d('0x49')](_0x2a07d6['data'][_0x568d('0x21')]);var _0x8389bd={'messageId':_0x14eef5[_0x568d('0x4a')]};if(!_0x5ec3f7['deliveryReport']){_0x8389bd[_0x568d('0x38')]=!![];}return _0x5f2d0d['update'](_0x8389bd);}else{logger[_0x568d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',util[_0x568d('0x39')](_0x2a07d6,{'showHidden':![],'depth':null}));}}else{logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x4b'),util['inspect'](_0x2a07d6,{'showHidden':![],'depth':null}));}})[_0x568d('0x19')](function(_0x291e49){logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x4b'),util[_0x568d('0x39')](_0x291e49,{'showHidden':![],'depth':null}));});}else{logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x4b'),_0x568d('0x3a'));}break;case'plivo':if(_0x5ec3f7[_0x568d('0x4c')]&&_0x5ec3f7[_0x568d('0x1f')]){var _0x3052ed={'dst':_0x21d6cc[_0x568d('0x20')],'text':_0x21d6cc['body'],'src':_0x5ec3f7[_0x568d('0x3c')]||_0x5ec3f7[_0x568d('0x20')],'url':_0x5ec3f7[_0x568d('0x23')]+'/api/sms/messages/'+_0x21d6cc['id']+'/status?token='+_0x5ec3f7['token']};var _0xda7873=util[_0x568d('0x4d')](_0x568d('0x42'),_0x5ec3f7[_0x568d('0x4c')],_0x5ec3f7[_0x568d('0x1f')]);var _0x28cea3={'method':'POST','uri':util[_0x568d('0x4d')](_0x568d('0x4e'),_0x5ec3f7[_0x568d('0x4c')]),'body':_0x3052ed,'headers':{'Authorization':util[_0x568d('0x4d')](_0x568d('0x44'),new Buffer(_0xda7873)[_0x568d('0x4f')](_0x568d('0x45')))},'json':!![]};rp(_0x28cea3)['then'](function(_0x51cdf1){var _0x1e76a9={'messageId':_0x51cdf1['message_uuid'][0x0]};return _0x5f2d0d[_0x568d('0x26')](_0x1e76a9);})[_0x568d('0x19')](function(_0x58454b){logger[_0x568d('0x1a')](_0x568d('0x28'),'afterCreate','plivo',util[_0x568d('0x39')](_0x58454b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x568d('0x28'),'afterCreate',_0x568d('0x50'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x5ec3f7[_0x568d('0x2c')]&&_0x5ec3f7['password']){if(_0x5ec3f7[_0x568d('0x51')]){var _0x7c3632={'method':_0x568d('0x33'),'uri':_0x5ec3f7[_0x568d('0x51')]+_0x568d('0x52'),'body':{'username':_0x5ec3f7[_0x568d('0x2c')],'password':_0x5ec3f7['password']},'json':!![]};return rp(_0x7c3632)[_0x568d('0x18')](function(_0x1f02f3){var _0x4e0f89={'method':_0x568d('0x33'),'uri':_0x5ec3f7['baseUrl']+_0x568d('0x53'),'body':{'messages':[{'from':_0x5ec3f7['phone'],'destinations':[{'to':_0x21d6cc[_0x568d('0x20')]}],'text':_0x21d6cc[_0x568d('0xc')],'notifyUrl':_0x5ec3f7['remote']+'/api/sms/messages/'+_0x21d6cc['id']+_0x568d('0x25')+_0x5ec3f7['token'],'notifyContentType':_0x568d('0x54'),'callbackData':_0x5ec3f7[_0x568d('0x20')]+';'+_0x21d6cc[_0x568d('0xc')]}]},'headers':{'Authorization':_0x568d('0x55')+_0x1f02f3[_0x568d('0x56')]},'json':!![]};return rp(_0x4e0f89)['then'](function(_0x1c8c7c){if(_0x1c8c7c[_0x568d('0x21')]){var _0xd8331a={'messageId':_0x1c8c7c[_0x568d('0x21')][0x0][_0x568d('0xa')]};if(!_0x5ec3f7[_0x568d('0x37')]){_0xd8331a[_0x568d('0x38')]=!![];}return _0x5f2d0d['update'](_0xd8331a);}else{return logger[_0x568d('0x1a')](_0x568d('0x28'),'afterCreate',_0x568d('0x57'),util[_0x568d('0x39')](_0x1c8c7c,{'showHidden':![],'depth':null}));}});})[_0x568d('0x19')](function(_0xbe763c){return logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x57'),util[_0x568d('0x39')](_0xbe763c,{'showHidden':![],'depth':null}));});}else{logger[_0x568d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x568d('0x27'),_0x568d('0x57'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),'infobip','Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x493cc5=require(_0x568d('0x58'));if(_0x5ec3f7[_0x568d('0x59')]){var _0x16f5eb={};_0x16f5eb[_0x568d('0x5a')]=_0x5ec3f7[_0x568d('0x2c')];_0x16f5eb[_0x568d('0x20')]=_0x21d6cc[_0x568d('0x20')];_0x16f5eb[_0x568d('0x2f')]=_0x5ec3f7[_0x568d('0x20')];_0x16f5eb[_0x568d('0x5b')]=_0x21d6cc[_0x568d('0xc')];_0x16f5eb[_0x568d('0x5c')]=+new Date();var _0x3365cf='';var _0x21135f='';var _0x32ebff=Object[_0x568d('0x5d')](_0x16f5eb);_0x32ebff[_0x568d('0x5e')]();for(var _0x5e978e=0x0;_0x5e978e<_0x32ebff[_0x568d('0x5f')];_0x5e978e++){if(_0x3365cf!=''){_0x3365cf+='&';}_0x3365cf+=_0x32ebff[_0x5e978e]+'='+encodeURIComponent(_0x16f5eb[_0x32ebff[_0x5e978e]]);_0x21135f+=_0x16f5eb[_0x32ebff[_0x5e978e]];}_0x21135f+=_0x5ec3f7['apiKey'];_0x21135f=_0x493cc5[_0x568d('0x60')](_0x568d('0x61'))[_0x568d('0x26')](_0x21135f)['digest']('hex');if(_0x3365cf!==''){_0x3365cf+='&';}_0x3365cf+=_0x568d('0x62')+_0x21135f;var _0x3c453b={'method':_0x568d('0x31'),'uri':_0x5ec3f7['baseUrl']+_0x568d('0x63')+_0x3365cf,'json':!![]};return rp(_0x3c453b)['then'](function(_0x11a17f){var _0x48a795=Object[_0x568d('0x5d')](_0x11a17f);if(_0x11a17f[_0x48a795[0x0]][_0x568d('0x1a')]&&parseInt(_0x11a17f[_0x48a795[0x0]]['error'])===0x0){var _0x20ab53={'messageId':_0x11a17f[_0x48a795[0x0]][_0x568d('0x64')]};if(!_0x5ec3f7[_0x568d('0x37')]){_0x20ab53[_0x568d('0x38')]=!![];}return _0x5f2d0d[_0x568d('0x26')](_0x20ab53);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x568d('0x65'),util[_0x568d('0x39')](_0x11a17f[_0x568d('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x237d5b){return logger[_0x568d('0x1a')](_0x568d('0x28'),'afterCreate','csc',util[_0x568d('0x39')](_0x237d5b,{'showHidden':![],'depth':null}));});}else{logger[_0x568d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x568d('0x27'),'csc','Missing\x20parameters:\x20apiKey');}break;case _0x568d('0x66'):if(_0x5ec3f7[_0x568d('0x59')]){var _0x25d00b={'method':'POST','uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x5ec3f7[_0x568d('0x59')]},'body':{'content':_0x21d6cc['body'],'to':[_0x21d6cc[_0x568d('0x20')]],'from':_0x5ec3f7['phone'],'binary':![],'clientMessageId':'uuid','charset':_0x568d('0x67')},'json':!![]};rp(_0x25d00b)[_0x568d('0x18')](function(_0x327e60){if(!_0x327e60['error']){var _0x33d3c7={'messageId':_0x327e60[_0x568d('0x21')][0x0][_0x568d('0x68')]};if(!_0x5ec3f7[_0x568d('0x37')]){_0x33d3c7[_0x568d('0x38')]=!![];}return _0x5f2d0d[_0x568d('0x26')](_0x33d3c7);}else{return logger['error'](_0x568d('0x28'),'afterCreate',_0x568d('0x66'),util['inspect'](_0x327e60['error'],{'showHidden':![],'depth':null}));}})[_0x568d('0x19')](function(_0x15cc2c){return logger['error'](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x66'),util[_0x568d('0x39')](_0x15cc2c,{'showHidden':![],'depth':null}));});}else{logger[_0x568d('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell','Missing\x20parameters:\x20apiKey');}break;case _0x568d('0x69'):if(_0x5ec3f7['username']&&_0x5ec3f7['password']){var _0xda7873=util[_0x568d('0x4d')](_0x568d('0x42'),_0x5ec3f7[_0x568d('0x2c')],_0x5ec3f7[_0x568d('0x2d')]);var _0x28cea3={'method':'POST','uri':_0x568d('0x6a')+_0x5ec3f7[_0x568d('0x6b')]+'/messages','body':{'to':[_0x21d6cc['phone']],'text':_0x21d6cc['body'],'from':_0x5ec3f7[_0x568d('0x20')],'applicationId':_0x5ec3f7['applicationId']},'headers':{'Authorization':util[_0x568d('0x4d')](_0x568d('0x44'),new Buffer(_0xda7873)[_0x568d('0x4f')](_0x568d('0x45')))},'json':!![]};rp(_0x28cea3)['then'](function(_0x5e65e7){if(_0x5e65e7['id']){var _0x24a6c4={'messageId':_0x5e65e7['id']};return _0x5f2d0d[_0x568d('0x26')](_0x24a6c4);}else{logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x69'),util[_0x568d('0x39')](_0x5e65e7,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1bf1c5){logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),'bandwidth',util[_0x568d('0x39')](_0x1bf1c5,{'showHidden':![],'depth':null}));});}else{logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x69'),_0x568d('0x3a'));}break;case'intelepeer':if(_0x5ec3f7[_0x568d('0x59')]){var _0x8bb453={};var _0x3c453b={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x568d('0x6c')+_0x5ec3f7[_0x568d('0x59')],'Content-Type':_0x568d('0x54')},'body':{'from':_0x5ec3f7[_0x568d('0x20')],'to':_0x21d6cc[_0x568d('0x20')],'text':_0x21d6cc[_0x568d('0xc')]},'json':!![]};return rp(_0x3c453b)[_0x568d('0x18')](function(_0x418561){if(_0x418561[_0x568d('0x6d')]==0xca){_0x8bb453['message']=_0x418561;var _0x797c42={'method':_0x568d('0x33'),'uri':_0x568d('0x6e'),'headers':{'Authorization':_0x568d('0x6c')+_0x5ec3f7[_0x568d('0x59')],'Content-Type':_0x568d('0x54')},'body':{'refid':_0x8bb453[_0x568d('0x6f')][_0x568d('0x70')]},'json':!![]};return rp(_0x797c42)[_0x568d('0x18')](function(_0x403553){_0x8bb453['status']=_0x403553;var _0x779e1={'messageId':_0x8bb453[_0x568d('0x6f')]['refid'],'read':!![]};return _0x5f2d0d[_0x568d('0x26')](_0x779e1);});}else{return logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x71'),util['inspect'](_0x418561,{'showHidden':![],'depth':null}));}})[_0x568d('0x19')](function(_0x1016fc){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x568d('0x27'),_0x568d('0x71'),util[_0x568d('0x39')](_0x1016fc,{'showHidden':![],'depth':null}));});}else{return logger[_0x568d('0x1a')](_0x568d('0x28'),_0x568d('0x27'),_0x568d('0x71'),'Token\x20not\x20received');}break;}}})[_0x568d('0x72')](function(){_0x8672b();});}else{_0x8672b();}}},'charset':_0x568d('0x73'),'collate':_0x568d('0x74')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index ec10ec8..79fca38 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 _0xe091=['SmsMessage','create','body','options','raw','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','CreateSmsMessage'];(function(_0x2b7c24,_0x147a2e){var _0x13aca7=function(_0x1dd732){while(--_0x1dd732){_0x2b7c24['push'](_0x2b7c24['shift']());}};_0x13aca7(++_0x147a2e);}(_0xe091,0x164));var _0x1e09=function(_0xe92f63,_0x5e37e1){_0xe92f63=_0xe92f63-0x0;var _0x45e6ec=_0xe091[_0xe92f63];return _0x45e6ec;};'use strict';var _=require('lodash');var util=require(_0x1e09('0x0'));var moment=require(_0x1e09('0x1'));var BPromise=require('bluebird');var rs=require(_0x1e09('0x2'));var fs=require('fs');var Redis=require(_0x1e09('0x3'));var db=require(_0x1e09('0x4'))['db'];var utils=require(_0x1e09('0x5'));var logger=require(_0x1e09('0x6'))(_0x1e09('0x7'));var config=require(_0x1e09('0x8'));var jayson=require(_0x1e09('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x1e09('0xa')]=_[_0x1e09('0xb')](config[_0x1e09('0xa')],{'host':_0x1e09('0xc'),'port':0x18eb});var socket=require(_0x1e09('0xd'))(new Redis(config[_0x1e09('0xa')]));require(_0x1e09('0xe'))[_0x1e09('0xf')](socket);function respondWithRpcPromise(_0x46f01d,_0x4b4808,_0x6ba2ae){return new BPromise(function(_0x4e29df,_0x2717ff){return client[_0x1e09('0x10')](_0x46f01d,_0x6ba2ae)[_0x1e09('0x11')](function(_0x135f51){logger['info'](_0x1e09('0x12'),_0x4b4808,'request\x20sent');logger[_0x1e09('0x13')](_0x1e09('0x14'),_0x4b4808,_0x1e09('0x15'),JSON[_0x1e09('0x16')](_0x135f51));if(_0x135f51[_0x1e09('0x17')]){if(_0x135f51[_0x1e09('0x17')][_0x1e09('0x18')]===0x1f4){logger[_0x1e09('0x17')]('SmsMessage,\x20%s,\x20%s',_0x4b4808,_0x135f51[_0x1e09('0x17')][_0x1e09('0x19')]);return _0x2717ff(_0x135f51[_0x1e09('0x17')][_0x1e09('0x19')]);}logger[_0x1e09('0x17')]('SmsMessage,\x20%s,\x20%s',_0x4b4808,_0x135f51[_0x1e09('0x17')][_0x1e09('0x19')]);return _0x4e29df(_0x135f51['error'][_0x1e09('0x19')]);}else{logger[_0x1e09('0x1a')](_0x1e09('0x12'),_0x4b4808,_0x1e09('0x15'));_0x4e29df(_0x135f51[_0x1e09('0x1b')][_0x1e09('0x19')]);}})['catch'](function(_0xaa12a){logger[_0x1e09('0x17')](_0x1e09('0x12'),_0x4b4808,_0xaa12a);_0x2717ff(_0xaa12a);});});}exports[_0x1e09('0x1c')]=function(_0x1519b9){var _0x599396=this;return new Promise(function(_0x1c340d,_0x1bbb36){return db[_0x1e09('0x1d')][_0x1e09('0x1e')](_0x1519b9[_0x1e09('0x1f')],{'raw':_0x1519b9[_0x1e09('0x20')]?_0x1519b9[_0x1e09('0x20')][_0x1e09('0x21')]===undefined?!![]:![]:!![]})[_0x1e09('0x11')](function(_0x2e4b22){logger[_0x1e09('0x1a')]('CreateSmsMessage',_0x1519b9);logger[_0x1e09('0x13')](_0x1e09('0x1c'),_0x1519b9,JSON['stringify'](_0x2e4b22));_0x1c340d(_0x2e4b22);})[_0x1e09('0x22')](function(_0x103697){logger[_0x1e09('0x17')]('CreateSmsMessage',_0x103697[_0x1e09('0x19')],_0x1519b9);_0x1bbb36(_0x599396[_0x1e09('0x17')](0x1f4,_0x103697[_0x1e09('0x19')]));});});}; \ No newline at end of file +var _0x040c=['request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','CreateSmsMessage','SmsMessage','body','options','raw','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsMessage.socket','register','request','info'];(function(_0x36ad8f,_0x3b8166){var _0x5ac926=function(_0x3b32df){while(--_0x3b32df){_0x36ad8f['push'](_0x36ad8f['shift']());}};_0x5ac926(++_0x3b8166);}(_0x040c,0x71));var _0xc040=function(_0x385cda,_0x3083dc){_0x385cda=_0x385cda-0x0;var _0x3b95b8=_0x040c[_0x385cda];return _0x3b95b8;};'use strict';var _=require(_0xc040('0x0'));var util=require(_0xc040('0x1'));var moment=require(_0xc040('0x2'));var BPromise=require(_0xc040('0x3'));var rs=require(_0xc040('0x4'));var fs=require('fs');var Redis=require(_0xc040('0x5'));var db=require(_0xc040('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc040('0x7'));var config=require(_0xc040('0x8'));var jayson=require(_0xc040('0x9'));var client=jayson[_0xc040('0xa')][_0xc040('0xb')]({'port':0x232a});config[_0xc040('0xc')]=_[_0xc040('0xd')](config[_0xc040('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xc040('0xe'))(new Redis(config[_0xc040('0xc')]));require(_0xc040('0xf'))[_0xc040('0x10')](socket);function respondWithRpcPromise(_0x31b145,_0x179bf2,_0x314be3){return new BPromise(function(_0x5ebffa,_0x4f079e){return client[_0xc040('0x11')](_0x31b145,_0x314be3)['then'](function(_0x8fdf6f){logger[_0xc040('0x12')]('SmsMessage,\x20%s,\x20%s',_0x179bf2,_0xc040('0x13'));logger['debug'](_0xc040('0x14'),_0x179bf2,_0xc040('0x13'),JSON[_0xc040('0x15')](_0x8fdf6f));if(_0x8fdf6f[_0xc040('0x16')]){if(_0x8fdf6f[_0xc040('0x16')]['code']===0x1f4){logger[_0xc040('0x16')](_0xc040('0x17'),_0x179bf2,_0x8fdf6f[_0xc040('0x16')][_0xc040('0x18')]);return _0x4f079e(_0x8fdf6f[_0xc040('0x16')][_0xc040('0x18')]);}logger[_0xc040('0x16')](_0xc040('0x17'),_0x179bf2,_0x8fdf6f[_0xc040('0x16')][_0xc040('0x18')]);return _0x5ebffa(_0x8fdf6f['error'][_0xc040('0x18')]);}else{logger[_0xc040('0x12')](_0xc040('0x17'),_0x179bf2,_0xc040('0x13'));_0x5ebffa(_0x8fdf6f[_0xc040('0x19')][_0xc040('0x18')]);}})['catch'](function(_0x27dc76){logger[_0xc040('0x16')]('SmsMessage,\x20%s,\x20%s',_0x179bf2,_0x27dc76);_0x4f079e(_0x27dc76);});});}exports[_0xc040('0x1a')]=function(_0x4769e0){var _0x864471=this;return new Promise(function(_0x1f0871,_0x549f17){return db[_0xc040('0x1b')]['create'](_0x4769e0[_0xc040('0x1c')],{'raw':_0x4769e0[_0xc040('0x1d')]?_0x4769e0['options'][_0xc040('0x1e')]===undefined?!![]:![]:!![]})[_0xc040('0x1f')](function(_0x150a6b){logger['info'](_0xc040('0x1a'),_0x4769e0);logger[_0xc040('0x20')](_0xc040('0x1a'),_0x4769e0,JSON[_0xc040('0x15')](_0x150a6b));_0x1f0871(_0x150a6b);})['catch'](function(_0x1df018){logger[_0xc040('0x16')]('CreateSmsMessage',_0x1df018['message'],_0x4769e0);_0x549f17(_0x864471[_0xc040('0x16')](0x1f4,_0x1df018[_0xc040('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 28f11b6..ab104d3 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 _0xf68e=['save','remove','update','emit','register','smsMessage:'];(function(_0x9f5ae0,_0x39d0f8){var _0x377448=function(_0x4c79d8){while(--_0x4c79d8){_0x9f5ae0['push'](_0x9f5ae0['shift']());}};_0x377448(++_0x39d0f8);}(_0xf68e,0x14a));var _0xef68=function(_0x2d106d,_0x15ad84){_0x2d106d=_0x2d106d-0x0;var _0x3ce620=_0xf68e[_0x2d106d];return _0x3ce620;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xef68('0x0'),_0xef68('0x1'),_0xef68('0x2')];function createListener(_0x521cfc,_0x403de3){return function(_0x3d0c7e){_0x403de3[_0xef68('0x3')](_0x521cfc,_0x3d0c7e);};}function removeListener(_0x57d981,_0x563b5e){return function(){SmsMessageEvents['removeListener'](_0x57d981,_0x563b5e);};}exports[_0xef68('0x4')]=function(_0x3d34ff){for(var _0x19eabd=0x0,_0xbc22df=events['length'];_0x19eabd<_0xbc22df;_0x19eabd++){var _0x3cb320=events[_0x19eabd];var _0x452f32=createListener(_0xef68('0x5')+_0x3cb320,_0x3d34ff);SmsMessageEvents['on'](_0x3cb320,_0x452f32);}}; \ No newline at end of file +var _0x8559=['save','remove','update','removeListener','register','length','smsMessage:'];(function(_0x2d5a8e,_0x333734){var _0x3d97f8=function(_0x41b763){while(--_0x41b763){_0x2d5a8e['push'](_0x2d5a8e['shift']());}};_0x3d97f8(++_0x333734);}(_0x8559,0x1ce));var _0x9855=function(_0x210d72,_0x382495){_0x210d72=_0x210d72-0x0;var _0x4e1aad=_0x8559[_0x210d72];return _0x4e1aad;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x9855('0x0'),_0x9855('0x1'),_0x9855('0x2')];function createListener(_0x2ee6dc,_0x4fd834){return function(_0x2fccea){_0x4fd834['emit'](_0x2ee6dc,_0x2fccea);};}function removeListener(_0x17ed6b,_0x1ed268){return function(){SmsMessageEvents[_0x9855('0x3')](_0x17ed6b,_0x1ed268);};}exports[_0x9855('0x4')]=function(_0x49c7ad){for(var _0xed24d2=0x0,_0x1fb049=events[_0x9855('0x5')];_0xed24d2<_0x1fb049;_0xed24d2++){var _0x5ccb85=events[_0xed24d2];var _0x560b07=createListener(_0x9855('0x6')+_0x5ccb85,_0x49c7ad);SmsMessageEvents['on'](_0x5ccb85,_0x560b07);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index e4dd378..e9bed27 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 _0xe02c=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','/describe','/:id','/:id/members','getMembers','getTeams','getAgents','post','/:id/teams','/:id/users','put','delete','destroy','removeTeams','exports','multer'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xe02c,0xae));var _0xce02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe02c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xce02('0x0'));var util=require('util');var path=require(_0xce02('0x1'));var timeout=require(_0xce02('0x2'));var express=require('express');var router=express[_0xce02('0x3')]();var fs_extra=require(_0xce02('0x4'));var auth=require(_0xce02('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xce02('0x6'));var controller=require(_0xce02('0x7'));router['get']('/',auth[_0xce02('0x8')](),controller[_0xce02('0x9')]);router[_0xce02('0xa')](_0xce02('0xb'),auth[_0xce02('0x8')](),controller['describe']);router[_0xce02('0xa')](_0xce02('0xc'),auth[_0xce02('0x8')](),controller['show']);router['get'](_0xce02('0xd'),auth[_0xce02('0x8')](),controller[_0xce02('0xe')]);router['get']('/:id/teams',auth[_0xce02('0x8')](),controller[_0xce02('0xf')]);router[_0xce02('0xa')]('/:id/users',auth[_0xce02('0x8')](),controller[_0xce02('0x10')]);router[_0xce02('0x11')]('/',auth[_0xce02('0x8')](),controller['create']);router[_0xce02('0x11')](_0xce02('0x12'),auth['isAuthenticated'](),controller['addTeams']);router[_0xce02('0x11')](_0xce02('0x13'),auth['isAuthenticated'](),controller['addAgents']);router[_0xce02('0x14')](_0xce02('0xc'),auth[_0xce02('0x8')](),controller['update']);router[_0xce02('0x15')]('/:id',auth[_0xce02('0x8')](),controller[_0xce02('0x16')]);router['delete'](_0xce02('0x12'),auth[_0xce02('0x8')](),controller[_0xce02('0x17')]);router[_0xce02('0x15')](_0xce02('0x13'),auth[_0xce02('0x8')](),controller['removeAgents']);module[_0xce02('0x18')]=router; \ No newline at end of file +var _0x1717=['create','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0x153e94,_0x8fb2f6){var _0x36b6a7=function(_0x46fac9){while(--_0x46fac9){_0x153e94['push'](_0x153e94['shift']());}};_0x36b6a7(++_0x8fb2f6);}(_0x1717,0x75));var _0x7171=function(_0xf4666e,_0x571140){_0xf4666e=_0xf4666e-0x0;var _0x1853f1=_0x1717[_0xf4666e];return _0x1853f1;};'use strict';var multer=require(_0x7171('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7171('0x1'));var router=express[_0x7171('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x7171('0x3'));var interaction=require(_0x7171('0x4'));var config=require(_0x7171('0x5'));var controller=require('./smsQueue.controller');router[_0x7171('0x6')]('/',auth[_0x7171('0x7')](),controller['index']);router[_0x7171('0x6')](_0x7171('0x8'),auth[_0x7171('0x7')](),controller['describe']);router['get'](_0x7171('0x9'),auth[_0x7171('0x7')](),controller[_0x7171('0xa')]);router['get'](_0x7171('0xb'),auth[_0x7171('0x7')](),controller[_0x7171('0xc')]);router[_0x7171('0x6')](_0x7171('0xd'),auth[_0x7171('0x7')](),controller[_0x7171('0xe')]);router['get'](_0x7171('0xf'),auth[_0x7171('0x7')](),controller[_0x7171('0x10')]);router[_0x7171('0x11')]('/',auth[_0x7171('0x7')](),controller[_0x7171('0x12')]);router[_0x7171('0x11')](_0x7171('0xd'),auth[_0x7171('0x7')](),controller[_0x7171('0x13')]);router[_0x7171('0x11')](_0x7171('0xf'),auth[_0x7171('0x7')](),controller[_0x7171('0x14')]);router[_0x7171('0x15')](_0x7171('0x9'),auth[_0x7171('0x7')](),controller['update']);router[_0x7171('0x16')](_0x7171('0x9'),auth[_0x7171('0x7')](),controller[_0x7171('0x17')]);router[_0x7171('0x16')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7171('0x18')]);router['delete'](_0x7171('0xf'),auth[_0x7171('0x7')](),controller[_0x7171('0x19')]);module[_0x7171('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 6e9e00b..10f1cd2 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 _0x31fa=['roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x25d2fb,_0x18a774){var _0x1ded53=function(_0x4c0715){while(--_0x4c0715){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0x1ded53(++_0x18a774);}(_0x31fa,0xc4));var _0xa31f=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x31fa[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0xa31f('0x0'));module[_0xa31f('0x1')]={'name':{'type':Sequelize[_0xa31f('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xa31f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0xa31f('0x4'))}}; \ No newline at end of file +var _0xd516=['INTEGER','ENUM','beepall','sequelize','exports','STRING'];(function(_0x235983,_0xd22673){var _0x538b67=function(_0x1f1546){while(--_0x1f1546){_0x235983['push'](_0x235983['shift']());}};_0x538b67(++_0xd22673);}(_0xd516,0x18f));var _0x6d51=function(_0x63848a,_0x3de459){_0x63848a=_0x63848a-0x0;var _0x3ad2fc=_0xd516[_0x63848a];return _0x3ad2fc;};'use strict';var Sequelize=require(_0x6d51('0x0'));module[_0x6d51('0x1')]={'name':{'type':Sequelize[_0x6d51('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6d51('0x2')]},'timeout':{'type':Sequelize[_0x6d51('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6d51('0x4')]('rrmemory',_0x6d51('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index c2bb683..b5c355c 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 _0x5f2f=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','type','key','getOptions','where','include','findAll','rows','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','sequelize','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x48ae97,_0x450240){var _0x13a62f=function(_0x139f44){while(--_0x139f44){_0x48ae97['push'](_0x48ae97['shift']());}};_0x13a62f(++_0x450240);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4a1304,_0x5c719d){_0x4a1304=_0x4a1304-0x0;var _0x194b46=_0x5f2f[_0x4a1304];return _0x194b46;};'use strict';var BPromise=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var squel=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var qs=require(_0xf5f2('0x5'));var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf5f2('0x8')]=_[_0xf5f2('0x9')](config[_0xf5f2('0x8')],{'host':_0xf5f2('0xa'),'port':0x18eb});var socket=require(_0xf5f2('0xb'))(new Redis(config[_0xf5f2('0x8')]));require('./smsQueue.socket')[_0xf5f2('0xc')](socket);function respondWithStatusCode(_0x46cd9c,_0x2ec345){_0x2ec345=_0x2ec345||0xcc;return function(_0x56a69f){if(_0x56a69f){return _0x46cd9c[_0xf5f2('0xd')](_0x2ec345);}return _0x46cd9c[_0xf5f2('0xe')](_0x2ec345)[_0xf5f2('0xf')]();};}function respondWithResult(_0x4e0e6b,_0x977a59){_0x977a59=_0x977a59||0xc8;return function(_0x4ebbbe){if(_0x4ebbbe){return _0x4e0e6b['status'](_0x977a59)[_0xf5f2('0x10')](_0x4ebbbe);}};}function respondWithFilteredResult(_0x151aba,_0x4b78cd){return function(_0x336f6b){if(_0x336f6b){var _0x14b51f=typeof _0x4b78cd[_0xf5f2('0x11')]===_0xf5f2('0x12')&&typeof _0x4b78cd[_0xf5f2('0x13')]===_0xf5f2('0x12');var _0x5c01b8=_0x336f6b[_0xf5f2('0x14')];var _0xea612c=_0x14b51f?0x0:_0x4b78cd[_0xf5f2('0x11')];var _0x1c1a5c=_0x14b51f?_0x336f6b[_0xf5f2('0x14')]:_0x4b78cd['offset']+_0x4b78cd[_0xf5f2('0x13')];var _0x286197;if(_0x1c1a5c>=_0x5c01b8){_0x1c1a5c=_0x5c01b8;_0x286197=0xc8;}else{_0x286197=0xce;}_0x151aba[_0xf5f2('0xe')](_0x286197);return _0x151aba[_0xf5f2('0x15')](_0xf5f2('0x16'),_0xea612c+'-'+_0x1c1a5c+'/'+_0x5c01b8)[_0xf5f2('0x10')](_0x336f6b);}return null;};}function saveUpdates(_0xdb61b3){return function(_0x395a5a){if(_0x395a5a){return _0x395a5a[_0xf5f2('0x17')](_0xdb61b3)[_0xf5f2('0x18')](function(_0x20fccd){return _0x20fccd;});}return null;};}function removeEntity(_0x28e097){return function(_0x4ff59b){if(_0x4ff59b){return _0x4ff59b[_0xf5f2('0x19')]()[_0xf5f2('0x18')](function(){var _0x626999=_0x4ff59b[_0xf5f2('0x1a')]({'plain':!![]});var _0x56acc5=_0xf5f2('0x1b');return db[_0xf5f2('0x1c')]['destroy']({'where':{'type':_0x56acc5,'resourceId':_0x626999['id']}})['then'](function(){return _0x4ff59b;});})[_0xf5f2('0x18')](function(){_0x28e097[_0xf5f2('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45b74f){return function(_0x170042){if(!_0x170042){_0x45b74f[_0xf5f2('0xd')](0x194);}return _0x170042;};}function handleError(_0x39c024,_0x36f1cb){_0x36f1cb=_0x36f1cb||0x1f4;return function(_0x4c691a){logger[_0xf5f2('0x1d')](_0x4c691a[_0xf5f2('0x1e')]);if(_0x4c691a[_0xf5f2('0x1f')]){delete _0x4c691a[_0xf5f2('0x1f')];}_0x39c024[_0xf5f2('0xe')](_0x36f1cb)['send'](_0x4c691a);};}exports['index']=function(_0x5f1124,_0x3f79d5){var _0x13da6f={};var _0x1a5bb3={'count':0x0,'rows':[]};var _0xf6c58d=_[_0xf5f2('0x20')](db[_0xf5f2('0x21')][_0xf5f2('0x22')],function(_0x294414){return{'name':_0x294414['fieldName'],'type':_0x294414[_0xf5f2('0x23')][_0xf5f2('0x24')]};});_0x13da6f=qs[_0xf5f2('0x25')](_0xf6c58d,_0x5f1124);var _0x31bfcb={'where':_0x13da6f[_0xf5f2('0x26')]};return db[_0xf5f2('0x21')]['count'](_0x31bfcb)['then'](function(_0x22c826){_0x1a5bb3[_0xf5f2('0x14')]=_0x22c826;_0x13da6f[_0xf5f2('0x27')]=qs['include'](_0x5f1124['query']);return db[_0xf5f2('0x21')][_0xf5f2('0x28')](_0x13da6f);})[_0xf5f2('0x18')](function(_0x153924){_0x1a5bb3[_0xf5f2('0x29')]=_0x153924;return _0x1a5bb3;})['then'](respondWithFilteredResult(_0x3f79d5,_0x13da6f))['catch'](handleError(_0x3f79d5,null));};exports[_0xf5f2('0x2a')]=function(_0x4e19cb,_0xb744b9){var _0x58a4df={'raw':!![],'where':{'id':_0x4e19cb[_0xf5f2('0x2b')]['id']}},_0x45b643={};_0x45b643[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x21')][_0xf5f2('0x22')]);_0x45b643[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x4e19cb['query']);_0x45b643[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],_0x45b643[_0xf5f2('0x2e')]);_0x58a4df[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],qs['fields'](_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x58a4df['attributes']=_0x58a4df[_0xf5f2('0x31')]['length']?_0x58a4df[_0xf5f2('0x31')]:_0x45b643[_0xf5f2('0x2c')];if(_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x33')]){_0x58a4df['include']=[{'all':!![]}];}_0x58a4df=_['merge']({},_0x58a4df,_0x4e19cb[_0xf5f2('0x34')]);return db[_0xf5f2('0x21')][_0xf5f2('0x35')](_0x58a4df)['then'](handleEntityNotFound(_0xb744b9,null))[_0xf5f2('0x18')](respondWithResult(_0xb744b9,null))['catch'](handleError(_0xb744b9,null));};exports[_0xf5f2('0x36')]=function(_0x566c47,_0x46f464){return db[_0xf5f2('0x21')]['create'](_0x566c47[_0xf5f2('0x37')],{})[_0xf5f2('0x18')](function(_0x5a4441){var _0x35f738=_0x566c47['user']['get']({'plain':!![]});if(!_0x35f738)throw new Error(_0xf5f2('0x38'));if(_0x35f738[_0xf5f2('0x39')]===_0xf5f2('0x3a')){var _0x2d4400=_0x5a4441[_0xf5f2('0x1a')]({'plain':!![]});var _0xe62b57=_0xf5f2('0x1b');return db['UserProfileSection'][_0xf5f2('0x35')]({'where':{'name':_0xe62b57,'userProfileId':_0x35f738[_0xf5f2('0x3b')]},'raw':!![]})['then'](function(_0xc6a1ae){if(_0xc6a1ae&&_0xc6a1ae[_0xf5f2('0x3c')]===0x0){return db[_0xf5f2('0x1c')][_0xf5f2('0x36')]({'name':_0x2d4400[_0xf5f2('0x1f')],'resourceId':_0x2d4400['id'],'type':_0xc6a1ae[_0xf5f2('0x1f')],'sectionId':_0xc6a1ae['id']},{})[_0xf5f2('0x18')](function(){return _0x5a4441;});}else{return _0x5a4441;}})[_0xf5f2('0x3d')](function(_0x574f24){logger[_0xf5f2('0x1d')](_0xf5f2('0x3e'),_0x574f24);throw _0x574f24;});}return _0x5a4441;})[_0xf5f2('0x18')](respondWithResult(_0x46f464,0xc9))['catch'](handleError(_0x46f464,null));};exports['update']=function(_0x59eb00,_0x76d21b){if(_0x59eb00[_0xf5f2('0x37')]['id']){delete _0x59eb00['body']['id'];}return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x59eb00[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x18')](saveUpdates(_0x59eb00[_0xf5f2('0x37')],null))[_0xf5f2('0x18')](respondWithResult(_0x76d21b,null))[_0xf5f2('0x3d')](handleError(_0x76d21b,null));};exports[_0xf5f2('0x19')]=function(_0x106062,_0x444317){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x106062[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x444317,null))[_0xf5f2('0x18')](removeEntity(_0x444317,null))['catch'](handleError(_0x444317,null));};exports[_0xf5f2('0x3f')]=function(_0xc04f44,_0x218def){return db[_0xf5f2('0x21')][_0xf5f2('0x3f')]()[_0xf5f2('0x18')](respondWithResult(_0x218def,null))['catch'](handleError(_0x218def,null));};exports[_0xf5f2('0x40')]=function(_0x2e7193,_0x1c1497){var _0x29b108={'raw':!![],'where':{}},_0x12124d={},_0x10753a;return db[_0xf5f2('0x21')][_0xf5f2('0x41')]({'where':{'id':_0x2e7193['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x1c1497,null))[_0xf5f2('0x18')](function(_0x45db9a){if(_0x45db9a){_0x10753a=_0x45db9a['get']({'plain':!![]});_0x12124d[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x42')]['rawAttributes']);_0x12124d['query']=_[_0xf5f2('0x2d')](_0x2e7193[_0xf5f2('0x2e')]);_0x12124d['filters']=_[_0xf5f2('0x30')](_0x12124d['model'],_0x12124d[_0xf5f2('0x2e')]);_0x29b108['attributes']=_[_0xf5f2('0x30')](_0x12124d['model'],qs[_0xf5f2('0x32')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x29b108[_0xf5f2('0x31')]=_0x29b108['attributes'][_0xf5f2('0x43')]?_0x29b108[_0xf5f2('0x31')]:_0x12124d['model'];if(!_0x2e7193['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x29b108['limit']=qs[_0xf5f2('0x13')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x29b108[_0xf5f2('0x11')]=qs['offset'](_0x2e7193['query'][_0xf5f2('0x11')]);}_0x29b108[_0xf5f2('0x46')]=qs['sort'](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x29b108[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2e7193[_0xf5f2('0x2e')],_0x12124d[_0xf5f2('0x2f')]));_0x29b108['where']['SmsQueueId']=_0x45db9a['id'];if(_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x29b108[_0xf5f2('0x26')]=_[_0xf5f2('0x4a')](_0x29b108[_0xf5f2('0x26')],{'$or':_['map'](_0x29b108[_0xf5f2('0x31')],function(_0x20ba91){var _0x18b124={};_0x18b124[_0x20ba91]={'$like':'%'+_0x2e7193['query'][_0xf5f2('0x49')]+'%'};return _0x18b124;})});}_0x29b108=_['merge']({},_0x29b108,_0x2e7193[_0xf5f2('0x34')]);return db[_0xf5f2('0x42')][_0xf5f2('0x28')](_0x29b108);}})[_0xf5f2('0x18')](function(_0x4afa4d){if(_0x4afa4d){return db['User'][_0xf5f2('0x4b')]({'where':{'id':_['map'](_0x4afa4d,_0xf5f2('0x4c')),'role':_0xf5f2('0x4d')},'attributes':['id','name',_0xf5f2('0x4e'),_0xf5f2('0x4f'),_0xf5f2('0x50')]});}})['then'](function(_0x397b99){if(_0x397b99){return{'count':_0x397b99[_0xf5f2('0x14')],'rows':_[_0xf5f2('0x20')](_0x397b99[_0xf5f2('0x29')],function(_0x51fa7e){return{'membername':_0x51fa7e[_0xf5f2('0x1f')],'UserId':_0x51fa7e['id'],'queue_name':_0x10753a['name'],'SmsQueueId':_0x10753a['id'],'interface':util[_0xf5f2('0x51')](_0xf5f2('0x52'),_0xf5f2('0x53'),_0x51fa7e[_0xf5f2('0x1f')]),'penalty':0x0,'paused':_0x51fa7e[_0xf5f2('0x4e')],'createdAt':_0x51fa7e['createdAt'],'updatedAt':_0x51fa7e[_0xf5f2('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5f2('0x18')](respondWithFilteredResult(_0x1c1497,_0x29b108))[_0xf5f2('0x3d')](handleError(_0x1c1497,null));};exports[_0xf5f2('0x54')]=function(_0x2c5733,_0x5359b5){var _0x31e16b={};var _0x5ee6bc={};var _0x4c96ee;var _0xd4f6ef;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x2c5733[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5359b5,null))[_0xf5f2('0x18')](function(_0x5767fc){if(_0x5767fc){_0x4c96ee=_0x5767fc;_0x5ee6bc[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x55')][_0xf5f2('0x22')]);_0x5ee6bc[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x2c5733[_0xf5f2('0x2e')]);_0x5ee6bc['filters']=_[_0xf5f2('0x30')](_0x5ee6bc[_0xf5f2('0x2c')],_0x5ee6bc[_0xf5f2('0x2e')]);_0x31e16b[_0xf5f2('0x31')]=_['intersection'](_0x5ee6bc[_0xf5f2('0x2c')],qs['fields'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x31e16b['attributes']=_0x31e16b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x31e16b[_0xf5f2('0x31')]:_0x5ee6bc[_0xf5f2('0x2c')];_0x31e16b[_0xf5f2('0x46')]=qs['sort'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x31e16b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2c5733[_0xf5f2('0x2e')],_0x5ee6bc['filters']));if(_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x31e16b['where']=_[_0xf5f2('0x4a')](_0x31e16b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x31e16b['attributes'],function(_0x551cc9){var _0x4f3df6={};_0x4f3df6[_0x551cc9]={'$like':'%'+_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]+'%'};return _0x4f3df6;})});}_0x31e16b=_[_0xf5f2('0x4a')]({},_0x31e16b,_0x2c5733[_0xf5f2('0x34')]);return _0x4c96ee[_0xf5f2('0x54')](_0x31e16b);}})['then'](function(_0x278b76){if(_0x278b76){_0xd4f6ef=_0x278b76[_0xf5f2('0x43')];if(!_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x31e16b[_0xf5f2('0x13')]=qs[_0xf5f2('0x13')](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x31e16b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x2c5733['query']['offset']);}return _0x4c96ee['getTeams'](_0x31e16b);}})[_0xf5f2('0x18')](function(_0xafba8e){if(_0xafba8e){return _0xafba8e?{'count':_0xd4f6ef,'rows':_0xafba8e}:null;}})[_0xf5f2('0x18')](respondWithResult(_0x5359b5,null))[_0xf5f2('0x3d')](handleError(_0x5359b5,null));};exports[_0xf5f2('0x56')]=function(_0x5c6959,_0x9d943f){var _0x43c732=_0x5c6959[_0xf5f2('0x37')][_0xf5f2('0x57')];return db[_0xf5f2('0x55')]['findAll']({'where':{'id':_0x43c732},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':_0xf5f2('0x59'),'attributes':['id','name',_0xf5f2('0x5a'),_0xf5f2('0x5b'),_0xf5f2('0x5c')],'raw':!![]}]})[_0xf5f2('0x18')](function(_0x588434){if(_0x588434){var _0x40b36e=_[_0xf5f2('0x5d')](_0x588434,function(_0x19602d){var _0x2adeb4=_0x19602d[_0xf5f2('0x1a')]({'plain':!![]});return _0x2adeb4['Agents'];});return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x5c6959[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0xe3ea1e){return db['sequelize']['transaction'](function(_0x16048e){return _0xe3ea1e['addTeams'](_0x43c732,{'transaction':_0x16048e})['then'](function(){return BPromise['each'](_0x40b36e,function(_0x57cb18){return db[_0xf5f2('0x42')][_0xf5f2('0x5e')]({'where':{'UserId':_0x57cb18['id'],'SmsQueueId':_0x5c6959[_0xf5f2('0x2b')]['id']},'transaction':_0x16048e});});})[_0xf5f2('0x18')](function(){_0x40b36e[_0xf5f2('0x5f')](function(_0x9f941e){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':_0x9f941e['id'],'SmsQueueId':_0xe3ea1e['id']});});});});});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x9d943f,null))[_0xf5f2('0x3d')](handleError(_0x9d943f,null));};exports[_0xf5f2('0x62')]=function(_0x2afeac,_0x1ba503){return db[_0xf5f2('0x55')][_0xf5f2('0x28')]({'where':{'id':_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')]},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf5f2('0x18')](handleEntityNotFound(_0x1ba503,null))[_0xf5f2('0x18')](function(_0x21043b){var _0x2811ad=_[_0xf5f2('0x20')](_0x21043b,'id');var _0x308220=[];var _0x16491c=[];var _0xcf48eb=squel['select']();_0xcf48eb[_0xf5f2('0x63')]('tq.TeamId')['from']('team_has_sms_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf5f2('0x26')](_0xf5f2('0x64'),_0x2afeac[_0xf5f2('0x2b')]['id']);for(var _0x375bc9=0x0;_0x375bc9<_0x21043b[_0xf5f2('0x43')];_0x375bc9+=0x1){let _0x3cf857=_0x21043b[_0x375bc9];for(var _0x5dc63f=0x0;_0x5dc63f<_0x3cf857['Agents'][_0xf5f2('0x43')];_0x5dc63f+=0x1){let _0x578a22=_0x3cf857[_0xf5f2('0x59')][_0x5dc63f];var _0x186fdd=_0xcf48eb['clone']();_0x186fdd['where'](_0xf5f2('0x65'),_0x578a22['id']);_0x16491c[_0xf5f2('0x66')](db['sequelize'][_0xf5f2('0x2e')](_0x186fdd[_0xf5f2('0x67')](),{'type':db['sequelize'][_0xf5f2('0x68')][_0xf5f2('0x69')]})[_0xf5f2('0x18')](function(_0x4c1678){if(_0x4c1678[_0xf5f2('0x43')]===0x1){return _0x578a22['id'];}else{var _0xc28adc=_[_0xf5f2('0x6a')](_[_0xf5f2('0x20')](_0x4c1678,_0xf5f2('0x6b')),function(_0x3e0288){return _[_0xf5f2('0x6c')](_0x2811ad,_0x3e0288);});if(_0xc28adc){return _0x578a22['id'];}}}));}}return BPromise[_0xf5f2('0x6d')](_0x16491c)[_0xf5f2('0x18')](function(_0x3a6f60){_0x308220=_(_0x308220)[_0xf5f2('0x6e')](_0x3a6f60)[_0xf5f2('0x6f')]()[_0xf5f2('0x70')]();return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2afeac[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0x29a9d4){return db[_0xf5f2('0x71')][_0xf5f2('0x72')](function(_0x800f42){return _0x29a9d4['removeTeams'](_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')],{'transaction':_0x800f42})['then'](function(){if(!_[_0xf5f2('0x73')](_0x308220)){return _0x29a9d4[_0xf5f2('0x74')](_0x308220,{'transaction':_0x800f42});}})['then'](function(){_0x308220[_0xf5f2('0x5f')](function(_0x2f54eb){socket[_0xf5f2('0x60')]('userSmsQueue:remove',{'UserId':_0x2f54eb,'SmsQueueId':_0x29a9d4['id']});});});});});});})['then'](respondWithStatusCode(_0x1ba503,null))[_0xf5f2('0x3d')](handleError(_0x1ba503,null));};exports[_0xf5f2('0x75')]=function(_0x213ade,_0x5ba275){return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x213ade[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5ba275,null))['then'](function(_0x4cde64){if(_0x4cde64){return _0x4cde64['addAgents'](_0x213ade['body']['ids'],_[_0xf5f2('0x76')](_0x213ade['body'],[_0xf5f2('0x57'),'id'])||{})[_0xf5f2('0x77')](function(_0xec3c35){for(var _0x43a167=0x0;_0x43a167<_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0xf5f2('0x43')];_0x43a167+=0x1){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':Number(_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0x43a167]),'SmsQueueId':Number(_0x213ade[_0xf5f2('0x2b')]['id'])});}return _0xec3c35;});}})[_0xf5f2('0x18')](respondWithResult(_0x5ba275,null))['catch'](handleError(_0x5ba275,null));};exports[_0xf5f2('0x74')]=function(_0x2a4fed,_0x5783e2){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2a4fed['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5783e2,null))[_0xf5f2('0x18')](function(_0x281f61){if(_0x281f61){return _0x281f61['removeAgents'](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])['then'](function(){if(_[_0xf5f2('0x78')](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])){for(var _0x517aa8=0x0;_0x517aa8<_0x2a4fed[_0xf5f2('0x2e')]['ids'][_0xf5f2('0x43')];_0x517aa8+=0x1){socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')][_0x517aa8]),'SmsQueueId':Number(_0x2a4fed[_0xf5f2('0x2b')]['id'])});}}else{socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed['query']['ids']),'SmsQueueId':Number(_0x2a4fed['params']['id'])});}});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x5783e2,null))[_0xf5f2('0x3d')](handleError(_0x5783e2,null));};exports['getAgents']=function(_0x3c8a1b,_0x15025d){var _0x35790b={};var _0x3962b2={};var _0x28873e;var _0x1fc5ae;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x3c8a1b[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x15025d,null))[_0xf5f2('0x18')](function(_0x19cbff){if(_0x19cbff){_0x28873e=_0x19cbff;_0x3962b2['model']=_[_0xf5f2('0x2d')](db[_0xf5f2('0x58')][_0xf5f2('0x22')]);_0x3962b2[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x3c8a1b[_0xf5f2('0x2e')]);_0x3962b2['filters']=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],_0x3962b2[_0xf5f2('0x2e')]);_0x35790b[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],qs[_0xf5f2('0x32')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x35790b['attributes']=_0x35790b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x35790b[_0xf5f2('0x31')]:_0x3962b2[_0xf5f2('0x2c')];_0x35790b[_0xf5f2('0x46')]=qs[_0xf5f2('0x47')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x35790b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_['pick'](_0x3c8a1b['query'],_0x3962b2[_0xf5f2('0x2f')]));if(_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x35790b[_0xf5f2('0x26')]=_['merge'](_0x35790b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x35790b[_0xf5f2('0x31')],function(_0x3d7f53){var _0x456a1e={};_0x456a1e[_0x3d7f53]={'$like':'%'+_0x3c8a1b['query'][_0xf5f2('0x49')]+'%'};return _0x456a1e;})});}_0x35790b=_[_0xf5f2('0x4a')]({},_0x35790b,_0x3c8a1b['options']);return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})[_0xf5f2('0x18')](function(_0x2563fa){if(_0x2563fa){_0x1fc5ae=_0x2563fa[_0xf5f2('0x43')];if(!_0x3c8a1b['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x35790b[_0xf5f2('0x13')]=qs['limit'](_0x3c8a1b['query'][_0xf5f2('0x13')]);_0x35790b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x11')]);}return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})['then'](function(_0x39dee8){if(_0x39dee8){return _0x39dee8?{'count':_0x1fc5ae,'rows':_0x39dee8}:null;}})['then'](respondWithResult(_0x15025d,null))[_0xf5f2('0x3d')](handleError(_0x15025d,null));}; \ No newline at end of file +var _0x5f66=['show','params','model','keys','intersection','attributes','fields','includeAll','merge','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','rawAttributes','filters','hasOwnProperty','order','sort','pick','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','length','filter','nolimit','ids','Team','Agents','interface','flatMap','sequelize','transaction','addTeams','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','findOne','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','./smsQueue.socket','register','end','json','offset','limit','undefined','count','status','update','then','UserProfileResource','destroy','sendStatus','stack','name','send','index','fieldName','key','getOptions','where','SmsQueue','include','query','findAll','catch'];(function(_0x3a9a6a,_0x51afcd){var _0xc860c8=function(_0x4578b6){while(--_0x4578b6){_0x3a9a6a['push'](_0x3a9a6a['shift']());}};_0xc860c8(++_0x51afcd);}(_0x5f66,0x1a0));var _0x65f6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5f66[_0x13d07a];return _0x5ee0ee;};'use strict';var BPromise=require('bluebird');var util=require(_0x65f6('0x0'));var _=require('lodash');var squel=require(_0x65f6('0x1'));var Redis=require(_0x65f6('0x2'));var qs=require(_0x65f6('0x3'));var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../config/environment');var db=require(_0x65f6('0x6'))['db'];config['redis']=_[_0x65f6('0x7')](config[_0x65f6('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65f6('0x8')]));require(_0x65f6('0x9'))[_0x65f6('0xa')](socket);function respondWithStatusCode(_0x8f6451,_0xc44c70){_0xc44c70=_0xc44c70||0xcc;return function(_0x14f4c7){if(_0x14f4c7){return _0x8f6451['sendStatus'](_0xc44c70);}return _0x8f6451['status'](_0xc44c70)[_0x65f6('0xb')]();};}function respondWithResult(_0x2f6d5b,_0x264647){_0x264647=_0x264647||0xc8;return function(_0x25c416){if(_0x25c416){return _0x2f6d5b['status'](_0x264647)[_0x65f6('0xc')](_0x25c416);}};}function respondWithFilteredResult(_0x571436,_0x497cf3){return function(_0x2d2dfa){if(_0x2d2dfa){var _0x576875=typeof _0x497cf3[_0x65f6('0xd')]==='undefined'&&typeof _0x497cf3[_0x65f6('0xe')]===_0x65f6('0xf');var _0x2c4ee5=_0x2d2dfa[_0x65f6('0x10')];var _0x369f96=_0x576875?0x0:_0x497cf3[_0x65f6('0xd')];var _0x44144b=_0x576875?_0x2d2dfa[_0x65f6('0x10')]:_0x497cf3[_0x65f6('0xd')]+_0x497cf3[_0x65f6('0xe')];var _0x59154e;if(_0x44144b>=_0x2c4ee5){_0x44144b=_0x2c4ee5;_0x59154e=0xc8;}else{_0x59154e=0xce;}_0x571436[_0x65f6('0x11')](_0x59154e);return _0x571436['set']('Content-Range',_0x369f96+'-'+_0x44144b+'/'+_0x2c4ee5)[_0x65f6('0xc')](_0x2d2dfa);}return null;};}function saveUpdates(_0x5c69f8){return function(_0x37330d){if(_0x37330d){return _0x37330d[_0x65f6('0x12')](_0x5c69f8)[_0x65f6('0x13')](function(_0x1f974c){return _0x1f974c;});}return null;};}function removeEntity(_0xc8660c){return function(_0x18380e){if(_0x18380e){return _0x18380e['destroy']()['then'](function(){var _0x2d538c=_0x18380e['get']({'plain':!![]});var _0x4c81f3='SmsQueues';return db[_0x65f6('0x14')][_0x65f6('0x15')]({'where':{'type':_0x4c81f3,'resourceId':_0x2d538c['id']}})['then'](function(){return _0x18380e;});})[_0x65f6('0x13')](function(){_0xc8660c[_0x65f6('0x11')](0xcc)[_0x65f6('0xb')]();});}};}function handleEntityNotFound(_0x3876ed){return function(_0x219ab2){if(!_0x219ab2){_0x3876ed[_0x65f6('0x16')](0x194);}return _0x219ab2;};}function handleError(_0x581374,_0x197a49){_0x197a49=_0x197a49||0x1f4;return function(_0x4bb39e){logger['error'](_0x4bb39e[_0x65f6('0x17')]);if(_0x4bb39e[_0x65f6('0x18')]){delete _0x4bb39e['name'];}_0x581374[_0x65f6('0x11')](_0x197a49)[_0x65f6('0x19')](_0x4bb39e);};}exports[_0x65f6('0x1a')]=function(_0x2774a1,_0x4f5a69){var _0x9d7bb0={};var _0x59ea32={'count':0x0,'rows':[]};var _0x20a161=_['map'](db['SmsQueue']['rawAttributes'],function(_0x29abdb){return{'name':_0x29abdb[_0x65f6('0x1b')],'type':_0x29abdb['type'][_0x65f6('0x1c')]};});_0x9d7bb0=qs[_0x65f6('0x1d')](_0x20a161,_0x2774a1);var _0x52277c={'where':_0x9d7bb0[_0x65f6('0x1e')]};return db[_0x65f6('0x1f')][_0x65f6('0x10')](_0x52277c)['then'](function(_0x4ac04b){_0x59ea32['count']=_0x4ac04b;_0x9d7bb0[_0x65f6('0x20')]=qs[_0x65f6('0x20')](_0x2774a1[_0x65f6('0x21')]);return db[_0x65f6('0x1f')][_0x65f6('0x22')](_0x9d7bb0);})[_0x65f6('0x13')](function(_0x144e55){_0x59ea32['rows']=_0x144e55;return _0x59ea32;})['then'](respondWithFilteredResult(_0x4f5a69,_0x9d7bb0))[_0x65f6('0x23')](handleError(_0x4f5a69,null));};exports[_0x65f6('0x24')]=function(_0x5878bc,_0x4e50c0){var _0x10b368={'raw':!![],'where':{'id':_0x5878bc[_0x65f6('0x25')]['id']}},_0x1ce43c={};_0x1ce43c[_0x65f6('0x26')]=_[_0x65f6('0x27')](db[_0x65f6('0x1f')]['rawAttributes']);_0x1ce43c[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x5878bc[_0x65f6('0x21')]);_0x1ce43c['filters']=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],_0x1ce43c[_0x65f6('0x21')]);_0x10b368[_0x65f6('0x29')]=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],qs['fields'](_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x10b368['attributes']=_0x10b368[_0x65f6('0x29')]['length']?_0x10b368[_0x65f6('0x29')]:_0x1ce43c['model'];if(_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2b')]){_0x10b368['include']=[{'all':!![]}];}_0x10b368=_[_0x65f6('0x2c')]({},_0x10b368,_0x5878bc[_0x65f6('0x2d')]);return db[_0x65f6('0x1f')]['find'](_0x10b368)['then'](handleEntityNotFound(_0x4e50c0,null))[_0x65f6('0x13')](respondWithResult(_0x4e50c0,null))['catch'](handleError(_0x4e50c0,null));};exports[_0x65f6('0x2e')]=function(_0x4e6653,_0x22d760){return db[_0x65f6('0x1f')]['create'](_0x4e6653[_0x65f6('0x2f')],{})['then'](function(_0x5edd04){var _0x71b16b=_0x4e6653[_0x65f6('0x30')][_0x65f6('0x31')]({'plain':!![]});if(!_0x71b16b)throw new Error(_0x65f6('0x32'));if(_0x71b16b[_0x65f6('0x33')]===_0x65f6('0x30')){var _0x1a55da=_0x5edd04[_0x65f6('0x31')]({'plain':!![]});var _0x4f933b=_0x65f6('0x34');return db['UserProfileSection'][_0x65f6('0x35')]({'where':{'name':_0x4f933b,'userProfileId':_0x71b16b[_0x65f6('0x36')]},'raw':!![]})[_0x65f6('0x13')](function(_0x2ea7f7){if(_0x2ea7f7&&_0x2ea7f7['autoAssociation']===0x0){return db[_0x65f6('0x14')][_0x65f6('0x2e')]({'name':_0x1a55da[_0x65f6('0x18')],'resourceId':_0x1a55da['id'],'type':_0x2ea7f7[_0x65f6('0x18')],'sectionId':_0x2ea7f7['id']},{})[_0x65f6('0x13')](function(){return _0x5edd04;});}else{return _0x5edd04;}})[_0x65f6('0x23')](function(_0xed4c96){logger[_0x65f6('0x37')](_0x65f6('0x38'),_0xed4c96);throw _0xed4c96;});}return _0x5edd04;})['then'](respondWithResult(_0x22d760,0xc9))[_0x65f6('0x23')](handleError(_0x22d760,null));};exports[_0x65f6('0x12')]=function(_0x377ae5,_0x181798){if(_0x377ae5[_0x65f6('0x2f')]['id']){delete _0x377ae5[_0x65f6('0x2f')]['id'];}return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x377ae5[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x181798,null))[_0x65f6('0x13')](saveUpdates(_0x377ae5[_0x65f6('0x2f')],null))[_0x65f6('0x13')](respondWithResult(_0x181798,null))[_0x65f6('0x23')](handleError(_0x181798,null));};exports[_0x65f6('0x15')]=function(_0x2cb38d,_0x5119ee){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x2cb38d[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x5119ee,null))['then'](removeEntity(_0x5119ee,null))[_0x65f6('0x23')](handleError(_0x5119ee,null));};exports[_0x65f6('0x39')]=function(_0x2b01eb,_0x5e69b4){return db[_0x65f6('0x1f')][_0x65f6('0x39')]()[_0x65f6('0x13')](respondWithResult(_0x5e69b4,null))[_0x65f6('0x23')](handleError(_0x5e69b4,null));};exports['getMembers']=function(_0x2ec114,_0x512527){var _0x3f1baa={'raw':!![],'where':{}},_0x6968b={},_0x577c93;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x2ec114[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x512527,null))[_0x65f6('0x13')](function(_0xc0db01){if(_0xc0db01){_0x577c93=_0xc0db01[_0x65f6('0x31')]({'plain':!![]});_0x6968b[_0x65f6('0x26')]=_['keys'](db['UserSmsQueue'][_0x65f6('0x3a')]);_0x6968b[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x2ec114[_0x65f6('0x21')]);_0x6968b[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x6968b[_0x65f6('0x26')],_0x6968b[_0x65f6('0x21')]);_0x3f1baa[_0x65f6('0x29')]=_['intersection'](_0x6968b[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x2ec114[_0x65f6('0x21')]['fields']));_0x3f1baa[_0x65f6('0x29')]=_0x3f1baa[_0x65f6('0x29')]['length']?_0x3f1baa[_0x65f6('0x29')]:_0x6968b[_0x65f6('0x26')];if(!_0x2ec114['query'][_0x65f6('0x3c')]('nolimit')){_0x3f1baa[_0x65f6('0xe')]=qs[_0x65f6('0xe')](_0x2ec114[_0x65f6('0x21')]['limit']);_0x3f1baa[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x2ec114['query'][_0x65f6('0xd')]);}_0x3f1baa[_0x65f6('0x3d')]=qs['sort'](_0x2ec114[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x3f1baa[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x2ec114[_0x65f6('0x21')],_0x6968b[_0x65f6('0x3b')]));_0x3f1baa[_0x65f6('0x1e')]['SmsQueueId']=_0xc0db01['id'];if(_0x2ec114['query']['filter']){_0x3f1baa[_0x65f6('0x1e')]=_[_0x65f6('0x2c')](_0x3f1baa[_0x65f6('0x1e')],{'$or':_[_0x65f6('0x40')](_0x3f1baa['attributes'],function(_0x183c08){var _0x2032b9={};_0x2032b9[_0x183c08]={'$like':'%'+_0x2ec114[_0x65f6('0x21')]['filter']+'%'};return _0x2032b9;})});}_0x3f1baa=_[_0x65f6('0x2c')]({},_0x3f1baa,_0x2ec114[_0x65f6('0x2d')]);return db[_0x65f6('0x41')]['findAll'](_0x3f1baa);}})['then'](function(_0x1d337d){if(_0x1d337d){return db[_0x65f6('0x42')][_0x65f6('0x43')]({'where':{'id':_[_0x65f6('0x40')](_0x1d337d,_0x65f6('0x44')),'role':_0x65f6('0x45')},'attributes':['id',_0x65f6('0x18'),_0x65f6('0x46'),_0x65f6('0x47'),_0x65f6('0x48')]});}})[_0x65f6('0x13')](function(_0x141fcc){if(_0x141fcc){return{'count':_0x141fcc[_0x65f6('0x10')],'rows':_[_0x65f6('0x40')](_0x141fcc['rows'],function(_0x47610a){return{'membername':_0x47610a[_0x65f6('0x18')],'UserId':_0x47610a['id'],'queue_name':_0x577c93[_0x65f6('0x18')],'SmsQueueId':_0x577c93['id'],'interface':util['format'](_0x65f6('0x49'),_0x65f6('0x4a'),_0x47610a[_0x65f6('0x18')]),'penalty':0x0,'paused':_0x47610a[_0x65f6('0x46')],'createdAt':_0x47610a['createdAt'],'updatedAt':_0x47610a[_0x65f6('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x65f6('0x13')](respondWithFilteredResult(_0x512527,_0x3f1baa))[_0x65f6('0x23')](handleError(_0x512527,null));};exports[_0x65f6('0x4b')]=function(_0x553ff0,_0x2923ff){var _0x2fc20f={};var _0x5c55e4={};var _0x28682b;var _0x26481e;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x553ff0[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x2923ff,null))[_0x65f6('0x13')](function(_0x3c23e3){if(_0x3c23e3){_0x28682b=_0x3c23e3;_0x5c55e4[_0x65f6('0x26')]=_[_0x65f6('0x27')](db['Team']['rawAttributes']);_0x5c55e4['query']=_[_0x65f6('0x27')](_0x553ff0[_0x65f6('0x21')]);_0x5c55e4[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],_0x5c55e4[_0x65f6('0x21')]);_0x2fc20f['attributes']=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],qs['fields'](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x2fc20f[_0x65f6('0x29')]=_0x2fc20f['attributes'][_0x65f6('0x4c')]?_0x2fc20f[_0x65f6('0x29')]:_0x5c55e4['model'];_0x2fc20f[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x2fc20f[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x553ff0['query'],_0x5c55e4['filters']));if(_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x2fc20f['where']=_[_0x65f6('0x2c')](_0x2fc20f['where'],{'$or':_[_0x65f6('0x40')](_0x2fc20f['attributes'],function(_0x440df1){var _0xdc8989={};_0xdc8989[_0x440df1]={'$like':'%'+_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0xdc8989;})});}_0x2fc20f=_[_0x65f6('0x2c')]({},_0x2fc20f,_0x553ff0[_0x65f6('0x2d')]);return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})[_0x65f6('0x13')](function(_0x2405a7){if(_0x2405a7){_0x26481e=_0x2405a7['length'];if(!_0x553ff0['query'][_0x65f6('0x3c')](_0x65f6('0x4e'))){_0x2fc20f[_0x65f6('0xe')]=qs['limit'](_0x553ff0['query'][_0x65f6('0xe')]);_0x2fc20f[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0xd')]);}return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})['then'](function(_0x4f42ae){if(_0x4f42ae){return _0x4f42ae?{'count':_0x26481e,'rows':_0x4f42ae}:null;}})[_0x65f6('0x13')](respondWithResult(_0x2923ff,null))[_0x65f6('0x23')](handleError(_0x2923ff,null));};exports['addTeams']=function(_0x219bf8,_0x4a8b60){var _0x254e9f=_0x219bf8[_0x65f6('0x2f')][_0x65f6('0x4f')];return db[_0x65f6('0x50')]['findAll']({'where':{'id':_0x254e9f},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id',_0x65f6('0x18'),'online','voicePause',_0x65f6('0x52')],'raw':!![]}]})['then'](function(_0x305967){if(_0x305967){var _0xf6de=_[_0x65f6('0x53')](_0x305967,function(_0x354b90){var _0x512776=_0x354b90['get']({'plain':!![]});return _0x512776['Agents'];});return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x219bf8[_0x65f6('0x25')]['id']}})['then'](function(_0x46cbde){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x49cee2){return _0x46cbde[_0x65f6('0x56')](_0x254e9f,{'transaction':_0x49cee2})[_0x65f6('0x13')](function(){return BPromise['each'](_0xf6de,function(_0x758e80){return db[_0x65f6('0x41')]['findOrCreate']({'where':{'UserId':_0x758e80['id'],'SmsQueueId':_0x219bf8[_0x65f6('0x25')]['id']},'transaction':_0x49cee2});});})['then'](function(){_0xf6de[_0x65f6('0x57')](function(_0x55ea91){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':_0x55ea91['id'],'SmsQueueId':_0x46cbde['id']});});});});});}})['then'](respondWithStatusCode(_0x4a8b60,null))[_0x65f6('0x23')](handleError(_0x4a8b60,null));};exports[_0x65f6('0x5a')]=function(_0x2a700b,_0x299b85){return db[_0x65f6('0x50')][_0x65f6('0x22')]({'where':{'id':_0x2a700b[_0x65f6('0x21')][_0x65f6('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id'],'raw':!![]}]})[_0x65f6('0x13')](handleEntityNotFound(_0x299b85,null))['then'](function(_0x10a661){var _0x1cf1bd=_[_0x65f6('0x40')](_0x10a661,'id');var _0x219e42=[];var _0x5694f9=[];var _0x453080=squel[_0x65f6('0x5b')]();_0x453080['field'](_0x65f6('0x5c'))['from'](_0x65f6('0x5d'),'tq')['join'](_0x65f6('0x5e'),'ut',_0x65f6('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x2a700b[_0x65f6('0x25')]['id']);for(var _0x413c21=0x0;_0x413c21<_0x10a661['length'];_0x413c21+=0x1){let _0x2d86c8=_0x10a661[_0x413c21];for(var _0x3b3bd5=0x0;_0x3b3bd5<_0x2d86c8[_0x65f6('0x51')]['length'];_0x3b3bd5+=0x1){let _0x1348ec=_0x2d86c8[_0x65f6('0x51')][_0x3b3bd5];var _0x5889dc=_0x453080[_0x65f6('0x60')]();_0x5889dc['where'](_0x65f6('0x61'),_0x1348ec['id']);_0x5694f9['push'](db['sequelize'][_0x65f6('0x21')](_0x5889dc[_0x65f6('0x62')](),{'type':db[_0x65f6('0x54')][_0x65f6('0x63')][_0x65f6('0x64')]})[_0x65f6('0x13')](function(_0x1ac46f){if(_0x1ac46f[_0x65f6('0x4c')]===0x1){return _0x1348ec['id'];}else{var _0x4d66fe=_['every'](_[_0x65f6('0x40')](_0x1ac46f,'TeamId'),function(_0x1ee28a){return _[_0x65f6('0x65')](_0x1cf1bd,_0x1ee28a);});if(_0x4d66fe){return _0x1348ec['id'];}}}));}}return BPromise[_0x65f6('0x66')](_0x5694f9)[_0x65f6('0x13')](function(_0x43127b){_0x219e42=_(_0x219e42)['union'](_0x43127b)[_0x65f6('0x67')]()[_0x65f6('0x68')]();return db[_0x65f6('0x1f')]['find']({'where':{'id':_0x2a700b[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](function(_0x4254c2){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x16bf93){return _0x4254c2['removeTeams'](_0x2a700b['query'][_0x65f6('0x4f')],{'transaction':_0x16bf93})[_0x65f6('0x13')](function(){if(!_[_0x65f6('0x69')](_0x219e42)){return _0x4254c2[_0x65f6('0x6a')](_0x219e42,{'transaction':_0x16bf93});}})['then'](function(){_0x219e42['forEach'](function(_0x336076){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':_0x336076,'SmsQueueId':_0x4254c2['id']});});});});});});})[_0x65f6('0x13')](respondWithStatusCode(_0x299b85,null))[_0x65f6('0x23')](handleError(_0x299b85,null));};exports[_0x65f6('0x6c')]=function(_0x5daaf4,_0x4d607a){return db['SmsQueue'][_0x65f6('0x35')]({'where':{'id':_0x5daaf4[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x4d607a,null))[_0x65f6('0x13')](function(_0x53b11c){if(_0x53b11c){return _0x53b11c['addAgents'](_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')],_['omit'](_0x5daaf4[_0x65f6('0x2f')],['ids','id'])||{})[_0x65f6('0x6d')](function(_0x4f3ef8){for(var _0x3a30ed=0x0;_0x3a30ed<_0x5daaf4[_0x65f6('0x2f')]['ids'][_0x65f6('0x4c')];_0x3a30ed+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':Number(_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')][_0x3a30ed]),'SmsQueueId':Number(_0x5daaf4[_0x65f6('0x25')]['id'])});}return _0x4f3ef8;});}})['then'](respondWithResult(_0x4d607a,null))[_0x65f6('0x23')](handleError(_0x4d607a,null));};exports['removeAgents']=function(_0x24495c,_0x56336a){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x24495c[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x56336a,null))['then'](function(_0x2b6f98){if(_0x2b6f98){return _0x2b6f98[_0x65f6('0x6a')](_0x24495c[_0x65f6('0x21')]['ids'])['then'](function(){if(_[_0x65f6('0x6e')](_0x24495c[_0x65f6('0x21')]['ids'])){for(var _0x180cde=0x0;_0x180cde<_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]['length'];_0x180cde+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':Number(_0x24495c['query'][_0x65f6('0x4f')][_0x180cde]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}}else{socket[_0x65f6('0x58')]('userSmsQueue:remove',{'UserId':Number(_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}});}})['then'](respondWithStatusCode(_0x56336a,null))[_0x65f6('0x23')](handleError(_0x56336a,null));};exports['getAgents']=function(_0x1beaa7,_0x87a9e4){var _0x31ec61={};var _0x22be6e={};var _0x29b2de;var _0x430fb8;return db['SmsQueue'][_0x65f6('0x6f')]({'where':{'id':_0x1beaa7[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x87a9e4,null))[_0x65f6('0x13')](function(_0x207d15){if(_0x207d15){_0x29b2de=_0x207d15;_0x22be6e['model']=_['keys'](db['User'][_0x65f6('0x3a')]);_0x22be6e[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x1beaa7['query']);_0x22be6e[_0x65f6('0x3b')]=_['intersection'](_0x22be6e['model'],_0x22be6e[_0x65f6('0x21')]);_0x31ec61[_0x65f6('0x29')]=_['intersection'](_0x22be6e[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x31ec61[_0x65f6('0x29')]=_0x31ec61[_0x65f6('0x29')][_0x65f6('0x4c')]?_0x31ec61[_0x65f6('0x29')]:_0x22be6e[_0x65f6('0x26')];_0x31ec61[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x1beaa7[_0x65f6('0x21')]['sort']);_0x31ec61[_0x65f6('0x1e')]=qs['filters'](_['pick'](_0x1beaa7[_0x65f6('0x21')],_0x22be6e[_0x65f6('0x3b')]));if(_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x31ec61['where']=_[_0x65f6('0x2c')](_0x31ec61['where'],{'$or':_['map'](_0x31ec61[_0x65f6('0x29')],function(_0x99fe6e){var _0x1a7e52={};_0x1a7e52[_0x99fe6e]={'$like':'%'+_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0x1a7e52;})});}_0x31ec61=_[_0x65f6('0x2c')]({},_0x31ec61,_0x1beaa7['options']);return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})['then'](function(_0x1ef2a0){if(_0x1ef2a0){_0x430fb8=_0x1ef2a0[_0x65f6('0x4c')];if(!_0x1beaa7[_0x65f6('0x21')]['hasOwnProperty'](_0x65f6('0x4e'))){_0x31ec61['limit']=qs['limit'](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0xe')]);_0x31ec61[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x1beaa7[_0x65f6('0x21')]['offset']);}return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})[_0x65f6('0x13')](function(_0x3bebe3){if(_0x3bebe3){return _0x3bebe3?{'count':_0x430fb8,'rows':_0x3bebe3}:null;}})[_0x65f6('0x13')](respondWithResult(_0x87a9e4,null))['catch'](handleError(_0x87a9e4,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index b80940e..dfd288b 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 _0x1c94=['SmsQueue','setMaxListeners','save','update','emit','hook','events','../../mysqldb'];(function(_0x10164f,_0x17057b){var _0x3ed881=function(_0x4b0724){while(--_0x4b0724){_0x10164f['push'](_0x10164f['shift']());}};_0x3ed881(++_0x17057b);}(_0x1c94,0x186));var _0x41c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c94[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x41c9('0x0'));var SmsQueue=require(_0x41c9('0x1'))['db'][_0x41c9('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x41c9('0x3')](0x0);var events={'afterCreate':_0x41c9('0x4'),'afterUpdate':_0x41c9('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4c4f9c){return function(_0x184e1e,_0x3c2725,_0x59034f){SmsQueueEvents[_0x41c9('0x6')](_0x4c4f9c+':'+_0x184e1e['id'],_0x184e1e);SmsQueueEvents[_0x41c9('0x6')](_0x4c4f9c,_0x184e1e);_0x59034f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x41c9('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xb5cf=['SmsQueue','setMaxListeners','update','emit','hook','events','../../mysqldb'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xb5cf,0x194));var _0xfb5c=function(_0xd1f83b,_0xc10512){_0xd1f83b=_0xd1f83b-0x0;var _0x548b09=_0xb5cf[_0xd1f83b];return _0x548b09;};'use strict';var EventEmitter=require(_0xfb5c('0x0'));var SmsQueue=require(_0xfb5c('0x1'))['db'][_0xfb5c('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xfb5c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfb5c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x14a5fe){return function(_0x570805,_0x2b7a0b,_0x18562b){SmsQueueEvents[_0xfb5c('0x5')](_0x14a5fe+':'+_0x570805['id'],_0x570805);SmsQueueEvents['emit'](_0x14a5fe,_0x570805);_0x18562b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xfb5c('0x6')](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 1553a9b..f794c18 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 _0x2450=['sms_queues','util','../../config/logger','api','moment','rimraf','../../config/environment','./smsQueue.attributes','exports','define'];(function(_0x261153,_0x174df0){var _0x5402f9=function(_0x5c7269){while(--_0x5c7269){_0x261153['push'](_0x261153['shift']());}};_0x5402f9(++_0x174df0);}(_0x2450,0xf1));var _0x0245=function(_0x3ffe50,_0x201df4){_0x3ffe50=_0x3ffe50-0x0;var _0x353829=_0x2450[_0x3ffe50];return _0x353829;};'use strict';var _=require('lodash');var util=require(_0x0245('0x0'));var logger=require(_0x0245('0x1'))(_0x0245('0x2'));var moment=require(_0x0245('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0245('0x4'));var config=require(_0x0245('0x5'));var attributes=require(_0x0245('0x6'));module[_0x0245('0x7')]=function(_0x4ef837,_0x112125){return _0x4ef837[_0x0245('0x8')]('SmsQueue',attributes,{'tableName':_0x0245('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1a8=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue'];(function(_0x5a563f,_0xf738a9){var _0x1bda27=function(_0x3fbd53){while(--_0x3fbd53){_0x5a563f['push'](_0x5a563f['shift']());}};_0x1bda27(++_0xf738a9);}(_0xe1a8,0x104));var _0x8e1a=function(_0x10b09b,_0x221f46){_0x10b09b=_0x10b09b-0x0;var _0x5774c0=_0xe1a8[_0x10b09b];return _0x5774c0;};'use strict';var _=require(_0x8e1a('0x0'));var util=require(_0x8e1a('0x1'));var logger=require(_0x8e1a('0x2'))(_0x8e1a('0x3'));var moment=require('moment');var BPromise=require(_0x8e1a('0x4'));var rp=require(_0x8e1a('0x5'));var fs=require('fs');var path=require(_0x8e1a('0x6'));var rimraf=require(_0x8e1a('0x7'));var config=require(_0x8e1a('0x8'));var attributes=require(_0x8e1a('0x9'));module[_0x8e1a('0xa')]=function(_0x53ac9e,_0x28a89b){return _0x53ac9e[_0x8e1a('0xb')](_0x8e1a('0xc'),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 a14d7e0..bfd979d 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 _0x27bc=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','request','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsQueue,\x20%s,\x20%s','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowSmsQueue','find','then','util','moment'];(function(_0x15b11f,_0x2f0a0f){var _0x53f0ba=function(_0xfeca6){while(--_0xfeca6){_0x15b11f['push'](_0x15b11f['shift']());}};_0x53f0ba(++_0x2f0a0f);}(_0x27bc,0x100));var _0xc27b=function(_0x3f4320,_0x526b8a){_0x3f4320=_0x3f4320-0x0;var _0xcc6aaa=_0x27bc[_0x3f4320];return _0xcc6aaa;};'use strict';var _=require('lodash');var util=require(_0xc27b('0x0'));var moment=require(_0xc27b('0x1'));var BPromise=require(_0xc27b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc27b('0x3'));var db=require(_0xc27b('0x4'))['db'];var utils=require(_0xc27b('0x5'));var logger=require(_0xc27b('0x6'))(_0xc27b('0x7'));var config=require(_0xc27b('0x8'));var jayson=require(_0xc27b('0x9'));var client=jayson[_0xc27b('0xa')]['http']({'port':0x232a});config['redis']=_[_0xc27b('0xb')](config[_0xc27b('0xc')],{'host':_0xc27b('0xd'),'port':0x18eb});var socket=require(_0xc27b('0xe'))(new Redis(config['redis']));require(_0xc27b('0xf'))[_0xc27b('0x10')](socket);function respondWithRpcPromise(_0x19698e,_0x318ab8,_0x53d208){return new BPromise(function(_0x41e829,_0x5f3b19){return client[_0xc27b('0x11')](_0x19698e,_0x53d208)['then'](function(_0x4ef4d4){logger[_0xc27b('0x12')]('SmsQueue,\x20%s,\x20%s',_0x318ab8,_0xc27b('0x13'));logger[_0xc27b('0x14')](_0xc27b('0x15'),_0x318ab8,_0xc27b('0x13'),JSON[_0xc27b('0x16')](_0x4ef4d4));if(_0x4ef4d4[_0xc27b('0x17')]){if(_0x4ef4d4[_0xc27b('0x17')][_0xc27b('0x18')]===0x1f4){logger[_0xc27b('0x17')]('SmsQueue,\x20%s,\x20%s',_0x318ab8,_0x4ef4d4[_0xc27b('0x17')]['message']);return _0x5f3b19(_0x4ef4d4['error'][_0xc27b('0x19')]);}logger[_0xc27b('0x17')](_0xc27b('0x1a'),_0x318ab8,_0x4ef4d4[_0xc27b('0x17')]['message']);return _0x41e829(_0x4ef4d4[_0xc27b('0x17')][_0xc27b('0x19')]);}else{logger['info'](_0xc27b('0x1a'),_0x318ab8,_0xc27b('0x13'));_0x41e829(_0x4ef4d4[_0xc27b('0x1b')][_0xc27b('0x19')]);}})[_0xc27b('0x1c')](function(_0xcb4d88){logger[_0xc27b('0x17')](_0xc27b('0x1a'),_0x318ab8,_0xcb4d88);_0x5f3b19(_0xcb4d88);});});}exports[_0xc27b('0x1d')]=function(_0x279a87){var _0x41d2df=this;return new Promise(function(_0x4904b9,_0x2188f9){return db[_0xc27b('0x1e')][_0xc27b('0x1f')]({'raw':_0x279a87['options']?_0x279a87[_0xc27b('0x20')][_0xc27b('0x21')]===undefined?!![]:![]:!![],'where':_0x279a87[_0xc27b('0x20')]?_0x279a87[_0xc27b('0x20')][_0xc27b('0x22')]||null:null,'attributes':_0x279a87[_0xc27b('0x20')]?_0x279a87[_0xc27b('0x20')][_0xc27b('0x23')]||null:null,'limit':_0x279a87[_0xc27b('0x20')]?_0x279a87[_0xc27b('0x20')][_0xc27b('0x24')]||null:null,'include':_0x279a87[_0xc27b('0x20')]?_0x279a87['options'][_0xc27b('0x25')]?_[_0xc27b('0x26')](_0x279a87[_0xc27b('0x20')][_0xc27b('0x25')],function(_0x525b72){return{'model':db[_0x525b72[_0xc27b('0x27')]],'as':_0x525b72['as'],'attributes':_0x525b72['attributes'],'include':_0x525b72['include']?_[_0xc27b('0x26')](_0x525b72[_0xc27b('0x25')],function(_0x12aaea){return{'model':db[_0x12aaea[_0xc27b('0x27')]],'as':_0x12aaea['as'],'attributes':_0x12aaea[_0xc27b('0x23')],'include':_0x12aaea['include']?_[_0xc27b('0x26')](_0x12aaea[_0xc27b('0x25')],function(_0x14085c){return{'model':db[_0x14085c[_0xc27b('0x27')]],'as':_0x14085c['as'],'attributes':_0x14085c[_0xc27b('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22e2b6){logger[_0xc27b('0x12')](_0xc27b('0x1d'),_0x279a87);logger['debug'](_0xc27b('0x1d'),_0x279a87,JSON[_0xc27b('0x16')](_0x22e2b6));_0x4904b9(_0x22e2b6);})['catch'](function(_0x41b465){logger[_0xc27b('0x17')](_0xc27b('0x1d'),_0x41b465['message'],_0x279a87);_0x2188f9(_0x41d2df[_0xc27b('0x17')](0x1f4,_0x41b465[_0xc27b('0x19')]));});});};exports[_0xc27b('0x28')]=function(_0x2ba3e6){var _0x3d07c8=this;return new Promise(function(_0x43bfd4,_0x514390){return db[_0xc27b('0x1e')][_0xc27b('0x29')]({'raw':_0x2ba3e6[_0xc27b('0x20')]?_0x2ba3e6[_0xc27b('0x20')][_0xc27b('0x21')]===undefined?!![]:![]:!![],'where':_0x2ba3e6['options']?_0x2ba3e6[_0xc27b('0x20')][_0xc27b('0x22')]||null:null,'attributes':_0x2ba3e6['options']?_0x2ba3e6['options'][_0xc27b('0x23')]||null:null,'include':_0x2ba3e6['options']?_0x2ba3e6[_0xc27b('0x20')]['include']?_[_0xc27b('0x26')](_0x2ba3e6[_0xc27b('0x20')][_0xc27b('0x25')],function(_0x20cbb2){return{'model':db[_0x20cbb2['model']],'as':_0x20cbb2['as'],'attributes':_0x20cbb2['attributes'],'include':_0x20cbb2['include']?_[_0xc27b('0x26')](_0x20cbb2['include'],function(_0xcf4c24){return{'model':db[_0xcf4c24[_0xc27b('0x27')]],'as':_0xcf4c24['as'],'attributes':_0xcf4c24[_0xc27b('0x23')],'include':_0xcf4c24[_0xc27b('0x25')]?_[_0xc27b('0x26')](_0xcf4c24[_0xc27b('0x25')],function(_0x3d5a23){return{'model':db[_0x3d5a23[_0xc27b('0x27')]],'as':_0x3d5a23['as'],'attributes':_0x3d5a23['attributes']};}):[]};}):[]};}):[]:[]})[_0xc27b('0x2a')](function(_0x585e86){logger[_0xc27b('0x12')](_0xc27b('0x28'),_0x2ba3e6);logger['debug']('ShowSmsQueue',_0x2ba3e6,JSON[_0xc27b('0x16')](_0x585e86));_0x43bfd4(_0x585e86);})[_0xc27b('0x1c')](function(_0x567faf){logger[_0xc27b('0x17')]('ShowSmsQueue',_0x567faf['message'],_0x2ba3e6);_0x514390(_0x3d07c8[_0xc27b('0x17')](0x1f4,_0x567faf[_0xc27b('0x19')]));});});}; \ No newline at end of file +var _0x6509=['rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','raw','options','limit','map','include','attributes','model','debug','ShowSmsQueue','find','where','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x29d320,_0x3ce348){var _0x1288eb=function(_0x38d638){while(--_0x38d638){_0x29d320['push'](_0x29d320['shift']());}};_0x1288eb(++_0x3ce348);}(_0x6509,0x7a));var _0x9650=function(_0xed4881,_0x45771c){_0xed4881=_0xed4881-0x0;var _0x7fcbd5=_0x6509[_0xed4881];return _0x7fcbd5;};'use strict';var _=require(_0x9650('0x0'));var util=require(_0x9650('0x1'));var moment=require(_0x9650('0x2'));var BPromise=require(_0x9650('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9650('0x4'))['db'];var utils=require(_0x9650('0x5'));var logger=require(_0x9650('0x6'))(_0x9650('0x7'));var config=require(_0x9650('0x8'));var jayson=require(_0x9650('0x9'));var client=jayson[_0x9650('0xa')]['http']({'port':0x232a});config[_0x9650('0xb')]=_[_0x9650('0xc')](config['redis'],{'host':_0x9650('0xd'),'port':0x18eb});var socket=require(_0x9650('0xe'))(new Redis(config['redis']));require(_0x9650('0xf'))[_0x9650('0x10')](socket);function respondWithRpcPromise(_0x5baa84,_0xcd343,_0x24cfc5){return new BPromise(function(_0x4bb7d8,_0xbb5020){return client[_0x9650('0x11')](_0x5baa84,_0x24cfc5)[_0x9650('0x12')](function(_0x200eba){logger[_0x9650('0x13')](_0x9650('0x14'),_0xcd343,_0x9650('0x15'));logger['debug'](_0x9650('0x16'),_0xcd343,'request\x20sent',JSON[_0x9650('0x17')](_0x200eba));if(_0x200eba['error']){if(_0x200eba[_0x9650('0x18')][_0x9650('0x19')]===0x1f4){logger[_0x9650('0x18')]('SmsQueue,\x20%s,\x20%s',_0xcd343,_0x200eba[_0x9650('0x18')][_0x9650('0x1a')]);return _0xbb5020(_0x200eba[_0x9650('0x18')][_0x9650('0x1a')]);}logger[_0x9650('0x18')](_0x9650('0x14'),_0xcd343,_0x200eba['error']['message']);return _0x4bb7d8(_0x200eba[_0x9650('0x18')][_0x9650('0x1a')]);}else{logger[_0x9650('0x13')](_0x9650('0x14'),_0xcd343,'request\x20sent');_0x4bb7d8(_0x200eba[_0x9650('0x1b')][_0x9650('0x1a')]);}})[_0x9650('0x1c')](function(_0x2dfd83){logger[_0x9650('0x18')](_0x9650('0x14'),_0xcd343,_0x2dfd83);_0xbb5020(_0x2dfd83);});});}exports[_0x9650('0x1d')]=function(_0x6f0564){var _0x3bf0bd=this;return new Promise(function(_0x1eb36f,_0x41fc0e){return db[_0x9650('0x1e')][_0x9650('0x1f')]({'raw':_0x6f0564['options']?_0x6f0564['options'][_0x9650('0x20')]===undefined?!![]:![]:!![],'where':_0x6f0564[_0x9650('0x21')]?_0x6f0564[_0x9650('0x21')]['where']||null:null,'attributes':_0x6f0564[_0x9650('0x21')]?_0x6f0564[_0x9650('0x21')]['attributes']||null:null,'limit':_0x6f0564[_0x9650('0x21')]?_0x6f0564[_0x9650('0x21')][_0x9650('0x22')]||null:null,'include':_0x6f0564[_0x9650('0x21')]?_0x6f0564[_0x9650('0x21')]['include']?_[_0x9650('0x23')](_0x6f0564[_0x9650('0x21')][_0x9650('0x24')],function(_0x60394d){return{'model':db[_0x60394d['model']],'as':_0x60394d['as'],'attributes':_0x60394d[_0x9650('0x25')],'include':_0x60394d['include']?_['map'](_0x60394d[_0x9650('0x24')],function(_0x1aa11c){return{'model':db[_0x1aa11c['model']],'as':_0x1aa11c['as'],'attributes':_0x1aa11c['attributes'],'include':_0x1aa11c['include']?_[_0x9650('0x23')](_0x1aa11c['include'],function(_0x31c36c){return{'model':db[_0x31c36c[_0x9650('0x26')]],'as':_0x31c36c['as'],'attributes':_0x31c36c['attributes']};}):[]};}):[]};}):[]:[]})[_0x9650('0x12')](function(_0x2e5844){logger['info'](_0x9650('0x1d'),_0x6f0564);logger[_0x9650('0x27')](_0x9650('0x1d'),_0x6f0564,JSON[_0x9650('0x17')](_0x2e5844));_0x1eb36f(_0x2e5844);})[_0x9650('0x1c')](function(_0x11a435){logger[_0x9650('0x18')](_0x9650('0x1d'),_0x11a435['message'],_0x6f0564);_0x41fc0e(_0x3bf0bd[_0x9650('0x18')](0x1f4,_0x11a435['message']));});});};exports[_0x9650('0x28')]=function(_0x3827d0){var _0xd41365=this;return new Promise(function(_0x1d24b9,_0x976395){return db[_0x9650('0x1e')][_0x9650('0x29')]({'raw':_0x3827d0['options']?_0x3827d0[_0x9650('0x21')][_0x9650('0x20')]===undefined?!![]:![]:!![],'where':_0x3827d0[_0x9650('0x21')]?_0x3827d0[_0x9650('0x21')][_0x9650('0x2a')]||null:null,'attributes':_0x3827d0['options']?_0x3827d0[_0x9650('0x21')][_0x9650('0x25')]||null:null,'include':_0x3827d0[_0x9650('0x21')]?_0x3827d0['options'][_0x9650('0x24')]?_[_0x9650('0x23')](_0x3827d0[_0x9650('0x21')][_0x9650('0x24')],function(_0x2872e2){return{'model':db[_0x2872e2[_0x9650('0x26')]],'as':_0x2872e2['as'],'attributes':_0x2872e2[_0x9650('0x25')],'include':_0x2872e2[_0x9650('0x24')]?_[_0x9650('0x23')](_0x2872e2[_0x9650('0x24')],function(_0x502512){return{'model':db[_0x502512[_0x9650('0x26')]],'as':_0x502512['as'],'attributes':_0x502512[_0x9650('0x25')],'include':_0x502512['include']?_[_0x9650('0x23')](_0x502512[_0x9650('0x24')],function(_0x5d2037){return{'model':db[_0x5d2037[_0x9650('0x26')]],'as':_0x5d2037['as'],'attributes':_0x5d2037[_0x9650('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50f498){logger[_0x9650('0x13')](_0x9650('0x28'),_0x3827d0);logger[_0x9650('0x27')](_0x9650('0x28'),_0x3827d0,JSON['stringify'](_0x50f498));_0x1d24b9(_0x50f498);})[_0x9650('0x1c')](function(_0x2adde2){logger[_0x9650('0x18')]('ShowSmsQueue',_0x2adde2[_0x9650('0x1a')],_0x3827d0);_0x976395(_0xd41365[_0x9650('0x18')](0x1f4,_0x2adde2['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index a1232e1..562effb 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 _0xd4d3=['removeListener','length','smsQueue:','./smsQueue.events','save','emit'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xd4d3,0x93));var _0x3d4d=function(_0x5b15cb,_0x25346d){_0x5b15cb=_0x5b15cb-0x0;var _0x143b1b=_0xd4d3[_0x5b15cb];return _0x143b1b;};'use strict';var SmsQueueEvents=require(_0x3d4d('0x0'));var events=[_0x3d4d('0x1'),'remove','update'];function createListener(_0x5ed0a1,_0x2663da){return function(_0x10bea4){_0x2663da[_0x3d4d('0x2')](_0x5ed0a1,_0x10bea4);};}function removeListener(_0x188c41,_0x381bbc){return function(){SmsQueueEvents[_0x3d4d('0x3')](_0x188c41,_0x381bbc);};}exports['register']=function(_0x46dd5b){for(var _0x3174b7=0x0,_0x902f7f=events[_0x3d4d('0x4')];_0x3174b7<_0x902f7f;_0x3174b7++){var _0x4072d6=events[_0x3174b7];var _0x5bdc0e=createListener(_0x3d4d('0x5')+_0x4072d6,_0x46dd5b);SmsQueueEvents['on'](_0x4072d6,_0x5bdc0e);}}; \ No newline at end of file +var _0x2c11=['remove','update','removeListener','register','length','./smsQueue.events','save'];(function(_0x238329,_0x248dae){var _0xed1a10=function(_0xb77bef){while(--_0xb77bef){_0x238329['push'](_0x238329['shift']());}};_0xed1a10(++_0x248dae);}(_0x2c11,0x1da));var _0x12c1=function(_0x3d48b8,_0x286558){_0x3d48b8=_0x3d48b8-0x0;var _0x29be7e=_0x2c11[_0x3d48b8];return _0x29be7e;};'use strict';var SmsQueueEvents=require(_0x12c1('0x0'));var events=[_0x12c1('0x1'),_0x12c1('0x2'),_0x12c1('0x3')];function createListener(_0x39d32b,_0x3364a8){return function(_0x38fcb4){_0x3364a8['emit'](_0x39d32b,_0x38fcb4);};}function removeListener(_0xe4b450,_0x28147c){return function(){SmsQueueEvents[_0x12c1('0x4')](_0xe4b450,_0x28147c);};}exports[_0x12c1('0x5')]=function(_0x1fc16c){for(var _0x2b0df3=0x0,_0x8c2e33=events[_0x12c1('0x6')];_0x2b0df3<_0x8c2e33;_0x2b0df3++){var _0x2acf0e=events[_0x2b0df3];var _0x53f400=createListener('smsQueue:'+_0x2acf0e,_0x1fc16c);SmsQueueEvents['on'](_0x2acf0e,_0x53f400);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 313e397..c0c0f21 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 _0x1dde=['create','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/:id','post'];(function(_0x268188,_0x111704){var _0x3e43e3=function(_0x39564f){while(--_0x39564f){_0x268188['push'](_0x268188['shift']());}};_0x3e43e3(++_0x111704);}(_0x1dde,0x16d));var _0xe1dd=function(_0x4845a6,_0x1c3e90){_0x4845a6=_0x4845a6-0x0;var _0x9ba0fd=_0x1dde[_0x4845a6];return _0x9ba0fd;};'use strict';var multer=require(_0xe1dd('0x0'));var util=require(_0xe1dd('0x1'));var path=require(_0xe1dd('0x2'));var timeout=require(_0xe1dd('0x3'));var express=require(_0xe1dd('0x4'));var router=express[_0xe1dd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe1dd('0x6'));var interaction=require(_0xe1dd('0x7'));var config=require(_0xe1dd('0x8'));var controller=require(_0xe1dd('0x9'));router[_0xe1dd('0xa')]('/',auth[_0xe1dd('0xb')](),controller[_0xe1dd('0xc')]);router[_0xe1dd('0xa')]('/describe',auth[_0xe1dd('0xb')](),controller['describe']);router[_0xe1dd('0xa')](_0xe1dd('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe1dd('0xe')]('/',auth[_0xe1dd('0xb')](),controller[_0xe1dd('0xf')]);router[_0xe1dd('0x10')](_0xe1dd('0xd'),auth[_0xe1dd('0xb')](),controller[_0xe1dd('0x11')]);router['delete']('/:id',auth[_0xe1dd('0xb')](),controller['destroy']);module[_0xe1dd('0x12')]=router; \ No newline at end of file +var _0xbeba=['post','create','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x11407c,_0x1d4209){var _0x5326b0=function(_0x423be8){while(--_0x423be8){_0x11407c['push'](_0x11407c['shift']());}};_0x5326b0(++_0x1d4209);}(_0xbeba,0x64));var _0xabeb=function(_0x175b84,_0xe53ff4){_0x175b84=_0x175b84-0x0;var _0x183820=_0xbeba[_0x175b84];return _0x183820;};'use strict';var multer=require(_0xabeb('0x0'));var util=require(_0xabeb('0x1'));var path=require('path');var timeout=require(_0xabeb('0x2'));var express=require(_0xabeb('0x3'));var router=express[_0xabeb('0x4')]();var fs_extra=require(_0xabeb('0x5'));var auth=require(_0xabeb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xabeb('0x7'));var controller=require(_0xabeb('0x8'));router[_0xabeb('0x9')]('/',auth[_0xabeb('0xa')](),controller[_0xabeb('0xb')]);router[_0xabeb('0x9')](_0xabeb('0xc'),auth[_0xabeb('0xa')](),controller['describe']);router['get'](_0xabeb('0xd'),auth[_0xabeb('0xa')](),controller['show']);router[_0xabeb('0xe')]('/',auth[_0xabeb('0xa')](),controller[_0xabeb('0xf')]);router['put'](_0xabeb('0xd'),auth[_0xabeb('0xa')](),controller['update']);router[_0xabeb('0x10')](_0xabeb('0xd'),auth[_0xabeb('0xa')](),controller[_0xabeb('0x11')]);module[_0xabeb('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 b389558..51aee23 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 _0x1f19=['sequelize','exports','DATE','STRING','moment'];(function(_0x5590f3,_0xfdea13){var _0x96e385=function(_0x534a8f){while(--_0x534a8f){_0x5590f3['push'](_0x5590f3['shift']());}};_0x96e385(++_0xfdea13);}(_0x1f19,0x162));var _0x91f1=function(_0x35e0e4,_0x3d63de){_0x35e0e4=_0x35e0e4-0x0;var _0xb9e81c=_0x1f19[_0x35e0e4];return _0xb9e81c;};'use strict';var moment=require(_0x91f1('0x0'));var Sequelize=require(_0x91f1('0x1'));module[_0x91f1('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x91f1('0x3')]},'leaveAt':{'type':Sequelize[_0x91f1('0x3')]},'acceptAt':{'type':Sequelize[_0x91f1('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x91f1('0x4')]}}; \ No newline at end of file +var _0x07b4=['DATE','STRING'];(function(_0x3ff524,_0x2c3e99){var _0x4ab46d=function(_0x3290c6){while(--_0x3290c6){_0x3ff524['push'](_0x3ff524['shift']());}};_0x4ab46d(++_0x2c3e99);}(_0x07b4,0x1c9));var _0x407b=function(_0x4f700a,_0xe7874b){_0x4f700a=_0x4f700a-0x0;var _0x546071=_0x07b4[_0x4f700a];return _0x546071;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x407b('0x0')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x407b('0x1')]},'leaveAt':{'type':Sequelize[_0x407b('0x1')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x407b('0x1')]},'reason':{'type':Sequelize[_0x407b('0x0')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index b19b541..f68dde0 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 _0xc1a2=['where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort'];(function(_0x549449,_0x245b21){var _0x49bcca=function(_0x76592e){while(--_0x76592e){_0x549449['push'](_0x549449['shift']());}};_0x49bcca(++_0x245b21);}(_0xc1a2,0x138));var _0x2c1a=function(_0x11abb2,_0x138ec7){_0x11abb2=_0x11abb2-0x0;var _0x2bb707=_0xc1a2[_0x11abb2];return _0x2bb707;};'use strict';var emlformat=require(_0x2c1a('0x0'));var rimraf=require(_0x2c1a('0x1'));var zipdir=require(_0x2c1a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2c1a('0x3'));var moment=require(_0x2c1a('0x4'));var BPromise=require(_0x2c1a('0x5'));var Mustache=require(_0x2c1a('0x6'));var util=require(_0x2c1a('0x7'));var path=require(_0x2c1a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c1a('0x9'));var _=require(_0x2c1a('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2c1a('0xb'));var toCsv=require(_0x2c1a('0xc'));var querystring=require('querystring');var Papa=require(_0x2c1a('0xd'));var Redis=require(_0x2c1a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2c1a('0xf'));var as=require(_0x2c1a('0x10'));var hardwareService=require(_0x2c1a('0x11'));var logger=require(_0x2c1a('0x12'))('api');var utils=require(_0x2c1a('0x13'));var config=require(_0x2c1a('0x14'));var licenseUtil=require(_0x2c1a('0x15'));var db=require(_0x2c1a('0x16'))['db'];function respondWithStatusCode(_0x56bab5,_0x3ed3d7){_0x3ed3d7=_0x3ed3d7||0xcc;return function(_0x3d4d39){if(_0x3d4d39){return _0x56bab5[_0x2c1a('0x17')](_0x3ed3d7);}return _0x56bab5[_0x2c1a('0x18')](_0x3ed3d7)[_0x2c1a('0x19')]();};}function respondWithResult(_0x212fc8,_0x5c82cd){_0x5c82cd=_0x5c82cd||0xc8;return function(_0x618173){if(_0x618173){return _0x212fc8[_0x2c1a('0x18')](_0x5c82cd)[_0x2c1a('0x1a')](_0x618173);}};}function respondWithFilteredResult(_0xa286be,_0x58722e){return function(_0x374820){if(_0x374820){var _0x534f2e=typeof _0x58722e['offset']===_0x2c1a('0x1b')&&typeof _0x58722e['limit']==='undefined';var _0x543945=_0x374820[_0x2c1a('0x1c')];var _0x5ec03b=_0x534f2e?0x0:_0x58722e[_0x2c1a('0x1d')];var _0x36099e=_0x534f2e?_0x374820[_0x2c1a('0x1c')]:_0x58722e['offset']+_0x58722e[_0x2c1a('0x1e')];var _0x358c38;if(_0x36099e>=_0x543945){_0x36099e=_0x543945;_0x358c38=0xc8;}else{_0x358c38=0xce;}_0xa286be[_0x2c1a('0x18')](_0x358c38);return _0xa286be[_0x2c1a('0x1f')](_0x2c1a('0x20'),_0x5ec03b+'-'+_0x36099e+'/'+_0x543945)[_0x2c1a('0x1a')](_0x374820);}return null;};}function patchUpdates(_0x425873){return function(_0x249b70){try{jsonpatch['apply'](_0x249b70,_0x425873,!![]);}catch(_0x4b86c6){return BPromise[_0x2c1a('0x21')](_0x4b86c6);}return _0x249b70[_0x2c1a('0x22')]();};}function saveUpdates(_0x59014c,_0x4ce92a){return function(_0x23c048){if(_0x23c048){return _0x23c048[_0x2c1a('0x23')](_0x59014c)[_0x2c1a('0x24')](function(_0x3f10b3){return _0x3f10b3;});}return null;};}function removeEntity(_0x414274,_0x10f488){return function(_0x3c3dc0){if(_0x3c3dc0){return _0x3c3dc0[_0x2c1a('0x25')]()[_0x2c1a('0x24')](function(){_0x414274[_0x2c1a('0x18')](0xcc)[_0x2c1a('0x19')]();});}};}function handleEntityNotFound(_0x40ade3,_0x438805){return function(_0x3fc45b){if(!_0x3fc45b){_0x40ade3[_0x2c1a('0x17')](0x194);}return _0x3fc45b;};}function handleError(_0xf5f35c,_0x4408f8){_0x4408f8=_0x4408f8||0x1f4;return function(_0x1cf1b3){logger[_0x2c1a('0x26')](_0x1cf1b3['stack']);if(_0x1cf1b3[_0x2c1a('0x27')]){delete _0x1cf1b3['name'];}_0xf5f35c[_0x2c1a('0x18')](_0x4408f8)[_0x2c1a('0x28')](_0x1cf1b3);};}exports[_0x2c1a('0x29')]=function(_0x2af248,_0xbcffd7){var _0x46bed1={},_0x495c0d={},_0x3bc051={'count':0x0,'rows':[]};var _0x16dbbd=_[_0x2c1a('0x2a')](db[_0x2c1a('0x2b')][_0x2c1a('0x2c')],function(_0x33bbd9){return{'name':_0x33bbd9[_0x2c1a('0x2d')],'type':_0x33bbd9[_0x2c1a('0x2e')][_0x2c1a('0x2f')]};});_0x495c0d[_0x2c1a('0x30')]=_[_0x2c1a('0x2a')](_0x16dbbd,_0x2c1a('0x27'));_0x495c0d[_0x2c1a('0x31')]=_[_0x2c1a('0x32')](_0x2af248['query']);_0x495c0d[_0x2c1a('0x33')]=_[_0x2c1a('0x34')](_0x495c0d['model'],_0x495c0d['query']);_0x46bed1[_0x2c1a('0x35')]=_[_0x2c1a('0x34')](_0x495c0d['model'],qs[_0x2c1a('0x36')](_0x2af248[_0x2c1a('0x31')][_0x2c1a('0x36')]));_0x46bed1[_0x2c1a('0x35')]=_0x46bed1[_0x2c1a('0x35')][_0x2c1a('0x37')]?_0x46bed1[_0x2c1a('0x35')]:_0x495c0d['model'];if(!_0x2af248[_0x2c1a('0x31')]['hasOwnProperty']('nolimit')){_0x46bed1['limit']=qs[_0x2c1a('0x1e')](_0x2af248[_0x2c1a('0x31')][_0x2c1a('0x1e')]);_0x46bed1[_0x2c1a('0x1d')]=qs[_0x2c1a('0x1d')](_0x2af248['query'][_0x2c1a('0x1d')]);}_0x46bed1[_0x2c1a('0x38')]=qs[_0x2c1a('0x39')](_0x2af248[_0x2c1a('0x31')]['sort']);_0x46bed1[_0x2c1a('0x3a')]=qs[_0x2c1a('0x33')](_[_0x2c1a('0x3b')](_0x2af248['query'],_0x495c0d[_0x2c1a('0x33')]),_0x16dbbd);if(_0x2af248['query'][_0x2c1a('0x3c')]){_0x46bed1['where']=_[_0x2c1a('0x3d')](_0x46bed1[_0x2c1a('0x3a')],{'$or':_[_0x2c1a('0x2a')](_0x16dbbd,function(_0x208a7a){if(_0x208a7a[_0x2c1a('0x2e')]!==_0x2c1a('0x3e')){var _0x75b9ee={};_0x75b9ee[_0x208a7a['name']]={'$like':'%'+_0x2af248[_0x2c1a('0x31')]['filter']+'%'};return _0x75b9ee;}})});}_0x46bed1=_[_0x2c1a('0x3d')]({},_0x46bed1,_0x2af248['options']);var _0xf44b08={'where':_0x46bed1['where']};return db[_0x2c1a('0x2b')][_0x2c1a('0x1c')](_0xf44b08)['then'](function(_0x143e5d){_0x3bc051[_0x2c1a('0x1c')]=_0x143e5d;if(_0x2af248[_0x2c1a('0x31')][_0x2c1a('0x3f')]){_0x46bed1[_0x2c1a('0x40')]=[{'all':!![]}];}return db[_0x2c1a('0x2b')][_0x2c1a('0x41')](_0x46bed1);})['then'](function(_0x154751){_0x3bc051[_0x2c1a('0x42')]=_0x154751;return _0x3bc051;})[_0x2c1a('0x24')](respondWithFilteredResult(_0xbcffd7,_0x46bed1))[_0x2c1a('0x43')](handleError(_0xbcffd7,null));};exports[_0x2c1a('0x44')]=function(_0xf886f2,_0x4b41f3){var _0x49fc4b={'raw':!![],'where':{'id':_0xf886f2[_0x2c1a('0x45')]['id']}},_0x1f83d5={};_0x1f83d5[_0x2c1a('0x30')]=_[_0x2c1a('0x32')](db['SmsQueueReport'][_0x2c1a('0x2c')]);_0x1f83d5[_0x2c1a('0x31')]=_[_0x2c1a('0x32')](_0xf886f2[_0x2c1a('0x31')]);_0x1f83d5[_0x2c1a('0x33')]=_['intersection'](_0x1f83d5[_0x2c1a('0x30')],_0x1f83d5['query']);_0x49fc4b[_0x2c1a('0x35')]=_[_0x2c1a('0x34')](_0x1f83d5[_0x2c1a('0x30')],qs[_0x2c1a('0x36')](_0xf886f2[_0x2c1a('0x31')][_0x2c1a('0x36')]));_0x49fc4b[_0x2c1a('0x35')]=_0x49fc4b[_0x2c1a('0x35')][_0x2c1a('0x37')]?_0x49fc4b[_0x2c1a('0x35')]:_0x1f83d5[_0x2c1a('0x30')];if(_0xf886f2['query']['includeAll']){_0x49fc4b[_0x2c1a('0x40')]=[{'all':!![]}];}_0x49fc4b=_[_0x2c1a('0x3d')]({},_0x49fc4b,_0xf886f2[_0x2c1a('0x46')]);return db[_0x2c1a('0x2b')][_0x2c1a('0x47')](_0x49fc4b)['then'](handleEntityNotFound(_0x4b41f3,null))['then'](respondWithResult(_0x4b41f3,null))['catch'](handleError(_0x4b41f3,null));};exports['create']=function(_0x5ac877,_0x40b5c1){return db[_0x2c1a('0x2b')]['create'](_0x5ac877['body'],{})['then'](respondWithResult(_0x40b5c1,0xc9))['catch'](handleError(_0x40b5c1,null));};exports['update']=function(_0xdb661c,_0x3416b4){if(_0xdb661c[_0x2c1a('0x48')]['id']){delete _0xdb661c[_0x2c1a('0x48')]['id'];}return db[_0x2c1a('0x2b')][_0x2c1a('0x47')]({'where':{'id':_0xdb661c[_0x2c1a('0x45')]['id']}})[_0x2c1a('0x24')](handleEntityNotFound(_0x3416b4,null))[_0x2c1a('0x24')](saveUpdates(_0xdb661c[_0x2c1a('0x48')],null))[_0x2c1a('0x24')](respondWithResult(_0x3416b4,null))[_0x2c1a('0x43')](handleError(_0x3416b4,null));};exports[_0x2c1a('0x25')]=function(_0x2b46eb,_0x2fbc10){return db[_0x2c1a('0x2b')][_0x2c1a('0x47')]({'where':{'id':_0x2b46eb[_0x2c1a('0x45')]['id']}})['then'](handleEntityNotFound(_0x2fbc10,null))['then'](removeEntity(_0x2fbc10,null))[_0x2c1a('0x43')](handleError(_0x2fbc10,null));};exports[_0x2c1a('0x49')]=function(_0x82e224,_0x5aa1ec){return db[_0x2c1a('0x2b')][_0x2c1a('0x49')]()['then'](respondWithResult(_0x5aa1ec,null))['catch'](handleError(_0x5aa1ec,null));}; \ No newline at end of file +var _0x3307=['api','../../config/utils','../../config/environment','../../config/license/util','status','offset','undefined','limit','set','Content-Range','json','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x558f9f,_0x2036ca){var _0x4fa18b=function(_0x1b8c4a){while(--_0x1b8c4a){_0x558f9f['push'](_0x558f9f['shift']());}};_0x4fa18b(++_0x2036ca);}(_0x3307,0x172));var _0x7330=function(_0x3044ef,_0x2dbc29){_0x3044ef=_0x3044ef-0x0;var _0x5db5e0=_0x3307[_0x3044ef];return _0x5db5e0;};'use strict';var emlformat=require(_0x7330('0x0'));var rimraf=require(_0x7330('0x1'));var zipdir=require(_0x7330('0x2'));var jsonpatch=require(_0x7330('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7330('0x4'));var Mustache=require(_0x7330('0x5'));var util=require(_0x7330('0x6'));var path=require(_0x7330('0x7'));var sox=require(_0x7330('0x8'));var csv=require(_0x7330('0x9'));var ejs=require(_0x7330('0xa'));var fs=require('fs');var fs_extra=require(_0x7330('0xb'));var _=require(_0x7330('0xc'));var squel=require(_0x7330('0xd'));var crypto=require(_0x7330('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7330('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7330('0x10'));var Redis=require(_0x7330('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7330('0x12'));var as=require(_0x7330('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7330('0x14'));var utils=require(_0x7330('0x15'));var config=require(_0x7330('0x16'));var licenseUtil=require(_0x7330('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1294a2,_0xa7ab79){_0xa7ab79=_0xa7ab79||0xcc;return function(_0x12e639){if(_0x12e639){return _0x1294a2['sendStatus'](_0xa7ab79);}return _0x1294a2[_0x7330('0x18')](_0xa7ab79)['end']();};}function respondWithResult(_0x5a0c56,_0x4247ca){_0x4247ca=_0x4247ca||0xc8;return function(_0x2872c4){if(_0x2872c4){return _0x5a0c56['status'](_0x4247ca)['json'](_0x2872c4);}};}function respondWithFilteredResult(_0x42c860,_0x37d626){return function(_0x1ddf93){if(_0x1ddf93){var _0x2f6736=typeof _0x37d626[_0x7330('0x19')]===_0x7330('0x1a')&&typeof _0x37d626[_0x7330('0x1b')]===_0x7330('0x1a');var _0x10899d=_0x1ddf93['count'];var _0x9fc78a=_0x2f6736?0x0:_0x37d626[_0x7330('0x19')];var _0x3cbb8e=_0x2f6736?_0x1ddf93['count']:_0x37d626[_0x7330('0x19')]+_0x37d626[_0x7330('0x1b')];var _0x1b6be6;if(_0x3cbb8e>=_0x10899d){_0x3cbb8e=_0x10899d;_0x1b6be6=0xc8;}else{_0x1b6be6=0xce;}_0x42c860[_0x7330('0x18')](_0x1b6be6);return _0x42c860[_0x7330('0x1c')](_0x7330('0x1d'),_0x9fc78a+'-'+_0x3cbb8e+'/'+_0x10899d)[_0x7330('0x1e')](_0x1ddf93);}return null;};}function patchUpdates(_0x1c141d){return function(_0x2301b0){try{jsonpatch['apply'](_0x2301b0,_0x1c141d,!![]);}catch(_0x2df487){return BPromise[_0x7330('0x1f')](_0x2df487);}return _0x2301b0[_0x7330('0x20')]();};}function saveUpdates(_0x27d6c7,_0x17cfe4){return function(_0x4fd068){if(_0x4fd068){return _0x4fd068[_0x7330('0x21')](_0x27d6c7)[_0x7330('0x22')](function(_0x37130d){return _0x37130d;});}return null;};}function removeEntity(_0x56a26f,_0x4060c4){return function(_0x51c827){if(_0x51c827){return _0x51c827[_0x7330('0x23')]()[_0x7330('0x22')](function(){_0x56a26f[_0x7330('0x18')](0xcc)[_0x7330('0x24')]();});}};}function handleEntityNotFound(_0x16310b,_0x2fd588){return function(_0x5baba8){if(!_0x5baba8){_0x16310b[_0x7330('0x25')](0x194);}return _0x5baba8;};}function handleError(_0x87ded7,_0x45fc8e){_0x45fc8e=_0x45fc8e||0x1f4;return function(_0x3c70c4){logger[_0x7330('0x26')](_0x3c70c4[_0x7330('0x27')]);if(_0x3c70c4[_0x7330('0x28')]){delete _0x3c70c4['name'];}_0x87ded7[_0x7330('0x18')](_0x45fc8e)[_0x7330('0x29')](_0x3c70c4);};}exports[_0x7330('0x2a')]=function(_0x1f6383,_0x26ebb1){var _0x381eb4={},_0x38d2d0={},_0x318811={'count':0x0,'rows':[]};var _0x47642c=_[_0x7330('0x2b')](db[_0x7330('0x2c')][_0x7330('0x2d')],function(_0x7df792){return{'name':_0x7df792[_0x7330('0x2e')],'type':_0x7df792['type'][_0x7330('0x2f')]};});_0x38d2d0[_0x7330('0x30')]=_['map'](_0x47642c,_0x7330('0x28'));_0x38d2d0[_0x7330('0x31')]=_[_0x7330('0x32')](_0x1f6383['query']);_0x38d2d0[_0x7330('0x33')]=_[_0x7330('0x34')](_0x38d2d0['model'],_0x38d2d0['query']);_0x381eb4['attributes']=_[_0x7330('0x34')](_0x38d2d0[_0x7330('0x30')],qs[_0x7330('0x35')](_0x1f6383['query'][_0x7330('0x35')]));_0x381eb4[_0x7330('0x36')]=_0x381eb4['attributes'][_0x7330('0x37')]?_0x381eb4[_0x7330('0x36')]:_0x38d2d0[_0x7330('0x30')];if(!_0x1f6383[_0x7330('0x31')][_0x7330('0x38')](_0x7330('0x39'))){_0x381eb4[_0x7330('0x1b')]=qs[_0x7330('0x1b')](_0x1f6383[_0x7330('0x31')]['limit']);_0x381eb4[_0x7330('0x19')]=qs[_0x7330('0x19')](_0x1f6383['query'][_0x7330('0x19')]);}_0x381eb4[_0x7330('0x3a')]=qs[_0x7330('0x3b')](_0x1f6383['query'][_0x7330('0x3b')]);_0x381eb4['where']=qs[_0x7330('0x33')](_[_0x7330('0x3c')](_0x1f6383['query'],_0x38d2d0[_0x7330('0x33')]),_0x47642c);if(_0x1f6383[_0x7330('0x31')][_0x7330('0x3d')]){_0x381eb4['where']=_['merge'](_0x381eb4[_0x7330('0x3e')],{'$or':_[_0x7330('0x2b')](_0x47642c,function(_0x1dd76c){if(_0x1dd76c['type']!==_0x7330('0x3f')){var _0x508b53={};_0x508b53[_0x1dd76c[_0x7330('0x28')]]={'$like':'%'+_0x1f6383['query'][_0x7330('0x3d')]+'%'};return _0x508b53;}})});}_0x381eb4=_[_0x7330('0x40')]({},_0x381eb4,_0x1f6383['options']);var _0x201ca4={'where':_0x381eb4[_0x7330('0x3e')]};return db[_0x7330('0x2c')][_0x7330('0x41')](_0x201ca4)['then'](function(_0x101ae5){_0x318811[_0x7330('0x41')]=_0x101ae5;if(_0x1f6383[_0x7330('0x31')][_0x7330('0x42')]){_0x381eb4[_0x7330('0x43')]=[{'all':!![]}];}return db[_0x7330('0x2c')][_0x7330('0x44')](_0x381eb4);})[_0x7330('0x22')](function(_0x496ebf){_0x318811[_0x7330('0x45')]=_0x496ebf;return _0x318811;})[_0x7330('0x22')](respondWithFilteredResult(_0x26ebb1,_0x381eb4))[_0x7330('0x46')](handleError(_0x26ebb1,null));};exports[_0x7330('0x47')]=function(_0x176b9d,_0x5707bd){var _0x27e4a2={'raw':!![],'where':{'id':_0x176b9d[_0x7330('0x48')]['id']}},_0x37e2c4={};_0x37e2c4[_0x7330('0x30')]=_[_0x7330('0x32')](db[_0x7330('0x2c')]['rawAttributes']);_0x37e2c4[_0x7330('0x31')]=_[_0x7330('0x32')](_0x176b9d[_0x7330('0x31')]);_0x37e2c4['filters']=_[_0x7330('0x34')](_0x37e2c4[_0x7330('0x30')],_0x37e2c4[_0x7330('0x31')]);_0x27e4a2[_0x7330('0x36')]=_['intersection'](_0x37e2c4['model'],qs[_0x7330('0x35')](_0x176b9d['query'][_0x7330('0x35')]));_0x27e4a2[_0x7330('0x36')]=_0x27e4a2[_0x7330('0x36')]['length']?_0x27e4a2[_0x7330('0x36')]:_0x37e2c4[_0x7330('0x30')];if(_0x176b9d[_0x7330('0x31')][_0x7330('0x42')]){_0x27e4a2[_0x7330('0x43')]=[{'all':!![]}];}_0x27e4a2=_[_0x7330('0x40')]({},_0x27e4a2,_0x176b9d[_0x7330('0x49')]);return db['SmsQueueReport'][_0x7330('0x4a')](_0x27e4a2)[_0x7330('0x22')](handleEntityNotFound(_0x5707bd,null))[_0x7330('0x22')](respondWithResult(_0x5707bd,null))[_0x7330('0x46')](handleError(_0x5707bd,null));};exports[_0x7330('0x4b')]=function(_0x1e9a2c,_0x374cc0){return db[_0x7330('0x2c')][_0x7330('0x4b')](_0x1e9a2c['body'],{})[_0x7330('0x22')](respondWithResult(_0x374cc0,0xc9))[_0x7330('0x46')](handleError(_0x374cc0,null));};exports['update']=function(_0x76b96c,_0x27dcea){if(_0x76b96c[_0x7330('0x4c')]['id']){delete _0x76b96c[_0x7330('0x4c')]['id'];}return db[_0x7330('0x2c')][_0x7330('0x4a')]({'where':{'id':_0x76b96c[_0x7330('0x48')]['id']}})['then'](handleEntityNotFound(_0x27dcea,null))[_0x7330('0x22')](saveUpdates(_0x76b96c[_0x7330('0x4c')],null))['then'](respondWithResult(_0x27dcea,null))[_0x7330('0x46')](handleError(_0x27dcea,null));};exports['destroy']=function(_0x405f4f,_0x1b6701){return db['SmsQueueReport'][_0x7330('0x4a')]({'where':{'id':_0x405f4f[_0x7330('0x48')]['id']}})['then'](handleEntityNotFound(_0x1b6701,null))[_0x7330('0x22')](removeEntity(_0x1b6701,null))[_0x7330('0x46')](handleError(_0x1b6701,null));};exports[_0x7330('0x4d')]=function(_0x33561a,_0x5aa0b8){return db[_0x7330('0x2c')][_0x7330('0x4d')]()['then'](respondWithResult(_0x5aa0b8,null))[_0x7330('0x46')](handleError(_0x5aa0b8,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 1773599..7e3daa7 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index e065635..14cbadd 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 _0xd27e=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','CreateSmsQueueReport','SmsQueueReport','create','body','raw','stringify','UpdateSmsQueueReport','update','options','where','limit'];(function(_0x520d2f,_0x41685a){var _0x491249=function(_0xb0d3e4){while(--_0xb0d3e4){_0x520d2f['push'](_0x520d2f['shift']());}};_0x491249(++_0x41685a);}(_0xd27e,0x1eb));var _0xed27=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xd27e[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xed27('0x0'));var util=require(_0xed27('0x1'));var moment=require(_0xed27('0x2'));var BPromise=require(_0xed27('0x3'));var rs=require(_0xed27('0x4'));var fs=require('fs');var Redis=require(_0xed27('0x5'));var db=require(_0xed27('0x6'))['db'];var utils=require(_0xed27('0x7'));var logger=require('../../config/logger')(_0xed27('0x8'));var config=require(_0xed27('0x9'));var jayson=require(_0xed27('0xa'));var client=jayson[_0xed27('0xb')][_0xed27('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x8237f3,_0xcf4c73,_0x477ec7){return new BPromise(function(_0x13d23c,_0x4efc92){return client[_0xed27('0xd')](_0x8237f3,_0x477ec7)[_0xed27('0xe')](function(_0x58663f){logger[_0xed27('0xf')](_0xed27('0x10'),_0xcf4c73,_0xed27('0x11'));logger[_0xed27('0x12')](_0xed27('0x13'),_0xcf4c73,'request\x20sent',JSON['stringify'](_0x58663f));if(_0x58663f[_0xed27('0x14')]){if(_0x58663f['error']['code']===0x1f4){logger[_0xed27('0x14')](_0xed27('0x10'),_0xcf4c73,_0x58663f['error']['message']);return _0x4efc92(_0x58663f[_0xed27('0x14')][_0xed27('0x15')]);}logger['error'](_0xed27('0x10'),_0xcf4c73,_0x58663f[_0xed27('0x14')][_0xed27('0x15')]);return _0x13d23c(_0x58663f[_0xed27('0x14')][_0xed27('0x15')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0xcf4c73,_0xed27('0x11'));_0x13d23c(_0x58663f[_0xed27('0x16')][_0xed27('0x15')]);}})['catch'](function(_0x425359){logger[_0xed27('0x14')](_0xed27('0x10'),_0xcf4c73,_0x425359);_0x4efc92(_0x425359);});});}exports[_0xed27('0x17')]=function(_0x4eada7){var _0x4fab30=this;return new Promise(function(_0x35c948,_0x22b301){return db[_0xed27('0x18')][_0xed27('0x19')](_0x4eada7[_0xed27('0x1a')],{'raw':_0x4eada7['options']?_0x4eada7['options'][_0xed27('0x1b')]===undefined?!![]:![]:!![]})[_0xed27('0xe')](function(_0x23bde2){logger[_0xed27('0xf')](_0xed27('0x17'),_0x4eada7);logger[_0xed27('0x12')]('CreateSmsQueueReport',_0x4eada7,JSON[_0xed27('0x1c')](_0x23bde2));_0x35c948(_0x23bde2);})['catch'](function(_0x5cbf5c){logger['error'](_0xed27('0x17'),_0x5cbf5c[_0xed27('0x15')],_0x4eada7);_0x22b301(_0x4fab30['error'](0x1f4,_0x5cbf5c[_0xed27('0x15')]));});});};exports[_0xed27('0x1d')]=function(_0x1a6d92){var _0x1a36a7=this;return new Promise(function(_0x4377f7,_0x4d4f4a){return db[_0xed27('0x18')][_0xed27('0x1e')](_0x1a6d92['body'],{'raw':_0x1a6d92[_0xed27('0x1f')]?_0x1a6d92[_0xed27('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a6d92[_0xed27('0x1f')]?_0x1a6d92[_0xed27('0x1f')][_0xed27('0x20')]||null:null,'attributes':_0x1a6d92[_0xed27('0x1f')]?_0x1a6d92[_0xed27('0x1f')]['attributes']||null:null,'limit':_0x1a6d92[_0xed27('0x1f')]?_0x1a6d92[_0xed27('0x1f')][_0xed27('0x21')]||null:null})['then'](function(_0x1b0328){logger['info'](_0xed27('0x1d'),_0x1a6d92);logger[_0xed27('0x12')](_0xed27('0x1d'),_0x1a6d92,JSON[_0xed27('0x1c')](_0x1b0328));_0x4377f7(_0x1b0328);})[_0xed27('0x22')](function(_0x4490a3){logger['error'](_0xed27('0x1d'),_0x4490a3[_0xed27('0x15')],_0x1a6d92);_0x4d4f4a(_0x1a36a7[_0xed27('0x14')](0x1f4,_0x4490a3['message']));});});}; \ No newline at end of file +var _0xea4d=['../../config/environment','jayson/promise','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','SmsQueueReport','create','body','options','raw','stringify','CreateSmsQueueReport','update','where','attributes','UpdateSmsQueueReport','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xea4d,0x1cb));var _0xdea4=function(_0xaa725b,_0x56f47e){_0xaa725b=_0xaa725b-0x0;var _0x212d43=_0xea4d[_0xaa725b];return _0x212d43;};'use strict';var _=require(_0xdea4('0x0'));var util=require('util');var moment=require(_0xdea4('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdea4('0x2'));var db=require(_0xdea4('0x3'))['db'];var utils=require(_0xdea4('0x4'));var logger=require(_0xdea4('0x5'))('rpc');var config=require(_0xdea4('0x6'));var jayson=require(_0xdea4('0x7'));var client=jayson['client'][_0xdea4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1930e5,_0x548091,_0xf32c49){return new BPromise(function(_0x54aec5,_0x1a33f8){return client[_0xdea4('0x9')](_0x1930e5,_0xf32c49)[_0xdea4('0xa')](function(_0x4f4c54){logger['info'](_0xdea4('0xb'),_0x548091,_0xdea4('0xc'));logger[_0xdea4('0xd')](_0xdea4('0xe'),_0x548091,'request\x20sent',JSON['stringify'](_0x4f4c54));if(_0x4f4c54[_0xdea4('0xf')]){if(_0x4f4c54[_0xdea4('0xf')][_0xdea4('0x10')]===0x1f4){logger[_0xdea4('0xf')](_0xdea4('0xb'),_0x548091,_0x4f4c54['error'][_0xdea4('0x11')]);return _0x1a33f8(_0x4f4c54[_0xdea4('0xf')][_0xdea4('0x11')]);}logger[_0xdea4('0xf')](_0xdea4('0xb'),_0x548091,_0x4f4c54[_0xdea4('0xf')][_0xdea4('0x11')]);return _0x54aec5(_0x4f4c54[_0xdea4('0xf')]['message']);}else{logger[_0xdea4('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x548091,_0xdea4('0xc'));_0x54aec5(_0x4f4c54['result'][_0xdea4('0x11')]);}})[_0xdea4('0x13')](function(_0x55d611){logger[_0xdea4('0xf')](_0xdea4('0xb'),_0x548091,_0x55d611);_0x1a33f8(_0x55d611);});});}exports['CreateSmsQueueReport']=function(_0xfb4f86){var _0x15e471=this;return new Promise(function(_0x45e96f,_0x549f78){return db[_0xdea4('0x14')][_0xdea4('0x15')](_0xfb4f86[_0xdea4('0x16')],{'raw':_0xfb4f86[_0xdea4('0x17')]?_0xfb4f86[_0xdea4('0x17')][_0xdea4('0x18')]===undefined?!![]:![]:!![]})[_0xdea4('0xa')](function(_0x34a57a){logger[_0xdea4('0x12')]('CreateSmsQueueReport',_0xfb4f86);logger['debug']('CreateSmsQueueReport',_0xfb4f86,JSON[_0xdea4('0x19')](_0x34a57a));_0x45e96f(_0x34a57a);})[_0xdea4('0x13')](function(_0x259264){logger[_0xdea4('0xf')](_0xdea4('0x1a'),_0x259264['message'],_0xfb4f86);_0x549f78(_0x15e471['error'](0x1f4,_0x259264[_0xdea4('0x11')]));});});};exports['UpdateSmsQueueReport']=function(_0x245349){var _0x590b76=this;return new Promise(function(_0x2ff997,_0x5e8576){return db['SmsQueueReport'][_0xdea4('0x1b')](_0x245349[_0xdea4('0x16')],{'raw':_0x245349[_0xdea4('0x17')]?_0x245349[_0xdea4('0x17')][_0xdea4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x245349[_0xdea4('0x17')]?_0x245349['options'][_0xdea4('0x1c')]||null:null,'attributes':_0x245349[_0xdea4('0x17')]?_0x245349[_0xdea4('0x17')][_0xdea4('0x1d')]||null:null,'limit':_0x245349[_0xdea4('0x17')]?_0x245349[_0xdea4('0x17')]['limit']||null:null})['then'](function(_0x42f912){logger[_0xdea4('0x12')](_0xdea4('0x1e'),_0x245349);logger[_0xdea4('0xd')](_0xdea4('0x1e'),_0x245349,JSON[_0xdea4('0x19')](_0x42f912));_0x2ff997(_0x42f912);})[_0xdea4('0x13')](function(_0x3eadf7){logger[_0xdea4('0xf')](_0xdea4('0x1e'),_0x3eadf7[_0xdea4('0x11')],_0x245349);_0x5e8576(_0x590b76['error'](0x1f4,_0x3eadf7['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 7c49042..5cca6bf 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 _0x3eea=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x57df43,_0x427fed){var _0x477867=function(_0x5010c0){while(--_0x5010c0){_0x57df43['push'](_0x57df43['shift']());}};_0x477867(++_0x427fed);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x3d11b1,_0x2f019d){_0x3d11b1=_0x3d11b1-0x0;var _0x1c40ec=_0x3eea[_0x3d11b1];return _0x1c40ec;};'use strict';var multer=require(_0xa3ee('0x0'));var util=require('util');var path=require(_0xa3ee('0x1'));var timeout=require(_0xa3ee('0x2'));var express=require(_0xa3ee('0x3'));var router=express[_0xa3ee('0x4')]();var fs_extra=require(_0xa3ee('0x5'));var auth=require(_0xa3ee('0x6'));var interaction=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var controller=require(_0xa3ee('0x9'));router[_0xa3ee('0xa')]('/',auth[_0xa3ee('0xb')](),controller['index']);router['get'](_0xa3ee('0xc'),auth['isAuthenticated'](),controller[_0xa3ee('0xd')]);router['get'](_0xa3ee('0xe'),auth['isAuthenticated'](),controller[_0xa3ee('0xf')]);router['post']('/',auth[_0xa3ee('0xb')](),controller[_0xa3ee('0x10')]);router[_0xa3ee('0x11')]('/:id',auth[_0xa3ee('0xb')](),controller[_0xa3ee('0x12')]);router['delete']('/:id',auth[_0xa3ee('0xb')](),controller[_0xa3ee('0x13')]);module[_0xa3ee('0x14')]=router; \ No newline at end of file +var _0x8819=['show','create','put','update','delete','/:id','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x1a051d,_0x3a017a){var _0x275ccb=function(_0x1290ba){while(--_0x1290ba){_0x1a051d['push'](_0x1a051d['shift']());}};_0x275ccb(++_0x3a017a);}(_0x8819,0x94));var _0x9881=function(_0x173d5c,_0x517f05){_0x173d5c=_0x173d5c-0x0;var _0x62b424=_0x8819[_0x173d5c];return _0x62b424;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9881('0x0'));var timeout=require(_0x9881('0x1'));var express=require(_0x9881('0x2'));var router=express[_0x9881('0x3')]();var fs_extra=require(_0x9881('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9881('0x5'));var config=require(_0x9881('0x6'));var controller=require(_0x9881('0x7'));router[_0x9881('0x8')]('/',auth[_0x9881('0x9')](),controller[_0x9881('0xa')]);router['get'](_0x9881('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x9881('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x9881('0xc')]);router['post']('/',auth[_0x9881('0x9')](),controller[_0x9881('0xd')]);router[_0x9881('0xe')]('/:id',auth[_0x9881('0x9')](),controller[_0x9881('0xf')]);router[_0x9881('0x10')](_0x9881('0x11'),auth['isAuthenticated'](),controller[_0x9881('0x12')]);module[_0x9881('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 97b7bed..3e2f25d 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x26802c,_0x28cfcb){var _0x3af5b0=function(_0x1d70fe){while(--_0x1d70fe){_0x26802c['push'](_0x26802c['shift']());}};_0x3af5b0(++_0x28cfcb);}(_0xedd9,0xfc));var _0x9edd=function(_0x56d6fc,_0x1ed9e0){_0x56d6fc=_0x56d6fc-0x0;var _0x4e1106=_0xedd9[_0x56d6fc];return _0x4e1106;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x214230,_0x5b95ab){var _0x1544c0=function(_0x5bb5bc){while(--_0x5bb5bc){_0x214230['push'](_0x214230['shift']());}};_0x1544c0(++_0x5b95ab);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x00bb[_0x1ac595];return _0x455fff;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index ce3fa1f..d310651 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 _0x799a=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','find','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','map','SmsTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x513a60,_0x4ed28c){var _0x47236d=function(_0x38c8cd){while(--_0x38c8cd){_0x513a60['push'](_0x513a60['shift']());}};_0x47236d(++_0x4ed28c);}(_0x799a,0x186));var _0xa799=function(_0x3cbbde,_0x552681){_0x3cbbde=_0x3cbbde-0x0;var _0x195bf7=_0x799a[_0x3cbbde];return _0x195bf7;};'use strict';var emlformat=require(_0xa799('0x0'));var rimraf=require(_0xa799('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa799('0x2'));var moment=require(_0xa799('0x3'));var BPromise=require(_0xa799('0x4'));var Mustache=require(_0xa799('0x5'));var util=require(_0xa799('0x6'));var path=require(_0xa799('0x7'));var sox=require('sox');var csv=require(_0xa799('0x8'));var ejs=require(_0xa799('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa799('0xa'));var jsforce=require(_0xa799('0xb'));var deskjs=require(_0xa799('0xc'));var toCsv=require(_0xa799('0x8'));var querystring=require(_0xa799('0xd'));var Papa=require(_0xa799('0xe'));var Redis=require('ioredis');var authService=require(_0xa799('0xf'));var qs=require(_0xa799('0x10'));var as=require(_0xa799('0x11'));var hardwareService=require(_0xa799('0x12'));var logger=require(_0xa799('0x13'))(_0xa799('0x14'));var utils=require(_0xa799('0x15'));var config=require(_0xa799('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa799('0x17'))['db'];function respondWithStatusCode(_0xee1e6d,_0x406ae0){_0x406ae0=_0x406ae0||0xcc;return function(_0x1caa9b){if(_0x1caa9b){return _0xee1e6d[_0xa799('0x18')](_0x406ae0);}return _0xee1e6d[_0xa799('0x19')](_0x406ae0)[_0xa799('0x1a')]();};}function respondWithResult(_0x24d0a6,_0x2b2900){_0x2b2900=_0x2b2900||0xc8;return function(_0x544036){if(_0x544036){return _0x24d0a6[_0xa799('0x19')](_0x2b2900)['json'](_0x544036);}};}function respondWithFilteredResult(_0x17b5d4,_0x3dd2a2){return function(_0x365853){if(_0x365853){var _0x365bb6=typeof _0x3dd2a2[_0xa799('0x1b')]==='undefined'&&typeof _0x3dd2a2['limit']===_0xa799('0x1c');var _0x5f9309=_0x365853[_0xa799('0x1d')];var _0x4f7776=_0x365bb6?0x0:_0x3dd2a2['offset'];var _0x36c383=_0x365bb6?_0x365853[_0xa799('0x1d')]:_0x3dd2a2[_0xa799('0x1b')]+_0x3dd2a2[_0xa799('0x1e')];var _0x3ebe0e;if(_0x36c383>=_0x5f9309){_0x36c383=_0x5f9309;_0x3ebe0e=0xc8;}else{_0x3ebe0e=0xce;}_0x17b5d4[_0xa799('0x19')](_0x3ebe0e);return _0x17b5d4[_0xa799('0x1f')](_0xa799('0x20'),_0x4f7776+'-'+_0x36c383+'/'+_0x5f9309)[_0xa799('0x21')](_0x365853);}return null;};}function patchUpdates(_0x209525){return function(_0x592302){try{jsonpatch[_0xa799('0x22')](_0x592302,_0x209525,!![]);}catch(_0x52fab7){return BPromise[_0xa799('0x23')](_0x52fab7);}return _0x592302[_0xa799('0x24')]();};}function saveUpdates(_0x14b923,_0x14d58e){return function(_0x70d199){if(_0x70d199){return _0x70d199[_0xa799('0x25')](_0x14b923)[_0xa799('0x26')](function(_0x41ab3f){return _0x41ab3f;});}return null;};}function removeEntity(_0x223d52,_0x19f762){return function(_0x568ec8){if(_0x568ec8){return _0x568ec8[_0xa799('0x27')]()[_0xa799('0x26')](function(){_0x223d52[_0xa799('0x19')](0xcc)[_0xa799('0x1a')]();});}};}function handleEntityNotFound(_0x19cd57,_0x26fc68){return function(_0x2bb305){if(!_0x2bb305){_0x19cd57['sendStatus'](0x194);}return _0x2bb305;};}function handleError(_0xb9f5b3,_0xae707f){_0xae707f=_0xae707f||0x1f4;return function(_0x353de0){logger[_0xa799('0x28')](_0x353de0['stack']);if(_0x353de0[_0xa799('0x29')]){delete _0x353de0['name'];}_0xb9f5b3['status'](_0xae707f)['send'](_0x353de0);};}exports['index']=function(_0x3462a1,_0x44469c){var _0x4ccf92={},_0x53db48={},_0x92f459={'count':0x0,'rows':[]};var _0x200ab4=_[_0xa799('0x2a')](db[_0xa799('0x2b')]['rawAttributes'],function(_0x1a7895){return{'name':_0x1a7895[_0xa799('0x2c')],'type':_0x1a7895[_0xa799('0x2d')][_0xa799('0x2e')]};});_0x53db48[_0xa799('0x2f')]=_[_0xa799('0x2a')](_0x200ab4,'name');_0x53db48[_0xa799('0x30')]=_[_0xa799('0x31')](_0x3462a1[_0xa799('0x30')]);_0x53db48[_0xa799('0x32')]=_[_0xa799('0x33')](_0x53db48[_0xa799('0x2f')],_0x53db48[_0xa799('0x30')]);_0x4ccf92[_0xa799('0x34')]=_[_0xa799('0x33')](_0x53db48['model'],qs[_0xa799('0x35')](_0x3462a1[_0xa799('0x30')]['fields']));_0x4ccf92[_0xa799('0x34')]=_0x4ccf92[_0xa799('0x34')][_0xa799('0x36')]?_0x4ccf92[_0xa799('0x34')]:_0x53db48[_0xa799('0x2f')];if(!_0x3462a1['query'][_0xa799('0x37')](_0xa799('0x38'))){_0x4ccf92[_0xa799('0x1e')]=qs[_0xa799('0x1e')](_0x3462a1['query'][_0xa799('0x1e')]);_0x4ccf92['offset']=qs[_0xa799('0x1b')](_0x3462a1[_0xa799('0x30')][_0xa799('0x1b')]);}_0x4ccf92[_0xa799('0x39')]=qs[_0xa799('0x3a')](_0x3462a1['query'][_0xa799('0x3a')]);_0x4ccf92[_0xa799('0x3b')]=qs[_0xa799('0x32')](_[_0xa799('0x3c')](_0x3462a1[_0xa799('0x30')],_0x53db48['filters']),_0x200ab4);if(_0x3462a1[_0xa799('0x30')][_0xa799('0x3d')]){_0x4ccf92[_0xa799('0x3b')]=_[_0xa799('0x3e')](_0x4ccf92[_0xa799('0x3b')],{'$or':_[_0xa799('0x2a')](_0x200ab4,function(_0xa39248){if(_0xa39248[_0xa799('0x2d')]!==_0xa799('0x3f')){var _0x26425f={};_0x26425f[_0xa39248[_0xa799('0x29')]]={'$like':'%'+_0x3462a1[_0xa799('0x30')][_0xa799('0x3d')]+'%'};return _0x26425f;}})});}_0x4ccf92=_[_0xa799('0x3e')]({},_0x4ccf92,_0x3462a1[_0xa799('0x40')]);var _0x4ee3dc={'where':_0x4ccf92[_0xa799('0x3b')]};return db[_0xa799('0x2b')][_0xa799('0x1d')](_0x4ee3dc)[_0xa799('0x26')](function(_0x2a3395){_0x92f459[_0xa799('0x1d')]=_0x2a3395;if(_0x3462a1[_0xa799('0x30')][_0xa799('0x41')]){_0x4ccf92[_0xa799('0x42')]=[{'all':!![]}];}return db[_0xa799('0x2b')]['findAll'](_0x4ccf92);})[_0xa799('0x26')](function(_0x354f64){_0x92f459[_0xa799('0x43')]=_0x354f64;return _0x92f459;})[_0xa799('0x26')](respondWithFilteredResult(_0x44469c,_0x4ccf92))[_0xa799('0x44')](handleError(_0x44469c,null));};exports['show']=function(_0x4c58ca,_0x58fa38){var _0x9f4793={'raw':!![],'where':{'id':_0x4c58ca[_0xa799('0x45')]['id']}},_0x45db1b={};_0x45db1b[_0xa799('0x2f')]=_[_0xa799('0x31')](db[_0xa799('0x2b')][_0xa799('0x46')]);_0x45db1b[_0xa799('0x30')]=_[_0xa799('0x31')](_0x4c58ca[_0xa799('0x30')]);_0x45db1b[_0xa799('0x32')]=_[_0xa799('0x33')](_0x45db1b['model'],_0x45db1b[_0xa799('0x30')]);_0x9f4793['attributes']=_[_0xa799('0x33')](_0x45db1b[_0xa799('0x2f')],qs['fields'](_0x4c58ca['query'][_0xa799('0x35')]));_0x9f4793[_0xa799('0x34')]=_0x9f4793[_0xa799('0x34')][_0xa799('0x36')]?_0x9f4793[_0xa799('0x34')]:_0x45db1b[_0xa799('0x2f')];if(_0x4c58ca[_0xa799('0x30')]['includeAll']){_0x9f4793[_0xa799('0x42')]=[{'all':!![]}];}_0x9f4793=_[_0xa799('0x3e')]({},_0x9f4793,_0x4c58ca['options']);return db[_0xa799('0x2b')][_0xa799('0x47')](_0x9f4793)[_0xa799('0x26')](handleEntityNotFound(_0x58fa38,null))[_0xa799('0x26')](respondWithResult(_0x58fa38,null))[_0xa799('0x44')](handleError(_0x58fa38,null));};exports['create']=function(_0x51aa79,_0x149d04){return db[_0xa799('0x2b')]['create'](_0x51aa79[_0xa799('0x48')],{})['then'](respondWithResult(_0x149d04,0xc9))[_0xa799('0x44')](handleError(_0x149d04,null));};exports['update']=function(_0xbe80c1,_0x276429){if(_0xbe80c1['body']['id']){delete _0xbe80c1[_0xa799('0x48')]['id'];}return db['SmsTransferReport'][_0xa799('0x47')]({'where':{'id':_0xbe80c1[_0xa799('0x45')]['id']}})['then'](handleEntityNotFound(_0x276429,null))[_0xa799('0x26')](saveUpdates(_0xbe80c1[_0xa799('0x48')],null))[_0xa799('0x26')](respondWithResult(_0x276429,null))[_0xa799('0x44')](handleError(_0x276429,null));};exports[_0xa799('0x27')]=function(_0x1afe09,_0x33c106){return db[_0xa799('0x2b')]['find']({'where':{'id':_0x1afe09['params']['id']}})['then'](handleEntityNotFound(_0x33c106,null))['then'](removeEntity(_0x33c106,null))[_0xa799('0x44')](handleError(_0x33c106,null));};exports[_0xa799('0x49')]=function(_0x2ac53f,_0x2f8d6b){return db['SmsTransferReport'][_0xa799('0x49')]()['then'](respondWithResult(_0x2f8d6b,null))[_0xa799('0x44')](handleError(_0x2f8d6b,null));}; \ No newline at end of file +var _0x21ff=['reject','update','then','destroy','error','stack','name','send','SmsTransferReport','type','key','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x21ff,0xb6));var _0xf21f=function(_0xf34109,_0x380779){_0xf34109=_0xf34109-0x0;var _0x570bfc=_0x21ff[_0xf34109];return _0x570bfc;};'use strict';var emlformat=require(_0xf21f('0x0'));var rimraf=require(_0xf21f('0x1'));var zipdir=require(_0xf21f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf21f('0x3'));var moment=require(_0xf21f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf21f('0x5'));var util=require('util');var path=require(_0xf21f('0x6'));var sox=require(_0xf21f('0x7'));var csv=require('to-csv');var ejs=require(_0xf21f('0x8'));var fs=require('fs');var fs_extra=require(_0xf21f('0x9'));var _=require(_0xf21f('0xa'));var squel=require(_0xf21f('0xb'));var crypto=require(_0xf21f('0xc'));var jsforce=require(_0xf21f('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf21f('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf21f('0xf'));var qs=require(_0xf21f('0x10'));var as=require(_0xf21f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf21f('0x12'))(_0xf21f('0x13'));var utils=require(_0xf21f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf21f('0x15'));var db=require(_0xf21f('0x16'))['db'];function respondWithStatusCode(_0x12c6fb,_0x1137c0){_0x1137c0=_0x1137c0||0xcc;return function(_0x1b4855){if(_0x1b4855){return _0x12c6fb[_0xf21f('0x17')](_0x1137c0);}return _0x12c6fb[_0xf21f('0x18')](_0x1137c0)[_0xf21f('0x19')]();};}function respondWithResult(_0x4b5814,_0x47ba59){_0x47ba59=_0x47ba59||0xc8;return function(_0x41cc52){if(_0x41cc52){return _0x4b5814[_0xf21f('0x18')](_0x47ba59)[_0xf21f('0x1a')](_0x41cc52);}};}function respondWithFilteredResult(_0x1bcf86,_0x226d13){return function(_0x4482b1){if(_0x4482b1){var _0x1c1a75=typeof _0x226d13[_0xf21f('0x1b')]==='undefined'&&typeof _0x226d13[_0xf21f('0x1c')]===_0xf21f('0x1d');var _0x3a882e=_0x4482b1[_0xf21f('0x1e')];var _0x4f4c46=_0x1c1a75?0x0:_0x226d13['offset'];var _0x5dd80c=_0x1c1a75?_0x4482b1['count']:_0x226d13[_0xf21f('0x1b')]+_0x226d13[_0xf21f('0x1c')];var _0x40b8f5;if(_0x5dd80c>=_0x3a882e){_0x5dd80c=_0x3a882e;_0x40b8f5=0xc8;}else{_0x40b8f5=0xce;}_0x1bcf86[_0xf21f('0x18')](_0x40b8f5);return _0x1bcf86[_0xf21f('0x1f')](_0xf21f('0x20'),_0x4f4c46+'-'+_0x5dd80c+'/'+_0x3a882e)[_0xf21f('0x1a')](_0x4482b1);}return null;};}function patchUpdates(_0xf90b71){return function(_0x480411){try{jsonpatch[_0xf21f('0x21')](_0x480411,_0xf90b71,!![]);}catch(_0x3b8a97){return BPromise[_0xf21f('0x22')](_0x3b8a97);}return _0x480411['save']();};}function saveUpdates(_0x300e69,_0x2911ee){return function(_0xdf7e7f){if(_0xdf7e7f){return _0xdf7e7f[_0xf21f('0x23')](_0x300e69)[_0xf21f('0x24')](function(_0x308014){return _0x308014;});}return null;};}function removeEntity(_0x5b622e,_0x306b92){return function(_0x13a0ca){if(_0x13a0ca){return _0x13a0ca[_0xf21f('0x25')]()[_0xf21f('0x24')](function(){_0x5b622e['status'](0xcc)[_0xf21f('0x19')]();});}};}function handleEntityNotFound(_0x4a3d2b,_0x2bcdb0){return function(_0x493e98){if(!_0x493e98){_0x4a3d2b[_0xf21f('0x17')](0x194);}return _0x493e98;};}function handleError(_0x467f01,_0x1a49c6){_0x1a49c6=_0x1a49c6||0x1f4;return function(_0x19606f){logger[_0xf21f('0x26')](_0x19606f[_0xf21f('0x27')]);if(_0x19606f[_0xf21f('0x28')]){delete _0x19606f[_0xf21f('0x28')];}_0x467f01[_0xf21f('0x18')](_0x1a49c6)[_0xf21f('0x29')](_0x19606f);};}exports['index']=function(_0x23746c,_0x56f8dd){var _0xe530a1={},_0x5c2a16={},_0x3e0b3c={'count':0x0,'rows':[]};var _0x1eb0da=_['map'](db[_0xf21f('0x2a')]['rawAttributes'],function(_0x36484b){return{'name':_0x36484b['fieldName'],'type':_0x36484b[_0xf21f('0x2b')][_0xf21f('0x2c')]};});_0x5c2a16['model']=_[_0xf21f('0x2d')](_0x1eb0da,'name');_0x5c2a16[_0xf21f('0x2e')]=_['keys'](_0x23746c['query']);_0x5c2a16[_0xf21f('0x2f')]=_[_0xf21f('0x30')](_0x5c2a16[_0xf21f('0x31')],_0x5c2a16[_0xf21f('0x2e')]);_0xe530a1[_0xf21f('0x32')]=_['intersection'](_0x5c2a16[_0xf21f('0x31')],qs[_0xf21f('0x33')](_0x23746c[_0xf21f('0x2e')][_0xf21f('0x33')]));_0xe530a1['attributes']=_0xe530a1[_0xf21f('0x32')]['length']?_0xe530a1[_0xf21f('0x32')]:_0x5c2a16['model'];if(!_0x23746c[_0xf21f('0x2e')][_0xf21f('0x34')]('nolimit')){_0xe530a1['limit']=qs['limit'](_0x23746c[_0xf21f('0x2e')][_0xf21f('0x1c')]);_0xe530a1['offset']=qs[_0xf21f('0x1b')](_0x23746c[_0xf21f('0x2e')]['offset']);}_0xe530a1[_0xf21f('0x35')]=qs[_0xf21f('0x36')](_0x23746c[_0xf21f('0x2e')][_0xf21f('0x36')]);_0xe530a1[_0xf21f('0x37')]=qs[_0xf21f('0x2f')](_[_0xf21f('0x38')](_0x23746c[_0xf21f('0x2e')],_0x5c2a16[_0xf21f('0x2f')]),_0x1eb0da);if(_0x23746c[_0xf21f('0x2e')]['filter']){_0xe530a1[_0xf21f('0x37')]=_[_0xf21f('0x39')](_0xe530a1[_0xf21f('0x37')],{'$or':_[_0xf21f('0x2d')](_0x1eb0da,function(_0x497206){if(_0x497206[_0xf21f('0x2b')]!==_0xf21f('0x3a')){var _0x23d7b4={};_0x23d7b4[_0x497206['name']]={'$like':'%'+_0x23746c[_0xf21f('0x2e')][_0xf21f('0x3b')]+'%'};return _0x23d7b4;}})});}_0xe530a1=_[_0xf21f('0x39')]({},_0xe530a1,_0x23746c[_0xf21f('0x3c')]);var _0x4ee3bb={'where':_0xe530a1[_0xf21f('0x37')]};return db[_0xf21f('0x2a')][_0xf21f('0x1e')](_0x4ee3bb)[_0xf21f('0x24')](function(_0x12a7ca){_0x3e0b3c[_0xf21f('0x1e')]=_0x12a7ca;if(_0x23746c[_0xf21f('0x2e')]['includeAll']){_0xe530a1[_0xf21f('0x3d')]=[{'all':!![]}];}return db[_0xf21f('0x2a')]['findAll'](_0xe530a1);})[_0xf21f('0x24')](function(_0x23fde5){_0x3e0b3c[_0xf21f('0x3e')]=_0x23fde5;return _0x3e0b3c;})[_0xf21f('0x24')](respondWithFilteredResult(_0x56f8dd,_0xe530a1))[_0xf21f('0x3f')](handleError(_0x56f8dd,null));};exports[_0xf21f('0x40')]=function(_0x2eb1cb,_0x409dda){var _0x1d0626={'raw':!![],'where':{'id':_0x2eb1cb[_0xf21f('0x41')]['id']}},_0x4fcbdf={};_0x4fcbdf[_0xf21f('0x31')]=_['keys'](db[_0xf21f('0x2a')][_0xf21f('0x42')]);_0x4fcbdf[_0xf21f('0x2e')]=_['keys'](_0x2eb1cb['query']);_0x4fcbdf[_0xf21f('0x2f')]=_[_0xf21f('0x30')](_0x4fcbdf['model'],_0x4fcbdf['query']);_0x1d0626['attributes']=_[_0xf21f('0x30')](_0x4fcbdf[_0xf21f('0x31')],qs['fields'](_0x2eb1cb[_0xf21f('0x2e')][_0xf21f('0x33')]));_0x1d0626['attributes']=_0x1d0626['attributes'][_0xf21f('0x43')]?_0x1d0626[_0xf21f('0x32')]:_0x4fcbdf[_0xf21f('0x31')];if(_0x2eb1cb[_0xf21f('0x2e')]['includeAll']){_0x1d0626['include']=[{'all':!![]}];}_0x1d0626=_['merge']({},_0x1d0626,_0x2eb1cb['options']);return db[_0xf21f('0x2a')][_0xf21f('0x44')](_0x1d0626)[_0xf21f('0x24')](handleEntityNotFound(_0x409dda,null))[_0xf21f('0x24')](respondWithResult(_0x409dda,null))[_0xf21f('0x3f')](handleError(_0x409dda,null));};exports[_0xf21f('0x45')]=function(_0xd7da92,_0x4512dc){return db['SmsTransferReport'][_0xf21f('0x45')](_0xd7da92['body'],{})['then'](respondWithResult(_0x4512dc,0xc9))['catch'](handleError(_0x4512dc,null));};exports[_0xf21f('0x23')]=function(_0x2baaea,_0x3d7efa){if(_0x2baaea[_0xf21f('0x46')]['id']){delete _0x2baaea['body']['id'];}return db[_0xf21f('0x2a')][_0xf21f('0x44')]({'where':{'id':_0x2baaea[_0xf21f('0x41')]['id']}})[_0xf21f('0x24')](handleEntityNotFound(_0x3d7efa,null))['then'](saveUpdates(_0x2baaea['body'],null))[_0xf21f('0x24')](respondWithResult(_0x3d7efa,null))[_0xf21f('0x3f')](handleError(_0x3d7efa,null));};exports[_0xf21f('0x25')]=function(_0x2dd01c,_0x4bc638){return db['SmsTransferReport'][_0xf21f('0x44')]({'where':{'id':_0x2dd01c[_0xf21f('0x41')]['id']}})[_0xf21f('0x24')](handleEntityNotFound(_0x4bc638,null))[_0xf21f('0x24')](removeEntity(_0x4bc638,null))[_0xf21f('0x3f')](handleError(_0x4bc638,null));};exports['describe']=function(_0x5e701a,_0x4380cd){return db[_0xf21f('0x2a')][_0xf21f('0x47')]()['then'](respondWithResult(_0x4380cd,null))[_0xf21f('0x3f')](handleError(_0x4380cd,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 9d23037..45affd3 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 _0x2029=['api','moment','bluebird','request-promise','path','rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','util'];(function(_0x2aa398,_0x3d0cd5){var _0x13b62d=function(_0x5c13df){while(--_0x5c13df){_0x2aa398['push'](_0x2aa398['shift']());}};_0x13b62d(++_0x3d0cd5);}(_0x2029,0xb5));var _0x9202=function(_0x3acdfe,_0x92cb20){_0x3acdfe=_0x3acdfe-0x0;var _0x1283fd=_0x2029[_0x3acdfe];return _0x1283fd;};'use strict';var _=require('lodash');var util=require(_0x9202('0x0'));var logger=require('../../config/logger')(_0x9202('0x1'));var moment=require(_0x9202('0x2'));var BPromise=require(_0x9202('0x3'));var rp=require(_0x9202('0x4'));var fs=require('fs');var path=require(_0x9202('0x5'));var rimraf=require(_0x9202('0x6'));var config=require('../../config/environment');var attributes=require(_0x9202('0x7'));module[_0x9202('0x8')]=function(_0x5b92d1,_0x4f232f){return _0x5b92d1[_0x9202('0x9')](_0x9202('0xa'),attributes,{'tableName':_0x9202('0xb'),'paranoid':![],'indexes':[{'name':_0x9202('0xc'),'fields':[_0x9202('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x359a=['define','SmsTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports'];(function(_0x5619c3,_0x568923){var _0x66cf19=function(_0x3028da){while(--_0x3028da){_0x5619c3['push'](_0x5619c3['shift']());}};_0x66cf19(++_0x568923);}(_0x359a,0x153));var _0xa359=function(_0x496fba,_0x1db6bc){_0x496fba=_0x496fba-0x0;var _0xe3e181=_0x359a[_0x496fba];return _0xe3e181;};'use strict';var _=require(_0xa359('0x0'));var util=require(_0xa359('0x1'));var logger=require(_0xa359('0x2'))(_0xa359('0x3'));var moment=require(_0xa359('0x4'));var BPromise=require('bluebird');var rp=require(_0xa359('0x5'));var fs=require('fs');var path=require(_0xa359('0x6'));var rimraf=require(_0xa359('0x7'));var config=require(_0xa359('0x8'));var attributes=require(_0xa359('0x9'));module[_0xa359('0xa')]=function(_0xbaaeb4,_0x1bd70e){return _0xbaaeb4[_0xa359('0xb')](_0xa359('0xc'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xa359('0xd'),'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 95e8bdc..8ec2e55 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 _0xde6c=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x4da462,_0x2aac46){var _0x2a001a=function(_0x5db008){while(--_0x5db008){_0x4da462['push'](_0x4da462['shift']());}};_0x2a001a(++_0x2aac46);}(_0xde6c,0x119));var _0xcde6=function(_0x5b21eb,_0x540b6d){_0x5b21eb=_0x5b21eb-0x0;var _0x279c63=_0xde6c[_0x5b21eb];return _0x279c63;};'use strict';var _=require(_0xcde6('0x0'));var util=require(_0xcde6('0x1'));var moment=require('moment');var BPromise=require(_0xcde6('0x2'));var rs=require(_0xcde6('0x3'));var fs=require('fs');var Redis=require(_0xcde6('0x4'));var db=require(_0xcde6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcde6('0x6'))(_0xcde6('0x7'));var config=require(_0xcde6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcde6('0x9')][_0xcde6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5543d9,_0x4c37b1,_0x2f7de6){return new BPromise(function(_0x4f07e8,_0x19d6b2){return client[_0xcde6('0xb')](_0x5543d9,_0x2f7de6)[_0xcde6('0xc')](function(_0x353b84){logger['info'](_0xcde6('0xd'),_0x4c37b1,_0xcde6('0xe'));logger['debug'](_0xcde6('0xf'),_0x4c37b1,_0xcde6('0xe'),JSON[_0xcde6('0x10')](_0x353b84));if(_0x353b84[_0xcde6('0x11')]){if(_0x353b84[_0xcde6('0x11')][_0xcde6('0x12')]===0x1f4){logger[_0xcde6('0x11')](_0xcde6('0xd'),_0x4c37b1,_0x353b84[_0xcde6('0x11')][_0xcde6('0x13')]);return _0x19d6b2(_0x353b84['error'][_0xcde6('0x13')]);}logger[_0xcde6('0x11')](_0xcde6('0xd'),_0x4c37b1,_0x353b84[_0xcde6('0x11')][_0xcde6('0x13')]);return _0x4f07e8(_0x353b84[_0xcde6('0x11')][_0xcde6('0x13')]);}else{logger[_0xcde6('0x14')](_0xcde6('0xd'),_0x4c37b1,_0xcde6('0xe'));_0x4f07e8(_0x353b84['result'][_0xcde6('0x13')]);}})[_0xcde6('0x15')](function(_0x38f82a){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x4c37b1,_0x38f82a);_0x19d6b2(_0x38f82a);});});} \ No newline at end of file +var _0x046b=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment','bluebird'];(function(_0xc70b15,_0x3425e3){var _0x496077=function(_0x57feee){while(--_0x57feee){_0xc70b15['push'](_0xc70b15['shift']());}};_0x496077(++_0x3425e3);}(_0x046b,0x147));var _0xb046=function(_0x564dd7,_0x248174){_0x564dd7=_0x564dd7-0x0;var _0xede844=_0x046b[_0x564dd7];return _0xede844;};'use strict';var _=require('lodash');var util=require(_0xb046('0x0'));var moment=require(_0xb046('0x1'));var BPromise=require(_0xb046('0x2'));var rs=require(_0xb046('0x3'));var fs=require('fs');var Redis=require(_0xb046('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb046('0x5'));var logger=require(_0xb046('0x6'))(_0xb046('0x7'));var config=require(_0xb046('0x8'));var jayson=require(_0xb046('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13203d,_0x1f00c8,_0x190c9a){return new BPromise(function(_0x308e79,_0x3c0678){return client[_0xb046('0xa')](_0x13203d,_0x190c9a)[_0xb046('0xb')](function(_0x170b66){logger['info'](_0xb046('0xc'),_0x1f00c8,'request\x20sent');logger[_0xb046('0xd')](_0xb046('0xe'),_0x1f00c8,_0xb046('0xf'),JSON[_0xb046('0x10')](_0x170b66));if(_0x170b66[_0xb046('0x11')]){if(_0x170b66['error']['code']===0x1f4){logger['error'](_0xb046('0xc'),_0x1f00c8,_0x170b66[_0xb046('0x11')]['message']);return _0x3c0678(_0x170b66[_0xb046('0x11')]['message']);}logger[_0xb046('0x11')](_0xb046('0xc'),_0x1f00c8,_0x170b66['error'][_0xb046('0x12')]);return _0x308e79(_0x170b66[_0xb046('0x11')][_0xb046('0x12')]);}else{logger[_0xb046('0x13')](_0xb046('0xc'),_0x1f00c8,'request\x20sent');_0x308e79(_0x170b66[_0xb046('0x14')][_0xb046('0x12')]);}})[_0xb046('0x15')](function(_0xa3b910){logger[_0xb046('0x11')](_0xb046('0xc'),_0x1f00c8,_0xa3b910);_0x3c0678(_0xa3b910);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index edaba1c..e46fe17 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 _0xb122=['%s-%s%s','extname','post','file','create','put','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','index','get','/:id','show','isAuthenticated','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace'];(function(_0x570ece,_0x4adf8b){var _0x221c19=function(_0x5c4708){while(--_0x5c4708){_0x570ece['push'](_0x570ece['shift']());}};_0x221c19(++_0x4adf8b);}(_0xb122,0x1ac));var _0x2b12=function(_0x17a610,_0x32a8f6){_0x17a610=_0x17a610-0x0;var _0xdabd1f=_0xb122[_0x17a610];return _0xdabd1f;};'use strict';var multer=require(_0x2b12('0x0'));var util=require(_0x2b12('0x1'));var path=require('path');var timeout=require(_0x2b12('0x2'));var express=require(_0x2b12('0x3'));var router=express[_0x2b12('0x4')]();var fs_extra=require(_0x2b12('0x5'));var auth=require(_0x2b12('0x6'));var interaction=require(_0x2b12('0x7'));var config=require(_0x2b12('0x8'));var controller=require(_0x2b12('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x2b12('0xa')]);router[_0x2b12('0xb')](_0x2b12('0xc'),auth['isAuthenticated'](),controller[_0x2b12('0xd')]);router['get']('/:id/download',auth[_0x2b12('0xe')](),controller[_0x2b12('0xf')]);var upload=multer({'storage':multer[_0x2b12('0x10')]({'destination':function(_0x56575d,_0x2e05a3,_0x2b7da6){_0x2b7da6(null,path[_0x2b12('0x11')](config[_0x2b12('0x12')],_0x2b12('0x13')));},'filename':function(_0x211f6c,_0x407738,_0x5b73a0){_0x407738[_0x2b12('0x14')]=_0x407738['originalname'][_0x2b12('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5b73a0(null,util['format'](_0x2b12('0x16'),path['basename'](_0x407738[_0x2b12('0x14')],path[_0x2b12('0x17')](_0x407738['originalname'])),Date['now'](),path[_0x2b12('0x17')](_0x407738[_0x2b12('0x14')])));}})});router[_0x2b12('0x18')]('/',upload['single'](_0x2b12('0x19')),controller[_0x2b12('0x1a')]);router[_0x2b12('0x1b')](_0x2b12('0xc'),auth[_0x2b12('0xe')](),controller[_0x2b12('0x1c')]);router[_0x2b12('0x1d')](_0x2b12('0xc'),auth[_0x2b12('0xe')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0x6dcd=['create','/:id','delete','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','download','diskStorage','root','server/files/sounds/original/','originalname','replace','basename','now','extname','single','file'];(function(_0x1489cd,_0x3d3a64){var _0x9e63d7=function(_0x81a609){while(--_0x81a609){_0x1489cd['push'](_0x1489cd['shift']());}};_0x9e63d7(++_0x3d3a64);}(_0x6dcd,0x130));var _0xd6dc=function(_0x4b5adf,_0x1c4db4){_0x4b5adf=_0x4b5adf-0x0;var _0x3b2175=_0x6dcd[_0x4b5adf];return _0x3b2175;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd6dc('0x0'));var timeout=require(_0xd6dc('0x1'));var express=require(_0xd6dc('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd6dc('0x3'));var interaction=require(_0xd6dc('0x4'));var config=require(_0xd6dc('0x5'));var controller=require('./sound.controller');router[_0xd6dc('0x6')]('/',auth[_0xd6dc('0x7')](),controller[_0xd6dc('0x8')]);router[_0xd6dc('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xd6dc('0x9')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xd6dc('0xa')]);var upload=multer({'storage':multer[_0xd6dc('0xb')]({'destination':function(_0x3372c8,_0x4f156b,_0x14c4a9){_0x14c4a9(null,path['join'](config[_0xd6dc('0xc')],_0xd6dc('0xd')));},'filename':function(_0x4325dd,_0xf74105,_0x1d418a){_0xf74105[_0xd6dc('0xe')]=_0xf74105['originalname'][_0xd6dc('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1d418a(null,util['format']('%s-%s%s',path[_0xd6dc('0x10')](_0xf74105[_0xd6dc('0xe')],path['extname'](_0xf74105[_0xd6dc('0xe')])),Date[_0xd6dc('0x11')](),path[_0xd6dc('0x12')](_0xf74105['originalname'])));}})});router['post']('/',upload[_0xd6dc('0x13')](_0xd6dc('0x14')),controller[_0xd6dc('0x15')]);router['put'](_0xd6dc('0x16'),auth[_0xd6dc('0x7')](),controller['update']);router[_0xd6dc('0x17')]('/:id',auth[_0xd6dc('0x7')](),controller[_0xd6dc('0x17')]);module[_0xd6dc('0x18')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 6f5b8d7..17c5a1b 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 _0x11d6=['FLOAT','BIGINT','INTEGER','sequelize','STRING','name'];(function(_0x4d6441,_0x15cec3){var _0xbd09ad=function(_0x276e67){while(--_0x276e67){_0x4d6441['push'](_0x4d6441['shift']());}};_0xbd09ad(++_0x15cec3);}(_0x11d6,0xff));var _0x611d=function(_0x7ea253,_0x3e8b76){_0x7ea253=_0x7ea253-0x0;var _0x1099b3=_0x11d6[_0x7ea253];return _0x1099b3;};'use strict';var Sequelize=require(_0x611d('0x0'));module['exports']={'name':{'type':Sequelize[_0x611d('0x1')],'unique':_0x611d('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x611d('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x611d('0x1')]},'original_duration':{'type':Sequelize[_0x611d('0x3')]},'original_sampleCount':{'type':Sequelize[_0x611d('0x4')]},'original_channelCount':{'type':Sequelize[_0x611d('0x5')]},'original_bitRate':{'type':Sequelize[_0x611d('0x4')]},'original_sampleRate':{'type':Sequelize[_0x611d('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x611d('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x611d('0x4')]},'converted_channelCount':{'type':Sequelize[_0x611d('0x5')]},'converted_bitRate':{'type':Sequelize[_0x611d('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x611d('0x5')]}}; \ No newline at end of file +var _0xd8c2=['sequelize','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x23099a,_0x2b5805){var _0x37d69c=function(_0xd2830e){while(--_0xd2830e){_0x23099a['push'](_0x23099a['shift']());}};_0x37d69c(++_0x2b5805);}(_0xd8c2,0x1bc));var _0x2d8c=function(_0x23ce61,_0x5278a1){_0x23ce61=_0x23ce61-0x0;var _0x2adcb4=_0xd8c2[_0x23ce61];return _0x2adcb4;};'use strict';var Sequelize=require(_0x2d8c('0x0'));module['exports']={'name':{'type':Sequelize[_0x2d8c('0x1')],'unique':_0x2d8c('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x2d8c('0x1')]},'display_name':{'type':Sequelize[_0x2d8c('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x2d8c('0x1')]},'original_duration':{'type':Sequelize[_0x2d8c('0x3')]},'original_sampleCount':{'type':Sequelize[_0x2d8c('0x4')]},'original_channelCount':{'type':Sequelize[_0x2d8c('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x2d8c('0x5')]},'converted_format':{'type':Sequelize[_0x2d8c('0x1')]},'converted_duration':{'type':Sequelize[_0x2d8c('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x2d8c('0x4')]},'converted_channelCount':{'type':Sequelize[_0x2d8c('0x5')]},'converted_bitRate':{'type':Sequelize[_0x2d8c('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x2d8c('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index bee827b..5a35ff9 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 _0xbc3f=['model','query','filters','fields','attributes','nolimit','order','sort','where','filter','options','findAll','rows','catch','show','params','intersection','length','include','save_name','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','download','root','format','%s.%s','create','basename','file','originalname','extname','filename','substring','info','Sound\x20upload\x20destination:\x20%s','0777','transcode','error','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_bitRate','converted_sampleRate','chmodSync','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','server/files/sounds/original','original_format','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','count','offset','limit','set','json','apply','reject','save','update','then','get','Sounds','end','sendStatus','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','key'];(function(_0xa9caa3,_0x37ca99){var _0x41e762=function(_0x57421a){while(--_0x57421a){_0xa9caa3['push'](_0xa9caa3['shift']());}};_0x41e762(++_0x37ca99);}(_0xbc3f,0x149));var _0xfbc3=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0xbc3f[_0x5d80de];return _0x1c7556;};'use strict';var emlformat=require(_0xfbc3('0x0'));var rimraf=require(_0xfbc3('0x1'));var zipdir=require(_0xfbc3('0x2'));var jsonpatch=require(_0xfbc3('0x3'));var rp=require('request-promise');var moment=require(_0xfbc3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfbc3('0x5'));var path=require(_0xfbc3('0x6'));var sox=require(_0xfbc3('0x7'));var csv=require(_0xfbc3('0x8'));var ejs=require(_0xfbc3('0x9'));var fs=require('fs');var fs_extra=require(_0xfbc3('0xa'));var _=require('lodash');var squel=require(_0xfbc3('0xb'));var crypto=require(_0xfbc3('0xc'));var jsforce=require(_0xfbc3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfbc3('0x8'));var querystring=require(_0xfbc3('0xe'));var Papa=require(_0xfbc3('0xf'));var Redis=require(_0xfbc3('0x10'));var authService=require(_0xfbc3('0x11'));var qs=require(_0xfbc3('0x12'));var as=require(_0xfbc3('0x13'));var hardwareService=require(_0xfbc3('0x14'));var logger=require(_0xfbc3('0x15'))(_0xfbc3('0x16'));var utils=require('../../config/utils');var config=require(_0xfbc3('0x17'));var licenseUtil=require(_0xfbc3('0x18'));var db=require(_0xfbc3('0x19'))['db'];function respondWithStatusCode(_0x435b8d,_0x2fade8){_0x2fade8=_0x2fade8||0xcc;return function(_0xac7adc){if(_0xac7adc){return _0x435b8d['sendStatus'](_0x2fade8);}return _0x435b8d[_0xfbc3('0x1a')](_0x2fade8)['end']();};}function respondWithResult(_0x1ab118,_0x2ee980){_0x2ee980=_0x2ee980||0xc8;return function(_0x591c56){if(_0x591c56){return _0x1ab118[_0xfbc3('0x1a')](_0x2ee980)['json'](_0x591c56);}};}function respondWithFilteredResult(_0x3835c1,_0x5abb06){return function(_0x165f08){if(_0x165f08){var _0xf52779=typeof _0x5abb06['offset']==='undefined'&&typeof _0x5abb06['limit']===_0xfbc3('0x1b');var _0x264cc8=_0x165f08[_0xfbc3('0x1c')];var _0x574c83=_0xf52779?0x0:_0x5abb06[_0xfbc3('0x1d')];var _0x5d38a6=_0xf52779?_0x165f08[_0xfbc3('0x1c')]:_0x5abb06[_0xfbc3('0x1d')]+_0x5abb06[_0xfbc3('0x1e')];var _0x389fe4;if(_0x5d38a6>=_0x264cc8){_0x5d38a6=_0x264cc8;_0x389fe4=0xc8;}else{_0x389fe4=0xce;}_0x3835c1['status'](_0x389fe4);return _0x3835c1[_0xfbc3('0x1f')]('Content-Range',_0x574c83+'-'+_0x5d38a6+'/'+_0x264cc8)[_0xfbc3('0x20')](_0x165f08);}return null;};}function patchUpdates(_0x442318){return function(_0x34eba2){try{jsonpatch[_0xfbc3('0x21')](_0x34eba2,_0x442318,!![]);}catch(_0x51a8c5){return BPromise[_0xfbc3('0x22')](_0x51a8c5);}return _0x34eba2[_0xfbc3('0x23')]();};}function saveUpdates(_0x34a28a,_0x1044c6){return function(_0x362256){if(_0x362256){return _0x362256[_0xfbc3('0x24')](_0x34a28a)[_0xfbc3('0x25')](function(_0x238ebe){return _0x238ebe;});}return null;};}function removeEntity(_0x3f2611,_0x2eead9){return function(_0x44d433){if(_0x44d433){return _0x44d433['destroy']()['then'](function(){var _0x1139af=_0x44d433[_0xfbc3('0x26')]({'plain':!![]});var _0x12f264=_0xfbc3('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x12f264,'resourceId':_0x1139af['id']}})['then'](function(){return _0x44d433;});})[_0xfbc3('0x25')](function(){_0x3f2611[_0xfbc3('0x1a')](0xcc)[_0xfbc3('0x28')]();});}};}function handleEntityNotFound(_0x566542,_0x301d74){return function(_0x43a383){if(!_0x43a383){_0x566542[_0xfbc3('0x29')](0x194);}return _0x43a383;};}function handleError(_0x415b5f,_0x25114a){_0x25114a=_0x25114a||0x1f4;return function(_0x2d0fde){logger['error'](_0x2d0fde[_0xfbc3('0x2a')]);if(_0x2d0fde[_0xfbc3('0x2b')]){delete _0x2d0fde['name'];}_0x415b5f['status'](_0x25114a)[_0xfbc3('0x2c')](_0x2d0fde);};}exports[_0xfbc3('0x2d')]=function(_0x205bfc,_0x5e7c4a){var _0x377971={},_0x31236b={},_0x2fa5a5={'count':0x0,'rows':[]};var _0x8ac342=_[_0xfbc3('0x2e')](db[_0xfbc3('0x2f')][_0xfbc3('0x30')],function(_0x5714ca){return{'name':_0x5714ca[_0xfbc3('0x31')],'type':_0x5714ca[_0xfbc3('0x32')][_0xfbc3('0x33')]};});_0x31236b[_0xfbc3('0x34')]=_[_0xfbc3('0x2e')](_0x8ac342,_0xfbc3('0x2b'));_0x31236b[_0xfbc3('0x35')]=_['keys'](_0x205bfc[_0xfbc3('0x35')]);_0x31236b[_0xfbc3('0x36')]=_['intersection'](_0x31236b[_0xfbc3('0x34')],_0x31236b[_0xfbc3('0x35')]);_0x377971['attributes']=_['intersection'](_0x31236b[_0xfbc3('0x34')],qs[_0xfbc3('0x37')](_0x205bfc[_0xfbc3('0x35')][_0xfbc3('0x37')]));_0x377971[_0xfbc3('0x38')]=_0x377971[_0xfbc3('0x38')]['length']?_0x377971[_0xfbc3('0x38')]:_0x31236b[_0xfbc3('0x34')];if(!_0x205bfc[_0xfbc3('0x35')]['hasOwnProperty'](_0xfbc3('0x39'))){_0x377971[_0xfbc3('0x1e')]=qs[_0xfbc3('0x1e')](_0x205bfc[_0xfbc3('0x35')][_0xfbc3('0x1e')]);_0x377971['offset']=qs[_0xfbc3('0x1d')](_0x205bfc[_0xfbc3('0x35')][_0xfbc3('0x1d')]);}_0x377971[_0xfbc3('0x3a')]=qs[_0xfbc3('0x3b')](_0x205bfc[_0xfbc3('0x35')]['sort']);_0x377971[_0xfbc3('0x3c')]=qs[_0xfbc3('0x36')](_['pick'](_0x205bfc['query'],_0x31236b[_0xfbc3('0x36')]),_0x8ac342);if(_0x205bfc['query']['filter']){_0x377971[_0xfbc3('0x3c')]=_['merge'](_0x377971[_0xfbc3('0x3c')],{'$or':_[_0xfbc3('0x2e')](_0x8ac342,function(_0x49102e){if(_0x49102e[_0xfbc3('0x32')]!=='VIRTUAL'){var _0x530e7e={};_0x530e7e[_0x49102e[_0xfbc3('0x2b')]]={'$like':'%'+_0x205bfc[_0xfbc3('0x35')][_0xfbc3('0x3d')]+'%'};return _0x530e7e;}})});}_0x377971=_['merge']({},_0x377971,_0x205bfc[_0xfbc3('0x3e')]);var _0x1b44de={'where':_0x377971['where']};return db[_0xfbc3('0x2f')][_0xfbc3('0x1c')](_0x1b44de)[_0xfbc3('0x25')](function(_0x3d208d){_0x2fa5a5[_0xfbc3('0x1c')]=_0x3d208d;if(_0x205bfc['query']['includeAll']){_0x377971['include']=[{'all':!![]}];}return db['Sound'][_0xfbc3('0x3f')](_0x377971);})[_0xfbc3('0x25')](function(_0x161389){_0x2fa5a5[_0xfbc3('0x40')]=_0x161389;return _0x2fa5a5;})['then'](respondWithFilteredResult(_0x5e7c4a,_0x377971))[_0xfbc3('0x41')](handleError(_0x5e7c4a,null));};exports[_0xfbc3('0x42')]=function(_0x1cd56c,_0x4d3960){var _0x2dcc27={'raw':!![],'where':{'id':_0x1cd56c[_0xfbc3('0x43')]['id']}},_0x4c32ad={};_0x4c32ad[_0xfbc3('0x34')]=_['keys'](db['Sound'][_0xfbc3('0x30')]);_0x4c32ad[_0xfbc3('0x35')]=_['keys'](_0x1cd56c[_0xfbc3('0x35')]);_0x4c32ad[_0xfbc3('0x36')]=_['intersection'](_0x4c32ad['model'],_0x4c32ad[_0xfbc3('0x35')]);_0x2dcc27['attributes']=_[_0xfbc3('0x44')](_0x4c32ad[_0xfbc3('0x34')],qs[_0xfbc3('0x37')](_0x1cd56c[_0xfbc3('0x35')][_0xfbc3('0x37')]));_0x2dcc27['attributes']=_0x2dcc27[_0xfbc3('0x38')][_0xfbc3('0x45')]?_0x2dcc27[_0xfbc3('0x38')]:_0x4c32ad[_0xfbc3('0x34')];if(_0x1cd56c[_0xfbc3('0x35')]['includeAll']){_0x2dcc27[_0xfbc3('0x46')]=[{'all':!![]}];}_0x2dcc27=_['merge']({},_0x2dcc27,_0x1cd56c['options']);return db['Sound']['find'](_0x2dcc27)[_0xfbc3('0x25')](handleEntityNotFound(_0x4d3960,null))[_0xfbc3('0x25')](respondWithResult(_0x4d3960,null))[_0xfbc3('0x41')](handleError(_0x4d3960,null));};exports['download']=function(_0x2cdcf7,_0x26ef43,_0x2d6a68){return db['Sound']['find']({'where':{'id':_0x2cdcf7[_0xfbc3('0x43')]['id']},'attributes':[_0xfbc3('0x2b'),_0xfbc3('0x47'),_0xfbc3('0x48')],'raw':!![]})[_0xfbc3('0x25')](handleEntityNotFound(_0x26ef43,null))[_0xfbc3('0x25')](function(_0xceb5dd){if(_0xceb5dd){if(!fs[_0xfbc3('0x49')](path[_0xfbc3('0x4a')](config['root'],_0xfbc3('0x4b'),_0xceb5dd[_0xfbc3('0x47')]+'.'+_0xceb5dd['converted_format']))){throw new db[(_0xfbc3('0x4c'))][(_0xfbc3('0x4d'))](_0xfbc3('0x4e'));}return _0x26ef43[_0xfbc3('0x4f')](path[_0xfbc3('0x4a')](config[_0xfbc3('0x50')],_0xfbc3('0x4b'),util[_0xfbc3('0x51')](_0xfbc3('0x52'),_0xceb5dd[_0xfbc3('0x47')],_0xceb5dd['converted_format'])),util[_0xfbc3('0x51')](_0xfbc3('0x52'),_0xceb5dd[_0xfbc3('0x2b')],_0xceb5dd[_0xfbc3('0x48')]));}return null;})[_0xfbc3('0x41')](handleError(_0x26ef43,null));};exports[_0xfbc3('0x53')]=function(_0x50ab46,_0xbb0999,_0x200b01){var _0x415dcf={'name':path[_0xfbc3('0x54')](_0x50ab46[_0xfbc3('0x55')][_0xfbc3('0x56')],path[_0xfbc3('0x57')](_0x50ab46[_0xfbc3('0x55')][_0xfbc3('0x56')])),'save_name':path['basename'](_0x50ab46[_0xfbc3('0x55')][_0xfbc3('0x58')],path['extname'](_0x50ab46[_0xfbc3('0x55')]['filename'])),'original_format':path[_0xfbc3('0x57')](_0x50ab46['file'][_0xfbc3('0x56')])[_0xfbc3('0x59')](0x1),'converted_format':'wav'};var _0x214ca1=path[_0xfbc3('0x4a')](config[_0xfbc3('0x50')],'server/files/sounds/original',_0x50ab46['file'][_0xfbc3('0x58')]);var _0x3bb900=path[_0xfbc3('0x4a')](config[_0xfbc3('0x50')],_0xfbc3('0x4b'),util['format'](_0xfbc3('0x52'),path['basename'](_0x50ab46[_0xfbc3('0x55')]['filename'],path[_0xfbc3('0x57')](_0x50ab46[_0xfbc3('0x55')][_0xfbc3('0x58')])),_0x415dcf[_0xfbc3('0x48')]));logger[_0xfbc3('0x5a')]('Sound\x20upload\x20filepath:\x20%s',_0x214ca1);logger['info'](_0xfbc3('0x5b'),_0x3bb900);try{fs['chmodSync'](_0x214ca1,parseInt(_0xfbc3('0x5c'),0x8));var _0x36db63=sox[_0xfbc3('0x5d')](_0x214ca1,_0x3bb900,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x36db63['on'](_0xfbc3('0x5e'),function(_0x2015ba){fs[_0xfbc3('0x5f')](_0x214ca1);_0xbb0999[_0xfbc3('0x1a')](0x1f4)[_0xfbc3('0x2c')](_0x2015ba);});_0x36db63['on'](_0xfbc3('0x60'),function(_0x3700d0){_0x415dcf[_0xfbc3('0x61')]=isNaN(_0x3700d0[_0xfbc3('0x62')])?null:_0x3700d0[_0xfbc3('0x62')]*0x3e8;_0x415dcf[_0xfbc3('0x63')]=isNaN(_0x3700d0[_0xfbc3('0x64')])?null:_0x3700d0[_0xfbc3('0x64')];_0x415dcf[_0xfbc3('0x65')]=isNaN(_0x3700d0['channelCount'])?null:_0x3700d0[_0xfbc3('0x66')];_0x415dcf[_0xfbc3('0x67')]=isNaN(_0x3700d0[_0xfbc3('0x68')])?null:_0x3700d0['bitRate'];_0x415dcf[_0xfbc3('0x69')]=isNaN(_0x3700d0[_0xfbc3('0x6a')])?null:_0x3700d0['sampleRate'];});_0x36db63['on'](_0xfbc3('0x6b'),function(_0x2673c9){_0x415dcf['converted_duration']=isNaN(_0x2673c9[_0xfbc3('0x62')])?null:_0x2673c9[_0xfbc3('0x62')]*0x3e8;_0x415dcf[_0xfbc3('0x6c')]=isNaN(_0x2673c9[_0xfbc3('0x64')])?null:_0x2673c9[_0xfbc3('0x64')];_0x415dcf['converted_channelCount']=isNaN(_0x2673c9['channelCount'])?null:_0x2673c9['channelCount'];_0x415dcf[_0xfbc3('0x6d')]=isNaN(_0x2673c9[_0xfbc3('0x68')])?null:_0x2673c9[_0xfbc3('0x68')];_0x415dcf[_0xfbc3('0x6e')]=isNaN(_0x2673c9[_0xfbc3('0x6a')])?null:_0x2673c9[_0xfbc3('0x6a')];});_0x36db63['on'](_0xfbc3('0x28'),function(){fs[_0xfbc3('0x6f')](_0x3bb900,parseInt('0777',0x8));return db[_0xfbc3('0x2f')][_0xfbc3('0x53')](_0x415dcf)[_0xfbc3('0x25')](function(_0x258b54){var _0x37870d={'role':_0x50ab46[_0xfbc3('0x70')][_0xfbc3('0x71')],'userProfileId':_0x50ab46[_0xfbc3('0x70')][_0xfbc3('0x72')]};if(!_0x37870d)throw new Error(_0xfbc3('0x73'));if(_0x37870d[_0xfbc3('0x71')]===_0xfbc3('0x74')){var _0x3fe6e5=_0x258b54[_0xfbc3('0x26')]({'plain':!![]});return db[_0xfbc3('0x75')][_0xfbc3('0x76')]({'where':{'name':_0xfbc3('0x27'),'userProfileId':_0x37870d[_0xfbc3('0x72')]},'raw':!![]})[_0xfbc3('0x25')](function(_0x17bc2d){if(_0x17bc2d&&_0x17bc2d['autoAssociation']===0x0){return db[_0xfbc3('0x77')][_0xfbc3('0x53')]({'name':_0x3fe6e5[_0xfbc3('0x2b')],'resourceId':_0x3fe6e5['id'],'type':_0x17bc2d[_0xfbc3('0x2b')],'sectionId':_0x17bc2d['id']},{})[_0xfbc3('0x25')](function(){return _0x258b54;});}else{return _0x258b54;}})[_0xfbc3('0x41')](function(_0x4870e1){logger[_0xfbc3('0x5e')](_0xfbc3('0x78'),_0x4870e1);throw _0x4870e1;});}return _0x258b54;})[_0xfbc3('0x25')](respondWithResult(_0xbb0999,null))[_0xfbc3('0x41')](handleError(_0xbb0999,null));});_0x36db63[_0xfbc3('0x79')]();}catch(_0x1b69d8){_0xbb0999['status'](0x1f4)['send'](_0x1b69d8);}};exports['update']=function(_0x53cb7f,_0x4689e4,_0x2773ff){return db[_0xfbc3('0x2f')]['find']({'where':{'id':_0x53cb7f[_0xfbc3('0x43')]['id']}})[_0xfbc3('0x25')](handleEntityNotFound(_0x4689e4,null))['then'](saveUpdates(_[_0xfbc3('0x7a')](_0x53cb7f[_0xfbc3('0x70')],[_0xfbc3('0x2b'),_0xfbc3('0x7b')]),null))[_0xfbc3('0x25')](respondWithResult(_0x4689e4,null))['catch'](handleError(_0x4689e4,null));};exports[_0xfbc3('0x7c')]=function(_0x220d71,_0x25d98a,_0x10e64f){return db[_0xfbc3('0x2f')][_0xfbc3('0x76')]({'where':{'id':_0x220d71[_0xfbc3('0x43')]['id']}})[_0xfbc3('0x25')](function(_0x24d7f2){if(_0x24d7f2){return _0x24d7f2['destroy']();}})[_0xfbc3('0x25')](function(_0x4b76cf){var _0x2c684f=path[_0xfbc3('0x4a')](config[_0xfbc3('0x50')],_0xfbc3('0x7d'),util[_0xfbc3('0x51')](_0xfbc3('0x52'),_0x4b76cf[_0xfbc3('0x47')],_0x4b76cf[_0xfbc3('0x7e')]));var _0x5dd1c9=path[_0xfbc3('0x4a')](config['root'],_0xfbc3('0x4b'),util[_0xfbc3('0x51')](_0xfbc3('0x52'),_0x4b76cf[_0xfbc3('0x47')],_0x4b76cf[_0xfbc3('0x48')]));fs['unlinkSync'](_0x2c684f);fs[_0xfbc3('0x5f')](_0x5dd1c9);return _0x4b76cf;})[_0xfbc3('0x25')](function(_0x4765dc){if(_0x4765dc){return _0x25d98a[_0xfbc3('0x1a')](0xcc)[_0xfbc3('0x28')]();}})[_0xfbc3('0x25')](handleEntityNotFound(_0x25d98a,null))['catch'](handleError(_0x25d98a,null));}; \ No newline at end of file +var _0x58d5=['converted_sampleRate','body','role','userProfileId','user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','original_format','eml-format','zip-dir','fast-json-patch','request-promise','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','index','Sound','rawAttributes','fieldName','type','map','keys','filters','intersection','model','query','attributes','fields','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','params','length','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','format','catch','create','basename','file','originalname','filename','extname','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','send','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_bitRate'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x58d5,0x8d));var _0x558d=function(_0x1c1c52,_0x33abfa){_0x1c1c52=_0x1c1c52-0x0;var _0x236178=_0x58d5[_0x1c1c52];return _0x236178;};'use strict';var emlformat=require(_0x558d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x558d('0x1'));var jsonpatch=require(_0x558d('0x2'));var rp=require(_0x558d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x558d('0x4'));var sox=require('sox');var csv=require(_0x558d('0x5'));var ejs=require(_0x558d('0x6'));var fs=require('fs');var fs_extra=require(_0x558d('0x7'));var _=require(_0x558d('0x8'));var squel=require(_0x558d('0x9'));var crypto=require(_0x558d('0xa'));var jsforce=require(_0x558d('0xb'));var deskjs=require(_0x558d('0xc'));var toCsv=require(_0x558d('0x5'));var querystring=require(_0x558d('0xd'));var Papa=require('papaparse');var Redis=require(_0x558d('0xe'));var authService=require(_0x558d('0xf'));var qs=require(_0x558d('0x10'));var as=require(_0x558d('0x11'));var hardwareService=require(_0x558d('0x12'));var logger=require(_0x558d('0x13'))(_0x558d('0x14'));var utils=require(_0x558d('0x15'));var config=require(_0x558d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x558d('0x17'))['db'];function respondWithStatusCode(_0x51644c,_0x4b4a6b){_0x4b4a6b=_0x4b4a6b||0xcc;return function(_0x1104e1){if(_0x1104e1){return _0x51644c[_0x558d('0x18')](_0x4b4a6b);}return _0x51644c[_0x558d('0x19')](_0x4b4a6b)[_0x558d('0x1a')]();};}function respondWithResult(_0x42a91a,_0x4e0051){_0x4e0051=_0x4e0051||0xc8;return function(_0x5cf9e5){if(_0x5cf9e5){return _0x42a91a[_0x558d('0x19')](_0x4e0051)['json'](_0x5cf9e5);}};}function respondWithFilteredResult(_0x2a8644,_0x2e75a0){return function(_0x184656){if(_0x184656){var _0x12cfc8=typeof _0x2e75a0[_0x558d('0x1b')]===_0x558d('0x1c')&&typeof _0x2e75a0[_0x558d('0x1d')]===_0x558d('0x1c');var _0xeababd=_0x184656[_0x558d('0x1e')];var _0x4bf275=_0x12cfc8?0x0:_0x2e75a0[_0x558d('0x1b')];var _0x2d5bc0=_0x12cfc8?_0x184656[_0x558d('0x1e')]:_0x2e75a0[_0x558d('0x1b')]+_0x2e75a0[_0x558d('0x1d')];var _0x146842;if(_0x2d5bc0>=_0xeababd){_0x2d5bc0=_0xeababd;_0x146842=0xc8;}else{_0x146842=0xce;}_0x2a8644[_0x558d('0x19')](_0x146842);return _0x2a8644[_0x558d('0x1f')]('Content-Range',_0x4bf275+'-'+_0x2d5bc0+'/'+_0xeababd)[_0x558d('0x20')](_0x184656);}return null;};}function patchUpdates(_0x4de2cb){return function(_0x288595){try{jsonpatch[_0x558d('0x21')](_0x288595,_0x4de2cb,!![]);}catch(_0x493b05){return BPromise[_0x558d('0x22')](_0x493b05);}return _0x288595['save']();};}function saveUpdates(_0x1915fd,_0x3929c8){return function(_0x5ac20d){if(_0x5ac20d){return _0x5ac20d[_0x558d('0x23')](_0x1915fd)[_0x558d('0x24')](function(_0xa61954){return _0xa61954;});}return null;};}function removeEntity(_0xf54d76,_0x5f4327){return function(_0x111021){if(_0x111021){return _0x111021[_0x558d('0x25')]()[_0x558d('0x24')](function(){var _0x2b4acc=_0x111021[_0x558d('0x26')]({'plain':!![]});var _0x3be533='Sounds';return db[_0x558d('0x27')][_0x558d('0x25')]({'where':{'type':_0x3be533,'resourceId':_0x2b4acc['id']}})['then'](function(){return _0x111021;});})[_0x558d('0x24')](function(){_0xf54d76['status'](0xcc)[_0x558d('0x1a')]();});}};}function handleEntityNotFound(_0x14bae8,_0x545ada){return function(_0x14fcb9){if(!_0x14fcb9){_0x14bae8[_0x558d('0x18')](0x194);}return _0x14fcb9;};}function handleError(_0x4df31b,_0x11ab8c){_0x11ab8c=_0x11ab8c||0x1f4;return function(_0x409871){logger[_0x558d('0x28')](_0x409871[_0x558d('0x29')]);if(_0x409871['name']){delete _0x409871[_0x558d('0x2a')];}_0x4df31b[_0x558d('0x19')](_0x11ab8c)['send'](_0x409871);};}exports[_0x558d('0x2b')]=function(_0x1582de,_0xd513fe){var _0x569c02={},_0xe6b7a2={},_0x484e23={'count':0x0,'rows':[]};var _0x52637e=_['map'](db[_0x558d('0x2c')][_0x558d('0x2d')],function(_0x367cfb){return{'name':_0x367cfb[_0x558d('0x2e')],'type':_0x367cfb[_0x558d('0x2f')]['key']};});_0xe6b7a2['model']=_[_0x558d('0x30')](_0x52637e,_0x558d('0x2a'));_0xe6b7a2['query']=_[_0x558d('0x31')](_0x1582de['query']);_0xe6b7a2[_0x558d('0x32')]=_[_0x558d('0x33')](_0xe6b7a2[_0x558d('0x34')],_0xe6b7a2[_0x558d('0x35')]);_0x569c02[_0x558d('0x36')]=_[_0x558d('0x33')](_0xe6b7a2[_0x558d('0x34')],qs['fields'](_0x1582de[_0x558d('0x35')][_0x558d('0x37')]));_0x569c02[_0x558d('0x36')]=_0x569c02[_0x558d('0x36')]['length']?_0x569c02[_0x558d('0x36')]:_0xe6b7a2[_0x558d('0x34')];if(!_0x1582de['query']['hasOwnProperty'](_0x558d('0x38'))){_0x569c02[_0x558d('0x1d')]=qs[_0x558d('0x1d')](_0x1582de[_0x558d('0x35')]['limit']);_0x569c02[_0x558d('0x1b')]=qs[_0x558d('0x1b')](_0x1582de[_0x558d('0x35')][_0x558d('0x1b')]);}_0x569c02[_0x558d('0x39')]=qs[_0x558d('0x3a')](_0x1582de[_0x558d('0x35')]['sort']);_0x569c02[_0x558d('0x3b')]=qs[_0x558d('0x32')](_['pick'](_0x1582de[_0x558d('0x35')],_0xe6b7a2[_0x558d('0x32')]),_0x52637e);if(_0x1582de[_0x558d('0x35')][_0x558d('0x3c')]){_0x569c02[_0x558d('0x3b')]=_['merge'](_0x569c02[_0x558d('0x3b')],{'$or':_['map'](_0x52637e,function(_0x1171d8){if(_0x1171d8[_0x558d('0x2f')]!==_0x558d('0x3d')){var _0x3c5bfb={};_0x3c5bfb[_0x1171d8[_0x558d('0x2a')]]={'$like':'%'+_0x1582de[_0x558d('0x35')][_0x558d('0x3c')]+'%'};return _0x3c5bfb;}})});}_0x569c02=_[_0x558d('0x3e')]({},_0x569c02,_0x1582de[_0x558d('0x3f')]);var _0x149b05={'where':_0x569c02[_0x558d('0x3b')]};return db[_0x558d('0x2c')][_0x558d('0x1e')](_0x149b05)[_0x558d('0x24')](function(_0xc7b81e){_0x484e23[_0x558d('0x1e')]=_0xc7b81e;if(_0x1582de[_0x558d('0x35')]['includeAll']){_0x569c02[_0x558d('0x40')]=[{'all':!![]}];}return db[_0x558d('0x2c')][_0x558d('0x41')](_0x569c02);})['then'](function(_0xb14871){_0x484e23[_0x558d('0x42')]=_0xb14871;return _0x484e23;})[_0x558d('0x24')](respondWithFilteredResult(_0xd513fe,_0x569c02))['catch'](handleError(_0xd513fe,null));};exports['show']=function(_0x270cc4,_0x39efe4){var _0xdac21f={'raw':!![],'where':{'id':_0x270cc4[_0x558d('0x43')]['id']}},_0xca97df={};_0xca97df['model']=_[_0x558d('0x31')](db[_0x558d('0x2c')][_0x558d('0x2d')]);_0xca97df[_0x558d('0x35')]=_[_0x558d('0x31')](_0x270cc4[_0x558d('0x35')]);_0xca97df['filters']=_[_0x558d('0x33')](_0xca97df[_0x558d('0x34')],_0xca97df[_0x558d('0x35')]);_0xdac21f[_0x558d('0x36')]=_['intersection'](_0xca97df[_0x558d('0x34')],qs[_0x558d('0x37')](_0x270cc4[_0x558d('0x35')][_0x558d('0x37')]));_0xdac21f[_0x558d('0x36')]=_0xdac21f[_0x558d('0x36')][_0x558d('0x44')]?_0xdac21f[_0x558d('0x36')]:_0xca97df[_0x558d('0x34')];if(_0x270cc4[_0x558d('0x35')]['includeAll']){_0xdac21f[_0x558d('0x40')]=[{'all':!![]}];}_0xdac21f=_[_0x558d('0x3e')]({},_0xdac21f,_0x270cc4[_0x558d('0x3f')]);return db[_0x558d('0x2c')][_0x558d('0x45')](_0xdac21f)[_0x558d('0x24')](handleEntityNotFound(_0x39efe4,null))[_0x558d('0x24')](respondWithResult(_0x39efe4,null))['catch'](handleError(_0x39efe4,null));};exports[_0x558d('0x46')]=function(_0x5e3e5e,_0x31aec3,_0x5d87c3){return db[_0x558d('0x2c')][_0x558d('0x45')]({'where':{'id':_0x5e3e5e[_0x558d('0x43')]['id']},'attributes':['name',_0x558d('0x47'),_0x558d('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x31aec3,null))[_0x558d('0x24')](function(_0x281243){if(_0x281243){if(!fs[_0x558d('0x49')](path[_0x558d('0x4a')](config[_0x558d('0x4b')],_0x558d('0x4c'),_0x281243[_0x558d('0x47')]+'.'+_0x281243['converted_format']))){throw new db[(_0x558d('0x4d'))][(_0x558d('0x4e'))](_0x558d('0x4f'));}return _0x31aec3[_0x558d('0x46')](path['join'](config[_0x558d('0x4b')],_0x558d('0x4c'),util['format'](_0x558d('0x50'),_0x281243['save_name'],_0x281243[_0x558d('0x48')])),util[_0x558d('0x51')](_0x558d('0x50'),_0x281243[_0x558d('0x2a')],_0x281243[_0x558d('0x48')]));}return null;})[_0x558d('0x52')](handleError(_0x31aec3,null));};exports[_0x558d('0x53')]=function(_0x2e946d,_0x1f4e24,_0x50782d){var _0x3ce298={'name':path[_0x558d('0x54')](_0x2e946d[_0x558d('0x55')][_0x558d('0x56')],path['extname'](_0x2e946d[_0x558d('0x55')][_0x558d('0x56')])),'save_name':path['basename'](_0x2e946d[_0x558d('0x55')][_0x558d('0x57')],path[_0x558d('0x58')](_0x2e946d['file']['filename'])),'original_format':path['extname'](_0x2e946d['file']['originalname'])[_0x558d('0x59')](0x1),'converted_format':_0x558d('0x5a')};var _0x179740=path[_0x558d('0x4a')](config[_0x558d('0x4b')],_0x558d('0x5b'),_0x2e946d['file'][_0x558d('0x57')]);var _0x116995=path['join'](config[_0x558d('0x4b')],'server/files/sounds/converted',util['format']('%s.%s',path[_0x558d('0x54')](_0x2e946d['file']['filename'],path[_0x558d('0x58')](_0x2e946d[_0x558d('0x55')][_0x558d('0x57')])),_0x3ce298[_0x558d('0x48')]));logger[_0x558d('0x5c')](_0x558d('0x5d'),_0x179740);logger[_0x558d('0x5c')](_0x558d('0x5e'),_0x116995);try{fs[_0x558d('0x5f')](_0x179740,parseInt(_0x558d('0x60'),0x8));var _0x5bd330=sox[_0x558d('0x61')](_0x179740,_0x116995,{'sampleRate':0x1f40,'format':_0x558d('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5bd330['on'](_0x558d('0x28'),function(_0x32850d){fs[_0x558d('0x62')](_0x179740);_0x1f4e24[_0x558d('0x19')](0x1f4)[_0x558d('0x63')](_0x32850d);});_0x5bd330['on'](_0x558d('0x64'),function(_0x3b3919){_0x3ce298[_0x558d('0x65')]=isNaN(_0x3b3919[_0x558d('0x66')])?null:_0x3b3919[_0x558d('0x66')]*0x3e8;_0x3ce298[_0x558d('0x67')]=isNaN(_0x3b3919[_0x558d('0x68')])?null:_0x3b3919[_0x558d('0x68')];_0x3ce298[_0x558d('0x69')]=isNaN(_0x3b3919[_0x558d('0x6a')])?null:_0x3b3919[_0x558d('0x6a')];_0x3ce298['original_bitRate']=isNaN(_0x3b3919[_0x558d('0x6b')])?null:_0x3b3919[_0x558d('0x6b')];_0x3ce298[_0x558d('0x6c')]=isNaN(_0x3b3919[_0x558d('0x6d')])?null:_0x3b3919[_0x558d('0x6d')];});_0x5bd330['on'](_0x558d('0x6e'),function(_0x3752c2){_0x3ce298[_0x558d('0x6f')]=isNaN(_0x3752c2[_0x558d('0x66')])?null:_0x3752c2[_0x558d('0x66')]*0x3e8;_0x3ce298['converted_sampleCount']=isNaN(_0x3752c2[_0x558d('0x68')])?null:_0x3752c2[_0x558d('0x68')];_0x3ce298['converted_channelCount']=isNaN(_0x3752c2[_0x558d('0x6a')])?null:_0x3752c2[_0x558d('0x6a')];_0x3ce298[_0x558d('0x70')]=isNaN(_0x3752c2[_0x558d('0x6b')])?null:_0x3752c2[_0x558d('0x6b')];_0x3ce298[_0x558d('0x71')]=isNaN(_0x3752c2[_0x558d('0x6d')])?null:_0x3752c2[_0x558d('0x6d')];});_0x5bd330['on'](_0x558d('0x1a'),function(){fs[_0x558d('0x5f')](_0x116995,parseInt(_0x558d('0x60'),0x8));return db[_0x558d('0x2c')]['create'](_0x3ce298)[_0x558d('0x24')](function(_0x55fd36){var _0x444b27={'role':_0x2e946d[_0x558d('0x72')][_0x558d('0x73')],'userProfileId':_0x2e946d[_0x558d('0x72')][_0x558d('0x74')]};if(!_0x444b27)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x444b27['role']===_0x558d('0x75')){var _0x264c46=_0x55fd36[_0x558d('0x26')]({'plain':!![]});return db[_0x558d('0x76')][_0x558d('0x45')]({'where':{'name':_0x558d('0x77'),'userProfileId':_0x444b27[_0x558d('0x74')]},'raw':!![]})['then'](function(_0x34d734){if(_0x34d734&&_0x34d734[_0x558d('0x78')]===0x0){return db['UserProfileResource'][_0x558d('0x53')]({'name':_0x264c46[_0x558d('0x2a')],'resourceId':_0x264c46['id'],'type':_0x34d734['name'],'sectionId':_0x34d734['id']},{})[_0x558d('0x24')](function(){return _0x55fd36;});}else{return _0x55fd36;}})['catch'](function(_0x3cd23e){logger['error'](_0x558d('0x79'),_0x3cd23e);throw _0x3cd23e;});}return _0x55fd36;})[_0x558d('0x24')](respondWithResult(_0x1f4e24,null))[_0x558d('0x52')](handleError(_0x1f4e24,null));});_0x5bd330[_0x558d('0x7a')]();}catch(_0x2f50c4){_0x1f4e24['status'](0x1f4)['send'](_0x2f50c4);}};exports[_0x558d('0x23')]=function(_0x549da1,_0x4e4393,_0x369bb5){return db['Sound']['find']({'where':{'id':_0x549da1[_0x558d('0x43')]['id']}})[_0x558d('0x24')](handleEntityNotFound(_0x4e4393,null))['then'](saveUpdates(_[_0x558d('0x7b')](_0x549da1[_0x558d('0x72')],['name',_0x558d('0x7c')]),null))[_0x558d('0x24')](respondWithResult(_0x4e4393,null))[_0x558d('0x52')](handleError(_0x4e4393,null));};exports[_0x558d('0x7d')]=function(_0x8c1caf,_0xfd9fe9,_0x4cd477){return db[_0x558d('0x2c')][_0x558d('0x45')]({'where':{'id':_0x8c1caf[_0x558d('0x43')]['id']}})[_0x558d('0x24')](function(_0x57ee88){if(_0x57ee88){return _0x57ee88[_0x558d('0x25')]();}})[_0x558d('0x24')](function(_0x495630){var _0x4b6e10=path[_0x558d('0x4a')](config['root'],_0x558d('0x5b'),util[_0x558d('0x51')]('%s.%s',_0x495630[_0x558d('0x47')],_0x495630[_0x558d('0x7e')]));var _0x2e5834=path[_0x558d('0x4a')](config[_0x558d('0x4b')],_0x558d('0x4c'),util['format'](_0x558d('0x50'),_0x495630[_0x558d('0x47')],_0x495630[_0x558d('0x48')]));fs[_0x558d('0x62')](_0x4b6e10);fs[_0x558d('0x62')](_0x2e5834);return _0x495630;})['then'](function(_0x2679f4){if(_0x2679f4){return _0xfd9fe9['status'](0xcc)['end']();}})['then'](handleEntityNotFound(_0xfd9fe9,null))[_0x558d('0x52')](handleError(_0xfd9fe9,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 665435d..566de36 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 _0x9977=['Sound','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes'];(function(_0x38080e,_0x95512d){var _0x4e4c87=function(_0x2be6b3){while(--_0x2be6b3){_0x38080e['push'](_0x38080e['shift']());}};_0x4e4c87(++_0x95512d);}(_0x9977,0x1bc));var _0x7997=function(_0x4fa0ea,_0x2cd534){_0x4fa0ea=_0x4fa0ea-0x0;var _0x51d027=_0x9977[_0x4fa0ea];return _0x51d027;};'use strict';var _=require(_0x7997('0x0'));var util=require(_0x7997('0x1'));var logger=require(_0x7997('0x2'))(_0x7997('0x3'));var moment=require(_0x7997('0x4'));var BPromise=require(_0x7997('0x5'));var rp=require(_0x7997('0x6'));var fs=require('fs');var path=require(_0x7997('0x7'));var rimraf=require(_0x7997('0x8'));var config=require(_0x7997('0x9'));var attributes=require(_0x7997('0xa'));module['exports']=function(_0x585a74,_0x198553){return _0x585a74['define'](_0x7997('0xb'),attributes,{'tableName':_0x7997('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69bb=['exports','define','Sound','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x69bb,0xb7));var _0xb69b=function(_0x2fd5f1,_0x51a172){_0x2fd5f1=_0x2fd5f1-0x0;var _0x5af6f6=_0x69bb[_0x2fd5f1];return _0x5af6f6;};'use strict';var _=require(_0xb69b('0x0'));var util=require('util');var logger=require(_0xb69b('0x1'))(_0xb69b('0x2'));var moment=require(_0xb69b('0x3'));var BPromise=require(_0xb69b('0x4'));var rp=require(_0xb69b('0x5'));var fs=require('fs');var path=require(_0xb69b('0x6'));var rimraf=require(_0xb69b('0x7'));var config=require(_0xb69b('0x8'));var attributes=require('./sound.attributes');module[_0xb69b('0x9')]=function(_0x1fd029,_0x3272fa){return _0x1fd029[_0xb69b('0xa')](_0xb69b('0xb'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 417e398..7af9b64 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 _0x75c1=['map','model','then','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSound','Sound','find','options','raw','where','attributes','include'];(function(_0x533d9f,_0x29483c){var _0xf7edfa=function(_0x586553){while(--_0x586553){_0x533d9f['push'](_0x533d9f['shift']());}};_0xf7edfa(++_0x29483c);}(_0x75c1,0xb7));var _0x175c=function(_0x2232ae,_0x108bd0){_0x2232ae=_0x2232ae-0x0;var _0x57b7af=_0x75c1[_0x2232ae];return _0x57b7af;};'use strict';var _=require('lodash');var util=require(_0x175c('0x0'));var moment=require(_0x175c('0x1'));var BPromise=require('bluebird');var rs=require(_0x175c('0x2'));var fs=require('fs');var Redis=require(_0x175c('0x3'));var db=require(_0x175c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x175c('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x175c('0x6'));var client=jayson[_0x175c('0x7')][_0x175c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b4f0a,_0x3086c8,_0x5997ac){return new BPromise(function(_0x83c926,_0x18cffb){return client['request'](_0x3b4f0a,_0x5997ac)['then'](function(_0x3ee67d){logger[_0x175c('0x9')](_0x175c('0xa'),_0x3086c8,_0x175c('0xb'));logger[_0x175c('0xc')]('Sound,\x20%s,\x20%s,\x20%s',_0x3086c8,_0x175c('0xb'),JSON[_0x175c('0xd')](_0x3ee67d));if(_0x3ee67d['error']){if(_0x3ee67d[_0x175c('0xe')][_0x175c('0xf')]===0x1f4){logger[_0x175c('0xe')](_0x175c('0xa'),_0x3086c8,_0x3ee67d[_0x175c('0xe')][_0x175c('0x10')]);return _0x18cffb(_0x3ee67d[_0x175c('0xe')][_0x175c('0x10')]);}logger[_0x175c('0xe')](_0x175c('0xa'),_0x3086c8,_0x3ee67d['error'][_0x175c('0x10')]);return _0x83c926(_0x3ee67d['error']['message']);}else{logger[_0x175c('0x9')]('Sound,\x20%s,\x20%s',_0x3086c8,_0x175c('0xb'));_0x83c926(_0x3ee67d[_0x175c('0x11')]['message']);}})[_0x175c('0x12')](function(_0xf68a32){logger['error'](_0x175c('0xa'),_0x3086c8,_0xf68a32);_0x18cffb(_0xf68a32);});});}exports[_0x175c('0x13')]=function(_0x5d36fa){var _0x1df584=this;return new Promise(function(_0x13defe,_0x14fa6e){return db[_0x175c('0x14')][_0x175c('0x15')]({'raw':_0x5d36fa[_0x175c('0x16')]?_0x5d36fa[_0x175c('0x16')][_0x175c('0x17')]===undefined?!![]:![]:!![],'where':_0x5d36fa[_0x175c('0x16')]?_0x5d36fa['options'][_0x175c('0x18')]||null:null,'attributes':_0x5d36fa[_0x175c('0x16')]?_0x5d36fa[_0x175c('0x16')][_0x175c('0x19')]||null:null,'include':_0x5d36fa[_0x175c('0x16')]?_0x5d36fa[_0x175c('0x16')][_0x175c('0x1a')]?_[_0x175c('0x1b')](_0x5d36fa[_0x175c('0x16')][_0x175c('0x1a')],function(_0x1e1ca7){return{'model':db[_0x1e1ca7[_0x175c('0x1c')]],'as':_0x1e1ca7['as'],'attributes':_0x1e1ca7[_0x175c('0x19')],'include':_0x1e1ca7['include']?_[_0x175c('0x1b')](_0x1e1ca7[_0x175c('0x1a')],function(_0x30ced6){return{'model':db[_0x30ced6['model']],'as':_0x30ced6['as'],'attributes':_0x30ced6[_0x175c('0x19')],'include':_0x30ced6[_0x175c('0x1a')]?_[_0x175c('0x1b')](_0x30ced6[_0x175c('0x1a')],function(_0xa6c48d){return{'model':db[_0xa6c48d[_0x175c('0x1c')]],'as':_0xa6c48d['as'],'attributes':_0xa6c48d['attributes']};}):[]};}):[]};}):[]:[]})[_0x175c('0x1d')](function(_0x2130d5){logger[_0x175c('0x9')](_0x175c('0x13'),_0x5d36fa);logger['debug']('ShowSound',_0x5d36fa,JSON[_0x175c('0xd')](_0x2130d5));_0x13defe(_0x2130d5);})[_0x175c('0x12')](function(_0x1d2f80){logger[_0x175c('0xe')]('ShowSound',_0x1d2f80[_0x175c('0x10')],_0x5d36fa);_0x14fa6e(_0x1df584[_0x175c('0xe')](0x1f4,_0x1d2f80[_0x175c('0x10')]));});});}; \ No newline at end of file +var _0x06cb=['moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Sound','options','attributes','include','map','model','then','ShowSound','debug','lodash','util'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x06cb,0x1a2));var _0xb06c=function(_0x406c79,_0x390730){_0x406c79=_0x406c79-0x0;var _0x2bb9de=_0x06cb[_0x406c79];return _0x2bb9de;};'use strict';var _=require(_0xb06c('0x0'));var util=require(_0xb06c('0x1'));var moment=require(_0xb06c('0x2'));var BPromise=require('bluebird');var rs=require(_0xb06c('0x3'));var fs=require('fs');var Redis=require(_0xb06c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb06c('0x5'));var logger=require('../../config/logger')(_0xb06c('0x6'));var config=require(_0xb06c('0x7'));var jayson=require(_0xb06c('0x8'));var client=jayson[_0xb06c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5dadce,_0x2bf4ca,_0xa8cc25){return new BPromise(function(_0x1c7e58,_0x63e539){return client[_0xb06c('0xa')](_0x5dadce,_0xa8cc25)['then'](function(_0xd8ef00){logger[_0xb06c('0xb')](_0xb06c('0xc'),_0x2bf4ca,_0xb06c('0xd'));logger['debug'](_0xb06c('0xe'),_0x2bf4ca,_0xb06c('0xd'),JSON[_0xb06c('0xf')](_0xd8ef00));if(_0xd8ef00[_0xb06c('0x10')]){if(_0xd8ef00['error'][_0xb06c('0x11')]===0x1f4){logger[_0xb06c('0x10')](_0xb06c('0xc'),_0x2bf4ca,_0xd8ef00['error']['message']);return _0x63e539(_0xd8ef00[_0xb06c('0x10')][_0xb06c('0x12')]);}logger['error'](_0xb06c('0xc'),_0x2bf4ca,_0xd8ef00[_0xb06c('0x10')][_0xb06c('0x12')]);return _0x1c7e58(_0xd8ef00[_0xb06c('0x10')][_0xb06c('0x12')]);}else{logger[_0xb06c('0xb')](_0xb06c('0xc'),_0x2bf4ca,_0xb06c('0xd'));_0x1c7e58(_0xd8ef00[_0xb06c('0x13')][_0xb06c('0x12')]);}})[_0xb06c('0x14')](function(_0x9cabff){logger[_0xb06c('0x10')]('Sound,\x20%s,\x20%s',_0x2bf4ca,_0x9cabff);_0x63e539(_0x9cabff);});});}exports['ShowSound']=function(_0x148379){var _0x4fe9e4=this;return new Promise(function(_0x418fa0,_0x5a39fc){return db[_0xb06c('0x15')]['find']({'raw':_0x148379[_0xb06c('0x16')]?_0x148379[_0xb06c('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x148379['options']?_0x148379[_0xb06c('0x16')]['where']||null:null,'attributes':_0x148379[_0xb06c('0x16')]?_0x148379[_0xb06c('0x16')][_0xb06c('0x17')]||null:null,'include':_0x148379[_0xb06c('0x16')]?_0x148379[_0xb06c('0x16')][_0xb06c('0x18')]?_[_0xb06c('0x19')](_0x148379[_0xb06c('0x16')][_0xb06c('0x18')],function(_0x1b34c1){return{'model':db[_0x1b34c1[_0xb06c('0x1a')]],'as':_0x1b34c1['as'],'attributes':_0x1b34c1[_0xb06c('0x17')],'include':_0x1b34c1[_0xb06c('0x18')]?_[_0xb06c('0x19')](_0x1b34c1['include'],function(_0x50a2fa){return{'model':db[_0x50a2fa[_0xb06c('0x1a')]],'as':_0x50a2fa['as'],'attributes':_0x50a2fa[_0xb06c('0x17')],'include':_0x50a2fa['include']?_['map'](_0x50a2fa['include'],function(_0x58c150){return{'model':db[_0x58c150[_0xb06c('0x1a')]],'as':_0x58c150['as'],'attributes':_0x58c150[_0xb06c('0x17')]};}):[]};}):[]};}):[]:[]})[_0xb06c('0x1b')](function(_0xc9d29d){logger['info'](_0xb06c('0x1c'),_0x148379);logger[_0xb06c('0x1d')](_0xb06c('0x1c'),_0x148379,JSON[_0xb06c('0xf')](_0xc9d29d));_0x418fa0(_0xc9d29d);})[_0xb06c('0x14')](function(_0x44267d){logger[_0xb06c('0x10')]('ShowSound',_0x44267d[_0xb06c('0x12')],_0x148379);_0x5a39fc(_0x4fe9e4[_0xb06c('0x10')](0x1f4,_0x44267d[_0xb06c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 7082bca..6ec2ea8 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 _0xac4a=['express','Router','../../components/interaction/service','../../config/environment','./squareMessage.controller','isAuthenticated','get','show','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3a7134,_0x3f0041){var _0x181716=function(_0x252c82){while(--_0x252c82){_0x3a7134['push'](_0x3a7134['shift']());}};_0x181716(++_0x3f0041);}(_0xac4a,0x13f));var _0xaac4=function(_0x1ed4bb,_0x4bfe24){_0x1ed4bb=_0x1ed4bb-0x0;var _0x22c536=_0xac4a[_0x1ed4bb];return _0x22c536;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router['put'](_0xaac4('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xaac4('0xe')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);module[_0xaac4('0x10')]=router; \ No newline at end of file +var _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x1aa335,_0x13a0c0){var _0x2c63f9=function(_0x393433){while(--_0x393433){_0x1aa335['push'](_0x1aa335['shift']());}};_0x2c63f9(++_0x13a0c0);}(_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('./squareMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 9c7e642..0847714 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 _0x4b18=['exports','STRING','TEXT','ENUM','out'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x4b18,0x1b3));var _0x84b1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4b18[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x84b1('0x0')]={'uniqueid':{'type':Sequelize[_0x84b1('0x1')]},'body':{'type':Sequelize[_0x84b1('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x84b1('0x3')]('in',_0x84b1('0x4')),'defaultValue':_0x84b1('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x84b1('0x1')]},'providerResponse':{'type':Sequelize[_0x84b1('0x2')]}}; \ No newline at end of file +var _0x098b=['sequelize','STRING','TEXT','medium','ENUM','out'];(function(_0x573114,_0x12b35e){var _0x142aa0=function(_0x276dee){while(--_0x276dee){_0x573114['push'](_0x573114['shift']());}};_0x142aa0(++_0x12b35e);}(_0x098b,0x174));var _0xb098=function(_0x4bfdb1,_0x562289){_0x4bfdb1=_0x4bfdb1-0x0;var _0x543a08=_0x098b[_0x4bfdb1];return _0x543a08;};'use strict';var Sequelize=require(_0xb098('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xb098('0x1')]},'body':{'type':Sequelize[_0xb098('0x2')](_0xb098('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xb098('0x4')]('in','out'),'defaultValue':_0xb098('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xb098('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 4901f32..8de6bf5 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 _0x757c=['set','reject','save','update','then','destroy','end','stack','name','index','SquareMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count'];(function(_0x219014,_0x210a34){var _0x1fef85=function(_0x2f76aa){while(--_0x2f76aa){_0x219014['push'](_0x219014['shift']());}};_0x1fef85(++_0x210a34);}(_0x757c,0x191));var _0xc757=function(_0x4e37f1,_0x56dd30){_0x4e37f1=_0x4e37f1-0x0;var _0x5a8cac=_0x757c[_0x4e37f1];return _0x5a8cac;};'use strict';var emlformat=require(_0xc757('0x0'));var rimraf=require(_0xc757('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc757('0x2'));var rp=require(_0xc757('0x3'));var moment=require(_0xc757('0x4'));var BPromise=require(_0xc757('0x5'));var Mustache=require(_0xc757('0x6'));var util=require(_0xc757('0x7'));var path=require(_0xc757('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc757('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc757('0xa'));var squel=require(_0xc757('0xb'));var crypto=require(_0xc757('0xc'));var jsforce=require(_0xc757('0xd'));var deskjs=require(_0xc757('0xe'));var toCsv=require(_0xc757('0xf'));var querystring=require(_0xc757('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc757('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc757('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc757('0x13'))('api');var utils=require(_0xc757('0x14'));var config=require(_0xc757('0x15'));var licenseUtil=require(_0xc757('0x16'));var db=require(_0xc757('0x17'))['db'];function respondWithStatusCode(_0x11f599,_0x5db141){_0x5db141=_0x5db141||0xcc;return function(_0x193a20){if(_0x193a20){return _0x11f599[_0xc757('0x18')](_0x5db141);}return _0x11f599[_0xc757('0x19')](_0x5db141)['end']();};}function respondWithResult(_0x5ebdc2,_0x42da8b){_0x42da8b=_0x42da8b||0xc8;return function(_0x195691){if(_0x195691){return _0x5ebdc2[_0xc757('0x19')](_0x42da8b)[_0xc757('0x1a')](_0x195691);}};}function respondWithFilteredResult(_0x3a10e4,_0x593c0e){return function(_0x2bd583){if(_0x2bd583){var _0x34597b=typeof _0x593c0e[_0xc757('0x1b')]==='undefined'&&typeof _0x593c0e[_0xc757('0x1c')]===_0xc757('0x1d');var _0x3c56a4=_0x2bd583[_0xc757('0x1e')];var _0x278294=_0x34597b?0x0:_0x593c0e[_0xc757('0x1b')];var _0x9a6ebe=_0x34597b?_0x2bd583[_0xc757('0x1e')]:_0x593c0e['offset']+_0x593c0e[_0xc757('0x1c')];var _0x4a851c;if(_0x9a6ebe>=_0x3c56a4){_0x9a6ebe=_0x3c56a4;_0x4a851c=0xc8;}else{_0x4a851c=0xce;}_0x3a10e4[_0xc757('0x19')](_0x4a851c);return _0x3a10e4[_0xc757('0x1f')]('Content-Range',_0x278294+'-'+_0x9a6ebe+'/'+_0x3c56a4)[_0xc757('0x1a')](_0x2bd583);}return null;};}function patchUpdates(_0x7a057b){return function(_0x4c4848){try{jsonpatch['apply'](_0x4c4848,_0x7a057b,!![]);}catch(_0x27d216){return BPromise[_0xc757('0x20')](_0x27d216);}return _0x4c4848[_0xc757('0x21')]();};}function saveUpdates(_0xbf8aca,_0x40f33f){return function(_0x5a679e){if(_0x5a679e){return _0x5a679e[_0xc757('0x22')](_0xbf8aca)[_0xc757('0x23')](function(_0x424fc){return _0x424fc;});}return null;};}function removeEntity(_0x3ddfe4,_0x5a27d6){return function(_0x5b3845){if(_0x5b3845){return _0x5b3845[_0xc757('0x24')]()[_0xc757('0x23')](function(){_0x3ddfe4[_0xc757('0x19')](0xcc)[_0xc757('0x25')]();});}};}function handleEntityNotFound(_0x394a10,_0x3c1d10){return function(_0x29e774){if(!_0x29e774){_0x394a10[_0xc757('0x18')](0x194);}return _0x29e774;};}function handleError(_0xf3d814,_0x548854){_0x548854=_0x548854||0x1f4;return function(_0x3b9b76){logger['error'](_0x3b9b76[_0xc757('0x26')]);if(_0x3b9b76[_0xc757('0x27')]){delete _0x3b9b76['name'];}_0xf3d814[_0xc757('0x19')](_0x548854)['send'](_0x3b9b76);};}exports[_0xc757('0x28')]=function(_0x33c2f2,_0x17a723){var _0x4440d0={},_0x5c3a3a={},_0x1f3479={'count':0x0,'rows':[]};var _0x39533e=_['map'](db[_0xc757('0x29')][_0xc757('0x2a')],function(_0x1ff684){return{'name':_0x1ff684[_0xc757('0x2b')],'type':_0x1ff684[_0xc757('0x2c')][_0xc757('0x2d')]};});_0x5c3a3a[_0xc757('0x2e')]=_[_0xc757('0x2f')](_0x39533e,_0xc757('0x27'));_0x5c3a3a[_0xc757('0x30')]=_[_0xc757('0x31')](_0x33c2f2[_0xc757('0x30')]);_0x5c3a3a[_0xc757('0x32')]=_[_0xc757('0x33')](_0x5c3a3a[_0xc757('0x2e')],_0x5c3a3a[_0xc757('0x30')]);_0x4440d0['attributes']=_['intersection'](_0x5c3a3a[_0xc757('0x2e')],qs[_0xc757('0x34')](_0x33c2f2['query'][_0xc757('0x34')]));_0x4440d0[_0xc757('0x35')]=_0x4440d0['attributes'][_0xc757('0x36')]?_0x4440d0['attributes']:_0x5c3a3a['model'];if(!_0x33c2f2[_0xc757('0x30')]['hasOwnProperty']('nolimit')){_0x4440d0[_0xc757('0x1c')]=qs[_0xc757('0x1c')](_0x33c2f2[_0xc757('0x30')][_0xc757('0x1c')]);_0x4440d0[_0xc757('0x1b')]=qs['offset'](_0x33c2f2[_0xc757('0x30')][_0xc757('0x1b')]);}_0x4440d0[_0xc757('0x37')]=qs[_0xc757('0x38')](_0x33c2f2['query'][_0xc757('0x38')]);_0x4440d0[_0xc757('0x39')]=qs[_0xc757('0x32')](_[_0xc757('0x3a')](_0x33c2f2[_0xc757('0x30')],_0x5c3a3a[_0xc757('0x32')]),_0x39533e);if(_0x33c2f2[_0xc757('0x30')][_0xc757('0x3b')]){_0x4440d0[_0xc757('0x39')]=_[_0xc757('0x3c')](_0x4440d0[_0xc757('0x39')],{'$or':_[_0xc757('0x2f')](_0x39533e,function(_0x2e7357){if(_0x2e7357[_0xc757('0x2c')]!==_0xc757('0x3d')){var _0x56585e={};_0x56585e[_0x2e7357[_0xc757('0x27')]]={'$like':'%'+_0x33c2f2[_0xc757('0x30')][_0xc757('0x3b')]+'%'};return _0x56585e;}})});}_0x4440d0=_[_0xc757('0x3c')]({},_0x4440d0,_0x33c2f2[_0xc757('0x3e')]);var _0x508d8b={'where':_0x4440d0[_0xc757('0x39')]};return db[_0xc757('0x29')][_0xc757('0x1e')](_0x508d8b)['then'](function(_0x1980c8){_0x1f3479[_0xc757('0x1e')]=_0x1980c8;if(_0x33c2f2[_0xc757('0x30')]['includeAll']){_0x4440d0[_0xc757('0x3f')]=[{'all':!![]}];}return db[_0xc757('0x29')][_0xc757('0x40')](_0x4440d0);})[_0xc757('0x23')](function(_0x2a6779){_0x1f3479[_0xc757('0x41')]=_0x2a6779;return _0x1f3479;})[_0xc757('0x23')](respondWithFilteredResult(_0x17a723,_0x4440d0))[_0xc757('0x42')](handleError(_0x17a723,null));};exports['show']=function(_0x18384b,_0x4e7fca){var _0x2c25a0={'raw':!![],'where':{'id':_0x18384b[_0xc757('0x43')]['id']}},_0x3ecff2={};_0x3ecff2['model']=_['keys'](db['SquareMessage'][_0xc757('0x2a')]);_0x3ecff2[_0xc757('0x30')]=_[_0xc757('0x31')](_0x18384b[_0xc757('0x30')]);_0x3ecff2['filters']=_[_0xc757('0x33')](_0x3ecff2['model'],_0x3ecff2['query']);_0x2c25a0[_0xc757('0x35')]=_[_0xc757('0x33')](_0x3ecff2[_0xc757('0x2e')],qs[_0xc757('0x34')](_0x18384b[_0xc757('0x30')][_0xc757('0x34')]));_0x2c25a0[_0xc757('0x35')]=_0x2c25a0['attributes']['length']?_0x2c25a0[_0xc757('0x35')]:_0x3ecff2[_0xc757('0x2e')];if(_0x18384b[_0xc757('0x30')][_0xc757('0x44')]){_0x2c25a0['include']=[{'all':!![]}];}_0x2c25a0=_[_0xc757('0x3c')]({},_0x2c25a0,_0x18384b[_0xc757('0x3e')]);return db[_0xc757('0x29')][_0xc757('0x45')](_0x2c25a0)[_0xc757('0x23')](handleEntityNotFound(_0x4e7fca,null))[_0xc757('0x23')](respondWithResult(_0x4e7fca,null))[_0xc757('0x42')](handleError(_0x4e7fca,null));};exports[_0xc757('0x46')]=function(_0x24540f,_0x5d907c){return db['SquareMessage'][_0xc757('0x46')](_0x24540f[_0xc757('0x47')],{})[_0xc757('0x23')](respondWithResult(_0x5d907c,0xc9))['catch'](handleError(_0x5d907c,null));};exports['update']=function(_0x147aac,_0x955dd5){if(_0x147aac[_0xc757('0x47')]['id']){delete _0x147aac[_0xc757('0x47')]['id'];}return db['SquareMessage'][_0xc757('0x45')]({'where':{'id':_0x147aac[_0xc757('0x43')]['id']}})['then'](handleEntityNotFound(_0x955dd5,null))[_0xc757('0x23')](saveUpdates(_0x147aac[_0xc757('0x47')],null))['then'](respondWithResult(_0x955dd5,null))[_0xc757('0x42')](handleError(_0x955dd5,null));};exports[_0xc757('0x24')]=function(_0x5b4d31,_0x2a6be0){return db[_0xc757('0x29')][_0xc757('0x45')]({'where':{'id':_0x5b4d31[_0xc757('0x43')]['id']}})[_0xc757('0x23')](handleEntityNotFound(_0x2a6be0,null))['then'](removeEntity(_0x2a6be0,null))['catch'](handleError(_0x2a6be0,null));}; \ No newline at end of file +var _0x1a95=['eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','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','json','undefined','limit','offset','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','map','SquareMessage','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','params','length','include','find','create','body'];(function(_0x568051,_0xfeb755){var _0x304aa8=function(_0xe4bd74){while(--_0xe4bd74){_0x568051['push'](_0x568051['shift']());}};_0x304aa8(++_0xfeb755);}(_0x1a95,0x130));var _0x51a9=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1a95[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x51a9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x51a9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x51a9('0x2'));var moment=require(_0x51a9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x51a9('0x4'));var util=require(_0x51a9('0x5'));var path=require(_0x51a9('0x6'));var sox=require(_0x51a9('0x7'));var csv=require(_0x51a9('0x8'));var ejs=require(_0x51a9('0x9'));var fs=require('fs');var fs_extra=require(_0x51a9('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x51a9('0xb'));var jsforce=require(_0x51a9('0xc'));var deskjs=require(_0x51a9('0xd'));var toCsv=require(_0x51a9('0x8'));var querystring=require('querystring');var Papa=require(_0x51a9('0xe'));var Redis=require(_0x51a9('0xf'));var authService=require(_0x51a9('0x10'));var qs=require(_0x51a9('0x11'));var as=require(_0x51a9('0x12'));var hardwareService=require(_0x51a9('0x13'));var logger=require(_0x51a9('0x14'))('api');var utils=require(_0x51a9('0x15'));var config=require(_0x51a9('0x16'));var licenseUtil=require(_0x51a9('0x17'));var db=require(_0x51a9('0x18'))['db'];function respondWithStatusCode(_0x299202,_0x14b5f1){_0x14b5f1=_0x14b5f1||0xcc;return function(_0x37ea3b){if(_0x37ea3b){return _0x299202[_0x51a9('0x19')](_0x14b5f1);}return _0x299202['status'](_0x14b5f1)['end']();};}function respondWithResult(_0x5161a0,_0x4d119f){_0x4d119f=_0x4d119f||0xc8;return function(_0x5cbbf0){if(_0x5cbbf0){return _0x5161a0[_0x51a9('0x1a')](_0x4d119f)[_0x51a9('0x1b')](_0x5cbbf0);}};}function respondWithFilteredResult(_0x1b33fc,_0x445dbc){return function(_0x20150a){if(_0x20150a){var _0x22bd00=typeof _0x445dbc['offset']===_0x51a9('0x1c')&&typeof _0x445dbc[_0x51a9('0x1d')]===_0x51a9('0x1c');var _0x55ead6=_0x20150a['count'];var _0x26b900=_0x22bd00?0x0:_0x445dbc[_0x51a9('0x1e')];var _0x31c02d=_0x22bd00?_0x20150a['count']:_0x445dbc[_0x51a9('0x1e')]+_0x445dbc[_0x51a9('0x1d')];var _0x426a43;if(_0x31c02d>=_0x55ead6){_0x31c02d=_0x55ead6;_0x426a43=0xc8;}else{_0x426a43=0xce;}_0x1b33fc[_0x51a9('0x1a')](_0x426a43);return _0x1b33fc[_0x51a9('0x1f')](_0x51a9('0x20'),_0x26b900+'-'+_0x31c02d+'/'+_0x55ead6)['json'](_0x20150a);}return null;};}function patchUpdates(_0x32e6f1){return function(_0x5e6659){try{jsonpatch[_0x51a9('0x21')](_0x5e6659,_0x32e6f1,!![]);}catch(_0x26a29c){return BPromise[_0x51a9('0x22')](_0x26a29c);}return _0x5e6659['save']();};}function saveUpdates(_0x2c7d38,_0x160a2a){return function(_0x5e6ea8){if(_0x5e6ea8){return _0x5e6ea8[_0x51a9('0x23')](_0x2c7d38)[_0x51a9('0x24')](function(_0x571962){return _0x571962;});}return null;};}function removeEntity(_0x2b5424,_0x36e505){return function(_0x18f177){if(_0x18f177){return _0x18f177[_0x51a9('0x25')]()[_0x51a9('0x24')](function(){_0x2b5424[_0x51a9('0x1a')](0xcc)[_0x51a9('0x26')]();});}};}function handleEntityNotFound(_0x15c3b4,_0x180325){return function(_0x11ff16){if(!_0x11ff16){_0x15c3b4[_0x51a9('0x19')](0x194);}return _0x11ff16;};}function handleError(_0x29fdea,_0x327baf){_0x327baf=_0x327baf||0x1f4;return function(_0x424b68){logger[_0x51a9('0x27')](_0x424b68[_0x51a9('0x28')]);if(_0x424b68[_0x51a9('0x29')]){delete _0x424b68['name'];}_0x29fdea[_0x51a9('0x1a')](_0x327baf)['send'](_0x424b68);};}exports[_0x51a9('0x2a')]=function(_0x4350e0,_0x1d7af8){var _0x231145={},_0x1dad0d={},_0x27c95c={'count':0x0,'rows':[]};var _0x4871c8=_[_0x51a9('0x2b')](db[_0x51a9('0x2c')][_0x51a9('0x2d')],function(_0x258a9b){return{'name':_0x258a9b[_0x51a9('0x2e')],'type':_0x258a9b[_0x51a9('0x2f')]['key']};});_0x1dad0d[_0x51a9('0x30')]=_[_0x51a9('0x2b')](_0x4871c8,_0x51a9('0x29'));_0x1dad0d[_0x51a9('0x31')]=_[_0x51a9('0x32')](_0x4350e0['query']);_0x1dad0d[_0x51a9('0x33')]=_['intersection'](_0x1dad0d[_0x51a9('0x30')],_0x1dad0d['query']);_0x231145[_0x51a9('0x34')]=_[_0x51a9('0x35')](_0x1dad0d[_0x51a9('0x30')],qs[_0x51a9('0x36')](_0x4350e0['query'][_0x51a9('0x36')]));_0x231145[_0x51a9('0x34')]=_0x231145['attributes']['length']?_0x231145[_0x51a9('0x34')]:_0x1dad0d[_0x51a9('0x30')];if(!_0x4350e0[_0x51a9('0x31')][_0x51a9('0x37')](_0x51a9('0x38'))){_0x231145[_0x51a9('0x1d')]=qs[_0x51a9('0x1d')](_0x4350e0['query'][_0x51a9('0x1d')]);_0x231145[_0x51a9('0x1e')]=qs[_0x51a9('0x1e')](_0x4350e0[_0x51a9('0x31')][_0x51a9('0x1e')]);}_0x231145[_0x51a9('0x39')]=qs[_0x51a9('0x3a')](_0x4350e0[_0x51a9('0x31')][_0x51a9('0x3a')]);_0x231145[_0x51a9('0x3b')]=qs['filters'](_[_0x51a9('0x3c')](_0x4350e0[_0x51a9('0x31')],_0x1dad0d['filters']),_0x4871c8);if(_0x4350e0['query'][_0x51a9('0x3d')]){_0x231145[_0x51a9('0x3b')]=_[_0x51a9('0x3e')](_0x231145[_0x51a9('0x3b')],{'$or':_[_0x51a9('0x2b')](_0x4871c8,function(_0x90a613){if(_0x90a613[_0x51a9('0x2f')]!==_0x51a9('0x3f')){var _0x8a1f82={};_0x8a1f82[_0x90a613[_0x51a9('0x29')]]={'$like':'%'+_0x4350e0['query'][_0x51a9('0x3d')]+'%'};return _0x8a1f82;}})});}_0x231145=_[_0x51a9('0x3e')]({},_0x231145,_0x4350e0[_0x51a9('0x40')]);var _0x5ecb29={'where':_0x231145[_0x51a9('0x3b')]};return db['SquareMessage'][_0x51a9('0x41')](_0x5ecb29)[_0x51a9('0x24')](function(_0x30f6b2){_0x27c95c[_0x51a9('0x41')]=_0x30f6b2;if(_0x4350e0[_0x51a9('0x31')][_0x51a9('0x42')]){_0x231145['include']=[{'all':!![]}];}return db['SquareMessage'][_0x51a9('0x43')](_0x231145);})[_0x51a9('0x24')](function(_0x4aaf0f){_0x27c95c[_0x51a9('0x44')]=_0x4aaf0f;return _0x27c95c;})[_0x51a9('0x24')](respondWithFilteredResult(_0x1d7af8,_0x231145))[_0x51a9('0x45')](handleError(_0x1d7af8,null));};exports['show']=function(_0x160367,_0x27147e){var _0x6584e6={'raw':!![],'where':{'id':_0x160367[_0x51a9('0x46')]['id']}},_0x41fca5={};_0x41fca5[_0x51a9('0x30')]=_[_0x51a9('0x32')](db['SquareMessage'][_0x51a9('0x2d')]);_0x41fca5[_0x51a9('0x31')]=_[_0x51a9('0x32')](_0x160367[_0x51a9('0x31')]);_0x41fca5[_0x51a9('0x33')]=_[_0x51a9('0x35')](_0x41fca5[_0x51a9('0x30')],_0x41fca5[_0x51a9('0x31')]);_0x6584e6[_0x51a9('0x34')]=_['intersection'](_0x41fca5[_0x51a9('0x30')],qs[_0x51a9('0x36')](_0x160367[_0x51a9('0x31')][_0x51a9('0x36')]));_0x6584e6['attributes']=_0x6584e6[_0x51a9('0x34')][_0x51a9('0x47')]?_0x6584e6[_0x51a9('0x34')]:_0x41fca5[_0x51a9('0x30')];if(_0x160367[_0x51a9('0x31')][_0x51a9('0x42')]){_0x6584e6[_0x51a9('0x48')]=[{'all':!![]}];}_0x6584e6=_['merge']({},_0x6584e6,_0x160367['options']);return db[_0x51a9('0x2c')][_0x51a9('0x49')](_0x6584e6)[_0x51a9('0x24')](handleEntityNotFound(_0x27147e,null))[_0x51a9('0x24')](respondWithResult(_0x27147e,null))[_0x51a9('0x45')](handleError(_0x27147e,null));};exports[_0x51a9('0x4a')]=function(_0x1ba76b,_0xa7c723){return db['SquareMessage'][_0x51a9('0x4a')](_0x1ba76b[_0x51a9('0x4b')],{})['then'](respondWithResult(_0xa7c723,0xc9))[_0x51a9('0x45')](handleError(_0xa7c723,null));};exports[_0x51a9('0x23')]=function(_0x2ef9ac,_0x5f4e11){if(_0x2ef9ac[_0x51a9('0x4b')]['id']){delete _0x2ef9ac[_0x51a9('0x4b')]['id'];}return db[_0x51a9('0x2c')][_0x51a9('0x49')]({'where':{'id':_0x2ef9ac[_0x51a9('0x46')]['id']}})[_0x51a9('0x24')](handleEntityNotFound(_0x5f4e11,null))[_0x51a9('0x24')](saveUpdates(_0x2ef9ac['body'],null))['then'](respondWithResult(_0x5f4e11,null))[_0x51a9('0x45')](handleError(_0x5f4e11,null));};exports['destroy']=function(_0x2bcbdc,_0x54e608){return db[_0x51a9('0x2c')]['find']({'where':{'id':_0x2bcbdc[_0x51a9('0x46')]['id']}})[_0x51a9('0x24')](handleEntityNotFound(_0x54e608,null))[_0x51a9('0x24')](removeEntity(_0x54e608,null))[_0x51a9('0x45')](handleError(_0x54e608,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index bda2bf9..ac590e4 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 _0x223b=['../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x52db8f,_0x1d571e){var _0x19f914=function(_0x4bd48a){while(--_0x4bd48a){_0x52db8f['push'](_0x52db8f['shift']());}};_0x19f914(++_0x1d571e);}(_0x223b,0x192));var _0xb223=function(_0x3024ba,_0x2e715f){_0x3024ba=_0x3024ba-0x0;var _0x3d3012=_0x223b[_0x3024ba];return _0x3d3012;};'use strict';var _=require(_0xb223('0x0'));var util=require(_0xb223('0x1'));var logger=require(_0xb223('0x2'))(_0xb223('0x3'));var moment=require(_0xb223('0x4'));var BPromise=require('bluebird');var rp=require(_0xb223('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb223('0x6'));var attributes=require(_0xb223('0x7'));module[_0xb223('0x8')]=function(_0x33fb5d,_0x51da7d){return _0x33fb5d[_0xb223('0x9')](_0xb223('0xa'),attributes,{'tableName':_0xb223('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b5a=['../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x561771,_0x554760){var _0x54d16e=function(_0x381c1f){while(--_0x381c1f){_0x561771['push'](_0x561771['shift']());}};_0x54d16e(++_0x554760);}(_0x9b5a,0x88));var _0xa9b5=function(_0x1b5b70,_0xfd0642){_0x1b5b70=_0x1b5b70-0x0;var _0x55fee3=_0x9b5a[_0x1b5b70];return _0x55fee3;};'use strict';var _=require(_0xa9b5('0x0'));var util=require(_0xa9b5('0x1'));var logger=require(_0xa9b5('0x2'))(_0xa9b5('0x3'));var moment=require(_0xa9b5('0x4'));var BPromise=require('bluebird');var rp=require(_0xa9b5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa9b5('0x6'));var config=require(_0xa9b5('0x7'));var attributes=require(_0xa9b5('0x8'));module[_0xa9b5('0x9')]=function(_0x6cd92,_0x366c58){return _0x6cd92[_0xa9b5('0xa')](_0xa9b5('0xb'),attributes,{'tableName':_0xa9b5('0xc'),'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 623c36f..e027422 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 _0xa8ee=['body','options','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage'];(function(_0x54075a,_0x1b29fa){var _0x1cda54=function(_0x76766){while(--_0x76766){_0x54075a['push'](_0x54075a['shift']());}};_0x1cda54(++_0x1b29fa);}(_0xa8ee,0x152));var _0xea8e=function(_0x3a03b3,_0x39b9f7){_0x3a03b3=_0x3a03b3-0x0;var _0x121a62=_0xa8ee[_0x3a03b3];return _0x121a62;};'use strict';var _=require(_0xea8e('0x0'));var util=require(_0xea8e('0x1'));var moment=require('moment');var BPromise=require(_0xea8e('0x2'));var rs=require(_0xea8e('0x3'));var fs=require('fs');var Redis=require(_0xea8e('0x4'));var db=require(_0xea8e('0x5'))['db'];var utils=require(_0xea8e('0x6'));var logger=require('../../config/logger')(_0xea8e('0x7'));var config=require(_0xea8e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xea8e('0x9')][_0xea8e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x327a2b,_0x36cb78,_0x45c7a8){return new BPromise(function(_0x152ac5,_0x2fe364){return client[_0xea8e('0xb')](_0x327a2b,_0x45c7a8)[_0xea8e('0xc')](function(_0x26f145){logger[_0xea8e('0xd')](_0xea8e('0xe'),_0x36cb78,_0xea8e('0xf'));logger[_0xea8e('0x10')](_0xea8e('0x11'),_0x36cb78,_0xea8e('0xf'),JSON[_0xea8e('0x12')](_0x26f145));if(_0x26f145['error']){if(_0x26f145[_0xea8e('0x13')][_0xea8e('0x14')]===0x1f4){logger[_0xea8e('0x13')](_0xea8e('0xe'),_0x36cb78,_0x26f145[_0xea8e('0x13')][_0xea8e('0x15')]);return _0x2fe364(_0x26f145[_0xea8e('0x13')]['message']);}logger['error']('SquareMessage,\x20%s,\x20%s',_0x36cb78,_0x26f145[_0xea8e('0x13')]['message']);return _0x152ac5(_0x26f145[_0xea8e('0x13')]['message']);}else{logger[_0xea8e('0xd')](_0xea8e('0xe'),_0x36cb78,_0xea8e('0xf'));_0x152ac5(_0x26f145[_0xea8e('0x16')][_0xea8e('0x15')]);}})[_0xea8e('0x17')](function(_0x19ce5e){logger['error']('SquareMessage,\x20%s,\x20%s',_0x36cb78,_0x19ce5e);_0x2fe364(_0x19ce5e);});});}exports[_0xea8e('0x18')]=function(_0xd7b0af){var _0x3839e4=this;return new Promise(function(_0x903689,_0x8838e9){return db[_0xea8e('0x19')]['create'](_0xd7b0af[_0xea8e('0x1a')],{'raw':_0xd7b0af[_0xea8e('0x1b')]?_0xd7b0af[_0xea8e('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xea8e('0xc')](function(_0x244e0d){logger[_0xea8e('0xd')](_0xea8e('0x18'),_0xd7b0af);logger[_0xea8e('0x10')](_0xea8e('0x18'),_0xd7b0af,JSON['stringify'](_0x244e0d));_0x903689(_0x244e0d);})[_0xea8e('0x17')](function(_0x154de0){logger['error'](_0xea8e('0x18'),_0x154de0['message'],_0xd7b0af);_0x8838e9(_0x3839e4[_0xea8e('0x13')](0x1f4,_0x154de0['message']));});});}; \ No newline at end of file +var _0x5da5=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareMessage,\x20%s,\x20%s','result','catch','CreateSquareMessage','create','body','options','raw','lodash','util','bluebird'];(function(_0x4c7d65,_0x200be2){var _0x18d0a9=function(_0x43770a){while(--_0x43770a){_0x4c7d65['push'](_0x4c7d65['shift']());}};_0x18d0a9(++_0x200be2);}(_0x5da5,0x159));var _0x55da=function(_0x5cbd2b,_0xf71c2e){_0x5cbd2b=_0x5cbd2b-0x0;var _0x5bfbd8=_0x5da5[_0x5cbd2b];return _0x5bfbd8;};'use strict';var _=require(_0x55da('0x0'));var util=require(_0x55da('0x1'));var moment=require('moment');var BPromise=require(_0x55da('0x2'));var rs=require(_0x55da('0x3'));var fs=require('fs');var Redis=require(_0x55da('0x4'));var db=require(_0x55da('0x5'))['db'];var utils=require(_0x55da('0x6'));var logger=require('../../config/logger')(_0x55da('0x7'));var config=require(_0x55da('0x8'));var jayson=require(_0x55da('0x9'));var client=jayson['client'][_0x55da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d34f1,_0x164556,_0x11da0c){return new BPromise(function(_0x276b05,_0x529072){return client[_0x55da('0xb')](_0x1d34f1,_0x11da0c)[_0x55da('0xc')](function(_0x1de10d){logger[_0x55da('0xd')]('SquareMessage,\x20%s,\x20%s',_0x164556,_0x55da('0xe'));logger[_0x55da('0xf')](_0x55da('0x10'),_0x164556,'request\x20sent',JSON[_0x55da('0x11')](_0x1de10d));if(_0x1de10d[_0x55da('0x12')]){if(_0x1de10d[_0x55da('0x12')][_0x55da('0x13')]===0x1f4){logger[_0x55da('0x12')]('SquareMessage,\x20%s,\x20%s',_0x164556,_0x1de10d[_0x55da('0x12')][_0x55da('0x14')]);return _0x529072(_0x1de10d[_0x55da('0x12')]['message']);}logger['error'](_0x55da('0x15'),_0x164556,_0x1de10d[_0x55da('0x12')][_0x55da('0x14')]);return _0x276b05(_0x1de10d[_0x55da('0x12')][_0x55da('0x14')]);}else{logger[_0x55da('0xd')]('SquareMessage,\x20%s,\x20%s',_0x164556,_0x55da('0xe'));_0x276b05(_0x1de10d[_0x55da('0x16')][_0x55da('0x14')]);}})[_0x55da('0x17')](function(_0x4c8860){logger[_0x55da('0x12')]('SquareMessage,\x20%s,\x20%s',_0x164556,_0x4c8860);_0x529072(_0x4c8860);});});}exports[_0x55da('0x18')]=function(_0x586b3e){var _0x3ddcec=this;return new Promise(function(_0x58867b,_0x5ce6db){return db['SquareMessage'][_0x55da('0x19')](_0x586b3e[_0x55da('0x1a')],{'raw':_0x586b3e[_0x55da('0x1b')]?_0x586b3e[_0x55da('0x1b')][_0x55da('0x1c')]===undefined?!![]:![]:!![]})[_0x55da('0xc')](function(_0x3e96c7){logger[_0x55da('0xd')]('CreateSquareMessage',_0x586b3e);logger[_0x55da('0xf')]('CreateSquareMessage',_0x586b3e,JSON['stringify'](_0x3e96c7));_0x58867b(_0x3e96c7);})[_0x55da('0x17')](function(_0x345ca5){logger[_0x55da('0x12')]('CreateSquareMessage',_0x345ca5['message'],_0x586b3e);_0x5ce6db(_0x3ddcec[_0x55da('0x12')](0x1f4,_0x345ca5['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index a9195be..9602546 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 _0x3640=['../../config/environment','./squareOdbc.controller','get','isAuthenticated','/:id','show','15s','test','post','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x23d2a0,_0x516174){var _0x409e80=function(_0x432940){while(--_0x432940){_0x23d2a0['push'](_0x23d2a0['shift']());}};_0x409e80(++_0x516174);}(_0x3640,0x98));var _0x0364=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x3640[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0x0364('0x0'));var util=require(_0x0364('0x1'));var path=require(_0x0364('0x2'));var timeout=require(_0x0364('0x3'));var express=require(_0x0364('0x4'));var router=express[_0x0364('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0364('0x6'));var interaction=require(_0x0364('0x7'));var config=require(_0x0364('0x8'));var controller=require(_0x0364('0x9'));router[_0x0364('0xa')]('/',auth[_0x0364('0xb')](),controller['index']);router['get'](_0x0364('0xc'),auth[_0x0364('0xb')](),controller[_0x0364('0xd')]);router[_0x0364('0xa')]('/:id/test',auth[_0x0364('0xb')](),timeout(_0x0364('0xe')),controller[_0x0364('0xf')]);router[_0x0364('0x10')]('/',auth[_0x0364('0xb')](),controller['create']);router['put'](_0x0364('0xc'),auth[_0x0364('0xb')](),controller[_0x0364('0x11')]);router[_0x0364('0x12')](_0x0364('0xc'),auth[_0x0364('0xb')](),controller['destroy']);module[_0x0364('0x13')]=router; \ No newline at end of file +var _0x9b17=['/:id','show','/:id/test','isAuthenticated','15s','test','post','put','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index'];(function(_0x3f8f5a,_0x5402a7){var _0x54f222=function(_0x57d2b3){while(--_0x57d2b3){_0x3f8f5a['push'](_0x3f8f5a['shift']());}};_0x54f222(++_0x5402a7);}(_0x9b17,0x198));var _0x79b1=function(_0x34c6a3,_0x3e1a91){_0x34c6a3=_0x34c6a3-0x0;var _0x58fcda=_0x9b17[_0x34c6a3];return _0x58fcda;};'use strict';var multer=require(_0x79b1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x79b1('0x1'));var router=express[_0x79b1('0x2')]();var fs_extra=require(_0x79b1('0x3'));var auth=require(_0x79b1('0x4'));var interaction=require(_0x79b1('0x5'));var config=require(_0x79b1('0x6'));var controller=require(_0x79b1('0x7'));router[_0x79b1('0x8')]('/',auth['isAuthenticated'](),controller[_0x79b1('0x9')]);router[_0x79b1('0x8')](_0x79b1('0xa'),auth['isAuthenticated'](),controller[_0x79b1('0xb')]);router[_0x79b1('0x8')](_0x79b1('0xc'),auth[_0x79b1('0xd')](),timeout(_0x79b1('0xe')),controller[_0x79b1('0xf')]);router[_0x79b1('0x10')]('/',auth[_0x79b1('0xd')](),controller['create']);router[_0x79b1('0x11')](_0x79b1('0xa'),auth[_0x79b1('0xd')](),controller[_0x79b1('0x12')]);router[_0x79b1('0x13')](_0x79b1('0xa'),auth['isAuthenticated'](),controller[_0x79b1('0x14')]);module[_0x79b1('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 557c179..f5bc207 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 _0xfa38=['STRING'];(function(_0x49b14d,_0x578d07){var _0x3d2488=function(_0x5a8668){while(--_0x5a8668){_0x49b14d['push'](_0x49b14d['shift']());}};_0x3d2488(++_0x578d07);}(_0xfa38,0x7a));var _0x8fa3=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xfa38[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8fa3('0x0')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x8fa3('0x0')]},'description':{'type':Sequelize[_0x8fa3('0x0')]}}; \ No newline at end of file +var _0x7fea=['name','sequelize','exports','STRING'];(function(_0x2356dc,_0x3c198f){var _0x990423=function(_0x3d2ba6){while(--_0x3d2ba6){_0x2356dc['push'](_0x2356dc['shift']());}};_0x990423(++_0x3c198f);}(_0x7fea,0xa9));var _0xa7fe=function(_0x1f11e4,_0x2f78f9){_0x1f11e4=_0x1f11e4-0x0;var _0x3e2184=_0x7fea[_0x1f11e4];return _0x3e2184;};'use strict';var Sequelize=require(_0xa7fe('0x0'));module[_0xa7fe('0x1')]={'name':{'type':Sequelize[_0xa7fe('0x2')],'unique':_0xa7fe('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xa7fe('0x2')]},'description':{'type':Sequelize[_0xa7fe('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 922d199..e1a6134 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 _0xa1ad=['bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','save','update','then','get','ODBC','UserProfileResource','destroy','error','name','send','index','SquareOdbc','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','findAll','rows','catch','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','openSync','dsn','zip-dir','request-promise','moment'];(function(_0x4d4002,_0x8db2b5){var _0x1a2940=function(_0x31cfed){while(--_0x31cfed){_0x4d4002['push'](_0x4d4002['shift']());}};_0x1a2940(++_0x8db2b5);}(_0xa1ad,0x139));var _0xda1a=function(_0x59b439,_0x14ae7b){_0x59b439=_0x59b439-0x0;var _0x521ea3=_0xa1ad[_0x59b439];return _0x521ea3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xda1a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda1a('0x1'));var moment=require(_0xda1a('0x2'));var BPromise=require(_0xda1a('0x3'));var Mustache=require(_0xda1a('0x4'));var util=require('util');var path=require(_0xda1a('0x5'));var sox=require(_0xda1a('0x6'));var csv=require(_0xda1a('0x7'));var ejs=require(_0xda1a('0x8'));var fs=require('fs');var fs_extra=require(_0xda1a('0x9'));var _=require('lodash');var squel=require(_0xda1a('0xa'));var crypto=require('crypto');var jsforce=require(_0xda1a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xda1a('0x7'));var querystring=require(_0xda1a('0xc'));var Papa=require(_0xda1a('0xd'));var Redis=require(_0xda1a('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda1a('0xf'));var logger=require(_0xda1a('0x10'))(_0xda1a('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xda1a('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2928e3,_0x3db128){_0x3db128=_0x3db128||0xcc;return function(_0x462b96){if(_0x462b96){return _0x2928e3[_0xda1a('0x13')](_0x3db128);}return _0x2928e3[_0xda1a('0x14')](_0x3db128)[_0xda1a('0x15')]();};}function respondWithResult(_0xaaf5b8,_0x3b0c1f){_0x3b0c1f=_0x3b0c1f||0xc8;return function(_0x48d34c){if(_0x48d34c){return _0xaaf5b8['status'](_0x3b0c1f)[_0xda1a('0x16')](_0x48d34c);}};}function respondWithFilteredResult(_0x2eac77,_0x1185bf){return function(_0x58a058){if(_0x58a058){var _0x54839d=typeof _0x1185bf['offset']===_0xda1a('0x17')&&typeof _0x1185bf[_0xda1a('0x18')]===_0xda1a('0x17');var _0x222931=_0x58a058[_0xda1a('0x19')];var _0x4fde94=_0x54839d?0x0:_0x1185bf[_0xda1a('0x1a')];var _0x4a319e=_0x54839d?_0x58a058['count']:_0x1185bf[_0xda1a('0x1a')]+_0x1185bf[_0xda1a('0x18')];var _0x2b7f2d;if(_0x4a319e>=_0x222931){_0x4a319e=_0x222931;_0x2b7f2d=0xc8;}else{_0x2b7f2d=0xce;}_0x2eac77['status'](_0x2b7f2d);return _0x2eac77[_0xda1a('0x1b')]('Content-Range',_0x4fde94+'-'+_0x4a319e+'/'+_0x222931)[_0xda1a('0x16')](_0x58a058);}return null;};}function patchUpdates(_0x105ad0){return function(_0x4dbb29){try{jsonpatch['apply'](_0x4dbb29,_0x105ad0,!![]);}catch(_0x7b470d){return BPromise['reject'](_0x7b470d);}return _0x4dbb29[_0xda1a('0x1c')]();};}function saveUpdates(_0x4a6a9f,_0x606463){return function(_0x23d90a){if(_0x23d90a){return _0x23d90a[_0xda1a('0x1d')](_0x4a6a9f)[_0xda1a('0x1e')](function(_0x22c959){return _0x22c959;});}return null;};}function removeEntity(_0x3b62f1,_0x3b75cc){return function(_0x4ad98c){if(_0x4ad98c){return _0x4ad98c['destroy']()[_0xda1a('0x1e')](function(){var _0x6d1d5d=_0x4ad98c[_0xda1a('0x1f')]({'plain':!![]});var _0x597d89=_0xda1a('0x20');return db[_0xda1a('0x21')][_0xda1a('0x22')]({'where':{'type':_0x597d89,'resourceId':_0x6d1d5d['id']}})[_0xda1a('0x1e')](function(){return _0x4ad98c;});})[_0xda1a('0x1e')](function(){_0x3b62f1[_0xda1a('0x14')](0xcc)[_0xda1a('0x15')]();});}};}function handleEntityNotFound(_0x47d8f8,_0x1ced1){return function(_0x5ddd03){if(!_0x5ddd03){_0x47d8f8['sendStatus'](0x194);}return _0x5ddd03;};}function handleError(_0x49f1f1,_0x18c34c){_0x18c34c=_0x18c34c||0x1f4;return function(_0x380cdc){logger[_0xda1a('0x23')](_0x380cdc['stack']);if(_0x380cdc[_0xda1a('0x24')]){delete _0x380cdc[_0xda1a('0x24')];}_0x49f1f1[_0xda1a('0x14')](_0x18c34c)[_0xda1a('0x25')](_0x380cdc);};}exports[_0xda1a('0x26')]=function(_0x9ea94,_0x365c96){var _0x42aa9e={},_0x3c2131={},_0x168972={'count':0x0,'rows':[]};var _0x42b8a3=_['map'](db[_0xda1a('0x27')][_0xda1a('0x28')],function(_0x127e7e){return{'name':_0x127e7e[_0xda1a('0x29')],'type':_0x127e7e[_0xda1a('0x2a')][_0xda1a('0x2b')]};});_0x3c2131[_0xda1a('0x2c')]=_[_0xda1a('0x2d')](_0x42b8a3,'name');_0x3c2131[_0xda1a('0x2e')]=_[_0xda1a('0x2f')](_0x9ea94['query']);_0x3c2131[_0xda1a('0x30')]=_[_0xda1a('0x31')](_0x3c2131[_0xda1a('0x2c')],_0x3c2131[_0xda1a('0x2e')]);_0x42aa9e[_0xda1a('0x32')]=_[_0xda1a('0x31')](_0x3c2131[_0xda1a('0x2c')],qs[_0xda1a('0x33')](_0x9ea94['query'][_0xda1a('0x33')]));_0x42aa9e['attributes']=_0x42aa9e[_0xda1a('0x32')][_0xda1a('0x34')]?_0x42aa9e['attributes']:_0x3c2131[_0xda1a('0x2c')];if(!_0x9ea94[_0xda1a('0x2e')][_0xda1a('0x35')]('nolimit')){_0x42aa9e['limit']=qs[_0xda1a('0x18')](_0x9ea94[_0xda1a('0x2e')][_0xda1a('0x18')]);_0x42aa9e[_0xda1a('0x1a')]=qs[_0xda1a('0x1a')](_0x9ea94[_0xda1a('0x2e')]['offset']);}_0x42aa9e[_0xda1a('0x36')]=qs[_0xda1a('0x37')](_0x9ea94[_0xda1a('0x2e')][_0xda1a('0x37')]);_0x42aa9e[_0xda1a('0x38')]=qs['filters'](_['pick'](_0x9ea94[_0xda1a('0x2e')],_0x3c2131['filters']),_0x42b8a3);if(_0x9ea94[_0xda1a('0x2e')][_0xda1a('0x39')]){_0x42aa9e[_0xda1a('0x38')]=_['merge'](_0x42aa9e[_0xda1a('0x38')],{'$or':_[_0xda1a('0x2d')](_0x42b8a3,function(_0x3be4c3){if(_0x3be4c3[_0xda1a('0x2a')]!==_0xda1a('0x3a')){var _0xc5522a={};_0xc5522a[_0x3be4c3[_0xda1a('0x24')]]={'$like':'%'+_0x9ea94[_0xda1a('0x2e')]['filter']+'%'};return _0xc5522a;}})});}_0x42aa9e=_[_0xda1a('0x3b')]({},_0x42aa9e,_0x9ea94[_0xda1a('0x3c')]);var _0xb5b231={'where':_0x42aa9e['where']};return db[_0xda1a('0x27')]['count'](_0xb5b231)['then'](function(_0x109c12){_0x168972[_0xda1a('0x19')]=_0x109c12;if(_0x9ea94[_0xda1a('0x2e')]['includeAll']){_0x42aa9e['include']=[{'all':!![]}];}return db['SquareOdbc'][_0xda1a('0x3d')](_0x42aa9e);})['then'](function(_0xcc6a32){_0x168972[_0xda1a('0x3e')]=_0xcc6a32;return _0x168972;})['then'](respondWithFilteredResult(_0x365c96,_0x42aa9e))[_0xda1a('0x3f')](handleError(_0x365c96,null));};exports['show']=function(_0x552281,_0x256da4){var _0x3d0636={'raw':!![],'where':{'id':_0x552281['params']['id']}},_0x5f0160={};_0x5f0160[_0xda1a('0x2c')]=_[_0xda1a('0x2f')](db['SquareOdbc'][_0xda1a('0x28')]);_0x5f0160[_0xda1a('0x2e')]=_[_0xda1a('0x2f')](_0x552281['query']);_0x5f0160['filters']=_['intersection'](_0x5f0160[_0xda1a('0x2c')],_0x5f0160[_0xda1a('0x2e')]);_0x3d0636[_0xda1a('0x32')]=_[_0xda1a('0x31')](_0x5f0160[_0xda1a('0x2c')],qs[_0xda1a('0x33')](_0x552281[_0xda1a('0x2e')][_0xda1a('0x33')]));_0x3d0636['attributes']=_0x3d0636[_0xda1a('0x32')][_0xda1a('0x34')]?_0x3d0636[_0xda1a('0x32')]:_0x5f0160[_0xda1a('0x2c')];if(_0x552281[_0xda1a('0x2e')][_0xda1a('0x40')]){_0x3d0636[_0xda1a('0x41')]=[{'all':!![]}];}_0x3d0636=_[_0xda1a('0x3b')]({},_0x3d0636,_0x552281[_0xda1a('0x3c')]);return db[_0xda1a('0x27')][_0xda1a('0x42')](_0x3d0636)[_0xda1a('0x1e')](handleEntityNotFound(_0x256da4,null))[_0xda1a('0x1e')](respondWithResult(_0x256da4,null))['catch'](handleError(_0x256da4,null));};exports[_0xda1a('0x43')]=function(_0x383065,_0x2f3c10){return db['SquareOdbc']['create'](_0x383065[_0xda1a('0x44')],{})[_0xda1a('0x1e')](function(_0x186435){var _0x4993df=_0x383065[_0xda1a('0x45')]['get']({'plain':!![]});if(!_0x4993df)throw new Error(_0xda1a('0x46'));if(_0x4993df['role']==='user'){var _0x847f52=_0x186435['get']({'plain':!![]});var _0x2eab1e=_0xda1a('0x20');return db[_0xda1a('0x47')][_0xda1a('0x42')]({'where':{'name':_0x2eab1e,'userProfileId':_0x4993df[_0xda1a('0x48')]},'raw':!![]})[_0xda1a('0x1e')](function(_0x3d1900){if(_0x3d1900&&_0x3d1900[_0xda1a('0x49')]===0x0){return db['UserProfileResource'][_0xda1a('0x43')]({'name':_0x847f52['name'],'resourceId':_0x847f52['id'],'type':_0x3d1900['name'],'sectionId':_0x3d1900['id']},{})['then'](function(){return _0x186435;});}else{return _0x186435;}})[_0xda1a('0x3f')](function(_0x4887fb){logger[_0xda1a('0x23')](_0xda1a('0x4a'),_0x4887fb);throw _0x4887fb;});}return _0x186435;})[_0xda1a('0x1e')](respondWithResult(_0x2f3c10,0xc9))['catch'](handleError(_0x2f3c10,null));};exports['update']=function(_0x2874f9,_0x59008d){if(_0x2874f9['body']['id']){delete _0x2874f9[_0xda1a('0x44')]['id'];}return db[_0xda1a('0x27')][_0xda1a('0x42')]({'where':{'id':_0x2874f9[_0xda1a('0x4b')]['id']}})[_0xda1a('0x1e')](handleEntityNotFound(_0x59008d,null))[_0xda1a('0x1e')](saveUpdates(_0x2874f9[_0xda1a('0x44')],null))['then'](respondWithResult(_0x59008d,null))[_0xda1a('0x3f')](handleError(_0x59008d,null));};exports['destroy']=function(_0x2220e0,_0xa4b5d5){return db[_0xda1a('0x27')][_0xda1a('0x42')]({'where':{'id':_0x2220e0[_0xda1a('0x4b')]['id']}})['then'](handleEntityNotFound(_0xa4b5d5,null))[_0xda1a('0x1e')](removeEntity(_0xa4b5d5,null))[_0xda1a('0x3f')](handleError(_0xa4b5d5,null));};exports[_0xda1a('0x4c')]=function(_0x3440eb,_0x40067a,_0x24afd3){var _0x1d19ef;return db['SquareOdbc'][_0xda1a('0x42')]({'where':{'id':_0x3440eb['params']['id']},'attributes':['id','dsn']})[_0xda1a('0x1e')](handleEntityNotFound(_0x40067a,null))[_0xda1a('0x1e')](function(_0x3b360d){if(_0x3b360d){var _0x336805=require('odbc')();_0x336805[_0xda1a('0x4d')](_0x3b360d[_0xda1a('0x4e')]);_0x336805['closeSync']();return _0x3b360d;}})[_0xda1a('0x1e')](respondWithResult(_0x40067a,null))[_0xda1a('0x3f')](handleError(_0x40067a,null));}; \ No newline at end of file +var _0x819b=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','count','offset','set','Content-Range','json','apply','destroy','then','get','ODBC','end','error','stack','name','send','index','map','SquareOdbc','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','keys','rawAttributes','fields','includeAll','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','test','dsn','openSync','closeSync','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x819b,0xf9));var _0xb819=function(_0xa087f5,_0x34fd10){_0xa087f5=_0xa087f5-0x0;var _0x4c8806=_0x819b[_0xa087f5];return _0x4c8806;};'use strict';var emlformat=require(_0xb819('0x0'));var rimraf=require(_0xb819('0x1'));var zipdir=require(_0xb819('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb819('0x3'));var BPromise=require(_0xb819('0x4'));var Mustache=require(_0xb819('0x5'));var util=require('util');var path=require(_0xb819('0x6'));var sox=require(_0xb819('0x7'));var csv=require('to-csv');var ejs=require(_0xb819('0x8'));var fs=require('fs');var fs_extra=require(_0xb819('0x9'));var _=require('lodash');var squel=require(_0xb819('0xa'));var crypto=require(_0xb819('0xb'));var jsforce=require(_0xb819('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb819('0xd'));var querystring=require(_0xb819('0xe'));var Papa=require('papaparse');var Redis=require(_0xb819('0xf'));var authService=require(_0xb819('0x10'));var qs=require(_0xb819('0x11'));var as=require(_0xb819('0x12'));var hardwareService=require(_0xb819('0x13'));var logger=require(_0xb819('0x14'))(_0xb819('0x15'));var utils=require(_0xb819('0x16'));var config=require(_0xb819('0x17'));var licenseUtil=require(_0xb819('0x18'));var db=require(_0xb819('0x19'))['db'];function respondWithStatusCode(_0x112a0f,_0x43a9ed){_0x43a9ed=_0x43a9ed||0xcc;return function(_0x4e27bb){if(_0x4e27bb){return _0x112a0f[_0xb819('0x1a')](_0x43a9ed);}return _0x112a0f[_0xb819('0x1b')](_0x43a9ed)['end']();};}function respondWithResult(_0x32f5a,_0x1aebfa){_0x1aebfa=_0x1aebfa||0xc8;return function(_0x5f2d0f){if(_0x5f2d0f){return _0x32f5a['status'](_0x1aebfa)['json'](_0x5f2d0f);}};}function respondWithFilteredResult(_0x2bf57f,_0x5903ea){return function(_0x2266f6){if(_0x2266f6){var _0x526103=typeof _0x5903ea['offset']==='undefined'&&typeof _0x5903ea[_0xb819('0x1c')]===_0xb819('0x1d');var _0x1eb74f=_0x2266f6[_0xb819('0x1e')];var _0x18c385=_0x526103?0x0:_0x5903ea[_0xb819('0x1f')];var _0x5bf6c3=_0x526103?_0x2266f6['count']:_0x5903ea[_0xb819('0x1f')]+_0x5903ea['limit'];var _0x2bbce8;if(_0x5bf6c3>=_0x1eb74f){_0x5bf6c3=_0x1eb74f;_0x2bbce8=0xc8;}else{_0x2bbce8=0xce;}_0x2bf57f[_0xb819('0x1b')](_0x2bbce8);return _0x2bf57f[_0xb819('0x20')](_0xb819('0x21'),_0x18c385+'-'+_0x5bf6c3+'/'+_0x1eb74f)[_0xb819('0x22')](_0x2266f6);}return null;};}function patchUpdates(_0x40ff39){return function(_0x24c088){try{jsonpatch[_0xb819('0x23')](_0x24c088,_0x40ff39,!![]);}catch(_0xa35cc7){return BPromise['reject'](_0xa35cc7);}return _0x24c088['save']();};}function saveUpdates(_0x304bc5,_0x228868){return function(_0x31b7f3){if(_0x31b7f3){return _0x31b7f3['update'](_0x304bc5)['then'](function(_0x840ba){return _0x840ba;});}return null;};}function removeEntity(_0x44e610,_0x42a9df){return function(_0x12f162){if(_0x12f162){return _0x12f162[_0xb819('0x24')]()[_0xb819('0x25')](function(){var _0x1f1079=_0x12f162[_0xb819('0x26')]({'plain':!![]});var _0x8e0003=_0xb819('0x27');return db['UserProfileResource'][_0xb819('0x24')]({'where':{'type':_0x8e0003,'resourceId':_0x1f1079['id']}})[_0xb819('0x25')](function(){return _0x12f162;});})[_0xb819('0x25')](function(){_0x44e610['status'](0xcc)[_0xb819('0x28')]();});}};}function handleEntityNotFound(_0xd854f0,_0x539b42){return function(_0x2ef84f){if(!_0x2ef84f){_0xd854f0[_0xb819('0x1a')](0x194);}return _0x2ef84f;};}function handleError(_0xdf17d0,_0x8e31f9){_0x8e31f9=_0x8e31f9||0x1f4;return function(_0x3c56eb){logger[_0xb819('0x29')](_0x3c56eb[_0xb819('0x2a')]);if(_0x3c56eb[_0xb819('0x2b')]){delete _0x3c56eb[_0xb819('0x2b')];}_0xdf17d0[_0xb819('0x1b')](_0x8e31f9)[_0xb819('0x2c')](_0x3c56eb);};}exports[_0xb819('0x2d')]=function(_0x19e022,_0x19c34f){var _0xe52da2={},_0x56a312={},_0x3f435e={'count':0x0,'rows':[]};var _0x23b101=_[_0xb819('0x2e')](db[_0xb819('0x2f')]['rawAttributes'],function(_0x11619f){return{'name':_0x11619f[_0xb819('0x30')],'type':_0x11619f[_0xb819('0x31')][_0xb819('0x32')]};});_0x56a312[_0xb819('0x33')]=_[_0xb819('0x2e')](_0x23b101,'name');_0x56a312[_0xb819('0x34')]=_['keys'](_0x19e022['query']);_0x56a312[_0xb819('0x35')]=_[_0xb819('0x36')](_0x56a312[_0xb819('0x33')],_0x56a312[_0xb819('0x34')]);_0xe52da2[_0xb819('0x37')]=_[_0xb819('0x36')](_0x56a312[_0xb819('0x33')],qs['fields'](_0x19e022[_0xb819('0x34')]['fields']));_0xe52da2[_0xb819('0x37')]=_0xe52da2['attributes'][_0xb819('0x38')]?_0xe52da2[_0xb819('0x37')]:_0x56a312[_0xb819('0x33')];if(!_0x19e022[_0xb819('0x34')][_0xb819('0x39')](_0xb819('0x3a'))){_0xe52da2[_0xb819('0x1c')]=qs[_0xb819('0x1c')](_0x19e022['query'][_0xb819('0x1c')]);_0xe52da2[_0xb819('0x1f')]=qs[_0xb819('0x1f')](_0x19e022['query'][_0xb819('0x1f')]);}_0xe52da2['order']=qs['sort'](_0x19e022['query']['sort']);_0xe52da2[_0xb819('0x3b')]=qs[_0xb819('0x35')](_[_0xb819('0x3c')](_0x19e022['query'],_0x56a312[_0xb819('0x35')]),_0x23b101);if(_0x19e022[_0xb819('0x34')][_0xb819('0x3d')]){_0xe52da2[_0xb819('0x3b')]=_[_0xb819('0x3e')](_0xe52da2[_0xb819('0x3b')],{'$or':_[_0xb819('0x2e')](_0x23b101,function(_0x103e5c){if(_0x103e5c[_0xb819('0x31')]!==_0xb819('0x3f')){var _0x17ac68={};_0x17ac68[_0x103e5c['name']]={'$like':'%'+_0x19e022[_0xb819('0x34')][_0xb819('0x3d')]+'%'};return _0x17ac68;}})});}_0xe52da2=_[_0xb819('0x3e')]({},_0xe52da2,_0x19e022['options']);var _0x566a77={'where':_0xe52da2[_0xb819('0x3b')]};return db[_0xb819('0x2f')][_0xb819('0x1e')](_0x566a77)['then'](function(_0x40788b){_0x3f435e[_0xb819('0x1e')]=_0x40788b;if(_0x19e022[_0xb819('0x34')]['includeAll']){_0xe52da2[_0xb819('0x40')]=[{'all':!![]}];}return db[_0xb819('0x2f')][_0xb819('0x41')](_0xe52da2);})[_0xb819('0x25')](function(_0x3d7458){_0x3f435e[_0xb819('0x42')]=_0x3d7458;return _0x3f435e;})[_0xb819('0x25')](respondWithFilteredResult(_0x19c34f,_0xe52da2))[_0xb819('0x43')](handleError(_0x19c34f,null));};exports[_0xb819('0x44')]=function(_0x5a6d92,_0x2a4b4a){var _0x62019a={'raw':!![],'where':{'id':_0x5a6d92['params']['id']}},_0x29a625={};_0x29a625['model']=_[_0xb819('0x45')](db[_0xb819('0x2f')][_0xb819('0x46')]);_0x29a625[_0xb819('0x34')]=_[_0xb819('0x45')](_0x5a6d92[_0xb819('0x34')]);_0x29a625[_0xb819('0x35')]=_[_0xb819('0x36')](_0x29a625[_0xb819('0x33')],_0x29a625[_0xb819('0x34')]);_0x62019a[_0xb819('0x37')]=_[_0xb819('0x36')](_0x29a625['model'],qs['fields'](_0x5a6d92[_0xb819('0x34')][_0xb819('0x47')]));_0x62019a['attributes']=_0x62019a[_0xb819('0x37')][_0xb819('0x38')]?_0x62019a[_0xb819('0x37')]:_0x29a625[_0xb819('0x33')];if(_0x5a6d92['query'][_0xb819('0x48')]){_0x62019a[_0xb819('0x40')]=[{'all':!![]}];}_0x62019a=_[_0xb819('0x3e')]({},_0x62019a,_0x5a6d92[_0xb819('0x49')]);return db[_0xb819('0x2f')]['find'](_0x62019a)[_0xb819('0x25')](handleEntityNotFound(_0x2a4b4a,null))[_0xb819('0x25')](respondWithResult(_0x2a4b4a,null))[_0xb819('0x43')](handleError(_0x2a4b4a,null));};exports[_0xb819('0x4a')]=function(_0x2867df,_0x2e5bb7){return db[_0xb819('0x2f')][_0xb819('0x4a')](_0x2867df[_0xb819('0x4b')],{})[_0xb819('0x25')](function(_0x3d70dd){var _0x58d386=_0x2867df['user'][_0xb819('0x26')]({'plain':!![]});if(!_0x58d386)throw new Error(_0xb819('0x4c'));if(_0x58d386[_0xb819('0x4d')]===_0xb819('0x4e')){var _0x16b306=_0x3d70dd[_0xb819('0x26')]({'plain':!![]});var _0x4db54=_0xb819('0x27');return db[_0xb819('0x4f')][_0xb819('0x50')]({'where':{'name':_0x4db54,'userProfileId':_0x58d386['userProfileId']},'raw':!![]})[_0xb819('0x25')](function(_0x3d9544){if(_0x3d9544&&_0x3d9544['autoAssociation']===0x0){return db[_0xb819('0x51')][_0xb819('0x4a')]({'name':_0x16b306['name'],'resourceId':_0x16b306['id'],'type':_0x3d9544['name'],'sectionId':_0x3d9544['id']},{})[_0xb819('0x25')](function(){return _0x3d70dd;});}else{return _0x3d70dd;}})[_0xb819('0x43')](function(_0x58655b){logger[_0xb819('0x29')](_0xb819('0x52'),_0x58655b);throw _0x58655b;});}return _0x3d70dd;})[_0xb819('0x25')](respondWithResult(_0x2e5bb7,0xc9))[_0xb819('0x43')](handleError(_0x2e5bb7,null));};exports[_0xb819('0x53')]=function(_0x141e15,_0x13d822){if(_0x141e15['body']['id']){delete _0x141e15[_0xb819('0x4b')]['id'];}return db['SquareOdbc'][_0xb819('0x50')]({'where':{'id':_0x141e15['params']['id']}})[_0xb819('0x25')](handleEntityNotFound(_0x13d822,null))[_0xb819('0x25')](saveUpdates(_0x141e15[_0xb819('0x4b')],null))[_0xb819('0x25')](respondWithResult(_0x13d822,null))[_0xb819('0x43')](handleError(_0x13d822,null));};exports['destroy']=function(_0x537320,_0x34c401){return db[_0xb819('0x2f')][_0xb819('0x50')]({'where':{'id':_0x537320[_0xb819('0x54')]['id']}})['then'](handleEntityNotFound(_0x34c401,null))['then'](removeEntity(_0x34c401,null))[_0xb819('0x43')](handleError(_0x34c401,null));};exports[_0xb819('0x55')]=function(_0x408db6,_0x16ed20,_0x34a874){var _0x38e6a2;return db['SquareOdbc'][_0xb819('0x50')]({'where':{'id':_0x408db6[_0xb819('0x54')]['id']},'attributes':['id',_0xb819('0x56')]})[_0xb819('0x25')](handleEntityNotFound(_0x16ed20,null))['then'](function(_0x54b50e){if(_0x54b50e){var _0x5c7c2c=require('odbc')();_0x5c7c2c[_0xb819('0x57')](_0x54b50e[_0xb819('0x56')]);_0x5c7c2c[_0xb819('0x58')]();return _0x54b50e;}})[_0xb819('0x25')](respondWithResult(_0x16ed20,null))[_0xb819('0x43')](handleError(_0x16ed20,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 0f79806..9de49fd 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 _0x88aa=['moment','bluebird','path','rimraf','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x88aa,0x134));var _0xa88a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x88aa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa88a('0x0'));var util=require(_0xa88a('0x1'));var logger=require(_0xa88a('0x2'))(_0xa88a('0x3'));var moment=require(_0xa88a('0x4'));var BPromise=require(_0xa88a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa88a('0x6'));var rimraf=require(_0xa88a('0x7'));var config=require('../../config/environment');var attributes=require(_0xa88a('0x8'));module[_0xa88a('0x9')]=function(_0x2cc027,_0x12a74b){return _0x2cc027[_0xa88a('0xa')](_0xa88a('0xb'),attributes,{'tableName':_0xa88a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc2b=['define','SquareOdbc','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports'];(function(_0xdcebe,_0x4da037){var _0x4c6062=function(_0x5077c4){while(--_0x5077c4){_0xdcebe['push'](_0xdcebe['shift']());}};_0x4c6062(++_0x4da037);}(_0xdc2b,0x77));var _0xbdc2=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xdc2b[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0xbdc2('0x0'));var util=require('util');var logger=require(_0xbdc2('0x1'))(_0xbdc2('0x2'));var moment=require(_0xbdc2('0x3'));var BPromise=require(_0xbdc2('0x4'));var rp=require(_0xbdc2('0x5'));var fs=require('fs');var path=require(_0xbdc2('0x6'));var rimraf=require(_0xbdc2('0x7'));var config=require(_0xbdc2('0x8'));var attributes=require(_0xbdc2('0x9'));module[_0xbdc2('0xa')]=function(_0x134017,_0x3b2e51){return _0x134017[_0xbdc2('0xb')](_0xbdc2('0xc'),attributes,{'tableName':'square_odbc','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 3137dd2..d9986d5 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 _0x264b=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareOdbc','find','options','raw','where','attributes','include','model','map','util','ioredis','../../mysqldb'];(function(_0xc5a1a2,_0x49df81){var _0x5d3fe6=function(_0x3d443d){while(--_0x3d443d){_0xc5a1a2['push'](_0xc5a1a2['shift']());}};_0x5d3fe6(++_0x49df81);}(_0x264b,0x133));var _0xb264=function(_0x5a990f,_0x2cb2bb){_0x5a990f=_0x5a990f-0x0;var _0x393838=_0x264b[_0x5a990f];return _0x393838;};'use strict';var _=require('lodash');var util=require(_0xb264('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb264('0x1'));var db=require(_0xb264('0x2'))['db'];var utils=require(_0xb264('0x3'));var logger=require('../../config/logger')(_0xb264('0x4'));var config=require(_0xb264('0x5'));var jayson=require(_0xb264('0x6'));var client=jayson[_0xb264('0x7')][_0xb264('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23140e,_0x13b1d1,_0x455a0c){return new BPromise(function(_0x5d5b6e,_0x19fcdf){return client[_0xb264('0x9')](_0x23140e,_0x455a0c)[_0xb264('0xa')](function(_0x2e95fb){logger[_0xb264('0xb')](_0xb264('0xc'),_0x13b1d1,_0xb264('0xd'));logger[_0xb264('0xe')](_0xb264('0xf'),_0x13b1d1,_0xb264('0xd'),JSON[_0xb264('0x10')](_0x2e95fb));if(_0x2e95fb['error']){if(_0x2e95fb[_0xb264('0x11')][_0xb264('0x12')]===0x1f4){logger[_0xb264('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x13b1d1,_0x2e95fb[_0xb264('0x11')][_0xb264('0x13')]);return _0x19fcdf(_0x2e95fb[_0xb264('0x11')][_0xb264('0x13')]);}logger[_0xb264('0x11')](_0xb264('0xc'),_0x13b1d1,_0x2e95fb[_0xb264('0x11')][_0xb264('0x13')]);return _0x5d5b6e(_0x2e95fb['error'][_0xb264('0x13')]);}else{logger[_0xb264('0xb')](_0xb264('0xc'),_0x13b1d1,_0xb264('0xd'));_0x5d5b6e(_0x2e95fb[_0xb264('0x14')][_0xb264('0x13')]);}})[_0xb264('0x15')](function(_0x1e3515){logger[_0xb264('0x11')](_0xb264('0xc'),_0x13b1d1,_0x1e3515);_0x19fcdf(_0x1e3515);});});}exports[_0xb264('0x16')]=function(_0x326f13){var _0x397bb0=this;return new Promise(function(_0x19737c,_0x484bb4){return db['SquareOdbc'][_0xb264('0x17')]({'raw':_0x326f13['options']?_0x326f13[_0xb264('0x18')][_0xb264('0x19')]===undefined?!![]:![]:!![],'where':_0x326f13[_0xb264('0x18')]?_0x326f13[_0xb264('0x18')][_0xb264('0x1a')]||null:null,'attributes':_0x326f13[_0xb264('0x18')]?_0x326f13['options'][_0xb264('0x1b')]||null:null,'include':_0x326f13[_0xb264('0x18')]?_0x326f13[_0xb264('0x18')][_0xb264('0x1c')]?_['map'](_0x326f13[_0xb264('0x18')][_0xb264('0x1c')],function(_0x5a7f49){return{'model':db[_0x5a7f49[_0xb264('0x1d')]],'as':_0x5a7f49['as'],'attributes':_0x5a7f49['attributes'],'include':_0x5a7f49['include']?_[_0xb264('0x1e')](_0x5a7f49[_0xb264('0x1c')],function(_0x571c74){return{'model':db[_0x571c74[_0xb264('0x1d')]],'as':_0x571c74['as'],'attributes':_0x571c74['attributes'],'include':_0x571c74['include']?_[_0xb264('0x1e')](_0x571c74['include'],function(_0x56d39c){return{'model':db[_0x56d39c[_0xb264('0x1d')]],'as':_0x56d39c['as'],'attributes':_0x56d39c[_0xb264('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb264('0xa')](function(_0x7c11e1){logger[_0xb264('0xb')](_0xb264('0x16'),_0x326f13);logger[_0xb264('0xe')](_0xb264('0x16'),_0x326f13,JSON['stringify'](_0x7c11e1));_0x19737c(_0x7c11e1);})[_0xb264('0x15')](function(_0x3adf78){logger[_0xb264('0x11')](_0xb264('0x16'),_0x3adf78['message'],_0x326f13);_0x484bb4(_0x397bb0[_0xb264('0x11')](0x1f4,_0x3adf78[_0xb264('0x13')]));});});}; \ No newline at end of file +var _0x220b=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','SquareOdbc,\x20%s,\x20%s','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','attributes','map','model','include','debug','lodash','moment'];(function(_0x244c26,_0x4bbc7a){var _0x881ccd=function(_0x5a11f2){while(--_0x5a11f2){_0x244c26['push'](_0x244c26['shift']());}};_0x881ccd(++_0x4bbc7a);}(_0x220b,0x10c));var _0xb220=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0x220b[_0x43776a];return _0x18eb8f;};'use strict';var _=require(_0xb220('0x0'));var util=require('util');var moment=require(_0xb220('0x1'));var BPromise=require('bluebird');var rs=require(_0xb220('0x2'));var fs=require('fs');var Redis=require(_0xb220('0x3'));var db=require(_0xb220('0x4'))['db'];var utils=require(_0xb220('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb220('0x6'));var jayson=require(_0xb220('0x7'));var client=jayson[_0xb220('0x8')][_0xb220('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b6e93,_0x496492,_0x473636){return new BPromise(function(_0x3b7295,_0x13792c){return client[_0xb220('0xa')](_0x5b6e93,_0x473636)[_0xb220('0xb')](function(_0x5be036){logger[_0xb220('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x496492,_0xb220('0xd'));logger['debug'](_0xb220('0xe'),_0x496492,'request\x20sent',JSON[_0xb220('0xf')](_0x5be036));if(_0x5be036[_0xb220('0x10')]){if(_0x5be036[_0xb220('0x10')]['code']===0x1f4){logger[_0xb220('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x496492,_0x5be036['error'][_0xb220('0x11')]);return _0x13792c(_0x5be036['error'][_0xb220('0x11')]);}logger['error'](_0xb220('0x12'),_0x496492,_0x5be036[_0xb220('0x10')][_0xb220('0x11')]);return _0x3b7295(_0x5be036[_0xb220('0x10')][_0xb220('0x11')]);}else{logger[_0xb220('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x496492,_0xb220('0xd'));_0x3b7295(_0x5be036['result'][_0xb220('0x11')]);}})[_0xb220('0x13')](function(_0x3ce92f){logger['error'](_0xb220('0x12'),_0x496492,_0x3ce92f);_0x13792c(_0x3ce92f);});});}exports[_0xb220('0x14')]=function(_0x4c9387){var _0x2f9b91=this;return new Promise(function(_0x33e51e,_0x325d50){return db[_0xb220('0x15')][_0xb220('0x16')]({'raw':_0x4c9387[_0xb220('0x17')]?_0x4c9387[_0xb220('0x17')][_0xb220('0x18')]===undefined?!![]:![]:!![],'where':_0x4c9387['options']?_0x4c9387[_0xb220('0x17')]['where']||null:null,'attributes':_0x4c9387[_0xb220('0x17')]?_0x4c9387[_0xb220('0x17')][_0xb220('0x19')]||null:null,'include':_0x4c9387[_0xb220('0x17')]?_0x4c9387[_0xb220('0x17')]['include']?_[_0xb220('0x1a')](_0x4c9387[_0xb220('0x17')]['include'],function(_0x4fab60){return{'model':db[_0x4fab60[_0xb220('0x1b')]],'as':_0x4fab60['as'],'attributes':_0x4fab60[_0xb220('0x19')],'include':_0x4fab60['include']?_['map'](_0x4fab60[_0xb220('0x1c')],function(_0x5d2bb6){return{'model':db[_0x5d2bb6[_0xb220('0x1b')]],'as':_0x5d2bb6['as'],'attributes':_0x5d2bb6['attributes'],'include':_0x5d2bb6[_0xb220('0x1c')]?_['map'](_0x5d2bb6[_0xb220('0x1c')],function(_0x2396c1){return{'model':db[_0x2396c1[_0xb220('0x1b')]],'as':_0x2396c1['as'],'attributes':_0x2396c1[_0xb220('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb220('0xb')](function(_0x509313){logger[_0xb220('0xc')](_0xb220('0x14'),_0x4c9387);logger[_0xb220('0x1d')](_0xb220('0x14'),_0x4c9387,JSON['stringify'](_0x509313));_0x33e51e(_0x509313);})[_0xb220('0x13')](function(_0x5e7030){logger[_0xb220('0x10')](_0xb220('0x14'),_0x5e7030['message'],_0x4c9387);_0x325d50(_0x2f9b91['error'](0x1f4,_0x5e7030['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index f14f0c0..3d93885 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 _0x48b4=['get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x48b4,0xbf));var _0x448b=function(_0x21f2d6,_0xcd305f){_0x21f2d6=_0x21f2d6-0x0;var _0x21ee15=_0x48b4[_0x21f2d6];return _0x21ee15;};'use strict';var multer=require('multer');var util=require(_0x448b('0x0'));var path=require(_0x448b('0x1'));var timeout=require(_0x448b('0x2'));var express=require(_0x448b('0x3'));var router=express[_0x448b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x448b('0x5'));var config=require(_0x448b('0x6'));var controller=require('./squareProject.controller');router[_0x448b('0x7')]('/',auth['isAuthenticated'](),controller[_0x448b('0x8')]);router[_0x448b('0x7')](_0x448b('0x9'),auth[_0x448b('0xa')](),controller[_0x448b('0xb')]);router[_0x448b('0xc')]('/',auth['isAuthenticated'](),controller[_0x448b('0xd')]);router['put'](_0x448b('0x9'),auth[_0x448b('0xa')](),controller[_0x448b('0xe')]);router[_0x448b('0xf')](_0x448b('0x9'),auth[_0x448b('0xa')](),controller[_0x448b('0x10')]);module[_0x448b('0x11')]=router; \ No newline at end of file +var _0x8775=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','/:id'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0x8775,0x1e3));var _0x5877=function(_0x56f6c0,_0x37c097){_0x56f6c0=_0x56f6c0-0x0;var _0x249342=_0x8775[_0x56f6c0];return _0x249342;};'use strict';var multer=require(_0x5877('0x0'));var util=require(_0x5877('0x1'));var path=require(_0x5877('0x2'));var timeout=require(_0x5877('0x3'));var express=require('express');var router=express[_0x5877('0x4')]();var fs_extra=require(_0x5877('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5877('0x6'));var controller=require('./squareProject.controller');router[_0x5877('0x7')]('/',auth[_0x5877('0x8')](),controller['index']);router[_0x5877('0x7')](_0x5877('0x9'),auth[_0x5877('0x8')](),controller['show']);router[_0x5877('0xa')]('/',auth[_0x5877('0x8')](),controller[_0x5877('0xb')]);router[_0x5877('0xc')](_0x5877('0x9'),auth[_0x5877('0x8')](),controller[_0x5877('0xd')]);router[_0x5877('0xe')]('/:id',auth[_0x5877('0x8')](),controller[_0x5877('0xf')]);module[_0x5877('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index be69370..c13e9c7 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 _0x4bc7=['getDataValue','preproduction','toString','production','DATE','STRING','name','BLOB','long'];(function(_0x3308ca,_0x3fe87e){var _0x340e93=function(_0x1560bc){while(--_0x1560bc){_0x3308ca['push'](_0x3308ca['shift']());}};_0x340e93(++_0x3fe87e);}(_0x4bc7,0x188));var _0x74bc=function(_0x540c49,_0x3e88d9){_0x540c49=_0x540c49-0x0;var _0x390f69=_0x4bc7[_0x540c49];return _0x390f69;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x74bc('0x0')],'unique':_0x74bc('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x74bc('0x2')](_0x74bc('0x3')),'get':function(){if(this[_0x74bc('0x4')](_0x74bc('0x5'))){return this[_0x74bc('0x4')]('preproduction')[_0x74bc('0x6')]('utf8');}}},'production':{'type':Sequelize[_0x74bc('0x2')](_0x74bc('0x3')),'get':function(){if(this[_0x74bc('0x4')]('production')){return this['getDataValue'](_0x74bc('0x7'))[_0x74bc('0x6')]('utf8');}}},'savedAt':{'type':Sequelize[_0x74bc('0x8')]},'publishedAt':{'type':Sequelize[_0x74bc('0x8')]}}; \ No newline at end of file +var _0x0a39=['exports','name','STRING','TEXT','BLOB','long','getDataValue','preproduction','production','toString','utf8','DATE','sequelize'];(function(_0x5f0d43,_0x4b5ab9){var _0x4c79f8=function(_0x13f4fa){while(--_0x13f4fa){_0x5f0d43['push'](_0x5f0d43['shift']());}};_0x4c79f8(++_0x4b5ab9);}(_0x0a39,0x144));var _0x90a3=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0a39[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x90a3('0x0'));module[_0x90a3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x90a3('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x90a3('0x3')]},'notes':{'type':Sequelize[_0x90a3('0x4')]},'preproduction':{'type':Sequelize[_0x90a3('0x5')](_0x90a3('0x6')),'get':function(){if(this[_0x90a3('0x7')](_0x90a3('0x8'))){return this[_0x90a3('0x7')](_0x90a3('0x8'))['toString']('utf8');}}},'production':{'type':Sequelize[_0x90a3('0x5')](_0x90a3('0x6')),'get':function(){if(this['getDataValue']('production')){return this[_0x90a3('0x7')](_0x90a3('0x9'))[_0x90a3('0xa')](_0x90a3('0xb'));}}},'savedAt':{'type':Sequelize[_0x90a3('0xc')]},'publishedAt':{'type':Sequelize[_0x90a3('0xc')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index eacaa0b..d17416c 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 _0xd837=['publish','agi','stringify','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','include','create','user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','pick','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','json','limit','undefined','offset','count','set','Content-Range','update','destroy','then','get','SquareProjects','UserProfileResource'];(function(_0x3c7d53,_0x2826d0){var _0x2c8387=function(_0x21f0e8){while(--_0x21f0e8){_0x3c7d53['push'](_0x3c7d53['shift']());}};_0x2c8387(++_0x2826d0);}(_0xd837,0x1a1));var _0x7d83=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd837[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7d83('0x0'));var Redis=require(_0x7d83('0x1'));var qs=require(_0x7d83('0x2'));var logger=require(_0x7d83('0x3'))(_0x7d83('0x4'));var config=require(_0x7d83('0x5'));var db=require(_0x7d83('0x6'))['db'];config[_0x7d83('0x7')]=_[_0x7d83('0x8')](config[_0x7d83('0x7')],{'host':_0x7d83('0x9'),'port':0x18eb});var socket=require(_0x7d83('0xa'))(new Redis(config[_0x7d83('0x7')]));require(_0x7d83('0xb'))[_0x7d83('0xc')](socket);function respondWithResult(_0xb9b8c2,_0x4aa53d){_0x4aa53d=_0x4aa53d||0xc8;return function(_0x16d409){if(_0x16d409){return _0xb9b8c2[_0x7d83('0xd')](_0x4aa53d)[_0x7d83('0xe')](_0x16d409);}};}function respondWithFilteredResult(_0xb993fe,_0x47260d){return function(_0x400b60){if(_0x400b60){var _0x3b30eb=typeof _0x47260d['offset']==='undefined'&&typeof _0x47260d[_0x7d83('0xf')]===_0x7d83('0x10');var _0x1eaae1=_0x400b60['count'];var _0x4eb17b=_0x3b30eb?0x0:_0x47260d[_0x7d83('0x11')];var _0x56c892=_0x3b30eb?_0x400b60[_0x7d83('0x12')]:_0x47260d[_0x7d83('0x11')]+_0x47260d['limit'];var _0x1a228a;if(_0x56c892>=_0x1eaae1){_0x56c892=_0x1eaae1;_0x1a228a=0xc8;}else{_0x1a228a=0xce;}_0xb993fe[_0x7d83('0xd')](_0x1a228a);return _0xb993fe[_0x7d83('0x13')](_0x7d83('0x14'),_0x4eb17b+'-'+_0x56c892+'/'+_0x1eaae1)[_0x7d83('0xe')](_0x400b60);}return null;};}function saveUpdates(_0xfa283d){return function(_0x4f21bd){if(_0x4f21bd){return _0x4f21bd[_0x7d83('0x15')](_0xfa283d)['then'](function(_0x33ce3f){return _0x33ce3f;});}return null;};}function removeEntity(_0x20d17b){return function(_0x515f4c){if(_0x515f4c){return _0x515f4c[_0x7d83('0x16')]()[_0x7d83('0x17')](function(){var _0x492e1c=_0x515f4c[_0x7d83('0x18')]({'plain':!![]});var _0x4772ca=_0x7d83('0x19');return db[_0x7d83('0x1a')]['destroy']({'where':{'type':_0x4772ca,'resourceId':_0x492e1c['id']}})['then'](function(){return _0x515f4c;});})[_0x7d83('0x17')](function(){var _0x4aad51=new Redis(config['redis']);_0x4aad51[_0x7d83('0x1b')](_0x7d83('0x1c'),JSON[_0x7d83('0x1d')]({'id':_0x515f4c['id'],'deleted':!![]}));})[_0x7d83('0x17')](function(){_0x20d17b[_0x7d83('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x283bb0){return function(_0x29cbf0){if(!_0x29cbf0){_0x283bb0[_0x7d83('0x1e')](0x194);}return _0x29cbf0;};}function handleError(_0xd85bed,_0x296592){_0x296592=_0x296592||0x1f4;return function(_0x4c8f23){logger[_0x7d83('0x1f')](_0x4c8f23[_0x7d83('0x20')]);if(_0x4c8f23['name']){delete _0x4c8f23[_0x7d83('0x21')];}_0xd85bed[_0x7d83('0xd')](_0x296592)[_0x7d83('0x22')](_0x4c8f23);};}exports[_0x7d83('0x23')]=function(_0x26dbec,_0x691562){var _0xc73d7e={},_0x14db7f={},_0x397824={'count':0x0,'rows':[]};var _0x26dfff=_[_0x7d83('0x24')](db[_0x7d83('0x25')][_0x7d83('0x26')],function(_0xdec98e){return{'name':_0xdec98e[_0x7d83('0x27')],'type':_0xdec98e[_0x7d83('0x28')][_0x7d83('0x29')]};});_0x14db7f[_0x7d83('0x2a')]=_['map'](_0x26dfff,_0x7d83('0x21'));_0x14db7f[_0x7d83('0x2b')]=_[_0x7d83('0x2c')](_0x26dbec['query']);_0x14db7f[_0x7d83('0x2d')]=_['intersection'](_0x14db7f[_0x7d83('0x2a')],_0x14db7f[_0x7d83('0x2b')]);_0xc73d7e[_0x7d83('0x2e')]=_[_0x7d83('0x2f')](_0x14db7f[_0x7d83('0x2a')],qs[_0x7d83('0x30')](_0x26dbec[_0x7d83('0x2b')][_0x7d83('0x30')]));_0xc73d7e['attributes']=_0xc73d7e[_0x7d83('0x2e')][_0x7d83('0x31')]?_0xc73d7e[_0x7d83('0x2e')]:_0x14db7f[_0x7d83('0x2a')];if(!_0x26dbec[_0x7d83('0x2b')][_0x7d83('0x32')](_0x7d83('0x33'))){_0xc73d7e[_0x7d83('0xf')]=qs[_0x7d83('0xf')](_0x26dbec['query'][_0x7d83('0xf')]);_0xc73d7e['offset']=qs['offset'](_0x26dbec[_0x7d83('0x2b')]['offset']);}_0xc73d7e[_0x7d83('0x34')]=qs[_0x7d83('0x35')](_0x26dbec[_0x7d83('0x2b')]['sort']);_0xc73d7e['where']=qs[_0x7d83('0x2d')](_['pick'](_0x26dbec[_0x7d83('0x2b')],_0x14db7f[_0x7d83('0x2d')]),_0x26dfff);if(_0x26dbec[_0x7d83('0x2b')]['filter']){_0xc73d7e[_0x7d83('0x36')]=_[_0x7d83('0x37')](_0xc73d7e[_0x7d83('0x36')],{'$or':_[_0x7d83('0x24')](_0x26dfff,function(_0x8a0332){if(_0x8a0332[_0x7d83('0x28')]!==_0x7d83('0x38')){var _0x3cb2cc={};_0x3cb2cc[_0x8a0332[_0x7d83('0x21')]]={'$like':'%'+_0x26dbec[_0x7d83('0x2b')][_0x7d83('0x39')]+'%'};return _0x3cb2cc;}})});}_0xc73d7e=_[_0x7d83('0x37')]({},_0xc73d7e,_0x26dbec[_0x7d83('0x3a')]);var _0x2f3617={'where':_0xc73d7e[_0x7d83('0x36')]};return db[_0x7d83('0x25')][_0x7d83('0x12')](_0x2f3617)['then'](function(_0x4947b2){_0x397824['count']=_0x4947b2;if(_0x26dbec['query']['includeAll']){_0xc73d7e['include']=[{'all':!![]}];}return db[_0x7d83('0x25')][_0x7d83('0x3b')](_0xc73d7e);})[_0x7d83('0x17')](function(_0x5672f8){_0x397824[_0x7d83('0x3c')]=_0x5672f8;return _0x397824;})[_0x7d83('0x17')](respondWithFilteredResult(_0x691562,_0xc73d7e))[_0x7d83('0x3d')](handleError(_0x691562,null));};exports[_0x7d83('0x3e')]=function(_0x444b39,_0x439120){var _0x432d5e={'raw':![],'where':{'id':_0x444b39[_0x7d83('0x3f')]['id']}},_0x52a9cd={};_0x52a9cd[_0x7d83('0x2a')]=_[_0x7d83('0x2c')](db[_0x7d83('0x25')][_0x7d83('0x26')]);_0x52a9cd['query']=_['keys'](_0x444b39[_0x7d83('0x2b')]);_0x52a9cd[_0x7d83('0x2d')]=_[_0x7d83('0x2f')](_0x52a9cd[_0x7d83('0x2a')],_0x52a9cd[_0x7d83('0x2b')]);_0x432d5e[_0x7d83('0x2e')]=_[_0x7d83('0x2f')](_0x52a9cd[_0x7d83('0x2a')],qs['fields'](_0x444b39[_0x7d83('0x2b')][_0x7d83('0x30')]));_0x432d5e[_0x7d83('0x2e')]=_0x432d5e['attributes'][_0x7d83('0x31')]?_0x432d5e['attributes']:_0x52a9cd[_0x7d83('0x2a')];if(_0x444b39['query']['includeAll']){_0x432d5e[_0x7d83('0x40')]=[{'all':!![]}];}_0x432d5e=_['merge']({},_0x432d5e,_0x444b39[_0x7d83('0x3a')]);return db['SquareProject']['find'](_0x432d5e)[_0x7d83('0x17')](handleEntityNotFound(_0x439120,null))['then'](respondWithResult(_0x439120,null))['catch'](handleError(_0x439120,null));};exports[_0x7d83('0x41')]=function(_0x1172e2,_0x46fba1){return db['SquareProject'][_0x7d83('0x41')](_0x1172e2['body'],{})[_0x7d83('0x17')](function(_0x3ea787){var _0x420217=_0x1172e2[_0x7d83('0x42')][_0x7d83('0x18')]({'plain':!![]});if(!_0x420217)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x420217[_0x7d83('0x43')]===_0x7d83('0x42')){var _0x4363af=_0x3ea787[_0x7d83('0x18')]({'plain':!![]});var _0x16eb7a='SquareProjects';return db['UserProfileSection'][_0x7d83('0x44')]({'where':{'name':_0x16eb7a,'userProfileId':_0x420217['userProfileId']},'raw':!![]})[_0x7d83('0x17')](function(_0x4cce2d){if(_0x4cce2d&&_0x4cce2d[_0x7d83('0x45')]===0x0){return db['UserProfileResource']['create']({'name':_0x4363af[_0x7d83('0x21')],'resourceId':_0x4363af['id'],'type':_0x4cce2d[_0x7d83('0x21')],'sectionId':_0x4cce2d['id']},{})['then'](function(){return _0x3ea787;});}else{return _0x3ea787;}})[_0x7d83('0x3d')](function(_0x1f0e9d){logger[_0x7d83('0x1f')](_0x7d83('0x46'),_0x1f0e9d);throw _0x1f0e9d;});}return _0x3ea787;})[_0x7d83('0x17')](respondWithResult(_0x46fba1,0xc9))[_0x7d83('0x3d')](handleError(_0x46fba1,null));};exports[_0x7d83('0x15')]=function(_0x51d26f,_0x1f18b2){if(_0x51d26f['body']['id']){delete _0x51d26f[_0x7d83('0x47')]['id'];}return db[_0x7d83('0x25')][_0x7d83('0x44')]({'where':{'id':_0x51d26f[_0x7d83('0x3f')]['id']}})[_0x7d83('0x17')](handleEntityNotFound(_0x1f18b2,null))['then'](saveUpdates(_0x51d26f[_0x7d83('0x47')],null))[_0x7d83('0x17')](function(_0x20fbf6){if(!_0x20fbf6)return;var _0x5b8b36=_0x20fbf6['get']({'plain':!![]});return _0x5b8b36;})['then'](function(_0x31685d){var _0x2fcdc7=new Redis(config[_0x7d83('0x7')]);_0x2fcdc7[_0x7d83('0x1b')]('agi',JSON['stringify'](_[_0x7d83('0x48')](_0x31685d,['id',_0x7d83('0x21'),_0x7d83('0x49')])));return _0x31685d;})[_0x7d83('0x17')](respondWithResult(_0x1f18b2,null))[_0x7d83('0x3d')](handleError(_0x1f18b2,null));};exports[_0x7d83('0x16')]=function(_0xbf8b68,_0x58f8b3){return db[_0x7d83('0x25')][_0x7d83('0x44')]({'where':{'id':_0xbf8b68['params']['id']}})[_0x7d83('0x17')](handleEntityNotFound(_0x58f8b3,null))[_0x7d83('0x17')](removeEntity(_0x58f8b3,null))[_0x7d83('0x3d')](handleError(_0x58f8b3,null));}; \ No newline at end of file +var _0x63cf=['../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','status','json','offset','undefined','limit','count','set','update','then','destroy','get','UserProfileResource','publish','agi','end','sendStatus','error','stack','name','send','index','SquareProject','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','options','includeAll','include','findAll','show','merge','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','params','production','ioredis','../../components/parsers/qs'];(function(_0x217189,_0x41a001){var _0x4089d2=function(_0x1de9fb){while(--_0x1de9fb){_0x217189['push'](_0x217189['shift']());}};_0x4089d2(++_0x41a001);}(_0x63cf,0x106));var _0xf63c=function(_0x5678b5,_0x1c4aa8){_0x5678b5=_0x5678b5-0x0;var _0x4c09a5=_0x63cf[_0x5678b5];return _0x4c09a5;};'use strict';var _=require('lodash');var Redis=require(_0xf63c('0x0'));var qs=require(_0xf63c('0x1'));var logger=require('../../config/logger')('api');var config=require(_0xf63c('0x2'));var db=require(_0xf63c('0x3'))['db'];config[_0xf63c('0x4')]=_['defaults'](config['redis'],{'host':_0xf63c('0x5'),'port':0x18eb});var socket=require(_0xf63c('0x6'))(new Redis(config[_0xf63c('0x4')]));require('./squareProject.socket')['register'](socket);function respondWithResult(_0x503b1e,_0x29333c){_0x29333c=_0x29333c||0xc8;return function(_0x54d9ff){if(_0x54d9ff){return _0x503b1e[_0xf63c('0x7')](_0x29333c)[_0xf63c('0x8')](_0x54d9ff);}};}function respondWithFilteredResult(_0x35f85f,_0x37f27e){return function(_0x5a5fa1){if(_0x5a5fa1){var _0x16988a=typeof _0x37f27e[_0xf63c('0x9')]===_0xf63c('0xa')&&typeof _0x37f27e[_0xf63c('0xb')]===_0xf63c('0xa');var _0x14cb73=_0x5a5fa1['count'];var _0x405efa=_0x16988a?0x0:_0x37f27e[_0xf63c('0x9')];var _0x1f4975=_0x16988a?_0x5a5fa1[_0xf63c('0xc')]:_0x37f27e['offset']+_0x37f27e[_0xf63c('0xb')];var _0x5372f1;if(_0x1f4975>=_0x14cb73){_0x1f4975=_0x14cb73;_0x5372f1=0xc8;}else{_0x5372f1=0xce;}_0x35f85f[_0xf63c('0x7')](_0x5372f1);return _0x35f85f[_0xf63c('0xd')]('Content-Range',_0x405efa+'-'+_0x1f4975+'/'+_0x14cb73)[_0xf63c('0x8')](_0x5a5fa1);}return null;};}function saveUpdates(_0x34014d){return function(_0x40cd40){if(_0x40cd40){return _0x40cd40[_0xf63c('0xe')](_0x34014d)[_0xf63c('0xf')](function(_0x4af7e2){return _0x4af7e2;});}return null;};}function removeEntity(_0x126f32){return function(_0x5a4e91){if(_0x5a4e91){return _0x5a4e91[_0xf63c('0x10')]()[_0xf63c('0xf')](function(){var _0x3ee013=_0x5a4e91[_0xf63c('0x11')]({'plain':!![]});var _0x254819='SquareProjects';return db[_0xf63c('0x12')][_0xf63c('0x10')]({'where':{'type':_0x254819,'resourceId':_0x3ee013['id']}})[_0xf63c('0xf')](function(){return _0x5a4e91;});})['then'](function(){var _0x5e2483=new Redis(config[_0xf63c('0x4')]);_0x5e2483[_0xf63c('0x13')](_0xf63c('0x14'),JSON['stringify']({'id':_0x5a4e91['id'],'deleted':!![]}));})[_0xf63c('0xf')](function(){_0x126f32[_0xf63c('0x7')](0xcc)[_0xf63c('0x15')]();});}};}function handleEntityNotFound(_0xdcbea8){return function(_0x4a2a3c){if(!_0x4a2a3c){_0xdcbea8[_0xf63c('0x16')](0x194);}return _0x4a2a3c;};}function handleError(_0x42b512,_0x2efae0){_0x2efae0=_0x2efae0||0x1f4;return function(_0x12a97b){logger[_0xf63c('0x17')](_0x12a97b[_0xf63c('0x18')]);if(_0x12a97b[_0xf63c('0x19')]){delete _0x12a97b[_0xf63c('0x19')];}_0x42b512[_0xf63c('0x7')](_0x2efae0)[_0xf63c('0x1a')](_0x12a97b);};}exports[_0xf63c('0x1b')]=function(_0x450ec0,_0x36e9df){var _0x45b870={},_0x5710c9={},_0x26bc39={'count':0x0,'rows':[]};var _0x35459=_['map'](db[_0xf63c('0x1c')][_0xf63c('0x1d')],function(_0x43bc3b){return{'name':_0x43bc3b[_0xf63c('0x1e')],'type':_0x43bc3b['type'][_0xf63c('0x1f')]};});_0x5710c9[_0xf63c('0x20')]=_[_0xf63c('0x21')](_0x35459,_0xf63c('0x19'));_0x5710c9[_0xf63c('0x22')]=_[_0xf63c('0x23')](_0x450ec0[_0xf63c('0x22')]);_0x5710c9[_0xf63c('0x24')]=_[_0xf63c('0x25')](_0x5710c9[_0xf63c('0x20')],_0x5710c9[_0xf63c('0x22')]);_0x45b870['attributes']=_[_0xf63c('0x25')](_0x5710c9[_0xf63c('0x20')],qs[_0xf63c('0x26')](_0x450ec0[_0xf63c('0x22')]['fields']));_0x45b870['attributes']=_0x45b870[_0xf63c('0x27')][_0xf63c('0x28')]?_0x45b870[_0xf63c('0x27')]:_0x5710c9[_0xf63c('0x20')];if(!_0x450ec0[_0xf63c('0x22')][_0xf63c('0x29')](_0xf63c('0x2a'))){_0x45b870[_0xf63c('0xb')]=qs['limit'](_0x450ec0[_0xf63c('0x22')][_0xf63c('0xb')]);_0x45b870[_0xf63c('0x9')]=qs[_0xf63c('0x9')](_0x450ec0[_0xf63c('0x22')][_0xf63c('0x9')]);}_0x45b870[_0xf63c('0x2b')]=qs[_0xf63c('0x2c')](_0x450ec0[_0xf63c('0x22')][_0xf63c('0x2c')]);_0x45b870['where']=qs['filters'](_[_0xf63c('0x2d')](_0x450ec0[_0xf63c('0x22')],_0x5710c9['filters']),_0x35459);if(_0x450ec0['query']['filter']){_0x45b870[_0xf63c('0x2e')]=_['merge'](_0x45b870[_0xf63c('0x2e')],{'$or':_['map'](_0x35459,function(_0xddf4fa){if(_0xddf4fa['type']!==_0xf63c('0x2f')){var _0x532777={};_0x532777[_0xddf4fa[_0xf63c('0x19')]]={'$like':'%'+_0x450ec0[_0xf63c('0x22')][_0xf63c('0x30')]+'%'};return _0x532777;}})});}_0x45b870=_['merge']({},_0x45b870,_0x450ec0[_0xf63c('0x31')]);var _0x3835e1={'where':_0x45b870[_0xf63c('0x2e')]};return db[_0xf63c('0x1c')]['count'](_0x3835e1)[_0xf63c('0xf')](function(_0x2b2f70){_0x26bc39[_0xf63c('0xc')]=_0x2b2f70;if(_0x450ec0[_0xf63c('0x22')][_0xf63c('0x32')]){_0x45b870[_0xf63c('0x33')]=[{'all':!![]}];}return db[_0xf63c('0x1c')][_0xf63c('0x34')](_0x45b870);})[_0xf63c('0xf')](function(_0x5cae0c){_0x26bc39['rows']=_0x5cae0c;return _0x26bc39;})[_0xf63c('0xf')](respondWithFilteredResult(_0x36e9df,_0x45b870))['catch'](handleError(_0x36e9df,null));};exports[_0xf63c('0x35')]=function(_0x39bef8,_0x49647e){var _0x11c84a={'raw':![],'where':{'id':_0x39bef8['params']['id']}},_0x35d548={};_0x35d548[_0xf63c('0x20')]=_[_0xf63c('0x23')](db[_0xf63c('0x1c')][_0xf63c('0x1d')]);_0x35d548[_0xf63c('0x22')]=_[_0xf63c('0x23')](_0x39bef8[_0xf63c('0x22')]);_0x35d548[_0xf63c('0x24')]=_['intersection'](_0x35d548[_0xf63c('0x20')],_0x35d548[_0xf63c('0x22')]);_0x11c84a[_0xf63c('0x27')]=_[_0xf63c('0x25')](_0x35d548[_0xf63c('0x20')],qs[_0xf63c('0x26')](_0x39bef8[_0xf63c('0x22')]['fields']));_0x11c84a[_0xf63c('0x27')]=_0x11c84a[_0xf63c('0x27')][_0xf63c('0x28')]?_0x11c84a[_0xf63c('0x27')]:_0x35d548[_0xf63c('0x20')];if(_0x39bef8['query'][_0xf63c('0x32')]){_0x11c84a[_0xf63c('0x33')]=[{'all':!![]}];}_0x11c84a=_[_0xf63c('0x36')]({},_0x11c84a,_0x39bef8['options']);return db['SquareProject'][_0xf63c('0x37')](_0x11c84a)['then'](handleEntityNotFound(_0x49647e,null))[_0xf63c('0xf')](respondWithResult(_0x49647e,null))[_0xf63c('0x38')](handleError(_0x49647e,null));};exports[_0xf63c('0x39')]=function(_0x541caf,_0xfd1a60){return db[_0xf63c('0x1c')]['create'](_0x541caf[_0xf63c('0x3a')],{})[_0xf63c('0xf')](function(_0x2f8844){var _0x57ccbd=_0x541caf[_0xf63c('0x3b')][_0xf63c('0x11')]({'plain':!![]});if(!_0x57ccbd)throw new Error(_0xf63c('0x3c'));if(_0x57ccbd[_0xf63c('0x3d')]===_0xf63c('0x3b')){var _0x46aabf=_0x2f8844[_0xf63c('0x11')]({'plain':!![]});var _0x5d934b=_0xf63c('0x3e');return db[_0xf63c('0x3f')]['find']({'where':{'name':_0x5d934b,'userProfileId':_0x57ccbd['userProfileId']},'raw':!![]})[_0xf63c('0xf')](function(_0x5491b6){if(_0x5491b6&&_0x5491b6['autoAssociation']===0x0){return db[_0xf63c('0x12')][_0xf63c('0x39')]({'name':_0x46aabf['name'],'resourceId':_0x46aabf['id'],'type':_0x5491b6[_0xf63c('0x19')],'sectionId':_0x5491b6['id']},{})[_0xf63c('0xf')](function(){return _0x2f8844;});}else{return _0x2f8844;}})[_0xf63c('0x38')](function(_0x1390d0){logger[_0xf63c('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1390d0);throw _0x1390d0;});}return _0x2f8844;})[_0xf63c('0xf')](respondWithResult(_0xfd1a60,0xc9))[_0xf63c('0x38')](handleError(_0xfd1a60,null));};exports[_0xf63c('0xe')]=function(_0x34f2ee,_0x100fe8){if(_0x34f2ee[_0xf63c('0x3a')]['id']){delete _0x34f2ee[_0xf63c('0x3a')]['id'];}return db['SquareProject'][_0xf63c('0x37')]({'where':{'id':_0x34f2ee[_0xf63c('0x40')]['id']}})['then'](handleEntityNotFound(_0x100fe8,null))[_0xf63c('0xf')](saveUpdates(_0x34f2ee[_0xf63c('0x3a')],null))[_0xf63c('0xf')](function(_0x58c5da){if(!_0x58c5da)return;var _0x4ef786=_0x58c5da['get']({'plain':!![]});return _0x4ef786;})[_0xf63c('0xf')](function(_0x18a1ad){var _0x3c5e3a=new Redis(config['redis']);_0x3c5e3a[_0xf63c('0x13')]('agi',JSON['stringify'](_['pick'](_0x18a1ad,['id',_0xf63c('0x19'),_0xf63c('0x41')])));return _0x18a1ad;})['then'](respondWithResult(_0x100fe8,null))[_0xf63c('0x38')](handleError(_0x100fe8,null));};exports[_0xf63c('0x10')]=function(_0x535a8c,_0x16c702){return db[_0xf63c('0x1c')]['find']({'where':{'id':_0x535a8c[_0xf63c('0x40')]['id']}})['then'](handleEntityNotFound(_0x16c702,null))[_0xf63c('0xf')](removeEntity(_0x16c702,null))['catch'](handleError(_0x16c702,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 3203d6f..cc0a3ca 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 _0x73fb=['events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x20176f,_0x331400){var _0x302d10=function(_0x356bd3){while(--_0x356bd3){_0x20176f['push'](_0x20176f['shift']());}};_0x302d10(++_0x331400);}(_0x73fb,0xc8));var _0xb73f=function(_0x2fe53d,_0x16d382){_0x2fe53d=_0x2fe53d-0x0;var _0x1d9647=_0x73fb[_0x2fe53d];return _0x1d9647;};'use strict';var EventEmitter=require(_0xb73f('0x0'));var SquareProject=require(_0xb73f('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xb73f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb73f('0x3'),'afterDestroy':_0xb73f('0x4')};function emitEvent(_0x592880){return function(_0x4b40dc,_0x5d900b,_0x26b4a6){SquareProjectEvents['emit'](_0x592880+':'+_0x4b40dc['id'],_0x4b40dc);SquareProjectEvents[_0xb73f('0x5')](_0x592880,_0x4b40dc);_0x26b4a6(null);};}for(var e in events){if(events[_0xb73f('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xb73f('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xa923=['save','update','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x2368e4,_0x449a78){var _0x5acaaf=function(_0x22e8a4){while(--_0x22e8a4){_0x2368e4['push'](_0x2368e4['shift']());}};_0x5acaaf(++_0x449a78);}(_0xa923,0x10d));var _0x3a92=function(_0x4e633e,_0x37f662){_0x4e633e=_0x4e633e-0x0;var _0x728373=_0xa923[_0x4e633e];return _0x728373;};'use strict';var EventEmitter=require(_0x3a92('0x0'));var SquareProject=require(_0x3a92('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x3a92('0x2')](0x0);var events={'afterCreate':_0x3a92('0x3'),'afterUpdate':_0x3a92('0x4'),'afterDestroy':'remove'};function emitEvent(_0x141055){return function(_0x55b167,_0x5f0814,_0x5f1616){SquareProjectEvents[_0x3a92('0x5')](_0x141055+':'+_0x55b167['id'],_0x55b167);SquareProjectEvents[_0x3a92('0x5')](_0x141055,_0x55b167);_0x5f1616(null);};}for(var e in events){if(events[_0x3a92('0x6')](e)){var event=events[e];SquareProject[_0x3a92('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index b2c0bed..c602434 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 _0x2ee6=['production','util','../../config/logger','api','moment','bluebird','path','rimraf','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1f49ee,_0xc02fdd){var _0xfac4c=function(_0x39d0a5){while(--_0x39d0a5){_0x1f49ee['push'](_0x1f49ee['shift']());}};_0xfac4c(++_0xc02fdd);}(_0x2ee6,0xef));var _0x62ee=function(_0x566184,_0x315af0){_0x566184=_0x566184-0x0;var _0x5f36e5=_0x2ee6[_0x566184];return _0x5f36e5;};'use strict';var _=require('lodash');var util=require(_0x62ee('0x0'));var logger=require(_0x62ee('0x1'))(_0x62ee('0x2'));var moment=require(_0x62ee('0x3'));var BPromise=require(_0x62ee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x62ee('0x5'));var rimraf=require(_0x62ee('0x6'));var config=require('../../config/environment');var attributes=require(_0x62ee('0x7'));module[_0x62ee('0x8')]=function(_0x28cba1,_0x2672e7){return _0x28cba1[_0x62ee('0x9')](_0x62ee('0xa'),attributes,{'tableName':_0x62ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x492571,_0x55d2f7,_0x3d9a7b){if(_0x492571[_0x62ee('0xc')](_0x62ee('0xd'))){_0x492571['savedAt']=moment()[_0x62ee('0xe')](_0x62ee('0xf'));}if(_0x492571['changed'](_0x62ee('0x10'))){_0x492571['publishedAt']=moment()[_0x62ee('0xe')](_0x62ee('0xf'));}_0x3d9a7b(null,_0x492571);}}});}; \ No newline at end of file +var _0x883b=['publishedAt','util','../../config/logger','api','bluebird','path','./squareProject.attributes','exports','define','SquareProject','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x56e24c,_0x19e1df){var _0x3a7af8=function(_0x1d83bc){while(--_0x1d83bc){_0x56e24c['push'](_0x56e24c['shift']());}};_0x3a7af8(++_0x19e1df);}(_0x883b,0x143));var _0xb883=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x883b[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xb883('0x0'));var logger=require(_0xb883('0x1'))(_0xb883('0x2'));var moment=require('moment');var BPromise=require(_0xb883('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb883('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb883('0x5'));module[_0xb883('0x6')]=function(_0x360847,_0x1f9ba5){return _0x360847[_0xb883('0x7')](_0xb883('0x8'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xe47192,_0x331618,_0xacbbb8){if(_0xe47192[_0xb883('0x9')](_0xb883('0xa'))){_0xe47192['savedAt']=moment()[_0xb883('0xb')](_0xb883('0xc'));}if(_0xe47192[_0xb883('0x9')]('production')){_0xe47192[_0xb883('0xd')]=moment()[_0xb883('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0xacbbb8(null,_0xe47192);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 30dd893..0d25fa0 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 _0xab9e=['ioredis','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','where','limit','map','include','model','attributes','then','debug','stringify','catch','error','message','ShowSquareProject','find','info','lodash'];(function(_0x4c0ad9,_0x1444b3){var _0x400238=function(_0x4b66e3){while(--_0x4b66e3){_0x4c0ad9['push'](_0x4c0ad9['shift']());}};_0x400238(++_0x1444b3);}(_0xab9e,0x1b1));var _0xeab9=function(_0x377dad,_0x5eaa4e){_0x377dad=_0x377dad-0x0;var _0x4bebd4=_0xab9e[_0x377dad];return _0x4bebd4;};'use strict';var _=require(_0xeab9('0x0'));var Redis=require(_0xeab9('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0xeab9('0x2'))(_0xeab9('0x3'));var config=require(_0xeab9('0x4'));config[_0xeab9('0x5')]=_[_0xeab9('0x6')](config['redis'],{'host':_0xeab9('0x7'),'port':0x18eb});var socket=require(_0xeab9('0x8'))(new Redis(config[_0xeab9('0x5')]));require(_0xeab9('0x9'))[_0xeab9('0xa')](socket);exports[_0xeab9('0xb')]=function(_0x2ea7b5){var _0x5b91ae=this;return new Promise(function(_0x31dc02,_0x467e68){return db[_0xeab9('0xc')][_0xeab9('0xd')]({'raw':_0x2ea7b5[_0xeab9('0xe')]?_0x2ea7b5[_0xeab9('0xe')][_0xeab9('0xf')]===undefined?!![]:![]:!![],'where':_0x2ea7b5[_0xeab9('0xe')]?_0x2ea7b5[_0xeab9('0xe')][_0xeab9('0x10')]||null:null,'attributes':_0x2ea7b5[_0xeab9('0xe')]?_0x2ea7b5[_0xeab9('0xe')]['attributes']||null:null,'limit':_0x2ea7b5[_0xeab9('0xe')]?_0x2ea7b5[_0xeab9('0xe')][_0xeab9('0x11')]||null:null,'include':_0x2ea7b5['options']?_0x2ea7b5[_0xeab9('0xe')]['include']?_[_0xeab9('0x12')](_0x2ea7b5['options'][_0xeab9('0x13')],function(_0x5a7300){return{'model':db[_0x5a7300[_0xeab9('0x14')]],'as':_0x5a7300['as'],'attributes':_0x5a7300[_0xeab9('0x15')],'include':_0x5a7300['include']?_[_0xeab9('0x12')](_0x5a7300[_0xeab9('0x13')],function(_0x57f832){return{'model':db[_0x57f832[_0xeab9('0x14')]],'as':_0x57f832['as'],'attributes':_0x57f832[_0xeab9('0x15')],'include':_0x57f832[_0xeab9('0x13')]?_['map'](_0x57f832['include'],function(_0x3c8ad1){return{'model':db[_0x3c8ad1[_0xeab9('0x14')]],'as':_0x3c8ad1['as'],'attributes':_0x3c8ad1[_0xeab9('0x15')]};}):[]};}):[]};}):[]:[]})[_0xeab9('0x16')](function(_0x3ee382){logger['info'](_0xeab9('0xb'),_0x2ea7b5);logger[_0xeab9('0x17')]('GetSquareProjects',_0x2ea7b5,JSON[_0xeab9('0x18')](_0x3ee382));_0x31dc02(_0x3ee382);})[_0xeab9('0x19')](function(_0xc8fa2f){logger['error'](_0xeab9('0xb'),_0xc8fa2f['message'],_0x2ea7b5);_0x467e68(_0x5b91ae[_0xeab9('0x1a')](0x1f4,_0xc8fa2f[_0xeab9('0x1b')]));});});};exports[_0xeab9('0x1c')]=function(_0x14617d){var _0x4060dd=this;return new Promise(function(_0x4f30d7,_0x5a01e4){return db[_0xeab9('0xc')][_0xeab9('0x1d')]({'raw':_0x14617d[_0xeab9('0xe')]?_0x14617d[_0xeab9('0xe')]['raw']===undefined?!![]:![]:!![],'where':_0x14617d['options']?_0x14617d[_0xeab9('0xe')][_0xeab9('0x10')]||null:null,'attributes':_0x14617d[_0xeab9('0xe')]?_0x14617d[_0xeab9('0xe')]['attributes']||null:null,'include':_0x14617d[_0xeab9('0xe')]?_0x14617d[_0xeab9('0xe')]['include']?_['map'](_0x14617d['options'][_0xeab9('0x13')],function(_0x58dacf){return{'model':db[_0x58dacf[_0xeab9('0x14')]],'as':_0x58dacf['as'],'attributes':_0x58dacf[_0xeab9('0x15')],'include':_0x58dacf[_0xeab9('0x13')]?_['map'](_0x58dacf['include'],function(_0x332ada){return{'model':db[_0x332ada[_0xeab9('0x14')]],'as':_0x332ada['as'],'attributes':_0x332ada[_0xeab9('0x15')],'include':_0x332ada['include']?_[_0xeab9('0x12')](_0x332ada[_0xeab9('0x13')],function(_0x3b704e){return{'model':db[_0x3b704e[_0xeab9('0x14')]],'as':_0x3b704e['as'],'attributes':_0x3b704e[_0xeab9('0x15')]};}):[]};}):[]};}):[]:[]})[_0xeab9('0x16')](function(_0x3c008a){logger[_0xeab9('0x1e')]('ShowSquareProject',_0x14617d);logger[_0xeab9('0x17')](_0xeab9('0x1c'),_0x14617d,JSON[_0xeab9('0x18')](_0x3c008a));_0x4f30d7(_0x3c008a);})[_0xeab9('0x19')](function(_0x4e6566){logger['error'](_0xeab9('0x1c'),_0x4e6566[_0xeab9('0x1b')],_0x14617d);_0x5a01e4(_0x4060dd['error'](0x1f4,_0x4e6566[_0xeab9('0x1b')]));});});}; \ No newline at end of file +var _0xd952=['limit','map','include','model','then','debug','stringify','catch','error','message','SquareProject','find','raw','ShowSquareProject','lodash','ioredis','../../mysqldb','rpc','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','findAll','options','where','attributes'];(function(_0x4591db,_0x1182cb){var _0x5891ed=function(_0x57eb2e){while(--_0x57eb2e){_0x4591db['push'](_0x4591db['shift']());}};_0x5891ed(++_0x1182cb);}(_0xd952,0x65));var _0x2d95=function(_0x27b3e0,_0x59514e){_0x27b3e0=_0x27b3e0-0x0;var _0x3628a7=_0xd952[_0x27b3e0];return _0x3628a7;};'use strict';var _=require(_0x2d95('0x0'));var Redis=require(_0x2d95('0x1'));var db=require(_0x2d95('0x2'))['db'];var logger=require('../../config/logger')(_0x2d95('0x3'));var config=require('../../config/environment');config[_0x2d95('0x4')]=_[_0x2d95('0x5')](config[_0x2d95('0x4')],{'host':_0x2d95('0x6'),'port':0x18eb});var socket=require(_0x2d95('0x7'))(new Redis(config[_0x2d95('0x4')]));require(_0x2d95('0x8'))[_0x2d95('0x9')](socket);exports[_0x2d95('0xa')]=function(_0x2f1a70){var _0x5e9858=this;return new Promise(function(_0x406d5b,_0x2124ba){return db['SquareProject'][_0x2d95('0xb')]({'raw':_0x2f1a70[_0x2d95('0xc')]?_0x2f1a70['options']['raw']===undefined?!![]:![]:!![],'where':_0x2f1a70[_0x2d95('0xc')]?_0x2f1a70[_0x2d95('0xc')][_0x2d95('0xd')]||null:null,'attributes':_0x2f1a70[_0x2d95('0xc')]?_0x2f1a70[_0x2d95('0xc')][_0x2d95('0xe')]||null:null,'limit':_0x2f1a70[_0x2d95('0xc')]?_0x2f1a70[_0x2d95('0xc')][_0x2d95('0xf')]||null:null,'include':_0x2f1a70['options']?_0x2f1a70['options']['include']?_[_0x2d95('0x10')](_0x2f1a70[_0x2d95('0xc')][_0x2d95('0x11')],function(_0x3d1e5e){return{'model':db[_0x3d1e5e[_0x2d95('0x12')]],'as':_0x3d1e5e['as'],'attributes':_0x3d1e5e['attributes'],'include':_0x3d1e5e[_0x2d95('0x11')]?_[_0x2d95('0x10')](_0x3d1e5e['include'],function(_0x5e3146){return{'model':db[_0x5e3146[_0x2d95('0x12')]],'as':_0x5e3146['as'],'attributes':_0x5e3146[_0x2d95('0xe')],'include':_0x5e3146[_0x2d95('0x11')]?_['map'](_0x5e3146[_0x2d95('0x11')],function(_0x5f27e2){return{'model':db[_0x5f27e2[_0x2d95('0x12')]],'as':_0x5f27e2['as'],'attributes':_0x5f27e2[_0x2d95('0xe')]};}):[]};}):[]};}):[]:[]})[_0x2d95('0x13')](function(_0x459906){logger['info'](_0x2d95('0xa'),_0x2f1a70);logger[_0x2d95('0x14')]('GetSquareProjects',_0x2f1a70,JSON[_0x2d95('0x15')](_0x459906));_0x406d5b(_0x459906);})[_0x2d95('0x16')](function(_0x3ebb47){logger[_0x2d95('0x17')]('GetSquareProjects',_0x3ebb47[_0x2d95('0x18')],_0x2f1a70);_0x2124ba(_0x5e9858[_0x2d95('0x17')](0x1f4,_0x3ebb47['message']));});});};exports['ShowSquareProject']=function(_0x225aa0){var _0x96c299=this;return new Promise(function(_0x47d64e,_0x398ab9){return db[_0x2d95('0x19')][_0x2d95('0x1a')]({'raw':_0x225aa0[_0x2d95('0xc')]?_0x225aa0[_0x2d95('0xc')][_0x2d95('0x1b')]===undefined?!![]:![]:!![],'where':_0x225aa0['options']?_0x225aa0[_0x2d95('0xc')][_0x2d95('0xd')]||null:null,'attributes':_0x225aa0[_0x2d95('0xc')]?_0x225aa0[_0x2d95('0xc')][_0x2d95('0xe')]||null:null,'include':_0x225aa0['options']?_0x225aa0[_0x2d95('0xc')][_0x2d95('0x11')]?_[_0x2d95('0x10')](_0x225aa0['options']['include'],function(_0x1e2ed6){return{'model':db[_0x1e2ed6['model']],'as':_0x1e2ed6['as'],'attributes':_0x1e2ed6[_0x2d95('0xe')],'include':_0x1e2ed6[_0x2d95('0x11')]?_[_0x2d95('0x10')](_0x1e2ed6[_0x2d95('0x11')],function(_0x2c5077){return{'model':db[_0x2c5077[_0x2d95('0x12')]],'as':_0x2c5077['as'],'attributes':_0x2c5077[_0x2d95('0xe')],'include':_0x2c5077[_0x2d95('0x11')]?_[_0x2d95('0x10')](_0x2c5077[_0x2d95('0x11')],function(_0x3276f0){return{'model':db[_0x3276f0[_0x2d95('0x12')]],'as':_0x3276f0['as'],'attributes':_0x3276f0[_0x2d95('0xe')]};}):[]};}):[]};}):[]:[]})[_0x2d95('0x13')](function(_0x4d4b39){logger['info']('ShowSquareProject',_0x225aa0);logger[_0x2d95('0x14')](_0x2d95('0x1c'),_0x225aa0,JSON[_0x2d95('0x15')](_0x4d4b39));_0x47d64e(_0x4d4b39);})[_0x2d95('0x16')](function(_0x1f5923){logger[_0x2d95('0x17')](_0x2d95('0x1c'),_0x1f5923[_0x2d95('0x18')],_0x225aa0);_0x398ab9(_0x96c299[_0x2d95('0x17')](0x1f4,_0x1f5923[_0x2d95('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 6c0545f..17e6a9a 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 _0x97d3=['register','length','save','update','removeListener'];(function(_0x21caee,_0x35b4b3){var _0x241c34=function(_0x2cabc3){while(--_0x2cabc3){_0x21caee['push'](_0x21caee['shift']());}};_0x241c34(++_0x35b4b3);}(_0x97d3,0x124));var _0x397d=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x97d3[_0xfa634c];return _0x73e478;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x397d('0x0'),'remove',_0x397d('0x1')];function createListener(_0x59aeaa,_0x4d06e0){return function(_0x113606){_0x4d06e0['emit'](_0x59aeaa,_0x113606);};}function removeListener(_0x2b36f3,_0x35746d){return function(){SquareProjectEvents[_0x397d('0x2')](_0x2b36f3,_0x35746d);};}exports[_0x397d('0x3')]=function(_0x1cddff){for(var _0x12b12d=0x0,_0x56e40d=events[_0x397d('0x4')];_0x12b12d<_0x56e40d;_0x12b12d++){var _0x13357b=events[_0x12b12d];var _0x528243=createListener('squareProject:'+_0x13357b,_0x1cddff);SquareProjectEvents['on'](_0x13357b,_0x528243);}}; \ No newline at end of file +var _0x7b1b=['save','remove','removeListener','register','length','./squareProject.events'];(function(_0x21b625,_0x347030){var _0x28df33=function(_0x36fab3){while(--_0x36fab3){_0x21b625['push'](_0x21b625['shift']());}};_0x28df33(++_0x347030);}(_0x7b1b,0xf5));var _0xb7b1=function(_0x20639d,_0x692ef4){_0x20639d=_0x20639d-0x0;var _0x3db57a=_0x7b1b[_0x20639d];return _0x3db57a;};'use strict';var SquareProjectEvents=require(_0xb7b1('0x0'));var events=[_0xb7b1('0x1'),_0xb7b1('0x2'),'update'];function createListener(_0x281f56,_0x580600){return function(_0x54f4aa){_0x580600['emit'](_0x281f56,_0x54f4aa);};}function removeListener(_0x5ed1d2,_0x3049bb){return function(){SquareProjectEvents[_0xb7b1('0x3')](_0x5ed1d2,_0x3049bb);};}exports[_0xb7b1('0x4')]=function(_0x25549c){for(var _0x1da6f5=0x0,_0x2718ff=events[_0xb7b1('0x5')];_0x1da6f5<_0x2718ff;_0x1da6f5++){var _0xfa296b=events[_0x1da6f5];var _0x9a95ab=createListener('squareProject:'+_0xfa296b,_0x25549c);SquareProjectEvents['on'](_0xfa296b,_0x9a95ab);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index e78a8ab..26e8c4d 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 _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0x4e8f79,_0x10a182){var _0x21117d=function(_0x209644){while(--_0x209644){_0x4e8f79['push'](_0x4e8f79['shift']());}};_0x21117d(++_0x10a182);}(_0x53ec,0x192));var _0xc53e=function(_0x5bc8d1,_0x5800fe){_0x5bc8d1=_0x5bc8d1-0x0;var _0x5db7d0=_0x53ec[_0x5bc8d1];return _0x5db7d0;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file +var _0x1cb9=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put'];(function(_0x5299e8,_0xa74bcc){var _0x279610=function(_0x146716){while(--_0x146716){_0x5299e8['push'](_0x5299e8['shift']());}};_0x279610(++_0xa74bcc);}(_0x1cb9,0x14e));var _0x91cb=function(_0x18d460,_0x275d84){_0x18d460=_0x18d460-0x0;var _0x362859=_0x1cb9[_0x18d460];return _0x362859;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x11')](_0x91cb('0xb'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x13')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0x14')]);module[_0x91cb('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index b9e16f4..e5d1058 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 _0x1cb9=['STRING','VIRTUAL','getDataValue','substring','sequelize'];(function(_0x3d0618,_0x40c9ad){var _0x4ff3c7=function(_0x168e62){while(--_0x168e62){_0x3d0618['push'](_0x3d0618['shift']());}};_0x4ff3c7(++_0x40c9ad);}(_0x1cb9,0x14e));var _0x91cb=function(_0x31ff75,_0x2d0a0c){_0x31ff75=_0x31ff75-0x0;var _0x842903=_0x1cb9[_0x31ff75];return _0x842903;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x91cb('0x1')]},'callerid':{'type':Sequelize[_0x91cb('0x1')]},'calleridname':{'type':Sequelize[_0x91cb('0x1')]},'context':{'type':Sequelize[_0x91cb('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x91cb('0x1')]},'accountcode':{'type':Sequelize[_0x91cb('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x91cb('0x1')]},'saveName':{'type':Sequelize[_0x91cb('0x1')]},'filename':{'type':Sequelize[_0x91cb('0x1')]},'savePath':{'type':Sequelize[_0x91cb('0x1')]},'format':{'type':Sequelize[_0x91cb('0x2')],'get':function(){var _0x8f8a3b='';var _0x4c1f56=this[_0x91cb('0x3')]('savePath');if(_0x4c1f56){_0x8f8a3b=_0x4c1f56[_0x91cb('0x4')](_0x4c1f56['lastIndexOf']('.'));}return _0x8f8a3b;}}}; \ No newline at end of file +var _0xb138=['getDataValue','substring','lastIndexOf','sequelize','exports','STRING'];(function(_0x499e2e,_0x8c3216){var _0x6a14bd=function(_0x1f4696){while(--_0x1f4696){_0x499e2e['push'](_0x499e2e['shift']());}};_0x6a14bd(++_0x8c3216);}(_0xb138,0x1dd));var _0x8b13=function(_0x2ce8e3,_0x34cb6e){_0x2ce8e3=_0x2ce8e3-0x0;var _0x3940ed=_0xb138[_0x2ce8e3];return _0x3940ed;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'uniqueid':{'type':Sequelize[_0x8b13('0x2')]},'callerid':{'type':Sequelize[_0x8b13('0x2')]},'calleridname':{'type':Sequelize[_0x8b13('0x2')]},'context':{'type':Sequelize[_0x8b13('0x2')]},'extension':{'type':Sequelize[_0x8b13('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8b13('0x2')]},'dnid':{'type':Sequelize[_0x8b13('0x2')]},'projectName':{'type':Sequelize[_0x8b13('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x8b13('0x2')]},'savePath':{'type':Sequelize[_0x8b13('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x3fdf4d='';var _0x33d1a7=this[_0x8b13('0x3')]('savePath');if(_0x33d1a7){_0x3fdf4d=_0x33d1a7[_0x8b13('0x4')](_0x33d1a7[_0x8b13('0x5')]('.'));}return _0x3fdf4d;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index d96d15d..3040b62 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 _0x9ea0=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','end','error','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','../../components/encryptor','uniqueid','savePath','format','existsSync','decryptFile','ValidationError','download','filename','extname','message','SquareRecording\x20not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9ea0,0x121));var _0x09ea=function(_0x1ac77b,_0x10ee7a){_0x1ac77b=_0x1ac77b-0x0;var _0x161584=_0x9ea0[_0x1ac77b];return _0x161584;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x09ea('0x0'));var zipdir=require(_0x09ea('0x1'));var jsonpatch=require(_0x09ea('0x2'));var rp=require(_0x09ea('0x3'));var moment=require(_0x09ea('0x4'));var BPromise=require(_0x09ea('0x5'));var Mustache=require('mustache');var util=require(_0x09ea('0x6'));var path=require(_0x09ea('0x7'));var sox=require(_0x09ea('0x8'));var csv=require(_0x09ea('0x9'));var ejs=require(_0x09ea('0xa'));var fs=require('fs');var fs_extra=require(_0x09ea('0xb'));var _=require(_0x09ea('0xc'));var squel=require(_0x09ea('0xd'));var crypto=require(_0x09ea('0xe'));var jsforce=require(_0x09ea('0xf'));var deskjs=require(_0x09ea('0x10'));var toCsv=require('to-csv');var querystring=require(_0x09ea('0x11'));var Papa=require(_0x09ea('0x12'));var Redis=require(_0x09ea('0x13'));var authService=require(_0x09ea('0x14'));var qs=require(_0x09ea('0x15'));var as=require(_0x09ea('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x09ea('0x17'))(_0x09ea('0x18'));var utils=require(_0x09ea('0x19'));var config=require(_0x09ea('0x1a'));var licenseUtil=require(_0x09ea('0x1b'));var db=require(_0x09ea('0x1c'))['db'];function respondWithStatusCode(_0x4f6a01,_0x274b17){_0x274b17=_0x274b17||0xcc;return function(_0xe4cdbb){if(_0xe4cdbb){return _0x4f6a01[_0x09ea('0x1d')](_0x274b17);}return _0x4f6a01[_0x09ea('0x1e')](_0x274b17)['end']();};}function respondWithResult(_0x4c6173,_0xd82669){_0xd82669=_0xd82669||0xc8;return function(_0x45dcb8){if(_0x45dcb8){return _0x4c6173[_0x09ea('0x1e')](_0xd82669)[_0x09ea('0x1f')](_0x45dcb8);}};}function respondWithFilteredResult(_0x4ca898,_0x23f66e){return function(_0x1bfb36){if(_0x1bfb36){var _0x5dea40=typeof _0x23f66e[_0x09ea('0x20')]===_0x09ea('0x21')&&typeof _0x23f66e['limit']===_0x09ea('0x21');var _0x46f93e=_0x1bfb36['count'];var _0x40e255=_0x5dea40?0x0:_0x23f66e[_0x09ea('0x20')];var _0x3dc408=_0x5dea40?_0x1bfb36[_0x09ea('0x22')]:_0x23f66e['offset']+_0x23f66e[_0x09ea('0x23')];var _0x3ea4a0;if(_0x3dc408>=_0x46f93e){_0x3dc408=_0x46f93e;_0x3ea4a0=0xc8;}else{_0x3ea4a0=0xce;}_0x4ca898[_0x09ea('0x1e')](_0x3ea4a0);return _0x4ca898[_0x09ea('0x24')]('Content-Range',_0x40e255+'-'+_0x3dc408+'/'+_0x46f93e)['json'](_0x1bfb36);}return null;};}function patchUpdates(_0x1dc6a2){return function(_0x6f858f){try{jsonpatch['apply'](_0x6f858f,_0x1dc6a2,!![]);}catch(_0x3a1775){return BPromise[_0x09ea('0x25')](_0x3a1775);}return _0x6f858f[_0x09ea('0x26')]();};}function saveUpdates(_0x26aa05,_0x40b238){return function(_0x56e74e){if(_0x56e74e){return _0x56e74e[_0x09ea('0x27')](_0x26aa05)[_0x09ea('0x28')](function(_0x2f8d27){return _0x2f8d27;});}return null;};}function removeEntity(_0x1dc34d,_0x500dcd){return function(_0x2eeae6){if(_0x2eeae6){return _0x2eeae6[_0x09ea('0x29')]()[_0x09ea('0x28')](function(){_0x1dc34d['status'](0xcc)[_0x09ea('0x2a')]();});}};}function handleEntityNotFound(_0x4bd964,_0x27ffb4){return function(_0xd56c6e){if(!_0xd56c6e){_0x4bd964[_0x09ea('0x1d')](0x194);}return _0xd56c6e;};}function handleError(_0x140f12,_0x22c517){_0x22c517=_0x22c517||0x1f4;return function(_0x532b70){logger[_0x09ea('0x2b')](_0x532b70['stack']);if(_0x532b70[_0x09ea('0x2c')]){delete _0x532b70[_0x09ea('0x2c')];}_0x140f12[_0x09ea('0x1e')](_0x22c517)[_0x09ea('0x2d')](_0x532b70);};}exports[_0x09ea('0x2e')]=function(_0x59e67,_0x1ac999){var _0x328602={},_0x18da5f={},_0x379194={'count':0x0,'rows':[]};var _0x23dc93=_[_0x09ea('0x2f')](db[_0x09ea('0x30')][_0x09ea('0x31')],function(_0x5b3944){return{'name':_0x5b3944[_0x09ea('0x32')],'type':_0x5b3944[_0x09ea('0x33')][_0x09ea('0x34')]};});_0x18da5f[_0x09ea('0x35')]=_[_0x09ea('0x2f')](_0x23dc93,_0x09ea('0x2c'));_0x18da5f[_0x09ea('0x36')]=_[_0x09ea('0x37')](_0x59e67[_0x09ea('0x36')]);_0x18da5f[_0x09ea('0x38')]=_[_0x09ea('0x39')](_0x18da5f[_0x09ea('0x35')],_0x18da5f[_0x09ea('0x36')]);_0x328602[_0x09ea('0x3a')]=_[_0x09ea('0x39')](_0x18da5f[_0x09ea('0x35')],qs['fields'](_0x59e67[_0x09ea('0x36')][_0x09ea('0x3b')]));_0x328602['attributes']=_0x328602['attributes']['length']?_0x328602['attributes']:_0x18da5f[_0x09ea('0x35')];if(!_0x59e67[_0x09ea('0x36')][_0x09ea('0x3c')](_0x09ea('0x3d'))){_0x328602[_0x09ea('0x23')]=qs[_0x09ea('0x23')](_0x59e67[_0x09ea('0x36')][_0x09ea('0x23')]);_0x328602[_0x09ea('0x20')]=qs[_0x09ea('0x20')](_0x59e67[_0x09ea('0x36')][_0x09ea('0x20')]);}_0x328602[_0x09ea('0x3e')]=qs[_0x09ea('0x3f')](_0x59e67['query'][_0x09ea('0x3f')]);_0x328602['where']=qs[_0x09ea('0x38')](_[_0x09ea('0x40')](_0x59e67['query'],_0x18da5f['filters']),_0x23dc93);if(_0x59e67[_0x09ea('0x36')]['filter']){_0x328602[_0x09ea('0x41')]=_[_0x09ea('0x42')](_0x328602['where'],{'$or':_[_0x09ea('0x2f')](_0x23dc93,function(_0x26d6bb){if(_0x26d6bb[_0x09ea('0x33')]!==_0x09ea('0x43')){var _0x4ba760={};_0x4ba760[_0x26d6bb[_0x09ea('0x2c')]]={'$like':'%'+_0x59e67[_0x09ea('0x36')][_0x09ea('0x44')]+'%'};return _0x4ba760;}})});}_0x328602=_[_0x09ea('0x42')]({},_0x328602,_0x59e67[_0x09ea('0x45')]);var _0x63d54d={'where':_0x328602['where']};return db['SquareRecording'][_0x09ea('0x22')](_0x63d54d)[_0x09ea('0x28')](function(_0x10a570){_0x379194[_0x09ea('0x22')]=_0x10a570;if(_0x59e67[_0x09ea('0x36')][_0x09ea('0x46')]){_0x328602[_0x09ea('0x47')]=[{'all':!![]}];}return db[_0x09ea('0x30')][_0x09ea('0x48')](_0x328602);})['then'](function(_0x56647f){_0x379194[_0x09ea('0x49')]=_0x56647f;return _0x379194;})[_0x09ea('0x28')](respondWithFilteredResult(_0x1ac999,_0x328602))[_0x09ea('0x4a')](handleError(_0x1ac999,null));};exports[_0x09ea('0x4b')]=function(_0x51e47e,_0x16b9f9){var _0x226747={'raw':!![],'where':{'id':_0x51e47e['params']['id']}},_0x423934={};_0x423934[_0x09ea('0x35')]=_[_0x09ea('0x37')](db[_0x09ea('0x30')]['rawAttributes']);_0x423934['query']=_[_0x09ea('0x37')](_0x51e47e[_0x09ea('0x36')]);_0x423934[_0x09ea('0x38')]=_[_0x09ea('0x39')](_0x423934[_0x09ea('0x35')],_0x423934[_0x09ea('0x36')]);_0x226747[_0x09ea('0x3a')]=_[_0x09ea('0x39')](_0x423934[_0x09ea('0x35')],qs[_0x09ea('0x3b')](_0x51e47e[_0x09ea('0x36')][_0x09ea('0x3b')]));_0x226747['attributes']=_0x226747['attributes'][_0x09ea('0x4c')]?_0x226747['attributes']:_0x423934[_0x09ea('0x35')];if(_0x51e47e[_0x09ea('0x36')][_0x09ea('0x46')]){_0x226747['include']=[{'all':!![]}];}_0x226747=_[_0x09ea('0x42')]({},_0x226747,_0x51e47e[_0x09ea('0x45')]);return db[_0x09ea('0x30')][_0x09ea('0x4d')](_0x226747)[_0x09ea('0x28')](handleEntityNotFound(_0x16b9f9,null))[_0x09ea('0x28')](respondWithResult(_0x16b9f9,null))['catch'](handleError(_0x16b9f9,null));};exports['create']=function(_0x198e82,_0x4eb9e5){return db[_0x09ea('0x30')][_0x09ea('0x4e')](_0x198e82[_0x09ea('0x4f')],{})[_0x09ea('0x28')](respondWithResult(_0x4eb9e5,0xc9))[_0x09ea('0x4a')](handleError(_0x4eb9e5,null));};exports[_0x09ea('0x27')]=function(_0x23210e,_0x2a3672){if(_0x23210e['body']['id']){delete _0x23210e[_0x09ea('0x4f')]['id'];}return db[_0x09ea('0x30')][_0x09ea('0x4d')]({'where':{'id':_0x23210e[_0x09ea('0x50')]['id']}})[_0x09ea('0x28')](handleEntityNotFound(_0x2a3672,null))[_0x09ea('0x28')](saveUpdates(_0x23210e[_0x09ea('0x4f')],null))['then'](respondWithResult(_0x2a3672,null))['catch'](handleError(_0x2a3672,null));};exports['download']=function(_0xbf52e3,_0x55ca0e,_0x45ee98){var _0xa82c84=require(_0x09ea('0x51'));var _0x32ad48=![];var _0x4bbc54={};if(_0xbf52e3[_0x09ea('0x36')][_0x09ea('0x33')]&&_0xbf52e3[_0x09ea('0x36')][_0x09ea('0x33')]===_0x09ea('0x52')){_0x4bbc54[_0x09ea('0x52')]=_0xbf52e3[_0x09ea('0x50')]['id'];}else{_0x4bbc54['id']=_0xbf52e3['params']['id'];}return db[_0x09ea('0x30')][_0x09ea('0x4d')]({'where':_0x4bbc54,'attributes':['id',_0x09ea('0x53'),'filename'],'raw':!![]})[_0x09ea('0x28')](handleEntityNotFound(_0x55ca0e,null))[_0x09ea('0x28')](function(_0x8b07e0){if(_0x8b07e0){var _0x21e250=_0x8b07e0[_0x09ea('0x53')];var _0x58b6b5=util[_0x09ea('0x54')]('%s.cypher',_0x21e250);if(fs[_0x09ea('0x55')](_0x58b6b5)){_0x32ad48=!![];return _0xa82c84[_0x09ea('0x56')](_0x58b6b5,_0x21e250,config['secrets']['recording'])[_0x09ea('0x28')](function(){return _0x8b07e0;});}return _0x8b07e0;}})[_0x09ea('0x28')](function(_0xd94a0d){if(_0xd94a0d){var _0x1e47dc=_0xd94a0d[_0x09ea('0x53')];if(!fs['existsSync'](_0x1e47dc)){throw new db['Sequelize'][(_0x09ea('0x57'))]('SquareRecording\x20not\x20found');}if(_0xd94a0d['filename']){return _0x55ca0e[_0x09ea('0x58')](_0x1e47dc,_0xd94a0d[_0x09ea('0x59')]+path[_0x09ea('0x5a')](_0x1e47dc),function(){if(_0x32ad48){fs['unlink'](_0x1e47dc);}});}else{return _0x55ca0e[_0x09ea('0x58')](_0x1e47dc,function(_0x3d5b62){if(_0x32ad48){fs['unlink'](_0x1e47dc);}});}}})[_0x09ea('0x4a')](function(_0x2387e1){if(_0x2387e1[_0x09ea('0x5b')]===_0x09ea('0x5c')){_0x55ca0e['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x55ca0e,null);}});};exports['destroy']=function(_0x319547,_0x4d94c0){return db[_0x09ea('0x30')][_0x09ea('0x4d')]({'where':{'id':_0x319547[_0x09ea('0x50')]['id']}})[_0x09ea('0x28')](function(_0x235669){if(_[_0x09ea('0x5d')](_0x235669)){throw new ReferenceError(_0x09ea('0x5e'));}return _0x235669;})[_0x09ea('0x28')](function(_0x5f168b){var _0x27a434=_0x5f168b[_0x09ea('0x53')];logger[_0x09ea('0x5f')]('cancellazione\x20fisica\x20documento\x20%s',_0x27a434);if(!_[_0x09ea('0x5d')](_0x5f168b['savePath'])&&fs[_0x09ea('0x55')](_0x27a434)){logger['info'](_0x09ea('0x60')+_0x27a434+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x27a434);}_0x27a434=_0x27a434+_0x09ea('0x61');if(!_['isNil'](_0x5f168b[_0x09ea('0x53')])&&fs['existsSync'](_0x27a434)){logger['info'](_0x09ea('0x60')+_0x27a434+_0x09ea('0x62'));fs[_0x09ea('0x63')](_0x27a434);}return _0x5f168b;})[_0x09ea('0x28')](function(_0x5a91e3){if(!_0x5a91e3)throw new InternalError();return _0x5a91e3[_0x09ea('0x29')]();})[_0x09ea('0x28')](function(){_0x4d94c0[_0x09ea('0x1e')](0xcc)[_0x09ea('0x2a')]();})[_0x09ea('0x4a')](handleError(_0x4d94c0,null));}; \ No newline at end of file +var _0x799e=['eml-format','request-promise','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','update','params','download','../../components/encryptor','uniqueid','savePath','%s.cypher','existsSync','recording','Sequelize','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync'];(function(_0x371648,_0x286805){var _0x5c7980=function(_0x4f4c51){while(--_0x4f4c51){_0x371648['push'](_0x371648['shift']());}};_0x5c7980(++_0x286805);}(_0x799e,0x174));var _0xe799=function(_0x1b0071,_0x35e57e){_0x1b0071=_0x1b0071-0x0;var _0x151840=_0x799e[_0x1b0071];return _0x151840;};'use strict';var emlformat=require(_0xe799('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe799('0x1'));var moment=require('moment');var BPromise=require(_0xe799('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe799('0x3'));var csv=require(_0xe799('0x4'));var ejs=require(_0xe799('0x5'));var fs=require('fs');var fs_extra=require(_0xe799('0x6'));var _=require(_0xe799('0x7'));var squel=require(_0xe799('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe799('0x9'));var toCsv=require(_0xe799('0x4'));var querystring=require(_0xe799('0xa'));var Papa=require(_0xe799('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe799('0xc'));var as=require(_0xe799('0xd'));var hardwareService=require(_0xe799('0xe'));var logger=require(_0xe799('0xf'))(_0xe799('0x10'));var utils=require('../../config/utils');var config=require(_0xe799('0x11'));var licenseUtil=require(_0xe799('0x12'));var db=require(_0xe799('0x13'))['db'];function respondWithStatusCode(_0x5b9c83,_0x1ecc71){_0x1ecc71=_0x1ecc71||0xcc;return function(_0x51728e){if(_0x51728e){return _0x5b9c83['sendStatus'](_0x1ecc71);}return _0x5b9c83[_0xe799('0x14')](_0x1ecc71)[_0xe799('0x15')]();};}function respondWithResult(_0x14fe62,_0x58c9d9){_0x58c9d9=_0x58c9d9||0xc8;return function(_0x5c70e2){if(_0x5c70e2){return _0x14fe62[_0xe799('0x14')](_0x58c9d9)[_0xe799('0x16')](_0x5c70e2);}};}function respondWithFilteredResult(_0x5d20a5,_0x4a8025){return function(_0x114ce3){if(_0x114ce3){var _0x588f69=typeof _0x4a8025[_0xe799('0x17')]===_0xe799('0x18')&&typeof _0x4a8025[_0xe799('0x19')]==='undefined';var _0x456494=_0x114ce3['count'];var _0x37e43f=_0x588f69?0x0:_0x4a8025[_0xe799('0x17')];var _0x529a6e=_0x588f69?_0x114ce3[_0xe799('0x1a')]:_0x4a8025[_0xe799('0x17')]+_0x4a8025[_0xe799('0x19')];var _0xb31315;if(_0x529a6e>=_0x456494){_0x529a6e=_0x456494;_0xb31315=0xc8;}else{_0xb31315=0xce;}_0x5d20a5[_0xe799('0x14')](_0xb31315);return _0x5d20a5[_0xe799('0x1b')](_0xe799('0x1c'),_0x37e43f+'-'+_0x529a6e+'/'+_0x456494)[_0xe799('0x16')](_0x114ce3);}return null;};}function patchUpdates(_0x5723fa){return function(_0x6a4bde){try{jsonpatch[_0xe799('0x1d')](_0x6a4bde,_0x5723fa,!![]);}catch(_0x88cf97){return BPromise[_0xe799('0x1e')](_0x88cf97);}return _0x6a4bde[_0xe799('0x1f')]();};}function saveUpdates(_0xcc8d9b,_0x382302){return function(_0x1e5e8f){if(_0x1e5e8f){return _0x1e5e8f['update'](_0xcc8d9b)[_0xe799('0x20')](function(_0x1c1fca){return _0x1c1fca;});}return null;};}function removeEntity(_0xf44cee,_0x2e73ca){return function(_0x5b2e3e){if(_0x5b2e3e){return _0x5b2e3e['destroy']()[_0xe799('0x20')](function(){_0xf44cee[_0xe799('0x14')](0xcc)[_0xe799('0x15')]();});}};}function handleEntityNotFound(_0x1226a2,_0x270feb){return function(_0x4f6bdb){if(!_0x4f6bdb){_0x1226a2['sendStatus'](0x194);}return _0x4f6bdb;};}function handleError(_0x304b0a,_0x45e15b){_0x45e15b=_0x45e15b||0x1f4;return function(_0xd9796){logger[_0xe799('0x21')](_0xd9796[_0xe799('0x22')]);if(_0xd9796[_0xe799('0x23')]){delete _0xd9796[_0xe799('0x23')];}_0x304b0a[_0xe799('0x14')](_0x45e15b)[_0xe799('0x24')](_0xd9796);};}exports[_0xe799('0x25')]=function(_0x2966bb,_0x48290c){var _0x4b190b={},_0x28b328={},_0x5d983a={'count':0x0,'rows':[]};var _0x577a93=_[_0xe799('0x26')](db[_0xe799('0x27')][_0xe799('0x28')],function(_0x580acd){return{'name':_0x580acd[_0xe799('0x29')],'type':_0x580acd[_0xe799('0x2a')][_0xe799('0x2b')]};});_0x28b328[_0xe799('0x2c')]=_[_0xe799('0x26')](_0x577a93,'name');_0x28b328[_0xe799('0x2d')]=_['keys'](_0x2966bb[_0xe799('0x2d')]);_0x28b328[_0xe799('0x2e')]=_['intersection'](_0x28b328[_0xe799('0x2c')],_0x28b328['query']);_0x4b190b[_0xe799('0x2f')]=_[_0xe799('0x30')](_0x28b328['model'],qs[_0xe799('0x31')](_0x2966bb['query'][_0xe799('0x31')]));_0x4b190b[_0xe799('0x2f')]=_0x4b190b['attributes'][_0xe799('0x32')]?_0x4b190b[_0xe799('0x2f')]:_0x28b328[_0xe799('0x2c')];if(!_0x2966bb[_0xe799('0x2d')][_0xe799('0x33')](_0xe799('0x34'))){_0x4b190b[_0xe799('0x19')]=qs[_0xe799('0x19')](_0x2966bb[_0xe799('0x2d')][_0xe799('0x19')]);_0x4b190b[_0xe799('0x17')]=qs['offset'](_0x2966bb['query']['offset']);}_0x4b190b[_0xe799('0x35')]=qs[_0xe799('0x36')](_0x2966bb[_0xe799('0x2d')][_0xe799('0x36')]);_0x4b190b[_0xe799('0x37')]=qs['filters'](_['pick'](_0x2966bb[_0xe799('0x2d')],_0x28b328['filters']),_0x577a93);if(_0x2966bb['query'][_0xe799('0x38')]){_0x4b190b['where']=_['merge'](_0x4b190b['where'],{'$or':_['map'](_0x577a93,function(_0x41ad56){if(_0x41ad56[_0xe799('0x2a')]!==_0xe799('0x39')){var _0x59296b={};_0x59296b[_0x41ad56[_0xe799('0x23')]]={'$like':'%'+_0x2966bb['query'][_0xe799('0x38')]+'%'};return _0x59296b;}})});}_0x4b190b=_[_0xe799('0x3a')]({},_0x4b190b,_0x2966bb['options']);var _0x477e1={'where':_0x4b190b[_0xe799('0x37')]};return db[_0xe799('0x27')][_0xe799('0x1a')](_0x477e1)[_0xe799('0x20')](function(_0x59e6b1){_0x5d983a[_0xe799('0x1a')]=_0x59e6b1;if(_0x2966bb['query'][_0xe799('0x3b')]){_0x4b190b[_0xe799('0x3c')]=[{'all':!![]}];}return db[_0xe799('0x27')][_0xe799('0x3d')](_0x4b190b);})[_0xe799('0x20')](function(_0x230b7c){_0x5d983a[_0xe799('0x3e')]=_0x230b7c;return _0x5d983a;})['then'](respondWithFilteredResult(_0x48290c,_0x4b190b))[_0xe799('0x3f')](handleError(_0x48290c,null));};exports[_0xe799('0x40')]=function(_0x39139d,_0x4f8585){var _0x346b25={'raw':!![],'where':{'id':_0x39139d['params']['id']}},_0x8fa5ab={};_0x8fa5ab[_0xe799('0x2c')]=_[_0xe799('0x41')](db[_0xe799('0x27')][_0xe799('0x28')]);_0x8fa5ab[_0xe799('0x2d')]=_[_0xe799('0x41')](_0x39139d[_0xe799('0x2d')]);_0x8fa5ab[_0xe799('0x2e')]=_[_0xe799('0x30')](_0x8fa5ab['model'],_0x8fa5ab[_0xe799('0x2d')]);_0x346b25[_0xe799('0x2f')]=_[_0xe799('0x30')](_0x8fa5ab[_0xe799('0x2c')],qs[_0xe799('0x31')](_0x39139d[_0xe799('0x2d')]['fields']));_0x346b25[_0xe799('0x2f')]=_0x346b25['attributes'][_0xe799('0x32')]?_0x346b25[_0xe799('0x2f')]:_0x8fa5ab[_0xe799('0x2c')];if(_0x39139d[_0xe799('0x2d')][_0xe799('0x3b')]){_0x346b25[_0xe799('0x3c')]=[{'all':!![]}];}_0x346b25=_[_0xe799('0x3a')]({},_0x346b25,_0x39139d[_0xe799('0x42')]);return db['SquareRecording'][_0xe799('0x43')](_0x346b25)[_0xe799('0x20')](handleEntityNotFound(_0x4f8585,null))[_0xe799('0x20')](respondWithResult(_0x4f8585,null))[_0xe799('0x3f')](handleError(_0x4f8585,null));};exports[_0xe799('0x44')]=function(_0x2ae9e3,_0x7df301){return db[_0xe799('0x27')][_0xe799('0x44')](_0x2ae9e3[_0xe799('0x45')],{})[_0xe799('0x20')](respondWithResult(_0x7df301,0xc9))[_0xe799('0x3f')](handleError(_0x7df301,null));};exports[_0xe799('0x46')]=function(_0x16b11d,_0xb4daa0){if(_0x16b11d[_0xe799('0x45')]['id']){delete _0x16b11d[_0xe799('0x45')]['id'];}return db[_0xe799('0x27')][_0xe799('0x43')]({'where':{'id':_0x16b11d[_0xe799('0x47')]['id']}})[_0xe799('0x20')](handleEntityNotFound(_0xb4daa0,null))[_0xe799('0x20')](saveUpdates(_0x16b11d[_0xe799('0x45')],null))[_0xe799('0x20')](respondWithResult(_0xb4daa0,null))[_0xe799('0x3f')](handleError(_0xb4daa0,null));};exports[_0xe799('0x48')]=function(_0x2ffca6,_0xf94ab0,_0x30f7ce){var _0x5ddd57=require(_0xe799('0x49'));var _0x2f47ee=![];var _0x2ca387={};if(_0x2ffca6[_0xe799('0x2d')][_0xe799('0x2a')]&&_0x2ffca6[_0xe799('0x2d')]['type']===_0xe799('0x4a')){_0x2ca387['uniqueid']=_0x2ffca6[_0xe799('0x47')]['id'];}else{_0x2ca387['id']=_0x2ffca6[_0xe799('0x47')]['id'];}return db['SquareRecording'][_0xe799('0x43')]({'where':_0x2ca387,'attributes':['id',_0xe799('0x4b'),'filename'],'raw':!![]})['then'](handleEntityNotFound(_0xf94ab0,null))['then'](function(_0x2dd987){if(_0x2dd987){var _0x42f00c=_0x2dd987[_0xe799('0x4b')];var _0x4a2a4c=util['format'](_0xe799('0x4c'),_0x42f00c);if(fs[_0xe799('0x4d')](_0x4a2a4c)){_0x2f47ee=!![];return _0x5ddd57['decryptFile'](_0x4a2a4c,_0x42f00c,config['secrets'][_0xe799('0x4e')])['then'](function(){return _0x2dd987;});}return _0x2dd987;}})['then'](function(_0x34e653){if(_0x34e653){var _0x514e51=_0x34e653[_0xe799('0x4b')];if(!fs[_0xe799('0x4d')](_0x514e51)){throw new db[(_0xe799('0x4f'))]['ValidationError'](_0xe799('0x50'));}if(_0x34e653[_0xe799('0x51')]){return _0xf94ab0[_0xe799('0x48')](_0x514e51,_0x34e653[_0xe799('0x51')]+path[_0xe799('0x52')](_0x514e51),function(){if(_0x2f47ee){fs[_0xe799('0x53')](_0x514e51);}});}else{return _0xf94ab0[_0xe799('0x48')](_0x514e51,function(_0x2de113){if(_0x2f47ee){fs[_0xe799('0x53')](_0x514e51);}});}}})[_0xe799('0x3f')](function(_0x58baac){if(_0x58baac[_0xe799('0x54')]==='SquareRecording\x20not\x20found'){_0xf94ab0[_0xe799('0x14')](0x194)[_0xe799('0x24')](_0xe799('0x55'));}else{return handleError(_0xf94ab0,null);}});};exports[_0xe799('0x56')]=function(_0x34c679,_0x14ad01){return db[_0xe799('0x27')][_0xe799('0x43')]({'where':{'id':_0x34c679[_0xe799('0x47')]['id']}})[_0xe799('0x20')](function(_0xa90c08){if(_[_0xe799('0x57')](_0xa90c08)){throw new ReferenceError(_0xe799('0x58'));}return _0xa90c08;})[_0xe799('0x20')](function(_0x3adfe7){var _0x337618=_0x3adfe7[_0xe799('0x4b')];logger[_0xe799('0x59')](_0xe799('0x5a'),_0x337618);if(!_[_0xe799('0x57')](_0x3adfe7[_0xe799('0x4b')])&&fs['existsSync'](_0x337618)){logger['info'](_0xe799('0x5b')+_0x337618+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe799('0x5c')](_0x337618);}_0x337618=_0x337618+'.cypher';if(!_[_0xe799('0x57')](_0x3adfe7[_0xe799('0x4b')])&&fs[_0xe799('0x4d')](_0x337618)){logger[_0xe799('0x59')]('File:\x20\x22'+_0x337618+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x337618);}return _0x3adfe7;})[_0xe799('0x20')](function(_0x2930da){if(!_0x2930da)throw new InternalError();return _0x2930da['destroy']();})['then'](function(){_0x14ad01[_0xe799('0x14')](0xcc)[_0xe799('0x15')]();})['catch'](handleError(_0x14ad01,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index a7aaacc..fe18a3e 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 _0xcac3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','util','../../config/logger','api'];(function(_0x347d95,_0x2d161b){var _0x1a5e53=function(_0x1e55f8){while(--_0x1e55f8){_0x347d95['push'](_0x347d95['shift']());}};_0x1a5e53(++_0x2d161b);}(_0xcac3,0x193));var _0x3cac=function(_0xc3050a,_0x3f50b5){_0xc3050a=_0xc3050a-0x0;var _0x433e7a=_0xcac3[_0xc3050a];return _0x433e7a;};'use strict';var _=require('lodash');var util=require(_0x3cac('0x0'));var logger=require(_0x3cac('0x1'))(_0x3cac('0x2'));var moment=require(_0x3cac('0x3'));var BPromise=require(_0x3cac('0x4'));var rp=require(_0x3cac('0x5'));var fs=require('fs');var path=require(_0x3cac('0x6'));var rimraf=require(_0x3cac('0x7'));var config=require(_0x3cac('0x8'));var attributes=require(_0x3cac('0x9'));module[_0x3cac('0xa')]=function(_0x2c5e16,_0x35c687){return _0x2c5e16[_0x3cac('0xb')](_0x3cac('0xc'),attributes,{'tableName':_0x3cac('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71ab=['exports','define','SquareRecording','square_recordings','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes'];(function(_0x596199,_0x1eb398){var _0x5b98c3=function(_0x3ddb06){while(--_0x3ddb06){_0x596199['push'](_0x596199['shift']());}};_0x5b98c3(++_0x1eb398);}(_0x71ab,0x64));var _0xb71a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x71ab[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));module[_0xb71a('0x8')]=function(_0x38d931,_0x22c072){return _0x38d931[_0xb71a('0x9')](_0xb71a('0xa'),attributes,{'tableName':_0xb71a('0xb'),'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 cdf6ff3..3f79431 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 _0x3692=['CreateSquareRecording','SquareRecording','create','options','raw','then','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x3cd918,_0x4badc7){var _0x5df305=function(_0x30aa25){while(--_0x30aa25){_0x3cd918['push'](_0x3cd918['shift']());}};_0x5df305(++_0x4badc7);}(_0x3692,0x1e1));var _0x2369=function(_0x49adfe,_0x2fd329){_0x49adfe=_0x49adfe-0x0;var _0x1d53da=_0x3692[_0x49adfe];return _0x1d53da;};'use strict';var _=require(_0x2369('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2369('0x1'));var fs=require('fs');var Redis=require(_0x2369('0x2'));var db=require(_0x2369('0x3'))['db'];var utils=require(_0x2369('0x4'));var logger=require(_0x2369('0x5'))(_0x2369('0x6'));var config=require(_0x2369('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2369('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4842e4,_0x5a2c46,_0x3f409c){return new BPromise(function(_0x295cc1,_0x337d21){return client['request'](_0x4842e4,_0x3f409c)['then'](function(_0x1db13a){logger[_0x2369('0x9')](_0x2369('0xa'),_0x5a2c46,_0x2369('0xb'));logger[_0x2369('0xc')](_0x2369('0xd'),_0x5a2c46,_0x2369('0xb'),JSON[_0x2369('0xe')](_0x1db13a));if(_0x1db13a[_0x2369('0xf')]){if(_0x1db13a[_0x2369('0xf')][_0x2369('0x10')]===0x1f4){logger[_0x2369('0xf')](_0x2369('0xa'),_0x5a2c46,_0x1db13a[_0x2369('0xf')][_0x2369('0x11')]);return _0x337d21(_0x1db13a[_0x2369('0xf')]['message']);}logger[_0x2369('0xf')](_0x2369('0xa'),_0x5a2c46,_0x1db13a[_0x2369('0xf')][_0x2369('0x11')]);return _0x295cc1(_0x1db13a[_0x2369('0xf')][_0x2369('0x11')]);}else{logger[_0x2369('0x9')](_0x2369('0xa'),_0x5a2c46,_0x2369('0xb'));_0x295cc1(_0x1db13a['result']['message']);}})[_0x2369('0x12')](function(_0x533aee){logger[_0x2369('0xf')]('SquareRecording,\x20%s,\x20%s',_0x5a2c46,_0x533aee);_0x337d21(_0x533aee);});});}exports[_0x2369('0x13')]=function(_0x49118a){var _0x1dab8d=this;return new Promise(function(_0x1c3049,_0x34243c){return db[_0x2369('0x14')][_0x2369('0x15')](_0x49118a['body'],{'raw':_0x49118a['options']?_0x49118a[_0x2369('0x16')][_0x2369('0x17')]===undefined?!![]:![]:!![]})[_0x2369('0x18')](function(_0x2b7c1d){logger[_0x2369('0x9')]('CreateSquareRecording',_0x49118a);logger[_0x2369('0xc')](_0x2369('0x13'),_0x49118a,JSON[_0x2369('0xe')](_0x2b7c1d));_0x1c3049(_0x2b7c1d);})[_0x2369('0x12')](function(_0x1c70b9){logger['error']('CreateSquareRecording',_0x1c70b9[_0x2369('0x11')],_0x49118a);_0x34243c(_0x1dab8d[_0x2369('0xf')](0x1f4,_0x1c70b9[_0x2369('0x11')]));});});}; \ No newline at end of file +var _0x6b63=['jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','create','body','options','raw','CreateSquareRecording','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x4b1d35,_0x1627ab){var _0x5d6bb7=function(_0x2f6b4f){while(--_0x2f6b4f){_0x4b1d35['push'](_0x4b1d35['shift']());}};_0x5d6bb7(++_0x1627ab);}(_0x6b63,0x19b));var _0x36b6=function(_0x4c7f56,_0x1c0086){_0x4c7f56=_0x4c7f56-0x0;var _0x4e030c=_0x6b63[_0x4c7f56];return _0x4e030c;};'use strict';var _=require(_0x36b6('0x0'));var util=require('util');var moment=require(_0x36b6('0x1'));var BPromise=require(_0x36b6('0x2'));var rs=require(_0x36b6('0x3'));var fs=require('fs');var Redis=require(_0x36b6('0x4'));var db=require(_0x36b6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x36b6('0x6'))(_0x36b6('0x7'));var config=require(_0x36b6('0x8'));var jayson=require(_0x36b6('0x9'));var client=jayson[_0x36b6('0xa')][_0x36b6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d8d77,_0x30e796,_0xfb11df){return new BPromise(function(_0x44cc1a,_0x104649){return client[_0x36b6('0xc')](_0x4d8d77,_0xfb11df)[_0x36b6('0xd')](function(_0xc4bb7b){logger['info'](_0x36b6('0xe'),_0x30e796,_0x36b6('0xf'));logger[_0x36b6('0x10')](_0x36b6('0x11'),_0x30e796,'request\x20sent',JSON[_0x36b6('0x12')](_0xc4bb7b));if(_0xc4bb7b[_0x36b6('0x13')]){if(_0xc4bb7b['error'][_0x36b6('0x14')]===0x1f4){logger[_0x36b6('0x13')](_0x36b6('0xe'),_0x30e796,_0xc4bb7b[_0x36b6('0x13')]['message']);return _0x104649(_0xc4bb7b[_0x36b6('0x13')]['message']);}logger[_0x36b6('0x13')](_0x36b6('0xe'),_0x30e796,_0xc4bb7b[_0x36b6('0x13')][_0x36b6('0x15')]);return _0x44cc1a(_0xc4bb7b[_0x36b6('0x13')][_0x36b6('0x15')]);}else{logger[_0x36b6('0x16')](_0x36b6('0xe'),_0x30e796,_0x36b6('0xf'));_0x44cc1a(_0xc4bb7b[_0x36b6('0x17')][_0x36b6('0x15')]);}})[_0x36b6('0x18')](function(_0x3eefa8){logger[_0x36b6('0x13')](_0x36b6('0xe'),_0x30e796,_0x3eefa8);_0x104649(_0x3eefa8);});});}exports['CreateSquareRecording']=function(_0x2e8ff0){var _0xc7429a=this;return new Promise(function(_0x357955,_0x3ed596){return db['SquareRecording'][_0x36b6('0x19')](_0x2e8ff0[_0x36b6('0x1a')],{'raw':_0x2e8ff0[_0x36b6('0x1b')]?_0x2e8ff0[_0x36b6('0x1b')][_0x36b6('0x1c')]===undefined?!![]:![]:!![]})[_0x36b6('0xd')](function(_0x3dee91){logger[_0x36b6('0x16')](_0x36b6('0x1d'),_0x2e8ff0);logger['debug'](_0x36b6('0x1d'),_0x2e8ff0,JSON[_0x36b6('0x12')](_0x3dee91));_0x357955(_0x3dee91);})['catch'](function(_0x2f9360){logger[_0x36b6('0x13')](_0x36b6('0x1d'),_0x2f9360['message'],_0x2e8ff0);_0x3ed596(_0xc7429a['error'](0x1f4,_0x2f9360['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index e8073eb..842e0f2 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 _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x1d2a90,_0x227227){var _0x5c94bb=function(_0x8b67a2){while(--_0x8b67a2){_0x1d2a90['push'](_0x1d2a90['shift']());}};_0x5c94bb(++_0x227227);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +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(_0x354b22,_0x343f43){var _0x231019=function(_0x584ef9){while(--_0x584ef9){_0x354b22['push'](_0x354b22['shift']());}};_0x231019(++_0x343f43);}(_0xe706,0xa3));var _0x6e70=function(_0x4ed32d,_0x327695){_0x4ed32d=_0x4ed32d-0x0;var _0xf624df=_0xe706[_0x4ed32d];return _0xf624df;};'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 c42b1b9..e914680 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 _0xca59=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x44bc06,_0x1f9bd5){var _0x3aba35=function(_0x50cfc0){while(--_0x50cfc0){_0x44bc06['push'](_0x44bc06['shift']());}};_0x3aba35(++_0x1f9bd5);}(_0xca59,0x1cd));var _0x9ca5=function(_0xe45f30,_0x16474c){_0xe45f30=_0xe45f30-0x0;var _0x1213e5=_0xca59[_0xe45f30];return _0x1213e5;};'use strict';var Sequelize=require(_0x9ca5('0x0'));module[_0x9ca5('0x1')]={'network':{'type':Sequelize[_0x9ca5('0x2')]},'network_script':{'type':Sequelize[_0x9ca5('0x2')]},'request':{'type':Sequelize[_0x9ca5('0x2')]},'channel':{'type':Sequelize[_0x9ca5('0x2')]},'language':{'type':Sequelize[_0x9ca5('0x2')]},'type':{'type':Sequelize[_0x9ca5('0x2')]},'uniqueid':{'type':Sequelize[_0x9ca5('0x2')]},'version':{'type':Sequelize[_0x9ca5('0x2')]},'callerid':{'type':Sequelize[_0x9ca5('0x2')]},'calleridname':{'type':Sequelize[_0x9ca5('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x9ca5('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x9ca5('0x2')]},'dnid':{'type':Sequelize[_0x9ca5('0x2')]},'rdnis':{'type':Sequelize[_0x9ca5('0x2')]},'context':{'type':Sequelize[_0x9ca5('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x9ca5('0x2')]},'accountcode':{'type':Sequelize[_0x9ca5('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x9ca5('0x3')]},'bot':{'type':Sequelize[_0x9ca5('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x76aa=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x2773ec,_0x2a5eef){var _0x235e68=function(_0x100f71){while(--_0x100f71){_0x2773ec['push'](_0x2773ec['shift']());}};_0x235e68(++_0x2a5eef);}(_0x76aa,0x131));var _0xa76a=function(_0x2b990c,_0x43cbcd){_0x2b990c=_0x2b990c-0x0;var _0x1b08f8=_0x76aa[_0x2b990c];return _0x1b08f8;};'use strict';var Sequelize=require(_0xa76a('0x0'));module[_0xa76a('0x1')]={'network':{'type':Sequelize[_0xa76a('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xa76a('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa76a('0x2')]},'type':{'type':Sequelize[_0xa76a('0x2')]},'uniqueid':{'type':Sequelize[_0xa76a('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa76a('0x2')]},'callingpres':{'type':Sequelize[_0xa76a('0x2')]},'callingani2':{'type':Sequelize[_0xa76a('0x2')]},'callington':{'type':Sequelize[_0xa76a('0x2')]},'callingtns':{'type':Sequelize[_0xa76a('0x2')]},'dnid':{'type':Sequelize[_0xa76a('0x2')]},'rdnis':{'type':Sequelize[_0xa76a('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa76a('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa76a('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xa76a('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa76a('0x3')]},'bot':{'type':Sequelize[_0xa76a('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index b7db797..93fcf25 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 _0x1a98=['attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','model','keys','query','filters','intersection'];(function(_0x137d53,_0x506647){var _0x463d38=function(_0x3f6e55){while(--_0x3f6e55){_0x137d53['push'](_0x137d53['shift']());}};_0x463d38(++_0x506647);}(_0x1a98,0xaf));var _0x81a9=function(_0x399b31,_0x5bd1b5){_0x399b31=_0x399b31-0x0;var _0x8b922=_0x1a98[_0x399b31];return _0x8b922;};'use strict';var emlformat=require(_0x81a9('0x0'));var rimraf=require(_0x81a9('0x1'));var zipdir=require(_0x81a9('0x2'));var jsonpatch=require(_0x81a9('0x3'));var rp=require(_0x81a9('0x4'));var moment=require('moment');var BPromise=require(_0x81a9('0x5'));var Mustache=require(_0x81a9('0x6'));var util=require('util');var path=require(_0x81a9('0x7'));var sox=require(_0x81a9('0x8'));var csv=require(_0x81a9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x81a9('0xa'));var _=require(_0x81a9('0xb'));var squel=require('squel');var crypto=require(_0x81a9('0xc'));var jsforce=require(_0x81a9('0xd'));var deskjs=require(_0x81a9('0xe'));var toCsv=require(_0x81a9('0x9'));var querystring=require(_0x81a9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x81a9('0x10'));var qs=require(_0x81a9('0x11'));var as=require(_0x81a9('0x12'));var hardwareService=require(_0x81a9('0x13'));var logger=require(_0x81a9('0x14'))(_0x81a9('0x15'));var utils=require(_0x81a9('0x16'));var config=require(_0x81a9('0x17'));var licenseUtil=require(_0x81a9('0x18'));var db=require(_0x81a9('0x19'))['db'];function respondWithStatusCode(_0x3ddcab,_0x28c49c){_0x28c49c=_0x28c49c||0xcc;return function(_0x316350){if(_0x316350){return _0x3ddcab[_0x81a9('0x1a')](_0x28c49c);}return _0x3ddcab[_0x81a9('0x1b')](_0x28c49c)[_0x81a9('0x1c')]();};}function respondWithResult(_0x25ccc7,_0x4ddd3b){_0x4ddd3b=_0x4ddd3b||0xc8;return function(_0x25c027){if(_0x25c027){return _0x25ccc7['status'](_0x4ddd3b)[_0x81a9('0x1d')](_0x25c027);}};}function respondWithFilteredResult(_0xee8773,_0xc209bd){return function(_0x1497e9){if(_0x1497e9){var _0x5b8fa5=typeof _0xc209bd[_0x81a9('0x1e')]===_0x81a9('0x1f')&&typeof _0xc209bd['limit']===_0x81a9('0x1f');var _0x47de2f=_0x1497e9[_0x81a9('0x20')];var _0x34d6ef=_0x5b8fa5?0x0:_0xc209bd[_0x81a9('0x1e')];var _0x1c069c=_0x5b8fa5?_0x1497e9['count']:_0xc209bd[_0x81a9('0x1e')]+_0xc209bd[_0x81a9('0x21')];var _0x21762a;if(_0x1c069c>=_0x47de2f){_0x1c069c=_0x47de2f;_0x21762a=0xc8;}else{_0x21762a=0xce;}_0xee8773[_0x81a9('0x1b')](_0x21762a);return _0xee8773[_0x81a9('0x22')]('Content-Range',_0x34d6ef+'-'+_0x1c069c+'/'+_0x47de2f)[_0x81a9('0x1d')](_0x1497e9);}return null;};}function patchUpdates(_0x203575){return function(_0x2cf1c4){try{jsonpatch[_0x81a9('0x23')](_0x2cf1c4,_0x203575,!![]);}catch(_0x30d617){return BPromise[_0x81a9('0x24')](_0x30d617);}return _0x2cf1c4[_0x81a9('0x25')]();};}function saveUpdates(_0x1b82c,_0x99397f){return function(_0x376fc2){if(_0x376fc2){return _0x376fc2[_0x81a9('0x26')](_0x1b82c)[_0x81a9('0x27')](function(_0x236871){return _0x236871;});}return null;};}function removeEntity(_0x3cfb68,_0x482b12){return function(_0x27cb4c){if(_0x27cb4c){return _0x27cb4c[_0x81a9('0x28')]()[_0x81a9('0x27')](function(){_0x3cfb68[_0x81a9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29d7d1,_0x5c4508){return function(_0x2e1ba){if(!_0x2e1ba){_0x29d7d1[_0x81a9('0x1a')](0x194);}return _0x2e1ba;};}function handleError(_0x3ed152,_0x2c0c7f){_0x2c0c7f=_0x2c0c7f||0x1f4;return function(_0x15e03c){logger[_0x81a9('0x29')](_0x15e03c[_0x81a9('0x2a')]);if(_0x15e03c[_0x81a9('0x2b')]){delete _0x15e03c[_0x81a9('0x2b')];}_0x3ed152[_0x81a9('0x1b')](_0x2c0c7f)[_0x81a9('0x2c')](_0x15e03c);};}exports['index']=function(_0x280f62,_0x514532){var _0x28ca0e={},_0x18fa97={},_0x43433d={'count':0x0,'rows':[]};var _0x2d17bf=_[_0x81a9('0x2d')](db['SquareReport'][_0x81a9('0x2e')],function(_0x162e50){return{'name':_0x162e50[_0x81a9('0x2f')],'type':_0x162e50['type']['key']};});_0x18fa97[_0x81a9('0x30')]=_['map'](_0x2d17bf,'name');_0x18fa97['query']=_[_0x81a9('0x31')](_0x280f62[_0x81a9('0x32')]);_0x18fa97[_0x81a9('0x33')]=_[_0x81a9('0x34')](_0x18fa97[_0x81a9('0x30')],_0x18fa97[_0x81a9('0x32')]);_0x28ca0e[_0x81a9('0x35')]=_['intersection'](_0x18fa97[_0x81a9('0x30')],qs[_0x81a9('0x36')](_0x280f62[_0x81a9('0x32')][_0x81a9('0x36')]));_0x28ca0e[_0x81a9('0x35')]=_0x28ca0e[_0x81a9('0x35')][_0x81a9('0x37')]?_0x28ca0e[_0x81a9('0x35')]:_0x18fa97['model'];if(!_0x280f62[_0x81a9('0x32')]['hasOwnProperty']('nolimit')){_0x28ca0e[_0x81a9('0x21')]=qs[_0x81a9('0x21')](_0x280f62[_0x81a9('0x32')][_0x81a9('0x21')]);_0x28ca0e['offset']=qs[_0x81a9('0x1e')](_0x280f62[_0x81a9('0x32')]['offset']);}_0x28ca0e[_0x81a9('0x38')]=qs[_0x81a9('0x39')](_0x280f62['query'][_0x81a9('0x39')]);_0x28ca0e[_0x81a9('0x3a')]=qs['filters'](_[_0x81a9('0x3b')](_0x280f62[_0x81a9('0x32')],_0x18fa97[_0x81a9('0x33')]),_0x2d17bf);if(_0x280f62['query'][_0x81a9('0x3c')]){_0x28ca0e[_0x81a9('0x3a')]=_[_0x81a9('0x3d')](_0x28ca0e['where'],{'$or':_[_0x81a9('0x2d')](_0x2d17bf,function(_0x498f22){if(_0x498f22['type']!==_0x81a9('0x3e')){var _0x1755c1={};_0x1755c1[_0x498f22[_0x81a9('0x2b')]]={'$like':'%'+_0x280f62[_0x81a9('0x32')]['filter']+'%'};return _0x1755c1;}})});}_0x28ca0e=_[_0x81a9('0x3d')]({},_0x28ca0e,_0x280f62[_0x81a9('0x3f')]);var _0x3638bf={'where':_0x28ca0e[_0x81a9('0x3a')]};return db[_0x81a9('0x40')]['count'](_0x3638bf)[_0x81a9('0x27')](function(_0x45305b){_0x43433d[_0x81a9('0x20')]=_0x45305b;if(_0x280f62[_0x81a9('0x32')][_0x81a9('0x41')]){_0x28ca0e[_0x81a9('0x42')]=[{'all':!![]}];}return db[_0x81a9('0x40')][_0x81a9('0x43')](_0x28ca0e);})['then'](function(_0x16961a){_0x43433d[_0x81a9('0x44')]=_0x16961a;return _0x43433d;})[_0x81a9('0x27')](respondWithFilteredResult(_0x514532,_0x28ca0e))[_0x81a9('0x45')](handleError(_0x514532,null));};exports[_0x81a9('0x46')]=function(_0x1dfcfb,_0x1b9f1b){var _0x36ecd9={'raw':!![],'where':{'id':_0x1dfcfb[_0x81a9('0x47')]['id']}},_0x5c5dff={};_0x5c5dff[_0x81a9('0x30')]=_[_0x81a9('0x31')](db[_0x81a9('0x40')][_0x81a9('0x2e')]);_0x5c5dff[_0x81a9('0x32')]=_[_0x81a9('0x31')](_0x1dfcfb[_0x81a9('0x32')]);_0x5c5dff[_0x81a9('0x33')]=_[_0x81a9('0x34')](_0x5c5dff[_0x81a9('0x30')],_0x5c5dff[_0x81a9('0x32')]);_0x36ecd9[_0x81a9('0x35')]=_[_0x81a9('0x34')](_0x5c5dff[_0x81a9('0x30')],qs[_0x81a9('0x36')](_0x1dfcfb[_0x81a9('0x32')][_0x81a9('0x36')]));_0x36ecd9[_0x81a9('0x35')]=_0x36ecd9[_0x81a9('0x35')][_0x81a9('0x37')]?_0x36ecd9[_0x81a9('0x35')]:_0x5c5dff[_0x81a9('0x30')];if(_0x1dfcfb[_0x81a9('0x32')][_0x81a9('0x41')]){_0x36ecd9['include']=[{'all':!![]}];}_0x36ecd9=_[_0x81a9('0x3d')]({},_0x36ecd9,_0x1dfcfb[_0x81a9('0x3f')]);return db['SquareReport'][_0x81a9('0x48')](_0x36ecd9)['then'](handleEntityNotFound(_0x1b9f1b,null))['then'](respondWithResult(_0x1b9f1b,null))['catch'](handleError(_0x1b9f1b,null));};exports[_0x81a9('0x49')]=function(_0x1527c9,_0x82d94c){return db[_0x81a9('0x40')]['create'](_0x1527c9[_0x81a9('0x4a')],{})[_0x81a9('0x27')](respondWithResult(_0x82d94c,0xc9))[_0x81a9('0x45')](handleError(_0x82d94c,null));};exports[_0x81a9('0x26')]=function(_0x5bd7fe,_0x4445f2){if(_0x5bd7fe['body']['id']){delete _0x5bd7fe[_0x81a9('0x4a')]['id'];}return db[_0x81a9('0x40')][_0x81a9('0x48')]({'where':{'id':_0x5bd7fe['params']['id']}})[_0x81a9('0x27')](handleEntityNotFound(_0x4445f2,null))[_0x81a9('0x27')](saveUpdates(_0x5bd7fe[_0x81a9('0x4a')],null))[_0x81a9('0x27')](respondWithResult(_0x4445f2,null))[_0x81a9('0x45')](handleError(_0x4445f2,null));};exports[_0x81a9('0x28')]=function(_0x1f036a,_0x131b1b){return db['SquareReport']['find']({'where':{'id':_0x1f036a[_0x81a9('0x47')]['id']}})[_0x81a9('0x27')](handleEntityNotFound(_0x131b1b,null))['then'](removeEntity(_0x131b1b,null))['catch'](handleError(_0x131b1b,null));};exports[_0x81a9('0x4b')]=function(_0xbc4dad,_0x162a78){return db[_0x81a9('0x40')][_0x81a9('0x4b')]()[_0x81a9('0x27')](respondWithResult(_0x162a78,null))[_0x81a9('0x45')](handleError(_0x162a78,null));}; \ No newline at end of file +var _0x846f=['lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','reject','save','update','then','destroy','error','stack','name','send','index','SquareReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x42a829,_0x430ec9){var _0x3159ff=function(_0x30cb9d){while(--_0x30cb9d){_0x42a829['push'](_0x42a829['shift']());}};_0x3159ff(++_0x430ec9);}(_0x846f,0x1b6));var _0xf846=function(_0x89b469,_0x4efc9d){_0x89b469=_0x89b469-0x0;var _0x41fee9=_0x846f[_0x89b469];return _0x41fee9;};'use strict';var emlformat=require(_0xf846('0x0'));var rimraf=require(_0xf846('0x1'));var zipdir=require(_0xf846('0x2'));var jsonpatch=require(_0xf846('0x3'));var rp=require('request-promise');var moment=require(_0xf846('0x4'));var BPromise=require(_0xf846('0x5'));var Mustache=require(_0xf846('0x6'));var util=require(_0xf846('0x7'));var path=require(_0xf846('0x8'));var sox=require('sox');var csv=require(_0xf846('0x9'));var ejs=require(_0xf846('0xa'));var fs=require('fs');var fs_extra=require(_0xf846('0xb'));var _=require(_0xf846('0xc'));var squel=require(_0xf846('0xd'));var crypto=require('crypto');var jsforce=require(_0xf846('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf846('0x9'));var querystring=require(_0xf846('0xf'));var Papa=require(_0xf846('0x10'));var Redis=require(_0xf846('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf846('0x12'));var as=require(_0xf846('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf846('0x14'))(_0xf846('0x15'));var utils=require('../../config/utils');var config=require(_0xf846('0x16'));var licenseUtil=require(_0xf846('0x17'));var db=require(_0xf846('0x18'))['db'];function respondWithStatusCode(_0x2c20eb,_0x8b37a){_0x8b37a=_0x8b37a||0xcc;return function(_0x56a3a8){if(_0x56a3a8){return _0x2c20eb[_0xf846('0x19')](_0x8b37a);}return _0x2c20eb[_0xf846('0x1a')](_0x8b37a)[_0xf846('0x1b')]();};}function respondWithResult(_0x11051d,_0x364af3){_0x364af3=_0x364af3||0xc8;return function(_0xae1cb4){if(_0xae1cb4){return _0x11051d['status'](_0x364af3)[_0xf846('0x1c')](_0xae1cb4);}};}function respondWithFilteredResult(_0x434d96,_0x192dc6){return function(_0x42585d){if(_0x42585d){var _0x1d7bca=typeof _0x192dc6['offset']===_0xf846('0x1d')&&typeof _0x192dc6[_0xf846('0x1e')]==='undefined';var _0x4e9ebe=_0x42585d[_0xf846('0x1f')];var _0x3b0bd9=_0x1d7bca?0x0:_0x192dc6[_0xf846('0x20')];var _0x4d6718=_0x1d7bca?_0x42585d['count']:_0x192dc6['offset']+_0x192dc6[_0xf846('0x1e')];var _0x21f815;if(_0x4d6718>=_0x4e9ebe){_0x4d6718=_0x4e9ebe;_0x21f815=0xc8;}else{_0x21f815=0xce;}_0x434d96[_0xf846('0x1a')](_0x21f815);return _0x434d96['set']('Content-Range',_0x3b0bd9+'-'+_0x4d6718+'/'+_0x4e9ebe)[_0xf846('0x1c')](_0x42585d);}return null;};}function patchUpdates(_0x14340f){return function(_0x3e4628){try{jsonpatch['apply'](_0x3e4628,_0x14340f,!![]);}catch(_0x208b52){return BPromise[_0xf846('0x21')](_0x208b52);}return _0x3e4628[_0xf846('0x22')]();};}function saveUpdates(_0x309f1d,_0x269a79){return function(_0x5471a1){if(_0x5471a1){return _0x5471a1[_0xf846('0x23')](_0x309f1d)[_0xf846('0x24')](function(_0x4baf5b){return _0x4baf5b;});}return null;};}function removeEntity(_0x35359b,_0x56b029){return function(_0x6307bb){if(_0x6307bb){return _0x6307bb[_0xf846('0x25')]()[_0xf846('0x24')](function(){_0x35359b[_0xf846('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c2e3c,_0x38b066){return function(_0x56a04b){if(!_0x56a04b){_0x1c2e3c[_0xf846('0x19')](0x194);}return _0x56a04b;};}function handleError(_0x42fe51,_0x2a5d82){_0x2a5d82=_0x2a5d82||0x1f4;return function(_0x213712){logger[_0xf846('0x26')](_0x213712[_0xf846('0x27')]);if(_0x213712[_0xf846('0x28')]){delete _0x213712[_0xf846('0x28')];}_0x42fe51[_0xf846('0x1a')](_0x2a5d82)[_0xf846('0x29')](_0x213712);};}exports[_0xf846('0x2a')]=function(_0x4c3085,_0x140354){var _0x22f3a3={},_0x50e63f={},_0x3b1354={'count':0x0,'rows':[]};var _0x377a41=_['map'](db[_0xf846('0x2b')][_0xf846('0x2c')],function(_0x25a3ef){return{'name':_0x25a3ef[_0xf846('0x2d')],'type':_0x25a3ef[_0xf846('0x2e')][_0xf846('0x2f')]};});_0x50e63f[_0xf846('0x30')]=_['map'](_0x377a41,_0xf846('0x28'));_0x50e63f['query']=_[_0xf846('0x31')](_0x4c3085[_0xf846('0x32')]);_0x50e63f[_0xf846('0x33')]=_[_0xf846('0x34')](_0x50e63f[_0xf846('0x30')],_0x50e63f['query']);_0x22f3a3[_0xf846('0x35')]=_[_0xf846('0x34')](_0x50e63f['model'],qs[_0xf846('0x36')](_0x4c3085['query'][_0xf846('0x36')]));_0x22f3a3[_0xf846('0x35')]=_0x22f3a3[_0xf846('0x35')][_0xf846('0x37')]?_0x22f3a3['attributes']:_0x50e63f[_0xf846('0x30')];if(!_0x4c3085[_0xf846('0x32')]['hasOwnProperty']('nolimit')){_0x22f3a3[_0xf846('0x1e')]=qs[_0xf846('0x1e')](_0x4c3085[_0xf846('0x32')][_0xf846('0x1e')]);_0x22f3a3[_0xf846('0x20')]=qs[_0xf846('0x20')](_0x4c3085[_0xf846('0x32')]['offset']);}_0x22f3a3[_0xf846('0x38')]=qs['sort'](_0x4c3085[_0xf846('0x32')][_0xf846('0x39')]);_0x22f3a3[_0xf846('0x3a')]=qs[_0xf846('0x33')](_['pick'](_0x4c3085[_0xf846('0x32')],_0x50e63f[_0xf846('0x33')]),_0x377a41);if(_0x4c3085[_0xf846('0x32')][_0xf846('0x3b')]){_0x22f3a3[_0xf846('0x3a')]=_['merge'](_0x22f3a3['where'],{'$or':_[_0xf846('0x3c')](_0x377a41,function(_0x20f4f7){if(_0x20f4f7[_0xf846('0x2e')]!==_0xf846('0x3d')){var _0x145792={};_0x145792[_0x20f4f7[_0xf846('0x28')]]={'$like':'%'+_0x4c3085[_0xf846('0x32')][_0xf846('0x3b')]+'%'};return _0x145792;}})});}_0x22f3a3=_[_0xf846('0x3e')]({},_0x22f3a3,_0x4c3085[_0xf846('0x3f')]);var _0x539432={'where':_0x22f3a3['where']};return db[_0xf846('0x2b')][_0xf846('0x1f')](_0x539432)[_0xf846('0x24')](function(_0x170a49){_0x3b1354['count']=_0x170a49;if(_0x4c3085[_0xf846('0x32')][_0xf846('0x40')]){_0x22f3a3[_0xf846('0x41')]=[{'all':!![]}];}return db[_0xf846('0x2b')][_0xf846('0x42')](_0x22f3a3);})['then'](function(_0x2fdbb1){_0x3b1354[_0xf846('0x43')]=_0x2fdbb1;return _0x3b1354;})[_0xf846('0x24')](respondWithFilteredResult(_0x140354,_0x22f3a3))[_0xf846('0x44')](handleError(_0x140354,null));};exports[_0xf846('0x45')]=function(_0x4e3def,_0x582f20){var _0x49f16a={'raw':!![],'where':{'id':_0x4e3def[_0xf846('0x46')]['id']}},_0x5b7a1c={};_0x5b7a1c[_0xf846('0x30')]=_[_0xf846('0x31')](db[_0xf846('0x2b')][_0xf846('0x2c')]);_0x5b7a1c[_0xf846('0x32')]=_[_0xf846('0x31')](_0x4e3def['query']);_0x5b7a1c[_0xf846('0x33')]=_[_0xf846('0x34')](_0x5b7a1c[_0xf846('0x30')],_0x5b7a1c[_0xf846('0x32')]);_0x49f16a[_0xf846('0x35')]=_[_0xf846('0x34')](_0x5b7a1c[_0xf846('0x30')],qs[_0xf846('0x36')](_0x4e3def['query'][_0xf846('0x36')]));_0x49f16a[_0xf846('0x35')]=_0x49f16a['attributes'][_0xf846('0x37')]?_0x49f16a[_0xf846('0x35')]:_0x5b7a1c[_0xf846('0x30')];if(_0x4e3def[_0xf846('0x32')][_0xf846('0x40')]){_0x49f16a[_0xf846('0x41')]=[{'all':!![]}];}_0x49f16a=_[_0xf846('0x3e')]({},_0x49f16a,_0x4e3def[_0xf846('0x3f')]);return db['SquareReport'][_0xf846('0x47')](_0x49f16a)[_0xf846('0x24')](handleEntityNotFound(_0x582f20,null))[_0xf846('0x24')](respondWithResult(_0x582f20,null))[_0xf846('0x44')](handleError(_0x582f20,null));};exports[_0xf846('0x48')]=function(_0x4cd5e8,_0x4cc62c){return db[_0xf846('0x2b')][_0xf846('0x48')](_0x4cd5e8[_0xf846('0x49')],{})[_0xf846('0x24')](respondWithResult(_0x4cc62c,0xc9))[_0xf846('0x44')](handleError(_0x4cc62c,null));};exports[_0xf846('0x23')]=function(_0x56bd60,_0x249620){if(_0x56bd60['body']['id']){delete _0x56bd60[_0xf846('0x49')]['id'];}return db[_0xf846('0x2b')][_0xf846('0x47')]({'where':{'id':_0x56bd60[_0xf846('0x46')]['id']}})['then'](handleEntityNotFound(_0x249620,null))[_0xf846('0x24')](saveUpdates(_0x56bd60[_0xf846('0x49')],null))['then'](respondWithResult(_0x249620,null))[_0xf846('0x44')](handleError(_0x249620,null));};exports[_0xf846('0x25')]=function(_0x25df6f,_0x20bceb){return db['SquareReport'][_0xf846('0x47')]({'where':{'id':_0x25df6f[_0xf846('0x46')]['id']}})['then'](handleEntityNotFound(_0x20bceb,null))[_0xf846('0x24')](removeEntity(_0x20bceb,null))[_0xf846('0x44')](handleError(_0x20bceb,null));};exports[_0xf846('0x4a')]=function(_0xa507c4,_0x2714dd){return db[_0xf846('0x2b')][_0xf846('0x4a')]()[_0xf846('0x24')](respondWithResult(_0x2714dd,null))['catch'](handleError(_0x2714dd,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 7bfd496..25b3ddc 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 _0xb471=['api','moment','bluebird','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','uniqueid','project_name','leaveAt','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb471,0x102));var _0x1b47=function(_0x37391d,_0x37f54b){_0x37391d=_0x37391d-0x0;var _0x337fcb=_0xb471[_0x37391d];return _0x337fcb;};'use strict';var _=require(_0x1b47('0x0'));var util=require(_0x1b47('0x1'));var logger=require('../../config/logger')(_0x1b47('0x2'));var moment=require(_0x1b47('0x3'));var BPromise=require(_0x1b47('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b47('0x5'));var config=require(_0x1b47('0x6'));var attributes=require(_0x1b47('0x7'));module[_0x1b47('0x8')]=function(_0x2a8def,_0x18591f){return _0x2a8def['define'](_0x1b47('0x9'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x1b47('0xa'),_0x1b47('0xb')]},{'name':_0x1b47('0xc'),'fields':[_0x1b47('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcbdb=['rimraf','../../config/environment','./squareReport.attributes','define','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2f4363,_0x24a102){var _0x318201=function(_0x4931c4){while(--_0x4931c4){_0x2f4363['push'](_0x2f4363['shift']());}};_0x318201(++_0x24a102);}(_0xcbdb,0x69));var _0xbcbd=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xcbdb[_0x257642];return _0x3d813b;};'use strict';var _=require(_0xbcbd('0x0'));var util=require('util');var logger=require(_0xbcbd('0x1'))(_0xbcbd('0x2'));var moment=require(_0xbcbd('0x3'));var BPromise=require(_0xbcbd('0x4'));var rp=require(_0xbcbd('0x5'));var fs=require('fs');var path=require(_0xbcbd('0x6'));var rimraf=require(_0xbcbd('0x7'));var config=require(_0xbcbd('0x8'));var attributes=require(_0xbcbd('0x9'));module['exports']=function(_0x85408d,_0x20643f){return _0x85408d[_0xbcbd('0xa')]('SquareReport',attributes,{'tableName':_0xbcbd('0xb'),'paranoid':![],'indexes':[{'name':_0xbcbd('0xc'),'fields':[_0xbcbd('0xd'),_0xbcbd('0xe')]},{'name':_0xbcbd('0xf'),'fields':[_0xbcbd('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 4bfb987..ef36cc3 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 _0x93ae=['result','catch','SquareReport','create','body','options','raw','CreateSquareReport','UpdateSquareReport','update','where','limit','debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','SquareReport,\x20%s,\x20%s','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x5b78da,_0x32f21f){var _0x230d5c=function(_0xf814dc){while(--_0xf814dc){_0x5b78da['push'](_0x5b78da['shift']());}};_0x230d5c(++_0x32f21f);}(_0x93ae,0x18d));var _0xe93a=function(_0x32d209,_0x4199f6){_0x32d209=_0x32d209-0x0;var _0xa5b959=_0x93ae[_0x32d209];return _0xa5b959;};'use strict';var _=require(_0xe93a('0x0'));var util=require('util');var moment=require(_0xe93a('0x1'));var BPromise=require(_0xe93a('0x2'));var rs=require(_0xe93a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe93a('0x4'))['db'];var utils=require(_0xe93a('0x5'));var logger=require(_0xe93a('0x6'))(_0xe93a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe93a('0x8')][_0xe93a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40385a,_0x36ff8e,_0x19b751){return new BPromise(function(_0x24f999,_0x578a6d){return client['request'](_0x40385a,_0x19b751)[_0xe93a('0xa')](function(_0x5e532d){logger[_0xe93a('0xb')](_0xe93a('0xc'),_0x36ff8e,'request\x20sent');logger['debug'](_0xe93a('0xd'),_0x36ff8e,_0xe93a('0xe'),JSON[_0xe93a('0xf')](_0x5e532d));if(_0x5e532d[_0xe93a('0x10')]){if(_0x5e532d[_0xe93a('0x10')][_0xe93a('0x11')]===0x1f4){logger[_0xe93a('0x10')](_0xe93a('0xc'),_0x36ff8e,_0x5e532d['error'][_0xe93a('0x12')]);return _0x578a6d(_0x5e532d[_0xe93a('0x10')][_0xe93a('0x12')]);}logger[_0xe93a('0x10')](_0xe93a('0xc'),_0x36ff8e,_0x5e532d[_0xe93a('0x10')][_0xe93a('0x12')]);return _0x24f999(_0x5e532d[_0xe93a('0x10')][_0xe93a('0x12')]);}else{logger[_0xe93a('0xb')]('SquareReport,\x20%s,\x20%s',_0x36ff8e,_0xe93a('0xe'));_0x24f999(_0x5e532d[_0xe93a('0x13')][_0xe93a('0x12')]);}})[_0xe93a('0x14')](function(_0x1d3722){logger[_0xe93a('0x10')](_0xe93a('0xc'),_0x36ff8e,_0x1d3722);_0x578a6d(_0x1d3722);});});}exports['CreateSquareReport']=function(_0x33a3bd){var _0x4edbc9=this;return new Promise(function(_0x43299d,_0x4da405){return db[_0xe93a('0x15')][_0xe93a('0x16')](_0x33a3bd[_0xe93a('0x17')],{'raw':_0x33a3bd[_0xe93a('0x18')]?_0x33a3bd['options'][_0xe93a('0x19')]===undefined?!![]:![]:!![]})[_0xe93a('0xa')](function(_0x1f3ce6){logger[_0xe93a('0xb')](_0xe93a('0x1a'),_0x33a3bd);logger['debug'](_0xe93a('0x1a'),_0x33a3bd,JSON['stringify'](_0x1f3ce6));_0x43299d(_0x1f3ce6);})['catch'](function(_0x315b6a){logger[_0xe93a('0x10')]('CreateSquareReport',_0x315b6a[_0xe93a('0x12')],_0x33a3bd);_0x4da405(_0x4edbc9[_0xe93a('0x10')](0x1f4,_0x315b6a[_0xe93a('0x12')]));});});};exports[_0xe93a('0x1b')]=function(_0x4b0483){var _0x5b723f=this;return new Promise(function(_0x122a39,_0x5d3e16){return db[_0xe93a('0x15')][_0xe93a('0x1c')](_0x4b0483[_0xe93a('0x17')],{'raw':_0x4b0483[_0xe93a('0x18')]?_0x4b0483['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b0483[_0xe93a('0x18')]?_0x4b0483['options'][_0xe93a('0x1d')]||null:null,'attributes':_0x4b0483['options']?_0x4b0483[_0xe93a('0x18')]['attributes']||null:null,'limit':_0x4b0483[_0xe93a('0x18')]?_0x4b0483[_0xe93a('0x18')][_0xe93a('0x1e')]||null:null})['then'](function(_0xda9249){logger[_0xe93a('0xb')](_0xe93a('0x1b'),_0x4b0483);logger[_0xe93a('0x1f')]('UpdateSquareReport',_0x4b0483,JSON[_0xe93a('0xf')](_0xda9249));_0x122a39(_0xda9249);})[_0xe93a('0x14')](function(_0x251802){logger[_0xe93a('0x10')](_0xe93a('0x1b'),_0x251802['message'],_0x4b0483);_0x5d3e16(_0x5b723f[_0xe93a('0x10')](0x1f4,_0x251802[_0xe93a('0x12')]));});});}; \ No newline at end of file +var _0x729c=['raw','CreateSquareReport','catch','SquareReport','update','where','attributes','limit','UpdateSquareReport','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','SquareReport,\x20%s,\x20%s','debug','stringify','code','error','message','request\x20sent','create','body','options'];(function(_0x4cdcea,_0x551728){var _0x335949=function(_0x2e1288){while(--_0x2e1288){_0x4cdcea['push'](_0x4cdcea['shift']());}};_0x335949(++_0x551728);}(_0x729c,0x1e9));var _0xc729=function(_0x1ef0c5,_0x49c061){_0x1ef0c5=_0x1ef0c5-0x0;var _0x114307=_0x729c[_0x1ef0c5];return _0x114307;};'use strict';var _=require(_0xc729('0x0'));var util=require('util');var moment=require(_0xc729('0x1'));var BPromise=require(_0xc729('0x2'));var rs=require(_0xc729('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc729('0x4'))['db'];var utils=require(_0xc729('0x5'));var logger=require('../../config/logger')(_0xc729('0x6'));var config=require(_0xc729('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc729('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4366a7,_0xe06ac4,_0x29f344){return new BPromise(function(_0x49293c,_0x430c4e){return client['request'](_0x4366a7,_0x29f344)[_0xc729('0x9')](function(_0xedfec1){logger[_0xc729('0xa')](_0xc729('0xb'),_0xe06ac4,'request\x20sent');logger[_0xc729('0xc')]('SquareReport,\x20%s,\x20%s,\x20%s',_0xe06ac4,'request\x20sent',JSON[_0xc729('0xd')](_0xedfec1));if(_0xedfec1['error']){if(_0xedfec1['error'][_0xc729('0xe')]===0x1f4){logger[_0xc729('0xf')](_0xc729('0xb'),_0xe06ac4,_0xedfec1[_0xc729('0xf')][_0xc729('0x10')]);return _0x430c4e(_0xedfec1[_0xc729('0xf')][_0xc729('0x10')]);}logger['error'](_0xc729('0xb'),_0xe06ac4,_0xedfec1['error'][_0xc729('0x10')]);return _0x49293c(_0xedfec1[_0xc729('0xf')][_0xc729('0x10')]);}else{logger[_0xc729('0xa')]('SquareReport,\x20%s,\x20%s',_0xe06ac4,_0xc729('0x11'));_0x49293c(_0xedfec1['result'][_0xc729('0x10')]);}})['catch'](function(_0x29ece1){logger[_0xc729('0xf')](_0xc729('0xb'),_0xe06ac4,_0x29ece1);_0x430c4e(_0x29ece1);});});}exports['CreateSquareReport']=function(_0x1738a8){var _0x304159=this;return new Promise(function(_0x42d34e,_0x1f5d5f){return db['SquareReport'][_0xc729('0x12')](_0x1738a8[_0xc729('0x13')],{'raw':_0x1738a8[_0xc729('0x14')]?_0x1738a8['options'][_0xc729('0x15')]===undefined?!![]:![]:!![]})[_0xc729('0x9')](function(_0x4bdef3){logger[_0xc729('0xa')](_0xc729('0x16'),_0x1738a8);logger['debug']('CreateSquareReport',_0x1738a8,JSON[_0xc729('0xd')](_0x4bdef3));_0x42d34e(_0x4bdef3);})[_0xc729('0x17')](function(_0x5e5f25){logger['error'](_0xc729('0x16'),_0x5e5f25[_0xc729('0x10')],_0x1738a8);_0x1f5d5f(_0x304159[_0xc729('0xf')](0x1f4,_0x5e5f25[_0xc729('0x10')]));});});};exports['UpdateSquareReport']=function(_0x506f38){var _0x351d31=this;return new Promise(function(_0x1d2386,_0x215259){return db[_0xc729('0x18')][_0xc729('0x19')](_0x506f38[_0xc729('0x13')],{'raw':_0x506f38['options']?_0x506f38['options'][_0xc729('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x506f38[_0xc729('0x14')]?_0x506f38[_0xc729('0x14')][_0xc729('0x1a')]||null:null,'attributes':_0x506f38[_0xc729('0x14')]?_0x506f38[_0xc729('0x14')][_0xc729('0x1b')]||null:null,'limit':_0x506f38['options']?_0x506f38[_0xc729('0x14')][_0xc729('0x1c')]||null:null})[_0xc729('0x9')](function(_0x1a1149){logger[_0xc729('0xa')](_0xc729('0x1d'),_0x506f38);logger['debug'](_0xc729('0x1d'),_0x506f38,JSON[_0xc729('0xd')](_0x1a1149));_0x1d2386(_0x1a1149);})['catch'](function(_0x1a6aea){logger[_0xc729('0xf')]('UpdateSquareReport',_0x1a6aea[_0xc729('0x10')],_0x506f38);_0x215259(_0x351d31[_0xc729('0xf')](0x1f4,_0x1a6aea[_0xc729('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 54efcda..ebcc3d6 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 _0xd509=['create','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x3e7aa4,_0x3614fd){var _0x3e733c=function(_0x2a638a){while(--_0x2a638a){_0x3e7aa4['push'](_0x3e7aa4['shift']());}};_0x3e733c(++_0x3614fd);}(_0xd509,0xe9));var _0x9d50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd509[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9d50('0x0'));var timeout=require(_0x9d50('0x1'));var express=require(_0x9d50('0x2'));var router=express[_0x9d50('0x3')]();var fs_extra=require(_0x9d50('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9d50('0x5'));var config=require(_0x9d50('0x6'));var controller=require('./squareReportDetail.controller');router[_0x9d50('0x7')]('/',auth[_0x9d50('0x8')](),controller[_0x9d50('0x9')]);router['get'](_0x9d50('0xa'),auth[_0x9d50('0x8')](),controller[_0x9d50('0xb')]);router[_0x9d50('0x7')](_0x9d50('0xc'),auth[_0x9d50('0x8')](),controller['show']);router[_0x9d50('0xd')]('/',auth[_0x9d50('0x8')](),controller[_0x9d50('0xe')]);router[_0x9d50('0xf')](_0x9d50('0xc'),auth[_0x9d50('0x8')](),controller[_0x9d50('0x10')]);router[_0x9d50('0x11')](_0x9d50('0xc'),auth[_0x9d50('0x8')](),controller['destroy']);module[_0x9d50('0x12')]=router; \ No newline at end of file +var _0x734f=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x30366a,_0x37d6fd){var _0x28a979=function(_0x43f2ea){while(--_0x43f2ea){_0x30366a['push'](_0x30366a['shift']());}};_0x28a979(++_0x37d6fd);}(_0x734f,0x1d6));var _0xf734=function(_0x21014b,_0xb932fe){_0x21014b=_0x21014b-0x0;var _0x4da430=_0x734f[_0x21014b];return _0x4da430;};'use strict';var multer=require(_0xf734('0x0'));var util=require(_0xf734('0x1'));var path=require(_0xf734('0x2'));var timeout=require(_0xf734('0x3'));var express=require(_0xf734('0x4'));var router=express[_0xf734('0x5')]();var fs_extra=require(_0xf734('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf734('0x7'));var controller=require(_0xf734('0x8'));router[_0xf734('0x9')]('/',auth[_0xf734('0xa')](),controller['index']);router[_0xf734('0x9')](_0xf734('0xb'),auth[_0xf734('0xa')](),controller[_0xf734('0xc')]);router[_0xf734('0x9')](_0xf734('0xd'),auth[_0xf734('0xa')](),controller[_0xf734('0xe')]);router[_0xf734('0xf')]('/',auth[_0xf734('0xa')](),controller[_0xf734('0x10')]);router[_0xf734('0x11')](_0xf734('0xd'),auth[_0xf734('0xa')](),controller[_0xf734('0x12')]);router[_0xf734('0x13')](_0xf734('0xd'),auth[_0xf734('0xa')](),controller[_0xf734('0x14')]);module[_0xf734('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 18f7082..e37f701 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 _0x05ec=['exports','STRING','TEXT','sequelize'];(function(_0x431b47,_0x2b8527){var _0xe3ef3a=function(_0x2962c2){while(--_0x2962c2){_0x431b47['push'](_0x431b47['shift']());}};_0xe3ef3a(++_0x2b8527);}(_0x05ec,0x107));var _0xc05e=function(_0x37d015,_0x23e074){_0x37d015=_0x37d015-0x0;var _0x173a60=_0x05ec[_0x37d015];return _0x173a60;};'use strict';var Sequelize=require(_0xc05e('0x0'));module[_0xc05e('0x1')]={'uniqueid':{'type':Sequelize[_0xc05e('0x2')]},'node':{'type':Sequelize[_0xc05e('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xc05e('0x3')]},'project_name':{'type':Sequelize[_0xc05e('0x2')]},'callerid':{'type':Sequelize[_0xc05e('0x2')]}}; \ No newline at end of file +var _0xc53d=['STRING','TEXT','exports'];(function(_0xcc26d2,_0x20c921){var _0x3841e2=function(_0x1ba4ea){while(--_0x1ba4ea){_0xcc26d2['push'](_0xcc26d2['shift']());}};_0x3841e2(++_0x20c921);}(_0xc53d,0x8c));var _0xdc53=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc53d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xdc53('0x0')]={'uniqueid':{'type':Sequelize[_0xdc53('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xdc53('0x2')]},'project_name':{'type':Sequelize[_0xdc53('0x1')]},'callerid':{'type':Sequelize[_0xdc53('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index c85756a..cd61c24 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 _0xc3a1=['to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','stack','name','send','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','where','filters','pick','filter','merge','VIRTUAL','options','SquareDetailsReport','includeAll','include','rows','params','catch','create','body','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox'];(function(_0x25bdd0,_0x28ed57){var _0x11430e=function(_0x5891fe){while(--_0x5891fe){_0x25bdd0['push'](_0x25bdd0['shift']());}};_0x11430e(++_0x28ed57);}(_0xc3a1,0x118));var _0x1c3a=function(_0x416b20,_0x15a533){_0x416b20=_0x416b20-0x0;var _0x134714=_0xc3a1[_0x416b20];return _0x134714;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c3a('0x0'));var zipdir=require(_0x1c3a('0x1'));var jsonpatch=require(_0x1c3a('0x2'));var rp=require('request-promise');var moment=require(_0x1c3a('0x3'));var BPromise=require(_0x1c3a('0x4'));var Mustache=require(_0x1c3a('0x5'));var util=require('util');var path=require(_0x1c3a('0x6'));var sox=require(_0x1c3a('0x7'));var csv=require(_0x1c3a('0x8'));var ejs=require(_0x1c3a('0x9'));var fs=require('fs');var fs_extra=require(_0x1c3a('0xa'));var _=require(_0x1c3a('0xb'));var squel=require(_0x1c3a('0xc'));var crypto=require('crypto');var jsforce=require(_0x1c3a('0xd'));var deskjs=require(_0x1c3a('0xe'));var toCsv=require(_0x1c3a('0x8'));var querystring=require(_0x1c3a('0xf'));var Papa=require('papaparse');var Redis=require(_0x1c3a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1c3a('0x11'));var as=require(_0x1c3a('0x12'));var hardwareService=require(_0x1c3a('0x13'));var logger=require(_0x1c3a('0x14'))(_0x1c3a('0x15'));var utils=require(_0x1c3a('0x16'));var config=require(_0x1c3a('0x17'));var licenseUtil=require(_0x1c3a('0x18'));var db=require(_0x1c3a('0x19'))['db'];function respondWithStatusCode(_0x59eb16,_0x30b4ee){_0x30b4ee=_0x30b4ee||0xcc;return function(_0xdaa2ac){if(_0xdaa2ac){return _0x59eb16[_0x1c3a('0x1a')](_0x30b4ee);}return _0x59eb16[_0x1c3a('0x1b')](_0x30b4ee)['end']();};}function respondWithResult(_0x5dddb6,_0x1fe8ac){_0x1fe8ac=_0x1fe8ac||0xc8;return function(_0x383602){if(_0x383602){return _0x5dddb6[_0x1c3a('0x1b')](_0x1fe8ac)[_0x1c3a('0x1c')](_0x383602);}};}function respondWithFilteredResult(_0x2c89f0,_0x321ff5){return function(_0x18f281){if(_0x18f281){var _0x1158d5=typeof _0x321ff5[_0x1c3a('0x1d')]===_0x1c3a('0x1e')&&typeof _0x321ff5[_0x1c3a('0x1f')]===_0x1c3a('0x1e');var _0x392dda=_0x18f281[_0x1c3a('0x20')];var _0x31c24f=_0x1158d5?0x0:_0x321ff5[_0x1c3a('0x1d')];var _0x106320=_0x1158d5?_0x18f281['count']:_0x321ff5[_0x1c3a('0x1d')]+_0x321ff5['limit'];var _0x27f51f;if(_0x106320>=_0x392dda){_0x106320=_0x392dda;_0x27f51f=0xc8;}else{_0x27f51f=0xce;}_0x2c89f0[_0x1c3a('0x1b')](_0x27f51f);return _0x2c89f0[_0x1c3a('0x21')](_0x1c3a('0x22'),_0x31c24f+'-'+_0x106320+'/'+_0x392dda)[_0x1c3a('0x1c')](_0x18f281);}return null;};}function patchUpdates(_0x11a919){return function(_0x4d502b){try{jsonpatch[_0x1c3a('0x23')](_0x4d502b,_0x11a919,!![]);}catch(_0xb08b2a){return BPromise['reject'](_0xb08b2a);}return _0x4d502b['save']();};}function saveUpdates(_0x485e4e,_0x211380){return function(_0x418c25){if(_0x418c25){return _0x418c25[_0x1c3a('0x24')](_0x485e4e)[_0x1c3a('0x25')](function(_0x1a76f5){return _0x1a76f5;});}return null;};}function removeEntity(_0x5bb240,_0x2a4786){return function(_0x5a95fe){if(_0x5a95fe){return _0x5a95fe[_0x1c3a('0x26')]()[_0x1c3a('0x25')](function(){_0x5bb240[_0x1c3a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e72f7,_0x249c3c){return function(_0x5961ed){if(!_0x5961ed){_0x3e72f7[_0x1c3a('0x1a')](0x194);}return _0x5961ed;};}function handleError(_0x147daa,_0x422305){_0x422305=_0x422305||0x1f4;return function(_0x35ffec){logger['error'](_0x35ffec[_0x1c3a('0x27')]);if(_0x35ffec['name']){delete _0x35ffec[_0x1c3a('0x28')];}_0x147daa[_0x1c3a('0x1b')](_0x422305)[_0x1c3a('0x29')](_0x35ffec);};}exports['index']=function(_0x42a339,_0x321c4a){var _0x362045={},_0x378b34={},_0x520ab7={'count':0x0,'rows':[]};var _0x1ba3d6=_[_0x1c3a('0x2a')](db['SquareDetailsReport'][_0x1c3a('0x2b')],function(_0x2f4504){return{'name':_0x2f4504['fieldName'],'type':_0x2f4504[_0x1c3a('0x2c')][_0x1c3a('0x2d')]};});_0x378b34[_0x1c3a('0x2e')]=_[_0x1c3a('0x2a')](_0x1ba3d6,_0x1c3a('0x28'));_0x378b34[_0x1c3a('0x2f')]=_[_0x1c3a('0x30')](_0x42a339[_0x1c3a('0x2f')]);_0x378b34['filters']=_[_0x1c3a('0x31')](_0x378b34[_0x1c3a('0x2e')],_0x378b34[_0x1c3a('0x2f')]);_0x362045[_0x1c3a('0x32')]=_[_0x1c3a('0x31')](_0x378b34['model'],qs[_0x1c3a('0x33')](_0x42a339[_0x1c3a('0x2f')][_0x1c3a('0x33')]));_0x362045[_0x1c3a('0x32')]=_0x362045[_0x1c3a('0x32')][_0x1c3a('0x34')]?_0x362045['attributes']:_0x378b34[_0x1c3a('0x2e')];if(!_0x42a339[_0x1c3a('0x2f')][_0x1c3a('0x35')]('nolimit')){_0x362045[_0x1c3a('0x1f')]=qs[_0x1c3a('0x1f')](_0x42a339['query']['limit']);_0x362045[_0x1c3a('0x1d')]=qs[_0x1c3a('0x1d')](_0x42a339['query'][_0x1c3a('0x1d')]);}_0x362045[_0x1c3a('0x36')]=qs['sort'](_0x42a339[_0x1c3a('0x2f')]['sort']);_0x362045[_0x1c3a('0x37')]=qs[_0x1c3a('0x38')](_[_0x1c3a('0x39')](_0x42a339[_0x1c3a('0x2f')],_0x378b34['filters']),_0x1ba3d6);if(_0x42a339['query'][_0x1c3a('0x3a')]){_0x362045['where']=_[_0x1c3a('0x3b')](_0x362045[_0x1c3a('0x37')],{'$or':_[_0x1c3a('0x2a')](_0x1ba3d6,function(_0x2f67aa){if(_0x2f67aa[_0x1c3a('0x2c')]!==_0x1c3a('0x3c')){var _0x5e9beb={};_0x5e9beb[_0x2f67aa['name']]={'$like':'%'+_0x42a339[_0x1c3a('0x2f')][_0x1c3a('0x3a')]+'%'};return _0x5e9beb;}})});}_0x362045=_[_0x1c3a('0x3b')]({},_0x362045,_0x42a339[_0x1c3a('0x3d')]);var _0x302ab8={'where':_0x362045[_0x1c3a('0x37')]};return db[_0x1c3a('0x3e')]['count'](_0x302ab8)[_0x1c3a('0x25')](function(_0x487386){_0x520ab7[_0x1c3a('0x20')]=_0x487386;if(_0x42a339[_0x1c3a('0x2f')][_0x1c3a('0x3f')]){_0x362045[_0x1c3a('0x40')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x362045);})['then'](function(_0xbdcb74){_0x520ab7[_0x1c3a('0x41')]=_0xbdcb74;return _0x520ab7;})[_0x1c3a('0x25')](respondWithFilteredResult(_0x321c4a,_0x362045))['catch'](handleError(_0x321c4a,null));};exports['show']=function(_0x1040c2,_0x5e8622){var _0x4bf94b={'raw':!![],'where':{'id':_0x1040c2[_0x1c3a('0x42')]['id']}},_0x4374e3={};_0x4374e3[_0x1c3a('0x2e')]=_[_0x1c3a('0x30')](db['SquareDetailsReport'][_0x1c3a('0x2b')]);_0x4374e3[_0x1c3a('0x2f')]=_[_0x1c3a('0x30')](_0x1040c2[_0x1c3a('0x2f')]);_0x4374e3[_0x1c3a('0x38')]=_[_0x1c3a('0x31')](_0x4374e3[_0x1c3a('0x2e')],_0x4374e3[_0x1c3a('0x2f')]);_0x4bf94b[_0x1c3a('0x32')]=_[_0x1c3a('0x31')](_0x4374e3[_0x1c3a('0x2e')],qs[_0x1c3a('0x33')](_0x1040c2[_0x1c3a('0x2f')][_0x1c3a('0x33')]));_0x4bf94b[_0x1c3a('0x32')]=_0x4bf94b[_0x1c3a('0x32')][_0x1c3a('0x34')]?_0x4bf94b[_0x1c3a('0x32')]:_0x4374e3['model'];if(_0x1040c2[_0x1c3a('0x2f')][_0x1c3a('0x3f')]){_0x4bf94b[_0x1c3a('0x40')]=[{'all':!![]}];}_0x4bf94b=_['merge']({},_0x4bf94b,_0x1040c2['options']);return db[_0x1c3a('0x3e')]['find'](_0x4bf94b)[_0x1c3a('0x25')](handleEntityNotFound(_0x5e8622,null))['then'](respondWithResult(_0x5e8622,null))[_0x1c3a('0x43')](handleError(_0x5e8622,null));};exports['create']=function(_0x494f98,_0x11318a){return db[_0x1c3a('0x3e')][_0x1c3a('0x44')](_0x494f98[_0x1c3a('0x45')],{})['then'](respondWithResult(_0x11318a,0xc9))[_0x1c3a('0x43')](handleError(_0x11318a,null));};exports[_0x1c3a('0x24')]=function(_0x2067e5,_0x3fbc7b){if(_0x2067e5[_0x1c3a('0x45')]['id']){delete _0x2067e5[_0x1c3a('0x45')]['id'];}return db[_0x1c3a('0x3e')][_0x1c3a('0x46')]({'where':{'id':_0x2067e5[_0x1c3a('0x42')]['id']}})[_0x1c3a('0x25')](handleEntityNotFound(_0x3fbc7b,null))[_0x1c3a('0x25')](saveUpdates(_0x2067e5['body'],null))[_0x1c3a('0x25')](respondWithResult(_0x3fbc7b,null))[_0x1c3a('0x43')](handleError(_0x3fbc7b,null));};exports[_0x1c3a('0x26')]=function(_0x2ead75,_0x39df18){return db['SquareDetailsReport'][_0x1c3a('0x46')]({'where':{'id':_0x2ead75[_0x1c3a('0x42')]['id']}})[_0x1c3a('0x25')](handleEntityNotFound(_0x39df18,null))['then'](removeEntity(_0x39df18,null))[_0x1c3a('0x43')](handleError(_0x39df18,null));};exports[_0x1c3a('0x47')]=function(_0x4dfe20,_0x363994){return db[_0x1c3a('0x3e')][_0x1c3a('0x47')]()[_0x1c3a('0x25')](respondWithResult(_0x363994,null))[_0x1c3a('0x43')](handleError(_0x363994,null));}; \ No newline at end of file +var _0x7675=['model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','VIRTUAL','filter','options','includeAll','include','rows','catch','params','find','create','update','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','status','sendStatus','error','stack','name','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key'];(function(_0x42d36f,_0x1ae79c){var _0x3650d3=function(_0x348344){while(--_0x348344){_0x42d36f['push'](_0x42d36f['shift']());}};_0x3650d3(++_0x1ae79c);}(_0x7675,0x131));var _0x5767=function(_0x357726,_0x31fa54){_0x357726=_0x357726-0x0;var _0x14a947=_0x7675[_0x357726];return _0x14a947;};'use strict';var emlformat=require(_0x5767('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5767('0x1'));var jsonpatch=require(_0x5767('0x2'));var rp=require('request-promise');var moment=require(_0x5767('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5767('0x4'));var path=require(_0x5767('0x5'));var sox=require(_0x5767('0x6'));var csv=require(_0x5767('0x7'));var ejs=require(_0x5767('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5767('0x9'));var crypto=require(_0x5767('0xa'));var jsforce=require(_0x5767('0xb'));var deskjs=require(_0x5767('0xc'));var toCsv=require(_0x5767('0x7'));var querystring=require(_0x5767('0xd'));var Papa=require(_0x5767('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5767('0xf'));var as=require(_0x5767('0x10'));var hardwareService=require(_0x5767('0x11'));var logger=require(_0x5767('0x12'))('api');var utils=require(_0x5767('0x13'));var config=require(_0x5767('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5767('0x15'))['db'];function respondWithStatusCode(_0x2020d1,_0x29712a){_0x29712a=_0x29712a||0xcc;return function(_0x339ada){if(_0x339ada){return _0x2020d1['sendStatus'](_0x29712a);}return _0x2020d1['status'](_0x29712a)[_0x5767('0x16')]();};}function respondWithResult(_0x18a739,_0x2aee47){_0x2aee47=_0x2aee47||0xc8;return function(_0x56a7f8){if(_0x56a7f8){return _0x18a739['status'](_0x2aee47)[_0x5767('0x17')](_0x56a7f8);}};}function respondWithFilteredResult(_0x3afe12,_0x3d3561){return function(_0x39b564){if(_0x39b564){var _0x534488=typeof _0x3d3561[_0x5767('0x18')]===_0x5767('0x19')&&typeof _0x3d3561['limit']===_0x5767('0x19');var _0x353f9b=_0x39b564[_0x5767('0x1a')];var _0x32ff68=_0x534488?0x0:_0x3d3561[_0x5767('0x18')];var _0x3440c5=_0x534488?_0x39b564[_0x5767('0x1a')]:_0x3d3561[_0x5767('0x18')]+_0x3d3561[_0x5767('0x1b')];var _0xbbd6fe;if(_0x3440c5>=_0x353f9b){_0x3440c5=_0x353f9b;_0xbbd6fe=0xc8;}else{_0xbbd6fe=0xce;}_0x3afe12['status'](_0xbbd6fe);return _0x3afe12['set'](_0x5767('0x1c'),_0x32ff68+'-'+_0x3440c5+'/'+_0x353f9b)[_0x5767('0x17')](_0x39b564);}return null;};}function patchUpdates(_0x109aac){return function(_0x504b41){try{jsonpatch[_0x5767('0x1d')](_0x504b41,_0x109aac,!![]);}catch(_0x1991d7){return BPromise[_0x5767('0x1e')](_0x1991d7);}return _0x504b41[_0x5767('0x1f')]();};}function saveUpdates(_0x2078d6,_0x1da7bd){return function(_0x5ded3a){if(_0x5ded3a){return _0x5ded3a['update'](_0x2078d6)['then'](function(_0x15bc7e){return _0x15bc7e;});}return null;};}function removeEntity(_0x428720,_0x10295d){return function(_0x57fb14){if(_0x57fb14){return _0x57fb14['destroy']()[_0x5767('0x20')](function(){_0x428720[_0x5767('0x21')](0xcc)[_0x5767('0x16')]();});}};}function handleEntityNotFound(_0x450198,_0x361503){return function(_0x4a7973){if(!_0x4a7973){_0x450198[_0x5767('0x22')](0x194);}return _0x4a7973;};}function handleError(_0x460075,_0xbca54){_0xbca54=_0xbca54||0x1f4;return function(_0x46b965){logger[_0x5767('0x23')](_0x46b965[_0x5767('0x24')]);if(_0x46b965[_0x5767('0x25')]){delete _0x46b965[_0x5767('0x25')];}_0x460075[_0x5767('0x21')](_0xbca54)['send'](_0x46b965);};}exports[_0x5767('0x26')]=function(_0x571081,_0x42bee6){var _0x18bc9c={},_0x2397c2={},_0x196c01={'count':0x0,'rows':[]};var _0x136bda=_[_0x5767('0x27')](db[_0x5767('0x28')][_0x5767('0x29')],function(_0x4f3f9c){return{'name':_0x4f3f9c[_0x5767('0x2a')],'type':_0x4f3f9c[_0x5767('0x2b')][_0x5767('0x2c')]};});_0x2397c2[_0x5767('0x2d')]=_[_0x5767('0x27')](_0x136bda,_0x5767('0x25'));_0x2397c2[_0x5767('0x2e')]=_[_0x5767('0x2f')](_0x571081[_0x5767('0x2e')]);_0x2397c2[_0x5767('0x30')]=_[_0x5767('0x31')](_0x2397c2['model'],_0x2397c2[_0x5767('0x2e')]);_0x18bc9c[_0x5767('0x32')]=_[_0x5767('0x31')](_0x2397c2[_0x5767('0x2d')],qs['fields'](_0x571081['query'][_0x5767('0x33')]));_0x18bc9c['attributes']=_0x18bc9c[_0x5767('0x32')]['length']?_0x18bc9c[_0x5767('0x32')]:_0x2397c2[_0x5767('0x2d')];if(!_0x571081[_0x5767('0x2e')]['hasOwnProperty'](_0x5767('0x34'))){_0x18bc9c['limit']=qs[_0x5767('0x1b')](_0x571081[_0x5767('0x2e')]['limit']);_0x18bc9c[_0x5767('0x18')]=qs[_0x5767('0x18')](_0x571081[_0x5767('0x2e')][_0x5767('0x18')]);}_0x18bc9c['order']=qs[_0x5767('0x35')](_0x571081[_0x5767('0x2e')][_0x5767('0x35')]);_0x18bc9c[_0x5767('0x36')]=qs[_0x5767('0x30')](_[_0x5767('0x37')](_0x571081['query'],_0x2397c2['filters']),_0x136bda);if(_0x571081[_0x5767('0x2e')]['filter']){_0x18bc9c[_0x5767('0x36')]=_['merge'](_0x18bc9c[_0x5767('0x36')],{'$or':_[_0x5767('0x27')](_0x136bda,function(_0x3293de){if(_0x3293de[_0x5767('0x2b')]!==_0x5767('0x38')){var _0x2ec624={};_0x2ec624[_0x3293de['name']]={'$like':'%'+_0x571081[_0x5767('0x2e')][_0x5767('0x39')]+'%'};return _0x2ec624;}})});}_0x18bc9c=_['merge']({},_0x18bc9c,_0x571081[_0x5767('0x3a')]);var _0xc5b33e={'where':_0x18bc9c[_0x5767('0x36')]};return db[_0x5767('0x28')][_0x5767('0x1a')](_0xc5b33e)['then'](function(_0x2c8b91){_0x196c01[_0x5767('0x1a')]=_0x2c8b91;if(_0x571081[_0x5767('0x2e')][_0x5767('0x3b')]){_0x18bc9c[_0x5767('0x3c')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x18bc9c);})[_0x5767('0x20')](function(_0x1b553d){_0x196c01[_0x5767('0x3d')]=_0x1b553d;return _0x196c01;})[_0x5767('0x20')](respondWithFilteredResult(_0x42bee6,_0x18bc9c))[_0x5767('0x3e')](handleError(_0x42bee6,null));};exports['show']=function(_0x5e7d75,_0x555308){var _0x26b97b={'raw':!![],'where':{'id':_0x5e7d75[_0x5767('0x3f')]['id']}},_0x449971={};_0x449971[_0x5767('0x2d')]=_[_0x5767('0x2f')](db[_0x5767('0x28')][_0x5767('0x29')]);_0x449971['query']=_[_0x5767('0x2f')](_0x5e7d75[_0x5767('0x2e')]);_0x449971[_0x5767('0x30')]=_['intersection'](_0x449971[_0x5767('0x2d')],_0x449971[_0x5767('0x2e')]);_0x26b97b['attributes']=_['intersection'](_0x449971['model'],qs[_0x5767('0x33')](_0x5e7d75[_0x5767('0x2e')][_0x5767('0x33')]));_0x26b97b[_0x5767('0x32')]=_0x26b97b[_0x5767('0x32')]['length']?_0x26b97b['attributes']:_0x449971[_0x5767('0x2d')];if(_0x5e7d75['query'][_0x5767('0x3b')]){_0x26b97b[_0x5767('0x3c')]=[{'all':!![]}];}_0x26b97b=_['merge']({},_0x26b97b,_0x5e7d75[_0x5767('0x3a')]);return db[_0x5767('0x28')][_0x5767('0x40')](_0x26b97b)[_0x5767('0x20')](handleEntityNotFound(_0x555308,null))['then'](respondWithResult(_0x555308,null))[_0x5767('0x3e')](handleError(_0x555308,null));};exports[_0x5767('0x41')]=function(_0x51a361,_0x3cd415){return db[_0x5767('0x28')][_0x5767('0x41')](_0x51a361['body'],{})[_0x5767('0x20')](respondWithResult(_0x3cd415,0xc9))['catch'](handleError(_0x3cd415,null));};exports[_0x5767('0x42')]=function(_0x23d407,_0x4c9e06){if(_0x23d407[_0x5767('0x43')]['id']){delete _0x23d407[_0x5767('0x43')]['id'];}return db[_0x5767('0x28')]['find']({'where':{'id':_0x23d407['params']['id']}})['then'](handleEntityNotFound(_0x4c9e06,null))['then'](saveUpdates(_0x23d407[_0x5767('0x43')],null))['then'](respondWithResult(_0x4c9e06,null))[_0x5767('0x3e')](handleError(_0x4c9e06,null));};exports[_0x5767('0x44')]=function(_0x4adda9,_0x4cf1be){return db['SquareDetailsReport'][_0x5767('0x40')]({'where':{'id':_0x4adda9[_0x5767('0x3f')]['id']}})[_0x5767('0x20')](handleEntityNotFound(_0x4cf1be,null))['then'](removeEntity(_0x4cf1be,null))['catch'](handleError(_0x4cf1be,null));};exports[_0x5767('0x45')]=function(_0x54058b,_0xe8063b){return db['SquareDetailsReport'][_0x5767('0x45')]()[_0x5767('0x20')](respondWithResult(_0xe8063b,null))[_0x5767('0x3e')](handleError(_0xe8063b,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 4fac370..5a0675d 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 _0x96be=['exports','SquareDetailsReport','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x96be,0x1ec));var _0xe96b=function(_0x2d0640,_0x51bafc){_0x2d0640=_0x2d0640-0x0;var _0x5a2c86=_0x96be[_0x2d0640];return _0x5a2c86;};'use strict';var _=require(_0xe96b('0x0'));var util=require(_0xe96b('0x1'));var logger=require(_0xe96b('0x2'))(_0xe96b('0x3'));var moment=require(_0xe96b('0x4'));var BPromise=require('bluebird');var rp=require(_0xe96b('0x5'));var fs=require('fs');var path=require(_0xe96b('0x6'));var rimraf=require(_0xe96b('0x7'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module[_0xe96b('0x8')]=function(_0x2e56d6,_0x35bd3f){return _0x2e56d6['define'](_0xe96b('0x9'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x58d1=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareDetailsReport','report_square_details','lodash','../../config/logger','api'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x58d1,0x7f));var _0x158d=function(_0x5c6046,_0x25dcd8){_0x5c6046=_0x5c6046-0x0;var _0x4c462d=_0x58d1[_0x5c6046];return _0x4c462d;};'use strict';var _=require(_0x158d('0x0'));var util=require('util');var logger=require(_0x158d('0x1'))(_0x158d('0x2'));var moment=require(_0x158d('0x3'));var BPromise=require(_0x158d('0x4'));var rp=require(_0x158d('0x5'));var fs=require('fs');var path=require(_0x158d('0x6'));var rimraf=require(_0x158d('0x7'));var config=require(_0x158d('0x8'));var attributes=require('./squareReportDetail.attributes');module[_0x158d('0x9')]=function(_0x5b4fec,_0x4cfd49){return _0x5b4fec[_0x158d('0xa')](_0x158d('0xb'),attributes,{'tableName':_0x158d('0xc'),'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 e75da6a..81d6328 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 _0x94d2=['stringify','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x94d2,0x1cd));var _0x294d=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0x94d2[_0x14fad0];return _0x5c665f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x294d('0x0'));var BPromise=require(_0x294d('0x1'));var rs=require(_0x294d('0x2'));var fs=require('fs');var Redis=require(_0x294d('0x3'));var db=require(_0x294d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x294d('0x5'));var config=require(_0x294d('0x6'));var jayson=require(_0x294d('0x7'));var client=jayson[_0x294d('0x8')][_0x294d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e023f,_0x5c3d7c,_0x2cf111){return new BPromise(function(_0x6653fc,_0x1cd249){return client[_0x294d('0xa')](_0x5e023f,_0x2cf111)[_0x294d('0xb')](function(_0x49923f){logger[_0x294d('0xc')](_0x294d('0xd'),_0x5c3d7c,'request\x20sent');logger[_0x294d('0xe')](_0x294d('0xf'),_0x5c3d7c,'request\x20sent',JSON['stringify'](_0x49923f));if(_0x49923f[_0x294d('0x10')]){if(_0x49923f[_0x294d('0x10')][_0x294d('0x11')]===0x1f4){logger['error'](_0x294d('0xd'),_0x5c3d7c,_0x49923f[_0x294d('0x10')][_0x294d('0x12')]);return _0x1cd249(_0x49923f[_0x294d('0x10')]['message']);}logger[_0x294d('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x5c3d7c,_0x49923f['error'][_0x294d('0x12')]);return _0x6653fc(_0x49923f[_0x294d('0x10')][_0x294d('0x12')]);}else{logger[_0x294d('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x5c3d7c,_0x294d('0x13'));_0x6653fc(_0x49923f['result']['message']);}})['catch'](function(_0x4f2436){logger[_0x294d('0x10')](_0x294d('0xd'),_0x5c3d7c,_0x4f2436);_0x1cd249(_0x4f2436);});});}exports[_0x294d('0x14')]=function(_0x46d9c5){var _0x17156c=this;return new Promise(function(_0x26563e,_0x199a1a){return db[_0x294d('0x15')]['create'](_0x46d9c5[_0x294d('0x16')],{'raw':_0x46d9c5[_0x294d('0x17')]?_0x46d9c5['options'][_0x294d('0x18')]===undefined?!![]:![]:!![]})[_0x294d('0xb')](function(_0x429da3){logger[_0x294d('0xc')](_0x294d('0x14'),_0x46d9c5);logger[_0x294d('0xe')](_0x294d('0x14'),_0x46d9c5,JSON[_0x294d('0x19')](_0x429da3));_0x26563e(_0x429da3);})[_0x294d('0x1a')](function(_0x11df11){logger[_0x294d('0x10')](_0x294d('0x14'),_0x11df11[_0x294d('0x12')],_0x46d9c5);_0x199a1a(_0x17156c[_0x294d('0x10')](0x1f4,_0x11df11[_0x294d('0x12')]));});});}; \ No newline at end of file +var _0x36ee=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw'];(function(_0x2cebb3,_0x237286){var _0x337970=function(_0x5892dc){while(--_0x5892dc){_0x2cebb3['push'](_0x2cebb3['shift']());}};_0x337970(++_0x237286);}(_0x36ee,0xe8));var _0xe36e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x36ee[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe36e('0x0'));var BPromise=require('bluebird');var rs=require(_0xe36e('0x1'));var fs=require('fs');var Redis=require(_0xe36e('0x2'));var db=require(_0xe36e('0x3'))['db'];var utils=require(_0xe36e('0x4'));var logger=require(_0xe36e('0x5'))(_0xe36e('0x6'));var config=require(_0xe36e('0x7'));var jayson=require(_0xe36e('0x8'));var client=jayson[_0xe36e('0x9')][_0xe36e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21be0b,_0x1aa596,_0x51b4bd){return new BPromise(function(_0x74b4b7,_0x4aebdd){return client[_0xe36e('0xb')](_0x21be0b,_0x51b4bd)[_0xe36e('0xc')](function(_0x46f239){logger['info'](_0xe36e('0xd'),_0x1aa596,'request\x20sent');logger[_0xe36e('0xe')](_0xe36e('0xf'),_0x1aa596,_0xe36e('0x10'),JSON[_0xe36e('0x11')](_0x46f239));if(_0x46f239[_0xe36e('0x12')]){if(_0x46f239[_0xe36e('0x12')][_0xe36e('0x13')]===0x1f4){logger[_0xe36e('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x1aa596,_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);return _0x4aebdd(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}logger['error'](_0xe36e('0xd'),_0x1aa596,_0x46f239['error']['message']);return _0x74b4b7(_0x46f239[_0xe36e('0x12')][_0xe36e('0x14')]);}else{logger[_0xe36e('0x15')](_0xe36e('0xd'),_0x1aa596,_0xe36e('0x10'));_0x74b4b7(_0x46f239[_0xe36e('0x16')][_0xe36e('0x14')]);}})[_0xe36e('0x17')](function(_0x387c37){logger[_0xe36e('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x1aa596,_0x387c37);_0x4aebdd(_0x387c37);});});}exports[_0xe36e('0x18')]=function(_0x2184ae){var _0x56c019=this;return new Promise(function(_0x21d9a3,_0x533c06){return db[_0xe36e('0x19')][_0xe36e('0x1a')](_0x2184ae['body'],{'raw':_0x2184ae[_0xe36e('0x1b')]?_0x2184ae[_0xe36e('0x1b')][_0xe36e('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x21e95e){logger[_0xe36e('0x15')](_0xe36e('0x18'),_0x2184ae);logger[_0xe36e('0xe')](_0xe36e('0x18'),_0x2184ae,JSON[_0xe36e('0x11')](_0x21e95e));_0x21d9a3(_0x21e95e);})['catch'](function(_0xd71137){logger[_0xe36e('0x12')](_0xe36e('0x18'),_0xd71137[_0xe36e('0x14')],_0x2184ae);_0x533c06(_0x56c019[_0xe36e('0x12')](0x1f4,_0xd71137['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 620709f..f91e755 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 _0xcb79=['/process/:pid/kill','express','Router','./system.controller','get','isAuthenticated'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xcb79,0xf7));var _0x9cb7=function(_0x3aa716,_0x240e15){_0x3aa716=_0x3aa716-0x0;var _0x10fabf=_0xcb79[_0x3aa716];return _0x10fabf;};'use strict';var express=require(_0x9cb7('0x0'));var router=express[_0x9cb7('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x9cb7('0x2'));router[_0x9cb7('0x3')]('/',auth[_0x9cb7('0x4')](),controller['index']);router[_0x9cb7('0x3')](_0x9cb7('0x5'),auth[_0x9cb7('0x4')](),controller['killProcess']);module['exports']=router; \ No newline at end of file +var _0xd4d5=['Router','../../components/auth/service','index','/process/:pid/kill','killProcess','exports'];(function(_0x3358f9,_0x4dc9cc){var _0x23cdcd=function(_0x30c901){while(--_0x30c901){_0x3358f9['push'](_0x3358f9['shift']());}};_0x23cdcd(++_0x4dc9cc);}(_0xd4d5,0x1e6));var _0x5d4d=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xd4d5[_0x4cf98e];return _0x1623ac;};'use strict';var express=require('express');var router=express[_0x5d4d('0x0')]();var auth=require(_0x5d4d('0x1'));var controller=require('./system.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5d4d('0x2')]);router['get'](_0x5d4d('0x3'),auth['isAuthenticated'](),controller[_0x5d4d('0x4')]);module[_0x5d4d('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 31bf85d..535185a 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 _0x8d94=['lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','getAllData','then','catch','json','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','systeminformation','exec','bluebird'];(function(_0x3ba728,_0x1d337d){var _0x2aadbd=function(_0x59c579){while(--_0x59c579){_0x3ba728['push'](_0x3ba728['shift']());}};_0x2aadbd(++_0x1d337d);}(_0x8d94,0x1a6));var _0x48d9=function(_0x2c3c1b,_0xfa7eb3){_0x2c3c1b=_0x2c3c1b-0x0;var _0x1fe8f1=_0x8d94[_0x2c3c1b];return _0x1fe8f1;};'use strict';var info=require(_0x48d9('0x0'));var exec=require('child_process')[_0x48d9('0x1')];var logger=require('../../config/logger')('api');var util=require('util');var BPromise=require(_0x48d9('0x2'));var _=require(_0x48d9('0x3'));function handleError(_0x1acfc4,_0x2b001d,_0x17284a){_0x2b001d=_0x2b001d||0x1f4;return function(_0x3130ef){logger[_0x48d9('0x4')](_0x48d9('0x5'),_0x17284a,_0x2b001d,util[_0x48d9('0x6')](_0x3130ef,{'showHidden':![],'depth':null}));delete _0x3130ef[_0x48d9('0x7')];_0x1acfc4[_0x48d9('0x8')](_0x2b001d)['send'](_0x3130ef);};}exports[_0x48d9('0x9')]=function(_0x3cb499,_0x5a74b7){return info[_0x48d9('0xa')]()[_0x48d9('0xb')](function(_0x4fd9bc){return _0x5a74b7['status'](0xc8)['json'](_0x4fd9bc);})[_0x48d9('0xc')](function(_0x239f53){return _0x5a74b7[_0x48d9('0x8')](0x1f4)[_0x48d9('0xd')](_0x239f53);});};exports[_0x48d9('0xe')]=function(_0x2ab674,_0x33bb7e){var _0x213769=['components/import/cm'];return new BPromise(function(_0x302eeb,_0x56b7d3){return exec(util[_0x48d9('0xf')](_0x48d9('0x10'),_0x2ab674[_0x48d9('0x11')][_0x48d9('0x12')]),function(_0x523f23,_0x46786d,_0xa027fe){if(_0x523f23){return _0x56b7d3(_0x523f23);}return _0x302eeb(_0x46786d);});})['then'](function(_0x5955f3){var _0x2c4617=![];var _0x3db19d=_0x5955f3[_0x48d9('0x13')](/\n/);for(var _0x5b741b=0x0,_0x17cf31=_0x213769[_0x48d9('0x14')];_0x5b741b<_0x17cf31,_0x2c4617===![];_0x5b741b+=0x1){if(_0x5955f3[_0x48d9('0x15')](_0x213769[_0x5b741b])>=0x0){_0x2c4617=!![];}}if(!_0x2c4617){throw new Error(util[_0x48d9('0xf')](_0x48d9('0x16'),_0x2ab674[_0x48d9('0x11')][_0x48d9('0x12')]));}process[_0x48d9('0x17')](_0x2ab674[_0x48d9('0x11')][_0x48d9('0x12')],_0x48d9('0x18'));return _0x33bb7e[_0x48d9('0x8')](0xc8)[_0x48d9('0xd')]({'message':util[_0x48d9('0xf')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x2ab674[_0x48d9('0x11')][_0x48d9('0x12')])});})['catch'](handleError(_0x33bb7e,null,_0x48d9('0xe')));}; \ No newline at end of file +var _0x4d1e=['params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','send','index','getAllData','status','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args'];(function(_0x5adc85,_0x4524f1){var _0x350e46=function(_0x541900){while(--_0x541900){_0x5adc85['push'](_0x5adc85['shift']());}};_0x350e46(++_0x4524f1);}(_0x4d1e,0x18e));var _0xe4d1=function(_0x1073ad,_0x44bf0b){_0x1073ad=_0x1073ad-0x0;var _0x528474=_0x4d1e[_0x1073ad];return _0x528474;};'use strict';var info=require(_0xe4d1('0x0'));var exec=require(_0xe4d1('0x1'))['exec'];var logger=require(_0xe4d1('0x2'))('api');var util=require(_0xe4d1('0x3'));var BPromise=require(_0xe4d1('0x4'));var _=require(_0xe4d1('0x5'));function handleError(_0x3fbd85,_0x2e2247,_0x365889){_0x2e2247=_0x2e2247||0x1f4;return function(_0x5a3d4d){logger[_0xe4d1('0x6')](_0xe4d1('0x7'),_0x365889,_0x2e2247,util['inspect'](_0x5a3d4d,{'showHidden':![],'depth':null}));delete _0x5a3d4d[_0xe4d1('0x8')];_0x3fbd85['status'](_0x2e2247)[_0xe4d1('0x9')](_0x5a3d4d);};}exports[_0xe4d1('0xa')]=function(_0x485f09,_0x30e264){return info[_0xe4d1('0xb')]()['then'](function(_0x309731){return _0x30e264[_0xe4d1('0xc')](0xc8)[_0xe4d1('0xd')](_0x309731);})[_0xe4d1('0xe')](function(_0x4d6528){return _0x30e264[_0xe4d1('0xc')](0x1f4)[_0xe4d1('0xd')](_0x4d6528);});};exports[_0xe4d1('0xf')]=function(_0x28ba9a,_0x193466){var _0x2e7ee8=['components/import/cm'];return new BPromise(function(_0x2e3177,_0x4eb976){return exec(util[_0xe4d1('0x10')](_0xe4d1('0x11'),_0x28ba9a[_0xe4d1('0x12')][_0xe4d1('0x13')]),function(_0x430ece,_0x8583bd,_0x5cb13d){if(_0x430ece){return _0x4eb976(_0x430ece);}return _0x2e3177(_0x8583bd);});})['then'](function(_0x26bb2a){var _0x493e1c=![];var _0x53039b=_0x26bb2a[_0xe4d1('0x14')](/\n/);for(var _0x45a613=0x0,_0x208dc4=_0x2e7ee8[_0xe4d1('0x15')];_0x45a613<_0x208dc4,_0x493e1c===![];_0x45a613+=0x1){if(_0x26bb2a[_0xe4d1('0x16')](_0x2e7ee8[_0x45a613])>=0x0){_0x493e1c=!![];}}if(!_0x493e1c){throw new Error(util[_0xe4d1('0x10')](_0xe4d1('0x17'),_0x28ba9a['params']['pid']));}process['kill'](_0x28ba9a[_0xe4d1('0x12')]['pid'],_0xe4d1('0x18'));return _0x193466[_0xe4d1('0xc')](0xc8)[_0xe4d1('0xd')]({'message':util[_0xe4d1('0x10')](_0xe4d1('0x19'),_0x28ba9a[_0xe4d1('0x12')][_0xe4d1('0x13')])});})['catch'](handleError(_0x193466,null,_0xe4d1('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index d5e9391..ece243a 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 _0xd2ea=['./tag.controller','get','isAuthenticated','/describe','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2ccb2b,_0x1ef70d){var _0x2606c8=function(_0x17fe6f){while(--_0x17fe6f){_0x2ccb2b['push'](_0x2ccb2b['shift']());}};_0x2606c8(++_0x1ef70d);}(_0xd2ea,0x15f));var _0xad2e=function(_0xb75dec,_0x504d40){_0xb75dec=_0xb75dec-0x0;var _0x514fea=_0xd2ea[_0xb75dec];return _0x514fea;};'use strict';var multer=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var path=require(_0xad2e('0x2'));var timeout=require(_0xad2e('0x3'));var express=require(_0xad2e('0x4'));var router=express['Router']();var fs_extra=require(_0xad2e('0x5'));var auth=require(_0xad2e('0x6'));var interaction=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var controller=require(_0xad2e('0x9'));router[_0xad2e('0xa')]('/',auth[_0xad2e('0xb')](),controller['index']);router[_0xad2e('0xa')](_0xad2e('0xc'),auth[_0xad2e('0xb')](),controller['describe']);router[_0xad2e('0xa')](_0xad2e('0xd'),auth['isAuthenticated'](),controller[_0xad2e('0xe')]);router['post']('/',auth[_0xad2e('0xb')](),controller[_0xad2e('0xf')]);router[_0xad2e('0x10')](_0xad2e('0xd'),auth['isAuthenticated'](),controller[_0xad2e('0x11')]);router['delete'](_0xad2e('0xd'),auth[_0xad2e('0xb')](),controller[_0xad2e('0x12')]);module[_0xad2e('0x13')]=router; \ No newline at end of file +var _0x9a19=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x45ca8f,_0x3e058b){var _0x447045=function(_0x1133f5){while(--_0x1133f5){_0x45ca8f['push'](_0x45ca8f['shift']());}};_0x447045(++_0x3e058b);}(_0x9a19,0x114));var _0x99a1=function(_0x354164,_0x4c30de){_0x354164=_0x354164-0x0;var _0x5db9a8=_0x9a19[_0x354164];return _0x5db9a8;};'use strict';var multer=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var path=require(_0x99a1('0x2'));var timeout=require('connect-timeout');var express=require(_0x99a1('0x3'));var router=express[_0x99a1('0x4')]();var fs_extra=require(_0x99a1('0x5'));var auth=require(_0x99a1('0x6'));var interaction=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var controller=require(_0x99a1('0x9'));router[_0x99a1('0xa')]('/',auth[_0x99a1('0xb')](),controller[_0x99a1('0xc')]);router[_0x99a1('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x99a1('0xa')](_0x99a1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x99a1('0xe')]('/',auth[_0x99a1('0xb')](),controller[_0x99a1('0xf')]);router[_0x99a1('0x10')](_0x99a1('0xd'),auth['isAuthenticated'](),controller[_0x99a1('0x11')]);router[_0x99a1('0x12')](_0x99a1('0xd'),auth[_0x99a1('0xb')](),controller[_0x99a1('0x13')]);module[_0x99a1('0x14')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index efb5f93..31fc0b4 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 _0x20df=['exports','STRING','name','#0091EA','sequelize'];(function(_0x51a90a,_0x599f93){var _0x905c52=function(_0x2a8ca2){while(--_0x2a8ca2){_0x51a90a['push'](_0x51a90a['shift']());}};_0x905c52(++_0x599f93);}(_0x20df,0x7c));var _0xf20d=function(_0x3d27a,_0x31311d){_0x3d27a=_0x3d27a-0x0;var _0x314fd7=_0x20df[_0x3d27a];return _0x314fd7;};'use strict';var Sequelize=require(_0xf20d('0x0'));module[_0xf20d('0x1')]={'name':{'type':Sequelize[_0xf20d('0x2')],'unique':_0xf20d('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0xf20d('0x4')},'description':{'type':Sequelize[_0xf20d('0x2')]}}; \ No newline at end of file +var _0x87d9=['STRING','name','#0091EA','sequelize'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x87d9,0x143));var _0x987d=function(_0x6cbe6d,_0x37bba3){_0x6cbe6d=_0x6cbe6d-0x0;var _0x25e1c9=_0x87d9[_0x6cbe6d];return _0x25e1c9;};'use strict';var Sequelize=require(_0x987d('0x0'));module['exports']={'name':{'type':Sequelize[_0x987d('0x1')],'unique':_0x987d('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x987d('0x1')],'defaultValue':_0x987d('0x3')},'description':{'type':Sequelize[_0x987d('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index f2f572e..d4810fb 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 _0x8313=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Tags','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','stack','name','index','map','Tag','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','params','options','find','create','body'];(function(_0x2d7106,_0x424e5b){var _0x409c8f=function(_0x14935b){while(--_0x14935b){_0x2d7106['push'](_0x2d7106['shift']());}};_0x409c8f(++_0x424e5b);}(_0x8313,0x19e));var _0x3831=function(_0xd56abb,_0x5698dc){_0xd56abb=_0xd56abb-0x0;var _0x218b05=_0x8313[_0xd56abb];return _0x218b05;};'use strict';var emlformat=require(_0x3831('0x0'));var rimraf=require(_0x3831('0x1'));var zipdir=require(_0x3831('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3831('0x3'));var moment=require('moment');var BPromise=require(_0x3831('0x4'));var Mustache=require(_0x3831('0x5'));var util=require(_0x3831('0x6'));var path=require(_0x3831('0x7'));var sox=require(_0x3831('0x8'));var csv=require(_0x3831('0x9'));var ejs=require(_0x3831('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3831('0xb'));var squel=require(_0x3831('0xc'));var crypto=require(_0x3831('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3831('0x9'));var querystring=require(_0x3831('0xe'));var Papa=require(_0x3831('0xf'));var Redis=require(_0x3831('0x10'));var authService=require(_0x3831('0x11'));var qs=require(_0x3831('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3831('0x13'));var logger=require(_0x3831('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3831('0x15'));var db=require(_0x3831('0x16'))['db'];function respondWithStatusCode(_0x178c62,_0x45dd9c){_0x45dd9c=_0x45dd9c||0xcc;return function(_0x2abad3){if(_0x2abad3){return _0x178c62[_0x3831('0x17')](_0x45dd9c);}return _0x178c62[_0x3831('0x18')](_0x45dd9c)[_0x3831('0x19')]();};}function respondWithResult(_0x3af9be,_0x5f1df2){_0x5f1df2=_0x5f1df2||0xc8;return function(_0x3bdc79){if(_0x3bdc79){return _0x3af9be[_0x3831('0x18')](_0x5f1df2)[_0x3831('0x1a')](_0x3bdc79);}};}function respondWithFilteredResult(_0x11cabe,_0x5d12ca){return function(_0x1df003){if(_0x1df003){var _0x3b31a9=typeof _0x5d12ca[_0x3831('0x1b')]==='undefined'&&typeof _0x5d12ca[_0x3831('0x1c')]===_0x3831('0x1d');var _0x232cb6=_0x1df003[_0x3831('0x1e')];var _0x39e08f=_0x3b31a9?0x0:_0x5d12ca['offset'];var _0x9b6a02=_0x3b31a9?_0x1df003[_0x3831('0x1e')]:_0x5d12ca[_0x3831('0x1b')]+_0x5d12ca[_0x3831('0x1c')];var _0x4e1619;if(_0x9b6a02>=_0x232cb6){_0x9b6a02=_0x232cb6;_0x4e1619=0xc8;}else{_0x4e1619=0xce;}_0x11cabe[_0x3831('0x18')](_0x4e1619);return _0x11cabe[_0x3831('0x1f')](_0x3831('0x20'),_0x39e08f+'-'+_0x9b6a02+'/'+_0x232cb6)['json'](_0x1df003);}return null;};}function patchUpdates(_0x11af0b){return function(_0x26798c){try{jsonpatch[_0x3831('0x21')](_0x26798c,_0x11af0b,!![]);}catch(_0x435236){return BPromise[_0x3831('0x22')](_0x435236);}return _0x26798c['save']();};}function saveUpdates(_0x5e9ab1,_0x170824){return function(_0xa62d6c){if(_0xa62d6c){return _0xa62d6c[_0x3831('0x23')](_0x5e9ab1)[_0x3831('0x24')](function(_0x410072){return _0x410072;});}return null;};}function removeEntity(_0x27f638,_0xd506d5){return function(_0x1c87cf){if(_0x1c87cf){return _0x1c87cf[_0x3831('0x25')]()[_0x3831('0x24')](function(){var _0x56bf7c=_0x1c87cf[_0x3831('0x26')]({'plain':!![]});var _0x294545='Tags';return db['UserProfileResource'][_0x3831('0x25')]({'where':{'type':_0x294545,'resourceId':_0x56bf7c['id']}})[_0x3831('0x24')](function(){return _0x1c87cf;});})[_0x3831('0x24')](function(){_0x27f638[_0x3831('0x18')](0xcc)[_0x3831('0x19')]();});}};}function handleEntityNotFound(_0x1dd90d,_0x42fdec){return function(_0x4dd7d2){if(!_0x4dd7d2){_0x1dd90d[_0x3831('0x17')](0x194);}return _0x4dd7d2;};}function handleError(_0x2f4a65,_0x2e2e8a){_0x2e2e8a=_0x2e2e8a||0x1f4;return function(_0x5750ea){logger['error'](_0x5750ea[_0x3831('0x27')]);if(_0x5750ea[_0x3831('0x28')]){delete _0x5750ea[_0x3831('0x28')];}_0x2f4a65[_0x3831('0x18')](_0x2e2e8a)['send'](_0x5750ea);};}exports[_0x3831('0x29')]=function(_0x183e5f,_0x4b7a45){var _0x2d20f0={},_0x503c41={},_0x12c51b={'count':0x0,'rows':[]};var _0x519869=_[_0x3831('0x2a')](db[_0x3831('0x2b')][_0x3831('0x2c')],function(_0x48c958){return{'name':_0x48c958['fieldName'],'type':_0x48c958[_0x3831('0x2d')][_0x3831('0x2e')]};});_0x503c41[_0x3831('0x2f')]=_[_0x3831('0x2a')](_0x519869,_0x3831('0x28'));_0x503c41[_0x3831('0x30')]=_[_0x3831('0x31')](_0x183e5f[_0x3831('0x30')]);_0x503c41[_0x3831('0x32')]=_[_0x3831('0x33')](_0x503c41[_0x3831('0x2f')],_0x503c41[_0x3831('0x30')]);_0x2d20f0['attributes']=_[_0x3831('0x33')](_0x503c41[_0x3831('0x2f')],qs[_0x3831('0x34')](_0x183e5f['query'][_0x3831('0x34')]));_0x2d20f0[_0x3831('0x35')]=_0x2d20f0[_0x3831('0x35')][_0x3831('0x36')]?_0x2d20f0[_0x3831('0x35')]:_0x503c41['model'];if(!_0x183e5f[_0x3831('0x30')][_0x3831('0x37')](_0x3831('0x38'))){_0x2d20f0[_0x3831('0x1c')]=qs[_0x3831('0x1c')](_0x183e5f['query'][_0x3831('0x1c')]);_0x2d20f0['offset']=qs['offset'](_0x183e5f[_0x3831('0x30')][_0x3831('0x1b')]);}_0x2d20f0[_0x3831('0x39')]=qs[_0x3831('0x3a')](_0x183e5f[_0x3831('0x30')]['sort']);_0x2d20f0[_0x3831('0x3b')]=qs[_0x3831('0x32')](_[_0x3831('0x3c')](_0x183e5f['query'],_0x503c41[_0x3831('0x32')]),_0x519869);if(_0x183e5f['query'][_0x3831('0x3d')]){_0x2d20f0[_0x3831('0x3b')]=_[_0x3831('0x3e')](_0x2d20f0['where'],{'$or':_[_0x3831('0x2a')](_0x519869,function(_0x3c1ec6){if(_0x3c1ec6['type']!=='VIRTUAL'){var _0x367070={};_0x367070[_0x3c1ec6[_0x3831('0x28')]]={'$like':'%'+_0x183e5f[_0x3831('0x30')][_0x3831('0x3d')]+'%'};return _0x367070;}})});}_0x2d20f0=_[_0x3831('0x3e')]({},_0x2d20f0,_0x183e5f['options']);var _0x25e9f9={'where':_0x2d20f0['where']};return db[_0x3831('0x2b')][_0x3831('0x1e')](_0x25e9f9)[_0x3831('0x24')](function(_0x2b3370){_0x12c51b[_0x3831('0x1e')]=_0x2b3370;if(_0x183e5f[_0x3831('0x30')][_0x3831('0x3f')]){_0x2d20f0[_0x3831('0x40')]=[{'all':!![]}];}return db[_0x3831('0x2b')][_0x3831('0x41')](_0x2d20f0);})[_0x3831('0x24')](function(_0xa9240b){_0x12c51b['rows']=_0xa9240b;return _0x12c51b;})[_0x3831('0x24')](respondWithFilteredResult(_0x4b7a45,_0x2d20f0))[_0x3831('0x42')](handleError(_0x4b7a45,null));};exports['show']=function(_0x29394d,_0x8a7f8d){var _0x3d12f2={'raw':!![],'where':{'id':_0x29394d[_0x3831('0x43')]['id']}},_0x1e193a={};_0x1e193a[_0x3831('0x2f')]=_[_0x3831('0x31')](db[_0x3831('0x2b')][_0x3831('0x2c')]);_0x1e193a['query']=_[_0x3831('0x31')](_0x29394d[_0x3831('0x30')]);_0x1e193a['filters']=_[_0x3831('0x33')](_0x1e193a['model'],_0x1e193a[_0x3831('0x30')]);_0x3d12f2[_0x3831('0x35')]=_[_0x3831('0x33')](_0x1e193a[_0x3831('0x2f')],qs[_0x3831('0x34')](_0x29394d[_0x3831('0x30')][_0x3831('0x34')]));_0x3d12f2[_0x3831('0x35')]=_0x3d12f2[_0x3831('0x35')][_0x3831('0x36')]?_0x3d12f2['attributes']:_0x1e193a[_0x3831('0x2f')];if(_0x29394d[_0x3831('0x30')][_0x3831('0x3f')]){_0x3d12f2['include']=[{'all':!![]}];}_0x3d12f2=_[_0x3831('0x3e')]({},_0x3d12f2,_0x29394d[_0x3831('0x44')]);return db[_0x3831('0x2b')][_0x3831('0x45')](_0x3d12f2)[_0x3831('0x24')](handleEntityNotFound(_0x8a7f8d,null))['then'](respondWithResult(_0x8a7f8d,null))[_0x3831('0x42')](handleError(_0x8a7f8d,null));};exports['create']=function(_0x50282f,_0x517a9c){return db[_0x3831('0x2b')][_0x3831('0x46')](_0x50282f[_0x3831('0x47')],{})['then'](function(_0x237865){var _0x1b3002=_0x50282f['user'][_0x3831('0x26')]({'plain':!![]});if(!_0x1b3002)throw new Error(_0x3831('0x48'));if(_0x1b3002[_0x3831('0x49')]===_0x3831('0x4a')){var _0x10a313=_0x237865[_0x3831('0x26')]({'plain':!![]});var _0x5b5381=_0x3831('0x4b');return db['UserProfileSection'][_0x3831('0x45')]({'where':{'name':_0x5b5381,'userProfileId':_0x1b3002[_0x3831('0x4c')]},'raw':!![]})[_0x3831('0x24')](function(_0x42b437){if(_0x42b437&&_0x42b437['autoAssociation']===0x0){return db[_0x3831('0x4d')][_0x3831('0x46')]({'name':_0x10a313[_0x3831('0x28')],'resourceId':_0x10a313['id'],'type':_0x42b437[_0x3831('0x28')],'sectionId':_0x42b437['id']},{})[_0x3831('0x24')](function(){return _0x237865;});}else{return _0x237865;}})[_0x3831('0x42')](function(_0x1a35b8){logger[_0x3831('0x4e')](_0x3831('0x4f'),_0x1a35b8);throw _0x1a35b8;});}return _0x237865;})['then'](respondWithResult(_0x517a9c,0xc9))[_0x3831('0x42')](handleError(_0x517a9c,null));};exports[_0x3831('0x23')]=function(_0x207995,_0x60fd0d){if(_0x207995[_0x3831('0x47')]['id']){delete _0x207995[_0x3831('0x47')]['id'];}return db[_0x3831('0x2b')][_0x3831('0x45')]({'where':{'id':_0x207995[_0x3831('0x43')]['id']}})[_0x3831('0x24')](handleEntityNotFound(_0x60fd0d,null))['then'](saveUpdates(_0x207995[_0x3831('0x47')],null))[_0x3831('0x24')](respondWithResult(_0x60fd0d,null))[_0x3831('0x42')](handleError(_0x60fd0d,null));};exports['destroy']=function(_0x240d82,_0x181633){return db[_0x3831('0x2b')][_0x3831('0x45')]({'where':{'id':_0x240d82['params']['id']}})[_0x3831('0x24')](handleEntityNotFound(_0x181633,null))['then'](removeEntity(_0x181633,null))[_0x3831('0x42')](handleError(_0x181633,null));};exports[_0x3831('0x50')]=function(_0x12f8d5,_0x1f0197){return db[_0x3831('0x2b')]['describe']()[_0x3831('0x24')](respondWithResult(_0x1f0197,null))[_0x3831('0x42')](handleError(_0x1f0197,null));}; \ No newline at end of file +var _0x6a52=['fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','reject','save','then','get','Tags','UserProfileResource','destroy','error','name','send','index','map','rawAttributes','fieldName','type','query','keys','model','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','Tag','include','findAll','rows','params','intersection','length','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x44ab9d,_0x3d060c){var _0x279648=function(_0x1b6d1f){while(--_0x1b6d1f){_0x44ab9d['push'](_0x44ab9d['shift']());}};_0x279648(++_0x3d060c);}(_0x6a52,0x189));var _0x26a5=function(_0x4f3b2d,_0x3bbf46){_0x4f3b2d=_0x4f3b2d-0x0;var _0x3dddfa=_0x6a52[_0x4f3b2d];return _0x3dddfa;};'use strict';var emlformat=require(_0x26a5('0x0'));var rimraf=require(_0x26a5('0x1'));var zipdir=require(_0x26a5('0x2'));var jsonpatch=require(_0x26a5('0x3'));var rp=require(_0x26a5('0x4'));var moment=require(_0x26a5('0x5'));var BPromise=require(_0x26a5('0x6'));var Mustache=require(_0x26a5('0x7'));var util=require(_0x26a5('0x8'));var path=require(_0x26a5('0x9'));var sox=require('sox');var csv=require(_0x26a5('0xa'));var ejs=require(_0x26a5('0xb'));var fs=require('fs');var fs_extra=require(_0x26a5('0xc'));var _=require(_0x26a5('0xd'));var squel=require(_0x26a5('0xe'));var crypto=require('crypto');var jsforce=require(_0x26a5('0xf'));var deskjs=require(_0x26a5('0x10'));var toCsv=require(_0x26a5('0xa'));var querystring=require('querystring');var Papa=require(_0x26a5('0x11'));var Redis=require(_0x26a5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x26a5('0x13'));var as=require(_0x26a5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x26a5('0x15'))(_0x26a5('0x16'));var utils=require(_0x26a5('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x26a5('0x18'))['db'];function respondWithStatusCode(_0x84763a,_0x44bd0f){_0x44bd0f=_0x44bd0f||0xcc;return function(_0x395dd7){if(_0x395dd7){return _0x84763a[_0x26a5('0x19')](_0x44bd0f);}return _0x84763a['status'](_0x44bd0f)[_0x26a5('0x1a')]();};}function respondWithResult(_0x2c2e52,_0x3d1d0f){_0x3d1d0f=_0x3d1d0f||0xc8;return function(_0x599dd6){if(_0x599dd6){return _0x2c2e52['status'](_0x3d1d0f)[_0x26a5('0x1b')](_0x599dd6);}};}function respondWithFilteredResult(_0x51fb3e,_0x1ce8ac){return function(_0x43a561){if(_0x43a561){var _0x4d7393=typeof _0x1ce8ac[_0x26a5('0x1c')]===_0x26a5('0x1d')&&typeof _0x1ce8ac[_0x26a5('0x1e')]===_0x26a5('0x1d');var _0x3311b8=_0x43a561[_0x26a5('0x1f')];var _0x32e99f=_0x4d7393?0x0:_0x1ce8ac[_0x26a5('0x1c')];var _0x18b06a=_0x4d7393?_0x43a561[_0x26a5('0x1f')]:_0x1ce8ac[_0x26a5('0x1c')]+_0x1ce8ac['limit'];var _0x31baee;if(_0x18b06a>=_0x3311b8){_0x18b06a=_0x3311b8;_0x31baee=0xc8;}else{_0x31baee=0xce;}_0x51fb3e[_0x26a5('0x20')](_0x31baee);return _0x51fb3e['set'](_0x26a5('0x21'),_0x32e99f+'-'+_0x18b06a+'/'+_0x3311b8)[_0x26a5('0x1b')](_0x43a561);}return null;};}function patchUpdates(_0x25b585){return function(_0x1194f2){try{jsonpatch['apply'](_0x1194f2,_0x25b585,!![]);}catch(_0x5ceda5){return BPromise[_0x26a5('0x22')](_0x5ceda5);}return _0x1194f2[_0x26a5('0x23')]();};}function saveUpdates(_0x58b3ed,_0x4b4d37){return function(_0x3a48b8){if(_0x3a48b8){return _0x3a48b8['update'](_0x58b3ed)[_0x26a5('0x24')](function(_0x42ec67){return _0x42ec67;});}return null;};}function removeEntity(_0x3a7694,_0x448504){return function(_0x5828b8){if(_0x5828b8){return _0x5828b8['destroy']()[_0x26a5('0x24')](function(){var _0x5220bd=_0x5828b8[_0x26a5('0x25')]({'plain':!![]});var _0x4325da=_0x26a5('0x26');return db[_0x26a5('0x27')][_0x26a5('0x28')]({'where':{'type':_0x4325da,'resourceId':_0x5220bd['id']}})[_0x26a5('0x24')](function(){return _0x5828b8;});})[_0x26a5('0x24')](function(){_0x3a7694[_0x26a5('0x20')](0xcc)[_0x26a5('0x1a')]();});}};}function handleEntityNotFound(_0x48c0d4,_0x12ae5d){return function(_0x505de2){if(!_0x505de2){_0x48c0d4[_0x26a5('0x19')](0x194);}return _0x505de2;};}function handleError(_0x490431,_0x3d5aaa){_0x3d5aaa=_0x3d5aaa||0x1f4;return function(_0x165654){logger[_0x26a5('0x29')](_0x165654['stack']);if(_0x165654['name']){delete _0x165654[_0x26a5('0x2a')];}_0x490431[_0x26a5('0x20')](_0x3d5aaa)[_0x26a5('0x2b')](_0x165654);};}exports[_0x26a5('0x2c')]=function(_0x4bd187,_0x17509c){var _0x5beb04={},_0x3eafd3={},_0x34a2ac={'count':0x0,'rows':[]};var _0x2f0676=_[_0x26a5('0x2d')](db['Tag'][_0x26a5('0x2e')],function(_0x599ef4){return{'name':_0x599ef4[_0x26a5('0x2f')],'type':_0x599ef4[_0x26a5('0x30')]['key']};});_0x3eafd3['model']=_[_0x26a5('0x2d')](_0x2f0676,_0x26a5('0x2a'));_0x3eafd3[_0x26a5('0x31')]=_[_0x26a5('0x32')](_0x4bd187['query']);_0x3eafd3['filters']=_['intersection'](_0x3eafd3[_0x26a5('0x33')],_0x3eafd3[_0x26a5('0x31')]);_0x5beb04[_0x26a5('0x34')]=_['intersection'](_0x3eafd3[_0x26a5('0x33')],qs[_0x26a5('0x35')](_0x4bd187[_0x26a5('0x31')]['fields']));_0x5beb04[_0x26a5('0x34')]=_0x5beb04[_0x26a5('0x34')]['length']?_0x5beb04['attributes']:_0x3eafd3['model'];if(!_0x4bd187[_0x26a5('0x31')][_0x26a5('0x36')]('nolimit')){_0x5beb04[_0x26a5('0x1e')]=qs[_0x26a5('0x1e')](_0x4bd187['query'][_0x26a5('0x1e')]);_0x5beb04['offset']=qs['offset'](_0x4bd187[_0x26a5('0x31')][_0x26a5('0x1c')]);}_0x5beb04['order']=qs[_0x26a5('0x37')](_0x4bd187['query'][_0x26a5('0x37')]);_0x5beb04[_0x26a5('0x38')]=qs[_0x26a5('0x39')](_[_0x26a5('0x3a')](_0x4bd187[_0x26a5('0x31')],_0x3eafd3[_0x26a5('0x39')]),_0x2f0676);if(_0x4bd187[_0x26a5('0x31')][_0x26a5('0x3b')]){_0x5beb04[_0x26a5('0x38')]=_[_0x26a5('0x3c')](_0x5beb04[_0x26a5('0x38')],{'$or':_[_0x26a5('0x2d')](_0x2f0676,function(_0x150f1b){if(_0x150f1b['type']!=='VIRTUAL'){var _0x308f27={};_0x308f27[_0x150f1b['name']]={'$like':'%'+_0x4bd187[_0x26a5('0x31')][_0x26a5('0x3b')]+'%'};return _0x308f27;}})});}_0x5beb04=_['merge']({},_0x5beb04,_0x4bd187['options']);var _0x1c647a={'where':_0x5beb04[_0x26a5('0x38')]};return db[_0x26a5('0x3d')][_0x26a5('0x1f')](_0x1c647a)[_0x26a5('0x24')](function(_0x581b4c){_0x34a2ac[_0x26a5('0x1f')]=_0x581b4c;if(_0x4bd187[_0x26a5('0x31')]['includeAll']){_0x5beb04[_0x26a5('0x3e')]=[{'all':!![]}];}return db[_0x26a5('0x3d')][_0x26a5('0x3f')](_0x5beb04);})[_0x26a5('0x24')](function(_0x4c4940){_0x34a2ac[_0x26a5('0x40')]=_0x4c4940;return _0x34a2ac;})[_0x26a5('0x24')](respondWithFilteredResult(_0x17509c,_0x5beb04))['catch'](handleError(_0x17509c,null));};exports['show']=function(_0x5931de,_0x1a36b2){var _0x393e8b={'raw':!![],'where':{'id':_0x5931de[_0x26a5('0x41')]['id']}},_0x43556f={};_0x43556f[_0x26a5('0x33')]=_[_0x26a5('0x32')](db[_0x26a5('0x3d')][_0x26a5('0x2e')]);_0x43556f[_0x26a5('0x31')]=_[_0x26a5('0x32')](_0x5931de['query']);_0x43556f[_0x26a5('0x39')]=_['intersection'](_0x43556f[_0x26a5('0x33')],_0x43556f[_0x26a5('0x31')]);_0x393e8b[_0x26a5('0x34')]=_[_0x26a5('0x42')](_0x43556f[_0x26a5('0x33')],qs[_0x26a5('0x35')](_0x5931de[_0x26a5('0x31')][_0x26a5('0x35')]));_0x393e8b[_0x26a5('0x34')]=_0x393e8b[_0x26a5('0x34')][_0x26a5('0x43')]?_0x393e8b['attributes']:_0x43556f['model'];if(_0x5931de[_0x26a5('0x31')][_0x26a5('0x44')]){_0x393e8b[_0x26a5('0x3e')]=[{'all':!![]}];}_0x393e8b=_['merge']({},_0x393e8b,_0x5931de['options']);return db[_0x26a5('0x3d')][_0x26a5('0x45')](_0x393e8b)[_0x26a5('0x24')](handleEntityNotFound(_0x1a36b2,null))['then'](respondWithResult(_0x1a36b2,null))[_0x26a5('0x46')](handleError(_0x1a36b2,null));};exports[_0x26a5('0x47')]=function(_0x134f99,_0x289ea5){return db[_0x26a5('0x3d')][_0x26a5('0x47')](_0x134f99['body'],{})[_0x26a5('0x24')](function(_0x56b600){var _0x1945cc=_0x134f99[_0x26a5('0x48')][_0x26a5('0x25')]({'plain':!![]});if(!_0x1945cc)throw new Error(_0x26a5('0x49'));if(_0x1945cc[_0x26a5('0x4a')]==='user'){var _0x3d94fa=_0x56b600['get']({'plain':!![]});var _0xd23066=_0x26a5('0x26');return db[_0x26a5('0x4b')][_0x26a5('0x45')]({'where':{'name':_0xd23066,'userProfileId':_0x1945cc[_0x26a5('0x4c')]},'raw':!![]})[_0x26a5('0x24')](function(_0x1ff70b){if(_0x1ff70b&&_0x1ff70b['autoAssociation']===0x0){return db[_0x26a5('0x27')][_0x26a5('0x47')]({'name':_0x3d94fa[_0x26a5('0x2a')],'resourceId':_0x3d94fa['id'],'type':_0x1ff70b[_0x26a5('0x2a')],'sectionId':_0x1ff70b['id']},{})[_0x26a5('0x24')](function(){return _0x56b600;});}else{return _0x56b600;}})[_0x26a5('0x46')](function(_0x618177){logger[_0x26a5('0x29')](_0x26a5('0x4d'),_0x618177);throw _0x618177;});}return _0x56b600;})[_0x26a5('0x24')](respondWithResult(_0x289ea5,0xc9))['catch'](handleError(_0x289ea5,null));};exports[_0x26a5('0x4e')]=function(_0x3b3f7e,_0x3f8dfb){if(_0x3b3f7e[_0x26a5('0x4f')]['id']){delete _0x3b3f7e['body']['id'];}return db[_0x26a5('0x3d')]['find']({'where':{'id':_0x3b3f7e['params']['id']}})[_0x26a5('0x24')](handleEntityNotFound(_0x3f8dfb,null))[_0x26a5('0x24')](saveUpdates(_0x3b3f7e[_0x26a5('0x4f')],null))[_0x26a5('0x24')](respondWithResult(_0x3f8dfb,null))['catch'](handleError(_0x3f8dfb,null));};exports['destroy']=function(_0x456f55,_0x2cbbb9){return db[_0x26a5('0x3d')][_0x26a5('0x45')]({'where':{'id':_0x456f55[_0x26a5('0x41')]['id']}})[_0x26a5('0x24')](handleEntityNotFound(_0x2cbbb9,null))[_0x26a5('0x24')](removeEntity(_0x2cbbb9,null))[_0x26a5('0x46')](handleError(_0x2cbbb9,null));};exports[_0x26a5('0x50')]=function(_0x3c1783,_0x21bff5){return db[_0x26a5('0x3d')][_0x26a5('0x50')]()['then'](respondWithResult(_0x21bff5,null))[_0x26a5('0x46')](handleError(_0x21bff5,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 07f3f9f..78b1c7a 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 _0x30aa=['moment','bluebird','request-promise','rimraf','./tag.attributes','exports','define','Tag','lodash','../../config/logger'];(function(_0x329b51,_0x53e10e){var _0x23297f=function(_0x56538d){while(--_0x56538d){_0x329b51['push'](_0x329b51['shift']());}};_0x23297f(++_0x53e10e);}(_0x30aa,0x1b6));var _0xa30a=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x30aa[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0xa30a('0x0'));var util=require('util');var logger=require(_0xa30a('0x1'))('api');var moment=require(_0xa30a('0x2'));var BPromise=require(_0xa30a('0x3'));var rp=require(_0xa30a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa30a('0x5'));var config=require('../../config/environment');var attributes=require(_0xa30a('0x6'));module[_0xa30a('0x7')]=function(_0x5f2fc3,_0x562b9c){return _0x5f2fc3[_0xa30a('0x8')](_0xa30a('0x9'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x628e=['path','./tag.attributes','exports','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x175e95,_0x593af4){var _0x368446=function(_0x81cedf){while(--_0x81cedf){_0x175e95['push'](_0x175e95['shift']());}};_0x368446(++_0x593af4);}(_0x628e,0xe9));var _0xe628=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x628e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe628('0x0'));var util=require(_0xe628('0x1'));var logger=require(_0xe628('0x2'))(_0xe628('0x3'));var moment=require(_0xe628('0x4'));var BPromise=require(_0xe628('0x5'));var rp=require(_0xe628('0x6'));var fs=require('fs');var path=require(_0xe628('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe628('0x8'));module[_0xe628('0x9')]=function(_0x5047ae,_0x55c28e){return _0x5047ae['define'](_0xe628('0xa'),attributes,{'tableName':_0xe628('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 22376fa..29dc2bb 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 _0xfd28=['error','code','message','info','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','Tag,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x200666,_0x39f745){var _0x147b87=function(_0x35a0ff){while(--_0x35a0ff){_0x200666['push'](_0x200666['shift']());}};_0x147b87(++_0x39f745);}(_0xfd28,0x148));var _0x8fd2=function(_0x3124f8,_0x1a8b23){_0x3124f8=_0x3124f8-0x0;var _0x5bab5f=_0xfd28[_0x3124f8];return _0x5bab5f;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var moment=require(_0x8fd2('0x1'));var BPromise=require('bluebird');var rs=require(_0x8fd2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fd2('0x3'))['db'];var utils=require(_0x8fd2('0x4'));var logger=require(_0x8fd2('0x5'))('rpc');var config=require(_0x8fd2('0x6'));var jayson=require(_0x8fd2('0x7'));var client=jayson[_0x8fd2('0x8')][_0x8fd2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f0afc,_0x4bdc1a,_0x53d938){return new BPromise(function(_0x10fccf,_0x466c3d){return client[_0x8fd2('0xa')](_0x2f0afc,_0x53d938)['then'](function(_0x13cc69){logger['info'](_0x8fd2('0xb'),_0x4bdc1a,'request\x20sent');logger[_0x8fd2('0xc')]('Tag,\x20%s,\x20%s,\x20%s',_0x4bdc1a,_0x8fd2('0xd'),JSON['stringify'](_0x13cc69));if(_0x13cc69[_0x8fd2('0xe')]){if(_0x13cc69['error'][_0x8fd2('0xf')]===0x1f4){logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);return _0x466c3d(_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);}logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);return _0x10fccf(_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);}else{logger[_0x8fd2('0x11')](_0x8fd2('0xb'),_0x4bdc1a,'request\x20sent');_0x10fccf(_0x13cc69[_0x8fd2('0x12')]['message']);}})['catch'](function(_0x56f75d){logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x56f75d);_0x466c3d(_0x56f75d);});});} \ No newline at end of file +var _0xbd50=['Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd50,0x196));var _0x0bd5=function(_0x5a24fc,_0x8d4266){_0x5a24fc=_0x5a24fc-0x0;var _0xe44766=_0xbd50[_0x5a24fc];return _0xe44766;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var moment=require(_0x0bd5('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bd5('0x3'));var fs=require('fs');var Redis=require(_0x0bd5('0x4'));var db=require(_0x0bd5('0x5'))['db'];var utils=require(_0x0bd5('0x6'));var logger=require(_0x0bd5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0bd5('0x8')][_0x0bd5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcc6cfa,_0x2c0db1,_0x1b99f3){return new BPromise(function(_0x5ebe64,_0x47e78d){return client[_0x0bd5('0xa')](_0xcc6cfa,_0x1b99f3)[_0x0bd5('0xb')](function(_0x259f4c){logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));logger['debug'](_0x0bd5('0xe'),_0x2c0db1,_0x0bd5('0xd'),JSON['stringify'](_0x259f4c));if(_0x259f4c[_0x0bd5('0xf')]){if(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x10')]===0x1f4){logger['error'](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);return _0x47e78d(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')]['message']);return _0x5ebe64(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}else{logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));_0x5ebe64(_0x259f4c[_0x0bd5('0x12')][_0x0bd5('0x11')]);}})['catch'](function(_0x14f32c){logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x14f32c);_0x47e78d(_0x14f32c);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 21a4ae0..0f6af35 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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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 a63eefe..53721bb 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 _0xbaf0=['name','exports','STRING'];(function(_0x483d8b,_0x526c52){var _0x6500f1=function(_0x372797){while(--_0x372797){_0x483d8b['push'](_0x483d8b['shift']());}};_0x6500f1(++_0x526c52);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x4bbcc1,_0x594e19){var _0x34435b=function(_0x124582){while(--_0x124582){_0x4bbcc1['push'](_0x4bbcc1['shift']());}};_0x34435b(++_0x594e19);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 37bd18c..4a5c4e6 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 _0xbcdb=['remove','addAgents','isArray','Mail','Fax','Whatsapp','Voice','through','penalty','defaults','User','findOrCreate','emit','QueueId','online','voicePause','UserVoiceQueueRt','upsert','interface','format','all','spread','removeAgents','Chat','Openchannel','getAgents','filter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','redis','localhost','socket.io-emitter','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','name','map','Team','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','includeAll','include','findAll','rows','catch','params','options','create','user','get','Teams','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','transaction','Sequelize','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','send','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','toLowerCase','Queue','capitalize','addQueues','add','Queues','ids','removeQueues'];(function(_0x14a673,_0x79c140){var _0x1dcdf6=function(_0x31ecbb){while(--_0x31ecbb){_0x14a673['push'](_0x14a673['shift']());}};_0x1dcdf6(++_0x79c140);}(_0xbcdb,0x1c8));var _0xbbcd=function(_0x3e5b8f,_0x40c705){_0x3e5b8f=_0x3e5b8f-0x0;var _0x27a6f2=_0xbcdb[_0x3e5b8f];return _0x27a6f2;};'use strict';var emlformat=require(_0xbbcd('0x0'));var rimraf=require(_0xbbcd('0x1'));var zipdir=require(_0xbbcd('0x2'));var jsonpatch=require(_0xbbcd('0x3'));var rp=require(_0xbbcd('0x4'));var moment=require(_0xbbcd('0x5'));var BPromise=require(_0xbbcd('0x6'));var Mustache=require(_0xbbcd('0x7'));var util=require('util');var path=require('path');var sox=require(_0xbbcd('0x8'));var csv=require(_0xbbcd('0x9'));var ejs=require(_0xbbcd('0xa'));var fs=require('fs');var fs_extra=require(_0xbbcd('0xb'));var _=require(_0xbbcd('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbbcd('0x9'));var querystring=require(_0xbbcd('0xd'));var Papa=require(_0xbbcd('0xe'));var Redis=require('ioredis');var authService=require(_0xbbcd('0xf'));var qs=require(_0xbbcd('0x10'));var as=require(_0xbbcd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbbcd('0x12'));var utils=require('../../config/utils');var config=require(_0xbbcd('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xbbcd('0x14')],{'host':_0xbbcd('0x15'),'port':0x18eb});var socket=require(_0xbbcd('0x16'))(new Redis(config[_0xbbcd('0x14')]));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x15b194,_0x13c0dc){_0x13c0dc=_0x13c0dc||0xcc;return function(_0x38ad72){if(_0x38ad72){return _0x15b194['sendStatus'](_0x13c0dc);}return _0x15b194[_0xbbcd('0x17')](_0x13c0dc)[_0xbbcd('0x18')]();};}function respondWithResult(_0xa9fdd,_0x29e225){_0x29e225=_0x29e225||0xc8;return function(_0x15206a){if(_0x15206a){return _0xa9fdd[_0xbbcd('0x17')](_0x29e225)[_0xbbcd('0x19')](_0x15206a);}};}function respondWithFilteredResult(_0x224326,_0x950a41){return function(_0x5974c7){if(_0x5974c7){var _0xdc620f=typeof _0x950a41[_0xbbcd('0x1a')]===_0xbbcd('0x1b')&&typeof _0x950a41[_0xbbcd('0x1c')]===_0xbbcd('0x1b');var _0x5b2d76=_0x5974c7[_0xbbcd('0x1d')];var _0x2a92ad=_0xdc620f?0x0:_0x950a41[_0xbbcd('0x1a')];var _0x2e56b3=_0xdc620f?_0x5974c7[_0xbbcd('0x1d')]:_0x950a41[_0xbbcd('0x1a')]+_0x950a41['limit'];var _0x77a400;if(_0x2e56b3>=_0x5b2d76){_0x2e56b3=_0x5b2d76;_0x77a400=0xc8;}else{_0x77a400=0xce;}_0x224326[_0xbbcd('0x17')](_0x77a400);return _0x224326[_0xbbcd('0x1e')](_0xbbcd('0x1f'),_0x2a92ad+'-'+_0x2e56b3+'/'+_0x5b2d76)['json'](_0x5974c7);}return null;};}function patchUpdates(_0x618078){return function(_0x1f7b7b){try{jsonpatch[_0xbbcd('0x20')](_0x1f7b7b,_0x618078,!![]);}catch(_0x4172ef){return BPromise[_0xbbcd('0x21')](_0x4172ef);}return _0x1f7b7b[_0xbbcd('0x22')]();};}function saveUpdates(_0x39388f,_0x2290e9){return function(_0x4c40f1){if(_0x4c40f1){return _0x4c40f1[_0xbbcd('0x23')](_0x39388f)[_0xbbcd('0x24')](function(_0x18972d){return _0x18972d;});}return null;};}function handleEntityNotFound(_0x6e5e1a,_0x2db3c3){return function(_0x323833){if(!_0x323833){_0x6e5e1a[_0xbbcd('0x25')](0x194);}return _0x323833;};}function handleError(_0x3d3047,_0x4aec7f){_0x4aec7f=_0x4aec7f||0x1f4;return function(_0xcae058){logger['error'](_0xcae058['stack']);if(_0xcae058[_0xbbcd('0x26')]){delete _0xcae058['name'];}_0x3d3047[_0xbbcd('0x17')](_0x4aec7f)['send'](_0xcae058);};}exports['index']=function(_0x3c8882,_0x163fae){var _0x3fdc30={},_0x42202c={},_0xc6ff25={'count':0x0,'rows':[]};var _0x520701=_[_0xbbcd('0x27')](db[_0xbbcd('0x28')][_0xbbcd('0x29')],function(_0xa9414){return{'name':_0xa9414[_0xbbcd('0x2a')],'type':_0xa9414['type']['key']};});_0x42202c[_0xbbcd('0x2b')]=_[_0xbbcd('0x27')](_0x520701,_0xbbcd('0x26'));_0x42202c['query']=_[_0xbbcd('0x2c')](_0x3c8882[_0xbbcd('0x2d')]);_0x42202c[_0xbbcd('0x2e')]=_[_0xbbcd('0x2f')](_0x42202c[_0xbbcd('0x2b')],_0x42202c[_0xbbcd('0x2d')]);_0x3fdc30[_0xbbcd('0x30')]=_[_0xbbcd('0x2f')](_0x42202c[_0xbbcd('0x2b')],qs[_0xbbcd('0x31')](_0x3c8882[_0xbbcd('0x2d')][_0xbbcd('0x31')]));_0x3fdc30[_0xbbcd('0x30')]=_0x3fdc30['attributes'][_0xbbcd('0x32')]?_0x3fdc30['attributes']:_0x42202c[_0xbbcd('0x2b')];if(!_0x3c8882[_0xbbcd('0x2d')][_0xbbcd('0x33')](_0xbbcd('0x34'))){_0x3fdc30[_0xbbcd('0x1c')]=qs[_0xbbcd('0x1c')](_0x3c8882[_0xbbcd('0x2d')]['limit']);_0x3fdc30['offset']=qs[_0xbbcd('0x1a')](_0x3c8882['query']['offset']);}_0x3fdc30[_0xbbcd('0x35')]=qs[_0xbbcd('0x36')](_0x3c8882[_0xbbcd('0x2d')]['sort']);_0x3fdc30[_0xbbcd('0x37')]=qs[_0xbbcd('0x2e')](_[_0xbbcd('0x38')](_0x3c8882[_0xbbcd('0x2d')],_0x42202c[_0xbbcd('0x2e')]),_0x520701);if(_0x3c8882[_0xbbcd('0x2d')]['filter']){_0x3fdc30[_0xbbcd('0x37')]=_[_0xbbcd('0x39')](_0x3fdc30[_0xbbcd('0x37')],{'$or':_[_0xbbcd('0x27')](_0x520701,function(_0x18a07e){if(_0x18a07e[_0xbbcd('0x3a')]!=='VIRTUAL'){var _0x94bee7={};_0x94bee7[_0x18a07e[_0xbbcd('0x26')]]={'$like':'%'+_0x3c8882[_0xbbcd('0x2d')]['filter']+'%'};return _0x94bee7;}})});}_0x3fdc30=_['merge']({},_0x3fdc30,_0x3c8882['options']);var _0x5c297a={'where':_0x3fdc30[_0xbbcd('0x37')]};return db['Team'][_0xbbcd('0x1d')](_0x5c297a)[_0xbbcd('0x24')](function(_0x31e749){_0xc6ff25[_0xbbcd('0x1d')]=_0x31e749;if(_0x3c8882['query'][_0xbbcd('0x3b')]){_0x3fdc30[_0xbbcd('0x3c')]=[{'all':!![]}];}return db[_0xbbcd('0x28')][_0xbbcd('0x3d')](_0x3fdc30);})[_0xbbcd('0x24')](function(_0x32cbad){_0xc6ff25[_0xbbcd('0x3e')]=_0x32cbad;return _0xc6ff25;})['then'](respondWithFilteredResult(_0x163fae,_0x3fdc30))[_0xbbcd('0x3f')](handleError(_0x163fae,null));};exports['show']=function(_0xbcff62,_0x288698){var _0xd8966={'raw':![],'where':{'id':_0xbcff62[_0xbbcd('0x40')]['id']}},_0x389ef2={};_0x389ef2[_0xbbcd('0x2b')]=_[_0xbbcd('0x2c')](db['Team']['rawAttributes']);_0x389ef2[_0xbbcd('0x2d')]=_[_0xbbcd('0x2c')](_0xbcff62[_0xbbcd('0x2d')]);_0x389ef2[_0xbbcd('0x2e')]=_['intersection'](_0x389ef2[_0xbbcd('0x2b')],_0x389ef2[_0xbbcd('0x2d')]);_0xd8966[_0xbbcd('0x30')]=_['intersection'](_0x389ef2[_0xbbcd('0x2b')],qs[_0xbbcd('0x31')](_0xbcff62['query'][_0xbbcd('0x31')]));_0xd8966[_0xbbcd('0x30')]=_0xd8966[_0xbbcd('0x30')][_0xbbcd('0x32')]?_0xd8966[_0xbbcd('0x30')]:_0x389ef2['model'];if(_0xbcff62[_0xbbcd('0x2d')][_0xbbcd('0x3b')]){_0xd8966['include']=[{'all':!![]}];}_0xd8966=_[_0xbbcd('0x39')]({},_0xd8966,_0xbcff62[_0xbbcd('0x41')]);return db[_0xbbcd('0x28')]['find'](_0xd8966)[_0xbbcd('0x24')](handleEntityNotFound(_0x288698,null))[_0xbbcd('0x24')](respondWithResult(_0x288698,null))[_0xbbcd('0x3f')](handleError(_0x288698,null));};exports[_0xbbcd('0x42')]=function(_0x475d81,_0xfb0ac7){return db[_0xbbcd('0x28')]['create'](_0x475d81['body'],{})[_0xbbcd('0x24')](function(_0x2b3fd8){var _0x496890=_0x475d81[_0xbbcd('0x43')][_0xbbcd('0x44')]({'plain':!![]});if(!_0x496890)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x496890['role']===_0xbbcd('0x43')){var _0x580986=_0x2b3fd8['get']({'plain':!![]});var _0x5d74ec=_0xbbcd('0x45');return db[_0xbbcd('0x46')][_0xbbcd('0x47')]({'where':{'name':_0x5d74ec,'userProfileId':_0x496890[_0xbbcd('0x48')]},'raw':!![]})[_0xbbcd('0x24')](function(_0x22f7c2){if(_0x22f7c2&&_0x22f7c2[_0xbbcd('0x49')]===0x0){return db[_0xbbcd('0x4a')]['create']({'name':_0x580986['name'],'resourceId':_0x580986['id'],'type':_0x22f7c2[_0xbbcd('0x26')],'sectionId':_0x22f7c2['id']},{})[_0xbbcd('0x24')](function(){return _0x2b3fd8;});}else{return _0x2b3fd8;}})[_0xbbcd('0x3f')](function(_0x3c8491){logger[_0xbbcd('0x4b')](_0xbbcd('0x4c'),_0x3c8491);throw _0x3c8491;});}return _0x2b3fd8;})[_0xbbcd('0x24')](respondWithResult(_0xfb0ac7,0xc9))[_0xbbcd('0x3f')](handleError(_0xfb0ac7,null));};exports[_0xbbcd('0x23')]=function(_0x44c4db,_0x238c56){if(_0x44c4db['body']['id']){delete _0x44c4db[_0xbbcd('0x4d')]['id'];}return db[_0xbbcd('0x28')][_0xbbcd('0x47')]({'where':{'id':_0x44c4db[_0xbbcd('0x40')]['id']}})['then'](handleEntityNotFound(_0x238c56,null))[_0xbbcd('0x24')](saveUpdates(_0x44c4db[_0xbbcd('0x4d')],null))[_0xbbcd('0x24')](respondWithResult(_0x238c56,null))['catch'](handleError(_0x238c56,null));};exports[_0xbbcd('0x4e')]=function(_0x9d7a9a,_0x4dc9b4){var _0x1c3ca4=_0x9d7a9a[_0xbbcd('0x40')]['id'];var _0x1b71f1=[];return db[_0xbbcd('0x4f')][_0xbbcd('0x50')](function(_0x20e2e9){var _0x8deee3='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x1c3ca4;return db[_0xbbcd('0x4f')][_0xbbcd('0x2d')](_0x8deee3,{'type':db[_0xbbcd('0x51')]['QueryTypes'][_0xbbcd('0x52')],'raw':!![],'transaction':_0x20e2e9})[_0xbbcd('0x24')](function(_0x5572fd){_0x1b71f1=_['map'](_0x5572fd,function(_0x4726ab){return Number(_0x4726ab['UserId']);});})['then'](function(){var _0x3f0f86=_0xbbcd('0x53')+_0x1c3ca4;return db[_0xbbcd('0x4f')][_0xbbcd('0x2d')](_0x3f0f86,{'type':db[_0xbbcd('0x51')][_0xbbcd('0x54')][_0xbbcd('0x52')],'raw':!![],'transaction':_0x20e2e9});})[_0xbbcd('0x24')](function(_0x196302){var _0x13ca20=_[_0xbbcd('0x27')](_0x196302,function(_0x49008a){return Number(_0x49008a['VoiceQueueId']);});return db[_0xbbcd('0x55')]['destroy']({'where':{'UserId':{'$in':_0x1b71f1},'VoiceQueueId':{'$in':_0x13ca20}},'transaction':_0x20e2e9});})[_0xbbcd('0x24')](function(){var _0x2ffd1d=_0xbbcd('0x56')+_0x1c3ca4;return db[_0xbbcd('0x4f')][_0xbbcd('0x2d')](_0x2ffd1d,{'type':db['Sequelize']['QueryTypes'][_0xbbcd('0x52')],'raw':!![],'transaction':_0x20e2e9});})[_0xbbcd('0x24')](function(_0x28c7bc){var _0x120796=_[_0xbbcd('0x27')](_0x28c7bc,function(_0x2a3886){return Number(_0x2a3886['MailQueueId']);});return db[_0xbbcd('0x57')][_0xbbcd('0x4e')]({'where':{'UserId':{'$in':_0x1b71f1},'MailQueueId':{'$in':_0x120796}},'transaction':_0x20e2e9});})[_0xbbcd('0x24')](function(){var _0x4a2c55=_0xbbcd('0x58')+_0x1c3ca4;return db['sequelize'][_0xbbcd('0x2d')](_0x4a2c55,{'type':db[_0xbbcd('0x51')][_0xbbcd('0x54')][_0xbbcd('0x52')],'raw':!![],'transaction':_0x20e2e9});})[_0xbbcd('0x24')](function(_0x1844aa){var _0x4441d5=_[_0xbbcd('0x27')](_0x1844aa,function(_0x51fd6d){return Number(_0x51fd6d[_0xbbcd('0x59')]);});return db[_0xbbcd('0x5a')][_0xbbcd('0x4e')]({'where':{'UserId':{'$in':_0x1b71f1},'SmsQueueId':{'$in':_0x4441d5}},'transaction':_0x20e2e9});})['then'](function(){var _0x3d5338=_0xbbcd('0x5b')+_0x1c3ca4;return db[_0xbbcd('0x4f')][_0xbbcd('0x2d')](_0x3d5338,{'type':db[_0xbbcd('0x51')][_0xbbcd('0x54')][_0xbbcd('0x52')],'raw':!![],'transaction':_0x20e2e9});})[_0xbbcd('0x24')](function(_0x59b668){var _0x124795=_[_0xbbcd('0x27')](_0x59b668,function(_0x515910){return Number(_0x515910[_0xbbcd('0x5c')]);});return db[_0xbbcd('0x5d')]['destroy']({'where':{'UserId':{'$in':_0x1b71f1},'ChatQueueId':{'$in':_0x124795}},'transaction':_0x20e2e9});})[_0xbbcd('0x24')](function(){var _0x36c751='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1c3ca4;return db['sequelize'][_0xbbcd('0x2d')](_0x36c751,{'type':db[_0xbbcd('0x51')][_0xbbcd('0x54')][_0xbbcd('0x52')],'raw':!![],'transaction':_0x20e2e9});})[_0xbbcd('0x24')](function(_0xaf6ff8){var _0x3a555f=_['map'](_0xaf6ff8,function(_0x4a28bc){return Number(_0x4a28bc['FaxQueueId']);});return db[_0xbbcd('0x5e')][_0xbbcd('0x4e')]({'where':{'UserId':{'$in':_0x1b71f1},'FaxQueueId':{'$in':_0x3a555f}},'transaction':_0x20e2e9});})[_0xbbcd('0x24')](function(){var _0x5f00b7=_0xbbcd('0x5f')+_0x1c3ca4;return db['sequelize'][_0xbbcd('0x2d')](_0x5f00b7,{'type':db[_0xbbcd('0x51')][_0xbbcd('0x54')]['SELECT'],'raw':!![],'transaction':_0x20e2e9});})[_0xbbcd('0x24')](function(_0x3eb8d5){var _0x14ad34=_[_0xbbcd('0x27')](_0x3eb8d5,function(_0x45f333){return Number(_0x45f333['OpenchannelQueueId']);});return db['UserOpenchannelQueue'][_0xbbcd('0x4e')]({'where':{'UserId':{'$in':_0x1b71f1},'OpenchannelQueueId':{'$in':_0x14ad34}},'transaction':_0x20e2e9});})[_0xbbcd('0x24')](function(){var _0x31fbea=_0xbbcd('0x60')+_0x1c3ca4;return db['sequelize'][_0xbbcd('0x2d')](_0x31fbea,{'type':db[_0xbbcd('0x51')]['QueryTypes'][_0xbbcd('0x52')],'raw':!![],'transaction':_0x20e2e9});})[_0xbbcd('0x24')](function(_0x52a62e){var _0xd63893=_[_0xbbcd('0x27')](_0x52a62e,function(_0x18f7d9){return Number(_0x18f7d9[_0xbbcd('0x61')]);});return db[_0xbbcd('0x62')][_0xbbcd('0x4e')]({'where':{'UserId':{'$in':_0x1b71f1},'WhatsappQueueId':{'$in':_0xd63893}},'transaction':_0x20e2e9});})[_0xbbcd('0x24')](function(){return db[_0xbbcd('0x63')]['find']({'where':{'TeamId':_0x1c3ca4}});})['then'](function(_0xe65501){if(_0xe65501===null){return;}return db[_0xbbcd('0x64')]['destroy']({'where':{'UserId':{'$in':_0x1b71f1},'VoicePrefixId':_0xe65501[_0xbbcd('0x65')]},'transaction':_0x20e2e9});})[_0xbbcd('0x24')](function(){return db[_0xbbcd('0x28')][_0xbbcd('0x4e')]({'where':{'id':_0x1c3ca4},'cascade':!![],'transaction':_0x20e2e9});})[_0xbbcd('0x24')](function(_0x35cc52){if(_0x35cc52===0x0){_0x4dc9b4['sendStatus'](0x194);}else{return db[_0xbbcd('0x4a')][_0xbbcd('0x4e')]({'where':{'type':_0xbbcd('0x45'),'resourceId':_0x1c3ca4},'cascade':!![],'transaction':_0x20e2e9})[_0xbbcd('0x24')](function(){_0x4dc9b4[_0xbbcd('0x17')](0xcc)[_0xbbcd('0x18')]();});}})[_0xbbcd('0x3f')](function(_0x1785ab){_0x4dc9b4['status'](0x1f4)[_0xbbcd('0x66')](_0x1785ab);});});};exports['getQueues']=function(_0x72937a,_0x4a62cb,_0x20f76b){return db['Team'][_0xbbcd('0x67')]({'where':{'id':_0x72937a[_0xbbcd('0x40')]['id']}})['then'](handleEntityNotFound(_0x4a62cb,null))[_0xbbcd('0x24')](function(_0x3fbacb){if(!_0x72937a[_0xbbcd('0x2d')][_0xbbcd('0x68')]||!utils[_0xbbcd('0x69')](_0x72937a[_0xbbcd('0x2d')][_0xbbcd('0x68')])){throw new db[(_0xbbcd('0x51'))][(_0xbbcd('0x6a'))](_0xbbcd('0x6b'));}var _0x2b82a7={};var _0x24e4db={};_0x24e4db[_0xbbcd('0x2b')]=_['keys'](db[_['capitalize'](_0x72937a[_0xbbcd('0x2d')][_0xbbcd('0x68')][_0xbbcd('0x6c')]())+_0xbbcd('0x6d')][_0xbbcd('0x29')]);_0x24e4db[_0xbbcd('0x2d')]=_[_0xbbcd('0x2c')](_0x72937a[_0xbbcd('0x2d')]);_0x24e4db[_0xbbcd('0x2e')]=_[_0xbbcd('0x2f')](_0x24e4db[_0xbbcd('0x2b')],_0x24e4db['query']);_0x2b82a7[_0xbbcd('0x30')]=_[_0xbbcd('0x2f')](_0x24e4db['model'],qs[_0xbbcd('0x31')](_0x72937a[_0xbbcd('0x2d')][_0xbbcd('0x31')]));_0x2b82a7[_0xbbcd('0x30')]=_0x2b82a7[_0xbbcd('0x30')]['length']?_0x2b82a7['attributes']:_0x24e4db['model'];_0x2b82a7['limit']=qs['limit'](_0x72937a[_0xbbcd('0x2d')][_0xbbcd('0x1c')]);_0x2b82a7[_0xbbcd('0x1a')]=qs[_0xbbcd('0x1a')](_0x72937a['query']['offset']);_0x2b82a7[_0xbbcd('0x35')]=qs[_0xbbcd('0x36')](_0x72937a[_0xbbcd('0x2d')][_0xbbcd('0x36')]);_0x2b82a7['where']=qs[_0xbbcd('0x2e')](_[_0xbbcd('0x38')](_0x72937a[_0xbbcd('0x2d')],_0x24e4db[_0xbbcd('0x2e')]));_0x2b82a7=_['merge']({},_0x2b82a7,_0x72937a[_0xbbcd('0x41')]);return _0x3fbacb[_0xbbcd('0x44')+_[_0xbbcd('0x6e')](_0x72937a[_0xbbcd('0x2d')][_0xbbcd('0x68')][_0xbbcd('0x6c')]())+'Queues'](_0x2b82a7);})[_0xbbcd('0x24')](respondWithResult(_0x4a62cb,null))[_0xbbcd('0x3f')](handleError(_0x4a62cb,null));};exports[_0xbbcd('0x6f')]=function(_0x5b6b1b,_0x29f747,_0x30b498){return db[_0xbbcd('0x28')][_0xbbcd('0x67')]({'where':{'id':_0x5b6b1b['params']['id']}})[_0xbbcd('0x24')](function(_0x5678df){if(_0x5678df){if(!_0x5b6b1b[_0xbbcd('0x4d')][_0xbbcd('0x68')]||!utils[_0xbbcd('0x69')](_0x5b6b1b[_0xbbcd('0x4d')][_0xbbcd('0x68')])){throw new db[(_0xbbcd('0x51'))][(_0xbbcd('0x6a'))](_0xbbcd('0x6b'));}return _0x5678df[_0xbbcd('0x70')+_['capitalize'](_0x5b6b1b[_0xbbcd('0x4d')][_0xbbcd('0x68')][_0xbbcd('0x6c')]())+_0xbbcd('0x71')](_0x5b6b1b[_0xbbcd('0x4d')][_0xbbcd('0x72')]);}return null;})[_0xbbcd('0x24')](handleEntityNotFound(_0x29f747,null))['then'](respondWithStatusCode(_0x29f747,null))[_0xbbcd('0x3f')](handleError(_0x29f747,null));};exports[_0xbbcd('0x73')]=function(_0x310b0b,_0x590070,_0x5deb8b){return db['Team'][_0xbbcd('0x67')]({'where':{'id':_0x310b0b[_0xbbcd('0x40')]['id']}})[_0xbbcd('0x24')](function(_0x70ebb){if(_0x70ebb){if(!_0x310b0b[_0xbbcd('0x2d')][_0xbbcd('0x68')]||!utils[_0xbbcd('0x69')](_0x310b0b[_0xbbcd('0x2d')][_0xbbcd('0x68')])){throw new db[(_0xbbcd('0x51'))]['ValidationError'](_0xbbcd('0x6b'));}return _0x70ebb[_0xbbcd('0x74')+_['capitalize'](_0x310b0b['query'][_0xbbcd('0x68')][_0xbbcd('0x6c')]())+_0xbbcd('0x71')](_0x310b0b['query'][_0xbbcd('0x72')]);}return null;})['then'](handleEntityNotFound(_0x590070,null))[_0xbbcd('0x24')](respondWithStatusCode(_0x590070,null))[_0xbbcd('0x3f')](handleError(_0x590070,null));};exports[_0xbbcd('0x75')]=function(_0x518c16,_0x4bd0ba){var _0x5ab9ba=_[_0xbbcd('0x76')](_0x518c16[_0xbbcd('0x4d')]['ids'])?_0x518c16[_0xbbcd('0x4d')][_0xbbcd('0x72')]:[_0x518c16[_0xbbcd('0x4d')]['ids']];var _0x4ea713=_0x518c16['params']['id'];return db[_0xbbcd('0x28')][_0xbbcd('0x47')]({'where':{'id':_0x4ea713}})[_0xbbcd('0x24')](handleEntityNotFound(_0x4bd0ba,null))[_0xbbcd('0x24')](function(_0x16c660){if(_0x16c660){var _0x26d5c7=['Voice','Chat',_0xbbcd('0x77'),'Sms',_0xbbcd('0x78'),'Openchannel',_0xbbcd('0x79')];return db[_0xbbcd('0x4f')]['transaction'](function(_0x5b58bd){var _0x24ea51=_[_0xbbcd('0x27')](_0x26d5c7,function(_0x453898){var _0x2c3bd6={'attributes':['id',_0xbbcd('0x26')]};if(_0x453898===_0xbbcd('0x7a')){_0x2c3bd6[_0xbbcd('0x7b')]={'attributes':[_0xbbcd('0x7c')]};}return _0x16c660[_0xbbcd('0x44')+_0x453898+_0xbbcd('0x71')](_0x2c3bd6)[_0xbbcd('0x24')](function(_0x408c26){var _0x189e71=_[_0xbbcd('0x27')](_0x408c26,function(_0x1fd0fc){var _0x55ced9=_['map'](_0x5ab9ba,function(_0x4b04f8){var _0x7f5d4d={'where':{'UserId':_0x4b04f8,[_0x453898+'QueueId']:_0x1fd0fc['id']},'transaction':_0x5b58bd};if(_0x453898===_0xbbcd('0x7a')){_0x7f5d4d[_0xbbcd('0x7d')]={'penalty':_0x1fd0fc['TeamVoiceQueue']['penalty']};}return db[_0xbbcd('0x7e')+_0x453898+'Queue'][_0xbbcd('0x7f')](_0x7f5d4d)[_0xbbcd('0x24')](function(){socket[_0xbbcd('0x80')](_0xbbcd('0x43')+_0x453898+'Queue:save',{'UserId':_0x4b04f8,[_0x453898+_0xbbcd('0x81')]:_0x1fd0fc['id']});if(_0x453898!==_0xbbcd('0x7a')){return;}return db[_0xbbcd('0x7e')][_0xbbcd('0x3d')]({'where':{'id':_0x5ab9ba,'online':0x1},'attributes':['id',_0xbbcd('0x26'),_0xbbcd('0x82'),_0xbbcd('0x83'),'interface'],'raw':!![]})[_0xbbcd('0x24')](function(_0x1ac506){var _0x18646b=_[_0xbbcd('0x27')](_0x1ac506,function(_0x5f2d62){return db[_0xbbcd('0x84')][_0xbbcd('0x85')]({'membername':_0x5f2d62[_0xbbcd('0x26')],'UserId':_0x5f2d62['id'],'queue_name':_0x1fd0fc['name'],'VoiceQueueId':_0x1fd0fc['id'],'interface':_['isNil'](_0x5f2d62[_0xbbcd('0x86')])?util[_0xbbcd('0x87')]('SIP/%s',_0x5f2d62[_0xbbcd('0x26')]):_0x5f2d62[_0xbbcd('0x86')],'paused':_0x5f2d62[_0xbbcd('0x83')]||![],'penalty':_0x1fd0fc['TeamVoiceQueue'][_0xbbcd('0x7c')]},{'transaction':_0x5b58bd});});return Promise[_0xbbcd('0x88')](_0x18646b);});});});return Promise[_0xbbcd('0x88')](_0x55ced9);});return Promise[_0xbbcd('0x88')](_0x189e71);})[_0xbbcd('0x24')](function(){return db[_0xbbcd('0x63')][_0xbbcd('0x67')]({'where':{'teamId':_0x4ea713}})['then'](function(_0x25b36c){if(_0x25b36c){var _0x3d760f=_[_0xbbcd('0x27')](_0x5ab9ba,function(_0x1a84cf){db[_0xbbcd('0x64')][_0xbbcd('0x85')]({'UserId':_0x1a84cf,'VoicePrefixId':_0x25b36c[_0xbbcd('0x65')]});});return Promise['all'](_0x3d760f);}});});});return Promise[_0xbbcd('0x88')](_0x24ea51)[_0xbbcd('0x24')](function(){return _0x16c660['addAgents'](_0x5ab9ba,{'transaction':_0x5b58bd})[_0xbbcd('0x89')](function(_0x172faa){return _0x172faa;});});});}})[_0xbbcd('0x24')](respondWithResult(_0x4bd0ba,null))[_0xbbcd('0x3f')](handleError(_0x4bd0ba,null));};exports[_0xbbcd('0x8a')]=function(_0x231b03,_0x5515b0){var _0x2ab29d=_[_0xbbcd('0x76')](_0x231b03['query'][_0xbbcd('0x72')])?_0x231b03[_0xbbcd('0x2d')][_0xbbcd('0x72')]:[_0x231b03['query'][_0xbbcd('0x72')]];var _0x204270=_0x231b03[_0xbbcd('0x40')]['id'];return db[_0xbbcd('0x28')]['find']({'where':{'id':_0x204270}})[_0xbbcd('0x24')](handleEntityNotFound(_0x5515b0,null))[_0xbbcd('0x24')](function(_0x38a44d){if(_0x38a44d){var _0x5360a5=[_0xbbcd('0x7a'),_0xbbcd('0x8b'),_0xbbcd('0x77'),'Sms',_0xbbcd('0x78'),_0xbbcd('0x8c'),_0xbbcd('0x79')];return db[_0xbbcd('0x4f')][_0xbbcd('0x50')](function(_0x4fc228){var _0x32cb67=_[_0xbbcd('0x27')](_0x5360a5,function(_0x20e985){var _0xc3fb93={'attributes':['id',_0xbbcd('0x26')]};return _0x38a44d[_0xbbcd('0x44')+_0x20e985+_0xbbcd('0x71')](_0xc3fb93)[_0xbbcd('0x24')](function(_0x2eff0a){var _0x5c4aa1=_['map'](_0x2eff0a,function(_0x4a4244){return _0x4a4244[_0xbbcd('0x8a')](_0x2ab29d,{'transaction':_0x4fc228})[_0xbbcd('0x24')](function(){var _0x26d4e2=_[_0xbbcd('0x27')](_0x2ab29d,function(_0x3f2f6f){socket[_0xbbcd('0x80')](_0xbbcd('0x43')+_0x20e985+'Queue:remove',{'UserId':Number(_0x3f2f6f),[_0x20e985+_0xbbcd('0x81')]:_0x4a4244['id']});if(_0x20e985!=='Voice'){return;}return db[_0xbbcd('0x84')]['destroy']({'where':{'VoiceQueueId':_0x4a4244['id'],'UserId':_0x3f2f6f},'transaction':_0x4fc228});});return Promise['all'](_0x26d4e2);});});return Promise[_0xbbcd('0x88')](_0x5c4aa1);});});return Promise[_0xbbcd('0x88')](_0x32cb67)[_0xbbcd('0x24')](function(){return _0x38a44d[_0xbbcd('0x8a')](_0x2ab29d,{'transaction':_0x4fc228});})[_0xbbcd('0x24')](function(){return db[_0xbbcd('0x63')][_0xbbcd('0x67')]({'where':{'teamId':_0x204270}})[_0xbbcd('0x24')](function(_0x514ab8){if(_0x514ab8){var _0xd97f7=_[_0xbbcd('0x27')](_0x2ab29d,function(_0x1687c1){db['UserVoicePrefix'][_0xbbcd('0x4e')]({'where':{'UserId':_0x1687c1,'VoicePrefixId':_0x514ab8[_0xbbcd('0x65')]}});});return Promise['all'](_0xd97f7);}});});});}})[_0xbbcd('0x24')](respondWithStatusCode(_0x5515b0,null))['catch'](handleError(_0x5515b0,null));};exports[_0xbbcd('0x8d')]=function(_0xd2f8b4,_0x5b7320,_0x4ccabe){var _0x506031={};var _0x5f7b4f={};var _0x2249ce;var _0x5485b7;return db[_0xbbcd('0x28')]['findOne']({'where':{'id':_0xd2f8b4[_0xbbcd('0x40')]['id']}})[_0xbbcd('0x24')](handleEntityNotFound(_0x5b7320,null))[_0xbbcd('0x24')](function(_0x43dc8c){if(_0x43dc8c){_0x2249ce=_0x43dc8c;_0x5f7b4f[_0xbbcd('0x2b')]=_[_0xbbcd('0x2c')](db['User'][_0xbbcd('0x29')]);_0x5f7b4f[_0xbbcd('0x2d')]=_['keys'](_0xd2f8b4['query']);_0x5f7b4f[_0xbbcd('0x2e')]=_['intersection'](_0x5f7b4f['model'],_0x5f7b4f[_0xbbcd('0x2d')]);_0x506031[_0xbbcd('0x30')]=_[_0xbbcd('0x2f')](_0x5f7b4f['model'],qs[_0xbbcd('0x31')](_0xd2f8b4[_0xbbcd('0x2d')][_0xbbcd('0x31')]));_0x506031[_0xbbcd('0x30')]=_0x506031[_0xbbcd('0x30')]['length']?_0x506031[_0xbbcd('0x30')]:_0x5f7b4f['model'];_0x506031[_0xbbcd('0x35')]=qs['sort'](_0xd2f8b4['query'][_0xbbcd('0x36')]);_0x506031[_0xbbcd('0x37')]=qs['filters'](_[_0xbbcd('0x38')](_0xd2f8b4[_0xbbcd('0x2d')],_0x5f7b4f[_0xbbcd('0x2e')]));if(_0xd2f8b4['query'][_0xbbcd('0x8e')]){_0x506031['where']=_['merge'](_0x506031[_0xbbcd('0x37')],{'$or':_['map'](_0x506031['attributes'],function(_0x33eef8){var _0xa297f9={};_0xa297f9[_0x33eef8]={'$like':'%'+_0xd2f8b4[_0xbbcd('0x2d')]['filter']+'%'};return _0xa297f9;})});}_0x506031=_[_0xbbcd('0x39')]({},_0x506031,_0xd2f8b4[_0xbbcd('0x41')]);return _0x2249ce[_0xbbcd('0x8d')](_0x506031);}})['then'](function(_0x1ba771){if(_0x1ba771){_0x5485b7=_0x1ba771['length'];if(!_0xd2f8b4[_0xbbcd('0x2d')]['hasOwnProperty']('nolimit')){_0x506031[_0xbbcd('0x1c')]=qs[_0xbbcd('0x1c')](_0xd2f8b4[_0xbbcd('0x2d')][_0xbbcd('0x1c')]);_0x506031['offset']=qs['offset'](_0xd2f8b4[_0xbbcd('0x2d')][_0xbbcd('0x1a')]);}return _0x2249ce[_0xbbcd('0x8d')](_0x506031);}})[_0xbbcd('0x24')](function(_0x35dd29){if(_0x35dd29){return _0x35dd29?{'count':_0x5485b7,'rows':_0x35dd29}:null;}})['then'](respondWithResult(_0x5b7320,null))[_0xbbcd('0x3f')](handleError(_0x5b7320,null));}; \ No newline at end of file +var _0x36d6=['UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','end','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','add','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Sms','Whatsapp','transaction','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','voicePause','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','interface','all','UserVoicePrefix','removeAgents','Queue:remove','order','getAgents','zip-dir','fast-json-patch','request-promise','bluebird','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/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./team.socket','register','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','update','then','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams'];(function(_0x1cfb74,_0x4dbeca){var _0x4ca325=function(_0x4473d6){while(--_0x4473d6){_0x1cfb74['push'](_0x1cfb74['shift']());}};_0x4ca325(++_0x4dbeca);}(_0x36d6,0x18d));var _0x636d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36d6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x636d('0x0'));var jsonpatch=require(_0x636d('0x1'));var rp=require(_0x636d('0x2'));var moment=require('moment');var BPromise=require(_0x636d('0x3'));var Mustache=require(_0x636d('0x4'));var util=require(_0x636d('0x5'));var path=require(_0x636d('0x6'));var sox=require(_0x636d('0x7'));var csv=require(_0x636d('0x8'));var ejs=require(_0x636d('0x9'));var fs=require('fs');var fs_extra=require(_0x636d('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x636d('0xb'));var jsforce=require(_0x636d('0xc'));var deskjs=require(_0x636d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x636d('0xe'));var Papa=require(_0x636d('0xf'));var Redis=require(_0x636d('0x10'));var authService=require(_0x636d('0x11'));var qs=require(_0x636d('0x12'));var as=require(_0x636d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x636d('0x14'));var config=require(_0x636d('0x15'));var licenseUtil=require(_0x636d('0x16'));var db=require('../../mysqldb')['db'];config[_0x636d('0x17')]=_[_0x636d('0x18')](config['redis'],{'host':_0x636d('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x636d('0x17')]));require(_0x636d('0x1a'))[_0x636d('0x1b')](socket);function respondWithStatusCode(_0x53dab0,_0x2eece7){_0x2eece7=_0x2eece7||0xcc;return function(_0x1a92d9){if(_0x1a92d9){return _0x53dab0[_0x636d('0x1c')](_0x2eece7);}return _0x53dab0[_0x636d('0x1d')](_0x2eece7)['end']();};}function respondWithResult(_0x157c08,_0x1ba9dc){_0x1ba9dc=_0x1ba9dc||0xc8;return function(_0x2a02a){if(_0x2a02a){return _0x157c08[_0x636d('0x1d')](_0x1ba9dc)['json'](_0x2a02a);}};}function respondWithFilteredResult(_0x57c6ff,_0x59e5d4){return function(_0x36e421){if(_0x36e421){var _0x137375=typeof _0x59e5d4[_0x636d('0x1e')]===_0x636d('0x1f')&&typeof _0x59e5d4[_0x636d('0x20')]===_0x636d('0x1f');var _0x1a7a3a=_0x36e421[_0x636d('0x21')];var _0x21c36b=_0x137375?0x0:_0x59e5d4[_0x636d('0x1e')];var _0x1b62d0=_0x137375?_0x36e421[_0x636d('0x21')]:_0x59e5d4[_0x636d('0x1e')]+_0x59e5d4[_0x636d('0x20')];var _0x406cb1;if(_0x1b62d0>=_0x1a7a3a){_0x1b62d0=_0x1a7a3a;_0x406cb1=0xc8;}else{_0x406cb1=0xce;}_0x57c6ff[_0x636d('0x1d')](_0x406cb1);return _0x57c6ff[_0x636d('0x22')]('Content-Range',_0x21c36b+'-'+_0x1b62d0+'/'+_0x1a7a3a)[_0x636d('0x23')](_0x36e421);}return null;};}function patchUpdates(_0x200da4){return function(_0x294188){try{jsonpatch[_0x636d('0x24')](_0x294188,_0x200da4,!![]);}catch(_0x144002){return BPromise[_0x636d('0x25')](_0x144002);}return _0x294188['save']();};}function saveUpdates(_0xd5121d,_0x5d970d){return function(_0x183179){if(_0x183179){return _0x183179[_0x636d('0x26')](_0xd5121d)[_0x636d('0x27')](function(_0x3b785c){return _0x3b785c;});}return null;};}function handleEntityNotFound(_0x463d6b,_0x12816d){return function(_0x347e0d){if(!_0x347e0d){_0x463d6b['sendStatus'](0x194);}return _0x347e0d;};}function handleError(_0x16c719,_0x297738){_0x297738=_0x297738||0x1f4;return function(_0x12372b){logger['error'](_0x12372b[_0x636d('0x28')]);if(_0x12372b[_0x636d('0x29')]){delete _0x12372b['name'];}_0x16c719['status'](_0x297738)[_0x636d('0x2a')](_0x12372b);};}exports[_0x636d('0x2b')]=function(_0x18fb27,_0x4be4db){var _0x437d8e={},_0x53fc6c={},_0x1d2351={'count':0x0,'rows':[]};var _0x5d323b=_[_0x636d('0x2c')](db[_0x636d('0x2d')][_0x636d('0x2e')],function(_0x516765){return{'name':_0x516765[_0x636d('0x2f')],'type':_0x516765[_0x636d('0x30')][_0x636d('0x31')]};});_0x53fc6c[_0x636d('0x32')]=_[_0x636d('0x2c')](_0x5d323b,_0x636d('0x29'));_0x53fc6c[_0x636d('0x33')]=_[_0x636d('0x34')](_0x18fb27[_0x636d('0x33')]);_0x53fc6c[_0x636d('0x35')]=_[_0x636d('0x36')](_0x53fc6c[_0x636d('0x32')],_0x53fc6c['query']);_0x437d8e[_0x636d('0x37')]=_[_0x636d('0x36')](_0x53fc6c[_0x636d('0x32')],qs[_0x636d('0x38')](_0x18fb27['query'][_0x636d('0x38')]));_0x437d8e[_0x636d('0x37')]=_0x437d8e[_0x636d('0x37')][_0x636d('0x39')]?_0x437d8e[_0x636d('0x37')]:_0x53fc6c[_0x636d('0x32')];if(!_0x18fb27['query'][_0x636d('0x3a')](_0x636d('0x3b'))){_0x437d8e[_0x636d('0x20')]=qs[_0x636d('0x20')](_0x18fb27[_0x636d('0x33')][_0x636d('0x20')]);_0x437d8e[_0x636d('0x1e')]=qs['offset'](_0x18fb27[_0x636d('0x33')]['offset']);}_0x437d8e['order']=qs[_0x636d('0x3c')](_0x18fb27[_0x636d('0x33')]['sort']);_0x437d8e[_0x636d('0x3d')]=qs[_0x636d('0x35')](_[_0x636d('0x3e')](_0x18fb27['query'],_0x53fc6c['filters']),_0x5d323b);if(_0x18fb27[_0x636d('0x33')][_0x636d('0x3f')]){_0x437d8e[_0x636d('0x3d')]=_[_0x636d('0x40')](_0x437d8e[_0x636d('0x3d')],{'$or':_[_0x636d('0x2c')](_0x5d323b,function(_0x329a20){if(_0x329a20[_0x636d('0x30')]!==_0x636d('0x41')){var _0x16294e={};_0x16294e[_0x329a20[_0x636d('0x29')]]={'$like':'%'+_0x18fb27['query']['filter']+'%'};return _0x16294e;}})});}_0x437d8e=_['merge']({},_0x437d8e,_0x18fb27[_0x636d('0x42')]);var _0x7257f4={'where':_0x437d8e['where']};return db[_0x636d('0x2d')]['count'](_0x7257f4)[_0x636d('0x27')](function(_0x4f002c){_0x1d2351[_0x636d('0x21')]=_0x4f002c;if(_0x18fb27[_0x636d('0x33')][_0x636d('0x43')]){_0x437d8e[_0x636d('0x44')]=[{'all':!![]}];}return db[_0x636d('0x2d')][_0x636d('0x45')](_0x437d8e);})[_0x636d('0x27')](function(_0x17505c){_0x1d2351['rows']=_0x17505c;return _0x1d2351;})[_0x636d('0x27')](respondWithFilteredResult(_0x4be4db,_0x437d8e))[_0x636d('0x46')](handleError(_0x4be4db,null));};exports[_0x636d('0x47')]=function(_0x4775da,_0x4fa0d3){var _0x1754a8={'raw':![],'where':{'id':_0x4775da[_0x636d('0x48')]['id']}},_0x215a5c={};_0x215a5c[_0x636d('0x32')]=_['keys'](db[_0x636d('0x2d')][_0x636d('0x2e')]);_0x215a5c[_0x636d('0x33')]=_[_0x636d('0x34')](_0x4775da[_0x636d('0x33')]);_0x215a5c['filters']=_[_0x636d('0x36')](_0x215a5c[_0x636d('0x32')],_0x215a5c[_0x636d('0x33')]);_0x1754a8[_0x636d('0x37')]=_[_0x636d('0x36')](_0x215a5c[_0x636d('0x32')],qs[_0x636d('0x38')](_0x4775da['query'][_0x636d('0x38')]));_0x1754a8[_0x636d('0x37')]=_0x1754a8[_0x636d('0x37')][_0x636d('0x39')]?_0x1754a8[_0x636d('0x37')]:_0x215a5c[_0x636d('0x32')];if(_0x4775da['query'][_0x636d('0x43')]){_0x1754a8[_0x636d('0x44')]=[{'all':!![]}];}_0x1754a8=_[_0x636d('0x40')]({},_0x1754a8,_0x4775da['options']);return db[_0x636d('0x2d')]['find'](_0x1754a8)[_0x636d('0x27')](handleEntityNotFound(_0x4fa0d3,null))[_0x636d('0x27')](respondWithResult(_0x4fa0d3,null))['catch'](handleError(_0x4fa0d3,null));};exports[_0x636d('0x49')]=function(_0x103ab2,_0x45255f){return db[_0x636d('0x2d')][_0x636d('0x49')](_0x103ab2[_0x636d('0x4a')],{})[_0x636d('0x27')](function(_0x2496be){var _0x2ed912=_0x103ab2[_0x636d('0x4b')][_0x636d('0x4c')]({'plain':!![]});if(!_0x2ed912)throw new Error(_0x636d('0x4d'));if(_0x2ed912[_0x636d('0x4e')]==='user'){var _0x40cd40=_0x2496be[_0x636d('0x4c')]({'plain':!![]});var _0x583c72=_0x636d('0x4f');return db[_0x636d('0x50')][_0x636d('0x51')]({'where':{'name':_0x583c72,'userProfileId':_0x2ed912[_0x636d('0x52')]},'raw':!![]})['then'](function(_0x5e911d){if(_0x5e911d&&_0x5e911d[_0x636d('0x53')]===0x0){return db[_0x636d('0x54')]['create']({'name':_0x40cd40[_0x636d('0x29')],'resourceId':_0x40cd40['id'],'type':_0x5e911d[_0x636d('0x29')],'sectionId':_0x5e911d['id']},{})[_0x636d('0x27')](function(){return _0x2496be;});}else{return _0x2496be;}})[_0x636d('0x46')](function(_0x401c34){logger[_0x636d('0x55')](_0x636d('0x56'),_0x401c34);throw _0x401c34;});}return _0x2496be;})[_0x636d('0x27')](respondWithResult(_0x45255f,0xc9))[_0x636d('0x46')](handleError(_0x45255f,null));};exports['update']=function(_0x264707,_0x5a1e8e){if(_0x264707['body']['id']){delete _0x264707['body']['id'];}return db[_0x636d('0x2d')][_0x636d('0x51')]({'where':{'id':_0x264707['params']['id']}})[_0x636d('0x27')](handleEntityNotFound(_0x5a1e8e,null))['then'](saveUpdates(_0x264707[_0x636d('0x4a')],null))[_0x636d('0x27')](respondWithResult(_0x5a1e8e,null))[_0x636d('0x46')](handleError(_0x5a1e8e,null));};exports[_0x636d('0x57')]=function(_0x16b9de,_0x2166bf){var _0x2737ae=_0x16b9de['params']['id'];var _0x3e9903=[];return db[_0x636d('0x58')]['transaction'](function(_0x19b565){var _0x5164a5=_0x636d('0x59')+_0x2737ae;return db[_0x636d('0x58')][_0x636d('0x33')](_0x5164a5,{'type':db['Sequelize'][_0x636d('0x5a')][_0x636d('0x5b')],'raw':!![],'transaction':_0x19b565})['then'](function(_0x355e21){_0x3e9903=_['map'](_0x355e21,function(_0x2e423b){return Number(_0x2e423b[_0x636d('0x5c')]);});})['then'](function(){var _0x2e2856=_0x636d('0x5d')+_0x2737ae;return db[_0x636d('0x58')][_0x636d('0x33')](_0x2e2856,{'type':db['Sequelize'][_0x636d('0x5a')][_0x636d('0x5b')],'raw':!![],'transaction':_0x19b565});})[_0x636d('0x27')](function(_0x38401b){var _0x36266a=_[_0x636d('0x2c')](_0x38401b,function(_0x59e55f){return Number(_0x59e55f[_0x636d('0x5e')]);});return db[_0x636d('0x5f')][_0x636d('0x57')]({'where':{'UserId':{'$in':_0x3e9903},'VoiceQueueId':{'$in':_0x36266a}},'transaction':_0x19b565});})[_0x636d('0x27')](function(){var _0x30af05=_0x636d('0x60')+_0x2737ae;return db[_0x636d('0x58')]['query'](_0x30af05,{'type':db[_0x636d('0x61')][_0x636d('0x5a')][_0x636d('0x5b')],'raw':!![],'transaction':_0x19b565});})[_0x636d('0x27')](function(_0x5c4b00){var _0x37de06=_['map'](_0x5c4b00,function(_0x43a1f8){return Number(_0x43a1f8['MailQueueId']);});return db[_0x636d('0x62')][_0x636d('0x57')]({'where':{'UserId':{'$in':_0x3e9903},'MailQueueId':{'$in':_0x37de06}},'transaction':_0x19b565});})[_0x636d('0x27')](function(){var _0x17ac8c=_0x636d('0x63')+_0x2737ae;return db[_0x636d('0x58')][_0x636d('0x33')](_0x17ac8c,{'type':db[_0x636d('0x61')][_0x636d('0x5a')][_0x636d('0x5b')],'raw':!![],'transaction':_0x19b565});})[_0x636d('0x27')](function(_0x3357ba){var _0x4bada0=_[_0x636d('0x2c')](_0x3357ba,function(_0xc199c7){return Number(_0xc199c7[_0x636d('0x64')]);});return db[_0x636d('0x65')][_0x636d('0x57')]({'where':{'UserId':{'$in':_0x3e9903},'SmsQueueId':{'$in':_0x4bada0}},'transaction':_0x19b565});})[_0x636d('0x27')](function(){var _0x3f2fd1=_0x636d('0x66')+_0x2737ae;return db[_0x636d('0x58')][_0x636d('0x33')](_0x3f2fd1,{'type':db[_0x636d('0x61')]['QueryTypes'][_0x636d('0x5b')],'raw':!![],'transaction':_0x19b565});})[_0x636d('0x27')](function(_0x2158d5){var _0x17689f=_[_0x636d('0x2c')](_0x2158d5,function(_0x53e114){return Number(_0x53e114['ChatQueueId']);});return db[_0x636d('0x67')][_0x636d('0x57')]({'where':{'UserId':{'$in':_0x3e9903},'ChatQueueId':{'$in':_0x17689f}},'transaction':_0x19b565});})[_0x636d('0x27')](function(){var _0x11978a='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2737ae;return db[_0x636d('0x58')][_0x636d('0x33')](_0x11978a,{'type':db[_0x636d('0x61')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x19b565});})[_0x636d('0x27')](function(_0x435d85){var _0x507e36=_[_0x636d('0x2c')](_0x435d85,function(_0x596bbf){return Number(_0x596bbf[_0x636d('0x68')]);});return db[_0x636d('0x69')][_0x636d('0x57')]({'where':{'UserId':{'$in':_0x3e9903},'FaxQueueId':{'$in':_0x507e36}},'transaction':_0x19b565});})['then'](function(){var _0x522d98=_0x636d('0x6a')+_0x2737ae;return db['sequelize']['query'](_0x522d98,{'type':db[_0x636d('0x61')][_0x636d('0x5a')][_0x636d('0x5b')],'raw':!![],'transaction':_0x19b565});})['then'](function(_0x1b91d4){var _0x37fabc=_[_0x636d('0x2c')](_0x1b91d4,function(_0x24b0cf){return Number(_0x24b0cf[_0x636d('0x6b')]);});return db[_0x636d('0x6c')][_0x636d('0x57')]({'where':{'UserId':{'$in':_0x3e9903},'OpenchannelQueueId':{'$in':_0x37fabc}},'transaction':_0x19b565});})[_0x636d('0x27')](function(){var _0x2ea76a=_0x636d('0x6d')+_0x2737ae;return db['sequelize'][_0x636d('0x33')](_0x2ea76a,{'type':db[_0x636d('0x61')]['QueryTypes'][_0x636d('0x5b')],'raw':!![],'transaction':_0x19b565});})[_0x636d('0x27')](function(_0x473fa4){var _0x30e188=_[_0x636d('0x2c')](_0x473fa4,function(_0x31e4a8){return Number(_0x31e4a8[_0x636d('0x6e')]);});return db[_0x636d('0x6f')][_0x636d('0x57')]({'where':{'UserId':{'$in':_0x3e9903},'WhatsappQueueId':{'$in':_0x30e188}},'transaction':_0x19b565});})[_0x636d('0x27')](function(){return db[_0x636d('0x70')][_0x636d('0x51')]({'where':{'TeamId':_0x2737ae}});})[_0x636d('0x27')](function(_0x58fa6b){if(_0x58fa6b===null){return;}return db['UserVoicePrefix'][_0x636d('0x57')]({'where':{'UserId':{'$in':_0x3e9903},'VoicePrefixId':_0x58fa6b[_0x636d('0x71')]},'transaction':_0x19b565});})[_0x636d('0x27')](function(){return db['Team']['destroy']({'where':{'id':_0x2737ae},'cascade':!![],'transaction':_0x19b565});})[_0x636d('0x27')](function(_0x4b25ac){if(_0x4b25ac===0x0){_0x2166bf[_0x636d('0x1c')](0x194);}else{return db[_0x636d('0x54')][_0x636d('0x57')]({'where':{'type':_0x636d('0x4f'),'resourceId':_0x2737ae},'cascade':!![],'transaction':_0x19b565})['then'](function(){_0x2166bf['status'](0xcc)[_0x636d('0x72')]();});}})['catch'](function(_0x193ed1){_0x2166bf['status'](0x1f4)['send'](_0x193ed1);});});};exports[_0x636d('0x73')]=function(_0x5b17e7,_0x3f826a,_0x159308){return db['Team'][_0x636d('0x74')]({'where':{'id':_0x5b17e7[_0x636d('0x48')]['id']}})[_0x636d('0x27')](handleEntityNotFound(_0x3f826a,null))[_0x636d('0x27')](function(_0x2c7db3){if(!_0x5b17e7['query'][_0x636d('0x75')]||!utils[_0x636d('0x76')](_0x5b17e7[_0x636d('0x33')]['channel'])){throw new db[(_0x636d('0x61'))][(_0x636d('0x77'))](_0x636d('0x78'));}var _0x2f167c={};var _0x1a777d={};_0x1a777d[_0x636d('0x32')]=_['keys'](db[_[_0x636d('0x79')](_0x5b17e7['query']['channel'][_0x636d('0x7a')]())+_0x636d('0x7b')][_0x636d('0x2e')]);_0x1a777d[_0x636d('0x33')]=_[_0x636d('0x34')](_0x5b17e7['query']);_0x1a777d[_0x636d('0x35')]=_[_0x636d('0x36')](_0x1a777d[_0x636d('0x32')],_0x1a777d[_0x636d('0x33')]);_0x2f167c[_0x636d('0x37')]=_[_0x636d('0x36')](_0x1a777d[_0x636d('0x32')],qs[_0x636d('0x38')](_0x5b17e7[_0x636d('0x33')]['fields']));_0x2f167c[_0x636d('0x37')]=_0x2f167c[_0x636d('0x37')][_0x636d('0x39')]?_0x2f167c[_0x636d('0x37')]:_0x1a777d['model'];_0x2f167c[_0x636d('0x20')]=qs[_0x636d('0x20')](_0x5b17e7[_0x636d('0x33')]['limit']);_0x2f167c['offset']=qs[_0x636d('0x1e')](_0x5b17e7[_0x636d('0x33')][_0x636d('0x1e')]);_0x2f167c['order']=qs['sort'](_0x5b17e7['query'][_0x636d('0x3c')]);_0x2f167c[_0x636d('0x3d')]=qs['filters'](_[_0x636d('0x3e')](_0x5b17e7['query'],_0x1a777d[_0x636d('0x35')]));_0x2f167c=_['merge']({},_0x2f167c,_0x5b17e7[_0x636d('0x42')]);return _0x2c7db3[_0x636d('0x4c')+_[_0x636d('0x79')](_0x5b17e7[_0x636d('0x33')][_0x636d('0x75')][_0x636d('0x7a')]())+_0x636d('0x7c')](_0x2f167c);})[_0x636d('0x27')](respondWithResult(_0x3f826a,null))[_0x636d('0x46')](handleError(_0x3f826a,null));};exports[_0x636d('0x7d')]=function(_0x3cf21b,_0x408b9f,_0x49f261){return db[_0x636d('0x2d')][_0x636d('0x74')]({'where':{'id':_0x3cf21b[_0x636d('0x48')]['id']}})['then'](function(_0x5b757a){if(_0x5b757a){if(!_0x3cf21b[_0x636d('0x4a')][_0x636d('0x75')]||!utils['isValidChannel'](_0x3cf21b[_0x636d('0x4a')]['channel'])){throw new db[(_0x636d('0x61'))]['ValidationError'](_0x636d('0x78'));}return _0x5b757a[_0x636d('0x7e')+_[_0x636d('0x79')](_0x3cf21b[_0x636d('0x4a')][_0x636d('0x75')][_0x636d('0x7a')]())+_0x636d('0x7c')](_0x3cf21b[_0x636d('0x4a')][_0x636d('0x7f')]);}return null;})[_0x636d('0x27')](handleEntityNotFound(_0x408b9f,null))['then'](respondWithStatusCode(_0x408b9f,null))[_0x636d('0x46')](handleError(_0x408b9f,null));};exports[_0x636d('0x80')]=function(_0x351037,_0x582950,_0x1229e7){return db['Team'][_0x636d('0x74')]({'where':{'id':_0x351037[_0x636d('0x48')]['id']}})[_0x636d('0x27')](function(_0x4bacd4){if(_0x4bacd4){if(!_0x351037[_0x636d('0x33')][_0x636d('0x75')]||!utils[_0x636d('0x76')](_0x351037[_0x636d('0x33')][_0x636d('0x75')])){throw new db[(_0x636d('0x61'))]['ValidationError'](_0x636d('0x78'));}return _0x4bacd4[_0x636d('0x81')+_[_0x636d('0x79')](_0x351037[_0x636d('0x33')][_0x636d('0x75')][_0x636d('0x7a')]())+_0x636d('0x7c')](_0x351037[_0x636d('0x33')][_0x636d('0x7f')]);}return null;})[_0x636d('0x27')](handleEntityNotFound(_0x582950,null))[_0x636d('0x27')](respondWithStatusCode(_0x582950,null))[_0x636d('0x46')](handleError(_0x582950,null));};exports[_0x636d('0x82')]=function(_0x2ac484,_0x2cfe38){var _0x4f3303=_[_0x636d('0x83')](_0x2ac484[_0x636d('0x4a')][_0x636d('0x7f')])?_0x2ac484[_0x636d('0x4a')][_0x636d('0x7f')]:[_0x2ac484[_0x636d('0x4a')][_0x636d('0x7f')]];var _0x14f20e=_0x2ac484[_0x636d('0x48')]['id'];return db[_0x636d('0x2d')][_0x636d('0x51')]({'where':{'id':_0x14f20e}})[_0x636d('0x27')](handleEntityNotFound(_0x2cfe38,null))[_0x636d('0x27')](function(_0x3856d4){if(_0x3856d4){var _0x5292b7=[_0x636d('0x84'),_0x636d('0x85'),'Mail',_0x636d('0x86'),'Fax','Openchannel',_0x636d('0x87')];return db[_0x636d('0x58')][_0x636d('0x88')](function(_0xa339c6){var _0x3da73d=_[_0x636d('0x2c')](_0x5292b7,function(_0x313b0a){var _0x3d8918={'attributes':['id',_0x636d('0x29')]};if(_0x313b0a===_0x636d('0x84')){_0x3d8918[_0x636d('0x89')]={'attributes':[_0x636d('0x8a')]};}return _0x3856d4['get'+_0x313b0a+_0x636d('0x7c')](_0x3d8918)['then'](function(_0x38a1d8){var _0x49cd81=_[_0x636d('0x2c')](_0x38a1d8,function(_0x3ae817){var _0x448d48=_[_0x636d('0x2c')](_0x4f3303,function(_0x13cee2){var _0x27e05b={'where':{'UserId':_0x13cee2,[_0x313b0a+_0x636d('0x8b')]:_0x3ae817['id']},'transaction':_0xa339c6};if(_0x313b0a===_0x636d('0x84')){_0x27e05b[_0x636d('0x18')]={'penalty':_0x3ae817[_0x636d('0x8c')][_0x636d('0x8a')]};}return db[_0x636d('0x8d')+_0x313b0a+'Queue'][_0x636d('0x8e')](_0x27e05b)[_0x636d('0x27')](function(){socket[_0x636d('0x8f')]('user'+_0x313b0a+_0x636d('0x90'),{'UserId':_0x13cee2,[_0x313b0a+_0x636d('0x8b')]:_0x3ae817['id']});if(_0x313b0a!=='Voice'){return;}return db[_0x636d('0x8d')]['findAll']({'where':{'id':_0x4f3303,'online':0x1},'attributes':['id',_0x636d('0x29'),_0x636d('0x91'),_0x636d('0x92'),'interface'],'raw':!![]})[_0x636d('0x27')](function(_0x45d36c){var _0x329eaa=_[_0x636d('0x2c')](_0x45d36c,function(_0x44604b){return db[_0x636d('0x93')][_0x636d('0x94')]({'membername':_0x44604b[_0x636d('0x29')],'UserId':_0x44604b['id'],'queue_name':_0x3ae817[_0x636d('0x29')],'VoiceQueueId':_0x3ae817['id'],'interface':_[_0x636d('0x95')](_0x44604b['interface'])?util[_0x636d('0x96')](_0x636d('0x97'),_0x44604b['name']):_0x44604b[_0x636d('0x98')],'paused':_0x44604b['voicePause']||![],'penalty':_0x3ae817[_0x636d('0x8c')][_0x636d('0x8a')]},{'transaction':_0xa339c6});});return Promise[_0x636d('0x99')](_0x329eaa);});});});return Promise[_0x636d('0x99')](_0x448d48);});return Promise[_0x636d('0x99')](_0x49cd81);})[_0x636d('0x27')](function(){return db[_0x636d('0x70')][_0x636d('0x74')]({'where':{'teamId':_0x14f20e}})[_0x636d('0x27')](function(_0x312fdd){if(_0x312fdd){var _0x2f2a29=_[_0x636d('0x2c')](_0x4f3303,function(_0x3d1113){db[_0x636d('0x9a')]['upsert']({'UserId':_0x3d1113,'VoicePrefixId':_0x312fdd[_0x636d('0x71')]});});return Promise[_0x636d('0x99')](_0x2f2a29);}});});});return Promise['all'](_0x3da73d)['then'](function(){return _0x3856d4[_0x636d('0x82')](_0x4f3303,{'transaction':_0xa339c6})['spread'](function(_0x5d26da){return _0x5d26da;});});});}})[_0x636d('0x27')](respondWithResult(_0x2cfe38,null))[_0x636d('0x46')](handleError(_0x2cfe38,null));};exports[_0x636d('0x9b')]=function(_0x4582c4,_0x5f31be){var _0x551fd3=_[_0x636d('0x83')](_0x4582c4[_0x636d('0x33')][_0x636d('0x7f')])?_0x4582c4['query']['ids']:[_0x4582c4[_0x636d('0x33')][_0x636d('0x7f')]];var _0x58243f=_0x4582c4['params']['id'];return db[_0x636d('0x2d')][_0x636d('0x51')]({'where':{'id':_0x58243f}})['then'](handleEntityNotFound(_0x5f31be,null))[_0x636d('0x27')](function(_0x3583a6){if(_0x3583a6){var _0x3fb165=['Voice',_0x636d('0x85'),'Mail',_0x636d('0x86'),'Fax','Openchannel',_0x636d('0x87')];return db[_0x636d('0x58')][_0x636d('0x88')](function(_0x19d169){var _0x1e20c7=_[_0x636d('0x2c')](_0x3fb165,function(_0x43bec3){var _0x34ee2b={'attributes':['id','name']};return _0x3583a6[_0x636d('0x4c')+_0x43bec3+_0x636d('0x7c')](_0x34ee2b)[_0x636d('0x27')](function(_0x11045f){var _0x386cc6=_[_0x636d('0x2c')](_0x11045f,function(_0x47ee9f){return _0x47ee9f['removeAgents'](_0x551fd3,{'transaction':_0x19d169})[_0x636d('0x27')](function(){var _0x2ced96=_[_0x636d('0x2c')](_0x551fd3,function(_0x56426b){socket['emit'](_0x636d('0x4b')+_0x43bec3+_0x636d('0x9c'),{'UserId':Number(_0x56426b),[_0x43bec3+_0x636d('0x8b')]:_0x47ee9f['id']});if(_0x43bec3!=='Voice'){return;}return db[_0x636d('0x93')][_0x636d('0x57')]({'where':{'VoiceQueueId':_0x47ee9f['id'],'UserId':_0x56426b},'transaction':_0x19d169});});return Promise['all'](_0x2ced96);});});return Promise['all'](_0x386cc6);});});return Promise[_0x636d('0x99')](_0x1e20c7)[_0x636d('0x27')](function(){return _0x3583a6[_0x636d('0x9b')](_0x551fd3,{'transaction':_0x19d169});})[_0x636d('0x27')](function(){return db[_0x636d('0x70')][_0x636d('0x74')]({'where':{'teamId':_0x58243f}})[_0x636d('0x27')](function(_0x464621){if(_0x464621){var _0xcb69c7=_[_0x636d('0x2c')](_0x551fd3,function(_0x31aebd){db['UserVoicePrefix'][_0x636d('0x57')]({'where':{'UserId':_0x31aebd,'VoicePrefixId':_0x464621[_0x636d('0x71')]}});});return Promise[_0x636d('0x99')](_0xcb69c7);}});});});}})[_0x636d('0x27')](respondWithStatusCode(_0x5f31be,null))['catch'](handleError(_0x5f31be,null));};exports['getAgents']=function(_0x38c865,_0x449f41,_0x38af14){var _0x478116={};var _0x6e7128={};var _0x907f70;var _0x44040b;return db[_0x636d('0x2d')][_0x636d('0x74')]({'where':{'id':_0x38c865[_0x636d('0x48')]['id']}})[_0x636d('0x27')](handleEntityNotFound(_0x449f41,null))[_0x636d('0x27')](function(_0x37ec8d){if(_0x37ec8d){_0x907f70=_0x37ec8d;_0x6e7128[_0x636d('0x32')]=_['keys'](db[_0x636d('0x8d')][_0x636d('0x2e')]);_0x6e7128['query']=_[_0x636d('0x34')](_0x38c865[_0x636d('0x33')]);_0x6e7128[_0x636d('0x35')]=_[_0x636d('0x36')](_0x6e7128[_0x636d('0x32')],_0x6e7128[_0x636d('0x33')]);_0x478116[_0x636d('0x37')]=_[_0x636d('0x36')](_0x6e7128[_0x636d('0x32')],qs[_0x636d('0x38')](_0x38c865[_0x636d('0x33')]['fields']));_0x478116['attributes']=_0x478116[_0x636d('0x37')][_0x636d('0x39')]?_0x478116['attributes']:_0x6e7128[_0x636d('0x32')];_0x478116[_0x636d('0x9d')]=qs[_0x636d('0x3c')](_0x38c865['query']['sort']);_0x478116[_0x636d('0x3d')]=qs['filters'](_[_0x636d('0x3e')](_0x38c865[_0x636d('0x33')],_0x6e7128[_0x636d('0x35')]));if(_0x38c865[_0x636d('0x33')][_0x636d('0x3f')]){_0x478116[_0x636d('0x3d')]=_['merge'](_0x478116['where'],{'$or':_['map'](_0x478116['attributes'],function(_0x90a345){var _0x3ead15={};_0x3ead15[_0x90a345]={'$like':'%'+_0x38c865[_0x636d('0x33')]['filter']+'%'};return _0x3ead15;})});}_0x478116=_['merge']({},_0x478116,_0x38c865[_0x636d('0x42')]);return _0x907f70[_0x636d('0x9e')](_0x478116);}})[_0x636d('0x27')](function(_0x180143){if(_0x180143){_0x44040b=_0x180143[_0x636d('0x39')];if(!_0x38c865[_0x636d('0x33')][_0x636d('0x3a')](_0x636d('0x3b'))){_0x478116[_0x636d('0x20')]=qs[_0x636d('0x20')](_0x38c865[_0x636d('0x33')]['limit']);_0x478116[_0x636d('0x1e')]=qs[_0x636d('0x1e')](_0x38c865[_0x636d('0x33')]['offset']);}return _0x907f70['getAgents'](_0x478116);}})[_0x636d('0x27')](function(_0x4a16f9){if(_0x4a16f9){return _0x4a16f9?{'count':_0x44040b,'rows':_0x4a16f9}:null;}})[_0x636d('0x27')](respondWithResult(_0x449f41,null))['catch'](handleError(_0x449f41,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 5bc5c90..b0b5cce 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 _0x2c63=['../../mysqldb','Team','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x31701d,_0x25897a){var _0x422109=function(_0x3ca953){while(--_0x3ca953){_0x31701d['push'](_0x31701d['shift']());}};_0x422109(++_0x25897a);}(_0x2c63,0x1c8));var _0x32c6=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x2c63[_0xdc37a1];return _0x99b4fe;};'use strict';var EventEmitter=require('events');var Team=require(_0x32c6('0x0'))['db'][_0x32c6('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x32c6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x32c6('0x3'),'afterDestroy':_0x32c6('0x4')};function emitEvent(_0x4a278e){return function(_0x242209,_0x491832,_0x47fab8){TeamEvents['emit'](_0x4a278e+':'+_0x242209['id'],_0x242209);TeamEvents[_0x32c6('0x5')](_0x4a278e,_0x242209);_0x47fab8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x32c6('0x6')](e,emitEvent(event));}}module[_0x32c6('0x7')]=TeamEvents; \ No newline at end of file +var _0xc401=['hook','exports','events','Team','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x4e618e,_0x55d3a0){var _0x9e8183=function(_0x4d705e){while(--_0x4d705e){_0x4e618e['push'](_0x4e618e['shift']());}};_0x9e8183(++_0x55d3a0);}(_0xc401,0x142));var _0x1c40=function(_0x316a1e,_0x3ab24a){_0x316a1e=_0x316a1e-0x0;var _0x1b57f2=_0xc401[_0x316a1e];return _0x1b57f2;};'use strict';var EventEmitter=require(_0x1c40('0x0'));var Team=require('../../mysqldb')['db'][_0x1c40('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x1c40('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1c40('0x3')};function emitEvent(_0x58580e){return function(_0x11d42d,_0x5c7e35,_0xdce977){TeamEvents[_0x1c40('0x4')](_0x58580e+':'+_0x11d42d['id'],_0x11d42d);TeamEvents['emit'](_0x58580e,_0x11d42d);_0xdce977(null);};}for(var e in events){if(events[_0x1c40('0x5')](e)){var event=events[e];Team[_0x1c40('0x6')](e,emitEvent(event));}}module[_0x1c40('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 2da4540..73e05cf 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 _0xb8ef=['exports','define','Team','teams','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','all','./team.attributes','get','Queues','then','map','setDataValue','channel','catch'];(function(_0x10a365,_0x2bbb4a){var _0x4025b7=function(_0x39f2c4){while(--_0x39f2c4){_0x10a365['push'](_0x10a365['shift']());}};_0x4025b7(++_0x2bbb4a);}(_0xb8ef,0x110));var _0xfb8e=function(_0x20f242,_0x1ff707){_0x20f242=_0x20f242-0x0;var _0x2fc138=_0xb8ef[_0x20f242];return _0x2fc138;};'use strict';var _=require('lodash');var attributes=require(_0xfb8e('0x0'));function getQueuesByChannel(_0x8fa96b,_0x20356d){var _0x550dd4=_0xfb8e('0x1')+_0x20356d+_0xfb8e('0x2');return _0x8fa96b[_0x550dd4]()[_0xfb8e('0x3')](function(_0x3323d2){return _[_0xfb8e('0x4')](_0x3323d2,function(_0x468be5){_0x468be5[_0xfb8e('0x5')](_0xfb8e('0x6'),_0x20356d);return _0x468be5;});})[_0xfb8e('0x7')](function(_0xaf2919){throw _0xaf2919;});}module[_0xfb8e('0x8')]=function(_0x495503){return _0x495503[_0xfb8e('0x9')](_0xfb8e('0xa'),attributes,{'tableName':_0xfb8e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x362f61=this;var _0x22884e=['Chat',_0xfb8e('0xc'),_0xfb8e('0xd'),_0xfb8e('0xe'),_0xfb8e('0xf'),_0xfb8e('0x10'),_0xfb8e('0x11')];return Promise[_0xfb8e('0x12')]()[_0xfb8e('0x3')](function(){var _0x177bb7=_['map'](_0x22884e,function(_0x3ee1a2){return getQueuesByChannel(_0x362f61,_0x3ee1a2);});return Promise[_0xfb8e('0x13')](_0x177bb7);})[_0xfb8e('0x7')](function(_0x289c54){throw _0x289c54;});}}});}; \ No newline at end of file +var _0x897a=['setDataValue','catch','exports','define','Team','teams','Chat','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','then','all','./team.attributes','get','map'];(function(_0x41d882,_0x5dd16d){var _0x40b59d=function(_0x40b0c5){while(--_0x40b0c5){_0x41d882['push'](_0x41d882['shift']());}};_0x40b59d(++_0x5dd16d);}(_0x897a,0xe1));var _0xa897=function(_0x84e3fb,_0x2929e7){_0x84e3fb=_0x84e3fb-0x0;var _0x485313=_0x897a[_0x84e3fb];return _0x485313;};'use strict';var _=require('lodash');var attributes=require(_0xa897('0x0'));function getQueuesByChannel(_0x6913e7,_0x3af915){var _0x27094f=_0xa897('0x1')+_0x3af915+'Queues';return _0x6913e7[_0x27094f]()['then'](function(_0x4f81a6){return _[_0xa897('0x2')](_0x4f81a6,function(_0x137ce9){_0x137ce9[_0xa897('0x3')]('channel',_0x3af915);return _0x137ce9;});})[_0xa897('0x4')](function(_0x3b219b){throw _0x3b219b;});}module[_0xa897('0x5')]=function(_0x21af60){return _0x21af60[_0xa897('0x6')](_0xa897('0x7'),attributes,{'tableName':_0xa897('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x3f0ade=this;var _0x2307fc=[_0xa897('0x9'),_0xa897('0xa'),_0xa897('0xb'),_0xa897('0xc'),_0xa897('0xd'),_0xa897('0xe'),_0xa897('0xf')];return Promise[_0xa897('0x10')]()[_0xa897('0x11')](function(){var _0x170c91=_[_0xa897('0x2')](_0x2307fc,function(_0xfca6c1){return getQueuesByChannel(_0x3f0ade,_0xfca6c1);});return Promise[_0xa897('0x12')](_0x170c91);})[_0xa897('0x4')](function(_0x7b5979){throw _0x7b5979;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index d20e087..c0fc8be 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 _0xf583=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','redis','defaults','localhost','register','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','error','code','message','util','moment'];(function(_0x2635f1,_0x5702c5){var _0x1396bc=function(_0x26ebd0){while(--_0x26ebd0){_0x2635f1['push'](_0x2635f1['shift']());}};_0x1396bc(++_0x5702c5);}(_0xf583,0x1ca));var _0x3f58=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xf583[_0x1573ea];return _0x51c0e2;};'use strict';var _=require('lodash');var util=require(_0x3f58('0x0'));var moment=require(_0x3f58('0x1'));var BPromise=require(_0x3f58('0x2'));var rs=require(_0x3f58('0x3'));var fs=require('fs');var Redis=require(_0x3f58('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f58('0x5'));var logger=require(_0x3f58('0x6'))(_0x3f58('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x3f58('0x8')]=_[_0x3f58('0x9')](config[_0x3f58('0x8')],{'host':_0x3f58('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3f58('0x8')]));require('./team.socket')[_0x3f58('0xb')](socket);function respondWithRpcPromise(_0x553b71,_0x15378c,_0x1f6d86){return new BPromise(function(_0x241c57,_0x273ea4){return client['request'](_0x553b71,_0x1f6d86)[_0x3f58('0xc')](function(_0x1fe652){logger[_0x3f58('0xd')](_0x3f58('0xe'),_0x15378c,_0x3f58('0xf'));logger['debug'](_0x3f58('0x10'),_0x15378c,_0x3f58('0xf'),JSON['stringify'](_0x1fe652));if(_0x1fe652[_0x3f58('0x11')]){if(_0x1fe652[_0x3f58('0x11')][_0x3f58('0x12')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x15378c,_0x1fe652[_0x3f58('0x11')][_0x3f58('0x13')]);return _0x273ea4(_0x1fe652[_0x3f58('0x11')][_0x3f58('0x13')]);}logger[_0x3f58('0x11')]('Team,\x20%s,\x20%s',_0x15378c,_0x1fe652[_0x3f58('0x11')][_0x3f58('0x13')]);return _0x241c57(_0x1fe652['error']['message']);}else{logger['info'](_0x3f58('0xe'),_0x15378c,_0x3f58('0xf'));_0x241c57(_0x1fe652['result'][_0x3f58('0x13')]);}})['catch'](function(_0x212938){logger[_0x3f58('0x11')](_0x3f58('0xe'),_0x15378c,_0x212938);_0x273ea4(_0x212938);});});} \ No newline at end of file +var _0xbfcb=['redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3937ab,_0x229d4f){var _0x545726=function(_0x5f3854){while(--_0x5f3854){_0x3937ab['push'](_0x3937ab['shift']());}};_0x545726(++_0x229d4f);}(_0xbfcb,0x103));var _0xbbfc=function(_0x467501,_0x5c154b){_0x467501=_0x467501-0x0;var _0x54de17=_0xbfcb[_0x467501];return _0x54de17;};'use strict';var _=require(_0xbbfc('0x0'));var util=require('util');var moment=require(_0xbbfc('0x1'));var BPromise=require(_0xbbfc('0x2'));var rs=require(_0xbbfc('0x3'));var fs=require('fs');var Redis=require(_0xbbfc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbbfc('0x5'));var logger=require(_0xbbfc('0x6'))('rpc');var config=require(_0xbbfc('0x7'));var jayson=require(_0xbbfc('0x8'));var client=jayson[_0xbbfc('0x9')][_0xbbfc('0xa')]({'port':0x232a});config[_0xbbfc('0xb')]=_[_0xbbfc('0xc')](config[_0xbbfc('0xb')],{'host':_0xbbfc('0xd'),'port':0x18eb});var socket=require(_0xbbfc('0xe'))(new Redis(config[_0xbbfc('0xb')]));require(_0xbbfc('0xf'))[_0xbbfc('0x10')](socket);function respondWithRpcPromise(_0x45a66f,_0x55356d,_0x13ac99){return new BPromise(function(_0x167dd0,_0x4545ae){return client[_0xbbfc('0x11')](_0x45a66f,_0x13ac99)[_0xbbfc('0x12')](function(_0xeba2be){logger['info'](_0xbbfc('0x13'),_0x55356d,_0xbbfc('0x14'));logger[_0xbbfc('0x15')](_0xbbfc('0x16'),_0x55356d,_0xbbfc('0x14'),JSON[_0xbbfc('0x17')](_0xeba2be));if(_0xeba2be[_0xbbfc('0x18')]){if(_0xeba2be[_0xbbfc('0x18')]['code']===0x1f4){logger['error'](_0xbbfc('0x13'),_0x55356d,_0xeba2be[_0xbbfc('0x18')]['message']);return _0x4545ae(_0xeba2be['error'][_0xbbfc('0x19')]);}logger[_0xbbfc('0x18')](_0xbbfc('0x13'),_0x55356d,_0xeba2be[_0xbbfc('0x18')][_0xbbfc('0x19')]);return _0x167dd0(_0xeba2be[_0xbbfc('0x18')][_0xbbfc('0x19')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x55356d,_0xbbfc('0x14'));_0x167dd0(_0xeba2be[_0xbbfc('0x1a')][_0xbbfc('0x19')]);}})['catch'](function(_0x3d68f8){logger[_0xbbfc('0x18')]('Team,\x20%s,\x20%s',_0x55356d,_0x3d68f8);_0x4545ae(_0x3d68f8);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index fc2d580..e3fb223 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 _0x9715=['team:','./team.events','save','remove','update','register','length'];(function(_0x260efc,_0x59b99e){var _0x248096=function(_0x5e3915){while(--_0x5e3915){_0x260efc['push'](_0x260efc['shift']());}};_0x248096(++_0x59b99e);}(_0x9715,0x15f));var _0x5971=function(_0xa2c0a3,_0x5bbac0){_0xa2c0a3=_0xa2c0a3-0x0;var _0x52c618=_0x9715[_0xa2c0a3];return _0x52c618;};'use strict';var TeamEvents=require(_0x5971('0x0'));var events=[_0x5971('0x1'),_0x5971('0x2'),_0x5971('0x3')];function createListener(_0x333442,_0x299f20){return function(_0x36062c){_0x299f20['emit'](_0x333442,_0x36062c);};}function removeListener(_0x52f839,_0x42c7a2){return function(){TeamEvents['removeListener'](_0x52f839,_0x42c7a2);};}exports[_0x5971('0x4')]=function(_0x5f193d){for(var _0x2f8a81=0x0,_0x48bf46=events[_0x5971('0x5')];_0x2f8a81<_0x48bf46;_0x2f8a81++){var _0x49da9f=events[_0x2f8a81];var _0xa859cf=createListener(_0x5971('0x6')+_0x49da9f,_0x5f193d);TeamEvents['on'](_0x49da9f,_0xa859cf);}}; \ No newline at end of file +var _0x2d28=['length','./team.events','save','emit','removeListener'];(function(_0x1617a5,_0x3d5b1f){var _0x255f1d=function(_0x2d3385){while(--_0x2d3385){_0x1617a5['push'](_0x1617a5['shift']());}};_0x255f1d(++_0x3d5b1f);}(_0x2d28,0x1be));var _0x82d2=function(_0x41bdd4,_0x3d5c76){_0x41bdd4=_0x41bdd4-0x0;var _0x5c03a6=_0x2d28[_0x41bdd4];return _0x5c03a6;};'use strict';var TeamEvents=require(_0x82d2('0x0'));var events=[_0x82d2('0x1'),'remove','update'];function createListener(_0x5bc4ff,_0x5f59d5){return function(_0x34e5aa){_0x5f59d5[_0x82d2('0x2')](_0x5bc4ff,_0x34e5aa);};}function removeListener(_0x5f5034,_0x272317){return function(){TeamEvents[_0x82d2('0x3')](_0x5f5034,_0x272317);};}exports['register']=function(_0x463ecf){for(var _0x4b55d2=0x0,_0x4dab01=events[_0x82d2('0x4')];_0x4b55d2<_0x4dab01;_0x4b55d2++){var _0x44b601=events[_0x4b55d2];var _0x37d12d=createListener('team:'+_0x44b601,_0x463ecf);TeamEvents['on'](_0x44b601,_0x37d12d);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 86e4c5f..d468b68 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9b4=['sequelize','exports'];(function(_0x1ac136,_0x15882e){var _0x6a7222=function(_0x2ef635){while(--_0x2ef635){_0x1ac136['push'](_0x1ac136['shift']());}};_0x6a7222(++_0x15882e);}(_0xd9b4,0x1f0));var _0x4d9b=function(_0x4f8600,_0x1ead5d){_0x4f8600=_0x4f8600-0x0;var _0x333816=_0xd9b4[_0x4f8600];return _0x333816;};'use strict';var Sequelize=require(_0x4d9b('0x0'));module[_0x4d9b('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xd86f=['sequelize','exports','INTEGER'];(function(_0x440464,_0xb7afd8){var _0x2f4043=function(_0x40a871){while(--_0x40a871){_0x440464['push'](_0x440464['shift']());}};_0x2f4043(++_0xb7afd8);}(_0xd86f,0xf6));var _0xfd86=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xd86f[_0x599f41];return _0x2e4d58;};'use strict';var Sequelize=require(_0xfd86('0x0'));module[_0xfd86('0x1')]={'TeamId':{'type':Sequelize[_0xfd86('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xfd86('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index af5eb82..0e1ce34 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.model.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6372=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','lodash'];(function(_0x5293d8,_0x5a69de){var _0x2ba618=function(_0x2a3b0b){while(--_0x2a3b0b){_0x5293d8['push'](_0x5293d8['shift']());}};_0x2ba618(++_0x5a69de);}(_0x6372,0x1b8));var _0x2637=function(_0x11142f,_0x164b10){_0x11142f=_0x11142f-0x0;var _0x132461=_0x6372[_0x11142f];return _0x132461;};'use strict';var _=require(_0x2637('0x0'));var util=require('util');var logger=require(_0x2637('0x1'))('api');var moment=require(_0x2637('0x2'));var BPromise=require(_0x2637('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2637('0x4'));var rimraf=require(_0x2637('0x5'));var config=require(_0x2637('0x6'));var attributes=require(_0x2637('0x7'));module[_0x2637('0x8')]=function(_0x5da891,_0x33d56c){return _0x5da891['define']('TeamVoicePrefix',attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0936=['request-promise','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x26cc1c,_0x4f6b44){var _0x23d79c=function(_0x4782ad){while(--_0x4782ad){_0x26cc1c['push'](_0x26cc1c['shift']());}};_0x23d79c(++_0x4f6b44);}(_0x0936,0xde));var _0x6093=function(_0x33395e,_0x57bac4){_0x33395e=_0x33395e-0x0;var _0x3d5780=_0x0936[_0x33395e];return _0x3d5780;};'use strict';var _=require(_0x6093('0x0'));var util=require(_0x6093('0x1'));var logger=require(_0x6093('0x2'))(_0x6093('0x3'));var moment=require(_0x6093('0x4'));var BPromise=require(_0x6093('0x5'));var rp=require(_0x6093('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6093('0x7'));var attributes=require(_0x6093('0x8'));module[_0x6093('0x9')]=function(_0x30c8e4,_0x3bd339){return _0x30c8e4[_0x6093('0xa')](_0x6093('0xb'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index d1d626d..699ab8f 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x27531a,_0x58628a){var _0x423afe=function(_0x2d2435){while(--_0x2d2435){_0x27531a['push'](_0x27531a['shift']());}};_0x423afe(++_0x58628a);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1d2adb,_0x34355e){var _0x3602bd=function(_0x22f7fb){while(--_0x22f7fb){_0x1d2adb['push'](_0x1d2adb['shift']());}};_0x3602bd(++_0x34355e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0xcb91[_0x54edc9];return _0x2ae7a9;};'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 d4c89d3..7961cfb 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 _0x8375=['exports','INTEGER'];(function(_0x4e3b35,_0x530e71){var _0x1edb5a=function(_0xb92fbb){while(--_0xb92fbb){_0x4e3b35['push'](_0x4e3b35['shift']());}};_0x1edb5a(++_0x530e71);}(_0x8375,0x132));var _0x5837=function(_0xf7a71b,_0x14f4fd){_0xf7a71b=_0xf7a71b-0x0;var _0x2d4b8d=_0x8375[_0xf7a71b];return _0x2d4b8d;};'use strict';var Sequelize=require('sequelize');module[_0x5837('0x0')]={'penalty':{'type':Sequelize[_0x5837('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7db4=['sequelize','exports','INTEGER'];(function(_0x3bafa7,_0x5067ed){var _0x3ee6d2=function(_0x34bd4e){while(--_0x34bd4e){_0x3bafa7['push'](_0x3bafa7['shift']());}};_0x3ee6d2(++_0x5067ed);}(_0x7db4,0x12f));var _0x47db=function(_0x3412e0,_0x5c4e4f){_0x3412e0=_0x3412e0-0x0;var _0x479b68=_0x7db4[_0x3412e0];return _0x479b68;};'use strict';var Sequelize=require(_0x47db('0x0'));module[_0x47db('0x1')]={'penalty':{'type':Sequelize[_0x47db('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 8be2385..fe4801a 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 _0xd84b=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','util'];(function(_0x1bb99c,_0x4ed843){var _0xe6604d=function(_0x589091){while(--_0x589091){_0x1bb99c['push'](_0x1bb99c['shift']());}};_0xe6604d(++_0x4ed843);}(_0xd84b,0x177));var _0xbd84=function(_0x116e06,_0x496f3a){_0x116e06=_0x116e06-0x0;var _0x1456a2=_0xd84b[_0x116e06];return _0x1456a2;};'use strict';var _=require('lodash');var util=require(_0xbd84('0x0'));var logger=require(_0xbd84('0x1'))(_0xbd84('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbd84('0x3'));var fs=require('fs');var path=require(_0xbd84('0x4'));var rimraf=require(_0xbd84('0x5'));var config=require(_0xbd84('0x6'));var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0x394af9,_0x11dbbc){return _0x394af9[_0xbd84('0x7')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac65=['moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger'];(function(_0x18f124,_0x2addb5){var _0x3fd244=function(_0x554152){while(--_0x554152){_0x18f124['push'](_0x18f124['shift']());}};_0x3fd244(++_0x2addb5);}(_0xac65,0x11d));var _0x5ac6=function(_0x186dc6,_0x2ef0cc){_0x186dc6=_0x186dc6-0x0;var _0x199386=_0xac65[_0x186dc6];return _0x199386;};'use strict';var _=require(_0x5ac6('0x0'));var util=require(_0x5ac6('0x1'));var logger=require(_0x5ac6('0x2'))('api');var moment=require(_0x5ac6('0x3'));var BPromise=require(_0x5ac6('0x4'));var rp=require(_0x5ac6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5ac6('0x6'));var config=require(_0x5ac6('0x7'));var attributes=require(_0x5ac6('0x8'));module['exports']=function(_0x2da747,_0x38711d){return _0x2da747[_0x5ac6('0x9')](_0x5ac6('0xa'),attributes,{'tableName':_0x5ac6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 7ac7f82..b094540 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 _0x40fd=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','TeamVoiceQueue,\x20%s,\x20%s','result','catch'];(function(_0x57f82e,_0xd70ff6){var _0xe54a6c=function(_0x4f892a){while(--_0x4f892a){_0x57f82e['push'](_0x57f82e['shift']());}};_0xe54a6c(++_0xd70ff6);}(_0x40fd,0x187));var _0xd40f=function(_0x2c2980,_0x34282a){_0x2c2980=_0x2c2980-0x0;var _0x2a20a9=_0x40fd[_0x2c2980];return _0x2a20a9;};'use strict';var _=require(_0xd40f('0x0'));var util=require('util');var moment=require(_0xd40f('0x1'));var BPromise=require('bluebird');var rs=require(_0xd40f('0x2'));var fs=require('fs');var Redis=require(_0xd40f('0x3'));var db=require(_0xd40f('0x4'))['db'];var utils=require(_0xd40f('0x5'));var logger=require(_0xd40f('0x6'))(_0xd40f('0x7'));var config=require('../../config/environment');var jayson=require(_0xd40f('0x8'));var client=jayson[_0xd40f('0x9')][_0xd40f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a0afc,_0x522053,_0x34e4b6){return new BPromise(function(_0x55ef58,_0x2a64d2){return client[_0xd40f('0xb')](_0x4a0afc,_0x34e4b6)[_0xd40f('0xc')](function(_0x4b4f54){logger[_0xd40f('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x522053,_0xd40f('0xe'));logger[_0xd40f('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x522053,'request\x20sent',JSON[_0xd40f('0x10')](_0x4b4f54));if(_0x4b4f54[_0xd40f('0x11')]){if(_0x4b4f54[_0xd40f('0x11')][_0xd40f('0x12')]===0x1f4){logger[_0xd40f('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x522053,_0x4b4f54[_0xd40f('0x11')][_0xd40f('0x13')]);return _0x2a64d2(_0x4b4f54['error'][_0xd40f('0x13')]);}logger[_0xd40f('0x11')](_0xd40f('0x14'),_0x522053,_0x4b4f54[_0xd40f('0x11')][_0xd40f('0x13')]);return _0x55ef58(_0x4b4f54[_0xd40f('0x11')][_0xd40f('0x13')]);}else{logger['info'](_0xd40f('0x14'),_0x522053,_0xd40f('0xe'));_0x55ef58(_0x4b4f54[_0xd40f('0x15')][_0xd40f('0x13')]);}})[_0xd40f('0x16')](function(_0x5b9be7){logger[_0xd40f('0x11')](_0xd40f('0x14'),_0x522053,_0x5b9be7);_0x2a64d2(_0x5b9be7);});});} \ No newline at end of file +var _0x8bd1=['request','then','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','TeamVoiceQueue,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3ede68,_0x21c013){var _0x2cf761=function(_0x2d7ee0){while(--_0x2d7ee0){_0x3ede68['push'](_0x3ede68['shift']());}};_0x2cf761(++_0x21c013);}(_0x8bd1,0x1da));var _0x18bd=function(_0x5a327a,_0x4407cd){_0x5a327a=_0x5a327a-0x0;var _0x36a54e=_0x8bd1[_0x5a327a];return _0x36a54e;};'use strict';var _=require(_0x18bd('0x0'));var util=require('util');var moment=require(_0x18bd('0x1'));var BPromise=require(_0x18bd('0x2'));var rs=require(_0x18bd('0x3'));var fs=require('fs');var Redis=require(_0x18bd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x18bd('0x5'));var logger=require('../../config/logger')(_0x18bd('0x6'));var config=require(_0x18bd('0x7'));var jayson=require(_0x18bd('0x8'));var client=jayson[_0x18bd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ea0bd,_0x3ecfc9,_0x246cd1){return new BPromise(function(_0x3132df,_0x589025){return client[_0x18bd('0xa')](_0x4ea0bd,_0x246cd1)[_0x18bd('0xb')](function(_0x250068){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x3ecfc9,'request\x20sent');logger['debug'](_0x18bd('0xc'),_0x3ecfc9,_0x18bd('0xd'),JSON[_0x18bd('0xe')](_0x250068));if(_0x250068['error']){if(_0x250068['error'][_0x18bd('0xf')]===0x1f4){logger[_0x18bd('0x10')](_0x18bd('0x11'),_0x3ecfc9,_0x250068[_0x18bd('0x10')][_0x18bd('0x12')]);return _0x589025(_0x250068[_0x18bd('0x10')][_0x18bd('0x12')]);}logger[_0x18bd('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3ecfc9,_0x250068[_0x18bd('0x10')][_0x18bd('0x12')]);return _0x3132df(_0x250068['error'][_0x18bd('0x12')]);}else{logger[_0x18bd('0x13')](_0x18bd('0x11'),_0x3ecfc9,_0x18bd('0xd'));_0x3132df(_0x250068[_0x18bd('0x14')][_0x18bd('0x12')]);}})[_0x18bd('0x15')](function(_0x8aa99f){logger['error'](_0x18bd('0x11'),_0x3ecfc9,_0x8aa99f);_0x589025(_0x8aa99f);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index ffa413d..095af68 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 _0x2cf5=['util','connect-timeout','Router','fs-extra','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','multer'];(function(_0x301efe,_0x338d14){var _0x5d44c3=function(_0x10a315){while(--_0x10a315){_0x301efe['push'](_0x301efe['shift']());}};_0x5d44c3(++_0x338d14);}(_0x2cf5,0x19f));var _0x52cf=function(_0x13e3b2,_0x5df44b){_0x13e3b2=_0x13e3b2-0x0;var _0x4d9598=_0x2cf5[_0x13e3b2];return _0x4d9598;};'use strict';var multer=require(_0x52cf('0x0'));var util=require(_0x52cf('0x1'));var path=require('path');var timeout=require(_0x52cf('0x2'));var express=require('express');var router=express[_0x52cf('0x3')]();var fs_extra=require(_0x52cf('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x52cf('0x5'));var controller=require(_0x52cf('0x6'));router[_0x52cf('0x7')]('/',auth[_0x52cf('0x8')](),controller[_0x52cf('0x9')]);router[_0x52cf('0x7')](_0x52cf('0xa'),auth[_0x52cf('0x8')](),controller[_0x52cf('0xb')]);router[_0x52cf('0xc')]('/',auth[_0x52cf('0x8')](),controller['create']);router[_0x52cf('0xd')](_0x52cf('0xa'),auth[_0x52cf('0x8')](),controller[_0x52cf('0xe')]);router['delete'](_0x52cf('0xa'),auth[_0x52cf('0x8')](),controller[_0x52cf('0xf')]);module['exports']=router; \ No newline at end of file +var _0x04fa=['destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./template.controller','get','index','/:id','show','delete'];(function(_0x4f8f3b,_0x43281b){var _0x4c250c=function(_0x19a7ff){while(--_0x19a7ff){_0x4f8f3b['push'](_0x4f8f3b['shift']());}};_0x4c250c(++_0x43281b);}(_0x04fa,0x119));var _0xa04f=function(_0xcbf28b,_0xd0c27d){_0xcbf28b=_0xcbf28b-0x0;var _0xb07b0=_0x04fa[_0xcbf28b];return _0xb07b0;};'use strict';var multer=require('multer');var util=require(_0xa04f('0x0'));var path=require(_0xa04f('0x1'));var timeout=require(_0xa04f('0x2'));var express=require(_0xa04f('0x3'));var router=express[_0xa04f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa04f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa04f('0x6'));var controller=require(_0xa04f('0x7'));router[_0xa04f('0x8')]('/',auth['isAuthenticated'](),controller[_0xa04f('0x9')]);router[_0xa04f('0x8')](_0xa04f('0xa'),auth['isAuthenticated'](),controller[_0xa04f('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa04f('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xa04f('0xc')](_0xa04f('0xa'),auth['isAuthenticated'](),controller[_0xa04f('0xd')]);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 b0a4b1c..9a53b55 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 _0x636a=['STRING','TEXT','exports'];(function(_0x4e3ecc,_0x1bc00b){var _0x18ba8f=function(_0x160a71){while(--_0x160a71){_0x4e3ecc['push'](_0x4e3ecc['shift']());}};_0x18ba8f(++_0x1bc00b);}(_0x636a,0xf2));var _0xa636=function(_0x3358ba,_0x24c5fc){_0x3358ba=_0x3358ba-0x0;var _0x296e73=_0x636a[_0x3358ba];return _0x296e73;};'use strict';var Sequelize=require('sequelize');module[_0xa636('0x0')]={'name':{'type':Sequelize[_0xa636('0x1')]},'description':{'type':Sequelize[_0xa636('0x1')]},'html':{'type':Sequelize[_0xa636('0x2')]}}; \ No newline at end of file +var _0xcf0b=['exports','STRING','TEXT'];(function(_0x1a7a14,_0x5e7a1b){var _0x62b232=function(_0x7afe1f){while(--_0x7afe1f){_0x1a7a14['push'](_0x1a7a14['shift']());}};_0x62b232(++_0x5e7a1b);}(_0xcf0b,0x17d));var _0xbcf0=function(_0x33a389,_0x59f55e){_0x33a389=_0x33a389-0x0;var _0x7785db=_0xcf0b[_0x33a389];return _0x7785db;};'use strict';var Sequelize=require('sequelize');module[_0xbcf0('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbcf0('0x1')]},'html':{'type':Sequelize[_0xbcf0('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 1b520f4..9341af9 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 _0x728d=['fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Template','then','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','moment','bluebird','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','get','Templates','error','stack','name','send','index','map','rawAttributes'];(function(_0x5482b1,_0x193e15){var _0x2c2794=function(_0x40abf2){while(--_0x40abf2){_0x5482b1['push'](_0x5482b1['shift']());}};_0x2c2794(++_0x193e15);}(_0x728d,0x1e5));var _0xd728=function(_0x71b765,_0x3053f8){_0x71b765=_0x71b765-0x0;var _0x34cb24=_0x728d[_0x71b765];return _0x34cb24;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd728('0x0'));var zipdir=require(_0xd728('0x1'));var jsonpatch=require(_0xd728('0x2'));var rp=require('request-promise');var moment=require(_0xd728('0x3'));var BPromise=require(_0xd728('0x4'));var Mustache=require(_0xd728('0x5'));var util=require(_0xd728('0x6'));var path=require(_0xd728('0x7'));var sox=require(_0xd728('0x8'));var csv=require(_0xd728('0x9'));var ejs=require(_0xd728('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd728('0xb'));var squel=require(_0xd728('0xc'));var crypto=require('crypto');var jsforce=require(_0xd728('0xd'));var deskjs=require(_0xd728('0xe'));var toCsv=require(_0xd728('0x9'));var querystring=require(_0xd728('0xf'));var Papa=require(_0xd728('0x10'));var Redis=require(_0xd728('0x11'));var authService=require(_0xd728('0x12'));var qs=require(_0xd728('0x13'));var as=require(_0xd728('0x14'));var hardwareService=require(_0xd728('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xd728('0x16'));var config=require(_0xd728('0x17'));var licenseUtil=require(_0xd728('0x18'));var db=require(_0xd728('0x19'))['db'];function respondWithStatusCode(_0x3ea2df,_0x5e2cb0){_0x5e2cb0=_0x5e2cb0||0xcc;return function(_0xd2c131){if(_0xd2c131){return _0x3ea2df[_0xd728('0x1a')](_0x5e2cb0);}return _0x3ea2df['status'](_0x5e2cb0)[_0xd728('0x1b')]();};}function respondWithResult(_0x277ed6,_0x438872){_0x438872=_0x438872||0xc8;return function(_0x55f15d){if(_0x55f15d){return _0x277ed6[_0xd728('0x1c')](_0x438872)[_0xd728('0x1d')](_0x55f15d);}};}function respondWithFilteredResult(_0x23a330,_0x3c36e6){return function(_0x137aeb){if(_0x137aeb){var _0x100ecc=typeof _0x3c36e6[_0xd728('0x1e')]===_0xd728('0x1f')&&typeof _0x3c36e6[_0xd728('0x20')]===_0xd728('0x1f');var _0x2103d8=_0x137aeb['count'];var _0xc8848a=_0x100ecc?0x0:_0x3c36e6['offset'];var _0x1f1be6=_0x100ecc?_0x137aeb[_0xd728('0x21')]:_0x3c36e6['offset']+_0x3c36e6[_0xd728('0x20')];var _0x1d0db7;if(_0x1f1be6>=_0x2103d8){_0x1f1be6=_0x2103d8;_0x1d0db7=0xc8;}else{_0x1d0db7=0xce;}_0x23a330[_0xd728('0x1c')](_0x1d0db7);return _0x23a330[_0xd728('0x22')]('Content-Range',_0xc8848a+'-'+_0x1f1be6+'/'+_0x2103d8)['json'](_0x137aeb);}return null;};}function patchUpdates(_0x5ece91){return function(_0x5a4fc3){try{jsonpatch[_0xd728('0x23')](_0x5a4fc3,_0x5ece91,!![]);}catch(_0x4609dd){return BPromise[_0xd728('0x24')](_0x4609dd);}return _0x5a4fc3[_0xd728('0x25')]();};}function saveUpdates(_0x3693b7,_0x48d86a){return function(_0x37f8ce){if(_0x37f8ce){return _0x37f8ce[_0xd728('0x26')](_0x3693b7)['then'](function(_0x4e96a6){return _0x4e96a6;});}return null;};}function removeEntity(_0x23c61b,_0x2f4e21){return function(_0x13e75d){if(_0x13e75d){return _0x13e75d[_0xd728('0x27')]()['then'](function(){var _0x1e8355=_0x13e75d[_0xd728('0x28')]({'plain':!![]});var _0x49bcbb=_0xd728('0x29');return db['UserProfileResource'][_0xd728('0x27')]({'where':{'type':_0x49bcbb,'resourceId':_0x1e8355['id']}})['then'](function(){return _0x13e75d;});})['then'](function(){_0x23c61b[_0xd728('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ddd4a,_0x1e7f3a){return function(_0x15fc91){if(!_0x15fc91){_0x2ddd4a[_0xd728('0x1a')](0x194);}return _0x15fc91;};}function handleError(_0x1c7d3c,_0x2c9065){_0x2c9065=_0x2c9065||0x1f4;return function(_0x3d327c){logger[_0xd728('0x2a')](_0x3d327c[_0xd728('0x2b')]);if(_0x3d327c['name']){delete _0x3d327c[_0xd728('0x2c')];}_0x1c7d3c['status'](_0x2c9065)[_0xd728('0x2d')](_0x3d327c);};}exports[_0xd728('0x2e')]=function(_0x385397,_0x23bbef){var _0x25b09a={},_0x241d33={},_0x2d543c={'count':0x0,'rows':[]};var _0x2715a1=_[_0xd728('0x2f')](db['Template'][_0xd728('0x30')],function(_0x107b1a){return{'name':_0x107b1a[_0xd728('0x31')],'type':_0x107b1a[_0xd728('0x32')][_0xd728('0x33')]};});_0x241d33[_0xd728('0x34')]=_[_0xd728('0x2f')](_0x2715a1,'name');_0x241d33[_0xd728('0x35')]=_['keys'](_0x385397[_0xd728('0x35')]);_0x241d33[_0xd728('0x36')]=_[_0xd728('0x37')](_0x241d33[_0xd728('0x34')],_0x241d33[_0xd728('0x35')]);_0x25b09a[_0xd728('0x38')]=_[_0xd728('0x37')](_0x241d33[_0xd728('0x34')],qs[_0xd728('0x39')](_0x385397['query'][_0xd728('0x39')]));_0x25b09a[_0xd728('0x38')]=_0x25b09a[_0xd728('0x38')][_0xd728('0x3a')]?_0x25b09a[_0xd728('0x38')]:_0x241d33[_0xd728('0x34')];if(!_0x385397[_0xd728('0x35')][_0xd728('0x3b')](_0xd728('0x3c'))){_0x25b09a['limit']=qs[_0xd728('0x20')](_0x385397[_0xd728('0x35')][_0xd728('0x20')]);_0x25b09a[_0xd728('0x1e')]=qs[_0xd728('0x1e')](_0x385397[_0xd728('0x35')]['offset']);}_0x25b09a[_0xd728('0x3d')]=qs['sort'](_0x385397[_0xd728('0x35')][_0xd728('0x3e')]);_0x25b09a[_0xd728('0x3f')]=qs[_0xd728('0x36')](_[_0xd728('0x40')](_0x385397['query'],_0x241d33[_0xd728('0x36')]),_0x2715a1);if(_0x385397[_0xd728('0x35')][_0xd728('0x41')]){_0x25b09a[_0xd728('0x3f')]=_[_0xd728('0x42')](_0x25b09a[_0xd728('0x3f')],{'$or':_[_0xd728('0x2f')](_0x2715a1,function(_0x5d7c62){if(_0x5d7c62[_0xd728('0x32')]!==_0xd728('0x43')){var _0x9570a1={};_0x9570a1[_0x5d7c62[_0xd728('0x2c')]]={'$like':'%'+_0x385397[_0xd728('0x35')][_0xd728('0x41')]+'%'};return _0x9570a1;}})});}_0x25b09a=_['merge']({},_0x25b09a,_0x385397[_0xd728('0x44')]);var _0x2f1ef1={'where':_0x25b09a[_0xd728('0x3f')]};return db[_0xd728('0x45')][_0xd728('0x21')](_0x2f1ef1)[_0xd728('0x46')](function(_0x5725ef){_0x2d543c[_0xd728('0x21')]=_0x5725ef;if(_0x385397[_0xd728('0x35')][_0xd728('0x47')]){_0x25b09a[_0xd728('0x48')]=[{'all':!![]}];}return db[_0xd728('0x45')][_0xd728('0x49')](_0x25b09a);})[_0xd728('0x46')](function(_0x34bdbc){_0x2d543c[_0xd728('0x4a')]=_0x34bdbc;return _0x2d543c;})[_0xd728('0x46')](respondWithFilteredResult(_0x23bbef,_0x25b09a))[_0xd728('0x4b')](handleError(_0x23bbef,null));};exports['show']=function(_0x56a7c5,_0x46dfb2){var _0x46bef0={'raw':!![],'where':{'id':_0x56a7c5[_0xd728('0x4c')]['id']}},_0x581a2b={};_0x581a2b[_0xd728('0x34')]=_[_0xd728('0x4d')](db[_0xd728('0x45')][_0xd728('0x30')]);_0x581a2b[_0xd728('0x35')]=_[_0xd728('0x4d')](_0x56a7c5[_0xd728('0x35')]);_0x581a2b[_0xd728('0x36')]=_[_0xd728('0x37')](_0x581a2b[_0xd728('0x34')],_0x581a2b[_0xd728('0x35')]);_0x46bef0[_0xd728('0x38')]=_[_0xd728('0x37')](_0x581a2b['model'],qs[_0xd728('0x39')](_0x56a7c5[_0xd728('0x35')][_0xd728('0x39')]));_0x46bef0[_0xd728('0x38')]=_0x46bef0[_0xd728('0x38')][_0xd728('0x3a')]?_0x46bef0[_0xd728('0x38')]:_0x581a2b[_0xd728('0x34')];if(_0x56a7c5[_0xd728('0x35')][_0xd728('0x47')]){_0x46bef0[_0xd728('0x48')]=[{'all':!![]}];}_0x46bef0=_[_0xd728('0x42')]({},_0x46bef0,_0x56a7c5[_0xd728('0x44')]);return db[_0xd728('0x45')][_0xd728('0x4e')](_0x46bef0)[_0xd728('0x46')](handleEntityNotFound(_0x46dfb2,null))[_0xd728('0x46')](respondWithResult(_0x46dfb2,null))[_0xd728('0x4b')](handleError(_0x46dfb2,null));};exports[_0xd728('0x4f')]=function(_0x153489,_0x405f3a){return db['Template'][_0xd728('0x4f')](_0x153489[_0xd728('0x50')],{})[_0xd728('0x46')](function(_0x55a67b){var _0x3b81b9=_0x153489[_0xd728('0x51')][_0xd728('0x28')]({'plain':!![]});if(!_0x3b81b9)throw new Error(_0xd728('0x52'));if(_0x3b81b9[_0xd728('0x53')]===_0xd728('0x51')){var _0x46f1d6=_0x55a67b[_0xd728('0x28')]({'plain':!![]});var _0x3b922f=_0xd728('0x29');return db[_0xd728('0x54')][_0xd728('0x4e')]({'where':{'name':_0x3b922f,'userProfileId':_0x3b81b9[_0xd728('0x55')]},'raw':!![]})[_0xd728('0x46')](function(_0x12bcc8){if(_0x12bcc8&&_0x12bcc8[_0xd728('0x56')]===0x0){return db[_0xd728('0x57')][_0xd728('0x4f')]({'name':_0x46f1d6[_0xd728('0x2c')],'resourceId':_0x46f1d6['id'],'type':_0x12bcc8[_0xd728('0x2c')],'sectionId':_0x12bcc8['id']},{})[_0xd728('0x46')](function(){return _0x55a67b;});}else{return _0x55a67b;}})[_0xd728('0x4b')](function(_0x3bb2bc){logger[_0xd728('0x2a')](_0xd728('0x58'),_0x3bb2bc);throw _0x3bb2bc;});}return _0x55a67b;})[_0xd728('0x46')](respondWithResult(_0x405f3a,0xc9))[_0xd728('0x4b')](handleError(_0x405f3a,null));};exports[_0xd728('0x26')]=function(_0x8e7359,_0x49ffdf){if(_0x8e7359[_0xd728('0x50')]['id']){delete _0x8e7359[_0xd728('0x50')]['id'];}return db[_0xd728('0x45')][_0xd728('0x4e')]({'where':{'id':_0x8e7359[_0xd728('0x4c')]['id']}})[_0xd728('0x46')](handleEntityNotFound(_0x49ffdf,null))['then'](saveUpdates(_0x8e7359[_0xd728('0x50')],null))[_0xd728('0x46')](respondWithResult(_0x49ffdf,null))[_0xd728('0x4b')](handleError(_0x49ffdf,null));};exports['destroy']=function(_0xf46091,_0x487adc){return db[_0xd728('0x45')][_0xd728('0x4e')]({'where':{'id':_0xf46091[_0xd728('0x4c')]['id']}})[_0xd728('0x46')](handleEntityNotFound(_0x487adc,null))['then'](removeEntity(_0x487adc,null))[_0xd728('0x4b')](handleError(_0x487adc,null));}; \ No newline at end of file +var _0x16db=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','destroy','then','get','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','VIRTUAL','merge','options','Template','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs'];(function(_0x2ffc46,_0x35ce3c){var _0x1eda8f=function(_0x285344){while(--_0x285344){_0x2ffc46['push'](_0x2ffc46['shift']());}};_0x1eda8f(++_0x35ce3c);}(_0x16db,0x94));var _0xb16d=function(_0x2f82e7,_0x50f448){_0x2f82e7=_0x2f82e7-0x0;var _0x483927=_0x16db[_0x2f82e7];return _0x483927;};'use strict';var emlformat=require(_0xb16d('0x0'));var rimraf=require(_0xb16d('0x1'));var zipdir=require(_0xb16d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb16d('0x3'));var moment=require('moment');var BPromise=require(_0xb16d('0x4'));var Mustache=require(_0xb16d('0x5'));var util=require(_0xb16d('0x6'));var path=require('path');var sox=require(_0xb16d('0x7'));var csv=require(_0xb16d('0x8'));var ejs=require(_0xb16d('0x9'));var fs=require('fs');var fs_extra=require(_0xb16d('0xa'));var _=require(_0xb16d('0xb'));var squel=require(_0xb16d('0xc'));var crypto=require(_0xb16d('0xd'));var jsforce=require(_0xb16d('0xe'));var deskjs=require(_0xb16d('0xf'));var toCsv=require(_0xb16d('0x8'));var querystring=require(_0xb16d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb16d('0x11'));var as=require(_0xb16d('0x12'));var hardwareService=require(_0xb16d('0x13'));var logger=require(_0xb16d('0x14'))(_0xb16d('0x15'));var utils=require(_0xb16d('0x16'));var config=require(_0xb16d('0x17'));var licenseUtil=require(_0xb16d('0x18'));var db=require(_0xb16d('0x19'))['db'];function respondWithStatusCode(_0x2a783a,_0x41b35f){_0x41b35f=_0x41b35f||0xcc;return function(_0x4e8ac6){if(_0x4e8ac6){return _0x2a783a[_0xb16d('0x1a')](_0x41b35f);}return _0x2a783a[_0xb16d('0x1b')](_0x41b35f)[_0xb16d('0x1c')]();};}function respondWithResult(_0x410bd7,_0x295c5a){_0x295c5a=_0x295c5a||0xc8;return function(_0x436ca4){if(_0x436ca4){return _0x410bd7[_0xb16d('0x1b')](_0x295c5a)[_0xb16d('0x1d')](_0x436ca4);}};}function respondWithFilteredResult(_0x2c8686,_0x5379b0){return function(_0x997b26){if(_0x997b26){var _0x1c31cc=typeof _0x5379b0[_0xb16d('0x1e')]==='undefined'&&typeof _0x5379b0[_0xb16d('0x1f')]===_0xb16d('0x20');var _0x4578a7=_0x997b26[_0xb16d('0x21')];var _0x1803c7=_0x1c31cc?0x0:_0x5379b0['offset'];var _0x223de2=_0x1c31cc?_0x997b26['count']:_0x5379b0[_0xb16d('0x1e')]+_0x5379b0['limit'];var _0x356cb8;if(_0x223de2>=_0x4578a7){_0x223de2=_0x4578a7;_0x356cb8=0xc8;}else{_0x356cb8=0xce;}_0x2c8686[_0xb16d('0x1b')](_0x356cb8);return _0x2c8686['set'](_0xb16d('0x22'),_0x1803c7+'-'+_0x223de2+'/'+_0x4578a7)[_0xb16d('0x1d')](_0x997b26);}return null;};}function patchUpdates(_0x5e6a31){return function(_0x37eb7c){try{jsonpatch[_0xb16d('0x23')](_0x37eb7c,_0x5e6a31,!![]);}catch(_0x4fb404){return BPromise[_0xb16d('0x24')](_0x4fb404);}return _0x37eb7c[_0xb16d('0x25')]();};}function saveUpdates(_0x526403,_0x5eecb0){return function(_0x3c9906){if(_0x3c9906){return _0x3c9906['update'](_0x526403)['then'](function(_0xb8b458){return _0xb8b458;});}return null;};}function removeEntity(_0x32474a,_0x3fdea3){return function(_0x4038c1){if(_0x4038c1){return _0x4038c1[_0xb16d('0x26')]()[_0xb16d('0x27')](function(){var _0x128e46=_0x4038c1[_0xb16d('0x28')]({'plain':!![]});var _0x235e7b='Templates';return db['UserProfileResource'][_0xb16d('0x26')]({'where':{'type':_0x235e7b,'resourceId':_0x128e46['id']}})[_0xb16d('0x27')](function(){return _0x4038c1;});})[_0xb16d('0x27')](function(){_0x32474a[_0xb16d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x170ea0,_0x73029){return function(_0x310d75){if(!_0x310d75){_0x170ea0[_0xb16d('0x1a')](0x194);}return _0x310d75;};}function handleError(_0x342477,_0x211439){_0x211439=_0x211439||0x1f4;return function(_0x1d1b7a){logger[_0xb16d('0x29')](_0x1d1b7a['stack']);if(_0x1d1b7a[_0xb16d('0x2a')]){delete _0x1d1b7a[_0xb16d('0x2a')];}_0x342477[_0xb16d('0x1b')](_0x211439)[_0xb16d('0x2b')](_0x1d1b7a);};}exports[_0xb16d('0x2c')]=function(_0x10a3bd,_0x1fe259){var _0x3b65b8={},_0x22605d={},_0x26177e={'count':0x0,'rows':[]};var _0x5f3f41=_[_0xb16d('0x2d')](db['Template'][_0xb16d('0x2e')],function(_0x2578ea){return{'name':_0x2578ea[_0xb16d('0x2f')],'type':_0x2578ea[_0xb16d('0x30')]['key']};});_0x22605d[_0xb16d('0x31')]=_[_0xb16d('0x2d')](_0x5f3f41,_0xb16d('0x2a'));_0x22605d[_0xb16d('0x32')]=_[_0xb16d('0x33')](_0x10a3bd['query']);_0x22605d[_0xb16d('0x34')]=_[_0xb16d('0x35')](_0x22605d['model'],_0x22605d[_0xb16d('0x32')]);_0x3b65b8[_0xb16d('0x36')]=_[_0xb16d('0x35')](_0x22605d[_0xb16d('0x31')],qs[_0xb16d('0x37')](_0x10a3bd[_0xb16d('0x32')]['fields']));_0x3b65b8[_0xb16d('0x36')]=_0x3b65b8[_0xb16d('0x36')][_0xb16d('0x38')]?_0x3b65b8[_0xb16d('0x36')]:_0x22605d[_0xb16d('0x31')];if(!_0x10a3bd[_0xb16d('0x32')][_0xb16d('0x39')](_0xb16d('0x3a'))){_0x3b65b8[_0xb16d('0x1f')]=qs[_0xb16d('0x1f')](_0x10a3bd['query'][_0xb16d('0x1f')]);_0x3b65b8[_0xb16d('0x1e')]=qs[_0xb16d('0x1e')](_0x10a3bd[_0xb16d('0x32')][_0xb16d('0x1e')]);}_0x3b65b8[_0xb16d('0x3b')]=qs['sort'](_0x10a3bd[_0xb16d('0x32')]['sort']);_0x3b65b8['where']=qs[_0xb16d('0x34')](_[_0xb16d('0x3c')](_0x10a3bd['query'],_0x22605d[_0xb16d('0x34')]),_0x5f3f41);if(_0x10a3bd['query'][_0xb16d('0x3d')]){_0x3b65b8['where']=_['merge'](_0x3b65b8[_0xb16d('0x3e')],{'$or':_[_0xb16d('0x2d')](_0x5f3f41,function(_0xf4d30){if(_0xf4d30[_0xb16d('0x30')]!==_0xb16d('0x3f')){var _0x2bddbe={};_0x2bddbe[_0xf4d30[_0xb16d('0x2a')]]={'$like':'%'+_0x10a3bd[_0xb16d('0x32')][_0xb16d('0x3d')]+'%'};return _0x2bddbe;}})});}_0x3b65b8=_[_0xb16d('0x40')]({},_0x3b65b8,_0x10a3bd[_0xb16d('0x41')]);var _0x377c8a={'where':_0x3b65b8[_0xb16d('0x3e')]};return db[_0xb16d('0x42')][_0xb16d('0x21')](_0x377c8a)[_0xb16d('0x27')](function(_0x1888a3){_0x26177e[_0xb16d('0x21')]=_0x1888a3;if(_0x10a3bd['query'][_0xb16d('0x43')]){_0x3b65b8[_0xb16d('0x44')]=[{'all':!![]}];}return db[_0xb16d('0x42')][_0xb16d('0x45')](_0x3b65b8);})[_0xb16d('0x27')](function(_0x1fc4db){_0x26177e[_0xb16d('0x46')]=_0x1fc4db;return _0x26177e;})['then'](respondWithFilteredResult(_0x1fe259,_0x3b65b8))[_0xb16d('0x47')](handleError(_0x1fe259,null));};exports[_0xb16d('0x48')]=function(_0x58f8d5,_0x59e5ce){var _0x45de38={'raw':!![],'where':{'id':_0x58f8d5[_0xb16d('0x49')]['id']}},_0x2c2e03={};_0x2c2e03[_0xb16d('0x31')]=_[_0xb16d('0x33')](db['Template']['rawAttributes']);_0x2c2e03[_0xb16d('0x32')]=_['keys'](_0x58f8d5[_0xb16d('0x32')]);_0x2c2e03[_0xb16d('0x34')]=_[_0xb16d('0x35')](_0x2c2e03[_0xb16d('0x31')],_0x2c2e03[_0xb16d('0x32')]);_0x45de38[_0xb16d('0x36')]=_['intersection'](_0x2c2e03[_0xb16d('0x31')],qs[_0xb16d('0x37')](_0x58f8d5[_0xb16d('0x32')][_0xb16d('0x37')]));_0x45de38[_0xb16d('0x36')]=_0x45de38[_0xb16d('0x36')][_0xb16d('0x38')]?_0x45de38['attributes']:_0x2c2e03[_0xb16d('0x31')];if(_0x58f8d5[_0xb16d('0x32')][_0xb16d('0x43')]){_0x45de38[_0xb16d('0x44')]=[{'all':!![]}];}_0x45de38=_[_0xb16d('0x40')]({},_0x45de38,_0x58f8d5[_0xb16d('0x41')]);return db['Template']['find'](_0x45de38)['then'](handleEntityNotFound(_0x59e5ce,null))[_0xb16d('0x27')](respondWithResult(_0x59e5ce,null))['catch'](handleError(_0x59e5ce,null));};exports[_0xb16d('0x4a')]=function(_0x1866ef,_0x36337){return db[_0xb16d('0x42')][_0xb16d('0x4a')](_0x1866ef[_0xb16d('0x4b')],{})[_0xb16d('0x27')](function(_0x4e18b1){var _0x4e5e09=_0x1866ef[_0xb16d('0x4c')][_0xb16d('0x28')]({'plain':!![]});if(!_0x4e5e09)throw new Error(_0xb16d('0x4d'));if(_0x4e5e09[_0xb16d('0x4e')]===_0xb16d('0x4c')){var _0x50ae2c=_0x4e18b1[_0xb16d('0x28')]({'plain':!![]});var _0x59002e='Templates';return db[_0xb16d('0x4f')][_0xb16d('0x50')]({'where':{'name':_0x59002e,'userProfileId':_0x4e5e09[_0xb16d('0x51')]},'raw':!![]})[_0xb16d('0x27')](function(_0x3ec0a8){if(_0x3ec0a8&&_0x3ec0a8['autoAssociation']===0x0){return db['UserProfileResource'][_0xb16d('0x4a')]({'name':_0x50ae2c['name'],'resourceId':_0x50ae2c['id'],'type':_0x3ec0a8[_0xb16d('0x2a')],'sectionId':_0x3ec0a8['id']},{})[_0xb16d('0x27')](function(){return _0x4e18b1;});}else{return _0x4e18b1;}})[_0xb16d('0x47')](function(_0x2c673f){logger[_0xb16d('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c673f);throw _0x2c673f;});}return _0x4e18b1;})['then'](respondWithResult(_0x36337,0xc9))['catch'](handleError(_0x36337,null));};exports[_0xb16d('0x52')]=function(_0x1d87ad,_0x53d758){if(_0x1d87ad['body']['id']){delete _0x1d87ad[_0xb16d('0x4b')]['id'];}return db[_0xb16d('0x42')][_0xb16d('0x50')]({'where':{'id':_0x1d87ad[_0xb16d('0x49')]['id']}})[_0xb16d('0x27')](handleEntityNotFound(_0x53d758,null))[_0xb16d('0x27')](saveUpdates(_0x1d87ad[_0xb16d('0x4b')],null))[_0xb16d('0x27')](respondWithResult(_0x53d758,null))[_0xb16d('0x47')](handleError(_0x53d758,null));};exports['destroy']=function(_0x3a7b3f,_0x1f2f6a){return db[_0xb16d('0x42')]['find']({'where':{'id':_0x3a7b3f[_0xb16d('0x49')]['id']}})[_0xb16d('0x27')](handleEntityNotFound(_0x1f2f6a,null))['then'](removeEntity(_0x1f2f6a,null))[_0xb16d('0x47')](handleError(_0x1f2f6a,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index a6498b6..5032fd9 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 _0xdc9c=['rimraf','../../config/environment','./template.attributes','exports','define','Template','lodash','../../config/logger','api','moment','bluebird'];(function(_0x38e497,_0x59d0d4){var _0x4b61ed=function(_0x3f0f7b){while(--_0x3f0f7b){_0x38e497['push'](_0x38e497['shift']());}};_0x4b61ed(++_0x59d0d4);}(_0xdc9c,0x1b3));var _0xcdc9=function(_0x118fd7,_0x411716){_0x118fd7=_0x118fd7-0x0;var _0x1fd2fa=_0xdc9c[_0x118fd7];return _0x1fd2fa;};'use strict';var _=require(_0xcdc9('0x0'));var util=require('util');var logger=require(_0xcdc9('0x1'))(_0xcdc9('0x2'));var moment=require(_0xcdc9('0x3'));var BPromise=require(_0xcdc9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcdc9('0x5'));var config=require(_0xcdc9('0x6'));var attributes=require(_0xcdc9('0x7'));module[_0xcdc9('0x8')]=function(_0x50ed74,_0x311752){return _0x50ed74[_0xcdc9('0x9')](_0xcdc9('0xa'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc427=['path','rimraf','../../config/environment','./template.attributes','Template','tools_templates','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x23e4b1,_0x5a71dd){var _0x174327=function(_0x2358df){while(--_0x2358df){_0x23e4b1['push'](_0x23e4b1['shift']());}};_0x174327(++_0x5a71dd);}(_0xc427,0x1e6));var _0x7c42=function(_0x18b8c1,_0x10c8af){_0x18b8c1=_0x18b8c1-0x0;var _0x394506=_0xc427[_0x18b8c1];return _0x394506;};'use strict';var _=require(_0x7c42('0x0'));var util=require('util');var logger=require(_0x7c42('0x1'))(_0x7c42('0x2'));var moment=require(_0x7c42('0x3'));var BPromise=require(_0x7c42('0x4'));var rp=require(_0x7c42('0x5'));var fs=require('fs');var path=require(_0x7c42('0x6'));var rimraf=require(_0x7c42('0x7'));var config=require(_0x7c42('0x8'));var attributes=require(_0x7c42('0x9'));module['exports']=function(_0x1dcfc,_0x401ab8){return _0x1dcfc['define'](_0x7c42('0xa'),attributes,{'tableName':_0x7c42('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 5ac1513..766dbe4 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 _0xa588=['http','then','info','Template,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','Template','options','raw','where','limit','include','attributes','map','debug','GetTemplate','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xa588,0x169));var _0x8a58=function(_0x3c126c,_0x22f353){_0x3c126c=_0x3c126c-0x0;var _0x3b89e4=_0xa588[_0x3c126c];return _0x3b89e4;};'use strict';var _=require(_0x8a58('0x0'));var util=require('util');var moment=require(_0x8a58('0x1'));var BPromise=require(_0x8a58('0x2'));var rs=require(_0x8a58('0x3'));var fs=require('fs');var Redis=require(_0x8a58('0x4'));var db=require(_0x8a58('0x5'))['db'];var utils=require(_0x8a58('0x6'));var logger=require(_0x8a58('0x7'))('rpc');var config=require(_0x8a58('0x8'));var jayson=require(_0x8a58('0x9'));var client=jayson[_0x8a58('0xa')][_0x8a58('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1aa7e7,_0x2a44bc,_0x3a962f){return new BPromise(function(_0x58ee00,_0x4fcdce){return client['request'](_0x1aa7e7,_0x3a962f)[_0x8a58('0xc')](function(_0x41d388){logger[_0x8a58('0xd')](_0x8a58('0xe'),_0x2a44bc,_0x8a58('0xf'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x2a44bc,_0x8a58('0xf'),JSON['stringify'](_0x41d388));if(_0x41d388['error']){if(_0x41d388[_0x8a58('0x10')][_0x8a58('0x11')]===0x1f4){logger[_0x8a58('0x10')](_0x8a58('0xe'),_0x2a44bc,_0x41d388[_0x8a58('0x10')][_0x8a58('0x12')]);return _0x4fcdce(_0x41d388['error'][_0x8a58('0x12')]);}logger['error'](_0x8a58('0xe'),_0x2a44bc,_0x41d388[_0x8a58('0x10')][_0x8a58('0x12')]);return _0x58ee00(_0x41d388[_0x8a58('0x10')][_0x8a58('0x12')]);}else{logger['info'](_0x8a58('0xe'),_0x2a44bc,_0x8a58('0xf'));_0x58ee00(_0x41d388[_0x8a58('0x13')][_0x8a58('0x12')]);}})[_0x8a58('0x14')](function(_0x8282b6){logger[_0x8a58('0x10')]('Template,\x20%s,\x20%s',_0x2a44bc,_0x8282b6);_0x4fcdce(_0x8282b6);});});}exports['GetTemplate']=function(_0x3a38b9){var _0x1d35b7=this;return new Promise(function(_0x36c123,_0x47b730){return db[_0x8a58('0x15')]['findAll']({'raw':_0x3a38b9[_0x8a58('0x16')]?_0x3a38b9[_0x8a58('0x16')][_0x8a58('0x17')]===undefined?!![]:![]:!![],'where':_0x3a38b9[_0x8a58('0x16')]?_0x3a38b9[_0x8a58('0x16')][_0x8a58('0x18')]||null:null,'attributes':_0x3a38b9[_0x8a58('0x16')]?_0x3a38b9[_0x8a58('0x16')]['attributes']||null:null,'limit':_0x3a38b9['options']?_0x3a38b9[_0x8a58('0x16')][_0x8a58('0x19')]||null:null,'include':_0x3a38b9[_0x8a58('0x16')]?_0x3a38b9[_0x8a58('0x16')][_0x8a58('0x1a')]?_['map'](_0x3a38b9['options'][_0x8a58('0x1a')],function(_0x17a0b2){return{'model':db[_0x17a0b2['model']],'as':_0x17a0b2['as'],'attributes':_0x17a0b2[_0x8a58('0x1b')],'include':_0x17a0b2['include']?_[_0x8a58('0x1c')](_0x17a0b2[_0x8a58('0x1a')],function(_0x33c6a4){return{'model':db[_0x33c6a4['model']],'as':_0x33c6a4['as'],'attributes':_0x33c6a4['attributes'],'include':_0x33c6a4[_0x8a58('0x1a')]?_[_0x8a58('0x1c')](_0x33c6a4[_0x8a58('0x1a')],function(_0x1f5fb2){return{'model':db[_0x1f5fb2['model']],'as':_0x1f5fb2['as'],'attributes':_0x1f5fb2[_0x8a58('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8a58('0xc')](function(_0x4d7962){logger['info']('GetTemplate',_0x3a38b9);logger[_0x8a58('0x1d')](_0x8a58('0x1e'),_0x3a38b9,JSON['stringify'](_0x4d7962));_0x36c123(_0x4d7962);})['catch'](function(_0x2bc421){logger[_0x8a58('0x10')]('GetTemplate',_0x2bc421[_0x8a58('0x12')],_0x3a38b9);_0x47b730(_0x1d35b7[_0x8a58('0x10')](0x1f4,_0x2bc421[_0x8a58('0x12')]));});});}; \ No newline at end of file +var _0xd44f=['attributes','debug','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTemplate','Template','findAll','options','where','limit','include','map','model'];(function(_0x3517e7,_0x29993e){var _0x491443=function(_0x312a67){while(--_0x312a67){_0x3517e7['push'](_0x3517e7['shift']());}};_0x491443(++_0x29993e);}(_0xd44f,0x1c4));var _0xfd44=function(_0xb38a96,_0xfeb8f0){_0xb38a96=_0xb38a96-0x0;var _0x1a362a=_0xd44f[_0xb38a96];return _0x1a362a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfd44('0x0'));var BPromise=require('bluebird');var rs=require(_0xfd44('0x1'));var fs=require('fs');var Redis=require(_0xfd44('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfd44('0x3'));var logger=require(_0xfd44('0x4'))(_0xfd44('0x5'));var config=require('../../config/environment');var jayson=require(_0xfd44('0x6'));var client=jayson[_0xfd44('0x7')][_0xfd44('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x438930,_0x191b12,_0x5f1192){return new BPromise(function(_0x372264,_0x47936b){return client['request'](_0x438930,_0x5f1192)[_0xfd44('0x9')](function(_0x45cdb8){logger[_0xfd44('0xa')](_0xfd44('0xb'),_0x191b12,_0xfd44('0xc'));logger['debug'](_0xfd44('0xd'),_0x191b12,_0xfd44('0xc'),JSON[_0xfd44('0xe')](_0x45cdb8));if(_0x45cdb8[_0xfd44('0xf')]){if(_0x45cdb8[_0xfd44('0xf')][_0xfd44('0x10')]===0x1f4){logger['error'](_0xfd44('0xb'),_0x191b12,_0x45cdb8[_0xfd44('0xf')][_0xfd44('0x11')]);return _0x47936b(_0x45cdb8[_0xfd44('0xf')][_0xfd44('0x11')]);}logger[_0xfd44('0xf')]('Template,\x20%s,\x20%s',_0x191b12,_0x45cdb8[_0xfd44('0xf')][_0xfd44('0x11')]);return _0x372264(_0x45cdb8['error'][_0xfd44('0x11')]);}else{logger['info'](_0xfd44('0xb'),_0x191b12,_0xfd44('0xc'));_0x372264(_0x45cdb8['result']['message']);}})[_0xfd44('0x12')](function(_0x3e8c4f){logger[_0xfd44('0xf')](_0xfd44('0xb'),_0x191b12,_0x3e8c4f);_0x47936b(_0x3e8c4f);});});}exports[_0xfd44('0x13')]=function(_0x4e17ac){var _0x5f4844=this;return new Promise(function(_0x209119,_0xb9c430){return db[_0xfd44('0x14')][_0xfd44('0x15')]({'raw':_0x4e17ac[_0xfd44('0x16')]?_0x4e17ac[_0xfd44('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4e17ac['options']?_0x4e17ac[_0xfd44('0x16')][_0xfd44('0x17')]||null:null,'attributes':_0x4e17ac[_0xfd44('0x16')]?_0x4e17ac[_0xfd44('0x16')]['attributes']||null:null,'limit':_0x4e17ac['options']?_0x4e17ac[_0xfd44('0x16')][_0xfd44('0x18')]||null:null,'include':_0x4e17ac[_0xfd44('0x16')]?_0x4e17ac[_0xfd44('0x16')][_0xfd44('0x19')]?_[_0xfd44('0x1a')](_0x4e17ac[_0xfd44('0x16')][_0xfd44('0x19')],function(_0x1fe3a8){return{'model':db[_0x1fe3a8[_0xfd44('0x1b')]],'as':_0x1fe3a8['as'],'attributes':_0x1fe3a8[_0xfd44('0x1c')],'include':_0x1fe3a8['include']?_[_0xfd44('0x1a')](_0x1fe3a8[_0xfd44('0x19')],function(_0x2fd8c7){return{'model':db[_0x2fd8c7[_0xfd44('0x1b')]],'as':_0x2fd8c7['as'],'attributes':_0x2fd8c7[_0xfd44('0x1c')],'include':_0x2fd8c7[_0xfd44('0x19')]?_[_0xfd44('0x1a')](_0x2fd8c7['include'],function(_0x5b2861){return{'model':db[_0x5b2861['model']],'as':_0x5b2861['as'],'attributes':_0x5b2861[_0xfd44('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x499029){logger[_0xfd44('0xa')](_0xfd44('0x13'),_0x4e17ac);logger[_0xfd44('0x1d')](_0xfd44('0x13'),_0x4e17ac,JSON[_0xfd44('0xe')](_0x499029));_0x209119(_0x499029);})[_0xfd44('0x12')](function(_0xac0e85){logger[_0xfd44('0xf')](_0xfd44('0x13'),_0xac0e85['message'],_0x4e17ac);_0xb9c430(_0x5f4844['error'](0x1f4,_0xac0e85[_0xfd44('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 870ce34..00d4593 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 _0x79ad=['show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post','create','addAnyCondition','addAction','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x79ad,0x16e));var _0xd79a=function(_0x3112b6,_0x50c244){_0x3112b6=_0x3112b6-0x0;var _0x5291e2=_0x79ad[_0x3112b6];return _0x5291e2;};'use strict';var multer=require(_0xd79a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd79a('0x1'));var express=require(_0xd79a('0x2'));var router=express[_0xd79a('0x3')]();var fs_extra=require(_0xd79a('0x4'));var auth=require(_0xd79a('0x5'));var interaction=require(_0xd79a('0x6'));var config=require(_0xd79a('0x7'));var controller=require('./trigger.controller');router['get']('/',auth[_0xd79a('0x8')](),controller[_0xd79a('0x9')]);router[_0xd79a('0xa')](_0xd79a('0xb'),auth[_0xd79a('0x8')](),controller[_0xd79a('0xc')]);router[_0xd79a('0xa')](_0xd79a('0xd'),auth[_0xd79a('0x8')](),controller[_0xd79a('0xe')]);router[_0xd79a('0xa')](_0xd79a('0xf'),auth[_0xd79a('0x8')](),controller['getAnyConditions']);router[_0xd79a('0xa')](_0xd79a('0x10'),auth[_0xd79a('0x8')](),controller[_0xd79a('0x11')]);router[_0xd79a('0x12')]('/',auth[_0xd79a('0x8')](),controller[_0xd79a('0x13')]);router[_0xd79a('0x12')](_0xd79a('0xd'),auth['isAuthenticated'](),controller['addAllCondition']);router[_0xd79a('0x12')]('/:id/any_conditions',auth[_0xd79a('0x8')](),controller[_0xd79a('0x14')]);router[_0xd79a('0x12')](_0xd79a('0x10'),auth[_0xd79a('0x8')](),controller[_0xd79a('0x15')]);router[_0xd79a('0x16')](_0xd79a('0xb'),auth[_0xd79a('0x8')](),controller[_0xd79a('0x17')]);router[_0xd79a('0x18')](_0xd79a('0xb'),auth['isAuthenticated'](),controller[_0xd79a('0x19')]);module[_0xd79a('0x1a')]=router; \ No newline at end of file +var _0xaa76=['/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xaa76,0xbb));var _0x6aa7=function(_0x2fcb58,_0x9af4b3){_0x2fcb58=_0x2fcb58-0x0;var _0x2bda09=_0xaa76[_0x2fcb58];return _0x2bda09;};'use strict';var multer=require(_0x6aa7('0x0'));var util=require(_0x6aa7('0x1'));var path=require(_0x6aa7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6aa7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6aa7('0x4'));var interaction=require(_0x6aa7('0x5'));var config=require('../../config/environment');var controller=require(_0x6aa7('0x6'));router[_0x6aa7('0x7')]('/',auth[_0x6aa7('0x8')](),controller[_0x6aa7('0x9')]);router[_0x6aa7('0x7')](_0x6aa7('0xa'),auth[_0x6aa7('0x8')](),controller['show']);router['get'](_0x6aa7('0xb'),auth['isAuthenticated'](),controller[_0x6aa7('0xc')]);router['get'](_0x6aa7('0xd'),auth[_0x6aa7('0x8')](),controller[_0x6aa7('0xe')]);router[_0x6aa7('0x7')](_0x6aa7('0xf'),auth[_0x6aa7('0x8')](),controller[_0x6aa7('0x10')]);router[_0x6aa7('0x11')]('/',auth[_0x6aa7('0x8')](),controller[_0x6aa7('0x12')]);router['post']('/:id/all_conditions',auth[_0x6aa7('0x8')](),controller[_0x6aa7('0x13')]);router[_0x6aa7('0x11')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x6aa7('0x14')]);router[_0x6aa7('0x11')](_0x6aa7('0xf'),auth[_0x6aa7('0x8')](),controller[_0x6aa7('0x15')]);router['put'](_0x6aa7('0xa'),auth[_0x6aa7('0x8')](),controller[_0x6aa7('0x16')]);router['delete'](_0x6aa7('0xa'),auth['isAuthenticated'](),controller[_0x6aa7('0x17')]);module[_0x6aa7('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 39c4ff4..0e0461e 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 _0x69d7=['STRING','exports'];(function(_0x5bed28,_0x3069b3){var _0x44fe9f=function(_0x5c934e){while(--_0x5c934e){_0x5bed28['push'](_0x5bed28['shift']());}};_0x44fe9f(++_0x3069b3);}(_0x69d7,0x13d));var _0x769d=function(_0x3aaa94,_0x4d968c){_0x3aaa94=_0x3aaa94-0x0;var _0x1e4463=_0x69d7[_0x3aaa94];return _0x1e4463;};'use strict';var Sequelize=require('sequelize');module[_0x769d('0x0')]={'name':{'type':Sequelize[_0x769d('0x1')]},'channel':{'type':Sequelize[_0x769d('0x1')]},'description':{'type':Sequelize[_0x769d('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb48c=['STRING','BOOLEAN','sequelize','exports'];(function(_0x52a659,_0x5e3c37){var _0xd10977=function(_0x5a2a8e){while(--_0x5a2a8e){_0x52a659['push'](_0x52a659['shift']());}};_0xd10977(++_0x5e3c37);}(_0xb48c,0x1aa));var _0xcb48=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb48c[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xcb48('0x0'));module[_0xcb48('0x1')]={'name':{'type':Sequelize[_0xcb48('0x2')]},'channel':{'type':Sequelize[_0xcb48('0x2')]},'description':{'type':Sequelize[_0xcb48('0x2')]},'status':{'type':Sequelize[_0xcb48('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 3288d50..9372b82 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 _0x05a5=['options','Trigger','includeAll','include','findAll','show','params','catch','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','pick','nolimit','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL'];(function(_0x203c0d,_0x2f936a){var _0x1ed620=function(_0xa5be7a){while(--_0xa5be7a){_0x203c0d['push'](_0x203c0d['shift']());}};_0x1ed620(++_0x2f936a);}(_0x05a5,0x18a));var _0x505a=function(_0x5f0df8,_0x1ccecb){_0x5f0df8=_0x5f0df8-0x0;var _0x5250b3=_0x05a5[_0x5f0df8];return _0x5250b3;};'use strict';var emlformat=require(_0x505a('0x0'));var rimraf=require(_0x505a('0x1'));var zipdir=require(_0x505a('0x2'));var jsonpatch=require(_0x505a('0x3'));var rp=require(_0x505a('0x4'));var moment=require(_0x505a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x505a('0x6'));var sox=require('sox');var csv=require(_0x505a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x505a('0x8'));var _=require(_0x505a('0x9'));var squel=require(_0x505a('0xa'));var crypto=require(_0x505a('0xb'));var jsforce=require(_0x505a('0xc'));var deskjs=require(_0x505a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x505a('0xe'));var authService=require(_0x505a('0xf'));var qs=require(_0x505a('0x10'));var as=require(_0x505a('0x11'));var hardwareService=require(_0x505a('0x12'));var logger=require(_0x505a('0x13'))(_0x505a('0x14'));var utils=require('../../config/utils');var config=require(_0x505a('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ca76f,_0x548c80){_0x548c80=_0x548c80||0xcc;return function(_0x4ff754){if(_0x4ff754){return _0x1ca76f[_0x505a('0x16')](_0x548c80);}return _0x1ca76f[_0x505a('0x17')](_0x548c80)[_0x505a('0x18')]();};}function respondWithResult(_0x15d2d2,_0x325009){_0x325009=_0x325009||0xc8;return function(_0x540c68){if(_0x540c68){return _0x15d2d2[_0x505a('0x17')](_0x325009)[_0x505a('0x19')](_0x540c68);}};}function respondWithFilteredResult(_0x1c7f10,_0xb5b14e){return function(_0x382339){if(_0x382339){var _0x5e5397=typeof _0xb5b14e[_0x505a('0x1a')]==='undefined'&&typeof _0xb5b14e[_0x505a('0x1b')]==='undefined';var _0x5a3717=_0x382339[_0x505a('0x1c')];var _0x3ade04=_0x5e5397?0x0:_0xb5b14e[_0x505a('0x1a')];var _0x529123=_0x5e5397?_0x382339['count']:_0xb5b14e['offset']+_0xb5b14e[_0x505a('0x1b')];var _0xa4545e;if(_0x529123>=_0x5a3717){_0x529123=_0x5a3717;_0xa4545e=0xc8;}else{_0xa4545e=0xce;}_0x1c7f10[_0x505a('0x17')](_0xa4545e);return _0x1c7f10['set'](_0x505a('0x1d'),_0x3ade04+'-'+_0x529123+'/'+_0x5a3717)[_0x505a('0x19')](_0x382339);}return null;};}function patchUpdates(_0x134c29){return function(_0x19a3b4){try{jsonpatch[_0x505a('0x1e')](_0x19a3b4,_0x134c29,!![]);}catch(_0x134bc1){return BPromise[_0x505a('0x1f')](_0x134bc1);}return _0x19a3b4[_0x505a('0x20')]();};}function saveUpdates(_0x1122c6,_0x25fd88){return function(_0xa2d862){if(_0xa2d862){return _0xa2d862[_0x505a('0x21')](_0x1122c6)[_0x505a('0x22')](function(_0x1221bc){return _0x1221bc;});}return null;};}function removeEntity(_0x164a49,_0x5be98a){return function(_0x58f8a2){if(_0x58f8a2){return _0x58f8a2[_0x505a('0x23')]()[_0x505a('0x22')](function(){var _0x2dffcb=_0x58f8a2[_0x505a('0x24')]({'plain':!![]});var _0x38a134=_0x505a('0x25');return db[_0x505a('0x26')]['destroy']({'where':{'type':_0x38a134,'resourceId':_0x2dffcb['id']}})[_0x505a('0x22')](function(){return _0x58f8a2;});})[_0x505a('0x22')](function(){_0x164a49[_0x505a('0x17')](0xcc)[_0x505a('0x18')]();});}};}function handleEntityNotFound(_0x2253f8,_0x13c40a){return function(_0x284972){if(!_0x284972){_0x2253f8[_0x505a('0x16')](0x194);}return _0x284972;};}function handleError(_0x17f66f,_0x359fcb){_0x359fcb=_0x359fcb||0x1f4;return function(_0x2a0bb5){logger['error'](_0x2a0bb5[_0x505a('0x27')]);if(_0x2a0bb5[_0x505a('0x28')]){delete _0x2a0bb5[_0x505a('0x28')];}_0x17f66f['status'](_0x359fcb)[_0x505a('0x29')](_0x2a0bb5);};}exports['index']=function(_0x52f67b,_0x5c91a3){var _0x62ea7={},_0x5e96cc={},_0x21e04a={'count':0x0,'rows':[]};var _0xc5154e=_[_0x505a('0x2a')](db['Trigger'][_0x505a('0x2b')],function(_0xdc25b7){return{'name':_0xdc25b7[_0x505a('0x2c')],'type':_0xdc25b7['type'][_0x505a('0x2d')]};});_0x5e96cc[_0x505a('0x2e')]=_[_0x505a('0x2a')](_0xc5154e,_0x505a('0x28'));_0x5e96cc[_0x505a('0x2f')]=_[_0x505a('0x30')](_0x52f67b[_0x505a('0x2f')]);_0x5e96cc[_0x505a('0x31')]=_['intersection'](_0x5e96cc['model'],_0x5e96cc[_0x505a('0x2f')]);_0x62ea7[_0x505a('0x32')]=_[_0x505a('0x33')](_0x5e96cc[_0x505a('0x2e')],qs['fields'](_0x52f67b[_0x505a('0x2f')][_0x505a('0x34')]));_0x62ea7[_0x505a('0x32')]=_0x62ea7[_0x505a('0x32')][_0x505a('0x35')]?_0x62ea7[_0x505a('0x32')]:_0x5e96cc[_0x505a('0x2e')];if(!_0x52f67b[_0x505a('0x2f')][_0x505a('0x36')]('nolimit')){_0x62ea7['limit']=qs[_0x505a('0x1b')](_0x52f67b[_0x505a('0x2f')][_0x505a('0x1b')]);_0x62ea7[_0x505a('0x1a')]=qs[_0x505a('0x1a')](_0x52f67b[_0x505a('0x2f')][_0x505a('0x1a')]);}_0x62ea7[_0x505a('0x37')]=qs[_0x505a('0x38')](_0x52f67b[_0x505a('0x2f')][_0x505a('0x38')]);_0x62ea7['where']=qs[_0x505a('0x31')](_['pick'](_0x52f67b[_0x505a('0x2f')],_0x5e96cc[_0x505a('0x31')]),_0xc5154e);if(_0x52f67b[_0x505a('0x2f')][_0x505a('0x39')]){_0x62ea7[_0x505a('0x3a')]=_[_0x505a('0x3b')](_0x62ea7[_0x505a('0x3a')],{'$or':_[_0x505a('0x2a')](_0xc5154e,function(_0x57b20c){if(_0x57b20c['type']!==_0x505a('0x3c')){var _0xf0dd92={};_0xf0dd92[_0x57b20c[_0x505a('0x28')]]={'$like':'%'+_0x52f67b[_0x505a('0x2f')][_0x505a('0x39')]+'%'};return _0xf0dd92;}})});}_0x62ea7=_[_0x505a('0x3b')]({},_0x62ea7,_0x52f67b[_0x505a('0x3d')]);var _0x19eb24={'where':_0x62ea7[_0x505a('0x3a')]};return db[_0x505a('0x3e')][_0x505a('0x1c')](_0x19eb24)[_0x505a('0x22')](function(_0x54ad35){_0x21e04a[_0x505a('0x1c')]=_0x54ad35;if(_0x52f67b[_0x505a('0x2f')][_0x505a('0x3f')]){_0x62ea7[_0x505a('0x40')]=[{'all':!![]}];}return db[_0x505a('0x3e')][_0x505a('0x41')](_0x62ea7);})[_0x505a('0x22')](function(_0x279c45){_0x21e04a['rows']=_0x279c45;return _0x21e04a;})[_0x505a('0x22')](respondWithFilteredResult(_0x5c91a3,_0x62ea7))['catch'](handleError(_0x5c91a3,null));};exports[_0x505a('0x42')]=function(_0x2f8571,_0x32ae9f){var _0x1e4e63={'raw':![],'where':{'id':_0x2f8571[_0x505a('0x43')]['id']}},_0x1dbe1d={};_0x1dbe1d['model']=_[_0x505a('0x30')](db[_0x505a('0x3e')][_0x505a('0x2b')]);_0x1dbe1d[_0x505a('0x2f')]=_['keys'](_0x2f8571['query']);_0x1dbe1d[_0x505a('0x31')]=_[_0x505a('0x33')](_0x1dbe1d[_0x505a('0x2e')],_0x1dbe1d[_0x505a('0x2f')]);_0x1e4e63['attributes']=_[_0x505a('0x33')](_0x1dbe1d[_0x505a('0x2e')],qs[_0x505a('0x34')](_0x2f8571[_0x505a('0x2f')][_0x505a('0x34')]));_0x1e4e63[_0x505a('0x32')]=_0x1e4e63[_0x505a('0x32')][_0x505a('0x35')]?_0x1e4e63[_0x505a('0x32')]:_0x1dbe1d['model'];if(_0x2f8571[_0x505a('0x2f')][_0x505a('0x3f')]){_0x1e4e63['include']=[{'all':!![]}];}_0x1e4e63=_[_0x505a('0x3b')]({},_0x1e4e63,_0x2f8571[_0x505a('0x3d')]);return db['Trigger']['find'](_0x1e4e63)[_0x505a('0x22')](handleEntityNotFound(_0x32ae9f,null))['then'](respondWithResult(_0x32ae9f,null))[_0x505a('0x44')](handleError(_0x32ae9f,null));};exports[_0x505a('0x45')]=function(_0x44ee2f,_0x46ac43){return db[_0x505a('0x3e')][_0x505a('0x45')](_0x44ee2f[_0x505a('0x46')],{})[_0x505a('0x22')](function(_0x3c8fcf){var _0x10ac62=_0x44ee2f[_0x505a('0x47')][_0x505a('0x24')]({'plain':!![]});if(!_0x10ac62)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10ac62[_0x505a('0x48')]===_0x505a('0x47')){var _0x2de4b4=_0x3c8fcf['get']({'plain':!![]});var _0x29e13c='Triggers';return db['UserProfileSection']['find']({'where':{'name':_0x29e13c,'userProfileId':_0x10ac62[_0x505a('0x49')]},'raw':!![]})['then'](function(_0x10108a){if(_0x10108a&&_0x10108a[_0x505a('0x4a')]===0x0){return db[_0x505a('0x26')]['create']({'name':_0x2de4b4[_0x505a('0x28')],'resourceId':_0x2de4b4['id'],'type':_0x10108a[_0x505a('0x28')],'sectionId':_0x10108a['id']},{})[_0x505a('0x22')](function(){return _0x3c8fcf;});}else{return _0x3c8fcf;}})[_0x505a('0x44')](function(_0x4bc08f){logger['error'](_0x505a('0x4b'),_0x4bc08f);throw _0x4bc08f;});}return _0x3c8fcf;})[_0x505a('0x22')](respondWithResult(_0x46ac43,0xc9))['catch'](handleError(_0x46ac43,null));};exports[_0x505a('0x21')]=function(_0x48afc4,_0x26a213){if(_0x48afc4[_0x505a('0x46')]['id']){delete _0x48afc4[_0x505a('0x46')]['id'];}return db[_0x505a('0x3e')][_0x505a('0x4c')]({'where':{'id':_0x48afc4[_0x505a('0x43')]['id']}})[_0x505a('0x22')](handleEntityNotFound(_0x26a213,null))[_0x505a('0x22')](saveUpdates(_0x48afc4['body'],null))[_0x505a('0x22')](respondWithResult(_0x26a213,null))[_0x505a('0x44')](handleError(_0x26a213,null));};exports['destroy']=function(_0x59f3eb,_0x1c10da){return db['Trigger'][_0x505a('0x4c')]({'where':{'id':_0x59f3eb[_0x505a('0x43')]['id']}})[_0x505a('0x22')](handleEntityNotFound(_0x1c10da,null))[_0x505a('0x22')](removeEntity(_0x1c10da,null))[_0x505a('0x44')](handleError(_0x1c10da,null));};exports[_0x505a('0x4d')]=function(_0x2e1660,_0x58808d,_0x50b1ee){if(_0x2e1660['body']['id']){delete _0x2e1660[_0x505a('0x46')]['id'];}return db[_0x505a('0x3e')][_0x505a('0x4c')]({'where':{'id':_0x2e1660[_0x505a('0x43')]['id']}})[_0x505a('0x22')](handleEntityNotFound(_0x58808d,null))[_0x505a('0x22')](function(_0x35fccb){if(_0x35fccb){_0x2e1660[_0x505a('0x46')][_0x505a('0x4e')]=_0x35fccb['id'];return db['Condition'][_0x505a('0x45')](_0x2e1660[_0x505a('0x46')]);}})[_0x505a('0x22')](respondWithResult(_0x58808d,null))[_0x505a('0x44')](handleError(_0x58808d,null));};exports[_0x505a('0x4f')]=function(_0x2ebaec,_0x49e189,_0x12d6fd){if(_0x2ebaec[_0x505a('0x46')]['id']){delete _0x2ebaec[_0x505a('0x46')]['id'];}return db[_0x505a('0x3e')]['find']({'where':{'id':_0x2ebaec[_0x505a('0x43')]['id']}})[_0x505a('0x22')](handleEntityNotFound(_0x49e189,null))['then'](function(_0x5d7900){if(_0x5d7900){_0x2ebaec[_0x505a('0x46')][_0x505a('0x50')]=_0x5d7900['id'];return db[_0x505a('0x51')]['create'](_0x2ebaec[_0x505a('0x46')]);}})[_0x505a('0x22')](respondWithResult(_0x49e189,null))[_0x505a('0x44')](handleError(_0x49e189,null));};exports[_0x505a('0x52')]=function(_0x243999,_0x2a44f0,_0x1a2090){var _0x58e639={};var _0x24ea83={};var _0x47b516;var _0x43bf4b;return db[_0x505a('0x3e')][_0x505a('0x53')]({'where':{'id':_0x243999[_0x505a('0x43')]['id']}})[_0x505a('0x22')](handleEntityNotFound(_0x2a44f0,null))[_0x505a('0x22')](function(_0x5e98f4){if(_0x5e98f4){_0x47b516=_0x5e98f4;_0x24ea83[_0x505a('0x2e')]=_[_0x505a('0x30')](db[_0x505a('0x51')][_0x505a('0x2b')]);_0x24ea83[_0x505a('0x2f')]=_[_0x505a('0x30')](_0x243999[_0x505a('0x2f')]);_0x24ea83[_0x505a('0x31')]=_['intersection'](_0x24ea83[_0x505a('0x2e')],_0x24ea83[_0x505a('0x2f')]);_0x58e639[_0x505a('0x32')]=_['intersection'](_0x24ea83[_0x505a('0x2e')],qs[_0x505a('0x34')](_0x243999['query'][_0x505a('0x34')]));_0x58e639['attributes']=_0x58e639[_0x505a('0x32')][_0x505a('0x35')]?_0x58e639[_0x505a('0x32')]:_0x24ea83['model'];_0x58e639[_0x505a('0x37')]=qs[_0x505a('0x38')](_0x243999[_0x505a('0x2f')][_0x505a('0x38')]);_0x58e639[_0x505a('0x3a')]=qs[_0x505a('0x31')](_[_0x505a('0x54')](_0x243999[_0x505a('0x2f')],_0x24ea83[_0x505a('0x31')]));if(_0x243999['query'][_0x505a('0x39')]){_0x58e639[_0x505a('0x3a')]=_[_0x505a('0x3b')](_0x58e639['where'],{'$or':_[_0x505a('0x2a')](_0x58e639[_0x505a('0x32')],function(_0x359bc9){var _0x33b92a={};_0x33b92a[_0x359bc9]={'$like':'%'+_0x243999[_0x505a('0x2f')][_0x505a('0x39')]+'%'};return _0x33b92a;})});}_0x58e639=_[_0x505a('0x3b')]({},_0x58e639,_0x243999[_0x505a('0x3d')]);return _0x47b516[_0x505a('0x52')](_0x58e639);}})[_0x505a('0x22')](function(_0x158d98){if(_0x158d98){_0x43bf4b=_0x158d98[_0x505a('0x35')];if(!_0x243999[_0x505a('0x2f')][_0x505a('0x36')](_0x505a('0x55'))){_0x58e639['limit']=qs[_0x505a('0x1b')](_0x243999[_0x505a('0x2f')][_0x505a('0x1b')]);_0x58e639[_0x505a('0x1a')]=qs['offset'](_0x243999[_0x505a('0x2f')]['offset']);}return _0x47b516['getAllConditions'](_0x58e639);}})[_0x505a('0x22')](function(_0x55b4d4){if(_0x55b4d4){return _0x55b4d4?{'count':_0x43bf4b,'rows':_0x55b4d4}:null;}})['then'](respondWithResult(_0x2a44f0,null))['catch'](handleError(_0x2a44f0,null));};exports['getAnyConditions']=function(_0x395a6b,_0x9e7885,_0x26bdaf){var _0x211b2c={};var _0x36a975={};var _0x34cedc;var _0x16fd0b;return db[_0x505a('0x3e')]['findOne']({'where':{'id':_0x395a6b[_0x505a('0x43')]['id']}})[_0x505a('0x22')](handleEntityNotFound(_0x9e7885,null))[_0x505a('0x22')](function(_0x56f6d1){if(_0x56f6d1){_0x34cedc=_0x56f6d1;_0x36a975[_0x505a('0x2e')]=_[_0x505a('0x30')](db[_0x505a('0x51')][_0x505a('0x2b')]);_0x36a975[_0x505a('0x2f')]=_[_0x505a('0x30')](_0x395a6b[_0x505a('0x2f')]);_0x36a975[_0x505a('0x31')]=_[_0x505a('0x33')](_0x36a975[_0x505a('0x2e')],_0x36a975[_0x505a('0x2f')]);_0x211b2c[_0x505a('0x32')]=_[_0x505a('0x33')](_0x36a975[_0x505a('0x2e')],qs[_0x505a('0x34')](_0x395a6b[_0x505a('0x2f')]['fields']));_0x211b2c[_0x505a('0x32')]=_0x211b2c['attributes'][_0x505a('0x35')]?_0x211b2c[_0x505a('0x32')]:_0x36a975[_0x505a('0x2e')];_0x211b2c['order']=qs[_0x505a('0x38')](_0x395a6b[_0x505a('0x2f')][_0x505a('0x38')]);_0x211b2c[_0x505a('0x3a')]=qs[_0x505a('0x31')](_[_0x505a('0x54')](_0x395a6b[_0x505a('0x2f')],_0x36a975[_0x505a('0x31')]));if(_0x395a6b['query']['filter']){_0x211b2c[_0x505a('0x3a')]=_['merge'](_0x211b2c[_0x505a('0x3a')],{'$or':_[_0x505a('0x2a')](_0x211b2c[_0x505a('0x32')],function(_0xeaf370){var _0x3e69a7={};_0x3e69a7[_0xeaf370]={'$like':'%'+_0x395a6b['query'][_0x505a('0x39')]+'%'};return _0x3e69a7;})});}_0x211b2c=_[_0x505a('0x3b')]({},_0x211b2c,_0x395a6b['options']);return _0x34cedc[_0x505a('0x56')](_0x211b2c);}})['then'](function(_0x47c831){if(_0x47c831){_0x16fd0b=_0x47c831[_0x505a('0x35')];if(!_0x395a6b['query'][_0x505a('0x36')](_0x505a('0x55'))){_0x211b2c[_0x505a('0x1b')]=qs['limit'](_0x395a6b[_0x505a('0x2f')][_0x505a('0x1b')]);_0x211b2c[_0x505a('0x1a')]=qs[_0x505a('0x1a')](_0x395a6b[_0x505a('0x2f')][_0x505a('0x1a')]);}return _0x34cedc[_0x505a('0x56')](_0x211b2c);}})['then'](function(_0x7eaefb){if(_0x7eaefb){return _0x7eaefb?{'count':_0x16fd0b,'rows':_0x7eaefb}:null;}})[_0x505a('0x22')](respondWithResult(_0x9e7885,null))[_0x505a('0x44')](handleError(_0x9e7885,null));};exports[_0x505a('0x57')]=function(_0x2a7b84,_0xd7ade6,_0x963077){if(_0x2a7b84[_0x505a('0x46')]['id']){delete _0x2a7b84[_0x505a('0x46')]['id'];}return db[_0x505a('0x3e')]['find']({'where':{'id':_0x2a7b84[_0x505a('0x43')]['id']}})['then'](handleEntityNotFound(_0xd7ade6,null))[_0x505a('0x22')](function(_0x47d7f3){if(_0x47d7f3){_0x2a7b84[_0x505a('0x46')][_0x505a('0x58')]=_0x47d7f3['id'];return db[_0x505a('0x59')][_0x505a('0x45')](_0x2a7b84['body']);}})[_0x505a('0x22')](respondWithResult(_0xd7ade6,null))[_0x505a('0x44')](handleError(_0xd7ade6,null));};exports[_0x505a('0x5a')]=function(_0x5819e7,_0x50e2c3,_0x1cd73d){var _0x468aeb={};var _0x16132b={};var _0x14177d;var _0x3a30bb;return db[_0x505a('0x3e')][_0x505a('0x53')]({'where':{'id':_0x5819e7[_0x505a('0x43')]['id']}})[_0x505a('0x22')](handleEntityNotFound(_0x50e2c3,null))[_0x505a('0x22')](function(_0x45ad8d){if(_0x45ad8d){_0x14177d=_0x45ad8d;_0x16132b[_0x505a('0x2e')]=_[_0x505a('0x30')](db['Action']['rawAttributes']);_0x16132b[_0x505a('0x2f')]=_['keys'](_0x5819e7[_0x505a('0x2f')]);_0x16132b[_0x505a('0x31')]=_['intersection'](_0x16132b[_0x505a('0x2e')],_0x16132b['query']);_0x468aeb['attributes']=_[_0x505a('0x33')](_0x16132b[_0x505a('0x2e')],qs['fields'](_0x5819e7[_0x505a('0x2f')]['fields']));_0x468aeb['attributes']=_0x468aeb[_0x505a('0x32')][_0x505a('0x35')]?_0x468aeb[_0x505a('0x32')]:_0x16132b[_0x505a('0x2e')];_0x468aeb['order']=qs[_0x505a('0x38')](_0x5819e7[_0x505a('0x2f')][_0x505a('0x38')]);_0x468aeb[_0x505a('0x3a')]=qs[_0x505a('0x31')](_['pick'](_0x5819e7[_0x505a('0x2f')],_0x16132b[_0x505a('0x31')]));if(_0x5819e7[_0x505a('0x2f')][_0x505a('0x39')]){_0x468aeb[_0x505a('0x3a')]=_[_0x505a('0x3b')](_0x468aeb[_0x505a('0x3a')],{'$or':_['map'](_0x468aeb[_0x505a('0x32')],function(_0x253237){var _0x1d56d1={};_0x1d56d1[_0x253237]={'$like':'%'+_0x5819e7[_0x505a('0x2f')][_0x505a('0x39')]+'%'};return _0x1d56d1;})});}_0x468aeb=_[_0x505a('0x3b')]({},_0x468aeb,_0x5819e7[_0x505a('0x3d')]);return _0x14177d[_0x505a('0x5a')](_0x468aeb);}})[_0x505a('0x22')](function(_0x2cd3bc){if(_0x2cd3bc){_0x3a30bb=_0x2cd3bc[_0x505a('0x35')];if(!_0x5819e7['query']['hasOwnProperty'](_0x505a('0x55'))){_0x468aeb[_0x505a('0x1b')]=qs['limit'](_0x5819e7[_0x505a('0x2f')]['limit']);_0x468aeb['offset']=qs['offset'](_0x5819e7[_0x505a('0x2f')][_0x505a('0x1a')]);}return _0x14177d[_0x505a('0x5a')](_0x468aeb);}})[_0x505a('0x22')](function(_0x3155e8){if(_0x3155e8){return _0x3155e8?{'count':_0x3a30bb,'rows':_0x3155e8}:null;}})[_0x505a('0x22')](respondWithResult(_0x50e2c3,null))[_0x505a('0x44')](handleError(_0x50e2c3,null));}; \ No newline at end of file +var _0xb777=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','destroy','then','UserProfileResource','error','name','send','map','Trigger','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','userProfileId','autoAssociation','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','order','getAnyConditions','addAction','TriggerId','getActions','Action','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x210ba0,_0x48f352){var _0xacf2c9=function(_0x2897d0){while(--_0x2897d0){_0x210ba0['push'](_0x210ba0['shift']());}};_0xacf2c9(++_0x48f352);}(_0xb777,0x1dd));var _0x7b77=function(_0x3566de,_0x1bec4d){_0x3566de=_0x3566de-0x0;var _0x256439=_0xb777[_0x3566de];return _0x256439;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b77('0x0'));var zipdir=require(_0x7b77('0x1'));var jsonpatch=require(_0x7b77('0x2'));var rp=require(_0x7b77('0x3'));var moment=require(_0x7b77('0x4'));var BPromise=require(_0x7b77('0x5'));var Mustache=require('mustache');var util=require(_0x7b77('0x6'));var path=require(_0x7b77('0x7'));var sox=require(_0x7b77('0x8'));var csv=require(_0x7b77('0x9'));var ejs=require(_0x7b77('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b77('0xb'));var squel=require(_0x7b77('0xc'));var crypto=require(_0x7b77('0xd'));var jsforce=require(_0x7b77('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7b77('0x9'));var querystring=require(_0x7b77('0xf'));var Papa=require('papaparse');var Redis=require(_0x7b77('0x10'));var authService=require(_0x7b77('0x11'));var qs=require(_0x7b77('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b77('0x13'));var logger=require(_0x7b77('0x14'))(_0x7b77('0x15'));var utils=require(_0x7b77('0x16'));var config=require(_0x7b77('0x17'));var licenseUtil=require(_0x7b77('0x18'));var db=require(_0x7b77('0x19'))['db'];function respondWithStatusCode(_0x1940ef,_0x75a13){_0x75a13=_0x75a13||0xcc;return function(_0x406519){if(_0x406519){return _0x1940ef[_0x7b77('0x1a')](_0x75a13);}return _0x1940ef[_0x7b77('0x1b')](_0x75a13)[_0x7b77('0x1c')]();};}function respondWithResult(_0x463fab,_0x29d710){_0x29d710=_0x29d710||0xc8;return function(_0x1a95e1){if(_0x1a95e1){return _0x463fab[_0x7b77('0x1b')](_0x29d710)[_0x7b77('0x1d')](_0x1a95e1);}};}function respondWithFilteredResult(_0x535fd4,_0x390d17){return function(_0x574d8b){if(_0x574d8b){var _0x20a8a6=typeof _0x390d17[_0x7b77('0x1e')]===_0x7b77('0x1f')&&typeof _0x390d17['limit']===_0x7b77('0x1f');var _0x48e731=_0x574d8b[_0x7b77('0x20')];var _0x33bd1b=_0x20a8a6?0x0:_0x390d17[_0x7b77('0x1e')];var _0x2de743=_0x20a8a6?_0x574d8b[_0x7b77('0x20')]:_0x390d17[_0x7b77('0x1e')]+_0x390d17['limit'];var _0x4c88d4;if(_0x2de743>=_0x48e731){_0x2de743=_0x48e731;_0x4c88d4=0xc8;}else{_0x4c88d4=0xce;}_0x535fd4[_0x7b77('0x1b')](_0x4c88d4);return _0x535fd4[_0x7b77('0x21')](_0x7b77('0x22'),_0x33bd1b+'-'+_0x2de743+'/'+_0x48e731)['json'](_0x574d8b);}return null;};}function patchUpdates(_0x39fc9c){return function(_0x1e8b53){try{jsonpatch[_0x7b77('0x23')](_0x1e8b53,_0x39fc9c,!![]);}catch(_0x39ed05){return BPromise[_0x7b77('0x24')](_0x39ed05);}return _0x1e8b53[_0x7b77('0x25')]();};}function saveUpdates(_0x1eae20,_0x14da23){return function(_0x16acd9){if(_0x16acd9){return _0x16acd9['update'](_0x1eae20)['then'](function(_0x1e0989){return _0x1e0989;});}return null;};}function removeEntity(_0x2c2993,_0x1d1906){return function(_0x21f0f9){if(_0x21f0f9){return _0x21f0f9[_0x7b77('0x26')]()[_0x7b77('0x27')](function(){var _0x19c3af=_0x21f0f9['get']({'plain':!![]});var _0x3b5382='Triggers';return db[_0x7b77('0x28')]['destroy']({'where':{'type':_0x3b5382,'resourceId':_0x19c3af['id']}})[_0x7b77('0x27')](function(){return _0x21f0f9;});})[_0x7b77('0x27')](function(){_0x2c2993[_0x7b77('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54c6ae,_0x5832fc){return function(_0x521a18){if(!_0x521a18){_0x54c6ae['sendStatus'](0x194);}return _0x521a18;};}function handleError(_0x2e7a31,_0x16d9e1){_0x16d9e1=_0x16d9e1||0x1f4;return function(_0x2c9d06){logger[_0x7b77('0x29')](_0x2c9d06['stack']);if(_0x2c9d06[_0x7b77('0x2a')]){delete _0x2c9d06['name'];}_0x2e7a31[_0x7b77('0x1b')](_0x16d9e1)[_0x7b77('0x2b')](_0x2c9d06);};}exports['index']=function(_0x16836a,_0x172247){var _0x3df4ac={},_0x33d0ee={},_0x1ecc13={'count':0x0,'rows':[]};var _0x241303=_[_0x7b77('0x2c')](db[_0x7b77('0x2d')][_0x7b77('0x2e')],function(_0x12ecbf){return{'name':_0x12ecbf[_0x7b77('0x2f')],'type':_0x12ecbf[_0x7b77('0x30')]['key']};});_0x33d0ee[_0x7b77('0x31')]=_['map'](_0x241303,_0x7b77('0x2a'));_0x33d0ee[_0x7b77('0x32')]=_[_0x7b77('0x33')](_0x16836a[_0x7b77('0x32')]);_0x33d0ee[_0x7b77('0x34')]=_[_0x7b77('0x35')](_0x33d0ee['model'],_0x33d0ee[_0x7b77('0x32')]);_0x3df4ac[_0x7b77('0x36')]=_[_0x7b77('0x35')](_0x33d0ee['model'],qs[_0x7b77('0x37')](_0x16836a['query'][_0x7b77('0x37')]));_0x3df4ac[_0x7b77('0x36')]=_0x3df4ac[_0x7b77('0x36')][_0x7b77('0x38')]?_0x3df4ac[_0x7b77('0x36')]:_0x33d0ee['model'];if(!_0x16836a[_0x7b77('0x32')][_0x7b77('0x39')](_0x7b77('0x3a'))){_0x3df4ac['limit']=qs[_0x7b77('0x3b')](_0x16836a['query'][_0x7b77('0x3b')]);_0x3df4ac[_0x7b77('0x1e')]=qs[_0x7b77('0x1e')](_0x16836a['query'][_0x7b77('0x1e')]);}_0x3df4ac['order']=qs[_0x7b77('0x3c')](_0x16836a[_0x7b77('0x32')][_0x7b77('0x3c')]);_0x3df4ac[_0x7b77('0x3d')]=qs['filters'](_[_0x7b77('0x3e')](_0x16836a[_0x7b77('0x32')],_0x33d0ee['filters']),_0x241303);if(_0x16836a[_0x7b77('0x32')][_0x7b77('0x3f')]){_0x3df4ac['where']=_[_0x7b77('0x40')](_0x3df4ac[_0x7b77('0x3d')],{'$or':_['map'](_0x241303,function(_0x7f08ce){if(_0x7f08ce['type']!==_0x7b77('0x41')){var _0x292d72={};_0x292d72[_0x7f08ce[_0x7b77('0x2a')]]={'$like':'%'+_0x16836a[_0x7b77('0x32')][_0x7b77('0x3f')]+'%'};return _0x292d72;}})});}_0x3df4ac=_[_0x7b77('0x40')]({},_0x3df4ac,_0x16836a['options']);var _0x493e73={'where':_0x3df4ac['where']};return db[_0x7b77('0x2d')]['count'](_0x493e73)[_0x7b77('0x27')](function(_0x52a77b){_0x1ecc13[_0x7b77('0x20')]=_0x52a77b;if(_0x16836a['query'][_0x7b77('0x42')]){_0x3df4ac[_0x7b77('0x43')]=[{'all':!![]}];}return db[_0x7b77('0x2d')][_0x7b77('0x44')](_0x3df4ac);})[_0x7b77('0x27')](function(_0x35c39b){_0x1ecc13[_0x7b77('0x45')]=_0x35c39b;return _0x1ecc13;})[_0x7b77('0x27')](respondWithFilteredResult(_0x172247,_0x3df4ac))['catch'](handleError(_0x172247,null));};exports['show']=function(_0x49471b,_0x967174){var _0x16ab9a={'raw':![],'where':{'id':_0x49471b[_0x7b77('0x46')]['id']}},_0x21208d={};_0x21208d[_0x7b77('0x31')]=_[_0x7b77('0x33')](db[_0x7b77('0x2d')]['rawAttributes']);_0x21208d['query']=_['keys'](_0x49471b[_0x7b77('0x32')]);_0x21208d['filters']=_[_0x7b77('0x35')](_0x21208d[_0x7b77('0x31')],_0x21208d[_0x7b77('0x32')]);_0x16ab9a[_0x7b77('0x36')]=_[_0x7b77('0x35')](_0x21208d[_0x7b77('0x31')],qs[_0x7b77('0x37')](_0x49471b[_0x7b77('0x32')][_0x7b77('0x37')]));_0x16ab9a[_0x7b77('0x36')]=_0x16ab9a[_0x7b77('0x36')]['length']?_0x16ab9a[_0x7b77('0x36')]:_0x21208d[_0x7b77('0x31')];if(_0x49471b[_0x7b77('0x32')]['includeAll']){_0x16ab9a[_0x7b77('0x43')]=[{'all':!![]}];}_0x16ab9a=_[_0x7b77('0x40')]({},_0x16ab9a,_0x49471b[_0x7b77('0x47')]);return db[_0x7b77('0x2d')][_0x7b77('0x48')](_0x16ab9a)['then'](handleEntityNotFound(_0x967174,null))[_0x7b77('0x27')](respondWithResult(_0x967174,null))['catch'](handleError(_0x967174,null));};exports['create']=function(_0x2a93e8,_0x1e5bdd){return db['Trigger']['create'](_0x2a93e8[_0x7b77('0x49')],{})[_0x7b77('0x27')](function(_0x2d9c9c){var _0x4ddf65=_0x2a93e8[_0x7b77('0x4a')][_0x7b77('0x4b')]({'plain':!![]});if(!_0x4ddf65)throw new Error(_0x7b77('0x4c'));if(_0x4ddf65[_0x7b77('0x4d')]===_0x7b77('0x4a')){var _0x58d566=_0x2d9c9c[_0x7b77('0x4b')]({'plain':!![]});var _0x12a556=_0x7b77('0x4e');return db['UserProfileSection'][_0x7b77('0x48')]({'where':{'name':_0x12a556,'userProfileId':_0x4ddf65[_0x7b77('0x4f')]},'raw':!![]})['then'](function(_0x5101ae){if(_0x5101ae&&_0x5101ae[_0x7b77('0x50')]===0x0){return db[_0x7b77('0x28')][_0x7b77('0x51')]({'name':_0x58d566[_0x7b77('0x2a')],'resourceId':_0x58d566['id'],'type':_0x5101ae[_0x7b77('0x2a')],'sectionId':_0x5101ae['id']},{})[_0x7b77('0x27')](function(){return _0x2d9c9c;});}else{return _0x2d9c9c;}})[_0x7b77('0x52')](function(_0x544c62){logger[_0x7b77('0x29')](_0x7b77('0x53'),_0x544c62);throw _0x544c62;});}return _0x2d9c9c;})['then'](respondWithResult(_0x1e5bdd,0xc9))['catch'](handleError(_0x1e5bdd,null));};exports[_0x7b77('0x54')]=function(_0xc64f27,_0xdb4eb){if(_0xc64f27[_0x7b77('0x49')]['id']){delete _0xc64f27[_0x7b77('0x49')]['id'];}return db[_0x7b77('0x2d')][_0x7b77('0x48')]({'where':{'id':_0xc64f27[_0x7b77('0x46')]['id']}})['then'](handleEntityNotFound(_0xdb4eb,null))[_0x7b77('0x27')](saveUpdates(_0xc64f27[_0x7b77('0x49')],null))[_0x7b77('0x27')](respondWithResult(_0xdb4eb,null))[_0x7b77('0x52')](handleError(_0xdb4eb,null));};exports[_0x7b77('0x26')]=function(_0xddf0ce,_0x551281){return db[_0x7b77('0x2d')][_0x7b77('0x48')]({'where':{'id':_0xddf0ce[_0x7b77('0x46')]['id']}})[_0x7b77('0x27')](handleEntityNotFound(_0x551281,null))[_0x7b77('0x27')](removeEntity(_0x551281,null))[_0x7b77('0x52')](handleError(_0x551281,null));};exports['addAllCondition']=function(_0x29e1dd,_0x440c70,_0x3b893f){if(_0x29e1dd['body']['id']){delete _0x29e1dd[_0x7b77('0x49')]['id'];}return db[_0x7b77('0x2d')][_0x7b77('0x48')]({'where':{'id':_0x29e1dd['params']['id']}})[_0x7b77('0x27')](handleEntityNotFound(_0x440c70,null))[_0x7b77('0x27')](function(_0x10f123){if(_0x10f123){_0x29e1dd[_0x7b77('0x49')][_0x7b77('0x55')]=_0x10f123['id'];return db[_0x7b77('0x56')][_0x7b77('0x51')](_0x29e1dd['body']);}})[_0x7b77('0x27')](respondWithResult(_0x440c70,null))['catch'](handleError(_0x440c70,null));};exports[_0x7b77('0x57')]=function(_0x20f8f7,_0x573e33,_0x5887e9){if(_0x20f8f7[_0x7b77('0x49')]['id']){delete _0x20f8f7[_0x7b77('0x49')]['id'];}return db[_0x7b77('0x2d')][_0x7b77('0x48')]({'where':{'id':_0x20f8f7[_0x7b77('0x46')]['id']}})[_0x7b77('0x27')](handleEntityNotFound(_0x573e33,null))[_0x7b77('0x27')](function(_0x49bcaa){if(_0x49bcaa){_0x20f8f7[_0x7b77('0x49')][_0x7b77('0x58')]=_0x49bcaa['id'];return db['Condition']['create'](_0x20f8f7[_0x7b77('0x49')]);}})[_0x7b77('0x27')](respondWithResult(_0x573e33,null))[_0x7b77('0x52')](handleError(_0x573e33,null));};exports[_0x7b77('0x59')]=function(_0x184e6d,_0xb187fe,_0x4be855){var _0x11efc9={};var _0x8a938={};var _0x1127be;var _0x75a117;return db[_0x7b77('0x2d')][_0x7b77('0x5a')]({'where':{'id':_0x184e6d[_0x7b77('0x46')]['id']}})[_0x7b77('0x27')](handleEntityNotFound(_0xb187fe,null))[_0x7b77('0x27')](function(_0x4ebfc1){if(_0x4ebfc1){_0x1127be=_0x4ebfc1;_0x8a938['model']=_[_0x7b77('0x33')](db[_0x7b77('0x56')][_0x7b77('0x2e')]);_0x8a938[_0x7b77('0x32')]=_['keys'](_0x184e6d[_0x7b77('0x32')]);_0x8a938[_0x7b77('0x34')]=_[_0x7b77('0x35')](_0x8a938[_0x7b77('0x31')],_0x8a938[_0x7b77('0x32')]);_0x11efc9[_0x7b77('0x36')]=_['intersection'](_0x8a938[_0x7b77('0x31')],qs[_0x7b77('0x37')](_0x184e6d[_0x7b77('0x32')][_0x7b77('0x37')]));_0x11efc9['attributes']=_0x11efc9['attributes'][_0x7b77('0x38')]?_0x11efc9['attributes']:_0x8a938[_0x7b77('0x31')];_0x11efc9[_0x7b77('0x5b')]=qs[_0x7b77('0x3c')](_0x184e6d['query'][_0x7b77('0x3c')]);_0x11efc9[_0x7b77('0x3d')]=qs[_0x7b77('0x34')](_[_0x7b77('0x3e')](_0x184e6d['query'],_0x8a938[_0x7b77('0x34')]));if(_0x184e6d['query'][_0x7b77('0x3f')]){_0x11efc9[_0x7b77('0x3d')]=_['merge'](_0x11efc9[_0x7b77('0x3d')],{'$or':_[_0x7b77('0x2c')](_0x11efc9['attributes'],function(_0x118aea){var _0x206650={};_0x206650[_0x118aea]={'$like':'%'+_0x184e6d[_0x7b77('0x32')][_0x7b77('0x3f')]+'%'};return _0x206650;})});}_0x11efc9=_['merge']({},_0x11efc9,_0x184e6d[_0x7b77('0x47')]);return _0x1127be[_0x7b77('0x59')](_0x11efc9);}})[_0x7b77('0x27')](function(_0x79c234){if(_0x79c234){_0x75a117=_0x79c234[_0x7b77('0x38')];if(!_0x184e6d['query'][_0x7b77('0x39')](_0x7b77('0x3a'))){_0x11efc9[_0x7b77('0x3b')]=qs[_0x7b77('0x3b')](_0x184e6d[_0x7b77('0x32')][_0x7b77('0x3b')]);_0x11efc9[_0x7b77('0x1e')]=qs['offset'](_0x184e6d[_0x7b77('0x32')]['offset']);}return _0x1127be[_0x7b77('0x59')](_0x11efc9);}})[_0x7b77('0x27')](function(_0x759066){if(_0x759066){return _0x759066?{'count':_0x75a117,'rows':_0x759066}:null;}})['then'](respondWithResult(_0xb187fe,null))[_0x7b77('0x52')](handleError(_0xb187fe,null));};exports[_0x7b77('0x5c')]=function(_0x4719ac,_0x50b004,_0x592042){var _0x2b8dee={};var _0x2f00dd={};var _0x13fd72;var _0x11c657;return db[_0x7b77('0x2d')][_0x7b77('0x5a')]({'where':{'id':_0x4719ac[_0x7b77('0x46')]['id']}})['then'](handleEntityNotFound(_0x50b004,null))[_0x7b77('0x27')](function(_0x4a9b01){if(_0x4a9b01){_0x13fd72=_0x4a9b01;_0x2f00dd['model']=_[_0x7b77('0x33')](db[_0x7b77('0x56')][_0x7b77('0x2e')]);_0x2f00dd[_0x7b77('0x32')]=_['keys'](_0x4719ac['query']);_0x2f00dd['filters']=_[_0x7b77('0x35')](_0x2f00dd['model'],_0x2f00dd[_0x7b77('0x32')]);_0x2b8dee[_0x7b77('0x36')]=_[_0x7b77('0x35')](_0x2f00dd[_0x7b77('0x31')],qs['fields'](_0x4719ac['query']['fields']));_0x2b8dee[_0x7b77('0x36')]=_0x2b8dee[_0x7b77('0x36')]['length']?_0x2b8dee[_0x7b77('0x36')]:_0x2f00dd[_0x7b77('0x31')];_0x2b8dee['order']=qs['sort'](_0x4719ac['query'][_0x7b77('0x3c')]);_0x2b8dee[_0x7b77('0x3d')]=qs[_0x7b77('0x34')](_[_0x7b77('0x3e')](_0x4719ac[_0x7b77('0x32')],_0x2f00dd[_0x7b77('0x34')]));if(_0x4719ac['query'][_0x7b77('0x3f')]){_0x2b8dee[_0x7b77('0x3d')]=_['merge'](_0x2b8dee[_0x7b77('0x3d')],{'$or':_[_0x7b77('0x2c')](_0x2b8dee[_0x7b77('0x36')],function(_0x47742e){var _0xa41cb8={};_0xa41cb8[_0x47742e]={'$like':'%'+_0x4719ac[_0x7b77('0x32')][_0x7b77('0x3f')]+'%'};return _0xa41cb8;})});}_0x2b8dee=_[_0x7b77('0x40')]({},_0x2b8dee,_0x4719ac[_0x7b77('0x47')]);return _0x13fd72[_0x7b77('0x5c')](_0x2b8dee);}})['then'](function(_0x37eb67){if(_0x37eb67){_0x11c657=_0x37eb67[_0x7b77('0x38')];if(!_0x4719ac[_0x7b77('0x32')][_0x7b77('0x39')](_0x7b77('0x3a'))){_0x2b8dee['limit']=qs[_0x7b77('0x3b')](_0x4719ac[_0x7b77('0x32')][_0x7b77('0x3b')]);_0x2b8dee[_0x7b77('0x1e')]=qs[_0x7b77('0x1e')](_0x4719ac[_0x7b77('0x32')][_0x7b77('0x1e')]);}return _0x13fd72[_0x7b77('0x5c')](_0x2b8dee);}})[_0x7b77('0x27')](function(_0x1184f8){if(_0x1184f8){return _0x1184f8?{'count':_0x11c657,'rows':_0x1184f8}:null;}})[_0x7b77('0x27')](respondWithResult(_0x50b004,null))['catch'](handleError(_0x50b004,null));};exports[_0x7b77('0x5d')]=function(_0x47ee2b,_0x27d25c,_0x41e12f){if(_0x47ee2b[_0x7b77('0x49')]['id']){delete _0x47ee2b['body']['id'];}return db[_0x7b77('0x2d')][_0x7b77('0x48')]({'where':{'id':_0x47ee2b[_0x7b77('0x46')]['id']}})[_0x7b77('0x27')](handleEntityNotFound(_0x27d25c,null))[_0x7b77('0x27')](function(_0x474c76){if(_0x474c76){_0x47ee2b['body'][_0x7b77('0x5e')]=_0x474c76['id'];return db['Action'][_0x7b77('0x51')](_0x47ee2b[_0x7b77('0x49')]);}})['then'](respondWithResult(_0x27d25c,null))[_0x7b77('0x52')](handleError(_0x27d25c,null));};exports[_0x7b77('0x5f')]=function(_0xf1ef6f,_0x5e96df,_0x3001ab){var _0x41a34c={};var _0x3f6c7a={};var _0x535bb7;var _0x301bb4;return db['Trigger'][_0x7b77('0x5a')]({'where':{'id':_0xf1ef6f[_0x7b77('0x46')]['id']}})['then'](handleEntityNotFound(_0x5e96df,null))['then'](function(_0x386c00){if(_0x386c00){_0x535bb7=_0x386c00;_0x3f6c7a[_0x7b77('0x31')]=_[_0x7b77('0x33')](db[_0x7b77('0x60')][_0x7b77('0x2e')]);_0x3f6c7a[_0x7b77('0x32')]=_[_0x7b77('0x33')](_0xf1ef6f[_0x7b77('0x32')]);_0x3f6c7a[_0x7b77('0x34')]=_['intersection'](_0x3f6c7a['model'],_0x3f6c7a[_0x7b77('0x32')]);_0x41a34c[_0x7b77('0x36')]=_[_0x7b77('0x35')](_0x3f6c7a[_0x7b77('0x31')],qs[_0x7b77('0x37')](_0xf1ef6f[_0x7b77('0x32')]['fields']));_0x41a34c['attributes']=_0x41a34c['attributes']['length']?_0x41a34c[_0x7b77('0x36')]:_0x3f6c7a[_0x7b77('0x31')];_0x41a34c[_0x7b77('0x5b')]=qs[_0x7b77('0x3c')](_0xf1ef6f[_0x7b77('0x32')][_0x7b77('0x3c')]);_0x41a34c[_0x7b77('0x3d')]=qs[_0x7b77('0x34')](_['pick'](_0xf1ef6f[_0x7b77('0x32')],_0x3f6c7a[_0x7b77('0x34')]));if(_0xf1ef6f[_0x7b77('0x32')][_0x7b77('0x3f')]){_0x41a34c['where']=_[_0x7b77('0x40')](_0x41a34c[_0x7b77('0x3d')],{'$or':_[_0x7b77('0x2c')](_0x41a34c['attributes'],function(_0x8af1cc){var _0x2f4a00={};_0x2f4a00[_0x8af1cc]={'$like':'%'+_0xf1ef6f[_0x7b77('0x32')]['filter']+'%'};return _0x2f4a00;})});}_0x41a34c=_[_0x7b77('0x40')]({},_0x41a34c,_0xf1ef6f[_0x7b77('0x47')]);return _0x535bb7['getActions'](_0x41a34c);}})[_0x7b77('0x27')](function(_0x4171b5){if(_0x4171b5){_0x301bb4=_0x4171b5[_0x7b77('0x38')];if(!_0xf1ef6f[_0x7b77('0x32')][_0x7b77('0x39')](_0x7b77('0x3a'))){_0x41a34c[_0x7b77('0x3b')]=qs[_0x7b77('0x3b')](_0xf1ef6f['query']['limit']);_0x41a34c[_0x7b77('0x1e')]=qs['offset'](_0xf1ef6f['query']['offset']);}return _0x535bb7[_0x7b77('0x5f')](_0x41a34c);}})['then'](function(_0x39044b){if(_0x39044b){return _0x39044b?{'count':_0x301bb4,'rows':_0x39044b}:null;}})[_0x7b77('0x27')](respondWithResult(_0x5e96df,null))[_0x7b77('0x52')](handleError(_0x5e96df,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 9c76075..89b1a4e 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 _0x61a1=['moment','request-promise','path','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api'];(function(_0xcfaf9b,_0x58dd0b){var _0x455285=function(_0x6c82b5){while(--_0x6c82b5){_0xcfaf9b['push'](_0xcfaf9b['shift']());}};_0x455285(++_0x58dd0b);}(_0x61a1,0x127));var _0x161a=function(_0x2a238a,_0x1d5054){_0x2a238a=_0x2a238a-0x0;var _0xeef802=_0x61a1[_0x2a238a];return _0xeef802;};'use strict';var _=require(_0x161a('0x0'));var util=require(_0x161a('0x1'));var logger=require(_0x161a('0x2'))(_0x161a('0x3'));var moment=require(_0x161a('0x4'));var BPromise=require('bluebird');var rp=require(_0x161a('0x5'));var fs=require('fs');var path=require(_0x161a('0x6'));var rimraf=require('rimraf');var config=require(_0x161a('0x7'));var attributes=require(_0x161a('0x8'));module[_0x161a('0x9')]=function(_0x1442cf,_0x1bb0ac){return _0x1442cf[_0x161a('0xa')](_0x161a('0xb'),attributes,{'tableName':_0x161a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68fc=['bluebird','path','./trigger.attributes','exports','tools_triggers','lodash','util','../../config/logger'];(function(_0x2fe2f4,_0x5f1fbc){var _0x3b5a6b=function(_0x3c750e){while(--_0x3c750e){_0x2fe2f4['push'](_0x2fe2f4['shift']());}};_0x3b5a6b(++_0x5f1fbc);}(_0x68fc,0xa5));var _0xc68f=function(_0x506ff0,_0x1d94e5){_0x506ff0=_0x506ff0-0x0;var _0x303439=_0x68fc[_0x506ff0];return _0x303439;};'use strict';var _=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var logger=require(_0xc68f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc68f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc68f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc68f('0x5'));module[_0xc68f('0x6')]=function(_0x1c6df9,_0x363cdf){return _0x1c6df9['define']('Trigger',attributes,{'tableName':_0xc68f('0x7'),'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 6f444c2..c7bb756 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 _0x219a=['http','request','then','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetTrigger','Trigger','options','raw','where','attributes','limit','map','include','model','debug','ShowTrigger','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x820307,_0x33406b){var _0x551324=function(_0x1f1e54){while(--_0x1f1e54){_0x820307['push'](_0x820307['shift']());}};_0x551324(++_0x33406b);}(_0x219a,0xdf));var _0xa219=function(_0x5806f7,_0x415618){_0x5806f7=_0x5806f7-0x0;var _0x2ef419=_0x219a[_0x5806f7];return _0x2ef419;};'use strict';var _=require('lodash');var util=require(_0xa219('0x0'));var moment=require('moment');var BPromise=require(_0xa219('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa219('0x2'));var db=require(_0xa219('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa219('0x4'))(_0xa219('0x5'));var config=require(_0xa219('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa219('0x7')][_0xa219('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x30645d,_0x49125c,_0x49f220){return new BPromise(function(_0x4983f5,_0xc97fb7){return client[_0xa219('0x9')](_0x30645d,_0x49f220)[_0xa219('0xa')](function(_0x21fc05){logger['info'](_0xa219('0xb'),_0x49125c,_0xa219('0xc'));logger['debug'](_0xa219('0xd'),_0x49125c,_0xa219('0xc'),JSON[_0xa219('0xe')](_0x21fc05));if(_0x21fc05['error']){if(_0x21fc05[_0xa219('0xf')][_0xa219('0x10')]===0x1f4){logger[_0xa219('0xf')](_0xa219('0xb'),_0x49125c,_0x21fc05['error'][_0xa219('0x11')]);return _0xc97fb7(_0x21fc05[_0xa219('0xf')][_0xa219('0x11')]);}logger['error'](_0xa219('0xb'),_0x49125c,_0x21fc05[_0xa219('0xf')]['message']);return _0x4983f5(_0x21fc05[_0xa219('0xf')][_0xa219('0x11')]);}else{logger[_0xa219('0x12')]('Trigger,\x20%s,\x20%s',_0x49125c,_0xa219('0xc'));_0x4983f5(_0x21fc05[_0xa219('0x13')][_0xa219('0x11')]);}})[_0xa219('0x14')](function(_0x4db3c4){logger['error'](_0xa219('0xb'),_0x49125c,_0x4db3c4);_0xc97fb7(_0x4db3c4);});});}exports[_0xa219('0x15')]=function(_0xd87589){var _0x5a2b99=this;return new Promise(function(_0x585f5a,_0x2e630b){return db[_0xa219('0x16')]['findAll']({'raw':_0xd87589[_0xa219('0x17')]?_0xd87589[_0xa219('0x17')][_0xa219('0x18')]===undefined?!![]:![]:!![],'where':_0xd87589['options']?_0xd87589['options'][_0xa219('0x19')]||null:null,'attributes':_0xd87589[_0xa219('0x17')]?_0xd87589[_0xa219('0x17')][_0xa219('0x1a')]||null:null,'limit':_0xd87589[_0xa219('0x17')]?_0xd87589['options'][_0xa219('0x1b')]||null:null,'include':_0xd87589[_0xa219('0x17')]?_0xd87589[_0xa219('0x17')]['include']?_[_0xa219('0x1c')](_0xd87589[_0xa219('0x17')][_0xa219('0x1d')],function(_0x581dbd){return{'model':db[_0x581dbd[_0xa219('0x1e')]],'as':_0x581dbd['as'],'attributes':_0x581dbd[_0xa219('0x1a')],'include':_0x581dbd['include']?_['map'](_0x581dbd[_0xa219('0x1d')],function(_0x40627b){return{'model':db[_0x40627b['model']],'as':_0x40627b['as'],'attributes':_0x40627b[_0xa219('0x1a')],'include':_0x40627b[_0xa219('0x1d')]?_['map'](_0x40627b['include'],function(_0x2e51de){return{'model':db[_0x2e51de[_0xa219('0x1e')]],'as':_0x2e51de['as'],'attributes':_0x2e51de[_0xa219('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa219('0xa')](function(_0x44264a){logger[_0xa219('0x12')](_0xa219('0x15'),_0xd87589);logger[_0xa219('0x1f')](_0xa219('0x15'),_0xd87589,JSON['stringify'](_0x44264a));_0x585f5a(_0x44264a);})[_0xa219('0x14')](function(_0x12354c){logger[_0xa219('0xf')]('GetTrigger',_0x12354c[_0xa219('0x11')],_0xd87589);_0x2e630b(_0x5a2b99['error'](0x1f4,_0x12354c[_0xa219('0x11')]));});});};exports[_0xa219('0x20')]=function(_0x3292d9){var _0x2a81f7=this;return new Promise(function(_0x433266,_0x18e64f){return db[_0xa219('0x16')]['find']({'raw':_0x3292d9[_0xa219('0x17')]?_0x3292d9[_0xa219('0x17')][_0xa219('0x18')]===undefined?!![]:![]:!![],'where':_0x3292d9['options']?_0x3292d9[_0xa219('0x17')][_0xa219('0x19')]||null:null,'attributes':_0x3292d9['options']?_0x3292d9['options'][_0xa219('0x1a')]||null:null,'include':_0x3292d9[_0xa219('0x17')]?_0x3292d9['options']['include']?_['map'](_0x3292d9['options']['include'],function(_0xb2818e){return{'model':db[_0xb2818e[_0xa219('0x1e')]],'as':_0xb2818e['as'],'attributes':_0xb2818e['attributes'],'include':_0xb2818e[_0xa219('0x1d')]?_[_0xa219('0x1c')](_0xb2818e['include'],function(_0x4579e7){return{'model':db[_0x4579e7['model']],'as':_0x4579e7['as'],'attributes':_0x4579e7[_0xa219('0x1a')],'include':_0x4579e7[_0xa219('0x1d')]?_[_0xa219('0x1c')](_0x4579e7['include'],function(_0x27439d){return{'model':db[_0x27439d['model']],'as':_0x27439d['as'],'attributes':_0x27439d[_0xa219('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa219('0xa')](function(_0x4151fd){logger[_0xa219('0x12')](_0xa219('0x20'),_0x3292d9);logger['debug'](_0xa219('0x20'),_0x3292d9,JSON['stringify'](_0x4151fd));_0x433266(_0x4151fd);})[_0xa219('0x14')](function(_0x5a3660){logger[_0xa219('0xf')](_0xa219('0x20'),_0x5a3660[_0xa219('0x11')],_0x3292d9);_0x18e64f(_0x2a81f7[_0xa219('0xf')](0x1f4,_0x5a3660[_0xa219('0x11')]));});});}; \ No newline at end of file +var _0x5c4b=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','GetTrigger','Trigger','options','raw','where','attributes','map','include','model','catch','ShowTrigger','find','debug','lodash','util','bluebird'];(function(_0x32aa7c,_0x4280f7){var _0xbbacae=function(_0x556c6f){while(--_0x556c6f){_0x32aa7c['push'](_0x32aa7c['shift']());}};_0xbbacae(++_0x4280f7);}(_0x5c4b,0xbd));var _0xb5c4=function(_0x4950d2,_0xb7909d){_0x4950d2=_0x4950d2-0x0;var _0x6ea4f5=_0x5c4b[_0x4950d2];return _0x6ea4f5;};'use strict';var _=require(_0xb5c4('0x0'));var util=require(_0xb5c4('0x1'));var moment=require('moment');var BPromise=require(_0xb5c4('0x2'));var rs=require(_0xb5c4('0x3'));var fs=require('fs');var Redis=require(_0xb5c4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb5c4('0x5'))(_0xb5c4('0x6'));var config=require(_0xb5c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb5c4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b8d9d,_0x314ab1,_0x296141){return new BPromise(function(_0x11c283,_0x1d802b){return client[_0xb5c4('0x9')](_0x5b8d9d,_0x296141)[_0xb5c4('0xa')](function(_0x598c46){logger[_0xb5c4('0xb')]('Trigger,\x20%s,\x20%s',_0x314ab1,_0xb5c4('0xc'));logger['debug'](_0xb5c4('0xd'),_0x314ab1,'request\x20sent',JSON[_0xb5c4('0xe')](_0x598c46));if(_0x598c46[_0xb5c4('0xf')]){if(_0x598c46[_0xb5c4('0xf')]['code']===0x1f4){logger[_0xb5c4('0xf')](_0xb5c4('0x10'),_0x314ab1,_0x598c46[_0xb5c4('0xf')]['message']);return _0x1d802b(_0x598c46[_0xb5c4('0xf')][_0xb5c4('0x11')]);}logger[_0xb5c4('0xf')]('Trigger,\x20%s,\x20%s',_0x314ab1,_0x598c46['error'][_0xb5c4('0x11')]);return _0x11c283(_0x598c46['error'][_0xb5c4('0x11')]);}else{logger[_0xb5c4('0xb')](_0xb5c4('0x10'),_0x314ab1,_0xb5c4('0xc'));_0x11c283(_0x598c46[_0xb5c4('0x12')]['message']);}})['catch'](function(_0x4cddae){logger['error'](_0xb5c4('0x10'),_0x314ab1,_0x4cddae);_0x1d802b(_0x4cddae);});});}exports[_0xb5c4('0x13')]=function(_0x2d1ee0){var _0x8d8a8f=this;return new Promise(function(_0x594076,_0x3ad887){return db[_0xb5c4('0x14')]['findAll']({'raw':_0x2d1ee0[_0xb5c4('0x15')]?_0x2d1ee0['options'][_0xb5c4('0x16')]===undefined?!![]:![]:!![],'where':_0x2d1ee0[_0xb5c4('0x15')]?_0x2d1ee0[_0xb5c4('0x15')][_0xb5c4('0x17')]||null:null,'attributes':_0x2d1ee0['options']?_0x2d1ee0[_0xb5c4('0x15')][_0xb5c4('0x18')]||null:null,'limit':_0x2d1ee0['options']?_0x2d1ee0[_0xb5c4('0x15')]['limit']||null:null,'include':_0x2d1ee0[_0xb5c4('0x15')]?_0x2d1ee0[_0xb5c4('0x15')]['include']?_[_0xb5c4('0x19')](_0x2d1ee0['options'][_0xb5c4('0x1a')],function(_0x2b1d32){return{'model':db[_0x2b1d32[_0xb5c4('0x1b')]],'as':_0x2b1d32['as'],'attributes':_0x2b1d32[_0xb5c4('0x18')],'include':_0x2b1d32['include']?_['map'](_0x2b1d32['include'],function(_0x2f7647){return{'model':db[_0x2f7647[_0xb5c4('0x1b')]],'as':_0x2f7647['as'],'attributes':_0x2f7647[_0xb5c4('0x18')],'include':_0x2f7647['include']?_[_0xb5c4('0x19')](_0x2f7647[_0xb5c4('0x1a')],function(_0x47a41b){return{'model':db[_0x47a41b[_0xb5c4('0x1b')]],'as':_0x47a41b['as'],'attributes':_0x47a41b[_0xb5c4('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x417f2f){logger[_0xb5c4('0xb')](_0xb5c4('0x13'),_0x2d1ee0);logger['debug'](_0xb5c4('0x13'),_0x2d1ee0,JSON[_0xb5c4('0xe')](_0x417f2f));_0x594076(_0x417f2f);})[_0xb5c4('0x1c')](function(_0x49bb15){logger[_0xb5c4('0xf')]('GetTrigger',_0x49bb15[_0xb5c4('0x11')],_0x2d1ee0);_0x3ad887(_0x8d8a8f[_0xb5c4('0xf')](0x1f4,_0x49bb15['message']));});});};exports[_0xb5c4('0x1d')]=function(_0x943c0){var _0x5b3663=this;return new Promise(function(_0x554140,_0x1553be){return db[_0xb5c4('0x14')][_0xb5c4('0x1e')]({'raw':_0x943c0[_0xb5c4('0x15')]?_0x943c0[_0xb5c4('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x943c0[_0xb5c4('0x15')]?_0x943c0['options'][_0xb5c4('0x17')]||null:null,'attributes':_0x943c0['options']?_0x943c0[_0xb5c4('0x15')][_0xb5c4('0x18')]||null:null,'include':_0x943c0[_0xb5c4('0x15')]?_0x943c0[_0xb5c4('0x15')][_0xb5c4('0x1a')]?_['map'](_0x943c0[_0xb5c4('0x15')][_0xb5c4('0x1a')],function(_0x105c1d){return{'model':db[_0x105c1d['model']],'as':_0x105c1d['as'],'attributes':_0x105c1d[_0xb5c4('0x18')],'include':_0x105c1d[_0xb5c4('0x1a')]?_[_0xb5c4('0x19')](_0x105c1d[_0xb5c4('0x1a')],function(_0x52d692){return{'model':db[_0x52d692[_0xb5c4('0x1b')]],'as':_0x52d692['as'],'attributes':_0x52d692[_0xb5c4('0x18')],'include':_0x52d692[_0xb5c4('0x1a')]?_[_0xb5c4('0x19')](_0x52d692[_0xb5c4('0x1a')],function(_0x1023ee){return{'model':db[_0x1023ee[_0xb5c4('0x1b')]],'as':_0x1023ee['as'],'attributes':_0x1023ee[_0xb5c4('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f1733){logger['info'](_0xb5c4('0x1d'),_0x943c0);logger[_0xb5c4('0x1f')](_0xb5c4('0x1d'),_0x943c0,JSON['stringify'](_0x2f1733));_0x554140(_0x2f1733);})[_0xb5c4('0x1c')](function(_0x262e5c){logger[_0xb5c4('0xf')](_0xb5c4('0x1d'),_0x262e5c[_0xb5c4('0x11')],_0x943c0);_0x1553be(_0x5b3663['error'](0x1f4,_0x262e5c[_0xb5c4('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 5f85a29..48941da 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 _0x7b7d=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','index','get','/:id','show','post','/:id/clone','clone','create','destroy','exports','multer','util'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7b7d,0xae));var _0xd7b7=function(_0x458420,_0x47f6e){_0x458420=_0x458420-0x0;var _0x3fab64=_0x7b7d[_0x458420];return _0x3fab64;};'use strict';var multer=require(_0xd7b7('0x0'));var util=require(_0xd7b7('0x1'));var path=require(_0xd7b7('0x2'));var timeout=require(_0xd7b7('0x3'));var express=require(_0xd7b7('0x4'));var router=express[_0xd7b7('0x5')]();var fs_extra=require(_0xd7b7('0x6'));var auth=require(_0xd7b7('0x7'));var interaction=require(_0xd7b7('0x8'));var config=require(_0xd7b7('0x9'));var controller=require(_0xd7b7('0xa'));router['get']('/',auth[_0xd7b7('0xb')](),controller[_0xd7b7('0xc')]);router[_0xd7b7('0xd')](_0xd7b7('0xe'),auth[_0xd7b7('0xb')](),controller[_0xd7b7('0xf')]);router[_0xd7b7('0x10')](_0xd7b7('0x11'),auth[_0xd7b7('0xb')](),controller[_0xd7b7('0x12')]);router[_0xd7b7('0x10')]('/',auth['isAuthenticated'](),controller[_0xd7b7('0x13')]);router['put'](_0xd7b7('0xe'),auth[_0xd7b7('0xb')](),controller['update']);router['delete'](_0xd7b7('0xe'),auth[_0xd7b7('0xb')](),controller[_0xd7b7('0x14')]);module[_0xd7b7('0x15')]=router; \ No newline at end of file +var _0x23e8=['./trunk.controller','get','index','show','post','isAuthenticated','clone','create','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3fd6ae,_0x332c75){var _0x204d55=function(_0xe316f3){while(--_0xe316f3){_0x3fd6ae['push'](_0x3fd6ae['shift']());}};_0x204d55(++_0x332c75);}(_0x23e8,0xac));var _0x823e=function(_0x39d294,_0xcb7a37){_0x39d294=_0x39d294-0x0;var _0x37c63f=_0x23e8[_0x39d294];return _0x37c63f;};'use strict';var multer=require(_0x823e('0x0'));var util=require(_0x823e('0x1'));var path=require('path');var timeout=require(_0x823e('0x2'));var express=require(_0x823e('0x3'));var router=express[_0x823e('0x4')]();var fs_extra=require(_0x823e('0x5'));var auth=require(_0x823e('0x6'));var interaction=require(_0x823e('0x7'));var config=require('../../config/environment');var controller=require(_0x823e('0x8'));router[_0x823e('0x9')]('/',auth['isAuthenticated'](),controller[_0x823e('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x823e('0xb')]);router[_0x823e('0xc')]('/:id/clone',auth[_0x823e('0xd')](),controller[_0x823e('0xe')]);router['post']('/',auth[_0x823e('0xd')](),controller[_0x823e('0xf')]);router['put'](_0x823e('0x10'),auth['isAuthenticated'](),controller[_0x823e('0x11')]);router['delete']('/:id',auth[_0x823e('0xd')](),controller[_0x823e('0x12')]);module[_0x823e('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index c0bef0d..62eb3b3 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 _0x46dd=['split','rfc2833','info','inband','auto','yes','nonat','update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','certificate','active','actpass','update,nonat','sequelize','exports','ENUM','friend','user','peer','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue'];(function(_0x3f4875,_0x1eee06){var _0x1727cf=function(_0x92fc15){while(--_0x92fc15){_0x3f4875['push'](_0x3f4875['shift']());}};_0x1727cf(++_0x1eee06);}(_0x46dd,0x7d));var _0xd46d=function(_0x1a4a06,_0x36a5c2){_0x1a4a06=_0x1a4a06-0x0;var _0x49ec08=_0x46dd[_0x1a4a06];return _0x49ec08;};'use strict';var Sequelize=require(_0xd46d('0x0'));module[_0xd46d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd46d('0x2')](_0xd46d('0x3'),_0xd46d('0x4'),_0xd46d('0x5')),'allowNull':![],'defaultValue':_0xd46d('0x3')},'context':{'type':Sequelize[_0xd46d('0x6')],'allowNull':![],'defaultValue':_0xd46d('0x7')},'callingpres':{'type':Sequelize[_0xd46d('0x2')](_0xd46d('0x8'),_0xd46d('0x9'),'ALLOWED_FAILED_SCREEN',_0xd46d('0xa'),_0xd46d('0xb'),_0xd46d('0xc'),_0xd46d('0xd'),_0xd46d('0xe'))},'deny':{'type':Sequelize[_0xd46d('0x6')]},'permit':{'type':Sequelize[_0xd46d('0x6')]},'secret':{'type':Sequelize[_0xd46d('0x6')]},'md5secret':{'type':Sequelize[_0xd46d('0x6')]},'remotesecret':{'type':Sequelize[_0xd46d('0x6')]},'transport':{'type':Sequelize[_0xd46d('0x6')],'defaultValue':'udp','set':function(_0x4a35a1){this[_0xd46d('0xf')](_0xd46d('0x10'),_0x4a35a1?_0x4a35a1[_0xd46d('0x11')](','):null);},'get':function(){return this[_0xd46d('0x12')](_0xd46d('0x10'))?this[_0xd46d('0x12')]('transport')[_0xd46d('0x13')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xd46d('0x2')](_0xd46d('0x14'),_0xd46d('0x15'),'shortinfo',_0xd46d('0x16'),_0xd46d('0x17')),'defaultValue':_0xd46d('0x14')},'directmedia':{'type':Sequelize[_0xd46d('0x2')](_0xd46d('0x18'),'no',_0xd46d('0x19'),_0xd46d('0x1a'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xd46d('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd46d('0x6')]},'directmediadeny':{'type':Sequelize[_0xd46d('0x6')]},'nat':{'type':Sequelize[_0xd46d('0x6')],'defaultValue':'force_rport,comedia','set':function(_0x1c5be9){this['setDataValue'](_0xd46d('0x1b'),_0x1c5be9?_0x1c5be9[_0xd46d('0x11')](','):null);},'get':function(){return this[_0xd46d('0x12')]('nat')?this[_0xd46d('0x12')](_0xd46d('0x1b'))[_0xd46d('0x13')](','):null;},'comment':_0xd46d('0x1c')},'callgroup':{'type':Sequelize[_0xd46d('0x6')]},'namedcallgroup':{'type':Sequelize[_0xd46d('0x6')]},'pickupgroup':{'type':Sequelize[_0xd46d('0x6')]},'namedpickupgroup':{'type':Sequelize[_0xd46d('0x6')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xd46d('0x6')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xd46d('0x6')],'allowNull':![],'defaultValue':_0xd46d('0x1d'),'set':function(_0x9f10ae){this['setDataValue'](_0xd46d('0x1e'),_0x9f10ae?_0x9f10ae[_0xd46d('0x11')](';'):_0xd46d('0x1d'));},'get':function(){return this['getDataValue'](_0xd46d('0x1e'))?this[_0xd46d('0x12')](_0xd46d('0x1e'))[_0xd46d('0x13')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xd46d('0x2')](_0xd46d('0x18'),'no')},'insecure':{'type':Sequelize[_0xd46d('0x6')],'defaultValue':_0xd46d('0x1f'),'set':function(_0x4ed40a){this[_0xd46d('0xf')](_0xd46d('0x20'),_0x4ed40a?_0x4ed40a['join'](','):null);},'get':function(){return this[_0xd46d('0x12')](_0xd46d('0x20'))?this[_0xd46d('0x12')]('insecure')[_0xd46d('0x13')](','):null;},'comment':_0xd46d('0x21')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xd46d('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd46d('0x2')](_0xd46d('0x18'),'no',_0xd46d('0x22'))},'promiscredir':{'type':Sequelize[_0xd46d('0x2')](_0xd46d('0x18'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xd46d('0x18'),'no')},'accountcode':{'type':Sequelize[_0xd46d('0x23')](0xb)},'setvar':{'type':Sequelize[_0xd46d('0x6')]},'callerid':{'type':Sequelize[_0xd46d('0x6')],'defaultValue':_0xd46d('0x24')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xd46d('0x2')](_0xd46d('0x18'),'no'),'defaultValue':_0xd46d('0x18')},'busylevel':{'type':Sequelize[_0xd46d('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0xd46d('0x2')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0xd46d('0x2')](_0xd46d('0x18'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xd46d('0x18'),'no')},'ignoresdpversion':{'type':Sequelize[_0xd46d('0x2')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xd46d('0x6')]},'videosupport':{'type':Sequelize[_0xd46d('0x2')]('yes','no',_0xd46d('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd46d('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0xd46d('0x6')]},'session_timers':{'type':Sequelize[_0xd46d('0x2')](_0xd46d('0x26'),_0xd46d('0x27'),_0xd46d('0x28'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xd46d('0x29'),_0xd46d('0x2a')),'defaultValue':_0xd46d('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0xd46d('0x6')]},'regexten':{'type':Sequelize[_0xd46d('0x6')]},'fromdomain':{'type':Sequelize[_0xd46d('0x6')]},'fromuser':{'type':Sequelize[_0xd46d('0x6')]},'port':{'type':Sequelize[_0xd46d('0x23')](0x5)},'qualify':{'type':Sequelize[_0xd46d('0x2')]('yes','no'),'defaultValue':_0xd46d('0x18')},'keepalive':{'type':Sequelize[_0xd46d('0x23')](0xb)},'defaultip':{'type':Sequelize[_0xd46d('0x6')]},'defaultuser':{'type':Sequelize[_0xd46d('0x6')]},'rtptimeout':{'type':Sequelize[_0xd46d('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xd46d('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0xd46d('0x2')](_0xd46d('0x18'),'no',_0xd46d('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd46d('0x6')]},'callbackextension':{'type':Sequelize[_0xd46d('0x6')]},'timert1':{'type':Sequelize[_0xd46d('0x23')](0xb)},'timerb':{'type':Sequelize[_0xd46d('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0xd46d('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0xd46d('0x6')]},'contactdeny':{'type':Sequelize[_0xd46d('0x6')]},'contactacl':{'type':Sequelize[_0xd46d('0x6')]},'unsolicited_mailbox':{'type':Sequelize[_0xd46d('0x6')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xd46d('0x23')](0xb)},'encryption':{'type':Sequelize[_0xd46d('0x2')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xd46d('0x2')]('yes','no')},'force_avp':{'type':Sequelize[_0xd46d('0x2')]('yes','no')},'icesupport':{'type':Sequelize[_0xd46d('0x2')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xd46d('0x2')](_0xd46d('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0xd46d('0x2')](_0xd46d('0x18'),'no','fingerprint',_0xd46d('0x2c'))},'dtlsrekey':{'type':Sequelize[_0xd46d('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0xd46d('0x6')]},'dtlsprivatekey':{'type':Sequelize[_0xd46d('0x6')]},'dtlscipher':{'type':Sequelize[_0xd46d('0x6')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xd46d('0x6')]},'dtlssetup':{'type':Sequelize[_0xd46d('0x2')](_0xd46d('0x2d'),'passive',_0xd46d('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xd46d('0x2')](_0xd46d('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd46d('0x6')]},'recordofffeature':{'type':Sequelize[_0xd46d('0x6')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xd46d('0x2')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xd46d('0x6')]},'mohsuggest':{'type':Sequelize[_0xd46d('0x6')]},'parkinglot':{'type':Sequelize[_0xd46d('0x6')]},'description':{'type':Sequelize[_0xd46d('0x6')]},'host':{'type':Sequelize[_0xd46d('0x6')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xd46d('0x2')](_0xd46d('0x18'),'no',_0xd46d('0x19'),_0xd46d('0x1a'),_0xd46d('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xd46d('0x6')]},'otherFields':{'type':Sequelize[_0xd46d('0x6')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xd46d('0x6')],'defaultValue':'no'}}; \ No newline at end of file +var _0x9597=['update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','join','allow','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','uas','certificate','active','actpass','dynamic','BOOLEAN','exports','STRING','name','ENUM','user','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','yes','nonat'];(function(_0x1fd91a,_0x407662){var _0x3dc9ff=function(_0x3137d0){while(--_0x3137d0){_0x1fd91a['push'](_0x1fd91a['shift']());}};_0x3dc9ff(++_0x407662);}(_0x9597,0xcb));var _0x7959=function(_0x4dbf71,_0x153da8){_0x4dbf71=_0x4dbf71-0x0;var _0x1ae202=_0x9597[_0x4dbf71];return _0x1ae202;};'use strict';var Sequelize=require('sequelize');module[_0x7959('0x0')]={'name':{'type':Sequelize[_0x7959('0x1')],'allowNull':![],'unique':_0x7959('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7959('0x3')]('friend',_0x7959('0x4'),'peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x7959('0x1')],'allowNull':![],'defaultValue':_0x7959('0x5')},'callingpres':{'type':Sequelize[_0x7959('0x3')]('ALLOWED_NOT_SCREENED',_0x7959('0x6'),_0x7959('0x7'),_0x7959('0x8'),_0x7959('0x9'),_0x7959('0xa'),_0x7959('0xb'),_0x7959('0xc'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x7959('0x1')]},'secret':{'type':Sequelize[_0x7959('0x1')]},'md5secret':{'type':Sequelize[_0x7959('0x1')]},'remotesecret':{'type':Sequelize[_0x7959('0x1')]},'transport':{'type':Sequelize[_0x7959('0x1')],'defaultValue':'udp','set':function(_0x518b11){this[_0x7959('0xd')](_0x7959('0xe'),_0x518b11?_0x518b11['join'](','):null);},'get':function(){return this[_0x7959('0xf')]('transport')?this[_0x7959('0xf')](_0x7959('0xe'))['split'](','):null;},'comment':_0x7959('0x10')},'dtmfmode':{'type':Sequelize['ENUM'](_0x7959('0x11'),'info',_0x7959('0x12'),_0x7959('0x13'),'auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no',_0x7959('0x15'),_0x7959('0x16'),_0x7959('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7959('0x1')]},'directmediadeny':{'type':Sequelize[_0x7959('0x1')]},'nat':{'type':Sequelize[_0x7959('0x1')],'defaultValue':_0x7959('0x18'),'set':function(_0x39ca2c){this['setDataValue']('nat',_0x39ca2c?_0x39ca2c['join'](','):null);},'get':function(){return this[_0x7959('0xf')](_0x7959('0x19'))?this[_0x7959('0xf')](_0x7959('0x19'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x7959('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x7959('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x7959('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7959('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x7959('0x1')],'defaultValue':_0x7959('0x1a')},'allow':{'type':Sequelize[_0x7959('0x1')],'allowNull':![],'defaultValue':_0x7959('0x1b'),'set':function(_0x1a38d0){this[_0x7959('0xd')]('allow',_0x1a38d0?_0x1a38d0[_0x7959('0x1c')](';'):_0x7959('0x1b'));},'get':function(){return this[_0x7959('0xf')](_0x7959('0x1d'))?this[_0x7959('0xf')](_0x7959('0x1d'))[_0x7959('0x1e')](';'):null;},'comment':_0x7959('0x1f')},'autoframing':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no')},'insecure':{'type':Sequelize[_0x7959('0x1')],'defaultValue':_0x7959('0x20'),'set':function(_0x1194ec){this[_0x7959('0xd')](_0x7959('0x21'),_0x1194ec?_0x1194ec[_0x7959('0x1c')](','):null);},'get':function(){return this[_0x7959('0xf')](_0x7959('0x21'))?this[_0x7959('0xf')]('insecure')[_0x7959('0x1e')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x7959('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no',_0x7959('0x22'))},'promiscredir':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no')},'useclientcode':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no')},'accountcode':{'type':Sequelize[_0x7959('0x23')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x7959('0x1')],'defaultValue':_0x7959('0x24')},'amaflags':{'type':Sequelize[_0x7959('0x1')]},'callcounter':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x7959('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0x7959('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x7959('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x7959('0x1')]},'videosupport':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no',_0x7959('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7959('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x7959('0x14'),'no')},'mailbox':{'type':Sequelize[_0x7959('0x1')]},'session_timers':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x26'),'refuse','originate')},'session_expires':{'type':Sequelize[_0x7959('0x23')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x7959('0x3')]('uac',_0x7959('0x27')),'defaultValue':_0x7959('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0x7959('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x7959('0x1')]},'fromuser':{'type':Sequelize[_0x7959('0x1')]},'port':{'type':Sequelize[_0x7959('0x23')](0x5)},'qualify':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no'),'defaultValue':_0x7959('0x14')},'keepalive':{'type':Sequelize[_0x7959('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x7959('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x7959('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x7959('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x7959('0x23')](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x7959('0x1')]},'callbackextension':{'type':Sequelize[_0x7959('0x1')]},'timert1':{'type':Sequelize[_0x7959('0x23')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x7959('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x7959('0x1')]},'contactdeny':{'type':Sequelize[_0x7959('0x1')]},'contactacl':{'type':Sequelize[_0x7959('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x7959('0x1')]},'use_q850_reason':{'type':Sequelize[_0x7959('0x1')]},'maxforwards':{'type':Sequelize[_0x7959('0x23')](0xb)},'encryption':{'type':Sequelize[_0x7959('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no')},'force_avp':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no')},'icesupport':{'type':Sequelize[_0x7959('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x7959('0x14'),'no','fingerprint',_0x7959('0x28'))},'dtlsrekey':{'type':Sequelize[_0x7959('0x23')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x7959('0x1')]},'dtlscapath':{'type':Sequelize[_0x7959('0x1')]},'dtlssetup':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x29'),'passive',_0x7959('0x2a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7959('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no')},'subscribemwi':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no')},'vmexten':{'type':Sequelize[_0x7959('0x1')]},'mohinterpret':{'type':Sequelize[_0x7959('0x1')]},'mohsuggest':{'type':Sequelize[_0x7959('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7959('0x1')]},'host':{'type':Sequelize[_0x7959('0x1')],'defaultValue':_0x7959('0x2b')},'canreinvite':{'type':Sequelize[_0x7959('0x3')](_0x7959('0x14'),'no',_0x7959('0x15'),_0x7959('0x16'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x7959('0x1')]},'otherFields':{'type':Sequelize[_0x7959('0x1')]},'active':{'type':Sequelize[_0x7959('0x2c')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x7959('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index fcbe579..bc35f69 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 _0x9bde=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','VIRTUAL','merge','Trunk','includeAll','findAll','rows','show','params','fields','include','options','clone','find','omit','createdAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/registry.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','root','server/files/templates/trunk.ejs','writeFileSync','rimraf'];(function(_0x13a68a,_0x2daaaa){var _0x27f857=function(_0x17b3a1){while(--_0x17b3a1){_0x13a68a['push'](_0x13a68a['shift']());}};_0x27f857(++_0x2daaaa);}(_0x9bde,0xe1));var _0xe9bd=function(_0x38a16f,_0x24298e){_0x38a16f=_0x38a16f-0x0;var _0x581bcf=_0x9bde[_0x38a16f];return _0x581bcf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe9bd('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x220d07,_0x429e88,_0x3435b4,_0x51109f){return new BPromise(function(_0x47ba5e,_0x46a95e){var _0x248818=_0x51109f||client;return _0x248818[_0xe9bd('0x1a')](_0x220d07,_0x3435b4)[_0xe9bd('0x1b')](function(_0x3360bd){logger[_0xe9bd('0x1c')](_0xe9bd('0x1d'),_0x429e88,'request\x20sent');logger[_0xe9bd('0x1e')](_0xe9bd('0x1f'),_0x429e88,_0xe9bd('0x20'),JSON['stringify'](_0x3360bd));if(_0x3360bd[_0xe9bd('0x21')]){if(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x22')]===0x1f4){logger[_0xe9bd('0x21')]('Trunk,\x20%s,\x20%s',_0x429e88,_0x3360bd[_0xe9bd('0x21')]['message']);return _0x46a95e(_0x3360bd[_0xe9bd('0x21')]['message']);}logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);return _0x47ba5e(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);}else{logger[_0xe9bd('0x1c')]('Trunk,\x20%s,\x20%s',_0x429e88,_0xe9bd('0x20'));_0x47ba5e(_0x3360bd[_0xe9bd('0x24')]['message']);}})[_0xe9bd('0x25')](function(_0x505c23){logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x505c23);_0x46a95e(_0x505c23);});});}function respondWithStatusCode(_0x36f8c0,_0xf02209){_0xf02209=_0xf02209||0xcc;return function(_0x5bc4bf){if(_0x5bc4bf){return _0x36f8c0[_0xe9bd('0x26')](_0xf02209);}return _0x36f8c0[_0xe9bd('0x27')](_0xf02209)[_0xe9bd('0x28')]();};}function respondWithResult(_0x39b206,_0x2641be){_0x2641be=_0x2641be||0xc8;return function(_0xb52d45){if(_0xb52d45){return _0x39b206[_0xe9bd('0x27')](_0x2641be)[_0xe9bd('0x29')](_0xb52d45);}};}function respondWithFilteredResult(_0x1ae889,_0x5987af){return function(_0x3c211a){if(_0x3c211a){var _0x38fdfa=typeof _0x5987af['offset']===_0xe9bd('0x2a')&&typeof _0x5987af[_0xe9bd('0x2b')]===_0xe9bd('0x2a');var _0x429055=_0x3c211a[_0xe9bd('0x2c')];var _0x183601=_0x38fdfa?0x0:_0x5987af['offset'];var _0x5b7f1d=_0x38fdfa?_0x3c211a[_0xe9bd('0x2c')]:_0x5987af['offset']+_0x5987af[_0xe9bd('0x2b')];var _0x1f2c0e;if(_0x5b7f1d>=_0x429055){_0x5b7f1d=_0x429055;_0x1f2c0e=0xc8;}else{_0x1f2c0e=0xce;}_0x1ae889[_0xe9bd('0x27')](_0x1f2c0e);return _0x1ae889[_0xe9bd('0x2d')](_0xe9bd('0x2e'),_0x183601+'-'+_0x5b7f1d+'/'+_0x429055)['json'](_0x3c211a);}return null;};}function patchUpdates(_0x4b7bc2){return function(_0x7f2c5){try{jsonpatch[_0xe9bd('0x2f')](_0x7f2c5,_0x4b7bc2,!![]);}catch(_0x3f96a0){return BPromise[_0xe9bd('0x30')](_0x3f96a0);}return _0x7f2c5[_0xe9bd('0x31')]();};}function saveUpdates(_0x1f0f9e,_0x3c31ee){return function(_0x66213a){if(_0x66213a){return _0x66213a[_0xe9bd('0x32')](_0x1f0f9e)['then'](function(_0x426004){return _0x426004;});}return null;};}function removeEntity(_0x81a31f,_0x390a43){return function(_0x5117bc){if(_0x5117bc){return _0x5117bc['destroy']()[_0xe9bd('0x1b')](function(){var _0x2e9593=_0x5117bc[_0xe9bd('0x33')]({'plain':!![]});var _0x3ed60a=_0xe9bd('0x34');return db[_0xe9bd('0x35')][_0xe9bd('0x36')]({'where':{'type':_0x3ed60a,'resourceId':_0x2e9593['id']}})[_0xe9bd('0x1b')](function(){return _0x5117bc;});})[_0xe9bd('0x1b')](function(){_0x81a31f[_0xe9bd('0x27')](0xcc)[_0xe9bd('0x28')]();});}};}function handleEntityNotFound(_0x549dd1,_0x2ad46e){return function(_0x199477){if(!_0x199477){_0x549dd1[_0xe9bd('0x26')](0x194);}return _0x199477;};}function handleError(_0x8ff624,_0x264ba0){_0x264ba0=_0x264ba0||0x1f4;return function(_0x147da5){logger['error'](_0x147da5[_0xe9bd('0x37')]);if(_0x147da5[_0xe9bd('0x38')]){delete _0x147da5['name'];}_0x8ff624[_0xe9bd('0x27')](_0x264ba0)[_0xe9bd('0x39')](_0x147da5);};}exports['index']=function(_0x4b1da0,_0x2785e6){var _0xdf43b9={},_0x4d2f3d={},_0x2d1289={'count':0x0,'rows':[]};var _0x3ea705=_[_0xe9bd('0x3a')](db['Trunk'][_0xe9bd('0x3b')],function(_0x4d1945){return{'name':_0x4d1945[_0xe9bd('0x3c')],'type':_0x4d1945[_0xe9bd('0x3d')][_0xe9bd('0x3e')]};});_0x4d2f3d[_0xe9bd('0x3f')]=_['map'](_0x3ea705,_0xe9bd('0x38'));_0x4d2f3d[_0xe9bd('0x40')]=_[_0xe9bd('0x41')](_0x4b1da0[_0xe9bd('0x40')]);_0x4d2f3d[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4d2f3d[_0xe9bd('0x3f')],_0x4d2f3d[_0xe9bd('0x40')]);_0xdf43b9[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x4d2f3d['model'],qs['fields'](_0x4b1da0[_0xe9bd('0x40')]['fields']));_0xdf43b9[_0xe9bd('0x44')]=_0xdf43b9[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xdf43b9['attributes']:_0x4d2f3d[_0xe9bd('0x3f')];if(!_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x46')]('nolimit')){_0xdf43b9[_0xe9bd('0x2b')]=qs[_0xe9bd('0x2b')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x2b')]);_0xdf43b9[_0xe9bd('0x47')]=qs[_0xe9bd('0x47')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x47')]);}_0xdf43b9[_0xe9bd('0x48')]=qs[_0xe9bd('0x49')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x49')]);_0xdf43b9[_0xe9bd('0x4a')]=qs[_0xe9bd('0x42')](_[_0xe9bd('0x4b')](_0x4b1da0['query'],_0x4d2f3d['filters']),_0x3ea705);if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x4c')]){_0xdf43b9[_0xe9bd('0x4a')]=_['merge'](_0xdf43b9['where'],{'$or':_[_0xe9bd('0x3a')](_0x3ea705,function(_0x3f6f22){if(_0x3f6f22[_0xe9bd('0x3d')]!==_0xe9bd('0x4d')){var _0x39fb61={};_0x39fb61[_0x3f6f22[_0xe9bd('0x38')]]={'$like':'%'+_0x4b1da0[_0xe9bd('0x40')]['filter']+'%'};return _0x39fb61;}})});}_0xdf43b9=_[_0xe9bd('0x4e')]({},_0xdf43b9,_0x4b1da0['options']);var _0x36726e={'where':_0xdf43b9[_0xe9bd('0x4a')]};return db[_0xe9bd('0x4f')][_0xe9bd('0x2c')](_0x36726e)[_0xe9bd('0x1b')](function(_0x4b7b67){_0x2d1289[_0xe9bd('0x2c')]=_0x4b7b67;if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xdf43b9['include']=[{'all':!![]}];}return db[_0xe9bd('0x4f')][_0xe9bd('0x51')](_0xdf43b9);})[_0xe9bd('0x1b')](function(_0x5a466b){_0x2d1289[_0xe9bd('0x52')]=_0x5a466b;return _0x2d1289;})[_0xe9bd('0x1b')](respondWithFilteredResult(_0x2785e6,_0xdf43b9))[_0xe9bd('0x25')](handleError(_0x2785e6,null));};exports[_0xe9bd('0x53')]=function(_0x1ee09c,_0x579d26){var _0x3f4833={'raw':![],'where':{'id':_0x1ee09c[_0xe9bd('0x54')]['id']}},_0x4b8ff9={};_0x4b8ff9[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0x4b8ff9['query']=_[_0xe9bd('0x41')](_0x1ee09c['query']);_0x4b8ff9[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4b8ff9['model'],_0x4b8ff9['query']);_0x3f4833[_0xe9bd('0x44')]=_['intersection'](_0x4b8ff9[_0xe9bd('0x3f')],qs['fields'](_0x1ee09c[_0xe9bd('0x40')][_0xe9bd('0x55')]));_0x3f4833['attributes']=_0x3f4833[_0xe9bd('0x44')]['length']?_0x3f4833[_0xe9bd('0x44')]:_0x4b8ff9[_0xe9bd('0x3f')];if(_0x1ee09c[_0xe9bd('0x40')]['includeAll']){_0x3f4833[_0xe9bd('0x56')]=[{'all':!![]}];}_0x3f4833=_[_0xe9bd('0x4e')]({},_0x3f4833,_0x1ee09c[_0xe9bd('0x57')]);return db[_0xe9bd('0x4f')]['find'](_0x3f4833)['then'](handleEntityNotFound(_0x579d26,null))[_0xe9bd('0x1b')](respondWithResult(_0x579d26,null))['catch'](handleError(_0x579d26,null));};exports[_0xe9bd('0x58')]=function(_0x3c33b8,_0xc7dd2f){var _0xc818b4={'where':{'id':_0x3c33b8[_0xe9bd('0x54')]['id']}},_0x159f68={};_0x159f68[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0xc818b4[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x159f68['model'],qs['fields'](_0x3c33b8['query'][_0xe9bd('0x55')]));_0xc818b4['attributes']=_0xc818b4[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xc818b4[_0xe9bd('0x44')]:_0x159f68[_0xe9bd('0x3f')];if(_0x3c33b8[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xc818b4[_0xe9bd('0x56')]=[{'all':!![]}];}_0xc818b4=_[_0xe9bd('0x4e')]({},_0xc818b4,_0x3c33b8[_0xe9bd('0x57')]);return db['Trunk'][_0xe9bd('0x59')](_0xc818b4)[_0xe9bd('0x1b')](handleEntityNotFound(_0xc7dd2f,null))[_0xe9bd('0x1b')](function(_0x3f848d){if(_0x3f848d){var _0x4d58c1=_0x3f848d[_0xe9bd('0x33')]({'plain':!![]});_0x4d58c1=qs[_0xe9bd('0x5a')](_0x4d58c1,['id',_0xe9bd('0x5b'),'updatedAt']);_0x3c33b8[_0xe9bd('0x5c')]=_[_0xe9bd('0x5a')](_0x3c33b8[_0xe9bd('0x5c')],['id',_0xe9bd('0x5b'),'updatedAt']);return db['Trunk'][_0xe9bd('0x5d')](_[_0xe9bd('0x4e')](_0x4d58c1,_0x3c33b8[_0xe9bd('0x5c')]),{'include':_0x3c33b8[_0xe9bd('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x305efa){var _0x20855b=_0x3c33b8[_0xe9bd('0x5e')][_0xe9bd('0x33')]({'plain':!![]});if(!_0x20855b)throw new Error(_0xe9bd('0x5f'));if(_0x20855b[_0xe9bd('0x60')]==='user'){var _0x179c8d=_0x305efa['get']({'plain':!![]});var _0x27e07c=_0xe9bd('0x34');return db[_0xe9bd('0x61')][_0xe9bd('0x59')]({'where':{'name':_0x27e07c,'userProfileId':_0x20855b['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x263ad9){if(_0x263ad9&&_0x263ad9[_0xe9bd('0x62')]===0x0){return db['UserProfileResource'][_0xe9bd('0x5d')]({'name':_0x179c8d[_0xe9bd('0x38')],'resourceId':_0x179c8d['id'],'type':_0x263ad9[_0xe9bd('0x38')],'sectionId':_0x263ad9['id']},{})[_0xe9bd('0x1b')](function(){return _0x305efa;});}else{return _0x305efa;}})[_0xe9bd('0x25')](function(_0x16b66c){logger[_0xe9bd('0x21')](_0xe9bd('0x63'),_0x16b66c);throw _0x16b66c;});}return _0x305efa;});}})[_0xe9bd('0x1b')](respondWithResult(_0xc7dd2f,0xc9))[_0xe9bd('0x25')](handleError(_0xc7dd2f,null));};exports[_0xe9bd('0x5d')]=function(_0x37d07a,_0x5d1e4b,_0x3a12e9){var _0x9d0603;return db['Trunk'][_0xe9bd('0x5d')](_0x37d07a[_0xe9bd('0x5c')],{'raw':!![]})['then'](function(_0x561165){_0x9d0603=_0x561165;return db[_0xe9bd('0x4f')][_0xe9bd('0x51')]({'raw':!![]});})['then'](function(_0x4ec8be){var _0x4a6422=fs[_0xe9bd('0x64')](path['join'](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x1fc88d=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x337284=ejs[_0xe9bd('0x68')](_0x4a6422,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x69'),_0x337284);if(_0x9d0603[_0xe9bd('0x6a')]){var _0x11ebcb=ejs['render'](_0x1fc88d,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x6b'),_0x11ebcb);}})[_0xe9bd('0x1b')](function(){return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x5d'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x1b')](function(){var _0x3fda4c=_0x37d07a[_0xe9bd('0x5e')]['get']({'plain':!![]});if(!_0x3fda4c)throw new Error(_0xe9bd('0x5f'));if(_0x3fda4c[_0xe9bd('0x60')]===_0xe9bd('0x5e')){var _0x3db47a=_0x9d0603[_0xe9bd('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xe9bd('0x59')]({'where':{'name':'Trunks','userProfileId':_0x3fda4c['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x4496e3){if(_0x4496e3&&_0x4496e3['autoAssociation']===0x0){return db[_0xe9bd('0x35')][_0xe9bd('0x5d')]({'name':_0x3db47a[_0xe9bd('0x38')],'resourceId':_0x3db47a['id'],'type':_0x4496e3[_0xe9bd('0x38')],'sectionId':_0x4496e3['id']},{})['then'](function(){return _0x9d0603;});}else{return _0x9d0603;}})[_0xe9bd('0x25')](function(_0x41fb41){logger['error'](_0xe9bd('0x63'),_0x41fb41);throw _0x41fb41;});}return _0x9d0603;})[_0xe9bd('0x1b')](respondWithResult(_0x5d1e4b,0xc9))[_0xe9bd('0x25')](handleError(_0x5d1e4b,null));};exports[_0xe9bd('0x32')]=function(_0x2e63c7,_0x1a36aa,_0x466a89){var _0x5e127b;return db[_0xe9bd('0x4f')][_0xe9bd('0x59')]({'where':{'id':_0x2e63c7[_0xe9bd('0x54')]['id']}})[_0xe9bd('0x1b')](handleEntityNotFound(_0x1a36aa,null))[_0xe9bd('0x1b')](saveUpdates(_0x2e63c7[_0xe9bd('0x5c')],null))[_0xe9bd('0x1b')](function(_0x2adc49){if(_0x2adc49){_0x5e127b=_0x2adc49;return db[_0xe9bd('0x4f')]['findAll']({'raw':!![]});}})[_0xe9bd('0x1b')](function(_0x466952){if(_0x466952){var _0x256890=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),'utf8');var _0x18519d=fs[_0xe9bd('0x64')](path['join'](config[_0xe9bd('0x6e')],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x2083c4=ejs[_0xe9bd('0x68')](_0x256890,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x69'),_0x2083c4);var _0x4f3dc6=ejs['render'](_0x18519d,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x4f3dc6);return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x32'),{'module':_0xe9bd('0x6d')});}return null;})[_0xe9bd('0x1b')](function(_0x1b46f4){if(_0x1b46f4){return _0x5e127b;}})['then'](respondWithResult(_0x1a36aa,null))[_0xe9bd('0x25')](handleError(_0x1a36aa,null));};exports[_0xe9bd('0x36')]=function(_0x29833b,_0x256862,_0x14cdd5){var _0x74063;return db[_0xe9bd('0x4f')]['find']({'where':{'id':_0x29833b['params']['id']}})['then'](handleEntityNotFound(_0x256862,null))[_0xe9bd('0x1b')](removeEntity(_0x256862,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0xe9bd('0x1b')](function(_0x402ab2){var _0xf170d4=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),_0xe9bd('0x67'));var _0x14ec42=fs['readFileSync'](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x22c67f=ejs[_0xe9bd('0x68')](_0xf170d4,{'trunks':_0x402ab2});var _0x416938=ejs['render'](_0x14ec42,{'trunks':_0x402ab2});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x22c67f);fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x416938);return respondWithRpcPromise('Reload',_0xe9bd('0x36'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x25')](handleError(_0x256862,null));}; \ No newline at end of file +var _0x9f62=['updatedAt','body','create','user','role','UserProfileSection','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','render','/etc/asterisk/sip_xcally_trunks.conf','Reload','server/files/templates/registry.ejs','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','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','get','Trunks','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','map','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','Trunk','findAll','rows','show','params','clone','find','omit','createdAt'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0x9f62,0x154));var _0x29f6=function(_0x2cbe06,_0x3c0fba){_0x2cbe06=_0x2cbe06-0x0;var _0x243c46=_0x9f62[_0x2cbe06];return _0x243c46;};'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'];var jayson=require('jayson/promise');var client=jayson['client'][_0x29f6('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x55cf4,_0x189344,_0x11a1fd,_0x17de6e){return new BPromise(function(_0x156c96,_0x35d2e2){var _0x2418ee=_0x17de6e||client;return _0x2418ee[_0x29f6('0x14')](_0x55cf4,_0x11a1fd)[_0x29f6('0x15')](function(_0x28d314){logger[_0x29f6('0x16')](_0x29f6('0x17'),_0x189344,_0x29f6('0x18'));logger[_0x29f6('0x19')](_0x29f6('0x1a'),_0x189344,_0x29f6('0x18'),JSON['stringify'](_0x28d314));if(_0x28d314['error']){if(_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1c')]===0x1f4){logger[_0x29f6('0x1b')]('Trunk,\x20%s,\x20%s',_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x35d2e2(_0x28d314['error'][_0x29f6('0x1d')]);}logger[_0x29f6('0x1b')](_0x29f6('0x17'),_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x156c96(_0x28d314[_0x29f6('0x1b')]['message']);}else{logger[_0x29f6('0x16')]('Trunk,\x20%s,\x20%s',_0x189344,'request\x20sent');_0x156c96(_0x28d314[_0x29f6('0x1e')][_0x29f6('0x1d')]);}})[_0x29f6('0x1f')](function(_0xafb5dd){logger['error'](_0x29f6('0x17'),_0x189344,_0xafb5dd);_0x35d2e2(_0xafb5dd);});});}function respondWithStatusCode(_0x49f67d,_0xd4179c){_0xd4179c=_0xd4179c||0xcc;return function(_0xcce041){if(_0xcce041){return _0x49f67d[_0x29f6('0x20')](_0xd4179c);}return _0x49f67d[_0x29f6('0x21')](_0xd4179c)['end']();};}function respondWithResult(_0x4290a2,_0x4d494f){_0x4d494f=_0x4d494f||0xc8;return function(_0x47c385){if(_0x47c385){return _0x4290a2[_0x29f6('0x21')](_0x4d494f)[_0x29f6('0x22')](_0x47c385);}};}function respondWithFilteredResult(_0x2519ac,_0x342038){return function(_0x84ccb7){if(_0x84ccb7){var _0x4333bc=typeof _0x342038[_0x29f6('0x23')]==='undefined'&&typeof _0x342038[_0x29f6('0x24')]===_0x29f6('0x25');var _0x1ab8d8=_0x84ccb7[_0x29f6('0x26')];var _0xda0a63=_0x4333bc?0x0:_0x342038[_0x29f6('0x23')];var _0x3790f5=_0x4333bc?_0x84ccb7[_0x29f6('0x26')]:_0x342038[_0x29f6('0x23')]+_0x342038[_0x29f6('0x24')];var _0x2915bc;if(_0x3790f5>=_0x1ab8d8){_0x3790f5=_0x1ab8d8;_0x2915bc=0xc8;}else{_0x2915bc=0xce;}_0x2519ac[_0x29f6('0x21')](_0x2915bc);return _0x2519ac[_0x29f6('0x27')](_0x29f6('0x28'),_0xda0a63+'-'+_0x3790f5+'/'+_0x1ab8d8)[_0x29f6('0x22')](_0x84ccb7);}return null;};}function patchUpdates(_0x218931){return function(_0x3a7249){try{jsonpatch['apply'](_0x3a7249,_0x218931,!![]);}catch(_0x5582d3){return BPromise[_0x29f6('0x29')](_0x5582d3);}return _0x3a7249['save']();};}function saveUpdates(_0x341071,_0xc8d2c5){return function(_0x1e1bb6){if(_0x1e1bb6){return _0x1e1bb6[_0x29f6('0x2a')](_0x341071)['then'](function(_0x53e11f){return _0x53e11f;});}return null;};}function removeEntity(_0x1bde69,_0xa6377c){return function(_0x2edc2e){if(_0x2edc2e){return _0x2edc2e[_0x29f6('0x2b')]()[_0x29f6('0x15')](function(){var _0x20bc5e=_0x2edc2e[_0x29f6('0x2c')]({'plain':!![]});var _0x1c3f0f=_0x29f6('0x2d');return db[_0x29f6('0x2e')][_0x29f6('0x2b')]({'where':{'type':_0x1c3f0f,'resourceId':_0x20bc5e['id']}})[_0x29f6('0x15')](function(){return _0x2edc2e;});})[_0x29f6('0x15')](function(){_0x1bde69[_0x29f6('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e31dd,_0x206beb){return function(_0x44cf19){if(!_0x44cf19){_0x5e31dd[_0x29f6('0x20')](0x194);}return _0x44cf19;};}function handleError(_0x5416dc,_0x3e1e25){_0x3e1e25=_0x3e1e25||0x1f4;return function(_0x749b9d){logger[_0x29f6('0x1b')](_0x749b9d[_0x29f6('0x2f')]);if(_0x749b9d[_0x29f6('0x30')]){delete _0x749b9d['name'];}_0x5416dc[_0x29f6('0x21')](_0x3e1e25)[_0x29f6('0x31')](_0x749b9d);};}exports[_0x29f6('0x32')]=function(_0x1b51cc,_0x4f5fe1){var _0x30d747={},_0x2a09e8={},_0x14b392={'count':0x0,'rows':[]};var _0x105557=_['map'](db['Trunk'][_0x29f6('0x33')],function(_0x4bfc80){return{'name':_0x4bfc80[_0x29f6('0x34')],'type':_0x4bfc80['type'][_0x29f6('0x35')]};});_0x2a09e8['model']=_[_0x29f6('0x36')](_0x105557,_0x29f6('0x30'));_0x2a09e8['query']=_[_0x29f6('0x37')](_0x1b51cc['query']);_0x2a09e8[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x2a09e8['model'],_0x2a09e8[_0x29f6('0x3a')]);_0x30d747[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2a09e8[_0x29f6('0x3c')],qs['fields'](_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x3d')]));_0x30d747[_0x29f6('0x3b')]=_0x30d747[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x30d747['attributes']:_0x2a09e8[_0x29f6('0x3c')];if(!_0x1b51cc['query'][_0x29f6('0x3f')]('nolimit')){_0x30d747[_0x29f6('0x24')]=qs[_0x29f6('0x24')](_0x1b51cc['query'][_0x29f6('0x24')]);_0x30d747[_0x29f6('0x23')]=qs[_0x29f6('0x23')](_0x1b51cc[_0x29f6('0x3a')]['offset']);}_0x30d747[_0x29f6('0x40')]=qs[_0x29f6('0x41')](_0x1b51cc[_0x29f6('0x3a')]['sort']);_0x30d747[_0x29f6('0x42')]=qs['filters'](_[_0x29f6('0x43')](_0x1b51cc['query'],_0x2a09e8['filters']),_0x105557);if(_0x1b51cc['query'][_0x29f6('0x44')]){_0x30d747[_0x29f6('0x42')]=_[_0x29f6('0x45')](_0x30d747[_0x29f6('0x42')],{'$or':_[_0x29f6('0x36')](_0x105557,function(_0x270842){if(_0x270842[_0x29f6('0x46')]!==_0x29f6('0x47')){var _0x352119={};_0x352119[_0x270842[_0x29f6('0x30')]]={'$like':'%'+_0x1b51cc['query']['filter']+'%'};return _0x352119;}})});}_0x30d747=_[_0x29f6('0x45')]({},_0x30d747,_0x1b51cc[_0x29f6('0x48')]);var _0x7a65c0={'where':_0x30d747[_0x29f6('0x42')]};return db['Trunk'][_0x29f6('0x26')](_0x7a65c0)[_0x29f6('0x15')](function(_0x532df5){_0x14b392[_0x29f6('0x26')]=_0x532df5;if(_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x30d747[_0x29f6('0x4a')]=[{'all':!![]}];}return db[_0x29f6('0x4b')][_0x29f6('0x4c')](_0x30d747);})[_0x29f6('0x15')](function(_0x1f03b6){_0x14b392[_0x29f6('0x4d')]=_0x1f03b6;return _0x14b392;})[_0x29f6('0x15')](respondWithFilteredResult(_0x4f5fe1,_0x30d747))[_0x29f6('0x1f')](handleError(_0x4f5fe1,null));};exports[_0x29f6('0x4e')]=function(_0x58ea69,_0x416c24){var _0x463551={'raw':![],'where':{'id':_0x58ea69[_0x29f6('0x4f')]['id']}},_0x335ec1={};_0x335ec1[_0x29f6('0x3c')]=_['keys'](db[_0x29f6('0x4b')]['rawAttributes']);_0x335ec1['query']=_[_0x29f6('0x37')](_0x58ea69[_0x29f6('0x3a')]);_0x335ec1[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x335ec1[_0x29f6('0x3c')],_0x335ec1['query']);_0x463551[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x335ec1['model'],qs[_0x29f6('0x3d')](_0x58ea69['query'][_0x29f6('0x3d')]));_0x463551[_0x29f6('0x3b')]=_0x463551[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x463551['attributes']:_0x335ec1[_0x29f6('0x3c')];if(_0x58ea69[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x463551[_0x29f6('0x4a')]=[{'all':!![]}];}_0x463551=_[_0x29f6('0x45')]({},_0x463551,_0x58ea69[_0x29f6('0x48')]);return db[_0x29f6('0x4b')]['find'](_0x463551)[_0x29f6('0x15')](handleEntityNotFound(_0x416c24,null))[_0x29f6('0x15')](respondWithResult(_0x416c24,null))[_0x29f6('0x1f')](handleError(_0x416c24,null));};exports[_0x29f6('0x50')]=function(_0x36e52c,_0x1ac20d){var _0x37c3c1={'where':{'id':_0x36e52c[_0x29f6('0x4f')]['id']}},_0x2f356d={};_0x2f356d[_0x29f6('0x3c')]=_['keys'](db['Trunk'][_0x29f6('0x33')]);_0x37c3c1[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2f356d['model'],qs[_0x29f6('0x3d')](_0x36e52c['query']['fields']));_0x37c3c1[_0x29f6('0x3b')]=_0x37c3c1[_0x29f6('0x3b')]['length']?_0x37c3c1['attributes']:_0x2f356d[_0x29f6('0x3c')];if(_0x36e52c[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x37c3c1['include']=[{'all':!![]}];}_0x37c3c1=_[_0x29f6('0x45')]({},_0x37c3c1,_0x36e52c[_0x29f6('0x48')]);return db[_0x29f6('0x4b')][_0x29f6('0x51')](_0x37c3c1)[_0x29f6('0x15')](handleEntityNotFound(_0x1ac20d,null))[_0x29f6('0x15')](function(_0x7700da){if(_0x7700da){var _0x33b1d7=_0x7700da[_0x29f6('0x2c')]({'plain':!![]});_0x33b1d7=qs[_0x29f6('0x52')](_0x33b1d7,['id',_0x29f6('0x53'),_0x29f6('0x54')]);_0x36e52c[_0x29f6('0x55')]=_['omit'](_0x36e52c['body'],['id',_0x29f6('0x53'),'updatedAt']);return db[_0x29f6('0x4b')][_0x29f6('0x56')](_[_0x29f6('0x45')](_0x33b1d7,_0x36e52c[_0x29f6('0x55')]),{'include':_0x36e52c[_0x29f6('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0x29f6('0x15')](function(_0x38d684){var _0x2f694e=_0x36e52c[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x2f694e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f694e[_0x29f6('0x58')]==='user'){var _0x51b9dc=_0x38d684[_0x29f6('0x2c')]({'plain':!![]});var _0x336b8e='Trunks';return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':_0x336b8e,'userProfileId':_0x2f694e['userProfileId']},'raw':!![]})[_0x29f6('0x15')](function(_0x2ba44c){if(_0x2ba44c&&_0x2ba44c[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')][_0x29f6('0x56')]({'name':_0x51b9dc[_0x29f6('0x30')],'resourceId':_0x51b9dc['id'],'type':_0x2ba44c[_0x29f6('0x30')],'sectionId':_0x2ba44c['id']},{})['then'](function(){return _0x38d684;});}else{return _0x38d684;}})[_0x29f6('0x1f')](function(_0x50ddd6){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50ddd6);throw _0x50ddd6;});}return _0x38d684;});}})['then'](respondWithResult(_0x1ac20d,0xc9))[_0x29f6('0x1f')](handleError(_0x1ac20d,null));};exports[_0x29f6('0x56')]=function(_0x195887,_0x536b0c,_0x6ae738){var _0x373cf6;return db[_0x29f6('0x4b')]['create'](_0x195887[_0x29f6('0x55')],{'raw':!![]})[_0x29f6('0x15')](function(_0x66a7bb){_0x373cf6=_0x66a7bb;return db[_0x29f6('0x4b')][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x6587f3){var _0x41c1b9=fs['readFileSync'](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x1636f1=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],'server/files/templates/registry.ejs'),_0x29f6('0x5e'));var _0x1ca187=ejs['render'](_0x41c1b9,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ca187);if(_0x373cf6[_0x29f6('0x61')]){var _0x5a383f=ejs['render'](_0x1636f1,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x5a383f);}})['then'](function(){return respondWithRpcPromise('Reload','create',{'module':_0x29f6('0x63')});})[_0x29f6('0x15')](function(){var _0x144c76=_0x195887[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x144c76)throw new Error(_0x29f6('0x64'));if(_0x144c76[_0x29f6('0x58')]==='user'){var _0x11ef85=_0x373cf6[_0x29f6('0x2c')]({'plain':!![]});return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':'Trunks','userProfileId':_0x144c76[_0x29f6('0x65')]},'raw':!![]})[_0x29f6('0x15')](function(_0x32a862){if(_0x32a862&&_0x32a862[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')]['create']({'name':_0x11ef85[_0x29f6('0x30')],'resourceId':_0x11ef85['id'],'type':_0x32a862[_0x29f6('0x30')],'sectionId':_0x32a862['id']},{})[_0x29f6('0x15')](function(){return _0x373cf6;});}else{return _0x373cf6;}})[_0x29f6('0x1f')](function(_0x4273a3){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4273a3);throw _0x4273a3;});}return _0x373cf6;})[_0x29f6('0x15')](respondWithResult(_0x536b0c,0xc9))['catch'](handleError(_0x536b0c,null));};exports['update']=function(_0x4f9907,_0x842ae3,_0x5bcf90){var _0x425da2;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x4f9907[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x842ae3,null))[_0x29f6('0x15')](saveUpdates(_0x4f9907[_0x29f6('0x55')],null))['then'](function(_0x3a23f3){if(_0x3a23f3){_0x425da2=_0x3a23f3;return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});}})[_0x29f6('0x15')](function(_0x32fa77){if(_0x32fa77){var _0x1d6e32=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0xe14459=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0xa31c7d=ejs[_0x29f6('0x66')](_0x1d6e32,{'trunks':_0x32fa77||[]});fs['writeFileSync'](_0x29f6('0x67'),_0xa31c7d);var _0x57b9fb=ejs[_0x29f6('0x66')](_0xe14459,{'trunks':_0x32fa77||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x57b9fb);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2a'),{'module':_0x29f6('0x63')});}return null;})[_0x29f6('0x15')](function(_0x4203f1){if(_0x4203f1){return _0x425da2;}})[_0x29f6('0x15')](respondWithResult(_0x842ae3,null))[_0x29f6('0x1f')](handleError(_0x842ae3,null));};exports['destroy']=function(_0x1d61ff,_0x4c0acc,_0x16bb3c){var _0x144d8c;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x1d61ff[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x4c0acc,null))[_0x29f6('0x15')](removeEntity(_0x4c0acc,null))[_0x29f6('0x15')](function(){return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x4e185f){var _0x4bb53f=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x906098=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x69')),_0x29f6('0x5e'));var _0x3f51fa=ejs['render'](_0x4bb53f,{'trunks':_0x4e185f});var _0x4b9631=ejs[_0x29f6('0x66')](_0x906098,{'trunks':_0x4e185f});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x3f51fa);fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x4b9631);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2b'),{'module':_0x29f6('0x63')});})[_0x29f6('0x1f')](handleError(_0x4c0acc,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 1d90130..3166683 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 _0x225e=['path','rimraf','../../config/environment','./trunk.attributes','exports','define','tools_trunks','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1a3ac5,_0x233ffc){var _0x447bb4=function(_0x2c25fb){while(--_0x2c25fb){_0x1a3ac5['push'](_0x1a3ac5['shift']());}};_0x447bb4(++_0x233ffc);}(_0x225e,0x6f));var _0xe225=function(_0x2e3d51,_0x5597d4){_0x2e3d51=_0x2e3d51-0x0;var _0xa3b47e=_0x225e[_0x2e3d51];return _0xa3b47e;};'use strict';var _=require(_0xe225('0x0'));var util=require(_0xe225('0x1'));var logger=require('../../config/logger')(_0xe225('0x2'));var moment=require(_0xe225('0x3'));var BPromise=require(_0xe225('0x4'));var rp=require(_0xe225('0x5'));var fs=require('fs');var path=require(_0xe225('0x6'));var rimraf=require(_0xe225('0x7'));var config=require(_0xe225('0x8'));var attributes=require(_0xe225('0x9'));module[_0xe225('0xa')]=function(_0xf0027f,_0x228773){return _0xf0027f[_0xe225('0xb')]('Trunk',attributes,{'tableName':_0xe225('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3272=['../../config/environment','./trunk.attributes','tools_trunks','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x272dc5,_0x161199){var _0x2f62c4=function(_0x250a04){while(--_0x250a04){_0x272dc5['push'](_0x272dc5['shift']());}};_0x2f62c4(++_0x161199);}(_0x3272,0x14d));var _0x2327=function(_0x406265,_0x5c8abc){_0x406265=_0x406265-0x0;var _0x153b4c=_0x3272[_0x406265];return _0x153b4c;};'use strict';var _=require('lodash');var util=require(_0x2327('0x0'));var logger=require(_0x2327('0x1'))(_0x2327('0x2'));var moment=require(_0x2327('0x3'));var BPromise=require(_0x2327('0x4'));var rp=require(_0x2327('0x5'));var fs=require('fs');var path=require(_0x2327('0x6'));var rimraf=require(_0x2327('0x7'));var config=require(_0x2327('0x8'));var attributes=require(_0x2327('0x9'));module['exports']=function(_0x488028,_0x565dd8){return _0x488028['define']('Trunk',attributes,{'tableName':_0x2327('0xa'),'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 a7afb1f..bd28280 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 _0xe3d3=['limit','include','map','model','ShowTrunk','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes'];(function(_0x2bf2f7,_0x3797ff){var _0x7c9d1c=function(_0x1ecbd0){while(--_0x1ecbd0){_0x2bf2f7['push'](_0x2bf2f7['shift']());}};_0x7c9d1c(++_0x3797ff);}(_0xe3d3,0x141));var _0x3e3d=function(_0x321df3,_0x3eed57){_0x321df3=_0x321df3-0x0;var _0x1d4fbd=_0xe3d3[_0x321df3];return _0x1d4fbd;};'use strict';var _=require(_0x3e3d('0x0'));var util=require(_0x3e3d('0x1'));var moment=require(_0x3e3d('0x2'));var BPromise=require(_0x3e3d('0x3'));var rs=require(_0x3e3d('0x4'));var fs=require('fs');var Redis=require(_0x3e3d('0x5'));var db=require(_0x3e3d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x3e3d('0x7'));var jayson=require(_0x3e3d('0x8'));var client=jayson['client'][_0x3e3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28f60d,_0x5e00dd,_0x23beb8){return new BPromise(function(_0x13fadf,_0x1c08d9){return client[_0x3e3d('0xa')](_0x28f60d,_0x23beb8)[_0x3e3d('0xb')](function(_0x34ddde){logger['info'](_0x3e3d('0xc'),_0x5e00dd,_0x3e3d('0xd'));logger[_0x3e3d('0xe')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5e00dd,_0x3e3d('0xd'),JSON[_0x3e3d('0xf')](_0x34ddde));if(_0x34ddde[_0x3e3d('0x10')]){if(_0x34ddde[_0x3e3d('0x10')][_0x3e3d('0x11')]===0x1f4){logger[_0x3e3d('0x10')](_0x3e3d('0xc'),_0x5e00dd,_0x34ddde[_0x3e3d('0x10')][_0x3e3d('0x12')]);return _0x1c08d9(_0x34ddde[_0x3e3d('0x10')][_0x3e3d('0x12')]);}logger[_0x3e3d('0x10')]('Trunk,\x20%s,\x20%s',_0x5e00dd,_0x34ddde['error']['message']);return _0x13fadf(_0x34ddde[_0x3e3d('0x10')][_0x3e3d('0x12')]);}else{logger[_0x3e3d('0x13')](_0x3e3d('0xc'),_0x5e00dd,_0x3e3d('0xd'));_0x13fadf(_0x34ddde[_0x3e3d('0x14')][_0x3e3d('0x12')]);}})[_0x3e3d('0x15')](function(_0x43fb30){logger[_0x3e3d('0x10')](_0x3e3d('0xc'),_0x5e00dd,_0x43fb30);_0x1c08d9(_0x43fb30);});});}exports[_0x3e3d('0x16')]=function(_0x17bc5e){var _0x586c21=this;return new Promise(function(_0x21b032,_0x3f6d77){return db[_0x3e3d('0x17')][_0x3e3d('0x18')]({'raw':_0x17bc5e[_0x3e3d('0x19')]?_0x17bc5e['options'][_0x3e3d('0x1a')]===undefined?!![]:![]:!![],'where':_0x17bc5e[_0x3e3d('0x19')]?_0x17bc5e[_0x3e3d('0x19')][_0x3e3d('0x1b')]||null:null,'attributes':_0x17bc5e[_0x3e3d('0x19')]?_0x17bc5e[_0x3e3d('0x19')][_0x3e3d('0x1c')]||null:null,'limit':_0x17bc5e[_0x3e3d('0x19')]?_0x17bc5e[_0x3e3d('0x19')][_0x3e3d('0x1d')]||null:null,'include':_0x17bc5e[_0x3e3d('0x19')]?_0x17bc5e[_0x3e3d('0x19')]['include']?_['map'](_0x17bc5e[_0x3e3d('0x19')][_0x3e3d('0x1e')],function(_0x26bebd){return{'model':db[_0x26bebd['model']],'as':_0x26bebd['as'],'attributes':_0x26bebd['attributes'],'include':_0x26bebd[_0x3e3d('0x1e')]?_[_0x3e3d('0x1f')](_0x26bebd[_0x3e3d('0x1e')],function(_0x3798dc){return{'model':db[_0x3798dc['model']],'as':_0x3798dc['as'],'attributes':_0x3798dc[_0x3e3d('0x1c')],'include':_0x3798dc[_0x3e3d('0x1e')]?_[_0x3e3d('0x1f')](_0x3798dc['include'],function(_0x1dd464){return{'model':db[_0x1dd464[_0x3e3d('0x20')]],'as':_0x1dd464['as'],'attributes':_0x1dd464[_0x3e3d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3e3d('0xb')](function(_0x1ded4d){logger[_0x3e3d('0x13')](_0x3e3d('0x16'),_0x17bc5e);logger['debug'](_0x3e3d('0x16'),_0x17bc5e,JSON['stringify'](_0x1ded4d));_0x21b032(_0x1ded4d);})[_0x3e3d('0x15')](function(_0x4dddb3){logger[_0x3e3d('0x10')](_0x3e3d('0x16'),_0x4dddb3[_0x3e3d('0x12')],_0x17bc5e);_0x3f6d77(_0x586c21[_0x3e3d('0x10')](0x1f4,_0x4dddb3[_0x3e3d('0x12')]));});});};exports[_0x3e3d('0x21')]=function(_0x3fdcae){var _0x46c93d=this;return new Promise(function(_0x544208,_0x24bc62){return db[_0x3e3d('0x17')][_0x3e3d('0x22')]({'raw':_0x3fdcae[_0x3e3d('0x19')]?_0x3fdcae[_0x3e3d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3fdcae[_0x3e3d('0x19')]?_0x3fdcae[_0x3e3d('0x19')]['where']||null:null,'attributes':_0x3fdcae['options']?_0x3fdcae[_0x3e3d('0x19')]['attributes']||null:null,'include':_0x3fdcae['options']?_0x3fdcae['options'][_0x3e3d('0x1e')]?_[_0x3e3d('0x1f')](_0x3fdcae[_0x3e3d('0x19')]['include'],function(_0x42a152){return{'model':db[_0x42a152[_0x3e3d('0x20')]],'as':_0x42a152['as'],'attributes':_0x42a152[_0x3e3d('0x1c')],'include':_0x42a152[_0x3e3d('0x1e')]?_[_0x3e3d('0x1f')](_0x42a152[_0x3e3d('0x1e')],function(_0x5f414e){return{'model':db[_0x5f414e[_0x3e3d('0x20')]],'as':_0x5f414e['as'],'attributes':_0x5f414e[_0x3e3d('0x1c')],'include':_0x5f414e[_0x3e3d('0x1e')]?_[_0x3e3d('0x1f')](_0x5f414e[_0x3e3d('0x1e')],function(_0x3c738d){return{'model':db[_0x3c738d[_0x3e3d('0x20')]],'as':_0x3c738d['as'],'attributes':_0x3c738d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3858ef){logger['info'](_0x3e3d('0x21'),_0x3fdcae);logger[_0x3e3d('0xe')](_0x3e3d('0x21'),_0x3fdcae,JSON['stringify'](_0x3858ef));_0x544208(_0x3858ef);})[_0x3e3d('0x15')](function(_0x4f28d0){logger[_0x3e3d('0x10')](_0x3e3d('0x21'),_0x4f28d0['message'],_0x3fdcae);_0x24bc62(_0x46c93d[_0x3e3d('0x10')](0x1f4,_0x4f28d0[_0x3e3d('0x12')]));});});}; \ No newline at end of file +var _0xd366=['map','include','stringify','catch','ShowTrunk','find','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','model'];(function(_0x2499a4,_0x24ab91){var _0x27cff1=function(_0x2ca926){while(--_0x2ca926){_0x2499a4['push'](_0x2499a4['shift']());}};_0x27cff1(++_0x24ab91);}(_0xd366,0x14a));var _0x6d36=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xd366[_0x487b0c];return _0x1adbdc;};'use strict';var _=require('lodash');var util=require(_0x6d36('0x0'));var moment=require(_0x6d36('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d36('0x2'));var db=require(_0x6d36('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d36('0x4'))(_0x6d36('0x5'));var config=require(_0x6d36('0x6'));var jayson=require(_0x6d36('0x7'));var client=jayson[_0x6d36('0x8')][_0x6d36('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a35e7,_0x6ca156,_0x243b8f){return new BPromise(function(_0x49c091,_0x4f94bb){return client[_0x6d36('0xa')](_0x5a35e7,_0x243b8f)[_0x6d36('0xb')](function(_0x5cb336){logger[_0x6d36('0xc')](_0x6d36('0xd'),_0x6ca156,_0x6d36('0xe'));logger[_0x6d36('0xf')](_0x6d36('0x10'),_0x6ca156,_0x6d36('0xe'),JSON['stringify'](_0x5cb336));if(_0x5cb336[_0x6d36('0x11')]){if(_0x5cb336[_0x6d36('0x11')][_0x6d36('0x12')]===0x1f4){logger[_0x6d36('0x11')](_0x6d36('0xd'),_0x6ca156,_0x5cb336[_0x6d36('0x11')][_0x6d36('0x13')]);return _0x4f94bb(_0x5cb336[_0x6d36('0x11')][_0x6d36('0x13')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x6ca156,_0x5cb336[_0x6d36('0x11')]['message']);return _0x49c091(_0x5cb336[_0x6d36('0x11')][_0x6d36('0x13')]);}else{logger['info'](_0x6d36('0xd'),_0x6ca156,_0x6d36('0xe'));_0x49c091(_0x5cb336[_0x6d36('0x14')][_0x6d36('0x13')]);}})['catch'](function(_0x57f34d){logger[_0x6d36('0x11')](_0x6d36('0xd'),_0x6ca156,_0x57f34d);_0x4f94bb(_0x57f34d);});});}exports[_0x6d36('0x15')]=function(_0x5eeeb9){var _0x54cb6c=this;return new Promise(function(_0x267c12,_0x5e9810){return db[_0x6d36('0x16')][_0x6d36('0x17')]({'raw':_0x5eeeb9[_0x6d36('0x18')]?_0x5eeeb9['options'][_0x6d36('0x19')]===undefined?!![]:![]:!![],'where':_0x5eeeb9['options']?_0x5eeeb9[_0x6d36('0x18')][_0x6d36('0x1a')]||null:null,'attributes':_0x5eeeb9[_0x6d36('0x18')]?_0x5eeeb9['options'][_0x6d36('0x1b')]||null:null,'limit':_0x5eeeb9[_0x6d36('0x18')]?_0x5eeeb9[_0x6d36('0x18')][_0x6d36('0x1c')]||null:null,'include':_0x5eeeb9[_0x6d36('0x18')]?_0x5eeeb9[_0x6d36('0x18')]['include']?_['map'](_0x5eeeb9[_0x6d36('0x18')]['include'],function(_0x44d6d8){return{'model':db[_0x44d6d8[_0x6d36('0x1d')]],'as':_0x44d6d8['as'],'attributes':_0x44d6d8[_0x6d36('0x1b')],'include':_0x44d6d8['include']?_[_0x6d36('0x1e')](_0x44d6d8[_0x6d36('0x1f')],function(_0x182433){return{'model':db[_0x182433['model']],'as':_0x182433['as'],'attributes':_0x182433[_0x6d36('0x1b')],'include':_0x182433[_0x6d36('0x1f')]?_[_0x6d36('0x1e')](_0x182433['include'],function(_0x4806a8){return{'model':db[_0x4806a8[_0x6d36('0x1d')]],'as':_0x4806a8['as'],'attributes':_0x4806a8[_0x6d36('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6d36('0xb')](function(_0x42b1a2){logger[_0x6d36('0xc')](_0x6d36('0x15'),_0x5eeeb9);logger[_0x6d36('0xf')]('GetTrunk',_0x5eeeb9,JSON[_0x6d36('0x20')](_0x42b1a2));_0x267c12(_0x42b1a2);})[_0x6d36('0x21')](function(_0xd43caa){logger[_0x6d36('0x11')](_0x6d36('0x15'),_0xd43caa[_0x6d36('0x13')],_0x5eeeb9);_0x5e9810(_0x54cb6c[_0x6d36('0x11')](0x1f4,_0xd43caa['message']));});});};exports[_0x6d36('0x22')]=function(_0x3ab94d){var _0x13e412=this;return new Promise(function(_0x2198c9,_0x5f4bb6){return db['Trunk'][_0x6d36('0x23')]({'raw':_0x3ab94d[_0x6d36('0x18')]?_0x3ab94d[_0x6d36('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3ab94d[_0x6d36('0x18')]?_0x3ab94d[_0x6d36('0x18')][_0x6d36('0x1a')]||null:null,'attributes':_0x3ab94d[_0x6d36('0x18')]?_0x3ab94d[_0x6d36('0x18')]['attributes']||null:null,'include':_0x3ab94d['options']?_0x3ab94d[_0x6d36('0x18')][_0x6d36('0x1f')]?_['map'](_0x3ab94d[_0x6d36('0x18')]['include'],function(_0x36f893){return{'model':db[_0x36f893[_0x6d36('0x1d')]],'as':_0x36f893['as'],'attributes':_0x36f893[_0x6d36('0x1b')],'include':_0x36f893['include']?_[_0x6d36('0x1e')](_0x36f893[_0x6d36('0x1f')],function(_0x449d50){return{'model':db[_0x449d50[_0x6d36('0x1d')]],'as':_0x449d50['as'],'attributes':_0x449d50[_0x6d36('0x1b')],'include':_0x449d50[_0x6d36('0x1f')]?_['map'](_0x449d50['include'],function(_0x1713c1){return{'model':db[_0x1713c1[_0x6d36('0x1d')]],'as':_0x1713c1['as'],'attributes':_0x1713c1[_0x6d36('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6d36('0xb')](function(_0x1ab3ac){logger['info'](_0x6d36('0x22'),_0x3ab94d);logger[_0x6d36('0xf')](_0x6d36('0x22'),_0x3ab94d,JSON[_0x6d36('0x20')](_0x1ab3ac));_0x2198c9(_0x1ab3ac);})[_0x6d36('0x21')](function(_0x5173e6){logger[_0x6d36('0x11')](_0x6d36('0x22'),_0x5173e6[_0x6d36('0x13')],_0x3ab94d);_0x5f4bb6(_0x13e412[_0x6d36('0x11')](0x1f4,_0x5173e6['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index d6d3b65..2d11e26 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf293=['../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update','express','Router'];(function(_0x102996,_0x2f6efd){var _0x1d0db3=function(_0x4273bf){while(--_0x4273bf){_0x102996['push'](_0x102996['shift']());}};_0x1d0db3(++_0x2f6efd);}(_0xf293,0xde));var _0x3f29=function(_0x5ec957,_0x2f7e6d){_0x5ec957=_0x5ec957-0x0;var _0x2a7bd0=_0xf293[_0x5ec957];return _0x2a7bd0;};'use strict';var express=require(_0x3f29('0x0'));var router=express[_0x3f29('0x1')]();var auth=require(_0x3f29('0x2'));var controller=require(_0x3f29('0x3'));router[_0x3f29('0x4')](_0x3f29('0x5'),auth[_0x3f29('0x6')](),controller[_0x3f29('0x7')]);module['exports']=router; \ No newline at end of file +var _0xcfcb=['Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update','exports'];(function(_0x187057,_0x535ffd){var _0x43820f=function(_0x49a279){while(--_0x49a279){_0x187057['push'](_0x187057['shift']());}};_0x43820f(++_0x535ffd);}(_0xcfcb,0xc0));var _0xbcfc=function(_0x296453,_0x219c2a){_0x296453=_0x296453-0x0;var _0x37b596=_0xcfcb[_0x296453];return _0x37b596;};'use strict';var express=require('express');var router=express[_0xbcfc('0x0')]();var auth=require(_0xbcfc('0x1'));var controller=require(_0xbcfc('0x2'));router[_0xbcfc('0x3')](_0xbcfc('0x4'),auth[_0xbcfc('0x5')](),controller[_0xbcfc('0x6')]);module[_0xbcfc('0x7')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 171b03c..d0773f3 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd042=['TEXT','error','warning','info','BOOLEAN'];(function(_0x118040,_0x57ccc4){var _0x309a92=function(_0x547100){while(--_0x547100){_0x118040['push'](_0x118040['shift']());}};_0x309a92(++_0x57ccc4);}(_0xd042,0x173));var _0x2d04=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xd042[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x2d04('0x0'),_0x2d04('0x1'),_0x2d04('0x2'),'debug'];module['exports']={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x2d04('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x2d04('0x3')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x2d04('0x4')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':'UserId'}}; \ No newline at end of file +var _0x8b07=['DATE','UserId','sequelize','error','warning','info','ENUM','BOOLEAN','TEXT'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x8b07,0x158));var _0x78b0=function(_0x2133df,_0x13cd29){_0x2133df=_0x2133df-0x0;var _0x17af94=_0x8b07[_0x2133df];return _0x17af94;};'use strict';var Sequelize=require(_0x78b0('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x78b0('0x1'),_0x78b0('0x2'),_0x78b0('0x3'),'debug'];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x78b0('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x78b0('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x78b0('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x78b0('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x78b0('0x8')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index b28ddda..a044b22 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8db0=['json','then','sendStatus','error','stack','name','send','update','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','catch','lodash','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','localhost','status'];(function(_0x25f019,_0x50dd48){var _0x332f0d=function(_0x4b879e){while(--_0x4b879e){_0x25f019['push'](_0x25f019['shift']());}};_0x332f0d(++_0x50dd48);}(_0x8db0,0x65));var _0x08db=function(_0x1044e5,_0x498e01){_0x1044e5=_0x1044e5-0x0;var _0x5ad0dd=_0x8db0[_0x1044e5];return _0x5ad0dd;};'use strict';var _=require(_0x08db('0x0'));var Redis=require(_0x08db('0x1'));var logger=require('../../config/logger')(_0x08db('0x2'));var config=require(_0x08db('0x3'));var db=require(_0x08db('0x4'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x08db('0x5')]));require('./user-setting.socket')['register'](socket);config['redis']=_[_0x08db('0x6')](config['redis'],{'host':_0x08db('0x7'),'port':0x18eb});function respondWithResult(_0x528139,_0x41b4bf){_0x41b4bf=_0x41b4bf||0xc8;return function(_0x1ca3d1){if(_0x1ca3d1){return _0x528139[_0x08db('0x8')](_0x41b4bf)[_0x08db('0x9')](_0x1ca3d1);}};}function saveUpdates(_0x2168a8){return function(_0x5ec76d){if(_0x5ec76d){return _0x5ec76d['update'](_0x2168a8)[_0x08db('0xa')](function(_0x2fe457){return _0x2fe457;});}return null;};}function handleEntityNotFound(_0x1242af){return function(_0x2d623c){if(!_0x2d623c){_0x1242af[_0x08db('0xb')](0x194);}return _0x2d623c;};}function handleError(_0x16ad14,_0x2b1d6f){_0x2b1d6f=_0x2b1d6f||0x1f4;return function(_0xbce1c7){logger[_0x08db('0xc')](_0xbce1c7[_0x08db('0xd')]);if(_0xbce1c7[_0x08db('0xe')]){delete _0xbce1c7[_0x08db('0xe')];}_0x16ad14[_0x08db('0x8')](_0x2b1d6f)[_0x08db('0xf')](_0xbce1c7);};}exports[_0x08db('0x10')]=function(_0x17756a,_0x1efa55){if(_0x17756a['user']['role']!=='admin')throw new Error(_0x08db('0x11'));if(isNaN(Number(_0x17756a[_0x08db('0x12')]['id'])))throw new Error(_0x08db('0x13'));return db[_0x08db('0x14')]['find']({'where':{'id':_0x17756a[_0x08db('0x12')]['id']}})['then'](handleEntityNotFound(_0x1efa55,null))[_0x08db('0xa')](saveUpdates(_0x17756a['body'],null))[_0x08db('0xa')](respondWithResult(_0x1efa55,null))[_0x08db('0x15')](handleError(_0x1efa55,null));}; \ No newline at end of file +var _0x6ce9=['sendStatus','error','stack','name','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','lodash','ioredis','../../config/logger','../../mysqldb','redis','./user-setting.socket','register','localhost','status','json','update','then'];(function(_0x12e7cb,_0x5c66e0){var _0x59d202=function(_0x14bd04){while(--_0x14bd04){_0x12e7cb['push'](_0x12e7cb['shift']());}};_0x59d202(++_0x5c66e0);}(_0x6ce9,0x76));var _0x96ce=function(_0x129254,_0x5e26af){_0x129254=_0x129254-0x0;var _0x2a0488=_0x6ce9[_0x129254];return _0x2a0488;};'use strict';var _=require(_0x96ce('0x0'));var Redis=require(_0x96ce('0x1'));var logger=require(_0x96ce('0x2'))('api');var config=require('../../config/environment');var db=require(_0x96ce('0x3'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x96ce('0x4')]));require(_0x96ce('0x5'))[_0x96ce('0x6')](socket);config[_0x96ce('0x4')]=_['defaults'](config[_0x96ce('0x4')],{'host':_0x96ce('0x7'),'port':0x18eb});function respondWithResult(_0x1a24c7,_0x569a40){_0x569a40=_0x569a40||0xc8;return function(_0x1abd8c){if(_0x1abd8c){return _0x1a24c7[_0x96ce('0x8')](_0x569a40)[_0x96ce('0x9')](_0x1abd8c);}};}function saveUpdates(_0x4a7278){return function(_0x4b4ba8){if(_0x4b4ba8){return _0x4b4ba8[_0x96ce('0xa')](_0x4a7278)[_0x96ce('0xb')](function(_0x19d1c2){return _0x19d1c2;});}return null;};}function handleEntityNotFound(_0x296e57){return function(_0x150f93){if(!_0x150f93){_0x296e57[_0x96ce('0xc')](0x194);}return _0x150f93;};}function handleError(_0x45711e,_0x897942){_0x897942=_0x897942||0x1f4;return function(_0x1e3c4a){logger[_0x96ce('0xd')](_0x1e3c4a[_0x96ce('0xe')]);if(_0x1e3c4a['name']){delete _0x1e3c4a[_0x96ce('0xf')];}_0x45711e[_0x96ce('0x8')](_0x897942)[_0x96ce('0x10')](_0x1e3c4a);};}exports['update']=function(_0x1743b3,_0x37bc3a){if(_0x1743b3[_0x96ce('0x11')][_0x96ce('0x12')]!==_0x96ce('0x13'))throw new Error(_0x96ce('0x14'));if(isNaN(Number(_0x1743b3[_0x96ce('0x15')]['id'])))throw new Error(_0x96ce('0x16'));return db[_0x96ce('0x17')][_0x96ce('0x18')]({'where':{'id':_0x1743b3[_0x96ce('0x15')]['id']}})[_0x96ce('0xb')](handleEntityNotFound(_0x37bc3a,null))[_0x96ce('0xb')](saveUpdates(_0x1743b3[_0x96ce('0x19')],null))[_0x96ce('0xb')](respondWithResult(_0x37bc3a,null))['catch'](handleError(_0x37bc3a,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 4f3d10c..34c0066 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1282=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserSetting'];(function(_0x1ba40c,_0x4d8113){var _0x2dffa8=function(_0x309e21){while(--_0x309e21){_0x1ba40c['push'](_0x1ba40c['shift']());}};_0x2dffa8(++_0x4d8113);}(_0x1282,0xb1));var _0x2128=function(_0xc1a7cf,_0xfa1405){_0xc1a7cf=_0xc1a7cf-0x0;var _0x50ef05=_0x1282[_0xc1a7cf];return _0x50ef05;};'use strict';var EventEmitter=require(_0x2128('0x0'));var UserSetting=require(_0x2128('0x1'))['db'][_0x2128('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x2128('0x3')](0x0);var events={'afterCreate':_0x2128('0x4'),'afterUpdate':_0x2128('0x5'),'afterDestroy':_0x2128('0x6')};function emitEvent(_0x3a651e){return function(_0x2e655f,_0x4d34fc,_0x412653){UserSettingEvents[_0x2128('0x7')](_0x3a651e+':'+_0x2e655f['id'],_0x2e655f);UserSettingEvents[_0x2128('0x7')](_0x3a651e,_0x2e655f);_0x412653(null);};}for(var e in events){if(events[_0x2128('0x8')](e)){var event=events[e];UserSetting[_0x2128('0x9')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x0340=['hasOwnProperty','hook','exports','events','../../mysqldb','UserSetting','setMaxListeners','update','remove','emit'];(function(_0x41a785,_0x2a6ffa){var _0x56f35d=function(_0x5199d4){while(--_0x5199d4){_0x41a785['push'](_0x41a785['shift']());}};_0x56f35d(++_0x2a6ffa);}(_0x0340,0xad));var _0x0034=function(_0x19e0c3,_0x236526){_0x19e0c3=_0x19e0c3-0x0;var _0x5840b0=_0x0340[_0x19e0c3];return _0x5840b0;};'use strict';var EventEmitter=require(_0x0034('0x0'));var UserSetting=require(_0x0034('0x1'))['db'][_0x0034('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x0034('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0034('0x4'),'afterDestroy':_0x0034('0x5')};function emitEvent(_0x159dfa){return function(_0x49ac32,_0x356b7f,_0x3ef155){UserSettingEvents[_0x0034('0x6')](_0x159dfa+':'+_0x49ac32['id'],_0x49ac32);UserSettingEvents[_0x0034('0x6')](_0x159dfa,_0x49ac32);_0x3ef155(null);};}for(var e in events){if(events[_0x0034('0x7')](e)){var event=events[e];UserSetting[_0x0034('0x8')](e,emitEvent(event));}}module[_0x0034('0x9')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 0489d35..f805fee 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3276=['clientSideLoggingEnabledSince','./user-setting.attributes','define','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0x2af333,_0x54f43f){var _0x1f22a5=function(_0x15ff1b){while(--_0x15ff1b){_0x2af333['push'](_0x2af333['shift']());}};_0x1f22a5(++_0x54f43f);}(_0x3276,0xc7));var _0x6327=function(_0x5a5a95,_0x3a8fb0){_0x5a5a95=_0x5a5a95-0x0;var _0x476608=_0x3276[_0x5a5a95];return _0x476608;};'use strict';var attributes=require(_0x6327('0x0'));module['exports']=function(_0x4c10de){return _0x4c10de[_0x6327('0x1')](_0x6327('0x2'),attributes,{'tableName':_0x6327('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1ca8a6){if(!_0x1ca8a6[_0x6327('0x4')])_0x1ca8a6[_0x6327('0x5')]=null;else if(_0x1ca8a6[_0x6327('0x5')]===null)_0x1ca8a6['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0x2fe3=['exports','UserSetting','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2fe3,0x87));var _0x32fe=function(_0x220930,_0x405c50){_0x220930=_0x220930-0x0;var _0x6d32d0=_0x2fe3[_0x220930];return _0x6d32d0;};'use strict';var attributes=require(_0x32fe('0x0'));module[_0x32fe('0x1')]=function(_0x4795c6){return _0x4795c6['define'](_0x32fe('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2f85c0){if(!_0x2f85c0['clientSideLoggingEnabled'])_0x2f85c0['clientSideLoggingEnabledSince']=null;else if(_0x2f85c0[_0x32fe('0x3')]===null)_0x2f85c0[_0x32fe('0x3')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index ec6a5c7..783c371 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb279=['emit','user-setting:update','user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events','save','update'];(function(_0x486cbe,_0x42c384){var _0x216a7f=function(_0x2c9e56){while(--_0x2c9e56){_0x486cbe['push'](_0x486cbe['shift']());}};_0x216a7f(++_0x42c384);}(_0xb279,0x165));var _0x9b27=function(_0x48dffb,_0x425252){_0x48dffb=_0x48dffb-0x0;var _0x5a2fc8=_0xb279[_0x48dffb];return _0x5a2fc8;};'use strict';var UserSettingEvents=require(_0x9b27('0x0'));var events=[_0x9b27('0x1'),'remove',_0x9b27('0x2')];function createListener(_0x4b6ca4,_0x3beb7a){return function(_0x5cf1b9){_0x3beb7a[_0x9b27('0x3')](_0x4b6ca4,_0x5cf1b9);if(_0x4b6ca4===_0x9b27('0x4')){_0x3beb7a[_0x9b27('0x3')](_0x9b27('0x5')+_0x5cf1b9[_0x9b27('0x6')],_0x5cf1b9);}};}exports[_0x9b27('0x7')]=function(_0x37becc){for(var _0x570d9d=0x0,_0x5da670=events[_0x9b27('0x8')];_0x570d9d<_0x5da670;_0x570d9d++){var _0x16e6e7=events[_0x570d9d];var _0x3aac06=createListener(_0x9b27('0x9')+_0x16e6e7,_0x37becc);UserSettingEvents['on'](_0x16e6e7,_0x3aac06);}}; \ No newline at end of file +var _0x23b9=['register','user-setting:','remove','update','emit','user-setting:update'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x23b9,0x170));var _0x923b=function(_0x2862eb,_0x398d09){_0x2862eb=_0x2862eb-0x0;var _0x1f3b64=_0x23b9[_0x2862eb];return _0x1f3b64;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=['save',_0x923b('0x0'),_0x923b('0x1')];function createListener(_0x23d724,_0xc5a5b3){return function(_0x47c5e2){_0xc5a5b3[_0x923b('0x2')](_0x23d724,_0x47c5e2);if(_0x23d724===_0x923b('0x3')){_0xc5a5b3['emit']('user-setting:update:user-'+_0x47c5e2['UserId'],_0x47c5e2);}};}exports[_0x923b('0x4')]=function(_0x17ee51){for(var _0x42bfd3=0x0,_0x54804d=events['length'];_0x42bfd3<_0x54804d;_0x42bfd3++){var _0x409a69=events[_0x42bfd3];var _0x5014c0=createListener(_0x923b('0x5')+_0x409a69,_0x17ee51);UserSettingEvents['on'](_0x409a69,_0x5014c0);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index eb8fe52..214d37e 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 _0x874c=['addWhatsappAccounts','/:id/api_key','/:id/password','changePassword','removeQueues','delete','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','path','express','Router','fs-extra','../../config/environment','./user.controller','get','/describe','isAuthenticated','describe','/whoami','whoami','/presence','getPresence','/:id','show','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','/:id/recordings','getRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/sms/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/lists','getLists','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','post','addContacts','create','bulkCreate','addQueues','diskStorage','join','server/files/images/','format','%s-%s','now','originalname','/:id/avatar','single','file','login','/:id/logout','logout','/:id/pause','pause','unpause','/:id/teams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites'];(function(_0x3b3a64,_0xb56866){var _0x167312=function(_0x2a258e){while(--_0x2a258e){_0x3b3a64['push'](_0x3b3a64['shift']());}};_0x167312(++_0xb56866);}(_0x874c,0x15a));var _0xc874=function(_0x5f2957,_0x1ec9b9){_0x5f2957=_0x5f2957-0x0;var _0xb0486d=_0x874c[_0x5f2957];return _0xb0486d;};'use strict';var multer=require(_0xc874('0x0'));var util=require('util');var path=require(_0xc874('0x1'));var timeout=require('connect-timeout');var express=require(_0xc874('0x2'));var router=express[_0xc874('0x3')]();var fs_extra=require(_0xc874('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc874('0x5'));var controller=require(_0xc874('0x6'));router[_0xc874('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc874('0x8'),auth[_0xc874('0x9')](),controller[_0xc874('0xa')]);router[_0xc874('0x7')](_0xc874('0xb'),auth[_0xc874('0x9')](),controller[_0xc874('0xc')]);router[_0xc874('0x7')](_0xc874('0xd'),auth[_0xc874('0x9')](),controller[_0xc874('0xe')]);router[_0xc874('0x7')](_0xc874('0xf'),auth['isAuthenticated'](),controller[_0xc874('0x10')]);router['get']('/:id/avatar',controller[_0xc874('0x11')]);router[_0xc874('0x7')](_0xc874('0x12'),auth['isAuthenticated'](),controller['getOpenTabs']);router[_0xc874('0x7')](_0xc874('0x13'),auth['isAuthenticated'](),controller[_0xc874('0x14')]);router[_0xc874('0x7')](_0xc874('0x15'),auth[_0xc874('0x9')](),controller[_0xc874('0x16')]);router[_0xc874('0x7')](_0xc874('0x17'),auth[_0xc874('0x9')](),controller['getVoiceQueuesRt']);router[_0xc874('0x7')](_0xc874('0x18'),auth['isAuthenticated'](),controller['getGroups']);router['get'](_0xc874('0x19'),auth[_0xc874('0x9')](),controller[_0xc874('0x1a')]);router[_0xc874('0x7')]('/:id/screen_recordings',auth[_0xc874('0x9')](),controller['getScreenRecordings']);router[_0xc874('0x7')](_0xc874('0x1b'),auth[_0xc874('0x9')](),controller[_0xc874('0x1c')]);router[_0xc874('0x7')](_0xc874('0x1d'),auth[_0xc874('0x9')](),controller['getOpenchannelInteractions']);router[_0xc874('0x7')]('/:id/mail/interactions',auth[_0xc874('0x9')](),controller['getMailInteractions']);router[_0xc874('0x7')](_0xc874('0x1e'),auth[_0xc874('0x9')](),controller['getSmsInteractions']);router[_0xc874('0x7')]('/:id/fax/interactions',auth[_0xc874('0x9')](),controller[_0xc874('0x1f')]);router['get'](_0xc874('0x20'),auth[_0xc874('0x9')](),controller[_0xc874('0x21')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0xc874('0x7')](_0xc874('0x22'),auth[_0xc874('0x9')](),controller[_0xc874('0x23')]);router['get']('/:id/agents',auth[_0xc874('0x9')](),controller['getAgents']);router['get'](_0xc874('0x24'),auth[_0xc874('0x9')](),controller[_0xc874('0x25')]);router[_0xc874('0x7')](_0xc874('0x26'),auth[_0xc874('0x9')](),controller[_0xc874('0x27')]);router[_0xc874('0x7')]('/:id/mail_accounts',auth[_0xc874('0x9')](),controller['getMailAccounts']);router[_0xc874('0x7')](_0xc874('0x28'),auth[_0xc874('0x9')](),controller[_0xc874('0x29')]);router['get'](_0xc874('0x2a'),auth[_0xc874('0x9')](),controller['getSmsAccounts']);router[_0xc874('0x7')](_0xc874('0x2b'),auth['isAuthenticated'](),controller['getChatWebsites']);router[_0xc874('0x7')](_0xc874('0x2c'),auth[_0xc874('0x9')](),controller['getWhatsappAccounts']);router[_0xc874('0x7')](_0xc874('0x2d'),auth[_0xc874('0x9')](),controller[_0xc874('0x2e')]);router[_0xc874('0x7')]('/:id/api_key',auth[_0xc874('0x9')](),controller['getApiKey']);router[_0xc874('0x2f')]('/:id/contacts',auth[_0xc874('0x9')](),controller[_0xc874('0x30')]);router[_0xc874('0x2f')]('/',auth[_0xc874('0x9')](),controller[_0xc874('0x31')]);router[_0xc874('0x2f')]('/create_many',auth[_0xc874('0x9')](),controller[_0xc874('0x32')]);router['post'](_0xc874('0x15'),auth[_0xc874('0x9')](),controller[_0xc874('0x33')]);var upload=multer({'storage':multer[_0xc874('0x34')]({'destination':function(_0x343398,_0x3dbcb6,_0x1723e1){_0x1723e1(null,path[_0xc874('0x35')](config['root'],_0xc874('0x36')));},'filename':function(_0x1f6e92,_0x479497,_0x2aac08){_0x2aac08(null,util[_0xc874('0x37')](_0xc874('0x38'),Date[_0xc874('0x39')](),_0x479497[_0xc874('0x3a')]));}})});router[_0xc874('0x2f')](_0xc874('0x3b'),upload[_0xc874('0x3c')](_0xc874('0x3d')),controller['addAvatar']);router[_0xc874('0x2f')]('/:id/login',auth[_0xc874('0x9')](),controller[_0xc874('0x3e')]);router[_0xc874('0x2f')](_0xc874('0x3f'),auth[_0xc874('0x9')](),controller[_0xc874('0x40')]);router[_0xc874('0x2f')](_0xc874('0x41'),auth['isAuthenticated'](),controller[_0xc874('0x42')]);router[_0xc874('0x2f')]('/:id/unpause',auth['isAuthenticated'](),controller[_0xc874('0x43')]);router['post'](_0xc874('0x44'),auth['isAuthenticated'](),controller['addTeams']);router[_0xc874('0x2f')](_0xc874('0x45'),auth['isAuthenticated'](),controller[_0xc874('0x46')]);router[_0xc874('0x2f')](_0xc874('0x47'),auth[_0xc874('0x9')](),controller[_0xc874('0x48')]);router[_0xc874('0x2f')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0xc874('0x49')]);router[_0xc874('0x2f')](_0xc874('0x4a'),auth[_0xc874('0x9')](),controller[_0xc874('0x4b')]);router[_0xc874('0x2f')](_0xc874('0x4c'),auth[_0xc874('0x9')](),controller[_0xc874('0x4d')]);router['post'](_0xc874('0x4e'),auth[_0xc874('0x9')](),controller[_0xc874('0x4f')]);router[_0xc874('0x2f')](_0xc874('0x26'),auth['isAuthenticated'](),controller[_0xc874('0x50')]);router['post'](_0xc874('0x51'),auth[_0xc874('0x9')](),controller[_0xc874('0x52')]);router[_0xc874('0x2f')](_0xc874('0x28'),auth['isAuthenticated'](),controller[_0xc874('0x53')]);router[_0xc874('0x2f')](_0xc874('0x2a'),auth['isAuthenticated'](),controller[_0xc874('0x54')]);router[_0xc874('0x2f')](_0xc874('0x2b'),auth[_0xc874('0x9')](),controller[_0xc874('0x55')]);router['post'](_0xc874('0x2c'),auth['isAuthenticated'](),controller[_0xc874('0x56')]);router[_0xc874('0x2f')](_0xc874('0x57'),auth[_0xc874('0x9')](),controller['createApiKey']);router['put']('/:id',auth[_0xc874('0x9')](),controller['update']);router['put'](_0xc874('0x58'),auth[_0xc874('0x9')](),controller[_0xc874('0x59')]);router['delete'](_0xc874('0x15'),auth[_0xc874('0x9')](),controller[_0xc874('0x5a')]);router['delete'](_0xc874('0x44'),auth[_0xc874('0x9')](),controller['removeTeams']);router[_0xc874('0x5b')](_0xc874('0xf'),auth['isAuthenticated'](),controller[_0xc874('0x5c')]);router[_0xc874('0x5b')]('/:id/chat_interactions',auth[_0xc874('0x9')](),controller[_0xc874('0x5d')]);router[_0xc874('0x5b')]('/:id/mail_interactions',auth[_0xc874('0x9')](),controller[_0xc874('0x5e')]);router[_0xc874('0x5b')](_0xc874('0x5f'),auth[_0xc874('0x9')](),controller[_0xc874('0x60')]);router[_0xc874('0x5b')](_0xc874('0x4a'),auth[_0xc874('0x9')](),controller[_0xc874('0x61')]);router[_0xc874('0x5b')]('/:id/openchannel_interactions',auth[_0xc874('0x9')](),controller[_0xc874('0x62')]);router[_0xc874('0x5b')](_0xc874('0x4e'),auth[_0xc874('0x9')](),controller['removeWhatsappInteractions']);router['delete'](_0xc874('0x26'),auth[_0xc874('0x9')](),controller[_0xc874('0x63')]);router[_0xc874('0x5b')](_0xc874('0x51'),auth[_0xc874('0x9')](),controller[_0xc874('0x64')]);router[_0xc874('0x5b')](_0xc874('0x28'),auth['isAuthenticated'](),controller[_0xc874('0x65')]);router[_0xc874('0x5b')](_0xc874('0x2a'),auth['isAuthenticated'](),controller[_0xc874('0x66')]);router[_0xc874('0x5b')](_0xc874('0x2b'),auth['isAuthenticated'](),controller[_0xc874('0x67')]);router[_0xc874('0x5b')](_0xc874('0x2c'),auth[_0xc874('0x9')](),controller[_0xc874('0x68')]);router[_0xc874('0x5b')](_0xc874('0x57'),auth[_0xc874('0x9')](),controller['removeApiKey']);router[_0xc874('0x2f')](_0xc874('0x69'),auth[_0xc874('0x9')](),controller[_0xc874('0x6a')]);module[_0xc874('0x6b')]=router; \ No newline at end of file +var _0x21bd=['getPresence','get','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','format','%s-%s','now','originalname','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','/:id','put','/:id/password','delete','/:id/queues','removeQueues','removeTeams','destroy','removeMailInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/describe','describe','/whoami','whoami'];(function(_0x5ca644,_0x3d2165){var _0x5c87a2=function(_0x3dc7d9){while(--_0x3dc7d9){_0x5ca644['push'](_0x5ca644['shift']());}};_0x5c87a2(++_0x3d2165);}(_0x21bd,0x157));var _0xd21b=function(_0x229fe8,_0x502f24){_0x229fe8=_0x229fe8-0x0;var _0x354ca8=_0x21bd[_0x229fe8];return _0x354ca8;};'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('./user.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']('/presence',auth[_0xd21b('0x8')](),controller[_0xd21b('0xe')]);router[_0xd21b('0xf')]('/:id',auth[_0xd21b('0x8')](),controller['show']);router[_0xd21b('0xf')](_0xd21b('0x10'),controller[_0xd21b('0x11')]);router[_0xd21b('0xf')](_0xd21b('0x12'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x13')]);router['get'](_0xd21b('0x14'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x15')]);router[_0xd21b('0xf')]('/:id/queues',auth[_0xd21b('0x8')](),controller[_0xd21b('0x16')]);router[_0xd21b('0xf')](_0xd21b('0x17'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x18')]);router[_0xd21b('0xf')](_0xd21b('0x19'),auth['isAuthenticated'](),controller[_0xd21b('0x1a')]);router['get']('/:id/recordings',auth[_0xd21b('0x8')](),controller[_0xd21b('0x1b')]);router[_0xd21b('0xf')]('/:id/screen_recordings',auth[_0xd21b('0x8')](),controller[_0xd21b('0x1c')]);router[_0xd21b('0xf')]('/:id/chat/interactions',auth[_0xd21b('0x8')](),controller[_0xd21b('0x1d')]);router[_0xd21b('0xf')](_0xd21b('0x1e'),auth['isAuthenticated'](),controller[_0xd21b('0x1f')]);router[_0xd21b('0xf')]('/:id/mail/interactions',auth[_0xd21b('0x8')](),controller[_0xd21b('0x20')]);router[_0xd21b('0xf')](_0xd21b('0x21'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x22')]);router[_0xd21b('0xf')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0xd21b('0x23')]);router[_0xd21b('0xf')]('/:id/whatsapp/interactions',auth[_0xd21b('0x8')](),controller['getWhatsappInteractions']);router['get'](_0xd21b('0x24'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x25')]);router['get'](_0xd21b('0x26'),auth[_0xd21b('0x8')](),controller['getLists']);router[_0xd21b('0xf')](_0xd21b('0x27'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x28')]);router['get'](_0xd21b('0x29'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x2a')]);router[_0xd21b('0xf')]('/:id/fax_accounts',auth[_0xd21b('0x8')](),controller[_0xd21b('0x2b')]);router['get'](_0xd21b('0x2c'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x2d')]);router[_0xd21b('0xf')](_0xd21b('0x2e'),auth[_0xd21b('0x8')](),controller['getOpenchannelAccounts']);router[_0xd21b('0xf')](_0xd21b('0x2f'),auth['isAuthenticated'](),controller[_0xd21b('0x30')]);router['get'](_0xd21b('0x31'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x32')]);router['get'](_0xd21b('0x33'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x34')]);router[_0xd21b('0xf')](_0xd21b('0x35'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x36')]);router[_0xd21b('0xf')](_0xd21b('0x37'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x38')]);router[_0xd21b('0x39')](_0xd21b('0x14'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x3a')]);router[_0xd21b('0x39')]('/',auth[_0xd21b('0x8')](),controller[_0xd21b('0x3b')]);router[_0xd21b('0x39')](_0xd21b('0x3c'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x3d')]);router[_0xd21b('0x39')]('/:id/queues',auth[_0xd21b('0x8')](),controller[_0xd21b('0x3e')]);var upload=multer({'storage':multer[_0xd21b('0x3f')]({'destination':function(_0x2aba60,_0xb9b863,_0x2ca280){_0x2ca280(null,path[_0xd21b('0x40')](config['root'],'server/files/images/'));},'filename':function(_0x393895,_0x4e1b44,_0x46fb9a){_0x46fb9a(null,util[_0xd21b('0x41')](_0xd21b('0x42'),Date[_0xd21b('0x43')](),_0x4e1b44[_0xd21b('0x44')]));}})});router['post'](_0xd21b('0x10'),upload['single'](_0xd21b('0x45')),controller[_0xd21b('0x46')]);router[_0xd21b('0x39')](_0xd21b('0x47'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x48')]);router[_0xd21b('0x39')](_0xd21b('0x49'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x4a')]);router[_0xd21b('0x39')](_0xd21b('0x4b'),auth['isAuthenticated'](),controller[_0xd21b('0x4c')]);router[_0xd21b('0x39')](_0xd21b('0x4d'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x4e')]);router[_0xd21b('0x39')](_0xd21b('0x24'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x4f')]);router[_0xd21b('0x39')](_0xd21b('0x50'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x51')]);router[_0xd21b('0x39')](_0xd21b('0x52'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x53')]);router['post'](_0xd21b('0x54'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x55')]);router[_0xd21b('0x39')](_0xd21b('0x56'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x57')]);router['post']('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0xd21b('0x58')]);router[_0xd21b('0x39')](_0xd21b('0x59'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x5a')]);router[_0xd21b('0x39')](_0xd21b('0x5b'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x5c')]);router[_0xd21b('0x39')]('/:id/mail_accounts',auth['isAuthenticated'](),controller['addMailAccounts']);router['post'](_0xd21b('0x2e'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x5d')]);router[_0xd21b('0x39')](_0xd21b('0x2f'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x5e')]);router[_0xd21b('0x39')](_0xd21b('0x31'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x5f')]);router[_0xd21b('0x39')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xd21b('0x60')]);router[_0xd21b('0x39')](_0xd21b('0x37'),auth['isAuthenticated'](),controller[_0xd21b('0x61')]);router['put'](_0xd21b('0x62'),auth[_0xd21b('0x8')](),controller['update']);router[_0xd21b('0x63')](_0xd21b('0x64'),auth[_0xd21b('0x8')](),controller['changePassword']);router[_0xd21b('0x65')](_0xd21b('0x66'),auth['isAuthenticated'](),controller[_0xd21b('0x67')]);router[_0xd21b('0x65')](_0xd21b('0x24'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x68')]);router[_0xd21b('0x65')](_0xd21b('0x62'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x69')]);router[_0xd21b('0x65')](_0xd21b('0x50'),auth[_0xd21b('0x8')](),controller['removeChatInteractions']);router[_0xd21b('0x65')]('/:id/mail_interactions',auth[_0xd21b('0x8')](),controller[_0xd21b('0x6a')]);router[_0xd21b('0x65')](_0xd21b('0x54'),auth[_0xd21b('0x8')](),controller['removeFaxInteractions']);router[_0xd21b('0x65')](_0xd21b('0x56'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x6b')]);router[_0xd21b('0x65')](_0xd21b('0x6c'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x6d')]);router['delete'](_0xd21b('0x59'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x6e')]);router[_0xd21b('0x65')](_0xd21b('0x5b'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x6f')]);router[_0xd21b('0x65')](_0xd21b('0x2c'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0xd21b('0x65')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xd21b('0x70')]);router[_0xd21b('0x65')](_0xd21b('0x2f'),auth[_0xd21b('0x8')](),controller['removeSmsAccounts']);router[_0xd21b('0x65')](_0xd21b('0x31'),auth['isAuthenticated'](),controller[_0xd21b('0x71')]);router['delete'](_0xd21b('0x33'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x72')]);router[_0xd21b('0x65')](_0xd21b('0x37'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x73')]);router[_0xd21b('0x39')](_0xd21b('0x74'),auth[_0xd21b('0x8')](),controller[_0xd21b('0x75')]);module[_0xd21b('0x76')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 6f4a008..4494d32 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 _0x44da=['setDataValue','defaultuser','format','\x22%s\x22\x20<%s>','getDataValue','STRING','email','toLowerCase','ENUM','user','internal','accountcode','callerid','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','join','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','split','insecure','never','always','refuse','originate','uas','certificate','passive','actpass','update,nonat','showWebBar','get','wss','udp','avpf','force_avp','dtlsenable','dtlsverify','rtcp_mux','encryption','icesupport','dtlscertfile','dtlsprivatekey','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','exports','name'];(function(_0x3d2403,_0x1f6af7){var _0x34f993=function(_0xbe32a){while(--_0xbe32a){_0x3d2403['push'](_0x3d2403['shift']());}};_0x34f993(++_0x1f6af7);}(_0x44da,0x189));var _0xa44d=function(_0x4585c1,_0x112003){_0x4585c1=_0x4585c1-0x0;var _0x29fdb8=_0x44da[_0x4585c1];return _0x29fdb8;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require('util');var _=require('lodash');module[_0xa44d('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa44d('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2d2bc1){this[_0xa44d('0x2')](_0xa44d('0x1'),_0x2d2bc1);this['setDataValue'](_0xa44d('0x3'),_0x2d2bc1);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x77f095){this[_0xa44d('0x2')]('fullname',_0x77f095);this[_0xa44d('0x2')]('callerid',util[_0xa44d('0x4')](_0xa44d('0x5'),_0x77f095,this[_0xa44d('0x6')]('internal')));}},'alias':{'type':Sequelize[_0xa44d('0x7')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa44d('0x8'),'validate':{'isEmail':!![]},'set':function(_0x58ab18){if(_0x58ab18){this[_0xa44d('0x2')](_0xa44d('0x8'),_0x58ab18[_0xa44d('0x9')]());}}},'role':{'type':Sequelize[_0xa44d('0xa')]('admin',_0xa44d('0xb'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xa44d('0x7')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xa44d('0x7')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xa44d('0xc'),'set':function(_0x1ab4af){this[_0xa44d('0x2')]('internal',_0x1ab4af);this['setDataValue'](_0xa44d('0xd'),_0x1ab4af);this[_0xa44d('0x2')](_0xa44d('0xe'),util[_0xa44d('0x4')](_0xa44d('0x5'),this[_0xa44d('0x6')]('fullname'),_0x1ab4af));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xa44d('0x7')]},'mobile':{'type':Sequelize[_0xa44d('0x7')]},'address':{'type':Sequelize[_0xa44d('0x7')]},'zipcode':{'type':Sequelize[_0xa44d('0x7')]},'userpic':{'type':Sequelize[_0xa44d('0x7')]},'city':{'type':Sequelize[_0xa44d('0x7')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xa44d('0x10')]},'voicePause':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xa44d('0x11')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xa44d('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xa44d('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xa44d('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xa44d('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xa44d('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xa44d('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xa44d('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xa44d('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'host':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![],'defaultValue':_0xa44d('0x13')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xa44d('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xa44d('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xa44d('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xa44d('0xa')](_0xa44d('0x14'),'user',_0xa44d('0x15')),'allowNull':!![],'defaultValue':_0xa44d('0x14')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xa44d('0x16')},'callingpres':{'type':Sequelize['ENUM'](_0xa44d('0x17'),_0xa44d('0x18'),_0xa44d('0x19'),_0xa44d('0x1a'),_0xa44d('0x1b'),_0xa44d('0x1c'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'permit':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'secret':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'transport':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![],'defaultValue':'udp','set':function(_0x7e1942){this[_0xa44d('0x2')]('transport',_0x7e1942?_0x7e1942['join'](','):null);},'get':function(){return this[_0xa44d('0x6')]('transport')?this[_0xa44d('0x6')](_0xa44d('0x1d'))['split'](','):null;},'comment':_0xa44d('0x1e')},'dtmfmode':{'type':Sequelize[_0xa44d('0xa')](_0xa44d('0x1f'),_0xa44d('0x20'),_0xa44d('0x21'),_0xa44d('0x22'),_0xa44d('0x23')),'allowNull':!![],'defaultValue':_0xa44d('0x1f')},'directmedia':{'type':Sequelize[_0xa44d('0xa')](_0xa44d('0x24'),'no',_0xa44d('0x25'),_0xa44d('0x26'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa44d('0xa')](_0xa44d('0x24'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x241dd9){this[_0xa44d('0x2')]('nat',_0x241dd9?_0x241dd9[_0xa44d('0x27')](','):null);},'get':function(){return this[_0xa44d('0x6')](_0xa44d('0x28'))?this[_0xa44d('0x6')](_0xa44d('0x28'))['split'](','):null;},'comment':_0xa44d('0x29')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xa44d('0x7')]},'namedpickupgroup':{'type':Sequelize[_0xa44d('0x7')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xa44d('0x7')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa44d('0x2a')},'allow':{'type':Sequelize[_0xa44d('0x7')],'allowNull':![],'defaultValue':_0xa44d('0x2b'),'set':function(_0x2b63ce){this[_0xa44d('0x2')](_0xa44d('0x2c'),_0x2b63ce?_0x2b63ce[_0xa44d('0x27')](';'):_0xa44d('0x2b'));},'get':function(){return this[_0xa44d('0x6')](_0xa44d('0x2c'))?this['getDataValue'](_0xa44d('0x2c'))[_0xa44d('0x2d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xa44d('0xa')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![],'set':function(_0x302a72){this['setDataValue'](_0xa44d('0x2e'),_0x302a72?_0x302a72['join'](','):null);},'get':function(){return this['getDataValue'](_0xa44d('0x2e'))?this[_0xa44d('0x6')](_0xa44d('0x2e'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xa44d('0xa')](_0xa44d('0x24'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xa44d('0x24'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa44d('0xa')](_0xa44d('0x24'),'no',_0xa44d('0x2f')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xa44d('0xa')](_0xa44d('0x24'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xa44d('0xa')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xa44d('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xa44d('0xa')](_0xa44d('0x24'),'no'),'allowNull':!![],'defaultValue':_0xa44d('0x24')},'busylevel':{'type':Sequelize[_0xa44d('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xa44d('0xa')](_0xa44d('0x24'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xa44d('0x24'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xa44d('0xa')](_0xa44d('0x24'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xa44d('0xa')](_0xa44d('0x24'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xa44d('0xa')]('yes','no',_0xa44d('0x30')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa44d('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xa44d('0xa')]('accept',_0xa44d('0x31'),_0xa44d('0x32')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xa44d('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xa44d('0xa')]('uac',_0xa44d('0x33')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0xa44d('0xa')](_0xa44d('0x24'),'no'),'allowNull':!![],'defaultValue':_0xa44d('0x24')},'keepalive':{'type':Sequelize[_0xa44d('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xa44d('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xa44d('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xa44d('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xa44d('0xa')](_0xa44d('0x24'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xa44d('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xa44d('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xa44d('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xa44d('0xa')](_0xa44d('0x24'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa44d('0xa')](_0xa44d('0x24'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xa44d('0xa')](_0xa44d('0x24'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xa44d('0xa')](_0xa44d('0x24'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xa44d('0xa')](_0xa44d('0x24'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xa44d('0xa')](_0xa44d('0x24'),'no','fingerprint',_0xa44d('0x34')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0xa44d('0x35'),_0xa44d('0x36')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xa44d('0xa')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xa44d('0xa')](_0xa44d('0x24'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xa44d('0xa')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0xa44d('0x25'),_0xa44d('0x26'),_0xa44d('0x37')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xa44d('0x7')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xa44d('0x10')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0xa44d('0x12')],'defaultValue':0x0,'set':function(_0x10b204){this[_0xa44d('0x2')](_0xa44d('0x38'),_0x10b204);var _0x559cb0=this[_0xa44d('0x39')]({'plain':!![]});switch(_0x10b204){case 0x0:case 0x1:var _0x334eba=_0x559cb0[_0xa44d('0x1d')]?_['isArray'](_0x559cb0[_0xa44d('0x1d')])?_0x559cb0[_0xa44d('0x1d')][_0xa44d('0x27')]():_0x559cb0[_0xa44d('0x1d')]:'udp';if(_0x334eba===_0xa44d('0x3a')){_0x334eba=_0xa44d('0x3b');}this[_0xa44d('0x2')](_0xa44d('0x1d'),_0x334eba);this[_0xa44d('0x2')]('encryption','no');this[_0xa44d('0x2')](_0xa44d('0x3c'),null);this[_0xa44d('0x2')](_0xa44d('0x3d'),null);this[_0xa44d('0x2')]('icesupport',null);this[_0xa44d('0x2')](_0xa44d('0x3e'),null);this[_0xa44d('0x2')](_0xa44d('0x3f'),null);this[_0xa44d('0x2')]('dtlssetup',null);this[_0xa44d('0x2')]('dtlscertfile',null);this[_0xa44d('0x2')]('dtlsprivatekey',null);this[_0xa44d('0x2')](_0xa44d('0x40'),'no');break;case 0x2:this[_0xa44d('0x2')]('transport',_0xa44d('0x3a'));this[_0xa44d('0x2')](_0xa44d('0x41'),'yes');this[_0xa44d('0x2')](_0xa44d('0x3c'),'yes');this[_0xa44d('0x2')]('force_avp','yes');this[_0xa44d('0x2')](_0xa44d('0x42'),_0xa44d('0x24'));this[_0xa44d('0x2')](_0xa44d('0x3e'),_0xa44d('0x24'));this['setDataValue'](_0xa44d('0x3f'),'no');this['setDataValue']('dtlssetup',_0xa44d('0x36'));this['setDataValue'](_0xa44d('0x43'),_0x559cb0[_0xa44d('0x43')]||'/etc/pki/tls/certs/motion.crt');this[_0xa44d('0x2')](_0xa44d('0x44'),_0x559cb0[_0xa44d('0x44')]||'/etc/pki/tls/private/motion.key');this[_0xa44d('0x2')](_0xa44d('0x40'),_0xa44d('0x24'));break;default:}}},'permissions':{'type':Sequelize[_0xa44d('0x45')],'set':function(_0x3f9dea){this['setDataValue'](_0xa44d('0x46'),_0x3f9dea?_0x3f9dea[_0xa44d('0x27')](','):[]);},'get':function(){return this[_0xa44d('0x6')](_0xa44d('0x46'))?_[_0xa44d('0x47')](this[_0xa44d('0x6')](_0xa44d('0x46'))[_0xa44d('0x2d')](','),function(_0x1a9fa5){return parseInt(_0x1a9fa5,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xa44d('0x7')]},'phoneBarBusyNumber':{'type':Sequelize[_0xa44d('0x7')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xa44d('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xa44d('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xa44d('0xa')](_0xa44d('0x24'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xa44d('0x48')],'get':function(){return this[_0xa44d('0x6')](_0xa44d('0x49'))?this[_0xa44d('0x6')](_0xa44d('0x49')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xa44d('0x7')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![],'set':function(_0x33812c){if(typeof _0x33812c===_0xa44d('0x4a')){var _0x409796=_0x33812c==='1'?!![]:_0x33812c==='0'?![]:_0x33812c==='true'?!![]:_0x33812c===_0xa44d('0x4b')?![]:![];this[_0xa44d('0x2')](_0xa44d('0x4c'),_0x409796);}else{this[_0xa44d('0x2')](_0xa44d('0x4c'),_0x33812c);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x5ad2cc){this[_0xa44d('0x2')](_0xa44d('0x4d'),_0x5ad2cc);if(_0x5ad2cc===!![]){this[_0xa44d('0x2')](_0xa44d('0x4e'),moment());this[_0xa44d('0x2')]('loginAttempts',0x0);}else{this[_0xa44d('0x2')](_0xa44d('0x4e'),null);}}},'blockedAt':{'type':Sequelize[_0xa44d('0x10')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xa44d('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xa44d('0x12')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xa44d('0x12')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xa44d('0x12')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xa44d('0x12')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xa44d('0xf')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1929=['auto','yes','nonat','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\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','passive','actpass','update,nonat','TEXT','showWebBar','get','wss','encryption','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlsenable','/etc/pki/tls/certs/motion.crt','permissions','map','true','false','screenrecording','blocked','sequelize','moment','util','lodash','exports','STRING','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','local','INTEGER','accountcode','format','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','friend','user','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband'];(function(_0x164798,_0x29e959){var _0xc5da=function(_0x30e86f){while(--_0x30e86f){_0x164798['push'](_0x164798['shift']());}};_0xc5da(++_0x29e959);}(_0x1929,0xdb));var _0x9192=function(_0x544099,_0x372b30){_0x544099=_0x544099-0x0;var _0x20ab09=_0x1929[_0x544099];return _0x20ab09;};'use strict';var Sequelize=require(_0x9192('0x0'));var moment=require(_0x9192('0x1'));var util=require(_0x9192('0x2'));var _=require(_0x9192('0x3'));module[_0x9192('0x4')]={'name':{'type':Sequelize[_0x9192('0x5')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x6804a4){this[_0x9192('0x6')](_0x9192('0x7'),_0x6804a4);this[_0x9192('0x6')](_0x9192('0x8'),_0x6804a4);},'comment':_0x9192('0x9')},'fullname':{'type':Sequelize[_0x9192('0x5')],'allowNull':![],'set':function(_0x31a426){this[_0x9192('0x6')]('fullname',_0x31a426);this[_0x9192('0x6')]('callerid',util['format'](_0x9192('0xa'),_0x31a426,this[_0x9192('0xb')](_0x9192('0xc'))));}},'alias':{'type':Sequelize[_0x9192('0x5')]},'email':{'type':Sequelize[_0x9192('0x5')],'allowNull':![],'unique':_0x9192('0xd'),'validate':{'isEmail':!![]},'set':function(_0x1ab929){if(_0x1ab929){this['setDataValue'](_0x9192('0xd'),_0x1ab929[_0x9192('0xe')]());}}},'role':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x10'),'user',_0x9192('0x11'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x9192('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x9192('0x5')],'defaultValue':_0x9192('0x12')},'internal':{'type':Sequelize[_0x9192('0x13')](0xb),'allowNull':![],'unique':_0x9192('0xc'),'set':function(_0x31f99b){this['setDataValue'](_0x9192('0xc'),_0x31f99b);this[_0x9192('0x6')](_0x9192('0x14'),_0x31f99b);this['setDataValue']('callerid',util[_0x9192('0x15')](_0x9192('0xa'),this['getDataValue'](_0x9192('0x16')),_0x31f99b));}},'salt':{'type':Sequelize[_0x9192('0x5')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x9192('0x5')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x9192('0x5')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x9192('0x5')]},'online':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x9192('0x18')]},'voicePause':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x9192('0x5')],'defaultValue':_0x9192('0x19')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x9192('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x9192('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x9192('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x9192('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x1a'),_0x9192('0x1b'),_0x9192('0x1c')),'allowNull':!![],'defaultValue':_0x9192('0x1a')},'context':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![],'defaultValue':_0x9192('0x1d')},'callingpres':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x1e'),_0x9192('0x1f'),'ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED',_0x9192('0x20'),_0x9192('0x21'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9192('0x22'),'set':function(_0x467458){this['setDataValue'](_0x9192('0x23'),_0x467458?_0x467458[_0x9192('0x24')](','):null);},'get':function(){return this[_0x9192('0xb')]('transport')?this[_0x9192('0xb')]('transport')[_0x9192('0x25')](','):null;},'comment':_0x9192('0x26')},'dtmfmode':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x27'),_0x9192('0x28'),'shortinfo',_0x9192('0x29'),_0x9192('0x2a')),'allowNull':!![],'defaultValue':_0x9192('0x27')},'directmedia':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no',_0x9192('0x2c'),_0x9192('0x2d'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9192('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9192('0x2e'),'set':function(_0x42ee2e){this[_0x9192('0x6')](_0x9192('0x2f'),_0x42ee2e?_0x42ee2e[_0x9192('0x24')](','):null);},'get':function(){return this[_0x9192('0xb')]('nat')?this[_0x9192('0xb')](_0x9192('0x2f'))[_0x9192('0x25')](','):null;},'comment':_0x9192('0x30')},'callgroup':{'type':Sequelize[_0x9192('0x5')]},'namedcallgroup':{'type':Sequelize[_0x9192('0x5')]},'pickupgroup':{'type':Sequelize[_0x9192('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9192('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9192('0x5')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9192('0x31')},'allow':{'type':Sequelize[_0x9192('0x5')],'allowNull':![],'defaultValue':_0x9192('0x32'),'set':function(_0x18ebc5){this[_0x9192('0x6')]('allow',_0x18ebc5?_0x18ebc5['join'](';'):_0x9192('0x32'));},'get':function(){return this[_0x9192('0xb')](_0x9192('0x33'))?this[_0x9192('0xb')](_0x9192('0x33'))[_0x9192('0x25')](';'):null;},'comment':_0x9192('0x34')},'autoframing':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![],'set':function(_0x4388e2){this['setDataValue'](_0x9192('0x35'),_0x4388e2?_0x4388e2[_0x9192('0x24')](','):null);},'get':function(){return this[_0x9192('0xb')](_0x9192('0x35'))?this[_0x9192('0xb')]('insecure')[_0x9192('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x9192('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x9192('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x9192('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x9192('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9192('0x37')},'amaflags':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x9192('0x2b')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no',_0x9192('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9192('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x39'),_0x9192('0x3a'),_0x9192('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x9192('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x9192('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x3c'),'uas'),'allowNull':!![],'defaultValue':_0x9192('0x3d')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x9192('0x2b')},'keepalive':{'type':Sequelize[_0x9192('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x9192('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x9192('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x9192('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x9192('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no','fingerprint',_0x9192('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x9192('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x9192('0xf')]('active',_0x9192('0x3f'),_0x9192('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x9192('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x9192('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x9192('0xf')](_0x9192('0x2b'),'no',_0x9192('0x2c'),'update',_0x9192('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x9192('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0x9192('0x18')]},'passwordResetAt':{'type':Sequelize[_0x9192('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x9192('0x42')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x55b9be){this[_0x9192('0x6')](_0x9192('0x43'),_0x55b9be);var _0x1709ed=this[_0x9192('0x44')]({'plain':!![]});switch(_0x55b9be){case 0x0:case 0x1:var _0x15c035=_0x1709ed[_0x9192('0x23')]?_['isArray'](_0x1709ed[_0x9192('0x23')])?_0x1709ed[_0x9192('0x23')][_0x9192('0x24')]():_0x1709ed['transport']:_0x9192('0x22');if(_0x15c035===_0x9192('0x45')){_0x15c035=_0x9192('0x22');}this[_0x9192('0x6')]('transport',_0x15c035);this[_0x9192('0x6')](_0x9192('0x46'),'no');this[_0x9192('0x6')](_0x9192('0x47'),null);this['setDataValue'](_0x9192('0x48'),null);this[_0x9192('0x6')](_0x9192('0x49'),null);this[_0x9192('0x6')]('dtlsenable',null);this[_0x9192('0x6')](_0x9192('0x4a'),null);this[_0x9192('0x6')](_0x9192('0x4b'),null);this['setDataValue'](_0x9192('0x4c'),null);this[_0x9192('0x6')](_0x9192('0x4d'),null);this['setDataValue'](_0x9192('0x4e'),'no');break;case 0x2:this['setDataValue'](_0x9192('0x23'),_0x9192('0x45'));this[_0x9192('0x6')]('encryption',_0x9192('0x2b'));this[_0x9192('0x6')](_0x9192('0x47'),_0x9192('0x2b'));this[_0x9192('0x6')]('force_avp','yes');this[_0x9192('0x6')](_0x9192('0x49'),'yes');this['setDataValue'](_0x9192('0x4f'),_0x9192('0x2b'));this[_0x9192('0x6')]('dtlsverify','no');this['setDataValue'](_0x9192('0x4b'),_0x9192('0x40'));this[_0x9192('0x6')](_0x9192('0x4c'),_0x1709ed['dtlscertfile']||_0x9192('0x50'));this[_0x9192('0x6')](_0x9192('0x4d'),_0x1709ed[_0x9192('0x4d')]||'/etc/pki/tls/private/motion.key');this[_0x9192('0x6')]('rtcp_mux',_0x9192('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0x9192('0x42')],'set':function(_0x455ab2){this[_0x9192('0x6')]('permissions',_0x455ab2?_0x455ab2[_0x9192('0x24')](','):[]);},'get':function(){return this[_0x9192('0xb')](_0x9192('0x51'))?_[_0x9192('0x52')](this[_0x9192('0xb')]('permissions')['split'](','),function(_0x8571a7){return parseInt(_0x8571a7,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x9192('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x9192('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0x9192('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x9192('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x9192('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x9192('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x9192('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x9192('0xb')]('phoneBarEnableScreenRecordingByAgent')?this[_0x9192('0xb')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x9192('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x9192('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![],'set':function(_0x55041c){if(typeof _0x55041c==='string'){var _0xf657b1=_0x55041c==='1'?!![]:_0x55041c==='0'?![]:_0x55041c===_0x9192('0x53')?!![]:_0x55041c===_0x9192('0x54')?![]:![];this[_0x9192('0x6')](_0x9192('0x55'),_0xf657b1);}else{this[_0x9192('0x6')](_0x9192('0x55'),_0x55041c);}}},'blocked':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![],'set':function(_0x2ba838){this[_0x9192('0x6')](_0x9192('0x56'),_0x2ba838);if(_0x2ba838===!![]){this[_0x9192('0x6')]('blockedAt',moment());this[_0x9192('0x6')]('loginAttempts',0x0);}else{this[_0x9192('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x9192('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x9192('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x9192('0x13')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x9192('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9192('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x9192('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x9192('0x13')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x9192('0x17')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index a16007a..09fc134 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 _0x9196=['iat','nonce','token','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','ringing','teams','queues','inbound','flatten','toString','lower','col','asc','desc','substring','uniqBy','orderBy','getRealtimeAgents','offline','voiceStatus','unavailable','busy','slice','charAt','select','ui.','InteractionId','field','ui.createdAt','user_has_','ui.UserId\x20=\x20?','OpenTabs','enabled','moment','util','path','lodash','squel','jayson/promise','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','APIForbiddenrror','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','localhost','client','http','status','end','undefined','limit','count','offset','set','Content-Range','json','info','request\x20sent','debug','stringify','error','code','User,\x20%s,\x20%s','message','result','catch','update','then','emit','destroy','get','role','Users','user','Agents','Telephones','telephone','ignore','value','includes','find','UserProfileResource','sendStatus','stack','name','send','User','map','type','key','filter','md5secret','index','getOptions','where','includeAll','include','query','userSetting','attributes','push','findAll','openTabs','true','rows','chat','dataValues','mail','whatsapp','all','show','UserSetting','merge','options','sms','fax','body','params','describe','addContacts','ids','omit','Setting','max','internal','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','length','from','mailbox','VoiceMail','password','fullname','agent','permissions','102','103','107','108','109','111','115','create','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','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','autoAssociation','compact','changePassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','Wrong\x20credentials','oldPassword','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','securePassword','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','Queue:save','voice','VoiceQueue','format','SIP/%s','UserVoiceQueueRt','upsert','remove','channel','isArray','Queue:remove','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','FaxOpenTabs','FAX','OpenchannelOpenTabs','createdAt','MailOpenTabs','MAIL','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','User\x20with\x20id\x20%s\x20not\x20found','CmList','List','Tag','Tags','color','tag','getQueues','model','keys','Queue','rawAttributes','filters','intersection','fields','sort','pick','Unknown\x20role','hasOwnProperty','nolimit','getVoiceQueuesRt','order','getGroups','ChatGroup','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:forcelogout','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','PAUSE','LOGININPAUSE','concat','isMiddleware','resolve','logout','pause','updateAttributes','DEFAULT\x20PAUSE','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','lastPauseAt','unpause','Team','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','sequelize','getAssociatedQueues','flattenDeep','getDataValue','TeamVoicePrefix','UserVoicePrefix','removeTeams','transaction','VoicePrefixId','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$gte','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contained','lastName','dialActive','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey'];(function(_0x50be84,_0x3f604d){var _0x33f452=function(_0x1dc8ae){while(--_0x1dc8ae){_0x50be84['push'](_0x50be84['shift']());}};_0x33f452(++_0x3f604d);}(_0x9196,0x1ac));var _0x6919=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x9196[_0x2c91e9];return _0x13f0ff;};'use strict';var moment=require(_0x6919('0x0'));var util=require(_0x6919('0x1'));var path=require(_0x6919('0x2'));var fs=require('fs');var _=require(_0x6919('0x3'));var squel=require(_0x6919('0x4'));var Redis=require('ioredis');var jayson=require(_0x6919('0x5'));var authService=require(_0x6919('0x6'));var contacts=require(_0x6919('0x7'));var qs=require(_0x6919('0x8'));var rta=require('../../components/realtime/agents');var logger=require(_0x6919('0x9'))(_0x6919('0xa'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6919('0xb'));var APIBadRequestError=require(_0x6919('0xc'))[_0x6919('0xd')];var APINotFoundError=require('../../errors/api')[_0x6919('0xe')];var APIForbiddenError=require('../../errors/api')[_0x6919('0xf')];var APIHandleError=require(_0x6919('0xc'))[_0x6919('0x10')];var db=require(_0x6919('0x11'))['db'];var socket=require(_0x6919('0x12'))(new Redis(config[_0x6919('0x13')]));require(_0x6919('0x14'))['register'](socket);config[_0x6919('0x13')]=_['defaults'](config[_0x6919('0x13')],{'host':_0x6919('0x15'),'port':0x18eb});var amiClient=jayson[_0x6919('0x16')][_0x6919('0x17')]({'port':0x232a});var values;function respondWithStatusCode(_0xb26435,_0x389b15){_0x389b15=_0x389b15||0xcc;return function(_0x5bc2d6){if(_0x5bc2d6){return _0xb26435['sendStatus'](_0x389b15);}return _0xb26435[_0x6919('0x18')](_0x389b15)[_0x6919('0x19')]();};}function respondWithResult(_0x4828df,_0x3b420a){_0x3b420a=_0x3b420a||0xc8;return function(_0x58c894){if(_0x58c894){return _0x4828df[_0x6919('0x18')](_0x3b420a)['json'](_0x58c894);}};}function respondWithFilteredResult(_0x250a68,_0xd062bd){return function(_0x50fba7){if(_0x50fba7){var _0x15de85=typeof _0xd062bd['offset']===_0x6919('0x1a')&&typeof _0xd062bd[_0x6919('0x1b')]===_0x6919('0x1a');var _0x4c5026=_0x50fba7[_0x6919('0x1c')];var _0x1b776b=_0x15de85?0x0:_0xd062bd[_0x6919('0x1d')];var _0x44ed5b=_0x15de85?_0x50fba7[_0x6919('0x1c')]:_0xd062bd[_0x6919('0x1d')]+_0xd062bd[_0x6919('0x1b')];var _0x5efe30;if(_0x44ed5b>=_0x4c5026){_0x44ed5b=_0x4c5026;_0x5efe30=0xc8;}else{_0x5efe30=0xce;}_0x250a68[_0x6919('0x18')](_0x5efe30);return _0x250a68[_0x6919('0x1e')](_0x6919('0x1f'),_0x1b776b+'-'+_0x44ed5b+'/'+_0x4c5026)[_0x6919('0x20')](_0x50fba7);}return null;};}function respondWithRpcPromise(_0x1f325d,_0x2d88be,_0x2dbb36,_0x3616c1){return new Promise(function(_0x3eadd5,_0x41b3c9){var _0x15c6e3=_0x3616c1||amiClient;return _0x15c6e3['request'](_0x1f325d,_0x2dbb36)['then'](function(_0x5a5476){logger[_0x6919('0x21')]('User,\x20%s,\x20%s',_0x2d88be,_0x6919('0x22'));logger[_0x6919('0x23')]('User,\x20%s,\x20%s,\x20%s',_0x2d88be,'request\x20sent',JSON[_0x6919('0x24')](_0x5a5476));if(_0x5a5476[_0x6919('0x25')]){if(_0x5a5476[_0x6919('0x25')][_0x6919('0x26')]===0x1f4){logger[_0x6919('0x25')](_0x6919('0x27'),_0x2d88be,_0x5a5476['error'][_0x6919('0x28')]);return _0x41b3c9(_0x5a5476['error'][_0x6919('0x28')]);}logger[_0x6919('0x25')]('User,\x20%s,\x20%s',_0x2d88be,_0x5a5476[_0x6919('0x25')]['message']);return _0x3eadd5(_0x5a5476[_0x6919('0x25')][_0x6919('0x28')]);}else{logger['info']('User,\x20%s,\x20%s',_0x2d88be,_0x6919('0x22'));_0x3eadd5(_0x5a5476[_0x6919('0x29')][_0x6919('0x28')]);}})[_0x6919('0x2a')](function(_0x5a0abe){logger[_0x6919('0x25')](_0x6919('0x27'),_0x2d88be,_0x5a0abe);_0x41b3c9(_0x5a0abe);});});}function saveUpdates(_0x781632){return function(_0x3d6332){if(_0x3d6332){return _0x3d6332[_0x6919('0x2b')](_0x781632)[_0x6919('0x2c')](function(_0x57dca0){if(_0x57dca0['role']==='agent'){socket[_0x6919('0x2d')]('userNotification:recalc:'+_0x57dca0['id'],_0x57dca0);}return _0x57dca0;});}return null;};}function removeEntity(_0xbb9979,_0x41c977){return function(_0x36c87b){if(_0x36c87b){return _0x36c87b[_0x6919('0x2e')]({'transaction':_0x41c977})[_0x6919('0x2c')](function(){var _0x421ac6=_0x36c87b[_0x6919('0x2f')]({'plain':!![]});if(_0x421ac6[_0x6919('0x30')]==='admin')return;var _0x233f61=[{'name':_0x6919('0x31'),'value':_0x6919('0x32'),'ignore':!![]},{'name':_0x6919('0x33'),'value':'agent','ignore':![]},{'name':_0x6919('0x34'),'value':_0x6919('0x35'),'ignore':![]}];var _0x146f63=_(_0x233f61)['filter'](_0x6919('0x36'))['map'](_0x6919('0x37'))[_0x6919('0x37')]();if(_[_0x6919('0x38')](_0x146f63,_0x421ac6[_0x6919('0x30')])){return;}var _0x415459=_[_0x6919('0x39')](_0x233f61,[_0x6919('0x37'),_0x421ac6[_0x6919('0x30')]])['name'];return db[_0x6919('0x3a')]['destroy']({'where':{'type':_0x415459,'resourceId':_0x421ac6['id']},'transaction':_0x41c977})['then'](function(){return _0x36c87b;});})[_0x6919('0x2c')](function(){_0xbb9979[_0x6919('0x18')](0xcc)[_0x6919('0x19')]();});}};}function handleEntityNotFound(_0x245bab){return function(_0x1d0209){if(!_0x1d0209){_0x245bab[_0x6919('0x3b')](0x194);}return _0x1d0209;};}function handleError(_0xd057d0,_0x5dd645){_0x5dd645=_0x5dd645||0x1f4;return function(_0x20c4dd){logger[_0x6919('0x25')](_0x20c4dd[_0x6919('0x3c')]);if(_0x20c4dd[_0x6919('0x3d')]){delete _0x20c4dd[_0x6919('0x3d')];}_0xd057d0[_0x6919('0x18')](_0x5dd645)[_0x6919('0x3e')](_0x20c4dd);};}function getUserAttributes(){return _(db[_0x6919('0x3f')]['rawAttributes'])[_0x6919('0x40')](function(_0x50252c){return{'name':_0x50252c['fieldName'],'type':_0x50252c[_0x6919('0x41')][_0x6919('0x42')]};})[_0x6919('0x43')](function(_0x57b1c9){return!['password','salt','previousPasswords','resetPasswordToken','resetPasswordExpires',_0x6919('0x44')][_0x6919('0x38')](_0x57b1c9[_0x6919('0x3d')]);})[_0x6919('0x37')]();}exports[_0x6919('0x45')]=function(_0x559cae,_0x4b5ee1){var _0x555cf9={},_0x48a4ad={'count':0x0,'rows':[]};var _0x2fc830=getUserAttributes();_0x555cf9=qs[_0x6919('0x46')](_0x2fc830,_0x559cae);var _0x58c4da={'where':_0x555cf9[_0x6919('0x47')]};return db[_0x6919('0x3f')][_0x6919('0x1c')](_0x58c4da)[_0x6919('0x2c')](function(_0x28b9ce){_0x48a4ad['count']=_0x28b9ce;if(_0x559cae['query'][_0x6919('0x48')]){_0x555cf9[_0x6919('0x49')]=[{'all':!![]}];}if(_0x559cae[_0x6919('0x4a')]['userSetting']==='true'){_0x555cf9[_0x6919('0x49')]=[{'model':db['UserSetting'],'as':_0x6919('0x4b')}];}if(!_['includes'](_0x555cf9['attributes'],'id')){_0x555cf9[_0x6919('0x4c')][_0x6919('0x4d')]('id');}return db[_0x6919('0x3f')][_0x6919('0x4e')](_0x555cf9);})['then'](function(_0x4b208e){_0x48a4ad['rows']=_0x4b208e;if(_0x559cae[_0x6919('0x4a')][_0x6919('0x4f')]===_0x6919('0x50')){var _0x2504b7=[];for(var _0x316b53=0x0;_0x316b53<_0x48a4ad[_0x6919('0x51')]['length'];_0x316b53++){_0x2504b7[_0x6919('0x4d')](get_open_tabs(_0x6919('0x52'),_0x48a4ad[_0x6919('0x51')][_0x316b53][_0x6919('0x53')]));_0x2504b7[_0x6919('0x4d')](get_open_tabs('sms',_0x48a4ad['rows'][_0x316b53]['dataValues']));_0x2504b7['push'](get_open_tabs('fax',_0x48a4ad[_0x6919('0x51')][_0x316b53][_0x6919('0x53')]));_0x2504b7['push'](get_open_tabs(_0x6919('0x54'),_0x48a4ad[_0x6919('0x51')][_0x316b53][_0x6919('0x53')]));_0x2504b7[_0x6919('0x4d')](get_open_tabs('openchannel',_0x48a4ad[_0x6919('0x51')][_0x316b53][_0x6919('0x53')]));_0x2504b7[_0x6919('0x4d')](get_open_tabs(_0x6919('0x55'),_0x48a4ad[_0x6919('0x51')][_0x316b53]['dataValues']));}return Promise[_0x6919('0x56')](_0x2504b7)[_0x6919('0x2c')](function(){return _0x48a4ad;});}else{return _0x48a4ad;}})[_0x6919('0x2c')](respondWithFilteredResult(_0x4b5ee1,_0x555cf9))[_0x6919('0x2a')](handleError(_0x4b5ee1,null));};exports[_0x6919('0x57')]=function(_0x55a0d8,_0x2ce1c7){var _0x136e32=getUserAttributes();_0x55a0d8[_0x6919('0x4a')]['id']=_0x55a0d8['params']['id'];var _0x1493d7=qs[_0x6919('0x46')](_0x136e32,_0x55a0d8);if(_0x55a0d8[_0x6919('0x4a')][_0x6919('0x48')]){_0x1493d7[_0x6919('0x49')]=[{'all':!![]}];}if(_0x55a0d8[_0x6919('0x4a')][_0x6919('0x4b')]===_0x6919('0x50')){_0x1493d7['include']=[{'model':db[_0x6919('0x58')],'as':_0x6919('0x4b')}];}_0x1493d7=_[_0x6919('0x59')]({},_0x1493d7,_0x55a0d8[_0x6919('0x5a')]);if(!_[_0x6919('0x38')](_0x1493d7[_0x6919('0x4c')],'id')){_0x1493d7[_0x6919('0x4c')][_0x6919('0x4d')]('id');}return db[_0x6919('0x3f')][_0x6919('0x39')](_0x1493d7)[_0x6919('0x2c')](handleEntityNotFound(_0x2ce1c7,null))[_0x6919('0x2c')](function(_0x8d01d8){var _0x47b876=[];values=_0x8d01d8;if(_0x55a0d8[_0x6919('0x4a')]['openTabs']===_0x6919('0x50')){_0x47b876[_0x6919('0x4d')](get_open_tabs('chat',_0x8d01d8[_0x6919('0x53')]));_0x47b876['push'](get_open_tabs(_0x6919('0x5b'),_0x8d01d8[_0x6919('0x53')]));_0x47b876['push'](get_open_tabs('openchannel',_0x8d01d8[_0x6919('0x53')]));_0x47b876['push'](get_open_tabs(_0x6919('0x55'),_0x8d01d8['dataValues']));_0x47b876[_0x6919('0x4d')](get_open_tabs(_0x6919('0x5c'),_0x8d01d8['dataValues']));_0x47b876[_0x6919('0x4d')](get_open_tabs(_0x6919('0x54'),_0x8d01d8[_0x6919('0x53')]));return Promise['all'](_0x47b876);}else{return values;}})['then'](function(){return values;})[_0x6919('0x2c')](respondWithResult(_0x2ce1c7,null))[_0x6919('0x2a')](handleError(_0x2ce1c7,null));};exports[_0x6919('0x2b')]=function(_0x147d2e,_0x18009c){if(_0x147d2e[_0x6919('0x5d')]['id']){delete _0x147d2e[_0x6919('0x5d')]['id'];}delete _0x147d2e[_0x6919('0x5d')][_0x6919('0x30')];return db[_0x6919('0x3f')]['find']({'where':{'id':_0x147d2e[_0x6919('0x5e')]['id']}})[_0x6919('0x2c')](handleEntityNotFound(_0x18009c,null))[_0x6919('0x2c')](saveUpdates(_0x147d2e[_0x6919('0x5d')],null))[_0x6919('0x2c')](respondWithResult(_0x18009c,null))[_0x6919('0x2a')](handleError(_0x18009c,null));};exports[_0x6919('0x5f')]=function(_0x3b7a20,_0x5ea31d){return db[_0x6919('0x3f')][_0x6919('0x5f')]()[_0x6919('0x2c')](respondWithResult(_0x5ea31d,null))['catch'](handleError(_0x5ea31d,null));};exports['addContacts']=function(_0x5656e0,_0x5a28f5){return db[_0x6919('0x3f')][_0x6919('0x39')]({'where':{'id':_0x5656e0[_0x6919('0x5e')]['id']}})[_0x6919('0x2c')](handleEntityNotFound(_0x5a28f5,null))['then'](function(_0x5b8126){if(_0x5b8126){return _0x5b8126[_0x6919('0x60')](_0x5656e0[_0x6919('0x5d')][_0x6919('0x61')],_[_0x6919('0x62')](_0x5656e0[_0x6919('0x5d')],[_0x6919('0x61'),'id'])||{});}})[_0x6919('0x2c')](respondWithResult(_0x5a28f5,null))[_0x6919('0x2a')](handleError(_0x5a28f5,null));};function validateUser(_0x2b3aec){return new Promise(function(_0x5ef5db,_0x5ce97a){if(_0x2b3aec['internal'])return _0x5ef5db(_0x2b3aec);return db[_0x6919('0x63')]['findById'](0x1)[_0x6919('0x2c')](function(_0x58a65d){if(_0x58a65d['securePassword'])authService['validatePasswordPattern'](_0x2b3aec['password']);db[_0x6919('0x3f')][_0x6919('0x64')](_0x6919('0x65'))[_0x6919('0x2c')](function(_0xfe3146){if(_[_0x6919('0x66')](_0xfe3146)){_0x2b3aec['internal']=_0x58a65d['min_internal']||0x1;return;}if(_[_0x6919('0x66')](_0x58a65d[_0x6919('0x67')])||_0x58a65d[_0x6919('0x67')]===_0xfe3146){_0x2b3aec[_0x6919('0x65')]=_0xfe3146+0x1;return;}if(_0x58a65d[_0x6919('0x67')]>_0xfe3146){_0x2b3aec[_0x6919('0x65')]=_0x58a65d[_0x6919('0x67')];return;}return db['sequelize'][_0x6919('0x4a')](_0x6919('0x68'),{'type':db['sequelize'][_0x6919('0x69')][_0x6919('0x6a')]})['then'](function(_0x4cf1d6){if(_0x4cf1d6&&_0x4cf1d6[_0x6919('0x6b')]){for(var _0xfe2766=0x0,_0x1a85d6=_0x4cf1d6[_0x6919('0x6b')];_0xfe2766<_0x1a85d6&&_[_0x6919('0x66')](_0x2b3aec[_0x6919('0x65')]);_0xfe2766++){if(_0x58a65d[_0x6919('0x67')]<=_0x4cf1d6[_0xfe2766][_0x6919('0x6c')]){_0x2b3aec['internal']=_0x4cf1d6[_0xfe2766][_0x6919('0x6c')];}else if(_0x58a65d[_0x6919('0x67')]>_0x4cf1d6[_0xfe2766][_0x6919('0x6c')]&&_0x58a65d[_0x6919('0x67')]<=_0x4cf1d6[_0xfe2766]['to']){_0x2b3aec[_0x6919('0x65')]=_0x58a65d['min_internal'];}}}if(_['isNil'](_0x2b3aec[_0x6919('0x65')])){_0x2b3aec[_0x6919('0x65')]=_0xfe3146+0x1;}return _0x5ef5db(_0x2b3aec);});});})['catch'](function(_0x5aa05f){_0x5ce97a(_0x5aa05f);});});}function updateUser(_0x4c0c12){return new Promise(function(_0x3174a5,_0xff1e6b){try{if(_0x4c0c12['voicemail']){_0x4c0c12[_0x6919('0x6d')]=_0x4c0c12[_0x6919('0x65')];_0x4c0c12[_0x6919('0x6e')]={'mailbox':_0x4c0c12[_0x6919('0x65')],'password':_0x4c0c12[_0x6919('0x6f')],'fullname':_0x4c0c12[_0x6919('0x70')],'email':_0x4c0c12['email']};}if(_0x4c0c12[_0x6919('0x30')]===_0x6919('0x71')){if(!_0x4c0c12['permissions'])_0x4c0c12[_0x6919('0x72')]=['101',_0x6919('0x73'),_0x6919('0x74'),'113','110','104','105','106',_0x6919('0x75'),_0x6919('0x76'),_0x6919('0x77'),'100',_0x6919('0x78'),'114',_0x6919('0x79')];}_0x3174a5(_0x4c0c12);}catch(_0x480036){_0xff1e6b(_0x480036);}});}exports[_0x6919('0x7a')]=function(_0x49bf22,_0x3774bc){if(_0x49bf22[_0x6919('0x32')]['role']===_0x6919('0x71'))throw new Error(_0x6919('0x7b'));if(_0x49bf22[_0x6919('0x5d')][_0x6919('0x30')]===_0x6919('0x32')&&_0x49bf22[_0x6919('0x32')][_0x6919('0x30')]!==_0x6919('0x7c')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x49bf22[_0x6919('0x5d')]['role']==='admin'&&_0x49bf22[_0x6919('0x32')][_0x6919('0x30')]!==_0x6919('0x7c')){throw new Error(_0x6919('0x7d'));}return licenseUtil[_0x6919('0x7e')]([_0x49bf22[_0x6919('0x5d')]])['then'](function(){return validateUser(_0x49bf22[_0x6919('0x5d')]);})[_0x6919('0x2c')](function(_0x2c7b71){return updateUser(_0x2c7b71)['then'](function(_0x40a4a6){if(_0x40a4a6[_0x6919('0x30')]===_0x6919('0x7c')){_0x40a4a6[_0x6919('0x7f')]=_0x49bf22['user'][_0x6919('0x7f')];delete _0x40a4a6[_0x6919('0x80')];}return _0x40a4a6;});})['then'](function(_0x4f679f){return db[_0x6919('0x3f')][_0x6919('0x7a')](_0x4f679f,{'include':[{'model':db[_0x6919('0x6e')],'as':_0x6919('0x6e')}]});})['then'](function(_0x4fff5c){if(_0x49bf22[_0x6919('0x5d')][_0x6919('0x30')]===_0x6919('0x32'))return _0x4fff5c;if(_0x49bf22[_0x6919('0x32')][_0x6919('0x30')]!==_0x6919('0x32'))return _0x4fff5c;return db[_0x6919('0x81')][_0x6919('0x39')]({'where':{'name':_0x4fff5c[_0x6919('0x30')]===_0x6919('0x71')?'Agents':_0x6919('0x34'),'userProfileId':_0x49bf22[_0x6919('0x32')][_0x6919('0x80')]},'raw':!![]})[_0x6919('0x2c')](function(_0x1761dc){if(!_0x1761dc||_0x1761dc['autoAssociation']!=0x0)return _0x4fff5c;return db[_0x6919('0x3a')][_0x6919('0x7a')]({'name':_0x4fff5c[_0x6919('0x3d')],'resourceId':_0x4fff5c['id'],'type':_0x1761dc[_0x6919('0x3d')],'sectionId':_0x1761dc['id']},{})[_0x6919('0x2c')](function(){return _0x4fff5c;});})[_0x6919('0x2a')](function(_0x468da6){logger[_0x6919('0x25')](_0x6919('0x82'),_0x468da6);throw _0x468da6;});})[_0x6919('0x2c')](respondWithResult(_0x3774bc,0xc9))[_0x6919('0x2a')](handleError(_0x3774bc,null));};exports[_0x6919('0x83')]=function(_0x2d0f93,_0x594a08){var _0x136cf6=_0x2d0f93[_0x6919('0x5d')];var _0x500987=[];if(_0x2d0f93[_0x6919('0x32')][_0x6919('0x30')]==='agent')throw new Error(_0x6919('0x7b'));if(_[_0x6919('0x84')](_0x136cf6,[_0x6919('0x30'),_0x6919('0x32')])&&_0x2d0f93['user']['role']!==_0x6919('0x7c')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x6919('0x84')](_0x136cf6,[_0x6919('0x30'),_0x6919('0x7c')])&&_0x2d0f93[_0x6919('0x32')][_0x6919('0x30')]!=='admin'){throw new Error(_0x6919('0x85'));}return licenseUtil[_0x6919('0x7e')](_0x136cf6)[_0x6919('0x2c')](function(){return validateUser(_0x136cf6[0x0]);})[_0x6919('0x2c')](function(){for(var _0x4076fb=0x1;_0x4076fb<_0x136cf6[_0x6919('0x6b')];_0x4076fb++){var _0x5b2770=_0x136cf6[_0x4076fb-0x1]['internal'];if(!_0x136cf6[_0x4076fb][_0x6919('0x65')])_0x136cf6[_0x4076fb][_0x6919('0x65')]=_0x5b2770+0x1;_0x500987[_0x6919('0x4d')](validateUser(_0x136cf6[_0x4076fb]));}return Promise[_0x6919('0x56')](_0x500987);})[_0x6919('0x2c')](function(){_0x500987=[];for(var _0x368280=0x0;_0x368280<_0x136cf6['length'];_0x368280++){_0x500987[_0x6919('0x4d')](updateUser(_0x136cf6[_0x368280]));}return Promise['all'](_0x500987);})[_0x6919('0x2c')](function(){_0x500987=_0x136cf6[_0x6919('0x40')](function(_0x4569dd){return db[_0x6919('0x3f')][_0x6919('0x7a')](_0x4569dd,{'include':[{'model':db[_0x6919('0x6e')],'as':_0x6919('0x6e')}]})[_0x6919('0x2c')](function(_0x26c7cd){_0x4569dd['id']=_0x26c7cd['id'];return _0x4569dd;});});return Promise[_0x6919('0x56')](_0x500987);})[_0x6919('0x2c')](function(_0x157783){if(_0x2d0f93['body'][_0x6919('0x30')]===_0x6919('0x32'))return _0x157783;if(_0x2d0f93[_0x6919('0x32')][_0x6919('0x30')]!==_0x6919('0x32'))return _0x157783;var _0x4a0a70=_[_0x6919('0x84')](_0x157783,function(_0x2883f5){return _0x2883f5[_0x6919('0x30')]===_0x6919('0x71')||_0x2883f5[_0x6919('0x30')]===_0x6919('0x35');});if(!_0x4a0a70)return _0x157783;return db['UserProfileSection'][_0x6919('0x4e')]({'where':{'name':{'$or':[_0x6919('0x33'),_0x6919('0x34')]},'userProfileId':_0x2d0f93[_0x6919('0x32')][_0x6919('0x80')]},'raw':!![]})[_0x6919('0x2c')](function(_0x34d287){if(_['isEmpty'](_0x34d287)||!_[_0x6919('0x84')](_0x34d287,[_0x6919('0x86'),0x0]))return _0x157783;_0x500987=[];var _0x44f13c=_(_0x34d287)[_0x6919('0x40')](function(_0x5ca76e){if(_0x5ca76e[_0x6919('0x86')]===0x1)return;return _0x5ca76e[_0x6919('0x3d')]==='Agents'?'agent':'telephone';})[_0x6919('0x87')]()[_0x6919('0x37')]();for(var _0x43e9c2=0x0;_0x43e9c2<_0x157783[_0x6919('0x6b')];_0x43e9c2++){if(!_['includes'](_0x44f13c,_0x157783[_0x43e9c2][_0x6919('0x30')]))return;var _0x2d253b=_0x157783[_0x43e9c2]['role']===_0x6919('0x71')?_0x6919('0x33'):'Telephones';_0x500987[_0x6919('0x4d')](db[_0x6919('0x3a')][_0x6919('0x7a')]({'name':_0x157783[_0x43e9c2]['name'],'resourceId':_0x157783[_0x43e9c2]['id'],'type':_0x2d253b,'sectionId':_[_0x6919('0x39')](_0x34d287,[_0x6919('0x3d'),_0x2d253b])['id']},{}));}return Promise[_0x6919('0x56')](_0x500987);});})[_0x6919('0x2c')](respondWithResult(_0x594a08,0xc9))['catch'](handleError(_0x594a08,null));};exports[_0x6919('0x88')]=function(_0x1a542c,_0x5c12a1){if(_0x1a542c[_0x6919('0x5d')]['id']){delete _0x1a542c[_0x6919('0x5d')]['id'];}return db['User'][_0x6919('0x39')]({'where':{'id':_0x1a542c[_0x6919('0x5e')]['id']}})[_0x6919('0x2c')](function(_0x545e0b){if(!_0x545e0b)return null;if(_0x545e0b['id']===_0x1a542c[_0x6919('0x32')]['id']){if(!_0x1a542c['body']['oldPassword']||!_0x1a542c[_0x6919('0x5d')][_0x6919('0x89')]){throw new db[(_0x6919('0x8a'))][(_0x6919('0x8b'))](_0x6919('0x8c'));}if(!_0x545e0b['authenticate'](_0x1a542c[_0x6919('0x5d')]['oldPassword'])){throw new db[(_0x6919('0x8a'))][(_0x6919('0x8b'))](_0x6919('0x8d'));}if(_0x1a542c[_0x6919('0x5d')][_0x6919('0x8e')]===_0x1a542c[_0x6919('0x5d')]['newPassword']){throw new db['Sequelize'][(_0x6919('0x8b'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x1a542c[_0x6919('0x32')]['role']===_0x6919('0x7c')){if(!_0x1a542c['body'][_0x6919('0x89')]){throw new db[(_0x6919('0x8a'))][(_0x6919('0x8b'))](_0x6919('0x8f'));}}else if(_0x1a542c[_0x6919('0x32')][_0x6919('0x30')]===_0x6919('0x32')){if(!_0x1a542c[_0x6919('0x5d')][_0x6919('0x89')]){throw new db[(_0x6919('0x8a'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x545e0b[_0x6919('0x30')]!==_0x6919('0x71')){throw new db[(_0x6919('0x8a'))][(_0x6919('0x8b'))](_0x6919('0x7b'));}}else{throw new db[(_0x6919('0x8a'))][(_0x6919('0x8b'))](_0x6919('0x7b'));}return _0x545e0b;})[_0x6919('0x2c')](handleEntityNotFound(_0x5c12a1,null))[_0x6919('0x2c')](function(_0x1c64aa){return db[_0x6919('0x63')][_0x6919('0x90')]({'attributes':['id','securePassword',_0x6919('0x91'),_0x6919('0x92')]})[_0x6919('0x2c')](function(_0xaebe12){if(_0xaebe12[_0x6919('0x93')])authService['validatePasswordPattern'](_0x1a542c[_0x6919('0x5d')][_0x6919('0x89')]);if(!_0xaebe12[_0x6919('0x91')]||!_0x1c64aa[_0x6919('0x94')])return _0x1c64aa;authService[_0x6919('0x95')](_0x1a542c['body'][_0x6919('0x89')],_0x1c64aa[_0x6919('0x94')],_0xaebe12[_0x6919('0x92')]);return _0x1c64aa;})['then'](saveUpdates({'password':_0x1a542c[_0x6919('0x5d')]['newPassword'],'passwordResetAt':_0x1a542c[_0x6919('0x32')]['id']==_0x1a542c[_0x6919('0x5e')]['id']?moment():null,'previousPasswords':authService[_0x6919('0x96')](_0x1a542c[_0x6919('0x5d')][_0x6919('0x89')],_0x1c64aa[_0x6919('0x94')])},null));})[_0x6919('0x2c')](respondWithResult(_0x5c12a1,null))[_0x6919('0x2a')](handleError(_0x5c12a1,null));};exports[_0x6919('0x97')]=function(_0xeb267d,_0x5db844){var _0x5df320=_0xeb267d[_0x6919('0x5d')]['channel'];return db['User']['find']({'where':{'id':_0xeb267d[_0x6919('0x5e')]['id']},'attributes':['id',_0x6919('0x3d'),'role',_0x6919('0x98'),_0x6919('0x99'),_0x6919('0x9a'),_0x6919('0x9b')]})[_0x6919('0x2c')](handleEntityNotFound(_0x5db844,null))['then'](function(_0x3bbcff){if(_0x3bbcff){if(!utils[_0x6919('0x9c')](_0x5df320)){throw new db[(_0x6919('0x8a'))]['ValidationError'](_0x6919('0x9d'));}return _0x3bbcff[_0x6919('0x9e')+_[_0x6919('0x9f')](_0x5df320[_0x6919('0xa0')]())+_0x6919('0xa1')](_0xeb267d[_0x6919('0x5d')][_0x6919('0x61')],{'penalty':_0xeb267d[_0x6919('0x5d')][_0x6919('0xa2')]||0x0})[_0x6919('0xa3')](function(_0x25217a){for(var _0x140b95=0x0;_0x140b95<_0xeb267d[_0x6919('0x5d')][_0x6919('0x61')][_0x6919('0x6b')];_0x140b95+=0x1){var _0x5a4758={'UserId':Number(_0xeb267d[_0x6919('0x5e')]['id'])};_0x5a4758[_[_0x6919('0x9f')](_0x5df320[_0x6919('0xa0')]())+_0x6919('0xa4')]=Number(_0xeb267d['body']['ids'][_0x140b95]);socket['emit'](_0x6919('0x32')+_[_0x6919('0x9f')](_0x5df320['toLowerCase']())+_0x6919('0xa5'),_0x5a4758);}return _0x25217a;})['then'](function(){if(_0x5df320===_0x6919('0xa6')){return db[_0x6919('0xa7')]['findAll']({'where':{'id':_0xeb267d[_0x6919('0x5d')][_0x6919('0x61')]||[]},'raw':!![],'attributes':['id',_0x6919('0x3d')]});}})[_0x6919('0x2c')](function(_0x5ce849){var _0x9300c7=_0x3bbcff[_0x6919('0x2f')]({'plain':!![]});var _0x2c8aed=[];if(_0x5df320===_0x6919('0xa6')&&_0x9300c7[_0x6919('0x30')]===_0x6919('0x71')&&_0x9300c7[_0x6919('0x98')]){for(let _0x2c813f=0x0;_0x2c813f<_0x5ce849[_0x6919('0x6b')];_0x2c813f+=0x1){_0x2c8aed['push']({'membername':_0x9300c7[_0x6919('0x3d')],'UserId':_0x9300c7['id'],'queue_name':_0x5ce849[_0x2c813f]['name'],'VoiceQueueId':_0x5ce849[_0x2c813f]['id'],'interface':_[_0x6919('0x66')](_0x9300c7[_0x6919('0x9b')])?util[_0x6919('0xa8')](_0x6919('0xa9'),_0x9300c7['name']):_0x9300c7[_0x6919('0x9b')],'paused':_0x9300c7['voicePause']||![],'penalty':_0xeb267d[_0x6919('0x5d')][_0x6919('0xa2')]||0x0});}return Promise[_0x6919('0x56')](_0x2c8aed[_0x6919('0x40')](function(_0x1d3225){return db[_0x6919('0xaa')][_0x6919('0xab')](_0x1d3225);}));}return _0x3bbcff;});}})[_0x6919('0x2c')](respondWithStatusCode(_0x5db844,null))[_0x6919('0x2a')](handleError(_0x5db844,null));};exports['removeQueues']=function(_0x4be445,_0x15ef20){var _0xb55f9b,_0x3603a3;return db[_0x6919('0x3f')][_0x6919('0x39')]({'where':{'id':_0x4be445['params']['id']},'attributes':['id',_0x6919('0x3d'),_0x6919('0x30')]})[_0x6919('0x2c')](handleEntityNotFound(_0x15ef20,null))[_0x6919('0x2c')](function(_0x2b61eb){if(_0x2b61eb){_0xb55f9b=_0x2b61eb;if(!_0x4be445[_0x6919('0x4a')]['channel']||!utils[_0x6919('0x9c')](_0x4be445['query']['channel'])){throw new db[(_0x6919('0x8a'))][(_0x6919('0x8b'))](_0x6919('0x9d'));}return _0x2b61eb[_0x6919('0xac')+_[_0x6919('0x9f')](_0x4be445[_0x6919('0x4a')][_0x6919('0xad')][_0x6919('0xa0')]())+_0x6919('0xa1')](_0x4be445['query'][_0x6919('0x61')]);}})[_0x6919('0x2c')](function(_0x1f9a67){if(_[_0x6919('0xae')](_0x4be445[_0x6919('0x4a')]['ids'])){for(var _0x2aa4e3=0x0;_0x2aa4e3<_0x4be445['query'][_0x6919('0x61')][_0x6919('0x6b')];_0x2aa4e3+=0x1){_0x3603a3={'UserId':Number(_0x4be445[_0x6919('0x5e')]['id'])};_0x3603a3[_['capitalize'](_0x4be445[_0x6919('0x4a')]['channel']['toLowerCase']())+_0x6919('0xa4')]=Number(_0x4be445[_0x6919('0x4a')][_0x6919('0x61')][_0x2aa4e3]);socket[_0x6919('0x2d')]('user'+_['capitalize'](_0x4be445[_0x6919('0x4a')]['channel'][_0x6919('0xa0')]())+_0x6919('0xaf'),_0x3603a3);}}else{_0x3603a3={'UserId':Number(_0x4be445[_0x6919('0x5e')]['id'])};_0x3603a3[_['capitalize'](_0x4be445[_0x6919('0x4a')][_0x6919('0xad')][_0x6919('0xa0')]())+_0x6919('0xa4')]=Number(_0x4be445[_0x6919('0x4a')][_0x6919('0x61')]);socket['emit'](_0x6919('0x32')+_[_0x6919('0x9f')](_0x4be445[_0x6919('0x4a')][_0x6919('0xad')][_0x6919('0xa0')]())+_0x6919('0xaf'),_0x3603a3);}return _0x1f9a67;})[_0x6919('0x2c')](function(){if(_0x4be445[_0x6919('0x4a')][_0x6919('0xad')]===_0x6919('0xa6')){return db[_0x6919('0xaa')][_0x6919('0x2e')]({'where':{'UserId':_0x4be445['params']['id'],'VoiceQueueId':_0x4be445['query']['ids']},'individualHooks':!![]})['then'](function(){return _0xb55f9b;});}return _0xb55f9b;})[_0x6919('0x2c')](respondWithStatusCode(_0x15ef20,null))[_0x6919('0x2a')](handleError(_0x15ef20,null));};exports['addAvatar']=function(_0xf31e2a,_0x289faf){_0xf31e2a[_0x6919('0x5d')][_0x6919('0xb0')]=_0xf31e2a[_0x6919('0xb1')][_0x6919('0xb2')];return db[_0x6919('0x3f')][_0x6919('0x39')]({'where':{'id':_0xf31e2a['params']['id']}})[_0x6919('0x2c')](handleEntityNotFound(_0x289faf,null))[_0x6919('0x2c')](saveUpdates(_0xf31e2a['body'],null))['then'](respondWithResult(_0x289faf,null))['catch'](handleError(_0x289faf,null));};exports[_0x6919('0xb3')]=function(_0x594158,_0x157bf1){var _0x5e6ae0=path[_0x6919('0xb4')](config[_0x6919('0xb5')],_0x6919('0xb6'));return db[_0x6919('0x3f')]['find']({'where':{'id':_0x594158[_0x6919('0x5e')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x157bf1,null))['then'](function(_0xf2d6c4){if(_0xf2d6c4){if(_[_0x6919('0x66')](_0xf2d6c4[_0x6919('0xb0')])){return _0x157bf1[_0x6919('0xb7')](_0x5e6ae0);}else{if(!fs['existsSync'](path['join'](config['root'],_0x6919('0xb8'),_0xf2d6c4[_0x6919('0xb0')]))){return _0x157bf1['download'](_0x5e6ae0);}return _0x157bf1[_0x6919('0xb7')](path[_0x6919('0xb4')](config['root'],_0x6919('0xb8'),_0xf2d6c4['userpic']));}}})[_0x6919('0x2a')](handleError(_0x157bf1,null));};exports[_0x6919('0xb9')]=function(_0x5818aa,_0xc8397a){return db[_0x6919('0x3f')]['find']({'where':{'id':_0x5818aa[_0x6919('0x5e')]['id']},'attributes':['id']})[_0x6919('0x2c')](handleEntityNotFound(_0xc8397a,null))[_0x6919('0x2c')](function(_0x58980d){var _0x5b10af=[];values=_0x58980d[_0x6919('0x53')];_0x5b10af[_0x6919('0x4d')](get_open_tabs(_0x6919('0x52'),_0x58980d[_0x6919('0x53')]));_0x5b10af[_0x6919('0x4d')](get_open_tabs(_0x6919('0x5b'),_0x58980d['dataValues']));_0x5b10af[_0x6919('0x4d')](get_open_tabs('openchannel',_0x58980d['dataValues']));_0x5b10af['push'](get_open_tabs('whatsapp',_0x58980d['dataValues']));_0x5b10af[_0x6919('0x4d')](get_open_tabs(_0x6919('0x5c'),_0x58980d[_0x6919('0x53')]));_0x5b10af['push'](get_open_tabs(_0x6919('0x54'),_0x58980d[_0x6919('0x53')]));return Promise['all'](_0x5b10af);})[_0x6919('0x2c')](function(_0x2f1841){if(_0x2f1841){var _0x117fdb=_[_0x6919('0x40')](values[_0x6919('0xba')],function(_0x51b677){return{'channel':_0x6919('0xbb'),'id':_0x51b677['id'],'createdAt':_0x51b677['createdAt']};});var _0x1f8f40=_[_0x6919('0x40')](values[_0x6919('0xbc')],function(_0x11a0fd){return{'channel':_0x6919('0xbd'),'id':_0x11a0fd['id'],'createdAt':_0x11a0fd['createdAt']};});var _0x153957=_[_0x6919('0x40')](values[_0x6919('0xbe')],function(_0x117529){return{'channel':'OPENCHANNEL','id':_0x117529['id'],'createdAt':_0x117529[_0x6919('0xbf')]};});var _0xf03385=_[_0x6919('0x40')](values[_0x6919('0xc0')],function(_0x2fffe6){return{'channel':_0x6919('0xc1'),'id':_0x2fffe6['id'],'createdAt':_0x2fffe6[_0x6919('0xbf')]};});var _0x567cae=_[_0x6919('0x40')](values['SmsOpenTabs'],function(_0x16d120){return{'channel':_0x6919('0xc2'),'id':_0x16d120['id'],'createdAt':_0x16d120[_0x6919('0xbf')]};});var _0x3f5d7f=_['map'](values[_0x6919('0xc3')],function(_0x337298){return{'channel':_0x6919('0xc4'),'id':_0x337298['id'],'createdAt':_0x337298[_0x6919('0xbf')]};});var _0x76c85f=_['concat'](_0x117fdb,_0x1f8f40,_0x153957,_0xf03385,_0x567cae,_0x3f5d7f);var _0x31dea8={'count':_0x76c85f[_0x6919('0x6b')],'rows':_0x76c85f};return _0x31dea8;}else return null;})[_0x6919('0x2c')](respondWithResult(_0xc8397a,null))['catch'](handleError(_0xc8397a,null));};exports[_0x6919('0xc5')]=function(_0x2e4487,_0x147b34){var _0x419a49={};return db[_0x6919('0x3f')][_0x6919('0x90')]({'where':{'id':_0x2e4487[_0x6919('0x5e')]['id']}})['then'](function(_0x971174){if(!_0x971174){throw new APINotFoundError(util[_0x6919('0xa8')](_0x6919('0xc6'),_0x2e4487[_0x6919('0x5e')]['id']));}return contacts['describe']();})[_0x6919('0x2c')](function(_0x8c8d7a){_0x2e4487['query'][_0x6919('0x3f')]=_0x2e4487[_0x6919('0x5e')]['id'];_0x419a49=qs[_0x6919('0x46')](_0x8c8d7a,_0x2e4487);if(_0x2e4487[_0x6919('0x4a')]['hasOwnProperty'](_0x6919('0x48'))){_0x419a49[_0x6919('0x49')]=[{'model':db[_0x6919('0xc7')],'as':_0x6919('0xc8'),'required':![]},{'model':db[_0x6919('0xc9')],'as':_0x6919('0xca'),'attributes':['id','name',_0x6919('0xcb')],'where':_0x2e4487['query'][_0x6919('0xcc')]?{'id':_0x2e4487[_0x6919('0x4a')][_0x6919('0xcc')]}:undefined,'required':_0x2e4487[_0x6919('0x4a')][_0x6919('0xcc')]?!![]:![]}];}return contacts[_0x6919('0x4e')](_0x2e4487[_0x6919('0x4a')],_0x2e4487[_0x6919('0x32')],_0x419a49,_0x8c8d7a);})['then'](respondWithFilteredResult(_0x147b34,_0x419a49))[_0x6919('0x2a')](APIHandleError(_0x147b34));};exports[_0x6919('0xcd')]=function(_0x1eefc0,_0x1f6d91){var _0x5f1440;var _0x532e8a={};var _0x538f65;return db[_0x6919('0x3f')][_0x6919('0x90')]({'where':{'id':_0x1eefc0[_0x6919('0x5e')]['id']},'attributes':['id',_0x6919('0x3d'),_0x6919('0x30')]})[_0x6919('0x2c')](handleEntityNotFound(_0x1f6d91,null))[_0x6919('0x2c')](function(_0x3b9ee5){if(!utils[_0x6919('0x9c')](_0x1eefc0[_0x6919('0x4a')]['channel'])){throw new db['Sequelize'][(_0x6919('0x8b'))]('Unknown\x20channel');}_0x5f1440=_0x3b9ee5;var _0x5bf706={};_0x5bf706[_0x6919('0xce')]=_[_0x6919('0xcf')](db[_[_0x6919('0x9f')](_0x1eefc0['query'][_0x6919('0xad')])+_0x6919('0xd0')][_0x6919('0xd1')]);_0x5bf706[_0x6919('0x4a')]=_['keys'](_0x1eefc0[_0x6919('0x4a')]);_0x5bf706[_0x6919('0xd2')]=_[_0x6919('0xd3')](_0x5bf706[_0x6919('0xce')],_0x5bf706[_0x6919('0x4a')]);_0x532e8a[_0x6919('0x4c')]=_['intersection'](_0x5bf706[_0x6919('0xce')],qs['fields'](_0x1eefc0[_0x6919('0x4a')][_0x6919('0xd4')]));_0x532e8a[_0x6919('0x4c')]=_0x532e8a[_0x6919('0x4c')][_0x6919('0x6b')]?_0x532e8a[_0x6919('0x4c')]:_0x5bf706[_0x6919('0xce')];_0x532e8a['order']=qs[_0x6919('0xd5')](_0x1eefc0[_0x6919('0x4a')]['sort']);_0x532e8a['where']=qs['filters'](_[_0x6919('0xd6')](_0x1eefc0[_0x6919('0x4a')],_0x5bf706[_0x6919('0xd2')]));if(_0x1eefc0['query'][_0x6919('0x43')]){_0x532e8a[_0x6919('0x47')]=_[_0x6919('0x59')](_0x532e8a['where'],{'$or':_[_0x6919('0x40')](_0x532e8a['attributes'],function(_0x649908){var _0x435579={};_0x435579[_0x649908]={'$like':'%'+_0x1eefc0[_0x6919('0x4a')]['filter']+'%'};return _0x435579;})});}_0x532e8a=_[_0x6919('0x59')]({},_0x532e8a,_0x1eefc0['options']);switch(_0x5f1440['role']){case _0x6919('0x7c'):return db[_[_0x6919('0x9f')](_0x1eefc0['query'][_0x6919('0xad')])+'Queue'][_0x6919('0x4e')](_0x532e8a);case _0x6919('0x32'):case _0x6919('0x71'):return _0x5f1440[_0x6919('0x2f')+_[_0x6919('0x9f')](_0x1eefc0[_0x6919('0x4a')][_0x6919('0xad')])+_0x6919('0xa1')](_0x532e8a);default:throw new db['Sequelize']['ValidationError'](_0x6919('0xd7'));}})[_0x6919('0x2c')](function(_0x394306){_0x538f65=_0x394306[_0x6919('0x6b')];if(!_0x1eefc0[_0x6919('0x4a')][_0x6919('0xd8')](_0x6919('0xd9'))){_0x532e8a['limit']=qs[_0x6919('0x1b')](_0x1eefc0[_0x6919('0x4a')][_0x6919('0x1b')]);_0x532e8a[_0x6919('0x1d')]=qs['offset'](_0x1eefc0['query']['offset']);}switch(_0x5f1440[_0x6919('0x30')]){case _0x6919('0x7c'):return db[_[_0x6919('0x9f')](_0x1eefc0[_0x6919('0x4a')][_0x6919('0xad')])+_0x6919('0xd0')][_0x6919('0x4e')](_0x532e8a);case'user':case _0x6919('0x71'):return _0x5f1440[_0x6919('0x2f')+_[_0x6919('0x9f')](_0x1eefc0[_0x6919('0x4a')][_0x6919('0xad')])+_0x6919('0xa1')](_0x532e8a);}})[_0x6919('0x2c')](function(_0x3e0b80){return{'count':_0x538f65,'rows':_0x3e0b80};})[_0x6919('0x2c')](respondWithResult(_0x1f6d91,null))[_0x6919('0x2a')](handleError(_0x1f6d91,null));};exports[_0x6919('0xda')]=function(_0xdb5789,_0x15b0d1){var _0x1fc4cb={};var _0x23982d={};var _0x4d2e35;var _0x244088;return db['User'][_0x6919('0x90')]({'where':{'id':_0xdb5789[_0x6919('0x5e')]['id']}})[_0x6919('0x2c')](handleEntityNotFound(_0x15b0d1,null))[_0x6919('0x2c')](function(_0x305bb8){if(_0x305bb8){_0x4d2e35=_0x305bb8;_0x23982d[_0x6919('0xce')]=_['keys'](db[_0x6919('0xaa')]['rawAttributes']);_0x23982d[_0x6919('0x4a')]=_[_0x6919('0xcf')](_0xdb5789[_0x6919('0x4a')]);_0x23982d[_0x6919('0xd2')]=_[_0x6919('0xd3')](_0x23982d['model'],_0x23982d[_0x6919('0x4a')]);_0x1fc4cb['attributes']=_[_0x6919('0xd3')](_0x23982d[_0x6919('0xce')],qs['fields'](_0xdb5789[_0x6919('0x4a')][_0x6919('0xd4')]));_0x1fc4cb[_0x6919('0x4c')]=_0x1fc4cb['attributes'][_0x6919('0x6b')]?_0x1fc4cb[_0x6919('0x4c')]:_0x23982d[_0x6919('0xce')];_0x1fc4cb[_0x6919('0xdb')]=qs[_0x6919('0xd5')](_0xdb5789['query'][_0x6919('0xd5')]);_0x1fc4cb[_0x6919('0x47')]=qs['filters'](_['pick'](_0xdb5789[_0x6919('0x4a')],_0x23982d[_0x6919('0xd2')]));if(_0xdb5789[_0x6919('0x4a')][_0x6919('0x43')]){_0x1fc4cb[_0x6919('0x47')]=_['merge'](_0x1fc4cb['where'],{'$or':_[_0x6919('0x40')](_0x1fc4cb['attributes'],function(_0x42c1cc){var _0x545cf8={};_0x545cf8[_0x42c1cc]={'$like':'%'+_0xdb5789[_0x6919('0x4a')][_0x6919('0x43')]+'%'};return _0x545cf8;})});}_0x1fc4cb=_[_0x6919('0x59')]({},_0x1fc4cb,_0xdb5789[_0x6919('0x5a')]);return _0x4d2e35[_0x6919('0xda')](_0x1fc4cb);}})[_0x6919('0x2c')](function(_0x3de702){if(_0x3de702){_0x244088=_0x3de702['length'];if(!_0xdb5789['query'][_0x6919('0xd8')](_0x6919('0xd9'))){_0x1fc4cb[_0x6919('0x1b')]=qs[_0x6919('0x1b')](_0xdb5789['query'][_0x6919('0x1b')]);_0x1fc4cb[_0x6919('0x1d')]=qs['offset'](_0xdb5789[_0x6919('0x4a')][_0x6919('0x1d')]);}return _0x4d2e35[_0x6919('0xda')](_0x1fc4cb);}})[_0x6919('0x2c')](function(_0x28a4ff){if(_0x28a4ff){return _0x28a4ff?{'count':_0x244088,'rows':_0x28a4ff}:null;}})[_0x6919('0x2c')](respondWithResult(_0x15b0d1,null))[_0x6919('0x2a')](handleError(_0x15b0d1,null));};exports[_0x6919('0xdc')]=function(_0x398536,_0x85c430){var _0x139f10={};var _0x5c3909={};var _0x3de2a7;var _0x3434f0;return db[_0x6919('0x3f')][_0x6919('0x90')]({'where':{'id':_0x398536['params']['id']}})[_0x6919('0x2c')](handleEntityNotFound(_0x85c430,null))[_0x6919('0x2c')](function(_0x216c7c){if(_0x216c7c){_0x3de2a7=_0x216c7c;_0x5c3909['model']=_['keys'](db[_0x6919('0xdd')][_0x6919('0xd1')]);_0x5c3909[_0x6919('0x4a')]=_[_0x6919('0xcf')](_0x398536[_0x6919('0x4a')]);_0x5c3909[_0x6919('0xd2')]=_['intersection'](_0x5c3909[_0x6919('0xce')],_0x5c3909['query']);_0x139f10[_0x6919('0x4c')]=_['intersection'](_0x5c3909[_0x6919('0xce')],qs[_0x6919('0xd4')](_0x398536['query'][_0x6919('0xd4')]));_0x139f10[_0x6919('0x4c')]=_0x139f10['attributes'][_0x6919('0x6b')]?_0x139f10[_0x6919('0x4c')]:_0x5c3909[_0x6919('0xce')];_0x139f10[_0x6919('0xdb')]=qs[_0x6919('0xd5')](_0x398536[_0x6919('0x4a')][_0x6919('0xd5')]);_0x139f10[_0x6919('0x47')]=qs[_0x6919('0xd2')](_[_0x6919('0xd6')](_0x398536[_0x6919('0x4a')],_0x5c3909[_0x6919('0xd2')]));if(_0x398536[_0x6919('0x4a')]['filter']){_0x139f10[_0x6919('0x47')]=_[_0x6919('0x59')](_0x139f10[_0x6919('0x47')],{'$or':_[_0x6919('0x40')](_0x139f10['attributes'],function(_0x12825a){var _0x40c602={};_0x40c602[_0x12825a]={'$like':'%'+_0x398536[_0x6919('0x4a')][_0x6919('0x43')]+'%'};return _0x40c602;})});}_0x139f10=_['merge']({},_0x139f10,_0x398536[_0x6919('0x5a')]);return _0x3de2a7[_0x6919('0xdc')](_0x139f10);}})[_0x6919('0x2c')](function(_0x276b4f){if(_0x276b4f){_0x3434f0=_0x276b4f[_0x6919('0x6b')];if(!_0x398536['query'][_0x6919('0xd8')](_0x6919('0xd9'))){_0x139f10[_0x6919('0x1b')]=qs['limit'](_0x398536['query'][_0x6919('0x1b')]);_0x139f10[_0x6919('0x1d')]=qs[_0x6919('0x1d')](_0x398536[_0x6919('0x4a')][_0x6919('0x1d')]);}return _0x3de2a7[_0x6919('0xdc')](_0x139f10);}})[_0x6919('0x2c')](function(_0x10f580){if(_0x10f580){return _0x10f580?{'count':_0x3434f0,'rows':_0x10f580}:null;}})['then'](respondWithResult(_0x85c430,null))[_0x6919('0x2a')](handleError(_0x85c430,null));};exports['getRecordings']=function(_0x20b2a4,_0x2e41ce){var _0x339b67={'raw':!![],'where':{}};var _0x415431={};var _0x2b8475={'count':0x0,'rows':[]};return db[_0x6919('0x3f')][_0x6919('0x90')]({'where':{'id':_0x20b2a4[_0x6919('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2e41ce,null))[_0x6919('0x2c')](function(_0x232c6c){if(_0x232c6c){_0x415431[_0x6919('0xce')]=_[_0x6919('0xcf')](db[_0x6919('0xde')][_0x6919('0xd1')]);_0x415431[_0x6919('0x4a')]=_['keys'](_0x20b2a4[_0x6919('0x4a')]);_0x415431['filters']=_[_0x6919('0xd3')](_0x415431[_0x6919('0xce')],_0x415431[_0x6919('0x4a')]);_0x339b67['attributes']=_['intersection'](_0x415431[_0x6919('0xce')],qs[_0x6919('0xd4')](_0x20b2a4[_0x6919('0x4a')]['fields']));_0x339b67[_0x6919('0x4c')]=_0x339b67[_0x6919('0x4c')][_0x6919('0x6b')]?_0x339b67['attributes']:_0x415431[_0x6919('0xce')];if(!_0x20b2a4[_0x6919('0x4a')]['hasOwnProperty']('nolimit')){_0x339b67['limit']=qs['limit'](_0x20b2a4[_0x6919('0x4a')][_0x6919('0x1b')]);_0x339b67[_0x6919('0x1d')]=qs[_0x6919('0x1d')](_0x20b2a4[_0x6919('0x4a')][_0x6919('0x1d')]);}_0x339b67['order']=qs['sort'](_0x20b2a4[_0x6919('0x4a')]['sort']);_0x339b67[_0x6919('0x47')]=qs['filters'](_[_0x6919('0xd6')](_0x20b2a4[_0x6919('0x4a')],_0x415431[_0x6919('0xd2')]));_0x339b67[_0x6919('0x47')][_0x6919('0xdf')]=_0x232c6c['id'];if(_0x20b2a4[_0x6919('0x4a')]['filter']){_0x339b67['where']=_[_0x6919('0x59')](_0x339b67['where'],{'$or':_[_0x6919('0x40')](_0x339b67['attributes'],function(_0x2214cc){var _0x50837e={};_0x50837e[_0x2214cc]={'$like':'%'+_0x20b2a4[_0x6919('0x4a')][_0x6919('0x43')]+'%'};return _0x50837e;})});}_0x339b67=_[_0x6919('0x59')]({},_0x339b67,_0x20b2a4[_0x6919('0x5a')]);return db[_0x6919('0xde')][_0x6919('0x1c')]({'where':_0x339b67[_0x6919('0x47')]})[_0x6919('0x2c')](function(_0x1598d7){_0x2b8475[_0x6919('0x1c')]=_0x1598d7;if(_0x20b2a4[_0x6919('0x4a')][_0x6919('0x48')]){_0x339b67[_0x6919('0x49')]=[{'all':!![]}];}return db[_0x6919('0xde')][_0x6919('0x4e')](_0x339b67);})[_0x6919('0x2c')](function(_0x19f114){_0x2b8475['rows']=_0x19f114;return _0x2b8475;});}})[_0x6919('0x2c')](respondWithFilteredResult(_0x2e41ce,_0x339b67))[_0x6919('0x2a')](handleError(_0x2e41ce,null));};exports[_0x6919('0xe0')]=function(_0x79f880,_0x4872c0){var _0x1d2f97={'raw':!![],'where':{}};var _0x4835d2={};var _0x4e1a5d={'count':0x0,'rows':[]};return db['User'][_0x6919('0x90')]({'where':{'id':_0x79f880[_0x6919('0x5e')]['id']}})[_0x6919('0x2c')](handleEntityNotFound(_0x4872c0,null))['then'](function(_0x425d3d){if(_0x425d3d){_0x4835d2[_0x6919('0xce')]=_[_0x6919('0xcf')](db[_0x6919('0xe1')]['rawAttributes']);_0x4835d2['query']=_['keys'](_0x79f880[_0x6919('0x4a')]);_0x4835d2[_0x6919('0xd2')]=_[_0x6919('0xd3')](_0x4835d2[_0x6919('0xce')],_0x4835d2['query']);_0x1d2f97[_0x6919('0x4c')]=_[_0x6919('0xd3')](_0x4835d2['model'],qs['fields'](_0x79f880[_0x6919('0x4a')][_0x6919('0xd4')]));_0x1d2f97[_0x6919('0x4c')]=_0x1d2f97[_0x6919('0x4c')][_0x6919('0x6b')]?_0x1d2f97[_0x6919('0x4c')]:_0x4835d2['model'];if(!_0x79f880[_0x6919('0x4a')][_0x6919('0xd8')]('nolimit')){_0x1d2f97[_0x6919('0x1b')]=qs['limit'](_0x79f880[_0x6919('0x4a')][_0x6919('0x1b')]);_0x1d2f97[_0x6919('0x1d')]=qs[_0x6919('0x1d')](_0x79f880[_0x6919('0x4a')][_0x6919('0x1d')]);}_0x1d2f97['order']=qs[_0x6919('0xd5')](_0x79f880[_0x6919('0x4a')]['sort']);_0x1d2f97[_0x6919('0x47')]=qs[_0x6919('0xd2')](_['pick'](_0x79f880[_0x6919('0x4a')],_0x4835d2[_0x6919('0xd2')]));_0x1d2f97[_0x6919('0x47')][_0x6919('0xdf')]=_0x425d3d['id'];if(_0x79f880['query'][_0x6919('0x43')]){_0x1d2f97['where']=_[_0x6919('0x59')](_0x1d2f97[_0x6919('0x47')],{'$or':_[_0x6919('0x40')](_0x1d2f97['attributes'],function(_0x453989){var _0x8b3b63={};_0x8b3b63[_0x453989]={'$like':'%'+_0x79f880[_0x6919('0x4a')][_0x6919('0x43')]+'%'};return _0x8b3b63;})});}_0x1d2f97=_[_0x6919('0x59')]({},_0x1d2f97,_0x79f880[_0x6919('0x5a')]);return db['ScreenRecording']['count']({'where':_0x1d2f97[_0x6919('0x47')]})['then'](function(_0x89fac0){_0x4e1a5d[_0x6919('0x1c')]=_0x89fac0;if(_0x79f880['query']['includeAll']){_0x1d2f97[_0x6919('0x49')]=[{'all':!![]}];}return db[_0x6919('0xe1')][_0x6919('0x4e')](_0x1d2f97);})[_0x6919('0x2c')](function(_0x4f3a7f){_0x4e1a5d[_0x6919('0x51')]=_0x4f3a7f;return _0x4e1a5d;});}})['then'](respondWithFilteredResult(_0x4872c0,_0x1d2f97))[_0x6919('0x2a')](handleError(_0x4872c0,null));};exports['getChatInteractions']=function(_0x6a756f,_0x1907b3){var _0x6e2e69={};var _0x36ddff={};var _0x253f87;var _0x1c5a70;return db['User']['findOne']({'where':{'id':_0x6a756f[_0x6919('0x5e')]['id']}})[_0x6919('0x2c')](handleEntityNotFound(_0x1907b3,null))[_0x6919('0x2c')](function(_0x21e5e7){if(_0x21e5e7){_0x253f87=_0x21e5e7;_0x36ddff[_0x6919('0xce')]=_[_0x6919('0xcf')](db[_0x6919('0xe2')][_0x6919('0xd1')]);_0x36ddff[_0x6919('0x4a')]=_['keys'](_0x6a756f[_0x6919('0x4a')]);_0x36ddff[_0x6919('0xd2')]=_['intersection'](_0x36ddff[_0x6919('0xce')],_0x36ddff[_0x6919('0x4a')]);_0x6e2e69[_0x6919('0x4c')]=_[_0x6919('0xd3')](_0x36ddff[_0x6919('0xce')],qs[_0x6919('0xd4')](_0x6a756f[_0x6919('0x4a')][_0x6919('0xd4')]));_0x6e2e69[_0x6919('0x4c')]=_0x6e2e69[_0x6919('0x4c')][_0x6919('0x6b')]?_0x6e2e69[_0x6919('0x4c')]:_0x36ddff[_0x6919('0xce')];_0x6e2e69[_0x6919('0xdb')]=qs[_0x6919('0xd5')](_0x6a756f['query'][_0x6919('0xd5')]);_0x6e2e69[_0x6919('0x47')]=qs[_0x6919('0xd2')](_[_0x6919('0xd6')](_0x6a756f[_0x6919('0x4a')],_0x36ddff[_0x6919('0xd2')]));if(_0x6a756f['query'][_0x6919('0x43')]){_0x6e2e69[_0x6919('0x47')]=_[_0x6919('0x59')](_0x6e2e69[_0x6919('0x47')],{'$or':_[_0x6919('0x40')](_0x6e2e69['attributes'],function(_0x502a6d){var _0x291608={};_0x291608[_0x502a6d]={'$like':'%'+_0x6a756f['query'][_0x6919('0x43')]+'%'};return _0x291608;})});}_0x6e2e69=_['merge']({},_0x6e2e69,_0x6a756f[_0x6919('0x5a')]);return _0x253f87[_0x6919('0xe3')](_0x6e2e69);}})[_0x6919('0x2c')](function(_0x5b2462){if(_0x5b2462){_0x1c5a70=_0x5b2462[_0x6919('0x6b')];if(!_0x6a756f[_0x6919('0x4a')][_0x6919('0xd8')](_0x6919('0xd9'))){_0x6e2e69[_0x6919('0x1b')]=qs[_0x6919('0x1b')](_0x6a756f['query'][_0x6919('0x1b')]);_0x6e2e69[_0x6919('0x1d')]=qs['offset'](_0x6a756f[_0x6919('0x4a')][_0x6919('0x1d')]);}return _0x253f87[_0x6919('0xe3')](_0x6e2e69);}})[_0x6919('0x2c')](function(_0x3dc5ac){if(_0x3dc5ac){return _0x3dc5ac?{'count':_0x1c5a70,'rows':_0x3dc5ac}:null;}})[_0x6919('0x2c')](respondWithResult(_0x1907b3,null))[_0x6919('0x2a')](handleError(_0x1907b3,null));};exports['getOpenchannelInteractions']=function(_0x42e58a,_0x305fca){var _0x26dc7c={};var _0x409b4a={};var _0x98bcb1;var _0x238aa6;return db[_0x6919('0x3f')][_0x6919('0x90')]({'where':{'id':_0x42e58a[_0x6919('0x5e')]['id']}})['then'](handleEntityNotFound(_0x305fca,null))[_0x6919('0x2c')](function(_0x175233){if(_0x175233){_0x98bcb1=_0x175233;_0x409b4a['model']=_[_0x6919('0xcf')](db['OpenchannelInteraction'][_0x6919('0xd1')]);_0x409b4a[_0x6919('0x4a')]=_['keys'](_0x42e58a[_0x6919('0x4a')]);_0x409b4a['filters']=_[_0x6919('0xd3')](_0x409b4a[_0x6919('0xce')],_0x409b4a[_0x6919('0x4a')]);_0x26dc7c[_0x6919('0x4c')]=_[_0x6919('0xd3')](_0x409b4a[_0x6919('0xce')],qs['fields'](_0x42e58a['query'][_0x6919('0xd4')]));_0x26dc7c[_0x6919('0x4c')]=_0x26dc7c[_0x6919('0x4c')][_0x6919('0x6b')]?_0x26dc7c[_0x6919('0x4c')]:_0x409b4a['model'];_0x26dc7c['order']=qs['sort'](_0x42e58a['query'][_0x6919('0xd5')]);_0x26dc7c[_0x6919('0x47')]=qs[_0x6919('0xd2')](_[_0x6919('0xd6')](_0x42e58a[_0x6919('0x4a')],_0x409b4a[_0x6919('0xd2')]));if(_0x42e58a[_0x6919('0x4a')][_0x6919('0x43')]){_0x26dc7c[_0x6919('0x47')]=_[_0x6919('0x59')](_0x26dc7c['where'],{'$or':_[_0x6919('0x40')](_0x26dc7c[_0x6919('0x4c')],function(_0x2e66c4){var _0x2b4867={};_0x2b4867[_0x2e66c4]={'$like':'%'+_0x42e58a[_0x6919('0x4a')][_0x6919('0x43')]+'%'};return _0x2b4867;})});}_0x26dc7c=_[_0x6919('0x59')]({},_0x26dc7c,_0x42e58a['options']);return _0x98bcb1[_0x6919('0xe4')](_0x26dc7c);}})['then'](function(_0x184b1c){if(_0x184b1c){_0x238aa6=_0x184b1c[_0x6919('0x6b')];if(!_0x42e58a[_0x6919('0x4a')][_0x6919('0xd8')](_0x6919('0xd9'))){_0x26dc7c[_0x6919('0x1b')]=qs[_0x6919('0x1b')](_0x42e58a[_0x6919('0x4a')][_0x6919('0x1b')]);_0x26dc7c[_0x6919('0x1d')]=qs[_0x6919('0x1d')](_0x42e58a['query']['offset']);}return _0x98bcb1[_0x6919('0xe4')](_0x26dc7c);}})[_0x6919('0x2c')](function(_0x37d561){if(_0x37d561){return _0x37d561?{'count':_0x238aa6,'rows':_0x37d561}:null;}})[_0x6919('0x2c')](respondWithResult(_0x305fca,null))[_0x6919('0x2a')](handleError(_0x305fca,null));};exports[_0x6919('0xe5')]=function(_0x31b126,_0x17d33a){var _0x2266fb={'raw':!![],'where':{}};var _0x73093a={};var _0x50fd69={'count':0x0,'rows':[]};return db[_0x6919('0x3f')][_0x6919('0x90')]({'where':{'id':_0x31b126[_0x6919('0x5e')]['id']}})['then'](handleEntityNotFound(_0x17d33a,null))[_0x6919('0x2c')](function(_0x27dfe6){if(_0x27dfe6){_0x73093a[_0x6919('0xce')]=_['keys'](db[_0x6919('0xe6')][_0x6919('0xd1')]);_0x73093a[_0x6919('0x4a')]=_['keys'](_0x31b126[_0x6919('0x4a')]);_0x73093a['filters']=_[_0x6919('0xd3')](_0x73093a['model'],_0x73093a[_0x6919('0x4a')]);_0x2266fb[_0x6919('0x4c')]=_[_0x6919('0xd3')](_0x73093a[_0x6919('0xce')],qs[_0x6919('0xd4')](_0x31b126['query']['fields']));_0x2266fb[_0x6919('0x4c')]=_0x2266fb[_0x6919('0x4c')][_0x6919('0x6b')]?_0x2266fb[_0x6919('0x4c')]:_0x73093a['model'];if(!_0x31b126['query']['hasOwnProperty'](_0x6919('0xd9'))){_0x2266fb[_0x6919('0x1b')]=qs[_0x6919('0x1b')](_0x31b126[_0x6919('0x4a')][_0x6919('0x1b')]);_0x2266fb['offset']=qs['offset'](_0x31b126[_0x6919('0x4a')][_0x6919('0x1d')]);}_0x2266fb[_0x6919('0xdb')]=qs['sort'](_0x31b126[_0x6919('0x4a')]['sort']);_0x2266fb['where']=qs[_0x6919('0xd2')](_['pick'](_0x31b126['query'],_0x73093a[_0x6919('0xd2')]));_0x2266fb[_0x6919('0x47')][_0x6919('0xdf')]=_0x27dfe6['id'];if(_0x31b126['query'][_0x6919('0x43')]){_0x2266fb['where']=_[_0x6919('0x59')](_0x2266fb[_0x6919('0x47')],{'$or':_['map'](_0x2266fb[_0x6919('0x4c')],function(_0x11c368){var _0xf4670={};_0xf4670[_0x11c368]={'$like':'%'+_0x31b126[_0x6919('0x4a')][_0x6919('0x43')]+'%'};return _0xf4670;})});}_0x2266fb=_[_0x6919('0x59')]({},_0x2266fb,_0x31b126[_0x6919('0x5a')]);return db[_0x6919('0xe6')][_0x6919('0x1c')]({'where':_0x2266fb[_0x6919('0x47')]})['then'](function(_0x1b020e){_0x50fd69[_0x6919('0x1c')]=_0x1b020e;if(_0x31b126[_0x6919('0x4a')]['includeAll']){_0x2266fb[_0x6919('0x49')]=[{'all':!![]}];}return db[_0x6919('0xe6')][_0x6919('0x4e')](_0x2266fb);})[_0x6919('0x2c')](function(_0x184ba1){_0x50fd69[_0x6919('0x51')]=_0x184ba1;return _0x50fd69;});}})['then'](respondWithFilteredResult(_0x17d33a,_0x2266fb))[_0x6919('0x2a')](handleError(_0x17d33a,null));};exports[_0x6919('0xe7')]=function(_0x1fddc8,_0x1b0a96){var _0x5bd5a7={};var _0x132c67={};var _0x6228d6;var _0x31af71;return db[_0x6919('0x3f')]['findOne']({'where':{'id':_0x1fddc8['params']['id']}})['then'](handleEntityNotFound(_0x1b0a96,null))[_0x6919('0x2c')](function(_0x5d9cd5){if(_0x5d9cd5){_0x6228d6=_0x5d9cd5;_0x132c67[_0x6919('0xce')]=_[_0x6919('0xcf')](db['SmsInteraction'][_0x6919('0xd1')]);_0x132c67[_0x6919('0x4a')]=_[_0x6919('0xcf')](_0x1fddc8[_0x6919('0x4a')]);_0x132c67[_0x6919('0xd2')]=_['intersection'](_0x132c67[_0x6919('0xce')],_0x132c67[_0x6919('0x4a')]);_0x5bd5a7[_0x6919('0x4c')]=_[_0x6919('0xd3')](_0x132c67[_0x6919('0xce')],qs[_0x6919('0xd4')](_0x1fddc8['query'][_0x6919('0xd4')]));_0x5bd5a7[_0x6919('0x4c')]=_0x5bd5a7[_0x6919('0x4c')]['length']?_0x5bd5a7['attributes']:_0x132c67[_0x6919('0xce')];_0x5bd5a7[_0x6919('0xdb')]=qs[_0x6919('0xd5')](_0x1fddc8[_0x6919('0x4a')][_0x6919('0xd5')]);_0x5bd5a7[_0x6919('0x47')]=qs['filters'](_['pick'](_0x1fddc8[_0x6919('0x4a')],_0x132c67[_0x6919('0xd2')]));if(_0x1fddc8['query']['filter']){_0x5bd5a7[_0x6919('0x47')]=_[_0x6919('0x59')](_0x5bd5a7[_0x6919('0x47')],{'$or':_[_0x6919('0x40')](_0x5bd5a7[_0x6919('0x4c')],function(_0xd45c93){var _0x1b93b9={};_0x1b93b9[_0xd45c93]={'$like':'%'+_0x1fddc8['query'][_0x6919('0x43')]+'%'};return _0x1b93b9;})});}_0x5bd5a7=_[_0x6919('0x59')]({},_0x5bd5a7,_0x1fddc8['options']);return _0x6228d6[_0x6919('0xe7')](_0x5bd5a7);}})[_0x6919('0x2c')](function(_0x2d84e4){if(_0x2d84e4){_0x31af71=_0x2d84e4[_0x6919('0x6b')];if(!_0x1fddc8[_0x6919('0x4a')]['hasOwnProperty']('nolimit')){_0x5bd5a7[_0x6919('0x1b')]=qs[_0x6919('0x1b')](_0x1fddc8[_0x6919('0x4a')][_0x6919('0x1b')]);_0x5bd5a7[_0x6919('0x1d')]=qs[_0x6919('0x1d')](_0x1fddc8[_0x6919('0x4a')][_0x6919('0x1d')]);}return _0x6228d6[_0x6919('0xe7')](_0x5bd5a7);}})[_0x6919('0x2c')](function(_0x279190){if(_0x279190){return _0x279190?{'count':_0x31af71,'rows':_0x279190}:null;}})[_0x6919('0x2c')](respondWithResult(_0x1b0a96,null))[_0x6919('0x2a')](handleError(_0x1b0a96,null));};exports[_0x6919('0xe8')]=function(_0x5052d6,_0x2cab44){var _0x3b158c={};var _0x4504bc={};var _0x1e091e;var _0x3c8804;return db[_0x6919('0x3f')][_0x6919('0x90')]({'where':{'id':_0x5052d6[_0x6919('0x5e')]['id']}})[_0x6919('0x2c')](handleEntityNotFound(_0x2cab44,null))[_0x6919('0x2c')](function(_0xf5a1b3){if(_0xf5a1b3){_0x1e091e=_0xf5a1b3;_0x4504bc[_0x6919('0xce')]=_[_0x6919('0xcf')](db[_0x6919('0xe9')][_0x6919('0xd1')]);_0x4504bc[_0x6919('0x4a')]=_['keys'](_0x5052d6['query']);_0x4504bc[_0x6919('0xd2')]=_[_0x6919('0xd3')](_0x4504bc[_0x6919('0xce')],_0x4504bc[_0x6919('0x4a')]);_0x3b158c['attributes']=_[_0x6919('0xd3')](_0x4504bc[_0x6919('0xce')],qs[_0x6919('0xd4')](_0x5052d6[_0x6919('0x4a')][_0x6919('0xd4')]));_0x3b158c[_0x6919('0x4c')]=_0x3b158c[_0x6919('0x4c')]['length']?_0x3b158c[_0x6919('0x4c')]:_0x4504bc[_0x6919('0xce')];_0x3b158c['order']=qs['sort'](_0x5052d6['query'][_0x6919('0xd5')]);_0x3b158c[_0x6919('0x47')]=qs[_0x6919('0xd2')](_[_0x6919('0xd6')](_0x5052d6['query'],_0x4504bc[_0x6919('0xd2')]));if(_0x5052d6[_0x6919('0x4a')][_0x6919('0x43')]){_0x3b158c[_0x6919('0x47')]=_[_0x6919('0x59')](_0x3b158c[_0x6919('0x47')],{'$or':_[_0x6919('0x40')](_0x3b158c[_0x6919('0x4c')],function(_0x105be5){var _0x16c140={};_0x16c140[_0x105be5]={'$like':'%'+_0x5052d6['query']['filter']+'%'};return _0x16c140;})});}_0x3b158c=_[_0x6919('0x59')]({},_0x3b158c,_0x5052d6[_0x6919('0x5a')]);return _0x1e091e['getFaxInteractions'](_0x3b158c);}})[_0x6919('0x2c')](function(_0x17694e){if(_0x17694e){_0x3c8804=_0x17694e['length'];if(!_0x5052d6[_0x6919('0x4a')][_0x6919('0xd8')]('nolimit')){_0x3b158c['limit']=qs[_0x6919('0x1b')](_0x5052d6[_0x6919('0x4a')][_0x6919('0x1b')]);_0x3b158c['offset']=qs['offset'](_0x5052d6[_0x6919('0x4a')][_0x6919('0x1d')]);}return _0x1e091e[_0x6919('0xe8')](_0x3b158c);}})[_0x6919('0x2c')](function(_0x370fff){if(_0x370fff){return _0x370fff?{'count':_0x3c8804,'rows':_0x370fff}:null;}})['then'](respondWithResult(_0x2cab44,null))[_0x6919('0x2a')](handleError(_0x2cab44,null));};exports[_0x6919('0xea')]=function(_0x4c93b6,_0xb4fafc){var _0x25330d={};var _0xd84f96={};var _0x3952ea;var _0x161a9c;return db[_0x6919('0x3f')][_0x6919('0x90')]({'where':{'id':_0x4c93b6[_0x6919('0x5e')]['id']}})['then'](handleEntityNotFound(_0xb4fafc,null))[_0x6919('0x2c')](function(_0xc63424){if(_0xc63424){_0x3952ea=_0xc63424;_0xd84f96[_0x6919('0xce')]=_[_0x6919('0xcf')](db[_0x6919('0xeb')]['rawAttributes']);_0xd84f96[_0x6919('0x4a')]=_[_0x6919('0xcf')](_0x4c93b6['query']);_0xd84f96[_0x6919('0xd2')]=_[_0x6919('0xd3')](_0xd84f96['model'],_0xd84f96['query']);_0x25330d[_0x6919('0x4c')]=_[_0x6919('0xd3')](_0xd84f96[_0x6919('0xce')],qs[_0x6919('0xd4')](_0x4c93b6[_0x6919('0x4a')]['fields']));_0x25330d['attributes']=_0x25330d['attributes'][_0x6919('0x6b')]?_0x25330d[_0x6919('0x4c')]:_0xd84f96[_0x6919('0xce')];_0x25330d[_0x6919('0xdb')]=qs['sort'](_0x4c93b6[_0x6919('0x4a')][_0x6919('0xd5')]);_0x25330d[_0x6919('0x47')]=qs[_0x6919('0xd2')](_[_0x6919('0xd6')](_0x4c93b6[_0x6919('0x4a')],_0xd84f96[_0x6919('0xd2')]));if(_0x4c93b6[_0x6919('0x4a')][_0x6919('0x43')]){_0x25330d[_0x6919('0x47')]=_[_0x6919('0x59')](_0x25330d[_0x6919('0x47')],{'$or':_[_0x6919('0x40')](_0x25330d['attributes'],function(_0x54b756){var _0x3c16e9={};_0x3c16e9[_0x54b756]={'$like':'%'+_0x4c93b6[_0x6919('0x4a')][_0x6919('0x43')]+'%'};return _0x3c16e9;})});}_0x25330d=_[_0x6919('0x59')]({},_0x25330d,_0x4c93b6[_0x6919('0x5a')]);return _0x3952ea[_0x6919('0xea')](_0x25330d);}})[_0x6919('0x2c')](function(_0x515877){if(_0x515877){_0x161a9c=_0x515877['length'];if(!_0x4c93b6['query'][_0x6919('0xd8')](_0x6919('0xd9'))){_0x25330d[_0x6919('0x1b')]=qs['limit'](_0x4c93b6['query'][_0x6919('0x1b')]);_0x25330d[_0x6919('0x1d')]=qs[_0x6919('0x1d')](_0x4c93b6['query'][_0x6919('0x1d')]);}return _0x3952ea[_0x6919('0xea')](_0x25330d);}})[_0x6919('0x2c')](function(_0x28d812){if(_0x28d812){return _0x28d812?{'count':_0x161a9c,'rows':_0x28d812}:null;}})[_0x6919('0x2c')](respondWithResult(_0xb4fafc,null))[_0x6919('0x2a')](handleError(_0xb4fafc,null));};exports['login']=function(_0x336744,_0xe57f41,_0x56a084){var _0x10f331;var _0x30cc00;var _0x140433;var _0x10ec3d=!_[_0x6919('0x66')](_0x336744['params']['id'])?_0x336744[_0x6919('0x5e')]['id']:!_[_0x6919('0x66')](_0x336744[_0x6919('0x32')]['id'])?_0x336744[_0x6919('0x32')]['id']:null;return db[_0x6919('0x3f')]['find']({'where':{'id':_0x10ec3d,'role':{'$or':[_0x6919('0x7c'),_0x6919('0x32'),_0x6919('0x71')]}},'attributes':['id',_0x6919('0x3d'),_0x6919('0xec'),_0x6919('0xed'),_0x6919('0x30'),_0x6919('0x65'),_0x6919('0x99')]})[_0x6919('0x2c')](function(_0x23ef2c){if(_0x23ef2c){if(_0x23ef2c['role']===_0x6919('0x71')){_0x10f331=_0x23ef2c;if(_0x336744[_0x6919('0x5d')][_0x6919('0x9b')]){_0x140433=util[_0x6919('0xa8')](_0x6919('0xee'),_0x10f331[_0x336744['body'][_0x6919('0x9b')]]);}else if(_0x336744[_0x6919('0x5d')]['intrf']){_0x140433=util[_0x6919('0xa8')](_0x6919('0xa9'),_0x336744[_0x6919('0x5d')][_0x6919('0xef')]);}else{_0x140433=util[_0x6919('0xa8')](_0x6919('0xa9'),_0x10f331[_0x6919('0x3d')]);}socket['to'](util[_0x6919('0xa8')]('user:%s',_0x10f331[_0x6919('0x3d')]))['emit'](_0x6919('0xf0'),{'user':{'id':_0x10f331['id'],'name':_0x10f331[_0x6919('0x3d')]},'ip':_0x336744['headers'][_0x6919('0xf1')]||_0x336744[_0x6919('0xf2')][_0x6919('0xf3')]||_0x336744[_0x6919('0xf4')]['remoteAddress']||_0x336744[_0x6919('0xf2')]['socket'][_0x6919('0xf3')]});return db[_0x6919('0xaa')][_0x6919('0x2e')]({'where':{'membername':_0x10f331[_0x6919('0x3d')]},'individualHooks':!![]});}}else{throw new db[(_0x6919('0x8a'))]['ValidationError'](_0x6919('0xf5'));}})[_0x6919('0x2c')](function(){if(_0x10f331){return _0x10f331[_0x6919('0xf6')]({'raw':!![]});}})[_0x6919('0x2c')](function(_0x260856){if(_0x10f331){if(_0x260856){_0x30cc00=_0x260856;if(_0x30cc00[_0x6919('0x6b')]){var _0x36d7fc=_0x30cc00['map'](function(_0x3b6a0a){var _0x5e236c={'membername':_0x10f331[_0x6919('0x3d')],'UserId':_0x10f331['id'],'queue_name':_0x3b6a0a[_0x6919('0x3d')],'VoiceQueueId':_0x3b6a0a['id'],'interface':_0x140433,'paused':_0x10f331[_0x6919('0x99')]||![],'penalty':_0x3b6a0a[_0x6919('0xf7')]||0x0};return db[_0x6919('0xaa')][_0x6919('0xab')](_0x5e236c);});return Promise[_0x6919('0x56')](_0x36d7fc);}}}})[_0x6919('0x2c')](function(){if(_0x10f331){return db[_0x6919('0xf8')][_0x6919('0x4e')]({'where':{'membername':_0x10f331[_0x6919('0x3d')],'exitAt':null}});}})['then'](function(_0x1d7960){if(_0x10f331){var _0x2bd5d9=[];_0x1d7960[_0x6919('0xf9')](function(_0x426b4e){_0x2bd5d9['push'](_0x426b4e[_0x6919('0x2b')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x2bd5d9);}})[_0x6919('0x2c')](function(){if(_0x10f331){var _0x12cf90=[];var _0x394c30=[];var _0x57ceb3=utils[_0x6919('0xfa')]();var _0x374aff={'membername':_0x10f331[_0x6919('0x3d')],'interface':_0x140433,'enterAt':moment()[_0x6919('0xa8')](_0x6919('0xfb')),'role':_0x10f331[_0x6919('0x30')],'internal':_0x10f331['internal']};_0x57ceb3['forEach'](function(_0x8e8626){_0x12cf90['push'](_[_0x6919('0x59')]({'channel':_0x8e8626,'type':'LOGIN','data1':_0x336744[_0x6919('0x5d')]['device'],'data2':_0x140433},_0x374aff));if(_0x10f331[_0x6919('0x99')]){_0x394c30[_0x6919('0x4d')](_[_0x6919('0x59')]({'channel':_0x8e8626,'type':_0x6919('0xfc'),'data1':_0x6919('0xfd')},_0x374aff));}});return db[_0x6919('0xf8')][_0x6919('0x83')](_0x12cf90[_0x6919('0xfe')](_0x394c30),{'individualHooks':!![]});}})[_0x6919('0x2c')](function(){if(_0x10f331){return _0x10f331[_0x6919('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x6919('0xa8')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x10f331['loginInPause']||![],'mailPause':_0x10f331[_0x6919('0x99')]||![],'chatPause':_0x10f331[_0x6919('0x99')]||![],'faxPause':_0x10f331['loginInPause']||![],'smsPause':_0x10f331[_0x6919('0x99')]||![],'openchannelPause':_0x10f331[_0x6919('0x99')]||![],'whatsappPause':_0x10f331[_0x6919('0x99')]||![],'pauseType':_0x10f331[_0x6919('0x99')]?'LOGININPAUSE':null,'interface':_0x140433,'lastPauseAt':moment()['format'](_0x6919('0xfb'))});}})['then'](function(_0x5529a4){if(_0x336744[_0x6919('0xff')]){return _0x56a084();}else{return Promise[_0x6919('0x100')](_0x5529a4)[_0x6919('0x2c')](respondWithResult(_0xe57f41,null));}})['catch'](handleError(_0xe57f41,null));};exports[_0x6919('0x101')]=function(_0x48cf1a,_0x5e877b){var _0x47cb56;return db['User'][_0x6919('0x39')]({'where':{'id':_0x48cf1a[_0x6919('0x5e')]['id'],'role':'agent'},'attributes':['id',_0x6919('0x3d'),'role']})['then'](handleEntityNotFound(_0x5e877b,null))[_0x6919('0x2c')](function(_0x2b8e8a){if(_0x2b8e8a){_0x47cb56=_0x2b8e8a;return db[_0x6919('0xaa')]['destroy']({'where':{'membername':_0x47cb56[_0x6919('0x3d')]},'individualHooks':!![]});}})['then'](function(){return db[_0x6919('0xf8')]['findAll']({'where':{'membername':_0x47cb56[_0x6919('0x3d')],'exitAt':null}});})['then'](function(_0x1d3922){var _0x5a3455=[];_0x1d3922[_0x6919('0xf9')](function(_0x5c114d){_0x5a3455[_0x6919('0x4d')](_0x5c114d['update']({'exitAt':moment()['format'](_0x6919('0xfb'))}));});return Promise[_0x6919('0x56')](_0x5a3455);})['then'](function(){return _0x47cb56['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x6919('0x2c')](respondWithResult(_0x5e877b,null))[_0x6919('0x2a')](handleError(_0x5e877b,null));};exports[_0x6919('0x102')]=function(_0x303bf4,_0x56d5a8){var _0x5cca0f;return db[_0x6919('0xaa')]['update']({'paused':0x1},{'where':{'UserId':_0x303bf4[_0x6919('0x5e')]['id']},'individualHooks':!![]})[_0x6919('0x2c')](function(){return db[_0x6919('0x3f')][_0x6919('0x39')]({'where':{'id':_0x303bf4[_0x6919('0x5e')]['id'],'role':_0x6919('0x71')},'attributes':['id',_0x6919('0x3d'),_0x6919('0x30'),_0x6919('0x65'),_0x6919('0x9b'),_0x6919('0x98')]});})['then'](handleEntityNotFound(_0x56d5a8,null))[_0x6919('0x2c')](function(_0x5a5cb3){if(_0x5a5cb3){_0x5cca0f=_0x5a5cb3;return respondWithRpcPromise('QueuePause',_0x6919('0x102'),{'id':_0x5cca0f['id'],'name':_0x5cca0f[_0x6919('0x3d')],'pause':!![]});}})['then'](function(){if(_0x5cca0f){return db[_0x6919('0xf8')][_0x6919('0x4e')]({'where':{'membername':_0x5cca0f[_0x6919('0x3d')],'type':_0x6919('0xfc'),'exitAt':null}});}})[_0x6919('0x2c')](function(_0x59520a){if(_0x59520a[_0x6919('0x6b')]){var _0x187516=moment()[_0x6919('0xa8')](_0x6919('0xfb'));for(var _0x98a99d=0x0,_0xd0f5ed=_0x59520a[_0x6919('0x6b')];_0x98a99d<_0xd0f5ed;_0x98a99d++){_0x59520a[_0x98a99d][_0x6919('0x103')]({'exitAt':_0x187516});}}})[_0x6919('0x2c')](function(){var _0x49d7c6=[];var _0x2be4fc=utils[_0x6919('0xfa')]();_0x2be4fc['forEach'](function(_0x2c5322){_0x49d7c6[_0x6919('0x4d')]({'channel':_0x2c5322,'membername':_0x5cca0f[_0x6919('0x3d')],'interface':_['isNil'](_0x5cca0f[_0x6919('0x9b')])?util['format']('SIP/%s',_0x5cca0f[_0x6919('0x3d')]):_0x5cca0f['interface'],'type':_0x6919('0xfc'),'enterAt':moment()['format'](_0x6919('0xfb')),'data1':_0x303bf4[_0x6919('0x5d')]['type']||_0x6919('0x104'),'role':_0x5cca0f['role'],'internal':_0x5cca0f[_0x6919('0x65')]});});return db['MemberReport']['bulkCreate'](_0x49d7c6,{'individualHooks':!![]});})[_0x6919('0x2c')](function(){return _0x5cca0f[_0x6919('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x303bf4[_0x6919('0x5d')][_0x6919('0x41')]||_0x6919('0x104'),'lastPauseAt':moment()[_0x6919('0xa8')](_0x6919('0xfb'))});})[_0x6919('0x2c')](respondWithResult(_0x56d5a8,null))[_0x6919('0x2a')](handleError(_0x56d5a8,null));};exports['unpause']=function(_0xdd595a,_0x1e2d2f){if(_0xdd595a[_0x6919('0x5d')][_0x6919('0xad')]&&!utils['isValidChannel'](_0xdd595a[_0x6919('0x5d')][_0x6919('0xad')])){throw new APIBadRequestError(util[_0x6919('0xa8')](_0x6919('0x105'),_0xdd595a['body']['channel']));}return db[_0x6919('0x3f')][_0x6919('0x39')]({'where':{'id':_0xdd595a[_0x6919('0x5e')]['id']},'attributes':['id','name',_0x6919('0x30'),_0x6919('0x65'),_0x6919('0x9b'),_0x6919('0x98'),_0x6919('0x9a'),_0x6919('0x106'),_0x6919('0x107'),_0x6919('0x108'),_0x6919('0x109'),_0x6919('0x10a'),_0x6919('0x10b'),'pauseType',_0x6919('0x10c')]})['then'](function(_0x5aec9f){if(!_0x5aec9f){throw new APINotFoundError(util['format'](_0x6919('0xc6'),_0xdd595a['params']['id']));}return _0x5aec9f[_0x6919('0x10d')](_0xdd595a[_0x6919('0x5d')][_0x6919('0xad')]);})[_0x6919('0x2c')](respondWithResult(_0x1e2d2f,null))[_0x6919('0x2a')](APIHandleError(_0x1e2d2f));};exports['getTeams']=function(_0x52f86b,_0x124670){var _0x4705cc={};var _0x2d6d3a={};var _0x146853;var _0x12c205;return db[_0x6919('0x3f')][_0x6919('0x90')]({'where':{'id':_0x52f86b[_0x6919('0x5e')]['id']}})[_0x6919('0x2c')](handleEntityNotFound(_0x124670,null))[_0x6919('0x2c')](function(_0xe822db){if(_0xe822db){_0x146853=_0xe822db;_0x2d6d3a['model']=_['keys'](db[_0x6919('0x10e')]['rawAttributes']);_0x2d6d3a[_0x6919('0x4a')]=_[_0x6919('0xcf')](_0x52f86b[_0x6919('0x4a')]);_0x2d6d3a[_0x6919('0xd2')]=_[_0x6919('0xd3')](_0x2d6d3a[_0x6919('0xce')],_0x2d6d3a[_0x6919('0x4a')]);_0x4705cc['attributes']=_[_0x6919('0xd3')](_0x2d6d3a[_0x6919('0xce')],qs[_0x6919('0xd4')](_0x52f86b[_0x6919('0x4a')][_0x6919('0xd4')]));_0x4705cc[_0x6919('0x4c')]=_0x4705cc[_0x6919('0x4c')][_0x6919('0x6b')]?_0x4705cc[_0x6919('0x4c')]:_0x2d6d3a[_0x6919('0xce')];_0x4705cc[_0x6919('0xdb')]=qs['sort'](_0x52f86b[_0x6919('0x4a')][_0x6919('0xd5')]);_0x4705cc[_0x6919('0x47')]=qs['filters'](_[_0x6919('0xd6')](_0x52f86b[_0x6919('0x4a')],_0x2d6d3a[_0x6919('0xd2')]));if(_0x52f86b['query'][_0x6919('0x43')]){_0x4705cc[_0x6919('0x47')]=_['merge'](_0x4705cc[_0x6919('0x47')],{'$or':_[_0x6919('0x40')](_0x4705cc[_0x6919('0x4c')],function(_0xbdccbb){var _0x33450a={};_0x33450a[_0xbdccbb]={'$like':'%'+_0x52f86b['query'][_0x6919('0x43')]+'%'};return _0x33450a;})});}_0x4705cc=_[_0x6919('0x59')]({},_0x4705cc,_0x52f86b[_0x6919('0x5a')]);return _0x146853[_0x6919('0x10f')](_0x4705cc);}})[_0x6919('0x2c')](function(_0x4cf823){if(_0x4cf823){_0x12c205=_0x4cf823[_0x6919('0x6b')];if(!_0x52f86b[_0x6919('0x4a')][_0x6919('0xd8')](_0x6919('0xd9'))){_0x4705cc[_0x6919('0x1b')]=qs[_0x6919('0x1b')](_0x52f86b['query'][_0x6919('0x1b')]);_0x4705cc[_0x6919('0x1d')]=qs['offset'](_0x52f86b[_0x6919('0x4a')][_0x6919('0x1d')]);}return _0x146853[_0x6919('0x10f')](_0x4705cc);}})[_0x6919('0x2c')](function(_0x20944b){if(_0x20944b){return _0x20944b?{'count':_0x12c205,'rows':_0x20944b}:null;}})['then'](respondWithResult(_0x124670,null))[_0x6919('0x2a')](handleError(_0x124670,null));};exports[_0x6919('0x110')]=function(_0x3dcb75,_0x5acf5e){var _0x281dba=_0x3dcb75[_0x6919('0x5e')]['id'];var _0x40d8af=_0x3dcb75[_0x6919('0x5d')]?_0x3dcb75['body'][_0x6919('0x61')]:null;var _0x56e87c=[];return Promise[_0x6919('0x100')]()['then'](function(){if(!_0x40d8af)throw new APIBadRequestError(_0x6919('0x111'));})[_0x6919('0x2c')](function(){return db[_0x6919('0x3f')][_0x6919('0x90')]({'where':{'id':_0x281dba}});})[_0x6919('0x2c')](function(_0x1e53c0){if(!_0x1e53c0)throw new APINotFoundError(util[_0x6919('0xa8')](_0x6919('0xc6'),_0x3dcb75[_0x6919('0x5e')]['id']));return db[_0x6919('0x112')]['transaction'](function(_0x826a91){return _0x1e53c0[_0x6919('0x110')](_0x40d8af,{'transaction':_0x826a91})[_0x6919('0x2c')](function(){return db[_0x6919('0x10e')][_0x6919('0x4e')]({'where':{'id':{'$in':_0x40d8af}}});})[_0x6919('0x2c')](function(_0x19e29e){var _0x336b08=_['map'](_0x19e29e,function(_0x4cf577){return _0x4cf577[_0x6919('0x113')]();});return Promise[_0x6919('0x56')](_0x336b08);})[_0x6919('0x2c')](function(_0x45bd34){_0x56e87c=_[_0x6919('0x114')](_0x45bd34);var _0x86fd32=_[_0x6919('0x40')](_0x56e87c,function(_0x1ce496){return _0x1ce496['addAgent'](_0x1e53c0['id'],{'transaction':_0x826a91});});return Promise['all'](_0x86fd32);})[_0x6919('0x2c')](function(){if(!_0x1e53c0['online'])return;var _0x4fd06f=_[_0x6919('0x43')](_0x56e87c,function(_0x48404f){return _0x48404f[_0x6919('0x115')](_0x6919('0xad'))==='Voice';});var _0x3f4be8=_['map'](_0x4fd06f,function(_0x3b9d8e){return db[_0x6919('0xaa')]['upsert']({'membername':_0x1e53c0['name'],'UserId':_0x1e53c0['id'],'queue_name':_0x3b9d8e[_0x6919('0x3d')],'VoiceQueueId':_0x3b9d8e['id'],'interface':_[_0x6919('0x66')](_0x1e53c0[_0x6919('0x9b')])?util[_0x6919('0xa8')](_0x6919('0xa9'),_0x1e53c0['name']):_0x1e53c0[_0x6919('0x9b')],'paused':_0x1e53c0[_0x6919('0x9a')]||![],'penalty':_0x1e53c0[_0x6919('0xa2')]},{'transaction':_0x826a91});});return Promise[_0x6919('0x56')](_0x3f4be8);})[_0x6919('0x2c')](function(){return db[_0x6919('0x116')]['findAll']({'where':{'teamId':{'$in':_0x40d8af}}});})[_0x6919('0x2c')](function(_0x534397){var _0x2d79b4=_[_0x6919('0x40')](_0x534397,function(_0x2e5b2f){return db[_0x6919('0x117')][_0x6919('0x7a')]({'UserId':_0x1e53c0['id'],'VoicePrefixId':_0x2e5b2f['VoicePrefixId']},{'transaction':_0x826a91});});return Promise[_0x6919('0x56')](_0x2d79b4);});});})['then'](function(){for(var _0x16a0d4=0x0;_0x16a0d4<_0x56e87c['length'];_0x16a0d4++){var _0x37c573=_0x56e87c[_0x16a0d4][_0x6919('0x115')](_0x6919('0xad'));var _0x46fdfc=_0x37c573+_0x6919('0xa4');socket[_0x6919('0x2d')]('user'+_0x37c573+_0x6919('0xa5'),{'UserId':_0x281dba,['queueField']:_0x56e87c[_0x16a0d4]['id']});}})['then'](respondWithStatusCode(_0x5acf5e,null))['catch'](APIHandleError(_0x5acf5e));};exports[_0x6919('0x118')]=function(_0x335f4d,_0x1bd288){var _0x23ae47=_0x335f4d['params']['id'];var _0x58c9fc=null;if(_0x335f4d[_0x6919('0x4a')][_0x6919('0x61')]){_0x58c9fc=_[_0x6919('0xae')](_0x335f4d[_0x6919('0x4a')]['ids'])?_0x335f4d[_0x6919('0x4a')]['ids']:[_0x335f4d[_0x6919('0x4a')][_0x6919('0x61')]];}var _0x35001c=[];return Promise[_0x6919('0x100')]()[_0x6919('0x2c')](function(){if(!_0x58c9fc)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x6919('0x2c')](function(){return db[_0x6919('0x3f')][_0x6919('0x90')]({'where':{'id':_0x23ae47}});})['then'](function(_0x406da4){if(!_0x406da4)throw new APINotFoundError(util[_0x6919('0xa8')](_0x6919('0xc6'),_0x335f4d[_0x6919('0x5e')]['id']));return db[_0x6919('0x112')][_0x6919('0x119')](function(_0x456357){return _0x406da4['removeTeams'](_0x58c9fc,{'transaction':_0x456357})['then'](function(){return db[_0x6919('0x10e')]['findAll']({'where':{'id':{'$in':_0x58c9fc}}});})[_0x6919('0x2c')](function(_0x2c6e54){var _0x3d1d15=_[_0x6919('0x40')](_0x2c6e54,function(_0x2dd79e){return _0x2dd79e[_0x6919('0x113')]();});return Promise[_0x6919('0x56')](_0x3d1d15);})[_0x6919('0x2c')](function(_0x22bf30){_0x35001c=_[_0x6919('0x114')](_0x22bf30);var _0x2b33f1=_[_0x6919('0x40')](_0x35001c,function(_0x56b4dd){return _0x56b4dd['removeAgent'](_0x406da4['id'],{'transaction':_0x456357});});return Promise[_0x6919('0x56')](_0x2b33f1);})[_0x6919('0x2c')](function(){if(!_0x406da4[_0x6919('0x98')])return;var _0x11447c=_[_0x6919('0x43')](_0x35001c,function(_0xf3e5b0){return _0xf3e5b0[_0x6919('0x115')](_0x6919('0xad'))==='Voice';});var _0x3f517f=_[_0x6919('0x40')](_0x11447c,function(_0x1d46af){return db['UserVoiceQueueRt'][_0x6919('0x2e')]({'where':{'VoiceQueueId':_0x1d46af['id'],'UserId':_0x406da4['id']},'transaction':_0x456357});});return Promise[_0x6919('0x56')](_0x3f517f);})[_0x6919('0x2c')](function(){return db[_0x6919('0x116')][_0x6919('0x4e')]({'where':{'teamId':{'$in':_0x58c9fc}}});})[_0x6919('0x2c')](function(_0x41fdf6){var _0x1fd730=_[_0x6919('0x40')](_0x41fdf6,function(_0x312c32){return db[_0x6919('0x117')][_0x6919('0x2e')]({'where':{'UserId':_0x406da4['id'],'VoicePrefixId':_0x312c32[_0x6919('0x11a')]}},{'transaction':_0x456357});});return Promise[_0x6919('0x56')](_0x1fd730);});});})[_0x6919('0x2c')](function(){for(var _0x5b8c62=0x0;_0x5b8c62<_0x35001c[_0x6919('0x6b')];_0x5b8c62++){var _0x2bcc06=_0x35001c[_0x5b8c62][_0x6919('0x115')](_0x6919('0xad'));var _0x18a7be=_0x2bcc06+'QueueId';socket['emit'](_0x6919('0x32')+_0x2bcc06+'Queue:remove',{'UserId':_0x23ae47,['queueField']:_0x35001c[_0x5b8c62]['id']});}})[_0x6919('0x2c')](respondWithStatusCode(_0x1bd288,null))[_0x6919('0x2a')](APIHandleError(_0x1bd288));};exports[_0x6919('0x11b')]=function(_0xbe014a,_0x44aa4c){var _0x2d3bbb={};var _0x52d00f={};var _0x3179ae;var _0x407905;return db['User'][_0x6919('0x90')]({'where':{'id':_0xbe014a[_0x6919('0x5e')]['id']}})['then'](handleEntityNotFound(_0x44aa4c,null))['then'](function(_0x3b3a63){if(_0x3b3a63){_0x3179ae=_0x3b3a63;_0x52d00f[_0x6919('0xce')]=_['keys'](db['CmList'][_0x6919('0xd1')]);_0x52d00f[_0x6919('0x4a')]=_[_0x6919('0xcf')](_0xbe014a['query']);_0x52d00f[_0x6919('0xd2')]=_[_0x6919('0xd3')](_0x52d00f[_0x6919('0xce')],_0x52d00f[_0x6919('0x4a')]);_0x2d3bbb[_0x6919('0x4c')]=_[_0x6919('0xd3')](_0x52d00f[_0x6919('0xce')],qs['fields'](_0xbe014a[_0x6919('0x4a')][_0x6919('0xd4')]));_0x2d3bbb[_0x6919('0x4c')]=_0x2d3bbb[_0x6919('0x4c')][_0x6919('0x6b')]?_0x2d3bbb[_0x6919('0x4c')]:_0x52d00f[_0x6919('0xce')];_0x2d3bbb[_0x6919('0xdb')]=qs[_0x6919('0xd5')](_0xbe014a[_0x6919('0x4a')]['sort']);_0x2d3bbb[_0x6919('0x47')]=qs['filters'](_[_0x6919('0xd6')](_0xbe014a[_0x6919('0x4a')],_0x52d00f[_0x6919('0xd2')]));if(_0xbe014a[_0x6919('0x4a')][_0x6919('0x43')]){_0x2d3bbb[_0x6919('0x47')]=_[_0x6919('0x59')](_0x2d3bbb[_0x6919('0x47')],{'$or':_[_0x6919('0x40')](_0x2d3bbb['attributes'],function(_0x522b53){var _0x425a45={};_0x425a45[_0x522b53]={'$like':'%'+_0xbe014a['query'][_0x6919('0x43')]+'%'};return _0x425a45;})});}_0x2d3bbb=_['merge']({},_0x2d3bbb,_0xbe014a['options']);return _0x3179ae[_0x6919('0x11b')](_0x2d3bbb);}})[_0x6919('0x2c')](function(_0x2fced0){if(_0x2fced0){_0x407905=_0x2fced0[_0x6919('0x6b')];if(!_0xbe014a[_0x6919('0x4a')][_0x6919('0xd8')]('nolimit')){_0x2d3bbb[_0x6919('0x1b')]=qs['limit'](_0xbe014a[_0x6919('0x4a')]['limit']);_0x2d3bbb[_0x6919('0x1d')]=qs['offset'](_0xbe014a[_0x6919('0x4a')][_0x6919('0x1d')]);}return _0x3179ae[_0x6919('0x11b')](_0x2d3bbb);}})[_0x6919('0x2c')](function(_0x41e259){if(_0x41e259){return _0x41e259?{'count':_0x407905,'rows':_0x41e259}:null;}})['then'](respondWithResult(_0x44aa4c,null))[_0x6919('0x2a')](handleError(_0x44aa4c,null));};exports[_0x6919('0x11c')]=function(_0x21d44a,_0x14622f){var _0x4601f8={};var _0x30e8f9={};var _0x3fb21a;return db[_0x6919('0x3f')][_0x6919('0x90')]({'where':{'id':_0x21d44a[_0x6919('0x5e')]['id']}})[_0x6919('0x2c')](handleEntityNotFound(_0x14622f,null))['then'](function(_0xa7fe80){if(_0xa7fe80){_0x3fb21a=_0xa7fe80;_0x30e8f9['model']=_[_0x6919('0xcf')](db[_0x6919('0x3f')][_0x6919('0xd1')]);_0x30e8f9[_0x6919('0x4a')]=_['keys'](_0x21d44a[_0x6919('0x4a')]);_0x30e8f9['filters']=_[_0x6919('0xd3')](_0x30e8f9[_0x6919('0xce')],_0x30e8f9[_0x6919('0x4a')]);_0x4601f8[_0x6919('0x4c')]=_['intersection'](_0x30e8f9[_0x6919('0xce')],qs[_0x6919('0xd4')](_0x21d44a[_0x6919('0x4a')][_0x6919('0xd4')]));_0x4601f8[_0x6919('0x4c')]=_0x4601f8[_0x6919('0x4c')][_0x6919('0x6b')]?_0x4601f8[_0x6919('0x4c')]:_0x30e8f9[_0x6919('0xce')];_0x4601f8[_0x6919('0xdb')]=qs['sort'](_0x21d44a[_0x6919('0x4a')][_0x6919('0xd5')]);_0x4601f8[_0x6919('0x47')]=qs[_0x6919('0xd2')](_[_0x6919('0xd6')](_0x21d44a[_0x6919('0x4a')],_0x30e8f9['filters']));if(_0x21d44a[_0x6919('0x4a')][_0x6919('0x43')]){_0x4601f8[_0x6919('0x47')]=_['merge'](_0x4601f8[_0x6919('0x47')],{'$or':_[_0x6919('0x40')](_0x4601f8[_0x6919('0x4c')],function(_0x1863ba){var _0x1a54f1={};_0x1a54f1[_0x1863ba]={'$like':'%'+_0x21d44a[_0x6919('0x4a')][_0x6919('0x43')]+'%'};return _0x1a54f1;})});}_0x4601f8['model']=db[_0x6919('0x3f')];_0x4601f8['as']=_0x6919('0x33');_0x4601f8=_[_0x6919('0x59')]({},_0x4601f8,_0x21d44a[_0x6919('0x5a')]);return _0x3fb21a[_0x6919('0xf6')]({'include':[_0x4601f8]});}})[_0x6919('0x2c')](function(_0xf6ad43){if(_0xf6ad43){var _0x1dac23={},_0x5136f6=[];for(var _0x16f367=0x0;_0x16f367<_0xf6ad43[_0x6919('0x6b')];_0x16f367+=0x1){for(var _0x225831=0x0,_0x44f6a5;_0x225831<_0xf6ad43[_0x16f367][_0x6919('0x33')]['length'];_0x225831+=0x1){_0x44f6a5=_0xf6ad43[_0x16f367][_0x6919('0x33')][_0x225831][_0x6919('0x2f')]({'plain':!![]});_0x1dac23[_0x44f6a5['id']]=_0x44f6a5;}}_0x1dac23=_['values'](_0x1dac23);for(var _0x4abfa4=qs['offset'](_0x21d44a[_0x6919('0x4a')][_0x6919('0x1d')]);_0x4abfa4<_0x1dac23[_0x6919('0x6b')]&&_0x5136f6[_0x6919('0x6b')]=_0x132c8d){_0x3341eb=_0x132c8d;_0x5640a7=0xc8;}else{_0x5640a7=0xce;}_0x5ca9b6[_0x14da('0x16')](_0x5640a7);return _0x5ca9b6[_0x14da('0x1c')](_0x14da('0x1d'),_0x2d921d+'-'+_0x3341eb+'/'+_0x132c8d)['json'](_0x360ec);}return null;};}function respondWithRpcPromise(_0x991780,_0x5101a5,_0x545fa0,_0x2d931e){return new Promise(function(_0x5cac98,_0x105117){var _0x12b21e=_0x2d931e||amiClient;return _0x12b21e['request'](_0x991780,_0x545fa0)[_0x14da('0x1e')](function(_0x3a5dcc){logger[_0x14da('0x1f')](_0x14da('0x20'),_0x5101a5,_0x14da('0x21'));logger['debug'](_0x14da('0x22'),_0x5101a5,_0x14da('0x21'),JSON[_0x14da('0x23')](_0x3a5dcc));if(_0x3a5dcc[_0x14da('0x24')]){if(_0x3a5dcc[_0x14da('0x24')][_0x14da('0x25')]===0x1f4){logger[_0x14da('0x24')](_0x14da('0x20'),_0x5101a5,_0x3a5dcc[_0x14da('0x24')]['message']);return _0x105117(_0x3a5dcc[_0x14da('0x24')][_0x14da('0x26')]);}logger[_0x14da('0x24')](_0x14da('0x20'),_0x5101a5,_0x3a5dcc[_0x14da('0x24')][_0x14da('0x26')]);return _0x5cac98(_0x3a5dcc[_0x14da('0x24')][_0x14da('0x26')]);}else{logger[_0x14da('0x1f')]('User,\x20%s,\x20%s',_0x5101a5,_0x14da('0x21'));_0x5cac98(_0x3a5dcc[_0x14da('0x27')][_0x14da('0x26')]);}})[_0x14da('0x28')](function(_0x3515d1){logger[_0x14da('0x24')](_0x14da('0x20'),_0x5101a5,_0x3515d1);_0x105117(_0x3515d1);});});}function saveUpdates(_0x4b7112){return function(_0x3f9850){if(_0x3f9850){return _0x3f9850[_0x14da('0x29')](_0x4b7112)[_0x14da('0x1e')](function(_0x116b07){if(_0x116b07[_0x14da('0x2a')]===_0x14da('0x2b')){socket['emit'](_0x14da('0x2c')+_0x116b07['id'],_0x116b07);}return _0x116b07;});}return null;};}function removeEntity(_0x5d6021,_0x10ca45){return function(_0x449a1c){if(_0x449a1c){return _0x449a1c['destroy']({'transaction':_0x10ca45})[_0x14da('0x1e')](function(){var _0x54aaa0=_0x449a1c['get']({'plain':!![]});if(_0x54aaa0[_0x14da('0x2a')]===_0x14da('0x2d'))return;var _0x277f9d=[{'name':_0x14da('0x2e'),'value':'user','ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0x14da('0x2f'),'value':_0x14da('0x30'),'ignore':![]}];var _0x4f8caf=_(_0x277f9d)['filter'](_0x14da('0x31'))[_0x14da('0x32')](_0x14da('0x33'))[_0x14da('0x33')]();if(_[_0x14da('0x34')](_0x4f8caf,_0x54aaa0['role'])){return;}var _0x2b0604=_['find'](_0x277f9d,[_0x14da('0x33'),_0x54aaa0[_0x14da('0x2a')]])[_0x14da('0x35')];return db[_0x14da('0x36')]['destroy']({'where':{'type':_0x2b0604,'resourceId':_0x54aaa0['id']},'transaction':_0x10ca45})[_0x14da('0x1e')](function(){return _0x449a1c;});})[_0x14da('0x1e')](function(){_0x5d6021['status'](0xcc)[_0x14da('0x17')]();});}};}function handleEntityNotFound(_0x20c44b){return function(_0x5c3541){if(!_0x5c3541){_0x20c44b[_0x14da('0x15')](0x194);}return _0x5c3541;};}function handleError(_0x38b01b,_0x14cbcb){_0x14cbcb=_0x14cbcb||0x1f4;return function(_0x428fcc){logger[_0x14da('0x24')](_0x428fcc[_0x14da('0x37')]);if(_0x428fcc[_0x14da('0x35')]){delete _0x428fcc[_0x14da('0x35')];}_0x38b01b[_0x14da('0x16')](_0x14cbcb)[_0x14da('0x38')](_0x428fcc);};}function getUserAttributes(){return _(db[_0x14da('0x39')][_0x14da('0x3a')])[_0x14da('0x32')](function(_0x5d4615){return{'name':_0x5d4615['fieldName'],'type':_0x5d4615[_0x14da('0x3b')][_0x14da('0x3c')]};})[_0x14da('0x3d')](function(_0xd40b85){return![_0x14da('0x3e'),_0x14da('0x3f'),_0x14da('0x40'),_0x14da('0x41'),'resetPasswordExpires',_0x14da('0x42')][_0x14da('0x34')](_0xd40b85[_0x14da('0x35')]);})[_0x14da('0x33')]();}exports[_0x14da('0x43')]=function(_0x313732,_0x530a2f){var _0xc5624c={},_0x33bd92={'count':0x0,'rows':[]};var _0xb7e202=getUserAttributes();_0xc5624c=qs['getOptions'](_0xb7e202,_0x313732);var _0x2a98b5={'where':_0xc5624c[_0x14da('0x44')]};return db[_0x14da('0x39')][_0x14da('0x1a')](_0x2a98b5)[_0x14da('0x1e')](function(_0x1c009c){_0x33bd92[_0x14da('0x1a')]=_0x1c009c;if(_0x313732[_0x14da('0x45')][_0x14da('0x46')]){_0xc5624c[_0x14da('0x47')]=[{'all':!![]}];}if(_0x313732[_0x14da('0x45')]['userSetting']===_0x14da('0x48')){_0xc5624c[_0x14da('0x47')]=[{'model':db[_0x14da('0x49')],'as':_0x14da('0x4a')}];}if(!_['includes'](_0xc5624c['attributes'],'id')){_0xc5624c[_0x14da('0x4b')][_0x14da('0x4c')]('id');}return db[_0x14da('0x39')]['findAll'](_0xc5624c);})['then'](function(_0x5092b1){_0x33bd92['rows']=_0x5092b1;if(_0x313732[_0x14da('0x45')][_0x14da('0x4d')]===_0x14da('0x48')){var _0x252eb5=[];for(var _0xe4de59=0x0;_0xe4de59<_0x33bd92[_0x14da('0x4e')][_0x14da('0x4f')];_0xe4de59++){_0x252eb5[_0x14da('0x4c')](get_open_tabs('chat',_0x33bd92['rows'][_0xe4de59][_0x14da('0x50')]));_0x252eb5[_0x14da('0x4c')](get_open_tabs('sms',_0x33bd92[_0x14da('0x4e')][_0xe4de59]['dataValues']));_0x252eb5[_0x14da('0x4c')](get_open_tabs(_0x14da('0x51'),_0x33bd92[_0x14da('0x4e')][_0xe4de59][_0x14da('0x50')]));_0x252eb5[_0x14da('0x4c')](get_open_tabs('mail',_0x33bd92[_0x14da('0x4e')][_0xe4de59]['dataValues']));_0x252eb5[_0x14da('0x4c')](get_open_tabs(_0x14da('0x52'),_0x33bd92[_0x14da('0x4e')][_0xe4de59][_0x14da('0x50')]));_0x252eb5[_0x14da('0x4c')](get_open_tabs(_0x14da('0x53'),_0x33bd92[_0x14da('0x4e')][_0xe4de59][_0x14da('0x50')]));}return Promise[_0x14da('0x54')](_0x252eb5)[_0x14da('0x1e')](function(){return _0x33bd92;});}else{return _0x33bd92;}})[_0x14da('0x1e')](respondWithFilteredResult(_0x530a2f,_0xc5624c))['catch'](handleError(_0x530a2f,null));};exports[_0x14da('0x55')]=function(_0x4480fc,_0x34c915){var _0x78bc5c=getUserAttributes();_0x4480fc[_0x14da('0x45')]['id']=_0x4480fc[_0x14da('0x56')]['id'];var _0x13bef0=qs[_0x14da('0x57')](_0x78bc5c,_0x4480fc);if(_0x4480fc['query'][_0x14da('0x46')]){_0x13bef0[_0x14da('0x47')]=[{'all':!![]}];}if(_0x4480fc[_0x14da('0x45')]['userSetting']==='true'){_0x13bef0[_0x14da('0x47')]=[{'model':db[_0x14da('0x49')],'as':_0x14da('0x4a')}];}_0x13bef0=_[_0x14da('0x58')]({},_0x13bef0,_0x4480fc['options']);if(!_[_0x14da('0x34')](_0x13bef0[_0x14da('0x4b')],'id')){_0x13bef0['attributes']['push']('id');}return db['User'][_0x14da('0x59')](_0x13bef0)[_0x14da('0x1e')](handleEntityNotFound(_0x34c915,null))[_0x14da('0x1e')](function(_0x1130b6){var _0x138b8f=[];values=_0x1130b6;if(_0x4480fc['query'][_0x14da('0x4d')]===_0x14da('0x48')){_0x138b8f['push'](get_open_tabs(_0x14da('0x5a'),_0x1130b6[_0x14da('0x50')]));_0x138b8f[_0x14da('0x4c')](get_open_tabs(_0x14da('0x5b'),_0x1130b6[_0x14da('0x50')]));_0x138b8f[_0x14da('0x4c')](get_open_tabs(_0x14da('0x52'),_0x1130b6['dataValues']));_0x138b8f[_0x14da('0x4c')](get_open_tabs(_0x14da('0x53'),_0x1130b6['dataValues']));_0x138b8f['push'](get_open_tabs(_0x14da('0x51'),_0x1130b6['dataValues']));_0x138b8f[_0x14da('0x4c')](get_open_tabs(_0x14da('0x5c'),_0x1130b6[_0x14da('0x50')]));return Promise[_0x14da('0x54')](_0x138b8f);}else{return values;}})[_0x14da('0x1e')](function(){return values;})['then'](respondWithResult(_0x34c915,null))[_0x14da('0x28')](handleError(_0x34c915,null));};exports[_0x14da('0x29')]=function(_0x470563,_0x5129f4){if(_0x470563[_0x14da('0x5d')]['id']){delete _0x470563['body']['id'];}delete _0x470563['body'][_0x14da('0x2a')];return db['User'][_0x14da('0x59')]({'where':{'id':_0x470563[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x5129f4,null))[_0x14da('0x1e')](saveUpdates(_0x470563[_0x14da('0x5d')],null))['then'](respondWithResult(_0x5129f4,null))[_0x14da('0x28')](handleError(_0x5129f4,null));};exports[_0x14da('0x5e')]=function(_0x27e4ee,_0x379ed3){return db[_0x14da('0x39')][_0x14da('0x5e')]()[_0x14da('0x1e')](respondWithResult(_0x379ed3,null))[_0x14da('0x28')](handleError(_0x379ed3,null));};exports['addContacts']=function(_0x35e121,_0x3808c6){return db[_0x14da('0x39')][_0x14da('0x59')]({'where':{'id':_0x35e121[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x3808c6,null))[_0x14da('0x1e')](function(_0x1dc648){if(_0x1dc648){return _0x1dc648['addContacts'](_0x35e121['body'][_0x14da('0x5f')],_[_0x14da('0x60')](_0x35e121[_0x14da('0x5d')],[_0x14da('0x5f'),'id'])||{});}})[_0x14da('0x1e')](respondWithResult(_0x3808c6,null))['catch'](handleError(_0x3808c6,null));};function validateUser(_0x2a8bef){return new Promise(function(_0x21f075,_0x314f44){if(_0x2a8bef[_0x14da('0x61')])return _0x21f075(_0x2a8bef);return db[_0x14da('0x62')]['findById'](0x1)[_0x14da('0x1e')](function(_0x443871){if(_0x443871[_0x14da('0x63')])authService['validatePasswordPattern'](_0x2a8bef['password']);db[_0x14da('0x39')]['max']('internal')[_0x14da('0x1e')](function(_0x31cf0b){if(_[_0x14da('0x64')](_0x31cf0b)){_0x2a8bef[_0x14da('0x61')]=_0x443871[_0x14da('0x65')]||0x1;return;}if(_[_0x14da('0x64')](_0x443871[_0x14da('0x65')])||_0x443871['min_internal']===_0x31cf0b){_0x2a8bef[_0x14da('0x61')]=_0x31cf0b+0x1;return;}if(_0x443871['min_internal']>_0x31cf0b){_0x2a8bef[_0x14da('0x61')]=_0x443871[_0x14da('0x65')];return;}return db['sequelize'][_0x14da('0x45')](_0x14da('0x66'),{'type':db[_0x14da('0x67')][_0x14da('0x68')][_0x14da('0x69')]})[_0x14da('0x1e')](function(_0x482d72){if(_0x482d72&&_0x482d72[_0x14da('0x4f')]){for(var _0x304347=0x0,_0x53ed2f=_0x482d72[_0x14da('0x4f')];_0x304347<_0x53ed2f&&_[_0x14da('0x64')](_0x2a8bef[_0x14da('0x61')]);_0x304347++){if(_0x443871[_0x14da('0x65')]<=_0x482d72[_0x304347][_0x14da('0x6a')]){_0x2a8bef[_0x14da('0x61')]=_0x482d72[_0x304347][_0x14da('0x6a')];}else if(_0x443871[_0x14da('0x65')]>_0x482d72[_0x304347][_0x14da('0x6a')]&&_0x443871[_0x14da('0x65')]<=_0x482d72[_0x304347]['to']){_0x2a8bef[_0x14da('0x61')]=_0x443871['min_internal'];}}}if(_[_0x14da('0x64')](_0x2a8bef[_0x14da('0x61')])){_0x2a8bef['internal']=_0x31cf0b+0x1;}return _0x21f075(_0x2a8bef);});});})[_0x14da('0x28')](function(_0x561ffb){_0x314f44(_0x561ffb);});});}function updateUser(_0x5b5794){return new Promise(function(_0x20eb01,_0x2bb2aa){try{if(_0x5b5794[_0x14da('0x6b')]){_0x5b5794[_0x14da('0x6c')]=_0x5b5794[_0x14da('0x61')];_0x5b5794[_0x14da('0x6d')]={'mailbox':_0x5b5794[_0x14da('0x61')],'password':_0x5b5794[_0x14da('0x3e')],'fullname':_0x5b5794[_0x14da('0x6e')],'email':_0x5b5794['email']};}if(_0x5b5794['role']===_0x14da('0x2b')){if(!_0x5b5794[_0x14da('0x6f')])_0x5b5794[_0x14da('0x6f')]=[_0x14da('0x70'),'102',_0x14da('0x71'),'113','110',_0x14da('0x72'),_0x14da('0x73'),_0x14da('0x74'),_0x14da('0x75'),_0x14da('0x76'),'109',_0x14da('0x77'),_0x14da('0x78'),_0x14da('0x79'),_0x14da('0x7a')];}_0x20eb01(_0x5b5794);}catch(_0x4fdd2a){_0x2bb2aa(_0x4fdd2a);}});}exports[_0x14da('0x7b')]=function(_0x4456fc,_0x4bb2b8){if(_0x4456fc['user'][_0x14da('0x2a')]===_0x14da('0x2b'))throw new Error('Unauthorized');if(_0x4456fc['body'][_0x14da('0x2a')]===_0x14da('0x7c')&&_0x4456fc[_0x14da('0x7c')][_0x14da('0x2a')]!==_0x14da('0x2d')){throw new Error(_0x14da('0x7d'));}if(_0x4456fc[_0x14da('0x5d')][_0x14da('0x2a')]===_0x14da('0x2d')&&_0x4456fc['user'][_0x14da('0x2a')]!==_0x14da('0x2d')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x14da('0x7e')]([_0x4456fc[_0x14da('0x5d')]])[_0x14da('0x1e')](function(){return validateUser(_0x4456fc[_0x14da('0x5d')]);})[_0x14da('0x1e')](function(_0xf6ae99){return updateUser(_0xf6ae99)['then'](function(_0x263dd){if(_0x263dd['role']===_0x14da('0x2d')){_0x263dd[_0x14da('0x7f')]=_0x4456fc[_0x14da('0x7c')][_0x14da('0x7f')];delete _0x263dd[_0x14da('0x80')];}return _0x263dd;});})['then'](function(_0x4c62a7){return db['User'][_0x14da('0x7b')](_0x4c62a7,{'include':[{'model':db[_0x14da('0x6d')],'as':_0x14da('0x6d')}]});})[_0x14da('0x1e')](function(_0x528c59){if(_0x4456fc['body'][_0x14da('0x2a')]==='user')return _0x528c59;if(_0x4456fc[_0x14da('0x7c')][_0x14da('0x2a')]!==_0x14da('0x7c'))return _0x528c59;return db['UserProfileSection']['find']({'where':{'name':_0x528c59[_0x14da('0x2a')]===_0x14da('0x2b')?_0x14da('0x81'):'Telephones','userProfileId':_0x4456fc[_0x14da('0x7c')][_0x14da('0x80')]},'raw':!![]})[_0x14da('0x1e')](function(_0x59d541){if(!_0x59d541||_0x59d541[_0x14da('0x82')]!=0x0)return _0x528c59;return db[_0x14da('0x36')][_0x14da('0x7b')]({'name':_0x528c59['name'],'resourceId':_0x528c59['id'],'type':_0x59d541[_0x14da('0x35')],'sectionId':_0x59d541['id']},{})[_0x14da('0x1e')](function(){return _0x528c59;});})[_0x14da('0x28')](function(_0x12d4bf){logger[_0x14da('0x24')](_0x14da('0x83'),_0x12d4bf);throw _0x12d4bf;});})['then'](respondWithResult(_0x4bb2b8,0xc9))[_0x14da('0x28')](handleError(_0x4bb2b8,null));};exports[_0x14da('0x84')]=function(_0x2725f8,_0x4a8512){var _0x5dcc2e=_0x2725f8[_0x14da('0x5d')];var _0x355812=[];if(_0x2725f8['user'][_0x14da('0x2a')]===_0x14da('0x2b'))throw new Error(_0x14da('0x85'));if(_[_0x14da('0x86')](_0x5dcc2e,['role',_0x14da('0x7c')])&&_0x2725f8['user']['role']!==_0x14da('0x2d')){throw new Error(_0x14da('0x7d'));}if(_[_0x14da('0x86')](_0x5dcc2e,[_0x14da('0x2a'),_0x14da('0x2d')])&&_0x2725f8[_0x14da('0x7c')][_0x14da('0x2a')]!==_0x14da('0x2d')){throw new Error(_0x14da('0x87'));}return licenseUtil[_0x14da('0x7e')](_0x5dcc2e)[_0x14da('0x1e')](function(){return validateUser(_0x5dcc2e[0x0]);})[_0x14da('0x1e')](function(){for(var _0x534970=0x1;_0x534970<_0x5dcc2e[_0x14da('0x4f')];_0x534970++){var _0x396f45=_0x5dcc2e[_0x534970-0x1][_0x14da('0x61')];if(!_0x5dcc2e[_0x534970][_0x14da('0x61')])_0x5dcc2e[_0x534970][_0x14da('0x61')]=_0x396f45+0x1;_0x355812[_0x14da('0x4c')](validateUser(_0x5dcc2e[_0x534970]));}return Promise[_0x14da('0x54')](_0x355812);})[_0x14da('0x1e')](function(){_0x355812=[];for(var _0x465a9a=0x0;_0x465a9a<_0x5dcc2e[_0x14da('0x4f')];_0x465a9a++){_0x355812[_0x14da('0x4c')](updateUser(_0x5dcc2e[_0x465a9a]));}return Promise[_0x14da('0x54')](_0x355812);})[_0x14da('0x1e')](function(){_0x355812=_0x5dcc2e[_0x14da('0x32')](function(_0x33a4e6){return db[_0x14da('0x39')]['create'](_0x33a4e6,{'include':[{'model':db['VoiceMail'],'as':_0x14da('0x6d')}]})[_0x14da('0x1e')](function(_0x95bfc){_0x33a4e6['id']=_0x95bfc['id'];return _0x33a4e6;});});return Promise[_0x14da('0x54')](_0x355812);})[_0x14da('0x1e')](function(_0x5a3d01){if(_0x2725f8[_0x14da('0x5d')]['role']===_0x14da('0x7c'))return _0x5a3d01;if(_0x2725f8[_0x14da('0x7c')][_0x14da('0x2a')]!==_0x14da('0x7c'))return _0x5a3d01;var _0x44fd0f=_[_0x14da('0x86')](_0x5a3d01,function(_0x1fda27){return _0x1fda27[_0x14da('0x2a')]==='agent'||_0x1fda27[_0x14da('0x2a')]===_0x14da('0x30');});if(!_0x44fd0f)return _0x5a3d01;return db['UserProfileSection'][_0x14da('0x88')]({'where':{'name':{'$or':[_0x14da('0x81'),'Telephones']},'userProfileId':_0x2725f8[_0x14da('0x7c')][_0x14da('0x80')]},'raw':!![]})[_0x14da('0x1e')](function(_0x10d356){if(_[_0x14da('0x89')](_0x10d356)||!_[_0x14da('0x86')](_0x10d356,[_0x14da('0x82'),0x0]))return _0x5a3d01;_0x355812=[];var _0x14d2b2=_(_0x10d356)[_0x14da('0x32')](function(_0x19db99){if(_0x19db99[_0x14da('0x82')]===0x1)return;return _0x19db99[_0x14da('0x35')]===_0x14da('0x81')?'agent':_0x14da('0x30');})['compact']()[_0x14da('0x33')]();for(var _0x248e45=0x0;_0x248e45<_0x5a3d01[_0x14da('0x4f')];_0x248e45++){if(!_[_0x14da('0x34')](_0x14d2b2,_0x5a3d01[_0x248e45][_0x14da('0x2a')]))return;var _0x4cad3a=_0x5a3d01[_0x248e45][_0x14da('0x2a')]===_0x14da('0x2b')?_0x14da('0x81'):_0x14da('0x2f');_0x355812[_0x14da('0x4c')](db[_0x14da('0x36')][_0x14da('0x7b')]({'name':_0x5a3d01[_0x248e45][_0x14da('0x35')],'resourceId':_0x5a3d01[_0x248e45]['id'],'type':_0x4cad3a,'sectionId':_[_0x14da('0x59')](_0x10d356,[_0x14da('0x35'),_0x4cad3a])['id']},{}));}return Promise['all'](_0x355812);});})[_0x14da('0x1e')](respondWithResult(_0x4a8512,0xc9))['catch'](handleError(_0x4a8512,null));};exports[_0x14da('0x8a')]=function(_0x5a8377,_0x5accb8){if(_0x5a8377['body']['id']){delete _0x5a8377[_0x14da('0x5d')]['id'];}return db[_0x14da('0x39')][_0x14da('0x59')]({'where':{'id':_0x5a8377['params']['id']}})[_0x14da('0x1e')](function(_0x4277d4){if(!_0x4277d4)return null;if(_0x4277d4['id']===_0x5a8377[_0x14da('0x7c')]['id']){if(!_0x5a8377[_0x14da('0x5d')][_0x14da('0x8b')]||!_0x5a8377[_0x14da('0x5d')][_0x14da('0x8c')]){throw new db['Sequelize'][(_0x14da('0x8d'))](_0x14da('0x8e'));}if(!_0x4277d4[_0x14da('0x8f')](_0x5a8377[_0x14da('0x5d')]['oldPassword'])){throw new db[(_0x14da('0x90'))][(_0x14da('0x8d'))](_0x14da('0x91'));}if(_0x5a8377['body'][_0x14da('0x8b')]===_0x5a8377[_0x14da('0x5d')][_0x14da('0x8c')]){throw new db[(_0x14da('0x90'))][(_0x14da('0x8d'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x5a8377[_0x14da('0x7c')][_0x14da('0x2a')]===_0x14da('0x2d')){if(!_0x5a8377[_0x14da('0x5d')][_0x14da('0x8c')]){throw new db[(_0x14da('0x90'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x5a8377['user'][_0x14da('0x2a')]===_0x14da('0x7c')){if(!_0x5a8377[_0x14da('0x5d')][_0x14da('0x8c')]){throw new db[(_0x14da('0x90'))]['ValidationError'](_0x14da('0x92'));}if(_0x4277d4['role']!==_0x14da('0x2b')){throw new db[(_0x14da('0x90'))]['ValidationError'](_0x14da('0x85'));}}else{throw new db[(_0x14da('0x90'))][(_0x14da('0x8d'))]('Unauthorized');}return _0x4277d4;})[_0x14da('0x1e')](handleEntityNotFound(_0x5accb8,null))[_0x14da('0x1e')](function(_0x4378e9){return db[_0x14da('0x62')]['findOne']({'attributes':['id',_0x14da('0x63'),_0x14da('0x93'),'passwordHistoryLimit']})['then'](function(_0x5a701f){if(_0x5a701f['securePassword'])authService[_0x14da('0x94')](_0x5a8377['body'][_0x14da('0x8c')]);if(!_0x5a701f[_0x14da('0x93')]||!_0x4378e9['previousPasswords'])return _0x4378e9;authService[_0x14da('0x95')](_0x5a8377[_0x14da('0x5d')][_0x14da('0x8c')],_0x4378e9[_0x14da('0x40')],_0x5a701f['passwordHistoryLimit']);return _0x4378e9;})[_0x14da('0x1e')](saveUpdates({'password':_0x5a8377[_0x14da('0x5d')][_0x14da('0x8c')],'passwordResetAt':_0x5a8377[_0x14da('0x7c')]['id']==_0x5a8377[_0x14da('0x56')]['id']?moment():null,'previousPasswords':authService[_0x14da('0x96')](_0x5a8377[_0x14da('0x5d')][_0x14da('0x8c')],_0x4378e9[_0x14da('0x40')])},null));})[_0x14da('0x1e')](respondWithResult(_0x5accb8,null))[_0x14da('0x28')](handleError(_0x5accb8,null));};exports[_0x14da('0x97')]=function(_0x12b4f8,_0x51a6c2){var _0x3aca89=_0x12b4f8[_0x14da('0x5d')]['channel'];return db[_0x14da('0x39')][_0x14da('0x59')]({'where':{'id':_0x12b4f8[_0x14da('0x56')]['id']},'attributes':['id',_0x14da('0x35'),_0x14da('0x2a'),_0x14da('0x98'),_0x14da('0x99'),_0x14da('0x9a'),_0x14da('0x9b')]})['then'](handleEntityNotFound(_0x51a6c2,null))['then'](function(_0x64cd2d){if(_0x64cd2d){if(!utils[_0x14da('0x9c')](_0x3aca89)){throw new db[(_0x14da('0x90'))]['ValidationError'](_0x14da('0x9d'));}return _0x64cd2d[_0x14da('0x9e')+_[_0x14da('0x9f')](_0x3aca89[_0x14da('0xa0')]())+_0x14da('0xa1')](_0x12b4f8[_0x14da('0x5d')][_0x14da('0x5f')],{'penalty':_0x12b4f8[_0x14da('0x5d')][_0x14da('0xa2')]||0x0})[_0x14da('0xa3')](function(_0x2d50dd){for(var _0x47a37b=0x0;_0x47a37b<_0x12b4f8[_0x14da('0x5d')][_0x14da('0x5f')][_0x14da('0x4f')];_0x47a37b+=0x1){var _0x4124c8={'UserId':Number(_0x12b4f8[_0x14da('0x56')]['id'])};_0x4124c8[_['capitalize'](_0x3aca89['toLowerCase']())+_0x14da('0xa4')]=Number(_0x12b4f8[_0x14da('0x5d')][_0x14da('0x5f')][_0x47a37b]);socket[_0x14da('0xa5')](_0x14da('0x7c')+_[_0x14da('0x9f')](_0x3aca89[_0x14da('0xa0')]())+_0x14da('0xa6'),_0x4124c8);}return _0x2d50dd;})[_0x14da('0x1e')](function(){if(_0x3aca89===_0x14da('0xa7')){return db['VoiceQueue'][_0x14da('0x88')]({'where':{'id':_0x12b4f8[_0x14da('0x5d')][_0x14da('0x5f')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x14da('0x1e')](function(_0x80772e){var _0x5358db=_0x64cd2d[_0x14da('0xa8')]({'plain':!![]});var _0x17791e=[];if(_0x3aca89===_0x14da('0xa7')&&_0x5358db[_0x14da('0x2a')]==='agent'&&_0x5358db['online']){for(let _0x5ae657=0x0;_0x5ae657<_0x80772e['length'];_0x5ae657+=0x1){_0x17791e['push']({'membername':_0x5358db[_0x14da('0x35')],'UserId':_0x5358db['id'],'queue_name':_0x80772e[_0x5ae657][_0x14da('0x35')],'VoiceQueueId':_0x80772e[_0x5ae657]['id'],'interface':_[_0x14da('0x64')](_0x5358db[_0x14da('0x9b')])?util[_0x14da('0xa9')](_0x14da('0xaa'),_0x5358db[_0x14da('0x35')]):_0x5358db[_0x14da('0x9b')],'paused':_0x5358db[_0x14da('0x9a')]||![],'penalty':_0x12b4f8[_0x14da('0x5d')][_0x14da('0xa2')]||0x0});}return Promise['all'](_0x17791e[_0x14da('0x32')](function(_0x491e6e){return db[_0x14da('0xab')][_0x14da('0xac')](_0x491e6e);}));}return _0x64cd2d;});}})['then'](respondWithStatusCode(_0x51a6c2,null))['catch'](handleError(_0x51a6c2,null));};exports[_0x14da('0xad')]=function(_0x244ecb,_0x417fe5){var _0x6c81ec,_0xdb257a;return db['User'][_0x14da('0x59')]({'where':{'id':_0x244ecb[_0x14da('0x56')]['id']},'attributes':['id',_0x14da('0x35'),_0x14da('0x2a')]})[_0x14da('0x1e')](handleEntityNotFound(_0x417fe5,null))[_0x14da('0x1e')](function(_0x14132d){if(_0x14132d){_0x6c81ec=_0x14132d;if(!_0x244ecb[_0x14da('0x45')][_0x14da('0xae')]||!utils[_0x14da('0x9c')](_0x244ecb[_0x14da('0x45')]['channel'])){throw new db[(_0x14da('0x90'))]['ValidationError'](_0x14da('0x9d'));}return _0x14132d['remove'+_['capitalize'](_0x244ecb['query'][_0x14da('0xae')][_0x14da('0xa0')]())+_0x14da('0xa1')](_0x244ecb[_0x14da('0x45')][_0x14da('0x5f')]);}})[_0x14da('0x1e')](function(_0x168a47){if(_[_0x14da('0xaf')](_0x244ecb[_0x14da('0x45')]['ids'])){for(var _0x4d7332=0x0;_0x4d7332<_0x244ecb[_0x14da('0x45')]['ids'][_0x14da('0x4f')];_0x4d7332+=0x1){_0xdb257a={'UserId':Number(_0x244ecb[_0x14da('0x56')]['id'])};_0xdb257a[_[_0x14da('0x9f')](_0x244ecb[_0x14da('0x45')][_0x14da('0xae')][_0x14da('0xa0')]())+_0x14da('0xa4')]=Number(_0x244ecb[_0x14da('0x45')][_0x14da('0x5f')][_0x4d7332]);socket[_0x14da('0xa5')](_0x14da('0x7c')+_[_0x14da('0x9f')](_0x244ecb['query'][_0x14da('0xae')][_0x14da('0xa0')]())+_0x14da('0xb0'),_0xdb257a);}}else{_0xdb257a={'UserId':Number(_0x244ecb['params']['id'])};_0xdb257a[_[_0x14da('0x9f')](_0x244ecb[_0x14da('0x45')]['channel'][_0x14da('0xa0')]())+_0x14da('0xa4')]=Number(_0x244ecb[_0x14da('0x45')][_0x14da('0x5f')]);socket[_0x14da('0xa5')](_0x14da('0x7c')+_['capitalize'](_0x244ecb[_0x14da('0x45')]['channel'][_0x14da('0xa0')]())+'Queue:remove',_0xdb257a);}return _0x168a47;})['then'](function(){if(_0x244ecb['query'][_0x14da('0xae')]==='voice'){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x244ecb[_0x14da('0x56')]['id'],'VoiceQueueId':_0x244ecb[_0x14da('0x45')][_0x14da('0x5f')]},'individualHooks':!![]})['then'](function(){return _0x6c81ec;});}return _0x6c81ec;})[_0x14da('0x1e')](respondWithStatusCode(_0x417fe5,null))['catch'](handleError(_0x417fe5,null));};exports[_0x14da('0xb1')]=function(_0x392e51,_0x2ed5cb){_0x392e51[_0x14da('0x5d')][_0x14da('0xb2')]=_0x392e51[_0x14da('0xb3')][_0x14da('0xb4')];return db['User'][_0x14da('0x59')]({'where':{'id':_0x392e51['params']['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x2ed5cb,null))[_0x14da('0x1e')](saveUpdates(_0x392e51[_0x14da('0x5d')],null))[_0x14da('0x1e')](respondWithResult(_0x2ed5cb,null))[_0x14da('0x28')](handleError(_0x2ed5cb,null));};exports[_0x14da('0xb5')]=function(_0x2bef08,_0x4e2b72){var _0x16a550=path[_0x14da('0xb6')](config['root'],_0x14da('0xb7'));return db[_0x14da('0x39')][_0x14da('0x59')]({'where':{'id':_0x2bef08['params']['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x4e2b72,null))[_0x14da('0x1e')](function(_0x26c2b8){if(_0x26c2b8){if(_['isNil'](_0x26c2b8[_0x14da('0xb2')])){return _0x4e2b72[_0x14da('0xb8')](_0x16a550);}else{if(!fs[_0x14da('0xb9')](path[_0x14da('0xb6')](config[_0x14da('0xba')],_0x14da('0xbb'),_0x26c2b8[_0x14da('0xb2')]))){return _0x4e2b72[_0x14da('0xb8')](_0x16a550);}return _0x4e2b72[_0x14da('0xb8')](path[_0x14da('0xb6')](config['root'],_0x14da('0xbb'),_0x26c2b8[_0x14da('0xb2')]));}}})[_0x14da('0x28')](handleError(_0x4e2b72,null));};exports[_0x14da('0xbc')]=function(_0x894916,_0x5cdf7d){return db[_0x14da('0x39')][_0x14da('0x59')]({'where':{'id':_0x894916[_0x14da('0x56')]['id']},'attributes':['id']})[_0x14da('0x1e')](handleEntityNotFound(_0x5cdf7d,null))[_0x14da('0x1e')](function(_0x5bc6fe){var _0x3118f2=[];values=_0x5bc6fe[_0x14da('0x50')];_0x3118f2[_0x14da('0x4c')](get_open_tabs(_0x14da('0x5a'),_0x5bc6fe['dataValues']));_0x3118f2[_0x14da('0x4c')](get_open_tabs(_0x14da('0x5b'),_0x5bc6fe[_0x14da('0x50')]));_0x3118f2['push'](get_open_tabs('openchannel',_0x5bc6fe['dataValues']));_0x3118f2['push'](get_open_tabs(_0x14da('0x53'),_0x5bc6fe[_0x14da('0x50')]));_0x3118f2[_0x14da('0x4c')](get_open_tabs(_0x14da('0x51'),_0x5bc6fe[_0x14da('0x50')]));_0x3118f2['push'](get_open_tabs(_0x14da('0x5c'),_0x5bc6fe[_0x14da('0x50')]));return Promise[_0x14da('0x54')](_0x3118f2);})[_0x14da('0x1e')](function(_0x582f16){if(_0x582f16){var _0x7b4935=_['map'](values[_0x14da('0xbd')],function(_0x4e3c88){return{'channel':_0x14da('0xbe'),'id':_0x4e3c88['id'],'createdAt':_0x4e3c88['createdAt']};});var _0x42e202=_[_0x14da('0x32')](values[_0x14da('0xbf')],function(_0x90e1dc){return{'channel':'FAX','id':_0x90e1dc['id'],'createdAt':_0x90e1dc[_0x14da('0xc0')]};});var _0x51a5e5=_[_0x14da('0x32')](values[_0x14da('0xc1')],function(_0x3c3b6f){return{'channel':_0x14da('0xc2'),'id':_0x3c3b6f['id'],'createdAt':_0x3c3b6f[_0x14da('0xc0')]};});var _0x3d224c=_[_0x14da('0x32')](values['MailOpenTabs'],function(_0x58523d){return{'channel':_0x14da('0xc3'),'id':_0x58523d['id'],'createdAt':_0x58523d[_0x14da('0xc0')]};});var _0x423edf=_['map'](values[_0x14da('0xc4')],function(_0x542916){return{'channel':_0x14da('0xc5'),'id':_0x542916['id'],'createdAt':_0x542916[_0x14da('0xc0')]};});var _0x150015=_['map'](values[_0x14da('0xc6')],function(_0x2332ef){return{'channel':_0x14da('0xc7'),'id':_0x2332ef['id'],'createdAt':_0x2332ef[_0x14da('0xc0')]};});var _0x4f86cf=_[_0x14da('0xc8')](_0x7b4935,_0x42e202,_0x51a5e5,_0x3d224c,_0x423edf,_0x150015);var _0x24e66a={'count':_0x4f86cf[_0x14da('0x4f')],'rows':_0x4f86cf};return _0x24e66a;}else return null;})[_0x14da('0x1e')](respondWithResult(_0x5cdf7d,null))[_0x14da('0x28')](handleError(_0x5cdf7d,null));};exports[_0x14da('0xc9')]=function(_0x6c630,_0x377a84){var _0x45aa05={};return db['User']['findOne']({'where':{'id':_0x6c630[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](function(_0x3e31aa){if(!_0x3e31aa){throw new APINotFoundError(util[_0x14da('0xa9')](_0x14da('0xca'),_0x6c630[_0x14da('0x56')]['id']));}return contacts[_0x14da('0x5e')]();})[_0x14da('0x1e')](function(_0x16d02f){_0x6c630['query'][_0x14da('0x39')]=_0x6c630[_0x14da('0x56')]['id'];_0x45aa05=qs['getOptions'](_0x16d02f,_0x6c630);if(_0x6c630[_0x14da('0x45')][_0x14da('0xcb')]('includeAll')){_0x45aa05[_0x14da('0x47')]=[{'model':db[_0x14da('0xcc')],'as':'List','required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x14da('0x35'),'color'],'where':_0x6c630[_0x14da('0x45')]['tag']?{'id':_0x6c630[_0x14da('0x45')][_0x14da('0xcd')]}:undefined,'required':_0x6c630[_0x14da('0x45')][_0x14da('0xcd')]?!![]:![]}];}return contacts[_0x14da('0x88')](_0x6c630['query'],_0x6c630['user'],_0x45aa05,_0x16d02f);})['then'](respondWithFilteredResult(_0x377a84,_0x45aa05))[_0x14da('0x28')](APIHandleError(_0x377a84));};exports[_0x14da('0xce')]=function(_0x4fa21d,_0x462b1e){var _0x37c408;var _0x17dba0={};var _0x2fd5d7;return db[_0x14da('0x39')]['findOne']({'where':{'id':_0x4fa21d[_0x14da('0x56')]['id']},'attributes':['id',_0x14da('0x35'),_0x14da('0x2a')]})['then'](handleEntityNotFound(_0x462b1e,null))['then'](function(_0x4aae5f){if(!utils[_0x14da('0x9c')](_0x4fa21d[_0x14da('0x45')][_0x14da('0xae')])){throw new db['Sequelize'][(_0x14da('0x8d'))]('Unknown\x20channel');}_0x37c408=_0x4aae5f;var _0x8d718c={};_0x8d718c[_0x14da('0xcf')]=_[_0x14da('0xd0')](db[_[_0x14da('0x9f')](_0x4fa21d[_0x14da('0x45')][_0x14da('0xae')])+_0x14da('0xd1')]['rawAttributes']);_0x8d718c[_0x14da('0x45')]=_[_0x14da('0xd0')](_0x4fa21d[_0x14da('0x45')]);_0x8d718c[_0x14da('0xd2')]=_[_0x14da('0xd3')](_0x8d718c['model'],_0x8d718c[_0x14da('0x45')]);_0x17dba0['attributes']=_[_0x14da('0xd3')](_0x8d718c[_0x14da('0xcf')],qs['fields'](_0x4fa21d[_0x14da('0x45')]['fields']));_0x17dba0['attributes']=_0x17dba0['attributes']['length']?_0x17dba0[_0x14da('0x4b')]:_0x8d718c[_0x14da('0xcf')];_0x17dba0['order']=qs[_0x14da('0xd4')](_0x4fa21d[_0x14da('0x45')]['sort']);_0x17dba0[_0x14da('0x44')]=qs['filters'](_[_0x14da('0xd5')](_0x4fa21d[_0x14da('0x45')],_0x8d718c[_0x14da('0xd2')]));if(_0x4fa21d['query']['filter']){_0x17dba0[_0x14da('0x44')]=_[_0x14da('0x58')](_0x17dba0[_0x14da('0x44')],{'$or':_[_0x14da('0x32')](_0x17dba0[_0x14da('0x4b')],function(_0x297d16){var _0x518886={};_0x518886[_0x297d16]={'$like':'%'+_0x4fa21d[_0x14da('0x45')]['filter']+'%'};return _0x518886;})});}_0x17dba0=_['merge']({},_0x17dba0,_0x4fa21d[_0x14da('0xd6')]);switch(_0x37c408['role']){case _0x14da('0x2d'):return db[_[_0x14da('0x9f')](_0x4fa21d[_0x14da('0x45')][_0x14da('0xae')])+'Queue']['findAll'](_0x17dba0);case _0x14da('0x7c'):case _0x14da('0x2b'):return _0x37c408[_0x14da('0xa8')+_[_0x14da('0x9f')](_0x4fa21d['query'][_0x14da('0xae')])+_0x14da('0xa1')](_0x17dba0);default:throw new db[(_0x14da('0x90'))][(_0x14da('0x8d'))]('Unknown\x20role');}})[_0x14da('0x1e')](function(_0x163263){_0x2fd5d7=_0x163263[_0x14da('0x4f')];if(!_0x4fa21d[_0x14da('0x45')][_0x14da('0xcb')](_0x14da('0xd7'))){_0x17dba0[_0x14da('0x1b')]=qs[_0x14da('0x1b')](_0x4fa21d[_0x14da('0x45')]['limit']);_0x17dba0[_0x14da('0xd8')]=qs[_0x14da('0xd8')](_0x4fa21d[_0x14da('0x45')]['offset']);}switch(_0x37c408[_0x14da('0x2a')]){case _0x14da('0x2d'):return db[_[_0x14da('0x9f')](_0x4fa21d[_0x14da('0x45')][_0x14da('0xae')])+_0x14da('0xd1')][_0x14da('0x88')](_0x17dba0);case _0x14da('0x7c'):case _0x14da('0x2b'):return _0x37c408[_0x14da('0xa8')+_[_0x14da('0x9f')](_0x4fa21d[_0x14da('0x45')][_0x14da('0xae')])+_0x14da('0xa1')](_0x17dba0);}})[_0x14da('0x1e')](function(_0x58d42d){return{'count':_0x2fd5d7,'rows':_0x58d42d};})[_0x14da('0x1e')](respondWithResult(_0x462b1e,null))['catch'](handleError(_0x462b1e,null));};exports[_0x14da('0xd9')]=function(_0x16bad1,_0x20bb4d){var _0x4bde8e={};var _0x5e232e={};var _0x316a8a;var _0xd20dba;return db['User']['findOne']({'where':{'id':_0x16bad1[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x20bb4d,null))[_0x14da('0x1e')](function(_0x2a9df4){if(_0x2a9df4){_0x316a8a=_0x2a9df4;_0x5e232e[_0x14da('0xcf')]=_[_0x14da('0xd0')](db[_0x14da('0xab')]['rawAttributes']);_0x5e232e[_0x14da('0x45')]=_['keys'](_0x16bad1[_0x14da('0x45')]);_0x5e232e[_0x14da('0xd2')]=_[_0x14da('0xd3')](_0x5e232e[_0x14da('0xcf')],_0x5e232e[_0x14da('0x45')]);_0x4bde8e['attributes']=_[_0x14da('0xd3')](_0x5e232e[_0x14da('0xcf')],qs[_0x14da('0xda')](_0x16bad1[_0x14da('0x45')][_0x14da('0xda')]));_0x4bde8e[_0x14da('0x4b')]=_0x4bde8e['attributes'][_0x14da('0x4f')]?_0x4bde8e[_0x14da('0x4b')]:_0x5e232e[_0x14da('0xcf')];_0x4bde8e['order']=qs[_0x14da('0xd4')](_0x16bad1[_0x14da('0x45')][_0x14da('0xd4')]);_0x4bde8e[_0x14da('0x44')]=qs['filters'](_[_0x14da('0xd5')](_0x16bad1['query'],_0x5e232e[_0x14da('0xd2')]));if(_0x16bad1[_0x14da('0x45')]['filter']){_0x4bde8e['where']=_[_0x14da('0x58')](_0x4bde8e[_0x14da('0x44')],{'$or':_[_0x14da('0x32')](_0x4bde8e['attributes'],function(_0x559c23){var _0x2ac260={};_0x2ac260[_0x559c23]={'$like':'%'+_0x16bad1[_0x14da('0x45')][_0x14da('0x3d')]+'%'};return _0x2ac260;})});}_0x4bde8e=_[_0x14da('0x58')]({},_0x4bde8e,_0x16bad1[_0x14da('0xd6')]);return _0x316a8a['getVoiceQueuesRt'](_0x4bde8e);}})[_0x14da('0x1e')](function(_0x1efb7c){if(_0x1efb7c){_0xd20dba=_0x1efb7c[_0x14da('0x4f')];if(!_0x16bad1[_0x14da('0x45')]['hasOwnProperty']('nolimit')){_0x4bde8e[_0x14da('0x1b')]=qs[_0x14da('0x1b')](_0x16bad1[_0x14da('0x45')][_0x14da('0x1b')]);_0x4bde8e[_0x14da('0xd8')]=qs['offset'](_0x16bad1['query'][_0x14da('0xd8')]);}return _0x316a8a[_0x14da('0xd9')](_0x4bde8e);}})[_0x14da('0x1e')](function(_0x5b173f){if(_0x5b173f){return _0x5b173f?{'count':_0xd20dba,'rows':_0x5b173f}:null;}})[_0x14da('0x1e')](respondWithResult(_0x20bb4d,null))[_0x14da('0x28')](handleError(_0x20bb4d,null));};exports[_0x14da('0xdb')]=function(_0x817111,_0x3730fb){var _0x4bfad9={};var _0x317449={};var _0x5b9855;var _0x5155a5;return db['User'][_0x14da('0xdc')]({'where':{'id':_0x817111['params']['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x3730fb,null))[_0x14da('0x1e')](function(_0x459167){if(_0x459167){_0x5b9855=_0x459167;_0x317449[_0x14da('0xcf')]=_['keys'](db[_0x14da('0xdd')][_0x14da('0x3a')]);_0x317449[_0x14da('0x45')]=_[_0x14da('0xd0')](_0x817111[_0x14da('0x45')]);_0x317449[_0x14da('0xd2')]=_['intersection'](_0x317449[_0x14da('0xcf')],_0x317449[_0x14da('0x45')]);_0x4bfad9[_0x14da('0x4b')]=_[_0x14da('0xd3')](_0x317449[_0x14da('0xcf')],qs[_0x14da('0xda')](_0x817111[_0x14da('0x45')][_0x14da('0xda')]));_0x4bfad9[_0x14da('0x4b')]=_0x4bfad9[_0x14da('0x4b')][_0x14da('0x4f')]?_0x4bfad9[_0x14da('0x4b')]:_0x317449[_0x14da('0xcf')];_0x4bfad9['order']=qs['sort'](_0x817111[_0x14da('0x45')][_0x14da('0xd4')]);_0x4bfad9[_0x14da('0x44')]=qs['filters'](_[_0x14da('0xd5')](_0x817111[_0x14da('0x45')],_0x317449[_0x14da('0xd2')]));if(_0x817111[_0x14da('0x45')]['filter']){_0x4bfad9[_0x14da('0x44')]=_[_0x14da('0x58')](_0x4bfad9[_0x14da('0x44')],{'$or':_[_0x14da('0x32')](_0x4bfad9[_0x14da('0x4b')],function(_0x48ac7a){var _0x3d1a27={};_0x3d1a27[_0x48ac7a]={'$like':'%'+_0x817111[_0x14da('0x45')]['filter']+'%'};return _0x3d1a27;})});}_0x4bfad9=_[_0x14da('0x58')]({},_0x4bfad9,_0x817111[_0x14da('0xd6')]);return _0x5b9855['getGroups'](_0x4bfad9);}})[_0x14da('0x1e')](function(_0x13c91a){if(_0x13c91a){_0x5155a5=_0x13c91a[_0x14da('0x4f')];if(!_0x817111[_0x14da('0x45')][_0x14da('0xcb')](_0x14da('0xd7'))){_0x4bfad9[_0x14da('0x1b')]=qs[_0x14da('0x1b')](_0x817111['query'][_0x14da('0x1b')]);_0x4bfad9[_0x14da('0xd8')]=qs[_0x14da('0xd8')](_0x817111['query'][_0x14da('0xd8')]);}return _0x5b9855[_0x14da('0xdb')](_0x4bfad9);}})[_0x14da('0x1e')](function(_0x3e3a63){if(_0x3e3a63){return _0x3e3a63?{'count':_0x5155a5,'rows':_0x3e3a63}:null;}})['then'](respondWithResult(_0x3730fb,null))['catch'](handleError(_0x3730fb,null));};exports[_0x14da('0xde')]=function(_0x286c63,_0x45886f){var _0xb7315a={'raw':!![],'where':{}};var _0x4f04c1={};var _0x1caa0d={'count':0x0,'rows':[]};return db[_0x14da('0x39')]['findOne']({'where':{'id':_0x286c63[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x45886f,null))[_0x14da('0x1e')](function(_0x29a4f6){if(_0x29a4f6){_0x4f04c1['model']=_['keys'](db[_0x14da('0xdf')]['rawAttributes']);_0x4f04c1[_0x14da('0x45')]=_[_0x14da('0xd0')](_0x286c63[_0x14da('0x45')]);_0x4f04c1[_0x14da('0xd2')]=_[_0x14da('0xd3')](_0x4f04c1[_0x14da('0xcf')],_0x4f04c1['query']);_0xb7315a['attributes']=_[_0x14da('0xd3')](_0x4f04c1[_0x14da('0xcf')],qs['fields'](_0x286c63[_0x14da('0x45')][_0x14da('0xda')]));_0xb7315a['attributes']=_0xb7315a[_0x14da('0x4b')]['length']?_0xb7315a['attributes']:_0x4f04c1[_0x14da('0xcf')];if(!_0x286c63[_0x14da('0x45')]['hasOwnProperty'](_0x14da('0xd7'))){_0xb7315a['limit']=qs['limit'](_0x286c63[_0x14da('0x45')]['limit']);_0xb7315a[_0x14da('0xd8')]=qs[_0x14da('0xd8')](_0x286c63[_0x14da('0x45')][_0x14da('0xd8')]);}_0xb7315a[_0x14da('0xe0')]=qs[_0x14da('0xd4')](_0x286c63[_0x14da('0x45')][_0x14da('0xd4')]);_0xb7315a[_0x14da('0x44')]=qs['filters'](_['pick'](_0x286c63[_0x14da('0x45')],_0x4f04c1[_0x14da('0xd2')]));_0xb7315a[_0x14da('0x44')][_0x14da('0xe1')]=_0x29a4f6['id'];if(_0x286c63[_0x14da('0x45')][_0x14da('0x3d')]){_0xb7315a['where']=_[_0x14da('0x58')](_0xb7315a[_0x14da('0x44')],{'$or':_['map'](_0xb7315a[_0x14da('0x4b')],function(_0xdb2915){var _0x6c5caf={};_0x6c5caf[_0xdb2915]={'$like':'%'+_0x286c63[_0x14da('0x45')]['filter']+'%'};return _0x6c5caf;})});}_0xb7315a=_['merge']({},_0xb7315a,_0x286c63[_0x14da('0xd6')]);return db['VoiceRecording']['count']({'where':_0xb7315a[_0x14da('0x44')]})[_0x14da('0x1e')](function(_0x17267f){_0x1caa0d[_0x14da('0x1a')]=_0x17267f;if(_0x286c63[_0x14da('0x45')][_0x14da('0x46')]){_0xb7315a[_0x14da('0x47')]=[{'all':!![]}];}return db[_0x14da('0xdf')]['findAll'](_0xb7315a);})['then'](function(_0x2bedb3){_0x1caa0d[_0x14da('0x4e')]=_0x2bedb3;return _0x1caa0d;});}})[_0x14da('0x1e')](respondWithFilteredResult(_0x45886f,_0xb7315a))['catch'](handleError(_0x45886f,null));};exports[_0x14da('0xe2')]=function(_0x113bed,_0x57b297){var _0x3be773={'raw':!![],'where':{}};var _0x3f6c24={};var _0x3a28d5={'count':0x0,'rows':[]};return db[_0x14da('0x39')][_0x14da('0xdc')]({'where':{'id':_0x113bed['params']['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x57b297,null))[_0x14da('0x1e')](function(_0x14487e){if(_0x14487e){_0x3f6c24['model']=_[_0x14da('0xd0')](db['ScreenRecording'][_0x14da('0x3a')]);_0x3f6c24['query']=_[_0x14da('0xd0')](_0x113bed[_0x14da('0x45')]);_0x3f6c24[_0x14da('0xd2')]=_[_0x14da('0xd3')](_0x3f6c24['model'],_0x3f6c24[_0x14da('0x45')]);_0x3be773[_0x14da('0x4b')]=_['intersection'](_0x3f6c24[_0x14da('0xcf')],qs['fields'](_0x113bed[_0x14da('0x45')][_0x14da('0xda')]));_0x3be773[_0x14da('0x4b')]=_0x3be773['attributes'][_0x14da('0x4f')]?_0x3be773[_0x14da('0x4b')]:_0x3f6c24[_0x14da('0xcf')];if(!_0x113bed['query'][_0x14da('0xcb')](_0x14da('0xd7'))){_0x3be773['limit']=qs[_0x14da('0x1b')](_0x113bed[_0x14da('0x45')]['limit']);_0x3be773[_0x14da('0xd8')]=qs[_0x14da('0xd8')](_0x113bed['query'][_0x14da('0xd8')]);}_0x3be773[_0x14da('0xe0')]=qs[_0x14da('0xd4')](_0x113bed[_0x14da('0x45')][_0x14da('0xd4')]);_0x3be773[_0x14da('0x44')]=qs[_0x14da('0xd2')](_[_0x14da('0xd5')](_0x113bed['query'],_0x3f6c24[_0x14da('0xd2')]));_0x3be773[_0x14da('0x44')][_0x14da('0xe1')]=_0x14487e['id'];if(_0x113bed[_0x14da('0x45')][_0x14da('0x3d')]){_0x3be773[_0x14da('0x44')]=_[_0x14da('0x58')](_0x3be773[_0x14da('0x44')],{'$or':_[_0x14da('0x32')](_0x3be773[_0x14da('0x4b')],function(_0x10fcf0){var _0x2942d4={};_0x2942d4[_0x10fcf0]={'$like':'%'+_0x113bed['query'][_0x14da('0x3d')]+'%'};return _0x2942d4;})});}_0x3be773=_[_0x14da('0x58')]({},_0x3be773,_0x113bed['options']);return db['ScreenRecording'][_0x14da('0x1a')]({'where':_0x3be773[_0x14da('0x44')]})[_0x14da('0x1e')](function(_0x57eec6){_0x3a28d5[_0x14da('0x1a')]=_0x57eec6;if(_0x113bed['query'][_0x14da('0x46')]){_0x3be773['include']=[{'all':!![]}];}return db[_0x14da('0xe3')][_0x14da('0x88')](_0x3be773);})[_0x14da('0x1e')](function(_0x384d91){_0x3a28d5['rows']=_0x384d91;return _0x3a28d5;});}})[_0x14da('0x1e')](respondWithFilteredResult(_0x57b297,_0x3be773))[_0x14da('0x28')](handleError(_0x57b297,null));};exports[_0x14da('0xe4')]=function(_0x1da6e7,_0x4950d7){var _0x52c4bc={};var _0x1e5a14={};var _0x4abb32;var _0x588e55;return db['User'][_0x14da('0xdc')]({'where':{'id':_0x1da6e7[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x4950d7,null))[_0x14da('0x1e')](function(_0x40f444){if(_0x40f444){_0x4abb32=_0x40f444;_0x1e5a14[_0x14da('0xcf')]=_[_0x14da('0xd0')](db[_0x14da('0xe5')]['rawAttributes']);_0x1e5a14['query']=_[_0x14da('0xd0')](_0x1da6e7['query']);_0x1e5a14[_0x14da('0xd2')]=_[_0x14da('0xd3')](_0x1e5a14[_0x14da('0xcf')],_0x1e5a14[_0x14da('0x45')]);_0x52c4bc['attributes']=_[_0x14da('0xd3')](_0x1e5a14[_0x14da('0xcf')],qs[_0x14da('0xda')](_0x1da6e7[_0x14da('0x45')][_0x14da('0xda')]));_0x52c4bc[_0x14da('0x4b')]=_0x52c4bc[_0x14da('0x4b')]['length']?_0x52c4bc[_0x14da('0x4b')]:_0x1e5a14['model'];_0x52c4bc[_0x14da('0xe0')]=qs[_0x14da('0xd4')](_0x1da6e7[_0x14da('0x45')]['sort']);_0x52c4bc['where']=qs['filters'](_[_0x14da('0xd5')](_0x1da6e7[_0x14da('0x45')],_0x1e5a14[_0x14da('0xd2')]));if(_0x1da6e7[_0x14da('0x45')][_0x14da('0x3d')]){_0x52c4bc[_0x14da('0x44')]=_['merge'](_0x52c4bc[_0x14da('0x44')],{'$or':_[_0x14da('0x32')](_0x52c4bc[_0x14da('0x4b')],function(_0xecc9e5){var _0x131d2b={};_0x131d2b[_0xecc9e5]={'$like':'%'+_0x1da6e7['query'][_0x14da('0x3d')]+'%'};return _0x131d2b;})});}_0x52c4bc=_[_0x14da('0x58')]({},_0x52c4bc,_0x1da6e7[_0x14da('0xd6')]);return _0x4abb32[_0x14da('0xe4')](_0x52c4bc);}})['then'](function(_0x55605b){if(_0x55605b){_0x588e55=_0x55605b[_0x14da('0x4f')];if(!_0x1da6e7['query']['hasOwnProperty'](_0x14da('0xd7'))){_0x52c4bc[_0x14da('0x1b')]=qs[_0x14da('0x1b')](_0x1da6e7[_0x14da('0x45')][_0x14da('0x1b')]);_0x52c4bc[_0x14da('0xd8')]=qs[_0x14da('0xd8')](_0x1da6e7[_0x14da('0x45')][_0x14da('0xd8')]);}return _0x4abb32['getChatInteractions'](_0x52c4bc);}})['then'](function(_0x13dfa9){if(_0x13dfa9){return _0x13dfa9?{'count':_0x588e55,'rows':_0x13dfa9}:null;}})[_0x14da('0x1e')](respondWithResult(_0x4950d7,null))[_0x14da('0x28')](handleError(_0x4950d7,null));};exports[_0x14da('0xe6')]=function(_0x561e95,_0x204314){var _0x162708={};var _0x40bcbb={};var _0x10c7de;var _0x26c28a;return db[_0x14da('0x39')][_0x14da('0xdc')]({'where':{'id':_0x561e95[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x204314,null))[_0x14da('0x1e')](function(_0x3d119f){if(_0x3d119f){_0x10c7de=_0x3d119f;_0x40bcbb[_0x14da('0xcf')]=_[_0x14da('0xd0')](db[_0x14da('0xe7')]['rawAttributes']);_0x40bcbb[_0x14da('0x45')]=_[_0x14da('0xd0')](_0x561e95['query']);_0x40bcbb[_0x14da('0xd2')]=_['intersection'](_0x40bcbb[_0x14da('0xcf')],_0x40bcbb[_0x14da('0x45')]);_0x162708['attributes']=_[_0x14da('0xd3')](_0x40bcbb[_0x14da('0xcf')],qs[_0x14da('0xda')](_0x561e95['query'][_0x14da('0xda')]));_0x162708[_0x14da('0x4b')]=_0x162708[_0x14da('0x4b')][_0x14da('0x4f')]?_0x162708[_0x14da('0x4b')]:_0x40bcbb[_0x14da('0xcf')];_0x162708['order']=qs[_0x14da('0xd4')](_0x561e95['query'][_0x14da('0xd4')]);_0x162708[_0x14da('0x44')]=qs['filters'](_[_0x14da('0xd5')](_0x561e95[_0x14da('0x45')],_0x40bcbb['filters']));if(_0x561e95[_0x14da('0x45')]['filter']){_0x162708['where']=_[_0x14da('0x58')](_0x162708[_0x14da('0x44')],{'$or':_[_0x14da('0x32')](_0x162708[_0x14da('0x4b')],function(_0x223478){var _0x5deb76={};_0x5deb76[_0x223478]={'$like':'%'+_0x561e95['query'][_0x14da('0x3d')]+'%'};return _0x5deb76;})});}_0x162708=_[_0x14da('0x58')]({},_0x162708,_0x561e95[_0x14da('0xd6')]);return _0x10c7de[_0x14da('0xe6')](_0x162708);}})[_0x14da('0x1e')](function(_0x573ba9){if(_0x573ba9){_0x26c28a=_0x573ba9['length'];if(!_0x561e95[_0x14da('0x45')][_0x14da('0xcb')](_0x14da('0xd7'))){_0x162708[_0x14da('0x1b')]=qs[_0x14da('0x1b')](_0x561e95[_0x14da('0x45')][_0x14da('0x1b')]);_0x162708[_0x14da('0xd8')]=qs[_0x14da('0xd8')](_0x561e95[_0x14da('0x45')]['offset']);}return _0x10c7de[_0x14da('0xe6')](_0x162708);}})[_0x14da('0x1e')](function(_0x46f570){if(_0x46f570){return _0x46f570?{'count':_0x26c28a,'rows':_0x46f570}:null;}})[_0x14da('0x1e')](respondWithResult(_0x204314,null))[_0x14da('0x28')](handleError(_0x204314,null));};exports[_0x14da('0xe8')]=function(_0x4c874b,_0x202e68){var _0x48f60d={'raw':!![],'where':{}};var _0x51c8ee={};var _0x44b245={'count':0x0,'rows':[]};return db[_0x14da('0x39')][_0x14da('0xdc')]({'where':{'id':_0x4c874b[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x202e68,null))[_0x14da('0x1e')](function(_0x3d6227){if(_0x3d6227){_0x51c8ee['model']=_[_0x14da('0xd0')](db[_0x14da('0xe9')][_0x14da('0x3a')]);_0x51c8ee[_0x14da('0x45')]=_[_0x14da('0xd0')](_0x4c874b[_0x14da('0x45')]);_0x51c8ee[_0x14da('0xd2')]=_[_0x14da('0xd3')](_0x51c8ee[_0x14da('0xcf')],_0x51c8ee[_0x14da('0x45')]);_0x48f60d[_0x14da('0x4b')]=_[_0x14da('0xd3')](_0x51c8ee['model'],qs[_0x14da('0xda')](_0x4c874b['query']['fields']));_0x48f60d[_0x14da('0x4b')]=_0x48f60d[_0x14da('0x4b')][_0x14da('0x4f')]?_0x48f60d['attributes']:_0x51c8ee[_0x14da('0xcf')];if(!_0x4c874b['query']['hasOwnProperty'](_0x14da('0xd7'))){_0x48f60d['limit']=qs[_0x14da('0x1b')](_0x4c874b[_0x14da('0x45')]['limit']);_0x48f60d[_0x14da('0xd8')]=qs[_0x14da('0xd8')](_0x4c874b[_0x14da('0x45')][_0x14da('0xd8')]);}_0x48f60d[_0x14da('0xe0')]=qs[_0x14da('0xd4')](_0x4c874b[_0x14da('0x45')]['sort']);_0x48f60d['where']=qs['filters'](_[_0x14da('0xd5')](_0x4c874b[_0x14da('0x45')],_0x51c8ee[_0x14da('0xd2')]));_0x48f60d['where'][_0x14da('0xe1')]=_0x3d6227['id'];if(_0x4c874b[_0x14da('0x45')]['filter']){_0x48f60d[_0x14da('0x44')]=_[_0x14da('0x58')](_0x48f60d[_0x14da('0x44')],{'$or':_[_0x14da('0x32')](_0x48f60d[_0x14da('0x4b')],function(_0x52f1e9){var _0x18b84c={};_0x18b84c[_0x52f1e9]={'$like':'%'+_0x4c874b[_0x14da('0x45')][_0x14da('0x3d')]+'%'};return _0x18b84c;})});}_0x48f60d=_[_0x14da('0x58')]({},_0x48f60d,_0x4c874b[_0x14da('0xd6')]);return db['MailInteraction'][_0x14da('0x1a')]({'where':_0x48f60d[_0x14da('0x44')]})[_0x14da('0x1e')](function(_0x118582){_0x44b245[_0x14da('0x1a')]=_0x118582;if(_0x4c874b[_0x14da('0x45')][_0x14da('0x46')]){_0x48f60d[_0x14da('0x47')]=[{'all':!![]}];}return db[_0x14da('0xe9')][_0x14da('0x88')](_0x48f60d);})['then'](function(_0x195f53){_0x44b245[_0x14da('0x4e')]=_0x195f53;return _0x44b245;});}})[_0x14da('0x1e')](respondWithFilteredResult(_0x202e68,_0x48f60d))[_0x14da('0x28')](handleError(_0x202e68,null));};exports['getSmsInteractions']=function(_0x362a68,_0xe49038){var _0x39aa9c={};var _0x2782c1={};var _0x5512cc;var _0x3b4a62;return db['User'][_0x14da('0xdc')]({'where':{'id':_0x362a68[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0xe49038,null))[_0x14da('0x1e')](function(_0x3e27d8){if(_0x3e27d8){_0x5512cc=_0x3e27d8;_0x2782c1[_0x14da('0xcf')]=_[_0x14da('0xd0')](db[_0x14da('0xea')][_0x14da('0x3a')]);_0x2782c1['query']=_[_0x14da('0xd0')](_0x362a68[_0x14da('0x45')]);_0x2782c1['filters']=_['intersection'](_0x2782c1[_0x14da('0xcf')],_0x2782c1[_0x14da('0x45')]);_0x39aa9c[_0x14da('0x4b')]=_[_0x14da('0xd3')](_0x2782c1['model'],qs[_0x14da('0xda')](_0x362a68[_0x14da('0x45')][_0x14da('0xda')]));_0x39aa9c[_0x14da('0x4b')]=_0x39aa9c['attributes'][_0x14da('0x4f')]?_0x39aa9c['attributes']:_0x2782c1[_0x14da('0xcf')];_0x39aa9c[_0x14da('0xe0')]=qs[_0x14da('0xd4')](_0x362a68[_0x14da('0x45')][_0x14da('0xd4')]);_0x39aa9c[_0x14da('0x44')]=qs[_0x14da('0xd2')](_[_0x14da('0xd5')](_0x362a68[_0x14da('0x45')],_0x2782c1[_0x14da('0xd2')]));if(_0x362a68['query'][_0x14da('0x3d')]){_0x39aa9c[_0x14da('0x44')]=_[_0x14da('0x58')](_0x39aa9c[_0x14da('0x44')],{'$or':_[_0x14da('0x32')](_0x39aa9c[_0x14da('0x4b')],function(_0x229ff4){var _0x153671={};_0x153671[_0x229ff4]={'$like':'%'+_0x362a68[_0x14da('0x45')][_0x14da('0x3d')]+'%'};return _0x153671;})});}_0x39aa9c=_[_0x14da('0x58')]({},_0x39aa9c,_0x362a68[_0x14da('0xd6')]);return _0x5512cc[_0x14da('0xeb')](_0x39aa9c);}})[_0x14da('0x1e')](function(_0x131079){if(_0x131079){_0x3b4a62=_0x131079[_0x14da('0x4f')];if(!_0x362a68[_0x14da('0x45')][_0x14da('0xcb')](_0x14da('0xd7'))){_0x39aa9c[_0x14da('0x1b')]=qs[_0x14da('0x1b')](_0x362a68[_0x14da('0x45')][_0x14da('0x1b')]);_0x39aa9c[_0x14da('0xd8')]=qs[_0x14da('0xd8')](_0x362a68['query'][_0x14da('0xd8')]);}return _0x5512cc[_0x14da('0xeb')](_0x39aa9c);}})[_0x14da('0x1e')](function(_0x129ace){if(_0x129ace){return _0x129ace?{'count':_0x3b4a62,'rows':_0x129ace}:null;}})[_0x14da('0x1e')](respondWithResult(_0xe49038,null))[_0x14da('0x28')](handleError(_0xe49038,null));};exports[_0x14da('0xec')]=function(_0x5e2cbe,_0x5332a9){var _0xa7fd10={};var _0x53fd50={};var _0x237383;var _0x1d9053;return db[_0x14da('0x39')]['findOne']({'where':{'id':_0x5e2cbe[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x5332a9,null))[_0x14da('0x1e')](function(_0x2b5bf9){if(_0x2b5bf9){_0x237383=_0x2b5bf9;_0x53fd50[_0x14da('0xcf')]=_['keys'](db[_0x14da('0xed')][_0x14da('0x3a')]);_0x53fd50[_0x14da('0x45')]=_[_0x14da('0xd0')](_0x5e2cbe[_0x14da('0x45')]);_0x53fd50['filters']=_[_0x14da('0xd3')](_0x53fd50['model'],_0x53fd50[_0x14da('0x45')]);_0xa7fd10['attributes']=_[_0x14da('0xd3')](_0x53fd50[_0x14da('0xcf')],qs[_0x14da('0xda')](_0x5e2cbe['query']['fields']));_0xa7fd10[_0x14da('0x4b')]=_0xa7fd10[_0x14da('0x4b')][_0x14da('0x4f')]?_0xa7fd10[_0x14da('0x4b')]:_0x53fd50[_0x14da('0xcf')];_0xa7fd10[_0x14da('0xe0')]=qs['sort'](_0x5e2cbe['query'][_0x14da('0xd4')]);_0xa7fd10[_0x14da('0x44')]=qs[_0x14da('0xd2')](_[_0x14da('0xd5')](_0x5e2cbe[_0x14da('0x45')],_0x53fd50['filters']));if(_0x5e2cbe['query'][_0x14da('0x3d')]){_0xa7fd10['where']=_[_0x14da('0x58')](_0xa7fd10[_0x14da('0x44')],{'$or':_[_0x14da('0x32')](_0xa7fd10[_0x14da('0x4b')],function(_0x1e47d9){var _0x2ebe83={};_0x2ebe83[_0x1e47d9]={'$like':'%'+_0x5e2cbe[_0x14da('0x45')][_0x14da('0x3d')]+'%'};return _0x2ebe83;})});}_0xa7fd10=_[_0x14da('0x58')]({},_0xa7fd10,_0x5e2cbe[_0x14da('0xd6')]);return _0x237383[_0x14da('0xec')](_0xa7fd10);}})[_0x14da('0x1e')](function(_0x4809d5){if(_0x4809d5){_0x1d9053=_0x4809d5[_0x14da('0x4f')];if(!_0x5e2cbe[_0x14da('0x45')][_0x14da('0xcb')](_0x14da('0xd7'))){_0xa7fd10[_0x14da('0x1b')]=qs[_0x14da('0x1b')](_0x5e2cbe[_0x14da('0x45')][_0x14da('0x1b')]);_0xa7fd10[_0x14da('0xd8')]=qs['offset'](_0x5e2cbe[_0x14da('0x45')][_0x14da('0xd8')]);}return _0x237383[_0x14da('0xec')](_0xa7fd10);}})[_0x14da('0x1e')](function(_0x5040b0){if(_0x5040b0){return _0x5040b0?{'count':_0x1d9053,'rows':_0x5040b0}:null;}})[_0x14da('0x1e')](respondWithResult(_0x5332a9,null))[_0x14da('0x28')](handleError(_0x5332a9,null));};exports['getWhatsappInteractions']=function(_0x30581f,_0x1b8952){var _0x3c7dcb={};var _0x1fb4a1={};var _0x5afb97;var _0x431209;return db[_0x14da('0x39')]['findOne']({'where':{'id':_0x30581f[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x1b8952,null))[_0x14da('0x1e')](function(_0x87c5d6){if(_0x87c5d6){_0x5afb97=_0x87c5d6;_0x1fb4a1[_0x14da('0xcf')]=_[_0x14da('0xd0')](db['WhatsappInteraction'][_0x14da('0x3a')]);_0x1fb4a1[_0x14da('0x45')]=_['keys'](_0x30581f[_0x14da('0x45')]);_0x1fb4a1[_0x14da('0xd2')]=_[_0x14da('0xd3')](_0x1fb4a1[_0x14da('0xcf')],_0x1fb4a1['query']);_0x3c7dcb[_0x14da('0x4b')]=_[_0x14da('0xd3')](_0x1fb4a1[_0x14da('0xcf')],qs[_0x14da('0xda')](_0x30581f[_0x14da('0x45')][_0x14da('0xda')]));_0x3c7dcb[_0x14da('0x4b')]=_0x3c7dcb[_0x14da('0x4b')]['length']?_0x3c7dcb[_0x14da('0x4b')]:_0x1fb4a1['model'];_0x3c7dcb[_0x14da('0xe0')]=qs[_0x14da('0xd4')](_0x30581f[_0x14da('0x45')][_0x14da('0xd4')]);_0x3c7dcb[_0x14da('0x44')]=qs['filters'](_[_0x14da('0xd5')](_0x30581f['query'],_0x1fb4a1[_0x14da('0xd2')]));if(_0x30581f[_0x14da('0x45')][_0x14da('0x3d')]){_0x3c7dcb[_0x14da('0x44')]=_[_0x14da('0x58')](_0x3c7dcb[_0x14da('0x44')],{'$or':_[_0x14da('0x32')](_0x3c7dcb[_0x14da('0x4b')],function(_0x1c6d70){var _0x4865c9={};_0x4865c9[_0x1c6d70]={'$like':'%'+_0x30581f['query']['filter']+'%'};return _0x4865c9;})});}_0x3c7dcb=_[_0x14da('0x58')]({},_0x3c7dcb,_0x30581f[_0x14da('0xd6')]);return _0x5afb97[_0x14da('0xee')](_0x3c7dcb);}})[_0x14da('0x1e')](function(_0xee7f52){if(_0xee7f52){_0x431209=_0xee7f52[_0x14da('0x4f')];if(!_0x30581f[_0x14da('0x45')][_0x14da('0xcb')](_0x14da('0xd7'))){_0x3c7dcb['limit']=qs[_0x14da('0x1b')](_0x30581f[_0x14da('0x45')][_0x14da('0x1b')]);_0x3c7dcb[_0x14da('0xd8')]=qs[_0x14da('0xd8')](_0x30581f[_0x14da('0x45')][_0x14da('0xd8')]);}return _0x5afb97[_0x14da('0xee')](_0x3c7dcb);}})['then'](function(_0x49c4fe){if(_0x49c4fe){return _0x49c4fe?{'count':_0x431209,'rows':_0x49c4fe}:null;}})[_0x14da('0x1e')](respondWithResult(_0x1b8952,null))[_0x14da('0x28')](handleError(_0x1b8952,null));};exports[_0x14da('0xef')]=function(_0x592186,_0x4d63cf,_0x2424af){var _0x344c9e;var _0x3cb4e2;var _0x394b1c;var _0x5591ef=!_[_0x14da('0x64')](_0x592186['params']['id'])?_0x592186[_0x14da('0x56')]['id']:!_[_0x14da('0x64')](_0x592186['user']['id'])?_0x592186['user']['id']:null;return db[_0x14da('0x39')][_0x14da('0x59')]({'where':{'id':_0x5591ef,'role':{'$or':[_0x14da('0x2d'),_0x14da('0x7c'),_0x14da('0x2b')]}},'attributes':['id',_0x14da('0x35'),_0x14da('0xf0'),_0x14da('0xf1'),'role',_0x14da('0x61'),_0x14da('0x99')]})[_0x14da('0x1e')](function(_0x1567a1){if(_0x1567a1){if(_0x1567a1['role']===_0x14da('0x2b')){_0x344c9e=_0x1567a1;if(_0x592186[_0x14da('0x5d')][_0x14da('0x9b')]){_0x394b1c=util[_0x14da('0xa9')]('LOCAL/%s@from-sip/n',_0x344c9e[_0x592186[_0x14da('0x5d')][_0x14da('0x9b')]]);}else if(_0x592186[_0x14da('0x5d')][_0x14da('0xf2')]){_0x394b1c=util[_0x14da('0xa9')]('SIP/%s',_0x592186['body'][_0x14da('0xf2')]);}else{_0x394b1c=util[_0x14da('0xa9')]('SIP/%s',_0x344c9e[_0x14da('0x35')]);}socket['to'](util['format'](_0x14da('0xf3'),_0x344c9e[_0x14da('0x35')]))['emit'](_0x14da('0xf4'),{'user':{'id':_0x344c9e['id'],'name':_0x344c9e['name']},'ip':_0x592186[_0x14da('0xf5')][_0x14da('0xf6')]||_0x592186[_0x14da('0xf7')][_0x14da('0xf8')]||_0x592186[_0x14da('0xf9')][_0x14da('0xf8')]||_0x592186['connection'][_0x14da('0xf9')][_0x14da('0xf8')]});return db[_0x14da('0xab')]['destroy']({'where':{'membername':_0x344c9e[_0x14da('0x35')]},'individualHooks':!![]});}}else{throw new db[(_0x14da('0x90'))][(_0x14da('0x8d'))](_0x14da('0xfa'));}})[_0x14da('0x1e')](function(){if(_0x344c9e){return _0x344c9e[_0x14da('0xfb')]({'raw':!![]});}})[_0x14da('0x1e')](function(_0x674144){if(_0x344c9e){if(_0x674144){_0x3cb4e2=_0x674144;if(_0x3cb4e2[_0x14da('0x4f')]){var _0x55bcda=_0x3cb4e2[_0x14da('0x32')](function(_0x1704f0){var _0x549b9b={'membername':_0x344c9e[_0x14da('0x35')],'UserId':_0x344c9e['id'],'queue_name':_0x1704f0[_0x14da('0x35')],'VoiceQueueId':_0x1704f0['id'],'interface':_0x394b1c,'paused':_0x344c9e[_0x14da('0x99')]||![],'penalty':_0x1704f0[_0x14da('0xfc')]||0x0};return db[_0x14da('0xab')][_0x14da('0xac')](_0x549b9b);});return Promise[_0x14da('0x54')](_0x55bcda);}}}})[_0x14da('0x1e')](function(){if(_0x344c9e){return db['MemberReport'][_0x14da('0x88')]({'where':{'membername':_0x344c9e[_0x14da('0x35')],'exitAt':null}});}})[_0x14da('0x1e')](function(_0x376791){if(_0x344c9e){var _0x2da724=[];_0x376791[_0x14da('0xfd')](function(_0xab397d){_0x2da724['push'](_0xab397d['update']({'exitAt':moment()[_0x14da('0xa9')](_0x14da('0xfe'))}));});return Promise['all'](_0x2da724);}})[_0x14da('0x1e')](function(){if(_0x344c9e){var _0x3b8044=[];var _0x1e4a50=[];var _0x21601d=utils[_0x14da('0xff')]();var _0x3ce7e6={'membername':_0x344c9e[_0x14da('0x35')],'interface':_0x394b1c,'enterAt':moment()[_0x14da('0xa9')](_0x14da('0xfe')),'role':_0x344c9e[_0x14da('0x2a')],'internal':_0x344c9e[_0x14da('0x61')]};_0x21601d[_0x14da('0xfd')](function(_0xaab26a){_0x3b8044[_0x14da('0x4c')](_[_0x14da('0x58')]({'channel':_0xaab26a,'type':_0x14da('0x100'),'data1':_0x592186['body']['device'],'data2':_0x394b1c},_0x3ce7e6));if(_0x344c9e[_0x14da('0x99')]){_0x1e4a50[_0x14da('0x4c')](_[_0x14da('0x58')]({'channel':_0xaab26a,'type':_0x14da('0x101'),'data1':_0x14da('0x102')},_0x3ce7e6));}});return db[_0x14da('0x103')]['bulkCreate'](_0x3b8044[_0x14da('0xc8')](_0x1e4a50),{'individualHooks':!![]});}})[_0x14da('0x1e')](function(){if(_0x344c9e){return _0x344c9e['update']({'online':!![],'lastLoginAt':moment()[_0x14da('0xa9')](_0x14da('0xfe')),'voicePause':_0x344c9e['loginInPause']||![],'mailPause':_0x344c9e['loginInPause']||![],'chatPause':_0x344c9e[_0x14da('0x99')]||![],'faxPause':_0x344c9e[_0x14da('0x99')]||![],'smsPause':_0x344c9e[_0x14da('0x99')]||![],'openchannelPause':_0x344c9e[_0x14da('0x99')]||![],'whatsappPause':_0x344c9e[_0x14da('0x99')]||![],'pauseType':_0x344c9e[_0x14da('0x99')]?'LOGININPAUSE':null,'interface':_0x394b1c,'lastPauseAt':moment()[_0x14da('0xa9')](_0x14da('0xfe'))});}})['then'](function(_0x466760){if(_0x592186['isMiddleware']){return _0x2424af();}else{return Promise[_0x14da('0x104')](_0x466760)[_0x14da('0x1e')](respondWithResult(_0x4d63cf,null));}})[_0x14da('0x28')](handleError(_0x4d63cf,null));};exports[_0x14da('0x105')]=function(_0x212eca,_0x163c98){var _0x156860;return db[_0x14da('0x39')][_0x14da('0x59')]({'where':{'id':_0x212eca[_0x14da('0x56')]['id'],'role':_0x14da('0x2b')},'attributes':['id',_0x14da('0x35'),'role']})['then'](handleEntityNotFound(_0x163c98,null))[_0x14da('0x1e')](function(_0xa3677e){if(_0xa3677e){_0x156860=_0xa3677e;return db[_0x14da('0xab')][_0x14da('0x106')]({'where':{'membername':_0x156860[_0x14da('0x35')]},'individualHooks':!![]});}})['then'](function(){return db[_0x14da('0x103')][_0x14da('0x88')]({'where':{'membername':_0x156860['name'],'exitAt':null}});})[_0x14da('0x1e')](function(_0x2bd93c){var _0x2c6692=[];_0x2bd93c[_0x14da('0xfd')](function(_0x4bdfcb){_0x2c6692[_0x14da('0x4c')](_0x4bdfcb[_0x14da('0x29')]({'exitAt':moment()[_0x14da('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x2c6692);})[_0x14da('0x1e')](function(){return _0x156860[_0x14da('0x29')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x14da('0x1e')](respondWithResult(_0x163c98,null))[_0x14da('0x28')](handleError(_0x163c98,null));};exports['pause']=function(_0x59bf0b,_0x30a66e){var _0x54656e;return db[_0x14da('0xab')][_0x14da('0x29')]({'paused':0x1},{'where':{'UserId':_0x59bf0b['params']['id']},'individualHooks':!![]})[_0x14da('0x1e')](function(){return db[_0x14da('0x39')][_0x14da('0x59')]({'where':{'id':_0x59bf0b['params']['id'],'role':_0x14da('0x2b')},'attributes':['id',_0x14da('0x35'),'role',_0x14da('0x61'),_0x14da('0x9b'),'online']});})[_0x14da('0x1e')](handleEntityNotFound(_0x30a66e,null))['then'](function(_0x5dc224){if(_0x5dc224){_0x54656e=_0x5dc224;return respondWithRpcPromise(_0x14da('0x107'),_0x14da('0x108'),{'id':_0x54656e['id'],'name':_0x54656e[_0x14da('0x35')],'pause':!![]});}})['then'](function(){if(_0x54656e){return db[_0x14da('0x103')]['findAll']({'where':{'membername':_0x54656e[_0x14da('0x35')],'type':_0x14da('0x101'),'exitAt':null}});}})['then'](function(_0x174544){if(_0x174544[_0x14da('0x4f')]){var _0x2818d5=moment()[_0x14da('0xa9')](_0x14da('0xfe'));for(var _0x237649=0x0,_0x5f5d14=_0x174544[_0x14da('0x4f')];_0x237649<_0x5f5d14;_0x237649++){_0x174544[_0x237649][_0x14da('0x109')]({'exitAt':_0x2818d5});}}})['then'](function(){var _0x3196a8=[];var _0x32b5df=utils[_0x14da('0xff')]();_0x32b5df[_0x14da('0xfd')](function(_0x328c1b){_0x3196a8[_0x14da('0x4c')]({'channel':_0x328c1b,'membername':_0x54656e[_0x14da('0x35')],'interface':_[_0x14da('0x64')](_0x54656e[_0x14da('0x9b')])?util[_0x14da('0xa9')](_0x14da('0xaa'),_0x54656e[_0x14da('0x35')]):_0x54656e[_0x14da('0x9b')],'type':_0x14da('0x101'),'enterAt':moment()[_0x14da('0xa9')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x59bf0b[_0x14da('0x5d')][_0x14da('0x3b')]||_0x14da('0x10a'),'role':_0x54656e[_0x14da('0x2a')],'internal':_0x54656e[_0x14da('0x61')]});});return db[_0x14da('0x103')]['bulkCreate'](_0x3196a8,{'individualHooks':!![]});})[_0x14da('0x1e')](function(){return _0x54656e['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x59bf0b[_0x14da('0x5d')][_0x14da('0x3b')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x14da('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x30a66e,null))[_0x14da('0x28')](handleError(_0x30a66e,null));};exports['unpause']=function(_0x4ec96c,_0x4b37c3){if(_0x4ec96c[_0x14da('0x5d')][_0x14da('0xae')]&&!utils['isValidChannel'](_0x4ec96c['body']['channel'])){throw new APIBadRequestError(util['format'](_0x14da('0x10b'),_0x4ec96c[_0x14da('0x5d')]['channel']));}return db[_0x14da('0x39')][_0x14da('0x59')]({'where':{'id':_0x4ec96c[_0x14da('0x56')]['id']},'attributes':['id',_0x14da('0x35'),_0x14da('0x2a'),_0x14da('0x61'),'interface',_0x14da('0x98'),_0x14da('0x9a'),'mailPause',_0x14da('0x10c'),_0x14da('0x10d'),_0x14da('0x10e'),'smsPause',_0x14da('0x10f'),_0x14da('0x110'),_0x14da('0x111')]})[_0x14da('0x1e')](function(_0x279ccc){if(!_0x279ccc){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x4ec96c['params']['id']));}return _0x279ccc['unpause'](_0x4ec96c['body'][_0x14da('0xae')]);})[_0x14da('0x1e')](respondWithResult(_0x4b37c3,null))[_0x14da('0x28')](APIHandleError(_0x4b37c3));};exports[_0x14da('0x112')]=function(_0x533352,_0x3e4082){var _0x26631e={};var _0x156fb4={};var _0x33920d;var _0x29b01b;return db[_0x14da('0x39')][_0x14da('0xdc')]({'where':{'id':_0x533352[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x3e4082,null))['then'](function(_0x30c9ce){if(_0x30c9ce){_0x33920d=_0x30c9ce;_0x156fb4[_0x14da('0xcf')]=_[_0x14da('0xd0')](db[_0x14da('0x113')]['rawAttributes']);_0x156fb4['query']=_[_0x14da('0xd0')](_0x533352['query']);_0x156fb4[_0x14da('0xd2')]=_[_0x14da('0xd3')](_0x156fb4[_0x14da('0xcf')],_0x156fb4[_0x14da('0x45')]);_0x26631e[_0x14da('0x4b')]=_['intersection'](_0x156fb4['model'],qs[_0x14da('0xda')](_0x533352[_0x14da('0x45')][_0x14da('0xda')]));_0x26631e[_0x14da('0x4b')]=_0x26631e[_0x14da('0x4b')][_0x14da('0x4f')]?_0x26631e[_0x14da('0x4b')]:_0x156fb4['model'];_0x26631e[_0x14da('0xe0')]=qs[_0x14da('0xd4')](_0x533352['query']['sort']);_0x26631e['where']=qs[_0x14da('0xd2')](_[_0x14da('0xd5')](_0x533352[_0x14da('0x45')],_0x156fb4['filters']));if(_0x533352['query'][_0x14da('0x3d')]){_0x26631e[_0x14da('0x44')]=_[_0x14da('0x58')](_0x26631e['where'],{'$or':_['map'](_0x26631e['attributes'],function(_0x216c2c){var _0x100660={};_0x100660[_0x216c2c]={'$like':'%'+_0x533352[_0x14da('0x45')][_0x14da('0x3d')]+'%'};return _0x100660;})});}_0x26631e=_['merge']({},_0x26631e,_0x533352['options']);return _0x33920d[_0x14da('0x112')](_0x26631e);}})[_0x14da('0x1e')](function(_0x21291e){if(_0x21291e){_0x29b01b=_0x21291e['length'];if(!_0x533352[_0x14da('0x45')][_0x14da('0xcb')](_0x14da('0xd7'))){_0x26631e[_0x14da('0x1b')]=qs[_0x14da('0x1b')](_0x533352[_0x14da('0x45')][_0x14da('0x1b')]);_0x26631e[_0x14da('0xd8')]=qs[_0x14da('0xd8')](_0x533352[_0x14da('0x45')][_0x14da('0xd8')]);}return _0x33920d[_0x14da('0x112')](_0x26631e);}})[_0x14da('0x1e')](function(_0x58a196){if(_0x58a196){return _0x58a196?{'count':_0x29b01b,'rows':_0x58a196}:null;}})[_0x14da('0x1e')](respondWithResult(_0x3e4082,null))[_0x14da('0x28')](handleError(_0x3e4082,null));};exports[_0x14da('0x114')]=function(_0x1312de,_0x78bf95){var _0x33f0e7=_0x1312de[_0x14da('0x56')]['id'];var _0x272a8f=_0x1312de[_0x14da('0x5d')]?_0x1312de[_0x14da('0x5d')][_0x14da('0x5f')]:null;var _0x71383a=[];return Promise[_0x14da('0x104')]()[_0x14da('0x1e')](function(){if(!_0x272a8f)throw new APIBadRequestError(_0x14da('0x115'));})[_0x14da('0x1e')](function(){return db[_0x14da('0x39')][_0x14da('0xdc')]({'where':{'id':_0x33f0e7}});})['then'](function(_0x53e2de){if(!_0x53e2de)throw new APINotFoundError(util[_0x14da('0xa9')](_0x14da('0xca'),_0x1312de[_0x14da('0x56')]['id']));return db[_0x14da('0x67')][_0x14da('0x116')](function(_0x26e8ac){return _0x53e2de[_0x14da('0x114')](_0x272a8f,{'transaction':_0x26e8ac})[_0x14da('0x1e')](function(){return db['Team'][_0x14da('0x88')]({'where':{'id':{'$in':_0x272a8f}}});})[_0x14da('0x1e')](function(_0x441aed){var _0x2c7263=_['map'](_0x441aed,function(_0x2e5663){return _0x2e5663[_0x14da('0x117')]();});return Promise[_0x14da('0x54')](_0x2c7263);})['then'](function(_0x8b6c36){_0x71383a=_['flattenDeep'](_0x8b6c36);var _0xaa75=_[_0x14da('0x32')](_0x71383a,function(_0x278d03){return _0x278d03['addAgent'](_0x53e2de['id'],{'transaction':_0x26e8ac});});return Promise[_0x14da('0x54')](_0xaa75);})[_0x14da('0x1e')](function(){if(!_0x53e2de['online'])return;var _0x24f3b8=_[_0x14da('0x3d')](_0x71383a,function(_0xf6bed8){return _0xf6bed8['getDataValue'](_0x14da('0xae'))==='Voice';});var _0x39d08b=_[_0x14da('0x32')](_0x24f3b8,function(_0x4e2cb1){return db[_0x14da('0xab')][_0x14da('0xac')]({'membername':_0x53e2de[_0x14da('0x35')],'UserId':_0x53e2de['id'],'queue_name':_0x4e2cb1[_0x14da('0x35')],'VoiceQueueId':_0x4e2cb1['id'],'interface':_['isNil'](_0x53e2de[_0x14da('0x9b')])?util[_0x14da('0xa9')](_0x14da('0xaa'),_0x53e2de[_0x14da('0x35')]):_0x53e2de[_0x14da('0x9b')],'paused':_0x53e2de[_0x14da('0x9a')]||![],'penalty':_0x53e2de['penalty']},{'transaction':_0x26e8ac});});return Promise[_0x14da('0x54')](_0x39d08b);})[_0x14da('0x1e')](function(){return db[_0x14da('0x118')][_0x14da('0x88')]({'where':{'teamId':{'$in':_0x272a8f}}});})[_0x14da('0x1e')](function(_0x482216){var _0x472382=_[_0x14da('0x32')](_0x482216,function(_0x1d3ce0){return db[_0x14da('0x119')][_0x14da('0x7b')]({'UserId':_0x53e2de['id'],'VoicePrefixId':_0x1d3ce0[_0x14da('0x11a')]},{'transaction':_0x26e8ac});});return Promise['all'](_0x472382);});});})[_0x14da('0x1e')](function(){for(var _0x320eb2=0x0;_0x320eb2<_0x71383a['length'];_0x320eb2++){var _0x1ff87a=_0x71383a[_0x320eb2][_0x14da('0x11b')](_0x14da('0xae'));var _0x12026e=_0x1ff87a+_0x14da('0xa4');socket['emit'](_0x14da('0x7c')+_0x1ff87a+_0x14da('0xa6'),{'UserId':_0x33f0e7,['queueField']:_0x71383a[_0x320eb2]['id']});}})[_0x14da('0x1e')](respondWithStatusCode(_0x78bf95,null))[_0x14da('0x28')](APIHandleError(_0x78bf95));};exports[_0x14da('0x11c')]=function(_0x2862f8,_0x22728c){var _0x1bd7f8=_0x2862f8[_0x14da('0x56')]['id'];var _0x3c0fb8=null;if(_0x2862f8[_0x14da('0x45')][_0x14da('0x5f')]){_0x3c0fb8=_[_0x14da('0xaf')](_0x2862f8[_0x14da('0x45')][_0x14da('0x5f')])?_0x2862f8[_0x14da('0x45')][_0x14da('0x5f')]:[_0x2862f8['query'][_0x14da('0x5f')]];}var _0x1bda56=[];return Promise['resolve']()['then'](function(){if(!_0x3c0fb8)throw new APIBadRequestError(_0x14da('0x11d'));})[_0x14da('0x1e')](function(){return db['User'][_0x14da('0xdc')]({'where':{'id':_0x1bd7f8}});})[_0x14da('0x1e')](function(_0x24c5c8){if(!_0x24c5c8)throw new APINotFoundError(util[_0x14da('0xa9')]('User\x20with\x20id\x20%s\x20not\x20found',_0x2862f8[_0x14da('0x56')]['id']));return db[_0x14da('0x67')][_0x14da('0x116')](function(_0x1be069){return _0x24c5c8['removeTeams'](_0x3c0fb8,{'transaction':_0x1be069})[_0x14da('0x1e')](function(){return db[_0x14da('0x113')][_0x14da('0x88')]({'where':{'id':{'$in':_0x3c0fb8}}});})[_0x14da('0x1e')](function(_0x3d87ae){var _0x2a0f88=_[_0x14da('0x32')](_0x3d87ae,function(_0x3e6144){return _0x3e6144[_0x14da('0x117')]();});return Promise['all'](_0x2a0f88);})[_0x14da('0x1e')](function(_0x171a39){_0x1bda56=_[_0x14da('0x11e')](_0x171a39);var _0x188f3c=_[_0x14da('0x32')](_0x1bda56,function(_0x2f1832){return _0x2f1832[_0x14da('0x11f')](_0x24c5c8['id'],{'transaction':_0x1be069});});return Promise[_0x14da('0x54')](_0x188f3c);})[_0x14da('0x1e')](function(){if(!_0x24c5c8[_0x14da('0x98')])return;var _0x598d3a=_[_0x14da('0x3d')](_0x1bda56,function(_0x2b58a7){return _0x2b58a7[_0x14da('0x11b')](_0x14da('0xae'))===_0x14da('0x120');});var _0x1abbea=_['map'](_0x598d3a,function(_0x3ab617){return db[_0x14da('0xab')][_0x14da('0x106')]({'where':{'VoiceQueueId':_0x3ab617['id'],'UserId':_0x24c5c8['id']},'transaction':_0x1be069});});return Promise[_0x14da('0x54')](_0x1abbea);})[_0x14da('0x1e')](function(){return db['TeamVoicePrefix'][_0x14da('0x88')]({'where':{'teamId':{'$in':_0x3c0fb8}}});})[_0x14da('0x1e')](function(_0x398a16){var _0x24bd20=_[_0x14da('0x32')](_0x398a16,function(_0x3f8ad8){return db[_0x14da('0x119')][_0x14da('0x106')]({'where':{'UserId':_0x24c5c8['id'],'VoicePrefixId':_0x3f8ad8[_0x14da('0x11a')]}},{'transaction':_0x1be069});});return Promise[_0x14da('0x54')](_0x24bd20);});});})[_0x14da('0x1e')](function(){for(var _0x31ed11=0x0;_0x31ed11<_0x1bda56[_0x14da('0x4f')];_0x31ed11++){var _0x37c196=_0x1bda56[_0x31ed11][_0x14da('0x11b')](_0x14da('0xae'));var _0x3131aa=_0x37c196+_0x14da('0xa4');socket[_0x14da('0xa5')](_0x14da('0x7c')+_0x37c196+_0x14da('0xb0'),{'UserId':_0x1bd7f8,['queueField']:_0x1bda56[_0x31ed11]['id']});}})[_0x14da('0x1e')](respondWithStatusCode(_0x22728c,null))[_0x14da('0x28')](APIHandleError(_0x22728c));};exports[_0x14da('0x121')]=function(_0x203261,_0x295ebc){var _0x56ec24={};var _0x22cdfb={};var _0x1058ae;var _0x20ddb3;return db['User'][_0x14da('0xdc')]({'where':{'id':_0x203261[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x295ebc,null))[_0x14da('0x1e')](function(_0x53ef83){if(_0x53ef83){_0x1058ae=_0x53ef83;_0x22cdfb[_0x14da('0xcf')]=_[_0x14da('0xd0')](db[_0x14da('0xcc')][_0x14da('0x3a')]);_0x22cdfb[_0x14da('0x45')]=_['keys'](_0x203261[_0x14da('0x45')]);_0x22cdfb['filters']=_['intersection'](_0x22cdfb[_0x14da('0xcf')],_0x22cdfb['query']);_0x56ec24[_0x14da('0x4b')]=_[_0x14da('0xd3')](_0x22cdfb[_0x14da('0xcf')],qs[_0x14da('0xda')](_0x203261[_0x14da('0x45')][_0x14da('0xda')]));_0x56ec24['attributes']=_0x56ec24[_0x14da('0x4b')][_0x14da('0x4f')]?_0x56ec24[_0x14da('0x4b')]:_0x22cdfb['model'];_0x56ec24['order']=qs[_0x14da('0xd4')](_0x203261[_0x14da('0x45')]['sort']);_0x56ec24['where']=qs['filters'](_[_0x14da('0xd5')](_0x203261[_0x14da('0x45')],_0x22cdfb[_0x14da('0xd2')]));if(_0x203261[_0x14da('0x45')][_0x14da('0x3d')]){_0x56ec24['where']=_[_0x14da('0x58')](_0x56ec24['where'],{'$or':_[_0x14da('0x32')](_0x56ec24[_0x14da('0x4b')],function(_0x263b07){var _0x5d1cd5={};_0x5d1cd5[_0x263b07]={'$like':'%'+_0x203261[_0x14da('0x45')][_0x14da('0x3d')]+'%'};return _0x5d1cd5;})});}_0x56ec24=_['merge']({},_0x56ec24,_0x203261[_0x14da('0xd6')]);return _0x1058ae[_0x14da('0x121')](_0x56ec24);}})[_0x14da('0x1e')](function(_0x10568b){if(_0x10568b){_0x20ddb3=_0x10568b[_0x14da('0x4f')];if(!_0x203261[_0x14da('0x45')][_0x14da('0xcb')](_0x14da('0xd7'))){_0x56ec24[_0x14da('0x1b')]=qs[_0x14da('0x1b')](_0x203261[_0x14da('0x45')][_0x14da('0x1b')]);_0x56ec24[_0x14da('0xd8')]=qs['offset'](_0x203261['query']['offset']);}return _0x1058ae['getLists'](_0x56ec24);}})[_0x14da('0x1e')](function(_0x289b09){if(_0x289b09){return _0x289b09?{'count':_0x20ddb3,'rows':_0x289b09}:null;}})[_0x14da('0x1e')](respondWithResult(_0x295ebc,null))[_0x14da('0x28')](handleError(_0x295ebc,null));};exports[_0x14da('0x122')]=function(_0x2719ba,_0x1cc20b){var _0x3d6d9d={};var _0x50b3da={};var _0x5e7244;return db['User']['findOne']({'where':{'id':_0x2719ba[_0x14da('0x56')]['id']}})[_0x14da('0x1e')](handleEntityNotFound(_0x1cc20b,null))[_0x14da('0x1e')](function(_0x31928f){if(_0x31928f){_0x5e7244=_0x31928f;_0x50b3da[_0x14da('0xcf')]=_[_0x14da('0xd0')](db[_0x14da('0x39')]['rawAttributes']);_0x50b3da['query']=_[_0x14da('0xd0')](_0x2719ba[_0x14da('0x45')]);_0x50b3da[_0x14da('0xd2')]=_[_0x14da('0xd3')](_0x50b3da[_0x14da('0xcf')],_0x50b3da[_0x14da('0x45')]);_0x3d6d9d[_0x14da('0x4b')]=_['intersection'](_0x50b3da[_0x14da('0xcf')],qs[_0x14da('0xda')](_0x2719ba[_0x14da('0x45')]['fields']));_0x3d6d9d[_0x14da('0x4b')]=_0x3d6d9d[_0x14da('0x4b')]['length']?_0x3d6d9d[_0x14da('0x4b')]:_0x50b3da[_0x14da('0xcf')];_0x3d6d9d[_0x14da('0xe0')]=qs['sort'](_0x2719ba[_0x14da('0x45')][_0x14da('0xd4')]);_0x3d6d9d[_0x14da('0x44')]=qs[_0x14da('0xd2')](_[_0x14da('0xd5')](_0x2719ba[_0x14da('0x45')],_0x50b3da[_0x14da('0xd2')]));if(_0x2719ba[_0x14da('0x45')][_0x14da('0x3d')]){_0x3d6d9d[_0x14da('0x44')]=_[_0x14da('0x58')](_0x3d6d9d['where'],{'$or':_[_0x14da('0x32')](_0x3d6d9d[_0x14da('0x4b')],function(_0x5a591e){var _0x4992f7={};_0x4992f7[_0x5a591e]={'$like':'%'+_0x2719ba[_0x14da('0x45')][_0x14da('0x3d')]+'%'};return _0x4992f7;})});}_0x3d6d9d['model']=db[_0x14da('0x39')];_0x3d6d9d['as']=_0x14da('0x81');_0x3d6d9d=_[_0x14da('0x58')]({},_0x3d6d9d,_0x2719ba[_0x14da('0xd6')]);return _0x5e7244['getVoiceQueues']({'include':[_0x3d6d9d]});}})[_0x14da('0x1e')](function(_0x541cea){if(_0x541cea){var _0x52c174={},_0x678efb=[];for(var _0x5d08b0=0x0;_0x5d08b0<_0x541cea['length'];_0x5d08b0+=0x1){for(var _0x25498b=0x0,_0x29623b;_0x25498b<_0x541cea[_0x5d08b0]['Agents'][_0x14da('0x4f')];_0x25498b+=0x1){_0x29623b=_0x541cea[_0x5d08b0]['Agents'][_0x25498b]['get']({'plain':!![]});_0x52c174[_0x29623b['id']]=_0x29623b;}}_0x52c174=_['values'](_0x52c174);for(var _0x494551=qs[_0x14da('0xd8')](_0x2719ba[_0x14da('0x45')][_0x14da('0xd8')]);_0x494551<_0x52c174['length']&&_0x678efb[_0x14da('0x4f')]=_0x10f3b3[_0x08fc('0x51')]){throw new Error(_0x08fc('0x52'));}})[_0x08fc('0x18')](function(){if(_0x510d04){return db[_0x08fc('0x27')][_0x08fc('0x47')]({'where':{'membername':_0x510d04['name']},'individualHooks':!![]});}})['then'](function(){if(_0x510d04){return _0x510d04[_0x08fc('0x53')]({'raw':!![]});}})[_0x08fc('0x18')](function(_0x5ed248){if(_0x510d04){if(_0x5ed248){var _0x245f3d=[];_0x8538f0=_0x5ed248;if(_0x8538f0[_0x08fc('0x2a')]){for(var _0x53398c=0x0;_0x53398c<_0x8538f0[_0x08fc('0x2a')];_0x53398c++){_0x245f3d[_0x08fc('0x2f')](db['UserVoiceQueueRt'][_0x08fc('0x54')]({'membername':_0x510d04[_0x08fc('0x22')],'UserId':_0x510d04['id'],'queue_name':_0x8538f0[_0x53398c][_0x08fc('0x22')],'VoiceQueueId':_0x8538f0[_0x53398c]['id'],'interface':_0x1f1833,'paused':_0x510d04['loginInPause']||![],'penalty':_0x8538f0[_0x53398c][_0x08fc('0x55')]||0x0}));}return BPromise['all'](_0x245f3d);}}}})[_0x08fc('0x18')](function(){if(_0x510d04){return db[_0x08fc('0x48')][_0x08fc('0x10')]({'where':{'membername':_0x510d04[_0x08fc('0x22')],'exitAt':null}});}})[_0x08fc('0x18')](function(_0x5dc742){if(_0x510d04){if(_0x5dc742&&_0x5dc742['length']){var _0x24f111=[];_0x5dc742[_0x08fc('0x2e')](function(_0x30f8d3){_0x24f111[_0x08fc('0x2f')](_0x30f8d3['update']({'exitAt':moment()[_0x08fc('0x24')](_0x08fc('0x2b'))}));});return BPromise[_0x08fc('0x49')](_0x24f111);}}})[_0x08fc('0x18')](function(){if(_0x510d04){var _0x57a323=[];var _0x1d6c82=[];var _0x506de1=utils[_0x08fc('0x2d')]();var _0x9d6085={'membername':_0x510d04[_0x08fc('0x22')],'interface':_0x1f1833,'enterAt':moment()['format'](_0x08fc('0x2b')),'role':_0x510d04[_0x08fc('0x3d')],'internal':_0x510d04[_0x08fc('0x23')]};_0x506de1[_0x08fc('0x2e')](function(_0x4d37d7){_0x57a323[_0x08fc('0x2f')](_[_0x08fc('0x56')]({'channel':_0x4d37d7,'type':_0x08fc('0x57'),'data1':_0x08fc('0x58'),'data2':_0x1f1833},_0x9d6085));if(_0x510d04[_0x08fc('0x59')]){_0x1d6c82['push'](_[_0x08fc('0x56')]({'channel':_0x4d37d7,'type':'PAUSE','data1':'LOGININPAUSE'},_0x9d6085));}});return db[_0x08fc('0x48')][_0x08fc('0x36')](_0x57a323[_0x08fc('0x5a')](_0x1d6c82),{'individualHooks':!![]});}})['then'](function(){if(_0x510d04){return _0x510d04[_0x08fc('0x28')]({'online':!![],'lastLoginAt':moment()['format'](_0x08fc('0x2b')),'voicePause':_0x510d04[_0x08fc('0x59')]||![],'mailPause':_0x510d04[_0x08fc('0x59')]||![],'chatPause':_0x510d04[_0x08fc('0x59')]||![],'faxPause':_0x510d04[_0x08fc('0x59')]||![],'smsPause':_0x510d04[_0x08fc('0x59')]||![],'openchannelPause':_0x510d04['loginInPause']||![],'pauseType':_0x510d04[_0x08fc('0x59')]?_0x08fc('0x5b'):null,'lastPauseAt':moment()[_0x08fc('0x24')](_0x08fc('0x2b')),'interface':_0x1f1833});}})[_0x08fc('0x18')](function(_0x2fdc57){_0x4a581f(_0x2fdc57);})[_0x08fc('0x1b')](function(_0x1e2b9e){_0x19806a(_0x1c9f35['error'](0x1f4,_0x1e2b9e[_0x08fc('0x1d')]));});});}; \ No newline at end of file +var _0xdf81=['Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','MemberReport','getChannels','merge','LOGIN','loginInPause','LOGININPAUSE','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','./user.socket','register','GetUser','options','raw','where','attributes','limit','include','map','model','then','info','debug','catch','error','message','ShowUser','User','stringify','find','role','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','findAll','name','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','push','isNil','SIP/%s','type','DEFAULT\x20PAUSE','internal','body','bulkCreate','update','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','lastPauseAt','unpause','system','LogoutUser','destroy','forEach','all','LoginUser','mobile','count','agent','../../config/license/util','getLicense','agents'];(function(_0x10aaa5,_0x18c360){var _0x447db4=function(_0x1ede16){while(--_0x1ede16){_0x10aaa5['push'](_0x10aaa5['shift']());}};_0x447db4(++_0x18c360);}(_0xdf81,0xc0));var _0x1df8=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xdf81[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0x1df8('0x0'));var util=require(_0x1df8('0x1'));var moment=require(_0x1df8('0x2'));var BPromise=require('bluebird');var Redis=require(_0x1df8('0x3'));var db=require(_0x1df8('0x4'))['db'];var utils=require(_0x1df8('0x5'));var logger=require(_0x1df8('0x6'))(_0x1df8('0x7'));var config=require(_0x1df8('0x8'));config[_0x1df8('0x9')]=_['defaults'](config[_0x1df8('0x9')],{'host':_0x1df8('0xa'),'port':0x18eb});var socket=require(_0x1df8('0xb'))(new Redis(config['redis']));require(_0x1df8('0xc'))[_0x1df8('0xd')](socket);exports[_0x1df8('0xe')]=function(_0x15d89b){var _0x465ebb=this;return new Promise(function(_0x496ca4,_0x263029){return db['User']['findAll']({'raw':_0x15d89b[_0x1df8('0xf')]?_0x15d89b[_0x1df8('0xf')][_0x1df8('0x10')]===undefined?!![]:![]:!![],'where':_0x15d89b[_0x1df8('0xf')]?_0x15d89b[_0x1df8('0xf')][_0x1df8('0x11')]||null:null,'attributes':_0x15d89b[_0x1df8('0xf')]?_0x15d89b[_0x1df8('0xf')][_0x1df8('0x12')]||null:null,'limit':_0x15d89b['options']?_0x15d89b[_0x1df8('0xf')][_0x1df8('0x13')]||null:null,'include':_0x15d89b[_0x1df8('0xf')]?_0x15d89b['options'][_0x1df8('0x14')]?_[_0x1df8('0x15')](_0x15d89b['options'][_0x1df8('0x14')],function(_0x44717b){return{'model':db[_0x44717b['model']],'as':_0x44717b['as'],'attributes':_0x44717b[_0x1df8('0x12')],'include':_0x44717b['include']?_[_0x1df8('0x15')](_0x44717b[_0x1df8('0x14')],function(_0x501306){return{'model':db[_0x501306['model']],'as':_0x501306['as'],'attributes':_0x501306[_0x1df8('0x12')],'include':_0x501306[_0x1df8('0x14')]?_['map'](_0x501306[_0x1df8('0x14')],function(_0x2d79ac){return{'model':db[_0x2d79ac[_0x1df8('0x16')]],'as':_0x2d79ac['as'],'attributes':_0x2d79ac['attributes']};}):[]};}):[]};}):[]:[]})[_0x1df8('0x17')](function(_0x4493c9){logger[_0x1df8('0x18')](_0x1df8('0xe'),_0x15d89b);logger[_0x1df8('0x19')](_0x1df8('0xe'),_0x15d89b,JSON['stringify'](_0x4493c9));_0x496ca4(_0x4493c9);})[_0x1df8('0x1a')](function(_0x3a8d33){logger[_0x1df8('0x1b')](_0x1df8('0xe'),_0x3a8d33['message'],_0x15d89b);_0x263029(_0x465ebb[_0x1df8('0x1b')](0x1f4,_0x3a8d33[_0x1df8('0x1c')]));});});};exports[_0x1df8('0x1d')]=function(_0x5f51ae){var _0x54e632=this;return new Promise(function(_0x1b05b1,_0xbed356){return db[_0x1df8('0x1e')]['find']({'raw':_0x5f51ae[_0x1df8('0xf')]?_0x5f51ae[_0x1df8('0xf')][_0x1df8('0x10')]===undefined?!![]:![]:!![],'where':_0x5f51ae[_0x1df8('0xf')]?_0x5f51ae['options'][_0x1df8('0x11')]||null:null,'attributes':_0x5f51ae[_0x1df8('0xf')]?_0x5f51ae[_0x1df8('0xf')][_0x1df8('0x12')]||null:null,'include':_0x5f51ae[_0x1df8('0xf')]?_0x5f51ae[_0x1df8('0xf')][_0x1df8('0x14')]?_[_0x1df8('0x15')](_0x5f51ae[_0x1df8('0xf')][_0x1df8('0x14')],function(_0x4f5d72){return{'model':db[_0x4f5d72[_0x1df8('0x16')]],'as':_0x4f5d72['as'],'attributes':_0x4f5d72[_0x1df8('0x12')],'include':_0x4f5d72[_0x1df8('0x14')]?_[_0x1df8('0x15')](_0x4f5d72[_0x1df8('0x14')],function(_0x1faf0a){return{'model':db[_0x1faf0a['model']],'as':_0x1faf0a['as'],'attributes':_0x1faf0a['attributes'],'include':_0x1faf0a[_0x1df8('0x14')]?_[_0x1df8('0x15')](_0x1faf0a[_0x1df8('0x14')],function(_0x4aeb40){return{'model':db[_0x4aeb40['model']],'as':_0x4aeb40['as'],'attributes':_0x4aeb40[_0x1df8('0x12')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x518ce6){logger[_0x1df8('0x18')](_0x1df8('0x1d'),_0x5f51ae);logger['debug']('ShowUser',_0x5f51ae,JSON[_0x1df8('0x1f')](_0x518ce6));_0x1b05b1(_0x518ce6);})[_0x1df8('0x1a')](function(_0x48c463){logger[_0x1df8('0x1b')](_0x1df8('0x1d'),_0x48c463[_0x1df8('0x1c')],_0x5f51ae);_0xbed356(_0x54e632['error'](0x1f4,_0x48c463[_0x1df8('0x1c')]));});});};exports['PauseUser']=function(_0x5c244e){var _0xd069a4;return db[_0x1df8('0x1e')][_0x1df8('0x20')]({'where':_0x5c244e['options'][_0x1df8('0x11')]||{},'attributes':['id','name',_0x1df8('0x21'),'internal',_0x1df8('0x22')]})[_0x1df8('0x17')](function(_0x354b2f){if(!_0x354b2f){throw new Error(util[_0x1df8('0x23')](_0x1df8('0x24'),_0x5c244e[_0x1df8('0x25')]['id']));}_0xd069a4=_0x354b2f;return db[_0x1df8('0x26')]['update']({'paused':0x1},{'where':{'UserId':_0xd069a4['id']},'individualHooks':!![]});})[_0x1df8('0x17')](function(){return db['MemberReport'][_0x1df8('0x27')]({'where':{'membername':_0xd069a4[_0x1df8('0x28')],'type':'PAUSE','exitAt':null}});})[_0x1df8('0x17')](function(_0x49f592){if(_0x49f592&&_0x49f592[_0x1df8('0x29')]){var _0x1a2f9a=moment()[_0x1df8('0x23')](_0x1df8('0x2a'));for(var _0x511c13=0x0,_0x21ad87=_0x49f592['length'];_0x511c13<_0x21ad87;_0x511c13++){_0x49f592[_0x511c13][_0x1df8('0x2b')]({'exitAt':_0x1a2f9a});}}})[_0x1df8('0x17')](function(){var _0x2e0668=[];var _0x5f2806=utils['getChannels']();_0x5f2806['forEach'](function(_0x339238){_0x2e0668[_0x1df8('0x2c')]({'channel':_0x339238,'membername':_0xd069a4[_0x1df8('0x28')],'interface':_[_0x1df8('0x2d')](_0xd069a4['interface'])?util[_0x1df8('0x23')](_0x1df8('0x2e'),_0xd069a4[_0x1df8('0x28')]):_0xd069a4[_0x1df8('0x22')],'type':'PAUSE','enterAt':moment()[_0x1df8('0x23')](_0x1df8('0x2a')),'data1':_0x5c244e['body'][_0x1df8('0x2f')]||_0x1df8('0x30'),'role':_0xd069a4[_0x1df8('0x21')],'internal':_0xd069a4[_0x1df8('0x31')],'uniqueid':_0x5c244e[_0x1df8('0x32')]['uniqueid']||null});});return db['MemberReport'][_0x1df8('0x33')](_0x2e0668,{'individualHooks':!![]});})['then'](function(){return _0xd069a4[_0x1df8('0x34')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x5c244e[_0x1df8('0x32')][_0x1df8('0x2f')]||_0x1df8('0x30'),'lastPauseAt':moment()[_0x1df8('0x23')](_0x1df8('0x2a'))});})[_0x1df8('0x1a')](function(_0x20cdea){throw _0x20cdea;});};exports[_0x1df8('0x35')]=function(_0x790e3b){return Promise[_0x1df8('0x36')]()[_0x1df8('0x17')](function(){if(_0x790e3b[_0x1df8('0x32')][_0x1df8('0x37')]&&!utils[_0x1df8('0x38')](_0x790e3b[_0x1df8('0x32')][_0x1df8('0x37')])){throw new Error(util[_0x1df8('0x23')](_0x1df8('0x39'),_0x790e3b[_0x1df8('0x32')][_0x1df8('0x37')]));}return db[_0x1df8('0x1e')][_0x1df8('0x3a')]({'where':_0x790e3b[_0x1df8('0xf')]['where']||{},'attributes':['id','name',_0x1df8('0x21'),_0x1df8('0x31'),'interface',_0x1df8('0x3b'),_0x1df8('0x3c'),_0x1df8('0x3d'),_0x1df8('0x3e'),_0x1df8('0x3f'),_0x1df8('0x40'),_0x1df8('0x41'),_0x1df8('0x42'),'pauseType',_0x1df8('0x43')]});})[_0x1df8('0x17')](function(_0x43600e){if(!_0x43600e){throw new Error(util[_0x1df8('0x23')]('User\x20with\x20id\x20%s\x20not\x20found',_0x790e3b[_0x1df8('0x25')]['id']));}return _0x43600e[_0x1df8('0x44')](_0x790e3b['body'][_0x1df8('0x37')],_0x1df8('0x45'));})['catch'](function(_0x115bdb){throw _0x115bdb;});};exports[_0x1df8('0x46')]=function(_0x4b21b0){var _0x4fa409=this;return new Promise(function(_0x252fbb,_0x206b24){var _0x2c0167;return db[_0x1df8('0x1e')][_0x1df8('0x3a')]({'where':_0x4b21b0[_0x1df8('0xf')][_0x1df8('0x11')]||{},'attributes':['id','name']})['then'](function(_0x1bf243){if(_0x1bf243){_0x2c0167=_0x1bf243;return db[_0x1df8('0x26')][_0x1df8('0x47')]({'where':{'membername':_0x2c0167[_0x1df8('0x28')]},'individualHooks':!![]});}})[_0x1df8('0x17')](function(){if(_0x2c0167){return db['MemberReport'][_0x1df8('0x27')]({'where':{'membername':_0x2c0167[_0x1df8('0x28')],'exitAt':null}});}})[_0x1df8('0x17')](function(_0x268f90){if(_0x2c0167){if(_0x268f90&&_0x268f90[_0x1df8('0x29')]){var _0x91c7ed=[];_0x268f90[_0x1df8('0x48')](function(_0x16eaa6){_0x91c7ed[_0x1df8('0x2c')](_0x16eaa6['update']({'exitAt':moment()['format'](_0x1df8('0x2a'))}));});return BPromise[_0x1df8('0x49')](_0x91c7ed);}}})[_0x1df8('0x17')](function(){if(_0x2c0167){return _0x2c0167['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x1df8('0x17')](function(_0xe2c0d6){_0x252fbb(_0xe2c0d6);})[_0x1df8('0x1a')](function(_0x45c15a){_0x206b24(_0x4fa409[_0x1df8('0x1b')](0x1f4,_0x45c15a[_0x1df8('0x1c')]));});});};exports[_0x1df8('0x4a')]=function(_0x42d5ce){var _0x114d53=this;return new Promise(function(_0x14ec83,_0x303123){var _0x4e6497;var _0x18959f;var _0x3de797;var _0xe5eb4d;return db[_0x1df8('0x1e')]['findOne']({'where':_0x42d5ce[_0x1df8('0xf')]['where']||{},'attributes':['id',_0x1df8('0x28'),_0x1df8('0x21'),_0x1df8('0x4b'),'phone',_0x1df8('0x31'),'loginInPause',_0x1df8('0x22')]})['then'](function(_0x31dcc1){if(_0x31dcc1){_0x4e6497=_0x31dcc1;_0xe5eb4d=_0x42d5ce[_0x1df8('0x32')][_0x1df8('0x22')]?_0x42d5ce[_0x1df8('0x32')]['interface']:util['format'](_0x1df8('0x2e'),_0x4e6497[_0x1df8('0x28')]);return db[_0x1df8('0x1e')][_0x1df8('0x4c')]({'where':{'role':_0x1df8('0x4d'),'online':!![],'id':{'$ne':_0x4e6497['id']}}});}})[_0x1df8('0x17')](function(_0x1cc706){if(_0x1cc706){_0x3de797=_0x1cc706;return require(_0x1df8('0x4e'))[_0x1df8('0x4f')]();}})[_0x1df8('0x17')](function(_0x34c4c2){if(_0x34c4c2&&_0x34c4c2[_0x1df8('0x50')]&&_0x3de797>=_0x34c4c2[_0x1df8('0x50')]){throw new Error(_0x1df8('0x51'));}})[_0x1df8('0x17')](function(){if(_0x4e6497){return db[_0x1df8('0x26')][_0x1df8('0x47')]({'where':{'membername':_0x4e6497[_0x1df8('0x28')]},'individualHooks':!![]});}})[_0x1df8('0x17')](function(){if(_0x4e6497){return _0x4e6497[_0x1df8('0x52')]({'raw':!![]});}})['then'](function(_0x4517b0){if(_0x4e6497){if(_0x4517b0){var _0x38f698=[];_0x18959f=_0x4517b0;if(_0x18959f[_0x1df8('0x29')]){for(var _0x57792a=0x0;_0x57792a<_0x18959f[_0x1df8('0x29')];_0x57792a++){_0x38f698[_0x1df8('0x2c')](db[_0x1df8('0x26')][_0x1df8('0x53')]({'membername':_0x4e6497['name'],'UserId':_0x4e6497['id'],'queue_name':_0x18959f[_0x57792a]['name'],'VoiceQueueId':_0x18959f[_0x57792a]['id'],'interface':_0xe5eb4d,'paused':_0x4e6497['loginInPause']||![],'penalty':_0x18959f[_0x57792a][_0x1df8('0x54')]||0x0}));}return BPromise['all'](_0x38f698);}}}})[_0x1df8('0x17')](function(){if(_0x4e6497){return db[_0x1df8('0x55')][_0x1df8('0x27')]({'where':{'membername':_0x4e6497[_0x1df8('0x28')],'exitAt':null}});}})[_0x1df8('0x17')](function(_0x41d757){if(_0x4e6497){if(_0x41d757&&_0x41d757['length']){var _0x54b95d=[];_0x41d757[_0x1df8('0x48')](function(_0x4a14c9){_0x54b95d[_0x1df8('0x2c')](_0x4a14c9[_0x1df8('0x34')]({'exitAt':moment()[_0x1df8('0x23')](_0x1df8('0x2a'))}));});return BPromise[_0x1df8('0x49')](_0x54b95d);}}})['then'](function(){if(_0x4e6497){var _0x5835f7=[];var _0x279b05=[];var _0x433c70=utils[_0x1df8('0x56')]();var _0x52f8c={'membername':_0x4e6497[_0x1df8('0x28')],'interface':_0xe5eb4d,'enterAt':moment()[_0x1df8('0x23')](_0x1df8('0x2a')),'role':_0x4e6497[_0x1df8('0x21')],'internal':_0x4e6497[_0x1df8('0x31')]};_0x433c70['forEach'](function(_0x4b46e9){_0x5835f7[_0x1df8('0x2c')](_[_0x1df8('0x57')]({'channel':_0x4b46e9,'type':_0x1df8('0x58'),'data1':'callysquare','data2':_0xe5eb4d},_0x52f8c));if(_0x4e6497[_0x1df8('0x59')]){_0x279b05[_0x1df8('0x2c')](_[_0x1df8('0x57')]({'channel':_0x4b46e9,'type':'PAUSE','data1':'LOGININPAUSE'},_0x52f8c));}});return db['MemberReport'][_0x1df8('0x33')](_0x5835f7['concat'](_0x279b05),{'individualHooks':!![]});}})[_0x1df8('0x17')](function(){if(_0x4e6497){return _0x4e6497[_0x1df8('0x34')]({'online':!![],'lastLoginAt':moment()[_0x1df8('0x23')](_0x1df8('0x2a')),'voicePause':_0x4e6497[_0x1df8('0x59')]||![],'mailPause':_0x4e6497[_0x1df8('0x59')]||![],'chatPause':_0x4e6497[_0x1df8('0x59')]||![],'faxPause':_0x4e6497[_0x1df8('0x59')]||![],'smsPause':_0x4e6497[_0x1df8('0x59')]||![],'openchannelPause':_0x4e6497[_0x1df8('0x59')]||![],'pauseType':_0x4e6497[_0x1df8('0x59')]?_0x1df8('0x5a'):null,'lastPauseAt':moment()[_0x1df8('0x23')](_0x1df8('0x2a')),'interface':_0xe5eb4d});}})[_0x1df8('0x17')](function(_0x5754a4){_0x14ec83(_0x5754a4);})[_0x1df8('0x1a')](function(_0x3f6c54){_0x303123(_0x114d53[_0x1df8('0x1b')](0x1f4,_0x3f6c54[_0x1df8('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index d0d0e2f..64d6f80 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 _0x7b80=['emit','removeListener','register','length','user:','save','update'];(function(_0x1be955,_0x415fc1){var _0x357f9b=function(_0x53ae45){while(--_0x53ae45){_0x1be955['push'](_0x1be955['shift']());}};_0x357f9b(++_0x415fc1);}(_0x7b80,0x67));var _0x07b8=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7b80[_0x4b369d];return _0x571a98;};'use strict';var UserEvents=require('./user.events');var events=[_0x07b8('0x0'),'remove',_0x07b8('0x1')];function createListener(_0x95ed6,_0x3499f2){return function(_0xaf1770){_0x3499f2[_0x07b8('0x2')](_0x95ed6,_0xaf1770);};}function removeListener(_0x4e30ea,_0xb5cce0){return function(){UserEvents[_0x07b8('0x3')](_0x4e30ea,_0xb5cce0);};}exports[_0x07b8('0x4')]=function(_0x120e7b){for(var _0x2a38ff=0x0,_0x4d51cb=events[_0x07b8('0x5')];_0x2a38ff<_0x4d51cb;_0x2a38ff++){var _0x53a39f=events[_0x2a38ff];var _0x17479f=createListener(_0x07b8('0x6')+_0x53a39f,_0x120e7b);UserEvents['on'](_0x53a39f,_0x17479f);}}; \ No newline at end of file +var _0x24ec=['removeListener','register','length','./user.events','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x24ec,0x147));var _0xc24e=function(_0x49fd03,_0x243aa0){_0x49fd03=_0x49fd03-0x0;var _0x405720=_0x24ec[_0x49fd03];return _0x405720;};'use strict';var UserEvents=require(_0xc24e('0x0'));var events=['save',_0xc24e('0x1'),'update'];function createListener(_0x5b5e90,_0x7724d0){return function(_0x2e4caf){_0x7724d0[_0xc24e('0x2')](_0x5b5e90,_0x2e4caf);};}function removeListener(_0x1511a3,_0x485e9c){return function(){UserEvents[_0xc24e('0x3')](_0x1511a3,_0x485e9c);};}exports[_0xc24e('0x4')]=function(_0x2fbad3){for(var _0x417134=0x0,_0x3af4b9=events[_0xc24e('0x5')];_0x417134<_0x3af4b9;_0x417134++){var _0x46844d=events[_0x417134];var _0x377ac2=createListener('user:'+_0x46844d,_0x2fbad3);UserEvents['on'](_0x46844d,_0x377ac2);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index aa88bd6..431dbad 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1de7e8,_0x355ee5){var _0x41b9ea=function(_0x4742eb){while(--_0x4742eb){_0x1de7e8['push'](_0x1de7e8['shift']());}};_0x41b9ea(++_0x355ee5);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x363fac,_0x479f13){var _0x53a343=function(_0x3fc856){while(--_0x3fc856){_0x363fac['push'](_0x363fac['shift']());}};_0x53a343(++_0x479f13);}(_0xe706,0xa3));var _0x6e70=function(_0x9f6f64,_0x4cd6df){_0x9f6f64=_0x9f6f64-0x0;var _0x3b9f5c=_0xe706[_0x9f6f64];return _0x3b9f5c;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index fe87320..467e995 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 _0x15ad=['sequelize','exports','INTEGER'];(function(_0x5380e1,_0x5c68ef){var _0x2e2400=function(_0x484ef0){while(--_0x484ef0){_0x5380e1['push'](_0x5380e1['shift']());}};_0x2e2400(++_0x5c68ef);}(_0x15ad,0x19b));var _0xd15a=function(_0xb88931,_0x2180eb){_0xb88931=_0xb88931-0x0;var _0x54c68f=_0x15ad[_0xb88931];return _0x54c68f;};'use strict';var Sequelize=require(_0xd15a('0x0'));module[_0xd15a('0x1')]={'penalty':{'type':Sequelize[_0xd15a('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb22e=['sequelize','exports','INTEGER'];(function(_0x1ee351,_0x54261b){var _0x245aaf=function(_0x3e4b65){while(--_0x3e4b65){_0x1ee351['push'](_0x1ee351['shift']());}};_0x245aaf(++_0x54261b);}(_0xb22e,0x81));var _0xeb22=function(_0x220860,_0x87b5ea){_0x220860=_0x220860-0x0;var _0x506932=_0xb22e[_0x220860];return _0x506932;};'use strict';var Sequelize=require(_0xeb22('0x0'));module[_0xeb22('0x1')]={'penalty':{'type':Sequelize[_0xeb22('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 a91ebe5..22e7433 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 _0x4fa4=['bluebird','path','./userChatQueue.attributes','exports','define','lodash','util','../../config/logger','moment'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x4fa4,0x125));var _0x44fa=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x4fa4[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0x44fa('0x0'));var util=require(_0x44fa('0x1'));var logger=require(_0x44fa('0x2'))('api');var moment=require(_0x44fa('0x3'));var BPromise=require(_0x44fa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x44fa('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x44fa('0x6'));module[_0x44fa('0x7')]=function(_0x3b3f2d,_0x178534){return _0x3b3f2d[_0x44fa('0x8')]('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd4b=['UserChatQueue','user_has_chat_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','./userChatQueue.attributes','define'];(function(_0x5a14dd,_0x55e143){var _0x43d8f6=function(_0x1d0e7d){while(--_0x1d0e7d){_0x5a14dd['push'](_0x5a14dd['shift']());}};_0x43d8f6(++_0x55e143);}(_0xdd4b,0x70));var _0xbdd4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xdd4b[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0xbdd4('0x0'));var logger=require(_0xbdd4('0x1'))(_0xbdd4('0x2'));var moment=require(_0xbdd4('0x3'));var BPromise=require('bluebird');var rp=require(_0xbdd4('0x4'));var fs=require('fs');var path=require(_0xbdd4('0x5'));var rimraf=require(_0xbdd4('0x6'));var config=require('../../config/environment');var attributes=require(_0xbdd4('0x7'));module['exports']=function(_0x2abd15,_0x4af720){return _0x2abd15[_0xbdd4('0x8')](_0xbdd4('0x9'),attributes,{'tableName':_0xbdd4('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 893ca80..13e2afd 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 _0xc134=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x4cdaa3,_0x3d40b6){var _0x317f6b=function(_0x237d5a){while(--_0x237d5a){_0x4cdaa3['push'](_0x4cdaa3['shift']());}};_0x317f6b(++_0x3d40b6);}(_0xc134,0xfc));var _0x4c13=function(_0x47b500,_0x47ae9a){_0x47b500=_0x47b500-0x0;var _0x59963a=_0xc134[_0x47b500];return _0x59963a;};'use strict';var _=require(_0x4c13('0x0'));var util=require(_0x4c13('0x1'));var moment=require(_0x4c13('0x2'));var BPromise=require(_0x4c13('0x3'));var rs=require(_0x4c13('0x4'));var fs=require('fs');var Redis=require(_0x4c13('0x5'));var db=require(_0x4c13('0x6'))['db'];var utils=require(_0x4c13('0x7'));var logger=require('../../config/logger')(_0x4c13('0x8'));var config=require(_0x4c13('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4c13('0xa')][_0x4c13('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e0d62,_0xfcb83e,_0x167151){return new BPromise(function(_0x59d61a,_0xf1dbe6){return client[_0x4c13('0xc')](_0x4e0d62,_0x167151)['then'](function(_0x36a0ca){logger['info'](_0x4c13('0xd'),_0xfcb83e,_0x4c13('0xe'));logger[_0x4c13('0xf')](_0x4c13('0x10'),_0xfcb83e,_0x4c13('0xe'),JSON[_0x4c13('0x11')](_0x36a0ca));if(_0x36a0ca[_0x4c13('0x12')]){if(_0x36a0ca['error'][_0x4c13('0x13')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0xfcb83e,_0x36a0ca[_0x4c13('0x12')][_0x4c13('0x14')]);return _0xf1dbe6(_0x36a0ca[_0x4c13('0x12')][_0x4c13('0x14')]);}logger[_0x4c13('0x12')]('UserChatQueue,\x20%s,\x20%s',_0xfcb83e,_0x36a0ca[_0x4c13('0x12')]['message']);return _0x59d61a(_0x36a0ca[_0x4c13('0x12')][_0x4c13('0x14')]);}else{logger['info'](_0x4c13('0xd'),_0xfcb83e,_0x4c13('0xe'));_0x59d61a(_0x36a0ca[_0x4c13('0x15')][_0x4c13('0x14')]);}})[_0x4c13('0x16')](function(_0x475883){logger[_0x4c13('0x12')](_0x4c13('0xd'),_0xfcb83e,_0x475883);_0xf1dbe6(_0x475883);});});} \ No newline at end of file +var _0xce95=['error','code','message','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x32f4b2,_0x52fb01){var _0x426dab=function(_0xf3f5e0){while(--_0xf3f5e0){_0x32f4b2['push'](_0x32f4b2['shift']());}};_0x426dab(++_0x52fb01);}(_0xce95,0x7b));var _0x5ce9=function(_0x4a3eef,_0x16388a){_0x4a3eef=_0x4a3eef-0x0;var _0x2d5b79=_0xce95[_0x4a3eef];return _0x2d5b79;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5ce9('0x0'));var BPromise=require('bluebird');var rs=require(_0x5ce9('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ce9('0x2'))['db'];var utils=require(_0x5ce9('0x3'));var logger=require(_0x5ce9('0x4'))('rpc');var config=require(_0x5ce9('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x5ce9('0x6')][_0x5ce9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4d724b,_0x5bc268,_0x33ab0f){return new BPromise(function(_0x591cc1,_0x5c799c){return client[_0x5ce9('0x8')](_0x4d724b,_0x33ab0f)['then'](function(_0x1c00c8){logger[_0x5ce9('0x9')](_0x5ce9('0xa'),_0x5bc268,_0x5ce9('0xb'));logger[_0x5ce9('0xc')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x5bc268,_0x5ce9('0xb'),JSON['stringify'](_0x1c00c8));if(_0x1c00c8[_0x5ce9('0xd')]){if(_0x1c00c8[_0x5ce9('0xd')][_0x5ce9('0xe')]===0x1f4){logger[_0x5ce9('0xd')](_0x5ce9('0xa'),_0x5bc268,_0x1c00c8[_0x5ce9('0xd')][_0x5ce9('0xf')]);return _0x5c799c(_0x1c00c8[_0x5ce9('0xd')]['message']);}logger[_0x5ce9('0xd')](_0x5ce9('0xa'),_0x5bc268,_0x1c00c8[_0x5ce9('0xd')]['message']);return _0x591cc1(_0x1c00c8[_0x5ce9('0xd')]['message']);}else{logger[_0x5ce9('0x9')](_0x5ce9('0xa'),_0x5bc268,'request\x20sent');_0x591cc1(_0x1c00c8['result'][_0x5ce9('0xf')]);}})[_0x5ce9('0x10')](function(_0x4ed325){logger[_0x5ce9('0xd')](_0x5ce9('0xa'),_0x5bc268,_0x4ed325);_0x5c799c(_0x4ed325);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 29cb72d..a1f1659 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5917c6,_0x4ab61c){var _0x300671=function(_0x1f390e){while(--_0x1f390e){_0x5917c6['push'](_0x5917c6['shift']());}};_0x300671(++_0x4ab61c);}(_0xe706,0xa3));var _0x6e70=function(_0x19b4ce,_0x187040){_0x19b4ce=_0x19b4ce-0x0;var _0x180b52=_0xe706[_0x19b4ce];return _0x180b52;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xf671b3,_0x37f4f7){var _0x3b6447=function(_0x1436f0){while(--_0x1436f0){_0xf671b3['push'](_0xf671b3['shift']());}};_0x3b6447(++_0x37f4f7);}(_0x70e0,0x17b));var _0x070e=function(_0x4d31aa,_0x5e9ba0){_0x4d31aa=_0x4d31aa-0x0;var _0x527373=_0x70e0[_0x4d31aa];return _0x527373;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index d04f804..590ad1b 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 _0xf409=['sequelize','exports','INTEGER','STRING'];(function(_0x201b91,_0x1abb8d){var _0x39b397=function(_0x27f603){while(--_0x27f603){_0x201b91['push'](_0x201b91['shift']());}};_0x39b397(++_0x1abb8d);}(_0xf409,0x1bc));var _0x9f40=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xf409[_0xdc37a1];return _0x99b4fe;};'use strict';var Sequelize=require(_0x9f40('0x0'));module[_0x9f40('0x1')]={'penalty':{'type':Sequelize[_0x9f40('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9f40('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x9f40('0x3')]}}; \ No newline at end of file +var _0x5cbf=['sequelize','INTEGER','STRING'];(function(_0x558e45,_0x4f5e4f){var _0x3e9075=function(_0x289725){while(--_0x289725){_0x558e45['push'](_0x558e45['shift']());}};_0x3e9075(++_0x4f5e4f);}(_0x5cbf,0x1d4));var _0xf5cb=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x5cbf[_0x47aa64];return _0x549c7a;};'use strict';var Sequelize=require(_0xf5cb('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xf5cb('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf5cb('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xf5cb('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index eed0e66..16eaf78 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 _0x99eb=['lodash','util','moment','bluebird','request-promise','path','rimraf','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues'];(function(_0x1f81cc,_0x2cfcfd){var _0x4484d8=function(_0x3ea88e){while(--_0x3ea88e){_0x1f81cc['push'](_0x1f81cc['shift']());}};_0x4484d8(++_0x2cfcfd);}(_0x99eb,0xf0));var _0xb99e=function(_0x22b683,_0x3aacc2){_0x22b683=_0x22b683-0x0;var _0x3b35e3=_0x99eb[_0x22b683];return _0x3b35e3;};'use strict';var _=require(_0xb99e('0x0'));var util=require(_0xb99e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb99e('0x2'));var BPromise=require(_0xb99e('0x3'));var rp=require(_0xb99e('0x4'));var fs=require('fs');var path=require(_0xb99e('0x5'));var rimraf=require(_0xb99e('0x6'));var config=require('../../config/environment');var attributes=require(_0xb99e('0x7'));module[_0xb99e('0x8')]=function(_0x521629,_0x219c98){return _0x521629[_0xb99e('0x9')](_0xb99e('0xa'),attributes,{'tableName':_0xb99e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb91f=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','user_has_fax_queues','util','../../config/logger'];(function(_0x5b41c2,_0x59461b){var _0x30bf4f=function(_0x52a746){while(--_0x52a746){_0x5b41c2['push'](_0x5b41c2['shift']());}};_0x30bf4f(++_0x59461b);}(_0xb91f,0x102));var _0xfb91=function(_0x3b9ad0,_0x2fa3f5){_0x3b9ad0=_0x3b9ad0-0x0;var _0xd8aee0=_0xb91f[_0x3b9ad0];return _0xd8aee0;};'use strict';var _=require('lodash');var util=require(_0xfb91('0x0'));var logger=require(_0xfb91('0x1'))('api');var moment=require('moment');var BPromise=require(_0xfb91('0x2'));var rp=require(_0xfb91('0x3'));var fs=require('fs');var path=require(_0xfb91('0x4'));var rimraf=require(_0xfb91('0x5'));var config=require(_0xfb91('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0xfb91('0x7')]=function(_0x5dc1d8,_0x529b96){return _0x5dc1d8[_0xfb91('0x8')]('UserFaxQueue',attributes,{'tableName':_0xfb91('0x9'),'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 eeb5c7f..170d035 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 _0xfc6e=['jayson/promise','client','http','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment'];(function(_0x4fb0af,_0xe61f22){var _0x20b697=function(_0x21564a){while(--_0x21564a){_0x4fb0af['push'](_0x4fb0af['shift']());}};_0x20b697(++_0xe61f22);}(_0xfc6e,0x133));var _0xefc6=function(_0x56739b,_0x2d2cc9){_0x56739b=_0x56739b-0x0;var _0x1c752f=_0xfc6e[_0x56739b];return _0x1c752f;};'use strict';var _=require(_0xefc6('0x0'));var util=require(_0xefc6('0x1'));var moment=require(_0xefc6('0x2'));var BPromise=require(_0xefc6('0x3'));var rs=require(_0xefc6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xefc6('0x5'))(_0xefc6('0x6'));var config=require(_0xefc6('0x7'));var jayson=require(_0xefc6('0x8'));var client=jayson[_0xefc6('0x9')][_0xefc6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbfaf91,_0x49d07a,_0x43c628){return new BPromise(function(_0xfed80b,_0x27f298){return client['request'](_0xbfaf91,_0x43c628)['then'](function(_0x760b1f){logger[_0xefc6('0xb')](_0xefc6('0xc'),_0x49d07a,_0xefc6('0xd'));logger[_0xefc6('0xe')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x49d07a,_0xefc6('0xd'),JSON[_0xefc6('0xf')](_0x760b1f));if(_0x760b1f[_0xefc6('0x10')]){if(_0x760b1f[_0xefc6('0x10')][_0xefc6('0x11')]===0x1f4){logger[_0xefc6('0x10')](_0xefc6('0xc'),_0x49d07a,_0x760b1f[_0xefc6('0x10')]['message']);return _0x27f298(_0x760b1f[_0xefc6('0x10')]['message']);}logger[_0xefc6('0x10')](_0xefc6('0xc'),_0x49d07a,_0x760b1f['error'][_0xefc6('0x12')]);return _0xfed80b(_0x760b1f['error'][_0xefc6('0x12')]);}else{logger[_0xefc6('0xb')](_0xefc6('0xc'),_0x49d07a,_0xefc6('0xd'));_0xfed80b(_0x760b1f[_0xefc6('0x13')]['message']);}})[_0xefc6('0x14')](function(_0x36ba6a){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x49d07a,_0x36ba6a);_0x27f298(_0x36ba6a);});});} \ No newline at end of file +var _0x0674=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','util','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0674,0x17a));var _0x4067=function(_0x19b002,_0x4027ca){_0x19b002=_0x19b002-0x0;var _0x777a08=_0x0674[_0x19b002];return _0x777a08;};'use strict';var _=require('lodash');var util=require(_0x4067('0x0'));var moment=require(_0x4067('0x1'));var BPromise=require(_0x4067('0x2'));var rs=require(_0x4067('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4067('0x4'))['db'];var utils=require(_0x4067('0x5'));var logger=require(_0x4067('0x6'))('rpc');var config=require(_0x4067('0x7'));var jayson=require(_0x4067('0x8'));var client=jayson[_0x4067('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23757e,_0x83c699,_0x54916d){return new BPromise(function(_0x39992d,_0x33c318){return client['request'](_0x23757e,_0x54916d)[_0x4067('0xa')](function(_0x267f96){logger[_0x4067('0xb')](_0x4067('0xc'),_0x83c699,'request\x20sent');logger[_0x4067('0xd')](_0x4067('0xe'),_0x83c699,_0x4067('0xf'),JSON[_0x4067('0x10')](_0x267f96));if(_0x267f96[_0x4067('0x11')]){if(_0x267f96[_0x4067('0x11')]['code']===0x1f4){logger[_0x4067('0x11')](_0x4067('0xc'),_0x83c699,_0x267f96[_0x4067('0x11')][_0x4067('0x12')]);return _0x33c318(_0x267f96['error'][_0x4067('0x12')]);}logger['error'](_0x4067('0xc'),_0x83c699,_0x267f96[_0x4067('0x11')][_0x4067('0x12')]);return _0x39992d(_0x267f96[_0x4067('0x11')][_0x4067('0x12')]);}else{logger[_0x4067('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x83c699,'request\x20sent');_0x39992d(_0x267f96['result'][_0x4067('0x12')]);}})[_0x4067('0x13')](function(_0x58ba98){logger[_0x4067('0x11')](_0x4067('0xc'),_0x83c699,_0x58ba98);_0x33c318(_0x58ba98);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 8af6501..c8e6ff4 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x7c5834,_0xa96cfb){var _0x40becf=function(_0x579649){while(--_0x579649){_0x7c5834['push'](_0x7c5834['shift']());}};_0x40becf(++_0xa96cfb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xc144be,_0x385142){var _0x4ffd89=function(_0x4d5ca1){while(--_0x4d5ca1){_0xc144be['push'](_0xc144be['shift']());}};_0x4ffd89(++_0x385142);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 8014600..4ceca60 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 _0xd2a3=['exports','sequelize'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd2a3,0x12d));var _0x3d2a=function(_0x15c929,_0x2b3902){_0x15c929=_0x15c929-0x0;var _0x518d15=_0xd2a3[_0x15c929];return _0x518d15;};'use strict';var Sequelize=require(_0x3d2a('0x0'));module[_0x3d2a('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xcdce=['exports','INTEGER','sequelize'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xcdce,0xad));var _0xecdc=function(_0x43973e,_0x119e5d){_0x43973e=_0x43973e-0x0;var _0x26f1d2=_0xcdce[_0x43973e];return _0x26f1d2;};'use strict';var Sequelize=require(_0xecdc('0x0'));module[_0xecdc('0x1')]={'penalty':{'type':Sequelize[_0xecdc('0x2')],'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 97f104a..73755d6 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 _0xdb3d=['define','UserMailQueue','user_has_mail_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x399486,_0x5319d4){var _0x381361=function(_0x1b90de){while(--_0x1b90de){_0x399486['push'](_0x399486['shift']());}};_0x381361(++_0x5319d4);}(_0xdb3d,0x9f));var _0xddb3=function(_0x1846e2,_0xe66a3a){_0x1846e2=_0x1846e2-0x0;var _0x626282=_0xdb3d[_0x1846e2];return _0x626282;};'use strict';var _=require('lodash');var util=require(_0xddb3('0x0'));var logger=require(_0xddb3('0x1'))(_0xddb3('0x2'));var moment=require(_0xddb3('0x3'));var BPromise=require(_0xddb3('0x4'));var rp=require(_0xddb3('0x5'));var fs=require('fs');var path=require(_0xddb3('0x6'));var rimraf=require(_0xddb3('0x7'));var config=require(_0xddb3('0x8'));var attributes=require('./userMailQueue.attributes');module[_0xddb3('0x9')]=function(_0x19bb5f,_0x337392){return _0x19bb5f[_0xddb3('0xa')](_0xddb3('0xb'),attributes,{'tableName':_0xddb3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b1b=['bluebird','rimraf','../../config/environment','./userMailQueue.attributes','exports','lodash','../../config/logger','api','moment'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6b1b,0x1e2));var _0xb6b1=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x6b1b[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0xb6b1('0x0'));var util=require('util');var logger=require(_0xb6b1('0x1'))(_0xb6b1('0x2'));var moment=require(_0xb6b1('0x3'));var BPromise=require(_0xb6b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb6b1('0x5'));var config=require(_0xb6b1('0x6'));var attributes=require(_0xb6b1('0x7'));module[_0xb6b1('0x8')]=function(_0x471c6d,_0x4bc411){return _0x471c6d['define']('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 2e597cc..2fb9971 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 _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x1b2f9c,_0x286beb){var _0x6eaa50=function(_0x39e74c){while(--_0x39e74c){_0x1b2f9c['push'](_0x1b2f9c['shift']());}};_0x6eaa50(++_0x286beb);}(_0x4b84,0x1cc));var _0x44b8=function(_0xb68772,_0x5253ac){_0xb68772=_0xb68772-0x0;var _0x4189bb=_0x4b84[_0xb68772];return _0x4189bb;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x1ec462,_0x5a00ef){var _0x4792eb=function(_0x5e2cc5){while(--_0x5e2cc5){_0x1ec462['push'](_0x1ec462['shift']());}};_0x4792eb(++_0x5a00ef);}(_0x34e8,0x12c));var _0x834e=function(_0x301e4d,_0x2afe6a){_0x301e4d=_0x301e4d-0x0;var _0x12d4d2=_0x34e8[_0x301e4d];return _0x12d4d2;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index cab898a..c7a19a8 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 _0x3973=['fs-extra','../../components/interaction/service','../../config/environment','post','isAuthenticated','multer','util','connect-timeout','express','Router'];(function(_0x4a6229,_0x3e5424){var _0x369f1e=function(_0x293472){while(--_0x293472){_0x4a6229['push'](_0x4a6229['shift']());}};_0x369f1e(++_0x3e5424);}(_0x3973,0x9b));var _0x3397=function(_0x244bb2,_0x5358fc){_0x244bb2=_0x244bb2-0x0;var _0x35a396=_0x3973[_0x244bb2];return _0x35a396;};'use strict';var multer=require(_0x3397('0x0'));var util=require(_0x3397('0x1'));var path=require('path');var timeout=require(_0x3397('0x2'));var express=require(_0x3397('0x3'));var router=express[_0x3397('0x4')]();var fs_extra=require(_0x3397('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3397('0x6'));var config=require(_0x3397('0x7'));var controller=require('./userNotification.controller');router[_0x3397('0x8')]('/',auth[_0x3397('0x9')](),controller['sendUserNotification']);module['exports']=router; \ No newline at end of file +var _0xf332=['util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','sendUserNotification','exports','multer'];(function(_0x54fc7d,_0x3dc24c){var _0xa487de=function(_0x3c4b68){while(--_0x3c4b68){_0x54fc7d['push'](_0x54fc7d['shift']());}};_0xa487de(++_0x3dc24c);}(_0xf332,0x16a));var _0x2f33=function(_0x5ee4b1,_0x1b2a93){_0x5ee4b1=_0x5ee4b1-0x0;var _0x517050=_0xf332[_0x5ee4b1];return _0x517050;};'use strict';var multer=require(_0x2f33('0x0'));var util=require(_0x2f33('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2f33('0x2'));var router=express['Router']();var fs_extra=require(_0x2f33('0x3'));var auth=require(_0x2f33('0x4'));var interaction=require(_0x2f33('0x5'));var config=require(_0x2f33('0x6'));var controller=require(_0x2f33('0x7'));router[_0x2f33('0x8')]('/',auth['isAuthenticated'](),controller[_0x2f33('0x9')]);module[_0x2f33('0xa')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index bebeaa0..32d8f23 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 _0x316d=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x3c9864,_0x488a3c){var _0x416dcd=function(_0x3f03d6){while(--_0x3f03d6){_0x3c9864['push'](_0x3c9864['shift']());}};_0x416dcd(++_0x488a3c);}(_0x316d,0xfe));var _0xd316=function(_0x424065,_0x572f82){_0x424065=_0x424065-0x0;var _0x2b6c16=_0x316d[_0x424065];return _0x2b6c16;};'use strict';var Sequelize=require(_0xd316('0x0'));module[_0xd316('0x1')]={'body':{'type':Sequelize[_0xd316('0x2')]},'senderName':{'type':Sequelize[_0xd316('0x3')]},'recipientsId':{'type':Sequelize[_0xd316('0x2')]},'recipientsDescription':{'type':Sequelize[_0xd316('0x3')]},'beep':{'type':Sequelize[_0xd316('0x4')]}}; \ No newline at end of file +var _0x8cb0=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x4bece4,_0x1288eb){var _0x19d5c5=function(_0x165a05){while(--_0x165a05){_0x4bece4['push'](_0x4bece4['shift']());}};_0x19d5c5(++_0x1288eb);}(_0x8cb0,0x168));var _0x08cb=function(_0x403b85,_0x1b0d02){_0x403b85=_0x403b85-0x0;var _0x6290d7=_0x8cb0[_0x403b85];return _0x6290d7;};'use strict';var Sequelize=require(_0x08cb('0x0'));module[_0x08cb('0x1')]={'body':{'type':Sequelize[_0x08cb('0x2')]},'senderName':{'type':Sequelize[_0x08cb('0x3')]},'recipientsId':{'type':Sequelize[_0x08cb('0x2')]},'recipientsDescription':{'type':Sequelize[_0x08cb('0x3')]},'beep':{'type':Sequelize[_0x08cb('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 79dea5e..46461da 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 _0xb6f5=['sequelize','transaction','create','forEach','emit','userNotification:send','catch','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','User','ids','replace','queue','Queue','all','findOne','getAgents','map','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','reject','save','then','end','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','recipientsId','join'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xb6f5,0x194));var _0x5b6f=function(_0x58efa6,_0x2c00bd){_0x58efa6=_0x58efa6-0x0;var _0x5d643c=_0xb6f5[_0x58efa6];return _0x5d643c;};'use strict';var emlformat=require(_0x5b6f('0x0'));var rimraf=require(_0x5b6f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5b6f('0x2'));var rp=require(_0x5b6f('0x3'));var moment=require(_0x5b6f('0x4'));var BPromise=require(_0x5b6f('0x5'));var Mustache=require(_0x5b6f('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5b6f('0x7'));var ejs=require(_0x5b6f('0x8'));var fs=require('fs');var fs_extra=require(_0x5b6f('0x9'));var _=require(_0x5b6f('0xa'));var squel=require('squel');var crypto=require(_0x5b6f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5b6f('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5b6f('0xd'));var Papa=require(_0x5b6f('0xe'));var Redis=require(_0x5b6f('0xf'));var authService=require(_0x5b6f('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5b6f('0x11'));var logger=require('../../config/logger')(_0x5b6f('0x12'));var utils=require(_0x5b6f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5b6f('0x14'));var db=require('../../mysqldb')['db'];config[_0x5b6f('0x15')]=_[_0x5b6f('0x16')](config[_0x5b6f('0x15')],{'host':_0x5b6f('0x17'),'port':0x18eb});var socket=require(_0x5b6f('0x18'))(new Redis(config[_0x5b6f('0x15')]));require(_0x5b6f('0x19'))[_0x5b6f('0x1a')](socket);function respondWithStatusCode(_0x3e9564,_0x6c2be5){_0x6c2be5=_0x6c2be5||0xcc;return function(_0x2f4ac6){if(_0x2f4ac6){return _0x3e9564[_0x5b6f('0x1b')](_0x6c2be5);}return _0x3e9564['status'](_0x6c2be5)['end']();};}function respondWithResult(_0x5801a7,_0xedd53b){_0xedd53b=_0xedd53b||0xc8;return function(_0x4184fc){if(_0x4184fc){return _0x5801a7[_0x5b6f('0x1c')](_0xedd53b)['json'](_0x4184fc);}};}function respondWithFilteredResult(_0x50112f,_0x26f655){return function(_0x18d522){if(_0x18d522){var _0x86c131=typeof _0x26f655[_0x5b6f('0x1d')]===_0x5b6f('0x1e')&&typeof _0x26f655['limit']===_0x5b6f('0x1e');var _0x211626=_0x18d522['count'];var _0x132012=_0x86c131?0x0:_0x26f655['offset'];var _0x5aeeee=_0x86c131?_0x18d522['count']:_0x26f655[_0x5b6f('0x1d')]+_0x26f655[_0x5b6f('0x1f')];var _0x46e54b;if(_0x5aeeee>=_0x211626){_0x5aeeee=_0x211626;_0x46e54b=0xc8;}else{_0x46e54b=0xce;}_0x50112f['status'](_0x46e54b);return _0x50112f[_0x5b6f('0x20')](_0x5b6f('0x21'),_0x132012+'-'+_0x5aeeee+'/'+_0x211626)[_0x5b6f('0x22')](_0x18d522);}return null;};}function patchUpdates(_0x1a7de9){return function(_0x120b0d){try{jsonpatch[_0x5b6f('0x23')](_0x120b0d,_0x1a7de9,!![]);}catch(_0x19a00d){return BPromise[_0x5b6f('0x24')](_0x19a00d);}return _0x120b0d[_0x5b6f('0x25')]();};}function saveUpdates(_0x2a9d3c,_0x310909){return function(_0xefa6f9){if(_0xefa6f9){return _0xefa6f9['update'](_0x2a9d3c)[_0x5b6f('0x26')](function(_0x24f36a){return _0x24f36a;});}return null;};}function removeEntity(_0x3cd345,_0x4aa3bc){return function(_0x242022){if(_0x242022){return _0x242022['destroy']()[_0x5b6f('0x26')](function(){_0x3cd345[_0x5b6f('0x1c')](0xcc)[_0x5b6f('0x27')]();});}};}function handleEntityNotFound(_0xcfa476,_0x1699b8){return function(_0x134c3a){if(!_0x134c3a){_0xcfa476[_0x5b6f('0x1b')](0x194);}return _0x134c3a;};}function handleError(_0x5c03c9,_0x2146ea){_0x2146ea=_0x2146ea||0x1f4;return function(_0x13f020){logger['error'](_0x13f020[_0x5b6f('0x28')]);if(_0x13f020['name']){delete _0x13f020[_0x5b6f('0x29')];}_0x5c03c9[_0x5b6f('0x1c')](_0x2146ea)[_0x5b6f('0x2a')](_0x13f020);};}exports[_0x5b6f('0x2b')]=function(_0x28f000,_0xd439c,_0x4c84e5){if(!_0x28f000[_0x5b6f('0x2c')][_0x5b6f('0x2d')](_0x5b6f('0x2e'))&&!_0x28f000[_0x5b6f('0x2c')]['hasOwnProperty'](_0x5b6f('0x2f'))){throw new db[(_0x5b6f('0x30'))]['ValidationError'](_0x5b6f('0x31'));}else{if(_0x28f000[_0x5b6f('0x2c')]['hasOwnProperty'](_0x5b6f('0x2f'))&&!_0x28f000[_0x5b6f('0x2c')][_0x5b6f('0x2d')](_0x5b6f('0x32'))){throw new db[(_0x5b6f('0x30'))][(_0x5b6f('0x33'))](_0x5b6f('0x34'));}if(!_0x28f000['body']['hasOwnProperty']('recipients')){throw new db[(_0x5b6f('0x30'))][(_0x5b6f('0x33'))](_0x5b6f('0x35'));}else{try{var _0x367a10=JSON[_0x5b6f('0x36')](_0x28f000[_0x5b6f('0x2c')][_0x5b6f('0x37')]);}catch(_0x3f9ff9){logger[_0x5b6f('0x38')](_0x3f9ff9);throw new db['Sequelize'][(_0x5b6f('0x33'))](_0x5b6f('0x39'));}var _0x5310ad=[_0x5b6f('0x3a'),'faxqueue','mailqueue',_0x5b6f('0x3b'),_0x5b6f('0x3c'),_0x5b6f('0x3d'),_0x5b6f('0x3e'),_0x5b6f('0x3f'),_0x5b6f('0x40')];if(_['some'](_0x367a10,function(_0x54ed31){return!_[_0x5b6f('0x41')](_0x5310ad,_0x54ed31[_0x5b6f('0x42')][_0x5b6f('0x43')]());})){throw new db['Sequelize'][(_0x5b6f('0x33'))](_0x5b6f('0x44'));}}}var _0x221151={};_0x221151[_0x5b6f('0x45')]=_0x28f000[_0x5b6f('0x2c')][_0x5b6f('0x2d')](_0x5b6f('0x45'))?_0x28f000[_0x5b6f('0x2c')][_0x5b6f('0x45')]:_0x28f000[_0x5b6f('0x40')][_0x5b6f('0x46')];_0x221151[_0x5b6f('0x47')]=_[_0x5b6f('0x48')](_0x28f000[_0x5b6f('0x2c')][_0x5b6f('0x47')])?null:_0x28f000['body'][_0x5b6f('0x47')];_0x221151[_0x5b6f('0x49')]=_0x28f000[_0x5b6f('0x2c')][_0x5b6f('0x49')]||![];_0x221151['SenderId']=_0x28f000['user']['id'];return getContent(_0x28f000['body'])[_0x5b6f('0x26')](function(_0xbad9fe){_0x221151[_0x5b6f('0x2c')]=_0xbad9fe;return getRecipients(_0x367a10);})[_0x5b6f('0x26')](function(_0x4222da){_0x221151[_0x5b6f('0x4a')]=_['sortBy'](_0x4222da)[_0x5b6f('0x4b')](',');return db[_0x5b6f('0x4c')][_0x5b6f('0x4d')](function(_0x460dea){return db['UserNotification'][_0x5b6f('0x4e')](_0x221151,{'raw':!![],'transaction':_0x460dea})[_0x5b6f('0x26')](function(_0x30fcdd){var _0xb5364c={'sender':_0x221151['senderName'],'description':_0x221151['recipientsDescription'],'content':_0x221151['body'],'beep':_0x221151[_0x5b6f('0x49')]};_0x4222da[_0x5b6f('0x4f')](function(_0x1ddc27){_0xb5364c['recipient']=_0x1ddc27;socket[_0x5b6f('0x50')](_0x5b6f('0x51'),_0xb5364c);});return _0x30fcdd;});});})[_0x5b6f('0x26')](respondWithResult(_0xd439c,0xc9))[_0x5b6f('0x52')](handleError(_0xd439c,null));};function getContent(_0x3626d6){return new BPromise(function(_0x383c50,_0x241721){if(_0x3626d6[_0x5b6f('0x2e')]){_0x383c50(_0x3626d6[_0x5b6f('0x2e')]);return;}return db[_0x5b6f('0x53')]['findOne']({'attributes':[_0x5b6f('0x54')],'where':{'id':_0x3626d6[_0x5b6f('0x2f')]},'raw':!![]})[_0x5b6f('0x26')](function(_0x49d6f6){if(!_0x49d6f6)throw new db[(_0x5b6f('0x30'))][(_0x5b6f('0x33'))](_0x5b6f('0x55'));var _0x1fe008=Mustache['render'](_0x49d6f6[_0x5b6f('0x54')],_0x3626d6[_0x5b6f('0x32')]);_0x383c50(_0x1fe008);})['catch'](function(_0x7d9904){_0x241721(_0x7d9904);});});}function getRecipients(_0x238046){return new BPromise(function(_0x2692f2,_0x19b705){var _0x1a06e5=[];var _0x2d5390=[];_0x238046['forEach'](function(_0x203b1c){var _0x3882ea=_[_0x5b6f('0x56')](_0x203b1c[_0x5b6f('0x42')][_0x5b6f('0x43')]());if(_0x3882ea===_0x5b6f('0x57')){_0x1a06e5=_['union'](_0x1a06e5,_0x203b1c[_0x5b6f('0x58')]);}else{if(_[_0x5b6f('0x41')](_0x3882ea,'queue'))_0x3882ea=_0x3882ea[_0x5b6f('0x59')](_0x5b6f('0x5a'),_0x5b6f('0x5b'));_0x203b1c['ids']['forEach'](function(_0x3fced9){_0x2d5390['push'](getAgents(_0x3882ea,_0x3fced9));});}});return BPromise[_0x5b6f('0x5c')](_0x2d5390)[_0x5b6f('0x26')](function(_0x1a6148){_0x1a06e5=_['union'](_0x1a06e5,_['flatten'](_0x1a6148));_0x2692f2(_0x1a06e5);})[_0x5b6f('0x52')](function(_0x234619){_0x19b705(_0x234619);});});}function getAgents(_0x2f257a,_0x26bdb8){return new BPromise(function(_0x4a4eb7,_0x18963a){return db[_0x2f257a][_0x5b6f('0x5d')]({'where':{'id':_0x26bdb8}})[_0x5b6f('0x26')](function(_0x320558){return _0x320558[_0x5b6f('0x5e')]({'attributes':['id'],'raw':!![]})['then'](function(_0x510634){var _0x555930=_[_0x5b6f('0x5f')](_0x510634,'id');_0x4a4eb7(_0x555930);});})[_0x5b6f('0x52')](function(_0x59d38e){_0x18963a(_0x59d38e);});});} \ No newline at end of file +var _0x7ae5=['isEmpty','recipientsDescription','beep','then','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','recipient','catch','Template','findOne','html','forEach','User','ids','includes','queue','replace','Queue','push','all','union','flatten','getAgents','map','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','error','stack','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','user','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname'];(function(_0x132fe1,_0x2a5861){var _0x3e9f38=function(_0x1bb681){while(--_0x1bb681){_0x132fe1['push'](_0x132fe1['shift']());}};_0x3e9f38(++_0x2a5861);}(_0x7ae5,0xeb));var _0x57ae=function(_0xb5646e,_0x327fd7){_0xb5646e=_0xb5646e-0x0;var _0x55fe64=_0x7ae5[_0xb5646e];return _0x55fe64;};'use strict';var emlformat=require(_0x57ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x57ae('0x1'));var jsonpatch=require(_0x57ae('0x2'));var rp=require(_0x57ae('0x3'));var moment=require(_0x57ae('0x4'));var BPromise=require(_0x57ae('0x5'));var Mustache=require(_0x57ae('0x6'));var util=require('util');var path=require(_0x57ae('0x7'));var sox=require(_0x57ae('0x8'));var csv=require(_0x57ae('0x9'));var ejs=require(_0x57ae('0xa'));var fs=require('fs');var fs_extra=require(_0x57ae('0xb'));var _=require(_0x57ae('0xc'));var squel=require(_0x57ae('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x57ae('0xe'));var toCsv=require('to-csv');var querystring=require(_0x57ae('0xf'));var Papa=require(_0x57ae('0x10'));var Redis=require(_0x57ae('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x57ae('0x12'));var as=require(_0x57ae('0x13'));var hardwareService=require(_0x57ae('0x14'));var logger=require('../../config/logger')(_0x57ae('0x15'));var utils=require(_0x57ae('0x16'));var config=require(_0x57ae('0x17'));var licenseUtil=require(_0x57ae('0x18'));var db=require(_0x57ae('0x19'))['db'];config[_0x57ae('0x1a')]=_[_0x57ae('0x1b')](config[_0x57ae('0x1a')],{'host':_0x57ae('0x1c'),'port':0x18eb});var socket=require(_0x57ae('0x1d'))(new Redis(config[_0x57ae('0x1a')]));require(_0x57ae('0x1e'))[_0x57ae('0x1f')](socket);function respondWithStatusCode(_0x4cf629,_0x32a010){_0x32a010=_0x32a010||0xcc;return function(_0x25e10a){if(_0x25e10a){return _0x4cf629[_0x57ae('0x20')](_0x32a010);}return _0x4cf629[_0x57ae('0x21')](_0x32a010)[_0x57ae('0x22')]();};}function respondWithResult(_0x1761c6,_0x25b58f){_0x25b58f=_0x25b58f||0xc8;return function(_0x45b4b3){if(_0x45b4b3){return _0x1761c6[_0x57ae('0x21')](_0x25b58f)[_0x57ae('0x23')](_0x45b4b3);}};}function respondWithFilteredResult(_0x12d031,_0x1f017c){return function(_0x4ad919){if(_0x4ad919){var _0x279a08=typeof _0x1f017c['offset']===_0x57ae('0x24')&&typeof _0x1f017c['limit']===_0x57ae('0x24');var _0x17923b=_0x4ad919[_0x57ae('0x25')];var _0x4d3ae0=_0x279a08?0x0:_0x1f017c[_0x57ae('0x26')];var _0x21c8c1=_0x279a08?_0x4ad919[_0x57ae('0x25')]:_0x1f017c['offset']+_0x1f017c[_0x57ae('0x27')];var _0x39cd4a;if(_0x21c8c1>=_0x17923b){_0x21c8c1=_0x17923b;_0x39cd4a=0xc8;}else{_0x39cd4a=0xce;}_0x12d031[_0x57ae('0x21')](_0x39cd4a);return _0x12d031[_0x57ae('0x28')](_0x57ae('0x29'),_0x4d3ae0+'-'+_0x21c8c1+'/'+_0x17923b)[_0x57ae('0x23')](_0x4ad919);}return null;};}function patchUpdates(_0x31bbbb){return function(_0x5aafa3){try{jsonpatch[_0x57ae('0x2a')](_0x5aafa3,_0x31bbbb,!![]);}catch(_0x52f5c7){return BPromise[_0x57ae('0x2b')](_0x52f5c7);}return _0x5aafa3['save']();};}function saveUpdates(_0x41f8d3,_0x5103b6){return function(_0x52d517){if(_0x52d517){return _0x52d517[_0x57ae('0x2c')](_0x41f8d3)['then'](function(_0x4e11ed){return _0x4e11ed;});}return null;};}function removeEntity(_0x5d5c1d,_0x18cc2c){return function(_0x4cbd8e){if(_0x4cbd8e){return _0x4cbd8e[_0x57ae('0x2d')]()['then'](function(){_0x5d5c1d['status'](0xcc)[_0x57ae('0x22')]();});}};}function handleEntityNotFound(_0x50208f,_0x52eb44){return function(_0x32681b){if(!_0x32681b){_0x50208f['sendStatus'](0x194);}return _0x32681b;};}function handleError(_0x463bba,_0x441f00){_0x441f00=_0x441f00||0x1f4;return function(_0x26e80b){logger[_0x57ae('0x2e')](_0x26e80b[_0x57ae('0x2f')]);if(_0x26e80b[_0x57ae('0x30')]){delete _0x26e80b[_0x57ae('0x30')];}_0x463bba['status'](_0x441f00)['send'](_0x26e80b);};}exports[_0x57ae('0x31')]=function(_0x24724b,_0x5d980b,_0x15098b){if(!_0x24724b[_0x57ae('0x32')][_0x57ae('0x33')](_0x57ae('0x34'))&&!_0x24724b[_0x57ae('0x32')]['hasOwnProperty'](_0x57ae('0x35'))){throw new db['Sequelize'][(_0x57ae('0x36'))](_0x57ae('0x37'));}else{if(_0x24724b[_0x57ae('0x32')][_0x57ae('0x33')]('TemplateId')&&!_0x24724b['body'][_0x57ae('0x33')](_0x57ae('0x38'))){throw new db[(_0x57ae('0x39'))][(_0x57ae('0x36'))](_0x57ae('0x3a'));}if(!_0x24724b[_0x57ae('0x32')]['hasOwnProperty'](_0x57ae('0x3b'))){throw new db[(_0x57ae('0x39'))][(_0x57ae('0x36'))](_0x57ae('0x3c'));}else{try{var _0x3df3cf=JSON[_0x57ae('0x3d')](_0x24724b[_0x57ae('0x32')]['recipients']);}catch(_0x54e2d5){logger['error'](_0x54e2d5);throw new db['Sequelize'][(_0x57ae('0x36'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x232bf1=[_0x57ae('0x3e'),_0x57ae('0x3f'),_0x57ae('0x40'),_0x57ae('0x41'),_0x57ae('0x42'),_0x57ae('0x43'),'whatsappqueue','team',_0x57ae('0x44')];if(_['some'](_0x3df3cf,function(_0x2cd57b){return!_['includes'](_0x232bf1,_0x2cd57b[_0x57ae('0x45')][_0x57ae('0x46')]());})){throw new db[(_0x57ae('0x39'))]['ValidationError'](_0x57ae('0x47'));}}}var _0x9cb9d8={};_0x9cb9d8['senderName']=_0x24724b['body'][_0x57ae('0x33')](_0x57ae('0x48'))?_0x24724b['body'][_0x57ae('0x48')]:_0x24724b[_0x57ae('0x44')][_0x57ae('0x49')];_0x9cb9d8['recipientsDescription']=_[_0x57ae('0x4a')](_0x24724b['body'][_0x57ae('0x4b')])?null:_0x24724b[_0x57ae('0x32')][_0x57ae('0x4b')];_0x9cb9d8[_0x57ae('0x4c')]=_0x24724b[_0x57ae('0x32')][_0x57ae('0x4c')]||![];_0x9cb9d8['SenderId']=_0x24724b[_0x57ae('0x44')]['id'];return getContent(_0x24724b[_0x57ae('0x32')])[_0x57ae('0x4d')](function(_0x535ae6){_0x9cb9d8[_0x57ae('0x32')]=_0x535ae6;return getRecipients(_0x3df3cf);})[_0x57ae('0x4d')](function(_0x5b0007){_0x9cb9d8[_0x57ae('0x4e')]=_[_0x57ae('0x4f')](_0x5b0007)[_0x57ae('0x50')](',');return db[_0x57ae('0x51')][_0x57ae('0x52')](function(_0x4e115e){return db[_0x57ae('0x53')][_0x57ae('0x54')](_0x9cb9d8,{'raw':!![],'transaction':_0x4e115e})['then'](function(_0x4e3e62){var _0x497bfa={'sender':_0x9cb9d8[_0x57ae('0x48')],'description':_0x9cb9d8[_0x57ae('0x4b')],'content':_0x9cb9d8[_0x57ae('0x32')],'beep':_0x9cb9d8[_0x57ae('0x4c')]};_0x5b0007['forEach'](function(_0x462ac8){_0x497bfa[_0x57ae('0x55')]=_0x462ac8;socket['emit']('userNotification:send',_0x497bfa);});return _0x4e3e62;});});})[_0x57ae('0x4d')](respondWithResult(_0x5d980b,0xc9))[_0x57ae('0x56')](handleError(_0x5d980b,null));};function getContent(_0x58bbba){return new BPromise(function(_0x485546,_0x15ed70){if(_0x58bbba[_0x57ae('0x34')]){_0x485546(_0x58bbba[_0x57ae('0x34')]);return;}return db[_0x57ae('0x57')][_0x57ae('0x58')]({'attributes':[_0x57ae('0x59')],'where':{'id':_0x58bbba[_0x57ae('0x35')]},'raw':!![]})['then'](function(_0x1e918f){if(!_0x1e918f)throw new db[(_0x57ae('0x39'))][(_0x57ae('0x36'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x3a6c3d=Mustache['render'](_0x1e918f[_0x57ae('0x59')],_0x58bbba['view']);_0x485546(_0x3a6c3d);})['catch'](function(_0x5bb9a2){_0x15ed70(_0x5bb9a2);});});}function getRecipients(_0x2fc7f1){return new BPromise(function(_0x17909d,_0xdf0c2f){var _0x2e926f=[];var _0x5396b0=[];_0x2fc7f1[_0x57ae('0x5a')](function(_0x2ad8dd){var _0x1a639b=_['startCase'](_0x2ad8dd[_0x57ae('0x45')][_0x57ae('0x46')]());if(_0x1a639b===_0x57ae('0x5b')){_0x2e926f=_['union'](_0x2e926f,_0x2ad8dd[_0x57ae('0x5c')]);}else{if(_[_0x57ae('0x5d')](_0x1a639b,_0x57ae('0x5e')))_0x1a639b=_0x1a639b[_0x57ae('0x5f')]('queue',_0x57ae('0x60'));_0x2ad8dd[_0x57ae('0x5c')][_0x57ae('0x5a')](function(_0x336946){_0x5396b0[_0x57ae('0x61')](getAgents(_0x1a639b,_0x336946));});}});return BPromise[_0x57ae('0x62')](_0x5396b0)['then'](function(_0x132c6f){_0x2e926f=_[_0x57ae('0x63')](_0x2e926f,_[_0x57ae('0x64')](_0x132c6f));_0x17909d(_0x2e926f);})['catch'](function(_0x2a844c){_0xdf0c2f(_0x2a844c);});});}function getAgents(_0x3b07cb,_0x3a26f7){return new BPromise(function(_0x27fdc2,_0x327bc8){return db[_0x3b07cb][_0x57ae('0x58')]({'where':{'id':_0x3a26f7}})['then'](function(_0x472315){return _0x472315[_0x57ae('0x65')]({'attributes':['id'],'raw':!![]})[_0x57ae('0x4d')](function(_0x446322){var _0x39152f=_[_0x57ae('0x66')](_0x446322,'id');_0x27fdc2(_0x39152f);});})[_0x57ae('0x56')](function(_0x3fa010){_0x327bc8(_0x3fa010);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index e62921e..eea4137 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 _0xa033=['hasOwnProperty','../../mysqldb','UserNotification','setMaxListeners','save','update','emit'];(function(_0x260b6a,_0x185288){var _0x14f914=function(_0x4af875){while(--_0x4af875){_0x260b6a['push'](_0x260b6a['shift']());}};_0x14f914(++_0x185288);}(_0xa033,0x86));var _0x3a03=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa033[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x3a03('0x0'))['db'][_0x3a03('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x3a03('0x2')](0x0);var events={'afterCreate':_0x3a03('0x3'),'afterUpdate':_0x3a03('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2c7f70){return function(_0x3b2738,_0xf03dad,_0x26be0a){UserNotificationEvents[_0x3a03('0x5')](_0x2c7f70+':'+_0x3b2738['id'],_0x3b2738);UserNotificationEvents['emit'](_0x2c7f70,_0x3b2738);_0x26be0a(null);};}for(var e in events){if(events[_0x3a03('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x0a00=['exports','events','../../mysqldb','UserNotification','save','update','remove','emit','hook'];(function(_0x2ba9ac,_0xa1fdc4){var _0x1b0fc9=function(_0x4343de){while(--_0x4343de){_0x2ba9ac['push'](_0x2ba9ac['shift']());}};_0x1b0fc9(++_0xa1fdc4);}(_0x0a00,0x10f));var _0x00a0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x0a00[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require(_0x00a0('0x0'));var UserNotification=require(_0x00a0('0x1'))['db'][_0x00a0('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x00a0('0x3'),'afterUpdate':_0x00a0('0x4'),'afterDestroy':_0x00a0('0x5')};function emitEvent(_0x138fe3){return function(_0x28cecc,_0x3146a9,_0x942f6e){UserNotificationEvents[_0x00a0('0x6')](_0x138fe3+':'+_0x28cecc['id'],_0x28cecc);UserNotificationEvents[_0x00a0('0x6')](_0x138fe3,_0x28cecc);_0x942f6e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x00a0('0x7')](e,emitEvent(event));}}module[_0x00a0('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index ad964be..be1c27e 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 _0x6e58=['define','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes'];(function(_0x47a31a,_0x41aea7){var _0x5c856b=function(_0x1e7835){while(--_0x1e7835){_0x47a31a['push'](_0x47a31a['shift']());}};_0x5c856b(++_0x41aea7);}(_0x6e58,0xd6));var _0x86e5=function(_0x52c111,_0x19e95d){_0x52c111=_0x52c111-0x0;var _0x5acc45=_0x6e58[_0x52c111];return _0x5acc45;};'use strict';var _=require(_0x86e5('0x0'));var util=require(_0x86e5('0x1'));var logger=require('../../config/logger')(_0x86e5('0x2'));var moment=require(_0x86e5('0x3'));var BPromise=require(_0x86e5('0x4'));var rp=require(_0x86e5('0x5'));var fs=require('fs');var path=require(_0x86e5('0x6'));var rimraf=require(_0x86e5('0x7'));var config=require(_0x86e5('0x8'));var attributes=require(_0x86e5('0x9'));module['exports']=function(_0x2d20f1,_0x2ca57b){return _0x2d20f1[_0x86e5('0xa')]('UserNotification',attributes,{'tableName':_0x86e5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x86e5('0xc'),'collate':_0x86e5('0xd')});}; \ No newline at end of file +var _0x4331=['./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x26fe8a,_0x2568ec){var _0x15108e=function(_0x331235){while(--_0x331235){_0x26fe8a['push'](_0x26fe8a['shift']());}};_0x15108e(++_0x2568ec);}(_0x4331,0x115));var _0x1433=function(_0x44406f,_0x428cc6){_0x44406f=_0x44406f-0x0;var _0x59dfaf=_0x4331[_0x44406f];return _0x59dfaf;};'use strict';var _=require(_0x1433('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1433('0x1'));var moment=require(_0x1433('0x2'));var BPromise=require(_0x1433('0x3'));var rp=require(_0x1433('0x4'));var fs=require('fs');var path=require(_0x1433('0x5'));var rimraf=require(_0x1433('0x6'));var config=require(_0x1433('0x7'));var attributes=require(_0x1433('0x8'));module[_0x1433('0x9')]=function(_0x53fe31,_0xe158c8){return _0x53fe31[_0x1433('0xa')](_0x1433('0xb'),attributes,{'tableName':_0x1433('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1433('0xd'),'collate':_0x1433('0xe')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index da8d2a8..c34884c 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 _0xb4c2=['request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userNotification.socket','register'];(function(_0x5ed082,_0x12c0ef){var _0x1423a9=function(_0x39c976){while(--_0x39c976){_0x5ed082['push'](_0x5ed082['shift']());}};_0x1423a9(++_0x12c0ef);}(_0xb4c2,0x176));var _0x2b4c=function(_0xd69127,_0x4971ef){_0xd69127=_0xd69127-0x0;var _0x5456f2=_0xb4c2[_0xd69127];return _0x5456f2;};'use strict';var _=require(_0x2b4c('0x0'));var util=require(_0x2b4c('0x1'));var moment=require(_0x2b4c('0x2'));var BPromise=require('bluebird');var rs=require(_0x2b4c('0x3'));var fs=require('fs');var Redis=require(_0x2b4c('0x4'));var db=require(_0x2b4c('0x5'))['db'];var utils=require(_0x2b4c('0x6'));var logger=require(_0x2b4c('0x7'))(_0x2b4c('0x8'));var config=require(_0x2b4c('0x9'));var jayson=require(_0x2b4c('0xa'));var client=jayson[_0x2b4c('0xb')][_0x2b4c('0xc')]({'port':0x232a});config[_0x2b4c('0xd')]=_[_0x2b4c('0xe')](config[_0x2b4c('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x2b4c('0xf'))(new Redis(config[_0x2b4c('0xd')]));require(_0x2b4c('0x10'))[_0x2b4c('0x11')](socket);function respondWithRpcPromise(_0x57d6e4,_0x16c9cc,_0x5b969a){return new BPromise(function(_0x404161,_0x4c54d2){return client[_0x2b4c('0x12')](_0x57d6e4,_0x5b969a)['then'](function(_0x59a055){logger[_0x2b4c('0x13')](_0x2b4c('0x14'),_0x16c9cc,_0x2b4c('0x15'));logger[_0x2b4c('0x16')](_0x2b4c('0x17'),_0x16c9cc,_0x2b4c('0x15'),JSON['stringify'](_0x59a055));if(_0x59a055['error']){if(_0x59a055[_0x2b4c('0x18')][_0x2b4c('0x19')]===0x1f4){logger[_0x2b4c('0x18')](_0x2b4c('0x14'),_0x16c9cc,_0x59a055[_0x2b4c('0x18')][_0x2b4c('0x1a')]);return _0x4c54d2(_0x59a055[_0x2b4c('0x18')][_0x2b4c('0x1a')]);}logger[_0x2b4c('0x18')](_0x2b4c('0x14'),_0x16c9cc,_0x59a055[_0x2b4c('0x18')][_0x2b4c('0x1a')]);return _0x404161(_0x59a055['error'][_0x2b4c('0x1a')]);}else{logger[_0x2b4c('0x13')](_0x2b4c('0x14'),_0x16c9cc,_0x2b4c('0x15'));_0x404161(_0x59a055[_0x2b4c('0x1b')][_0x2b4c('0x1a')]);}})['catch'](function(_0x19bbff){logger[_0x2b4c('0x18')](_0x2b4c('0x14'),_0x16c9cc,_0x19bbff);_0x4c54d2(_0x19bbff);});});} \ No newline at end of file +var _0x4d91=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','code','error','UserNotification,\x20%s,\x20%s','message','request\x20sent','result','catch','bluebird'];(function(_0x5f4464,_0x558b7f){var _0x1a9e15=function(_0x442c72){while(--_0x442c72){_0x5f4464['push'](_0x5f4464['shift']());}};_0x1a9e15(++_0x558b7f);}(_0x4d91,0x103));var _0x14d9=function(_0x4404ff,_0x13d7a9){_0x4404ff=_0x4404ff-0x0;var _0x5e7b19=_0x4d91[_0x4404ff];return _0x5e7b19;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x14d9('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14d9('0x1'))['db'];var utils=require(_0x14d9('0x2'));var logger=require(_0x14d9('0x3'))(_0x14d9('0x4'));var config=require(_0x14d9('0x5'));var jayson=require(_0x14d9('0x6'));var client=jayson[_0x14d9('0x7')][_0x14d9('0x8')]({'port':0x232a});config[_0x14d9('0x9')]=_['defaults'](config[_0x14d9('0x9')],{'host':_0x14d9('0xa'),'port':0x18eb});var socket=require(_0x14d9('0xb'))(new Redis(config['redis']));require('./userNotification.socket')[_0x14d9('0xc')](socket);function respondWithRpcPromise(_0x1ac74d,_0x509472,_0x1f9d30){return new BPromise(function(_0x34af06,_0x13ba4b){return client[_0x14d9('0xd')](_0x1ac74d,_0x1f9d30)[_0x14d9('0xe')](function(_0x40e981){logger[_0x14d9('0xf')]('UserNotification,\x20%s,\x20%s',_0x509472,'request\x20sent');logger[_0x14d9('0x10')](_0x14d9('0x11'),_0x509472,'request\x20sent',JSON[_0x14d9('0x12')](_0x40e981));if(_0x40e981['error']){if(_0x40e981['error'][_0x14d9('0x13')]===0x1f4){logger[_0x14d9('0x14')](_0x14d9('0x15'),_0x509472,_0x40e981[_0x14d9('0x14')][_0x14d9('0x16')]);return _0x13ba4b(_0x40e981['error'][_0x14d9('0x16')]);}logger[_0x14d9('0x14')](_0x14d9('0x15'),_0x509472,_0x40e981[_0x14d9('0x14')][_0x14d9('0x16')]);return _0x34af06(_0x40e981[_0x14d9('0x14')]['message']);}else{logger[_0x14d9('0xf')](_0x14d9('0x15'),_0x509472,_0x14d9('0x17'));_0x34af06(_0x40e981[_0x14d9('0x18')][_0x14d9('0x16')]);}})[_0x14d9('0x19')](function(_0x5e9fef){logger[_0x14d9('0x14')]('UserNotification,\x20%s,\x20%s',_0x509472,_0x5e9fef);_0x13ba4b(_0x5e9fef);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 2d6f165..b594fc1 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 _0x0332=['register','length','remove','update','emit','removeListener'];(function(_0x119cf9,_0x571cc1){var _0x54ed7c=function(_0x1f6f93){while(--_0x1f6f93){_0x119cf9['push'](_0x119cf9['shift']());}};_0x54ed7c(++_0x571cc1);}(_0x0332,0xbc));var _0x2033=function(_0x5dcd95,_0x1e72d4){_0x5dcd95=_0x5dcd95-0x0;var _0x271b17=_0x0332[_0x5dcd95];return _0x271b17;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=['save',_0x2033('0x0'),_0x2033('0x1')];function createListener(_0x4e0db4,_0x1d961d){return function(_0x489ec3){_0x1d961d[_0x2033('0x2')](_0x4e0db4,_0x489ec3);};}function removeListener(_0x16d600,_0x3644e0){return function(){UserNotificationEvents[_0x2033('0x3')](_0x16d600,_0x3644e0);};}exports[_0x2033('0x4')]=function(_0x5d0ccd){for(var _0x26ac61=0x0,_0xe8dd1d=events[_0x2033('0x5')];_0x26ac61<_0xe8dd1d;_0x26ac61++){var _0x3949c1=events[_0x26ac61];var _0x1e73ed=createListener('userNotification:'+_0x3949c1,_0x5d0ccd);UserNotificationEvents['on'](_0x3949c1,_0x1e73ed);}}; \ No newline at end of file +var _0x6d47=['update','emit','removeListener','register','length','userNotification:','./userNotification.events','save','remove'];(function(_0xb893c,_0x1ab5b2){var _0x479368=function(_0x30e9ae){while(--_0x30e9ae){_0xb893c['push'](_0xb893c['shift']());}};_0x479368(++_0x1ab5b2);}(_0x6d47,0x141));var _0x76d4=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x6d47[_0x4ea69d];return _0x5318e0;};'use strict';var UserNotificationEvents=require(_0x76d4('0x0'));var events=[_0x76d4('0x1'),_0x76d4('0x2'),_0x76d4('0x3')];function createListener(_0x1aede4,_0x27f377){return function(_0x43b612){_0x27f377[_0x76d4('0x4')](_0x1aede4,_0x43b612);};}function removeListener(_0x3ecb11,_0x46fa77){return function(){UserNotificationEvents[_0x76d4('0x5')](_0x3ecb11,_0x46fa77);};}exports[_0x76d4('0x6')]=function(_0xa9b4d6){for(var _0x4553b2=0x0,_0x725b4c=events[_0x76d4('0x7')];_0x4553b2<_0x725b4c;_0x4553b2++){var _0x2db08c=events[_0x4553b2];var _0x40e2d5=createListener(_0x76d4('0x8')+_0x2db08c,_0xa9b4d6);UserNotificationEvents['on'](_0x2db08c,_0x40e2d5);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index ef2b54f..766a640 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x65d13d,_0x49e929){var _0x309bb3=function(_0x2d7f73){while(--_0x2d7f73){_0x65d13d['push'](_0x65d13d['shift']());}};_0x309bb3(++_0x49e929);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x57931c,_0x5a3537){var _0x41cfe4=function(_0x2ab466){while(--_0x2ab466){_0x57931c['push'](_0x57931c['shift']());}};_0x41cfe4(++_0x5a3537);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3dea7d,_0x2cd4ea){_0x3dea7d=_0x3dea7d-0x0;var _0x53919a=_0xcb91[_0x3dea7d];return _0x53919a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 488e5b7..0f5ba3b 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 _0x1ab8=['sequelize','exports'];(function(_0x4d684a,_0x3b4cde){var _0x286f3e=function(_0x530af1){while(--_0x530af1){_0x4d684a['push'](_0x4d684a['shift']());}};_0x286f3e(++_0x3b4cde);}(_0x1ab8,0x1e2));var _0x81ab=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1ab8[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x81ab('0x0'));module[_0x81ab('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7ab0=['sequelize','exports','INTEGER'];(function(_0x45b24a,_0x83731){var _0x1dac4c=function(_0x52b0ac){while(--_0x52b0ac){_0x45b24a['push'](_0x45b24a['shift']());}};_0x1dac4c(++_0x83731);}(_0x7ab0,0x135));var _0x07ab=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7ab0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x07ab('0x0'));module[_0x07ab('0x1')]={'penalty':{'type':Sequelize[_0x07ab('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 9024662..b357abe 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 _0x7234=['moment','bluebird','request-promise','path','rimraf','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','api'];(function(_0x575199,_0x285c3d){var _0x3fb23c=function(_0x2a6689){while(--_0x2a6689){_0x575199['push'](_0x575199['shift']());}};_0x3fb23c(++_0x285c3d);}(_0x7234,0xf4));var _0x4723=function(_0x5891c,_0x26c3ab){_0x5891c=_0x5891c-0x0;var _0x82a0a7=_0x7234[_0x5891c];return _0x82a0a7;};'use strict';var _=require('lodash');var util=require(_0x4723('0x0'));var logger=require(_0x4723('0x1'))(_0x4723('0x2'));var moment=require(_0x4723('0x3'));var BPromise=require(_0x4723('0x4'));var rp=require(_0x4723('0x5'));var fs=require('fs');var path=require(_0x4723('0x6'));var rimraf=require(_0x4723('0x7'));var config=require('../../config/environment');var attributes=require(_0x4723('0x8'));module[_0x4723('0x9')]=function(_0x1b8003,_0x4a16cc){return _0x1b8003[_0x4723('0xa')](_0x4723('0xb'),attributes,{'tableName':_0x4723('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3198=['bluebird','request-promise','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','api'];(function(_0x52ad00,_0x57bf4c){var _0x482d55=function(_0x335f10){while(--_0x335f10){_0x52ad00['push'](_0x52ad00['shift']());}};_0x482d55(++_0x57bf4c);}(_0x3198,0x11f));var _0x8319=function(_0x134c76,_0x173298){_0x134c76=_0x134c76-0x0;var _0x4e5064=_0x3198[_0x134c76];return _0x4e5064;};'use strict';var _=require(_0x8319('0x0'));var util=require(_0x8319('0x1'));var logger=require('../../config/logger')(_0x8319('0x2'));var moment=require('moment');var BPromise=require(_0x8319('0x3'));var rp=require(_0x8319('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8319('0x5'));module[_0x8319('0x6')]=function(_0x2d0d2a,_0x17829b){return _0x2d0d2a[_0x8319('0x7')](_0x8319('0x8'),attributes,{'tableName':_0x8319('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 0df08f2..d55e12e 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 _0x1ba0=['../../config/environment','client','http','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x4e2806,_0x29bddf){var _0xd5a5a1=function(_0x44ea94){while(--_0x44ea94){_0x4e2806['push'](_0x4e2806['shift']());}};_0xd5a5a1(++_0x29bddf);}(_0x1ba0,0xa4));var _0x01ba=function(_0xfbf7e6,_0x56e560){_0xfbf7e6=_0xfbf7e6-0x0;var _0x4da03d=_0x1ba0[_0xfbf7e6];return _0x4da03d;};'use strict';var _=require(_0x01ba('0x0'));var util=require(_0x01ba('0x1'));var moment=require(_0x01ba('0x2'));var BPromise=require(_0x01ba('0x3'));var rs=require(_0x01ba('0x4'));var fs=require('fs');var Redis=require(_0x01ba('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x01ba('0x6'))('rpc');var config=require(_0x01ba('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x01ba('0x8')][_0x01ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x475e94,_0x1a7467,_0x47a44e){return new BPromise(function(_0x5d810d,_0x3d3837){return client['request'](_0x475e94,_0x47a44e)['then'](function(_0x2df2cb){logger['info'](_0x01ba('0xa'),_0x1a7467,_0x01ba('0xb'));logger[_0x01ba('0xc')](_0x01ba('0xd'),_0x1a7467,_0x01ba('0xb'),JSON[_0x01ba('0xe')](_0x2df2cb));if(_0x2df2cb[_0x01ba('0xf')]){if(_0x2df2cb[_0x01ba('0xf')][_0x01ba('0x10')]===0x1f4){logger[_0x01ba('0xf')](_0x01ba('0xa'),_0x1a7467,_0x2df2cb[_0x01ba('0xf')][_0x01ba('0x11')]);return _0x3d3837(_0x2df2cb[_0x01ba('0xf')][_0x01ba('0x11')]);}logger[_0x01ba('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1a7467,_0x2df2cb[_0x01ba('0xf')][_0x01ba('0x11')]);return _0x5d810d(_0x2df2cb[_0x01ba('0xf')][_0x01ba('0x11')]);}else{logger['info'](_0x01ba('0xa'),_0x1a7467,'request\x20sent');_0x5d810d(_0x2df2cb[_0x01ba('0x12')][_0x01ba('0x11')]);}})['catch'](function(_0x666d14){logger[_0x01ba('0xf')](_0x01ba('0xa'),_0x1a7467,_0x666d14);_0x3d3837(_0x666d14);});});} \ No newline at end of file +var _0xaee3=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird'];(function(_0x2678d6,_0x4e2001){var _0x475503=function(_0x34b23d){while(--_0x34b23d){_0x2678d6['push'](_0x2678d6['shift']());}};_0x475503(++_0x4e2001);}(_0xaee3,0x1e0));var _0x3aee=function(_0x50c492,_0x5c1e67){_0x50c492=_0x50c492-0x0;var _0x3505a8=_0xaee3[_0x50c492];return _0x3505a8;};'use strict';var _=require(_0x3aee('0x0'));var util=require(_0x3aee('0x1'));var moment=require('moment');var BPromise=require(_0x3aee('0x2'));var rs=require(_0x3aee('0x3'));var fs=require('fs');var Redis=require(_0x3aee('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3aee('0x5'));var logger=require(_0x3aee('0x6'))(_0x3aee('0x7'));var config=require(_0x3aee('0x8'));var jayson=require(_0x3aee('0x9'));var client=jayson[_0x3aee('0xa')][_0x3aee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c0c3b,_0x1fcff0,_0x1b6017){return new BPromise(function(_0x457db4,_0x37aba2){return client['request'](_0x2c0c3b,_0x1b6017)[_0x3aee('0xc')](function(_0x3a7534){logger[_0x3aee('0xd')](_0x3aee('0xe'),_0x1fcff0,_0x3aee('0xf'));logger[_0x3aee('0x10')](_0x3aee('0x11'),_0x1fcff0,'request\x20sent',JSON[_0x3aee('0x12')](_0x3a7534));if(_0x3a7534['error']){if(_0x3a7534[_0x3aee('0x13')]['code']===0x1f4){logger[_0x3aee('0x13')](_0x3aee('0xe'),_0x1fcff0,_0x3a7534[_0x3aee('0x13')][_0x3aee('0x14')]);return _0x37aba2(_0x3a7534[_0x3aee('0x13')]['message']);}logger['error'](_0x3aee('0xe'),_0x1fcff0,_0x3a7534['error']['message']);return _0x457db4(_0x3a7534[_0x3aee('0x13')][_0x3aee('0x14')]);}else{logger[_0x3aee('0xd')](_0x3aee('0xe'),_0x1fcff0,'request\x20sent');_0x457db4(_0x3a7534[_0x3aee('0x15')][_0x3aee('0x14')]);}})[_0x3aee('0x16')](function(_0x40faf0){logger['error'](_0x3aee('0xe'),_0x1fcff0,_0x40faf0);_0x37aba2(_0x40faf0);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index ebb295a..9be13b0 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 _0x0d9a=['../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/sections','getSections','post','create','/:id/clone','clone','addSections','/:id/resources','addResources','put','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x590dea,_0x174ae2){var _0x219bca=function(_0x5af50b){while(--_0x5af50b){_0x590dea['push'](_0x590dea['shift']());}};_0x219bca(++_0x174ae2);}(_0x0d9a,0xf9));var _0xa0d9=function(_0x267a16,_0x150cef){_0x267a16=_0x267a16-0x0;var _0xe80262=_0x0d9a[_0x267a16];return _0xe80262;};'use strict';var multer=require(_0xa0d9('0x0'));var util=require(_0xa0d9('0x1'));var path=require(_0xa0d9('0x2'));var timeout=require(_0xa0d9('0x3'));var express=require(_0xa0d9('0x4'));var router=express['Router']();var fs_extra=require(_0xa0d9('0x5'));var auth=require(_0xa0d9('0x6'));var interaction=require(_0xa0d9('0x7'));var config=require(_0xa0d9('0x8'));var controller=require(_0xa0d9('0x9'));router[_0xa0d9('0xa')]('/',auth['isAuthenticated'](),controller[_0xa0d9('0xb')]);router[_0xa0d9('0xa')](_0xa0d9('0xc'),auth[_0xa0d9('0xd')](),controller['describe']);router[_0xa0d9('0xa')](_0xa0d9('0xe'),auth[_0xa0d9('0xd')](),controller[_0xa0d9('0xf')]);router[_0xa0d9('0xa')](_0xa0d9('0x10'),auth[_0xa0d9('0xd')](),controller[_0xa0d9('0x11')]);router['get']('/:id/resources',auth['isAuthenticated'](),controller['getResources']);router[_0xa0d9('0x12')]('/',auth[_0xa0d9('0xd')](),controller[_0xa0d9('0x13')]);router[_0xa0d9('0x12')](_0xa0d9('0x14'),auth['isAuthenticated'](),controller[_0xa0d9('0x15')]);router[_0xa0d9('0x12')](_0xa0d9('0x10'),auth[_0xa0d9('0xd')](),controller[_0xa0d9('0x16')]);router[_0xa0d9('0x12')](_0xa0d9('0x17'),auth['isAuthenticated'](),controller[_0xa0d9('0x18')]);router[_0xa0d9('0x19')](_0xa0d9('0xe'),auth[_0xa0d9('0xd')](),controller[_0xa0d9('0x1a')]);router[_0xa0d9('0x1b')](_0xa0d9('0xe'),auth[_0xa0d9('0xd')](),controller[_0xa0d9('0x1c')]);router['delete']('/:id/sections',auth[_0xa0d9('0xd')](),controller[_0xa0d9('0x1d')]);router['delete']('/:id/resources',auth['isAuthenticated'](),controller[_0xa0d9('0x1e')]);module[_0xa0d9('0x1f')]=router; \ No newline at end of file +var _0x1ef3=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','getResources','post','addSections','/:id/resources','addResources','put','destroy','delete','/:id/sections','removeSections','removeResources'];(function(_0x27beea,_0x3bc9f4){var _0x122645=function(_0x2c848){while(--_0x2c848){_0x27beea['push'](_0x27beea['shift']());}};_0x122645(++_0x3bc9f4);}(_0x1ef3,0x69));var _0x31ef=function(_0x6e050,_0x38475a){_0x6e050=_0x6e050-0x0;var _0x41ce33=_0x1ef3[_0x6e050];return _0x41ce33;};'use strict';var multer=require(_0x31ef('0x0'));var util=require(_0x31ef('0x1'));var path=require('path');var timeout=require(_0x31ef('0x2'));var express=require(_0x31ef('0x3'));var router=express[_0x31ef('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x31ef('0x5'));var interaction=require(_0x31ef('0x6'));var config=require('../../config/environment');var controller=require(_0x31ef('0x7'));router[_0x31ef('0x8')]('/',auth[_0x31ef('0x9')](),controller[_0x31ef('0xa')]);router[_0x31ef('0x8')](_0x31ef('0xb'),auth['isAuthenticated'](),controller[_0x31ef('0xc')]);router[_0x31ef('0x8')](_0x31ef('0xd'),auth[_0x31ef('0x9')](),controller['show']);router[_0x31ef('0x8')]('/:id/sections',auth[_0x31ef('0x9')](),controller['getSections']);router['get']('/:id/resources',auth[_0x31ef('0x9')](),controller[_0x31ef('0xe')]);router[_0x31ef('0xf')]('/',auth[_0x31ef('0x9')](),controller['create']);router['post']('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0x31ef('0xf')]('/:id/sections',auth[_0x31ef('0x9')](),controller[_0x31ef('0x10')]);router['post'](_0x31ef('0x11'),auth[_0x31ef('0x9')](),controller[_0x31ef('0x12')]);router[_0x31ef('0x13')](_0x31ef('0xd'),auth[_0x31ef('0x9')](),controller['update']);router['delete'](_0x31ef('0xd'),auth['isAuthenticated'](),controller[_0x31ef('0x14')]);router[_0x31ef('0x15')](_0x31ef('0x16'),auth[_0x31ef('0x9')](),controller[_0x31ef('0x17')]);router['delete'](_0x31ef('0x11'),auth[_0x31ef('0x9')](),controller[_0x31ef('0x18')]);module[_0x31ef('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 23b8a64..f66fcab 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 _0x5918=['split','BOOLEAN','exports','name','STRING','setDataValue','crudPermissions','join','getDataValue'];(function(_0x1863fb,_0x3304d3){var _0x3c7735=function(_0x4fc0bb){while(--_0x4fc0bb){_0x1863fb['push'](_0x1863fb['shift']());}};_0x3c7735(++_0x3304d3);}(_0x5918,0x89));var _0x8591=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5918[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x8591('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8591('0x1')},'crudPermissions':{'type':Sequelize[_0x8591('0x2')],'set':function(_0x40a6aa){this[_0x8591('0x3')](_0x8591('0x4'),_0x40a6aa?_0x40a6aa[_0x8591('0x5')](''):[]);},'get':function(){return this[_0x8591('0x6')]('crudPermissions')?this[_0x8591('0x6')]('crudPermissions')[_0x8591('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x8591('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x8591('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x8591('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x8591('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x8591('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x8591('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8591('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4c28=['setDataValue','crudPermissions','join','getDataValue','BOOLEAN','exports','STRING'];(function(_0x25d2fb,_0x3f2182){var _0xcd1ff0=function(_0x1578db){while(--_0x1578db){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0xcd1ff0(++_0x3f2182);}(_0x4c28,0x1e1));var _0x84c2=function(_0x19bd5b,_0x17a7b3){_0x19bd5b=_0x19bd5b-0x0;var _0x36fe10=_0x4c28[_0x19bd5b];return _0x36fe10;};'use strict';var Sequelize=require('sequelize');module[_0x84c2('0x0')]={'name':{'type':Sequelize[_0x84c2('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x84c2('0x1')],'set':function(_0x28be57){this[_0x84c2('0x2')](_0x84c2('0x3'),_0x28be57?_0x28be57[_0x84c2('0x4')](''):[]);},'get':function(){return this[_0x84c2('0x5')](_0x84c2('0x3'))?this['getDataValue']('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x84c2('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x84c2('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x84c2('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x84c2('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x84c2('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x84c2('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x84c2('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 ae7624a..f9c8bdf 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 _0xd9b1=['subsections','concat','push','autoAssociation','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','count','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','UserProfile','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','catch','show','rawAttributes','find','create','clone','params','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','UserProfileSection','each','sectionId','userProfileId','Resources','UserProfileResource','describe','transaction','removeSections','getSections','enabled','includes','isEmpty'];(function(_0x507546,_0x53c0a0){var _0x2365f8=function(_0x160c2f){while(--_0x160c2f){_0x507546['push'](_0x507546['shift']());}};_0x2365f8(++_0x53c0a0);}(_0xd9b1,0xf6));var _0x1d9b=function(_0x2612bd,_0x575aa6){_0x2612bd=_0x2612bd-0x0;var _0x45ed22=_0xd9b1[_0x2612bd];return _0x45ed22;};'use strict';var emlformat=require(_0x1d9b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1d9b('0x1'));var rp=require(_0x1d9b('0x2'));var moment=require(_0x1d9b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1d9b('0x4'));var sox=require(_0x1d9b('0x5'));var csv=require(_0x1d9b('0x6'));var ejs=require(_0x1d9b('0x7'));var fs=require('fs');var fs_extra=require(_0x1d9b('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1d9b('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x1d9b('0xa'));var toCsv=require(_0x1d9b('0x6'));var querystring=require(_0x1d9b('0xb'));var Papa=require(_0x1d9b('0xc'));var Redis=require(_0x1d9b('0xd'));var authService=require(_0x1d9b('0xe'));var qs=require(_0x1d9b('0xf'));var as=require(_0x1d9b('0x10'));var hardwareService=require(_0x1d9b('0x11'));var logger=require(_0x1d9b('0x12'))('api');var utils=require(_0x1d9b('0x13'));var config=require(_0x1d9b('0x14'));var licenseUtil=require(_0x1d9b('0x15'));var db=require(_0x1d9b('0x16'))['db'];config[_0x1d9b('0x17')]=_[_0x1d9b('0x18')](config['redis'],{'host':_0x1d9b('0x19'),'port':0x18eb});var socket=require(_0x1d9b('0x1a'))(new Redis(config[_0x1d9b('0x17')]));require(_0x1d9b('0x1b'))[_0x1d9b('0x1c')](socket);function respondWithStatusCode(_0x5e297a,_0x310981){_0x310981=_0x310981||0xcc;return function(_0x261b2a){if(_0x261b2a){return _0x5e297a[_0x1d9b('0x1d')](_0x310981);}return _0x5e297a[_0x1d9b('0x1e')](_0x310981)[_0x1d9b('0x1f')]();};}function respondWithResult(_0x2ab90f,_0xc7cdad){_0xc7cdad=_0xc7cdad||0xc8;return function(_0x51f02f){if(_0x51f02f){return _0x2ab90f['status'](_0xc7cdad)[_0x1d9b('0x20')](_0x51f02f);}};}function respondWithFilteredResult(_0x3c1c9f,_0xac6e4c){return function(_0x383cdc){if(_0x383cdc){var _0x37fb5b=typeof _0xac6e4c[_0x1d9b('0x21')]===_0x1d9b('0x22')&&typeof _0xac6e4c['limit']===_0x1d9b('0x22');var _0x6d4553=_0x383cdc[_0x1d9b('0x23')];var _0x13dd97=_0x37fb5b?0x0:_0xac6e4c[_0x1d9b('0x21')];var _0x23b827=_0x37fb5b?_0x383cdc[_0x1d9b('0x23')]:_0xac6e4c['offset']+_0xac6e4c['limit'];var _0x22f994;if(_0x23b827>=_0x6d4553){_0x23b827=_0x6d4553;_0x22f994=0xc8;}else{_0x22f994=0xce;}_0x3c1c9f[_0x1d9b('0x1e')](_0x22f994);return _0x3c1c9f['set'](_0x1d9b('0x24'),_0x13dd97+'-'+_0x23b827+'/'+_0x6d4553)['json'](_0x383cdc);}return null;};}function patchUpdates(_0x12905c){return function(_0x3149ca){try{jsonpatch['apply'](_0x3149ca,_0x12905c,!![]);}catch(_0x1f56fb){return BPromise[_0x1d9b('0x25')](_0x1f56fb);}return _0x3149ca[_0x1d9b('0x26')]();};}function saveUpdates(_0x216614,_0x1a59e7){return function(_0x38cc6){if(_0x38cc6){return _0x38cc6[_0x1d9b('0x27')](_0x216614)[_0x1d9b('0x28')](function(_0x389de5){return _0x389de5;});}return null;};}function removeEntity(_0x58592d,_0x55408a){return function(_0x1dca73){if(_0x1dca73){return _0x1dca73[_0x1d9b('0x29')]()[_0x1d9b('0x28')](function(){_0x58592d[_0x1d9b('0x1e')](0xcc)[_0x1d9b('0x1f')]();});}};}function handleEntityNotFound(_0x717a76,_0x44dffb){return function(_0x640974){if(!_0x640974){_0x717a76[_0x1d9b('0x1d')](0x194);}return _0x640974;};}function handleError(_0x158196,_0xb87f3f){_0xb87f3f=_0xb87f3f||0x1f4;return function(_0x513f2f){logger['error'](_0x513f2f[_0x1d9b('0x2a')]);if(_0x513f2f[_0x1d9b('0x2b')]){delete _0x513f2f['name'];}_0x158196['status'](_0xb87f3f)[_0x1d9b('0x2c')](_0x513f2f);};}exports[_0x1d9b('0x2d')]=function(_0x119e1c,_0x4beee9){var _0x4ec58c={},_0x270556={},_0x39d0dc={'count':0x0,'rows':[]};var _0x24c4ec=_[_0x1d9b('0x2e')](db[_0x1d9b('0x2f')]['rawAttributes'],function(_0x3c961b){return{'name':_0x3c961b[_0x1d9b('0x30')],'type':_0x3c961b['type'][_0x1d9b('0x31')]};});_0x270556[_0x1d9b('0x32')]=_[_0x1d9b('0x2e')](_0x24c4ec,_0x1d9b('0x2b'));_0x270556[_0x1d9b('0x33')]=_[_0x1d9b('0x34')](_0x119e1c[_0x1d9b('0x33')]);_0x270556[_0x1d9b('0x35')]=_[_0x1d9b('0x36')](_0x270556['model'],_0x270556[_0x1d9b('0x33')]);_0x4ec58c[_0x1d9b('0x37')]=_['intersection'](_0x270556[_0x1d9b('0x32')],qs[_0x1d9b('0x38')](_0x119e1c['query'][_0x1d9b('0x38')]));_0x4ec58c['attributes']=_0x4ec58c['attributes'][_0x1d9b('0x39')]?_0x4ec58c[_0x1d9b('0x37')]:_0x270556[_0x1d9b('0x32')];if(!_0x119e1c[_0x1d9b('0x33')][_0x1d9b('0x3a')](_0x1d9b('0x3b'))){_0x4ec58c[_0x1d9b('0x3c')]=qs[_0x1d9b('0x3c')](_0x119e1c[_0x1d9b('0x33')][_0x1d9b('0x3c')]);_0x4ec58c['offset']=qs['offset'](_0x119e1c[_0x1d9b('0x33')][_0x1d9b('0x21')]);}_0x4ec58c[_0x1d9b('0x3d')]=qs['sort'](_0x119e1c['query'][_0x1d9b('0x3e')]);_0x4ec58c[_0x1d9b('0x3f')]=qs[_0x1d9b('0x35')](_[_0x1d9b('0x40')](_0x119e1c[_0x1d9b('0x33')],_0x270556[_0x1d9b('0x35')]),_0x24c4ec);if(_0x119e1c['query'][_0x1d9b('0x41')]){_0x4ec58c[_0x1d9b('0x3f')]=_['merge'](_0x4ec58c['where'],{'$or':_['map'](_0x24c4ec,function(_0x37c6d5){if(_0x37c6d5[_0x1d9b('0x42')]!=='VIRTUAL'){var _0x59a6a9={};_0x59a6a9[_0x37c6d5[_0x1d9b('0x2b')]]={'$like':'%'+_0x119e1c[_0x1d9b('0x33')][_0x1d9b('0x41')]+'%'};return _0x59a6a9;}})});}_0x4ec58c=_[_0x1d9b('0x43')]({},_0x4ec58c,_0x119e1c[_0x1d9b('0x44')]);var _0x394353={'where':_0x4ec58c['where']};return db[_0x1d9b('0x2f')][_0x1d9b('0x23')](_0x394353)[_0x1d9b('0x28')](function(_0x362c43){_0x39d0dc[_0x1d9b('0x23')]=_0x362c43;if(_0x119e1c[_0x1d9b('0x33')][_0x1d9b('0x45')]){_0x4ec58c[_0x1d9b('0x46')]=[{'all':!![]}];}return db[_0x1d9b('0x2f')][_0x1d9b('0x47')](_0x4ec58c);})['then'](function(_0x10e6dd){_0x39d0dc['rows']=_0x10e6dd;return _0x39d0dc;})[_0x1d9b('0x28')](respondWithFilteredResult(_0x4beee9,_0x4ec58c))[_0x1d9b('0x48')](handleError(_0x4beee9,null));};exports[_0x1d9b('0x49')]=function(_0x65d8d3,_0x41e344){var _0x4a79c0={'raw':![],'where':{'id':_0x65d8d3['params']['id']}},_0x1c1e0d={};_0x1c1e0d['model']=_['keys'](db[_0x1d9b('0x2f')][_0x1d9b('0x4a')]);_0x1c1e0d[_0x1d9b('0x33')]=_['keys'](_0x65d8d3[_0x1d9b('0x33')]);_0x1c1e0d[_0x1d9b('0x35')]=_['intersection'](_0x1c1e0d[_0x1d9b('0x32')],_0x1c1e0d[_0x1d9b('0x33')]);_0x4a79c0['attributes']=_[_0x1d9b('0x36')](_0x1c1e0d[_0x1d9b('0x32')],qs[_0x1d9b('0x38')](_0x65d8d3[_0x1d9b('0x33')][_0x1d9b('0x38')]));_0x4a79c0['attributes']=_0x4a79c0[_0x1d9b('0x37')][_0x1d9b('0x39')]?_0x4a79c0[_0x1d9b('0x37')]:_0x1c1e0d['model'];if(_0x65d8d3[_0x1d9b('0x33')][_0x1d9b('0x45')]){_0x4a79c0[_0x1d9b('0x46')]=[{'all':!![]}];}_0x4a79c0=_[_0x1d9b('0x43')]({},_0x4a79c0,_0x65d8d3[_0x1d9b('0x44')]);return db[_0x1d9b('0x2f')][_0x1d9b('0x4b')](_0x4a79c0)['then'](handleEntityNotFound(_0x41e344,null))[_0x1d9b('0x28')](respondWithResult(_0x41e344,null))[_0x1d9b('0x48')](handleError(_0x41e344,null));};exports[_0x1d9b('0x4c')]=function(_0x54136a,_0x21dcd3){return db[_0x1d9b('0x2f')][_0x1d9b('0x4c')](_0x54136a['body'],{})['then'](respondWithResult(_0x21dcd3,0xc9))[_0x1d9b('0x48')](handleError(_0x21dcd3,null));};exports[_0x1d9b('0x4d')]=function(_0x49efce,_0xfecdc0){var _0x1ab915={'where':{'id':_0x49efce[_0x1d9b('0x4e')]['id']}},_0x51debb={};_0x51debb[_0x1d9b('0x32')]=_[_0x1d9b('0x34')](db[_0x1d9b('0x2f')]['rawAttributes']);_0x1ab915[_0x1d9b('0x37')]=_[_0x1d9b('0x36')](_0x51debb[_0x1d9b('0x32')],qs[_0x1d9b('0x38')](_0x49efce[_0x1d9b('0x33')]['fields']));_0x1ab915[_0x1d9b('0x37')]=_0x1ab915[_0x1d9b('0x37')][_0x1d9b('0x39')]?_0x1ab915[_0x1d9b('0x37')]:_0x51debb[_0x1d9b('0x32')];if(_0x49efce[_0x1d9b('0x33')][_0x1d9b('0x45')]){_0x1ab915[_0x1d9b('0x46')]=[{'all':!![]}];}_0x1ab915=_[_0x1d9b('0x43')]({},_0x1ab915,_0x49efce['options']);return db[_0x1d9b('0x2f')][_0x1d9b('0x4b')](_0x1ab915)[_0x1d9b('0x28')](handleEntityNotFound(_0xfecdc0,null))['then'](function(_0xa98fcd){if(_0xa98fcd){var _0x95b416=_0xa98fcd[_0x1d9b('0x4f')]({'plain':!![]});_0x95b416=qs[_0x1d9b('0x50')](_0x95b416,['id',_0x1d9b('0x51'),_0x1d9b('0x52'),_0x1d9b('0x53')]);_0x49efce[_0x1d9b('0x54')]=_[_0x1d9b('0x50')](_0x49efce[_0x1d9b('0x54')],['id','createdAt',_0x1d9b('0x52')]);return db[_0x1d9b('0x55')]['transaction'](function(_0x3a4094){return db[_0x1d9b('0x2f')][_0x1d9b('0x4c')](_[_0x1d9b('0x43')](_0x95b416,_0x49efce[_0x1d9b('0x54')]),{'include':_0x49efce[_0x1d9b('0x33')][_0x1d9b('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x3a4094})[_0x1d9b('0x28')](function(_0x3b9864){var _0x214dc1=_0x3b9864[_0x1d9b('0x4f')]({'plain':!![]});return db[_0x1d9b('0x56')][_0x1d9b('0x47')]({'where':{'userProfileId':_0x49efce[_0x1d9b('0x4e')]['id']},'raw':!![]})['then'](function(_0x8eeab7){if(_0x8eeab7){return BPromise[_0x1d9b('0x57')](_0x8eeab7,function(_0x484141){return new BPromise(function(_0xb1e8d3,_0x2cc8c6){if(_0x484141['autoAssociation']===null||_0x484141['autoAssociation']===0x1)_0xb1e8d3(null);return db['UserProfileResource'][_0x1d9b('0x47')]({'where':{'sectionId':_0x484141['id']},'raw':!![]})['then'](function(_0x38977b){var _0x15c4d4=_['map'](_0x38977b,function(_0x4a3763){return qs['omit'](_0x4a3763,['id',_0x1d9b('0x51'),'updatedAt',_0x1d9b('0x58')]);});_0xb1e8d3(_0x15c4d4);})[_0x1d9b('0x48')](function(_0x33e6b5){_0x2cc8c6(_0x33e6b5);});})[_0x1d9b('0x28')](function(_0x36fa0b){var _0x3922eb=qs[_0x1d9b('0x50')](_0x484141,['id',_0x1d9b('0x51'),_0x1d9b('0x52')]);_0x3922eb[_0x1d9b('0x59')]=_0x214dc1['id'];if(_0x36fa0b)_0x3922eb[_0x1d9b('0x5a')]=_0x36fa0b;return _0x3922eb;})[_0x1d9b('0x28')](function(_0x51a2cf){return db[_0x1d9b('0x56')][_0x1d9b('0x4c')](_0x51a2cf,{'include':[{'model':db[_0x1d9b('0x5b')],'as':_0x1d9b('0x5a')}],'raw':!![],'transaction':_0x3a4094});});})[_0x1d9b('0x28')](function(){return _0x214dc1;});}});});});}})['then'](respondWithResult(_0xfecdc0,0xc9))[_0x1d9b('0x48')](handleError(_0xfecdc0,null));};exports['update']=function(_0x5c7a3c,_0x3767d4){if(_0x5c7a3c[_0x1d9b('0x54')]['id']){delete _0x5c7a3c[_0x1d9b('0x54')]['id'];}return db[_0x1d9b('0x2f')][_0x1d9b('0x4b')]({'where':{'id':_0x5c7a3c[_0x1d9b('0x4e')]['id']}})[_0x1d9b('0x28')](handleEntityNotFound(_0x3767d4,null))[_0x1d9b('0x28')](saveUpdates(_0x5c7a3c[_0x1d9b('0x54')],null))[_0x1d9b('0x28')](respondWithResult(_0x3767d4,null))['catch'](handleError(_0x3767d4,null));};exports[_0x1d9b('0x29')]=function(_0x5f046d,_0x79c85f){return db[_0x1d9b('0x2f')]['find']({'where':{'id':_0x5f046d[_0x1d9b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x79c85f,null))[_0x1d9b('0x28')](removeEntity(_0x79c85f,null))[_0x1d9b('0x48')](handleError(_0x79c85f,null));};exports[_0x1d9b('0x5c')]=function(_0x4ff65c,_0x4e6b95){return db[_0x1d9b('0x2f')][_0x1d9b('0x5c')]()['then'](respondWithResult(_0x4e6b95,null))['catch'](handleError(_0x4e6b95,null));};exports['addSections']=function(_0x228f8d,_0x29163f){var _0x1c5b37=_0x228f8d[_0x1d9b('0x54')];return db['UserProfile'][_0x1d9b('0x4b')]({'where':{'id':_0x228f8d[_0x1d9b('0x4e')]['id']}})[_0x1d9b('0x28')](handleEntityNotFound(_0x29163f,null))[_0x1d9b('0x28')](function(_0x4dbb63){if(_0x4dbb63){return db[_0x1d9b('0x55')][_0x1d9b('0x5d')](function(_0x2bb269){return db[_0x1d9b('0x56')][_0x1d9b('0x29')]({'where':{'userProfileId':_0x228f8d[_0x1d9b('0x4e')]['id'],'sectionId':_['map'](_0x1c5b37,function(_0x337526){return _0x337526[_0x1d9b('0x58')];})},'transaction':_0x2bb269})['then'](function(){var _0x2932e2=_['map'](_0x1c5b37,function(_0x387a70){_0x387a70['userProfileId']=_0x228f8d[_0x1d9b('0x4e')]['id'];return _0x387a70;});var _0x40831b=[];return BPromise['each'](_0x2932e2,function(_0x1ba41c){return db[_0x1d9b('0x56')][_0x1d9b('0x4c')](_0x1ba41c,{'include':[{'model':db[_0x1d9b('0x5b')],'as':'Resources'}],'raw':!![],'transaction':_0x2bb269})[_0x1d9b('0x28')](function(_0x158626){_0x40831b['push'](_0x158626[_0x1d9b('0x4f')]({'plain':!![]}));});})[_0x1d9b('0x28')](function(){return _0x40831b;});});});}})[_0x1d9b('0x28')](function(_0x13c0c1){return _0x13c0c1;})[_0x1d9b('0x28')](respondWithResult(_0x29163f,null))[_0x1d9b('0x48')](handleError(_0x29163f,null));};exports[_0x1d9b('0x5e')]=function(_0x593558,_0x4fdf72){var _0x368e74;return db[_0x1d9b('0x2f')][_0x1d9b('0x4b')]({'where':{'id':_0x593558[_0x1d9b('0x4e')]['id']},'attributes':['id',_0x1d9b('0x2b')]})[_0x1d9b('0x28')](handleEntityNotFound(_0x4fdf72,null))['then'](function(_0x2cccc6){if(_0x2cccc6){_0x368e74=_0x2cccc6;return db['UserProfileSection'][_0x1d9b('0x29')]({'where':{'userProfileId':_0x593558['params']['id'],'sectionId':_0x593558[_0x1d9b('0x33')]['ids']}});}})[_0x1d9b('0x28')](function(){return _0x368e74;})[_0x1d9b('0x28')](respondWithStatusCode(_0x4fdf72,null))[_0x1d9b('0x48')](handleError(_0x4fdf72,null));};exports[_0x1d9b('0x5f')]=function(_0x148bad,_0x3f713f){var _0x37f427=[];var _0x1c66e6=[];return db[_0x1d9b('0x56')][_0x1d9b('0x47')]({'where':{'userProfileId':_0x148bad[_0x1d9b('0x4e')]['id']},'raw':!![]})[_0x1d9b('0x28')](function(_0x5e70da){_0x37f427=_['filter'](_0x5e70da,function(_0x1ad7fd){return _0x1ad7fd[_0x1d9b('0x60')]===0x1||_[_0x1d9b('0x61')]([0x3eb,0x709],_0x1ad7fd['sectionId']);});if(!_[_0x1d9b('0x62')](_0x37f427)){return _[_0x1d9b('0x2e')](_0x37f427,function(_0x4c9030){return _0x4c9030[_0x1d9b('0x58')];});}else{return;}})[_0x1d9b('0x28')](function(_0x3727ca){if(_0x3727ca)_0x1c66e6=_0x3727ca;if(_['includes'](_0x1c66e6,0x64)){var _0x32c413=_['find'](_0x37f427,{'sectionId':0x64});return hasDefaultDashboard(_0x32c413)[_0x1d9b('0x28')](function(_0x343c62){return _[_0x1d9b('0x2e')](_0x37f427,function(_0x3ba86f){if(_0x3ba86f[_0x1d9b('0x58')]===0x64){_0x3ba86f[_0x1d9b('0x63')]=_0x343c62;}return _0x3ba86f;});});}else{return;}})['then'](function(_0xfb56ea){if(_0xfb56ea)_0x37f427=_0xfb56ea;if(_[_0x1d9b('0x61')](_0x1c66e6,0x3eb)){var _0x2b23a8=_[_0x1d9b('0x4b')](_0x37f427,{'sectionId':0x3eb});return getCustomDashboards(_0x2b23a8)['then'](function(_0x4fbe5f){return _['map'](_0x37f427,function(_0xa1860b){if(_0x2b23a8[_0x1d9b('0x60')]){if(_0xa1860b[_0x1d9b('0x58')]===0x3eb){_0xa1860b[_0x1d9b('0x63')]=_0x4fbe5f;}}else{if(_0xa1860b[_0x1d9b('0x58')]===0x64){if(!_0xa1860b[_0x1d9b('0x63')]){_0xa1860b[_0x1d9b('0x63')]=[];}_0xa1860b[_0x1d9b('0x63')]=_0xa1860b['subsections'][_0x1d9b('0x64')](_0x4fbe5f);}}return _0xa1860b;});});}else{return;}})[_0x1d9b('0x28')](function(_0x3844e8){if(_0x3844e8)_0x37f427=_0x3844e8;if(_[_0x1d9b('0x61')](_0x1c66e6,0x709)){var _0x3377cd=_[_0x1d9b('0x4b')](_0x37f427,{'sectionId':0x709});return getPlugins(_0x3377cd)[_0x1d9b('0x28')](function(_0x385d14){if(_0x3377cd[_0x1d9b('0x60')]){return _['map'](_0x37f427,function(_0x399fc6){if(_0x399fc6[_0x1d9b('0x58')]===0x709){_0x399fc6[_0x1d9b('0x63')]=_0x385d14;}return _0x399fc6;});}else{var _0x4967a1={'sectionId':0x76c,'enabled':0x1,'subsections':_0x385d14};var _0x3d3b82=_[_0x1d9b('0x2e')](_0x37f427);_0x3d3b82[_0x1d9b('0x65')](_0x4967a1);return _0x3d3b82;}});}else{return;}})[_0x1d9b('0x28')](function(_0x9e02cb){if(_0x9e02cb)_0x37f427=_0x9e02cb;return _[_0x1d9b('0x41')](_0x37f427,[_0x1d9b('0x60'),0x1]);})['then'](respondWithResult(_0x3f713f,null))[_0x1d9b('0x48')](handleError(_0x3f713f,null));};function hasDefaultDashboard(_0x3e27b7){var _0x12848b=[0x65];return new BPromise(function(_0x40e992,_0x11fb26){try{if(_0x3e27b7[_0x1d9b('0x66')]){_0x40e992(_0x12848b);}else{return db[_0x1d9b('0x5b')][_0x1d9b('0x67')]({'where':{'sectionId':_0x3e27b7['id']},'raw':!![]})['then'](function(_0x2043f8){_0x2043f8?_0x40e992(_0x12848b):_0x40e992();});}}catch(_0x3e16f0){_0x11fb26(_0x3e16f0);}});}function getCustomDashboards(_0x3e1143){var _0x4dcae7=[];return new BPromise(function(_0x300b09,_0x293684){try{if(_0x3e1143[_0x1d9b('0x66')]){return db['Dashboard'][_0x1d9b('0x47')]({'raw':!![]})['then'](function(_0x5cc7d7){_0x5cc7d7[_0x1d9b('0x68')](function(_0x5ce7d8){_0x4dcae7[_0x1d9b('0x65')](_0x5ce7d8['id']+0x1869f);});_0x300b09(_0x4dcae7);});}else{return db[_0x1d9b('0x5b')][_0x1d9b('0x47')]({'where':{'sectionId':_0x3e1143['id']},'raw':!![]})[_0x1d9b('0x28')](function(_0x232382){_0x232382[_0x1d9b('0x68')](function(_0x5bcfa8){_0x4dcae7[_0x1d9b('0x65')](_0x5bcfa8[_0x1d9b('0x69')]+0x1869f);});_0x300b09(_0x4dcae7);});}}catch(_0x24ebe5){_0x293684(_0x24ebe5);}});}function getPlugins(_0x12b9a7){var _0x518034=[];return new BPromise(function(_0x18ca26,_0x2d7296){try{if(_0x12b9a7[_0x1d9b('0x66')]){return db[_0x1d9b('0x6a')][_0x1d9b('0x47')]({'raw':!![]})[_0x1d9b('0x28')](function(_0x36d874){_0x36d874[_0x1d9b('0x68')](function(_0x34a36e){_0x518034[_0x1d9b('0x65')](_0x34a36e['id']+0x15b38);});_0x18ca26(_0x518034);});}else{return db[_0x1d9b('0x5b')][_0x1d9b('0x47')]({'where':{'sectionId':_0x12b9a7['id']},'raw':!![]})[_0x1d9b('0x28')](function(_0x39c669){_0x39c669['forEach'](function(_0x497d68){_0x518034[_0x1d9b('0x65')](_0x497d68['resourceId']+0x15b38);});_0x18ca26(_0x518034);});}}catch(_0x43140a){_0x2d7296(_0x43140a);}});}exports[_0x1d9b('0x6b')]=function(_0x371528,_0x2b9c0f){return db[_0x1d9b('0x2f')][_0x1d9b('0x4b')]({'where':{'id':_0x371528[_0x1d9b('0x4e')]['id']}})[_0x1d9b('0x28')](handleEntityNotFound(_0x2b9c0f,null))[_0x1d9b('0x28')](function(_0x5e182e){if(_0x5e182e){return db[_0x1d9b('0x55')][_0x1d9b('0x5d')](function(_0x6ab898){return db['UserProfileSection'][_0x1d9b('0x47')]({'where':{'userProfileId':_0x371528['params']['id']},'attributes':['id'],'raw':!![]})[_0x1d9b('0x28')](function(_0x2774a2){if(_0x2774a2){return db[_0x1d9b('0x56')][_0x1d9b('0x29')]({'where':{'userProfileId':_0x371528[_0x1d9b('0x4e')]['id'],'id':_[_0x1d9b('0x2e')](_0x2774a2,function(_0x24b2fe){return _0x24b2fe['id'];})},'transaction':_0x6ab898});}})[_0x1d9b('0x28')](function(_0x123f53){var _0x2e65ce=_[_0x1d9b('0x2e')](_0x371528[_0x1d9b('0x54')],function(_0x397913){_0x397913[_0x1d9b('0x59')]=_0x371528[_0x1d9b('0x4e')]['id'];return _0x397913;});return db[_0x1d9b('0x56')][_0x1d9b('0x6c')](_0x2e65ce,{'raw':!![],'transaction':_0x6ab898});})['then'](function(_0x43bb8e){var _0x2da09b=_[_0x1d9b('0x41')](_['map'](_0x43bb8e,function(_0x295c44){return _0x295c44['get']({'plain':!![]});}),{'includeAll':![]});if(_0x2da09b){return db['UserProfileSection'][_0x1d9b('0x47')]({'where':{'userProfileId':_0x371528[_0x1d9b('0x4e')]['id'],'sectionId':_['map'](_0x2da09b,function(_0x49e765){return _0x49e765[_0x1d9b('0x58')];})},'attributes':['id',_0x1d9b('0x58')],'raw':!![]})[_0x1d9b('0x28')](function(_0x5c2eb7){var _0x1fc04e=_[_0x1d9b('0x2e')](_0x371528['body'],function(_0x1d60af){_0x1d60af[_0x1d9b('0x59')]=_0x371528[_0x1d9b('0x4e')]['id'];return _0x1d60af;});return db['UserProfileResource'][_0x1d9b('0x6c')](_0x1fc04e,{'raw':!![],'transaction':_0x6ab898});});}})[_0x1d9b('0x48')](handleError(_0x2b9c0f,null));});}})[_0x1d9b('0x28')](function(_0x5178d4){var _0x2c9779=_[_0x1d9b('0x2e')](_0x5178d4,function(_0x579159){return _0x579159[_0x1d9b('0x4f')]({'plain':!![]});});})[_0x1d9b('0x28')](respondWithResult(_0x2b9c0f,null))[_0x1d9b('0x48')](handleError(_0x2b9c0f,null));};exports[_0x1d9b('0x6d')]=function(_0x3c1a68,_0x39892e,_0x1c7801){return db[_0x1d9b('0x2f')]['find']({'where':{'id':_0x3c1a68['params']['id']}})['then'](handleEntityNotFound(_0x39892e,null))[_0x1d9b('0x28')](function(_0x41dbdf){if(_0x41dbdf){return _0x41dbdf[_0x1d9b('0x6d')](_0x3c1a68[_0x1d9b('0x33')][_0x1d9b('0x6e')]);}})[_0x1d9b('0x28')](respondWithStatusCode(_0x39892e,null))['catch'](handleError(_0x39892e,null));};exports[_0x1d9b('0x6f')]=function(_0x89135f,_0x11f8d1){var _0x8e1b12={};if(!_0x89135f[_0x1d9b('0x33')][_0x1d9b('0x70')])throw new Error(_0x1d9b('0x71'));if(!_0x89135f[_0x1d9b('0x33')]['hasOwnProperty']('nolimit')){_0x8e1b12['limit']=qs[_0x1d9b('0x3c')](_0x89135f[_0x1d9b('0x33')][_0x1d9b('0x3c')]);_0x8e1b12[_0x1d9b('0x21')]=qs[_0x1d9b('0x21')](_0x89135f[_0x1d9b('0x33')]['offset']);}return db[_0x1d9b('0x2f')]['find']({'where':{'id':_0x89135f[_0x1d9b('0x4e')]['id']}})[_0x1d9b('0x28')](function(_0x2432eb){if(!_0x2432eb)throw new Error(_0x1d9b('0x72')+_0x89135f[_0x1d9b('0x4e')]['id']);return db[_0x1d9b('0x2f')][_0x1d9b('0x6f')](_0x89135f);})[_0x1d9b('0x28')](respondWithFilteredResult(_0x11f8d1,_0x8e1b12))[_0x1d9b('0x48')](handleError(_0x11f8d1,null));}; \ No newline at end of file +var _0xe698=['includeAll','get','omit','crudPermissions','body','createdAt','updatedAt','transaction','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','sequelize','UserProfileSection','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','concat','push','findOne','Dashboard','resourceId','Plugin','forEach','addResources','bulkCreate','removeResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./userProfile.socket','register','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','index','map','UserProfile','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','clone'];(function(_0x868dbb,_0x26cc25){var _0x2ccd37=function(_0x3e99f8){while(--_0x3e99f8){_0x868dbb['push'](_0x868dbb['shift']());}};_0x2ccd37(++_0x26cc25);}(_0xe698,0x188));var _0x8e69=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe698[_0x40a045];return _0x1a687c;};'use strict';var emlformat=require(_0x8e69('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8e69('0x1'));var jsonpatch=require(_0x8e69('0x2'));var rp=require(_0x8e69('0x3'));var moment=require(_0x8e69('0x4'));var BPromise=require(_0x8e69('0x5'));var Mustache=require(_0x8e69('0x6'));var util=require(_0x8e69('0x7'));var path=require('path');var sox=require(_0x8e69('0x8'));var csv=require(_0x8e69('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8e69('0xa'));var squel=require(_0x8e69('0xb'));var crypto=require(_0x8e69('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8e69('0xd'));var toCsv=require(_0x8e69('0x9'));var querystring=require('querystring');var Papa=require(_0x8e69('0xe'));var Redis=require(_0x8e69('0xf'));var authService=require(_0x8e69('0x10'));var qs=require(_0x8e69('0x11'));var as=require(_0x8e69('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e69('0x13'))(_0x8e69('0x14'));var utils=require(_0x8e69('0x15'));var config=require(_0x8e69('0x16'));var licenseUtil=require(_0x8e69('0x17'));var db=require(_0x8e69('0x18'))['db'];config[_0x8e69('0x19')]=_[_0x8e69('0x1a')](config[_0x8e69('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8e69('0x19')]));require(_0x8e69('0x1b'))[_0x8e69('0x1c')](socket);function respondWithStatusCode(_0x2203ee,_0x41faee){_0x41faee=_0x41faee||0xcc;return function(_0x1d57c8){if(_0x1d57c8){return _0x2203ee['sendStatus'](_0x41faee);}return _0x2203ee['status'](_0x41faee)['end']();};}function respondWithResult(_0x5e7522,_0x10f568){_0x10f568=_0x10f568||0xc8;return function(_0x2ce309){if(_0x2ce309){return _0x5e7522[_0x8e69('0x1d')](_0x10f568)['json'](_0x2ce309);}};}function respondWithFilteredResult(_0x623bf3,_0x6a2260){return function(_0x2224b5){if(_0x2224b5){var _0x35b1e8=typeof _0x6a2260['offset']===_0x8e69('0x1e')&&typeof _0x6a2260[_0x8e69('0x1f')]===_0x8e69('0x1e');var _0x5be90c=_0x2224b5[_0x8e69('0x20')];var _0x521ea2=_0x35b1e8?0x0:_0x6a2260[_0x8e69('0x21')];var _0x26d860=_0x35b1e8?_0x2224b5[_0x8e69('0x20')]:_0x6a2260[_0x8e69('0x21')]+_0x6a2260[_0x8e69('0x1f')];var _0x2c0ba1;if(_0x26d860>=_0x5be90c){_0x26d860=_0x5be90c;_0x2c0ba1=0xc8;}else{_0x2c0ba1=0xce;}_0x623bf3[_0x8e69('0x1d')](_0x2c0ba1);return _0x623bf3[_0x8e69('0x22')](_0x8e69('0x23'),_0x521ea2+'-'+_0x26d860+'/'+_0x5be90c)[_0x8e69('0x24')](_0x2224b5);}return null;};}function patchUpdates(_0x43b406){return function(_0x2ac9c9){try{jsonpatch[_0x8e69('0x25')](_0x2ac9c9,_0x43b406,!![]);}catch(_0x4177bf){return BPromise['reject'](_0x4177bf);}return _0x2ac9c9[_0x8e69('0x26')]();};}function saveUpdates(_0x3cc1bd,_0x125924){return function(_0x2a3518){if(_0x2a3518){return _0x2a3518[_0x8e69('0x27')](_0x3cc1bd)[_0x8e69('0x28')](function(_0x522c95){return _0x522c95;});}return null;};}function removeEntity(_0xfda4f3,_0x2e5eb7){return function(_0x5ce7f8){if(_0x5ce7f8){return _0x5ce7f8[_0x8e69('0x29')]()[_0x8e69('0x28')](function(){_0xfda4f3['status'](0xcc)[_0x8e69('0x2a')]();});}};}function handleEntityNotFound(_0x2abe9c,_0x5b779a){return function(_0x556e25){if(!_0x556e25){_0x2abe9c['sendStatus'](0x194);}return _0x556e25;};}function handleError(_0x58a6d8,_0x2dd233){_0x2dd233=_0x2dd233||0x1f4;return function(_0x55a42a){logger[_0x8e69('0x2b')](_0x55a42a[_0x8e69('0x2c')]);if(_0x55a42a[_0x8e69('0x2d')]){delete _0x55a42a[_0x8e69('0x2d')];}_0x58a6d8[_0x8e69('0x1d')](_0x2dd233)['send'](_0x55a42a);};}exports[_0x8e69('0x2e')]=function(_0x1b290e,_0x29f817){var _0x15af0d={},_0x4ce989={},_0x2def0f={'count':0x0,'rows':[]};var _0x3924f4=_[_0x8e69('0x2f')](db[_0x8e69('0x30')]['rawAttributes'],function(_0x3f07b0){return{'name':_0x3f07b0[_0x8e69('0x31')],'type':_0x3f07b0[_0x8e69('0x32')][_0x8e69('0x33')]};});_0x4ce989[_0x8e69('0x34')]=_[_0x8e69('0x2f')](_0x3924f4,_0x8e69('0x2d'));_0x4ce989[_0x8e69('0x35')]=_['keys'](_0x1b290e[_0x8e69('0x35')]);_0x4ce989[_0x8e69('0x36')]=_[_0x8e69('0x37')](_0x4ce989['model'],_0x4ce989[_0x8e69('0x35')]);_0x15af0d[_0x8e69('0x38')]=_[_0x8e69('0x37')](_0x4ce989[_0x8e69('0x34')],qs['fields'](_0x1b290e[_0x8e69('0x35')][_0x8e69('0x39')]));_0x15af0d['attributes']=_0x15af0d['attributes'][_0x8e69('0x3a')]?_0x15af0d[_0x8e69('0x38')]:_0x4ce989[_0x8e69('0x34')];if(!_0x1b290e['query'][_0x8e69('0x3b')](_0x8e69('0x3c'))){_0x15af0d[_0x8e69('0x1f')]=qs[_0x8e69('0x1f')](_0x1b290e['query'][_0x8e69('0x1f')]);_0x15af0d[_0x8e69('0x21')]=qs[_0x8e69('0x21')](_0x1b290e[_0x8e69('0x35')][_0x8e69('0x21')]);}_0x15af0d[_0x8e69('0x3d')]=qs[_0x8e69('0x3e')](_0x1b290e['query']['sort']);_0x15af0d['where']=qs['filters'](_[_0x8e69('0x3f')](_0x1b290e[_0x8e69('0x35')],_0x4ce989[_0x8e69('0x36')]),_0x3924f4);if(_0x1b290e[_0x8e69('0x35')]['filter']){_0x15af0d['where']=_[_0x8e69('0x40')](_0x15af0d[_0x8e69('0x41')],{'$or':_[_0x8e69('0x2f')](_0x3924f4,function(_0x4ac6d3){if(_0x4ac6d3['type']!==_0x8e69('0x42')){var _0x4c53ec={};_0x4c53ec[_0x4ac6d3['name']]={'$like':'%'+_0x1b290e[_0x8e69('0x35')][_0x8e69('0x43')]+'%'};return _0x4c53ec;}})});}_0x15af0d=_['merge']({},_0x15af0d,_0x1b290e[_0x8e69('0x44')]);var _0x2d49ee={'where':_0x15af0d[_0x8e69('0x41')]};return db['UserProfile'][_0x8e69('0x20')](_0x2d49ee)[_0x8e69('0x28')](function(_0x409675){_0x2def0f[_0x8e69('0x20')]=_0x409675;if(_0x1b290e[_0x8e69('0x35')]['includeAll']){_0x15af0d[_0x8e69('0x45')]=[{'all':!![]}];}return db['UserProfile'][_0x8e69('0x46')](_0x15af0d);})[_0x8e69('0x28')](function(_0x247cbe){_0x2def0f[_0x8e69('0x47')]=_0x247cbe;return _0x2def0f;})['then'](respondWithFilteredResult(_0x29f817,_0x15af0d))[_0x8e69('0x48')](handleError(_0x29f817,null));};exports[_0x8e69('0x49')]=function(_0x33048c,_0xe73a7a){var _0x55d8ab={'raw':![],'where':{'id':_0x33048c[_0x8e69('0x4a')]['id']}},_0x22f733={};_0x22f733['model']=_[_0x8e69('0x4b')](db[_0x8e69('0x30')][_0x8e69('0x4c')]);_0x22f733[_0x8e69('0x35')]=_[_0x8e69('0x4b')](_0x33048c[_0x8e69('0x35')]);_0x22f733[_0x8e69('0x36')]=_[_0x8e69('0x37')](_0x22f733[_0x8e69('0x34')],_0x22f733[_0x8e69('0x35')]);_0x55d8ab[_0x8e69('0x38')]=_['intersection'](_0x22f733[_0x8e69('0x34')],qs[_0x8e69('0x39')](_0x33048c[_0x8e69('0x35')]['fields']));_0x55d8ab['attributes']=_0x55d8ab[_0x8e69('0x38')][_0x8e69('0x3a')]?_0x55d8ab[_0x8e69('0x38')]:_0x22f733[_0x8e69('0x34')];if(_0x33048c[_0x8e69('0x35')]['includeAll']){_0x55d8ab['include']=[{'all':!![]}];}_0x55d8ab=_['merge']({},_0x55d8ab,_0x33048c['options']);return db[_0x8e69('0x30')][_0x8e69('0x4d')](_0x55d8ab)[_0x8e69('0x28')](handleEntityNotFound(_0xe73a7a,null))[_0x8e69('0x28')](respondWithResult(_0xe73a7a,null))[_0x8e69('0x48')](handleError(_0xe73a7a,null));};exports[_0x8e69('0x4e')]=function(_0x1b3888,_0x4c8f0e){return db[_0x8e69('0x30')][_0x8e69('0x4e')](_0x1b3888['body'],{})['then'](respondWithResult(_0x4c8f0e,0xc9))[_0x8e69('0x48')](handleError(_0x4c8f0e,null));};exports[_0x8e69('0x4f')]=function(_0x1ac3d6,_0x2f423c){var _0x13aaaf={'where':{'id':_0x1ac3d6[_0x8e69('0x4a')]['id']}},_0x1d8a69={};_0x1d8a69[_0x8e69('0x34')]=_[_0x8e69('0x4b')](db[_0x8e69('0x30')]['rawAttributes']);_0x13aaaf[_0x8e69('0x38')]=_[_0x8e69('0x37')](_0x1d8a69['model'],qs[_0x8e69('0x39')](_0x1ac3d6[_0x8e69('0x35')]['fields']));_0x13aaaf[_0x8e69('0x38')]=_0x13aaaf[_0x8e69('0x38')][_0x8e69('0x3a')]?_0x13aaaf['attributes']:_0x1d8a69[_0x8e69('0x34')];if(_0x1ac3d6[_0x8e69('0x35')][_0x8e69('0x50')]){_0x13aaaf[_0x8e69('0x45')]=[{'all':!![]}];}_0x13aaaf=_[_0x8e69('0x40')]({},_0x13aaaf,_0x1ac3d6['options']);return db[_0x8e69('0x30')][_0x8e69('0x4d')](_0x13aaaf)[_0x8e69('0x28')](handleEntityNotFound(_0x2f423c,null))[_0x8e69('0x28')](function(_0x3eda8d){if(_0x3eda8d){var _0xd19a3f=_0x3eda8d[_0x8e69('0x51')]({'plain':!![]});_0xd19a3f=qs[_0x8e69('0x52')](_0xd19a3f,['id','createdAt','updatedAt',_0x8e69('0x53')]);_0x1ac3d6[_0x8e69('0x54')]=_['omit'](_0x1ac3d6[_0x8e69('0x54')],['id',_0x8e69('0x55'),_0x8e69('0x56')]);return db['sequelize'][_0x8e69('0x57')](function(_0x4c9f56){return db['UserProfile'][_0x8e69('0x4e')](_[_0x8e69('0x40')](_0xd19a3f,_0x1ac3d6[_0x8e69('0x54')]),{'include':_0x1ac3d6[_0x8e69('0x35')][_0x8e69('0x50')]?[{'all':!![]}]:undefined,'transaction':_0x4c9f56})[_0x8e69('0x28')](function(_0x39e43f){var _0x388479=_0x39e43f[_0x8e69('0x51')]({'plain':!![]});return db['UserProfileSection'][_0x8e69('0x46')]({'where':{'userProfileId':_0x1ac3d6[_0x8e69('0x4a')]['id']},'raw':!![]})[_0x8e69('0x28')](function(_0x431429){if(_0x431429){return BPromise[_0x8e69('0x58')](_0x431429,function(_0x741118){return new BPromise(function(_0x302ccd,_0x5a0dd0){if(_0x741118[_0x8e69('0x59')]===null||_0x741118[_0x8e69('0x59')]===0x1)_0x302ccd(null);return db[_0x8e69('0x5a')][_0x8e69('0x46')]({'where':{'sectionId':_0x741118['id']},'raw':!![]})['then'](function(_0x13eddf){var _0x1824e8=_[_0x8e69('0x2f')](_0x13eddf,function(_0x473ab0){return qs[_0x8e69('0x52')](_0x473ab0,['id',_0x8e69('0x55'),'updatedAt',_0x8e69('0x5b')]);});_0x302ccd(_0x1824e8);})[_0x8e69('0x48')](function(_0x3c10fe){_0x5a0dd0(_0x3c10fe);});})[_0x8e69('0x28')](function(_0x23a283){var _0x25b007=qs[_0x8e69('0x52')](_0x741118,['id','createdAt',_0x8e69('0x56')]);_0x25b007[_0x8e69('0x5c')]=_0x388479['id'];if(_0x23a283)_0x25b007[_0x8e69('0x5d')]=_0x23a283;return _0x25b007;})['then'](function(_0x58fed5){return db['UserProfileSection']['create'](_0x58fed5,{'include':[{'model':db[_0x8e69('0x5a')],'as':_0x8e69('0x5d')}],'raw':!![],'transaction':_0x4c9f56});});})[_0x8e69('0x28')](function(){return _0x388479;});}});});});}})['then'](respondWithResult(_0x2f423c,0xc9))[_0x8e69('0x48')](handleError(_0x2f423c,null));};exports[_0x8e69('0x27')]=function(_0x5eff75,_0xbceefc){if(_0x5eff75[_0x8e69('0x54')]['id']){delete _0x5eff75[_0x8e69('0x54')]['id'];}return db[_0x8e69('0x30')][_0x8e69('0x4d')]({'where':{'id':_0x5eff75[_0x8e69('0x4a')]['id']}})['then'](handleEntityNotFound(_0xbceefc,null))[_0x8e69('0x28')](saveUpdates(_0x5eff75['body'],null))[_0x8e69('0x28')](respondWithResult(_0xbceefc,null))[_0x8e69('0x48')](handleError(_0xbceefc,null));};exports[_0x8e69('0x29')]=function(_0x4704da,_0x1facd1){return db[_0x8e69('0x30')][_0x8e69('0x4d')]({'where':{'id':_0x4704da[_0x8e69('0x4a')]['id']}})[_0x8e69('0x28')](handleEntityNotFound(_0x1facd1,null))[_0x8e69('0x28')](removeEntity(_0x1facd1,null))[_0x8e69('0x48')](handleError(_0x1facd1,null));};exports['describe']=function(_0xafa24d,_0x1920af){return db['UserProfile'][_0x8e69('0x5e')]()[_0x8e69('0x28')](respondWithResult(_0x1920af,null))[_0x8e69('0x48')](handleError(_0x1920af,null));};exports[_0x8e69('0x5f')]=function(_0x26b5b9,_0x43d7b0){var _0x20867e=_0x26b5b9[_0x8e69('0x54')];return db[_0x8e69('0x30')][_0x8e69('0x4d')]({'where':{'id':_0x26b5b9[_0x8e69('0x4a')]['id']}})[_0x8e69('0x28')](handleEntityNotFound(_0x43d7b0,null))[_0x8e69('0x28')](function(_0x243e8e){if(_0x243e8e){return db[_0x8e69('0x60')][_0x8e69('0x57')](function(_0x5e0bb8){return db[_0x8e69('0x61')]['destroy']({'where':{'userProfileId':_0x26b5b9[_0x8e69('0x4a')]['id'],'sectionId':_['map'](_0x20867e,function(_0x21f96d){return _0x21f96d[_0x8e69('0x5b')];})},'transaction':_0x5e0bb8})[_0x8e69('0x28')](function(){var _0x346da2=_[_0x8e69('0x2f')](_0x20867e,function(_0x2cc3eb){_0x2cc3eb[_0x8e69('0x5c')]=_0x26b5b9[_0x8e69('0x4a')]['id'];return _0x2cc3eb;});var _0x6d70d0=[];return BPromise[_0x8e69('0x58')](_0x346da2,function(_0x226914){return db[_0x8e69('0x61')][_0x8e69('0x4e')](_0x226914,{'include':[{'model':db[_0x8e69('0x5a')],'as':'Resources'}],'raw':!![],'transaction':_0x5e0bb8})[_0x8e69('0x28')](function(_0x1bec09){_0x6d70d0['push'](_0x1bec09['get']({'plain':!![]}));});})['then'](function(){return _0x6d70d0;});});});}})[_0x8e69('0x28')](function(_0x44a736){return _0x44a736;})[_0x8e69('0x28')](respondWithResult(_0x43d7b0,null))[_0x8e69('0x48')](handleError(_0x43d7b0,null));};exports[_0x8e69('0x62')]=function(_0x375b64,_0x1da493){var _0x198834;return db['UserProfile']['find']({'where':{'id':_0x375b64['params']['id']},'attributes':['id',_0x8e69('0x2d')]})[_0x8e69('0x28')](handleEntityNotFound(_0x1da493,null))[_0x8e69('0x28')](function(_0x2a84a8){if(_0x2a84a8){_0x198834=_0x2a84a8;return db[_0x8e69('0x61')][_0x8e69('0x29')]({'where':{'userProfileId':_0x375b64['params']['id'],'sectionId':_0x375b64[_0x8e69('0x35')][_0x8e69('0x63')]}});}})[_0x8e69('0x28')](function(){return _0x198834;})[_0x8e69('0x28')](respondWithStatusCode(_0x1da493,null))[_0x8e69('0x48')](handleError(_0x1da493,null));};exports[_0x8e69('0x64')]=function(_0xeaaa1b,_0x4d849e){var _0x556027=[];var _0x8c8395=[];return db[_0x8e69('0x61')][_0x8e69('0x46')]({'where':{'userProfileId':_0xeaaa1b[_0x8e69('0x4a')]['id']},'raw':!![]})[_0x8e69('0x28')](function(_0x4e267f){_0x556027=_[_0x8e69('0x43')](_0x4e267f,function(_0x48a366){return _0x48a366[_0x8e69('0x65')]===0x1||_['includes']([0x3eb,0x709],_0x48a366[_0x8e69('0x5b')]);});if(!_[_0x8e69('0x66')](_0x556027)){return _[_0x8e69('0x2f')](_0x556027,function(_0x32e4bb){return _0x32e4bb[_0x8e69('0x5b')];});}else{return;}})['then'](function(_0x10a3ec){if(_0x10a3ec)_0x8c8395=_0x10a3ec;if(_[_0x8e69('0x67')](_0x8c8395,0x64)){var _0x37e7f6=_[_0x8e69('0x4d')](_0x556027,{'sectionId':0x64});return hasDefaultDashboard(_0x37e7f6)[_0x8e69('0x28')](function(_0x399934){return _[_0x8e69('0x2f')](_0x556027,function(_0x42f749){if(_0x42f749[_0x8e69('0x5b')]===0x64){_0x42f749[_0x8e69('0x68')]=_0x399934;}return _0x42f749;});});}else{return;}})[_0x8e69('0x28')](function(_0x4d02d4){if(_0x4d02d4)_0x556027=_0x4d02d4;if(_[_0x8e69('0x67')](_0x8c8395,0x3eb)){var _0x2d9e35=_[_0x8e69('0x4d')](_0x556027,{'sectionId':0x3eb});return getCustomDashboards(_0x2d9e35)[_0x8e69('0x28')](function(_0x250a2a){return _['map'](_0x556027,function(_0x500933){if(_0x2d9e35[_0x8e69('0x65')]){if(_0x500933['sectionId']===0x3eb){_0x500933[_0x8e69('0x68')]=_0x250a2a;}}else{if(_0x500933[_0x8e69('0x5b')]===0x64){if(!_0x500933[_0x8e69('0x68')]){_0x500933[_0x8e69('0x68')]=[];}_0x500933[_0x8e69('0x68')]=_0x500933[_0x8e69('0x68')][_0x8e69('0x69')](_0x250a2a);}}return _0x500933;});});}else{return;}})[_0x8e69('0x28')](function(_0x43ba3a){if(_0x43ba3a)_0x556027=_0x43ba3a;if(_[_0x8e69('0x67')](_0x8c8395,0x709)){var _0xb87324=_['find'](_0x556027,{'sectionId':0x709});return getPlugins(_0xb87324)['then'](function(_0x474fd6){if(_0xb87324[_0x8e69('0x65')]){return _[_0x8e69('0x2f')](_0x556027,function(_0x417222){if(_0x417222['sectionId']===0x709){_0x417222[_0x8e69('0x68')]=_0x474fd6;}return _0x417222;});}else{var _0x36c59c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x474fd6};var _0x5cc62c=_[_0x8e69('0x2f')](_0x556027);_0x5cc62c[_0x8e69('0x6a')](_0x36c59c);return _0x5cc62c;}});}else{return;}})[_0x8e69('0x28')](function(_0x291db1){if(_0x291db1)_0x556027=_0x291db1;return _[_0x8e69('0x43')](_0x556027,[_0x8e69('0x65'),0x1]);})[_0x8e69('0x28')](respondWithResult(_0x4d849e,null))['catch'](handleError(_0x4d849e,null));};function hasDefaultDashboard(_0x35fd48){var _0x5b04fd=[0x65];return new BPromise(function(_0x13f4ba,_0x3f1f58){try{if(_0x35fd48[_0x8e69('0x59')]){_0x13f4ba(_0x5b04fd);}else{return db[_0x8e69('0x5a')][_0x8e69('0x6b')]({'where':{'sectionId':_0x35fd48['id']},'raw':!![]})[_0x8e69('0x28')](function(_0x5657b1){_0x5657b1?_0x13f4ba(_0x5b04fd):_0x13f4ba();});}}catch(_0x3b0e9a){_0x3f1f58(_0x3b0e9a);}});}function getCustomDashboards(_0x4bd731){var _0x3d040f=[];return new BPromise(function(_0x5873c4,_0x46271e){try{if(_0x4bd731[_0x8e69('0x59')]){return db[_0x8e69('0x6c')][_0x8e69('0x46')]({'raw':!![]})[_0x8e69('0x28')](function(_0x2771b1){_0x2771b1['forEach'](function(_0x2ae979){_0x3d040f[_0x8e69('0x6a')](_0x2ae979['id']+0x1869f);});_0x5873c4(_0x3d040f);});}else{return db['UserProfileResource'][_0x8e69('0x46')]({'where':{'sectionId':_0x4bd731['id']},'raw':!![]})['then'](function(_0xe68e78){_0xe68e78['forEach'](function(_0x2aff86){_0x3d040f[_0x8e69('0x6a')](_0x2aff86[_0x8e69('0x6d')]+0x1869f);});_0x5873c4(_0x3d040f);});}}catch(_0x6721f9){_0x46271e(_0x6721f9);}});}function getPlugins(_0x2df214){var _0x3b7267=[];return new BPromise(function(_0x59d11f,_0x4e593f){try{if(_0x2df214[_0x8e69('0x59')]){return db[_0x8e69('0x6e')][_0x8e69('0x46')]({'raw':!![]})[_0x8e69('0x28')](function(_0x148fa9){_0x148fa9['forEach'](function(_0x5a0857){_0x3b7267['push'](_0x5a0857['id']+0x15b38);});_0x59d11f(_0x3b7267);});}else{return db[_0x8e69('0x5a')]['findAll']({'where':{'sectionId':_0x2df214['id']},'raw':!![]})[_0x8e69('0x28')](function(_0x2c49ea){_0x2c49ea[_0x8e69('0x6f')](function(_0x2cf22){_0x3b7267[_0x8e69('0x6a')](_0x2cf22[_0x8e69('0x6d')]+0x15b38);});_0x59d11f(_0x3b7267);});}}catch(_0x52c035){_0x4e593f(_0x52c035);}});}exports[_0x8e69('0x70')]=function(_0x4911f6,_0x25425a){return db[_0x8e69('0x30')][_0x8e69('0x4d')]({'where':{'id':_0x4911f6[_0x8e69('0x4a')]['id']}})[_0x8e69('0x28')](handleEntityNotFound(_0x25425a,null))[_0x8e69('0x28')](function(_0x4e525e){if(_0x4e525e){return db[_0x8e69('0x60')][_0x8e69('0x57')](function(_0x4680fb){return db[_0x8e69('0x61')][_0x8e69('0x46')]({'where':{'userProfileId':_0x4911f6[_0x8e69('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0x8e69('0x28')](function(_0x2c5431){if(_0x2c5431){return db[_0x8e69('0x61')]['destroy']({'where':{'userProfileId':_0x4911f6[_0x8e69('0x4a')]['id'],'id':_[_0x8e69('0x2f')](_0x2c5431,function(_0x15dfda){return _0x15dfda['id'];})},'transaction':_0x4680fb});}})[_0x8e69('0x28')](function(_0x19a5fa){var _0x50cd62=_[_0x8e69('0x2f')](_0x4911f6[_0x8e69('0x54')],function(_0x383e78){_0x383e78['userProfileId']=_0x4911f6[_0x8e69('0x4a')]['id'];return _0x383e78;});return db[_0x8e69('0x61')]['bulkCreate'](_0x50cd62,{'raw':!![],'transaction':_0x4680fb});})['then'](function(_0x23d997){var _0x2dc652=_['filter'](_['map'](_0x23d997,function(_0x46eef4){return _0x46eef4[_0x8e69('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x2dc652){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x4911f6[_0x8e69('0x4a')]['id'],'sectionId':_['map'](_0x2dc652,function(_0x1a0dbd){return _0x1a0dbd[_0x8e69('0x5b')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x4d9f9a){var _0x30bc8e=_[_0x8e69('0x2f')](_0x4911f6[_0x8e69('0x54')],function(_0x2eaa1e){_0x2eaa1e['userProfileId']=_0x4911f6['params']['id'];return _0x2eaa1e;});return db[_0x8e69('0x5a')][_0x8e69('0x71')](_0x30bc8e,{'raw':!![],'transaction':_0x4680fb});});}})[_0x8e69('0x48')](handleError(_0x25425a,null));});}})['then'](function(_0x8c3041){var _0x4af5fe=_[_0x8e69('0x2f')](_0x8c3041,function(_0x2182e3){return _0x2182e3[_0x8e69('0x51')]({'plain':!![]});});})[_0x8e69('0x28')](respondWithResult(_0x25425a,null))['catch'](handleError(_0x25425a,null));};exports[_0x8e69('0x72')]=function(_0x19c1f4,_0x22a95e,_0x12865c){return db[_0x8e69('0x30')][_0x8e69('0x4d')]({'where':{'id':_0x19c1f4['params']['id']}})['then'](handleEntityNotFound(_0x22a95e,null))['then'](function(_0x33122e){if(_0x33122e){return _0x33122e[_0x8e69('0x72')](_0x19c1f4['query']['ids']);}})[_0x8e69('0x28')](respondWithStatusCode(_0x22a95e,null))[_0x8e69('0x48')](handleError(_0x22a95e,null));};exports['getResources']=function(_0x5b84dd,_0x42cb93){var _0x492380={};if(!_0x5b84dd['query'][_0x8e69('0x73')])throw new Error('Missing\x20section\x20parameter');if(!_0x5b84dd[_0x8e69('0x35')][_0x8e69('0x3b')](_0x8e69('0x3c'))){_0x492380['limit']=qs['limit'](_0x5b84dd[_0x8e69('0x35')]['limit']);_0x492380[_0x8e69('0x21')]=qs[_0x8e69('0x21')](_0x5b84dd[_0x8e69('0x35')][_0x8e69('0x21')]);}return db[_0x8e69('0x30')]['find']({'where':{'id':_0x5b84dd[_0x8e69('0x4a')]['id']}})[_0x8e69('0x28')](function(_0x3f1538){if(!_0x3f1538)throw new Error(_0x8e69('0x74')+_0x5b84dd['params']['id']);return db[_0x8e69('0x30')][_0x8e69('0x75')](_0x5b84dd);})['then'](respondWithFilteredResult(_0x42cb93,_0x492380))[_0x8e69('0x48')](handleError(_0x42cb93,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 47b0ab3..a200200 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 _0x8a9a=['UserProfile','setMaxListeners','save','update','remove','emit','hook','../../mysqldb'];(function(_0x31e04a,_0x98366d){var _0x4a4232=function(_0x4ced53){while(--_0x4ced53){_0x31e04a['push'](_0x31e04a['shift']());}};_0x4a4232(++_0x98366d);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x8a9a[_0x15bc81];return _0x59440e;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xa8a9('0x0'))['db'][_0xa8a9('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xa8a9('0x2')](0x0);var events={'afterCreate':_0xa8a9('0x3'),'afterUpdate':_0xa8a9('0x4'),'afterDestroy':_0xa8a9('0x5')};function emitEvent(_0x2d782d){return function(_0x9570dc,_0x3fcb8c,_0xe5e64b){UserProfileEvents[_0xa8a9('0x6')](_0x2d782d+':'+_0x9570dc['id'],_0x9570dc);UserProfileEvents[_0xa8a9('0x6')](_0x2d782d,_0x9570dc);_0xe5e64b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xa8a9('0x7')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x7e27=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x3c3a03,_0x3c0da1){var _0x57ff53=function(_0xd08f4a){while(--_0xd08f4a){_0x3c3a03['push'](_0x3c3a03['shift']());}};_0x57ff53(++_0x3c0da1);}(_0x7e27,0xdd));var _0x77e2=function(_0x58bbc5,_0x509e1b){_0x58bbc5=_0x58bbc5-0x0;var _0x5c0024=_0x7e27[_0x58bbc5];return _0x5c0024;};'use strict';var EventEmitter=require(_0x77e2('0x0'));var UserProfile=require(_0x77e2('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x77e2('0x2')](0x0);var events={'afterCreate':_0x77e2('0x3'),'afterUpdate':_0x77e2('0x4'),'afterDestroy':_0x77e2('0x5')};function emitEvent(_0x49537e){return function(_0x30766a,_0x21bb94,_0x20c6f0){UserProfileEvents['emit'](_0x49537e+':'+_0x30766a['id'],_0x30766a);UserProfileEvents[_0x77e2('0x6')](_0x49537e,_0x30766a);_0x20c6f0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x77e2('0x7')](e,emitEvent(event));}}module[_0x77e2('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 402ab1c..4e64383 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 _0xd49f=['faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','membername','User','agent','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','whatsappqueues','WhatsappQueue','teams','Team','voicequeues','users','telephones','Users','admin','user','Telephones','zendeskaccounts','ZendeskAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','Schedule','sounds','tags','Tag','templates','Template','triggers','Trigger','variables','Variable','extractedreports','Reports','reportId','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','InteractionId','from','_interactions','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','UserProfile','../../components/parsers/qs','raw','section','mergeResources','isEmpty','length','find','all','union','ignore','push','rawAttributes','keys','filters','intersection','fields','attributes','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','default','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','Agents','openTabs','true','chat','dataValues','sms','mail','openchannel','whatsapp','lodash','squel','models','filter','value','findAll','map','catch','model','then','associatedResources','field','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','name','projects','contacts','CmContact','lists','CmList','companies','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd49f,0x96));var _0xfd49=function(_0x317d6f,_0x18463f){_0x317d6f=_0x317d6f-0x0;var _0x4a5911=_0xd49f[_0x317d6f];return _0x4a5911;};'use strict';var _=require(_0xfd49('0x0'));var attributes=require('./userProfile.attributes');var squel=require(_0xfd49('0x1'));module['exports']=function(_0x36c462){var _0x4cf968=_0x36c462[_0xfd49('0x2')];function _0x4171d6(_0x24346c,_0x78dbd7){return new Promise(function(_0x313e2f,_0xe25592){if(!_0x78dbd7)return _0x313e2f(null);var _0x4bbbb8=_0x78dbd7[_0xfd49('0x3')]?{[_0x78dbd7[_0xfd49('0x3')]['field']]:_0x78dbd7[_0xfd49('0x3')][_0xfd49('0x4')]}:undefined;return _0x4cf968[_0x24346c][_0xfd49('0x5')]({'where':_0x4bbbb8,'raw':!![]})['then'](function(_0x2825eb){_0x78dbd7['associatedResources']=_[_0xfd49('0x6')](_0x2825eb,'id');_0x313e2f(_0x78dbd7);})[_0xfd49('0x7')](function(_0x43c46f){_0xe25592(_0x43c46f);});});}function _0x3d0f46(_0x4689f3,_0x51a186){return new Promise(function(_0x46e87c,_0x457ddc){var _0x26bd30=_0x4689f3[_0xfd49('0x3')]?{[_0x4689f3[_0xfd49('0x3')]['field']]:_0x4689f3[_0xfd49('0x3')][_0xfd49('0x4')]}:undefined;return _0x4cf968[_0x4689f3[_0xfd49('0x8')]][_0xfd49('0x5')]({'where':_0x26bd30,'raw':!![]})[_0xfd49('0x9')](function(_0x42d269){_0x51a186[_0xfd49('0xa')]=_['map'](_0x42d269,function(_0x3e644f){return _0x3e644f['name'];});_0x46e87c(_0x51a186);})[_0xfd49('0x7')](function(_0x57ffd3){_0x457ddc(_0x57ffd3);});});}function _0x41c4d0(_0x4d09db,_0x3987c4,_0x5c64ab){if(!_0x3987c4)return Promise['resolve'](null);return new Promise(function(_0x4747b5,_0x56b309){return _0x4cf968['UserProfileResource']['findAll']({'where':{'sectionId':_0x3987c4['id']},'raw':!![]})['then'](function(_0x517cd4){if(_0x4d09db[_0xfd49('0xb')]&&_0x4d09db[_0xfd49('0xb')]!=='id'){_0x3987c4[_0xfd49('0xa')]=_[_0xfd49('0x6')](_0x517cd4,function(_0x29a68c){return _0x29a68c[_0x4d09db['field']];});}else{if(_0x5c64ab===_0xfd49('0xc')){_0x3987c4[_0xfd49('0xa')]=_[_0xfd49('0x6')](_0x517cd4,function(_0x229882){return{'id':_0x229882['resourceId'],'type':_0x229882[_0xfd49('0xd')]};});}else{_0x3987c4[_0xfd49('0xa')]=_[_0xfd49('0x6')](_0x517cd4,function(_0x4493e4){return _0x4493e4[_0xfd49('0xe')];});}}_0x4747b5(_0x3987c4);})[_0xfd49('0x7')](function(_0x28356e){_0x56b309(_0x28356e);});});}function _0x5371d3(_0x3652b6,_0x16ca74){var _0x844a96={'parentSections':[]};switch(_0x3652b6[_0xfd49('0xf')]()){case _0xfd49('0x10'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x12');break;case _0xfd49('0x13'):_0x844a96['childModel']=_0xfd49('0x14');break;case _0xfd49('0x15'):_0x844a96['childModel']=_0xfd49('0x16');_0x844a96[_0xfd49('0x17')]=[{'name':'SquareProjects','field':_0xfd49('0x18'),'foreignKey':'projectName'}];break;case _0xfd49('0x19'):_0x844a96[_0xfd49('0x11')]='JscriptyProject';break;case _0xfd49('0x1a'):_0x844a96['childModel']=_0xfd49('0x1b');_0x844a96[_0xfd49('0x17')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0xfd49('0x1c'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x1d');break;case _0xfd49('0x1e'):_0x844a96[_0xfd49('0x11')]='CmCompany';break;case'globalcustomfields':_0x844a96[_0xfd49('0x11')]=_0xfd49('0x1f');break;case _0xfd49('0x20'):_0x844a96['childModel']=_0xfd49('0x21');break;case _0xfd49('0x22'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x23');break;case _0xfd49('0x24'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x25');break;case _0xfd49('0x26'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x27');break;case _0xfd49('0x28'):case _0xfd49('0x29'):case _0xfd49('0x2a'):_0x844a96[_0xfd49('0x11')]='VoiceExtension';break;case _0xfd49('0x2b'):_0x844a96['childModel']=_0xfd49('0x2c');break;case'voicemails':_0x844a96[_0xfd49('0x11')]=_0xfd49('0x2d');break;case _0xfd49('0x2e'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x2f');_0x844a96['parentSections']=[{'name':'Agents','field':_0xfd49('0x18'),'foreignKey':_0xfd49('0x30'),'model':_0xfd49('0x31'),'filter':{'field':'role','value':[_0xfd49('0x32')]}},{'name':'Telephones','field':_0xfd49('0x18'),'foreignKey':_0xfd49('0x30'),'model':_0xfd49('0x31'),'filter':{'field':_0xfd49('0x33'),'value':[_0xfd49('0x34')]}},{'name':_0xfd49('0x35'),'field':_0xfd49('0x18'),'foreignKey':_0xfd49('0x36'),'model':_0xfd49('0x37'),'filter':{'field':'type','value':[_0xfd49('0x38')]}},{'name':_0xfd49('0x39'),'field':_0xfd49('0x18'),'foreignKey':_0xfd49('0x36'),'model':'VoiceQueue','filter':{'field':_0xfd49('0xd'),'value':[_0xfd49('0x3a')]}}];break;case _0xfd49('0x3b'):_0x844a96['childModel']='VoiceMusicOnHold';break;case _0xfd49('0x3c'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x3d');break;case'voiceprefixes':_0x844a96[_0xfd49('0x11')]=_0xfd49('0x3e');break;case _0xfd49('0x3f'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x40');break;case _0xfd49('0x41'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x42');break;case _0xfd49('0x43'):_0x844a96[_0xfd49('0x11')]='MailAccount';break;case _0xfd49('0x44'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x45');break;case'openchannelqueues':_0x844a96[_0xfd49('0x11')]='OpenchannelQueue';break;case _0xfd49('0x46'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x47');break;case _0xfd49('0x48'):_0x844a96[_0xfd49('0x11')]='SmsQueue';break;case _0xfd49('0x49'):_0x844a96[_0xfd49('0x11')]='SmsAccount';break;case _0xfd49('0x4a'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x4b');break;case'whatsappaccounts':_0x844a96[_0xfd49('0x11')]='WhatsappAccount';break;case _0xfd49('0x4c'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x4d');break;case _0xfd49('0x4e'):case'queuecampaigns':_0x844a96[_0xfd49('0x11')]=_0xfd49('0x37');if(_0x16ca74){_0x844a96['parentSections']=[{'name':_0xfd49('0x35')},{'name':'QueueCampaigns'}];}break;case _0xfd49('0x4f'):case'agents':case _0xfd49('0x50'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x31');if(_0x16ca74){_0x844a96['parentSections']=[{'name':_0xfd49('0x51'),'filter':{'field':_0xfd49('0x33'),'value':[_0xfd49('0x52'),_0xfd49('0x53')]},'ignore':!![]},{'name':'Agents'},{'name':_0xfd49('0x54')}];}break;case _0xfd49('0x55'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x56');break;case'salesforceaccounts':_0x844a96[_0xfd49('0x11')]='SalesforceAccount';break;case _0xfd49('0x57'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x58');break;case _0xfd49('0x59'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x5a');break;case'deskaccounts':_0x844a96[_0xfd49('0x11')]='DeskAccount';break;case _0xfd49('0x5b'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x5c');break;case _0xfd49('0x5d'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x31');break;case _0xfd49('0x5e'):_0x844a96['childModel']=_0xfd49('0x5f');break;case _0xfd49('0x60'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x61');break;case _0xfd49('0x62'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x63');break;case _0xfd49('0x64'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x65');break;case _0xfd49('0x66'):_0x844a96['childModel']=_0xfd49('0x67');break;case'scheduler':_0x844a96['childModel']=_0xfd49('0x68');break;case _0xfd49('0x69'):_0x844a96[_0xfd49('0x11')]='Sound';break;case _0xfd49('0x6a'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x6b');break;case _0xfd49('0x6c'):_0x844a96['childModel']=_0xfd49('0x6d');break;case _0xfd49('0x6e'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x6f');break;case'trunks':_0x844a96[_0xfd49('0x11')]='Trunk';break;case _0xfd49('0x70'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0x71');break;case'plugins':_0x844a96['childModel']='Plugin';break;case _0xfd49('0x72'):_0x844a96[_0xfd49('0x11')]=_0xfd49('0xc');_0x844a96['parentSections']=[{'name':_0xfd49('0x73'),'field':'id','foreignKey':_0xfd49('0x74')}];break;case'metrics':_0x844a96[_0xfd49('0x11')]='AnalyticMetric';break;}return _0x844a96;}function _0x157e4e(_0x390d7b,_0x2f3726){var _0x207c51=_0x390d7b[_0xfd49('0x75')](0x0)[_0xfd49('0x76')]()+_0x390d7b[_0xfd49('0x77')](0x1);var _0x20b007={'type':_0x4cf968[_0xfd49('0x78')][_0xfd49('0x79')][_0xfd49('0x7a')],'raw':!![]};return new Promise(function(_0x3e9bbe,_0x2de102){var _0x71410f=squel[_0xfd49('0x7b')]()[_0xfd49('0xb')]('ui.'+_0x207c51+_0xfd49('0x7c'),'id')[_0xfd49('0xb')]('ui.createdAt')[_0xfd49('0x7d')]('user_has_'+_0x390d7b+_0xfd49('0x7e'),'ui')[_0xfd49('0x7f')](_0xfd49('0x80'),_0x2f3726['id']);return _0x4cf968['sequelize'][_0xfd49('0x81')](_0x71410f[_0xfd49('0x82')](),_0x20b007)[_0xfd49('0x9')](function(_0x5ae7f4){_0x2f3726[_0x207c51+_0xfd49('0x83')]=_0x5ae7f4;_0x3e9bbe(_0x5ae7f4);})['catch'](function(_0x585516){_0x2de102(_0x585516);});});}return _0x36c462[_0xfd49('0x84')](_0xfd49('0x85'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x579c8b){var _0x1d8d49=require(_0xfd49('0x86'));var _0x3d95bf={'raw':_0x579c8b['query'][_0xfd49('0x87')],'where':{}};var _0x32ac4e={};var _0x490b93={'count':0x0,'rows':[]};var _0x36b5c3=_0x579c8b['query'][_0xfd49('0x88')];var _0xeeb690=_0x579c8b[_0xfd49('0x81')][_0xfd49('0x89')]||![];var _0x3cbfb0=_0x5371d3(_0x36b5c3,_0xeeb690);if(!_0x3cbfb0[_0xfd49('0x11')])throw new Error('Invalid\x20section\x20\x27'+_0x36b5c3+'\x27');var _0x4bf80d=[{'name':_0x36b5c3}];if(!_[_0xfd49('0x8a')](_0x3cbfb0[_0xfd49('0x17')]))_0x4bf80d=_0x3cbfb0[_0xfd49('0x17')];var _0x58270e=[];for(var _0x27b510=0x0;_0x27b510<_0x4bf80d[_0xfd49('0x8b')];_0x27b510++){_0x58270e['push'](_0x4cf968['UserProfileSection'][_0xfd49('0x8c')]({'where':{'userProfileId':_0x579c8b['params']['id'],'name':_0x4bf80d[_0x27b510][_0xfd49('0x18')]},'raw':!![]}));}return Promise[_0xfd49('0x8d')](_0x58270e)['then'](function(_0x24604d){var _0xe4a03e=_[_0xfd49('0x3')](_0x24604d,function(_0x288656){return _0x288656?_0x288656:undefined;});var _0x32daaf=_['filter'](_0x4bf80d,['ignore',!![]]);var _0x5a4eea=_['isEmpty'](_0xe4a03e)&&_[_0xfd49('0x8a')](_0x32daaf)?null:_[_0xfd49('0x8e')](_0x32daaf,_0xe4a03e);if(!_0x5a4eea)return null;var _0x543cab=[];for(var _0xd59c19=0x0;_0xd59c19<_0x5a4eea[_0xfd49('0x8b')];_0xd59c19++){var _0xc63451=_['find'](_0x4bf80d,function(_0x441e65){return _0x5a4eea[_0xd59c19]?_0x441e65[_0xfd49('0x18')]===_0x5a4eea[_0xd59c19][_0xfd49('0x18')]:null;});if(_0xc63451){if(_0x5a4eea[_0xd59c19][_0xfd49('0x8f')]){_0x543cab['push'](_0x4171d6(_0x3cbfb0['childModel'],_0x5a4eea[_0xd59c19]));}else{if(!_0x5a4eea[_0xd59c19]['autoAssociation']){_0x543cab[_0xfd49('0x90')](_0x41c4d0(_0xc63451,_0x5a4eea[_0xd59c19],_0x3cbfb0['childModel']));}else{if(_0xc63451['model']){_0x543cab[_0xfd49('0x90')](_0x3d0f46(_0xc63451,_0x5a4eea[_0xd59c19]));}}}}}return Promise[_0xfd49('0x8d')](_0x543cab);})[_0xfd49('0x9')](function(_0x17b9ee){var _0x3a8573=_0x17b9ee;var _0xfcad70=null;if(_0x3a8573){_0xfcad70=_0x3a8573[_0xfd49('0x8b')]===0x1?_0x3a8573[0x0]:null;}if(!_0xfcad70&&!_0x3a8573)return _0x490b93;var _0xac9233=_0x4cf968[_0x3cbfb0['childModel']][_0xfd49('0x91')];_0x32ac4e[_0xfd49('0x8')]=_[_0xfd49('0x92')](_0xac9233);_0x32ac4e[_0xfd49('0x81')]=_[_0xfd49('0x92')](_0x579c8b['query']);_0x32ac4e[_0xfd49('0x93')]=_['intersection'](_0x32ac4e[_0xfd49('0x8')],_0x32ac4e[_0xfd49('0x81')]);_0x3d95bf['attributes']=_[_0xfd49('0x94')](_0x32ac4e[_0xfd49('0x8')],_0x1d8d49[_0xfd49('0x95')](_0x579c8b[_0xfd49('0x81')]['fields']));_0x3d95bf[_0xfd49('0x96')]=_0x3d95bf[_0xfd49('0x96')][_0xfd49('0x8b')]?_0x3d95bf['attributes']:_0x32ac4e['model'];if(!_0x579c8b[_0xfd49('0x81')]['hasOwnProperty'](_0xfd49('0x97'))){_0x3d95bf[_0xfd49('0x98')]=_0x1d8d49[_0xfd49('0x98')](_0x579c8b[_0xfd49('0x81')][_0xfd49('0x98')]);_0x3d95bf['offset']=_0x1d8d49[_0xfd49('0x99')](_0x579c8b['query'][_0xfd49('0x99')]);}_0x3d95bf[_0xfd49('0x9a')]=_0x1d8d49[_0xfd49('0x9b')](_0x579c8b[_0xfd49('0x81')]['sort']);_0x3d95bf['where']=_0x1d8d49[_0xfd49('0x93')](_[_0xfd49('0x9c')](_0x579c8b[_0xfd49('0x81')],_0x32ac4e['filters']));if(_0x579c8b['query'][_0xfd49('0x3')]){_0x3d95bf['where']=_[_0xfd49('0x9d')](_0x3d95bf['where'],{'$or':_[_0xfd49('0x6')](_0xac9233,function(_0x5a03d9){if(_0x5a03d9[_0xfd49('0xd')][_0xfd49('0x9e')]!==_0xfd49('0x9f')){var _0x6c96bb={};_0x6c96bb[_0x5a03d9[_0xfd49('0xb')]]={'$like':'%'+_0x579c8b[_0xfd49('0x81')][_0xfd49('0x3')]+'%'};return _0x6c96bb;}})});}var _0x15cfd7=[];var _0x9f0f57=null;var _0x5d12bd={};if(_0xfcad70){_0x9f0f57=_[_0xfd49('0x8c')](_0x4bf80d,[_0xfd49('0x18'),_0xfcad70[_0xfd49('0x18')]]);if(_0x9f0f57[_0xfd49('0xb')]){_0x5d12bd={};if(_0x3cbfb0[_0xfd49('0x11')]===_0xfd49('0xc')){_0x5d12bd[_0x9f0f57[_0xfd49('0xa0')]]=_[_0xfd49('0x6')](_0xfcad70[_0xfd49('0xa')],'id');}else{_0x5d12bd[_0x9f0f57['foreignKey']]=_0xfcad70[_0xfd49('0xa')];}_0x15cfd7[_0xfd49('0x90')](_0x5d12bd);}else{_0x3d95bf[_0xfd49('0x7f')]['id']=_0xfcad70[_0xfd49('0xa')];}}else{for(var _0x469d3e=0x0;_0x469d3e<_0x3a8573['length'];_0x469d3e++){_0x9f0f57=_['find'](_0x4bf80d,[_0xfd49('0x18'),_0x3a8573[_0x469d3e]['name']]);if(_0x9f0f57[_0xfd49('0xb')]){_0x5d12bd={};_0x5d12bd[_0x9f0f57[_0xfd49('0xa0')]]=_0x3a8573[_0x469d3e][_0xfd49('0xa')];_0x15cfd7[_0xfd49('0x90')](_0x5d12bd);}else{if(!_0x3d95bf[_0xfd49('0x7f')]['id'])_0x3d95bf[_0xfd49('0x7f')]['id']=[];_0x3a8573[_0x469d3e][_0xfd49('0xa')][_0xfd49('0xa1')](function(_0x879c9b){_0x3d95bf['where']['id'][_0xfd49('0x90')](_0x879c9b);});}}}if(!_[_0xfd49('0x8a')](_0x15cfd7)){_0x3d95bf['where']=_[_0xfd49('0x9d')](_0x3d95bf[_0xfd49('0x7f')],{'$and':{'$or':_0x15cfd7}});}_0x3d95bf=_['merge']({},_0x3d95bf,_0x579c8b[_0xfd49('0xa2')]);if(_0xfcad70&&!_0xfcad70['autoAssociation']&&_0x3cbfb0['childModel']===_0xfd49('0xc')){if(_0x579c8b[_0xfd49('0x81')][_0xfd49('0xa3')]){_0x3d95bf[_0xfd49('0xa4')]=[{'all':!![]}];}return _0x4cf968[_0x3cbfb0[_0xfd49('0x11')]][_0xfd49('0x5')](_0x3d95bf)['then'](function(_0x2a3a44){var _0x57f2e7=[];_0x2a3a44[_0xfd49('0xa1')](function(_0xf5d19f){var _0xbd978d;switch(_0xf5d19f[_0xfd49('0xa5')]){case _0xfd49('0xa6'):_0xbd978d=_[_0xfd49('0x8c')](_0xfcad70[_0xfd49('0xa')],function(_0x3b5c43){return _0x3b5c43['id']===_0xf5d19f[_0xfd49('0x74')]&&_0x3b5c43[_0xfd49('0xd')]==='DefaultReports';});break;case _0xfd49('0xa7'):_0xbd978d=_[_0xfd49('0x8c')](_0xfcad70[_0xfd49('0xa')],function(_0x1f8907){return _0x1f8907['id']===_0xf5d19f[_0xfd49('0x74')]&&_0x1f8907[_0xfd49('0xd')]===_0xfd49('0xa8');});break;}if(_0xbd978d)_0x57f2e7[_0xfd49('0x90')](_0xf5d19f);});_0x490b93[_0xfd49('0xa9')]=_0x57f2e7[_0xfd49('0x8b')];_0x490b93[_0xfd49('0xaa')]=_0x57f2e7;return _0x490b93;});}else{if(!_['isEmpty'](_0x579c8b[_0xfd49('0x81')][_0xfd49('0xab')])){_0x3d95bf[_0xfd49('0x7f')]['id']=_0x3d95bf[_0xfd49('0x7f')]['id']?_['intersection'](_0x3d95bf[_0xfd49('0x7f')]['id'],_0x579c8b[_0xfd49('0x81')][_0xfd49('0xab')]):_0x579c8b[_0xfd49('0x81')][_0xfd49('0xab')];if(_0x579c8b[_0xfd49('0x81')][_0xfd49('0xac')]){_0x3d95bf[_0xfd49('0x9a')]=_0x579c8b[_0xfd49('0x81')][_0xfd49('0xac')];}}if(_0x579c8b[_0xfd49('0x81')][_0xfd49('0xad')]){_0x3d95bf[_0xfd49('0x7f')]=_[_0xfd49('0x9d')](_0x3d95bf[_0xfd49('0x7f')],{'$and':_0x579c8b[_0xfd49('0x81')]['extraQueryConditions']});}return _0x4cf968[_0x3cbfb0[_0xfd49('0x11')]]['count']({'where':_0x3d95bf[_0xfd49('0x7f')]})[_0xfd49('0x9')](function(_0x13b633){_0x490b93['count']=_0x13b633;if(_0x579c8b['query']['includeAll']){if(_0x3cbfb0[_0xfd49('0x11')]===_0xfd49('0x1b')){_0x3d95bf[_0xfd49('0xa4')]=[{'model':_0x4cf968[_0xfd49('0x6b')],'as':_0xfd49('0xae'),'attributes':['id','name',_0xfd49('0xaf')],'required':_0x579c8b[_0xfd49('0x81')][_0xfd49('0xb0')]?!![]:![]},{'model':_0x4cf968['Tag'],'as':'ThroughTags','attributes':['id','name',_0xfd49('0xaf')],'through':_0x579c8b['query'][_0xfd49('0xb0')]?{'attributes':[],'where':{'TagId':_0x579c8b[_0xfd49('0x81')][_0xfd49('0xb0')]||undefined}}:{},'required':_0x579c8b[_0xfd49('0x81')][_0xfd49('0xb0')]?!![]:![]}];}else{_0x3d95bf[_0xfd49('0xa4')]=[{'all':!![]}];}}return _0x4cf968[_0x3cbfb0[_0xfd49('0x11')]][_0xfd49('0x5')](_0x3d95bf);})[_0xfd49('0x9')](function(_0x5f094b){_0x490b93[_0xfd49('0xaa')]=_0x5f094b;if(_0x36b5c3===_0xfd49('0xb1')&&_0x579c8b[_0xfd49('0x81')][_0xfd49('0xb2')]===_0xfd49('0xb3')){var _0x56ed4e=[];for(var _0x26d820=0x0;_0x26d820<_0x490b93['rows'][_0xfd49('0x8b')];_0x26d820++){_0x56ed4e['push'](_0x157e4e(_0xfd49('0xb4'),_0x490b93[_0xfd49('0xaa')][_0x26d820][_0xfd49('0xb5')]));_0x56ed4e['push'](_0x157e4e(_0xfd49('0xb6'),_0x490b93['rows'][_0x26d820]['dataValues']));_0x56ed4e['push'](_0x157e4e('fax',_0x490b93['rows'][_0x26d820][_0xfd49('0xb5')]));_0x56ed4e['push'](_0x157e4e(_0xfd49('0xb7'),_0x490b93[_0xfd49('0xaa')][_0x26d820][_0xfd49('0xb5')]));_0x56ed4e['push'](_0x157e4e(_0xfd49('0xb8'),_0x490b93[_0xfd49('0xaa')][_0x26d820][_0xfd49('0xb5')]));_0x56ed4e['push'](_0x157e4e(_0xfd49('0xb9'),_0x490b93[_0xfd49('0xaa')][_0x26d820][_0xfd49('0xb5')]));}return Promise['all'](_0x56ed4e)['then'](function(){return _0x490b93;});}return _0x490b93;});}});}}});}; \ No newline at end of file +var _0x9e24=['options','autoAssociation','include','reportType','DefaultReports','custom','CustomReports','rows','ids','customSorting','extraQueryConditions','count','CmContact','color','ThroughTags','tag','openTabs','sms','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','exports','models','filter','field','findAll','then','associatedResources','map','catch','value','model','AnalyticExtractedReport','resourceId','type','squareprojects','childModel','parentSections','name','projectName','projects','contacts','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','role','Telephones','User','queue','inbound','QueueCampaigns','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','VoiceQueue','VoiceQueues','users','agents','Users','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','Schedule','sounds','Sound','tags','Tag','templates','Template','Trigger','trunks','Trunk','variables','plugins','Plugin','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','select','ui.','InteractionId','ui.createdAt','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','filters','merge','key','foreignKey','forEach'];(function(_0x3f2fea,_0x3c4ea8){var _0x69a4d5=function(_0x223109){while(--_0x223109){_0x3f2fea['push'](_0x3f2fea['shift']());}};_0x69a4d5(++_0x3c4ea8);}(_0x9e24,0xd9));var _0x49e2=function(_0x34933a,_0x327378){_0x34933a=_0x34933a-0x0;var _0x36abb4=_0x9e24[_0x34933a];return _0x36abb4;};'use strict';var _=require(_0x49e2('0x0'));var attributes=require(_0x49e2('0x1'));var squel=require('squel');module[_0x49e2('0x2')]=function(_0x3cac55){var _0x355786=_0x3cac55[_0x49e2('0x3')];function _0x252e98(_0x308c5f,_0x1f7d24){return new Promise(function(_0x1c08cc,_0xfbcc61){if(!_0x1f7d24)return _0x1c08cc(null);var _0x4d30a9=_0x1f7d24[_0x49e2('0x4')]?{[_0x1f7d24['filter'][_0x49e2('0x5')]]:_0x1f7d24[_0x49e2('0x4')]['value']}:undefined;return _0x355786[_0x308c5f][_0x49e2('0x6')]({'where':_0x4d30a9,'raw':!![]})[_0x49e2('0x7')](function(_0x919936){_0x1f7d24[_0x49e2('0x8')]=_[_0x49e2('0x9')](_0x919936,'id');_0x1c08cc(_0x1f7d24);})[_0x49e2('0xa')](function(_0x88b70b){_0xfbcc61(_0x88b70b);});});}function _0x324b35(_0x3192b1,_0x33efca){return new Promise(function(_0xf15e5,_0x381532){var _0x1f05b0=_0x3192b1[_0x49e2('0x4')]?{[_0x3192b1[_0x49e2('0x4')][_0x49e2('0x5')]]:_0x3192b1[_0x49e2('0x4')][_0x49e2('0xb')]}:undefined;return _0x355786[_0x3192b1[_0x49e2('0xc')]][_0x49e2('0x6')]({'where':_0x1f05b0,'raw':!![]})[_0x49e2('0x7')](function(_0x388232){_0x33efca[_0x49e2('0x8')]=_[_0x49e2('0x9')](_0x388232,function(_0x143d29){return _0x143d29['name'];});_0xf15e5(_0x33efca);})[_0x49e2('0xa')](function(_0x2eb934){_0x381532(_0x2eb934);});});}function _0x1b5af(_0x118b17,_0x642fd0,_0x8c878a){if(!_0x642fd0)return Promise['resolve'](null);return new Promise(function(_0x5b3417,_0x464b26){return _0x355786['UserProfileResource'][_0x49e2('0x6')]({'where':{'sectionId':_0x642fd0['id']},'raw':!![]})[_0x49e2('0x7')](function(_0x261695){if(_0x118b17['field']&&_0x118b17[_0x49e2('0x5')]!=='id'){_0x642fd0['associatedResources']=_[_0x49e2('0x9')](_0x261695,function(_0x4df7d4){return _0x4df7d4[_0x118b17['field']];});}else{if(_0x8c878a===_0x49e2('0xd')){_0x642fd0[_0x49e2('0x8')]=_[_0x49e2('0x9')](_0x261695,function(_0x4f7e06){return{'id':_0x4f7e06[_0x49e2('0xe')],'type':_0x4f7e06[_0x49e2('0xf')]};});}else{_0x642fd0['associatedResources']=_[_0x49e2('0x9')](_0x261695,function(_0x5035c8){return _0x5035c8[_0x49e2('0xe')];});}}_0x5b3417(_0x642fd0);})[_0x49e2('0xa')](function(_0x1a33f7){_0x464b26(_0x1a33f7);});});}function _0x1a3fd8(_0x4cb9ff,_0x2bf7a4){var _0x1053b5={'parentSections':[]};switch(_0x4cb9ff['toLowerCase']()){case _0x49e2('0x10'):_0x1053b5[_0x49e2('0x11')]='SquareProject';break;case'odbc':_0x1053b5[_0x49e2('0x11')]='SquareOdbc';break;case'squarerecordings':_0x1053b5[_0x49e2('0x11')]='SquareRecording';_0x1053b5[_0x49e2('0x12')]=[{'name':'SquareProjects','field':_0x49e2('0x13'),'foreignKey':_0x49e2('0x14')}];break;case _0x49e2('0x15'):_0x1053b5[_0x49e2('0x11')]='JscriptyProject';break;case _0x49e2('0x16'):_0x1053b5[_0x49e2('0x11')]='CmContact';_0x1053b5[_0x49e2('0x12')]=[{'name':_0x49e2('0x17'),'field':'id','foreignKey':_0x49e2('0x18')}];break;case _0x49e2('0x19'):_0x1053b5['childModel']=_0x49e2('0x1a');break;case _0x49e2('0x1b'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x1c');break;case _0x49e2('0x1d'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x1e');break;case _0x49e2('0x1f'):_0x1053b5[_0x49e2('0x11')]='ChatQueue';break;case _0x49e2('0x20'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x21');break;case _0x49e2('0x22'):_0x1053b5['childModel']=_0x49e2('0x23');break;case _0x49e2('0x24'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x25');break;case'inboundroutes':case _0x49e2('0x26'):case _0x49e2('0x27'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x28');break;case _0x49e2('0x29'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x2a');break;case _0x49e2('0x2b'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x2c');break;case _0x49e2('0x2d'):_0x1053b5['childModel']=_0x49e2('0x2e');_0x1053b5['parentSections']=[{'name':'Agents','field':_0x49e2('0x13'),'foreignKey':_0x49e2('0x2f'),'model':'User','filter':{'field':_0x49e2('0x30'),'value':['agent']}},{'name':_0x49e2('0x31'),'field':_0x49e2('0x13'),'foreignKey':_0x49e2('0x2f'),'model':_0x49e2('0x32'),'filter':{'field':_0x49e2('0x30'),'value':['telephone']}},{'name':'VoiceQueues','field':'name','foreignKey':_0x49e2('0x33'),'model':'VoiceQueue','filter':{'field':'type','value':[_0x49e2('0x34')]}},{'name':_0x49e2('0x35'),'field':'name','foreignKey':_0x49e2('0x33'),'model':'VoiceQueue','filter':{'field':_0x49e2('0xf'),'value':[_0x49e2('0x36')]}}];break;case _0x49e2('0x37'):_0x1053b5['childModel']='VoiceMusicOnHold';break;case _0x49e2('0x38'):_0x1053b5['childModel']=_0x49e2('0x39');break;case _0x49e2('0x3a'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x3b');break;case _0x49e2('0x3c'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x3d');break;case _0x49e2('0x3e'):_0x1053b5['childModel']=_0x49e2('0x3f');break;case _0x49e2('0x40'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x41');break;case _0x49e2('0x42'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x43');break;case _0x49e2('0x44'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x45');break;case'openchannelaccounts':_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x46');break;case _0x49e2('0x47'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x48');break;case'smsaccounts':_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x49');break;case _0x49e2('0x4a'):_0x1053b5['childModel']=_0x49e2('0x4b');break;case _0x49e2('0x4c'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x4d');break;case _0x49e2('0x4e'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x4f');break;case _0x49e2('0x50'):case'queuecampaigns':_0x1053b5['childModel']=_0x49e2('0x51');if(_0x2bf7a4){_0x1053b5[_0x49e2('0x12')]=[{'name':_0x49e2('0x52')},{'name':_0x49e2('0x35')}];}break;case _0x49e2('0x53'):case _0x49e2('0x54'):case'telephones':_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x32');if(_0x2bf7a4){_0x1053b5['parentSections']=[{'name':_0x49e2('0x55'),'filter':{'field':'role','value':['admin',_0x49e2('0x56')]},'ignore':!![]},{'name':_0x49e2('0x57')},{'name':_0x49e2('0x31')}];}break;case _0x49e2('0x58'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x59');break;case _0x49e2('0x5a'):_0x1053b5['childModel']=_0x49e2('0x5b');break;case _0x49e2('0x5c'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x5d');break;case _0x49e2('0x5e'):_0x1053b5[_0x49e2('0x11')]='SugarcrmAccount';break;case'deskaccounts':_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x5f');break;case _0x49e2('0x60'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x61');break;case'vtigeraccounts':_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x32');break;case _0x49e2('0x62'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x63');break;case'dispositions':_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x64');break;case _0x49e2('0x65'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x66');break;case _0x49e2('0x67'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x68');break;case _0x49e2('0x69'):_0x1053b5['childModel']=_0x49e2('0x6a');break;case'scheduler':_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x6b');break;case _0x49e2('0x6c'):_0x1053b5['childModel']=_0x49e2('0x6d');break;case _0x49e2('0x6e'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x6f');break;case _0x49e2('0x70'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x71');break;case'triggers':_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x72');break;case _0x49e2('0x73'):_0x1053b5['childModel']=_0x49e2('0x74');break;case _0x49e2('0x75'):_0x1053b5[_0x49e2('0x11')]='Variable';break;case _0x49e2('0x76'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x77');break;case'extractedreports':_0x1053b5['childModel']=_0x49e2('0xd');_0x1053b5['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0x49e2('0x78')}];break;case _0x49e2('0x79'):_0x1053b5[_0x49e2('0x11')]=_0x49e2('0x7a');break;}return _0x1053b5;}function _0x2243a4(_0x22fea4,_0x4d9dcc){var _0x275efe=_0x22fea4[_0x49e2('0x7b')](0x0)[_0x49e2('0x7c')]()+_0x22fea4[_0x49e2('0x7d')](0x1);var _0x1e751f={'type':_0x355786[_0x49e2('0x7e')][_0x49e2('0x7f')]['SELECT'],'raw':!![]};return new Promise(function(_0x4a3882,_0x522b35){var _0x19ea07=squel[_0x49e2('0x80')]()[_0x49e2('0x5')](_0x49e2('0x81')+_0x275efe+_0x49e2('0x82'),'id')[_0x49e2('0x5')](_0x49e2('0x83'))['from'](_0x49e2('0x84')+_0x22fea4+_0x49e2('0x85'),'ui')[_0x49e2('0x86')](_0x49e2('0x87'),_0x4d9dcc['id']);return _0x355786[_0x49e2('0x88')][_0x49e2('0x89')](_0x19ea07[_0x49e2('0x8a')](),_0x1e751f)[_0x49e2('0x7')](function(_0x550e5c){_0x4d9dcc[_0x275efe+_0x49e2('0x8b')]=_0x550e5c;_0x4a3882(_0x550e5c);})[_0x49e2('0xa')](function(_0x26393b){_0x522b35(_0x26393b);});});}return _0x3cac55[_0x49e2('0x8c')](_0x49e2('0x8d'),attributes,{'tableName':_0x49e2('0x8e'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x18a80e){var _0x16fac1=require('../../components/parsers/qs');var _0x90207b={'raw':_0x18a80e[_0x49e2('0x89')]['raw'],'where':{}};var _0x2b08d4={};var _0x10c114={'count':0x0,'rows':[]};var _0xa3ef65=_0x18a80e[_0x49e2('0x89')][_0x49e2('0x8f')];var _0x138c52=_0x18a80e[_0x49e2('0x89')][_0x49e2('0x90')]||![];var _0x2da603=_0x1a3fd8(_0xa3ef65,_0x138c52);if(!_0x2da603[_0x49e2('0x11')])throw new Error(_0x49e2('0x91')+_0xa3ef65+'\x27');var _0x5d5a2f=[{'name':_0xa3ef65}];if(!_[_0x49e2('0x92')](_0x2da603[_0x49e2('0x12')]))_0x5d5a2f=_0x2da603[_0x49e2('0x12')];var _0x4b1efe=[];for(var _0x4cec96=0x0;_0x4cec96<_0x5d5a2f[_0x49e2('0x93')];_0x4cec96++){_0x4b1efe[_0x49e2('0x94')](_0x355786[_0x49e2('0x95')][_0x49e2('0x96')]({'where':{'userProfileId':_0x18a80e[_0x49e2('0x97')]['id'],'name':_0x5d5a2f[_0x4cec96][_0x49e2('0x13')]},'raw':!![]}));}return Promise[_0x49e2('0x98')](_0x4b1efe)['then'](function(_0x3968e2){var _0x20b380=_[_0x49e2('0x4')](_0x3968e2,function(_0x59f98b){return _0x59f98b?_0x59f98b:undefined;});var _0x2b4e58=_[_0x49e2('0x4')](_0x5d5a2f,[_0x49e2('0x99'),!![]]);var _0x2b99f2=_['isEmpty'](_0x20b380)&&_[_0x49e2('0x92')](_0x2b4e58)?null:_[_0x49e2('0x9a')](_0x2b4e58,_0x20b380);if(!_0x2b99f2)return null;var _0x3cf550=[];for(var _0x17cd02=0x0;_0x17cd02<_0x2b99f2['length'];_0x17cd02++){var _0x3ebf93=_['find'](_0x5d5a2f,function(_0x48e53a){return _0x2b99f2[_0x17cd02]?_0x48e53a[_0x49e2('0x13')]===_0x2b99f2[_0x17cd02][_0x49e2('0x13')]:null;});if(_0x3ebf93){if(_0x2b99f2[_0x17cd02][_0x49e2('0x99')]){_0x3cf550[_0x49e2('0x94')](_0x252e98(_0x2da603[_0x49e2('0x11')],_0x2b99f2[_0x17cd02]));}else{if(!_0x2b99f2[_0x17cd02]['autoAssociation']){_0x3cf550['push'](_0x1b5af(_0x3ebf93,_0x2b99f2[_0x17cd02],_0x2da603['childModel']));}else{if(_0x3ebf93[_0x49e2('0xc')]){_0x3cf550[_0x49e2('0x94')](_0x324b35(_0x3ebf93,_0x2b99f2[_0x17cd02]));}}}}}return Promise[_0x49e2('0x98')](_0x3cf550);})['then'](function(_0x3e0cfe){var _0x14caf7=_0x3e0cfe;var _0x583e6e=null;if(_0x14caf7){_0x583e6e=_0x14caf7[_0x49e2('0x93')]===0x1?_0x14caf7[0x0]:null;}if(!_0x583e6e&&!_0x14caf7)return _0x10c114;var _0x523179=_0x355786[_0x2da603[_0x49e2('0x11')]][_0x49e2('0x9b')];_0x2b08d4[_0x49e2('0xc')]=_[_0x49e2('0x9c')](_0x523179);_0x2b08d4[_0x49e2('0x89')]=_[_0x49e2('0x9c')](_0x18a80e[_0x49e2('0x89')]);_0x2b08d4['filters']=_[_0x49e2('0x9d')](_0x2b08d4[_0x49e2('0xc')],_0x2b08d4[_0x49e2('0x89')]);_0x90207b[_0x49e2('0x9e')]=_[_0x49e2('0x9d')](_0x2b08d4['model'],_0x16fac1[_0x49e2('0x9f')](_0x18a80e[_0x49e2('0x89')][_0x49e2('0x9f')]));_0x90207b[_0x49e2('0x9e')]=_0x90207b[_0x49e2('0x9e')][_0x49e2('0x93')]?_0x90207b[_0x49e2('0x9e')]:_0x2b08d4['model'];if(!_0x18a80e[_0x49e2('0x89')][_0x49e2('0xa0')](_0x49e2('0xa1'))){_0x90207b[_0x49e2('0xa2')]=_0x16fac1['limit'](_0x18a80e[_0x49e2('0x89')]['limit']);_0x90207b['offset']=_0x16fac1[_0x49e2('0xa3')](_0x18a80e[_0x49e2('0x89')][_0x49e2('0xa3')]);}_0x90207b[_0x49e2('0xa4')]=_0x16fac1[_0x49e2('0xa5')](_0x18a80e['query'][_0x49e2('0xa5')]);_0x90207b[_0x49e2('0x86')]=_0x16fac1[_0x49e2('0xa6')](_['pick'](_0x18a80e[_0x49e2('0x89')],_0x2b08d4[_0x49e2('0xa6')]));if(_0x18a80e[_0x49e2('0x89')][_0x49e2('0x4')]){_0x90207b[_0x49e2('0x86')]=_[_0x49e2('0xa7')](_0x90207b['where'],{'$or':_[_0x49e2('0x9')](_0x523179,function(_0x17cc11){if(_0x17cc11[_0x49e2('0xf')][_0x49e2('0xa8')]!=='VIRTUAL'){var _0x1fcbc3={};_0x1fcbc3[_0x17cc11[_0x49e2('0x5')]]={'$like':'%'+_0x18a80e[_0x49e2('0x89')][_0x49e2('0x4')]+'%'};return _0x1fcbc3;}})});}var _0x26eee7=[];var _0x9f54a8=null;var _0x4d5587={};if(_0x583e6e){_0x9f54a8=_['find'](_0x5d5a2f,[_0x49e2('0x13'),_0x583e6e[_0x49e2('0x13')]]);if(_0x9f54a8[_0x49e2('0x5')]){_0x4d5587={};if(_0x2da603[_0x49e2('0x11')]==='AnalyticExtractedReport'){_0x4d5587[_0x9f54a8['foreignKey']]=_[_0x49e2('0x9')](_0x583e6e[_0x49e2('0x8')],'id');}else{_0x4d5587[_0x9f54a8[_0x49e2('0xa9')]]=_0x583e6e[_0x49e2('0x8')];}_0x26eee7[_0x49e2('0x94')](_0x4d5587);}else{_0x90207b[_0x49e2('0x86')]['id']=_0x583e6e[_0x49e2('0x8')];}}else{for(var _0x3d9514=0x0;_0x3d9514<_0x14caf7['length'];_0x3d9514++){_0x9f54a8=_[_0x49e2('0x96')](_0x5d5a2f,[_0x49e2('0x13'),_0x14caf7[_0x3d9514][_0x49e2('0x13')]]);if(_0x9f54a8[_0x49e2('0x5')]){_0x4d5587={};_0x4d5587[_0x9f54a8['foreignKey']]=_0x14caf7[_0x3d9514][_0x49e2('0x8')];_0x26eee7[_0x49e2('0x94')](_0x4d5587);}else{if(!_0x90207b[_0x49e2('0x86')]['id'])_0x90207b[_0x49e2('0x86')]['id']=[];_0x14caf7[_0x3d9514][_0x49e2('0x8')][_0x49e2('0xaa')](function(_0x24dfe3){_0x90207b['where']['id'][_0x49e2('0x94')](_0x24dfe3);});}}}if(!_[_0x49e2('0x92')](_0x26eee7)){_0x90207b[_0x49e2('0x86')]=_[_0x49e2('0xa7')](_0x90207b[_0x49e2('0x86')],{'$and':{'$or':_0x26eee7}});}_0x90207b=_['merge']({},_0x90207b,_0x18a80e[_0x49e2('0xab')]);if(_0x583e6e&&!_0x583e6e[_0x49e2('0xac')]&&_0x2da603[_0x49e2('0x11')]==='AnalyticExtractedReport'){if(_0x18a80e['query']['includeAll']){_0x90207b[_0x49e2('0xad')]=[{'all':!![]}];}return _0x355786[_0x2da603['childModel']][_0x49e2('0x6')](_0x90207b)[_0x49e2('0x7')](function(_0xb1adbe){var _0x132c5e=[];_0xb1adbe[_0x49e2('0xaa')](function(_0x3f2b6c){var _0x553103;switch(_0x3f2b6c[_0x49e2('0xae')]){case'default':_0x553103=_[_0x49e2('0x96')](_0x583e6e[_0x49e2('0x8')],function(_0x3a4d73){return _0x3a4d73['id']===_0x3f2b6c[_0x49e2('0x78')]&&_0x3a4d73[_0x49e2('0xf')]===_0x49e2('0xaf');});break;case _0x49e2('0xb0'):_0x553103=_[_0x49e2('0x96')](_0x583e6e[_0x49e2('0x8')],function(_0x5db269){return _0x5db269['id']===_0x3f2b6c['reportId']&&_0x5db269['type']===_0x49e2('0xb1');});break;}if(_0x553103)_0x132c5e['push'](_0x3f2b6c);});_0x10c114['count']=_0x132c5e[_0x49e2('0x93')];_0x10c114[_0x49e2('0xb2')]=_0x132c5e;return _0x10c114;});}else{if(!_['isEmpty'](_0x18a80e['query'][_0x49e2('0xb3')])){_0x90207b['where']['id']=_0x90207b[_0x49e2('0x86')]['id']?_[_0x49e2('0x9d')](_0x90207b['where']['id'],_0x18a80e[_0x49e2('0x89')]['ids']):_0x18a80e['query'][_0x49e2('0xb3')];if(_0x18a80e[_0x49e2('0x89')][_0x49e2('0xb4')]){_0x90207b[_0x49e2('0xa4')]=_0x18a80e[_0x49e2('0x89')][_0x49e2('0xb4')];}}if(_0x18a80e[_0x49e2('0x89')][_0x49e2('0xb5')]){_0x90207b[_0x49e2('0x86')]=_['merge'](_0x90207b['where'],{'$and':_0x18a80e[_0x49e2('0x89')][_0x49e2('0xb5')]});}return _0x355786[_0x2da603['childModel']][_0x49e2('0xb6')]({'where':_0x90207b[_0x49e2('0x86')]})['then'](function(_0x45cf57){_0x10c114[_0x49e2('0xb6')]=_0x45cf57;if(_0x18a80e[_0x49e2('0x89')]['includeAll']){if(_0x2da603[_0x49e2('0x11')]===_0x49e2('0xb7')){_0x90207b['include']=[{'model':_0x355786[_0x49e2('0x6f')],'as':'Tags','attributes':['id',_0x49e2('0x13'),_0x49e2('0xb8')],'required':_0x18a80e[_0x49e2('0x89')]['tag']?!![]:![]},{'model':_0x355786[_0x49e2('0x6f')],'as':_0x49e2('0xb9'),'attributes':['id','name','color'],'through':_0x18a80e[_0x49e2('0x89')]['tag']?{'attributes':[],'where':{'TagId':_0x18a80e[_0x49e2('0x89')]['tag']||undefined}}:{},'required':_0x18a80e['query'][_0x49e2('0xba')]?!![]:![]}];}else{_0x90207b['include']=[{'all':!![]}];}}return _0x355786[_0x2da603['childModel']]['findAll'](_0x90207b);})[_0x49e2('0x7')](function(_0x19fb91){_0x10c114[_0x49e2('0xb2')]=_0x19fb91;if(_0xa3ef65==='Agents'&&_0x18a80e[_0x49e2('0x89')][_0x49e2('0xbb')]==='true'){var _0x5aa979=[];for(var _0x36ac0a=0x0;_0x36ac0a<_0x10c114[_0x49e2('0xb2')][_0x49e2('0x93')];_0x36ac0a++){_0x5aa979['push'](_0x2243a4('chat',_0x10c114[_0x49e2('0xb2')][_0x36ac0a]['dataValues']));_0x5aa979['push'](_0x2243a4(_0x49e2('0xbc'),_0x10c114['rows'][_0x36ac0a][_0x49e2('0xbd')]));_0x5aa979[_0x49e2('0x94')](_0x2243a4(_0x49e2('0xbe'),_0x10c114[_0x49e2('0xb2')][_0x36ac0a][_0x49e2('0xbd')]));_0x5aa979[_0x49e2('0x94')](_0x2243a4(_0x49e2('0xbf'),_0x10c114[_0x49e2('0xb2')][_0x36ac0a][_0x49e2('0xbd')]));_0x5aa979[_0x49e2('0x94')](_0x2243a4(_0x49e2('0xc0'),_0x10c114[_0x49e2('0xb2')][_0x36ac0a][_0x49e2('0xbd')]));_0x5aa979[_0x49e2('0x94')](_0x2243a4(_0x49e2('0xc1'),_0x10c114[_0x49e2('0xb2')][_0x36ac0a][_0x49e2('0xbd')]));}return Promise['all'](_0x5aa979)[_0x49e2('0x7')](function(){return _0x10c114;});}return _0x10c114;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 78f3b64..cc24153 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 _0x9d5c=['redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x5a2ebe,_0x1592d6){var _0x5ce877=function(_0x500b7d){while(--_0x500b7d){_0x5a2ebe['push'](_0x5a2ebe['shift']());}};_0x5ce877(++_0x1592d6);}(_0x9d5c,0x98));var _0xc9d5=function(_0x286ed,_0x2bae5d){_0x286ed=_0x286ed-0x0;var _0x36072b=_0x9d5c[_0x286ed];return _0x36072b;};'use strict';var _=require(_0xc9d5('0x0'));var util=require('util');var moment=require(_0xc9d5('0x1'));var BPromise=require(_0xc9d5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc9d5('0x3'));var db=require(_0xc9d5('0x4'))['db'];var utils=require(_0xc9d5('0x5'));var logger=require('../../config/logger')(_0xc9d5('0x6'));var config=require(_0xc9d5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc9d5('0x8')][_0xc9d5('0x9')]({'port':0x232a});config[_0xc9d5('0xa')]=_[_0xc9d5('0xb')](config[_0xc9d5('0xa')],{'host':_0xc9d5('0xc'),'port':0x18eb});var socket=require(_0xc9d5('0xd'))(new Redis(config[_0xc9d5('0xa')]));require(_0xc9d5('0xe'))[_0xc9d5('0xf')](socket);function respondWithRpcPromise(_0x4b2a27,_0x5aeab3,_0x53816b){return new BPromise(function(_0x4d4fde,_0x15dcdf){return client[_0xc9d5('0x10')](_0x4b2a27,_0x53816b)[_0xc9d5('0x11')](function(_0x23d32e){logger[_0xc9d5('0x12')](_0xc9d5('0x13'),_0x5aeab3,_0xc9d5('0x14'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x5aeab3,'request\x20sent',JSON[_0xc9d5('0x15')](_0x23d32e));if(_0x23d32e[_0xc9d5('0x16')]){if(_0x23d32e[_0xc9d5('0x16')][_0xc9d5('0x17')]===0x1f4){logger['error'](_0xc9d5('0x13'),_0x5aeab3,_0x23d32e[_0xc9d5('0x16')]['message']);return _0x15dcdf(_0x23d32e[_0xc9d5('0x16')][_0xc9d5('0x18')]);}logger['error']('UserProfile,\x20%s,\x20%s',_0x5aeab3,_0x23d32e[_0xc9d5('0x16')][_0xc9d5('0x18')]);return _0x4d4fde(_0x23d32e[_0xc9d5('0x16')]['message']);}else{logger[_0xc9d5('0x12')]('UserProfile,\x20%s,\x20%s',_0x5aeab3,_0xc9d5('0x14'));_0x4d4fde(_0x23d32e[_0xc9d5('0x19')][_0xc9d5('0x18')]);}})[_0xc9d5('0x1a')](function(_0x55aae9){logger[_0xc9d5('0x16')]('UserProfile,\x20%s,\x20%s',_0x5aeab3,_0x55aae9);_0x15dcdf(_0x55aae9);});});} \ No newline at end of file +var _0x980e=['request\x20sent','result','lodash','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','request','then','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','UserProfile,\x20%s,\x20%s','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x980e,0x1a6));var _0xe980=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x980e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe980('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe980('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe980('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe980('0x3'));var logger=require(_0xe980('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe980('0x5'));var client=jayson['client']['http']({'port':0x232a});config[_0xe980('0x6')]=_[_0xe980('0x7')](config[_0xe980('0x6')],{'host':_0xe980('0x8'),'port':0x18eb});var socket=require(_0xe980('0x9'))(new Redis(config[_0xe980('0x6')]));require('./userProfile.socket')[_0xe980('0xa')](socket);function respondWithRpcPromise(_0x3c5091,_0x323b26,_0x543cb9){return new BPromise(function(_0xc7944f,_0x43718a){return client[_0xe980('0xb')](_0x3c5091,_0x543cb9)[_0xe980('0xc')](function(_0x161409){logger['info']('UserProfile,\x20%s,\x20%s',_0x323b26,'request\x20sent');logger[_0xe980('0xd')](_0xe980('0xe'),_0x323b26,'request\x20sent',JSON['stringify'](_0x161409));if(_0x161409[_0xe980('0xf')]){if(_0x161409[_0xe980('0xf')][_0xe980('0x10')]===0x1f4){logger[_0xe980('0xf')](_0xe980('0x11'),_0x323b26,_0x161409[_0xe980('0xf')][_0xe980('0x12')]);return _0x43718a(_0x161409['error']['message']);}logger['error'](_0xe980('0x11'),_0x323b26,_0x161409[_0xe980('0xf')][_0xe980('0x12')]);return _0xc7944f(_0x161409[_0xe980('0xf')][_0xe980('0x12')]);}else{logger['info'](_0xe980('0x11'),_0x323b26,_0xe980('0x13'));_0xc7944f(_0x161409[_0xe980('0x14')]['message']);}})['catch'](function(_0xa49ed0){logger[_0xe980('0xf')](_0xe980('0x11'),_0x323b26,_0xa49ed0);_0x43718a(_0xa49ed0);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 47b9634..29d2a89 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 _0x970d=['remove','emit','removeListener','length','userProfile:','./userProfile.events','save'];(function(_0x4fc79e,_0x3b1919){var _0x301cba=function(_0x39ed05){while(--_0x39ed05){_0x4fc79e['push'](_0x4fc79e['shift']());}};_0x301cba(++_0x3b1919);}(_0x970d,0x15c));var _0xd970=function(_0x70fd53,_0x2a95a6){_0x70fd53=_0x70fd53-0x0;var _0x4b71c5=_0x970d[_0x70fd53];return _0x4b71c5;};'use strict';var UserProfileEvents=require(_0xd970('0x0'));var events=[_0xd970('0x1'),_0xd970('0x2'),'update'];function createListener(_0x79dae4,_0x24ad24){return function(_0x50b2bc){_0x24ad24[_0xd970('0x3')](_0x79dae4,_0x50b2bc);};}function removeListener(_0x4c0f9e,_0x4d640b){return function(){UserProfileEvents[_0xd970('0x4')](_0x4c0f9e,_0x4d640b);};}exports['register']=function(_0x3ef441){for(var _0x1354d8=0x0,_0x44d50e=events[_0xd970('0x5')];_0x1354d8<_0x44d50e;_0x1354d8++){var _0x195047=events[_0x1354d8];var _0x473b09=createListener(_0xd970('0x6')+_0x195047,_0x3ef441);UserProfileEvents['on'](_0x195047,_0x473b09);}}; \ No newline at end of file +var _0xb326=['userProfile:','./userProfile.events','save','remove','update','emit','register','length'];(function(_0x44310b,_0x97d7d3){var _0x1428b2=function(_0x215f40){while(--_0x215f40){_0x44310b['push'](_0x44310b['shift']());}};_0x1428b2(++_0x97d7d3);}(_0xb326,0x109));var _0x6b32=function(_0x599cf8,_0x48f1cb){_0x599cf8=_0x599cf8-0x0;var _0x209458=_0xb326[_0x599cf8];return _0x209458;};'use strict';var UserProfileEvents=require(_0x6b32('0x0'));var events=[_0x6b32('0x1'),_0x6b32('0x2'),_0x6b32('0x3')];function createListener(_0x1fd3a2,_0x2d4b98){return function(_0x136845){_0x2d4b98[_0x6b32('0x4')](_0x1fd3a2,_0x136845);};}function removeListener(_0x4149e7,_0x36b5fb){return function(){UserProfileEvents['removeListener'](_0x4149e7,_0x36b5fb);};}exports[_0x6b32('0x5')]=function(_0x4e995d){for(var _0x58d14e=0x0,_0x29663e=events[_0x6b32('0x6')];_0x58d14e<_0x29663e;_0x58d14e++){var _0x55ef3e=events[_0x58d14e];var _0x3deb94=createListener(_0x6b32('0x7')+_0x55ef3e,_0x4e995d);UserProfileEvents['on'](_0x55ef3e,_0x3deb94);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 7be348c..1257140 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 _0x8252=['isAuthenticated','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','/describe','describe','/:id'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0x8252,0xf6));var _0x2825=function(_0x5383fb,_0x6108b4){_0x5383fb=_0x5383fb-0x0;var _0x2aae58=_0x8252[_0x5383fb];return _0x2aae58;};'use strict';var multer=require(_0x2825('0x0'));var util=require(_0x2825('0x1'));var path=require(_0x2825('0x2'));var timeout=require(_0x2825('0x3'));var express=require(_0x2825('0x4'));var router=express[_0x2825('0x5')]();var fs_extra=require(_0x2825('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2825('0x7'));var config=require(_0x2825('0x8'));var controller=require(_0x2825('0x9'));router[_0x2825('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2825('0xb'),auth['isAuthenticated'](),controller[_0x2825('0xc')]);router['get'](_0x2825('0xd'),auth[_0x2825('0xe')](),controller['show']);router[_0x2825('0xf')]('/',auth['isAuthenticated'](),controller[_0x2825('0x10')]);router['put'](_0x2825('0xd'),auth[_0x2825('0xe')](),controller[_0x2825('0x11')]);router[_0x2825('0x12')](_0x2825('0xd'),auth['isAuthenticated'](),controller[_0x2825('0x13')]);module['exports']=router; \ No newline at end of file +var _0xfee8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x84a064,_0xbaa32e){var _0x104d6f=function(_0x32c121){while(--_0x32c121){_0x84a064['push'](_0x84a064['shift']());}};_0x104d6f(++_0xbaa32e);}(_0xfee8,0x174));var _0x8fee=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0xfee8[_0x585133];return _0x18254a;};'use strict';var multer=require(_0x8fee('0x0'));var util=require('util');var path=require(_0x8fee('0x1'));var timeout=require(_0x8fee('0x2'));var express=require(_0x8fee('0x3'));var router=express[_0x8fee('0x4')]();var fs_extra=require(_0x8fee('0x5'));var auth=require(_0x8fee('0x6'));var interaction=require(_0x8fee('0x7'));var config=require(_0x8fee('0x8'));var controller=require(_0x8fee('0x9'));router[_0x8fee('0xa')]('/',auth[_0x8fee('0xb')](),controller[_0x8fee('0xc')]);router[_0x8fee('0xa')]('/describe',auth[_0x8fee('0xb')](),controller[_0x8fee('0xd')]);router['get'](_0x8fee('0xe'),auth[_0x8fee('0xb')](),controller[_0x8fee('0xf')]);router[_0x8fee('0x10')]('/',auth['isAuthenticated'](),controller[_0x8fee('0x11')]);router[_0x8fee('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8fee('0x13')](_0x8fee('0xe'),auth[_0x8fee('0xb')](),controller['destroy']);module[_0x8fee('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 209341e..f41b871 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 _0x5826=['exports','STRING','INTEGER','sequelize'];(function(_0x368e09,_0x2c1517){var _0x14b7df=function(_0x5002af){while(--_0x5002af){_0x368e09['push'](_0x368e09['shift']());}};_0x14b7df(++_0x2c1517);}(_0x5826,0x147));var _0x6582=function(_0x6b53cf,_0x433754){_0x6b53cf=_0x6b53cf-0x0;var _0x954cee=_0x5826[_0x6b53cf];return _0x954cee;};'use strict';var Sequelize=require(_0x6582('0x0'));module[_0x6582('0x1')]={'name':{'type':Sequelize[_0x6582('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x6582('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x6582('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xbb44=['exports','STRING','INTEGER'];(function(_0x34c553,_0x3e7dfc){var _0x1357d2=function(_0x3b509f){while(--_0x3b509f){_0x34c553['push'](_0x34c553['shift']());}};_0x1357d2(++_0x3e7dfc);}(_0xbb44,0x12c));var _0x4bb4=function(_0x2907bd,_0x2cc752){_0x2907bd=_0x2907bd-0x0;var _0x428652=_0xbb44[_0x2907bd];return _0x428652;};'use strict';var Sequelize=require('sequelize');module[_0x4bb4('0x0')]={'name':{'type':Sequelize[_0x4bb4('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x4bb4('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4bb4('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 51e0d6f..36e72d6 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 _0x0598=['include','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','json','undefined','limit','count','offset','set','apply','update','destroy','then','end','error','stack','name','index','map','UserProfileResource','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x0598,0x92));var _0x8059=function(_0x4a3669,_0x40d224){_0x4a3669=_0x4a3669-0x0;var _0x54692e=_0x0598[_0x4a3669];return _0x54692e;};'use strict';var emlformat=require(_0x8059('0x0'));var rimraf=require(_0x8059('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8059('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8059('0x3'));var Mustache=require(_0x8059('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8059('0x5'));var ejs=require(_0x8059('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8059('0x7'));var crypto=require(_0x8059('0x8'));var jsforce=require(_0x8059('0x9'));var deskjs=require(_0x8059('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8059('0xb'));var Redis=require(_0x8059('0xc'));var authService=require(_0x8059('0xd'));var qs=require(_0x8059('0xe'));var as=require(_0x8059('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8059('0x10'));var utils=require(_0x8059('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ead10,_0x2d26e2){_0x2d26e2=_0x2d26e2||0xcc;return function(_0x306467){if(_0x306467){return _0x1ead10[_0x8059('0x12')](_0x2d26e2);}return _0x1ead10[_0x8059('0x13')](_0x2d26e2)['end']();};}function respondWithResult(_0x11218f,_0x5480a5){_0x5480a5=_0x5480a5||0xc8;return function(_0x346b23){if(_0x346b23){return _0x11218f['status'](_0x5480a5)[_0x8059('0x14')](_0x346b23);}};}function respondWithFilteredResult(_0x13bf07,_0x4810fd){return function(_0x4d3873){if(_0x4d3873){var _0x516c1f=typeof _0x4810fd['offset']===_0x8059('0x15')&&typeof _0x4810fd[_0x8059('0x16')]===_0x8059('0x15');var _0x246c9d=_0x4d3873[_0x8059('0x17')];var _0x4b6d55=_0x516c1f?0x0:_0x4810fd[_0x8059('0x18')];var _0x2bb670=_0x516c1f?_0x4d3873[_0x8059('0x17')]:_0x4810fd[_0x8059('0x18')]+_0x4810fd['limit'];var _0x5456a9;if(_0x2bb670>=_0x246c9d){_0x2bb670=_0x246c9d;_0x5456a9=0xc8;}else{_0x5456a9=0xce;}_0x13bf07['status'](_0x5456a9);return _0x13bf07[_0x8059('0x19')]('Content-Range',_0x4b6d55+'-'+_0x2bb670+'/'+_0x246c9d)[_0x8059('0x14')](_0x4d3873);}return null;};}function patchUpdates(_0x56d794){return function(_0x466a88){try{jsonpatch[_0x8059('0x1a')](_0x466a88,_0x56d794,!![]);}catch(_0x1e9ac5){return BPromise['reject'](_0x1e9ac5);}return _0x466a88['save']();};}function saveUpdates(_0x21a80f,_0x232f1b){return function(_0x32aeda){if(_0x32aeda){return _0x32aeda[_0x8059('0x1b')](_0x21a80f)['then'](function(_0x3bc226){return _0x3bc226;});}return null;};}function removeEntity(_0x21ac82,_0x3da080){return function(_0x5449d9){if(_0x5449d9){return _0x5449d9[_0x8059('0x1c')]()[_0x8059('0x1d')](function(){_0x21ac82[_0x8059('0x13')](0xcc)[_0x8059('0x1e')]();});}};}function handleEntityNotFound(_0x59d3a6,_0x140f64){return function(_0x2cd179){if(!_0x2cd179){_0x59d3a6[_0x8059('0x12')](0x194);}return _0x2cd179;};}function handleError(_0x3e2d2b,_0x202b30){_0x202b30=_0x202b30||0x1f4;return function(_0x54b88b){logger[_0x8059('0x1f')](_0x54b88b[_0x8059('0x20')]);if(_0x54b88b[_0x8059('0x21')]){delete _0x54b88b['name'];}_0x3e2d2b['status'](_0x202b30)['send'](_0x54b88b);};}exports[_0x8059('0x22')]=function(_0xbebe0e,_0xc32b1f){var _0x1009af={},_0x59abe9={},_0x1eb71b={'count':0x0,'rows':[]};var _0x50b737=_[_0x8059('0x23')](db[_0x8059('0x24')]['rawAttributes'],function(_0x3814f5){return{'name':_0x3814f5[_0x8059('0x25')],'type':_0x3814f5[_0x8059('0x26')][_0x8059('0x27')]};});_0x59abe9[_0x8059('0x28')]=_[_0x8059('0x23')](_0x50b737,_0x8059('0x21'));_0x59abe9[_0x8059('0x29')]=_['keys'](_0xbebe0e[_0x8059('0x29')]);_0x59abe9[_0x8059('0x2a')]=_[_0x8059('0x2b')](_0x59abe9[_0x8059('0x28')],_0x59abe9[_0x8059('0x29')]);_0x1009af['attributes']=_[_0x8059('0x2b')](_0x59abe9[_0x8059('0x28')],qs[_0x8059('0x2c')](_0xbebe0e[_0x8059('0x29')][_0x8059('0x2c')]));_0x1009af[_0x8059('0x2d')]=_0x1009af[_0x8059('0x2d')][_0x8059('0x2e')]?_0x1009af[_0x8059('0x2d')]:_0x59abe9[_0x8059('0x28')];if(!_0xbebe0e['query'][_0x8059('0x2f')]('nolimit')){_0x1009af[_0x8059('0x16')]=qs['limit'](_0xbebe0e['query'][_0x8059('0x16')]);_0x1009af['offset']=qs[_0x8059('0x18')](_0xbebe0e['query'][_0x8059('0x18')]);}_0x1009af['order']=qs[_0x8059('0x30')](_0xbebe0e[_0x8059('0x29')]['sort']);_0x1009af[_0x8059('0x31')]=qs[_0x8059('0x2a')](_[_0x8059('0x32')](_0xbebe0e['query'],_0x59abe9[_0x8059('0x2a')]),_0x50b737);if(_0xbebe0e['query'][_0x8059('0x33')]){_0x1009af['where']=_[_0x8059('0x34')](_0x1009af[_0x8059('0x31')],{'$or':_[_0x8059('0x23')](_0x50b737,function(_0xb3b3c1){if(_0xb3b3c1['type']!==_0x8059('0x35')){var _0x55aaec={};_0x55aaec[_0xb3b3c1['name']]={'$like':'%'+_0xbebe0e[_0x8059('0x29')][_0x8059('0x33')]+'%'};return _0x55aaec;}})});}_0x1009af=_[_0x8059('0x34')]({},_0x1009af,_0xbebe0e[_0x8059('0x36')]);var _0x2f68b0={'where':_0x1009af['where']};return db['UserProfileResource']['count'](_0x2f68b0)['then'](function(_0x373e10){_0x1eb71b[_0x8059('0x17')]=_0x373e10;if(_0xbebe0e[_0x8059('0x29')]['includeAll']){_0x1009af[_0x8059('0x37')]=[{'all':!![]}];}return db[_0x8059('0x24')]['findAll'](_0x1009af);})[_0x8059('0x1d')](function(_0x2980cb){_0x1eb71b[_0x8059('0x38')]=_0x2980cb;return _0x1eb71b;})['then'](respondWithFilteredResult(_0xc32b1f,_0x1009af))[_0x8059('0x39')](handleError(_0xc32b1f,null));};exports[_0x8059('0x3a')]=function(_0x57eb56,_0x338493){var _0x280047={'raw':![],'where':{'id':_0x57eb56[_0x8059('0x3b')]['id']}},_0x3f00de={};_0x3f00de[_0x8059('0x28')]=_[_0x8059('0x3c')](db[_0x8059('0x24')][_0x8059('0x3d')]);_0x3f00de[_0x8059('0x29')]=_[_0x8059('0x3c')](_0x57eb56[_0x8059('0x29')]);_0x3f00de[_0x8059('0x2a')]=_[_0x8059('0x2b')](_0x3f00de[_0x8059('0x28')],_0x3f00de[_0x8059('0x29')]);_0x280047[_0x8059('0x2d')]=_[_0x8059('0x2b')](_0x3f00de[_0x8059('0x28')],qs[_0x8059('0x2c')](_0x57eb56[_0x8059('0x29')][_0x8059('0x2c')]));_0x280047[_0x8059('0x2d')]=_0x280047[_0x8059('0x2d')]['length']?_0x280047[_0x8059('0x2d')]:_0x3f00de['model'];if(_0x57eb56['query'][_0x8059('0x3e')]){_0x280047['include']=[{'all':!![]}];}_0x280047=_[_0x8059('0x34')]({},_0x280047,_0x57eb56['options']);return db[_0x8059('0x24')][_0x8059('0x3f')](_0x280047)[_0x8059('0x1d')](handleEntityNotFound(_0x338493,null))[_0x8059('0x1d')](respondWithResult(_0x338493,null))[_0x8059('0x39')](handleError(_0x338493,null));};exports[_0x8059('0x40')]=function(_0x538ab6,_0x301dca){return db['UserProfileResource'][_0x8059('0x40')](_0x538ab6[_0x8059('0x41')],{})[_0x8059('0x1d')](respondWithResult(_0x301dca,0xc9))['catch'](handleError(_0x301dca,null));};exports[_0x8059('0x1b')]=function(_0x120665,_0x46bec8){if(_0x120665[_0x8059('0x41')]['id']){delete _0x120665['body']['id'];}return db[_0x8059('0x24')][_0x8059('0x3f')]({'where':{'id':_0x120665[_0x8059('0x3b')]['id']}})['then'](handleEntityNotFound(_0x46bec8,null))[_0x8059('0x1d')](saveUpdates(_0x120665['body'],null))['then'](respondWithResult(_0x46bec8,null))[_0x8059('0x39')](handleError(_0x46bec8,null));};exports['destroy']=function(_0x20caa3,_0x54d2d2){return db[_0x8059('0x24')][_0x8059('0x3f')]({'where':{'id':_0x20caa3['params']['id']}})[_0x8059('0x1d')](handleEntityNotFound(_0x54d2d2,null))['then'](removeEntity(_0x54d2d2,null))[_0x8059('0x39')](handleError(_0x54d2d2,null));};exports[_0x8059('0x42')]=function(_0x429cf0,_0x5d5f16){return db[_0x8059('0x24')]['describe']()[_0x8059('0x1d')](respondWithResult(_0x5d5f16,null))[_0x8059('0x39')](handleError(_0x5d5f16,null));}; \ No newline at end of file +var _0xdb28=['index','UserProfileResource','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send'];(function(_0x30b01e,_0x1184cb){var _0x196f32=function(_0x2939ba){while(--_0x2939ba){_0x30b01e['push'](_0x30b01e['shift']());}};_0x196f32(++_0x1184cb);}(_0xdb28,0x106));var _0x8db2=function(_0x5a667d,_0x46367e){_0x5a667d=_0x5a667d-0x0;var _0xe88493=_0xdb28[_0x5a667d];return _0xe88493;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['create']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')](_0x449109['body'],{})['then'](respondWithResult(_0x2ada52,0xc9))[_0x8db2('0x42')](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x164020,_0x4c66e5){if(_0x164020['body']['id']){delete _0x164020['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x164020[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x4c66e5,null))[_0x8db2('0x24')](saveUpdates(_0x164020[_0x8db2('0x4a')],null))[_0x8db2('0x24')](respondWithResult(_0x4c66e5,null))['catch'](handleError(_0x4c66e5,null));};exports['destroy']=function(_0x3d29bc,_0x18c6ef){return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x3d29bc[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x18c6ef,null))[_0x8db2('0x24')](removeEntity(_0x18c6ef,null))[_0x8db2('0x42')](handleError(_0x18c6ef,null));};exports[_0x8db2('0x4b')]=function(_0x426ae0,_0x3bc632){return db[_0x8db2('0x2b')][_0x8db2('0x4b')]()[_0x8db2('0x24')](respondWithResult(_0x3bc632,null))[_0x8db2('0x42')](handleError(_0x3bc632,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 478b19d..e1e7a6c 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 _0x24ec=['./userProfileResource.attributes','exports','define','UserProfileResource','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x252623,_0x11e913){var _0x5fd5b4=function(_0x2daacc){while(--_0x2daacc){_0x252623['push'](_0x252623['shift']());}};_0x5fd5b4(++_0x11e913);}(_0x24ec,0xd3));var _0xc24e=function(_0x376db5,_0x2b8874){_0x376db5=_0x376db5-0x0;var _0x304c17=_0x24ec[_0x376db5];return _0x304c17;};'use strict';var _=require(_0xc24e('0x0'));var util=require(_0xc24e('0x1'));var logger=require(_0xc24e('0x2'))(_0xc24e('0x3'));var moment=require(_0xc24e('0x4'));var BPromise=require(_0xc24e('0x5'));var rp=require(_0xc24e('0x6'));var fs=require('fs');var path=require(_0xc24e('0x7'));var rimraf=require(_0xc24e('0x8'));var config=require(_0xc24e('0x9'));var attributes=require(_0xc24e('0xa'));module[_0xc24e('0xb')]=function(_0x42e1df,_0x29f594){return _0x42e1df[_0xc24e('0xc')](_0xc24e('0xd'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xc24e('0xe'),'fields':[_0xc24e('0xf'),_0xc24e('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc2d1=['api','moment','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','resourceId','lodash','../../config/logger'];(function(_0x5e709a,_0x1d7975){var _0x57401a=function(_0x27eab5){while(--_0x27eab5){_0x5e709a['push'](_0x5e709a['shift']());}};_0x57401a(++_0x1d7975);}(_0xc2d1,0x174));var _0x1c2d=function(_0x5c2ad1,_0x171ef5){_0x5c2ad1=_0x5c2ad1-0x0;var _0x32328a=_0xc2d1[_0x5c2ad1];return _0x32328a;};'use strict';var _=require(_0x1c2d('0x0'));var util=require('util');var logger=require(_0x1c2d('0x1'))(_0x1c2d('0x2'));var moment=require(_0x1c2d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1c2d('0x4'));var attributes=require(_0x1c2d('0x5'));module[_0x1c2d('0x6')]=function(_0x35a99e,_0x224e23){return _0x35a99e[_0x1c2d('0x7')](_0x1c2d('0x8'),attributes,{'tableName':_0x1c2d('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x1c2d('0xa'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index c2f0399..ce6b470 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 _0x12c4=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x12c4,0x1cb));var _0x412c=function(_0x4ae234,_0x347a9b){_0x4ae234=_0x4ae234-0x0;var _0x378b96=_0x12c4[_0x4ae234];return _0x378b96;};'use strict';var _=require('lodash');var util=require(_0x412c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x412c('0x1'))['db'];var utils=require(_0x412c('0x2'));var logger=require(_0x412c('0x3'))(_0x412c('0x4'));var config=require('../../config/environment');var jayson=require(_0x412c('0x5'));var client=jayson[_0x412c('0x6')][_0x412c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x540177,_0x42e435,_0x17c5f3){return new BPromise(function(_0x1ae22e,_0x4c8f84){return client[_0x412c('0x8')](_0x540177,_0x17c5f3)[_0x412c('0x9')](function(_0x3aad5f){logger[_0x412c('0xa')](_0x412c('0xb'),_0x42e435,_0x412c('0xc'));logger[_0x412c('0xd')](_0x412c('0xe'),_0x42e435,_0x412c('0xc'),JSON[_0x412c('0xf')](_0x3aad5f));if(_0x3aad5f[_0x412c('0x10')]){if(_0x3aad5f['error'][_0x412c('0x11')]===0x1f4){logger[_0x412c('0x10')](_0x412c('0xb'),_0x42e435,_0x3aad5f['error'][_0x412c('0x12')]);return _0x4c8f84(_0x3aad5f[_0x412c('0x10')]['message']);}logger[_0x412c('0x10')](_0x412c('0xb'),_0x42e435,_0x3aad5f[_0x412c('0x10')][_0x412c('0x12')]);return _0x1ae22e(_0x3aad5f[_0x412c('0x10')]['message']);}else{logger[_0x412c('0xa')](_0x412c('0xb'),_0x42e435,'request\x20sent');_0x1ae22e(_0x3aad5f[_0x412c('0x13')]['message']);}})['catch'](function(_0x1bbc89){logger[_0x412c('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x42e435,_0x1bbc89);_0x4c8f84(_0x1bbc89);});});} \ No newline at end of file +var _0xefc6=['client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise'];(function(_0x5d76cc,_0x195736){var _0x4acce4=function(_0x3b889d){while(--_0x3b889d){_0x5d76cc['push'](_0x5d76cc['shift']());}};_0x4acce4(++_0x195736);}(_0xefc6,0x148));var _0x6efc=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xefc6[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x6efc('0x0'));var util=require(_0x6efc('0x1'));var moment=require(_0x6efc('0x2'));var BPromise=require(_0x6efc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6efc('0x4'));var db=require(_0x6efc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6efc('0x6'));var config=require('../../config/environment');var jayson=require(_0x6efc('0x7'));var client=jayson[_0x6efc('0x8')][_0x6efc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a3976,_0x81d244,_0x53b03d){return new BPromise(function(_0x6c37e6,_0x601a33){return client['request'](_0x1a3976,_0x53b03d)[_0x6efc('0xa')](function(_0x34527f){logger[_0x6efc('0xb')](_0x6efc('0xc'),_0x81d244,_0x6efc('0xd'));logger[_0x6efc('0xe')](_0x6efc('0xf'),_0x81d244,_0x6efc('0xd'),JSON['stringify'](_0x34527f));if(_0x34527f[_0x6efc('0x10')]){if(_0x34527f['error'][_0x6efc('0x11')]===0x1f4){logger['error'](_0x6efc('0xc'),_0x81d244,_0x34527f[_0x6efc('0x10')][_0x6efc('0x12')]);return _0x601a33(_0x34527f[_0x6efc('0x10')][_0x6efc('0x12')]);}logger[_0x6efc('0x10')](_0x6efc('0xc'),_0x81d244,_0x34527f[_0x6efc('0x10')][_0x6efc('0x12')]);return _0x6c37e6(_0x34527f['error'][_0x6efc('0x12')]);}else{logger[_0x6efc('0xb')](_0x6efc('0xc'),_0x81d244,_0x6efc('0xd'));_0x6c37e6(_0x34527f[_0x6efc('0x13')][_0x6efc('0x12')]);}})[_0x6efc('0x14')](function(_0x4dad00){logger[_0x6efc('0x10')](_0x6efc('0xc'),_0x81d244,_0x4dad00);_0x601a33(_0x4dad00);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 7d553f8..50f71a0 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 _0x2ebc=['./userProfileSection.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x110a8f,_0x423b78){var _0x5bcda6=function(_0x2aa4da){while(--_0x2aa4da){_0x110a8f['push'](_0x110a8f['shift']());}};_0x5bcda6(++_0x423b78);}(_0x2ebc,0x1bb));var _0xc2eb=function(_0x183e3a,_0x1bb4a9){_0x183e3a=_0x183e3a-0x0;var _0x340030=_0x2ebc[_0x183e3a];return _0x340030;};'use strict';var multer=require(_0xc2eb('0x0'));var util=require(_0xc2eb('0x1'));var path=require(_0xc2eb('0x2'));var timeout=require(_0xc2eb('0x3'));var express=require(_0xc2eb('0x4'));var router=express[_0xc2eb('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc2eb('0x6'));var config=require('../../config/environment');var controller=require(_0xc2eb('0x7'));router[_0xc2eb('0x8')]('/',auth[_0xc2eb('0x9')](),controller['index']);router[_0xc2eb('0x8')](_0xc2eb('0xa'),auth[_0xc2eb('0x9')](),controller[_0xc2eb('0xb')]);router[_0xc2eb('0x8')](_0xc2eb('0xc'),auth[_0xc2eb('0x9')](),controller[_0xc2eb('0xd')]);router[_0xc2eb('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc2eb('0xf')](_0xc2eb('0xc'),auth[_0xc2eb('0x9')](),controller[_0xc2eb('0x10')]);router['delete'](_0xc2eb('0xc'),auth[_0xc2eb('0x9')](),controller[_0xc2eb('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa0cf=['../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service'];(function(_0x20ab5a,_0x178ffa){var _0x272c6e=function(_0x14922e){while(--_0x14922e){_0x20ab5a['push'](_0x20ab5a['shift']());}};_0x272c6e(++_0x178ffa);}(_0xa0cf,0x1db));var _0xfa0c=function(_0x548503,_0x1aa00c){_0x548503=_0x548503-0x0;var _0xf8f05f=_0xa0cf[_0x548503];return _0xf8f05f;};'use strict';var multer=require('multer');var util=require(_0xfa0c('0x0'));var path=require(_0xfa0c('0x1'));var timeout=require(_0xfa0c('0x2'));var express=require(_0xfa0c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfa0c('0x4'));var config=require(_0xfa0c('0x5'));var controller=require(_0xfa0c('0x6'));router['get']('/',auth[_0xfa0c('0x7')](),controller[_0xfa0c('0x8')]);router[_0xfa0c('0x9')]('/describe',auth[_0xfa0c('0x7')](),controller[_0xfa0c('0xa')]);router[_0xfa0c('0x9')](_0xfa0c('0xb'),auth[_0xfa0c('0x7')](),controller[_0xfa0c('0xc')]);router[_0xfa0c('0xd')]('/',auth['isAuthenticated'](),controller[_0xfa0c('0xe')]);router[_0xfa0c('0xf')](_0xfa0c('0xb'),auth['isAuthenticated'](),controller[_0xfa0c('0x10')]);router[_0xfa0c('0x11')](_0xfa0c('0xb'),auth[_0xfa0c('0x7')](),controller[_0xfa0c('0x12')]);module[_0xfa0c('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index a37bba3..75c32d1 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 _0xe605=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','STRING','INTEGER'];(function(_0x361ad4,_0x4e2a8d){var _0x5173fa=function(_0x35a2e6){while(--_0x35a2e6){_0x361ad4['push'](_0x361ad4['shift']());}};_0x5173fa(++_0x4e2a8d);}(_0xe605,0x92));var _0x5e60=function(_0x486d66,_0x593eac){_0x486d66=_0x486d66-0x0;var _0x27fcad=_0xe605[_0x486d66];return _0x27fcad;};'use strict';var Sequelize=require(_0x5e60('0x0'));module[_0x5e60('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x5e60('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x5e60('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x5e60('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x5e60('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x5e60('0x2')],'set':function(_0xfe1f64){this[_0x5e60('0x5')](_0x5e60('0x6'),_0xfe1f64?_0xfe1f64[_0x5e60('0x7')](''):[]);},'get':function(){return this[_0x5e60('0x8')](_0x5e60('0x6'))?this[_0x5e60('0x8')]('crudPermissions')[_0x5e60('0x9')](''):[];}}}; \ No newline at end of file +var _0xe605=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','STRING','INTEGER'];(function(_0x3f42b0,_0x7727b3){var _0x3ba568=function(_0x3a518f){while(--_0x3a518f){_0x3f42b0['push'](_0x3f42b0['shift']());}};_0x3ba568(++_0x7727b3);}(_0xe605,0x92));var _0x5e60=function(_0x287f7c,_0x268ead){_0x287f7c=_0x287f7c-0x0;var _0xd28b20=_0xe605[_0x287f7c];return _0xd28b20;};'use strict';var Sequelize=require(_0x5e60('0x0'));module[_0x5e60('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x5e60('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x5e60('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x5e60('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x5e60('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x5e60('0x2')],'set':function(_0xfe1f64){this[_0x5e60('0x5')](_0x5e60('0x6'),_0xfe1f64?_0xfe1f64[_0x5e60('0x7')](''):[]);},'get':function(){return this[_0x5e60('0x8')](_0x5e60('0x6'))?this[_0x5e60('0x8')]('crudPermissions')[_0x5e60('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 351a369..33d3eba 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 _0x2c07=['map','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','count','include','rows','catch','show','UserProfileSection','rawAttributes','length','create','body','find','params','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index'];(function(_0x41658e,_0x3e14a6){var _0x593ce3=function(_0x1314be){while(--_0x1314be){_0x41658e['push'](_0x41658e['shift']());}};_0x593ce3(++_0x3e14a6);}(_0x2c07,0x6d));var _0x72c0=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x2c07[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x72c0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x72c0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x72c0('0x2'));var moment=require(_0x72c0('0x3'));var BPromise=require(_0x72c0('0x4'));var Mustache=require(_0x72c0('0x5'));var util=require(_0x72c0('0x6'));var path=require(_0x72c0('0x7'));var sox=require(_0x72c0('0x8'));var csv=require(_0x72c0('0x9'));var ejs=require(_0x72c0('0xa'));var fs=require('fs');var fs_extra=require(_0x72c0('0xb'));var _=require('lodash');var squel=require(_0x72c0('0xc'));var crypto=require(_0x72c0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x72c0('0xe'));var toCsv=require(_0x72c0('0x9'));var querystring=require(_0x72c0('0xf'));var Papa=require(_0x72c0('0x10'));var Redis=require(_0x72c0('0x11'));var authService=require(_0x72c0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x72c0('0x13'));var hardwareService=require(_0x72c0('0x14'));var logger=require(_0x72c0('0x15'))('api');var utils=require(_0x72c0('0x16'));var config=require(_0x72c0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x72c0('0x18'))['db'];function respondWithStatusCode(_0x2409cd,_0x2d3816){_0x2d3816=_0x2d3816||0xcc;return function(_0x1ba357){if(_0x1ba357){return _0x2409cd['sendStatus'](_0x2d3816);}return _0x2409cd[_0x72c0('0x19')](_0x2d3816)[_0x72c0('0x1a')]();};}function respondWithResult(_0x2886d0,_0x333764){_0x333764=_0x333764||0xc8;return function(_0x5506da){if(_0x5506da){return _0x2886d0[_0x72c0('0x19')](_0x333764)[_0x72c0('0x1b')](_0x5506da);}};}function respondWithFilteredResult(_0x55ab16,_0x2d81b6){return function(_0x2ed4dd){if(_0x2ed4dd){var _0x4be756=typeof _0x2d81b6[_0x72c0('0x1c')]===_0x72c0('0x1d')&&typeof _0x2d81b6[_0x72c0('0x1e')]==='undefined';var _0x27d007=_0x2ed4dd['count'];var _0x40776c=_0x4be756?0x0:_0x2d81b6[_0x72c0('0x1c')];var _0x58332d=_0x4be756?_0x2ed4dd['count']:_0x2d81b6['offset']+_0x2d81b6[_0x72c0('0x1e')];var _0x17147e;if(_0x58332d>=_0x27d007){_0x58332d=_0x27d007;_0x17147e=0xc8;}else{_0x17147e=0xce;}_0x55ab16[_0x72c0('0x19')](_0x17147e);return _0x55ab16[_0x72c0('0x1f')](_0x72c0('0x20'),_0x40776c+'-'+_0x58332d+'/'+_0x27d007)[_0x72c0('0x1b')](_0x2ed4dd);}return null;};}function patchUpdates(_0x35d01a){return function(_0x40f249){try{jsonpatch[_0x72c0('0x21')](_0x40f249,_0x35d01a,!![]);}catch(_0x4addf9){return BPromise[_0x72c0('0x22')](_0x4addf9);}return _0x40f249[_0x72c0('0x23')]();};}function saveUpdates(_0x5e38c6,_0xd12a5d){return function(_0x7602a0){if(_0x7602a0){return _0x7602a0[_0x72c0('0x24')](_0x5e38c6)[_0x72c0('0x25')](function(_0x3d1c85){return _0x3d1c85;});}return null;};}function removeEntity(_0x337200,_0x3556af){return function(_0x3fc0d2){if(_0x3fc0d2){return _0x3fc0d2[_0x72c0('0x26')]()[_0x72c0('0x25')](function(){_0x337200[_0x72c0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34a1da,_0x4033c6){return function(_0x4f842f){if(!_0x4f842f){_0x34a1da[_0x72c0('0x27')](0x194);}return _0x4f842f;};}function handleError(_0x30c715,_0x5a6463){_0x5a6463=_0x5a6463||0x1f4;return function(_0x3c6a8c){logger[_0x72c0('0x28')](_0x3c6a8c[_0x72c0('0x29')]);if(_0x3c6a8c[_0x72c0('0x2a')]){delete _0x3c6a8c[_0x72c0('0x2a')];}_0x30c715['status'](_0x5a6463)[_0x72c0('0x2b')](_0x3c6a8c);};}exports[_0x72c0('0x2c')]=function(_0x387be4,_0x5ae6cf){var _0x464e05={},_0x1d1db5={},_0x12625e={'count':0x0,'rows':[]};var _0x57fc05=_[_0x72c0('0x2d')](db['UserProfileSection']['rawAttributes'],function(_0x48b0c0){return{'name':_0x48b0c0['fieldName'],'type':_0x48b0c0['type'][_0x72c0('0x2e')]};});_0x1d1db5[_0x72c0('0x2f')]=_[_0x72c0('0x2d')](_0x57fc05,_0x72c0('0x2a'));_0x1d1db5[_0x72c0('0x30')]=_[_0x72c0('0x31')](_0x387be4[_0x72c0('0x30')]);_0x1d1db5[_0x72c0('0x32')]=_[_0x72c0('0x33')](_0x1d1db5[_0x72c0('0x2f')],_0x1d1db5['query']);_0x464e05[_0x72c0('0x34')]=_[_0x72c0('0x33')](_0x1d1db5[_0x72c0('0x2f')],qs[_0x72c0('0x35')](_0x387be4[_0x72c0('0x30')]['fields']));_0x464e05[_0x72c0('0x34')]=_0x464e05[_0x72c0('0x34')]['length']?_0x464e05[_0x72c0('0x34')]:_0x1d1db5[_0x72c0('0x2f')];if(!_0x387be4[_0x72c0('0x30')][_0x72c0('0x36')](_0x72c0('0x37'))){_0x464e05['limit']=qs['limit'](_0x387be4[_0x72c0('0x30')][_0x72c0('0x1e')]);_0x464e05[_0x72c0('0x1c')]=qs[_0x72c0('0x1c')](_0x387be4[_0x72c0('0x30')][_0x72c0('0x1c')]);}_0x464e05['order']=qs[_0x72c0('0x38')](_0x387be4[_0x72c0('0x30')][_0x72c0('0x38')]);_0x464e05[_0x72c0('0x39')]=qs[_0x72c0('0x32')](_[_0x72c0('0x3a')](_0x387be4['query'],_0x1d1db5[_0x72c0('0x32')]),_0x57fc05);if(_0x387be4[_0x72c0('0x30')][_0x72c0('0x3b')]){_0x464e05[_0x72c0('0x39')]=_['merge'](_0x464e05[_0x72c0('0x39')],{'$or':_[_0x72c0('0x2d')](_0x57fc05,function(_0x52d7d5){if(_0x52d7d5[_0x72c0('0x3c')]!==_0x72c0('0x3d')){var _0x8cd11d={};_0x8cd11d[_0x52d7d5[_0x72c0('0x2a')]]={'$like':'%'+_0x387be4[_0x72c0('0x30')][_0x72c0('0x3b')]+'%'};return _0x8cd11d;}})});}_0x464e05=_[_0x72c0('0x3e')]({},_0x464e05,_0x387be4[_0x72c0('0x3f')]);var _0x222e1b={'where':_0x464e05[_0x72c0('0x39')]};return db['UserProfileSection'][_0x72c0('0x40')](_0x222e1b)[_0x72c0('0x25')](function(_0xc3f7d3){_0x12625e[_0x72c0('0x40')]=_0xc3f7d3;if(_0x387be4['query']['includeAll']){_0x464e05[_0x72c0('0x41')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x464e05);})[_0x72c0('0x25')](function(_0x27f488){_0x12625e[_0x72c0('0x42')]=_0x27f488;return _0x12625e;})[_0x72c0('0x25')](respondWithFilteredResult(_0x5ae6cf,_0x464e05))[_0x72c0('0x43')](handleError(_0x5ae6cf,null));};exports[_0x72c0('0x44')]=function(_0x3565f2,_0x58c83c){var _0x313ef7={'raw':![],'where':{'id':_0x3565f2['params']['id']}},_0x1a7a00={};_0x1a7a00[_0x72c0('0x2f')]=_[_0x72c0('0x31')](db[_0x72c0('0x45')][_0x72c0('0x46')]);_0x1a7a00['query']=_[_0x72c0('0x31')](_0x3565f2['query']);_0x1a7a00[_0x72c0('0x32')]=_['intersection'](_0x1a7a00[_0x72c0('0x2f')],_0x1a7a00['query']);_0x313ef7[_0x72c0('0x34')]=_[_0x72c0('0x33')](_0x1a7a00['model'],qs[_0x72c0('0x35')](_0x3565f2[_0x72c0('0x30')][_0x72c0('0x35')]));_0x313ef7[_0x72c0('0x34')]=_0x313ef7[_0x72c0('0x34')][_0x72c0('0x47')]?_0x313ef7[_0x72c0('0x34')]:_0x1a7a00[_0x72c0('0x2f')];if(_0x3565f2['query']['includeAll']){_0x313ef7[_0x72c0('0x41')]=[{'all':!![]}];}_0x313ef7=_['merge']({},_0x313ef7,_0x3565f2[_0x72c0('0x3f')]);return db['UserProfileSection']['find'](_0x313ef7)[_0x72c0('0x25')](handleEntityNotFound(_0x58c83c,null))[_0x72c0('0x25')](respondWithResult(_0x58c83c,null))['catch'](handleError(_0x58c83c,null));};exports[_0x72c0('0x48')]=function(_0x2dc4b3,_0x25eeaf){return db['UserProfileSection'][_0x72c0('0x48')](_0x2dc4b3[_0x72c0('0x49')],{})[_0x72c0('0x25')](respondWithResult(_0x25eeaf,0xc9))[_0x72c0('0x43')](handleError(_0x25eeaf,null));};exports[_0x72c0('0x24')]=function(_0x255d32,_0x289051){if(_0x255d32[_0x72c0('0x49')]['id']){delete _0x255d32[_0x72c0('0x49')]['id'];}return db[_0x72c0('0x45')][_0x72c0('0x4a')]({'where':{'id':_0x255d32[_0x72c0('0x4b')]['id']}})[_0x72c0('0x25')](handleEntityNotFound(_0x289051,null))[_0x72c0('0x25')](saveUpdates(_0x255d32['body'],null))['then'](respondWithResult(_0x289051,null))[_0x72c0('0x43')](handleError(_0x289051,null));};exports[_0x72c0('0x26')]=function(_0x1b122a,_0x704c5a){return db[_0x72c0('0x45')][_0x72c0('0x4a')]({'where':{'id':_0x1b122a[_0x72c0('0x4b')]['id']}})[_0x72c0('0x25')](handleEntityNotFound(_0x704c5a,null))['then'](removeEntity(_0x704c5a,null))[_0x72c0('0x43')](handleError(_0x704c5a,null));};exports[_0x72c0('0x4c')]=function(_0x487aeb,_0x56aa53){return db[_0x72c0('0x45')][_0x72c0('0x4c')]()[_0x72c0('0x25')](respondWithResult(_0x56aa53,null))[_0x72c0('0x43')](handleError(_0x56aa53,null));}; \ No newline at end of file +var _0xb6e4=['jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','sort','where','filters','pick','filter','merge','VIRTUAL','options','UserProfileSection','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x4ddc5a,_0x5e319b){var _0x499313=function(_0x5aab52){while(--_0x5aab52){_0x4ddc5a['push'](_0x4ddc5a['shift']());}};_0x499313(++_0x5e319b);}(_0xb6e4,0x1f2));var _0x4b6e=function(_0x1e6dbd,_0x4e476e){_0x1e6dbd=_0x1e6dbd-0x0;var _0x523a5d=_0xb6e4[_0x1e6dbd];return _0x523a5d;};'use strict';var emlformat=require(_0x4b6e('0x0'));var rimraf=require(_0x4b6e('0x1'));var zipdir=require(_0x4b6e('0x2'));var jsonpatch=require(_0x4b6e('0x3'));var rp=require(_0x4b6e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4b6e('0x5'));var util=require(_0x4b6e('0x6'));var path=require(_0x4b6e('0x7'));var sox=require(_0x4b6e('0x8'));var csv=require(_0x4b6e('0x9'));var ejs=require(_0x4b6e('0xa'));var fs=require('fs');var fs_extra=require(_0x4b6e('0xb'));var _=require('lodash');var squel=require(_0x4b6e('0xc'));var crypto=require('crypto');var jsforce=require(_0x4b6e('0xd'));var deskjs=require(_0x4b6e('0xe'));var toCsv=require(_0x4b6e('0x9'));var querystring=require('querystring');var Papa=require(_0x4b6e('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4b6e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b6e('0x11'))(_0x4b6e('0x12'));var utils=require(_0x4b6e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4b6e('0x14'));var db=require(_0x4b6e('0x15'))['db'];function respondWithStatusCode(_0x47c69d,_0x4fbeb1){_0x4fbeb1=_0x4fbeb1||0xcc;return function(_0xa330d3){if(_0xa330d3){return _0x47c69d[_0x4b6e('0x16')](_0x4fbeb1);}return _0x47c69d['status'](_0x4fbeb1)[_0x4b6e('0x17')]();};}function respondWithResult(_0x2f6fd9,_0x5a0172){_0x5a0172=_0x5a0172||0xc8;return function(_0x5225f4){if(_0x5225f4){return _0x2f6fd9[_0x4b6e('0x18')](_0x5a0172)[_0x4b6e('0x19')](_0x5225f4);}};}function respondWithFilteredResult(_0x301528,_0x56f02e){return function(_0x4666d6){if(_0x4666d6){var _0x5c144a=typeof _0x56f02e[_0x4b6e('0x1a')]===_0x4b6e('0x1b')&&typeof _0x56f02e[_0x4b6e('0x1c')]==='undefined';var _0x58bfcf=_0x4666d6[_0x4b6e('0x1d')];var _0x4abb6e=_0x5c144a?0x0:_0x56f02e[_0x4b6e('0x1a')];var _0x5c075d=_0x5c144a?_0x4666d6['count']:_0x56f02e['offset']+_0x56f02e[_0x4b6e('0x1c')];var _0x1f9fb2;if(_0x5c075d>=_0x58bfcf){_0x5c075d=_0x58bfcf;_0x1f9fb2=0xc8;}else{_0x1f9fb2=0xce;}_0x301528['status'](_0x1f9fb2);return _0x301528['set'](_0x4b6e('0x1e'),_0x4abb6e+'-'+_0x5c075d+'/'+_0x58bfcf)[_0x4b6e('0x19')](_0x4666d6);}return null;};}function patchUpdates(_0x12650e){return function(_0xe6a7c6){try{jsonpatch[_0x4b6e('0x1f')](_0xe6a7c6,_0x12650e,!![]);}catch(_0x3ceda0){return BPromise['reject'](_0x3ceda0);}return _0xe6a7c6[_0x4b6e('0x20')]();};}function saveUpdates(_0x1b1e06,_0x7683c8){return function(_0x32433b){if(_0x32433b){return _0x32433b[_0x4b6e('0x21')](_0x1b1e06)[_0x4b6e('0x22')](function(_0x20944e){return _0x20944e;});}return null;};}function removeEntity(_0x4a666c,_0x45775e){return function(_0xaf136e){if(_0xaf136e){return _0xaf136e[_0x4b6e('0x23')]()['then'](function(){_0x4a666c[_0x4b6e('0x18')](0xcc)[_0x4b6e('0x17')]();});}};}function handleEntityNotFound(_0x24f82a,_0x46fbd4){return function(_0x408bfb){if(!_0x408bfb){_0x24f82a[_0x4b6e('0x16')](0x194);}return _0x408bfb;};}function handleError(_0x338590,_0x195ddc){_0x195ddc=_0x195ddc||0x1f4;return function(_0x10ef5e){logger[_0x4b6e('0x24')](_0x10ef5e[_0x4b6e('0x25')]);if(_0x10ef5e[_0x4b6e('0x26')]){delete _0x10ef5e[_0x4b6e('0x26')];}_0x338590['status'](_0x195ddc)[_0x4b6e('0x27')](_0x10ef5e);};}exports[_0x4b6e('0x28')]=function(_0x328f9e,_0x8043b){var _0x4bfdb5={},_0x1e0f0b={},_0x4779f8={'count':0x0,'rows':[]};var _0x29fbfa=_[_0x4b6e('0x29')](db['UserProfileSection']['rawAttributes'],function(_0x275505){return{'name':_0x275505[_0x4b6e('0x2a')],'type':_0x275505[_0x4b6e('0x2b')][_0x4b6e('0x2c')]};});_0x1e0f0b[_0x4b6e('0x2d')]=_['map'](_0x29fbfa,'name');_0x1e0f0b[_0x4b6e('0x2e')]=_[_0x4b6e('0x2f')](_0x328f9e[_0x4b6e('0x2e')]);_0x1e0f0b['filters']=_[_0x4b6e('0x30')](_0x1e0f0b[_0x4b6e('0x2d')],_0x1e0f0b[_0x4b6e('0x2e')]);_0x4bfdb5['attributes']=_[_0x4b6e('0x30')](_0x1e0f0b['model'],qs['fields'](_0x328f9e[_0x4b6e('0x2e')][_0x4b6e('0x31')]));_0x4bfdb5[_0x4b6e('0x32')]=_0x4bfdb5[_0x4b6e('0x32')][_0x4b6e('0x33')]?_0x4bfdb5[_0x4b6e('0x32')]:_0x1e0f0b['model'];if(!_0x328f9e['query']['hasOwnProperty']('nolimit')){_0x4bfdb5[_0x4b6e('0x1c')]=qs['limit'](_0x328f9e['query'][_0x4b6e('0x1c')]);_0x4bfdb5[_0x4b6e('0x1a')]=qs[_0x4b6e('0x1a')](_0x328f9e[_0x4b6e('0x2e')][_0x4b6e('0x1a')]);}_0x4bfdb5['order']=qs[_0x4b6e('0x34')](_0x328f9e[_0x4b6e('0x2e')][_0x4b6e('0x34')]);_0x4bfdb5[_0x4b6e('0x35')]=qs[_0x4b6e('0x36')](_[_0x4b6e('0x37')](_0x328f9e[_0x4b6e('0x2e')],_0x1e0f0b[_0x4b6e('0x36')]),_0x29fbfa);if(_0x328f9e[_0x4b6e('0x2e')][_0x4b6e('0x38')]){_0x4bfdb5[_0x4b6e('0x35')]=_[_0x4b6e('0x39')](_0x4bfdb5[_0x4b6e('0x35')],{'$or':_[_0x4b6e('0x29')](_0x29fbfa,function(_0x39a681){if(_0x39a681[_0x4b6e('0x2b')]!==_0x4b6e('0x3a')){var _0x162629={};_0x162629[_0x39a681[_0x4b6e('0x26')]]={'$like':'%'+_0x328f9e[_0x4b6e('0x2e')][_0x4b6e('0x38')]+'%'};return _0x162629;}})});}_0x4bfdb5=_[_0x4b6e('0x39')]({},_0x4bfdb5,_0x328f9e[_0x4b6e('0x3b')]);var _0x585d0a={'where':_0x4bfdb5['where']};return db[_0x4b6e('0x3c')][_0x4b6e('0x1d')](_0x585d0a)['then'](function(_0x185b68){_0x4779f8[_0x4b6e('0x1d')]=_0x185b68;if(_0x328f9e[_0x4b6e('0x2e')][_0x4b6e('0x3d')]){_0x4bfdb5[_0x4b6e('0x3e')]=[{'all':!![]}];}return db['UserProfileSection'][_0x4b6e('0x3f')](_0x4bfdb5);})[_0x4b6e('0x22')](function(_0x34519e){_0x4779f8[_0x4b6e('0x40')]=_0x34519e;return _0x4779f8;})[_0x4b6e('0x22')](respondWithFilteredResult(_0x8043b,_0x4bfdb5))[_0x4b6e('0x41')](handleError(_0x8043b,null));};exports[_0x4b6e('0x42')]=function(_0x56c57c,_0x455e13){var _0x2a406c={'raw':![],'where':{'id':_0x56c57c[_0x4b6e('0x43')]['id']}},_0x396cbb={};_0x396cbb[_0x4b6e('0x2d')]=_['keys'](db[_0x4b6e('0x3c')][_0x4b6e('0x44')]);_0x396cbb[_0x4b6e('0x2e')]=_[_0x4b6e('0x2f')](_0x56c57c['query']);_0x396cbb[_0x4b6e('0x36')]=_[_0x4b6e('0x30')](_0x396cbb[_0x4b6e('0x2d')],_0x396cbb['query']);_0x2a406c[_0x4b6e('0x32')]=_['intersection'](_0x396cbb[_0x4b6e('0x2d')],qs[_0x4b6e('0x31')](_0x56c57c[_0x4b6e('0x2e')][_0x4b6e('0x31')]));_0x2a406c['attributes']=_0x2a406c[_0x4b6e('0x32')][_0x4b6e('0x33')]?_0x2a406c[_0x4b6e('0x32')]:_0x396cbb['model'];if(_0x56c57c[_0x4b6e('0x2e')]['includeAll']){_0x2a406c['include']=[{'all':!![]}];}_0x2a406c=_[_0x4b6e('0x39')]({},_0x2a406c,_0x56c57c[_0x4b6e('0x3b')]);return db[_0x4b6e('0x3c')][_0x4b6e('0x45')](_0x2a406c)[_0x4b6e('0x22')](handleEntityNotFound(_0x455e13,null))['then'](respondWithResult(_0x455e13,null))[_0x4b6e('0x41')](handleError(_0x455e13,null));};exports[_0x4b6e('0x46')]=function(_0x873f91,_0x5ac357){return db[_0x4b6e('0x3c')][_0x4b6e('0x46')](_0x873f91[_0x4b6e('0x47')],{})[_0x4b6e('0x22')](respondWithResult(_0x5ac357,0xc9))[_0x4b6e('0x41')](handleError(_0x5ac357,null));};exports['update']=function(_0x2623b1,_0x1b3962){if(_0x2623b1['body']['id']){delete _0x2623b1[_0x4b6e('0x47')]['id'];}return db['UserProfileSection'][_0x4b6e('0x45')]({'where':{'id':_0x2623b1[_0x4b6e('0x43')]['id']}})[_0x4b6e('0x22')](handleEntityNotFound(_0x1b3962,null))[_0x4b6e('0x22')](saveUpdates(_0x2623b1[_0x4b6e('0x47')],null))[_0x4b6e('0x22')](respondWithResult(_0x1b3962,null))['catch'](handleError(_0x1b3962,null));};exports[_0x4b6e('0x23')]=function(_0x54697b,_0x32b6e0){return db[_0x4b6e('0x3c')][_0x4b6e('0x45')]({'where':{'id':_0x54697b[_0x4b6e('0x43')]['id']}})[_0x4b6e('0x22')](handleEntityNotFound(_0x32b6e0,null))[_0x4b6e('0x22')](removeEntity(_0x32b6e0,null))[_0x4b6e('0x41')](handleError(_0x32b6e0,null));};exports[_0x4b6e('0x48')]=function(_0x5860e9,_0x22f5b7){return db[_0x4b6e('0x3c')][_0x4b6e('0x48')]()['then'](respondWithResult(_0x22f5b7,null))['catch'](handleError(_0x22f5b7,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 0c09f88..872871e 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 _0xaa22=['../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','UserProfileSection','user_profile_has_sections'];(function(_0x41f96e,_0x333851){var _0x48a4ac=function(_0xdad934){while(--_0xdad934){_0x41f96e['push'](_0x41f96e['shift']());}};_0x48a4ac(++_0x333851);}(_0xaa22,0x1dd));var _0x2aa2=function(_0x37339f,_0x4c4c98){_0x37339f=_0x37339f-0x0;var _0x2329bb=_0xaa22[_0x37339f];return _0x2329bb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2aa2('0x0'))('api');var moment=require(_0x2aa2('0x1'));var BPromise=require(_0x2aa2('0x2'));var rp=require(_0x2aa2('0x3'));var fs=require('fs');var path=require(_0x2aa2('0x4'));var rimraf=require(_0x2aa2('0x5'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0x2aa2('0x6')]=function(_0x4391aa,_0x32053b){return _0x4391aa['define'](_0x2aa2('0x7'),attributes,{'tableName':_0x2aa2('0x8'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5ee9=['request-promise','path','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','moment','bluebird'];(function(_0x194847,_0x34a5d5){var _0x9499e4=function(_0x364ec0){while(--_0x364ec0){_0x194847['push'](_0x194847['shift']());}};_0x9499e4(++_0x34a5d5);}(_0x5ee9,0x1db));var _0x95ee=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5ee9[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x95ee('0x0'));var util=require(_0x95ee('0x1'));var logger=require(_0x95ee('0x2'))('api');var moment=require(_0x95ee('0x3'));var BPromise=require(_0x95ee('0x4'));var rp=require(_0x95ee('0x5'));var fs=require('fs');var path=require(_0x95ee('0x6'));var rimraf=require('rimraf');var config=require(_0x95ee('0x7'));var attributes=require(_0x95ee('0x8'));module[_0x95ee('0x9')]=function(_0xcefde9,_0x4852f7){return _0xcefde9[_0x95ee('0xa')](_0x95ee('0xb'),attributes,{'tableName':_0x95ee('0xc'),'paranoid':![],'indexes':[{'name':_0x95ee('0xd'),'fields':[_0x95ee('0xe'),_0x95ee('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 4a14f71..835f2d2 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 _0x8dbd=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x36405a,_0x762511){var _0x443a48=function(_0x59f6d9){while(--_0x59f6d9){_0x36405a['push'](_0x36405a['shift']());}};_0x443a48(++_0x762511);}(_0x8dbd,0x159));var _0xd8db=function(_0x39d96d,_0x6e1bad){_0x39d96d=_0x39d96d-0x0;var _0x35ea1a=_0x8dbd[_0x39d96d];return _0x35ea1a;};'use strict';var _=require(_0xd8db('0x0'));var util=require(_0xd8db('0x1'));var moment=require('moment');var BPromise=require(_0xd8db('0x2'));var rs=require(_0xd8db('0x3'));var fs=require('fs');var Redis=require(_0xd8db('0x4'));var db=require(_0xd8db('0x5'))['db'];var utils=require(_0xd8db('0x6'));var logger=require(_0xd8db('0x7'))(_0xd8db('0x8'));var config=require(_0xd8db('0x9'));var jayson=require(_0xd8db('0xa'));var client=jayson[_0xd8db('0xb')][_0xd8db('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c08cf,_0x1fc5f1,_0x80f8e9){return new BPromise(function(_0x3bdf6a,_0x53afb5){return client[_0xd8db('0xd')](_0x2c08cf,_0x80f8e9)['then'](function(_0x10c57e){logger[_0xd8db('0xe')](_0xd8db('0xf'),_0x1fc5f1,_0xd8db('0x10'));logger[_0xd8db('0x11')](_0xd8db('0x12'),_0x1fc5f1,_0xd8db('0x10'),JSON[_0xd8db('0x13')](_0x10c57e));if(_0x10c57e[_0xd8db('0x14')]){if(_0x10c57e[_0xd8db('0x14')]['code']===0x1f4){logger[_0xd8db('0x14')](_0xd8db('0xf'),_0x1fc5f1,_0x10c57e[_0xd8db('0x14')][_0xd8db('0x15')]);return _0x53afb5(_0x10c57e[_0xd8db('0x14')][_0xd8db('0x15')]);}logger[_0xd8db('0x14')](_0xd8db('0xf'),_0x1fc5f1,_0x10c57e['error']['message']);return _0x3bdf6a(_0x10c57e[_0xd8db('0x14')][_0xd8db('0x15')]);}else{logger['info'](_0xd8db('0xf'),_0x1fc5f1,_0xd8db('0x10'));_0x3bdf6a(_0x10c57e['result'][_0xd8db('0x15')]);}})[_0xd8db('0x16')](function(_0x437806){logger[_0xd8db('0x14')](_0xd8db('0xf'),_0x1fc5f1,_0x437806);_0x53afb5(_0x437806);});});} \ No newline at end of file +var _0x7a62=['debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','UserProfileSection,\x20%s,\x20%s','request\x20sent'];(function(_0x4bb2b9,_0x459c78){var _0x40e2a2=function(_0x19a26c){while(--_0x19a26c){_0x4bb2b9['push'](_0x4bb2b9['shift']());}};_0x40e2a2(++_0x459c78);}(_0x7a62,0x85));var _0x27a6=function(_0x29baa5,_0x26e470){_0x29baa5=_0x29baa5-0x0;var _0x3fc908=_0x7a62[_0x29baa5];return _0x3fc908;};'use strict';var _=require(_0x27a6('0x0'));var util=require(_0x27a6('0x1'));var moment=require('moment');var BPromise=require(_0x27a6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x27a6('0x3'));var db=require(_0x27a6('0x4'))['db'];var utils=require(_0x27a6('0x5'));var logger=require(_0x27a6('0x6'))('rpc');var config=require(_0x27a6('0x7'));var jayson=require(_0x27a6('0x8'));var client=jayson[_0x27a6('0x9')][_0x27a6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb6bf76,_0x5e2605,_0x34fe2b){return new BPromise(function(_0x3d1965,_0x410e82){return client['request'](_0xb6bf76,_0x34fe2b)[_0x27a6('0xb')](function(_0x8ca85c){logger['info'](_0x27a6('0xc'),_0x5e2605,_0x27a6('0xd'));logger[_0x27a6('0xe')](_0x27a6('0xf'),_0x5e2605,_0x27a6('0xd'),JSON[_0x27a6('0x10')](_0x8ca85c));if(_0x8ca85c[_0x27a6('0x11')]){if(_0x8ca85c[_0x27a6('0x11')]['code']===0x1f4){logger[_0x27a6('0x11')](_0x27a6('0xc'),_0x5e2605,_0x8ca85c[_0x27a6('0x11')][_0x27a6('0x12')]);return _0x410e82(_0x8ca85c['error']['message']);}logger['error']('UserProfileSection,\x20%s,\x20%s',_0x5e2605,_0x8ca85c[_0x27a6('0x11')][_0x27a6('0x12')]);return _0x3d1965(_0x8ca85c[_0x27a6('0x11')][_0x27a6('0x12')]);}else{logger[_0x27a6('0x13')](_0x27a6('0xc'),_0x5e2605,_0x27a6('0xd'));_0x3d1965(_0x8ca85c[_0x27a6('0x14')][_0x27a6('0x12')]);}})['catch'](function(_0x598cec){logger[_0x27a6('0x11')](_0x27a6('0xc'),_0x5e2605,_0x598cec);_0x410e82(_0x598cec);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index a01b47e..3f5aca9 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x31eaf6,_0x4048ae){var _0x5d890b=function(_0x1ca21b){while(--_0x1ca21b){_0x31eaf6['push'](_0x31eaf6['shift']());}};_0x5d890b(++_0x4048ae);}(_0xe706,0xa3));var _0x6e70=function(_0x4a858b,_0x270c1c){_0x4a858b=_0x4a858b-0x0;var _0x5ae6a0=_0xe706[_0x4a858b];return _0x5ae6a0;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5bad83,_0x5c216d){var _0x1bddfd=function(_0x236e94){while(--_0x236e94){_0x5bad83['push'](_0x5bad83['shift']());}};_0x1bddfd(++_0x5c216d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 7081420..165dbc4 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 _0xe20a=['INTEGER','sequelize','exports'];(function(_0x7e2825,_0x4df34a){var _0x3ed058=function(_0x3f592c){while(--_0x3f592c){_0x7e2825['push'](_0x7e2825['shift']());}};_0x3ed058(++_0x4df34a);}(_0xe20a,0xf7));var _0xae20=function(_0x50fe9f,_0xaf05b2){_0x50fe9f=_0x50fe9f-0x0;var _0x5dcb37=_0xe20a[_0x50fe9f];return _0x5dcb37;};'use strict';var Sequelize=require(_0xae20('0x0'));module[_0xae20('0x1')]={'penalty':{'type':Sequelize[_0xae20('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x22d2=['sequelize','exports'];(function(_0x3ebbd2,_0x18293c){var _0x5cc1ba=function(_0x3ccace){while(--_0x3ccace){_0x3ebbd2['push'](_0x3ebbd2['shift']());}};_0x5cc1ba(++_0x18293c);}(_0x22d2,0x194));var _0x222d=function(_0x1790b0,_0x2c1b20){_0x1790b0=_0x1790b0-0x0;var _0x10c31c=_0x22d2[_0x1790b0];return _0x10c31c;};'use strict';var Sequelize=require(_0x222d('0x0'));module[_0x222d('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 9b92282..5e426eb 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 _0x3d04=['../../config/environment','./userSmsQueue.attributes','exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x57cb4f,_0x541f57){var _0x29bb45=function(_0x462bee){while(--_0x462bee){_0x57cb4f['push'](_0x57cb4f['shift']());}};_0x29bb45(++_0x541f57);}(_0x3d04,0xbe));var _0x43d0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3d04[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var logger=require(_0x43d0('0x2'))(_0x43d0('0x3'));var moment=require(_0x43d0('0x4'));var BPromise=require(_0x43d0('0x5'));var rp=require(_0x43d0('0x6'));var fs=require('fs');var path=require(_0x43d0('0x7'));var rimraf=require('rimraf');var config=require(_0x43d0('0x8'));var attributes=require(_0x43d0('0x9'));module[_0x43d0('0xa')]=function(_0x617bf,_0x5e284f){return _0x617bf['define']('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a07=['exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes'];(function(_0x163a4d,_0x22feab){var _0x47fbf3=function(_0x359e2f){while(--_0x359e2f){_0x163a4d['push'](_0x163a4d['shift']());}};_0x47fbf3(++_0x22feab);}(_0x2a07,0x74));var _0x72a0=function(_0x2e200c,_0x48ecf0){_0x2e200c=_0x2e200c-0x0;var _0x5a1e2e=_0x2a07[_0x2e200c];return _0x5a1e2e;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var logger=require(_0x72a0('0x2'))(_0x72a0('0x3'));var moment=require(_0x72a0('0x4'));var BPromise=require('bluebird');var rp=require(_0x72a0('0x5'));var fs=require('fs');var path=require(_0x72a0('0x6'));var rimraf=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var attributes=require(_0x72a0('0x9'));module[_0x72a0('0xa')]=function(_0x3ccf6d,_0x20dab9){return _0x3ccf6d[_0x72a0('0xb')](_0x72a0('0xc'),attributes,{'tableName':_0x72a0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 7db3f3b..c51599b 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 _0x28ca=['http','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\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'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x28ca,0x1a4));var _0xa28c=function(_0x4c196b,_0x40816a){_0x4c196b=_0x4c196b-0x0;var _0x38a5d9=_0x28ca[_0x4c196b];return _0x38a5d9;};'use strict';var _=require(_0xa28c('0x0'));var util=require(_0xa28c('0x1'));var moment=require(_0xa28c('0x2'));var BPromise=require(_0xa28c('0x3'));var rs=require(_0xa28c('0x4'));var fs=require('fs');var Redis=require(_0xa28c('0x5'));var db=require(_0xa28c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa28c('0x7'))(_0xa28c('0x8'));var config=require(_0xa28c('0x9'));var jayson=require(_0xa28c('0xa'));var client=jayson[_0xa28c('0xb')][_0xa28c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x17a96b,_0x671cdf,_0xffc2bd){return new BPromise(function(_0x14e9fe,_0x4846f5){return client['request'](_0x17a96b,_0xffc2bd)[_0xa28c('0xd')](function(_0x3163b9){logger[_0xa28c('0xe')](_0xa28c('0xf'),_0x671cdf,_0xa28c('0x10'));logger['debug'](_0xa28c('0x11'),_0x671cdf,_0xa28c('0x10'),JSON[_0xa28c('0x12')](_0x3163b9));if(_0x3163b9['error']){if(_0x3163b9[_0xa28c('0x13')][_0xa28c('0x14')]===0x1f4){logger[_0xa28c('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x671cdf,_0x3163b9[_0xa28c('0x13')][_0xa28c('0x15')]);return _0x4846f5(_0x3163b9[_0xa28c('0x13')][_0xa28c('0x15')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x671cdf,_0x3163b9[_0xa28c('0x13')][_0xa28c('0x15')]);return _0x14e9fe(_0x3163b9[_0xa28c('0x13')]['message']);}else{logger[_0xa28c('0xe')](_0xa28c('0xf'),_0x671cdf,'request\x20sent');_0x14e9fe(_0x3163b9[_0xa28c('0x16')][_0xa28c('0x15')]);}})[_0xa28c('0x17')](function(_0x504d44){logger['error'](_0xa28c('0xf'),_0x671cdf,_0x504d44);_0x4846f5(_0x504d44);});});} \ No newline at end of file +var _0x5539=['jayson/promise','client','request','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/environment'];(function(_0x1746cb,_0x442b68){var _0x59f3d4=function(_0x4a0224){while(--_0x4a0224){_0x1746cb['push'](_0x1746cb['shift']());}};_0x59f3d4(++_0x442b68);}(_0x5539,0xc2));var _0x9553=function(_0x15d3dd,_0x15a82a){_0x15d3dd=_0x15d3dd-0x0;var _0x26360a=_0x5539[_0x15d3dd];return _0x26360a;};'use strict';var _=require(_0x9553('0x0'));var util=require(_0x9553('0x1'));var moment=require(_0x9553('0x2'));var BPromise=require(_0x9553('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9553('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9553('0x5'));var jayson=require(_0x9553('0x6'));var client=jayson[_0x9553('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22343b,_0x22a06b,_0x281d31){return new BPromise(function(_0x459bfd,_0x58bdcb){return client[_0x9553('0x8')](_0x22343b,_0x281d31)['then'](function(_0x531b3b){logger['info'](_0x9553('0x9'),_0x22a06b,_0x9553('0xa'));logger[_0x9553('0xb')](_0x9553('0xc'),_0x22a06b,_0x9553('0xa'),JSON[_0x9553('0xd')](_0x531b3b));if(_0x531b3b[_0x9553('0xe')]){if(_0x531b3b['error'][_0x9553('0xf')]===0x1f4){logger[_0x9553('0xe')](_0x9553('0x9'),_0x22a06b,_0x531b3b[_0x9553('0xe')][_0x9553('0x10')]);return _0x58bdcb(_0x531b3b['error']['message']);}logger[_0x9553('0xe')](_0x9553('0x9'),_0x22a06b,_0x531b3b[_0x9553('0xe')][_0x9553('0x10')]);return _0x459bfd(_0x531b3b[_0x9553('0xe')][_0x9553('0x10')]);}else{logger[_0x9553('0x11')](_0x9553('0x9'),_0x22a06b,_0x9553('0xa'));_0x459bfd(_0x531b3b[_0x9553('0x12')]['message']);}})[_0x9553('0x13')](function(_0x24b4e4){logger[_0x9553('0xe')](_0x9553('0x9'),_0x22a06b,_0x24b4e4);_0x58bdcb(_0x24b4e4);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index e3ca8d9..6fcf5c5 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.attributes.js +++ b/server/api/userVoicePrefix/userVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5cc=['INTEGER','sequelize','exports'];(function(_0x592d1e,_0xe44981){var _0x2eee42=function(_0x21f9ec){while(--_0x21f9ec){_0x592d1e['push'](_0x592d1e['shift']());}};_0x2eee42(++_0xe44981);}(_0xe5cc,0x1ed));var _0xce5c=function(_0x22b6b1,_0x1f67e7){_0x22b6b1=_0x22b6b1-0x0;var _0x587ce1=_0xe5cc[_0x22b6b1];return _0x587ce1;};'use strict';var Sequelize=require(_0xce5c('0x0'));module[_0xce5c('0x1')]={'UserId':{'type':Sequelize[_0xce5c('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xce5c('0x2')]}}; \ No newline at end of file +var _0x94c0=['INTEGER','sequelize','exports'];(function(_0x3c2863,_0x1b2cee){var _0x2c3d27=function(_0x4f831b){while(--_0x4f831b){_0x3c2863['push'](_0x3c2863['shift']());}};_0x2c3d27(++_0x1b2cee);}(_0x94c0,0xcd));var _0x094c=function(_0x263b1f,_0x3f2376){_0x263b1f=_0x263b1f-0x0;var _0x4aa612=_0x94c0[_0x263b1f];return _0x4aa612;};'use strict';var Sequelize=require(_0x094c('0x0'));module[_0x094c('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x094c('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index e2d0b54..1585557 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.model.js +++ b/server/api/userVoicePrefix/userVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x3aa472,_0x1b81bb){var _0x31a748=function(_0x13f72c){while(--_0x13f72c){_0x3aa472['push'](_0x3aa472['shift']());}};_0x31a748(++_0x1b81bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x407ea2,_0x1325ef){var _0x197ba4=function(_0x297d6d){while(--_0x297d6d){_0x407ea2['push'](_0x407ea2['shift']());}};_0x197ba4(++_0x1325ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index bffe386..f21bd2a 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x390aca,_0x25ea70){var _0x48eeba=function(_0x35a260){while(--_0x35a260){_0x390aca['push'](_0x390aca['shift']());}};_0x48eeba(++_0x25ea70);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(_0x58b095,_0x102945){var _0x5341b3=function(_0xbf9f6a){while(--_0xbf9f6a){_0x58b095['push'](_0x58b095['shift']());}};_0x5341b3(++_0x102945);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 4fd6a19..9ad23ed 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 _0x7916=['exports'];(function(_0x2f90cc,_0x56eb52){var _0x37ba03=function(_0x86abd0){while(--_0x86abd0){_0x2f90cc['push'](_0x2f90cc['shift']());}};_0x37ba03(++_0x56eb52);}(_0x7916,0x9a));var _0x6791=function(_0x4152fb,_0x382ecb){_0x4152fb=_0x4152fb-0x0;var _0x53b04d=_0x7916[_0x4152fb];return _0x53b04d;};'use strict';var Sequelize=require('sequelize');module[_0x6791('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x81ef=['sequelize','exports','INTEGER'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x81ef,0xc3));var _0xf81e=function(_0x35bbe9,_0x541605){_0x35bbe9=_0x35bbe9-0x0;var _0x4d3e9f=_0x81ef[_0x35bbe9];return _0x4d3e9f;};'use strict';var Sequelize=require(_0xf81e('0x0'));module[_0xf81e('0x1')]={'penalty':{'type':Sequelize[_0xf81e('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 84b28dd..1e8d2a3 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 _0xbcba=['api','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','../../config/logger'];(function(_0x1fb956,_0x3f73f5){var _0x1a5ddf=function(_0x33697f){while(--_0x33697f){_0x1fb956['push'](_0x1fb956['shift']());}};_0x1a5ddf(++_0x3f73f5);}(_0xbcba,0xd0));var _0xabcb=function(_0x537cf0,_0x6ac7f){_0x537cf0=_0x537cf0-0x0;var _0x4dbc6f=_0xbcba[_0x537cf0];return _0x4dbc6f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xabcb('0x0'))(_0xabcb('0x1'));var moment=require('moment');var BPromise=require(_0xabcb('0x2'));var rp=require(_0xabcb('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xabcb('0x4'));var config=require(_0xabcb('0x5'));var attributes=require(_0xabcb('0x6'));module[_0xabcb('0x7')]=function(_0x25ce1b,_0x4607f6){return _0x25ce1b[_0xabcb('0x8')](_0xabcb('0x9'),attributes,{'tableName':_0xabcb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbc1=['bluebird','path','rimraf','../../config/environment','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api'];(function(_0x1dbf47,_0x221fc0){var _0x542d3a=function(_0x47c137){while(--_0x47c137){_0x1dbf47['push'](_0x1dbf47['shift']());}};_0x542d3a(++_0x221fc0);}(_0xfbc1,0x17c));var _0x1fbc=function(_0xfbdff6,_0x2af690){_0xfbdff6=_0xfbdff6-0x0;var _0x4cb9be=_0xfbc1[_0xfbdff6];return _0x4cb9be;};'use strict';var _=require(_0x1fbc('0x0'));var util=require(_0x1fbc('0x1'));var logger=require(_0x1fbc('0x2'))(_0x1fbc('0x3'));var moment=require('moment');var BPromise=require(_0x1fbc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fbc('0x5'));var rimraf=require(_0x1fbc('0x6'));var config=require(_0x1fbc('0x7'));var attributes=require('./userVoiceQueue.attributes');module[_0x1fbc('0x8')]=function(_0x2ab5ce,_0x55c9bf){return _0x2ab5ce[_0x1fbc('0x9')](_0x1fbc('0xa'),attributes,{'tableName':_0x1fbc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 0d33ee3..8a151c7 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 _0x7c0e=['util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash'];(function(_0x4e58fe,_0x290615){var _0x4bf6a1=function(_0x2a7ad5){while(--_0x2a7ad5){_0x4e58fe['push'](_0x4e58fe['shift']());}};_0x4bf6a1(++_0x290615);}(_0x7c0e,0x13f));var _0xe7c0=function(_0x36c2a9,_0x45afaa){_0x36c2a9=_0x36c2a9-0x0;var _0x5662d9=_0x7c0e[_0x36c2a9];return _0x5662d9;};'use strict';var _=require(_0xe7c0('0x0'));var util=require(_0xe7c0('0x1'));var moment=require('moment');var BPromise=require(_0xe7c0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7c0('0x3'));var db=require(_0xe7c0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe7c0('0x5'));var config=require(_0xe7c0('0x6'));var jayson=require(_0xe7c0('0x7'));var client=jayson[_0xe7c0('0x8')][_0xe7c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf3e352,_0x53f1bb,_0xf65c9d){return new BPromise(function(_0x3f07bc,_0x2ed438){return client[_0xe7c0('0xa')](_0xf3e352,_0xf65c9d)[_0xe7c0('0xb')](function(_0xbc988e){logger[_0xe7c0('0xc')](_0xe7c0('0xd'),_0x53f1bb,_0xe7c0('0xe'));logger[_0xe7c0('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x53f1bb,_0xe7c0('0xe'),JSON[_0xe7c0('0x10')](_0xbc988e));if(_0xbc988e[_0xe7c0('0x11')]){if(_0xbc988e[_0xe7c0('0x11')]['code']===0x1f4){logger['error'](_0xe7c0('0xd'),_0x53f1bb,_0xbc988e['error'][_0xe7c0('0x12')]);return _0x2ed438(_0xbc988e[_0xe7c0('0x11')][_0xe7c0('0x12')]);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x53f1bb,_0xbc988e['error'][_0xe7c0('0x12')]);return _0x3f07bc(_0xbc988e[_0xe7c0('0x11')][_0xe7c0('0x12')]);}else{logger['info'](_0xe7c0('0xd'),_0x53f1bb,_0xe7c0('0xe'));_0x3f07bc(_0xbc988e[_0xe7c0('0x13')]['message']);}})['catch'](function(_0xff7665){logger[_0xe7c0('0x11')](_0xe7c0('0xd'),_0x53f1bb,_0xff7665);_0x2ed438(_0xff7665);});});} \ No newline at end of file +var _0xab56=['info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x199aed,_0x462dfd){var _0x595c7d=function(_0x4705ff){while(--_0x4705ff){_0x199aed['push'](_0x199aed['shift']());}};_0x595c7d(++_0x462dfd);}(_0xab56,0x71));var _0x6ab5=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xab56[_0x376b45];return _0x2341b3;};'use strict';var _=require('lodash');var util=require(_0x6ab5('0x0'));var moment=require('moment');var BPromise=require(_0x6ab5('0x1'));var rs=require(_0x6ab5('0x2'));var fs=require('fs');var Redis=require(_0x6ab5('0x3'));var db=require(_0x6ab5('0x4'))['db'];var utils=require(_0x6ab5('0x5'));var logger=require('../../config/logger')(_0x6ab5('0x6'));var config=require(_0x6ab5('0x7'));var jayson=require(_0x6ab5('0x8'));var client=jayson[_0x6ab5('0x9')][_0x6ab5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdd2689,_0x33b4b6,_0x1aa377){return new BPromise(function(_0x509eb8,_0xe21ee1){return client[_0x6ab5('0xb')](_0xdd2689,_0x1aa377)[_0x6ab5('0xc')](function(_0x23b5a6){logger[_0x6ab5('0xd')](_0x6ab5('0xe'),_0x33b4b6,_0x6ab5('0xf'));logger[_0x6ab5('0x10')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x33b4b6,_0x6ab5('0xf'),JSON[_0x6ab5('0x11')](_0x23b5a6));if(_0x23b5a6['error']){if(_0x23b5a6['error']['code']===0x1f4){logger[_0x6ab5('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x33b4b6,_0x23b5a6[_0x6ab5('0x12')][_0x6ab5('0x13')]);return _0xe21ee1(_0x23b5a6[_0x6ab5('0x12')][_0x6ab5('0x13')]);}logger[_0x6ab5('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x33b4b6,_0x23b5a6[_0x6ab5('0x12')]['message']);return _0x509eb8(_0x23b5a6[_0x6ab5('0x12')][_0x6ab5('0x13')]);}else{logger[_0x6ab5('0xd')](_0x6ab5('0xe'),_0x33b4b6,_0x6ab5('0xf'));_0x509eb8(_0x23b5a6['result'][_0x6ab5('0x13')]);}})[_0x6ab5('0x14')](function(_0x172b76){logger['error'](_0x6ab5('0xe'),_0x33b4b6,_0x172b76);_0xe21ee1(_0x172b76);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index de00958..3c471ee 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x43ceb0,_0x1c6db0){var _0x58cb5a=function(_0x5c8dc9){while(--_0x5c8dc9){_0x43ceb0['push'](_0x43ceb0['shift']());}};_0x58cb5a(++_0x1c6db0);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x11bd20,_0x59bded){var _0x25be44=function(_0x248bff){while(--_0x248bff){_0x11bd20['push'](_0x11bd20['shift']());}};_0x25be44(++_0x59bded);}(_0xe706,0xa3));var _0x6e70=function(_0x6f0911,_0x5721c6){_0x6f0911=_0x6f0911-0x0;var _0x48cf3b=_0xe706[_0x6f0911];return _0x48cf3b;};'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 0cd272c..7c3cf3b 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 _0xe5ef=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','sequelize'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xe5ef,0x13a));var _0xfe5e=function(_0x158bec,_0x39eb7e){_0x158bec=_0x158bec-0x0;var _0x33575a=_0xe5ef[_0x158bec];return _0x33575a;};'use strict';var Sequelize=require(_0xfe5e('0x0'));module[_0xfe5e('0x1')]={'uniqueid':{'type':Sequelize[_0xfe5e('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xfe5e('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xfe5e('0x3')},'UserId':{'type':Sequelize[_0xfe5e('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xfe5e('0x4')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xfe5e('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xfe5e('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0xfe5e('0x3')},'penalty':{'type':Sequelize[_0xfe5e('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xfe5e('0x3')}}; \ No newline at end of file +var _0x477f=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x4374fb,_0x3819b9){var _0x4ca7fe=function(_0x5f43be){while(--_0x5f43be){_0x4374fb['push'](_0x4374fb['shift']());}};_0x4ca7fe(++_0x3819b9);}(_0x477f,0x1dc));var _0xf477=function(_0x498772,_0x2388fb){_0x498772=_0x498772-0x0;var _0x22d890=_0x477f[_0x498772];return _0x22d890;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xf477('0x0')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xf477('0x1')},'membername':{'type':Sequelize[_0xf477('0x2')],'allowNull':![],'comment':_0xf477('0x1')},'UserId':{'type':Sequelize[_0xf477('0x0')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xf477('0x2')],'allowNull':![],'unique':_0xf477('0x3'),'comment':_0xf477('0x1')},'VoiceQueueId':{'type':Sequelize[_0xf477('0x0')],'allowNull':![]},'interface':{'type':Sequelize[_0xf477('0x2')],'allowNull':![],'unique':_0xf477('0x3'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xf477('0x0')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xf477('0x1')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 34bedda..6632024 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 _0xdfb9=['remove','emit','hasOwnProperty','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update'];(function(_0x3922c5,_0x3f2b1b){var _0x5c5b19=function(_0x2d52b0){while(--_0x2d52b0){_0x3922c5['push'](_0x3922c5['shift']());}};_0x5c5b19(++_0x3f2b1b);}(_0xdfb9,0x12c));var _0x9dfb=function(_0x2791c9,_0x5273d8){_0x2791c9=_0x2791c9-0x0;var _0x30e2f4=_0xdfb9[_0x2791c9];return _0x30e2f4;};'use strict';var EventEmitter=require(_0x9dfb('0x0'));var UserVoiceQueueRt=require(_0x9dfb('0x1'))['db'][_0x9dfb('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9dfb('0x3')](0x0);var events={'afterCreate':_0x9dfb('0x4'),'afterUpdate':_0x9dfb('0x5'),'afterDestroy':_0x9dfb('0x6')};function emitEvent(_0x5ac0bd){return function(_0x102c2b,_0x41fa03,_0x20a31a){UserVoiceQueueRtEvents['emit'](_0x5ac0bd+':'+_0x102c2b['id'],_0x102c2b);UserVoiceQueueRtEvents[_0x9dfb('0x7')](_0x5ac0bd,_0x102c2b);_0x20a31a(null);};}for(var e in events){if(events[_0x9dfb('0x8')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xe872=['save','update','emit','hook','exports','events','UserVoiceQueueRt'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xe872,0x186));var _0x2e87=function(_0x4085cc,_0x554cee){_0x4085cc=_0x4085cc-0x0;var _0x23e552=_0xe872[_0x4085cc];return _0x23e552;};'use strict';var EventEmitter=require(_0x2e87('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x2e87('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2e87('0x2'),'afterUpdate':_0x2e87('0x3'),'afterDestroy':'remove'};function emitEvent(_0x252060){return function(_0x136d78,_0x4116ed,_0x2d1715){UserVoiceQueueRtEvents[_0x2e87('0x4')](_0x252060+':'+_0x136d78['id'],_0x136d78);UserVoiceQueueRtEvents[_0x2e87('0x4')](_0x252060,_0x136d78);_0x2d1715(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x2e87('0x5')](e,emitEvent(event));}}module[_0x2e87('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 2a38dcc..a12fe35 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 _0xc72c=['./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x34f553,_0x5885f0){var _0x271bf2=function(_0x481545){while(--_0x481545){_0x34f553['push'](_0x34f553['shift']());}};_0x271bf2(++_0x5885f0);}(_0xc72c,0x143));var _0xcc72=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xc72c[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xcc72('0x0'));var util=require(_0xcc72('0x1'));var logger=require('../../config/logger')(_0xcc72('0x2'));var moment=require(_0xcc72('0x3'));var BPromise=require('bluebird');var rp=require(_0xcc72('0x4'));var fs=require('fs');var path=require(_0xcc72('0x5'));var rimraf=require(_0xcc72('0x6'));var config=require('../../config/environment');var attributes=require(_0xcc72('0x7'));module['exports']=function(_0x176fe5,_0x2528e4){return _0x176fe5[_0xcc72('0x8')](_0xcc72('0x9'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61bf=['path','../../config/environment','./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt','lodash','util','../../config/logger','moment','request-promise'];(function(_0x47739c,_0x194604){var _0x2b5dbb=function(_0x232846){while(--_0x232846){_0x47739c['push'](_0x47739c['shift']());}};_0x2b5dbb(++_0x194604);}(_0x61bf,0x166));var _0xf61b=function(_0xf9ab75,_0xfaeaa9){_0xf9ab75=_0xf9ab75-0x0;var _0x224790=_0x61bf[_0xf9ab75];return _0x224790;};'use strict';var _=require(_0xf61b('0x0'));var util=require(_0xf61b('0x1'));var logger=require(_0xf61b('0x2'))('api');var moment=require(_0xf61b('0x3'));var BPromise=require('bluebird');var rp=require(_0xf61b('0x4'));var fs=require('fs');var path=require(_0xf61b('0x5'));var rimraf=require('rimraf');var config=require(_0xf61b('0x6'));var attributes=require(_0xf61b('0x7'));module[_0xf61b('0x8')]=function(_0x165959,_0x3e422c){return _0x165959[_0xf61b('0x9')]('UserVoiceQueueRt',attributes,{'tableName':_0xf61b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 6840e61..56e8305 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 _0x72e8=['register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket'];(function(_0x1d0ac9,_0x264b95){var _0xfbd7aa=function(_0x28328a){while(--_0x28328a){_0x1d0ac9['push'](_0x1d0ac9['shift']());}};_0xfbd7aa(++_0x264b95);}(_0x72e8,0x1b9));var _0x872e=function(_0x3c878d,_0x59248c){_0x3c878d=_0x3c878d-0x0;var _0x15592d=_0x72e8[_0x3c878d];return _0x15592d;};'use strict';var _=require(_0x872e('0x0'));var util=require(_0x872e('0x1'));var moment=require(_0x872e('0x2'));var BPromise=require(_0x872e('0x3'));var rs=require(_0x872e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x872e('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x872e('0x6'));var jayson=require(_0x872e('0x7'));var client=jayson[_0x872e('0x8')][_0x872e('0x9')]({'port':0x232a});config[_0x872e('0xa')]=_[_0x872e('0xb')](config['redis'],{'host':_0x872e('0xc'),'port':0x18eb});var socket=require(_0x872e('0xd'))(new Redis(config[_0x872e('0xa')]));require(_0x872e('0xe'))[_0x872e('0xf')](socket);function respondWithRpcPromise(_0x4a2442,_0x5d6554,_0x4f09a7){return new BPromise(function(_0x533a3a,_0x35208c){return client[_0x872e('0x10')](_0x4a2442,_0x4f09a7)[_0x872e('0x11')](function(_0x3bfab4){logger[_0x872e('0x12')](_0x872e('0x13'),_0x5d6554,'request\x20sent');logger[_0x872e('0x14')](_0x872e('0x15'),_0x5d6554,_0x872e('0x16'),JSON[_0x872e('0x17')](_0x3bfab4));if(_0x3bfab4[_0x872e('0x18')]){if(_0x3bfab4[_0x872e('0x18')][_0x872e('0x19')]===0x1f4){logger[_0x872e('0x18')](_0x872e('0x13'),_0x5d6554,_0x3bfab4[_0x872e('0x18')][_0x872e('0x1a')]);return _0x35208c(_0x3bfab4['error'][_0x872e('0x1a')]);}logger[_0x872e('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5d6554,_0x3bfab4[_0x872e('0x18')][_0x872e('0x1a')]);return _0x533a3a(_0x3bfab4[_0x872e('0x18')]['message']);}else{logger[_0x872e('0x12')](_0x872e('0x13'),_0x5d6554,_0x872e('0x16'));_0x533a3a(_0x3bfab4['result'][_0x872e('0x1a')]);}})[_0x872e('0x1b')](function(_0x462764){logger[_0x872e('0x18')](_0x872e('0x13'),_0x5d6554,_0x462764);_0x35208c(_0x462764);});});}exports[_0x872e('0x1c')]=function(_0x2ac906){var _0x4b5d24=this;return new Promise(function(_0x4c4de1,_0x24c6fe){return db[_0x872e('0x1d')][_0x872e('0x1e')]({'raw':_0x2ac906[_0x872e('0x1f')]?_0x2ac906['options'][_0x872e('0x20')]===undefined?!![]:![]:!![],'where':_0x2ac906[_0x872e('0x1f')]?_0x2ac906[_0x872e('0x1f')][_0x872e('0x21')]||null:null,'attributes':[[db[_0x872e('0x22')]['fn'](_0x872e('0x23'),db['sequelize']['fn']('IF',db[_0x872e('0x22')][_0x872e('0x24')]('`paused`\x20=\x201,\x201,\x20null'))),_0x872e('0x25')]]})[_0x872e('0x11')](function(_0x1328c7){logger['info'](_0x872e('0x1c'),_0x2ac906);logger['debug'](_0x872e('0x1c'),_0x2ac906,JSON[_0x872e('0x17')](_0x1328c7));_0x4c4de1(_0x1328c7);})[_0x872e('0x1b')](function(_0x11f39a){logger[_0x872e('0x18')](_0x872e('0x1c'),_0x11f39a[_0x872e('0x1a')],_0x2ac906);_0x24c6fe(_0x4b5d24['error'](0x1f4,_0x11f39a[_0x872e('0x1a')]));});});}; \ No newline at end of file +var _0xacbd=['catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./userVoiceQueueRt.socket','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1c5391,_0x233c3f){var _0x2643be=function(_0x42a3e5){while(--_0x42a3e5){_0x1c5391['push'](_0x1c5391['shift']());}};_0x2643be(++_0x233c3f);}(_0xacbd,0x116));var _0xdacb=function(_0x5eca26,_0x3b609e){_0x5eca26=_0x5eca26-0x0;var _0x2e7a53=_0xacbd[_0x5eca26];return _0x2e7a53;};'use strict';var _=require(_0xdacb('0x0'));var util=require(_0xdacb('0x1'));var moment=require(_0xdacb('0x2'));var BPromise=require('bluebird');var rs=require(_0xdacb('0x3'));var fs=require('fs');var Redis=require(_0xdacb('0x4'));var db=require(_0xdacb('0x5'))['db'];var utils=require(_0xdacb('0x6'));var logger=require(_0xdacb('0x7'))(_0xdacb('0x8'));var config=require(_0xdacb('0x9'));var jayson=require(_0xdacb('0xa'));var client=jayson['client'][_0xdacb('0xb')]({'port':0x232a});config[_0xdacb('0xc')]=_[_0xdacb('0xd')](config['redis'],{'host':_0xdacb('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdacb('0xc')]));require(_0xdacb('0xf'))['register'](socket);function respondWithRpcPromise(_0x22bc0f,_0xedc079,_0x396ab5){return new BPromise(function(_0x13fc80,_0x54232a){return client['request'](_0x22bc0f,_0x396ab5)[_0xdacb('0x10')](function(_0x4a2b5b){logger[_0xdacb('0x11')](_0xdacb('0x12'),_0xedc079,_0xdacb('0x13'));logger['debug'](_0xdacb('0x14'),_0xedc079,'request\x20sent',JSON[_0xdacb('0x15')](_0x4a2b5b));if(_0x4a2b5b['error']){if(_0x4a2b5b[_0xdacb('0x16')][_0xdacb('0x17')]===0x1f4){logger['error'](_0xdacb('0x12'),_0xedc079,_0x4a2b5b[_0xdacb('0x16')][_0xdacb('0x18')]);return _0x54232a(_0x4a2b5b[_0xdacb('0x16')][_0xdacb('0x18')]);}logger[_0xdacb('0x16')](_0xdacb('0x12'),_0xedc079,_0x4a2b5b[_0xdacb('0x16')][_0xdacb('0x18')]);return _0x13fc80(_0x4a2b5b[_0xdacb('0x16')][_0xdacb('0x18')]);}else{logger[_0xdacb('0x11')](_0xdacb('0x12'),_0xedc079,_0xdacb('0x13'));_0x13fc80(_0x4a2b5b[_0xdacb('0x19')][_0xdacb('0x18')]);}})[_0xdacb('0x1a')](function(_0x6d1e28){logger['error'](_0xdacb('0x12'),_0xedc079,_0x6d1e28);_0x54232a(_0x6d1e28);});});}exports[_0xdacb('0x1b')]=function(_0x2a95a1){var _0x372e1f=this;return new Promise(function(_0xabe700,_0x5a4391){return db[_0xdacb('0x1c')][_0xdacb('0x1d')]({'raw':_0x2a95a1['options']?_0x2a95a1[_0xdacb('0x1e')][_0xdacb('0x1f')]===undefined?!![]:![]:!![],'where':_0x2a95a1[_0xdacb('0x1e')]?_0x2a95a1[_0xdacb('0x1e')]['where']||null:null,'attributes':[[db[_0xdacb('0x20')]['fn'](_0xdacb('0x21'),db[_0xdacb('0x20')]['fn']('IF',db['sequelize'][_0xdacb('0x22')](_0xdacb('0x23')))),_0xdacb('0x24')]]})[_0xdacb('0x10')](function(_0x4596be){logger[_0xdacb('0x11')](_0xdacb('0x1b'),_0x2a95a1);logger[_0xdacb('0x25')]('GetVoiceQueueRtPauses',_0x2a95a1,JSON[_0xdacb('0x15')](_0x4596be));_0xabe700(_0x4596be);})[_0xdacb('0x1a')](function(_0x38ee1c){logger[_0xdacb('0x16')]('GetVoiceQueueRtPauses',_0x38ee1c['message'],_0x2a95a1);_0x5a4391(_0x372e1f[_0xdacb('0x16')](0x1f4,_0x38ee1c[_0xdacb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 7c41b91..1080107 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 _0x103f=['remove','update','emit','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x3fb27c,_0x28c3a3){var _0x1a795c=function(_0x2b08fb){while(--_0x2b08fb){_0x3fb27c['push'](_0x3fb27c['shift']());}};_0x1a795c(++_0x28c3a3);}(_0x103f,0x13e));var _0xf103=function(_0x453835,_0x2eee68){_0x453835=_0x453835-0x0;var _0x2f9414=_0x103f[_0x453835];return _0x2f9414;};'use strict';var UserVoiceQueueRtEvents=require(_0xf103('0x0'));var events=[_0xf103('0x1'),_0xf103('0x2'),_0xf103('0x3')];function createListener(_0xbaee4b,_0x15ff90){return function(_0x3eca86){_0x15ff90[_0xf103('0x4')](_0xbaee4b,_0x3eca86);};}function removeListener(_0x2db927,_0x2e15c9){return function(){UserVoiceQueueRtEvents['removeListener'](_0x2db927,_0x2e15c9);};}exports[_0xf103('0x5')]=function(_0x30ae90){for(var _0x1cb07e=0x0,_0x211dbc=events[_0xf103('0x6')];_0x1cb07e<_0x211dbc;_0x1cb07e++){var _0x3cfbd1=events[_0x1cb07e];var _0x37e92b=createListener(_0xf103('0x7')+_0x3cfbd1,_0x30ae90);UserVoiceQueueRtEvents['on'](_0x3cfbd1,_0x37e92b);}}; \ No newline at end of file +var _0xf96b=['length','./userVoiceQueueRt.events','save','remove','update','emit','removeListener','register'];(function(_0x4bd67a,_0x4f9725){var _0x2be5fb=function(_0x33e132){while(--_0x33e132){_0x4bd67a['push'](_0x4bd67a['shift']());}};_0x2be5fb(++_0x4f9725);}(_0xf96b,0x109));var _0xbf96=function(_0x1ea106,_0x48787d){_0x1ea106=_0x1ea106-0x0;var _0x1dae19=_0xf96b[_0x1ea106];return _0x1dae19;};'use strict';var UserVoiceQueueRtEvents=require(_0xbf96('0x0'));var events=[_0xbf96('0x1'),_0xbf96('0x2'),_0xbf96('0x3')];function createListener(_0x29e6f2,_0x34b226){return function(_0x440d4e){_0x34b226[_0xbf96('0x4')](_0x29e6f2,_0x440d4e);};}function removeListener(_0x42be7e,_0x38565){return function(){UserVoiceQueueRtEvents[_0xbf96('0x5')](_0x42be7e,_0x38565);};}exports[_0xbf96('0x6')]=function(_0x162c19){for(var _0x4de1c3=0x0,_0x3e8271=events[_0xbf96('0x7')];_0x4de1c3<_0x3e8271;_0x4de1c3++){var _0x260da0=events[_0x4de1c3];var _0x88b9fa=createListener('userVoiceQueueRt:'+_0x260da0,_0x162c19);UserVoiceQueueRtEvents['on'](_0x260da0,_0x88b9fa);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 19a7ce3..7f8bc59 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x589eb4,_0xaa2019){var _0xf50816=function(_0x572fc5){while(--_0x572fc5){_0x589eb4['push'](_0x589eb4['shift']());}};_0xf50816(++_0xaa2019);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3550e8,_0x424fea){var _0x18eb61=function(_0x2dcb49){while(--_0x2dcb49){_0x3550e8['push'](_0x3550e8['shift']());}};_0x18eb61(++_0x424fea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('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 0e37028..8d8fbc8 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 _0xde32=['exports','sequelize'];(function(_0x347379,_0x37de29){var _0x1e6dbf=function(_0x137484){while(--_0x137484){_0x347379['push'](_0x347379['shift']());}};_0x1e6dbf(++_0x37de29);}(_0xde32,0xd5));var _0x2de3=function(_0x4a49bb,_0x59c7b2){_0x4a49bb=_0x4a49bb-0x0;var _0x3cf176=_0xde32[_0x4a49bb];return _0x3cf176;};'use strict';var Sequelize=require(_0x2de3('0x0'));module[_0x2de3('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb20a=['exports'];(function(_0x1d09a1,_0x43d1ca){var _0x193fec=function(_0x49c706){while(--_0x49c706){_0x1d09a1['push'](_0x1d09a1['shift']());}};_0x193fec(++_0x43d1ca);}(_0xb20a,0x167));var _0xab20=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xb20a[_0x24f31b];return _0x488401;};'use strict';var Sequelize=require('sequelize');module[_0xab20('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index ad1876a..5f0f443 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 _0x2f64=['define','UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x2f19c8,_0x138c82){var _0x245cb8=function(_0x23f3b4){while(--_0x23f3b4){_0x2f19c8['push'](_0x2f19c8['shift']());}};_0x245cb8(++_0x138c82);}(_0x2f64,0x1ef));var _0x42f6=function(_0x42e1ec,_0x19aacc){_0x42e1ec=_0x42e1ec-0x0;var _0xe8c124=_0x2f64[_0x42e1ec];return _0xe8c124;};'use strict';var _=require('lodash');var util=require(_0x42f6('0x0'));var logger=require(_0x42f6('0x1'))(_0x42f6('0x2'));var moment=require(_0x42f6('0x3'));var BPromise=require('bluebird');var rp=require(_0x42f6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42f6('0x5'));var config=require(_0x42f6('0x6'));var attributes=require(_0x42f6('0x7'));module[_0x42f6('0x8')]=function(_0x5b32cd,_0x19a4ba){return _0x5b32cd[_0x42f6('0x9')](_0x42f6('0xa'),attributes,{'tableName':_0x42f6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc44=['define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x2c2568,_0x36e52b){var _0x54c73a=function(_0x3f8849){while(--_0x3f8849){_0x2c2568['push'](_0x2c2568['shift']());}};_0x54c73a(++_0x36e52b);}(_0xbc44,0x18f));var _0x4bc4=function(_0x14a7cd,_0x3ef92){_0x14a7cd=_0x14a7cd-0x0;var _0x54191c=_0xbc44[_0x14a7cd];return _0x54191c;};'use strict';var _=require(_0x4bc4('0x0'));var util=require('util');var logger=require(_0x4bc4('0x1'))('api');var moment=require(_0x4bc4('0x2'));var BPromise=require('bluebird');var rp=require(_0x4bc4('0x3'));var fs=require('fs');var path=require(_0x4bc4('0x4'));var rimraf=require(_0x4bc4('0x5'));var config=require(_0x4bc4('0x6'));var attributes=require('./userWhatsappQueue.attributes');module[_0x4bc4('0x7')]=function(_0x2fa2fa,_0x94ec9e){return _0x2fa2fa[_0x4bc4('0x8')](_0x4bc4('0x9'),attributes,{'tableName':_0x4bc4('0xa'),'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 5c39a55..3fbd7b2 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 _0x6879=['client','http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x32c521,_0x42440a){var _0x55a750=function(_0x3f96f6){while(--_0x3f96f6){_0x32c521['push'](_0x32c521['shift']());}};_0x55a750(++_0x42440a);}(_0x6879,0xd6));var _0x9687=function(_0x274511,_0x4f3ae9){_0x274511=_0x274511-0x0;var _0x3fa8e1=_0x6879[_0x274511];return _0x3fa8e1;};'use strict';var _=require(_0x9687('0x0'));var util=require(_0x9687('0x1'));var moment=require(_0x9687('0x2'));var BPromise=require(_0x9687('0x3'));var rs=require(_0x9687('0x4'));var fs=require('fs');var Redis=require(_0x9687('0x5'));var db=require(_0x9687('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9687('0x7'))(_0x9687('0x8'));var config=require(_0x9687('0x9'));var jayson=require(_0x9687('0xa'));var client=jayson[_0x9687('0xb')][_0x9687('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39bfd1,_0x5ade0c,_0x163a4a){return new BPromise(function(_0x129c7c,_0x5befdc){return client[_0x9687('0xd')](_0x39bfd1,_0x163a4a)[_0x9687('0xe')](function(_0x25ec56){logger['info'](_0x9687('0xf'),_0x5ade0c,_0x9687('0x10'));logger[_0x9687('0x11')](_0x9687('0x12'),_0x5ade0c,_0x9687('0x10'),JSON['stringify'](_0x25ec56));if(_0x25ec56[_0x9687('0x13')]){if(_0x25ec56[_0x9687('0x13')][_0x9687('0x14')]===0x1f4){logger[_0x9687('0x13')](_0x9687('0xf'),_0x5ade0c,_0x25ec56[_0x9687('0x13')][_0x9687('0x15')]);return _0x5befdc(_0x25ec56[_0x9687('0x13')]['message']);}logger['error'](_0x9687('0xf'),_0x5ade0c,_0x25ec56[_0x9687('0x13')][_0x9687('0x15')]);return _0x129c7c(_0x25ec56['error'][_0x9687('0x15')]);}else{logger[_0x9687('0x16')](_0x9687('0xf'),_0x5ade0c,_0x9687('0x10'));_0x129c7c(_0x25ec56[_0x9687('0x17')]['message']);}})[_0x9687('0x18')](function(_0x4efde3){logger[_0x9687('0x13')](_0x9687('0xf'),_0x5ade0c,_0x4efde3);_0x5befdc(_0x4efde3);});});} \ No newline at end of file +var _0xcda5=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','message','result','util','randomstring','ioredis'];(function(_0x3f651b,_0x2fa70f){var _0x27ce4b=function(_0x517597){while(--_0x517597){_0x3f651b['push'](_0x3f651b['shift']());}};_0x27ce4b(++_0x2fa70f);}(_0xcda5,0xf4));var _0x5cda=function(_0x101e27,_0x11de14){_0x101e27=_0x101e27-0x0;var _0x4094e5=_0xcda5[_0x101e27];return _0x4094e5;};'use strict';var _=require('lodash');var util=require(_0x5cda('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5cda('0x1'));var fs=require('fs');var Redis=require(_0x5cda('0x2'));var db=require(_0x5cda('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5cda('0x4'))(_0x5cda('0x5'));var config=require('../../config/environment');var jayson=require(_0x5cda('0x6'));var client=jayson[_0x5cda('0x7')][_0x5cda('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x256caf,_0x3cc239,_0x5420d9){return new BPromise(function(_0x3ee51b,_0x3d664f){return client[_0x5cda('0x9')](_0x256caf,_0x5420d9)[_0x5cda('0xa')](function(_0x15b134){logger[_0x5cda('0xb')](_0x5cda('0xc'),_0x3cc239,_0x5cda('0xd'));logger[_0x5cda('0xe')](_0x5cda('0xf'),_0x3cc239,_0x5cda('0xd'),JSON['stringify'](_0x15b134));if(_0x15b134[_0x5cda('0x10')]){if(_0x15b134['error']['code']===0x1f4){logger[_0x5cda('0x10')](_0x5cda('0xc'),_0x3cc239,_0x15b134['error'][_0x5cda('0x11')]);return _0x3d664f(_0x15b134[_0x5cda('0x10')][_0x5cda('0x11')]);}logger[_0x5cda('0x10')](_0x5cda('0xc'),_0x3cc239,_0x15b134[_0x5cda('0x10')]['message']);return _0x3ee51b(_0x15b134[_0x5cda('0x10')][_0x5cda('0x11')]);}else{logger[_0x5cda('0xb')](_0x5cda('0xc'),_0x3cc239,_0x5cda('0xd'));_0x3ee51b(_0x15b134[_0x5cda('0x12')][_0x5cda('0x11')]);}})['catch'](function(_0x4bcdf0){logger[_0x5cda('0x10')](_0x5cda('0xc'),_0x3cc239,_0x4bcdf0);_0x3d664f(_0x4bcdf0);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 8deeeef..6c5cdef 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 _0x3ee5=['delete','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x4d46f9,_0x2c418b){var _0x18a2bd=function(_0x25658){while(--_0x25658){_0x4d46f9['push'](_0x4d46f9['shift']());}};_0x18a2bd(++_0x2c418b);}(_0x3ee5,0x1b6));var _0x53ee=function(_0x2ba45b,_0x336083){_0x2ba45b=_0x2ba45b-0x0;var _0x402183=_0x3ee5[_0x2ba45b];return _0x402183;};'use strict';var multer=require('multer');var util=require(_0x53ee('0x0'));var path=require(_0x53ee('0x1'));var timeout=require('connect-timeout');var express=require(_0x53ee('0x2'));var router=express[_0x53ee('0x3')]();var fs_extra=require(_0x53ee('0x4'));var auth=require(_0x53ee('0x5'));var interaction=require(_0x53ee('0x6'));var config=require(_0x53ee('0x7'));var controller=require(_0x53ee('0x8'));router[_0x53ee('0x9')]('/',auth[_0x53ee('0xa')](),controller[_0x53ee('0xb')]);router[_0x53ee('0x9')]('/:id',auth[_0x53ee('0xa')](),controller[_0x53ee('0xc')]);router[_0x53ee('0xd')]('/',auth[_0x53ee('0xa')](),controller[_0x53ee('0xe')]);router[_0x53ee('0xf')](_0x53ee('0x10'),auth[_0x53ee('0xa')](),controller[_0x53ee('0x11')]);router[_0x53ee('0x12')](_0x53ee('0x10'),auth[_0x53ee('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc43c=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./variable.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util'];(function(_0x41f745,_0x4b5c4a){var _0x2cbbcb=function(_0x4d5c74){while(--_0x4d5c74){_0x41f745['push'](_0x41f745['shift']());}};_0x2cbbcb(++_0x4b5c4a);}(_0xc43c,0x152));var _0xcc43=function(_0x36b28f,_0x5631b8){_0x36b28f=_0x36b28f-0x0;var _0xffc6d8=_0xc43c[_0x36b28f];return _0xffc6d8;};'use strict';var multer=require(_0xcc43('0x0'));var util=require(_0xcc43('0x1'));var path=require(_0xcc43('0x2'));var timeout=require(_0xcc43('0x3'));var express=require(_0xcc43('0x4'));var router=express[_0xcc43('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcc43('0x6'));var interaction=require(_0xcc43('0x7'));var config=require('../../config/environment');var controller=require(_0xcc43('0x8'));router[_0xcc43('0x9')]('/',auth[_0xcc43('0xa')](),controller[_0xcc43('0xb')]);router[_0xcc43('0x9')](_0xcc43('0xc'),auth[_0xcc43('0xa')](),controller[_0xcc43('0xd')]);router[_0xcc43('0xe')]('/',auth[_0xcc43('0xa')](),controller['create']);router[_0xcc43('0xf')](_0xcc43('0xc'),auth[_0xcc43('0xa')](),controller[_0xcc43('0x10')]);router[_0xcc43('0x11')](_0xcc43('0xc'),auth['isAuthenticated'](),controller[_0xcc43('0x12')]);module[_0xcc43('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 7f3c779..dbbc3af 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 _0xa7d8=['sequelize','STRING'];(function(_0x1941ef,_0x5c5856){var _0x12fd15=function(_0x2cdfb7){while(--_0x2cdfb7){_0x1941ef['push'](_0x1941ef['shift']());}};_0x12fd15(++_0x5c5856);}(_0xa7d8,0x94));var _0x8a7d=function(_0x2f9acc,_0x5192ff){_0x2f9acc=_0x2f9acc-0x0;var _0x58cf03=_0xa7d8[_0x2f9acc];return _0x58cf03;};'use strict';var Sequelize=require(_0x8a7d('0x0'));module['exports']={'name':{'type':Sequelize[_0x8a7d('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8a7d('0x1')]}}; \ No newline at end of file +var _0x3baf=['exports','STRING','name','sequelize'];(function(_0x49f368,_0xf070e2){var _0x3923f3=function(_0x5a313a){while(--_0x5a313a){_0x49f368['push'](_0x49f368['shift']());}};_0x3923f3(++_0xf070e2);}(_0x3baf,0xf7));var _0xf3ba=function(_0x3dcec5,_0x4a2304){_0x3dcec5=_0x3dcec5-0x0;var _0x2d211b=_0x3baf[_0x3dcec5];return _0x2d211b;};'use strict';var Sequelize=require(_0xf3ba('0x0'));module[_0xf3ba('0x1')]={'name':{'type':Sequelize[_0xf3ba('0x2')],'unique':_0xf3ba('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf3ba('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 6af9e91..d786c77 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 _0x4cd2=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','Variable','includeAll','include','rows','catch','params','filters','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0xceae53,_0x11c5e5){var _0x4674ac=function(_0x36a78f){while(--_0x36a78f){_0xceae53['push'](_0xceae53['shift']());}};_0x4674ac(++_0x11c5e5);}(_0x4cd2,0x188));var _0x24cd=function(_0x276366,_0x23d358){_0x276366=_0x276366-0x0;var _0x1b22a6=_0x4cd2[_0x276366];return _0x1b22a6;};'use strict';var emlformat=require(_0x24cd('0x0'));var rimraf=require(_0x24cd('0x1'));var zipdir=require(_0x24cd('0x2'));var jsonpatch=require(_0x24cd('0x3'));var rp=require(_0x24cd('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x24cd('0x5'));var util=require('util');var path=require(_0x24cd('0x6'));var sox=require(_0x24cd('0x7'));var csv=require(_0x24cd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x24cd('0x9'));var _=require(_0x24cd('0xa'));var squel=require(_0x24cd('0xb'));var crypto=require(_0x24cd('0xc'));var jsforce=require(_0x24cd('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x24cd('0x8'));var querystring=require(_0x24cd('0xe'));var Papa=require(_0x24cd('0xf'));var Redis=require('ioredis');var authService=require(_0x24cd('0x10'));var qs=require(_0x24cd('0x11'));var as=require(_0x24cd('0x12'));var hardwareService=require(_0x24cd('0x13'));var logger=require(_0x24cd('0x14'))(_0x24cd('0x15'));var utils=require(_0x24cd('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x24cd('0x17'))['db'];function respondWithStatusCode(_0x5bc64a,_0x2f1ddd){_0x2f1ddd=_0x2f1ddd||0xcc;return function(_0x4fac9f){if(_0x4fac9f){return _0x5bc64a[_0x24cd('0x18')](_0x2f1ddd);}return _0x5bc64a[_0x24cd('0x19')](_0x2f1ddd)[_0x24cd('0x1a')]();};}function respondWithResult(_0x7f8ee1,_0xb6c6d0){_0xb6c6d0=_0xb6c6d0||0xc8;return function(_0x1ce39b){if(_0x1ce39b){return _0x7f8ee1['status'](_0xb6c6d0)[_0x24cd('0x1b')](_0x1ce39b);}};}function respondWithFilteredResult(_0x297ab1,_0x4ae7f4){return function(_0x518aef){if(_0x518aef){var _0x4e1920=typeof _0x4ae7f4[_0x24cd('0x1c')]==='undefined'&&typeof _0x4ae7f4[_0x24cd('0x1d')]===_0x24cd('0x1e');var _0xb9129c=_0x518aef[_0x24cd('0x1f')];var _0x285fed=_0x4e1920?0x0:_0x4ae7f4[_0x24cd('0x1c')];var _0x31eb3d=_0x4e1920?_0x518aef['count']:_0x4ae7f4['offset']+_0x4ae7f4[_0x24cd('0x1d')];var _0x20fe4b;if(_0x31eb3d>=_0xb9129c){_0x31eb3d=_0xb9129c;_0x20fe4b=0xc8;}else{_0x20fe4b=0xce;}_0x297ab1['status'](_0x20fe4b);return _0x297ab1['set'](_0x24cd('0x20'),_0x285fed+'-'+_0x31eb3d+'/'+_0xb9129c)[_0x24cd('0x1b')](_0x518aef);}return null;};}function patchUpdates(_0x811a8d){return function(_0x1c65bf){try{jsonpatch[_0x24cd('0x21')](_0x1c65bf,_0x811a8d,!![]);}catch(_0xad0ad7){return BPromise[_0x24cd('0x22')](_0xad0ad7);}return _0x1c65bf[_0x24cd('0x23')]();};}function saveUpdates(_0x4dfbb0,_0x3fc34d){return function(_0x11528e){if(_0x11528e){return _0x11528e['update'](_0x4dfbb0)[_0x24cd('0x24')](function(_0x6637c9){return _0x6637c9;});}return null;};}function removeEntity(_0x2e26c9,_0x41cea3){return function(_0x5c975f){if(_0x5c975f){return _0x5c975f[_0x24cd('0x25')]()[_0x24cd('0x24')](function(){var _0x4c8fd8=_0x5c975f[_0x24cd('0x26')]({'plain':!![]});var _0x475bf2=_0x24cd('0x27');return db[_0x24cd('0x28')][_0x24cd('0x25')]({'where':{'type':_0x475bf2,'resourceId':_0x4c8fd8['id']}})[_0x24cd('0x24')](function(){return _0x5c975f;});})[_0x24cd('0x24')](function(){_0x2e26c9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x49789f,_0x2e7389){return function(_0x193018){if(!_0x193018){_0x49789f[_0x24cd('0x18')](0x194);}return _0x193018;};}function handleError(_0x2beb66,_0x1ddd48){_0x1ddd48=_0x1ddd48||0x1f4;return function(_0xb60262){logger[_0x24cd('0x29')](_0xb60262[_0x24cd('0x2a')]);if(_0xb60262['name']){delete _0xb60262[_0x24cd('0x2b')];}_0x2beb66['status'](_0x1ddd48)[_0x24cd('0x2c')](_0xb60262);};}exports['index']=function(_0x1fc4a6,_0x3e14d8){var _0x436aa4={},_0x3e3d4c={},_0x4b0763={'count':0x0,'rows':[]};var _0x241f67=_[_0x24cd('0x2d')](db['Variable'][_0x24cd('0x2e')],function(_0x5983af){return{'name':_0x5983af[_0x24cd('0x2f')],'type':_0x5983af[_0x24cd('0x30')][_0x24cd('0x31')]};});_0x3e3d4c['model']=_[_0x24cd('0x2d')](_0x241f67,_0x24cd('0x2b'));_0x3e3d4c[_0x24cd('0x32')]=_[_0x24cd('0x33')](_0x1fc4a6[_0x24cd('0x32')]);_0x3e3d4c['filters']=_[_0x24cd('0x34')](_0x3e3d4c[_0x24cd('0x35')],_0x3e3d4c[_0x24cd('0x32')]);_0x436aa4[_0x24cd('0x36')]=_[_0x24cd('0x34')](_0x3e3d4c[_0x24cd('0x35')],qs[_0x24cd('0x37')](_0x1fc4a6[_0x24cd('0x32')][_0x24cd('0x37')]));_0x436aa4['attributes']=_0x436aa4[_0x24cd('0x36')][_0x24cd('0x38')]?_0x436aa4[_0x24cd('0x36')]:_0x3e3d4c[_0x24cd('0x35')];if(!_0x1fc4a6[_0x24cd('0x32')][_0x24cd('0x39')](_0x24cd('0x3a'))){_0x436aa4[_0x24cd('0x1d')]=qs[_0x24cd('0x1d')](_0x1fc4a6[_0x24cd('0x32')][_0x24cd('0x1d')]);_0x436aa4[_0x24cd('0x1c')]=qs[_0x24cd('0x1c')](_0x1fc4a6[_0x24cd('0x32')][_0x24cd('0x1c')]);}_0x436aa4['order']=qs[_0x24cd('0x3b')](_0x1fc4a6[_0x24cd('0x32')][_0x24cd('0x3b')]);_0x436aa4[_0x24cd('0x3c')]=qs['filters'](_[_0x24cd('0x3d')](_0x1fc4a6[_0x24cd('0x32')],_0x3e3d4c['filters']),_0x241f67);if(_0x1fc4a6[_0x24cd('0x32')]['filter']){_0x436aa4['where']=_[_0x24cd('0x3e')](_0x436aa4[_0x24cd('0x3c')],{'$or':_[_0x24cd('0x2d')](_0x241f67,function(_0x3abaee){if(_0x3abaee[_0x24cd('0x30')]!==_0x24cd('0x3f')){var _0x145b0d={};_0x145b0d[_0x3abaee[_0x24cd('0x2b')]]={'$like':'%'+_0x1fc4a6[_0x24cd('0x32')][_0x24cd('0x40')]+'%'};return _0x145b0d;}})});}_0x436aa4=_['merge']({},_0x436aa4,_0x1fc4a6[_0x24cd('0x41')]);var _0x4ff67d={'where':_0x436aa4[_0x24cd('0x3c')]};return db[_0x24cd('0x42')][_0x24cd('0x1f')](_0x4ff67d)[_0x24cd('0x24')](function(_0x28179f){_0x4b0763[_0x24cd('0x1f')]=_0x28179f;if(_0x1fc4a6[_0x24cd('0x32')][_0x24cd('0x43')]){_0x436aa4[_0x24cd('0x44')]=[{'all':!![]}];}return db[_0x24cd('0x42')]['findAll'](_0x436aa4);})[_0x24cd('0x24')](function(_0x7e51cd){_0x4b0763[_0x24cd('0x45')]=_0x7e51cd;return _0x4b0763;})[_0x24cd('0x24')](respondWithFilteredResult(_0x3e14d8,_0x436aa4))[_0x24cd('0x46')](handleError(_0x3e14d8,null));};exports['show']=function(_0x25c49,_0x305f65){var _0x61fc19={'raw':!![],'where':{'id':_0x25c49[_0x24cd('0x47')]['id']}},_0xb41551={};_0xb41551[_0x24cd('0x35')]=_[_0x24cd('0x33')](db[_0x24cd('0x42')][_0x24cd('0x2e')]);_0xb41551[_0x24cd('0x32')]=_[_0x24cd('0x33')](_0x25c49[_0x24cd('0x32')]);_0xb41551[_0x24cd('0x48')]=_[_0x24cd('0x34')](_0xb41551[_0x24cd('0x35')],_0xb41551['query']);_0x61fc19[_0x24cd('0x36')]=_[_0x24cd('0x34')](_0xb41551['model'],qs[_0x24cd('0x37')](_0x25c49[_0x24cd('0x32')][_0x24cd('0x37')]));_0x61fc19[_0x24cd('0x36')]=_0x61fc19[_0x24cd('0x36')]['length']?_0x61fc19[_0x24cd('0x36')]:_0xb41551['model'];if(_0x25c49[_0x24cd('0x32')][_0x24cd('0x43')]){_0x61fc19['include']=[{'all':!![]}];}_0x61fc19=_[_0x24cd('0x3e')]({},_0x61fc19,_0x25c49[_0x24cd('0x41')]);return db[_0x24cd('0x42')][_0x24cd('0x49')](_0x61fc19)[_0x24cd('0x24')](handleEntityNotFound(_0x305f65,null))[_0x24cd('0x24')](respondWithResult(_0x305f65,null))[_0x24cd('0x46')](handleError(_0x305f65,null));};exports['create']=function(_0x57fc36,_0x18e362){return db[_0x24cd('0x42')][_0x24cd('0x4a')](_0x57fc36['body'],{})[_0x24cd('0x24')](function(_0x2dfe00){var _0x1fc248=_0x57fc36[_0x24cd('0x4b')][_0x24cd('0x26')]({'plain':!![]});if(!_0x1fc248)throw new Error(_0x24cd('0x4c'));if(_0x1fc248[_0x24cd('0x4d')]===_0x24cd('0x4b')){var _0xf491b4=_0x2dfe00['get']({'plain':!![]});var _0x236f28=_0x24cd('0x27');return db[_0x24cd('0x4e')][_0x24cd('0x49')]({'where':{'name':_0x236f28,'userProfileId':_0x1fc248[_0x24cd('0x4f')]},'raw':!![]})[_0x24cd('0x24')](function(_0xe3e7bc){if(_0xe3e7bc&&_0xe3e7bc['autoAssociation']===0x0){return db[_0x24cd('0x28')]['create']({'name':_0xf491b4[_0x24cd('0x2b')],'resourceId':_0xf491b4['id'],'type':_0xe3e7bc[_0x24cd('0x2b')],'sectionId':_0xe3e7bc['id']},{})[_0x24cd('0x24')](function(){return _0x2dfe00;});}else{return _0x2dfe00;}})[_0x24cd('0x46')](function(_0x272390){logger[_0x24cd('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x272390);throw _0x272390;});}return _0x2dfe00;})['then'](respondWithResult(_0x18e362,0xc9))[_0x24cd('0x46')](handleError(_0x18e362,null));};exports[_0x24cd('0x50')]=function(_0x4709db,_0x2f89ec){if(_0x4709db[_0x24cd('0x51')]['id']){delete _0x4709db[_0x24cd('0x51')]['id'];}return db[_0x24cd('0x42')][_0x24cd('0x49')]({'where':{'id':_0x4709db[_0x24cd('0x47')]['id']}})[_0x24cd('0x24')](handleEntityNotFound(_0x2f89ec,null))[_0x24cd('0x24')](saveUpdates(_0x4709db[_0x24cd('0x51')],null))['then'](respondWithResult(_0x2f89ec,null))['catch'](handleError(_0x2f89ec,null));};exports[_0x24cd('0x25')]=function(_0x4fb1e9,_0x11fcc2){return db[_0x24cd('0x42')][_0x24cd('0x49')]({'where':{'id':_0x4fb1e9[_0x24cd('0x47')]['id']}})['then'](handleEntityNotFound(_0x11fcc2,null))['then'](removeEntity(_0x11fcc2,null))[_0x24cd('0x46')](handleError(_0x11fcc2,null));}; \ No newline at end of file +var _0xafe7=['sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Variables','UserProfileResource','stack','name','send','index','map','Variable','rawAttributes','key','query','filters','intersection','model','attributes','order','sort','pick','filter','where','VIRTUAL','includeAll','include','findAll','params','keys','length','merge','options','find','catch','create','body','user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x295a5c,_0xfd0b5){var _0x53339e=function(_0x5ee71d){while(--_0x5ee71d){_0x295a5c['push'](_0x295a5c['shift']());}};_0x53339e(++_0xfd0b5);}(_0xafe7,0xe8));var _0x7afe=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xafe7[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0x7afe('0x0'));var rimraf=require(_0x7afe('0x1'));var zipdir=require(_0x7afe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7afe('0x3'));var moment=require(_0x7afe('0x4'));var BPromise=require(_0x7afe('0x5'));var Mustache=require(_0x7afe('0x6'));var util=require(_0x7afe('0x7'));var path=require('path');var sox=require(_0x7afe('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7afe('0x9'));var _=require(_0x7afe('0xa'));var squel=require(_0x7afe('0xb'));var crypto=require(_0x7afe('0xc'));var jsforce=require(_0x7afe('0xd'));var deskjs=require(_0x7afe('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7afe('0xf'));var Papa=require(_0x7afe('0x10'));var Redis=require(_0x7afe('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7afe('0x12'));var as=require(_0x7afe('0x13'));var hardwareService=require(_0x7afe('0x14'));var logger=require(_0x7afe('0x15'))(_0x7afe('0x16'));var utils=require('../../config/utils');var config=require(_0x7afe('0x17'));var licenseUtil=require(_0x7afe('0x18'));var db=require(_0x7afe('0x19'))['db'];function respondWithStatusCode(_0x248b5b,_0x40f258){_0x40f258=_0x40f258||0xcc;return function(_0x1393e2){if(_0x1393e2){return _0x248b5b[_0x7afe('0x1a')](_0x40f258);}return _0x248b5b[_0x7afe('0x1b')](_0x40f258)[_0x7afe('0x1c')]();};}function respondWithResult(_0x292150,_0x46e5f5){_0x46e5f5=_0x46e5f5||0xc8;return function(_0x4b0f0e){if(_0x4b0f0e){return _0x292150['status'](_0x46e5f5)[_0x7afe('0x1d')](_0x4b0f0e);}};}function respondWithFilteredResult(_0x345a4f,_0x77d33d){return function(_0x417144){if(_0x417144){var _0x57baa7=typeof _0x77d33d[_0x7afe('0x1e')]===_0x7afe('0x1f')&&typeof _0x77d33d[_0x7afe('0x20')]==='undefined';var _0x553bcc=_0x417144[_0x7afe('0x21')];var _0x559a2a=_0x57baa7?0x0:_0x77d33d['offset'];var _0x1513ff=_0x57baa7?_0x417144['count']:_0x77d33d[_0x7afe('0x1e')]+_0x77d33d[_0x7afe('0x20')];var _0x935c4d;if(_0x1513ff>=_0x553bcc){_0x1513ff=_0x553bcc;_0x935c4d=0xc8;}else{_0x935c4d=0xce;}_0x345a4f['status'](_0x935c4d);return _0x345a4f[_0x7afe('0x22')](_0x7afe('0x23'),_0x559a2a+'-'+_0x1513ff+'/'+_0x553bcc)[_0x7afe('0x1d')](_0x417144);}return null;};}function patchUpdates(_0x42e318){return function(_0x2d4f29){try{jsonpatch['apply'](_0x2d4f29,_0x42e318,!![]);}catch(_0xb3507a){return BPromise[_0x7afe('0x24')](_0xb3507a);}return _0x2d4f29[_0x7afe('0x25')]();};}function saveUpdates(_0x380ecb,_0x28b911){return function(_0x3a3691){if(_0x3a3691){return _0x3a3691[_0x7afe('0x26')](_0x380ecb)[_0x7afe('0x27')](function(_0x17f903){return _0x17f903;});}return null;};}function removeEntity(_0x5e0d11,_0x5088f2){return function(_0x3589a2){if(_0x3589a2){return _0x3589a2[_0x7afe('0x28')]()[_0x7afe('0x27')](function(){var _0x107087=_0x3589a2[_0x7afe('0x29')]({'plain':!![]});var _0xe98882=_0x7afe('0x2a');return db[_0x7afe('0x2b')][_0x7afe('0x28')]({'where':{'type':_0xe98882,'resourceId':_0x107087['id']}})[_0x7afe('0x27')](function(){return _0x3589a2;});})[_0x7afe('0x27')](function(){_0x5e0d11[_0x7afe('0x1b')](0xcc)[_0x7afe('0x1c')]();});}};}function handleEntityNotFound(_0x535078,_0x456ad9){return function(_0x53ba29){if(!_0x53ba29){_0x535078['sendStatus'](0x194);}return _0x53ba29;};}function handleError(_0x4eb085,_0x456e52){_0x456e52=_0x456e52||0x1f4;return function(_0x1c369a){logger['error'](_0x1c369a[_0x7afe('0x2c')]);if(_0x1c369a[_0x7afe('0x2d')]){delete _0x1c369a[_0x7afe('0x2d')];}_0x4eb085['status'](_0x456e52)[_0x7afe('0x2e')](_0x1c369a);};}exports[_0x7afe('0x2f')]=function(_0x22620a,_0x514ece){var _0xe4bef2={},_0x3d2e44={},_0x3c9b42={'count':0x0,'rows':[]};var _0x1e33fb=_[_0x7afe('0x30')](db[_0x7afe('0x31')][_0x7afe('0x32')],function(_0x9e38bb){return{'name':_0x9e38bb['fieldName'],'type':_0x9e38bb['type'][_0x7afe('0x33')]};});_0x3d2e44['model']=_['map'](_0x1e33fb,_0x7afe('0x2d'));_0x3d2e44[_0x7afe('0x34')]=_['keys'](_0x22620a[_0x7afe('0x34')]);_0x3d2e44[_0x7afe('0x35')]=_[_0x7afe('0x36')](_0x3d2e44[_0x7afe('0x37')],_0x3d2e44[_0x7afe('0x34')]);_0xe4bef2[_0x7afe('0x38')]=_[_0x7afe('0x36')](_0x3d2e44[_0x7afe('0x37')],qs['fields'](_0x22620a[_0x7afe('0x34')]['fields']));_0xe4bef2['attributes']=_0xe4bef2[_0x7afe('0x38')]['length']?_0xe4bef2[_0x7afe('0x38')]:_0x3d2e44[_0x7afe('0x37')];if(!_0x22620a[_0x7afe('0x34')]['hasOwnProperty']('nolimit')){_0xe4bef2[_0x7afe('0x20')]=qs[_0x7afe('0x20')](_0x22620a[_0x7afe('0x34')][_0x7afe('0x20')]);_0xe4bef2[_0x7afe('0x1e')]=qs[_0x7afe('0x1e')](_0x22620a[_0x7afe('0x34')][_0x7afe('0x1e')]);}_0xe4bef2[_0x7afe('0x39')]=qs[_0x7afe('0x3a')](_0x22620a[_0x7afe('0x34')][_0x7afe('0x3a')]);_0xe4bef2['where']=qs['filters'](_[_0x7afe('0x3b')](_0x22620a['query'],_0x3d2e44[_0x7afe('0x35')]),_0x1e33fb);if(_0x22620a[_0x7afe('0x34')][_0x7afe('0x3c')]){_0xe4bef2[_0x7afe('0x3d')]=_['merge'](_0xe4bef2[_0x7afe('0x3d')],{'$or':_[_0x7afe('0x30')](_0x1e33fb,function(_0x54396a){if(_0x54396a['type']!==_0x7afe('0x3e')){var _0x2ddd77={};_0x2ddd77[_0x54396a[_0x7afe('0x2d')]]={'$like':'%'+_0x22620a['query'][_0x7afe('0x3c')]+'%'};return _0x2ddd77;}})});}_0xe4bef2=_['merge']({},_0xe4bef2,_0x22620a['options']);var _0x1b641f={'where':_0xe4bef2[_0x7afe('0x3d')]};return db[_0x7afe('0x31')][_0x7afe('0x21')](_0x1b641f)[_0x7afe('0x27')](function(_0x4507ac){_0x3c9b42[_0x7afe('0x21')]=_0x4507ac;if(_0x22620a[_0x7afe('0x34')][_0x7afe('0x3f')]){_0xe4bef2[_0x7afe('0x40')]=[{'all':!![]}];}return db['Variable'][_0x7afe('0x41')](_0xe4bef2);})[_0x7afe('0x27')](function(_0x1bb184){_0x3c9b42['rows']=_0x1bb184;return _0x3c9b42;})[_0x7afe('0x27')](respondWithFilteredResult(_0x514ece,_0xe4bef2))['catch'](handleError(_0x514ece,null));};exports['show']=function(_0x4bdb48,_0x2ffca2){var _0x7500d6={'raw':!![],'where':{'id':_0x4bdb48[_0x7afe('0x42')]['id']}},_0x376b4f={};_0x376b4f[_0x7afe('0x37')]=_['keys'](db[_0x7afe('0x31')][_0x7afe('0x32')]);_0x376b4f[_0x7afe('0x34')]=_[_0x7afe('0x43')](_0x4bdb48[_0x7afe('0x34')]);_0x376b4f[_0x7afe('0x35')]=_['intersection'](_0x376b4f[_0x7afe('0x37')],_0x376b4f['query']);_0x7500d6[_0x7afe('0x38')]=_[_0x7afe('0x36')](_0x376b4f[_0x7afe('0x37')],qs['fields'](_0x4bdb48[_0x7afe('0x34')]['fields']));_0x7500d6['attributes']=_0x7500d6[_0x7afe('0x38')][_0x7afe('0x44')]?_0x7500d6[_0x7afe('0x38')]:_0x376b4f[_0x7afe('0x37')];if(_0x4bdb48[_0x7afe('0x34')][_0x7afe('0x3f')]){_0x7500d6[_0x7afe('0x40')]=[{'all':!![]}];}_0x7500d6=_[_0x7afe('0x45')]({},_0x7500d6,_0x4bdb48[_0x7afe('0x46')]);return db[_0x7afe('0x31')][_0x7afe('0x47')](_0x7500d6)['then'](handleEntityNotFound(_0x2ffca2,null))[_0x7afe('0x27')](respondWithResult(_0x2ffca2,null))[_0x7afe('0x48')](handleError(_0x2ffca2,null));};exports[_0x7afe('0x49')]=function(_0x3c8fb4,_0xc9ffaa){return db[_0x7afe('0x31')][_0x7afe('0x49')](_0x3c8fb4[_0x7afe('0x4a')],{})[_0x7afe('0x27')](function(_0x1eee54){var _0x2cc0ef=_0x3c8fb4[_0x7afe('0x4b')]['get']({'plain':!![]});if(!_0x2cc0ef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2cc0ef[_0x7afe('0x4c')]===_0x7afe('0x4b')){var _0x68ac1c=_0x1eee54[_0x7afe('0x29')]({'plain':!![]});var _0x62201f=_0x7afe('0x2a');return db['UserProfileSection'][_0x7afe('0x47')]({'where':{'name':_0x62201f,'userProfileId':_0x2cc0ef[_0x7afe('0x4d')]},'raw':!![]})['then'](function(_0x2a8de0){if(_0x2a8de0&&_0x2a8de0['autoAssociation']===0x0){return db[_0x7afe('0x2b')]['create']({'name':_0x68ac1c['name'],'resourceId':_0x68ac1c['id'],'type':_0x2a8de0[_0x7afe('0x2d')],'sectionId':_0x2a8de0['id']},{})[_0x7afe('0x27')](function(){return _0x1eee54;});}else{return _0x1eee54;}})[_0x7afe('0x48')](function(_0x3f9da1){logger[_0x7afe('0x4e')](_0x7afe('0x4f'),_0x3f9da1);throw _0x3f9da1;});}return _0x1eee54;})[_0x7afe('0x27')](respondWithResult(_0xc9ffaa,0xc9))[_0x7afe('0x48')](handleError(_0xc9ffaa,null));};exports[_0x7afe('0x26')]=function(_0x116028,_0x219d26){if(_0x116028[_0x7afe('0x4a')]['id']){delete _0x116028[_0x7afe('0x4a')]['id'];}return db[_0x7afe('0x31')][_0x7afe('0x47')]({'where':{'id':_0x116028[_0x7afe('0x42')]['id']}})[_0x7afe('0x27')](handleEntityNotFound(_0x219d26,null))[_0x7afe('0x27')](saveUpdates(_0x116028[_0x7afe('0x4a')],null))[_0x7afe('0x27')](respondWithResult(_0x219d26,null))[_0x7afe('0x48')](handleError(_0x219d26,null));};exports[_0x7afe('0x28')]=function(_0x1dbeac,_0x415168){return db[_0x7afe('0x31')][_0x7afe('0x47')]({'where':{'id':_0x1dbeac['params']['id']}})[_0x7afe('0x27')](handleEntityNotFound(_0x415168,null))[_0x7afe('0x27')](removeEntity(_0x415168,null))[_0x7afe('0x48')](handleError(_0x415168,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index c35ba45..96d7733 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 _0xf03d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable'];(function(_0x181378,_0x3a1d1d){var _0x57d0ad=function(_0x3fe826){while(--_0x3fe826){_0x181378['push'](_0x181378['shift']());}};_0x57d0ad(++_0x3a1d1d);}(_0xf03d,0x150));var _0xdf03=function(_0x1e3003,_0x1c580e){_0x1e3003=_0x1e3003-0x0;var _0xaa8687=_0xf03d[_0x1e3003];return _0xaa8687;};'use strict';var _=require(_0xdf03('0x0'));var util=require(_0xdf03('0x1'));var logger=require(_0xdf03('0x2'))(_0xdf03('0x3'));var moment=require(_0xdf03('0x4'));var BPromise=require(_0xdf03('0x5'));var rp=require(_0xdf03('0x6'));var fs=require('fs');var path=require(_0xdf03('0x7'));var rimraf=require(_0xdf03('0x8'));var config=require(_0xdf03('0x9'));var attributes=require(_0xdf03('0xa'));module[_0xdf03('0xb')]=function(_0x631c60,_0x181543){return _0x631c60[_0xdf03('0xc')](_0xdf03('0xd'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9ba=['rimraf','./variable.attributes','exports','define','tools_variables','../../config/logger','api','moment','bluebird'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xe9ba,0x11c));var _0xae9b=function(_0x54a9ae,_0x10263e){_0x54a9ae=_0x54a9ae-0x0;var _0x37a96d=_0xe9ba[_0x54a9ae];return _0x37a96d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xae9b('0x0'))(_0xae9b('0x1'));var moment=require(_0xae9b('0x2'));var BPromise=require(_0xae9b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xae9b('0x4'));var config=require('../../config/environment');var attributes=require(_0xae9b('0x5'));module[_0xae9b('0x6')]=function(_0x558739,_0x37777c){return _0x558739[_0xae9b('0x7')]('Variable',attributes,{'tableName':_0xae9b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 2bf501a..e622bd5 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 _0x7fbe=['stringify','error','code','message','result','catch','Variable','find','options','where','attributes','include','map','model','info','ShowVariable','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x52a9d7,_0x4b2c0d){var _0x3a0667=function(_0x388dae){while(--_0x388dae){_0x52a9d7['push'](_0x52a9d7['shift']());}};_0x3a0667(++_0x4b2c0d);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2f432a,_0x21efbd){_0x2f432a=_0x2f432a-0x0;var _0x9fb239=_0x7fbe[_0x2f432a];return _0x9fb239;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});}exports['ShowVariable']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')]({'raw':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]||null:null,'attributes':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1c')]||null:null,'include':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1d')]?_[_0xe7fb('0x1e')](_0x293a47['options'][_0xe7fb('0x1d')],function(_0x469ead){return{'model':db[_0x469ead['model']],'as':_0x469ead['as'],'attributes':_0x469ead['attributes'],'include':_0x469ead['include']?_[_0xe7fb('0x1e')](_0x469ead['include'],function(_0x49b219){return{'model':db[_0x49b219[_0xe7fb('0x1f')]],'as':_0x49b219['as'],'attributes':_0x49b219[_0xe7fb('0x1c')],'include':_0x49b219[_0xe7fb('0x1d')]?_['map'](_0x49b219[_0xe7fb('0x1d')],function(_0x2b69c4){return{'model':db[_0x2b69c4[_0xe7fb('0x1f')]],'as':_0x2b69c4['as'],'attributes':_0x2b69c4[_0xe7fb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe7fb('0xd')](function(_0x16237a){logger[_0xe7fb('0x20')]('ShowVariable',_0x293a47);logger['debug'](_0xe7fb('0x21'),_0x293a47,JSON[_0xe7fb('0x12')](_0x16237a));_0x1e77fd(_0x16237a);})[_0xe7fb('0x17')](function(_0x4fd290){logger[_0xe7fb('0x13')](_0xe7fb('0x21'),_0x4fd290[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463[_0xe7fb('0x13')](0x1f4,_0x4fd290[_0xe7fb('0x15')]));});});}; \ No newline at end of file +var _0x9957=['stringify','error','code','message','result','catch','ShowVariable','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x7226b1,_0x399845){var _0x4fb039=function(_0x3fe120){while(--_0x3fe120){_0x7226b1['push'](_0x7226b1['shift']());}};_0x4fb039(++_0x399845);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Variable,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Variable'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowVariable',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 1c2058d..00f8b9d 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 _0x6e0f=['express','Router','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','/migrations','exports'];(function(_0x5bca38,_0x56270c){var _0x3f76cb=function(_0x278b02){while(--_0x278b02){_0x5bca38['push'](_0x5bca38['shift']());}};_0x3f76cb(++_0x56270c);}(_0x6e0f,0xe0));var _0xf6e0=function(_0x3f4cd0,_0x303070){_0x3f4cd0=_0x3f4cd0-0x0;var _0x3f9f01=_0x6e0f[_0x3f4cd0];return _0x3f9f01;};'use strict';var express=require(_0xf6e0('0x0'));var router=express[_0xf6e0('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xf6e0('0x2'));router[_0xf6e0('0x3')]('/',controller[_0xf6e0('0x4')]);router[_0xf6e0('0x3')](_0xf6e0('0x5'),auth[_0xf6e0('0x6')](),auth[_0xf6e0('0x7')](),controller[_0xf6e0('0x8')]);router[_0xf6e0('0x3')](_0xf6e0('0x9'),auth['isAuthenticated'](),auth[_0xf6e0('0x7')](),controller[_0xf6e0('0xa')]);router['get'](_0xf6e0('0xb'),auth['isAuthenticated'](),auth[_0xf6e0('0x7')](),controller[_0xf6e0('0xc')]);router[_0xf6e0('0x3')](_0xf6e0('0xd'),auth[_0xf6e0('0x6')](),controller['restart']);router[_0xf6e0('0x3')](_0xf6e0('0xe'),controller['migrations']);module[_0xf6e0('0xf')]=router; \ No newline at end of file +var _0x5cf3=['pull','/restart','restart','migrations','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','/pull'];(function(_0x2b93f5,_0x5d8b16){var _0x484a84=function(_0x139b6e){while(--_0x139b6e){_0x2b93f5['push'](_0x2b93f5['shift']());}};_0x484a84(++_0x5d8b16);}(_0x5cf3,0x1d4));var _0x35cf=function(_0x4aea3a,_0x3839f9){_0x4aea3a=_0x4aea3a-0x0;var _0x5a349e=_0x5cf3[_0x4aea3a];return _0x5a349e;};'use strict';var express=require(_0x35cf('0x0'));var router=express[_0x35cf('0x1')]();var auth=require(_0x35cf('0x2'));var controller=require(_0x35cf('0x3'));router[_0x35cf('0x4')]('/',controller[_0x35cf('0x5')]);router[_0x35cf('0x4')](_0x35cf('0x6'),auth[_0x35cf('0x7')](),auth[_0x35cf('0x8')](),controller[_0x35cf('0x9')]);router[_0x35cf('0x4')](_0x35cf('0xa'),auth[_0x35cf('0x7')](),auth['canUpdate'](),controller['reset']);router[_0x35cf('0x4')](_0x35cf('0xb'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x35cf('0xc')]);router['get'](_0x35cf('0xd'),auth[_0x35cf('0x7')](),controller[_0x35cf('0xe')]);router[_0x35cf('0x4')]('/migrations',controller[_0x35cf('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index da726b8..82cf420 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 _0x5992=['pull','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','server','length','replace','sort','Migration','getQueryInterface','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','.js','last','join','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','version','query','latest','2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard'];(function(_0x586266,_0x21ce2b){var _0x4df015=function(_0x4f3580){while(--_0x4f3580){_0x586266['push'](_0x586266['shift']());}};_0x4df015(++_0x21ce2b);}(_0x5992,0xbe));var _0x2599=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x5992[_0x50a0c2];return _0x5ebadd;};'use strict';var Umzug=require(_0x2599('0x0'));var path=require(_0x2599('0x1'));var fs=require('fs');var _=require(_0x2599('0x2'));var pkginfo=require(_0x2599('0x3'))(module,'version');var compareVersions=require(_0x2599('0x4'));var exec=require(_0x2599('0x5'))[_0x2599('0x6')];var db=require(_0x2599('0x7'))['db'];var config=require(_0x2599('0x8'));var pm2=require(_0x2599('0x9'));var logger=require(_0x2599('0xa'))(_0x2599('0xb'));var git=require(_0x2599('0xc'))(config[_0x2599('0xd')]);exports[_0x2599('0xe')]=function(_0x597efe,_0x356f9e){var _0x1d1189={'current':module[_0x2599('0xf')][_0x2599('0x10')],'phonebar':0x2};if(_0x597efe[_0x2599('0x11')]&&_0x597efe[_0x2599('0x11')][_0x2599('0x12')]){return git['fetch']()['tags'](function(_0x4e1105,_0x55ce07){_0x1d1189[_0x2599('0x12')]=(_0x4e1105?module[_0x2599('0xf')][_0x2599('0x10')]:_0x55ce07[_0x2599('0x12')])||_0x2599('0x13');return _0x356f9e[_0x2599('0x14')](0xc8)[_0x2599('0x15')](_0x1d1189);});}else{return _0x356f9e[_0x2599('0x14')](0xc8)['json'](_0x1d1189);}};exports[_0x2599('0x16')]=function(_0x12f3b1,_0x2cd567){return git[_0x2599('0x16')]([_0x2599('0x17'),_0x2599('0x18')],function(_0x4e1445){if(_0x4e1445){logger[_0x2599('0x19')](_0x4e1445);return _0x2cd567[_0x2599('0x14')](0x1f4)[_0x2599('0x15')](_0x4e1445);}logger[_0x2599('0x1a')](_0x2599('0x1b'));return _0x2cd567[_0x2599('0x14')](0xc8)[_0x2599('0x15')]({'output':_0x2599('0x1c')});});};exports[_0x2599('0x1d')]=function(_0x4d85af,_0xa196c8){return git[_0x2599('0x1d')]([_0x2599('0x1e'),_0x2599('0x1f')],function(_0x2c8c40){if(_0x2c8c40){logger[_0x2599('0x19')](_0x2c8c40);return _0xa196c8[_0x2599('0x14')](0x1f4)[_0x2599('0x15')](_0x2c8c40);}logger[_0x2599('0x1a')](_0x2599('0x20'));return _0xa196c8[_0x2599('0x14')](0xc8)[_0x2599('0x15')]({'output':_0x2599('0x21')});});};exports[_0x2599('0x22')]=function(_0x1bc9d3,_0x2a1ccc){exec('npm\x20install\x20--production',function(_0x32bebe,_0x42a624,_0x34f570){logger[_0x2599('0x1a')](_0x42a624);logger['info'](_0x34f570);if(_0x32bebe){logger['error'](_0x32bebe);return _0x2a1ccc['status'](0x1f4)['json'](_0x32bebe);}return _0x2a1ccc['status'](0xc8)['json']({'output':_0x42a624});});};exports[_0x2599('0x23')]=function(_0x151d9a,_0x9a63c6){return pm2[_0x2599('0x23')](_0x2599('0x24'))[_0x2599('0x25')](function(_0x1197a3){logger['info']('pm2\x20restart\x20motion\x20%s',_0x1197a3);return _0x9a63c6[_0x2599('0x14')](0xc8)[_0x2599('0x15')]({'output':_0x2599('0x26')});})[_0x2599('0x27')](function(_0x120b10){logger['error'](_0x120b10);return _0x9a63c6[_0x2599('0x14')](0x1f4)[_0x2599('0x15')](_0x120b10);});};exports[_0x2599('0x28')]=function(_0x5c7904,_0x286d73){var _0x190178=fs['readdirSync'](path['join'](config[_0x2599('0xd')],_0x2599('0x29'),'migrations'));var _0x503734=[];for(var _0x50dfdc=0x0;_0x50dfdc<_0x190178[_0x2599('0x2a')];_0x50dfdc++){var _0x8782fa=_0x190178[_0x50dfdc][_0x2599('0x2b')]('.js','');if(compareVersions(module['exports'][_0x2599('0x10')],_0x8782fa)===-0x1){_0x503734['push'](_0x8782fa);}}if(_0x503734[_0x2599('0x2a')]){var _0x4db150=_0x503734[_0x2599('0x2c')](compareVersions);var _0x4c1e1d=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x2599('0x2d')],'modelName':'Migration','columnName':_0x2599('0x10')},'migrations':{'params':[db['sequelize'][_0x2599('0x2e')](),db[_0x2599('0x2f')][_0x2599('0x30')],function(){throw new Error(_0x2599('0x31'));}],'path':path['join'](config['root'],'server',_0x2599('0x28')),'pattern':/\.js$/}});_0x4c1e1d['up']({'migrations':_[_0x2599('0x32')](_0x4db150,function(_0x4ed050){return _0x4ed050+_0x2599('0x33');})})[_0x2599('0x25')](function(){return _0x286d73[_0x2599('0x14')](0xc8)[_0x2599('0x15')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x2599('0xf')][_0x2599('0x10')]+'\x20to\x20'+_[_0x2599('0x34')](_0x4db150),'migrations':_[_0x2599('0x35')](_0x4db150)});})[_0x2599('0x27')](function(_0x5a8212){if(_0x5a8212 instanceof db['sequelize'][_0x2599('0x36')]){return _0x286d73[_0x2599('0x14')](0xc8)[_0x2599('0x15')]({'output':_0x2599('0x37')});}else{return _0x286d73[_0x2599('0x14')](0x1f4)[_0x2599('0x15')](_0x5a8212);}});}else{return _0x286d73[_0x2599('0x14')](0xc8)[_0x2599('0x15')]({'output':_0x2599('0x37')});}}; \ No newline at end of file +var _0xab76=['push','sort','Migration','sequelize','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','root','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','version','query','latest','fetch','tags','exports','2.0.0','status','json','origin','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','info','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace'];(function(_0x78defc,_0x3cec24){var _0x3c03b8=function(_0x4c4357){while(--_0x4c4357){_0x78defc['push'](_0x78defc['shift']());}};_0x3c03b8(++_0x3cec24);}(_0xab76,0xf1));var _0x6ab7=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xab76[_0x6131cd];return _0x47e916;};'use strict';var Umzug=require(_0x6ab7('0x0'));var path=require(_0x6ab7('0x1'));var fs=require('fs');var _=require(_0x6ab7('0x2'));var pkginfo=require(_0x6ab7('0x3'))(module,'version');var compareVersions=require(_0x6ab7('0x4'));var exec=require('child_process')[_0x6ab7('0x5')];var db=require(_0x6ab7('0x6'))['db'];var config=require(_0x6ab7('0x7'));var pm2=require(_0x6ab7('0x8'));var logger=require(_0x6ab7('0x9'))(_0x6ab7('0xa'));var git=require(_0x6ab7('0xb'))(config['root']);exports[_0x6ab7('0xc')]=function(_0x359d7a,_0x2b7b1f){var _0x444325={'current':module['exports'][_0x6ab7('0xd')],'phonebar':0x2};if(_0x359d7a[_0x6ab7('0xe')]&&_0x359d7a[_0x6ab7('0xe')][_0x6ab7('0xf')]){return git[_0x6ab7('0x10')]()[_0x6ab7('0x11')](function(_0x4e2ff4,_0x36861e){_0x444325[_0x6ab7('0xf')]=(_0x4e2ff4?module[_0x6ab7('0x12')][_0x6ab7('0xd')]:_0x36861e[_0x6ab7('0xf')])||_0x6ab7('0x13');return _0x2b7b1f[_0x6ab7('0x14')](0xc8)[_0x6ab7('0x15')](_0x444325);});}else{return _0x2b7b1f['status'](0xc8)[_0x6ab7('0x15')](_0x444325);}};exports[_0x6ab7('0x10')]=function(_0x134c1a,_0x38b8a4){return git[_0x6ab7('0x10')]([_0x6ab7('0x16'),'master'],function(_0x302d7f){if(_0x302d7f){logger[_0x6ab7('0x17')](_0x302d7f);return _0x38b8a4['status'](0x1f4)[_0x6ab7('0x15')](_0x302d7f);}logger['info'](_0x6ab7('0x18'));return _0x38b8a4[_0x6ab7('0x14')](0xc8)[_0x6ab7('0x15')]({'output':_0x6ab7('0x19')});});};exports[_0x6ab7('0x1a')]=function(_0x234ab6,_0x121b66){return git[_0x6ab7('0x1a')](['--hard',_0x6ab7('0x1b')],function(_0x17085f){if(_0x17085f){logger[_0x6ab7('0x17')](_0x17085f);return _0x121b66[_0x6ab7('0x14')](0x1f4)['json'](_0x17085f);}logger[_0x6ab7('0x1c')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x121b66[_0x6ab7('0x14')](0xc8)[_0x6ab7('0x15')]({'output':_0x6ab7('0x1d')});});};exports[_0x6ab7('0x1e')]=function(_0x4a6fb3,_0x7fc352){exec(_0x6ab7('0x1f'),function(_0x58f8c4,_0x3ff003,_0x12b3c2){logger[_0x6ab7('0x1c')](_0x3ff003);logger[_0x6ab7('0x1c')](_0x12b3c2);if(_0x58f8c4){logger[_0x6ab7('0x17')](_0x58f8c4);return _0x7fc352[_0x6ab7('0x14')](0x1f4)['json'](_0x58f8c4);}return _0x7fc352[_0x6ab7('0x14')](0xc8)['json']({'output':_0x3ff003});});};exports[_0x6ab7('0x20')]=function(_0x37f2c2,_0x2e1270){return pm2[_0x6ab7('0x20')](_0x6ab7('0x21'))[_0x6ab7('0x22')](function(_0x14cd2b){logger[_0x6ab7('0x1c')](_0x6ab7('0x23'),_0x14cd2b);return _0x2e1270[_0x6ab7('0x14')](0xc8)[_0x6ab7('0x15')]({'output':_0x6ab7('0x24')});})[_0x6ab7('0x25')](function(_0x5289e8){logger[_0x6ab7('0x17')](_0x5289e8);return _0x2e1270[_0x6ab7('0x14')](0x1f4)['json'](_0x5289e8);});};exports[_0x6ab7('0x26')]=function(_0x578fe7,_0xed6537){var _0x35424f=fs[_0x6ab7('0x27')](path[_0x6ab7('0x28')](config['root'],_0x6ab7('0x29'),_0x6ab7('0x26')));var _0xabe40e=[];for(var _0x325883=0x0;_0x325883<_0x35424f[_0x6ab7('0x2a')];_0x325883++){var _0x580ef9=_0x35424f[_0x325883][_0x6ab7('0x2b')]('.js','');if(compareVersions(module[_0x6ab7('0x12')][_0x6ab7('0xd')],_0x580ef9)===-0x1){_0xabe40e[_0x6ab7('0x2c')](_0x580ef9);}}if(_0xabe40e[_0x6ab7('0x2a')]){var _0x563d25=_0xabe40e[_0x6ab7('0x2d')](compareVersions);var _0x4e986f=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x6ab7('0x2e')],'modelName':_0x6ab7('0x2e'),'columnName':'version'},'migrations':{'params':[db[_0x6ab7('0x2f')]['getQueryInterface'](),db[_0x6ab7('0x2f')]['constructor'],function(){throw new Error(_0x6ab7('0x30'));}],'path':path[_0x6ab7('0x28')](config[_0x6ab7('0x31')],_0x6ab7('0x29'),_0x6ab7('0x26')),'pattern':/\.js$/}});_0x4e986f['up']({'migrations':_[_0x6ab7('0x32')](_0x563d25,function(_0x38f3d6){return _0x38f3d6+_0x6ab7('0x33');})})['then'](function(){return _0xed6537[_0x6ab7('0x14')](0xc8)['json']({'output':_0x6ab7('0x34')+module[_0x6ab7('0x12')][_0x6ab7('0xd')]+_0x6ab7('0x35')+_[_0x6ab7('0x36')](_0x563d25),'migrations':_[_0x6ab7('0x28')](_0x563d25)});})[_0x6ab7('0x25')](function(_0x34a7d4){if(_0x34a7d4 instanceof db['sequelize'][_0x6ab7('0x37')]){return _0xed6537[_0x6ab7('0x14')](0xc8)[_0x6ab7('0x15')]({'output':'Database\x20already\x20up-to-date'});}else{return _0xed6537[_0x6ab7('0x14')](0x1f4)[_0x6ab7('0x15')](_0x34a7d4);}});}else{return _0xed6537[_0x6ab7('0x14')](0xc8)['json']({'output':_0x6ab7('0x38')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index af2c6b2..3581bf8 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 _0xf5af=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','post','put','/:id','update','delete','destroy','exports','util'];(function(_0x4872a9,_0x29b9cf){var _0x5df9e5=function(_0x2bc675){while(--_0x2bc675){_0x4872a9['push'](_0x4872a9['shift']());}};_0x5df9e5(++_0x29b9cf);}(_0xf5af,0x142));var _0xff5a=function(_0x310e94,_0x129456){_0x310e94=_0x310e94-0x0;var _0x5aa359=_0xf5af[_0x310e94];return _0x5aa359;};'use strict';var multer=require('multer');var util=require(_0xff5a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xff5a('0x1')]();var fs_extra=require(_0xff5a('0x2'));var auth=require(_0xff5a('0x3'));var interaction=require(_0xff5a('0x4'));var config=require(_0xff5a('0x5'));var controller=require(_0xff5a('0x6'));router[_0xff5a('0x7')]('/',auth[_0xff5a('0x8')](),controller[_0xff5a('0x9')]);router['get'](_0xff5a('0xa'),auth[_0xff5a('0x8')](),controller[_0xff5a('0xb')]);router[_0xff5a('0x7')]('/:id',auth[_0xff5a('0x8')](),controller['show']);router[_0xff5a('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xff5a('0xd')](_0xff5a('0xe'),auth[_0xff5a('0x8')](),controller[_0xff5a('0xf')]);router[_0xff5a('0x10')]('/:id',auth[_0xff5a('0x8')](),controller[_0xff5a('0x11')]);module[_0xff5a('0x12')]=router; \ No newline at end of file +var _0xfeaa=['./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x97bbb3,_0x55cf8f){var _0x58e9d9=function(_0x59ad4b){while(--_0x59ad4b){_0x97bbb3['push'](_0x97bbb3['shift']());}};_0x58e9d9(++_0x55cf8f);}(_0xfeaa,0x17d));var _0xafea=function(_0x57ddb3,_0x398941){_0x57ddb3=_0x57ddb3-0x0;var _0x240faf=_0xfeaa[_0x57ddb3];return _0x240faf;};'use strict';var multer=require(_0xafea('0x0'));var util=require(_0xafea('0x1'));var path=require(_0xafea('0x2'));var timeout=require(_0xafea('0x3'));var express=require(_0xafea('0x4'));var router=express[_0xafea('0x5')]();var fs_extra=require(_0xafea('0x6'));var auth=require(_0xafea('0x7'));var interaction=require(_0xafea('0x8'));var config=require(_0xafea('0x9'));var controller=require(_0xafea('0xa'));router[_0xafea('0xb')]('/',auth[_0xafea('0xc')](),controller[_0xafea('0xd')]);router[_0xafea('0xb')](_0xafea('0xe'),auth[_0xafea('0xc')](),controller[_0xafea('0xf')]);router[_0xafea('0xb')](_0xafea('0x10'),auth[_0xafea('0xc')](),controller[_0xafea('0x11')]);router[_0xafea('0x12')]('/',auth[_0xafea('0xc')](),controller['create']);router['put'](_0xafea('0x10'),auth[_0xafea('0xc')](),controller[_0xafea('0x13')]);router[_0xafea('0x14')](_0xafea('0x10'),auth[_0xafea('0xc')](),controller[_0xafea('0x15')]);module[_0xafea('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index fc5cca4..cb174c6 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 _0xd6f9=['BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x3eaa46,_0x23f4cf){var _0x2c1471=function(_0x58e404){while(--_0x58e404){_0x3eaa46['push'](_0x3eaa46['shift']());}};_0x2c1471(++_0x23f4cf);}(_0xd6f9,0x1ca));var _0x9d6f=function(_0x4aac5a,_0x15b04c){_0x4aac5a=_0x4aac5a-0x0;var _0x42e7bc=_0xd6f9[_0x4aac5a];return _0x42e7bc;};'use strict';var Sequelize=require(_0x9d6f('0x0'));module[_0x9d6f('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x9d6f('0x2')]},'calleridname':{'type':Sequelize[_0x9d6f('0x2')]},'queue':{'type':Sequelize[_0x9d6f('0x2')]},'interface':{'type':Sequelize[_0x9d6f('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x9d6f('0x3')]},'agentconnectAt':{'type':Sequelize[_0x9d6f('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x9d6f('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x9d6f('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x9d6f('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x9d6f('0x5')]},'agentacw':{'type':Sequelize[_0x9d6f('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9d6f('0x5')]},'reason':{'type':Sequelize[_0x9d6f('0x2')]},'lastevent':{'type':Sequelize[_0x9d6f('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x9d6f('0x2')]},'connectedlinename':{'type':Sequelize[_0x9d6f('0x2')]},'language':{'type':Sequelize[_0x9d6f('0x2')]},'accountcode':{'type':Sequelize[_0x9d6f('0x2')]},'context':{'type':Sequelize[_0x9d6f('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x9d6f('0x2')]},'destchannel':{'type':Sequelize[_0x9d6f('0x2')]},'destchannelstate':{'type':Sequelize[_0x9d6f('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x9d6f('0x2')]},'destcalleridnum':{'type':Sequelize[_0x9d6f('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x9d6f('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x9d6f('0x2')]},'destlanguage':{'type':Sequelize[_0x9d6f('0x2')]},'destaccountcode':{'type':Sequelize[_0x9d6f('0x2')]},'destcontext':{'type':Sequelize[_0x9d6f('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x9d6f('0x2')]},'destuniqueid':{'type':Sequelize[_0x9d6f('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x9d6f('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x9d6f('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9d6f('0x2')],'comment':_0x9d6f('0x6')},'transferexten':{'type':Sequelize[_0x9d6f('0x2')]},'transferuniqueid':{'type':Sequelize[_0x9d6f('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8374=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x3c27b6,_0x2192cb){var _0x2a5f55=function(_0x4d8700){while(--_0x4d8700){_0x3c27b6['push'](_0x3c27b6['shift']());}};_0x2a5f55(++_0x2192cb);}(_0x8374,0x174));var _0x4837=function(_0x4bda35,_0x1a370e){_0x4bda35=_0x4bda35-0x0;var _0x5cfb25=_0x8374[_0x4bda35];return _0x5cfb25;};'use strict';var Sequelize=require(_0x4837('0x0'));module[_0x4837('0x1')]={'type':{'type':Sequelize[_0x4837('0x2')]},'uniqueid':{'type':Sequelize[_0x4837('0x2')]},'calleridnum':{'type':Sequelize[_0x4837('0x2')]},'calleridname':{'type':Sequelize[_0x4837('0x2')]},'queue':{'type':Sequelize[_0x4837('0x2')]},'interface':{'type':Sequelize[_0x4837('0x2')]},'membername':{'type':Sequelize[_0x4837('0x2')]},'agentcalledAt':{'type':Sequelize[_0x4837('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4837('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x4837('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x4837('0x3')]},'agentdumpAt':{'type':Sequelize[_0x4837('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x4837('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4837('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4837('0x5')]},'agentacw':{'type':Sequelize[_0x4837('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4837('0x5')]},'reason':{'type':Sequelize[_0x4837('0x2')]},'lastevent':{'type':Sequelize[_0x4837('0x2')]},'channel':{'type':Sequelize[_0x4837('0x2')]},'channelstate':{'type':Sequelize[_0x4837('0x5')]},'channelstatedesc':{'type':Sequelize[_0x4837('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4837('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4837('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4837('0x2')]},'priority':{'type':Sequelize[_0x4837('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x4837('0x2')]},'destcalleridname':{'type':Sequelize[_0x4837('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x4837('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4837('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x4837('0x2')]},'destcontext':{'type':Sequelize[_0x4837('0x2')]},'destexten':{'type':Sequelize[_0x4837('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x4837('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4837('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x4837('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4837('0x2')],'comment':_0x4837('0x6')},'transferexten':{'type':Sequelize[_0x4837('0x2')]},'transferuniqueid':{'type':Sequelize[_0x4837('0x2')]},'agententerreason':{'type':Sequelize[_0x4837('0x5')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 05082a4..2cde310 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(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 7c1b1ad..8405ad7 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 _0xf69d=['report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport'];(function(_0x47e7dd,_0x51b041){var _0x38501f=function(_0x5ba66d){while(--_0x5ba66d){_0x47e7dd['push'](_0x47e7dd['shift']());}};_0x38501f(++_0x51b041);}(_0xf69d,0xd3));var _0xdf69=function(_0x4bd44f,_0x2b3e1e){_0x4bd44f=_0x4bd44f-0x0;var _0x203aa2=_0xf69d[_0x4bd44f];return _0x203aa2;};'use strict';var _=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var logger=require(_0xdf69('0x2'))(_0xdf69('0x3'));var moment=require(_0xdf69('0x4'));var BPromise=require('bluebird');var rp=require(_0xdf69('0x5'));var fs=require('fs');var path=require(_0xdf69('0x6'));var rimraf=require(_0xdf69('0x7'));var config=require(_0xdf69('0x8'));var attributes=require(_0xdf69('0x9'));module[_0xdf69('0xa')]=function(_0x2d456f,_0x465b1b){return _0x2d456f[_0xdf69('0xb')](_0xdf69('0xc'),attributes,{'tableName':_0xdf69('0xd'),'paranoid':![],'indexes':[{'fields':[_0xdf69('0xe'),_0xdf69('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5455=['define','VoiceAgentReport','uniqueid','destuniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceAgentReport.attributes','exports'];(function(_0x5a2744,_0x53f4cd){var _0x519f7a=function(_0x5d9aa2){while(--_0x5d9aa2){_0x5a2744['push'](_0x5a2744['shift']());}};_0x519f7a(++_0x53f4cd);}(_0x5455,0x197));var _0x5545=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5455[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x5545('0x0'));var logger=require(_0x5545('0x1'))(_0x5545('0x2'));var moment=require(_0x5545('0x3'));var BPromise=require(_0x5545('0x4'));var rp=require(_0x5545('0x5'));var fs=require('fs');var path=require(_0x5545('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5545('0x7'));module[_0x5545('0x8')]=function(_0x5c22f1,_0x5a6ac7){return _0x5c22f1[_0x5545('0x9')](_0x5545('0xa'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x5545('0xb'),_0x5545('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 aa4f370..30ad0dd 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 _0x0b58=['UpdateVoiceAgentReport','VoiceAgentReport','update','limit','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceAgentReport','create','body','options','raw'];(function(_0x4692d7,_0x448d8e){var _0x26657a=function(_0x15ac86){while(--_0x15ac86){_0x4692d7['push'](_0x4692d7['shift']());}};_0x26657a(++_0x448d8e);}(_0x0b58,0x1f2));var _0x80b5=function(_0x488ca1,_0xf6858e){_0x488ca1=_0x488ca1-0x0;var _0x4dd0a4=_0x0b58[_0x488ca1];return _0x4dd0a4;};'use strict';var _=require(_0x80b5('0x0'));var util=require(_0x80b5('0x1'));var moment=require(_0x80b5('0x2'));var BPromise=require('bluebird');var rs=require(_0x80b5('0x3'));var fs=require('fs');var Redis=require(_0x80b5('0x4'));var db=require(_0x80b5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x80b5('0x6'))(_0x80b5('0x7'));var config=require('../../config/environment');var jayson=require(_0x80b5('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d649c,_0x3d9b7e,_0x4c878b){return new BPromise(function(_0x2a6706,_0x5169ca){return client['request'](_0x4d649c,_0x4c878b)[_0x80b5('0x9')](function(_0x3b4f2b){logger[_0x80b5('0xa')](_0x80b5('0xb'),_0x3d9b7e,_0x80b5('0xc'));logger['debug'](_0x80b5('0xd'),_0x3d9b7e,_0x80b5('0xc'),JSON[_0x80b5('0xe')](_0x3b4f2b));if(_0x3b4f2b[_0x80b5('0xf')]){if(_0x3b4f2b[_0x80b5('0xf')][_0x80b5('0x10')]===0x1f4){logger[_0x80b5('0xf')](_0x80b5('0xb'),_0x3d9b7e,_0x3b4f2b[_0x80b5('0xf')][_0x80b5('0x11')]);return _0x5169ca(_0x3b4f2b[_0x80b5('0xf')][_0x80b5('0x11')]);}logger[_0x80b5('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x3d9b7e,_0x3b4f2b[_0x80b5('0xf')][_0x80b5('0x11')]);return _0x2a6706(_0x3b4f2b[_0x80b5('0xf')][_0x80b5('0x11')]);}else{logger[_0x80b5('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0x3d9b7e,_0x80b5('0xc'));_0x2a6706(_0x3b4f2b['result'][_0x80b5('0x11')]);}})[_0x80b5('0x12')](function(_0x53e646){logger[_0x80b5('0xf')](_0x80b5('0xb'),_0x3d9b7e,_0x53e646);_0x5169ca(_0x53e646);});});}exports[_0x80b5('0x13')]=function(_0x522919){var _0x580a40=this;return new Promise(function(_0x56af7c,_0x5dd6e5){return db['VoiceAgentReport'][_0x80b5('0x14')](_0x522919[_0x80b5('0x15')],{'raw':_0x522919['options']?_0x522919[_0x80b5('0x16')][_0x80b5('0x17')]===undefined?!![]:![]:!![]})[_0x80b5('0x9')](function(_0x47aa4a){logger[_0x80b5('0xa')](_0x80b5('0x13'),_0x522919);logger['debug']('CreateVoiceAgentReport',_0x522919,JSON[_0x80b5('0xe')](_0x47aa4a));_0x56af7c(_0x47aa4a);})[_0x80b5('0x12')](function(_0x143b39){logger[_0x80b5('0xf')](_0x80b5('0x13'),_0x143b39[_0x80b5('0x11')],_0x522919);_0x5dd6e5(_0x580a40[_0x80b5('0xf')](0x1f4,_0x143b39[_0x80b5('0x11')]));});});};exports[_0x80b5('0x18')]=function(_0x1cba0b){var _0x5a7589=this;return new Promise(function(_0x412e09,_0x106ac9){return db[_0x80b5('0x19')][_0x80b5('0x1a')](_0x1cba0b[_0x80b5('0x15')],{'raw':_0x1cba0b[_0x80b5('0x16')]?_0x1cba0b[_0x80b5('0x16')][_0x80b5('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cba0b[_0x80b5('0x16')]?_0x1cba0b[_0x80b5('0x16')]['where']||null:null,'attributes':_0x1cba0b['options']?_0x1cba0b[_0x80b5('0x16')]['attributes']||null:null,'limit':_0x1cba0b['options']?_0x1cba0b[_0x80b5('0x16')][_0x80b5('0x1b')]||null:null})['then'](function(_0x16452d){logger['info']('UpdateVoiceAgentReport',_0x1cba0b);logger[_0x80b5('0x1c')](_0x80b5('0x18'),_0x1cba0b,JSON['stringify'](_0x16452d));_0x412e09(_0x16452d);})[_0x80b5('0x12')](function(_0x4884c9){logger[_0x80b5('0xf')](_0x80b5('0x18'),_0x4884c9[_0x80b5('0x11')],_0x1cba0b);_0x106ac9(_0x5a7589[_0x80b5('0xf')](0x1f4,_0x4884c9[_0x80b5('0x11')]));});});}; \ No newline at end of file +var _0x64d4=['request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','debug','UpdateVoiceAgentReport','update','body','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x33f135,_0x35b352){var _0x23bb2f=function(_0x109e1f){while(--_0x109e1f){_0x33f135['push'](_0x33f135['shift']());}};_0x23bb2f(++_0x35b352);}(_0x64d4,0x197));var _0x464d=function(_0x11db68,_0x4f0351){_0x11db68=_0x11db68-0x0;var _0xcd8a93=_0x64d4[_0x11db68];return _0xcd8a93;};'use strict';var _=require(_0x464d('0x0'));var util=require(_0x464d('0x1'));var moment=require(_0x464d('0x2'));var BPromise=require(_0x464d('0x3'));var rs=require(_0x464d('0x4'));var fs=require('fs');var Redis=require(_0x464d('0x5'));var db=require(_0x464d('0x6'))['db'];var utils=require(_0x464d('0x7'));var logger=require(_0x464d('0x8'))(_0x464d('0x9'));var config=require(_0x464d('0xa'));var jayson=require(_0x464d('0xb'));var client=jayson[_0x464d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bb8d3,_0x3b38ae,_0x4589d4){return new BPromise(function(_0x43dbc2,_0x55282f){return client[_0x464d('0xd')](_0x1bb8d3,_0x4589d4)[_0x464d('0xe')](function(_0xbe766c){logger[_0x464d('0xf')](_0x464d('0x10'),_0x3b38ae,_0x464d('0x11'));logger['debug'](_0x464d('0x12'),_0x3b38ae,_0x464d('0x11'),JSON[_0x464d('0x13')](_0xbe766c));if(_0xbe766c[_0x464d('0x14')]){if(_0xbe766c[_0x464d('0x14')]['code']===0x1f4){logger[_0x464d('0x14')](_0x464d('0x10'),_0x3b38ae,_0xbe766c['error'][_0x464d('0x15')]);return _0x55282f(_0xbe766c[_0x464d('0x14')][_0x464d('0x15')]);}logger[_0x464d('0x14')](_0x464d('0x10'),_0x3b38ae,_0xbe766c['error'][_0x464d('0x15')]);return _0x43dbc2(_0xbe766c[_0x464d('0x14')][_0x464d('0x15')]);}else{logger[_0x464d('0xf')](_0x464d('0x10'),_0x3b38ae,_0x464d('0x11'));_0x43dbc2(_0xbe766c[_0x464d('0x16')][_0x464d('0x15')]);}})[_0x464d('0x17')](function(_0x2a9d98){logger[_0x464d('0x14')](_0x464d('0x10'),_0x3b38ae,_0x2a9d98);_0x55282f(_0x2a9d98);});});}exports[_0x464d('0x18')]=function(_0x25e8f7){var _0x2616d8=this;return new Promise(function(_0x3003fc,_0x5b52d7){return db[_0x464d('0x19')][_0x464d('0x1a')](_0x25e8f7['body'],{'raw':_0x25e8f7[_0x464d('0x1b')]?_0x25e8f7[_0x464d('0x1b')][_0x464d('0x1c')]===undefined?!![]:![]:!![]})[_0x464d('0xe')](function(_0x2222b5){logger['info'](_0x464d('0x18'),_0x25e8f7);logger[_0x464d('0x1d')]('CreateVoiceAgentReport',_0x25e8f7,JSON['stringify'](_0x2222b5));_0x3003fc(_0x2222b5);})[_0x464d('0x17')](function(_0x5dcbf0){logger[_0x464d('0x14')](_0x464d('0x18'),_0x5dcbf0[_0x464d('0x15')],_0x25e8f7);_0x5b52d7(_0x2616d8[_0x464d('0x14')](0x1f4,_0x5dcbf0[_0x464d('0x15')]));});});};exports[_0x464d('0x1e')]=function(_0x1b0eb4){var _0x52e90e=this;return new Promise(function(_0xfe6c12,_0x4df24f){return db['VoiceAgentReport'][_0x464d('0x1f')](_0x1b0eb4[_0x464d('0x20')],{'raw':_0x1b0eb4[_0x464d('0x1b')]?_0x1b0eb4[_0x464d('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b0eb4['options']?_0x1b0eb4[_0x464d('0x1b')][_0x464d('0x21')]||null:null,'attributes':_0x1b0eb4[_0x464d('0x1b')]?_0x1b0eb4[_0x464d('0x1b')][_0x464d('0x22')]||null:null,'limit':_0x1b0eb4[_0x464d('0x1b')]?_0x1b0eb4[_0x464d('0x1b')]['limit']||null:null})[_0x464d('0xe')](function(_0x5ad914){logger[_0x464d('0xf')]('UpdateVoiceAgentReport',_0x1b0eb4);logger[_0x464d('0x1d')](_0x464d('0x1e'),_0x1b0eb4,JSON[_0x464d('0x13')](_0x5ad914));_0xfe6c12(_0x5ad914);})[_0x464d('0x17')](function(_0x5976da){logger[_0x464d('0x14')](_0x464d('0x1e'),_0x5976da['message'],_0x1b0eb4);_0x4df24f(_0x52e90e[_0x464d('0x14')](0x1f4,_0x5976da[_0x464d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 5a8d3fa..ec35496 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 _0x0e69=['delete','destroy','exports','express','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put'];(function(_0xff9523,_0x159854){var _0x639261=function(_0x5a397b){while(--_0x5a397b){_0xff9523['push'](_0xff9523['shift']());}};_0x639261(++_0x159854);}(_0x0e69,0x1f2));var _0x90e6=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x0e69[_0x47e7cb];return _0x2a8874;};'use strict';var express=require(_0x90e6('0x0'));var router=express[_0x90e6('0x1')]();var auth=require(_0x90e6('0x2'));var controller=require(_0x90e6('0x3'));router[_0x90e6('0x4')]('/',auth[_0x90e6('0x5')](),controller[_0x90e6('0x6')]);router[_0x90e6('0x4')]('/describe',auth[_0x90e6('0x5')](),controller[_0x90e6('0x7')]);router['get'](_0x90e6('0x8'),auth[_0x90e6('0x5')](),controller[_0x90e6('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x90e6('0xa')]);router[_0x90e6('0xb')]('/:id',auth[_0x90e6('0x5')](),controller['update']);router[_0x90e6('0xb')]('/with-retry/:id',auth[_0x90e6('0x5')](),controller['updateWithRetry']);router[_0x90e6('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x90e6('0xd')]);module[_0x90e6('0xe')]=router; \ No newline at end of file +var _0x4601=['./voiceCallReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','/with-retry/:id','updateWithRetry','delete','destroy','Router','../../components/auth/service'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x4601,0x1a7));var _0x1460=function(_0x3e7681,_0x394857){_0x3e7681=_0x3e7681-0x0;var _0x43995a=_0x4601[_0x3e7681];return _0x43995a;};'use strict';var express=require('express');var router=express[_0x1460('0x0')]();var auth=require(_0x1460('0x1'));var controller=require(_0x1460('0x2'));router[_0x1460('0x3')]('/',auth['isAuthenticated'](),controller[_0x1460('0x4')]);router[_0x1460('0x3')](_0x1460('0x5'),auth[_0x1460('0x6')](),controller[_0x1460('0x7')]);router[_0x1460('0x3')](_0x1460('0x8'),auth[_0x1460('0x6')](),controller[_0x1460('0x9')]);router['post']('/',auth[_0x1460('0x6')](),controller[_0x1460('0xa')]);router[_0x1460('0xb')](_0x1460('0x8'),auth[_0x1460('0x6')](),controller[_0x1460('0xc')]);router[_0x1460('0xb')](_0x1460('0xd'),auth[_0x1460('0x6')](),controller[_0x1460('0xe')]);router[_0x1460('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x1460('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index dec5e07..d9f41f3 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 _0x21ad=['ENUM','inbound','outbound','dialer','TEXT','DATE','INTEGER','sequelize','STRING'];(function(_0x36b745,_0x1c0cee){var _0x2317aa=function(_0xa75156){while(--_0xa75156){_0x36b745['push'](_0x36b745['shift']());}};_0x2317aa(++_0x1c0cee);}(_0x21ad,0x85));var _0xd21a=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x21ad[_0x40bffc];return _0x3007e9;};'use strict';var Sequelize=require(_0xd21a('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xd21a('0x1')]},'type':{'type':Sequelize[_0xd21a('0x2')](_0xd21a('0x3'),'internal',_0xd21a('0x4'),'inbound-fax','outbound-fax',_0xd21a('0x5'))},'tag':{'type':Sequelize[_0xd21a('0x1')]},'accountcode':{'type':Sequelize[_0xd21a('0x1')]},'source':{'type':Sequelize[_0xd21a('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xd21a('0x1')]},'callerid':{'type':Sequelize[_0xd21a('0x1')]},'channel':{'type':Sequelize[_0xd21a('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0xd21a('0x1')]},'lastdata':{'type':Sequelize[_0xd21a('0x6')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xd21a('0x7')]},'answertime':{'type':Sequelize[_0xd21a('0x7')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xd21a('0x8')]},'billableseconds':{'type':Sequelize[_0xd21a('0x8')]},'mohtime':{'type':Sequelize[_0xd21a('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd21a('0x1')]},'amaflags':{'type':Sequelize[_0xd21a('0x1')]},'userfield':{'type':Sequelize[_0xd21a('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xd21a('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xd21a('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xd21a('0x1')]},'routeid':{'type':Sequelize[_0xd21a('0x8')]},'sipcallid':{'type':Sequelize[_0xd21a('0x1')]}}; \ No newline at end of file +var _0xfe13=['ENUM','inbound','internal','outbound','inbound-fax','DATE','INTEGER','sequelize','STRING'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xfe13,0x178));var _0x3fe1=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0xfe13[_0x43f881];return _0x365c14;};'use strict';var Sequelize=require(_0x3fe1('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x3fe1('0x1')]},'type':{'type':Sequelize[_0x3fe1('0x2')](_0x3fe1('0x3'),_0x3fe1('0x4'),_0x3fe1('0x5'),_0x3fe1('0x6'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0x3fe1('0x1')]},'accountcode':{'type':Sequelize[_0x3fe1('0x1')]},'source':{'type':Sequelize[_0x3fe1('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x3fe1('0x1')]},'callerid':{'type':Sequelize[_0x3fe1('0x1')]},'channel':{'type':Sequelize[_0x3fe1('0x1')]},'destinationchannel':{'type':Sequelize[_0x3fe1('0x1')]},'lastapplication':{'type':Sequelize[_0x3fe1('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x3fe1('0x7')]},'answertime':{'type':Sequelize[_0x3fe1('0x7')]},'endtime':{'type':Sequelize[_0x3fe1('0x7')]},'duration':{'type':Sequelize[_0x3fe1('0x8')]},'billableseconds':{'type':Sequelize[_0x3fe1('0x8')]},'mohtime':{'type':Sequelize[_0x3fe1('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3fe1('0x1')]},'amaflags':{'type':Sequelize[_0x3fe1('0x1')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x3fe1('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x3fe1('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x3fe1('0x1')]},'note':{'type':Sequelize[_0x3fe1('0x1')]},'prefix':{'type':Sequelize[_0x3fe1('0x1')]},'routeid':{'type':Sequelize[_0x3fe1('0x8')]},'sipcallid':{'type':Sequelize[_0x3fe1('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index b6542d1..8942b4b 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 _0xc1c6=['merge','options','includeAll','include','alias','User','findAll','rows','catch','show','params','find','create','body','describe','user','uniqueid','updateWithRetry','No\x20such\x20report','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','offset','undefined','limit','count','status','set','Content-Range','update','destroy','then','end','sendStatus','error','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x275e9f,_0x13416e){_0x275e9f=_0x275e9f-0x0;var _0x4108ad=_0xc1c6[_0x275e9f];return _0x4108ad;};'use strict';var _=require(_0x6c1c('0x0'));var qs=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var db=require(_0x6c1c('0x3'))['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x426398,_0x40ff59){_0x40ff59=_0x40ff59||0xc8;return function(_0x265d2c){if(_0x265d2c){return _0x426398['status'](_0x40ff59)['json'](_0x265d2c);}};}function respondWithFilteredResult(_0x32af84,_0x524a6b){return function(_0x50c1bb){if(_0x50c1bb){var _0x582bec=typeof _0x524a6b[_0x6c1c('0x4')]===_0x6c1c('0x5')&&typeof _0x524a6b[_0x6c1c('0x6')]===_0x6c1c('0x5');var _0x4b66ec=_0x50c1bb[_0x6c1c('0x7')];var _0x3ca985=_0x582bec?0x0:_0x524a6b['offset'];var _0x147c7b=_0x582bec?_0x50c1bb[_0x6c1c('0x7')]:_0x524a6b[_0x6c1c('0x4')]+_0x524a6b[_0x6c1c('0x6')];var _0x49fb01;if(_0x147c7b>=_0x4b66ec){_0x147c7b=_0x4b66ec;_0x49fb01=0xc8;}else{_0x49fb01=0xce;}_0x32af84[_0x6c1c('0x8')](_0x49fb01);return _0x32af84[_0x6c1c('0x9')](_0x6c1c('0xa'),_0x3ca985+'-'+_0x147c7b+'/'+_0x4b66ec)['json'](_0x50c1bb);}return null;};}function saveUpdates(_0x412717){return function(_0x12a9e6){if(_0x12a9e6){return _0x12a9e6[_0x6c1c('0xb')](_0x412717)['then'](function(_0x2e82e9){return _0x2e82e9;});}return null;};}function removeEntity(_0x5e64b7){return function(_0x357370){if(_0x357370){return _0x357370[_0x6c1c('0xc')]()[_0x6c1c('0xd')](function(){_0x5e64b7[_0x6c1c('0x8')](0xcc)[_0x6c1c('0xe')]();});}};}function handleEntityNotFound(_0x3f532c){return function(_0x297c33){if(!_0x297c33){_0x3f532c[_0x6c1c('0xf')](0x194);}return _0x297c33;};}function handleError(_0x448f35,_0x5f3758){_0x5f3758=_0x5f3758||0x1f4;return function(_0x3df1b7){logger[_0x6c1c('0x10')](_0x3df1b7['stack']);if(_0x3df1b7[_0x6c1c('0x11')]){delete _0x3df1b7[_0x6c1c('0x11')];}_0x448f35['status'](_0x5f3758)[_0x6c1c('0x12')](_0x3df1b7);};}exports['index']=function(_0x338dc2,_0x1a0ab9){var _0x5a3bb7={},_0xa667eb={},_0x59ab38={'count':0x0,'rows':[]};var _0x2db60e=_[_0x6c1c('0x13')](db[_0x6c1c('0x14')][_0x6c1c('0x15')],function(_0x1acf7f){return{'name':_0x1acf7f[_0x6c1c('0x16')],'type':_0x1acf7f[_0x6c1c('0x17')][_0x6c1c('0x18')]};});_0xa667eb[_0x6c1c('0x19')]=_[_0x6c1c('0x13')](_0x2db60e,_0x6c1c('0x11'));_0xa667eb[_0x6c1c('0x1a')]=_[_0x6c1c('0x1b')](_0x338dc2[_0x6c1c('0x1a')]);_0xa667eb[_0x6c1c('0x1c')]=_[_0x6c1c('0x1d')](_0xa667eb[_0x6c1c('0x19')],_0xa667eb[_0x6c1c('0x1a')]);_0x5a3bb7[_0x6c1c('0x1e')]=_[_0x6c1c('0x1d')](_0xa667eb[_0x6c1c('0x19')],qs[_0x6c1c('0x1f')](_0x338dc2[_0x6c1c('0x1a')][_0x6c1c('0x1f')]));_0x5a3bb7[_0x6c1c('0x1e')]=_0x5a3bb7[_0x6c1c('0x1e')][_0x6c1c('0x20')]?_0x5a3bb7[_0x6c1c('0x1e')]:_0xa667eb[_0x6c1c('0x19')];if(!_0x338dc2['query'][_0x6c1c('0x21')]('nolimit')){_0x5a3bb7[_0x6c1c('0x6')]=qs['limit'](_0x338dc2[_0x6c1c('0x1a')]['limit']);_0x5a3bb7[_0x6c1c('0x4')]=qs[_0x6c1c('0x4')](_0x338dc2['query'][_0x6c1c('0x4')]);}_0x5a3bb7[_0x6c1c('0x22')]=qs['sort'](_0x338dc2[_0x6c1c('0x1a')][_0x6c1c('0x23')]);_0x5a3bb7[_0x6c1c('0x24')]=qs[_0x6c1c('0x1c')](_['pick'](_0x338dc2['query'],_0xa667eb[_0x6c1c('0x1c')]),_0x2db60e);if(_0x338dc2[_0x6c1c('0x1a')][_0x6c1c('0x25')]){_0x5a3bb7[_0x6c1c('0x24')]=_[_0x6c1c('0x26')](_0x5a3bb7[_0x6c1c('0x24')],{'$or':_['map'](_0x2db60e,function(_0x348757){if(_0x348757[_0x6c1c('0x17')]!=='VIRTUAL'){var _0x1b371d={};_0x1b371d[_0x348757[_0x6c1c('0x11')]]={'$like':'%'+_0x338dc2[_0x6c1c('0x1a')][_0x6c1c('0x25')]+'%'};return _0x1b371d;}})});}_0x5a3bb7=_['merge']({},_0x5a3bb7,_0x338dc2[_0x6c1c('0x27')]);var _0x347aff={'where':_0x5a3bb7[_0x6c1c('0x24')]};return db['VoiceCallReport'][_0x6c1c('0x7')](_0x347aff)['then'](function(_0x6870a4){_0x59ab38['count']=_0x6870a4;if(_0x338dc2[_0x6c1c('0x1a')][_0x6c1c('0x28')]){_0x5a3bb7[_0x6c1c('0x29')]=[{'attributes':['id','name','fullname',_0x6c1c('0x2a')],'model':db[_0x6c1c('0x2b')],'as':_0x6c1c('0x2b')}];}return db['VoiceCallReport'][_0x6c1c('0x2c')](_0x5a3bb7);})['then'](function(_0x5ba362){_0x59ab38[_0x6c1c('0x2d')]=_0x5ba362;return _0x59ab38;})[_0x6c1c('0xd')](respondWithFilteredResult(_0x1a0ab9,_0x5a3bb7))[_0x6c1c('0x2e')](handleError(_0x1a0ab9,null));};exports[_0x6c1c('0x2f')]=function(_0x4bed10,_0x9da66e){var _0xb7c684={'raw':!![],'where':{'id':_0x4bed10[_0x6c1c('0x30')]['id']}},_0x387d62={};_0x387d62[_0x6c1c('0x19')]=_[_0x6c1c('0x1b')](db[_0x6c1c('0x14')][_0x6c1c('0x15')]);_0x387d62[_0x6c1c('0x1a')]=_[_0x6c1c('0x1b')](_0x4bed10['query']);_0x387d62[_0x6c1c('0x1c')]=_[_0x6c1c('0x1d')](_0x387d62[_0x6c1c('0x19')],_0x387d62[_0x6c1c('0x1a')]);_0xb7c684[_0x6c1c('0x1e')]=_['intersection'](_0x387d62['model'],qs['fields'](_0x4bed10[_0x6c1c('0x1a')]['fields']));_0xb7c684['attributes']=_0xb7c684[_0x6c1c('0x1e')][_0x6c1c('0x20')]?_0xb7c684['attributes']:_0x387d62[_0x6c1c('0x19')];if(_0x4bed10[_0x6c1c('0x1a')][_0x6c1c('0x28')]){_0xb7c684['include']=[{'all':!![]}];}_0xb7c684=_[_0x6c1c('0x26')]({},_0xb7c684,_0x4bed10[_0x6c1c('0x27')]);return db['VoiceCallReport'][_0x6c1c('0x31')](_0xb7c684)['then'](handleEntityNotFound(_0x9da66e,null))[_0x6c1c('0xd')](respondWithResult(_0x9da66e,null))[_0x6c1c('0x2e')](handleError(_0x9da66e,null));};exports[_0x6c1c('0x32')]=function(_0x174f2c,_0x10764a){return db['VoiceCallReport'][_0x6c1c('0x32')](_0x174f2c[_0x6c1c('0x33')],{})[_0x6c1c('0xd')](respondWithResult(_0x10764a,0xc9))['catch'](handleError(_0x10764a,null));};exports[_0x6c1c('0xc')]=function(_0x52866c,_0x28d141){return db[_0x6c1c('0x14')][_0x6c1c('0x31')]({'where':{'id':_0x52866c['params']['id']}})[_0x6c1c('0xd')](handleEntityNotFound(_0x28d141,null))['then'](removeEntity(_0x28d141,null))['catch'](handleError(_0x28d141,null));};exports['describe']=function(_0x45d732,_0x26710c){return db[_0x6c1c('0x14')][_0x6c1c('0x34')]()[_0x6c1c('0xd')](respondWithResult(_0x26710c,null))[_0x6c1c('0x2e')](handleError(_0x26710c,null));};function findForUpdate(_0x260363){return db[_0x6c1c('0x14')]['find']({'where':{'uniqueid':_0x260363[_0x6c1c('0x30')]['id'],'UserId':{'$or':[null,_0x260363[_0x6c1c('0x35')]['id']]}}});}exports['update']=function(_0x2b4706,_0x5518f6){if(_0x2b4706[_0x6c1c('0x33')][_0x6c1c('0x36')]){delete _0x2b4706[_0x6c1c('0x33')][_0x6c1c('0x36')];}return findForUpdate(_0x2b4706)[_0x6c1c('0xd')](handleEntityNotFound(_0x5518f6,null))['then'](saveUpdates(_0x2b4706[_0x6c1c('0x33')],null))['then'](respondWithResult(_0x5518f6,null))[_0x6c1c('0x2e')](handleError(_0x5518f6,null));};exports[_0x6c1c('0x37')]=function(_0x2f6ce0,_0xa06377,_0x8d614){if(_0x2f6ce0[_0x6c1c('0x33')]['uniqueid']){delete _0x2f6ce0[_0x6c1c('0x33')][_0x6c1c('0x36')];}promiseRetry(function(_0x4b7014){return findForUpdate(_0x2f6ce0)[_0x6c1c('0xd')](function(_0x201e66){if(_0x201e66!==null){return _0x201e66;}else{_0x4b7014(new Error(_0x6c1c('0x38')));}});},{'retries':0x4,'minTimeout':0xfa})[_0x6c1c('0xd')](function(_0x5badb4){if(!_0x5badb4){return new Promise(function(_0x154f02){_0x154f02(handleEntityNotFound(_0xa06377)());});}else{return _0x5badb4[_0x6c1c('0xb')](_0x2f6ce0[_0x6c1c('0x33')])['then'](function(_0x5b8d69){return respondWithResult(_0xa06377)(_0x5b8d69);});}},function(){handleEntityNotFound(_0xa06377)();});}; \ No newline at end of file +var _0x33af=['../../components/parsers/qs','api','../../mysqldb','promise-retry','json','offset','undefined','limit','count','status','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','fullname','User','findAll','rows','show','params','include','find','catch','create','body','describe','user','uniqueid','updateWithRetry','No\x20such\x20report'];(function(_0x5a4293,_0x52e4eb){var _0xe1b2ab=function(_0x56d341){while(--_0x56d341){_0x5a4293['push'](_0x5a4293['shift']());}};_0xe1b2ab(++_0x52e4eb);}(_0x33af,0xec));var _0xf33a=function(_0x46fdbb,_0x217295){_0x46fdbb=_0x46fdbb-0x0;var _0x219d7e=_0x33af[_0x46fdbb];return _0x219d7e;};'use strict';var _=require('lodash');var qs=require(_0xf33a('0x0'));var logger=require('../../config/logger')(_0xf33a('0x1'));var db=require(_0xf33a('0x2'))['db'];const promiseRetry=require(_0xf33a('0x3'));function respondWithResult(_0x4303f1,_0x169f02){_0x169f02=_0x169f02||0xc8;return function(_0x25f156){if(_0x25f156){return _0x4303f1['status'](_0x169f02)[_0xf33a('0x4')](_0x25f156);}};}function respondWithFilteredResult(_0x44cfa5,_0x583e54){return function(_0xc0dd13){if(_0xc0dd13){var _0x384b14=typeof _0x583e54[_0xf33a('0x5')]===_0xf33a('0x6')&&typeof _0x583e54[_0xf33a('0x7')]===_0xf33a('0x6');var _0x52517f=_0xc0dd13[_0xf33a('0x8')];var _0x14eb0e=_0x384b14?0x0:_0x583e54[_0xf33a('0x5')];var _0x457b3b=_0x384b14?_0xc0dd13[_0xf33a('0x8')]:_0x583e54[_0xf33a('0x5')]+_0x583e54['limit'];var _0x4ea282;if(_0x457b3b>=_0x52517f){_0x457b3b=_0x52517f;_0x4ea282=0xc8;}else{_0x4ea282=0xce;}_0x44cfa5[_0xf33a('0x9')](_0x4ea282);return _0x44cfa5[_0xf33a('0xa')](_0xf33a('0xb'),_0x14eb0e+'-'+_0x457b3b+'/'+_0x52517f)[_0xf33a('0x4')](_0xc0dd13);}return null;};}function saveUpdates(_0x338d1b){return function(_0x5959c9){if(_0x5959c9){return _0x5959c9[_0xf33a('0xc')](_0x338d1b)[_0xf33a('0xd')](function(_0x549978){return _0x549978;});}return null;};}function removeEntity(_0x506924){return function(_0x374b01){if(_0x374b01){return _0x374b01[_0xf33a('0xe')]()[_0xf33a('0xd')](function(){_0x506924[_0xf33a('0x9')](0xcc)[_0xf33a('0xf')]();});}};}function handleEntityNotFound(_0xc01217){return function(_0x45e311){if(!_0x45e311){_0xc01217[_0xf33a('0x10')](0x194);}return _0x45e311;};}function handleError(_0x507cb9,_0x441f59){_0x441f59=_0x441f59||0x1f4;return function(_0x5b5f27){logger[_0xf33a('0x11')](_0x5b5f27[_0xf33a('0x12')]);if(_0x5b5f27['name']){delete _0x5b5f27[_0xf33a('0x13')];}_0x507cb9[_0xf33a('0x9')](_0x441f59)['send'](_0x5b5f27);};}exports[_0xf33a('0x14')]=function(_0x23d9e2,_0x38d69a){var _0x2a9f0e={},_0x532502={},_0x11efa0={'count':0x0,'rows':[]};var _0x366bda=_[_0xf33a('0x15')](db[_0xf33a('0x16')][_0xf33a('0x17')],function(_0x6cdf7b){return{'name':_0x6cdf7b[_0xf33a('0x18')],'type':_0x6cdf7b[_0xf33a('0x19')][_0xf33a('0x1a')]};});_0x532502[_0xf33a('0x1b')]=_['map'](_0x366bda,_0xf33a('0x13'));_0x532502[_0xf33a('0x1c')]=_[_0xf33a('0x1d')](_0x23d9e2[_0xf33a('0x1c')]);_0x532502[_0xf33a('0x1e')]=_['intersection'](_0x532502[_0xf33a('0x1b')],_0x532502['query']);_0x2a9f0e[_0xf33a('0x1f')]=_[_0xf33a('0x20')](_0x532502[_0xf33a('0x1b')],qs[_0xf33a('0x21')](_0x23d9e2[_0xf33a('0x1c')]['fields']));_0x2a9f0e[_0xf33a('0x1f')]=_0x2a9f0e[_0xf33a('0x1f')]['length']?_0x2a9f0e['attributes']:_0x532502[_0xf33a('0x1b')];if(!_0x23d9e2['query']['hasOwnProperty'](_0xf33a('0x22'))){_0x2a9f0e['limit']=qs[_0xf33a('0x7')](_0x23d9e2['query'][_0xf33a('0x7')]);_0x2a9f0e[_0xf33a('0x5')]=qs[_0xf33a('0x5')](_0x23d9e2[_0xf33a('0x1c')][_0xf33a('0x5')]);}_0x2a9f0e[_0xf33a('0x23')]=qs[_0xf33a('0x24')](_0x23d9e2[_0xf33a('0x1c')][_0xf33a('0x24')]);_0x2a9f0e[_0xf33a('0x25')]=qs[_0xf33a('0x1e')](_[_0xf33a('0x26')](_0x23d9e2[_0xf33a('0x1c')],_0x532502[_0xf33a('0x1e')]),_0x366bda);if(_0x23d9e2[_0xf33a('0x1c')]['filter']){_0x2a9f0e[_0xf33a('0x25')]=_[_0xf33a('0x27')](_0x2a9f0e[_0xf33a('0x25')],{'$or':_[_0xf33a('0x15')](_0x366bda,function(_0x4ee492){if(_0x4ee492[_0xf33a('0x19')]!==_0xf33a('0x28')){var _0x2d9a9d={};_0x2d9a9d[_0x4ee492[_0xf33a('0x13')]]={'$like':'%'+_0x23d9e2[_0xf33a('0x1c')][_0xf33a('0x29')]+'%'};return _0x2d9a9d;}})});}_0x2a9f0e=_['merge']({},_0x2a9f0e,_0x23d9e2[_0xf33a('0x2a')]);var _0x6f5b94={'where':_0x2a9f0e[_0xf33a('0x25')]};return db[_0xf33a('0x16')][_0xf33a('0x8')](_0x6f5b94)['then'](function(_0x578998){_0x11efa0[_0xf33a('0x8')]=_0x578998;if(_0x23d9e2['query']['includeAll']){_0x2a9f0e['include']=[{'attributes':['id',_0xf33a('0x13'),_0xf33a('0x2b'),'alias'],'model':db[_0xf33a('0x2c')],'as':'User'}];}return db[_0xf33a('0x16')][_0xf33a('0x2d')](_0x2a9f0e);})[_0xf33a('0xd')](function(_0x2a8e9e){_0x11efa0[_0xf33a('0x2e')]=_0x2a8e9e;return _0x11efa0;})[_0xf33a('0xd')](respondWithFilteredResult(_0x38d69a,_0x2a9f0e))['catch'](handleError(_0x38d69a,null));};exports[_0xf33a('0x2f')]=function(_0x29a39f,_0x5b8607){var _0x380842={'raw':!![],'where':{'id':_0x29a39f[_0xf33a('0x30')]['id']}},_0x3793b4={};_0x3793b4['model']=_[_0xf33a('0x1d')](db[_0xf33a('0x16')][_0xf33a('0x17')]);_0x3793b4[_0xf33a('0x1c')]=_[_0xf33a('0x1d')](_0x29a39f[_0xf33a('0x1c')]);_0x3793b4[_0xf33a('0x1e')]=_[_0xf33a('0x20')](_0x3793b4[_0xf33a('0x1b')],_0x3793b4['query']);_0x380842[_0xf33a('0x1f')]=_[_0xf33a('0x20')](_0x3793b4['model'],qs[_0xf33a('0x21')](_0x29a39f['query']['fields']));_0x380842[_0xf33a('0x1f')]=_0x380842[_0xf33a('0x1f')]['length']?_0x380842[_0xf33a('0x1f')]:_0x3793b4[_0xf33a('0x1b')];if(_0x29a39f[_0xf33a('0x1c')]['includeAll']){_0x380842[_0xf33a('0x31')]=[{'all':!![]}];}_0x380842=_[_0xf33a('0x27')]({},_0x380842,_0x29a39f['options']);return db[_0xf33a('0x16')][_0xf33a('0x32')](_0x380842)[_0xf33a('0xd')](handleEntityNotFound(_0x5b8607,null))[_0xf33a('0xd')](respondWithResult(_0x5b8607,null))[_0xf33a('0x33')](handleError(_0x5b8607,null));};exports['create']=function(_0x45ae15,_0x1722e5){return db[_0xf33a('0x16')][_0xf33a('0x34')](_0x45ae15[_0xf33a('0x35')],{})['then'](respondWithResult(_0x1722e5,0xc9))[_0xf33a('0x33')](handleError(_0x1722e5,null));};exports[_0xf33a('0xe')]=function(_0x6ae3ef,_0x5da70c){return db[_0xf33a('0x16')][_0xf33a('0x32')]({'where':{'id':_0x6ae3ef[_0xf33a('0x30')]['id']}})[_0xf33a('0xd')](handleEntityNotFound(_0x5da70c,null))[_0xf33a('0xd')](removeEntity(_0x5da70c,null))[_0xf33a('0x33')](handleError(_0x5da70c,null));};exports['describe']=function(_0x19aade,_0xa9c2cd){return db[_0xf33a('0x16')][_0xf33a('0x36')]()[_0xf33a('0xd')](respondWithResult(_0xa9c2cd,null))['catch'](handleError(_0xa9c2cd,null));};function findForUpdate(_0xcc4390){return db[_0xf33a('0x16')][_0xf33a('0x32')]({'where':{'uniqueid':_0xcc4390['params']['id'],'UserId':{'$or':[null,_0xcc4390[_0xf33a('0x37')]['id']]}}});}exports[_0xf33a('0xc')]=function(_0x4bcb39,_0x4c0f24){if(_0x4bcb39[_0xf33a('0x35')]['uniqueid']){delete _0x4bcb39[_0xf33a('0x35')][_0xf33a('0x38')];}return findForUpdate(_0x4bcb39)[_0xf33a('0xd')](handleEntityNotFound(_0x4c0f24,null))[_0xf33a('0xd')](saveUpdates(_0x4bcb39[_0xf33a('0x35')],null))[_0xf33a('0xd')](respondWithResult(_0x4c0f24,null))[_0xf33a('0x33')](handleError(_0x4c0f24,null));};exports[_0xf33a('0x39')]=function(_0x205409,_0xbe98a9,_0x704817){if(_0x205409[_0xf33a('0x35')][_0xf33a('0x38')]){delete _0x205409[_0xf33a('0x35')][_0xf33a('0x38')];}promiseRetry(function(_0x1a8a4e){return findForUpdate(_0x205409)[_0xf33a('0xd')](function(_0x103ec7){if(_0x103ec7!==null){return _0x103ec7;}else{_0x1a8a4e(new Error(_0xf33a('0x3a')));}});},{'retries':0x4,'minTimeout':0xfa})[_0xf33a('0xd')](function(_0xc0f0d3){if(!_0xc0f0d3){return new Promise(function(_0x3ddcdc){_0x3ddcdc(handleEntityNotFound(_0xbe98a9)());});}else{return _0xc0f0d3[_0xf33a('0xc')](_0x205409[_0xf33a('0x35')])[_0xf33a('0xd')](function(_0x1b15a1){return respondWithResult(_0xbe98a9)(_0x1b15a1);});}},function(){handleEntityNotFound(_0xbe98a9)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index b8e0773..d008a21 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 _0xc8b6=['request-promise','path','./voiceCallReport.attributes','exports','define','report_call','util','../../config/logger','api','moment','bluebird'];(function(_0x1bdfa9,_0x4a9db1){var _0x2ce497=function(_0x1434c6){while(--_0x1434c6){_0x1bdfa9['push'](_0x1bdfa9['shift']());}};_0x2ce497(++_0x4a9db1);}(_0xc8b6,0xed));var _0x6c8b=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xc8b6[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require('lodash');var util=require(_0x6c8b('0x0'));var logger=require(_0x6c8b('0x1'))(_0x6c8b('0x2'));var moment=require(_0x6c8b('0x3'));var BPromise=require(_0x6c8b('0x4'));var rp=require(_0x6c8b('0x5'));var fs=require('fs');var path=require(_0x6c8b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6c8b('0x7'));module[_0x6c8b('0x8')]=function(_0x32a337,_0x5df6ca){return _0x32a337[_0x6c8b('0x9')]('VoiceCallReport',attributes,{'tableName':_0x6c8b('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8a23=['api','moment','bluebird','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a23,0x1a1));var _0x38a2=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x8a23[_0x174ef5];return _0x1cc379;};'use strict';var _=require(_0x38a2('0x0'));var util=require(_0x38a2('0x1'));var logger=require(_0x38a2('0x2'))(_0x38a2('0x3'));var moment=require(_0x38a2('0x4'));var BPromise=require(_0x38a2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x38a2('0x6'));var rimraf=require(_0x38a2('0x7'));var config=require(_0x38a2('0x8'));var attributes=require(_0x38a2('0x9'));module[_0x38a2('0xa')]=function(_0x50c60c,_0x4239b7){return _0x50c60c[_0x38a2('0xb')](_0x38a2('0xc'),attributes,{'tableName':_0x38a2('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 48259ff..4e34d15 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 _0xcb2c=['VoiceCallReport,\x20%s,\x20%s,\x20%s','error','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','limit','include','model','attributes','map','CreateVoiceCallReport','body','stringify','update','UpdateVoiceCallReport','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug'];(function(_0x91d6fa,_0x4a6001){var _0x21643a=function(_0xbd7eb1){while(--_0xbd7eb1){_0x91d6fa['push'](_0x91d6fa['shift']());}};_0x21643a(++_0x4a6001);}(_0xcb2c,0x1ad));var _0xccb2=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xcb2c[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0xccb2('0x0'));var util=require(_0xccb2('0x1'));var moment=require(_0xccb2('0x2'));var BPromise=require('bluebird');var rs=require(_0xccb2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xccb2('0x4'))['db'];var utils=require(_0xccb2('0x5'));var logger=require(_0xccb2('0x6'))(_0xccb2('0x7'));var config=require('../../config/environment');var jayson=require(_0xccb2('0x8'));var client=jayson[_0xccb2('0x9')][_0xccb2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ba722,_0x2913bc,_0x50b67d){return new BPromise(function(_0x444fba,_0x15c0d9){return client['request'](_0x3ba722,_0x50b67d)[_0xccb2('0xb')](function(_0x440681){logger[_0xccb2('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x2913bc,_0xccb2('0xd'));logger[_0xccb2('0xe')](_0xccb2('0xf'),_0x2913bc,_0xccb2('0xd'),JSON['stringify'](_0x440681));if(_0x440681[_0xccb2('0x10')]){if(_0x440681[_0xccb2('0x10')]['code']===0x1f4){logger[_0xccb2('0x10')](_0xccb2('0x11'),_0x2913bc,_0x440681[_0xccb2('0x10')][_0xccb2('0x12')]);return _0x15c0d9(_0x440681[_0xccb2('0x10')][_0xccb2('0x12')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x2913bc,_0x440681[_0xccb2('0x10')][_0xccb2('0x12')]);return _0x444fba(_0x440681['error']['message']);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x2913bc,_0xccb2('0xd'));_0x444fba(_0x440681[_0xccb2('0x13')][_0xccb2('0x12')]);}})[_0xccb2('0x14')](function(_0x4c0fdd){logger[_0xccb2('0x10')](_0xccb2('0x11'),_0x2913bc,_0x4c0fdd);_0x15c0d9(_0x4c0fdd);});});}exports[_0xccb2('0x15')]=function(_0x9620c3){var _0x59e4c1=this;return new Promise(function(_0x139980,_0x2976c3){return db[_0xccb2('0x16')][_0xccb2('0x17')]({'raw':_0x9620c3[_0xccb2('0x18')]?_0x9620c3[_0xccb2('0x18')][_0xccb2('0x19')]===undefined?!![]:![]:!![],'where':_0x9620c3[_0xccb2('0x18')]?_0x9620c3['options'][_0xccb2('0x1a')]||null:null,'attributes':_0x9620c3[_0xccb2('0x18')]?_0x9620c3[_0xccb2('0x18')]['attributes']||null:null,'limit':_0x9620c3['options']?_0x9620c3['options'][_0xccb2('0x1b')]||null:null,'include':_0x9620c3[_0xccb2('0x18')]?_0x9620c3[_0xccb2('0x18')][_0xccb2('0x1c')]?_['map'](_0x9620c3[_0xccb2('0x18')][_0xccb2('0x1c')],function(_0x1f7f33){return{'model':db[_0x1f7f33[_0xccb2('0x1d')]],'as':_0x1f7f33['as'],'attributes':_0x1f7f33[_0xccb2('0x1e')],'include':_0x1f7f33[_0xccb2('0x1c')]?_[_0xccb2('0x1f')](_0x1f7f33['include'],function(_0xe846fa){return{'model':db[_0xe846fa[_0xccb2('0x1d')]],'as':_0xe846fa['as'],'attributes':_0xe846fa[_0xccb2('0x1e')],'include':_0xe846fa[_0xccb2('0x1c')]?_[_0xccb2('0x1f')](_0xe846fa[_0xccb2('0x1c')],function(_0x5159e8){return{'model':db[_0x5159e8[_0xccb2('0x1d')]],'as':_0x5159e8['as'],'attributes':_0x5159e8[_0xccb2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xccb2('0xb')](function(_0x4331c3){logger[_0xccb2('0xc')](_0xccb2('0x15'),_0x9620c3);logger['debug'](_0xccb2('0x15'),_0x9620c3,JSON['stringify'](_0x4331c3));_0x139980(_0x4331c3);})[_0xccb2('0x14')](function(_0x5bfbb3){logger[_0xccb2('0x10')](_0xccb2('0x15'),_0x5bfbb3[_0xccb2('0x12')],_0x9620c3);_0x2976c3(_0x59e4c1[_0xccb2('0x10')](0x1f4,_0x5bfbb3[_0xccb2('0x12')]));});});};exports[_0xccb2('0x20')]=function(_0x3b9eea){var _0x18cfc7=this;return new Promise(function(_0x2fe179,_0x14e1e8){return db[_0xccb2('0x16')]['create'](_0x3b9eea[_0xccb2('0x21')],{'raw':_0x3b9eea[_0xccb2('0x18')]?_0x3b9eea[_0xccb2('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xccb2('0xb')](function(_0x3e1bec){logger['info']('CreateVoiceCallReport',_0x3b9eea);logger[_0xccb2('0xe')]('CreateVoiceCallReport',_0x3b9eea,JSON[_0xccb2('0x22')](_0x3e1bec));_0x2fe179(_0x3e1bec);})[_0xccb2('0x14')](function(_0x564be3){logger[_0xccb2('0x10')](_0xccb2('0x20'),_0x564be3[_0xccb2('0x12')],_0x3b9eea);_0x14e1e8(_0x18cfc7['error'](0x1f4,_0x564be3[_0xccb2('0x12')]));});});};exports['UpdateVoiceCallReport']=function(_0x272932){var _0x5d16a7=this;return new Promise(function(_0x48ad52,_0x270b37){return db['VoiceCallReport'][_0xccb2('0x23')](_0x272932['body'],{'raw':_0x272932[_0xccb2('0x18')]?_0x272932[_0xccb2('0x18')][_0xccb2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x272932[_0xccb2('0x18')]?_0x272932['options']['where']||null:null,'attributes':_0x272932[_0xccb2('0x18')]?_0x272932['options'][_0xccb2('0x1e')]||null:null,'limit':_0x272932[_0xccb2('0x18')]?_0x272932[_0xccb2('0x18')][_0xccb2('0x1b')]||null:null})[_0xccb2('0xb')](function(_0x16d430){logger[_0xccb2('0xc')](_0xccb2('0x24'),_0x272932);logger[_0xccb2('0xe')](_0xccb2('0x24'),_0x272932,JSON[_0xccb2('0x22')](_0x16d430));_0x48ad52(_0x16d430);})['catch'](function(_0x440cd1){logger[_0xccb2('0x10')]('UpdateVoiceCallReport',_0x440cd1[_0xccb2('0x12')],_0x272932);_0x270b37(_0x5d16a7[_0xccb2('0x10')](0x1f4,_0x440cd1[_0xccb2('0x12')]));});});}; \ No newline at end of file +var _0x9878=['../../config/environment','jayson/promise','client','http','request','then','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','map','include','model','debug','CreateVoiceCallReport','create','body','limit','UpdateVoiceCallReport','lodash','util','moment','randomstring','../../mysqldb','../../config/logger'];(function(_0x16fe64,_0x4a91e2){var _0x4d17cf=function(_0x429e26){while(--_0x429e26){_0x16fe64['push'](_0x16fe64['shift']());}};_0x4d17cf(++_0x4a91e2);}(_0x9878,0x150));var _0x8987=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9878[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8987('0x0'));var util=require(_0x8987('0x1'));var moment=require(_0x8987('0x2'));var BPromise=require('bluebird');var rs=require(_0x8987('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8987('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8987('0x5'))('rpc');var config=require(_0x8987('0x6'));var jayson=require(_0x8987('0x7'));var client=jayson[_0x8987('0x8')][_0x8987('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41eb57,_0x2a6aeb,_0x47202a){return new BPromise(function(_0x27afcd,_0x154ebe){return client[_0x8987('0xa')](_0x41eb57,_0x47202a)[_0x8987('0xb')](function(_0x542c79){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x2a6aeb,_0x8987('0xc'));logger['debug'](_0x8987('0xd'),_0x2a6aeb,_0x8987('0xc'),JSON[_0x8987('0xe')](_0x542c79));if(_0x542c79[_0x8987('0xf')]){if(_0x542c79['error'][_0x8987('0x10')]===0x1f4){logger['error'](_0x8987('0x11'),_0x2a6aeb,_0x542c79['error']['message']);return _0x154ebe(_0x542c79['error'][_0x8987('0x12')]);}logger['error'](_0x8987('0x11'),_0x2a6aeb,_0x542c79[_0x8987('0xf')]['message']);return _0x27afcd(_0x542c79[_0x8987('0xf')][_0x8987('0x12')]);}else{logger[_0x8987('0x13')](_0x8987('0x11'),_0x2a6aeb,_0x8987('0xc'));_0x27afcd(_0x542c79[_0x8987('0x14')]['message']);}})[_0x8987('0x15')](function(_0x56a58a){logger[_0x8987('0xf')](_0x8987('0x11'),_0x2a6aeb,_0x56a58a);_0x154ebe(_0x56a58a);});});}exports[_0x8987('0x16')]=function(_0x42ac0c){var _0x11e59e=this;return new Promise(function(_0x5c118a,_0x398557){return db[_0x8987('0x17')][_0x8987('0x18')]({'raw':_0x42ac0c[_0x8987('0x19')]?_0x42ac0c['options'][_0x8987('0x1a')]===undefined?!![]:![]:!![],'where':_0x42ac0c[_0x8987('0x19')]?_0x42ac0c[_0x8987('0x19')][_0x8987('0x1b')]||null:null,'attributes':_0x42ac0c[_0x8987('0x19')]?_0x42ac0c[_0x8987('0x19')][_0x8987('0x1c')]||null:null,'limit':_0x42ac0c['options']?_0x42ac0c['options']['limit']||null:null,'include':_0x42ac0c[_0x8987('0x19')]?_0x42ac0c[_0x8987('0x19')]['include']?_[_0x8987('0x1d')](_0x42ac0c[_0x8987('0x19')][_0x8987('0x1e')],function(_0xd776fe){return{'model':db[_0xd776fe[_0x8987('0x1f')]],'as':_0xd776fe['as'],'attributes':_0xd776fe[_0x8987('0x1c')],'include':_0xd776fe[_0x8987('0x1e')]?_[_0x8987('0x1d')](_0xd776fe[_0x8987('0x1e')],function(_0x2d0688){return{'model':db[_0x2d0688['model']],'as':_0x2d0688['as'],'attributes':_0x2d0688[_0x8987('0x1c')],'include':_0x2d0688[_0x8987('0x1e')]?_['map'](_0x2d0688['include'],function(_0x58a8c4){return{'model':db[_0x58a8c4['model']],'as':_0x58a8c4['as'],'attributes':_0x58a8c4[_0x8987('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8987('0xb')](function(_0x374a7a){logger['info'](_0x8987('0x16'),_0x42ac0c);logger[_0x8987('0x20')]('GetVoiceCallReport',_0x42ac0c,JSON['stringify'](_0x374a7a));_0x5c118a(_0x374a7a);})[_0x8987('0x15')](function(_0x3fec20){logger[_0x8987('0xf')]('GetVoiceCallReport',_0x3fec20[_0x8987('0x12')],_0x42ac0c);_0x398557(_0x11e59e[_0x8987('0xf')](0x1f4,_0x3fec20[_0x8987('0x12')]));});});};exports[_0x8987('0x21')]=function(_0xf3af17){var _0x4e2952=this;return new Promise(function(_0x4097bf,_0x135989){return db[_0x8987('0x17')][_0x8987('0x22')](_0xf3af17[_0x8987('0x23')],{'raw':_0xf3af17[_0x8987('0x19')]?_0xf3af17[_0x8987('0x19')][_0x8987('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x31ae7d){logger[_0x8987('0x13')]('CreateVoiceCallReport',_0xf3af17);logger[_0x8987('0x20')](_0x8987('0x21'),_0xf3af17,JSON[_0x8987('0xe')](_0x31ae7d));_0x4097bf(_0x31ae7d);})[_0x8987('0x15')](function(_0x336a12){logger[_0x8987('0xf')](_0x8987('0x21'),_0x336a12[_0x8987('0x12')],_0xf3af17);_0x135989(_0x4e2952[_0x8987('0xf')](0x1f4,_0x336a12['message']));});});};exports['UpdateVoiceCallReport']=function(_0x4fd23f){var _0x1bd7bf=this;return new Promise(function(_0xa38dca,_0x5f5d68){return db[_0x8987('0x17')]['update'](_0x4fd23f[_0x8987('0x23')],{'raw':_0x4fd23f[_0x8987('0x19')]?_0x4fd23f[_0x8987('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fd23f['options']?_0x4fd23f[_0x8987('0x19')][_0x8987('0x1b')]||null:null,'attributes':_0x4fd23f[_0x8987('0x19')]?_0x4fd23f[_0x8987('0x19')][_0x8987('0x1c')]||null:null,'limit':_0x4fd23f[_0x8987('0x19')]?_0x4fd23f['options'][_0x8987('0x24')]||null:null})[_0x8987('0xb')](function(_0x15f366){logger['info'](_0x8987('0x25'),_0x4fd23f);logger[_0x8987('0x20')]('UpdateVoiceCallReport',_0x4fd23f,JSON['stringify'](_0x15f366));_0xa38dca(_0x15f366);})[_0x8987('0x15')](function(_0x1335b2){logger[_0x8987('0xf')](_0x8987('0x25'),_0x1335b2[_0x8987('0x12')],_0x4fd23f);_0x5f5d68(_0x1bd7bf['error'](0x1f4,_0x1335b2[_0x8987('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 95804e0..c4ea1a6 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 _0x9875=['delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','put','/:id','update'];(function(_0x325398,_0x5caf8b){var _0x43df61=function(_0x390349){while(--_0x390349){_0x325398['push'](_0x325398['shift']());}};_0x43df61(++_0x5caf8b);}(_0x9875,0x7a));var _0x5987=function(_0x85fc6b,_0x14f2a0){_0x85fc6b=_0x85fc6b-0x0;var _0x1bb7ea=_0x9875[_0x85fc6b];return _0x1bb7ea;};'use strict';var multer=require('multer');var util=require(_0x5987('0x0'));var path=require(_0x5987('0x1'));var timeout=require('connect-timeout');var express=require(_0x5987('0x2'));var router=express[_0x5987('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5987('0x4'));var interaction=require(_0x5987('0x5'));var config=require('../../config/environment');var controller=require(_0x5987('0x6'));router[_0x5987('0x7')]('/',auth[_0x5987('0x8')](),controller[_0x5987('0x9')]);router[_0x5987('0x7')]('/:id',auth[_0x5987('0x8')](),controller['show']);router['post']('/',auth[_0x5987('0x8')](),controller['create']);router[_0x5987('0xa')](_0x5987('0xb'),auth['isAuthenticated'](),controller[_0x5987('0xc')]);router[_0x5987('0xd')](_0x5987('0xb'),auth['isAuthenticated'](),controller[_0x5987('0xe')]);module['exports']=router; \ No newline at end of file +var _0x65fc=['/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x65fc,0x15c));var _0xc65f=function(_0x5e0f76,_0x23bf31){_0x5e0f76=_0x5e0f76-0x0;var _0x35f07a=_0x65fc[_0x5e0f76];return _0x35f07a;};'use strict';var multer=require(_0xc65f('0x0'));var util=require(_0xc65f('0x1'));var path=require(_0xc65f('0x2'));var timeout=require(_0xc65f('0x3'));var express=require('express');var router=express[_0xc65f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc65f('0x5'));var interaction=require(_0xc65f('0x6'));var config=require(_0xc65f('0x7'));var controller=require(_0xc65f('0x8'));router[_0xc65f('0x9')]('/',auth[_0xc65f('0xa')](),controller[_0xc65f('0xb')]);router[_0xc65f('0x9')](_0xc65f('0xc'),auth[_0xc65f('0xa')](),controller['show']);router[_0xc65f('0xd')]('/',auth['isAuthenticated'](),controller[_0xc65f('0xe')]);router[_0xc65f('0xf')](_0xc65f('0xc'),auth[_0xc65f('0xa')](),controller[_0xc65f('0x10')]);router[_0xc65f('0x11')](_0xc65f('0xc'),auth[_0xc65f('0xa')](),controller[_0xc65f('0x12')]);module[_0xc65f('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index d1491f8..6fb9dbb 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 _0x6b97=['join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','options'];(function(_0x545c93,_0x4b7c1d){var _0x39508f=function(_0x2493a1){while(--_0x2493a1){_0x545c93['push'](_0x545c93['shift']());}};_0x39508f(++_0x4b7c1d);}(_0x6b97,0xdc));var _0x76b9=function(_0x48b61d,_0x22ba6a){_0x48b61d=_0x48b61d-0x0;var _0x1a35af=_0x6b97[_0x48b61d];return _0x1a35af;};'use strict';var Sequelize=require(_0x76b9('0x0'));module[_0x76b9('0x1')]={'name':{'type':Sequelize[_0x76b9('0x2')]},'prefix':{'type':Sequelize[_0x76b9('0x2')],'unique':_0x76b9('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x76b9('0x2')],'set':function(_0x58fe24){this['setDataValue'](_0x76b9('0x4'),_0x58fe24?_0x58fe24[_0x76b9('0x5')](''):[]);},'get':function(){return this[_0x76b9('0x6')](_0x76b9('0x4'))?this[_0x76b9('0x6')](_0x76b9('0x4'))[_0x76b9('0x7')](''):[];}},'auth':{'type':Sequelize[_0x76b9('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x76b9('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x76b9('0x2')]},'description':{'type':Sequelize[_0x76b9('0x2')]}}; \ No newline at end of file +var _0x2f25=['sequelize','exports','STRING','name','setDataValue','options','join','getDataValue','split','BOOLEAN'];(function(_0x26aa88,_0x12eb93){var _0x5560b0=function(_0x47906a){while(--_0x47906a){_0x26aa88['push'](_0x26aa88['shift']());}};_0x5560b0(++_0x12eb93);}(_0x2f25,0x12c));var _0x52f2=function(_0x91489c,_0x46b3db){_0x91489c=_0x91489c-0x0;var _0x30c7b6=_0x2f25[_0x91489c];return _0x30c7b6;};'use strict';var Sequelize=require(_0x52f2('0x0'));module[_0x52f2('0x1')]={'name':{'type':Sequelize[_0x52f2('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x52f2('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x52f2('0x2')],'set':function(_0x2f6ade){this[_0x52f2('0x4')](_0x52f2('0x5'),_0x2f6ade?_0x2f6ade[_0x52f2('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x52f2('0x5'))?this[_0x52f2('0x7')](_0x52f2('0x5'))[_0x52f2('0x8')](''):[];}},'auth':{'type':Sequelize[_0x52f2('0x9')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x52f2('0x2')]},'description':{'type':Sequelize[_0x52f2('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index f0dfa17..e3471f4 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 _0xb43b=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','params','keys','include','options','find','catch','create','body','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','sendStatus','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields'];(function(_0x323938,_0x1893ef){var _0x3434c9=function(_0x443fca){while(--_0x443fca){_0x323938['push'](_0x323938['shift']());}};_0x3434c9(++_0x1893ef);}(_0xb43b,0xbf));var _0xbb43=function(_0x33e37c,_0x3a8b43){_0x33e37c=_0x33e37c-0x0;var _0x5bb6c8=_0xb43b[_0x33e37c];return _0x5bb6c8;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb43('0x1'));var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require(_0xbb43('0x5'));var Mustache=require(_0xbb43('0x6'));var util=require(_0xbb43('0x7'));var path=require(_0xbb43('0x8'));var sox=require(_0xbb43('0x9'));var csv=require(_0xbb43('0xa'));var ejs=require(_0xbb43('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb43('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbb43('0xd'));var deskjs=require(_0xbb43('0xe'));var toCsv=require(_0xbb43('0xa'));var querystring=require(_0xbb43('0xf'));var Papa=require(_0xbb43('0x10'));var Redis=require('ioredis');var authService=require(_0xbb43('0x11'));var qs=require(_0xbb43('0x12'));var as=require(_0xbb43('0x13'));var hardwareService=require(_0xbb43('0x14'));var logger=require('../../config/logger')(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2867fb,_0x5d0ccc){_0x5d0ccc=_0x5d0ccc||0xcc;return function(_0x6be368){if(_0x6be368){return _0x2867fb['sendStatus'](_0x5d0ccc);}return _0x2867fb[_0xbb43('0x17')](_0x5d0ccc)[_0xbb43('0x18')]();};}function respondWithResult(_0x3ce968,_0x3327bc){_0x3327bc=_0x3327bc||0xc8;return function(_0x2e2517){if(_0x2e2517){return _0x3ce968['status'](_0x3327bc)[_0xbb43('0x19')](_0x2e2517);}};}function respondWithFilteredResult(_0x4ac25c,_0x199726){return function(_0x32425c){if(_0x32425c){var _0x15182b=typeof _0x199726[_0xbb43('0x1a')]===_0xbb43('0x1b')&&typeof _0x199726[_0xbb43('0x1c')]===_0xbb43('0x1b');var _0x209c9c=_0x32425c[_0xbb43('0x1d')];var _0x4c223b=_0x15182b?0x0:_0x199726[_0xbb43('0x1a')];var _0x4cb0b2=_0x15182b?_0x32425c[_0xbb43('0x1d')]:_0x199726['offset']+_0x199726[_0xbb43('0x1c')];var _0x5f4b4f;if(_0x4cb0b2>=_0x209c9c){_0x4cb0b2=_0x209c9c;_0x5f4b4f=0xc8;}else{_0x5f4b4f=0xce;}_0x4ac25c[_0xbb43('0x17')](_0x5f4b4f);return _0x4ac25c[_0xbb43('0x1e')]('Content-Range',_0x4c223b+'-'+_0x4cb0b2+'/'+_0x209c9c)[_0xbb43('0x19')](_0x32425c);}return null;};}function patchUpdates(_0x6cdc26){return function(_0x398ce5){try{jsonpatch[_0xbb43('0x1f')](_0x398ce5,_0x6cdc26,!![]);}catch(_0x22c5d1){return BPromise[_0xbb43('0x20')](_0x22c5d1);}return _0x398ce5[_0xbb43('0x21')]();};}function saveUpdates(_0x1e83cd,_0x3409d0){return function(_0x3cb6d1){if(_0x3cb6d1){return _0x3cb6d1[_0xbb43('0x22')](_0x1e83cd)[_0xbb43('0x23')](function(_0x36992f){return _0x36992f;});}return null;};}function removeEntity(_0x37beb0,_0x500af4){return function(_0x28b3e4){if(_0x28b3e4){return _0x28b3e4[_0xbb43('0x24')]()['then'](function(){var _0x464b4a=_0x28b3e4[_0xbb43('0x25')]({'plain':!![]});var _0x25279b='ChanSpies';return db['UserProfileResource'][_0xbb43('0x24')]({'where':{'type':_0x25279b,'resourceId':_0x464b4a['id']}})[_0xbb43('0x23')](function(){return _0x28b3e4;});})['then'](function(){_0x37beb0['status'](0xcc)[_0xbb43('0x18')]();});}};}function handleEntityNotFound(_0xb9fe3b,_0x268fb5){return function(_0x4bb859){if(!_0x4bb859){_0xb9fe3b[_0xbb43('0x26')](0x194);}return _0x4bb859;};}function handleError(_0x426cec,_0x2dcc60){_0x2dcc60=_0x2dcc60||0x1f4;return function(_0x1a6e2b){logger['error'](_0x1a6e2b[_0xbb43('0x27')]);if(_0x1a6e2b[_0xbb43('0x28')]){delete _0x1a6e2b[_0xbb43('0x28')];}_0x426cec[_0xbb43('0x17')](_0x2dcc60)[_0xbb43('0x29')](_0x1a6e2b);};}exports[_0xbb43('0x2a')]=function(_0x2860d8,_0x48986d){var _0x3b2290={},_0x209244={},_0x3c46c6={'count':0x0,'rows':[]};var _0x5b8a7d=_[_0xbb43('0x2b')](db[_0xbb43('0x2c')][_0xbb43('0x2d')],function(_0x168374){return{'name':_0x168374[_0xbb43('0x2e')],'type':_0x168374[_0xbb43('0x2f')][_0xbb43('0x30')]};});_0x209244[_0xbb43('0x31')]=_[_0xbb43('0x2b')](_0x5b8a7d,'name');_0x209244['query']=_['keys'](_0x2860d8['query']);_0x209244[_0xbb43('0x32')]=_[_0xbb43('0x33')](_0x209244[_0xbb43('0x31')],_0x209244[_0xbb43('0x34')]);_0x3b2290[_0xbb43('0x35')]=_[_0xbb43('0x33')](_0x209244[_0xbb43('0x31')],qs[_0xbb43('0x36')](_0x2860d8['query'][_0xbb43('0x36')]));_0x3b2290[_0xbb43('0x35')]=_0x3b2290[_0xbb43('0x35')][_0xbb43('0x37')]?_0x3b2290['attributes']:_0x209244[_0xbb43('0x31')];if(!_0x2860d8[_0xbb43('0x34')][_0xbb43('0x38')](_0xbb43('0x39'))){_0x3b2290['limit']=qs[_0xbb43('0x1c')](_0x2860d8['query'][_0xbb43('0x1c')]);_0x3b2290[_0xbb43('0x1a')]=qs[_0xbb43('0x1a')](_0x2860d8[_0xbb43('0x34')][_0xbb43('0x1a')]);}_0x3b2290[_0xbb43('0x3a')]=qs[_0xbb43('0x3b')](_0x2860d8[_0xbb43('0x34')][_0xbb43('0x3b')]);_0x3b2290[_0xbb43('0x3c')]=qs[_0xbb43('0x32')](_[_0xbb43('0x3d')](_0x2860d8['query'],_0x209244[_0xbb43('0x32')]),_0x5b8a7d);if(_0x2860d8[_0xbb43('0x34')][_0xbb43('0x3e')]){_0x3b2290[_0xbb43('0x3c')]=_[_0xbb43('0x3f')](_0x3b2290[_0xbb43('0x3c')],{'$or':_[_0xbb43('0x2b')](_0x5b8a7d,function(_0x3d7d56){if(_0x3d7d56[_0xbb43('0x2f')]!==_0xbb43('0x40')){var _0x1fe204={};_0x1fe204[_0x3d7d56[_0xbb43('0x28')]]={'$like':'%'+_0x2860d8[_0xbb43('0x34')][_0xbb43('0x3e')]+'%'};return _0x1fe204;}})});}_0x3b2290=_[_0xbb43('0x3f')]({},_0x3b2290,_0x2860d8['options']);var _0x4807a3={'where':_0x3b2290[_0xbb43('0x3c')]};return db[_0xbb43('0x2c')][_0xbb43('0x1d')](_0x4807a3)[_0xbb43('0x23')](function(_0x4b32c9){_0x3c46c6['count']=_0x4b32c9;if(_0x2860d8[_0xbb43('0x34')][_0xbb43('0x41')]){_0x3b2290['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0xbb43('0x42')](_0x3b2290);})[_0xbb43('0x23')](function(_0x26aa10){_0x3c46c6[_0xbb43('0x43')]=_0x26aa10;return _0x3c46c6;})[_0xbb43('0x23')](respondWithFilteredResult(_0x48986d,_0x3b2290))['catch'](handleError(_0x48986d,null));};exports['show']=function(_0x2ea37b,_0x41fed6){var _0x3f48a1={'raw':![],'where':{'id':_0x2ea37b[_0xbb43('0x44')]['id']}},_0x2d1256={};_0x2d1256[_0xbb43('0x31')]=_[_0xbb43('0x45')](db[_0xbb43('0x2c')][_0xbb43('0x2d')]);_0x2d1256[_0xbb43('0x34')]=_['keys'](_0x2ea37b['query']);_0x2d1256[_0xbb43('0x32')]=_[_0xbb43('0x33')](_0x2d1256['model'],_0x2d1256[_0xbb43('0x34')]);_0x3f48a1[_0xbb43('0x35')]=_[_0xbb43('0x33')](_0x2d1256[_0xbb43('0x31')],qs[_0xbb43('0x36')](_0x2ea37b[_0xbb43('0x34')][_0xbb43('0x36')]));_0x3f48a1['attributes']=_0x3f48a1[_0xbb43('0x35')][_0xbb43('0x37')]?_0x3f48a1['attributes']:_0x2d1256[_0xbb43('0x31')];if(_0x2ea37b[_0xbb43('0x34')]['includeAll']){_0x3f48a1[_0xbb43('0x46')]=[{'all':!![]}];}_0x3f48a1=_[_0xbb43('0x3f')]({},_0x3f48a1,_0x2ea37b[_0xbb43('0x47')]);return db[_0xbb43('0x2c')][_0xbb43('0x48')](_0x3f48a1)[_0xbb43('0x23')](handleEntityNotFound(_0x41fed6,null))[_0xbb43('0x23')](respondWithResult(_0x41fed6,null))[_0xbb43('0x49')](handleError(_0x41fed6,null));};exports[_0xbb43('0x4a')]=function(_0x2f044f,_0x38cc4d){return db[_0xbb43('0x2c')]['create'](_0x2f044f[_0xbb43('0x4b')],{})[_0xbb43('0x23')](function(_0x50096a){var _0x7089bb=_0x2f044f['user'][_0xbb43('0x25')]({'plain':!![]});if(!_0x7089bb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7089bb[_0xbb43('0x4c')]==='user'){var _0x21f78b=_0x50096a[_0xbb43('0x25')]({'plain':!![]});var _0x26586c='ChanSpies';return db[_0xbb43('0x4d')][_0xbb43('0x48')]({'where':{'name':_0x26586c,'userProfileId':_0x7089bb[_0xbb43('0x4e')]},'raw':!![]})['then'](function(_0xd485c7){if(_0xd485c7&&_0xd485c7[_0xbb43('0x4f')]===0x0){return db['UserProfileResource'][_0xbb43('0x4a')]({'name':_0x21f78b['name'],'resourceId':_0x21f78b['id'],'type':_0xd485c7[_0xbb43('0x28')],'sectionId':_0xd485c7['id']},{})[_0xbb43('0x23')](function(){return _0x50096a;});}else{return _0x50096a;}})['catch'](function(_0x13731d){logger[_0xbb43('0x50')](_0xbb43('0x51'),_0x13731d);throw _0x13731d;});}return _0x50096a;})['then'](respondWithResult(_0x38cc4d,0xc9))[_0xbb43('0x49')](handleError(_0x38cc4d,null));};exports['update']=function(_0x3433ff,_0x451007){if(_0x3433ff[_0xbb43('0x4b')]['id']){delete _0x3433ff['body']['id'];}return db[_0xbb43('0x2c')][_0xbb43('0x48')]({'where':{'id':_0x3433ff['params']['id']}})['then'](handleEntityNotFound(_0x451007,null))[_0xbb43('0x23')](saveUpdates(_0x3433ff[_0xbb43('0x4b')],null))['then'](respondWithResult(_0x451007,null))['catch'](handleError(_0x451007,null));};exports[_0xbb43('0x24')]=function(_0x51ca4f,_0x30908e){return db[_0xbb43('0x2c')][_0xbb43('0x48')]({'where':{'id':_0x51ca4f['params']['id']}})['then'](handleEntityNotFound(_0x30908e,null))['then'](removeEntity(_0x30908e,null))['catch'](handleError(_0x30908e,null));}; \ No newline at end of file +var _0x67da=['json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','ChanSpies','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceChanSpy','include','findAll','catch','params','intersection','length','includeAll','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status'];(function(_0x46728b,_0x376bc6){var _0x5aa8e2=function(_0x111c54){while(--_0x111c54){_0x46728b['push'](_0x46728b['shift']());}};_0x5aa8e2(++_0x376bc6);}(_0x67da,0x192));var _0xa67d=function(_0x5d963e,_0x5edbfe){_0x5d963e=_0x5d963e-0x0;var _0x523c8e=_0x67da[_0x5d963e];return _0x523c8e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa67d('0x0'));var zipdir=require(_0xa67d('0x1'));var jsonpatch=require(_0xa67d('0x2'));var rp=require(_0xa67d('0x3'));var moment=require(_0xa67d('0x4'));var BPromise=require(_0xa67d('0x5'));var Mustache=require(_0xa67d('0x6'));var util=require(_0xa67d('0x7'));var path=require(_0xa67d('0x8'));var sox=require(_0xa67d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa67d('0xa'));var _=require('lodash');var squel=require(_0xa67d('0xb'));var crypto=require(_0xa67d('0xc'));var jsforce=require(_0xa67d('0xd'));var deskjs=require(_0xa67d('0xe'));var toCsv=require(_0xa67d('0xf'));var querystring=require(_0xa67d('0x10'));var Papa=require(_0xa67d('0x11'));var Redis=require(_0xa67d('0x12'));var authService=require(_0xa67d('0x13'));var qs=require(_0xa67d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa67d('0x15'));var logger=require(_0xa67d('0x16'))(_0xa67d('0x17'));var utils=require(_0xa67d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa67d('0x19'));var db=require(_0xa67d('0x1a'))['db'];function respondWithStatusCode(_0x560485,_0x4e86f6){_0x4e86f6=_0x4e86f6||0xcc;return function(_0x304ee2){if(_0x304ee2){return _0x560485['sendStatus'](_0x4e86f6);}return _0x560485[_0xa67d('0x1b')](_0x4e86f6)['end']();};}function respondWithResult(_0x5d757b,_0x22dcc7){_0x22dcc7=_0x22dcc7||0xc8;return function(_0x3b99e3){if(_0x3b99e3){return _0x5d757b['status'](_0x22dcc7)[_0xa67d('0x1c')](_0x3b99e3);}};}function respondWithFilteredResult(_0x267a67,_0x1cfe81){return function(_0x288e5f){if(_0x288e5f){var _0x5a47de=typeof _0x1cfe81['offset']==='undefined'&&typeof _0x1cfe81['limit']===_0xa67d('0x1d');var _0x553811=_0x288e5f[_0xa67d('0x1e')];var _0xf8422c=_0x5a47de?0x0:_0x1cfe81[_0xa67d('0x1f')];var _0x1b58c3=_0x5a47de?_0x288e5f[_0xa67d('0x1e')]:_0x1cfe81[_0xa67d('0x1f')]+_0x1cfe81[_0xa67d('0x20')];var _0x5538a5;if(_0x1b58c3>=_0x553811){_0x1b58c3=_0x553811;_0x5538a5=0xc8;}else{_0x5538a5=0xce;}_0x267a67[_0xa67d('0x1b')](_0x5538a5);return _0x267a67[_0xa67d('0x21')](_0xa67d('0x22'),_0xf8422c+'-'+_0x1b58c3+'/'+_0x553811)[_0xa67d('0x1c')](_0x288e5f);}return null;};}function patchUpdates(_0x28f38b){return function(_0x1c3498){try{jsonpatch['apply'](_0x1c3498,_0x28f38b,!![]);}catch(_0x3f1898){return BPromise[_0xa67d('0x23')](_0x3f1898);}return _0x1c3498[_0xa67d('0x24')]();};}function saveUpdates(_0xed6c3e,_0x48f240){return function(_0x276ef7){if(_0x276ef7){return _0x276ef7['update'](_0xed6c3e)[_0xa67d('0x25')](function(_0x415141){return _0x415141;});}return null;};}function removeEntity(_0x46bbc8,_0x9c2935){return function(_0x559009){if(_0x559009){return _0x559009[_0xa67d('0x26')]()[_0xa67d('0x25')](function(){var _0x5ed92a=_0x559009[_0xa67d('0x27')]({'plain':!![]});var _0x3dd0b9=_0xa67d('0x28');return db[_0xa67d('0x29')][_0xa67d('0x26')]({'where':{'type':_0x3dd0b9,'resourceId':_0x5ed92a['id']}})[_0xa67d('0x25')](function(){return _0x559009;});})['then'](function(){_0x46bbc8[_0xa67d('0x1b')](0xcc)[_0xa67d('0x2a')]();});}};}function handleEntityNotFound(_0x4e730e,_0x2ac61a){return function(_0x83b547){if(!_0x83b547){_0x4e730e[_0xa67d('0x2b')](0x194);}return _0x83b547;};}function handleError(_0x1e7f28,_0x40f829){_0x40f829=_0x40f829||0x1f4;return function(_0x8793cf){logger[_0xa67d('0x2c')](_0x8793cf[_0xa67d('0x2d')]);if(_0x8793cf[_0xa67d('0x2e')]){delete _0x8793cf[_0xa67d('0x2e')];}_0x1e7f28[_0xa67d('0x1b')](_0x40f829)[_0xa67d('0x2f')](_0x8793cf);};}exports[_0xa67d('0x30')]=function(_0x393269,_0x5e4f04){var _0x2998af={},_0x20c751={},_0x1fc18f={'count':0x0,'rows':[]};var _0x2703f5=_[_0xa67d('0x31')](db['VoiceChanSpy'][_0xa67d('0x32')],function(_0xc2b129){return{'name':_0xc2b129[_0xa67d('0x33')],'type':_0xc2b129[_0xa67d('0x34')][_0xa67d('0x35')]};});_0x20c751[_0xa67d('0x36')]=_[_0xa67d('0x31')](_0x2703f5,_0xa67d('0x2e'));_0x20c751[_0xa67d('0x37')]=_[_0xa67d('0x38')](_0x393269['query']);_0x20c751[_0xa67d('0x39')]=_['intersection'](_0x20c751[_0xa67d('0x36')],_0x20c751[_0xa67d('0x37')]);_0x2998af[_0xa67d('0x3a')]=_['intersection'](_0x20c751[_0xa67d('0x36')],qs[_0xa67d('0x3b')](_0x393269[_0xa67d('0x37')][_0xa67d('0x3b')]));_0x2998af[_0xa67d('0x3a')]=_0x2998af[_0xa67d('0x3a')]['length']?_0x2998af[_0xa67d('0x3a')]:_0x20c751[_0xa67d('0x36')];if(!_0x393269['query']['hasOwnProperty']('nolimit')){_0x2998af[_0xa67d('0x20')]=qs['limit'](_0x393269[_0xa67d('0x37')][_0xa67d('0x20')]);_0x2998af[_0xa67d('0x1f')]=qs[_0xa67d('0x1f')](_0x393269[_0xa67d('0x37')][_0xa67d('0x1f')]);}_0x2998af[_0xa67d('0x3c')]=qs[_0xa67d('0x3d')](_0x393269[_0xa67d('0x37')][_0xa67d('0x3d')]);_0x2998af[_0xa67d('0x3e')]=qs[_0xa67d('0x39')](_[_0xa67d('0x3f')](_0x393269['query'],_0x20c751['filters']),_0x2703f5);if(_0x393269['query'][_0xa67d('0x40')]){_0x2998af['where']=_[_0xa67d('0x41')](_0x2998af[_0xa67d('0x3e')],{'$or':_[_0xa67d('0x31')](_0x2703f5,function(_0x3777ae){if(_0x3777ae['type']!==_0xa67d('0x42')){var _0x46669f={};_0x46669f[_0x3777ae[_0xa67d('0x2e')]]={'$like':'%'+_0x393269[_0xa67d('0x37')][_0xa67d('0x40')]+'%'};return _0x46669f;}})});}_0x2998af=_[_0xa67d('0x41')]({},_0x2998af,_0x393269[_0xa67d('0x43')]);var _0x5b51dc={'where':_0x2998af['where']};return db[_0xa67d('0x44')][_0xa67d('0x1e')](_0x5b51dc)[_0xa67d('0x25')](function(_0x15b9b8){_0x1fc18f[_0xa67d('0x1e')]=_0x15b9b8;if(_0x393269[_0xa67d('0x37')]['includeAll']){_0x2998af[_0xa67d('0x45')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xa67d('0x46')](_0x2998af);})[_0xa67d('0x25')](function(_0x2f698c){_0x1fc18f['rows']=_0x2f698c;return _0x1fc18f;})[_0xa67d('0x25')](respondWithFilteredResult(_0x5e4f04,_0x2998af))[_0xa67d('0x47')](handleError(_0x5e4f04,null));};exports['show']=function(_0x5765a8,_0xcd7852){var _0x5f0af2={'raw':![],'where':{'id':_0x5765a8[_0xa67d('0x48')]['id']}},_0x23f1e1={};_0x23f1e1[_0xa67d('0x36')]=_['keys'](db[_0xa67d('0x44')]['rawAttributes']);_0x23f1e1[_0xa67d('0x37')]=_[_0xa67d('0x38')](_0x5765a8['query']);_0x23f1e1[_0xa67d('0x39')]=_[_0xa67d('0x49')](_0x23f1e1[_0xa67d('0x36')],_0x23f1e1[_0xa67d('0x37')]);_0x5f0af2[_0xa67d('0x3a')]=_[_0xa67d('0x49')](_0x23f1e1[_0xa67d('0x36')],qs[_0xa67d('0x3b')](_0x5765a8['query'][_0xa67d('0x3b')]));_0x5f0af2[_0xa67d('0x3a')]=_0x5f0af2[_0xa67d('0x3a')][_0xa67d('0x4a')]?_0x5f0af2[_0xa67d('0x3a')]:_0x23f1e1['model'];if(_0x5765a8['query'][_0xa67d('0x4b')]){_0x5f0af2[_0xa67d('0x45')]=[{'all':!![]}];}_0x5f0af2=_[_0xa67d('0x41')]({},_0x5f0af2,_0x5765a8[_0xa67d('0x43')]);return db[_0xa67d('0x44')]['find'](_0x5f0af2)[_0xa67d('0x25')](handleEntityNotFound(_0xcd7852,null))['then'](respondWithResult(_0xcd7852,null))[_0xa67d('0x47')](handleError(_0xcd7852,null));};exports[_0xa67d('0x4c')]=function(_0x1c451f,_0x1dba18){return db[_0xa67d('0x44')]['create'](_0x1c451f[_0xa67d('0x4d')],{})[_0xa67d('0x25')](function(_0x348ebd){var _0x5833c2=_0x1c451f[_0xa67d('0x4e')][_0xa67d('0x27')]({'plain':!![]});if(!_0x5833c2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5833c2[_0xa67d('0x4f')]===_0xa67d('0x4e')){var _0x51c887=_0x348ebd['get']({'plain':!![]});var _0x21581d=_0xa67d('0x28');return db[_0xa67d('0x50')][_0xa67d('0x51')]({'where':{'name':_0x21581d,'userProfileId':_0x5833c2[_0xa67d('0x52')]},'raw':!![]})[_0xa67d('0x25')](function(_0x355ae2){if(_0x355ae2&&_0x355ae2[_0xa67d('0x53')]===0x0){return db[_0xa67d('0x29')]['create']({'name':_0x51c887[_0xa67d('0x2e')],'resourceId':_0x51c887['id'],'type':_0x355ae2[_0xa67d('0x2e')],'sectionId':_0x355ae2['id']},{})['then'](function(){return _0x348ebd;});}else{return _0x348ebd;}})[_0xa67d('0x47')](function(_0x18f99d){logger['error'](_0xa67d('0x54'),_0x18f99d);throw _0x18f99d;});}return _0x348ebd;})['then'](respondWithResult(_0x1dba18,0xc9))[_0xa67d('0x47')](handleError(_0x1dba18,null));};exports[_0xa67d('0x55')]=function(_0x503413,_0x1de1fb){if(_0x503413[_0xa67d('0x4d')]['id']){delete _0x503413[_0xa67d('0x4d')]['id'];}return db[_0xa67d('0x44')][_0xa67d('0x51')]({'where':{'id':_0x503413[_0xa67d('0x48')]['id']}})[_0xa67d('0x25')](handleEntityNotFound(_0x1de1fb,null))[_0xa67d('0x25')](saveUpdates(_0x503413['body'],null))[_0xa67d('0x25')](respondWithResult(_0x1de1fb,null))[_0xa67d('0x47')](handleError(_0x1de1fb,null));};exports[_0xa67d('0x26')]=function(_0x42fb68,_0x539307){return db[_0xa67d('0x44')][_0xa67d('0x51')]({'where':{'id':_0x42fb68[_0xa67d('0x48')]['id']}})[_0xa67d('0x25')](handleEntityNotFound(_0x539307,null))[_0xa67d('0x25')](removeEntity(_0x539307,null))[_0xa67d('0x47')](handleError(_0x539307,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index f68c4a6..9ff05b8 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 _0x1f7d=['record','push','MixMonitor','recordingFormat','merge','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','util','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','system','CDR(type)=%s','chanspy'];(function(_0x57056c,_0x12c8a1){var _0xb624a2=function(_0x3933fc){while(--_0x3933fc){_0x57056c['push'](_0x57056c['shift']());}};_0xb624a2(++_0x12c8a1);}(_0x1f7d,0x66));var _0xd1f7=function(_0x4fcb34,_0x52f140){_0x4fcb34=_0x4fcb34-0x0;var _0x4f67c1=_0x1f7d[_0x4fcb34];return _0x4f67c1;};'use strict';var _=require('lodash');var util=require(_0xd1f7('0x0'));var BPromise=require(_0xd1f7('0x1'));var attributes=require(_0xd1f7('0x2'));var getUserApplications=function(_0x2f1d95,_0x1160ff,_0x3e83ca){var _0x343372=0x1;var _0x8a7426=[];var _0x308ed2={'context':_0x1160ff['context']||_0xd1f7('0x3'),'exten':util[_0xd1f7('0x4')](_0xd1f7('0x5'),_0x2f1d95['prefix'],_0x3e83ca),'type':_0xd1f7('0x6'),'isApp':![],'ChanSpyId':_0x2f1d95['id'],'UserId':_0x1160ff['id']};_0x8a7426['push'](_['merge']({'app':'Set','appdata':util[_0xd1f7('0x4')](_0xd1f7('0x7'),_0xd1f7('0x8')),'priority':_0x343372++},_0x308ed2));if(_0x2f1d95[_0xd1f7('0x9')]){_0x8a7426[_0xd1f7('0xa')](_['merge']({'app':_0xd1f7('0xb'),'appdata':util[_0xd1f7('0x4')]('${UNIQUEID}.%s,a',_0x2f1d95[_0xd1f7('0xc')]),'priority':_0x343372++},_0x308ed2));}if(_0x2f1d95['auth']){_0x8a7426[_0xd1f7('0xa')](_[_0xd1f7('0xd')]({'app':_0xd1f7('0xe'),'appdata':_0x2f1d95[_0xd1f7('0xf')],'priority':_0x343372++},_0x308ed2));}_0x8a7426[_0xd1f7('0xa')](_[_0xd1f7('0xd')]({'app':_0xd1f7('0x10'),'appdata':util['format'](_0xd1f7('0x11'),_0x1160ff[_0xd1f7('0x12')],_0x2f1d95[_0xd1f7('0x13')]?_0x2f1d95[_0xd1f7('0x13')][_0xd1f7('0x14')](''):''),'priority':_0x343372++},_0x308ed2));if(_0x2f1d95[_0xd1f7('0x9')]){_0x8a7426[_0xd1f7('0xa')](_[_0xd1f7('0xd')]({'app':'StopMixMonitor','priority':_0x343372++},_0x308ed2));}return _0x8a7426;};var getChanSpyApplications=function(_0x4db137,_0x19980f){var _0x3a569e=[];for(var _0x3100b5=0x0,_0x530938=0x1;_0x3100b5<_0x19980f[_0xd1f7('0x15')];_0x3100b5++,_0x530938=0x1){_0x3a569e=_0x3a569e[_0xd1f7('0x16')](getUserApplications(_0x4db137,_0x19980f[_0x3100b5],_0x19980f[_0x3100b5]['internal']));if(_0x19980f[_0x3100b5][_0xd1f7('0x17')]!=_0x19980f[_0x3100b5]['name']){_0x3a569e=_0x3a569e[_0xd1f7('0x16')](getUserApplications(_0x4db137,_0x19980f[_0x3100b5],_0x19980f[_0x3100b5]['name']));}}return _0x3a569e;};var getChanSpyPromise=function(_0x4a4e93,_0xc90e66){return new BPromise(function(_0x1f8fe5,_0x1a415f){return _0x4a4e93[_0xd1f7('0x18')][_0xd1f7('0x19')]({'attributes':['id',_0xd1f7('0x12'),_0xd1f7('0x17')],'where':{'role':_0xd1f7('0x1a'),'chanspy':!![]},'raw':!![]})[_0xd1f7('0x1b')](function(_0x1867d1){if(_0x1867d1){return _0x1f8fe5(getChanSpyApplications(_0xc90e66,_0x1867d1));}return _0x1f8fe5([]);})[_0xd1f7('0x1c')](function(_0x4bbf4e){_0x1a415f(_0x4bbf4e);});});};module[_0xd1f7('0x1d')]=function(_0x536deb,_0x1548bf){var _0x36f430=_0x536deb[_0xd1f7('0x1e')];return _0x536deb[_0xd1f7('0x1f')](_0xd1f7('0x20'),attributes,{'tableName':_0xd1f7('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x53e48b,_0x558743,_0x5eee16){return getChanSpyPromise(_0x36f430,_0x53e48b)[_0xd1f7('0x1b')](function(_0x49767c){if(_0x49767c&&_0x49767c[_0xd1f7('0x15')]){return _0x36f430[_0xd1f7('0x22')][_0xd1f7('0x23')](_0x49767c);}})[_0xd1f7('0x1b')](function(){_0x5eee16();})['catch'](function(_0x25b1ac){_0x5eee16(_0x25b1ac);});},'afterUpdate':function(_0x5a0d7f,_0x3eb876,_0x3af923){return _0x36f430[_0xd1f7('0x22')][_0xd1f7('0x24')]({'where':{'ChanSpyId':_0x5a0d7f['id']}})[_0xd1f7('0x1b')](function(){return getChanSpyPromise(_0x36f430,_0x5a0d7f);})[_0xd1f7('0x1b')](function(_0x5bf2ac){if(_0x5bf2ac&&_0x5bf2ac[_0xd1f7('0x15')]){return _0x36f430[_0xd1f7('0x22')][_0xd1f7('0x23')](_0x5bf2ac);}})[_0xd1f7('0x1b')](function(){_0x3af923();})[_0xd1f7('0x1c')](function(_0x140505){_0x3af923(_0x140505);});},'afterDestroy':function(_0x2206c3,_0x36d0dc,_0x2a26cb){return _0x36f430[_0xd1f7('0x22')][_0xd1f7('0x24')]({'where':{'ChanSpyId':_0x2206c3['id']}})[_0xd1f7('0x1b')](function(){_0x2a26cb();})[_0xd1f7('0x1c')](function(_0x51c148){_0x2a26cb(_0x51c148);});}}});}; \ No newline at end of file +var _0x9f90=['Authenticate','password','ChanSpy','SIP/%s,%s','name','options','record','length','concat','internal','findAll','agent','then','catch','exports','models','define','voice_chanspy','VoiceExtension','bulkCreate','destroy','util','bluebird','context','from-sip','format','prefix','system','merge','Set','chanspy','push','${UNIQUEID}.%s,a','recordingFormat','auth'];(function(_0x5e646a,_0x22a846){var _0x308280=function(_0x7f53a2){while(--_0x7f53a2){_0x5e646a['push'](_0x5e646a['shift']());}};_0x308280(++_0x22a846);}(_0x9f90,0x150));var _0x09f9=function(_0x1bcc3c,_0x59f478){_0x1bcc3c=_0x1bcc3c-0x0;var _0x4cdb22=_0x9f90[_0x1bcc3c];return _0x4cdb22;};'use strict';var _=require('lodash');var util=require(_0x09f9('0x0'));var BPromise=require(_0x09f9('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x29dbe1,_0x578c0a,_0x49f67a){var _0x4dbf3b=0x1;var _0x21eb43=[];var _0x4e5a5c={'context':_0x578c0a[_0x09f9('0x2')]||_0x09f9('0x3'),'exten':util[_0x09f9('0x4')]('%s%s',_0x29dbe1[_0x09f9('0x5')],_0x49f67a),'type':_0x09f9('0x6'),'isApp':![],'ChanSpyId':_0x29dbe1['id'],'UserId':_0x578c0a['id']};_0x21eb43['push'](_[_0x09f9('0x7')]({'app':_0x09f9('0x8'),'appdata':util[_0x09f9('0x4')]('CDR(type)=%s',_0x09f9('0x9')),'priority':_0x4dbf3b++},_0x4e5a5c));if(_0x29dbe1['record']){_0x21eb43[_0x09f9('0xa')](_[_0x09f9('0x7')]({'app':'MixMonitor','appdata':util[_0x09f9('0x4')](_0x09f9('0xb'),_0x29dbe1[_0x09f9('0xc')]),'priority':_0x4dbf3b++},_0x4e5a5c));}if(_0x29dbe1[_0x09f9('0xd')]){_0x21eb43['push'](_[_0x09f9('0x7')]({'app':_0x09f9('0xe'),'appdata':_0x29dbe1[_0x09f9('0xf')],'priority':_0x4dbf3b++},_0x4e5a5c));}_0x21eb43[_0x09f9('0xa')](_[_0x09f9('0x7')]({'app':_0x09f9('0x10'),'appdata':util[_0x09f9('0x4')](_0x09f9('0x11'),_0x578c0a[_0x09f9('0x12')],_0x29dbe1[_0x09f9('0x13')]?_0x29dbe1[_0x09f9('0x13')]['join'](''):''),'priority':_0x4dbf3b++},_0x4e5a5c));if(_0x29dbe1[_0x09f9('0x14')]){_0x21eb43['push'](_['merge']({'app':'StopMixMonitor','priority':_0x4dbf3b++},_0x4e5a5c));}return _0x21eb43;};var getChanSpyApplications=function(_0x1ef7bf,_0x454773){var _0x21ea98=[];for(var _0x2233bd=0x0,_0x1f199c=0x1;_0x2233bd<_0x454773[_0x09f9('0x15')];_0x2233bd++,_0x1f199c=0x1){_0x21ea98=_0x21ea98[_0x09f9('0x16')](getUserApplications(_0x1ef7bf,_0x454773[_0x2233bd],_0x454773[_0x2233bd][_0x09f9('0x17')]));if(_0x454773[_0x2233bd][_0x09f9('0x17')]!=_0x454773[_0x2233bd]['name']){_0x21ea98=_0x21ea98['concat'](getUserApplications(_0x1ef7bf,_0x454773[_0x2233bd],_0x454773[_0x2233bd][_0x09f9('0x12')]));}}return _0x21ea98;};var getChanSpyPromise=function(_0x1f96ff,_0x34f635){return new BPromise(function(_0x22e07b,_0x768c16){return _0x1f96ff['User'][_0x09f9('0x18')]({'attributes':['id','name',_0x09f9('0x17')],'where':{'role':_0x09f9('0x19'),'chanspy':!![]},'raw':!![]})[_0x09f9('0x1a')](function(_0x5227ab){if(_0x5227ab){return _0x22e07b(getChanSpyApplications(_0x34f635,_0x5227ab));}return _0x22e07b([]);})[_0x09f9('0x1b')](function(_0x49b02b){_0x768c16(_0x49b02b);});});};module[_0x09f9('0x1c')]=function(_0x37f703,_0x28a1da){var _0x506c84=_0x37f703[_0x09f9('0x1d')];return _0x37f703[_0x09f9('0x1e')]('VoiceChanSpy',attributes,{'tableName':_0x09f9('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ad935,_0x35e620,_0x3faf15){return getChanSpyPromise(_0x506c84,_0x5ad935)[_0x09f9('0x1a')](function(_0x1b06c7){if(_0x1b06c7&&_0x1b06c7['length']){return _0x506c84[_0x09f9('0x20')][_0x09f9('0x21')](_0x1b06c7);}})[_0x09f9('0x1a')](function(){_0x3faf15();})[_0x09f9('0x1b')](function(_0x4278dc){_0x3faf15(_0x4278dc);});},'afterUpdate':function(_0x5bdc8e,_0x643644,_0x22c58a){return _0x506c84['VoiceExtension'][_0x09f9('0x22')]({'where':{'ChanSpyId':_0x5bdc8e['id']}})[_0x09f9('0x1a')](function(){return getChanSpyPromise(_0x506c84,_0x5bdc8e);})[_0x09f9('0x1a')](function(_0x28f0e5){if(_0x28f0e5&&_0x28f0e5['length']){return _0x506c84[_0x09f9('0x20')][_0x09f9('0x21')](_0x28f0e5);}})['then'](function(){_0x22c58a();})['catch'](function(_0x3b98a2){_0x22c58a(_0x3b98a2);});},'afterDestroy':function(_0x2b3840,_0x57e70a,_0x3bf6cb){return _0x506c84[_0x09f9('0x20')][_0x09f9('0x22')]({'where':{'ChanSpyId':_0x2b3840['id']}})[_0x09f9('0x1a')](function(){_0x3bf6cb();})[_0x09f9('0x1b')](function(_0x2d68b7){_0x3bf6cb(_0x2d68b7);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 5f87178..56d6328 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 _0x0427=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceChanSpy,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','moment','bluebird','ioredis','../../mysqldb'];(function(_0x3dac64,_0x121d2d){var _0x91f4e0=function(_0x4ba2c4){while(--_0x4ba2c4){_0x3dac64['push'](_0x3dac64['shift']());}};_0x91f4e0(++_0x121d2d);}(_0x0427,0x137));var _0x7042=function(_0x410702,_0x4cf468){_0x410702=_0x410702-0x0;var _0x228702=_0x0427[_0x410702];return _0x228702;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7042('0x0'));var BPromise=require(_0x7042('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7042('0x2'));var db=require(_0x7042('0x3'))['db'];var utils=require(_0x7042('0x4'));var logger=require(_0x7042('0x5'))(_0x7042('0x6'));var config=require(_0x7042('0x7'));var jayson=require(_0x7042('0x8'));var client=jayson['client'][_0x7042('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f24b5,_0x25c552,_0x346aa8){return new BPromise(function(_0x295b19,_0x978169){return client[_0x7042('0xa')](_0x2f24b5,_0x346aa8)[_0x7042('0xb')](function(_0x3bd534){logger['info'](_0x7042('0xc'),_0x25c552,'request\x20sent');logger['debug']('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x25c552,'request\x20sent',JSON[_0x7042('0xd')](_0x3bd534));if(_0x3bd534['error']){if(_0x3bd534[_0x7042('0xe')][_0x7042('0xf')]===0x1f4){logger[_0x7042('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x25c552,_0x3bd534['error'][_0x7042('0x10')]);return _0x978169(_0x3bd534[_0x7042('0xe')][_0x7042('0x10')]);}logger[_0x7042('0xe')](_0x7042('0xc'),_0x25c552,_0x3bd534[_0x7042('0xe')]['message']);return _0x295b19(_0x3bd534[_0x7042('0xe')][_0x7042('0x10')]);}else{logger[_0x7042('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x25c552,_0x7042('0x12'));_0x295b19(_0x3bd534[_0x7042('0x13')]['message']);}})[_0x7042('0x14')](function(_0x590edd){logger['error'](_0x7042('0xc'),_0x25c552,_0x590edd);_0x978169(_0x590edd);});});} \ No newline at end of file +var _0x6f7a=['http','request','then','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x252699,_0x134b4e){var _0x56d0c6=function(_0x5551a8){while(--_0x5551a8){_0x252699['push'](_0x252699['shift']());}};_0x56d0c6(++_0x134b4e);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x114e55,_0x5c9ac8){_0x114e55=_0x114e55-0x0;var _0x460a7e=_0x6f7a[_0x114e55];return _0x460a7e;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var moment=require(_0xa6f7('0x2'));var BPromise=require(_0xa6f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6f7('0x4'));var db=require(_0xa6f7('0x5'))['db'];var utils=require(_0xa6f7('0x6'));var logger=require(_0xa6f7('0x7'))(_0xa6f7('0x8'));var config=require(_0xa6f7('0x9'));var jayson=require(_0xa6f7('0xa'));var client=jayson[_0xa6f7('0xb')][_0xa6f7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x335aaa,_0x1a06d1,_0x481a8c){return new BPromise(function(_0x4b4f9e,_0x30f2a7){return client[_0xa6f7('0xd')](_0x335aaa,_0x481a8c)[_0xa6f7('0xe')](function(_0x362404){logger[_0xa6f7('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x1a06d1,'request\x20sent');logger[_0xa6f7('0x10')](_0xa6f7('0x11'),_0x1a06d1,'request\x20sent',JSON[_0xa6f7('0x12')](_0x362404));if(_0x362404['error']){if(_0x362404[_0xa6f7('0x13')][_0xa6f7('0x14')]===0x1f4){logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x362404['error'][_0xa6f7('0x16')]);return _0x30f2a7(_0x362404['error'][_0xa6f7('0x16')]);}logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x362404['error'][_0xa6f7('0x16')]);return _0x4b4f9e(_0x362404['error'][_0xa6f7('0x16')]);}else{logger['info'](_0xa6f7('0x15'),_0x1a06d1,_0xa6f7('0x17'));_0x4b4f9e(_0x362404[_0xa6f7('0x18')]['message']);}})[_0xa6f7('0x19')](function(_0x22635e){logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x22635e);_0x30f2a7(_0x22635e);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 93edf1b..7722bfc 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 _0x1da3=['delete','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','create','update'];(function(_0x53f8bb,_0x52156d){var _0x510a09=function(_0x1a5f14){while(--_0x1a5f14){_0x53f8bb['push'](_0x53f8bb['shift']());}};_0x510a09(++_0x52156d);}(_0x1da3,0x1b1));var _0x31da=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1da3[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require('multer');var util=require(_0x31da('0x0'));var path=require(_0x31da('0x1'));var timeout=require(_0x31da('0x2'));var express=require('express');var router=express[_0x31da('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x31da('0x4'));var interaction=require(_0x31da('0x5'));var config=require(_0x31da('0x6'));var controller=require(_0x31da('0x7'));router[_0x31da('0x8')]('/',auth[_0x31da('0x9')](),controller[_0x31da('0xa')]);router['get'](_0x31da('0xb'),auth[_0x31da('0x9')](),controller[_0x31da('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x31da('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x31da('0xe')]);router[_0x31da('0xf')](_0x31da('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb415=['exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','/:id','post','isAuthenticated','delete','destroy'];(function(_0x2f843f,_0x1dfad5){var _0x588481=function(_0x18a633){while(--_0x18a633){_0x2f843f['push'](_0x2f843f['shift']());}};_0x588481(++_0x1dfad5);}(_0xb415,0x9a));var _0x5b41=function(_0x50aaf2,_0x467015){_0x50aaf2=_0x50aaf2-0x0;var _0x5e1fdb=_0xb415[_0x50aaf2];return _0x5e1fdb;};'use strict';var multer=require(_0x5b41('0x0'));var util=require(_0x5b41('0x1'));var path=require(_0x5b41('0x2'));var timeout=require('connect-timeout');var express=require(_0x5b41('0x3'));var router=express['Router']();var fs_extra=require(_0x5b41('0x4'));var auth=require(_0x5b41('0x5'));var interaction=require(_0x5b41('0x6'));var config=require(_0x5b41('0x7'));var controller=require(_0x5b41('0x8'));router[_0x5b41('0x9')]('/',auth['isAuthenticated'](),controller[_0x5b41('0xa')]);router['get'](_0x5b41('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x5b41('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x5b41('0xb'),auth[_0x5b41('0xd')](),controller['update']);router[_0x5b41('0xe')](_0x5b41('0xb'),auth[_0x5b41('0xd')](),controller[_0x5b41('0xf')]);module[_0x5b41('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 8542762..da787cb 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 _0xe1c2=['BOOLEAN','name','STRING'];(function(_0x16452a,_0x3f9bdc){var _0x4b44c7=function(_0x3c6f71){while(--_0x3c6f71){_0x16452a['push'](_0x16452a['shift']());}};_0x4b44c7(++_0x3f9bdc);}(_0xe1c2,0x10f));var _0x2e1c=function(_0x12d3ed,_0x4e391d){_0x12d3ed=_0x12d3ed-0x0;var _0x190946=_0xe1c2[_0x12d3ed];return _0x190946;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x2e1c('0x0')},'description':{'type':Sequelize[_0x2e1c('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x2e1c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb0d9=['BOOLEAN','exports','STRING'];(function(_0xb21dd9,_0x55e6ec){var _0xa95acb=function(_0x1048e5){while(--_0x1048e5){_0xb21dd9['push'](_0xb21dd9['shift']());}};_0xa95acb(++_0x55e6ec);}(_0xb0d9,0xf4));var _0x9b0d=function(_0x4d5b97,_0x118d9d){_0x4d5b97=_0x4d5b97-0x0;var _0x4f9cea=_0xb0d9[_0x4d5b97];return _0x4f9cea;};'use strict';var Sequelize=require('sequelize');module[_0x9b0d('0x0')]={'name':{'type':Sequelize[_0x9b0d('0x1')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x9b0d('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 a68505d..d400e2c 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 _0x713a=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','Reload','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0x713a,0x126));var _0xa713=function(_0x4114ae,_0xb64da9){_0x4114ae=_0x4114ae-0x0;var _0x1c7324=_0x713a[_0x4114ae];return _0x1c7324;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa713('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa713('0x1'));var rp=require(_0xa713('0x2'));var moment=require('moment');var BPromise=require(_0xa713('0x3'));var Mustache=require(_0xa713('0x4'));var util=require(_0xa713('0x5'));var path=require(_0xa713('0x6'));var sox=require(_0xa713('0x7'));var csv=require(_0xa713('0x8'));var ejs=require(_0xa713('0x9'));var fs=require('fs');var fs_extra=require(_0xa713('0xa'));var _=require(_0xa713('0xb'));var squel=require(_0xa713('0xc'));var crypto=require(_0xa713('0xd'));var jsforce=require(_0xa713('0xe'));var deskjs=require(_0xa713('0xf'));var toCsv=require(_0xa713('0x8'));var querystring=require(_0xa713('0x10'));var Papa=require(_0xa713('0x11'));var Redis=require(_0xa713('0x12'));var authService=require(_0xa713('0x13'));var qs=require(_0xa713('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa713('0x15'));var logger=require('../../config/logger')(_0xa713('0x16'));var utils=require('../../config/utils');var config=require(_0xa713('0x17'));var licenseUtil=require(_0xa713('0x18'));var db=require(_0xa713('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xa713('0x1a')][_0xa713('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x600167,_0x3dfa96,_0x2a79ec,_0x5349bf){return new BPromise(function(_0x5658a2,_0x115021){var _0x8d7fd0=_0x5349bf||client;return _0x8d7fd0['request'](_0x600167,_0x2a79ec)[_0xa713('0x1c')](function(_0x4564c1){logger[_0xa713('0x1d')](_0xa713('0x1e'),_0x3dfa96,_0xa713('0x1f'));logger['debug'](_0xa713('0x20'),_0x3dfa96,_0xa713('0x1f'),JSON['stringify'](_0x4564c1));if(_0x4564c1[_0xa713('0x21')]){if(_0x4564c1[_0xa713('0x21')]['code']===0x1f4){logger[_0xa713('0x21')](_0xa713('0x1e'),_0x3dfa96,_0x4564c1[_0xa713('0x21')][_0xa713('0x22')]);return _0x115021(_0x4564c1['error'][_0xa713('0x22')]);}logger[_0xa713('0x21')](_0xa713('0x1e'),_0x3dfa96,_0x4564c1[_0xa713('0x21')][_0xa713('0x22')]);return _0x5658a2(_0x4564c1[_0xa713('0x21')]['message']);}else{logger[_0xa713('0x1d')](_0xa713('0x1e'),_0x3dfa96,_0xa713('0x1f'));_0x5658a2(_0x4564c1[_0xa713('0x23')]['message']);}})[_0xa713('0x24')](function(_0x42182a){logger[_0xa713('0x21')](_0xa713('0x1e'),_0x3dfa96,_0x42182a);_0x115021(_0x42182a);});});}function respondWithStatusCode(_0x436073,_0x1ab126){_0x1ab126=_0x1ab126||0xcc;return function(_0xaf462e){if(_0xaf462e){return _0x436073['sendStatus'](_0x1ab126);}return _0x436073[_0xa713('0x25')](_0x1ab126)[_0xa713('0x26')]();};}function respondWithResult(_0x5129a3,_0x1a2a56){_0x1a2a56=_0x1a2a56||0xc8;return function(_0x1ec47d){if(_0x1ec47d){return _0x5129a3[_0xa713('0x25')](_0x1a2a56)[_0xa713('0x27')](_0x1ec47d);}};}function respondWithFilteredResult(_0xc068ae,_0x1cd616){return function(_0x3ef62a){if(_0x3ef62a){var _0x21dc74=typeof _0x1cd616[_0xa713('0x28')]===_0xa713('0x29')&&typeof _0x1cd616[_0xa713('0x2a')]===_0xa713('0x29');var _0x3586dc=_0x3ef62a[_0xa713('0x2b')];var _0x28570f=_0x21dc74?0x0:_0x1cd616[_0xa713('0x28')];var _0xb6cba6=_0x21dc74?_0x3ef62a[_0xa713('0x2b')]:_0x1cd616[_0xa713('0x28')]+_0x1cd616[_0xa713('0x2a')];var _0x3b283a;if(_0xb6cba6>=_0x3586dc){_0xb6cba6=_0x3586dc;_0x3b283a=0xc8;}else{_0x3b283a=0xce;}_0xc068ae[_0xa713('0x25')](_0x3b283a);return _0xc068ae[_0xa713('0x2c')](_0xa713('0x2d'),_0x28570f+'-'+_0xb6cba6+'/'+_0x3586dc)['json'](_0x3ef62a);}return null;};}function patchUpdates(_0x50c0d5){return function(_0x2d34d7){try{jsonpatch[_0xa713('0x2e')](_0x2d34d7,_0x50c0d5,!![]);}catch(_0x2f0781){return BPromise['reject'](_0x2f0781);}return _0x2d34d7[_0xa713('0x2f')]();};}function saveUpdates(_0x1cd1d3,_0x24d03b){return function(_0x1212bc){if(_0x1212bc){return _0x1212bc[_0xa713('0x30')](_0x1cd1d3)['then'](function(_0x5c8b46){return _0x5c8b46;});}return null;};}function removeEntity(_0x1dbf54,_0x50871c){return function(_0x1a7744){if(_0x1a7744){return _0x1a7744[_0xa713('0x31')]()[_0xa713('0x1c')](function(){var _0x4c1bcb=_0x1a7744[_0xa713('0x32')]({'plain':!![]});var _0x1dcb29='Contexts';return db[_0xa713('0x33')][_0xa713('0x31')]({'where':{'type':_0x1dcb29,'resourceId':_0x4c1bcb['id']}})[_0xa713('0x1c')](function(){return _0x1a7744;});})[_0xa713('0x1c')](function(){_0x1dbf54[_0xa713('0x25')](0xcc)[_0xa713('0x26')]();});}};}function handleEntityNotFound(_0x1c7b72,_0x1ccc81){return function(_0x3ee6e5){if(!_0x3ee6e5){_0x1c7b72[_0xa713('0x34')](0x194);}return _0x3ee6e5;};}function handleError(_0x4942a7,_0x332044){_0x332044=_0x332044||0x1f4;return function(_0x48941d){logger[_0xa713('0x21')](_0x48941d[_0xa713('0x35')]);if(_0x48941d[_0xa713('0x36')]){delete _0x48941d[_0xa713('0x36')];}_0x4942a7[_0xa713('0x25')](_0x332044)[_0xa713('0x37')](_0x48941d);};}exports[_0xa713('0x38')]=function(_0x1dba2e,_0x5599a0){var _0x5a7f4e={},_0x127c6f={},_0x124e3c={'count':0x0,'rows':[]};var _0xf24ee=_[_0xa713('0x39')](db[_0xa713('0x3a')][_0xa713('0x3b')],function(_0x560fab){return{'name':_0x560fab[_0xa713('0x3c')],'type':_0x560fab[_0xa713('0x3d')][_0xa713('0x3e')]};});_0x127c6f[_0xa713('0x3f')]=_[_0xa713('0x39')](_0xf24ee,_0xa713('0x36'));_0x127c6f[_0xa713('0x40')]=_[_0xa713('0x41')](_0x1dba2e[_0xa713('0x40')]);_0x127c6f[_0xa713('0x42')]=_[_0xa713('0x43')](_0x127c6f[_0xa713('0x3f')],_0x127c6f[_0xa713('0x40')]);_0x5a7f4e[_0xa713('0x44')]=_[_0xa713('0x43')](_0x127c6f[_0xa713('0x3f')],qs[_0xa713('0x45')](_0x1dba2e[_0xa713('0x40')][_0xa713('0x45')]));_0x5a7f4e['attributes']=_0x5a7f4e[_0xa713('0x44')][_0xa713('0x46')]?_0x5a7f4e['attributes']:_0x127c6f[_0xa713('0x3f')];if(!_0x1dba2e[_0xa713('0x40')][_0xa713('0x47')]('nolimit')){_0x5a7f4e['limit']=qs[_0xa713('0x2a')](_0x1dba2e[_0xa713('0x40')][_0xa713('0x2a')]);_0x5a7f4e[_0xa713('0x28')]=qs[_0xa713('0x28')](_0x1dba2e['query'][_0xa713('0x28')]);}_0x5a7f4e['order']=qs[_0xa713('0x48')](_0x1dba2e['query'][_0xa713('0x48')]);_0x5a7f4e['where']=qs[_0xa713('0x42')](_[_0xa713('0x49')](_0x1dba2e['query'],_0x127c6f[_0xa713('0x42')]),_0xf24ee);if(_0x1dba2e[_0xa713('0x40')][_0xa713('0x4a')]){_0x5a7f4e[_0xa713('0x4b')]=_['merge'](_0x5a7f4e[_0xa713('0x4b')],{'$or':_[_0xa713('0x39')](_0xf24ee,function(_0x13a7f5){if(_0x13a7f5[_0xa713('0x3d')]!==_0xa713('0x4c')){var _0x1a6060={};_0x1a6060[_0x13a7f5[_0xa713('0x36')]]={'$like':'%'+_0x1dba2e[_0xa713('0x40')][_0xa713('0x4a')]+'%'};return _0x1a6060;}})});}_0x5a7f4e=_[_0xa713('0x4d')]({},_0x5a7f4e,_0x1dba2e[_0xa713('0x4e')]);var _0x51430={'where':_0x5a7f4e[_0xa713('0x4b')]};return db[_0xa713('0x3a')][_0xa713('0x2b')](_0x51430)[_0xa713('0x1c')](function(_0x5b54a6){_0x124e3c[_0xa713('0x2b')]=_0x5b54a6;if(_0x1dba2e[_0xa713('0x40')][_0xa713('0x4f')]){_0x5a7f4e[_0xa713('0x50')]=[{'all':!![]}];}return db[_0xa713('0x3a')][_0xa713('0x51')](_0x5a7f4e);})[_0xa713('0x1c')](function(_0x5841eb){_0x124e3c[_0xa713('0x52')]=_0x5841eb;return _0x124e3c;})[_0xa713('0x1c')](respondWithFilteredResult(_0x5599a0,_0x5a7f4e))[_0xa713('0x24')](handleError(_0x5599a0,null));};exports[_0xa713('0x53')]=function(_0x52da59,_0x2359e1){var _0x5246ce={'raw':![],'where':{'id':_0x52da59['params']['id']}},_0xf89e66={};_0xf89e66[_0xa713('0x3f')]=_[_0xa713('0x41')](db[_0xa713('0x3a')][_0xa713('0x3b')]);_0xf89e66['query']=_[_0xa713('0x41')](_0x52da59[_0xa713('0x40')]);_0xf89e66[_0xa713('0x42')]=_['intersection'](_0xf89e66[_0xa713('0x3f')],_0xf89e66['query']);_0x5246ce[_0xa713('0x44')]=_[_0xa713('0x43')](_0xf89e66[_0xa713('0x3f')],qs[_0xa713('0x45')](_0x52da59[_0xa713('0x40')][_0xa713('0x45')]));_0x5246ce[_0xa713('0x44')]=_0x5246ce[_0xa713('0x44')]['length']?_0x5246ce[_0xa713('0x44')]:_0xf89e66['model'];if(_0x52da59[_0xa713('0x40')]['includeAll']){_0x5246ce[_0xa713('0x50')]=[{'all':!![]}];}_0x5246ce=_[_0xa713('0x4d')]({},_0x5246ce,_0x52da59[_0xa713('0x4e')]);return db[_0xa713('0x3a')]['find'](_0x5246ce)[_0xa713('0x1c')](handleEntityNotFound(_0x2359e1,null))[_0xa713('0x1c')](respondWithResult(_0x2359e1,null))[_0xa713('0x24')](handleError(_0x2359e1,null));};exports[_0xa713('0x54')]=function(_0x10539b,_0x8f0c1b,_0x1a7573){var _0x3315f9;return db[_0xa713('0x3a')][_0xa713('0x54')](_0x10539b[_0xa713('0x55')],{'raw':!![]})[_0xa713('0x1c')](function(_0x5b8872){_0x3315f9=_0x5b8872;return db[_0xa713('0x3a')][_0xa713('0x51')]({'raw':!![]});})['then'](function(_0x2b852d){var _0x380e3e=fs[_0xa713('0x56')](path[_0xa713('0x57')](config[_0xa713('0x58')],_0xa713('0x59')),_0xa713('0x5a'));var _0xc238dd=ejs[_0xa713('0x5b')](_0x380e3e,{'contexts':_0x2b852d||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0xc238dd);})[_0xa713('0x1c')](function(){return respondWithRpcPromise(_0xa713('0x5c'),_0xa713('0x54'),{'module':'chan_sip.so'});})[_0xa713('0x1c')](function(){var _0x352af0=_0x10539b[_0xa713('0x5d')][_0xa713('0x32')]({'plain':!![]});if(!_0x352af0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x352af0['role']==='user'){var _0x2b02d2=_0x3315f9['get']({'plain':!![]});return db[_0xa713('0x5e')][_0xa713('0x5f')]({'where':{'name':'Contexts','userProfileId':_0x352af0[_0xa713('0x60')]},'raw':!![]})[_0xa713('0x1c')](function(_0x451349){if(_0x451349&&_0x451349['autoAssociation']===0x0){return db[_0xa713('0x33')][_0xa713('0x54')]({'name':_0x2b02d2[_0xa713('0x36')],'resourceId':_0x2b02d2['id'],'type':_0x451349[_0xa713('0x36')],'sectionId':_0x451349['id']},{})[_0xa713('0x1c')](function(){return _0x3315f9;});}else{return _0x3315f9;}})[_0xa713('0x24')](function(_0x3675cc){logger[_0xa713('0x21')](_0xa713('0x61'),_0x3675cc);throw _0x3675cc;});}return _0x3315f9;})[_0xa713('0x1c')](respondWithResult(_0x8f0c1b,0xc9))[_0xa713('0x24')](handleError(_0x8f0c1b,null));};exports[_0xa713('0x30')]=function(_0x517306,_0xb1790c,_0x445691){var _0x1a708a;return db[_0xa713('0x3a')][_0xa713('0x5f')]({'where':{'id':_0x517306[_0xa713('0x62')]['id']}})[_0xa713('0x1c')](handleEntityNotFound(_0xb1790c,null))[_0xa713('0x1c')](saveUpdates(_0x517306[_0xa713('0x55')],null))[_0xa713('0x1c')](function(_0x499c8f){if(_0x499c8f){_0x1a708a=_0x499c8f;return db[_0xa713('0x3a')]['findAll']({'raw':!![]});}})[_0xa713('0x1c')](function(_0x2f84ee){var _0x32971a=fs[_0xa713('0x56')](path[_0xa713('0x57')](config[_0xa713('0x58')],_0xa713('0x59')),_0xa713('0x5a'));var _0x36df3a=ejs[_0xa713('0x5b')](_0x32971a,{'contexts':_0x2f84ee||[]});fs[_0xa713('0x63')](_0xa713('0x64'),_0x36df3a);})[_0xa713('0x1c')](function(){return respondWithRpcPromise('Reload','update',{'module':_0xa713('0x65')});})[_0xa713('0x1c')](function(){return _0x1a708a;})[_0xa713('0x1c')](respondWithResult(_0xb1790c,null))['catch'](handleError(_0xb1790c,null));};exports[_0xa713('0x31')]=function(_0x1af30a,_0x51497e,_0x212b26){var _0x35b07d;return db['VoiceContext']['find']({'where':{'id':_0x1af30a[_0xa713('0x62')]['id']}})[_0xa713('0x1c')](handleEntityNotFound(_0x51497e,null))[_0xa713('0x1c')](removeEntity(_0x51497e,null))['then'](function(){return db[_0xa713('0x3a')][_0xa713('0x51')]({'raw':!![]});})['then'](function(_0x4c4299){var _0x47675e=fs[_0xa713('0x56')](path[_0xa713('0x57')](config[_0xa713('0x58')],_0xa713('0x59')),'utf8');var _0x35ebda=ejs[_0xa713('0x5b')](_0x47675e,{'contexts':_0x4c4299});fs[_0xa713('0x63')](_0xa713('0x64'),_0x35ebda);return respondWithRpcPromise(_0xa713('0x5c'),'destroy',{'module':_0xa713('0x65')});})['catch'](handleError(_0x51497e,null));}; \ No newline at end of file +var _0x55e0=['limit','count','offset','status','set','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','end','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceContext','include','findAll','params','includeAll','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','create','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','json','undefined'];(function(_0x41bfa8,_0x2222f0){var _0x5a689e=function(_0x9c9b27){while(--_0x9c9b27){_0x41bfa8['push'](_0x41bfa8['shift']());}};_0x5a689e(++_0x2222f0);}(_0x55e0,0xa2));var _0x055e=function(_0x346045,_0x3ce566){_0x346045=_0x346045-0x0;var _0x3d1573=_0x55e0[_0x346045];return _0x3d1573;};'use strict';var emlformat=require(_0x055e('0x0'));var rimraf=require(_0x055e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x055e('0x2'));var rp=require(_0x055e('0x3'));var moment=require(_0x055e('0x4'));var BPromise=require(_0x055e('0x5'));var Mustache=require(_0x055e('0x6'));var util=require(_0x055e('0x7'));var path=require(_0x055e('0x8'));var sox=require('sox');var csv=require(_0x055e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x055e('0xa'));var _=require('lodash');var squel=require(_0x055e('0xb'));var crypto=require('crypto');var jsforce=require(_0x055e('0xc'));var deskjs=require(_0x055e('0xd'));var toCsv=require(_0x055e('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x055e('0xe'));var authService=require(_0x055e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x055e('0x10'));var hardwareService=require(_0x055e('0x11'));var logger=require(_0x055e('0x12'))('api');var utils=require(_0x055e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x055e('0x14'));var db=require(_0x055e('0x15'))['db'];var jayson=require(_0x055e('0x16'));var client=jayson[_0x055e('0x17')][_0x055e('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x263d3d,_0x44e2e7,_0x242c25,_0x52647){return new BPromise(function(_0x43abe5,_0x2c3329){var _0x6dc294=_0x52647||client;return _0x6dc294[_0x055e('0x19')](_0x263d3d,_0x242c25)[_0x055e('0x1a')](function(_0xd21a16){logger[_0x055e('0x1b')](_0x055e('0x1c'),_0x44e2e7,_0x055e('0x1d'));logger[_0x055e('0x1e')](_0x055e('0x1f'),_0x44e2e7,'request\x20sent',JSON[_0x055e('0x20')](_0xd21a16));if(_0xd21a16[_0x055e('0x21')]){if(_0xd21a16[_0x055e('0x21')]['code']===0x1f4){logger[_0x055e('0x21')](_0x055e('0x1c'),_0x44e2e7,_0xd21a16[_0x055e('0x21')][_0x055e('0x22')]);return _0x2c3329(_0xd21a16[_0x055e('0x21')][_0x055e('0x22')]);}logger[_0x055e('0x21')](_0x055e('0x1c'),_0x44e2e7,_0xd21a16[_0x055e('0x21')][_0x055e('0x22')]);return _0x43abe5(_0xd21a16[_0x055e('0x21')][_0x055e('0x22')]);}else{logger[_0x055e('0x1b')]('VoiceContext,\x20%s,\x20%s',_0x44e2e7,_0x055e('0x1d'));_0x43abe5(_0xd21a16[_0x055e('0x23')][_0x055e('0x22')]);}})[_0x055e('0x24')](function(_0x3adba7){logger['error'](_0x055e('0x1c'),_0x44e2e7,_0x3adba7);_0x2c3329(_0x3adba7);});});}function respondWithStatusCode(_0x1074a7,_0x4ddbef){_0x4ddbef=_0x4ddbef||0xcc;return function(_0x531c73){if(_0x531c73){return _0x1074a7[_0x055e('0x25')](_0x4ddbef);}return _0x1074a7['status'](_0x4ddbef)['end']();};}function respondWithResult(_0x5e8d7b,_0x3b88bd){_0x3b88bd=_0x3b88bd||0xc8;return function(_0xab53bc){if(_0xab53bc){return _0x5e8d7b['status'](_0x3b88bd)[_0x055e('0x26')](_0xab53bc);}};}function respondWithFilteredResult(_0x288f52,_0x72f899){return function(_0x2def16){if(_0x2def16){var _0x556bf8=typeof _0x72f899['offset']===_0x055e('0x27')&&typeof _0x72f899[_0x055e('0x28')]==='undefined';var _0x49983e=_0x2def16[_0x055e('0x29')];var _0x290093=_0x556bf8?0x0:_0x72f899[_0x055e('0x2a')];var _0x2fa38e=_0x556bf8?_0x2def16[_0x055e('0x29')]:_0x72f899[_0x055e('0x2a')]+_0x72f899[_0x055e('0x28')];var _0x1fcd07;if(_0x2fa38e>=_0x49983e){_0x2fa38e=_0x49983e;_0x1fcd07=0xc8;}else{_0x1fcd07=0xce;}_0x288f52[_0x055e('0x2b')](_0x1fcd07);return _0x288f52[_0x055e('0x2c')]('Content-Range',_0x290093+'-'+_0x2fa38e+'/'+_0x49983e)['json'](_0x2def16);}return null;};}function patchUpdates(_0x8e7209){return function(_0x17f5e9){try{jsonpatch[_0x055e('0x2d')](_0x17f5e9,_0x8e7209,!![]);}catch(_0x16131b){return BPromise[_0x055e('0x2e')](_0x16131b);}return _0x17f5e9[_0x055e('0x2f')]();};}function saveUpdates(_0x1c9fbf,_0x3e96b5){return function(_0x458ab3){if(_0x458ab3){return _0x458ab3[_0x055e('0x30')](_0x1c9fbf)[_0x055e('0x1a')](function(_0x143fc5){return _0x143fc5;});}return null;};}function removeEntity(_0x2f64b3,_0x254bb3){return function(_0x45caf0){if(_0x45caf0){return _0x45caf0[_0x055e('0x31')]()[_0x055e('0x1a')](function(){var _0x2c57ed=_0x45caf0[_0x055e('0x32')]({'plain':!![]});var _0x3eee5b=_0x055e('0x33');return db[_0x055e('0x34')][_0x055e('0x31')]({'where':{'type':_0x3eee5b,'resourceId':_0x2c57ed['id']}})[_0x055e('0x1a')](function(){return _0x45caf0;});})['then'](function(){_0x2f64b3[_0x055e('0x2b')](0xcc)[_0x055e('0x35')]();});}};}function handleEntityNotFound(_0x1d6766,_0x3b9842){return function(_0x5e0067){if(!_0x5e0067){_0x1d6766['sendStatus'](0x194);}return _0x5e0067;};}function handleError(_0x577f7c,_0x47fe89){_0x47fe89=_0x47fe89||0x1f4;return function(_0x515759){logger[_0x055e('0x21')](_0x515759['stack']);if(_0x515759['name']){delete _0x515759[_0x055e('0x36')];}_0x577f7c['status'](_0x47fe89)[_0x055e('0x37')](_0x515759);};}exports[_0x055e('0x38')]=function(_0x453584,_0x4fa25b){var _0x52bae1={},_0x28f320={},_0x5cad0b={'count':0x0,'rows':[]};var _0x42337c=_[_0x055e('0x39')](db['VoiceContext'][_0x055e('0x3a')],function(_0x469353){return{'name':_0x469353[_0x055e('0x3b')],'type':_0x469353[_0x055e('0x3c')][_0x055e('0x3d')]};});_0x28f320['model']=_[_0x055e('0x39')](_0x42337c,_0x055e('0x36'));_0x28f320[_0x055e('0x3e')]=_['keys'](_0x453584['query']);_0x28f320[_0x055e('0x3f')]=_[_0x055e('0x40')](_0x28f320[_0x055e('0x41')],_0x28f320[_0x055e('0x3e')]);_0x52bae1[_0x055e('0x42')]=_[_0x055e('0x40')](_0x28f320[_0x055e('0x41')],qs['fields'](_0x453584['query'][_0x055e('0x43')]));_0x52bae1[_0x055e('0x42')]=_0x52bae1[_0x055e('0x42')][_0x055e('0x44')]?_0x52bae1[_0x055e('0x42')]:_0x28f320[_0x055e('0x41')];if(!_0x453584[_0x055e('0x3e')][_0x055e('0x45')](_0x055e('0x46'))){_0x52bae1['limit']=qs[_0x055e('0x28')](_0x453584[_0x055e('0x3e')][_0x055e('0x28')]);_0x52bae1[_0x055e('0x2a')]=qs[_0x055e('0x2a')](_0x453584['query'][_0x055e('0x2a')]);}_0x52bae1[_0x055e('0x47')]=qs['sort'](_0x453584[_0x055e('0x3e')][_0x055e('0x48')]);_0x52bae1[_0x055e('0x49')]=qs[_0x055e('0x3f')](_[_0x055e('0x4a')](_0x453584['query'],_0x28f320[_0x055e('0x3f')]),_0x42337c);if(_0x453584[_0x055e('0x3e')][_0x055e('0x4b')]){_0x52bae1[_0x055e('0x49')]=_[_0x055e('0x4c')](_0x52bae1[_0x055e('0x49')],{'$or':_[_0x055e('0x39')](_0x42337c,function(_0x36e95b){if(_0x36e95b[_0x055e('0x3c')]!==_0x055e('0x4d')){var _0x4f04af={};_0x4f04af[_0x36e95b[_0x055e('0x36')]]={'$like':'%'+_0x453584[_0x055e('0x3e')][_0x055e('0x4b')]+'%'};return _0x4f04af;}})});}_0x52bae1=_[_0x055e('0x4c')]({},_0x52bae1,_0x453584[_0x055e('0x4e')]);var _0x4584af={'where':_0x52bae1['where']};return db[_0x055e('0x4f')][_0x055e('0x29')](_0x4584af)[_0x055e('0x1a')](function(_0x21c6f6){_0x5cad0b['count']=_0x21c6f6;if(_0x453584[_0x055e('0x3e')]['includeAll']){_0x52bae1[_0x055e('0x50')]=[{'all':!![]}];}return db['VoiceContext'][_0x055e('0x51')](_0x52bae1);})['then'](function(_0x2d2c78){_0x5cad0b['rows']=_0x2d2c78;return _0x5cad0b;})[_0x055e('0x1a')](respondWithFilteredResult(_0x4fa25b,_0x52bae1))['catch'](handleError(_0x4fa25b,null));};exports['show']=function(_0x16ce5a,_0x13f31d){var _0x10c06e={'raw':![],'where':{'id':_0x16ce5a[_0x055e('0x52')]['id']}},_0x5cbc5e={};_0x5cbc5e[_0x055e('0x41')]=_['keys'](db[_0x055e('0x4f')][_0x055e('0x3a')]);_0x5cbc5e[_0x055e('0x3e')]=_['keys'](_0x16ce5a['query']);_0x5cbc5e[_0x055e('0x3f')]=_[_0x055e('0x40')](_0x5cbc5e['model'],_0x5cbc5e['query']);_0x10c06e[_0x055e('0x42')]=_[_0x055e('0x40')](_0x5cbc5e['model'],qs[_0x055e('0x43')](_0x16ce5a[_0x055e('0x3e')][_0x055e('0x43')]));_0x10c06e[_0x055e('0x42')]=_0x10c06e['attributes']['length']?_0x10c06e['attributes']:_0x5cbc5e[_0x055e('0x41')];if(_0x16ce5a['query'][_0x055e('0x53')]){_0x10c06e['include']=[{'all':!![]}];}_0x10c06e=_['merge']({},_0x10c06e,_0x16ce5a[_0x055e('0x4e')]);return db[_0x055e('0x4f')]['find'](_0x10c06e)[_0x055e('0x1a')](handleEntityNotFound(_0x13f31d,null))[_0x055e('0x1a')](respondWithResult(_0x13f31d,null))[_0x055e('0x24')](handleError(_0x13f31d,null));};exports['create']=function(_0x286650,_0x4b47d2,_0x312d56){var _0x3e6200;return db[_0x055e('0x4f')]['create'](_0x286650['body'],{'raw':!![]})[_0x055e('0x1a')](function(_0x15bdac){_0x3e6200=_0x15bdac;return db[_0x055e('0x4f')][_0x055e('0x51')]({'raw':!![]});})[_0x055e('0x1a')](function(_0x1a51a3){var _0x5a8201=fs[_0x055e('0x54')](path[_0x055e('0x55')](config[_0x055e('0x56')],_0x055e('0x57')),_0x055e('0x58'));var _0x44e9b9=ejs[_0x055e('0x59')](_0x5a8201,{'contexts':_0x1a51a3||[]});fs[_0x055e('0x5a')](_0x055e('0x5b'),_0x44e9b9);})[_0x055e('0x1a')](function(){return respondWithRpcPromise(_0x055e('0x5c'),_0x055e('0x5d'),{'module':_0x055e('0x5e')});})['then'](function(){var _0x5f353a=_0x286650['user'][_0x055e('0x32')]({'plain':!![]});if(!_0x5f353a)throw new Error(_0x055e('0x5f'));if(_0x5f353a[_0x055e('0x60')]===_0x055e('0x61')){var _0xc08da7=_0x3e6200[_0x055e('0x32')]({'plain':!![]});return db['UserProfileSection'][_0x055e('0x62')]({'where':{'name':_0x055e('0x33'),'userProfileId':_0x5f353a[_0x055e('0x63')]},'raw':!![]})['then'](function(_0x1b1bf3){if(_0x1b1bf3&&_0x1b1bf3['autoAssociation']===0x0){return db[_0x055e('0x34')][_0x055e('0x5d')]({'name':_0xc08da7['name'],'resourceId':_0xc08da7['id'],'type':_0x1b1bf3[_0x055e('0x36')],'sectionId':_0x1b1bf3['id']},{})[_0x055e('0x1a')](function(){return _0x3e6200;});}else{return _0x3e6200;}})['catch'](function(_0x3de8ad){logger[_0x055e('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3de8ad);throw _0x3de8ad;});}return _0x3e6200;})[_0x055e('0x1a')](respondWithResult(_0x4b47d2,0xc9))[_0x055e('0x24')](handleError(_0x4b47d2,null));};exports['update']=function(_0x1c51d4,_0x26b4f3,_0x254fd6){var _0x14e9ed;return db[_0x055e('0x4f')][_0x055e('0x62')]({'where':{'id':_0x1c51d4[_0x055e('0x52')]['id']}})['then'](handleEntityNotFound(_0x26b4f3,null))[_0x055e('0x1a')](saveUpdates(_0x1c51d4[_0x055e('0x64')],null))['then'](function(_0x24b132){if(_0x24b132){_0x14e9ed=_0x24b132;return db[_0x055e('0x4f')]['findAll']({'raw':!![]});}})['then'](function(_0x402515){var _0x514c66=fs[_0x055e('0x54')](path[_0x055e('0x55')](config[_0x055e('0x56')],_0x055e('0x57')),_0x055e('0x58'));var _0xc93b8e=ejs[_0x055e('0x59')](_0x514c66,{'contexts':_0x402515||[]});fs[_0x055e('0x5a')](_0x055e('0x5b'),_0xc93b8e);})[_0x055e('0x1a')](function(){return respondWithRpcPromise(_0x055e('0x5c'),_0x055e('0x30'),{'module':_0x055e('0x5e')});})[_0x055e('0x1a')](function(){return _0x14e9ed;})[_0x055e('0x1a')](respondWithResult(_0x26b4f3,null))[_0x055e('0x24')](handleError(_0x26b4f3,null));};exports[_0x055e('0x31')]=function(_0x544ec8,_0x387622,_0x12b989){var _0x2cc616;return db[_0x055e('0x4f')][_0x055e('0x62')]({'where':{'id':_0x544ec8[_0x055e('0x52')]['id']}})[_0x055e('0x1a')](handleEntityNotFound(_0x387622,null))['then'](removeEntity(_0x387622,null))[_0x055e('0x1a')](function(){return db[_0x055e('0x4f')][_0x055e('0x51')]({'raw':!![]});})[_0x055e('0x1a')](function(_0x5a3dba){var _0x3ef968=fs['readFileSync'](path[_0x055e('0x55')](config['root'],_0x055e('0x57')),'utf8');var _0x1c9ee8=ejs[_0x055e('0x59')](_0x3ef968,{'contexts':_0x5a3dba});fs['writeFileSync'](_0x055e('0x5b'),_0x1c9ee8);return respondWithRpcPromise(_0x055e('0x5c'),_0x055e('0x31'),{'module':'chan_sip.so'});})[_0x055e('0x24')](handleError(_0x387622,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index e75f33f..d143cc0 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 _0x25fe=['rimraf','./voiceContext.attributes','define','VoiceContext','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xba1076,_0x130e38){var _0x4e9ea4=function(_0x249e14){while(--_0x249e14){_0xba1076['push'](_0xba1076['shift']());}};_0x4e9ea4(++_0x130e38);}(_0x25fe,0x13a));var _0xe25f=function(_0x569fef,_0x49c37a){_0x569fef=_0x569fef-0x0;var _0x11f20b=_0x25fe[_0x569fef];return _0x11f20b;};'use strict';var _=require(_0xe25f('0x0'));var util=require('util');var logger=require(_0xe25f('0x1'))(_0xe25f('0x2'));var moment=require(_0xe25f('0x3'));var BPromise=require(_0xe25f('0x4'));var rp=require(_0xe25f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe25f('0x6'));var config=require('../../config/environment');var attributes=require(_0xe25f('0x7'));module['exports']=function(_0x2d76c6,_0x27d770){return _0x2d76c6[_0xe25f('0x8')](_0xe25f('0x9'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc4f=['lodash','util','../../config/logger','api','moment','request-promise','path','./voiceContext.attributes','define','VoiceContext'];(function(_0x474cb1,_0x518d51){var _0x4e20bb=function(_0x463773){while(--_0x463773){_0x474cb1['push'](_0x474cb1['shift']());}};_0x4e20bb(++_0x518d51);}(_0xcc4f,0x82));var _0xfcc4=function(_0x3a7a85,_0x16bbe3){_0x3a7a85=_0x3a7a85-0x0;var _0x434e67=_0xcc4f[_0x3a7a85];return _0x434e67;};'use strict';var _=require(_0xfcc4('0x0'));var util=require(_0xfcc4('0x1'));var logger=require(_0xfcc4('0x2'))(_0xfcc4('0x3'));var moment=require(_0xfcc4('0x4'));var BPromise=require('bluebird');var rp=require(_0xfcc4('0x5'));var fs=require('fs');var path=require(_0xfcc4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfcc4('0x7'));module['exports']=function(_0x45e2a8,_0x51c01d){return _0x45e2a8[_0xfcc4('0x8')](_0xfcc4('0x9'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 3b81bb0..9a5376b 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 _0x7894=['request','info','VoiceContext,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x2bf2cd,_0xe31b3e){var _0x2d7f22=function(_0x2d891e){while(--_0x2d891e){_0x2bf2cd['push'](_0x2bf2cd['shift']());}};_0x2d7f22(++_0xe31b3e);}(_0x7894,0x170));var _0x4789=function(_0x2069a7,_0x13899c){_0x2069a7=_0x2069a7-0x0;var _0x3622c0=_0x7894[_0x2069a7];return _0x3622c0;};'use strict';var _=require(_0x4789('0x0'));var util=require(_0x4789('0x1'));var moment=require(_0x4789('0x2'));var BPromise=require(_0x4789('0x3'));var rs=require(_0x4789('0x4'));var fs=require('fs');var Redis=require(_0x4789('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4789('0x6'));var logger=require(_0x4789('0x7'))('rpc');var config=require(_0x4789('0x8'));var jayson=require(_0x4789('0x9'));var client=jayson[_0x4789('0xa')][_0x4789('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x114a90,_0x298902,_0x13b7f6){return new BPromise(function(_0x5a45ae,_0x49d256){return client[_0x4789('0xc')](_0x114a90,_0x13b7f6)['then'](function(_0x2e8038){logger[_0x4789('0xd')](_0x4789('0xe'),_0x298902,'request\x20sent');logger[_0x4789('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x298902,_0x4789('0x10'),JSON[_0x4789('0x11')](_0x2e8038));if(_0x2e8038[_0x4789('0x12')]){if(_0x2e8038['error']['code']===0x1f4){logger[_0x4789('0x12')]('VoiceContext,\x20%s,\x20%s',_0x298902,_0x2e8038[_0x4789('0x12')]['message']);return _0x49d256(_0x2e8038[_0x4789('0x12')][_0x4789('0x13')]);}logger['error'](_0x4789('0xe'),_0x298902,_0x2e8038['error'][_0x4789('0x13')]);return _0x5a45ae(_0x2e8038[_0x4789('0x12')][_0x4789('0x13')]);}else{logger['info'](_0x4789('0xe'),_0x298902,_0x4789('0x10'));_0x5a45ae(_0x2e8038['result'][_0x4789('0x13')]);}})['catch'](function(_0x118f97){logger[_0x4789('0x12')]('VoiceContext,\x20%s,\x20%s',_0x298902,_0x118f97);_0x49d256(_0x118f97);});});} \ No newline at end of file +var _0xd844=['../../config/logger','rpc','../../config/environment','client','request','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util','bluebird','randomstring','../../config/utils'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd844,0x6d));var _0x4d84=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd844[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x4d84('0x0'));var util=require(_0x4d84('0x1'));var moment=require('moment');var BPromise=require(_0x4d84('0x2'));var rs=require(_0x4d84('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4d84('0x4'));var logger=require(_0x4d84('0x5'))(_0x4d84('0x6'));var config=require(_0x4d84('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4d84('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x591203,_0x423d11,_0x4f777a){return new BPromise(function(_0x49c1b0,_0xbdf246){return client[_0x4d84('0x9')](_0x591203,_0x4f777a)['then'](function(_0x42a874){logger['info'](_0x4d84('0xa'),_0x423d11,_0x4d84('0xb'));logger[_0x4d84('0xc')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x423d11,_0x4d84('0xb'),JSON[_0x4d84('0xd')](_0x42a874));if(_0x42a874[_0x4d84('0xe')]){if(_0x42a874[_0x4d84('0xe')][_0x4d84('0xf')]===0x1f4){logger[_0x4d84('0xe')](_0x4d84('0xa'),_0x423d11,_0x42a874[_0x4d84('0xe')][_0x4d84('0x10')]);return _0xbdf246(_0x42a874[_0x4d84('0xe')][_0x4d84('0x10')]);}logger['error'](_0x4d84('0xa'),_0x423d11,_0x42a874['error'][_0x4d84('0x10')]);return _0x49c1b0(_0x42a874[_0x4d84('0xe')][_0x4d84('0x10')]);}else{logger[_0x4d84('0x11')]('VoiceContext,\x20%s,\x20%s',_0x423d11,_0x4d84('0xb'));_0x49c1b0(_0x42a874['result'][_0x4d84('0x10')]);}})[_0x4d84('0x12')](function(_0x501525){logger['error'](_0x4d84('0xa'),_0x423d11,_0x501525);_0xbdf246(_0x501525);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index bce7b44..cbf1079 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 _0x4f09=['fs-extra','../../config/environment','./voiceDialReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','update','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x4f09,0x18b));var _0x94f0=function(_0x478349,_0x4e11b2){_0x478349=_0x478349-0x0;var _0x564ad3=_0x4f09[_0x478349];return _0x564ad3;};'use strict';var multer=require(_0x94f0('0x0'));var util=require('util');var path=require(_0x94f0('0x1'));var timeout=require(_0x94f0('0x2'));var express=require('express');var router=express[_0x94f0('0x3')]();var fs_extra=require(_0x94f0('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x94f0('0x5'));var controller=require(_0x94f0('0x6'));router[_0x94f0('0x7')]('/',auth['isAuthenticated'](),controller[_0x94f0('0x8')]);router['get'](_0x94f0('0x9'),auth[_0x94f0('0xa')](),controller[_0x94f0('0xb')]);router[_0x94f0('0x7')](_0x94f0('0xc'),auth[_0x94f0('0xa')](),controller[_0x94f0('0xd')]);router[_0x94f0('0xe')]('/',auth[_0x94f0('0xa')](),controller['create']);router[_0x94f0('0xf')](_0x94f0('0xc'),auth[_0x94f0('0xa')](),controller[_0x94f0('0x10')]);router['delete']('/:id',auth[_0x94f0('0xa')](),controller[_0x94f0('0x11')]);module[_0x94f0('0x12')]=router; \ No newline at end of file +var _0x4862=['express','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','get','/describe','describe','show','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout'];(function(_0x18e7e2,_0x5b0886){var _0xea6f67=function(_0x23766c){while(--_0x23766c){_0x18e7e2['push'](_0x18e7e2['shift']());}};_0xea6f67(++_0x5b0886);}(_0x4862,0x129));var _0x2486=function(_0x16adf1,_0x1273a5){_0x16adf1=_0x16adf1-0x0;var _0xc13362=_0x4862[_0x16adf1];return _0xc13362;};'use strict';var multer=require(_0x2486('0x0'));var util=require('util');var path=require(_0x2486('0x1'));var timeout=require(_0x2486('0x2'));var express=require(_0x2486('0x3'));var router=express['Router']();var fs_extra=require(_0x2486('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2486('0x5'));var config=require(_0x2486('0x6'));var controller=require(_0x2486('0x7'));router['get']('/',auth[_0x2486('0x8')](),controller['index']);router[_0x2486('0x9')](_0x2486('0xa'),auth[_0x2486('0x8')](),controller[_0x2486('0xb')]);router['get']('/:id',auth[_0x2486('0x8')](),controller[_0x2486('0xc')]);router[_0x2486('0xd')]('/',auth['isAuthenticated'](),controller[_0x2486('0xe')]);router[_0x2486('0xf')](_0x2486('0x10'),auth['isAuthenticated'](),controller[_0x2486('0x11')]);router[_0x2486('0x12')]('/:id',auth[_0x2486('0x8')](),controller['destroy']);module[_0x2486('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index a91f5dd..701d916 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 _0x9bde=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x3aed86,_0xb83cb5){var _0x1ca38d=function(_0x98b2c5){while(--_0x98b2c5){_0x3aed86['push'](_0x3aed86['shift']());}};_0x1ca38d(++_0xb83cb5);}(_0x9bde,0xe1));var _0xe9bd=function(_0xfc32c6,_0x4ff0c5){_0xfc32c6=_0xfc32c6-0x0;var _0x3a0355=_0x9bde[_0xfc32c6];return _0x3a0355;};'use strict';var Sequelize=require('sequelize');module[_0xe9bd('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe9bd('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xe9bd('0x1')]},'calleridnum':{'type':Sequelize[_0xe9bd('0x1')]},'calleridname':{'type':Sequelize[_0xe9bd('0x1')]},'connectedlinenum':{'type':Sequelize[_0xe9bd('0x1')]},'connectedlinename':{'type':Sequelize[_0xe9bd('0x1')]},'language':{'type':Sequelize[_0xe9bd('0x1')]},'accountcode':{'type':Sequelize[_0xe9bd('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xe9bd('0x1')]},'priority':{'type':Sequelize[_0xe9bd('0x2')]},'uniqueid':{'type':Sequelize[_0xe9bd('0x1')]},'linkedid':{'type':Sequelize[_0xe9bd('0x1')]},'destchannel':{'type':Sequelize[_0xe9bd('0x1')]},'destchannelstate':{'type':Sequelize[_0xe9bd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xe9bd('0x1')]},'destcalleridnum':{'type':Sequelize[_0xe9bd('0x1')]},'destcalleridname':{'type':Sequelize[_0xe9bd('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xe9bd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xe9bd('0x1')]},'destcontext':{'type':Sequelize[_0xe9bd('0x1')]},'destexten':{'type':Sequelize[_0xe9bd('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xe9bd('0x1')]},'destlinkedid':{'type':Sequelize[_0xe9bd('0x1')]},'dialstring':{'type':Sequelize[_0xe9bd('0x1')]},'dialstatus':{'type':Sequelize[_0xe9bd('0x1')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe9bd('0x3')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xe9bd('0x1')],'comment':_0xe9bd('0x4')},'routeId':{'type':Sequelize[_0xe9bd('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xe9bd('0x2')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x2ba235,_0x4e1431){var _0x381629=function(_0x10f755){while(--_0x10f755){_0x2ba235['push'](_0x2ba235['shift']());}};_0x381629(++_0x4e1431);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x470f24,_0x2436a9){_0x470f24=_0x470f24-0x0;var _0x2c6fc8=_0xf3cd[_0x470f24];return _0x2c6fc8;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'privilege':{'type':Sequelize[_0xdf3c('0x2')]},'channel':{'type':Sequelize[_0xdf3c('0x2')]},'channelstate':{'type':Sequelize[_0xdf3c('0x3')]},'channelstatedesc':{'type':Sequelize[_0xdf3c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'connectedlinename':{'type':Sequelize[_0xdf3c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xdf3c('0x2')]},'context':{'type':Sequelize[_0xdf3c('0x2')]},'exten':{'type':Sequelize[_0xdf3c('0x2')]},'priority':{'type':Sequelize[_0xdf3c('0x3')]},'uniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'linkedid':{'type':Sequelize[_0xdf3c('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xdf3c('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xdf3c('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xdf3c('0x2')]},'destaccountcode':{'type':Sequelize[_0xdf3c('0x2')]},'destcontext':{'type':Sequelize[_0xdf3c('0x2')]},'destexten':{'type':Sequelize[_0xdf3c('0x2')]},'destpriority':{'type':Sequelize[_0xdf3c('0x3')]},'destuniqueid':{'type':Sequelize[_0xdf3c('0x2')]},'destlinkedid':{'type':Sequelize[_0xdf3c('0x2')]},'dialstring':{'type':Sequelize[_0xdf3c('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xdf3c('0x4')]},'answertime':{'type':Sequelize[_0xdf3c('0x4')]},'endtime':{'type':Sequelize[_0xdf3c('0x4')]},'lastevent':{'type':Sequelize[_0xdf3c('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xdf3c('0x3')]},'duration':{'type':Sequelize[_0xdf3c('0x3')]},'holdtime':{'type':Sequelize[_0xdf3c('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 7a38fc4..1f5789e 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 _0xec86=['query','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','then','destroy','sendStatus','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','fields'];(function(_0x456e84,_0x4dee14){var _0x15d719=function(_0x5280cf){while(--_0x5280cf){_0x456e84['push'](_0x456e84['shift']());}};_0x15d719(++_0x4dee14);}(_0xec86,0xf5));var _0x6ec8=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xec86[_0x40220a];return _0x3903cc;};'use strict';var emlformat=require(_0x6ec8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6ec8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6ec8('0x2'));var BPromise=require(_0x6ec8('0x3'));var Mustache=require(_0x6ec8('0x4'));var util=require(_0x6ec8('0x5'));var path=require('path');var sox=require(_0x6ec8('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6ec8('0x7'));var _=require(_0x6ec8('0x8'));var squel=require(_0x6ec8('0x9'));var crypto=require(_0x6ec8('0xa'));var jsforce=require(_0x6ec8('0xb'));var deskjs=require(_0x6ec8('0xc'));var toCsv=require(_0x6ec8('0xd'));var querystring=require(_0x6ec8('0xe'));var Papa=require(_0x6ec8('0xf'));var Redis=require(_0x6ec8('0x10'));var authService=require(_0x6ec8('0x11'));var qs=require(_0x6ec8('0x12'));var as=require(_0x6ec8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6ec8('0x14'));var utils=require('../../config/utils');var config=require(_0x6ec8('0x15'));var licenseUtil=require(_0x6ec8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c7e0e,_0xcd180b){_0xcd180b=_0xcd180b||0xcc;return function(_0xfc193e){if(_0xfc193e){return _0x2c7e0e['sendStatus'](_0xcd180b);}return _0x2c7e0e['status'](_0xcd180b)[_0x6ec8('0x17')]();};}function respondWithResult(_0x479a03,_0x385e3f){_0x385e3f=_0x385e3f||0xc8;return function(_0x48b994){if(_0x48b994){return _0x479a03[_0x6ec8('0x18')](_0x385e3f)[_0x6ec8('0x19')](_0x48b994);}};}function respondWithFilteredResult(_0x5307de,_0x598b39){return function(_0xd6183c){if(_0xd6183c){var _0xc6a567=typeof _0x598b39[_0x6ec8('0x1a')]==='undefined'&&typeof _0x598b39[_0x6ec8('0x1b')]===_0x6ec8('0x1c');var _0x119762=_0xd6183c[_0x6ec8('0x1d')];var _0x193c11=_0xc6a567?0x0:_0x598b39[_0x6ec8('0x1a')];var _0xf55a61=_0xc6a567?_0xd6183c[_0x6ec8('0x1d')]:_0x598b39[_0x6ec8('0x1a')]+_0x598b39['limit'];var _0x19acb;if(_0xf55a61>=_0x119762){_0xf55a61=_0x119762;_0x19acb=0xc8;}else{_0x19acb=0xce;}_0x5307de[_0x6ec8('0x18')](_0x19acb);return _0x5307de[_0x6ec8('0x1e')](_0x6ec8('0x1f'),_0x193c11+'-'+_0xf55a61+'/'+_0x119762)[_0x6ec8('0x19')](_0xd6183c);}return null;};}function patchUpdates(_0x132006){return function(_0x28b7ec){try{jsonpatch['apply'](_0x28b7ec,_0x132006,!![]);}catch(_0x2a43f4){return BPromise[_0x6ec8('0x20')](_0x2a43f4);}return _0x28b7ec['save']();};}function saveUpdates(_0x21f354,_0x3a2d65){return function(_0x12a801){if(_0x12a801){return _0x12a801['update'](_0x21f354)[_0x6ec8('0x21')](function(_0xc50505){return _0xc50505;});}return null;};}function removeEntity(_0x30380e,_0x56a97c){return function(_0x14fc07){if(_0x14fc07){return _0x14fc07[_0x6ec8('0x22')]()[_0x6ec8('0x21')](function(){_0x30380e[_0x6ec8('0x18')](0xcc)[_0x6ec8('0x17')]();});}};}function handleEntityNotFound(_0x3130b0,_0x29d785){return function(_0x5a233b){if(!_0x5a233b){_0x3130b0[_0x6ec8('0x23')](0x194);}return _0x5a233b;};}function handleError(_0x432e2b,_0x2828a2){_0x2828a2=_0x2828a2||0x1f4;return function(_0x5b1b4f){logger['error'](_0x5b1b4f[_0x6ec8('0x24')]);if(_0x5b1b4f[_0x6ec8('0x25')]){delete _0x5b1b4f[_0x6ec8('0x25')];}_0x432e2b['status'](_0x2828a2)[_0x6ec8('0x26')](_0x5b1b4f);};}exports[_0x6ec8('0x27')]=function(_0x5f10de,_0x515749){var _0x2807eb={},_0x1bd4d3={},_0x4d4a7e={'count':0x0,'rows':[]};var _0x3547d4=_[_0x6ec8('0x28')](db[_0x6ec8('0x29')][_0x6ec8('0x2a')],function(_0x4c06f8){return{'name':_0x4c06f8[_0x6ec8('0x2b')],'type':_0x4c06f8[_0x6ec8('0x2c')][_0x6ec8('0x2d')]};});_0x1bd4d3[_0x6ec8('0x2e')]=_['map'](_0x3547d4,_0x6ec8('0x25'));_0x1bd4d3['query']=_[_0x6ec8('0x2f')](_0x5f10de['query']);_0x1bd4d3[_0x6ec8('0x30')]=_[_0x6ec8('0x31')](_0x1bd4d3[_0x6ec8('0x2e')],_0x1bd4d3['query']);_0x2807eb['attributes']=_[_0x6ec8('0x31')](_0x1bd4d3[_0x6ec8('0x2e')],qs[_0x6ec8('0x32')](_0x5f10de[_0x6ec8('0x33')]['fields']));_0x2807eb[_0x6ec8('0x34')]=_0x2807eb[_0x6ec8('0x34')]['length']?_0x2807eb['attributes']:_0x1bd4d3[_0x6ec8('0x2e')];if(!_0x5f10de[_0x6ec8('0x33')][_0x6ec8('0x35')](_0x6ec8('0x36'))){_0x2807eb[_0x6ec8('0x1b')]=qs['limit'](_0x5f10de[_0x6ec8('0x33')]['limit']);_0x2807eb[_0x6ec8('0x1a')]=qs['offset'](_0x5f10de[_0x6ec8('0x33')][_0x6ec8('0x1a')]);}_0x2807eb[_0x6ec8('0x37')]=qs[_0x6ec8('0x38')](_0x5f10de[_0x6ec8('0x33')][_0x6ec8('0x38')]);_0x2807eb[_0x6ec8('0x39')]=qs['filters'](_[_0x6ec8('0x3a')](_0x5f10de[_0x6ec8('0x33')],_0x1bd4d3['filters']),_0x3547d4);if(_0x5f10de['query'][_0x6ec8('0x3b')]){_0x2807eb[_0x6ec8('0x39')]=_[_0x6ec8('0x3c')](_0x2807eb[_0x6ec8('0x39')],{'$or':_[_0x6ec8('0x28')](_0x3547d4,function(_0x2650e6){if(_0x2650e6[_0x6ec8('0x2c')]!==_0x6ec8('0x3d')){var _0x21152e={};_0x21152e[_0x2650e6['name']]={'$like':'%'+_0x5f10de[_0x6ec8('0x33')][_0x6ec8('0x3b')]+'%'};return _0x21152e;}})});}_0x2807eb=_[_0x6ec8('0x3c')]({},_0x2807eb,_0x5f10de[_0x6ec8('0x3e')]);var _0x19c7ed={'where':_0x2807eb[_0x6ec8('0x39')]};return db[_0x6ec8('0x29')][_0x6ec8('0x1d')](_0x19c7ed)[_0x6ec8('0x21')](function(_0x5a9397){_0x4d4a7e[_0x6ec8('0x1d')]=_0x5a9397;if(_0x5f10de[_0x6ec8('0x33')][_0x6ec8('0x3f')]){_0x2807eb[_0x6ec8('0x40')]=[{'all':!![]}];}return db[_0x6ec8('0x29')][_0x6ec8('0x41')](_0x2807eb);})[_0x6ec8('0x21')](function(_0x51b8e0){_0x4d4a7e[_0x6ec8('0x42')]=_0x51b8e0;return _0x4d4a7e;})[_0x6ec8('0x21')](respondWithFilteredResult(_0x515749,_0x2807eb))[_0x6ec8('0x43')](handleError(_0x515749,null));};exports[_0x6ec8('0x44')]=function(_0x772273,_0x1aae83){var _0x44156a={'raw':!![],'where':{'id':_0x772273[_0x6ec8('0x45')]['id']}},_0x23cab2={};_0x23cab2[_0x6ec8('0x2e')]=_[_0x6ec8('0x2f')](db['VoiceDialReport']['rawAttributes']);_0x23cab2[_0x6ec8('0x33')]=_[_0x6ec8('0x2f')](_0x772273[_0x6ec8('0x33')]);_0x23cab2[_0x6ec8('0x30')]=_[_0x6ec8('0x31')](_0x23cab2[_0x6ec8('0x2e')],_0x23cab2[_0x6ec8('0x33')]);_0x44156a[_0x6ec8('0x34')]=_['intersection'](_0x23cab2['model'],qs[_0x6ec8('0x32')](_0x772273['query']['fields']));_0x44156a['attributes']=_0x44156a[_0x6ec8('0x34')]['length']?_0x44156a[_0x6ec8('0x34')]:_0x23cab2[_0x6ec8('0x2e')];if(_0x772273[_0x6ec8('0x33')]['includeAll']){_0x44156a['include']=[{'all':!![]}];}_0x44156a=_[_0x6ec8('0x3c')]({},_0x44156a,_0x772273[_0x6ec8('0x3e')]);return db['VoiceDialReport'][_0x6ec8('0x46')](_0x44156a)[_0x6ec8('0x21')](handleEntityNotFound(_0x1aae83,null))[_0x6ec8('0x21')](respondWithResult(_0x1aae83,null))[_0x6ec8('0x43')](handleError(_0x1aae83,null));};exports[_0x6ec8('0x47')]=function(_0xac08d3,_0x13e40e){return db[_0x6ec8('0x29')][_0x6ec8('0x47')](_0xac08d3[_0x6ec8('0x48')],{})[_0x6ec8('0x21')](respondWithResult(_0x13e40e,0xc9))[_0x6ec8('0x43')](handleError(_0x13e40e,null));};exports['update']=function(_0x217273,_0x45702d){if(_0x217273['body']['id']){delete _0x217273[_0x6ec8('0x48')]['id'];}return db['VoiceDialReport'][_0x6ec8('0x46')]({'where':{'id':_0x217273[_0x6ec8('0x45')]['id']}})[_0x6ec8('0x21')](handleEntityNotFound(_0x45702d,null))[_0x6ec8('0x21')](saveUpdates(_0x217273['body'],null))[_0x6ec8('0x21')](respondWithResult(_0x45702d,null))[_0x6ec8('0x43')](handleError(_0x45702d,null));};exports['destroy']=function(_0x373d8a,_0x5aefe7){return db[_0x6ec8('0x29')][_0x6ec8('0x46')]({'where':{'id':_0x373d8a['params']['id']}})[_0x6ec8('0x21')](handleEntityNotFound(_0x5aefe7,null))[_0x6ec8('0x21')](removeEntity(_0x5aefe7,null))['catch'](handleError(_0x5aefe7,null));};exports[_0x6ec8('0x49')]=function(_0x1d3eb8,_0x4fba9c){return db['VoiceDialReport'][_0x6ec8('0x49')]()[_0x6ec8('0x21')](respondWithResult(_0x4fba9c,null))['catch'](handleError(_0x4fba9c,null));}; \ No newline at end of file +var _0xc3e5=['to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','key','map','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','VoiceDialReport','includeAll','include','findAll','catch','show','params','keys','options','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x3121d3,_0x89bd10){var _0x3df779=function(_0x2f07ea){while(--_0x2f07ea){_0x3121d3['push'](_0x3121d3['shift']());}};_0x3df779(++_0x89bd10);}(_0xc3e5,0x13e));var _0x5c3e=function(_0x2fe2de,_0x45c467){_0x2fe2de=_0x2fe2de-0x0;var _0x590437=_0xc3e5[_0x2fe2de];return _0x590437;};'use strict';var emlformat=require(_0x5c3e('0x0'));var rimraf=require(_0x5c3e('0x1'));var zipdir=require(_0x5c3e('0x2'));var jsonpatch=require(_0x5c3e('0x3'));var rp=require('request-promise');var moment=require(_0x5c3e('0x4'));var BPromise=require(_0x5c3e('0x5'));var Mustache=require(_0x5c3e('0x6'));var util=require(_0x5c3e('0x7'));var path=require(_0x5c3e('0x8'));var sox=require(_0x5c3e('0x9'));var csv=require(_0x5c3e('0xa'));var ejs=require(_0x5c3e('0xb'));var fs=require('fs');var fs_extra=require(_0x5c3e('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5c3e('0xd'));var jsforce=require(_0x5c3e('0xe'));var deskjs=require(_0x5c3e('0xf'));var toCsv=require(_0x5c3e('0xa'));var querystring=require(_0x5c3e('0x10'));var Papa=require(_0x5c3e('0x11'));var Redis=require(_0x5c3e('0x12'));var authService=require(_0x5c3e('0x13'));var qs=require(_0x5c3e('0x14'));var as=require(_0x5c3e('0x15'));var hardwareService=require(_0x5c3e('0x16'));var logger=require(_0x5c3e('0x17'))(_0x5c3e('0x18'));var utils=require(_0x5c3e('0x19'));var config=require(_0x5c3e('0x1a'));var licenseUtil=require(_0x5c3e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d2248,_0x590d4a){_0x590d4a=_0x590d4a||0xcc;return function(_0x192d54){if(_0x192d54){return _0x3d2248[_0x5c3e('0x1c')](_0x590d4a);}return _0x3d2248[_0x5c3e('0x1d')](_0x590d4a)[_0x5c3e('0x1e')]();};}function respondWithResult(_0x178b87,_0xb1bdeb){_0xb1bdeb=_0xb1bdeb||0xc8;return function(_0x3c09d3){if(_0x3c09d3){return _0x178b87['status'](_0xb1bdeb)[_0x5c3e('0x1f')](_0x3c09d3);}};}function respondWithFilteredResult(_0x42f609,_0x4e2ef6){return function(_0x360abf){if(_0x360abf){var _0x2b2345=typeof _0x4e2ef6[_0x5c3e('0x20')]===_0x5c3e('0x21')&&typeof _0x4e2ef6[_0x5c3e('0x22')]===_0x5c3e('0x21');var _0x48f19d=_0x360abf[_0x5c3e('0x23')];var _0x2e99bf=_0x2b2345?0x0:_0x4e2ef6[_0x5c3e('0x20')];var _0xe56112=_0x2b2345?_0x360abf['count']:_0x4e2ef6[_0x5c3e('0x20')]+_0x4e2ef6[_0x5c3e('0x22')];var _0x39f475;if(_0xe56112>=_0x48f19d){_0xe56112=_0x48f19d;_0x39f475=0xc8;}else{_0x39f475=0xce;}_0x42f609[_0x5c3e('0x1d')](_0x39f475);return _0x42f609[_0x5c3e('0x24')](_0x5c3e('0x25'),_0x2e99bf+'-'+_0xe56112+'/'+_0x48f19d)[_0x5c3e('0x1f')](_0x360abf);}return null;};}function patchUpdates(_0x3114da){return function(_0x10792e){try{jsonpatch[_0x5c3e('0x26')](_0x10792e,_0x3114da,!![]);}catch(_0x3761f4){return BPromise[_0x5c3e('0x27')](_0x3761f4);}return _0x10792e[_0x5c3e('0x28')]();};}function saveUpdates(_0x15e1f2,_0xece7ff){return function(_0x3e9496){if(_0x3e9496){return _0x3e9496['update'](_0x15e1f2)['then'](function(_0x27dd66){return _0x27dd66;});}return null;};}function removeEntity(_0x11c66d,_0x1273dd){return function(_0x473e5b){if(_0x473e5b){return _0x473e5b[_0x5c3e('0x29')]()[_0x5c3e('0x2a')](function(){_0x11c66d[_0x5c3e('0x1d')](0xcc)[_0x5c3e('0x1e')]();});}};}function handleEntityNotFound(_0x2005a0,_0x3e2841){return function(_0x54c2ae){if(!_0x54c2ae){_0x2005a0[_0x5c3e('0x1c')](0x194);}return _0x54c2ae;};}function handleError(_0x3aa287,_0x35a8da){_0x35a8da=_0x35a8da||0x1f4;return function(_0x5d85f9){logger[_0x5c3e('0x2b')](_0x5d85f9[_0x5c3e('0x2c')]);if(_0x5d85f9['name']){delete _0x5d85f9[_0x5c3e('0x2d')];}_0x3aa287['status'](_0x35a8da)[_0x5c3e('0x2e')](_0x5d85f9);};}exports[_0x5c3e('0x2f')]=function(_0x4a0154,_0x32f18d){var _0x4b4cbe={},_0xf7e666={},_0x436821={'count':0x0,'rows':[]};var _0x220299=_['map'](db['VoiceDialReport'][_0x5c3e('0x30')],function(_0x2059ce){return{'name':_0x2059ce[_0x5c3e('0x31')],'type':_0x2059ce['type'][_0x5c3e('0x32')]};});_0xf7e666['model']=_[_0x5c3e('0x33')](_0x220299,'name');_0xf7e666['query']=_['keys'](_0x4a0154['query']);_0xf7e666[_0x5c3e('0x34')]=_['intersection'](_0xf7e666[_0x5c3e('0x35')],_0xf7e666[_0x5c3e('0x36')]);_0x4b4cbe[_0x5c3e('0x37')]=_[_0x5c3e('0x38')](_0xf7e666['model'],qs[_0x5c3e('0x39')](_0x4a0154[_0x5c3e('0x36')][_0x5c3e('0x39')]));_0x4b4cbe[_0x5c3e('0x37')]=_0x4b4cbe['attributes'][_0x5c3e('0x3a')]?_0x4b4cbe[_0x5c3e('0x37')]:_0xf7e666[_0x5c3e('0x35')];if(!_0x4a0154[_0x5c3e('0x36')][_0x5c3e('0x3b')](_0x5c3e('0x3c'))){_0x4b4cbe[_0x5c3e('0x22')]=qs[_0x5c3e('0x22')](_0x4a0154[_0x5c3e('0x36')][_0x5c3e('0x22')]);_0x4b4cbe[_0x5c3e('0x20')]=qs[_0x5c3e('0x20')](_0x4a0154[_0x5c3e('0x36')][_0x5c3e('0x20')]);}_0x4b4cbe[_0x5c3e('0x3d')]=qs[_0x5c3e('0x3e')](_0x4a0154[_0x5c3e('0x36')][_0x5c3e('0x3e')]);_0x4b4cbe[_0x5c3e('0x3f')]=qs[_0x5c3e('0x34')](_['pick'](_0x4a0154[_0x5c3e('0x36')],_0xf7e666[_0x5c3e('0x34')]),_0x220299);if(_0x4a0154[_0x5c3e('0x36')][_0x5c3e('0x40')]){_0x4b4cbe[_0x5c3e('0x3f')]=_[_0x5c3e('0x41')](_0x4b4cbe[_0x5c3e('0x3f')],{'$or':_[_0x5c3e('0x33')](_0x220299,function(_0x585285){if(_0x585285[_0x5c3e('0x42')]!==_0x5c3e('0x43')){var _0x4dc37b={};_0x4dc37b[_0x585285[_0x5c3e('0x2d')]]={'$like':'%'+_0x4a0154[_0x5c3e('0x36')]['filter']+'%'};return _0x4dc37b;}})});}_0x4b4cbe=_[_0x5c3e('0x41')]({},_0x4b4cbe,_0x4a0154['options']);var _0x154b4d={'where':_0x4b4cbe[_0x5c3e('0x3f')]};return db[_0x5c3e('0x44')][_0x5c3e('0x23')](_0x154b4d)[_0x5c3e('0x2a')](function(_0x46d580){_0x436821[_0x5c3e('0x23')]=_0x46d580;if(_0x4a0154[_0x5c3e('0x36')][_0x5c3e('0x45')]){_0x4b4cbe[_0x5c3e('0x46')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x5c3e('0x47')](_0x4b4cbe);})[_0x5c3e('0x2a')](function(_0x2823da){_0x436821['rows']=_0x2823da;return _0x436821;})[_0x5c3e('0x2a')](respondWithFilteredResult(_0x32f18d,_0x4b4cbe))[_0x5c3e('0x48')](handleError(_0x32f18d,null));};exports[_0x5c3e('0x49')]=function(_0x531ef8,_0x531850){var _0x8481aa={'raw':!![],'where':{'id':_0x531ef8[_0x5c3e('0x4a')]['id']}},_0x3b7a01={};_0x3b7a01[_0x5c3e('0x35')]=_[_0x5c3e('0x4b')](db[_0x5c3e('0x44')][_0x5c3e('0x30')]);_0x3b7a01['query']=_['keys'](_0x531ef8[_0x5c3e('0x36')]);_0x3b7a01['filters']=_['intersection'](_0x3b7a01[_0x5c3e('0x35')],_0x3b7a01[_0x5c3e('0x36')]);_0x8481aa[_0x5c3e('0x37')]=_['intersection'](_0x3b7a01['model'],qs[_0x5c3e('0x39')](_0x531ef8['query'][_0x5c3e('0x39')]));_0x8481aa[_0x5c3e('0x37')]=_0x8481aa[_0x5c3e('0x37')][_0x5c3e('0x3a')]?_0x8481aa['attributes']:_0x3b7a01[_0x5c3e('0x35')];if(_0x531ef8[_0x5c3e('0x36')][_0x5c3e('0x45')]){_0x8481aa['include']=[{'all':!![]}];}_0x8481aa=_[_0x5c3e('0x41')]({},_0x8481aa,_0x531ef8[_0x5c3e('0x4c')]);return db[_0x5c3e('0x44')]['find'](_0x8481aa)[_0x5c3e('0x2a')](handleEntityNotFound(_0x531850,null))[_0x5c3e('0x2a')](respondWithResult(_0x531850,null))[_0x5c3e('0x48')](handleError(_0x531850,null));};exports['create']=function(_0x2baece,_0x487995){return db[_0x5c3e('0x44')][_0x5c3e('0x4d')](_0x2baece[_0x5c3e('0x4e')],{})[_0x5c3e('0x2a')](respondWithResult(_0x487995,0xc9))[_0x5c3e('0x48')](handleError(_0x487995,null));};exports[_0x5c3e('0x4f')]=function(_0x14061d,_0x33b08c){if(_0x14061d['body']['id']){delete _0x14061d[_0x5c3e('0x4e')]['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0x14061d[_0x5c3e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x33b08c,null))[_0x5c3e('0x2a')](saveUpdates(_0x14061d[_0x5c3e('0x4e')],null))['then'](respondWithResult(_0x33b08c,null))[_0x5c3e('0x48')](handleError(_0x33b08c,null));};exports['destroy']=function(_0x342ccf,_0x225c53){return db[_0x5c3e('0x44')][_0x5c3e('0x50')]({'where':{'id':_0x342ccf[_0x5c3e('0x4a')]['id']}})[_0x5c3e('0x2a')](handleEntityNotFound(_0x225c53,null))[_0x5c3e('0x2a')](removeEntity(_0x225c53,null))[_0x5c3e('0x48')](handleError(_0x225c53,null));};exports[_0x5c3e('0x51')]=function(_0x344c23,_0x1822f5){return db[_0x5c3e('0x44')][_0x5c3e('0x51')]()[_0x5c3e('0x2a')](respondWithResult(_0x1822f5,null))[_0x5c3e('0x48')](handleError(_0x1822f5,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index ab1e7a1..59777ae 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 _0xae17=['./voiceDialReport.attributes','exports','define','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x57cc22,_0x2d351f){var _0x6f7bdc=function(_0x4935b5){while(--_0x4935b5){_0x57cc22['push'](_0x57cc22['shift']());}};_0x6f7bdc(++_0x2d351f);}(_0xae17,0x171));var _0x7ae1=function(_0x4e968c,_0x20b36c){_0x4e968c=_0x4e968c-0x0;var _0x53ec88=_0xae17[_0x4e968c];return _0x53ec88;};'use strict';var _=require(_0x7ae1('0x0'));var util=require(_0x7ae1('0x1'));var logger=require(_0x7ae1('0x2'))(_0x7ae1('0x3'));var moment=require(_0x7ae1('0x4'));var BPromise=require('bluebird');var rp=require(_0x7ae1('0x5'));var fs=require('fs');var path=require(_0x7ae1('0x6'));var rimraf=require(_0x7ae1('0x7'));var config=require(_0x7ae1('0x8'));var attributes=require(_0x7ae1('0x9'));module[_0x7ae1('0xa')]=function(_0x1d7156,_0x3efc25){return _0x1d7156[_0x7ae1('0xb')]('VoiceDialReport',attributes,{'tableName':_0x7ae1('0xc'),'paranoid':![],'indexes':[{'fields':[_0x7ae1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8250=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./voiceDialReport.attributes','define','report_dial'];(function(_0x388a6e,_0xb3af14){var _0x53c774=function(_0x2776ea){while(--_0x2776ea){_0x388a6e['push'](_0x388a6e['shift']());}};_0x53c774(++_0xb3af14);}(_0x8250,0xfa));var _0x0825=function(_0x2ee0e0,_0x1e0a09){_0x2ee0e0=_0x2ee0e0-0x0;var _0x4ca938=_0x8250[_0x2ee0e0];return _0x4ca938;};'use strict';var _=require(_0x0825('0x0'));var util=require(_0x0825('0x1'));var logger=require(_0x0825('0x2'))(_0x0825('0x3'));var moment=require('moment');var BPromise=require(_0x0825('0x4'));var rp=require(_0x0825('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0825('0x6'));var config=require('../../config/environment');var attributes=require(_0x0825('0x7'));module['exports']=function(_0x18733,_0x1a3bf8){return _0x18733[_0x0825('0x8')]('VoiceDialReport',attributes,{'tableName':_0x0825('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index a82074a..a6bac9e 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 _0xaac2=['then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VoiceDialReport','create','body','raw','CreateVoiceDialReport','UpdateVoiceDialReport','options','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x156a0d,_0x3946ce){var _0x98a9ba=function(_0x46c1b2){while(--_0x46c1b2){_0x156a0d['push'](_0x156a0d['shift']());}};_0x98a9ba(++_0x3946ce);}(_0xaac2,0xb5));var _0x2aac=function(_0xa1146e,_0x6af580){_0xa1146e=_0xa1146e-0x0;var _0x427e13=_0xaac2[_0xa1146e];return _0x427e13;};'use strict';var _=require(_0x2aac('0x0'));var util=require(_0x2aac('0x1'));var moment=require(_0x2aac('0x2'));var BPromise=require(_0x2aac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2aac('0x4'));var db=require(_0x2aac('0x5'))['db'];var utils=require(_0x2aac('0x6'));var logger=require(_0x2aac('0x7'))(_0x2aac('0x8'));var config=require(_0x2aac('0x9'));var jayson=require(_0x2aac('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1e7ee3,_0x1ea7f6,_0x5baef7){return new BPromise(function(_0x5667aa,_0x307988){return client['request'](_0x1e7ee3,_0x5baef7)[_0x2aac('0xb')](function(_0x3e0d81){logger[_0x2aac('0xc')](_0x2aac('0xd'),_0x1ea7f6,_0x2aac('0xe'));logger[_0x2aac('0xf')](_0x2aac('0x10'),_0x1ea7f6,'request\x20sent',JSON[_0x2aac('0x11')](_0x3e0d81));if(_0x3e0d81[_0x2aac('0x12')]){if(_0x3e0d81[_0x2aac('0x12')][_0x2aac('0x13')]===0x1f4){logger[_0x2aac('0x12')](_0x2aac('0xd'),_0x1ea7f6,_0x3e0d81['error'][_0x2aac('0x14')]);return _0x307988(_0x3e0d81['error']['message']);}logger[_0x2aac('0x12')](_0x2aac('0xd'),_0x1ea7f6,_0x3e0d81[_0x2aac('0x12')]['message']);return _0x5667aa(_0x3e0d81[_0x2aac('0x12')][_0x2aac('0x14')]);}else{logger[_0x2aac('0xc')](_0x2aac('0xd'),_0x1ea7f6,_0x2aac('0xe'));_0x5667aa(_0x3e0d81['result'][_0x2aac('0x14')]);}})[_0x2aac('0x15')](function(_0x2e3a30){logger[_0x2aac('0x12')](_0x2aac('0xd'),_0x1ea7f6,_0x2e3a30);_0x307988(_0x2e3a30);});});}exports['CreateVoiceDialReport']=function(_0x5ce44a){var _0x425f7c=this;return new Promise(function(_0x14c264,_0xaf3c91){return db[_0x2aac('0x16')][_0x2aac('0x17')](_0x5ce44a[_0x2aac('0x18')],{'raw':_0x5ce44a['options']?_0x5ce44a['options'][_0x2aac('0x19')]===undefined?!![]:![]:!![]})[_0x2aac('0xb')](function(_0x3e927b){logger[_0x2aac('0xc')](_0x2aac('0x1a'),_0x5ce44a);logger[_0x2aac('0xf')](_0x2aac('0x1a'),_0x5ce44a,JSON[_0x2aac('0x11')](_0x3e927b));_0x14c264(_0x3e927b);})['catch'](function(_0x16e3b0){logger[_0x2aac('0x12')]('CreateVoiceDialReport',_0x16e3b0[_0x2aac('0x14')],_0x5ce44a);_0xaf3c91(_0x425f7c[_0x2aac('0x12')](0x1f4,_0x16e3b0[_0x2aac('0x14')]));});});};exports[_0x2aac('0x1b')]=function(_0x5fa2d6){var _0x1e2e0b=this;return new Promise(function(_0x16fa11,_0x1e3643){return db['VoiceDialReport']['update'](_0x5fa2d6['body'],{'raw':_0x5fa2d6[_0x2aac('0x1c')]?_0x5fa2d6[_0x2aac('0x1c')][_0x2aac('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5fa2d6[_0x2aac('0x1c')]?_0x5fa2d6['options'][_0x2aac('0x1d')]||null:null,'attributes':_0x5fa2d6[_0x2aac('0x1c')]?_0x5fa2d6[_0x2aac('0x1c')][_0x2aac('0x1e')]||null:null,'limit':_0x5fa2d6[_0x2aac('0x1c')]?_0x5fa2d6[_0x2aac('0x1c')][_0x2aac('0x1f')]||null:null})['then'](function(_0x151b80){logger[_0x2aac('0xc')](_0x2aac('0x1b'),_0x5fa2d6);logger['debug']('UpdateVoiceDialReport',_0x5fa2d6,JSON[_0x2aac('0x11')](_0x151b80));_0x16fa11(_0x151b80);})[_0x2aac('0x15')](function(_0x3fce70){logger['error'](_0x2aac('0x1b'),_0x3fce70[_0x2aac('0x14')],_0x5fa2d6);_0x1e3643(_0x1e2e0b['error'](0x1f4,_0x3fce70[_0x2aac('0x14')]));});});}; \ No newline at end of file +var _0xbc78=['http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','attributes','limit','stringify','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x2628ba,_0x565f76){var _0x3666c3=function(_0x3c7279){while(--_0x3c7279){_0x2628ba['push'](_0x2628ba['shift']());}};_0x3666c3(++_0x565f76);}(_0xbc78,0xb1));var _0x8bc7=function(_0xf4caa3,_0x20107b){_0xf4caa3=_0xf4caa3-0x0;var _0x58ded2=_0xbc78[_0xf4caa3];return _0x58ded2;};'use strict';var _=require(_0x8bc7('0x0'));var util=require(_0x8bc7('0x1'));var moment=require(_0x8bc7('0x2'));var BPromise=require(_0x8bc7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bc7('0x4'))['db'];var utils=require(_0x8bc7('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x8bc7('0x6'));var jayson=require(_0x8bc7('0x7'));var client=jayson[_0x8bc7('0x8')][_0x8bc7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8770a8,_0x9d8d4,_0xde4f05){return new BPromise(function(_0x4f40fc,_0x1a5057){return client[_0x8bc7('0xa')](_0x8770a8,_0xde4f05)[_0x8bc7('0xb')](function(_0x2ce8ab){logger[_0x8bc7('0xc')](_0x8bc7('0xd'),_0x9d8d4,_0x8bc7('0xe'));logger[_0x8bc7('0xf')](_0x8bc7('0x10'),_0x9d8d4,_0x8bc7('0xe'),JSON['stringify'](_0x2ce8ab));if(_0x2ce8ab['error']){if(_0x2ce8ab[_0x8bc7('0x11')]['code']===0x1f4){logger['error'](_0x8bc7('0xd'),_0x9d8d4,_0x2ce8ab[_0x8bc7('0x11')]['message']);return _0x1a5057(_0x2ce8ab[_0x8bc7('0x11')][_0x8bc7('0x12')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x9d8d4,_0x2ce8ab[_0x8bc7('0x11')]['message']);return _0x4f40fc(_0x2ce8ab[_0x8bc7('0x11')][_0x8bc7('0x12')]);}else{logger['info'](_0x8bc7('0xd'),_0x9d8d4,'request\x20sent');_0x4f40fc(_0x2ce8ab[_0x8bc7('0x13')]['message']);}})[_0x8bc7('0x14')](function(_0x151b8d){logger[_0x8bc7('0x11')](_0x8bc7('0xd'),_0x9d8d4,_0x151b8d);_0x1a5057(_0x151b8d);});});}exports[_0x8bc7('0x15')]=function(_0x4e66c2){var _0x565a75=this;return new Promise(function(_0x401dd1,_0x1b52ca){return db[_0x8bc7('0x16')][_0x8bc7('0x17')](_0x4e66c2[_0x8bc7('0x18')],{'raw':_0x4e66c2[_0x8bc7('0x19')]?_0x4e66c2[_0x8bc7('0x19')][_0x8bc7('0x1a')]===undefined?!![]:![]:!![]})[_0x8bc7('0xb')](function(_0x52ef57){logger[_0x8bc7('0xc')](_0x8bc7('0x15'),_0x4e66c2);logger['debug']('CreateVoiceDialReport',_0x4e66c2,JSON['stringify'](_0x52ef57));_0x401dd1(_0x52ef57);})['catch'](function(_0x3e16dc){logger[_0x8bc7('0x11')](_0x8bc7('0x15'),_0x3e16dc['message'],_0x4e66c2);_0x1b52ca(_0x565a75['error'](0x1f4,_0x3e16dc['message']));});});};exports[_0x8bc7('0x1b')]=function(_0x2880fc){var _0x1b6c27=this;return new Promise(function(_0x1df05f,_0x6ed07e){return db[_0x8bc7('0x16')]['update'](_0x2880fc[_0x8bc7('0x18')],{'raw':_0x2880fc[_0x8bc7('0x19')]?_0x2880fc[_0x8bc7('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2880fc[_0x8bc7('0x19')]?_0x2880fc[_0x8bc7('0x19')]['where']||null:null,'attributes':_0x2880fc[_0x8bc7('0x19')]?_0x2880fc[_0x8bc7('0x19')][_0x8bc7('0x1c')]||null:null,'limit':_0x2880fc[_0x8bc7('0x19')]?_0x2880fc['options'][_0x8bc7('0x1d')]||null:null})[_0x8bc7('0xb')](function(_0x37b725){logger[_0x8bc7('0xc')](_0x8bc7('0x1b'),_0x2880fc);logger['debug'](_0x8bc7('0x1b'),_0x2880fc,JSON[_0x8bc7('0x1e')](_0x37b725));_0x1df05f(_0x37b725);})[_0x8bc7('0x14')](function(_0x265db6){logger[_0x8bc7('0x11')](_0x8bc7('0x1b'),_0x265db6[_0x8bc7('0x12')],_0x2880fc);_0x6ed07e(_0x1b6c27[_0x8bc7('0x11')](0x1f4,_0x265db6[_0x8bc7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 253b475..11f4977 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 _0xb969=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','show','create','post','/:id/applications','put','update','delete'];(function(_0x59e91f,_0x232a45){var _0xbdf1b3=function(_0x3b46ff){while(--_0x3b46ff){_0x59e91f['push'](_0x59e91f['shift']());}};_0xbdf1b3(++_0x232a45);}(_0xb969,0xc8));var _0x9b96=function(_0x46f064,_0x1a821){_0x46f064=_0x46f064-0x0;var _0xd66e7a=_0xb969[_0x46f064];return _0xd66e7a;};'use strict';var multer=require(_0x9b96('0x0'));var util=require(_0x9b96('0x1'));var path=require(_0x9b96('0x2'));var timeout=require(_0x9b96('0x3'));var express=require(_0x9b96('0x4'));var router=express[_0x9b96('0x5')]();var fs_extra=require(_0x9b96('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9b96('0x7'));var config=require(_0x9b96('0x8'));var controller=require(_0x9b96('0x9'));router[_0x9b96('0xa')]('/',auth[_0x9b96('0xb')](),controller['index']);router[_0x9b96('0xa')](_0x9b96('0xc'),auth[_0x9b96('0xb')](),controller[_0x9b96('0xd')]);router['post']('/',auth[_0x9b96('0xb')](),controller[_0x9b96('0xe')]);router[_0x9b96('0xf')](_0x9b96('0x10'),auth[_0x9b96('0xb')](),controller['addApplications']);router[_0x9b96('0x11')](_0x9b96('0xc'),auth['isAuthenticated'](),controller[_0x9b96('0x12')]);router[_0x9b96('0x13')](_0x9b96('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdbd3=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','create','/:id/applications','addApplications','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x51f28b,_0x5750b1){var _0xad39ff=function(_0x4dc9ca){while(--_0x4dc9ca){_0x51f28b['push'](_0x51f28b['shift']());}};_0xad39ff(++_0x5750b1);}(_0xdbd3,0x123));var _0x3dbd=function(_0x51ab83,_0x2721b9){_0x51ab83=_0x51ab83-0x0;var _0x14b6de=_0xdbd3[_0x51ab83];return _0x14b6de;};'use strict';var multer=require(_0x3dbd('0x0'));var util=require('util');var path=require(_0x3dbd('0x1'));var timeout=require(_0x3dbd('0x2'));var express=require(_0x3dbd('0x3'));var router=express[_0x3dbd('0x4')]();var fs_extra=require(_0x3dbd('0x5'));var auth=require(_0x3dbd('0x6'));var interaction=require(_0x3dbd('0x7'));var config=require(_0x3dbd('0x8'));var controller=require(_0x3dbd('0x9'));router[_0x3dbd('0xa')]('/',auth[_0x3dbd('0xb')](),controller[_0x3dbd('0xc')]);router[_0x3dbd('0xa')](_0x3dbd('0xd'),auth[_0x3dbd('0xb')](),controller['show']);router['post']('/',auth[_0x3dbd('0xb')](),controller[_0x3dbd('0xe')]);router['post'](_0x3dbd('0xf'),auth['isAuthenticated'](),controller[_0x3dbd('0x10')]);router[_0x3dbd('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3dbd('0x12')]);router[_0x3dbd('0x13')](_0x3dbd('0xd'),auth[_0x3dbd('0xb')](),controller['destroy']);module[_0x3dbd('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 82b644f..7135c6e 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 _0x0713=['internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','STRING','compositeIndex','NoOp','ENUM','inbound','outbound'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'priority':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':_0x3071('0x2')},'appdata':{'type':Sequelize[_0x3071('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3071('0x3')](_0x3071('0x4'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x3071('0x0')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3071('0xb')},'IntervalId':{'type':Sequelize[_0x3071('0xc')]},'isApp':{'type':Sequelize[_0x3071('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x3071('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0x3071('0x0')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3071('0xc')]},'recordingFormat':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0xe')},'answer':{'type':Sequelize[_0x3071('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x3071('0xf')],'get':function(){return this['getDataValue']('exten');}}}; \ No newline at end of file +var _0x0713=['internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','STRING','compositeIndex','NoOp','ENUM','inbound','outbound'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'priority':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':_0x3071('0x2')},'appdata':{'type':Sequelize[_0x3071('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3071('0x3')](_0x3071('0x4'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x3071('0x0')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3071('0xb')},'IntervalId':{'type':Sequelize[_0x3071('0xc')]},'isApp':{'type':Sequelize[_0x3071('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x3071('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0x3071('0x0')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3071('0xc')]},'recordingFormat':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0xe')},'answer':{'type':Sequelize[_0x3071('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x3071('0xf')],'get':function(){return this['getDataValue']('exten');}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 74fd9af..1236abc 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 _0xd165=['send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','merge','options','VoiceExtension','includeAll','include','findAll','rows','catch','show','params','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','InternalRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','sequelize','transaction','ISOLATION_LEVELS','findOne','isApp','createRouting','cast(priority\x20as\x20unsigned)','stack','finally','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','./voiceExtension.socket','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','destroy','then','get','inbound','OutboundRoutes','outbound','internal','filter','map','value','includes','type','find','UserProfileResource','error','name'];(function(_0x36e55e,_0x3b6286){var _0x5981a2=function(_0x3f5b7a){while(--_0x3f5b7a){_0x36e55e['push'](_0x36e55e['shift']());}};_0x5981a2(++_0x3b6286);}(_0xd165,0x1f0));var _0x5d16=function(_0x4e8583,_0x5a8c5a){_0x4e8583=_0x4e8583-0x0;var _0x1f151b=_0xd165[_0x4e8583];return _0x1f151b;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x5d16('0x0'));var logger=require(_0x5d16('0x1'))(_0x5d16('0x2'));var config=require('../../config/environment');var db=require(_0x5d16('0x3'))['db'];config[_0x5d16('0x4')]=_[_0x5d16('0x5')](config[_0x5d16('0x4')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5d16('0x4')]));require(_0x5d16('0x6'))['register'](socket);function respondWithStatusCode(_0xdd1ffe,_0x2de2ca){_0x2de2ca=_0x2de2ca||0xcc;return function(_0x13ed13){if(_0x13ed13){return _0xdd1ffe[_0x5d16('0x7')](_0x2de2ca);}return _0xdd1ffe[_0x5d16('0x8')](_0x2de2ca)[_0x5d16('0x9')]();};}function respondWithResult(_0x7c7d87,_0x3cc92c){_0x3cc92c=_0x3cc92c||0xc8;return function(_0x3f71d4){if(_0x3f71d4){return _0x7c7d87[_0x5d16('0x8')](_0x3cc92c)[_0x5d16('0xa')](_0x3f71d4);}};}function respondWithFilteredResult(_0x2ee429,_0x4d7cb3){return function(_0x5e395a){if(_0x5e395a){var _0x377295=typeof _0x4d7cb3[_0x5d16('0xb')]===_0x5d16('0xc')&&typeof _0x4d7cb3[_0x5d16('0xd')]===_0x5d16('0xc');var _0x506750=_0x5e395a[_0x5d16('0xe')];var _0x610719=_0x377295?0x0:_0x4d7cb3[_0x5d16('0xb')];var _0x4f9cc9=_0x377295?_0x5e395a[_0x5d16('0xe')]:_0x4d7cb3[_0x5d16('0xb')]+_0x4d7cb3[_0x5d16('0xd')];var _0x1a9763;if(_0x4f9cc9>=_0x506750){_0x4f9cc9=_0x506750;_0x1a9763=0xc8;}else{_0x1a9763=0xce;}_0x2ee429[_0x5d16('0x8')](_0x1a9763);return _0x2ee429['set'](_0x5d16('0xf'),_0x610719+'-'+_0x4f9cc9+'/'+_0x506750)[_0x5d16('0xa')](_0x5e395a);}return null;};}function removeEntity(_0x5370c5){return function(_0x454961){if(_0x454961){return _0x454961[_0x5d16('0x10')]()[_0x5d16('0x11')](function(){var _0x56a54a=_0x454961[_0x5d16('0x12')]({'plain':!![]});var _0xde4eaa=[{'name':'InboundRoutes','value':_0x5d16('0x13'),'ignore':![]},{'name':_0x5d16('0x14'),'value':_0x5d16('0x15'),'ignore':![]},{'name':'InternalRoutes','value':_0x5d16('0x16'),'ignore':![]}];var _0x2929bc=_(_0xde4eaa)[_0x5d16('0x17')]('ignore')[_0x5d16('0x18')]('value')[_0x5d16('0x19')]();if(_[_0x5d16('0x1a')](_0x2929bc,_0x56a54a[_0x5d16('0x1b')])){return;}var _0x56c8a3=_[_0x5d16('0x1c')](_0xde4eaa,[_0x5d16('0x19'),_0x56a54a['type']])['name'];return db[_0x5d16('0x1d')][_0x5d16('0x10')]({'where':{'type':_0x56c8a3,'resourceId':_0x56a54a['id']}})[_0x5d16('0x11')](function(){return _0x454961;});})['then'](function(){_0x5370c5['status'](0xcc)[_0x5d16('0x9')]();});}};}function handleEntityNotFound(_0x49cbe9){return function(_0x5dd47e){if(!_0x5dd47e){_0x49cbe9[_0x5d16('0x7')](0x194);}return _0x5dd47e;};}function handleError(_0x540503,_0x1a25b3){_0x1a25b3=_0x1a25b3||0x1f4;return function(_0x1d2859){logger[_0x5d16('0x1e')](_0x1d2859['stack']);if(_0x1d2859[_0x5d16('0x1f')]){delete _0x1d2859[_0x5d16('0x1f')];}_0x540503[_0x5d16('0x8')](_0x1a25b3)[_0x5d16('0x20')](_0x1d2859);};}exports[_0x5d16('0x21')]=function(_0x2dcfcd,_0x18d5c4){var _0x12f209={},_0x5d12ff={},_0x145bcd={'count':0x0,'rows':[]};var _0x386566=_[_0x5d16('0x18')](db['VoiceExtension'][_0x5d16('0x22')],function(_0x4d3487){return{'name':_0x4d3487[_0x5d16('0x23')],'type':_0x4d3487[_0x5d16('0x1b')][_0x5d16('0x24')]};});_0x5d12ff[_0x5d16('0x25')]=_['map'](_0x386566,_0x5d16('0x1f'));_0x5d12ff[_0x5d16('0x26')]=_[_0x5d16('0x27')](_0x2dcfcd[_0x5d16('0x26')]);_0x5d12ff[_0x5d16('0x28')]=_[_0x5d16('0x29')](_0x5d12ff['model'],_0x5d12ff[_0x5d16('0x26')]);_0x12f209['attributes']=_[_0x5d16('0x29')](_0x5d12ff['model'],qs[_0x5d16('0x2a')](_0x2dcfcd[_0x5d16('0x26')][_0x5d16('0x2a')]));_0x12f209[_0x5d16('0x2b')]=_0x12f209[_0x5d16('0x2b')][_0x5d16('0x2c')]?_0x12f209[_0x5d16('0x2b')]:_0x5d12ff[_0x5d16('0x25')];if(!_0x2dcfcd[_0x5d16('0x26')]['hasOwnProperty'](_0x5d16('0x2d'))){_0x12f209[_0x5d16('0xd')]=qs[_0x5d16('0xd')](_0x2dcfcd[_0x5d16('0x26')]['limit']);_0x12f209[_0x5d16('0xb')]=qs['offset'](_0x2dcfcd['query'][_0x5d16('0xb')]);}_0x12f209['order']=qs[_0x5d16('0x2e')](_0x2dcfcd['query'][_0x5d16('0x2e')]);_0x12f209[_0x5d16('0x2f')]=qs[_0x5d16('0x28')](_[_0x5d16('0x30')](_0x2dcfcd[_0x5d16('0x26')],_0x5d12ff[_0x5d16('0x28')]),_0x386566);if(_0x2dcfcd[_0x5d16('0x26')][_0x5d16('0x17')]){_0x12f209[_0x5d16('0x2f')]=_[_0x5d16('0x31')](_0x12f209[_0x5d16('0x2f')],{'$or':_['map'](_0x386566,function(_0x5f5e01){if(_0x5f5e01['type']!=='VIRTUAL'){var _0x3e9ca2={};_0x3e9ca2[_0x5f5e01[_0x5d16('0x1f')]]={'$like':'%'+_0x2dcfcd['query']['filter']+'%'};return _0x3e9ca2;}})});}_0x12f209=_['merge']({},_0x12f209,_0x2dcfcd[_0x5d16('0x32')]);var _0x37d507={'where':_0x12f209[_0x5d16('0x2f')]};return db[_0x5d16('0x33')][_0x5d16('0xe')](_0x37d507)[_0x5d16('0x11')](function(_0x48103c){_0x145bcd[_0x5d16('0xe')]=_0x48103c;if(_0x2dcfcd['query'][_0x5d16('0x34')]){_0x12f209[_0x5d16('0x35')]=[{'all':!![]}];}return db[_0x5d16('0x33')][_0x5d16('0x36')](_0x12f209);})[_0x5d16('0x11')](function(_0x3578f0){_0x145bcd[_0x5d16('0x37')]=_0x3578f0;return _0x145bcd;})['then'](respondWithFilteredResult(_0x18d5c4,_0x12f209))[_0x5d16('0x38')](handleError(_0x18d5c4,null));};exports[_0x5d16('0x39')]=function(_0x127929,_0x5aa41c){var _0x3b5349={'raw':![],'where':{'id':_0x127929['params']['id']}},_0x3c1be2={};_0x3c1be2[_0x5d16('0x25')]=_['keys'](db['VoiceExtension'][_0x5d16('0x22')]);_0x3c1be2[_0x5d16('0x26')]=_[_0x5d16('0x27')](_0x127929[_0x5d16('0x26')]);_0x3c1be2[_0x5d16('0x28')]=_[_0x5d16('0x29')](_0x3c1be2['model'],_0x3c1be2[_0x5d16('0x26')]);_0x3b5349[_0x5d16('0x2b')]=_[_0x5d16('0x29')](_0x3c1be2[_0x5d16('0x25')],qs[_0x5d16('0x2a')](_0x127929[_0x5d16('0x26')]['fields']));_0x3b5349[_0x5d16('0x2b')]=_0x3b5349[_0x5d16('0x2b')]['length']?_0x3b5349[_0x5d16('0x2b')]:_0x3c1be2['model'];if(_0x127929[_0x5d16('0x26')][_0x5d16('0x34')]){_0x3b5349['include']=[{'all':!![]}];}_0x3b5349=_[_0x5d16('0x31')]({},_0x3b5349,_0x127929[_0x5d16('0x32')]);return db[_0x5d16('0x33')][_0x5d16('0x1c')](_0x3b5349)['then'](handleEntityNotFound(_0x5aa41c,null))[_0x5d16('0x11')](respondWithResult(_0x5aa41c,null))[_0x5d16('0x38')](handleError(_0x5aa41c,null));};exports[_0x5d16('0x10')]=function(_0x94673f,_0x455b2d){return db[_0x5d16('0x33')][_0x5d16('0x1c')]({'where':{'id':_0x94673f[_0x5d16('0x3a')]['id']}})[_0x5d16('0x11')](handleEntityNotFound(_0x455b2d,null))[_0x5d16('0x11')](removeEntity(_0x455b2d,null))[_0x5d16('0x38')](handleError(_0x455b2d,null));};exports[_0x5d16('0x3b')]=function(_0x4fef85,_0x1c9794){if(_0x4fef85[_0x5d16('0x3c')]['type']==='outbound'&&!_[_0x5d16('0x3d')](_0x4fef85[_0x5d16('0x3c')][_0x5d16('0x3e')],'_')){_0x4fef85[_0x5d16('0x3c')][_0x5d16('0x3e')]='_'[_0x5d16('0x3f')](_0x4fef85[_0x5d16('0x3c')][_0x5d16('0x3e')]);}return db[_0x5d16('0x33')]['create'](_0x4fef85[_0x5d16('0x3c')],{'raw':![]})[_0x5d16('0x11')](function(_0x551761){var _0x22eb22=_0x4fef85[_0x5d16('0x40')][_0x5d16('0x12')]({'plain':!![]});if(!_0x22eb22)throw new Error(_0x5d16('0x41'));if(_0x22eb22[_0x5d16('0x42')]===_0x5d16('0x40')){var _0x34989f=_0x551761[_0x5d16('0x12')]({'plain':!![]});var _0x3aebc5=[{'name':_0x5d16('0x43'),'value':_0x5d16('0x13')},{'name':_0x5d16('0x14'),'value':_0x5d16('0x15')},{'name':_0x5d16('0x44'),'value':_0x5d16('0x16')}];var _0x4077e8=_[_0x5d16('0x1c')](_0x3aebc5,['value',_0x34989f[_0x5d16('0x1b')]])[_0x5d16('0x1f')];return db[_0x5d16('0x45')][_0x5d16('0x1c')]({'where':{'name':_0x4077e8,'userProfileId':_0x22eb22[_0x5d16('0x46')]},'raw':!![]})[_0x5d16('0x11')](function(_0x47e824){if(_0x47e824&&_0x47e824[_0x5d16('0x47')]===0x0){return db[_0x5d16('0x1d')]['create']({'name':_0x34989f[_0x5d16('0x1f')],'resourceId':_0x34989f['id'],'type':_0x47e824['name'],'sectionId':_0x47e824['id']},{})['then'](function(){return _0x551761;});}else{return _0x551761;}})[_0x5d16('0x38')](function(_0x472618){logger[_0x5d16('0x1e')](_0x5d16('0x48'),_0x472618);throw _0x472618;});}return _0x551761;})[_0x5d16('0x11')](respondWithResult(_0x1c9794,0xc9))[_0x5d16('0x38')](handleError(_0x1c9794,null));};exports['update']=function(_0x3dbb72,_0x44da7a){if(_0x3dbb72[_0x5d16('0x3c')]['id']){delete _0x3dbb72[_0x5d16('0x3c')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x3dbb72[_0x5d16('0x3a')]['id']}})[_0x5d16('0x11')](handleEntityNotFound(_0x44da7a,null))['then'](function(_0x1eec93){if(_0x1eec93){return db[_0x5d16('0x33')]['update'](_[_0x5d16('0x30')](_0x3dbb72[_0x5d16('0x3c')],['exten',_0x5d16('0x49'),_0x5d16('0x4a'),_0x5d16('0x4b'),_0x5d16('0x4c'),_0x5d16('0x4d'),_0x5d16('0x4e')]),{'where':{'context':_0x1eec93[_0x5d16('0x49')],'exten':_0x1eec93[_0x5d16('0x3e')]},'individualHooks':!![]})['then'](function(_0x2204c1){return _0x2204c1;});}return null;})[_0x5d16('0x11')](respondWithStatusCode(_0x44da7a,null))['catch'](handleError(_0x44da7a,null));};exports['addApplications']=function(_0x3b07af,_0x3c9378){var _0x463943=_0x3b07af[_0x5d16('0x3a')]['id'];var _0x14ea9e=_0x3b07af[_0x5d16('0x3c')];var _0x208c86=0xc8;var _0xef728a=null;return db[_0x5d16('0x4f')][_0x5d16('0x50')]({'isolationLevel':db[_0x5d16('0x4f')]['Transaction'][_0x5d16('0x51')]['READ_COMMITTED']},function(_0x2b956f){return db[_0x5d16('0x33')][_0x5d16('0x52')]({'where':{'id':_0x463943},'transaction':_0x2b956f})[_0x5d16('0x11')](function(_0x4c49d3){if(_0x4c49d3){return db[_0x5d16('0x33')][_0x5d16('0x10')]({'where':{'VoiceExtensionId':_0x463943},'transaction':_0x2b956f})['then'](function(){var _0x32962c=_['map'](_0x14ea9e,function(_0x7a39fc){_0x7a39fc['VoiceExtensionId']=_0x463943;_0x7a39fc[_0x5d16('0x53')]=!![];return _0x7a39fc;});return _0x4c49d3[_0x5d16('0x54')](_0x32962c);})[_0x5d16('0x11')](function(_0x11dc54){return db[_0x5d16('0x33')]['bulkCreate'](_0x11dc54,{'transaction':_0x2b956f});});}else{_0x208c86=0x194;_0xef728a=[];}});})[_0x5d16('0x11')](function(){if(_0x208c86!==0x194){return db[_0x5d16('0x33')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x463943},'order':_0x5d16('0x55')})['then'](function(_0x2597c8){_0xef728a=_0x2597c8;});}})['catch'](function(_0x301373){_0x208c86=0x1f4;logger[_0x5d16('0x1e')](_0x301373[_0x5d16('0x56')]);if(_0x301373[_0x5d16('0x1f')]){delete _0x301373['name'];}_0xef728a=_0x301373;})[_0x5d16('0x57')](function(){if(_0xef728a===null){_0x3c9378['sendStatus'](_0x208c86);}else{if(_0x208c86===0x1f4){_0x3c9378[_0x5d16('0x8')](_0x208c86)[_0x5d16('0x20')](_0xef728a);}else{_0x3c9378[_0x5d16('0x8')](_0x208c86)[_0x5d16('0xa')](_0xef728a);}}});}; \ No newline at end of file +var _0xef13=['map','VoiceExtension','rawAttributes','fieldName','key','model','keys','filters','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','intersection','catch','destroy','create','body','startsWith','exten','concat','user','get','role','InboundRoutes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','recordingFormat','cutdigits','mandatoryDisposition','alias','context','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','then','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','value','type','find','name','UserProfileResource','error','send','index'];(function(_0x3e7ff2,_0x2627cd){var _0x1266da=function(_0x16b7cb){while(--_0x16b7cb){_0x3e7ff2['push'](_0x3e7ff2['shift']());}};_0x1266da(++_0x2627cd);}(_0xef13,0x15b));var _0x3ef1=function(_0x55f3f8,_0x4354c3){_0x55f3f8=_0x55f3f8-0x0;var _0x28bbc9=_0xef13[_0x55f3f8];return _0x28bbc9;};'use strict';var _=require(_0x3ef1('0x0'));var Redis=require(_0x3ef1('0x1'));var qs=require(_0x3ef1('0x2'));var logger=require(_0x3ef1('0x3'))(_0x3ef1('0x4'));var config=require(_0x3ef1('0x5'));var db=require(_0x3ef1('0x6'))['db'];config['redis']=_[_0x3ef1('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3ef1('0x8'))(new Redis(config[_0x3ef1('0x9')]));require(_0x3ef1('0xa'))[_0x3ef1('0xb')](socket);function respondWithStatusCode(_0x141084,_0x504403){_0x504403=_0x504403||0xcc;return function(_0x38f227){if(_0x38f227){return _0x141084[_0x3ef1('0xc')](_0x504403);}return _0x141084[_0x3ef1('0xd')](_0x504403)[_0x3ef1('0xe')]();};}function respondWithResult(_0x469ff8,_0x206052){_0x206052=_0x206052||0xc8;return function(_0x51455c){if(_0x51455c){return _0x469ff8['status'](_0x206052)[_0x3ef1('0xf')](_0x51455c);}};}function respondWithFilteredResult(_0x305e67,_0x559ee2){return function(_0x5aeafc){if(_0x5aeafc){var _0x25fd33=typeof _0x559ee2[_0x3ef1('0x10')]===_0x3ef1('0x11')&&typeof _0x559ee2[_0x3ef1('0x12')]==='undefined';var _0x62c3bc=_0x5aeafc[_0x3ef1('0x13')];var _0x5101ea=_0x25fd33?0x0:_0x559ee2['offset'];var _0x48fc92=_0x25fd33?_0x5aeafc['count']:_0x559ee2[_0x3ef1('0x10')]+_0x559ee2[_0x3ef1('0x12')];var _0xf817f5;if(_0x48fc92>=_0x62c3bc){_0x48fc92=_0x62c3bc;_0xf817f5=0xc8;}else{_0xf817f5=0xce;}_0x305e67[_0x3ef1('0xd')](_0xf817f5);return _0x305e67['set'](_0x3ef1('0x14'),_0x5101ea+'-'+_0x48fc92+'/'+_0x62c3bc)[_0x3ef1('0xf')](_0x5aeafc);}return null;};}function removeEntity(_0x312da3){return function(_0x208316){if(_0x208316){return _0x208316['destroy']()[_0x3ef1('0x15')](function(){var _0x1cf6d3=_0x208316['get']({'plain':!![]});var _0x3ea1bd=[{'name':'InboundRoutes','value':_0x3ef1('0x16'),'ignore':![]},{'name':_0x3ef1('0x17'),'value':_0x3ef1('0x18'),'ignore':![]},{'name':_0x3ef1('0x19'),'value':_0x3ef1('0x1a'),'ignore':![]}];var _0x268b7c=_(_0x3ea1bd)[_0x3ef1('0x1b')](_0x3ef1('0x1c'))['map'](_0x3ef1('0x1d'))[_0x3ef1('0x1d')]();if(_['includes'](_0x268b7c,_0x1cf6d3[_0x3ef1('0x1e')])){return;}var _0x58cbb5=_[_0x3ef1('0x1f')](_0x3ea1bd,[_0x3ef1('0x1d'),_0x1cf6d3[_0x3ef1('0x1e')]])[_0x3ef1('0x20')];return db[_0x3ef1('0x21')]['destroy']({'where':{'type':_0x58cbb5,'resourceId':_0x1cf6d3['id']}})[_0x3ef1('0x15')](function(){return _0x208316;});})[_0x3ef1('0x15')](function(){_0x312da3['status'](0xcc)[_0x3ef1('0xe')]();});}};}function handleEntityNotFound(_0x1eb102){return function(_0x3560a2){if(!_0x3560a2){_0x1eb102[_0x3ef1('0xc')](0x194);}return _0x3560a2;};}function handleError(_0x16419f,_0x47e271){_0x47e271=_0x47e271||0x1f4;return function(_0x291262){logger[_0x3ef1('0x22')](_0x291262['stack']);if(_0x291262[_0x3ef1('0x20')]){delete _0x291262[_0x3ef1('0x20')];}_0x16419f['status'](_0x47e271)[_0x3ef1('0x23')](_0x291262);};}exports[_0x3ef1('0x24')]=function(_0x1aa9e1,_0x40be37){var _0x565b01={},_0x3ba05f={},_0x40a38f={'count':0x0,'rows':[]};var _0x1e8aca=_[_0x3ef1('0x25')](db[_0x3ef1('0x26')][_0x3ef1('0x27')],function(_0x241df2){return{'name':_0x241df2[_0x3ef1('0x28')],'type':_0x241df2[_0x3ef1('0x1e')][_0x3ef1('0x29')]};});_0x3ba05f[_0x3ef1('0x2a')]=_[_0x3ef1('0x25')](_0x1e8aca,'name');_0x3ba05f['query']=_[_0x3ef1('0x2b')](_0x1aa9e1['query']);_0x3ba05f[_0x3ef1('0x2c')]=_['intersection'](_0x3ba05f['model'],_0x3ba05f['query']);_0x565b01[_0x3ef1('0x2d')]=_['intersection'](_0x3ba05f[_0x3ef1('0x2a')],qs[_0x3ef1('0x2e')](_0x1aa9e1[_0x3ef1('0x2f')][_0x3ef1('0x2e')]));_0x565b01[_0x3ef1('0x2d')]=_0x565b01['attributes'][_0x3ef1('0x30')]?_0x565b01[_0x3ef1('0x2d')]:_0x3ba05f['model'];if(!_0x1aa9e1[_0x3ef1('0x2f')][_0x3ef1('0x31')](_0x3ef1('0x32'))){_0x565b01[_0x3ef1('0x12')]=qs['limit'](_0x1aa9e1[_0x3ef1('0x2f')]['limit']);_0x565b01[_0x3ef1('0x10')]=qs[_0x3ef1('0x10')](_0x1aa9e1[_0x3ef1('0x2f')]['offset']);}_0x565b01[_0x3ef1('0x33')]=qs[_0x3ef1('0x34')](_0x1aa9e1[_0x3ef1('0x2f')][_0x3ef1('0x34')]);_0x565b01[_0x3ef1('0x35')]=qs[_0x3ef1('0x2c')](_['pick'](_0x1aa9e1[_0x3ef1('0x2f')],_0x3ba05f[_0x3ef1('0x2c')]),_0x1e8aca);if(_0x1aa9e1[_0x3ef1('0x2f')][_0x3ef1('0x1b')]){_0x565b01[_0x3ef1('0x35')]=_[_0x3ef1('0x36')](_0x565b01[_0x3ef1('0x35')],{'$or':_[_0x3ef1('0x25')](_0x1e8aca,function(_0x16794e){if(_0x16794e[_0x3ef1('0x1e')]!==_0x3ef1('0x37')){var _0xd7ff12={};_0xd7ff12[_0x16794e[_0x3ef1('0x20')]]={'$like':'%'+_0x1aa9e1[_0x3ef1('0x2f')]['filter']+'%'};return _0xd7ff12;}})});}_0x565b01=_[_0x3ef1('0x36')]({},_0x565b01,_0x1aa9e1[_0x3ef1('0x38')]);var _0x5d4bdc={'where':_0x565b01['where']};return db[_0x3ef1('0x26')][_0x3ef1('0x13')](_0x5d4bdc)['then'](function(_0x587415){_0x40a38f[_0x3ef1('0x13')]=_0x587415;if(_0x1aa9e1[_0x3ef1('0x2f')][_0x3ef1('0x39')]){_0x565b01[_0x3ef1('0x3a')]=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0x565b01);})[_0x3ef1('0x15')](function(_0x144de5){_0x40a38f[_0x3ef1('0x3b')]=_0x144de5;return _0x40a38f;})[_0x3ef1('0x15')](respondWithFilteredResult(_0x40be37,_0x565b01))['catch'](handleError(_0x40be37,null));};exports[_0x3ef1('0x3c')]=function(_0xd1800e,_0x25fa1d){var _0x5c61c2={'raw':![],'where':{'id':_0xd1800e[_0x3ef1('0x3d')]['id']}},_0x27b7cc={};_0x27b7cc[_0x3ef1('0x2a')]=_['keys'](db['VoiceExtension'][_0x3ef1('0x27')]);_0x27b7cc['query']=_['keys'](_0xd1800e[_0x3ef1('0x2f')]);_0x27b7cc[_0x3ef1('0x2c')]=_[_0x3ef1('0x3e')](_0x27b7cc['model'],_0x27b7cc[_0x3ef1('0x2f')]);_0x5c61c2[_0x3ef1('0x2d')]=_[_0x3ef1('0x3e')](_0x27b7cc[_0x3ef1('0x2a')],qs[_0x3ef1('0x2e')](_0xd1800e[_0x3ef1('0x2f')][_0x3ef1('0x2e')]));_0x5c61c2[_0x3ef1('0x2d')]=_0x5c61c2[_0x3ef1('0x2d')][_0x3ef1('0x30')]?_0x5c61c2[_0x3ef1('0x2d')]:_0x27b7cc['model'];if(_0xd1800e[_0x3ef1('0x2f')][_0x3ef1('0x39')]){_0x5c61c2[_0x3ef1('0x3a')]=[{'all':!![]}];}_0x5c61c2=_[_0x3ef1('0x36')]({},_0x5c61c2,_0xd1800e['options']);return db[_0x3ef1('0x26')][_0x3ef1('0x1f')](_0x5c61c2)[_0x3ef1('0x15')](handleEntityNotFound(_0x25fa1d,null))[_0x3ef1('0x15')](respondWithResult(_0x25fa1d,null))[_0x3ef1('0x3f')](handleError(_0x25fa1d,null));};exports[_0x3ef1('0x40')]=function(_0x47bcba,_0x4732af){return db[_0x3ef1('0x26')][_0x3ef1('0x1f')]({'where':{'id':_0x47bcba['params']['id']}})[_0x3ef1('0x15')](handleEntityNotFound(_0x4732af,null))['then'](removeEntity(_0x4732af,null))['catch'](handleError(_0x4732af,null));};exports[_0x3ef1('0x41')]=function(_0x196b59,_0x4d7508){if(_0x196b59[_0x3ef1('0x42')][_0x3ef1('0x1e')]===_0x3ef1('0x18')&&!_[_0x3ef1('0x43')](_0x196b59[_0x3ef1('0x42')][_0x3ef1('0x44')],'_')){_0x196b59[_0x3ef1('0x42')][_0x3ef1('0x44')]='_'[_0x3ef1('0x45')](_0x196b59[_0x3ef1('0x42')][_0x3ef1('0x44')]);}return db[_0x3ef1('0x26')][_0x3ef1('0x41')](_0x196b59[_0x3ef1('0x42')],{'raw':![]})[_0x3ef1('0x15')](function(_0x5b23a0){var _0x2f47d3=_0x196b59[_0x3ef1('0x46')][_0x3ef1('0x47')]({'plain':!![]});if(!_0x2f47d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f47d3[_0x3ef1('0x48')]===_0x3ef1('0x46')){var _0x5f5710=_0x5b23a0['get']({'plain':!![]});var _0x58346c=[{'name':_0x3ef1('0x49'),'value':'inbound'},{'name':_0x3ef1('0x17'),'value':_0x3ef1('0x18')},{'name':_0x3ef1('0x19'),'value':_0x3ef1('0x1a')}];var _0x3ccb08=_[_0x3ef1('0x1f')](_0x58346c,[_0x3ef1('0x1d'),_0x5f5710[_0x3ef1('0x1e')]])[_0x3ef1('0x20')];return db['UserProfileSection'][_0x3ef1('0x1f')]({'where':{'name':_0x3ccb08,'userProfileId':_0x2f47d3[_0x3ef1('0x4a')]},'raw':!![]})[_0x3ef1('0x15')](function(_0x4f3b33){if(_0x4f3b33&&_0x4f3b33[_0x3ef1('0x4b')]===0x0){return db[_0x3ef1('0x21')][_0x3ef1('0x41')]({'name':_0x5f5710[_0x3ef1('0x20')],'resourceId':_0x5f5710['id'],'type':_0x4f3b33[_0x3ef1('0x20')],'sectionId':_0x4f3b33['id']},{})[_0x3ef1('0x15')](function(){return _0x5b23a0;});}else{return _0x5b23a0;}})[_0x3ef1('0x3f')](function(_0x2168f1){logger[_0x3ef1('0x22')](_0x3ef1('0x4c'),_0x2168f1);throw _0x2168f1;});}return _0x5b23a0;})[_0x3ef1('0x15')](respondWithResult(_0x4d7508,0xc9))[_0x3ef1('0x3f')](handleError(_0x4d7508,null));};exports[_0x3ef1('0x4d')]=function(_0x3212f9,_0x101991){if(_0x3212f9[_0x3ef1('0x42')]['id']){delete _0x3212f9[_0x3ef1('0x42')]['id'];}return db[_0x3ef1('0x26')][_0x3ef1('0x1f')]({'where':{'id':_0x3212f9[_0x3ef1('0x3d')]['id']}})[_0x3ef1('0x15')](handleEntityNotFound(_0x101991,null))[_0x3ef1('0x15')](function(_0x4243f6){if(_0x4243f6){return db[_0x3ef1('0x26')][_0x3ef1('0x4d')](_[_0x3ef1('0x4e')](_0x3212f9[_0x3ef1('0x42')],[_0x3ef1('0x44'),'context','description',_0x3ef1('0x4f'),_0x3ef1('0x50'),_0x3ef1('0x51'),_0x3ef1('0x52')]),{'where':{'context':_0x4243f6[_0x3ef1('0x53')],'exten':_0x4243f6[_0x3ef1('0x44')]},'individualHooks':!![]})[_0x3ef1('0x15')](function(_0x46539d){return _0x46539d;});}return null;})[_0x3ef1('0x15')](respondWithStatusCode(_0x101991,null))[_0x3ef1('0x3f')](handleError(_0x101991,null));};exports['addApplications']=function(_0x2cce70,_0x19ee72){var _0x92397d=_0x2cce70['params']['id'];var _0x5f3d49=_0x2cce70[_0x3ef1('0x42')];var _0x10559b=0xc8;var _0xdd64c8=null;return db[_0x3ef1('0x54')]['transaction']({'isolationLevel':db[_0x3ef1('0x54')][_0x3ef1('0x55')][_0x3ef1('0x56')][_0x3ef1('0x57')]},function(_0x2f15a7){return db[_0x3ef1('0x26')][_0x3ef1('0x58')]({'where':{'id':_0x92397d},'transaction':_0x2f15a7})[_0x3ef1('0x15')](function(_0x56af3f){if(_0x56af3f){return db[_0x3ef1('0x26')][_0x3ef1('0x40')]({'where':{'VoiceExtensionId':_0x92397d},'transaction':_0x2f15a7})[_0x3ef1('0x15')](function(){var _0x3d83b8=_[_0x3ef1('0x25')](_0x5f3d49,function(_0x4ae22f){_0x4ae22f[_0x3ef1('0x59')]=_0x92397d;_0x4ae22f[_0x3ef1('0x5a')]=!![];return _0x4ae22f;});return _0x56af3f['createRouting'](_0x3d83b8);})[_0x3ef1('0x15')](function(_0x2df7c9){return db[_0x3ef1('0x26')][_0x3ef1('0x5b')](_0x2df7c9,{'transaction':_0x2f15a7});});}else{_0x10559b=0x194;_0xdd64c8=[];}});})[_0x3ef1('0x15')](function(){if(_0x10559b!==0x194){return db[_0x3ef1('0x26')][_0x3ef1('0x5c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x92397d},'order':_0x3ef1('0x5d')})[_0x3ef1('0x15')](function(_0x2687fa){_0xdd64c8=_0x2687fa;});}})[_0x3ef1('0x3f')](function(_0x200140){_0x10559b=0x1f4;logger[_0x3ef1('0x22')](_0x200140[_0x3ef1('0x5e')]);if(_0x200140[_0x3ef1('0x20')]){delete _0x200140[_0x3ef1('0x20')];}_0xdd64c8=_0x200140;})[_0x3ef1('0x5f')](function(){if(_0xdd64c8===null){_0x19ee72[_0x3ef1('0xc')](_0x10559b);}else{if(_0x10559b===0x1f4){_0x19ee72[_0x3ef1('0xd')](_0x10559b)[_0x3ef1('0x23')](_0xdd64c8);}else{_0x19ee72[_0x3ef1('0xd')](_0x10559b)[_0x3ef1('0xf')](_0xdd64c8);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index a2af273..dacab8d 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 _0x8427=['hasOwnProperty','hook','../../mysqldb','VoiceExtension','save','emit'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x8427,0x11c));var _0x7842=function(_0x4c0986,_0x577753){_0x4c0986=_0x4c0986-0x0;var _0x480d78=_0x8427[_0x4c0986];return _0x480d78;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x7842('0x0'))['db'][_0x7842('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7842('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x16ea6f){return function(_0x9255f,_0x315cbd,_0x30bdd1){VoiceExtensionEvents[_0x7842('0x3')](_0x16ea6f+':'+_0x9255f['id'],_0x9255f);VoiceExtensionEvents['emit'](_0x16ea6f,_0x9255f);_0x30bdd1(null);};}for(var e in events){if(events[_0x7842('0x4')](e)){var event=events[e];VoiceExtension[_0x7842('0x5')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x1e56=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0xf4666e,_0x571140){var _0x1853f1=function(_0x5160a5){while(--_0x5160a5){_0xf4666e['push'](_0xf4666e['shift']());}};_0x1853f1(++_0x571140);}(_0x1e56,0x86));var _0x61e5=function(_0x4b5378,_0x47a610){_0x4b5378=_0x4b5378-0x0;var _0x5181d6=_0x1e56[_0x4b5378];return _0x5181d6;};'use strict';var EventEmitter=require(_0x61e5('0x0'));var VoiceExtension=require(_0x61e5('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x61e5('0x2')](0x0);var events={'afterCreate':_0x61e5('0x3'),'afterUpdate':_0x61e5('0x4'),'afterDestroy':_0x61e5('0x5')};function emitEvent(_0x4db815){return function(_0x56105a,_0x37d9ae,_0x384bcb){VoiceExtensionEvents[_0x61e5('0x6')](_0x4db815+':'+_0x56105a['id'],_0x56105a);VoiceExtensionEvents[_0x61e5('0x6')](_0x4db815,_0x56105a);_0x384bcb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x61e5('0x7')](e,emitEvent(event));}}module[_0x61e5('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 3fcc2d7..7639abc 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 _0x1c35=['options','url','name','param','split','phone','prefix','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','length','intervals','map','filter','toLowerCase','hasOwnProperty','tag','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','get','then','concat','Hangup','lodash','models','type','CDR(type)=','context','exten','inbound','push','Set','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','${EXTEN:','cutdigits','${EXTEN}','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','recordingFormat','none','wav','trunk'];(function(_0xf021e9,_0x579ba1){var _0x4006e3=function(_0x5dd095){while(--_0x5dd095){_0xf021e9['push'](_0xf021e9['shift']());}};_0x4006e3(++_0x579ba1);}(_0x1c35,0x107));var _0x51c3=function(_0x4db828,_0x233696){_0x4db828=_0x4db828-0x0;var _0x27d336=_0x1c35[_0x4db828];return _0x27d336;};'use strict';var _=require(_0x51c3('0x0'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x46275e){var _0x4687fa=_0x46275e[_0x51c3('0x1')];function _0x3813c2(_0x2cf286){var _0x3bf211=0x2;var _0x53e944=[{'type':_0x2cf286[_0x51c3('0x2')],'app':'Set','appdata':_0x51c3('0x3')+_0x2cf286['type'],'context':_0x2cf286[_0x51c3('0x4')],'exten':_0x2cf286[_0x51c3('0x5')],'priority':_0x3bf211++,'VoiceExtensionId':_0x2cf286['id']}];if(_0x2cf286[_0x51c3('0x2')]===_0x51c3('0x6')){_0x53e944[_0x51c3('0x7')]({'type':'inbound','app':'Set','appdata':'CDR(routeid)='+_0x2cf286['id'],'context':_0x2cf286['context'],'exten':_0x2cf286['exten'],'priority':_0x3bf211++,'VoiceExtensionId':_0x2cf286['id']});}_0x53e944[_0x51c3('0x7')]({'type':_0x2cf286[_0x51c3('0x2')],'app':_0x51c3('0x8'),'appdata':_0x51c3('0x9'),'context':_0x2cf286[_0x51c3('0x4')],'exten':_0x2cf286[_0x51c3('0x5')],'priority':_0x3bf211++,'VoiceExtensionId':_0x2cf286['id']},{'type':_0x2cf286[_0x51c3('0x2')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2cf286[_0x51c3('0x4')],'exten':_0x2cf286[_0x51c3('0x5')],'priority':_0x3bf211++,'VoiceExtensionId':_0x2cf286['id']},{'type':_0x2cf286[_0x51c3('0x2')],'app':_0x51c3('0x8'),'appdata':_0x51c3('0xa'),'context':_0x2cf286[_0x51c3('0x4')],'exten':_0x2cf286[_0x51c3('0x5')],'priority':_0x3bf211++,'VoiceExtensionId':_0x2cf286['id']});return _0x53e944;}function _0x456d0f(_0x625c34){var _0x2a50ae=0x2;var _0x25b774=[{'type':'outbound','app':'Set','appdata':_0x51c3('0xb'),'context':_0x625c34[_0x51c3('0x4')],'exten':_0x625c34['exten'],'priority':_0x2a50ae++,'VoiceExtensionId':_0x625c34['id']},{'type':_0x51c3('0xc'),'app':_0x51c3('0x8'),'appdata':'CDR(destination)='+(_0x625c34['cutdigits']?_0x51c3('0xd')+_0x625c34[_0x51c3('0xe')]+'}':_0x51c3('0xf')),'context':_0x625c34[_0x51c3('0x4')],'exten':_0x625c34[_0x51c3('0x5')],'priority':_0x2a50ae++,'VoiceExtensionId':_0x625c34['id']},{'type':_0x51c3('0xc'),'app':_0x51c3('0x8'),'appdata':_0x51c3('0x10')+_0x625c34['id'],'context':_0x625c34['context'],'exten':_0x625c34[_0x51c3('0x5')],'priority':_0x2a50ae++,'VoiceExtensionId':_0x625c34['id']},{'type':'outbound','app':'ExecIf','appdata':_0x51c3('0x11')+(_0x2a50ae+0x2)+'):Goto('+(_0x2a50ae+0x1)+')','context':_0x625c34[_0x51c3('0x4')],'exten':_0x625c34['exten'],'priority':_0x2a50ae++,'VoiceExtensionId':_0x625c34['id']},{'type':_0x51c3('0xc'),'app':_0x51c3('0x8'),'appdata':_0x625c34[_0x51c3('0xe')]?'CDR(prefix)=${EXTEN:0:'+_0x625c34[_0x51c3('0xe')]+'}':_0x51c3('0x12'),'context':_0x625c34[_0x51c3('0x4')],'exten':_0x625c34[_0x51c3('0x5')],'priority':_0x2a50ae++,'VoiceExtensionId':_0x625c34['id']},{'type':_0x51c3('0xc'),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x625c34['context'],'exten':_0x625c34['exten'],'priority':_0x2a50ae++,'VoiceExtensionId':_0x625c34['id']},{'type':_0x51c3('0xc'),'app':_0x51c3('0x8'),'appdata':_0x51c3('0x13'),'context':_0x625c34[_0x51c3('0x4')],'exten':_0x625c34[_0x51c3('0x5')],'priority':_0x2a50ae++,'VoiceExtensionId':_0x625c34['id']},{'type':_0x51c3('0xc'),'app':_0x51c3('0x8'),'appdata':_0x51c3('0xa'),'context':_0x625c34[_0x51c3('0x4')],'exten':_0x625c34['exten'],'priority':_0x2a50ae++,'VoiceExtensionId':_0x625c34['id']},{'type':_0x51c3('0xc'),'app':_0x51c3('0x8'),'appdata':_0x51c3('0x14')+_0x625c34['id'],'context':_0x625c34[_0x51c3('0x4')],'exten':_0x625c34[_0x51c3('0x5')],'priority':_0x2a50ae++,'VoiceExtensionId':_0x625c34['id']}];if(_0x625c34['hasOwnProperty'](_0x51c3('0x15'))&&_0x625c34[_0x51c3('0x15')]!==_0x51c3('0x16')){_0x25b774[_0x51c3('0x7')]({'type':_0x51c3('0xc'),'app':_0x51c3('0x8'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x625c34[_0x51c3('0x4')],'exten':_0x625c34[_0x51c3('0x5')],'priority':_0x2a50ae++,'VoiceExtensionId':_0x625c34['id']},{'type':_0x51c3('0xc'),'app':_0x51c3('0x8'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x625c34[_0x51c3('0x15')]||_0x51c3('0x17'),'context':_0x625c34[_0x51c3('0x4')],'exten':_0x625c34[_0x51c3('0x5')],'priority':_0x2a50ae++,'VoiceExtensionId':_0x625c34['id']});}return _0x25b774;}function _0x59e686(_0x2426ac,_0x478c42){var _0x37983f=[{'name':_0x51c3('0x18'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x51c3('0x19'),'param':0x2},{'name':_0x51c3('0x1a'),'param':0x3}];var _0x5d6b68={};var _0x1cdb72=_0x478c42['split'](',');var _0x18c3ca=[];for(var _0x5d9d55=0x0;_0x5d9d55<_0x37983f['length'];_0x5d9d55++){switch(_0x37983f[_0x5d9d55][_0x51c3('0x1b')]){case _0x51c3('0x18'):_0x5d6b68[_0x51c3('0x18')]=_0x1cdb72[_0x37983f[_0x5d9d55][_0x51c3('0x1c')]]['split']('/')[0x1];_0x5d6b68['phone']=_0x1cdb72[_0x37983f[_0x5d9d55][_0x51c3('0x1c')]][_0x51c3('0x1d')]('/')[0x2];_0x5d6b68['prefix']=_0x5d6b68[_0x51c3('0x1e')]?_0x5d6b68['phone'][_0x51c3('0x1d')]('$')[0x0]:undefined;_0x5d6b68[_0x51c3('0x1e')]=_0x2426ac['cutdigits']?(_0x5d6b68[_0x51c3('0x1f')]||'')+'${EXTEN:'+_0x2426ac['cutdigits']+'}':(_0x5d6b68[_0x51c3('0x1f')]||'')+_0x51c3('0xf');_0x18c3ca[_0x37983f[_0x5d9d55][_0x51c3('0x1c')]]=['SIP',_0x5d6b68[_0x51c3('0x18')],_0x5d6b68[_0x51c3('0x1e')]][_0x51c3('0x20')]('/');break;case _0x51c3('0x19'):_0x5d6b68[_0x51c3('0x19')]=_0x1cdb72[_0x37983f[_0x5d9d55]['param']];if(_0x2426ac[_0x51c3('0x15')]!==_0x51c3('0x16')){if(_0x5d6b68['options'][_0x51c3('0x21')]('U(xcally-mixmonitor-context)')<0x0){_0x5d6b68[_0x51c3('0x19')]+=_0x51c3('0x22');}}else{_0x5d6b68[_0x51c3('0x19')]=_0x5d6b68[_0x51c3('0x19')][_0x51c3('0x23')](_0x51c3('0x22'),'');}_0x18c3ca[_0x37983f[_0x5d9d55][_0x51c3('0x1c')]]=_0x5d6b68['options'];break;default:_0x18c3ca[_0x37983f[_0x5d9d55]['param']]=_0x1cdb72[_0x37983f[_0x5d9d55][_0x51c3('0x1c')]];}}return _0x18c3ca[_0x51c3('0x20')](',');}function _0x54e960(_0x25e77f,_0x255fe8,_0x45628d){return new Promise(function(_0x446e26,_0x117908){var _0x68d18d=[];if(_[_0x51c3('0x24')](_0x255fe8))return _0x446e26(_0x68d18d);_0x4687fa[_0x51c3('0x25')][_0x51c3('0x26')]({'attributes':['id',_0x51c3('0x27'),_0x51c3('0x28')],'raw':!![]})['then'](function(_0x5a914c){for(var _0x1be9be=0x0,_0x10f67f=0x0;_0x1be9be<_0x255fe8[_0x51c3('0x29')];_0x1be9be++,_0x10f67f=0x0){var _0x53c181=_0x255fe8[_0x1be9be];var _0x54f571=[];var _0x5a9ee=[];delete _0x53c181['id'];if(_0x53c181['interval']!=='*,*,*,*'){_0x53c181['intervals']=[_0x53c181[_0x51c3('0x27')]];}else{_0x53c181[_0x51c3('0x2a')]=_0x53c181['IntervalId']?_[_0x51c3('0x2b')](_[_0x51c3('0x2c')](_0x5a914c,{'IntervalId':_0x53c181[_0x51c3('0x28')]}),_0x51c3('0x27')):[];}_0x53c181[_0x51c3('0x4')]=_0x25e77f[_0x51c3('0x4')];_0x53c181[_0x51c3('0x5')]=_0x25e77f[_0x51c3('0x5')];if(_0x53c181[_0x51c3('0x2')])_0x53c181[_0x51c3('0x2')]=_0x53c181[_0x51c3('0x2')][_0x51c3('0x2d')]();if(_0x25e77f[_0x51c3('0x2')]===_0x51c3('0xc')){if(_0x53c181[_0x51c3('0x2e')](_0x51c3('0x2f'))&&_0x53c181['tag']&&_0x53c181[_0x51c3('0x2f')]!=='--'){_0x54f571[_0x51c3('0x7')]({'type':_0x53c181[_0x51c3('0x2')][_0x51c3('0x2d')](),'app':_0x51c3('0x8'),'appdata':'CDR(tag)='+_0x53c181['tag'],'context':_0x25e77f[_0x51c3('0x4')],'exten':_0x25e77f['exten'],'priority':_0x53c181[_0x51c3('0x2a')]['length']+_0x45628d+_0x10f67f++,'VoiceExtensionId':_0x25e77f['id']});}_0x54f571['push']({'type':_0x53c181['type'][_0x51c3('0x2d')](),'app':_0x51c3('0x30'),'appdata':_0x51c3('0x31')+(_0x53c181[_0x51c3('0x32')]?_0x51c3('0x33')+_0x53c181[_0x51c3('0x32')]+')':_0x51c3('0x34')),'context':_0x25e77f['context'],'exten':_0x25e77f[_0x51c3('0x5')],'priority':_0x53c181[_0x51c3('0x2a')][_0x51c3('0x29')]+_0x45628d+_0x10f67f++,'VoiceExtensionId':_0x25e77f['id']});}else{if(_0x53c181[_0x51c3('0x2e')](_0x51c3('0x35'))){if([_0x51c3('0x36'),'playback'][_0x51c3('0x37')](_0x53c181[_0x51c3('0x38')][_0x51c3('0x2d')]())&&_0x53c181[_0x51c3('0x39')]!=='custom'){if(_0x53c181[_0x51c3('0x35')]){_0x54f571['push']({'type':_0x53c181['type'][_0x51c3('0x2d')](),'app':_0x51c3('0x30'),'appdata':_0x51c3('0x3a'),'context':_0x25e77f['context'],'exten':_0x25e77f[_0x51c3('0x5')],'priority':_0x53c181[_0x51c3('0x2a')]['length']+_0x45628d+_0x10f67f++,'VoiceExtensionId':_0x25e77f['id']});_0x54f571[_0x51c3('0x7')]({'type':_0x53c181[_0x51c3('0x2')][_0x51c3('0x2d')](),'app':_0x51c3('0x8'),'appdata':_0x51c3('0x3b'),'context':_0x25e77f['context'],'exten':_0x25e77f[_0x51c3('0x5')],'priority':_0x53c181[_0x51c3('0x2a')][_0x51c3('0x29')]+_0x45628d+_0x10f67f++,'VoiceExtensionId':_0x25e77f['id']});}else{_0x54f571[_0x51c3('0x7')]({'type':_0x53c181[_0x51c3('0x2')][_0x51c3('0x2d')](),'app':_0x51c3('0x30'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x25e77f['context'],'exten':_0x25e77f[_0x51c3('0x5')],'priority':_0x53c181['intervals'][_0x51c3('0x29')]+_0x45628d+_0x10f67f++,'VoiceExtensionId':_0x25e77f['id']});_0x54f571[_0x51c3('0x7')]({'type':_0x53c181[_0x51c3('0x2')]['toLowerCase'](),'app':_0x51c3('0x8'),'appdata':_0x51c3('0x3c'),'context':_0x25e77f[_0x51c3('0x4')],'exten':_0x25e77f[_0x51c3('0x5')],'priority':_0x53c181['intervals']['length']+_0x45628d+_0x10f67f++,'VoiceExtensionId':_0x25e77f['id']});}}}}for(var _0x20bd4d=0x0;_0x20bd4d<_0x53c181['intervals']['length'];_0x20bd4d++){var _0x6e8516=_0x45628d+_0x53c181[_0x51c3('0x2a')][_0x51c3('0x29')];var _0x713eef=_0x20bd4d===_0x53c181[_0x51c3('0x2a')]['length']-0x1?_0x45628d+_0x54f571['length']+_0x5a9ee[_0x51c3('0x29')]+0x2:_0x45628d+_0x20bd4d+0x1;_0x54f571[_0x51c3('0x3d')](_0x20bd4d,0x0,{'type':_0x25e77f['type'],'app':_0x51c3('0x3e'),'appdata':_0x53c181[_0x51c3('0x2a')][_0x20bd4d]+'?'+_0x25e77f[_0x51c3('0x4')]+_0x51c3('0x3f')+_0x6e8516+':'+_0x25e77f[_0x51c3('0x4')]+_0x51c3('0x3f')+_0x713eef,'exten':_0x25e77f[_0x51c3('0x5')],'context':_0x25e77f[_0x51c3('0x4')],'priority':_0x45628d+_0x20bd4d,'VoiceExtensionId':_0x25e77f['id']});}if(_0x53c181[_0x51c3('0x39')]===_0x51c3('0x40')){_0x53c181['appdata']=_0x59e686(_0x25e77f,_0x53c181[_0x51c3('0x41')]);}if(_0x53c181[_0x51c3('0x39')]==='agi'){_0x54f571[_0x51c3('0x7')]({'type':_0x53c181[_0x51c3('0x2')]['toLowerCase'](),'app':_0x51c3('0x8'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x25e77f[_0x51c3('0x4')],'exten':_0x25e77f[_0x51c3('0x5')],'priority':_0x53c181[_0x51c3('0x2a')]['length']+_0x45628d+_0x10f67f++,'VoiceExtensionId':_0x25e77f['id']});}_0x53c181[_0x51c3('0x42')]=_0x54f571[_0x51c3('0x29')]?_[_0x51c3('0x43')](_0x54f571)[_0x51c3('0x42')]+0x1:_0x45628d;_0x68d18d=_['concat'](_0x68d18d,_0x54f571,[_0x53c181],_0x5a9ee);_0x45628d=_[_0x51c3('0x43')](_0x68d18d)[_0x51c3('0x42')]+0x1;}return _0x446e26(_0x68d18d);})['catch'](function(_0x2bac15){_0x117908(_0x2bac15);});});}return _0x46275e['define']('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x539213){var _0x38b0b7=this[_0x51c3('0x44')]({'plain':!![]});var _0x12bf78=_0x38b0b7[_0x51c3('0x2')]===_0x51c3('0xc')?_0x456d0f(_0x38b0b7):_0x3813c2(_0x38b0b7);return _0x54e960(_0x38b0b7,_0x539213,_[_0x51c3('0x43')](_0x12bf78)['priority']+0x1)[_0x51c3('0x45')](function(_0x20b7a6){var _0x5cef48=_[_0x51c3('0x46')](_0x12bf78,_0x20b7a6);_0x5cef48['push']({'type':_0x38b0b7['type'],'app':_0x51c3('0x47'),'exten':_0x38b0b7['exten'],'context':_0x38b0b7[_0x51c3('0x4')],'priority':_['last'](_0x5cef48)[_0x51c3('0x42')]+0x1,'VoiceExtensionId':_0x38b0b7['id']});return _0x5cef48;});}}});}; \ No newline at end of file +var _0x1ab4=['wav','trunk','timeout','options','url','split','length','name','phone','param','prefix','${EXTEN:','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','IntervalId','then','intervals','map','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','VoiceExtension','voice_extensions','get','Hangup','exports','models','type','Set','CDR(type)=','context','inbound','push','exten','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}'];(function(_0x26c949,_0x237670){var _0x1cf84c=function(_0x1c9450){while(--_0x1c9450){_0x26c949['push'](_0x26c949['shift']());}};_0x1cf84c(++_0x237670);}(_0x1ab4,0x8b));var _0x41ab=function(_0x342cf1,_0xbcece1){_0x342cf1=_0x342cf1-0x0;var _0x135bef=_0x1ab4[_0x342cf1];return _0x135bef;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module[_0x41ab('0x0')]=function(_0x1f21e3){var _0x3b6aed=_0x1f21e3[_0x41ab('0x1')];function _0x365153(_0x1319b8){var _0x46ddaf=0x2;var _0x301f50=[{'type':_0x1319b8[_0x41ab('0x2')],'app':_0x41ab('0x3'),'appdata':_0x41ab('0x4')+_0x1319b8['type'],'context':_0x1319b8[_0x41ab('0x5')],'exten':_0x1319b8['exten'],'priority':_0x46ddaf++,'VoiceExtensionId':_0x1319b8['id']}];if(_0x1319b8[_0x41ab('0x2')]===_0x41ab('0x6')){_0x301f50[_0x41ab('0x7')]({'type':_0x41ab('0x6'),'app':'Set','appdata':'CDR(routeid)='+_0x1319b8['id'],'context':_0x1319b8['context'],'exten':_0x1319b8[_0x41ab('0x8')],'priority':_0x46ddaf++,'VoiceExtensionId':_0x1319b8['id']});}_0x301f50[_0x41ab('0x7')]({'type':_0x1319b8[_0x41ab('0x2')],'app':_0x41ab('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1319b8[_0x41ab('0x5')],'exten':_0x1319b8['exten'],'priority':_0x46ddaf++,'VoiceExtensionId':_0x1319b8['id']},{'type':_0x1319b8[_0x41ab('0x2')],'app':'Set','appdata':_0x41ab('0x9'),'context':_0x1319b8[_0x41ab('0x5')],'exten':_0x1319b8[_0x41ab('0x8')],'priority':_0x46ddaf++,'VoiceExtensionId':_0x1319b8['id']},{'type':_0x1319b8[_0x41ab('0x2')],'app':_0x41ab('0x3'),'appdata':_0x41ab('0xa'),'context':_0x1319b8[_0x41ab('0x5')],'exten':_0x1319b8[_0x41ab('0x8')],'priority':_0x46ddaf++,'VoiceExtensionId':_0x1319b8['id']});return _0x301f50;}function _0x118e46(_0x3bc766){var _0x562169=0x2;var _0x817d2b=[{'type':_0x41ab('0xb'),'app':_0x41ab('0x3'),'appdata':_0x41ab('0xc'),'context':_0x3bc766[_0x41ab('0x5')],'exten':_0x3bc766[_0x41ab('0x8')],'priority':_0x562169++,'VoiceExtensionId':_0x3bc766['id']},{'type':_0x41ab('0xb'),'app':_0x41ab('0x3'),'appdata':_0x41ab('0xd')+(_0x3bc766[_0x41ab('0xe')]?'${EXTEN:'+_0x3bc766['cutdigits']+'}':_0x41ab('0xf')),'context':_0x3bc766['context'],'exten':_0x3bc766[_0x41ab('0x8')],'priority':_0x562169++,'VoiceExtensionId':_0x3bc766['id']},{'type':'outbound','app':_0x41ab('0x3'),'appdata':_0x41ab('0x10')+_0x3bc766['id'],'context':_0x3bc766[_0x41ab('0x5')],'exten':_0x3bc766['exten'],'priority':_0x562169++,'VoiceExtensionId':_0x3bc766['id']},{'type':'outbound','app':_0x41ab('0x11'),'appdata':_0x41ab('0x12')+(_0x562169+0x2)+_0x41ab('0x13')+(_0x562169+0x1)+')','context':_0x3bc766['context'],'exten':_0x3bc766['exten'],'priority':_0x562169++,'VoiceExtensionId':_0x3bc766['id']},{'type':'outbound','app':_0x41ab('0x3'),'appdata':_0x3bc766['cutdigits']?_0x41ab('0x14')+_0x3bc766[_0x41ab('0xe')]+'}':_0x41ab('0x15'),'context':_0x3bc766[_0x41ab('0x5')],'exten':_0x3bc766[_0x41ab('0x8')],'priority':_0x562169++,'VoiceExtensionId':_0x3bc766['id']},{'type':_0x41ab('0xb'),'app':_0x41ab('0x3'),'appdata':_0x41ab('0x16'),'context':_0x3bc766[_0x41ab('0x5')],'exten':_0x3bc766['exten'],'priority':_0x562169++,'VoiceExtensionId':_0x3bc766['id']},{'type':_0x41ab('0xb'),'app':_0x41ab('0x3'),'appdata':_0x41ab('0x9'),'context':_0x3bc766[_0x41ab('0x5')],'exten':_0x3bc766[_0x41ab('0x8')],'priority':_0x562169++,'VoiceExtensionId':_0x3bc766['id']},{'type':'outbound','app':_0x41ab('0x3'),'appdata':_0x41ab('0xa'),'context':_0x3bc766[_0x41ab('0x5')],'exten':_0x3bc766[_0x41ab('0x8')],'priority':_0x562169++,'VoiceExtensionId':_0x3bc766['id']},{'type':_0x41ab('0xb'),'app':'Set','appdata':_0x41ab('0x17')+_0x3bc766['id'],'context':_0x3bc766[_0x41ab('0x5')],'exten':_0x3bc766[_0x41ab('0x8')],'priority':_0x562169++,'VoiceExtensionId':_0x3bc766['id']}];if(_0x3bc766['hasOwnProperty'](_0x41ab('0x18'))&&_0x3bc766[_0x41ab('0x18')]!==_0x41ab('0x19')){_0x817d2b[_0x41ab('0x7')]({'type':_0x41ab('0xb'),'app':'Set','appdata':_0x41ab('0x1a'),'context':_0x3bc766['context'],'exten':_0x3bc766[_0x41ab('0x8')],'priority':_0x562169++,'VoiceExtensionId':_0x3bc766['id']},{'type':_0x41ab('0xb'),'app':_0x41ab('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x3bc766['recordingFormat']||_0x41ab('0x1b'),'context':_0x3bc766[_0x41ab('0x5')],'exten':_0x3bc766[_0x41ab('0x8')],'priority':_0x562169++,'VoiceExtensionId':_0x3bc766['id']});}return _0x817d2b;}function _0x1551b2(_0x3a9962,_0x17b525){var _0xbdc859=[{'name':_0x41ab('0x1c'),'param':0x0},{'name':_0x41ab('0x1d'),'param':0x1},{'name':_0x41ab('0x1e'),'param':0x2},{'name':_0x41ab('0x1f'),'param':0x3}];var _0x39a1af={};var _0x242569=_0x17b525[_0x41ab('0x20')](',');var _0x582279=[];for(var _0xd52590=0x0;_0xd52590<_0xbdc859[_0x41ab('0x21')];_0xd52590++){switch(_0xbdc859[_0xd52590][_0x41ab('0x22')]){case _0x41ab('0x1c'):_0x39a1af[_0x41ab('0x1c')]=_0x242569[_0xbdc859[_0xd52590]['param']][_0x41ab('0x20')]('/')[0x1];_0x39a1af[_0x41ab('0x23')]=_0x242569[_0xbdc859[_0xd52590][_0x41ab('0x24')]][_0x41ab('0x20')]('/')[0x2];_0x39a1af[_0x41ab('0x25')]=_0x39a1af[_0x41ab('0x23')]?_0x39a1af['phone'][_0x41ab('0x20')]('$')[0x0]:undefined;_0x39a1af[_0x41ab('0x23')]=_0x3a9962['cutdigits']?(_0x39a1af[_0x41ab('0x25')]||'')+_0x41ab('0x26')+_0x3a9962[_0x41ab('0xe')]+'}':(_0x39a1af[_0x41ab('0x25')]||'')+_0x41ab('0xf');_0x582279[_0xbdc859[_0xd52590][_0x41ab('0x24')]]=[_0x41ab('0x27'),_0x39a1af[_0x41ab('0x1c')],_0x39a1af['phone']][_0x41ab('0x28')]('/');break;case _0x41ab('0x1e'):_0x39a1af[_0x41ab('0x1e')]=_0x242569[_0xbdc859[_0xd52590][_0x41ab('0x24')]];if(_0x3a9962[_0x41ab('0x18')]!==_0x41ab('0x19')){if(_0x39a1af[_0x41ab('0x1e')][_0x41ab('0x29')](_0x41ab('0x2a'))<0x0){_0x39a1af[_0x41ab('0x1e')]+='U(xcally-mixmonitor-context)';}}else{_0x39a1af[_0x41ab('0x1e')]=_0x39a1af[_0x41ab('0x1e')][_0x41ab('0x2b')](_0x41ab('0x2a'),'');}_0x582279[_0xbdc859[_0xd52590][_0x41ab('0x24')]]=_0x39a1af['options'];break;default:_0x582279[_0xbdc859[_0xd52590][_0x41ab('0x24')]]=_0x242569[_0xbdc859[_0xd52590][_0x41ab('0x24')]];}}return _0x582279[_0x41ab('0x28')](',');}function _0x16bb7c(_0x111be0,_0x35b241,_0x5e1848){return new Promise(function(_0x16715b,_0x120920){var _0x319f6d=[];if(_[_0x41ab('0x2c')](_0x35b241))return _0x16715b(_0x319f6d);_0x3b6aed['Interval'][_0x41ab('0x2d')]({'attributes':['id',_0x41ab('0x2e'),_0x41ab('0x2f')],'raw':!![]})[_0x41ab('0x30')](function(_0x381cb0){for(var _0x5d9b27=0x0,_0x59357c=0x0;_0x5d9b27<_0x35b241[_0x41ab('0x21')];_0x5d9b27++,_0x59357c=0x0){var _0x38849a=_0x35b241[_0x5d9b27];var _0x12c89c=[];var _0x496c75=[];delete _0x38849a['id'];if(_0x38849a[_0x41ab('0x2e')]!=='*,*,*,*'){_0x38849a['intervals']=[_0x38849a[_0x41ab('0x2e')]];}else{_0x38849a[_0x41ab('0x31')]=_0x38849a['IntervalId']?_[_0x41ab('0x32')](_[_0x41ab('0x33')](_0x381cb0,{'IntervalId':_0x38849a[_0x41ab('0x2f')]}),_0x41ab('0x2e')):[];}_0x38849a[_0x41ab('0x5')]=_0x111be0[_0x41ab('0x5')];_0x38849a[_0x41ab('0x8')]=_0x111be0['exten'];if(_0x38849a[_0x41ab('0x2')])_0x38849a['type']=_0x38849a[_0x41ab('0x2')][_0x41ab('0x34')]();if(_0x111be0[_0x41ab('0x2')]===_0x41ab('0xb')){if(_0x38849a[_0x41ab('0x35')](_0x41ab('0x36'))&&_0x38849a['tag']&&_0x38849a[_0x41ab('0x36')]!=='--'){_0x12c89c[_0x41ab('0x7')]({'type':_0x38849a[_0x41ab('0x2')][_0x41ab('0x34')](),'app':_0x41ab('0x3'),'appdata':_0x41ab('0x37')+_0x38849a['tag'],'context':_0x111be0[_0x41ab('0x5')],'exten':_0x111be0[_0x41ab('0x8')],'priority':_0x38849a[_0x41ab('0x31')][_0x41ab('0x21')]+_0x5e1848+_0x59357c++,'VoiceExtensionId':_0x111be0['id']});}_0x12c89c['push']({'type':_0x38849a[_0x41ab('0x2')][_0x41ab('0x34')](),'app':_0x41ab('0x11'),'appdata':_0x41ab('0x38')+(_0x38849a[_0x41ab('0x39')]?_0x41ab('0x3a')+_0x38849a[_0x41ab('0x39')]+')':'NoOp(No\x20number\x20available)'),'context':_0x111be0['context'],'exten':_0x111be0[_0x41ab('0x8')],'priority':_0x38849a[_0x41ab('0x31')][_0x41ab('0x21')]+_0x5e1848+_0x59357c++,'VoiceExtensionId':_0x111be0['id']});}else{if(_0x38849a['hasOwnProperty'](_0x41ab('0x3b'))){if([_0x41ab('0x3c'),_0x41ab('0x3d')][_0x41ab('0x3e')](_0x38849a[_0x41ab('0x3f')][_0x41ab('0x34')]())&&_0x38849a[_0x41ab('0x40')]!==_0x41ab('0x41')){if(_0x38849a[_0x41ab('0x3b')]){_0x12c89c['push']({'type':_0x38849a[_0x41ab('0x2')][_0x41ab('0x34')](),'app':_0x41ab('0x11'),'appdata':_0x41ab('0x42'),'context':_0x111be0[_0x41ab('0x5')],'exten':_0x111be0[_0x41ab('0x8')],'priority':_0x38849a[_0x41ab('0x31')][_0x41ab('0x21')]+_0x5e1848+_0x59357c++,'VoiceExtensionId':_0x111be0['id']});_0x12c89c[_0x41ab('0x7')]({'type':_0x38849a[_0x41ab('0x2')][_0x41ab('0x34')](),'app':'Set','appdata':_0x41ab('0x43'),'context':_0x111be0[_0x41ab('0x5')],'exten':_0x111be0[_0x41ab('0x8')],'priority':_0x38849a['intervals'][_0x41ab('0x21')]+_0x5e1848+_0x59357c++,'VoiceExtensionId':_0x111be0['id']});}else{_0x12c89c[_0x41ab('0x7')]({'type':_0x38849a['type']['toLowerCase'](),'app':_0x41ab('0x11'),'appdata':_0x41ab('0x44'),'context':_0x111be0[_0x41ab('0x5')],'exten':_0x111be0[_0x41ab('0x8')],'priority':_0x38849a['intervals']['length']+_0x5e1848+_0x59357c++,'VoiceExtensionId':_0x111be0['id']});_0x12c89c[_0x41ab('0x7')]({'type':_0x38849a[_0x41ab('0x2')][_0x41ab('0x34')](),'app':_0x41ab('0x3'),'appdata':_0x41ab('0x45'),'context':_0x111be0['context'],'exten':_0x111be0[_0x41ab('0x8')],'priority':_0x38849a[_0x41ab('0x31')][_0x41ab('0x21')]+_0x5e1848+_0x59357c++,'VoiceExtensionId':_0x111be0['id']});}}}}for(var _0x399823=0x0;_0x399823<_0x38849a['intervals'][_0x41ab('0x21')];_0x399823++){var _0x472fe0=_0x5e1848+_0x38849a[_0x41ab('0x31')][_0x41ab('0x21')];var _0x3c9f02=_0x399823===_0x38849a[_0x41ab('0x31')]['length']-0x1?_0x5e1848+_0x12c89c[_0x41ab('0x21')]+_0x496c75[_0x41ab('0x21')]+0x2:_0x5e1848+_0x399823+0x1;_0x12c89c[_0x41ab('0x46')](_0x399823,0x0,{'type':_0x111be0[_0x41ab('0x2')],'app':_0x41ab('0x47'),'appdata':_0x38849a[_0x41ab('0x31')][_0x399823]+'?'+_0x111be0[_0x41ab('0x5')]+_0x41ab('0x48')+_0x472fe0+':'+_0x111be0[_0x41ab('0x5')]+_0x41ab('0x48')+_0x3c9f02,'exten':_0x111be0[_0x41ab('0x8')],'context':_0x111be0[_0x41ab('0x5')],'priority':_0x5e1848+_0x399823,'VoiceExtensionId':_0x111be0['id']});}if(_0x38849a['appType']===_0x41ab('0x49')){_0x38849a[_0x41ab('0x4a')]=_0x1551b2(_0x111be0,_0x38849a[_0x41ab('0x4a')]);}if(_0x38849a['appType']==='agi'){_0x12c89c['push']({'type':_0x38849a['type']['toLowerCase'](),'app':_0x41ab('0x3'),'appdata':_0x41ab('0x4b'),'context':_0x111be0['context'],'exten':_0x111be0[_0x41ab('0x8')],'priority':_0x38849a[_0x41ab('0x31')]['length']+_0x5e1848+_0x59357c++,'VoiceExtensionId':_0x111be0['id']});}_0x38849a[_0x41ab('0x4c')]=_0x12c89c['length']?_[_0x41ab('0x4d')](_0x12c89c)['priority']+0x1:_0x5e1848;_0x319f6d=_[_0x41ab('0x4e')](_0x319f6d,_0x12c89c,[_0x38849a],_0x496c75);_0x5e1848=_[_0x41ab('0x4d')](_0x319f6d)[_0x41ab('0x4c')]+0x1;}return _0x16715b(_0x319f6d);})['catch'](function(_0x15822f){_0x120920(_0x15822f);});});}return _0x1f21e3['define'](_0x41ab('0x4f'),attributes,{'tableName':_0x41ab('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x30199b){var _0x1a5529=this[_0x41ab('0x51')]({'plain':!![]});var _0x17df99=_0x1a5529[_0x41ab('0x2')]===_0x41ab('0xb')?_0x118e46(_0x1a5529):_0x365153(_0x1a5529);return _0x16bb7c(_0x1a5529,_0x30199b,_[_0x41ab('0x4d')](_0x17df99)[_0x41ab('0x4c')]+0x1)[_0x41ab('0x30')](function(_0x1bacb4){var _0x2de770=_[_0x41ab('0x4e')](_0x17df99,_0x1bacb4);_0x2de770['push']({'type':_0x1a5529[_0x41ab('0x2')],'app':_0x41ab('0x52'),'exten':_0x1a5529['exten'],'context':_0x1a5529['context'],'priority':_[_0x41ab('0x4d')](_0x2de770)[_0x41ab('0x4c')]+0x1,'VoiceExtensionId':_0x1a5529['id']});return _0x2de770;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index a7f077c..b53ac75 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 _0xc99e=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./voiceExtension.socket','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceExtension','VoiceExtension','options','raw','where','attributes','limit','map','model','include','debug','catch','lodash','util','moment','bluebird'];(function(_0x1d60d0,_0x2cfa88){var _0x1a0917=function(_0x24dc91){while(--_0x24dc91){_0x1d60d0['push'](_0x1d60d0['shift']());}};_0x1a0917(++_0x2cfa88);}(_0xc99e,0x6e));var _0xec99=function(_0x9f64db,_0x52acea){_0x9f64db=_0x9f64db-0x0;var _0x5ee363=_0xc99e[_0x9f64db];return _0x5ee363;};'use strict';var _=require(_0xec99('0x0'));var util=require(_0xec99('0x1'));var moment=require(_0xec99('0x2'));var BPromise=require(_0xec99('0x3'));var rs=require(_0xec99('0x4'));var fs=require('fs');var Redis=require(_0xec99('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xec99('0x6'));var logger=require(_0xec99('0x7'))(_0xec99('0x8'));var config=require(_0xec99('0x9'));var jayson=require(_0xec99('0xa'));var client=jayson[_0xec99('0xb')][_0xec99('0xc')]({'port':0x232a});config[_0xec99('0xd')]=_['defaults'](config[_0xec99('0xd')],{'host':_0xec99('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xec99('0xd')]));require(_0xec99('0xf'))['register'](socket);function respondWithRpcPromise(_0x5b36de,_0x44ee57,_0x223a39){return new BPromise(function(_0x1a057a,_0x581c2b){return client[_0xec99('0x10')](_0x5b36de,_0x223a39)[_0xec99('0x11')](function(_0x1853d7){logger[_0xec99('0x12')](_0xec99('0x13'),_0x44ee57,_0xec99('0x14'));logger['debug'](_0xec99('0x15'),_0x44ee57,'request\x20sent',JSON[_0xec99('0x16')](_0x1853d7));if(_0x1853d7['error']){if(_0x1853d7[_0xec99('0x17')]['code']===0x1f4){logger['error'](_0xec99('0x13'),_0x44ee57,_0x1853d7['error'][_0xec99('0x18')]);return _0x581c2b(_0x1853d7[_0xec99('0x17')][_0xec99('0x18')]);}logger[_0xec99('0x17')](_0xec99('0x13'),_0x44ee57,_0x1853d7[_0xec99('0x17')][_0xec99('0x18')]);return _0x1a057a(_0x1853d7['error'][_0xec99('0x18')]);}else{logger[_0xec99('0x12')](_0xec99('0x13'),_0x44ee57,_0xec99('0x14'));_0x1a057a(_0x1853d7[_0xec99('0x19')][_0xec99('0x18')]);}})['catch'](function(_0x5ca76c){logger['error'](_0xec99('0x13'),_0x44ee57,_0x5ca76c);_0x581c2b(_0x5ca76c);});});}exports[_0xec99('0x1a')]=function(_0x6127a9){var _0x46a09d=this;return new Promise(function(_0x2257f7,_0x1edaf9){return db[_0xec99('0x1b')]['findAll']({'raw':_0x6127a9['options']?_0x6127a9[_0xec99('0x1c')][_0xec99('0x1d')]===undefined?!![]:![]:!![],'where':_0x6127a9['options']?_0x6127a9[_0xec99('0x1c')][_0xec99('0x1e')]||null:null,'attributes':_0x6127a9[_0xec99('0x1c')]?_0x6127a9[_0xec99('0x1c')][_0xec99('0x1f')]||null:null,'limit':_0x6127a9[_0xec99('0x1c')]?_0x6127a9[_0xec99('0x1c')][_0xec99('0x20')]||null:null,'include':_0x6127a9[_0xec99('0x1c')]?_0x6127a9[_0xec99('0x1c')]['include']?_[_0xec99('0x21')](_0x6127a9['options']['include'],function(_0x5eebc1){return{'model':db[_0x5eebc1[_0xec99('0x22')]],'as':_0x5eebc1['as'],'attributes':_0x5eebc1[_0xec99('0x1f')],'include':_0x5eebc1[_0xec99('0x23')]?_[_0xec99('0x21')](_0x5eebc1['include'],function(_0x2baf58){return{'model':db[_0x2baf58[_0xec99('0x22')]],'as':_0x2baf58['as'],'attributes':_0x2baf58[_0xec99('0x1f')],'include':_0x2baf58[_0xec99('0x23')]?_[_0xec99('0x21')](_0x2baf58[_0xec99('0x23')],function(_0x34f1f5){return{'model':db[_0x34f1f5[_0xec99('0x22')]],'as':_0x34f1f5['as'],'attributes':_0x34f1f5[_0xec99('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xec99('0x11')](function(_0x153bde){logger['info'](_0xec99('0x1a'),_0x6127a9);logger[_0xec99('0x24')]('GetVoiceExtension',_0x6127a9,JSON[_0xec99('0x16')](_0x153bde));_0x2257f7(_0x153bde);})[_0xec99('0x25')](function(_0x80c90c){logger['error'](_0xec99('0x1a'),_0x80c90c[_0xec99('0x18')],_0x6127a9);_0x1edaf9(_0x46a09d[_0xec99('0x17')](0x1f4,_0x80c90c[_0xec99('0x18')]));});});}; \ No newline at end of file +var _0x644f=['limit','include','map','model','info','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes'];(function(_0x1ca361,_0x573b1c){var _0x454618=function(_0x50531a){while(--_0x50531a){_0x1ca361['push'](_0x1ca361['shift']());}};_0x454618(++_0x573b1c);}(_0x644f,0x177));var _0xf644=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0x644f[_0x318840];return _0x223da4;};'use strict';var _=require('lodash');var util=require(_0xf644('0x0'));var moment=require(_0xf644('0x1'));var BPromise=require(_0xf644('0x2'));var rs=require(_0xf644('0x3'));var fs=require('fs');var Redis=require(_0xf644('0x4'));var db=require(_0xf644('0x5'))['db'];var utils=require(_0xf644('0x6'));var logger=require(_0xf644('0x7'))(_0xf644('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf644('0x9')][_0xf644('0xa')]({'port':0x232a});config[_0xf644('0xb')]=_['defaults'](config[_0xf644('0xb')],{'host':_0xf644('0xc'),'port':0x18eb});var socket=require(_0xf644('0xd'))(new Redis(config[_0xf644('0xb')]));require(_0xf644('0xe'))['register'](socket);function respondWithRpcPromise(_0x35b8e5,_0x21e90a,_0x33a2c2){return new BPromise(function(_0xcd5688,_0x59d974){return client['request'](_0x35b8e5,_0x33a2c2)[_0xf644('0xf')](function(_0x517447){logger['info'](_0xf644('0x10'),_0x21e90a,_0xf644('0x11'));logger[_0xf644('0x12')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x21e90a,_0xf644('0x11'),JSON[_0xf644('0x13')](_0x517447));if(_0x517447[_0xf644('0x14')]){if(_0x517447[_0xf644('0x14')][_0xf644('0x15')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x21e90a,_0x517447['error']['message']);return _0x59d974(_0x517447['error'][_0xf644('0x16')]);}logger['error'](_0xf644('0x10'),_0x21e90a,_0x517447[_0xf644('0x14')][_0xf644('0x16')]);return _0xcd5688(_0x517447[_0xf644('0x14')][_0xf644('0x16')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x21e90a,_0xf644('0x11'));_0xcd5688(_0x517447[_0xf644('0x17')][_0xf644('0x16')]);}})[_0xf644('0x18')](function(_0x2b628d){logger[_0xf644('0x14')](_0xf644('0x10'),_0x21e90a,_0x2b628d);_0x59d974(_0x2b628d);});});}exports[_0xf644('0x19')]=function(_0x2c51ef){var _0x1c8c56=this;return new Promise(function(_0x1c5613,_0x567c1d){return db[_0xf644('0x1a')][_0xf644('0x1b')]({'raw':_0x2c51ef[_0xf644('0x1c')]?_0x2c51ef[_0xf644('0x1c')][_0xf644('0x1d')]===undefined?!![]:![]:!![],'where':_0x2c51ef['options']?_0x2c51ef[_0xf644('0x1c')][_0xf644('0x1e')]||null:null,'attributes':_0x2c51ef[_0xf644('0x1c')]?_0x2c51ef[_0xf644('0x1c')][_0xf644('0x1f')]||null:null,'limit':_0x2c51ef['options']?_0x2c51ef[_0xf644('0x1c')][_0xf644('0x20')]||null:null,'include':_0x2c51ef[_0xf644('0x1c')]?_0x2c51ef[_0xf644('0x1c')]['include']?_['map'](_0x2c51ef[_0xf644('0x1c')][_0xf644('0x21')],function(_0x372f30){return{'model':db[_0x372f30['model']],'as':_0x372f30['as'],'attributes':_0x372f30['attributes'],'include':_0x372f30[_0xf644('0x21')]?_[_0xf644('0x22')](_0x372f30[_0xf644('0x21')],function(_0x530a33){return{'model':db[_0x530a33[_0xf644('0x23')]],'as':_0x530a33['as'],'attributes':_0x530a33['attributes'],'include':_0x530a33[_0xf644('0x21')]?_[_0xf644('0x22')](_0x530a33[_0xf644('0x21')],function(_0x295c04){return{'model':db[_0x295c04[_0xf644('0x23')]],'as':_0x295c04['as'],'attributes':_0x295c04['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x44366a){logger[_0xf644('0x24')](_0xf644('0x19'),_0x2c51ef);logger['debug'](_0xf644('0x19'),_0x2c51ef,JSON[_0xf644('0x13')](_0x44366a));_0x1c5613(_0x44366a);})[_0xf644('0x18')](function(_0x42351e){logger[_0xf644('0x14')]('GetVoiceExtension',_0x42351e[_0xf644('0x16')],_0x2c51ef);_0x567c1d(_0x1c8c56[_0xf644('0x14')](0x1f4,_0x42351e[_0xf644('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index eeb3542..6e6b553 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['removeListener','register','length','./voiceExtension.events','save','emit'];(function(_0xf0bb34,_0x41f9f9){var _0x38ca87=function(_0x35e477){while(--_0x35e477){_0xf0bb34['push'](_0xf0bb34['shift']());}};_0x38ca87(++_0x41f9f9);}(_0xe14b,0x93));var _0xbe14=function(_0x1d0738,_0x1fb903){_0x1d0738=_0x1d0738-0x0;var _0x516ff8=_0xe14b[_0x1d0738];return _0x516ff8;};'use strict';var VoiceExtensionEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){VoiceExtensionEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('voiceExtension:'+_0x196fca,_0x1fe204);VoiceExtensionEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file +var _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x49cde6,_0x492715){var _0x5987f4=function(_0x3f6e71){while(--_0x3f6e71){_0x49cde6['push'](_0x49cde6['shift']());}};_0x5987f4(++_0x492715);}(_0x4975,0x86));var _0x5497=function(_0x583bd4,_0x408786){_0x583bd4=_0x583bd4-0x0;var _0x488c80=_0x4975[_0x583bd4];return _0x488c80;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 71d755a..2fe4ee0 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 _0x3f8a=['show','/:id/messages','getMessages','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id'];(function(_0x431043,_0x1dec39){var _0x4206ca=function(_0x343259){while(--_0x343259){_0x431043['push'](_0x431043['shift']());}};_0x4206ca(++_0x1dec39);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x463e45,_0x365ff8){_0x463e45=_0x463e45-0x0;var _0x34290c=_0x3f8a[_0x463e45];return _0x34290c;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var fs_extra=require(_0xa3f8('0x5'));var auth=require(_0xa3f8('0x6'));var interaction=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var controller=require(_0xa3f8('0x9'));router[_0xa3f8('0xa')]('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xc')]);router[_0xa3f8('0xa')](_0xa3f8('0xd'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0xe')]);router[_0xa3f8('0xa')](_0xa3f8('0xf'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x10')]);router['post']('/',auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x11')]);router[_0xa3f8('0x12')](_0xa3f8('0xd'),auth['isAuthenticated'](),controller[_0xa3f8('0x13')]);router[_0xa3f8('0x14')](_0xa3f8('0xd'),auth[_0xa3f8('0xb')](),controller[_0xa3f8('0x15')]);module[_0xa3f8('0x16')]=router; \ No newline at end of file +var _0x32f4=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','getMessages','post','create','update','exports'];(function(_0x189f99,_0x1bb970){var _0x29ee75=function(_0x60bffe){while(--_0x60bffe){_0x189f99['push'](_0x189f99['shift']());}};_0x29ee75(++_0x1bb970);}(_0x32f4,0x154));var _0x432f=function(_0x4d2789,_0x50788d){_0x4d2789=_0x4d2789-0x0;var _0xaf9c17=_0x32f4[_0x4d2789];return _0xaf9c17;};'use strict';var multer=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var path=require(_0x432f('0x2'));var timeout=require(_0x432f('0x3'));var express=require('express');var router=express[_0x432f('0x4')]();var fs_extra=require(_0x432f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x432f('0x6'));var config=require(_0x432f('0x7'));var controller=require(_0x432f('0x8'));router[_0x432f('0x9')]('/',auth[_0x432f('0xa')](),controller['index']);router['get'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['show']);router[_0x432f('0x9')]('/:id/messages',auth[_0x432f('0xa')](),controller[_0x432f('0xc')]);router[_0x432f('0xd')]('/',auth[_0x432f('0xa')](),controller[_0x432f('0xe')]);router['put'](_0x432f('0xb'),auth['isAuthenticated'](),controller[_0x432f('0xf')]);router['delete'](_0x432f('0xb'),auth[_0x432f('0xa')](),controller['destroy']);module[_0x432f('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index ccfca62..aa18fb6 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 _0x9a41=['email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','mailbox','exports','STRING','contest_mailbox','setDataValue'];(function(_0x2a5416,_0x68ca20){var _0x2cd67f=function(_0x2a5ff3){while(--_0x2a5ff3){_0x2a5416['push'](_0x2a5416['shift']());}};_0x2cd67f(++_0x68ca20);}(_0x9a41,0x9c));var _0x19a4=function(_0x325333,_0x3fc06e){_0x325333=_0x325333-0x0;var _0x58637a=_0x9a41[_0x325333];return _0x58637a;};'use strict';var Sequelize=require('sequelize');module[_0x19a4('0x0')]={'customer_id':{'type':Sequelize[_0x19a4('0x1')]},'context':{'type':Sequelize[_0x19a4('0x1')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x19a4('0x1')],'defaultValue':'','allowNull':![],'unique':_0x19a4('0x2')},'password':{'type':Sequelize[_0x19a4('0x1')]},'fullname':{'type':Sequelize[_0x19a4('0x1')]},'email':{'type':Sequelize[_0x19a4('0x1')],'validate':{'isEmail':!![]},'set':function(_0x113a4e){this[_0x19a4('0x3')](_0x19a4('0x4'),typeof _0x113a4e===_0x19a4('0x5')&&_0x113a4e[_0x19a4('0x6')]()?_0x113a4e[_0x19a4('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x19a4('0x1')],'defaultValue':_0x19a4('0x7')},'attach':{'type':Sequelize[_0x19a4('0x8')](_0x19a4('0x9'),'no'),'defaultValue':_0x19a4('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x19a4('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x19a4('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x19a4('0x8')](_0x19a4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x19a4('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x19a4('0x8')](_0x19a4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x19a4('0x8')](_0x19a4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x19a4('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x19a4('0x8')](_0x19a4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x19a4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x19a4('0x8')](_0x19a4('0x9'),'no'),'defaultValue':_0x19a4('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x19a4('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x19a4('0x8')](_0x19a4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x19a4('0x9'),'no'),'defaultValue':_0x19a4('0x9'),'allowNull':![]},'stamp':{'type':_0x19a4('0xb')},'emailsubject':{'type':Sequelize[_0x19a4('0x1')]},'emailbody':{'type':Sequelize[_0x19a4('0x1')]},'maxsecs':{'type':Sequelize[_0x19a4('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x19a4('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x19a4('0xd')](_0x19a4('0xe'))+'\x20-\x20'+this['getDataValue'](_0x19a4('0xf'));}}}; \ No newline at end of file +var _0x91e0=['getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL'];(function(_0x9d5969,_0x3177ef){var _0x442cb4=function(_0x1df983){while(--_0x1df983){_0x9d5969['push'](_0x9d5969['shift']());}};_0x442cb4(++_0x3177ef);}(_0x91e0,0x16c));var _0x091e=function(_0x38c7a1,_0x17f38c){_0x38c7a1=_0x38c7a1-0x0;var _0x52a582=_0x91e0[_0x38c7a1];return _0x52a582;};'use strict';var Sequelize=require(_0x091e('0x0'));module[_0x091e('0x1')]={'customer_id':{'type':Sequelize[_0x091e('0x2')]},'context':{'type':Sequelize[_0x091e('0x2')],'defaultValue':_0x091e('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x091e('0x2')],'defaultValue':'','allowNull':![],'unique':_0x091e('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x091e('0x2')]},'email':{'type':Sequelize[_0x091e('0x2')],'validate':{'isEmail':!![]},'set':function(_0x56d3b6){this[_0x091e('0x5')]('email',typeof _0x56d3b6===_0x091e('0x6')&&_0x56d3b6[_0x091e('0x7')]()?_0x56d3b6[_0x091e('0x7')]():null);}},'pager':{'type':Sequelize[_0x091e('0x2')]},'tz':{'type':Sequelize[_0x091e('0x2')],'defaultValue':_0x091e('0x8')},'attach':{'type':Sequelize[_0x091e('0x9')](_0x091e('0xa'),'no'),'defaultValue':_0x091e('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x091e('0x9')](_0x091e('0xa'),'no'),'defaultValue':_0x091e('0xa'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x091e('0x9')](_0x091e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x091e('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x091e('0x9')](_0x091e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x091e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x091e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x091e('0x9')](_0x091e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x091e('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x091e('0x9')](_0x091e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x091e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x091e('0x9')](_0x091e('0xa'),'no'),'defaultValue':_0x091e('0xa'),'allowNull':![]},'stamp':{'type':_0x091e('0xb')},'emailsubject':{'type':Sequelize[_0x091e('0x2')]},'emailbody':{'type':Sequelize[_0x091e('0x2')]},'maxsecs':{'type':Sequelize[_0x091e('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x091e('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x091e('0xd')],'get':function(){return this[_0x091e('0xe')](_0x091e('0xf'))+_0x091e('0x10')+this[_0x091e('0xe')](_0x091e('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index c3b52c3..853a511 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 _0xb9a7=['model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','filter','options','VoiceMail','includeAll','include','findAll','rows','params','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','body','findOne','VoiceMailMessage','rawAttributes','nolimit','findAndCountAll','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','fieldName','type'];(function(_0x336d34,_0x41a5f4){var _0x23116c=function(_0x2b0be9){while(--_0x2b0be9){_0x336d34['push'](_0x336d34['shift']());}};_0x23116c(++_0x41a5f4);}(_0xb9a7,0x112));var _0x7b9a=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xb9a7[_0x8c43de];return _0xa6591b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b9a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7b9a('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x7b9a('0x2'));var util=require(_0x7b9a('0x3'));var path=require(_0x7b9a('0x4'));var sox=require(_0x7b9a('0x5'));var csv=require(_0x7b9a('0x6'));var ejs=require(_0x7b9a('0x7'));var fs=require('fs');var fs_extra=require(_0x7b9a('0x8'));var _=require(_0x7b9a('0x9'));var squel=require(_0x7b9a('0xa'));var crypto=require(_0x7b9a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7b9a('0xc'));var toCsv=require(_0x7b9a('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7b9a('0xd'));var qs=require(_0x7b9a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b9a('0xf'));var logger=require('../../config/logger')(_0x7b9a('0x10'));var utils=require('../../config/utils');var config=require(_0x7b9a('0x11'));var licenseUtil=require(_0x7b9a('0x12'));var db=require(_0x7b9a('0x13'))['db'];function respondWithStatusCode(_0x5948ca,_0x32f616){_0x32f616=_0x32f616||0xcc;return function(_0xec5949){if(_0xec5949){return _0x5948ca['sendStatus'](_0x32f616);}return _0x5948ca[_0x7b9a('0x14')](_0x32f616)[_0x7b9a('0x15')]();};}function respondWithResult(_0x4b7ec0,_0xb157e5){_0xb157e5=_0xb157e5||0xc8;return function(_0xde180d){if(_0xde180d){return _0x4b7ec0[_0x7b9a('0x14')](_0xb157e5)[_0x7b9a('0x16')](_0xde180d);}};}function respondWithFilteredResult(_0x344fa7,_0x346daa){return function(_0x22a7e4){if(_0x22a7e4){var _0x35e602=typeof _0x346daa[_0x7b9a('0x17')]==='undefined'&&typeof _0x346daa[_0x7b9a('0x18')]==='undefined';var _0x123921=_0x22a7e4[_0x7b9a('0x19')];var _0x271263=_0x35e602?0x0:_0x346daa[_0x7b9a('0x17')];var _0x44a232=_0x35e602?_0x22a7e4[_0x7b9a('0x19')]:_0x346daa[_0x7b9a('0x17')]+_0x346daa[_0x7b9a('0x18')];var _0x2064a0;if(_0x44a232>=_0x123921){_0x44a232=_0x123921;_0x2064a0=0xc8;}else{_0x2064a0=0xce;}_0x344fa7[_0x7b9a('0x14')](_0x2064a0);return _0x344fa7[_0x7b9a('0x1a')](_0x7b9a('0x1b'),_0x271263+'-'+_0x44a232+'/'+_0x123921)[_0x7b9a('0x16')](_0x22a7e4);}return null;};}function patchUpdates(_0x58aed7){return function(_0x993048){try{jsonpatch['apply'](_0x993048,_0x58aed7,!![]);}catch(_0x1eacbc){return BPromise['reject'](_0x1eacbc);}return _0x993048[_0x7b9a('0x1c')]();};}function saveUpdates(_0x331ae6,_0x23d812){return function(_0x54fda7){if(_0x54fda7){return _0x54fda7[_0x7b9a('0x1d')](_0x331ae6)[_0x7b9a('0x1e')](function(_0x5705b2){return _0x5705b2;});}return null;};}function removeEntity(_0x35aca7,_0x374dca){return function(_0x269c07){if(_0x269c07){return _0x269c07[_0x7b9a('0x1f')]()[_0x7b9a('0x1e')](function(){var _0x5b2f52=_0x269c07[_0x7b9a('0x20')]({'plain':!![]});var _0x23219e='Voicemails';return db[_0x7b9a('0x21')]['destroy']({'where':{'type':_0x23219e,'resourceId':_0x5b2f52['id']}})[_0x7b9a('0x1e')](function(){return _0x269c07;});})[_0x7b9a('0x1e')](function(){_0x35aca7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x24d886,_0x55301c){return function(_0x54df8a){if(!_0x54df8a){_0x24d886[_0x7b9a('0x22')](0x194);}return _0x54df8a;};}function handleError(_0x58fec8,_0x5be740){_0x5be740=_0x5be740||0x1f4;return function(_0x3847b4){logger['error'](_0x3847b4[_0x7b9a('0x23')]);if(_0x3847b4[_0x7b9a('0x24')]){delete _0x3847b4['name'];}_0x58fec8[_0x7b9a('0x14')](_0x5be740)[_0x7b9a('0x25')](_0x3847b4);};}exports[_0x7b9a('0x26')]=function(_0x5b64d7,_0x45ccf5){var _0x2ce78b={},_0x181e9c={},_0x6c8b1f={'count':0x0,'rows':[]};var _0x5028e7=_[_0x7b9a('0x27')](db['VoiceMail']['rawAttributes'],function(_0x2d278e){return{'name':_0x2d278e[_0x7b9a('0x28')],'type':_0x2d278e[_0x7b9a('0x29')]['key']};});_0x181e9c[_0x7b9a('0x2a')]=_[_0x7b9a('0x27')](_0x5028e7,'name');_0x181e9c['query']=_[_0x7b9a('0x2b')](_0x5b64d7[_0x7b9a('0x2c')]);_0x181e9c['filters']=_[_0x7b9a('0x2d')](_0x181e9c[_0x7b9a('0x2a')],_0x181e9c[_0x7b9a('0x2c')]);_0x2ce78b[_0x7b9a('0x2e')]=_[_0x7b9a('0x2d')](_0x181e9c['model'],qs[_0x7b9a('0x2f')](_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x2f')]));_0x2ce78b[_0x7b9a('0x2e')]=_0x2ce78b[_0x7b9a('0x2e')][_0x7b9a('0x30')]?_0x2ce78b['attributes']:_0x181e9c['model'];if(!_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x31')]('nolimit')){_0x2ce78b[_0x7b9a('0x18')]=qs[_0x7b9a('0x18')](_0x5b64d7[_0x7b9a('0x2c')]['limit']);_0x2ce78b[_0x7b9a('0x17')]=qs[_0x7b9a('0x17')](_0x5b64d7['query']['offset']);}_0x2ce78b[_0x7b9a('0x32')]=qs[_0x7b9a('0x33')](_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x33')]);_0x2ce78b[_0x7b9a('0x34')]=qs[_0x7b9a('0x35')](_[_0x7b9a('0x36')](_0x5b64d7[_0x7b9a('0x2c')],_0x181e9c['filters']),_0x5028e7);if(_0x5b64d7[_0x7b9a('0x2c')]['filter']){_0x2ce78b[_0x7b9a('0x34')]=_[_0x7b9a('0x37')](_0x2ce78b[_0x7b9a('0x34')],{'$or':_[_0x7b9a('0x27')](_0x5028e7,function(_0x3fa4cd){if(_0x3fa4cd[_0x7b9a('0x29')]!=='VIRTUAL'){var _0x34eebe={};_0x34eebe[_0x3fa4cd[_0x7b9a('0x24')]]={'$like':'%'+_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x38')]+'%'};return _0x34eebe;}})});}_0x2ce78b=_['merge']({},_0x2ce78b,_0x5b64d7[_0x7b9a('0x39')]);var _0xf86939={'where':_0x2ce78b[_0x7b9a('0x34')]};return db[_0x7b9a('0x3a')]['count'](_0xf86939)[_0x7b9a('0x1e')](function(_0x53d89a){_0x6c8b1f[_0x7b9a('0x19')]=_0x53d89a;if(_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x3b')]){_0x2ce78b[_0x7b9a('0x3c')]=[{'all':!![]}];}return db[_0x7b9a('0x3a')][_0x7b9a('0x3d')](_0x2ce78b);})['then'](function(_0x33edc6){_0x6c8b1f[_0x7b9a('0x3e')]=_0x33edc6;return _0x6c8b1f;})[_0x7b9a('0x1e')](respondWithFilteredResult(_0x45ccf5,_0x2ce78b))['catch'](handleError(_0x45ccf5,null));};exports['show']=function(_0x3724fe,_0x454b35){var _0x995d59={'raw':!![],'where':{'id':_0x3724fe[_0x7b9a('0x3f')]['id']}},_0x5cd3dd={};_0x5cd3dd[_0x7b9a('0x2a')]=_['keys'](db['VoiceMail']['rawAttributes']);_0x5cd3dd[_0x7b9a('0x2c')]=_[_0x7b9a('0x2b')](_0x3724fe['query']);_0x5cd3dd[_0x7b9a('0x35')]=_[_0x7b9a('0x2d')](_0x5cd3dd[_0x7b9a('0x2a')],_0x5cd3dd['query']);_0x995d59[_0x7b9a('0x2e')]=_['intersection'](_0x5cd3dd[_0x7b9a('0x2a')],qs[_0x7b9a('0x2f')](_0x3724fe[_0x7b9a('0x2c')][_0x7b9a('0x2f')]));_0x995d59[_0x7b9a('0x2e')]=_0x995d59['attributes'][_0x7b9a('0x30')]?_0x995d59['attributes']:_0x5cd3dd[_0x7b9a('0x2a')];if(_0x3724fe['query']['includeAll']){_0x995d59[_0x7b9a('0x3c')]=[{'all':!![]}];}_0x995d59=_[_0x7b9a('0x37')]({},_0x995d59,_0x3724fe[_0x7b9a('0x39')]);return db[_0x7b9a('0x3a')][_0x7b9a('0x40')](_0x995d59)[_0x7b9a('0x1e')](handleEntityNotFound(_0x454b35,null))[_0x7b9a('0x1e')](respondWithResult(_0x454b35,null))[_0x7b9a('0x41')](handleError(_0x454b35,null));};exports[_0x7b9a('0x42')]=function(_0x5088c7,_0x1d7957){return db[_0x7b9a('0x3a')]['create'](_0x5088c7['body'],{})['then'](function(_0x1b3e65){var _0x30296e=_0x5088c7[_0x7b9a('0x43')][_0x7b9a('0x20')]({'plain':!![]});if(!_0x30296e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30296e[_0x7b9a('0x44')]===_0x7b9a('0x43')){var _0x287dea=_0x1b3e65[_0x7b9a('0x20')]({'plain':!![]});var _0x2d083b='Voicemails';return db[_0x7b9a('0x45')]['find']({'where':{'name':_0x2d083b,'userProfileId':_0x30296e[_0x7b9a('0x46')]},'raw':!![]})[_0x7b9a('0x1e')](function(_0x239146){if(_0x239146&&_0x239146[_0x7b9a('0x47')]===0x0){return db['UserProfileResource'][_0x7b9a('0x42')]({'name':_0x287dea[_0x7b9a('0x24')],'resourceId':_0x287dea['id'],'type':_0x239146[_0x7b9a('0x24')],'sectionId':_0x239146['id']},{})[_0x7b9a('0x1e')](function(){return _0x1b3e65;});}else{return _0x1b3e65;}})[_0x7b9a('0x41')](function(_0x3e2f1b){logger[_0x7b9a('0x48')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e2f1b);throw _0x3e2f1b;});}return _0x1b3e65;})['then'](respondWithResult(_0x1d7957,0xc9))['catch'](handleError(_0x1d7957,null));};exports[_0x7b9a('0x1d')]=function(_0x2f8929,_0x5a1b7d){if(_0x2f8929['body']['id']){delete _0x2f8929['body']['id'];}return db['VoiceMail'][_0x7b9a('0x40')]({'where':{'id':_0x2f8929[_0x7b9a('0x3f')]['id']}})[_0x7b9a('0x1e')](handleEntityNotFound(_0x5a1b7d,null))[_0x7b9a('0x1e')](saveUpdates(_0x2f8929[_0x7b9a('0x49')],null))[_0x7b9a('0x1e')](respondWithResult(_0x5a1b7d,null))[_0x7b9a('0x41')](handleError(_0x5a1b7d,null));};exports[_0x7b9a('0x1f')]=function(_0x5dc17e,_0x1f99f5){return db['VoiceMail'][_0x7b9a('0x40')]({'where':{'id':_0x5dc17e[_0x7b9a('0x3f')]['id']}})[_0x7b9a('0x1e')](handleEntityNotFound(_0x1f99f5,null))[_0x7b9a('0x1e')](removeEntity(_0x1f99f5,null))[_0x7b9a('0x41')](handleError(_0x1f99f5,null));};exports['getMessages']=function(_0x25ec82,_0x491804,_0x3d2df4){return db[_0x7b9a('0x3a')][_0x7b9a('0x4a')]({'where':{'id':_0x25ec82['params']['id']}})['then'](handleEntityNotFound(_0x491804,null))['then'](function(_0x4f6843){var _0x33375c;var _0x8a777f={},_0xb91099={};_0xb91099['model']=_[_0x7b9a('0x2b')](db[_0x7b9a('0x4b')][_0x7b9a('0x4c')]);_0xb91099[_0x7b9a('0x2c')]=_[_0x7b9a('0x2b')](_0x25ec82['query']);_0xb91099[_0x7b9a('0x35')]=_[_0x7b9a('0x2d')](_0xb91099[_0x7b9a('0x2a')],_0xb91099['query']);_0x8a777f['attributes']=_['intersection'](_0xb91099[_0x7b9a('0x2a')],qs[_0x7b9a('0x2f')](_0x25ec82[_0x7b9a('0x2c')]['fields']));_0x8a777f[_0x7b9a('0x2e')]=_0x8a777f[_0x7b9a('0x2e')]['length']?_0x8a777f[_0x7b9a('0x2e')]:_0xb91099['model'];if(!_0x25ec82[_0x7b9a('0x2c')]['hasOwnProperty'](_0x7b9a('0x4d'))){_0x8a777f[_0x7b9a('0x18')]=qs[_0x7b9a('0x18')](_0x25ec82[_0x7b9a('0x2c')]['limit']);_0x8a777f[_0x7b9a('0x17')]=qs[_0x7b9a('0x17')](_0x25ec82[_0x7b9a('0x2c')][_0x7b9a('0x17')]);}_0x8a777f['order']=qs[_0x7b9a('0x33')](_0x25ec82['query'][_0x7b9a('0x33')]);_0x8a777f['where']=qs[_0x7b9a('0x35')](_['pick'](_0x25ec82['query'],_0xb91099['filters']));if(_0x25ec82['query'][_0x7b9a('0x38')]){_0x8a777f[_0x7b9a('0x34')]=_[_0x7b9a('0x37')](_0x8a777f[_0x7b9a('0x34')],{'$or':_['map'](_0x8a777f[_0x7b9a('0x2e')],function(_0x4b9462){var _0x50b6f1={};_0x50b6f1[_0x4b9462]={'$like':'%'+_0x25ec82[_0x7b9a('0x2c')]['filter']+'%'};return _0x50b6f1;})});}_0x8a777f['where']=_[_0x7b9a('0x37')](_0x8a777f[_0x7b9a('0x34')],{'mailboxuser':_0x4f6843['mailbox']});_0x8a777f=_[_0x7b9a('0x37')]({},_0x8a777f,_0x25ec82['options']);return db[_0x7b9a('0x4b')][_0x7b9a('0x4e')](_0x8a777f)[_0x7b9a('0x1e')](respondWithFilteredResult(_0x491804,_0x8a777f));})['catch'](handleError(_0x491804,null));}; \ No newline at end of file +var _0x13f6=['destroy','Voicemails','error','send','index','map','VoiceMail','rawAttributes','fieldName','type','model','name','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','user','get','UserProfileSection','userProfileId','UserProfileResource','getMessages','findOne','VoiceMailMessage','pick','findAndCountAll','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then'];(function(_0x202780,_0x4889b5){var _0x386548=function(_0x334391){while(--_0x334391){_0x202780['push'](_0x202780['shift']());}};_0x386548(++_0x4889b5);}(_0x13f6,0x124));var _0x613f=function(_0xbd3294,_0xf4ef07){_0xbd3294=_0xbd3294-0x0;var _0x5db501=_0x13f6[_0xbd3294];return _0x5db501;};'use strict';var emlformat=require(_0x613f('0x0'));var rimraf=require(_0x613f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x613f('0x2'));var moment=require(_0x613f('0x3'));var BPromise=require(_0x613f('0x4'));var Mustache=require('mustache');var util=require(_0x613f('0x5'));var path=require(_0x613f('0x6'));var sox=require(_0x613f('0x7'));var csv=require('to-csv');var ejs=require(_0x613f('0x8'));var fs=require('fs');var fs_extra=require(_0x613f('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x613f('0xa'));var toCsv=require(_0x613f('0xb'));var querystring=require(_0x613f('0xc'));var Papa=require(_0x613f('0xd'));var Redis=require('ioredis');var authService=require(_0x613f('0xe'));var qs=require(_0x613f('0xf'));var as=require(_0x613f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x613f('0x11'))(_0x613f('0x12'));var utils=require(_0x613f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x613f('0x14'));var db=require(_0x613f('0x15'))['db'];function respondWithStatusCode(_0x542230,_0x4c2a85){_0x4c2a85=_0x4c2a85||0xcc;return function(_0x517f57){if(_0x517f57){return _0x542230[_0x613f('0x16')](_0x4c2a85);}return _0x542230[_0x613f('0x17')](_0x4c2a85)[_0x613f('0x18')]();};}function respondWithResult(_0x375db1,_0x329fcf){_0x329fcf=_0x329fcf||0xc8;return function(_0x4a6fc){if(_0x4a6fc){return _0x375db1[_0x613f('0x17')](_0x329fcf)[_0x613f('0x19')](_0x4a6fc);}};}function respondWithFilteredResult(_0x2eee4d,_0x1d68fd){return function(_0x548218){if(_0x548218){var _0x3c9edf=typeof _0x1d68fd['offset']==='undefined'&&typeof _0x1d68fd[_0x613f('0x1a')]===_0x613f('0x1b');var _0x544eca=_0x548218[_0x613f('0x1c')];var _0x4f9dae=_0x3c9edf?0x0:_0x1d68fd[_0x613f('0x1d')];var _0x1e5a11=_0x3c9edf?_0x548218[_0x613f('0x1c')]:_0x1d68fd[_0x613f('0x1d')]+_0x1d68fd[_0x613f('0x1a')];var _0x1ba35f;if(_0x1e5a11>=_0x544eca){_0x1e5a11=_0x544eca;_0x1ba35f=0xc8;}else{_0x1ba35f=0xce;}_0x2eee4d['status'](_0x1ba35f);return _0x2eee4d['set'](_0x613f('0x1e'),_0x4f9dae+'-'+_0x1e5a11+'/'+_0x544eca)['json'](_0x548218);}return null;};}function patchUpdates(_0x48493c){return function(_0x3c9b58){try{jsonpatch[_0x613f('0x1f')](_0x3c9b58,_0x48493c,!![]);}catch(_0x4f5a5a){return BPromise[_0x613f('0x20')](_0x4f5a5a);}return _0x3c9b58[_0x613f('0x21')]();};}function saveUpdates(_0x2aa14b,_0x48b28a){return function(_0x5401c2){if(_0x5401c2){return _0x5401c2[_0x613f('0x22')](_0x2aa14b)[_0x613f('0x23')](function(_0x2acfcf){return _0x2acfcf;});}return null;};}function removeEntity(_0x51f376,_0x41104e){return function(_0x33e0c6){if(_0x33e0c6){return _0x33e0c6[_0x613f('0x24')]()[_0x613f('0x23')](function(){var _0x3013a1=_0x33e0c6['get']({'plain':!![]});var _0x30fb15=_0x613f('0x25');return db['UserProfileResource'][_0x613f('0x24')]({'where':{'type':_0x30fb15,'resourceId':_0x3013a1['id']}})[_0x613f('0x23')](function(){return _0x33e0c6;});})[_0x613f('0x23')](function(){_0x51f376['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a4a8b,_0x379920){return function(_0x594c28){if(!_0x594c28){_0x5a4a8b[_0x613f('0x16')](0x194);}return _0x594c28;};}function handleError(_0x1767db,_0x4ca372){_0x4ca372=_0x4ca372||0x1f4;return function(_0x121241){logger[_0x613f('0x26')](_0x121241['stack']);if(_0x121241['name']){delete _0x121241['name'];}_0x1767db[_0x613f('0x17')](_0x4ca372)[_0x613f('0x27')](_0x121241);};}exports[_0x613f('0x28')]=function(_0x47f4af,_0x23eda8){var _0x439478={},_0xd335a6={},_0x19bb8f={'count':0x0,'rows':[]};var _0x4f8500=_[_0x613f('0x29')](db[_0x613f('0x2a')][_0x613f('0x2b')],function(_0x728f45){return{'name':_0x728f45[_0x613f('0x2c')],'type':_0x728f45[_0x613f('0x2d')]['key']};});_0xd335a6[_0x613f('0x2e')]=_[_0x613f('0x29')](_0x4f8500,_0x613f('0x2f'));_0xd335a6['query']=_[_0x613f('0x30')](_0x47f4af['query']);_0xd335a6[_0x613f('0x31')]=_[_0x613f('0x32')](_0xd335a6[_0x613f('0x2e')],_0xd335a6[_0x613f('0x33')]);_0x439478[_0x613f('0x34')]=_[_0x613f('0x32')](_0xd335a6['model'],qs[_0x613f('0x35')](_0x47f4af[_0x613f('0x33')][_0x613f('0x35')]));_0x439478[_0x613f('0x34')]=_0x439478[_0x613f('0x34')]['length']?_0x439478['attributes']:_0xd335a6['model'];if(!_0x47f4af[_0x613f('0x33')][_0x613f('0x36')](_0x613f('0x37'))){_0x439478[_0x613f('0x1a')]=qs['limit'](_0x47f4af[_0x613f('0x33')][_0x613f('0x1a')]);_0x439478['offset']=qs[_0x613f('0x1d')](_0x47f4af['query'][_0x613f('0x1d')]);}_0x439478['order']=qs[_0x613f('0x38')](_0x47f4af['query'][_0x613f('0x38')]);_0x439478[_0x613f('0x39')]=qs[_0x613f('0x31')](_['pick'](_0x47f4af[_0x613f('0x33')],_0xd335a6[_0x613f('0x31')]),_0x4f8500);if(_0x47f4af[_0x613f('0x33')][_0x613f('0x3a')]){_0x439478[_0x613f('0x39')]=_[_0x613f('0x3b')](_0x439478[_0x613f('0x39')],{'$or':_[_0x613f('0x29')](_0x4f8500,function(_0x1f71f3){if(_0x1f71f3[_0x613f('0x2d')]!=='VIRTUAL'){var _0x28b1bc={};_0x28b1bc[_0x1f71f3[_0x613f('0x2f')]]={'$like':'%'+_0x47f4af[_0x613f('0x33')][_0x613f('0x3a')]+'%'};return _0x28b1bc;}})});}_0x439478=_[_0x613f('0x3b')]({},_0x439478,_0x47f4af[_0x613f('0x3c')]);var _0xa76fff={'where':_0x439478['where']};return db[_0x613f('0x2a')][_0x613f('0x1c')](_0xa76fff)[_0x613f('0x23')](function(_0x3d2d7b){_0x19bb8f[_0x613f('0x1c')]=_0x3d2d7b;if(_0x47f4af[_0x613f('0x33')][_0x613f('0x3d')]){_0x439478['include']=[{'all':!![]}];}return db[_0x613f('0x2a')][_0x613f('0x3e')](_0x439478);})[_0x613f('0x23')](function(_0x2f584e){_0x19bb8f[_0x613f('0x3f')]=_0x2f584e;return _0x19bb8f;})[_0x613f('0x23')](respondWithFilteredResult(_0x23eda8,_0x439478))[_0x613f('0x40')](handleError(_0x23eda8,null));};exports[_0x613f('0x41')]=function(_0x403feb,_0x2d2574){var _0x12647a={'raw':!![],'where':{'id':_0x403feb[_0x613f('0x42')]['id']}},_0x258a71={};_0x258a71['model']=_[_0x613f('0x30')](db[_0x613f('0x2a')][_0x613f('0x2b')]);_0x258a71[_0x613f('0x33')]=_['keys'](_0x403feb[_0x613f('0x33')]);_0x258a71[_0x613f('0x31')]=_[_0x613f('0x32')](_0x258a71[_0x613f('0x2e')],_0x258a71[_0x613f('0x33')]);_0x12647a[_0x613f('0x34')]=_[_0x613f('0x32')](_0x258a71[_0x613f('0x2e')],qs[_0x613f('0x35')](_0x403feb[_0x613f('0x33')]['fields']));_0x12647a['attributes']=_0x12647a[_0x613f('0x34')][_0x613f('0x43')]?_0x12647a['attributes']:_0x258a71[_0x613f('0x2e')];if(_0x403feb[_0x613f('0x33')][_0x613f('0x3d')]){_0x12647a[_0x613f('0x44')]=[{'all':!![]}];}_0x12647a=_[_0x613f('0x3b')]({},_0x12647a,_0x403feb[_0x613f('0x3c')]);return db[_0x613f('0x2a')][_0x613f('0x45')](_0x12647a)[_0x613f('0x23')](handleEntityNotFound(_0x2d2574,null))[_0x613f('0x23')](respondWithResult(_0x2d2574,null))[_0x613f('0x40')](handleError(_0x2d2574,null));};exports[_0x613f('0x46')]=function(_0x174e22,_0x17f8e5){return db[_0x613f('0x2a')][_0x613f('0x46')](_0x174e22[_0x613f('0x47')],{})[_0x613f('0x23')](function(_0x5a4079){var _0x47c84b=_0x174e22[_0x613f('0x48')][_0x613f('0x49')]({'plain':!![]});if(!_0x47c84b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47c84b['role']===_0x613f('0x48')){var _0x51729a=_0x5a4079['get']({'plain':!![]});var _0x6e006b=_0x613f('0x25');return db[_0x613f('0x4a')]['find']({'where':{'name':_0x6e006b,'userProfileId':_0x47c84b[_0x613f('0x4b')]},'raw':!![]})[_0x613f('0x23')](function(_0x4f59b6){if(_0x4f59b6&&_0x4f59b6['autoAssociation']===0x0){return db[_0x613f('0x4c')][_0x613f('0x46')]({'name':_0x51729a[_0x613f('0x2f')],'resourceId':_0x51729a['id'],'type':_0x4f59b6[_0x613f('0x2f')],'sectionId':_0x4f59b6['id']},{})[_0x613f('0x23')](function(){return _0x5a4079;});}else{return _0x5a4079;}})[_0x613f('0x40')](function(_0x24d162){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24d162);throw _0x24d162;});}return _0x5a4079;})[_0x613f('0x23')](respondWithResult(_0x17f8e5,0xc9))['catch'](handleError(_0x17f8e5,null));};exports['update']=function(_0x387913,_0x52c2a6){if(_0x387913[_0x613f('0x47')]['id']){delete _0x387913['body']['id'];}return db[_0x613f('0x2a')][_0x613f('0x45')]({'where':{'id':_0x387913[_0x613f('0x42')]['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x52c2a6,null))[_0x613f('0x23')](saveUpdates(_0x387913[_0x613f('0x47')],null))[_0x613f('0x23')](respondWithResult(_0x52c2a6,null))['catch'](handleError(_0x52c2a6,null));};exports[_0x613f('0x24')]=function(_0x4ff3ad,_0x3ce3dd){return db[_0x613f('0x2a')][_0x613f('0x45')]({'where':{'id':_0x4ff3ad[_0x613f('0x42')]['id']}})[_0x613f('0x23')](handleEntityNotFound(_0x3ce3dd,null))[_0x613f('0x23')](removeEntity(_0x3ce3dd,null))[_0x613f('0x40')](handleError(_0x3ce3dd,null));};exports[_0x613f('0x4d')]=function(_0x214d01,_0x49637d,_0x2ebce1){return db[_0x613f('0x2a')][_0x613f('0x4e')]({'where':{'id':_0x214d01['params']['id']}})['then'](handleEntityNotFound(_0x49637d,null))[_0x613f('0x23')](function(_0x4b6eb3){var _0xcb1c9d;var _0x3c3cd7={},_0x42a72b={};_0x42a72b[_0x613f('0x2e')]=_[_0x613f('0x30')](db[_0x613f('0x4f')][_0x613f('0x2b')]);_0x42a72b[_0x613f('0x33')]=_[_0x613f('0x30')](_0x214d01[_0x613f('0x33')]);_0x42a72b[_0x613f('0x31')]=_['intersection'](_0x42a72b[_0x613f('0x2e')],_0x42a72b[_0x613f('0x33')]);_0x3c3cd7[_0x613f('0x34')]=_[_0x613f('0x32')](_0x42a72b['model'],qs[_0x613f('0x35')](_0x214d01[_0x613f('0x33')]['fields']));_0x3c3cd7['attributes']=_0x3c3cd7[_0x613f('0x34')]['length']?_0x3c3cd7['attributes']:_0x42a72b['model'];if(!_0x214d01[_0x613f('0x33')]['hasOwnProperty']('nolimit')){_0x3c3cd7['limit']=qs[_0x613f('0x1a')](_0x214d01[_0x613f('0x33')]['limit']);_0x3c3cd7[_0x613f('0x1d')]=qs[_0x613f('0x1d')](_0x214d01[_0x613f('0x33')][_0x613f('0x1d')]);}_0x3c3cd7['order']=qs[_0x613f('0x38')](_0x214d01[_0x613f('0x33')]['sort']);_0x3c3cd7[_0x613f('0x39')]=qs[_0x613f('0x31')](_[_0x613f('0x50')](_0x214d01[_0x613f('0x33')],_0x42a72b[_0x613f('0x31')]));if(_0x214d01[_0x613f('0x33')][_0x613f('0x3a')]){_0x3c3cd7[_0x613f('0x39')]=_[_0x613f('0x3b')](_0x3c3cd7[_0x613f('0x39')],{'$or':_[_0x613f('0x29')](_0x3c3cd7[_0x613f('0x34')],function(_0x50d7ca){var _0x1c4e48={};_0x1c4e48[_0x50d7ca]={'$like':'%'+_0x214d01[_0x613f('0x33')][_0x613f('0x3a')]+'%'};return _0x1c4e48;})});}_0x3c3cd7[_0x613f('0x39')]=_[_0x613f('0x3b')](_0x3c3cd7[_0x613f('0x39')],{'mailboxuser':_0x4b6eb3['mailbox']});_0x3c3cd7=_[_0x613f('0x3b')]({},_0x3c3cd7,_0x214d01[_0x613f('0x3c')]);return db[_0x613f('0x4f')][_0x613f('0x51')](_0x3c3cd7)[_0x613f('0x23')](respondWithFilteredResult(_0x49637d,_0x3c3cd7));})[_0x613f('0x40')](handleError(_0x49637d,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index c7d0b2b..48ea480 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 _0xb600=['../../config/logger','api','moment','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash'];(function(_0x11a032,_0x9b3f65){var _0x2504a1=function(_0x48a79d){while(--_0x48a79d){_0x11a032['push'](_0x11a032['shift']());}};_0x2504a1(++_0x9b3f65);}(_0xb600,0x13a));var _0x0b60=function(_0x32e6b9,_0x1ba001){_0x32e6b9=_0x32e6b9-0x0;var _0xd18132=_0xb600[_0x32e6b9];return _0xd18132;};'use strict';var _=require(_0x0b60('0x0'));var util=require('util');var logger=require(_0x0b60('0x1'))(_0x0b60('0x2'));var moment=require(_0x0b60('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b60('0x4'));var rimraf=require(_0x0b60('0x5'));var config=require(_0x0b60('0x6'));var attributes=require(_0x0b60('0x7'));module[_0x0b60('0x8')]=function(_0x2cdbb2,_0x27a844){return _0x2cdbb2[_0x0b60('0x9')](_0x0b60('0xa'),attributes,{'tableName':_0x0b60('0xb'),'paranoid':![],'indexes':[{'name':_0x0b60('0xc'),'fields':[_0x0b60('0xd'),_0x0b60('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x23c3=['context','util','moment','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox'];(function(_0x10c9a0,_0x5dd803){var _0xf80043=function(_0x45edf4){while(--_0x45edf4){_0x10c9a0['push'](_0x10c9a0['shift']());}};_0xf80043(++_0x5dd803);}(_0x23c3,0x1a1));var _0x323c=function(_0x22cc16,_0x1f4fa2){_0x22cc16=_0x22cc16-0x0;var _0x399b70=_0x23c3[_0x22cc16];return _0x399b70;};'use strict';var _=require('lodash');var util=require(_0x323c('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x323c('0x1'));var BPromise=require('bluebird');var rp=require(_0x323c('0x2'));var fs=require('fs');var path=require(_0x323c('0x3'));var rimraf=require(_0x323c('0x4'));var config=require(_0x323c('0x5'));var attributes=require(_0x323c('0x6'));module[_0x323c('0x7')]=function(_0x2d3e8f,_0x17f8ac){return _0x2d3e8f[_0x323c('0x8')](_0x323c('0x9'),attributes,{'tableName':_0x323c('0xa'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x323c('0xb'),_0x323c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 5ab38f7..fc66db6 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 _0xe2e1=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','randomstring','ioredis'];(function(_0x1d1e4f,_0x1fdcaf){var _0x575d15=function(_0x1336e9){while(--_0x1336e9){_0x1d1e4f['push'](_0x1d1e4f['shift']());}};_0x575d15(++_0x1fdcaf);}(_0xe2e1,0x100));var _0x1e2e=function(_0x55e67b,_0x57fbed){_0x55e67b=_0x55e67b-0x0;var _0x4b71c2=_0xe2e1[_0x55e67b];return _0x4b71c2;};'use strict';var _=require(_0x1e2e('0x0'));var util=require(_0x1e2e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1e2e('0x2'));var fs=require('fs');var Redis=require(_0x1e2e('0x3'));var db=require(_0x1e2e('0x4'))['db'];var utils=require(_0x1e2e('0x5'));var logger=require(_0x1e2e('0x6'))('rpc');var config=require(_0x1e2e('0x7'));var jayson=require(_0x1e2e('0x8'));var client=jayson['client'][_0x1e2e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2469f9,_0xd28ff9,_0x2d231f){return new BPromise(function(_0x546c04,_0x2fab95){return client[_0x1e2e('0xa')](_0x2469f9,_0x2d231f)['then'](function(_0x27b10c){logger[_0x1e2e('0xb')](_0x1e2e('0xc'),_0xd28ff9,_0x1e2e('0xd'));logger[_0x1e2e('0xe')](_0x1e2e('0xf'),_0xd28ff9,_0x1e2e('0xd'),JSON['stringify'](_0x27b10c));if(_0x27b10c[_0x1e2e('0x10')]){if(_0x27b10c[_0x1e2e('0x10')][_0x1e2e('0x11')]===0x1f4){logger[_0x1e2e('0x10')](_0x1e2e('0xc'),_0xd28ff9,_0x27b10c[_0x1e2e('0x10')][_0x1e2e('0x12')]);return _0x2fab95(_0x27b10c[_0x1e2e('0x10')][_0x1e2e('0x12')]);}logger['error'](_0x1e2e('0xc'),_0xd28ff9,_0x27b10c[_0x1e2e('0x10')][_0x1e2e('0x12')]);return _0x546c04(_0x27b10c[_0x1e2e('0x10')][_0x1e2e('0x12')]);}else{logger['info'](_0x1e2e('0xc'),_0xd28ff9,'request\x20sent');_0x546c04(_0x27b10c[_0x1e2e('0x13')][_0x1e2e('0x12')]);}})['catch'](function(_0x1074b3){logger[_0x1e2e('0x10')](_0x1e2e('0xc'),_0xd28ff9,_0x1074b3);_0x2fab95(_0x1074b3);});});} \ No newline at end of file +var _0xc80a=['error','message','VoiceMail,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xc80a,0x1d0));var _0xac80=function(_0x1ef167,_0x444fcd){_0x1ef167=_0x1ef167-0x0;var _0x594b71=_0xc80a[_0x1ef167];return _0x594b71;};'use strict';var _=require(_0xac80('0x0'));var util=require(_0xac80('0x1'));var moment=require(_0xac80('0x2'));var BPromise=require(_0xac80('0x3'));var rs=require(_0xac80('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac80('0x5'))['db'];var utils=require(_0xac80('0x6'));var logger=require('../../config/logger')(_0xac80('0x7'));var config=require(_0xac80('0x8'));var jayson=require(_0xac80('0x9'));var client=jayson[_0xac80('0xa')][_0xac80('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46f58b,_0x20c85e,_0x3d2f9c){return new BPromise(function(_0x4fa63f,_0x1a8502){return client[_0xac80('0xc')](_0x46f58b,_0x3d2f9c)[_0xac80('0xd')](function(_0xda1994){logger[_0xac80('0xe')]('VoiceMail,\x20%s,\x20%s',_0x20c85e,'request\x20sent');logger[_0xac80('0xf')](_0xac80('0x10'),_0x20c85e,_0xac80('0x11'),JSON[_0xac80('0x12')](_0xda1994));if(_0xda1994[_0xac80('0x13')]){if(_0xda1994[_0xac80('0x13')]['code']===0x1f4){logger[_0xac80('0x13')]('VoiceMail,\x20%s,\x20%s',_0x20c85e,_0xda1994[_0xac80('0x13')][_0xac80('0x14')]);return _0x1a8502(_0xda1994[_0xac80('0x13')]['message']);}logger[_0xac80('0x13')](_0xac80('0x15'),_0x20c85e,_0xda1994['error'][_0xac80('0x14')]);return _0x4fa63f(_0xda1994['error']['message']);}else{logger[_0xac80('0xe')](_0xac80('0x15'),_0x20c85e,_0xac80('0x11'));_0x4fa63f(_0xda1994['result'][_0xac80('0x14')]);}})[_0xac80('0x16')](function(_0x5debf5){logger['error'](_0xac80('0x15'),_0x20c85e,_0x5debf5);_0x1a8502(_0x5debf5);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 50881da..2bcebcc 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 _0x064f=['index','/:id','show','/:id/download','download','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated'];(function(_0x4076e0,_0x30fb96){var _0x31f286=function(_0x5c2d28){while(--_0x5c2d28){_0x4076e0['push'](_0x4076e0['shift']());}};_0x31f286(++_0x30fb96);}(_0x064f,0xdc));var _0xf064=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x064f[_0x342baa];return _0x1208f3;};'use strict';var multer=require('multer');var util=require(_0xf064('0x0'));var path=require(_0xf064('0x1'));var timeout=require(_0xf064('0x2'));var express=require(_0xf064('0x3'));var router=express[_0xf064('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf064('0x5'));var interaction=require(_0xf064('0x6'));var config=require(_0xf064('0x7'));var controller=require(_0xf064('0x8'));router[_0xf064('0x9')]('/',auth[_0xf064('0xa')](),controller[_0xf064('0xb')]);router[_0xf064('0x9')](_0xf064('0xc'),auth[_0xf064('0xa')](),controller[_0xf064('0xd')]);router[_0xf064('0x9')](_0xf064('0xe'),auth[_0xf064('0xa')](),controller[_0xf064('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xf064('0x10')](_0xf064('0xc'),auth[_0xf064('0xa')](),controller[_0xf064('0x11')]);router[_0xf064('0x12')](_0xf064('0xc'),auth[_0xf064('0xa')](),controller[_0xf064('0x13')]);module[_0xf064('0x14')]=router; \ No newline at end of file +var _0x9b39=['isAuthenticated','index','/:id','show','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./voiceMailMessage.controller','get'];(function(_0x28240c,_0x4301c9){var _0x2bbe34=function(_0xbbe64a){while(--_0xbbe64a){_0x28240c['push'](_0x28240c['shift']());}};_0x2bbe34(++_0x4301c9);}(_0x9b39,0x132));var _0x99b3=function(_0x18841f,_0x4e8d18){_0x18841f=_0x18841f-0x0;var _0x17187a=_0x9b39[_0x18841f];return _0x17187a;};'use strict';var multer=require(_0x99b3('0x0'));var util=require(_0x99b3('0x1'));var path=require(_0x99b3('0x2'));var timeout=require(_0x99b3('0x3'));var express=require('express');var router=express[_0x99b3('0x4')]();var fs_extra=require(_0x99b3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x99b3('0x6'));var config=require('../../config/environment');var controller=require(_0x99b3('0x7'));router[_0x99b3('0x8')]('/',auth[_0x99b3('0x9')](),controller[_0x99b3('0xa')]);router[_0x99b3('0x8')](_0x99b3('0xb'),auth[_0x99b3('0x9')](),controller[_0x99b3('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x99b3('0xd')]);router[_0x99b3('0xe')]('/',auth[_0x99b3('0x9')](),controller[_0x99b3('0xf')]);router[_0x99b3('0x10')](_0x99b3('0xb'),auth[_0x99b3('0x9')](),controller[_0x99b3('0x11')]);router[_0x99b3('0x12')](_0x99b3('0xb'),auth[_0x99b3('0x9')](),controller[_0x99b3('0x13')]);module[_0x99b3('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 3b5cf33..4f17e23 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 _0xa480=['INTEGER','STRING','BLOB','long','literal','sequelize','exports','VIRTUAL'];(function(_0x5c1329,_0x44d752){var _0x282631=function(_0x92755d){while(--_0x92755d){_0x5c1329['push'](_0x5c1329['shift']());}};_0x282631(++_0x44d752);}(_0xa480,0x6d));var _0x0a48=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xa480[_0xe66cf2];return _0x2d84e7;};'use strict';var Sequelize=require(_0x0a48('0x0'));module[_0x0a48('0x1')]={'name':{'type':Sequelize[_0x0a48('0x2')],'get':function(_0x27f3a7){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x0a48('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x0a48('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x0a48('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x0a48('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x0a48('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x0a48('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x0a48('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x0a48('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x0a48('0x5')](_0x0a48('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x0a48('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x0a48('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x0a48('0x7')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0xa9b9=['long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','INTEGER','STRING','BLOB'];(function(_0x3c414c,_0x399dbb){var _0x4f3062=function(_0x1b71cc){while(--_0x1b71cc){_0x3c414c['push'](_0x3c414c['shift']());}};_0x4f3062(++_0x399dbb);}(_0xa9b9,0x16c));var _0x9a9b=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0xa9b9[_0x99868f];return _0x27a71b;};'use strict';var Sequelize=require('sequelize');module[_0x9a9b('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x293e5a){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x9a9b('0x1')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x9a9b('0x2')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x9a9b('0x2')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x9a9b('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x9a9b('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x9a9b('0x2')],'defaultValue':''},'recording':{'type':Sequelize[_0x9a9b('0x3')](_0x9a9b('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x9a9b('0x2')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x9a9b('0x5'),'defaultValue':Sequelize[_0x9a9b('0x6')](_0x9a9b('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 0235465..55395c5 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 _0xa4e6=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','name','send','index','map','VoiceMailMessage','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','find','catch','create','body','params','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa4e6,0xdb));var _0x6a4e=function(_0x51376c,_0x1ed71d){_0x51376c=_0x51376c-0x0;var _0x50623b=_0xa4e6[_0x51376c];return _0x50623b;};'use strict';var emlformat=require(_0x6a4e('0x0'));var rimraf=require(_0x6a4e('0x1'));var zipdir=require(_0x6a4e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a4e('0x3'));var moment=require(_0x6a4e('0x4'));var BPromise=require(_0x6a4e('0x5'));var Mustache=require(_0x6a4e('0x6'));var util=require(_0x6a4e('0x7'));var path=require(_0x6a4e('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('lodash');var squel=require('squel');var crypto=require(_0x6a4e('0x9'));var jsforce=require(_0x6a4e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6a4e('0xb'));var querystring=require('querystring');var Papa=require(_0x6a4e('0xc'));var Redis=require(_0x6a4e('0xd'));var authService=require(_0x6a4e('0xe'));var qs=require(_0x6a4e('0xf'));var as=require(_0x6a4e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a4e('0x11'))(_0x6a4e('0x12'));var utils=require(_0x6a4e('0x13'));var config=require(_0x6a4e('0x14'));var licenseUtil=require(_0x6a4e('0x15'));var db=require(_0x6a4e('0x16'))['db'];function respondWithStatusCode(_0x3fe62e,_0x34bf48){_0x34bf48=_0x34bf48||0xcc;return function(_0x1ed3bd){if(_0x1ed3bd){return _0x3fe62e['sendStatus'](_0x34bf48);}return _0x3fe62e['status'](_0x34bf48)[_0x6a4e('0x17')]();};}function respondWithResult(_0x434979,_0x2a1e3c){_0x2a1e3c=_0x2a1e3c||0xc8;return function(_0x4214d3){if(_0x4214d3){return _0x434979[_0x6a4e('0x18')](_0x2a1e3c)['json'](_0x4214d3);}};}function respondWithFilteredResult(_0x5d37e3,_0xeedd2d){return function(_0x4779c8){if(_0x4779c8){var _0x2978fa=typeof _0xeedd2d[_0x6a4e('0x19')]==='undefined'&&typeof _0xeedd2d[_0x6a4e('0x1a')]===_0x6a4e('0x1b');var _0x204a90=_0x4779c8[_0x6a4e('0x1c')];var _0x472144=_0x2978fa?0x0:_0xeedd2d[_0x6a4e('0x19')];var _0x4b5da2=_0x2978fa?_0x4779c8[_0x6a4e('0x1c')]:_0xeedd2d['offset']+_0xeedd2d[_0x6a4e('0x1a')];var _0xc9f7de;if(_0x4b5da2>=_0x204a90){_0x4b5da2=_0x204a90;_0xc9f7de=0xc8;}else{_0xc9f7de=0xce;}_0x5d37e3[_0x6a4e('0x18')](_0xc9f7de);return _0x5d37e3[_0x6a4e('0x1d')](_0x6a4e('0x1e'),_0x472144+'-'+_0x4b5da2+'/'+_0x204a90)['json'](_0x4779c8);}return null;};}function patchUpdates(_0x2ecf43){return function(_0x560301){try{jsonpatch['apply'](_0x560301,_0x2ecf43,!![]);}catch(_0x174048){return BPromise[_0x6a4e('0x1f')](_0x174048);}return _0x560301[_0x6a4e('0x20')]();};}function saveUpdates(_0x2b2fee,_0x5511fd){return function(_0x2d726a){if(_0x2d726a){return _0x2d726a[_0x6a4e('0x21')](_0x2b2fee)['then'](function(_0x4013e9){return _0x4013e9;});}return null;};}function removeEntity(_0x18c11d,_0x8cddb){return function(_0x4838ac){if(_0x4838ac){return _0x4838ac[_0x6a4e('0x22')]()[_0x6a4e('0x23')](function(){_0x18c11d['status'](0xcc)[_0x6a4e('0x17')]();});}};}function handleEntityNotFound(_0x533fbb,_0x601d06){return function(_0x598302){if(!_0x598302){_0x533fbb['sendStatus'](0x194);}return _0x598302;};}function handleError(_0x556a34,_0x480e32){_0x480e32=_0x480e32||0x1f4;return function(_0x6c755b){logger['error'](_0x6c755b['stack']);if(_0x6c755b[_0x6a4e('0x24')]){delete _0x6c755b[_0x6a4e('0x24')];}_0x556a34[_0x6a4e('0x18')](_0x480e32)[_0x6a4e('0x25')](_0x6c755b);};}exports[_0x6a4e('0x26')]=function(_0xfa5e42,_0x49b60f){var _0x823895={},_0x138ce0={},_0x53d69e={'count':0x0,'rows':[]};var _0x4bd2dc=_[_0x6a4e('0x27')](db[_0x6a4e('0x28')][_0x6a4e('0x29')],function(_0x1db305){return{'name':_0x1db305['fieldName'],'type':_0x1db305[_0x6a4e('0x2a')][_0x6a4e('0x2b')]};});_0x138ce0['model']=_['differenceBy'](_[_0x6a4e('0x27')](_0x4bd2dc,'name'),['name']);_0x138ce0['query']=_[_0x6a4e('0x2c')](_0xfa5e42[_0x6a4e('0x2d')]);_0x138ce0[_0x6a4e('0x2e')]=_[_0x6a4e('0x2f')](_0x138ce0[_0x6a4e('0x30')],_0x138ce0[_0x6a4e('0x2d')]);_0x823895[_0x6a4e('0x31')]=_[_0x6a4e('0x2f')](_0x138ce0[_0x6a4e('0x30')],qs[_0x6a4e('0x32')](_0xfa5e42['query']['fields']));_0x823895[_0x6a4e('0x31')]=_0x823895['attributes'][_0x6a4e('0x33')]?_0x823895[_0x6a4e('0x31')]:_0x138ce0['model'];if(!_0xfa5e42[_0x6a4e('0x2d')]['hasOwnProperty'](_0x6a4e('0x34'))){_0x823895[_0x6a4e('0x1a')]=qs[_0x6a4e('0x1a')](_0xfa5e42['query'][_0x6a4e('0x1a')]);_0x823895[_0x6a4e('0x19')]=qs[_0x6a4e('0x19')](_0xfa5e42['query'][_0x6a4e('0x19')]);}_0x823895[_0x6a4e('0x35')]=qs[_0x6a4e('0x36')](_0xfa5e42[_0x6a4e('0x2d')][_0x6a4e('0x36')]);_0x823895[_0x6a4e('0x37')]=qs[_0x6a4e('0x2e')](_[_0x6a4e('0x38')](_0xfa5e42[_0x6a4e('0x2d')],_0x138ce0[_0x6a4e('0x2e')]),_0x4bd2dc);if(_0xfa5e42[_0x6a4e('0x2d')][_0x6a4e('0x39')]){_0x823895[_0x6a4e('0x37')]=_[_0x6a4e('0x3a')](_0x823895['where'],{'$or':_[_0x6a4e('0x27')](_0x4bd2dc,function(_0x37993e){if(_0x37993e['type']!=='VIRTUAL'){var _0x40e936={};_0x40e936[_0x37993e[_0x6a4e('0x24')]]={'$like':'%'+_0xfa5e42['query'][_0x6a4e('0x39')]+'%'};return _0x40e936;}})});}_0x823895=_[_0x6a4e('0x3a')]({},_0x823895,_0xfa5e42[_0x6a4e('0x3b')]);var _0x5067f9={'where':_0x823895['where']};return db[_0x6a4e('0x28')][_0x6a4e('0x1c')](_0x5067f9)[_0x6a4e('0x23')](function(_0x5f05d2){_0x53d69e['count']=_0x5f05d2;if(_0xfa5e42[_0x6a4e('0x2d')][_0x6a4e('0x3c')]){_0x823895[_0x6a4e('0x3d')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x6a4e('0x3e')](_0x823895);})[_0x6a4e('0x23')](function(_0x117478){_0x53d69e[_0x6a4e('0x3f')]=_0x117478;return _0x53d69e;})[_0x6a4e('0x23')](respondWithFilteredResult(_0x49b60f,_0x823895))['catch'](handleError(_0x49b60f,null));};exports['show']=function(_0x4e716e,_0xe36865){var _0x2be9d8={'raw':!![],'where':{'id':_0x4e716e['params']['id']}},_0x1ddc74={};_0x1ddc74[_0x6a4e('0x30')]=_[_0x6a4e('0x2c')](db[_0x6a4e('0x28')]['rawAttributes']);_0x1ddc74[_0x6a4e('0x2d')]=_[_0x6a4e('0x2c')](_0x4e716e['query']);_0x1ddc74[_0x6a4e('0x2e')]=_[_0x6a4e('0x2f')](_0x1ddc74[_0x6a4e('0x30')],_0x1ddc74[_0x6a4e('0x2d')]);_0x2be9d8[_0x6a4e('0x31')]=_[_0x6a4e('0x2f')](_0x1ddc74[_0x6a4e('0x30')],qs[_0x6a4e('0x32')](_0x4e716e[_0x6a4e('0x2d')]['fields']));_0x2be9d8['attributes']=_0x2be9d8['attributes'][_0x6a4e('0x33')]?_0x2be9d8[_0x6a4e('0x31')]:_0x1ddc74[_0x6a4e('0x30')];if(_0x4e716e[_0x6a4e('0x2d')]['includeAll']){_0x2be9d8[_0x6a4e('0x3d')]=[{'all':!![]}];}_0x2be9d8=_['merge']({},_0x2be9d8,_0x4e716e[_0x6a4e('0x3b')]);return db[_0x6a4e('0x28')][_0x6a4e('0x40')](_0x2be9d8)[_0x6a4e('0x23')](handleEntityNotFound(_0xe36865,null))[_0x6a4e('0x23')](respondWithResult(_0xe36865,null))[_0x6a4e('0x41')](handleError(_0xe36865,null));};exports[_0x6a4e('0x42')]=function(_0x7ad3b2,_0x327ee5){return db['VoiceMailMessage']['create'](_0x7ad3b2[_0x6a4e('0x43')],{})[_0x6a4e('0x23')](respondWithResult(_0x327ee5,0xc9))['catch'](handleError(_0x327ee5,null));};exports['update']=function(_0x49c35e,_0x1f121e){if(_0x49c35e['body']['id']){delete _0x49c35e[_0x6a4e('0x43')]['id'];}return db[_0x6a4e('0x28')][_0x6a4e('0x40')]({'where':{'id':_0x49c35e[_0x6a4e('0x44')]['id']}})[_0x6a4e('0x23')](handleEntityNotFound(_0x1f121e,null))[_0x6a4e('0x23')](saveUpdates(_0x49c35e[_0x6a4e('0x43')],null))[_0x6a4e('0x23')](respondWithResult(_0x1f121e,null))[_0x6a4e('0x41')](handleError(_0x1f121e,null));};exports['destroy']=function(_0x50926b,_0x24e9bf){return db['VoiceMailMessage']['find']({'where':{'id':_0x50926b[_0x6a4e('0x44')]['id']}})[_0x6a4e('0x23')](handleEntityNotFound(_0x24e9bf,null))[_0x6a4e('0x23')](removeEntity(_0x24e9bf,null))[_0x6a4e('0x41')](handleError(_0x24e9bf,null));};exports[_0x6a4e('0x45')]=function(_0x40eafb,_0x2be793,_0xa8b410){return db[_0x6a4e('0x28')][_0x6a4e('0x40')]({'where':{'id':_0x40eafb[_0x6a4e('0x44')]['id']},'attributes':['id',_0x6a4e('0x46'),_0x6a4e('0x47')]})[_0x6a4e('0x23')](handleEntityNotFound(_0x2be793,null))[_0x6a4e('0x23')](function(_0x1139c6){if(_0x1139c6){if(!_0x1139c6[_0x6a4e('0x46')]){throw new db[(_0x6a4e('0x48'))][(_0x6a4e('0x49'))](_0x6a4e('0x4a'));}var _0x52c351={'Content-Type':_0x6a4e('0x4b'),'Content-Disposition':_0x6a4e('0x4c')};if(_0x1139c6[_0x6a4e('0x47')]){_0x52c351[_0x6a4e('0x4d')]=_0x6a4e('0x4e')+_0x1139c6[_0x6a4e('0x47')]+'.wav\x22';}_0x2be793[_0x6a4e('0x1d')](_0x52c351);return _0x2be793[_0x6a4e('0x25')](new Buffer(_0x1139c6[_0x6a4e('0x46')]));}})[_0x6a4e('0x41')](handleError(_0x2be793,null));}; \ No newline at end of file +var _0x520f=['recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','attachment;\x20filename=\x22','.wav\x22','send','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','error','stack','name','index','map','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','query','intersection','fields','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','attributes','length','find','create','body','download'];(function(_0x35f892,_0x13c4cf){var _0x144e18=function(_0x5cf729){while(--_0x5cf729){_0x35f892['push'](_0x35f892['shift']());}};_0x144e18(++_0x13c4cf);}(_0x520f,0x1a3));var _0xf520=function(_0x515e9f,_0xff9586){_0x515e9f=_0x515e9f-0x0;var _0x19cbf0=_0x520f[_0x515e9f];return _0x19cbf0;};'use strict';var emlformat=require(_0xf520('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf520('0x1'));var jsonpatch=require(_0xf520('0x2'));var rp=require('request-promise');var moment=require(_0xf520('0x3'));var BPromise=require(_0xf520('0x4'));var Mustache=require(_0xf520('0x5'));var util=require(_0xf520('0x6'));var path=require('path');var sox=require(_0xf520('0x7'));var csv=require(_0xf520('0x8'));var ejs=require(_0xf520('0x9'));var fs=require('fs');var fs_extra=require(_0xf520('0xa'));var _=require('lodash');var squel=require(_0xf520('0xb'));var crypto=require(_0xf520('0xc'));var jsforce=require(_0xf520('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf520('0x8'));var querystring=require(_0xf520('0xe'));var Papa=require('papaparse');var Redis=require(_0xf520('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf520('0x10'));var as=require(_0xf520('0x11'));var hardwareService=require(_0xf520('0x12'));var logger=require(_0xf520('0x13'))(_0xf520('0x14'));var utils=require(_0xf520('0x15'));var config=require(_0xf520('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf520('0x17'))['db'];function respondWithStatusCode(_0x1ce989,_0x2c7df7){_0x2c7df7=_0x2c7df7||0xcc;return function(_0xcb408b){if(_0xcb408b){return _0x1ce989['sendStatus'](_0x2c7df7);}return _0x1ce989[_0xf520('0x18')](_0x2c7df7)[_0xf520('0x19')]();};}function respondWithResult(_0x357cf2,_0x21dbda){_0x21dbda=_0x21dbda||0xc8;return function(_0xe4845f){if(_0xe4845f){return _0x357cf2[_0xf520('0x18')](_0x21dbda)['json'](_0xe4845f);}};}function respondWithFilteredResult(_0x2cf84b,_0x1ee356){return function(_0x4d55b4){if(_0x4d55b4){var _0x54f780=typeof _0x1ee356[_0xf520('0x1a')]===_0xf520('0x1b')&&typeof _0x1ee356[_0xf520('0x1c')]==='undefined';var _0x3b386b=_0x4d55b4['count'];var _0x258ca2=_0x54f780?0x0:_0x1ee356['offset'];var _0x4d6860=_0x54f780?_0x4d55b4[_0xf520('0x1d')]:_0x1ee356[_0xf520('0x1a')]+_0x1ee356[_0xf520('0x1c')];var _0x282838;if(_0x4d6860>=_0x3b386b){_0x4d6860=_0x3b386b;_0x282838=0xc8;}else{_0x282838=0xce;}_0x2cf84b['status'](_0x282838);return _0x2cf84b[_0xf520('0x1e')]('Content-Range',_0x258ca2+'-'+_0x4d6860+'/'+_0x3b386b)[_0xf520('0x1f')](_0x4d55b4);}return null;};}function patchUpdates(_0x1d85dd){return function(_0x5962f1){try{jsonpatch['apply'](_0x5962f1,_0x1d85dd,!![]);}catch(_0x321d30){return BPromise[_0xf520('0x20')](_0x321d30);}return _0x5962f1[_0xf520('0x21')]();};}function saveUpdates(_0x51c9c4,_0x138a56){return function(_0x2efb50){if(_0x2efb50){return _0x2efb50[_0xf520('0x22')](_0x51c9c4)[_0xf520('0x23')](function(_0x37e2d0){return _0x37e2d0;});}return null;};}function removeEntity(_0x4da386,_0x8b3584){return function(_0x41862d){if(_0x41862d){return _0x41862d[_0xf520('0x24')]()[_0xf520('0x23')](function(){_0x4da386[_0xf520('0x18')](0xcc)[_0xf520('0x19')]();});}};}function handleEntityNotFound(_0x5d48de,_0x538835){return function(_0x10b674){if(!_0x10b674){_0x5d48de['sendStatus'](0x194);}return _0x10b674;};}function handleError(_0x58ab3,_0x133e6c){_0x133e6c=_0x133e6c||0x1f4;return function(_0x44ad51){logger[_0xf520('0x25')](_0x44ad51[_0xf520('0x26')]);if(_0x44ad51[_0xf520('0x27')]){delete _0x44ad51[_0xf520('0x27')];}_0x58ab3[_0xf520('0x18')](_0x133e6c)['send'](_0x44ad51);};}exports[_0xf520('0x28')]=function(_0x37aa04,_0x1b177a){var _0x88841e={},_0x3968f5={},_0x5ec6a1={'count':0x0,'rows':[]};var _0x1ad790=_[_0xf520('0x29')](db[_0xf520('0x2a')][_0xf520('0x2b')],function(_0x5acdf1){return{'name':_0x5acdf1['fieldName'],'type':_0x5acdf1[_0xf520('0x2c')][_0xf520('0x2d')]};});_0x3968f5[_0xf520('0x2e')]=_[_0xf520('0x2f')](_[_0xf520('0x29')](_0x1ad790,_0xf520('0x27')),[_0xf520('0x27')]);_0x3968f5[_0xf520('0x30')]=_['keys'](_0x37aa04['query']);_0x3968f5['filters']=_[_0xf520('0x31')](_0x3968f5[_0xf520('0x2e')],_0x3968f5['query']);_0x88841e['attributes']=_[_0xf520('0x31')](_0x3968f5['model'],qs['fields'](_0x37aa04[_0xf520('0x30')][_0xf520('0x32')]));_0x88841e['attributes']=_0x88841e['attributes']['length']?_0x88841e['attributes']:_0x3968f5[_0xf520('0x2e')];if(!_0x37aa04[_0xf520('0x30')]['hasOwnProperty'](_0xf520('0x33'))){_0x88841e[_0xf520('0x1c')]=qs[_0xf520('0x1c')](_0x37aa04[_0xf520('0x30')][_0xf520('0x1c')]);_0x88841e[_0xf520('0x1a')]=qs[_0xf520('0x1a')](_0x37aa04[_0xf520('0x30')][_0xf520('0x1a')]);}_0x88841e['order']=qs['sort'](_0x37aa04[_0xf520('0x30')][_0xf520('0x34')]);_0x88841e[_0xf520('0x35')]=qs[_0xf520('0x36')](_[_0xf520('0x37')](_0x37aa04['query'],_0x3968f5[_0xf520('0x36')]),_0x1ad790);if(_0x37aa04['query'][_0xf520('0x38')]){_0x88841e['where']=_[_0xf520('0x39')](_0x88841e['where'],{'$or':_[_0xf520('0x29')](_0x1ad790,function(_0x1b6752){if(_0x1b6752[_0xf520('0x2c')]!==_0xf520('0x3a')){var _0x382850={};_0x382850[_0x1b6752[_0xf520('0x27')]]={'$like':'%'+_0x37aa04[_0xf520('0x30')]['filter']+'%'};return _0x382850;}})});}_0x88841e=_[_0xf520('0x39')]({},_0x88841e,_0x37aa04[_0xf520('0x3b')]);var _0xb7568={'where':_0x88841e['where']};return db[_0xf520('0x2a')][_0xf520('0x1d')](_0xb7568)['then'](function(_0x2a0353){_0x5ec6a1[_0xf520('0x1d')]=_0x2a0353;if(_0x37aa04[_0xf520('0x30')][_0xf520('0x3c')]){_0x88841e[_0xf520('0x3d')]=[{'all':!![]}];}return db[_0xf520('0x2a')]['findAll'](_0x88841e);})[_0xf520('0x23')](function(_0x5d4569){_0x5ec6a1[_0xf520('0x3e')]=_0x5d4569;return _0x5ec6a1;})['then'](respondWithFilteredResult(_0x1b177a,_0x88841e))[_0xf520('0x3f')](handleError(_0x1b177a,null));};exports[_0xf520('0x40')]=function(_0x542a82,_0x241257){var _0x4e4216={'raw':!![],'where':{'id':_0x542a82[_0xf520('0x41')]['id']}},_0x258693={};_0x258693[_0xf520('0x2e')]=_[_0xf520('0x42')](db['VoiceMailMessage']['rawAttributes']);_0x258693['query']=_[_0xf520('0x42')](_0x542a82[_0xf520('0x30')]);_0x258693[_0xf520('0x36')]=_[_0xf520('0x31')](_0x258693[_0xf520('0x2e')],_0x258693[_0xf520('0x30')]);_0x4e4216[_0xf520('0x43')]=_['intersection'](_0x258693['model'],qs[_0xf520('0x32')](_0x542a82[_0xf520('0x30')][_0xf520('0x32')]));_0x4e4216[_0xf520('0x43')]=_0x4e4216[_0xf520('0x43')][_0xf520('0x44')]?_0x4e4216[_0xf520('0x43')]:_0x258693[_0xf520('0x2e')];if(_0x542a82['query']['includeAll']){_0x4e4216[_0xf520('0x3d')]=[{'all':!![]}];}_0x4e4216=_[_0xf520('0x39')]({},_0x4e4216,_0x542a82[_0xf520('0x3b')]);return db[_0xf520('0x2a')][_0xf520('0x45')](_0x4e4216)['then'](handleEntityNotFound(_0x241257,null))['then'](respondWithResult(_0x241257,null))['catch'](handleError(_0x241257,null));};exports['create']=function(_0x4abf94,_0x56c832){return db['VoiceMailMessage'][_0xf520('0x46')](_0x4abf94[_0xf520('0x47')],{})[_0xf520('0x23')](respondWithResult(_0x56c832,0xc9))[_0xf520('0x3f')](handleError(_0x56c832,null));};exports[_0xf520('0x22')]=function(_0xb2535a,_0x432f8c){if(_0xb2535a[_0xf520('0x47')]['id']){delete _0xb2535a[_0xf520('0x47')]['id'];}return db[_0xf520('0x2a')][_0xf520('0x45')]({'where':{'id':_0xb2535a['params']['id']}})['then'](handleEntityNotFound(_0x432f8c,null))[_0xf520('0x23')](saveUpdates(_0xb2535a[_0xf520('0x47')],null))[_0xf520('0x23')](respondWithResult(_0x432f8c,null))[_0xf520('0x3f')](handleError(_0x432f8c,null));};exports[_0xf520('0x24')]=function(_0x270ca6,_0x4e00bd){return db[_0xf520('0x2a')][_0xf520('0x45')]({'where':{'id':_0x270ca6['params']['id']}})[_0xf520('0x23')](handleEntityNotFound(_0x4e00bd,null))[_0xf520('0x23')](removeEntity(_0x4e00bd,null))['catch'](handleError(_0x4e00bd,null));};exports[_0xf520('0x48')]=function(_0xb8b237,_0x2066e2,_0x508899){return db[_0xf520('0x2a')][_0xf520('0x45')]({'where':{'id':_0xb8b237[_0xf520('0x41')]['id']},'attributes':['id',_0xf520('0x49'),_0xf520('0x4a')]})['then'](handleEntityNotFound(_0x2066e2,null))[_0xf520('0x23')](function(_0xfe3579){if(_0xfe3579){if(!_0xfe3579[_0xf520('0x49')]){throw new db[(_0xf520('0x4b'))]['ValidationError'](_0xf520('0x4c'));}var _0xd22eab={'Content-Type':_0xf520('0x4d'),'Content-Disposition':_0xf520('0x4e')};if(_0xfe3579['msg_id']){_0xd22eab['Content-Disposition']=_0xf520('0x4f')+_0xfe3579[_0xf520('0x4a')]+_0xf520('0x50');}_0x2066e2[_0xf520('0x1e')](_0xd22eab);return _0x2066e2[_0xf520('0x51')](new Buffer(_0xfe3579[_0xf520('0x49')]));}})[_0xf520('0x3f')](handleError(_0x2066e2,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 0077ba4..c488194 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 _0xec25=['./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','bluebird','../../config/environment'];(function(_0x5c7499,_0x22fbaf){var _0x113166=function(_0x61f7cd){while(--_0x61f7cd){_0x5c7499['push'](_0x5c7499['shift']());}};_0x113166(++_0x22fbaf);}(_0xec25,0xfe));var _0x5ec2=function(_0x41a3a8,_0x335d5d){_0x41a3a8=_0x41a3a8-0x0;var _0x2cf70a=_0xec25[_0x41a3a8];return _0x2cf70a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5ec2('0x0'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5ec2('0x1'));var attributes=require(_0x5ec2('0x2'));module[_0x5ec2('0x3')]=function(_0x37bf5c,_0x6d86b9){return _0x37bf5c[_0x5ec2('0x4')](_0x5ec2('0x5'),attributes,{'tableName':_0x5ec2('0x6'),'paranoid':![],'indexes':[{'name':_0x5ec2('0x7'),'fields':[_0x5ec2('0x7')]}],'timestamps':![]});}; \ No newline at end of file +var _0x18ad=['path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','dir','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x5636cc,_0x1d76bb){var _0x324fb5=function(_0x28d72a){while(--_0x28d72a){_0x5636cc['push'](_0x5636cc['shift']());}};_0x324fb5(++_0x1d76bb);}(_0x18ad,0x19d));var _0xd18a=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x18ad[_0x2b7764];return _0x848dcb;};'use strict';var _=require(_0xd18a('0x0'));var util=require('util');var logger=require(_0xd18a('0x1'))(_0xd18a('0x2'));var moment=require('moment');var BPromise=require(_0xd18a('0x3'));var rp=require(_0xd18a('0x4'));var fs=require('fs');var path=require(_0xd18a('0x5'));var rimraf=require(_0xd18a('0x6'));var config=require(_0xd18a('0x7'));var attributes=require(_0xd18a('0x8'));module[_0xd18a('0x9')]=function(_0x2b71fa,_0x5b3ab0){return _0x2b71fa['define']('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xd18a('0xa'),'fields':[_0xd18a('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index f5a1f4a..d24dbaa 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 _0x3304=['../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../config/logger','rpc'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x3304,0x64));var _0x4330=function(_0x2dd96e,_0x24b256){_0x2dd96e=_0x2dd96e-0x0;var _0x5133f4=_0x3304[_0x2dd96e];return _0x5133f4;};'use strict';var _=require(_0x4330('0x0'));var util=require('util');var moment=require(_0x4330('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4330('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4330('0x3'))(_0x4330('0x4'));var config=require(_0x4330('0x5'));var jayson=require(_0x4330('0x6'));var client=jayson[_0x4330('0x7')][_0x4330('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10e646,_0x4e06c5,_0x312512){return new BPromise(function(_0x4a6fa9,_0x10b39f){return client[_0x4330('0x9')](_0x10e646,_0x312512)[_0x4330('0xa')](function(_0x286408){logger[_0x4330('0xb')](_0x4330('0xc'),_0x4e06c5,_0x4330('0xd'));logger[_0x4330('0xe')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x4e06c5,_0x4330('0xd'),JSON[_0x4330('0xf')](_0x286408));if(_0x286408[_0x4330('0x10')]){if(_0x286408[_0x4330('0x10')][_0x4330('0x11')]===0x1f4){logger[_0x4330('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x4e06c5,_0x286408[_0x4330('0x10')][_0x4330('0x12')]);return _0x10b39f(_0x286408[_0x4330('0x10')][_0x4330('0x12')]);}logger[_0x4330('0x10')](_0x4330('0xc'),_0x4e06c5,_0x286408[_0x4330('0x10')][_0x4330('0x12')]);return _0x4a6fa9(_0x286408[_0x4330('0x10')][_0x4330('0x12')]);}else{logger[_0x4330('0xb')](_0x4330('0xc'),_0x4e06c5,'request\x20sent');_0x4a6fa9(_0x286408[_0x4330('0x13')][_0x4330('0x12')]);}})[_0x4330('0x14')](function(_0x2ffad1){logger[_0x4330('0x10')](_0x4330('0xc'),_0x4e06c5,_0x2ffad1);_0x10b39f(_0x2ffad1);});});} \ No newline at end of file +var _0x8b72=['result','util','moment','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x9e05d1,_0x3cef4a){var _0x4f7e97=function(_0x402f40){while(--_0x402f40){_0x9e05d1['push'](_0x9e05d1['shift']());}};_0x4f7e97(++_0x3cef4a);}(_0x8b72,0x1d1));var _0x28b7=function(_0x567342,_0x3bbe75){_0x567342=_0x567342-0x0;var _0x334036=_0x8b72[_0x567342];return _0x334036;};'use strict';var _=require('lodash');var util=require(_0x28b7('0x0'));var moment=require(_0x28b7('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x28b7('0x2'))['db'];var utils=require(_0x28b7('0x3'));var logger=require(_0x28b7('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x28b7('0x5'));var client=jayson[_0x28b7('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x84b2b1,_0x4f0e97,_0x54c0ed){return new BPromise(function(_0x35f6f6,_0x3a4b53){return client['request'](_0x84b2b1,_0x54c0ed)['then'](function(_0x371b68){logger[_0x28b7('0x7')](_0x28b7('0x8'),_0x4f0e97,_0x28b7('0x9'));logger[_0x28b7('0xa')](_0x28b7('0xb'),_0x4f0e97,_0x28b7('0x9'),JSON[_0x28b7('0xc')](_0x371b68));if(_0x371b68[_0x28b7('0xd')]){if(_0x371b68[_0x28b7('0xd')]['code']===0x1f4){logger[_0x28b7('0xd')](_0x28b7('0x8'),_0x4f0e97,_0x371b68[_0x28b7('0xd')][_0x28b7('0xe')]);return _0x3a4b53(_0x371b68[_0x28b7('0xd')][_0x28b7('0xe')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x4f0e97,_0x371b68['error'][_0x28b7('0xe')]);return _0x35f6f6(_0x371b68[_0x28b7('0xd')][_0x28b7('0xe')]);}else{logger[_0x28b7('0x7')](_0x28b7('0x8'),_0x4f0e97,_0x28b7('0x9'));_0x35f6f6(_0x371b68[_0x28b7('0xf')][_0x28b7('0xe')]);}})['catch'](function(_0x19a4a4){logger['error'](_0x28b7('0x8'),_0x4f0e97,_0x19a4a4);_0x3a4b53(_0x19a4a4);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 109a5e5..50c5a5f 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 _0x4af2=['show','/:id/sounds','getSounds','post','create','addSound','put','destroy','delete','/:id/sounds/:id2','multer','util','path','express','Router','../../components/auth/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x4af2,0x73));var _0x24af=function(_0x36a7b3,_0x2a1f15){_0x36a7b3=_0x36a7b3-0x0;var _0x376273=_0x4af2[_0x36a7b3];return _0x376273;};'use strict';var multer=require(_0x24af('0x0'));var util=require(_0x24af('0x1'));var path=require(_0x24af('0x2'));var timeout=require('connect-timeout');var express=require(_0x24af('0x3'));var router=express[_0x24af('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x24af('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x24af('0x6'));router[_0x24af('0x7')]('/',auth[_0x24af('0x8')](),controller[_0x24af('0x9')]);router[_0x24af('0x7')](_0x24af('0xa'),auth['isAuthenticated'](),controller[_0x24af('0xb')]);router[_0x24af('0x7')](_0x24af('0xc'),auth[_0x24af('0x8')](),controller[_0x24af('0xd')]);router[_0x24af('0xe')]('/',auth[_0x24af('0x8')](),controller[_0x24af('0xf')]);router[_0x24af('0xe')](_0x24af('0xc'),auth['isAuthenticated'](),controller[_0x24af('0x10')]);router[_0x24af('0x11')](_0x24af('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x24af('0xa'),auth['isAuthenticated'](),controller[_0x24af('0x12')]);router[_0x24af('0x13')](_0x24af('0x14'),auth[_0x24af('0x8')](),controller['removeSound']);module['exports']=router; \ No newline at end of file +var _0x24ae=['show','/:id/sounds','post','create','addSound','/:id','delete','destroy','removeSound','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x24ae,0x1ea));var _0xe24a=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x24ae[_0xaa1b3e];return _0x454d7d;};'use strict';var multer=require(_0xe24a('0x0'));var util=require(_0xe24a('0x1'));var path=require('path');var timeout=require(_0xe24a('0x2'));var express=require(_0xe24a('0x3'));var router=express[_0xe24a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe24a('0x5'));var interaction=require(_0xe24a('0x6'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth[_0xe24a('0x7')](),controller[_0xe24a('0x8')]);router[_0xe24a('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe24a('0xa')]);router[_0xe24a('0x9')](_0xe24a('0xb'),auth['isAuthenticated'](),controller['getSounds']);router[_0xe24a('0xc')]('/',auth[_0xe24a('0x7')](),controller[_0xe24a('0xd')]);router[_0xe24a('0xc')]('/:id/sounds',auth[_0xe24a('0x7')](),controller[_0xe24a('0xe')]);router['put'](_0xe24a('0xf'),auth[_0xe24a('0x7')](),controller['update']);router[_0xe24a('0x10')](_0xe24a('0xf'),auth[_0xe24a('0x7')](),controller[_0xe24a('0x11')]);router[_0xe24a('0x10')]('/:id/sounds/:id2',auth[_0xe24a('0x7')](),controller[_0xe24a('0x12')]);module[_0xe24a('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index a272752..5c2fedc 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 _0x9a54=['STRING','name','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','sequelize','exports'];(function(_0x168057,_0x18fae0){var _0x470c2f=function(_0x540df1){while(--_0x540df1){_0x168057['push'](_0x168057['shift']());}};_0x470c2f(++_0x18fae0);}(_0x9a54,0x8e));var _0x49a5=function(_0x567b93,_0x2999ae){_0x567b93=_0x567b93-0x0;var _0x424fa5=_0x9a54[_0x567b93];return _0x424fa5;};'use strict';var Sequelize=require(_0x49a5('0x0'));module[_0x49a5('0x1')]={'name':{'type':Sequelize[_0x49a5('0x2')],'allowNull':![],'unique':_0x49a5('0x3')},'mode':{'type':Sequelize['ENUM'](_0x49a5('0x4'),_0x49a5('0x5'),_0x49a5('0x6'),_0x49a5('0x7'),_0x49a5('0x8'),_0x49a5('0x9')),'allowNull':!![],'defaultValue':_0x49a5('0x5')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x49a5('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x49a5('0x2')],'allowNull':!![],'defaultValue':_0x49a5('0xa')},'format':{'type':Sequelize[_0x49a5('0x2')],'allowNull':!![]},'stamp':{'type':_0x49a5('0xb')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6ded=['custom','files','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM'];(function(_0x17218c,_0x3e8bf6){var _0x2fb49a=function(_0x1d293c){while(--_0x1d293c){_0x17218c['push'](_0x17218c['shift']());}};_0x2fb49a(++_0x3e8bf6);}(_0x6ded,0xff));var _0xd6de=function(_0x302cb2,_0x2f0c30){_0x302cb2=_0x302cb2-0x0;var _0x4f1403=_0x6ded[_0x302cb2];return _0x4f1403;};'use strict';var Sequelize=require(_0xd6de('0x0'));module[_0xd6de('0x1')]={'name':{'type':Sequelize[_0xd6de('0x2')],'allowNull':![],'unique':_0xd6de('0x3')},'mode':{'type':Sequelize[_0xd6de('0x4')](_0xd6de('0x5'),_0xd6de('0x6'),'mp3nb',_0xd6de('0x7'),_0xd6de('0x8'),_0xd6de('0x9')),'allowNull':!![],'defaultValue':_0xd6de('0x6')},'directory':{'type':Sequelize[_0xd6de('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xd6de('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xd6de('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xd6de('0x2')],'allowNull':!![],'defaultValue':_0xd6de('0xa')},'format':{'type':Sequelize[_0xd6de('0x2')],'allowNull':!![]},'stamp':{'type':_0xd6de('0xb')},'defaultEntry':{'type':Sequelize[_0xd6de('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 388ce75..33e5aab 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 _0xb07a=['unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','createdAt','root','server/files/sounds/converted','%s.%s','basename','save_name','extname','server/files/moh','converted_format','symlinkSync','removeSound','findOne','id2','Sound','format','message','getSounds','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','end','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','map','keys','intersection','query','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','body','find','create','sequelize','mode','files','directory','join','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','transaction'];(function(_0x17b112,_0x5438d6){var _0x1d40f1=function(_0x3b93a4){while(--_0x3b93a4){_0x17b112['push'](_0x17b112['shift']());}};_0x1d40f1(++_0x5438d6);}(_0xb07a,0x17e));var _0xab07=function(_0x21a7aa,_0x2248dc){_0x21a7aa=_0x21a7aa-0x0;var _0x20c622=_0xb07a[_0x21a7aa];return _0x20c622;};'use strict';var emlformat=require(_0xab07('0x0'));var rimraf=require(_0xab07('0x1'));var zipdir=require(_0xab07('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab07('0x3'));var moment=require(_0xab07('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xab07('0x5'));var util=require(_0xab07('0x6'));var path=require(_0xab07('0x7'));var sox=require('sox');var csv=require(_0xab07('0x8'));var ejs=require(_0xab07('0x9'));var fs=require('fs');var fs_extra=require(_0xab07('0xa'));var _=require(_0xab07('0xb'));var squel=require(_0xab07('0xc'));var crypto=require(_0xab07('0xd'));var jsforce=require(_0xab07('0xe'));var deskjs=require(_0xab07('0xf'));var toCsv=require(_0xab07('0x8'));var querystring=require(_0xab07('0x10'));var Papa=require('papaparse');var Redis=require(_0xab07('0x11'));var authService=require(_0xab07('0x12'));var qs=require(_0xab07('0x13'));var as=require(_0xab07('0x14'));var hardwareService=require(_0xab07('0x15'));var logger=require('../../config/logger')(_0xab07('0x16'));var utils=require(_0xab07('0x17'));var config=require(_0xab07('0x18'));var licenseUtil=require(_0xab07('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55cc1b,_0x500ee4){_0x500ee4=_0x500ee4||0xcc;return function(_0x57fed3){if(_0x57fed3){return _0x55cc1b[_0xab07('0x1a')](_0x500ee4);}return _0x55cc1b[_0xab07('0x1b')](_0x500ee4)['end']();};}function respondWithResult(_0x15b383,_0x241a3a){_0x241a3a=_0x241a3a||0xc8;return function(_0x1a1e4f){if(_0x1a1e4f){return _0x15b383[_0xab07('0x1b')](_0x241a3a)[_0xab07('0x1c')](_0x1a1e4f);}};}function respondWithFilteredResult(_0x14f3f2,_0x3c673d){return function(_0x56c6c9){if(_0x56c6c9){var _0x892c58=typeof _0x3c673d['offset']===_0xab07('0x1d')&&typeof _0x3c673d['limit']==='undefined';var _0xa9c4f9=_0x56c6c9[_0xab07('0x1e')];var _0x704107=_0x892c58?0x0:_0x3c673d[_0xab07('0x1f')];var _0x9f9346=_0x892c58?_0x56c6c9['count']:_0x3c673d[_0xab07('0x1f')]+_0x3c673d[_0xab07('0x20')];var _0x5e61c9;if(_0x9f9346>=_0xa9c4f9){_0x9f9346=_0xa9c4f9;_0x5e61c9=0xc8;}else{_0x5e61c9=0xce;}_0x14f3f2[_0xab07('0x1b')](_0x5e61c9);return _0x14f3f2[_0xab07('0x21')](_0xab07('0x22'),_0x704107+'-'+_0x9f9346+'/'+_0xa9c4f9)['json'](_0x56c6c9);}return null;};}function patchUpdates(_0x550f94){return function(_0x1e18c2){try{jsonpatch[_0xab07('0x23')](_0x1e18c2,_0x550f94,!![]);}catch(_0x3bfc66){return BPromise[_0xab07('0x24')](_0x3bfc66);}return _0x1e18c2[_0xab07('0x25')]();};}function saveUpdates(_0x63ed10,_0x2ee9e0){return function(_0x5bf882){if(_0x5bf882){return _0x5bf882[_0xab07('0x26')](_0x63ed10)[_0xab07('0x27')](function(_0xc35ec7){return _0xc35ec7;});}return null;};}function removeEntity(_0x57f2fd,_0x3dedf0){return function(_0x341daa){if(_0x341daa){return _0x341daa['destroy']()[_0xab07('0x27')](function(){var _0x539a62=_0x341daa[_0xab07('0x28')]({'plain':!![]});var _0x22b120='MusicOnHolds';return db[_0xab07('0x29')]['destroy']({'where':{'type':_0x22b120,'resourceId':_0x539a62['id']}})[_0xab07('0x27')](function(){return _0x341daa;});})[_0xab07('0x27')](function(){_0x57f2fd[_0xab07('0x1b')](0xcc)[_0xab07('0x2a')]();});}};}function handleEntityNotFound(_0x4df439,_0x1a8704){return function(_0x4e9d5f){if(!_0x4e9d5f){_0x4df439[_0xab07('0x1a')](0x194);}return _0x4e9d5f;};}function handleError(_0x252591,_0x150766){_0x150766=_0x150766||0x1f4;return function(_0x5c8fd1){logger[_0xab07('0x2b')](_0x5c8fd1[_0xab07('0x2c')]);if(_0x5c8fd1[_0xab07('0x2d')]){delete _0x5c8fd1['name'];}_0x252591[_0xab07('0x1b')](_0x150766)[_0xab07('0x2e')](_0x5c8fd1);};}exports[_0xab07('0x2f')]=function(_0xb1f18f,_0x593e7d){var _0x37788a={},_0x498ec6={},_0x194b4d={'count':0x0,'rows':[]};var _0x58396b=_['map'](db[_0xab07('0x30')][_0xab07('0x31')],function(_0x54b8cf){return{'name':_0x54b8cf[_0xab07('0x32')],'type':_0x54b8cf[_0xab07('0x33')][_0xab07('0x34')]};});_0x498ec6['model']=_[_0xab07('0x35')](_0x58396b,_0xab07('0x2d'));_0x498ec6['query']=_[_0xab07('0x36')](_0xb1f18f['query']);_0x498ec6['filters']=_[_0xab07('0x37')](_0x498ec6['model'],_0x498ec6[_0xab07('0x38')]);_0x37788a[_0xab07('0x39')]=_[_0xab07('0x37')](_0x498ec6[_0xab07('0x3a')],qs[_0xab07('0x3b')](_0xb1f18f[_0xab07('0x38')]['fields']));_0x37788a[_0xab07('0x39')]=_0x37788a[_0xab07('0x39')][_0xab07('0x3c')]?_0x37788a[_0xab07('0x39')]:_0x498ec6[_0xab07('0x3a')];if(!_0xb1f18f[_0xab07('0x38')][_0xab07('0x3d')](_0xab07('0x3e'))){_0x37788a[_0xab07('0x20')]=qs[_0xab07('0x20')](_0xb1f18f[_0xab07('0x38')][_0xab07('0x20')]);_0x37788a[_0xab07('0x1f')]=qs[_0xab07('0x1f')](_0xb1f18f[_0xab07('0x38')][_0xab07('0x1f')]);}_0x37788a[_0xab07('0x3f')]=qs[_0xab07('0x40')](_0xb1f18f[_0xab07('0x38')][_0xab07('0x40')]);delete _0xb1f18f[_0xab07('0x38')][_0xab07('0x40')];_0x37788a['where']=qs[_0xab07('0x41')](_[_0xab07('0x42')](_0xb1f18f['query'],_0x498ec6[_0xab07('0x41')]),_0x58396b);if(_0xb1f18f[_0xab07('0x38')][_0xab07('0x43')]){_0x37788a[_0xab07('0x44')]=_[_0xab07('0x45')](_0x37788a[_0xab07('0x44')],{'$or':_[_0xab07('0x35')](_0x58396b,function(_0x179ad3){if(_0x179ad3[_0xab07('0x33')]!==_0xab07('0x46')){var _0x4034cb={};_0x4034cb[_0x179ad3[_0xab07('0x2d')]]={'$like':'%'+_0xb1f18f[_0xab07('0x38')][_0xab07('0x43')]+'%'};return _0x4034cb;}})});}_0x37788a=_[_0xab07('0x45')]({},_0x37788a,_0xb1f18f[_0xab07('0x47')]);var _0xfb4406={'where':_0x37788a[_0xab07('0x44')]};return db[_0xab07('0x30')][_0xab07('0x1e')](_0xfb4406)[_0xab07('0x27')](function(_0x23e97c){_0x194b4d['count']=_0x23e97c;if(_0xb1f18f[_0xab07('0x38')]['includeAll']){_0x37788a[_0xab07('0x48')]=[{'all':!![]}];}return db[_0xab07('0x30')][_0xab07('0x49')](_0x37788a);})[_0xab07('0x27')](function(_0x3d0e27){_0x194b4d[_0xab07('0x4a')]=_0x3d0e27;return _0x194b4d;})['then'](respondWithFilteredResult(_0x593e7d,_0x37788a))[_0xab07('0x4b')](handleError(_0x593e7d,null));};exports[_0xab07('0x4c')]=function(_0x374196,_0x29690f){var _0x477ecb={'raw':![],'where':{'id':_0x374196[_0xab07('0x4d')]['id']}},_0xd3a57f={};_0xd3a57f['model']=_[_0xab07('0x36')](db[_0xab07('0x30')][_0xab07('0x31')]);_0xd3a57f[_0xab07('0x38')]=_[_0xab07('0x36')](_0x374196['query']);_0xd3a57f[_0xab07('0x41')]=_[_0xab07('0x37')](_0xd3a57f['model'],_0xd3a57f['query']);_0x477ecb[_0xab07('0x39')]=_[_0xab07('0x37')](_0xd3a57f[_0xab07('0x3a')],qs[_0xab07('0x3b')](_0x374196[_0xab07('0x38')][_0xab07('0x3b')]));_0x477ecb['attributes']=_0x477ecb['attributes']['length']?_0x477ecb['attributes']:_0xd3a57f[_0xab07('0x3a')];if(_0x374196[_0xab07('0x38')][_0xab07('0x4e')]){_0x477ecb['include']=[{'all':!![]}];}_0x477ecb=_[_0xab07('0x45')]({},_0x477ecb,_0x374196[_0xab07('0x47')]);return db[_0xab07('0x30')]['find'](_0x477ecb)['then'](handleEntityNotFound(_0x29690f,null))[_0xab07('0x27')](respondWithResult(_0x29690f,null))[_0xab07('0x4b')](handleError(_0x29690f,null));};exports['update']=function(_0x5ee332,_0x1ad758){if(_0x5ee332[_0xab07('0x4f')]['id']){delete _0x5ee332[_0xab07('0x4f')]['id'];}return db[_0xab07('0x30')][_0xab07('0x50')]({'where':{'id':_0x5ee332[_0xab07('0x4d')]['id']}})[_0xab07('0x27')](handleEntityNotFound(_0x1ad758,null))[_0xab07('0x27')](saveUpdates(_0x5ee332[_0xab07('0x4f')],null))['then'](respondWithResult(_0x1ad758,null))[_0xab07('0x4b')](handleError(_0x1ad758,null));};exports[_0xab07('0x51')]=function(_0x1201e5,_0x2d77e7,_0x404e45){return db[_0xab07('0x52')]['transaction'](function(_0x533ea0){if(_0x1201e5[_0xab07('0x4f')][_0xab07('0x53')]===_0xab07('0x54')){_0x1201e5['body'][_0xab07('0x55')]=path[_0xab07('0x56')](config['root'],'server/files/moh',_0x1201e5[_0xab07('0x4f')][_0xab07('0x2d')]);}return db[_0xab07('0x30')][_0xab07('0x51')](_0x1201e5[_0xab07('0x4f')],{'transaction':_0x533ea0})[_0xab07('0x27')](function(_0x4e73ec){if(_0x1201e5[_0xab07('0x4f')][_0xab07('0x53')]==='files'){fs[_0xab07('0x57')](_0x4e73ec['directory'],parseInt(_0xab07('0x58'),0x8));}var _0x31194a=_0x1201e5['user'][_0xab07('0x28')]({'plain':!![]});if(!_0x31194a)throw new Error(_0xab07('0x59'));if(_0x31194a[_0xab07('0x5a')]===_0xab07('0x5b')){var _0x106d65=_0x4e73ec[_0xab07('0x28')]({'plain':!![]});return db[_0xab07('0x5c')][_0xab07('0x50')]({'where':{'name':'MusicOnHolds','userProfileId':_0x31194a[_0xab07('0x5d')]},'raw':!![]})['then'](function(_0xc52752){if(_0xc52752&&_0xc52752[_0xab07('0x5e')]===0x0){return db['UserProfileResource'][_0xab07('0x51')]({'name':_0x106d65[_0xab07('0x2d')],'resourceId':_0x106d65['id'],'type':_0xc52752[_0xab07('0x2d')],'sectionId':_0xc52752['id']},{})['then'](function(){return _0x4e73ec;});}else{return _0x4e73ec;}})['catch'](function(_0x2a037f){logger[_0xab07('0x2b')](_0xab07('0x5f'),_0x2a037f);});}return _0x4e73ec;});})[_0xab07('0x27')](respondWithResult(_0x2d77e7,0xc9))['catch'](handleError(_0x2d77e7,null));};exports[_0xab07('0x60')]=function(_0x2d392d,_0x146793,_0x33128d){var _0x19194a;return db[_0xab07('0x30')][_0xab07('0x50')]({'where':{'id':_0x2d392d[_0xab07('0x4d')]['id']}})[_0xab07('0x27')](function(_0x15818d){if(_0x15818d){return db[_0xab07('0x52')][_0xab07('0x61')](function(_0x5e2173){return _0x15818d['destroy']({'transaction':_0x5e2173,'raw':!![]})[_0xab07('0x27')](function(_0x4c82cc){if(_0x4c82cc[_0xab07('0x55')]){fs['readdirSync'](_0x4c82cc[_0xab07('0x55')])['forEach'](function(_0xa9426c){fs[_0xab07('0x62')](path[_0xab07('0x56')](_0x4c82cc[_0xab07('0x55')],_0xa9426c));});fs[_0xab07('0x63')](_0x4c82cc[_0xab07('0x55')]);}return _0x4c82cc;});})['catch'](function(_0x3b50cd){throw new db[(_0xab07('0x64'))][(_0xab07('0x65'))](_0x3b50cd['message']);});}})['then'](handleEntityNotFound(_0x146793,null))[_0xab07('0x27')](removeEntity(_0x146793,null))['catch'](handleError(_0x146793,null));};exports[_0xab07('0x66')]=function(_0x4d4bbc,_0x442828,_0x5ab8e4){return db[_0xab07('0x52')]['transaction'](function(_0x19aafc){var _0x507892;return db[_0xab07('0x30')][_0xab07('0x50')]({'where':{'id':_0x4d4bbc[_0xab07('0x4d')]['id']}})[_0xab07('0x27')](function(_0xd244eb){if(_0xd244eb){_0x507892=_0xd244eb;return _0xd244eb[_0xab07('0x66')](_0x4d4bbc[_0xab07('0x4f')]['id'],{'transaction':_0x19aafc});}})[_0xab07('0x27')](function(_0x59e2e9){if(_0x59e2e9){return db['Sound']['findOne']({'where':{'id':_0x4d4bbc[_0xab07('0x4f')]['id']},'attributes':['id','name','save_name','converted_format',_0xab07('0x67')],'raw':!![]});}})[_0xab07('0x27')](function(_0x50ea22){if(_0x50ea22){var _0x5aeafe=path['join'](config[_0xab07('0x68')],_0xab07('0x69'),util['format'](_0xab07('0x6a'),path[_0xab07('0x6b')](_0x50ea22[_0xab07('0x6c')],path[_0xab07('0x6d')](_0x50ea22[_0xab07('0x6c')])),_0x50ea22['converted_format']));var _0xc81828=path[_0xab07('0x56')](config[_0xab07('0x68')],_0xab07('0x6e'),_0x507892[_0xab07('0x2d')],util['format']('%s.%s',_0x50ea22[_0xab07('0x2d')],_0x50ea22[_0xab07('0x6f')]));fs[_0xab07('0x70')](_0x5aeafe,_0xc81828);return _0x50ea22;}})[_0xab07('0x4b')](function(_0x146271){throw new db[(_0xab07('0x64'))][(_0xab07('0x65'))](_0x146271['message']);});})[_0xab07('0x27')](handleEntityNotFound(_0x442828,null))['then'](respondWithResult(_0x442828,0xc9))['catch'](handleError(_0x442828,null));};exports[_0xab07('0x71')]=function(_0x4c8f3a,_0x3d2487,_0x4c032e){return db[_0xab07('0x52')][_0xab07('0x61')](function(_0x430b5a){var _0x1724b5;return db[_0xab07('0x30')][_0xab07('0x72')]({'where':{'id':_0x4c8f3a[_0xab07('0x4d')]['id']}})[_0xab07('0x27')](handleEntityNotFound(_0x3d2487,null))['then'](function(_0x238fd8){if(_0x238fd8){_0x1724b5=_0x238fd8;return _0x238fd8[_0xab07('0x71')](_0x4c8f3a[_0xab07('0x4d')][_0xab07('0x73')]);}})[_0xab07('0x27')](function(_0xe5642d){if(_0xe5642d){return db[_0xab07('0x74')][_0xab07('0x72')]({'where':{'id':_0x4c8f3a[_0xab07('0x4d')][_0xab07('0x73')]},'attributes':['id',_0xab07('0x2d'),'save_name','converted_format',_0xab07('0x67')],'raw':!![]});}})['then'](function(_0x549ede){if(_0x549ede){fs[_0xab07('0x62')](path[_0xab07('0x56')](_0x1724b5['directory'],util[_0xab07('0x75')]('%s.%s',_0x549ede[_0xab07('0x2d')],_0x549ede[_0xab07('0x6f')])));return _0x549ede;}})[_0xab07('0x4b')](function(_0x175f9a){throw new db[(_0xab07('0x64'))][(_0xab07('0x65'))](_0x175f9a[_0xab07('0x76')]);});})[_0xab07('0x27')](handleEntityNotFound(_0x3d2487,null))[_0xab07('0x27')](respondWithStatusCode(_0x3d2487,0xcc))['catch'](handleError(_0x3d2487,null));};exports[_0xab07('0x77')]=function(_0x22bacf,_0x1e0b90,_0x3e4cec){var _0x579fb7={};var _0x498755={};var _0x424bee;var _0x5a7aba;return db[_0xab07('0x30')][_0xab07('0x72')]({'where':{'id':_0x22bacf['params']['id']}})[_0xab07('0x27')](handleEntityNotFound(_0x1e0b90,null))[_0xab07('0x27')](function(_0x5212e5){if(_0x5212e5){_0x424bee=_0x5212e5;_0x498755[_0xab07('0x3a')]=_['keys'](db['Sound'][_0xab07('0x31')]);_0x498755['query']=_[_0xab07('0x36')](_0x22bacf[_0xab07('0x38')]);_0x498755['filters']=_[_0xab07('0x37')](_0x498755[_0xab07('0x3a')],_0x498755[_0xab07('0x38')]);_0x579fb7[_0xab07('0x39')]=_['intersection'](_0x498755[_0xab07('0x3a')],qs['fields'](_0x22bacf[_0xab07('0x38')][_0xab07('0x3b')]));_0x579fb7[_0xab07('0x39')]=_0x579fb7[_0xab07('0x39')]['length']?_0x579fb7['attributes']:_0x498755[_0xab07('0x3a')];_0x579fb7[_0xab07('0x3f')]=qs[_0xab07('0x40')](_0x22bacf[_0xab07('0x38')][_0xab07('0x40')]);_0x579fb7[_0xab07('0x44')]=qs[_0xab07('0x41')](_[_0xab07('0x42')](_0x22bacf[_0xab07('0x38')],_0x498755[_0xab07('0x41')]));if(_0x22bacf[_0xab07('0x38')]['filter']){_0x579fb7['where']=_[_0xab07('0x45')](_0x579fb7[_0xab07('0x44')],{'$or':_[_0xab07('0x35')](_0x579fb7[_0xab07('0x39')],function(_0x5978fa){var _0x119860={};_0x119860[_0x5978fa]={'$like':'%'+_0x22bacf['query'][_0xab07('0x43')]+'%'};return _0x119860;})});}_0x579fb7=_[_0xab07('0x45')]({},_0x579fb7,_0x22bacf['options']);return _0x424bee[_0xab07('0x77')](_0x579fb7);}})['then'](function(_0x5a659a){if(_0x5a659a){_0x5a7aba=_0x5a659a[_0xab07('0x3c')];if(!_0x22bacf[_0xab07('0x38')][_0xab07('0x3d')](_0xab07('0x3e'))){_0x579fb7['limit']=qs[_0xab07('0x20')](_0x22bacf[_0xab07('0x38')][_0xab07('0x20')]);_0x579fb7[_0xab07('0x1f')]=qs[_0xab07('0x1f')](_0x22bacf['query'][_0xab07('0x1f')]);}return _0x424bee[_0xab07('0x77')](_0x579fb7);}})['then'](function(_0x6d732f){if(_0x6d732f){return _0x6d732f?{'count':_0x5a7aba,'rows':_0x6d732f}:null;}})['then'](respondWithResult(_0x1e0b90,null))['catch'](handleError(_0x1e0b90,null));}; \ No newline at end of file +var _0x37d8=['directory','join','server/files/moh','mkdirSync','0777','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','%s.%s','basename','extname','removeSound','id2','format','getSounds','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','status','set','Content-Range','apply','reject','save','then','destroy','MusicOnHolds','UserProfileResource','error','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','sequelize','transaction','mode','files'];(function(_0x182647,_0x5e98ed){var _0x1b9847=function(_0x24dff7){while(--_0x24dff7){_0x182647['push'](_0x182647['shift']());}};_0x1b9847(++_0x5e98ed);}(_0x37d8,0x95));var _0x837d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x37d8[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x837d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x837d('0x1'));var rp=require(_0x837d('0x2'));var moment=require('moment');var BPromise=require(_0x837d('0x3'));var Mustache=require(_0x837d('0x4'));var util=require(_0x837d('0x5'));var path=require(_0x837d('0x6'));var sox=require(_0x837d('0x7'));var csv=require('to-csv');var ejs=require(_0x837d('0x8'));var fs=require('fs');var fs_extra=require(_0x837d('0x9'));var _=require('lodash');var squel=require(_0x837d('0xa'));var crypto=require('crypto');var jsforce=require(_0x837d('0xb'));var deskjs=require(_0x837d('0xc'));var toCsv=require(_0x837d('0xd'));var querystring=require(_0x837d('0xe'));var Papa=require(_0x837d('0xf'));var Redis=require('ioredis');var authService=require(_0x837d('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x837d('0x11'))(_0x837d('0x12'));var utils=require(_0x837d('0x13'));var config=require(_0x837d('0x14'));var licenseUtil=require(_0x837d('0x15'));var db=require(_0x837d('0x16'))['db'];function respondWithStatusCode(_0xa88946,_0x50632a){_0x50632a=_0x50632a||0xcc;return function(_0x70a8f5){if(_0x70a8f5){return _0xa88946[_0x837d('0x17')](_0x50632a);}return _0xa88946['status'](_0x50632a)[_0x837d('0x18')]();};}function respondWithResult(_0x5147e6,_0x2ad005){_0x2ad005=_0x2ad005||0xc8;return function(_0x5eb506){if(_0x5eb506){return _0x5147e6['status'](_0x2ad005)[_0x837d('0x19')](_0x5eb506);}};}function respondWithFilteredResult(_0x1d75c6,_0x43fc5f){return function(_0x3fd3a5){if(_0x3fd3a5){var _0xc7863e=typeof _0x43fc5f[_0x837d('0x1a')]===_0x837d('0x1b')&&typeof _0x43fc5f[_0x837d('0x1c')]===_0x837d('0x1b');var _0x5a62f0=_0x3fd3a5['count'];var _0x236675=_0xc7863e?0x0:_0x43fc5f[_0x837d('0x1a')];var _0x515a20=_0xc7863e?_0x3fd3a5['count']:_0x43fc5f[_0x837d('0x1a')]+_0x43fc5f[_0x837d('0x1c')];var _0x3159aa;if(_0x515a20>=_0x5a62f0){_0x515a20=_0x5a62f0;_0x3159aa=0xc8;}else{_0x3159aa=0xce;}_0x1d75c6[_0x837d('0x1d')](_0x3159aa);return _0x1d75c6[_0x837d('0x1e')](_0x837d('0x1f'),_0x236675+'-'+_0x515a20+'/'+_0x5a62f0)[_0x837d('0x19')](_0x3fd3a5);}return null;};}function patchUpdates(_0x272c6c){return function(_0x3c6894){try{jsonpatch[_0x837d('0x20')](_0x3c6894,_0x272c6c,!![]);}catch(_0x3e84c5){return BPromise[_0x837d('0x21')](_0x3e84c5);}return _0x3c6894[_0x837d('0x22')]();};}function saveUpdates(_0x1451d9,_0x1d6029){return function(_0x58206f){if(_0x58206f){return _0x58206f['update'](_0x1451d9)[_0x837d('0x23')](function(_0x568380){return _0x568380;});}return null;};}function removeEntity(_0x331d9a,_0x963a31){return function(_0x7667af){if(_0x7667af){return _0x7667af[_0x837d('0x24')]()['then'](function(){var _0x399507=_0x7667af['get']({'plain':!![]});var _0x4af99c=_0x837d('0x25');return db[_0x837d('0x26')][_0x837d('0x24')]({'where':{'type':_0x4af99c,'resourceId':_0x399507['id']}})['then'](function(){return _0x7667af;});})['then'](function(){_0x331d9a[_0x837d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38a653,_0x591496){return function(_0x44ef06){if(!_0x44ef06){_0x38a653['sendStatus'](0x194);}return _0x44ef06;};}function handleError(_0x22c237,_0x3f40d2){_0x3f40d2=_0x3f40d2||0x1f4;return function(_0x5d316b){logger[_0x837d('0x27')](_0x5d316b[_0x837d('0x28')]);if(_0x5d316b[_0x837d('0x29')]){delete _0x5d316b[_0x837d('0x29')];}_0x22c237['status'](_0x3f40d2)[_0x837d('0x2a')](_0x5d316b);};}exports['index']=function(_0x37b990,_0x2a2ce4){var _0x63d378={},_0x23c5f7={},_0x274aa6={'count':0x0,'rows':[]};var _0x42cd01=_[_0x837d('0x2b')](db[_0x837d('0x2c')][_0x837d('0x2d')],function(_0x56d16e){return{'name':_0x56d16e[_0x837d('0x2e')],'type':_0x56d16e[_0x837d('0x2f')][_0x837d('0x30')]};});_0x23c5f7[_0x837d('0x31')]=_[_0x837d('0x2b')](_0x42cd01,_0x837d('0x29'));_0x23c5f7[_0x837d('0x32')]=_[_0x837d('0x33')](_0x37b990['query']);_0x23c5f7['filters']=_[_0x837d('0x34')](_0x23c5f7['model'],_0x23c5f7[_0x837d('0x32')]);_0x63d378[_0x837d('0x35')]=_['intersection'](_0x23c5f7[_0x837d('0x31')],qs[_0x837d('0x36')](_0x37b990[_0x837d('0x32')]['fields']));_0x63d378['attributes']=_0x63d378['attributes'][_0x837d('0x37')]?_0x63d378[_0x837d('0x35')]:_0x23c5f7[_0x837d('0x31')];if(!_0x37b990[_0x837d('0x32')][_0x837d('0x38')](_0x837d('0x39'))){_0x63d378[_0x837d('0x1c')]=qs['limit'](_0x37b990[_0x837d('0x32')][_0x837d('0x1c')]);_0x63d378[_0x837d('0x1a')]=qs['offset'](_0x37b990['query'][_0x837d('0x1a')]);}_0x63d378[_0x837d('0x3a')]=qs[_0x837d('0x3b')](_0x37b990[_0x837d('0x32')][_0x837d('0x3b')]);delete _0x37b990['query'][_0x837d('0x3b')];_0x63d378[_0x837d('0x3c')]=qs['filters'](_[_0x837d('0x3d')](_0x37b990[_0x837d('0x32')],_0x23c5f7[_0x837d('0x3e')]),_0x42cd01);if(_0x37b990[_0x837d('0x32')]['filter']){_0x63d378[_0x837d('0x3c')]=_['merge'](_0x63d378[_0x837d('0x3c')],{'$or':_['map'](_0x42cd01,function(_0x42d737){if(_0x42d737['type']!==_0x837d('0x3f')){var _0x2151d0={};_0x2151d0[_0x42d737['name']]={'$like':'%'+_0x37b990[_0x837d('0x32')][_0x837d('0x40')]+'%'};return _0x2151d0;}})});}_0x63d378=_[_0x837d('0x41')]({},_0x63d378,_0x37b990[_0x837d('0x42')]);var _0x5ae9d4={'where':_0x63d378[_0x837d('0x3c')]};return db[_0x837d('0x2c')][_0x837d('0x43')](_0x5ae9d4)[_0x837d('0x23')](function(_0x5a961f){_0x274aa6[_0x837d('0x43')]=_0x5a961f;if(_0x37b990[_0x837d('0x32')][_0x837d('0x44')]){_0x63d378[_0x837d('0x45')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x837d('0x46')](_0x63d378);})[_0x837d('0x23')](function(_0x11b202){_0x274aa6[_0x837d('0x47')]=_0x11b202;return _0x274aa6;})[_0x837d('0x23')](respondWithFilteredResult(_0x2a2ce4,_0x63d378))[_0x837d('0x48')](handleError(_0x2a2ce4,null));};exports[_0x837d('0x49')]=function(_0x2710fb,_0x332883){var _0x2dc63a={'raw':![],'where':{'id':_0x2710fb[_0x837d('0x4a')]['id']}},_0x3e9f87={};_0x3e9f87[_0x837d('0x31')]=_[_0x837d('0x33')](db[_0x837d('0x2c')]['rawAttributes']);_0x3e9f87[_0x837d('0x32')]=_['keys'](_0x2710fb[_0x837d('0x32')]);_0x3e9f87[_0x837d('0x3e')]=_['intersection'](_0x3e9f87[_0x837d('0x31')],_0x3e9f87['query']);_0x2dc63a[_0x837d('0x35')]=_[_0x837d('0x34')](_0x3e9f87[_0x837d('0x31')],qs[_0x837d('0x36')](_0x2710fb[_0x837d('0x32')]['fields']));_0x2dc63a[_0x837d('0x35')]=_0x2dc63a['attributes'][_0x837d('0x37')]?_0x2dc63a['attributes']:_0x3e9f87[_0x837d('0x31')];if(_0x2710fb['query']['includeAll']){_0x2dc63a[_0x837d('0x45')]=[{'all':!![]}];}_0x2dc63a=_[_0x837d('0x41')]({},_0x2dc63a,_0x2710fb[_0x837d('0x42')]);return db['VoiceMusicOnHold'][_0x837d('0x4b')](_0x2dc63a)[_0x837d('0x23')](handleEntityNotFound(_0x332883,null))[_0x837d('0x23')](respondWithResult(_0x332883,null))[_0x837d('0x48')](handleError(_0x332883,null));};exports[_0x837d('0x4c')]=function(_0x82d840,_0x1f465c){if(_0x82d840[_0x837d('0x4d')]['id']){delete _0x82d840['body']['id'];}return db[_0x837d('0x2c')][_0x837d('0x4b')]({'where':{'id':_0x82d840[_0x837d('0x4a')]['id']}})[_0x837d('0x23')](handleEntityNotFound(_0x1f465c,null))[_0x837d('0x23')](saveUpdates(_0x82d840['body'],null))[_0x837d('0x23')](respondWithResult(_0x1f465c,null))[_0x837d('0x48')](handleError(_0x1f465c,null));};exports[_0x837d('0x4e')]=function(_0x25ebf1,_0x47b74d,_0x82caff){return db[_0x837d('0x4f')][_0x837d('0x50')](function(_0x58cdcf){if(_0x25ebf1[_0x837d('0x4d')][_0x837d('0x51')]===_0x837d('0x52')){_0x25ebf1[_0x837d('0x4d')][_0x837d('0x53')]=path[_0x837d('0x54')](config['root'],_0x837d('0x55'),_0x25ebf1[_0x837d('0x4d')][_0x837d('0x29')]);}return db['VoiceMusicOnHold'][_0x837d('0x4e')](_0x25ebf1[_0x837d('0x4d')],{'transaction':_0x58cdcf})[_0x837d('0x23')](function(_0x287642){if(_0x25ebf1['body']['mode']===_0x837d('0x52')){fs[_0x837d('0x56')](_0x287642['directory'],parseInt(_0x837d('0x57'),0x8));}var _0x460f47=_0x25ebf1['user'][_0x837d('0x58')]({'plain':!![]});if(!_0x460f47)throw new Error(_0x837d('0x59'));if(_0x460f47[_0x837d('0x5a')]===_0x837d('0x5b')){var _0x3f7179=_0x287642[_0x837d('0x58')]({'plain':!![]});return db[_0x837d('0x5c')][_0x837d('0x4b')]({'where':{'name':'MusicOnHolds','userProfileId':_0x460f47['userProfileId']},'raw':!![]})[_0x837d('0x23')](function(_0x113a34){if(_0x113a34&&_0x113a34[_0x837d('0x5d')]===0x0){return db[_0x837d('0x26')][_0x837d('0x4e')]({'name':_0x3f7179[_0x837d('0x29')],'resourceId':_0x3f7179['id'],'type':_0x113a34[_0x837d('0x29')],'sectionId':_0x113a34['id']},{})[_0x837d('0x23')](function(){return _0x287642;});}else{return _0x287642;}})[_0x837d('0x48')](function(_0x4232c9){logger[_0x837d('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4232c9);});}return _0x287642;});})[_0x837d('0x23')](respondWithResult(_0x47b74d,0xc9))[_0x837d('0x48')](handleError(_0x47b74d,null));};exports['destroy']=function(_0x51b5e1,_0x2fbcb0,_0x2c8a6c){var _0x18dc7f;return db[_0x837d('0x2c')][_0x837d('0x4b')]({'where':{'id':_0x51b5e1[_0x837d('0x4a')]['id']}})['then'](function(_0x517493){if(_0x517493){return db['sequelize'][_0x837d('0x50')](function(_0x38cb92){return _0x517493['destroy']({'transaction':_0x38cb92,'raw':!![]})[_0x837d('0x23')](function(_0x31cd2f){if(_0x31cd2f[_0x837d('0x53')]){fs[_0x837d('0x5e')](_0x31cd2f[_0x837d('0x53')])[_0x837d('0x5f')](function(_0x62e8bd){fs[_0x837d('0x60')](path[_0x837d('0x54')](_0x31cd2f[_0x837d('0x53')],_0x62e8bd));});fs[_0x837d('0x61')](_0x31cd2f[_0x837d('0x53')]);}return _0x31cd2f;});})['catch'](function(_0x156cb5){throw new db[(_0x837d('0x62'))][(_0x837d('0x63'))](_0x156cb5[_0x837d('0x64')]);});}})[_0x837d('0x23')](handleEntityNotFound(_0x2fbcb0,null))[_0x837d('0x23')](removeEntity(_0x2fbcb0,null))[_0x837d('0x48')](handleError(_0x2fbcb0,null));};exports[_0x837d('0x65')]=function(_0x5b0093,_0x90d0fa,_0x2021f5){return db[_0x837d('0x4f')]['transaction'](function(_0x1e1722){var _0x2455f5;return db[_0x837d('0x2c')][_0x837d('0x4b')]({'where':{'id':_0x5b0093[_0x837d('0x4a')]['id']}})[_0x837d('0x23')](function(_0x5989d5){if(_0x5989d5){_0x2455f5=_0x5989d5;return _0x5989d5[_0x837d('0x65')](_0x5b0093[_0x837d('0x4d')]['id'],{'transaction':_0x1e1722});}})[_0x837d('0x23')](function(_0x18cd83){if(_0x18cd83){return db[_0x837d('0x66')][_0x837d('0x67')]({'where':{'id':_0x5b0093['body']['id']},'attributes':['id',_0x837d('0x29'),_0x837d('0x68'),_0x837d('0x69'),_0x837d('0x6a')],'raw':!![]});}})[_0x837d('0x23')](function(_0x98f108){if(_0x98f108){var _0x1807a7=path[_0x837d('0x54')](config[_0x837d('0x6b')],_0x837d('0x6c'),util['format'](_0x837d('0x6d'),path[_0x837d('0x6e')](_0x98f108['save_name'],path[_0x837d('0x6f')](_0x98f108['save_name'])),_0x98f108[_0x837d('0x69')]));var _0x5664a8=path['join'](config['root'],_0x837d('0x55'),_0x2455f5[_0x837d('0x29')],util['format'](_0x837d('0x6d'),_0x98f108[_0x837d('0x29')],_0x98f108['converted_format']));fs['symlinkSync'](_0x1807a7,_0x5664a8);return _0x98f108;}})['catch'](function(_0x1238f2){throw new db['Sequelize'][(_0x837d('0x63'))](_0x1238f2[_0x837d('0x64')]);});})['then'](handleEntityNotFound(_0x90d0fa,null))[_0x837d('0x23')](respondWithResult(_0x90d0fa,0xc9))['catch'](handleError(_0x90d0fa,null));};exports['removeSound']=function(_0x588b35,_0x21b2e6,_0x4d4165){return db[_0x837d('0x4f')][_0x837d('0x50')](function(_0x5233c8){var _0x2fece1;return db['VoiceMusicOnHold'][_0x837d('0x67')]({'where':{'id':_0x588b35[_0x837d('0x4a')]['id']}})[_0x837d('0x23')](handleEntityNotFound(_0x21b2e6,null))['then'](function(_0x5a42f5){if(_0x5a42f5){_0x2fece1=_0x5a42f5;return _0x5a42f5[_0x837d('0x70')](_0x588b35[_0x837d('0x4a')][_0x837d('0x71')]);}})[_0x837d('0x23')](function(_0x451b84){if(_0x451b84){return db[_0x837d('0x66')][_0x837d('0x67')]({'where':{'id':_0x588b35[_0x837d('0x4a')][_0x837d('0x71')]},'attributes':['id',_0x837d('0x29'),_0x837d('0x68'),_0x837d('0x69'),'createdAt'],'raw':!![]});}})[_0x837d('0x23')](function(_0x5c180b){if(_0x5c180b){fs[_0x837d('0x60')](path['join'](_0x2fece1[_0x837d('0x53')],util[_0x837d('0x72')]('%s.%s',_0x5c180b[_0x837d('0x29')],_0x5c180b[_0x837d('0x69')])));return _0x5c180b;}})['catch'](function(_0x4d2f7a){throw new db['Sequelize'][(_0x837d('0x63'))](_0x4d2f7a[_0x837d('0x64')]);});})[_0x837d('0x23')](handleEntityNotFound(_0x21b2e6,null))[_0x837d('0x23')](respondWithStatusCode(_0x21b2e6,0xcc))[_0x837d('0x48')](handleError(_0x21b2e6,null));};exports[_0x837d('0x73')]=function(_0x463962,_0x57dfc4,_0x4b74a9){var _0x4442fc={};var _0xa8a0b2={};var _0x3e00cd;var _0x2cfbb5;return db[_0x837d('0x2c')][_0x837d('0x67')]({'where':{'id':_0x463962[_0x837d('0x4a')]['id']}})[_0x837d('0x23')](handleEntityNotFound(_0x57dfc4,null))['then'](function(_0x561cbc){if(_0x561cbc){_0x3e00cd=_0x561cbc;_0xa8a0b2[_0x837d('0x31')]=_[_0x837d('0x33')](db[_0x837d('0x66')][_0x837d('0x2d')]);_0xa8a0b2['query']=_[_0x837d('0x33')](_0x463962[_0x837d('0x32')]);_0xa8a0b2[_0x837d('0x3e')]=_['intersection'](_0xa8a0b2['model'],_0xa8a0b2[_0x837d('0x32')]);_0x4442fc[_0x837d('0x35')]=_['intersection'](_0xa8a0b2['model'],qs[_0x837d('0x36')](_0x463962['query']['fields']));_0x4442fc[_0x837d('0x35')]=_0x4442fc['attributes'][_0x837d('0x37')]?_0x4442fc[_0x837d('0x35')]:_0xa8a0b2['model'];_0x4442fc[_0x837d('0x3a')]=qs[_0x837d('0x3b')](_0x463962['query'][_0x837d('0x3b')]);_0x4442fc['where']=qs[_0x837d('0x3e')](_[_0x837d('0x3d')](_0x463962['query'],_0xa8a0b2[_0x837d('0x3e')]));if(_0x463962[_0x837d('0x32')][_0x837d('0x40')]){_0x4442fc['where']=_['merge'](_0x4442fc[_0x837d('0x3c')],{'$or':_[_0x837d('0x2b')](_0x4442fc[_0x837d('0x35')],function(_0x492bd4){var _0x1ce72b={};_0x1ce72b[_0x492bd4]={'$like':'%'+_0x463962[_0x837d('0x32')][_0x837d('0x40')]+'%'};return _0x1ce72b;})});}_0x4442fc=_['merge']({},_0x4442fc,_0x463962[_0x837d('0x42')]);return _0x3e00cd['getSounds'](_0x4442fc);}})[_0x837d('0x23')](function(_0x23240a){if(_0x23240a){_0x2cfbb5=_0x23240a['length'];if(!_0x463962[_0x837d('0x32')][_0x837d('0x38')]('nolimit')){_0x4442fc['limit']=qs['limit'](_0x463962[_0x837d('0x32')][_0x837d('0x1c')]);_0x4442fc['offset']=qs[_0x837d('0x1a')](_0x463962[_0x837d('0x32')][_0x837d('0x1a')]);}return _0x3e00cd[_0x837d('0x73')](_0x4442fc);}})['then'](function(_0xd3dc2c){if(_0xd3dc2c){return _0xd3dc2c?{'count':_0x2cfbb5,'rows':_0xd3dc2c}:null;}})[_0x837d('0x23')](respondWithResult(_0x57dfc4,null))[_0x837d('0x48')](handleError(_0x57dfc4,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 1ccc0c9..0dacd70 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 _0x2622=['define','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','exports'];(function(_0x1576e2,_0x63ad27){var _0x1c98ca=function(_0x5b53b4){while(--_0x5b53b4){_0x1576e2['push'](_0x1576e2['shift']());}};_0x1c98ca(++_0x63ad27);}(_0x2622,0x17b));var _0x2262=function(_0xe71405,_0x5151ab){_0xe71405=_0xe71405-0x0;var _0x4a9d1c=_0x2622[_0xe71405];return _0x4a9d1c;};'use strict';var _=require(_0x2262('0x0'));var util=require(_0x2262('0x1'));var logger=require(_0x2262('0x2'))(_0x2262('0x3'));var moment=require(_0x2262('0x4'));var BPromise=require(_0x2262('0x5'));var rp=require(_0x2262('0x6'));var fs=require('fs');var path=require(_0x2262('0x7'));var rimraf=require('rimraf');var config=require(_0x2262('0x8'));var attributes=require(_0x2262('0x9'));module[_0x2262('0xa')]=function(_0x31abf3,_0x326dd6){return _0x31abf3[_0x2262('0xb')]('VoiceMusicOnHold',attributes,{'tableName':_0x2262('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66a6=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','voice_musiconhold'];(function(_0x459e81,_0x52aeb0){var _0x4fac6a=function(_0x2880ae){while(--_0x2880ae){_0x459e81['push'](_0x459e81['shift']());}};_0x4fac6a(++_0x52aeb0);}(_0x66a6,0x1c3));var _0x666a=function(_0x42c97b,_0x3e401a){_0x42c97b=_0x42c97b-0x0;var _0x5ee945=_0x66a6[_0x42c97b];return _0x5ee945;};'use strict';var _=require(_0x666a('0x0'));var util=require(_0x666a('0x1'));var logger=require(_0x666a('0x2'))('api');var moment=require(_0x666a('0x3'));var BPromise=require(_0x666a('0x4'));var rp=require(_0x666a('0x5'));var fs=require('fs');var path=require(_0x666a('0x6'));var rimraf=require(_0x666a('0x7'));var config=require('../../config/environment');var attributes=require('./voiceMusicOnHold.attributes');module[_0x666a('0x8')]=function(_0x4d1f8a,_0x376ae6){return _0x4d1f8a[_0x666a('0x9')]('VoiceMusicOnHold',attributes,{'tableName':_0x666a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 08112fc..cdc54e2 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4979b4,_0x17cb17){var _0x4f7fb7=function(_0x1bf337){while(--_0x1bf337){_0x4979b4['push'](_0x4979b4['shift']());}};_0x4f7fb7(++_0x17cb17);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x9720b9,_0x578c4f){var _0xf1778b=function(_0x56c89a){while(--_0x56c89a){_0x9720b9['push'](_0x9720b9['shift']());}};_0xf1778b(++_0x578c4f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4bcf38,_0x3c12be){_0x4bcf38=_0x4bcf38-0x0;var _0x4a89be=_0xcb91[_0x4bcf38];return _0x4a89be;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index f963079..228633d 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 _0xb701=['/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','destroy','delete','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x3074f3,_0x4f2c03){var _0x53f112=function(_0x4a17af){while(--_0x4a17af){_0x3074f3['push'](_0x3074f3['shift']());}};_0x53f112(++_0x4f2c03);}(_0xb701,0x144));var _0x1b70=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xb701[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require('multer');var util=require(_0x1b70('0x0'));var path=require('path');var timeout=require(_0x1b70('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1b70('0x2'));var auth=require(_0x1b70('0x3'));var interaction=require(_0x1b70('0x4'));var config=require(_0x1b70('0x5'));var controller=require(_0x1b70('0x6'));router[_0x1b70('0x7')]('/',auth[_0x1b70('0x8')](),controller[_0x1b70('0x9')]);router[_0x1b70('0x7')](_0x1b70('0xa'),auth['isAuthenticated'](),controller[_0x1b70('0xb')]);router[_0x1b70('0x7')](_0x1b70('0xc'),auth[_0x1b70('0x8')](),controller[_0x1b70('0xd')]);router[_0x1b70('0x7')](_0x1b70('0xe'),auth['isAuthenticated'](),controller[_0x1b70('0xf')]);router[_0x1b70('0x7')](_0x1b70('0x10'),auth[_0x1b70('0x8')](),controller[_0x1b70('0x11')]);router[_0x1b70('0x12')]('/',auth[_0x1b70('0x8')](),controller[_0x1b70('0x13')]);router[_0x1b70('0x12')](_0x1b70('0xe'),auth[_0x1b70('0x8')](),controller[_0x1b70('0x14')]);router[_0x1b70('0x12')]('/:id/teams',auth[_0x1b70('0x8')](),controller[_0x1b70('0x15')]);router[_0x1b70('0x16')](_0x1b70('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x1b70('0xc'),auth[_0x1b70('0x8')](),controller[_0x1b70('0x17')]);router[_0x1b70('0x18')](_0x1b70('0xe'),auth[_0x1b70('0x8')](),controller['removeAgents']);router[_0x1b70('0x18')](_0x1b70('0x10'),auth[_0x1b70('0x8')](),controller['removeTeams']);module[_0x1b70('0x19')]=router; \ No newline at end of file +var _0xc7a4=['/:id/teams','post','addAgents','addTeams','delete','destroy','removeAgents','removeTeams','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents'];(function(_0x5e5964,_0x201efc){var _0xb11687=function(_0x544c1b){while(--_0x544c1b){_0x5e5964['push'](_0x5e5964['shift']());}};_0xb11687(++_0x201efc);}(_0xc7a4,0x8b));var _0x4c7a=function(_0x250965,_0x148a1e){_0x250965=_0x250965-0x0;var _0x2a0f14=_0xc7a4[_0x250965];return _0x2a0f14;};'use strict';var multer=require(_0x4c7a('0x0'));var util=require(_0x4c7a('0x1'));var path=require(_0x4c7a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4c7a('0x3')]();var fs_extra=require(_0x4c7a('0x4'));var auth=require(_0x4c7a('0x5'));var interaction=require(_0x4c7a('0x6'));var config=require(_0x4c7a('0x7'));var controller=require('./voicePrefix.controller');router[_0x4c7a('0x8')]('/',auth[_0x4c7a('0x9')](),controller[_0x4c7a('0xa')]);router[_0x4c7a('0x8')](_0x4c7a('0xb'),auth['isAuthenticated'](),controller[_0x4c7a('0xc')]);router['get'](_0x4c7a('0xd'),auth['isAuthenticated'](),controller[_0x4c7a('0xe')]);router[_0x4c7a('0x8')](_0x4c7a('0xf'),auth[_0x4c7a('0x9')](),controller[_0x4c7a('0x10')]);router['get'](_0x4c7a('0x11'),auth[_0x4c7a('0x9')](),controller['getTeams']);router[_0x4c7a('0x12')]('/',auth[_0x4c7a('0x9')](),controller['create']);router[_0x4c7a('0x12')](_0x4c7a('0xf'),auth[_0x4c7a('0x9')](),controller[_0x4c7a('0x13')]);router[_0x4c7a('0x12')](_0x4c7a('0x11'),auth['isAuthenticated'](),controller[_0x4c7a('0x14')]);router['put'](_0x4c7a('0xd'),auth[_0x4c7a('0x9')](),controller['update']);router[_0x4c7a('0x15')](_0x4c7a('0xd'),auth[_0x4c7a('0x9')](),controller[_0x4c7a('0x16')]);router['delete'](_0x4c7a('0xf'),auth[_0x4c7a('0x9')](),controller[_0x4c7a('0x17')]);router[_0x4c7a('0x15')]('/:id/teams',auth['isAuthenticated'](),controller[_0x4c7a('0x18')]);module[_0x4c7a('0x19')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index e7caadb..edc8e09 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 _0xf8eb=['exports','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf8eb,0x10b));var _0xbf8e=function(_0x3a8bd1,_0x49c918){_0x3a8bd1=_0x3a8bd1-0x0;var _0x37532a=_0xf8eb[_0x3a8bd1];return _0x37532a;};'use strict';var Sequelize=require('sequelize');module[_0xbf8e('0x0')]={'name':{'type':Sequelize[_0xbf8e('0x1')],'allowNull':![],'unique':_0xbf8e('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x1c4405){return'system-'+this['getDataValue'](_0xbf8e('0x2'))+'-';}},'description':{'type':Sequelize[_0xbf8e('0x1')]},'callerIdAll':{'type':Sequelize[_0xbf8e('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xb9b2=['getDataValue','STRING','INTEGER','sequelize','name','system-'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xb9b2,0x75));var _0x2b9b=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xb9b2[_0x53cf8e];return _0x459197;};'use strict';var Sequelize=require(_0x2b9b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2b9b('0x1')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x5f5613){return _0x2b9b('0x2')+this[_0x2b9b('0x3')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x2b9b('0x4')]},'VoiceExtensionId':{'type':Sequelize[_0x2b9b('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 25947c2..dbb1ea1 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 _0x065e=['localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','get','VoicePrefixes','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','VoicePrefix','include','rows','catch','show','params','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','callerIdAll','push','Set','PREFIX-CALLERIDALL=','NoOp','goto','context','${EXTEN:','charAt','update','system-','findById','addAgents','omit','ids','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','User','order','pick','getTeams','findOne','addTeams','Team','findAll','Agents','voicePause','interface','each','upsert','UserVoicePrefix','forEach','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','every','TeamId','includes','all','union','compact','isEmpty','eml-format','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults'];(function(_0x2f9bc7,_0x2ff284){var _0x1887f4=function(_0x15dda4){while(--_0x15dda4){_0x2f9bc7['push'](_0x2f9bc7['shift']());}};_0x1887f4(++_0x2ff284);}(_0x065e,0x1a7));var _0xe065=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x065e[_0xdea41a];return _0x15d0d8;};'use strict';var emlformat=require(_0xe065('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe065('0x1'));var moment=require(_0xe065('0x2'));var BPromise=require(_0xe065('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe065('0x4'));var sox=require(_0xe065('0x5'));var csv=require('to-csv');var ejs=require(_0xe065('0x6'));var fs=require('fs');var fs_extra=require(_0xe065('0x7'));var _=require(_0xe065('0x8'));var squel=require('squel');var crypto=require(_0xe065('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe065('0xa'));var toCsv=require(_0xe065('0xb'));var querystring=require(_0xe065('0xc'));var Papa=require(_0xe065('0xd'));var Redis=require(_0xe065('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe065('0xf'));var as=require(_0xe065('0x10'));var hardwareService=require(_0xe065('0x11'));var logger=require(_0xe065('0x12'))(_0xe065('0x13'));var utils=require(_0xe065('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe065('0x15'))['db'];config[_0xe065('0x16')]=_[_0xe065('0x17')](config['redis'],{'host':_0xe065('0x18'),'port':0x18eb});var socket=require(_0xe065('0x19'))(new Redis(config[_0xe065('0x16')]));require(_0xe065('0x1a'))[_0xe065('0x1b')](socket);function respondWithStatusCode(_0x541985,_0x3d3557){_0x3d3557=_0x3d3557||0xcc;return function(_0x2b4789){if(_0x2b4789){return _0x541985[_0xe065('0x1c')](_0x3d3557);}return _0x541985[_0xe065('0x1d')](_0x3d3557)[_0xe065('0x1e')]();};}function respondWithResult(_0x352206,_0x2e5feb){_0x2e5feb=_0x2e5feb||0xc8;return function(_0x545100){if(_0x545100){return _0x352206[_0xe065('0x1d')](_0x2e5feb)[_0xe065('0x1f')](_0x545100);}};}function respondWithFilteredResult(_0x54d260,_0x2bfec0){return function(_0x1d2f7a){if(_0x1d2f7a){var _0x397f05=typeof _0x2bfec0[_0xe065('0x20')]===_0xe065('0x21')&&typeof _0x2bfec0[_0xe065('0x22')]===_0xe065('0x21');var _0x5000e1=_0x1d2f7a[_0xe065('0x23')];var _0x52e9b2=_0x397f05?0x0:_0x2bfec0[_0xe065('0x20')];var _0x23233d=_0x397f05?_0x1d2f7a['count']:_0x2bfec0[_0xe065('0x20')]+_0x2bfec0['limit'];var _0xe26e9b;if(_0x23233d>=_0x5000e1){_0x23233d=_0x5000e1;_0xe26e9b=0xc8;}else{_0xe26e9b=0xce;}_0x54d260[_0xe065('0x1d')](_0xe26e9b);return _0x54d260[_0xe065('0x24')](_0xe065('0x25'),_0x52e9b2+'-'+_0x23233d+'/'+_0x5000e1)[_0xe065('0x1f')](_0x1d2f7a);}return null;};}function patchUpdates(_0x105cb2){return function(_0x22a0cb){try{jsonpatch[_0xe065('0x26')](_0x22a0cb,_0x105cb2,!![]);}catch(_0x1c5dd9){return BPromise['reject'](_0x1c5dd9);}return _0x22a0cb[_0xe065('0x27')]();};}function saveUpdates(_0x43b712,_0x44ec95){return function(_0x13f6e5){if(_0x13f6e5){return _0x13f6e5['update'](_0x43b712)['then'](function(_0x164965){return _0x164965;});}return null;};}function removeEntity(_0x530dc0,_0x14e6b6){return function(_0x27e669){if(_0x27e669){return _0x27e669[_0xe065('0x28')]()[_0xe065('0x29')](function(){var _0x418731=_0x27e669[_0xe065('0x2a')]({'plain':!![]});var _0x3b1caf=_0xe065('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x3b1caf,'resourceId':_0x418731['id']}})[_0xe065('0x29')](function(){return _0x27e669;});})[_0xe065('0x29')](function(){_0x530dc0[_0xe065('0x1d')](0xcc)[_0xe065('0x1e')]();});}};}function handleEntityNotFound(_0x5b1220,_0x23f573){return function(_0x55ecaa){if(!_0x55ecaa){_0x5b1220['sendStatus'](0x194);}return _0x55ecaa;};}function handleError(_0x182743,_0x2659e6){_0x2659e6=_0x2659e6||0x1f4;return function(_0x2aa766){logger['error'](_0x2aa766[_0xe065('0x2c')]);if(_0x2aa766['name']){delete _0x2aa766[_0xe065('0x2d')];}_0x182743[_0xe065('0x1d')](_0x2659e6)[_0xe065('0x2e')](_0x2aa766);};}exports[_0xe065('0x2f')]=function(_0x58c49b,_0x3f02b2){var _0x4940cf={},_0x3fa56f={},_0x2e4e4a={'count':0x0,'rows':[]};var _0x5d0864=_[_0xe065('0x30')](db['VoicePrefix'][_0xe065('0x31')],function(_0x4999b0){return{'name':_0x4999b0[_0xe065('0x32')],'type':_0x4999b0[_0xe065('0x33')][_0xe065('0x34')]};});_0x3fa56f[_0xe065('0x35')]=_['map'](_0x5d0864,_0xe065('0x2d'));_0x3fa56f[_0xe065('0x36')]=_[_0xe065('0x37')](_0x58c49b[_0xe065('0x36')]);_0x3fa56f[_0xe065('0x38')]=_[_0xe065('0x39')](_0x3fa56f['model'],_0x3fa56f[_0xe065('0x36')]);_0x4940cf[_0xe065('0x3a')]=_['intersection'](_0x3fa56f[_0xe065('0x35')],qs[_0xe065('0x3b')](_0x58c49b[_0xe065('0x36')][_0xe065('0x3b')]));_0x4940cf[_0xe065('0x3a')]=_0x4940cf[_0xe065('0x3a')][_0xe065('0x3c')]?_0x4940cf['attributes']:_0x3fa56f[_0xe065('0x35')];if(!_0x58c49b['query'][_0xe065('0x3d')](_0xe065('0x3e'))){_0x4940cf[_0xe065('0x22')]=qs[_0xe065('0x22')](_0x58c49b[_0xe065('0x36')][_0xe065('0x22')]);_0x4940cf['offset']=qs[_0xe065('0x20')](_0x58c49b[_0xe065('0x36')][_0xe065('0x20')]);}_0x4940cf['order']=qs[_0xe065('0x3f')](_0x58c49b[_0xe065('0x36')][_0xe065('0x3f')]);_0x4940cf[_0xe065('0x40')]=qs[_0xe065('0x38')](_['pick'](_0x58c49b[_0xe065('0x36')],_0x3fa56f[_0xe065('0x38')]),_0x5d0864);if(_0x58c49b['query'][_0xe065('0x41')]){_0x4940cf['where']=_[_0xe065('0x42')](_0x4940cf[_0xe065('0x40')],{'$or':_['map'](_0x5d0864,function(_0x3c7e70){if(_0x3c7e70[_0xe065('0x33')]!=='VIRTUAL'){var _0x16b5da={};_0x16b5da[_0x3c7e70[_0xe065('0x2d')]]={'$like':'%'+_0x58c49b[_0xe065('0x36')][_0xe065('0x41')]+'%'};return _0x16b5da;}})});}_0x4940cf=_[_0xe065('0x42')]({},_0x4940cf,_0x58c49b[_0xe065('0x43')]);var _0x395cc2={'where':_0x4940cf[_0xe065('0x40')]};return db[_0xe065('0x44')][_0xe065('0x23')](_0x395cc2)[_0xe065('0x29')](function(_0x4364c3){_0x2e4e4a[_0xe065('0x23')]=_0x4364c3;if(_0x58c49b['query']['includeAll']){_0x4940cf[_0xe065('0x45')]=[{'all':!![]}];}return db[_0xe065('0x44')]['findAll'](_0x4940cf);})[_0xe065('0x29')](function(_0x448044){_0x2e4e4a[_0xe065('0x46')]=_0x448044;return _0x2e4e4a;})[_0xe065('0x29')](respondWithFilteredResult(_0x3f02b2,_0x4940cf))[_0xe065('0x47')](handleError(_0x3f02b2,null));};exports[_0xe065('0x48')]=function(_0x39440c,_0x11e82d){var _0x1f93e9={'raw':![],'where':{'id':_0x39440c[_0xe065('0x49')]['id']}},_0x52073d={};_0x52073d[_0xe065('0x35')]=_[_0xe065('0x37')](db['VoicePrefix'][_0xe065('0x31')]);_0x52073d[_0xe065('0x36')]=_[_0xe065('0x37')](_0x39440c[_0xe065('0x36')]);_0x52073d['filters']=_[_0xe065('0x39')](_0x52073d[_0xe065('0x35')],_0x52073d[_0xe065('0x36')]);_0x1f93e9[_0xe065('0x3a')]=_[_0xe065('0x39')](_0x52073d[_0xe065('0x35')],qs[_0xe065('0x3b')](_0x39440c['query'][_0xe065('0x3b')]));_0x1f93e9[_0xe065('0x3a')]=_0x1f93e9[_0xe065('0x3a')][_0xe065('0x3c')]?_0x1f93e9[_0xe065('0x3a')]:_0x52073d[_0xe065('0x35')];if(_0x39440c[_0xe065('0x36')]['includeAll']){_0x1f93e9[_0xe065('0x45')]=[{'all':!![]}];}_0x1f93e9=_['merge']({},_0x1f93e9,_0x39440c[_0xe065('0x43')]);return db[_0xe065('0x44')][_0xe065('0x4a')](_0x1f93e9)['then'](handleEntityNotFound(_0x11e82d,null))[_0xe065('0x29')](respondWithResult(_0x11e82d,null))[_0xe065('0x47')](handleError(_0x11e82d,null));};exports[_0xe065('0x28')]=function(_0x162d11,_0x3c6880){return db[_0xe065('0x44')][_0xe065('0x4a')]({'where':{'id':_0x162d11[_0xe065('0x49')]['id']}})[_0xe065('0x29')](handleEntityNotFound(_0x3c6880,null))[_0xe065('0x29')](removeEntity(_0x3c6880,null))[_0xe065('0x47')](handleError(_0x3c6880,null));};exports[_0xe065('0x4b')]=function(_0x14327f,_0x490498){return db['VoicePrefix']['describe']()[_0xe065('0x29')](respondWithResult(_0x490498,null))['catch'](handleError(_0x490498,null));};exports[_0xe065('0x4c')]=function(_0x2c5e42,_0x5a7a98){var _0x480aec;return db[_0xe065('0x4d')][_0xe065('0x4e')](function(_0x5cce78){return db[_0xe065('0x44')][_0xe065('0x4c')](_0x2c5e42[_0xe065('0x4f')],{'transaction':_0x5cce78})[_0xe065('0x29')](function(_0x12df39){_0x480aec=_0x12df39[_0xe065('0x2a')]({'plain':!![]});return db[_0xe065('0x50')][_0xe065('0x4a')]({'where':{'id':_0x480aec[_0xe065('0x51')]},'raw':!![]})[_0xe065('0x29')](function(_0x49a367){return createVoicePrefixExtensions(_0x480aec,_0x49a367,_0x5cce78);});});})[_0xe065('0x29')](function(){var _0x18eb92=_0x2c5e42[_0xe065('0x52')][_0xe065('0x2a')]({'plain':!![]});if(!_0x18eb92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18eb92[_0xe065('0x53')]===_0xe065('0x52')){var _0x21884d=_0x480aec;return db[_0xe065('0x54')]['find']({'where':{'name':_0xe065('0x2b'),'userProfileId':_0x18eb92[_0xe065('0x55')]},'raw':!![]})[_0xe065('0x29')](function(_0x5320c6){if(_0x5320c6&&_0x5320c6[_0xe065('0x56')]===0x0){return db[_0xe065('0x57')][_0xe065('0x4c')]({'name':_0x21884d[_0xe065('0x2d')],'resourceId':_0x21884d['id'],'type':_0x5320c6[_0xe065('0x2d')],'sectionId':_0x5320c6['id']},{})[_0xe065('0x29')](function(){return _0x480aec;});}else{return _0x480aec;}})[_0xe065('0x47')](function(_0x464ef7){logger[_0xe065('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x464ef7);throw _0x464ef7;});}return _0x480aec;})[_0xe065('0x29')](respondWithResult(_0x5a7a98,null))['catch'](handleError(_0x5a7a98,null));};function Extension(_0x44edf0,_0x24fc1c,_0x3c1229,_0x4e9e85){this['context']='from-sip';this[_0xe065('0x59')]=_0x44edf0;this[_0xe065('0x5a')]=_0x3c1229;this[_0xe065('0x33')]=_0xe065('0x5b');this[_0xe065('0x5c')]=_0xe065('0x5d');this[_0xe065('0x5e')]=_0x24fc1c;this[_0xe065('0x5f')]=_0x4e9e85;}function createVoicePrefixExtensions(_0x20abe0,_0x3169fa,_0x25ec8a){return new BPromise(function(_0x590429,_0x544bff){var _0x2fe0ac=new Extension(formatPrefixName(_0x20abe0[_0xe065('0x60')]),0x1,'NoOp',_0xe065('0x61'));_0x2fe0ac['VoicePrefixId']=_0x20abe0['id'];return db['VoiceExtension'][_0xe065('0x4c')](_0x2fe0ac,{'transaction':_0x25ec8a})[_0xe065('0x29')](function(_0x4e7275){var _0x96355e=_0x4e7275[_0xe065('0x2a')]({'plain':!![]});var _0x817baf=_[_0xe065('0x30')](addVoicePrefixExtensions(_0x20abe0,_0x3169fa),function(_0x5edc0f){_0x5edc0f[_0xe065('0x51')]=_0x96355e['id'];_0x5edc0f[_0xe065('0x62')]=_0x20abe0['id'];return _0x5edc0f;});return db[_0xe065('0x50')][_0xe065('0x63')](_0x817baf,{'transaction':_0x25ec8a})[_0xe065('0x29')](function(_0x4f35a6){if(!_0x4f35a6){return _0x544bff(_0xe065('0x64'));}else{return _0x590429(_0x4f35a6);}})[_0xe065('0x47')](function(_0x29b3f0){return _0x544bff(_0x29b3f0);});});;});};function addVoicePrefixExtensions(_0x155133,_0x2968c5){var _0xfce2e=[];var _0x5af9d5=formatPrefixName(_0x155133['prefix']);_0xfce2e['push'](new Extension(_0x5af9d5,0x2,'Set','CDR(prefix)='+_0x155133[_0xe065('0x2d')]));if(_0x155133[_0xe065('0x65')]){_0xfce2e[_0xe065('0x66')](new Extension(_0x5af9d5,0x3,_0xe065('0x67'),_0xe065('0x68')+_0x155133[_0xe065('0x65')]));}else{_0xfce2e[_0xe065('0x66')](new Extension(_0x5af9d5,0x3,_0xe065('0x69'),'No\x20callerid\x20available'));}_0xfce2e['push'](new Extension(_0x5af9d5,0x4,_0xe065('0x6a'),_0x2968c5[_0xe065('0x6b')]+','+_0xe065('0x6c')+(0x8+_0x155133['name'][_0xe065('0x3c')])+'}'+','+0x1));return _0xfce2e;}function formatPrefixName(_0x268428){var _0x113a0f='_';for(var _0x4765a0=0x0;_0x4765a0<_0x268428[_0xe065('0x3c')];_0x4765a0++){if(_0x268428[_0xe065('0x6d')](_0x4765a0)=='-'){_0x113a0f+=_0x268428[_0xe065('0x6d')](_0x4765a0);}else{_0x113a0f+='['+_0x268428[_0xe065('0x6d')](_0x4765a0)+']';}}_0x113a0f+='.';return _0x113a0f;}exports[_0xe065('0x6e')]=function(_0xecef2,_0x213feb,_0x4493db){var _0xa5310c=_0xecef2[_0xe065('0x4f')];_0xa5310c[_0xe065('0x60')]=_0xe065('0x6f')+_0xa5310c[_0xe065('0x2d')]+'-';return db[_0xe065('0x4d')]['transaction'](function(_0x31d6cb){return db[_0xe065('0x44')][_0xe065('0x6e')](_0xa5310c,{'where':{'id':_0xa5310c['id']},'transaction':_0x31d6cb})[_0xe065('0x29')](function(){return db[_0xe065('0x50')][_0xe065('0x28')]({'where':{'VoicePrefixId':_0xa5310c['id']},'transaction':_0x31d6cb})[_0xe065('0x29')](function(){return db[_0xe065('0x50')][_0xe065('0x4a')]({'where':{'id':_0xa5310c[_0xe065('0x51')]},'raw':!![]})[_0xe065('0x29')](function(_0xa08631){return createVoicePrefixExtensions(_0xa5310c,_0xa08631,_0x31d6cb);});});});})[_0xe065('0x29')](function(){return db[_0xe065('0x44')][_0xe065('0x70')](_0xa5310c['id']);})[_0xe065('0x29')](respondWithResult(_0x213feb,null))[_0xe065('0x47')](handleError(_0x213feb,null));};exports['addAgents']=function(_0x256eef,_0x185b5b,_0x3e2241){return db[_0xe065('0x44')][_0xe065('0x4a')]({'where':{'id':_0x256eef[_0xe065('0x49')]['id']}})[_0xe065('0x29')](handleEntityNotFound(_0x185b5b,null))[_0xe065('0x29')](function(_0x54b1f2){if(_0x54b1f2){return _0x54b1f2[_0xe065('0x71')](_0x256eef['body']['ids'],_[_0xe065('0x72')](_0x256eef['body'],[_0xe065('0x73'),'id'])||{})['spread'](function(_0x1df721){for(var _0x162482=0x0;_0x162482<_0x256eef[_0xe065('0x4f')][_0xe065('0x73')][_0xe065('0x3c')];_0x162482+=0x1){socket[_0xe065('0x74')](_0xe065('0x75'),{'UserId':Number(_0x256eef[_0xe065('0x4f')][_0xe065('0x73')][_0x162482]),'VoicePrefixId':Number(_0x256eef['params']['id'])});}return _0x1df721;});}})[_0xe065('0x29')](respondWithResult(_0x185b5b,null))[_0xe065('0x47')](handleError(_0x185b5b,null));};exports[_0xe065('0x76')]=function(_0x3f8e32,_0x5858d9,_0x26c427){return db[_0xe065('0x44')][_0xe065('0x4a')]({'where':{'id':_0x3f8e32['params']['id']}})[_0xe065('0x29')](handleEntityNotFound(_0x5858d9,null))[_0xe065('0x29')](function(_0x3c024b){if(_0x3c024b){return _0x3c024b['removeAgents'](_0x3f8e32[_0xe065('0x36')][_0xe065('0x73')])['then'](function(){if(_['isArray'](_0x3f8e32[_0xe065('0x36')][_0xe065('0x73')])){for(var _0x1b8c33=0x0;_0x1b8c33<_0x3f8e32[_0xe065('0x36')][_0xe065('0x73')]['length'];_0x1b8c33+=0x1){socket['emit'](_0xe065('0x77'),{'UserId':Number(_0x3f8e32[_0xe065('0x36')]['ids'][_0x1b8c33]),'VoicePrefixId':Number(_0x3f8e32[_0xe065('0x49')]['id'])});}}else{socket[_0xe065('0x74')](_0xe065('0x77'),{'UserId':Number(_0x3f8e32[_0xe065('0x36')][_0xe065('0x73')]),'VoicePrefixId':Number(_0x3f8e32[_0xe065('0x49')]['id'])});}});}})[_0xe065('0x29')](respondWithStatusCode(_0x5858d9,null))[_0xe065('0x47')](handleError(_0x5858d9,null));};exports[_0xe065('0x78')]=function(_0x1ec81f,_0x4d25b9,_0x5d940d){var _0x34174f={};var _0x5336e3={};var _0x2451ec;var _0x45b479;return db[_0xe065('0x44')]['findOne']({'where':{'id':_0x1ec81f[_0xe065('0x49')]['id']}})[_0xe065('0x29')](handleEntityNotFound(_0x4d25b9,null))[_0xe065('0x29')](function(_0x124054){if(_0x124054){_0x2451ec=_0x124054;_0x5336e3[_0xe065('0x35')]=_[_0xe065('0x37')](db[_0xe065('0x79')][_0xe065('0x31')]);_0x5336e3[_0xe065('0x36')]=_[_0xe065('0x37')](_0x1ec81f[_0xe065('0x36')]);_0x5336e3['filters']=_[_0xe065('0x39')](_0x5336e3[_0xe065('0x35')],_0x5336e3[_0xe065('0x36')]);_0x34174f[_0xe065('0x3a')]=_[_0xe065('0x39')](_0x5336e3[_0xe065('0x35')],qs[_0xe065('0x3b')](_0x1ec81f[_0xe065('0x36')][_0xe065('0x3b')]));_0x34174f[_0xe065('0x3a')]=_0x34174f[_0xe065('0x3a')][_0xe065('0x3c')]?_0x34174f['attributes']:_0x5336e3[_0xe065('0x35')];_0x34174f[_0xe065('0x7a')]=qs[_0xe065('0x3f')](_0x1ec81f[_0xe065('0x36')][_0xe065('0x3f')]);_0x34174f[_0xe065('0x40')]=qs[_0xe065('0x38')](_[_0xe065('0x7b')](_0x1ec81f[_0xe065('0x36')],_0x5336e3[_0xe065('0x38')]));if(_0x1ec81f[_0xe065('0x36')][_0xe065('0x41')]){_0x34174f[_0xe065('0x40')]=_[_0xe065('0x42')](_0x34174f[_0xe065('0x40')],{'$or':_[_0xe065('0x30')](_0x34174f[_0xe065('0x3a')],function(_0x47792d){var _0x105eaa={};_0x105eaa[_0x47792d]={'$like':'%'+_0x1ec81f[_0xe065('0x36')][_0xe065('0x41')]+'%'};return _0x105eaa;})});}_0x34174f=_[_0xe065('0x42')]({},_0x34174f,_0x1ec81f[_0xe065('0x43')]);return _0x2451ec[_0xe065('0x78')](_0x34174f);}})[_0xe065('0x29')](function(_0x428745){if(_0x428745){_0x45b479=_0x428745[_0xe065('0x3c')];if(!_0x1ec81f[_0xe065('0x36')][_0xe065('0x3d')](_0xe065('0x3e'))){_0x34174f[_0xe065('0x22')]=qs[_0xe065('0x22')](_0x1ec81f[_0xe065('0x36')][_0xe065('0x22')]);_0x34174f[_0xe065('0x20')]=qs[_0xe065('0x20')](_0x1ec81f[_0xe065('0x36')][_0xe065('0x20')]);}return _0x2451ec[_0xe065('0x78')](_0x34174f);}})[_0xe065('0x29')](function(_0x4da03f){if(_0x4da03f){return _0x4da03f?{'count':_0x45b479,'rows':_0x4da03f}:null;}})[_0xe065('0x29')](respondWithResult(_0x4d25b9,null))[_0xe065('0x47')](handleError(_0x4d25b9,null));};exports[_0xe065('0x7c')]=function(_0xe199d7,_0x40231d,_0x34b37c){var _0x24ebbd={};var _0x22bc5c={};var _0x5d6761;var _0x2f2f53;return db['VoicePrefix'][_0xe065('0x7d')]({'where':{'id':_0xe199d7['params']['id']}})[_0xe065('0x29')](handleEntityNotFound(_0x40231d,null))[_0xe065('0x29')](function(_0x19e3cf){if(_0x19e3cf){_0x5d6761=_0x19e3cf;_0x22bc5c[_0xe065('0x35')]=_['keys'](db['Team'][_0xe065('0x31')]);_0x22bc5c[_0xe065('0x36')]=_[_0xe065('0x37')](_0xe199d7['query']);_0x22bc5c[_0xe065('0x38')]=_[_0xe065('0x39')](_0x22bc5c[_0xe065('0x35')],_0x22bc5c['query']);_0x24ebbd['attributes']=_['intersection'](_0x22bc5c['model'],qs[_0xe065('0x3b')](_0xe199d7[_0xe065('0x36')][_0xe065('0x3b')]));_0x24ebbd[_0xe065('0x3a')]=_0x24ebbd[_0xe065('0x3a')]['length']?_0x24ebbd[_0xe065('0x3a')]:_0x22bc5c[_0xe065('0x35')];_0x24ebbd['order']=qs[_0xe065('0x3f')](_0xe199d7['query'][_0xe065('0x3f')]);_0x24ebbd['where']=qs[_0xe065('0x38')](_[_0xe065('0x7b')](_0xe199d7[_0xe065('0x36')],_0x22bc5c[_0xe065('0x38')]));if(_0xe199d7[_0xe065('0x36')][_0xe065('0x41')]){_0x24ebbd[_0xe065('0x40')]=_[_0xe065('0x42')](_0x24ebbd[_0xe065('0x40')],{'$or':_[_0xe065('0x30')](_0x24ebbd[_0xe065('0x3a')],function(_0x242712){var _0xa89a0e={};_0xa89a0e[_0x242712]={'$like':'%'+_0xe199d7[_0xe065('0x36')]['filter']+'%'};return _0xa89a0e;})});}_0x24ebbd=_['merge']({},_0x24ebbd,_0xe199d7[_0xe065('0x43')]);return _0x5d6761[_0xe065('0x7c')](_0x24ebbd);}})['then'](function(_0x33a5b9){if(_0x33a5b9){_0x2f2f53=_0x33a5b9[_0xe065('0x3c')];if(!_0xe199d7[_0xe065('0x36')][_0xe065('0x3d')](_0xe065('0x3e'))){_0x24ebbd[_0xe065('0x22')]=qs[_0xe065('0x22')](_0xe199d7['query']['limit']);_0x24ebbd[_0xe065('0x20')]=qs[_0xe065('0x20')](_0xe199d7[_0xe065('0x36')][_0xe065('0x20')]);}return _0x5d6761['getTeams'](_0x24ebbd);}})[_0xe065('0x29')](function(_0x33f41c){if(_0x33f41c){return _0x33f41c?{'count':_0x2f2f53,'rows':_0x33f41c}:null;}})[_0xe065('0x29')](respondWithResult(_0x40231d,null))[_0xe065('0x47')](handleError(_0x40231d,null));};exports[_0xe065('0x7e')]=function(_0x123188,_0x490961,_0x3cd1c8){var _0x4a63da=_0x123188['body'][_0xe065('0x73')];var _0x14440a;return db[_0xe065('0x7f')][_0xe065('0x80')]({'where':{'id':_0x4a63da},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe065('0x81'),'attributes':['id',_0xe065('0x2d'),'online',_0xe065('0x82'),_0xe065('0x83')],'raw':!![]}]})[_0xe065('0x29')](function(_0x29ecc6){if(_0x29ecc6){_0x14440a=_0x29ecc6;var _0x2aab25=_['flatMap'](_0x29ecc6,function(_0x1998ee){var _0x5df1f5=_0x1998ee[_0xe065('0x2a')]({'plain':!![]});return _0x5df1f5['Agents'];});return db[_0xe065('0x44')][_0xe065('0x4a')]({'where':{'id':_0x123188[_0xe065('0x49')]['id']}})['then'](function(_0x4d68c2){return db[_0xe065('0x4d')][_0xe065('0x4e')](function(_0x5c61df){return _0x4d68c2[_0xe065('0x7e')](_0x4a63da,{'transaction':_0x5c61df})['then'](function(){return BPromise[_0xe065('0x84')](_0x14440a,function(_0x41c62a){return db['TeamVoicePrefix'][_0xe065('0x85')]({'TeamId':_0x41c62a['id'],'VoicePrefixId':_0x123188[_0xe065('0x49')]['id']},{'transaction':_0x5c61df});});})[_0xe065('0x29')](function(){return BPromise[_0xe065('0x84')](_0x2aab25,function(_0xd8b280){return db[_0xe065('0x86')]['findOrCreate']({'where':{'UserId':_0xd8b280['id'],'VoicePrefixId':_0x123188['params']['id']},'transaction':_0x5c61df});});})[_0xe065('0x29')](function(){_0x2aab25[_0xe065('0x87')](function(_0x41d5b5){socket[_0xe065('0x74')](_0xe065('0x75'),{'UserId':_0x41d5b5['id'],'VoicePrefixId':_0x4d68c2['id']});});});});});}})['then'](respondWithStatusCode(_0x490961,null))['catch'](handleError(_0x490961,null));};exports['removeTeams']=function(_0x3e51b4,_0xab9cb,_0x5d64af){return db[_0xe065('0x7f')][_0xe065('0x80')]({'where':{'id':_0x3e51b4[_0xe065('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe065('0x79')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xab9cb,null))[_0xe065('0x29')](function(_0x42afb3){var _0x38119f=_[_0xe065('0x30')](_0x42afb3,'id');var _0x5b7ce9=[];var _0xa80c6d=[];var _0x3a46d3=squel['select']();_0x3a46d3[_0xe065('0x88')](_0xe065('0x89'))[_0xe065('0x8a')]('team_has_voice_prefixes','tq')[_0xe065('0x8b')]('user_has_teams','ut',_0xe065('0x8c'))[_0xe065('0x40')]('VoicePrefixId\x20=\x20?',_0x3e51b4['params']['id']);for(var _0x451186=0x0;_0x451186<_0x42afb3[_0xe065('0x3c')];_0x451186+=0x1){let _0x16e82a=_0x42afb3[_0x451186];for(var _0x243415=0x0;_0x243415<_0x16e82a[_0xe065('0x81')][_0xe065('0x3c')];_0x243415+=0x1){let _0x2b8d04=_0x16e82a['Agents'][_0x243415];var _0x572836=_0x3a46d3['clone']();_0x572836[_0xe065('0x40')](_0xe065('0x8d'),_0x2b8d04['id']);_0xa80c6d['push'](db[_0xe065('0x4d')][_0xe065('0x36')](_0x572836['toString'](),{'type':db[_0xe065('0x4d')]['QueryTypes']['SELECT']})[_0xe065('0x29')](function(_0x1a21c0){if(_0x1a21c0[_0xe065('0x3c')]===0x1){return _0x2b8d04['id'];}else{var _0x5c7e10=_[_0xe065('0x8e')](_[_0xe065('0x30')](_0x1a21c0,_0xe065('0x8f')),function(_0x10a15e){return _[_0xe065('0x90')](_0x38119f,_0x10a15e);});if(_0x5c7e10){return _0x2b8d04['id'];}}}));}}return BPromise[_0xe065('0x91')](_0xa80c6d)[_0xe065('0x29')](function(_0x20c16c){_0x5b7ce9=_(_0x5b7ce9)[_0xe065('0x92')](_0x20c16c)[_0xe065('0x93')]()['value']();return db[_0xe065('0x44')][_0xe065('0x4a')]({'where':{'id':_0x3e51b4[_0xe065('0x49')]['id']}})[_0xe065('0x29')](function(_0x97b140){return db['sequelize'][_0xe065('0x4e')](function(_0x257ea2){return _0x97b140['removeTeams'](_0x3e51b4['query'][_0xe065('0x73')],{'transaction':_0x257ea2})[_0xe065('0x29')](function(){if(!_[_0xe065('0x94')](_0x5b7ce9)){return _0x97b140[_0xe065('0x76')](_0x5b7ce9,{'transaction':_0x257ea2});}})['then'](function(){_0x5b7ce9[_0xe065('0x87')](function(_0x1113fa){socket[_0xe065('0x74')](_0xe065('0x77'),{'UserId':_0x1113fa,'VoicePrefixId':_0x97b140['id']});});});});});});})['then'](respondWithStatusCode(_0xab9cb,null))[_0xe065('0x47')](handleError(_0xab9cb,null));}; \ No newline at end of file +var _0x63a5=['merge','VIRTUAL','options','includeAll','include','VoicePrefix','findAll','rows','catch','show','params','rawAttributes','keys','find','describe','create','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','context','from-sip','exten','app','appdata','prefix','NoOp','VoicePrefixId','VoiceExtension','bulkCreate','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','No\x20callerid\x20available','goto','charAt','system-','transaction','findById','addAgents','ids','spread','emit','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','pick','getTeams','Team','Agents','online','voicePause','interface','flatMap','sequelize','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','removeTeams','select','field','tq.TeamId','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','compact','value','isEmpty','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','redis','defaults','localhost','socket.io-emitter','register','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','send','index','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter'];(function(_0x53ef5e,_0x2ea64f){var _0x2aec64=function(_0x53f1a0){while(--_0x53f1a0){_0x53ef5e['push'](_0x53ef5e['shift']());}};_0x2aec64(++_0x2ea64f);}(_0x63a5,0x18e));var _0x563a=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x63a5[_0x20a558];return _0x53d3f7;};'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'];config[_0x563a('0x19')]=_[_0x563a('0x1a')](config[_0x563a('0x19')],{'host':_0x563a('0x1b'),'port':0x18eb});var socket=require(_0x563a('0x1c'))(new Redis(config[_0x563a('0x19')]));require('./voicePrefix.socket')[_0x563a('0x1d')](socket);function respondWithStatusCode(_0x3045ac,_0x8c3727){_0x8c3727=_0x8c3727||0xcc;return function(_0x26987f){if(_0x26987f){return _0x3045ac['sendStatus'](_0x8c3727);}return _0x3045ac['status'](_0x8c3727)[_0x563a('0x1e')]();};}function respondWithResult(_0x2ad667,_0x5b291f){_0x5b291f=_0x5b291f||0xc8;return function(_0x2ade24){if(_0x2ade24){return _0x2ad667[_0x563a('0x1f')](_0x5b291f)[_0x563a('0x20')](_0x2ade24);}};}function respondWithFilteredResult(_0x9c2f77,_0x4f947d){return function(_0x598693){if(_0x598693){var _0xe3d2bd=typeof _0x4f947d[_0x563a('0x21')]===_0x563a('0x22')&&typeof _0x4f947d['limit']==='undefined';var _0x52b99a=_0x598693['count'];var _0x40916a=_0xe3d2bd?0x0:_0x4f947d[_0x563a('0x21')];var _0x26061f=_0xe3d2bd?_0x598693[_0x563a('0x23')]:_0x4f947d['offset']+_0x4f947d['limit'];var _0x3930f0;if(_0x26061f>=_0x52b99a){_0x26061f=_0x52b99a;_0x3930f0=0xc8;}else{_0x3930f0=0xce;}_0x9c2f77[_0x563a('0x1f')](_0x3930f0);return _0x9c2f77[_0x563a('0x24')](_0x563a('0x25'),_0x40916a+'-'+_0x26061f+'/'+_0x52b99a)[_0x563a('0x20')](_0x598693);}return null;};}function patchUpdates(_0x2dc7e2){return function(_0x44b460){try{jsonpatch[_0x563a('0x26')](_0x44b460,_0x2dc7e2,!![]);}catch(_0x506491){return BPromise[_0x563a('0x27')](_0x506491);}return _0x44b460['save']();};}function saveUpdates(_0x44e2c1,_0xd3e0ae){return function(_0x3a36a4){if(_0x3a36a4){return _0x3a36a4[_0x563a('0x28')](_0x44e2c1)[_0x563a('0x29')](function(_0x1682ee){return _0x1682ee;});}return null;};}function removeEntity(_0x3642b3,_0x173990){return function(_0x4de4c3){if(_0x4de4c3){return _0x4de4c3[_0x563a('0x2a')]()[_0x563a('0x29')](function(){var _0x2311f2=_0x4de4c3[_0x563a('0x2b')]({'plain':!![]});var _0xce8165=_0x563a('0x2c');return db[_0x563a('0x2d')][_0x563a('0x2a')]({'where':{'type':_0xce8165,'resourceId':_0x2311f2['id']}})[_0x563a('0x29')](function(){return _0x4de4c3;});})[_0x563a('0x29')](function(){_0x3642b3[_0x563a('0x1f')](0xcc)[_0x563a('0x1e')]();});}};}function handleEntityNotFound(_0x1bdfb0,_0x7696c2){return function(_0x579cb5){if(!_0x579cb5){_0x1bdfb0[_0x563a('0x2e')](0x194);}return _0x579cb5;};}function handleError(_0x3c16d0,_0x2257e1){_0x2257e1=_0x2257e1||0x1f4;return function(_0x4aaa3d){logger[_0x563a('0x2f')](_0x4aaa3d[_0x563a('0x30')]);if(_0x4aaa3d[_0x563a('0x31')]){delete _0x4aaa3d[_0x563a('0x31')];}_0x3c16d0[_0x563a('0x1f')](_0x2257e1)[_0x563a('0x32')](_0x4aaa3d);};}exports[_0x563a('0x33')]=function(_0x4a2d28,_0x2418ae){var _0x24ec9d={},_0x4259f6={},_0x2ea6c2={'count':0x0,'rows':[]};var _0x1a77b8=_['map'](db['VoicePrefix']['rawAttributes'],function(_0x4e5c46){return{'name':_0x4e5c46[_0x563a('0x34')],'type':_0x4e5c46[_0x563a('0x35')][_0x563a('0x36')]};});_0x4259f6[_0x563a('0x37')]=_[_0x563a('0x38')](_0x1a77b8,_0x563a('0x31'));_0x4259f6['query']=_['keys'](_0x4a2d28[_0x563a('0x39')]);_0x4259f6[_0x563a('0x3a')]=_[_0x563a('0x3b')](_0x4259f6[_0x563a('0x37')],_0x4259f6[_0x563a('0x39')]);_0x24ec9d[_0x563a('0x3c')]=_[_0x563a('0x3b')](_0x4259f6[_0x563a('0x37')],qs[_0x563a('0x3d')](_0x4a2d28[_0x563a('0x39')][_0x563a('0x3d')]));_0x24ec9d[_0x563a('0x3c')]=_0x24ec9d[_0x563a('0x3c')][_0x563a('0x3e')]?_0x24ec9d[_0x563a('0x3c')]:_0x4259f6[_0x563a('0x37')];if(!_0x4a2d28['query'][_0x563a('0x3f')](_0x563a('0x40'))){_0x24ec9d[_0x563a('0x41')]=qs['limit'](_0x4a2d28[_0x563a('0x39')]['limit']);_0x24ec9d[_0x563a('0x21')]=qs[_0x563a('0x21')](_0x4a2d28['query']['offset']);}_0x24ec9d[_0x563a('0x42')]=qs['sort'](_0x4a2d28[_0x563a('0x39')][_0x563a('0x43')]);_0x24ec9d[_0x563a('0x44')]=qs[_0x563a('0x3a')](_['pick'](_0x4a2d28['query'],_0x4259f6[_0x563a('0x3a')]),_0x1a77b8);if(_0x4a2d28['query'][_0x563a('0x45')]){_0x24ec9d[_0x563a('0x44')]=_[_0x563a('0x46')](_0x24ec9d[_0x563a('0x44')],{'$or':_[_0x563a('0x38')](_0x1a77b8,function(_0x38fab5){if(_0x38fab5[_0x563a('0x35')]!==_0x563a('0x47')){var _0x4c71df={};_0x4c71df[_0x38fab5[_0x563a('0x31')]]={'$like':'%'+_0x4a2d28['query'][_0x563a('0x45')]+'%'};return _0x4c71df;}})});}_0x24ec9d=_[_0x563a('0x46')]({},_0x24ec9d,_0x4a2d28[_0x563a('0x48')]);var _0x2d3800={'where':_0x24ec9d['where']};return db['VoicePrefix']['count'](_0x2d3800)[_0x563a('0x29')](function(_0x1255da){_0x2ea6c2[_0x563a('0x23')]=_0x1255da;if(_0x4a2d28[_0x563a('0x39')][_0x563a('0x49')]){_0x24ec9d[_0x563a('0x4a')]=[{'all':!![]}];}return db[_0x563a('0x4b')][_0x563a('0x4c')](_0x24ec9d);})[_0x563a('0x29')](function(_0x433353){_0x2ea6c2[_0x563a('0x4d')]=_0x433353;return _0x2ea6c2;})[_0x563a('0x29')](respondWithFilteredResult(_0x2418ae,_0x24ec9d))[_0x563a('0x4e')](handleError(_0x2418ae,null));};exports[_0x563a('0x4f')]=function(_0x144e15,_0x456d27){var _0x4643c4={'raw':![],'where':{'id':_0x144e15[_0x563a('0x50')]['id']}},_0x21bafb={};_0x21bafb['model']=_['keys'](db[_0x563a('0x4b')][_0x563a('0x51')]);_0x21bafb[_0x563a('0x39')]=_[_0x563a('0x52')](_0x144e15[_0x563a('0x39')]);_0x21bafb[_0x563a('0x3a')]=_[_0x563a('0x3b')](_0x21bafb[_0x563a('0x37')],_0x21bafb['query']);_0x4643c4['attributes']=_[_0x563a('0x3b')](_0x21bafb[_0x563a('0x37')],qs[_0x563a('0x3d')](_0x144e15[_0x563a('0x39')][_0x563a('0x3d')]));_0x4643c4[_0x563a('0x3c')]=_0x4643c4[_0x563a('0x3c')][_0x563a('0x3e')]?_0x4643c4['attributes']:_0x21bafb[_0x563a('0x37')];if(_0x144e15[_0x563a('0x39')]['includeAll']){_0x4643c4[_0x563a('0x4a')]=[{'all':!![]}];}_0x4643c4=_['merge']({},_0x4643c4,_0x144e15[_0x563a('0x48')]);return db[_0x563a('0x4b')][_0x563a('0x53')](_0x4643c4)['then'](handleEntityNotFound(_0x456d27,null))[_0x563a('0x29')](respondWithResult(_0x456d27,null))[_0x563a('0x4e')](handleError(_0x456d27,null));};exports[_0x563a('0x2a')]=function(_0x39c104,_0x6fe8a9){return db[_0x563a('0x4b')][_0x563a('0x53')]({'where':{'id':_0x39c104[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x6fe8a9,null))[_0x563a('0x29')](removeEntity(_0x6fe8a9,null))[_0x563a('0x4e')](handleError(_0x6fe8a9,null));};exports[_0x563a('0x54')]=function(_0x406d4a,_0x497469){return db['VoicePrefix'][_0x563a('0x54')]()[_0x563a('0x29')](respondWithResult(_0x497469,null))[_0x563a('0x4e')](handleError(_0x497469,null));};exports['create']=function(_0x5ae08f,_0x13530f){var _0x1fc4d2;return db['sequelize']['transaction'](function(_0x51e142){return db[_0x563a('0x4b')][_0x563a('0x55')](_0x5ae08f[_0x563a('0x56')],{'transaction':_0x51e142})[_0x563a('0x29')](function(_0x8d3997){_0x1fc4d2=_0x8d3997[_0x563a('0x2b')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x1fc4d2[_0x563a('0x57')]},'raw':!![]})['then'](function(_0x4453b2){return createVoicePrefixExtensions(_0x1fc4d2,_0x4453b2,_0x51e142);});});})[_0x563a('0x29')](function(){var _0x3e993e=_0x5ae08f[_0x563a('0x58')][_0x563a('0x2b')]({'plain':!![]});if(!_0x3e993e)throw new Error(_0x563a('0x59'));if(_0x3e993e[_0x563a('0x5a')]==='user'){var _0x22cc91=_0x1fc4d2;return db[_0x563a('0x5b')]['find']({'where':{'name':_0x563a('0x2c'),'userProfileId':_0x3e993e[_0x563a('0x5c')]},'raw':!![]})[_0x563a('0x29')](function(_0x2afa8c){if(_0x2afa8c&&_0x2afa8c[_0x563a('0x5d')]===0x0){return db[_0x563a('0x2d')][_0x563a('0x55')]({'name':_0x22cc91[_0x563a('0x31')],'resourceId':_0x22cc91['id'],'type':_0x2afa8c[_0x563a('0x31')],'sectionId':_0x2afa8c['id']},{})[_0x563a('0x29')](function(){return _0x1fc4d2;});}else{return _0x1fc4d2;}})['catch'](function(_0x1926f1){logger[_0x563a('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1926f1);throw _0x1926f1;});}return _0x1fc4d2;})['then'](respondWithResult(_0x13530f,null))[_0x563a('0x4e')](handleError(_0x13530f,null));};function Extension(_0x709bfd,_0x579d61,_0x19edc3,_0x59e371){this[_0x563a('0x5e')]=_0x563a('0x5f');this[_0x563a('0x60')]=_0x709bfd;this[_0x563a('0x61')]=_0x19edc3;this[_0x563a('0x35')]='system';this['description']='Voice\x20Prefix\x20Extension';this['priority']=_0x579d61;this[_0x563a('0x62')]=_0x59e371;}function createVoicePrefixExtensions(_0x5141d5,_0x111444,_0x496b6a){return new BPromise(function(_0x2a82cf,_0x3f2750){var _0xbe3343=new Extension(formatPrefixName(_0x5141d5[_0x563a('0x63')]),0x1,_0x563a('0x64'),'Voice\x20Prefix');_0xbe3343[_0x563a('0x65')]=_0x5141d5['id'];return db['VoiceExtension']['create'](_0xbe3343,{'transaction':_0x496b6a})[_0x563a('0x29')](function(_0x3b7993){var _0x409f3c=_0x3b7993[_0x563a('0x2b')]({'plain':!![]});var _0x1c8ad7=_['map'](addVoicePrefixExtensions(_0x5141d5,_0x111444),function(_0x10eb03){_0x10eb03[_0x563a('0x57')]=_0x409f3c['id'];_0x10eb03[_0x563a('0x65')]=_0x5141d5['id'];return _0x10eb03;});return db[_0x563a('0x66')][_0x563a('0x67')](_0x1c8ad7,{'transaction':_0x496b6a})['then'](function(_0xac578c){if(!_0xac578c){return _0x3f2750('Extensions\x20creation\x20failed');}else{return _0x2a82cf(_0xac578c);}})[_0x563a('0x4e')](function(_0x201c9d){return _0x3f2750(_0x201c9d);});});;});};function addVoicePrefixExtensions(_0x47d6cd,_0x34dd59){var _0x30bf2b=[];var _0x18a26b=formatPrefixName(_0x47d6cd[_0x563a('0x63')]);_0x30bf2b[_0x563a('0x68')](new Extension(_0x18a26b,0x2,_0x563a('0x69'),_0x563a('0x6a')+_0x47d6cd[_0x563a('0x31')]));if(_0x47d6cd['callerIdAll']){_0x30bf2b[_0x563a('0x68')](new Extension(_0x18a26b,0x3,_0x563a('0x69'),_0x563a('0x6b')+_0x47d6cd[_0x563a('0x6c')]));}else{_0x30bf2b[_0x563a('0x68')](new Extension(_0x18a26b,0x3,_0x563a('0x64'),_0x563a('0x6d')));}_0x30bf2b['push'](new Extension(_0x18a26b,0x4,_0x563a('0x6e'),_0x34dd59['context']+','+'${EXTEN:'+(0x8+_0x47d6cd['name'][_0x563a('0x3e')])+'}'+','+0x1));return _0x30bf2b;}function formatPrefixName(_0x4e4e60){var _0x529587='_';for(var _0x30d775=0x0;_0x30d775<_0x4e4e60[_0x563a('0x3e')];_0x30d775++){if(_0x4e4e60[_0x563a('0x6f')](_0x30d775)=='-'){_0x529587+=_0x4e4e60[_0x563a('0x6f')](_0x30d775);}else{_0x529587+='['+_0x4e4e60[_0x563a('0x6f')](_0x30d775)+']';}}_0x529587+='.';return _0x529587;}exports['update']=function(_0x4814b3,_0x4c9ad7,_0x39b8f8){var _0x8b2e10=_0x4814b3[_0x563a('0x56')];_0x8b2e10[_0x563a('0x63')]=_0x563a('0x70')+_0x8b2e10[_0x563a('0x31')]+'-';return db['sequelize'][_0x563a('0x71')](function(_0x43b2f1){return db['VoicePrefix'][_0x563a('0x28')](_0x8b2e10,{'where':{'id':_0x8b2e10['id']},'transaction':_0x43b2f1})[_0x563a('0x29')](function(){return db[_0x563a('0x66')]['destroy']({'where':{'VoicePrefixId':_0x8b2e10['id']},'transaction':_0x43b2f1})[_0x563a('0x29')](function(){return db[_0x563a('0x66')][_0x563a('0x53')]({'where':{'id':_0x8b2e10[_0x563a('0x57')]},'raw':!![]})['then'](function(_0x229690){return createVoicePrefixExtensions(_0x8b2e10,_0x229690,_0x43b2f1);});});});})[_0x563a('0x29')](function(){return db[_0x563a('0x4b')][_0x563a('0x72')](_0x8b2e10['id']);})[_0x563a('0x29')](respondWithResult(_0x4c9ad7,null))['catch'](handleError(_0x4c9ad7,null));};exports['addAgents']=function(_0x4346fe,_0x598a91,_0x46beba){return db[_0x563a('0x4b')][_0x563a('0x53')]({'where':{'id':_0x4346fe[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x598a91,null))[_0x563a('0x29')](function(_0x3f66be){if(_0x3f66be){return _0x3f66be[_0x563a('0x73')](_0x4346fe[_0x563a('0x56')][_0x563a('0x74')],_['omit'](_0x4346fe[_0x563a('0x56')],['ids','id'])||{})[_0x563a('0x75')](function(_0x441933){for(var _0x54c512=0x0;_0x54c512<_0x4346fe[_0x563a('0x56')]['ids'][_0x563a('0x3e')];_0x54c512+=0x1){socket[_0x563a('0x76')]('userVoicePrefix:save',{'UserId':Number(_0x4346fe[_0x563a('0x56')][_0x563a('0x74')][_0x54c512]),'VoicePrefixId':Number(_0x4346fe[_0x563a('0x50')]['id'])});}return _0x441933;});}})[_0x563a('0x29')](respondWithResult(_0x598a91,null))['catch'](handleError(_0x598a91,null));};exports[_0x563a('0x77')]=function(_0x31faef,_0x17000b,_0x3cdfc1){return db[_0x563a('0x4b')][_0x563a('0x53')]({'where':{'id':_0x31faef[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x17000b,null))[_0x563a('0x29')](function(_0x238ae4){if(_0x238ae4){return _0x238ae4['removeAgents'](_0x31faef[_0x563a('0x39')][_0x563a('0x74')])[_0x563a('0x29')](function(){if(_['isArray'](_0x31faef[_0x563a('0x39')][_0x563a('0x74')])){for(var _0x3dc800=0x0;_0x3dc800<_0x31faef[_0x563a('0x39')][_0x563a('0x74')][_0x563a('0x3e')];_0x3dc800+=0x1){socket[_0x563a('0x76')](_0x563a('0x78'),{'UserId':Number(_0x31faef[_0x563a('0x39')][_0x563a('0x74')][_0x3dc800]),'VoicePrefixId':Number(_0x31faef[_0x563a('0x50')]['id'])});}}else{socket[_0x563a('0x76')](_0x563a('0x78'),{'UserId':Number(_0x31faef['query'][_0x563a('0x74')]),'VoicePrefixId':Number(_0x31faef[_0x563a('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x17000b,null))[_0x563a('0x4e')](handleError(_0x17000b,null));};exports[_0x563a('0x79')]=function(_0x1ecca5,_0x162ab6,_0xf3ed04){var _0x44cbb4={};var _0x3a00b8={};var _0x9b753b;var _0x41898f;return db['VoicePrefix'][_0x563a('0x7a')]({'where':{'id':_0x1ecca5[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x162ab6,null))[_0x563a('0x29')](function(_0x4c5547){if(_0x4c5547){_0x9b753b=_0x4c5547;_0x3a00b8['model']=_['keys'](db[_0x563a('0x7b')][_0x563a('0x51')]);_0x3a00b8[_0x563a('0x39')]=_[_0x563a('0x52')](_0x1ecca5[_0x563a('0x39')]);_0x3a00b8[_0x563a('0x3a')]=_[_0x563a('0x3b')](_0x3a00b8[_0x563a('0x37')],_0x3a00b8[_0x563a('0x39')]);_0x44cbb4[_0x563a('0x3c')]=_['intersection'](_0x3a00b8[_0x563a('0x37')],qs[_0x563a('0x3d')](_0x1ecca5[_0x563a('0x39')][_0x563a('0x3d')]));_0x44cbb4[_0x563a('0x3c')]=_0x44cbb4[_0x563a('0x3c')][_0x563a('0x3e')]?_0x44cbb4[_0x563a('0x3c')]:_0x3a00b8[_0x563a('0x37')];_0x44cbb4[_0x563a('0x42')]=qs[_0x563a('0x43')](_0x1ecca5[_0x563a('0x39')][_0x563a('0x43')]);_0x44cbb4['where']=qs[_0x563a('0x3a')](_[_0x563a('0x7c')](_0x1ecca5[_0x563a('0x39')],_0x3a00b8[_0x563a('0x3a')]));if(_0x1ecca5[_0x563a('0x39')][_0x563a('0x45')]){_0x44cbb4[_0x563a('0x44')]=_['merge'](_0x44cbb4[_0x563a('0x44')],{'$or':_[_0x563a('0x38')](_0x44cbb4[_0x563a('0x3c')],function(_0x562120){var _0x1e3b8c={};_0x1e3b8c[_0x562120]={'$like':'%'+_0x1ecca5[_0x563a('0x39')][_0x563a('0x45')]+'%'};return _0x1e3b8c;})});}_0x44cbb4=_[_0x563a('0x46')]({},_0x44cbb4,_0x1ecca5[_0x563a('0x48')]);return _0x9b753b[_0x563a('0x79')](_0x44cbb4);}})['then'](function(_0x2d46f5){if(_0x2d46f5){_0x41898f=_0x2d46f5[_0x563a('0x3e')];if(!_0x1ecca5[_0x563a('0x39')][_0x563a('0x3f')](_0x563a('0x40'))){_0x44cbb4['limit']=qs[_0x563a('0x41')](_0x1ecca5[_0x563a('0x39')][_0x563a('0x41')]);_0x44cbb4[_0x563a('0x21')]=qs['offset'](_0x1ecca5[_0x563a('0x39')][_0x563a('0x21')]);}return _0x9b753b['getAgents'](_0x44cbb4);}})['then'](function(_0x458a21){if(_0x458a21){return _0x458a21?{'count':_0x41898f,'rows':_0x458a21}:null;}})[_0x563a('0x29')](respondWithResult(_0x162ab6,null))[_0x563a('0x4e')](handleError(_0x162ab6,null));};exports[_0x563a('0x7d')]=function(_0x241361,_0x31a58e,_0x1e324a){var _0x38857b={};var _0x43b6a2={};var _0x2385eb;var _0x36fe22;return db['VoicePrefix'][_0x563a('0x7a')]({'where':{'id':_0x241361[_0x563a('0x50')]['id']}})[_0x563a('0x29')](handleEntityNotFound(_0x31a58e,null))['then'](function(_0x1dc77d){if(_0x1dc77d){_0x2385eb=_0x1dc77d;_0x43b6a2[_0x563a('0x37')]=_['keys'](db[_0x563a('0x7e')][_0x563a('0x51')]);_0x43b6a2[_0x563a('0x39')]=_[_0x563a('0x52')](_0x241361[_0x563a('0x39')]);_0x43b6a2[_0x563a('0x3a')]=_[_0x563a('0x3b')](_0x43b6a2[_0x563a('0x37')],_0x43b6a2['query']);_0x38857b[_0x563a('0x3c')]=_[_0x563a('0x3b')](_0x43b6a2[_0x563a('0x37')],qs[_0x563a('0x3d')](_0x241361[_0x563a('0x39')]['fields']));_0x38857b[_0x563a('0x3c')]=_0x38857b['attributes']['length']?_0x38857b[_0x563a('0x3c')]:_0x43b6a2[_0x563a('0x37')];_0x38857b[_0x563a('0x42')]=qs[_0x563a('0x43')](_0x241361['query'][_0x563a('0x43')]);_0x38857b[_0x563a('0x44')]=qs['filters'](_[_0x563a('0x7c')](_0x241361['query'],_0x43b6a2[_0x563a('0x3a')]));if(_0x241361[_0x563a('0x39')][_0x563a('0x45')]){_0x38857b[_0x563a('0x44')]=_[_0x563a('0x46')](_0x38857b[_0x563a('0x44')],{'$or':_[_0x563a('0x38')](_0x38857b[_0x563a('0x3c')],function(_0x372e43){var _0x484953={};_0x484953[_0x372e43]={'$like':'%'+_0x241361[_0x563a('0x39')]['filter']+'%'};return _0x484953;})});}_0x38857b=_['merge']({},_0x38857b,_0x241361[_0x563a('0x48')]);return _0x2385eb[_0x563a('0x7d')](_0x38857b);}})['then'](function(_0x44859c){if(_0x44859c){_0x36fe22=_0x44859c[_0x563a('0x3e')];if(!_0x241361[_0x563a('0x39')][_0x563a('0x3f')](_0x563a('0x40'))){_0x38857b[_0x563a('0x41')]=qs[_0x563a('0x41')](_0x241361[_0x563a('0x39')]['limit']);_0x38857b[_0x563a('0x21')]=qs[_0x563a('0x21')](_0x241361['query'][_0x563a('0x21')]);}return _0x2385eb[_0x563a('0x7d')](_0x38857b);}})['then'](function(_0x38601a){if(_0x38601a){return _0x38601a?{'count':_0x36fe22,'rows':_0x38601a}:null;}})[_0x563a('0x29')](respondWithResult(_0x31a58e,null))[_0x563a('0x4e')](handleError(_0x31a58e,null));};exports['addTeams']=function(_0x10c81e,_0x4928de,_0x95bb77){var _0x33d74b=_0x10c81e[_0x563a('0x56')]['ids'];var _0x2d9810;return db['Team'][_0x563a('0x4c')]({'where':{'id':_0x33d74b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x563a('0x7f'),'attributes':['id',_0x563a('0x31'),_0x563a('0x80'),_0x563a('0x81'),_0x563a('0x82')],'raw':!![]}]})[_0x563a('0x29')](function(_0x2d2cb9){if(_0x2d2cb9){_0x2d9810=_0x2d2cb9;var _0x2c4b52=_[_0x563a('0x83')](_0x2d2cb9,function(_0x5c8df5){var _0x579601=_0x5c8df5[_0x563a('0x2b')]({'plain':!![]});return _0x579601[_0x563a('0x7f')];});return db['VoicePrefix'][_0x563a('0x53')]({'where':{'id':_0x10c81e[_0x563a('0x50')]['id']}})[_0x563a('0x29')](function(_0x1ebdd0){return db[_0x563a('0x84')][_0x563a('0x71')](function(_0x2a3bdd){return _0x1ebdd0['addTeams'](_0x33d74b,{'transaction':_0x2a3bdd})[_0x563a('0x29')](function(){return BPromise[_0x563a('0x85')](_0x2d9810,function(_0x28bbe5){return db[_0x563a('0x86')]['upsert']({'TeamId':_0x28bbe5['id'],'VoicePrefixId':_0x10c81e[_0x563a('0x50')]['id']},{'transaction':_0x2a3bdd});});})[_0x563a('0x29')](function(){return BPromise[_0x563a('0x85')](_0x2c4b52,function(_0x150fd6){return db[_0x563a('0x87')][_0x563a('0x88')]({'where':{'UserId':_0x150fd6['id'],'VoicePrefixId':_0x10c81e[_0x563a('0x50')]['id']},'transaction':_0x2a3bdd});});})[_0x563a('0x29')](function(){_0x2c4b52[_0x563a('0x89')](function(_0x3f78b7){socket[_0x563a('0x76')](_0x563a('0x8a'),{'UserId':_0x3f78b7['id'],'VoicePrefixId':_0x1ebdd0['id']});});});});});}})[_0x563a('0x29')](respondWithStatusCode(_0x4928de,null))[_0x563a('0x4e')](handleError(_0x4928de,null));};exports[_0x563a('0x8b')]=function(_0x115188,_0x713637,_0x12bb1b){return db[_0x563a('0x7e')][_0x563a('0x4c')]({'where':{'id':_0x115188[_0x563a('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0x563a('0x7b')],'as':_0x563a('0x7f'),'attributes':['id'],'raw':!![]}]})[_0x563a('0x29')](handleEntityNotFound(_0x713637,null))[_0x563a('0x29')](function(_0xb9cbc9){var _0x42831f=_[_0x563a('0x38')](_0xb9cbc9,'id');var _0x5385e0=[];var _0x1d0ed4=[];var _0x14bc9e=squel[_0x563a('0x8c')]();_0x14bc9e[_0x563a('0x8d')](_0x563a('0x8e'))['from'](_0x563a('0x8f'),'tq')['join'](_0x563a('0x90'),'ut',_0x563a('0x91'))[_0x563a('0x44')]('VoicePrefixId\x20=\x20?',_0x115188[_0x563a('0x50')]['id']);for(var _0x25e5d1=0x0;_0x25e5d1<_0xb9cbc9[_0x563a('0x3e')];_0x25e5d1+=0x1){let _0x5ba698=_0xb9cbc9[_0x25e5d1];for(var _0x2dadc1=0x0;_0x2dadc1<_0x5ba698[_0x563a('0x7f')]['length'];_0x2dadc1+=0x1){let _0x55f64e=_0x5ba698[_0x563a('0x7f')][_0x2dadc1];var _0x41d0df=_0x14bc9e['clone']();_0x41d0df['where'](_0x563a('0x92'),_0x55f64e['id']);_0x1d0ed4['push'](db[_0x563a('0x84')][_0x563a('0x39')](_0x41d0df[_0x563a('0x93')](),{'type':db[_0x563a('0x84')][_0x563a('0x94')][_0x563a('0x95')]})[_0x563a('0x29')](function(_0xc24817){if(_0xc24817[_0x563a('0x3e')]===0x1){return _0x55f64e['id'];}else{var _0xd04cd=_[_0x563a('0x96')](_['map'](_0xc24817,'TeamId'),function(_0x571a84){return _[_0x563a('0x97')](_0x42831f,_0x571a84);});if(_0xd04cd){return _0x55f64e['id'];}}}));}}return BPromise[_0x563a('0x98')](_0x1d0ed4)[_0x563a('0x29')](function(_0x5244e5){_0x5385e0=_(_0x5385e0)['union'](_0x5244e5)[_0x563a('0x99')]()[_0x563a('0x9a')]();return db[_0x563a('0x4b')][_0x563a('0x53')]({'where':{'id':_0x115188[_0x563a('0x50')]['id']}})[_0x563a('0x29')](function(_0x23e33f){return db['sequelize'][_0x563a('0x71')](function(_0x25049d){return _0x23e33f[_0x563a('0x8b')](_0x115188[_0x563a('0x39')][_0x563a('0x74')],{'transaction':_0x25049d})[_0x563a('0x29')](function(){if(!_[_0x563a('0x9b')](_0x5385e0)){return _0x23e33f[_0x563a('0x77')](_0x5385e0,{'transaction':_0x25049d});}})[_0x563a('0x29')](function(){_0x5385e0[_0x563a('0x89')](function(_0x482d21){socket[_0x563a('0x76')]('userVoicePrefix:remove',{'UserId':_0x482d21,'VoicePrefixId':_0x23e33f['id']});});});});});});})[_0x563a('0x29')](respondWithStatusCode(_0x713637,null))[_0x563a('0x4e')](handleError(_0x713637,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 2e974cf..f0c2364 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 _0x5934=['VoicePrefix','setMaxListeners','save','emit','exports','events'];(function(_0x16a223,_0x31b6e8){var _0x5ded66=function(_0x25eb5f){while(--_0x25eb5f){_0x16a223['push'](_0x16a223['shift']());}};_0x5ded66(++_0x31b6e8);}(_0x5934,0x18b));var _0x4593=function(_0x364910,_0x4299e5){_0x364910=_0x364910-0x0;var _0x12d39b=_0x5934[_0x364910];return _0x12d39b;};'use strict';var EventEmitter=require(_0x4593('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x4593('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x4593('0x2')](0x0);var events={'afterCreate':_0x4593('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5c8de9){return function(_0x1f8957,_0xc80cc,_0x2df730){VoicePrefixEvents[_0x4593('0x4')](_0x5c8de9+':'+_0x1f8957['id'],_0x1f8957);VoicePrefixEvents[_0x4593('0x4')](_0x5c8de9,_0x1f8957);_0x2df730(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x4593('0x5')]=VoicePrefixEvents; \ No newline at end of file +var _0x1594=['emit','hasOwnProperty','hook','exports','events','VoicePrefix','setMaxListeners','remove'];(function(_0x382285,_0x1e4f54){var _0x5a5b70=function(_0x55dfd6){while(--_0x55dfd6){_0x382285['push'](_0x382285['shift']());}};_0x5a5b70(++_0x1e4f54);}(_0x1594,0x184));var _0x4159=function(_0x5cf942,_0x529414){_0x5cf942=_0x5cf942-0x0;var _0x425e71=_0x1594[_0x5cf942];return _0x425e71;};'use strict';var EventEmitter=require(_0x4159('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x4159('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x4159('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4159('0x3')};function emitEvent(_0x16e2b1){return function(_0xbdd64c,_0x6edda0,_0x11fa1b){VoicePrefixEvents[_0x4159('0x4')](_0x16e2b1+':'+_0xbdd64c['id'],_0xbdd64c);VoicePrefixEvents[_0x4159('0x4')](_0x16e2b1,_0xbdd64c);_0x11fa1b(null);};}for(var e in events){if(events[_0x4159('0x5')](e)){var event=events[e];VoicePrefix[_0x4159('0x6')](e,emitEvent(event));}}module[_0x4159('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 3f29a6b..d1b3b96 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 _0x2b70=['moment','bluebird','request-promise','path','../../config/environment','exports','VoicePrefix','voice_prefixes','lodash','../../config/logger'];(function(_0x3d2461,_0x32335c){var _0x577aec=function(_0x53acfe){while(--_0x53acfe){_0x3d2461['push'](_0x3d2461['shift']());}};_0x577aec(++_0x32335c);}(_0x2b70,0x18e));var _0x02b7=function(_0x4c66e0,_0x2a6d3b){_0x4c66e0=_0x4c66e0-0x0;var _0x58e2dc=_0x2b70[_0x4c66e0];return _0x58e2dc;};'use strict';var _=require(_0x02b7('0x0'));var util=require('util');var logger=require(_0x02b7('0x1'))('api');var moment=require(_0x02b7('0x2'));var BPromise=require(_0x02b7('0x3'));var rp=require(_0x02b7('0x4'));var fs=require('fs');var path=require(_0x02b7('0x5'));var rimraf=require('rimraf');var config=require(_0x02b7('0x6'));var attributes=require('./voicePrefix.attributes');module[_0x02b7('0x7')]=function(_0x299e61,_0x39fac9){return _0x299e61['define'](_0x02b7('0x8'),attributes,{'tableName':_0x02b7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f5a=['voice_prefixes','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','define','VoicePrefix'];(function(_0x20852f,_0x224a17){var _0x18abb7=function(_0x2f5299){while(--_0x2f5299){_0x20852f['push'](_0x20852f['shift']());}};_0x18abb7(++_0x224a17);}(_0x9f5a,0x109));var _0xa9f5=function(_0x56fb92,_0x519dda){_0x56fb92=_0x56fb92-0x0;var _0xa9defa=_0x9f5a[_0x56fb92];return _0xa9defa;};'use strict';var _=require(_0xa9f5('0x0'));var util=require(_0xa9f5('0x1'));var logger=require(_0xa9f5('0x2'))('api');var moment=require(_0xa9f5('0x3'));var BPromise=require(_0xa9f5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa9f5('0x5'));var rimraf=require(_0xa9f5('0x6'));var config=require(_0xa9f5('0x7'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x269c94,_0x3e29d7){return _0x269c94[_0xa9f5('0x8')](_0xa9f5('0x9'),attributes,{'tableName':_0xa9f5('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 cd2188c..16945c5 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 _0x3fc6=['request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s'];(function(_0x56553a,_0x458912){var _0x408e7e=function(_0x50b67b){while(--_0x50b67b){_0x56553a['push'](_0x56553a['shift']());}};_0x408e7e(++_0x458912);}(_0x3fc6,0x115));var _0x63fc=function(_0x5bf3c6,_0x317114){_0x5bf3c6=_0x5bf3c6-0x0;var _0x53f9a8=_0x3fc6[_0x5bf3c6];return _0x53f9a8;};'use strict';var _=require(_0x63fc('0x0'));var util=require('util');var moment=require(_0x63fc('0x1'));var BPromise=require(_0x63fc('0x2'));var rs=require(_0x63fc('0x3'));var fs=require('fs');var Redis=require(_0x63fc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x63fc('0x5'));var logger=require(_0x63fc('0x6'))(_0x63fc('0x7'));var config=require('../../config/environment');var jayson=require(_0x63fc('0x8'));var client=jayson['client'][_0x63fc('0x9')]({'port':0x232a});config[_0x63fc('0xa')]=_[_0x63fc('0xb')](config['redis'],{'host':_0x63fc('0xc'),'port':0x18eb});var socket=require(_0x63fc('0xd'))(new Redis(config[_0x63fc('0xa')]));require(_0x63fc('0xe'))[_0x63fc('0xf')](socket);function respondWithRpcPromise(_0x5f328c,_0x319f1e,_0x544f22){return new BPromise(function(_0x5ad9a0,_0x6b8e8f){return client[_0x63fc('0x10')](_0x5f328c,_0x544f22)[_0x63fc('0x11')](function(_0x4445ba){logger[_0x63fc('0x12')](_0x63fc('0x13'),_0x319f1e,_0x63fc('0x14'));logger[_0x63fc('0x15')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x319f1e,_0x63fc('0x14'),JSON[_0x63fc('0x16')](_0x4445ba));if(_0x4445ba[_0x63fc('0x17')]){if(_0x4445ba['error'][_0x63fc('0x18')]===0x1f4){logger[_0x63fc('0x17')](_0x63fc('0x13'),_0x319f1e,_0x4445ba['error'][_0x63fc('0x19')]);return _0x6b8e8f(_0x4445ba[_0x63fc('0x17')][_0x63fc('0x19')]);}logger[_0x63fc('0x17')](_0x63fc('0x13'),_0x319f1e,_0x4445ba[_0x63fc('0x17')][_0x63fc('0x19')]);return _0x5ad9a0(_0x4445ba[_0x63fc('0x17')][_0x63fc('0x19')]);}else{logger[_0x63fc('0x12')](_0x63fc('0x13'),_0x319f1e,_0x63fc('0x14'));_0x5ad9a0(_0x4445ba[_0x63fc('0x1a')][_0x63fc('0x19')]);}})['catch'](function(_0x225c93){logger[_0x63fc('0x17')](_0x63fc('0x13'),_0x319f1e,_0x225c93);_0x6b8e8f(_0x225c93);});});} \ No newline at end of file +var _0x2af8=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x29120c,_0x1c80f9){var _0x80a193=function(_0x2ff66e){while(--_0x2ff66e){_0x29120c['push'](_0x29120c['shift']());}};_0x80a193(++_0x1c80f9);}(_0x2af8,0xf6));var _0x82af=function(_0x12bada,_0xcc257d){_0x12bada=_0x12bada-0x0;var _0x479493=_0x2af8[_0x12bada];return _0x479493;};'use strict';var _=require(_0x82af('0x0'));var util=require('util');var moment=require(_0x82af('0x1'));var BPromise=require(_0x82af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x82af('0x3'));var db=require(_0x82af('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x82af('0x5'))('rpc');var config=require(_0x82af('0x6'));var jayson=require(_0x82af('0x7'));var client=jayson['client'][_0x82af('0x8')]({'port':0x232a});config[_0x82af('0x9')]=_['defaults'](config[_0x82af('0x9')],{'host':_0x82af('0xa'),'port':0x18eb});var socket=require(_0x82af('0xb'))(new Redis(config[_0x82af('0x9')]));require(_0x82af('0xc'))[_0x82af('0xd')](socket);function respondWithRpcPromise(_0x1dbaff,_0x46fe4b,_0x41451a){return new BPromise(function(_0xd5ecc8,_0x459bf0){return client[_0x82af('0xe')](_0x1dbaff,_0x41451a)[_0x82af('0xf')](function(_0x1dedf2){logger[_0x82af('0x10')](_0x82af('0x11'),_0x46fe4b,_0x82af('0x12'));logger[_0x82af('0x13')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x46fe4b,'request\x20sent',JSON[_0x82af('0x14')](_0x1dedf2));if(_0x1dedf2[_0x82af('0x15')]){if(_0x1dedf2[_0x82af('0x15')]['code']===0x1f4){logger[_0x82af('0x15')](_0x82af('0x11'),_0x46fe4b,_0x1dedf2[_0x82af('0x15')][_0x82af('0x16')]);return _0x459bf0(_0x1dedf2['error'][_0x82af('0x16')]);}logger[_0x82af('0x15')](_0x82af('0x11'),_0x46fe4b,_0x1dedf2[_0x82af('0x15')][_0x82af('0x16')]);return _0xd5ecc8(_0x1dedf2[_0x82af('0x15')][_0x82af('0x16')]);}else{logger[_0x82af('0x10')](_0x82af('0x11'),_0x46fe4b,_0x82af('0x12'));_0xd5ecc8(_0x1dedf2[_0x82af('0x17')][_0x82af('0x16')]);}})[_0x82af('0x18')](function(_0x5be05a){logger[_0x82af('0x15')](_0x82af('0x11'),_0x46fe4b,_0x5be05a);_0x459bf0(_0x5be05a);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index c4a7841..6861aa3 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 _0xf45e=['removeListener','register','length','voicePrefix:','./voicePrefix.events','remove','emit'];(function(_0x3f4bef,_0x405c78){var _0xc16c1e=function(_0x4520db){while(--_0x4520db){_0x3f4bef['push'](_0x3f4bef['shift']());}};_0xc16c1e(++_0x405c78);}(_0xf45e,0x115));var _0xef45=function(_0x43d5bb,_0x1d1595){_0x43d5bb=_0x43d5bb-0x0;var _0x2a3c02=_0xf45e[_0x43d5bb];return _0x2a3c02;};'use strict';var VoicePrefixEvents=require(_0xef45('0x0'));var events=['save',_0xef45('0x1'),'update'];function createListener(_0x17b897,_0x4140b2){return function(_0x1cd055){_0x4140b2[_0xef45('0x2')](_0x17b897,_0x1cd055);};}function removeListener(_0x37772f,_0x8b048c){return function(){VoicePrefixEvents[_0xef45('0x3')](_0x37772f,_0x8b048c);};}exports[_0xef45('0x4')]=function(_0x338960){for(var _0x315b84=0x0,_0x2f2e92=events[_0xef45('0x5')];_0x315b84<_0x2f2e92;_0x315b84++){var _0x1a68c4=events[_0x315b84];var _0x1e0def=createListener(_0xef45('0x6')+_0x1a68c4,_0x338960);VoicePrefixEvents['on'](_0x1a68c4,_0x1e0def);}}; \ No newline at end of file +var _0x9173=['removeListener','register','length','voicePrefix:','./voicePrefix.events','save','update','emit'];(function(_0x2f5e81,_0x49c319){var _0x5e4f0e=function(_0x3343d8){while(--_0x3343d8){_0x2f5e81['push'](_0x2f5e81['shift']());}};_0x5e4f0e(++_0x49c319);}(_0x9173,0xb4));var _0x3917=function(_0xc8a897,_0x5830fa){_0xc8a897=_0xc8a897-0x0;var _0x26a589=_0x9173[_0xc8a897];return _0x26a589;};'use strict';var VoicePrefixEvents=require(_0x3917('0x0'));var events=[_0x3917('0x1'),'remove',_0x3917('0x2')];function createListener(_0x30989e,_0x282f74){return function(_0x5df798){_0x282f74[_0x3917('0x3')](_0x30989e,_0x5df798);};}function removeListener(_0x5e0739,_0xb4eb06){return function(){VoicePrefixEvents[_0x3917('0x4')](_0x5e0739,_0xb4eb06);};}exports[_0x3917('0x5')]=function(_0x403e03){for(var _0x2dace9=0x0,_0x48d592=events[_0x3917('0x6')];_0x2dace9<_0x48d592;_0x2dace9++){var _0x27f513=events[_0x2dace9];var _0x11267b=createListener(_0x3917('0x7')+_0x27f513,_0x403e03);VoicePrefixEvents['on'](_0x27f513,_0x11267b);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 1dcb4e5..521ffe9 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x2609f8,_0x378553){var _0x2c39e0=function(_0x19d406){while(--_0x19d406){_0x2609f8['push'](_0x2609f8['shift']());}};_0x2c39e0(++_0x378553);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x5582f7,_0x422b0f){var _0x56e6d6=function(_0x355318){while(--_0x355318){_0x5582f7['push'](_0x5582f7['shift']());}};_0x56e6d6(++_0x422b0f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 0392620..bc81e1a 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 _0x9e8f=['INTEGER','yes','once','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','never','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#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)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','sequelize','exports','STRING','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','includes'];(function(_0x44cf25,_0x2769a8){var _0x210250=function(_0x18237d){while(--_0x18237d){_0x44cf25['push'](_0x44cf25['shift']());}};_0x210250(++_0x2769a8);}(_0x9e8f,0x123));var _0xf9e8=function(_0x5f962b,_0x42ae8a){_0x5f962b=_0x5f962b-0x0;var _0x35796f=_0x9e8f[_0x5f962b];return _0x35796f;};'use strict';var Sequelize=require(_0xf9e8('0x0'));module[_0xf9e8('0x1')]={'name':{'type':Sequelize[_0xf9e8('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf9e8('0x3')](_0xf9e8('0x4'),_0xf9e8('0x5')),'allowNull':![],'defaultValue':_0xf9e8('0x4')},'musiconhold':{'type':Sequelize[_0xf9e8('0x2')],'defaultValue':_0xf9e8('0x6')},'announce':{'type':Sequelize[_0xf9e8('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xf9e8('0x3')]('rr',_0xf9e8('0x7'),_0xf9e8('0x8'),_0xf9e8('0x9'),_0xf9e8('0xa'),_0xf9e8('0xb'),_0xf9e8('0xc'),_0xf9e8('0xd'),_0xf9e8('0xe')),'allowNull':![],'defaultValue':'ringall','set':function(_0x53a75e){this[_0xf9e8('0xf')](_0xf9e8('0x10'),_0x53a75e?_0x53a75e:_0xf9e8('0xb'));},'get':function(){var _0x35b4a6=this[_0xf9e8('0x11')](_0xf9e8('0x12'));var _0x1fece7=this[_0xf9e8('0x11')](_0xf9e8('0x13'));var _0x4630cb=this[_0xf9e8('0x11')](_0xf9e8('0x10'));if(_0x35b4a6==='outbound'){if(_0x1fece7==='preview'){return null;}if(_0x1fece7==='booked'&&![_0xf9e8('0xb'),'roundrobin'][_0xf9e8('0x14')](_0x4630cb)){this[_0xf9e8('0xf')](_0xf9e8('0x10'),_0xf9e8('0xb'));}}return _0x4630cb;}},'servicelevel':{'type':Sequelize[_0xf9e8('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xf9e8('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xf9e8('0x15')](0xb)},'timeout':{'type':Sequelize[_0xf9e8('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xf9e8('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xf9e8('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xf9e8('0x3')](_0xf9e8('0x16'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xf9e8('0x3')](_0xf9e8('0x16'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xf9e8('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0xf9e8('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xf9e8('0x3')](_0xf9e8('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xf9e8('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xf9e8('0x3')](_0xf9e8('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xf9e8('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xf9e8('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xf9e8('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xf9e8('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xf9e8('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xf9e8('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xf9e8('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xf9e8('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xf9e8('0x3')](_0xf9e8('0x16'),'no'),'defaultValue':_0xf9e8('0x16')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xf9e8('0x16'),'no',_0xf9e8('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xf9e8('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xf9e8('0x3')](_0xf9e8('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0xf9e8('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xf9e8('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xf9e8('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xf9e8('0x2')]},'queue_youarenext':{'type':Sequelize[_0xf9e8('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xf9e8('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xf9e8('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xf9e8('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xf9e8('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xf9e8('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xf9e8('0x2')]},'queue_quantity1':{'type':Sequelize[_0xf9e8('0x2')]},'queue_quantity2':{'type':Sequelize[_0xf9e8('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xf9e8('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xf9e8('0x18')],'set':function(_0x27a01f){this[_0xf9e8('0xf')](_0xf9e8('0x19'),_0x27a01f?_0x27a01f[_0xf9e8('0x1a')](','):[]);},'get':function(){return this[_0xf9e8('0x11')]('periodic_announce')?this['getDataValue'](_0xf9e8('0x19'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xf9e8('0x2')],'defaultValue':'yes','set':function(_0x5d44b5){this[_0xf9e8('0xf')]('joinempty',_0x5d44b5?_0x5d44b5[_0xf9e8('0x1a')](','):undefined);},'get':function(){return this['getDataValue'](_0xf9e8('0x1b'))?this['getDataValue']('joinempty')[_0xf9e8('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xf9e8('0x2')],'defaultValue':'no','set':function(_0x2340b9){this['setDataValue'](_0xf9e8('0x1d'),_0x2340b9?_0x2340b9[_0xf9e8('0x1a')](','):undefined);},'get':function(){return this[_0xf9e8('0x11')]('leavewhenempty')?this[_0xf9e8('0x11')](_0xf9e8('0x1d'))[_0xf9e8('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0xf9e8('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xf9e8('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xf9e8('0x3')](_0xf9e8('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xf9e8('0x2')]},'description':{'type':Sequelize[_0xf9e8('0x2')]},'acw':{'type':Sequelize[_0xf9e8('0x1e')],'defaultValue':0x0,'set':function(_0x20669a){this[_0xf9e8('0xf')](_0xf9e8('0x1f'),_0x20669a);if(_0x20669a){if(this[_0xf9e8('0x11')](_0xf9e8('0x20'))<0x2){this[_0xf9e8('0xf')](_0xf9e8('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xf9e8('0x1e')],'defaultValue':0x0,'comment':_0xf9e8('0x21')},'dialMethod':{'type':Sequelize['ENUM'](_0xf9e8('0x22'),_0xf9e8('0x23'),_0xf9e8('0x24'),_0xf9e8('0x25'),'booked'),'defaultValue':'progressive','comment':_0xf9e8('0x26')},'dialLimitChannel':{'type':Sequelize[_0xf9e8('0x15')](0x4)[_0xf9e8('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xf9e8('0x15')](0x4)[_0xf9e8('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xf9e8('0x28')},'dialPowerLevel':{'type':Sequelize[_0xf9e8('0x29')](0x2)[_0xf9e8('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xf9e8('0x2a'),'dropRate'),'defaultValue':_0xf9e8('0x2b'),'comment':_0xf9e8('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xf9e8('0x29')](0x2)[_0xf9e8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xf9e8('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0xf9e8('0x15')](0x3)[_0xf9e8('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xf9e8('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xf9e8('0x15')](0x3)[_0xf9e8('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf9e8('0x2f')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0xf9e8('0x30')},'dialQueueTimeout':{'type':Sequelize[_0xf9e8('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0xf9e8('0x2')],'comment':_0xf9e8('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0xf9e8('0x15')](0x3)[_0xf9e8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf9e8('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf9e8('0x15')](0x5)[_0xf9e8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf9e8('0x33')},'dialBusyMaxRetry':{'type':Sequelize[_0xf9e8('0x15')](0x3)[_0xf9e8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf9e8('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0xf9e8('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf9e8('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xf9e8('0x15')](0x3)[_0xf9e8('0x27')],'defaultValue':0x3,'comment':_0xf9e8('0x36')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf9e8('0x15')](0x5)[_0xf9e8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf9e8('0x37')},'dialGlobalMaxRetry':{'type':Sequelize[_0xf9e8('0x15')](0x3)[_0xf9e8('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xf9e8('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xf9e8('0x2')],'defaultValue':_0xf9e8('0x38')},'dialPrefix':{'type':Sequelize[_0xf9e8('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xf9e8('0x3')]('always',_0xf9e8('0x39'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xf9e8('0x1e')],'defaultValue':0x0,'comment':_0xf9e8('0x3a')},'dialAMDInitialSilence':{'type':Sequelize[_0xf9e8('0x15')](0x9)[_0xf9e8('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xf9e8('0x15')](0x9)[_0xf9e8('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xf9e8('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xf9e8('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf9e8('0x15')](0x9)[_0xf9e8('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf9e8('0x3c')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xf9e8('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xf9e8('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xf9e8('0x15')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xf9e8('0x15')](0x9)[_0xf9e8('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xf9e8('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xf9e8('0x15')](0x5)[_0xf9e8('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xf9e8('0x15')](0x9)[_0xf9e8('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf9e8('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0xf9e8('0x15')](0x5)[_0xf9e8('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xf9e8('0x40')},'dialRecallInQueue':{'type':Sequelize[_0xf9e8('0x1e')],'defaultValue':0x0,'comment':_0xf9e8('0x41')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xf9e8('0x42'),'ASC'),'defaultValue':_0xf9e8('0x42')},'dialQueueProject2':{'type':Sequelize[_0xf9e8('0x2')],'comment':_0xf9e8('0x31')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xf9e8('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xf9e8('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xf9e8('0x15')](0x3)[_0xf9e8('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf9e8('0x43')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf9e8('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xf9e8('0x15')](0x3)[_0xf9e8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf9e8('0x45')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xf9e8('0x15')](0x5)[_0xf9e8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xf9e8('0x15')](0x3)[_0xf9e8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xf9e8('0x15')](0x5)[_0xf9e8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf9e8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf9e8('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf9e8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf9e8('0x47')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf9e8('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf9e8('0x48')},'dialMachineRetryFrequency':{'type':Sequelize[_0xf9e8('0x15')](0x5)[_0xf9e8('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf9e8('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xf9e8('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf9e8('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xf9e8('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf9e8('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf9e8('0x15')],'allowNull':!![],'comment':_0xf9e8('0x4c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf9e8('0x4d'),'set':function(_0x5849ac){if(!_0x5849ac)this[_0xf9e8('0xf')]('mandatoryDispositionPauseId',null);this[_0xf9e8('0xf')]('mandatoryDisposition',_0x5849ac);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xf9e8('0x15')](0x3)[_0xf9e8('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xf9e8('0x15')](0x3)[_0xf9e8('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xf9e8('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xf9e8('0x1e')],'defaultValue':![]}}; \ No newline at end of file +var _0xceb0=['Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','ENUM','inbound','outbound','default','fewestcalls','random','rrmemory','linear','wrandom','strategy','getDataValue','booked','roundrobin','includes','INTEGER','yes','all','once','TEXT','join','periodic_announce','setDataValue','joinempty','split','leavewhenempty','BOOLEAN','acw','Active/Disactive\x20Campaign','preview','progressive','power','predictive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','UNSIGNED'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xceb0,0xc8));var _0x0ceb=function(_0x490faf,_0x3205ce){_0x490faf=_0x490faf-0x0;var _0x1358f9=_0xceb0[_0x490faf];return _0x1358f9;};'use strict';var Sequelize=require(_0x0ceb('0x0'));module[_0x0ceb('0x1')]={'name':{'type':Sequelize[_0x0ceb('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x0ceb('0x3')](_0x0ceb('0x4'),_0x0ceb('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':_0x0ceb('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x0ceb('0x3')]('rr','ringall','leastrecent',_0x0ceb('0x7'),_0x0ceb('0x8'),_0x0ceb('0x9'),_0x0ceb('0xa'),_0x0ceb('0xb'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x10cd7f){this['setDataValue'](_0x0ceb('0xc'),_0x10cd7f?_0x10cd7f:'rrmemory');},'get':function(){var _0x40990a=this['getDataValue']('type');var _0x43b3c9=this['getDataValue']('dialMethod');var _0x4aed8a=this[_0x0ceb('0xd')](_0x0ceb('0xc'));if(_0x40990a===_0x0ceb('0x5')){if(_0x43b3c9==='preview'){return null;}if(_0x43b3c9===_0x0ceb('0xe')&&![_0x0ceb('0x9'),_0x0ceb('0xf')][_0x0ceb('0x10')](_0x4aed8a)){this['setDataValue'](_0x0ceb('0xc'),_0x0ceb('0x9'));}}return _0x4aed8a;}},'servicelevel':{'type':Sequelize[_0x0ceb('0x11')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x0ceb('0x11')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x0ceb('0x11')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0ceb('0x3')](_0x0ceb('0x12'),'no'),'defaultValue':_0x0ceb('0x12')},'autopause':{'type':Sequelize[_0x0ceb('0x3')]('yes','no',_0x0ceb('0x13')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x0ceb('0x3')](_0x0ceb('0x12'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0ceb('0x3')](_0x0ceb('0x12'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0ceb('0x11')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0ceb('0x3')](_0x0ceb('0x12'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x0ceb('0x12'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x0ceb('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0ceb('0x3')](_0x0ceb('0x12'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0ceb('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x0ceb('0x11')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0ceb('0x11')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0ceb('0x11')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0ceb('0x3')](_0x0ceb('0x12'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x0ceb('0x3')]('yes','no'),'defaultValue':_0x0ceb('0x12')},'announce_holdtime':{'type':Sequelize[_0x0ceb('0x3')](_0x0ceb('0x12'),'no',_0x0ceb('0x14')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x0ceb('0x12'),'no')},'announce_position_limit':{'type':Sequelize[_0x0ceb('0x11')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0ceb('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0ceb('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0ceb('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0ceb('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0ceb('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0ceb('0x2')]},'queue_less_than':{'type':Sequelize[_0x0ceb('0x2')]},'periodic_announce':{'type':Sequelize[_0x0ceb('0x15')],'set':function(_0x2fe819){this['setDataValue']('periodic_announce',_0x2fe819?_0x2fe819[_0x0ceb('0x16')](','):[]);},'get':function(){return this[_0x0ceb('0xd')](_0x0ceb('0x17'))?this['getDataValue'](_0x0ceb('0x17'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':'yes','set':function(_0x545a56){this[_0x0ceb('0x18')]('joinempty',_0x545a56?_0x545a56['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x0ceb('0x19'))?this[_0x0ceb('0xd')](_0x0ceb('0x19'))[_0x0ceb('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':'no','set':function(_0x301fbc){this[_0x0ceb('0x18')](_0x0ceb('0x1b'),_0x301fbc?_0x301fbc[_0x0ceb('0x16')](','):undefined);},'get':function(){return this[_0x0ceb('0xd')](_0x0ceb('0x1b'))?this[_0x0ceb('0xd')](_0x0ceb('0x1b'))[_0x0ceb('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0ceb('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0ceb('0x12'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0ceb('0x3')](_0x0ceb('0x12'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0ceb('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x0ceb('0x1c')],'defaultValue':0x0,'set':function(_0x3c87f1){this[_0x0ceb('0x18')](_0x0ceb('0x1d'),_0x3c87f1);if(_0x3c87f1){if(this['getDataValue']('wrapuptime')<0x2){this[_0x0ceb('0x18')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x0ceb('0x11')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0ceb('0x1c')],'defaultValue':0x0,'comment':_0x0ceb('0x1e')},'dialMethod':{'type':Sequelize[_0x0ceb('0x3')](_0x0ceb('0x1f'),_0x0ceb('0x20'),_0x0ceb('0x21'),_0x0ceb('0x22'),_0x0ceb('0xe')),'defaultValue':_0x0ceb('0x20'),'comment':_0x0ceb('0x23')},'dialLimitChannel':{'type':Sequelize[_0x0ceb('0x11')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0ceb('0x24')},'dialLimitQueue':{'type':Sequelize[_0x0ceb('0x11')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0ceb('0x25')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0ceb('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0x0ceb('0x3')]('agentBusyFactor','dropRate'),'defaultValue':_0x0ceb('0x27'),'comment':_0x0ceb('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0ceb('0x29')](0x2)[_0x0ceb('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0ceb('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x0ceb('0x11')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0ceb('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0ceb('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ceb('0x2c')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x0ceb('0x2d'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x0ceb('0x11')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ceb('0x2e')},'dialQueueProject':{'type':Sequelize[_0x0ceb('0x2')],'comment':_0x0ceb('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0ceb('0x11')](0x3)[_0x0ceb('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ceb('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0ceb('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x0ceb('0x11')](0x3)[_0x0ceb('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x0ceb('0x11')](0x5)[_0x0ceb('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ceb('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0ceb('0x11')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x0ceb('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ceb('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0ceb('0x11')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0ceb('0x34')},'dialTimezone':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':_0x0ceb('0x35')},'dialPrefix':{'type':Sequelize[_0x0ceb('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x0ceb('0x3')](_0x0ceb('0x36'),_0x0ceb('0x37'),_0x0ceb('0x38')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x0ceb('0x1c')],'defaultValue':0x0,'comment':_0x0ceb('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x0ceb('0x11')](0x9)[_0x0ceb('0x2a')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0ceb('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x0ceb('0x2a')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0ceb('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0ceb('0x11')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0ceb('0x11')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0ceb('0x3c')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0ceb('0x2a')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0ceb('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0ceb('0x11')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0ceb('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0ceb('0x11')](0x9)[_0x0ceb('0x2a')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0ceb('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0ceb('0x11')](0x5)[_0x0ceb('0x2a')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0ceb('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0ceb('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0x0ceb('0x11')](0x5)[_0x0ceb('0x2a')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0ceb('0x42')},'dialRecallInQueue':{'type':Sequelize[_0x0ceb('0x1c')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x0ceb('0x3')]('DESC',_0x0ceb('0x43')),'defaultValue':_0x0ceb('0x44')},'dialQueueProject2':{'type':Sequelize[_0x0ceb('0x2')],'comment':_0x0ceb('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0ceb('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0ceb('0x11')](0x3)[_0x0ceb('0x2a')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0ceb('0x45')},'dialCutDigit':{'type':Sequelize[_0x0ceb('0x11')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0ceb('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0ceb('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ceb('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0x0ceb('0x11')](0x3)[_0x0ceb('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ceb('0x48')},'dialDropRetryFrequency':{'type':Sequelize[_0x0ceb('0x11')](0x5)[_0x0ceb('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ceb('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0ceb('0x11')](0x3)[_0x0ceb('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0ceb('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ceb('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0x0ceb('0x11')](0x3)[_0x0ceb('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ceb('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0ceb('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ceb('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0ceb('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ceb('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0ceb('0x11')](0x5)[_0x0ceb('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0ceb('0x11')],'allowNull':!![],'comment':_0x0ceb('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0x0ceb('0x1c')],'defaultValue':![],'comment':_0x0ceb('0x4f'),'set':function(_0x4a8513){if(!_0x4a8513)this[_0x0ceb('0x18')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x0ceb('0x50'),_0x4a8513);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0ceb('0x2a')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x0ceb('0x11')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x0ceb('0x2a')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index f60389a..4f99a36 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 _0x4b84=['type','find','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','findAll','rows','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','findOne','hasOwnProperty','nolimit','order','sort','VoiceQueueId','CmHopper','getHopperHistories','pick','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','User','Agents','voicePause','interface','forEach','penalty','transaction','TeamVoiceQueue','each','UserVoiceQueue','UserVoiceQueueRt','upsert','format','SIP/%s','emit','ids','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','TeamId','all','removeTeams','isEmpty','removeAgents','addAgents','spread','userVoiceQueue:save','online','isNil','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','fromQuery','phone','scheduledAt','ContactId','ListId','select','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','into','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','NOW()','removeBlackLists','moment','bluebird','squel','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./voiceQueue.socket','sendStatus','end','status','json','undefined','count','offset','limit','update','destroy','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b84,0x1cc));var _0x44b8=function(_0x567bcb,_0x4978c1){_0x567bcb=_0x567bcb-0x0;var _0x4eebc2=_0x4b84[_0x567bcb];return _0x4eebc2;};'use strict';var moment=require(_0x44b8('0x0'));var BPromise=require(_0x44b8('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0x44b8('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x44b8('0x3'))(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x44b8('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x44b8('0x7'))(new Redis(config['redis']));require(_0x44b8('0x8'))['register'](socket);function respondWithStatusCode(_0x5034b6,_0x41d515){_0x41d515=_0x41d515||0xcc;return function(_0x42319d){if(_0x42319d){return _0x5034b6[_0x44b8('0x9')](_0x41d515);}return _0x5034b6['status'](_0x41d515)[_0x44b8('0xa')]();};}function respondWithResult(_0x2cc74b,_0x4315f6){_0x4315f6=_0x4315f6||0xc8;return function(_0x9b6048){if(_0x9b6048){return _0x2cc74b[_0x44b8('0xb')](_0x4315f6)[_0x44b8('0xc')](_0x9b6048);}};}function respondWithFilteredResult(_0xe9a025,_0x4ae8a1){return function(_0x147529){if(_0x147529){var _0x4301a6=typeof _0x4ae8a1['offset']===_0x44b8('0xd')&&typeof _0x4ae8a1['limit']===_0x44b8('0xd');var _0x18d642=_0x147529['count'];var _0x63e8f6=_0x4301a6?0x0:_0x4ae8a1['offset'];var _0x54fa95=_0x4301a6?_0x147529[_0x44b8('0xe')]:_0x4ae8a1[_0x44b8('0xf')]+_0x4ae8a1[_0x44b8('0x10')];var _0x41ab46;if(_0x54fa95>=_0x18d642){_0x54fa95=_0x18d642;_0x41ab46=0xc8;}else{_0x41ab46=0xce;}_0xe9a025['status'](_0x41ab46);return _0xe9a025['set']('Content-Range',_0x63e8f6+'-'+_0x54fa95+'/'+_0x18d642)[_0x44b8('0xc')](_0x147529);}return null;};}function saveUpdates(_0x5b7803){return function(_0x28ef36){if(_0x28ef36){return _0x28ef36[_0x44b8('0x11')](_0x5b7803)['then'](function(_0x36743e){return _0x36743e;});}return null;};}function removeEntity(_0xe3de8f){return function(_0x5103f5){if(_0x5103f5){return _0x5103f5[_0x44b8('0x12')]()[_0x44b8('0x13')](function(){var _0x4b600f=_0x5103f5[_0x44b8('0x14')]({'plain':!![]});var _0x8b4301=[{'name':_0x44b8('0x15'),'value':_0x44b8('0x16'),'ignore':![]},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18'),'ignore':![]}];var _0x452f2f=_(_0x8b4301)[_0x44b8('0x19')](_0x44b8('0x1a'))[_0x44b8('0x1b')](_0x44b8('0x1c'))[_0x44b8('0x1c')]();if(_['includes'](_0x452f2f,_0x4b600f[_0x44b8('0x1d')])){return;}var _0x3a8aa4=_[_0x44b8('0x1e')](_0x8b4301,[_0x44b8('0x1c'),_0x4b600f[_0x44b8('0x1d')]])['name'];return db[_0x44b8('0x1f')]['destroy']({'where':{'type':_0x3a8aa4,'resourceId':_0x4b600f['id']}})[_0x44b8('0x13')](function(){return _0x5103f5;});})[_0x44b8('0x13')](function(){_0xe3de8f[_0x44b8('0xb')](0xcc)[_0x44b8('0xa')]();});}};}function handleEntityNotFound(_0x230a3d){return function(_0x59acbc){if(!_0x59acbc){_0x230a3d[_0x44b8('0x9')](0x194);}return _0x59acbc;};}function handleError(_0x502acf,_0x41d673){_0x41d673=_0x41d673||0x1f4;return function(_0x350482){logger['error'](_0x350482[_0x44b8('0x20')]);if(_0x350482[_0x44b8('0x21')]){delete _0x350482[_0x44b8('0x21')];}_0x502acf['status'](_0x41d673)[_0x44b8('0x22')](_0x350482);};}exports[_0x44b8('0x23')]=function(_0x53d9c7,_0x2e0174){var _0x4a182d={};var _0xfb0028={'count':0x0,'rows':[]};var _0x5a544c=_['map'](db['VoiceQueue'][_0x44b8('0x24')],function(_0x29b18d){return{'name':_0x29b18d[_0x44b8('0x25')],'type':_0x29b18d[_0x44b8('0x1d')][_0x44b8('0x26')]};});_0x4a182d=qs[_0x44b8('0x27')](_0x5a544c,_0x53d9c7);var _0x2cf205={'where':_0x4a182d[_0x44b8('0x28')]};return db[_0x44b8('0x29')][_0x44b8('0xe')](_0x2cf205)[_0x44b8('0x13')](function(_0x417d81){_0xfb0028[_0x44b8('0xe')]=_0x417d81;_0x4a182d['include']=qs[_0x44b8('0x2a')](_0x53d9c7['query']);return db[_0x44b8('0x29')][_0x44b8('0x2b')](_0x4a182d);})[_0x44b8('0x13')](function(_0xb64609){_0xfb0028[_0x44b8('0x2c')]=_0xb64609;return _0xfb0028;})['then'](respondWithFilteredResult(_0x2e0174,_0x4a182d))[_0x44b8('0x2d')](handleError(_0x2e0174,null));};exports[_0x44b8('0x2e')]=function(_0x26265f,_0x339f0f){var _0x46b008={'raw':![],'where':{'id':_0x26265f[_0x44b8('0x2f')]['id']}},_0x5f541d={};_0x5f541d[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x29')][_0x44b8('0x24')]);_0x5f541d[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x26265f[_0x44b8('0x32')]);_0x5f541d[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x5f541d[_0x44b8('0x30')],_0x5f541d[_0x44b8('0x32')]);_0x46b008[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x5f541d[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x26265f[_0x44b8('0x32')][_0x44b8('0x36')]));_0x46b008[_0x44b8('0x35')]=_0x46b008[_0x44b8('0x35')][_0x44b8('0x37')]?_0x46b008[_0x44b8('0x35')]:_0x5f541d['model'];if(_0x26265f[_0x44b8('0x32')][_0x44b8('0x38')]){_0x46b008['include']=[{'all':!![]}];}_0x46b008=_[_0x44b8('0x39')]({},_0x46b008,_0x26265f[_0x44b8('0x3a')]);return db[_0x44b8('0x29')][_0x44b8('0x1e')](_0x46b008)['then'](handleEntityNotFound(_0x339f0f,null))[_0x44b8('0x13')](respondWithResult(_0x339f0f,null))[_0x44b8('0x2d')](handleError(_0x339f0f,null));};exports[_0x44b8('0x3b')]=function(_0x1ee3cc,_0x9cb2a){return db[_0x44b8('0x29')][_0x44b8('0x3b')](_0x1ee3cc[_0x44b8('0x3c')],{})[_0x44b8('0x13')](function(_0x3d1be1){var _0x1c9983=_0x1ee3cc[_0x44b8('0x3d')][_0x44b8('0x14')]({'plain':!![]});if(!_0x1c9983)throw new Error(_0x44b8('0x3e'));if(_0x1c9983[_0x44b8('0x3f')]===_0x44b8('0x3d')){var _0x57d8c4=_0x3d1be1[_0x44b8('0x14')]({'plain':!![]});var _0x43e43a=[{'name':_0x44b8('0x15'),'value':'inbound'},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18')}];var _0x229cc9=_['find'](_0x43e43a,[_0x44b8('0x1c'),_0x57d8c4[_0x44b8('0x1d')]])[_0x44b8('0x21')];return db[_0x44b8('0x40')][_0x44b8('0x1e')]({'where':{'name':_0x229cc9,'userProfileId':_0x1c9983['userProfileId']},'raw':!![]})['then'](function(_0x215f7b){if(_0x215f7b&&_0x215f7b[_0x44b8('0x41')]===0x0){return db[_0x44b8('0x1f')][_0x44b8('0x3b')]({'name':_0x57d8c4[_0x44b8('0x21')],'resourceId':_0x57d8c4['id'],'type':_0x215f7b[_0x44b8('0x21')],'sectionId':_0x215f7b['id']},{})[_0x44b8('0x13')](function(){return _0x3d1be1;});}else{return _0x3d1be1;}})[_0x44b8('0x2d')](function(_0x455fd6){logger[_0x44b8('0x42')](_0x44b8('0x43'),_0x455fd6);throw _0x455fd6;});}return _0x3d1be1;})[_0x44b8('0x13')](respondWithResult(_0x9cb2a,0xc9))[_0x44b8('0x2d')](handleError(_0x9cb2a,null));};exports[_0x44b8('0x44')]=function(_0x149731,_0x60eeb2){var _0xce06dc={'where':{'id':_0x149731[_0x44b8('0x2f')]['id']}},_0x3b3d5d={};_0x3b3d5d['model']=_['keys'](db[_0x44b8('0x29')][_0x44b8('0x24')]);_0xce06dc[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x3b3d5d[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x149731[_0x44b8('0x32')]['fields']));_0xce06dc[_0x44b8('0x35')]=_0xce06dc['attributes'][_0x44b8('0x37')]?_0xce06dc[_0x44b8('0x35')]:_0x3b3d5d[_0x44b8('0x30')];if(_0x149731[_0x44b8('0x32')][_0x44b8('0x38')]){_0xce06dc[_0x44b8('0x2a')]=[{'all':!![]}];}_0xce06dc=_['merge']({},_0xce06dc,_0x149731[_0x44b8('0x3a')]);return db[_0x44b8('0x29')][_0x44b8('0x1e')](_0xce06dc)[_0x44b8('0x13')](handleEntityNotFound(_0x60eeb2,null))['then'](function(_0x4e4ed1){if(_0x4e4ed1){var _0x2f549d=_0x4e4ed1[_0x44b8('0x14')]({'plain':!![]});_0x2f549d=qs[_0x44b8('0x45')](_0x2f549d,['id',_0x44b8('0x46'),_0x44b8('0x47')]);_0x149731['body']=_[_0x44b8('0x45')](_0x149731[_0x44b8('0x3c')],['id',_0x44b8('0x46'),_0x44b8('0x47')]);return db[_0x44b8('0x29')]['create'](_['merge'](_0x2f549d,_0x149731[_0x44b8('0x3c')]),{'include':_0x149731['query'][_0x44b8('0x38')]?[{'all':!![]}]:undefined})['then'](function(_0x40164d){var _0x434d6a=_0x149731[_0x44b8('0x3d')][_0x44b8('0x14')]({'plain':!![]});if(!_0x434d6a)throw new Error(_0x44b8('0x3e'));if(_0x434d6a[_0x44b8('0x3f')]===_0x44b8('0x3d')){var _0x533967=_0x40164d[_0x44b8('0x14')]({'plain':!![]});var _0x37b2c2=[{'name':_0x44b8('0x15'),'value':'inbound'},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18')}];var _0x45f9a0=_[_0x44b8('0x1e')](_0x37b2c2,['value',_0x533967[_0x44b8('0x1d')]])[_0x44b8('0x21')];return db['UserProfileSection'][_0x44b8('0x1e')]({'where':{'name':_0x45f9a0,'userProfileId':_0x434d6a[_0x44b8('0x48')]},'raw':!![]})[_0x44b8('0x13')](function(_0x3df6aa){if(_0x3df6aa&&_0x3df6aa[_0x44b8('0x41')]===0x0){return db['UserProfileResource']['create']({'name':_0x533967[_0x44b8('0x21')],'resourceId':_0x533967['id'],'type':_0x3df6aa[_0x44b8('0x21')],'sectionId':_0x3df6aa['id']},{})[_0x44b8('0x13')](function(){return _0x40164d;});}else{return _0x40164d;}})[_0x44b8('0x2d')](function(_0x765e45){logger[_0x44b8('0x42')](_0x44b8('0x43'),_0x765e45);throw _0x765e45;});}return _0x40164d;});}})[_0x44b8('0x13')](respondWithResult(_0x60eeb2,0xc9))[_0x44b8('0x2d')](handleError(_0x60eeb2,null));};exports[_0x44b8('0x11')]=function(_0x16c628,_0x3f7576){if(_0x16c628['body']['id']){delete _0x16c628[_0x44b8('0x3c')]['id'];}return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x16c628[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3f7576,null))[_0x44b8('0x13')](saveUpdates(_0x16c628[_0x44b8('0x3c')],null))[_0x44b8('0x13')](respondWithResult(_0x3f7576,null))[_0x44b8('0x2d')](handleError(_0x3f7576,null));};exports[_0x44b8('0x12')]=function(_0x2ecff9,_0x15bcba){return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x2ecff9[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x15bcba,null))[_0x44b8('0x13')](removeEntity(_0x15bcba,null))[_0x44b8('0x2d')](handleError(_0x15bcba,null));};exports['getHoppers']=function(_0x1ec516,_0x3aac51){var _0x10e519={'raw':![],'where':{}};var _0x2b37e={};var _0x51f763={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x1ec516['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3aac51,null))[_0x44b8('0x13')](function(_0x5df821){if(_0x5df821){_0x2b37e[_0x44b8('0x30')]=_[_0x44b8('0x31')](db['CmHopper'][_0x44b8('0x24')]);_0x2b37e[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x1ec516['query']);_0x2b37e[_0x44b8('0x33')]=_['intersection'](_0x2b37e[_0x44b8('0x30')],_0x2b37e['query']);_0x10e519[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x2b37e[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0x36')]));_0x10e519['attributes']=_0x10e519[_0x44b8('0x35')]['length']?_0x10e519[_0x44b8('0x35')]:_0x2b37e[_0x44b8('0x30')];if(!_0x1ec516['query'][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x10e519[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0x10')]);_0x10e519[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x10e519[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x1ec516['query'][_0x44b8('0x4d')]);_0x10e519[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_['pick'](_0x1ec516[_0x44b8('0x32')],_0x2b37e[_0x44b8('0x33')]));_0x10e519['where'][_0x44b8('0x4e')]=_0x5df821['id'];if(_0x1ec516[_0x44b8('0x32')][_0x44b8('0x19')]){_0x10e519[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x10e519['where'],{'$or':_[_0x44b8('0x1b')](_0x10e519[_0x44b8('0x35')],function(_0x279753){var _0x270224={};_0x270224[_0x279753]={'$like':'%'+_0x1ec516[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x270224;})});}_0x10e519=_[_0x44b8('0x39')]({},_0x10e519,_0x1ec516[_0x44b8('0x3a')]);return db['CmHopper'][_0x44b8('0xe')]({'where':_0x10e519[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0x3ce76e){_0x51f763['count']=_0x3ce76e;if(_0x1ec516['query']['includeAll']){_0x10e519[_0x44b8('0x2a')]=[{'all':!![]}];}return db[_0x44b8('0x4f')][_0x44b8('0x2b')](_0x10e519);})[_0x44b8('0x13')](function(_0x32e630){_0x51f763['rows']=_0x32e630;return _0x51f763;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x3aac51,_0x10e519))['catch'](handleError(_0x3aac51,null));};exports[_0x44b8('0x50')]=function(_0x155bcf,_0xea2c3e){var _0x5da034={'raw':!![],'where':{}};var _0x4cac12={};var _0xb4c6dc={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x155bcf['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0xea2c3e,null))[_0x44b8('0x13')](function(_0x1258c2){if(_0x1258c2){_0x4cac12[_0x44b8('0x30')]=_[_0x44b8('0x31')](db['CmHopperHistory'][_0x44b8('0x24')]);_0x4cac12[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x155bcf[_0x44b8('0x32')]);_0x4cac12[_0x44b8('0x33')]=_['intersection'](_0x4cac12[_0x44b8('0x30')],_0x4cac12[_0x44b8('0x32')]);_0x5da034[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x4cac12[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x155bcf[_0x44b8('0x32')]['fields']));_0x5da034[_0x44b8('0x35')]=_0x5da034[_0x44b8('0x35')]['length']?_0x5da034[_0x44b8('0x35')]:_0x4cac12[_0x44b8('0x30')];if(!_0x155bcf['query'][_0x44b8('0x4a')]('nolimit')){_0x5da034['limit']=qs[_0x44b8('0x10')](_0x155bcf[_0x44b8('0x32')][_0x44b8('0x10')]);_0x5da034['offset']=qs['offset'](_0x155bcf['query'][_0x44b8('0xf')]);}_0x5da034[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x155bcf[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x5da034[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x155bcf['query'],_0x4cac12[_0x44b8('0x33')]));_0x5da034['where']['VoiceQueueId']=_0x1258c2['id'];if(_0x155bcf['query'][_0x44b8('0x19')]){_0x5da034['where']=_[_0x44b8('0x39')](_0x5da034[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x5da034[_0x44b8('0x35')],function(_0x3a9780){var _0x245ba3={};_0x245ba3[_0x3a9780]={'$like':'%'+_0x155bcf[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x245ba3;})});}_0x5da034=_['merge']({},_0x5da034,_0x155bcf[_0x44b8('0x3a')]);return db[_0x44b8('0x52')][_0x44b8('0xe')]({'where':_0x5da034[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0xee44b3){_0xb4c6dc[_0x44b8('0xe')]=_0xee44b3;if(_0x155bcf[_0x44b8('0x32')][_0x44b8('0x38')]){_0x5da034['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x44b8('0x2b')](_0x5da034);})['then'](function(_0x531d65){_0xb4c6dc[_0x44b8('0x2c')]=_0x531d65;return _0xb4c6dc;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0xea2c3e,_0x5da034))['catch'](handleError(_0xea2c3e,null));};exports['getHopperFinals']=function(_0x4b22e7,_0x2e0289){var _0x4860af={'raw':!![],'where':{}};var _0x353ff1={};var _0x2812da={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x4b22e7[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2e0289,null))[_0x44b8('0x13')](function(_0x3a7229){if(_0x3a7229){_0x353ff1[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x53')][_0x44b8('0x24')]);_0x353ff1[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x4b22e7['query']);_0x353ff1[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x353ff1[_0x44b8('0x30')],_0x353ff1[_0x44b8('0x32')]);_0x4860af[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x353ff1[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x36')]));_0x4860af[_0x44b8('0x35')]=_0x4860af[_0x44b8('0x35')][_0x44b8('0x37')]?_0x4860af['attributes']:_0x353ff1[_0x44b8('0x30')];if(!_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x4860af['limit']=qs[_0x44b8('0x10')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x10')]);_0x4860af['offset']=qs[_0x44b8('0xf')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x4860af[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x4860af[_0x44b8('0x28')]=qs['filters'](_[_0x44b8('0x51')](_0x4b22e7[_0x44b8('0x32')],_0x353ff1[_0x44b8('0x33')]));_0x4860af[_0x44b8('0x28')][_0x44b8('0x4e')]=_0x3a7229['id'];if(_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x19')]){_0x4860af['where']=_['merge'](_0x4860af['where'],{'$or':_[_0x44b8('0x1b')](_0x4860af[_0x44b8('0x35')],function(_0x2d74ee){var _0x312f4c={};_0x312f4c[_0x2d74ee]={'$like':'%'+_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x312f4c;})});}_0x4860af=_[_0x44b8('0x39')]({},_0x4860af,_0x4b22e7[_0x44b8('0x3a')]);return db[_0x44b8('0x53')]['count']({'where':_0x4860af[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0x4b8036){_0x2812da['count']=_0x4b8036;if(_0x4b22e7[_0x44b8('0x32')]['includeAll']){_0x4860af[_0x44b8('0x2a')]=[{'all':!![]}];}return db[_0x44b8('0x53')][_0x44b8('0x2b')](_0x4860af);})['then'](function(_0x3f4a2a){_0x2812da[_0x44b8('0x2c')]=_0x3f4a2a;return _0x2812da;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x2e0289,_0x4860af))[_0x44b8('0x2d')](handleError(_0x2e0289,null));};exports['getHopperBlacks']=function(_0x216030,_0x584ae3){var _0x38c0c5={'raw':!![],'where':{}};var _0x2f2923={};var _0x2d9d62={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x216030[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x584ae3,null))['then'](function(_0x4d3b82){if(_0x4d3b82){_0x2f2923['model']=_[_0x44b8('0x31')](db[_0x44b8('0x54')][_0x44b8('0x24')]);_0x2f2923[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x216030[_0x44b8('0x32')]);_0x2f2923[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x2f2923[_0x44b8('0x30')],_0x2f2923[_0x44b8('0x32')]);_0x38c0c5[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x2f2923[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x216030[_0x44b8('0x32')][_0x44b8('0x36')]));_0x38c0c5[_0x44b8('0x35')]=_0x38c0c5[_0x44b8('0x35')]['length']?_0x38c0c5[_0x44b8('0x35')]:_0x2f2923['model'];if(!_0x216030[_0x44b8('0x32')]['hasOwnProperty']('nolimit')){_0x38c0c5[_0x44b8('0x10')]=qs['limit'](_0x216030['query']['limit']);_0x38c0c5['offset']=qs['offset'](_0x216030[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x38c0c5[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x216030['query'][_0x44b8('0x4d')]);_0x38c0c5[_0x44b8('0x28')]=qs['filters'](_['pick'](_0x216030[_0x44b8('0x32')],_0x2f2923[_0x44b8('0x33')]));_0x38c0c5[_0x44b8('0x28')]['VoiceQueueId']=_0x4d3b82['id'];if(_0x216030[_0x44b8('0x32')][_0x44b8('0x19')]){_0x38c0c5[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x38c0c5[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x38c0c5[_0x44b8('0x35')],function(_0x16344b){var _0x21057f={};_0x21057f[_0x16344b]={'$like':'%'+_0x216030['query'][_0x44b8('0x19')]+'%'};return _0x21057f;})});}_0x38c0c5=_[_0x44b8('0x39')]({},_0x38c0c5,_0x216030['options']);return db[_0x44b8('0x54')][_0x44b8('0xe')]({'where':_0x38c0c5[_0x44b8('0x28')]})['then'](function(_0x3a09e4){_0x2d9d62['count']=_0x3a09e4;if(_0x216030[_0x44b8('0x32')][_0x44b8('0x38')]){_0x38c0c5['include']=[{'all':!![]}];}return db[_0x44b8('0x54')][_0x44b8('0x2b')](_0x38c0c5);})[_0x44b8('0x13')](function(_0x37871e){_0x2d9d62['rows']=_0x37871e;return _0x2d9d62;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x584ae3,_0x38c0c5))[_0x44b8('0x2d')](handleError(_0x584ae3,null));};exports[_0x44b8('0x55')]=function(_0x35d46c,_0x2d4a8a){var _0x1d666e={};var _0x10a66a={};var _0x1e608f;var _0x470f90;return db['VoiceQueue']['findOne']({'where':{'id':_0x35d46c[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2d4a8a,null))[_0x44b8('0x13')](function(_0x3539f9){if(_0x3539f9){_0x1e608f=_0x3539f9;_0x10a66a[_0x44b8('0x30')]=_['keys'](db[_0x44b8('0x56')]['rawAttributes']);_0x10a66a[_0x44b8('0x32')]=_['keys'](_0x35d46c[_0x44b8('0x32')]);_0x10a66a[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x10a66a[_0x44b8('0x30')],_0x10a66a[_0x44b8('0x32')]);_0x1d666e[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x10a66a[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x35d46c['query'][_0x44b8('0x36')]));_0x1d666e[_0x44b8('0x35')]=_0x1d666e[_0x44b8('0x35')][_0x44b8('0x37')]?_0x1d666e['attributes']:_0x10a66a['model'];_0x1d666e['order']=qs[_0x44b8('0x4d')](_0x35d46c['query']['sort']);_0x1d666e[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x35d46c[_0x44b8('0x32')],_0x10a66a[_0x44b8('0x33')]));if(_0x35d46c[_0x44b8('0x32')][_0x44b8('0x19')]){_0x1d666e[_0x44b8('0x28')]=_['merge'](_0x1d666e[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x1d666e[_0x44b8('0x35')],function(_0x2594bf){var _0x5f0c0c={};_0x5f0c0c[_0x2594bf]={'$like':'%'+_0x35d46c[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x5f0c0c;})});}_0x1d666e=_[_0x44b8('0x39')]({},_0x1d666e,_0x35d46c['options']);return _0x1e608f['getTeams'](_0x1d666e);}})[_0x44b8('0x13')](function(_0xae9b10){if(_0xae9b10){_0x470f90=_0xae9b10[_0x44b8('0x37')];if(!_0x35d46c[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x1d666e[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x35d46c['query'][_0x44b8('0x10')]);_0x1d666e[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x35d46c[_0x44b8('0x32')]['offset']);}return _0x1e608f[_0x44b8('0x55')](_0x1d666e);}})['then'](function(_0x4464d3){if(_0x4464d3){return _0x4464d3?{'count':_0x470f90,'rows':_0x4464d3}:null;}})[_0x44b8('0x13')](respondWithResult(_0x2d4a8a,null))[_0x44b8('0x2d')](handleError(_0x2d4a8a,null));};exports[_0x44b8('0x57')]=function(_0x45ff62,_0x343c5c){var _0x3cb290=_0x45ff62[_0x44b8('0x3c')]['teams'];var _0x2d27bf=_[_0x44b8('0x1b')](_0x3cb290,'id');return db[_0x44b8('0x56')][_0x44b8('0x2b')]({'where':{'id':_0x2d27bf},'attributes':['id'],'include':[{'model':db[_0x44b8('0x58')],'as':_0x44b8('0x59'),'attributes':['id','name','online',_0x44b8('0x5a'),_0x44b8('0x5b')],'raw':!![]}]})['then'](function(_0x41f732){if(_0x41f732){var _0x16074e=_['flatMap'](_0x41f732,function(_0x1ec23e){var _0x3208b4=_0x1ec23e[_0x44b8('0x14')]({'plain':!![]});_0x3208b4[_0x44b8('0x59')][_0x44b8('0x5c')](function(_0x43f416){_0x43f416[_0x44b8('0x5d')]=_[_0x44b8('0x1e')](_0x3cb290,{'id':_0x3208b4['id']})[_0x44b8('0x5d')];});return _0x3208b4[_0x44b8('0x59')];});return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x45ff62[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(_0x15365d){return db['sequelize'][_0x44b8('0x5e')](function(_0x3d92a9){return _0x15365d[_0x44b8('0x57')](_0x2d27bf,{'transaction':_0x3d92a9})[_0x44b8('0x13')](function(){return BPromise['each'](_0x3cb290,function(_0x611876){return db[_0x44b8('0x5f')]['upsert']({'TeamId':_0x611876['id'],'VoiceQueueId':_0x45ff62[_0x44b8('0x2f')]['id'],'penalty':_0x611876['penalty']},{'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){return BPromise[_0x44b8('0x60')](_0x16074e,function(_0x5a508f){return db[_0x44b8('0x61')]['findOrCreate']({'where':{'UserId':_0x5a508f['id'],'VoiceQueueId':_0x45ff62['params']['id']},'defaults':{'penalty':_0x5a508f[_0x44b8('0x5d')]},'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){return BPromise['each'](_['filter'](_0x16074e,{'online':!![]}),function(_0x52af57){return db[_0x44b8('0x62')][_0x44b8('0x63')]({'membername':_0x52af57[_0x44b8('0x21')],'UserId':_0x52af57['id'],'queue_name':_0x15365d['name'],'VoiceQueueId':_0x15365d['id'],'interface':_['isNil'](_0x52af57[_0x44b8('0x5b')])?util[_0x44b8('0x64')](_0x44b8('0x65'),_0x52af57[_0x44b8('0x21')]):_0x52af57[_0x44b8('0x5b')],'paused':_0x52af57[_0x44b8('0x5a')]||![],'penalty':_0x52af57[_0x44b8('0x5d')]},{'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){_0x16074e[_0x44b8('0x5c')](function(_0x4ed62f){socket[_0x44b8('0x66')]('userVoiceQueue:save',{'UserId':_0x4ed62f['id'],'VoiceQueueId':_0x15365d['id']});});});});});}})[_0x44b8('0x13')](respondWithStatusCode(_0x343c5c,null))['catch'](handleError(_0x343c5c,null));};exports['removeTeams']=function(_0x1fb070,_0x224071){return db[_0x44b8('0x56')][_0x44b8('0x2b')]({'where':{'id':_0x1fb070[_0x44b8('0x32')][_0x44b8('0x67')]},'attributes':['id'],'include':[{'model':db[_0x44b8('0x58')],'as':_0x44b8('0x59'),'attributes':['id'],'raw':!![]}]})[_0x44b8('0x13')](handleEntityNotFound(_0x224071,null))['then'](function(_0x1eb0a8){var _0x1e3b5f=_[_0x44b8('0x1b')](_0x1eb0a8,'id');var _0x536d1d=[];var _0x5bc747=[];var _0x3e44ea=squel['select']();_0x3e44ea[_0x44b8('0x68')]('tq.TeamId')[_0x44b8('0x69')]('team_has_voice_queues','tq')['join'](_0x44b8('0x6a'),'ut',_0x44b8('0x6b'))['where'](_0x44b8('0x6c'),_0x1fb070[_0x44b8('0x2f')]['id']);for(var _0x276dfc=0x0;_0x276dfc<_0x1eb0a8[_0x44b8('0x37')];_0x276dfc+=0x1){let _0x291617=_0x1eb0a8[_0x276dfc];for(var _0x57b73f=0x0;_0x57b73f<_0x291617[_0x44b8('0x59')]['length'];_0x57b73f+=0x1){let _0x595af5=_0x291617['Agents'][_0x57b73f];var _0x3015f9=_0x3e44ea[_0x44b8('0x44')]();_0x3015f9['where'](_0x44b8('0x6d'),_0x595af5['id']);_0x5bc747[_0x44b8('0x6e')](db['sequelize']['query'](_0x3015f9[_0x44b8('0x6f')](),{'type':db[_0x44b8('0x70')]['QueryTypes'][_0x44b8('0x71')]})[_0x44b8('0x13')](function(_0x5e2d3b){if(_0x5e2d3b[_0x44b8('0x37')]===0x1){return _0x595af5['id'];}else{var _0x97f4=_['every'](_[_0x44b8('0x1b')](_0x5e2d3b,_0x44b8('0x72')),function(_0xdb42f2){return _['includes'](_0x1e3b5f,_0xdb42f2);});if(_0x97f4){return _0x595af5['id'];}}}));}}return BPromise[_0x44b8('0x73')](_0x5bc747)['then'](function(_0x2ea49d){_0x536d1d=_(_0x536d1d)['union'](_0x2ea49d)['compact']()[_0x44b8('0x1c')]();return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x1fb070[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(_0x1db2cf){return db[_0x44b8('0x70')][_0x44b8('0x5e')](function(_0x1b7826){return _0x1db2cf[_0x44b8('0x74')](_0x1fb070[_0x44b8('0x32')]['ids'],{'transaction':_0x1b7826})[_0x44b8('0x13')](function(){if(!_[_0x44b8('0x75')](_0x536d1d)){return _0x1db2cf[_0x44b8('0x76')](_0x536d1d,{'transaction':_0x1b7826})[_0x44b8('0x13')](function(){return db[_0x44b8('0x62')][_0x44b8('0x12')]({'where':{'VoiceQueueId':_0x1fb070[_0x44b8('0x2f')]['id'],'UserId':_0x536d1d},'transaction':_0x1b7826});});}})[_0x44b8('0x13')](function(){_0x536d1d['forEach'](function(_0x4234bc){socket[_0x44b8('0x66')]('userVoiceQueue:remove',{'UserId':_0x4234bc,'VoiceQueueId':_0x1db2cf['id']});});});});});});})[_0x44b8('0x13')](respondWithStatusCode(_0x224071,null))[_0x44b8('0x2d')](handleError(_0x224071,null));};exports[_0x44b8('0x77')]=function(_0x5596c0,_0x4b2b8f){var _0x18cd30,_0x133da8;return db['VoiceQueue']['find']({'where':{'id':_0x5596c0[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x4b2b8f,null))[_0x44b8('0x13')](function(_0x2bccf9){if(_0x2bccf9){_0x133da8=_0x2bccf9;return _0x2bccf9[_0x44b8('0x77')](_0x5596c0['body'][_0x44b8('0x67')],_['omit'](_0x5596c0[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{})[_0x44b8('0x78')](function(_0x156a60){for(var _0x3cbec9=0x0;_0x3cbec9<_0x5596c0[_0x44b8('0x3c')]['ids'][_0x44b8('0x37')];_0x3cbec9+=0x1){socket['emit'](_0x44b8('0x79'),{'UserId':Number(_0x5596c0[_0x44b8('0x3c')]['ids'][_0x3cbec9]),'VoiceQueueId':Number(_0x5596c0[_0x44b8('0x2f')]['id'])});}return _0x156a60;});}})['then'](function(_0x42b0c9){_0x18cd30=_0x42b0c9||[];if(_0x133da8){return db[_0x44b8('0x58')][_0x44b8('0x2b')]({'where':{'id':_0x5596c0['body'][_0x44b8('0x67')]},'attributes':['id',_0x44b8('0x21'),'online',_0x44b8('0x5a'),'interface'],'raw':!![]});}})['then'](function(_0x4220b5){if(!_['isEmpty'](_0x4220b5)){var _0x336436=[];for(var _0x51add5=0x0;_0x51add5<_0x4220b5[_0x44b8('0x37')];_0x51add5++){if(_0x4220b5[_0x51add5][_0x44b8('0x7a')]){_0x336436['push'](db[_0x44b8('0x62')][_0x44b8('0x63')]({'membername':_0x4220b5[_0x51add5]['name'],'UserId':_0x4220b5[_0x51add5]['id'],'queue_name':_0x133da8['name'],'VoiceQueueId':_0x133da8['id'],'interface':_[_0x44b8('0x7b')](_0x4220b5[_0x51add5][_0x44b8('0x5b')])?util[_0x44b8('0x64')](_0x44b8('0x65'),_0x4220b5[_0x51add5]['name']):_0x4220b5[_0x51add5][_0x44b8('0x5b')],'paused':_0x4220b5[_0x51add5][_0x44b8('0x5a')]||![],'penalty':_0x5596c0[_0x44b8('0x3c')][_0x44b8('0x5d')]||0x0}));}}return BPromise['all'](_0x336436);}})['then'](function(){return _0x18cd30;})[_0x44b8('0x13')](respondWithResult(_0x4b2b8f,null))[_0x44b8('0x2d')](handleError(_0x4b2b8f,null));};exports[_0x44b8('0x76')]=function(_0x4cf4a0,_0x1443bd){return db[_0x44b8('0x29')]['find']({'where':{'id':_0x4cf4a0[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x1443bd,null))[_0x44b8('0x13')](function(_0x2cb698){if(_0x2cb698){return _0x2cb698[_0x44b8('0x76')](_0x4cf4a0[_0x44b8('0x32')]['ids'])['then'](function(){if(_[_0x44b8('0x7c')](_0x4cf4a0['query'][_0x44b8('0x67')])){for(var _0x4dc333=0x0;_0x4dc333<_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')][_0x44b8('0x37')];_0x4dc333+=0x1){socket[_0x44b8('0x66')](_0x44b8('0x7d'),{'UserId':Number(_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')][_0x4dc333]),'VoiceQueueId':Number(_0x4cf4a0[_0x44b8('0x2f')]['id'])});}}else{socket[_0x44b8('0x66')](_0x44b8('0x7d'),{'UserId':Number(_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')]),'VoiceQueueId':Number(_0x4cf4a0[_0x44b8('0x2f')]['id'])});}});}})[_0x44b8('0x13')](function(_0x4026d7){return db[_0x44b8('0x62')]['destroy']({'where':{'VoiceQueueId':_0x4cf4a0[_0x44b8('0x2f')]['id'],'UserId':_0x4cf4a0['query'][_0x44b8('0x67')]}})[_0x44b8('0x13')](function(){return _0x4026d7;});})[_0x44b8('0x13')](respondWithStatusCode(_0x1443bd,null))[_0x44b8('0x2d')](handleError(_0x1443bd,null));};exports[_0x44b8('0x7e')]=function(_0x22e5ae,_0x2f3340){var _0x4d98de={};var _0x597139={};var _0x2fffd5;var _0x3c90c2;return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x22e5ae[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x2f3340,null))[_0x44b8('0x13')](function(_0x208c53){if(_0x208c53){_0x2fffd5=_0x208c53;_0x597139[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x58')][_0x44b8('0x24')]);_0x597139['query']=_[_0x44b8('0x31')](_0x22e5ae[_0x44b8('0x32')]);_0x597139[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x597139[_0x44b8('0x30')],_0x597139['query']);_0x4d98de['attributes']=_[_0x44b8('0x34')](_0x597139[_0x44b8('0x30')],qs['fields'](_0x22e5ae['query'][_0x44b8('0x36')]));_0x4d98de['attributes']=_0x4d98de[_0x44b8('0x35')][_0x44b8('0x37')]?_0x4d98de[_0x44b8('0x35')]:_0x597139[_0x44b8('0x30')];_0x4d98de[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x4d98de['where']=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x22e5ae[_0x44b8('0x32')],_0x597139['filters']));if(_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x19')]){_0x4d98de['where']=_['merge'](_0x4d98de['where'],{'$or':_['map'](_0x4d98de[_0x44b8('0x35')],function(_0x5e423c){var _0x48065d={};_0x48065d[_0x5e423c]={'$like':'%'+_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x48065d;})});}_0x4d98de=_[_0x44b8('0x39')]({},_0x4d98de,_0x22e5ae['options']);return _0x2fffd5[_0x44b8('0x7e')](_0x4d98de);}})['then'](function(_0x230407){if(_0x230407){_0x3c90c2=_0x230407[_0x44b8('0x37')];if(!_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x4d98de[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x10')]);_0x4d98de['offset']=qs['offset'](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0xf')]);}return _0x2fffd5['getAgents'](_0x4d98de);}})[_0x44b8('0x13')](function(_0x188744){if(_0x188744){return _0x188744?{'count':_0x3c90c2,'rows':_0x188744}:null;}})[_0x44b8('0x13')](respondWithResult(_0x2f3340,null))[_0x44b8('0x2d')](handleError(_0x2f3340,null));};exports[_0x44b8('0x7f')]=function(_0x2da727,_0x319520){var _0x2f7550={};var _0x57d24f={};var _0x223e54;var _0x3e5fa8;return db[_0x44b8('0x29')]['findOne']({'where':{'id':_0x2da727[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x319520,null))[_0x44b8('0x13')](function(_0x5370a5){if(_0x5370a5){_0x223e54=_0x5370a5;_0x57d24f[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x62')][_0x44b8('0x24')]);_0x57d24f[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x2da727[_0x44b8('0x32')]);_0x57d24f[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x57d24f[_0x44b8('0x30')],_0x57d24f[_0x44b8('0x32')]);_0x2f7550[_0x44b8('0x35')]=_['intersection'](_0x57d24f[_0x44b8('0x30')],qs['fields'](_0x2da727[_0x44b8('0x32')]['fields']));_0x2f7550[_0x44b8('0x35')]=_0x2f7550[_0x44b8('0x35')][_0x44b8('0x37')]?_0x2f7550[_0x44b8('0x35')]:_0x57d24f[_0x44b8('0x30')];_0x2f7550[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x2da727['query'][_0x44b8('0x4d')]);_0x2f7550[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x2da727[_0x44b8('0x32')],_0x57d24f[_0x44b8('0x33')]));if(_0x2da727[_0x44b8('0x32')][_0x44b8('0x19')]){_0x2f7550[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x2f7550[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x2f7550[_0x44b8('0x35')],function(_0x4281a6){var _0x4bb399={};_0x4bb399[_0x4281a6]={'$like':'%'+_0x2da727[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x4bb399;})});}_0x2f7550=_['merge']({},_0x2f7550,_0x2da727[_0x44b8('0x3a')]);return _0x223e54[_0x44b8('0x7f')](_0x2f7550);}})[_0x44b8('0x13')](function(_0x1f389e){if(_0x1f389e){_0x3e5fa8=_0x1f389e[_0x44b8('0x37')];if(!_0x2da727['query'][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x2f7550[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x2da727['query'][_0x44b8('0x10')]);_0x2f7550[_0x44b8('0xf')]=qs['offset'](_0x2da727['query']['offset']);}return _0x223e54['getMembers'](_0x2f7550);}})[_0x44b8('0x13')](function(_0x5824a8){return _0x5824a8?{'count':_0x3e5fa8,'rows':_0x5824a8}:null;})['then'](respondWithResult(_0x319520,null))[_0x44b8('0x2d')](handleError(_0x319520,null));};exports[_0x44b8('0x80')]=function(_0x87a38,_0x54adf9){var _0x44dc3d={};var _0x32dafb={};var _0x3c8e0c;var _0x21ea61;return db['VoiceQueue'][_0x44b8('0x49')]({'where':{'id':_0x87a38['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x54adf9,null))[_0x44b8('0x13')](function(_0x56cfa5){if(_0x56cfa5){_0x3c8e0c=_0x56cfa5;_0x32dafb[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x81')][_0x44b8('0x24')]);_0x32dafb[_0x44b8('0x32')]=_['keys'](_0x87a38['query']);_0x32dafb[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x32dafb[_0x44b8('0x30')],_0x32dafb[_0x44b8('0x32')]);_0x44dc3d[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x32dafb[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x87a38[_0x44b8('0x32')][_0x44b8('0x36')]));_0x44dc3d[_0x44b8('0x35')]=_0x44dc3d[_0x44b8('0x35')]['length']?_0x44dc3d['attributes']:_0x32dafb[_0x44b8('0x30')];_0x44dc3d['order']=qs[_0x44b8('0x4d')](_0x87a38[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x44dc3d['where']=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x87a38[_0x44b8('0x32')],_0x32dafb[_0x44b8('0x33')]));if(_0x87a38[_0x44b8('0x32')][_0x44b8('0x19')]){_0x44dc3d['where']=_[_0x44b8('0x39')](_0x44dc3d[_0x44b8('0x28')],{'$or':_['map'](_0x44dc3d[_0x44b8('0x35')],function(_0x1ffa05){var _0x22edd7={};_0x22edd7[_0x1ffa05]={'$like':'%'+_0x87a38[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x22edd7;})});}_0x44dc3d=_['merge']({},_0x44dc3d,_0x87a38[_0x44b8('0x3a')]);return _0x3c8e0c[_0x44b8('0x80')](_0x44dc3d);}})[_0x44b8('0x13')](function(_0x2fca1a){if(_0x2fca1a){_0x21ea61=_0x2fca1a[_0x44b8('0x37')];if(!_0x87a38[_0x44b8('0x32')][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x44dc3d[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x87a38['query'][_0x44b8('0x10')]);_0x44dc3d[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x87a38['query']['offset']);}return _0x3c8e0c[_0x44b8('0x80')](_0x44dc3d);}})['then'](function(_0x9458fb){if(_0x9458fb){return _0x9458fb?{'count':_0x21ea61,'rows':_0x9458fb}:null;}})[_0x44b8('0x13')](respondWithResult(_0x54adf9,null))[_0x44b8('0x2d')](handleError(_0x54adf9,null));};exports[_0x44b8('0x82')]=function(_0x2eb6ce,_0x105ca0){var _0x25f364=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x77c009,_0x161362;return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x2eb6ce[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x105ca0,null))['then'](function(_0x4d88a6){if(_0x4d88a6){_0x161362=_0x4d88a6;return _0x4d88a6[_0x44b8('0x82')](_0x2eb6ce[_0x44b8('0x3c')][_0x44b8('0x67')],_[_0x44b8('0x45')](_0x2eb6ce[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{});}return null;})[_0x44b8('0x78')](function(_0x4b49df){var _0xbf96c1;_0x77c009=_0x4b49df||[];var _0x1f6244=[];if(_0x4b49df){for(var _0x96a3cd=0x0;_0x96a3cd<_0x4b49df['length'];_0x96a3cd+=0x1){var _0x16721d=_0x4b49df[_0x96a3cd][_0x44b8('0x14')]({'plain':!![]});_0x161362[_0x44b8('0x83')]=_0x2eb6ce[_0x44b8('0x3c')]['dialCheckDuplicateType']?_0x2eb6ce[_0x44b8('0x3c')][_0x44b8('0x83')]:_0x161362[_0x44b8('0x83')];switch(_0x161362['dialCheckDuplicateType']){case'always':_0xbf96c1=squel['insert']()['into']('cm_hopper')[_0x44b8('0x84')]([_0x44b8('0x85'),_0x44b8('0x86'),_0x44b8('0x87'),_0x44b8('0x88'),_0x44b8('0x4e'),_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x85'),'phone')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id',_0x44b8('0x87'))[_0x44b8('0x68')](_0x16721d['CmListId'][_0x44b8('0x6f')](),'ListId')[_0x44b8('0x68')](_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')](),'VoiceQueueId')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))['field']('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x8a'))['where'](_0x44b8('0x8b'))['where'](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')]())['where'](_0x44b8('0x8e'))['where'](_0x44b8('0x8f'),squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x90'))[_0x44b8('0x69')](_0x44b8('0x91'))['where'](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]()))[_0x44b8('0x28')]('phone\x20NOT\x20IN\x20(?)',squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x92'))[_0x44b8('0x69')](_0x44b8('0x93'))[_0x44b8('0x28')](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]())))[_0x44b8('0x6f')]();break;case _0x44b8('0x94'):_0xbf96c1=squel[_0x44b8('0x95')]()['into'](_0x44b8('0x93'))[_0x44b8('0x84')]([_0x44b8('0x85'),_0x44b8('0x86'),'ContactId',_0x44b8('0x88'),'VoiceQueueId',_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()['field'](_0x44b8('0x85'),_0x44b8('0x85'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id','ContactId')[_0x44b8('0x68')](_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0x2eb6ce['params']['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')]['toString']())['where'](_0x44b8('0x8e'))[_0x44b8('0x28')](_0x44b8('0x8f'),squel[_0x44b8('0x89')]()[_0x44b8('0x68')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')['where'](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]())))[_0x44b8('0x6f')]();break;default:_0xbf96c1=squel[_0x44b8('0x95')]()[_0x44b8('0x96')]('cm_hopper')[_0x44b8('0x84')](['phone',_0x44b8('0x86'),_0x44b8('0x87'),_0x44b8('0x88'),'VoiceQueueId','createdAt',_0x44b8('0x47')],squel[_0x44b8('0x89')]()['field']('phone',_0x44b8('0x85'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id',_0x44b8('0x87'))['field'](_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))['field']('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x8a'))[_0x44b8('0x28')]('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')]())['where'](_0x44b8('0x8e')))[_0x44b8('0x6f')]();}_0x1f6244[_0x44b8('0x6e')](db[_0x44b8('0x70')]['query'](_0xbf96c1));}return BPromise['all'](_0x1f6244);}})[_0x44b8('0x13')](function(){var _0x2ad4ab=[];var _0x196b4b=squel[_0x44b8('0x95')]()[_0x44b8('0x96')]('cm_hopper_additional_phones')[_0x44b8('0x84')]([_0x44b8('0x97'),_0x44b8('0x85'),_0x44b8('0x98'),_0x44b8('0x46'),_0x44b8('0x47')],squel['select']()[_0x44b8('0x68')](_0x44b8('0x99'))[_0x44b8('0x68')](_0x44b8('0x9a'))[_0x44b8('0x68')](_0x44b8('0x9b'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27','createdAt')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x9c'),'ci')['join'](_0x44b8('0x93'),'h','h.ContactId=ci.CmContactId')[_0x44b8('0x28')](_0x44b8('0x9d'),_0x25f364)[_0x44b8('0x28')](_0x44b8('0x9e'),'PHONE'))[_0x44b8('0x6f')]();_0x2ad4ab[_0x44b8('0x6e')](db[_0x44b8('0x70')]['query'](_0x196b4b));return BPromise[_0x44b8('0x73')](_0x2ad4ab);})[_0x44b8('0x13')](function(){return _0x77c009;})[_0x44b8('0x13')](respondWithResult(_0x105ca0,null))[_0x44b8('0x2d')](handleError(_0x105ca0,null));};exports[_0x44b8('0x9f')]=function(_0x257702,_0x17560c){return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x257702[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x17560c,null))[_0x44b8('0x13')](function(_0x4d11d5){if(_0x4d11d5){return _0x4d11d5[_0x44b8('0x9f')](_0x257702[_0x44b8('0x32')][_0x44b8('0x67')]);}})[_0x44b8('0x13')](function(_0xafca17){if(_0xafca17){return db['CmHopper']['destroy']({'where':{'ListId':_0x257702['query'][_0x44b8('0x67')],'VoiceQueueId':_0x257702[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(){return _0xafca17;});}})[_0x44b8('0x13')](respondWithStatusCode(_0x17560c,null))[_0x44b8('0x2d')](handleError(_0x17560c,null));};exports[_0x44b8('0xa0')]=function(_0x513302,_0xfdb408){var _0x119dda={};var _0x5834fe={};var _0xe5cc1e;var _0x4c55e6;return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x513302['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0xfdb408,null))[_0x44b8('0x13')](function(_0x537eab){if(_0x537eab){_0xe5cc1e=_0x537eab;_0x5834fe[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x81')][_0x44b8('0x24')]);_0x5834fe['query']=_[_0x44b8('0x31')](_0x513302[_0x44b8('0x32')]);_0x5834fe[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x5834fe[_0x44b8('0x30')],_0x5834fe[_0x44b8('0x32')]);_0x119dda[_0x44b8('0x35')]=_['intersection'](_0x5834fe[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x513302[_0x44b8('0x32')]['fields']));_0x119dda[_0x44b8('0x35')]=_0x119dda[_0x44b8('0x35')]['length']?_0x119dda[_0x44b8('0x35')]:_0x5834fe[_0x44b8('0x30')];_0x119dda[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x513302['query'][_0x44b8('0x4d')]);_0x119dda[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x513302[_0x44b8('0x32')],_0x5834fe['filters']));if(_0x513302[_0x44b8('0x32')][_0x44b8('0x19')]){_0x119dda['where']=_[_0x44b8('0x39')](_0x119dda[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x119dda[_0x44b8('0x35')],function(_0x4e9376){var _0x25f31c={};_0x25f31c[_0x4e9376]={'$like':'%'+_0x513302[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x25f31c;})});}_0x119dda=_[_0x44b8('0x39')]({},_0x119dda,_0x513302[_0x44b8('0x3a')]);return _0xe5cc1e[_0x44b8('0xa0')](_0x119dda);}})[_0x44b8('0x13')](function(_0x57e3c9){if(_0x57e3c9){_0x4c55e6=_0x57e3c9[_0x44b8('0x37')];if(!_0x513302[_0x44b8('0x32')][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x119dda['limit']=qs[_0x44b8('0x10')](_0x513302[_0x44b8('0x32')][_0x44b8('0x10')]);_0x119dda['offset']=qs['offset'](_0x513302[_0x44b8('0x32')][_0x44b8('0xf')]);}return _0xe5cc1e[_0x44b8('0xa0')](_0x119dda);}})[_0x44b8('0x13')](function(_0x4a5916){if(_0x4a5916){return _0x4a5916?{'count':_0x4c55e6,'rows':_0x4a5916}:null;}})[_0x44b8('0x13')](respondWithResult(_0xfdb408,null))[_0x44b8('0x2d')](handleError(_0xfdb408,null));};exports['addBlackLists']=function(_0xd19a35,_0x2439f2){var _0x22a624;return db['VoiceQueue'][_0x44b8('0x1e')]({'where':{'id':_0xd19a35[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2439f2,null))[_0x44b8('0x13')](function(_0x14c021){if(_0x14c021){return _0x14c021['addBlackLists'](_0xd19a35[_0x44b8('0x3c')][_0x44b8('0x67')],_['omit'](_0xd19a35[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{});}return null;})[_0x44b8('0x78')](function(_0x3b9cd2){var _0xb6cadf;_0x22a624=_0x3b9cd2||[];var _0x2024eb=[];if(_0x3b9cd2){for(var _0x29af58=0x0;_0x29af58<_0x3b9cd2[_0x44b8('0x37')];_0x29af58+=0x1){var _0x3870a9=_0x3b9cd2[_0x29af58]['get']({'plain':!![]});_0xb6cadf=squel['insert']()['into']('cm_hopper_black')[_0x44b8('0x84')]([_0x44b8('0x85'),'ContactId',_0x44b8('0x88'),_0x44b8('0x4e'),_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()[_0x44b8('0x68')]('phone',_0x44b8('0x85'))['field']('id','ContactId')[_0x44b8('0x68')](_0x3870a9[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0xd19a35['params']['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))[_0x44b8('0x68')](_0x44b8('0xa1'),_0x44b8('0x46'))[_0x44b8('0x68')](_0x44b8('0xa1'),'updatedAt')[_0x44b8('0x69')](_0x44b8('0x8a'))[_0x44b8('0x28')]('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x3870a9[_0x44b8('0x8d')][_0x44b8('0x6f')]())[_0x44b8('0x28')](_0x44b8('0x8e')))[_0x44b8('0x6f')]();_0x2024eb[_0x44b8('0x6e')](db['sequelize'][_0x44b8('0x32')](_0xb6cadf));}return BPromise[_0x44b8('0x73')](_0x2024eb);}})[_0x44b8('0x13')](function(){return _0x22a624;})[_0x44b8('0x13')](respondWithResult(_0x2439f2,null))[_0x44b8('0x2d')](handleError(_0x2439f2,null));};exports[_0x44b8('0xa2')]=function(_0x4ec799,_0x3fa943){return db[_0x44b8('0x29')]['find']({'where':{'id':_0x4ec799[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3fa943,null))[_0x44b8('0x13')](function(_0x3b1643){if(_0x3b1643){return _0x3b1643['removeBlackLists'](_0x4ec799[_0x44b8('0x32')]['ids']);}})['then'](function(_0x9a5734){if(_0x9a5734){return db[_0x44b8('0x54')][_0x44b8('0x12')]({'where':{'ListId':_0x4ec799[_0x44b8('0x32')][_0x44b8('0x67')],'VoiceQueueId':_0x4ec799['params']['id']}})['then'](function(){return _0x9a5734;});}})['then'](respondWithStatusCode(_0x3fa943,null))[_0x44b8('0x2d')](handleError(_0x3fa943,null));}; \ No newline at end of file +var _0x7217=['toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','ids','emit','userVoiceQueue:remove','addAgents','isEmpty','removeAgents','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_hopper','fromQuery','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','ignore','map','value','type','find','name','UserProfileResource','end','error','send','index','VoiceQueue','fieldName','getOptions','where','include','query','findAll','rows','catch','params','model','keys','rawAttributes','filters','attributes','intersection','fields','length','options','create','user','role','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','includeAll','omit','createdAt','updatedAt','body','merge','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','getHoppers','findOne','CmHopper','hasOwnProperty','nolimit','limit','order','sort','pick','VoiceQueueId','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','online','flatMap','penalty','sequelize','transaction','addTeams','upsert','each','UserVoiceQueueRt','isNil','interface','format','SIP/%s','voicePause','forEach','userVoiceQueue:save','removeTeams','Agents','select','field','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push'];(function(_0x15cae3,_0x458cb9){var _0x20596f=function(_0x1ad3e6){while(--_0x1ad3e6){_0x15cae3['push'](_0x15cae3['shift']());}};_0x20596f(++_0x458cb9);}(_0x7217,0x19e));var _0x7721=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x7217[_0x5c351c];return _0x26f3b3;};'use strict';var moment=require(_0x7721('0x0'));var BPromise=require('bluebird');var util=require(_0x7721('0x1'));var _=require(_0x7721('0x2'));var squel=require(_0x7721('0x3'));var Redis=require(_0x7721('0x4'));var qs=require(_0x7721('0x5'));var logger=require('../../config/logger')('api');var config=require(_0x7721('0x6'));var db=require(_0x7721('0x7'))['db'];config[_0x7721('0x8')]=_[_0x7721('0x9')](config[_0x7721('0x8')],{'host':_0x7721('0xa'),'port':0x18eb});var socket=require(_0x7721('0xb'))(new Redis(config[_0x7721('0x8')]));require(_0x7721('0xc'))[_0x7721('0xd')](socket);function respondWithStatusCode(_0x3e6368,_0x2a66cb){_0x2a66cb=_0x2a66cb||0xcc;return function(_0xfa8835){if(_0xfa8835){return _0x3e6368[_0x7721('0xe')](_0x2a66cb);}return _0x3e6368[_0x7721('0xf')](_0x2a66cb)['end']();};}function respondWithResult(_0x461d1a,_0x29bc8f){_0x29bc8f=_0x29bc8f||0xc8;return function(_0x8729a6){if(_0x8729a6){return _0x461d1a[_0x7721('0xf')](_0x29bc8f)[_0x7721('0x10')](_0x8729a6);}};}function respondWithFilteredResult(_0x409b37,_0x1e7fd7){return function(_0x27b36b){if(_0x27b36b){var _0x55b4ca=typeof _0x1e7fd7[_0x7721('0x11')]===_0x7721('0x12')&&typeof _0x1e7fd7['limit']===_0x7721('0x12');var _0x30da54=_0x27b36b[_0x7721('0x13')];var _0x2e9752=_0x55b4ca?0x0:_0x1e7fd7['offset'];var _0x3cbce8=_0x55b4ca?_0x27b36b[_0x7721('0x13')]:_0x1e7fd7['offset']+_0x1e7fd7['limit'];var _0x4b183e;if(_0x3cbce8>=_0x30da54){_0x3cbce8=_0x30da54;_0x4b183e=0xc8;}else{_0x4b183e=0xce;}_0x409b37[_0x7721('0xf')](_0x4b183e);return _0x409b37[_0x7721('0x14')](_0x7721('0x15'),_0x2e9752+'-'+_0x3cbce8+'/'+_0x30da54)[_0x7721('0x10')](_0x27b36b);}return null;};}function saveUpdates(_0x5ed94b){return function(_0x20f669){if(_0x20f669){return _0x20f669['update'](_0x5ed94b)[_0x7721('0x16')](function(_0x5cb0e6){return _0x5cb0e6;});}return null;};}function removeEntity(_0xfec626){return function(_0x4e96fb){if(_0x4e96fb){return _0x4e96fb[_0x7721('0x17')]()[_0x7721('0x16')](function(){var _0x2286e5=_0x4e96fb[_0x7721('0x18')]({'plain':!![]});var _0x402820=[{'name':_0x7721('0x19'),'value':_0x7721('0x1a'),'ignore':![]},{'name':_0x7721('0x1b'),'value':'outbound','ignore':![]}];var _0x288f7e=_(_0x402820)[_0x7721('0x1c')](_0x7721('0x1d'))[_0x7721('0x1e')]('value')[_0x7721('0x1f')]();if(_['includes'](_0x288f7e,_0x2286e5[_0x7721('0x20')])){return;}var _0x288e3a=_[_0x7721('0x21')](_0x402820,[_0x7721('0x1f'),_0x2286e5[_0x7721('0x20')]])[_0x7721('0x22')];return db[_0x7721('0x23')]['destroy']({'where':{'type':_0x288e3a,'resourceId':_0x2286e5['id']}})[_0x7721('0x16')](function(){return _0x4e96fb;});})[_0x7721('0x16')](function(){_0xfec626[_0x7721('0xf')](0xcc)[_0x7721('0x24')]();});}};}function handleEntityNotFound(_0x40d550){return function(_0x16355a){if(!_0x16355a){_0x40d550[_0x7721('0xe')](0x194);}return _0x16355a;};}function handleError(_0xf753f1,_0x40f367){_0x40f367=_0x40f367||0x1f4;return function(_0x52316e){logger[_0x7721('0x25')](_0x52316e['stack']);if(_0x52316e['name']){delete _0x52316e[_0x7721('0x22')];}_0xf753f1[_0x7721('0xf')](_0x40f367)[_0x7721('0x26')](_0x52316e);};}exports[_0x7721('0x27')]=function(_0x1ea4d,_0x37b9f0){var _0xd7d703={};var _0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x1e')](db[_0x7721('0x28')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x29')],'type':_0x4a25c9[_0x7721('0x20')]['key']};});_0xd7d703=qs[_0x7721('0x2a')](_0x5c54f0,_0x1ea4d);var _0x4651b5={'where':_0xd7d703[_0x7721('0x2b')]};return db['VoiceQueue'][_0x7721('0x13')](_0x4651b5)[_0x7721('0x16')](function(_0x1492d4){_0x1da2d8[_0x7721('0x13')]=_0x1492d4;_0xd7d703[_0x7721('0x2c')]=qs['include'](_0x1ea4d[_0x7721('0x2d')]);return db[_0x7721('0x28')][_0x7721('0x2e')](_0xd7d703);})['then'](function(_0x35de7a){_0x1da2d8[_0x7721('0x2f')]=_0x35de7a;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x37b9f0,_0xd7d703))[_0x7721('0x30')](handleError(_0x37b9f0,null));};exports['show']=function(_0x2d6ba0,_0x326c50){var _0x19d082={'raw':![],'where':{'id':_0x2d6ba0[_0x7721('0x31')]['id']}},_0x1d894b={};_0x1d894b[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x28')][_0x7721('0x34')]);_0x1d894b[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x2d6ba0['query']);_0x1d894b[_0x7721('0x35')]=_['intersection'](_0x1d894b[_0x7721('0x32')],_0x1d894b[_0x7721('0x2d')]);_0x19d082[_0x7721('0x36')]=_[_0x7721('0x37')](_0x1d894b[_0x7721('0x32')],qs[_0x7721('0x38')](_0x2d6ba0['query']['fields']));_0x19d082['attributes']=_0x19d082['attributes'][_0x7721('0x39')]?_0x19d082[_0x7721('0x36')]:_0x1d894b[_0x7721('0x32')];if(_0x2d6ba0[_0x7721('0x2d')]['includeAll']){_0x19d082[_0x7721('0x2c')]=[{'all':!![]}];}_0x19d082=_['merge']({},_0x19d082,_0x2d6ba0[_0x7721('0x3a')]);return db[_0x7721('0x28')]['find'](_0x19d082)[_0x7721('0x16')](handleEntityNotFound(_0x326c50,null))[_0x7721('0x16')](respondWithResult(_0x326c50,null))['catch'](handleError(_0x326c50,null));};exports['create']=function(_0x3d84d3,_0xfc4dc4){return db[_0x7721('0x28')][_0x7721('0x3b')](_0x3d84d3['body'],{})[_0x7721('0x16')](function(_0x120de9){var _0x40ce8c=_0x3d84d3[_0x7721('0x3c')][_0x7721('0x18')]({'plain':!![]});if(!_0x40ce8c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40ce8c[_0x7721('0x3d')]==='user'){var _0xaa3216=_0x120de9['get']({'plain':!![]});var _0x2333b8=[{'name':_0x7721('0x19'),'value':_0x7721('0x1a')},{'name':'QueueCampaigns','value':_0x7721('0x3e')}];var _0x11d853=_[_0x7721('0x21')](_0x2333b8,['value',_0xaa3216[_0x7721('0x20')]])[_0x7721('0x22')];return db[_0x7721('0x3f')][_0x7721('0x21')]({'where':{'name':_0x11d853,'userProfileId':_0x40ce8c[_0x7721('0x40')]},'raw':!![]})[_0x7721('0x16')](function(_0x463ccc){if(_0x463ccc&&_0x463ccc['autoAssociation']===0x0){return db['UserProfileResource'][_0x7721('0x3b')]({'name':_0xaa3216[_0x7721('0x22')],'resourceId':_0xaa3216['id'],'type':_0x463ccc[_0x7721('0x22')],'sectionId':_0x463ccc['id']},{})[_0x7721('0x16')](function(){return _0x120de9;});}else{return _0x120de9;}})[_0x7721('0x30')](function(_0x15181b){logger[_0x7721('0x25')](_0x7721('0x41'),_0x15181b);throw _0x15181b;});}return _0x120de9;})[_0x7721('0x16')](respondWithResult(_0xfc4dc4,0xc9))[_0x7721('0x30')](handleError(_0xfc4dc4,null));};exports['clone']=function(_0x578867,_0x5ed70d){var _0x6a4664={'where':{'id':_0x578867[_0x7721('0x31')]['id']}},_0x151f69={};_0x151f69['model']=_[_0x7721('0x33')](db[_0x7721('0x28')]['rawAttributes']);_0x6a4664[_0x7721('0x36')]=_['intersection'](_0x151f69[_0x7721('0x32')],qs['fields'](_0x578867[_0x7721('0x2d')][_0x7721('0x38')]));_0x6a4664[_0x7721('0x36')]=_0x6a4664['attributes'][_0x7721('0x39')]?_0x6a4664[_0x7721('0x36')]:_0x151f69['model'];if(_0x578867[_0x7721('0x2d')][_0x7721('0x42')]){_0x6a4664[_0x7721('0x2c')]=[{'all':!![]}];}_0x6a4664=_['merge']({},_0x6a4664,_0x578867[_0x7721('0x3a')]);return db['VoiceQueue'][_0x7721('0x21')](_0x6a4664)[_0x7721('0x16')](handleEntityNotFound(_0x5ed70d,null))[_0x7721('0x16')](function(_0x443503){if(_0x443503){var _0x1c95d8=_0x443503[_0x7721('0x18')]({'plain':!![]});_0x1c95d8=qs[_0x7721('0x43')](_0x1c95d8,['id',_0x7721('0x44'),_0x7721('0x45')]);_0x578867[_0x7721('0x46')]=_[_0x7721('0x43')](_0x578867[_0x7721('0x46')],['id',_0x7721('0x44'),_0x7721('0x45')]);return db[_0x7721('0x28')]['create'](_[_0x7721('0x47')](_0x1c95d8,_0x578867[_0x7721('0x46')]),{'include':_0x578867[_0x7721('0x2d')][_0x7721('0x42')]?[{'all':!![]}]:undefined})[_0x7721('0x16')](function(_0x315127){var _0x267f5e=_0x578867['user'][_0x7721('0x18')]({'plain':!![]});if(!_0x267f5e)throw new Error(_0x7721('0x48'));if(_0x267f5e[_0x7721('0x3d')]===_0x7721('0x3c')){var _0x1f1e84=_0x315127[_0x7721('0x18')]({'plain':!![]});var _0x7fbd6c=[{'name':_0x7721('0x19'),'value':_0x7721('0x1a')},{'name':_0x7721('0x1b'),'value':_0x7721('0x3e')}];var _0x52e870=_[_0x7721('0x21')](_0x7fbd6c,[_0x7721('0x1f'),_0x1f1e84[_0x7721('0x20')]])[_0x7721('0x22')];return db[_0x7721('0x3f')][_0x7721('0x21')]({'where':{'name':_0x52e870,'userProfileId':_0x267f5e[_0x7721('0x40')]},'raw':!![]})[_0x7721('0x16')](function(_0x360882){if(_0x360882&&_0x360882[_0x7721('0x49')]===0x0){return db[_0x7721('0x23')][_0x7721('0x3b')]({'name':_0x1f1e84[_0x7721('0x22')],'resourceId':_0x1f1e84['id'],'type':_0x360882[_0x7721('0x22')],'sectionId':_0x360882['id']},{})[_0x7721('0x16')](function(){return _0x315127;});}else{return _0x315127;}})['catch'](function(_0x50e9e9){logger['error'](_0x7721('0x41'),_0x50e9e9);throw _0x50e9e9;});}return _0x315127;});}})['then'](respondWithResult(_0x5ed70d,0xc9))['catch'](handleError(_0x5ed70d,null));};exports['update']=function(_0x5d7036,_0x47925a){if(_0x5d7036[_0x7721('0x46')]['id']){delete _0x5d7036[_0x7721('0x46')]['id'];}return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0x5d7036['params']['id']}})['then'](handleEntityNotFound(_0x47925a,null))['then'](saveUpdates(_0x5d7036[_0x7721('0x46')],null))['then'](respondWithResult(_0x47925a,null))['catch'](handleError(_0x47925a,null));};exports['destroy']=function(_0x160292,_0x2e9155){return db[_0x7721('0x28')]['find']({'where':{'id':_0x160292[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x2e9155,null))[_0x7721('0x16')](removeEntity(_0x2e9155,null))[_0x7721('0x30')](handleError(_0x2e9155,null));};exports[_0x7721('0x4a')]=function(_0x16e80b,_0xad43ce){var _0x3e3301={'raw':![],'where':{}};var _0x127f46={};var _0x197b73={'count':0x0,'rows':[]};return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x16e80b[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0xad43ce,null))[_0x7721('0x16')](function(_0x4cbd28){if(_0x4cbd28){_0x127f46[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x4c')][_0x7721('0x34')]);_0x127f46['query']=_[_0x7721('0x33')](_0x16e80b[_0x7721('0x2d')]);_0x127f46['filters']=_[_0x7721('0x37')](_0x127f46['model'],_0x127f46[_0x7721('0x2d')]);_0x3e3301[_0x7721('0x36')]=_[_0x7721('0x37')](_0x127f46[_0x7721('0x32')],qs[_0x7721('0x38')](_0x16e80b[_0x7721('0x2d')][_0x7721('0x38')]));_0x3e3301[_0x7721('0x36')]=_0x3e3301[_0x7721('0x36')]['length']?_0x3e3301[_0x7721('0x36')]:_0x127f46[_0x7721('0x32')];if(!_0x16e80b[_0x7721('0x2d')][_0x7721('0x4d')](_0x7721('0x4e'))){_0x3e3301[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x16e80b['query'][_0x7721('0x4f')]);_0x3e3301[_0x7721('0x11')]=qs['offset'](_0x16e80b[_0x7721('0x2d')]['offset']);}_0x3e3301[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x16e80b[_0x7721('0x2d')][_0x7721('0x51')]);_0x3e3301[_0x7721('0x2b')]=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x16e80b['query'],_0x127f46[_0x7721('0x35')]));_0x3e3301[_0x7721('0x2b')][_0x7721('0x53')]=_0x4cbd28['id'];if(_0x16e80b['query']['filter']){_0x3e3301['where']=_['merge'](_0x3e3301['where'],{'$or':_[_0x7721('0x1e')](_0x3e3301[_0x7721('0x36')],function(_0x580473){var _0x2d4b3a={};_0x2d4b3a[_0x580473]={'$like':'%'+_0x16e80b[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x2d4b3a;})});}_0x3e3301=_[_0x7721('0x47')]({},_0x3e3301,_0x16e80b['options']);return db[_0x7721('0x4c')][_0x7721('0x13')]({'where':_0x3e3301[_0x7721('0x2b')]})[_0x7721('0x16')](function(_0x3cf3fd){_0x197b73['count']=_0x3cf3fd;if(_0x16e80b[_0x7721('0x2d')][_0x7721('0x42')]){_0x3e3301[_0x7721('0x2c')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x3e3301);})[_0x7721('0x16')](function(_0x752564){_0x197b73[_0x7721('0x2f')]=_0x752564;return _0x197b73;});}})[_0x7721('0x16')](respondWithFilteredResult(_0xad43ce,_0x3e3301))[_0x7721('0x30')](handleError(_0xad43ce,null));};exports['getHopperHistories']=function(_0x4ba35e,_0x263070){var _0x1bd97e={'raw':!![],'where':{}};var _0x68de4={};var _0x3c66b3={'count':0x0,'rows':[]};return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x4ba35e[_0x7721('0x31')]['id']}})['then'](handleEntityNotFound(_0x263070,null))[_0x7721('0x16')](function(_0x413185){if(_0x413185){_0x68de4[_0x7721('0x32')]=_['keys'](db[_0x7721('0x54')][_0x7721('0x34')]);_0x68de4[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x4ba35e['query']);_0x68de4['filters']=_[_0x7721('0x37')](_0x68de4[_0x7721('0x32')],_0x68de4[_0x7721('0x2d')]);_0x1bd97e[_0x7721('0x36')]=_[_0x7721('0x37')](_0x68de4[_0x7721('0x32')],qs['fields'](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x38')]));_0x1bd97e[_0x7721('0x36')]=_0x1bd97e['attributes'][_0x7721('0x39')]?_0x1bd97e[_0x7721('0x36')]:_0x68de4[_0x7721('0x32')];if(!_0x4ba35e[_0x7721('0x2d')][_0x7721('0x4d')]('nolimit')){_0x1bd97e[_0x7721('0x4f')]=qs['limit'](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x4f')]);_0x1bd97e[_0x7721('0x11')]=qs[_0x7721('0x11')](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x11')]);}_0x1bd97e[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x4ba35e[_0x7721('0x2d')][_0x7721('0x51')]);_0x1bd97e[_0x7721('0x2b')]=qs['filters'](_[_0x7721('0x52')](_0x4ba35e[_0x7721('0x2d')],_0x68de4[_0x7721('0x35')]));_0x1bd97e['where'][_0x7721('0x53')]=_0x413185['id'];if(_0x4ba35e[_0x7721('0x2d')][_0x7721('0x1c')]){_0x1bd97e[_0x7721('0x2b')]=_[_0x7721('0x47')](_0x1bd97e['where'],{'$or':_[_0x7721('0x1e')](_0x1bd97e[_0x7721('0x36')],function(_0x44326d){var _0x21b365={};_0x21b365[_0x44326d]={'$like':'%'+_0x4ba35e[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x21b365;})});}_0x1bd97e=_['merge']({},_0x1bd97e,_0x4ba35e[_0x7721('0x3a')]);return db[_0x7721('0x54')]['count']({'where':_0x1bd97e[_0x7721('0x2b')]})['then'](function(_0x453792){_0x3c66b3[_0x7721('0x13')]=_0x453792;if(_0x4ba35e['query'][_0x7721('0x42')]){_0x1bd97e['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x1bd97e);})[_0x7721('0x16')](function(_0x20f12e){_0x3c66b3[_0x7721('0x2f')]=_0x20f12e;return _0x3c66b3;});}})['then'](respondWithFilteredResult(_0x263070,_0x1bd97e))['catch'](handleError(_0x263070,null));};exports['getHopperFinals']=function(_0x355aa8,_0x3f7923){var _0x3c9334={'raw':!![],'where':{}};var _0x4220cf={};var _0x3b02d7={'count':0x0,'rows':[]};return db[_0x7721('0x28')]['findOne']({'where':{'id':_0x355aa8[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x3f7923,null))[_0x7721('0x16')](function(_0xcf5304){if(_0xcf5304){_0x4220cf[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x55')][_0x7721('0x34')]);_0x4220cf[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x355aa8[_0x7721('0x2d')]);_0x4220cf[_0x7721('0x35')]=_['intersection'](_0x4220cf['model'],_0x4220cf[_0x7721('0x2d')]);_0x3c9334[_0x7721('0x36')]=_['intersection'](_0x4220cf[_0x7721('0x32')],qs['fields'](_0x355aa8['query'][_0x7721('0x38')]));_0x3c9334['attributes']=_0x3c9334['attributes'][_0x7721('0x39')]?_0x3c9334[_0x7721('0x36')]:_0x4220cf[_0x7721('0x32')];if(!_0x355aa8[_0x7721('0x2d')][_0x7721('0x4d')]('nolimit')){_0x3c9334[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x355aa8[_0x7721('0x2d')][_0x7721('0x4f')]);_0x3c9334['offset']=qs['offset'](_0x355aa8[_0x7721('0x2d')][_0x7721('0x11')]);}_0x3c9334['order']=qs[_0x7721('0x51')](_0x355aa8[_0x7721('0x2d')]['sort']);_0x3c9334['where']=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x355aa8[_0x7721('0x2d')],_0x4220cf[_0x7721('0x35')]));_0x3c9334[_0x7721('0x2b')][_0x7721('0x53')]=_0xcf5304['id'];if(_0x355aa8[_0x7721('0x2d')][_0x7721('0x1c')]){_0x3c9334['where']=_[_0x7721('0x47')](_0x3c9334[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x3c9334[_0x7721('0x36')],function(_0xe1c795){var _0x9b5f60={};_0x9b5f60[_0xe1c795]={'$like':'%'+_0x355aa8[_0x7721('0x2d')]['filter']+'%'};return _0x9b5f60;})});}_0x3c9334=_[_0x7721('0x47')]({},_0x3c9334,_0x355aa8[_0x7721('0x3a')]);return db['CmHopperFinal'][_0x7721('0x13')]({'where':_0x3c9334[_0x7721('0x2b')]})[_0x7721('0x16')](function(_0xb8547a){_0x3b02d7[_0x7721('0x13')]=_0xb8547a;if(_0x355aa8[_0x7721('0x2d')][_0x7721('0x42')]){_0x3c9334[_0x7721('0x2c')]=[{'all':!![]}];}return db[_0x7721('0x55')][_0x7721('0x2e')](_0x3c9334);})['then'](function(_0x418954){_0x3b02d7[_0x7721('0x2f')]=_0x418954;return _0x3b02d7;});}})[_0x7721('0x16')](respondWithFilteredResult(_0x3f7923,_0x3c9334))[_0x7721('0x30')](handleError(_0x3f7923,null));};exports[_0x7721('0x56')]=function(_0x47653d,_0x12869b){var _0x1cfee2={'raw':!![],'where':{}};var _0x425327={};var _0x42ee11={'count':0x0,'rows':[]};return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x47653d[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x12869b,null))[_0x7721('0x16')](function(_0x461938){if(_0x461938){_0x425327[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x57')][_0x7721('0x34')]);_0x425327['query']=_[_0x7721('0x33')](_0x47653d['query']);_0x425327[_0x7721('0x35')]=_[_0x7721('0x37')](_0x425327[_0x7721('0x32')],_0x425327[_0x7721('0x2d')]);_0x1cfee2[_0x7721('0x36')]=_['intersection'](_0x425327['model'],qs['fields'](_0x47653d['query'][_0x7721('0x38')]));_0x1cfee2[_0x7721('0x36')]=_0x1cfee2[_0x7721('0x36')][_0x7721('0x39')]?_0x1cfee2[_0x7721('0x36')]:_0x425327['model'];if(!_0x47653d[_0x7721('0x2d')]['hasOwnProperty'](_0x7721('0x4e'))){_0x1cfee2[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x47653d[_0x7721('0x2d')][_0x7721('0x4f')]);_0x1cfee2[_0x7721('0x11')]=qs['offset'](_0x47653d[_0x7721('0x2d')]['offset']);}_0x1cfee2['order']=qs[_0x7721('0x51')](_0x47653d[_0x7721('0x2d')][_0x7721('0x51')]);_0x1cfee2[_0x7721('0x2b')]=qs[_0x7721('0x35')](_['pick'](_0x47653d[_0x7721('0x2d')],_0x425327[_0x7721('0x35')]));_0x1cfee2[_0x7721('0x2b')][_0x7721('0x53')]=_0x461938['id'];if(_0x47653d[_0x7721('0x2d')][_0x7721('0x1c')]){_0x1cfee2[_0x7721('0x2b')]=_['merge'](_0x1cfee2[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x1cfee2[_0x7721('0x36')],function(_0x193326){var _0x1dbf47={};_0x1dbf47[_0x193326]={'$like':'%'+_0x47653d['query'][_0x7721('0x1c')]+'%'};return _0x1dbf47;})});}_0x1cfee2=_[_0x7721('0x47')]({},_0x1cfee2,_0x47653d[_0x7721('0x3a')]);return db['CmHopperBlack'][_0x7721('0x13')]({'where':_0x1cfee2[_0x7721('0x2b')]})['then'](function(_0x29403d){_0x42ee11[_0x7721('0x13')]=_0x29403d;if(_0x47653d[_0x7721('0x2d')][_0x7721('0x42')]){_0x1cfee2['include']=[{'all':!![]}];}return db[_0x7721('0x57')]['findAll'](_0x1cfee2);})[_0x7721('0x16')](function(_0x1c50c2){_0x42ee11['rows']=_0x1c50c2;return _0x42ee11;});}})[_0x7721('0x16')](respondWithFilteredResult(_0x12869b,_0x1cfee2))[_0x7721('0x30')](handleError(_0x12869b,null));};exports['getTeams']=function(_0x29968c,_0x11733f){var _0x5e3816={};var _0x7fd3e8={};var _0x52e8b1;var _0x240b0a;return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x29968c['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x11733f,null))['then'](function(_0x5a00be){if(_0x5a00be){_0x52e8b1=_0x5a00be;_0x7fd3e8[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x58')][_0x7721('0x34')]);_0x7fd3e8[_0x7721('0x2d')]=_['keys'](_0x29968c[_0x7721('0x2d')]);_0x7fd3e8[_0x7721('0x35')]=_[_0x7721('0x37')](_0x7fd3e8[_0x7721('0x32')],_0x7fd3e8[_0x7721('0x2d')]);_0x5e3816['attributes']=_[_0x7721('0x37')](_0x7fd3e8['model'],qs[_0x7721('0x38')](_0x29968c['query']['fields']));_0x5e3816[_0x7721('0x36')]=_0x5e3816['attributes']['length']?_0x5e3816[_0x7721('0x36')]:_0x7fd3e8[_0x7721('0x32')];_0x5e3816[_0x7721('0x50')]=qs['sort'](_0x29968c[_0x7721('0x2d')]['sort']);_0x5e3816['where']=qs['filters'](_[_0x7721('0x52')](_0x29968c[_0x7721('0x2d')],_0x7fd3e8[_0x7721('0x35')]));if(_0x29968c[_0x7721('0x2d')][_0x7721('0x1c')]){_0x5e3816[_0x7721('0x2b')]=_[_0x7721('0x47')](_0x5e3816[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x5e3816[_0x7721('0x36')],function(_0x25bf32){var _0x4ec3c6={};_0x4ec3c6[_0x25bf32]={'$like':'%'+_0x29968c[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x4ec3c6;})});}_0x5e3816=_[_0x7721('0x47')]({},_0x5e3816,_0x29968c[_0x7721('0x3a')]);return _0x52e8b1[_0x7721('0x59')](_0x5e3816);}})[_0x7721('0x16')](function(_0xc7e4e9){if(_0xc7e4e9){_0x240b0a=_0xc7e4e9['length'];if(!_0x29968c['query'][_0x7721('0x4d')](_0x7721('0x4e'))){_0x5e3816[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x29968c['query'][_0x7721('0x4f')]);_0x5e3816['offset']=qs[_0x7721('0x11')](_0x29968c['query'][_0x7721('0x11')]);}return _0x52e8b1[_0x7721('0x59')](_0x5e3816);}})[_0x7721('0x16')](function(_0x249a5b){if(_0x249a5b){return _0x249a5b?{'count':_0x240b0a,'rows':_0x249a5b}:null;}})[_0x7721('0x16')](respondWithResult(_0x11733f,null))[_0x7721('0x30')](handleError(_0x11733f,null));};exports['addTeams']=function(_0x509f2d,_0x4d2644){var _0x2b0968=_0x509f2d['body'][_0x7721('0x5a')];var _0x186ada=_['map'](_0x2b0968,'id');return db[_0x7721('0x58')][_0x7721('0x2e')]({'where':{'id':_0x186ada},'attributes':['id'],'include':[{'model':db[_0x7721('0x5b')],'as':'Agents','attributes':['id',_0x7721('0x22'),_0x7721('0x5c'),'voicePause','interface'],'raw':!![]}]})[_0x7721('0x16')](function(_0xc85b9){if(_0xc85b9){var _0x58be49=_[_0x7721('0x5d')](_0xc85b9,function(_0x283716){var _0x4cd26e=_0x283716['get']({'plain':!![]});_0x4cd26e['Agents']['forEach'](function(_0x19be6b){_0x19be6b[_0x7721('0x5e')]=_[_0x7721('0x21')](_0x2b0968,{'id':_0x4cd26e['id']})['penalty'];});return _0x4cd26e['Agents'];});return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0x509f2d[_0x7721('0x31')]['id']}})[_0x7721('0x16')](function(_0x14711c){return db[_0x7721('0x5f')][_0x7721('0x60')](function(_0x435455){return _0x14711c[_0x7721('0x61')](_0x186ada,{'transaction':_0x435455})['then'](function(){return BPromise['each'](_0x2b0968,function(_0x415445){return db['TeamVoiceQueue'][_0x7721('0x62')]({'TeamId':_0x415445['id'],'VoiceQueueId':_0x509f2d['params']['id'],'penalty':_0x415445[_0x7721('0x5e')]},{'transaction':_0x435455});});})['then'](function(){return BPromise[_0x7721('0x63')](_0x58be49,function(_0x14341e){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x14341e['id'],'VoiceQueueId':_0x509f2d[_0x7721('0x31')]['id']},'defaults':{'penalty':_0x14341e[_0x7721('0x5e')]},'transaction':_0x435455});});})[_0x7721('0x16')](function(){return BPromise[_0x7721('0x63')](_[_0x7721('0x1c')](_0x58be49,{'online':!![]}),function(_0x5e69d7){return db[_0x7721('0x64')][_0x7721('0x62')]({'membername':_0x5e69d7[_0x7721('0x22')],'UserId':_0x5e69d7['id'],'queue_name':_0x14711c['name'],'VoiceQueueId':_0x14711c['id'],'interface':_[_0x7721('0x65')](_0x5e69d7[_0x7721('0x66')])?util[_0x7721('0x67')](_0x7721('0x68'),_0x5e69d7[_0x7721('0x22')]):_0x5e69d7[_0x7721('0x66')],'paused':_0x5e69d7[_0x7721('0x69')]||![],'penalty':_0x5e69d7[_0x7721('0x5e')]},{'transaction':_0x435455});});})[_0x7721('0x16')](function(){_0x58be49[_0x7721('0x6a')](function(_0x2a2d8a){socket['emit'](_0x7721('0x6b'),{'UserId':_0x2a2d8a['id'],'VoiceQueueId':_0x14711c['id']});});});});});}})[_0x7721('0x16')](respondWithStatusCode(_0x4d2644,null))[_0x7721('0x30')](handleError(_0x4d2644,null));};exports[_0x7721('0x6c')]=function(_0xcb843e,_0x35d3f1){return db[_0x7721('0x58')]['findAll']({'where':{'id':_0xcb843e[_0x7721('0x2d')]['ids']},'attributes':['id'],'include':[{'model':db[_0x7721('0x5b')],'as':_0x7721('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x7721('0x16')](handleEntityNotFound(_0x35d3f1,null))[_0x7721('0x16')](function(_0x37b607){var _0x3d6d41=_['map'](_0x37b607,'id');var _0xbce1b=[];var _0x4d3ad1=[];var _0x4028fa=squel[_0x7721('0x6e')]();_0x4028fa[_0x7721('0x6f')]('tq.TeamId')[_0x7721('0x70')](_0x7721('0x71'),'tq')[_0x7721('0x72')](_0x7721('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7721('0x2b')](_0x7721('0x74'),_0xcb843e[_0x7721('0x31')]['id']);for(var _0x980f26=0x0;_0x980f26<_0x37b607['length'];_0x980f26+=0x1){let _0x40dd5e=_0x37b607[_0x980f26];for(var _0x3d143a=0x0;_0x3d143a<_0x40dd5e[_0x7721('0x6d')][_0x7721('0x39')];_0x3d143a+=0x1){let _0x53fa66=_0x40dd5e[_0x7721('0x6d')][_0x3d143a];var _0x1a95e6=_0x4028fa[_0x7721('0x75')]();_0x1a95e6[_0x7721('0x2b')](_0x7721('0x76'),_0x53fa66['id']);_0x4d3ad1[_0x7721('0x77')](db[_0x7721('0x5f')][_0x7721('0x2d')](_0x1a95e6[_0x7721('0x78')](),{'type':db['sequelize'][_0x7721('0x79')][_0x7721('0x7a')]})[_0x7721('0x16')](function(_0x1c246b){if(_0x1c246b[_0x7721('0x39')]===0x1){return _0x53fa66['id'];}else{var _0x31447d=_[_0x7721('0x7b')](_[_0x7721('0x1e')](_0x1c246b,_0x7721('0x7c')),function(_0x14fd97){return _[_0x7721('0x7d')](_0x3d6d41,_0x14fd97);});if(_0x31447d){return _0x53fa66['id'];}}}));}}return BPromise[_0x7721('0x7e')](_0x4d3ad1)[_0x7721('0x16')](function(_0x18ccdf){_0xbce1b=_(_0xbce1b)[_0x7721('0x7f')](_0x18ccdf)[_0x7721('0x80')]()['value']();return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0xcb843e[_0x7721('0x31')]['id']}})[_0x7721('0x16')](function(_0x157310){return db[_0x7721('0x5f')][_0x7721('0x60')](function(_0xdd0e7a){return _0x157310[_0x7721('0x6c')](_0xcb843e[_0x7721('0x2d')][_0x7721('0x81')],{'transaction':_0xdd0e7a})[_0x7721('0x16')](function(){if(!_['isEmpty'](_0xbce1b)){return _0x157310['removeAgents'](_0xbce1b,{'transaction':_0xdd0e7a})[_0x7721('0x16')](function(){return db[_0x7721('0x64')][_0x7721('0x17')]({'where':{'VoiceQueueId':_0xcb843e[_0x7721('0x31')]['id'],'UserId':_0xbce1b},'transaction':_0xdd0e7a});});}})[_0x7721('0x16')](function(){_0xbce1b['forEach'](function(_0x1ebc86){socket[_0x7721('0x82')](_0x7721('0x83'),{'UserId':_0x1ebc86,'VoiceQueueId':_0x157310['id']});});});});});});})[_0x7721('0x16')](respondWithStatusCode(_0x35d3f1,null))[_0x7721('0x30')](handleError(_0x35d3f1,null));};exports[_0x7721('0x84')]=function(_0xc0f448,_0x3dc688){var _0x298aca,_0x45b430;return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0xc0f448['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x3dc688,null))[_0x7721('0x16')](function(_0x16e0cd){if(_0x16e0cd){_0x45b430=_0x16e0cd;return _0x16e0cd['addAgents'](_0xc0f448[_0x7721('0x46')][_0x7721('0x81')],_[_0x7721('0x43')](_0xc0f448['body'],[_0x7721('0x81'),'id'])||{})['spread'](function(_0x5f3dd2){for(var _0xa73193=0x0;_0xa73193<_0xc0f448[_0x7721('0x46')][_0x7721('0x81')][_0x7721('0x39')];_0xa73193+=0x1){socket['emit'](_0x7721('0x6b'),{'UserId':Number(_0xc0f448[_0x7721('0x46')][_0x7721('0x81')][_0xa73193]),'VoiceQueueId':Number(_0xc0f448[_0x7721('0x31')]['id'])});}return _0x5f3dd2;});}})[_0x7721('0x16')](function(_0x5b12c7){_0x298aca=_0x5b12c7||[];if(_0x45b430){return db[_0x7721('0x5b')][_0x7721('0x2e')]({'where':{'id':_0xc0f448[_0x7721('0x46')][_0x7721('0x81')]},'attributes':['id',_0x7721('0x22'),_0x7721('0x5c'),_0x7721('0x69'),_0x7721('0x66')],'raw':!![]});}})[_0x7721('0x16')](function(_0x385c86){if(!_[_0x7721('0x85')](_0x385c86)){var _0xc18d1a=[];for(var _0x9575b3=0x0;_0x9575b3<_0x385c86[_0x7721('0x39')];_0x9575b3++){if(_0x385c86[_0x9575b3][_0x7721('0x5c')]){_0xc18d1a[_0x7721('0x77')](db[_0x7721('0x64')][_0x7721('0x62')]({'membername':_0x385c86[_0x9575b3][_0x7721('0x22')],'UserId':_0x385c86[_0x9575b3]['id'],'queue_name':_0x45b430[_0x7721('0x22')],'VoiceQueueId':_0x45b430['id'],'interface':_[_0x7721('0x65')](_0x385c86[_0x9575b3][_0x7721('0x66')])?util['format'](_0x7721('0x68'),_0x385c86[_0x9575b3]['name']):_0x385c86[_0x9575b3][_0x7721('0x66')],'paused':_0x385c86[_0x9575b3][_0x7721('0x69')]||![],'penalty':_0xc0f448[_0x7721('0x46')][_0x7721('0x5e')]||0x0}));}}return BPromise['all'](_0xc18d1a);}})[_0x7721('0x16')](function(){return _0x298aca;})[_0x7721('0x16')](respondWithResult(_0x3dc688,null))['catch'](handleError(_0x3dc688,null));};exports[_0x7721('0x86')]=function(_0x3a8f89,_0x52aae1){return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0x3a8f89[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x52aae1,null))[_0x7721('0x16')](function(_0x55c43c){if(_0x55c43c){return _0x55c43c['removeAgents'](_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')])['then'](function(){if(_['isArray'](_0x3a8f89[_0x7721('0x2d')]['ids'])){for(var _0x1c23e3=0x0;_0x1c23e3<_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')]['length'];_0x1c23e3+=0x1){socket[_0x7721('0x82')](_0x7721('0x83'),{'UserId':Number(_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')][_0x1c23e3]),'VoiceQueueId':Number(_0x3a8f89[_0x7721('0x31')]['id'])});}}else{socket[_0x7721('0x82')](_0x7721('0x83'),{'UserId':Number(_0x3a8f89[_0x7721('0x2d')]['ids']),'VoiceQueueId':Number(_0x3a8f89[_0x7721('0x31')]['id'])});}});}})[_0x7721('0x16')](function(_0x3c3c7e){return db[_0x7721('0x64')][_0x7721('0x17')]({'where':{'VoiceQueueId':_0x3a8f89['params']['id'],'UserId':_0x3a8f89[_0x7721('0x2d')][_0x7721('0x81')]}})[_0x7721('0x16')](function(){return _0x3c3c7e;});})[_0x7721('0x16')](respondWithStatusCode(_0x52aae1,null))[_0x7721('0x30')](handleError(_0x52aae1,null));};exports[_0x7721('0x87')]=function(_0x16b110,_0x366323){var _0x14b49e={};var _0x12f568={};var _0x259640;var _0x4a0e50;return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0x16b110[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x366323,null))[_0x7721('0x16')](function(_0x25e4db){if(_0x25e4db){_0x259640=_0x25e4db;_0x12f568[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x5b')][_0x7721('0x34')]);_0x12f568[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x16b110[_0x7721('0x2d')]);_0x12f568[_0x7721('0x35')]=_[_0x7721('0x37')](_0x12f568['model'],_0x12f568[_0x7721('0x2d')]);_0x14b49e['attributes']=_['intersection'](_0x12f568[_0x7721('0x32')],qs['fields'](_0x16b110[_0x7721('0x2d')][_0x7721('0x38')]));_0x14b49e[_0x7721('0x36')]=_0x14b49e[_0x7721('0x36')]['length']?_0x14b49e['attributes']:_0x12f568[_0x7721('0x32')];_0x14b49e[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x16b110[_0x7721('0x2d')][_0x7721('0x51')]);_0x14b49e[_0x7721('0x2b')]=qs[_0x7721('0x35')](_['pick'](_0x16b110[_0x7721('0x2d')],_0x12f568['filters']));if(_0x16b110[_0x7721('0x2d')][_0x7721('0x1c')]){_0x14b49e[_0x7721('0x2b')]=_[_0x7721('0x47')](_0x14b49e[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x14b49e[_0x7721('0x36')],function(_0x184f1b){var _0xa257a0={};_0xa257a0[_0x184f1b]={'$like':'%'+_0x16b110[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0xa257a0;})});}_0x14b49e=_[_0x7721('0x47')]({},_0x14b49e,_0x16b110[_0x7721('0x3a')]);return _0x259640[_0x7721('0x87')](_0x14b49e);}})[_0x7721('0x16')](function(_0x1ee0c1){if(_0x1ee0c1){_0x4a0e50=_0x1ee0c1[_0x7721('0x39')];if(!_0x16b110[_0x7721('0x2d')]['hasOwnProperty'](_0x7721('0x4e'))){_0x14b49e[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0x16b110[_0x7721('0x2d')][_0x7721('0x4f')]);_0x14b49e[_0x7721('0x11')]=qs['offset'](_0x16b110[_0x7721('0x2d')][_0x7721('0x11')]);}return _0x259640[_0x7721('0x87')](_0x14b49e);}})['then'](function(_0x1bdadb){if(_0x1bdadb){return _0x1bdadb?{'count':_0x4a0e50,'rows':_0x1bdadb}:null;}})['then'](respondWithResult(_0x366323,null))[_0x7721('0x30')](handleError(_0x366323,null));};exports['getMembers']=function(_0xe5e55f,_0x17ce3b){var _0xbc0a80={};var _0xf2dc08={};var _0x5b493a;var _0x45024c;return db[_0x7721('0x28')][_0x7721('0x4b')]({'where':{'id':_0xe5e55f[_0x7721('0x31')]['id']}})['then'](handleEntityNotFound(_0x17ce3b,null))['then'](function(_0x12b255){if(_0x12b255){_0x5b493a=_0x12b255;_0xf2dc08['model']=_[_0x7721('0x33')](db[_0x7721('0x64')][_0x7721('0x34')]);_0xf2dc08[_0x7721('0x2d')]=_[_0x7721('0x33')](_0xe5e55f[_0x7721('0x2d')]);_0xf2dc08[_0x7721('0x35')]=_[_0x7721('0x37')](_0xf2dc08[_0x7721('0x32')],_0xf2dc08['query']);_0xbc0a80[_0x7721('0x36')]=_[_0x7721('0x37')](_0xf2dc08[_0x7721('0x32')],qs['fields'](_0xe5e55f['query'][_0x7721('0x38')]));_0xbc0a80[_0x7721('0x36')]=_0xbc0a80[_0x7721('0x36')][_0x7721('0x39')]?_0xbc0a80[_0x7721('0x36')]:_0xf2dc08[_0x7721('0x32')];_0xbc0a80['order']=qs[_0x7721('0x51')](_0xe5e55f[_0x7721('0x2d')]['sort']);_0xbc0a80[_0x7721('0x2b')]=qs['filters'](_[_0x7721('0x52')](_0xe5e55f['query'],_0xf2dc08[_0x7721('0x35')]));if(_0xe5e55f['query']['filter']){_0xbc0a80['where']=_[_0x7721('0x47')](_0xbc0a80['where'],{'$or':_['map'](_0xbc0a80['attributes'],function(_0x52a1ee){var _0x41c991={};_0x41c991[_0x52a1ee]={'$like':'%'+_0xe5e55f[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x41c991;})});}_0xbc0a80=_[_0x7721('0x47')]({},_0xbc0a80,_0xe5e55f[_0x7721('0x3a')]);return _0x5b493a['getMembers'](_0xbc0a80);}})[_0x7721('0x16')](function(_0x22d4e0){if(_0x22d4e0){_0x45024c=_0x22d4e0['length'];if(!_0xe5e55f[_0x7721('0x2d')][_0x7721('0x4d')](_0x7721('0x4e'))){_0xbc0a80[_0x7721('0x4f')]=qs[_0x7721('0x4f')](_0xe5e55f[_0x7721('0x2d')][_0x7721('0x4f')]);_0xbc0a80[_0x7721('0x11')]=qs['offset'](_0xe5e55f[_0x7721('0x2d')][_0x7721('0x11')]);}return _0x5b493a[_0x7721('0x88')](_0xbc0a80);}})[_0x7721('0x16')](function(_0x2fbb00){return _0x2fbb00?{'count':_0x45024c,'rows':_0x2fbb00}:null;})[_0x7721('0x16')](respondWithResult(_0x17ce3b,null))[_0x7721('0x30')](handleError(_0x17ce3b,null));};exports[_0x7721('0x89')]=function(_0x561235,_0x12ad4d){var _0x226081={};var _0x17c3e7={};var _0x250cbf;var _0x255b22;return db['VoiceQueue'][_0x7721('0x4b')]({'where':{'id':_0x561235[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x12ad4d,null))[_0x7721('0x16')](function(_0x396880){if(_0x396880){_0x250cbf=_0x396880;_0x17c3e7['model']=_[_0x7721('0x33')](db[_0x7721('0x8a')]['rawAttributes']);_0x17c3e7[_0x7721('0x2d')]=_[_0x7721('0x33')](_0x561235[_0x7721('0x2d')]);_0x17c3e7[_0x7721('0x35')]=_[_0x7721('0x37')](_0x17c3e7['model'],_0x17c3e7[_0x7721('0x2d')]);_0x226081[_0x7721('0x36')]=_['intersection'](_0x17c3e7['model'],qs[_0x7721('0x38')](_0x561235[_0x7721('0x2d')][_0x7721('0x38')]));_0x226081['attributes']=_0x226081[_0x7721('0x36')]['length']?_0x226081['attributes']:_0x17c3e7[_0x7721('0x32')];_0x226081[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x561235[_0x7721('0x2d')][_0x7721('0x51')]);_0x226081['where']=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x561235[_0x7721('0x2d')],_0x17c3e7[_0x7721('0x35')]));if(_0x561235[_0x7721('0x2d')]['filter']){_0x226081[_0x7721('0x2b')]=_['merge'](_0x226081[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x226081[_0x7721('0x36')],function(_0x5209ff){var _0x2583c1={};_0x2583c1[_0x5209ff]={'$like':'%'+_0x561235['query'][_0x7721('0x1c')]+'%'};return _0x2583c1;})});}_0x226081=_[_0x7721('0x47')]({},_0x226081,_0x561235[_0x7721('0x3a')]);return _0x250cbf[_0x7721('0x89')](_0x226081);}})[_0x7721('0x16')](function(_0x3235d8){if(_0x3235d8){_0x255b22=_0x3235d8[_0x7721('0x39')];if(!_0x561235[_0x7721('0x2d')][_0x7721('0x4d')](_0x7721('0x4e'))){_0x226081['limit']=qs[_0x7721('0x4f')](_0x561235[_0x7721('0x2d')][_0x7721('0x4f')]);_0x226081[_0x7721('0x11')]=qs[_0x7721('0x11')](_0x561235['query'][_0x7721('0x11')]);}return _0x250cbf[_0x7721('0x89')](_0x226081);}})[_0x7721('0x16')](function(_0x501e31){if(_0x501e31){return _0x501e31?{'count':_0x255b22,'rows':_0x501e31}:null;}})[_0x7721('0x16')](respondWithResult(_0x12ad4d,null))[_0x7721('0x30')](handleError(_0x12ad4d,null));};exports[_0x7721('0x8b')]=function(_0xe325e1,_0x1aa1fc){var _0x560be6=moment()[_0x7721('0x67')](_0x7721('0x8c'));var _0x1bd066,_0xaa15c5;return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0xe325e1[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x1aa1fc,null))[_0x7721('0x16')](function(_0x42ffff){if(_0x42ffff){_0xaa15c5=_0x42ffff;return _0x42ffff[_0x7721('0x8b')](_0xe325e1[_0x7721('0x46')][_0x7721('0x81')],_[_0x7721('0x43')](_0xe325e1[_0x7721('0x46')],[_0x7721('0x81'),'id'])||{});}return null;})[_0x7721('0x8d')](function(_0x3f19f5){var _0x28f11a;_0x1bd066=_0x3f19f5||[];var _0x3bc8f3=[];if(_0x3f19f5){for(var _0x26cea3=0x0;_0x26cea3<_0x3f19f5[_0x7721('0x39')];_0x26cea3+=0x1){var _0x57e928=_0x3f19f5[_0x26cea3]['get']({'plain':!![]});_0xaa15c5[_0x7721('0x8e')]=_0xe325e1[_0x7721('0x46')][_0x7721('0x8e')]?_0xe325e1[_0x7721('0x46')]['dialCheckDuplicateType']:_0xaa15c5[_0x7721('0x8e')];switch(_0xaa15c5['dialCheckDuplicateType']){case _0x7721('0x8f'):_0x28f11a=squel[_0x7721('0x90')]()[_0x7721('0x91')]('cm_hopper')['fromQuery'](['phone',_0x7721('0x92'),_0x7721('0x93'),_0x7721('0x94'),_0x7721('0x53'),_0x7721('0x44'),'updatedAt'],squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x95'),'phone')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x92'))[_0x7721('0x6f')]('id','ContactId')[_0x7721('0x6f')](_0x57e928[_0x7721('0x96')][_0x7721('0x78')](),'ListId')[_0x7721('0x6f')](_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27','createdAt')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27','updatedAt')['from'](_0x7721('0x97'))[_0x7721('0x2b')](_0x7721('0x98'))[_0x7721('0x2b')](_0x7721('0x99'),_0x57e928['CmListId'][_0x7721('0x78')]())[_0x7721('0x2b')](_0x7721('0x9a'))[_0x7721('0x2b')](_0x7721('0x9b'),squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x9c'))[_0x7721('0x70')](_0x7721('0x9d'))['where'](_0x7721('0x74'),_0xe325e1[_0x7721('0x31')]['id']['toString']()))[_0x7721('0x2b')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7721('0x6e')]()['field'](_0x7721('0x9e'))['from']('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0xe325e1[_0x7721('0x31')]['id']['toString']())))[_0x7721('0x78')]();break;case _0x7721('0x9f'):_0x28f11a=squel[_0x7721('0x90')]()[_0x7721('0x91')](_0x7721('0xa0'))[_0x7721('0xa1')](['phone',_0x7721('0x92'),_0x7721('0x93'),'ListId','VoiceQueueId',_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()['field'](_0x7721('0x95'),_0x7721('0x95'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x92'))[_0x7721('0x6f')]('id','ContactId')[_0x7721('0x6f')](_0x57e928[_0x7721('0x96')][_0x7721('0x78')](),_0x7721('0x94'))[_0x7721('0x6f')](_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))['field']('\x27'+_0x560be6+'\x27','createdAt')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x45'))['from'](_0x7721('0x97'))['where']('deletedAt\x20IS\x20NULL')[_0x7721('0x2b')]('ListId\x20=\x20?',_0x57e928[_0x7721('0x96')]['toString']())[_0x7721('0x2b')](_0x7721('0x9a'))['where'](_0x7721('0x9b'),squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x9e'))[_0x7721('0x70')]('cm_hopper')[_0x7721('0x2b')](_0x7721('0x74'),_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')]())))[_0x7721('0x78')]();break;default:_0x28f11a=squel[_0x7721('0x90')]()[_0x7721('0x91')]('cm_hopper')[_0x7721('0xa1')]([_0x7721('0x95'),_0x7721('0x92'),_0x7721('0x93'),_0x7721('0x94'),'VoiceQueueId',_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0x95'),_0x7721('0x95'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x92'))[_0x7721('0x6f')]('id',_0x7721('0x93'))['field'](_0x57e928['CmListId'][_0x7721('0x78')](),'ListId')['field'](_0xe325e1[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x44'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x45'))[_0x7721('0x70')](_0x7721('0x97'))[_0x7721('0x2b')](_0x7721('0x98'))[_0x7721('0x2b')](_0x7721('0x99'),_0x57e928[_0x7721('0x96')][_0x7721('0x78')]())[_0x7721('0x2b')]('phone\x20IS\x20NOT\x20NULL'))[_0x7721('0x78')]();}_0x3bc8f3[_0x7721('0x77')](db[_0x7721('0x5f')][_0x7721('0x2d')](_0x28f11a));}return BPromise[_0x7721('0x7e')](_0x3bc8f3);}})[_0x7721('0x16')](function(){var _0x5f53b3=[];var _0x8fc283=squel[_0x7721('0x90')]()['into'](_0x7721('0xa2'))['fromQuery']([_0x7721('0xa3'),_0x7721('0x95'),_0x7721('0xa4'),_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()[_0x7721('0x6f')](_0x7721('0xa5'))[_0x7721('0x6f')](_0x7721('0xa6'))[_0x7721('0x6f')](_0x7721('0xa7'))[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27','createdAt')[_0x7721('0x6f')]('\x27'+_0x560be6+'\x27',_0x7721('0x45'))[_0x7721('0x70')](_0x7721('0xa8'),'ci')[_0x7721('0x72')](_0x7721('0xa0'),'h',_0x7721('0xa9'))['where'](_0x7721('0xaa'),_0x560be6)[_0x7721('0x2b')](_0x7721('0xab'),'PHONE'))[_0x7721('0x78')]();_0x5f53b3['push'](db['sequelize'][_0x7721('0x2d')](_0x8fc283));return BPromise[_0x7721('0x7e')](_0x5f53b3);})['then'](function(){return _0x1bd066;})[_0x7721('0x16')](respondWithResult(_0x1aa1fc,null))[_0x7721('0x30')](handleError(_0x1aa1fc,null));};exports[_0x7721('0xac')]=function(_0xbc4f13,_0x50f4bd){return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0xbc4f13['params']['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x50f4bd,null))[_0x7721('0x16')](function(_0x537831){if(_0x537831){return _0x537831[_0x7721('0xac')](_0xbc4f13[_0x7721('0x2d')][_0x7721('0x81')]);}})[_0x7721('0x16')](function(_0x49548e){if(_0x49548e){return db['CmHopper'][_0x7721('0x17')]({'where':{'ListId':_0xbc4f13[_0x7721('0x2d')][_0x7721('0x81')],'VoiceQueueId':_0xbc4f13[_0x7721('0x31')]['id']}})['then'](function(){return _0x49548e;});}})['then'](respondWithStatusCode(_0x50f4bd,null))[_0x7721('0x30')](handleError(_0x50f4bd,null));};exports[_0x7721('0xad')]=function(_0x4ea8ac,_0x226556){var _0x4bd023={};var _0x50de45={};var _0x51ac8f;var _0x27ed5e;return db['VoiceQueue'][_0x7721('0x4b')]({'where':{'id':_0x4ea8ac[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x226556,null))['then'](function(_0x4893c0){if(_0x4893c0){_0x51ac8f=_0x4893c0;_0x50de45[_0x7721('0x32')]=_[_0x7721('0x33')](db[_0x7721('0x8a')][_0x7721('0x34')]);_0x50de45[_0x7721('0x2d')]=_['keys'](_0x4ea8ac[_0x7721('0x2d')]);_0x50de45[_0x7721('0x35')]=_[_0x7721('0x37')](_0x50de45[_0x7721('0x32')],_0x50de45[_0x7721('0x2d')]);_0x4bd023['attributes']=_[_0x7721('0x37')](_0x50de45[_0x7721('0x32')],qs[_0x7721('0x38')](_0x4ea8ac[_0x7721('0x2d')][_0x7721('0x38')]));_0x4bd023[_0x7721('0x36')]=_0x4bd023['attributes']['length']?_0x4bd023[_0x7721('0x36')]:_0x50de45[_0x7721('0x32')];_0x4bd023[_0x7721('0x50')]=qs[_0x7721('0x51')](_0x4ea8ac[_0x7721('0x2d')][_0x7721('0x51')]);_0x4bd023[_0x7721('0x2b')]=qs[_0x7721('0x35')](_[_0x7721('0x52')](_0x4ea8ac[_0x7721('0x2d')],_0x50de45[_0x7721('0x35')]));if(_0x4ea8ac['query'][_0x7721('0x1c')]){_0x4bd023[_0x7721('0x2b')]=_['merge'](_0x4bd023[_0x7721('0x2b')],{'$or':_[_0x7721('0x1e')](_0x4bd023[_0x7721('0x36')],function(_0x400273){var _0x42c438={};_0x42c438[_0x400273]={'$like':'%'+_0x4ea8ac[_0x7721('0x2d')][_0x7721('0x1c')]+'%'};return _0x42c438;})});}_0x4bd023=_[_0x7721('0x47')]({},_0x4bd023,_0x4ea8ac[_0x7721('0x3a')]);return _0x51ac8f[_0x7721('0xad')](_0x4bd023);}})[_0x7721('0x16')](function(_0x1192a8){if(_0x1192a8){_0x27ed5e=_0x1192a8[_0x7721('0x39')];if(!_0x4ea8ac['query'][_0x7721('0x4d')](_0x7721('0x4e'))){_0x4bd023['limit']=qs[_0x7721('0x4f')](_0x4ea8ac['query'][_0x7721('0x4f')]);_0x4bd023[_0x7721('0x11')]=qs['offset'](_0x4ea8ac['query'][_0x7721('0x11')]);}return _0x51ac8f['getBlackLists'](_0x4bd023);}})[_0x7721('0x16')](function(_0x2f7067){if(_0x2f7067){return _0x2f7067?{'count':_0x27ed5e,'rows':_0x2f7067}:null;}})[_0x7721('0x16')](respondWithResult(_0x226556,null))[_0x7721('0x30')](handleError(_0x226556,null));};exports[_0x7721('0xae')]=function(_0x376f37,_0x5b157e){var _0x4b84b9;return db['VoiceQueue'][_0x7721('0x21')]({'where':{'id':_0x376f37[_0x7721('0x31')]['id']}})[_0x7721('0x16')](handleEntityNotFound(_0x5b157e,null))[_0x7721('0x16')](function(_0x39d43b){if(_0x39d43b){return _0x39d43b['addBlackLists'](_0x376f37['body'][_0x7721('0x81')],_[_0x7721('0x43')](_0x376f37[_0x7721('0x46')],[_0x7721('0x81'),'id'])||{});}return null;})[_0x7721('0x8d')](function(_0x430304){var _0x469b6b;_0x4b84b9=_0x430304||[];var _0x6766c6=[];if(_0x430304){for(var _0x37877c=0x0;_0x37877c<_0x430304['length'];_0x37877c+=0x1){var _0x259eaa=_0x430304[_0x37877c][_0x7721('0x18')]({'plain':!![]});_0x469b6b=squel['insert']()['into'](_0x7721('0xaf'))[_0x7721('0xa1')]([_0x7721('0x95'),'ContactId',_0x7721('0x94'),_0x7721('0x53'),_0x7721('0x44'),_0x7721('0x45')],squel[_0x7721('0x6e')]()['field'](_0x7721('0x95'),'phone')[_0x7721('0x6f')]('id','ContactId')[_0x7721('0x6f')](_0x259eaa['CmListId'][_0x7721('0x78')](),_0x7721('0x94'))[_0x7721('0x6f')](_0x376f37[_0x7721('0x31')]['id'][_0x7721('0x78')](),_0x7721('0x53'))['field'](_0x7721('0xb0'),_0x7721('0x44'))[_0x7721('0x6f')](_0x7721('0xb0'),'updatedAt')[_0x7721('0x70')](_0x7721('0x97'))['where'](_0x7721('0x98'))[_0x7721('0x2b')](_0x7721('0x99'),_0x259eaa['CmListId']['toString']())[_0x7721('0x2b')]('phone\x20IS\x20NOT\x20NULL'))[_0x7721('0x78')]();_0x6766c6[_0x7721('0x77')](db['sequelize'][_0x7721('0x2d')](_0x469b6b));}return BPromise[_0x7721('0x7e')](_0x6766c6);}})['then'](function(){return _0x4b84b9;})[_0x7721('0x16')](respondWithResult(_0x5b157e,null))[_0x7721('0x30')](handleError(_0x5b157e,null));};exports[_0x7721('0xb1')]=function(_0x37da70,_0x54616a){return db[_0x7721('0x28')][_0x7721('0x21')]({'where':{'id':_0x37da70[_0x7721('0x31')]['id']}})['then'](handleEntityNotFound(_0x54616a,null))[_0x7721('0x16')](function(_0x174e79){if(_0x174e79){return _0x174e79['removeBlackLists'](_0x37da70[_0x7721('0x2d')]['ids']);}})[_0x7721('0x16')](function(_0x4c1b63){if(_0x4c1b63){return db[_0x7721('0x57')][_0x7721('0x17')]({'where':{'ListId':_0x37da70[_0x7721('0x2d')][_0x7721('0x81')],'VoiceQueueId':_0x37da70[_0x7721('0x31')]['id']}})['then'](function(){return _0x4c1b63;});}})[_0x7721('0x16')](respondWithStatusCode(_0x54616a,null))[_0x7721('0x30')](handleError(_0x54616a,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index ad69513..8f734dd 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 _0x5540=['../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2110c4,_0x38cebe){var _0x1372aa=function(_0x49319f){while(--_0x49319f){_0x2110c4['push'](_0x2110c4['shift']());}};_0x1372aa(++_0x38cebe);}(_0x5540,0x175));var _0x0554=function(_0x1b0a89,_0x5f4f8f){_0x1b0a89=_0x1b0a89-0x0;var _0x3800f0=_0x5540[_0x1b0a89];return _0x3800f0;};'use strict';var EventEmitter=require(_0x0554('0x0'));var VoiceQueue=require(_0x0554('0x1'))['db'][_0x0554('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x0554('0x3')](0x0);var events={'afterCreate':_0x0554('0x4'),'afterUpdate':_0x0554('0x5'),'afterDestroy':_0x0554('0x6')};function emitEvent(_0x584849){return function(_0x441237,_0x5e8383,_0x72a137){VoiceQueueEvents[_0x0554('0x7')](_0x584849+':'+_0x441237['id'],_0x441237);VoiceQueueEvents['emit'](_0x584849,_0x441237);_0x72a137(null);};}for(var e in events){if(events[_0x0554('0x8')](e)){var event=events[e];VoiceQueue[_0x0554('0x9')](e,emitEvent(event));}}module[_0x0554('0xa')]=VoiceQueueEvents; \ No newline at end of file +var _0xb5f4=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueue'];(function(_0x158443,_0x1f4a35){var _0x282e59=function(_0xd72bee){while(--_0xd72bee){_0x158443['push'](_0x158443['shift']());}};_0x282e59(++_0x1f4a35);}(_0xb5f4,0x6a));var _0x4b5f=function(_0x47378a,_0x20bc70){_0x47378a=_0x47378a-0x0;var _0x120fdb=_0xb5f4[_0x47378a];return _0x120fdb;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x4b5f('0x0'))['db'][_0x4b5f('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4b5f('0x2'),'afterUpdate':_0x4b5f('0x3'),'afterDestroy':_0x4b5f('0x4')};function emitEvent(_0x19e1cd){return function(_0x41f6f2,_0x2cbf59,_0x574915){VoiceQueueEvents[_0x4b5f('0x5')](_0x19e1cd+':'+_0x41f6f2['id'],_0x41f6f2);VoiceQueueEvents['emit'](_0x19e1cd,_0x41f6f2);_0x574915(null);};}for(var e in events){if(events[_0x4b5f('0x6')](e)){var event=events[e];VoiceQueue[_0x4b5f('0x7')](e,emitEvent(event));}}module[_0x4b5f('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index eb23d85..209466c 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(_0x525479,_0x13963d){var _0x48cf18=function(_0x2cf1c5){while(--_0x2cf1c5){_0x525479['push'](_0x525479['shift']());}};_0x48cf18(++_0x13963d);}(_0x34e8,0x12c));var _0x834e=function(_0x1e7ba9,_0x129612){_0x1e7ba9=_0x1e7ba9-0x0;var _0x1b5ae8=_0x34e8[_0x1e7ba9];return _0x1b5ae8;};'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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x5f3b52,_0x554fa9){var _0x1ffa89=function(_0x4c8f7f){while(--_0x4c8f7f){_0x5f3b52['push'](_0x5f3b52['shift']());}};_0x1ffa89(++_0x554fa9);}(_0xedd9,0xfc));var _0x9edd=function(_0xb4a397,_0x5cf722){_0xb4a397=_0xb4a397-0x0;var _0x24be46=_0xedd9[_0xb4a397];return _0x24be46;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 1a47739..f987824 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 _0x86b5=['map','model','GetVoiceQueue','debug','ShowVoiceQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','VoiceQueue','findAll','options','raw','where','attributes','include'];(function(_0x30b315,_0x198dd8){var _0x3e95f6=function(_0x3e01e6){while(--_0x3e01e6){_0x30b315['push'](_0x30b315['shift']());}};_0x3e95f6(++_0x198dd8);}(_0x86b5,0x180));var _0x586b=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x86b5[_0x62c958];return _0x57ec61;};'use strict';var _=require(_0x586b('0x0'));var util=require(_0x586b('0x1'));var moment=require(_0x586b('0x2'));var BPromise=require(_0x586b('0x3'));var rs=require(_0x586b('0x4'));var fs=require('fs');var Redis=require(_0x586b('0x5'));var db=require(_0x586b('0x6'))['db'];var utils=require(_0x586b('0x7'));var logger=require(_0x586b('0x8'))(_0x586b('0x9'));var config=require(_0x586b('0xa'));var jayson=require(_0x586b('0xb'));var client=jayson[_0x586b('0xc')][_0x586b('0xd')]({'port':0x232a});config['redis']=_[_0x586b('0xe')](config[_0x586b('0xf')],{'host':_0x586b('0x10'),'port':0x18eb});var socket=require(_0x586b('0x11'))(new Redis(config[_0x586b('0xf')]));require(_0x586b('0x12'))['register'](socket);function respondWithRpcPromise(_0x4cc61b,_0x288595,_0x5f34c0){return new BPromise(function(_0x2a16b2,_0x5d617b){return client[_0x586b('0x13')](_0x4cc61b,_0x5f34c0)[_0x586b('0x14')](function(_0x57adde){logger['info'](_0x586b('0x15'),_0x288595,_0x586b('0x16'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x288595,'request\x20sent',JSON[_0x586b('0x17')](_0x57adde));if(_0x57adde[_0x586b('0x18')]){if(_0x57adde[_0x586b('0x18')]['code']===0x1f4){logger['error'](_0x586b('0x15'),_0x288595,_0x57adde[_0x586b('0x18')][_0x586b('0x19')]);return _0x5d617b(_0x57adde[_0x586b('0x18')][_0x586b('0x19')]);}logger[_0x586b('0x18')](_0x586b('0x15'),_0x288595,_0x57adde[_0x586b('0x18')][_0x586b('0x19')]);return _0x2a16b2(_0x57adde[_0x586b('0x18')][_0x586b('0x19')]);}else{logger[_0x586b('0x1a')](_0x586b('0x15'),_0x288595,'request\x20sent');_0x2a16b2(_0x57adde[_0x586b('0x1b')][_0x586b('0x19')]);}})[_0x586b('0x1c')](function(_0x178656){logger['error'](_0x586b('0x15'),_0x288595,_0x178656);_0x5d617b(_0x178656);});});}exports['GetVoiceQueue']=function(_0x8458fa){var _0x5f6941=this;return new Promise(function(_0x5afb56,_0x23d789){return db[_0x586b('0x1d')][_0x586b('0x1e')]({'raw':_0x8458fa['options']?_0x8458fa[_0x586b('0x1f')][_0x586b('0x20')]===undefined?!![]:![]:!![],'where':_0x8458fa['options']?_0x8458fa[_0x586b('0x1f')][_0x586b('0x21')]||null:null,'attributes':_0x8458fa[_0x586b('0x1f')]?_0x8458fa['options'][_0x586b('0x22')]||null:null,'limit':_0x8458fa[_0x586b('0x1f')]?_0x8458fa[_0x586b('0x1f')]['limit']||null:null,'include':_0x8458fa[_0x586b('0x1f')]?_0x8458fa[_0x586b('0x1f')][_0x586b('0x23')]?_[_0x586b('0x24')](_0x8458fa[_0x586b('0x1f')]['include'],function(_0x5c820b){return{'model':db[_0x5c820b['model']],'as':_0x5c820b['as'],'attributes':_0x5c820b[_0x586b('0x22')],'include':_0x5c820b[_0x586b('0x23')]?_[_0x586b('0x24')](_0x5c820b[_0x586b('0x23')],function(_0x23d173){return{'model':db[_0x23d173[_0x586b('0x25')]],'as':_0x23d173['as'],'attributes':_0x23d173['attributes'],'include':_0x23d173['include']?_[_0x586b('0x24')](_0x23d173['include'],function(_0x18988e){return{'model':db[_0x18988e[_0x586b('0x25')]],'as':_0x18988e['as'],'attributes':_0x18988e[_0x586b('0x22')]};}):[]};}):[]};}):[]:[]})[_0x586b('0x14')](function(_0x130bcb){logger['info'](_0x586b('0x26'),_0x8458fa);logger[_0x586b('0x27')](_0x586b('0x26'),_0x8458fa,JSON[_0x586b('0x17')](_0x130bcb));_0x5afb56(_0x130bcb);})[_0x586b('0x1c')](function(_0x49a41d){logger[_0x586b('0x18')](_0x586b('0x26'),_0x49a41d['message'],_0x8458fa);_0x23d789(_0x5f6941[_0x586b('0x18')](0x1f4,_0x49a41d[_0x586b('0x19')]));});});};exports[_0x586b('0x28')]=function(_0x429894){var _0x57fe8b=this;return new Promise(function(_0xbed42a,_0x5741be){return db[_0x586b('0x1d')][_0x586b('0x29')]({'raw':_0x429894[_0x586b('0x1f')]?_0x429894[_0x586b('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x429894['options']?_0x429894[_0x586b('0x1f')][_0x586b('0x21')]||null:null,'attributes':_0x429894[_0x586b('0x1f')]?_0x429894['options'][_0x586b('0x22')]||null:null,'include':_0x429894[_0x586b('0x1f')]?_0x429894[_0x586b('0x1f')]['include']?_[_0x586b('0x24')](_0x429894[_0x586b('0x1f')]['include'],function(_0x200810){return{'model':db[_0x200810['model']],'as':_0x200810['as'],'attributes':_0x200810[_0x586b('0x22')],'include':_0x200810[_0x586b('0x23')]?_[_0x586b('0x24')](_0x200810['include'],function(_0x48ed33){return{'model':db[_0x48ed33[_0x586b('0x25')]],'as':_0x48ed33['as'],'attributes':_0x48ed33[_0x586b('0x22')],'include':_0x48ed33['include']?_[_0x586b('0x24')](_0x48ed33[_0x586b('0x23')],function(_0x10cf42){return{'model':db[_0x10cf42[_0x586b('0x25')]],'as':_0x10cf42['as'],'attributes':_0x10cf42[_0x586b('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d5ecd){logger['info'](_0x586b('0x28'),_0x429894);logger[_0x586b('0x27')]('ShowVoiceQueue',_0x429894,JSON[_0x586b('0x17')](_0x5d5ecd));_0xbed42a(_0x5d5ecd);})[_0x586b('0x1c')](function(_0x247e82){logger['error']('ShowVoiceQueue',_0x247e82[_0x586b('0x19')],_0x429894);_0x5741be(_0x57fe8b[_0x586b('0x18')](0x1f4,_0x247e82[_0x586b('0x19')]));});});}; \ No newline at end of file +var _0x367a=['then','info','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','catch','GetVoiceQueue','findAll','options','raw','attributes','limit','include','map','model','ShowVoiceQueue','VoiceQueue','where','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','redis','defaults','localhost','./voiceQueue.socket','register','request'];(function(_0xbc1c93,_0x30351e){var _0x49204e=function(_0x36f8a7){while(--_0x36f8a7){_0xbc1c93['push'](_0xbc1c93['shift']());}};_0x49204e(++_0x30351e);}(_0x367a,0xf5));var _0xa367=function(_0x56a38e,_0x42856d){_0x56a38e=_0x56a38e-0x0;var _0x51faa2=_0x367a[_0x56a38e];return _0x51faa2;};'use strict';var _=require(_0xa367('0x0'));var util=require(_0xa367('0x1'));var moment=require(_0xa367('0x2'));var BPromise=require(_0xa367('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa367('0x4'))['db'];var utils=require(_0xa367('0x5'));var logger=require(_0xa367('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa367('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xa367('0x8')]=_[_0xa367('0x9')](config[_0xa367('0x8')],{'host':_0xa367('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa367('0x8')]));require(_0xa367('0xb'))[_0xa367('0xc')](socket);function respondWithRpcPromise(_0x2207e9,_0xf42c76,_0x4a2fff){return new BPromise(function(_0x53c8b0,_0x2bd446){return client[_0xa367('0xd')](_0x2207e9,_0x4a2fff)[_0xa367('0xe')](function(_0x41cca0){logger[_0xa367('0xf')]('VoiceQueue,\x20%s,\x20%s',_0xf42c76,'request\x20sent');logger[_0xa367('0x10')](_0xa367('0x11'),_0xf42c76,_0xa367('0x12'),JSON[_0xa367('0x13')](_0x41cca0));if(_0x41cca0['error']){if(_0x41cca0[_0xa367('0x14')][_0xa367('0x15')]===0x1f4){logger[_0xa367('0x14')](_0xa367('0x16'),_0xf42c76,_0x41cca0[_0xa367('0x14')]['message']);return _0x2bd446(_0x41cca0[_0xa367('0x14')][_0xa367('0x17')]);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0xf42c76,_0x41cca0[_0xa367('0x14')]['message']);return _0x53c8b0(_0x41cca0[_0xa367('0x14')][_0xa367('0x17')]);}else{logger[_0xa367('0xf')](_0xa367('0x16'),_0xf42c76,_0xa367('0x12'));_0x53c8b0(_0x41cca0['result'][_0xa367('0x17')]);}})[_0xa367('0x18')](function(_0x1781a7){logger[_0xa367('0x14')](_0xa367('0x16'),_0xf42c76,_0x1781a7);_0x2bd446(_0x1781a7);});});}exports[_0xa367('0x19')]=function(_0x5984f3){var _0x4534d6=this;return new Promise(function(_0x538532,_0x3afe8c){return db['VoiceQueue'][_0xa367('0x1a')]({'raw':_0x5984f3[_0xa367('0x1b')]?_0x5984f3[_0xa367('0x1b')][_0xa367('0x1c')]===undefined?!![]:![]:!![],'where':_0x5984f3[_0xa367('0x1b')]?_0x5984f3[_0xa367('0x1b')]['where']||null:null,'attributes':_0x5984f3['options']?_0x5984f3[_0xa367('0x1b')][_0xa367('0x1d')]||null:null,'limit':_0x5984f3[_0xa367('0x1b')]?_0x5984f3['options'][_0xa367('0x1e')]||null:null,'include':_0x5984f3[_0xa367('0x1b')]?_0x5984f3['options'][_0xa367('0x1f')]?_[_0xa367('0x20')](_0x5984f3[_0xa367('0x1b')][_0xa367('0x1f')],function(_0x490c94){return{'model':db[_0x490c94[_0xa367('0x21')]],'as':_0x490c94['as'],'attributes':_0x490c94['attributes'],'include':_0x490c94[_0xa367('0x1f')]?_[_0xa367('0x20')](_0x490c94[_0xa367('0x1f')],function(_0x774a3f){return{'model':db[_0x774a3f[_0xa367('0x21')]],'as':_0x774a3f['as'],'attributes':_0x774a3f[_0xa367('0x1d')],'include':_0x774a3f['include']?_[_0xa367('0x20')](_0x774a3f[_0xa367('0x1f')],function(_0x33219f){return{'model':db[_0x33219f['model']],'as':_0x33219f['as'],'attributes':_0x33219f[_0xa367('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa367('0xe')](function(_0xa93489){logger[_0xa367('0xf')](_0xa367('0x19'),_0x5984f3);logger[_0xa367('0x10')](_0xa367('0x19'),_0x5984f3,JSON['stringify'](_0xa93489));_0x538532(_0xa93489);})[_0xa367('0x18')](function(_0x47c538){logger[_0xa367('0x14')](_0xa367('0x19'),_0x47c538[_0xa367('0x17')],_0x5984f3);_0x3afe8c(_0x4534d6[_0xa367('0x14')](0x1f4,_0x47c538[_0xa367('0x17')]));});});};exports[_0xa367('0x22')]=function(_0x1957af){var _0x512935=this;return new Promise(function(_0x5b0699,_0x69c030){return db[_0xa367('0x23')]['find']({'raw':_0x1957af[_0xa367('0x1b')]?_0x1957af[_0xa367('0x1b')][_0xa367('0x1c')]===undefined?!![]:![]:!![],'where':_0x1957af[_0xa367('0x1b')]?_0x1957af[_0xa367('0x1b')][_0xa367('0x24')]||null:null,'attributes':_0x1957af[_0xa367('0x1b')]?_0x1957af[_0xa367('0x1b')][_0xa367('0x1d')]||null:null,'include':_0x1957af[_0xa367('0x1b')]?_0x1957af['options'][_0xa367('0x1f')]?_[_0xa367('0x20')](_0x1957af[_0xa367('0x1b')][_0xa367('0x1f')],function(_0x4acfe2){return{'model':db[_0x4acfe2[_0xa367('0x21')]],'as':_0x4acfe2['as'],'attributes':_0x4acfe2[_0xa367('0x1d')],'include':_0x4acfe2[_0xa367('0x1f')]?_[_0xa367('0x20')](_0x4acfe2[_0xa367('0x1f')],function(_0x4794cf){return{'model':db[_0x4794cf['model']],'as':_0x4794cf['as'],'attributes':_0x4794cf['attributes'],'include':_0x4794cf[_0xa367('0x1f')]?_[_0xa367('0x20')](_0x4794cf['include'],function(_0x138fb6){return{'model':db[_0x138fb6[_0xa367('0x21')]],'as':_0x138fb6['as'],'attributes':_0x138fb6[_0xa367('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x477cd8){logger[_0xa367('0xf')](_0xa367('0x22'),_0x1957af);logger['debug'](_0xa367('0x22'),_0x1957af,JSON[_0xa367('0x13')](_0x477cd8));_0x5b0699(_0x477cd8);})[_0xa367('0x18')](function(_0x2529c0){logger[_0xa367('0x14')](_0xa367('0x22'),_0x2529c0[_0xa367('0x17')],_0x1957af);_0x69c030(_0x512935['error'](0x1f4,_0x2529c0[_0xa367('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index de68fb5..348ee11 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 _0x2ccd=['register','length','voiceQueue:','save'];(function(_0x276204,_0x4ad6f3){var _0x137d07=function(_0x3d6add){while(--_0x3d6add){_0x276204['push'](_0x276204['shift']());}};_0x137d07(++_0x4ad6f3);}(_0x2ccd,0xc3));var _0xd2cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2ccd[_0x3dd15e];return _0x231fd0;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xd2cc('0x0'),'remove','update'];function createListener(_0x4c5e3d,_0x236735){return function(_0x64bbd8){_0x236735['emit'](_0x4c5e3d,_0x64bbd8);};}function removeListener(_0x122287,_0x43a5cc){return function(){VoiceQueueEvents['removeListener'](_0x122287,_0x43a5cc);};}exports[_0xd2cc('0x1')]=function(_0x1459e0){for(var _0x5cbb8a=0x0,_0x486142=events[_0xd2cc('0x2')];_0x5cbb8a<_0x486142;_0x5cbb8a++){var _0x5a949c=events[_0x5cbb8a];var _0xb70800=createListener(_0xd2cc('0x3')+_0x5a949c,_0x1459e0);VoiceQueueEvents['on'](_0x5a949c,_0xb70800);}}; \ No newline at end of file +var _0x2d69=['removeListener','register','voiceQueue:','./voiceQueue.events','save'];(function(_0x422d4b,_0x1ce750){var _0x483cf7=function(_0x21c188){while(--_0x21c188){_0x422d4b['push'](_0x422d4b['shift']());}};_0x483cf7(++_0x1ce750);}(_0x2d69,0x71));var _0x92d6=function(_0x4b65f1,_0x3dfc92){_0x4b65f1=_0x4b65f1-0x0;var _0x4efedd=_0x2d69[_0x4b65f1];return _0x4efedd;};'use strict';var VoiceQueueEvents=require(_0x92d6('0x0'));var events=[_0x92d6('0x1'),'remove','update'];function createListener(_0x284cd1,_0x2c7514){return function(_0x220fcb){_0x2c7514['emit'](_0x284cd1,_0x220fcb);};}function removeListener(_0x35fe91,_0x77b122){return function(){VoiceQueueEvents[_0x92d6('0x2')](_0x35fe91,_0x77b122);};}exports[_0x92d6('0x3')]=function(_0x14b037){for(var _0x2f8aeb=0x0,_0x1f0e4e=events['length'];_0x2f8aeb<_0x1f0e4e;_0x2f8aeb++){var _0x41c1b7=events[_0x2f8aeb];var _0xba1866=createListener(_0x92d6('0x4')+_0x41c1b7,_0x14b037);VoiceQueueEvents['on'](_0x41c1b7,_0xba1866);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 9d04afb..ef9410c 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 _0xc613=['../../config/environment','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','show','post','/:id','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc613,0x1b3));var _0x3c61=function(_0x5491dc,_0x19940a){_0x5491dc=_0x5491dc-0x0;var _0x4671cd=_0xc613[_0x5491dc];return _0x4671cd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3c61('0x0'));var timeout=require(_0x3c61('0x1'));var express=require('express');var router=express[_0x3c61('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3c61('0x3'));var interaction=require(_0x3c61('0x4'));var config=require(_0x3c61('0x5'));var controller=require('./voiceQueueReport.controller');router[_0x3c61('0x6')]('/',auth[_0x3c61('0x7')](),controller[_0x3c61('0x8')]);router[_0x3c61('0x6')](_0x3c61('0x9'),auth[_0x3c61('0x7')](),controller[_0x3c61('0xa')]);router[_0x3c61('0x6')](_0x3c61('0xb'),auth[_0x3c61('0x7')](),controller[_0x3c61('0xc')]);router[_0x3c61('0x6')]('/:id',auth[_0x3c61('0x7')](),controller[_0x3c61('0xd')]);router[_0x3c61('0xe')]('/',auth[_0x3c61('0x7')](),controller['create']);router['put'](_0x3c61('0xf'),auth[_0x3c61('0x7')](),controller[_0x3c61('0x10')]);router[_0x3c61('0x11')](_0x3c61('0xf'),auth[_0x3c61('0x7')](),controller[_0x3c61('0x12')]);module[_0x3c61('0x13')]=router; \ No newline at end of file +var _0x592a=['isAuthenticated','index','get','/describe','describe','/index','getVoiceQueuesReport','show','post','/:id','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller'];(function(_0x1e5fa3,_0x528acc){var _0x23ca3d=function(_0x488995){while(--_0x488995){_0x1e5fa3['push'](_0x1e5fa3['shift']());}};_0x23ca3d(++_0x528acc);}(_0x592a,0x1c5));var _0xa592=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x592a[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xa592('0x0'));var util=require(_0xa592('0x1'));var path=require(_0xa592('0x2'));var timeout=require(_0xa592('0x3'));var express=require(_0xa592('0x4'));var router=express['Router']();var fs_extra=require(_0xa592('0x5'));var auth=require(_0xa592('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa592('0x7'));var controller=require(_0xa592('0x8'));router['get']('/',auth[_0xa592('0x9')](),controller[_0xa592('0xa')]);router[_0xa592('0xb')](_0xa592('0xc'),auth[_0xa592('0x9')](),controller[_0xa592('0xd')]);router['get'](_0xa592('0xe'),auth[_0xa592('0x9')](),controller[_0xa592('0xf')]);router[_0xa592('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xa592('0x10')]);router[_0xa592('0x11')]('/',auth[_0xa592('0x9')](),controller['create']);router['put'](_0xa592('0x12'),auth[_0xa592('0x9')](),controller[_0xa592('0x13')]);router[_0xa592('0x14')](_0xa592('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0xa592('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 0e2bed4..baa4f7c 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 _0xe319=['sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x17b8da,_0x2f134b){var _0x44eb68=function(_0x30b8b7){while(--_0x30b8b7){_0x17b8da['push'](_0x17b8da['shift']());}};_0x44eb68(++_0x2f134b);}(_0xe319,0x110));var _0x9e31=function(_0xc6e106,_0x5d27fc){_0xc6e106=_0xc6e106-0x0;var _0x18f2b9=_0xe319[_0xc6e106];return _0x18f2b9;};'use strict';var Sequelize=require(_0x9e31('0x0'));var moment=require(_0x9e31('0x1'));module['exports']={'type':{'type':Sequelize[_0x9e31('0x2')]},'uniqueid':{'type':Sequelize[_0x9e31('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x9e31('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x9e31('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x9e31('0x3')],'set':function(_0xd6b685){var _0x4742dd=moment(_0xd6b685);var _0x77647=moment(this[_0x9e31('0x4')](_0x9e31('0x5')))[_0x9e31('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x47a921=_0x4742dd[_0x9e31('0x7')](_0x77647,_0x9e31('0x8'));this[_0x9e31('0x9')](_0x9e31('0xa'),_0xd6b685);this[_0x9e31('0x9')](_0x9e31('0xb'),_0x47a921||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x9e31('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x9e31('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x9e31('0x3')]},'queuecallerexit':{'type':Sequelize[_0x9e31('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x9e31('0x2')],'comment':_0x9e31('0xd')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x9e31('0x2')]},'connectedlinenum':{'type':Sequelize[_0x9e31('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9e31('0x2')]},'context':{'type':Sequelize[_0x9e31('0x2')]},'exten':{'type':Sequelize[_0x9e31('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x9e31('0xe')]},'mohtime':{'type':Sequelize[_0x9e31('0xe')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x9e31('0x2')]},'transfer':{'type':Sequelize[_0x9e31('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9e31('0x2')],'comment':_0x9e31('0xf')},'transferexten':{'type':Sequelize[_0x9e31('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x9e31('0x2')]},'secondDisposition':{'type':Sequelize[_0x9e31('0x2')]},'thirdDisposition':{'type':Sequelize[_0x9e31('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x9e31('0xe')],'defaultValue':0x0},'note':{'type':Sequelize[_0x9e31('0x2')]}}; \ No newline at end of file +var _0x82b7=['BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER'];(function(_0x32c2e7,_0x576ada){var _0x30da17=function(_0x1374c2){while(--_0x1374c2){_0x32c2e7['push'](_0x32c2e7['shift']());}};_0x30da17(++_0x576ada);}(_0x82b7,0x98));var _0x782b=function(_0x1c4654,_0x5d6e0d){_0x1c4654=_0x1c4654-0x0;var _0x14018f=_0x82b7[_0x1c4654];return _0x14018f;};'use strict';var Sequelize=require(_0x782b('0x0'));var moment=require(_0x782b('0x1'));module[_0x782b('0x2')]={'type':{'type':Sequelize[_0x782b('0x3')]},'uniqueid':{'type':Sequelize[_0x782b('0x3')]},'calleridnum':{'type':Sequelize[_0x782b('0x3')]},'calleridname':{'type':Sequelize[_0x782b('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x782b('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x782b('0x4')],'set':function(_0x2030af){var _0x3a24a4=moment(_0x2030af);var _0x276739=moment(this['getDataValue'](_0x782b('0x5')))[_0x782b('0x6')](_0x782b('0x7'));var _0x16da1d=_0x3a24a4['diff'](_0x276739,_0x782b('0x8'));this[_0x782b('0x9')](_0x782b('0xa'),_0x2030af);this[_0x782b('0x9')](_0x782b('0xb'),_0x16da1d||null);}},'position':{'type':Sequelize[_0x782b('0xc')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x782b('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x782b('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x782b('0x4')]},'queuecallerexit':{'type':Sequelize[_0x782b('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x782b('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x782b('0xe')},'originalposition':{'type':Sequelize[_0x782b('0xc')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x782b('0x3')]},'accountcode':{'type':Sequelize[_0x782b('0x3')]},'context':{'type':Sequelize[_0x782b('0x3')]},'exten':{'type':Sequelize[_0x782b('0x3')]},'priority':{'type':Sequelize[_0x782b('0x3')]},'holdtime':{'type':Sequelize[_0x782b('0xc')]},'mohtime':{'type':Sequelize[_0x782b('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x782b('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x782b('0x3')]},'transfer':{'type':Sequelize[_0x782b('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x782b('0x3')]},'transferuniqueid':{'type':Sequelize[_0x782b('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x782b('0x3')]},'thirdDisposition':{'type':Sequelize[_0x782b('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x782b('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0x782b('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 6f8bec0..62c9088 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 _0xb35f=['then','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','merge','find','create','body','destroy','getVoiceQueuesReport','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','limit','count','offset','set','Content-Range','json','reject','save','update'];(function(_0xbd35aa,_0x49e53b){var _0x403a4f=function(_0x6f11e6){while(--_0x6f11e6){_0xbd35aa['push'](_0xbd35aa['shift']());}};_0x403a4f(++_0x49e53b);}(_0xb35f,0xc6));var _0xfb35=function(_0x5c3a91,_0x12292a){_0x5c3a91=_0x5c3a91-0x0;var _0x3f91f2=_0xb35f[_0x5c3a91];return _0x3f91f2;};'use strict';var emlformat=require(_0xfb35('0x0'));var rimraf=require(_0xfb35('0x1'));var zipdir=require(_0xfb35('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfb35('0x3'));var moment=require(_0xfb35('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfb35('0x5'));var util=require(_0xfb35('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfb35('0x7'));var fs=require('fs');var fs_extra=require(_0xfb35('0x8'));var _=require(_0xfb35('0x9'));var squel=require(_0xfb35('0xa'));var crypto=require(_0xfb35('0xb'));var jsforce=require(_0xfb35('0xc'));var deskjs=require(_0xfb35('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfb35('0xe'));var Papa=require('papaparse');var Redis=require(_0xfb35('0xf'));var authService=require(_0xfb35('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfb35('0x11'));var hardwareService=require(_0xfb35('0x12'));var logger=require(_0xfb35('0x13'))(_0xfb35('0x14'));var utils=require(_0xfb35('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfb35('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xfb35('0x17')](config[_0xfb35('0x18')],{'host':_0xfb35('0x19'),'port':0x18eb});var socket=require(_0xfb35('0x1a'))(new Redis(config[_0xfb35('0x18')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x55c774,_0x34f4ba){_0x34f4ba=_0x34f4ba||0xcc;return function(_0x70302e){if(_0x70302e){return _0x55c774[_0xfb35('0x1b')](_0x34f4ba);}return _0x55c774[_0xfb35('0x1c')](_0x34f4ba)[_0xfb35('0x1d')]();};}function respondWithResult(_0x12fe0d,_0x4d6e77){_0x4d6e77=_0x4d6e77||0xc8;return function(_0x5b82fb){if(_0x5b82fb){return _0x12fe0d[_0xfb35('0x1c')](_0x4d6e77)['json'](_0x5b82fb);}};}function respondWithFilteredResult(_0x4c49f0,_0x3cbbbe){return function(_0x15fe8f){if(_0x15fe8f){var _0x5852b0=typeof _0x3cbbbe['offset']==='undefined'&&typeof _0x3cbbbe[_0xfb35('0x1e')]==='undefined';var _0x4d8764=_0x15fe8f[_0xfb35('0x1f')];var _0x2b3c29=_0x5852b0?0x0:_0x3cbbbe[_0xfb35('0x20')];var _0x31233c=_0x5852b0?_0x15fe8f[_0xfb35('0x1f')]:_0x3cbbbe['offset']+_0x3cbbbe[_0xfb35('0x1e')];var _0x5dac29;if(_0x31233c>=_0x4d8764){_0x31233c=_0x4d8764;_0x5dac29=0xc8;}else{_0x5dac29=0xce;}_0x4c49f0['status'](_0x5dac29);return _0x4c49f0[_0xfb35('0x21')](_0xfb35('0x22'),_0x2b3c29+'-'+_0x31233c+'/'+_0x4d8764)[_0xfb35('0x23')](_0x15fe8f);}return null;};}function patchUpdates(_0x2fe89a){return function(_0x10211f){try{jsonpatch['apply'](_0x10211f,_0x2fe89a,!![]);}catch(_0x5602a9){return BPromise[_0xfb35('0x24')](_0x5602a9);}return _0x10211f[_0xfb35('0x25')]();};}function saveUpdates(_0xad3595,_0x11f0b7){return function(_0x59e554){if(_0x59e554){return _0x59e554[_0xfb35('0x26')](_0xad3595)[_0xfb35('0x27')](function(_0x59744f){return _0x59744f;});}return null;};}function removeEntity(_0x4c768e,_0x302721){return function(_0x30f538){if(_0x30f538){return _0x30f538['destroy']()['then'](function(){_0x4c768e['status'](0xcc)[_0xfb35('0x1d')]();});}};}function handleEntityNotFound(_0x47ec38,_0x179247){return function(_0x328923){if(!_0x328923){_0x47ec38['sendStatus'](0x194);}return _0x328923;};}function handleError(_0x3d2b60,_0x34ad4e){_0x34ad4e=_0x34ad4e||0x1f4;return function(_0x28c02d){logger[_0xfb35('0x28')](_0x28c02d[_0xfb35('0x29')]);if(_0x28c02d[_0xfb35('0x2a')]){delete _0x28c02d[_0xfb35('0x2a')];}_0x3d2b60[_0xfb35('0x1c')](_0x34ad4e)[_0xfb35('0x2b')](_0x28c02d);};}exports[_0xfb35('0x2c')]=function(_0x3dc3a1,_0x310026){var _0x3ebfaf={},_0x5529c1={},_0x322786={'count':0x0,'rows':[]};var _0x31c094=_[_0xfb35('0x2d')](db[_0xfb35('0x2e')][_0xfb35('0x2f')],function(_0x5871e6){return{'name':_0x5871e6['fieldName'],'type':_0x5871e6[_0xfb35('0x30')][_0xfb35('0x31')]};});_0x5529c1['model']=_[_0xfb35('0x2d')](_0x31c094,_0xfb35('0x2a'));_0x5529c1[_0xfb35('0x32')]=_[_0xfb35('0x33')](_0x3dc3a1['query']);_0x5529c1[_0xfb35('0x34')]=_[_0xfb35('0x35')](_0x5529c1[_0xfb35('0x36')],_0x5529c1[_0xfb35('0x32')]);_0x3ebfaf[_0xfb35('0x37')]=_[_0xfb35('0x35')](_0x5529c1['model'],qs['fields'](_0x3dc3a1[_0xfb35('0x32')][_0xfb35('0x38')]));_0x3ebfaf[_0xfb35('0x37')]=_0x3ebfaf[_0xfb35('0x37')]['length']?_0x3ebfaf[_0xfb35('0x37')]:_0x5529c1[_0xfb35('0x36')];if(!_0x3dc3a1[_0xfb35('0x32')][_0xfb35('0x39')]('nolimit')){_0x3ebfaf['limit']=qs[_0xfb35('0x1e')](_0x3dc3a1[_0xfb35('0x32')][_0xfb35('0x1e')]);_0x3ebfaf[_0xfb35('0x20')]=qs['offset'](_0x3dc3a1['query'][_0xfb35('0x20')]);}_0x3ebfaf[_0xfb35('0x3a')]=qs[_0xfb35('0x3b')](_0x3dc3a1[_0xfb35('0x32')]['sort']);_0x3ebfaf['where']=qs[_0xfb35('0x34')](_[_0xfb35('0x3c')](_0x3dc3a1[_0xfb35('0x32')],_0x5529c1[_0xfb35('0x34')]),_0x31c094);if(_0x3dc3a1['query'][_0xfb35('0x3d')]){_0x3ebfaf[_0xfb35('0x3e')]=_['merge'](_0x3ebfaf[_0xfb35('0x3e')],{'$or':_[_0xfb35('0x2d')](_0x31c094,function(_0x1341bf){if(_0x1341bf[_0xfb35('0x30')]!==_0xfb35('0x3f')){var _0x4b251f={};_0x4b251f[_0x1341bf[_0xfb35('0x2a')]]={'$like':'%'+_0x3dc3a1[_0xfb35('0x32')][_0xfb35('0x3d')]+'%'};return _0x4b251f;}})});}_0x3ebfaf=_['merge']({},_0x3ebfaf,_0x3dc3a1[_0xfb35('0x40')]);var _0x130ea4={'where':_0x3ebfaf[_0xfb35('0x3e')]};return db[_0xfb35('0x2e')][_0xfb35('0x1f')](_0x130ea4)['then'](function(_0x47d3bb){_0x322786[_0xfb35('0x1f')]=_0x47d3bb;if(_0x3dc3a1[_0xfb35('0x32')][_0xfb35('0x41')]){_0x3ebfaf[_0xfb35('0x42')]=[{'all':!![]}];}return db[_0xfb35('0x2e')][_0xfb35('0x43')](_0x3ebfaf);})[_0xfb35('0x27')](function(_0x2bc25c){_0x322786[_0xfb35('0x44')]=_0x2bc25c;return _0x322786;})[_0xfb35('0x27')](respondWithFilteredResult(_0x310026,_0x3ebfaf))[_0xfb35('0x45')](handleError(_0x310026,null));};exports['show']=function(_0x58ba21,_0x7213be){var _0x43eec9={'raw':![],'where':{'id':_0x58ba21[_0xfb35('0x46')]['id']}},_0x22cd62={};_0x22cd62[_0xfb35('0x36')]=_['keys'](db[_0xfb35('0x2e')][_0xfb35('0x2f')]);_0x22cd62['query']=_[_0xfb35('0x33')](_0x58ba21[_0xfb35('0x32')]);_0x22cd62[_0xfb35('0x34')]=_[_0xfb35('0x35')](_0x22cd62['model'],_0x22cd62[_0xfb35('0x32')]);_0x43eec9['attributes']=_[_0xfb35('0x35')](_0x22cd62[_0xfb35('0x36')],qs[_0xfb35('0x38')](_0x58ba21[_0xfb35('0x32')][_0xfb35('0x38')]));_0x43eec9[_0xfb35('0x37')]=_0x43eec9[_0xfb35('0x37')][_0xfb35('0x47')]?_0x43eec9[_0xfb35('0x37')]:_0x22cd62['model'];if(_0x58ba21[_0xfb35('0x32')][_0xfb35('0x41')]){_0x43eec9['include']=[{'all':!![]}];}_0x43eec9=_[_0xfb35('0x48')]({},_0x43eec9,_0x58ba21['options']);return db[_0xfb35('0x2e')][_0xfb35('0x49')](_0x43eec9)[_0xfb35('0x27')](handleEntityNotFound(_0x7213be,null))[_0xfb35('0x27')](respondWithResult(_0x7213be,null))[_0xfb35('0x45')](handleError(_0x7213be,null));};exports['create']=function(_0x26cdd1,_0xce6af8){return db[_0xfb35('0x2e')][_0xfb35('0x4a')](_0x26cdd1[_0xfb35('0x4b')],{})['then'](respondWithResult(_0xce6af8,0xc9))[_0xfb35('0x45')](handleError(_0xce6af8,null));};exports[_0xfb35('0x26')]=function(_0x96fa5,_0x5e3f72){if(_0x96fa5['body']['id']){delete _0x96fa5[_0xfb35('0x4b')]['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x96fa5['params']['id']}})[_0xfb35('0x27')](handleEntityNotFound(_0x5e3f72,null))[_0xfb35('0x27')](saveUpdates(_0x96fa5[_0xfb35('0x4b')],null))[_0xfb35('0x27')](respondWithResult(_0x5e3f72,null))[_0xfb35('0x45')](handleError(_0x5e3f72,null));};exports[_0xfb35('0x4c')]=function(_0x589584,_0x8a3a5d){return db[_0xfb35('0x2e')][_0xfb35('0x49')]({'where':{'id':_0x589584[_0xfb35('0x46')]['id']}})[_0xfb35('0x27')](handleEntityNotFound(_0x8a3a5d,null))[_0xfb35('0x27')](removeEntity(_0x8a3a5d,null))[_0xfb35('0x45')](handleError(_0x8a3a5d,null));};exports['describe']=function(_0x1e817f,_0x12d18e){return db[_0xfb35('0x2e')]['describe']()[_0xfb35('0x27')](respondWithResult(_0x12d18e,null))['catch'](handleError(_0x12d18e,null));};exports[_0xfb35('0x4d')]=function(_0x1db47b,_0xe984b2){var _0x430186={},_0x39d38b={},_0x219c0c={'count':0x0,'rows':[]};_0x39d38b[_0xfb35('0x36')]=_[_0xfb35('0x33')](db[_0xfb35('0x2e')]['rawAttributes']);_0x39d38b[_0xfb35('0x32')]=_['keys'](_0x1db47b[_0xfb35('0x32')]);_0x39d38b[_0xfb35('0x34')]=_[_0xfb35('0x35')](_0x39d38b[_0xfb35('0x36')],_0x39d38b[_0xfb35('0x32')]);_0x430186[_0xfb35('0x37')]=_[_0xfb35('0x35')](_0x39d38b[_0xfb35('0x36')],qs[_0xfb35('0x38')](_0x1db47b[_0xfb35('0x32')][_0xfb35('0x38')]));_0x430186[_0xfb35('0x37')]=_0x430186[_0xfb35('0x37')][_0xfb35('0x47')]?_0x430186[_0xfb35('0x37')]:_0x39d38b['model'];if(!_0x1db47b[_0xfb35('0x32')][_0xfb35('0x39')](_0xfb35('0x4e'))){_0x430186[_0xfb35('0x1e')]=qs[_0xfb35('0x1e')](_0x1db47b[_0xfb35('0x32')][_0xfb35('0x1e')]);_0x430186[_0xfb35('0x20')]=qs[_0xfb35('0x20')](_0x1db47b['query'][_0xfb35('0x20')]);}_0x430186['order']=qs[_0xfb35('0x3b')](_0x1db47b['query']['sort']);_0x430186['where']=qs[_0xfb35('0x34')](_[_0xfb35('0x3c')](_0x1db47b[_0xfb35('0x32')],_0x39d38b['filters']));if(_0x1db47b['query'][_0xfb35('0x3d')]){_0x430186[_0xfb35('0x3e')]=_['merge'](_0x430186[_0xfb35('0x3e')],{'$or':_[_0xfb35('0x2d')](_0x430186['attributes'],function(_0x236a85){var _0x5c1046={};_0x5c1046[_0x236a85]={'$like':'%'+_0x1db47b[_0xfb35('0x32')]['filter']+'%'};return _0x5c1046;})});}_0x430186=_[_0xfb35('0x48')]({},_0x430186,_0x1db47b[_0xfb35('0x40')]);var _0x20e84e={'where':_0x430186['where']};return db[_0xfb35('0x2e')]['count'](_0x20e84e)[_0xfb35('0x27')](function(_0x470a54){_0x219c0c['count']=_0x470a54;if(_0x1db47b[_0xfb35('0x32')][_0xfb35('0x41')]){_0x430186[_0xfb35('0x42')]=[{'all':!![]}];}return db[_0xfb35('0x2e')][_0xfb35('0x43')](_0x430186);})[_0xfb35('0x27')](function(_0x2d3e94){_0x219c0c[_0xfb35('0x44')]=_0x2d3e94;return _0x219c0c;})[_0xfb35('0x27')](respondWithFilteredResult(_0xe984b2,_0x430186,_0xfb35('0x4d')))['catch'](handleError(_0xe984b2,null,_0xfb35('0x4d')));}; \ No newline at end of file +var _0x535d=['papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','VoiceQueueReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','merge','create','body','find','describe','nolimit','pick','map','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x535d,0x1a2));var _0xd535=function(_0x5017d0,_0x36e6a9){_0x5017d0=_0x5017d0-0x0;var _0x1ebd2b=_0x535d[_0x5017d0];return _0x1ebd2b;};'use strict';var emlformat=require(_0xd535('0x0'));var rimraf=require(_0xd535('0x1'));var zipdir=require(_0xd535('0x2'));var jsonpatch=require(_0xd535('0x3'));var rp=require(_0xd535('0x4'));var moment=require(_0xd535('0x5'));var BPromise=require(_0xd535('0x6'));var Mustache=require(_0xd535('0x7'));var util=require('util');var path=require(_0xd535('0x8'));var sox=require(_0xd535('0x9'));var csv=require(_0xd535('0xa'));var ejs=require(_0xd535('0xb'));var fs=require('fs');var fs_extra=require(_0xd535('0xc'));var _=require(_0xd535('0xd'));var squel=require('squel');var crypto=require(_0xd535('0xe'));var jsforce=require(_0xd535('0xf'));var deskjs=require(_0xd535('0x10'));var toCsv=require(_0xd535('0xa'));var querystring=require('querystring');var Papa=require(_0xd535('0x11'));var Redis=require(_0xd535('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd535('0x13'));var hardwareService=require(_0xd535('0x14'));var logger=require(_0xd535('0x15'))(_0xd535('0x16'));var utils=require(_0xd535('0x17'));var config=require(_0xd535('0x18'));var licenseUtil=require(_0xd535('0x19'));var db=require(_0xd535('0x1a'))['db'];config[_0xd535('0x1b')]=_[_0xd535('0x1c')](config[_0xd535('0x1b')],{'host':_0xd535('0x1d'),'port':0x18eb});var socket=require(_0xd535('0x1e'))(new Redis(config['redis']));require(_0xd535('0x1f'))[_0xd535('0x20')](socket);function respondWithStatusCode(_0x1c1186,_0x24dfaf){_0x24dfaf=_0x24dfaf||0xcc;return function(_0x2df957){if(_0x2df957){return _0x1c1186[_0xd535('0x21')](_0x24dfaf);}return _0x1c1186[_0xd535('0x22')](_0x24dfaf)[_0xd535('0x23')]();};}function respondWithResult(_0xee71ab,_0x16a0d6){_0x16a0d6=_0x16a0d6||0xc8;return function(_0x1f872d){if(_0x1f872d){return _0xee71ab[_0xd535('0x22')](_0x16a0d6)['json'](_0x1f872d);}};}function respondWithFilteredResult(_0x2a1b2d,_0x1e08ee){return function(_0x15de5e){if(_0x15de5e){var _0x440a69=typeof _0x1e08ee[_0xd535('0x24')]===_0xd535('0x25')&&typeof _0x1e08ee[_0xd535('0x26')]==='undefined';var _0x2708a7=_0x15de5e['count'];var _0x35e2d8=_0x440a69?0x0:_0x1e08ee[_0xd535('0x24')];var _0x441024=_0x440a69?_0x15de5e[_0xd535('0x27')]:_0x1e08ee[_0xd535('0x24')]+_0x1e08ee[_0xd535('0x26')];var _0x190eb5;if(_0x441024>=_0x2708a7){_0x441024=_0x2708a7;_0x190eb5=0xc8;}else{_0x190eb5=0xce;}_0x2a1b2d[_0xd535('0x22')](_0x190eb5);return _0x2a1b2d[_0xd535('0x28')](_0xd535('0x29'),_0x35e2d8+'-'+_0x441024+'/'+_0x2708a7)[_0xd535('0x2a')](_0x15de5e);}return null;};}function patchUpdates(_0x359fbe){return function(_0x20dff3){try{jsonpatch[_0xd535('0x2b')](_0x20dff3,_0x359fbe,!![]);}catch(_0x42bbae){return BPromise[_0xd535('0x2c')](_0x42bbae);}return _0x20dff3[_0xd535('0x2d')]();};}function saveUpdates(_0x1dc2ce,_0x50bf9a){return function(_0x16a503){if(_0x16a503){return _0x16a503[_0xd535('0x2e')](_0x1dc2ce)[_0xd535('0x2f')](function(_0x35dab7){return _0x35dab7;});}return null;};}function removeEntity(_0x16f74a,_0x913d64){return function(_0x1088a5){if(_0x1088a5){return _0x1088a5[_0xd535('0x30')]()[_0xd535('0x2f')](function(){_0x16f74a[_0xd535('0x22')](0xcc)[_0xd535('0x23')]();});}};}function handleEntityNotFound(_0x425d11,_0x4b69c4){return function(_0x318f20){if(!_0x318f20){_0x425d11[_0xd535('0x21')](0x194);}return _0x318f20;};}function handleError(_0x280721,_0x25f17a){_0x25f17a=_0x25f17a||0x1f4;return function(_0x5266f7){logger[_0xd535('0x31')](_0x5266f7['stack']);if(_0x5266f7[_0xd535('0x32')]){delete _0x5266f7[_0xd535('0x32')];}_0x280721[_0xd535('0x22')](_0x25f17a)[_0xd535('0x33')](_0x5266f7);};}exports[_0xd535('0x34')]=function(_0x142c2f,_0x53f93f){var _0x1686ce={},_0x552d8d={},_0x3768d4={'count':0x0,'rows':[]};var _0x343e41=_['map'](db[_0xd535('0x35')][_0xd535('0x36')],function(_0x5496ae){return{'name':_0x5496ae['fieldName'],'type':_0x5496ae[_0xd535('0x37')][_0xd535('0x38')]};});_0x552d8d[_0xd535('0x39')]=_['map'](_0x343e41,_0xd535('0x32'));_0x552d8d[_0xd535('0x3a')]=_['keys'](_0x142c2f['query']);_0x552d8d[_0xd535('0x3b')]=_[_0xd535('0x3c')](_0x552d8d['model'],_0x552d8d[_0xd535('0x3a')]);_0x1686ce[_0xd535('0x3d')]=_[_0xd535('0x3c')](_0x552d8d[_0xd535('0x39')],qs[_0xd535('0x3e')](_0x142c2f[_0xd535('0x3a')][_0xd535('0x3e')]));_0x1686ce[_0xd535('0x3d')]=_0x1686ce['attributes'][_0xd535('0x3f')]?_0x1686ce[_0xd535('0x3d')]:_0x552d8d[_0xd535('0x39')];if(!_0x142c2f[_0xd535('0x3a')][_0xd535('0x40')]('nolimit')){_0x1686ce[_0xd535('0x26')]=qs[_0xd535('0x26')](_0x142c2f[_0xd535('0x3a')][_0xd535('0x26')]);_0x1686ce[_0xd535('0x24')]=qs[_0xd535('0x24')](_0x142c2f[_0xd535('0x3a')][_0xd535('0x24')]);}_0x1686ce[_0xd535('0x41')]=qs[_0xd535('0x42')](_0x142c2f[_0xd535('0x3a')][_0xd535('0x42')]);_0x1686ce[_0xd535('0x43')]=qs[_0xd535('0x3b')](_['pick'](_0x142c2f[_0xd535('0x3a')],_0x552d8d['filters']),_0x343e41);if(_0x142c2f[_0xd535('0x3a')]['filter']){_0x1686ce[_0xd535('0x43')]=_['merge'](_0x1686ce[_0xd535('0x43')],{'$or':_['map'](_0x343e41,function(_0x2d0689){if(_0x2d0689[_0xd535('0x37')]!==_0xd535('0x44')){var _0x6d74d8={};_0x6d74d8[_0x2d0689[_0xd535('0x32')]]={'$like':'%'+_0x142c2f[_0xd535('0x3a')][_0xd535('0x45')]+'%'};return _0x6d74d8;}})});}_0x1686ce=_['merge']({},_0x1686ce,_0x142c2f[_0xd535('0x46')]);var _0x5606e3={'where':_0x1686ce[_0xd535('0x43')]};return db[_0xd535('0x35')][_0xd535('0x27')](_0x5606e3)[_0xd535('0x2f')](function(_0x5fa607){_0x3768d4[_0xd535('0x27')]=_0x5fa607;if(_0x142c2f[_0xd535('0x3a')][_0xd535('0x47')]){_0x1686ce[_0xd535('0x48')]=[{'all':!![]}];}return db[_0xd535('0x35')]['findAll'](_0x1686ce);})[_0xd535('0x2f')](function(_0xe64653){_0x3768d4[_0xd535('0x49')]=_0xe64653;return _0x3768d4;})[_0xd535('0x2f')](respondWithFilteredResult(_0x53f93f,_0x1686ce))[_0xd535('0x4a')](handleError(_0x53f93f,null));};exports[_0xd535('0x4b')]=function(_0xb72167,_0x1bc322){var _0x112c23={'raw':![],'where':{'id':_0xb72167[_0xd535('0x4c')]['id']}},_0x33bb48={};_0x33bb48[_0xd535('0x39')]=_[_0xd535('0x4d')](db['VoiceQueueReport']['rawAttributes']);_0x33bb48['query']=_[_0xd535('0x4d')](_0xb72167[_0xd535('0x3a')]);_0x33bb48[_0xd535('0x3b')]=_['intersection'](_0x33bb48[_0xd535('0x39')],_0x33bb48['query']);_0x112c23[_0xd535('0x3d')]=_[_0xd535('0x3c')](_0x33bb48[_0xd535('0x39')],qs[_0xd535('0x3e')](_0xb72167[_0xd535('0x3a')][_0xd535('0x3e')]));_0x112c23[_0xd535('0x3d')]=_0x112c23[_0xd535('0x3d')][_0xd535('0x3f')]?_0x112c23[_0xd535('0x3d')]:_0x33bb48[_0xd535('0x39')];if(_0xb72167['query'][_0xd535('0x47')]){_0x112c23[_0xd535('0x48')]=[{'all':!![]}];}_0x112c23=_[_0xd535('0x4e')]({},_0x112c23,_0xb72167[_0xd535('0x46')]);return db[_0xd535('0x35')]['find'](_0x112c23)[_0xd535('0x2f')](handleEntityNotFound(_0x1bc322,null))[_0xd535('0x2f')](respondWithResult(_0x1bc322,null))[_0xd535('0x4a')](handleError(_0x1bc322,null));};exports[_0xd535('0x4f')]=function(_0x4ad8e4,_0x3bb806){return db[_0xd535('0x35')]['create'](_0x4ad8e4[_0xd535('0x50')],{})[_0xd535('0x2f')](respondWithResult(_0x3bb806,0xc9))[_0xd535('0x4a')](handleError(_0x3bb806,null));};exports[_0xd535('0x2e')]=function(_0x55040b,_0x5d2e00){if(_0x55040b['body']['id']){delete _0x55040b[_0xd535('0x50')]['id'];}return db[_0xd535('0x35')][_0xd535('0x51')]({'where':{'id':_0x55040b[_0xd535('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5d2e00,null))[_0xd535('0x2f')](saveUpdates(_0x55040b[_0xd535('0x50')],null))[_0xd535('0x2f')](respondWithResult(_0x5d2e00,null))['catch'](handleError(_0x5d2e00,null));};exports[_0xd535('0x30')]=function(_0x36f830,_0xe42741){return db['VoiceQueueReport'][_0xd535('0x51')]({'where':{'id':_0x36f830[_0xd535('0x4c')]['id']}})[_0xd535('0x2f')](handleEntityNotFound(_0xe42741,null))[_0xd535('0x2f')](removeEntity(_0xe42741,null))['catch'](handleError(_0xe42741,null));};exports[_0xd535('0x52')]=function(_0x1db024,_0x2e14f2){return db[_0xd535('0x35')][_0xd535('0x52')]()[_0xd535('0x2f')](respondWithResult(_0x2e14f2,null))[_0xd535('0x4a')](handleError(_0x2e14f2,null));};exports['getVoiceQueuesReport']=function(_0x59cffc,_0x4e752b){var _0x5004b0={},_0x21a68d={},_0x5d097c={'count':0x0,'rows':[]};_0x21a68d[_0xd535('0x39')]=_[_0xd535('0x4d')](db[_0xd535('0x35')][_0xd535('0x36')]);_0x21a68d[_0xd535('0x3a')]=_['keys'](_0x59cffc['query']);_0x21a68d[_0xd535('0x3b')]=_[_0xd535('0x3c')](_0x21a68d['model'],_0x21a68d[_0xd535('0x3a')]);_0x5004b0['attributes']=_['intersection'](_0x21a68d[_0xd535('0x39')],qs['fields'](_0x59cffc[_0xd535('0x3a')]['fields']));_0x5004b0[_0xd535('0x3d')]=_0x5004b0['attributes'][_0xd535('0x3f')]?_0x5004b0[_0xd535('0x3d')]:_0x21a68d['model'];if(!_0x59cffc[_0xd535('0x3a')]['hasOwnProperty'](_0xd535('0x53'))){_0x5004b0[_0xd535('0x26')]=qs[_0xd535('0x26')](_0x59cffc[_0xd535('0x3a')]['limit']);_0x5004b0['offset']=qs[_0xd535('0x24')](_0x59cffc['query'][_0xd535('0x24')]);}_0x5004b0['order']=qs[_0xd535('0x42')](_0x59cffc[_0xd535('0x3a')][_0xd535('0x42')]);_0x5004b0[_0xd535('0x43')]=qs[_0xd535('0x3b')](_[_0xd535('0x54')](_0x59cffc[_0xd535('0x3a')],_0x21a68d[_0xd535('0x3b')]));if(_0x59cffc['query'][_0xd535('0x45')]){_0x5004b0['where']=_[_0xd535('0x4e')](_0x5004b0[_0xd535('0x43')],{'$or':_[_0xd535('0x55')](_0x5004b0[_0xd535('0x3d')],function(_0x146ada){var _0xc85dc3={};_0xc85dc3[_0x146ada]={'$like':'%'+_0x59cffc['query'][_0xd535('0x45')]+'%'};return _0xc85dc3;})});}_0x5004b0=_['merge']({},_0x5004b0,_0x59cffc[_0xd535('0x46')]);var _0x1e6f23={'where':_0x5004b0[_0xd535('0x43')]};return db[_0xd535('0x35')]['count'](_0x1e6f23)[_0xd535('0x2f')](function(_0x548f8d){_0x5d097c['count']=_0x548f8d;if(_0x59cffc['query'][_0xd535('0x47')]){_0x5004b0[_0xd535('0x48')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x5004b0);})[_0xd535('0x2f')](function(_0x1d732a){_0x5d097c[_0xd535('0x49')]=_0x1d732a;return _0x5d097c;})[_0xd535('0x2f')](respondWithFilteredResult(_0x4e752b,_0x5004b0,_0xd535('0x56')))['catch'](handleError(_0x4e752b,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index f3b08ae..3892542 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 _0xdd30=['events','VoiceQueueReport','setMaxListeners','save','update','emit','hasOwnProperty','exports'];(function(_0x3b594f,_0x33b91e){var _0xd859df=function(_0x8b1c3){while(--_0x8b1c3){_0x3b594f['push'](_0x3b594f['shift']());}};_0xd859df(++_0x33b91e);}(_0xdd30,0x90));var _0x0dd3=function(_0x38500c,_0x347c56){_0x38500c=_0x38500c-0x0;var _0x50c21d=_0xdd30[_0x38500c];return _0x50c21d;};'use strict';var EventEmitter=require(_0x0dd3('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x0dd3('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x0dd3('0x2')](0x0);var events={'afterCreate':_0x0dd3('0x3'),'afterUpdate':_0x0dd3('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2b2cc6){return function(_0xe14e5b,_0x2de21a,_0x302c1c){VoiceQueueReportEvents['emit'](_0x2b2cc6+':'+_0xe14e5b['id'],_0xe14e5b);VoiceQueueReportEvents[_0x0dd3('0x5')](_0x2b2cc6,_0xe14e5b);_0x302c1c(null);};}for(var e in events){if(events[_0x0dd3('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x0dd3('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x672d=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoiceQueueReport'];(function(_0x33b9ac,_0x1cd671){var _0x4da2a0=function(_0x62ec6b){while(--_0x62ec6b){_0x33b9ac['push'](_0x33b9ac['shift']());}};_0x4da2a0(++_0x1cd671);}(_0x672d,0xc3));var _0xd672=function(_0x4f5f6c,_0x15a990){_0x4f5f6c=_0x4f5f6c-0x0;var _0x3f3fba=_0x672d[_0x4f5f6c];return _0x3f3fba;};'use strict';var EventEmitter=require(_0xd672('0x0'));var VoiceQueueReport=require(_0xd672('0x1'))['db'][_0xd672('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd672('0x3'),'afterUpdate':_0xd672('0x4'),'afterDestroy':_0xd672('0x5')};function emitEvent(_0x5bde88){return function(_0x526b20,_0x1619bc,_0x33e2fc){VoiceQueueReportEvents[_0xd672('0x6')](_0x5bde88+':'+_0x526b20['id'],_0x526b20);VoiceQueueReportEvents[_0xd672('0x6')](_0x5bde88,_0x526b20);_0x33e2fc(null);};}for(var e in events){if(events[_0xd672('0x7')](e)){var event=events[e];VoiceQueueReport[_0xd672('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 0a73a40..19dc0fd 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 _0x6ca5=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api'];(function(_0x3ee621,_0x198f8c){var _0xcfef16=function(_0x119cc2){while(--_0x119cc2){_0x3ee621['push'](_0x3ee621['shift']());}};_0xcfef16(++_0x198f8c);}(_0x6ca5,0x16c));var _0x56ca=function(_0x4afc84,_0x362843){_0x4afc84=_0x4afc84-0x0;var _0x360fe8=_0x6ca5[_0x4afc84];return _0x360fe8;};'use strict';var _=require(_0x56ca('0x0'));var util=require(_0x56ca('0x1'));var logger=require(_0x56ca('0x2'))(_0x56ca('0x3'));var moment=require(_0x56ca('0x4'));var BPromise=require(_0x56ca('0x5'));var rp=require(_0x56ca('0x6'));var fs=require('fs');var path=require(_0x56ca('0x7'));var rimraf=require(_0x56ca('0x8'));var config=require(_0x56ca('0x9'));var attributes=require(_0x56ca('0xa'));module[_0x56ca('0xb')]=function(_0x3b6554,_0x3bbe5a){return _0x3b6554[_0x56ca('0xc')]('VoiceQueueReport',attributes,{'tableName':_0x56ca('0xd'),'paranoid':![],'indexes':[{'fields':[_0x56ca('0xe')]},{'fields':[_0x56ca('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xae6b=['rimraf','exports','define','VoiceQueueReport','uniqueid','calleridnum','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3c3a36,_0x49c795){var _0x477e6a=function(_0x171741){while(--_0x171741){_0x3c3a36['push'](_0x3c3a36['shift']());}};_0x477e6a(++_0x49c795);}(_0xae6b,0x158));var _0xbae6=function(_0x55042e,_0x10aa58){_0x55042e=_0x55042e-0x0;var _0x9871fc=_0xae6b[_0x55042e];return _0x9871fc;};'use strict';var _=require(_0xbae6('0x0'));var util=require('util');var logger=require(_0xbae6('0x1'))(_0xbae6('0x2'));var moment=require(_0xbae6('0x3'));var BPromise=require(_0xbae6('0x4'));var rp=require(_0xbae6('0x5'));var fs=require('fs');var path=require(_0xbae6('0x6'));var rimraf=require(_0xbae6('0x7'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module[_0xbae6('0x8')]=function(_0x47597b,_0x24e0ad){return _0x47597b[_0xbae6('0x9')](_0xbae6('0xa'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xbae6('0xb')]},{'fields':[_0xbae6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 11cc33f..a785fca 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 _0x46e7=['defaults','localhost','socket.io-emitter','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','catch','VoiceQueueReport','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','where','lodash','util','bluebird','../../mysqldb','rpc','../../config/environment','client','http','redis'];(function(_0x590da5,_0x298084){var _0x54d4c4=function(_0xf67551){while(--_0xf67551){_0x590da5['push'](_0x590da5['shift']());}};_0x54d4c4(++_0x298084);}(_0x46e7,0x13f));var _0x746e=function(_0x52c828,_0x25dc17){_0x52c828=_0x52c828-0x0;var _0x371589=_0x46e7[_0x52c828];return _0x371589;};'use strict';var _=require(_0x746e('0x0'));var util=require(_0x746e('0x1'));var moment=require('moment');var BPromise=require(_0x746e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x746e('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x746e('0x4'));var config=require(_0x746e('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x746e('0x6')][_0x746e('0x7')]({'port':0x232a});config[_0x746e('0x8')]=_[_0x746e('0x9')](config[_0x746e('0x8')],{'host':_0x746e('0xa'),'port':0x18eb});var socket=require(_0x746e('0xb'))(new Redis(config[_0x746e('0x8')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x441fc2,_0x112b8c,_0x194066){return new BPromise(function(_0x5a5f71,_0x12b51d){return client[_0x746e('0xc')](_0x441fc2,_0x194066)[_0x746e('0xd')](function(_0xd07953){logger[_0x746e('0xe')](_0x746e('0xf'),_0x112b8c,_0x746e('0x10'));logger[_0x746e('0x11')](_0x746e('0x12'),_0x112b8c,_0x746e('0x10'),JSON[_0x746e('0x13')](_0xd07953));if(_0xd07953[_0x746e('0x14')]){if(_0xd07953[_0x746e('0x14')][_0x746e('0x15')]===0x1f4){logger['error'](_0x746e('0xf'),_0x112b8c,_0xd07953[_0x746e('0x14')][_0x746e('0x16')]);return _0x12b51d(_0xd07953[_0x746e('0x14')]['message']);}logger[_0x746e('0x14')](_0x746e('0xf'),_0x112b8c,_0xd07953['error'][_0x746e('0x16')]);return _0x5a5f71(_0xd07953[_0x746e('0x14')][_0x746e('0x16')]);}else{logger[_0x746e('0xe')](_0x746e('0xf'),_0x112b8c,_0x746e('0x10'));_0x5a5f71(_0xd07953[_0x746e('0x17')]['message']);}})['catch'](function(_0x6e4d20){logger[_0x746e('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x112b8c,_0x6e4d20);_0x12b51d(_0x6e4d20);});});}exports[_0x746e('0x18')]=function(_0x2483dc){var _0x38c663=this;return new Promise(function(_0x261d14,_0x1503b4){return db['VoiceQueueReport'][_0x746e('0x19')]({'raw':_0x2483dc[_0x746e('0x1a')]?_0x2483dc['options'][_0x746e('0x1b')]===undefined?!![]:![]:!![],'where':_0x2483dc[_0x746e('0x1a')]?_0x2483dc[_0x746e('0x1a')]['where']||null:null,'attributes':_0x2483dc['options']?_0x2483dc[_0x746e('0x1a')][_0x746e('0x1c')]||null:null,'limit':_0x2483dc[_0x746e('0x1a')]?_0x2483dc[_0x746e('0x1a')][_0x746e('0x1d')]||null:null,'include':_0x2483dc[_0x746e('0x1a')]?_0x2483dc[_0x746e('0x1a')][_0x746e('0x1e')]?_[_0x746e('0x1f')](_0x2483dc[_0x746e('0x1a')][_0x746e('0x1e')],function(_0x30bcd7){return{'model':db[_0x30bcd7[_0x746e('0x20')]],'as':_0x30bcd7['as'],'attributes':_0x30bcd7[_0x746e('0x1c')],'include':_0x30bcd7[_0x746e('0x1e')]?_['map'](_0x30bcd7[_0x746e('0x1e')],function(_0x485123){return{'model':db[_0x485123[_0x746e('0x20')]],'as':_0x485123['as'],'attributes':_0x485123[_0x746e('0x1c')],'include':_0x485123[_0x746e('0x1e')]?_[_0x746e('0x1f')](_0x485123[_0x746e('0x1e')],function(_0x55fa8f){return{'model':db[_0x55fa8f[_0x746e('0x20')]],'as':_0x55fa8f['as'],'attributes':_0x55fa8f['attributes']};}):[]};}):[]};}):[]:[]})[_0x746e('0xd')](function(_0x10cac9){logger['info'](_0x746e('0x18'),_0x2483dc);logger[_0x746e('0x11')](_0x746e('0x18'),_0x2483dc,JSON[_0x746e('0x13')](_0x10cac9));_0x261d14(_0x10cac9);})[_0x746e('0x21')](function(_0xaa5a48){logger[_0x746e('0x14')](_0x746e('0x18'),_0xaa5a48['message'],_0x2483dc);_0x1503b4(_0x38c663[_0x746e('0x14')](0x1f4,_0xaa5a48['message']));});});};exports['CreateVoiceQueueReport']=function(_0x21a15e){var _0x3e19c1=this;return new Promise(function(_0x8db5db,_0x150651){return db[_0x746e('0x22')][_0x746e('0x23')](_0x21a15e[_0x746e('0x24')],{'raw':_0x21a15e[_0x746e('0x1a')]?_0x21a15e[_0x746e('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x746e('0xd')](function(_0x23f74d){logger[_0x746e('0xe')](_0x746e('0x25'),_0x21a15e);logger[_0x746e('0x11')]('CreateVoiceQueueReport',_0x21a15e,JSON[_0x746e('0x13')](_0x23f74d));_0x8db5db(_0x23f74d);})['catch'](function(_0x24199d){logger[_0x746e('0x14')]('CreateVoiceQueueReport',_0x24199d[_0x746e('0x16')],_0x21a15e);_0x150651(_0x3e19c1[_0x746e('0x14')](0x1f4,_0x24199d['message']));});});};exports[_0x746e('0x26')]=function(_0x5c7be4){var _0x2da952=this;return new Promise(function(_0x389e8c,_0x3bf1f0){return db[_0x746e('0x22')][_0x746e('0x27')](_0x5c7be4[_0x746e('0x24')],{'raw':_0x5c7be4['options']?_0x5c7be4[_0x746e('0x1a')][_0x746e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c7be4[_0x746e('0x1a')]?_0x5c7be4[_0x746e('0x1a')][_0x746e('0x28')]||null:null,'attributes':_0x5c7be4['options']?_0x5c7be4[_0x746e('0x1a')]['attributes']||null:null,'limit':_0x5c7be4['options']?_0x5c7be4[_0x746e('0x1a')][_0x746e('0x1d')]||null:null})[_0x746e('0xd')](function(_0x3f426d){logger['info'](_0x746e('0x26'),_0x5c7be4);logger['debug']('UpdateVoiceQueueReport',_0x5c7be4,JSON['stringify'](_0x3f426d));_0x389e8c(_0x3f426d);})[_0x746e('0x21')](function(_0x51a2a2){logger['error'](_0x746e('0x26'),_0x51a2a2[_0x746e('0x16')],_0x5c7be4);_0x3bf1f0(_0x2da952['error'](0x1f4,_0x51a2a2[_0x746e('0x16')]));});});}; \ No newline at end of file +var _0xa99a=['model','attributes','CreateVoiceQueueReport','UpdateVoiceQueueReport','body','lodash','util','moment','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','info','debug','request\x20sent','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','limit','map','include'];(function(_0x389a26,_0x389051){var _0x12c638=function(_0x35e5bd){while(--_0x35e5bd){_0x389a26['push'](_0x389a26['shift']());}};_0x12c638(++_0x389051);}(_0xa99a,0x1a7));var _0xaa99=function(_0x3177b1,_0x4d2db0){_0x3177b1=_0x3177b1-0x0;var _0x867a86=_0xa99a[_0x3177b1];return _0x867a86;};'use strict';var _=require(_0xaa99('0x0'));var util=require(_0xaa99('0x1'));var moment=require(_0xaa99('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(_0xaa99('0x3'));var logger=require(_0xaa99('0x4'))(_0xaa99('0x5'));var config=require('../../config/environment');var jayson=require(_0xaa99('0x6'));var client=jayson['client'][_0xaa99('0x7')]({'port':0x232a});config[_0xaa99('0x8')]=_['defaults'](config[_0xaa99('0x8')],{'host':_0xaa99('0x9'),'port':0x18eb});var socket=require(_0xaa99('0xa'))(new Redis(config['redis']));require(_0xaa99('0xb'))['register'](socket);function respondWithRpcPromise(_0x3ac071,_0x1e26d7,_0x1a1610){return new BPromise(function(_0x2cf89f,_0x413ec9){return client[_0xaa99('0xc')](_0x3ac071,_0x1a1610)[_0xaa99('0xd')](function(_0x142176){logger[_0xaa99('0xe')]('VoiceQueueReport,\x20%s,\x20%s',_0x1e26d7,'request\x20sent');logger[_0xaa99('0xf')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x1e26d7,_0xaa99('0x10'),JSON[_0xaa99('0x11')](_0x142176));if(_0x142176[_0xaa99('0x12')]){if(_0x142176[_0xaa99('0x12')][_0xaa99('0x13')]===0x1f4){logger[_0xaa99('0x12')](_0xaa99('0x14'),_0x1e26d7,_0x142176['error'][_0xaa99('0x15')]);return _0x413ec9(_0x142176[_0xaa99('0x12')][_0xaa99('0x15')]);}logger[_0xaa99('0x12')](_0xaa99('0x14'),_0x1e26d7,_0x142176[_0xaa99('0x12')]['message']);return _0x2cf89f(_0x142176[_0xaa99('0x12')][_0xaa99('0x15')]);}else{logger[_0xaa99('0xe')](_0xaa99('0x14'),_0x1e26d7,_0xaa99('0x10'));_0x2cf89f(_0x142176[_0xaa99('0x16')][_0xaa99('0x15')]);}})[_0xaa99('0x17')](function(_0x2c0dee){logger[_0xaa99('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x1e26d7,_0x2c0dee);_0x413ec9(_0x2c0dee);});});}exports[_0xaa99('0x18')]=function(_0x15d0f6){var _0x472bbc=this;return new Promise(function(_0x102e26,_0xa7abf){return db[_0xaa99('0x19')][_0xaa99('0x1a')]({'raw':_0x15d0f6['options']?_0x15d0f6[_0xaa99('0x1b')][_0xaa99('0x1c')]===undefined?!![]:![]:!![],'where':_0x15d0f6['options']?_0x15d0f6[_0xaa99('0x1b')][_0xaa99('0x1d')]||null:null,'attributes':_0x15d0f6[_0xaa99('0x1b')]?_0x15d0f6[_0xaa99('0x1b')]['attributes']||null:null,'limit':_0x15d0f6['options']?_0x15d0f6[_0xaa99('0x1b')][_0xaa99('0x1e')]||null:null,'include':_0x15d0f6[_0xaa99('0x1b')]?_0x15d0f6[_0xaa99('0x1b')]['include']?_[_0xaa99('0x1f')](_0x15d0f6[_0xaa99('0x1b')][_0xaa99('0x20')],function(_0x353497){return{'model':db[_0x353497[_0xaa99('0x21')]],'as':_0x353497['as'],'attributes':_0x353497[_0xaa99('0x22')],'include':_0x353497[_0xaa99('0x20')]?_[_0xaa99('0x1f')](_0x353497['include'],function(_0x2bdfcc){return{'model':db[_0x2bdfcc[_0xaa99('0x21')]],'as':_0x2bdfcc['as'],'attributes':_0x2bdfcc[_0xaa99('0x22')],'include':_0x2bdfcc[_0xaa99('0x20')]?_[_0xaa99('0x1f')](_0x2bdfcc[_0xaa99('0x20')],function(_0x1a9df0){return{'model':db[_0x1a9df0[_0xaa99('0x21')]],'as':_0x1a9df0['as'],'attributes':_0x1a9df0[_0xaa99('0x22')]};}):[]};}):[]};}):[]:[]})[_0xaa99('0xd')](function(_0x10cd42){logger['info']('GetVoiceQueueReport',_0x15d0f6);logger[_0xaa99('0xf')](_0xaa99('0x18'),_0x15d0f6,JSON[_0xaa99('0x11')](_0x10cd42));_0x102e26(_0x10cd42);})['catch'](function(_0x2bf791){logger[_0xaa99('0x12')](_0xaa99('0x18'),_0x2bf791[_0xaa99('0x15')],_0x15d0f6);_0xa7abf(_0x472bbc[_0xaa99('0x12')](0x1f4,_0x2bf791[_0xaa99('0x15')]));});});};exports[_0xaa99('0x23')]=function(_0x29ef9b){var _0x56faf7=this;return new Promise(function(_0x26c402,_0x51dce1){return db[_0xaa99('0x19')]['create'](_0x29ef9b['body'],{'raw':_0x29ef9b[_0xaa99('0x1b')]?_0x29ef9b[_0xaa99('0x1b')][_0xaa99('0x1c')]===undefined?!![]:![]:!![]})[_0xaa99('0xd')](function(_0x3e973a){logger[_0xaa99('0xe')]('CreateVoiceQueueReport',_0x29ef9b);logger['debug'](_0xaa99('0x23'),_0x29ef9b,JSON['stringify'](_0x3e973a));_0x26c402(_0x3e973a);})['catch'](function(_0x108689){logger[_0xaa99('0x12')](_0xaa99('0x23'),_0x108689['message'],_0x29ef9b);_0x51dce1(_0x56faf7['error'](0x1f4,_0x108689[_0xaa99('0x15')]));});});};exports[_0xaa99('0x24')]=function(_0x59f7a8){var _0x3ab968=this;return new Promise(function(_0xced023,_0x5655e6){return db[_0xaa99('0x19')]['update'](_0x59f7a8[_0xaa99('0x25')],{'raw':_0x59f7a8['options']?_0x59f7a8['options'][_0xaa99('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59f7a8[_0xaa99('0x1b')]?_0x59f7a8[_0xaa99('0x1b')]['where']||null:null,'attributes':_0x59f7a8[_0xaa99('0x1b')]?_0x59f7a8[_0xaa99('0x1b')][_0xaa99('0x22')]||null:null,'limit':_0x59f7a8[_0xaa99('0x1b')]?_0x59f7a8[_0xaa99('0x1b')][_0xaa99('0x1e')]||null:null})[_0xaa99('0xd')](function(_0x41f190){logger[_0xaa99('0xe')]('UpdateVoiceQueueReport',_0x59f7a8);logger[_0xaa99('0xf')]('UpdateVoiceQueueReport',_0x59f7a8,JSON[_0xaa99('0x11')](_0x41f190));_0xced023(_0x41f190);})[_0xaa99('0x17')](function(_0x4fc51b){logger[_0xaa99('0x12')](_0xaa99('0x24'),_0x4fc51b[_0xaa99('0x15')],_0x59f7a8);_0x5655e6(_0x3ab968[_0xaa99('0x12')](0x1f4,_0x4fc51b[_0xaa99('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 557290a..6f2571c 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 _0x406f=['emit','removeListener','register','length','./voiceQueueReport.events','remove'];(function(_0xad7433,_0x328655){var _0x113410=function(_0x2ee73d){while(--_0x2ee73d){_0xad7433['push'](_0xad7433['shift']());}};_0x113410(++_0x328655);}(_0x406f,0xe8));var _0xf406=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x406f[_0xb24a3e];return _0x4038d7;};'use strict';var VoiceQueueReportEvents=require(_0xf406('0x0'));var events=['save',_0xf406('0x1'),'update'];function createListener(_0x28ed57,_0x444c02){return function(_0x2921ce){_0x444c02[_0xf406('0x2')](_0x28ed57,_0x2921ce);};}function removeListener(_0xbe427a,_0x19221b){return function(){VoiceQueueReportEvents[_0xf406('0x3')](_0xbe427a,_0x19221b);};}exports[_0xf406('0x4')]=function(_0x40542f){for(var _0x235134=0x0,_0x51237b=events[_0xf406('0x5')];_0x235134<_0x51237b;_0x235134++){var _0x18bf2f=events[_0x235134];var _0x1130ae=createListener('voiceQueueReport:'+_0x18bf2f,_0x40542f);VoiceQueueReportEvents['on'](_0x18bf2f,_0x1130ae);}}; \ No newline at end of file +var _0x1061=['register','voiceQueueReport:','./voiceQueueReport.events','emit','removeListener'];(function(_0x54a28a,_0x1ba1fe){var _0x3da1f1=function(_0x7231b5){while(--_0x7231b5){_0x54a28a['push'](_0x54a28a['shift']());}};_0x3da1f1(++_0x1ba1fe);}(_0x1061,0x1b5));var _0x1106=function(_0x3cc670,_0x4e515f){_0x3cc670=_0x3cc670-0x0;var _0x222f13=_0x1061[_0x3cc670];return _0x222f13;};'use strict';var VoiceQueueReportEvents=require(_0x1106('0x0'));var events=['save','remove','update'];function createListener(_0x986553,_0x3a9fe3){return function(_0x3362fc){_0x3a9fe3[_0x1106('0x1')](_0x986553,_0x3362fc);};}function removeListener(_0x1c1bae,_0x13fcfc){return function(){VoiceQueueReportEvents[_0x1106('0x2')](_0x1c1bae,_0x13fcfc);};}exports[_0x1106('0x3')]=function(_0x5120c6){for(var _0x1f098a=0x0,_0x36bfb3=events['length'];_0x1f098a<_0x36bfb3;_0x1f098a++){var _0x523f0f=events[_0x1f098a];var _0x287336=createListener(_0x1106('0x4')+_0x523f0f,_0x5120c6);VoiceQueueReportEvents['on'](_0x523f0f,_0x287336);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 691a16a..16bb6df 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 _0xc16b=['get','isAuthenticated','index','show','post','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./voiceQueuesLog.controller'];(function(_0x2b7e81,_0x4e476a){var _0x3dc222=function(_0x158280){while(--_0x158280){_0x2b7e81['push'](_0x2b7e81['shift']());}};_0x3dc222(++_0x4e476a);}(_0xc16b,0x76));var _0xbc16=function(_0x5bdd2c,_0x8c504f){_0x5bdd2c=_0x5bdd2c-0x0;var _0x23dd44=_0xc16b[_0x5bdd2c];return _0x23dd44;};'use strict';var multer=require(_0xbc16('0x0'));var util=require(_0xbc16('0x1'));var path=require(_0xbc16('0x2'));var timeout=require(_0xbc16('0x3'));var express=require(_0xbc16('0x4'));var router=express[_0xbc16('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbc16('0x6'));var controller=require(_0xbc16('0x7'));router[_0xbc16('0x8')]('/',auth[_0xbc16('0x9')](),controller[_0xbc16('0xa')]);router[_0xbc16('0x8')]('/:id',auth[_0xbc16('0x9')](),controller[_0xbc16('0xb')]);router[_0xbc16('0xc')]('/',auth[_0xbc16('0x9')](),controller['create']);router[_0xbc16('0xd')](_0xbc16('0xe'),auth[_0xbc16('0x9')](),controller['update']);router[_0xbc16('0xf')](_0xbc16('0xe'),auth[_0xbc16('0x9')](),controller[_0xbc16('0x10')]);module[_0xbc16('0x11')]=router; \ No newline at end of file +var _0x84fe=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x221a48,_0x5d80f1){var _0x298b2e=function(_0x40df28){while(--_0x40df28){_0x221a48['push'](_0x221a48['shift']());}};_0x298b2e(++_0x5d80f1);}(_0x84fe,0xdb));var _0xe84f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x84fe[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xe84f('0x0'));var util=require(_0xe84f('0x1'));var path=require(_0xe84f('0x2'));var timeout=require(_0xe84f('0x3'));var express=require(_0xe84f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe84f('0x5'));var interaction=require(_0xe84f('0x6'));var config=require(_0xe84f('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0xe84f('0x8')]('/',auth[_0xe84f('0x9')](),controller[_0xe84f('0xa')]);router['get'](_0xe84f('0xb'),auth[_0xe84f('0x9')](),controller['show']);router[_0xe84f('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xe84f('0xb'),auth[_0xe84f('0x9')](),controller[_0xe84f('0xd')]);router['delete'](_0xe84f('0xb'),auth[_0xe84f('0x9')](),controller[_0xe84f('0xe')]);module[_0xe84f('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 4b6ab1b..cf6549e 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 _0x6fb0=['STRING','DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6fb0,0x12b));var _0x06fb=function(_0x1eec62,_0x198e12){_0x1eec62=_0x1eec62-0x0;var _0x4ab11f=_0x6fb0[_0x1eec62];return _0x4ab11f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x06fb('0x0'));module['exports']={'time':{'type':Sequelize[_0x06fb('0x1')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x06fb('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x06fb('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x06fb('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x06fb('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x06fb('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x06fb('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x06fb('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x06fb('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x06fb('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x06fb('0x2')],'allowNull':![],'defaultValue':Sequelize['literal'](_0x06fb('0x3'))}}; \ No newline at end of file +var _0x54a1=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','STRING'];(function(_0x11b1b3,_0xf3cc69){var _0x437029=function(_0x40499a){while(--_0x40499a){_0x11b1b3['push'](_0x11b1b3['shift']());}};_0x437029(++_0xf3cc69);}(_0x54a1,0xa1));var _0x154a=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x54a1[_0x486f4a];return _0x135d99;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0x154a('0x0')]},'callid':{'type':Sequelize[_0x154a('0x0')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x154a('0x0')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x154a('0x0')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x154a('0x0')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x154a('0x0')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x154a('0x0')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x154a('0x0')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x154a('0x0')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x154a('0x1')](_0x154a('0x2'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 49ecdf2..dc48626 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 _0x5781=['util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','update','eml-format','rimraf','request-promise','moment','mustache'];(function(_0x5ceb69,_0x59e104){var _0x3f6a4d=function(_0x16909c){while(--_0x16909c){_0x5ceb69['push'](_0x5ceb69['shift']());}};_0x3f6a4d(++_0x59e104);}(_0x5781,0xe2));var _0x1578=function(_0x5bd1f6,_0x3a0b1b){_0x5bd1f6=_0x5bd1f6-0x0;var _0x4413a4=_0x5781[_0x5bd1f6];return _0x4413a4;};'use strict';var emlformat=require(_0x1578('0x0'));var rimraf=require(_0x1578('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1578('0x2'));var moment=require(_0x1578('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1578('0x4'));var util=require(_0x1578('0x5'));var path=require('path');var sox=require(_0x1578('0x6'));var csv=require('to-csv');var ejs=require(_0x1578('0x7'));var fs=require('fs');var fs_extra=require(_0x1578('0x8'));var _=require('lodash');var squel=require(_0x1578('0x9'));var crypto=require(_0x1578('0xa'));var jsforce=require(_0x1578('0xb'));var deskjs=require(_0x1578('0xc'));var toCsv=require(_0x1578('0xd'));var querystring=require(_0x1578('0xe'));var Papa=require(_0x1578('0xf'));var Redis=require(_0x1578('0x10'));var authService=require(_0x1578('0x11'));var qs=require(_0x1578('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1578('0x13'));var logger=require(_0x1578('0x14'))(_0x1578('0x15'));var utils=require(_0x1578('0x16'));var config=require(_0x1578('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1578('0x18'))['db'];function respondWithStatusCode(_0x1ffa62,_0x7119c){_0x7119c=_0x7119c||0xcc;return function(_0x3bb771){if(_0x3bb771){return _0x1ffa62[_0x1578('0x19')](_0x7119c);}return _0x1ffa62[_0x1578('0x1a')](_0x7119c)[_0x1578('0x1b')]();};}function respondWithResult(_0x54f799,_0x9954d0){_0x9954d0=_0x9954d0||0xc8;return function(_0x53d5bd){if(_0x53d5bd){return _0x54f799[_0x1578('0x1a')](_0x9954d0)[_0x1578('0x1c')](_0x53d5bd);}};}function respondWithFilteredResult(_0x454d20,_0x4f8576){return function(_0x36adfe){if(_0x36adfe){var _0x3aaf62=typeof _0x4f8576['offset']===_0x1578('0x1d')&&typeof _0x4f8576[_0x1578('0x1e')]===_0x1578('0x1d');var _0x2044d3=_0x36adfe['count'];var _0x52e755=_0x3aaf62?0x0:_0x4f8576[_0x1578('0x1f')];var _0x3509fb=_0x3aaf62?_0x36adfe[_0x1578('0x20')]:_0x4f8576[_0x1578('0x1f')]+_0x4f8576['limit'];var _0x10b041;if(_0x3509fb>=_0x2044d3){_0x3509fb=_0x2044d3;_0x10b041=0xc8;}else{_0x10b041=0xce;}_0x454d20['status'](_0x10b041);return _0x454d20[_0x1578('0x21')](_0x1578('0x22'),_0x52e755+'-'+_0x3509fb+'/'+_0x2044d3)['json'](_0x36adfe);}return null;};}function patchUpdates(_0x5a5c66){return function(_0x45916b){try{jsonpatch[_0x1578('0x23')](_0x45916b,_0x5a5c66,!![]);}catch(_0x5f5a4e){return BPromise[_0x1578('0x24')](_0x5f5a4e);}return _0x45916b[_0x1578('0x25')]();};}function saveUpdates(_0xf8f46c,_0x25abbd){return function(_0x4e5350){if(_0x4e5350){return _0x4e5350['update'](_0xf8f46c)['then'](function(_0x1e0b62){return _0x1e0b62;});}return null;};}function removeEntity(_0x42961f,_0x968ccf){return function(_0x52b91e){if(_0x52b91e){return _0x52b91e[_0x1578('0x26')]()[_0x1578('0x27')](function(){_0x42961f[_0x1578('0x1a')](0xcc)[_0x1578('0x1b')]();});}};}function handleEntityNotFound(_0x375512,_0x1795d0){return function(_0xfc4bc0){if(!_0xfc4bc0){_0x375512[_0x1578('0x19')](0x194);}return _0xfc4bc0;};}function handleError(_0x55875b,_0x1cf76c){_0x1cf76c=_0x1cf76c||0x1f4;return function(_0x4e30f2){logger[_0x1578('0x28')](_0x4e30f2[_0x1578('0x29')]);if(_0x4e30f2['name']){delete _0x4e30f2[_0x1578('0x2a')];}_0x55875b[_0x1578('0x1a')](_0x1cf76c)[_0x1578('0x2b')](_0x4e30f2);};}exports['index']=function(_0x558316,_0x4a1084){var _0x30c7c7={},_0x5cc8dd={},_0x4fcb74={'count':0x0,'rows':[]};var _0x5f2f9c=_[_0x1578('0x2c')](db[_0x1578('0x2d')][_0x1578('0x2e')],function(_0x2a3105){return{'name':_0x2a3105[_0x1578('0x2f')],'type':_0x2a3105[_0x1578('0x30')]['key']};});_0x5cc8dd[_0x1578('0x31')]=_[_0x1578('0x2c')](_0x5f2f9c,_0x1578('0x2a'));_0x5cc8dd['query']=_[_0x1578('0x32')](_0x558316[_0x1578('0x33')]);_0x5cc8dd[_0x1578('0x34')]=_[_0x1578('0x35')](_0x5cc8dd[_0x1578('0x31')],_0x5cc8dd['query']);_0x30c7c7[_0x1578('0x36')]=_['intersection'](_0x5cc8dd[_0x1578('0x31')],qs['fields'](_0x558316[_0x1578('0x33')]['fields']));_0x30c7c7[_0x1578('0x36')]=_0x30c7c7['attributes'][_0x1578('0x37')]?_0x30c7c7['attributes']:_0x5cc8dd[_0x1578('0x31')];if(!_0x558316[_0x1578('0x33')][_0x1578('0x38')](_0x1578('0x39'))){_0x30c7c7[_0x1578('0x1e')]=qs[_0x1578('0x1e')](_0x558316[_0x1578('0x33')]['limit']);_0x30c7c7[_0x1578('0x1f')]=qs['offset'](_0x558316['query']['offset']);}_0x30c7c7['order']=qs['sort'](_0x558316[_0x1578('0x33')][_0x1578('0x3a')]);_0x30c7c7[_0x1578('0x3b')]=qs['filters'](_[_0x1578('0x3c')](_0x558316[_0x1578('0x33')],_0x5cc8dd[_0x1578('0x34')]),_0x5f2f9c);if(_0x558316[_0x1578('0x33')][_0x1578('0x3d')]){_0x30c7c7['where']=_[_0x1578('0x3e')](_0x30c7c7[_0x1578('0x3b')],{'$or':_[_0x1578('0x2c')](_0x5f2f9c,function(_0x166043){if(_0x166043[_0x1578('0x30')]!==_0x1578('0x3f')){var _0x3ace0d={};_0x3ace0d[_0x166043['name']]={'$like':'%'+_0x558316[_0x1578('0x33')]['filter']+'%'};return _0x3ace0d;}})});}_0x30c7c7=_[_0x1578('0x3e')]({},_0x30c7c7,_0x558316[_0x1578('0x40')]);var _0x128e01={'where':_0x30c7c7['where']};return db[_0x1578('0x2d')][_0x1578('0x20')](_0x128e01)[_0x1578('0x27')](function(_0x5ac38a){_0x4fcb74['count']=_0x5ac38a;if(_0x558316[_0x1578('0x33')][_0x1578('0x41')]){_0x30c7c7[_0x1578('0x42')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x1578('0x43')](_0x30c7c7);})['then'](function(_0x25e966){_0x4fcb74[_0x1578('0x44')]=_0x25e966;return _0x4fcb74;})[_0x1578('0x27')](respondWithFilteredResult(_0x4a1084,_0x30c7c7))[_0x1578('0x45')](handleError(_0x4a1084,null));};exports[_0x1578('0x46')]=function(_0x3e0cf4,_0x30364a){var _0x126862={'raw':!![],'where':{'id':_0x3e0cf4[_0x1578('0x47')]['id']}},_0x657046={};_0x657046[_0x1578('0x31')]=_[_0x1578('0x32')](db['VoiceQueuesLog']['rawAttributes']);_0x657046['query']=_[_0x1578('0x32')](_0x3e0cf4[_0x1578('0x33')]);_0x657046[_0x1578('0x34')]=_[_0x1578('0x35')](_0x657046[_0x1578('0x31')],_0x657046[_0x1578('0x33')]);_0x126862['attributes']=_[_0x1578('0x35')](_0x657046[_0x1578('0x31')],qs[_0x1578('0x48')](_0x3e0cf4[_0x1578('0x33')][_0x1578('0x48')]));_0x126862[_0x1578('0x36')]=_0x126862[_0x1578('0x36')][_0x1578('0x37')]?_0x126862[_0x1578('0x36')]:_0x657046[_0x1578('0x31')];if(_0x3e0cf4['query'][_0x1578('0x41')]){_0x126862[_0x1578('0x42')]=[{'all':!![]}];}_0x126862=_[_0x1578('0x3e')]({},_0x126862,_0x3e0cf4[_0x1578('0x40')]);return db[_0x1578('0x2d')][_0x1578('0x49')](_0x126862)[_0x1578('0x27')](handleEntityNotFound(_0x30364a,null))[_0x1578('0x27')](respondWithResult(_0x30364a,null))[_0x1578('0x45')](handleError(_0x30364a,null));};exports[_0x1578('0x4a')]=function(_0x1a8a57,_0x56f7ab){return db[_0x1578('0x2d')]['create'](_0x1a8a57[_0x1578('0x4b')],{})[_0x1578('0x27')](respondWithResult(_0x56f7ab,0xc9))[_0x1578('0x45')](handleError(_0x56f7ab,null));};exports[_0x1578('0x4c')]=function(_0x1e77be,_0x55953c){if(_0x1e77be['body']['id']){delete _0x1e77be['body']['id'];}return db[_0x1578('0x2d')]['find']({'where':{'id':_0x1e77be[_0x1578('0x47')]['id']}})[_0x1578('0x27')](handleEntityNotFound(_0x55953c,null))[_0x1578('0x27')](saveUpdates(_0x1e77be['body'],null))[_0x1578('0x27')](respondWithResult(_0x55953c,null))[_0x1578('0x45')](handleError(_0x55953c,null));};exports['destroy']=function(_0xfe6d5,_0x3b8cd7){return db[_0x1578('0x2d')]['find']({'where':{'id':_0xfe6d5[_0x1578('0x47')]['id']}})[_0x1578('0x27')](handleEntityNotFound(_0x3b8cd7,null))['then'](removeEntity(_0x3b8cd7,null))[_0x1578('0x45')](handleError(_0x3b8cd7,null));}; \ No newline at end of file +var _0x150b=['apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceQueuesLog','count','includeAll','include','findAll','catch','show','params','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','offset','limit','Content-Range'];(function(_0x3f59b1,_0x25cdbe){var _0x11d2e8=function(_0x37b3fc){while(--_0x37b3fc){_0x3f59b1['push'](_0x3f59b1['shift']());}};_0x11d2e8(++_0x25cdbe);}(_0x150b,0xc2));var _0xb150=function(_0x1394a2,_0x533264){_0x1394a2=_0x1394a2-0x0;var _0x31dcd1=_0x150b[_0x1394a2];return _0x31dcd1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb150('0x0'));var zipdir=require(_0xb150('0x1'));var jsonpatch=require(_0xb150('0x2'));var rp=require(_0xb150('0x3'));var moment=require(_0xb150('0x4'));var BPromise=require(_0xb150('0x5'));var Mustache=require(_0xb150('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb150('0x7'));var csv=require(_0xb150('0x8'));var ejs=require(_0xb150('0x9'));var fs=require('fs');var fs_extra=require(_0xb150('0xa'));var _=require(_0xb150('0xb'));var squel=require('squel');var crypto=require(_0xb150('0xc'));var jsforce=require(_0xb150('0xd'));var deskjs=require(_0xb150('0xe'));var toCsv=require(_0xb150('0x8'));var querystring=require(_0xb150('0xf'));var Papa=require('papaparse');var Redis=require(_0xb150('0x10'));var authService=require(_0xb150('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb150('0x12'));var hardwareService=require(_0xb150('0x13'));var logger=require(_0xb150('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xb150('0x15'));var licenseUtil=require(_0xb150('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x280e7e,_0x1481c2){_0x1481c2=_0x1481c2||0xcc;return function(_0x1beaee){if(_0x1beaee){return _0x280e7e[_0xb150('0x17')](_0x1481c2);}return _0x280e7e[_0xb150('0x18')](_0x1481c2)[_0xb150('0x19')]();};}function respondWithResult(_0x26a21b,_0x3ba25d){_0x3ba25d=_0x3ba25d||0xc8;return function(_0x5c0da7){if(_0x5c0da7){return _0x26a21b[_0xb150('0x18')](_0x3ba25d)[_0xb150('0x1a')](_0x5c0da7);}};}function respondWithFilteredResult(_0x225415,_0x14ddda){return function(_0x2ade2e){if(_0x2ade2e){var _0x2210f4=typeof _0x14ddda['offset']===_0xb150('0x1b')&&typeof _0x14ddda['limit']===_0xb150('0x1b');var _0x205c0e=_0x2ade2e['count'];var _0x3554ab=_0x2210f4?0x0:_0x14ddda[_0xb150('0x1c')];var _0x5c3648=_0x2210f4?_0x2ade2e['count']:_0x14ddda[_0xb150('0x1c')]+_0x14ddda[_0xb150('0x1d')];var _0xe1cc13;if(_0x5c3648>=_0x205c0e){_0x5c3648=_0x205c0e;_0xe1cc13=0xc8;}else{_0xe1cc13=0xce;}_0x225415['status'](_0xe1cc13);return _0x225415['set'](_0xb150('0x1e'),_0x3554ab+'-'+_0x5c3648+'/'+_0x205c0e)['json'](_0x2ade2e);}return null;};}function patchUpdates(_0xad69ed){return function(_0x311188){try{jsonpatch[_0xb150('0x1f')](_0x311188,_0xad69ed,!![]);}catch(_0x3c5447){return BPromise[_0xb150('0x20')](_0x3c5447);}return _0x311188[_0xb150('0x21')]();};}function saveUpdates(_0x606e81,_0x5235d8){return function(_0x2d7308){if(_0x2d7308){return _0x2d7308[_0xb150('0x22')](_0x606e81)[_0xb150('0x23')](function(_0x4b4e69){return _0x4b4e69;});}return null;};}function removeEntity(_0x4c0fc4,_0x344ecf){return function(_0x273770){if(_0x273770){return _0x273770[_0xb150('0x24')]()['then'](function(){_0x4c0fc4[_0xb150('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a349,_0x9bef1d){return function(_0x4dd7da){if(!_0x4dd7da){_0x28a349[_0xb150('0x17')](0x194);}return _0x4dd7da;};}function handleError(_0x5463da,_0xe88b57){_0xe88b57=_0xe88b57||0x1f4;return function(_0x321706){logger[_0xb150('0x25')](_0x321706[_0xb150('0x26')]);if(_0x321706['name']){delete _0x321706[_0xb150('0x27')];}_0x5463da['status'](_0xe88b57)[_0xb150('0x28')](_0x321706);};}exports[_0xb150('0x29')]=function(_0x2efa6a,_0x42d321){var _0x185b4a={},_0x2db855={},_0x5845d5={'count':0x0,'rows':[]};var _0x5f4f19=_[_0xb150('0x2a')](db['VoiceQueuesLog'][_0xb150('0x2b')],function(_0x32f5ec){return{'name':_0x32f5ec[_0xb150('0x2c')],'type':_0x32f5ec['type']['key']};});_0x2db855[_0xb150('0x2d')]=_['map'](_0x5f4f19,_0xb150('0x27'));_0x2db855[_0xb150('0x2e')]=_[_0xb150('0x2f')](_0x2efa6a[_0xb150('0x2e')]);_0x2db855[_0xb150('0x30')]=_[_0xb150('0x31')](_0x2db855[_0xb150('0x2d')],_0x2db855[_0xb150('0x2e')]);_0x185b4a['attributes']=_[_0xb150('0x31')](_0x2db855[_0xb150('0x2d')],qs[_0xb150('0x32')](_0x2efa6a[_0xb150('0x2e')]['fields']));_0x185b4a[_0xb150('0x33')]=_0x185b4a[_0xb150('0x33')][_0xb150('0x34')]?_0x185b4a[_0xb150('0x33')]:_0x2db855[_0xb150('0x2d')];if(!_0x2efa6a[_0xb150('0x2e')][_0xb150('0x35')](_0xb150('0x36'))){_0x185b4a[_0xb150('0x1d')]=qs[_0xb150('0x1d')](_0x2efa6a[_0xb150('0x2e')][_0xb150('0x1d')]);_0x185b4a['offset']=qs[_0xb150('0x1c')](_0x2efa6a[_0xb150('0x2e')][_0xb150('0x1c')]);}_0x185b4a[_0xb150('0x37')]=qs['sort'](_0x2efa6a[_0xb150('0x2e')][_0xb150('0x38')]);_0x185b4a[_0xb150('0x39')]=qs['filters'](_[_0xb150('0x3a')](_0x2efa6a[_0xb150('0x2e')],_0x2db855[_0xb150('0x30')]),_0x5f4f19);if(_0x2efa6a[_0xb150('0x2e')][_0xb150('0x3b')]){_0x185b4a['where']=_[_0xb150('0x3c')](_0x185b4a[_0xb150('0x39')],{'$or':_['map'](_0x5f4f19,function(_0x14f267){if(_0x14f267[_0xb150('0x3d')]!==_0xb150('0x3e')){var _0x40b77b={};_0x40b77b[_0x14f267['name']]={'$like':'%'+_0x2efa6a[_0xb150('0x2e')][_0xb150('0x3b')]+'%'};return _0x40b77b;}})});}_0x185b4a=_[_0xb150('0x3c')]({},_0x185b4a,_0x2efa6a[_0xb150('0x3f')]);var _0x23ee36={'where':_0x185b4a[_0xb150('0x39')]};return db[_0xb150('0x40')][_0xb150('0x41')](_0x23ee36)[_0xb150('0x23')](function(_0x1b60e1){_0x5845d5[_0xb150('0x41')]=_0x1b60e1;if(_0x2efa6a[_0xb150('0x2e')][_0xb150('0x42')]){_0x185b4a[_0xb150('0x43')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xb150('0x44')](_0x185b4a);})['then'](function(_0x4dd895){_0x5845d5['rows']=_0x4dd895;return _0x5845d5;})[_0xb150('0x23')](respondWithFilteredResult(_0x42d321,_0x185b4a))[_0xb150('0x45')](handleError(_0x42d321,null));};exports[_0xb150('0x46')]=function(_0x414f08,_0x15bba0){var _0x31b51a={'raw':!![],'where':{'id':_0x414f08[_0xb150('0x47')]['id']}},_0xf8f7c0={};_0xf8f7c0['model']=_[_0xb150('0x2f')](db[_0xb150('0x40')]['rawAttributes']);_0xf8f7c0[_0xb150('0x2e')]=_[_0xb150('0x2f')](_0x414f08[_0xb150('0x2e')]);_0xf8f7c0[_0xb150('0x30')]=_['intersection'](_0xf8f7c0[_0xb150('0x2d')],_0xf8f7c0[_0xb150('0x2e')]);_0x31b51a['attributes']=_[_0xb150('0x31')](_0xf8f7c0[_0xb150('0x2d')],qs['fields'](_0x414f08[_0xb150('0x2e')][_0xb150('0x32')]));_0x31b51a[_0xb150('0x33')]=_0x31b51a[_0xb150('0x33')][_0xb150('0x34')]?_0x31b51a[_0xb150('0x33')]:_0xf8f7c0['model'];if(_0x414f08[_0xb150('0x2e')][_0xb150('0x42')]){_0x31b51a['include']=[{'all':!![]}];}_0x31b51a=_[_0xb150('0x3c')]({},_0x31b51a,_0x414f08[_0xb150('0x3f')]);return db['VoiceQueuesLog']['find'](_0x31b51a)[_0xb150('0x23')](handleEntityNotFound(_0x15bba0,null))[_0xb150('0x23')](respondWithResult(_0x15bba0,null))[_0xb150('0x45')](handleError(_0x15bba0,null));};exports[_0xb150('0x48')]=function(_0x34208a,_0x697d2c){return db['VoiceQueuesLog'][_0xb150('0x48')](_0x34208a[_0xb150('0x49')],{})[_0xb150('0x23')](respondWithResult(_0x697d2c,0xc9))[_0xb150('0x45')](handleError(_0x697d2c,null));};exports[_0xb150('0x22')]=function(_0x5faf6c,_0x553bfb){if(_0x5faf6c[_0xb150('0x49')]['id']){delete _0x5faf6c['body']['id'];}return db[_0xb150('0x40')][_0xb150('0x4a')]({'where':{'id':_0x5faf6c[_0xb150('0x47')]['id']}})[_0xb150('0x23')](handleEntityNotFound(_0x553bfb,null))[_0xb150('0x23')](saveUpdates(_0x5faf6c[_0xb150('0x49')],null))[_0xb150('0x23')](respondWithResult(_0x553bfb,null))[_0xb150('0x45')](handleError(_0x553bfb,null));};exports['destroy']=function(_0x1dcd14,_0x649f1d){return db['VoiceQueuesLog'][_0xb150('0x4a')]({'where':{'id':_0x1dcd14[_0xb150('0x47')]['id']}})[_0xb150('0x23')](handleEntityNotFound(_0x649f1d,null))['then'](removeEntity(_0x649f1d,null))[_0xb150('0x45')](handleError(_0x649f1d,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index b90cdc0..1cceefc 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 _0xd99d=['path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event','dtm','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x3d3706,_0x2e5651){var _0x50ca22=function(_0x9a9208){while(--_0x9a9208){_0x3d3706['push'](_0x3d3706['shift']());}};_0x50ca22(++_0x2e5651);}(_0xd99d,0x1ae));var _0xdd99=function(_0x208f2a,_0x169440){_0x208f2a=_0x208f2a-0x0;var _0x3d101b=_0xd99d[_0x208f2a];return _0x3d101b;};'use strict';var _=require(_0xdd99('0x0'));var util=require('util');var logger=require(_0xdd99('0x1'))(_0xdd99('0x2'));var moment=require('moment');var BPromise=require(_0xdd99('0x3'));var rp=require(_0xdd99('0x4'));var fs=require('fs');var path=require(_0xdd99('0x5'));var rimraf=require(_0xdd99('0x6'));var config=require(_0xdd99('0x7'));var attributes=require(_0xdd99('0x8'));module[_0xdd99('0x9')]=function(_0x2537e5,_0x30b828){return _0x2537e5[_0xdd99('0xa')](_0xdd99('0xb'),attributes,{'tableName':_0xdd99('0xc'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xdd99('0xd'),_0xdd99('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xafcc=['exports','event_dtm','event','dtm','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes'];(function(_0xa7fcd,_0x49d5a3){var _0x2d3429=function(_0x1e4475){while(--_0x1e4475){_0xa7fcd['push'](_0xa7fcd['shift']());}};_0x2d3429(++_0x49d5a3);}(_0xafcc,0x154));var _0xcafc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xafcc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcafc('0x0'));var util=require('util');var logger=require(_0xcafc('0x1'))(_0xcafc('0x2'));var moment=require(_0xcafc('0x3'));var BPromise=require('bluebird');var rp=require(_0xcafc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcafc('0x5'));var config=require(_0xcafc('0x6'));var attributes=require(_0xcafc('0x7'));module[_0xcafc('0x8')]=function(_0x48d41f,_0x5754e4){return _0x48d41f['define']('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xcafc('0x9'),'fields':[_0xcafc('0xa'),_0xcafc('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index b3d5b03..a8d282c 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 _0xa530=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x3e8d4d,_0x850052){var _0x3255ff=function(_0x2b63e9){while(--_0x2b63e9){_0x3e8d4d['push'](_0x3e8d4d['shift']());}};_0x3255ff(++_0x850052);}(_0xa530,0x7a));var _0x0a53=function(_0x21a0cb,_0x5a4cc5){_0x21a0cb=_0x21a0cb-0x0;var _0x2e9bb4=_0xa530[_0x21a0cb];return _0x2e9bb4;};'use strict';var _=require(_0x0a53('0x0'));var util=require(_0x0a53('0x1'));var moment=require('moment');var BPromise=require(_0x0a53('0x2'));var rs=require(_0x0a53('0x3'));var fs=require('fs');var Redis=require(_0x0a53('0x4'));var db=require(_0x0a53('0x5'))['db'];var utils=require(_0x0a53('0x6'));var logger=require(_0x0a53('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0a53('0x8'));var client=jayson[_0x0a53('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3beb8e,_0x3eda64,_0x34286a){return new BPromise(function(_0x19573e,_0x111476){return client[_0x0a53('0xa')](_0x3beb8e,_0x34286a)[_0x0a53('0xb')](function(_0x1e77bd){logger['info'](_0x0a53('0xc'),_0x3eda64,_0x0a53('0xd'));logger['debug'](_0x0a53('0xe'),_0x3eda64,'request\x20sent',JSON[_0x0a53('0xf')](_0x1e77bd));if(_0x1e77bd[_0x0a53('0x10')]){if(_0x1e77bd[_0x0a53('0x10')][_0x0a53('0x11')]===0x1f4){logger[_0x0a53('0x10')](_0x0a53('0xc'),_0x3eda64,_0x1e77bd['error'][_0x0a53('0x12')]);return _0x111476(_0x1e77bd['error'][_0x0a53('0x12')]);}logger[_0x0a53('0x10')](_0x0a53('0xc'),_0x3eda64,_0x1e77bd['error'][_0x0a53('0x12')]);return _0x19573e(_0x1e77bd[_0x0a53('0x10')][_0x0a53('0x12')]);}else{logger['info'](_0x0a53('0xc'),_0x3eda64,_0x0a53('0xd'));_0x19573e(_0x1e77bd[_0x0a53('0x13')][_0x0a53('0x12')]);}})[_0x0a53('0x14')](function(_0x8f543c){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x3eda64,_0x8f543c);_0x111476(_0x8f543c);});});} \ No newline at end of file +var _0x92a2=['VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','then'];(function(_0x4db3ca,_0xae5665){var _0x404a6c=function(_0x522bca){while(--_0x522bca){_0x4db3ca['push'](_0x4db3ca['shift']());}};_0x404a6c(++_0xae5665);}(_0x92a2,0x1ee));var _0x292a=function(_0xc6478a,_0x3ecbea){_0xc6478a=_0xc6478a-0x0;var _0x545ebf=_0x92a2[_0xc6478a];return _0x545ebf;};'use strict';var _=require(_0x292a('0x0'));var util=require(_0x292a('0x1'));var moment=require(_0x292a('0x2'));var BPromise=require(_0x292a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x292a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x292a('0x5'));var logger=require(_0x292a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x292a('0x7'));var client=jayson[_0x292a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b7ec3,_0xde082c,_0x41f1f0){return new BPromise(function(_0x3e5c02,_0x419de4){return client['request'](_0x3b7ec3,_0x41f1f0)[_0x292a('0x9')](function(_0x1beb9d){logger['info'](_0x292a('0xa'),_0xde082c,_0x292a('0xb'));logger['debug'](_0x292a('0xc'),_0xde082c,'request\x20sent',JSON[_0x292a('0xd')](_0x1beb9d));if(_0x1beb9d[_0x292a('0xe')]){if(_0x1beb9d[_0x292a('0xe')][_0x292a('0xf')]===0x1f4){logger[_0x292a('0xe')](_0x292a('0xa'),_0xde082c,_0x1beb9d[_0x292a('0xe')]['message']);return _0x419de4(_0x1beb9d[_0x292a('0xe')][_0x292a('0x10')]);}logger[_0x292a('0xe')](_0x292a('0xa'),_0xde082c,_0x1beb9d[_0x292a('0xe')][_0x292a('0x10')]);return _0x3e5c02(_0x1beb9d['error'][_0x292a('0x10')]);}else{logger['info'](_0x292a('0xa'),_0xde082c,'request\x20sent');_0x3e5c02(_0x1beb9d[_0x292a('0x11')]['message']);}})['catch'](function(_0x3c5b3f){logger[_0x292a('0xe')](_0x292a('0xa'),_0xde082c,_0x3c5b3f);_0x419de4(_0x3c5b3f);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 6b65428..d0f34b5 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 _0xd5ad=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','download','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put'];(function(_0x569d3d,_0x746e94){var _0x20d13=function(_0x52bd3a){while(--_0x52bd3a){_0x569d3d['push'](_0x569d3d['shift']());}};_0x20d13(++_0x746e94);}(_0xd5ad,0xa5));var _0xdd5a=function(_0x10b64e,_0x3cb8bb){_0x10b64e=_0x10b64e-0x0;var _0x35ff06=_0xd5ad[_0x10b64e];return _0x35ff06;};'use strict';var multer=require(_0xdd5a('0x0'));var util=require(_0xdd5a('0x1'));var path=require(_0xdd5a('0x2'));var timeout=require(_0xdd5a('0x3'));var express=require(_0xdd5a('0x4'));var router=express[_0xdd5a('0x5')]();var fs_extra=require(_0xdd5a('0x6'));var auth=require(_0xdd5a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdd5a('0x8'));var controller=require('./voiceRecording.controller');router[_0xdd5a('0x9')]('/',auth[_0xdd5a('0xa')](),controller[_0xdd5a('0xb')]);router[_0xdd5a('0x9')](_0xdd5a('0xc'),auth[_0xdd5a('0xa')](),controller[_0xdd5a('0xd')]);router[_0xdd5a('0x9')](_0xdd5a('0xe'),auth['isAuthenticated'](),controller[_0xdd5a('0xf')]);router[_0xdd5a('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0xdd5a('0x10')]);router[_0xdd5a('0x9')]('/:id/downloads',controller[_0xdd5a('0x11')]);router[_0xdd5a('0x9')](_0xdd5a('0x12'),auth[_0xdd5a('0xa')](),controller[_0xdd5a('0x13')]);router[_0xdd5a('0x14')]('/',auth['isAuthenticated'](),controller[_0xdd5a('0x15')]);router[_0xdd5a('0x14')](_0xdd5a('0x12'),auth['isAuthenticated'](),controller[_0xdd5a('0x16')]);router[_0xdd5a('0x17')]('/:id',auth[_0xdd5a('0xa')](),controller['update']);router[_0xdd5a('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xdd5a('0x19')]);module[_0xdd5a('0x1a')]=router; \ No newline at end of file +var _0x4bf2=['isAuthenticated','index','/describe','describe','/:id','show','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','put','update','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x20f08b,_0x646ea0){var _0x675062=function(_0x266c20){while(--_0x266c20){_0x20f08b['push'](_0x20f08b['shift']());}};_0x675062(++_0x646ea0);}(_0x4bf2,0xbf));var _0x24bf=function(_0x5ede08,_0x11d12e){_0x5ede08=_0x5ede08-0x0;var _0x38c4b1=_0x4bf2[_0x5ede08];return _0x38c4b1;};'use strict';var multer=require(_0x24bf('0x0'));var util=require(_0x24bf('0x1'));var path=require(_0x24bf('0x2'));var timeout=require(_0x24bf('0x3'));var express=require('express');var router=express[_0x24bf('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x24bf('0x5'));var config=require(_0x24bf('0x6'));var controller=require(_0x24bf('0x7'));router[_0x24bf('0x8')]('/',auth[_0x24bf('0x9')](),controller[_0x24bf('0xa')]);router['get'](_0x24bf('0xb'),auth[_0x24bf('0x9')](),controller[_0x24bf('0xc')]);router['get'](_0x24bf('0xd'),auth[_0x24bf('0x9')](),controller[_0x24bf('0xe')]);router[_0x24bf('0x8')]('/:id/download',auth[_0x24bf('0x9')](),controller[_0x24bf('0xf')]);router['get'](_0x24bf('0x10'),controller[_0x24bf('0x11')]);router[_0x24bf('0x8')](_0x24bf('0x12'),auth[_0x24bf('0x9')](),controller[_0x24bf('0x13')]);router[_0x24bf('0x14')]('/',auth[_0x24bf('0x9')](),controller[_0x24bf('0x15')]);router[_0x24bf('0x14')]('/:id/transcribe',auth[_0x24bf('0x9')](),controller['runTranscribe']);router[_0x24bf('0x16')](_0x24bf('0xd'),auth[_0x24bf('0x9')](),controller[_0x24bf('0x17')]);router['delete'](_0x24bf('0xd'),auth[_0x24bf('0x9')](),controller['destroy']);module[_0x24bf('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index fb64d21..62cdc14 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(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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 bb215a2..135644e 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 _0xe18f=['col','token','$and','push','decryptFile','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','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)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','model','format','filters','query','attributes','intersection','fields','length','sort','where','merge','VIRTUAL','filter','options','VoiceRecording','includeAll','include','findAll','rows','catch','keys','find','create','body','params','describe','download','../../components/encryptor','type','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5'];(function(_0xad6d25,_0x4e68f3){var _0x45dd3d=function(_0x282341){while(--_0x282341){_0xad6d25['push'](_0xad6d25['shift']());}};_0x45dd3d(++_0x4e68f3);}(_0xe18f,0x169));var _0xfe18=function(_0x1a7123,_0x543509){_0x1a7123=_0x1a7123-0x0;var _0x3881f4=_0xe18f[_0x1a7123];return _0x3881f4;};'use strict';var emlformat=require(_0xfe18('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfe18('0x1'));var jsonpatch=require(_0xfe18('0x2'));var rp=require(_0xfe18('0x3'));var moment=require(_0xfe18('0x4'));var BPromise=require(_0xfe18('0x5'));var Mustache=require(_0xfe18('0x6'));var util=require('util');var path=require('path');var sox=require(_0xfe18('0x7'));var csv=require(_0xfe18('0x8'));var ejs=require(_0xfe18('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfe18('0xa'));var crypto=require('crypto');var jsforce=require(_0xfe18('0xb'));var deskjs=require(_0xfe18('0xc'));var toCsv=require('to-csv');var querystring=require(_0xfe18('0xd'));var Papa=require(_0xfe18('0xe'));var AWS=require('aws-sdk');var uuidv4=require(_0xfe18('0xf'));var Redis=require(_0xfe18('0x10'));var authService=require(_0xfe18('0x11'));var qs=require(_0xfe18('0x12'));var as=require(_0xfe18('0x13'));var hardwareService=require(_0xfe18('0x14'));var logger=require('../../config/logger')(_0xfe18('0x15'));var utils=require(_0xfe18('0x16'));var config=require(_0xfe18('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe18('0x18'))['db'];function respondWithStatusCode(_0x5cbd93,_0x32ffc0){_0x32ffc0=_0x32ffc0||0xcc;return function(_0x133fa3){if(_0x133fa3){return _0x5cbd93[_0xfe18('0x19')](_0x32ffc0);}return _0x5cbd93[_0xfe18('0x1a')](_0x32ffc0)[_0xfe18('0x1b')]();};}function respondWithResult(_0x209a35,_0x241d6e){_0x241d6e=_0x241d6e||0xc8;return function(_0x2e3c44){if(_0x2e3c44){return _0x209a35[_0xfe18('0x1a')](_0x241d6e)[_0xfe18('0x1c')](_0x2e3c44);}};}function respondWithFilteredResult(_0x1fff47,_0x43978c){return function(_0x1f6aef){if(_0x1f6aef){var _0x2d65ba=typeof _0x43978c[_0xfe18('0x1d')]===_0xfe18('0x1e')&&typeof _0x43978c[_0xfe18('0x1f')]===_0xfe18('0x1e');var _0x23742a=_0x1f6aef[_0xfe18('0x20')];var _0x5487cb=_0x2d65ba?0x0:_0x43978c[_0xfe18('0x1d')];var _0x221ebe=_0x2d65ba?_0x1f6aef['count']:_0x43978c[_0xfe18('0x1d')]+_0x43978c[_0xfe18('0x1f')];var _0x246bb4;if(_0x221ebe>=_0x23742a){_0x221ebe=_0x23742a;_0x246bb4=0xc8;}else{_0x246bb4=0xce;}_0x1fff47['status'](_0x246bb4);return _0x1fff47[_0xfe18('0x21')](_0xfe18('0x22'),_0x5487cb+'-'+_0x221ebe+'/'+_0x23742a)[_0xfe18('0x1c')](_0x1f6aef);}return null;};}function patchUpdates(_0x41630d){return function(_0x32150d){try{jsonpatch[_0xfe18('0x23')](_0x32150d,_0x41630d,!![]);}catch(_0x493eca){return BPromise[_0xfe18('0x24')](_0x493eca);}return _0x32150d[_0xfe18('0x25')]();};}function saveUpdates(_0x11bacb,_0x441afa){return function(_0x1e2e11){if(_0x1e2e11){return _0x1e2e11[_0xfe18('0x26')](_0x11bacb)[_0xfe18('0x27')](function(_0x45bb96){return _0x45bb96;});}return null;};}function removeEntity(_0x24b987,_0x4dbe00){return function(_0x4c5ee6){if(_0x4c5ee6){return _0x4c5ee6[_0xfe18('0x28')]()[_0xfe18('0x27')](function(){_0x24b987[_0xfe18('0x1a')](0xcc)[_0xfe18('0x1b')]();});}};}function handleEntityNotFound(_0x4db634,_0x4d3e54){return function(_0x167b2e){if(!_0x167b2e){_0x4db634[_0xfe18('0x19')](0x194);}return _0x167b2e;};}function handleError(_0x50533b,_0x21288a){_0x21288a=_0x21288a||0x1f4;return function(_0x800f9a){logger[_0xfe18('0x29')](_0x800f9a['stack']);if(_0x800f9a[_0xfe18('0x2a')]){delete _0x800f9a[_0xfe18('0x2a')];}_0x50533b[_0xfe18('0x1a')](_0x21288a)[_0xfe18('0x2b')](_0x800f9a);};}exports[_0xfe18('0x2c')]=function(_0x5e10aa,_0x4aab22){var _0x45587a={},_0xe3f957={},_0x1b3d1a={'count':0x0,'rows':[]};var _0xc9e0a6=_[_0xfe18('0x2d')](db['VoiceRecording'][_0xfe18('0x2e')],function(_0x450730){return{'name':_0x450730[_0xfe18('0x2f')],'type':_0x450730['type'][_0xfe18('0x30')]};});_0xe3f957[_0xfe18('0x31')]=_['differenceBy'](_['map'](_0xc9e0a6,_0xfe18('0x2a')),[_0xfe18('0x32')]);_0xe3f957['query']=_['keys'](_0x5e10aa['query']);_0xe3f957[_0xfe18('0x33')]=_['intersection'](_0xe3f957[_0xfe18('0x31')],_0xe3f957[_0xfe18('0x34')]);_0x45587a[_0xfe18('0x35')]=_[_0xfe18('0x36')](_0xe3f957['model'],qs[_0xfe18('0x37')](_0x5e10aa['query'][_0xfe18('0x37')]));_0x45587a[_0xfe18('0x35')]=_0x45587a['attributes'][_0xfe18('0x38')]?_0x45587a[_0xfe18('0x35')]:_0xe3f957[_0xfe18('0x31')];if(!_0x5e10aa[_0xfe18('0x34')]['hasOwnProperty']('nolimit')){_0x45587a[_0xfe18('0x1f')]=qs[_0xfe18('0x1f')](_0x5e10aa[_0xfe18('0x34')][_0xfe18('0x1f')]);_0x45587a[_0xfe18('0x1d')]=qs['offset'](_0x5e10aa[_0xfe18('0x34')][_0xfe18('0x1d')]);}_0x45587a['order']=qs['sort'](_0x5e10aa[_0xfe18('0x34')][_0xfe18('0x39')]);_0x45587a[_0xfe18('0x3a')]=qs[_0xfe18('0x33')](_['pick'](_0x5e10aa[_0xfe18('0x34')],_0xe3f957[_0xfe18('0x33')]),_0xc9e0a6);if(_0x5e10aa[_0xfe18('0x34')]['filter']){_0x45587a[_0xfe18('0x3a')]=_[_0xfe18('0x3b')](_0x45587a['where'],{'$or':_['map'](_0xc9e0a6,function(_0x2fa3fe){if(_0x2fa3fe['type']!==_0xfe18('0x3c')){var _0x494b18={};_0x494b18[_0x2fa3fe[_0xfe18('0x2a')]]={'$like':'%'+_0x5e10aa[_0xfe18('0x34')][_0xfe18('0x3d')]+'%'};return _0x494b18;}})});}_0x45587a=_[_0xfe18('0x3b')]({},_0x45587a,_0x5e10aa[_0xfe18('0x3e')]);var _0x235660={'where':_0x45587a[_0xfe18('0x3a')]};return db[_0xfe18('0x3f')][_0xfe18('0x20')](_0x235660)[_0xfe18('0x27')](function(_0x906392){_0x1b3d1a[_0xfe18('0x20')]=_0x906392;if(_0x5e10aa[_0xfe18('0x34')][_0xfe18('0x40')]){_0x45587a[_0xfe18('0x41')]=[{'all':!![]}];}return db['VoiceRecording'][_0xfe18('0x42')](_0x45587a);})[_0xfe18('0x27')](function(_0x300e36){_0x1b3d1a[_0xfe18('0x43')]=_0x300e36;return _0x1b3d1a;})[_0xfe18('0x27')](respondWithFilteredResult(_0x4aab22,_0x45587a))[_0xfe18('0x44')](handleError(_0x4aab22,null));};exports['show']=function(_0x45e2d9,_0x5c40bd){var _0x55196c={'raw':![],'where':{'id':_0x45e2d9['params']['id']}},_0x403541={};_0x403541[_0xfe18('0x31')]=_[_0xfe18('0x45')](db[_0xfe18('0x3f')][_0xfe18('0x2e')]);_0x403541[_0xfe18('0x34')]=_[_0xfe18('0x45')](_0x45e2d9[_0xfe18('0x34')]);_0x403541[_0xfe18('0x33')]=_[_0xfe18('0x36')](_0x403541[_0xfe18('0x31')],_0x403541[_0xfe18('0x34')]);_0x55196c['attributes']=_[_0xfe18('0x36')](_0x403541[_0xfe18('0x31')],qs['fields'](_0x45e2d9[_0xfe18('0x34')][_0xfe18('0x37')]));_0x55196c['attributes']=_0x55196c[_0xfe18('0x35')][_0xfe18('0x38')]?_0x55196c['attributes']:_0x403541[_0xfe18('0x31')];if(_0x45e2d9[_0xfe18('0x34')][_0xfe18('0x40')]){_0x55196c[_0xfe18('0x41')]=[{'all':!![]}];}_0x55196c=_[_0xfe18('0x3b')]({},_0x55196c,_0x45e2d9['options']);return db[_0xfe18('0x3f')][_0xfe18('0x46')](_0x55196c)[_0xfe18('0x27')](handleEntityNotFound(_0x5c40bd,null))[_0xfe18('0x27')](respondWithResult(_0x5c40bd,null))[_0xfe18('0x44')](handleError(_0x5c40bd,null));};exports[_0xfe18('0x47')]=function(_0x4c68d5,_0x5cf066){return db['VoiceRecording'][_0xfe18('0x47')](_0x4c68d5[_0xfe18('0x48')],{})['then'](respondWithResult(_0x5cf066,0xc9))[_0xfe18('0x44')](handleError(_0x5cf066,null));};exports[_0xfe18('0x26')]=function(_0x5129a8,_0x42f2df){if(_0x5129a8[_0xfe18('0x48')]['id']){delete _0x5129a8['body']['id'];}return db[_0xfe18('0x3f')]['find']({'where':{'id':_0x5129a8[_0xfe18('0x49')]['id']}})[_0xfe18('0x27')](handleEntityNotFound(_0x42f2df,null))['then'](saveUpdates(_0x5129a8[_0xfe18('0x48')],null))[_0xfe18('0x27')](respondWithResult(_0x42f2df,null))[_0xfe18('0x44')](handleError(_0x42f2df,null));};exports[_0xfe18('0x4a')]=function(_0x59ae44,_0x3560b3){return db[_0xfe18('0x3f')]['describe']()['then'](respondWithResult(_0x3560b3,null))[_0xfe18('0x44')](handleError(_0x3560b3,null));};exports[_0xfe18('0x4b')]=function(_0x2fad37,_0xf609e2,_0x27c6d3){var _0x159084=require(_0xfe18('0x4c'));var _0x3942ca=![];var _0x19b7e4={};if(_0x2fad37[_0xfe18('0x34')]['type']&&_0x2fad37[_0xfe18('0x34')][_0xfe18('0x4d')]===_0xfe18('0x4e')){_0x19b7e4[_0xfe18('0x4e')]=_0x2fad37[_0xfe18('0x49')]['id'];}else{_0x19b7e4['id']=_0x2fad37['params']['id'];}return db['VoiceRecording'][_0xfe18('0x46')]({'where':_0x19b7e4,'attributes':['id',_0xfe18('0x4f')],'raw':!![]})[_0xfe18('0x27')](handleEntityNotFound(_0xf609e2,null))[_0xfe18('0x27')](function(_0x16e9ab){if(_0x16e9ab){var _0xefdc91=_0x16e9ab[_0xfe18('0x4f')];var _0x4c8dff=util[_0xfe18('0x32')](_0xfe18('0x50'),_0xefdc91);if(fs[_0xfe18('0x51')](_0x4c8dff)){_0x3942ca=!![];return _0x159084['decryptFile'](_0x4c8dff,_0xefdc91,config[_0xfe18('0x52')][_0xfe18('0x53')])[_0xfe18('0x27')](function(){return _0x16e9ab;});}return _0x16e9ab;}})[_0xfe18('0x27')](function(_0x3d517e){if(_0x3d517e){var _0x20a009=_0x3d517e[_0xfe18('0x4f')];if(!fs[_0xfe18('0x51')](_0x20a009)){throw new db[(_0xfe18('0x54'))][(_0xfe18('0x55'))](_0xfe18('0x56'));}if(_0x3d517e[_0xfe18('0x57')]){return _0xf609e2[_0xfe18('0x4b')](_0x20a009,_0x3d517e['filename']+path[_0xfe18('0x58')](_0x20a009),function(){if(_0x3942ca){fs[_0xfe18('0x59')](_0x20a009);}});}else{return _0xf609e2[_0xfe18('0x4b')](_0x20a009,function(_0x49f1de){if(_0x3942ca){fs['unlink'](_0x20a009);}});}}})[_0xfe18('0x44')](function(_0x3a826b){if(_0x3a826b[_0xfe18('0x5a')]==='VoiceRecording\x20not\x20found'){_0xf609e2[_0xfe18('0x1a')](0x194)[_0xfe18('0x2b')](_0xfe18('0x5b'));}else{return handleError(_0xf609e2,null);}});};exports[_0xfe18('0x5c')]=function(_0x46af8e,_0x32a0c0,_0x152d86){var _0x20c999=require(_0xfe18('0x4c'));var _0xeddfc0=![];var _0x8dcdc4={'$and':[db[_0xfe18('0x5d')][_0xfe18('0x3a')](db['sequelize']['fn'](_0xfe18('0x5e'),db[_0xfe18('0x5d')][_0xfe18('0x5f')](_0xfe18('0x4e'))),_0x46af8e[_0xfe18('0x34')][_0xfe18('0x60')])]};if(_0x46af8e['query'][_0xfe18('0x4d')]&&_0x46af8e['query'][_0xfe18('0x4d')]===_0xfe18('0x4e')){_0x8dcdc4[_0xfe18('0x61')][_0xfe18('0x62')]({'uniqueid':_0x46af8e[_0xfe18('0x49')]['id']});}else{_0x8dcdc4[_0xfe18('0x61')][_0xfe18('0x62')]({'id':_0x46af8e[_0xfe18('0x49')]['id']});}return db['VoiceRecording'][_0xfe18('0x46')]({'where':_0x8dcdc4,'attributes':['id',_0xfe18('0x4f')],'raw':!![]})[_0xfe18('0x27')](handleEntityNotFound(_0x32a0c0,null))[_0xfe18('0x27')](function(_0x2646ef){if(_0x2646ef){var _0x403b52=util[_0xfe18('0x32')]('%s.cypher',_0x2646ef[_0xfe18('0x4f')]);if(fs['existsSync'](_0x403b52)){_0xeddfc0=!![];return _0x20c999[_0xfe18('0x63')](_0x403b52,_0x2646ef[_0xfe18('0x4f')],config['secrets'][_0xfe18('0x53')])[_0xfe18('0x27')](function(){return _0x2646ef;});}return _0x2646ef;}})['then'](function(_0x19aacb){if(_0x19aacb){if(!fs[_0xfe18('0x51')](_0x19aacb[_0xfe18('0x4f')])){throw new db[(_0xfe18('0x54'))][(_0xfe18('0x55'))](_0xfe18('0x56'));}if(_0x19aacb[_0xfe18('0x57')]){return _0x32a0c0[_0xfe18('0x4b')](_0x19aacb[_0xfe18('0x4f')],_0x19aacb['filename']+path['extname'](_0x19aacb[_0xfe18('0x4f')]),function(){if(_0xeddfc0){fs[_0xfe18('0x59')](_0x19aacb[_0xfe18('0x4f')]);}});}else{return _0x32a0c0[_0xfe18('0x4b')](_0x19aacb[_0xfe18('0x4f')],function(_0x4736b1){if(_0xeddfc0){fs[_0xfe18('0x59')](_0x19aacb[_0xfe18('0x4f')]);}});}}})['catch'](handleError(_0x32a0c0,null));};exports[_0xfe18('0x28')]=function(_0x5d95b1,_0x39329e){return db[_0xfe18('0x3f')][_0xfe18('0x46')]({'where':{'id':_0x5d95b1[_0xfe18('0x49')]['id']}})['then'](function(_0x37679d){if(_[_0xfe18('0x64')](_0x37679d)){throw new ReferenceError(_0xfe18('0x65'));}return _0x37679d;})[_0xfe18('0x27')](function(_0x114461){var _0x55d557=_0x114461[_0xfe18('0x4f')];logger[_0xfe18('0x66')](_0xfe18('0x67'),_0x55d557);if(!_[_0xfe18('0x64')](_0x114461['value'])&&fs['existsSync'](_0x55d557)){logger['info'](_0xfe18('0x68')+_0x55d557+_0xfe18('0x69'));fs[_0xfe18('0x6a')](_0x55d557);}_0x55d557=_0x55d557+_0xfe18('0x6b');if(!_[_0xfe18('0x64')](_0x114461[_0xfe18('0x4f')])&&fs['existsSync'](_0x55d557)){logger[_0xfe18('0x66')]('File:\x20\x22'+_0x55d557+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xfe18('0x6a')](_0x55d557);}return _0x114461;})[_0xfe18('0x27')](function(_0x340853){if(!_0x340853)throw new InternalError();return _0x340853[_0xfe18('0x28')]();})[_0xfe18('0x27')](function(){_0x39329e[_0xfe18('0x1a')](0xcc)['end']();})[_0xfe18('0x44')](handleError(_0x39329e,null));};function getBucketslist(_0x33d3e2,_0x57e3eb,_0x8c5beb){return new Promise(function(_0x59a1ba,_0x4b7c88){var _0x26d196=new AWS['S3']({'accessKeyId':_0x57e3eb,'secretAccessKey':_0x33d3e2,'region':_0x8c5beb});_0x26d196[_0xfe18('0x6c')]({},function(_0x4378ff,_0x244259){if(_0x4378ff){return _0x4b7c88(_0x4378ff);}else{return _0x59a1ba(_0x244259);}});});}function createBucket(_0x12ebcd,_0x216419,_0x312ddb,_0x1a2b1d){return new Promise(function(_0x266138,_0x104032){var _0x12d0da=new AWS['S3']({'accessKeyId':_0x216419,'secretAccessKey':_0x12ebcd,'region':_0x312ddb});_0x12d0da[_0xfe18('0x6d')]({'Bucket':_0x1a2b1d},function(_0x16b6fb,_0x40f77e){if(_0x16b6fb){return _0x104032(_0x16b6fb);}else{return _0x266138(_0x40f77e);}});});}function uploadFile(_0x99ee40,_0x5590a4,_0x167f07,_0x262810,_0x378715,_0x50a717){return new Promise(function(_0x59659d,_0x3022b5){var _0x31d4da=new AWS['S3']({'accessKeyId':_0x5590a4,'secretAccessKey':_0x99ee40,'region':_0x167f07});_0x31d4da['upload']({'Bucket':_0x262810,'Key':_0x378715,'Body':_0x50a717},function(_0x241bc9,_0x52fdea){if(_0x241bc9){return _0x3022b5(_0x241bc9);}else{return _0x59659d(_0x52fdea);}});});}function startTranscribe(_0x5f006f,_0x1fb2ee,_0x4f88cf,_0x36e250,_0xf81cfa,_0x22c00d){return new Promise(function(_0x15a5e7,_0x1d2a81){var _0x1755a5=new AWS[(_0xfe18('0x6e'))]({'accessKeyId':_0x1fb2ee,'secretAccessKey':_0x5f006f,'region':_0x4f88cf});_0x1755a5[_0xfe18('0x6f')]({'TranscriptionJobName':_0x36e250,'LanguageCode':_0xf81cfa,'Media':{'MediaFileUri':_0x22c00d}},function(_0x3328cf,_0x66a99d){if(_0x3328cf){return _0x1d2a81(_0x3328cf);}else{return _0x15a5e7(_0x66a99d);}});});}function transcribe(_0x4f3b15,_0x4f2531,_0x3f140f,_0x35cfdf,_0x6181f3,_0x7f5838,_0x360785){return new Promise(function(_0x10dc5c,_0x5b11e2){var _0x17d388={};logger[_0xfe18('0x66')](util['format'](_0xfe18('0x70'),_0x4f3b15,_0x6181f3));return uploadFile(_0x4f2531,_0x3f140f,_0x35cfdf,_0x6181f3,path[_0xfe18('0x71')](_0x7f5838),fs[_0xfe18('0x72')](_0x7f5838))[_0xfe18('0x27')](function(_0x1df1c8){logger['info'](util['format'](_0xfe18('0x73'),_0x4f3b15,_0x6181f3,_0x1df1c8[_0xfe18('0x74')]));_0x17d388[_0xfe18('0x75')]=_0x1df1c8[_0xfe18('0x76')];_0x17d388[_0xfe18('0x77')]=_0x1df1c8['Location'];logger[_0xfe18('0x66')](util[_0xfe18('0x32')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x4f3b15));return startTranscribe(_0x4f2531,_0x3f140f,_0x35cfdf,uuidv4(),_0x360785,_0x1df1c8[_0xfe18('0x74')]);})['then'](function(_0x107b36){logger[_0xfe18('0x66')](util['format'](_0xfe18('0x78'),_0x4f3b15,_0x107b36[_0xfe18('0x79')][_0xfe18('0x7a')]));_0x17d388[_0xfe18('0x7b')]=_0x107b36['TranscriptionJob']['TranscriptionJobName'];_0x17d388[_0xfe18('0x7c')]=_0x107b36[_0xfe18('0x79')][_0xfe18('0x7d')];return _0x10dc5c(_0x17d388);})[_0xfe18('0x44')](function(_0x43d0a4){return _0x5b11e2(_0x43d0a4);});});}exports[_0xfe18('0x7e')]=function(_0x4c359a,_0x52229e,_0x3ca45b){var _0x208da1;var _0x49f57a;var _0x4f78f8;var _0x5442a7=require('../../components/encryptor');return db[_0xfe18('0x3f')][_0xfe18('0x7f')]({'where':{'id':_0x4c359a[_0xfe18('0x49')]['id']}})[_0xfe18('0x27')](function(_0x1b0e8d){if(_0x1b0e8d){var _0x1d3007=util[_0xfe18('0x32')](_0xfe18('0x50'),_0x1b0e8d[_0xfe18('0x4f')]);if(fs[_0xfe18('0x51')](_0x1d3007)){cypher=!![];return _0x5442a7[_0xfe18('0x63')](_0x1d3007,_0x1b0e8d[_0xfe18('0x4f')],config[_0xfe18('0x52')][_0xfe18('0x53')])['then'](function(){return _0x1b0e8d;});}return _0x1b0e8d;}})[_0xfe18('0x27')](function(_0xfb4a52){if(!_0xfb4a52){throw new db['Sequelize'][(_0xfe18('0x55'))]('Voice\x20Recording\x20not\x20found');}_0x49f57a=_0xfb4a52;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0xfe18('0x27')](handleEntityNotFound(_0x52229e,null))[_0xfe18('0x27')](function(_0xb3717d){if(_0xb3717d){_0x208da1=_0xb3717d;if(!_0x208da1['transcribe']||!_0x208da1['transcribeAccountId']||!_0x208da1[_0xfe18('0x80')]||!_0x208da1[_0xfe18('0x81')]||!_0x208da1[_0xfe18('0x75')]){throw new db[(_0xfe18('0x54'))][(_0xfe18('0x55'))](_0xfe18('0x82'));}if(_0x4c359a['body'][_0xfe18('0x83')]&&(!_0x208da1['sentiment']||!_0x208da1[_0xfe18('0x84')]||!_0x208da1['sentimentRegion']||!_0x208da1['language']||!_0x208da1[_0xfe18('0x75')])){throw new db[(_0xfe18('0x54'))]['ValidationError'](_0xfe18('0x85'));}return db[_0xfe18('0x86')]['findOne']({'where':{'id':_0x208da1[_0xfe18('0x87')]}});}})['then'](function(_0x14dd28){if(!_0x14dd28){throw new db['Sequelize']['ValidationError'](_0xfe18('0x88'));}if(!_0x14dd28[_0xfe18('0x89')]||!_0x14dd28['data2']){throw new db[(_0xfe18('0x54'))][(_0xfe18('0x55'))](_0xfe18('0x8a'));}_0x4f78f8=_0x14dd28;return getBucketslist(_0x4f78f8[_0xfe18('0x89')],_0x4f78f8[_0xfe18('0x8b')],_0x208da1[_0xfe18('0x80')]);})[_0xfe18('0x27')](function(_0x37b184){if(_0x37b184&&_0x37b184[_0xfe18('0x8c')]){var _0x5b1ca9=_[_0xfe18('0x46')](_0x37b184[_0xfe18('0x8c')],function(_0x493bdb){return _0x493bdb[_0xfe18('0x8d')]===_0x208da1[_0xfe18('0x75')];});if(!_0x5b1ca9){logger[_0xfe18('0x66')](util[_0xfe18('0x32')](_0xfe18('0x8e'),_0x4c359a[_0xfe18('0x49')]['id'],_0x208da1[_0xfe18('0x75')]));return createBucket(_0x4f78f8[_0xfe18('0x89')],_0x4f78f8['data2'],_0x208da1['transcribeRegion'],_0x208da1[_0xfe18('0x75')]);}logger[_0xfe18('0x66')](util['format'](_0xfe18('0x8f'),_0x4c359a[_0xfe18('0x49')]['id'],_0x208da1[_0xfe18('0x75')]));return;}})[_0xfe18('0x27')](function(_0x16fd24){if(_0x49f57a[_0xfe18('0x7c')]==='NEW'){return transcribe(_0x4c359a[_0xfe18('0x49')]['id'],_0x4f78f8[_0xfe18('0x89')],_0x4f78f8[_0xfe18('0x8b')],_0x208da1[_0xfe18('0x80')],_0x208da1[_0xfe18('0x75')],_0x49f57a[_0xfe18('0x4f')],_0x208da1[_0xfe18('0x81')]);}else{logger[_0xfe18('0x66')](util['format'](_0xfe18('0x90'),_0x4c359a[_0xfe18('0x49')]['id']));return{'transcribeStatus':_0xfe18('0x91')};}})[_0xfe18('0x27')](function(_0x47927b){if(_0x47927b){_0x47927b[_0xfe18('0x92')]=_0x4c359a[_0xfe18('0x48')][_0xfe18('0x83')];return _0x49f57a['updateAttributes'](_0x47927b);}})[_0xfe18('0x27')](respondWithResult(_0x52229e,null))[_0xfe18('0x44')](handleError(_0x52229e,null));};function writeFile(_0x3adba,_0x2f3caf){return new Promise(function(_0x342a95,_0x381e15){fs['writeFile'](_0x2f3caf,_0x3adba,function(_0x3c72ab,_0xfe48d0){if(_0x3c72ab){return _0x381e15(_0x3c72ab);}else{return _0x342a95(_0xfe48d0);}});});}exports[_0xfe18('0x93')]=function(_0x155cfa,_0x1d2f1f,_0x5eca0f){return db[_0xfe18('0x3f')][_0xfe18('0x7f')]({'where':{'id':_0x155cfa[_0xfe18('0x49')]['id']}})[_0xfe18('0x27')](handleEntityNotFound(_0x1d2f1f))['then'](function(_0x5bf7d7){if(_0x5bf7d7&&_0x5bf7d7[_0xfe18('0x94')]){var _0x893e92=_0x5bf7d7['fileText'];var _0x51e755=config[_0xfe18('0x95')]+'/server/files/transcribes/transcribe_'+_0x5bf7d7['id']+_0xfe18('0x96');if(fs[_0xfe18('0x51')](_0x51e755)){return _0x51e755;}return writeFile(_0x893e92,_0x51e755)[_0xfe18('0x27')](function(){return _0x51e755;});}else{throw new db['Sequelize'][(_0xfe18('0x55'))](_0xfe18('0x97'));}})[_0xfe18('0x27')](function(_0x2e4f82){return _0x1d2f1f[_0xfe18('0x4b')](_0x2e4f82);})[_0xfe18('0x44')](handleError(_0x1d2f1f));}; \ No newline at end of file +var _0xb85b=['jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','index','map','rawAttributes','fieldName','type','key','model','differenceBy','name','format','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','rows','catch','show','VoiceRecording','length','options','find','create','body','params','describe','download','uniqueid','value','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','send','downloads','../../components/encryptor','MD5','sequelize','col','token','$and','push','%s.cypher','existsSync','destroy','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash'];(function(_0x11d372,_0x3ccb76){var _0x14ecff=function(_0x457bdb){while(--_0x457bdb){_0x11d372['push'](_0x11d372['shift']());}};_0x14ecff(++_0x3ccb76);}(_0xb85b,0x129));var _0xbb85=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xb85b[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb85('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb85('0x1'));var rp=require(_0xbb85('0x2'));var moment=require(_0xbb85('0x3'));var BPromise=require(_0xbb85('0x4'));var Mustache=require(_0xbb85('0x5'));var util=require(_0xbb85('0x6'));var path=require(_0xbb85('0x7'));var sox=require('sox');var csv=require(_0xbb85('0x8'));var ejs=require(_0xbb85('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb85('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbb85('0xb'));var deskjs=require(_0xbb85('0xc'));var toCsv=require(_0xbb85('0x8'));var querystring=require(_0xbb85('0xd'));var Papa=require(_0xbb85('0xe'));var AWS=require(_0xbb85('0xf'));var uuidv4=require(_0xbb85('0x10'));var Redis=require('ioredis');var authService=require(_0xbb85('0x11'));var qs=require(_0xbb85('0x12'));var as=require(_0xbb85('0x13'));var hardwareService=require(_0xbb85('0x14'));var logger=require(_0xbb85('0x15'))('api');var utils=require(_0xbb85('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb85('0x17'));var db=require(_0xbb85('0x18'))['db'];function respondWithStatusCode(_0x4474dd,_0x51b733){_0x51b733=_0x51b733||0xcc;return function(_0x10bdbb){if(_0x10bdbb){return _0x4474dd[_0xbb85('0x19')](_0x51b733);}return _0x4474dd[_0xbb85('0x1a')](_0x51b733)[_0xbb85('0x1b')]();};}function respondWithResult(_0x270a90,_0x8fa331){_0x8fa331=_0x8fa331||0xc8;return function(_0x3320b6){if(_0x3320b6){return _0x270a90[_0xbb85('0x1a')](_0x8fa331)[_0xbb85('0x1c')](_0x3320b6);}};}function respondWithFilteredResult(_0x3d283e,_0x532117){return function(_0x556570){if(_0x556570){var _0x3570e2=typeof _0x532117['offset']===_0xbb85('0x1d')&&typeof _0x532117[_0xbb85('0x1e')]===_0xbb85('0x1d');var _0x5ef497=_0x556570[_0xbb85('0x1f')];var _0x5ed55b=_0x3570e2?0x0:_0x532117[_0xbb85('0x20')];var _0x2f0a45=_0x3570e2?_0x556570[_0xbb85('0x1f')]:_0x532117[_0xbb85('0x20')]+_0x532117['limit'];var _0x4a2899;if(_0x2f0a45>=_0x5ef497){_0x2f0a45=_0x5ef497;_0x4a2899=0xc8;}else{_0x4a2899=0xce;}_0x3d283e[_0xbb85('0x1a')](_0x4a2899);return _0x3d283e[_0xbb85('0x21')](_0xbb85('0x22'),_0x5ed55b+'-'+_0x2f0a45+'/'+_0x5ef497)[_0xbb85('0x1c')](_0x556570);}return null;};}function patchUpdates(_0x18ca69){return function(_0xb364ab){try{jsonpatch[_0xbb85('0x23')](_0xb364ab,_0x18ca69,!![]);}catch(_0x5c793d){return BPromise['reject'](_0x5c793d);}return _0xb364ab[_0xbb85('0x24')]();};}function saveUpdates(_0x27d00a,_0x3d6d4b){return function(_0x3b849c){if(_0x3b849c){return _0x3b849c[_0xbb85('0x25')](_0x27d00a)[_0xbb85('0x26')](function(_0x4ef548){return _0x4ef548;});}return null;};}function removeEntity(_0x3cd8cd,_0x3ea220){return function(_0x4f219d){if(_0x4f219d){return _0x4f219d['destroy']()[_0xbb85('0x26')](function(){_0x3cd8cd[_0xbb85('0x1a')](0xcc)[_0xbb85('0x1b')]();});}};}function handleEntityNotFound(_0x139e03,_0x5c1c33){return function(_0x344539){if(!_0x344539){_0x139e03['sendStatus'](0x194);}return _0x344539;};}function handleError(_0x4a9a4f,_0x200e68){_0x200e68=_0x200e68||0x1f4;return function(_0x3e1a77){logger['error'](_0x3e1a77['stack']);if(_0x3e1a77['name']){delete _0x3e1a77['name'];}_0x4a9a4f[_0xbb85('0x1a')](_0x200e68)['send'](_0x3e1a77);};}exports[_0xbb85('0x27')]=function(_0x593b32,_0x10a2b1){var _0x39c7e0={},_0x131ce2={},_0x34413e={'count':0x0,'rows':[]};var _0x29c3c7=_[_0xbb85('0x28')](db['VoiceRecording'][_0xbb85('0x29')],function(_0x5a0856){return{'name':_0x5a0856[_0xbb85('0x2a')],'type':_0x5a0856[_0xbb85('0x2b')][_0xbb85('0x2c')]};});_0x131ce2[_0xbb85('0x2d')]=_[_0xbb85('0x2e')](_[_0xbb85('0x28')](_0x29c3c7,_0xbb85('0x2f')),[_0xbb85('0x30')]);_0x131ce2[_0xbb85('0x31')]=_[_0xbb85('0x32')](_0x593b32[_0xbb85('0x31')]);_0x131ce2[_0xbb85('0x33')]=_[_0xbb85('0x34')](_0x131ce2[_0xbb85('0x2d')],_0x131ce2[_0xbb85('0x31')]);_0x39c7e0[_0xbb85('0x35')]=_[_0xbb85('0x34')](_0x131ce2[_0xbb85('0x2d')],qs[_0xbb85('0x36')](_0x593b32[_0xbb85('0x31')]['fields']));_0x39c7e0[_0xbb85('0x35')]=_0x39c7e0['attributes']['length']?_0x39c7e0['attributes']:_0x131ce2[_0xbb85('0x2d')];if(!_0x593b32[_0xbb85('0x31')]['hasOwnProperty'](_0xbb85('0x37'))){_0x39c7e0[_0xbb85('0x1e')]=qs[_0xbb85('0x1e')](_0x593b32['query'][_0xbb85('0x1e')]);_0x39c7e0[_0xbb85('0x20')]=qs['offset'](_0x593b32[_0xbb85('0x31')][_0xbb85('0x20')]);}_0x39c7e0[_0xbb85('0x38')]=qs[_0xbb85('0x39')](_0x593b32[_0xbb85('0x31')][_0xbb85('0x39')]);_0x39c7e0[_0xbb85('0x3a')]=qs[_0xbb85('0x33')](_[_0xbb85('0x3b')](_0x593b32[_0xbb85('0x31')],_0x131ce2[_0xbb85('0x33')]),_0x29c3c7);if(_0x593b32[_0xbb85('0x31')]['filter']){_0x39c7e0[_0xbb85('0x3a')]=_[_0xbb85('0x3c')](_0x39c7e0[_0xbb85('0x3a')],{'$or':_[_0xbb85('0x28')](_0x29c3c7,function(_0x2c9e18){if(_0x2c9e18[_0xbb85('0x2b')]!==_0xbb85('0x3d')){var _0x1a42ee={};_0x1a42ee[_0x2c9e18[_0xbb85('0x2f')]]={'$like':'%'+_0x593b32[_0xbb85('0x31')][_0xbb85('0x3e')]+'%'};return _0x1a42ee;}})});}_0x39c7e0=_['merge']({},_0x39c7e0,_0x593b32['options']);var _0x8c4f79={'where':_0x39c7e0['where']};return db['VoiceRecording'][_0xbb85('0x1f')](_0x8c4f79)[_0xbb85('0x26')](function(_0x1c1063){_0x34413e['count']=_0x1c1063;if(_0x593b32['query']['includeAll']){_0x39c7e0[_0xbb85('0x3f')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x39c7e0);})[_0xbb85('0x26')](function(_0x22b03b){_0x34413e[_0xbb85('0x40')]=_0x22b03b;return _0x34413e;})['then'](respondWithFilteredResult(_0x10a2b1,_0x39c7e0))[_0xbb85('0x41')](handleError(_0x10a2b1,null));};exports[_0xbb85('0x42')]=function(_0x17d0a0,_0x1744e4){var _0x5bfdb0={'raw':![],'where':{'id':_0x17d0a0['params']['id']}},_0x3aed0d={};_0x3aed0d['model']=_[_0xbb85('0x32')](db[_0xbb85('0x43')]['rawAttributes']);_0x3aed0d['query']=_[_0xbb85('0x32')](_0x17d0a0[_0xbb85('0x31')]);_0x3aed0d[_0xbb85('0x33')]=_[_0xbb85('0x34')](_0x3aed0d[_0xbb85('0x2d')],_0x3aed0d[_0xbb85('0x31')]);_0x5bfdb0[_0xbb85('0x35')]=_[_0xbb85('0x34')](_0x3aed0d[_0xbb85('0x2d')],qs[_0xbb85('0x36')](_0x17d0a0[_0xbb85('0x31')][_0xbb85('0x36')]));_0x5bfdb0[_0xbb85('0x35')]=_0x5bfdb0[_0xbb85('0x35')][_0xbb85('0x44')]?_0x5bfdb0['attributes']:_0x3aed0d[_0xbb85('0x2d')];if(_0x17d0a0[_0xbb85('0x31')]['includeAll']){_0x5bfdb0[_0xbb85('0x3f')]=[{'all':!![]}];}_0x5bfdb0=_[_0xbb85('0x3c')]({},_0x5bfdb0,_0x17d0a0[_0xbb85('0x45')]);return db[_0xbb85('0x43')][_0xbb85('0x46')](_0x5bfdb0)[_0xbb85('0x26')](handleEntityNotFound(_0x1744e4,null))[_0xbb85('0x26')](respondWithResult(_0x1744e4,null))[_0xbb85('0x41')](handleError(_0x1744e4,null));};exports[_0xbb85('0x47')]=function(_0x139436,_0x1337f2){return db['VoiceRecording'][_0xbb85('0x47')](_0x139436[_0xbb85('0x48')],{})[_0xbb85('0x26')](respondWithResult(_0x1337f2,0xc9))[_0xbb85('0x41')](handleError(_0x1337f2,null));};exports['update']=function(_0x4c4caa,_0x414ce8){if(_0x4c4caa[_0xbb85('0x48')]['id']){delete _0x4c4caa[_0xbb85('0x48')]['id'];}return db[_0xbb85('0x43')][_0xbb85('0x46')]({'where':{'id':_0x4c4caa[_0xbb85('0x49')]['id']}})[_0xbb85('0x26')](handleEntityNotFound(_0x414ce8,null))[_0xbb85('0x26')](saveUpdates(_0x4c4caa[_0xbb85('0x48')],null))['then'](respondWithResult(_0x414ce8,null))[_0xbb85('0x41')](handleError(_0x414ce8,null));};exports[_0xbb85('0x4a')]=function(_0x230ecb,_0x1ab504){return db[_0xbb85('0x43')][_0xbb85('0x4a')]()['then'](respondWithResult(_0x1ab504,null))['catch'](handleError(_0x1ab504,null));};exports[_0xbb85('0x4b')]=function(_0x5b3bb6,_0x431d32,_0x26928a){var _0x23afc2=require('../../components/encryptor');var _0x3d7790=![];var _0x3414f6={};if(_0x5b3bb6[_0xbb85('0x31')][_0xbb85('0x2b')]&&_0x5b3bb6[_0xbb85('0x31')][_0xbb85('0x2b')]===_0xbb85('0x4c')){_0x3414f6[_0xbb85('0x4c')]=_0x5b3bb6[_0xbb85('0x49')]['id'];}else{_0x3414f6['id']=_0x5b3bb6[_0xbb85('0x49')]['id'];}return db[_0xbb85('0x43')][_0xbb85('0x46')]({'where':_0x3414f6,'attributes':['id',_0xbb85('0x4d')],'raw':!![]})[_0xbb85('0x26')](handleEntityNotFound(_0x431d32,null))[_0xbb85('0x26')](function(_0x28256a){if(_0x28256a){var _0x11a55a=_0x28256a[_0xbb85('0x4d')];var _0x55eb25=util[_0xbb85('0x30')]('%s.cypher',_0x11a55a);if(fs['existsSync'](_0x55eb25)){_0x3d7790=!![];return _0x23afc2[_0xbb85('0x4e')](_0x55eb25,_0x11a55a,config[_0xbb85('0x4f')][_0xbb85('0x50')])[_0xbb85('0x26')](function(){return _0x28256a;});}return _0x28256a;}})[_0xbb85('0x26')](function(_0x4a1254){if(_0x4a1254){var _0x781df9=_0x4a1254['value'];if(!fs['existsSync'](_0x781df9)){throw new db[(_0xbb85('0x51'))][(_0xbb85('0x52'))](_0xbb85('0x53'));}if(_0x4a1254['filename']){return _0x431d32['download'](_0x781df9,_0x4a1254[_0xbb85('0x54')]+path[_0xbb85('0x55')](_0x781df9),function(){if(_0x3d7790){fs['unlink'](_0x781df9);}});}else{return _0x431d32['download'](_0x781df9,function(_0xb053c8){if(_0x3d7790){fs[_0xbb85('0x56')](_0x781df9);}});}}})[_0xbb85('0x41')](function(_0x3b6960){if(_0x3b6960['message']===_0xbb85('0x53')){_0x431d32[_0xbb85('0x1a')](0x194)[_0xbb85('0x57')]('Not\x20found');}else{return handleError(_0x431d32,null);}});};exports[_0xbb85('0x58')]=function(_0xf07348,_0x44e268,_0x36f849){var _0x25aa27=require(_0xbb85('0x59'));var _0x2dcac3=![];var _0x33c333={'$and':[db['sequelize']['where'](db['sequelize']['fn'](_0xbb85('0x5a'),db[_0xbb85('0x5b')][_0xbb85('0x5c')](_0xbb85('0x4c'))),_0xf07348[_0xbb85('0x31')][_0xbb85('0x5d')])]};if(_0xf07348[_0xbb85('0x31')][_0xbb85('0x2b')]&&_0xf07348[_0xbb85('0x31')][_0xbb85('0x2b')]===_0xbb85('0x4c')){_0x33c333[_0xbb85('0x5e')][_0xbb85('0x5f')]({'uniqueid':_0xf07348[_0xbb85('0x49')]['id']});}else{_0x33c333[_0xbb85('0x5e')][_0xbb85('0x5f')]({'id':_0xf07348[_0xbb85('0x49')]['id']});}return db['VoiceRecording']['find']({'where':_0x33c333,'attributes':['id',_0xbb85('0x4d')],'raw':!![]})[_0xbb85('0x26')](handleEntityNotFound(_0x44e268,null))[_0xbb85('0x26')](function(_0x2325a3){if(_0x2325a3){var _0x44dd4d=util[_0xbb85('0x30')](_0xbb85('0x60'),_0x2325a3['value']);if(fs[_0xbb85('0x61')](_0x44dd4d)){_0x2dcac3=!![];return _0x25aa27[_0xbb85('0x4e')](_0x44dd4d,_0x2325a3[_0xbb85('0x4d')],config['secrets'][_0xbb85('0x50')])[_0xbb85('0x26')](function(){return _0x2325a3;});}return _0x2325a3;}})[_0xbb85('0x26')](function(_0x922fa6){if(_0x922fa6){if(!fs[_0xbb85('0x61')](_0x922fa6[_0xbb85('0x4d')])){throw new db[(_0xbb85('0x51'))][(_0xbb85('0x52'))](_0xbb85('0x53'));}if(_0x922fa6[_0xbb85('0x54')]){return _0x44e268[_0xbb85('0x4b')](_0x922fa6[_0xbb85('0x4d')],_0x922fa6[_0xbb85('0x54')]+path[_0xbb85('0x55')](_0x922fa6[_0xbb85('0x4d')]),function(){if(_0x2dcac3){fs[_0xbb85('0x56')](_0x922fa6[_0xbb85('0x4d')]);}});}else{return _0x44e268[_0xbb85('0x4b')](_0x922fa6['value'],function(_0x5c81e7){if(_0x2dcac3){fs['unlink'](_0x922fa6[_0xbb85('0x4d')]);}});}}})['catch'](handleError(_0x44e268,null));};exports[_0xbb85('0x62')]=function(_0x160398,_0x2c6b87){return db[_0xbb85('0x43')][_0xbb85('0x46')]({'where':{'id':_0x160398[_0xbb85('0x49')]['id']}})[_0xbb85('0x26')](function(_0x4ec2b8){if(_[_0xbb85('0x63')](_0x4ec2b8)){throw new ReferenceError(_0xbb85('0x64'));}return _0x4ec2b8;})[_0xbb85('0x26')](function(_0x5ba443){var _0x13091f=_0x5ba443[_0xbb85('0x4d')];logger['info'](_0xbb85('0x65'),_0x13091f);if(!_['isNil'](_0x5ba443[_0xbb85('0x4d')])&&fs[_0xbb85('0x61')](_0x13091f)){logger[_0xbb85('0x66')]('File:\x20\x22'+_0x13091f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x13091f);}_0x13091f=_0x13091f+'.cypher';if(!_[_0xbb85('0x63')](_0x5ba443[_0xbb85('0x4d')])&&fs[_0xbb85('0x61')](_0x13091f)){logger[_0xbb85('0x66')](_0xbb85('0x67')+_0x13091f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xbb85('0x68')](_0x13091f);}return _0x5ba443;})[_0xbb85('0x26')](function(_0x321df4){if(!_0x321df4)throw new InternalError();return _0x321df4['destroy']();})[_0xbb85('0x26')](function(){_0x2c6b87[_0xbb85('0x1a')](0xcc)[_0xbb85('0x1b')]();})[_0xbb85('0x41')](handleError(_0x2c6b87,null));};function getBucketslist(_0x4e9d89,_0x5ecc61,_0x109f6d){return new Promise(function(_0xe82fa2,_0x4c71d8){var _0x4edeac=new AWS['S3']({'accessKeyId':_0x5ecc61,'secretAccessKey':_0x4e9d89,'region':_0x109f6d});_0x4edeac[_0xbb85('0x69')]({},function(_0x584377,_0x1a99f6){if(_0x584377){return _0x4c71d8(_0x584377);}else{return _0xe82fa2(_0x1a99f6);}});});}function createBucket(_0x36a719,_0x2cfd75,_0x287735,_0x493413){return new Promise(function(_0x3a6f27,_0x2eb5fd){var _0x290d6a=new AWS['S3']({'accessKeyId':_0x2cfd75,'secretAccessKey':_0x36a719,'region':_0x287735});_0x290d6a['createBucket']({'Bucket':_0x493413},function(_0x1fe0ef,_0x4396d8){if(_0x1fe0ef){return _0x2eb5fd(_0x1fe0ef);}else{return _0x3a6f27(_0x4396d8);}});});}function uploadFile(_0x45a53c,_0x29d3a6,_0x4577c0,_0x365486,_0x1f1443,_0x4adae7){return new Promise(function(_0x462f5b,_0x5d8d36){var _0x2a1125=new AWS['S3']({'accessKeyId':_0x29d3a6,'secretAccessKey':_0x45a53c,'region':_0x4577c0});_0x2a1125[_0xbb85('0x6a')]({'Bucket':_0x365486,'Key':_0x1f1443,'Body':_0x4adae7},function(_0x274370,_0x1b77ef){if(_0x274370){return _0x5d8d36(_0x274370);}else{return _0x462f5b(_0x1b77ef);}});});}function startTranscribe(_0x4ac35f,_0x3ce468,_0x4c2750,_0x67e15c,_0x6439d5,_0xec5f79){return new Promise(function(_0x1397f7,_0x5d7058){var _0x4a3cee=new AWS[(_0xbb85('0x6b'))]({'accessKeyId':_0x3ce468,'secretAccessKey':_0x4ac35f,'region':_0x4c2750});_0x4a3cee[_0xbb85('0x6c')]({'TranscriptionJobName':_0x67e15c,'LanguageCode':_0x6439d5,'Media':{'MediaFileUri':_0xec5f79}},function(_0x12ebdb,_0x11fc95){if(_0x12ebdb){return _0x5d7058(_0x12ebdb);}else{return _0x1397f7(_0x11fc95);}});});}function transcribe(_0x3a242b,_0x87902d,_0xfe939,_0x12f6c0,_0x1a38b2,_0x553249,_0x2f0255){return new Promise(function(_0x502057,_0xd14753){var _0x2172ed={};logger[_0xbb85('0x66')](util['format'](_0xbb85('0x6d'),_0x3a242b,_0x1a38b2));return uploadFile(_0x87902d,_0xfe939,_0x12f6c0,_0x1a38b2,path[_0xbb85('0x6e')](_0x553249),fs['readFileSync'](_0x553249))[_0xbb85('0x26')](function(_0x3c36a3){logger[_0xbb85('0x66')](util[_0xbb85('0x30')](_0xbb85('0x6f'),_0x3a242b,_0x1a38b2,_0x3c36a3[_0xbb85('0x70')]));_0x2172ed[_0xbb85('0x71')]=_0x3c36a3[_0xbb85('0x72')];_0x2172ed[_0xbb85('0x73')]=_0x3c36a3[_0xbb85('0x70')];logger[_0xbb85('0x66')](util[_0xbb85('0x30')](_0xbb85('0x74'),_0x3a242b));return startTranscribe(_0x87902d,_0xfe939,_0x12f6c0,uuidv4(),_0x2f0255,_0x3c36a3[_0xbb85('0x70')]);})[_0xbb85('0x26')](function(_0x4c30a7){logger[_0xbb85('0x66')](util[_0xbb85('0x30')](_0xbb85('0x75'),_0x3a242b,_0x4c30a7[_0xbb85('0x76')][_0xbb85('0x77')]));_0x2172ed[_0xbb85('0x78')]=_0x4c30a7['TranscriptionJob']['TranscriptionJobName'];_0x2172ed['transcribeStatus']=_0x4c30a7['TranscriptionJob'][_0xbb85('0x79')];return _0x502057(_0x2172ed);})[_0xbb85('0x41')](function(_0x25adb0){return _0xd14753(_0x25adb0);});});}exports[_0xbb85('0x7a')]=function(_0x384b36,_0x19982b,_0x1aaabc){var _0x336d73;var _0x123d05;var _0x3b16c9;var _0x50eb5f=require('../../components/encryptor');return db[_0xbb85('0x43')][_0xbb85('0x7b')]({'where':{'id':_0x384b36['params']['id']}})[_0xbb85('0x26')](function(_0x265114){if(_0x265114){var _0x50e8fa=util[_0xbb85('0x30')](_0xbb85('0x60'),_0x265114[_0xbb85('0x4d')]);if(fs[_0xbb85('0x61')](_0x50e8fa)){cypher=!![];return _0x50eb5f[_0xbb85('0x4e')](_0x50e8fa,_0x265114[_0xbb85('0x4d')],config[_0xbb85('0x4f')][_0xbb85('0x50')])[_0xbb85('0x26')](function(){return _0x265114;});}return _0x265114;}})[_0xbb85('0x26')](function(_0x3ef7ea){if(!_0x3ef7ea){throw new db['Sequelize'][(_0xbb85('0x52'))](_0xbb85('0x7c'));}_0x123d05=_0x3ef7ea;return db[_0xbb85('0x7d')]['findOne']({'where':{'id':0x1}});})[_0xbb85('0x26')](handleEntityNotFound(_0x19982b,null))[_0xbb85('0x26')](function(_0x583efe){if(_0x583efe){_0x336d73=_0x583efe;if(!_0x336d73['transcribe']||!_0x336d73[_0xbb85('0x7e')]||!_0x336d73[_0xbb85('0x7f')]||!_0x336d73['language']||!_0x336d73[_0xbb85('0x71')]){throw new db['Sequelize']['ValidationError'](_0xbb85('0x80'));}if(_0x384b36['body'][_0xbb85('0x81')]&&(!_0x336d73['sentiment']||!_0x336d73['sentimentAccountId']||!_0x336d73[_0xbb85('0x82')]||!_0x336d73[_0xbb85('0x83')]||!_0x336d73[_0xbb85('0x71')])){throw new db[(_0xbb85('0x51'))][(_0xbb85('0x52'))](_0xbb85('0x84'));}return db[_0xbb85('0x85')][_0xbb85('0x7b')]({'where':{'id':_0x336d73[_0xbb85('0x7e')]}});}})[_0xbb85('0x26')](function(_0x8414d4){if(!_0x8414d4){throw new db[(_0xbb85('0x51'))][(_0xbb85('0x52'))](_0xbb85('0x86'));}if(!_0x8414d4[_0xbb85('0x87')]||!_0x8414d4[_0xbb85('0x88')]){throw new db[(_0xbb85('0x51'))][(_0xbb85('0x52'))](_0xbb85('0x89'));}_0x3b16c9=_0x8414d4;return getBucketslist(_0x3b16c9['data1'],_0x3b16c9[_0xbb85('0x88')],_0x336d73[_0xbb85('0x7f')]);})[_0xbb85('0x26')](function(_0x4c40e2){if(_0x4c40e2&&_0x4c40e2[_0xbb85('0x8a')]){var _0x47de3b=_[_0xbb85('0x46')](_0x4c40e2[_0xbb85('0x8a')],function(_0x5e6dee){return _0x5e6dee[_0xbb85('0x8b')]===_0x336d73[_0xbb85('0x71')];});if(!_0x47de3b){logger[_0xbb85('0x66')](util[_0xbb85('0x30')](_0xbb85('0x8c'),_0x384b36[_0xbb85('0x49')]['id'],_0x336d73['bucket']));return createBucket(_0x3b16c9[_0xbb85('0x87')],_0x3b16c9[_0xbb85('0x88')],_0x336d73[_0xbb85('0x7f')],_0x336d73[_0xbb85('0x71')]);}logger[_0xbb85('0x66')](util['format'](_0xbb85('0x8d'),_0x384b36['params']['id'],_0x336d73[_0xbb85('0x71')]));return;}})[_0xbb85('0x26')](function(_0x2c9c35){if(_0x123d05[_0xbb85('0x8e')]===_0xbb85('0x8f')){return transcribe(_0x384b36[_0xbb85('0x49')]['id'],_0x3b16c9[_0xbb85('0x87')],_0x3b16c9[_0xbb85('0x88')],_0x336d73[_0xbb85('0x7f')],_0x336d73[_0xbb85('0x71')],_0x123d05[_0xbb85('0x4d')],_0x336d73[_0xbb85('0x83')]);}else{logger[_0xbb85('0x66')](util[_0xbb85('0x30')](_0xbb85('0x90'),_0x384b36[_0xbb85('0x49')]['id']));return{'transcribeStatus':_0xbb85('0x91')};}})['then'](function(_0xb01508){if(_0xb01508){_0xb01508[_0xbb85('0x92')]=_0x384b36[_0xbb85('0x48')][_0xbb85('0x81')];return _0x123d05[_0xbb85('0x93')](_0xb01508);}})[_0xbb85('0x26')](respondWithResult(_0x19982b,null))['catch'](handleError(_0x19982b,null));};function writeFile(_0x3e8c60,_0x2496e4){return new Promise(function(_0x5d7f20,_0xdc8dc5){fs[_0xbb85('0x94')](_0x2496e4,_0x3e8c60,function(_0x15cc1e,_0x51cb54){if(_0x15cc1e){return _0xdc8dc5(_0x15cc1e);}else{return _0x5d7f20(_0x51cb54);}});});}exports[_0xbb85('0x95')]=function(_0x319eb0,_0x2d664e,_0x12a492){return db[_0xbb85('0x43')][_0xbb85('0x7b')]({'where':{'id':_0x319eb0[_0xbb85('0x49')]['id']}})[_0xbb85('0x26')](handleEntityNotFound(_0x2d664e))[_0xbb85('0x26')](function(_0x169c6a){if(_0x169c6a&&_0x169c6a['fileText']){var _0x55606c=_0x169c6a['fileText'];var _0x16fa6d=config[_0xbb85('0x96')]+_0xbb85('0x97')+_0x169c6a['id']+_0xbb85('0x98');if(fs[_0xbb85('0x61')](_0x16fa6d)){return _0x16fa6d;}return writeFile(_0x55606c,_0x16fa6d)[_0xbb85('0x26')](function(){return _0x16fa6d;});}else{throw new db['Sequelize'][(_0xbb85('0x52'))](_0xbb85('0x99'));}})['then'](function(_0x168ad0){return _0x2d664e['download'](_0x168ad0);})['catch'](handleError(_0x2d664e));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 7703ce3..5a2e69b 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 _0x4f29=['transcribeStatus','exports','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x331331,_0xc0533d){var _0x3a6cb1=function(_0x4181c4){while(--_0x4181c4){_0x331331['push'](_0x331331['shift']());}};_0x3a6cb1(++_0xc0533d);}(_0x4f29,0xfd));var _0x94f2=function(_0x47057d,_0x3f400b){_0x47057d=_0x47057d-0x0;var _0x46050b=_0x4f29[_0x47057d];return _0x46050b;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0x94f2('0x0')]=function(_0x37e667,_0x3a07c6){return _0x37e667[_0x94f2('0x1')](_0x94f2('0x2'),attributes,{'tableName':_0x94f2('0x3'),'paranoid':![],'indexes':[{'name':_0x94f2('0x4'),'fields':[_0x94f2('0x4')]},{'name':_0x94f2('0x5'),'fields':[_0x94f2('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbf1a=['define','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x557fd2,_0x2c0a7a){var _0x1b54a2=function(_0x2e439b){while(--_0x2e439b){_0x557fd2['push'](_0x557fd2['shift']());}};_0x1b54a2(++_0x2c0a7a);}(_0xbf1a,0x7c));var _0xabf1=function(_0x461577,_0x5c6c79){_0x461577=_0x461577-0x0;var _0x5751c5=_0xbf1a[_0x461577];return _0x5751c5;};'use strict';var attributes=require(_0xabf1('0x0'));module[_0xabf1('0x1')]=function(_0x7cbc88,_0x2132b4){return _0x7cbc88[_0xabf1('0x2')]('VoiceRecording',attributes,{'tableName':_0xabf1('0x3'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xabf1('0x4')]},{'name':_0xabf1('0x5'),'fields':[_0xabf1('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 6318b4a..55acadb 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 _0xb016=['options','raw','attributes','limit','debug','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','value','format','encryptFile','secrets','recording','unlink','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb016,0x159));var _0x6b01=function(_0x359170,_0x45aa73){_0x359170=_0x359170-0x0;var _0x1e1945=_0xb016[_0x359170];return _0x1e1945;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b01('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b01('0x3'))['db'];var utils=require(_0x6b01('0x4'));var logger=require(_0x6b01('0x5'))(_0x6b01('0x6'));var config=require('../../config/environment');var jayson=require(_0x6b01('0x7'));var client=jayson[_0x6b01('0x8')][_0x6b01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5759a1,_0x5c5bfb,_0x374aab){return new BPromise(function(_0x39f9fa,_0x526a7d){return client['request'](_0x5759a1,_0x374aab)[_0x6b01('0xa')](function(_0x1cb3a6){logger[_0x6b01('0xb')](_0x6b01('0xc'),_0x5c5bfb,_0x6b01('0xd'));logger['debug']('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'),JSON[_0x6b01('0xe')](_0x1cb3a6));if(_0x1cb3a6[_0x6b01('0xf')]){if(_0x1cb3a6['error'][_0x6b01('0x10')]===0x1f4){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x5c5bfb,_0x1cb3a6[_0x6b01('0xf')]['message']);return _0x526a7d(_0x1cb3a6[_0x6b01('0xf')][_0x6b01('0x11')]);}logger['error'](_0x6b01('0xc'),_0x5c5bfb,_0x1cb3a6['error']['message']);return _0x39f9fa(_0x1cb3a6['error'][_0x6b01('0x11')]);}else{logger['info']('VoiceRecording,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'));_0x39f9fa(_0x1cb3a6[_0x6b01('0x12')][_0x6b01('0x11')]);}})[_0x6b01('0x13')](function(_0x3d7045){logger[_0x6b01('0xf')](_0x6b01('0xc'),_0x5c5bfb,_0x3d7045);_0x526a7d(_0x3d7045);});});}exports[_0x6b01('0x14')]=function(_0x9c6571){var _0xc4e1b1=this;return new Promise(function(_0x18f336,_0x4f2d08){return db[_0x6b01('0x15')][_0x6b01('0x16')](_0x9c6571[_0x6b01('0x17')],{'raw':_0x9c6571[_0x6b01('0x18')]?_0x9c6571[_0x6b01('0x18')][_0x6b01('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9c6571[_0x6b01('0x18')]?_0x9c6571[_0x6b01('0x18')]['where']||null:null,'attributes':_0x9c6571[_0x6b01('0x18')]?_0x9c6571[_0x6b01('0x18')][_0x6b01('0x1a')]||null:null,'limit':_0x9c6571[_0x6b01('0x18')]?_0x9c6571[_0x6b01('0x18')][_0x6b01('0x1b')]||null:null})[_0x6b01('0xa')](function(_0x542fab){logger[_0x6b01('0xb')](_0x6b01('0x14'),_0x9c6571);logger[_0x6b01('0x1c')]('UpdateVoiceRecording',_0x9c6571,JSON[_0x6b01('0xe')](_0x542fab));_0x18f336(_0x542fab);})[_0x6b01('0x13')](function(_0x304393){logger[_0x6b01('0xf')](_0x6b01('0x14'),_0x304393[_0x6b01('0x11')],_0x9c6571);_0x4f2d08(_0xc4e1b1[_0x6b01('0xf')](0x1f4,_0x304393[_0x6b01('0x11')]));});});};exports[_0x6b01('0x1d')]=function(_0x152dda){var _0x3c0607=this;return new Promise(function(_0xa846d8,_0x154dfc){var _0x55ca4b=require(_0x6b01('0x1e'));var _0x220efb;return db[_0x6b01('0x1f')][_0x6b01('0x20')]({'attributes':['id',_0x6b01('0x21')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x54f030){_0x220efb=_0x54f030;return db[_0x6b01('0x15')][_0x6b01('0x22')](_0x152dda[_0x6b01('0x17')]);})[_0x6b01('0xa')](function(_0x2a894e){if(_0x220efb[_0x6b01('0x21')]&&fs['existsSync'](_0x2a894e[_0x6b01('0x23')])){var _0x5482a8=util[_0x6b01('0x24')]('%s.cypher',_0x2a894e[_0x6b01('0x23')]);return _0x55ca4b[_0x6b01('0x25')](_0x2a894e[_0x6b01('0x23')],_0x5482a8,config[_0x6b01('0x26')][_0x6b01('0x27')])['then'](function(){fs[_0x6b01('0x28')](_0x2a894e[_0x6b01('0x23')]);logger[_0x6b01('0xb')]('CreateVoiceRecording\x20file\x20encrypted');return _0x2a894e;});}return _0x2a894e;})['then'](function(_0x3578ef){logger['info'](_0x6b01('0x1d'),_0x152dda);logger[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x152dda,JSON['stringify'](_0x3578ef));_0xa846d8(_0x3578ef);})[_0x6b01('0x13')](function(_0x42d5f7){logger[_0x6b01('0xf')]('CreateVoiceRecording',_0x42d5f7[_0x6b01('0x11')],_0x152dda);_0x154dfc(_0x3c0607[_0x6b01('0xf')](0x1f4,_0x42d5f7[_0x6b01('0x11')]));});});}; \ No newline at end of file +var _0x7b84=['VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','raw','where','attributes','limit','UpdateVoiceRecording','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','create','body','existsSync','value','format','%s.cypher','recording','unlink','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x7b84,0x17c));var _0x47b8=function(_0x31fbfb,_0x306890){_0x31fbfb=_0x31fbfb-0x0;var _0x51013d=_0x7b84[_0x31fbfb];return _0x51013d;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));var BPromise=require(_0x47b8('0x3'));var rs=require(_0x47b8('0x4'));var fs=require('fs');var Redis=require(_0x47b8('0x5'));var db=require(_0x47b8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x47b8('0x7'))(_0x47b8('0x8'));var config=require(_0x47b8('0x9'));var jayson=require(_0x47b8('0xa'));var client=jayson[_0x47b8('0xb')][_0x47b8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53e656,_0x3867ca,_0x3ce846){return new BPromise(function(_0x46245a,_0xb845c9){return client[_0x47b8('0xd')](_0x53e656,_0x3ce846)[_0x47b8('0xe')](function(_0x24d240){logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));logger[_0x47b8('0x12')](_0x47b8('0x13'),_0x3867ca,_0x47b8('0x11'),JSON[_0x47b8('0x14')](_0x24d240));if(_0x24d240[_0x47b8('0x15')]){if(_0x24d240[_0x47b8('0x15')][_0x47b8('0x16')]===0x1f4){logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0xb845c9(_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);}logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0x46245a(_0x24d240['error'][_0x47b8('0x17')]);}else{logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));_0x46245a(_0x24d240[_0x47b8('0x18')][_0x47b8('0x17')]);}})[_0x47b8('0x19')](function(_0x5ad3ae){logger[_0x47b8('0x15')]('VoiceRecording,\x20%s,\x20%s',_0x3867ca,_0x5ad3ae);_0xb845c9(_0x5ad3ae);});});}exports['UpdateVoiceRecording']=function(_0x4f7317){var _0x299195=this;return new Promise(function(_0x36faf1,_0x2797ac){return db['VoiceRecording']['update'](_0x4f7317['body'],{'raw':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317['options'][_0x47b8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317[_0x47b8('0x1a')][_0x47b8('0x1c')]||null:null,'attributes':_0x4f7317['options']?_0x4f7317[_0x47b8('0x1a')][_0x47b8('0x1d')]||null:null,'limit':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317[_0x47b8('0x1a')][_0x47b8('0x1e')]||null:null})[_0x47b8('0xe')](function(_0x54f6bc){logger[_0x47b8('0xf')](_0x47b8('0x1f'),_0x4f7317);logger['debug'](_0x47b8('0x1f'),_0x4f7317,JSON[_0x47b8('0x14')](_0x54f6bc));_0x36faf1(_0x54f6bc);})[_0x47b8('0x19')](function(_0x142fb6){logger['error'](_0x47b8('0x1f'),_0x142fb6[_0x47b8('0x17')],_0x4f7317);_0x2797ac(_0x299195[_0x47b8('0x15')](0x1f4,_0x142fb6[_0x47b8('0x17')]));});});};exports[_0x47b8('0x20')]=function(_0xbf5ce9){var _0x40918f=this;return new Promise(function(_0x568c1e,_0x43fd49){var _0x1f719a=require('../../components/encryptor');var _0x195a66;return db[_0x47b8('0x21')][_0x47b8('0x22')]({'attributes':['id',_0x47b8('0x23')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x162d96){_0x195a66=_0x162d96;return db['VoiceRecording'][_0x47b8('0x24')](_0xbf5ce9[_0x47b8('0x25')]);})[_0x47b8('0xe')](function(_0x2e540d){if(_0x195a66['callRecordingEncryption']&&fs[_0x47b8('0x26')](_0x2e540d[_0x47b8('0x27')])){var _0x402e7c=util[_0x47b8('0x28')](_0x47b8('0x29'),_0x2e540d[_0x47b8('0x27')]);return _0x1f719a['encryptFile'](_0x2e540d['value'],_0x402e7c,config['secrets'][_0x47b8('0x2a')])[_0x47b8('0xe')](function(){fs[_0x47b8('0x2b')](_0x2e540d['value']);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x2e540d;});}return _0x2e540d;})['then'](function(_0x347769){logger[_0x47b8('0xf')](_0x47b8('0x20'),_0xbf5ce9);logger[_0x47b8('0x12')](_0x47b8('0x20'),_0xbf5ce9,JSON[_0x47b8('0x14')](_0x347769));_0x568c1e(_0x347769);})[_0x47b8('0x19')](function(_0x460dcc){logger[_0x47b8('0x15')]('CreateVoiceRecording',_0x460dcc['message'],_0xbf5ce9);_0x43fd49(_0x40918f[_0x47b8('0x15')](0x1f4,_0x460dcc[_0x47b8('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 4f5e5d2..a9acac3 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 _0x7f4c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','update','destroy','multer'];(function(_0x5652ea,_0x285c78){var _0x1c3233=function(_0x7f7988){while(--_0x7f7988){_0x5652ea['push'](_0x5652ea['shift']());}};_0x1c3233(++_0x285c78);}(_0x7f4c,0x17b));var _0xc7f4=function(_0x58ee99,_0x1149ea){_0x58ee99=_0x58ee99-0x0;var _0x437a51=_0x7f4c[_0x58ee99];return _0x437a51;};'use strict';var multer=require(_0xc7f4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc7f4('0x1'));var express=require(_0xc7f4('0x2'));var router=express[_0xc7f4('0x3')]();var fs_extra=require(_0xc7f4('0x4'));var auth=require(_0xc7f4('0x5'));var interaction=require(_0xc7f4('0x6'));var config=require(_0xc7f4('0x7'));var controller=require(_0xc7f4('0x8'));router[_0xc7f4('0x9')]('/',auth['isAuthenticated'](),controller[_0xc7f4('0xa')]);router['get'](_0xc7f4('0xb'),auth[_0xc7f4('0xc')](),controller[_0xc7f4('0xd')]);router['get'](_0xc7f4('0xe'),auth[_0xc7f4('0xc')](),controller[_0xc7f4('0xf')]);router['post']('/',auth[_0xc7f4('0xc')](),controller[_0xc7f4('0x10')]);router['put'](_0xc7f4('0xe'),auth[_0xc7f4('0xc')](),controller[_0xc7f4('0x11')]);router['delete'](_0xc7f4('0xe'),auth['isAuthenticated'](),controller[_0xc7f4('0x12')]);module['exports']=router; \ No newline at end of file +var _0x760b=['put','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x5caadc,_0x4bbf3f){var _0x5877fa=function(_0x51b1a6){while(--_0x51b1a6){_0x5caadc['push'](_0x5caadc['shift']());}};_0x5877fa(++_0x4bbf3f);}(_0x760b,0x16b));var _0xb760=function(_0xcbee2,_0x2beacc){_0xcbee2=_0xcbee2-0x0;var _0x45a41a=_0x760b[_0xcbee2];return _0x45a41a;};'use strict';var multer=require(_0xb760('0x0'));var util=require(_0xb760('0x1'));var path=require(_0xb760('0x2'));var timeout=require(_0xb760('0x3'));var express=require(_0xb760('0x4'));var router=express['Router']();var fs_extra=require(_0xb760('0x5'));var auth=require(_0xb760('0x6'));var interaction=require(_0xb760('0x7'));var config=require(_0xb760('0x8'));var controller=require(_0xb760('0x9'));router[_0xb760('0xa')]('/',auth[_0xb760('0xb')](),controller[_0xb760('0xc')]);router['get']('/describe',auth[_0xb760('0xb')](),controller[_0xb760('0xd')]);router['get'](_0xb760('0xe'),auth[_0xb760('0xb')](),controller[_0xb760('0xf')]);router[_0xb760('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb760('0x11')]('/:id',auth[_0xb760('0xb')](),controller[_0xb760('0x12')]);router['delete']('/:id',auth[_0xb760('0xb')](),controller['destroy']);module[_0xb760('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 8d7f86b..bf92d16 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 _0x6f0d=['sequelize','moment','ENUM','blind','attended','STRING','Yes'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6f0d,0x69));var _0xd6f0=function(_0x3a545c,_0x459527){_0x3a545c=_0x3a545c-0x0;var _0x5875b=_0x6f0d[_0x3a545c];return _0x5875b;};'use strict';var Sequelize=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));module['exports']={'type':{'type':Sequelize[_0xd6f0('0x2')](_0xd6f0('0x3'),_0xd6f0('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xd6f0('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xd6f0('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xd6f0('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xd6f0('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xd6f0('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xd6f0('0x5')]},'transfereechannel':{'type':Sequelize[_0xd6f0('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xd6f0('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xd6f0('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xd6f0('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xd6f0('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xd6f0('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xd6f0('0x5')]},'isexternal':{'type':Sequelize[_0xd6f0('0x2')](_0xd6f0('0x6'),'No')},'context':{'type':Sequelize[_0xd6f0('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x121f=['attended','STRING','Yes','moment','exports','ENUM','blind'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x121f,0xce));var _0xf121=function(_0x255ac0,_0x3f6645){_0x255ac0=_0x255ac0-0x0;var _0x437bf1=_0x121f[_0x255ac0];return _0x437bf1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf121('0x0'));module[_0xf121('0x1')]={'type':{'type':Sequelize[_0xf121('0x2')](_0xf121('0x3'),_0xf121('0x4'))},'result':{'type':Sequelize[_0xf121('0x5')]},'transfererchannel':{'type':Sequelize[_0xf121('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xf121('0x5')]},'transferercalleridname':{'type':Sequelize[_0xf121('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xf121('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xf121('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xf121('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xf121('0x5')]},'transfereechannel':{'type':Sequelize[_0xf121('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xf121('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xf121('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xf121('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xf121('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xf121('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xf121('0x2')](_0xf121('0x6'),'No')},'context':{'type':Sequelize[_0xf121('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 0ec58e0..a9dbdf4 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 _0xa73b=['merge','type','VIRTUAL','name','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','send','index','map','VoiceTransferReport','rawAttributes','fieldName','key','model','keys','query','attributes','intersection','fields','length','order','sort','where','filters','pick','filter'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0xa73b,0x144));var _0xba73=function(_0x16c857,_0x244ff4){_0x16c857=_0x16c857-0x0;var _0xd2f7e5=_0xa73b[_0x16c857];return _0xd2f7e5;};'use strict';var emlformat=require(_0xba73('0x0'));var rimraf=require(_0xba73('0x1'));var zipdir=require(_0xba73('0x2'));var jsonpatch=require(_0xba73('0x3'));var rp=require(_0xba73('0x4'));var moment=require(_0xba73('0x5'));var BPromise=require(_0xba73('0x6'));var Mustache=require('mustache');var util=require(_0xba73('0x7'));var path=require(_0xba73('0x8'));var sox=require(_0xba73('0x9'));var csv=require(_0xba73('0xa'));var ejs=require(_0xba73('0xb'));var fs=require('fs');var fs_extra=require(_0xba73('0xc'));var _=require(_0xba73('0xd'));var squel=require(_0xba73('0xe'));var crypto=require(_0xba73('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xba73('0x10'));var toCsv=require('to-csv');var querystring=require(_0xba73('0x11'));var Papa=require(_0xba73('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xba73('0x13'));var as=require(_0xba73('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba73('0x15'))(_0xba73('0x16'));var utils=require('../../config/utils');var config=require(_0xba73('0x17'));var licenseUtil=require(_0xba73('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11fb75,_0x54a8e4){_0x54a8e4=_0x54a8e4||0xcc;return function(_0x3f0b04){if(_0x3f0b04){return _0x11fb75['sendStatus'](_0x54a8e4);}return _0x11fb75[_0xba73('0x19')](_0x54a8e4)[_0xba73('0x1a')]();};}function respondWithResult(_0x46115c,_0xdc03e3){_0xdc03e3=_0xdc03e3||0xc8;return function(_0x2153c3){if(_0x2153c3){return _0x46115c['status'](_0xdc03e3)[_0xba73('0x1b')](_0x2153c3);}};}function respondWithFilteredResult(_0x468371,_0x2fc444){return function(_0x3ec062){if(_0x3ec062){var _0x130a3a=typeof _0x2fc444['offset']===_0xba73('0x1c')&&typeof _0x2fc444[_0xba73('0x1d')]===_0xba73('0x1c');var _0x1e227b=_0x3ec062['count'];var _0x2a357c=_0x130a3a?0x0:_0x2fc444[_0xba73('0x1e')];var _0x841c8c=_0x130a3a?_0x3ec062[_0xba73('0x1f')]:_0x2fc444[_0xba73('0x1e')]+_0x2fc444[_0xba73('0x1d')];var _0x379a2b;if(_0x841c8c>=_0x1e227b){_0x841c8c=_0x1e227b;_0x379a2b=0xc8;}else{_0x379a2b=0xce;}_0x468371['status'](_0x379a2b);return _0x468371[_0xba73('0x20')](_0xba73('0x21'),_0x2a357c+'-'+_0x841c8c+'/'+_0x1e227b)[_0xba73('0x1b')](_0x3ec062);}return null;};}function patchUpdates(_0x5cdf45){return function(_0x22f28e){try{jsonpatch['apply'](_0x22f28e,_0x5cdf45,!![]);}catch(_0x1e30d4){return BPromise[_0xba73('0x22')](_0x1e30d4);}return _0x22f28e['save']();};}function saveUpdates(_0x2963fc,_0x4ec911){return function(_0x3ecb6e){if(_0x3ecb6e){return _0x3ecb6e[_0xba73('0x23')](_0x2963fc)[_0xba73('0x24')](function(_0x53409f){return _0x53409f;});}return null;};}function removeEntity(_0x466f75,_0x15eb4a){return function(_0x4c4f3b){if(_0x4c4f3b){return _0x4c4f3b[_0xba73('0x25')]()[_0xba73('0x24')](function(){_0x466f75[_0xba73('0x19')](0xcc)[_0xba73('0x1a')]();});}};}function handleEntityNotFound(_0x36c2ce,_0x143a3e){return function(_0x9c7f98){if(!_0x9c7f98){_0x36c2ce[_0xba73('0x26')](0x194);}return _0x9c7f98;};}function handleError(_0x30941c,_0x255571){_0x255571=_0x255571||0x1f4;return function(_0x276956){logger[_0xba73('0x27')](_0x276956[_0xba73('0x28')]);if(_0x276956['name']){delete _0x276956['name'];}_0x30941c[_0xba73('0x19')](_0x255571)[_0xba73('0x29')](_0x276956);};}exports[_0xba73('0x2a')]=function(_0xaabdce,_0x23dcb0){var _0xfae7d2={},_0x265a3e={},_0x421a50={'count':0x0,'rows':[]};var _0x41fa8d=_[_0xba73('0x2b')](db[_0xba73('0x2c')][_0xba73('0x2d')],function(_0x407374){return{'name':_0x407374[_0xba73('0x2e')],'type':_0x407374['type'][_0xba73('0x2f')]};});_0x265a3e[_0xba73('0x30')]=_['map'](_0x41fa8d,'name');_0x265a3e['query']=_[_0xba73('0x31')](_0xaabdce[_0xba73('0x32')]);_0x265a3e['filters']=_['intersection'](_0x265a3e[_0xba73('0x30')],_0x265a3e[_0xba73('0x32')]);_0xfae7d2[_0xba73('0x33')]=_[_0xba73('0x34')](_0x265a3e[_0xba73('0x30')],qs[_0xba73('0x35')](_0xaabdce[_0xba73('0x32')][_0xba73('0x35')]));_0xfae7d2[_0xba73('0x33')]=_0xfae7d2[_0xba73('0x33')][_0xba73('0x36')]?_0xfae7d2[_0xba73('0x33')]:_0x265a3e[_0xba73('0x30')];if(!_0xaabdce['query']['hasOwnProperty']('nolimit')){_0xfae7d2['limit']=qs[_0xba73('0x1d')](_0xaabdce[_0xba73('0x32')][_0xba73('0x1d')]);_0xfae7d2[_0xba73('0x1e')]=qs['offset'](_0xaabdce['query'][_0xba73('0x1e')]);}_0xfae7d2[_0xba73('0x37')]=qs[_0xba73('0x38')](_0xaabdce[_0xba73('0x32')][_0xba73('0x38')]);_0xfae7d2[_0xba73('0x39')]=qs[_0xba73('0x3a')](_[_0xba73('0x3b')](_0xaabdce[_0xba73('0x32')],_0x265a3e['filters']),_0x41fa8d);if(_0xaabdce[_0xba73('0x32')][_0xba73('0x3c')]){_0xfae7d2[_0xba73('0x39')]=_[_0xba73('0x3d')](_0xfae7d2['where'],{'$or':_['map'](_0x41fa8d,function(_0x20aa84){if(_0x20aa84[_0xba73('0x3e')]!==_0xba73('0x3f')){var _0x49d466={};_0x49d466[_0x20aa84[_0xba73('0x40')]]={'$like':'%'+_0xaabdce[_0xba73('0x32')][_0xba73('0x3c')]+'%'};return _0x49d466;}})});}_0xfae7d2=_[_0xba73('0x3d')]({},_0xfae7d2,_0xaabdce[_0xba73('0x41')]);var _0x33b896={'where':_0xfae7d2[_0xba73('0x39')]};return db[_0xba73('0x2c')][_0xba73('0x1f')](_0x33b896)[_0xba73('0x24')](function(_0x44b4ce){_0x421a50[_0xba73('0x1f')]=_0x44b4ce;if(_0xaabdce[_0xba73('0x32')][_0xba73('0x42')]){_0xfae7d2['include']=[{'all':!![]}];}return db['VoiceTransferReport'][_0xba73('0x43')](_0xfae7d2);})[_0xba73('0x24')](function(_0x467c5e){_0x421a50[_0xba73('0x44')]=_0x467c5e;return _0x421a50;})[_0xba73('0x24')](respondWithFilteredResult(_0x23dcb0,_0xfae7d2))['catch'](handleError(_0x23dcb0,null));};exports[_0xba73('0x45')]=function(_0x48e5e9,_0x2c264b){var _0x39e996={'raw':!![],'where':{'id':_0x48e5e9[_0xba73('0x46')]['id']}},_0x23c8a1={};_0x23c8a1['model']=_['keys'](db[_0xba73('0x2c')]['rawAttributes']);_0x23c8a1['query']=_[_0xba73('0x31')](_0x48e5e9['query']);_0x23c8a1[_0xba73('0x3a')]=_[_0xba73('0x34')](_0x23c8a1['model'],_0x23c8a1[_0xba73('0x32')]);_0x39e996[_0xba73('0x33')]=_['intersection'](_0x23c8a1[_0xba73('0x30')],qs[_0xba73('0x35')](_0x48e5e9[_0xba73('0x32')][_0xba73('0x35')]));_0x39e996['attributes']=_0x39e996['attributes'][_0xba73('0x36')]?_0x39e996[_0xba73('0x33')]:_0x23c8a1[_0xba73('0x30')];if(_0x48e5e9[_0xba73('0x32')]['includeAll']){_0x39e996[_0xba73('0x47')]=[{'all':!![]}];}_0x39e996=_[_0xba73('0x3d')]({},_0x39e996,_0x48e5e9[_0xba73('0x41')]);return db[_0xba73('0x2c')][_0xba73('0x48')](_0x39e996)[_0xba73('0x24')](handleEntityNotFound(_0x2c264b,null))['then'](respondWithResult(_0x2c264b,null))[_0xba73('0x49')](handleError(_0x2c264b,null));};exports[_0xba73('0x4a')]=function(_0x3b530c,_0x57e7bb){return db[_0xba73('0x2c')]['create'](_0x3b530c[_0xba73('0x4b')],{})[_0xba73('0x24')](respondWithResult(_0x57e7bb,0xc9))['catch'](handleError(_0x57e7bb,null));};exports[_0xba73('0x23')]=function(_0x4936a5,_0x2f4965){if(_0x4936a5[_0xba73('0x4b')]['id']){delete _0x4936a5[_0xba73('0x4b')]['id'];}return db[_0xba73('0x2c')][_0xba73('0x48')]({'where':{'id':_0x4936a5[_0xba73('0x46')]['id']}})[_0xba73('0x24')](handleEntityNotFound(_0x2f4965,null))[_0xba73('0x24')](saveUpdates(_0x4936a5[_0xba73('0x4b')],null))['then'](respondWithResult(_0x2f4965,null))['catch'](handleError(_0x2f4965,null));};exports[_0xba73('0x25')]=function(_0x16933f,_0x13661a){return db[_0xba73('0x2c')]['find']({'where':{'id':_0x16933f[_0xba73('0x46')]['id']}})['then'](handleEntityNotFound(_0x13661a,null))[_0xba73('0x24')](removeEntity(_0x13661a,null))[_0xba73('0x49')](handleError(_0x13661a,null));};exports['describe']=function(_0x34bee3,_0x47f26e){return db[_0xba73('0x2c')][_0xba73('0x4c')]()[_0xba73('0x24')](respondWithResult(_0x47f26e,null))[_0xba73('0x49')](handleError(_0x47f26e,null));}; \ No newline at end of file +var _0x2fa8=['destroy','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','count','findAll','rows','params','keys','includeAll','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','apply','reject','save','update','then'];(function(_0x472815,_0x585779){var _0x54f08d=function(_0x379fd0){while(--_0x379fd0){_0x472815['push'](_0x472815['shift']());}};_0x54f08d(++_0x585779);}(_0x2fa8,0x103));var _0x82fa=function(_0x2025d1,_0x465966){_0x2025d1=_0x2025d1-0x0;var _0x184ee1=_0x2fa8[_0x2025d1];return _0x184ee1;};'use strict';var emlformat=require(_0x82fa('0x0'));var rimraf=require(_0x82fa('0x1'));var zipdir=require(_0x82fa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x82fa('0x3'));var BPromise=require(_0x82fa('0x4'));var Mustache=require(_0x82fa('0x5'));var util=require(_0x82fa('0x6'));var path=require(_0x82fa('0x7'));var sox=require(_0x82fa('0x8'));var csv=require(_0x82fa('0x9'));var ejs=require(_0x82fa('0xa'));var fs=require('fs');var fs_extra=require(_0x82fa('0xb'));var _=require(_0x82fa('0xc'));var squel=require(_0x82fa('0xd'));var crypto=require('crypto');var jsforce=require(_0x82fa('0xe'));var deskjs=require(_0x82fa('0xf'));var toCsv=require(_0x82fa('0x9'));var querystring=require('querystring');var Papa=require(_0x82fa('0x10'));var Redis=require(_0x82fa('0x11'));var authService=require(_0x82fa('0x12'));var qs=require(_0x82fa('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x82fa('0x14'));var logger=require(_0x82fa('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x82fa('0x16'));var db=require(_0x82fa('0x17'))['db'];function respondWithStatusCode(_0x5b1fe3,_0x6a1164){_0x6a1164=_0x6a1164||0xcc;return function(_0x1aaae2){if(_0x1aaae2){return _0x5b1fe3[_0x82fa('0x18')](_0x6a1164);}return _0x5b1fe3['status'](_0x6a1164)[_0x82fa('0x19')]();};}function respondWithResult(_0x29c456,_0x1762c5){_0x1762c5=_0x1762c5||0xc8;return function(_0xa1b25a){if(_0xa1b25a){return _0x29c456[_0x82fa('0x1a')](_0x1762c5)[_0x82fa('0x1b')](_0xa1b25a);}};}function respondWithFilteredResult(_0x451489,_0x2206f2){return function(_0x54a3f3){if(_0x54a3f3){var _0xe461e8=typeof _0x2206f2[_0x82fa('0x1c')]===_0x82fa('0x1d')&&typeof _0x2206f2['limit']==='undefined';var _0x34f200=_0x54a3f3['count'];var _0x280cb1=_0xe461e8?0x0:_0x2206f2['offset'];var _0x5be1b2=_0xe461e8?_0x54a3f3['count']:_0x2206f2[_0x82fa('0x1c')]+_0x2206f2[_0x82fa('0x1e')];var _0x3ca098;if(_0x5be1b2>=_0x34f200){_0x5be1b2=_0x34f200;_0x3ca098=0xc8;}else{_0x3ca098=0xce;}_0x451489[_0x82fa('0x1a')](_0x3ca098);return _0x451489[_0x82fa('0x1f')]('Content-Range',_0x280cb1+'-'+_0x5be1b2+'/'+_0x34f200)[_0x82fa('0x1b')](_0x54a3f3);}return null;};}function patchUpdates(_0x463a7f){return function(_0x35f069){try{jsonpatch[_0x82fa('0x20')](_0x35f069,_0x463a7f,!![]);}catch(_0x1afd5c){return BPromise[_0x82fa('0x21')](_0x1afd5c);}return _0x35f069[_0x82fa('0x22')]();};}function saveUpdates(_0x4ed1a5,_0x33fad0){return function(_0x1f7a7f){if(_0x1f7a7f){return _0x1f7a7f[_0x82fa('0x23')](_0x4ed1a5)[_0x82fa('0x24')](function(_0x39a3d4){return _0x39a3d4;});}return null;};}function removeEntity(_0x76f838,_0x2c3030){return function(_0x49f8bf){if(_0x49f8bf){return _0x49f8bf[_0x82fa('0x25')]()['then'](function(){_0x76f838[_0x82fa('0x1a')](0xcc)[_0x82fa('0x19')]();});}};}function handleEntityNotFound(_0x2be472,_0x92b185){return function(_0xd653ed){if(!_0xd653ed){_0x2be472[_0x82fa('0x18')](0x194);}return _0xd653ed;};}function handleError(_0x12084c,_0x3d373f){_0x3d373f=_0x3d373f||0x1f4;return function(_0x324e84){logger['error'](_0x324e84[_0x82fa('0x26')]);if(_0x324e84[_0x82fa('0x27')]){delete _0x324e84[_0x82fa('0x27')];}_0x12084c[_0x82fa('0x1a')](_0x3d373f)['send'](_0x324e84);};}exports[_0x82fa('0x28')]=function(_0x1a3ebc,_0x6a9ae1){var _0x3e1a52={},_0x5ebae2={},_0x10985b={'count':0x0,'rows':[]};var _0xf929da=_[_0x82fa('0x29')](db[_0x82fa('0x2a')][_0x82fa('0x2b')],function(_0x418134){return{'name':_0x418134[_0x82fa('0x2c')],'type':_0x418134[_0x82fa('0x2d')][_0x82fa('0x2e')]};});_0x5ebae2[_0x82fa('0x2f')]=_[_0x82fa('0x29')](_0xf929da,_0x82fa('0x27'));_0x5ebae2[_0x82fa('0x30')]=_['keys'](_0x1a3ebc['query']);_0x5ebae2[_0x82fa('0x31')]=_['intersection'](_0x5ebae2[_0x82fa('0x2f')],_0x5ebae2[_0x82fa('0x30')]);_0x3e1a52['attributes']=_[_0x82fa('0x32')](_0x5ebae2[_0x82fa('0x2f')],qs[_0x82fa('0x33')](_0x1a3ebc[_0x82fa('0x30')][_0x82fa('0x33')]));_0x3e1a52[_0x82fa('0x34')]=_0x3e1a52[_0x82fa('0x34')][_0x82fa('0x35')]?_0x3e1a52[_0x82fa('0x34')]:_0x5ebae2[_0x82fa('0x2f')];if(!_0x1a3ebc[_0x82fa('0x30')][_0x82fa('0x36')]('nolimit')){_0x3e1a52[_0x82fa('0x1e')]=qs[_0x82fa('0x1e')](_0x1a3ebc[_0x82fa('0x30')][_0x82fa('0x1e')]);_0x3e1a52[_0x82fa('0x1c')]=qs[_0x82fa('0x1c')](_0x1a3ebc['query'][_0x82fa('0x1c')]);}_0x3e1a52[_0x82fa('0x37')]=qs[_0x82fa('0x38')](_0x1a3ebc[_0x82fa('0x30')]['sort']);_0x3e1a52[_0x82fa('0x39')]=qs[_0x82fa('0x31')](_['pick'](_0x1a3ebc['query'],_0x5ebae2[_0x82fa('0x31')]),_0xf929da);if(_0x1a3ebc[_0x82fa('0x30')][_0x82fa('0x3a')]){_0x3e1a52[_0x82fa('0x39')]=_[_0x82fa('0x3b')](_0x3e1a52[_0x82fa('0x39')],{'$or':_[_0x82fa('0x29')](_0xf929da,function(_0x5d0648){if(_0x5d0648['type']!==_0x82fa('0x3c')){var _0x22d576={};_0x22d576[_0x5d0648[_0x82fa('0x27')]]={'$like':'%'+_0x1a3ebc[_0x82fa('0x30')][_0x82fa('0x3a')]+'%'};return _0x22d576;}})});}_0x3e1a52=_['merge']({},_0x3e1a52,_0x1a3ebc[_0x82fa('0x3d')]);var _0xba8092={'where':_0x3e1a52[_0x82fa('0x39')]};return db[_0x82fa('0x2a')][_0x82fa('0x3e')](_0xba8092)[_0x82fa('0x24')](function(_0x5dea1c){_0x10985b['count']=_0x5dea1c;if(_0x1a3ebc['query']['includeAll']){_0x3e1a52['include']=[{'all':!![]}];}return db[_0x82fa('0x2a')][_0x82fa('0x3f')](_0x3e1a52);})[_0x82fa('0x24')](function(_0x5edb48){_0x10985b[_0x82fa('0x40')]=_0x5edb48;return _0x10985b;})['then'](respondWithFilteredResult(_0x6a9ae1,_0x3e1a52))['catch'](handleError(_0x6a9ae1,null));};exports['show']=function(_0x59927a,_0x5c45b7){var _0x4f7964={'raw':!![],'where':{'id':_0x59927a[_0x82fa('0x41')]['id']}},_0x771aa2={};_0x771aa2[_0x82fa('0x2f')]=_[_0x82fa('0x42')](db[_0x82fa('0x2a')][_0x82fa('0x2b')]);_0x771aa2[_0x82fa('0x30')]=_[_0x82fa('0x42')](_0x59927a[_0x82fa('0x30')]);_0x771aa2[_0x82fa('0x31')]=_['intersection'](_0x771aa2[_0x82fa('0x2f')],_0x771aa2[_0x82fa('0x30')]);_0x4f7964[_0x82fa('0x34')]=_['intersection'](_0x771aa2[_0x82fa('0x2f')],qs[_0x82fa('0x33')](_0x59927a[_0x82fa('0x30')][_0x82fa('0x33')]));_0x4f7964[_0x82fa('0x34')]=_0x4f7964[_0x82fa('0x34')]['length']?_0x4f7964[_0x82fa('0x34')]:_0x771aa2[_0x82fa('0x2f')];if(_0x59927a[_0x82fa('0x30')][_0x82fa('0x43')]){_0x4f7964[_0x82fa('0x44')]=[{'all':!![]}];}_0x4f7964=_[_0x82fa('0x3b')]({},_0x4f7964,_0x59927a['options']);return db[_0x82fa('0x2a')][_0x82fa('0x45')](_0x4f7964)['then'](handleEntityNotFound(_0x5c45b7,null))[_0x82fa('0x24')](respondWithResult(_0x5c45b7,null))[_0x82fa('0x46')](handleError(_0x5c45b7,null));};exports['create']=function(_0x45746a,_0x24cdd3){return db[_0x82fa('0x2a')][_0x82fa('0x47')](_0x45746a[_0x82fa('0x48')],{})[_0x82fa('0x24')](respondWithResult(_0x24cdd3,0xc9))['catch'](handleError(_0x24cdd3,null));};exports[_0x82fa('0x23')]=function(_0x160af1,_0x115685){if(_0x160af1['body']['id']){delete _0x160af1['body']['id'];}return db[_0x82fa('0x2a')][_0x82fa('0x45')]({'where':{'id':_0x160af1[_0x82fa('0x41')]['id']}})[_0x82fa('0x24')](handleEntityNotFound(_0x115685,null))['then'](saveUpdates(_0x160af1['body'],null))['then'](respondWithResult(_0x115685,null))[_0x82fa('0x46')](handleError(_0x115685,null));};exports['destroy']=function(_0x17a298,_0x105ec6){return db['VoiceTransferReport'][_0x82fa('0x45')]({'where':{'id':_0x17a298[_0x82fa('0x41')]['id']}})[_0x82fa('0x24')](handleEntityNotFound(_0x105ec6,null))[_0x82fa('0x24')](removeEntity(_0x105ec6,null))[_0x82fa('0x46')](handleError(_0x105ec6,null));};exports[_0x82fa('0x49')]=function(_0x2f5d18,_0x46c1f9){return db[_0x82fa('0x2a')]['describe']()[_0x82fa('0x24')](respondWithResult(_0x46c1f9,null))[_0x82fa('0x46')](handleError(_0x46c1f9,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 083930a..aa564f0 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 _0x13a5=['moment','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer','lodash','util','api'];(function(_0x27091c,_0x309348){var _0x3ad65a=function(_0x2be2ba){while(--_0x2be2ba){_0x27091c['push'](_0x27091c['shift']());}};_0x3ad65a(++_0x309348);}(_0x13a5,0x8d));var _0x513a=function(_0x40bc1b,_0x3fcc4e){_0x40bc1b=_0x40bc1b-0x0;var _0x58e500=_0x13a5[_0x40bc1b];return _0x58e500;};'use strict';var _=require(_0x513a('0x0'));var util=require(_0x513a('0x1'));var logger=require('../../config/logger')(_0x513a('0x2'));var moment=require(_0x513a('0x3'));var BPromise=require('bluebird');var rp=require(_0x513a('0x4'));var fs=require('fs');var path=require(_0x513a('0x5'));var rimraf=require(_0x513a('0x6'));var config=require(_0x513a('0x7'));var attributes=require(_0x513a('0x8'));module[_0x513a('0x9')]=function(_0x560db2,_0x3eed90){return _0x560db2['define'](_0x513a('0xa'),attributes,{'tableName':_0x513a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9dc3=['util','api','moment','bluebird','request-promise','path','exports','define','VoiceTransferReport','report_call_transfer','lodash'];(function(_0x46092f,_0x223615){var _0x162d22=function(_0x304945){while(--_0x304945){_0x46092f['push'](_0x46092f['shift']());}};_0x162d22(++_0x223615);}(_0x9dc3,0x154));var _0x39dc=function(_0x4bcac2,_0x18bc5f){_0x4bcac2=_0x4bcac2-0x0;var _0xf1f9a1=_0x9dc3[_0x4bcac2];return _0xf1f9a1;};'use strict';var _=require(_0x39dc('0x0'));var util=require(_0x39dc('0x1'));var logger=require('../../config/logger')(_0x39dc('0x2'));var moment=require(_0x39dc('0x3'));var BPromise=require(_0x39dc('0x4'));var rp=require(_0x39dc('0x5'));var fs=require('fs');var path=require(_0x39dc('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceTransferReport.attributes');module[_0x39dc('0x7')]=function(_0x31e7a2,_0x5f59cf){return _0x31e7a2[_0x39dc('0x8')](_0x39dc('0x9'),attributes,{'tableName':_0x39dc('0xa'),'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 a5111a9..faeca24 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 _0x9658=['VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VoiceTransferReport','body','options','raw','debug','CreateVoiceTransferReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info'];(function(_0x1e4a8e,_0x18022b){var _0x5408f9=function(_0x4ef2ed){while(--_0x4ef2ed){_0x1e4a8e['push'](_0x1e4a8e['shift']());}};_0x5408f9(++_0x18022b);}(_0x9658,0x17a));var _0x8965=function(_0xb66df,_0x4fb5ce){_0xb66df=_0xb66df-0x0;var _0x42a702=_0x9658[_0xb66df];return _0x42a702;};'use strict';var _=require(_0x8965('0x0'));var util=require(_0x8965('0x1'));var moment=require(_0x8965('0x2'));var BPromise=require(_0x8965('0x3'));var rs=require(_0x8965('0x4'));var fs=require('fs');var Redis=require(_0x8965('0x5'));var db=require(_0x8965('0x6'))['db'];var utils=require(_0x8965('0x7'));var logger=require('../../config/logger')(_0x8965('0x8'));var config=require('../../config/environment');var jayson=require(_0x8965('0x9'));var client=jayson[_0x8965('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x569f31,_0x5028cf,_0x374995){return new BPromise(function(_0x163e40,_0x3f6c25){return client[_0x8965('0xb')](_0x569f31,_0x374995)[_0x8965('0xc')](function(_0x139f70){logger[_0x8965('0xd')](_0x8965('0xe'),_0x5028cf,_0x8965('0xf'));logger['debug'](_0x8965('0x10'),_0x5028cf,_0x8965('0xf'),JSON[_0x8965('0x11')](_0x139f70));if(_0x139f70[_0x8965('0x12')]){if(_0x139f70[_0x8965('0x12')]['code']===0x1f4){logger['error'](_0x8965('0xe'),_0x5028cf,_0x139f70['error'][_0x8965('0x13')]);return _0x3f6c25(_0x139f70[_0x8965('0x12')][_0x8965('0x13')]);}logger[_0x8965('0x12')](_0x8965('0xe'),_0x5028cf,_0x139f70[_0x8965('0x12')][_0x8965('0x13')]);return _0x163e40(_0x139f70[_0x8965('0x12')]['message']);}else{logger[_0x8965('0xd')](_0x8965('0xe'),_0x5028cf,_0x8965('0xf'));_0x163e40(_0x139f70[_0x8965('0x14')][_0x8965('0x13')]);}})[_0x8965('0x15')](function(_0x3ac5f3){logger[_0x8965('0x12')](_0x8965('0xe'),_0x5028cf,_0x3ac5f3);_0x3f6c25(_0x3ac5f3);});});}exports['CreateVoiceTransferReport']=function(_0x2ab63a){var _0x202a22=this;return new Promise(function(_0x4b0228,_0x525640){return db[_0x8965('0x16')]['create'](_0x2ab63a[_0x8965('0x17')],{'raw':_0x2ab63a[_0x8965('0x18')]?_0x2ab63a[_0x8965('0x18')][_0x8965('0x19')]===undefined?!![]:![]:!![]})[_0x8965('0xc')](function(_0xb7d7d4){logger[_0x8965('0xd')]('CreateVoiceTransferReport',_0x2ab63a);logger[_0x8965('0x1a')](_0x8965('0x1b'),_0x2ab63a,JSON[_0x8965('0x11')](_0xb7d7d4));_0x4b0228(_0xb7d7d4);})[_0x8965('0x15')](function(_0x83ae05){logger['error'](_0x8965('0x1b'),_0x83ae05[_0x8965('0x13')],_0x2ab63a);_0x525640(_0x202a22[_0x8965('0x12')](0x1f4,_0x83ae05[_0x8965('0x13')]));});});}; \ No newline at end of file +var _0x967c=['client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x465ba4,_0x2f04b){var _0x17f6e8=function(_0x46ccdf){while(--_0x46ccdf){_0x465ba4['push'](_0x465ba4['shift']());}};_0x17f6e8(++_0x2f04b);}(_0x967c,0x146));var _0xc967=function(_0x29ff5e,_0x220788){_0x29ff5e=_0x29ff5e-0x0;var _0xd8135a=_0x967c[_0x29ff5e];return _0xd8135a;};'use strict';var _=require('lodash');var util=require(_0xc967('0x0'));var moment=require(_0xc967('0x1'));var BPromise=require(_0xc967('0x2'));var rs=require(_0xc967('0x3'));var fs=require('fs');var Redis=require(_0xc967('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc967('0x5'));var logger=require(_0xc967('0x6'))(_0xc967('0x7'));var config=require(_0xc967('0x8'));var jayson=require(_0xc967('0x9'));var client=jayson[_0xc967('0xa')][_0xc967('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cdc91,_0x211f1c,_0x4dfb7a){return new BPromise(function(_0x977b58,_0x5a7710){return client[_0xc967('0xc')](_0x2cdc91,_0x4dfb7a)[_0xc967('0xd')](function(_0x3087c3){logger[_0xc967('0xe')](_0xc967('0xf'),_0x211f1c,'request\x20sent');logger[_0xc967('0x10')](_0xc967('0x11'),_0x211f1c,_0xc967('0x12'),JSON[_0xc967('0x13')](_0x3087c3));if(_0x3087c3['error']){if(_0x3087c3['error']['code']===0x1f4){logger[_0xc967('0x14')](_0xc967('0xf'),_0x211f1c,_0x3087c3[_0xc967('0x14')][_0xc967('0x15')]);return _0x5a7710(_0x3087c3['error'][_0xc967('0x15')]);}logger[_0xc967('0x14')](_0xc967('0xf'),_0x211f1c,_0x3087c3[_0xc967('0x14')][_0xc967('0x15')]);return _0x977b58(_0x3087c3[_0xc967('0x14')][_0xc967('0x15')]);}else{logger[_0xc967('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x211f1c,_0xc967('0x12'));_0x977b58(_0x3087c3['result'][_0xc967('0x15')]);}})[_0xc967('0x16')](function(_0x5acfe8){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x211f1c,_0x5acfe8);_0x5a7710(_0x5acfe8);});});}exports[_0xc967('0x17')]=function(_0x488412){var _0x210cbd=this;return new Promise(function(_0x5166ca,_0x22e9a6){return db[_0xc967('0x18')][_0xc967('0x19')](_0x488412['body'],{'raw':_0x488412[_0xc967('0x1a')]?_0x488412[_0xc967('0x1a')][_0xc967('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3d2baf){logger['info'](_0xc967('0x17'),_0x488412);logger[_0xc967('0x10')](_0xc967('0x17'),_0x488412,JSON[_0xc967('0x13')](_0x3d2baf));_0x5166ca(_0x3d2baf);})[_0xc967('0x16')](function(_0xe906c8){logger['error']('CreateVoiceTransferReport',_0xe906c8[_0xc967('0x15')],_0x488412);_0x22e9a6(_0x210cbd[_0xc967('0x14')](0x1f4,_0xe906c8[_0xc967('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index ba4fa2a..1e49f70 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 _0xf4eb=['/hangup','isAuthenticated','isWebrtcLicence','hangup','/hold','hold','/unhold','unhold','/calls','calls','transfer','exports','express','/originate','originate','post'];(function(_0x2167d2,_0x3a68cd){var _0x2ded3c=function(_0x2ae64d){while(--_0x2ae64d){_0x2167d2['push'](_0x2167d2['shift']());}};_0x2ded3c(++_0x3a68cd);}(_0xf4eb,0xec));var _0xbf4e=function(_0xc7d642,_0x1f80ab){_0xc7d642=_0xc7d642-0x0;var _0x2a2383=_0xf4eb[_0xc7d642];return _0x2a2383;};'use strict';var express=require(_0xbf4e('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router['post'](_0xbf4e('0x1'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0x2')]);router[_0xbf4e('0x3')](_0xbf4e('0x4'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x3')]('/answer',auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller['answer']);router[_0xbf4e('0x3')](_0xbf4e('0x8'),auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x3')](_0xbf4e('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xb')]);router['post'](_0xbf4e('0xc'),auth[_0xbf4e('0x5')](),auth['isWebrtcLicence'](),controller[_0xbf4e('0xd')]);router['post']('/transfer',auth[_0xbf4e('0x5')](),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xe')]);module[_0xbf4e('0xf')]=router; \ No newline at end of file +var _0x34e8=['/unhold','unhold','/calls','calls','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','hold'];(function(_0x40bdbc,_0x3fabcd){var _0xc603a8=function(_0x17c0e6){while(--_0x17c0e6){_0x40bdbc['push'](_0x40bdbc['shift']());}};_0xc603a8(++_0x3fabcd);}(_0x34e8,0x12c));var _0x834e=function(_0x3a1085,_0x374be3){_0x3a1085=_0x3a1085-0x0;var _0xd60ef4=_0x34e8[_0x3a1085];return _0xd60ef4;};'use strict';var express=require(_0x834e('0x0'));var router=express[_0x834e('0x1')]();var auth=require(_0x834e('0x2'));var controller=require(_0x834e('0x3'));router['post'](_0x834e('0x4'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x7')]);router[_0x834e('0x8')](_0x834e('0x9'),auth[_0x834e('0x5')](),auth['isWebrtcLicence'](),controller[_0x834e('0xa')]);router['post'](_0x834e('0xb'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0xc')]);router[_0x834e('0x8')](_0x834e('0xd'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0xe')]);router[_0x834e('0x8')](_0x834e('0xf'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x10')]);router[_0x834e('0x8')](_0x834e('0x11'),auth[_0x834e('0x5')](),auth['isWebrtcLicence'](),controller[_0x834e('0x12')]);router[_0x834e('0x8')]('/transfer',auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x13')]);module[_0x834e('0x14')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 4fd62da..d24aafe 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 _0x4860=['hangup','hangup\x20fired:','json','webbar:hangup','hangup\x20executed!','answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','calls','UserId','conference','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','util','jayson/promise','client','../../config/logger','webbarapi','ioredis','defaults','redis','socket.io-emitter','validate','string','callNumber\x20is\x20required','number','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','send','request','code','message','result','catch','agent','then','VoiceChannels','all','filter','rows','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','length','status','userId','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x4860,0x197));var _0x0486=function(_0x3d4f30,_0x581883){_0x3d4f30=_0x3d4f30-0x0;var _0x4a95d4=_0x4860[_0x3d4f30];return _0x4a95d4;};'use strict';var path=require(_0x0486('0x0'));var fs=require('fs');var _=require(_0x0486('0x1'));var db=require(_0x0486('0x2'))['db'];var config=require('../../config/environment');var util=require(_0x0486('0x3'));var BPromise=require('bluebird');var jayson=require(_0x0486('0x4'));var amiClient=jayson[_0x0486('0x5')]['http']({'port':0x232a});var logger=require(_0x0486('0x6'))(_0x0486('0x7'));var Redis=require(_0x0486('0x8'));config['redis']=_[_0x0486('0x9')](config[_0x0486('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x0486('0xb'))(new Redis(config[_0x0486('0xa')]));var Schema=require(_0x0486('0xc'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x0486('0xd'),'required':[!![],_0x0486('0xe')]},'callerId':{'type':_0x0486('0xd')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x0486('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x0486('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x0486('0xf'),'required':[!![],_0x0486('0x10')]},'sessionId':{'type':_0x0486('0xd'),'required':[!![],_0x0486('0x11')]},'transferNumber':{'type':_0x0486('0xd'),'required':[!![],_0x0486('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x0486('0xf'),'required':[!![],_0x0486('0x10')]},'sessionId':{'type':_0x0486('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0486('0x10')]}});function emit(_0x3c3e13,_0x598f8e,_0x30ca56){logger[_0x0486('0x13')](_0x3c3e13,_0x598f8e,JSON[_0x0486('0x14')](_0x30ca56));io['to'](_0x3c3e13)[_0x0486('0x15')](_0x598f8e,_0x30ca56);}function handleError(_0x57f88d){return function(_0x1c1206){console[_0x0486('0x16')](_0x0486('0x17'),_0x1c1206,_0x1c1206 instanceof RangeError);logger[_0x0486('0x18')](_0x1c1206[_0x0486('0x19')]);if(_0x1c1206 instanceof RangeError){if(_0x1c1206[_0x0486('0x1a')]){delete _0x1c1206[_0x0486('0x1a')];}_0x57f88d['status'](0x194)[_0x0486('0x1b')](_0x1c1206);}else{if(_0x1c1206['name']){delete _0x1c1206[_0x0486('0x1a')];}_0x57f88d['status'](0x1f4)[_0x0486('0x1b')](_0x1c1206);}};}function checkError(){return function(_0x124db7){if(!_0x124db7){throw new RangeError('NotFound');}return _0x124db7;};}function respondWithRpcPromise(_0x17bdf1,_0x4320ba){return new BPromise(function(_0x33c88d,_0x331737){var _0x569658=amiClient;return _0x569658[_0x0486('0x1c')](_0x17bdf1,_0x4320ba)['then'](function(_0x34fb62){if(_0x34fb62[_0x0486('0x18')]){if(_0x34fb62[_0x0486('0x18')][_0x0486('0x1d')]===0x1f4){return _0x331737(_0x34fb62[_0x0486('0x18')][_0x0486('0x1e')]);}return _0x33c88d(_0x34fb62[_0x0486('0x18')][_0x0486('0x1e')]);}else{_0x33c88d(_0x34fb62[_0x0486('0x1f')]);}})[_0x0486('0x20')](function(_0x24b7e2){_0x331737(_0x24b7e2);});});}function getAgent(_0x2a5734){return db['User']['findOne']({'where':{'id':_0x2a5734,'role':_0x0486('0x21')}})[_0x0486('0x22')](checkError());}function getAgentCheckSession(_0x1976a6,_0x14be19){return new BPromise(function(_0x3f454d,_0x6246da){var _0x28e6cf=respondWithRpcPromise(_0x0486('0x23'));var _0x4e857c=getAgent(_0x1976a6);Promise[_0x0486('0x24')]([_0x28e6cf,_0x4e857c])[_0x0486('0x22')](function(_0x39de52){var _0x2f971f=_0x39de52[0x0];var _0x486d66=_0x39de52[0x1];var _0x3b894a=_[_0x0486('0x25')](_0x2f971f[_0x0486('0x26')],function(_0x3f1835){return _0x3f1835['UserId']==_0x486d66['id']&&_0x3f1835[_0x0486('0x27')]==_0x14be19;});if(_0x3b894a['length']==0x1){_0x3f454d(_0x486d66);}else{_0x6246da(new RangeError(_0x0486('0x28')+_0x14be19+_0x0486('0x29')));}});});}exports[_0x0486('0x2a')]=function(_0x5d920d,_0x544cfc){logger[_0x0486('0x13')](_0x0486('0x2b'),_0x5d920d[_0x0486('0x2c')]);var _0x3a6464=originateValidation[_0x0486('0xc')](_0x5d920d['body']);if(_0x3a6464[_0x0486('0x2d')]>0x0){return _0x544cfc[_0x0486('0x2e')](0x190)['json'](_0x3a6464);}var _0x2e8bdf=_0x5d920d[_0x0486('0x2c')][_0x0486('0x2f')];var _0x42c55e=_0x5d920d['body']['callNumber'];var _0x3a20f2=_0x5d920d['body'][_0x0486('0x30')];var _0x1d9390=_0x5d920d[_0x0486('0x2c')][_0x0486('0x31')];return getAgent(_0x2e8bdf)[_0x0486('0x22')](function(_0x54f376){logger['info'](_0x0486('0x32'),_0x54f376[_0x0486('0x1a')]);emit(util[_0x0486('0x33')](_0x0486('0x34'),_0x54f376['name']),_0x0486('0x35'),{'callNumber':_0x42c55e,'callerId':_0x3a20f2,'callbackUrl':_0x1d9390});return _0x544cfc[_0x0486('0x2e')](0xc8)['json']({'error':![],'message':_0x0486('0x36')});})[_0x0486('0x20')](handleError(_0x544cfc));};exports[_0x0486('0x37')]=function(_0x262771,_0x44689e){logger[_0x0486('0x13')](_0x0486('0x38'),_0x262771[_0x0486('0x2c')]);var _0x3ee4cc=hangupValidation[_0x0486('0xc')](_0x262771[_0x0486('0x2c')]);if(_0x3ee4cc[_0x0486('0x2d')]>0x0){return _0x44689e['status'](0x190)[_0x0486('0x39')](_0x3ee4cc);}var _0x358bdd=_0x262771['body'][_0x0486('0x2f')];var _0x323a69=_0x262771[_0x0486('0x2c')]['sessionId'];return getAgent(_0x358bdd)[_0x0486('0x22')](function(_0x2413f8){logger[_0x0486('0x13')](_0x0486('0x32'),_0x2413f8['name']);emit(util[_0x0486('0x33')](_0x0486('0x34'),_0x2413f8[_0x0486('0x1a')]),_0x0486('0x3a'),{'sessionId':_0x323a69});return _0x44689e[_0x0486('0x2e')](0xc8)[_0x0486('0x39')]({'error':![],'message':_0x0486('0x3b')});})[_0x0486('0x20')](handleError(_0x44689e));};exports[_0x0486('0x3c')]=function(_0x340abd,_0x5bd126){logger['info']('answer\x20fired:',_0x340abd['body']);var _0x30b772=answerValidation[_0x0486('0xc')](_0x340abd[_0x0486('0x2c')]);if(_0x30b772[_0x0486('0x2d')]>0x0){return _0x5bd126[_0x0486('0x2e')](0x190)[_0x0486('0x39')](_0x30b772);}var _0xeaba40=_0x340abd[_0x0486('0x2c')][_0x0486('0x2f')];var _0x300fd2=_0x340abd['body'][_0x0486('0x27')];return getAgent(_0xeaba40)[_0x0486('0x22')](function(_0x5aa57d){logger[_0x0486('0x13')](_0x0486('0x32'),_0x5aa57d[_0x0486('0x1a')]);emit(util[_0x0486('0x33')](_0x0486('0x34'),_0x5aa57d[_0x0486('0x1a')]),'webbar:answer',{'sessionId':_0x300fd2});return _0x5bd126[_0x0486('0x2e')](0xc8)[_0x0486('0x39')]({'error':![],'message':_0x0486('0x3d')});})['catch'](handleError(_0x5bd126));};exports[_0x0486('0x3e')]=function(_0x14638b,_0x5d8062){logger[_0x0486('0x13')](_0x0486('0x3f'),_0x14638b['body']);var _0x37ece1=holdValidation['validate'](_0x14638b[_0x0486('0x2c')]);if(_0x37ece1[_0x0486('0x2d')]>0x0){return _0x5d8062[_0x0486('0x2e')](0x190)[_0x0486('0x39')](_0x37ece1);}var _0x2115c1=_0x14638b[_0x0486('0x2c')][_0x0486('0x2f')];var _0x2ccb31=_0x14638b['body']['sessionId'];return getAgent(_0x2115c1)[_0x0486('0x22')](function(_0x338931){logger[_0x0486('0x13')](_0x0486('0x32'),_0x338931[_0x0486('0x1a')]);emit(util['format']('user:%s',_0x338931[_0x0486('0x1a')]),_0x0486('0x40'),{'sessionId':_0x2ccb31});return _0x5d8062[_0x0486('0x2e')](0xc8)[_0x0486('0x39')]({'error':![],'message':_0x0486('0x41')});})['catch'](handleError(_0x5d8062));};exports[_0x0486('0x42')]=function(_0x585188,_0x9a9d4a){logger['info'](_0x0486('0x43'),_0x585188['body']);var _0x34a8d3=unholdValidation[_0x0486('0xc')](_0x585188[_0x0486('0x2c')]);if(_0x34a8d3[_0x0486('0x2d')]>0x0){return _0x9a9d4a[_0x0486('0x2e')](0x190)['json'](_0x34a8d3);}var _0x3feda0=_0x585188[_0x0486('0x2c')][_0x0486('0x2f')];var _0x12bd92=_0x585188[_0x0486('0x2c')][_0x0486('0x27')];return getAgent(_0x3feda0)[_0x0486('0x22')](function(_0x2c074e){logger[_0x0486('0x13')](_0x0486('0x32'),_0x2c074e[_0x0486('0x1a')]);emit(util[_0x0486('0x33')](_0x0486('0x34'),_0x2c074e[_0x0486('0x1a')]),'webbar:unhold',{'sessionId':_0x12bd92});return _0x9a9d4a[_0x0486('0x2e')](0xc8)[_0x0486('0x39')]({'error':![],'message':'unhold\x20executed!'});})[_0x0486('0x20')](handleError(_0x9a9d4a));};exports[_0x0486('0x44')]=function(_0x1fc8e3,_0x4505ed){logger['info']('calls\x20fired:',_0x4505ed[_0x0486('0x2c')]);var _0x2c9810=callsValidation['validate'](_0x1fc8e3[_0x0486('0x2c')]);if(_0x2c9810[_0x0486('0x2d')]>0x0){return _0x4505ed[_0x0486('0x2e')](0x190)[_0x0486('0x39')](_0x2c9810);}var _0x3344ea=_0x1fc8e3['body']['userId'];var _0x8874ab=respondWithRpcPromise(_0x0486('0x23'));var _0x48234f=getAgent(_0x3344ea);return Promise['all']([_0x8874ab,_0x48234f])[_0x0486('0x22')](function(_0x1e8393){var _0x4bab59=_0x1e8393[0x0];var _0x4235bc=_0x1e8393[0x1];var _0x578393=_[_0x0486('0x25')](_0x4bab59[_0x0486('0x26')],function(_0x385d73){return _0x385d73[_0x0486('0x45')]==_0x4235bc['id'];});return _0x4505ed[_0x0486('0x2e')](0xc8)['json']({'count':_0x578393[_0x0486('0x2d')],'rows':_0x578393});})['catch'](handleError(_0x4505ed));};exports[_0x0486('0x46')]=function(_0x16379e,_0x22c654){logger[_0x0486('0x13')]('conference\x20fired:',_0x16379e[_0x0486('0x2c')]);var _0xcba30e=conferenceValidation[_0x0486('0xc')](_0x16379e['body']);if(_0xcba30e['length']>0x0){return _0x22c654['status'](0x190)[_0x0486('0x39')](_0xcba30e);}var _0x43f773=_0x16379e[_0x0486('0x2c')]['userId'];return getAgent(_0x43f773)[_0x0486('0x22')](function(_0x161c2d){logger[_0x0486('0x13')](_0x0486('0x32'),_0x161c2d[_0x0486('0x1a')]);emit(util[_0x0486('0x33')](_0x0486('0x34'),_0x161c2d[_0x0486('0x1a')]),_0x0486('0x47'));return _0x22c654[_0x0486('0x2e')](0xc8)[_0x0486('0x39')]({'error':![],'message':_0x0486('0x48')});})[_0x0486('0x20')](handleError(_0x22c654));};exports[_0x0486('0x49')]=function(_0x5a110d,_0xe8c93f){logger[_0x0486('0x13')]('transfer\x20fired:',_0x5a110d[_0x0486('0x2c')]);var _0x4c0b11=transferValidation[_0x0486('0xc')](_0x5a110d[_0x0486('0x2c')]);if(_0x4c0b11[_0x0486('0x2d')]>0x0){return _0xe8c93f[_0x0486('0x2e')](0x190)[_0x0486('0x39')](_0x4c0b11);}var _0x5c8070=_0x5a110d[_0x0486('0x2c')]['userId'];var _0x39bbf9=_0x5a110d['body']['sessionId'];var _0x5564cb=_0x5a110d[_0x0486('0x2c')][_0x0486('0x4a')];return getAgent(_0x5c8070)[_0x0486('0x22')](function(_0x3858c2){logger['info'](_0x0486('0x32'),_0x3858c2[_0x0486('0x1a')]);emit(util['format'](_0x0486('0x34'),_0x3858c2[_0x0486('0x1a')]),_0x0486('0x4b'),{'sessionId':_0x39bbf9,'transferNumber':_0x5564cb});return _0xe8c93f[_0x0486('0x2e')](0xc8)['json']({'error':![],'message':_0x0486('0x4c')});})['catch'](handleError(_0xe8c93f));}; \ No newline at end of file +var _0xca31=['string','number','info','stringify','log','error','stack','name','status','send','NotFound','message','User','agent','then','VoiceChannels','all','filter','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','user:%s','hangup\x20executed!','answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','UserId','webbar:conference','conference\x20executed!','transferNumber','webbar:transfer','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','http','webbarapi','redis','localhost','validate','userId\x20is\x20required'];(function(_0x585c02,_0x46b1ea){var _0x1f0d36=function(_0x265fcc){while(--_0x265fcc){_0x585c02['push'](_0x585c02['shift']());}};_0x1f0d36(++_0x46b1ea);}(_0xca31,0x1f4));var _0x1ca3=function(_0x593a37,_0x20ac5b){_0x593a37=_0x593a37-0x0;var _0x4bde96=_0xca31[_0x593a37];return _0x4bde96;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x1ca3('0x0'));var db=require(_0x1ca3('0x1'))['db'];var config=require(_0x1ca3('0x2'));var util=require(_0x1ca3('0x3'));var BPromise=require(_0x1ca3('0x4'));var jayson=require(_0x1ca3('0x5'));var amiClient=jayson['client'][_0x1ca3('0x6')]({'port':0x232a});var logger=require('../../config/logger')(_0x1ca3('0x7'));var Redis=require('ioredis');config[_0x1ca3('0x8')]=_['defaults'](config[_0x1ca3('0x8')],{'host':_0x1ca3('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1ca3('0x8')]));var Schema=require(_0x1ca3('0xa'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x1ca3('0xb')]},'callNumber':{'type':_0x1ca3('0xc'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0x1ca3('0xc')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x1ca3('0xb')]},'sessionId':{'type':_0x1ca3('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x1ca3('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x1ca3('0xd'),'required':[!![],_0x1ca3('0xb')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x1ca3('0xc'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x1ca3('0xd'),'required':[!![],_0x1ca3('0xb')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x1ca3('0xd'),'required':[!![],_0x1ca3('0xb')]},'sessionId':{'type':_0x1ca3('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x1ca3('0xd'),'required':[!![],_0x1ca3('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':_0x1ca3('0xd'),'required':[!![],_0x1ca3('0xb')]}});function emit(_0x4bb0e5,_0x3edc40,_0x6b4817){logger[_0x1ca3('0xe')](_0x4bb0e5,_0x3edc40,JSON[_0x1ca3('0xf')](_0x6b4817));io['to'](_0x4bb0e5)['emit'](_0x3edc40,_0x6b4817);}function handleError(_0x7c6383){return function(_0x2c5184){console[_0x1ca3('0x10')]('handleError:',_0x2c5184,_0x2c5184 instanceof RangeError);logger[_0x1ca3('0x11')](_0x2c5184[_0x1ca3('0x12')]);if(_0x2c5184 instanceof RangeError){if(_0x2c5184[_0x1ca3('0x13')]){delete _0x2c5184['name'];}_0x7c6383[_0x1ca3('0x14')](0x194)['send'](_0x2c5184);}else{if(_0x2c5184[_0x1ca3('0x13')]){delete _0x2c5184[_0x1ca3('0x13')];}_0x7c6383[_0x1ca3('0x14')](0x1f4)[_0x1ca3('0x15')](_0x2c5184);}};}function checkError(){return function(_0x39a7e0){if(!_0x39a7e0){throw new RangeError(_0x1ca3('0x16'));}return _0x39a7e0;};}function respondWithRpcPromise(_0x2ee6c8,_0x12a97e){return new BPromise(function(_0x19ca7e,_0x2e3532){var _0x2658ba=amiClient;return _0x2658ba['request'](_0x2ee6c8,_0x12a97e)['then'](function(_0x15951b){if(_0x15951b['error']){if(_0x15951b[_0x1ca3('0x11')]['code']===0x1f4){return _0x2e3532(_0x15951b['error'][_0x1ca3('0x17')]);}return _0x19ca7e(_0x15951b[_0x1ca3('0x11')][_0x1ca3('0x17')]);}else{_0x19ca7e(_0x15951b['result']);}})['catch'](function(_0x4cdf23){_0x2e3532(_0x4cdf23);});});}function getAgent(_0x1e2948){return db[_0x1ca3('0x18')]['findOne']({'where':{'id':_0x1e2948,'role':_0x1ca3('0x19')}})[_0x1ca3('0x1a')](checkError());}function getAgentCheckSession(_0x2949a3,_0x4c5390){return new BPromise(function(_0x291c1f,_0x291f3d){var _0x336f76=respondWithRpcPromise(_0x1ca3('0x1b'));var _0x508356=getAgent(_0x2949a3);Promise[_0x1ca3('0x1c')]([_0x336f76,_0x508356])['then'](function(_0x5bfe71){var _0x380f6b=_0x5bfe71[0x0];var _0x1847c3=_0x5bfe71[0x1];var _0x166234=_[_0x1ca3('0x1d')](_0x380f6b['rows'],function(_0x2e5060){return _0x2e5060['UserId']==_0x1847c3['id']&&_0x2e5060[_0x1ca3('0x1e')]==_0x4c5390;});if(_0x166234[_0x1ca3('0x1f')]==0x1){_0x291c1f(_0x1847c3);}else{_0x291f3d(new RangeError(_0x1ca3('0x20')+_0x4c5390+_0x1ca3('0x21')));}});});}exports[_0x1ca3('0x22')]=function(_0x25446a,_0x44e353){logger['info'](_0x1ca3('0x23'),_0x25446a[_0x1ca3('0x24')]);var _0x21f3b5=originateValidation[_0x1ca3('0xa')](_0x25446a[_0x1ca3('0x24')]);if(_0x21f3b5[_0x1ca3('0x1f')]>0x0){return _0x44e353[_0x1ca3('0x14')](0x190)[_0x1ca3('0x25')](_0x21f3b5);}var _0x531b09=_0x25446a[_0x1ca3('0x24')][_0x1ca3('0x26')];var _0x4ab145=_0x25446a[_0x1ca3('0x24')][_0x1ca3('0x27')];var _0x30fb16=_0x25446a[_0x1ca3('0x24')]['callerId'];var _0x5b1631=_0x25446a[_0x1ca3('0x24')][_0x1ca3('0x28')];return getAgent(_0x531b09)[_0x1ca3('0x1a')](function(_0xa44837){logger[_0x1ca3('0xe')](_0x1ca3('0x29'),_0xa44837[_0x1ca3('0x13')]);emit(util[_0x1ca3('0x2a')]('user:%s',_0xa44837[_0x1ca3('0x13')]),_0x1ca3('0x2b'),{'callNumber':_0x4ab145,'callerId':_0x30fb16,'callbackUrl':_0x5b1631});return _0x44e353[_0x1ca3('0x14')](0xc8)[_0x1ca3('0x25')]({'error':![],'message':_0x1ca3('0x2c')});})[_0x1ca3('0x2d')](handleError(_0x44e353));};exports[_0x1ca3('0x2e')]=function(_0x1263a8,_0x79a280){logger[_0x1ca3('0xe')](_0x1ca3('0x2f'),_0x1263a8[_0x1ca3('0x24')]);var _0x289a52=hangupValidation[_0x1ca3('0xa')](_0x1263a8[_0x1ca3('0x24')]);if(_0x289a52[_0x1ca3('0x1f')]>0x0){return _0x79a280[_0x1ca3('0x14')](0x190)[_0x1ca3('0x25')](_0x289a52);}var _0x369fda=_0x1263a8[_0x1ca3('0x24')][_0x1ca3('0x26')];var _0x215765=_0x1263a8[_0x1ca3('0x24')][_0x1ca3('0x1e')];return getAgent(_0x369fda)['then'](function(_0x226a18){logger[_0x1ca3('0xe')]('entityFound:',_0x226a18[_0x1ca3('0x13')]);emit(util['format'](_0x1ca3('0x30'),_0x226a18['name']),'webbar:hangup',{'sessionId':_0x215765});return _0x79a280[_0x1ca3('0x14')](0xc8)['json']({'error':![],'message':_0x1ca3('0x31')});})[_0x1ca3('0x2d')](handleError(_0x79a280));};exports[_0x1ca3('0x32')]=function(_0x5f22b8,_0x3ad204){logger[_0x1ca3('0xe')]('answer\x20fired:',_0x5f22b8[_0x1ca3('0x24')]);var _0x44e06c=answerValidation[_0x1ca3('0xa')](_0x5f22b8[_0x1ca3('0x24')]);if(_0x44e06c[_0x1ca3('0x1f')]>0x0){return _0x3ad204[_0x1ca3('0x14')](0x190)['json'](_0x44e06c);}var _0x241538=_0x5f22b8['body'][_0x1ca3('0x26')];var _0x18d7ba=_0x5f22b8[_0x1ca3('0x24')][_0x1ca3('0x1e')];return getAgent(_0x241538)[_0x1ca3('0x1a')](function(_0x1d990f){logger[_0x1ca3('0xe')]('entityFound:',_0x1d990f[_0x1ca3('0x13')]);emit(util[_0x1ca3('0x2a')](_0x1ca3('0x30'),_0x1d990f[_0x1ca3('0x13')]),'webbar:answer',{'sessionId':_0x18d7ba});return _0x3ad204['status'](0xc8)[_0x1ca3('0x25')]({'error':![],'message':_0x1ca3('0x33')});})[_0x1ca3('0x2d')](handleError(_0x3ad204));};exports['hold']=function(_0x1d9885,_0x1db949){logger['info'](_0x1ca3('0x34'),_0x1d9885[_0x1ca3('0x24')]);var _0x2fb25e=holdValidation['validate'](_0x1d9885[_0x1ca3('0x24')]);if(_0x2fb25e[_0x1ca3('0x1f')]>0x0){return _0x1db949[_0x1ca3('0x14')](0x190)[_0x1ca3('0x25')](_0x2fb25e);}var _0x1945a5=_0x1d9885[_0x1ca3('0x24')][_0x1ca3('0x26')];var _0x259699=_0x1d9885[_0x1ca3('0x24')][_0x1ca3('0x1e')];return getAgent(_0x1945a5)[_0x1ca3('0x1a')](function(_0x17466c){logger[_0x1ca3('0xe')](_0x1ca3('0x29'),_0x17466c[_0x1ca3('0x13')]);emit(util[_0x1ca3('0x2a')]('user:%s',_0x17466c['name']),_0x1ca3('0x35'),{'sessionId':_0x259699});return _0x1db949[_0x1ca3('0x14')](0xc8)['json']({'error':![],'message':_0x1ca3('0x36')});})[_0x1ca3('0x2d')](handleError(_0x1db949));};exports[_0x1ca3('0x37')]=function(_0x597ac2,_0x3b3013){logger['info']('unhold\x20fired:',_0x597ac2[_0x1ca3('0x24')]);var _0x3464ea=unholdValidation[_0x1ca3('0xa')](_0x597ac2[_0x1ca3('0x24')]);if(_0x3464ea[_0x1ca3('0x1f')]>0x0){return _0x3b3013[_0x1ca3('0x14')](0x190)['json'](_0x3464ea);}var _0x1df2de=_0x597ac2[_0x1ca3('0x24')][_0x1ca3('0x26')];var _0x12dd1b=_0x597ac2[_0x1ca3('0x24')]['sessionId'];return getAgent(_0x1df2de)[_0x1ca3('0x1a')](function(_0x26e630){logger[_0x1ca3('0xe')](_0x1ca3('0x29'),_0x26e630[_0x1ca3('0x13')]);emit(util[_0x1ca3('0x2a')](_0x1ca3('0x30'),_0x26e630['name']),_0x1ca3('0x38'),{'sessionId':_0x12dd1b});return _0x3b3013[_0x1ca3('0x14')](0xc8)[_0x1ca3('0x25')]({'error':![],'message':_0x1ca3('0x39')});})[_0x1ca3('0x2d')](handleError(_0x3b3013));};exports[_0x1ca3('0x3a')]=function(_0x407ca5,_0x2e000e){logger['info']('calls\x20fired:',_0x2e000e[_0x1ca3('0x24')]);var _0x49963b=callsValidation[_0x1ca3('0xa')](_0x407ca5[_0x1ca3('0x24')]);if(_0x49963b[_0x1ca3('0x1f')]>0x0){return _0x2e000e[_0x1ca3('0x14')](0x190)[_0x1ca3('0x25')](_0x49963b);}var _0x55fc3a=_0x407ca5[_0x1ca3('0x24')][_0x1ca3('0x26')];var _0x56f276=respondWithRpcPromise(_0x1ca3('0x1b'));var _0x384a20=getAgent(_0x55fc3a);return Promise[_0x1ca3('0x1c')]([_0x56f276,_0x384a20])[_0x1ca3('0x1a')](function(_0x2a7780){var _0x13152d=_0x2a7780[0x0];var _0x18be28=_0x2a7780[0x1];var _0x308978=_['filter'](_0x13152d['rows'],function(_0x54ed80){return _0x54ed80[_0x1ca3('0x3b')]==_0x18be28['id'];});return _0x2e000e['status'](0xc8)['json']({'count':_0x308978[_0x1ca3('0x1f')],'rows':_0x308978});})['catch'](handleError(_0x2e000e));};exports['conference']=function(_0x44342b,_0x131693){logger[_0x1ca3('0xe')]('conference\x20fired:',_0x44342b['body']);var _0x429481=conferenceValidation[_0x1ca3('0xa')](_0x44342b[_0x1ca3('0x24')]);if(_0x429481[_0x1ca3('0x1f')]>0x0){return _0x131693[_0x1ca3('0x14')](0x190)['json'](_0x429481);}var _0x23070f=_0x44342b[_0x1ca3('0x24')][_0x1ca3('0x26')];return getAgent(_0x23070f)[_0x1ca3('0x1a')](function(_0xfa7d65){logger[_0x1ca3('0xe')]('entityFound:',_0xfa7d65[_0x1ca3('0x13')]);emit(util[_0x1ca3('0x2a')](_0x1ca3('0x30'),_0xfa7d65[_0x1ca3('0x13')]),_0x1ca3('0x3c'));return _0x131693[_0x1ca3('0x14')](0xc8)[_0x1ca3('0x25')]({'error':![],'message':_0x1ca3('0x3d')});})[_0x1ca3('0x2d')](handleError(_0x131693));};exports['transfer']=function(_0x2d7f95,_0x3561e4){logger['info']('transfer\x20fired:',_0x2d7f95[_0x1ca3('0x24')]);var _0x4a1803=transferValidation[_0x1ca3('0xa')](_0x2d7f95[_0x1ca3('0x24')]);if(_0x4a1803[_0x1ca3('0x1f')]>0x0){return _0x3561e4['status'](0x190)[_0x1ca3('0x25')](_0x4a1803);}var _0x16e6e3=_0x2d7f95[_0x1ca3('0x24')][_0x1ca3('0x26')];var _0x4956cb=_0x2d7f95[_0x1ca3('0x24')][_0x1ca3('0x1e')];var _0xf4bf6f=_0x2d7f95[_0x1ca3('0x24')][_0x1ca3('0x3e')];return getAgent(_0x16e6e3)['then'](function(_0x4bf79a){logger[_0x1ca3('0xe')](_0x1ca3('0x29'),_0x4bf79a[_0x1ca3('0x13')]);emit(util[_0x1ca3('0x2a')]('user:%s',_0x4bf79a[_0x1ca3('0x13')]),_0x1ca3('0x3f'),{'sessionId':_0x4956cb,'transferNumber':_0xf4bf6f});return _0x3561e4['status'](0xc8)[_0x1ca3('0x25')]({'error':![],'message':'transfer\x20executed!'});})[_0x1ca3('0x2d')](handleError(_0x3561e4));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 31506ae..9af530c 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 _0xfd9a=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports'];(function(_0x1bb91a,_0x3090fa){var _0x206a80=function(_0x5a27ff){while(--_0x5a27ff){_0x1bb91a['push'](_0x1bb91a['shift']());}};_0x206a80(++_0x3090fa);}(_0xfd9a,0x1ad));var _0xafd9=function(_0x2124b1,_0x297e75){_0x2124b1=_0x2124b1-0x0;var _0x48ebf4=_0xfd9a[_0x2124b1];return _0x48ebf4;};'use strict';var multer=require(_0xafd9('0x0'));var util=require(_0xafd9('0x1'));var path=require(_0xafd9('0x2'));var timeout=require(_0xafd9('0x3'));var express=require(_0xafd9('0x4'));var router=express[_0xafd9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xafd9('0x6'));var interaction=require(_0xafd9('0x7'));var config=require('../../config/environment');var controller=require(_0xafd9('0x8'));router[_0xafd9('0x9')]('/',auth[_0xafd9('0xa')](),controller['index']);router[_0xafd9('0x9')](_0xafd9('0xb'),auth[_0xafd9('0xa')](),controller[_0xafd9('0xc')]);router[_0xafd9('0x9')](_0xafd9('0xd'),auth[_0xafd9('0xa')](),controller[_0xafd9('0xe')]);router[_0xafd9('0x9')](_0xafd9('0xf'),auth[_0xafd9('0xa')](),controller[_0xafd9('0x10')]);router[_0xafd9('0x9')](_0xafd9('0x11'),auth[_0xafd9('0xa')](),controller['getAnswers']);router[_0xafd9('0x9')](_0xafd9('0x12'),auth[_0xafd9('0xa')](),controller[_0xafd9('0x13')]);router['get'](_0xafd9('0x14'),auth[_0xafd9('0xa')](),controller[_0xafd9('0x15')]);router[_0xafd9('0x16')]('/',auth[_0xafd9('0xa')](),controller[_0xafd9('0x17')]);router['post'](_0xafd9('0xf'),auth[_0xafd9('0xa')](),controller[_0xafd9('0x18')]);router['post'](_0xafd9('0x11'),auth[_0xafd9('0xa')](),controller[_0xafd9('0x19')]);router[_0xafd9('0x16')](_0xafd9('0x12'),auth[_0xafd9('0xa')](),controller[_0xafd9('0x1a')]);router['post']('/:id/applications',auth[_0xafd9('0xa')](),controller[_0xafd9('0x1b')]);router['post'](_0xafd9('0x1c'),controller[_0xafd9('0x1d')]);router[_0xafd9('0x16')](_0xafd9('0x1e'),auth['isAuthenticated'](),controller['send']);router[_0xafd9('0x1f')](_0xafd9('0xd'),auth['isAuthenticated'](),controller[_0xafd9('0x20')]);router[_0xafd9('0x21')](_0xafd9('0xd'),auth['isAuthenticated'](),controller[_0xafd9('0x22')]);router[_0xafd9('0x21')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xafd9('0x23')]);router[_0xafd9('0x21')](_0xafd9('0x11'),auth[_0xafd9('0xa')](),controller[_0xafd9('0x24')]);router[_0xafd9('0x21')](_0xafd9('0x12'),auth[_0xafd9('0xa')](),controller[_0xafd9('0x25')]);module[_0xafd9('0x26')]=router; \ No newline at end of file +var _0xf4a6=['addAgents','addApplications','/:id/notify','send','put','update','delete','destroy','removeAnswers','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','describe','/:id','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/users','getAgents','/:id/applications','create','post','/:id/canned_answers','addAnswer'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xf4a6,0x1c4));var _0x6f4a=function(_0xdb158d,_0x5b6178){_0xdb158d=_0xdb158d-0x0;var _0x256286=_0xf4a6[_0xdb158d];return _0x256286;};'use strict';var multer=require(_0x6f4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6f4a('0x1'));var express=require(_0x6f4a('0x2'));var router=express[_0x6f4a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6f4a('0x4'));var interaction=require(_0x6f4a('0x5'));var config=require(_0x6f4a('0x6'));var controller=require(_0x6f4a('0x7'));router[_0x6f4a('0x8')]('/',auth['isAuthenticated'](),controller[_0x6f4a('0x9')]);router[_0x6f4a('0x8')](_0x6f4a('0xa'),auth['isAuthenticated'](),controller[_0x6f4a('0xb')]);router[_0x6f4a('0x8')](_0x6f4a('0xc'),auth['isAuthenticated'](),controller[_0x6f4a('0xd')]);router[_0x6f4a('0x8')](_0x6f4a('0xe'),auth[_0x6f4a('0xf')](),controller[_0x6f4a('0x10')]);router[_0x6f4a('0x8')]('/:id/canned_answers',auth[_0x6f4a('0xf')](),controller['getAnswers']);router[_0x6f4a('0x8')](_0x6f4a('0x11'),auth[_0x6f4a('0xf')](),controller[_0x6f4a('0x12')]);router['get'](_0x6f4a('0x13'),auth[_0x6f4a('0xf')](),controller['getApplications']);router['post']('/',auth[_0x6f4a('0xf')](),controller[_0x6f4a('0x14')]);router[_0x6f4a('0x15')](_0x6f4a('0xe'),auth[_0x6f4a('0xf')](),controller['addDisposition']);router[_0x6f4a('0x15')](_0x6f4a('0x16'),auth[_0x6f4a('0xf')](),controller[_0x6f4a('0x17')]);router[_0x6f4a('0x15')]('/:id/users',auth[_0x6f4a('0xf')](),controller[_0x6f4a('0x18')]);router[_0x6f4a('0x15')]('/:id/applications',auth[_0x6f4a('0xf')](),controller[_0x6f4a('0x19')]);router[_0x6f4a('0x15')](_0x6f4a('0x1a'),controller['notify']);router[_0x6f4a('0x15')]('/:id/send',auth[_0x6f4a('0xf')](),controller[_0x6f4a('0x1b')]);router[_0x6f4a('0x1c')](_0x6f4a('0xc'),auth[_0x6f4a('0xf')](),controller[_0x6f4a('0x1d')]);router[_0x6f4a('0x1e')](_0x6f4a('0xc'),auth[_0x6f4a('0xf')](),controller[_0x6f4a('0x1f')]);router['delete'](_0x6f4a('0xe'),auth[_0x6f4a('0xf')](),controller['removeDispositions']);router['delete'](_0x6f4a('0x16'),auth[_0x6f4a('0xf')](),controller[_0x6f4a('0x20')]);router[_0x6f4a('0x1e')]('/:id/users',auth[_0x6f4a('0xf')](),controller['removeAgents']);module[_0x6f4a('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index fff2f12..30bb0d0 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 _0x4af9=['sequelize','randomstring','name','STRING','generate','ENUM','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x4af9,0x12c));var _0x94af=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4af9[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x94af('0x0'));var rs=require(_0x94af('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x94af('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x94af('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x94af('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x94af('0x3')],'defaultValue':function(){return rs[_0x94af('0x4')]();}},'phone':{'type':Sequelize[_0x94af('0x3')]},'type':{'type':Sequelize[_0x94af('0x5')]('twilio',_0x94af('0x6'))},'accountSid':{'type':Sequelize[_0x94af('0x3')]},'baseUrl':{'type':Sequelize[_0x94af('0x3')]},'authToken':{'type':Sequelize[_0x94af('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x94af('0x7');}},'notificationSound':{'type':Sequelize[_0x94af('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x94af('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x94af('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x94af('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x94af('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x94af('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x94af('0x9')],'comment':_0x94af('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x94af('0xb'),'set':function(_0x3a1610){if(!_0x3a1610){this['setDataValue'](_0x94af('0xc'),null);}this[_0x94af('0xd')](_0x94af('0xe'),_0x3a1610);}},'description':{'type':Sequelize[_0x94af('0x3')]}}; \ No newline at end of file +var _0x3b0d=['sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','randomstring','STRING','name','generate','ENUM','twilio'];(function(_0x45ce08,_0x59dcc7){var _0x23dff2=function(_0x1ad0e5){while(--_0x1ad0e5){_0x45ce08['push'](_0x45ce08['shift']());}};_0x23dff2(++_0x59dcc7);}(_0x3b0d,0x1db));var _0xd3b0=function(_0x114adc,_0x1b1c55){_0x114adc=_0x114adc-0x0;var _0x19199a=_0x3b0d[_0x114adc];return _0x19199a;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xd3b0('0x0'));module['exports']={'name':{'type':Sequelize[_0xd3b0('0x1')],'unique':_0xd3b0('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xd3b0('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xd3b0('0x3')]();}},'phone':{'type':Sequelize[_0xd3b0('0x1')]},'type':{'type':Sequelize[_0xd3b0('0x4')](_0xd3b0('0x5'),_0xd3b0('0x6'))},'accountSid':{'type':Sequelize[_0xd3b0('0x1')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xd3b0('0x7');}},'notificationSound':{'type':Sequelize[_0xd3b0('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xd3b0('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd3b0('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd3b0('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd3b0('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd3b0('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd3b0('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd3b0('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd3b0('0x9')],'comment':_0xd3b0('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xd3b0('0x8')],'defaultValue':![],'comment':_0xd3b0('0xb'),'set':function(_0x10893c){if(!_0x10893c){this['setDataValue'](_0xd3b0('0xc'),null);}this['setDataValue']('mandatoryDisposition',_0x10893c);}},'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 f2a79ff..156a7a5 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 _0xefab=['autoclose','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','Content-Type','\x0a','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','./whatsappAccount.socket','register','jayson/promise','http','request','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','status','offset','limit','undefined','count','Content-Range','apply','reject','save','destroy','then','WhatsappAccounts','UserProfileResource','sendStatus','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','include','findAll','rows','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','getDispositions','findOne','order','WhatsappAccountId','includeAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','stack','finally','json','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','WhatsappMessage','timestamp','message_id','applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','from','From','replace','Body','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','Contacts','DESC','contact','WhatsappInteraction','interaction','created'];(function(_0x18a913,_0xe0446e){var _0x5db961=function(_0xe8a85){while(--_0xe8a85){_0x18a913['push'](_0x18a913['shift']());}};_0x5db961(++_0xe0446e);}(_0xefab,0x1a5));var _0xbefa=function(_0x571c00,_0x3ae028){_0x571c00=_0x571c00-0x0;var _0x2887df=_0xefab[_0x571c00];return _0x2887df;};'use strict';var emlformat=require(_0xbefa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbefa('0x1'));var jsonpatch=require(_0xbefa('0x2'));var rp=require('request-promise');var moment=require(_0xbefa('0x3'));var BPromise=require(_0xbefa('0x4'));var Mustache=require(_0xbefa('0x5'));var util=require(_0xbefa('0x6'));var path=require(_0xbefa('0x7'));var sox=require(_0xbefa('0x8'));var csv=require(_0xbefa('0x9'));var ejs=require(_0xbefa('0xa'));var fs=require('fs');var fs_extra=require(_0xbefa('0xb'));var _=require(_0xbefa('0xc'));var squel=require('squel');var crypto=require(_0xbefa('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbefa('0xe'));var toCsv=require(_0xbefa('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbefa('0xf'));var authService=require(_0xbefa('0x10'));var qs=require(_0xbefa('0x11'));var as=require(_0xbefa('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbefa('0x13'));var utils=require(_0xbefa('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbefa('0x15'));var db=require(_0xbefa('0x16'))['db'];config['redis']=_[_0xbefa('0x17')](config[_0xbefa('0x18')],{'host':_0xbefa('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbefa('0x18')]));require(_0xbefa('0x1a'))[_0xbefa('0x1b')](socket);var jayson=require(_0xbefa('0x1c'));var client=jayson['client'][_0xbefa('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x10f06a,_0x13b105,_0x23e0a2,_0x381d03){return new BPromise(function(_0x2a1267,_0x249abc){var _0x2962b4=_0x381d03||client;return _0x2962b4[_0xbefa('0x1e')](_0x10f06a,_0x23e0a2)['then'](function(_0x3f339a){logger['info'](_0xbefa('0x1f'),_0x13b105,_0xbefa('0x20'));logger[_0xbefa('0x21')](_0xbefa('0x22'),_0x13b105,_0xbefa('0x20'),JSON[_0xbefa('0x23')](_0x3f339a));if(_0x3f339a[_0xbefa('0x24')]){if(_0x3f339a['error']['code']===0x1f4){logger[_0xbefa('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x13b105,_0x3f339a[_0xbefa('0x24')][_0xbefa('0x25')]);return _0x249abc(_0x3f339a[_0xbefa('0x24')][_0xbefa('0x25')]);}logger[_0xbefa('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x13b105,_0x3f339a[_0xbefa('0x24')][_0xbefa('0x25')]);return _0x2a1267(_0x3f339a[_0xbefa('0x24')][_0xbefa('0x25')]);}else{logger[_0xbefa('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x13b105,'request\x20sent');_0x2a1267(_0x3f339a['result']['message']);}})[_0xbefa('0x27')](function(_0x52ec0f){logger[_0xbefa('0x24')](_0xbefa('0x1f'),_0x13b105,_0x52ec0f);_0x249abc(_0x52ec0f);});});}function respondWithStatusCode(_0x527c51,_0x3c2b51){_0x3c2b51=_0x3c2b51||0xcc;return function(_0xdc1f4e){if(_0xdc1f4e){return _0x527c51['sendStatus'](_0x3c2b51);}return _0x527c51[_0xbefa('0x28')](_0x3c2b51)['end']();};}function respondWithResult(_0x47e7e7,_0x1f19f5){_0x1f19f5=_0x1f19f5||0xc8;return function(_0x54b5c9){if(_0x54b5c9){return _0x47e7e7['status'](_0x1f19f5)['json'](_0x54b5c9);}};}function respondWithFilteredResult(_0x632ecb,_0x1bbeff){return function(_0x4decf8){if(_0x4decf8){var _0xcf584b=typeof _0x1bbeff[_0xbefa('0x29')]==='undefined'&&typeof _0x1bbeff[_0xbefa('0x2a')]===_0xbefa('0x2b');var _0x58e1d6=_0x4decf8['count'];var _0x2f7025=_0xcf584b?0x0:_0x1bbeff[_0xbefa('0x29')];var _0x1109d9=_0xcf584b?_0x4decf8[_0xbefa('0x2c')]:_0x1bbeff[_0xbefa('0x29')]+_0x1bbeff[_0xbefa('0x2a')];var _0x68b5c6;if(_0x1109d9>=_0x58e1d6){_0x1109d9=_0x58e1d6;_0x68b5c6=0xc8;}else{_0x68b5c6=0xce;}_0x632ecb['status'](_0x68b5c6);return _0x632ecb['set'](_0xbefa('0x2d'),_0x2f7025+'-'+_0x1109d9+'/'+_0x58e1d6)['json'](_0x4decf8);}return null;};}function patchUpdates(_0x4f93a3){return function(_0x57f08e){try{jsonpatch[_0xbefa('0x2e')](_0x57f08e,_0x4f93a3,!![]);}catch(_0x288600){return BPromise[_0xbefa('0x2f')](_0x288600);}return _0x57f08e[_0xbefa('0x30')]();};}function saveUpdates(_0x2c4faa,_0x2a611d){return function(_0x209b67){if(_0x209b67){return _0x209b67['update'](_0x2c4faa)['then'](function(_0x302f7a){return _0x302f7a;});}return null;};}function removeEntity(_0x2ecadb,_0x850c8d){return function(_0x56b417){if(_0x56b417){return _0x56b417[_0xbefa('0x31')]()[_0xbefa('0x32')](function(){var _0x52d540=_0x56b417['get']({'plain':!![]});var _0x36b1dc=_0xbefa('0x33');return db[_0xbefa('0x34')]['destroy']({'where':{'type':_0x36b1dc,'resourceId':_0x52d540['id']}})['then'](function(){return _0x56b417;});})['then'](function(){_0x2ecadb[_0xbefa('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd0de81,_0x1206a9){return function(_0x4112d4){if(!_0x4112d4){_0xd0de81[_0xbefa('0x35')](0x194);}return _0x4112d4;};}function handleError(_0x39ba45,_0x3af5a3){_0x3af5a3=_0x3af5a3||0x1f4;return function(_0xdfda59){logger[_0xbefa('0x24')](_0xdfda59['stack']);if(_0xdfda59['name']){delete _0xdfda59[_0xbefa('0x36')];}_0x39ba45[_0xbefa('0x28')](_0x3af5a3)[_0xbefa('0x37')](_0xdfda59);};}exports[_0xbefa('0x38')]=function(_0x3d6446,_0x363c0e){var _0x292282={'include':[{'model':db[_0xbefa('0x39')],'as':_0xbefa('0x3a')}]},_0x323dda={},_0x2b5b6d={'count':0x0,'rows':[]};var _0x577ddb=_[_0xbefa('0x3b')](db[_0xbefa('0x3c')][_0xbefa('0x3d')],function(_0x3662c6){return{'name':_0x3662c6[_0xbefa('0x3e')],'type':_0x3662c6['type'][_0xbefa('0x3f')]};});_0x323dda[_0xbefa('0x40')]=_['map'](_0x577ddb,_0xbefa('0x36'));_0x323dda[_0xbefa('0x41')]=_[_0xbefa('0x42')](_0x3d6446[_0xbefa('0x41')]);_0x323dda[_0xbefa('0x43')]=_[_0xbefa('0x44')](_0x323dda[_0xbefa('0x40')],_0x323dda['query']);_0x292282[_0xbefa('0x45')]=_[_0xbefa('0x44')](_0x323dda[_0xbefa('0x40')],qs[_0xbefa('0x46')](_0x3d6446[_0xbefa('0x41')][_0xbefa('0x46')]));_0x292282[_0xbefa('0x45')]=_0x292282[_0xbefa('0x45')][_0xbefa('0x47')]?_0x292282[_0xbefa('0x45')]:_0x323dda[_0xbefa('0x40')];if(!_0x3d6446['query'][_0xbefa('0x48')](_0xbefa('0x49'))){_0x292282[_0xbefa('0x2a')]=qs[_0xbefa('0x2a')](_0x3d6446[_0xbefa('0x41')][_0xbefa('0x2a')]);_0x292282[_0xbefa('0x29')]=qs[_0xbefa('0x29')](_0x3d6446['query'][_0xbefa('0x29')]);}_0x292282['order']=qs[_0xbefa('0x4a')](_0x3d6446[_0xbefa('0x41')]['sort']);_0x292282[_0xbefa('0x4b')]=qs[_0xbefa('0x43')](_[_0xbefa('0x4c')](_0x3d6446[_0xbefa('0x41')],_0x323dda[_0xbefa('0x43')]),_0x577ddb);if(_0x3d6446['query'][_0xbefa('0x4d')]){_0x292282[_0xbefa('0x4b')]=_[_0xbefa('0x4e')](_0x292282['where'],{'$or':_[_0xbefa('0x3b')](_0x577ddb,function(_0x39514d){if(_0x39514d[_0xbefa('0x4f')]!=='VIRTUAL'){var _0x21043d={};_0x21043d[_0x39514d[_0xbefa('0x36')]]={'$like':'%'+_0x3d6446[_0xbefa('0x41')][_0xbefa('0x4d')]+'%'};return _0x21043d;}})});}_0x292282=_[_0xbefa('0x4e')]({},_0x292282,_0x3d6446[_0xbefa('0x50')]);var _0x46dd28={'where':_0x292282[_0xbefa('0x4b')]};return db[_0xbefa('0x3c')][_0xbefa('0x2c')](_0x46dd28)[_0xbefa('0x32')](function(_0xb92050){_0x2b5b6d[_0xbefa('0x2c')]=_0xb92050;if(_0x3d6446[_0xbefa('0x41')]['includeAll']){_0x292282[_0xbefa('0x51')]=[{'all':!![]}];}return db[_0xbefa('0x3c')][_0xbefa('0x52')](_0x292282);})[_0xbefa('0x32')](function(_0x461cdd){_0x2b5b6d[_0xbefa('0x53')]=_0x461cdd;return _0x2b5b6d;})[_0xbefa('0x32')](respondWithFilteredResult(_0x363c0e,_0x292282))[_0xbefa('0x27')](handleError(_0x363c0e,null));};exports[_0xbefa('0x54')]=function(_0x3f3ecb,_0x29aebc){var _0x2ad6d1={'raw':![],'where':{'id':_0x3f3ecb[_0xbefa('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0xbefa('0x3a')}]},_0x92fda8={};_0x92fda8[_0xbefa('0x40')]=_[_0xbefa('0x42')](db['WhatsappAccount'][_0xbefa('0x3d')]);_0x92fda8['query']=_[_0xbefa('0x42')](_0x3f3ecb[_0xbefa('0x41')]);_0x92fda8[_0xbefa('0x43')]=_[_0xbefa('0x44')](_0x92fda8[_0xbefa('0x40')],_0x92fda8[_0xbefa('0x41')]);_0x2ad6d1['attributes']=_[_0xbefa('0x44')](_0x92fda8[_0xbefa('0x40')],qs[_0xbefa('0x46')](_0x3f3ecb['query'][_0xbefa('0x46')]));_0x2ad6d1['attributes']=_0x2ad6d1[_0xbefa('0x45')][_0xbefa('0x47')]?_0x2ad6d1[_0xbefa('0x45')]:_0x92fda8[_0xbefa('0x40')];if(_0x3f3ecb['query']['includeAll']){_0x2ad6d1['include']=[{'all':!![]}];}_0x2ad6d1=_[_0xbefa('0x4e')]({},_0x2ad6d1,_0x3f3ecb['options']);return db['WhatsappAccount'][_0xbefa('0x56')](_0x2ad6d1)['then'](handleEntityNotFound(_0x29aebc,null))[_0xbefa('0x32')](respondWithResult(_0x29aebc,null))['catch'](handleError(_0x29aebc,null));};exports['create']=function(_0x5c3296,_0x396f2e){return db['WhatsappAccount'][_0xbefa('0x57')](_0x5c3296[_0xbefa('0x58')],{})[_0xbefa('0x32')](function(_0x3087d6){var _0x301ed8=_0x5c3296[_0xbefa('0x59')][_0xbefa('0x5a')]({'plain':!![]});if(!_0x301ed8)throw new Error(_0xbefa('0x5b'));if(_0x301ed8[_0xbefa('0x5c')]===_0xbefa('0x59')){var _0x5dd4c9=_0x3087d6[_0xbefa('0x5a')]({'plain':!![]});var _0x7a429=_0xbefa('0x33');return db[_0xbefa('0x5d')]['find']({'where':{'name':_0x7a429,'userProfileId':_0x301ed8[_0xbefa('0x5e')]},'raw':!![]})[_0xbefa('0x32')](function(_0x36742d){if(_0x36742d&&_0x36742d[_0xbefa('0x5f')]===0x0){return db[_0xbefa('0x34')][_0xbefa('0x57')]({'name':_0x5dd4c9[_0xbefa('0x36')],'resourceId':_0x5dd4c9['id'],'type':_0x36742d[_0xbefa('0x36')],'sectionId':_0x36742d['id']},{})[_0xbefa('0x32')](function(){return _0x3087d6;});}else{return _0x3087d6;}})[_0xbefa('0x27')](function(_0x40597e){logger[_0xbefa('0x24')](_0xbefa('0x60'),_0x40597e);throw _0x40597e;});}return _0x3087d6;})[_0xbefa('0x32')](respondWithResult(_0x396f2e,0xc9))['catch'](handleError(_0x396f2e,null));};exports[_0xbefa('0x61')]=function(_0x14dbb8,_0x255077){if(_0x14dbb8[_0xbefa('0x58')]['id']){delete _0x14dbb8[_0xbefa('0x58')]['id'];}return db[_0xbefa('0x3c')][_0xbefa('0x56')]({'where':{'id':_0x14dbb8[_0xbefa('0x55')]['id']},'include':[{'model':db[_0xbefa('0x39')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x255077,null))[_0xbefa('0x32')](saveUpdates(_0x14dbb8[_0xbefa('0x58')],null))['then'](respondWithResult(_0x255077,null))['catch'](handleError(_0x255077,null));};exports['destroy']=function(_0x295471,_0x43b9bc){return db['WhatsappAccount'][_0xbefa('0x56')]({'where':{'id':_0x295471['params']['id']}})[_0xbefa('0x32')](handleEntityNotFound(_0x43b9bc,null))[_0xbefa('0x32')](removeEntity(_0x43b9bc,null))[_0xbefa('0x27')](handleError(_0x43b9bc,null));};exports[_0xbefa('0x62')]=function(_0x30e260,_0x531938){return db['WhatsappAccount'][_0xbefa('0x62')]()[_0xbefa('0x32')](respondWithResult(_0x531938,null))['catch'](handleError(_0x531938,null));};exports[_0xbefa('0x63')]=function(_0x56af0d,_0x5259ce,_0x9e36e){if(_0x56af0d['body']['id']){delete _0x56af0d[_0xbefa('0x58')]['id'];}return db[_0xbefa('0x3c')][_0xbefa('0x56')]({'where':{'id':_0x56af0d[_0xbefa('0x55')]['id']}})[_0xbefa('0x32')](handleEntityNotFound(_0x5259ce,null))[_0xbefa('0x32')](function(_0x4cd997){if(_0x4cd997){_0x56af0d[_0xbefa('0x58')]['WhatsappAccountId']=_0x4cd997['id'];return db[_0xbefa('0x64')][_0xbefa('0x57')](_0x56af0d[_0xbefa('0x58')]);}})['then'](respondWithResult(_0x5259ce,null))[_0xbefa('0x27')](handleError(_0x5259ce,null));};exports[_0xbefa('0x65')]=function(_0x115af4,_0x23347e,_0x1f8357){var _0x287271={'raw':![],'where':{}};var _0x36c91e={};var _0x56f957={'count':0x0,'rows':[]};return db[_0xbefa('0x3c')][_0xbefa('0x66')]({'where':{'id':_0x115af4[_0xbefa('0x55')]['id']}})[_0xbefa('0x32')](handleEntityNotFound(_0x23347e,null))[_0xbefa('0x32')](function(_0x23862d){if(_0x23862d){_0x36c91e[_0xbefa('0x40')]=_[_0xbefa('0x42')](db[_0xbefa('0x64')][_0xbefa('0x3d')]);_0x36c91e[_0xbefa('0x41')]=_[_0xbefa('0x42')](_0x115af4['query']);_0x36c91e['filters']=_[_0xbefa('0x44')](_0x36c91e['model'],_0x36c91e[_0xbefa('0x41')]);_0x287271[_0xbefa('0x45')]=_[_0xbefa('0x44')](_0x36c91e[_0xbefa('0x40')],qs[_0xbefa('0x46')](_0x115af4[_0xbefa('0x41')][_0xbefa('0x46')]));_0x287271[_0xbefa('0x45')]=_0x287271[_0xbefa('0x45')][_0xbefa('0x47')]?_0x287271[_0xbefa('0x45')]:_0x36c91e[_0xbefa('0x40')];if(!_0x115af4['query'][_0xbefa('0x48')](_0xbefa('0x49'))){_0x287271[_0xbefa('0x2a')]=qs[_0xbefa('0x2a')](_0x115af4[_0xbefa('0x41')][_0xbefa('0x2a')]);_0x287271[_0xbefa('0x29')]=qs[_0xbefa('0x29')](_0x115af4[_0xbefa('0x41')]['offset']);}_0x287271[_0xbefa('0x67')]=qs[_0xbefa('0x4a')](_0x115af4[_0xbefa('0x41')][_0xbefa('0x4a')]);_0x287271[_0xbefa('0x4b')]=qs[_0xbefa('0x43')](_['pick'](_0x115af4[_0xbefa('0x41')],_0x36c91e[_0xbefa('0x43')]));_0x287271[_0xbefa('0x4b')][_0xbefa('0x68')]=_0x23862d['id'];if(_0x115af4['query'][_0xbefa('0x4d')]){_0x287271['where']=_['merge'](_0x287271[_0xbefa('0x4b')],{'$or':_[_0xbefa('0x3b')](_0x287271['attributes'],function(_0x323093){var _0x4b7f2e={};_0x4b7f2e[_0x323093]={'$like':'%'+_0x115af4[_0xbefa('0x41')][_0xbefa('0x4d')]+'%'};return _0x4b7f2e;})});}_0x287271=_[_0xbefa('0x4e')]({},_0x287271,_0x115af4[_0xbefa('0x50')]);return db[_0xbefa('0x64')][_0xbefa('0x2c')]({'where':_0x287271['where']})[_0xbefa('0x32')](function(_0x3dd4c9){_0x56f957['count']=_0x3dd4c9;if(_0x115af4[_0xbefa('0x41')][_0xbefa('0x69')]){_0x287271[_0xbefa('0x51')]=[{'all':!![]}];}return db[_0xbefa('0x64')]['findAll'](_0x287271);})[_0xbefa('0x32')](function(_0x5ca1bc){_0x56f957[_0xbefa('0x53')]=_0x5ca1bc;return _0x56f957;});}})[_0xbefa('0x32')](respondWithFilteredResult(_0x23347e,_0x287271))[_0xbefa('0x27')](handleError(_0x23347e,null));};exports[_0xbefa('0x6a')]=function(_0x1674ff,_0xc691b7,_0x2d3f51){return db[_0xbefa('0x3c')][_0xbefa('0x56')]({'where':{'id':_0x1674ff[_0xbefa('0x55')]['id']}})[_0xbefa('0x32')](handleEntityNotFound(_0xc691b7,null))[_0xbefa('0x32')](function(_0x4aca06){if(_0x4aca06){return _0x4aca06[_0xbefa('0x6a')](_0x1674ff[_0xbefa('0x41')][_0xbefa('0x6b')]);}})['then'](respondWithStatusCode(_0xc691b7,null))['catch'](handleError(_0xc691b7,null));};exports['addAnswer']=function(_0x37a86a,_0x1a52b9,_0x24c160){if(_0x37a86a['body']['id']){delete _0x37a86a[_0xbefa('0x58')]['id'];}return db[_0xbefa('0x3c')][_0xbefa('0x56')]({'where':{'id':_0x37a86a[_0xbefa('0x55')]['id']}})['then'](handleEntityNotFound(_0x1a52b9,null))[_0xbefa('0x32')](function(_0x3e5eaf){if(_0x3e5eaf){_0x37a86a[_0xbefa('0x58')]['WhatsappAccountId']=_0x3e5eaf['id'];return db[_0xbefa('0x6c')][_0xbefa('0x57')](_0x37a86a[_0xbefa('0x58')]);}})[_0xbefa('0x32')](respondWithResult(_0x1a52b9,null))[_0xbefa('0x27')](handleError(_0x1a52b9,null));};exports[_0xbefa('0x6d')]=function(_0x557900,_0xefe80f,_0x424dd8){var _0x356cac={'raw':![],'where':{}};var _0x8b5699={};var _0x5ae75f={'count':0x0,'rows':[]};return db[_0xbefa('0x3c')][_0xbefa('0x66')]({'where':{'id':_0x557900[_0xbefa('0x55')]['id']}})['then'](handleEntityNotFound(_0xefe80f,null))[_0xbefa('0x32')](function(_0x18ce29){if(_0x18ce29){_0x8b5699[_0xbefa('0x40')]=_[_0xbefa('0x42')](db[_0xbefa('0x6c')][_0xbefa('0x3d')]);_0x8b5699[_0xbefa('0x41')]=_[_0xbefa('0x42')](_0x557900[_0xbefa('0x41')]);_0x8b5699['filters']=_[_0xbefa('0x44')](_0x8b5699[_0xbefa('0x40')],_0x8b5699[_0xbefa('0x41')]);_0x356cac[_0xbefa('0x45')]=_[_0xbefa('0x44')](_0x8b5699['model'],qs['fields'](_0x557900[_0xbefa('0x41')]['fields']));_0x356cac[_0xbefa('0x45')]=_0x356cac[_0xbefa('0x45')][_0xbefa('0x47')]?_0x356cac[_0xbefa('0x45')]:_0x8b5699['model'];if(!_0x557900[_0xbefa('0x41')][_0xbefa('0x48')](_0xbefa('0x49'))){_0x356cac[_0xbefa('0x2a')]=qs[_0xbefa('0x2a')](_0x557900[_0xbefa('0x41')][_0xbefa('0x2a')]);_0x356cac[_0xbefa('0x29')]=qs['offset'](_0x557900[_0xbefa('0x41')]['offset']);}_0x356cac[_0xbefa('0x67')]=qs['sort'](_0x557900[_0xbefa('0x41')][_0xbefa('0x4a')]);_0x356cac[_0xbefa('0x4b')]=qs['filters'](_['pick'](_0x557900['query'],_0x8b5699[_0xbefa('0x43')]));_0x356cac[_0xbefa('0x4b')][_0xbefa('0x68')]=_0x18ce29['id'];if(_0x557900['query'][_0xbefa('0x4d')]){_0x356cac['where']=_[_0xbefa('0x4e')](_0x356cac['where'],{'$or':_[_0xbefa('0x3b')](_0x356cac['attributes'],function(_0x386aca){var _0x29b1b3={};_0x29b1b3[_0x386aca]={'$like':'%'+_0x557900[_0xbefa('0x41')][_0xbefa('0x4d')]+'%'};return _0x29b1b3;})});}_0x356cac=_['merge']({},_0x356cac,_0x557900[_0xbefa('0x50')]);return db[_0xbefa('0x6c')]['count']({'where':_0x356cac[_0xbefa('0x4b')]})[_0xbefa('0x32')](function(_0x2f4307){_0x5ae75f[_0xbefa('0x2c')]=_0x2f4307;if(_0x557900[_0xbefa('0x41')][_0xbefa('0x69')]){_0x356cac[_0xbefa('0x51')]=[{'all':!![]}];}return db[_0xbefa('0x6c')]['findAll'](_0x356cac);})['then'](function(_0x54f438){_0x5ae75f['rows']=_0x54f438;return _0x5ae75f;});}})[_0xbefa('0x32')](respondWithFilteredResult(_0xefe80f,_0x356cac))[_0xbefa('0x27')](handleError(_0xefe80f,null));};exports[_0xbefa('0x6e')]=function(_0x2de9d2,_0x16b413,_0x1753f5){return db[_0xbefa('0x3c')][_0xbefa('0x56')]({'where':{'id':_0x2de9d2[_0xbefa('0x55')]['id']}})[_0xbefa('0x32')](handleEntityNotFound(_0x16b413,null))[_0xbefa('0x32')](function(_0x56d7c1){if(_0x56d7c1){return _0x56d7c1[_0xbefa('0x6e')](_0x2de9d2['query']['ids']);}})[_0xbefa('0x32')](respondWithStatusCode(_0x16b413,null))[_0xbefa('0x27')](handleError(_0x16b413,null));};exports[_0xbefa('0x6f')]=function(_0x4720a2,_0x51cd52,_0x21f75f){return db['WhatsappAccount']['find']({'where':{'id':_0x4720a2[_0xbefa('0x55')]['id']}})[_0xbefa('0x32')](handleEntityNotFound(_0x51cd52,null))[_0xbefa('0x32')](function(_0x202800){if(_0x202800){return _0x202800[_0xbefa('0x6f')](_0x4720a2[_0xbefa('0x58')][_0xbefa('0x6b')],_[_0xbefa('0x70')](_0x4720a2['body'],[_0xbefa('0x6b'),'id'])||{})[_0xbefa('0x71')](function(_0x17e715){for(var _0x5d020f=0x0;_0x5d020f<_0x4720a2[_0xbefa('0x58')]['ids'][_0xbefa('0x47')];_0x5d020f+=0x1){socket[_0xbefa('0x72')](_0xbefa('0x73'),{'UserId':Number(_0x4720a2[_0xbefa('0x58')][_0xbefa('0x6b')][_0x5d020f]),'WhatsappAccountId':Number(_0x4720a2[_0xbefa('0x55')]['id'])});}return _0x17e715;});}})[_0xbefa('0x32')](respondWithResult(_0x51cd52,null))[_0xbefa('0x27')](handleError(_0x51cd52,null));};exports[_0xbefa('0x74')]=function(_0x44417b,_0x22db13,_0x3c7625){return db[_0xbefa('0x3c')][_0xbefa('0x56')]({'where':{'id':_0x44417b[_0xbefa('0x55')]['id']}})[_0xbefa('0x32')](handleEntityNotFound(_0x22db13,null))[_0xbefa('0x32')](function(_0x59b745){if(_0x59b745){return _0x59b745['removeAgents'](_0x44417b[_0xbefa('0x41')][_0xbefa('0x6b')])[_0xbefa('0x32')](function(){if(_['isArray'](_0x44417b[_0xbefa('0x41')]['ids'])){for(var _0x29c796=0x0;_0x29c796<_0x44417b[_0xbefa('0x41')]['ids'][_0xbefa('0x47')];_0x29c796+=0x1){socket[_0xbefa('0x72')](_0xbefa('0x75'),{'UserId':Number(_0x44417b[_0xbefa('0x41')]['ids'][_0x29c796]),'WhatsappAccountId':Number(_0x44417b['params']['id'])});}}else{socket[_0xbefa('0x72')](_0xbefa('0x75'),{'UserId':Number(_0x44417b['query'][_0xbefa('0x6b')]),'WhatsappAccountId':Number(_0x44417b[_0xbefa('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x22db13,null))[_0xbefa('0x27')](handleError(_0x22db13,null));};exports[_0xbefa('0x76')]=function(_0x32424a,_0x32b336,_0x38a1df){var _0x347211={};var _0x128d83={};var _0x26270c;var _0x1e7745;return db['WhatsappAccount']['findOne']({'where':{'id':_0x32424a[_0xbefa('0x55')]['id']}})[_0xbefa('0x32')](handleEntityNotFound(_0x32b336,null))[_0xbefa('0x32')](function(_0x446cce){if(_0x446cce){_0x26270c=_0x446cce;_0x128d83[_0xbefa('0x40')]=_[_0xbefa('0x42')](db['User']['rawAttributes']);_0x128d83['query']=_[_0xbefa('0x42')](_0x32424a['query']);_0x128d83['filters']=_[_0xbefa('0x44')](_0x128d83['model'],_0x128d83[_0xbefa('0x41')]);_0x347211[_0xbefa('0x45')]=_[_0xbefa('0x44')](_0x128d83['model'],qs[_0xbefa('0x46')](_0x32424a[_0xbefa('0x41')][_0xbefa('0x46')]));_0x347211[_0xbefa('0x45')]=_0x347211['attributes'][_0xbefa('0x47')]?_0x347211[_0xbefa('0x45')]:_0x128d83['model'];_0x347211[_0xbefa('0x67')]=qs[_0xbefa('0x4a')](_0x32424a[_0xbefa('0x41')][_0xbefa('0x4a')]);_0x347211['where']=qs[_0xbefa('0x43')](_[_0xbefa('0x4c')](_0x32424a['query'],_0x128d83['filters']));if(_0x32424a[_0xbefa('0x41')][_0xbefa('0x4d')]){_0x347211['where']=_[_0xbefa('0x4e')](_0x347211[_0xbefa('0x4b')],{'$or':_[_0xbefa('0x3b')](_0x347211['attributes'],function(_0x5e2a61){var _0x5952c1={};_0x5952c1[_0x5e2a61]={'$like':'%'+_0x32424a[_0xbefa('0x41')][_0xbefa('0x4d')]+'%'};return _0x5952c1;})});}_0x347211=_[_0xbefa('0x4e')]({},_0x347211,_0x32424a['options']);return _0x26270c[_0xbefa('0x76')](_0x347211);}})['then'](function(_0x105378){if(_0x105378){_0x1e7745=_0x105378[_0xbefa('0x47')];if(!_0x32424a[_0xbefa('0x41')]['hasOwnProperty'](_0xbefa('0x49'))){_0x347211['limit']=qs[_0xbefa('0x2a')](_0x32424a['query'][_0xbefa('0x2a')]);_0x347211[_0xbefa('0x29')]=qs['offset'](_0x32424a[_0xbefa('0x41')][_0xbefa('0x29')]);}return _0x26270c['getAgents'](_0x347211);}})[_0xbefa('0x32')](function(_0x304eff){if(_0x304eff){return _0x304eff?{'count':_0x1e7745,'rows':_0x304eff}:null;}})[_0xbefa('0x32')](respondWithResult(_0x32b336,null))[_0xbefa('0x27')](handleError(_0x32b336,null));};exports[_0xbefa('0x77')]=function(_0x598f9d,_0x9a4281){var _0x22c400=_0x598f9d[_0xbefa('0x55')]['id'];var _0x2bf2f8=_0x598f9d['body'];var _0xcc9b46=0xc8;var _0x17001f=null;return db[_0xbefa('0x78')][_0xbefa('0x79')]({'isolationLevel':db[_0xbefa('0x78')][_0xbefa('0x7a')][_0xbefa('0x7b')][_0xbefa('0x7c')]},function(_0x561b88){return db[_0xbefa('0x3c')]['findOne']({'where':{'id':_0x22c400},'transaction':_0x561b88})[_0xbefa('0x32')](function(_0x2bd2f6){if(_0x2bd2f6){return db[_0xbefa('0x7d')][_0xbefa('0x31')]({'where':{'WhatsappAccountId':_0x22c400},'transaction':_0x561b88})[_0xbefa('0x32')](function(){var _0x4776d2=_[_0xbefa('0x3b')](_0x2bf2f8,function(_0x24dd04){_0x24dd04[_0xbefa('0x68')]=_0x22c400;return _0x24dd04;});return db['WhatsappApplication'][_0xbefa('0x7e')](_0x4776d2,{'transaction':_0x561b88});});}else{_0xcc9b46=0x194;_0x17001f=[];}});})[_0xbefa('0x32')](function(){if(_0xcc9b46!==0x194){return db[_0xbefa('0x7d')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x22c400},'order':_0xbefa('0x7f')})[_0xbefa('0x32')](function(_0x210c98){_0x17001f=_0x210c98;});}})['catch'](function(_0x301baf){_0xcc9b46=0x1f4;logger[_0xbefa('0x24')](_0x301baf[_0xbefa('0x80')]);if(_0x301baf[_0xbefa('0x36')]){delete _0x301baf[_0xbefa('0x36')];}_0x17001f=_0x301baf;})[_0xbefa('0x81')](function(){if(_0x17001f===null){_0x9a4281[_0xbefa('0x35')](_0xcc9b46);}else{if(_0xcc9b46===0x1f4){_0x9a4281['status'](_0xcc9b46)['send'](_0x17001f);}else{_0x9a4281[_0xbefa('0x28')](_0xcc9b46)[_0xbefa('0x82')](_0x17001f);}}});};exports[_0xbefa('0x83')]=function(_0x5efd48,_0x185057,_0x4c65bb){var _0x352886={};var _0x24c6fc={};var _0x4ee9bd;var _0x5bf075;return db['WhatsappAccount'][_0xbefa('0x66')]({'where':{'id':_0x5efd48['params']['id']}})['then'](handleEntityNotFound(_0x185057,null))[_0xbefa('0x32')](function(_0x571313){if(_0x571313){_0x4ee9bd=_0x571313;_0x24c6fc[_0xbefa('0x40')]=_['keys'](db[_0xbefa('0x7d')][_0xbefa('0x3d')]);_0x24c6fc[_0xbefa('0x41')]=_[_0xbefa('0x42')](_0x5efd48[_0xbefa('0x41')]);_0x24c6fc[_0xbefa('0x43')]=_[_0xbefa('0x44')](_0x24c6fc[_0xbefa('0x40')],_0x24c6fc[_0xbefa('0x41')]);_0x352886[_0xbefa('0x45')]=_['intersection'](_0x24c6fc['model'],qs[_0xbefa('0x46')](_0x5efd48['query'][_0xbefa('0x46')]));_0x352886[_0xbefa('0x45')]=_0x352886[_0xbefa('0x45')][_0xbefa('0x47')]?_0x352886['attributes']:_0x24c6fc[_0xbefa('0x40')];_0x352886['order']=qs[_0xbefa('0x4a')](_0x5efd48[_0xbefa('0x41')][_0xbefa('0x4a')]);_0x352886[_0xbefa('0x4b')]=qs['filters'](_[_0xbefa('0x4c')](_0x5efd48['query'],_0x24c6fc['filters']));if(_0x5efd48[_0xbefa('0x41')][_0xbefa('0x4d')]){_0x352886['where']=_[_0xbefa('0x4e')](_0x352886[_0xbefa('0x4b')],{'$or':_['map'](_0x352886[_0xbefa('0x45')],function(_0xaf3c54){var _0x405551={};_0x405551[_0xaf3c54]={'$like':'%'+_0x5efd48[_0xbefa('0x41')][_0xbefa('0x4d')]+'%'};return _0x405551;})});}_0x352886=_[_0xbefa('0x4e')]({},_0x352886,_0x5efd48['options']);return _0x4ee9bd[_0xbefa('0x83')](_0x352886);}})[_0xbefa('0x32')](function(_0x68f764){if(_0x68f764){_0x5bf075=_0x68f764['length'];if(!_0x5efd48['query']['hasOwnProperty'](_0xbefa('0x49'))){_0x352886['limit']=qs[_0xbefa('0x2a')](_0x5efd48['query'][_0xbefa('0x2a')]);_0x352886['offset']=qs[_0xbefa('0x29')](_0x5efd48[_0xbefa('0x41')]['offset']);}return _0x4ee9bd[_0xbefa('0x83')](_0x352886);}})[_0xbefa('0x32')](function(_0x4492ca){if(_0x4492ca){return _0x4492ca?{'count':_0x5bf075,'rows':_0x4492ca}:null;}})['then'](respondWithResult(_0x185057,null))[_0xbefa('0x27')](handleError(_0x185057,null));};exports[_0xbefa('0x84')]=function(_0x4ffa68,_0x325107,_0x3777e){var _0x5f186a={'channel':_0xbefa('0x85')};var _0x34bcb4=[];var _0x3b43e9=[];var _0x5a2fa1={};return db[_0xbefa('0x3c')][_0xbefa('0x56')]({'where':{'id':_0x4ffa68[_0xbefa('0x55')]['id']},'include':[{'model':db[_0xbefa('0x7d')],'as':_0xbefa('0x86')}]})[_0xbefa('0x32')](handleEntityNotFound(_0x325107,null))[_0xbefa('0x32')](function(_0x6a39bc){_0x5f186a[_0xbefa('0x87')]=_0x6a39bc;if(_0x5f186a['account']&&_0x5f186a[_0xbefa('0x87')][_0xbefa('0x4f')]===_0xbefa('0x88')&&_0x4ffa68[_0xbefa('0x58')]['statuses']){if(_0x4ffa68['body']['statuses'][_0xbefa('0x47')]===0x0)return;if(_0x4ffa68['body'][_0xbefa('0x89')][0x0][_0xbefa('0x8a')]!=='read')return;return db[_0xbefa('0x8b')]['update']({'read':!![],'readAt':_0x4ffa68[_0xbefa('0x58')]['statuses'][0x0][_0xbefa('0x8c')]},{'where':{'messageId':_0x4ffa68[_0xbefa('0x58')]['statuses'][0x0][_0xbefa('0x8d')]},'individualHooks':!![]})[_0xbefa('0x32')](function(_0x6f273d){return _0x325107['status'](0xc8)[_0xbefa('0x82')](_0x6f273d);});}_0x5f186a[_0xbefa('0x8e')]=_['orderBy'](_0x6a39bc['Applications'],[_0xbefa('0x7f')],[_0xbefa('0x8f')]);if(_0x5f186a[_0xbefa('0x87')][_0xbefa('0x86')]){delete _0x5f186a[_0xbefa('0x87')][_0xbefa('0x86')];}return db[_0xbefa('0x90')][_0xbefa('0x62')]()['then'](function(_0x5c5e35){if(!_0x5c5e35){throw new db[(_0xbefa('0x91'))][(_0xbefa('0x92'))](_0xbefa('0x93'));}_0x34bcb4=_[_0xbefa('0x94')](_[_0xbefa('0x42')](_0x5c5e35),['createdAt',_0xbefa('0x95')]);_0x3b43e9=_[_0xbefa('0x94')](_[_0xbefa('0x42')](_0x5c5e35),[_0xbefa('0x96'),_0xbefa('0x95'),_0xbefa('0x97'),_0xbefa('0x98')]);_0x5f186a[_0xbefa('0x58')]={'mapKey':_0xbefa('0x99')};if(_0x5f186a[_0xbefa('0x87')]&&_0x5f186a[_0xbefa('0x87')][_0xbefa('0x4f')]==='twilio'){_0x5f186a[_0xbefa('0x58')][_0xbefa('0x9a')]=_0x4ffa68[_0xbefa('0x58')][_0xbefa('0x9b')][_0xbefa('0x9c')]('whatsapp:','');_0x5f186a['body']['body']=_0x4ffa68[_0xbefa('0x58')][_0xbefa('0x9d')];_0x5f186a[_0xbefa('0x58')][_0xbefa('0x9e')]=_0x4ffa68[_0xbefa('0x58')][_0xbefa('0x9f')];}if(_0x5f186a['account']&&_0x5f186a['account'][_0xbefa('0x4f')]===_0xbefa('0x88')){_0x5f186a[_0xbefa('0x58')][_0xbefa('0x9a')]=_0x4ffa68[_0xbefa('0x58')][_0xbefa('0xa0')][0x0][_0xbefa('0x9a')];_0x5f186a[_0xbefa('0x58')][_0xbefa('0x58')]=_0x4ffa68[_0xbefa('0x58')][_0xbefa('0xa0')][0x0][_0xbefa('0x25')][_0xbefa('0x58')];_0x5f186a[_0xbefa('0x58')][_0xbefa('0x9e')]=_0x4ffa68[_0xbefa('0x58')][_0xbefa('0xa0')][0x0][_0xbefa('0x8d')];}if(_0x5f186a[_0xbefa('0x58')]['id']){delete _0x5f186a[_0xbefa('0x58')]['id'];}if(_[_0xbefa('0xa1')](_0x5f186a[_0xbefa('0x58')][_0xbefa('0x9a')])){throw new db[(_0xbefa('0x91'))]['ValidationError'](_0xbefa('0xa2'));}if(_[_0xbefa('0xa1')](_0x5f186a[_0xbefa('0x58')][_0xbefa('0x58')])||_0x5f186a[_0xbefa('0x58')][_0xbefa('0x58')]===''){throw new db[(_0xbefa('0x91'))][(_0xbefa('0x92'))](_0xbefa('0xa3'));}if(_['isNil'](_0x5f186a[_0xbefa('0x58')][_0xbefa('0xa4')])){throw new db[(_0xbefa('0x91'))][(_0xbefa('0x92'))](_0xbefa('0xa5')+_0x3b43e9);}if(!_[_0xbefa('0xa6')](_0x3b43e9,_0x5f186a[_0xbefa('0x58')]['mapKey'])){throw new db[(_0xbefa('0x91'))][(_0xbefa('0x92'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3b43e9);}_0x5a2fa1[_0x5f186a[_0xbefa('0x58')][_0xbefa('0xa4')]]=_0x5f186a['body']['from'];return db['CmList'][_0xbefa('0x56')]({'where':{'id':_0x5f186a[_0xbefa('0x87')][_0xbefa('0x98')]},'include':[{'model':db[_0xbefa('0x90')],'as':_0xbefa('0xa7'),'where':_0x5a2fa1,'limit':0x1,'order':[[_0xbefa('0x95'),_0xbefa('0xa8')]]}]});})[_0xbefa('0x32')](handleEntityNotFound(_0x325107,null))[_0xbefa('0x32')](function(_0x5a9e1a){if(_0x5a9e1a){_0x5f186a['list']=_[_0xbefa('0x70')](_0x5a9e1a,[_0xbefa('0xa7')]);if(_0x5a9e1a['Contacts'][_0xbefa('0x47')]){return _0x5a9e1a[_0xbefa('0xa7')][0x0];}var _0xeaf93a=_[_0xbefa('0x17')](_0x5f186a[_0xbefa('0x58')],{'firstName':_0x5f186a[_0xbefa('0x58')][_0xbefa('0x9a')],'ListId':_0x5a9e1a['id']});_0xeaf93a[_0x5f186a[_0xbefa('0x58')]['mapKey']]=_0x5f186a['body'][_0xbefa('0x9a')];return db[_0xbefa('0x90')]['create'](_0xeaf93a,{'fields':_0x34bcb4,'raw':!![]});}})['then'](handleEntityNotFound(_0x325107,null))[_0xbefa('0x32')](function(_0x1337ce){if(_0x1337ce){_0x5f186a[_0xbefa('0xa9')]=_0x1337ce;var _0x312bad={'ContactId':_0x1337ce['id'],'phone':_0x5f186a[_0xbefa('0x58')]['from'],'WhatsappAccountId':_0x4ffa68[_0xbefa('0x55')]['id']};var _0x51f6a9={'ContactId':_0x1337ce['id'],'WhatsappAccountId':_0x4ffa68[_0xbefa('0x55')]['id'],'closed':![]};return db['WhatsappInteraction'][_0xbefa('0x56')]({'where':_0x51f6a9})['then'](function(_0x537dd5){if(_0x537dd5){return[_0x537dd5,![]];}return db[_0xbefa('0xaa')][_0xbefa('0x57')](_0x312bad)[_0xbefa('0x32')](function(_0x491885){return[_0x491885,!![]];});});}})[_0xbefa('0x71')](function(_0x2da1f1,_0x3b5365){_0x5f186a[_0xbefa('0xab')]=_0x2da1f1[_0xbefa('0x5a')]({'plain':!![]});_0x5f186a[_0xbefa('0xab')][_0xbefa('0xac')]=![];if(_0x3b5365){if(_0x5f186a[_0xbefa('0x87')][_0xbefa('0xad')]){_0x5f186a[_0xbefa('0x8e')]['push']({'id':0x0,'priority':_0x5f186a[_0xbefa('0x8e')][_0xbefa('0x47')]+0x1,'app':_0xbefa('0xae'),'appdata':_0xbefa('0xaf'),'interval':_0xbefa('0xb0')});}_0x5f186a[_0xbefa('0xab')][_0xbefa('0xac')]=!![];}return db[_0xbefa('0x8b')]['create']({'phone':_0x5f186a[_0xbefa('0x58')][_0xbefa('0x9a')],'messageId':_0x5f186a['body'][_0xbefa('0x9e')],'body':_0x5f186a[_0xbefa('0x58')][_0xbefa('0x58')],'WhatsappAccountId':_0x4ffa68[_0xbefa('0x55')]['id'],'WhatsappInteractionId':_0x2da1f1['id'],'direction':'in','ContactId':_0x2da1f1['ContactId'],'AttachmentId':_0x5f186a[_0xbefa('0x58')][_0xbefa('0xb1')]});})[_0xbefa('0x32')](function(_0x5edda1){_0x5f186a[_0xbefa('0x25')]=_0x5edda1;if(!_0x5f186a['interaction'][_0xbefa('0xb2')])return;return db[_0xbefa('0xb3')][_0xbefa('0x56')]({'attributes':['id',_0xbefa('0x36')],'where':{'id':_0x5f186a[_0xbefa('0xab')][_0xbefa('0xb2')]}});})[_0xbefa('0x32')](function(_0xd789bf){if(_0xd789bf){_0x5f186a[_0xbefa('0x8e')][_0xbefa('0xb4')]({'id':0x0,'priority':0x0,'app':_0xbefa('0xb5'),'appdata':_0xd789bf['name']+','+(_0x5f186a[_0xbefa('0x87')][_0xbefa('0xb6')]||0xa),'interval':_0xbefa('0xb0')});}if(!_0x5f186a[_0xbefa('0xab')][_0xbefa('0xb7')])return;return db['WhatsappQueue']['find']({'attributes':['id',_0xbefa('0x36')],'where':{'id':_0x5f186a[_0xbefa('0xab')]['queueId']}});})[_0xbefa('0x32')](function(_0x536451){if(_0x536451){_0x5f186a['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0xbefa('0xb8'),'appdata':_0x536451[_0xbefa('0x36')]+','+(_0x5f186a['account'][_0xbefa('0xb9')]||0x12c),'interval':_0xbefa('0xb0')});}return respondWithRpcPromise(_0xbefa('0xba'),_0xbefa('0xbb'),_0x5f186a);})[_0xbefa('0x32')](function(_0xba31c0){if(_0xba31c0){var _0x28f018=0xc8;var _0x2e17a1=_0xbefa('0xbc');logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2e17a1,_0x28f018,_0xbefa('0xbd'));logger[_0xbefa('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2e17a1,_0x28f018,_0xbefa('0xbd'),JSON[_0xbefa('0x23')](_0xba31c0));if(_0x5f186a['account'][_0xbefa('0x4f')]==='twilio'){return _0x325107[_0xbefa('0x28')](_0x28f018)['set'](_0xbefa('0xbe'),'text/xml')[_0xbefa('0x37')](_0xbefa('0xbf'));}else{return _0x325107[_0xbefa('0x28')](_0x28f018)['json'](_0xba31c0);}}});})[_0xbefa('0x27')](handleError(_0x325107,null));};exports[_0xbefa('0x37')]=function(_0x440134,_0x27e7de,_0x22c72f){var _0x5866d6,_0x293682,_0x4a5b83;if(_[_0xbefa('0xa1')](_0x440134[_0xbefa('0x58')][_0xbefa('0x58')])||_0x440134[_0xbefa('0x58')][_0xbefa('0x58')]===''){throw new db[(_0xbefa('0x91'))][(_0xbefa('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbefa('0xa1')](_0x440134[_0xbefa('0x58')]['to'])){throw new db[(_0xbefa('0x91'))][(_0xbefa('0x92'))](_0xbefa('0xc0'));}_0x5866d6=_0x440134[_0xbefa('0x58')]['to'];return db[_0xbefa('0x3c')]['find']({'where':{'id':_0x440134[_0xbefa('0x55')]['id']},'include':[{'model':db[_0xbefa('0xc1')],'as':_0xbefa('0xc2'),'include':[{'model':db['CmContact'],'as':_0xbefa('0xa7'),'where':{'mobile':_0x5866d6},'limit':0x1,'order':[[_0xbefa('0x95'),_0xbefa('0xa8')]]}]}]})[_0xbefa('0x32')](handleEntityNotFound(_0x27e7de,null))[_0xbefa('0x32')](function(_0x2f2d12){if(_0x2f2d12&&_0x2f2d12[_0xbefa('0xc2')]){_0x293682=_0x2f2d12[_0xbefa('0x5a')]({'plain':!![]});if(_0x293682[_0xbefa('0xc2')]&&_0x293682[_0xbefa('0xc2')][_0xbefa('0xa7')][_0xbefa('0x47')]){return _0x293682[_0xbefa('0xc2')][_0xbefa('0xa7')][0x0];}return db[_0xbefa('0x90')][_0xbefa('0x57')](_[_0xbefa('0x17')](_0x440134[_0xbefa('0x58')],{'firstName':_0x5866d6,'mobile':_0x5866d6,'phone':_0x5866d6,'ListId':_0x293682[_0xbefa('0x98')]}));}})[_0xbefa('0x32')](handleEntityNotFound(_0x27e7de,null))[_0xbefa('0x32')](function(_0x13858b){if(_0x13858b){_0x4a5b83=_0x13858b;return db['WhatsappInteraction'][_0xbefa('0x56')]({'where':{'ContactId':_0x4a5b83['id'],'closed':![],'WhatsappAccountId':_0x293682['id']}})['then'](function(_0x3c9218){if(_0x3c9218){return[_0x3c9218,![]];}return db[_0xbefa('0xaa')]['create']({'UserId':_0x440134[_0xbefa('0x59')]['id'],'ContactId':_0x4a5b83['id'],'WhatsappAccountId':_0x293682['id'],'phone':_0x5866d6,'firstMsgDirection':_0xbefa('0xc3'),'Messages':[_[_0xbefa('0x4e')](_0x440134['body'],{'read':![],'body':_0x440134[_0xbefa('0x58')][_0xbefa('0x58')],'phone':_0x5866d6,'WhatsappAccountId':_0x293682['id'],'UserId':_0x440134[_0xbefa('0x59')]['id'],'ContactId':_0x4a5b83['id']})]},{'include':[{'model':db[_0xbefa('0x8b')],'as':_0xbefa('0xc4')}]})[_0xbefa('0x32')](function(_0x2bde8d){return[_0x2bde8d,!![]];});});}})['spread'](function(_0x264e77,_0x4cc272){if(_0x4cc272){return _0x264e77;}return db['WhatsappMessage'][_0xbefa('0x57')](_[_0xbefa('0x4e')](_0x440134[_0xbefa('0x58')],{'read':![],'body':_0x440134[_0xbefa('0x58')][_0xbefa('0x58')],'phone':_0x5866d6,'WhatsappAccountId':_0x293682['id'],'WhatsappInteractionId':_0x264e77['id'],'UserId':_0x440134[_0xbefa('0x59')]['id'],'ContactId':_0x4a5b83['id']}))[_0xbefa('0x32')](function(_0x3b7ba6){_0x264e77[_0xbefa('0xc5')][_0xbefa('0xc4')]=[];_0x264e77[_0xbefa('0xc5')]['Messages']['push'](_0x3b7ba6[_0xbefa('0xc5')]);return _0x264e77;});})[_0xbefa('0x32')](respondWithResult(_0x27e7de,null))['catch'](handleError(_0x27e7de,null));}; \ No newline at end of file +var _0xebd3=['queueId','WhatsappQueue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','set','Content-Type','\x0a','to\x20is\x20mandatory','List','WhatsappInteraction','out','user','Messages','dataValues','eml-format','zip-dir','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','request','then','info','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','WhatsappAccount,\x20%s,\x20%s','error','message','request\x20sent','result','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','destroy','WhatsappAccounts','stack','name','send','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','options','removeAnswers','ids','addAgents','omit','spread','emit','removeAgents','getAgents','User','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','finally','getApplications','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','mobile','twilio','From','replace','whatsapp:','Body','MessageSid','from','notifications','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','ListId','Contacts','DESC','list','contact','interaction','autoclose','push','created','ContactId','AttachmentId','UserId','unshift','*,*,*,*'];(function(_0x28c3a3,_0x1cc488){var _0x5772fa=function(_0xd5659d){while(--_0xd5659d){_0x28c3a3['push'](_0x28c3a3['shift']());}};_0x5772fa(++_0x1cc488);}(_0xebd3,0x194));var _0x3ebd=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0xebd3[_0x19b84f];return _0x18067b;};'use strict';var emlformat=require(_0x3ebd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3ebd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3ebd('0x2'));var moment=require(_0x3ebd('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3ebd('0x4'));var sox=require(_0x3ebd('0x5'));var csv=require(_0x3ebd('0x6'));var ejs=require(_0x3ebd('0x7'));var fs=require('fs');var fs_extra=require(_0x3ebd('0x8'));var _=require(_0x3ebd('0x9'));var squel=require(_0x3ebd('0xa'));var crypto=require(_0x3ebd('0xb'));var jsforce=require(_0x3ebd('0xc'));var deskjs=require(_0x3ebd('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3ebd('0xe'));var Papa=require('papaparse');var Redis=require(_0x3ebd('0xf'));var authService=require(_0x3ebd('0x10'));var qs=require(_0x3ebd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ebd('0x12'));var logger=require('../../config/logger')(_0x3ebd('0x13'));var utils=require('../../config/utils');var config=require(_0x3ebd('0x14'));var licenseUtil=require(_0x3ebd('0x15'));var db=require(_0x3ebd('0x16'))['db'];config[_0x3ebd('0x17')]=_[_0x3ebd('0x18')](config['redis'],{'host':_0x3ebd('0x19'),'port':0x18eb});var socket=require(_0x3ebd('0x1a'))(new Redis(config['redis']));require(_0x3ebd('0x1b'))[_0x3ebd('0x1c')](socket);var jayson=require(_0x3ebd('0x1d'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x3b6ced,_0x585ff7,_0x116f7b,_0x6e6291){return new BPromise(function(_0x2a0c2e,_0x32d9e8){var _0x3f6278=_0x6e6291||client;return _0x3f6278[_0x3ebd('0x1e')](_0x3b6ced,_0x116f7b)[_0x3ebd('0x1f')](function(_0x6c486a){logger[_0x3ebd('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x585ff7,'request\x20sent');logger['debug'](_0x3ebd('0x21'),_0x585ff7,'request\x20sent',JSON[_0x3ebd('0x22')](_0x6c486a));if(_0x6c486a['error']){if(_0x6c486a['error']['code']===0x1f4){logger['error'](_0x3ebd('0x23'),_0x585ff7,_0x6c486a[_0x3ebd('0x24')]['message']);return _0x32d9e8(_0x6c486a['error'][_0x3ebd('0x25')]);}logger[_0x3ebd('0x24')](_0x3ebd('0x23'),_0x585ff7,_0x6c486a['error'][_0x3ebd('0x25')]);return _0x2a0c2e(_0x6c486a[_0x3ebd('0x24')][_0x3ebd('0x25')]);}else{logger[_0x3ebd('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x585ff7,_0x3ebd('0x26'));_0x2a0c2e(_0x6c486a[_0x3ebd('0x27')]['message']);}})['catch'](function(_0x506748){logger['error'](_0x3ebd('0x23'),_0x585ff7,_0x506748);_0x32d9e8(_0x506748);});});}function respondWithStatusCode(_0x339c8b,_0x2b17d1){_0x2b17d1=_0x2b17d1||0xcc;return function(_0x45666b){if(_0x45666b){return _0x339c8b[_0x3ebd('0x28')](_0x2b17d1);}return _0x339c8b[_0x3ebd('0x29')](_0x2b17d1)[_0x3ebd('0x2a')]();};}function respondWithResult(_0x143ef1,_0x10855a){_0x10855a=_0x10855a||0xc8;return function(_0x1dbc38){if(_0x1dbc38){return _0x143ef1[_0x3ebd('0x29')](_0x10855a)[_0x3ebd('0x2b')](_0x1dbc38);}};}function respondWithFilteredResult(_0x4dcc51,_0x4af09b){return function(_0x29537a){if(_0x29537a){var _0x1f4e46=typeof _0x4af09b[_0x3ebd('0x2c')]===_0x3ebd('0x2d')&&typeof _0x4af09b[_0x3ebd('0x2e')]===_0x3ebd('0x2d');var _0x939846=_0x29537a[_0x3ebd('0x2f')];var _0x485b30=_0x1f4e46?0x0:_0x4af09b[_0x3ebd('0x2c')];var _0x5b807c=_0x1f4e46?_0x29537a[_0x3ebd('0x2f')]:_0x4af09b['offset']+_0x4af09b['limit'];var _0x533dd9;if(_0x5b807c>=_0x939846){_0x5b807c=_0x939846;_0x533dd9=0xc8;}else{_0x533dd9=0xce;}_0x4dcc51[_0x3ebd('0x29')](_0x533dd9);return _0x4dcc51['set']('Content-Range',_0x485b30+'-'+_0x5b807c+'/'+_0x939846)[_0x3ebd('0x2b')](_0x29537a);}return null;};}function patchUpdates(_0x48d9dd){return function(_0x127a3a){try{jsonpatch[_0x3ebd('0x30')](_0x127a3a,_0x48d9dd,!![]);}catch(_0x81af02){return BPromise[_0x3ebd('0x31')](_0x81af02);}return _0x127a3a[_0x3ebd('0x32')]();};}function saveUpdates(_0x4f060f,_0x4b6d9e){return function(_0xf8cee1){if(_0xf8cee1){return _0xf8cee1[_0x3ebd('0x33')](_0x4f060f)[_0x3ebd('0x1f')](function(_0xe9ed9a){return _0xe9ed9a;});}return null;};}function removeEntity(_0x2a4232,_0x2562cb){return function(_0x5bdf01){if(_0x5bdf01){return _0x5bdf01[_0x3ebd('0x34')]()[_0x3ebd('0x1f')](function(){var _0x250124=_0x5bdf01['get']({'plain':!![]});var _0xa63d0f=_0x3ebd('0x35');return db['UserProfileResource']['destroy']({'where':{'type':_0xa63d0f,'resourceId':_0x250124['id']}})[_0x3ebd('0x1f')](function(){return _0x5bdf01;});})[_0x3ebd('0x1f')](function(){_0x2a4232[_0x3ebd('0x29')](0xcc)[_0x3ebd('0x2a')]();});}};}function handleEntityNotFound(_0x4f9968,_0x3e5aae){return function(_0x1e7558){if(!_0x1e7558){_0x4f9968[_0x3ebd('0x28')](0x194);}return _0x1e7558;};}function handleError(_0x41c034,_0x5b43fb){_0x5b43fb=_0x5b43fb||0x1f4;return function(_0x585209){logger[_0x3ebd('0x24')](_0x585209[_0x3ebd('0x36')]);if(_0x585209[_0x3ebd('0x37')]){delete _0x585209[_0x3ebd('0x37')];}_0x41c034[_0x3ebd('0x29')](_0x5b43fb)[_0x3ebd('0x38')](_0x585209);};}exports['index']=function(_0x3bd7bf,_0x291817){var _0x275ce9={'include':[{'model':db['Pause'],'as':_0x3ebd('0x39')}]},_0x44c932={},_0x4c527d={'count':0x0,'rows':[]};var _0x59da81=_['map'](db[_0x3ebd('0x3a')][_0x3ebd('0x3b')],function(_0x30466a){return{'name':_0x30466a[_0x3ebd('0x3c')],'type':_0x30466a[_0x3ebd('0x3d')][_0x3ebd('0x3e')]};});_0x44c932['model']=_[_0x3ebd('0x3f')](_0x59da81,'name');_0x44c932['query']=_['keys'](_0x3bd7bf[_0x3ebd('0x40')]);_0x44c932[_0x3ebd('0x41')]=_[_0x3ebd('0x42')](_0x44c932[_0x3ebd('0x43')],_0x44c932['query']);_0x275ce9[_0x3ebd('0x44')]=_[_0x3ebd('0x42')](_0x44c932[_0x3ebd('0x43')],qs[_0x3ebd('0x45')](_0x3bd7bf['query']['fields']));_0x275ce9[_0x3ebd('0x44')]=_0x275ce9[_0x3ebd('0x44')][_0x3ebd('0x46')]?_0x275ce9['attributes']:_0x44c932[_0x3ebd('0x43')];if(!_0x3bd7bf[_0x3ebd('0x40')][_0x3ebd('0x47')](_0x3ebd('0x48'))){_0x275ce9[_0x3ebd('0x2e')]=qs[_0x3ebd('0x2e')](_0x3bd7bf[_0x3ebd('0x40')][_0x3ebd('0x2e')]);_0x275ce9[_0x3ebd('0x2c')]=qs['offset'](_0x3bd7bf[_0x3ebd('0x40')][_0x3ebd('0x2c')]);}_0x275ce9[_0x3ebd('0x49')]=qs[_0x3ebd('0x4a')](_0x3bd7bf[_0x3ebd('0x40')][_0x3ebd('0x4a')]);_0x275ce9['where']=qs['filters'](_[_0x3ebd('0x4b')](_0x3bd7bf['query'],_0x44c932['filters']),_0x59da81);if(_0x3bd7bf[_0x3ebd('0x40')][_0x3ebd('0x4c')]){_0x275ce9[_0x3ebd('0x4d')]=_[_0x3ebd('0x4e')](_0x275ce9['where'],{'$or':_[_0x3ebd('0x3f')](_0x59da81,function(_0x4aa47c){if(_0x4aa47c[_0x3ebd('0x3d')]!=='VIRTUAL'){var _0x488ceb={};_0x488ceb[_0x4aa47c[_0x3ebd('0x37')]]={'$like':'%'+_0x3bd7bf[_0x3ebd('0x40')]['filter']+'%'};return _0x488ceb;}})});}_0x275ce9=_['merge']({},_0x275ce9,_0x3bd7bf['options']);var _0x2eba50={'where':_0x275ce9['where']};return db[_0x3ebd('0x3a')]['count'](_0x2eba50)[_0x3ebd('0x1f')](function(_0x5e64df){_0x4c527d['count']=_0x5e64df;if(_0x3bd7bf['query'][_0x3ebd('0x4f')]){_0x275ce9[_0x3ebd('0x50')]=[{'all':!![]}];}return db[_0x3ebd('0x3a')][_0x3ebd('0x51')](_0x275ce9);})[_0x3ebd('0x1f')](function(_0x11c8ab){_0x4c527d[_0x3ebd('0x52')]=_0x11c8ab;return _0x4c527d;})[_0x3ebd('0x1f')](respondWithFilteredResult(_0x291817,_0x275ce9))[_0x3ebd('0x53')](handleError(_0x291817,null));};exports[_0x3ebd('0x54')]=function(_0x60e1b2,_0x22fc7f){var _0x433482={'raw':![],'where':{'id':_0x60e1b2[_0x3ebd('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x3ebd('0x39')}]},_0x2c5b94={};_0x2c5b94[_0x3ebd('0x43')]=_[_0x3ebd('0x56')](db['WhatsappAccount'][_0x3ebd('0x3b')]);_0x2c5b94['query']=_[_0x3ebd('0x56')](_0x60e1b2['query']);_0x2c5b94[_0x3ebd('0x41')]=_[_0x3ebd('0x42')](_0x2c5b94[_0x3ebd('0x43')],_0x2c5b94[_0x3ebd('0x40')]);_0x433482[_0x3ebd('0x44')]=_[_0x3ebd('0x42')](_0x2c5b94['model'],qs['fields'](_0x60e1b2[_0x3ebd('0x40')][_0x3ebd('0x45')]));_0x433482[_0x3ebd('0x44')]=_0x433482[_0x3ebd('0x44')][_0x3ebd('0x46')]?_0x433482[_0x3ebd('0x44')]:_0x2c5b94['model'];if(_0x60e1b2['query']['includeAll']){_0x433482[_0x3ebd('0x50')]=[{'all':!![]}];}_0x433482=_[_0x3ebd('0x4e')]({},_0x433482,_0x60e1b2['options']);return db[_0x3ebd('0x3a')][_0x3ebd('0x57')](_0x433482)[_0x3ebd('0x1f')](handleEntityNotFound(_0x22fc7f,null))[_0x3ebd('0x1f')](respondWithResult(_0x22fc7f,null))[_0x3ebd('0x53')](handleError(_0x22fc7f,null));};exports[_0x3ebd('0x58')]=function(_0x8fd21d,_0x1a093e){return db['WhatsappAccount']['create'](_0x8fd21d[_0x3ebd('0x59')],{})['then'](function(_0x234ca1){var _0xdc3dc2=_0x8fd21d['user'][_0x3ebd('0x5a')]({'plain':!![]});if(!_0xdc3dc2)throw new Error(_0x3ebd('0x5b'));if(_0xdc3dc2['role']==='user'){var _0x227c53=_0x234ca1[_0x3ebd('0x5a')]({'plain':!![]});var _0x77b409='WhatsappAccounts';return db[_0x3ebd('0x5c')]['find']({'where':{'name':_0x77b409,'userProfileId':_0xdc3dc2[_0x3ebd('0x5d')]},'raw':!![]})[_0x3ebd('0x1f')](function(_0x4d5007){if(_0x4d5007&&_0x4d5007['autoAssociation']===0x0){return db['UserProfileResource'][_0x3ebd('0x58')]({'name':_0x227c53['name'],'resourceId':_0x227c53['id'],'type':_0x4d5007['name'],'sectionId':_0x4d5007['id']},{})[_0x3ebd('0x1f')](function(){return _0x234ca1;});}else{return _0x234ca1;}})['catch'](function(_0x3be32f){logger[_0x3ebd('0x24')](_0x3ebd('0x5e'),_0x3be32f);throw _0x3be32f;});}return _0x234ca1;})['then'](respondWithResult(_0x1a093e,0xc9))['catch'](handleError(_0x1a093e,null));};exports[_0x3ebd('0x33')]=function(_0x3fd30e,_0x2925ea){if(_0x3fd30e[_0x3ebd('0x59')]['id']){delete _0x3fd30e[_0x3ebd('0x59')]['id'];}return db[_0x3ebd('0x3a')][_0x3ebd('0x57')]({'where':{'id':_0x3fd30e[_0x3ebd('0x55')]['id']},'include':[{'model':db[_0x3ebd('0x5f')],'as':_0x3ebd('0x39')}]})[_0x3ebd('0x1f')](handleEntityNotFound(_0x2925ea,null))[_0x3ebd('0x1f')](saveUpdates(_0x3fd30e[_0x3ebd('0x59')],null))['then'](respondWithResult(_0x2925ea,null))['catch'](handleError(_0x2925ea,null));};exports[_0x3ebd('0x34')]=function(_0x5e7790,_0x4dc3bd){return db[_0x3ebd('0x3a')][_0x3ebd('0x57')]({'where':{'id':_0x5e7790[_0x3ebd('0x55')]['id']}})[_0x3ebd('0x1f')](handleEntityNotFound(_0x4dc3bd,null))[_0x3ebd('0x1f')](removeEntity(_0x4dc3bd,null))[_0x3ebd('0x53')](handleError(_0x4dc3bd,null));};exports[_0x3ebd('0x60')]=function(_0x51dc82,_0x5c93c2){return db[_0x3ebd('0x3a')][_0x3ebd('0x60')]()[_0x3ebd('0x1f')](respondWithResult(_0x5c93c2,null))[_0x3ebd('0x53')](handleError(_0x5c93c2,null));};exports[_0x3ebd('0x61')]=function(_0x2c2f89,_0x2507e0,_0x75ddb3){if(_0x2c2f89[_0x3ebd('0x59')]['id']){delete _0x2c2f89[_0x3ebd('0x59')]['id'];}return db[_0x3ebd('0x3a')][_0x3ebd('0x57')]({'where':{'id':_0x2c2f89[_0x3ebd('0x55')]['id']}})[_0x3ebd('0x1f')](handleEntityNotFound(_0x2507e0,null))[_0x3ebd('0x1f')](function(_0x2c86b5){if(_0x2c86b5){_0x2c2f89[_0x3ebd('0x59')][_0x3ebd('0x62')]=_0x2c86b5['id'];return db[_0x3ebd('0x63')]['create'](_0x2c2f89[_0x3ebd('0x59')]);}})['then'](respondWithResult(_0x2507e0,null))[_0x3ebd('0x53')](handleError(_0x2507e0,null));};exports[_0x3ebd('0x64')]=function(_0x3046cb,_0x5767ac,_0x291c4b){var _0x3333be={'raw':![],'where':{}};var _0x35a336={};var _0x4f8d18={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x3ebd('0x65')]({'where':{'id':_0x3046cb[_0x3ebd('0x55')]['id']}})[_0x3ebd('0x1f')](handleEntityNotFound(_0x5767ac,null))[_0x3ebd('0x1f')](function(_0x1f9930){if(_0x1f9930){_0x35a336[_0x3ebd('0x43')]=_[_0x3ebd('0x56')](db[_0x3ebd('0x63')]['rawAttributes']);_0x35a336[_0x3ebd('0x40')]=_[_0x3ebd('0x56')](_0x3046cb['query']);_0x35a336[_0x3ebd('0x41')]=_[_0x3ebd('0x42')](_0x35a336[_0x3ebd('0x43')],_0x35a336[_0x3ebd('0x40')]);_0x3333be['attributes']=_[_0x3ebd('0x42')](_0x35a336[_0x3ebd('0x43')],qs[_0x3ebd('0x45')](_0x3046cb[_0x3ebd('0x40')][_0x3ebd('0x45')]));_0x3333be[_0x3ebd('0x44')]=_0x3333be[_0x3ebd('0x44')][_0x3ebd('0x46')]?_0x3333be['attributes']:_0x35a336[_0x3ebd('0x43')];if(!_0x3046cb[_0x3ebd('0x40')][_0x3ebd('0x47')](_0x3ebd('0x48'))){_0x3333be[_0x3ebd('0x2e')]=qs[_0x3ebd('0x2e')](_0x3046cb['query']['limit']);_0x3333be[_0x3ebd('0x2c')]=qs[_0x3ebd('0x2c')](_0x3046cb[_0x3ebd('0x40')][_0x3ebd('0x2c')]);}_0x3333be['order']=qs['sort'](_0x3046cb['query'][_0x3ebd('0x4a')]);_0x3333be[_0x3ebd('0x4d')]=qs[_0x3ebd('0x41')](_['pick'](_0x3046cb[_0x3ebd('0x40')],_0x35a336['filters']));_0x3333be[_0x3ebd('0x4d')]['WhatsappAccountId']=_0x1f9930['id'];if(_0x3046cb[_0x3ebd('0x40')]['filter']){_0x3333be[_0x3ebd('0x4d')]=_[_0x3ebd('0x4e')](_0x3333be[_0x3ebd('0x4d')],{'$or':_['map'](_0x3333be[_0x3ebd('0x44')],function(_0x1d71b4){var _0x299e4a={};_0x299e4a[_0x1d71b4]={'$like':'%'+_0x3046cb[_0x3ebd('0x40')][_0x3ebd('0x4c')]+'%'};return _0x299e4a;})});}_0x3333be=_[_0x3ebd('0x4e')]({},_0x3333be,_0x3046cb['options']);return db[_0x3ebd('0x63')][_0x3ebd('0x2f')]({'where':_0x3333be[_0x3ebd('0x4d')]})[_0x3ebd('0x1f')](function(_0x26508f){_0x4f8d18['count']=_0x26508f;if(_0x3046cb[_0x3ebd('0x40')][_0x3ebd('0x4f')]){_0x3333be[_0x3ebd('0x50')]=[{'all':!![]}];}return db['Disposition'][_0x3ebd('0x51')](_0x3333be);})[_0x3ebd('0x1f')](function(_0x2d1c5c){_0x4f8d18[_0x3ebd('0x52')]=_0x2d1c5c;return _0x4f8d18;});}})['then'](respondWithFilteredResult(_0x5767ac,_0x3333be))['catch'](handleError(_0x5767ac,null));};exports['removeDispositions']=function(_0x22b0cf,_0x35408c,_0x390bf9){return db[_0x3ebd('0x3a')][_0x3ebd('0x57')]({'where':{'id':_0x22b0cf[_0x3ebd('0x55')]['id']}})[_0x3ebd('0x1f')](handleEntityNotFound(_0x35408c,null))['then'](function(_0x2424f2){if(_0x2424f2){return _0x2424f2[_0x3ebd('0x66')](_0x22b0cf[_0x3ebd('0x40')]['ids']);}})[_0x3ebd('0x1f')](respondWithStatusCode(_0x35408c,null))[_0x3ebd('0x53')](handleError(_0x35408c,null));};exports[_0x3ebd('0x67')]=function(_0x3ba915,_0x112ebd,_0x477ff7){if(_0x3ba915['body']['id']){delete _0x3ba915[_0x3ebd('0x59')]['id'];}return db[_0x3ebd('0x3a')][_0x3ebd('0x57')]({'where':{'id':_0x3ba915[_0x3ebd('0x55')]['id']}})[_0x3ebd('0x1f')](handleEntityNotFound(_0x112ebd,null))[_0x3ebd('0x1f')](function(_0x22f723){if(_0x22f723){_0x3ba915[_0x3ebd('0x59')][_0x3ebd('0x62')]=_0x22f723['id'];return db[_0x3ebd('0x68')][_0x3ebd('0x58')](_0x3ba915['body']);}})[_0x3ebd('0x1f')](respondWithResult(_0x112ebd,null))[_0x3ebd('0x53')](handleError(_0x112ebd,null));};exports[_0x3ebd('0x69')]=function(_0x331fe8,_0x459f58,_0x5e015a){var _0x410ca9={'raw':![],'where':{}};var _0x3c7ed8={};var _0x1b170f={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x3ebd('0x65')]({'where':{'id':_0x331fe8[_0x3ebd('0x55')]['id']}})[_0x3ebd('0x1f')](handleEntityNotFound(_0x459f58,null))['then'](function(_0x281a77){if(_0x281a77){_0x3c7ed8['model']=_[_0x3ebd('0x56')](db['CannedAnswer']['rawAttributes']);_0x3c7ed8['query']=_[_0x3ebd('0x56')](_0x331fe8['query']);_0x3c7ed8['filters']=_[_0x3ebd('0x42')](_0x3c7ed8[_0x3ebd('0x43')],_0x3c7ed8[_0x3ebd('0x40')]);_0x410ca9[_0x3ebd('0x44')]=_[_0x3ebd('0x42')](_0x3c7ed8[_0x3ebd('0x43')],qs['fields'](_0x331fe8[_0x3ebd('0x40')]['fields']));_0x410ca9['attributes']=_0x410ca9[_0x3ebd('0x44')]['length']?_0x410ca9[_0x3ebd('0x44')]:_0x3c7ed8[_0x3ebd('0x43')];if(!_0x331fe8[_0x3ebd('0x40')][_0x3ebd('0x47')](_0x3ebd('0x48'))){_0x410ca9[_0x3ebd('0x2e')]=qs[_0x3ebd('0x2e')](_0x331fe8['query'][_0x3ebd('0x2e')]);_0x410ca9[_0x3ebd('0x2c')]=qs[_0x3ebd('0x2c')](_0x331fe8['query'][_0x3ebd('0x2c')]);}_0x410ca9[_0x3ebd('0x49')]=qs[_0x3ebd('0x4a')](_0x331fe8[_0x3ebd('0x40')][_0x3ebd('0x4a')]);_0x410ca9['where']=qs['filters'](_[_0x3ebd('0x4b')](_0x331fe8['query'],_0x3c7ed8[_0x3ebd('0x41')]));_0x410ca9[_0x3ebd('0x4d')][_0x3ebd('0x62')]=_0x281a77['id'];if(_0x331fe8['query']['filter']){_0x410ca9[_0x3ebd('0x4d')]=_[_0x3ebd('0x4e')](_0x410ca9[_0x3ebd('0x4d')],{'$or':_[_0x3ebd('0x3f')](_0x410ca9['attributes'],function(_0x1f8203){var _0x55c3ff={};_0x55c3ff[_0x1f8203]={'$like':'%'+_0x331fe8['query'][_0x3ebd('0x4c')]+'%'};return _0x55c3ff;})});}_0x410ca9=_[_0x3ebd('0x4e')]({},_0x410ca9,_0x331fe8[_0x3ebd('0x6a')]);return db[_0x3ebd('0x68')]['count']({'where':_0x410ca9[_0x3ebd('0x4d')]})[_0x3ebd('0x1f')](function(_0x405134){_0x1b170f[_0x3ebd('0x2f')]=_0x405134;if(_0x331fe8[_0x3ebd('0x40')][_0x3ebd('0x4f')]){_0x410ca9['include']=[{'all':!![]}];}return db[_0x3ebd('0x68')][_0x3ebd('0x51')](_0x410ca9);})[_0x3ebd('0x1f')](function(_0x38a55c){_0x1b170f[_0x3ebd('0x52')]=_0x38a55c;return _0x1b170f;});}})[_0x3ebd('0x1f')](respondWithFilteredResult(_0x459f58,_0x410ca9))[_0x3ebd('0x53')](handleError(_0x459f58,null));};exports[_0x3ebd('0x6b')]=function(_0x3bb679,_0x1ddce2,_0x4c8964){return db[_0x3ebd('0x3a')][_0x3ebd('0x57')]({'where':{'id':_0x3bb679[_0x3ebd('0x55')]['id']}})[_0x3ebd('0x1f')](handleEntityNotFound(_0x1ddce2,null))['then'](function(_0x4a1d18){if(_0x4a1d18){return _0x4a1d18[_0x3ebd('0x6b')](_0x3bb679['query'][_0x3ebd('0x6c')]);}})[_0x3ebd('0x1f')](respondWithStatusCode(_0x1ddce2,null))[_0x3ebd('0x53')](handleError(_0x1ddce2,null));};exports[_0x3ebd('0x6d')]=function(_0x5124e1,_0x13ac68,_0x202070){return db[_0x3ebd('0x3a')][_0x3ebd('0x57')]({'where':{'id':_0x5124e1[_0x3ebd('0x55')]['id']}})['then'](handleEntityNotFound(_0x13ac68,null))['then'](function(_0x264419){if(_0x264419){return _0x264419[_0x3ebd('0x6d')](_0x5124e1[_0x3ebd('0x59')][_0x3ebd('0x6c')],_[_0x3ebd('0x6e')](_0x5124e1[_0x3ebd('0x59')],['ids','id'])||{})[_0x3ebd('0x6f')](function(_0x44c006){for(var _0x512126=0x0;_0x512126<_0x5124e1['body'][_0x3ebd('0x6c')]['length'];_0x512126+=0x1){socket[_0x3ebd('0x70')]('userWhatsappAccount:save',{'UserId':Number(_0x5124e1[_0x3ebd('0x59')][_0x3ebd('0x6c')][_0x512126]),'WhatsappAccountId':Number(_0x5124e1['params']['id'])});}return _0x44c006;});}})[_0x3ebd('0x1f')](respondWithResult(_0x13ac68,null))[_0x3ebd('0x53')](handleError(_0x13ac68,null));};exports['removeAgents']=function(_0x4e2a3f,_0x255713,_0x11f704){return db[_0x3ebd('0x3a')][_0x3ebd('0x57')]({'where':{'id':_0x4e2a3f[_0x3ebd('0x55')]['id']}})['then'](handleEntityNotFound(_0x255713,null))[_0x3ebd('0x1f')](function(_0x4ef6f9){if(_0x4ef6f9){return _0x4ef6f9[_0x3ebd('0x71')](_0x4e2a3f[_0x3ebd('0x40')][_0x3ebd('0x6c')])[_0x3ebd('0x1f')](function(){if(_['isArray'](_0x4e2a3f[_0x3ebd('0x40')][_0x3ebd('0x6c')])){for(var _0x2e282f=0x0;_0x2e282f<_0x4e2a3f['query'][_0x3ebd('0x6c')][_0x3ebd('0x46')];_0x2e282f+=0x1){socket[_0x3ebd('0x70')]('userWhatsappAccount:remove',{'UserId':Number(_0x4e2a3f[_0x3ebd('0x40')][_0x3ebd('0x6c')][_0x2e282f]),'WhatsappAccountId':Number(_0x4e2a3f[_0x3ebd('0x55')]['id'])});}}else{socket[_0x3ebd('0x70')]('userWhatsappAccount:remove',{'UserId':Number(_0x4e2a3f[_0x3ebd('0x40')][_0x3ebd('0x6c')]),'WhatsappAccountId':Number(_0x4e2a3f[_0x3ebd('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x255713,null))[_0x3ebd('0x53')](handleError(_0x255713,null));};exports[_0x3ebd('0x72')]=function(_0x15c4ad,_0x3ef2be,_0x37fd90){var _0x3009bc={};var _0x33b672={};var _0x5d96b1;var _0x49a16a;return db[_0x3ebd('0x3a')][_0x3ebd('0x65')]({'where':{'id':_0x15c4ad[_0x3ebd('0x55')]['id']}})[_0x3ebd('0x1f')](handleEntityNotFound(_0x3ef2be,null))[_0x3ebd('0x1f')](function(_0x3159f2){if(_0x3159f2){_0x5d96b1=_0x3159f2;_0x33b672['model']=_[_0x3ebd('0x56')](db[_0x3ebd('0x73')][_0x3ebd('0x3b')]);_0x33b672[_0x3ebd('0x40')]=_[_0x3ebd('0x56')](_0x15c4ad['query']);_0x33b672[_0x3ebd('0x41')]=_['intersection'](_0x33b672[_0x3ebd('0x43')],_0x33b672[_0x3ebd('0x40')]);_0x3009bc['attributes']=_[_0x3ebd('0x42')](_0x33b672[_0x3ebd('0x43')],qs['fields'](_0x15c4ad[_0x3ebd('0x40')][_0x3ebd('0x45')]));_0x3009bc[_0x3ebd('0x44')]=_0x3009bc[_0x3ebd('0x44')][_0x3ebd('0x46')]?_0x3009bc[_0x3ebd('0x44')]:_0x33b672['model'];_0x3009bc[_0x3ebd('0x49')]=qs['sort'](_0x15c4ad[_0x3ebd('0x40')][_0x3ebd('0x4a')]);_0x3009bc[_0x3ebd('0x4d')]=qs[_0x3ebd('0x41')](_[_0x3ebd('0x4b')](_0x15c4ad[_0x3ebd('0x40')],_0x33b672['filters']));if(_0x15c4ad[_0x3ebd('0x40')]['filter']){_0x3009bc[_0x3ebd('0x4d')]=_[_0x3ebd('0x4e')](_0x3009bc[_0x3ebd('0x4d')],{'$or':_[_0x3ebd('0x3f')](_0x3009bc[_0x3ebd('0x44')],function(_0x323b92){var _0xc3c0be={};_0xc3c0be[_0x323b92]={'$like':'%'+_0x15c4ad[_0x3ebd('0x40')][_0x3ebd('0x4c')]+'%'};return _0xc3c0be;})});}_0x3009bc=_[_0x3ebd('0x4e')]({},_0x3009bc,_0x15c4ad[_0x3ebd('0x6a')]);return _0x5d96b1[_0x3ebd('0x72')](_0x3009bc);}})[_0x3ebd('0x1f')](function(_0x1319f6){if(_0x1319f6){_0x49a16a=_0x1319f6[_0x3ebd('0x46')];if(!_0x15c4ad[_0x3ebd('0x40')]['hasOwnProperty'](_0x3ebd('0x48'))){_0x3009bc['limit']=qs[_0x3ebd('0x2e')](_0x15c4ad[_0x3ebd('0x40')][_0x3ebd('0x2e')]);_0x3009bc[_0x3ebd('0x2c')]=qs[_0x3ebd('0x2c')](_0x15c4ad[_0x3ebd('0x40')][_0x3ebd('0x2c')]);}return _0x5d96b1[_0x3ebd('0x72')](_0x3009bc);}})[_0x3ebd('0x1f')](function(_0x1e7b79){if(_0x1e7b79){return _0x1e7b79?{'count':_0x49a16a,'rows':_0x1e7b79}:null;}})[_0x3ebd('0x1f')](respondWithResult(_0x3ef2be,null))[_0x3ebd('0x53')](handleError(_0x3ef2be,null));};exports[_0x3ebd('0x74')]=function(_0x27910c,_0x2ed078){var _0xab144b=_0x27910c[_0x3ebd('0x55')]['id'];var _0x103d78=_0x27910c['body'];var _0x359074=0xc8;var _0x24c374=null;return db['sequelize'][_0x3ebd('0x75')]({'isolationLevel':db[_0x3ebd('0x76')][_0x3ebd('0x77')][_0x3ebd('0x78')][_0x3ebd('0x79')]},function(_0x2fc75a){return db[_0x3ebd('0x3a')]['findOne']({'where':{'id':_0xab144b},'transaction':_0x2fc75a})[_0x3ebd('0x1f')](function(_0x458c73){if(_0x458c73){return db[_0x3ebd('0x7a')][_0x3ebd('0x34')]({'where':{'WhatsappAccountId':_0xab144b},'transaction':_0x2fc75a})['then'](function(){var _0x5276b8=_[_0x3ebd('0x3f')](_0x103d78,function(_0x2e27a9){_0x2e27a9[_0x3ebd('0x62')]=_0xab144b;return _0x2e27a9;});return db[_0x3ebd('0x7a')][_0x3ebd('0x7b')](_0x5276b8,{'transaction':_0x2fc75a});});}else{_0x359074=0x194;_0x24c374=[];}});})[_0x3ebd('0x1f')](function(){if(_0x359074!==0x194){return db[_0x3ebd('0x7a')]['findAndCountAll']({'where':{'WhatsappAccountId':_0xab144b},'order':_0x3ebd('0x7c')})[_0x3ebd('0x1f')](function(_0x2068c9){_0x24c374=_0x2068c9;});}})[_0x3ebd('0x53')](function(_0x4a0c50){_0x359074=0x1f4;logger[_0x3ebd('0x24')](_0x4a0c50[_0x3ebd('0x36')]);if(_0x4a0c50[_0x3ebd('0x37')]){delete _0x4a0c50['name'];}_0x24c374=_0x4a0c50;})[_0x3ebd('0x7d')](function(){if(_0x24c374===null){_0x2ed078[_0x3ebd('0x28')](_0x359074);}else{if(_0x359074===0x1f4){_0x2ed078[_0x3ebd('0x29')](_0x359074)[_0x3ebd('0x38')](_0x24c374);}else{_0x2ed078[_0x3ebd('0x29')](_0x359074)['json'](_0x24c374);}}});};exports[_0x3ebd('0x7e')]=function(_0x115c4d,_0x391140,_0x299771){var _0x1cd22d={};var _0x24d7b8={};var _0x325e42;var _0x3f093e;return db['WhatsappAccount'][_0x3ebd('0x65')]({'where':{'id':_0x115c4d[_0x3ebd('0x55')]['id']}})[_0x3ebd('0x1f')](handleEntityNotFound(_0x391140,null))[_0x3ebd('0x1f')](function(_0x272042){if(_0x272042){_0x325e42=_0x272042;_0x24d7b8['model']=_['keys'](db[_0x3ebd('0x7a')][_0x3ebd('0x3b')]);_0x24d7b8[_0x3ebd('0x40')]=_[_0x3ebd('0x56')](_0x115c4d[_0x3ebd('0x40')]);_0x24d7b8[_0x3ebd('0x41')]=_[_0x3ebd('0x42')](_0x24d7b8[_0x3ebd('0x43')],_0x24d7b8[_0x3ebd('0x40')]);_0x1cd22d['attributes']=_[_0x3ebd('0x42')](_0x24d7b8[_0x3ebd('0x43')],qs['fields'](_0x115c4d[_0x3ebd('0x40')]['fields']));_0x1cd22d[_0x3ebd('0x44')]=_0x1cd22d['attributes']['length']?_0x1cd22d['attributes']:_0x24d7b8[_0x3ebd('0x43')];_0x1cd22d[_0x3ebd('0x49')]=qs[_0x3ebd('0x4a')](_0x115c4d[_0x3ebd('0x40')]['sort']);_0x1cd22d['where']=qs[_0x3ebd('0x41')](_[_0x3ebd('0x4b')](_0x115c4d[_0x3ebd('0x40')],_0x24d7b8['filters']));if(_0x115c4d[_0x3ebd('0x40')][_0x3ebd('0x4c')]){_0x1cd22d[_0x3ebd('0x4d')]=_[_0x3ebd('0x4e')](_0x1cd22d[_0x3ebd('0x4d')],{'$or':_[_0x3ebd('0x3f')](_0x1cd22d[_0x3ebd('0x44')],function(_0x40e3e0){var _0x3a509b={};_0x3a509b[_0x40e3e0]={'$like':'%'+_0x115c4d[_0x3ebd('0x40')][_0x3ebd('0x4c')]+'%'};return _0x3a509b;})});}_0x1cd22d=_[_0x3ebd('0x4e')]({},_0x1cd22d,_0x115c4d[_0x3ebd('0x6a')]);return _0x325e42[_0x3ebd('0x7e')](_0x1cd22d);}})[_0x3ebd('0x1f')](function(_0x264aef){if(_0x264aef){_0x3f093e=_0x264aef['length'];if(!_0x115c4d[_0x3ebd('0x40')]['hasOwnProperty'](_0x3ebd('0x48'))){_0x1cd22d[_0x3ebd('0x2e')]=qs[_0x3ebd('0x2e')](_0x115c4d[_0x3ebd('0x40')][_0x3ebd('0x2e')]);_0x1cd22d[_0x3ebd('0x2c')]=qs['offset'](_0x115c4d[_0x3ebd('0x40')][_0x3ebd('0x2c')]);}return _0x325e42[_0x3ebd('0x7e')](_0x1cd22d);}})[_0x3ebd('0x1f')](function(_0x11b557){if(_0x11b557){return _0x11b557?{'count':_0x3f093e,'rows':_0x11b557}:null;}})[_0x3ebd('0x1f')](respondWithResult(_0x391140,null))['catch'](handleError(_0x391140,null));};exports['notify']=function(_0x567fff,_0x4fee03,_0x56c283){var _0x15c27b={'channel':'whatsapp'};var _0x46ae06=[];var _0x4d7469=[];var _0x323128={};return db[_0x3ebd('0x3a')][_0x3ebd('0x57')]({'where':{'id':_0x567fff[_0x3ebd('0x55')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x3ebd('0x7f')}]})[_0x3ebd('0x1f')](handleEntityNotFound(_0x4fee03,null))[_0x3ebd('0x1f')](function(_0x5bd9ce){_0x15c27b[_0x3ebd('0x80')]=_0x5bd9ce;if(_0x15c27b[_0x3ebd('0x80')]&&_0x15c27b[_0x3ebd('0x80')][_0x3ebd('0x3d')]===_0x3ebd('0x81')&&_0x567fff[_0x3ebd('0x59')][_0x3ebd('0x82')]){if(_0x567fff[_0x3ebd('0x59')][_0x3ebd('0x82')][_0x3ebd('0x46')]===0x0)return;if(_0x567fff[_0x3ebd('0x59')][_0x3ebd('0x82')][0x0][_0x3ebd('0x83')]!==_0x3ebd('0x84'))return;return db[_0x3ebd('0x85')][_0x3ebd('0x33')]({'read':!![],'readAt':_0x567fff[_0x3ebd('0x59')][_0x3ebd('0x82')][0x0][_0x3ebd('0x86')]},{'where':{'messageId':_0x567fff['body'][_0x3ebd('0x82')][0x0]['message_id']},'individualHooks':!![]})[_0x3ebd('0x1f')](function(_0x2e056b){return _0x4fee03['status'](0xc8)[_0x3ebd('0x2b')](_0x2e056b);});}_0x15c27b[_0x3ebd('0x87')]=_[_0x3ebd('0x88')](_0x5bd9ce[_0x3ebd('0x7f')],[_0x3ebd('0x7c')],[_0x3ebd('0x89')]);if(_0x15c27b[_0x3ebd('0x80')]['Applications']){delete _0x15c27b[_0x3ebd('0x80')][_0x3ebd('0x7f')];}return db[_0x3ebd('0x8a')][_0x3ebd('0x60')]()[_0x3ebd('0x1f')](function(_0x50cd05){if(!_0x50cd05){throw new db[(_0x3ebd('0x8b'))][(_0x3ebd('0x8c'))](_0x3ebd('0x8d'));}_0x46ae06=_[_0x3ebd('0x8e')](_['keys'](_0x50cd05),[_0x3ebd('0x8f'),_0x3ebd('0x90')]);_0x4d7469=_['difference'](_[_0x3ebd('0x56')](_0x50cd05),[_0x3ebd('0x8f'),_0x3ebd('0x90'),'CompanyId','ListId']);_0x15c27b['body']={'mapKey':_0x3ebd('0x91')};if(_0x15c27b['account']&&_0x15c27b[_0x3ebd('0x80')][_0x3ebd('0x3d')]===_0x3ebd('0x92')){_0x15c27b[_0x3ebd('0x59')]['from']=_0x567fff[_0x3ebd('0x59')][_0x3ebd('0x93')][_0x3ebd('0x94')](_0x3ebd('0x95'),'');_0x15c27b[_0x3ebd('0x59')][_0x3ebd('0x59')]=_0x567fff[_0x3ebd('0x59')][_0x3ebd('0x96')];_0x15c27b[_0x3ebd('0x59')]['messageId']=_0x567fff['body'][_0x3ebd('0x97')];}if(_0x15c27b[_0x3ebd('0x80')]&&_0x15c27b[_0x3ebd('0x80')][_0x3ebd('0x3d')]===_0x3ebd('0x81')){_0x15c27b['body'][_0x3ebd('0x98')]=_0x567fff[_0x3ebd('0x59')][_0x3ebd('0x99')][0x0][_0x3ebd('0x98')];_0x15c27b[_0x3ebd('0x59')][_0x3ebd('0x59')]=_0x567fff['body'][_0x3ebd('0x99')][0x0][_0x3ebd('0x25')][_0x3ebd('0x59')];_0x15c27b[_0x3ebd('0x59')][_0x3ebd('0x9a')]=_0x567fff[_0x3ebd('0x59')][_0x3ebd('0x99')][0x0]['message_id'];}if(_0x15c27b['body']['id']){delete _0x15c27b['body']['id'];}if(_[_0x3ebd('0x9b')](_0x15c27b[_0x3ebd('0x59')][_0x3ebd('0x98')])){throw new db[(_0x3ebd('0x8b'))][(_0x3ebd('0x8c'))](_0x3ebd('0x9c'));}if(_['isNil'](_0x15c27b[_0x3ebd('0x59')]['body'])||_0x15c27b[_0x3ebd('0x59')]['body']===''){throw new db[(_0x3ebd('0x8b'))][(_0x3ebd('0x8c'))](_0x3ebd('0x9d'));}if(_[_0x3ebd('0x9b')](_0x15c27b[_0x3ebd('0x59')]['mapKey'])){throw new db[(_0x3ebd('0x8b'))][(_0x3ebd('0x8c'))](_0x3ebd('0x9e')+_0x4d7469);}if(!_['includes'](_0x4d7469,_0x15c27b[_0x3ebd('0x59')][_0x3ebd('0x9f')])){throw new db[(_0x3ebd('0x8b'))][(_0x3ebd('0x8c'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4d7469);}_0x323128[_0x15c27b[_0x3ebd('0x59')][_0x3ebd('0x9f')]]=_0x15c27b[_0x3ebd('0x59')]['from'];return db[_0x3ebd('0xa0')][_0x3ebd('0x57')]({'where':{'id':_0x15c27b[_0x3ebd('0x80')][_0x3ebd('0xa1')]},'include':[{'model':db[_0x3ebd('0x8a')],'as':_0x3ebd('0xa2'),'where':_0x323128,'limit':0x1,'order':[[_0x3ebd('0x90'),_0x3ebd('0xa3')]]}]});})[_0x3ebd('0x1f')](handleEntityNotFound(_0x4fee03,null))[_0x3ebd('0x1f')](function(_0x26e4ff){if(_0x26e4ff){_0x15c27b[_0x3ebd('0xa4')]=_[_0x3ebd('0x6e')](_0x26e4ff,[_0x3ebd('0xa2')]);if(_0x26e4ff[_0x3ebd('0xa2')][_0x3ebd('0x46')]){return _0x26e4ff[_0x3ebd('0xa2')][0x0];}var _0x139de9=_[_0x3ebd('0x18')](_0x15c27b[_0x3ebd('0x59')],{'firstName':_0x15c27b['body'][_0x3ebd('0x98')],'ListId':_0x26e4ff['id']});_0x139de9[_0x15c27b['body'][_0x3ebd('0x9f')]]=_0x15c27b['body']['from'];return db['CmContact']['create'](_0x139de9,{'fields':_0x46ae06,'raw':!![]});}})['then'](handleEntityNotFound(_0x4fee03,null))[_0x3ebd('0x1f')](function(_0x45c510){if(_0x45c510){_0x15c27b[_0x3ebd('0xa5')]=_0x45c510;var _0x5a0c9c={'ContactId':_0x45c510['id'],'phone':_0x15c27b[_0x3ebd('0x59')][_0x3ebd('0x98')],'WhatsappAccountId':_0x567fff[_0x3ebd('0x55')]['id']};var _0x2cb838={'ContactId':_0x45c510['id'],'WhatsappAccountId':_0x567fff[_0x3ebd('0x55')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x3ebd('0x57')]({'where':_0x2cb838})[_0x3ebd('0x1f')](function(_0x563399){if(_0x563399){return[_0x563399,![]];}return db['WhatsappInteraction'][_0x3ebd('0x58')](_0x5a0c9c)[_0x3ebd('0x1f')](function(_0xe156fe){return[_0xe156fe,!![]];});});}})['spread'](function(_0x431a40,_0x1e196c){_0x15c27b[_0x3ebd('0xa6')]=_0x431a40[_0x3ebd('0x5a')]({'plain':!![]});_0x15c27b['interaction']['created']=![];if(_0x1e196c){if(_0x15c27b[_0x3ebd('0x80')][_0x3ebd('0xa7')]){_0x15c27b['applications'][_0x3ebd('0xa8')]({'id':0x0,'priority':_0x15c27b['applications'][_0x3ebd('0x46')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}_0x15c27b[_0x3ebd('0xa6')][_0x3ebd('0xa9')]=!![];}return db[_0x3ebd('0x85')][_0x3ebd('0x58')]({'phone':_0x15c27b[_0x3ebd('0x59')]['from'],'messageId':_0x15c27b[_0x3ebd('0x59')][_0x3ebd('0x9a')],'body':_0x15c27b[_0x3ebd('0x59')][_0x3ebd('0x59')],'WhatsappAccountId':_0x567fff[_0x3ebd('0x55')]['id'],'WhatsappInteractionId':_0x431a40['id'],'direction':'in','ContactId':_0x431a40[_0x3ebd('0xaa')],'AttachmentId':_0x15c27b[_0x3ebd('0x59')][_0x3ebd('0xab')]});})[_0x3ebd('0x1f')](function(_0x47e17e){_0x15c27b[_0x3ebd('0x25')]=_0x47e17e;if(!_0x15c27b[_0x3ebd('0xa6')][_0x3ebd('0xac')])return;return db[_0x3ebd('0x73')][_0x3ebd('0x57')]({'attributes':['id',_0x3ebd('0x37')],'where':{'id':_0x15c27b[_0x3ebd('0xa6')][_0x3ebd('0xac')]}});})[_0x3ebd('0x1f')](function(_0xa7b12f){if(_0xa7b12f){_0x15c27b['applications'][_0x3ebd('0xad')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xa7b12f[_0x3ebd('0x37')]+','+(_0x15c27b[_0x3ebd('0x80')]['waitForTheAssignedAgent']||0xa),'interval':_0x3ebd('0xae')});}if(!_0x15c27b[_0x3ebd('0xa6')][_0x3ebd('0xaf')])return;return db[_0x3ebd('0xb0')][_0x3ebd('0x57')]({'attributes':['id',_0x3ebd('0x37')],'where':{'id':_0x15c27b[_0x3ebd('0xa6')]['queueId']}});})[_0x3ebd('0x1f')](function(_0x3b15d3){if(_0x3b15d3){_0x15c27b[_0x3ebd('0x87')][_0x3ebd('0xad')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x3b15d3['name']+','+(_0x15c27b[_0x3ebd('0x80')][_0x3ebd('0xb1')]||0x12c),'interval':_0x3ebd('0xae')});}return respondWithRpcPromise(_0x3ebd('0xb2'),_0x3ebd('0xb3'),_0x15c27b);})[_0x3ebd('0x1f')](function(_0xc43cce){if(_0xc43cce){var _0x3ac31c=0xc8;var _0x25e440=_0x3ebd('0xb4');logger[_0x3ebd('0x20')](_0x3ebd('0x21'),_0x25e440,_0x3ac31c,'entity\x20found');logger['debug'](_0x3ebd('0xb5'),_0x25e440,_0x3ac31c,_0x3ebd('0xb6'),JSON[_0x3ebd('0x22')](_0xc43cce));if(_0x15c27b[_0x3ebd('0x80')][_0x3ebd('0x3d')]==='twilio'){return _0x4fee03['status'](_0x3ac31c)[_0x3ebd('0xb7')](_0x3ebd('0xb8'),'text/xml')[_0x3ebd('0x38')](_0x3ebd('0xb9'));}else{return _0x4fee03[_0x3ebd('0x29')](_0x3ac31c)[_0x3ebd('0x2b')](_0xc43cce);}}});})['catch'](handleError(_0x4fee03,null));};exports[_0x3ebd('0x38')]=function(_0x203411,_0x42cfec,_0x24aac2){var _0x4ec4a1,_0xd5b9e6,_0x10f713;if(_[_0x3ebd('0x9b')](_0x203411['body'][_0x3ebd('0x59')])||_0x203411[_0x3ebd('0x59')]['body']===''){throw new db[(_0x3ebd('0x8b'))][(_0x3ebd('0x8c'))](_0x3ebd('0x9d'));}if(_[_0x3ebd('0x9b')](_0x203411['body']['to'])){throw new db['Sequelize'][(_0x3ebd('0x8c'))](_0x3ebd('0xba'));}_0x4ec4a1=_0x203411[_0x3ebd('0x59')]['to'];return db['WhatsappAccount'][_0x3ebd('0x57')]({'where':{'id':_0x203411['params']['id']},'include':[{'model':db[_0x3ebd('0xa0')],'as':'List','include':[{'model':db[_0x3ebd('0x8a')],'as':_0x3ebd('0xa2'),'where':{'mobile':_0x4ec4a1},'limit':0x1,'order':[[_0x3ebd('0x90'),_0x3ebd('0xa3')]]}]}]})['then'](handleEntityNotFound(_0x42cfec,null))[_0x3ebd('0x1f')](function(_0x5ad3ac){if(_0x5ad3ac&&_0x5ad3ac[_0x3ebd('0xbb')]){_0xd5b9e6=_0x5ad3ac[_0x3ebd('0x5a')]({'plain':!![]});if(_0xd5b9e6['List']&&_0xd5b9e6['List'][_0x3ebd('0xa2')]['length']){return _0xd5b9e6['List']['Contacts'][0x0];}return db[_0x3ebd('0x8a')][_0x3ebd('0x58')](_['defaults'](_0x203411[_0x3ebd('0x59')],{'firstName':_0x4ec4a1,'mobile':_0x4ec4a1,'phone':_0x4ec4a1,'ListId':_0xd5b9e6[_0x3ebd('0xa1')]}));}})[_0x3ebd('0x1f')](handleEntityNotFound(_0x42cfec,null))[_0x3ebd('0x1f')](function(_0x4f267d){if(_0x4f267d){_0x10f713=_0x4f267d;return db[_0x3ebd('0xbc')][_0x3ebd('0x57')]({'where':{'ContactId':_0x10f713['id'],'closed':![],'WhatsappAccountId':_0xd5b9e6['id']}})[_0x3ebd('0x1f')](function(_0x2ce56c){if(_0x2ce56c){return[_0x2ce56c,![]];}return db[_0x3ebd('0xbc')][_0x3ebd('0x58')]({'UserId':_0x203411['user']['id'],'ContactId':_0x10f713['id'],'WhatsappAccountId':_0xd5b9e6['id'],'phone':_0x4ec4a1,'firstMsgDirection':_0x3ebd('0xbd'),'Messages':[_[_0x3ebd('0x4e')](_0x203411[_0x3ebd('0x59')],{'read':![],'body':_0x203411[_0x3ebd('0x59')][_0x3ebd('0x59')],'phone':_0x4ec4a1,'WhatsappAccountId':_0xd5b9e6['id'],'UserId':_0x203411[_0x3ebd('0xbe')]['id'],'ContactId':_0x10f713['id']})]},{'include':[{'model':db[_0x3ebd('0x85')],'as':_0x3ebd('0xbf')}]})[_0x3ebd('0x1f')](function(_0x1a2c91){return[_0x1a2c91,!![]];});});}})[_0x3ebd('0x6f')](function(_0x3b7d01,_0x11ad44){if(_0x11ad44){return _0x3b7d01;}return db[_0x3ebd('0x85')][_0x3ebd('0x58')](_[_0x3ebd('0x4e')](_0x203411[_0x3ebd('0x59')],{'read':![],'body':_0x203411[_0x3ebd('0x59')]['body'],'phone':_0x4ec4a1,'WhatsappAccountId':_0xd5b9e6['id'],'WhatsappInteractionId':_0x3b7d01['id'],'UserId':_0x203411['user']['id'],'ContactId':_0x10f713['id']}))['then'](function(_0x3ff48f){_0x3b7d01[_0x3ebd('0xc0')][_0x3ebd('0xbf')]=[];_0x3b7d01[_0x3ebd('0xc0')][_0x3ebd('0xbf')]['push'](_0x3ff48f[_0x3ebd('0xc0')]);return _0x3b7d01;});})[_0x3ebd('0x1f')](respondWithResult(_0x42cfec,null))['catch'](handleError(_0x42cfec,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 56bb864..698ad62 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 _0xcf50=['hook','exports','events','../../mysqldb','WhatsappAccount','update','remove','emit','hasOwnProperty'];(function(_0x3a8012,_0x23a2b8){var _0x1cbc20=function(_0x43cdbf){while(--_0x43cdbf){_0x3a8012['push'](_0x3a8012['shift']());}};_0x1cbc20(++_0x23a2b8);}(_0xcf50,0x6e));var _0x0cf5=function(_0x81050d,_0x3254b3){_0x81050d=_0x81050d-0x0;var _0x489cc9=_0xcf50[_0x81050d];return _0x489cc9;};'use strict';var EventEmitter=require(_0x0cf5('0x0'));var WhatsappAccount=require(_0x0cf5('0x1'))['db'][_0x0cf5('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0cf5('0x3'),'afterDestroy':_0x0cf5('0x4')};function emitEvent(_0x568f26){return function(_0x452607,_0x52c969,_0x3e7ae5){WhatsappAccountEvents[_0x0cf5('0x5')](_0x568f26+':'+_0x452607['id'],_0x452607);WhatsappAccountEvents[_0x0cf5('0x5')](_0x568f26,_0x452607);_0x3e7ae5(null);};}for(var e in events){if(events[_0x0cf5('0x6')](e)){var event=events[e];WhatsappAccount[_0x0cf5('0x7')](e,emitEvent(event));}}module[_0x0cf5('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0xcb4d=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','WhatsappAccount'];(function(_0x1de108,_0x112861){var _0xac408d=function(_0x4b49a9){while(--_0x4b49a9){_0x1de108['push'](_0x1de108['shift']());}};_0xac408d(++_0x112861);}(_0xcb4d,0x101));var _0xdcb4=function(_0x41726c,_0x4cf7a4){_0x41726c=_0x41726c-0x0;var _0x1c9577=_0xcb4d[_0x41726c];return _0x1c9577;};'use strict';var EventEmitter=require(_0xdcb4('0x0'));var WhatsappAccount=require(_0xdcb4('0x1'))['db'][_0xdcb4('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xdcb4('0x3')](0x0);var events={'afterCreate':_0xdcb4('0x4'),'afterUpdate':_0xdcb4('0x5'),'afterDestroy':_0xdcb4('0x6')};function emitEvent(_0x277a4e){return function(_0x2876e3,_0x19c25f,_0x1e70f8){WhatsappAccountEvents[_0xdcb4('0x7')](_0x277a4e+':'+_0x2876e3['id'],_0x2876e3);WhatsappAccountEvents[_0xdcb4('0x7')](_0x277a4e,_0x2876e3);_0x1e70f8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xdcb4('0x8')](e,emitEvent(event));}}module[_0xdcb4('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index f70d791..e378126 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 _0xec03=['request-promise','path','rimraf','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','bluebird'];(function(_0x29322d,_0x386d1b){var _0x5518e9=function(_0x17fbed){while(--_0x17fbed){_0x29322d['push'](_0x29322d['shift']());}};_0x5518e9(++_0x386d1b);}(_0xec03,0x70));var _0x3ec0=function(_0x53fe52,_0x467e11){_0x53fe52=_0x53fe52-0x0;var _0x307122=_0xec03[_0x53fe52];return _0x307122;};'use strict';var _=require(_0x3ec0('0x0'));var util=require(_0x3ec0('0x1'));var logger=require(_0x3ec0('0x2'))(_0x3ec0('0x3'));var moment=require('moment');var BPromise=require(_0x3ec0('0x4'));var rp=require(_0x3ec0('0x5'));var fs=require('fs');var path=require(_0x3ec0('0x6'));var rimraf=require(_0x3ec0('0x7'));var config=require('../../config/environment');var attributes=require(_0x3ec0('0x8'));module[_0x3ec0('0x9')]=function(_0x1bdd01,_0xf6715e){return _0x1bdd01[_0x3ec0('0xa')](_0x3ec0('0xb'),attributes,{'tableName':_0x3ec0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d01=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api'];(function(_0x52eabb,_0x4ecc51){var _0x290a28=function(_0x60dfb0){while(--_0x60dfb0){_0x52eabb['push'](_0x52eabb['shift']());}};_0x290a28(++_0x4ecc51);}(_0x8d01,0x6c));var _0x18d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d01[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x18d0('0x0'));var util=require(_0x18d0('0x1'));var logger=require(_0x18d0('0x2'))(_0x18d0('0x3'));var moment=require(_0x18d0('0x4'));var BPromise=require(_0x18d0('0x5'));var rp=require(_0x18d0('0x6'));var fs=require('fs');var path=require(_0x18d0('0x7'));var rimraf=require(_0x18d0('0x8'));var config=require(_0x18d0('0x9'));var attributes=require('./whatsappAccount.attributes');module[_0x18d0('0xa')]=function(_0x25839d,_0xab6fc9){return _0x25839d[_0x18d0('0xb')](_0x18d0('0xc'),attributes,{'tableName':_0x18d0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 9a18e67..e2f2d67 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 _0xbc34=['WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','localhost','socket.io-emitter','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x373a56,_0x282e8a){var _0x5a4362=function(_0x327ff0){while(--_0x327ff0){_0x373a56['push'](_0x373a56['shift']());}};_0x5a4362(++_0x282e8a);}(_0xbc34,0x79));var _0x4bc3=function(_0xd008a6,_0x33cb35){_0xd008a6=_0xd008a6-0x0;var _0xe993ce=_0xbc34[_0xd008a6];return _0xe993ce;};'use strict';var _=require(_0x4bc3('0x0'));var util=require(_0x4bc3('0x1'));var moment=require(_0x4bc3('0x2'));var BPromise=require(_0x4bc3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4bc3('0x4'));var db=require(_0x4bc3('0x5'))['db'];var utils=require(_0x4bc3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4bc3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4bc3('0x8')][_0x4bc3('0x9')]({'port':0x232a});config[_0x4bc3('0xa')]=_['defaults'](config[_0x4bc3('0xa')],{'host':_0x4bc3('0xb'),'port':0x18eb});var socket=require(_0x4bc3('0xc'))(new Redis(config[_0x4bc3('0xa')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x477363,_0x2b51ff,_0x272958){return new BPromise(function(_0x4e3670,_0x1f3b93){return client[_0x4bc3('0xd')](_0x477363,_0x272958)[_0x4bc3('0xe')](function(_0x12cce6){logger[_0x4bc3('0xf')](_0x4bc3('0x10'),_0x2b51ff,_0x4bc3('0x11'));logger[_0x4bc3('0x12')](_0x4bc3('0x13'),_0x2b51ff,_0x4bc3('0x11'),JSON[_0x4bc3('0x14')](_0x12cce6));if(_0x12cce6[_0x4bc3('0x15')]){if(_0x12cce6[_0x4bc3('0x15')][_0x4bc3('0x16')]===0x1f4){logger[_0x4bc3('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x2b51ff,_0x12cce6[_0x4bc3('0x15')]['message']);return _0x1f3b93(_0x12cce6['error']['message']);}logger[_0x4bc3('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x2b51ff,_0x12cce6['error'][_0x4bc3('0x17')]);return _0x4e3670(_0x12cce6[_0x4bc3('0x15')][_0x4bc3('0x17')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x2b51ff,_0x4bc3('0x11'));_0x4e3670(_0x12cce6[_0x4bc3('0x18')][_0x4bc3('0x17')]);}})[_0x4bc3('0x19')](function(_0x55df1){logger[_0x4bc3('0x15')](_0x4bc3('0x10'),_0x2b51ff,_0x55df1);_0x1f3b93(_0x55df1);});});}exports[_0x4bc3('0x1a')]=function(_0x5167b2){var _0x416571=this;return new Promise(function(_0x9e8de1,_0x415a1b){return db[_0x4bc3('0x1b')]['find']({'raw':_0x5167b2[_0x4bc3('0x1c')]?_0x5167b2[_0x4bc3('0x1c')][_0x4bc3('0x1d')]===undefined?!![]:![]:!![],'where':_0x5167b2[_0x4bc3('0x1c')]?_0x5167b2[_0x4bc3('0x1c')][_0x4bc3('0x1e')]||null:null,'attributes':_0x5167b2['options']?_0x5167b2['options'][_0x4bc3('0x1f')]||null:null,'include':_0x5167b2[_0x4bc3('0x1c')]?_0x5167b2[_0x4bc3('0x1c')][_0x4bc3('0x20')]?_[_0x4bc3('0x21')](_0x5167b2[_0x4bc3('0x1c')]['include'],function(_0x4f4895){return{'model':db[_0x4f4895['model']],'as':_0x4f4895['as'],'attributes':_0x4f4895[_0x4bc3('0x1f')],'include':_0x4f4895['include']?_[_0x4bc3('0x21')](_0x4f4895[_0x4bc3('0x20')],function(_0x129d1c){return{'model':db[_0x129d1c[_0x4bc3('0x22')]],'as':_0x129d1c['as'],'attributes':_0x129d1c[_0x4bc3('0x1f')],'include':_0x129d1c[_0x4bc3('0x20')]?_[_0x4bc3('0x21')](_0x129d1c['include'],function(_0x14624b){return{'model':db[_0x14624b[_0x4bc3('0x22')]],'as':_0x14624b['as'],'attributes':_0x14624b[_0x4bc3('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cfd2a){logger[_0x4bc3('0xf')](_0x4bc3('0x1a'),_0x5167b2);logger['debug']('ShowWhatsappAccount',_0x5167b2,JSON[_0x4bc3('0x14')](_0x2cfd2a));_0x9e8de1(_0x2cfd2a);})[_0x4bc3('0x19')](function(_0x1f45c3){logger[_0x4bc3('0x15')]('ShowWhatsappAccount',_0x1f45c3[_0x4bc3('0x17')],_0x5167b2);_0x415a1b(_0x416571['error'](0x1f4,_0x1f45c3['message']));});});}; \ No newline at end of file +var _0x120a=['message','catch','ShowWhatsappAccount','options','raw','attributes','include','model','map','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x3a04d5,_0x436db9){var _0x50bc4b=function(_0x21f8f3){while(--_0x21f8f3){_0x3a04d5['push'](_0x3a04d5['shift']());}};_0x50bc4b(++_0x436db9);}(_0x120a,0xa4));var _0xa120=function(_0x4f1789,_0x37fda7){_0x4f1789=_0x4f1789-0x0;var _0x5bb8fe=_0x120a[_0x4f1789];return _0x5bb8fe;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa120('0x0'));var rs=require(_0xa120('0x1'));var fs=require('fs');var Redis=require(_0xa120('0x2'));var db=require(_0xa120('0x3'))['db'];var utils=require(_0xa120('0x4'));var logger=require(_0xa120('0x5'))('rpc');var config=require(_0xa120('0x6'));var jayson=require(_0xa120('0x7'));var client=jayson['client'][_0xa120('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa120('0x9')],{'host':_0xa120('0xa'),'port':0x18eb});var socket=require(_0xa120('0xb'))(new Redis(config[_0xa120('0x9')]));require(_0xa120('0xc'))[_0xa120('0xd')](socket);function respondWithRpcPromise(_0x314328,_0x63ef50,_0x4be317){return new BPromise(function(_0x54e40f,_0x429e57){return client['request'](_0x314328,_0x4be317)[_0xa120('0xe')](function(_0x1084a6){logger[_0xa120('0xf')](_0xa120('0x10'),_0x63ef50,_0xa120('0x11'));logger[_0xa120('0x12')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x63ef50,_0xa120('0x11'),JSON[_0xa120('0x13')](_0x1084a6));if(_0x1084a6['error']){if(_0x1084a6[_0xa120('0x14')][_0xa120('0x15')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x63ef50,_0x1084a6[_0xa120('0x14')][_0xa120('0x16')]);return _0x429e57(_0x1084a6[_0xa120('0x14')][_0xa120('0x16')]);}logger[_0xa120('0x14')](_0xa120('0x10'),_0x63ef50,_0x1084a6['error']['message']);return _0x54e40f(_0x1084a6[_0xa120('0x14')][_0xa120('0x16')]);}else{logger[_0xa120('0xf')](_0xa120('0x10'),_0x63ef50,_0xa120('0x11'));_0x54e40f(_0x1084a6['result'][_0xa120('0x16')]);}})[_0xa120('0x17')](function(_0x68d44e){logger['error'](_0xa120('0x10'),_0x63ef50,_0x68d44e);_0x429e57(_0x68d44e);});});}exports[_0xa120('0x18')]=function(_0xfda576){var _0xa26cf=this;return new Promise(function(_0x4a8809,_0x3db641){return db['WhatsappAccount']['find']({'raw':_0xfda576[_0xa120('0x19')]?_0xfda576[_0xa120('0x19')][_0xa120('0x1a')]===undefined?!![]:![]:!![],'where':_0xfda576[_0xa120('0x19')]?_0xfda576[_0xa120('0x19')]['where']||null:null,'attributes':_0xfda576['options']?_0xfda576['options'][_0xa120('0x1b')]||null:null,'include':_0xfda576['options']?_0xfda576[_0xa120('0x19')][_0xa120('0x1c')]?_['map'](_0xfda576[_0xa120('0x19')][_0xa120('0x1c')],function(_0x209bcd){return{'model':db[_0x209bcd[_0xa120('0x1d')]],'as':_0x209bcd['as'],'attributes':_0x209bcd[_0xa120('0x1b')],'include':_0x209bcd[_0xa120('0x1c')]?_['map'](_0x209bcd[_0xa120('0x1c')],function(_0x3a3f8e){return{'model':db[_0x3a3f8e[_0xa120('0x1d')]],'as':_0x3a3f8e['as'],'attributes':_0x3a3f8e[_0xa120('0x1b')],'include':_0x3a3f8e[_0xa120('0x1c')]?_[_0xa120('0x1e')](_0x3a3f8e[_0xa120('0x1c')],function(_0x4b4104){return{'model':db[_0x4b4104[_0xa120('0x1d')]],'as':_0x4b4104['as'],'attributes':_0x4b4104['attributes']};}):[]};}):[]};}):[]:[]})[_0xa120('0xe')](function(_0x3726ba){logger['info'](_0xa120('0x18'),_0xfda576);logger['debug'](_0xa120('0x18'),_0xfda576,JSON[_0xa120('0x13')](_0x3726ba));_0x4a8809(_0x3726ba);})[_0xa120('0x17')](function(_0x4a0cce){logger[_0xa120('0x14')](_0xa120('0x18'),_0x4a0cce[_0xa120('0x16')],_0xfda576);_0x3db641(_0xa26cf[_0xa120('0x14')](0x1f4,_0x4a0cce[_0xa120('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 6716d12..7431b59 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 _0x329c=['update','emit','removeListener','register','length','whatsappAccount:','save','remove'];(function(_0x12d538,_0x43701f){var _0x2d9436=function(_0x24e203){while(--_0x24e203){_0x12d538['push'](_0x12d538['shift']());}};_0x2d9436(++_0x43701f);}(_0x329c,0x166));var _0xc329=function(_0x366e99,_0x15d82d){_0x366e99=_0x366e99-0x0;var _0x180bbe=_0x329c[_0x366e99];return _0x180bbe;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xc329('0x0'),_0xc329('0x1'),_0xc329('0x2')];function createListener(_0x528730,_0x240038){return function(_0xc2be2b){_0x240038[_0xc329('0x3')](_0x528730,_0xc2be2b);};}function removeListener(_0x19eac6,_0x23f561){return function(){WhatsappAccountEvents[_0xc329('0x4')](_0x19eac6,_0x23f561);};}exports[_0xc329('0x5')]=function(_0x219324){for(var _0x23c8e1=0x0,_0x3a9ed9=events[_0xc329('0x6')];_0x23c8e1<_0x3a9ed9;_0x23c8e1++){var _0x26f53e=events[_0x23c8e1];var _0x2b90b5=createListener(_0xc329('0x7')+_0x26f53e,_0x219324);WhatsappAccountEvents['on'](_0x26f53e,_0x2b90b5);}}; \ No newline at end of file +var _0x1f9f=['length','whatsappAccount:','remove','emit','removeListener','register'];(function(_0x18f90e,_0x25a7f8){var _0x11cb87=function(_0x204815){while(--_0x204815){_0x18f90e['push'](_0x18f90e['shift']());}};_0x11cb87(++_0x25a7f8);}(_0x1f9f,0x1e8));var _0xf1f9=function(_0x4067ac,_0x363603){_0x4067ac=_0x4067ac-0x0;var _0x53d74d=_0x1f9f[_0x4067ac];return _0x53d74d;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0xf1f9('0x0'),'update'];function createListener(_0x363fad,_0xd812dd){return function(_0x350102){_0xd812dd[_0xf1f9('0x1')](_0x363fad,_0x350102);};}function removeListener(_0x248291,_0x525c69){return function(){WhatsappAccountEvents[_0xf1f9('0x2')](_0x248291,_0x525c69);};}exports[_0xf1f9('0x3')]=function(_0x14d2a1){for(var _0x116b09=0x0,_0x1e4d4a=events[_0xf1f9('0x4')];_0x116b09<_0x1e4d4a;_0x116b09++){var _0x5ecbf8=events[_0x116b09];var _0x5b9daa=createListener(_0xf1f9('0x5')+_0x5ecbf8,_0x14d2a1);WhatsappAccountEvents['on'](_0x5ecbf8,_0x5b9daa);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index f7b8f95..c0edc0f 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 _0x0881=['show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','index','get','/:id'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x0881,0x16d));var _0x1088=function(_0x352108,_0xb5cdc3){_0x352108=_0x352108-0x0;var _0x2c901c=_0x0881[_0x352108];return _0x2c901c;};'use strict';var multer=require(_0x1088('0x0'));var util=require(_0x1088('0x1'));var path=require(_0x1088('0x2'));var timeout=require('connect-timeout');var express=require(_0x1088('0x3'));var router=express[_0x1088('0x4')]();var fs_extra=require(_0x1088('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1088('0x6'));var config=require(_0x1088('0x7'));var controller=require(_0x1088('0x8'));router['get']('/',auth[_0x1088('0x9')](),controller[_0x1088('0xa')]);router[_0x1088('0xb')](_0x1088('0xc'),auth['isAuthenticated'](),controller[_0x1088('0xd')]);router[_0x1088('0xe')]('/',auth[_0x1088('0x9')](),controller[_0x1088('0xf')]);router[_0x1088('0x10')](_0x1088('0xc'),auth[_0x1088('0x9')](),controller[_0x1088('0x11')]);router[_0x1088('0x12')]('/:id',auth[_0x1088('0x9')](),controller[_0x1088('0x13')]);module[_0x1088('0x14')]=router; \ No newline at end of file +var _0xecc6=['index','/:id','show','post','create','put','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated'];(function(_0x590ef7,_0x175f08){var _0x4c2634=function(_0xf94570){while(--_0xf94570){_0x590ef7['push'](_0x590ef7['shift']());}};_0x4c2634(++_0x175f08);}(_0xecc6,0x172));var _0x6ecc=function(_0x20cca4,_0x5f456f){_0x20cca4=_0x20cca4-0x0;var _0x100fa4=_0xecc6[_0x20cca4];return _0x100fa4;};'use strict';var multer=require('multer');var util=require(_0x6ecc('0x0'));var path=require(_0x6ecc('0x1'));var timeout=require('connect-timeout');var express=require(_0x6ecc('0x2'));var router=express[_0x6ecc('0x3')]();var fs_extra=require(_0x6ecc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6ecc('0x5'));var config=require(_0x6ecc('0x6'));var controller=require(_0x6ecc('0x7'));router[_0x6ecc('0x8')]('/',auth[_0x6ecc('0x9')](),controller[_0x6ecc('0xa')]);router['get'](_0x6ecc('0xb'),auth[_0x6ecc('0x9')](),controller[_0x6ecc('0xc')]);router[_0x6ecc('0xd')]('/',auth[_0x6ecc('0x9')](),controller[_0x6ecc('0xe')]);router[_0x6ecc('0xf')](_0x6ecc('0xb'),auth[_0x6ecc('0x9')](),controller['update']);router[_0x6ecc('0x10')](_0x6ecc('0xb'),auth[_0x6ecc('0x9')](),controller[_0x6ecc('0x11')]);module[_0x6ecc('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 3f6a354..48e2eb8 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 _0x262e=['sequelize','exports','noop','TEXT','STRING','*,*,*,*'];(function(_0x5c11d9,_0x1fa92a){var _0x49eb41=function(_0x144194){while(--_0x144194){_0x5c11d9['push'](_0x5c11d9['shift']());}};_0x49eb41(++_0x1fa92a);}(_0x262e,0x192));var _0xe262=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x262e[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require(_0xe262('0x0'));module[_0xe262('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe262('0x2')},'appdata':{'type':Sequelize[_0xe262('0x3')]()},'description':{'type':Sequelize[_0xe262('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xe262('0x5')}}; \ No newline at end of file +var _0xed3d=['STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x10b304,_0x3f188e){var _0x10fb78=function(_0x5079b1){while(--_0x5079b1){_0x10b304['push'](_0x10b304['shift']());}};_0x10fb78(++_0x3f188e);}(_0xed3d,0x1ea));var _0xded3=function(_0x482283,_0x45de3a){_0x482283=_0x482283-0x0;var _0x332c7e=_0xed3d[_0x482283];return _0x332c7e;};'use strict';var Sequelize=require(_0xded3('0x0'));module[_0xded3('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xded3('0x2')],'allowNull':![],'defaultValue':_0xded3('0x3')},'appdata':{'type':Sequelize[_0xded3('0x4')]()},'description':{'type':Sequelize[_0xded3('0x2')]},'interval':{'type':Sequelize[_0xded3('0x2')],'defaultValue':_0xded3('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index ab22a8b..3223e7b 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 _0x82f8=['stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','keys','length','includeAll','options','find','create','body','update','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x82f8,0x157));var _0x882f=function(_0x1d6929,_0x177ed6){_0x1d6929=_0x1d6929-0x0;var _0x553adf=_0x82f8[_0x1d6929];return _0x553adf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x882f('0x0'));var zipdir=require(_0x882f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x882f('0x2'));var moment=require(_0x882f('0x3'));var BPromise=require(_0x882f('0x4'));var Mustache=require(_0x882f('0x5'));var util=require(_0x882f('0x6'));var path=require(_0x882f('0x7'));var sox=require(_0x882f('0x8'));var csv=require(_0x882f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x882f('0xa'));var squel=require(_0x882f('0xb'));var crypto=require(_0x882f('0xc'));var jsforce=require(_0x882f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x882f('0x9'));var querystring=require('querystring');var Papa=require(_0x882f('0xe'));var Redis=require('ioredis');var authService=require(_0x882f('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x882f('0x10'));var logger=require(_0x882f('0x11'))(_0x882f('0x12'));var utils=require(_0x882f('0x13'));var config=require(_0x882f('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x188e41,_0x1b5c5d){_0x1b5c5d=_0x1b5c5d||0xcc;return function(_0x1ffbde){if(_0x1ffbde){return _0x188e41[_0x882f('0x15')](_0x1b5c5d);}return _0x188e41[_0x882f('0x16')](_0x1b5c5d)[_0x882f('0x17')]();};}function respondWithResult(_0x39f2bb,_0x56034c){_0x56034c=_0x56034c||0xc8;return function(_0x33740b){if(_0x33740b){return _0x39f2bb[_0x882f('0x16')](_0x56034c)[_0x882f('0x18')](_0x33740b);}};}function respondWithFilteredResult(_0x167a0,_0x4cee2a){return function(_0x4ca189){if(_0x4ca189){var _0x4e9b6e=typeof _0x4cee2a[_0x882f('0x19')]===_0x882f('0x1a')&&typeof _0x4cee2a[_0x882f('0x1b')]===_0x882f('0x1a');var _0x3f72c2=_0x4ca189[_0x882f('0x1c')];var _0x3bd47c=_0x4e9b6e?0x0:_0x4cee2a[_0x882f('0x19')];var _0x544fd5=_0x4e9b6e?_0x4ca189[_0x882f('0x1c')]:_0x4cee2a['offset']+_0x4cee2a['limit'];var _0xaa6bcb;if(_0x544fd5>=_0x3f72c2){_0x544fd5=_0x3f72c2;_0xaa6bcb=0xc8;}else{_0xaa6bcb=0xce;}_0x167a0[_0x882f('0x16')](_0xaa6bcb);return _0x167a0[_0x882f('0x1d')](_0x882f('0x1e'),_0x3bd47c+'-'+_0x544fd5+'/'+_0x3f72c2)['json'](_0x4ca189);}return null;};}function patchUpdates(_0x3cfc4e){return function(_0x14792c){try{jsonpatch[_0x882f('0x1f')](_0x14792c,_0x3cfc4e,!![]);}catch(_0x421aaf){return BPromise[_0x882f('0x20')](_0x421aaf);}return _0x14792c[_0x882f('0x21')]();};}function saveUpdates(_0x3ee80d,_0x1dd9e4){return function(_0x251ed0){if(_0x251ed0){return _0x251ed0['update'](_0x3ee80d)['then'](function(_0x4c0a93){return _0x4c0a93;});}return null;};}function removeEntity(_0x3705e8,_0x2c44e5){return function(_0x11298b){if(_0x11298b){return _0x11298b[_0x882f('0x22')]()[_0x882f('0x23')](function(){_0x3705e8[_0x882f('0x16')](0xcc)[_0x882f('0x17')]();});}};}function handleEntityNotFound(_0x2d6f58,_0x1bfc1d){return function(_0x4f24f1){if(!_0x4f24f1){_0x2d6f58[_0x882f('0x15')](0x194);}return _0x4f24f1;};}function handleError(_0x2a8605,_0x51d359){_0x51d359=_0x51d359||0x1f4;return function(_0x48c52b){logger[_0x882f('0x24')](_0x48c52b[_0x882f('0x25')]);if(_0x48c52b[_0x882f('0x26')]){delete _0x48c52b['name'];}_0x2a8605[_0x882f('0x16')](_0x51d359)[_0x882f('0x27')](_0x48c52b);};}exports[_0x882f('0x28')]=function(_0x29fc23,_0x58d4ce){var _0x41605c={},_0x31d0b7={},_0x48431={'count':0x0,'rows':[]};var _0x1cb5e3=_[_0x882f('0x29')](db[_0x882f('0x2a')][_0x882f('0x2b')],function(_0x862f1b){return{'name':_0x862f1b[_0x882f('0x2c')],'type':_0x862f1b[_0x882f('0x2d')][_0x882f('0x2e')]};});_0x31d0b7[_0x882f('0x2f')]=_[_0x882f('0x29')](_0x1cb5e3,'name');_0x31d0b7[_0x882f('0x30')]=_['keys'](_0x29fc23[_0x882f('0x30')]);_0x31d0b7['filters']=_['intersection'](_0x31d0b7[_0x882f('0x2f')],_0x31d0b7[_0x882f('0x30')]);_0x41605c['attributes']=_[_0x882f('0x31')](_0x31d0b7[_0x882f('0x2f')],qs[_0x882f('0x32')](_0x29fc23[_0x882f('0x30')][_0x882f('0x32')]));_0x41605c[_0x882f('0x33')]=_0x41605c['attributes']['length']?_0x41605c['attributes']:_0x31d0b7[_0x882f('0x2f')];if(!_0x29fc23['query'][_0x882f('0x34')](_0x882f('0x35'))){_0x41605c['limit']=qs['limit'](_0x29fc23[_0x882f('0x30')][_0x882f('0x1b')]);_0x41605c['offset']=qs[_0x882f('0x19')](_0x29fc23[_0x882f('0x30')][_0x882f('0x19')]);}_0x41605c[_0x882f('0x36')]=qs[_0x882f('0x37')](_0x29fc23['query'][_0x882f('0x37')]);_0x41605c[_0x882f('0x38')]=qs[_0x882f('0x39')](_[_0x882f('0x3a')](_0x29fc23[_0x882f('0x30')],_0x31d0b7[_0x882f('0x39')]),_0x1cb5e3);if(_0x29fc23[_0x882f('0x30')][_0x882f('0x3b')]){_0x41605c['where']=_[_0x882f('0x3c')](_0x41605c[_0x882f('0x38')],{'$or':_[_0x882f('0x29')](_0x1cb5e3,function(_0x1dd865){if(_0x1dd865[_0x882f('0x2d')]!==_0x882f('0x3d')){var _0x281e89={};_0x281e89[_0x1dd865[_0x882f('0x26')]]={'$like':'%'+_0x29fc23['query'][_0x882f('0x3b')]+'%'};return _0x281e89;}})});}_0x41605c=_[_0x882f('0x3c')]({},_0x41605c,_0x29fc23['options']);var _0x2a02f9={'where':_0x41605c[_0x882f('0x38')]};return db[_0x882f('0x2a')]['count'](_0x2a02f9)[_0x882f('0x23')](function(_0x9210e3){_0x48431[_0x882f('0x1c')]=_0x9210e3;if(_0x29fc23['query']['includeAll']){_0x41605c[_0x882f('0x3e')]=[{'all':!![]}];}return db[_0x882f('0x2a')][_0x882f('0x3f')](_0x41605c);})[_0x882f('0x23')](function(_0x45b848){_0x48431[_0x882f('0x40')]=_0x45b848;return _0x48431;})[_0x882f('0x23')](respondWithFilteredResult(_0x58d4ce,_0x41605c))[_0x882f('0x41')](handleError(_0x58d4ce,null));};exports[_0x882f('0x42')]=function(_0xa8e935,_0x184e92){var _0x4fbd9b={'raw':!![],'where':{'id':_0xa8e935[_0x882f('0x43')]['id']}},_0xb34eb4={};_0xb34eb4[_0x882f('0x2f')]=_[_0x882f('0x44')](db[_0x882f('0x2a')][_0x882f('0x2b')]);_0xb34eb4[_0x882f('0x30')]=_[_0x882f('0x44')](_0xa8e935[_0x882f('0x30')]);_0xb34eb4['filters']=_['intersection'](_0xb34eb4['model'],_0xb34eb4[_0x882f('0x30')]);_0x4fbd9b['attributes']=_['intersection'](_0xb34eb4[_0x882f('0x2f')],qs[_0x882f('0x32')](_0xa8e935[_0x882f('0x30')][_0x882f('0x32')]));_0x4fbd9b['attributes']=_0x4fbd9b[_0x882f('0x33')][_0x882f('0x45')]?_0x4fbd9b[_0x882f('0x33')]:_0xb34eb4['model'];if(_0xa8e935[_0x882f('0x30')][_0x882f('0x46')]){_0x4fbd9b[_0x882f('0x3e')]=[{'all':!![]}];}_0x4fbd9b=_[_0x882f('0x3c')]({},_0x4fbd9b,_0xa8e935[_0x882f('0x47')]);return db['WhatsappApplication'][_0x882f('0x48')](_0x4fbd9b)[_0x882f('0x23')](handleEntityNotFound(_0x184e92,null))['then'](respondWithResult(_0x184e92,null))[_0x882f('0x41')](handleError(_0x184e92,null));};exports[_0x882f('0x49')]=function(_0x11dacc,_0x4e6175){return db[_0x882f('0x2a')]['create'](_0x11dacc[_0x882f('0x4a')],{})[_0x882f('0x23')](respondWithResult(_0x4e6175,0xc9))[_0x882f('0x41')](handleError(_0x4e6175,null));};exports[_0x882f('0x4b')]=function(_0x3b2f7b,_0x1b89cd){if(_0x3b2f7b[_0x882f('0x4a')]['id']){delete _0x3b2f7b[_0x882f('0x4a')]['id'];}return db[_0x882f('0x2a')]['find']({'where':{'id':_0x3b2f7b[_0x882f('0x43')]['id']}})[_0x882f('0x23')](handleEntityNotFound(_0x1b89cd,null))[_0x882f('0x23')](saveUpdates(_0x3b2f7b['body'],null))['then'](respondWithResult(_0x1b89cd,null))[_0x882f('0x41')](handleError(_0x1b89cd,null));};exports[_0x882f('0x22')]=function(_0x3d2947,_0x2deeea){return db[_0x882f('0x2a')][_0x882f('0x48')]({'where':{'id':_0x3d2947[_0x882f('0x43')]['id']}})['then'](handleEntityNotFound(_0x2deeea,null))[_0x882f('0x23')](removeEntity(_0x2deeea,null))['catch'](handleError(_0x2deeea,null));}; \ No newline at end of file +var _0x9219=['includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','params','request-promise','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','map','WhatsappApplication','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9219,0x19e));var _0x9921=function(_0x4efb0c,_0x235e83){_0x4efb0c=_0x4efb0c-0x0;var _0xe66fc4=_0x9219[_0x4efb0c];return _0xe66fc4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9921('0x0'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9921('0x1'));var util=require('util');var path=require('path');var sox=require(_0x9921('0x2'));var csv=require(_0x9921('0x3'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9921('0x4'));var _=require(_0x9921('0x5'));var squel=require(_0x9921('0x6'));var crypto=require(_0x9921('0x7'));var jsforce=require(_0x9921('0x8'));var deskjs=require(_0x9921('0x9'));var toCsv=require(_0x9921('0x3'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9921('0xa'));var qs=require('../../components/parsers/qs');var as=require(_0x9921('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9921('0xc'));var utils=require(_0x9921('0xd'));var config=require(_0x9921('0xe'));var licenseUtil=require(_0x9921('0xf'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x415387,_0x4f1f14){_0x4f1f14=_0x4f1f14||0xcc;return function(_0x484827){if(_0x484827){return _0x415387[_0x9921('0x10')](_0x4f1f14);}return _0x415387[_0x9921('0x11')](_0x4f1f14)['end']();};}function respondWithResult(_0x38b5cd,_0x3840eb){_0x3840eb=_0x3840eb||0xc8;return function(_0x51638f){if(_0x51638f){return _0x38b5cd[_0x9921('0x11')](_0x3840eb)[_0x9921('0x12')](_0x51638f);}};}function respondWithFilteredResult(_0x12def0,_0x5114c6){return function(_0x20fca1){if(_0x20fca1){var _0x258116=typeof _0x5114c6[_0x9921('0x13')]==='undefined'&&typeof _0x5114c6[_0x9921('0x14')]===_0x9921('0x15');var _0x47cd77=_0x20fca1[_0x9921('0x16')];var _0x566838=_0x258116?0x0:_0x5114c6[_0x9921('0x13')];var _0x291874=_0x258116?_0x20fca1[_0x9921('0x16')]:_0x5114c6['offset']+_0x5114c6[_0x9921('0x14')];var _0x823824;if(_0x291874>=_0x47cd77){_0x291874=_0x47cd77;_0x823824=0xc8;}else{_0x823824=0xce;}_0x12def0[_0x9921('0x11')](_0x823824);return _0x12def0[_0x9921('0x17')](_0x9921('0x18'),_0x566838+'-'+_0x291874+'/'+_0x47cd77)[_0x9921('0x12')](_0x20fca1);}return null;};}function patchUpdates(_0x47cda8){return function(_0x26d351){try{jsonpatch[_0x9921('0x19')](_0x26d351,_0x47cda8,!![]);}catch(_0x27f246){return BPromise[_0x9921('0x1a')](_0x27f246);}return _0x26d351['save']();};}function saveUpdates(_0x24cc66,_0x3d1f40){return function(_0x24023b){if(_0x24023b){return _0x24023b[_0x9921('0x1b')](_0x24cc66)[_0x9921('0x1c')](function(_0x32c5f3){return _0x32c5f3;});}return null;};}function removeEntity(_0x7a2c31,_0x2105be){return function(_0x2bc3f7){if(_0x2bc3f7){return _0x2bc3f7[_0x9921('0x1d')]()['then'](function(){_0x7a2c31['status'](0xcc)[_0x9921('0x1e')]();});}};}function handleEntityNotFound(_0x1e7076,_0x51e115){return function(_0x5e0da7){if(!_0x5e0da7){_0x1e7076[_0x9921('0x10')](0x194);}return _0x5e0da7;};}function handleError(_0x2be1cd,_0x40eb38){_0x40eb38=_0x40eb38||0x1f4;return function(_0xfa470){logger['error'](_0xfa470[_0x9921('0x1f')]);if(_0xfa470['name']){delete _0xfa470[_0x9921('0x20')];}_0x2be1cd[_0x9921('0x11')](_0x40eb38)[_0x9921('0x21')](_0xfa470);};}exports['index']=function(_0x5e5c01,_0x59620e){var _0x115ee9={},_0x3a36c5={},_0x1607e6={'count':0x0,'rows':[]};var _0x486446=_[_0x9921('0x22')](db[_0x9921('0x23')]['rawAttributes'],function(_0x2fb165){return{'name':_0x2fb165[_0x9921('0x24')],'type':_0x2fb165[_0x9921('0x25')][_0x9921('0x26')]};});_0x3a36c5[_0x9921('0x27')]=_[_0x9921('0x22')](_0x486446,_0x9921('0x20'));_0x3a36c5[_0x9921('0x28')]=_['keys'](_0x5e5c01[_0x9921('0x28')]);_0x3a36c5[_0x9921('0x29')]=_['intersection'](_0x3a36c5[_0x9921('0x27')],_0x3a36c5[_0x9921('0x28')]);_0x115ee9[_0x9921('0x2a')]=_[_0x9921('0x2b')](_0x3a36c5[_0x9921('0x27')],qs[_0x9921('0x2c')](_0x5e5c01[_0x9921('0x28')]['fields']));_0x115ee9[_0x9921('0x2a')]=_0x115ee9[_0x9921('0x2a')][_0x9921('0x2d')]?_0x115ee9[_0x9921('0x2a')]:_0x3a36c5[_0x9921('0x27')];if(!_0x5e5c01[_0x9921('0x28')]['hasOwnProperty'](_0x9921('0x2e'))){_0x115ee9['limit']=qs['limit'](_0x5e5c01[_0x9921('0x28')][_0x9921('0x14')]);_0x115ee9[_0x9921('0x13')]=qs['offset'](_0x5e5c01[_0x9921('0x28')][_0x9921('0x13')]);}_0x115ee9[_0x9921('0x2f')]=qs['sort'](_0x5e5c01['query'][_0x9921('0x30')]);_0x115ee9[_0x9921('0x31')]=qs[_0x9921('0x29')](_[_0x9921('0x32')](_0x5e5c01[_0x9921('0x28')],_0x3a36c5[_0x9921('0x29')]),_0x486446);if(_0x5e5c01[_0x9921('0x28')][_0x9921('0x33')]){_0x115ee9[_0x9921('0x31')]=_['merge'](_0x115ee9[_0x9921('0x31')],{'$or':_[_0x9921('0x22')](_0x486446,function(_0x28ef0a){if(_0x28ef0a['type']!==_0x9921('0x34')){var _0x31b6b2={};_0x31b6b2[_0x28ef0a[_0x9921('0x20')]]={'$like':'%'+_0x5e5c01['query'][_0x9921('0x33')]+'%'};return _0x31b6b2;}})});}_0x115ee9=_[_0x9921('0x35')]({},_0x115ee9,_0x5e5c01[_0x9921('0x36')]);var _0x5e6487={'where':_0x115ee9[_0x9921('0x31')]};return db[_0x9921('0x23')][_0x9921('0x16')](_0x5e6487)['then'](function(_0x47a1c6){_0x1607e6[_0x9921('0x16')]=_0x47a1c6;if(_0x5e5c01['query'][_0x9921('0x37')]){_0x115ee9[_0x9921('0x38')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x9921('0x39')](_0x115ee9);})[_0x9921('0x1c')](function(_0x2ecf47){_0x1607e6[_0x9921('0x3a')]=_0x2ecf47;return _0x1607e6;})[_0x9921('0x1c')](respondWithFilteredResult(_0x59620e,_0x115ee9))[_0x9921('0x3b')](handleError(_0x59620e,null));};exports[_0x9921('0x3c')]=function(_0x376b19,_0x4f8ff6){var _0x59de7f={'raw':!![],'where':{'id':_0x376b19['params']['id']}},_0x4286f9={};_0x4286f9[_0x9921('0x27')]=_[_0x9921('0x3d')](db[_0x9921('0x23')][_0x9921('0x3e')]);_0x4286f9[_0x9921('0x28')]=_['keys'](_0x376b19[_0x9921('0x28')]);_0x4286f9[_0x9921('0x29')]=_[_0x9921('0x2b')](_0x4286f9[_0x9921('0x27')],_0x4286f9[_0x9921('0x28')]);_0x59de7f['attributes']=_[_0x9921('0x2b')](_0x4286f9[_0x9921('0x27')],qs['fields'](_0x376b19[_0x9921('0x28')][_0x9921('0x2c')]));_0x59de7f[_0x9921('0x2a')]=_0x59de7f['attributes'][_0x9921('0x2d')]?_0x59de7f[_0x9921('0x2a')]:_0x4286f9[_0x9921('0x27')];if(_0x376b19[_0x9921('0x28')][_0x9921('0x37')]){_0x59de7f[_0x9921('0x38')]=[{'all':!![]}];}_0x59de7f=_[_0x9921('0x35')]({},_0x59de7f,_0x376b19[_0x9921('0x36')]);return db['WhatsappApplication'][_0x9921('0x3f')](_0x59de7f)[_0x9921('0x1c')](handleEntityNotFound(_0x4f8ff6,null))[_0x9921('0x1c')](respondWithResult(_0x4f8ff6,null))['catch'](handleError(_0x4f8ff6,null));};exports[_0x9921('0x40')]=function(_0x783704,_0x1f3faa){return db['WhatsappApplication'][_0x9921('0x40')](_0x783704['body'],{})[_0x9921('0x1c')](respondWithResult(_0x1f3faa,0xc9))[_0x9921('0x3b')](handleError(_0x1f3faa,null));};exports[_0x9921('0x1b')]=function(_0x4af7ea,_0x29a1e4){if(_0x4af7ea[_0x9921('0x41')]['id']){delete _0x4af7ea['body']['id'];}return db[_0x9921('0x23')][_0x9921('0x3f')]({'where':{'id':_0x4af7ea['params']['id']}})[_0x9921('0x1c')](handleEntityNotFound(_0x29a1e4,null))[_0x9921('0x1c')](saveUpdates(_0x4af7ea['body'],null))[_0x9921('0x1c')](respondWithResult(_0x29a1e4,null))[_0x9921('0x3b')](handleError(_0x29a1e4,null));};exports[_0x9921('0x1d')]=function(_0x4c0639,_0x52c7fe){return db['WhatsappApplication'][_0x9921('0x3f')]({'where':{'id':_0x4c0639[_0x9921('0x42')]['id']}})[_0x9921('0x1c')](handleEntityNotFound(_0x52c7fe,null))[_0x9921('0x1c')](removeEntity(_0x52c7fe,null))[_0x9921('0x3b')](handleError(_0x52c7fe,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index fa94159..d54143e 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 _0xdd0c=['./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x322d81,_0x680f9b){var _0x58a9fe=function(_0x4ea953){while(--_0x4ea953){_0x322d81['push'](_0x322d81['shift']());}};_0x58a9fe(++_0x680f9b);}(_0xdd0c,0x165));var _0xcdd0=function(_0x3f3300,_0x57127b){_0x3f3300=_0x3f3300-0x0;var _0x3e4971=_0xdd0c[_0x3f3300];return _0x3e4971;};'use strict';var _=require('lodash');var util=require(_0xcdd0('0x0'));var logger=require(_0xcdd0('0x1'))(_0xcdd0('0x2'));var moment=require('moment');var BPromise=require(_0xcdd0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcdd0('0x4'));var rimraf=require(_0xcdd0('0x5'));var config=require(_0xcdd0('0x6'));var attributes=require(_0xcdd0('0x7'));module[_0xcdd0('0x8')]=function(_0x5ae472,_0x2b33fc){return _0x5ae472[_0xcdd0('0x9')](_0xcdd0('0xa'),attributes,{'tableName':_0xcdd0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcdd0('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8ce1=['WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define'];(function(_0xa11023,_0x1509fe){var _0x5ec706=function(_0x582127){while(--_0x582127){_0xa11023['push'](_0xa11023['shift']());}};_0x5ec706(++_0x1509fe);}(_0x8ce1,0x183));var _0x18ce=function(_0x58d596,_0x8fa3c){_0x58d596=_0x58d596-0x0;var _0x34c840=_0x8ce1[_0x58d596];return _0x34c840;};'use strict';var _=require(_0x18ce('0x0'));var util=require(_0x18ce('0x1'));var logger=require(_0x18ce('0x2'))(_0x18ce('0x3'));var moment=require(_0x18ce('0x4'));var BPromise=require(_0x18ce('0x5'));var rp=require(_0x18ce('0x6'));var fs=require('fs');var path=require(_0x18ce('0x7'));var rimraf=require(_0x18ce('0x8'));var config=require(_0x18ce('0x9'));var attributes=require(_0x18ce('0xa'));module[_0x18ce('0xb')]=function(_0x13ff9d,_0x36f8db){return _0x13ff9d[_0x18ce('0xc')](_0x18ce('0xd'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x18ce('0xe'),'collate':_0x18ce('0xf')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index f0ce8e5..dad092c 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 _0x55e0=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x55e0,0xdc));var _0x055e=function(_0x405d00,_0x395604){_0x405d00=_0x405d00-0x0;var _0xfa3103=_0x55e0[_0x405d00];return _0xfa3103;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4384ff,_0x4a442e,_0x8e7824){return new BPromise(function(_0x3c4cf,_0x376618){return client[_0x055e('0xa')](_0x4384ff,_0x8e7824)[_0x055e('0xb')](function(_0x49540c){logger[_0x055e('0xc')](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));logger[_0x055e('0xf')](_0x055e('0x10'),_0x4a442e,'request\x20sent',JSON['stringify'](_0x49540c));if(_0x49540c[_0x055e('0x11')]){if(_0x49540c['error'][_0x055e('0x12')]===0x1f4){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x376618(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}logger['error'](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x3c4cf(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}else{logger['info'](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));_0x3c4cf(_0x49540c[_0x055e('0x14')]['message']);}})[_0x055e('0x15')](function(_0x2c377c){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x2c377c);_0x376618(_0x2c377c);});});} \ No newline at end of file +var _0xb821=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','ioredis'];(function(_0x11f8ab,_0x14c79c){var _0xe10e93=function(_0x4b4c66){while(--_0x4b4c66){_0x11f8ab['push'](_0x11f8ab['shift']());}};_0xe10e93(++_0x14c79c);}(_0xb821,0xa7));var _0x1b82=function(_0x462073,_0x218a1e){_0x462073=_0x462073-0x0;var _0x27e3dd=_0xb821[_0x462073];return _0x27e3dd;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b82('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b82('0x3'))(_0x1b82('0x4'));var config=require(_0x1b82('0x5'));var jayson=require(_0x1b82('0x6'));var client=jayson['client'][_0x1b82('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x192434,_0x202a5f,_0x3632dd){return new BPromise(function(_0x18f45f,_0x7b87e8){return client[_0x1b82('0x8')](_0x192434,_0x3632dd)[_0x1b82('0x9')](function(_0x141673){logger['info'](_0x1b82('0xa'),_0x202a5f,_0x1b82('0xb'));logger[_0x1b82('0xc')](_0x1b82('0xd'),_0x202a5f,_0x1b82('0xb'),JSON[_0x1b82('0xe')](_0x141673));if(_0x141673[_0x1b82('0xf')]){if(_0x141673[_0x1b82('0xf')]['code']===0x1f4){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);return _0x7b87e8(_0x141673['error'][_0x1b82('0x10')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x202a5f,_0x141673[_0x1b82('0xf')]['message']);return _0x18f45f(_0x141673[_0x1b82('0xf')][_0x1b82('0x10')]);}else{logger['info'](_0x1b82('0xa'),_0x202a5f,'request\x20sent');_0x18f45f(_0x141673['result'][_0x1b82('0x10')]);}})['catch'](function(_0x111247){logger[_0x1b82('0xf')](_0x1b82('0xa'),_0x202a5f,_0x111247);_0x7b87e8(_0x111247);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index aef92a3..fb4a54d 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 _0xb138=['/:id/download','download','post','create','/:id/tags','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','update','delete','tracked','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','get'];(function(_0x14e833,_0x1ffc79){var _0x31195d=function(_0xbcfb12){while(--_0xbcfb12){_0x14e833['push'](_0x14e833['shift']());}};_0x31195d(++_0x1ffc79);}(_0xb138,0x1dd));var _0x8b13=function(_0x32fe3b,_0x359cdd){_0x32fe3b=_0x32fe3b-0x0;var _0x411e3d=_0xb138[_0x32fe3b];return _0x411e3d;};'use strict';var multer=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var path=require(_0x8b13('0x2'));var timeout=require(_0x8b13('0x3'));var express=require(_0x8b13('0x4'));var router=express[_0x8b13('0x5')]();var fs_extra=require(_0x8b13('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var controller=require(_0x8b13('0x9'));router['get']('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0xb')]);router['get'](_0x8b13('0xc'),auth[_0x8b13('0xa')](),controller[_0x8b13('0xd')]);router['get'](_0x8b13('0xe'),auth[_0x8b13('0xa')](),controller['show']);router['get'](_0x8b13('0xf'),auth[_0x8b13('0xa')](),controller[_0x8b13('0x10')]);router[_0x8b13('0x11')](_0x8b13('0x12'),auth['isAuthenticated'](),controller[_0x8b13('0x13')]);router[_0x8b13('0x14')]('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0x15')]);router[_0x8b13('0x14')](_0x8b13('0xf'),auth['isAuthenticated'](),controller['addMessage']);router[_0x8b13('0x14')](_0x8b13('0x16'),auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0x8b13('0x17')),controller[_0x8b13('0x18')]);router[_0x8b13('0x19')](_0x8b13('0xe'),auth[_0x8b13('0xa')](),interaction['tracked'](_0x8b13('0x1a'),_0x8b13('0x1b')),controller[_0x8b13('0x1c')]);router[_0x8b13('0x1d')](_0x8b13('0xe'),auth[_0x8b13('0xa')](),interaction[_0x8b13('0x1e')](_0x8b13('0x1a'),'whatsappinteraction:destroy'),controller['destroy']);router[_0x8b13('0x1d')](_0x8b13('0x16'),auth[_0x8b13('0xa')](),controller[_0x8b13('0x1f')]);module[_0x8b13('0x20')]=router; \ No newline at end of file +var _0xe3da=['post','create','addMessage','/:id/tags','tracked','whatsapp','addTags','put','/:id','update','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages'];(function(_0xac8f37,_0x421df5){var _0x32b646=function(_0x671212){while(--_0x671212){_0xac8f37['push'](_0xac8f37['shift']());}};_0x32b646(++_0x421df5);}(_0xe3da,0x1cd));var _0xae3d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe3da[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var fs_extra=require(_0xae3d('0x6'));var auth=require(_0xae3d('0x7'));var interaction=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var controller=require(_0xae3d('0xa'));router[_0xae3d('0xb')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0xd')]);router[_0xae3d('0xb')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0xf')]);router[_0xae3d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xae3d('0x10')]);router[_0xae3d('0xb')](_0xae3d('0x11'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x12')]);router[_0xae3d('0xb')]('/:id/download',auth[_0xae3d('0xc')](),controller['download']);router[_0xae3d('0x13')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0x14')]);router[_0xae3d('0x13')]('/:id/messages',auth[_0xae3d('0xc')](),controller[_0xae3d('0x15')]);router[_0xae3d('0x13')](_0xae3d('0x16'),auth[_0xae3d('0xc')](),interaction[_0xae3d('0x17')](_0xae3d('0x18'),'whatsappinteraction:addtags'),controller[_0xae3d('0x19')]);router[_0xae3d('0x1a')](_0xae3d('0x1b'),auth[_0xae3d('0xc')](),interaction[_0xae3d('0x17')](_0xae3d('0x18'),'whatsappinteraction:update'),controller[_0xae3d('0x1c')]);router[_0xae3d('0x1d')](_0xae3d('0x1b'),auth['isAuthenticated'](),interaction[_0xae3d('0x17')](_0xae3d('0x18'),'whatsappinteraction:destroy'),controller['destroy']);router[_0xae3d('0x1d')](_0xae3d('0x16'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x1e')]);module[_0xae3d('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index fb23b58..458eee5 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 _0xa3b7=['DATE','STRING','out','ENUM','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0xa3b7,0xe6));var _0x7a3b=function(_0xae1a83,_0x1980d4){_0xae1a83=_0xae1a83-0x0;var _0xdb9da8=_0xa3b7[_0xae1a83];return _0xdb9da8;};'use strict';var Sequelize=require(_0x7a3b('0x0'));var moment=require('moment');module[_0x7a3b('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7a3b('0x2')]},'disposition':{'type':Sequelize[_0x7a3b('0x3')]},'secondDisposition':{'type':Sequelize[_0x7a3b('0x3')]},'thirdDisposition':{'type':Sequelize[_0x7a3b('0x3')]},'note':{'type':Sequelize[_0x7a3b('0x3')]},'phone':{'type':Sequelize[_0x7a3b('0x3')]},'read1stAt':{'type':Sequelize[_0x7a3b('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x7a3b('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7a3b('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x7a3b('0x5')]('in',_0x7a3b('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7a3b('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7a3b('0x7')]}}; \ No newline at end of file +var _0x8f1a=['BOOLEAN','DATE','STRING','out','INTEGER','sequelize','moment','exports'];(function(_0x26cbc2,_0x5491e3){var _0x56f9a0=function(_0x21f0db){while(--_0x21f0db){_0x26cbc2['push'](_0x26cbc2['shift']());}};_0x56f9a0(++_0x5491e3);}(_0x8f1a,0xcd));var _0xa8f1=function(_0x329f20,_0x5dd5d9){_0x329f20=_0x329f20-0x0;var _0x26f134=_0x8f1a[_0x329f20];return _0x26f134;};'use strict';var Sequelize=require(_0xa8f1('0x0'));var moment=require(_0xa8f1('0x1'));module[_0xa8f1('0x2')]={'closed':{'type':Sequelize[_0xa8f1('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa8f1('0x4')]},'disposition':{'type':Sequelize[_0xa8f1('0x5')]},'secondDisposition':{'type':Sequelize[_0xa8f1('0x5')]},'thirdDisposition':{'type':Sequelize[_0xa8f1('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xa8f1('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xa8f1('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa8f1('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa8f1('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa8f1('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa8f1('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 5392423..95d7280 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 _0x0268=['register','status','json','offset','undefined','limit','count','set','Content-Range','update','end','sendStatus','error','name','send','index','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','query','user','then','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','find','create','body','destroy','describe','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','pick','where','WhatsappInteractionId','map','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','addTags','setTags','spread','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','attachments','push','User','fullname','CmContact','Contact','firstName','Attachment','Messages','createdAt','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','format','closedAt','disposition','existsSync','createReadStream','pipe','basename','System','lastName','out','value','views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','rimraf','moment','bluebird','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket'];(function(_0x54381d,_0x247b2c){var _0x5308a7=function(_0x3ef056){while(--_0x3ef056){_0x54381d['push'](_0x54381d['shift']());}};_0x5308a7(++_0x247b2c);}(_0x0268,0x17e));var _0x8026=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x0268[_0x47e7cb];return _0x2a8874;};'use strict';var rimraf=require(_0x8026('0x0'));var zipdir=require('zip-dir');var moment=require(_0x8026('0x1'));var BPromise=require(_0x8026('0x2'));var util=require('util');var path=require(_0x8026('0x3'));var ejs=require(_0x8026('0x4'));var fs=require('fs');var _=require(_0x8026('0x5'));var Redis=require(_0x8026('0x6'));var interaction=require(_0x8026('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x8026('0x8'));var logger=require(_0x8026('0x9'))('api');var config=require(_0x8026('0xa'));var db=require(_0x8026('0xb'))['db'];config[_0x8026('0xc')]=_[_0x8026('0xd')](config[_0x8026('0xc')],{'host':_0x8026('0xe'),'port':0x18eb});var socket=require(_0x8026('0xf'))(new Redis(config[_0x8026('0xc')]));require(_0x8026('0x10'))[_0x8026('0x11')](socket);function respondWithStatusCode(_0x29884c,_0x683916){_0x683916=_0x683916||0xcc;return function(_0x3ebad0){if(_0x3ebad0){return _0x29884c['sendStatus'](_0x683916);}return _0x29884c['status'](_0x683916)['end']();};}function respondWithResult(_0x42940,_0x4a93c6){_0x4a93c6=_0x4a93c6||0xc8;return function(_0x124d5e){if(_0x124d5e){return _0x42940[_0x8026('0x12')](_0x4a93c6)[_0x8026('0x13')](_0x124d5e);}};}function respondWithFilteredResult(_0x3898d2,_0x46e77b){return function(_0x19d23f){if(_0x19d23f){var _0x12f0d7=typeof _0x46e77b[_0x8026('0x14')]===_0x8026('0x15')&&typeof _0x46e77b[_0x8026('0x16')]===_0x8026('0x15');var _0x347808=_0x19d23f[_0x8026('0x17')];var _0x324e50=_0x12f0d7?0x0:_0x46e77b[_0x8026('0x14')];var _0x10057d=_0x12f0d7?_0x19d23f[_0x8026('0x17')]:_0x46e77b['offset']+_0x46e77b['limit'];var _0x1acd0e;if(_0x10057d>=_0x347808){_0x10057d=_0x347808;_0x1acd0e=0xc8;}else{_0x1acd0e=0xce;}_0x3898d2[_0x8026('0x12')](_0x1acd0e);return _0x3898d2[_0x8026('0x18')](_0x8026('0x19'),_0x324e50+'-'+_0x10057d+'/'+_0x347808)[_0x8026('0x13')](_0x19d23f);}return null;};}function saveUpdates(_0x5df1f6){return function(_0x848017){if(_0x848017){return _0x848017[_0x8026('0x1a')](_0x5df1f6)['then'](function(_0x1a7ddb){return _0x1a7ddb;});}return null;};}function removeEntity(_0x1aac10){return function(_0x1a8454){if(_0x1a8454){return _0x1a8454['destroy']()['then'](function(){_0x1aac10[_0x8026('0x12')](0xcc)[_0x8026('0x1b')]();});}};}function handleEntityNotFound(_0x529fc5){return function(_0x30c9dd){if(!_0x30c9dd){_0x529fc5[_0x8026('0x1c')](0x194);}return _0x30c9dd;};}function handleError(_0x521a46,_0x1b98a5){_0x1b98a5=_0x1b98a5||0x1f4;return function(_0x3366b2){logger[_0x8026('0x1d')](_0x3366b2['stack']);if(_0x3366b2[_0x8026('0x1e')]){delete _0x3366b2[_0x8026('0x1e')];}_0x521a46['status'](_0x1b98a5)[_0x8026('0x1f')](_0x3366b2);};}exports[_0x8026('0x20')]=function(_0x3b3ae3,_0x42bb17){var _0x1e5bf0={};var _0x3790fc=_['map'](db[_0x8026('0x21')][_0x8026('0x22')],function(_0x3c01c1){return{'name':_0x3c01c1[_0x8026('0x23')],'type':_0x3c01c1[_0x8026('0x24')][_0x8026('0x25')]};});_0x1e5bf0=qs[_0x8026('0x26')](_0x3790fc,_0x3b3ae3);return interaction['findAll']('whatsapp',_0x3b3ae3[_0x8026('0x27')],_0x3b3ae3[_0x8026('0x28')],_0x1e5bf0,_0x3790fc)[_0x8026('0x29')](respondWithFilteredResult(_0x42bb17,_0x1e5bf0))[_0x8026('0x2a')](handleError(_0x42bb17,null));};exports[_0x8026('0x2b')]=function(_0x37a555,_0x558ff7){var _0x4f1ecd={'raw':![],'where':{'id':_0x37a555[_0x8026('0x2c')]['id']}},_0x5928bc={};_0x5928bc[_0x8026('0x2d')]=_[_0x8026('0x2e')](db[_0x8026('0x21')]['rawAttributes']);_0x5928bc[_0x8026('0x27')]=_[_0x8026('0x2e')](_0x37a555[_0x8026('0x27')]);_0x5928bc[_0x8026('0x2f')]=_[_0x8026('0x30')](_0x5928bc[_0x8026('0x2d')],_0x5928bc[_0x8026('0x27')]);_0x4f1ecd[_0x8026('0x31')]=_[_0x8026('0x30')](_0x5928bc['model'],qs[_0x8026('0x32')](_0x37a555[_0x8026('0x27')][_0x8026('0x32')]));_0x4f1ecd['attributes']=_0x4f1ecd[_0x8026('0x31')][_0x8026('0x33')]?_0x4f1ecd[_0x8026('0x31')]:_0x5928bc[_0x8026('0x2d')];if(_0x37a555[_0x8026('0x27')][_0x8026('0x34')]){_0x4f1ecd[_0x8026('0x35')]=[{'all':!![]}];}_0x4f1ecd=_[_0x8026('0x36')]({},_0x4f1ecd,_0x37a555['options']);return db[_0x8026('0x21')][_0x8026('0x37')](_0x4f1ecd)[_0x8026('0x29')](handleEntityNotFound(_0x558ff7,null))[_0x8026('0x29')](respondWithResult(_0x558ff7,null))[_0x8026('0x2a')](handleError(_0x558ff7,null));};exports['create']=function(_0x4a5e0b,_0x2e4cf2){return db[_0x8026('0x21')][_0x8026('0x38')](_0x4a5e0b[_0x8026('0x39')],{})[_0x8026('0x29')](respondWithResult(_0x2e4cf2,0xc9))[_0x8026('0x2a')](handleError(_0x2e4cf2,null));};exports[_0x8026('0x1a')]=function(_0x36d3ff,_0x66f341){if(_0x36d3ff[_0x8026('0x39')]['id']){delete _0x36d3ff['body']['id'];}return db[_0x8026('0x21')][_0x8026('0x37')]({'where':{'id':_0x36d3ff[_0x8026('0x2c')]['id']}})[_0x8026('0x29')](handleEntityNotFound(_0x66f341,null))[_0x8026('0x29')](saveUpdates(_0x36d3ff[_0x8026('0x39')],null))['then'](respondWithResult(_0x66f341,null))[_0x8026('0x2a')](handleError(_0x66f341,null));};exports[_0x8026('0x3a')]=function(_0x148f63,_0x530d65){return db[_0x8026('0x21')]['find']({'where':{'id':_0x148f63[_0x8026('0x2c')]['id']}})[_0x8026('0x29')](handleEntityNotFound(_0x530d65,null))[_0x8026('0x29')](removeEntity(_0x530d65,null))[_0x8026('0x2a')](handleError(_0x530d65,null));};exports[_0x8026('0x3b')]=function(_0x1b13e0,_0xb3f593){return db['WhatsappInteraction'][_0x8026('0x3b')]()[_0x8026('0x29')](respondWithResult(_0xb3f593,null))[_0x8026('0x2a')](handleError(_0xb3f593,null));};exports[_0x8026('0x3c')]=function(_0x82d16b,_0x1a9608){return db[_0x8026('0x3d')][_0x8026('0x37')]({'where':{'id':_0x82d16b[_0x8026('0x2c')]['id']}})[_0x8026('0x29')](handleEntityNotFound(_0x1a9608,null))[_0x8026('0x29')](function(_0x3d1a65){if(_0x3d1a65){return _0x3d1a65[_0x8026('0x3c')](_0x82d16b[_0x8026('0x39')]['ids'],_[_0x8026('0x3e')](_0x82d16b[_0x8026('0x39')],[_0x8026('0x3f'),'id'])||{});}})[_0x8026('0x29')](respondWithResult(_0x1a9608,null))[_0x8026('0x2a')](handleError(_0x1a9608,null));};exports[_0x8026('0x40')]=function(_0x3f3363,_0x754a7b){var _0x50e941={'raw':![],'where':{}};var _0x96341c={};var _0x21fa0a={'count':0x0,'rows':[]};return db[_0x8026('0x21')][_0x8026('0x41')]({'where':{'id':_0x3f3363[_0x8026('0x2c')]['id']}})['then'](handleEntityNotFound(_0x754a7b,null))[_0x8026('0x29')](function(_0x4948a0){if(_0x4948a0){_0x96341c[_0x8026('0x2d')]=_[_0x8026('0x2e')](db[_0x8026('0x3d')]['rawAttributes']);_0x96341c[_0x8026('0x27')]=_[_0x8026('0x2e')](_0x3f3363[_0x8026('0x27')]);_0x96341c[_0x8026('0x2f')]=_[_0x8026('0x30')](_0x96341c[_0x8026('0x2d')],_0x96341c['query']);_0x50e941[_0x8026('0x31')]=_[_0x8026('0x30')](_0x96341c[_0x8026('0x2d')],qs['fields'](_0x3f3363[_0x8026('0x27')][_0x8026('0x32')]));_0x50e941[_0x8026('0x31')]=_0x50e941[_0x8026('0x31')][_0x8026('0x33')]?_0x50e941[_0x8026('0x31')]:_0x96341c[_0x8026('0x2d')];if(!_0x3f3363['query'][_0x8026('0x42')](_0x8026('0x43'))){_0x50e941[_0x8026('0x16')]=qs[_0x8026('0x16')](_0x3f3363[_0x8026('0x27')]['limit']);_0x50e941['offset']=qs['offset'](_0x3f3363['query'][_0x8026('0x14')]);}_0x50e941[_0x8026('0x44')]=qs[_0x8026('0x45')](_0x3f3363[_0x8026('0x27')][_0x8026('0x45')]);_0x50e941['where']=qs[_0x8026('0x2f')](_[_0x8026('0x46')](_0x3f3363[_0x8026('0x27')],_0x96341c[_0x8026('0x2f')]));_0x50e941[_0x8026('0x47')][_0x8026('0x48')]=_0x4948a0['id'];if(_0x3f3363[_0x8026('0x27')]['filter']){_0x50e941[_0x8026('0x47')]=_[_0x8026('0x36')](_0x50e941[_0x8026('0x47')],{'$or':_[_0x8026('0x49')](_0x50e941[_0x8026('0x31')],function(_0x4e3e79){var _0x42411e={};_0x42411e[_0x4e3e79]={'$like':'%'+_0x3f3363[_0x8026('0x27')][_0x8026('0x4a')]+'%'};return _0x42411e;})});}if(_0x3f3363[_0x8026('0x27')]['$gte']){var _0x13beee=_0x3f3363[_0x8026('0x27')][_0x8026('0x4b')][_0x8026('0x4c')](',');var _0x2f616c={};_0x2f616c[_0x13beee[0x0]]={'$gte':moment(_0x13beee[0x1])['format'](_0x8026('0x4d'))};_0x50e941[_0x8026('0x47')]=_[_0x8026('0x36')](_0x50e941[_0x8026('0x47')],_0x2f616c);}_0x50e941=_['merge']({},_0x50e941,_0x3f3363[_0x8026('0x4e')]);return db[_0x8026('0x3d')][_0x8026('0x17')]({'where':_0x50e941[_0x8026('0x47')]})['then'](function(_0x227f49){_0x21fa0a[_0x8026('0x17')]=_0x227f49;if(_0x3f3363['query']['includeAll']){_0x50e941[_0x8026('0x35')]=[{'all':!![]}];}return db[_0x8026('0x3d')][_0x8026('0x4f')](_0x50e941);})[_0x8026('0x29')](function(_0x2af932){_0x21fa0a[_0x8026('0x50')]=_0x2af932;return _0x21fa0a;});}})[_0x8026('0x29')](respondWithFilteredResult(_0x754a7b,_0x50e941))[_0x8026('0x2a')](handleError(_0x754a7b,null));};exports[_0x8026('0x51')]=function(_0x2cf049,_0x5749e1){return db[_0x8026('0x21')]['find']({'where':{'id':_0x2cf049[_0x8026('0x2c')]['id']}})[_0x8026('0x29')](handleEntityNotFound(_0x5749e1,null))['then'](function(_0x302796){if(_0x302796){return _0x302796[_0x8026('0x52')](_0x2cf049[_0x8026('0x39')][_0x8026('0x3f')],_['omit'](_0x2cf049[_0x8026('0x39')],[_0x8026('0x3f'),'id'])||{})[_0x8026('0x53')](function(){return db['Tag'][_0x8026('0x4f')]({'attributes':['id',_0x8026('0x1e'),_0x8026('0x54')],'where':{'id':_0x2cf049[_0x8026('0x39')]['ids']}});})[_0x8026('0x29')](function(_0x46c008){socket[_0x8026('0x55')](_0x8026('0x56'),{'id':Number(_0x2cf049['params']['id']),'tags':_0x46c008||[]});return{'id':Number(_0x2cf049['params']['id']),'tags':_0x46c008||[]};});}})[_0x8026('0x29')](respondWithResult(_0x5749e1,null))[_0x8026('0x2a')](handleError(_0x5749e1,null));};exports[_0x8026('0x57')]=function(_0x15be12,_0x47fd27){return db[_0x8026('0x21')]['find']({'where':{'id':_0x15be12['params']['id']}})[_0x8026('0x29')](handleEntityNotFound(_0x47fd27,null))[_0x8026('0x29')](function(_0x36198e){if(_0x36198e){return _0x36198e['removeTags'](_0x15be12[_0x8026('0x27')][_0x8026('0x3f')]);}})['then'](respondWithStatusCode(_0x47fd27,null))[_0x8026('0x2a')](handleError(_0x47fd27,null));};exports[_0x8026('0x58')]=function(_0x1cd360,_0x509b3a){var _0x36902b=moment()[_0x8026('0x59')]()[_0x8026('0x5a')]();var _0x54f3eb=path['join'](config[_0x8026('0x5b')],_0x8026('0x5c'),_0x8026('0x5d'),_0x8026('0x5e'));var _0x24882a=path[_0x8026('0x5f')](config[_0x8026('0x5b')],_0x8026('0x5c'),_0x8026('0x5d'),_0x8026('0x60'));var _0x3cad2a=path[_0x8026('0x5f')](_0x54f3eb,_0x36902b);var _0x3b9855=util['format']('transcript-%d-%s.zip',_0x1cd360[_0x8026('0x2c')]['id'],_0x36902b);var _0x44f2b5=path[_0x8026('0x5f')](_0x54f3eb,_0x3b9855);var _0x542cbe=[];_0x542cbe[_0x8026('0x61')]({'model':db[_0x8026('0x62')],'as':_0x8026('0x62'),'attributes':['id',_0x8026('0x63')],'raw':!![]});_0x542cbe['push']({'model':db[_0x8026('0x64')],'as':_0x8026('0x65'),'attributes':['id',_0x8026('0x66'),'lastName'],'raw':!![]});if(_0x1cd360[_0x8026('0x27')][_0x8026('0x60')]){_0x542cbe['push']({'model':db['Attachment'],'as':_0x8026('0x67'),'raw':!![]});}var _0x2085a9=[{'model':db[_0x8026('0x3d')],'as':_0x8026('0x68'),'attributes':['id',_0x8026('0x39'),_0x8026('0x69'),'direction',_0x8026('0x6a'),_0x8026('0x6b')],'include':_0x542cbe}];_0x2085a9[_0x8026('0x61')]({'model':db[_0x8026('0x6c')],'as':_0x8026('0x6d'),'attributes':['id',_0x8026('0x1e')]});_0x2085a9[_0x8026('0x61')]({'model':db['User'],'as':_0x8026('0x6e'),'attributes':['id',_0x8026('0x63')]});return db[_0x8026('0x21')]['find']({'where':{'id':_0x1cd360[_0x8026('0x2c')]['id']},'include':_0x2085a9})['then'](handleEntityNotFound(_0x509b3a,null))[_0x8026('0x29')](function(_0x3b34b6){if(_0x3b34b6){var _0x354c1b=_0x3b34b6[_0x8026('0x6f')]({'plain':!![]});fs[_0x8026('0x70')](_0x3cad2a);var _0x465ce8={'channel':'Whatsapp','account':_0x354c1b[_0x8026('0x6d')][_0x8026('0x1e')],'agent':_0x354c1b[_0x8026('0x6e')]?_0x354c1b[_0x8026('0x6e')][_0x8026('0x63')]:'N.A.','createdAt':moment(_0x354c1b['createdAt'])[_0x8026('0x71')](_0x8026('0x4d'))[_0x8026('0x5a')](),'closedAt':_0x354c1b['closed']?moment(_0x354c1b[_0x8026('0x72')])[_0x8026('0x71')](_0x8026('0x4d'))[_0x8026('0x5a')]():'','disposition':_0x354c1b[_0x8026('0x73')],'messages':_(_0x354c1b[_0x8026('0x68')])[_0x8026('0x4a')]({'secret':![]})[_0x8026('0x49')](function(_0xfff892){if(_0xfff892[_0x8026('0x67')]){var _0x5a4f34=path[_0x8026('0x5f')](_0x24882a,_0xfff892[_0x8026('0x67')]['basename']);if(fs[_0x8026('0x74')](_0x5a4f34)){fs[_0x8026('0x75')](_0x5a4f34)[_0x8026('0x76')](fs['createWriteStream'](path[_0x8026('0x5f')](_0x3cad2a,_0xfff892[_0x8026('0x67')][_0x8026('0x77')])));}}return{'date':moment(_0xfff892[_0x8026('0x69')])[_0x8026('0x71')]('YYYY-MM-DD\x20HH:mm:ss')[_0x8026('0x5a')](),'sender':_0xfff892['direction']==='out'?_0xfff892['User']?_0xfff892['User'][_0x8026('0x63')]:_0x8026('0x78'):_0xfff892[_0x8026('0x65')]['firstName']+(_0xfff892[_0x8026('0x65')]['lastName']?'\x20'+_0xfff892['Contact'][_0x8026('0x79')]:''),'body':_0xfff892[_0x8026('0x67')]?_0xfff892[_0x8026('0x67')][_0x8026('0x77')]:_0xfff892[_0x8026('0x39')],'direction':_0xfff892['direction']===_0x8026('0x7a')?'A':'C','secret':_0xfff892['secret'],'read':_0xfff892[_0x8026('0x6b')],'attachment':_0xfff892[_0x8026('0x67')]};})[_0x8026('0x7b')]()};return ejs['renderFile'](path['join'](config[_0x8026('0x5b')],_0x8026('0x5c'),_0x8026('0x7c'),_0x8026('0x7d')),{'interaction':_0x465ce8})[_0x8026('0x29')](function(_0xc68dde){var _0x5862e1=path[_0x8026('0x5f')](_0x3cad2a,_0x8026('0x7e')+_0x354c1b['id']+'-'+_0x36902b+_0x8026('0x7f'));var _0x717f64={'path':_0x5862e1,'channel':_0x8026('0x80'),'interactionId':_0x354c1b['id']};return pdf[_0x8026('0x81')](_0xc68dde,_0x717f64);})['then'](function(){return new BPromise(function(_0x18e02f,_0xfd0850){zipdir(_0x3cad2a,{'saveTo':_0x44f2b5},function(_0x519a9a,_0x216718){if(_0x519a9a)return _0xfd0850(_0x519a9a);return _0x18e02f(_0x216718);});})[_0x8026('0x29')](function(){return new BPromise(function(_0x25d080,_0x4eacdf){rimraf(_0x3cad2a,function(_0x54359b){if(_0x54359b)_0x4eacdf(_0x54359b);return _0x25d080();});});})['then'](function(){return _0x509b3a[_0x8026('0x58')](_0x44f2b5,_0x3b9855,function(_0x511e7e){if(_0x511e7e){console[_0x8026('0x82')](_0x8026('0x83'),_0x511e7e);}else{fs[_0x8026('0x84')](_0x44f2b5);}});});});}else{return _0x509b3a[_0x8026('0x1c')](0xc8);}})['catch'](handleError(_0x509b3a,null));}; \ No newline at end of file +var _0xda7d=['catch','create','body','describe','addMessage','ids','omit','findOne','WhatsappMessage','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','setTags','spread','Tag','color','emit','whatsappInteractionTags:save','unix','join','files','tmp','root','server','attachments','transcript-%d-%s.zip','push','User','CmContact','firstName','lastName','Attachment','direction','secret','read','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','fullname','N.A.','createdAt','closed','closedAt','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','toString','Contact','out','views','downloadInteraction.ejs','transcript-','.pdf','download','log','err','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./whatsappInteraction.socket','register','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','sendStatus','error','stack','name','index','map','WhatsappInteraction','rawAttributes','fieldName','type','getOptions','findAll','user','show','params','model','keys','query','intersection','attributes','fields','length','include','merge','find'];(function(_0x28d391,_0x1357b3){var _0x3c8bf0=function(_0x55bac9){while(--_0x55bac9){_0x28d391['push'](_0x28d391['shift']());}};_0x3c8bf0(++_0x1357b3);}(_0xda7d,0x145));var _0xdda7=function(_0x962edb,_0x5dd356){_0x962edb=_0x962edb-0x0;var _0x359dcf=_0xda7d[_0x962edb];return _0x359dcf;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xdda7('0x0'));var moment=require(_0xdda7('0x1'));var BPromise=require(_0xdda7('0x2'));var util=require(_0xdda7('0x3'));var path=require(_0xdda7('0x4'));var ejs=require(_0xdda7('0x5'));var fs=require('fs');var _=require(_0xdda7('0x6'));var Redis=require(_0xdda7('0x7'));var interaction=require(_0xdda7('0x8'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0xdda7('0x9'))(_0xdda7('0xa'));var config=require(_0xdda7('0xb'));var db=require(_0xdda7('0xc'))['db'];config[_0xdda7('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdda7('0xe'))(new Redis(config[_0xdda7('0xd')]));require(_0xdda7('0xf'))[_0xdda7('0x10')](socket);function respondWithStatusCode(_0x4f0e12,_0x52e0cc){_0x52e0cc=_0x52e0cc||0xcc;return function(_0x307c10){if(_0x307c10){return _0x4f0e12['sendStatus'](_0x52e0cc);}return _0x4f0e12[_0xdda7('0x11')](_0x52e0cc)['end']();};}function respondWithResult(_0x38c4a8,_0xfd6b25){_0xfd6b25=_0xfd6b25||0xc8;return function(_0x2c4ee1){if(_0x2c4ee1){return _0x38c4a8[_0xdda7('0x11')](_0xfd6b25)['json'](_0x2c4ee1);}};}function respondWithFilteredResult(_0x1be32e,_0x348727){return function(_0x597d45){if(_0x597d45){var _0x42b0e6=typeof _0x348727[_0xdda7('0x12')]===_0xdda7('0x13')&&typeof _0x348727[_0xdda7('0x14')]==='undefined';var _0x4d88fb=_0x597d45['count'];var _0x2afc7e=_0x42b0e6?0x0:_0x348727[_0xdda7('0x12')];var _0x196d85=_0x42b0e6?_0x597d45[_0xdda7('0x15')]:_0x348727[_0xdda7('0x12')]+_0x348727[_0xdda7('0x14')];var _0x4cbcf7;if(_0x196d85>=_0x4d88fb){_0x196d85=_0x4d88fb;_0x4cbcf7=0xc8;}else{_0x4cbcf7=0xce;}_0x1be32e[_0xdda7('0x11')](_0x4cbcf7);return _0x1be32e[_0xdda7('0x16')](_0xdda7('0x17'),_0x2afc7e+'-'+_0x196d85+'/'+_0x4d88fb)[_0xdda7('0x18')](_0x597d45);}return null;};}function saveUpdates(_0x26abce){return function(_0x23f026){if(_0x23f026){return _0x23f026[_0xdda7('0x19')](_0x26abce)[_0xdda7('0x1a')](function(_0x4f1296){return _0x4f1296;});}return null;};}function removeEntity(_0xeb15d2){return function(_0x2dfef0){if(_0x2dfef0){return _0x2dfef0[_0xdda7('0x1b')]()[_0xdda7('0x1a')](function(){_0xeb15d2[_0xdda7('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22dae1){return function(_0x2f199f){if(!_0x2f199f){_0x22dae1[_0xdda7('0x1c')](0x194);}return _0x2f199f;};}function handleError(_0x2811d0,_0x39e3bd){_0x39e3bd=_0x39e3bd||0x1f4;return function(_0x3a5a49){logger[_0xdda7('0x1d')](_0x3a5a49[_0xdda7('0x1e')]);if(_0x3a5a49['name']){delete _0x3a5a49[_0xdda7('0x1f')];}_0x2811d0[_0xdda7('0x11')](_0x39e3bd)['send'](_0x3a5a49);};}exports[_0xdda7('0x20')]=function(_0x33ef90,_0x3998ad){var _0x2f4454={};var _0x283490=_[_0xdda7('0x21')](db[_0xdda7('0x22')][_0xdda7('0x23')],function(_0x3ad5c6){return{'name':_0x3ad5c6[_0xdda7('0x24')],'type':_0x3ad5c6[_0xdda7('0x25')]['key']};});_0x2f4454=qs[_0xdda7('0x26')](_0x283490,_0x33ef90);return interaction[_0xdda7('0x27')]('whatsapp',_0x33ef90['query'],_0x33ef90[_0xdda7('0x28')],_0x2f4454,_0x283490)[_0xdda7('0x1a')](respondWithFilteredResult(_0x3998ad,_0x2f4454))['catch'](handleError(_0x3998ad,null));};exports[_0xdda7('0x29')]=function(_0x1cdccd,_0x1b516c){var _0x5122b4={'raw':![],'where':{'id':_0x1cdccd[_0xdda7('0x2a')]['id']}},_0x14fb92={};_0x14fb92[_0xdda7('0x2b')]=_[_0xdda7('0x2c')](db[_0xdda7('0x22')]['rawAttributes']);_0x14fb92[_0xdda7('0x2d')]=_[_0xdda7('0x2c')](_0x1cdccd[_0xdda7('0x2d')]);_0x14fb92['filters']=_[_0xdda7('0x2e')](_0x14fb92[_0xdda7('0x2b')],_0x14fb92['query']);_0x5122b4[_0xdda7('0x2f')]=_[_0xdda7('0x2e')](_0x14fb92[_0xdda7('0x2b')],qs['fields'](_0x1cdccd[_0xdda7('0x2d')][_0xdda7('0x30')]));_0x5122b4[_0xdda7('0x2f')]=_0x5122b4[_0xdda7('0x2f')][_0xdda7('0x31')]?_0x5122b4[_0xdda7('0x2f')]:_0x14fb92['model'];if(_0x1cdccd[_0xdda7('0x2d')]['includeAll']){_0x5122b4[_0xdda7('0x32')]=[{'all':!![]}];}_0x5122b4=_[_0xdda7('0x33')]({},_0x5122b4,_0x1cdccd['options']);return db[_0xdda7('0x22')][_0xdda7('0x34')](_0x5122b4)[_0xdda7('0x1a')](handleEntityNotFound(_0x1b516c,null))[_0xdda7('0x1a')](respondWithResult(_0x1b516c,null))[_0xdda7('0x35')](handleError(_0x1b516c,null));};exports[_0xdda7('0x36')]=function(_0x18b720,_0x83000b){return db[_0xdda7('0x22')][_0xdda7('0x36')](_0x18b720[_0xdda7('0x37')],{})['then'](respondWithResult(_0x83000b,0xc9))[_0xdda7('0x35')](handleError(_0x83000b,null));};exports[_0xdda7('0x19')]=function(_0x24ae11,_0x38a0f0){if(_0x24ae11[_0xdda7('0x37')]['id']){delete _0x24ae11[_0xdda7('0x37')]['id'];}return db[_0xdda7('0x22')]['find']({'where':{'id':_0x24ae11[_0xdda7('0x2a')]['id']}})[_0xdda7('0x1a')](handleEntityNotFound(_0x38a0f0,null))['then'](saveUpdates(_0x24ae11[_0xdda7('0x37')],null))['then'](respondWithResult(_0x38a0f0,null))[_0xdda7('0x35')](handleError(_0x38a0f0,null));};exports[_0xdda7('0x1b')]=function(_0x4c5172,_0x11fc82){return db[_0xdda7('0x22')][_0xdda7('0x34')]({'where':{'id':_0x4c5172[_0xdda7('0x2a')]['id']}})[_0xdda7('0x1a')](handleEntityNotFound(_0x11fc82,null))[_0xdda7('0x1a')](removeEntity(_0x11fc82,null))['catch'](handleError(_0x11fc82,null));};exports[_0xdda7('0x38')]=function(_0x2a0228,_0x56a3d9){return db['WhatsappInteraction']['describe']()['then'](respondWithResult(_0x56a3d9,null))['catch'](handleError(_0x56a3d9,null));};exports[_0xdda7('0x39')]=function(_0x3c3bfd,_0x18dbc1){return db['WhatsappMessage'][_0xdda7('0x34')]({'where':{'id':_0x3c3bfd['params']['id']}})[_0xdda7('0x1a')](handleEntityNotFound(_0x18dbc1,null))[_0xdda7('0x1a')](function(_0x37c17f){if(_0x37c17f){return _0x37c17f[_0xdda7('0x39')](_0x3c3bfd[_0xdda7('0x37')][_0xdda7('0x3a')],_[_0xdda7('0x3b')](_0x3c3bfd[_0xdda7('0x37')],['ids','id'])||{});}})['then'](respondWithResult(_0x18dbc1,null))[_0xdda7('0x35')](handleError(_0x18dbc1,null));};exports['getMessages']=function(_0x329a8d,_0x135f17){var _0xabb0bb={'raw':![],'where':{}};var _0x2f05f6={};var _0x33e64c={'count':0x0,'rows':[]};return db[_0xdda7('0x22')][_0xdda7('0x3c')]({'where':{'id':_0x329a8d[_0xdda7('0x2a')]['id']}})[_0xdda7('0x1a')](handleEntityNotFound(_0x135f17,null))[_0xdda7('0x1a')](function(_0x7807da){if(_0x7807da){_0x2f05f6[_0xdda7('0x2b')]=_[_0xdda7('0x2c')](db[_0xdda7('0x3d')]['rawAttributes']);_0x2f05f6[_0xdda7('0x2d')]=_[_0xdda7('0x2c')](_0x329a8d[_0xdda7('0x2d')]);_0x2f05f6['filters']=_[_0xdda7('0x2e')](_0x2f05f6[_0xdda7('0x2b')],_0x2f05f6[_0xdda7('0x2d')]);_0xabb0bb[_0xdda7('0x2f')]=_[_0xdda7('0x2e')](_0x2f05f6[_0xdda7('0x2b')],qs['fields'](_0x329a8d['query'][_0xdda7('0x30')]));_0xabb0bb['attributes']=_0xabb0bb[_0xdda7('0x2f')]['length']?_0xabb0bb['attributes']:_0x2f05f6[_0xdda7('0x2b')];if(!_0x329a8d['query'][_0xdda7('0x3e')](_0xdda7('0x3f'))){_0xabb0bb[_0xdda7('0x14')]=qs[_0xdda7('0x14')](_0x329a8d[_0xdda7('0x2d')][_0xdda7('0x14')]);_0xabb0bb[_0xdda7('0x12')]=qs['offset'](_0x329a8d[_0xdda7('0x2d')][_0xdda7('0x12')]);}_0xabb0bb[_0xdda7('0x40')]=qs[_0xdda7('0x41')](_0x329a8d[_0xdda7('0x2d')][_0xdda7('0x41')]);_0xabb0bb[_0xdda7('0x42')]=qs[_0xdda7('0x43')](_[_0xdda7('0x44')](_0x329a8d[_0xdda7('0x2d')],_0x2f05f6['filters']));_0xabb0bb[_0xdda7('0x42')]['WhatsappInteractionId']=_0x7807da['id'];if(_0x329a8d['query'][_0xdda7('0x45')]){_0xabb0bb['where']=_[_0xdda7('0x33')](_0xabb0bb[_0xdda7('0x42')],{'$or':_[_0xdda7('0x21')](_0xabb0bb['attributes'],function(_0x2199e8){var _0x84c7b2={};_0x84c7b2[_0x2199e8]={'$like':'%'+_0x329a8d[_0xdda7('0x2d')][_0xdda7('0x45')]+'%'};return _0x84c7b2;})});}if(_0x329a8d['query'][_0xdda7('0x46')]){var _0x3a326c=_0x329a8d['query'][_0xdda7('0x46')][_0xdda7('0x47')](',');var _0x1a898c={};_0x1a898c[_0x3a326c[0x0]]={'$gte':moment(_0x3a326c[0x1])[_0xdda7('0x48')](_0xdda7('0x49'))};_0xabb0bb[_0xdda7('0x42')]=_[_0xdda7('0x33')](_0xabb0bb[_0xdda7('0x42')],_0x1a898c);}_0xabb0bb=_['merge']({},_0xabb0bb,_0x329a8d['options']);return db['WhatsappMessage'][_0xdda7('0x15')]({'where':_0xabb0bb[_0xdda7('0x42')]})['then'](function(_0x52e2c4){_0x33e64c[_0xdda7('0x15')]=_0x52e2c4;if(_0x329a8d[_0xdda7('0x2d')][_0xdda7('0x4a')]){_0xabb0bb['include']=[{'all':!![]}];}return db[_0xdda7('0x3d')][_0xdda7('0x27')](_0xabb0bb);})['then'](function(_0x4dbcce){_0x33e64c['rows']=_0x4dbcce;return _0x33e64c;});}})['then'](respondWithFilteredResult(_0x135f17,_0xabb0bb))[_0xdda7('0x35')](handleError(_0x135f17,null));};exports[_0xdda7('0x4b')]=function(_0x164a45,_0x43b1e5){return db['WhatsappInteraction'][_0xdda7('0x34')]({'where':{'id':_0x164a45[_0xdda7('0x2a')]['id']}})[_0xdda7('0x1a')](handleEntityNotFound(_0x43b1e5,null))['then'](function(_0x4dacc8){if(_0x4dacc8){return _0x4dacc8[_0xdda7('0x4c')](_0x164a45[_0xdda7('0x37')][_0xdda7('0x3a')],_[_0xdda7('0x3b')](_0x164a45[_0xdda7('0x37')],[_0xdda7('0x3a'),'id'])||{})[_0xdda7('0x4d')](function(){return db[_0xdda7('0x4e')][_0xdda7('0x27')]({'attributes':['id','name',_0xdda7('0x4f')],'where':{'id':_0x164a45[_0xdda7('0x37')]['ids']}});})[_0xdda7('0x1a')](function(_0x5d42cb){socket[_0xdda7('0x50')](_0xdda7('0x51'),{'id':Number(_0x164a45['params']['id']),'tags':_0x5d42cb||[]});return{'id':Number(_0x164a45[_0xdda7('0x2a')]['id']),'tags':_0x5d42cb||[]};});}})[_0xdda7('0x1a')](respondWithResult(_0x43b1e5,null))[_0xdda7('0x35')](handleError(_0x43b1e5,null));};exports['removeTags']=function(_0x1b6761,_0x47c82f){return db[_0xdda7('0x22')]['find']({'where':{'id':_0x1b6761[_0xdda7('0x2a')]['id']}})[_0xdda7('0x1a')](handleEntityNotFound(_0x47c82f,null))[_0xdda7('0x1a')](function(_0xeb7731){if(_0xeb7731){return _0xeb7731['removeTags'](_0x1b6761[_0xdda7('0x2d')]['ids']);}})[_0xdda7('0x1a')](respondWithStatusCode(_0x47c82f,null))[_0xdda7('0x35')](handleError(_0x47c82f,null));};exports['download']=function(_0xe74197,_0x3e1981){var _0x4305cd=moment()[_0xdda7('0x52')]()['toString']();var _0x2d8077=path[_0xdda7('0x53')](config['root'],'server',_0xdda7('0x54'),_0xdda7('0x55'));var _0x5bedeb=path[_0xdda7('0x53')](config[_0xdda7('0x56')],_0xdda7('0x57'),_0xdda7('0x54'),_0xdda7('0x58'));var _0x3f509f=path[_0xdda7('0x53')](_0x2d8077,_0x4305cd);var _0xfba3e3=util[_0xdda7('0x48')](_0xdda7('0x59'),_0xe74197[_0xdda7('0x2a')]['id'],_0x4305cd);var _0x50cb03=path[_0xdda7('0x53')](_0x2d8077,_0xfba3e3);var _0x1ff5d2=[];_0x1ff5d2[_0xdda7('0x5a')]({'model':db[_0xdda7('0x5b')],'as':_0xdda7('0x5b'),'attributes':['id','fullname'],'raw':!![]});_0x1ff5d2[_0xdda7('0x5a')]({'model':db[_0xdda7('0x5c')],'as':'Contact','attributes':['id',_0xdda7('0x5d'),_0xdda7('0x5e')],'raw':!![]});if(_0xe74197['query']['attachments']){_0x1ff5d2[_0xdda7('0x5a')]({'model':db['Attachment'],'as':_0xdda7('0x5f'),'raw':!![]});}var _0x1c386c=[{'model':db[_0xdda7('0x3d')],'as':'Messages','attributes':['id','body','createdAt',_0xdda7('0x60'),_0xdda7('0x61'),_0xdda7('0x62')],'include':_0x1ff5d2}];_0x1c386c[_0xdda7('0x5a')]({'model':db[_0xdda7('0x63')],'as':_0xdda7('0x64'),'attributes':['id','name']});_0x1c386c['push']({'model':db[_0xdda7('0x5b')],'as':'Owner','attributes':['id','fullname']});return db[_0xdda7('0x22')][_0xdda7('0x34')]({'where':{'id':_0xe74197[_0xdda7('0x2a')]['id']},'include':_0x1c386c})['then'](handleEntityNotFound(_0x3e1981,null))['then'](function(_0x27acf6){if(_0x27acf6){var _0x15fabb=_0x27acf6[_0xdda7('0x65')]({'plain':!![]});fs[_0xdda7('0x66')](_0x3f509f);var _0x21cd84={'channel':_0xdda7('0x67'),'account':_0x15fabb[_0xdda7('0x64')][_0xdda7('0x1f')],'agent':_0x15fabb[_0xdda7('0x68')]?_0x15fabb[_0xdda7('0x68')][_0xdda7('0x69')]:_0xdda7('0x6a'),'createdAt':moment(_0x15fabb[_0xdda7('0x6b')])[_0xdda7('0x48')](_0xdda7('0x49'))['toString'](),'closedAt':_0x15fabb[_0xdda7('0x6c')]?moment(_0x15fabb[_0xdda7('0x6d')])[_0xdda7('0x48')](_0xdda7('0x49'))['toString']():'','disposition':_0x15fabb['disposition'],'messages':_(_0x15fabb[_0xdda7('0x6e')])[_0xdda7('0x45')]({'secret':![]})[_0xdda7('0x21')](function(_0x3b2492){if(_0x3b2492[_0xdda7('0x5f')]){var _0x4747=path[_0xdda7('0x53')](_0x5bedeb,_0x3b2492[_0xdda7('0x5f')][_0xdda7('0x6f')]);if(fs[_0xdda7('0x70')](_0x4747)){fs[_0xdda7('0x71')](_0x4747)[_0xdda7('0x72')](fs[_0xdda7('0x73')](path['join'](_0x3f509f,_0x3b2492[_0xdda7('0x5f')][_0xdda7('0x6f')])));}}return{'date':moment(_0x3b2492[_0xdda7('0x6b')])[_0xdda7('0x48')](_0xdda7('0x49'))[_0xdda7('0x74')](),'sender':_0x3b2492['direction']==='out'?_0x3b2492[_0xdda7('0x5b')]?_0x3b2492[_0xdda7('0x5b')][_0xdda7('0x69')]:'System':_0x3b2492['Contact'][_0xdda7('0x5d')]+(_0x3b2492[_0xdda7('0x75')][_0xdda7('0x5e')]?'\x20'+_0x3b2492[_0xdda7('0x75')][_0xdda7('0x5e')]:''),'body':_0x3b2492[_0xdda7('0x5f')]?_0x3b2492[_0xdda7('0x5f')]['basename']:_0x3b2492[_0xdda7('0x37')],'direction':_0x3b2492[_0xdda7('0x60')]===_0xdda7('0x76')?'A':'C','secret':_0x3b2492[_0xdda7('0x61')],'read':_0x3b2492[_0xdda7('0x62')],'attachment':_0x3b2492[_0xdda7('0x5f')]};})['value']()};return ejs['renderFile'](path[_0xdda7('0x53')](config[_0xdda7('0x56')],'server',_0xdda7('0x77'),_0xdda7('0x78')),{'interaction':_0x21cd84})[_0xdda7('0x1a')](function(_0x24db79){var _0x3ffb96=path[_0xdda7('0x53')](_0x3f509f,_0xdda7('0x79')+_0x15fabb['id']+'-'+_0x4305cd+_0xdda7('0x7a'));var _0x2fde5c={'path':_0x3ffb96,'channel':_0xdda7('0x67'),'interactionId':_0x15fabb['id']};return pdf['createPdfFromHTML'](_0x24db79,_0x2fde5c);})[_0xdda7('0x1a')](function(){return new BPromise(function(_0x448967,_0x3a164b){zipdir(_0x3f509f,{'saveTo':_0x50cb03},function(_0x3a8464,_0x97d797){if(_0x3a8464)return _0x3a164b(_0x3a8464);return _0x448967(_0x97d797);});})[_0xdda7('0x1a')](function(){return new BPromise(function(_0x260de6,_0x3caa9b){rimraf(_0x3f509f,function(_0x389b62){if(_0x389b62)_0x3caa9b(_0x389b62);return _0x260de6();});});})[_0xdda7('0x1a')](function(){return _0x3e1981[_0xdda7('0x7b')](_0x50cb03,_0xfba3e3,function(_0x7a4cd6){if(_0x7a4cd6){console[_0xdda7('0x7c')](_0xdda7('0x7d'),_0x7a4cd6);}else{fs['unlinkSync'](_0x50cb03);}});});});}else{return _0x3e1981[_0xdda7('0x1c')](0xc8);}})[_0xdda7('0x35')](handleError(_0x3e1981,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index fa0ef2a..cae11de 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 _0x5b02=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','save','remove','then','Users'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b02,0xe9));var _0x25b0=function(_0x37b440,_0x26afa3){_0x37b440=_0x37b440-0x0;var _0x2b87b5=_0x5b02[_0x37b440];return _0x2b87b5;};'use strict';var EventEmitter=require(_0x25b0('0x0'));var WhatsappInteraction=require(_0x25b0('0x1'))['db'][_0x25b0('0x2')];var WhatsappMessage=require(_0x25b0('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x25b0('0x3'),'afterUpdate':'update','afterDestroy':_0x25b0('0x4')};function emitEvent(_0x31c9c2){return function(_0x38dc14,_0x1928e8,_0x2d84a9){_0x38dc14['getUsers']({'attributes':['id'],'raw':!![]})[_0x25b0('0x5')](function(_0xd8276d){_0x38dc14['setDataValue'](_0x25b0('0x6'),_0xd8276d['map'](function(_0x56feca){return{'id':_0x56feca['id']};}));return WhatsappMessage[_0x25b0('0x7')]({'where':{'WhatsappInteractionId':_0x38dc14['id'],'direction':'in','read':![]},'raw':!![]});})[_0x25b0('0x5')](function(_0x358af0){_0x38dc14['setDataValue'](_0x25b0('0x8'),_0x358af0[_0x25b0('0x9')]);WhatsappInteractionEvents[_0x25b0('0xa')](_0x31c9c2+':'+_0x38dc14['id'],_0x38dc14);WhatsappInteractionEvents[_0x25b0('0xa')](_0x31c9c2,_0x38dc14);_0x2d84a9(null);})[_0x25b0('0xb')](_0x2d84a9(null));};}for(var e in events){if(events[_0x25b0('0xc')](e)){var event=events[e];WhatsappInteraction[_0x25b0('0xd')](e,emitEvent(event));}}module[_0x25b0('0xe')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x4a47=['length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','remove','getUsers','Users','findAll','then','unreadMessages'];(function(_0x4b98df,_0x39e3ca){var _0x33a6b4=function(_0x43eb26){while(--_0x43eb26){_0x4b98df['push'](_0x4b98df['shift']());}};_0x33a6b4(++_0x39e3ca);}(_0x4a47,0xb5));var _0x74a4=function(_0x59820d,_0xc8e6ba){_0x59820d=_0x59820d-0x0;var _0x3c72b1=_0x4a47[_0x59820d];return _0x3c72b1;};'use strict';var EventEmitter=require(_0x74a4('0x0'));var WhatsappInteraction=require(_0x74a4('0x1'))['db'][_0x74a4('0x2')];var WhatsappMessage=require(_0x74a4('0x1'))['db'][_0x74a4('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x74a4('0x4'),'afterUpdate':'update','afterDestroy':_0x74a4('0x5')};function emitEvent(_0x450c10){return function(_0x5af655,_0x43080b,_0x3c6344){_0x5af655[_0x74a4('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x41ef5a){_0x5af655['setDataValue'](_0x74a4('0x7'),_0x41ef5a['map'](function(_0x39bbb4){return{'id':_0x39bbb4['id']};}));return WhatsappMessage[_0x74a4('0x8')]({'where':{'WhatsappInteractionId':_0x5af655['id'],'direction':'in','read':![]},'raw':!![]});})[_0x74a4('0x9')](function(_0x17c01f){_0x5af655['setDataValue'](_0x74a4('0xa'),_0x17c01f[_0x74a4('0xb')]);WhatsappInteractionEvents[_0x74a4('0xc')](_0x450c10+':'+_0x5af655['id'],_0x5af655);WhatsappInteractionEvents[_0x74a4('0xc')](_0x450c10,_0x5af655);_0x3c6344(null);})['catch'](_0x3c6344(null));};}for(var e in events){if(events[_0x74a4('0xd')](e)){var event=events[e];WhatsappInteraction[_0x74a4('0xe')](e,emitEvent(event));}}module[_0x74a4('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 58bf126..3d92954 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 _0x2e3a=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed'];(function(_0xad2972,_0x362cf7){var _0xd72857=function(_0xbfeb2e){while(--_0xbfeb2e){_0xad2972['push'](_0xad2972['shift']());}};_0xd72857(++_0x362cf7);}(_0x2e3a,0x145));var _0xa2e3=function(_0x3698a2,_0x7906c1){_0x3698a2=_0x3698a2-0x0;var _0x453cd1=_0x2e3a[_0x3698a2];return _0x453cd1;};'use strict';var _=require(_0xa2e3('0x0'));var util=require('util');var logger=require(_0xa2e3('0x1'))('api');var moment=require(_0xa2e3('0x2'));var BPromise=require(_0xa2e3('0x3'));var rp=require(_0xa2e3('0x4'));var fs=require('fs');var path=require(_0xa2e3('0x5'));var rimraf=require(_0xa2e3('0x6'));var config=require(_0xa2e3('0x7'));var attributes=require(_0xa2e3('0x8'));module[_0xa2e3('0x9')]=function(_0x43226f,_0x2237f1){return _0x43226f[_0xa2e3('0xa')](_0xa2e3('0xb'),attributes,{'tableName':_0xa2e3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2f8508,_0x49f29f,_0x3a10d1){if(_0x2f8508[_0xa2e3('0xd')](_0xa2e3('0xe'))){_0x2f8508['closedAt']=moment()[_0xa2e3('0xf')](_0xa2e3('0x10'));}_0x3a10d1(null,_0x2f8508);}}});}; \ No newline at end of file +var _0x0e9f=['define','WhatsappInteraction','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0x59fc33,_0x2e182d){var _0x39066f=function(_0x4d843d){while(--_0x4d843d){_0x59fc33['push'](_0x59fc33['shift']());}};_0x39066f(++_0x2e182d);}(_0x0e9f,0xf7));var _0xf0e9=function(_0x1e2569,_0x23fcda){_0x1e2569=_0x1e2569-0x0;var _0x186ec6=_0x0e9f[_0x1e2569];return _0x186ec6;};'use strict';var _=require('lodash');var util=require(_0xf0e9('0x0'));var logger=require('../../config/logger')(_0xf0e9('0x1'));var moment=require(_0xf0e9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf0e9('0x3'));var rimraf=require(_0xf0e9('0x4'));var config=require(_0xf0e9('0x5'));var attributes=require(_0xf0e9('0x6'));module[_0xf0e9('0x7')]=function(_0x570a1b,_0x37995d){return _0x570a1b[_0xf0e9('0x8')](_0xf0e9('0x9'),attributes,{'tableName':_0xf0e9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2ab744,_0x26207f,_0x33f6b0){if(_0x2ab744[_0xf0e9('0xb')](_0xf0e9('0xc'))){_0x2ab744['closedAt']=moment()[_0xf0e9('0xd')](_0xf0e9('0xe'));}_0x33f6b0(null,_0x2ab744);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 8acc2b9..8ab9f23 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 _0x14c7=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','WhatsappInteraction','body','options','raw','where','UpdateWhatsappInteraction','catch','addTags','omit','ids','spread','AddTags','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14c7,0x167));var _0x714c=function(_0x5e7643,_0x7aee74){_0x5e7643=_0x5e7643-0x0;var _0xf0fbc=_0x14c7[_0x5e7643];return _0xf0fbc;};'use strict';var _=require(_0x714c('0x0'));var util=require(_0x714c('0x1'));var moment=require('moment');var BPromise=require(_0x714c('0x2'));var rs=require(_0x714c('0x3'));var fs=require('fs');var Redis=require(_0x714c('0x4'));var db=require(_0x714c('0x5'))['db'];var utils=require(_0x714c('0x6'));var logger=require(_0x714c('0x7'))('rpc');var config=require(_0x714c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x714c('0x9')]['http']({'port':0x232a});config[_0x714c('0xa')]=_[_0x714c('0xb')](config[_0x714c('0xa')],{'host':_0x714c('0xc'),'port':0x18eb});var socket=require(_0x714c('0xd'))(new Redis(config[_0x714c('0xa')]));require(_0x714c('0xe'))[_0x714c('0xf')](socket);function respondWithRpcPromise(_0x1e698f,_0x1d97f3,_0x496234){return new BPromise(function(_0x2c4382,_0x2010c2){return client[_0x714c('0x10')](_0x1e698f,_0x496234)[_0x714c('0x11')](function(_0x3e1683){logger[_0x714c('0x12')](_0x714c('0x13'),_0x1d97f3,'request\x20sent');logger[_0x714c('0x14')](_0x714c('0x15'),_0x1d97f3,_0x714c('0x16'),JSON[_0x714c('0x17')](_0x3e1683));if(_0x3e1683[_0x714c('0x18')]){if(_0x3e1683[_0x714c('0x18')][_0x714c('0x19')]===0x1f4){logger[_0x714c('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x1d97f3,_0x3e1683[_0x714c('0x18')][_0x714c('0x1a')]);return _0x2010c2(_0x3e1683[_0x714c('0x18')][_0x714c('0x1a')]);}logger[_0x714c('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x1d97f3,_0x3e1683['error'][_0x714c('0x1a')]);return _0x2c4382(_0x3e1683[_0x714c('0x18')][_0x714c('0x1a')]);}else{logger['info'](_0x714c('0x13'),_0x1d97f3,'request\x20sent');_0x2c4382(_0x3e1683[_0x714c('0x1b')][_0x714c('0x1a')]);}})['catch'](function(_0x4e5aa5){logger[_0x714c('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x1d97f3,_0x4e5aa5);_0x2010c2(_0x4e5aa5);});});}exports['UpdateWhatsappInteraction']=function(_0x3c1734){var _0x51cdc5=this;return new Promise(function(_0x5427d0,_0x4c0458){return db[_0x714c('0x1c')]['update'](_0x3c1734[_0x714c('0x1d')],{'raw':_0x3c1734[_0x714c('0x1e')]?_0x3c1734[_0x714c('0x1e')][_0x714c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c1734['options']?_0x3c1734[_0x714c('0x1e')][_0x714c('0x20')]||null:null,'attributes':_0x3c1734[_0x714c('0x1e')]?_0x3c1734[_0x714c('0x1e')]['attributes']||null:null,'limit':_0x3c1734[_0x714c('0x1e')]?_0x3c1734[_0x714c('0x1e')]['limit']||null:null})[_0x714c('0x11')](function(_0x320737){logger[_0x714c('0x12')]('UpdateWhatsappInteraction',_0x3c1734);logger[_0x714c('0x14')](_0x714c('0x21'),_0x3c1734,JSON[_0x714c('0x17')](_0x320737));_0x5427d0(_0x320737);})[_0x714c('0x22')](function(_0x4072f6){logger['error'](_0x714c('0x21'),_0x4072f6[_0x714c('0x1a')],_0x3c1734);_0x4c0458(_0x51cdc5[_0x714c('0x18')](0x1f4,_0x4072f6[_0x714c('0x1a')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x40d586){return new Promise(function(_0x176e5b,_0xff9787){return db[_0x714c('0x1c')]['find']({'where':_0x40d586[_0x714c('0x1e')]?_0x40d586['options'][_0x714c('0x20')]||null:null})[_0x714c('0x11')](function(_0x40e63f){if(_0x40e63f){return _0x40e63f[_0x714c('0x23')](_0x40d586[_0x714c('0x1d')]['ids'],_[_0x714c('0x24')](_0x40d586['body'],[_0x714c('0x25'),'id'])||{});}})[_0x714c('0x26')](function(_0x5dd663){logger['info'](_0x714c('0x27'),_0x40d586);logger[_0x714c('0x14')](_0x714c('0x27'),_0x40d586,JSON[_0x714c('0x17')](_0x5dd663));_0x176e5b(_0x5dd663);})['catch'](function(_0x62ada8){logger['error'](_0x714c('0x27'),_0x62ada8['message'],_0x40d586);_0xff9787(_this[_0x714c('0x18')](0x1f4,_0x62ada8['message']));});});}; \ No newline at end of file +var _0x2f95=['catch','UpdateWhatsappInteraction','WhatsappInteraction','options','where','attributes','limit','then','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x51ffeb,_0x3e7fcb){var _0x3f8201=function(_0x253e58){while(--_0x253e58){_0x51ffeb['push'](_0x51ffeb['shift']());}};_0x3f8201(++_0x3e7fcb);}(_0x2f95,0x180));var _0x52f9=function(_0x2755e6,_0x50a38e){_0x2755e6=_0x2755e6-0x0;var _0x383f97=_0x2f95[_0x2755e6];return _0x383f97;};'use strict';var _=require(_0x52f9('0x0'));var util=require(_0x52f9('0x1'));var moment=require(_0x52f9('0x2'));var BPromise=require(_0x52f9('0x3'));var rs=require(_0x52f9('0x4'));var fs=require('fs');var Redis=require(_0x52f9('0x5'));var db=require(_0x52f9('0x6'))['db'];var utils=require(_0x52f9('0x7'));var logger=require(_0x52f9('0x8'))(_0x52f9('0x9'));var config=require(_0x52f9('0xa'));var jayson=require(_0x52f9('0xb'));var client=jayson[_0x52f9('0xc')]['http']({'port':0x232a});config['redis']=_[_0x52f9('0xd')](config['redis'],{'host':_0x52f9('0xe'),'port':0x18eb});var socket=require(_0x52f9('0xf'))(new Redis(config[_0x52f9('0x10')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x637220,_0x706437,_0x242019){return new BPromise(function(_0x5d6ca0,_0x2f1b4c){return client['request'](_0x637220,_0x242019)['then'](function(_0x218003){logger[_0x52f9('0x11')](_0x52f9('0x12'),_0x706437,_0x52f9('0x13'));logger[_0x52f9('0x14')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x706437,_0x52f9('0x13'),JSON[_0x52f9('0x15')](_0x218003));if(_0x218003[_0x52f9('0x16')]){if(_0x218003['error'][_0x52f9('0x17')]===0x1f4){logger[_0x52f9('0x16')](_0x52f9('0x12'),_0x706437,_0x218003[_0x52f9('0x16')][_0x52f9('0x18')]);return _0x2f1b4c(_0x218003[_0x52f9('0x16')][_0x52f9('0x18')]);}logger[_0x52f9('0x16')](_0x52f9('0x12'),_0x706437,_0x218003[_0x52f9('0x16')][_0x52f9('0x18')]);return _0x5d6ca0(_0x218003[_0x52f9('0x16')]['message']);}else{logger[_0x52f9('0x11')](_0x52f9('0x12'),_0x706437,_0x52f9('0x13'));_0x5d6ca0(_0x218003[_0x52f9('0x19')][_0x52f9('0x18')]);}})[_0x52f9('0x1a')](function(_0x2f6072){logger[_0x52f9('0x16')](_0x52f9('0x12'),_0x706437,_0x2f6072);_0x2f1b4c(_0x2f6072);});});}exports[_0x52f9('0x1b')]=function(_0x520e4e){var _0x268bb6=this;return new Promise(function(_0xc66dba,_0x489de1){return db[_0x52f9('0x1c')]['update'](_0x520e4e['body'],{'raw':_0x520e4e[_0x52f9('0x1d')]?_0x520e4e[_0x52f9('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x520e4e[_0x52f9('0x1d')]?_0x520e4e[_0x52f9('0x1d')][_0x52f9('0x1e')]||null:null,'attributes':_0x520e4e['options']?_0x520e4e[_0x52f9('0x1d')][_0x52f9('0x1f')]||null:null,'limit':_0x520e4e[_0x52f9('0x1d')]?_0x520e4e[_0x52f9('0x1d')][_0x52f9('0x20')]||null:null})[_0x52f9('0x21')](function(_0x2a80ee){logger[_0x52f9('0x11')]('UpdateWhatsappInteraction',_0x520e4e);logger[_0x52f9('0x14')]('UpdateWhatsappInteraction',_0x520e4e,JSON[_0x52f9('0x15')](_0x2a80ee));_0xc66dba(_0x2a80ee);})[_0x52f9('0x1a')](function(_0x5b6ac9){logger[_0x52f9('0x16')](_0x52f9('0x1b'),_0x5b6ac9[_0x52f9('0x18')],_0x520e4e);_0x489de1(_0x268bb6[_0x52f9('0x16')](0x1f4,_0x5b6ac9['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x297917){return new Promise(function(_0x3df452,_0x20ca7a){return db[_0x52f9('0x1c')][_0x52f9('0x22')]({'where':_0x297917[_0x52f9('0x1d')]?_0x297917['options'][_0x52f9('0x1e')]||null:null})[_0x52f9('0x21')](function(_0x523a3c){if(_0x523a3c){return _0x523a3c[_0x52f9('0x23')](_0x297917[_0x52f9('0x24')][_0x52f9('0x25')],_[_0x52f9('0x26')](_0x297917['body'],[_0x52f9('0x25'),'id'])||{});}})[_0x52f9('0x27')](function(_0x50e685){logger[_0x52f9('0x11')](_0x52f9('0x28'),_0x297917);logger[_0x52f9('0x14')]('AddTags',_0x297917,JSON[_0x52f9('0x15')](_0x50e685));_0x3df452(_0x50e685);})['catch'](function(_0x6f0ab8){logger[_0x52f9('0x16')](_0x52f9('0x28'),_0x6f0ab8[_0x52f9('0x18')],_0x297917);_0x20ca7a(_this['error'](0x1f4,_0x6f0ab8[_0x52f9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 1f73d6f..53d9030 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 _0xf64a=['./whatsappInteraction.events','save','remove','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x1029b7,_0x4c871c){var _0x240c63=function(_0x110526){while(--_0x110526){_0x1029b7['push'](_0x1029b7['shift']());}};_0x240c63(++_0x4c871c);}(_0xf64a,0x1c8));var _0xaf64=function(_0x152449,_0x49f41d){_0x152449=_0x152449-0x0;var _0x5b58b2=_0xf64a[_0x152449];return _0x5b58b2;};'use strict';var WhatsappInteractionEvents=require(_0xaf64('0x0'));var events=[_0xaf64('0x1'),_0xaf64('0x2'),'update'];function createListener(_0x4dbc8b,_0x198e38){return function(_0x1a5bfe){_0x198e38[_0xaf64('0x3')](_0x4dbc8b,_0x1a5bfe);};}function removeListener(_0x4d4bd3,_0x114b45){return function(){WhatsappInteractionEvents[_0xaf64('0x4')](_0x4d4bd3,_0x114b45);};}exports[_0xaf64('0x5')]=function(_0x1b0f15){for(var _0x3b4e52=0x0,_0xab0836=events[_0xaf64('0x6')];_0x3b4e52<_0xab0836;_0x3b4e52++){var _0x517463=events[_0x3b4e52];var _0x1619f0=createListener(_0xaf64('0x7')+_0x517463,_0x1b0f15);WhatsappInteractionEvents['on'](_0x517463,_0x1619f0);}}; \ No newline at end of file +var _0x29ba=['removeListener','register','length','whatsappInteraction:','remove','update'];(function(_0x286633,_0x27159e){var _0x4aa6f0=function(_0x199b8a){while(--_0x199b8a){_0x286633['push'](_0x286633['shift']());}};_0x4aa6f0(++_0x27159e);}(_0x29ba,0xe8));var _0xa29b=function(_0x359377,_0x1a63ef){_0x359377=_0x359377-0x0;var _0x8be18a=_0x29ba[_0x359377];return _0x8be18a;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0xa29b('0x0'),_0xa29b('0x1')];function createListener(_0x3a2322,_0x821632){return function(_0x2e9e8d){_0x821632['emit'](_0x3a2322,_0x2e9e8d);};}function removeListener(_0x2d8b18,_0xfac1de){return function(){WhatsappInteractionEvents[_0xa29b('0x2')](_0x2d8b18,_0xfac1de);};}exports[_0xa29b('0x3')]=function(_0x4c98df){for(var _0x119066=0x0,_0x1d122c=events[_0xa29b('0x4')];_0x119066<_0x1d122c;_0x119066++){var _0x3c8a56=events[_0x119066];var _0x2036d8=createListener(_0xa29b('0x5')+_0x3c8a56,_0x4c98df);WhatsappInteractionEvents['on'](_0x3c8a56,_0x2036d8);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index c05e932..1b30361 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 _0xf25e=['whatsapp','whatsappmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','/:id','show','post'];(function(_0x4c6686,_0x2d0a4f){var _0x290d50=function(_0x4bf4c4){while(--_0x4bf4c4){_0x4c6686['push'](_0x4c6686['shift']());}};_0x290d50(++_0x2d0a4f);}(_0xf25e,0x184));var _0xef25=function(_0x5a98e5,_0xeed17a){_0x5a98e5=_0x5a98e5-0x0;var _0x37cf7a=_0xf25e[_0x5a98e5];return _0x37cf7a;};'use strict';var multer=require(_0xef25('0x0'));var util=require(_0xef25('0x1'));var path=require(_0xef25('0x2'));var timeout=require(_0xef25('0x3'));var express=require(_0xef25('0x4'));var router=express[_0xef25('0x5')]();var fs_extra=require(_0xef25('0x6'));var auth=require(_0xef25('0x7'));var interaction=require(_0xef25('0x8'));var config=require(_0xef25('0x9'));var controller=require(_0xef25('0xa'));router[_0xef25('0xb')]('/',auth[_0xef25('0xc')](),controller['index']);router[_0xef25('0xb')](_0xef25('0xd'),auth[_0xef25('0xc')](),controller['describe']);router[_0xef25('0xb')](_0xef25('0xe'),auth['isAuthenticated'](),controller[_0xef25('0xf')]);router[_0xef25('0x10')]('/',auth[_0xef25('0xc')](),interaction['tracked'](_0xef25('0x11'),_0xef25('0x12')),controller[_0xef25('0x13')]);router[_0xef25('0x10')]('/:id/status',controller['status']);router[_0xef25('0x14')](_0xef25('0xe'),auth[_0xef25('0xc')](),controller[_0xef25('0x15')]);router[_0xef25('0x14')](_0xef25('0x16'),auth[_0xef25('0xc')](),controller[_0xef25('0x17')]);router[_0xef25('0x14')](_0xef25('0x18'),auth[_0xef25('0xc')](),controller['reject']);router[_0xef25('0x19')](_0xef25('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xef25('0x1a')]=router; \ No newline at end of file +var _0x1a52=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','post','whatsapp','whatsappmessage:create','create','/:id/status','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','express'];(function(_0x1e4180,_0x4d8d35){var _0x86f6e7=function(_0x50e840){while(--_0x50e840){_0x1e4180['push'](_0x1e4180['shift']());}};_0x86f6e7(++_0x4d8d35);}(_0x1a52,0x130));var _0x21a5=function(_0x35f1f5,_0x162028){_0x35f1f5=_0x35f1f5-0x0;var _0x40e9f9=_0x1a52[_0x35f1f5];return _0x40e9f9;};'use strict';var multer=require(_0x21a5('0x0'));var util=require(_0x21a5('0x1'));var path=require(_0x21a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x21a5('0x3'));var router=express[_0x21a5('0x4')]();var fs_extra=require(_0x21a5('0x5'));var auth=require(_0x21a5('0x6'));var interaction=require(_0x21a5('0x7'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0x21a5('0x8')]('/',auth['isAuthenticated'](),controller[_0x21a5('0x9')]);router[_0x21a5('0x8')](_0x21a5('0xa'),auth[_0x21a5('0xb')](),controller[_0x21a5('0xc')]);router['get'](_0x21a5('0xd'),auth[_0x21a5('0xb')](),controller[_0x21a5('0xe')]);router[_0x21a5('0xf')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x21a5('0x10'),_0x21a5('0x11')),controller[_0x21a5('0x12')]);router[_0x21a5('0xf')](_0x21a5('0x13'),controller['status']);router[_0x21a5('0x14')](_0x21a5('0xd'),auth[_0x21a5('0xb')](),controller[_0x21a5('0x15')]);router[_0x21a5('0x14')](_0x21a5('0x16'),auth['isAuthenticated'](),controller[_0x21a5('0x17')]);router[_0x21a5('0x14')](_0x21a5('0x18'),auth[_0x21a5('0xb')](),controller['reject']);router[_0x21a5('0x19')]('/:id',auth[_0x21a5('0xb')](),controller[_0x21a5('0x1a')]);module[_0x21a5('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 9dd9a63..85d4e8d 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 _0x1ff9=['TEXT','BOOLEAN','out','DATE','STRING','sequelize','exports'];(function(_0x577d79,_0x446fa7){var _0x72c474=function(_0xce678d){while(--_0xce678d){_0x577d79['push'](_0x577d79['shift']());}};_0x72c474(++_0x446fa7);}(_0x1ff9,0x15c));var _0x91ff=function(_0x22e90b,_0x369648){_0x22e90b=_0x22e90b-0x0;var _0x1950f2=_0x1ff9[_0x22e90b];return _0x1950f2;};'use strict';var Sequelize=require(_0x91ff('0x0'));module[_0x91ff('0x1')]={'body':{'type':Sequelize[_0x91ff('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x91ff('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x91ff('0x4')),'defaultValue':_0x91ff('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x91ff('0x5')]},'secret':{'type':Sequelize[_0x91ff('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x91ff('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xeb00=['STRING','DATE','TEXT','sequelize','exports','BOOLEAN','ENUM','out'];(function(_0xe07686,_0xd36d8e){var _0x1e41a3=function(_0x39124b){while(--_0x39124b){_0xe07686['push'](_0xe07686['shift']());}};_0x1e41a3(++_0xd36d8e);}(_0xeb00,0x1bb));var _0x0eb0=function(_0x2f3fdb,_0x5854f2){_0x2f3fdb=_0x2f3fdb-0x0;var _0x8d3b0b=_0xeb00[_0x2f3fdb];return _0x8d3b0b;};'use strict';var Sequelize=require(_0x0eb0('0x0'));module[_0x0eb0('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x0eb0('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0eb0('0x3')]('in',_0x0eb0('0x4')),'defaultValue':_0x0eb0('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0eb0('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x0eb0('0x6')]},'secret':{'type':Sequelize[_0x0eb0('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0eb0('0x5')]},'providerResponse':{'type':Sequelize[_0x0eb0('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index eb229b6..98c43ad 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 _0x42a9=['request-promise','bluebird','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','offset','undefined','limit','count','save','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappMessage','includeAll','include','findAll','keys','find','catch','create','body','update','params','describe','../../config/logger','accept','whatsapp','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','isNil','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','User','manual','interface','format','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','whatsapp-interactions','reject','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','QueryTypes','fullname','email','internal','rejectmessage','WhatsappAccount','WhatsappAccountId','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','rimraf','fast-json-patch'];(function(_0x5c2796,_0x2882fe){var _0x4b4088=function(_0x89893){while(--_0x89893){_0x5c2796['push'](_0x5c2796['shift']());}};_0x4b4088(++_0x2882fe);}(_0x42a9,0x190));var _0x942a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x42a9[_0x46698a];return _0x356db0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x942a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x942a('0x1'));var rp=require(_0x942a('0x2'));var moment=require('moment');var BPromise=require(_0x942a('0x3'));var Mustache=require('mustache');var util=require(_0x942a('0x4'));var path=require('path');var sox=require(_0x942a('0x5'));var csv=require('to-csv');var ejs=require(_0x942a('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x942a('0x7'));var crypto=require(_0x942a('0x8'));var jsforce=require(_0x942a('0x9'));var deskjs=require(_0x942a('0xa'));var toCsv=require(_0x942a('0xb'));var querystring=require('querystring');var Papa=require(_0x942a('0xc'));var Redis=require('ioredis');var authService=require(_0x942a('0xd'));var qs=require(_0x942a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x942a('0xf'));var logger=require('../../config/logger')(_0x942a('0x10'));var utils=require(_0x942a('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x942a('0x12'));var db=require('../../mysqldb')['db'];config[_0x942a('0x13')]=_[_0x942a('0x14')](config[_0x942a('0x13')],{'host':_0x942a('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x942a('0x13')]));require(_0x942a('0x16'))[_0x942a('0x17')](socket);var jayson=require(_0x942a('0x18'));var client=jayson[_0x942a('0x19')][_0x942a('0x1a')]({'port':0x232c});var client9002=jayson[_0x942a('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6cdb41,_0xe1c520,_0x338472,_0x3cc460){return new BPromise(function(_0x49c301,_0x479f2c){var _0x260802=_0x3cc460||client;return _0x260802[_0x942a('0x1b')](_0x6cdb41,_0x338472)[_0x942a('0x1c')](function(_0x1152b9){logger[_0x942a('0x1d')](_0x942a('0x1e'),_0xe1c520,_0x942a('0x1f'));logger[_0x942a('0x20')](_0x942a('0x21'),_0xe1c520,_0x942a('0x1f'),JSON[_0x942a('0x22')](_0x1152b9));if(_0x1152b9[_0x942a('0x23')]){if(_0x1152b9[_0x942a('0x23')][_0x942a('0x24')]===0x1f4){logger[_0x942a('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0xe1c520,_0x1152b9[_0x942a('0x23')][_0x942a('0x25')]);return _0x479f2c(_0x1152b9[_0x942a('0x23')][_0x942a('0x25')]);}logger[_0x942a('0x23')](_0x942a('0x1e'),_0xe1c520,_0x1152b9[_0x942a('0x23')][_0x942a('0x25')]);return _0x49c301(_0x1152b9[_0x942a('0x23')]['message']);}else{logger[_0x942a('0x1d')](_0x942a('0x1e'),_0xe1c520,'request\x20sent');_0x49c301(_0x1152b9[_0x942a('0x26')]['message']);}})['catch'](function(_0x52c021){logger[_0x942a('0x23')](_0x942a('0x1e'),_0xe1c520,_0x52c021);_0x479f2c(_0x52c021);});});}function respondWithStatusCode(_0x194be7,_0x779d28){_0x779d28=_0x779d28||0xcc;return function(_0x17af62){if(_0x17af62){return _0x194be7['sendStatus'](_0x779d28);}return _0x194be7[_0x942a('0x27')](_0x779d28)[_0x942a('0x28')]();};}function respondWithResult(_0x575a08,_0x31dacc){_0x31dacc=_0x31dacc||0xc8;return function(_0x1e57ae){if(_0x1e57ae){return _0x575a08[_0x942a('0x27')](_0x31dacc)[_0x942a('0x29')](_0x1e57ae);}};}function respondWithFilteredResult(_0x479dfd,_0x43fc29){return function(_0x571629){if(_0x571629){var _0x34de76=typeof _0x43fc29[_0x942a('0x2a')]===_0x942a('0x2b')&&typeof _0x43fc29[_0x942a('0x2c')]==='undefined';var _0x381178=_0x571629[_0x942a('0x2d')];var _0x21565c=_0x34de76?0x0:_0x43fc29[_0x942a('0x2a')];var _0x11074d=_0x34de76?_0x571629[_0x942a('0x2d')]:_0x43fc29[_0x942a('0x2a')]+_0x43fc29[_0x942a('0x2c')];var _0x2b2571;if(_0x11074d>=_0x381178){_0x11074d=_0x381178;_0x2b2571=0xc8;}else{_0x2b2571=0xce;}_0x479dfd[_0x942a('0x27')](_0x2b2571);return _0x479dfd['set']('Content-Range',_0x21565c+'-'+_0x11074d+'/'+_0x381178)[_0x942a('0x29')](_0x571629);}return null;};}function patchUpdates(_0x455795){return function(_0x4ba8c3){try{jsonpatch['apply'](_0x4ba8c3,_0x455795,!![]);}catch(_0x464f88){return BPromise['reject'](_0x464f88);}return _0x4ba8c3[_0x942a('0x2e')]();};}function saveUpdates(_0x598bf3,_0x226879){return function(_0x166cab){if(_0x166cab){return _0x166cab['update'](_0x598bf3)[_0x942a('0x1c')](function(_0x4b9147){return _0x4b9147;});}return null;};}function removeEntity(_0x4200d3,_0x19251c){return function(_0x591b6b){if(_0x591b6b){return _0x591b6b[_0x942a('0x2f')]()['then'](function(){_0x4200d3[_0x942a('0x27')](0xcc)[_0x942a('0x28')]();});}};}function handleEntityNotFound(_0x8daef0,_0x56db3e){return function(_0xf4f383){if(!_0xf4f383){_0x8daef0[_0x942a('0x30')](0x194);}return _0xf4f383;};}function handleError(_0x41ad61,_0x1c7215){_0x1c7215=_0x1c7215||0x1f4;return function(_0x4b7c41){logger['error'](_0x4b7c41[_0x942a('0x31')]);if(_0x4b7c41[_0x942a('0x32')]){delete _0x4b7c41[_0x942a('0x32')];}_0x41ad61[_0x942a('0x27')](_0x1c7215)[_0x942a('0x33')](_0x4b7c41);};}exports[_0x942a('0x34')]=function(_0x184b9d,_0x2f36b7){var _0x110f79={},_0x2799f8={},_0x4b87c3={'count':0x0,'rows':[]};var _0x2d34a5=_[_0x942a('0x35')](db['WhatsappMessage'][_0x942a('0x36')],function(_0x2bdb4d){return{'name':_0x2bdb4d[_0x942a('0x37')],'type':_0x2bdb4d[_0x942a('0x38')]['key']};});_0x2799f8[_0x942a('0x39')]=_[_0x942a('0x35')](_0x2d34a5,_0x942a('0x32'));_0x2799f8[_0x942a('0x3a')]=_['keys'](_0x184b9d[_0x942a('0x3a')]);_0x2799f8[_0x942a('0x3b')]=_[_0x942a('0x3c')](_0x2799f8['model'],_0x2799f8[_0x942a('0x3a')]);_0x110f79[_0x942a('0x3d')]=_[_0x942a('0x3c')](_0x2799f8[_0x942a('0x39')],qs[_0x942a('0x3e')](_0x184b9d[_0x942a('0x3a')][_0x942a('0x3e')]));_0x110f79[_0x942a('0x3d')]=_0x110f79['attributes'][_0x942a('0x3f')]?_0x110f79['attributes']:_0x2799f8[_0x942a('0x39')];if(!_0x184b9d[_0x942a('0x3a')]['hasOwnProperty']('nolimit')){_0x110f79['limit']=qs[_0x942a('0x2c')](_0x184b9d['query'][_0x942a('0x2c')]);_0x110f79[_0x942a('0x2a')]=qs[_0x942a('0x2a')](_0x184b9d[_0x942a('0x3a')][_0x942a('0x2a')]);}_0x110f79[_0x942a('0x40')]=qs[_0x942a('0x41')](_0x184b9d[_0x942a('0x3a')][_0x942a('0x41')]);_0x110f79[_0x942a('0x42')]=qs[_0x942a('0x3b')](_[_0x942a('0x43')](_0x184b9d['query'],_0x2799f8[_0x942a('0x3b')]),_0x2d34a5);if(_0x184b9d['query'][_0x942a('0x44')]){_0x110f79['where']=_[_0x942a('0x45')](_0x110f79[_0x942a('0x42')],{'$or':_[_0x942a('0x35')](_0x2d34a5,function(_0x1a462a){if(_0x1a462a[_0x942a('0x38')]!==_0x942a('0x46')){var _0x183f84={};_0x183f84[_0x1a462a[_0x942a('0x32')]]={'$like':'%'+_0x184b9d[_0x942a('0x3a')]['filter']+'%'};return _0x183f84;}})});}_0x110f79=_[_0x942a('0x45')]({},_0x110f79,_0x184b9d[_0x942a('0x47')]);var _0x24ebf0={'where':_0x110f79[_0x942a('0x42')]};return db[_0x942a('0x48')][_0x942a('0x2d')](_0x24ebf0)[_0x942a('0x1c')](function(_0x33495e){_0x4b87c3[_0x942a('0x2d')]=_0x33495e;if(_0x184b9d[_0x942a('0x3a')][_0x942a('0x49')]){_0x110f79[_0x942a('0x4a')]=[{'all':!![]}];}return db[_0x942a('0x48')][_0x942a('0x4b')](_0x110f79);})[_0x942a('0x1c')](function(_0x470a53){_0x4b87c3['rows']=_0x470a53;return _0x4b87c3;})[_0x942a('0x1c')](respondWithFilteredResult(_0x2f36b7,_0x110f79))['catch'](handleError(_0x2f36b7,null));};exports['show']=function(_0x3c2b07,_0x27e62a){var _0x349935={'raw':!![],'where':{'id':_0x3c2b07['params']['id']}},_0x217319={};_0x217319[_0x942a('0x39')]=_[_0x942a('0x4c')](db[_0x942a('0x48')][_0x942a('0x36')]);_0x217319[_0x942a('0x3a')]=_['keys'](_0x3c2b07[_0x942a('0x3a')]);_0x217319[_0x942a('0x3b')]=_[_0x942a('0x3c')](_0x217319[_0x942a('0x39')],_0x217319[_0x942a('0x3a')]);_0x349935[_0x942a('0x3d')]=_[_0x942a('0x3c')](_0x217319[_0x942a('0x39')],qs[_0x942a('0x3e')](_0x3c2b07['query'][_0x942a('0x3e')]));_0x349935['attributes']=_0x349935[_0x942a('0x3d')][_0x942a('0x3f')]?_0x349935[_0x942a('0x3d')]:_0x217319['model'];if(_0x3c2b07[_0x942a('0x3a')]['includeAll']){_0x349935['include']=[{'all':!![]}];}_0x349935=_[_0x942a('0x45')]({},_0x349935,_0x3c2b07[_0x942a('0x47')]);return db[_0x942a('0x48')][_0x942a('0x4d')](_0x349935)[_0x942a('0x1c')](handleEntityNotFound(_0x27e62a,null))[_0x942a('0x1c')](respondWithResult(_0x27e62a,null))[_0x942a('0x4e')](handleError(_0x27e62a,null));};exports[_0x942a('0x4f')]=function(_0x11520c,_0x334d67){return db['WhatsappMessage'][_0x942a('0x4f')](_0x11520c[_0x942a('0x50')],{})['then'](respondWithResult(_0x334d67,0xc9))[_0x942a('0x4e')](handleError(_0x334d67,null));};exports[_0x942a('0x51')]=function(_0xbbc948,_0xa831a4){if(_0xbbc948['body']['id']){delete _0xbbc948[_0x942a('0x50')]['id'];}return db[_0x942a('0x48')][_0x942a('0x4d')]({'where':{'id':_0xbbc948[_0x942a('0x52')]['id']}})[_0x942a('0x1c')](handleEntityNotFound(_0xa831a4,null))[_0x942a('0x1c')](saveUpdates(_0xbbc948[_0x942a('0x50')],null))[_0x942a('0x1c')](respondWithResult(_0xa831a4,null))[_0x942a('0x4e')](handleError(_0xa831a4,null));};exports['destroy']=function(_0xe6b915,_0x23c014){return db[_0x942a('0x48')][_0x942a('0x4d')]({'where':{'id':_0xe6b915['params']['id']}})[_0x942a('0x1c')](handleEntityNotFound(_0x23c014,null))[_0x942a('0x1c')](removeEntity(_0x23c014,null))['catch'](handleError(_0x23c014,null));};exports[_0x942a('0x53')]=function(_0x230c94,_0x4b770e){return db[_0x942a('0x48')][_0x942a('0x53')]()[_0x942a('0x1c')](respondWithResult(_0x4b770e,null))[_0x942a('0x4e')](handleError(_0x4b770e,null));};var interaction_log=require(_0x942a('0x54'))('whatsapp-interactions');exports[_0x942a('0x55')]=function(_0x317bd9,_0x15448d,_0x20b2f6){var _0x2df7fe={'agent':{},'channel':_0x942a('0x56')};if(_0x317bd9[_0x942a('0x50')]['id']){delete _0x317bd9[_0x942a('0x50')]['id'];}_0x317bd9[_0x942a('0x50')][_0x942a('0x57')]=!![];_0x317bd9[_0x942a('0x50')]['readAt']=moment()['format'](_0x942a('0x58'));_0x317bd9[_0x942a('0x50')][_0x942a('0x59')]=_0x317bd9[_0x942a('0x50')][_0x942a('0x59')]||_0x317bd9[_0x942a('0x5a')]['id'];_0x2df7fe[_0x942a('0x5b')]['id']=_0x317bd9[_0x942a('0x50')]['UserId'];return db[_0x942a('0x48')][_0x942a('0x4d')]({'where':{'id':_0x317bd9[_0x942a('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x15448d,null))[_0x942a('0x1c')](saveUpdates(_0x317bd9['body'],null))[_0x942a('0x1c')](function(_0x350e37){if(_0x350e37){_0x2df7fe[_0x942a('0x25')]=_0x350e37[_0x942a('0x5c')]({'plain':!![]});return db[_0x942a('0x5d')][_0x942a('0x4d')]({'where':{'id':_0x350e37['WhatsappInteractionId']}});}return null;})[_0x942a('0x1c')](handleEntityNotFound(_0x15448d,null))[_0x942a('0x1c')](function(_0x386fce){if(_0x386fce){return _0x386fce[_0x942a('0x51')]({'UserId':_0x317bd9[_0x942a('0x50')]['UserId'],'read1stAt':_[_0x942a('0x5e')](_0x386fce['read1stAt'])?moment()['format'](_0x942a('0x58')):undefined});}return null;})[_0x942a('0x1c')](function(_0x1cdd1a){if(_0x1cdd1a){_0x2df7fe[_0x942a('0x5f')]=_0x1cdd1a[_0x942a('0x5c')]({'plain':!![]});interaction_log['info'](_0x942a('0x60'),_0x317bd9[_0x942a('0x5a')]['id'],_0x317bd9[_0x942a('0x5a')][_0x942a('0x32')],_0x317bd9['user'][_0x942a('0x61')],_0x2df7fe[_0x942a('0x5f')]['id'],_0x317bd9[_0x942a('0x50')]?JSON[_0x942a('0x22')](_0x317bd9[_0x942a('0x50')]):_0x942a('0x62'));return respondWithRpcPromise(_0x942a('0x63'),_0x942a('0x64'),_0x2df7fe);}return null;})['then'](function(_0x46a90b){var _0x48d60b=_0x942a('0x65')+_0x46a90b['message']['ContactId'];return db[_0x942a('0x66')][_0x942a('0x3a')](_0x48d60b,{'type':db[_0x942a('0x67')]['QueryTypes'][_0x942a('0x68')],'raw':!![]})[_0x942a('0x1c')](function(_0x58404f){return _0x58404f;});})[_0x942a('0x1c')](function(_0x3817a9){if(_0x3817a9){_0x2df7fe[_0x942a('0x25')][_0x942a('0x69')]=_0x3817a9[0x0];if(!_0x317bd9['body']['UserId'])return;return db[_0x942a('0x6a')][_0x942a('0x4d')]({'where':{'id':_0x317bd9[_0x942a('0x50')][_0x942a('0x59')],'role':_0x942a('0x5b')},'attributes':['id','name','fullname','email','internal'],'raw':!![]});}return null;})[_0x942a('0x1c')](function(_0x446815){if(!_0x446815)return null;_0x2df7fe[_0x942a('0x25')][_0x942a('0x5b')]=_0x446815;return _0x2df7fe;})[_0x942a('0x1c')](function(_0x29c6cb){if(_0x29c6cb){if(_0x317bd9['body'][_0x942a('0x6b')]){_0x2df7fe[_0x942a('0x25')][_0x942a('0x6c')]=util[_0x942a('0x6d')](_0x942a('0x6e'),_0x317bd9['user'][_0x942a('0x32')]);_0x2df7fe[_0x942a('0x25')][_0x942a('0x6f')]=_0x2df7fe[_0x942a('0x6f')];_0x2df7fe[_0x942a('0x25')][_0x942a('0x70')]=_0x2df7fe[_0x942a('0x6f')];_0x2df7fe[_0x942a('0x25')][_0x942a('0x71')]=_0x942a('0x55');return respondWithRpcPromise(_0x942a('0x72'),_0x942a('0x72'),{'event':_0x942a('0x73'),'message':_0x2df7fe[_0x942a('0x25')]},client9002)[_0x942a('0x1c')](function(){return _0x2df7fe;});}return _0x2df7fe;}return null;})['then'](respondWithResult(_0x15448d,null))[_0x942a('0x4e')](handleError(_0x15448d,null));};var interaction_log=require(_0x942a('0x54'))(_0x942a('0x74'));exports[_0x942a('0x75')]=function(_0x457006,_0x241751,_0x4474ec){var _0x41af62={'agent':{},'channel':'whatsapp'};if(_0x457006[_0x942a('0x50')]['id']){delete _0x457006[_0x942a('0x50')]['id'];}_0x457006[_0x942a('0x50')][_0x942a('0x59')]=_0x457006[_0x942a('0x50')][_0x942a('0x59')]||_0x457006[_0x942a('0x5a')]['id'];_0x41af62['agent']['id']=_0x457006[_0x942a('0x50')][_0x942a('0x59')];return db['WhatsappMessage'][_0x942a('0x4d')]({'where':{'id':_0x457006[_0x942a('0x52')]['id'],'UserId':null}})[_0x942a('0x1c')](handleEntityNotFound(_0x241751,null))[_0x942a('0x1c')](function(_0x446b10){if(_0x446b10){_0x41af62[_0x942a('0x25')]=_0x446b10['get']({'plain':!![]});return db[_0x942a('0x5d')][_0x942a('0x4d')]({'where':{'id':_0x446b10[_0x942a('0x76')]}});}return null;})[_0x942a('0x1c')](handleEntityNotFound(_0x241751,null))['then'](function(_0x2e327d){if(_0x2e327d){_0x41af62[_0x942a('0x5f')]=_0x2e327d[_0x942a('0x5c')]({'plain':!![]});interaction_log[_0x942a('0x1d')](_0x942a('0x77'),_0x457006[_0x942a('0x5a')]['id'],_0x457006[_0x942a('0x5a')][_0x942a('0x32')],_0x457006['user'][_0x942a('0x61')],_0x41af62[_0x942a('0x5f')]['id'],_0x457006[_0x942a('0x50')]?JSON['stringify'](_0x457006[_0x942a('0x50')]):_0x942a('0x62'));return respondWithRpcPromise(_0x942a('0x78'),_0x942a('0x79'),_0x41af62);}return null;})[_0x942a('0x1c')](function(_0x5a976a){var _0x21dbe0=_0x942a('0x65')+_0x5a976a[_0x942a('0x25')]['ContactId'];return db[_0x942a('0x66')]['query'](_0x21dbe0,{'type':db[_0x942a('0x67')][_0x942a('0x7a')][_0x942a('0x68')],'raw':!![]})[_0x942a('0x1c')](function(_0x5ae304){return _0x5ae304;});})['then'](function(_0x1309f1){if(_0x1309f1){_0x41af62[_0x942a('0x25')]['contact']=_0x1309f1[0x0];if(!_0x457006[_0x942a('0x50')][_0x942a('0x59')])return;return db['User'][_0x942a('0x4d')]({'where':{'id':_0x457006[_0x942a('0x50')][_0x942a('0x59')],'role':'agent'},'attributes':['id','name',_0x942a('0x7b'),_0x942a('0x7c'),_0x942a('0x7d')],'raw':!![]});}return null;})[_0x942a('0x1c')](function(_0xf735a2){if(!_0xf735a2)return null;_0x41af62[_0x942a('0x25')][_0x942a('0x5b')]=_0xf735a2;return _0x41af62;})[_0x942a('0x1c')](function(_0x2f4341){if(_0x2f4341){_0x2f4341[_0x942a('0x25')][_0x942a('0x6c')]=util['format'](_0x942a('0x6e'),_0x457006[_0x942a('0x5a')][_0x942a('0x32')]);_0x2f4341[_0x942a('0x25')][_0x942a('0x6f')]=_0x41af62[_0x942a('0x6f')];_0x2f4341[_0x942a('0x25')]['motionChannel']=_0x41af62['channel'];_0x2f4341[_0x942a('0x25')]['event']=_0x942a('0x75');respondWithRpcPromise(_0x942a('0x72'),_0x942a('0x72'),{'event':_0x942a('0x7e'),'message':_0x2f4341[_0x942a('0x25')]},client9002);return _0x41af62;}return null;})[_0x942a('0x1c')](respondWithResult(_0x241751,null))['catch'](handleError(_0x241751,null));};exports[_0x942a('0x27')]=function(_0x5af4fd,_0x211e33,_0x4ab69c){if(_0x5af4fd['body']['id']){delete _0x5af4fd[_0x942a('0x50')]['id'];}var _0x4b0b37;return db[_0x942a('0x48')]['find']({'where':{'id':_0x5af4fd[_0x942a('0x52')]['id']}})['then'](handleEntityNotFound(_0x211e33,null))[_0x942a('0x1c')](function(_0x462f80){if(_0x462f80){_0x4b0b37=_0x462f80;return db[_0x942a('0x7f')][_0x942a('0x4d')]({'where':{'id':_0x462f80[_0x942a('0x80')]}});}})[_0x942a('0x1c')](handleEntityNotFound(_0x211e33,null))['then'](function(_0x54d9e5){if(_0x54d9e5){logger[_0x942a('0x20')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x942a('0x27'),'received\x20delivery\x20report\x20from',_0x54d9e5[_0x942a('0x38')],util['inspect'](_0x5af4fd['body'],{'showHidden':![],'depth':null}));switch(_0x54d9e5[_0x942a('0x38')]){case'twilio':if(_0x5af4fd['body'][_0x942a('0x81')]&&_0x5af4fd[_0x942a('0x50')]['MessageSid']===_0x4b0b37['messageId']&&_0x5af4fd[_0x942a('0x50')][_0x942a('0x82')]&&_0x5af4fd['body']['MessageStatus']===_0x942a('0x57')){return _0x4b0b37[_0x942a('0x51')]({'read':!![]});}else{logger[_0x942a('0x23')](_0x942a('0x83'),'status',_0x942a('0x84'),util[_0x942a('0x85')](_0x5af4fd[_0x942a('0x50')],{'showHidden':![],'depth':null}));}break;}return _0x4b0b37;}})['then'](respondWithResult(_0x211e33,null))[_0x942a('0x4e')](handleError(_0x211e33,null));}; \ No newline at end of file +var _0x0f3a=['desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','describe','whatsapp','read','format','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','channel','event','accept','EventManager','acceptmessage','whatsapp-interactions','RejectMessage','rejectMessage','contact','motionChannel','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x0f3a,0x193));var _0xa0f3=function(_0x2d993f,_0x482508){_0x2d993f=_0x2d993f-0x0;var _0x247c34=_0x0f3a[_0x2d993f];return _0x247c34;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa0f3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa0f3('0x1'));var rp=require('request-promise');var moment=require(_0xa0f3('0x2'));var BPromise=require(_0xa0f3('0x3'));var Mustache=require(_0xa0f3('0x4'));var util=require(_0xa0f3('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xa0f3('0x6'));var ejs=require(_0xa0f3('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa0f3('0x8'));var squel=require('squel');var crypto=require(_0xa0f3('0x9'));var jsforce=require(_0xa0f3('0xa'));var deskjs=require(_0xa0f3('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa0f3('0xc'));var Redis=require('ioredis');var authService=require(_0xa0f3('0xd'));var qs=require(_0xa0f3('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa0f3('0xf'));var logger=require(_0xa0f3('0x10'))(_0xa0f3('0x11'));var utils=require(_0xa0f3('0x12'));var config=require(_0xa0f3('0x13'));var licenseUtil=require(_0xa0f3('0x14'));var db=require(_0xa0f3('0x15'))['db'];config[_0xa0f3('0x16')]=_[_0xa0f3('0x17')](config[_0xa0f3('0x16')],{'host':_0xa0f3('0x18'),'port':0x18eb});var socket=require(_0xa0f3('0x19'))(new Redis(config['redis']));require(_0xa0f3('0x1a'))[_0xa0f3('0x1b')](socket);var jayson=require(_0xa0f3('0x1c'));var client=jayson[_0xa0f3('0x1d')][_0xa0f3('0x1e')]({'port':0x232c});var client9002=jayson[_0xa0f3('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1209f4,_0x58a3d7,_0x1a068a,_0x278998){return new BPromise(function(_0x3a28a5,_0x20696f){var _0x52cdc6=_0x278998||client;return _0x52cdc6[_0xa0f3('0x1f')](_0x1209f4,_0x1a068a)[_0xa0f3('0x20')](function(_0x2a2297){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x58a3d7,_0xa0f3('0x21'));logger[_0xa0f3('0x22')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x58a3d7,'request\x20sent',JSON[_0xa0f3('0x23')](_0x2a2297));if(_0x2a2297['error']){if(_0x2a2297[_0xa0f3('0x24')][_0xa0f3('0x25')]===0x1f4){logger[_0xa0f3('0x24')](_0xa0f3('0x26'),_0x58a3d7,_0x2a2297[_0xa0f3('0x24')]['message']);return _0x20696f(_0x2a2297[_0xa0f3('0x24')]['message']);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x58a3d7,_0x2a2297[_0xa0f3('0x24')]['message']);return _0x3a28a5(_0x2a2297[_0xa0f3('0x24')][_0xa0f3('0x27')]);}else{logger[_0xa0f3('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x58a3d7,_0xa0f3('0x21'));_0x3a28a5(_0x2a2297['result'][_0xa0f3('0x27')]);}})[_0xa0f3('0x29')](function(_0x1dffaf){logger['error'](_0xa0f3('0x26'),_0x58a3d7,_0x1dffaf);_0x20696f(_0x1dffaf);});});}function respondWithStatusCode(_0x54f0af,_0x13ac5e){_0x13ac5e=_0x13ac5e||0xcc;return function(_0x29ec4f){if(_0x29ec4f){return _0x54f0af['sendStatus'](_0x13ac5e);}return _0x54f0af[_0xa0f3('0x2a')](_0x13ac5e)[_0xa0f3('0x2b')]();};}function respondWithResult(_0x178bb4,_0x382df6){_0x382df6=_0x382df6||0xc8;return function(_0x20906f){if(_0x20906f){return _0x178bb4[_0xa0f3('0x2a')](_0x382df6)[_0xa0f3('0x2c')](_0x20906f);}};}function respondWithFilteredResult(_0x23a7fe,_0x2f4111){return function(_0xf85766){if(_0xf85766){var _0x47becb=typeof _0x2f4111[_0xa0f3('0x2d')]===_0xa0f3('0x2e')&&typeof _0x2f4111['limit']===_0xa0f3('0x2e');var _0x1bf7bc=_0xf85766['count'];var _0x5c68a3=_0x47becb?0x0:_0x2f4111[_0xa0f3('0x2d')];var _0x143cf9=_0x47becb?_0xf85766[_0xa0f3('0x2f')]:_0x2f4111[_0xa0f3('0x2d')]+_0x2f4111[_0xa0f3('0x30')];var _0x38a629;if(_0x143cf9>=_0x1bf7bc){_0x143cf9=_0x1bf7bc;_0x38a629=0xc8;}else{_0x38a629=0xce;}_0x23a7fe['status'](_0x38a629);return _0x23a7fe[_0xa0f3('0x31')](_0xa0f3('0x32'),_0x5c68a3+'-'+_0x143cf9+'/'+_0x1bf7bc)['json'](_0xf85766);}return null;};}function patchUpdates(_0x27a32a){return function(_0x2ee980){try{jsonpatch[_0xa0f3('0x33')](_0x2ee980,_0x27a32a,!![]);}catch(_0x37d39e){return BPromise[_0xa0f3('0x34')](_0x37d39e);}return _0x2ee980['save']();};}function saveUpdates(_0x5ab98b,_0x5bd52d){return function(_0x3d5fd5){if(_0x3d5fd5){return _0x3d5fd5[_0xa0f3('0x35')](_0x5ab98b)[_0xa0f3('0x20')](function(_0x34bbc3){return _0x34bbc3;});}return null;};}function removeEntity(_0x460022,_0x36c877){return function(_0x1c5407){if(_0x1c5407){return _0x1c5407[_0xa0f3('0x36')]()[_0xa0f3('0x20')](function(){_0x460022[_0xa0f3('0x2a')](0xcc)[_0xa0f3('0x2b')]();});}};}function handleEntityNotFound(_0x50d3be,_0x2ffd53){return function(_0x49be35){if(!_0x49be35){_0x50d3be['sendStatus'](0x194);}return _0x49be35;};}function handleError(_0x8a320,_0x45033e){_0x45033e=_0x45033e||0x1f4;return function(_0x59e71e){logger[_0xa0f3('0x24')](_0x59e71e[_0xa0f3('0x37')]);if(_0x59e71e[_0xa0f3('0x38')]){delete _0x59e71e['name'];}_0x8a320[_0xa0f3('0x2a')](_0x45033e)[_0xa0f3('0x39')](_0x59e71e);};}exports[_0xa0f3('0x3a')]=function(_0x31de25,_0x523459){var _0x5e099d={},_0x5106b6={},_0x2cf677={'count':0x0,'rows':[]};var _0x51e51f=_[_0xa0f3('0x3b')](db[_0xa0f3('0x3c')][_0xa0f3('0x3d')],function(_0x306b77){return{'name':_0x306b77['fieldName'],'type':_0x306b77[_0xa0f3('0x3e')][_0xa0f3('0x3f')]};});_0x5106b6[_0xa0f3('0x40')]=_[_0xa0f3('0x3b')](_0x51e51f,_0xa0f3('0x38'));_0x5106b6[_0xa0f3('0x41')]=_[_0xa0f3('0x42')](_0x31de25[_0xa0f3('0x41')]);_0x5106b6['filters']=_[_0xa0f3('0x43')](_0x5106b6[_0xa0f3('0x40')],_0x5106b6[_0xa0f3('0x41')]);_0x5e099d[_0xa0f3('0x44')]=_['intersection'](_0x5106b6[_0xa0f3('0x40')],qs[_0xa0f3('0x45')](_0x31de25[_0xa0f3('0x41')][_0xa0f3('0x45')]));_0x5e099d[_0xa0f3('0x44')]=_0x5e099d['attributes'][_0xa0f3('0x46')]?_0x5e099d[_0xa0f3('0x44')]:_0x5106b6[_0xa0f3('0x40')];if(!_0x31de25[_0xa0f3('0x41')][_0xa0f3('0x47')](_0xa0f3('0x48'))){_0x5e099d['limit']=qs[_0xa0f3('0x30')](_0x31de25['query'][_0xa0f3('0x30')]);_0x5e099d[_0xa0f3('0x2d')]=qs['offset'](_0x31de25[_0xa0f3('0x41')][_0xa0f3('0x2d')]);}_0x5e099d[_0xa0f3('0x49')]=qs[_0xa0f3('0x4a')](_0x31de25['query']['sort']);_0x5e099d[_0xa0f3('0x4b')]=qs['filters'](_[_0xa0f3('0x4c')](_0x31de25[_0xa0f3('0x41')],_0x5106b6[_0xa0f3('0x4d')]),_0x51e51f);if(_0x31de25[_0xa0f3('0x41')][_0xa0f3('0x4e')]){_0x5e099d[_0xa0f3('0x4b')]=_[_0xa0f3('0x4f')](_0x5e099d[_0xa0f3('0x4b')],{'$or':_['map'](_0x51e51f,function(_0x363e63){if(_0x363e63[_0xa0f3('0x3e')]!==_0xa0f3('0x50')){var _0x4862d0={};_0x4862d0[_0x363e63[_0xa0f3('0x38')]]={'$like':'%'+_0x31de25[_0xa0f3('0x41')]['filter']+'%'};return _0x4862d0;}})});}_0x5e099d=_[_0xa0f3('0x4f')]({},_0x5e099d,_0x31de25['options']);var _0x4bc751={'where':_0x5e099d[_0xa0f3('0x4b')]};return db[_0xa0f3('0x3c')]['count'](_0x4bc751)[_0xa0f3('0x20')](function(_0x4aa5ed){_0x2cf677[_0xa0f3('0x2f')]=_0x4aa5ed;if(_0x31de25['query'][_0xa0f3('0x51')]){_0x5e099d[_0xa0f3('0x52')]=[{'all':!![]}];}return db[_0xa0f3('0x3c')][_0xa0f3('0x53')](_0x5e099d);})[_0xa0f3('0x20')](function(_0x4702ec){_0x2cf677[_0xa0f3('0x54')]=_0x4702ec;return _0x2cf677;})[_0xa0f3('0x20')](respondWithFilteredResult(_0x523459,_0x5e099d))[_0xa0f3('0x29')](handleError(_0x523459,null));};exports[_0xa0f3('0x55')]=function(_0x39eb4f,_0x14bd50){var _0x5ab7ca={'raw':!![],'where':{'id':_0x39eb4f[_0xa0f3('0x56')]['id']}},_0x599f68={};_0x599f68[_0xa0f3('0x40')]=_[_0xa0f3('0x42')](db[_0xa0f3('0x3c')][_0xa0f3('0x3d')]);_0x599f68[_0xa0f3('0x41')]=_[_0xa0f3('0x42')](_0x39eb4f['query']);_0x599f68['filters']=_[_0xa0f3('0x43')](_0x599f68[_0xa0f3('0x40')],_0x599f68[_0xa0f3('0x41')]);_0x5ab7ca[_0xa0f3('0x44')]=_[_0xa0f3('0x43')](_0x599f68[_0xa0f3('0x40')],qs[_0xa0f3('0x45')](_0x39eb4f[_0xa0f3('0x41')][_0xa0f3('0x45')]));_0x5ab7ca[_0xa0f3('0x44')]=_0x5ab7ca[_0xa0f3('0x44')][_0xa0f3('0x46')]?_0x5ab7ca[_0xa0f3('0x44')]:_0x599f68[_0xa0f3('0x40')];if(_0x39eb4f[_0xa0f3('0x41')][_0xa0f3('0x51')]){_0x5ab7ca[_0xa0f3('0x52')]=[{'all':!![]}];}_0x5ab7ca=_['merge']({},_0x5ab7ca,_0x39eb4f[_0xa0f3('0x57')]);return db['WhatsappMessage'][_0xa0f3('0x58')](_0x5ab7ca)[_0xa0f3('0x20')](handleEntityNotFound(_0x14bd50,null))[_0xa0f3('0x20')](respondWithResult(_0x14bd50,null))[_0xa0f3('0x29')](handleError(_0x14bd50,null));};exports[_0xa0f3('0x59')]=function(_0x932878,_0x599390){return db[_0xa0f3('0x3c')][_0xa0f3('0x59')](_0x932878[_0xa0f3('0x5a')],{})['then'](respondWithResult(_0x599390,0xc9))[_0xa0f3('0x29')](handleError(_0x599390,null));};exports[_0xa0f3('0x35')]=function(_0x5dc3df,_0x252305){if(_0x5dc3df[_0xa0f3('0x5a')]['id']){delete _0x5dc3df[_0xa0f3('0x5a')]['id'];}return db['WhatsappMessage'][_0xa0f3('0x58')]({'where':{'id':_0x5dc3df[_0xa0f3('0x56')]['id']}})[_0xa0f3('0x20')](handleEntityNotFound(_0x252305,null))[_0xa0f3('0x20')](saveUpdates(_0x5dc3df['body'],null))[_0xa0f3('0x20')](respondWithResult(_0x252305,null))[_0xa0f3('0x29')](handleError(_0x252305,null));};exports[_0xa0f3('0x36')]=function(_0x2233fb,_0x1b00ca){return db[_0xa0f3('0x3c')][_0xa0f3('0x58')]({'where':{'id':_0x2233fb['params']['id']}})[_0xa0f3('0x20')](handleEntityNotFound(_0x1b00ca,null))['then'](removeEntity(_0x1b00ca,null))[_0xa0f3('0x29')](handleError(_0x1b00ca,null));};exports[_0xa0f3('0x5b')]=function(_0x345313,_0x14852b){return db[_0xa0f3('0x3c')][_0xa0f3('0x5b')]()[_0xa0f3('0x20')](respondWithResult(_0x14852b,null))[_0xa0f3('0x29')](handleError(_0x14852b,null));};var interaction_log=require(_0xa0f3('0x10'))('whatsapp-interactions');exports['accept']=function(_0x1fa28c,_0x796917,_0x43a4f5){var _0x4c21d2={'agent':{},'channel':_0xa0f3('0x5c')};if(_0x1fa28c[_0xa0f3('0x5a')]['id']){delete _0x1fa28c['body']['id'];}_0x1fa28c[_0xa0f3('0x5a')][_0xa0f3('0x5d')]=!![];_0x1fa28c[_0xa0f3('0x5a')]['readAt']=moment()[_0xa0f3('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1fa28c[_0xa0f3('0x5a')][_0xa0f3('0x5f')]=_0x1fa28c['body']['UserId']||_0x1fa28c[_0xa0f3('0x60')]['id'];_0x4c21d2[_0xa0f3('0x61')]['id']=_0x1fa28c[_0xa0f3('0x5a')]['UserId'];return db[_0xa0f3('0x3c')]['find']({'where':{'id':_0x1fa28c['params']['id'],'UserId':null}})[_0xa0f3('0x20')](handleEntityNotFound(_0x796917,null))[_0xa0f3('0x20')](saveUpdates(_0x1fa28c['body'],null))[_0xa0f3('0x20')](function(_0x270ada){if(_0x270ada){_0x4c21d2[_0xa0f3('0x27')]=_0x270ada[_0xa0f3('0x62')]({'plain':!![]});return db[_0xa0f3('0x63')]['find']({'where':{'id':_0x270ada[_0xa0f3('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x796917,null))[_0xa0f3('0x20')](function(_0xbcf47){if(_0xbcf47){return _0xbcf47['update']({'UserId':_0x1fa28c[_0xa0f3('0x5a')][_0xa0f3('0x5f')],'read1stAt':_[_0xa0f3('0x65')](_0xbcf47[_0xa0f3('0x66')])?moment()[_0xa0f3('0x5e')](_0xa0f3('0x67')):undefined});}return null;})['then'](function(_0x537066){if(_0x537066){_0x4c21d2[_0xa0f3('0x68')]=_0x537066[_0xa0f3('0x62')]({'plain':!![]});interaction_log[_0xa0f3('0x28')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1fa28c[_0xa0f3('0x60')]['id'],_0x1fa28c[_0xa0f3('0x60')][_0xa0f3('0x38')],_0x1fa28c[_0xa0f3('0x60')][_0xa0f3('0x69')],_0x4c21d2[_0xa0f3('0x68')]['id'],_0x1fa28c[_0xa0f3('0x5a')]?JSON[_0xa0f3('0x23')](_0x1fa28c['body']):_0xa0f3('0x6a'));return respondWithRpcPromise('AcceptMessage',_0xa0f3('0x6b'),_0x4c21d2);}return null;})[_0xa0f3('0x20')](function(_0x549faf){var _0x2c3872=_0xa0f3('0x6c')+_0x549faf[_0xa0f3('0x27')][_0xa0f3('0x6d')];return db[_0xa0f3('0x6e')][_0xa0f3('0x41')](_0x2c3872,{'type':db[_0xa0f3('0x6f')][_0xa0f3('0x70')][_0xa0f3('0x71')],'raw':!![]})[_0xa0f3('0x20')](function(_0x55dc26){return _0x55dc26;});})[_0xa0f3('0x20')](function(_0x347c62){if(_0x347c62){_0x4c21d2[_0xa0f3('0x27')]['contact']=_0x347c62[0x0];if(!_0x1fa28c[_0xa0f3('0x5a')][_0xa0f3('0x5f')])return;return db[_0xa0f3('0x72')][_0xa0f3('0x58')]({'where':{'id':_0x1fa28c[_0xa0f3('0x5a')][_0xa0f3('0x5f')],'role':_0xa0f3('0x61')},'attributes':['id','name',_0xa0f3('0x73'),_0xa0f3('0x74'),_0xa0f3('0x75')],'raw':!![]});}return null;})[_0xa0f3('0x20')](function(_0xc02ecc){if(!_0xc02ecc)return null;_0x4c21d2[_0xa0f3('0x27')][_0xa0f3('0x61')]=_0xc02ecc;return _0x4c21d2;})[_0xa0f3('0x20')](function(_0x1b87e9){if(_0x1b87e9){if(_0x1fa28c[_0xa0f3('0x5a')][_0xa0f3('0x76')]){_0x4c21d2[_0xa0f3('0x27')][_0xa0f3('0x77')]=util[_0xa0f3('0x5e')]('SIP/%s',_0x1fa28c[_0xa0f3('0x60')][_0xa0f3('0x38')]);_0x4c21d2[_0xa0f3('0x27')]['channel']=_0x4c21d2[_0xa0f3('0x78')];_0x4c21d2[_0xa0f3('0x27')]['motionChannel']=_0x4c21d2[_0xa0f3('0x78')];_0x4c21d2[_0xa0f3('0x27')][_0xa0f3('0x79')]=_0xa0f3('0x7a');return respondWithRpcPromise(_0xa0f3('0x7b'),'EventManager',{'event':_0xa0f3('0x7c'),'message':_0x4c21d2[_0xa0f3('0x27')]},client9002)[_0xa0f3('0x20')](function(){return _0x4c21d2;});}return _0x4c21d2;}return null;})[_0xa0f3('0x20')](respondWithResult(_0x796917,null))['catch'](handleError(_0x796917,null));};var interaction_log=require('../../config/logger')(_0xa0f3('0x7d'));exports[_0xa0f3('0x34')]=function(_0x2d5651,_0x478183,_0x1a29cf){var _0x11cee8={'agent':{},'channel':_0xa0f3('0x5c')};if(_0x2d5651[_0xa0f3('0x5a')]['id']){delete _0x2d5651[_0xa0f3('0x5a')]['id'];}_0x2d5651[_0xa0f3('0x5a')][_0xa0f3('0x5f')]=_0x2d5651[_0xa0f3('0x5a')][_0xa0f3('0x5f')]||_0x2d5651[_0xa0f3('0x60')]['id'];_0x11cee8['agent']['id']=_0x2d5651[_0xa0f3('0x5a')]['UserId'];return db[_0xa0f3('0x3c')]['find']({'where':{'id':_0x2d5651['params']['id'],'UserId':null}})[_0xa0f3('0x20')](handleEntityNotFound(_0x478183,null))[_0xa0f3('0x20')](function(_0x1a4cc3){if(_0x1a4cc3){_0x11cee8['message']=_0x1a4cc3[_0xa0f3('0x62')]({'plain':!![]});return db[_0xa0f3('0x63')]['find']({'where':{'id':_0x1a4cc3[_0xa0f3('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x478183,null))[_0xa0f3('0x20')](function(_0x36d54e){if(_0x36d54e){_0x11cee8[_0xa0f3('0x68')]=_0x36d54e[_0xa0f3('0x62')]({'plain':!![]});interaction_log[_0xa0f3('0x28')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2d5651[_0xa0f3('0x60')]['id'],_0x2d5651[_0xa0f3('0x60')][_0xa0f3('0x38')],_0x2d5651[_0xa0f3('0x60')][_0xa0f3('0x69')],_0x11cee8[_0xa0f3('0x68')]['id'],_0x2d5651[_0xa0f3('0x5a')]?JSON[_0xa0f3('0x23')](_0x2d5651[_0xa0f3('0x5a')]):_0xa0f3('0x6a'));return respondWithRpcPromise(_0xa0f3('0x7e'),_0xa0f3('0x7f'),_0x11cee8);}return null;})[_0xa0f3('0x20')](function(_0x2bfbd3){var _0x7e939a=_0xa0f3('0x6c')+_0x2bfbd3['message'][_0xa0f3('0x6d')];return db[_0xa0f3('0x6e')][_0xa0f3('0x41')](_0x7e939a,{'type':db[_0xa0f3('0x6f')][_0xa0f3('0x70')][_0xa0f3('0x71')],'raw':!![]})['then'](function(_0x3e8d7c){return _0x3e8d7c;});})['then'](function(_0x34f0fa){if(_0x34f0fa){_0x11cee8[_0xa0f3('0x27')][_0xa0f3('0x80')]=_0x34f0fa[0x0];if(!_0x2d5651[_0xa0f3('0x5a')][_0xa0f3('0x5f')])return;return db[_0xa0f3('0x72')][_0xa0f3('0x58')]({'where':{'id':_0x2d5651[_0xa0f3('0x5a')][_0xa0f3('0x5f')],'role':_0xa0f3('0x61')},'attributes':['id',_0xa0f3('0x38'),_0xa0f3('0x73'),'email','internal'],'raw':!![]});}return null;})[_0xa0f3('0x20')](function(_0x8407c4){if(!_0x8407c4)return null;_0x11cee8[_0xa0f3('0x27')][_0xa0f3('0x61')]=_0x8407c4;return _0x11cee8;})['then'](function(_0x3b91f5){if(_0x3b91f5){_0x3b91f5[_0xa0f3('0x27')][_0xa0f3('0x77')]=util['format']('SIP/%s',_0x2d5651[_0xa0f3('0x60')][_0xa0f3('0x38')]);_0x3b91f5['message'][_0xa0f3('0x78')]=_0x11cee8[_0xa0f3('0x78')];_0x3b91f5[_0xa0f3('0x27')][_0xa0f3('0x81')]=_0x11cee8['channel'];_0x3b91f5['message'][_0xa0f3('0x79')]=_0xa0f3('0x34');respondWithRpcPromise(_0xa0f3('0x7b'),_0xa0f3('0x7b'),{'event':'rejectmessage','message':_0x3b91f5[_0xa0f3('0x27')]},client9002);return _0x11cee8;}return null;})[_0xa0f3('0x20')](respondWithResult(_0x478183,null))['catch'](handleError(_0x478183,null));};exports[_0xa0f3('0x2a')]=function(_0x143511,_0x13945c,_0x12421b){if(_0x143511[_0xa0f3('0x5a')]['id']){delete _0x143511[_0xa0f3('0x5a')]['id'];}var _0x43e12e;return db['WhatsappMessage'][_0xa0f3('0x58')]({'where':{'id':_0x143511[_0xa0f3('0x56')]['id']}})[_0xa0f3('0x20')](handleEntityNotFound(_0x13945c,null))['then'](function(_0x2a0dba){if(_0x2a0dba){_0x43e12e=_0x2a0dba;return db[_0xa0f3('0x82')]['find']({'where':{'id':_0x2a0dba[_0xa0f3('0x83')]}});}})[_0xa0f3('0x20')](handleEntityNotFound(_0x13945c,null))[_0xa0f3('0x20')](function(_0x37bb4c){if(_0x37bb4c){logger[_0xa0f3('0x22')](_0xa0f3('0x84'),'status','received\x20delivery\x20report\x20from',_0x37bb4c[_0xa0f3('0x3e')],util[_0xa0f3('0x85')](_0x143511[_0xa0f3('0x5a')],{'showHidden':![],'depth':null}));switch(_0x37bb4c[_0xa0f3('0x3e')]){case _0xa0f3('0x86'):if(_0x143511['body'][_0xa0f3('0x87')]&&_0x143511[_0xa0f3('0x5a')][_0xa0f3('0x87')]===_0x43e12e[_0xa0f3('0x88')]&&_0x143511[_0xa0f3('0x5a')]['MessageStatus']&&_0x143511['body']['MessageStatus']===_0xa0f3('0x5d')){return _0x43e12e['update']({'read':!![]});}else{logger[_0xa0f3('0x24')](_0xa0f3('0x89'),_0xa0f3('0x2a'),'twilio',util[_0xa0f3('0x85')](_0x143511[_0xa0f3('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x43e12e;}})['then'](respondWithResult(_0x13945c,null))[_0xa0f3('0x29')](handleError(_0x13945c,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 44ddc9d..ea2ebbf 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 _0xd523=['remove','emit','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','update'];(function(_0x5718c1,_0x31597c){var _0x476537=function(_0xaa27a){while(--_0xaa27a){_0x5718c1['push'](_0x5718c1['shift']());}};_0x476537(++_0x31597c);}(_0xd523,0x153));var _0x3d52=function(_0x1f9ebd,_0x36d6ec){_0x1f9ebd=_0x1f9ebd-0x0;var _0x37a3be=_0xd523[_0x1f9ebd];return _0x37a3be;};'use strict';var EventEmitter=require(_0x3d52('0x0'));var WhatsappMessage=require(_0x3d52('0x1'))['db'][_0x3d52('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x3d52('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3d52('0x4'),'afterDestroy':_0x3d52('0x5')};function emitEvent(_0x2752e7){return function(_0x5103d8,_0x24d3af,_0x3dfd00){WhatsappMessageEvents[_0x3d52('0x6')](_0x2752e7+':'+_0x5103d8['id'],_0x5103d8);WhatsappMessageEvents[_0x3d52('0x6')](_0x2752e7,_0x5103d8);_0x3dfd00(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x3d52('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0xcf66=['exports','events','../../mysqldb','WhatsappMessage','save','update','emit','hasOwnProperty'];(function(_0x18856a,_0x5d09af){var _0x4d285a=function(_0x16a37e){while(--_0x16a37e){_0x18856a['push'](_0x18856a['shift']());}};_0x4d285a(++_0x5d09af);}(_0xcf66,0x71));var _0x6cf6=function(_0x51ce29,_0x2c0867){_0x51ce29=_0x51ce29-0x0;var _0x2b08ca=_0xcf66[_0x51ce29];return _0x2b08ca;};'use strict';var EventEmitter=require(_0x6cf6('0x0'));var WhatsappMessage=require(_0x6cf6('0x1'))['db'][_0x6cf6('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6cf6('0x3'),'afterUpdate':_0x6cf6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4e16eb){return function(_0x1c599d,_0x45d0d8,_0x57f22f){WhatsappMessageEvents[_0x6cf6('0x5')](_0x4e16eb+':'+_0x1c599d['id'],_0x1c599d);WhatsappMessageEvents[_0x6cf6('0x5')](_0x4e16eb,_0x1c599d);_0x57f22f(null);};}for(var e in events){if(events[_0x6cf6('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x6cf6('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 a3540f9..beafced 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 _0x87d9=['update','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','token','sid','catch','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','body','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','then'];(function(_0x3a1d74,_0x50ba38){var _0x9d2456=function(_0x591d48){while(--_0x591d48){_0x3a1d74['push'](_0x3a1d74['shift']());}};_0x9d2456(++_0x50ba38);}(_0x87d9,0x1af));var _0x987d=function(_0x5e2cb4,_0x592c64){_0x5e2cb4=_0x5e2cb4-0x0;var _0x282902=_0x87d9[_0x5e2cb4];return _0x282902;};'use strict';var _=require(_0x987d('0x0'));var util=require('util');var logger=require(_0x987d('0x1'))(_0x987d('0x2'));var moment=require(_0x987d('0x3'));var BPromise=require('bluebird');var rp=require(_0x987d('0x4'));var fetch=require(_0x987d('0x5'));var fs=require('fs');var path=require(_0x987d('0x6'));var rimraf=require(_0x987d('0x7'));var config=require(_0x987d('0x8'));var attributes=require(_0x987d('0x9'));module['exports']=function(_0x55771d,_0x569cef){return _0x55771d[_0x987d('0xa')](_0x987d('0xb'),attributes,{'tableName':_0x987d('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x987d('0xd')]},{'name':'fti_whatsapp_messages','fields':[_0x987d('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c8052,_0x1fae3f,_0x258289){var _0x4ef154=_0x55771d['models'];var _0x226b25=_0x2c8052[_0x987d('0xf')]({'plain':!![]});if(_0x226b25[_0x987d('0x10')][_0x987d('0x11')]()==='in'||_0x226b25[_0x987d('0x10')]['toLowerCase']()===_0x987d('0x12')&&!_0x226b25[_0x987d('0x13')]&&!_[_0x987d('0x14')](_0x226b25[_0x987d('0x15')])){_0x4ef154[_0x987d('0x16')][_0x987d('0x17')]({'where':{'id':_0x226b25['WhatsappInteractionId']}})[_0x987d('0x18')](function(_0x91fbae){if(_0x91fbae){_0x91fbae[_0x987d('0x19')]({'lastMsgAt':_0x226b25['createdAt'],'lastMsgDirection':_0x226b25[_0x987d('0x10')]['toLowerCase']()});}})['catch'](function(_0x3b263b){console['error'](_0x3b263b);});}if(_0x226b25['direction']==='out'&&!_0x226b25['secret']){var _0x2ab8d9;_0x4ef154['WhatsappAccount'][_0x987d('0x1a')]({'where':{'id':_0x226b25[_0x987d('0x1b')]},'raw':!![]})['then'](function(_0x5ea05d){_0x2ab8d9=_0x5ea05d;if(_0x2ab8d9&&_0x2ab8d9[_0x987d('0x1c')]){switch(_0x2ab8d9[_0x987d('0x1c')]){case'twilio':var _0x5b7423=require(_0x987d('0x1d'));if(_0x2ab8d9[_0x987d('0x1e')]&&_0x2ab8d9[_0x987d('0x1f')]&&_0x2ab8d9[_0x987d('0x20')]){var _0x6ddad7=new _0x5b7423(_0x2ab8d9[_0x987d('0x1e')],_0x2ab8d9['authToken']);_0x6ddad7[_0x987d('0x21')][_0x987d('0x22')]({'body':_0x226b25[_0x987d('0xe')],'to':_0x987d('0x23')+_0x226b25['phone'],'from':_0x987d('0x23')+_0x2ab8d9[_0x987d('0x20')],'statusCallback':_0x2ab8d9[_0x987d('0x24')]+_0x987d('0x25')+_0x226b25['id']+'/status?token='+_0x2ab8d9[_0x987d('0x26')]})[_0x987d('0x18')](function(_0x148ff1){if(_0x148ff1['sid']){return _0x2c8052[_0x987d('0x19')]({'messageId':_0x148ff1[_0x987d('0x27')]});}})[_0x987d('0x28')](function(_0x419b12){logger[_0x987d('0x29')](_0x987d('0x2a'),_0x987d('0x2b'),'twilio',util[_0x987d('0x2c')](_0x419b12,{'showHidden':![],'depth':null}));});}else{logger[_0x987d('0x29')](_0x987d('0x2a'),'afterCreate','twilio',_0x987d('0x2d'));}break;case'sinch':var _0x4076c5=_0x2ab8d9['accountSid'];var _0x403700=_0x2ab8d9[_0x987d('0x1f')];var _0x1033ab=_0x2ab8d9[_0x987d('0x2e')]+_0x987d('0x2f')+_0x4076c5+'/messages/';var _0x47e9c2={'to':[_0x226b25[_0x987d('0x20')]],'message':{'type':'text','text':_0x226b25['body']}};var _0x4e08c4={'method':_0x987d('0x30'),'uri':_0x1033ab,'headers':{'Authorization':_0x987d('0x31')+_0x403700,'Content-Type':_0x987d('0x32')},'body':_0x47e9c2,'json':!![]};rp(_0x4e08c4)[_0x987d('0x18')](function(_0x3a16fc){if(_0x3a16fc[_0x987d('0x33')][0x0][_0x987d('0x34')]){return _0x2c8052[_0x987d('0x19')]({'messageId':_0x3a16fc[_0x987d('0x33')][0x0][_0x987d('0x34')]});}})[_0x987d('0x28')](function(_0x208350){logger[_0x987d('0x35')](_0x987d('0x36'),_0x208350);});break;}}})[_0x987d('0x37')](function(){_0x258289();});}else{_0x258289();}}},'charset':'utf8mb4','collate':_0x987d('0x38')});}; \ No newline at end of file +var _0x777f=['../../config/environment','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','then','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','phone','authToken','messages','whatsapp:','/api/whatsapp/messages/','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','text','POST','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','rimraf'];(function(_0xd99a75,_0x455205){var _0x73bdfb=function(_0xf5540b){while(--_0xf5540b){_0xd99a75['push'](_0xd99a75['shift']());}};_0x73bdfb(++_0x455205);}(_0x777f,0x9f));var _0xf777=function(_0x254b22,_0x27159f){_0x254b22=_0x254b22-0x0;var _0x1279db=_0x777f[_0x254b22];return _0x1279db;};'use strict';var _=require(_0xf777('0x0'));var util=require(_0xf777('0x1'));var logger=require(_0xf777('0x2'))(_0xf777('0x3'));var moment=require(_0xf777('0x4'));var BPromise=require(_0xf777('0x5'));var rp=require(_0xf777('0x6'));var fetch=require(_0xf777('0x7'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf777('0x8'));var config=require(_0xf777('0x9'));var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0x5df5dc,_0xa78a3){return _0x5df5dc[_0xf777('0xa')](_0xf777('0xb'),attributes,{'tableName':_0xf777('0xc'),'paranoid':![],'indexes':[{'name':_0xf777('0xd'),'fields':[_0xf777('0xd')]},{'name':_0xf777('0xe'),'fields':[_0xf777('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b849a,_0x5d8752,_0x121128){var _0x2bfd8c=_0x5df5dc['models'];var _0x133cfc=_0x4b849a[_0xf777('0x10')]({'plain':!![]});if(_0x133cfc[_0xf777('0x11')]['toLowerCase']()==='in'||_0x133cfc[_0xf777('0x11')][_0xf777('0x12')]()===_0xf777('0x13')&&!_0x133cfc[_0xf777('0x14')]&&!_[_0xf777('0x15')](_0x133cfc[_0xf777('0x16')])){_0x2bfd8c[_0xf777('0x17')]['findOne']({'where':{'id':_0x133cfc['WhatsappInteractionId']}})[_0xf777('0x18')](function(_0x599c09){if(_0x599c09){_0x599c09[_0xf777('0x19')]({'lastMsgAt':_0x133cfc[_0xf777('0x1a')],'lastMsgDirection':_0x133cfc[_0xf777('0x11')]['toLowerCase']()});}})[_0xf777('0x1b')](function(_0xa9c4f8){console[_0xf777('0x1c')](_0xa9c4f8);});}if(_0x133cfc[_0xf777('0x11')]===_0xf777('0x13')&&!_0x133cfc[_0xf777('0x14')]){var _0x263c7f;_0x2bfd8c[_0xf777('0x1d')][_0xf777('0x1e')]({'where':{'id':_0x133cfc[_0xf777('0x1f')]},'raw':!![]})[_0xf777('0x18')](function(_0x5ac512){_0x263c7f=_0x5ac512;if(_0x263c7f&&_0x263c7f[_0xf777('0x20')]){switch(_0x263c7f['type']){case _0xf777('0x21'):var _0x5a5b80=require(_0xf777('0x21'));if(_0x263c7f['accountSid']&&_0x263c7f['authToken']&&_0x263c7f[_0xf777('0x22')]){var _0x3ffa51=new _0x5a5b80(_0x263c7f['accountSid'],_0x263c7f[_0xf777('0x23')]);_0x3ffa51[_0xf777('0x24')]['create']({'body':_0x133cfc['body'],'to':'whatsapp:'+_0x133cfc[_0xf777('0x22')],'from':_0xf777('0x25')+_0x263c7f['phone'],'statusCallback':_0x263c7f['remote']+_0xf777('0x26')+_0x133cfc['id']+'/status?token='+_0x263c7f[_0xf777('0x27')]})['then'](function(_0x2b4a0f){if(_0x2b4a0f['sid']){return _0x4b849a['update']({'messageId':_0x2b4a0f[_0xf777('0x28')]});}})['catch'](function(_0x9b8b20){logger['error'](_0xf777('0x29'),_0xf777('0x2a'),_0xf777('0x21'),util[_0xf777('0x2b')](_0x9b8b20,{'showHidden':![],'depth':null}));});}else{logger[_0xf777('0x1c')](_0xf777('0x29'),'afterCreate',_0xf777('0x21'),_0xf777('0x2c'));}break;case _0xf777('0x2d'):var _0x4f38f2=_0x263c7f['accountSid'];var _0x451e21=_0x263c7f['authToken'];var _0x2719c3=_0x263c7f['baseUrl']+_0xf777('0x2e')+_0x4f38f2+'/messages/';var _0x30f09b={'to':[_0x133cfc[_0xf777('0x22')]],'message':{'type':_0xf777('0x2f'),'text':_0x133cfc[_0xf777('0xf')]}};var _0x3492bd={'method':_0xf777('0x30'),'uri':_0x2719c3,'headers':{'Authorization':'Bearer\x20'+_0x451e21,'Content-Type':_0xf777('0x31')},'body':_0x30f09b,'json':!![]};rp(_0x3492bd)[_0xf777('0x18')](function(_0x2e41bd){if(_0x2e41bd[_0xf777('0x32')][0x0][_0xf777('0x33')]){return _0x4b849a[_0xf777('0x19')]({'messageId':_0x2e41bd[_0xf777('0x32')][0x0]['message_id']});}})[_0xf777('0x1b')](function(_0x342e67){logger[_0xf777('0x34')](_0xf777('0x35'),_0x342e67);});break;}}})[_0xf777('0x36')](function(){_0x121128();});}else{_0x121128();}}},'charset':_0xf777('0x37'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index c75d391..c17fb3c 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 _0xc307=['info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateWhatsappMessage','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','./whatsappMessage.socket','register','request','then'];(function(_0x55d768,_0x1ac357){var _0x880d6d=function(_0x3c9172){while(--_0x3c9172){_0x55d768['push'](_0x55d768['shift']());}};_0x880d6d(++_0x1ac357);}(_0xc307,0x181));var _0x7c30=function(_0x1e60ff,_0x1329a5){_0x1e60ff=_0x1e60ff-0x0;var _0x1075e2=_0xc307[_0x1e60ff];return _0x1075e2;};'use strict';var _=require('lodash');var util=require(_0x7c30('0x0'));var moment=require(_0x7c30('0x1'));var BPromise=require(_0x7c30('0x2'));var rs=require(_0x7c30('0x3'));var fs=require('fs');var Redis=require(_0x7c30('0x4'));var db=require(_0x7c30('0x5'))['db'];var utils=require(_0x7c30('0x6'));var logger=require(_0x7c30('0x7'))(_0x7c30('0x8'));var config=require(_0x7c30('0x9'));var jayson=require(_0x7c30('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x7c30('0xb')](config[_0x7c30('0xc')],{'host':_0x7c30('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c30('0xc')]));require(_0x7c30('0xe'))[_0x7c30('0xf')](socket);function respondWithRpcPromise(_0x5a895c,_0x32bc84,_0x2f1eba){return new BPromise(function(_0x2f748b,_0xccbf4f){return client[_0x7c30('0x10')](_0x5a895c,_0x2f1eba)[_0x7c30('0x11')](function(_0x408d3c){logger[_0x7c30('0x12')](_0x7c30('0x13'),_0x32bc84,_0x7c30('0x14'));logger[_0x7c30('0x15')](_0x7c30('0x16'),_0x32bc84,_0x7c30('0x14'),JSON[_0x7c30('0x17')](_0x408d3c));if(_0x408d3c['error']){if(_0x408d3c[_0x7c30('0x18')]['code']===0x1f4){logger[_0x7c30('0x18')](_0x7c30('0x13'),_0x32bc84,_0x408d3c[_0x7c30('0x18')][_0x7c30('0x19')]);return _0xccbf4f(_0x408d3c[_0x7c30('0x18')][_0x7c30('0x19')]);}logger['error'](_0x7c30('0x13'),_0x32bc84,_0x408d3c['error'][_0x7c30('0x19')]);return _0x2f748b(_0x408d3c['error'][_0x7c30('0x19')]);}else{logger[_0x7c30('0x12')](_0x7c30('0x13'),_0x32bc84,'request\x20sent');_0x2f748b(_0x408d3c['result'][_0x7c30('0x19')]);}})[_0x7c30('0x1a')](function(_0x5c7872){logger[_0x7c30('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x32bc84,_0x5c7872);_0xccbf4f(_0x5c7872);});});}exports[_0x7c30('0x1b')]=function(_0x1b67d5){var _0x3f0543=this;return new Promise(function(_0x2cf91e,_0x270296){return db['WhatsappMessage']['create'](_0x1b67d5[_0x7c30('0x1c')],{'raw':_0x1b67d5[_0x7c30('0x1d')]?_0x1b67d5[_0x7c30('0x1d')][_0x7c30('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x129f25){logger[_0x7c30('0x12')](_0x7c30('0x1b'),_0x1b67d5);logger[_0x7c30('0x15')](_0x7c30('0x1b'),_0x1b67d5,JSON[_0x7c30('0x17')](_0x129f25));_0x2cf91e(_0x129f25);})[_0x7c30('0x1a')](function(_0x169203){logger[_0x7c30('0x18')](_0x7c30('0x1b'),_0x169203['message'],_0x1b67d5);_0x270296(_0x3f0543['error'](0x1f4,_0x169203['message']));});});}; \ No newline at end of file +var _0x0c62=['stringify','error','code','message','info','result','catch','CreateWhatsappMessage','create','body','options','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./whatsappMessage.socket','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x413bc0,_0x5d1de8){var _0x369313=function(_0x31ba1f){while(--_0x31ba1f){_0x413bc0['push'](_0x413bc0['shift']());}};_0x369313(++_0x5d1de8);}(_0x0c62,0x161));var _0x20c6=function(_0x30e9d8,_0x89aee6){_0x30e9d8=_0x30e9d8-0x0;var _0x5a7c2d=_0x0c62[_0x30e9d8];return _0x5a7c2d;};'use strict';var _=require(_0x20c6('0x0'));var util=require('util');var moment=require(_0x20c6('0x1'));var BPromise=require('bluebird');var rs=require(_0x20c6('0x2'));var fs=require('fs');var Redis=require(_0x20c6('0x3'));var db=require(_0x20c6('0x4'))['db'];var utils=require(_0x20c6('0x5'));var logger=require(_0x20c6('0x6'))(_0x20c6('0x7'));var config=require('../../config/environment');var jayson=require(_0x20c6('0x8'));var client=jayson[_0x20c6('0x9')][_0x20c6('0xa')]({'port':0x232a});config[_0x20c6('0xb')]=_['defaults'](config[_0x20c6('0xb')],{'host':_0x20c6('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x20c6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5a7717,_0x4325a5,_0x177a5b){return new BPromise(function(_0x1bfd8a,_0x353286){return client[_0x20c6('0xe')](_0x5a7717,_0x177a5b)[_0x20c6('0xf')](function(_0x504241){logger['info'](_0x20c6('0x10'),_0x4325a5,_0x20c6('0x11'));logger[_0x20c6('0x12')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4325a5,'request\x20sent',JSON[_0x20c6('0x13')](_0x504241));if(_0x504241[_0x20c6('0x14')]){if(_0x504241[_0x20c6('0x14')][_0x20c6('0x15')]===0x1f4){logger[_0x20c6('0x14')](_0x20c6('0x10'),_0x4325a5,_0x504241['error']['message']);return _0x353286(_0x504241['error'][_0x20c6('0x16')]);}logger[_0x20c6('0x14')](_0x20c6('0x10'),_0x4325a5,_0x504241[_0x20c6('0x14')]['message']);return _0x1bfd8a(_0x504241[_0x20c6('0x14')][_0x20c6('0x16')]);}else{logger[_0x20c6('0x17')](_0x20c6('0x10'),_0x4325a5,_0x20c6('0x11'));_0x1bfd8a(_0x504241[_0x20c6('0x18')]['message']);}})[_0x20c6('0x19')](function(_0x52af75){logger[_0x20c6('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x4325a5,_0x52af75);_0x353286(_0x52af75);});});}exports[_0x20c6('0x1a')]=function(_0x38861b){var _0x58a4a2=this;return new Promise(function(_0x1dfcd5,_0xa7db3b){return db['WhatsappMessage'][_0x20c6('0x1b')](_0x38861b[_0x20c6('0x1c')],{'raw':_0x38861b[_0x20c6('0x1d')]?_0x38861b['options'][_0x20c6('0x1e')]===undefined?!![]:![]:!![]})[_0x20c6('0xf')](function(_0x30f428){logger[_0x20c6('0x17')](_0x20c6('0x1a'),_0x38861b);logger['debug'](_0x20c6('0x1a'),_0x38861b,JSON['stringify'](_0x30f428));_0x1dfcd5(_0x30f428);})[_0x20c6('0x19')](function(_0x65fc4c){logger[_0x20c6('0x14')](_0x20c6('0x1a'),_0x65fc4c[_0x20c6('0x16')],_0x38861b);_0xa7db3b(_0x58a4a2[_0x20c6('0x14')](0x1f4,_0x65fc4c['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index f6194dc..f1d5f84 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 _0x35b1=['remove','update','removeListener','register','length','./whatsappMessage.events','save'];(function(_0x4ddea3,_0x4e15f1){var _0x258053=function(_0x15a6ec){while(--_0x15a6ec){_0x4ddea3['push'](_0x4ddea3['shift']());}};_0x258053(++_0x4e15f1);}(_0x35b1,0x108));var _0x135b=function(_0x2deb2b,_0x35f4e5){_0x2deb2b=_0x2deb2b-0x0;var _0x5836a0=_0x35b1[_0x2deb2b];return _0x5836a0;};'use strict';var WhatsappMessageEvents=require(_0x135b('0x0'));var events=[_0x135b('0x1'),_0x135b('0x2'),_0x135b('0x3')];function createListener(_0x20c8b0,_0x494aaf){return function(_0x5c0957){_0x494aaf['emit'](_0x20c8b0,_0x5c0957);};}function removeListener(_0x2fec6a,_0x4227a5){return function(){WhatsappMessageEvents[_0x135b('0x4')](_0x2fec6a,_0x4227a5);};}exports[_0x135b('0x5')]=function(_0x7c9a00){for(var _0x7845cf=0x0,_0x259998=events[_0x135b('0x6')];_0x7845cf<_0x259998;_0x7845cf++){var _0x78db3f=events[_0x7845cf];var _0x5169f7=createListener('whatsappMessage:'+_0x78db3f,_0x7c9a00);WhatsappMessageEvents['on'](_0x78db3f,_0x5169f7);}}; \ No newline at end of file +var _0x8379=['length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x596284,_0x1cd02b){var _0x5313c6=function(_0x77db49){while(--_0x77db49){_0x596284['push'](_0x596284['shift']());}};_0x5313c6(++_0x1cd02b);}(_0x8379,0x12b));var _0x9837=function(_0x65bfd0,_0x2d1560){_0x65bfd0=_0x65bfd0-0x0;var _0x38e4ad=_0x8379[_0x65bfd0];return _0x38e4ad;};'use strict';var WhatsappMessageEvents=require(_0x9837('0x0'));var events=[_0x9837('0x1'),_0x9837('0x2'),_0x9837('0x3')];function createListener(_0x1e7d76,_0x5cdcdb){return function(_0xc6a19a){_0x5cdcdb[_0x9837('0x4')](_0x1e7d76,_0xc6a19a);};}function removeListener(_0x4ff284,_0x4bb192){return function(){WhatsappMessageEvents[_0x9837('0x5')](_0x4ff284,_0x4bb192);};}exports[_0x9837('0x6')]=function(_0x3cdb7f){for(var _0x5e89b3=0x0,_0x41fb63=events[_0x9837('0x7')];_0x5e89b3<_0x41fb63;_0x5e89b3++){var _0x2a0fd8=events[_0x5e89b3];var _0x348e91=createListener(_0x9837('0x8')+_0x2a0fd8,_0x3cdb7f);WhatsappMessageEvents['on'](_0x2a0fd8,_0x348e91);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index f6a9378..22e82f5 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 _0x5cd5=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','index','/describe','isAuthenticated','describe','get','/:id/members','getMembers','/:id/teams','getTeams','create','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer'];(function(_0x5838cf,_0x5208b6){var _0x78c437=function(_0x280d98){while(--_0x280d98){_0x5838cf['push'](_0x5838cf['shift']());}};_0x78c437(++_0x5208b6);}(_0x5cd5,0x149));var _0x55cd=function(_0x535205,_0x5d94fd){_0x535205=_0x535205-0x0;var _0x3030e3=_0x5cd5[_0x535205];return _0x3030e3;};'use strict';var multer=require(_0x55cd('0x0'));var util=require(_0x55cd('0x1'));var path=require(_0x55cd('0x2'));var timeout=require(_0x55cd('0x3'));var express=require(_0x55cd('0x4'));var router=express['Router']();var fs_extra=require(_0x55cd('0x5'));var auth=require(_0x55cd('0x6'));var interaction=require(_0x55cd('0x7'));var config=require(_0x55cd('0x8'));var controller=require(_0x55cd('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x55cd('0xa')]);router['get'](_0x55cd('0xb'),auth[_0x55cd('0xc')](),controller[_0x55cd('0xd')]);router[_0x55cd('0xe')]('/:id',auth[_0x55cd('0xc')](),controller['show']);router[_0x55cd('0xe')](_0x55cd('0xf'),auth['isAuthenticated'](),controller[_0x55cd('0x10')]);router[_0x55cd('0xe')](_0x55cd('0x11'),auth['isAuthenticated'](),controller[_0x55cd('0x12')]);router[_0x55cd('0xe')]('/:id/users',auth[_0x55cd('0xc')](),controller['getAgents']);router['post']('/',auth[_0x55cd('0xc')](),controller[_0x55cd('0x13')]);router[_0x55cd('0x14')](_0x55cd('0x11'),auth[_0x55cd('0xc')](),controller[_0x55cd('0x15')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x55cd('0x16')]);router[_0x55cd('0x17')]('/:id',auth[_0x55cd('0xc')](),controller[_0x55cd('0x18')]);router[_0x55cd('0x19')]('/:id',auth[_0x55cd('0xc')](),controller[_0x55cd('0x1a')]);router[_0x55cd('0x19')](_0x55cd('0x11'),auth['isAuthenticated'](),controller[_0x55cd('0x1b')]);router[_0x55cd('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0x55cd('0x1c')]);module[_0x55cd('0x1d')]=router; \ No newline at end of file +var _0x88f3=['post','addAgents','put','update','delete','destroy','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','./whatsappQueue.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x88f3,0x70));var _0x388f=function(_0x449118,_0x14ce50){_0x449118=_0x449118-0x0;var _0x3ed0f2=_0x88f3[_0x449118];return _0x3ed0f2;};'use strict';var multer=require('multer');var util=require(_0x388f('0x0'));var path=require(_0x388f('0x1'));var timeout=require('connect-timeout');var express=require(_0x388f('0x2'));var router=express[_0x388f('0x3')]();var fs_extra=require(_0x388f('0x4'));var auth=require(_0x388f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x388f('0x6'));router[_0x388f('0x7')]('/',auth['isAuthenticated'](),controller[_0x388f('0x8')]);router['get'](_0x388f('0x9'),auth[_0x388f('0xa')](),controller['describe']);router[_0x388f('0x7')](_0x388f('0xb'),auth[_0x388f('0xa')](),controller[_0x388f('0xc')]);router[_0x388f('0x7')](_0x388f('0xd'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x388f('0xe'),auth[_0x388f('0xa')](),controller[_0x388f('0xf')]);router[_0x388f('0x7')](_0x388f('0x10'),auth[_0x388f('0xa')](),controller[_0x388f('0x11')]);router['post']('/',auth[_0x388f('0xa')](),controller['create']);router[_0x388f('0x12')](_0x388f('0xe'),auth[_0x388f('0xa')](),controller['addTeams']);router[_0x388f('0x12')](_0x388f('0x10'),auth[_0x388f('0xa')](),controller[_0x388f('0x13')]);router[_0x388f('0x14')]('/:id',auth[_0x388f('0xa')](),controller[_0x388f('0x15')]);router[_0x388f('0x16')]('/:id',auth[_0x388f('0xa')](),controller[_0x388f('0x17')]);router[_0x388f('0x16')](_0x388f('0xe'),auth[_0x388f('0xa')](),controller['removeTeams']);router[_0x388f('0x16')]('/:id/users',auth[_0x388f('0xa')](),controller[_0x388f('0x18')]);module[_0x388f('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 4768832..305259f 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 _0x6364=['rrmemory','beepall','roundrobin','STRING','name','INTEGER','ENUM'];(function(_0xb0b966,_0x1f21e9){var _0x182842=function(_0x35b372){while(--_0x35b372){_0xb0b966['push'](_0xb0b966['shift']());}};_0x182842(++_0x1f21e9);}(_0x6364,0x8f));var _0x4636=function(_0x5e8586,_0x4fa046){_0x5e8586=_0x5e8586-0x0;var _0x49e062=_0x6364[_0x5e8586];return _0x49e062;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4636('0x0')],'unique':_0x4636('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x4636('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4636('0x3')](_0x4636('0x4'),_0x4636('0x5'),_0x4636('0x6'))},'description':{'type':Sequelize[_0x4636('0x0')]}}; \ No newline at end of file +var _0x9d02=['sequelize','STRING','INTEGER','rrmemory','beepall'];(function(_0x34df4a,_0x209d10){var _0x145c69=function(_0xb9bcbd){while(--_0xb9bcbd){_0x34df4a['push'](_0x34df4a['shift']());}};_0x145c69(++_0x209d10);}(_0x9d02,0x118));var _0x29d0=function(_0x555089,_0x3b5a57){_0x555089=_0x555089-0x0;var _0x22e91e=_0x9d02[_0x555089];return _0x22e91e;};'use strict';var Sequelize=require(_0x29d0('0x0'));module['exports']={'name':{'type':Sequelize[_0x29d0('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x29d0('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x29d0('0x3'),_0x29d0('0x4'),'roundrobin')},'description':{'type':Sequelize[_0x29d0('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 6a1b05f..9a063eb 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 _0xa7cf=['filter','User','findAndCountAll','updatedAt','createdAt','rows','%s/%s','SIP','whatsappPause','getTeams','options','nolimit','addTeams','ids','Team','Agents','online','flatMap','sequelize','transaction','findOrCreate','forEach','userWhatsappQueue:save','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','includes','union','removeTeams','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','isArray','getAgents','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','send','WhatsappQueue','type','getOptions','where','include','findAll','catch','show','params','keys','rawAttributes','query','filters','intersection','fields','attributes','length','model','includeAll','merge','find','create','body','user','userProfileId','autoAssociation','update','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','order','sort','pick','map'];(function(_0x3ac523,_0x401e6b){var _0x55a76c=function(_0x494054){while(--_0x494054){_0x3ac523['push'](_0x3ac523['shift']());}};_0x55a76c(++_0x401e6b);}(_0xa7cf,0x9d));var _0xfa7c=function(_0x310a1b,_0x4c9129){_0x310a1b=_0x310a1b-0x0;var _0xdea206=_0xa7cf[_0x310a1b];return _0xdea206;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xfa7c('0x0'));var squel=require(_0xfa7c('0x1'));var Redis=require(_0xfa7c('0x2'));var qs=require(_0xfa7c('0x3'));var logger=require(_0xfa7c('0x4'))(_0xfa7c('0x5'));var config=require(_0xfa7c('0x6'));var db=require(_0xfa7c('0x7'))['db'];config[_0xfa7c('0x8')]=_['defaults'](config[_0xfa7c('0x8')],{'host':_0xfa7c('0x9'),'port':0x18eb});var socket=require(_0xfa7c('0xa'))(new Redis(config[_0xfa7c('0x8')]));require(_0xfa7c('0xb'))[_0xfa7c('0xc')](socket);function respondWithStatusCode(_0x50849b,_0x5949d6){_0x5949d6=_0x5949d6||0xcc;return function(_0xf416ce){if(_0xf416ce){return _0x50849b[_0xfa7c('0xd')](_0x5949d6);}return _0x50849b[_0xfa7c('0xe')](_0x5949d6)[_0xfa7c('0xf')]();};}function respondWithResult(_0xdd6aeb,_0x10aa6f){_0x10aa6f=_0x10aa6f||0xc8;return function(_0x135b35){if(_0x135b35){return _0xdd6aeb[_0xfa7c('0xe')](_0x10aa6f)[_0xfa7c('0x10')](_0x135b35);}};}function respondWithFilteredResult(_0xb2b135,_0x2ee5c8){return function(_0x15a8a4){if(_0x15a8a4){var _0x3ab415=typeof _0x2ee5c8['offset']===_0xfa7c('0x11')&&typeof _0x2ee5c8[_0xfa7c('0x12')]==='undefined';var _0x46ed2d=_0x15a8a4[_0xfa7c('0x13')];var _0x3c8dab=_0x3ab415?0x0:_0x2ee5c8[_0xfa7c('0x14')];var _0x3f6cd2=_0x3ab415?_0x15a8a4[_0xfa7c('0x13')]:_0x2ee5c8['offset']+_0x2ee5c8[_0xfa7c('0x12')];var _0x4a7bb0;if(_0x3f6cd2>=_0x46ed2d){_0x3f6cd2=_0x46ed2d;_0x4a7bb0=0xc8;}else{_0x4a7bb0=0xce;}_0xb2b135['status'](_0x4a7bb0);return _0xb2b135[_0xfa7c('0x15')]('Content-Range',_0x3c8dab+'-'+_0x3f6cd2+'/'+_0x46ed2d)[_0xfa7c('0x10')](_0x15a8a4);}return null;};}function saveUpdates(_0x125782){return function(_0x87b310){if(_0x87b310){return _0x87b310['update'](_0x125782)[_0xfa7c('0x16')](function(_0x5006d9){return _0x5006d9;});}return null;};}function removeEntity(_0x18998c){return function(_0x4d0d78){if(_0x4d0d78){return _0x4d0d78[_0xfa7c('0x17')]()['then'](function(){var _0x10cdcf=_0x4d0d78[_0xfa7c('0x18')]({'plain':!![]});var _0x1d49c3=_0xfa7c('0x19');return db[_0xfa7c('0x1a')][_0xfa7c('0x17')]({'where':{'type':_0x1d49c3,'resourceId':_0x10cdcf['id']}})[_0xfa7c('0x16')](function(){return _0x4d0d78;});})['then'](function(){_0x18998c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cecd0){return function(_0x80d0fd){if(!_0x80d0fd){_0x5cecd0['sendStatus'](0x194);}return _0x80d0fd;};}function handleError(_0x56a787,_0x5d03e0){_0x5d03e0=_0x5d03e0||0x1f4;return function(_0x3b8868){logger[_0xfa7c('0x1b')](_0x3b8868[_0xfa7c('0x1c')]);if(_0x3b8868[_0xfa7c('0x1d')]){delete _0x3b8868[_0xfa7c('0x1d')];}_0x56a787[_0xfa7c('0xe')](_0x5d03e0)[_0xfa7c('0x1e')](_0x3b8868);};}exports['index']=function(_0xce5fbc,_0x83702d){var _0x2219cd={};var _0x2cba62={'count':0x0,'rows':[]};var _0x49248d=_['map'](db[_0xfa7c('0x1f')]['rawAttributes'],function(_0x31d242){return{'name':_0x31d242['fieldName'],'type':_0x31d242[_0xfa7c('0x20')]['key']};});_0x2219cd=qs[_0xfa7c('0x21')](_0x49248d,_0xce5fbc);var _0x452e62={'where':_0x2219cd[_0xfa7c('0x22')]};return db[_0xfa7c('0x1f')][_0xfa7c('0x13')](_0x452e62)['then'](function(_0x1bd80c){_0x2cba62[_0xfa7c('0x13')]=_0x1bd80c;_0x2219cd[_0xfa7c('0x23')]=qs[_0xfa7c('0x23')](_0xce5fbc['query']);return db[_0xfa7c('0x1f')][_0xfa7c('0x24')](_0x2219cd);})[_0xfa7c('0x16')](function(_0x3c66e3){_0x2cba62['rows']=_0x3c66e3;return _0x2cba62;})[_0xfa7c('0x16')](respondWithFilteredResult(_0x83702d,_0x2219cd))[_0xfa7c('0x25')](handleError(_0x83702d,null));};exports[_0xfa7c('0x26')]=function(_0x1d0c53,_0x283690){var _0x12c8e1={'raw':!![],'where':{'id':_0x1d0c53[_0xfa7c('0x27')]['id']}},_0x1a97fc={};_0x1a97fc['model']=_[_0xfa7c('0x28')](db[_0xfa7c('0x1f')][_0xfa7c('0x29')]);_0x1a97fc[_0xfa7c('0x2a')]=_['keys'](_0x1d0c53[_0xfa7c('0x2a')]);_0x1a97fc[_0xfa7c('0x2b')]=_[_0xfa7c('0x2c')](_0x1a97fc['model'],_0x1a97fc[_0xfa7c('0x2a')]);_0x12c8e1['attributes']=_[_0xfa7c('0x2c')](_0x1a97fc['model'],qs[_0xfa7c('0x2d')](_0x1d0c53[_0xfa7c('0x2a')]['fields']));_0x12c8e1[_0xfa7c('0x2e')]=_0x12c8e1[_0xfa7c('0x2e')][_0xfa7c('0x2f')]?_0x12c8e1[_0xfa7c('0x2e')]:_0x1a97fc[_0xfa7c('0x30')];if(_0x1d0c53[_0xfa7c('0x2a')][_0xfa7c('0x31')]){_0x12c8e1['include']=[{'all':!![]}];}_0x12c8e1=_[_0xfa7c('0x32')]({},_0x12c8e1,_0x1d0c53['options']);return db[_0xfa7c('0x1f')][_0xfa7c('0x33')](_0x12c8e1)['then'](handleEntityNotFound(_0x283690,null))[_0xfa7c('0x16')](respondWithResult(_0x283690,null))['catch'](handleError(_0x283690,null));};exports[_0xfa7c('0x34')]=function(_0xe83ff6,_0x25e32c){return db['WhatsappQueue']['create'](_0xe83ff6[_0xfa7c('0x35')],{})[_0xfa7c('0x16')](function(_0x344c26){var _0x5a0906=_0xe83ff6[_0xfa7c('0x36')][_0xfa7c('0x18')]({'plain':!![]});if(!_0x5a0906)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a0906['role']===_0xfa7c('0x36')){var _0x277f72=_0x344c26['get']({'plain':!![]});var _0x482378=_0xfa7c('0x19');return db['UserProfileSection'][_0xfa7c('0x33')]({'where':{'name':_0x482378,'userProfileId':_0x5a0906[_0xfa7c('0x37')]},'raw':!![]})['then'](function(_0xf093d6){if(_0xf093d6&&_0xf093d6[_0xfa7c('0x38')]===0x0){return db[_0xfa7c('0x1a')][_0xfa7c('0x34')]({'name':_0x277f72['name'],'resourceId':_0x277f72['id'],'type':_0xf093d6[_0xfa7c('0x1d')],'sectionId':_0xf093d6['id']},{})[_0xfa7c('0x16')](function(){return _0x344c26;});}else{return _0x344c26;}})['catch'](function(_0x3429be){logger[_0xfa7c('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3429be);throw _0x3429be;});}return _0x344c26;})[_0xfa7c('0x16')](respondWithResult(_0x25e32c,0xc9))[_0xfa7c('0x25')](handleError(_0x25e32c,null));};exports[_0xfa7c('0x39')]=function(_0xcc5810,_0x6beb8b){if(_0xcc5810[_0xfa7c('0x35')]['id']){delete _0xcc5810[_0xfa7c('0x35')]['id'];}return db[_0xfa7c('0x1f')][_0xfa7c('0x33')]({'where':{'id':_0xcc5810['params']['id']}})[_0xfa7c('0x16')](handleEntityNotFound(_0x6beb8b,null))['then'](saveUpdates(_0xcc5810[_0xfa7c('0x35')],null))[_0xfa7c('0x16')](respondWithResult(_0x6beb8b,null))[_0xfa7c('0x25')](handleError(_0x6beb8b,null));};exports['destroy']=function(_0x326c45,_0xb8cc12){return db['WhatsappQueue'][_0xfa7c('0x33')]({'where':{'id':_0x326c45[_0xfa7c('0x27')]['id']}})[_0xfa7c('0x16')](handleEntityNotFound(_0xb8cc12,null))['then'](removeEntity(_0xb8cc12,null))[_0xfa7c('0x25')](handleError(_0xb8cc12,null));};exports[_0xfa7c('0x3a')]=function(_0x4ab1e5,_0x972522){return db[_0xfa7c('0x1f')][_0xfa7c('0x3a')]()[_0xfa7c('0x16')](respondWithResult(_0x972522,null))[_0xfa7c('0x25')](handleError(_0x972522,null));};exports[_0xfa7c('0x3b')]=function(_0x474a84,_0x4641c5){var _0x8c1e60={'raw':!![],'where':{}},_0x1b9b67={},_0x5f42dd;return db[_0xfa7c('0x1f')][_0xfa7c('0x3c')]({'where':{'id':_0x474a84[_0xfa7c('0x27')]['id']}})['then'](handleEntityNotFound(_0x4641c5,null))[_0xfa7c('0x16')](function(_0x13dca3){if(_0x13dca3){_0x5f42dd=_0x13dca3[_0xfa7c('0x18')]({'plain':!![]});_0x1b9b67[_0xfa7c('0x30')]=_[_0xfa7c('0x28')](db[_0xfa7c('0x3d')][_0xfa7c('0x29')]);_0x1b9b67[_0xfa7c('0x2a')]=_['keys'](_0x474a84[_0xfa7c('0x2a')]);_0x1b9b67[_0xfa7c('0x2b')]=_[_0xfa7c('0x2c')](_0x1b9b67[_0xfa7c('0x30')],_0x1b9b67[_0xfa7c('0x2a')]);_0x8c1e60[_0xfa7c('0x2e')]=_[_0xfa7c('0x2c')](_0x1b9b67[_0xfa7c('0x30')],qs[_0xfa7c('0x2d')](_0x474a84[_0xfa7c('0x2a')]['fields']));_0x8c1e60['attributes']=_0x8c1e60[_0xfa7c('0x2e')][_0xfa7c('0x2f')]?_0x8c1e60['attributes']:_0x1b9b67['model'];if(!_0x474a84['query'][_0xfa7c('0x3e')]('nolimit')){_0x8c1e60[_0xfa7c('0x12')]=qs[_0xfa7c('0x12')](_0x474a84[_0xfa7c('0x2a')]['limit']);_0x8c1e60[_0xfa7c('0x14')]=qs['offset'](_0x474a84[_0xfa7c('0x2a')][_0xfa7c('0x14')]);}_0x8c1e60[_0xfa7c('0x3f')]=qs[_0xfa7c('0x40')](_0x474a84['query'][_0xfa7c('0x40')]);_0x8c1e60[_0xfa7c('0x22')]=qs[_0xfa7c('0x2b')](_[_0xfa7c('0x41')](_0x474a84[_0xfa7c('0x2a')],_0x1b9b67[_0xfa7c('0x2b')]));_0x8c1e60[_0xfa7c('0x22')]['WhatsappQueueId']=_0x13dca3['id'];if(_0x474a84[_0xfa7c('0x2a')]['filter']){_0x8c1e60[_0xfa7c('0x22')]=_['merge'](_0x8c1e60['where'],{'$or':_[_0xfa7c('0x42')](_0x8c1e60[_0xfa7c('0x2e')],function(_0x1249d3){var _0x41d338={};_0x41d338[_0x1249d3]={'$like':'%'+_0x474a84[_0xfa7c('0x2a')][_0xfa7c('0x43')]+'%'};return _0x41d338;})});}_0x8c1e60=_[_0xfa7c('0x32')]({},_0x8c1e60,_0x474a84['options']);return db['UserWhatsappQueue']['findAll'](_0x8c1e60);}})['then'](function(_0x8648f6){if(_0x8648f6){return db[_0xfa7c('0x44')][_0xfa7c('0x45')]({'where':{'id':_[_0xfa7c('0x42')](_0x8648f6,'UserId'),'role':'agent'},'attributes':['id','name','whatsappPause',_0xfa7c('0x46'),_0xfa7c('0x47')]});}})['then'](function(_0x4b39c5){if(_0x4b39c5){return{'count':_0x4b39c5[_0xfa7c('0x13')],'rows':_[_0xfa7c('0x42')](_0x4b39c5[_0xfa7c('0x48')],function(_0x248dea){return{'membername':_0x248dea[_0xfa7c('0x1d')],'UserId':_0x248dea['id'],'queue_name':_0x5f42dd['name'],'WhatsappQueueId':_0x5f42dd['id'],'interface':util['format'](_0xfa7c('0x49'),_0xfa7c('0x4a'),_0x248dea['name']),'penalty':0x0,'paused':_0x248dea[_0xfa7c('0x4b')],'createdAt':_0x248dea['createdAt'],'updatedAt':_0x248dea[_0xfa7c('0x46')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfa7c('0x16')](respondWithFilteredResult(_0x4641c5,_0x8c1e60))[_0xfa7c('0x25')](handleError(_0x4641c5,null));};exports[_0xfa7c('0x4c')]=function(_0x2ed744,_0x18857a){var _0x38803a={};var _0x2a6629={};var _0x3fe962;var _0x2b424a;return db[_0xfa7c('0x1f')][_0xfa7c('0x3c')]({'where':{'id':_0x2ed744[_0xfa7c('0x27')]['id']}})['then'](handleEntityNotFound(_0x18857a,null))['then'](function(_0x32c901){if(_0x32c901){_0x3fe962=_0x32c901;_0x2a6629[_0xfa7c('0x30')]=_['keys'](db['Team'][_0xfa7c('0x29')]);_0x2a6629[_0xfa7c('0x2a')]=_[_0xfa7c('0x28')](_0x2ed744[_0xfa7c('0x2a')]);_0x2a6629[_0xfa7c('0x2b')]=_[_0xfa7c('0x2c')](_0x2a6629[_0xfa7c('0x30')],_0x2a6629[_0xfa7c('0x2a')]);_0x38803a[_0xfa7c('0x2e')]=_['intersection'](_0x2a6629[_0xfa7c('0x30')],qs[_0xfa7c('0x2d')](_0x2ed744[_0xfa7c('0x2a')][_0xfa7c('0x2d')]));_0x38803a[_0xfa7c('0x2e')]=_0x38803a['attributes']['length']?_0x38803a['attributes']:_0x2a6629[_0xfa7c('0x30')];_0x38803a['order']=qs[_0xfa7c('0x40')](_0x2ed744[_0xfa7c('0x2a')]['sort']);_0x38803a[_0xfa7c('0x22')]=qs[_0xfa7c('0x2b')](_[_0xfa7c('0x41')](_0x2ed744[_0xfa7c('0x2a')],_0x2a6629[_0xfa7c('0x2b')]));if(_0x2ed744[_0xfa7c('0x2a')][_0xfa7c('0x43')]){_0x38803a[_0xfa7c('0x22')]=_['merge'](_0x38803a['where'],{'$or':_[_0xfa7c('0x42')](_0x38803a[_0xfa7c('0x2e')],function(_0x5f3ebd){var _0x4ea1c4={};_0x4ea1c4[_0x5f3ebd]={'$like':'%'+_0x2ed744[_0xfa7c('0x2a')]['filter']+'%'};return _0x4ea1c4;})});}_0x38803a=_['merge']({},_0x38803a,_0x2ed744[_0xfa7c('0x4d')]);return _0x3fe962['getTeams'](_0x38803a);}})[_0xfa7c('0x16')](function(_0x2a8806){if(_0x2a8806){_0x2b424a=_0x2a8806[_0xfa7c('0x2f')];if(!_0x2ed744[_0xfa7c('0x2a')][_0xfa7c('0x3e')](_0xfa7c('0x4e'))){_0x38803a[_0xfa7c('0x12')]=qs[_0xfa7c('0x12')](_0x2ed744[_0xfa7c('0x2a')][_0xfa7c('0x12')]);_0x38803a[_0xfa7c('0x14')]=qs[_0xfa7c('0x14')](_0x2ed744[_0xfa7c('0x2a')]['offset']);}return _0x3fe962[_0xfa7c('0x4c')](_0x38803a);}})[_0xfa7c('0x16')](function(_0x588128){if(_0x588128){return _0x588128?{'count':_0x2b424a,'rows':_0x588128}:null;}})[_0xfa7c('0x16')](respondWithResult(_0x18857a,null))[_0xfa7c('0x25')](handleError(_0x18857a,null));};exports[_0xfa7c('0x4f')]=function(_0x34aa55,_0x3d342f){var _0x27bea8=_0x34aa55[_0xfa7c('0x35')][_0xfa7c('0x50')];return db[_0xfa7c('0x51')]['findAll']({'where':{'id':_0x27bea8},'attributes':['id'],'include':[{'model':db[_0xfa7c('0x44')],'as':_0xfa7c('0x52'),'attributes':['id','name',_0xfa7c('0x53'),'voicePause','interface'],'raw':!![]}]})[_0xfa7c('0x16')](function(_0x50ccda){if(_0x50ccda){var _0x242923=_[_0xfa7c('0x54')](_0x50ccda,function(_0x453d84){var _0x46b926=_0x453d84[_0xfa7c('0x18')]({'plain':!![]});return _0x46b926[_0xfa7c('0x52')];});return db[_0xfa7c('0x1f')][_0xfa7c('0x33')]({'where':{'id':_0x34aa55['params']['id']}})[_0xfa7c('0x16')](function(_0x128779){return db[_0xfa7c('0x55')][_0xfa7c('0x56')](function(_0x5dbe0f){return _0x128779['addTeams'](_0x27bea8,{'transaction':_0x5dbe0f})[_0xfa7c('0x16')](function(){return BPromise['each'](_0x242923,function(_0x113bd5){return db[_0xfa7c('0x3d')][_0xfa7c('0x57')]({'where':{'UserId':_0x113bd5['id'],'WhatsappQueueId':_0x34aa55[_0xfa7c('0x27')]['id']},'transaction':_0x5dbe0f});});})[_0xfa7c('0x16')](function(){_0x242923[_0xfa7c('0x58')](function(_0x16f605){socket['emit'](_0xfa7c('0x59'),{'UserId':_0x16f605['id'],'WhatsappQueueId':_0x128779['id']});});});});});}})[_0xfa7c('0x16')](respondWithStatusCode(_0x3d342f,null))['catch'](handleError(_0x3d342f,null));};exports['removeTeams']=function(_0x5000ca,_0x5a5137){return db['Team'][_0xfa7c('0x24')]({'where':{'id':_0x5000ca[_0xfa7c('0x2a')][_0xfa7c('0x50')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfa7c('0x52'),'attributes':['id'],'raw':!![]}]})[_0xfa7c('0x16')](handleEntityNotFound(_0x5a5137,null))[_0xfa7c('0x16')](function(_0x417818){var _0x548d2e=_[_0xfa7c('0x42')](_0x417818,'id');var _0x554187=[];var _0x41209d=[];var _0x5e6c28=squel[_0xfa7c('0x5a')]();_0x5e6c28[_0xfa7c('0x5b')](_0xfa7c('0x5c'))[_0xfa7c('0x5d')]('team_has_whatsapp_queues','tq')[_0xfa7c('0x5e')](_0xfa7c('0x5f'),'ut',_0xfa7c('0x60'))[_0xfa7c('0x22')]('WhatsappQueueId\x20=\x20?',_0x5000ca[_0xfa7c('0x27')]['id']);for(var _0x3e5514=0x0;_0x3e5514<_0x417818[_0xfa7c('0x2f')];_0x3e5514+=0x1){let _0x4e9ac4=_0x417818[_0x3e5514];for(var _0x5ecb48=0x0;_0x5ecb48<_0x4e9ac4[_0xfa7c('0x52')]['length'];_0x5ecb48+=0x1){let _0x3b148d=_0x4e9ac4[_0xfa7c('0x52')][_0x5ecb48];var _0x39b88f=_0x5e6c28['clone']();_0x39b88f['where'](_0xfa7c('0x61'),_0x3b148d['id']);_0x41209d[_0xfa7c('0x62')](db['sequelize'][_0xfa7c('0x2a')](_0x39b88f['toString'](),{'type':db[_0xfa7c('0x55')][_0xfa7c('0x63')][_0xfa7c('0x64')]})[_0xfa7c('0x16')](function(_0x2a28b4){if(_0x2a28b4[_0xfa7c('0x2f')]===0x1){return _0x3b148d['id'];}else{var _0x633969=_['every'](_[_0xfa7c('0x42')](_0x2a28b4,_0xfa7c('0x65')),function(_0x33db16){return _[_0xfa7c('0x66')](_0x548d2e,_0x33db16);});if(_0x633969){return _0x3b148d['id'];}}}));}}return BPromise['all'](_0x41209d)['then'](function(_0x3ee326){_0x554187=_(_0x554187)[_0xfa7c('0x67')](_0x3ee326)['compact']()['value']();return db[_0xfa7c('0x1f')]['find']({'where':{'id':_0x5000ca[_0xfa7c('0x27')]['id']}})['then'](function(_0x483a82){return db['sequelize'][_0xfa7c('0x56')](function(_0xeccd82){return _0x483a82[_0xfa7c('0x68')](_0x5000ca[_0xfa7c('0x2a')]['ids'],{'transaction':_0xeccd82})[_0xfa7c('0x16')](function(){if(!_[_0xfa7c('0x69')](_0x554187)){return _0x483a82[_0xfa7c('0x6a')](_0x554187,{'transaction':_0xeccd82});}})[_0xfa7c('0x16')](function(){_0x554187[_0xfa7c('0x58')](function(_0x4b56fb){socket[_0xfa7c('0x6b')](_0xfa7c('0x6c'),{'UserId':_0x4b56fb,'WhatsappQueueId':_0x483a82['id']});});});});});});})[_0xfa7c('0x16')](respondWithStatusCode(_0x5a5137,null))[_0xfa7c('0x25')](handleError(_0x5a5137,null));};exports[_0xfa7c('0x6d')]=function(_0x5112a6,_0x4abe80){return db[_0xfa7c('0x1f')]['find']({'where':{'id':_0x5112a6[_0xfa7c('0x27')]['id']}})[_0xfa7c('0x16')](handleEntityNotFound(_0x4abe80,null))[_0xfa7c('0x16')](function(_0x1a6f60){if(_0x1a6f60){return _0x1a6f60[_0xfa7c('0x6d')](_0x5112a6['body'][_0xfa7c('0x50')],_['omit'](_0x5112a6['body'],[_0xfa7c('0x50'),'id'])||{})['spread'](function(_0xd3e929){for(var _0x5d4d2f=0x0;_0x5d4d2f<_0x5112a6[_0xfa7c('0x35')][_0xfa7c('0x50')][_0xfa7c('0x2f')];_0x5d4d2f+=0x1){socket['emit'](_0xfa7c('0x59'),{'UserId':Number(_0x5112a6[_0xfa7c('0x35')][_0xfa7c('0x50')][_0x5d4d2f]),'WhatsappQueueId':Number(_0x5112a6['params']['id'])});}return _0xd3e929;});}})[_0xfa7c('0x16')](respondWithResult(_0x4abe80,null))[_0xfa7c('0x25')](handleError(_0x4abe80,null));};exports['removeAgents']=function(_0xfb7884,_0x39b5cd){return db[_0xfa7c('0x1f')]['find']({'where':{'id':_0xfb7884['params']['id']}})[_0xfa7c('0x16')](handleEntityNotFound(_0x39b5cd,null))[_0xfa7c('0x16')](function(_0x415b57){if(_0x415b57){return _0x415b57[_0xfa7c('0x6a')](_0xfb7884[_0xfa7c('0x2a')]['ids'])[_0xfa7c('0x16')](function(){if(_[_0xfa7c('0x6e')](_0xfb7884['query']['ids'])){for(var _0x590cd3=0x0;_0x590cd3<_0xfb7884[_0xfa7c('0x2a')]['ids']['length'];_0x590cd3+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0xfb7884[_0xfa7c('0x2a')]['ids'][_0x590cd3]),'WhatsappQueueId':Number(_0xfb7884[_0xfa7c('0x27')]['id'])});}}else{socket[_0xfa7c('0x6b')]('userWhatsappQueue:remove',{'UserId':Number(_0xfb7884[_0xfa7c('0x2a')][_0xfa7c('0x50')]),'WhatsappQueueId':Number(_0xfb7884[_0xfa7c('0x27')]['id'])});}});}})[_0xfa7c('0x16')](respondWithStatusCode(_0x39b5cd,null))[_0xfa7c('0x25')](handleError(_0x39b5cd,null));};exports[_0xfa7c('0x6f')]=function(_0x2e0331,_0x9cf872){var _0x3b2dd0={};var _0x940063={};var _0xbfede6;var _0x32f945;return db[_0xfa7c('0x1f')][_0xfa7c('0x3c')]({'where':{'id':_0x2e0331['params']['id']}})['then'](handleEntityNotFound(_0x9cf872,null))[_0xfa7c('0x16')](function(_0x1922de){if(_0x1922de){_0xbfede6=_0x1922de;_0x940063[_0xfa7c('0x30')]=_[_0xfa7c('0x28')](db[_0xfa7c('0x44')][_0xfa7c('0x29')]);_0x940063['query']=_[_0xfa7c('0x28')](_0x2e0331['query']);_0x940063[_0xfa7c('0x2b')]=_[_0xfa7c('0x2c')](_0x940063['model'],_0x940063[_0xfa7c('0x2a')]);_0x3b2dd0['attributes']=_[_0xfa7c('0x2c')](_0x940063[_0xfa7c('0x30')],qs[_0xfa7c('0x2d')](_0x2e0331[_0xfa7c('0x2a')][_0xfa7c('0x2d')]));_0x3b2dd0[_0xfa7c('0x2e')]=_0x3b2dd0[_0xfa7c('0x2e')][_0xfa7c('0x2f')]?_0x3b2dd0['attributes']:_0x940063[_0xfa7c('0x30')];_0x3b2dd0[_0xfa7c('0x3f')]=qs[_0xfa7c('0x40')](_0x2e0331[_0xfa7c('0x2a')][_0xfa7c('0x40')]);_0x3b2dd0['where']=qs[_0xfa7c('0x2b')](_['pick'](_0x2e0331['query'],_0x940063[_0xfa7c('0x2b')]));if(_0x2e0331[_0xfa7c('0x2a')][_0xfa7c('0x43')]){_0x3b2dd0[_0xfa7c('0x22')]=_['merge'](_0x3b2dd0['where'],{'$or':_[_0xfa7c('0x42')](_0x3b2dd0[_0xfa7c('0x2e')],function(_0x504474){var _0x1b400d={};_0x1b400d[_0x504474]={'$like':'%'+_0x2e0331['query'][_0xfa7c('0x43')]+'%'};return _0x1b400d;})});}_0x3b2dd0=_[_0xfa7c('0x32')]({},_0x3b2dd0,_0x2e0331[_0xfa7c('0x4d')]);return _0xbfede6['getAgents'](_0x3b2dd0);}})['then'](function(_0x9530c8){if(_0x9530c8){_0x32f945=_0x9530c8[_0xfa7c('0x2f')];if(!_0x2e0331[_0xfa7c('0x2a')][_0xfa7c('0x3e')](_0xfa7c('0x4e'))){_0x3b2dd0[_0xfa7c('0x12')]=qs[_0xfa7c('0x12')](_0x2e0331[_0xfa7c('0x2a')]['limit']);_0x3b2dd0[_0xfa7c('0x14')]=qs[_0xfa7c('0x14')](_0x2e0331[_0xfa7c('0x2a')][_0xfa7c('0x14')]);}return _0xbfede6[_0xfa7c('0x6f')](_0x3b2dd0);}})['then'](function(_0x248db1){if(_0x248db1){return _0x248db1?{'count':_0x32f945,'rows':_0x248db1}:null;}})[_0xfa7c('0x16')](respondWithResult(_0x9cf872,null))[_0xfa7c('0x25')](handleError(_0x9cf872,null));}; \ No newline at end of file +var _0xda4f=['update','then','get','WhatsappQueues','destroy','error','stack','name','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','catch','show','params','keys','filters','model','intersection','fields','attributes','length','includeAll','merge','options','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','describe','getMembers','UserWhatsappQueue','nolimit','order','sort','pick','WhatsappQueueId','filter','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','findOne','Team','hasOwnProperty','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','removeAgents','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','./whatsappQueue.socket','register','sendStatus','end','status','json','offset','count','limit','Content-Range'];(function(_0x40baa0,_0x4a557e){var _0x47d78c=function(_0x10f9eb){while(--_0x10f9eb){_0x40baa0['push'](_0x40baa0['shift']());}};_0x47d78c(++_0x4a557e);}(_0xda4f,0x168));var _0xfda4=function(_0x5d6518,_0x5e2d02){_0x5d6518=_0x5d6518-0x0;var _0x17c918=_0xda4f[_0x5d6518];return _0x17c918;};'use strict';var BPromise=require(_0xfda4('0x0'));var util=require(_0xfda4('0x1'));var _=require(_0xfda4('0x2'));var squel=require(_0xfda4('0x3'));var Redis=require(_0xfda4('0x4'));var qs=require(_0xfda4('0x5'));var logger=require('../../config/logger')(_0xfda4('0x6'));var config=require(_0xfda4('0x7'));var db=require(_0xfda4('0x8'))['db'];config[_0xfda4('0x9')]=_['defaults'](config[_0xfda4('0x9')],{'host':_0xfda4('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfda4('0x9')]));require(_0xfda4('0xb'))[_0xfda4('0xc')](socket);function respondWithStatusCode(_0x555f3a,_0x53c2e3){_0x53c2e3=_0x53c2e3||0xcc;return function(_0x5c3b3e){if(_0x5c3b3e){return _0x555f3a[_0xfda4('0xd')](_0x53c2e3);}return _0x555f3a['status'](_0x53c2e3)[_0xfda4('0xe')]();};}function respondWithResult(_0x48eda1,_0x569570){_0x569570=_0x569570||0xc8;return function(_0x1ee530){if(_0x1ee530){return _0x48eda1[_0xfda4('0xf')](_0x569570)[_0xfda4('0x10')](_0x1ee530);}};}function respondWithFilteredResult(_0x1ce2de,_0x2f6aaa){return function(_0x2e370d){if(_0x2e370d){var _0x1693af=typeof _0x2f6aaa[_0xfda4('0x11')]==='undefined'&&typeof _0x2f6aaa['limit']==='undefined';var _0x173702=_0x2e370d[_0xfda4('0x12')];var _0x4a4bf6=_0x1693af?0x0:_0x2f6aaa[_0xfda4('0x11')];var _0x99b4f3=_0x1693af?_0x2e370d[_0xfda4('0x12')]:_0x2f6aaa[_0xfda4('0x11')]+_0x2f6aaa[_0xfda4('0x13')];var _0x52e2bb;if(_0x99b4f3>=_0x173702){_0x99b4f3=_0x173702;_0x52e2bb=0xc8;}else{_0x52e2bb=0xce;}_0x1ce2de[_0xfda4('0xf')](_0x52e2bb);return _0x1ce2de['set'](_0xfda4('0x14'),_0x4a4bf6+'-'+_0x99b4f3+'/'+_0x173702)['json'](_0x2e370d);}return null;};}function saveUpdates(_0x5131e3){return function(_0x3ff5cb){if(_0x3ff5cb){return _0x3ff5cb[_0xfda4('0x15')](_0x5131e3)[_0xfda4('0x16')](function(_0x22e833){return _0x22e833;});}return null;};}function removeEntity(_0x5773ef){return function(_0x569911){if(_0x569911){return _0x569911['destroy']()[_0xfda4('0x16')](function(){var _0x1c73ef=_0x569911[_0xfda4('0x17')]({'plain':!![]});var _0x2892ea=_0xfda4('0x18');return db['UserProfileResource'][_0xfda4('0x19')]({'where':{'type':_0x2892ea,'resourceId':_0x1c73ef['id']}})[_0xfda4('0x16')](function(){return _0x569911;});})[_0xfda4('0x16')](function(){_0x5773ef[_0xfda4('0xf')](0xcc)[_0xfda4('0xe')]();});}};}function handleEntityNotFound(_0xac70c9){return function(_0x3144de){if(!_0x3144de){_0xac70c9[_0xfda4('0xd')](0x194);}return _0x3144de;};}function handleError(_0x500354,_0x510a43){_0x510a43=_0x510a43||0x1f4;return function(_0x1267a9){logger[_0xfda4('0x1a')](_0x1267a9[_0xfda4('0x1b')]);if(_0x1267a9[_0xfda4('0x1c')]){delete _0x1267a9[_0xfda4('0x1c')];}_0x500354['status'](_0x510a43)['send'](_0x1267a9);};}exports[_0xfda4('0x1d')]=function(_0x289131,_0x210961){var _0xf8159={};var _0x574a1d={'count':0x0,'rows':[]};var _0x36dfea=_[_0xfda4('0x1e')](db[_0xfda4('0x1f')][_0xfda4('0x20')],function(_0x9bca23){return{'name':_0x9bca23[_0xfda4('0x21')],'type':_0x9bca23[_0xfda4('0x22')][_0xfda4('0x23')]};});_0xf8159=qs[_0xfda4('0x24')](_0x36dfea,_0x289131);var _0xef1b67={'where':_0xf8159[_0xfda4('0x25')]};return db[_0xfda4('0x1f')]['count'](_0xef1b67)['then'](function(_0x4a1ea7){_0x574a1d['count']=_0x4a1ea7;_0xf8159[_0xfda4('0x26')]=qs[_0xfda4('0x26')](_0x289131[_0xfda4('0x27')]);return db[_0xfda4('0x1f')][_0xfda4('0x28')](_0xf8159);})[_0xfda4('0x16')](function(_0x5f4950){_0x574a1d['rows']=_0x5f4950;return _0x574a1d;})[_0xfda4('0x16')](respondWithFilteredResult(_0x210961,_0xf8159))[_0xfda4('0x29')](handleError(_0x210961,null));};exports[_0xfda4('0x2a')]=function(_0x3319bc,_0x13cf0c){var _0x1ab6ec={'raw':!![],'where':{'id':_0x3319bc[_0xfda4('0x2b')]['id']}},_0x1b026d={};_0x1b026d['model']=_[_0xfda4('0x2c')](db[_0xfda4('0x1f')][_0xfda4('0x20')]);_0x1b026d[_0xfda4('0x27')]=_[_0xfda4('0x2c')](_0x3319bc[_0xfda4('0x27')]);_0x1b026d[_0xfda4('0x2d')]=_['intersection'](_0x1b026d[_0xfda4('0x2e')],_0x1b026d[_0xfda4('0x27')]);_0x1ab6ec['attributes']=_[_0xfda4('0x2f')](_0x1b026d[_0xfda4('0x2e')],qs[_0xfda4('0x30')](_0x3319bc[_0xfda4('0x27')]['fields']));_0x1ab6ec['attributes']=_0x1ab6ec[_0xfda4('0x31')][_0xfda4('0x32')]?_0x1ab6ec[_0xfda4('0x31')]:_0x1b026d[_0xfda4('0x2e')];if(_0x3319bc['query'][_0xfda4('0x33')]){_0x1ab6ec[_0xfda4('0x26')]=[{'all':!![]}];}_0x1ab6ec=_[_0xfda4('0x34')]({},_0x1ab6ec,_0x3319bc[_0xfda4('0x35')]);return db[_0xfda4('0x1f')]['find'](_0x1ab6ec)['then'](handleEntityNotFound(_0x13cf0c,null))['then'](respondWithResult(_0x13cf0c,null))[_0xfda4('0x29')](handleError(_0x13cf0c,null));};exports[_0xfda4('0x36')]=function(_0x24ac10,_0x2dff21){return db[_0xfda4('0x1f')]['create'](_0x24ac10[_0xfda4('0x37')],{})[_0xfda4('0x16')](function(_0x286c21){var _0x3e1ea3=_0x24ac10[_0xfda4('0x38')][_0xfda4('0x17')]({'plain':!![]});if(!_0x3e1ea3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e1ea3[_0xfda4('0x39')]===_0xfda4('0x38')){var _0x3ceb5f=_0x286c21[_0xfda4('0x17')]({'plain':!![]});var _0x414f42='WhatsappQueues';return db[_0xfda4('0x3a')][_0xfda4('0x3b')]({'where':{'name':_0x414f42,'userProfileId':_0x3e1ea3[_0xfda4('0x3c')]},'raw':!![]})[_0xfda4('0x16')](function(_0x21d2cf){if(_0x21d2cf&&_0x21d2cf[_0xfda4('0x3d')]===0x0){return db[_0xfda4('0x3e')][_0xfda4('0x36')]({'name':_0x3ceb5f[_0xfda4('0x1c')],'resourceId':_0x3ceb5f['id'],'type':_0x21d2cf[_0xfda4('0x1c')],'sectionId':_0x21d2cf['id']},{})[_0xfda4('0x16')](function(){return _0x286c21;});}else{return _0x286c21;}})[_0xfda4('0x29')](function(_0x363485){logger[_0xfda4('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x363485);throw _0x363485;});}return _0x286c21;})[_0xfda4('0x16')](respondWithResult(_0x2dff21,0xc9))[_0xfda4('0x29')](handleError(_0x2dff21,null));};exports[_0xfda4('0x15')]=function(_0x3a60f1,_0x30f414){if(_0x3a60f1[_0xfda4('0x37')]['id']){delete _0x3a60f1[_0xfda4('0x37')]['id'];}return db[_0xfda4('0x1f')][_0xfda4('0x3b')]({'where':{'id':_0x3a60f1[_0xfda4('0x2b')]['id']}})['then'](handleEntityNotFound(_0x30f414,null))[_0xfda4('0x16')](saveUpdates(_0x3a60f1[_0xfda4('0x37')],null))['then'](respondWithResult(_0x30f414,null))[_0xfda4('0x29')](handleError(_0x30f414,null));};exports[_0xfda4('0x19')]=function(_0x3c509,_0x1a47fb){return db[_0xfda4('0x1f')][_0xfda4('0x3b')]({'where':{'id':_0x3c509[_0xfda4('0x2b')]['id']}})[_0xfda4('0x16')](handleEntityNotFound(_0x1a47fb,null))[_0xfda4('0x16')](removeEntity(_0x1a47fb,null))[_0xfda4('0x29')](handleError(_0x1a47fb,null));};exports[_0xfda4('0x3f')]=function(_0x6408f0,_0x18129c){return db[_0xfda4('0x1f')][_0xfda4('0x3f')]()[_0xfda4('0x16')](respondWithResult(_0x18129c,null))[_0xfda4('0x29')](handleError(_0x18129c,null));};exports[_0xfda4('0x40')]=function(_0x2d97de,_0x56c805){var _0xff96a9={'raw':!![],'where':{}},_0x199e1f={},_0xb3085d;return db[_0xfda4('0x1f')]['findOne']({'where':{'id':_0x2d97de[_0xfda4('0x2b')]['id']}})['then'](handleEntityNotFound(_0x56c805,null))['then'](function(_0x26f350){if(_0x26f350){_0xb3085d=_0x26f350['get']({'plain':!![]});_0x199e1f['model']=_[_0xfda4('0x2c')](db[_0xfda4('0x41')][_0xfda4('0x20')]);_0x199e1f[_0xfda4('0x27')]=_[_0xfda4('0x2c')](_0x2d97de[_0xfda4('0x27')]);_0x199e1f[_0xfda4('0x2d')]=_[_0xfda4('0x2f')](_0x199e1f[_0xfda4('0x2e')],_0x199e1f[_0xfda4('0x27')]);_0xff96a9[_0xfda4('0x31')]=_['intersection'](_0x199e1f[_0xfda4('0x2e')],qs[_0xfda4('0x30')](_0x2d97de[_0xfda4('0x27')][_0xfda4('0x30')]));_0xff96a9['attributes']=_0xff96a9[_0xfda4('0x31')]['length']?_0xff96a9[_0xfda4('0x31')]:_0x199e1f[_0xfda4('0x2e')];if(!_0x2d97de[_0xfda4('0x27')]['hasOwnProperty'](_0xfda4('0x42'))){_0xff96a9[_0xfda4('0x13')]=qs[_0xfda4('0x13')](_0x2d97de[_0xfda4('0x27')][_0xfda4('0x13')]);_0xff96a9[_0xfda4('0x11')]=qs[_0xfda4('0x11')](_0x2d97de[_0xfda4('0x27')][_0xfda4('0x11')]);}_0xff96a9[_0xfda4('0x43')]=qs[_0xfda4('0x44')](_0x2d97de[_0xfda4('0x27')]['sort']);_0xff96a9[_0xfda4('0x25')]=qs[_0xfda4('0x2d')](_[_0xfda4('0x45')](_0x2d97de[_0xfda4('0x27')],_0x199e1f['filters']));_0xff96a9[_0xfda4('0x25')][_0xfda4('0x46')]=_0x26f350['id'];if(_0x2d97de[_0xfda4('0x27')][_0xfda4('0x47')]){_0xff96a9[_0xfda4('0x25')]=_[_0xfda4('0x34')](_0xff96a9[_0xfda4('0x25')],{'$or':_[_0xfda4('0x1e')](_0xff96a9[_0xfda4('0x31')],function(_0x4b6b14){var _0x139700={};_0x139700[_0x4b6b14]={'$like':'%'+_0x2d97de[_0xfda4('0x27')][_0xfda4('0x47')]+'%'};return _0x139700;})});}_0xff96a9=_['merge']({},_0xff96a9,_0x2d97de['options']);return db['UserWhatsappQueue'][_0xfda4('0x28')](_0xff96a9);}})[_0xfda4('0x16')](function(_0x3a75aa){if(_0x3a75aa){return db[_0xfda4('0x48')][_0xfda4('0x49')]({'where':{'id':_[_0xfda4('0x1e')](_0x3a75aa,_0xfda4('0x4a')),'role':_0xfda4('0x4b')},'attributes':['id',_0xfda4('0x1c'),_0xfda4('0x4c'),_0xfda4('0x4d'),_0xfda4('0x4e')]});}})[_0xfda4('0x16')](function(_0x20d6e2){if(_0x20d6e2){return{'count':_0x20d6e2[_0xfda4('0x12')],'rows':_[_0xfda4('0x1e')](_0x20d6e2[_0xfda4('0x4f')],function(_0x2c3409){return{'membername':_0x2c3409[_0xfda4('0x1c')],'UserId':_0x2c3409['id'],'queue_name':_0xb3085d[_0xfda4('0x1c')],'WhatsappQueueId':_0xb3085d['id'],'interface':util[_0xfda4('0x50')](_0xfda4('0x51'),_0xfda4('0x52'),_0x2c3409['name']),'penalty':0x0,'paused':_0x2c3409[_0xfda4('0x4c')],'createdAt':_0x2c3409['createdAt'],'updatedAt':_0x2c3409['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xfda4('0x16')](respondWithFilteredResult(_0x56c805,_0xff96a9))[_0xfda4('0x29')](handleError(_0x56c805,null));};exports[_0xfda4('0x53')]=function(_0x21a96d,_0x46f283){var _0x2b88d9={};var _0x31255e={};var _0x34432e;var _0x2cc29e;return db[_0xfda4('0x1f')][_0xfda4('0x54')]({'where':{'id':_0x21a96d[_0xfda4('0x2b')]['id']}})[_0xfda4('0x16')](handleEntityNotFound(_0x46f283,null))[_0xfda4('0x16')](function(_0x50ab69){if(_0x50ab69){_0x34432e=_0x50ab69;_0x31255e['model']=_[_0xfda4('0x2c')](db[_0xfda4('0x55')][_0xfda4('0x20')]);_0x31255e['query']=_[_0xfda4('0x2c')](_0x21a96d[_0xfda4('0x27')]);_0x31255e[_0xfda4('0x2d')]=_[_0xfda4('0x2f')](_0x31255e[_0xfda4('0x2e')],_0x31255e[_0xfda4('0x27')]);_0x2b88d9['attributes']=_['intersection'](_0x31255e[_0xfda4('0x2e')],qs[_0xfda4('0x30')](_0x21a96d[_0xfda4('0x27')]['fields']));_0x2b88d9['attributes']=_0x2b88d9[_0xfda4('0x31')][_0xfda4('0x32')]?_0x2b88d9[_0xfda4('0x31')]:_0x31255e[_0xfda4('0x2e')];_0x2b88d9[_0xfda4('0x43')]=qs[_0xfda4('0x44')](_0x21a96d['query'][_0xfda4('0x44')]);_0x2b88d9[_0xfda4('0x25')]=qs[_0xfda4('0x2d')](_[_0xfda4('0x45')](_0x21a96d[_0xfda4('0x27')],_0x31255e[_0xfda4('0x2d')]));if(_0x21a96d['query'][_0xfda4('0x47')]){_0x2b88d9[_0xfda4('0x25')]=_[_0xfda4('0x34')](_0x2b88d9['where'],{'$or':_[_0xfda4('0x1e')](_0x2b88d9[_0xfda4('0x31')],function(_0x4dc02b){var _0x48c1cf={};_0x48c1cf[_0x4dc02b]={'$like':'%'+_0x21a96d['query'][_0xfda4('0x47')]+'%'};return _0x48c1cf;})});}_0x2b88d9=_['merge']({},_0x2b88d9,_0x21a96d['options']);return _0x34432e[_0xfda4('0x53')](_0x2b88d9);}})[_0xfda4('0x16')](function(_0x215d9a){if(_0x215d9a){_0x2cc29e=_0x215d9a[_0xfda4('0x32')];if(!_0x21a96d['query'][_0xfda4('0x56')](_0xfda4('0x42'))){_0x2b88d9[_0xfda4('0x13')]=qs[_0xfda4('0x13')](_0x21a96d['query'][_0xfda4('0x13')]);_0x2b88d9[_0xfda4('0x11')]=qs[_0xfda4('0x11')](_0x21a96d['query'][_0xfda4('0x11')]);}return _0x34432e[_0xfda4('0x53')](_0x2b88d9);}})[_0xfda4('0x16')](function(_0x1b3f47){if(_0x1b3f47){return _0x1b3f47?{'count':_0x2cc29e,'rows':_0x1b3f47}:null;}})[_0xfda4('0x16')](respondWithResult(_0x46f283,null))[_0xfda4('0x29')](handleError(_0x46f283,null));};exports[_0xfda4('0x57')]=function(_0x5d058e,_0x599865){var _0x2fcf5d=_0x5d058e[_0xfda4('0x37')][_0xfda4('0x58')];return db[_0xfda4('0x55')][_0xfda4('0x28')]({'where':{'id':_0x2fcf5d},'attributes':['id'],'include':[{'model':db[_0xfda4('0x48')],'as':_0xfda4('0x59'),'attributes':['id','name',_0xfda4('0x5a'),_0xfda4('0x5b'),_0xfda4('0x5c')],'raw':!![]}]})[_0xfda4('0x16')](function(_0x3287ec){if(_0x3287ec){var _0x5aa130=_[_0xfda4('0x5d')](_0x3287ec,function(_0x4a2342){var _0x3d36a2=_0x4a2342[_0xfda4('0x17')]({'plain':!![]});return _0x3d36a2[_0xfda4('0x59')];});return db[_0xfda4('0x1f')][_0xfda4('0x3b')]({'where':{'id':_0x5d058e[_0xfda4('0x2b')]['id']}})[_0xfda4('0x16')](function(_0x5d26d4){return db[_0xfda4('0x5e')][_0xfda4('0x5f')](function(_0x35d940){return _0x5d26d4[_0xfda4('0x57')](_0x2fcf5d,{'transaction':_0x35d940})[_0xfda4('0x16')](function(){return BPromise[_0xfda4('0x60')](_0x5aa130,function(_0x2f8e45){return db[_0xfda4('0x41')]['findOrCreate']({'where':{'UserId':_0x2f8e45['id'],'WhatsappQueueId':_0x5d058e['params']['id']},'transaction':_0x35d940});});})[_0xfda4('0x16')](function(){_0x5aa130['forEach'](function(_0x329f02){socket[_0xfda4('0x61')]('userWhatsappQueue:save',{'UserId':_0x329f02['id'],'WhatsappQueueId':_0x5d26d4['id']});});});});});}})[_0xfda4('0x16')](respondWithStatusCode(_0x599865,null))[_0xfda4('0x29')](handleError(_0x599865,null));};exports[_0xfda4('0x62')]=function(_0x3ba0fb,_0xec6a62){return db[_0xfda4('0x55')][_0xfda4('0x28')]({'where':{'id':_0x3ba0fb[_0xfda4('0x27')]['ids']},'attributes':['id'],'include':[{'model':db[_0xfda4('0x48')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfda4('0x16')](handleEntityNotFound(_0xec6a62,null))[_0xfda4('0x16')](function(_0x45cd31){var _0x1e45b1=_[_0xfda4('0x1e')](_0x45cd31,'id');var _0x1bef21=[];var _0x2a2177=[];var _0x46c0a0=squel[_0xfda4('0x63')]();_0x46c0a0[_0xfda4('0x64')](_0xfda4('0x65'))[_0xfda4('0x66')](_0xfda4('0x67'),'tq')[_0xfda4('0x68')]('user_has_teams','ut',_0xfda4('0x69'))['where'](_0xfda4('0x6a'),_0x3ba0fb[_0xfda4('0x2b')]['id']);for(var _0x3df5d3=0x0;_0x3df5d3<_0x45cd31[_0xfda4('0x32')];_0x3df5d3+=0x1){let _0x39927d=_0x45cd31[_0x3df5d3];for(var _0x538893=0x0;_0x538893<_0x39927d[_0xfda4('0x59')][_0xfda4('0x32')];_0x538893+=0x1){let _0x2dd95d=_0x39927d[_0xfda4('0x59')][_0x538893];var _0x5d9734=_0x46c0a0['clone']();_0x5d9734[_0xfda4('0x25')](_0xfda4('0x6b'),_0x2dd95d['id']);_0x2a2177[_0xfda4('0x6c')](db['sequelize'][_0xfda4('0x27')](_0x5d9734[_0xfda4('0x6d')](),{'type':db[_0xfda4('0x5e')][_0xfda4('0x6e')]['SELECT']})[_0xfda4('0x16')](function(_0x1ad5b9){if(_0x1ad5b9[_0xfda4('0x32')]===0x1){return _0x2dd95d['id'];}else{var _0xba30ef=_[_0xfda4('0x6f')](_[_0xfda4('0x1e')](_0x1ad5b9,_0xfda4('0x70')),function(_0x13b010){return _[_0xfda4('0x71')](_0x1e45b1,_0x13b010);});if(_0xba30ef){return _0x2dd95d['id'];}}}));}}return BPromise[_0xfda4('0x72')](_0x2a2177)['then'](function(_0x27b3e4){_0x1bef21=_(_0x1bef21)[_0xfda4('0x73')](_0x27b3e4)[_0xfda4('0x74')]()[_0xfda4('0x75')]();return db['WhatsappQueue'][_0xfda4('0x3b')]({'where':{'id':_0x3ba0fb[_0xfda4('0x2b')]['id']}})[_0xfda4('0x16')](function(_0x1e73bb){return db['sequelize'][_0xfda4('0x5f')](function(_0x4b17d3){return _0x1e73bb[_0xfda4('0x62')](_0x3ba0fb[_0xfda4('0x27')]['ids'],{'transaction':_0x4b17d3})[_0xfda4('0x16')](function(){if(!_[_0xfda4('0x76')](_0x1bef21)){return _0x1e73bb['removeAgents'](_0x1bef21,{'transaction':_0x4b17d3});}})[_0xfda4('0x16')](function(){_0x1bef21['forEach'](function(_0x51b48e){socket[_0xfda4('0x61')](_0xfda4('0x77'),{'UserId':_0x51b48e,'WhatsappQueueId':_0x1e73bb['id']});});});});});});})['then'](respondWithStatusCode(_0xec6a62,null))[_0xfda4('0x29')](handleError(_0xec6a62,null));};exports[_0xfda4('0x78')]=function(_0x2af042,_0x14c4d1){return db[_0xfda4('0x1f')]['find']({'where':{'id':_0x2af042[_0xfda4('0x2b')]['id']}})[_0xfda4('0x16')](handleEntityNotFound(_0x14c4d1,null))[_0xfda4('0x16')](function(_0xa8f727){if(_0xa8f727){return _0xa8f727[_0xfda4('0x78')](_0x2af042[_0xfda4('0x37')][_0xfda4('0x58')],_[_0xfda4('0x79')](_0x2af042['body'],[_0xfda4('0x58'),'id'])||{})[_0xfda4('0x7a')](function(_0x28ae55){for(var _0x4d8113=0x0;_0x4d8113<_0x2af042['body'][_0xfda4('0x58')][_0xfda4('0x32')];_0x4d8113+=0x1){socket[_0xfda4('0x61')](_0xfda4('0x7b'),{'UserId':Number(_0x2af042[_0xfda4('0x37')][_0xfda4('0x58')][_0x4d8113]),'WhatsappQueueId':Number(_0x2af042[_0xfda4('0x2b')]['id'])});}return _0x28ae55;});}})[_0xfda4('0x16')](respondWithResult(_0x14c4d1,null))['catch'](handleError(_0x14c4d1,null));};exports[_0xfda4('0x7c')]=function(_0x48d9bc,_0x65917b){return db[_0xfda4('0x1f')][_0xfda4('0x3b')]({'where':{'id':_0x48d9bc['params']['id']}})[_0xfda4('0x16')](handleEntityNotFound(_0x65917b,null))[_0xfda4('0x16')](function(_0x5d2132){if(_0x5d2132){return _0x5d2132[_0xfda4('0x7c')](_0x48d9bc[_0xfda4('0x27')][_0xfda4('0x58')])['then'](function(){if(_[_0xfda4('0x7d')](_0x48d9bc['query']['ids'])){for(var _0x5a2f34=0x0;_0x5a2f34<_0x48d9bc['query'][_0xfda4('0x58')][_0xfda4('0x32')];_0x5a2f34+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x48d9bc[_0xfda4('0x27')]['ids'][_0x5a2f34]),'WhatsappQueueId':Number(_0x48d9bc[_0xfda4('0x2b')]['id'])});}}else{socket[_0xfda4('0x61')](_0xfda4('0x77'),{'UserId':Number(_0x48d9bc[_0xfda4('0x27')]['ids']),'WhatsappQueueId':Number(_0x48d9bc[_0xfda4('0x2b')]['id'])});}});}})[_0xfda4('0x16')](respondWithStatusCode(_0x65917b,null))[_0xfda4('0x29')](handleError(_0x65917b,null));};exports[_0xfda4('0x7e')]=function(_0x5e7b36,_0x1505f1){var _0x5cb370={};var _0x90051d={};var _0x577231;var _0x589a5f;return db[_0xfda4('0x1f')][_0xfda4('0x54')]({'where':{'id':_0x5e7b36[_0xfda4('0x2b')]['id']}})[_0xfda4('0x16')](handleEntityNotFound(_0x1505f1,null))['then'](function(_0x19287e){if(_0x19287e){_0x577231=_0x19287e;_0x90051d[_0xfda4('0x2e')]=_['keys'](db[_0xfda4('0x48')][_0xfda4('0x20')]);_0x90051d[_0xfda4('0x27')]=_[_0xfda4('0x2c')](_0x5e7b36['query']);_0x90051d[_0xfda4('0x2d')]=_[_0xfda4('0x2f')](_0x90051d[_0xfda4('0x2e')],_0x90051d[_0xfda4('0x27')]);_0x5cb370['attributes']=_[_0xfda4('0x2f')](_0x90051d['model'],qs[_0xfda4('0x30')](_0x5e7b36[_0xfda4('0x27')]['fields']));_0x5cb370[_0xfda4('0x31')]=_0x5cb370['attributes'][_0xfda4('0x32')]?_0x5cb370[_0xfda4('0x31')]:_0x90051d[_0xfda4('0x2e')];_0x5cb370[_0xfda4('0x43')]=qs[_0xfda4('0x44')](_0x5e7b36[_0xfda4('0x27')][_0xfda4('0x44')]);_0x5cb370[_0xfda4('0x25')]=qs['filters'](_['pick'](_0x5e7b36[_0xfda4('0x27')],_0x90051d['filters']));if(_0x5e7b36[_0xfda4('0x27')][_0xfda4('0x47')]){_0x5cb370['where']=_[_0xfda4('0x34')](_0x5cb370[_0xfda4('0x25')],{'$or':_[_0xfda4('0x1e')](_0x5cb370[_0xfda4('0x31')],function(_0x5970eb){var _0x235298={};_0x235298[_0x5970eb]={'$like':'%'+_0x5e7b36[_0xfda4('0x27')]['filter']+'%'};return _0x235298;})});}_0x5cb370=_[_0xfda4('0x34')]({},_0x5cb370,_0x5e7b36[_0xfda4('0x35')]);return _0x577231['getAgents'](_0x5cb370);}})[_0xfda4('0x16')](function(_0x2e95fb){if(_0x2e95fb){_0x589a5f=_0x2e95fb['length'];if(!_0x5e7b36[_0xfda4('0x27')][_0xfda4('0x56')](_0xfda4('0x42'))){_0x5cb370['limit']=qs[_0xfda4('0x13')](_0x5e7b36[_0xfda4('0x27')]['limit']);_0x5cb370['offset']=qs[_0xfda4('0x11')](_0x5e7b36[_0xfda4('0x27')][_0xfda4('0x11')]);}return _0x577231[_0xfda4('0x7e')](_0x5cb370);}})[_0xfda4('0x16')](function(_0x170332){if(_0x170332){return _0x170332?{'count':_0x589a5f,'rows':_0x170332}:null;}})[_0xfda4('0x16')](respondWithResult(_0x1505f1,null))[_0xfda4('0x29')](handleError(_0x1505f1,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 70d870a..c7c97be 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 _0x86dd=['remove','emit','hook','events','../../mysqldb','WhatsappQueue','save'];(function(_0x1c7f09,_0x502fa9){var _0x3f622c=function(_0x2b9b5b){while(--_0x2b9b5b){_0x1c7f09['push'](_0x1c7f09['shift']());}};_0x3f622c(++_0x502fa9);}(_0x86dd,0x129));var _0xd86d=function(_0x47b45d,_0x4675fe){_0x47b45d=_0x47b45d-0x0;var _0x32979d=_0x86dd[_0x47b45d];return _0x32979d;};'use strict';var EventEmitter=require(_0xd86d('0x0'));var WhatsappQueue=require(_0xd86d('0x1'))['db'][_0xd86d('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd86d('0x3'),'afterUpdate':'update','afterDestroy':_0xd86d('0x4')};function emitEvent(_0x30a0f1){return function(_0x7a9a4,_0x3e6542,_0x35ea9a){WhatsappQueueEvents[_0xd86d('0x5')](_0x30a0f1+':'+_0x7a9a4['id'],_0x7a9a4);WhatsappQueueEvents[_0xd86d('0x5')](_0x30a0f1,_0x7a9a4);_0x35ea9a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xd86d('0x6')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x6dec=['events','../../mysqldb','WhatsappQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2b7055,_0x45df71){var _0x2c8fc4=function(_0x1fd01d){while(--_0x1fd01d){_0x2b7055['push'](_0x2b7055['shift']());}};_0x2c8fc4(++_0x45df71);}(_0x6dec,0x190));var _0xc6de=function(_0x2a4bf1,_0x52c5be){_0x2a4bf1=_0x2a4bf1-0x0;var _0x2f16c1=_0x6dec[_0x2a4bf1];return _0x2f16c1;};'use strict';var EventEmitter=require(_0xc6de('0x0'));var WhatsappQueue=require(_0xc6de('0x1'))['db'][_0xc6de('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xc6de('0x3')](0x0);var events={'afterCreate':_0xc6de('0x4'),'afterUpdate':'update','afterDestroy':_0xc6de('0x5')};function emitEvent(_0x14648e){return function(_0x1dc3de,_0x5b6551,_0x5d19f1){WhatsappQueueEvents[_0xc6de('0x6')](_0x14648e+':'+_0x1dc3de['id'],_0x1dc3de);WhatsappQueueEvents[_0xc6de('0x6')](_0x14648e,_0x1dc3de);_0x5d19f1(null);};}for(var e in events){if(events[_0xc6de('0x7')](e)){var event=events[e];WhatsappQueue[_0xc6de('0x8')](e,emitEvent(event));}}module[_0xc6de('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index ff64188..9b2d931 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 _0x7c9b=['exports','define','whatsapp_queues','lodash','api','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes'];(function(_0x2e6b82,_0x37b2aa){var _0x29e6c3=function(_0x36b991){while(--_0x36b991){_0x2e6b82['push'](_0x2e6b82['shift']());}};_0x29e6c3(++_0x37b2aa);}(_0x7c9b,0x14d));var _0xb7c9=function(_0x543670,_0x4d26b5){_0x543670=_0x543670-0x0;var _0x1e1c2d=_0x7c9b[_0x543670];return _0x1e1c2d;};'use strict';var _=require(_0xb7c9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb7c9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb7c9('0x2'));var fs=require('fs');var path=require(_0xb7c9('0x3'));var rimraf=require(_0xb7c9('0x4'));var config=require(_0xb7c9('0x5'));var attributes=require(_0xb7c9('0x6'));module[_0xb7c9('0x7')]=function(_0x29c4a4,_0x402947){return _0x29c4a4[_0xb7c9('0x8')]('WhatsappQueue',attributes,{'tableName':_0xb7c9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ff7=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash'];(function(_0x3e21f4,_0x43d310){var _0x40fc49=function(_0x54a8f6){while(--_0x54a8f6){_0x3e21f4['push'](_0x3e21f4['shift']());}};_0x40fc49(++_0x43d310);}(_0x8ff7,0x151));var _0x78ff=function(_0x59eef7,_0x55429a){_0x59eef7=_0x59eef7-0x0;var _0x4641f6=_0x8ff7[_0x59eef7];return _0x4641f6;};'use strict';var _=require(_0x78ff('0x0'));var util=require(_0x78ff('0x1'));var logger=require('../../config/logger')(_0x78ff('0x2'));var moment=require(_0x78ff('0x3'));var BPromise=require(_0x78ff('0x4'));var rp=require(_0x78ff('0x5'));var fs=require('fs');var path=require(_0x78ff('0x6'));var rimraf=require(_0x78ff('0x7'));var config=require(_0x78ff('0x8'));var attributes=require(_0x78ff('0x9'));module[_0x78ff('0xa')]=function(_0x1d8e91,_0x11d53a){return _0x1d8e91[_0x78ff('0xb')]('WhatsappQueue',attributes,{'tableName':_0x78ff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 925299a..c913e18 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 _0x6711=['lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','then','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','WhatsappQueue','findAll','options','where','attributes','include','map','model','GetWhatsappQueue','find','raw','ShowWhatsappQueue'];(function(_0x14a5f0,_0x4df871){var _0x53eb40=function(_0x5acde7){while(--_0x5acde7){_0x14a5f0['push'](_0x14a5f0['shift']());}};_0x53eb40(++_0x4df871);}(_0x6711,0x6f));var _0x1671=function(_0x2d2885,_0x667d70){_0x2d2885=_0x2d2885-0x0;var _0x2cea6=_0x6711[_0x2d2885];return _0x2cea6;};'use strict';var _=require(_0x1671('0x0'));var util=require(_0x1671('0x1'));var moment=require(_0x1671('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1671('0x3'));var db=require(_0x1671('0x4'))['db'];var utils=require(_0x1671('0x5'));var logger=require(_0x1671('0x6'))(_0x1671('0x7'));var config=require(_0x1671('0x8'));var jayson=require(_0x1671('0x9'));var client=jayson[_0x1671('0xa')][_0x1671('0xb')]({'port':0x232a});config[_0x1671('0xc')]=_['defaults'](config[_0x1671('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x1671('0xd'))(new Redis(config['redis']));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x10de57,_0x314c63,_0x14339c){return new BPromise(function(_0x22c74e,_0xff9e2d){return client['request'](_0x10de57,_0x14339c)[_0x1671('0xe')](function(_0x355697){logger['info'](_0x1671('0xf'),_0x314c63,'request\x20sent');logger[_0x1671('0x10')](_0x1671('0x11'),_0x314c63,_0x1671('0x12'),JSON[_0x1671('0x13')](_0x355697));if(_0x355697[_0x1671('0x14')]){if(_0x355697[_0x1671('0x14')]['code']===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x314c63,_0x355697[_0x1671('0x14')][_0x1671('0x15')]);return _0xff9e2d(_0x355697[_0x1671('0x14')][_0x1671('0x15')]);}logger['error'](_0x1671('0xf'),_0x314c63,_0x355697[_0x1671('0x14')]['message']);return _0x22c74e(_0x355697['error'][_0x1671('0x15')]);}else{logger[_0x1671('0x16')](_0x1671('0xf'),_0x314c63,_0x1671('0x12'));_0x22c74e(_0x355697[_0x1671('0x17')][_0x1671('0x15')]);}})[_0x1671('0x18')](function(_0x193b09){logger[_0x1671('0x14')](_0x1671('0xf'),_0x314c63,_0x193b09);_0xff9e2d(_0x193b09);});});}exports['GetWhatsappQueue']=function(_0x399a41){var _0x4ed8c9=this;return new Promise(function(_0x121e33,_0x2f9e9a){return db[_0x1671('0x19')][_0x1671('0x1a')]({'raw':_0x399a41[_0x1671('0x1b')]?_0x399a41['options']['raw']===undefined?!![]:![]:!![],'where':_0x399a41[_0x1671('0x1b')]?_0x399a41[_0x1671('0x1b')][_0x1671('0x1c')]||null:null,'attributes':_0x399a41[_0x1671('0x1b')]?_0x399a41[_0x1671('0x1b')][_0x1671('0x1d')]||null:null,'limit':_0x399a41[_0x1671('0x1b')]?_0x399a41[_0x1671('0x1b')]['limit']||null:null,'include':_0x399a41[_0x1671('0x1b')]?_0x399a41[_0x1671('0x1b')][_0x1671('0x1e')]?_[_0x1671('0x1f')](_0x399a41[_0x1671('0x1b')][_0x1671('0x1e')],function(_0x8a3e9a){return{'model':db[_0x8a3e9a['model']],'as':_0x8a3e9a['as'],'attributes':_0x8a3e9a[_0x1671('0x1d')],'include':_0x8a3e9a[_0x1671('0x1e')]?_[_0x1671('0x1f')](_0x8a3e9a[_0x1671('0x1e')],function(_0x2396c2){return{'model':db[_0x2396c2[_0x1671('0x20')]],'as':_0x2396c2['as'],'attributes':_0x2396c2['attributes'],'include':_0x2396c2['include']?_[_0x1671('0x1f')](_0x2396c2[_0x1671('0x1e')],function(_0x435279){return{'model':db[_0x435279[_0x1671('0x20')]],'as':_0x435279['as'],'attributes':_0x435279['attributes']};}):[]};}):[]};}):[]:[]})[_0x1671('0xe')](function(_0x24269c){logger[_0x1671('0x16')](_0x1671('0x21'),_0x399a41);logger[_0x1671('0x10')](_0x1671('0x21'),_0x399a41,JSON[_0x1671('0x13')](_0x24269c));_0x121e33(_0x24269c);})['catch'](function(_0x5209b9){logger['error'](_0x1671('0x21'),_0x5209b9['message'],_0x399a41);_0x2f9e9a(_0x4ed8c9[_0x1671('0x14')](0x1f4,_0x5209b9[_0x1671('0x15')]));});});};exports['ShowWhatsappQueue']=function(_0x491ea8){var _0x5a2877=this;return new Promise(function(_0x2d7418,_0x1aeb37){return db[_0x1671('0x19')][_0x1671('0x22')]({'raw':_0x491ea8[_0x1671('0x1b')]?_0x491ea8['options'][_0x1671('0x23')]===undefined?!![]:![]:!![],'where':_0x491ea8[_0x1671('0x1b')]?_0x491ea8['options'][_0x1671('0x1c')]||null:null,'attributes':_0x491ea8['options']?_0x491ea8[_0x1671('0x1b')][_0x1671('0x1d')]||null:null,'include':_0x491ea8[_0x1671('0x1b')]?_0x491ea8[_0x1671('0x1b')][_0x1671('0x1e')]?_[_0x1671('0x1f')](_0x491ea8[_0x1671('0x1b')][_0x1671('0x1e')],function(_0x5adf1b){return{'model':db[_0x5adf1b[_0x1671('0x20')]],'as':_0x5adf1b['as'],'attributes':_0x5adf1b['attributes'],'include':_0x5adf1b[_0x1671('0x1e')]?_[_0x1671('0x1f')](_0x5adf1b['include'],function(_0x3a4e27){return{'model':db[_0x3a4e27['model']],'as':_0x3a4e27['as'],'attributes':_0x3a4e27[_0x1671('0x1d')],'include':_0x3a4e27['include']?_[_0x1671('0x1f')](_0x3a4e27[_0x1671('0x1e')],function(_0x528ca2){return{'model':db[_0x528ca2[_0x1671('0x20')]],'as':_0x528ca2['as'],'attributes':_0x528ca2[_0x1671('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f4b6e){logger[_0x1671('0x16')]('ShowWhatsappQueue',_0x491ea8);logger[_0x1671('0x10')]('ShowWhatsappQueue',_0x491ea8,JSON[_0x1671('0x13')](_0x1f4b6e));_0x2d7418(_0x1f4b6e);})['catch'](function(_0x23d6cc){logger['error'](_0x1671('0x24'),_0x23d6cc['message'],_0x491ea8);_0x1aeb37(_0x5a2877[_0x1671('0x14')](0x1f4,_0x23d6cc[_0x1671('0x15')]));});});}; \ No newline at end of file +var _0x399a=['findAll','options','raw','limit','include','attributes','map','model','GetWhatsappQueue','ShowWhatsappQueue','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','WhatsappQueue'];(function(_0x35d9f5,_0x3f47d7){var _0x3db11f=function(_0x11e4d8){while(--_0x11e4d8){_0x35d9f5['push'](_0x35d9f5['shift']());}};_0x3db11f(++_0x3f47d7);}(_0x399a,0x1d2));var _0xa399=function(_0x435b2f,_0x4c44da){_0x435b2f=_0x435b2f-0x0;var _0x181648=_0x399a[_0x435b2f];return _0x181648;};'use strict';var _=require('lodash');var util=require(_0xa399('0x0'));var moment=require(_0xa399('0x1'));var BPromise=require('bluebird');var rs=require(_0xa399('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa399('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa399('0x4'))(_0xa399('0x5'));var config=require(_0xa399('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa399('0x7')][_0xa399('0x8')]({'port':0x232a});config[_0xa399('0x9')]=_[_0xa399('0xa')](config[_0xa399('0x9')],{'host':_0xa399('0xb'),'port':0x18eb});var socket=require(_0xa399('0xc'))(new Redis(config[_0xa399('0x9')]));require('./whatsappQueue.socket')[_0xa399('0xd')](socket);function respondWithRpcPromise(_0x478ddb,_0x56863c,_0x3f9c43){return new BPromise(function(_0x2c9da7,_0x23dc45){return client[_0xa399('0xe')](_0x478ddb,_0x3f9c43)[_0xa399('0xf')](function(_0x3af07a){logger['info'](_0xa399('0x10'),_0x56863c,_0xa399('0x11'));logger[_0xa399('0x12')](_0xa399('0x13'),_0x56863c,'request\x20sent',JSON[_0xa399('0x14')](_0x3af07a));if(_0x3af07a[_0xa399('0x15')]){if(_0x3af07a[_0xa399('0x15')][_0xa399('0x16')]===0x1f4){logger[_0xa399('0x15')](_0xa399('0x10'),_0x56863c,_0x3af07a['error']['message']);return _0x23dc45(_0x3af07a['error'][_0xa399('0x17')]);}logger[_0xa399('0x15')](_0xa399('0x10'),_0x56863c,_0x3af07a[_0xa399('0x15')][_0xa399('0x17')]);return _0x2c9da7(_0x3af07a['error']['message']);}else{logger[_0xa399('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x56863c,_0xa399('0x11'));_0x2c9da7(_0x3af07a[_0xa399('0x19')][_0xa399('0x17')]);}})[_0xa399('0x1a')](function(_0x5db163){logger['error'](_0xa399('0x10'),_0x56863c,_0x5db163);_0x23dc45(_0x5db163);});});}exports['GetWhatsappQueue']=function(_0xdcbf1a){var _0x2c82a8=this;return new Promise(function(_0x3d4976,_0x9148da){return db[_0xa399('0x1b')][_0xa399('0x1c')]({'raw':_0xdcbf1a[_0xa399('0x1d')]?_0xdcbf1a[_0xa399('0x1d')][_0xa399('0x1e')]===undefined?!![]:![]:!![],'where':_0xdcbf1a[_0xa399('0x1d')]?_0xdcbf1a[_0xa399('0x1d')]['where']||null:null,'attributes':_0xdcbf1a[_0xa399('0x1d')]?_0xdcbf1a[_0xa399('0x1d')]['attributes']||null:null,'limit':_0xdcbf1a[_0xa399('0x1d')]?_0xdcbf1a['options'][_0xa399('0x1f')]||null:null,'include':_0xdcbf1a['options']?_0xdcbf1a[_0xa399('0x1d')][_0xa399('0x20')]?_['map'](_0xdcbf1a['options'][_0xa399('0x20')],function(_0x155ec0){return{'model':db[_0x155ec0['model']],'as':_0x155ec0['as'],'attributes':_0x155ec0[_0xa399('0x21')],'include':_0x155ec0[_0xa399('0x20')]?_[_0xa399('0x22')](_0x155ec0[_0xa399('0x20')],function(_0x2dbf67){return{'model':db[_0x2dbf67['model']],'as':_0x2dbf67['as'],'attributes':_0x2dbf67[_0xa399('0x21')],'include':_0x2dbf67['include']?_[_0xa399('0x22')](_0x2dbf67[_0xa399('0x20')],function(_0x5730d5){return{'model':db[_0x5730d5[_0xa399('0x23')]],'as':_0x5730d5['as'],'attributes':_0x5730d5[_0xa399('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa399('0xf')](function(_0x48eb43){logger[_0xa399('0x18')](_0xa399('0x24'),_0xdcbf1a);logger['debug'](_0xa399('0x24'),_0xdcbf1a,JSON[_0xa399('0x14')](_0x48eb43));_0x3d4976(_0x48eb43);})['catch'](function(_0x26fa42){logger['error'](_0xa399('0x24'),_0x26fa42[_0xa399('0x17')],_0xdcbf1a);_0x9148da(_0x2c82a8[_0xa399('0x15')](0x1f4,_0x26fa42[_0xa399('0x17')]));});});};exports[_0xa399('0x25')]=function(_0x377260){var _0x3a30ec=this;return new Promise(function(_0x3585eb,_0x4abc00){return db['WhatsappQueue']['find']({'raw':_0x377260['options']?_0x377260[_0xa399('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x377260[_0xa399('0x1d')]?_0x377260[_0xa399('0x1d')]['where']||null:null,'attributes':_0x377260[_0xa399('0x1d')]?_0x377260[_0xa399('0x1d')][_0xa399('0x21')]||null:null,'include':_0x377260[_0xa399('0x1d')]?_0x377260[_0xa399('0x1d')][_0xa399('0x20')]?_[_0xa399('0x22')](_0x377260[_0xa399('0x1d')][_0xa399('0x20')],function(_0x4d3dc0){return{'model':db[_0x4d3dc0[_0xa399('0x23')]],'as':_0x4d3dc0['as'],'attributes':_0x4d3dc0['attributes'],'include':_0x4d3dc0['include']?_['map'](_0x4d3dc0[_0xa399('0x20')],function(_0x150ee8){return{'model':db[_0x150ee8[_0xa399('0x23')]],'as':_0x150ee8['as'],'attributes':_0x150ee8[_0xa399('0x21')],'include':_0x150ee8['include']?_[_0xa399('0x22')](_0x150ee8[_0xa399('0x20')],function(_0x472ef2){return{'model':db[_0x472ef2['model']],'as':_0x472ef2['as'],'attributes':_0x472ef2[_0xa399('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa399('0xf')](function(_0x266738){logger[_0xa399('0x18')]('ShowWhatsappQueue',_0x377260);logger[_0xa399('0x12')](_0xa399('0x25'),_0x377260,JSON['stringify'](_0x266738));_0x3585eb(_0x266738);})[_0xa399('0x1a')](function(_0x548518){logger[_0xa399('0x15')]('ShowWhatsappQueue',_0x548518[_0xa399('0x17')],_0x377260);_0x4abc00(_0x3a30ec[_0xa399('0x15')](0x1f4,_0x548518['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 18db3fc..9127317 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 _0x8ea3=['whatsappQueue:','./whatsappQueue.events','emit','removeListener','register'];(function(_0x43aed9,_0x3dac8f){var _0x3048c5=function(_0x4d93a4){while(--_0x4d93a4){_0x43aed9['push'](_0x43aed9['shift']());}};_0x3048c5(++_0x3dac8f);}(_0x8ea3,0x97));var _0x38ea=function(_0x474c0a,_0x3c741f){_0x474c0a=_0x474c0a-0x0;var _0x4005b7=_0x8ea3[_0x474c0a];return _0x4005b7;};'use strict';var WhatsappQueueEvents=require(_0x38ea('0x0'));var events=['save','remove','update'];function createListener(_0x406c2f,_0x1a3dce){return function(_0xe2c45c){_0x1a3dce[_0x38ea('0x1')](_0x406c2f,_0xe2c45c);};}function removeListener(_0x5033bd,_0x282f4b){return function(){WhatsappQueueEvents[_0x38ea('0x2')](_0x5033bd,_0x282f4b);};}exports[_0x38ea('0x3')]=function(_0x517096){for(var _0x1cbd34=0x0,_0x64b78c=events['length'];_0x1cbd34<_0x64b78c;_0x1cbd34++){var _0x5bbf9c=events[_0x1cbd34];var _0x6ba72f=createListener(_0x38ea('0x4')+_0x5bbf9c,_0x517096);WhatsappQueueEvents['on'](_0x5bbf9c,_0x6ba72f);}}; \ No newline at end of file +var _0x72cf=['emit','removeListener','register','whatsappQueue:','./whatsappQueue.events','save','update'];(function(_0x3612c5,_0x23593e){var _0x2e6706=function(_0x33dead){while(--_0x33dead){_0x3612c5['push'](_0x3612c5['shift']());}};_0x2e6706(++_0x23593e);}(_0x72cf,0x162));var _0xf72c=function(_0x12e318,_0x191068){_0x12e318=_0x12e318-0x0;var _0x433c40=_0x72cf[_0x12e318];return _0x433c40;};'use strict';var WhatsappQueueEvents=require(_0xf72c('0x0'));var events=[_0xf72c('0x1'),'remove',_0xf72c('0x2')];function createListener(_0x229370,_0x40aed7){return function(_0x5d7aca){_0x40aed7[_0xf72c('0x3')](_0x229370,_0x5d7aca);};}function removeListener(_0x4423ba,_0x2cb549){return function(){WhatsappQueueEvents[_0xf72c('0x4')](_0x4423ba,_0x2cb549);};}exports[_0xf72c('0x5')]=function(_0x1dbf6f){for(var _0x52a151=0x0,_0x48c628=events['length'];_0x52a151<_0x48c628;_0x52a151++){var _0x5914fa=events[_0x52a151];var _0x279643=createListener(_0xf72c('0x6')+_0x5914fa,_0x1dbf6f);WhatsappQueueEvents['on'](_0x5914fa,_0x279643);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index e18b556..7999efa 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 _0x0915=['put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id','show','create'];(function(_0x23f1b4,_0xadb6d7){var _0x2c2d98=function(_0x242e35){while(--_0x242e35){_0x23f1b4['push'](_0x23f1b4['shift']());}};_0x2c2d98(++_0xadb6d7);}(_0x0915,0x158));var _0x5091=function(_0x3b632f,_0x453380){_0x3b632f=_0x3b632f-0x0;var _0x10e788=_0x0915[_0x3b632f];return _0x10e788;};'use strict';var multer=require(_0x5091('0x0'));var util=require(_0x5091('0x1'));var path=require(_0x5091('0x2'));var timeout=require(_0x5091('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5091('0x4'));var auth=require(_0x5091('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5091('0x6'));var controller=require('./whatsappQueueReport.controller');router[_0x5091('0x7')]('/',auth[_0x5091('0x8')](),controller['index']);router[_0x5091('0x7')]('/describe',auth[_0x5091('0x8')](),controller[_0x5091('0x9')]);router[_0x5091('0x7')](_0x5091('0xa'),auth[_0x5091('0x8')](),controller[_0x5091('0xb')]);router['post']('/',auth[_0x5091('0x8')](),controller[_0x5091('0xc')]);router[_0x5091('0xd')](_0x5091('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x5091('0xe')](_0x5091('0xa'),auth['isAuthenticated'](),controller[_0x5091('0xf')]);module[_0x5091('0x10')]=router; \ No newline at end of file +var _0xb82c=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show','put','update','exports','multer','connect-timeout','express'];(function(_0x4a42ce,_0x451cde){var _0x3f8968=function(_0x76a4c3){while(--_0x76a4c3){_0x4a42ce['push'](_0x4a42ce['shift']());}};_0x3f8968(++_0x451cde);}(_0xb82c,0x153));var _0xcb82=function(_0x577968,_0x3079a5){_0x577968=_0x577968-0x0;var _0x1d8128=_0xb82c[_0x577968];return _0x1d8128;};'use strict';var multer=require(_0xcb82('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcb82('0x1'));var express=require(_0xcb82('0x2'));var router=express[_0xcb82('0x3')]();var fs_extra=require(_0xcb82('0x4'));var auth=require(_0xcb82('0x5'));var interaction=require(_0xcb82('0x6'));var config=require(_0xcb82('0x7'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xcb82('0x8')]);router[_0xcb82('0x9')](_0xcb82('0xa'),auth[_0xcb82('0xb')](),controller[_0xcb82('0xc')]);router[_0xcb82('0x9')](_0xcb82('0xd'),auth['isAuthenticated'](),controller[_0xcb82('0xe')]);router['post']('/',auth[_0xcb82('0xb')](),controller['create']);router[_0xcb82('0xf')](_0xcb82('0xd'),auth[_0xcb82('0xb')](),controller[_0xcb82('0x10')]);router['delete'](_0xcb82('0xd'),auth[_0xcb82('0xb')](),controller['destroy']);module[_0xcb82('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index ab3b1b1..246a858 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(_0x4dccc8,_0x1371aa){var _0x163f75=function(_0x24f482){while(--_0x24f482){_0x4dccc8['push'](_0x4dccc8['shift']());}};_0x163f75(++_0x1371aa);}(_0x7a54,0x106));var _0x47a5=function(_0x290aca,_0x75ce88){_0x290aca=_0x290aca-0x0;var _0xc901=_0x7a54[_0x290aca];return _0xc901;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x55e1c8,_0x35499f){var _0x3613d3=function(_0x582a98){while(--_0x582a98){_0x55e1c8['push'](_0x55e1c8['shift']());}};_0x3613d3(++_0x35499f);}(_0x7a54,0x106));var _0x47a5=function(_0x4bdb67,_0x1ee0eb){_0x4bdb67=_0x4bdb67-0x0;var _0x517ec1=_0x7a54[_0x4bdb67];return _0x517ec1;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index c7286b3..89d756a 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 _0x02ce=['then','destroy','error','name','index','map','WhatsappQueueReport','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','findAll','rows','catch','show','keys','includeAll','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','Content-Range','apply','reject','save','update'];(function(_0x5184bd,_0x164321){var _0x231940=function(_0xe7b7a7){while(--_0xe7b7a7){_0x5184bd['push'](_0x5184bd['shift']());}};_0x231940(++_0x164321);}(_0x02ce,0x1ac));var _0xe02c=function(_0x23b1bf,_0x16c935){_0x23b1bf=_0x23b1bf-0x0;var _0x50cf7d=_0x02ce[_0x23b1bf];return _0x50cf7d;};'use strict';var emlformat=require(_0xe02c('0x0'));var rimraf=require(_0xe02c('0x1'));var zipdir=require(_0xe02c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe02c('0x3'));var moment=require('moment');var BPromise=require(_0xe02c('0x4'));var Mustache=require(_0xe02c('0x5'));var util=require(_0xe02c('0x6'));var path=require(_0xe02c('0x7'));var sox=require(_0xe02c('0x8'));var csv=require(_0xe02c('0x9'));var ejs=require(_0xe02c('0xa'));var fs=require('fs');var fs_extra=require(_0xe02c('0xb'));var _=require(_0xe02c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe02c('0xd'));var deskjs=require(_0xe02c('0xe'));var toCsv=require(_0xe02c('0x9'));var querystring=require(_0xe02c('0xf'));var Papa=require(_0xe02c('0x10'));var Redis=require(_0xe02c('0x11'));var authService=require(_0xe02c('0x12'));var qs=require(_0xe02c('0x13'));var as=require(_0xe02c('0x14'));var hardwareService=require(_0xe02c('0x15'));var logger=require(_0xe02c('0x16'))(_0xe02c('0x17'));var utils=require(_0xe02c('0x18'));var config=require(_0xe02c('0x19'));var licenseUtil=require(_0xe02c('0x1a'));var db=require(_0xe02c('0x1b'))['db'];function respondWithStatusCode(_0x23d886,_0x32fc45){_0x32fc45=_0x32fc45||0xcc;return function(_0x5d6d13){if(_0x5d6d13){return _0x23d886[_0xe02c('0x1c')](_0x32fc45);}return _0x23d886['status'](_0x32fc45)['end']();};}function respondWithResult(_0x3f4e28,_0x56405a){_0x56405a=_0x56405a||0xc8;return function(_0x221910){if(_0x221910){return _0x3f4e28['status'](_0x56405a)[_0xe02c('0x1d')](_0x221910);}};}function respondWithFilteredResult(_0x4e9c6d,_0x256311){return function(_0x366893){if(_0x366893){var _0x59f2f6=typeof _0x256311[_0xe02c('0x1e')]===_0xe02c('0x1f')&&typeof _0x256311['limit']===_0xe02c('0x1f');var _0x20f492=_0x366893['count'];var _0x52917f=_0x59f2f6?0x0:_0x256311[_0xe02c('0x1e')];var _0x49604a=_0x59f2f6?_0x366893[_0xe02c('0x20')]:_0x256311[_0xe02c('0x1e')]+_0x256311[_0xe02c('0x21')];var _0x36fed0;if(_0x49604a>=_0x20f492){_0x49604a=_0x20f492;_0x36fed0=0xc8;}else{_0x36fed0=0xce;}_0x4e9c6d[_0xe02c('0x22')](_0x36fed0);return _0x4e9c6d['set'](_0xe02c('0x23'),_0x52917f+'-'+_0x49604a+'/'+_0x20f492)['json'](_0x366893);}return null;};}function patchUpdates(_0x4ea9b5){return function(_0x393621){try{jsonpatch[_0xe02c('0x24')](_0x393621,_0x4ea9b5,!![]);}catch(_0x480b9a){return BPromise[_0xe02c('0x25')](_0x480b9a);}return _0x393621[_0xe02c('0x26')]();};}function saveUpdates(_0x4ce5ee,_0x38dce2){return function(_0x45fd82){if(_0x45fd82){return _0x45fd82[_0xe02c('0x27')](_0x4ce5ee)[_0xe02c('0x28')](function(_0x2d44c8){return _0x2d44c8;});}return null;};}function removeEntity(_0x557142,_0x3e80e3){return function(_0xf41d4c){if(_0xf41d4c){return _0xf41d4c[_0xe02c('0x29')]()[_0xe02c('0x28')](function(){_0x557142[_0xe02c('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0xefd882,_0x4411d8){return function(_0x3592ca){if(!_0x3592ca){_0xefd882[_0xe02c('0x1c')](0x194);}return _0x3592ca;};}function handleError(_0x16dfa3,_0x303d24){_0x303d24=_0x303d24||0x1f4;return function(_0x43dc78){logger[_0xe02c('0x2a')](_0x43dc78['stack']);if(_0x43dc78[_0xe02c('0x2b')]){delete _0x43dc78[_0xe02c('0x2b')];}_0x16dfa3[_0xe02c('0x22')](_0x303d24)['send'](_0x43dc78);};}exports[_0xe02c('0x2c')]=function(_0x2d1d98,_0x445421){var _0x287f7e={},_0x1e7eab={},_0x35a309={'count':0x0,'rows':[]};var _0x22a285=_[_0xe02c('0x2d')](db[_0xe02c('0x2e')][_0xe02c('0x2f')],function(_0x17d5b3){return{'name':_0x17d5b3['fieldName'],'type':_0x17d5b3[_0xe02c('0x30')][_0xe02c('0x31')]};});_0x1e7eab[_0xe02c('0x32')]=_[_0xe02c('0x2d')](_0x22a285,_0xe02c('0x2b'));_0x1e7eab[_0xe02c('0x33')]=_['keys'](_0x2d1d98[_0xe02c('0x33')]);_0x1e7eab[_0xe02c('0x34')]=_['intersection'](_0x1e7eab[_0xe02c('0x32')],_0x1e7eab[_0xe02c('0x33')]);_0x287f7e[_0xe02c('0x35')]=_[_0xe02c('0x36')](_0x1e7eab[_0xe02c('0x32')],qs['fields'](_0x2d1d98['query'][_0xe02c('0x37')]));_0x287f7e[_0xe02c('0x35')]=_0x287f7e['attributes'][_0xe02c('0x38')]?_0x287f7e['attributes']:_0x1e7eab[_0xe02c('0x32')];if(!_0x2d1d98[_0xe02c('0x33')][_0xe02c('0x39')](_0xe02c('0x3a'))){_0x287f7e[_0xe02c('0x21')]=qs['limit'](_0x2d1d98[_0xe02c('0x33')]['limit']);_0x287f7e[_0xe02c('0x1e')]=qs[_0xe02c('0x1e')](_0x2d1d98[_0xe02c('0x33')][_0xe02c('0x1e')]);}_0x287f7e[_0xe02c('0x3b')]=qs[_0xe02c('0x3c')](_0x2d1d98['query'][_0xe02c('0x3c')]);_0x287f7e[_0xe02c('0x3d')]=qs['filters'](_[_0xe02c('0x3e')](_0x2d1d98[_0xe02c('0x33')],_0x1e7eab['filters']),_0x22a285);if(_0x2d1d98[_0xe02c('0x33')]['filter']){_0x287f7e[_0xe02c('0x3d')]=_[_0xe02c('0x3f')](_0x287f7e['where'],{'$or':_[_0xe02c('0x2d')](_0x22a285,function(_0x1eeddb){if(_0x1eeddb[_0xe02c('0x30')]!==_0xe02c('0x40')){var _0x3c4a65={};_0x3c4a65[_0x1eeddb[_0xe02c('0x2b')]]={'$like':'%'+_0x2d1d98['query'][_0xe02c('0x41')]+'%'};return _0x3c4a65;}})});}_0x287f7e=_['merge']({},_0x287f7e,_0x2d1d98['options']);var _0x3db057={'where':_0x287f7e[_0xe02c('0x3d')]};return db[_0xe02c('0x2e')][_0xe02c('0x20')](_0x3db057)['then'](function(_0x37e4fe){_0x35a309[_0xe02c('0x20')]=_0x37e4fe;if(_0x2d1d98[_0xe02c('0x33')]['includeAll']){_0x287f7e['include']=[{'all':!![]}];}return db[_0xe02c('0x2e')][_0xe02c('0x42')](_0x287f7e);})[_0xe02c('0x28')](function(_0x2313d2){_0x35a309[_0xe02c('0x43')]=_0x2313d2;return _0x35a309;})[_0xe02c('0x28')](respondWithFilteredResult(_0x445421,_0x287f7e))[_0xe02c('0x44')](handleError(_0x445421,null));};exports[_0xe02c('0x45')]=function(_0x21d66e,_0x53d123){var _0xc7e935={'raw':!![],'where':{'id':_0x21d66e['params']['id']}},_0x5ef4a1={};_0x5ef4a1[_0xe02c('0x32')]=_[_0xe02c('0x46')](db[_0xe02c('0x2e')][_0xe02c('0x2f')]);_0x5ef4a1[_0xe02c('0x33')]=_[_0xe02c('0x46')](_0x21d66e[_0xe02c('0x33')]);_0x5ef4a1[_0xe02c('0x34')]=_['intersection'](_0x5ef4a1['model'],_0x5ef4a1[_0xe02c('0x33')]);_0xc7e935[_0xe02c('0x35')]=_[_0xe02c('0x36')](_0x5ef4a1['model'],qs[_0xe02c('0x37')](_0x21d66e[_0xe02c('0x33')][_0xe02c('0x37')]));_0xc7e935[_0xe02c('0x35')]=_0xc7e935[_0xe02c('0x35')][_0xe02c('0x38')]?_0xc7e935[_0xe02c('0x35')]:_0x5ef4a1[_0xe02c('0x32')];if(_0x21d66e[_0xe02c('0x33')][_0xe02c('0x47')]){_0xc7e935['include']=[{'all':!![]}];}_0xc7e935=_[_0xe02c('0x3f')]({},_0xc7e935,_0x21d66e[_0xe02c('0x48')]);return db[_0xe02c('0x2e')][_0xe02c('0x49')](_0xc7e935)[_0xe02c('0x28')](handleEntityNotFound(_0x53d123,null))[_0xe02c('0x28')](respondWithResult(_0x53d123,null))[_0xe02c('0x44')](handleError(_0x53d123,null));};exports[_0xe02c('0x4a')]=function(_0x30dc90,_0x1176c9){return db[_0xe02c('0x2e')][_0xe02c('0x4a')](_0x30dc90[_0xe02c('0x4b')],{})['then'](respondWithResult(_0x1176c9,0xc9))[_0xe02c('0x44')](handleError(_0x1176c9,null));};exports['update']=function(_0x15b05c,_0x324911){if(_0x15b05c[_0xe02c('0x4b')]['id']){delete _0x15b05c[_0xe02c('0x4b')]['id'];}return db[_0xe02c('0x2e')][_0xe02c('0x49')]({'where':{'id':_0x15b05c[_0xe02c('0x4c')]['id']}})[_0xe02c('0x28')](handleEntityNotFound(_0x324911,null))[_0xe02c('0x28')](saveUpdates(_0x15b05c[_0xe02c('0x4b')],null))['then'](respondWithResult(_0x324911,null))[_0xe02c('0x44')](handleError(_0x324911,null));};exports[_0xe02c('0x29')]=function(_0xeb4214,_0x536cf7){return db[_0xe02c('0x2e')]['find']({'where':{'id':_0xeb4214[_0xe02c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x536cf7,null))['then'](removeEntity(_0x536cf7,null))['catch'](handleError(_0x536cf7,null));};exports['describe']=function(_0x51d540,_0x5740df){return db[_0xe02c('0x2e')][_0xe02c('0x4d')]()[_0xe02c('0x28')](respondWithResult(_0x5740df,null))[_0xe02c('0x44')](handleError(_0x5740df,null));}; \ No newline at end of file +var _0xe820=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','status','set','Content-Range','json','reject','save','update','then','destroy','error','name','index','WhatsappQueueReport','rawAttributes','key','map','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','describe','eml-format','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x2825c0,_0x442135){var _0xd518a9=function(_0x334c75){while(--_0x334c75){_0x2825c0['push'](_0x2825c0['shift']());}};_0xd518a9(++_0x442135);}(_0xe820,0xd2));var _0x0e82=function(_0x5f0ab4,_0x42945f){_0x5f0ab4=_0x5f0ab4-0x0;var _0x1915af=_0xe820[_0x5f0ab4];return _0x1915af;};'use strict';var emlformat=require(_0x0e82('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0e82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0e82('0x2'));var BPromise=require(_0x0e82('0x3'));var Mustache=require(_0x0e82('0x4'));var util=require('util');var path=require(_0x0e82('0x5'));var sox=require('sox');var csv=require(_0x0e82('0x6'));var ejs=require(_0x0e82('0x7'));var fs=require('fs');var fs_extra=require(_0x0e82('0x8'));var _=require(_0x0e82('0x9'));var squel=require(_0x0e82('0xa'));var crypto=require('crypto');var jsforce=require(_0x0e82('0xb'));var deskjs=require(_0x0e82('0xc'));var toCsv=require(_0x0e82('0x6'));var querystring=require(_0x0e82('0xd'));var Papa=require(_0x0e82('0xe'));var Redis=require('ioredis');var authService=require(_0x0e82('0xf'));var qs=require(_0x0e82('0x10'));var as=require(_0x0e82('0x11'));var hardwareService=require(_0x0e82('0x12'));var logger=require(_0x0e82('0x13'))(_0x0e82('0x14'));var utils=require(_0x0e82('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0e82('0x16'));var db=require(_0x0e82('0x17'))['db'];function respondWithStatusCode(_0x21c40b,_0x1da28a){_0x1da28a=_0x1da28a||0xcc;return function(_0x166dc2){if(_0x166dc2){return _0x21c40b[_0x0e82('0x18')](_0x1da28a);}return _0x21c40b['status'](_0x1da28a)[_0x0e82('0x19')]();};}function respondWithResult(_0x5c161c,_0x48d99b){_0x48d99b=_0x48d99b||0xc8;return function(_0x1e4ddb){if(_0x1e4ddb){return _0x5c161c['status'](_0x48d99b)['json'](_0x1e4ddb);}};}function respondWithFilteredResult(_0x5a2d28,_0x3298c7){return function(_0x4d1aa0){if(_0x4d1aa0){var _0x585b9b=typeof _0x3298c7[_0x0e82('0x1a')]==='undefined'&&typeof _0x3298c7[_0x0e82('0x1b')]===_0x0e82('0x1c');var _0x233c6d=_0x4d1aa0[_0x0e82('0x1d')];var _0x53622b=_0x585b9b?0x0:_0x3298c7[_0x0e82('0x1a')];var _0x310aac=_0x585b9b?_0x4d1aa0[_0x0e82('0x1d')]:_0x3298c7[_0x0e82('0x1a')]+_0x3298c7[_0x0e82('0x1b')];var _0x1230e6;if(_0x310aac>=_0x233c6d){_0x310aac=_0x233c6d;_0x1230e6=0xc8;}else{_0x1230e6=0xce;}_0x5a2d28[_0x0e82('0x1e')](_0x1230e6);return _0x5a2d28[_0x0e82('0x1f')](_0x0e82('0x20'),_0x53622b+'-'+_0x310aac+'/'+_0x233c6d)[_0x0e82('0x21')](_0x4d1aa0);}return null;};}function patchUpdates(_0x5903c){return function(_0x493280){try{jsonpatch['apply'](_0x493280,_0x5903c,!![]);}catch(_0x294696){return BPromise[_0x0e82('0x22')](_0x294696);}return _0x493280[_0x0e82('0x23')]();};}function saveUpdates(_0xb0a31,_0xd48046){return function(_0x1bdad4){if(_0x1bdad4){return _0x1bdad4[_0x0e82('0x24')](_0xb0a31)[_0x0e82('0x25')](function(_0x56b3ad){return _0x56b3ad;});}return null;};}function removeEntity(_0x1b71b4,_0x13f023){return function(_0x3d6c28){if(_0x3d6c28){return _0x3d6c28[_0x0e82('0x26')]()['then'](function(){_0x1b71b4[_0x0e82('0x1e')](0xcc)[_0x0e82('0x19')]();});}};}function handleEntityNotFound(_0x7a9399,_0x16e11c){return function(_0x4900d3){if(!_0x4900d3){_0x7a9399[_0x0e82('0x18')](0x194);}return _0x4900d3;};}function handleError(_0x51dbcd,_0x595319){_0x595319=_0x595319||0x1f4;return function(_0x384f88){logger[_0x0e82('0x27')](_0x384f88['stack']);if(_0x384f88[_0x0e82('0x28')]){delete _0x384f88[_0x0e82('0x28')];}_0x51dbcd[_0x0e82('0x1e')](_0x595319)['send'](_0x384f88);};}exports[_0x0e82('0x29')]=function(_0x25fa4e,_0x4ee65a){var _0xabc536={},_0x59a5b6={},_0x4300f9={'count':0x0,'rows':[]};var _0x3ec302=_['map'](db[_0x0e82('0x2a')][_0x0e82('0x2b')],function(_0x661718){return{'name':_0x661718['fieldName'],'type':_0x661718['type'][_0x0e82('0x2c')]};});_0x59a5b6['model']=_[_0x0e82('0x2d')](_0x3ec302,'name');_0x59a5b6[_0x0e82('0x2e')]=_[_0x0e82('0x2f')](_0x25fa4e[_0x0e82('0x2e')]);_0x59a5b6['filters']=_[_0x0e82('0x30')](_0x59a5b6['model'],_0x59a5b6[_0x0e82('0x2e')]);_0xabc536[_0x0e82('0x31')]=_[_0x0e82('0x30')](_0x59a5b6[_0x0e82('0x32')],qs[_0x0e82('0x33')](_0x25fa4e[_0x0e82('0x2e')]['fields']));_0xabc536[_0x0e82('0x31')]=_0xabc536[_0x0e82('0x31')][_0x0e82('0x34')]?_0xabc536[_0x0e82('0x31')]:_0x59a5b6[_0x0e82('0x32')];if(!_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x35')](_0x0e82('0x36'))){_0xabc536[_0x0e82('0x1b')]=qs[_0x0e82('0x1b')](_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x1b')]);_0xabc536[_0x0e82('0x1a')]=qs[_0x0e82('0x1a')](_0x25fa4e[_0x0e82('0x2e')]['offset']);}_0xabc536[_0x0e82('0x37')]=qs[_0x0e82('0x38')](_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x38')]);_0xabc536['where']=qs[_0x0e82('0x39')](_[_0x0e82('0x3a')](_0x25fa4e['query'],_0x59a5b6[_0x0e82('0x39')]),_0x3ec302);if(_0x25fa4e['query']['filter']){_0xabc536[_0x0e82('0x3b')]=_[_0x0e82('0x3c')](_0xabc536[_0x0e82('0x3b')],{'$or':_[_0x0e82('0x2d')](_0x3ec302,function(_0x61a5ce){if(_0x61a5ce[_0x0e82('0x3d')]!==_0x0e82('0x3e')){var _0x50fed8={};_0x50fed8[_0x61a5ce['name']]={'$like':'%'+_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x3f')]+'%'};return _0x50fed8;}})});}_0xabc536=_[_0x0e82('0x3c')]({},_0xabc536,_0x25fa4e[_0x0e82('0x40')]);var _0x265872={'where':_0xabc536[_0x0e82('0x3b')]};return db[_0x0e82('0x2a')][_0x0e82('0x1d')](_0x265872)['then'](function(_0x3ba181){_0x4300f9[_0x0e82('0x1d')]=_0x3ba181;if(_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x41')]){_0xabc536[_0x0e82('0x42')]=[{'all':!![]}];}return db[_0x0e82('0x2a')][_0x0e82('0x43')](_0xabc536);})['then'](function(_0x311cb8){_0x4300f9[_0x0e82('0x44')]=_0x311cb8;return _0x4300f9;})[_0x0e82('0x25')](respondWithFilteredResult(_0x4ee65a,_0xabc536))[_0x0e82('0x45')](handleError(_0x4ee65a,null));};exports[_0x0e82('0x46')]=function(_0x423b14,_0x453cd3){var _0x50322b={'raw':!![],'where':{'id':_0x423b14['params']['id']}},_0x581764={};_0x581764['model']=_['keys'](db['WhatsappQueueReport'][_0x0e82('0x2b')]);_0x581764[_0x0e82('0x2e')]=_[_0x0e82('0x2f')](_0x423b14[_0x0e82('0x2e')]);_0x581764[_0x0e82('0x39')]=_[_0x0e82('0x30')](_0x581764[_0x0e82('0x32')],_0x581764[_0x0e82('0x2e')]);_0x50322b['attributes']=_['intersection'](_0x581764[_0x0e82('0x32')],qs[_0x0e82('0x33')](_0x423b14[_0x0e82('0x2e')][_0x0e82('0x33')]));_0x50322b[_0x0e82('0x31')]=_0x50322b[_0x0e82('0x31')][_0x0e82('0x34')]?_0x50322b[_0x0e82('0x31')]:_0x581764['model'];if(_0x423b14[_0x0e82('0x2e')]['includeAll']){_0x50322b[_0x0e82('0x42')]=[{'all':!![]}];}_0x50322b=_['merge']({},_0x50322b,_0x423b14[_0x0e82('0x40')]);return db['WhatsappQueueReport'][_0x0e82('0x47')](_0x50322b)[_0x0e82('0x25')](handleEntityNotFound(_0x453cd3,null))[_0x0e82('0x25')](respondWithResult(_0x453cd3,null))['catch'](handleError(_0x453cd3,null));};exports['create']=function(_0x331668,_0x132c45){return db[_0x0e82('0x2a')]['create'](_0x331668[_0x0e82('0x48')],{})['then'](respondWithResult(_0x132c45,0xc9))[_0x0e82('0x45')](handleError(_0x132c45,null));};exports[_0x0e82('0x24')]=function(_0x162890,_0x64406e){if(_0x162890[_0x0e82('0x48')]['id']){delete _0x162890[_0x0e82('0x48')]['id'];}return db[_0x0e82('0x2a')][_0x0e82('0x47')]({'where':{'id':_0x162890[_0x0e82('0x49')]['id']}})[_0x0e82('0x25')](handleEntityNotFound(_0x64406e,null))[_0x0e82('0x25')](saveUpdates(_0x162890[_0x0e82('0x48')],null))['then'](respondWithResult(_0x64406e,null))[_0x0e82('0x45')](handleError(_0x64406e,null));};exports[_0x0e82('0x26')]=function(_0x576726,_0x360858){return db['WhatsappQueueReport']['find']({'where':{'id':_0x576726[_0x0e82('0x49')]['id']}})['then'](handleEntityNotFound(_0x360858,null))[_0x0e82('0x25')](removeEntity(_0x360858,null))[_0x0e82('0x45')](handleError(_0x360858,null));};exports[_0x0e82('0x4a')]=function(_0x149100,_0xdbb813){return db['WhatsappQueueReport'][_0x0e82('0x4a')]()['then'](respondWithResult(_0xdbb813,null))[_0x0e82('0x45')](handleError(_0xdbb813,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 345038b..955f91e 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 _0xce65=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid'];(function(_0x1b6752,_0x7c4c40){var _0x30f621=function(_0xc6b5c5){while(--_0xc6b5c5){_0x1b6752['push'](_0x1b6752['shift']());}};_0x30f621(++_0x7c4c40);}(_0xce65,0x9c));var _0x5ce6=function(_0x2d5e45,_0x340324){_0x2d5e45=_0x2d5e45-0x0;var _0x1321e9=_0xce65[_0x2d5e45];return _0x1321e9;};'use strict';var _=require('lodash');var util=require(_0x5ce6('0x0'));var logger=require(_0x5ce6('0x1'))(_0x5ce6('0x2'));var moment=require(_0x5ce6('0x3'));var BPromise=require(_0x5ce6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ce6('0x5'));var rimraf=require(_0x5ce6('0x6'));var config=require(_0x5ce6('0x7'));var attributes=require(_0x5ce6('0x8'));module['exports']=function(_0x4493fb,_0x5b22ec){return _0x4493fb[_0x5ce6('0x9')](_0x5ce6('0xa'),attributes,{'tableName':_0x5ce6('0xb'),'paranoid':![],'indexes':[{'name':_0x5ce6('0xc'),'fields':[_0x5ce6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b88=['report_whatsapp_queue','uniqueid','api','moment','bluebird','rimraf','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport'];(function(_0xfbd165,_0x1e8c53){var _0x9414d4=function(_0xb57fca){while(--_0xb57fca){_0xfbd165['push'](_0xfbd165['shift']());}};_0x9414d4(++_0x1e8c53);}(_0x0b88,0x1ba));var _0x80b8=function(_0x4e126b,_0x3aa531){_0x4e126b=_0x4e126b-0x0;var _0x55ef4=_0x0b88[_0x4e126b];return _0x55ef4;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x80b8('0x0'));var moment=require(_0x80b8('0x1'));var BPromise=require(_0x80b8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x80b8('0x3'));var config=require('../../config/environment');var attributes=require(_0x80b8('0x4'));module[_0x80b8('0x5')]=function(_0x5440bc,_0xbada85){return _0x5440bc[_0x80b8('0x6')](_0x80b8('0x7'),attributes,{'tableName':_0x80b8('0x8'),'paranoid':![],'indexes':[{'name':_0x80b8('0x9'),'fields':[_0x80b8('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 7d83751..e9a7613 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 _0xcb5c=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','debug','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','moment'];(function(_0x405a1f,_0x446aa3){var _0x4fd010=function(_0xc2ed83){while(--_0xc2ed83){_0x405a1f['push'](_0x405a1f['shift']());}};_0x4fd010(++_0x446aa3);}(_0xcb5c,0x172));var _0xccb5=function(_0x614b97,_0x666b6c){_0x614b97=_0x614b97-0x0;var _0x1411e4=_0xcb5c[_0x614b97];return _0x1411e4;};'use strict';var _=require(_0xccb5('0x0'));var util=require('util');var moment=require(_0xccb5('0x1'));var BPromise=require('bluebird');var rs=require(_0xccb5('0x2'));var fs=require('fs');var Redis=require(_0xccb5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xccb5('0x4'));var logger=require(_0xccb5('0x5'))(_0xccb5('0x6'));var config=require('../../config/environment');var jayson=require(_0xccb5('0x7'));var client=jayson[_0xccb5('0x8')][_0xccb5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x12c059,_0x5fed6d,_0x44e12c){return new BPromise(function(_0x3b17b9,_0x1dc8a8){return client[_0xccb5('0xa')](_0x12c059,_0x44e12c)['then'](function(_0x564deb){logger[_0xccb5('0xb')](_0xccb5('0xc'),_0x5fed6d,_0xccb5('0xd'));logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x5fed6d,_0xccb5('0xd'),JSON[_0xccb5('0xe')](_0x564deb));if(_0x564deb[_0xccb5('0xf')]){if(_0x564deb[_0xccb5('0xf')][_0xccb5('0x10')]===0x1f4){logger[_0xccb5('0xf')](_0xccb5('0xc'),_0x5fed6d,_0x564deb[_0xccb5('0xf')][_0xccb5('0x11')]);return _0x1dc8a8(_0x564deb[_0xccb5('0xf')]['message']);}logger[_0xccb5('0xf')](_0xccb5('0xc'),_0x5fed6d,_0x564deb['error'][_0xccb5('0x11')]);return _0x3b17b9(_0x564deb[_0xccb5('0xf')][_0xccb5('0x11')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x5fed6d,_0xccb5('0xd'));_0x3b17b9(_0x564deb[_0xccb5('0x12')][_0xccb5('0x11')]);}})[_0xccb5('0x13')](function(_0x55a6cb){logger[_0xccb5('0xf')](_0xccb5('0xc'),_0x5fed6d,_0x55a6cb);_0x1dc8a8(_0x55a6cb);});});}exports[_0xccb5('0x14')]=function(_0x58b5a4){var _0x426fad=this;return new Promise(function(_0x4a13ff,_0xefe778){return db[_0xccb5('0x15')]['create'](_0x58b5a4[_0xccb5('0x16')],{'raw':_0x58b5a4[_0xccb5('0x17')]?_0x58b5a4[_0xccb5('0x17')][_0xccb5('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x1d9e1d){logger[_0xccb5('0xb')]('CreateWhatsappQueueReport',_0x58b5a4);logger[_0xccb5('0x19')](_0xccb5('0x14'),_0x58b5a4,JSON[_0xccb5('0xe')](_0x1d9e1d));_0x4a13ff(_0x1d9e1d);})[_0xccb5('0x13')](function(_0x54ae19){logger[_0xccb5('0xf')]('CreateWhatsappQueueReport',_0x54ae19[_0xccb5('0x11')],_0x58b5a4);_0xefe778(_0x426fad[_0xccb5('0xf')](0x1f4,_0x54ae19[_0xccb5('0x11')]));});});};exports[_0xccb5('0x1a')]=function(_0x5249db){var _0xba113b=this;return new Promise(function(_0x252fe7,_0x569739){return db[_0xccb5('0x15')][_0xccb5('0x1b')](_0x5249db[_0xccb5('0x16')],{'raw':_0x5249db[_0xccb5('0x17')]?_0x5249db[_0xccb5('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5249db[_0xccb5('0x17')]?_0x5249db[_0xccb5('0x17')][_0xccb5('0x1c')]||null:null,'attributes':_0x5249db['options']?_0x5249db['options'][_0xccb5('0x1d')]||null:null,'limit':_0x5249db['options']?_0x5249db[_0xccb5('0x17')][_0xccb5('0x1e')]||null:null})['then'](function(_0x38e155){logger[_0xccb5('0xb')](_0xccb5('0x1a'),_0x5249db);logger[_0xccb5('0x19')](_0xccb5('0x1a'),_0x5249db,JSON[_0xccb5('0xe')](_0x38e155));_0x252fe7(_0x38e155);})[_0xccb5('0x13')](function(_0x13cd52){logger['error'](_0xccb5('0x1a'),_0x13cd52['message'],_0x5249db);_0x569739(_0xba113b['error'](0x1f4,_0x13cd52['message']));});});}; \ No newline at end of file +var _0x3a41=['create','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','attributes','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','then','info','request\x20sent','debug','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','catch','WhatsappQueueReport'];(function(_0x57421c,_0x49c6b3){var _0x129674=function(_0x1d4413){while(--_0x1d4413){_0x57421c['push'](_0x57421c['shift']());}};_0x129674(++_0x49c6b3);}(_0x3a41,0x8f));var _0x13a4=function(_0x64edb0,_0x4dd13c){_0x64edb0=_0x64edb0-0x0;var _0x580a4b=_0x3a41[_0x64edb0];return _0x580a4b;};'use strict';var _=require('lodash');var util=require(_0x13a4('0x0'));var moment=require('moment');var BPromise=require(_0x13a4('0x1'));var rs=require(_0x13a4('0x2'));var fs=require('fs');var Redis=require(_0x13a4('0x3'));var db=require(_0x13a4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x13a4('0x5'))('rpc');var config=require(_0x13a4('0x6'));var jayson=require(_0x13a4('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x50f130,_0x37ad0c,_0x4f9f64){return new BPromise(function(_0x23a6ae,_0x15fab8){return client['request'](_0x50f130,_0x4f9f64)[_0x13a4('0x8')](function(_0x479ce1){logger[_0x13a4('0x9')]('WhatsappQueueReport,\x20%s,\x20%s',_0x37ad0c,_0x13a4('0xa'));logger[_0x13a4('0xb')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x37ad0c,_0x13a4('0xa'),JSON[_0x13a4('0xc')](_0x479ce1));if(_0x479ce1[_0x13a4('0xd')]){if(_0x479ce1[_0x13a4('0xd')][_0x13a4('0xe')]===0x1f4){logger[_0x13a4('0xd')](_0x13a4('0xf'),_0x37ad0c,_0x479ce1[_0x13a4('0xd')][_0x13a4('0x10')]);return _0x15fab8(_0x479ce1[_0x13a4('0xd')][_0x13a4('0x10')]);}logger[_0x13a4('0xd')](_0x13a4('0xf'),_0x37ad0c,_0x479ce1['error'][_0x13a4('0x10')]);return _0x23a6ae(_0x479ce1[_0x13a4('0xd')][_0x13a4('0x10')]);}else{logger[_0x13a4('0x9')](_0x13a4('0xf'),_0x37ad0c,_0x13a4('0xa'));_0x23a6ae(_0x479ce1['result'][_0x13a4('0x10')]);}})[_0x13a4('0x11')](function(_0x4c8bf0){logger[_0x13a4('0xd')](_0x13a4('0xf'),_0x37ad0c,_0x4c8bf0);_0x15fab8(_0x4c8bf0);});});}exports['CreateWhatsappQueueReport']=function(_0x3f9b37){var _0x41caf4=this;return new Promise(function(_0x1657d8,_0x322cda){return db[_0x13a4('0x12')][_0x13a4('0x13')](_0x3f9b37[_0x13a4('0x14')],{'raw':_0x3f9b37[_0x13a4('0x15')]?_0x3f9b37[_0x13a4('0x15')][_0x13a4('0x16')]===undefined?!![]:![]:!![]})[_0x13a4('0x8')](function(_0x502810){logger['info']('CreateWhatsappQueueReport',_0x3f9b37);logger['debug']('CreateWhatsappQueueReport',_0x3f9b37,JSON[_0x13a4('0xc')](_0x502810));_0x1657d8(_0x502810);})[_0x13a4('0x11')](function(_0x397e63){logger[_0x13a4('0xd')](_0x13a4('0x17'),_0x397e63[_0x13a4('0x10')],_0x3f9b37);_0x322cda(_0x41caf4[_0x13a4('0xd')](0x1f4,_0x397e63[_0x13a4('0x10')]));});});};exports[_0x13a4('0x18')]=function(_0x4e551e){var _0x30eb63=this;return new Promise(function(_0x4f6b54,_0x34f264){return db[_0x13a4('0x12')][_0x13a4('0x19')](_0x4e551e[_0x13a4('0x14')],{'raw':_0x4e551e['options']?_0x4e551e['options'][_0x13a4('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e551e[_0x13a4('0x15')]?_0x4e551e[_0x13a4('0x15')]['where']||null:null,'attributes':_0x4e551e['options']?_0x4e551e[_0x13a4('0x15')][_0x13a4('0x1a')]||null:null,'limit':_0x4e551e[_0x13a4('0x15')]?_0x4e551e[_0x13a4('0x15')]['limit']||null:null})[_0x13a4('0x8')](function(_0x1fff3b){logger[_0x13a4('0x9')](_0x13a4('0x18'),_0x4e551e);logger['debug']('UpdateWhatsappQueueReport',_0x4e551e,JSON['stringify'](_0x1fff3b));_0x4f6b54(_0x1fff3b);})[_0x13a4('0x11')](function(_0x49ef05){logger['error'](_0x13a4('0x18'),_0x49ef05[_0x13a4('0x10')],_0x4e551e);_0x34f264(_0x30eb63[_0x13a4('0xd')](0x1f4,_0x49ef05[_0x13a4('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 0cf6a3d..be85b19 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 _0x04a8=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','delete','destroy','exports','util'];(function(_0x27a760,_0x4570b0){var _0x2136e4=function(_0x451871){while(--_0x451871){_0x27a760['push'](_0x27a760['shift']());}};_0x2136e4(++_0x4570b0);}(_0x04a8,0x13a));var _0x804a=function(_0x1d3236,_0x26bcba){_0x1d3236=_0x1d3236-0x0;var _0x5df9e0=_0x04a8[_0x1d3236];return _0x5df9e0;};'use strict';var multer=require('multer');var util=require(_0x804a('0x0'));var path=require(_0x804a('0x1'));var timeout=require(_0x804a('0x2'));var express=require(_0x804a('0x3'));var router=express[_0x804a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x804a('0x5'));var interaction=require(_0x804a('0x6'));var config=require(_0x804a('0x7'));var controller=require(_0x804a('0x8'));router[_0x804a('0x9')]('/',auth['isAuthenticated'](),controller[_0x804a('0xa')]);router['get'](_0x804a('0xb'),auth[_0x804a('0xc')](),controller[_0x804a('0xd')]);router[_0x804a('0x9')](_0x804a('0xe'),auth[_0x804a('0xc')](),controller[_0x804a('0xf')]);router[_0x804a('0x10')]('/',auth['isAuthenticated'](),controller[_0x804a('0x11')]);router['put'](_0x804a('0xe'),auth[_0x804a('0xc')](),controller['update']);router[_0x804a('0x12')]('/:id',auth[_0x804a('0xc')](),controller[_0x804a('0x13')]);module[_0x804a('0x14')]=router; \ No newline at end of file +var _0xd124=['describe','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x324648,_0x27149e){var _0x304041=function(_0x4fd9b6){while(--_0x4fd9b6){_0x324648['push'](_0x324648['shift']());}};_0x304041(++_0x27149e);}(_0xd124,0x14b));var _0x4d12=function(_0x4d8dcc,_0x36d964){_0x4d8dcc=_0x4d8dcc-0x0;var _0x1cf65b=_0xd124[_0x4d8dcc];return _0x1cf65b;};'use strict';var multer=require(_0x4d12('0x0'));var util=require(_0x4d12('0x1'));var path=require(_0x4d12('0x2'));var timeout=require(_0x4d12('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4d12('0x4'));var config=require(_0x4d12('0x5'));var controller=require(_0x4d12('0x6'));router[_0x4d12('0x7')]('/',auth[_0x4d12('0x8')](),controller[_0x4d12('0x9')]);router[_0x4d12('0x7')](_0x4d12('0xa'),auth[_0x4d12('0x8')](),controller[_0x4d12('0xb')]);router['get'](_0x4d12('0xc'),auth[_0x4d12('0x8')](),controller[_0x4d12('0xd')]);router[_0x4d12('0xe')]('/',auth[_0x4d12('0x8')](),controller[_0x4d12('0xf')]);router['put']('/:id',auth[_0x4d12('0x8')](),controller['update']);router[_0x4d12('0x10')]('/:id',auth[_0x4d12('0x8')](),controller[_0x4d12('0x11')]);module[_0x4d12('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 5a174c3..09b8aeb 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 _0x0972=['exports','ENUM','agent','queue'];(function(_0x38feca,_0x103493){var _0x1da882=function(_0x53b18f){while(--_0x53b18f){_0x38feca['push'](_0x38feca['shift']());}};_0x1da882(++_0x103493);}(_0x0972,0x64));var _0x2097=function(_0x39e5a1,_0x3c80e5){_0x39e5a1=_0x39e5a1-0x0;var _0x29f7bf=_0x0972[_0x39e5a1];return _0x29f7bf;};'use strict';var Sequelize=require('sequelize');module[_0x2097('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2097('0x1')]('account',_0x2097('0x2'),_0x2097('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x6b72=['ENUM','agent','queue','sequelize','STRING'];(function(_0x366217,_0x42d2b7){var _0x398346=function(_0x35c910){while(--_0x35c910){_0x366217['push'](_0x366217['shift']());}};_0x398346(++_0x42d2b7);}(_0x6b72,0x19d));var _0x26b7=function(_0x5e897b,_0x349df5){_0x5e897b=_0x5e897b-0x0;var _0x507d2c=_0x6b72[_0x5e897b];return _0x507d2c;};'use strict';var Sequelize=require(_0x26b7('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x26b7('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x26b7('0x2')]('account',_0x26b7('0x3'),_0x26b7('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index d86da63..563524e 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 _0x3a3a=['merge','options','include','findAll','rows','catch','WhatsappTransferReport','rawAttributes','includeAll','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','sendStatus','stack','name','send','index','map','type','key','query','intersection','model','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','VIRTUAL'];(function(_0xa03e99,_0x208cf5){var _0x12d137=function(_0x270ed3){while(--_0x270ed3){_0xa03e99['push'](_0xa03e99['shift']());}};_0x12d137(++_0x208cf5);}(_0x3a3a,0xef));var _0xa3a3=function(_0x106118,_0x255c3e){_0x106118=_0x106118-0x0;var _0x43584c=_0x3a3a[_0x106118];return _0x43584c;};'use strict';var emlformat=require(_0xa3a3('0x0'));var rimraf=require(_0xa3a3('0x1'));var zipdir=require(_0xa3a3('0x2'));var jsonpatch=require(_0xa3a3('0x3'));var rp=require(_0xa3a3('0x4'));var moment=require(_0xa3a3('0x5'));var BPromise=require(_0xa3a3('0x6'));var Mustache=require(_0xa3a3('0x7'));var util=require('util');var path=require(_0xa3a3('0x8'));var sox=require(_0xa3a3('0x9'));var csv=require(_0xa3a3('0xa'));var ejs=require(_0xa3a3('0xb'));var fs=require('fs');var fs_extra=require(_0xa3a3('0xc'));var _=require(_0xa3a3('0xd'));var squel=require('squel');var crypto=require(_0xa3a3('0xe'));var jsforce=require(_0xa3a3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa3a3('0xa'));var querystring=require('querystring');var Papa=require(_0xa3a3('0x10'));var Redis=require(_0xa3a3('0x11'));var authService=require(_0xa3a3('0x12'));var qs=require(_0xa3a3('0x13'));var as=require(_0xa3a3('0x14'));var hardwareService=require(_0xa3a3('0x15'));var logger=require('../../config/logger')(_0xa3a3('0x16'));var utils=require(_0xa3a3('0x17'));var config=require(_0xa3a3('0x18'));var licenseUtil=require(_0xa3a3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc39a13,_0x121d68){_0x121d68=_0x121d68||0xcc;return function(_0x5a9586){if(_0x5a9586){return _0xc39a13['sendStatus'](_0x121d68);}return _0xc39a13[_0xa3a3('0x1a')](_0x121d68)[_0xa3a3('0x1b')]();};}function respondWithResult(_0x3c9bf4,_0x5e3501){_0x5e3501=_0x5e3501||0xc8;return function(_0x11dfa5){if(_0x11dfa5){return _0x3c9bf4['status'](_0x5e3501)['json'](_0x11dfa5);}};}function respondWithFilteredResult(_0x3ba919,_0x137514){return function(_0x284b72){if(_0x284b72){var _0x59992a=typeof _0x137514[_0xa3a3('0x1c')]===_0xa3a3('0x1d')&&typeof _0x137514[_0xa3a3('0x1e')]===_0xa3a3('0x1d');var _0xf5ae80=_0x284b72[_0xa3a3('0x1f')];var _0x528afb=_0x59992a?0x0:_0x137514['offset'];var _0x4807da=_0x59992a?_0x284b72[_0xa3a3('0x1f')]:_0x137514[_0xa3a3('0x1c')]+_0x137514[_0xa3a3('0x1e')];var _0x5503a8;if(_0x4807da>=_0xf5ae80){_0x4807da=_0xf5ae80;_0x5503a8=0xc8;}else{_0x5503a8=0xce;}_0x3ba919['status'](_0x5503a8);return _0x3ba919[_0xa3a3('0x20')](_0xa3a3('0x21'),_0x528afb+'-'+_0x4807da+'/'+_0xf5ae80)[_0xa3a3('0x22')](_0x284b72);}return null;};}function patchUpdates(_0x386cf8){return function(_0x306465){try{jsonpatch[_0xa3a3('0x23')](_0x306465,_0x386cf8,!![]);}catch(_0xc5f56f){return BPromise['reject'](_0xc5f56f);}return _0x306465[_0xa3a3('0x24')]();};}function saveUpdates(_0x404a32,_0x11229e){return function(_0x47595f){if(_0x47595f){return _0x47595f['update'](_0x404a32)[_0xa3a3('0x25')](function(_0x705834){return _0x705834;});}return null;};}function removeEntity(_0x21b159,_0xdb8846){return function(_0x305d0c){if(_0x305d0c){return _0x305d0c[_0xa3a3('0x26')]()[_0xa3a3('0x25')](function(){_0x21b159[_0xa3a3('0x1a')](0xcc)[_0xa3a3('0x1b')]();});}};}function handleEntityNotFound(_0x35c8ee,_0x4f98d8){return function(_0x2f3e4a){if(!_0x2f3e4a){_0x35c8ee[_0xa3a3('0x27')](0x194);}return _0x2f3e4a;};}function handleError(_0x4eb75f,_0x2be897){_0x2be897=_0x2be897||0x1f4;return function(_0x13fef5){logger['error'](_0x13fef5[_0xa3a3('0x28')]);if(_0x13fef5[_0xa3a3('0x29')]){delete _0x13fef5[_0xa3a3('0x29')];}_0x4eb75f[_0xa3a3('0x1a')](_0x2be897)[_0xa3a3('0x2a')](_0x13fef5);};}exports[_0xa3a3('0x2b')]=function(_0x421953,_0x179522){var _0x1ffb72={},_0x32bfc5={},_0x1de240={'count':0x0,'rows':[]};var _0x4e4afa=_[_0xa3a3('0x2c')](db['WhatsappTransferReport']['rawAttributes'],function(_0x274b78){return{'name':_0x274b78['fieldName'],'type':_0x274b78[_0xa3a3('0x2d')][_0xa3a3('0x2e')]};});_0x32bfc5['model']=_[_0xa3a3('0x2c')](_0x4e4afa,_0xa3a3('0x29'));_0x32bfc5[_0xa3a3('0x2f')]=_['keys'](_0x421953[_0xa3a3('0x2f')]);_0x32bfc5['filters']=_[_0xa3a3('0x30')](_0x32bfc5[_0xa3a3('0x31')],_0x32bfc5[_0xa3a3('0x2f')]);_0x1ffb72[_0xa3a3('0x32')]=_['intersection'](_0x32bfc5[_0xa3a3('0x31')],qs['fields'](_0x421953[_0xa3a3('0x2f')][_0xa3a3('0x33')]));_0x1ffb72['attributes']=_0x1ffb72[_0xa3a3('0x32')][_0xa3a3('0x34')]?_0x1ffb72['attributes']:_0x32bfc5[_0xa3a3('0x31')];if(!_0x421953[_0xa3a3('0x2f')]['hasOwnProperty'](_0xa3a3('0x35'))){_0x1ffb72[_0xa3a3('0x1e')]=qs[_0xa3a3('0x1e')](_0x421953[_0xa3a3('0x2f')][_0xa3a3('0x1e')]);_0x1ffb72[_0xa3a3('0x1c')]=qs[_0xa3a3('0x1c')](_0x421953[_0xa3a3('0x2f')][_0xa3a3('0x1c')]);}_0x1ffb72[_0xa3a3('0x36')]=qs[_0xa3a3('0x37')](_0x421953['query'][_0xa3a3('0x37')]);_0x1ffb72['where']=qs[_0xa3a3('0x38')](_[_0xa3a3('0x39')](_0x421953[_0xa3a3('0x2f')],_0x32bfc5[_0xa3a3('0x38')]),_0x4e4afa);if(_0x421953[_0xa3a3('0x2f')][_0xa3a3('0x3a')]){_0x1ffb72[_0xa3a3('0x3b')]=_['merge'](_0x1ffb72['where'],{'$or':_[_0xa3a3('0x2c')](_0x4e4afa,function(_0x2775bd){if(_0x2775bd[_0xa3a3('0x2d')]!==_0xa3a3('0x3c')){var _0x2796ed={};_0x2796ed[_0x2775bd['name']]={'$like':'%'+_0x421953['query']['filter']+'%'};return _0x2796ed;}})});}_0x1ffb72=_[_0xa3a3('0x3d')]({},_0x1ffb72,_0x421953[_0xa3a3('0x3e')]);var _0x5b26e3={'where':_0x1ffb72[_0xa3a3('0x3b')]};return db['WhatsappTransferReport']['count'](_0x5b26e3)[_0xa3a3('0x25')](function(_0x37accc){_0x1de240[_0xa3a3('0x1f')]=_0x37accc;if(_0x421953[_0xa3a3('0x2f')]['includeAll']){_0x1ffb72[_0xa3a3('0x3f')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xa3a3('0x40')](_0x1ffb72);})[_0xa3a3('0x25')](function(_0x475663){_0x1de240[_0xa3a3('0x41')]=_0x475663;return _0x1de240;})['then'](respondWithFilteredResult(_0x179522,_0x1ffb72))[_0xa3a3('0x42')](handleError(_0x179522,null));};exports['show']=function(_0x1d7b96,_0x1c5405){var _0x5377a2={'raw':!![],'where':{'id':_0x1d7b96['params']['id']}},_0x5e0df1={};_0x5e0df1[_0xa3a3('0x31')]=_['keys'](db[_0xa3a3('0x43')][_0xa3a3('0x44')]);_0x5e0df1[_0xa3a3('0x2f')]=_['keys'](_0x1d7b96[_0xa3a3('0x2f')]);_0x5e0df1[_0xa3a3('0x38')]=_[_0xa3a3('0x30')](_0x5e0df1['model'],_0x5e0df1['query']);_0x5377a2['attributes']=_['intersection'](_0x5e0df1[_0xa3a3('0x31')],qs[_0xa3a3('0x33')](_0x1d7b96[_0xa3a3('0x2f')]['fields']));_0x5377a2[_0xa3a3('0x32')]=_0x5377a2[_0xa3a3('0x32')]['length']?_0x5377a2[_0xa3a3('0x32')]:_0x5e0df1[_0xa3a3('0x31')];if(_0x1d7b96['query'][_0xa3a3('0x45')]){_0x5377a2['include']=[{'all':!![]}];}_0x5377a2=_[_0xa3a3('0x3d')]({},_0x5377a2,_0x1d7b96[_0xa3a3('0x3e')]);return db[_0xa3a3('0x43')]['find'](_0x5377a2)[_0xa3a3('0x25')](handleEntityNotFound(_0x1c5405,null))['then'](respondWithResult(_0x1c5405,null))[_0xa3a3('0x42')](handleError(_0x1c5405,null));};exports[_0xa3a3('0x46')]=function(_0xbab3a8,_0x3cc26e){return db['WhatsappTransferReport']['create'](_0xbab3a8['body'],{})[_0xa3a3('0x25')](respondWithResult(_0x3cc26e,0xc9))[_0xa3a3('0x42')](handleError(_0x3cc26e,null));};exports[_0xa3a3('0x47')]=function(_0x5943f1,_0x34f9e4){if(_0x5943f1[_0xa3a3('0x48')]['id']){delete _0x5943f1[_0xa3a3('0x48')]['id'];}return db[_0xa3a3('0x43')]['find']({'where':{'id':_0x5943f1['params']['id']}})[_0xa3a3('0x25')](handleEntityNotFound(_0x34f9e4,null))[_0xa3a3('0x25')](saveUpdates(_0x5943f1[_0xa3a3('0x48')],null))[_0xa3a3('0x25')](respondWithResult(_0x34f9e4,null))[_0xa3a3('0x42')](handleError(_0x34f9e4,null));};exports[_0xa3a3('0x26')]=function(_0x193bc6,_0xa3a51d){return db[_0xa3a3('0x43')]['find']({'where':{'id':_0x193bc6[_0xa3a3('0x49')]['id']}})[_0xa3a3('0x25')](handleEntityNotFound(_0xa3a51d,null))[_0xa3a3('0x25')](removeEntity(_0xa3a51d,null))[_0xa3a3('0x42')](handleError(_0xa3a51d,null));};exports[_0xa3a3('0x4a')]=function(_0x3be54e,_0x1bb494){return db[_0xa3a3('0x43')][_0xa3a3('0x4a')]()['then'](respondWithResult(_0x1bb494,null))[_0xa3a3('0x42')](handleError(_0x1bb494,null));}; \ No newline at end of file +var _0xa770=['update','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','keys','length','catch','create','body','find','params','describe','eml-format','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/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','apply','save'];(function(_0xc0100a,_0x50a006){var _0x150057=function(_0x45d31a){while(--_0x45d31a){_0xc0100a['push'](_0xc0100a['shift']());}};_0x150057(++_0x50a006);}(_0xa770,0xc6));var _0x0a77=function(_0x495b1b,_0x45c6c8){_0x495b1b=_0x495b1b-0x0;var _0x4172f4=_0xa770[_0x495b1b];return _0x4172f4;};'use strict';var emlformat=require(_0x0a77('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0a77('0x1'));var jsonpatch=require(_0x0a77('0x2'));var rp=require(_0x0a77('0x3'));var moment=require(_0x0a77('0x4'));var BPromise=require(_0x0a77('0x5'));var Mustache=require(_0x0a77('0x6'));var util=require('util');var path=require(_0x0a77('0x7'));var sox=require(_0x0a77('0x8'));var csv=require(_0x0a77('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a77('0xa'));var _=require(_0x0a77('0xb'));var squel=require(_0x0a77('0xc'));var crypto=require(_0x0a77('0xd'));var jsforce=require(_0x0a77('0xe'));var deskjs=require(_0x0a77('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0a77('0x10'));var Papa=require(_0x0a77('0x11'));var Redis=require(_0x0a77('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0a77('0x13'));var as=require(_0x0a77('0x14'));var hardwareService=require(_0x0a77('0x15'));var logger=require(_0x0a77('0x16'))('api');var utils=require(_0x0a77('0x17'));var config=require(_0x0a77('0x18'));var licenseUtil=require(_0x0a77('0x19'));var db=require(_0x0a77('0x1a'))['db'];function respondWithStatusCode(_0x21ee75,_0x1c13bb){_0x1c13bb=_0x1c13bb||0xcc;return function(_0xa155af){if(_0xa155af){return _0x21ee75[_0x0a77('0x1b')](_0x1c13bb);}return _0x21ee75[_0x0a77('0x1c')](_0x1c13bb)[_0x0a77('0x1d')]();};}function respondWithResult(_0x281516,_0x45553b){_0x45553b=_0x45553b||0xc8;return function(_0x37ca79){if(_0x37ca79){return _0x281516[_0x0a77('0x1c')](_0x45553b)[_0x0a77('0x1e')](_0x37ca79);}};}function respondWithFilteredResult(_0x244713,_0x1b55bc){return function(_0x2c2273){if(_0x2c2273){var _0x45e28b=typeof _0x1b55bc[_0x0a77('0x1f')]===_0x0a77('0x20')&&typeof _0x1b55bc[_0x0a77('0x21')]==='undefined';var _0x19c16c=_0x2c2273[_0x0a77('0x22')];var _0xec125d=_0x45e28b?0x0:_0x1b55bc[_0x0a77('0x1f')];var _0x539921=_0x45e28b?_0x2c2273[_0x0a77('0x22')]:_0x1b55bc['offset']+_0x1b55bc[_0x0a77('0x21')];var _0x18074a;if(_0x539921>=_0x19c16c){_0x539921=_0x19c16c;_0x18074a=0xc8;}else{_0x18074a=0xce;}_0x244713[_0x0a77('0x1c')](_0x18074a);return _0x244713[_0x0a77('0x23')](_0x0a77('0x24'),_0xec125d+'-'+_0x539921+'/'+_0x19c16c)[_0x0a77('0x1e')](_0x2c2273);}return null;};}function patchUpdates(_0x4703e7){return function(_0x4bc201){try{jsonpatch[_0x0a77('0x25')](_0x4bc201,_0x4703e7,!![]);}catch(_0x1b117e){return BPromise['reject'](_0x1b117e);}return _0x4bc201[_0x0a77('0x26')]();};}function saveUpdates(_0x3d9705,_0x8b02f8){return function(_0x43b01f){if(_0x43b01f){return _0x43b01f[_0x0a77('0x27')](_0x3d9705)[_0x0a77('0x28')](function(_0x1aa35d){return _0x1aa35d;});}return null;};}function removeEntity(_0x563ab3,_0x3ca57d){return function(_0x107c84){if(_0x107c84){return _0x107c84[_0x0a77('0x29')]()['then'](function(){_0x563ab3[_0x0a77('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31143d,_0x21ad75){return function(_0x2e1ee8){if(!_0x2e1ee8){_0x31143d[_0x0a77('0x1b')](0x194);}return _0x2e1ee8;};}function handleError(_0x40afc5,_0x4c362a){_0x4c362a=_0x4c362a||0x1f4;return function(_0x53262a){logger[_0x0a77('0x2a')](_0x53262a[_0x0a77('0x2b')]);if(_0x53262a[_0x0a77('0x2c')]){delete _0x53262a[_0x0a77('0x2c')];}_0x40afc5['status'](_0x4c362a)[_0x0a77('0x2d')](_0x53262a);};}exports[_0x0a77('0x2e')]=function(_0x1bfcc9,_0x274c74){var _0x1ce2a4={},_0x54d5f6={},_0x111f6d={'count':0x0,'rows':[]};var _0xbb7403=_[_0x0a77('0x2f')](db[_0x0a77('0x30')][_0x0a77('0x31')],function(_0x1fcb67){return{'name':_0x1fcb67[_0x0a77('0x32')],'type':_0x1fcb67['type'][_0x0a77('0x33')]};});_0x54d5f6[_0x0a77('0x34')]=_['map'](_0xbb7403,_0x0a77('0x2c'));_0x54d5f6[_0x0a77('0x35')]=_['keys'](_0x1bfcc9[_0x0a77('0x35')]);_0x54d5f6[_0x0a77('0x36')]=_[_0x0a77('0x37')](_0x54d5f6[_0x0a77('0x34')],_0x54d5f6['query']);_0x1ce2a4[_0x0a77('0x38')]=_[_0x0a77('0x37')](_0x54d5f6[_0x0a77('0x34')],qs[_0x0a77('0x39')](_0x1bfcc9[_0x0a77('0x35')]['fields']));_0x1ce2a4['attributes']=_0x1ce2a4[_0x0a77('0x38')]['length']?_0x1ce2a4[_0x0a77('0x38')]:_0x54d5f6[_0x0a77('0x34')];if(!_0x1bfcc9['query']['hasOwnProperty'](_0x0a77('0x3a'))){_0x1ce2a4[_0x0a77('0x21')]=qs[_0x0a77('0x21')](_0x1bfcc9[_0x0a77('0x35')][_0x0a77('0x21')]);_0x1ce2a4[_0x0a77('0x1f')]=qs[_0x0a77('0x1f')](_0x1bfcc9[_0x0a77('0x35')][_0x0a77('0x1f')]);}_0x1ce2a4[_0x0a77('0x3b')]=qs[_0x0a77('0x3c')](_0x1bfcc9[_0x0a77('0x35')][_0x0a77('0x3c')]);_0x1ce2a4[_0x0a77('0x3d')]=qs['filters'](_[_0x0a77('0x3e')](_0x1bfcc9[_0x0a77('0x35')],_0x54d5f6['filters']),_0xbb7403);if(_0x1bfcc9['query'][_0x0a77('0x3f')]){_0x1ce2a4[_0x0a77('0x3d')]=_[_0x0a77('0x40')](_0x1ce2a4[_0x0a77('0x3d')],{'$or':_[_0x0a77('0x2f')](_0xbb7403,function(_0x1f9bef){if(_0x1f9bef[_0x0a77('0x41')]!==_0x0a77('0x42')){var _0x5d6df8={};_0x5d6df8[_0x1f9bef[_0x0a77('0x2c')]]={'$like':'%'+_0x1bfcc9[_0x0a77('0x35')][_0x0a77('0x3f')]+'%'};return _0x5d6df8;}})});}_0x1ce2a4=_[_0x0a77('0x40')]({},_0x1ce2a4,_0x1bfcc9[_0x0a77('0x43')]);var _0x2e6f9b={'where':_0x1ce2a4[_0x0a77('0x3d')]};return db[_0x0a77('0x30')]['count'](_0x2e6f9b)[_0x0a77('0x28')](function(_0x5810ac){_0x111f6d['count']=_0x5810ac;if(_0x1bfcc9[_0x0a77('0x35')][_0x0a77('0x44')]){_0x1ce2a4[_0x0a77('0x45')]=[{'all':!![]}];}return db[_0x0a77('0x30')]['findAll'](_0x1ce2a4);})[_0x0a77('0x28')](function(_0x4002d1){_0x111f6d[_0x0a77('0x46')]=_0x4002d1;return _0x111f6d;})['then'](respondWithFilteredResult(_0x274c74,_0x1ce2a4))['catch'](handleError(_0x274c74,null));};exports['show']=function(_0x31c1e1,_0x3761e6){var _0x8eda={'raw':!![],'where':{'id':_0x31c1e1['params']['id']}},_0x6b22f7={};_0x6b22f7['model']=_['keys'](db['WhatsappTransferReport'][_0x0a77('0x31')]);_0x6b22f7[_0x0a77('0x35')]=_[_0x0a77('0x47')](_0x31c1e1['query']);_0x6b22f7[_0x0a77('0x36')]=_[_0x0a77('0x37')](_0x6b22f7[_0x0a77('0x34')],_0x6b22f7[_0x0a77('0x35')]);_0x8eda[_0x0a77('0x38')]=_[_0x0a77('0x37')](_0x6b22f7[_0x0a77('0x34')],qs['fields'](_0x31c1e1[_0x0a77('0x35')]['fields']));_0x8eda['attributes']=_0x8eda[_0x0a77('0x38')][_0x0a77('0x48')]?_0x8eda['attributes']:_0x6b22f7['model'];if(_0x31c1e1[_0x0a77('0x35')][_0x0a77('0x44')]){_0x8eda['include']=[{'all':!![]}];}_0x8eda=_[_0x0a77('0x40')]({},_0x8eda,_0x31c1e1[_0x0a77('0x43')]);return db[_0x0a77('0x30')]['find'](_0x8eda)[_0x0a77('0x28')](handleEntityNotFound(_0x3761e6,null))[_0x0a77('0x28')](respondWithResult(_0x3761e6,null))[_0x0a77('0x49')](handleError(_0x3761e6,null));};exports[_0x0a77('0x4a')]=function(_0x4e57d6,_0x93628c){return db[_0x0a77('0x30')]['create'](_0x4e57d6['body'],{})[_0x0a77('0x28')](respondWithResult(_0x93628c,0xc9))[_0x0a77('0x49')](handleError(_0x93628c,null));};exports[_0x0a77('0x27')]=function(_0x3fcccd,_0x2ac3eb){if(_0x3fcccd[_0x0a77('0x4b')]['id']){delete _0x3fcccd['body']['id'];}return db[_0x0a77('0x30')][_0x0a77('0x4c')]({'where':{'id':_0x3fcccd['params']['id']}})[_0x0a77('0x28')](handleEntityNotFound(_0x2ac3eb,null))['then'](saveUpdates(_0x3fcccd[_0x0a77('0x4b')],null))[_0x0a77('0x28')](respondWithResult(_0x2ac3eb,null))['catch'](handleError(_0x2ac3eb,null));};exports[_0x0a77('0x29')]=function(_0x40ccd5,_0x2eb382){return db[_0x0a77('0x30')]['find']({'where':{'id':_0x40ccd5[_0x0a77('0x4d')]['id']}})[_0x0a77('0x28')](handleEntityNotFound(_0x2eb382,null))[_0x0a77('0x28')](removeEntity(_0x2eb382,null))[_0x0a77('0x49')](handleError(_0x2eb382,null));};exports[_0x0a77('0x4e')]=function(_0x5d263a,_0x292465){return db[_0x0a77('0x30')][_0x0a77('0x4e')]()['then'](respondWithResult(_0x292465,null))[_0x0a77('0x49')](handleError(_0x292465,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index f9669bf..2a02ae5 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 _0x8690=['WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define'];(function(_0x29038d,_0x54cca5){var _0x39ca8a=function(_0xbc660d){while(--_0xbc660d){_0x29038d['push'](_0x29038d['shift']());}};_0x39ca8a(++_0x54cca5);}(_0x8690,0xf2));var _0x0869=function(_0x2a2166,_0x3a077f){_0x2a2166=_0x2a2166-0x0;var _0x3bcf50=_0x8690[_0x2a2166];return _0x3bcf50;};'use strict';var _=require(_0x0869('0x0'));var util=require(_0x0869('0x1'));var logger=require(_0x0869('0x2'))(_0x0869('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0869('0x4'));var rimraf=require(_0x0869('0x5'));var config=require(_0x0869('0x6'));var attributes=require(_0x0869('0x7'));module[_0x0869('0x8')]=function(_0x50fd48,_0x37c4a4){return _0x50fd48[_0x0869('0x9')](_0x0869('0xa'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0869('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x406a=['./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','api','bluebird','path','rimraf'];(function(_0x549c11,_0x37a9b5){var _0x446684=function(_0x16839b){while(--_0x16839b){_0x549c11['push'](_0x549c11['shift']());}};_0x446684(++_0x37a9b5);}(_0x406a,0x1be));var _0xa406=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x406a[_0x51c819];return _0x15c5d2;};'use strict';var _=require('lodash');var util=require(_0xa406('0x0'));var logger=require('../../config/logger')(_0xa406('0x1'));var moment=require('moment');var BPromise=require(_0xa406('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa406('0x3'));var rimraf=require(_0xa406('0x4'));var config=require('../../config/environment');var attributes=require(_0xa406('0x5'));module[_0xa406('0x6')]=function(_0x31c66d,_0x262d76){return _0x31c66d[_0xa406('0x7')](_0xa406('0x8'),attributes,{'tableName':_0xa406('0x9'),'paranoid':![],'indexes':[{'name':_0xa406('0xa'),'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 cbae381..fd8bc67 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 _0x8b30=['jayson/promise','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xa2540e,_0x4eabe8){var _0x144e14=function(_0x3dd0d9){while(--_0x3dd0d9){_0xa2540e['push'](_0xa2540e['shift']());}};_0x144e14(++_0x4eabe8);}(_0x8b30,0xc1));var _0x08b3=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x8b30[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0x08b3('0x0'));var util=require(_0x08b3('0x1'));var moment=require('moment');var BPromise=require(_0x08b3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x08b3('0x3'));var logger=require(_0x08b3('0x4'))(_0x08b3('0x5'));var config=require(_0x08b3('0x6'));var jayson=require(_0x08b3('0x7'));var client=jayson['client'][_0x08b3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e53e6,_0xc18a89,_0x3611c2){return new BPromise(function(_0x5d7bc6,_0x1aedea){return client[_0x08b3('0x9')](_0x5e53e6,_0x3611c2)['then'](function(_0x532739){logger[_0x08b3('0xa')](_0x08b3('0xb'),_0xc18a89,_0x08b3('0xc'));logger[_0x08b3('0xd')](_0x08b3('0xe'),_0xc18a89,'request\x20sent',JSON[_0x08b3('0xf')](_0x532739));if(_0x532739[_0x08b3('0x10')]){if(_0x532739['error']['code']===0x1f4){logger['error'](_0x08b3('0xb'),_0xc18a89,_0x532739[_0x08b3('0x10')][_0x08b3('0x11')]);return _0x1aedea(_0x532739[_0x08b3('0x10')][_0x08b3('0x11')]);}logger[_0x08b3('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0xc18a89,_0x532739[_0x08b3('0x10')][_0x08b3('0x11')]);return _0x5d7bc6(_0x532739[_0x08b3('0x10')][_0x08b3('0x11')]);}else{logger[_0x08b3('0xa')](_0x08b3('0xb'),_0xc18a89,_0x08b3('0xc'));_0x5d7bc6(_0x532739[_0x08b3('0x12')]['message']);}})[_0x08b3('0x13')](function(_0x3f4a07){logger[_0x08b3('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0xc18a89,_0x3f4a07);_0x1aedea(_0x3f4a07);});});} \ No newline at end of file +var _0xe55d=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x271ecd,_0x5789d8){var _0x3affec=function(_0x4f09c5){while(--_0x4f09c5){_0x271ecd['push'](_0x271ecd['shift']());}};_0x3affec(++_0x5789d8);}(_0xe55d,0x126));var _0xde55=function(_0x3cf57c,_0x1af43f){_0x3cf57c=_0x3cf57c-0x0;var _0x1ce95a=_0xe55d[_0x3cf57c];return _0x1ce95a;};'use strict';var _=require(_0xde55('0x0'));var util=require(_0xde55('0x1'));var moment=require('moment');var BPromise=require(_0xde55('0x2'));var rs=require(_0xde55('0x3'));var fs=require('fs');var Redis=require(_0xde55('0x4'));var db=require(_0xde55('0x5'))['db'];var utils=require(_0xde55('0x6'));var logger=require(_0xde55('0x7'))('rpc');var config=require(_0xde55('0x8'));var jayson=require(_0xde55('0x9'));var client=jayson[_0xde55('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e7b53,_0x1468f2,_0x1e342e){return new BPromise(function(_0x2094bb,_0x22cbd8){return client[_0xde55('0xb')](_0x1e7b53,_0x1e342e)['then'](function(_0x11aa16){logger[_0xde55('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1468f2,'request\x20sent');logger[_0xde55('0xd')](_0xde55('0xe'),_0x1468f2,'request\x20sent',JSON[_0xde55('0xf')](_0x11aa16));if(_0x11aa16[_0xde55('0x10')]){if(_0x11aa16['error'][_0xde55('0x11')]===0x1f4){logger[_0xde55('0x10')](_0xde55('0x12'),_0x1468f2,_0x11aa16['error'][_0xde55('0x13')]);return _0x22cbd8(_0x11aa16[_0xde55('0x10')][_0xde55('0x13')]);}logger[_0xde55('0x10')](_0xde55('0x12'),_0x1468f2,_0x11aa16[_0xde55('0x10')]['message']);return _0x2094bb(_0x11aa16['error'][_0xde55('0x13')]);}else{logger[_0xde55('0xc')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1468f2,_0xde55('0x14'));_0x2094bb(_0x11aa16[_0xde55('0x15')][_0xde55('0x13')]);}})[_0xde55('0x16')](function(_0x2f4a77){logger[_0xde55('0x10')](_0xde55('0x12'),_0x1468f2,_0x2f4a77);_0x22cbd8(_0x2f4a77);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 443b274..6e69dac 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae1c=['info','filter','exitCode','length','map','online','name','join','Offline\x20apps:','status','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','default','then','listen','start'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xae1c,0xff));var _0xcae1=function(_0x39e6e2,_0x4723ec){_0x39e6e2=_0x39e6e2-0x0;var _0x5ac6f6=_0xae1c[_0x39e6e2];return _0x5ac6f6;};'use strict';var _=require('lodash');var db=require('./mysqldb')['db'];var seedDb=require('./config/seedDB');var checkLicense=require('./config/license');var rpc=require(_0xcae1('0x0'));var config=require(_0xcae1('0x1'));var logger=require(_0xcae1('0x2'))(_0xcae1('0x3'));var pm2=require(_0xcae1('0x4'));var pm2Config=require(_0xcae1('0x5'));var schedule=require(_0xcae1('0x6'));var chat=require(_0xcae1('0x7'));var whatsapp=require(_0xcae1('0x8'));var transcribe=require(_0xcae1('0x9'));var provider=require(_0xcae1('0xa'));function main(){return db[_0xcae1('0xb')][_0xcae1('0xc')]()['then'](function(){if(config['seedDB']){return seedDb[_0xcae1('0xd')]();}})[_0xcae1('0xe')](function(){return checkLicense[_0xcae1('0xd')]();})['then'](function(){return rpc[_0xcae1('0xf')]();})[_0xcae1('0xe')](function(_0x6849f6){logger['info'](_0x6849f6);return chat[_0xcae1('0x10')]();})[_0xcae1('0xe')](function(){return whatsapp['start']();})['then'](function(){return schedule[_0xcae1('0x10')]();})[_0xcae1('0xe')](function(){return transcribe[_0xcae1('0x10')]();})[_0xcae1('0xe')](function(){return provider[_0xcae1('0x10')]();})[_0xcae1('0xe')](function(_0x1124d9){logger[_0xcae1('0x11')](_0x1124d9);return pm2[_0xcae1('0x10')](pm2Config);})[_0xcae1('0xe')](function(_0x13ad2c){var _0x203741=_0x13ad2c[_0xcae1('0x12')](function(_0x12d6cb){return typeof _0x12d6cb[_0xcae1('0x13')]==='number'&&_0x12d6cb[_0xcae1('0x13')]>=0x0;});if(_0x203741[_0xcae1('0x14')]>0x0){throw new Error(_0x203741['length']+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xcae1('0x15')](_0x203741,function(_0x143c21){return'\x22'+_0x143c21['pm2_env']['name']+'\x22';}));}logger[_0xcae1('0x11')]('Online\x20apps:',_[_0xcae1('0x15')](_[_0xcae1('0x12')](_0x13ad2c,{'status':_0xcae1('0x16')}),_0xcae1('0x17'))[_0xcae1('0x18')]());logger[_0xcae1('0x11')](_0xcae1('0x19'),_[_0xcae1('0x15')](_[_0xcae1('0x12')](_0x13ad2c,function(_0x33e1af){return _0x33e1af[_0xcae1('0x1a')]!==_0xcae1('0x16');}),_0xcae1('0x17'))[_0xcae1('0x18')]()||'None');console[_0xcae1('0x1b')](_0xcae1('0x1c'));})[_0xcae1('0x1d')](function(_0x2972d6){console['log'](_0xcae1('0x1e'),_0x2972d6);logger[_0xcae1('0x1f')](_0xcae1('0x20'),_0x2972d6);process[_0xcae1('0x21')](0x1);});}main(); \ No newline at end of file +var _0xdcf6=['App\x20Ready!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','then','default','info','start','filter','exitCode','length','map','pm2_env','name','Online\x20apps:','join','Offline\x20apps:','online','None','log'];(function(_0x7ff7da,_0x13a1f2){var _0x4626f1=function(_0x4a4ee5){while(--_0x4a4ee5){_0x7ff7da['push'](_0x7ff7da['shift']());}};_0x4626f1(++_0x13a1f2);}(_0xdcf6,0x1b6));var _0x6dcf=function(_0x3374fd,_0x59a9bc){_0x3374fd=_0x3374fd-0x0;var _0xb10792=_0xdcf6[_0x3374fd];return _0xb10792;};'use strict';var _=require('lodash');var db=require(_0x6dcf('0x0'))['db'];var seedDb=require(_0x6dcf('0x1'));var checkLicense=require(_0x6dcf('0x2'));var rpc=require(_0x6dcf('0x3'));var config=require(_0x6dcf('0x4'));var logger=require(_0x6dcf('0x5'))(_0x6dcf('0x6'));var pm2=require('./config/pm2');var pm2Config=require(_0x6dcf('0x7'));var schedule=require(_0x6dcf('0x8'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x6dcf('0x9'));var transcribe=require(_0x6dcf('0xa'));var provider=require('./config/schedule/cloud-provider');function main(){return db['sequelize']['sync']()[_0x6dcf('0xb')](function(){if(config['seedDB']){return seedDb[_0x6dcf('0xc')]();}})[_0x6dcf('0xb')](function(){return checkLicense[_0x6dcf('0xc')]();})['then'](function(){return rpc['listen']();})['then'](function(_0x443c93){logger[_0x6dcf('0xd')](_0x443c93);return chat[_0x6dcf('0xe')]();})['then'](function(){return whatsapp[_0x6dcf('0xe')]();})[_0x6dcf('0xb')](function(){return schedule[_0x6dcf('0xe')]();})[_0x6dcf('0xb')](function(){return transcribe[_0x6dcf('0xe')]();})[_0x6dcf('0xb')](function(){return provider[_0x6dcf('0xe')]();})[_0x6dcf('0xb')](function(_0x43dbf1){logger[_0x6dcf('0xd')](_0x43dbf1);return pm2[_0x6dcf('0xe')](pm2Config);})[_0x6dcf('0xb')](function(_0x418c45){var _0x214050=_0x418c45[_0x6dcf('0xf')](function(_0x31239d){return typeof _0x31239d[_0x6dcf('0x10')]==='number'&&_0x31239d[_0x6dcf('0x10')]>=0x0;});if(_0x214050[_0x6dcf('0x11')]>0x0){throw new Error(_0x214050[_0x6dcf('0x11')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x6dcf('0x12')](_0x214050,function(_0x1a03b4){return'\x22'+_0x1a03b4[_0x6dcf('0x13')][_0x6dcf('0x14')]+'\x22';}));}logger[_0x6dcf('0xd')](_0x6dcf('0x15'),_[_0x6dcf('0x12')](_[_0x6dcf('0xf')](_0x418c45,{'status':'online'}),_0x6dcf('0x14'))[_0x6dcf('0x16')]());logger[_0x6dcf('0xd')](_0x6dcf('0x17'),_[_0x6dcf('0x12')](_[_0x6dcf('0xf')](_0x418c45,function(_0x32ea6c){return _0x32ea6c['status']!==_0x6dcf('0x18');}),'name')[_0x6dcf('0x16')]()||_0x6dcf('0x19'));console[_0x6dcf('0x1a')](_0x6dcf('0x1b'));})['catch'](function(_0x576cce){console[_0x6dcf('0x1a')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x576cce);logger[_0x6dcf('0x1c')](_0x6dcf('0x1d'),_0x576cce);process[_0x6dcf('0x1e')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 8d90e56..4614141 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 _0x45eb=['validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','splice','unshift','encryptString','join','promisify','sign','secret','verify','randomBytes','toString','floor','now','HS512','../../mysqldb','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','role','internal','email','permissions','md5secret','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','params','closed','disposition','then','status','json','Forbidden.','headers','authorization','startsWith','Basic','User','name','Wrong\x20credentials.','user','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','find','sub','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','catch','use','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x45eb,0x12d));var _0xb45e=function(_0x4efe94,_0x4e7e3a){_0x4efe94=_0x4efe94-0x0;var _0x55f299=_0x45eb[_0x4efe94];return _0x55f299;};'use strict';var db=require(_0xb45e('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0xb45e('0x1'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xb45e('0x2'));var _=require(_0xb45e('0x3'));var jwt=require(_0xb45e('0x4'));var expressJwt=require(_0xb45e('0x5'));var compose=require(_0xb45e('0x6'));var basicAuth=require(_0xb45e('0x7'));var crypto=require(_0xb45e('0x8'));var BPromise=require(_0xb45e('0x9'));var util=require('util');var moment=require(_0xb45e('0xa'));var validateJwt=expressJwt({'secret':config[_0xb45e('0xb')][_0xb45e('0xc')]});var userAttributes=['id',_0xb45e('0xd'),'fullname','name',_0xb45e('0xe'),_0xb45e('0xf'),'userpic',_0xb45e('0x10'),_0xb45e('0x11'),'voicePause',_0xb45e('0x12'),_0xb45e('0x13'),_0xb45e('0x14'),_0xb45e('0x15'),_0xb45e('0x16'),_0xb45e('0x17'),'showWebBar',_0xb45e('0x18'),'lastPauseAt',_0xb45e('0x19'),'allowmessenger',_0xb45e('0x1a'),_0xb45e('0x1b'),_0xb45e('0x1c'),'phoneBarAutoAnswerDelay',_0xb45e('0x1d'),_0xb45e('0x1e'),'phoneBarEnableDtmfTone',_0xb45e('0x1f'),_0xb45e('0x20'),'phoneBarPrefixRequired',_0xb45e('0x21'),_0xb45e('0x22'),_0xb45e('0x23'),_0xb45e('0x24'),_0xb45e('0x25'),_0xb45e('0x26'),_0xb45e('0x27'),_0xb45e('0x28'),_0xb45e('0x29'),_0xb45e('0x2a'),'downloadAttachments',_0xb45e('0x2b'),_0xb45e('0x2c'),_0xb45e('0x2d'),_0xb45e('0x2e'),_0xb45e('0x2f'),_0xb45e('0x30'),_0xb45e('0x31'),_0xb45e('0x32'),'openchannelAutoanswer',_0xb45e('0x33'),_0xb45e('0x34'),_0xb45e('0x35'),'whatsappAutoanswer',_0xb45e('0x36'),_0xb45e('0x37')];exports[_0xb45e('0x38')]=function(){return this[_0xb45e('0x39')](!![])['use'](function(_0x17bd84,_0x505b22,_0xe70ad0){if(_0x17bd84['user']){_0xe70ad0();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x17bd84[_0xb45e('0x3a')]['id']},'attributes':['id',_0xb45e('0x3b'),_0xb45e('0x3c')],'raw':!![]})[_0xb45e('0x3d')](function(_0x105337){if(_0x105337&&_0x105337[_0xb45e('0x3b')]&&!_0x17bd84['query']['forceDownload']){return _0x505b22[_0xb45e('0x3e')](_0x105337['disposition']==='unmanaged'?0x195:0x193)[_0xb45e('0x3f')]({'message':_0x105337[_0xb45e('0x3c')]==='unmanaged'?'Unmanaged.':_0xb45e('0x40')});}else{_0xe70ad0();}})['catch'](function(_0x4da6a6){_0xe70ad0(_0x4da6a6);});}});};exports[_0xb45e('0x39')]=function isAuthenticated(_0x54fcfd){return compose()['use'](function(_0x2d77d7,_0x400005,_0x520d6c){var _0x479663;if(_0x2d77d7[_0xb45e('0x41')][_0xb45e('0x42')]){if(_[_0xb45e('0x43')](_0x2d77d7[_0xb45e('0x41')][_0xb45e('0x42')],_0xb45e('0x44'))){var _0x33d96f=basicAuth(_0x2d77d7);db[_0xb45e('0x45')]['find']({'where':{'name':_0x33d96f[_0xb45e('0x46')]}})['then'](function(_0x3a518e){if(!_0x3a518e||!_0x3a518e['authenticate'](_0x33d96f['pass'])){return _0x400005[_0xb45e('0x3e')](0x191)[_0xb45e('0x3f')]({'message':_0xb45e('0x47')});}_0x2d77d7[_0xb45e('0x48')]={'id':_0x3a518e['id']};_0x520d6c();})['catch'](function(_0x1c3839){_0x520d6c(_0x1c3839);});}else if(_[_0xb45e('0x43')](_0x2d77d7[_0xb45e('0x41')][_0xb45e('0x42')],_0xb45e('0x49'))){validateJwt(_0x2d77d7,_0x400005,_0x520d6c);}else{if(_0x54fcfd){_0x520d6c();}else{return _0x400005[_0xb45e('0x3e')](0x193)['json']({'message':_0xb45e('0x4a')});}}}else if(_0x2d77d7['query'][_0xb45e('0x4b')]){try{var _0x233eab={'audience':hardwareConf[_0xb45e('0x4c')](),'issuer':hardwareConf[_0xb45e('0x4c')]()};verifyJwt(_0x2d77d7[_0xb45e('0x4d')][_0xb45e('0x4b')],_0x233eab)['then'](function(_0x52ce07){return db[_0xb45e('0x45')][_0xb45e('0x4e')]({'where':{'id':_0x52ce07[_0xb45e('0x4f')]}})[_0xb45e('0x3d')](function(_0x4f1cbb){_0x479663=_0x4f1cbb;return db[_0xb45e('0x50')][_0xb45e('0x51')]({'where':{'id':0x1},'attributes':[_0xb45e('0x52'),_0xb45e('0x53')],'raw':!![]});})[_0xb45e('0x3d')](function(_0x3119d0){if(!_0x479663||!_[_0xb45e('0x54')](_0x479663[_0xb45e('0x55')],_0x52ce07[_0xb45e('0x56')])){return _0x400005[_0xb45e('0x3e')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x479663[_0xb45e('0x57')]){return _0x400005[_0xb45e('0x3e')](0x191)['json']({'message':_0xb45e('0x58')});}if(_0x479663[_0xb45e('0x59')]){if(_0x3119d0[_0xb45e('0x53')]>0x0){if(moment(_0x479663[_0xb45e('0x5a')])['add'](_0x3119d0['blockDuration'],_0xb45e('0x5b'))>moment()){return _0x400005[_0xb45e('0x3e')](0x191)[_0xb45e('0x3f')]({'message':_0xb45e('0x58')});}}else{return _0x400005[_0xb45e('0x3e')](0x191)[_0xb45e('0x3f')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x2d77d7[_0xb45e('0x48')]={'id':_0x479663['id']};_0x520d6c();});})[_0xb45e('0x5c')](function(){return _0x400005[_0xb45e('0x3e')](0x191)[_0xb45e('0x3f')]({'message':_0xb45e('0x58')});});}catch(_0x4f402b){_0x520d6c(_0x4f402b);}}else if(_0x54fcfd){_0x520d6c();}else{return _0x400005[_0xb45e('0x3e')](0x193)[_0xb45e('0x3f')]({'message':_0xb45e('0x4a')});}})[_0xb45e('0x5d')](function(_0x1c4ada,_0x2b5f3e,_0x3cb879){if(_0x1c4ada[_0xb45e('0x48')]){db[_0xb45e('0x45')][_0xb45e('0x4e')]({'where':{'id':_0x1c4ada[_0xb45e('0x48')]['id']},'attributes':userAttributes})[_0xb45e('0x3d')](function(_0x173861){if(!_0x173861){return _0x2b5f3e[_0xb45e('0x3e')](0x194)[_0xb45e('0x3f')]({'message':'User\x20not\x20found.'});}_0x1c4ada[_0xb45e('0x48')]=_0x173861;_0x3cb879();})[_0xb45e('0x5c')](function(_0x3767d4){_0x3cb879(_0x3767d4);});}else if(_0x54fcfd){_0x3cb879();}else{return _0x2b5f3e[_0xb45e('0x3e')](0x194)[_0xb45e('0x3f')]({'message':_0xb45e('0x5e')});}});};exports[_0xb45e('0x5f')]=function canUpdate(){return compose()[_0xb45e('0x5d')](function(_0x29e9be,_0x445c5c,_0xf1c7ef){return licenseUtil[_0xb45e('0x60')]()[_0xb45e('0x3d')](function(_0x1a9af9){if(_0x1a9af9[_0xb45e('0x61')]){_0xf1c7ef();}else{return _0x445c5c['status'](0x193)[_0xb45e('0x3f')]({'message':'Forbidden'});}})['catch'](function(_0x1b240c){_0xf1c7ef(_0x1b240c);});});};exports[_0xb45e('0x62')]=function isWebrtcLicence(){return compose()[_0xb45e('0x5d')](function(_0x2d456c,_0x7134ef,_0x1e4dcb){return licenseUtil['getLicense']()[_0xb45e('0x3d')](function(_0xace039){if(_0xace039[_0xb45e('0x63')]){_0x1e4dcb();}else{return _0x7134ef[_0xb45e('0x3e')](0x193)['json']({'message':'Forbidden'});}})[_0xb45e('0x5c')](function(_0x5866d2){_0x1e4dcb(_0x5866d2);});});};exports[_0xb45e('0x64')]=function(_0x5ee283,_0x1c7bb2,_0x16f518){_0x5ee283[_0xb45e('0x64')]=!![];return _0x16f518();};exports[_0xb45e('0x65')]=function signToken(_0x2fe4aa){return signJwt(_0x2fe4aa);};exports['setTokenCookie']=function(_0xa63cd,_0x2accb8){if(!_0xa63cd['user']){return _0x2accb8[_0xb45e('0x3e')](0x194)[_0xb45e('0x3f')]({'message':_0xb45e('0x66')});}var _0x1bf624={'payload':{'id':_0xa63cd['user']['id'],'role':_0xa63cd['user'][_0xb45e('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x1bf624)[_0xb45e('0x3d')](function(_0x3a00ae){_0x2accb8[_0xb45e('0x67')](_0xb45e('0x68'),_0x3a00ae);_0x2accb8[_0xb45e('0x69')]('/dashboards/general');})[_0xb45e('0x5c')](function(_0x887990){return _0x2accb8[_0xb45e('0x3e')](0x1f4)[_0xb45e('0x6a')](_0x887990);});};exports[_0xb45e('0x6b')]=function(_0x39648e){if(_[_0xb45e('0x6c')](_0x39648e['apiKeyNonce'])||_[_0xb45e('0x6c')](_0x39648e[_0xb45e('0x6d')])){return null;}else{return createJwt(_0x39648e);}};exports[_0xb45e('0x6e')]=function(_0x36f1e2){_0x36f1e2['apiKeyNonce']=generateNonce();_0x36f1e2[_0xb45e('0x6d')]=generateIssuedAt();return createJwt(_0x36f1e2);};exports[_0xb45e('0x6f')]=function(_0x28017,_0x275c80){var _0xe30d53=_0x28017[_0xb45e('0x4d')][_0xb45e('0x4b')];if(_0xe30d53){var _0x113ff1={'nonce':_0x275c80[_0xb45e('0x55')],'iat':_0x275c80[_0xb45e('0x6d')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0xe30d53,_0x113ff1)['then'](function(){return generateApiKey(_0x275c80);});}else{throw{'message':_0xb45e('0x70')};}};exports[_0xb45e('0x71')]=function(_0x2ea580){var _0x494638=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x494638['test'](_0x2ea580))throw new db[(_0xb45e('0x72'))][(_0xb45e('0x73'))](_0xb45e('0x74'));return;};exports[_0xb45e('0x75')]=function(_0x5d9f54,_0x37baeb,_0x312772){var _0x1c1d68=encryptor[_0xb45e('0x76')](_0x37baeb)[_0xb45e('0x77')](',');for(var _0x5f4fcf=0x0;_0x5f4fcf<_0x312772;_0x5f4fcf++){if(!_0x1c1d68[_0x5f4fcf])break;if(_0x5d9f54[_0xb45e('0x78')]()===_0x1c1d68[_0x5f4fcf][_0xb45e('0x78')]()){var _0x3defc6=util[_0xb45e('0x79')](_0xb45e('0x7a'),_0x312772);if(_0x312772===0x1){_0x3defc6=_0xb45e('0x7b');}throw new db[(_0xb45e('0x72'))][(_0xb45e('0x73'))](_0x3defc6);}}return;};exports['updatePasswordsHistory']=function(_0xc01aec,_0x435fc1){var _0x5371bd=_0x435fc1?encryptor['decryptString'](_0x435fc1)[_0xb45e('0x77')](','):[];if(_0x5371bd[_0xb45e('0x7c')]===0x5){_0x5371bd[_0xb45e('0x7d')](-0x1,0x1);}_0x5371bd[_0xb45e('0x7e')](_0xc01aec);return encryptor[_0xb45e('0x7f')](_0x5371bd[_0xb45e('0x80')](','));};function signJwt(_0x5b663a){var _0x36d926=BPromise[_0xb45e('0x81')](jwt[_0xb45e('0x82')],{'context':jwt});var _0x5c8346=_0x5b663a[_0xb45e('0x83')]||config[_0xb45e('0xb')][_0xb45e('0xc')];return new BPromise(function(_0x55806b,_0x4c5899){_0x36d926(_0x5b663a['payload'],_0x5c8346,_0x5b663a['options'])[_0xb45e('0x3d')](function(_0x38ce44){_0x55806b(_0x38ce44);})[_0xb45e('0x5c')](function(_0x3c7d11){_0x4c5899(_0x3c7d11);});});}function verifyJwt(_0x35903d,_0x348be0,_0x2d5616){var _0x383b71=BPromise['promisify'](jwt[_0xb45e('0x84')],{'context':jwt});var _0x39e2aa=_0x2d5616||config['secrets'][_0xb45e('0xc')];return new BPromise(function(_0x45a384,_0x5649aa){_0x383b71(_0x35903d,_0x39e2aa,_0x348be0)[_0xb45e('0x3d')](function(_0x4d51d8){_0x45a384(_0x4d51d8);})[_0xb45e('0x5c')](function(_0x1d14d0){_0x5649aa(_0x1d14d0);});});}function generateNonce(){return crypto[_0xb45e('0x85')](0x10)[_0xb45e('0x86')]('hex');}function generateIssuedAt(){return Math[_0xb45e('0x87')](Date[_0xb45e('0x88')]()/0x3e8)[_0xb45e('0x86')]();}function createJwt(_0x21afa1){var _0xdbc22c={'payload':{'iat':_0x21afa1[_0xb45e('0x6d')],'nonce':_0x21afa1['apiKeyNonce']},'options':{'algorithm':_0xb45e('0x89'),'subject':_0x21afa1['id']['toString'](),'issuer':hardwareConf[_0xb45e('0x4c')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0xdbc22c)[_0xb45e('0x3d')](function(_0xeba7bd){return{'iat':_0x21afa1[_0xb45e('0x6d')],'nonce':_0x21afa1[_0xb45e('0x55')],'token':_0xeba7bd};});} \ No newline at end of file +var _0xd6ef=['express-jwt','composable-middleware','basic-auth','util','moment','secrets','session','role','fullname','name','userpic','permissions','md5secret','voicePause','chatPause','mailPause','smsPause','pauseType','showWebBar','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','openchannelAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','disposition','then','closed','forceDownload','status','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','find','authenticate','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','apikey','getUuid','User','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','isWebrtcLicence','webrtc','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','unshift','encryptString','join','promisify','sign','secret','payload','verify','randomBytes','toString','floor','now','../../config/environment','../encryptor','jsonwebtoken'];(function(_0x7d4bbe,_0x264cf8){var _0x22a59f=function(_0x1d0db5){while(--_0x1d0db5){_0x7d4bbe['push'](_0x7d4bbe['shift']());}};_0x22a59f(++_0x264cf8);}(_0xd6ef,0x109));var _0xfd6e=function(_0x4775c9,_0x2192e4){_0x4775c9=_0x4775c9-0x0;var _0x14dbc6=_0xd6ef[_0x4775c9];return _0x14dbc6;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xfd6e('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require(_0xfd6e('0x1'));var _=require('lodash');var jwt=require(_0xfd6e('0x2'));var expressJwt=require(_0xfd6e('0x3'));var compose=require(_0xfd6e('0x4'));var basicAuth=require(_0xfd6e('0x5'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0xfd6e('0x6'));var moment=require(_0xfd6e('0x7'));var validateJwt=expressJwt({'secret':config[_0xfd6e('0x8')][_0xfd6e('0x9')]});var userAttributes=['id',_0xfd6e('0xa'),_0xfd6e('0xb'),_0xfd6e('0xc'),'internal','email',_0xfd6e('0xd'),_0xfd6e('0xe'),_0xfd6e('0xf'),_0xfd6e('0x10'),_0xfd6e('0x11'),_0xfd6e('0x12'),'faxPause',_0xfd6e('0x13'),'openchannelPause',_0xfd6e('0x14'),_0xfd6e('0x15'),_0xfd6e('0x16'),'lastPauseAt',_0xfd6e('0x17'),_0xfd6e('0x18'),_0xfd6e('0x19'),_0xfd6e('0x1a'),'phoneBarAutoAnswer',_0xfd6e('0x1b'),_0xfd6e('0x1c'),_0xfd6e('0x1d'),_0xfd6e('0x1e'),'phoneBarEnableSettings',_0xfd6e('0x1f'),_0xfd6e('0x20'),_0xfd6e('0x21'),_0xfd6e('0x22'),'hotdesk','interface','userProfileId',_0xfd6e('0x23'),_0xfd6e('0x24'),_0xfd6e('0x25'),_0xfd6e('0x26'),_0xfd6e('0x27'),'downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign',_0xfd6e('0x28'),_0xfd6e('0x29'),_0xfd6e('0x2a'),_0xfd6e('0x2b'),_0xfd6e('0x2c'),'smsAutoanswerDelay',_0xfd6e('0x2d'),'openchannelAutoanswerDelay','faxAutoanswer',_0xfd6e('0x2e'),'whatsappAutoanswer',_0xfd6e('0x2f'),_0xfd6e('0x30')];exports[_0xfd6e('0x31')]=function(){return this[_0xfd6e('0x32')](!![])[_0xfd6e('0x33')](function(_0x41e813,_0x44edcc,_0x27579f){if(_0x41e813[_0xfd6e('0x34')]){_0x27579f();}else{return db[_0xfd6e('0x35')][_0xfd6e('0x36')]({'where':{'id':_0x41e813[_0xfd6e('0x37')]['id']},'attributes':['id','closed',_0xfd6e('0x38')],'raw':!![]})[_0xfd6e('0x39')](function(_0x3430bb){if(_0x3430bb&&_0x3430bb[_0xfd6e('0x3a')]&&!_0x41e813['query'][_0xfd6e('0x3b')]){return _0x44edcc[_0xfd6e('0x3c')](_0x3430bb[_0xfd6e('0x38')]===_0xfd6e('0x3d')?0x195:0x193)[_0xfd6e('0x3e')]({'message':_0x3430bb['disposition']===_0xfd6e('0x3d')?_0xfd6e('0x3f'):_0xfd6e('0x40')});}else{_0x27579f();}})[_0xfd6e('0x41')](function(_0x4be15c){_0x27579f(_0x4be15c);});}});};exports['isAuthenticated']=function isAuthenticated(_0x3120e8){return compose()[_0xfd6e('0x33')](function(_0x317a98,_0x443241,_0x25a9f2){var _0xcb6523;if(_0x317a98[_0xfd6e('0x42')][_0xfd6e('0x43')]){if(_[_0xfd6e('0x44')](_0x317a98[_0xfd6e('0x42')][_0xfd6e('0x43')],_0xfd6e('0x45'))){var _0x2aedb3=basicAuth(_0x317a98);db['User'][_0xfd6e('0x46')]({'where':{'name':_0x2aedb3[_0xfd6e('0xc')]}})['then'](function(_0x1d83f4){if(!_0x1d83f4||!_0x1d83f4[_0xfd6e('0x47')](_0x2aedb3['pass'])){return _0x443241[_0xfd6e('0x3c')](0x191)[_0xfd6e('0x3e')]({'message':_0xfd6e('0x48')});}_0x317a98[_0xfd6e('0x34')]={'id':_0x1d83f4['id']};_0x25a9f2();})[_0xfd6e('0x41')](function(_0x2d3f1e){_0x25a9f2(_0x2d3f1e);});}else if(_[_0xfd6e('0x44')](_0x317a98[_0xfd6e('0x42')]['authorization'],'Bearer')){validateJwt(_0x317a98,_0x443241,_0x25a9f2);}else{if(_0x3120e8){_0x25a9f2();}else{return _0x443241[_0xfd6e('0x3c')](0x193)[_0xfd6e('0x3e')]({'message':_0xfd6e('0x49')});}}}else if(_0x317a98[_0xfd6e('0x4a')][_0xfd6e('0x4b')]){try{var _0x49267c={'audience':hardwareConf[_0xfd6e('0x4c')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x317a98[_0xfd6e('0x4a')][_0xfd6e('0x4b')],_0x49267c)[_0xfd6e('0x39')](function(_0xbe0010){return db[_0xfd6e('0x4d')][_0xfd6e('0x46')]({'where':{'id':_0xbe0010[_0xfd6e('0x4e')]}})[_0xfd6e('0x39')](function(_0x209a5b){_0xcb6523=_0x209a5b;return db[_0xfd6e('0x4f')]['findOne']({'where':{'id':0x1},'attributes':[_0xfd6e('0x50'),_0xfd6e('0x51')],'raw':!![]});})[_0xfd6e('0x39')](function(_0x56eb5d){if(!_0xcb6523||!_[_0xfd6e('0x52')](_0xcb6523['apiKeyNonce'],_0xbe0010[_0xfd6e('0x53')])){return _0x443241['status'](0x191)[_0xfd6e('0x3e')]({'message':_0xfd6e('0x54')});}if(_0xcb6523[_0xfd6e('0x55')]){return _0x443241['status'](0x191)[_0xfd6e('0x3e')]({'message':_0xfd6e('0x56')});}if(_0xcb6523[_0xfd6e('0x57')]){if(_0x56eb5d['blockDuration']>0x0){if(moment(_0xcb6523[_0xfd6e('0x58')])[_0xfd6e('0x59')](_0x56eb5d['blockDuration'],_0xfd6e('0x5a'))>moment()){return _0x443241[_0xfd6e('0x3c')](0x191)[_0xfd6e('0x3e')]({'message':_0xfd6e('0x56')});}}else{return _0x443241['status'](0x191)[_0xfd6e('0x3e')]({'message':_0xfd6e('0x56')});}}_0x317a98[_0xfd6e('0x34')]={'id':_0xcb6523['id']};_0x25a9f2();});})[_0xfd6e('0x41')](function(){return _0x443241[_0xfd6e('0x3c')](0x191)['json']({'message':_0xfd6e('0x56')});});}catch(_0x5d04d9){_0x25a9f2(_0x5d04d9);}}else if(_0x3120e8){_0x25a9f2();}else{return _0x443241[_0xfd6e('0x3c')](0x193)['json']({'message':_0xfd6e('0x49')});}})[_0xfd6e('0x33')](function(_0x463a88,_0x25dcf1,_0x3ca3c4){if(_0x463a88['user']){db[_0xfd6e('0x4d')][_0xfd6e('0x46')]({'where':{'id':_0x463a88[_0xfd6e('0x34')]['id']},'attributes':userAttributes})[_0xfd6e('0x39')](function(_0x10f5bc){if(!_0x10f5bc){return _0x25dcf1['status'](0x194)[_0xfd6e('0x3e')]({'message':_0xfd6e('0x5b')});}_0x463a88[_0xfd6e('0x34')]=_0x10f5bc;_0x3ca3c4();})[_0xfd6e('0x41')](function(_0x24d3b1){_0x3ca3c4(_0x24d3b1);});}else if(_0x3120e8){_0x3ca3c4();}else{return _0x25dcf1[_0xfd6e('0x3c')](0x194)['json']({'message':_0xfd6e('0x5c')});}});};exports[_0xfd6e('0x5d')]=function canUpdate(){return compose()[_0xfd6e('0x33')](function(_0x49f52e,_0x439d69,_0x3a29eb){return licenseUtil[_0xfd6e('0x5e')]()['then'](function(_0x41e2d7){if(_0x41e2d7['update']){_0x3a29eb();}else{return _0x439d69[_0xfd6e('0x3c')](0x193)[_0xfd6e('0x3e')]({'message':'Forbidden'});}})['catch'](function(_0xf84ebc){_0x3a29eb(_0xf84ebc);});});};exports[_0xfd6e('0x5f')]=function isWebrtcLicence(){return compose()[_0xfd6e('0x33')](function(_0x4ac589,_0x39bef0,_0x3bcb9b){return licenseUtil[_0xfd6e('0x5e')]()['then'](function(_0x43e357){if(_0x43e357[_0xfd6e('0x60')]){_0x3bcb9b();}else{return _0x39bef0[_0xfd6e('0x3c')](0x193)[_0xfd6e('0x3e')]({'message':_0xfd6e('0x61')});}})['catch'](function(_0x38254b){_0x3bcb9b(_0x38254b);});});};exports['isMiddleware']=function(_0x407696,_0x21a5dd,_0xb864ca){_0x407696[_0xfd6e('0x62')]=!![];return _0xb864ca();};exports['signToken']=function signToken(_0x5777d7){return signJwt(_0x5777d7);};exports[_0xfd6e('0x63')]=function(_0x4c663e,_0x496fbc){if(!_0x4c663e[_0xfd6e('0x34')]){return _0x496fbc[_0xfd6e('0x3c')](0x194)[_0xfd6e('0x3e')]({'message':_0xfd6e('0x64')});}var _0x5b40b6={'payload':{'id':_0x4c663e[_0xfd6e('0x34')]['id'],'role':_0x4c663e[_0xfd6e('0x34')][_0xfd6e('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5b40b6)[_0xfd6e('0x39')](function(_0x4d5660){_0x496fbc[_0xfd6e('0x65')](_0xfd6e('0x66'),_0x4d5660);_0x496fbc[_0xfd6e('0x67')]('/dashboards/general');})[_0xfd6e('0x41')](function(_0x470383){return _0x496fbc[_0xfd6e('0x3c')](0x1f4)[_0xfd6e('0x68')](_0x470383);});};exports[_0xfd6e('0x69')]=function(_0x8ec257){if(_[_0xfd6e('0x6a')](_0x8ec257[_0xfd6e('0x6b')])||_[_0xfd6e('0x6a')](_0x8ec257[_0xfd6e('0x6c')])){return null;}else{return createJwt(_0x8ec257);}};exports['generateApiKey']=function(_0x392980){_0x392980[_0xfd6e('0x6b')]=generateNonce();_0x392980[_0xfd6e('0x6c')]=generateIssuedAt();return createJwt(_0x392980);};exports['regenerateApiKey']=function(_0x362a42,_0x406946){var _0x534157=_0x362a42[_0xfd6e('0x4a')][_0xfd6e('0x4b')];if(_0x534157){var _0x416a45={'nonce':_0x406946[_0xfd6e('0x6b')],'iat':_0x406946['apiKeyIat'],'audience':hardwareConf[_0xfd6e('0x4c')](),'issuer':hardwareConf[_0xfd6e('0x4c')]()};return verifyJwt(_0x534157,_0x416a45)[_0xfd6e('0x39')](function(){return generateApiKey(_0x406946);});}else{throw{'message':_0xfd6e('0x6d')};}};exports[_0xfd6e('0x6e')]=function(_0x375c82){var _0x1b7640=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1b7640[_0xfd6e('0x6f')](_0x375c82))throw new db[(_0xfd6e('0x70'))][(_0xfd6e('0x71'))](_0xfd6e('0x72'));return;};exports[_0xfd6e('0x73')]=function(_0x5230b1,_0x5d0bf1,_0x5bbbc4){var _0x4ae5d6=encryptor[_0xfd6e('0x74')](_0x5d0bf1)[_0xfd6e('0x75')](',');for(var _0x535a08=0x0;_0x535a08<_0x5bbbc4;_0x535a08++){if(!_0x4ae5d6[_0x535a08])break;if(_0x5230b1[_0xfd6e('0x76')]()===_0x4ae5d6[_0x535a08][_0xfd6e('0x76')]()){var _0x5c1dd8=util[_0xfd6e('0x77')](_0xfd6e('0x78'),_0x5bbbc4);if(_0x5bbbc4===0x1){_0x5c1dd8='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize'][(_0xfd6e('0x71'))](_0x5c1dd8);}}return;};exports[_0xfd6e('0x79')]=function(_0x23e534,_0xb28e71){var _0x418aea=_0xb28e71?encryptor['decryptString'](_0xb28e71)[_0xfd6e('0x75')](','):[];if(_0x418aea['length']===0x5){_0x418aea['splice'](-0x1,0x1);}_0x418aea[_0xfd6e('0x7a')](_0x23e534);return encryptor[_0xfd6e('0x7b')](_0x418aea[_0xfd6e('0x7c')](','));};function signJwt(_0x526385){var _0x15d752=BPromise[_0xfd6e('0x7d')](jwt[_0xfd6e('0x7e')],{'context':jwt});var _0xabc9ba=_0x526385[_0xfd6e('0x7f')]||config['secrets'][_0xfd6e('0x9')];return new BPromise(function(_0x3338e1,_0x4f9142){_0x15d752(_0x526385[_0xfd6e('0x80')],_0xabc9ba,_0x526385['options'])[_0xfd6e('0x39')](function(_0x37a1c7){_0x3338e1(_0x37a1c7);})[_0xfd6e('0x41')](function(_0x2a4e4d){_0x4f9142(_0x2a4e4d);});});}function verifyJwt(_0x31e2a5,_0xca0cb7,_0x38a344){var _0x28a008=BPromise[_0xfd6e('0x7d')](jwt[_0xfd6e('0x81')],{'context':jwt});var _0x2147eb=_0x38a344||config[_0xfd6e('0x8')]['session'];return new BPromise(function(_0x5997c0,_0xc38edc){_0x28a008(_0x31e2a5,_0x2147eb,_0xca0cb7)[_0xfd6e('0x39')](function(_0x56d813){_0x5997c0(_0x56d813);})[_0xfd6e('0x41')](function(_0xd26fbf){_0xc38edc(_0xd26fbf);});});}function generateNonce(){return crypto[_0xfd6e('0x82')](0x10)[_0xfd6e('0x83')]('hex');}function generateIssuedAt(){return Math[_0xfd6e('0x84')](Date[_0xfd6e('0x85')]()/0x3e8)[_0xfd6e('0x83')]();}function createJwt(_0x179c01){var _0x1271f0={'payload':{'iat':_0x179c01[_0xfd6e('0x6c')],'nonce':_0x179c01['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x179c01['id']['toString'](),'issuer':hardwareConf[_0xfd6e('0x4c')](),'audience':hardwareConf[_0xfd6e('0x4c')]()}};return signJwt(_0x1271f0)[_0xfd6e('0x39')](function(_0x901bcb){return{'iat':_0x179c01[_0xfd6e('0x6c')],'nonce':_0x179c01[_0xfd6e('0x6b')],'token':_0x901bcb};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index b4d3f45..bc8468d 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf0f9=['clause','tags','skip','checkListsRestrictions','ids','tag','count','User','buildContactsQuery','getFilteredContacts','rows','catch','describe','CmContact','keys','startsWith','cf_','map','CmCustomField','slice','length','./sql-utils','../../mysqldb','findAll','resolve','getContactsSubquery','then','search','parseQueryParameters','default','fields','where','filter','user'];(function(_0x57862d,_0x2603ab){var _0x5e562c=function(_0x383140){while(--_0x383140){_0x57862d['push'](_0x57862d['shift']());}};_0x5e562c(++_0x2603ab);}(_0xf0f9,0x169));var _0x9f0f=function(_0x38beea,_0x29b803){_0x38beea=_0x38beea-0x0;var _0xf9b4ef=_0xf0f9[_0x38beea];return _0xf9b4ef;};'use strict';var _=require('lodash');var sqlUtils=require(_0x9f0f('0x0'));var db=require(_0x9f0f('0x1'))['db'];exports[_0x9f0f('0x2')]=function(_0x5a7cfd,_0xe94262,_0x34be92,_0x13843){var _0x5492eb={'count':0x0,'rows':[]};var _0x20b893=sqlUtils['skipContactsQuery'](_0xe94262,_0x5a7cfd);if(_0x20b893){return Promise[_0x9f0f('0x3')](_0x5492eb);}var _0x276e24=sqlUtils[_0x9f0f('0x4')]();var _0x20a43e={};var _0x21c54b=![];var _0x15389a=![];return Promise['resolve']()[_0x9f0f('0x5')](function(){if(_0x5a7cfd[_0x9f0f('0x6')]){return sqlUtils['parseAdvancedSearchFilter'](_0x5a7cfd['search'],_0x13843);}else{return sqlUtils[_0x9f0f('0x7')](_0x5a7cfd,_0x13843);}})['then'](function(_0x4fe355){_0x276e24['where'](_0x4fe355[_0x9f0f('0x8')]);_0x276e24['where'](_0x4fe355[_0x9f0f('0x9')]);_0x276e24[_0x9f0f('0xa')](_0x4fe355[_0x9f0f('0xb')]);_0x276e24[_0x9f0f('0xa')](_0x4fe355[_0x9f0f('0xc')][_0x9f0f('0xd')]);_0x20a43e=_0x4fe355[_0x9f0f('0xe')];_0x15389a=_0x4fe355[_0x9f0f('0xc')][_0x9f0f('0xf')];return sqlUtils[_0x9f0f('0x10')](_0xe94262,_0x5a7cfd,_0x15389a);})[_0x9f0f('0x5')](function(_0x524591){_0x276e24[_0x9f0f('0xa')](_0x524591);var _0x1f61ef=_0x5a7cfd[_0x9f0f('0x6')]?_0x20a43e[_0x9f0f('0x11')]:_0x5a7cfd[_0x9f0f('0x12')];_0x21c54b=_0x1f61ef?!![]:![];return sqlUtils['countFilteredContacts'](_0x276e24,_0x1f61ef);})['then'](function(_0x4e4ba0){_0x5492eb[_0x9f0f('0x13')]=_0x4e4ba0;if(_0x5492eb[_0x9f0f('0x13')]===0x0){return;}if(_0x5a7cfd[_0x9f0f('0x14')]){_0x15389a=!![];}return sqlUtils[_0x9f0f('0x15')](_0x276e24,_0x5a7cfd[_0x9f0f('0x9')],_0x34be92,_0x21c54b,_0x20a43e[_0x9f0f('0xd')],_0x15389a);})[_0x9f0f('0x5')](function(_0x1c60cb){if(!_0x1c60cb){return[];}return sqlUtils[_0x9f0f('0x16')](_0x1c60cb,_0x5a7cfd,_0x34be92);})[_0x9f0f('0x5')](function(_0x212dab){_0x5492eb[_0x9f0f('0x17')]=_0x212dab;return _0x5492eb;})[_0x9f0f('0x18')](function(_0x190eaf){throw _0x190eaf;});};exports[_0x9f0f('0x19')]=function(){var _0x1ad87a={};var _0x53ea6e=[];return db[_0x9f0f('0x1a')][_0x9f0f('0x19')]()[_0x9f0f('0x5')](function(_0x26dbbd){_0x1ad87a=_0x26dbbd;var _0x394456=Object[_0x9f0f('0x1b')](_0x1ad87a)[_0x9f0f('0xb')](function(_0x3e7e20){return _[_0x9f0f('0x1c')](_0x3e7e20,_0x9f0f('0x1d'))?_0x3e7e20:undefined;});var _0x264d2a=_0x394456[_0x9f0f('0x1e')](function(_0x50b8e1){return db[_0x9f0f('0x1f')]['findOne']({'where':{'id':_0x50b8e1[_0x9f0f('0x20')](0x3)},'raw':!![]});});return Promise['all'](_0x264d2a);})[_0x9f0f('0x5')](function(_0x4d539e){for(var _0x392d70=0x0;_0x392d70<_0x4d539e[_0x9f0f('0x21')];_0x392d70++){if(_0x4d539e[_0x392d70]){var _0x10748f='cf_'+_0x4d539e[_0x392d70]['id'];_0x1ad87a[_0x10748f]['fieldType']=_0x4d539e[_0x392d70]['type'];}}_0x53ea6e=_['map'](Object[_0x9f0f('0x1b')](_0x1ad87a),function(_0x4b013e){return{'name':_0x4b013e,'type':_0x1ad87a[_0x4b013e]['type']};});return _0x53ea6e;})[_0x9f0f('0x18')](function(_0x4d78a6){throw _0x4d78a6;});}; \ No newline at end of file +var _0xeba7=['lodash','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','user','tags','skip','checkListsRestrictions','ids','tag','countFilteredContacts','User','buildContactsQuery','fields','getFilteredContacts','rows','catch','CmContact','describe','keys','filter','cf_','map','CmCustomField','findOne','slice','all','length','fieldType','type'];(function(_0x261d05,_0x48cbb2){var _0x2684cd=function(_0xd47565){while(--_0xd47565){_0x261d05['push'](_0x261d05['shift']());}};_0x2684cd(++_0x48cbb2);}(_0xeba7,0x1e1));var _0x7eba=function(_0x526f57,_0x3949e5){_0x526f57=_0x526f57-0x0;var _0x2f8a22=_0xeba7[_0x526f57];return _0x2f8a22;};'use strict';var _=require(_0x7eba('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0x7eba('0x1'))['db'];exports[_0x7eba('0x2')]=function(_0x4ee6f4,_0x1a3260,_0x16c568,_0x193918){var _0x211469={'count':0x0,'rows':[]};var _0x353245=sqlUtils[_0x7eba('0x3')](_0x1a3260,_0x4ee6f4);if(_0x353245){return Promise[_0x7eba('0x4')](_0x211469);}var _0x13de34=sqlUtils[_0x7eba('0x5')]();var _0x1013b8={};var _0x12fc32=![];var _0x3afb8b=![];return Promise[_0x7eba('0x4')]()[_0x7eba('0x6')](function(){if(_0x4ee6f4[_0x7eba('0x7')]){return sqlUtils[_0x7eba('0x8')](_0x4ee6f4[_0x7eba('0x7')],_0x193918);}else{return sqlUtils[_0x7eba('0x9')](_0x4ee6f4,_0x193918);}})[_0x7eba('0x6')](function(_0x6803be){_0x13de34[_0x7eba('0xa')](_0x6803be['default']);_0x13de34[_0x7eba('0xa')](_0x6803be['fields']);_0x13de34[_0x7eba('0xa')](_0x6803be['filter']);_0x13de34['where'](_0x6803be[_0x7eba('0xb')]['clause']);_0x1013b8=_0x6803be[_0x7eba('0xc')];_0x3afb8b=_0x6803be[_0x7eba('0xb')][_0x7eba('0xd')];return sqlUtils[_0x7eba('0xe')](_0x1a3260,_0x4ee6f4,_0x3afb8b);})['then'](function(_0x4fdf68){_0x13de34['where'](_0x4fdf68);var _0x200fa7=_0x4ee6f4['search']?_0x1013b8[_0x7eba('0xf')]:_0x4ee6f4[_0x7eba('0x10')];_0x12fc32=_0x200fa7?!![]:![];return sqlUtils[_0x7eba('0x11')](_0x13de34,_0x200fa7);})[_0x7eba('0x6')](function(_0x89f991){_0x211469['count']=_0x89f991;if(_0x211469['count']===0x0){return;}if(_0x4ee6f4[_0x7eba('0x12')]){_0x3afb8b=!![];}return sqlUtils[_0x7eba('0x13')](_0x13de34,_0x4ee6f4[_0x7eba('0x14')],_0x16c568,_0x12fc32,_0x1013b8['clause'],_0x3afb8b);})[_0x7eba('0x6')](function(_0x48a6bf){if(!_0x48a6bf){return[];}return sqlUtils[_0x7eba('0x15')](_0x48a6bf,_0x4ee6f4,_0x16c568);})[_0x7eba('0x6')](function(_0x582226){_0x211469[_0x7eba('0x16')]=_0x582226;return _0x211469;})[_0x7eba('0x17')](function(_0x2bce58){throw _0x2bce58;});};exports['describe']=function(){var _0x43a51f={};var _0x494e32=[];return db[_0x7eba('0x18')][_0x7eba('0x19')]()[_0x7eba('0x6')](function(_0x552b7e){_0x43a51f=_0x552b7e;var _0x901c33=Object[_0x7eba('0x1a')](_0x43a51f)[_0x7eba('0x1b')](function(_0x3fe00e){return _['startsWith'](_0x3fe00e,_0x7eba('0x1c'))?_0x3fe00e:undefined;});var _0x15065c=_0x901c33[_0x7eba('0x1d')](function(_0x35bf62){return db[_0x7eba('0x1e')][_0x7eba('0x1f')]({'where':{'id':_0x35bf62[_0x7eba('0x20')](0x3)},'raw':!![]});});return Promise[_0x7eba('0x21')](_0x15065c);})[_0x7eba('0x6')](function(_0x5c96e3){for(var _0x284a83=0x0;_0x284a83<_0x5c96e3[_0x7eba('0x22')];_0x284a83++){if(_0x5c96e3[_0x284a83]){var _0x2d4332=_0x7eba('0x1c')+_0x5c96e3[_0x284a83]['id'];_0x43a51f[_0x2d4332][_0x7eba('0x23')]=_0x5c96e3[_0x284a83][_0x7eba('0x24')];}}_0x494e32=_[_0x7eba('0x1d')](Object[_0x7eba('0x1a')](_0x43a51f),function(_0x3f2d0d){return{'name':_0x3f2d0d,'type':_0x43a51f[_0x3f2d0d][_0x7eba('0x24')]};});return _0x494e32;})[_0x7eba('0x17')](function(_0x4c01b2){throw _0x4c01b2;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 02267df..55344bf 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe1fc=['sqlOperator','conditions','find','dateOfBirth','fieldType','castTo','DATE','buildExpression','type','default','text','start','value','end','Tag','tags','User','and','uc.UserId\x20=\x20?','user','keys','map','some','name','compact','Contact','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','tag','clause','filter','c.ListId\x20IS\x20NULL','attributes','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','color','keyBy','Sequelize','QueryTypes','CmContact','query','toString','Tags','clone','COUNT(*)','group','c.id','getSelectedTags','t.id\x20IN\x20?','exports','squel','../parsers/qs','../interaction/utils','role','agent','search','ListId','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','ct.CmContactId\x20=\x20','.id','tools_tags','firstName','lastName','phone','mobile','fax','email','CompanyId','updatedAt','deletedAt','TagIds','push','forEach','field','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','escapeLIKESpecialChars','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xe1fc,0x1eb));var _0xce1f=function(_0x422be2,_0x1c439e){_0x422be2=_0x422be2-0x0;var _0x1b820e=_0xe1fc[_0x422be2];return _0x1b820e;};'use strict';var _=require('lodash');var squel=require(_0xce1f('0x0'));var as=require('../parsers/advancedSearch');var qs=require(_0xce1f('0x1'));var utils=require(_0xce1f('0x2'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x4d68c3,_0x49f1b4){var _0x5cb25c=![];if(_0x4d68c3[_0xce1f('0x3')]===_0xce1f('0x4')&&!_0x49f1b4[_0xce1f('0x5')]&&!_0x49f1b4[_0xce1f('0x6')]&&_0x49f1b4['autocomplete']!==_0xce1f('0x7')){_0x5cb25c=!![];}return _0x5cb25c;}function getContactsSubquery(){return squel[_0xce1f('0x8')]()[_0xce1f('0x9')](_0xce1f('0xa'),'c')[_0xce1f('0xb')](_0xce1f('0xc'));}function applyJoinClauses(_0x1338b1,_0x5eccc1){var _0x387c0d=_0x5eccc1?'c':_0xce1f('0xd');_0x1338b1[_0xce1f('0xe')](_0xce1f('0xf'),'uc',_0xce1f('0x10')+_0x387c0d+'.id')[_0xce1f('0xe')]('cm_contact_has_tags','ct',_0xce1f('0x11')+_0x387c0d+_0xce1f('0x12'))[_0xce1f('0xe')](_0xce1f('0x13'),'t','t.id\x20=\x20ct.TagId');return _0x1338b1;}function addFieldsToQuery(_0x5b010a,_0x3b2d81,_0x16cada,_0x321cff,_0x500112){var _0x283246=_0x500112?'c':_0xce1f('0xd');if(!_0x3b2d81){_0x3b2d81=['id',_0xce1f('0x14'),_0xce1f('0x15'),_0xce1f('0x16'),_0xce1f('0x17'),_0xce1f('0x18'),_0xce1f('0x19'),_0xce1f('0x6'),_0xce1f('0x1a'),'createdAt',_0xce1f('0x1b'),_0xce1f('0x1c'),_0xce1f('0x1d')];}else if(!_0x3b2d81['includes']('id')){_0x3b2d81[_0xce1f('0x1e')]('id');}var _0x4b477f=_0x16cada&&_0x500112||!_0x16cada&&!_0x500112;if(_0x321cff){_0x4b477f=_0x321cff&&_0x500112||!_0x321cff&&!_0x500112;}_0x3b2d81[_0xce1f('0x1f')](function(_0x303e77){if(_0x303e77===_0xce1f('0x1d')){if(_0x4b477f){_0x5b010a[_0xce1f('0x20')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x303e77);}else if(_0x16cada||_0x321cff){_0x5b010a['field'](_0x283246+'.'+_0x303e77);}}else{_0x5b010a[_0xce1f('0x20')](_0x283246+'.'+_0x303e77);}});return _0x5b010a;}function getSqlClauses(){var _0x11ab81={'default':squel[_0xce1f('0x21')](),'fields':squel[_0xce1f('0x21')](),'filter':squel[_0xce1f('0x21')](),'tags':{'clause':squel[_0xce1f('0x21')](),'ids':null},'user':{'clause':squel[_0xce1f('0x21')](),'skip':![]}};return _0x11ab81;}function parseTagParameter(_0x377c09){var _0x531677=squel[_0xce1f('0x21')]();if(_0x377c09){var _0x21955a=utils['getSelectedTags'](_0x377c09);_0x21955a[_0xce1f('0x1f')](function(_0x2f72cd){_0x531677['or'](_0xce1f('0x22'),'%,'+_0x2f72cd+',%');});}return _0x531677;}function parseSearchFilter(_0x2832e5){var _0x31c891=squel[_0xce1f('0x21')]();if(_0x2832e5){var _0x1a28b6=_0x2832e5[_0xce1f('0x23')]('\x5c','\x5c\x5c')[_0xce1f('0x23')](/'/g,'\x27\x27');var _0x3b372=qs[_0xce1f('0x24')](_0x1a28b6);if(_0x1a28b6[_0xce1f('0x25')]('\x20')[_0xce1f('0x26')]>0x1){_0x31c891['or'](_0xce1f('0x27'),qs['getFullTextValue'](_0x1a28b6,!![]),null);}else{if(qs[_0xce1f('0x28')](_0x1a28b6)){_0x31c891['or'](_0xce1f('0x29'),_0x3b372+'%');_0x31c891['or'](_0xce1f('0x2a'),_0x3b372+'%');_0x31c891['or'](_0xce1f('0x2b'),_0x3b372+'%');_0x31c891['or'](_0xce1f('0x2c'),_0x3b372+'%');}else if(qs[_0xce1f('0x2d')](_0x1a28b6)){_0x31c891['or']('c.email\x20LIKE\x20?',_0x3b372+'%');}else{_0x31c891['or'](_0xce1f('0x2e'),'%'+_0x3b372+'%');_0x31c891['or']('c.lastName\x20LIKE\x20?','%'+_0x3b372+'%');_0x31c891['or'](_0xce1f('0x2f'),'%'+_0x3b372+'%');}}}return _0x31c891;}function parseAdvancedSearchFilter(_0x12adc5,_0x1f8c85){var _0x2b99ed=getSqlClauses();var _0x5d6228=as[_0xce1f('0x30')](_0x12adc5);var _0x2065f5=_0x5d6228[_0xce1f('0x31')];for(var _0x25dfe4=0x0;_0x25dfe4<_0x5d6228[_0xce1f('0x32')][_0xce1f('0x26')];_0x25dfe4++){var _0x4b04b9=_0x5d6228['conditions'][_0x25dfe4];var _0x2bfe3f='c';var _0x3bb22c=_[_0xce1f('0x33')](_0x1f8c85,['name',_0x4b04b9[_0xce1f('0x20')]]);if(_0x3bb22c){if(_0x4b04b9['field']===_0xce1f('0x34')||_0x3bb22c[_0xce1f('0x35')]==='datetime'){_0x4b04b9[_0xce1f('0x36')]=_0xce1f('0x37');}var _0x3a4152=as[_0xce1f('0x38')](_0x2bfe3f,_0x3bb22c[_0xce1f('0x39')],_0x4b04b9);_0x2b99ed[_0xce1f('0x3a')][_0x2065f5](_0x3a4152[_0xce1f('0x3b')],_0x3a4152['value'][_0xce1f('0x3c')],_0x3a4152[_0xce1f('0x3d')][_0xce1f('0x3e')]);}else{if(_0x4b04b9[_0xce1f('0x20')]===_0xce1f('0x3f')){var _0x1d8b4b=_0x4b04b9[_0xce1f('0x3d')]['split'](',')['map'](function(_0x47adae){return Number(_0x47adae);});var _0x21ef04=parseTagParameter(_0x1d8b4b);_0x2b99ed[_0xce1f('0x40')]['clause']['and'](_0x21ef04);_0x2b99ed[_0xce1f('0x40')]['ids']=_0x1d8b4b;}else if(_0x4b04b9[_0xce1f('0x20')]===_0xce1f('0x41')){_0x2b99ed['user']['clause'][_0xce1f('0x42')](_0xce1f('0x43'),_0x4b04b9[_0xce1f('0x3d')]);_0x2b99ed[_0xce1f('0x44')]['skip']=!![];}}}return _0x2b99ed;}function parseModelFields(_0x27edb4,_0x56372e){var _0x346902=squel[_0xce1f('0x21')]();var _0x4d747a=_(_0x27edb4)[_0xce1f('0x45')]()[_0xce1f('0x46')](function(_0x26ee5d){return _[_0xce1f('0x47')](_0x56372e,[_0xce1f('0x48'),_0x26ee5d])?_0x26ee5d:undefined;})[_0xce1f('0x49')]()[_0xce1f('0x3d')]();if(_0x27edb4[_0xce1f('0x4a')]){_0x4d747a[_0xce1f('0x1e')]('Contact');}if(_0x27edb4[_0xce1f('0x41')]){_0x4d747a[_0xce1f('0x1e')](_0xce1f('0x41'));}if(_0x4d747a[_0xce1f('0x26')]>0x0){_0x4d747a['forEach'](function(_0x5685f2){if(_0x5685f2===_0xce1f('0x6')){_0x346902[_0xce1f('0x42')]('c.ListId\x20IN\x20?',[][_0xce1f('0x4b')](_0x27edb4[_0x5685f2]));}else if(_0x5685f2===_0xce1f('0x4a')){var _0x6b31='%'+_0x27edb4[_0x5685f2]+'%';_0x346902['and'](_0xce1f('0x4c'),_0x6b31);}else if(_0x5685f2===_0xce1f('0x41')){_0x346902[_0xce1f('0x42')]('uc.UserId\x20=\x20?',_0x27edb4[_0x5685f2]);}else{_0x346902['and']('c.'+_0x5685f2+_0xce1f('0x4d'),_0x27edb4[_0x5685f2]);}});}return _0x346902;}function parseQueryParameters(_0x2f2cd9,_0x519dc9){var _0x33fa2d=getSqlClauses();return Promise[_0xce1f('0x4e')]()['then'](function(){return parseModelFields(_0x2f2cd9,_0x519dc9);})[_0xce1f('0x4f')](function(_0x44155e){_0x33fa2d['fields'][_0xce1f('0x42')](_0x44155e);return parseTagParameter(_0x2f2cd9[_0xce1f('0x50')]);})[_0xce1f('0x4f')](function(_0x21fe8c){_0x33fa2d[_0xce1f('0x40')][_0xce1f('0x51')]['and'](_0x21fe8c);return parseSearchFilter(_0x2f2cd9[_0xce1f('0x52')]);})[_0xce1f('0x4f')](function(_0x46c2c6){_0x33fa2d[_0xce1f('0x52')]=_0x46c2c6;return _0x33fa2d;});}function checkListsRestrictions(_0x2ee28c,_0x13d545,_0x3d79cd){var _0x54f3a7=squel[_0xce1f('0x21')]();return Promise['resolve']()['then'](function(){if(_0x13d545[_0xce1f('0x5')]&&_0x2ee28c[_0xce1f('0x3')]===_0xce1f('0x4')&&!_0x3d79cd){return _0x2ee28c['getLists']({'attributes':['id'],'raw':!![]});}})[_0xce1f('0x4f')](function(_0x27a472){if(_0x27a472){if(_0x27a472['length']===0x0){_0x54f3a7[_0xce1f('0x42')](_0xce1f('0x53'));}else{_0x54f3a7['and']('c.ListId\x20IN\x20?',_[_0xce1f('0x46')](_0x27a472,'id'));}}})['then'](function(){return _0x54f3a7;});}function buildContactsQuery(_0x36c504,_0x529e47,_0x3caa63,_0x1dcc3c,_0x5ba430,_0x523570){if(_0x529e47){_0x529e47=_0x3caa63[_0xce1f('0x54')];}_0x36c504=addFieldsToQuery(_0x36c504,_0x529e47,_0x1dcc3c,_0x523570,!![]);var _0x10a571=squel[_0xce1f('0x8')]();_0x10a571=addFieldsToQuery(_0x10a571,_0x529e47,_0x1dcc3c,_0x523570,![]);if(_0x1dcc3c||_0x523570){_0x36c504=applyJoinClauses(_0x36c504,!![]);_0x36c504['group']('c.id');if(_0x3caa63['limit']){_0x10a571[_0xce1f('0x55')](_0x3caa63['limit']);}if(_0x3caa63[_0xce1f('0x56')]){_0x10a571[_0xce1f('0x56')](_0x3caa63[_0xce1f('0x56')]);}}else{_0x10a571=applyJoinClauses(_0x10a571,![]);_0x10a571['group'](_0xce1f('0x57'));if(_0x3caa63[_0xce1f('0x55')]){_0x36c504[_0xce1f('0x55')](_0x3caa63['limit']);}if(_0x3caa63[_0xce1f('0x56')]){_0x36c504['offset'](_0x3caa63[_0xce1f('0x56')]);}}_0x10a571[_0xce1f('0x58')](_0x5ba430);if(_0x3caa63[_0xce1f('0x59')]){_0x3caa63['order'][_0xce1f('0x1f')](function(_0x5a6bb4){_0x36c504[_0xce1f('0x59')]('c.'+_0x5a6bb4[0x0],_0x5a6bb4[0x1]===_0xce1f('0x5a')?![]:!![]);_0x10a571[_0xce1f('0x59')](_0xce1f('0x5b')+_0x5a6bb4[0x0],_0x5a6bb4[0x1]===_0xce1f('0x5a')?![]:!![]);});}_0x10a571[_0xce1f('0x9')](_0x36c504,_0xce1f('0xd'));return _0x10a571;}function getFilteredContacts(_0x4b2b2d){var _0x2ec180=[];return db['Tag'][_0xce1f('0x5c')]({'attributes':['id',_0xce1f('0x48'),_0xce1f('0x5d')],'raw':!![]})['then'](function(_0x498bc7){_0x2ec180=_[_0xce1f('0x5e')](_0x498bc7,'id');var _0x809b2f={'type':db[_0xce1f('0x5f')][_0xce1f('0x60')]['SELECT'],'model':db[_0xce1f('0x61')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0xce1f('0x62')](_0x4b2b2d[_0xce1f('0x63')](),_0x809b2f);})[_0xce1f('0x4f')](function(_0x19f127){_0x19f127[_0xce1f('0x1f')](function(_0x435ef4){if(_0x435ef4[_0xce1f('0x1d')]){_0x435ef4[_0xce1f('0x64')]=[];_0x435ef4[_0xce1f('0x1d')][_0xce1f('0x25')](',')[_0xce1f('0x1f')](function(_0x2d2d6e){_0x435ef4[_0xce1f('0x64')][_0xce1f('0x1e')](_0x2ec180[_0x2d2d6e]);});}delete _0x435ef4[_0xce1f('0x1d')];});return _0x19f127;});}function countFilteredContacts(_0x45c1b9,_0x52720b){var _0x1f60ee=_0x45c1b9[_0xce1f('0x65')]();_0x1f60ee[_0xce1f('0x20')](_0xce1f('0x66'));_0x1f60ee=applyJoinClauses(_0x1f60ee,!![]);_0x45c1b9[_0xce1f('0x67')](_0xce1f('0x68'));var _0x229fd1=utils[_0xce1f('0x69')](_0x52720b);if(!_['isEmpty'](_0x229fd1)){_0x1f60ee[_0xce1f('0xb')](_0xce1f('0x6a'),_0x229fd1);}var _0x2cd762={'type':db[_0xce1f('0x5f')]['QueryTypes']['SELECT'],'raw':!![]};return db['sequelize']['query'](_0x1f60ee['toString'](),_0x2cd762)[_0xce1f('0x4f')](function(_0x4af865){return _0x4af865[0x0][_0xce1f('0x66')];});}module[_0xce1f('0x6b')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x891c=['SELECT','CmContact','sequelize','query','Tags','clone','COUNT(*)','getSelectedTags','isEmpty','t.id\x20IN\x20?','Sequelize','toString','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','agent','ListId','true','from','cm_contacts','where','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','CompanyId','createdAt','deletedAt','TagIds','forEach','field','expr','replace','escapeLIKESpecialChars','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','buildExpression','default','text','value','start','end','Tag','map','tags','clause','and','ids','uc.UserId\x20=\x20?','user','skip','keys','some','compact','push','Contact','User','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','search','role','getLists','c.ListId\x20IS\x20NULL','attributes','select','group','c.id','limit','offset','order','DESC','findAll','color','keyBy','QueryTypes'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x891c,0x1cc));var _0xc891=function(_0x56fcd0,_0x1aa69f){_0x56fcd0=_0x56fcd0-0x0;var _0x3bbb8d=_0x891c[_0x56fcd0];return _0x3bbb8d;};'use strict';var _=require(_0xc891('0x0'));var squel=require(_0xc891('0x1'));var as=require(_0xc891('0x2'));var qs=require(_0xc891('0x3'));var utils=require(_0xc891('0x4'));var db=require(_0xc891('0x5'))['db'];function skipContactsQuery(_0x39fa07,_0x383fca){var _0x5b41ff=![];if(_0x39fa07['role']===_0xc891('0x6')&&!_0x383fca['search']&&!_0x383fca[_0xc891('0x7')]&&_0x383fca['autocomplete']!==_0xc891('0x8')){_0x5b41ff=!![];}return _0x5b41ff;}function getContactsSubquery(){return squel['select']()[_0xc891('0x9')](_0xc891('0xa'),'c')[_0xc891('0xb')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x1dc523,_0x2cbe44){var _0x53b8cb=_0x2cbe44?'c':_0xc891('0xc');_0x1dc523[_0xc891('0xd')](_0xc891('0xe'),'uc',_0xc891('0xf')+_0x53b8cb+_0xc891('0x10'))[_0xc891('0xd')](_0xc891('0x11'),'ct',_0xc891('0x12')+_0x53b8cb+_0xc891('0x10'))[_0xc891('0xd')](_0xc891('0x13'),'t',_0xc891('0x14'));return _0x1dc523;}function addFieldsToQuery(_0x120ac4,_0x230358,_0x3907ea,_0x148ae7,_0x35e802){var _0x544568=_0x35e802?'c':_0xc891('0xc');if(!_0x230358){_0x230358=['id',_0xc891('0x15'),_0xc891('0x16'),_0xc891('0x17'),_0xc891('0x18'),_0xc891('0x19'),'email',_0xc891('0x7'),_0xc891('0x1a'),_0xc891('0x1b'),'updatedAt',_0xc891('0x1c'),_0xc891('0x1d')];}else if(!_0x230358['includes']('id')){_0x230358['push']('id');}var _0x596292=_0x3907ea&&_0x35e802||!_0x3907ea&&!_0x35e802;if(_0x148ae7){_0x596292=_0x148ae7&&_0x35e802||!_0x148ae7&&!_0x35e802;}_0x230358[_0xc891('0x1e')](function(_0x241bcf){if(_0x241bcf===_0xc891('0x1d')){if(_0x596292){_0x120ac4[_0xc891('0x1f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x241bcf);}else if(_0x3907ea||_0x148ae7){_0x120ac4[_0xc891('0x1f')](_0x544568+'.'+_0x241bcf);}}else{_0x120ac4['field'](_0x544568+'.'+_0x241bcf);}});return _0x120ac4;}function getSqlClauses(){var _0x209b12={'default':squel[_0xc891('0x20')](),'fields':squel['expr'](),'filter':squel['expr'](),'tags':{'clause':squel[_0xc891('0x20')](),'ids':null},'user':{'clause':squel[_0xc891('0x20')](),'skip':![]}};return _0x209b12;}function parseTagParameter(_0x22b9ba){var _0x3dbba8=squel[_0xc891('0x20')]();if(_0x22b9ba){var _0xdeba5d=utils['getSelectedTags'](_0x22b9ba);_0xdeba5d['forEach'](function(_0x32a316){_0x3dbba8['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x32a316+',%');});}return _0x3dbba8;}function parseSearchFilter(_0x2e91d6){var _0x141b04=squel[_0xc891('0x20')]();if(_0x2e91d6){var _0x3b9114=_0x2e91d6[_0xc891('0x21')]('\x5c','\x5c\x5c')[_0xc891('0x21')](/'/g,'\x27\x27');var _0x2684b1=qs[_0xc891('0x22')](_0x3b9114);if(_0x3b9114[_0xc891('0x23')]('\x20')[_0xc891('0x24')]>0x1){_0x141b04['or'](_0xc891('0x25'),qs[_0xc891('0x26')](_0x3b9114,!![]),null);}else{if(qs[_0xc891('0x27')](_0x3b9114)){_0x141b04['or'](_0xc891('0x28'),_0x2684b1+'%');_0x141b04['or']('c.phone\x20LIKE\x20?',_0x2684b1+'%');_0x141b04['or'](_0xc891('0x29'),_0x2684b1+'%');_0x141b04['or'](_0xc891('0x2a'),_0x2684b1+'%');}else if(qs['isEmail'](_0x3b9114)){_0x141b04['or'](_0xc891('0x2b'),_0x2684b1+'%');}else{_0x141b04['or'](_0xc891('0x2c'),'%'+_0x2684b1+'%');_0x141b04['or'](_0xc891('0x2d'),'%'+_0x2684b1+'%');_0x141b04['or'](_0xc891('0x2b'),'%'+_0x2684b1+'%');}}}return _0x141b04;}function parseAdvancedSearchFilter(_0x279bf2,_0x17321a){var _0x41f4cd=getSqlClauses();var _0x21b1a9=as[_0xc891('0x2e')](_0x279bf2);var _0x3db2d6=_0x21b1a9[_0xc891('0x2f')];for(var _0xe61da9=0x0;_0xe61da9<_0x21b1a9[_0xc891('0x30')][_0xc891('0x24')];_0xe61da9++){var _0x387e88=_0x21b1a9['conditions'][_0xe61da9];var _0x47f29d='c';var _0x34a0d6=_[_0xc891('0x31')](_0x17321a,[_0xc891('0x32'),_0x387e88[_0xc891('0x1f')]]);if(_0x34a0d6){if(_0x387e88[_0xc891('0x1f')]===_0xc891('0x33')||_0x34a0d6[_0xc891('0x34')]===_0xc891('0x35')){_0x387e88[_0xc891('0x36')]='DATE';}var _0x1ed6c6=as[_0xc891('0x37')](_0x47f29d,_0x34a0d6['type'],_0x387e88);_0x41f4cd[_0xc891('0x38')][_0x3db2d6](_0x1ed6c6[_0xc891('0x39')],_0x1ed6c6[_0xc891('0x3a')][_0xc891('0x3b')],_0x1ed6c6[_0xc891('0x3a')][_0xc891('0x3c')]);}else{if(_0x387e88[_0xc891('0x1f')]===_0xc891('0x3d')){var _0x176c34=_0x387e88[_0xc891('0x3a')]['split'](',')[_0xc891('0x3e')](function(_0x45e46b){return Number(_0x45e46b);});var _0x47a8e7=parseTagParameter(_0x176c34);_0x41f4cd[_0xc891('0x3f')][_0xc891('0x40')][_0xc891('0x41')](_0x47a8e7);_0x41f4cd[_0xc891('0x3f')][_0xc891('0x42')]=_0x176c34;}else if(_0x387e88[_0xc891('0x1f')]==='User'){_0x41f4cd['user'][_0xc891('0x40')][_0xc891('0x41')](_0xc891('0x43'),_0x387e88[_0xc891('0x3a')]);_0x41f4cd[_0xc891('0x44')][_0xc891('0x45')]=!![];}}}return _0x41f4cd;}function parseModelFields(_0x3a50d1,_0x3c3b2e){var _0x5a65c4=squel[_0xc891('0x20')]();var _0x2b78c7=_(_0x3a50d1)[_0xc891('0x46')]()[_0xc891('0x3e')](function(_0x203433){return _[_0xc891('0x47')](_0x3c3b2e,[_0xc891('0x32'),_0x203433])?_0x203433:undefined;})[_0xc891('0x48')]()[_0xc891('0x3a')]();if(_0x3a50d1['Contact']){_0x2b78c7[_0xc891('0x49')](_0xc891('0x4a'));}if(_0x3a50d1[_0xc891('0x4b')]){_0x2b78c7[_0xc891('0x49')](_0xc891('0x4b'));}if(_0x2b78c7[_0xc891('0x24')]>0x0){_0x2b78c7[_0xc891('0x1e')](function(_0x49fb7b){if(_0x49fb7b===_0xc891('0x7')){_0x5a65c4[_0xc891('0x41')](_0xc891('0x4c'),[]['concat'](_0x3a50d1[_0x49fb7b]));}else if(_0x49fb7b===_0xc891('0x4a')){var _0xa2451='%'+_0x3a50d1[_0x49fb7b]+'%';_0x5a65c4[_0xc891('0x41')](_0xc891('0x4d'),_0xa2451);}else if(_0x49fb7b===_0xc891('0x4b')){_0x5a65c4[_0xc891('0x41')](_0xc891('0x43'),_0x3a50d1[_0x49fb7b]);}else{_0x5a65c4[_0xc891('0x41')]('c.'+_0x49fb7b+_0xc891('0x4e'),_0x3a50d1[_0x49fb7b]);}});}return _0x5a65c4;}function parseQueryParameters(_0x5ee9f1,_0x4cc925){var _0x2a1808=getSqlClauses();return Promise[_0xc891('0x4f')]()[_0xc891('0x50')](function(){return parseModelFields(_0x5ee9f1,_0x4cc925);})[_0xc891('0x50')](function(_0x31e774){_0x2a1808[_0xc891('0x51')][_0xc891('0x41')](_0x31e774);return parseTagParameter(_0x5ee9f1[_0xc891('0x52')]);})['then'](function(_0x557214){_0x2a1808[_0xc891('0x3f')]['clause'][_0xc891('0x41')](_0x557214);return parseSearchFilter(_0x5ee9f1[_0xc891('0x53')]);})['then'](function(_0x1573f4){_0x2a1808[_0xc891('0x53')]=_0x1573f4;return _0x2a1808;});}function checkListsRestrictions(_0x500c11,_0x419bb1,_0x53decb){var _0x44ca5d=squel[_0xc891('0x20')]();return Promise['resolve']()[_0xc891('0x50')](function(){if(_0x419bb1[_0xc891('0x54')]&&_0x500c11[_0xc891('0x55')]===_0xc891('0x6')&&!_0x53decb){return _0x500c11[_0xc891('0x56')]({'attributes':['id'],'raw':!![]});}})[_0xc891('0x50')](function(_0x47a471){if(_0x47a471){if(_0x47a471[_0xc891('0x24')]===0x0){_0x44ca5d['and'](_0xc891('0x57'));}else{_0x44ca5d['and']('c.ListId\x20IN\x20?',_[_0xc891('0x3e')](_0x47a471,'id'));}}})[_0xc891('0x50')](function(){return _0x44ca5d;});}function buildContactsQuery(_0x1e4e61,_0x2ed08a,_0x2ebb20,_0x120620,_0x1ec950,_0x508384){if(_0x2ed08a){_0x2ed08a=_0x2ebb20[_0xc891('0x58')];}_0x1e4e61=addFieldsToQuery(_0x1e4e61,_0x2ed08a,_0x120620,_0x508384,!![]);var _0x2b19e2=squel[_0xc891('0x59')]();_0x2b19e2=addFieldsToQuery(_0x2b19e2,_0x2ed08a,_0x120620,_0x508384,![]);if(_0x120620||_0x508384){_0x1e4e61=applyJoinClauses(_0x1e4e61,!![]);_0x1e4e61[_0xc891('0x5a')](_0xc891('0x5b'));if(_0x2ebb20[_0xc891('0x5c')]){_0x2b19e2[_0xc891('0x5c')](_0x2ebb20[_0xc891('0x5c')]);}if(_0x2ebb20['offset']){_0x2b19e2[_0xc891('0x5d')](_0x2ebb20[_0xc891('0x5d')]);}}else{_0x2b19e2=applyJoinClauses(_0x2b19e2,![]);_0x2b19e2[_0xc891('0x5a')]('subqry.id');if(_0x2ebb20[_0xc891('0x5c')]){_0x1e4e61[_0xc891('0x5c')](_0x2ebb20[_0xc891('0x5c')]);}if(_0x2ebb20[_0xc891('0x5d')]){_0x1e4e61[_0xc891('0x5d')](_0x2ebb20[_0xc891('0x5d')]);}}_0x2b19e2['having'](_0x1ec950);if(_0x2ebb20[_0xc891('0x5e')]){_0x2ebb20[_0xc891('0x5e')][_0xc891('0x1e')](function(_0x43c9c4){_0x1e4e61[_0xc891('0x5e')]('c.'+_0x43c9c4[0x0],_0x43c9c4[0x1]===_0xc891('0x5f')?![]:!![]);_0x2b19e2[_0xc891('0x5e')]('subqry.'+_0x43c9c4[0x0],_0x43c9c4[0x1]===_0xc891('0x5f')?![]:!![]);});}_0x2b19e2[_0xc891('0x9')](_0x1e4e61,_0xc891('0xc'));return _0x2b19e2;}function getFilteredContacts(_0x56ac92){var _0xa26d3e=[];return db[_0xc891('0x3d')][_0xc891('0x60')]({'attributes':['id',_0xc891('0x32'),_0xc891('0x61')],'raw':!![]})['then'](function(_0x3220a7){_0xa26d3e=_[_0xc891('0x62')](_0x3220a7,'id');var _0x4bc4d8={'type':db['Sequelize'][_0xc891('0x63')][_0xc891('0x64')],'model':db[_0xc891('0x65')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xc891('0x66')][_0xc891('0x67')](_0x56ac92['toString'](),_0x4bc4d8);})[_0xc891('0x50')](function(_0xee0310){_0xee0310[_0xc891('0x1e')](function(_0x1fd92a){if(_0x1fd92a['TagIds']){_0x1fd92a[_0xc891('0x68')]=[];_0x1fd92a[_0xc891('0x1d')][_0xc891('0x23')](',')[_0xc891('0x1e')](function(_0x4fc025){_0x1fd92a[_0xc891('0x68')][_0xc891('0x49')](_0xa26d3e[_0x4fc025]);});}delete _0x1fd92a['TagIds'];});return _0xee0310;});}function countFilteredContacts(_0x1c9da2,_0x1e3f20){var _0x88468a=_0x1c9da2[_0xc891('0x69')]();_0x88468a[_0xc891('0x1f')](_0xc891('0x6a'));_0x88468a=applyJoinClauses(_0x88468a,!![]);_0x1c9da2[_0xc891('0x5a')]('c.id');var _0x4a5bd3=utils[_0xc891('0x6b')](_0x1e3f20);if(!_[_0xc891('0x6c')](_0x4a5bd3)){_0x88468a[_0xc891('0xb')](_0xc891('0x6d'),_0x4a5bd3);}var _0x115ac5={'type':db[_0xc891('0x6e')][_0xc891('0x63')]['SELECT'],'raw':!![]};return db[_0xc891('0x66')][_0xc891('0x67')](_0x88468a[_0xc891('0x6f')](),_0x115ac5)[_0xc891('0x50')](function(_0x151c98){return _0x151c98[0x0][_0xc891('0x6a')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 995f366..ec3d925 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 _0x1858=['createReadStream','createWriteStream','createCipher','data','update','binary','write','end','final','unlink','decryptFile','close','encryptString','secret','utf8','base64','decryptString','createDecipher','bluebird','lodash','../../config/environment','secrets','aes-256-ctr','encrypt','algorithm','join','error','test','filter','indexOf','hasOwnProperty','encryptFile'];(function(_0x16539a,_0x31409a){var _0x200796=function(_0xfe7803){while(--_0xfe7803){_0x16539a['push'](_0x16539a['shift']());}};_0x200796(++_0x31409a);}(_0x1858,0x152));var _0x8185=function(_0x4c0318,_0x9b68f0){_0x4c0318=_0x4c0318-0x0;var _0x22db7f=_0x1858[_0x4c0318];return _0x22db7f;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x8185('0x0'));var _=require(_0x8185('0x1'));var config=require(_0x8185('0x2'));var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x8185('0x3')]['session'],'algorithm':_0x8185('0x4')};const fileOptions={'algorithm':'aes192'};if(config[_0x8185('0x5')]&&config[_0x8185('0x5')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x8185('0x5')]['algorithm']);if(isSupported){fileOptions[_0x8185('0x6')]=config[_0x8185('0x5')][_0x8185('0x6')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x8185('0x7')](',\x20');logger[_0x8185('0x8')](config[_0x8185('0x5')][_0x8185('0x6')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x5b51e2){return AES_SUPPORTED_RX[_0x8185('0x9')](_0x5b51e2);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x8185('0xa')](isASupportedCipher);}function isAlgorithmSupported(_0x334323){return getSupportedCiphers()[_0x8185('0xb')](_0x334323)>-0x1;}function combineOptions(_0x59cb78){var _0x21efd0={};for(var _0x4349c0 in fileOptions){if(fileOptions['hasOwnProperty'](_0x4349c0)){_0x21efd0[_0x4349c0]=fileOptions[_0x4349c0];}}if(_0x59cb78){for(var _0x5768e7 in _0x59cb78){if(_0x59cb78[_0x8185('0xc')](_0x5768e7)){_0x21efd0[_0x5768e7]=_0x59cb78[_0x5768e7];}}}return _0x21efd0;}exports[_0x8185('0xd')]=function(_0x1039d2,_0x4d17a3,_0x997e6d,_0x363192){return new BPromise(function(_0x245a54,_0xe6f76e){_0x363192=combineOptions(_0x363192);var _0x2659e4=new Buffer(_0x997e6d);var _0x5097e3=fs[_0x8185('0xe')](_0x1039d2);var _0x2c3e60=fs[_0x8185('0xf')](_0x4d17a3);var _0xe7c77f=crypto[_0x8185('0x10')](_0x363192[_0x8185('0x6')],_0x2659e4);_0x5097e3['on'](_0x8185('0x11'),function(_0x4c2db8){var _0x431548=new Buffer(_0xe7c77f[_0x8185('0x12')](_0x4c2db8),_0x8185('0x13'));_0x2c3e60[_0x8185('0x14')](_0x431548);});_0x5097e3['on'](_0x8185('0x15'),function(){try{var _0x38f0ab=new Buffer(_0xe7c77f[_0x8185('0x16')]('binary'),_0x8185('0x13'));_0x2c3e60['write'](_0x38f0ab);_0x2c3e60[_0x8185('0x15')]();_0x2c3e60['on']('close',function(){return _0x245a54(_0x4d17a3);});}catch(_0xbc2c87){fs[_0x8185('0x17')](_0x4d17a3);return _0xe6f76e(_0xbc2c87);}});});};exports[_0x8185('0x18')]=function(_0x34911b,_0x5a18ae,_0x303cd9,_0x441790){return new BPromise(function(_0x2f78b3,_0x5dce37){_0x441790=combineOptions(_0x441790);var _0x18a6ae=new Buffer(_0x303cd9);var _0x1cd433=fs[_0x8185('0xe')](_0x34911b);var _0x1f6046=fs[_0x8185('0xf')](_0x5a18ae);var _0x140675=crypto['createDecipher'](_0x441790[_0x8185('0x6')],_0x18a6ae);_0x1cd433['on'](_0x8185('0x11'),function(_0x3f375f){var _0x9e04b9=new Buffer(_0x140675[_0x8185('0x12')](_0x3f375f),'binary');_0x1f6046['write'](_0x9e04b9);});_0x1cd433['on']('end',function(){try{var _0x3fc081=new Buffer(_0x140675[_0x8185('0x16')](_0x8185('0x13')),_0x8185('0x13'));_0x1f6046[_0x8185('0x14')](_0x3fc081);_0x1f6046[_0x8185('0x15')]();_0x1f6046['on'](_0x8185('0x19'),function(){return _0x2f78b3(_0x5a18ae);});}catch(_0x1fa325){fs[_0x8185('0x17')](_0x5a18ae);return _0x5dce37(_0x1fa325);}});});};exports[_0x8185('0x1a')]=function(_0x4ac382,_0x1dba28,_0x4f979b){var _0x25b20b=_0x4f979b||stringOptions[_0x8185('0x6')];var _0x42a8e7=_0x1dba28||stringOptions[_0x8185('0x1b')];var _0x1e9e4b=crypto[_0x8185('0x10')](_0x25b20b,_0x42a8e7);var _0xd7ad65=_0x1e9e4b[_0x8185('0x12')](_0x4ac382,_0x8185('0x1c'),_0x8185('0x1d'));_0xd7ad65+=_0x1e9e4b[_0x8185('0x16')](_0x8185('0x1d'));return _0xd7ad65;};exports[_0x8185('0x1e')]=function(_0xea91e3,_0x496c9e,_0x39383c){var _0x48a33b=_0x39383c||stringOptions['algorithm'];var _0x3ab18c=_0x496c9e||stringOptions['secret'];var _0xea6b5d=crypto[_0x8185('0x1f')](_0x48a33b,_0x3ab18c);var _0x1d48fd=_0xea6b5d[_0x8185('0x12')](_0xea91e3,_0x8185('0x1d'),_0x8185('0x1c'));_0x1d48fd+=_0xea6b5d[_0x8185('0x16')]('utf8');return _0x1d48fd;}; \ No newline at end of file +var _0x806e=['is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher','data','update','binary','final','write','end','close','unlink','decryptFile','createWriteStream','createDecipher','secret','base64','decryptString','utf8','crypto','bluebird','lodash','../../config/environment','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x806e,0x1a4));var _0xe806=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x806e[_0x20a584];return _0x4b41a8;};'use strict';var crypto=require(_0xe806('0x0'));var fs=require('fs');var BPromise=require(_0xe806('0x1'));var _=require(_0xe806('0x2'));var config=require(_0xe806('0x3'));var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xe806('0x4')][_0xe806('0x5')],'algorithm':_0xe806('0x6')};const fileOptions={'algorithm':_0xe806('0x7')};if(config[_0xe806('0x8')]&&config['encrypt'][_0xe806('0x9')]){var isSupported=isAlgorithmSupported(config[_0xe806('0x8')][_0xe806('0x9')]);if(isSupported){fileOptions[_0xe806('0x9')]=config[_0xe806('0x8')][_0xe806('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xe806('0xa')](',\x20');logger[_0xe806('0xb')](config['encrypt'][_0xe806('0x9')],_0xe806('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x2d9a59){return AES_SUPPORTED_RX[_0xe806('0xd')](_0x2d9a59);}function getSupportedCiphers(){return crypto[_0xe806('0xe')]()[_0xe806('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0xc254d2){return getSupportedCiphers()[_0xe806('0x10')](_0xc254d2)>-0x1;}function combineOptions(_0x2d3eab){var _0x1e569b={};for(var _0x430ae6 in fileOptions){if(fileOptions[_0xe806('0x11')](_0x430ae6)){_0x1e569b[_0x430ae6]=fileOptions[_0x430ae6];}}if(_0x2d3eab){for(var _0x52637b in _0x2d3eab){if(_0x2d3eab['hasOwnProperty'](_0x52637b)){_0x1e569b[_0x52637b]=_0x2d3eab[_0x52637b];}}}return _0x1e569b;}exports[_0xe806('0x12')]=function(_0x1a5d9d,_0x523995,_0x5589fa,_0x220f94){return new BPromise(function(_0x54582a,_0x572b35){_0x220f94=combineOptions(_0x220f94);var _0x3b0df3=new Buffer(_0x5589fa);var _0x3c1d6b=fs[_0xe806('0x13')](_0x1a5d9d);var _0x3da871=fs['createWriteStream'](_0x523995);var _0x5c28c6=crypto[_0xe806('0x14')](_0x220f94[_0xe806('0x9')],_0x3b0df3);_0x3c1d6b['on'](_0xe806('0x15'),function(_0xaf6a48){var _0x49dc58=new Buffer(_0x5c28c6[_0xe806('0x16')](_0xaf6a48),_0xe806('0x17'));_0x3da871['write'](_0x49dc58);});_0x3c1d6b['on']('end',function(){try{var _0x3a1778=new Buffer(_0x5c28c6[_0xe806('0x18')](_0xe806('0x17')),_0xe806('0x17'));_0x3da871[_0xe806('0x19')](_0x3a1778);_0x3da871[_0xe806('0x1a')]();_0x3da871['on'](_0xe806('0x1b'),function(){return _0x54582a(_0x523995);});}catch(_0x317bb9){fs[_0xe806('0x1c')](_0x523995);return _0x572b35(_0x317bb9);}});});};exports[_0xe806('0x1d')]=function(_0x4314ec,_0x1944e7,_0x3276ce,_0xd2b6b0){return new BPromise(function(_0x55bf9f,_0x13c9a3){_0xd2b6b0=combineOptions(_0xd2b6b0);var _0xb3c30d=new Buffer(_0x3276ce);var _0x63ed6f=fs[_0xe806('0x13')](_0x4314ec);var _0x28e3fc=fs[_0xe806('0x1e')](_0x1944e7);var _0x274467=crypto[_0xe806('0x1f')](_0xd2b6b0[_0xe806('0x9')],_0xb3c30d);_0x63ed6f['on'](_0xe806('0x15'),function(_0x5660b5){var _0x5b5dec=new Buffer(_0x274467[_0xe806('0x16')](_0x5660b5),_0xe806('0x17'));_0x28e3fc[_0xe806('0x19')](_0x5b5dec);});_0x63ed6f['on'](_0xe806('0x1a'),function(){try{var _0xbf350c=new Buffer(_0x274467[_0xe806('0x18')](_0xe806('0x17')),_0xe806('0x17'));_0x28e3fc[_0xe806('0x19')](_0xbf350c);_0x28e3fc[_0xe806('0x1a')]();_0x28e3fc['on']('close',function(){return _0x55bf9f(_0x1944e7);});}catch(_0x271e03){fs['unlink'](_0x1944e7);return _0x13c9a3(_0x271e03);}});});};exports['encryptString']=function(_0x4b367f,_0x55c227,_0x114bd1){var _0x50d092=_0x114bd1||stringOptions['algorithm'];var _0x2f668a=_0x55c227||stringOptions[_0xe806('0x20')];var _0x1d1a70=crypto['createCipher'](_0x50d092,_0x2f668a);var _0x592242=_0x1d1a70[_0xe806('0x16')](_0x4b367f,'utf8','base64');_0x592242+=_0x1d1a70[_0xe806('0x18')](_0xe806('0x21'));return _0x592242;};exports[_0xe806('0x22')]=function(_0x2dd4c2,_0xb109f8,_0x5957d2){var _0x134de9=_0x5957d2||stringOptions[_0xe806('0x9')];var _0x5a8ba0=_0xb109f8||stringOptions[_0xe806('0x20')];var _0x2eebaa=crypto[_0xe806('0x1f')](_0x134de9,_0x5a8ba0);var _0x1bf9a3=_0x2eebaa[_0xe806('0x16')](_0x2dd4c2,_0xe806('0x21'),'utf8');_0x1bf9a3+=_0x2eebaa[_0xe806('0x18')](_0xe806('0x23'));return _0x1bf9a3;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 913d072..e33519b 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 _0x329d=['%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','update','format','CSV','find','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','split','length','range','isInteger','forEach','push','query'];(function(_0x4cc989,_0x54f72d){var _0x8e1730=function(_0x2094ed){while(--_0x2094ed){_0x4cc989['push'](_0x4cc989['shift']());}};_0x8e1730(++_0x54f72d);}(_0x329d,0x175));var _0xd329=function(_0xb301d4,_0x27ed18){_0xb301d4=_0xb301d4-0x0;var _0x3b5bde=_0x329d[_0xb301d4];return _0x3b5bde;};'use strict';var util=require('util');var path=require('path');var _=require(_0xd329('0x0'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xd329('0x1'));var zipdir=require(_0xd329('0x2'));var rimraf=require(_0xd329('0x3'));var db=require(_0xd329('0x4'))['db'];var dbH=require(_0xd329('0x4'))[_0xd329('0x5')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xd329('0x6')][0x2]);var QUERY=process[_0xd329('0x6')][0x3];var PATH=process[_0xd329('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x41a0d9,_0x5c9bb8){var _0x580018={'status':_0x41a0d9};var _0x573c01={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5c9bb8){_0x580018[_0xd329('0x7')]=_0x5c9bb8;}return db[_0xd329('0x8')][_0xd329('0x9')](_0x580018,_0x573c01);}function main(){var _0x36ffe0=0x1388;var _0x19f7f3;logger['info'](util[_0xd329('0xa')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xd329('0xb')));return db['Setting'][_0xd329('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xd329('0xd')]})['then'](function(_0x4ed6ac){if(_0x4ed6ac){_0x19f7f3=_0x4ed6ac;_0x36ffe0=_0x19f7f3['splitSizeCsv']||0x1388;}})[_0xd329('0xe')](function(){return dbH[_0xd329('0xf')]['query'](util[_0xd329('0xa')](_0xd329('0x10'),QUERY),{'type':dbH[_0xd329('0xf')][_0xd329('0x11')]['SELECT']});})[_0xd329('0xe')](function(_0x54163e){if(!_0x54163e[0x0][_0xd329('0x12')]){return analyticExtractedReport(_0xd329('0x13'));}var _0x4440c9=[];var _0x44eaed=0x0;if(_0x19f7f3[_0xd329('0x14')]){if(_0x54163e&&_0x54163e[_0xd329('0x15')]){var _0x584359=_[_0xd329('0x16')](_0x54163e[0x0][_0xd329('0x12')]/_0x36ffe0);var _0x364577=Number[_0xd329('0x17')](_0x54163e[0x0]['num']/_0x36ffe0)?_0x54163e[0x0][_0xd329('0x12')]%_0x36ffe0:0x0;_0x584359[_0xd329('0x18')](function(_0x31fe94){if(_0x31fe94>0x0){_0x44eaed+=_0x36ffe0;}_0x4440c9[_0xd329('0x19')](dbH[_0xd329('0xf')][_0xd329('0x1a')](util[_0xd329('0xa')](_0xd329('0x1b'),QUERY,_0x36ffe0,_0x44eaed),{'type':dbH[_0xd329('0xf')]['QueryTypes'][_0xd329('0x1c')]}));});if(_0x364577>0x0){_0x44eaed+=_0x36ffe0;_0x4440c9[_0xd329('0x19')](dbH[_0xd329('0xf')][_0xd329('0x1a')](util[_0xd329('0xa')](_0xd329('0x1b'),QUERY,_0x364577,_0x44eaed),{'type':dbH[_0xd329('0xf')]['QueryTypes']['SELECT']}));}}}else{_0x4440c9[_0xd329('0x19')](dbH[_0xd329('0xf')]['query'](QUERY,{'type':dbH['sequelize'][_0xd329('0x11')][_0xd329('0x1c')]}));}var _0x5b19b2=path[_0xd329('0x1d')](PATH);var _0x1219b3=path[_0xd329('0x1e')](PATH,_0xd329('0x1f'));var _0x103563=_0x19f7f3['split']&&_0x4440c9[_0xd329('0x15')]>0x1;var _0x5243d6=[];if(!fs[_0xd329('0x20')](path[_0xd329('0x21')](_0x5b19b2,_0x1219b3))&&_0x103563){fs[_0xd329('0x22')](path['join'](_0x5b19b2,_0x1219b3));}return BPromise[_0xd329('0x23')](_0x4440c9,function(_0x17c004){_0x5243d6[_0xd329('0x19')](_0x17c004);})['then'](function(){for(var _0x5931ce=0x0;_0x5931ce<_0x5243d6[_0xd329('0x15')];_0x5931ce+=0x1){var _0x1b8364;var _0x5007bf=_0x5243d6[_0x5931ce];if(_0x103563){_0x1b8364=path[_0xd329('0x21')](_0x5b19b2,_0x1219b3,util[_0xd329('0xa')](_0xd329('0x24'),_0x1219b3,_0x5931ce,_0xd329('0x25')));}else{_0x1b8364=path[_0xd329('0x21')](_0x5b19b2,util[_0xd329('0xa')](_0xd329('0x26'),_0x1219b3,_0xd329('0x25')));}fs[_0xd329('0x27')](_0x1b8364,csv(_0x5007bf));}})[_0xd329('0xe')](function(){if(_0x103563){return new Promise(function(_0x318cc1){zipdir(path[_0xd329('0x21')](_0x5b19b2,_0x1219b3),{'saveTo':path[_0xd329('0x21')](_0x5b19b2,util[_0xd329('0xa')](_0xd329('0x26'),_0x1219b3,_0xd329('0x28')))},function(_0x2aba36,_0x2f47fb){rimraf(path[_0xd329('0x21')](_0x5b19b2,_0x1219b3),function(){});_0x318cc1(_0xd329('0x29'));});});}})['then'](function(){logger[_0xd329('0x2a')](util[_0xd329('0xa')](_0xd329('0x2b'),EXTRACTED_REPORT_ID,_0xd329('0xb')));return analyticExtractedReport(_0xd329('0x2c'),_0x103563?util['format'](_0xd329('0x26'),_0x1219b3,_0x103563?'zip':_0xd329('0x25')):null);});})[_0xd329('0x2d')](function(_0x3716b4){logger[_0xd329('0x2a')](util['format'](_0xd329('0x2e'),EXTRACTED_REPORT_ID,_0xd329('0xb')),util['inspect'](_0x3716b4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd329('0x2f'));})[_0xd329('0x30')](function(){process[_0xd329('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xf46f=['../../config/logger','argv','savename','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','length','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Failed','exit','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH'];(function(_0xdc19d4,_0x4afa8e){var _0x1e9ff9=function(_0xe6a551){while(--_0xe6a551){_0xdc19d4['push'](_0xdc19d4['shift']());}};_0x1e9ff9(++_0x4afa8e);}(_0xf46f,0xf2));var _0xff46=function(_0xc3b7fe,_0x4a9350){_0xc3b7fe=_0xc3b7fe-0x0;var _0xc1c137=_0xf46f[_0xc3b7fe];return _0xc1c137;};'use strict';var util=require('util');var path=require(_0xff46('0x0'));var _=require(_0xff46('0x1'));var csv=require(_0xff46('0x2'));var fs=require('fs');var BPromise=require(_0xff46('0x3'));var zipdir=require(_0xff46('0x4'));var rimraf=require(_0xff46('0x5'));var db=require(_0xff46('0x6'))['db'];var dbH=require(_0xff46('0x6'))[_0xff46('0x7')];var logger=require(_0xff46('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xff46('0x9')][0x2]);var QUERY=process[_0xff46('0x9')][0x3];var PATH=process[_0xff46('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4fc28c,_0x4fe9ff){var _0x5cffdb={'status':_0x4fc28c};var _0x4c4814={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4fe9ff){_0x5cffdb[_0xff46('0xa')]=_0x4fe9ff;}return db[_0xff46('0xb')]['update'](_0x5cffdb,_0x4c4814);}function main(){var _0x3d4c78=0x1388;var _0x35aef1;logger[_0xff46('0xc')](util['format'](_0xff46('0xd'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xff46('0xe')][_0xff46('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xff46('0x10'),'splitSizeCsv']})['then'](function(_0x52d4dd){if(_0x52d4dd){_0x35aef1=_0x52d4dd;_0x3d4c78=_0x35aef1[_0xff46('0x11')]||0x1388;}})[_0xff46('0x12')](function(){return dbH[_0xff46('0x13')][_0xff46('0x14')](util[_0xff46('0x15')](_0xff46('0x16'),QUERY),{'type':dbH[_0xff46('0x13')][_0xff46('0x17')][_0xff46('0x18')]});})[_0xff46('0x12')](function(_0x20b042){if(!_0x20b042[0x0][_0xff46('0x19')]){return analyticExtractedReport(_0xff46('0x1a'));}var _0x4c223b=[];var _0x379613=0x0;if(_0x35aef1[_0xff46('0x10')]){if(_0x20b042&&_0x20b042['length']){var _0xbda700=_[_0xff46('0x1b')](_0x20b042[0x0][_0xff46('0x19')]/_0x3d4c78);var _0x248876=Number['isInteger'](_0x20b042[0x0][_0xff46('0x19')]/_0x3d4c78)?_0x20b042[0x0][_0xff46('0x19')]%_0x3d4c78:0x0;_0xbda700[_0xff46('0x1c')](function(_0x5d8cb5){if(_0x5d8cb5>0x0){_0x379613+=_0x3d4c78;}_0x4c223b[_0xff46('0x1d')](dbH['sequelize'][_0xff46('0x14')](util[_0xff46('0x15')](_0xff46('0x1e'),QUERY,_0x3d4c78,_0x379613),{'type':dbH['sequelize'][_0xff46('0x17')][_0xff46('0x18')]}));});if(_0x248876>0x0){_0x379613+=_0x3d4c78;_0x4c223b[_0xff46('0x1d')](dbH['sequelize']['query'](util[_0xff46('0x15')](_0xff46('0x1e'),QUERY,_0x248876,_0x379613),{'type':dbH[_0xff46('0x13')][_0xff46('0x17')]['SELECT']}));}}}else{_0x4c223b[_0xff46('0x1d')](dbH[_0xff46('0x13')][_0xff46('0x14')](QUERY,{'type':dbH['sequelize'][_0xff46('0x17')][_0xff46('0x18')]}));}var _0x52aacc=path[_0xff46('0x1f')](PATH);var _0x18b429=path[_0xff46('0x20')](PATH,_0xff46('0x21'));var _0x2e0fb4=_0x35aef1['split']&&_0x4c223b[_0xff46('0x22')]>0x1;var _0x5cac2c=[];if(!fs[_0xff46('0x23')](path[_0xff46('0x24')](_0x52aacc,_0x18b429))&&_0x2e0fb4){fs[_0xff46('0x25')](path[_0xff46('0x24')](_0x52aacc,_0x18b429));}return BPromise[_0xff46('0x26')](_0x4c223b,function(_0xda094e){_0x5cac2c[_0xff46('0x1d')](_0xda094e);})[_0xff46('0x12')](function(){for(var _0x2ba745=0x0;_0x2ba745<_0x5cac2c[_0xff46('0x22')];_0x2ba745+=0x1){var _0x5be7ee;var _0x47787a=_0x5cac2c[_0x2ba745];if(_0x2e0fb4){_0x5be7ee=path[_0xff46('0x24')](_0x52aacc,_0x18b429,util[_0xff46('0x15')](_0xff46('0x27'),_0x18b429,_0x2ba745,_0xff46('0x28')));}else{_0x5be7ee=path[_0xff46('0x24')](_0x52aacc,util[_0xff46('0x15')](_0xff46('0x29'),_0x18b429,_0xff46('0x28')));}fs[_0xff46('0x2a')](_0x5be7ee,csv(_0x47787a));}})[_0xff46('0x12')](function(){if(_0x2e0fb4){return new Promise(function(_0x473ca9){zipdir(path['join'](_0x52aacc,_0x18b429),{'saveTo':path[_0xff46('0x24')](_0x52aacc,util['format'](_0xff46('0x29'),_0x18b429,_0xff46('0x2b')))},function(_0x1d272a,_0x4fb8d2){rimraf(path[_0xff46('0x24')](_0x52aacc,_0x18b429),function(){});_0x473ca9('zip\x20finished');});});}})[_0xff46('0x12')](function(){logger['info'](util[_0xff46('0x15')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xff46('0x2c'),_0x2e0fb4?util[_0xff46('0x15')]('%s.%s',_0x18b429,_0x2e0fb4?_0xff46('0x2b'):_0xff46('0x28')):null);});})[_0xff46('0x2d')](function(_0x562552){logger[_0xff46('0xc')](util[_0xff46('0x15')](_0xff46('0x2e'),EXTRACTED_REPORT_ID,_0xff46('0x2f')),util['inspect'](_0x562552,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xff46('0x30'));})['finally'](function(){process[_0xff46('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index b16f9f2..7572e67 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 _0xb11c=['before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','splitSizePdf','then','split','length','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','join','mkdirSync','each','flatten','%s%d.%s','pdf','%s.%s','zip\x20finished','zip','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','interactionId','toString','center','\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','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','JSDOM','bluebird','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','update','map','tableHeader','auto','body','concat','chunk','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','pageBreak'];(function(_0x4dd8af,_0xfd2fba){var _0x152e6e=function(_0x26a0ff){while(--_0x26a0ff){_0x4dd8af['push'](_0x4dd8af['shift']());}};_0x152e6e(++_0xfd2fba);}(_0xb11c,0x8d));var _0xcb11=function(_0x3fa828,_0x1eabf5){_0x3fa828=_0x3fa828-0x0;var _0x406cc9=_0xb11c[_0x3fa828];return _0x406cc9;};'use strict';var _=require('lodash');var fs=require('fs');var util=require('util');var path=require(_0xcb11('0x0'));var moment=require(_0xcb11('0x1'));var htmlToPdfmake=require(_0xcb11('0x2'));var PdfPrinter=require(_0xcb11('0x3'));var zipdir=require(_0xcb11('0x4'));var rimraf=require('rimraf');var JSDOM=require('jsdom')[_0xcb11('0x5')];var window=new JSDOM('')['window'];var BPromise=require(_0xcb11('0x6'));var db=require(_0xcb11('0x7'))['db'];var dbH=require(_0xcb11('0x7'))[_0xcb11('0x8')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xcb11('0x9')][0x3];var PATH=process[_0xcb11('0x9')][0x4];var NAME=process[_0xcb11('0x9')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x28bd75,_0x1b8055){var _0x2ad688={'status':_0x28bd75};var _0x3777e6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1b8055){_0x2ad688[_0xcb11('0xa')]=_0x1b8055;}return db[_0xcb11('0xb')][_0xcb11('0xc')](_0x2ad688,_0x3777e6);}function getHeaders(_0x4b7f12){return _[_0xcb11('0xd')](_0x4b7f12,function(_0x4dcc13){return{'text':_0x4dcc13,'style':_0xcb11('0xe')};});}function getRows(_0x11df54,_0x1ba182){return _[_0xcb11('0xd')](_0x1ba182,function(_0x2c8d5b){return _(_0x2c8d5b)['pick'](_0x11df54)[_0xcb11('0xd')](function(_0x27a357){return _0x27a357?_['toString'](_0x27a357):'';})['value']();});}function createTable(_0x2d9d1d,_0x1ee289){var _0x165339={'widths':_['fill'](Array(_0x2d9d1d['length']),0x91),'heights':function(_0x1d684a){return _0x1d684a===0x0?_0xcb11('0xf'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3c5cfd=getHeaders(_0x2d9d1d);_0x165339[_0xcb11('0x10')]['push'](_0x3c5cfd);var _0x379a41=getRows(_0x2d9d1d,_0x1ee289);_0x165339[_0xcb11('0x10')]=_0x165339[_0xcb11('0x10')][_0xcb11('0x11')](_0x379a41);return _0x165339;}function createTables(_0x20cb02){var _0x129fab=[];var _0xc3e79=_[_0xcb11('0x12')](Object['keys'](_0x20cb02[0x0]),0x5);_0xc3e79[_0xcb11('0x13')](function(_0x2edff4){_0x129fab[_0xcb11('0x14')](createTable(_0x2edff4,_0x20cb02));});return _0x129fab;}function getPDFDocDefinition(_0x3830a2){var _0x31bf10=util[_0xcb11('0x15')](_0xcb11('0x16'),NAME,EXTRACTED_REPORT[_0xcb11('0x17')],moment(EXTRACTED_REPORT[_0xcb11('0x18')])[_0xcb11('0x15')](FORMAT),moment(EXTRACTED_REPORT[_0xcb11('0x19')])[_0xcb11('0x15')](FORMAT));var _0x331e17=[];for(var _0x245fea=0x0;_0x245fea<_0x3830a2['length'];_0x245fea++){var _0x23db2a=[];if(_0x245fea===0x0){_0x23db2a[_0xcb11('0x14')]({'text':_0x31bf10,'style':'header'});}var _0x20c396={'table':_0x3830a2[_0x245fea]};if(_0x245fea>0x0){_0x20c396[_0xcb11('0x1a')]=_0xcb11('0x1b');_0x20c396[_0xcb11('0x1c')]=[0x0,0x46,0x0,0x0];}_0x23db2a[_0xcb11('0x14')](_0x20c396);_0x331e17[_0xcb11('0x14')](_0x23db2a);}return{'pageSize':'A4','pageOrientation':_0xcb11('0x1d'),'content':_0x331e17,'footer':function(_0x117ac4,_0x215704){return{'text':_0x117ac4['toString']()+_0xcb11('0x1e')+_0x215704,'style':_0xcb11('0x1f')};},'defaultStyle':{'font':_0xcb11('0x20')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xcb11('0x21')},'footer':{'alignment':_0xcb11('0x22'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xbd8f6f){var _0x491221=0x1388;var _0x55c7d1;if(!_0xbd8f6f[0x0][_0xcb11('0x23')]){return analyticExtractedReport(_0xcb11('0x24'));}return db[_0xcb11('0x25')][_0xcb11('0x26')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xcb11('0x27')]})[_0xcb11('0x28')](function(_0x29dd9a){if(_0x29dd9a){_0x55c7d1=_0x29dd9a;_0x491221=_0x55c7d1[_0xcb11('0x27')]||0x3e8;}})[_0xcb11('0x28')](function(){var _0x98f17b=[];var _0x47d7b3=0x0;if(_0x55c7d1[_0xcb11('0x29')]){if(_0xbd8f6f&&_0xbd8f6f[_0xcb11('0x2a')]){var _0x5c1470=_[_0xcb11('0x2b')](_0xbd8f6f[0x0]['num']/_0x491221);var _0x4cc3a6=Number[_0xcb11('0x2c')](_0xbd8f6f[0x0][_0xcb11('0x23')]/_0x491221)?_0xbd8f6f[0x0][_0xcb11('0x23')]%_0x491221:0x0;_0x5c1470[_0xcb11('0x13')](function(_0x277c63){if(_0x277c63>0x0){_0x47d7b3+=_0x491221;}_0x98f17b['push'](dbH[_0xcb11('0x2d')][_0xcb11('0x2e')](util['format'](_0xcb11('0x2f'),QUERY,_0x491221,_0x47d7b3),{'type':dbH['sequelize'][_0xcb11('0x30')][_0xcb11('0x31')]}));});if(_0x4cc3a6>0x0){_0x47d7b3+=_0x491221;_0x98f17b['push'](dbH['sequelize'][_0xcb11('0x2e')](util[_0xcb11('0x15')](_0xcb11('0x2f'),QUERY,_0x4cc3a6,_0x47d7b3),{'type':dbH['sequelize'][_0xcb11('0x30')]['SELECT']}));}}}else{_0x98f17b[_0xcb11('0x14')](dbH[_0xcb11('0x2d')]['query'](QUERY,{'type':dbH['sequelize'][_0xcb11('0x30')][_0xcb11('0x31')]}));}var _0x145e75=path[_0xcb11('0x32')](PATH);var _0x261c0f=path[_0xcb11('0x33')](PATH,_0xcb11('0x34'));var _0x170722=_0x55c7d1[_0xcb11('0x29')]&&_0x98f17b[_0xcb11('0x2a')]>0x1;var _0x5ded7c=[];if(!fs['existsSync'](path[_0xcb11('0x35')](_0x145e75,_0x261c0f))&&_0x170722){fs[_0xcb11('0x36')](path[_0xcb11('0x35')](_0x145e75,_0x261c0f));}return BPromise[_0xcb11('0x37')](_0x98f17b,function(_0x3beaa5){_0x5ded7c['push'](_0x3beaa5);})['then'](function(){var _0x10b2ef=[];for(var _0x3885a0=0x0;_0x3885a0<_0x5ded7c[_0xcb11('0x2a')];_0x3885a0+=0x1){var _0x38445f=_0x5ded7c[_0x3885a0];var _0x1d3749=createTables(_[_0xcb11('0x38')](_0x38445f));var _0x275554;var _0x3501f4=getPDFDocDefinition(_0x1d3749);var _0x362d0c=getPDFPrinter();var _0x1d8ca5=_0x362d0c['createPdfKitDocument'](_0x3501f4);if(_0x170722){_0x275554=path[_0xcb11('0x35')](_0x145e75,_0x261c0f,util[_0xcb11('0x15')](_0xcb11('0x39'),_0x261c0f,_0x3885a0,_0xcb11('0x3a')));}else{_0x275554=path['join'](_0x145e75,util[_0xcb11('0x15')](_0xcb11('0x3b'),_0x261c0f,_0xcb11('0x3a')));}_0x10b2ef['push'](writePDFDocument(_0x1d8ca5,_0x275554));}return Promise['all'](_0x10b2ef);})[_0xcb11('0x28')](function(){if(_0x170722){return new Promise(function(_0x3be8fa){zipdir(path[_0xcb11('0x35')](_0x145e75,_0x261c0f),{'saveTo':path[_0xcb11('0x35')](_0x145e75,util['format']('%s.%s',_0x261c0f,'zip'))},function(){rimraf(path[_0xcb11('0x35')](_0x145e75,_0x261c0f),function(){});_0x3be8fa(_0xcb11('0x3c'));});});}})['then'](function(){if(!_0x170722)return;rimraf(path['join'](_0x145e75,_0x261c0f),function(){});})[_0xcb11('0x28')](function(){logger['info'](util[_0xcb11('0x15')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x170722?util['format'](_0xcb11('0x3b'),_0x261c0f,_0x170722?_0xcb11('0x3d'):_0xcb11('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xcb11('0x3e')](util[_0xcb11('0x15')](_0xcb11('0x3f'),EXTRACTED_REPORT_ID,_0xcb11('0x40')));return db[_0xcb11('0xb')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xcb11('0x28')](function(_0x1f4a1f){EXTRACTED_REPORT=_0x1f4a1f;return dbH[_0xcb11('0x2d')]['query'](util[_0xcb11('0x15')](_0xcb11('0x41'),QUERY),{'type':dbH[_0xcb11('0x2d')]['QueryTypes']['SELECT']});})[_0xcb11('0x28')](extractReport)[_0xcb11('0x42')](function(_0x2ee82b){logger['info'](util[_0xcb11('0x15')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xcb11('0x40')),util['inspect'](_0x2ee82b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcb11('0x43'));})['finally'](function(){process[_0xcb11('0x44')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x42c7fa=new PdfPrinter({'Arial':{'normal':__dirname+_0xcb11('0x45'),'bold':__dirname+_0xcb11('0x46'),'italics':__dirname+_0xcb11('0x47'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x42c7fa;}function getPDFDocDefinitionFromHTML(_0x3faba7,_0xfc6c34){var _0x2bfb6d=util['format'](_0xcb11('0x48'),_0xfc6c34['channel'],_0xfc6c34[_0xcb11('0x49')]);var _0x10f38d=moment()['format']('YYYY-MM-DD')[_0xcb11('0x4a')]();var _0x121389=htmlToPdfmake(_0x3faba7,{'window':window,'tableAutoSize':!![]});return{'content':[_0x121389],'defaultStyle':{'font':_0xcb11('0x20')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xcb11('0x4b'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':'Interaction\x20Transcript','style':'header'}];},'footer':function(_0x1d3634,_0x80599b){return[{'text':util[_0xcb11('0x15')](_0xcb11('0x4c'),_0x2bfb6d,_0x1d3634,_0x80599b,_0x10f38d),'style':_0xcb11('0x1f')}];}};}function writePDFDocument(_0x30d06b,_0xf6acff){return new Promise(function(_0x1f894d,_0x2718b9){var _0x2d7f1a=_0x30d06b[_0xcb11('0x4d')](fs[_0xcb11('0x4e')](_0xf6acff));_0x2d7f1a['on'](_0xcb11('0x4f'),function(){_0x1f894d(_0xcb11('0x4f'));});_0x2d7f1a['on'](_0xcb11('0x50'),function(_0x470da4){_0x2718b9(_0x470da4);});_0x30d06b[_0xcb11('0x51')]();});}exports[_0xcb11('0x52')]=function(_0x3d2241,_0x1f06bf){var _0x903ffe=getPDFPrinter();var _0x53de70=getPDFDocDefinitionFromHTML(_0x3d2241,_0x1f06bf);var _0x2765f1=_0x903ffe[_0xcb11('0x53')](_0x53de70);return writePDFDocument(_0x2765f1,_0x1f06bf['path'])['catch'](function(_0x27f6ca){throw _0x27f6ca;});}; \ No newline at end of file +var _0xacf2=['splitSizePdf','then','num','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','.pdf','split','existsSync','join','mkdirSync','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','toString','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','end','createPdfFromHTML','path','util','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','update','tableHeader','map','pick','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','header','pageBreak','before','\x20/\x20','footer','Arial','Empty','Setting','find'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0xacf2,0x8f));var _0x2acf=function(_0x5c1ade,_0xaa1212){_0x5c1ade=_0x5c1ade-0x0;var _0x4980b4=_0xacf2[_0x5c1ade];return _0x4980b4;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x2acf('0x0'));var path=require('path');var moment=require(_0x2acf('0x1'));var htmlToPdfmake=require(_0x2acf('0x2'));var PdfPrinter=require(_0x2acf('0x3'));var zipdir=require(_0x2acf('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0x2acf('0x5'))[_0x2acf('0x6')];var window=new JSDOM('')[_0x2acf('0x7')];var BPromise=require(_0x2acf('0x8'));var db=require(_0x2acf('0x9'))['db'];var dbH=require(_0x2acf('0x9'))['dbH'];var logger=require(_0x2acf('0xa'))(_0x2acf('0xb'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x2acf('0xc')][0x3];var PATH=process[_0x2acf('0xc')][0x4];var NAME=process[_0x2acf('0xc')][0x5];var FORMAT=_0x2acf('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x58110b,_0x265e9e){var _0x3cfce4={'status':_0x58110b};var _0x17fa55={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x265e9e){_0x3cfce4['savename']=_0x265e9e;}return db['AnalyticExtractedReport'][_0x2acf('0xe')](_0x3cfce4,_0x17fa55);}function getHeaders(_0x462c14){return _['map'](_0x462c14,function(_0x15274e){return{'text':_0x15274e,'style':_0x2acf('0xf')};});}function getRows(_0x2e8e0a,_0x2e798c){return _[_0x2acf('0x10')](_0x2e798c,function(_0x1e4ed4){return _(_0x1e4ed4)[_0x2acf('0x11')](_0x2e8e0a)[_0x2acf('0x10')](function(_0x450546){return _0x450546?_['toString'](_0x450546):'';})[_0x2acf('0x12')]();});}function createTable(_0x16bba8,_0xb9c602){var _0x1d28d8={'widths':_[_0x2acf('0x13')](Array(_0x16bba8[_0x2acf('0x14')]),0x91),'heights':function(_0x1b2e13){return _0x1b2e13===0x0?_0x2acf('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x500835=getHeaders(_0x16bba8);_0x1d28d8[_0x2acf('0x16')][_0x2acf('0x17')](_0x500835);var _0x26e326=getRows(_0x16bba8,_0xb9c602);_0x1d28d8[_0x2acf('0x16')]=_0x1d28d8['body'][_0x2acf('0x18')](_0x26e326);return _0x1d28d8;}function createTables(_0x2694f8){var _0x903cf7=[];var _0x3d108f=_[_0x2acf('0x19')](Object[_0x2acf('0x1a')](_0x2694f8[0x0]),0x5);_0x3d108f[_0x2acf('0x1b')](function(_0x115f81){_0x903cf7[_0x2acf('0x17')](createTable(_0x115f81,_0x2694f8));});return _0x903cf7;}function getPDFDocDefinition(_0xa23ddf){var _0x3697b2=util[_0x2acf('0x1c')](_0x2acf('0x1d'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x2acf('0x1e')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x2acf('0x1f')])[_0x2acf('0x1c')](FORMAT));var _0xe9a4ef=[];for(var _0x5a60ba=0x0;_0x5a60ba<_0xa23ddf[_0x2acf('0x14')];_0x5a60ba++){var _0x1a540d=[];if(_0x5a60ba===0x0){_0x1a540d[_0x2acf('0x17')]({'text':_0x3697b2,'style':_0x2acf('0x20')});}var _0x2f95a5={'table':_0xa23ddf[_0x5a60ba]};if(_0x5a60ba>0x0){_0x2f95a5[_0x2acf('0x21')]=_0x2acf('0x22');_0x2f95a5['margin']=[0x0,0x46,0x0,0x0];}_0x1a540d[_0x2acf('0x17')](_0x2f95a5);_0xe9a4ef['push'](_0x1a540d);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0xe9a4ef,'footer':function(_0x4b1feb,_0x2a93bf){return{'text':_0x4b1feb['toString']()+_0x2acf('0x23')+_0x2a93bf,'style':_0x2acf('0x24')};},'defaultStyle':{'font':_0x2acf('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x26be50){var _0x5d072a=0x1388;var _0x244c3c;if(!_0x26be50[0x0]['num']){return analyticExtractedReport(_0x2acf('0x26'));}return db[_0x2acf('0x27')][_0x2acf('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x2acf('0x29')]})[_0x2acf('0x2a')](function(_0x48855f){if(_0x48855f){_0x244c3c=_0x48855f;_0x5d072a=_0x244c3c[_0x2acf('0x29')]||0x3e8;}})[_0x2acf('0x2a')](function(){var _0xb9900c=[];var _0x4952ac=0x0;if(_0x244c3c['split']){if(_0x26be50&&_0x26be50[_0x2acf('0x14')]){var _0x14f515=_['range'](_0x26be50[0x0][_0x2acf('0x2b')]/_0x5d072a);var _0x2375e5=Number[_0x2acf('0x2c')](_0x26be50[0x0][_0x2acf('0x2b')]/_0x5d072a)?_0x26be50[0x0][_0x2acf('0x2b')]%_0x5d072a:0x0;_0x14f515[_0x2acf('0x1b')](function(_0x527f00){if(_0x527f00>0x0){_0x4952ac+=_0x5d072a;}_0xb9900c[_0x2acf('0x17')](dbH[_0x2acf('0x2d')][_0x2acf('0x2e')](util[_0x2acf('0x1c')](_0x2acf('0x2f'),QUERY,_0x5d072a,_0x4952ac),{'type':dbH['sequelize'][_0x2acf('0x30')][_0x2acf('0x31')]}));});if(_0x2375e5>0x0){_0x4952ac+=_0x5d072a;_0xb9900c[_0x2acf('0x17')](dbH[_0x2acf('0x2d')][_0x2acf('0x2e')](util['format'](_0x2acf('0x2f'),QUERY,_0x2375e5,_0x4952ac),{'type':dbH['sequelize'][_0x2acf('0x30')][_0x2acf('0x31')]}));}}}else{_0xb9900c[_0x2acf('0x17')](dbH[_0x2acf('0x2d')][_0x2acf('0x2e')](QUERY,{'type':dbH['sequelize'][_0x2acf('0x30')][_0x2acf('0x31')]}));}var _0x1379e7=path['dirname'](PATH);var _0x398b80=path['basename'](PATH,_0x2acf('0x32'));var _0x54278d=_0x244c3c[_0x2acf('0x33')]&&_0xb9900c['length']>0x1;var _0x5d33ec=[];if(!fs[_0x2acf('0x34')](path[_0x2acf('0x35')](_0x1379e7,_0x398b80))&&_0x54278d){fs[_0x2acf('0x36')](path['join'](_0x1379e7,_0x398b80));}return BPromise['each'](_0xb9900c,function(_0x21c85f){_0x5d33ec[_0x2acf('0x17')](_0x21c85f);})['then'](function(){var _0x520343=[];for(var _0x22427e=0x0;_0x22427e<_0x5d33ec[_0x2acf('0x14')];_0x22427e+=0x1){var _0x31be76=_0x5d33ec[_0x22427e];var _0x8338f2=createTables(_[_0x2acf('0x37')](_0x31be76));var _0x50b045;var _0x127eb4=getPDFDocDefinition(_0x8338f2);var _0x1da1cc=getPDFPrinter();var _0x282fe3=_0x1da1cc[_0x2acf('0x38')](_0x127eb4);if(_0x54278d){_0x50b045=path['join'](_0x1379e7,_0x398b80,util[_0x2acf('0x1c')](_0x2acf('0x39'),_0x398b80,_0x22427e,_0x2acf('0x3a')));}else{_0x50b045=path[_0x2acf('0x35')](_0x1379e7,util['format'](_0x2acf('0x3b'),_0x398b80,'pdf'));}_0x520343[_0x2acf('0x17')](writePDFDocument(_0x282fe3,_0x50b045));}return Promise[_0x2acf('0x3c')](_0x520343);})[_0x2acf('0x2a')](function(){if(_0x54278d){return new Promise(function(_0x4eaee6){zipdir(path['join'](_0x1379e7,_0x398b80),{'saveTo':path[_0x2acf('0x35')](_0x1379e7,util['format'](_0x2acf('0x3b'),_0x398b80,_0x2acf('0x3d')))},function(){rimraf(path['join'](_0x1379e7,_0x398b80),function(){});_0x4eaee6(_0x2acf('0x3e'));});});}})[_0x2acf('0x2a')](function(){if(!_0x54278d)return;rimraf(path['join'](_0x1379e7,_0x398b80),function(){});})[_0x2acf('0x2a')](function(){logger['info'](util[_0x2acf('0x1c')](_0x2acf('0x3f'),EXTRACTED_REPORT_ID,_0x2acf('0x40')));return analyticExtractedReport(_0x2acf('0x41'),_0x54278d?util[_0x2acf('0x1c')](_0x2acf('0x3b'),_0x398b80,_0x54278d?_0x2acf('0x3d'):_0x2acf('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x2acf('0x42')](util[_0x2acf('0x1c')](_0x2acf('0x43'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x2acf('0x44')][_0x2acf('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x5af60d){EXTRACTED_REPORT=_0x5af60d;return dbH[_0x2acf('0x2d')][_0x2acf('0x2e')](util[_0x2acf('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x2acf('0x31')]});})[_0x2acf('0x2a')](extractReport)[_0x2acf('0x46')](function(_0x955bbf){logger[_0x2acf('0x42')](util[_0x2acf('0x1c')](_0x2acf('0x47'),EXTRACTED_REPORT_ID,_0x2acf('0x40')),util[_0x2acf('0x48')](_0x955bbf,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2acf('0x49'));})[_0x2acf('0x4a')](function(){process[_0x2acf('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1767c9=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x2acf('0x4c'),'bolditalics':__dirname+_0x2acf('0x4d')}});return _0x1767c9;}function getPDFDocDefinitionFromHTML(_0x586649,_0x45e6f2){var _0x76d037=util[_0x2acf('0x1c')](_0x2acf('0x4e'),_0x45e6f2[_0x2acf('0x4f')],_0x45e6f2[_0x2acf('0x50')]);var _0x4fc4d4=moment()['format'](_0x2acf('0x51'))[_0x2acf('0x52')]();var _0x474450=htmlToPdfmake(_0x586649,{'window':window,'tableAutoSize':!![]});return{'content':[_0x474450],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x2acf('0x53'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x2acf('0x53')}},'header':function(){return[{'text':_0x2acf('0x54'),'style':'header'}];},'footer':function(_0x121164,_0x35f585){return[{'text':util[_0x2acf('0x1c')](_0x2acf('0x55'),_0x76d037,_0x121164,_0x35f585,_0x4fc4d4),'style':_0x2acf('0x24')}];}};}function writePDFDocument(_0x5289f7,_0x245f6a){return new Promise(function(_0x281336,_0x3f9df8){var _0x40fcd2=_0x5289f7['pipe'](fs[_0x2acf('0x56')](_0x245f6a));_0x40fcd2['on'](_0x2acf('0x57'),function(){_0x281336(_0x2acf('0x57'));});_0x40fcd2['on'](_0x2acf('0x58'),function(_0x1f06c5){_0x3f9df8(_0x1f06c5);});_0x5289f7[_0x2acf('0x59')]();});}exports[_0x2acf('0x5a')]=function(_0x41b28f,_0x4ca3f4){var _0x19144c=getPDFPrinter();var _0x4f3003=getPDFDocDefinitionFromHTML(_0x41b28f,_0x4ca3f4);var _0x3ef93f=_0x19144c[_0x2acf('0x38')](_0x4f3003);return writePDFDocument(_0x3ef93f,_0x4ca3f4[_0x2acf('0x5b')])[_0x2acf('0x46')](function(_0x3877a3){throw _0x3877a3;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index ecde19f..f6f60a2 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 _0xe517=['mkdirSync','each','%s%d.%s','xlsx','zip','Completed','%s.%s','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','path','lodash','json2xls','../../mysqldb','../../config/logger','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','Empty','range','num','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','basename','.xlsx','length','existsSync','join'];(function(_0x42696d,_0xb8e8fa){var _0x4f3a3c=function(_0x1e878a){while(--_0x1e878a){_0x42696d['push'](_0x42696d['shift']());}};_0x4f3a3c(++_0xb8e8fa);}(_0xe517,0xe6));var _0x7e51=function(_0x1d6e17,_0x1bfce7){_0x1d6e17=_0x1d6e17-0x0;var _0x124c03=_0xe517[_0x1d6e17];return _0x124c03;};'use strict';var util=require('util');var path=require(_0x7e51('0x0'));var _=require(_0x7e51('0x1'));var fs=require('fs');var json2xls=require(_0x7e51('0x2'));var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0x7e51('0x3'))['db'];var dbH=require(_0x7e51('0x3'))['dbH'];var logger=require(_0x7e51('0x4'))(_0x7e51('0x5'));var EXTRACTED_REPORT_ID=Number(process[_0x7e51('0x6')][0x2]);var QUERY=process[_0x7e51('0x6')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xf79a02,_0x50a887){var _0x5afbd9={'status':_0xf79a02};var _0x234a2f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x50a887){_0x5afbd9[_0x7e51('0x7')]=_0x50a887;}return db['AnalyticExtractedReport'][_0x7e51('0x8')](_0x5afbd9,_0x234a2f);}function main(){var _0x2e6056=0x1388;var _0x254203;logger[_0x7e51('0x9')](util[_0x7e51('0xa')](_0x7e51('0xb'),EXTRACTED_REPORT_ID,_0x7e51('0xc')));return db[_0x7e51('0xd')][_0x7e51('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7e51('0xf'),_0x7e51('0x10')]})['then'](function(_0x7e1cf6){if(_0x7e1cf6){_0x254203=_0x7e1cf6;_0x2e6056=_0x254203[_0x7e51('0x10')]||0x1388;}})[_0x7e51('0x11')](function(){return dbH[_0x7e51('0x12')][_0x7e51('0x13')](util[_0x7e51('0xa')](_0x7e51('0x14'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x7e51('0x15')]});})[_0x7e51('0x11')](function(_0x4400d4){if(!_0x4400d4[0x0]['num']){return analyticExtractedReport(_0x7e51('0x16'));}var _0x37e168=[];var _0x2163bc=0x0;if(_0x254203[_0x7e51('0xf')]){if(_0x4400d4&&_0x4400d4['length']){var _0xc1c79=_[_0x7e51('0x17')](_0x4400d4[0x0]['num']/_0x2e6056);var _0xd10150=Number['isInteger'](_0x4400d4[0x0][_0x7e51('0x18')]/_0x2e6056)?_0x4400d4[0x0][_0x7e51('0x18')]%_0x2e6056:0x0;_0xc1c79[_0x7e51('0x19')](function(_0x466c52){if(_0x466c52>0x0){_0x2163bc+=_0x2e6056;}_0x37e168['push'](dbH[_0x7e51('0x12')][_0x7e51('0x13')](util[_0x7e51('0xa')](_0x7e51('0x1a'),QUERY,_0x2e6056,_0x2163bc),{'type':dbH['sequelize']['QueryTypes'][_0x7e51('0x15')]}));});if(_0xd10150>0x0){_0x2163bc+=_0x2e6056;_0x37e168['push'](dbH[_0x7e51('0x12')][_0x7e51('0x13')](util['format'](_0x7e51('0x1a'),QUERY,_0xd10150,_0x2163bc),{'type':dbH['sequelize'][_0x7e51('0x1b')][_0x7e51('0x15')]}));}}}else{_0x37e168[_0x7e51('0x1c')](dbH[_0x7e51('0x12')]['query'](QUERY,{'type':dbH[_0x7e51('0x12')][_0x7e51('0x1b')]['SELECT']}));}var _0x5147eb=path['dirname'](PATH);var _0x190668=path[_0x7e51('0x1d')](PATH,_0x7e51('0x1e'));var _0xc324a6=_0x254203['split']&&_0x37e168[_0x7e51('0x1f')]>0x1;var _0x2ddf5c=[];if(!fs[_0x7e51('0x20')](path[_0x7e51('0x21')](_0x5147eb,_0x190668))&&_0xc324a6){fs[_0x7e51('0x22')](path[_0x7e51('0x21')](_0x5147eb,_0x190668));}return BPromise[_0x7e51('0x23')](_0x37e168,function(_0x43b320){_0x2ddf5c[_0x7e51('0x1c')](_0x43b320);})[_0x7e51('0x11')](function(){for(var _0x291d5d=0x0;_0x291d5d<_0x2ddf5c[_0x7e51('0x1f')];_0x291d5d+=0x1){var _0x12487f;var _0x33c16f=_0x2ddf5c[_0x291d5d];if(_0xc324a6){_0x12487f=path[_0x7e51('0x21')](_0x5147eb,_0x190668,util[_0x7e51('0xa')](_0x7e51('0x24'),_0x190668,_0x291d5d,_0x7e51('0x25')));}else{_0x12487f=path['join'](_0x5147eb,util[_0x7e51('0xa')]('%s.%s',_0x190668,_0x7e51('0x25')));}fs['writeFileSync'](_0x12487f,json2xls(_0x33c16f),'binary');}})[_0x7e51('0x11')](function(){if(_0xc324a6){return new Promise(function(_0x13340e){zipdir(path[_0x7e51('0x21')](_0x5147eb,_0x190668),{'saveTo':path['join'](_0x5147eb,util[_0x7e51('0xa')]('%s.%s',_0x190668,_0x7e51('0x26')))},function(_0x1f05e6,_0x954e18){rimraf(path[_0x7e51('0x21')](_0x5147eb,_0x190668),function(){});_0x13340e('zip\x20finished');});});}})[_0x7e51('0x11')](function(){logger[_0x7e51('0x9')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x7e51('0xc')));return analyticExtractedReport(_0x7e51('0x27'),_0xc324a6?util[_0x7e51('0xa')](_0x7e51('0x28'),_0x190668,_0xc324a6?_0x7e51('0x26'):_0x7e51('0x25')):null);});})['catch'](function(_0x2c234d){logger[_0x7e51('0x9')](util['format'](_0x7e51('0x29'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x2c234d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x7e51('0x2a')](function(){process[_0x7e51('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xa20a=['binary','zip','zip\x20finished','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','num','Empty','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','length','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xa20a,0x14d));var _0xaa20=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xa20a[_0x32f7d7];return _0x133d09;};'use strict';var util=require(_0xaa20('0x0'));var path=require(_0xaa20('0x1'));var _=require(_0xaa20('0x2'));var fs=require('fs');var json2xls=require(_0xaa20('0x3'));var BPromise=require('bluebird');var zipdir=require(_0xaa20('0x4'));var rimraf=require(_0xaa20('0x5'));var db=require(_0xaa20('0x6'))['db'];var dbH=require(_0xaa20('0x6'))[_0xaa20('0x7')];var logger=require(_0xaa20('0x8'))(_0xaa20('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xaa20('0xa')][0x2]);var QUERY=process[_0xaa20('0xa')][0x3];var PATH=process[_0xaa20('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5ad1dc,_0x201081){var _0x509ca7={'status':_0x5ad1dc};var _0x116358={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x201081){_0x509ca7[_0xaa20('0xb')]=_0x201081;}return db[_0xaa20('0xc')][_0xaa20('0xd')](_0x509ca7,_0x116358);}function main(){var _0x44722a=0x1388;var _0x2dcb10;logger[_0xaa20('0xe')](util[_0xaa20('0xf')](_0xaa20('0x10'),EXTRACTED_REPORT_ID,_0xaa20('0x11')));return db[_0xaa20('0x12')][_0xaa20('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xaa20('0x14'),_0xaa20('0x15')]})['then'](function(_0x4ae093){if(_0x4ae093){_0x2dcb10=_0x4ae093;_0x44722a=_0x2dcb10[_0xaa20('0x15')]||0x1388;}})[_0xaa20('0x16')](function(){return dbH[_0xaa20('0x17')][_0xaa20('0x18')](util[_0xaa20('0xf')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0xaa20('0x19')][_0xaa20('0x1a')]});})[_0xaa20('0x16')](function(_0x42b666){if(!_0x42b666[0x0][_0xaa20('0x1b')]){return analyticExtractedReport(_0xaa20('0x1c'));}var _0x231da0=[];var _0x2911fe=0x0;if(_0x2dcb10[_0xaa20('0x14')]){if(_0x42b666&&_0x42b666['length']){var _0x1f7066=_['range'](_0x42b666[0x0][_0xaa20('0x1b')]/_0x44722a);var _0x846fbe=Number[_0xaa20('0x1d')](_0x42b666[0x0]['num']/_0x44722a)?_0x42b666[0x0][_0xaa20('0x1b')]%_0x44722a:0x0;_0x1f7066[_0xaa20('0x1e')](function(_0x51134c){if(_0x51134c>0x0){_0x2911fe+=_0x44722a;}_0x231da0[_0xaa20('0x1f')](dbH[_0xaa20('0x17')][_0xaa20('0x18')](util[_0xaa20('0xf')](_0xaa20('0x20'),QUERY,_0x44722a,_0x2911fe),{'type':dbH[_0xaa20('0x17')][_0xaa20('0x19')][_0xaa20('0x1a')]}));});if(_0x846fbe>0x0){_0x2911fe+=_0x44722a;_0x231da0[_0xaa20('0x1f')](dbH[_0xaa20('0x17')][_0xaa20('0x18')](util[_0xaa20('0xf')](_0xaa20('0x20'),QUERY,_0x846fbe,_0x2911fe),{'type':dbH[_0xaa20('0x17')][_0xaa20('0x19')][_0xaa20('0x1a')]}));}}}else{_0x231da0[_0xaa20('0x1f')](dbH['sequelize'][_0xaa20('0x18')](QUERY,{'type':dbH[_0xaa20('0x17')][_0xaa20('0x19')][_0xaa20('0x1a')]}));}var _0x50b8de=path[_0xaa20('0x21')](PATH);var _0x403168=path[_0xaa20('0x22')](PATH,_0xaa20('0x23'));var _0x4d1982=_0x2dcb10[_0xaa20('0x14')]&&_0x231da0[_0xaa20('0x24')]>0x1;var _0x1b16ca=[];if(!fs[_0xaa20('0x25')](path[_0xaa20('0x26')](_0x50b8de,_0x403168))&&_0x4d1982){fs[_0xaa20('0x27')](path[_0xaa20('0x26')](_0x50b8de,_0x403168));}return BPromise[_0xaa20('0x28')](_0x231da0,function(_0x81b232){_0x1b16ca[_0xaa20('0x1f')](_0x81b232);})['then'](function(){for(var _0xa6463b=0x0;_0xa6463b<_0x1b16ca[_0xaa20('0x24')];_0xa6463b+=0x1){var _0x5316ce;var _0x112fa4=_0x1b16ca[_0xa6463b];if(_0x4d1982){_0x5316ce=path['join'](_0x50b8de,_0x403168,util[_0xaa20('0xf')](_0xaa20('0x29'),_0x403168,_0xa6463b,_0xaa20('0x2a')));}else{_0x5316ce=path[_0xaa20('0x26')](_0x50b8de,util[_0xaa20('0xf')](_0xaa20('0x2b'),_0x403168,_0xaa20('0x2a')));}fs[_0xaa20('0x2c')](_0x5316ce,json2xls(_0x112fa4),_0xaa20('0x2d'));}})['then'](function(){if(_0x4d1982){return new Promise(function(_0xbe4263){zipdir(path[_0xaa20('0x26')](_0x50b8de,_0x403168),{'saveTo':path[_0xaa20('0x26')](_0x50b8de,util[_0xaa20('0xf')](_0xaa20('0x2b'),_0x403168,_0xaa20('0x2e')))},function(_0x303187,_0x3cf199){rimraf(path['join'](_0x50b8de,_0x403168),function(){});_0xbe4263(_0xaa20('0x2f'));});});}})['then'](function(){logger['info'](util[_0xaa20('0xf')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xaa20('0x11')));return analyticExtractedReport('Completed',_0x4d1982?util[_0xaa20('0xf')](_0xaa20('0x2b'),_0x403168,_0x4d1982?_0xaa20('0x2e'):_0xaa20('0x2a')):null);});})[_0xaa20('0x30')](function(_0x58132c){logger[_0xaa20('0xe')](util['format'](_0xaa20('0x31'),EXTRACTED_REPORT_ID,_0xaa20('0x11')),util[_0xaa20('0x32')](_0x58132c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xaa20('0x33'));})[_0xaa20('0x34')](function(){process[_0xaa20('0x35')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 1162474..e9448c8 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 _0x07e7=['filter','playback','hasOwnProperty','priority','extension','find','extensions','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','inbound','outbound','CDR(destination)=','cutdigits','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','IntervalId','map','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','lodash','util','models','Interval','then','intervals','VoiceExtension','findAll','uniq','exten'];(function(_0x12cec8,_0x24ac15){var _0x1c3259=function(_0xb5853d){while(--_0xb5853d){_0x12cec8['push'](_0x12cec8['shift']());}};_0x1c3259(++_0x24ac15);}(_0x07e7,0xce));var _0x707e=function(_0x57024d,_0xd5a35d){_0x57024d=_0x57024d-0x0;var _0x457e9a=_0x07e7[_0x57024d];return _0x457e9a;};'use strict';var _=require(_0x707e('0x0'));var util=require(_0x707e('0x1'));function rewrite(_0x2e24f4,_0x2f36ba){var _0x1771d9=this;return _0x2e24f4[_0x707e('0x2')][_0x707e('0x3')]['findAll']({'raw':!![]})[_0x707e('0x4')](function(_0x17c7d9){_0x1771d9[_0x707e('0x5')]=_0x17c7d9;return _0x2e24f4[_0x707e('0x2')][_0x707e('0x6')]['findAll']({'where':{'IntervalId':_0x2f36ba['IntervalId']},'raw':!![]});})[_0x707e('0x4')](function(_0x2faf2b){return _0x2e24f4[_0x707e('0x2')][_0x707e('0x6')][_0x707e('0x7')]({'where':{'exten':{'$in':_[_0x707e('0x8')](_['map'](_0x2faf2b,_0x707e('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x45cfdc){var _0x1836d3=_[_0x707e('0xa')](_0x45cfdc,{'priority':'1'});var _0x281f7c=_[_0x707e('0xa')](_0x45cfdc,{'isApp':0x1});var _0x514472=_['groupBy'](_0x281f7c,_0x707e('0x9'));var _0x1ef513=['queue',_0x707e('0xb')];var _0x3322ba=[];var _0x36a589=[];for(var _0x10c81e in _0x514472){if(_0x514472[_0x707e('0xc')](_0x10c81e)){_0x1771d9[_0x707e('0xd')]=0x2;_0x1771d9['extensions']=[];_0x1771d9[_0x707e('0xe')]=_[_0x707e('0xf')](_0x1836d3,{'exten':_0x514472[_0x10c81e][0x0][_0x707e('0x9')]});_0x1771d9[_0x707e('0x10')][_0x707e('0x11')]({'type':_0x514472[_0x10c81e][0x0][_0x707e('0x12')],'app':_0x707e('0x13'),'appdata':util[_0x707e('0x14')](_0x707e('0x15'),_0x514472[_0x10c81e][0x0]['type']),'context':_0x514472[_0x10c81e][0x0][_0x707e('0x16')],'exten':_0x514472[_0x10c81e][0x0]['exten'],'priority':_0x1771d9[_0x707e('0xd')]++,'VoiceExtensionId':_0x514472[_0x10c81e][0x0][_0x707e('0x17')]});if(_0x514472[_0x10c81e][0x0][_0x707e('0x12')]===_0x707e('0x18')){_0x1771d9[_0x707e('0x10')]['push']({'type':_0x514472[_0x10c81e][0x0][_0x707e('0x12')],'app':'Set','appdata':'CDR(routeid)='+_0x514472[_0x10c81e][0x0][_0x707e('0x17')],'context':_0x514472[_0x10c81e][0x0][_0x707e('0x16')],'exten':_0x514472[_0x10c81e][0x0][_0x707e('0x9')],'priority':_0x1771d9[_0x707e('0xd')]++,'VoiceExtensionId':_0x514472[_0x10c81e][0x0]['VoiceExtensionId']});}else if(_0x514472[_0x10c81e][0x0][_0x707e('0x12')]===_0x707e('0x19')){if(_0x1771d9[_0x707e('0xe')]){_0x1771d9[_0x707e('0x10')][_0x707e('0x11')]({'type':_0x514472[_0x10c81e][0x0][_0x707e('0x12')],'app':'Set','appdata':_0x707e('0x1a')+(_0x1771d9[_0x707e('0xe')][_0x707e('0x1b')]?'${EXTEN:'+_0x1771d9[_0x707e('0xe')][_0x707e('0x1b')]+'}':'${EXTEN}'),'context':_0x514472[_0x10c81e][0x0][_0x707e('0x16')],'exten':_0x514472[_0x10c81e][0x0][_0x707e('0x9')],'priority':_0x1771d9[_0x707e('0xd')]++,'VoiceExtensionId':_0x514472[_0x10c81e][0x0]['VoiceExtensionId']});}_0x1771d9[_0x707e('0x10')][_0x707e('0x11')]({'type':_0x514472[_0x10c81e][0x0][_0x707e('0x12')],'app':'Set','appdata':'CDR(routeid)='+_0x514472[_0x10c81e][0x0][_0x707e('0x17')],'context':_0x514472[_0x10c81e][0x0]['context'],'exten':_0x514472[_0x10c81e][0x0][_0x707e('0x9')],'priority':_0x1771d9[_0x707e('0xd')]++,'VoiceExtensionId':_0x514472[_0x10c81e][0x0][_0x707e('0x17')]});var _0x19810f=_0x1771d9['priority']++;_0x1771d9[_0x707e('0x10')][_0x707e('0x11')]({'type':_0x514472[_0x10c81e][0x0][_0x707e('0x12')],'app':_0x707e('0x1c'),'appdata':_0x707e('0x1d')+(_0x19810f+0x2)+_0x707e('0x1e')+(_0x19810f+0x1)+')','context':_0x514472[_0x10c81e][0x0][_0x707e('0x16')],'exten':_0x514472[_0x10c81e][0x0][_0x707e('0x9')],'priority':_0x19810f,'VoiceExtensionId':_0x514472[_0x10c81e][0x0]['VoiceExtensionId']});if(_0x1771d9['extension']){_0x1771d9[_0x707e('0x10')][_0x707e('0x11')]({'type':_0x514472[_0x10c81e][0x0][_0x707e('0x12')],'app':_0x707e('0x13'),'appdata':_0x1771d9[_0x707e('0xe')][_0x707e('0x1b')]?_0x707e('0x1f')+_0x1771d9[_0x707e('0xe')]['cutdigits']+'}':_0x707e('0x20'),'context':_0x514472[_0x10c81e][0x0][_0x707e('0x16')],'exten':_0x514472[_0x10c81e][0x0][_0x707e('0x9')],'priority':_0x1771d9[_0x707e('0xd')]++,'VoiceExtensionId':_0x514472[_0x10c81e][0x0]['VoiceExtensionId']});}_0x1771d9[_0x707e('0x10')][_0x707e('0x11')]({'type':_0x514472[_0x10c81e][0x0]['type'],'app':_0x707e('0x13'),'appdata':_0x707e('0x21')+_0x514472[_0x10c81e][0x0]['VoiceExtensionId'],'context':_0x514472[_0x10c81e][0x0][_0x707e('0x16')],'exten':_0x514472[_0x10c81e][0x0][_0x707e('0x9')],'priority':_0x1771d9[_0x707e('0xd')]++,'VoiceExtensionId':_0x514472[_0x10c81e][0x0][_0x707e('0x17')]});if(_0x1771d9[_0x707e('0xe')]&&_0x1771d9['extension'][_0x707e('0xc')](_0x707e('0x22'))&&_0x1771d9[_0x707e('0xe')][_0x707e('0x22')]!==_0x707e('0x23')){_0x1771d9[_0x707e('0x10')][_0x707e('0x11')]({'type':_0x514472[_0x10c81e][0x0][_0x707e('0x12')],'app':_0x707e('0x13'),'appdata':_0x707e('0x24'),'context':_0x514472[_0x10c81e][0x0]['context'],'exten':_0x514472[_0x10c81e][0x0]['exten'],'priority':_0x1771d9[_0x707e('0xd')]++,'VoiceExtensionId':_0x514472[_0x10c81e][0x0][_0x707e('0x17')]});_0x1771d9[_0x707e('0x10')][_0x707e('0x11')]({'type':_0x514472[_0x10c81e][0x0]['type'],'app':_0x707e('0x13'),'appdata':_0x707e('0x25')+_0x1771d9[_0x707e('0xe')]['recordingFormat']||_0x707e('0x26'),'context':_0x514472[_0x10c81e][0x0][_0x707e('0x16')],'exten':_0x514472[_0x10c81e][0x0][_0x707e('0x9')],'priority':_0x1771d9[_0x707e('0xd')]++,'VoiceExtensionId':_0x514472[_0x10c81e][0x0]['VoiceExtensionId']});}}_0x1771d9[_0x707e('0x10')]['push']({'type':_0x514472[_0x10c81e][0x0]['type'],'app':_0x707e('0x13'),'appdata':_0x707e('0x27'),'context':_0x514472[_0x10c81e][0x0][_0x707e('0x16')],'exten':_0x514472[_0x10c81e][0x0][_0x707e('0x9')],'priority':_0x1771d9['priority']++,'VoiceExtensionId':_0x514472[_0x10c81e][0x0][_0x707e('0x17')]});_0x1771d9[_0x707e('0x10')][_0x707e('0x11')]({'type':_0x514472[_0x10c81e][0x0][_0x707e('0x12')],'app':'Set','appdata':_0x707e('0x28'),'context':_0x514472[_0x10c81e][0x0]['context'],'exten':_0x514472[_0x10c81e][0x0][_0x707e('0x9')],'priority':_0x1771d9[_0x707e('0xd')]++,'VoiceExtensionId':_0x514472[_0x10c81e][0x0][_0x707e('0x17')]});_0x1771d9[_0x707e('0x10')][_0x707e('0x11')]({'type':_0x514472[_0x10c81e][0x0]['type'],'app':_0x707e('0x13'),'appdata':'MONITOR_OPTIONS=ab','context':_0x514472[_0x10c81e][0x0][_0x707e('0x16')],'exten':_0x514472[_0x10c81e][0x0][_0x707e('0x9')],'priority':_0x1771d9['priority']++,'VoiceExtensionId':_0x514472[_0x10c81e][0x0]['VoiceExtensionId']});for(var _0x4862e4=0x0,_0x4f7536=0x0;_0x4862e4<_0x514472[_0x10c81e][_0x707e('0x29')];_0x4862e4+=0x1,_0x4f7536=0x0){var _0x356e3f=_0x514472[_0x10c81e][_0x4862e4];if(_0x356e3f['type']){_0x356e3f[_0x707e('0x12')]=_0x356e3f[_0x707e('0x12')][_0x707e('0x2a')]();}var _0x292014=[];var _0x1619e1=[];delete _0x356e3f['id'];delete _0x356e3f[_0x707e('0x2b')];delete _0x356e3f[_0x707e('0x2c')];var _0x4b218a=_0x356e3f['interval']!==_0x707e('0x2d')?[_0x356e3f[_0x707e('0x2e')]]:_0x356e3f[_0x707e('0x2f')]?_[_0x707e('0x30')](_['filter'](_0x1771d9[_0x707e('0x5')],{'IntervalId':_0x356e3f[_0x707e('0x2f')]}),'interval'):[];if(_0x356e3f[_0x707e('0xc')]('tag')){if(_0x356e3f[_0x707e('0x31')]&&_0x356e3f[_0x707e('0x31')]!=='--'){_0x292014[_0x707e('0x11')]({'type':_0x356e3f[_0x707e('0x12')],'app':_0x707e('0x13'),'appdata':'CDR(tag)='+_0x356e3f['tag'],'context':_0x356e3f[_0x707e('0x16')],'exten':_0x356e3f['exten'],'priority':_0x4b218a[_0x707e('0x29')]+_0x1771d9['priority']+_0x4f7536++,'VoiceExtensionId':_0x356e3f[_0x707e('0x17')]});}}if(_0x356e3f[_0x707e('0x12')]==='outbound'&&_0x356e3f['hasOwnProperty'](_0x707e('0x32'))){if(_0x356e3f[_0x707e('0x32')]){_0x292014[_0x707e('0x11')]({'type':_0x356e3f[_0x707e('0x12')],'app':_0x707e('0x1c'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x356e3f[_0x707e('0x32')]+')','context':_0x356e3f[_0x707e('0x16')],'exten':_0x356e3f['exten'],'priority':_0x4b218a[_0x707e('0x29')]+_0x1771d9[_0x707e('0xd')]+_0x4f7536++,'VoiceExtensionId':_0x356e3f[_0x707e('0x17')]});}else{_0x292014[_0x707e('0x11')]({'type':_0x356e3f[_0x707e('0x12')],'app':_0x707e('0x1c'),'appdata':_0x707e('0x33'),'context':_0x356e3f[_0x707e('0x16')],'exten':_0x356e3f[_0x707e('0x9')],'priority':_0x4b218a[_0x707e('0x29')]+_0x1771d9[_0x707e('0xd')]+_0x4f7536++,'VoiceExtensionId':_0x356e3f['VoiceExtensionId']});}}if(_0x356e3f[_0x707e('0xc')](_0x707e('0x34'))){if(_0x1ef513[_0x707e('0x35')](_0x356e3f[_0x707e('0x36')][_0x707e('0x2a')]())>=0x0&&_0x356e3f[_0x707e('0x37')]!==_0x707e('0x38')){if(_0x356e3f[_0x707e('0x34')]){_0x292014[_0x707e('0x11')]({'type':_0x356e3f[_0x707e('0x12')],'app':_0x707e('0x1c'),'appdata':_0x707e('0x39'),'context':_0x356e3f[_0x707e('0x16')],'exten':_0x356e3f[_0x707e('0x9')],'priority':_0x4b218a['length']+_0x1771d9[_0x707e('0xd')]+_0x4f7536++,'VoiceExtensionId':_0x356e3f[_0x707e('0x17')]});_0x292014[_0x707e('0x11')]({'type':_0x356e3f['type'],'app':_0x707e('0x13'),'appdata':_0x707e('0x3a'),'context':_0x356e3f['context'],'exten':_0x356e3f[_0x707e('0x9')],'priority':_0x4b218a[_0x707e('0x29')]+_0x1771d9[_0x707e('0xd')]+_0x4f7536++,'VoiceExtensionId':_0x356e3f['VoiceExtensionId']});}else{_0x292014['push']({'type':_0x356e3f[_0x707e('0x12')],'app':'ExecIf','appdata':_0x707e('0x3b'),'context':_0x356e3f[_0x707e('0x16')],'exten':_0x356e3f['exten'],'priority':_0x4b218a[_0x707e('0x29')]+_0x1771d9[_0x707e('0xd')]+_0x4f7536++,'VoiceExtensionId':_0x356e3f[_0x707e('0x17')]});_0x292014[_0x707e('0x11')]({'type':_0x356e3f[_0x707e('0x12')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x356e3f[_0x707e('0x16')],'exten':_0x356e3f['exten'],'priority':_0x4b218a[_0x707e('0x29')]+_0x1771d9['priority']+_0x4f7536++,'VoiceExtensionId':_0x356e3f[_0x707e('0x17')]});}}}for(var _0x29c187=0x0;_0x29c187<_0x4b218a[_0x707e('0x29')];_0x29c187+=0x1){var _0x5996c2=_0x1771d9[_0x707e('0xd')]+_0x4b218a['length'];var _0x3dca45=_0x29c187===_0x4b218a[_0x707e('0x29')]-0x1?_0x1771d9[_0x707e('0xd')]+_0x292014[_0x707e('0x29')]+_0x1619e1[_0x707e('0x29')]+0x2:_0x1771d9['priority']+_0x29c187+0x1;_0x292014[_0x707e('0x3c')](_0x29c187,0x0,{'type':_0x356e3f[_0x707e('0x12')],'app':_0x707e('0x3d'),'appdata':_0x4b218a[_0x29c187]+'?'+_0x356e3f[_0x707e('0x16')]+_0x707e('0x3e')+_0x5996c2+':'+_0x356e3f[_0x707e('0x16')]+_0x707e('0x3e')+_0x3dca45,'exten':_0x356e3f[_0x707e('0x9')],'context':_0x356e3f[_0x707e('0x16')],'priority':_0x1771d9['priority']+_0x29c187,'VoiceExtensionId':_0x514472[_0x10c81e][0x0][_0x707e('0x17')]});}_0x356e3f[_0x707e('0xd')]=_0x292014[_0x707e('0x29')]?_[_0x707e('0x3f')](_0x292014)[_0x707e('0xd')]+0x1:_0x1771d9[_0x707e('0xd')];_0x1771d9[_0x707e('0xd')]=(_0x1619e1[_0x707e('0x29')]?_[_0x707e('0x3f')](_0x1619e1)[_0x707e('0xd')]:_0x356e3f[_0x707e('0xd')])+0x1;_0x1771d9[_0x707e('0x10')]=_[_0x707e('0x40')](_0x1771d9['extensions'],_0x292014,[_0x356e3f],_0x1619e1);}_0x1771d9[_0x707e('0x10')]['push']({'type':_0x514472[_0x10c81e][0x0][_0x707e('0x12')],'app':_0x707e('0x41'),'exten':_0x514472[_0x10c81e][0x0]['exten'],'context':_0x514472[_0x10c81e][0x0][_0x707e('0x16')],'priority':_0x1771d9['priority'],'VoiceExtensionId':_0x514472[_0x10c81e][0x0][_0x707e('0x17')]});_0x3322ba['push'](_0x514472[_0x10c81e][0x0][_0x707e('0x17')]);_0x36a589=_[_0x707e('0x40')](_0x36a589,_0x1771d9['extensions']);}}return _0x2e24f4[_0x707e('0x42')](function(_0x3bb5cb){return _0x2e24f4[_0x707e('0x2')]['VoiceExtension'][_0x707e('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x3322ba}},'transaction':_0x3bb5cb})[_0x707e('0x4')](function(_0x46af0d){return _0x2e24f4['models'][_0x707e('0x6')][_0x707e('0x44')](_[_0x707e('0x45')](_0x36a589,_0x707e('0xd')),{'transaction':_0x3bb5cb});});});})[_0x707e('0x46')](function(_0x437bae){console[_0x707e('0x47')](_0x437bae);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0xb2c5=['type','format','VoiceExtensionId','Set','CDR(routeid)=','context','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','length','createdAt','updatedAt','interval','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','catch','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extensions','extension','find','push'];(function(_0xcab889,_0x51d667){var _0x4f956e=function(_0x54f7d7){while(--_0x54f7d7){_0xcab889['push'](_0xcab889['shift']());}};_0x4f956e(++_0x51d667);}(_0xb2c5,0x14d));var _0x5b2c=function(_0x4eb832,_0x324bff){_0x4eb832=_0x4eb832-0x0;var _0x2e5927=_0xb2c5[_0x4eb832];return _0x2e5927;};'use strict';var _=require(_0x5b2c('0x0'));var util=require(_0x5b2c('0x1'));function rewrite(_0x4888c5,_0x34bac5){var _0x55eb12=this;return _0x4888c5[_0x5b2c('0x2')][_0x5b2c('0x3')][_0x5b2c('0x4')]({'raw':!![]})[_0x5b2c('0x5')](function(_0x3f8ed2){_0x55eb12[_0x5b2c('0x6')]=_0x3f8ed2;return _0x4888c5[_0x5b2c('0x2')][_0x5b2c('0x7')][_0x5b2c('0x4')]({'where':{'IntervalId':_0x34bac5[_0x5b2c('0x8')]},'raw':!![]});})[_0x5b2c('0x5')](function(_0x3eb21c){return _0x4888c5[_0x5b2c('0x2')][_0x5b2c('0x7')][_0x5b2c('0x4')]({'where':{'exten':{'$in':_[_0x5b2c('0x9')](_[_0x5b2c('0xa')](_0x3eb21c,_0x5b2c('0xb')))}},'order':[{'raw':_0x5b2c('0xc')}],'raw':!![]});})['then'](function(_0x218a1d){var _0x19c0d8=_[_0x5b2c('0xd')](_0x218a1d,{'priority':'1'});var _0x263a02=_[_0x5b2c('0xd')](_0x218a1d,{'isApp':0x1});var _0x1b29d9=_[_0x5b2c('0xe')](_0x263a02,'exten');var _0x2f2aa9=[_0x5b2c('0xf'),_0x5b2c('0x10')];var _0x276693=[];var _0x3007dd=[];for(var _0xc6a8f9 in _0x1b29d9){if(_0x1b29d9['hasOwnProperty'](_0xc6a8f9)){_0x55eb12[_0x5b2c('0x11')]=0x2;_0x55eb12[_0x5b2c('0x12')]=[];_0x55eb12[_0x5b2c('0x13')]=_[_0x5b2c('0x14')](_0x19c0d8,{'exten':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0xb')]});_0x55eb12[_0x5b2c('0x12')][_0x5b2c('0x15')]({'type':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')],'app':'Set','appdata':util[_0x5b2c('0x17')]('CDR(type)=%s',_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')]),'context':_0x1b29d9[_0xc6a8f9][0x0]['context'],'exten':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0xb')],'priority':_0x55eb12[_0x5b2c('0x11')]++,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x18')]});if(_0x1b29d9[_0xc6a8f9][0x0]['type']==='inbound'){_0x55eb12[_0x5b2c('0x12')][_0x5b2c('0x15')]({'type':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')],'app':_0x5b2c('0x19'),'appdata':_0x5b2c('0x1a')+_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x18')],'context':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x1b')],'exten':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0xb')],'priority':_0x55eb12['priority']++,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x18')]});}else if(_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')]===_0x5b2c('0x1c')){if(_0x55eb12['extension']){_0x55eb12[_0x5b2c('0x12')][_0x5b2c('0x15')]({'type':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')],'app':'Set','appdata':_0x5b2c('0x1d')+(_0x55eb12[_0x5b2c('0x13')][_0x5b2c('0x1e')]?_0x5b2c('0x1f')+_0x55eb12[_0x5b2c('0x13')]['cutdigits']+'}':_0x5b2c('0x20')),'context':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x1b')],'exten':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0xb')],'priority':_0x55eb12[_0x5b2c('0x11')]++,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0]['VoiceExtensionId']});}_0x55eb12['extensions']['push']({'type':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')],'app':_0x5b2c('0x19'),'appdata':_0x5b2c('0x1a')+_0x1b29d9[_0xc6a8f9][0x0]['VoiceExtensionId'],'context':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x1b')],'exten':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0xb')],'priority':_0x55eb12[_0x5b2c('0x11')]++,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x18')]});var _0x3952b0=_0x55eb12['priority']++;_0x55eb12[_0x5b2c('0x12')]['push']({'type':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')],'app':'ExecIf','appdata':_0x5b2c('0x21')+(_0x3952b0+0x2)+_0x5b2c('0x22')+(_0x3952b0+0x1)+')','context':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x1b')],'exten':_0x1b29d9[_0xc6a8f9][0x0]['exten'],'priority':_0x3952b0,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x18')]});if(_0x55eb12[_0x5b2c('0x13')]){_0x55eb12['extensions']['push']({'type':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')],'app':_0x5b2c('0x19'),'appdata':_0x55eb12[_0x5b2c('0x13')][_0x5b2c('0x1e')]?'CDR(prefix)=${EXTEN:0:'+_0x55eb12[_0x5b2c('0x13')][_0x5b2c('0x1e')]+'}':_0x5b2c('0x23'),'context':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x1b')],'exten':_0x1b29d9[_0xc6a8f9][0x0]['exten'],'priority':_0x55eb12[_0x5b2c('0x11')]++,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0]['VoiceExtensionId']});}_0x55eb12[_0x5b2c('0x12')][_0x5b2c('0x15')]({'type':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')],'app':'Set','appdata':_0x5b2c('0x24')+_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x18')],'context':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x1b')],'exten':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0xb')],'priority':_0x55eb12[_0x5b2c('0x11')]++,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0]['VoiceExtensionId']});if(_0x55eb12['extension']&&_0x55eb12[_0x5b2c('0x13')][_0x5b2c('0x25')](_0x5b2c('0x26'))&&_0x55eb12[_0x5b2c('0x13')][_0x5b2c('0x26')]!==_0x5b2c('0x27')){_0x55eb12[_0x5b2c('0x12')][_0x5b2c('0x15')]({'type':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')],'app':_0x5b2c('0x19'),'appdata':_0x5b2c('0x28'),'context':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x1b')],'exten':_0x1b29d9[_0xc6a8f9][0x0]['exten'],'priority':_0x55eb12[_0x5b2c('0x11')]++,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x18')]});_0x55eb12[_0x5b2c('0x12')][_0x5b2c('0x15')]({'type':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')],'app':'Set','appdata':_0x5b2c('0x29')+_0x55eb12['extension'][_0x5b2c('0x26')]||_0x5b2c('0x2a'),'context':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x1b')],'exten':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0xb')],'priority':_0x55eb12['priority']++,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0]['VoiceExtensionId']});}}_0x55eb12[_0x5b2c('0x12')]['push']({'type':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')],'app':_0x5b2c('0x19'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x1b')],'exten':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0xb')],'priority':_0x55eb12[_0x5b2c('0x11')]++,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x18')]});_0x55eb12[_0x5b2c('0x12')]['push']({'type':_0x1b29d9[_0xc6a8f9][0x0]['type'],'app':_0x5b2c('0x19'),'appdata':_0x5b2c('0x2b'),'context':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x1b')],'exten':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0xb')],'priority':_0x55eb12['priority']++,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x18')]});_0x55eb12[_0x5b2c('0x12')][_0x5b2c('0x15')]({'type':_0x1b29d9[_0xc6a8f9][0x0]['type'],'app':_0x5b2c('0x19'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x1b')],'exten':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0xb')],'priority':_0x55eb12[_0x5b2c('0x11')]++,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x18')]});for(var _0x973339=0x0,_0x2c2c86=0x0;_0x973339<_0x1b29d9[_0xc6a8f9][_0x5b2c('0x2c')];_0x973339+=0x1,_0x2c2c86=0x0){var _0x3750f9=_0x1b29d9[_0xc6a8f9][_0x973339];if(_0x3750f9[_0x5b2c('0x16')]){_0x3750f9['type']=_0x3750f9['type']['toLowerCase']();}var _0x5747b9=[];var _0x52666b=[];delete _0x3750f9['id'];delete _0x3750f9[_0x5b2c('0x2d')];delete _0x3750f9[_0x5b2c('0x2e')];var _0x491033=_0x3750f9[_0x5b2c('0x2f')]!=='*,*,*,*'?[_0x3750f9['interval']]:_0x3750f9[_0x5b2c('0x8')]?_[_0x5b2c('0xa')](_[_0x5b2c('0xd')](_0x55eb12[_0x5b2c('0x6')],{'IntervalId':_0x3750f9[_0x5b2c('0x8')]}),'interval'):[];if(_0x3750f9[_0x5b2c('0x25')]('tag')){if(_0x3750f9[_0x5b2c('0x30')]&&_0x3750f9[_0x5b2c('0x30')]!=='--'){_0x5747b9[_0x5b2c('0x15')]({'type':_0x3750f9[_0x5b2c('0x16')],'app':'Set','appdata':_0x5b2c('0x31')+_0x3750f9['tag'],'context':_0x3750f9[_0x5b2c('0x1b')],'exten':_0x3750f9[_0x5b2c('0xb')],'priority':_0x491033['length']+_0x55eb12['priority']+_0x2c2c86++,'VoiceExtensionId':_0x3750f9[_0x5b2c('0x18')]});}}if(_0x3750f9['type']===_0x5b2c('0x1c')&&_0x3750f9['hasOwnProperty'](_0x5b2c('0x32'))){if(_0x3750f9[_0x5b2c('0x32')]){_0x5747b9['push']({'type':_0x3750f9[_0x5b2c('0x16')],'app':_0x5b2c('0x33'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x3750f9['callerID']+')','context':_0x3750f9[_0x5b2c('0x1b')],'exten':_0x3750f9[_0x5b2c('0xb')],'priority':_0x491033[_0x5b2c('0x2c')]+_0x55eb12[_0x5b2c('0x11')]+_0x2c2c86++,'VoiceExtensionId':_0x3750f9[_0x5b2c('0x18')]});}else{_0x5747b9['push']({'type':_0x3750f9[_0x5b2c('0x16')],'app':_0x5b2c('0x33'),'appdata':_0x5b2c('0x34'),'context':_0x3750f9[_0x5b2c('0x1b')],'exten':_0x3750f9[_0x5b2c('0xb')],'priority':_0x491033[_0x5b2c('0x2c')]+_0x55eb12['priority']+_0x2c2c86++,'VoiceExtensionId':_0x3750f9['VoiceExtensionId']});}}if(_0x3750f9[_0x5b2c('0x25')](_0x5b2c('0x35'))){if(_0x2f2aa9[_0x5b2c('0x36')](_0x3750f9[_0x5b2c('0x37')][_0x5b2c('0x38')]())>=0x0&&_0x3750f9[_0x5b2c('0x39')]!==_0x5b2c('0x3a')){if(_0x3750f9['answer']){_0x5747b9[_0x5b2c('0x15')]({'type':_0x3750f9[_0x5b2c('0x16')],'app':_0x5b2c('0x33'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x3750f9['context'],'exten':_0x3750f9[_0x5b2c('0xb')],'priority':_0x491033[_0x5b2c('0x2c')]+_0x55eb12[_0x5b2c('0x11')]+_0x2c2c86++,'VoiceExtensionId':_0x3750f9[_0x5b2c('0x18')]});_0x5747b9[_0x5b2c('0x15')]({'type':_0x3750f9[_0x5b2c('0x16')],'app':_0x5b2c('0x19'),'appdata':_0x5b2c('0x3b'),'context':_0x3750f9['context'],'exten':_0x3750f9[_0x5b2c('0xb')],'priority':_0x491033[_0x5b2c('0x2c')]+_0x55eb12[_0x5b2c('0x11')]+_0x2c2c86++,'VoiceExtensionId':_0x3750f9['VoiceExtensionId']});}else{_0x5747b9[_0x5b2c('0x15')]({'type':_0x3750f9[_0x5b2c('0x16')],'app':'ExecIf','appdata':_0x5b2c('0x3c'),'context':_0x3750f9[_0x5b2c('0x1b')],'exten':_0x3750f9[_0x5b2c('0xb')],'priority':_0x491033[_0x5b2c('0x2c')]+_0x55eb12[_0x5b2c('0x11')]+_0x2c2c86++,'VoiceExtensionId':_0x3750f9[_0x5b2c('0x18')]});_0x5747b9[_0x5b2c('0x15')]({'type':_0x3750f9[_0x5b2c('0x16')],'app':_0x5b2c('0x19'),'appdata':_0x5b2c('0x3d'),'context':_0x3750f9[_0x5b2c('0x1b')],'exten':_0x3750f9[_0x5b2c('0xb')],'priority':_0x491033[_0x5b2c('0x2c')]+_0x55eb12[_0x5b2c('0x11')]+_0x2c2c86++,'VoiceExtensionId':_0x3750f9[_0x5b2c('0x18')]});}}}for(var _0x47df7d=0x0;_0x47df7d<_0x491033[_0x5b2c('0x2c')];_0x47df7d+=0x1){var _0x49451e=_0x55eb12['priority']+_0x491033[_0x5b2c('0x2c')];var _0x449fd4=_0x47df7d===_0x491033['length']-0x1?_0x55eb12[_0x5b2c('0x11')]+_0x5747b9[_0x5b2c('0x2c')]+_0x52666b['length']+0x2:_0x55eb12[_0x5b2c('0x11')]+_0x47df7d+0x1;_0x5747b9['splice'](_0x47df7d,0x0,{'type':_0x3750f9[_0x5b2c('0x16')],'app':_0x5b2c('0x3e'),'appdata':_0x491033[_0x47df7d]+'?'+_0x3750f9['context']+_0x5b2c('0x3f')+_0x49451e+':'+_0x3750f9[_0x5b2c('0x1b')]+_0x5b2c('0x3f')+_0x449fd4,'exten':_0x3750f9['exten'],'context':_0x3750f9[_0x5b2c('0x1b')],'priority':_0x55eb12[_0x5b2c('0x11')]+_0x47df7d,'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x18')]});}_0x3750f9[_0x5b2c('0x11')]=_0x5747b9[_0x5b2c('0x2c')]?_[_0x5b2c('0x40')](_0x5747b9)['priority']+0x1:_0x55eb12['priority'];_0x55eb12[_0x5b2c('0x11')]=(_0x52666b[_0x5b2c('0x2c')]?_['last'](_0x52666b)[_0x5b2c('0x11')]:_0x3750f9['priority'])+0x1;_0x55eb12[_0x5b2c('0x12')]=_[_0x5b2c('0x41')](_0x55eb12[_0x5b2c('0x12')],_0x5747b9,[_0x3750f9],_0x52666b);}_0x55eb12[_0x5b2c('0x12')][_0x5b2c('0x15')]({'type':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x16')],'app':'Hangup','exten':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0xb')],'context':_0x1b29d9[_0xc6a8f9][0x0][_0x5b2c('0x1b')],'priority':_0x55eb12[_0x5b2c('0x11')],'VoiceExtensionId':_0x1b29d9[_0xc6a8f9][0x0]['VoiceExtensionId']});_0x276693[_0x5b2c('0x15')](_0x1b29d9[_0xc6a8f9][0x0]['VoiceExtensionId']);_0x3007dd=_['concat'](_0x3007dd,_0x55eb12['extensions']);}}return _0x4888c5[_0x5b2c('0x42')](function(_0x1cc4a6){return _0x4888c5['models'][_0x5b2c('0x7')][_0x5b2c('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x276693}},'transaction':_0x1cc4a6})[_0x5b2c('0x5')](function(_0x5d8001){return _0x4888c5[_0x5b2c('0x2')][_0x5b2c('0x7')][_0x5b2c('0x44')](_['sortBy'](_0x3007dd,_0x5b2c('0x11')),{'transaction':_0x1cc4a6});});});})[_0x5b2c('0x45')](function(_0x5959c6){console['error'](_0x5959c6);});}exports[_0x5b2c('0x46')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 9ab834e..085badc 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 _0x4bfc=['birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','then','pick','Error\x20while\x20creating\x20contact:\x20','message','checkHopper','insert','ContactId','createdAt','select','field','NOW()','scheduledAt','toString','updatedAt','from','cm_contacts','where','ListId\x20=\x20?','cm_hopper','\x20=\x20?','into','fromQuery','deletedAt\x20IS\x20NULL','str','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','cm_hopper_black','id\x20IN\x20?','VoiceQueue','findAll','outbound','dialCheckDuplicateType','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','catch','push','all','CmList','BlackLists','Lists','CampaignId','Campaign','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','api','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','split','Missing\x20socket_timestamp\x20parameter!','contact','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD'];(function(_0x88567a,_0xe8d3e5){var _0x34cfa8=function(_0x2c82cc){while(--_0x2c82cc){_0x88567a['push'](_0x88567a['shift']());}};_0x34cfa8(++_0xe8d3e5);}(_0x4bfc,0x1e5));var _0xc4bf=function(_0x59d881,_0x183f30){_0x59d881=_0x59d881-0x0;var _0x2c4605=_0x4bfc[_0x59d881];return _0x2c4605;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xc4bf('0x0'));var fs=require('fs');var squel=require(_0xc4bf('0x1'));var Papa=require(_0xc4bf('0x2'));var Redis=require('ioredis');var db=require(_0xc4bf('0x3'))['db'];var config=require(_0xc4bf('0x4'));var logger=require('../../../config/logger')(_0xc4bf('0x5'));config[_0xc4bf('0x6')]=_[_0xc4bf('0x7')](config[_0xc4bf('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xc4bf('0x8'))(new Redis(config[_0xc4bf('0x6')]));require(_0xc4bf('0x9'))[_0xc4bf('0xa')](socket);try{if(!process['argv'][0x2]||process[_0xc4bf('0xb')][0x2]===_0xc4bf('0xc')||process[_0xc4bf('0xb')][0x2]==='null'){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0xc4bf('0xb')][0x2];if(!process[_0xc4bf('0xb')][0x3]||process['argv'][0x3]===_0xc4bf('0xc')||process['argv'][0x3]===_0xc4bf('0xd')||!process['argv'][0x4]||process[_0xc4bf('0xb')][0x4]===_0xc4bf('0xc')||process['argv'][0x4]===_0xc4bf('0xd')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_['zipObject'](process['argv'][0x3][_0xc4bf('0xe')](','),process[_0xc4bf('0xb')][0x4][_0xc4bf('0xe')](','));if(!process[_0xc4bf('0xb')][0x5]||process[_0xc4bf('0xb')][0x5]==='undefined'||process[_0xc4bf('0xb')][0x5]===_0xc4bf('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xc4bf('0xb')][0x5];var COMPANYID=process[_0xc4bf('0xb')][0x6]&&process[_0xc4bf('0xb')][0x6]!==_0xc4bf('0xc')&&process[_0xc4bf('0xb')][0x6]!==_0xc4bf('0xd')?process['argv'][0x6]:null;var DUPLICATES=process[_0xc4bf('0xb')][0x7]&&process[_0xc4bf('0xb')][0x7]!==_0xc4bf('0xc')&&process[_0xc4bf('0xb')][0x7]!==_0xc4bf('0xd')?process[_0xc4bf('0xb')][0x7]:null;if(!process[_0xc4bf('0xb')][0x8]||process[_0xc4bf('0xb')][0x8]===_0xc4bf('0xc')||process[_0xc4bf('0xb')][0x8]===_0xc4bf('0xd')){throw new Error(_0xc4bf('0xf'));}var SOCKET_TIMESTAMP=process[_0xc4bf('0xb')][0x8];}catch(_0x4e0ba9){logger['error'](_0x4e0ba9);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(_0x3d0801,_0x5d334c,_0x4f9b0c,_0x1c3fcf){var _0x2f832c={'message':_0x5d334c};_0x2f832c[_0x3d0801]=!![];if(_0x4f9b0c){_0x2f832c[_0xc4bf('0x10')]=_0x4f9b0c;}if(_0x1c3fcf){_0x2f832c['index']=_0x1c3fcf;}return _0x2f832c;}function isEmail(_0x3d3562){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'](_0x3d3562);}function checkRow(_0x122ca2,_0x3c6422,_0x273531){return new BPromise(function(_0x544850,_0x3ed85a){if(_[_0xc4bf('0x11')](_0x122ca2)){return _0x3ed85a(handleCheckRowError(_0xc4bf('0x12'),_0xc4bf('0x13'),null,_0x273531));}if(_0x122ca2[_0xc4bf('0x14')]&&_0x122ca2[_0xc4bf('0x14')][_0xc4bf('0x15')]){var _0x42bcbd=_['map'](_0x122ca2['errors'],'message')[_0xc4bf('0x16')](';');return _0x3ed85a(handleCheckRowError('error',_0x42bcbd,null,_0x273531));}var _0x5ad61f={};for(var _0x5b7c51 in FIELDS){if(FIELDS[_0xc4bf('0x17')](_0x5b7c51)&&FIELDS[_0x5b7c51]){_0x5ad61f[_0x5b7c51]=_0x122ca2[_0xc4bf('0x18')][0x0][FIELDS[_0x5b7c51]]||_0x122ca2[_0xc4bf('0x18')][0x0]['\ufeff'+FIELDS[_0x5b7c51]];}}if(!_0x5ad61f[_0xc4bf('0x19')]){return _0x3ed85a(handleCheckRowError(_0xc4bf('0x12'),_0xc4bf('0x1a'),null,_0x273531));}if(!_0x5ad61f[_0xc4bf('0x1b')]){return _0x3ed85a(handleCheckRowError(_0xc4bf('0x12'),'phone\x20not\x20specified!',null,_0x273531));}if(_0x5ad61f[_0xc4bf('0x1c')]){var _0x41a5c3=moment(_0x5ad61f[_0xc4bf('0x1c')],_0xc4bf('0x1d'));if(!_0x41a5c3['isValid']()){return _0x3ed85a(handleCheckRowError(_0xc4bf('0x12'),_0xc4bf('0x1e'),null,_0x273531));}}if(_0x5ad61f[_0xc4bf('0x1f')]){if(!isEmail(_0x5ad61f[_0xc4bf('0x1f')])){return _0x3ed85a(handleCheckRowError(_0xc4bf('0x12'),_0xc4bf('0x20'),null,_0x273531));}}_0x5ad61f[_0xc4bf('0x21')]=LISTID;_0x5ad61f[_0xc4bf('0x22')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x3c6422){var _0x29ebf6={};for(var _0x49300e=0x0,_0x1f5ff4=DUPLICATES[_0xc4bf('0x15')];_0x49300e<_0x1f5ff4;_0x49300e+=0x1){_0x29ebf6[DUPLICATES[_0x49300e]]=_0x5ad61f[DUPLICATES[_0x49300e]];}var _0x19b474=_[_0xc4bf('0x23')](_0x3c6422,_0x29ebf6);if(_0x19b474){return _0x3ed85a(handleCheckRowError(_0xc4bf('0x24'),_0xc4bf('0x25'),_0x19b474,_0x273531));}}return db[_0xc4bf('0x26')]['create'](_0x5ad61f,{'raw':!![],'hooks':![],'fields':_['keys'](_0x5ad61f)})[_0xc4bf('0x27')](function(_0x76c98c){if(DUPLICATES&&DUPLICATES[_0xc4bf('0x15')]&&_0x3c6422){_0x3c6422['push'](_[_0xc4bf('0x28')](_0x5ad61f,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x76c98c['id'];return _0x544850();})['catch'](function(_0x2ea2cf){return _0x3ed85a(handleCheckRowError('error',_0xc4bf('0x29')+(_0x2ea2cf[_0xc4bf('0x2a')]||JSON['stringify'](_0x2ea2cf)),null,_0x273531));});});}function checkHopper(){function _0x2a124f(){return function(_0xc79b89){logger['error']('cmContact',_0xc4bf('0x2b'),util['inspect'](_0xc79b89,{'showHidden':![],'depth':null}));};}var _0x3b6fab=function(_0x1edb3d,_0x19ee12){var _0x240d2a=squel[_0xc4bf('0x2c')]()['into']('cm_hopper')['fromQuery']([_0xc4bf('0x1b'),'scheduledAt',_0xc4bf('0x2d'),'ListId',_0x19ee12,_0xc4bf('0x2e'),'updatedAt'],squel[_0xc4bf('0x2f')]()[_0xc4bf('0x30')]('phone','phone')[_0xc4bf('0x30')](_0xc4bf('0x31'),_0xc4bf('0x32'))[_0xc4bf('0x30')]('id','ContactId')[_0xc4bf('0x30')](LISTID[_0xc4bf('0x33')](),_0xc4bf('0x21'))[_0xc4bf('0x30')](_0x1edb3d['id'][_0xc4bf('0x33')](),_0x19ee12)[_0xc4bf('0x30')](_0xc4bf('0x31'),'createdAt')[_0xc4bf('0x30')](_0xc4bf('0x31'),_0xc4bf('0x34'))[_0xc4bf('0x35')](_0xc4bf('0x36'))[_0xc4bf('0x37')]('deletedAt\x20IS\x20NULL')[_0xc4bf('0x37')](_0xc4bf('0x38'),LISTID['toString']())[_0xc4bf('0x37')]('phone\x20IS\x20NOT\x20NULL')[_0xc4bf('0x37')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc4bf('0x2f')]()[_0xc4bf('0x30')](_0xc4bf('0x1b'))[_0xc4bf('0x35')](_0xc4bf('0x39'))['where'](_0x19ee12+_0xc4bf('0x3a'),_0x1edb3d['id']['toString']())))[_0xc4bf('0x33')]();return _0x240d2a;};var _0x1485a0=function(_0x275c86,_0x4ded8f){var _0x4a8546=squel[_0xc4bf('0x2c')]()[_0xc4bf('0x3b')](_0xc4bf('0x39'))[_0xc4bf('0x3c')]([_0xc4bf('0x1b'),_0xc4bf('0x32'),_0xc4bf('0x2d'),_0xc4bf('0x21'),_0x4ded8f,_0xc4bf('0x2e'),_0xc4bf('0x34')],squel[_0xc4bf('0x2f')]()['field'](_0xc4bf('0x1b'),_0xc4bf('0x1b'))[_0xc4bf('0x30')](_0xc4bf('0x31'),_0xc4bf('0x32'))[_0xc4bf('0x30')]('id','ContactId')[_0xc4bf('0x30')](LISTID['toString'](),'ListId')[_0xc4bf('0x30')](_0x275c86['id'][_0xc4bf('0x33')](),_0x4ded8f)[_0xc4bf('0x30')](_0xc4bf('0x31'),_0xc4bf('0x2e'))[_0xc4bf('0x30')]('NOW()',_0xc4bf('0x34'))[_0xc4bf('0x35')](_0xc4bf('0x36'))[_0xc4bf('0x37')](_0xc4bf('0x3d'))[_0xc4bf('0x37')](_0xc4bf('0x38'),LISTID[_0xc4bf('0x33')]())[_0xc4bf('0x37')]('id\x20IN\x20?',squel[_0xc4bf('0x3e')](hopperContacts))['where'](_0xc4bf('0x3f'))[_0xc4bf('0x37')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc4bf('0x2f')]()[_0xc4bf('0x30')]('calleridnum')[_0xc4bf('0x35')](_0xc4bf('0x40'))[_0xc4bf('0x37')](_0x4ded8f+_0xc4bf('0x3a'),_0x275c86['id']['toString']()))['where'](_0xc4bf('0x41'),squel[_0xc4bf('0x2f')]()[_0xc4bf('0x30')](_0xc4bf('0x1b'))[_0xc4bf('0x35')](_0xc4bf('0x39'))[_0xc4bf('0x37')](_0x4ded8f+_0xc4bf('0x3a'),_0x275c86['id'][_0xc4bf('0x33')]())))[_0xc4bf('0x33')]();return _0x4a8546;};function _0x4c08ec(_0xf35430,_0x446f8b){var _0x3a7db9=squel['insert']()[_0xc4bf('0x3b')](_0xc4bf('0x39'))[_0xc4bf('0x3c')]([_0xc4bf('0x1b'),_0xc4bf('0x32'),_0xc4bf('0x2d'),'ListId',_0x446f8b,_0xc4bf('0x2e'),_0xc4bf('0x34')],squel[_0xc4bf('0x2f')]()[_0xc4bf('0x30')](_0xc4bf('0x1b'),_0xc4bf('0x1b'))[_0xc4bf('0x30')](_0xc4bf('0x31'),_0xc4bf('0x32'))[_0xc4bf('0x30')]('id','ContactId')['field'](LISTID[_0xc4bf('0x33')](),_0xc4bf('0x21'))[_0xc4bf('0x30')](_0xf35430['id']['toString'](),_0x446f8b)[_0xc4bf('0x30')](_0xc4bf('0x31'),_0xc4bf('0x2e'))[_0xc4bf('0x30')]('NOW()','updatedAt')[_0xc4bf('0x35')](_0xc4bf('0x36'))[_0xc4bf('0x37')](_0xc4bf('0x3d'))[_0xc4bf('0x37')](_0xc4bf('0x38'),LISTID[_0xc4bf('0x33')]())['where']('id\x20IN\x20?',squel['str'](hopperContacts))['where'](_0xc4bf('0x3f')))[_0xc4bf('0x33')]();return _0x3a7db9;}function _0x1163ef(_0x752d41,_0x61e873){var _0x3bf578=squel[_0xc4bf('0x2c')]()['into'](_0xc4bf('0x42'))[_0xc4bf('0x3c')]([_0xc4bf('0x1b'),_0xc4bf('0x2d'),_0xc4bf('0x21'),_0x61e873,'createdAt',_0xc4bf('0x34')],squel[_0xc4bf('0x2f')]()[_0xc4bf('0x30')]('phone',_0xc4bf('0x1b'))[_0xc4bf('0x30')]('id','ContactId')['field'](LISTID[_0xc4bf('0x33')](),'ListId')['field'](_0x752d41['id'][_0xc4bf('0x33')](),_0x61e873)[_0xc4bf('0x30')](_0xc4bf('0x31'),_0xc4bf('0x2e'))['field'](_0xc4bf('0x31'),_0xc4bf('0x34'))[_0xc4bf('0x35')](_0xc4bf('0x36'))['where']('deletedAt\x20IS\x20NULL')[_0xc4bf('0x37')](_0xc4bf('0x38'),LISTID['toString']())[_0xc4bf('0x37')](_0xc4bf('0x43'),squel[_0xc4bf('0x3e')](hopperContacts))[_0xc4bf('0x37')]('phone\x20IS\x20NOT\x20NULL'))[_0xc4bf('0x33')]();return _0x3bf578;}return db[_0xc4bf('0x44')][_0xc4bf('0x45')]({'where':{'type':_0xc4bf('0x46')},'attributes':['id',_0xc4bf('0x47')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xc4bf('0x27')](function(_0x18fab4){var _0x2b51d8=[];if(_0x18fab4){var _0x5a0b7a;for(var _0x572ad7=0x0,_0x1f68e2;_0x572ad7<_0x18fab4['length'];_0x572ad7+=0x1){_0x1f68e2=_0x18fab4[_0x572ad7][_0xc4bf('0x48')]({'plain':!![]});switch(_0x1f68e2[_0xc4bf('0x47')]){case _0xc4bf('0x49'):_0x2b51d8['push'](db['sequelize'][_0xc4bf('0x4a')](_0x1485a0(_0x1f68e2,_0xc4bf('0x4b')))['then'](function(){})['catch'](_0x2a124f()));break;case _0xc4bf('0x4c'):_0x2b51d8['push'](db[_0xc4bf('0x4d')]['query'](_0x3b6fab(_0x1f68e2,_0xc4bf('0x4b')))[_0xc4bf('0x27')](function(){})[_0xc4bf('0x4e')](_0x2a124f()));break;default:_0x2b51d8[_0xc4bf('0x4f')](db[_0xc4bf('0x4d')][_0xc4bf('0x4a')](_0x4c08ec(_0x1f68e2,_0xc4bf('0x4b')))[_0xc4bf('0x27')](function(){})[_0xc4bf('0x4e')](_0x2a124f()));}}}return _0x2b51d8;})[_0xc4bf('0x50')]()['then'](function(){return db[_0xc4bf('0x44')][_0xc4bf('0x45')]({'where':{'type':_0xc4bf('0x46')},'attributes':['id'],'include':[{'model':db[_0xc4bf('0x51')],'as':_0xc4bf('0x52'),'where':{'id':LISTID}}]})['then'](function(_0x2f831f){var _0x1e0ace=[];if(_0x2f831f){var _0x19caa9;for(var _0x41f344=0x0,_0x40c56c;_0x41f344<_0x2f831f[_0xc4bf('0x15')];_0x41f344+=0x1){_0x40c56c=_0x2f831f[_0x41f344][_0xc4bf('0x48')]({'plain':!![]});_0x1e0ace[_0xc4bf('0x4f')](db[_0xc4bf('0x4d')]['query'](_0x1163ef(_0x40c56c,_0xc4bf('0x4b')))[_0xc4bf('0x27')](function(){})['catch'](_0x2a124f()));}}return _0x1e0ace;})['all']();})[_0xc4bf('0x27')](function(){return db['Campaign']['findAll']({'attributes':['id',_0xc4bf('0x47')],'include':[{'model':db[_0xc4bf('0x51')],'as':_0xc4bf('0x53'),'where':{'id':LISTID}}]})[_0xc4bf('0x27')](function(_0x407338){var _0x3bb724=[];if(_0x407338){for(var _0x41d786=0x0,_0x59ac53;_0x41d786<_0x407338[_0xc4bf('0x15')];_0x41d786+=0x1){_0x59ac53=_0x407338[_0x41d786][_0xc4bf('0x48')]({'plain':!![]});switch(_0x59ac53[_0xc4bf('0x47')]){case _0xc4bf('0x49'):_0x3bb724[_0xc4bf('0x4f')](db[_0xc4bf('0x4d')][_0xc4bf('0x4a')](_0x1485a0(_0x59ac53,_0xc4bf('0x54')))[_0xc4bf('0x27')](function(){})['catch'](_0x2a124f()));break;case'onlyIfOpen':_0x3bb724[_0xc4bf('0x4f')](db[_0xc4bf('0x4d')][_0xc4bf('0x4a')](_0x3b6fab(_0x59ac53,_0xc4bf('0x54')))['then'](function(){})[_0xc4bf('0x4e')](_0x2a124f()));break;default:_0x3bb724[_0xc4bf('0x4f')](db[_0xc4bf('0x4d')]['query'](_0x4c08ec(_0x59ac53,_0xc4bf('0x54')))['then'](function(){})['catch'](_0x2a124f()));}}}return _0x3bb724;})['all']();})['then'](function(){return db[_0xc4bf('0x55')][_0xc4bf('0x45')]({'attributes':['id'],'include':[{'model':db[_0xc4bf('0x51')],'as':_0xc4bf('0x52'),'where':{'id':LISTID}}]})[_0xc4bf('0x27')](function(_0xa0999a){var _0x5e8075=[];if(_0xa0999a){for(var _0x1588b1=0x0,_0x47c89a;_0x1588b1<_0xa0999a[_0xc4bf('0x15')];_0x1588b1+=0x1){_0x47c89a=_0xa0999a[_0x1588b1][_0xc4bf('0x48')]({'plain':!![]});_0x5e8075['push'](db[_0xc4bf('0x4d')]['query'](_0x1163ef(_0x47c89a,_0xc4bf('0x54')))['then'](function(){})[_0xc4bf('0x4e')](_0x2a124f()));}}return _0x5e8075;})[_0xc4bf('0x50')]();})[_0xc4bf('0x4e')](function(_0x470baa){logger[_0xc4bf('0x12')](_0xc4bf('0x56'),_0xc4bf('0x57'),_0x470baa['message']);});}var processPromises=function(_0x223de3){return BPromise[_0xc4bf('0x50')](promises)[_0xc4bf('0x27')](function(_0x1252a8){})['catch'](function(_0x50f87d){logger[_0xc4bf('0x12')](_0xc4bf('0x58'),JSON[_0xc4bf('0x59')](_0x50f87d));})['finally'](function(){socket[_0xc4bf('0x5a')](_0xc4bf('0x5b')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x223de3){return _0x223de3['resume']();}});};var endCsv=function(){return BPromise[_0xc4bf('0x5c')]()[_0xc4bf('0x27')](function(){if(hopperContacts){return checkHopper();}})[_0xc4bf('0x27')](function(){socket['emit'](_0xc4bf('0x5b')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xc4bf('0x5d')](FILEPATH);}catch(_0x56a55b){logger[_0xc4bf('0x12')](_0xc4bf('0x5e'),JSON[_0xc4bf('0x59')](_0x56a55b));}finally{process[_0xc4bf('0x5f')](0x0);}});};process['on'](_0xc4bf('0x60'),function(){logger[_0xc4bf('0x61')](_0xc4bf('0x62'));endCsv();});function main(){return BPromise['resolve']()[_0xc4bf('0x27')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xc4bf('0xe')](',');return db[_0xc4bf('0x26')][_0xc4bf('0x45')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xc4bf('0x27')](function(_0x2a18a5){var _0x16c7b4=fs[_0xc4bf('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x16c7b4,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4c8c59,_0x1b29bf){total+=0x1;var _0x33e198=total;promises[_0xc4bf('0x4f')](checkRow(_0x4c8c59,_0x2a18a5,_0x33e198)[_0xc4bf('0x27')](function(){success+=0x1;})[_0xc4bf('0x4e')](function(_0x3d7af4){if(_0x3d7af4['error']){errors+=0x1;delete _0x3d7af4[_0xc4bf('0x12')];}else if(_0x3d7af4[_0xc4bf('0x24')]){duplicates+=0x1;delete _0x3d7af4['duplicate'];}rows['push'](_0x3d7af4);}));if(total%0xc8===0x0){_0x1b29bf[_0xc4bf('0x64')]();return processPromises(_0x1b29bf);}},'complete':function(){return processPromises()[_0xc4bf('0x27')](function(){logger[_0xc4bf('0x61')](_0xc4bf('0x65'));endCsv();});},'error':function(_0x520a1d,_0x42a23f){logger['info']('CSV\x20parse\x20error',JSON['stringify'](_0x520a1d));endCsv();}});})[_0xc4bf('0x4e')](function(_0x5aa20d){logger[_0xc4bf('0x12')](_0xc4bf('0x66'),JSON[_0xc4bf('0x59')](_0x5aa20d));});}main(); \ No newline at end of file +var _0xbf87=['Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','undefined','argv','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','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','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','CmContact','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','inspect','insert','into','cm_hopper','fromQuery','createdAt','updatedAt','select','field','ContactId','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','scheduledAt','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','VoiceQueue','findAll','outbound','CmList','get','always','push','sequelize','VoiceQueueId','query','BlackLists','all','Campaign','dialCheckDuplicateType','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','Unable\x20to\x20delete\x20temp\x20file:','stringify','exit','info','resolve','createReadStream','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error'];(function(_0x281cf4,_0x5f3a4b){var _0x3a77ab=function(_0x155bcb){while(--_0x155bcb){_0x281cf4['push'](_0x281cf4['shift']());}};_0x3a77ab(++_0x5f3a4b);}(_0xbf87,0xd3));var _0x7bf8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbf87[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x7bf8('0x0'));var util=require(_0x7bf8('0x1'));var _=require(_0x7bf8('0x2'));var fs=require('fs');var squel=require(_0x7bf8('0x3'));var Papa=require(_0x7bf8('0x4'));var Redis=require(_0x7bf8('0x5'));var db=require(_0x7bf8('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0x7bf8('0x7'))('api');config[_0x7bf8('0x8')]=_[_0x7bf8('0x9')](config[_0x7bf8('0x8')],{'host':_0x7bf8('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7bf8('0x8')]));require(_0x7bf8('0xb'))[_0x7bf8('0xc')](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0x7bf8('0xd')||process[_0x7bf8('0xe')][0x2]===_0x7bf8('0xf')){throw new Error(_0x7bf8('0x10'));}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process[_0x7bf8('0xe')][0x3]===_0x7bf8('0xd')||process[_0x7bf8('0xe')][0x3]===_0x7bf8('0xf')||!process[_0x7bf8('0xe')][0x4]||process[_0x7bf8('0xe')][0x4]===_0x7bf8('0xd')||process['argv'][0x4]===_0x7bf8('0xf')){throw new Error(_0x7bf8('0x11'));}var FIELDS=_[_0x7bf8('0x12')](process[_0x7bf8('0xe')][0x3][_0x7bf8('0x13')](','),process[_0x7bf8('0xe')][0x4][_0x7bf8('0x13')](','));if(!process['argv'][0x5]||process['argv'][0x5]===_0x7bf8('0xd')||process[_0x7bf8('0xe')][0x5]===_0x7bf8('0xf')){throw new Error(_0x7bf8('0x14'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x7bf8('0xe')][0x6]&&process[_0x7bf8('0xe')][0x6]!==_0x7bf8('0xd')&&process[_0x7bf8('0xe')][0x6]!==_0x7bf8('0xf')?process[_0x7bf8('0xe')][0x6]:null;var DUPLICATES=process[_0x7bf8('0xe')][0x7]&&process[_0x7bf8('0xe')][0x7]!==_0x7bf8('0xd')&&process[_0x7bf8('0xe')][0x7]!==_0x7bf8('0xf')?process[_0x7bf8('0xe')][0x7]:null;if(!process[_0x7bf8('0xe')][0x8]||process[_0x7bf8('0xe')][0x8]==='undefined'||process[_0x7bf8('0xe')][0x8]===_0x7bf8('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x7bf8('0xe')][0x8];}catch(_0x7e495f){logger[_0x7bf8('0x15')](_0x7e495f);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(_0x5c0a1c,_0x236a2c,_0x17f6ef,_0x30cdc3){var _0x2498df={'message':_0x236a2c};_0x2498df[_0x5c0a1c]=!![];if(_0x17f6ef){_0x2498df[_0x7bf8('0x16')]=_0x17f6ef;}if(_0x30cdc3){_0x2498df['index']=_0x30cdc3;}return _0x2498df;}function isEmail(_0x5aaf88){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))*$/[_0x7bf8('0x17')](_0x5aaf88);}function checkRow(_0x13977a,_0x137449,_0x7e6462){return new BPromise(function(_0x4db7aa,_0x2c1f12){if(_[_0x7bf8('0x18')](_0x13977a)){return _0x2c1f12(handleCheckRowError(_0x7bf8('0x15'),_0x7bf8('0x19'),null,_0x7e6462));}if(_0x13977a[_0x7bf8('0x1a')]&&_0x13977a[_0x7bf8('0x1a')][_0x7bf8('0x1b')]){var _0x5d2200=_['map'](_0x13977a['errors'],'message')[_0x7bf8('0x1c')](';');return _0x2c1f12(handleCheckRowError(_0x7bf8('0x15'),_0x5d2200,null,_0x7e6462));}var _0x252210={};for(var _0x53046a in FIELDS){if(FIELDS[_0x7bf8('0x1d')](_0x53046a)&&FIELDS[_0x53046a]){_0x252210[_0x53046a]=_0x13977a['data'][0x0][FIELDS[_0x53046a]]||_0x13977a[_0x7bf8('0x1e')][0x0]['\ufeff'+FIELDS[_0x53046a]];}}if(!_0x252210['firstName']){return _0x2c1f12(handleCheckRowError('error',_0x7bf8('0x1f'),null,_0x7e6462));}if(!_0x252210[_0x7bf8('0x20')]){return _0x2c1f12(handleCheckRowError(_0x7bf8('0x15'),_0x7bf8('0x21'),null,_0x7e6462));}if(_0x252210[_0x7bf8('0x22')]){var _0x2e0b3a=moment(_0x252210[_0x7bf8('0x22')],'YYYY-MM-DD');if(!_0x2e0b3a[_0x7bf8('0x23')]()){return _0x2c1f12(handleCheckRowError(_0x7bf8('0x15'),_0x7bf8('0x24'),null,_0x7e6462));}}if(_0x252210[_0x7bf8('0x25')]){if(!isEmail(_0x252210[_0x7bf8('0x25')])){return _0x2c1f12(handleCheckRowError('error',_0x7bf8('0x26'),null,_0x7e6462));}}_0x252210[_0x7bf8('0x27')]=LISTID;_0x252210[_0x7bf8('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7bf8('0x1b')]&&_0x137449){var _0x2af7d9={};for(var _0xffb1cf=0x0,_0x588ee1=DUPLICATES[_0x7bf8('0x1b')];_0xffb1cf<_0x588ee1;_0xffb1cf+=0x1){_0x2af7d9[DUPLICATES[_0xffb1cf]]=_0x252210[DUPLICATES[_0xffb1cf]];}var _0x4913ba=_['find'](_0x137449,_0x2af7d9);if(_0x4913ba){return _0x2c1f12(handleCheckRowError(_0x7bf8('0x29'),'Duplicate\x20Contact',_0x4913ba,_0x7e6462));}}return db[_0x7bf8('0x2a')]['create'](_0x252210,{'raw':!![],'hooks':![],'fields':_[_0x7bf8('0x2b')](_0x252210)})[_0x7bf8('0x2c')](function(_0x43cf9e){if(DUPLICATES&&DUPLICATES[_0x7bf8('0x1b')]&&_0x137449){_0x137449['push'](_[_0x7bf8('0x2d')](_0x252210,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x43cf9e['id'];return _0x4db7aa();})[_0x7bf8('0x2e')](function(_0x59f9bb){return _0x2c1f12(handleCheckRowError(_0x7bf8('0x15'),_0x7bf8('0x2f')+(_0x59f9bb['message']||JSON['stringify'](_0x59f9bb)),null,_0x7e6462));});});}function checkHopper(){function _0x9bcc8f(){return function(_0xaa489){logger[_0x7bf8('0x15')](_0x7bf8('0x30'),'checkHopper',util[_0x7bf8('0x31')](_0xaa489,{'showHidden':![],'depth':null}));};}var _0xad7081=function(_0x232761,_0x3ef9f5){var _0x13dacc=squel[_0x7bf8('0x32')]()[_0x7bf8('0x33')](_0x7bf8('0x34'))[_0x7bf8('0x35')]([_0x7bf8('0x20'),'scheduledAt','ContactId',_0x7bf8('0x27'),_0x3ef9f5,_0x7bf8('0x36'),_0x7bf8('0x37')],squel[_0x7bf8('0x38')]()[_0x7bf8('0x39')](_0x7bf8('0x20'),_0x7bf8('0x20'))['field']('NOW()','scheduledAt')['field']('id',_0x7bf8('0x3a'))[_0x7bf8('0x39')](LISTID[_0x7bf8('0x3b')](),_0x7bf8('0x27'))[_0x7bf8('0x39')](_0x232761['id'][_0x7bf8('0x3b')](),_0x3ef9f5)[_0x7bf8('0x39')](_0x7bf8('0x3c'),_0x7bf8('0x36'))['field']('NOW()',_0x7bf8('0x37'))[_0x7bf8('0x3d')](_0x7bf8('0x3e'))[_0x7bf8('0x3f')](_0x7bf8('0x40'))[_0x7bf8('0x3f')](_0x7bf8('0x41'),LISTID[_0x7bf8('0x3b')]())[_0x7bf8('0x3f')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x7bf8('0x42'),squel[_0x7bf8('0x38')]()[_0x7bf8('0x39')](_0x7bf8('0x20'))[_0x7bf8('0x3d')]('cm_hopper')['where'](_0x3ef9f5+_0x7bf8('0x43'),_0x232761['id']['toString']())))[_0x7bf8('0x3b')]();return _0x13dacc;};var _0x41ed5f=function(_0x555a76,_0x488e53){var _0x5420d8=squel[_0x7bf8('0x32')]()['into'](_0x7bf8('0x34'))['fromQuery'](['phone',_0x7bf8('0x44'),_0x7bf8('0x3a'),_0x7bf8('0x27'),_0x488e53,_0x7bf8('0x36'),_0x7bf8('0x37')],squel[_0x7bf8('0x38')]()[_0x7bf8('0x39')]('phone',_0x7bf8('0x20'))[_0x7bf8('0x39')](_0x7bf8('0x3c'),_0x7bf8('0x44'))[_0x7bf8('0x39')]('id',_0x7bf8('0x3a'))['field'](LISTID[_0x7bf8('0x3b')](),_0x7bf8('0x27'))[_0x7bf8('0x39')](_0x555a76['id'][_0x7bf8('0x3b')](),_0x488e53)[_0x7bf8('0x39')](_0x7bf8('0x3c'),_0x7bf8('0x36'))[_0x7bf8('0x39')](_0x7bf8('0x3c'),_0x7bf8('0x37'))[_0x7bf8('0x3d')]('cm_contacts')['where'](_0x7bf8('0x40'))[_0x7bf8('0x3f')](_0x7bf8('0x41'),LISTID[_0x7bf8('0x3b')]())[_0x7bf8('0x3f')](_0x7bf8('0x45'),squel[_0x7bf8('0x46')](hopperContacts))[_0x7bf8('0x3f')](_0x7bf8('0x47'))[_0x7bf8('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7bf8('0x38')]()[_0x7bf8('0x39')](_0x7bf8('0x48'))['from']('cm_hopper_final')[_0x7bf8('0x3f')](_0x488e53+_0x7bf8('0x43'),_0x555a76['id'][_0x7bf8('0x3b')]()))[_0x7bf8('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x7bf8('0x39')](_0x7bf8('0x20'))[_0x7bf8('0x3d')](_0x7bf8('0x34'))[_0x7bf8('0x3f')](_0x488e53+_0x7bf8('0x43'),_0x555a76['id'][_0x7bf8('0x3b')]())))[_0x7bf8('0x3b')]();return _0x5420d8;};function _0x196a46(_0x346246,_0x492a46){var _0x124b65=squel[_0x7bf8('0x32')]()[_0x7bf8('0x33')](_0x7bf8('0x34'))[_0x7bf8('0x35')]([_0x7bf8('0x20'),_0x7bf8('0x44'),_0x7bf8('0x3a'),_0x7bf8('0x27'),_0x492a46,_0x7bf8('0x36'),'updatedAt'],squel['select']()[_0x7bf8('0x39')](_0x7bf8('0x20'),_0x7bf8('0x20'))[_0x7bf8('0x39')](_0x7bf8('0x3c'),_0x7bf8('0x44'))[_0x7bf8('0x39')]('id',_0x7bf8('0x3a'))[_0x7bf8('0x39')](LISTID[_0x7bf8('0x3b')](),'ListId')['field'](_0x346246['id']['toString'](),_0x492a46)[_0x7bf8('0x39')](_0x7bf8('0x3c'),_0x7bf8('0x36'))['field']('NOW()',_0x7bf8('0x37'))[_0x7bf8('0x3d')](_0x7bf8('0x3e'))['where']('deletedAt\x20IS\x20NULL')[_0x7bf8('0x3f')]('ListId\x20=\x20?',LISTID[_0x7bf8('0x3b')]())['where'](_0x7bf8('0x45'),squel[_0x7bf8('0x46')](hopperContacts))[_0x7bf8('0x3f')](_0x7bf8('0x47')))[_0x7bf8('0x3b')]();return _0x124b65;}function _0x3c2d55(_0x342878,_0x3c304c){var _0x512f12=squel[_0x7bf8('0x32')]()[_0x7bf8('0x33')]('cm_hopper_black')['fromQuery']([_0x7bf8('0x20'),_0x7bf8('0x3a'),_0x7bf8('0x27'),_0x3c304c,'createdAt','updatedAt'],squel['select']()[_0x7bf8('0x39')]('phone',_0x7bf8('0x20'))[_0x7bf8('0x39')]('id',_0x7bf8('0x3a'))['field'](LISTID[_0x7bf8('0x3b')](),_0x7bf8('0x27'))[_0x7bf8('0x39')](_0x342878['id'][_0x7bf8('0x3b')](),_0x3c304c)[_0x7bf8('0x39')]('NOW()',_0x7bf8('0x36'))['field'](_0x7bf8('0x3c'),_0x7bf8('0x37'))[_0x7bf8('0x3d')]('cm_contacts')[_0x7bf8('0x3f')]('deletedAt\x20IS\x20NULL')[_0x7bf8('0x3f')](_0x7bf8('0x41'),LISTID[_0x7bf8('0x3b')]())[_0x7bf8('0x3f')](_0x7bf8('0x45'),squel[_0x7bf8('0x46')](hopperContacts))['where'](_0x7bf8('0x47')))[_0x7bf8('0x3b')]();return _0x512f12;}return db[_0x7bf8('0x49')][_0x7bf8('0x4a')]({'where':{'type':_0x7bf8('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x7bf8('0x4c')],'as':'Lists','where':{'id':LISTID}}]})[_0x7bf8('0x2c')](function(_0x4842c9){var _0x4ad65f=[];if(_0x4842c9){var _0x35aae2;for(var _0x19d398=0x0,_0x5a1244;_0x19d398<_0x4842c9[_0x7bf8('0x1b')];_0x19d398+=0x1){_0x5a1244=_0x4842c9[_0x19d398][_0x7bf8('0x4d')]({'plain':!![]});switch(_0x5a1244['dialCheckDuplicateType']){case _0x7bf8('0x4e'):_0x4ad65f[_0x7bf8('0x4f')](db[_0x7bf8('0x50')]['query'](_0x41ed5f(_0x5a1244,_0x7bf8('0x51')))[_0x7bf8('0x2c')](function(){})[_0x7bf8('0x2e')](_0x9bcc8f()));break;case'onlyIfOpen':_0x4ad65f[_0x7bf8('0x4f')](db['sequelize']['query'](_0xad7081(_0x5a1244,'VoiceQueueId'))[_0x7bf8('0x2c')](function(){})['catch'](_0x9bcc8f()));break;default:_0x4ad65f[_0x7bf8('0x4f')](db['sequelize'][_0x7bf8('0x52')](_0x196a46(_0x5a1244,'VoiceQueueId'))['then'](function(){})[_0x7bf8('0x2e')](_0x9bcc8f()));}}}return _0x4ad65f;})['all']()['then'](function(){return db[_0x7bf8('0x49')]['findAll']({'where':{'type':_0x7bf8('0x4b')},'attributes':['id'],'include':[{'model':db[_0x7bf8('0x4c')],'as':_0x7bf8('0x53'),'where':{'id':LISTID}}]})[_0x7bf8('0x2c')](function(_0x41ad36){var _0x471cbd=[];if(_0x41ad36){var _0x2b0f31;for(var _0x410414=0x0,_0x3e35a4;_0x410414<_0x41ad36[_0x7bf8('0x1b')];_0x410414+=0x1){_0x3e35a4=_0x41ad36[_0x410414]['get']({'plain':!![]});_0x471cbd[_0x7bf8('0x4f')](db['sequelize'][_0x7bf8('0x52')](_0x3c2d55(_0x3e35a4,_0x7bf8('0x51')))[_0x7bf8('0x2c')](function(){})['catch'](_0x9bcc8f()));}}return _0x471cbd;})[_0x7bf8('0x54')]();})[_0x7bf8('0x2c')](function(){return db[_0x7bf8('0x55')]['findAll']({'attributes':['id',_0x7bf8('0x56')],'include':[{'model':db[_0x7bf8('0x4c')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x6ef75){var _0x55b76e=[];if(_0x6ef75){for(var _0x48e786=0x0,_0x510614;_0x48e786<_0x6ef75[_0x7bf8('0x1b')];_0x48e786+=0x1){_0x510614=_0x6ef75[_0x48e786][_0x7bf8('0x4d')]({'plain':!![]});switch(_0x510614[_0x7bf8('0x56')]){case'always':_0x55b76e[_0x7bf8('0x4f')](db[_0x7bf8('0x50')]['query'](_0x41ed5f(_0x510614,_0x7bf8('0x57')))[_0x7bf8('0x2c')](function(){})[_0x7bf8('0x2e')](_0x9bcc8f()));break;case _0x7bf8('0x58'):_0x55b76e[_0x7bf8('0x4f')](db[_0x7bf8('0x50')]['query'](_0xad7081(_0x510614,_0x7bf8('0x57')))[_0x7bf8('0x2c')](function(){})['catch'](_0x9bcc8f()));break;default:_0x55b76e['push'](db[_0x7bf8('0x50')][_0x7bf8('0x52')](_0x196a46(_0x510614,_0x7bf8('0x57')))[_0x7bf8('0x2c')](function(){})[_0x7bf8('0x2e')](_0x9bcc8f()));}}}return _0x55b76e;})[_0x7bf8('0x54')]();})[_0x7bf8('0x2c')](function(){return db[_0x7bf8('0x55')][_0x7bf8('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x7bf8('0x4c')],'as':_0x7bf8('0x53'),'where':{'id':LISTID}}]})[_0x7bf8('0x2c')](function(_0x244732){var _0x428587=[];if(_0x244732){for(var _0x5873cf=0x0,_0x271512;_0x5873cf<_0x244732[_0x7bf8('0x1b')];_0x5873cf+=0x1){_0x271512=_0x244732[_0x5873cf]['get']({'plain':!![]});_0x428587['push'](db[_0x7bf8('0x50')][_0x7bf8('0x52')](_0x3c2d55(_0x271512,_0x7bf8('0x57')))['then'](function(){})['catch'](_0x9bcc8f()));}}return _0x428587;})['all']();})[_0x7bf8('0x2e')](function(_0x258877){logger[_0x7bf8('0x15')](_0x7bf8('0x59'),'generalCheckHopper',_0x258877['message']);});}var processPromises=function(_0x5c06fd){return BPromise[_0x7bf8('0x54')](promises)[_0x7bf8('0x2c')](function(_0x2d4583){})[_0x7bf8('0x2e')](function(_0x5991da){logger['error'](_0x7bf8('0x5a'),JSON['stringify'](_0x5991da));})[_0x7bf8('0x5b')](function(){socket[_0x7bf8('0x5c')](_0x7bf8('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5c06fd){return _0x5c06fd[_0x7bf8('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x7bf8('0x2c')](function(){if(hopperContacts){return checkHopper();}})[_0x7bf8('0x2c')](function(){socket['emit'](_0x7bf8('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x28bd6c){logger[_0x7bf8('0x15')](_0x7bf8('0x5f'),JSON[_0x7bf8('0x60')](_0x28bd6c));}finally{process[_0x7bf8('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x7bf8('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x7bf8('0x63')]()[_0x7bf8('0x2c')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7bf8('0x13')](',');return db[_0x7bf8('0x2a')][_0x7bf8('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7bf8('0x2c')](function(_0x3044ba){var _0x3107b3=fs[_0x7bf8('0x64')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x3107b3,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4a611e,_0x4b0d87){total+=0x1;var _0x2bd71c=total;promises['push'](checkRow(_0x4a611e,_0x3044ba,_0x2bd71c)[_0x7bf8('0x2c')](function(){success+=0x1;})['catch'](function(_0x11a35a){if(_0x11a35a[_0x7bf8('0x15')]){errors+=0x1;delete _0x11a35a['error'];}else if(_0x11a35a['duplicate']){duplicates+=0x1;delete _0x11a35a['duplicate'];}rows[_0x7bf8('0x4f')](_0x11a35a);}));if(total%0xc8===0x0){_0x4b0d87[_0x7bf8('0x65')]();return processPromises(_0x4b0d87);}},'complete':function(){return processPromises()[_0x7bf8('0x2c')](function(){logger['info'](_0x7bf8('0x66'));endCsv();});},'error':function(_0x2a79d7,_0x5b9906){logger['info'](_0x7bf8('0x67'),JSON[_0x7bf8('0x60')](_0x2a79d7));endCsv();}});})[_0x7bf8('0x2e')](function(_0x40f38b){logger[_0x7bf8('0x15')](_0x7bf8('0x68'),JSON[_0x7bf8('0x60')](_0x40f38b));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 5cdcf69..a51d22e 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 _0x247f=['select','field','phone','from','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','CmContactHasItem','findOne','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','updatedAt','priority','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_contacts.createdAt','createdAt','.CmListId','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','recallme','cm_contacts.createdAt\x20=\x20?','cm_hopper_black','cm_hopper.id','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_hopper.ListId\x20=\x20?','concat','keys','CompanyId','scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','error','message','exit','code','sequelize','query','catch','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','voice_queues.id','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','spread','dialTimezone','utcOffset','set','offset','main','stringify','binding','clone','root','server/files/tmp','.csv','includes','header','ContactItemType','name','_description','writeFileSync','parse','createReadStream','data','rows','errors','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','timezones','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','util','moment','squel','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x247f,0xa7));var _0xf247=function(_0x1e1279,_0x48ed40){_0x1e1279=_0x1e1279-0x0;var _0x40813a=_0x247f[_0x1e1279];return _0x40813a;};'use strict';var fs=require('fs');var path=require(_0xf247('0x0'));var _=require(_0xf247('0x1'));var Papa=require(_0xf247('0x2'));var util=require(_0xf247('0x3'));var BPromise=require('bluebird');var moment=require(_0xf247('0x4'));var squel=require(_0xf247('0x5'));var Redis=require('ioredis');var db=require(_0xf247('0x6'))['db'];var config=require(_0xf247('0x7'));var shared=require(_0xf247('0x8'));var logger=require(_0xf247('0x9'))(_0xf247('0xa'));config[_0xf247('0xb')]=_['defaults'](config['redis'],{'host':_0xf247('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf247('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xf247('0xd')](_0xf247('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xf247('0xd')](_0xf247('0xe'));function isEmail(_0x41f10a){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))*$/[_0xf247('0xf')](_0x41f10a);}function selectNotIn(_0x1cb7a5,_0x2c4404,_0xcd74ec,_0xf4e75d,_0x2c03cf){return squel[_0xf247('0x10')]()[_0xf247('0x11')](_0xf247('0x12'))[_0xf247('0x13')](_0xf4e75d)['join'](_0x2c4404,null,_0x2c4404+'.id\x20=\x20'+_0xf4e75d+'.'+_0xcd74ec)[_0xf247('0x14')](_0xf4e75d+'.'+_0xcd74ec+_0xf247('0x15')+_0x1cb7a5+'.'+_0xcd74ec)[_0xf247('0x14')](_0x2c4404+_0xf247('0x16')+_0x2c03cf[_0xf247('0x17')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3d0892,_0x35b65a){promisesAdditionalPhones=[];return db[_0xf247('0x18')][_0xf247('0x19')]({'raw':!![],'attributes':['id',_0xf247('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xf247('0x1b')](function(_0x3dafff){if(_0x3dafff!==null){var _0x24fb62=[];for(var _0x1d88e5=0x0;_0x1d88e5<_0x3dafff[_0xf247('0x1c')];_0x1d88e5++){var _0x346053=_0x3dafff[_0x1d88e5];_0x24fb62[_0xf247('0x1d')](insertAdditionalPhones(_0x346053));}}Promise[_0xf247('0x1e')](_0x24fb62)['then'](function(){_0x3d0892({'val':0x1});});});});}function insertAdditionalPhones(_0x3844a3){return new Promise(function(_0x3191b2,_0x24a905){var _0x241fa5=_0x3844a3['AdditionalPhones'];var _0x142b5a=_0x241fa5['split'](';');var _0x50aea3=[];orderBy=0x0;for(var _0xe9533a=0x0;_0xe9533a<_0x142b5a[_0xf247('0x1c')];_0xe9533a++){_0x50aea3[_0xf247('0x1d')](splitAdditionalPhone(_0x3844a3['id'],_0x142b5a[_0xe9533a]));}Promise['all'](_0x50aea3)[_0xf247('0x1b')](function(){_0x3191b2({'val':_0x142b5a[_0xf247('0x1c')]});});});}function splitAdditionalPhone(_0x599121,_0x5db520){return new Promise(function(_0x5b48fc,_0x43733b){var _0x72ba1b=_0x5db520[_0xf247('0x1f')](':');var _0x1be78c=_0x72ba1b[0x0];var _0x1dee0c=_0x72ba1b[0x1];if(!_[_0xf247('0x20')](_0x1dee0c)){var _0x6ab540=_0x1dee0c[_0xf247('0x1f')]('|');var _0x35482b=[];for(var _0x40d82e=0x0;_0x40d82e<_0x6ab540[_0xf247('0x1c')];_0x40d82e++){if(_0x6ab540[_0x40d82e]!==''){var _0x4c07ee=_['filter'](promisesAdditionalPhones,{'contactId':_0x599121,'phone':_0x6ab540[_0x40d82e]});if(_0x4c07ee[_0xf247('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0xf247('0x1d')]({'contactId':_0x599121,'contactTypeId':_0x1be78c,'phone':_0x6ab540[_0x40d82e],'orderBy':orderBy});}}}_0x5b48fc({'ok':0x1});}else _0x5b48fc({'res':0x0});});}function createAdditionalPhone(_0x140209,_0x31d096,_0x311c74,_0x512399){var _0x275c0e='';var _0x5cdab8='';var _0x29d7fa=_0x311c74[_0xf247('0x1f')]('§');_0x275c0e=_0x29d7fa[0x0];if(_0x29d7fa[_0xf247('0x1c')]==0x2)_0x5cdab8=_0x29d7fa[0x1];return new Promise(function(_0x4a6eeb,_0x7e1c05){return db[_0xf247('0x21')][_0xf247('0x22')]({'where':{'CmContactId':_0x140209,'item':_0x275c0e}})[_0xf247('0x1b')](function(_0x192574){if(_0x192574){return db['CmContactHasItem']['update']({'ItemTypeId':_0x31d096,'description':_0x5cdab8,'OrderBy':_0x512399},{'where':{'CmContactId':_0x140209,'item':_0x275c0e}})[_0xf247('0x1b')](function(_0x3ad442){_0x4a6eeb({'res':'updated'});});}else{return db[_0xf247('0x21')]['create']({'CmContactId':_0x140209,'item':_0x275c0e,'description':_0x5cdab8,'ItemTypeId':_0x31d096,'OrderBy':_0x512399,'ItemClass':'PHONE'})[_0xf247('0x1b')](function(_0x54bd77){_0x4a6eeb({'res':_0xf247('0x23')});});}});});}function insertCmHopper(_0x466759,_0x367cf7,_0x26f474,_0x363815,_0x5eb9e5){var _0x292268=[_0xf247('0x24'),_0xf247('0x25'),'cm_contacts.id',_0xf247('0x26'),_0x367cf7+'.'+_0x363815,'cm_contacts.createdAt',_0xf247('0x27'),_0xf247('0x28'),_0xf247('0x29'),'\x22'+_0x5eb9e5+'\x22'];return squel[_0xf247('0x2a')]()[_0xf247('0x2b')](_0xf247('0x2c'))[_0xf247('0x2d')](['phone',_0xf247('0x2e'),_0xf247('0x2f'),_0xf247('0x30'),_0x363815,'createdAt',_0xf247('0x31'),_0xf247('0x32'),_0xf247('0x33'),'recallme'],squel[_0xf247('0x10')]()[_0xf247('0x34')](_0x292268)['from'](_0x367cf7)['join'](_0xf247('0x35'),null,_0xf247('0x36')+_0x367cf7+'.CmListId')[_0xf247('0x17')](_0x26f474,null,_0x26f474+_0xf247('0x37')+_0x367cf7+'.'+_0x363815)[_0xf247('0x14')](_0x367cf7+_0xf247('0x38'),_0x466759)[_0xf247('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xf247('0x14')](_0xf247('0x39'),selectNotIn(_0x367cf7,_0x26f474,_0x363815,_0xf247('0x2c'),[_0xf247('0x3a'),_0xf247('0x3b')]))[_0xf247('0x14')](_0xf247('0x39'),selectNotIn(_0x367cf7,_0x26f474,_0x363815,_0xf247('0x2c'),[_0xf247('0x3a')])))[_0xf247('0x3c')]();}function insertCmHopperBlack(_0x1ac918,_0x14c2d4,_0x2b641c,_0x527692){var _0x5f5205=[_0xf247('0x24'),_0xf247('0x3d'),'cm_contacts.ListId',_0x14c2d4+'.'+_0x527692,_0xf247('0x3e'),'cm_contacts.updatedAt'];return squel[_0xf247('0x2a')]()[_0xf247('0x2b')]('cm_hopper_black')['fromQuery']([_0xf247('0x12'),_0xf247('0x2f'),_0xf247('0x30'),_0x527692,_0xf247('0x3f'),_0xf247('0x31')],squel['select']()[_0xf247('0x34')](_0x5f5205)[_0xf247('0x13')](_0x14c2d4)['join'](_0xf247('0x35'),null,_0xf247('0x36')+_0x14c2d4+_0xf247('0x40'))['join'](_0x2b641c,null,_0x2b641c+_0xf247('0x37')+_0x14c2d4+'.'+_0x527692)[_0xf247('0x14')](_0x14c2d4+'.CmListId\x20=\x20?',_0x1ac918)[_0xf247('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xf247('0x14')](_0xf247('0x39'),squel[_0xf247('0x10')]()[_0xf247('0x11')](_0xf247('0x12'))[_0xf247('0x13')]('cm_hopper_black')[_0xf247('0x14')](_0xf247('0x41'),_0x1ac918)[_0xf247('0x14')](_0x527692+_0xf247('0x15')+_0x14c2d4+'.'+_0x527692)))[_0xf247('0x3c')]();}function insertTzCmHopper(_0x3a46aa,_0x52d9ed,_0x19e20d,_0x217ce1,_0x4820a6,_0x185756){var _0x561e16=[_0xf247('0x24'),_0xf247('0x42')+_0x185756+_0xf247('0x43'),_0xf247('0x3d'),_0xf247('0x26'),_0x52d9ed+'.'+_0x217ce1,_0xf247('0x3e'),_0xf247('0x27'),'cm_contacts.priority',_0xf247('0x29'),'\x22'+_0x4820a6+'\x22'];var _0x5782d6=squel[_0xf247('0x2a')]()['into']('cm_hopper')[_0xf247('0x2d')]([_0xf247('0x12'),_0xf247('0x2e'),'ContactId',_0xf247('0x30'),_0x217ce1,_0xf247('0x3f'),_0xf247('0x31'),_0xf247('0x32'),_0xf247('0x33'),_0xf247('0x44')],squel['select']()[_0xf247('0x34')](_0x561e16)[_0xf247('0x13')](_0x52d9ed)[_0xf247('0x17')](_0xf247('0x35'),null,_0xf247('0x36')+_0x52d9ed+_0xf247('0x40'))[_0xf247('0x17')](_0x19e20d,null,_0x19e20d+_0xf247('0x37')+_0x52d9ed+'.'+_0x217ce1)[_0xf247('0x17')](_0x185756,null,_0x185756+_0xf247('0x37')+_0x52d9ed+'.'+_0x217ce1)[_0xf247('0x14')](_0x52d9ed+_0xf247('0x38'),_0x3a46aa)[_0xf247('0x14')](_0xf247('0x45'),NOW)['where'](_0xf247('0x39'),selectNotIn(_0x52d9ed,_0x19e20d,_0x217ce1,_0xf247('0x2c'),[_0xf247('0x3a'),_0xf247('0x3b')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x52d9ed,_0x19e20d,_0x217ce1,_0xf247('0x2c'),[_0xf247('0x3a')])))[_0xf247('0x3c')]();return _0x5782d6;}function insertTzCmHopperBlack(_0x3b7dd4,_0x469c5e,_0x4ab793,_0x11ace2){var _0x2fbec8=[_0xf247('0x24'),'cm_contacts.id',_0xf247('0x26'),_0x469c5e+'.'+_0x11ace2,_0xf247('0x3e'),_0xf247('0x27')];return squel['insert']()[_0xf247('0x2b')](_0xf247('0x46'))[_0xf247('0x2d')](['phone','ContactId',_0xf247('0x30'),_0x11ace2,_0xf247('0x3f'),_0xf247('0x31')],squel[_0xf247('0x10')]()['fields'](_0x2fbec8)['from'](_0x469c5e)[_0xf247('0x17')]('cm_contacts',null,_0xf247('0x36')+_0x469c5e+_0xf247('0x40'))[_0xf247('0x17')](_0x4ab793,null,_0x4ab793+'.id\x20=\x20'+_0x469c5e+'.'+_0x11ace2)[_0xf247('0x14')](_0x469c5e+_0xf247('0x38'),_0x3b7dd4)[_0xf247('0x14')](_0xf247('0x45'),NOW)[_0xf247('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xf247('0x11')](_0xf247('0x12'))[_0xf247('0x13')](_0xf247('0x46'))[_0xf247('0x14')](_0xf247('0x41'),_0x3b7dd4)[_0xf247('0x14')](_0x11ace2+_0xf247('0x15')+_0x469c5e+'.'+_0x11ace2)))[_0xf247('0x3c')]();}function insertCmHopperAdditionalPhones(_0x32fed6){var _0x5a0039=[_0xf247('0x47'),'cm_contact_has_items.item',_0xf247('0x48'),'cm_contact_has_items.createdAt',_0xf247('0x49')];return squel['insert']()[_0xf247('0x2b')](_0xf247('0x4a'))[_0xf247('0x2d')]([_0xf247('0x4b'),'phone',_0xf247('0x4c'),_0xf247('0x3f'),_0xf247('0x31')],squel[_0xf247('0x10')]()[_0xf247('0x34')](_0x5a0039)[_0xf247('0x13')](_0xf247('0x2c'))[_0xf247('0x17')]('cm_contacts',null,_0xf247('0x4d'))[_0xf247('0x17')](_0xf247('0x4e'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xf247('0x14')](_0xf247('0x4f'),_0x32fed6)[_0xf247('0x14')](_0xf247('0x45'),NOW))[_0xf247('0x3c')]();}function insertCmContact(_0x56ab47,_0x43d32e,_0x32bbe9,_0x404dc2){var _0x4c090a=_[_0xf247('0x50')](_[_0xf247('0x51')](_0x404dc2),[_0xf247('0x30'),_0xf247('0x52'),'createdAt',_0xf247('0x31'),_0xf247('0x53')]);return squel[_0xf247('0x2a')]()['into'](_0xf247('0x35'))[_0xf247('0x2d')](_0x4c090a,squel['select']()[_0xf247('0x34')](_0x4c090a)[_0xf247('0x13')](_0x43d32e)[_0xf247('0x14')]('('+_0x32bbe9['join'](',')+')\x20NOT\x20IN\x20?',squel[_0xf247('0x10')]()['fields'](_0x32bbe9)[_0xf247('0x13')](_0xf247('0x35'))['where']('ListId\x20=\x20?',_0x56ab47)['where'](_0xf247('0x54')))[_0xf247('0x14')](_0xf247('0x55'),squel[_0xf247('0x10')]()[_0xf247('0x11')](_0xf247('0x56'),_0xf247('0x57'))[_0xf247('0x13')](_0x43d32e)[_0xf247('0x58')](_0x32bbe9['join'](','))))['toString']();}function handleStop(){logger[_0xf247('0x59')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x15eaa7){logger[_0xf247('0x5a')](_0x15eaa7[_0xf247('0x5b')]);process[_0xf247('0x5c')](0x1);}function handleError(_0x483e87,_0xabd5a4){stats['errors'][_0xf247('0x1d')]({'name':_0xabd5a4[_0xf247('0x5d')],'message':_0xabd5a4['message'],'row':_0x483e87});}function handleQuery(_0x326b06){logger[_0xf247('0x59')](_0x326b06);return db[_0xf247('0x5e')][_0xf247('0x5f')](_0x326b06)['spread'](function(_0x5c38cf){results[_0xf247('0x1d')](_0x5c38cf);})[_0xf247('0x60')](function(_0xe1eb8b){logger[_0xf247('0x5a')](_0xe1eb8b['message']);});}function updateTzCampaigns(_0x64982){return new Promise(function(_0x2af8af,_0x5a6f90){var _0x13cb14=squel[_0xf247('0x10')]()[_0xf247('0x34')]([_0xf247('0x61'),'campaigns.dialTimezone'])[_0xf247('0x13')](_0xf247('0x62'))[_0xf247('0x17')](_0xf247('0x63'),null,_0xf247('0x64'))[_0xf247('0x14')]('campaigns_has_cm_lists.CmListId='+_0x64982);db['sequelize']['query'](_0x13cb14['toString']())['spread'](function(_0x6162cf){var _0x18816b=[];for(var _0xc51b82=0x0;_0xc51b82<_0x6162cf[_0xf247('0x1c')];_0xc51b82++){_0x18816b[_0xf247('0x1d')](getTimezoneData(_0x6162cf[_0xc51b82],tmp_campaigns));}BPromise['all'](_0x18816b)[_0xf247('0x1b')](function(){_0x2af8af({'val':0x1});});})[_0xf247('0x60')](function(_0x4284bf){logger['error'](_0x4284bf[_0xf247('0x5b')]);_0x2af8af({'val':0x0});});});}function updateTzVoiceQueues(_0x4bcd23){return new Promise(function(_0x3bb17b,_0x583e60){var _0x46da86=squel[_0xf247('0x10')]()[_0xf247('0x34')]([_0xf247('0x65'),'voice_queues.dialTimezone'])['from']('voice_queues')[_0xf247('0x17')](_0xf247('0x66'),null,_0xf247('0x67'))['where']('voice_queues_has_cm_lists.CmListId='+_0x4bcd23);db[_0xf247('0x5e')][_0xf247('0x5f')](_0x46da86[_0xf247('0x3c')]())[_0xf247('0x68')](function(_0x4042c5){var _0x102b9c=[];for(var _0x48440a=0x0;_0x48440a<_0x4042c5[_0xf247('0x1c')];_0x48440a++){_0x102b9c['push'](getTimezoneData(_0x4042c5[_0x48440a],tmp_voice_queues));}BPromise['all'](_0x102b9c)['then'](function(){_0x3bb17b({'val':0x1});});})[_0xf247('0x60')](function(_0x3fb18f){logger[_0xf247('0x5a')](_0x3fb18f['message']);_0x3bb17b({'val':0x0});});});}function getTimezoneData(_0x359590,_0x4441c0){return new Promise(function(_0x5db8da,_0x18f60d){var _0x37c5f7=shared['timezones'];var _0x46cfa3=_0x37c5f7[_0x359590[_0xf247('0x69')]];if(_['isNil'](_0x46cfa3)){_0x5db8da({'ret':0x1});}else{var _0x2d02d4=_0x46cfa3[_0xf247('0x6a')];var _0x2c5a93=squel[_0xf247('0x2a')]()[_0xf247('0x2b')](_0x4441c0)[_0xf247('0x6b')]('id',_0x359590['id'])['set'](_0xf247('0x6c'),_0x2d02d4)[_0xf247('0x6b')](_0xf247('0x69'),_0x359590[_0xf247('0x69')])[_0xf247('0x3c')]();return db[_0xf247('0x5e')][_0xf247('0x5f')](_0x2c5a93)[_0xf247('0x68')](function(_0x12b2ff){_0x5db8da({'ret':0x1});})[_0xf247('0x60')](function(_0x3858c1){logger[_0xf247('0x5a')](_0x3858c1[_0xf247('0x5b')]);_0x18f60d({'ret':0x1});});}});}function handleTZQuery(_0xeab40f){logger[_0xf247('0x59')](_0xeab40f);return db[_0xf247('0x5e')][_0xf247('0x5f')](_0xeab40f)[_0xf247('0x68')](function(_0x58bc1a){})['catch'](function(_0x2c0398){logger['error'](_0x2c0398[_0xf247('0x5b')]);});}function main(_0x1b321d,_0xf5a08d,_0x36bd41,_0x440d9b){logger['info'](_0xf247('0x6d'),_0x1b321d,JSON[_0xf247('0x6e')](_0xf5a08d));process['send']('start');var _0x34598c=_0xf5a08d[_0xf247('0x6f')];var _0x1d0458=_[_0xf247('0x70')](_0x34598c);var _0x5d171a=_0xf5a08d['socket_timestamp'];var _0x19d63b=path[_0xf247('0x17')](config[_0xf247('0x71')],_0xf247('0x72'),_0x5d171a+_0xf247('0x73'));hasTZ=_[_0xf247('0x51')](_0x34598c)[_0xf247('0x74')]('dialTimezone');var _0x403f39=_['keys'](_0x34598c)[_0xf247('0x17')]();logger[_0xf247('0x59')](_0xf247('0x75'),_0x403f39);db[_0xf247('0x76')][_0xf247('0x19')]({'raw':!![],'attributes':['id',_0xf247('0x77')]})[_0xf247('0x1b')](function(_0x50b6bc){for(var _0x43622a=0x0;_0x43622a<_0x50b6bc[_0xf247('0x1c')];_0x43622a++){if(_0x50b6bc[_0x43622a][_0xf247('0x77')]in _0x34598c){contactItemTypes[_0xf247('0x1d')](_0x50b6bc[_0x43622a]);delete _0x1d0458[_0x50b6bc[_0x43622a][_0xf247('0x77')]];hasAdditionalPhones=!![];}for(var _0x47e23e in _0x34598c){if(_0x50b6bc[_0x43622a]['name']+_0xf247('0x78')===_0x47e23e){phoneDescriptions['push']({'itemTypeId':_0x50b6bc[_0x43622a]['id'],'description':_0x47e23e});delete _0x1d0458[_0x47e23e];}}}if(hasAdditionalPhones)_0x1d0458[_0xf247('0x1a')]='';var _0x5d3f7d=_[_0xf247('0x51')](_0x1d0458)['join']();logger['info'](_0xf247('0x75'),_0x5d3f7d);fs[_0xf247('0x79')](_0x19d63b,_0x5d3f7d+'\x0a');Papa[_0xf247('0x7a')](fs[_0xf247('0x7b')](_0x1b321d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x16470f,_0x172240){try{for(var _0x43b072=0x0,_0xd4d078=[];_0x43b072<_0x16470f[_0xf247('0x7c')][_0xf247('0x1c')];_0x43b072++){stats[_0xf247('0x7d')]+=0x1;if(_0x16470f[_0xf247('0x7e')][_0x43b072]){handleError(_0x16470f['data'][_0x43b072],_0x16470f['errors'][_0x43b072]);}else{var _0x17db30=[];var _0x3df2ec=[];var _0x1b75f3={};for(var _0x113396 in _0x34598c){let _0xd0a134=contactItemTypes[_0xf247('0x7f')](_0x4e6060=>_0x4e6060[_0xf247('0x77')]===_0x113396);let _0x4d353c=contactItemTypes['find'](_0x293033=>_0x293033['name']+'_description'===_0x113396);if(_['isNil'](_0xd0a134)&&_[_0xf247('0x20')](_0x4d353c)){if(_0x34598c[_0xf247('0x80')](_0x113396)){if(_0x16470f[_0xf247('0x7c')][_0x43b072][_0x34598c[_0x113396]]){var _0x225f77=_[_0xf247('0x81')](_0x16470f[_0xf247('0x7c')][_0x43b072][_0x34598c[_0x113396]][_0xf247('0x82')](/"/g,'\x27'));switch(_0x113396){case _0xf247('0x2e'):var _0x1a3daf=moment(_0x225f77,_0xf247('0xe'),!![]);if(_0x1a3daf[_0xf247('0x83')]()){_0xd4d078[_0xf247('0x1d')]('\x22'+_0x225f77+'\x22');}else{_0x17db30[_0xf247('0x1d')](_0xf247('0x84'));}break;case _0xf247('0x32'):var _0x29e51=parseInt(_0x225f77);_0x225f77=_[_0xf247('0x85')](_0x29e51)||_0x29e51<0x0||_0x29e51>0x4?_0x440d9b?0x3:0x2:_0x29e51;_0xd4d078[_0xf247('0x1d')]('\x22'+_0x225f77+'\x22');break;case _0xf247('0x33'):var _0x581f09=parseInt(_0x225f77);if(_[_0xf247('0x86')](_0x581f09)&&_[_0xf247('0x74')](_0x36bd41,_0x581f09)){_0xd4d078[_0xf247('0x1d')]('\x22'+_0x581f09+'\x22');}else{_0x17db30[_0xf247('0x1d')](_0xf247('0x87'));}break;case _0xf247('0x88'):if(isEmail(_0x225f77)){_0xd4d078[_0xf247('0x1d')]('\x22'+_0x225f77+'\x22');}else{_0x17db30[_0xf247('0x1d')](_0xf247('0x89'));}break;case _0xf247('0x8a'):var _0x5f5c40=moment(_0x225f77,'YYYY-MM-DD',!![]);if(_0x5f5c40[_0xf247('0x83')]()){_0xd4d078[_0xf247('0x1d')]('\x22'+_0x225f77+'\x22');}else{_0x17db30[_0xf247('0x1d')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case'dialTimezone':var _0xa762ca=shared[_0xf247('0x8b')];var _0x4990c5=_0xa762ca[_0x225f77];if(!_[_0xf247('0x20')](_0x4990c5)){var _0x53c7bc=_0x4990c5[_0xf247('0x6a')];_0xd4d078[_0xf247('0x1d')]('\x22'+_0x225f77+'\x22');_0xd4d078[_0xf247('0x1d')]('\x22'+_0x53c7bc+'\x22');}break;default:_0xd4d078[_0xf247('0x1d')]('\x22'+_0x225f77+'\x22');}}else{switch(_0x113396){case _0xf247('0x8c'):case _0xf247('0x12'):_0x17db30[_0xf247('0x1d')](_0x113396+_0xf247('0x8d'));break;default:_0xd4d078[_0xf247('0x1d')]('\x22\x22');}}}}else{var _0x26e507='';if(!_[_0xf247('0x20')](_0xd0a134)){if(!_0x1b75f3['hasOwnProperty'](_0xd0a134['id'])){if(!_['isNil'](_0x16470f[_0xf247('0x7c')][_0x43b072][_0x34598c[_0x113396]])){var _0x225f77=_['trim'](_0x16470f['data'][_0x43b072][_0x34598c[_0x113396]][_0xf247('0x82')](/"/g,'\x27'));var _0x776fc0=phoneDescriptions[_0xf247('0x7f')](_0x48efa8=>_0x48efa8[_0xf247('0x8e')]===_0xd0a134['id']);if(!_['isNil'](_0x776fc0)){var _0x158c9e=_['trim'](_0x16470f[_0xf247('0x7c')][_0x43b072][_0x34598c[_0x776fc0[_0xf247('0x8f')]]][_0xf247('0x82')](/"/g,'\x27'));if(!_[_0xf247('0x20')](_0x158c9e))_0x225f77=_0x225f77+'§'+_0x158c9e;}if(_0x26e507=='')_0x26e507=_0x225f77;else _0x26e507+='|'+_0x225f77;}_0x3df2ec[_0xf247('0x1d')](_0xd0a134['id']+':'+_0x26e507);_0x1b75f3[_0xd0a134['id']]=0x1;}}}}if(hasAdditionalPhones){_0xd4d078[_0xf247('0x1d')]('\x22'+_0x3df2ec[_0xf247('0x17')](';')+'\x22');}if(_0x17db30[_0xf247('0x1c')]){handleError(_0x16470f['data'][_0x43b072],{'code':_0xf247('0x90'),'message':_0x17db30[_0xf247('0x17')]()});}else{fs[_0xf247('0x91')](_0x19d63b,_0xd4d078[_0xf247('0x17')]()+'\x0a');}_0xd4d078=[];}if(!(stats[_0xf247('0x7d')]%0xc8)){socket['emit']('contact:import:'+_0x5d171a,stats);stats['errors']=[];}}if(stopped){logger[_0xf247('0x59')](_0xf247('0x92'));_0x172240['abort']();}}catch(_0x1949f4){handleError(_0x16470f[_0xf247('0x7c')][_0x43b072],{'code':_0xf247('0x93'),'message':_0x1949f4[_0xf247('0x5b')]});logger['error'](_0xf247('0x94'),_0x1949f4[_0xf247('0x5b')]);}},'complete':function(){try{var _0x2731b4=[];var _0x56e53f=[];var _0x2e4f2d=_0xf247('0x35');if(_0xf5a08d[_0xf247('0x95')]&&_0xf5a08d[_0xf247('0x95')]['length']){_0x2e4f2d=_0xf247('0x96')+_0x5d171a;_0x2731b4[_0xf247('0x1d')](_0xf247('0x97')+_0x2e4f2d+_0xf247('0x98'));}tmp_campaigns=_0xf247('0x99')+_0x5d171a;tmp_voice_queues='voice_queues_'+_0x5d171a;_0x56e53f[_0xf247('0x1d')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0xf247('0x9a'));_0x56e53f[_0xf247('0x1d')](_0xf247('0x97')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0xf247('0x9b')](_0x56e53f,handleTZQuery)[_0xf247('0x1b')](function(_0x2b9859){updateTzCampaigns(_0xf5a08d['ListId'])[_0xf247('0x1b')](function(_0x5c1722){updateTzVoiceQueues(_0xf5a08d[_0xf247('0x30')])[_0xf247('0x1b')](function(_0x239943){if(hasTZ)_0x5d3f7d=_0x5d3f7d[_0xf247('0x82')]('dialTimezone',_0xf247('0x9c'));var _0x240320=util['format'](_0xf247('0x9d'),_0x19d63b,_0x2e4f2d,_0x5d3f7d,_0xf5a08d[_0xf247('0x30')],_0xf5a08d[_0xf247('0x52')]||null,NOW,NOW);if(_[_0xf247('0x20')](_0x34598c[_0xf247('0x2e')])){_0x240320+=_0xf247('0x9e');}_0x2731b4[_0xf247('0x1d')](_0x240320);if(_0xf5a08d[_0xf247('0x95')]&&_0xf5a08d[_0xf247('0x95')][_0xf247('0x1c')]){_0x2731b4[_0xf247('0x1d')](insertCmContact(_0xf5a08d[_0xf247('0x30')],_0x2e4f2d,_0xf5a08d['duplicates'],_0x34598c));_0x2731b4['push'](_0xf247('0x9f')+_0x2e4f2d+';');}BPromise[_0xf247('0x9b')](_0x2731b4,handleQuery)[_0xf247('0x1b')](function(_0x5e2625){BPromise[_0xf247('0x1e')]([handleAdditionalPhones()])[_0xf247('0x1b')](function(){_0x2731b4=[];for(var _0x388c69=0x0;_0x388c69\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse'];(function(_0x195343,_0x2a0d70){var _0x15f280=function(_0x1e3760){while(--_0x1e3760){_0x195343['push'](_0x195343['shift']());}};_0x15f280(++_0x2a0d70);}(_0x2eb6,0x172));var _0x62eb=function(_0x29c674,_0x47100a){_0x29c674=_0x29c674-0x0;var _0x8f85c1=_0x2eb6[_0x29c674];return _0x8f85c1;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x62eb('0x0'));var Papa=require(_0x62eb('0x1'));var util=require(_0x62eb('0x2'));var BPromise=require(_0x62eb('0x3'));var moment=require(_0x62eb('0x4'));var squel=require(_0x62eb('0x5'));var Redis=require(_0x62eb('0x6'));var db=require(_0x62eb('0x7'))['db'];var config=require(_0x62eb('0x8'));var shared=require(_0x62eb('0x9'));var logger=require(_0x62eb('0xa'))('import');config[_0x62eb('0xb')]=_['defaults'](config[_0x62eb('0xb')],{'host':_0x62eb('0xc'),'port':0x18eb});var socket=require(_0x62eb('0xd'))(new Redis(config[_0x62eb('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x62eb('0xe')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x62eb('0xe')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x720b75){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))*$/[_0x62eb('0xf')](_0x720b75);}function selectNotIn(_0xbff089,_0x17e476,_0x6461ab,_0x44eb85,_0x5c4b4b){return squel[_0x62eb('0x10')]()[_0x62eb('0x11')](_0x62eb('0x12'))[_0x62eb('0x13')](_0x44eb85)['join'](_0x17e476,null,_0x17e476+_0x62eb('0x14')+_0x44eb85+'.'+_0x6461ab)[_0x62eb('0x15')](_0x44eb85+'.'+_0x6461ab+_0x62eb('0x16')+_0xbff089+'.'+_0x6461ab)[_0x62eb('0x15')](_0x17e476+_0x62eb('0x17')+_0x5c4b4b[_0x62eb('0x18')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x33f696,_0x4ed74a){promisesAdditionalPhones=[];return db[_0x62eb('0x19')][_0x62eb('0x1a')]({'raw':!![],'attributes':['id',_0x62eb('0x1b')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x62eb('0x1c')](function(_0x48a19d){if(_0x48a19d!==null){var _0x79d351=[];for(var _0x3fc5e8=0x0;_0x3fc5e8<_0x48a19d[_0x62eb('0x1d')];_0x3fc5e8++){var _0xbdd9c4=_0x48a19d[_0x3fc5e8];_0x79d351[_0x62eb('0x1e')](insertAdditionalPhones(_0xbdd9c4));}}Promise[_0x62eb('0x1f')](_0x79d351)['then'](function(){_0x33f696({'val':0x1});});});});}function insertAdditionalPhones(_0x1d47f8){return new Promise(function(_0x3d372d,_0x3dce12){var _0x3417c1=_0x1d47f8[_0x62eb('0x1b')];var _0x23bf2d=_0x3417c1[_0x62eb('0x20')](';');var _0x2e9ad9=[];orderBy=0x0;for(var _0x48122e=0x0;_0x48122e<_0x23bf2d[_0x62eb('0x1d')];_0x48122e++){_0x2e9ad9[_0x62eb('0x1e')](splitAdditionalPhone(_0x1d47f8['id'],_0x23bf2d[_0x48122e]));}Promise['all'](_0x2e9ad9)[_0x62eb('0x1c')](function(){_0x3d372d({'val':_0x23bf2d[_0x62eb('0x1d')]});});});}function splitAdditionalPhone(_0x18b01d,_0x3bfa44){return new Promise(function(_0x157214,_0x31db4a){var _0x157563=_0x3bfa44[_0x62eb('0x20')](':');var _0x2ac4d9=_0x157563[0x0];var _0x5d3e7c=_0x157563[0x1];if(!_[_0x62eb('0x21')](_0x5d3e7c)){var _0x57e1e7=_0x5d3e7c['split']('|');var _0x35ca50=[];for(var _0xd04cfc=0x0;_0xd04cfc<_0x57e1e7[_0x62eb('0x1d')];_0xd04cfc++){if(_0x57e1e7[_0xd04cfc]!==''){var _0x49a2cf=_[_0x62eb('0x22')](promisesAdditionalPhones,{'contactId':_0x18b01d,'phone':_0x57e1e7[_0xd04cfc]});if(_0x49a2cf[_0x62eb('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0x62eb('0x1e')]({'contactId':_0x18b01d,'contactTypeId':_0x2ac4d9,'phone':_0x57e1e7[_0xd04cfc],'orderBy':orderBy});}}}_0x157214({'ok':0x1});}else _0x157214({'res':0x0});});}function createAdditionalPhone(_0x5772b3,_0x1067b9,_0x3acb6f,_0x4d01bd){var _0x7fcb9c='';var _0x283f61='';var _0x2c71ae=_0x3acb6f[_0x62eb('0x20')]('§');_0x7fcb9c=_0x2c71ae[0x0];if(_0x2c71ae[_0x62eb('0x1d')]==0x2)_0x283f61=_0x2c71ae[0x1];return new Promise(function(_0x3af026,_0x183c13){return db[_0x62eb('0x23')][_0x62eb('0x24')]({'where':{'CmContactId':_0x5772b3,'item':_0x7fcb9c}})[_0x62eb('0x1c')](function(_0x33767a){if(_0x33767a){return db['CmContactHasItem']['update']({'ItemTypeId':_0x1067b9,'description':_0x283f61,'OrderBy':_0x4d01bd},{'where':{'CmContactId':_0x5772b3,'item':_0x7fcb9c}})[_0x62eb('0x1c')](function(_0x3bd8c3){_0x3af026({'res':_0x62eb('0x25')});});}else{return db[_0x62eb('0x23')]['create']({'CmContactId':_0x5772b3,'item':_0x7fcb9c,'description':_0x283f61,'ItemTypeId':_0x1067b9,'OrderBy':_0x4d01bd,'ItemClass':_0x62eb('0x26')})[_0x62eb('0x1c')](function(_0x3eba8d){_0x3af026({'res':_0x62eb('0x27')});});}});});}function insertCmHopper(_0x3cf020,_0x47ed8a,_0x41a936,_0x376af4,_0x1a5e02){var _0x43bab3=['cm_contacts.phone',_0x62eb('0x28'),_0x62eb('0x29'),_0x62eb('0x2a'),_0x47ed8a+'.'+_0x376af4,_0x62eb('0x2b'),_0x62eb('0x2c'),_0x62eb('0x2d'),_0x62eb('0x2e'),'\x22'+_0x1a5e02+'\x22'];return squel[_0x62eb('0x2f')]()[_0x62eb('0x30')](_0x62eb('0x31'))[_0x62eb('0x32')](['phone','scheduledat',_0x62eb('0x33'),_0x62eb('0x34'),_0x376af4,_0x62eb('0x35'),_0x62eb('0x36'),'priority',_0x62eb('0x37'),_0x62eb('0x38')],squel['select']()[_0x62eb('0x39')](_0x43bab3)[_0x62eb('0x13')](_0x47ed8a)[_0x62eb('0x18')](_0x62eb('0x3a'),null,_0x62eb('0x3b')+_0x47ed8a+_0x62eb('0x3c'))[_0x62eb('0x18')](_0x41a936,null,_0x41a936+_0x62eb('0x14')+_0x47ed8a+'.'+_0x376af4)[_0x62eb('0x15')](_0x47ed8a+_0x62eb('0x3d'),_0x3cf020)['where'](_0x62eb('0x3e'),NOW)[_0x62eb('0x15')](_0x62eb('0x3f'),selectNotIn(_0x47ed8a,_0x41a936,_0x376af4,'cm_hopper',[_0x62eb('0x40'),_0x62eb('0x41')]))['where'](_0x62eb('0x3f'),selectNotIn(_0x47ed8a,_0x41a936,_0x376af4,_0x62eb('0x31'),[_0x62eb('0x40')])))[_0x62eb('0x42')]();}function insertCmHopperBlack(_0x5a3be3,_0x5a0d47,_0x5c9ed3,_0x3319c5){var _0xe4bbe4=[_0x62eb('0x43'),_0x62eb('0x29'),_0x62eb('0x2a'),_0x5a0d47+'.'+_0x3319c5,'cm_contacts.createdAt',_0x62eb('0x2c')];return squel['insert']()['into']('cm_hopper_black')[_0x62eb('0x32')]([_0x62eb('0x12'),_0x62eb('0x33'),_0x62eb('0x34'),_0x3319c5,'createdAt',_0x62eb('0x36')],squel[_0x62eb('0x10')]()[_0x62eb('0x39')](_0xe4bbe4)[_0x62eb('0x13')](_0x5a0d47)[_0x62eb('0x18')](_0x62eb('0x3a'),null,_0x62eb('0x3b')+_0x5a0d47+_0x62eb('0x3c'))[_0x62eb('0x18')](_0x5c9ed3,null,_0x5c9ed3+_0x62eb('0x14')+_0x5a0d47+'.'+_0x3319c5)[_0x62eb('0x15')](_0x5a0d47+_0x62eb('0x3d'),_0x5a3be3)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x62eb('0x15')](_0x62eb('0x3f'),squel[_0x62eb('0x10')]()[_0x62eb('0x11')](_0x62eb('0x12'))[_0x62eb('0x13')]('cm_hopper_black')[_0x62eb('0x15')](_0x62eb('0x44'),_0x5a3be3)[_0x62eb('0x15')](_0x3319c5+'\x20=\x20'+_0x5a0d47+'.'+_0x3319c5)))[_0x62eb('0x42')]();}function insertTzCmHopper(_0x2f50ab,_0x4a2532,_0x19802b,_0x49bf60,_0x49ae54,_0xe6e82e){var _0x406bec=[_0x62eb('0x43'),_0x62eb('0x45')+_0xe6e82e+_0x62eb('0x46'),'cm_contacts.id',_0x62eb('0x2a'),_0x4a2532+'.'+_0x49bf60,'cm_contacts.createdAt',_0x62eb('0x2c'),_0x62eb('0x2d'),_0x62eb('0x2e'),'\x22'+_0x49ae54+'\x22'];var _0x53373f=squel[_0x62eb('0x2f')]()[_0x62eb('0x30')](_0x62eb('0x31'))[_0x62eb('0x32')]([_0x62eb('0x12'),_0x62eb('0x47'),_0x62eb('0x33'),_0x62eb('0x34'),_0x49bf60,_0x62eb('0x35'),_0x62eb('0x36'),'priority',_0x62eb('0x37'),_0x62eb('0x38')],squel[_0x62eb('0x10')]()[_0x62eb('0x39')](_0x406bec)[_0x62eb('0x13')](_0x4a2532)[_0x62eb('0x18')](_0x62eb('0x3a'),null,_0x62eb('0x3b')+_0x4a2532+_0x62eb('0x3c'))[_0x62eb('0x18')](_0x19802b,null,_0x19802b+'.id\x20=\x20'+_0x4a2532+'.'+_0x49bf60)[_0x62eb('0x18')](_0xe6e82e,null,_0xe6e82e+_0x62eb('0x14')+_0x4a2532+'.'+_0x49bf60)[_0x62eb('0x15')](_0x4a2532+_0x62eb('0x3d'),_0x2f50ab)[_0x62eb('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x62eb('0x15')](_0x62eb('0x3f'),selectNotIn(_0x4a2532,_0x19802b,_0x49bf60,_0x62eb('0x31'),[_0x62eb('0x40'),_0x62eb('0x41')]))[_0x62eb('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4a2532,_0x19802b,_0x49bf60,_0x62eb('0x31'),[_0x62eb('0x40')])))[_0x62eb('0x42')]();return _0x53373f;}function insertTzCmHopperBlack(_0x34075d,_0x3ab469,_0x1dbb44,_0x4282c6){var _0x4bbe5d=[_0x62eb('0x43'),_0x62eb('0x29'),_0x62eb('0x2a'),_0x3ab469+'.'+_0x4282c6,_0x62eb('0x2b'),'cm_contacts.updatedAt'];return squel[_0x62eb('0x2f')]()['into']('cm_hopper_black')[_0x62eb('0x32')]([_0x62eb('0x12'),_0x62eb('0x33'),_0x62eb('0x34'),_0x4282c6,_0x62eb('0x35'),_0x62eb('0x36')],squel['select']()[_0x62eb('0x39')](_0x4bbe5d)['from'](_0x3ab469)[_0x62eb('0x18')]('cm_contacts',null,_0x62eb('0x3b')+_0x3ab469+_0x62eb('0x3c'))['join'](_0x1dbb44,null,_0x1dbb44+_0x62eb('0x14')+_0x3ab469+'.'+_0x4282c6)[_0x62eb('0x15')](_0x3ab469+_0x62eb('0x3d'),_0x34075d)['where'](_0x62eb('0x3e'),NOW)[_0x62eb('0x15')](_0x62eb('0x3f'),squel[_0x62eb('0x10')]()[_0x62eb('0x11')](_0x62eb('0x12'))[_0x62eb('0x13')](_0x62eb('0x48'))[_0x62eb('0x15')](_0x62eb('0x44'),_0x34075d)['where'](_0x4282c6+'\x20=\x20'+_0x3ab469+'.'+_0x4282c6)))[_0x62eb('0x42')]();}function insertCmHopperAdditionalPhones(_0x34a4fe){var _0x2e7a2e=[_0x62eb('0x49'),_0x62eb('0x4a'),'cm_contact_has_items.OrderBy',_0x62eb('0x4b'),_0x62eb('0x4c')];return squel[_0x62eb('0x2f')]()[_0x62eb('0x30')](_0x62eb('0x4d'))[_0x62eb('0x32')](['CmHopperId','phone',_0x62eb('0x4e'),_0x62eb('0x35'),'updatedAt'],squel['select']()[_0x62eb('0x39')](_0x2e7a2e)[_0x62eb('0x13')](_0x62eb('0x31'))[_0x62eb('0x18')](_0x62eb('0x3a'),null,_0x62eb('0x4f'))[_0x62eb('0x18')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where'](_0x62eb('0x50'),_0x34a4fe)[_0x62eb('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x62eb('0x42')]();}function insertCmContact(_0x4705f7,_0x1e1178,_0x24d3cb,_0x385754){var _0x297859=_[_0x62eb('0x51')](_['keys'](_0x385754),[_0x62eb('0x34'),_0x62eb('0x52'),_0x62eb('0x35'),_0x62eb('0x36'),_0x62eb('0x53')]);return squel['insert']()[_0x62eb('0x30')](_0x62eb('0x3a'))['fromQuery'](_0x297859,squel[_0x62eb('0x10')]()[_0x62eb('0x39')](_0x297859)[_0x62eb('0x13')](_0x1e1178)[_0x62eb('0x15')]('('+_0x24d3cb[_0x62eb('0x18')](',')+')\x20NOT\x20IN\x20?',squel[_0x62eb('0x10')]()[_0x62eb('0x39')](_0x24d3cb)[_0x62eb('0x13')](_0x62eb('0x3a'))[_0x62eb('0x15')](_0x62eb('0x44'),_0x4705f7)['where'](_0x62eb('0x54')))[_0x62eb('0x15')](_0x62eb('0x55'),squel[_0x62eb('0x10')]()[_0x62eb('0x11')](_0x62eb('0x56'),_0x62eb('0x57'))['from'](_0x1e1178)[_0x62eb('0x58')](_0x24d3cb[_0x62eb('0x18')](','))))[_0x62eb('0x42')]();}function handleStop(){logger[_0x62eb('0x59')](_0x62eb('0x5a'));stopped=!![];}function handleUncaughtException(_0xae1565){logger[_0x62eb('0x5b')](_0xae1565[_0x62eb('0x5c')]);process['exit'](0x1);}function handleError(_0x28a594,_0x5266c3){stats['errors'][_0x62eb('0x1e')]({'name':_0x5266c3[_0x62eb('0x5d')],'message':_0x5266c3['message'],'row':_0x28a594});}function handleQuery(_0x22ca55){logger[_0x62eb('0x59')](_0x22ca55);return db['sequelize'][_0x62eb('0x5e')](_0x22ca55)[_0x62eb('0x5f')](function(_0x3ff3fe){results['push'](_0x3ff3fe);})[_0x62eb('0x60')](function(_0x1e1c14){logger[_0x62eb('0x5b')](_0x1e1c14[_0x62eb('0x5c')]);});}function updateTzCampaigns(_0x3266be){return new Promise(function(_0x1b4c01,_0x435bd0){var _0x57dece=squel['select']()[_0x62eb('0x39')]([_0x62eb('0x61'),'campaigns.dialTimezone'])['from']('campaigns')[_0x62eb('0x18')](_0x62eb('0x62'),null,_0x62eb('0x63'))['where']('campaigns_has_cm_lists.CmListId='+_0x3266be);db[_0x62eb('0x64')]['query'](_0x57dece[_0x62eb('0x42')]())[_0x62eb('0x5f')](function(_0x1547a4){var _0x25d3c2=[];for(var _0x46a23b=0x0;_0x46a23b<_0x1547a4['length'];_0x46a23b++){_0x25d3c2[_0x62eb('0x1e')](getTimezoneData(_0x1547a4[_0x46a23b],tmp_campaigns));}BPromise[_0x62eb('0x1f')](_0x25d3c2)[_0x62eb('0x1c')](function(){_0x1b4c01({'val':0x1});});})['catch'](function(_0x1e3659){logger[_0x62eb('0x5b')](_0x1e3659[_0x62eb('0x5c')]);_0x1b4c01({'val':0x0});});});}function updateTzVoiceQueues(_0x41f83a){return new Promise(function(_0x29ca9d,_0x3b6cf4){var _0x34d6b2=squel[_0x62eb('0x10')]()[_0x62eb('0x39')]([_0x62eb('0x65'),_0x62eb('0x66')])['from'](_0x62eb('0x67'))['join'](_0x62eb('0x68'),null,_0x62eb('0x69'))['where']('voice_queues_has_cm_lists.CmListId='+_0x41f83a);db['sequelize']['query'](_0x34d6b2['toString']())[_0x62eb('0x5f')](function(_0x3ce1e3){var _0x4fb49a=[];for(var _0x955024=0x0;_0x955024<_0x3ce1e3[_0x62eb('0x1d')];_0x955024++){_0x4fb49a['push'](getTimezoneData(_0x3ce1e3[_0x955024],tmp_voice_queues));}BPromise[_0x62eb('0x1f')](_0x4fb49a)[_0x62eb('0x1c')](function(){_0x29ca9d({'val':0x1});});})['catch'](function(_0x8c53fc){logger[_0x62eb('0x5b')](_0x8c53fc['message']);_0x29ca9d({'val':0x0});});});}function getTimezoneData(_0x2e0a32,_0x2aa8e4){return new Promise(function(_0x171365,_0x94f6e2){var _0x15a9b5=shared[_0x62eb('0x6a')];var _0x5a9f9d=_0x15a9b5[_0x2e0a32[_0x62eb('0x6b')]];if(_[_0x62eb('0x21')](_0x5a9f9d)){_0x171365({'ret':0x1});}else{var _0x192d22=_0x5a9f9d['utcOffset'];var _0x1143ca=squel['insert']()[_0x62eb('0x30')](_0x2aa8e4)['set']('id',_0x2e0a32['id'])[_0x62eb('0x6c')]('offset',_0x192d22)[_0x62eb('0x6c')](_0x62eb('0x6b'),_0x2e0a32['dialTimezone'])[_0x62eb('0x42')]();return db[_0x62eb('0x64')][_0x62eb('0x5e')](_0x1143ca)[_0x62eb('0x5f')](function(_0x5c9e26){_0x171365({'ret':0x1});})['catch'](function(_0x1ba6e9){logger[_0x62eb('0x5b')](_0x1ba6e9[_0x62eb('0x5c')]);_0x94f6e2({'ret':0x1});});}});}function handleTZQuery(_0x1319af){logger[_0x62eb('0x59')](_0x1319af);return db['sequelize'][_0x62eb('0x5e')](_0x1319af)['spread'](function(_0x4076c7){})[_0x62eb('0x60')](function(_0x5b8839){logger['error'](_0x5b8839[_0x62eb('0x5c')]);});}function main(_0x382a79,_0x23a444,_0x132b3d,_0x5b9543){logger['info']('main',_0x382a79,JSON[_0x62eb('0x6d')](_0x23a444));process[_0x62eb('0x6e')](_0x62eb('0x6f'));var _0x6c221c=_0x23a444[_0x62eb('0x70')];var _0x343dd3=_[_0x62eb('0x71')](_0x6c221c);var _0x35f037=_0x23a444[_0x62eb('0x72')];var _0x3b5f90=path[_0x62eb('0x18')](config[_0x62eb('0x73')],'server/files/tmp',_0x35f037+'.csv');hasTZ=_[_0x62eb('0x74')](_0x6c221c)[_0x62eb('0x75')](_0x62eb('0x6b'));var _0x5a981c=_[_0x62eb('0x74')](_0x6c221c)['join']();logger['info'](_0x62eb('0x76'),_0x5a981c);db[_0x62eb('0x77')][_0x62eb('0x1a')]({'raw':!![],'attributes':['id','name']})[_0x62eb('0x1c')](function(_0x37755c){for(var _0x510ab5=0x0;_0x510ab5<_0x37755c[_0x62eb('0x1d')];_0x510ab5++){if(_0x37755c[_0x510ab5]['name']in _0x6c221c){contactItemTypes[_0x62eb('0x1e')](_0x37755c[_0x510ab5]);delete _0x343dd3[_0x37755c[_0x510ab5][_0x62eb('0x78')]];hasAdditionalPhones=!![];}for(var _0x514bc5 in _0x6c221c){if(_0x37755c[_0x510ab5][_0x62eb('0x78')]+_0x62eb('0x79')===_0x514bc5){phoneDescriptions[_0x62eb('0x1e')]({'itemTypeId':_0x37755c[_0x510ab5]['id'],'description':_0x514bc5});delete _0x343dd3[_0x514bc5];}}}if(hasAdditionalPhones)_0x343dd3['AdditionalPhones']='';var _0x165df6=_[_0x62eb('0x74')](_0x343dd3)[_0x62eb('0x18')]();logger[_0x62eb('0x59')](_0x62eb('0x76'),_0x165df6);fs[_0x62eb('0x7a')](_0x3b5f90,_0x165df6+'\x0a');Papa[_0x62eb('0x7b')](fs[_0x62eb('0x7c')](_0x382a79),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1674ad,_0x50d766){try{for(var _0x5d7e6e=0x0,_0x514c65=[];_0x5d7e6e<_0x1674ad[_0x62eb('0x7d')][_0x62eb('0x1d')];_0x5d7e6e++){stats['rows']+=0x1;if(_0x1674ad[_0x62eb('0x7e')][_0x5d7e6e]){handleError(_0x1674ad['data'][_0x5d7e6e],_0x1674ad[_0x62eb('0x7e')][_0x5d7e6e]);}else{var _0x44ce5c=[];var _0x1137bf=[];var _0x3e2f60={};for(var _0x3f78e9 in _0x6c221c){let _0x3ebfb9=contactItemTypes[_0x62eb('0x7f')](_0x475ef2=>_0x475ef2[_0x62eb('0x78')]===_0x3f78e9);let _0x1a092f=contactItemTypes[_0x62eb('0x7f')](_0x58adb6=>_0x58adb6['name']+_0x62eb('0x79')===_0x3f78e9);if(_[_0x62eb('0x21')](_0x3ebfb9)&&_[_0x62eb('0x21')](_0x1a092f)){if(_0x6c221c[_0x62eb('0x80')](_0x3f78e9)){if(_0x1674ad[_0x62eb('0x7d')][_0x5d7e6e][_0x6c221c[_0x3f78e9]]){var _0x808691=_[_0x62eb('0x81')](_0x1674ad['data'][_0x5d7e6e][_0x6c221c[_0x3f78e9]][_0x62eb('0x82')](/"/g,'\x27'));switch(_0x3f78e9){case _0x62eb('0x47'):var _0x494201=moment(_0x808691,_0x62eb('0x83'),!![]);if(_0x494201['isValid']()){_0x514c65[_0x62eb('0x1e')]('\x22'+_0x808691+'\x22');}else{_0x44ce5c[_0x62eb('0x1e')](_0x62eb('0x84'));}break;case _0x62eb('0x85'):var _0x55987f=parseInt(_0x808691);_0x808691=_[_0x62eb('0x86')](_0x55987f)||_0x55987f<0x0||_0x55987f>0x4?_0x5b9543?0x3:0x2:_0x55987f;_0x514c65[_0x62eb('0x1e')]('\x22'+_0x808691+'\x22');break;case _0x62eb('0x37'):var _0x1033a8=parseInt(_0x808691);if(_[_0x62eb('0x87')](_0x1033a8)&&_[_0x62eb('0x75')](_0x132b3d,_0x1033a8)){_0x514c65[_0x62eb('0x1e')]('\x22'+_0x1033a8+'\x22');}else{_0x44ce5c[_0x62eb('0x1e')](_0x62eb('0x88'));}break;case _0x62eb('0x89'):if(isEmail(_0x808691)){_0x514c65[_0x62eb('0x1e')]('\x22'+_0x808691+'\x22');}else{_0x44ce5c[_0x62eb('0x1e')](_0x62eb('0x8a'));}break;case _0x62eb('0x8b'):var _0x45ad4c=moment(_0x808691,'YYYY-MM-DD',!![]);if(_0x45ad4c['isValid']()){_0x514c65[_0x62eb('0x1e')]('\x22'+_0x808691+'\x22');}else{_0x44ce5c[_0x62eb('0x1e')](_0x62eb('0x8c'));}break;case _0x62eb('0x6b'):var _0x560760=shared['timezones'];var _0x5ecdc7=_0x560760[_0x808691];if(!_[_0x62eb('0x21')](_0x5ecdc7)){var _0x230f2e=_0x5ecdc7['utcOffset'];_0x514c65[_0x62eb('0x1e')]('\x22'+_0x808691+'\x22');_0x514c65['push']('\x22'+_0x230f2e+'\x22');}break;default:_0x514c65[_0x62eb('0x1e')]('\x22'+_0x808691+'\x22');}}else{switch(_0x3f78e9){case _0x62eb('0x8d'):case'phone':_0x44ce5c[_0x62eb('0x1e')](_0x3f78e9+'\x20not\x20specified');break;default:_0x514c65['push']('\x22\x22');}}}}else{var _0x2714a0='';if(!_[_0x62eb('0x21')](_0x3ebfb9)){if(!_0x3e2f60[_0x62eb('0x80')](_0x3ebfb9['id'])){if(!_[_0x62eb('0x21')](_0x1674ad['data'][_0x5d7e6e][_0x6c221c[_0x3f78e9]])){var _0x808691=_[_0x62eb('0x81')](_0x1674ad[_0x62eb('0x7d')][_0x5d7e6e][_0x6c221c[_0x3f78e9]][_0x62eb('0x82')](/"/g,'\x27'));var _0x1b04f6=phoneDescriptions[_0x62eb('0x7f')](_0x5a842b=>_0x5a842b[_0x62eb('0x8e')]===_0x3ebfb9['id']);if(!_['isNil'](_0x1b04f6)){var _0x1b4471=_['trim'](_0x1674ad[_0x62eb('0x7d')][_0x5d7e6e][_0x6c221c[_0x1b04f6[_0x62eb('0x8f')]]][_0x62eb('0x82')](/"/g,'\x27'));if(!_[_0x62eb('0x21')](_0x1b4471))_0x808691=_0x808691+'§'+_0x1b4471;}if(_0x2714a0=='')_0x2714a0=_0x808691;else _0x2714a0+='|'+_0x808691;}_0x1137bf[_0x62eb('0x1e')](_0x3ebfb9['id']+':'+_0x2714a0);_0x3e2f60[_0x3ebfb9['id']]=0x1;}}}}if(hasAdditionalPhones){_0x514c65[_0x62eb('0x1e')]('\x22'+_0x1137bf[_0x62eb('0x18')](';')+'\x22');}if(_0x44ce5c[_0x62eb('0x1d')]){handleError(_0x1674ad[_0x62eb('0x7d')][_0x5d7e6e],{'code':_0x62eb('0x90'),'message':_0x44ce5c[_0x62eb('0x18')]()});}else{fs[_0x62eb('0x91')](_0x3b5f90,_0x514c65['join']()+'\x0a');}_0x514c65=[];}if(!(stats['rows']%0xc8)){socket[_0x62eb('0x92')]('contact:import:'+_0x35f037,stats);stats['errors']=[];}}if(stopped){logger[_0x62eb('0x59')]('Abort\x20parser');_0x50d766[_0x62eb('0x93')]();}}catch(_0x47f3c8){handleError(_0x1674ad[_0x62eb('0x7d')][_0x5d7e6e],{'code':_0x62eb('0x94'),'message':_0x47f3c8[_0x62eb('0x5c')]});logger[_0x62eb('0x5b')](_0x62eb('0x95'),_0x47f3c8[_0x62eb('0x5c')]);}},'complete':function(){try{var _0x13866e=[];var _0x48d015=[];var _0x18dd87='cm_contacts';if(_0x23a444[_0x62eb('0x96')]&&_0x23a444[_0x62eb('0x96')][_0x62eb('0x1d')]){_0x18dd87='cm_contacts_'+_0x35f037;_0x13866e['push']('CREATE\x20TABLE\x20'+_0x18dd87+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x62eb('0x97')+_0x35f037;tmp_voice_queues=_0x62eb('0x98')+_0x35f037;_0x48d015[_0x62eb('0x1e')](_0x62eb('0x99')+tmp_campaigns+_0x62eb('0x9a'));_0x48d015[_0x62eb('0x1e')](_0x62eb('0x99')+tmp_voice_queues+_0x62eb('0x9a'));BPromise[_0x62eb('0x9b')](_0x48d015,handleTZQuery)['then'](function(_0x272591){updateTzCampaigns(_0x23a444[_0x62eb('0x34')])[_0x62eb('0x1c')](function(_0x555add){updateTzVoiceQueues(_0x23a444[_0x62eb('0x34')])['then'](function(_0x3721aa){if(hasTZ)_0x165df6=_0x165df6[_0x62eb('0x82')](_0x62eb('0x6b'),_0x62eb('0x9c'));var _0xe3c0fd=util[_0x62eb('0xe')](_0x62eb('0x9d'),_0x3b5f90,_0x18dd87,_0x165df6,_0x23a444[_0x62eb('0x34')],_0x23a444[_0x62eb('0x52')]||null,NOW,NOW);if(_[_0x62eb('0x21')](_0x6c221c[_0x62eb('0x47')])){_0xe3c0fd+=_0x62eb('0x9e');}_0x13866e[_0x62eb('0x1e')](_0xe3c0fd);if(_0x23a444[_0x62eb('0x96')]&&_0x23a444[_0x62eb('0x96')]['length']){_0x13866e[_0x62eb('0x1e')](insertCmContact(_0x23a444[_0x62eb('0x34')],_0x18dd87,_0x23a444['duplicates'],_0x6c221c));_0x13866e['push'](_0x62eb('0x9f')+_0x18dd87+';');}BPromise[_0x62eb('0x9b')](_0x13866e,handleQuery)[_0x62eb('0x1c')](function(_0x38679d){BPromise['all']([handleAdditionalPhones()])[_0x62eb('0x1c')](function(){_0x13866e=[];for(var _0x3c8166=0x0;_0x3c8166_0x5cf490['name']===_0x3eef75);let _0x54e339=contactItemTypes[_0xb464('0x79')](_0x297ad3=>_0x297ad3['name']+_0xb464('0x73')===_0x3eef75);if(_[_0xb464('0x1d')](_0x2981e9)&&_[_0xb464('0x1d')](_0x54e339)){if(_0x248628[_0xb464('0x7a')](_0x3eef75)){if(_0x1347b0[_0xb464('0x76')][_0x38637b][_0x248628[_0x3eef75]]){var _0x240216=_[_0xb464('0x7b')](_0x1347b0[_0xb464('0x76')][_0x38637b][_0x248628[_0x3eef75]][_0xb464('0x7c')](/"/g,'\x27'));switch(_0x3eef75){case _0xb464('0x3a'):var _0x3647c5=moment(_0x240216,_0xb464('0x10'),!![]);if(_0x3647c5[_0xb464('0x7d')]()){_0x36ade7[_0xb464('0x1f')]('\x22'+_0x240216+'\x22');}else{_0x5494f9[_0xb464('0x1f')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xb464('0x3d'):var _0x21ea81=parseInt(_0x240216);_0x240216=_[_0xb464('0x7e')](_0x21ea81)||_0x21ea81<0x0||_0x21ea81>0x4?_0x2d7913?0x3:0x2:_0x21ea81;_0x36ade7[_0xb464('0x1f')]('\x22'+_0x240216+'\x22');break;case _0xb464('0x3e'):var _0x2e4eef=parseInt(_0x240216);if(_[_0xb464('0x7f')](_0x2e4eef)&&_[_0xb464('0x80')](_0x1e4851,_0x2e4eef)){_0x36ade7[_0xb464('0x1f')]('\x22'+_0x2e4eef+'\x22');}else{_0x5494f9[_0xb464('0x1f')](_0xb464('0x81'));}break;case'email':if(isEmail(_0x240216)){_0x36ade7['push']('\x22'+_0x240216+'\x22');}else{_0x5494f9[_0xb464('0x1f')](_0xb464('0x82'));}break;case _0xb464('0x83'):var _0x1de1b9=moment(_0x240216,_0xb464('0x84'),!![]);if(_0x1de1b9[_0xb464('0x7d')]()){_0x36ade7[_0xb464('0x1f')]('\x22'+_0x240216+'\x22');}else{_0x5494f9[_0xb464('0x1f')](_0xb464('0x85'));}break;default:_0x36ade7[_0xb464('0x1f')]('\x22'+_0x240216+'\x22');}}else{switch(_0x3eef75){case _0xb464('0x86'):case _0xb464('0x4e'):_0x5494f9['push'](_0x3eef75+_0xb464('0x87'));break;default:_0x36ade7[_0xb464('0x1f')]('\x22\x22');}}}}else{var _0x152c5='';if(!_[_0xb464('0x1d')](_0x2981e9)){if(!_0x499deb[_0xb464('0x7a')](_0x2981e9['id'])){for(var _0x321f38=0x0;_0x321f38<_0x248628[_0x3eef75][_0xb464('0x25')];_0x321f38++){var _0x240216=_[_0xb464('0x7b')](_0x1347b0[_0xb464('0x76')][_0x38637b][_0x248628[_0x3eef75][_0x321f38]][_0xb464('0x7c')](/"/g,'\x27'));var _0x39815a=phoneDescriptions[_0xb464('0x79')](_0x48cdfb=>_0x48cdfb['itemTypeId']===_0x2981e9['id']);if(!_[_0xb464('0x1d')](_0x39815a)){var _0x661707=_['trim'](_0x1347b0[_0xb464('0x76')][_0x38637b][_0x248628[_0x39815a[_0xb464('0x88')]][0x0]][_0xb464('0x7c')](/"/g,'\x27'));if(!_[_0xb464('0x1d')](_0x661707))_0x240216=_0x240216+'§'+_0x661707;}if(_0x152c5=='')_0x152c5=_0x240216;else _0x152c5+='|'+_0x240216;}_0x420831[_0xb464('0x1f')](_0x2981e9['id']+':'+_0x152c5);_0x499deb[_0x2981e9['id']]=0x1;}}}}if(hasAdditionalPhones){_0x36ade7[_0xb464('0x1f')]('\x22'+_0x420831[_0xb464('0x15')](';')+'\x22');}if(_0x5494f9[_0xb464('0x25')]){handleError(_0x1347b0[_0xb464('0x76')][_0x38637b],{'code':_0xb464('0x89'),'message':_0x5494f9[_0xb464('0x15')]()});}else{fs[_0xb464('0x8a')](_0x36b4d4,_0x36ade7[_0xb464('0x15')]()+'\x0a');}_0x36ade7=[];}if(!(stats[_0xb464('0x77')]%0xc8)){socket[_0xb464('0x8b')](_0xb464('0x8c')+_0x596f7a,stats);stats[_0xb464('0x78')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x2be33f[_0xb464('0x8d')]();}}catch(_0x577055){handleError(_0x1347b0[_0xb464('0x76')][_0x38637b],{'code':'SystemError','message':_0x577055[_0xb464('0x23')]});logger[_0xb464('0x66')](_0xb464('0x8e'),_0x577055[_0xb464('0x23')]);}},'complete':function(){try{var _0x3bf900=[];var _0x1e67b9=tempTableName;_0x3bf900[_0xb464('0x1f')](_0xb464('0x8f')+_0x1e67b9+_0xb464('0x90'));logger[_0xb464('0x64')](_0xb464('0x91'),contactItemTypes[_0xb464('0x25')]);var _0x265f27=util[_0xb464('0xf')](_0xb464('0x92'),_0x36b4d4,_0x1e67b9,_0x31ce04,_0x365b88[_0xb464('0x49')],_0x365b88[_0xb464('0x5e')]||null,NOW,NOW);if(_[_0xb464('0x1d')](_0x248628['scheduledat'])){_0x265f27+=_0xb464('0x93');}_0x3bf900[_0xb464('0x1f')](_0x265f27);BPromise[_0xb464('0x94')](_0x3bf900,handleQuery)[_0xb464('0x21')](function(_0x2c7dcc){BPromise[_0xb464('0x20')]([handleAdditionalPhones()])[_0xb464('0x21')](function(){_0x3bf900=[];for(var _0x3955e1=0x0;_0x3955e1\x20\x20');}var _0x5bf8fd=path['join'](config['root'],_0xb464('0x9c'),process[_0xb464('0x9b')][0x2]);if(!fs[_0xb464('0x9d')](_0x5bf8fd)){throw new Error(_0xb464('0x9e'));}var _0x1d6208={};try{_0x1d6208=JSON[_0xb464('0x9f')](process['argv'][0x3]);if(!_0x1d6208[_0xb464('0x6c')]){throw new Error(_0xb464('0xa0'));}var _0x35de3f=0x0;if(_0x1d6208[_0xb464('0x6c')][_0xb464('0x3e')]){_0x35de3f=0x1;}if(!_0x1d6208[_0xb464('0x49')]){throw new Error(_0xb464('0xa1'));}}catch(_0x147aa9){throw new Error(_0xb464('0xa2'));}var _0x3156e1=[];try{_0x3156e1=_['map'](JSON[_0xb464('0x9f')](process[_0xb464('0x9b')][0x4]),'id');}catch(_0x123fd7){logger[_0xb464('0x64')]('No\x20agent\x20available');}main(_0x5bf8fd,_0x1d6208,_0x3156e1,_0x35de3f);}validate();process['on']('SIGINT',handleStop);process['on'](_0xb464('0xa3'),handleUncaughtException); \ No newline at end of file +var _0x19e1=['email\x20wrong\x20format','dateOfBirth','firstName','\x20not\x20specified','description','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','step','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\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contactId','contactTypeId','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','squel','ioredis','../../../config/environment','../../../config/logger','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','format','test','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','isNil','AdditionalPhones','push','all','then','catch','message','split','length','findOne','CmContactHasItem','update','PHONE','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_hopper_black','fields','cm_contacts','.CmListId','field','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','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','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','error','exit','errors','code','info','main','stringify','send','start','binding','clone','socket_timestamp','server/files/tmp','.csv','body','ContactItemType','findAll','name','_description','header','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','scheduledat','isValid','isNaN','isNumber','agent\x20not\x20exists','email'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x19e1,0x163));var _0x119e=function(_0x2aefb6,_0x1bd384){_0x2aefb6=_0x2aefb6-0x0;var _0x202772=_0x19e1[_0x2aefb6];return _0x202772;};'use strict';var fs=require('fs');var path=require(_0x119e('0x0'));var _=require(_0x119e('0x1'));var Papa=require(_0x119e('0x2'));var util=require(_0x119e('0x3'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x119e('0x4'));var Redis=require(_0x119e('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0x119e('0x6'));var logger=require(_0x119e('0x7'))('import');config[_0x119e('0x8')]=_['defaults'](config[_0x119e('0x8')],{'host':_0x119e('0x9'),'port':0x18eb});var socket=require(_0x119e('0xa'))(new Redis(config[_0x119e('0x8')]));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'](_0x119e('0xb'));var tempTableName=_0x119e('0xc')+moment()[_0x119e('0xd')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x4ee06c){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))*$/[_0x119e('0xe')](_0x4ee06c);}function selectNotIn(_0xc2c4a7,_0x3199b1,_0x35fbf1,_0x475b7f,_0x24a27b){return squel[_0x119e('0xf')]()['field'](_0x119e('0x10'))[_0x119e('0x11')](_0x475b7f)[_0x119e('0x12')](_0x3199b1,null,_0x3199b1+_0x119e('0x13')+_0x475b7f+'.'+_0x35fbf1)[_0x119e('0x14')](_0x475b7f+'.'+_0x35fbf1+_0x119e('0x15')+_0xc2c4a7+'.'+_0x35fbf1)['where'](_0x3199b1+_0x119e('0x16')+_0x24a27b[_0x119e('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1c6fd5,_0x881816){promisesAdditionalPhones=[];promisesContact=[];return db[_0x119e('0x17')][_0x119e('0x18')](_0x119e('0x19')+tempTableName)[_0x119e('0x1a')](function(_0x2c5902){if(_0x2c5902!==null){var _0x42acfd=[];for(var _0x41f329=0x0;_0x41f329<_0x2c5902['length'];_0x41f329++){var _0x1820ff=_0x2c5902[_0x41f329];if(!_[_0x119e('0x1b')](_0x1820ff[_0x119e('0x10')])){if(!_[_0x119e('0x1b')](_0x1820ff[_0x119e('0x1c')]))_0x42acfd[_0x119e('0x1d')](insertAdditionalPhones(_0x1820ff));promisesContact[_0x119e('0x1d')]({'contact':_0x1820ff});}}}Promise[_0x119e('0x1e')](_0x42acfd)[_0x119e('0x1f')](function(){_0x1c6fd5({'val':0x1});});})[_0x119e('0x20')](function(_0x2bd27a){logger['error'](_0x2bd27a[_0x119e('0x21')]);});});}function insertAdditionalPhones(_0x5ef280){return new Promise(function(_0xd4c2d5,_0x523a8d){var _0x3cb1bb=_0x5ef280[_0x119e('0x1c')];if(_['isNil'](_0x3cb1bb))_0x523a8d({'val':0x0});else{var _0x4d41f0=_0x3cb1bb[_0x119e('0x22')](';');var _0x29de19=[];orderBy=0x0;for(var _0x37b07e=0x0;_0x37b07e<_0x4d41f0['length'];_0x37b07e++){_0x29de19['push'](splitAdditionalPhone(_0x5ef280['id'],_0x4d41f0[_0x37b07e]));}Promise[_0x119e('0x1e')](_0x29de19)['then'](function(){_0xd4c2d5({'val':_0x4d41f0[_0x119e('0x23')]});});}});}function splitAdditionalPhone(_0x21fb19,_0x198f7b){return new Promise(function(_0x596dfb,_0x1e4c98){var _0x59fc43=_0x198f7b[_0x119e('0x22')](':');var _0x5398e6=_0x59fc43[0x0];var _0x5c57a2=_0x59fc43[0x1];if(_0x5c57a2!==''){var _0xdc170f=_0x5c57a2[_0x119e('0x22')]('|');var _0x1a7dea=[];for(var _0x2770ac=0x0;_0x2770ac<_0xdc170f[_0x119e('0x23')];_0x2770ac++){if(_0xdc170f[_0x2770ac]!==''){var _0x3a9588=_['filter'](promisesAdditionalPhones,{'contactId':_0x21fb19,'phone':_0xdc170f[_0x2770ac]});if(_0x3a9588[_0x119e('0x23')]==0x0){orderBy++;promisesAdditionalPhones[_0x119e('0x1d')]({'contactId':_0x21fb19,'contactTypeId':_0x5398e6,'phone':_0xdc170f[_0x2770ac],'orderBy':orderBy});}}}_0x596dfb({'ok':0x1});}else _0x596dfb({'res':0x0});});}function createAdditionalPhone(_0x58aa83,_0x3ba6ee,_0x1ca670,_0x49b965){var _0x18f2d4='';var _0x513843='';var _0x12d101=_0x1ca670[_0x119e('0x22')]('§');_0x18f2d4=_0x12d101[0x0];if(_0x12d101[_0x119e('0x23')]==0x2)_0x513843=_0x12d101[0x1];return new Promise(function(_0x1e122a,_0x3df7e9){return db['CmContactHasItem'][_0x119e('0x24')]({'where':{'CmContactId':_0x58aa83,'item':_0x18f2d4}})[_0x119e('0x1f')](function(_0x2743d9){if(_0x2743d9){return db[_0x119e('0x25')][_0x119e('0x26')]({'ItemTypeId':_0x3ba6ee,'description':_0x513843,'OrderBy':_0x49b965},{'where':{'CmContactId':_0x58aa83,'item':_0x18f2d4}})[_0x119e('0x1f')](function(_0x4fc239){_0x1e122a({'res':'updated'});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x58aa83,'item':_0x18f2d4,'ItemTypeId':_0x3ba6ee,'description':_0x513843,'OrderBy':_0x49b965,'ItemClass':_0x119e('0x27')})[_0x119e('0x1f')](function(_0x48fae5){_0x1e122a({'res':'inserted'});});}});});}function updateContact(_0x3cc2cc){return new Promise(function(_0x3dc17f,_0x5f021d){var _0x1a9d07=_0x3cc2cc['id'];delete _0x3cc2cc['id'];return db[_0x119e('0x28')]['update'](_0x3cc2cc,{'where':{'id':_0x1a9d07}})[_0x119e('0x1f')](function(_0x2a196d){updatedRows+=0x1;return db[_0x119e('0x29')][_0x119e('0x26')]({'phone':_0x3cc2cc[_0x119e('0x10')]},{'where':{'ContactId':_0x1a9d07}})[_0x119e('0x1f')](function(_0x1f05e8){_0x3dc17f({'ret':'OK'});});});});}function insertCmHopper(_0x3af549,_0x7f1e56,_0xf4755,_0x35f1fd,_0xf81f0f){var _0x323510=[_0x119e('0x2a'),_0x119e('0x2b'),'cm_contacts.id',_0x119e('0x2c'),_0x7f1e56+'.'+_0x35f1fd,_0x119e('0x2d'),_0x119e('0x2e'),'cm_contacts.priority',_0x119e('0x2f'),'\x22'+_0xf81f0f+'\x22'];return squel[_0x119e('0x30')]()[_0x119e('0x31')](_0x119e('0x32'))[_0x119e('0x33')](['phone','scheduledat',_0x119e('0x34'),_0x119e('0x35'),_0x35f1fd,_0x119e('0x36'),_0x119e('0x37'),_0x119e('0x38'),_0x119e('0x39'),_0x119e('0x3a')],squel['select']()['fields'](_0x323510)[_0x119e('0x11')](_0x7f1e56)['join']('cm_contacts',null,_0x119e('0x3b')+_0x7f1e56+'.CmListId')['join'](_0xf4755,null,_0xf4755+'.id\x20=\x20'+_0x7f1e56+'.'+_0x35f1fd)[_0x119e('0x14')](_0x7f1e56+_0x119e('0x3c'),_0x3af549)[_0x119e('0x14')](_0x119e('0x3d'),NOW)[_0x119e('0x14')](_0x119e('0x3e'),selectNotIn(_0x7f1e56,_0xf4755,_0x35f1fd,_0x119e('0x32'),[_0x119e('0x3f'),_0x119e('0x40')]))[_0x119e('0x14')](_0x119e('0x3e'),selectNotIn(_0x7f1e56,_0xf4755,_0x35f1fd,_0x119e('0x32'),[_0x119e('0x3f')])))[_0x119e('0x41')]();}function insertCmHopperBlack(_0x4f57f8,_0x442c05,_0x3fb1f0,_0x3a55b3){var _0x31e6e6=[_0x119e('0x2a'),_0x119e('0x42'),'cm_contacts.ListId',_0x442c05+'.'+_0x3a55b3,_0x119e('0x2d'),'cm_contacts.updatedAt'];return squel[_0x119e('0x30')]()[_0x119e('0x31')](_0x119e('0x43'))[_0x119e('0x33')]([_0x119e('0x10'),_0x119e('0x34'),_0x119e('0x35'),_0x3a55b3,'createdAt','updatedAt'],squel[_0x119e('0xf')]()[_0x119e('0x44')](_0x31e6e6)[_0x119e('0x11')](_0x442c05)[_0x119e('0x12')](_0x119e('0x45'),null,_0x119e('0x3b')+_0x442c05+_0x119e('0x46'))[_0x119e('0x12')](_0x3fb1f0,null,_0x3fb1f0+_0x119e('0x13')+_0x442c05+'.'+_0x3a55b3)[_0x119e('0x14')](_0x442c05+_0x119e('0x3c'),_0x4f57f8)[_0x119e('0x14')](_0x119e('0x3d'),NOW)[_0x119e('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x119e('0xf')]()[_0x119e('0x47')]('phone')[_0x119e('0x11')]('cm_hopper_black')[_0x119e('0x14')](_0x119e('0x48'),_0x4f57f8)[_0x119e('0x14')](_0x3a55b3+'\x20=\x20?',_0x442c05+'.'+_0x3a55b3)))[_0x119e('0x41')]();}function insertCmHopperAdditionalPhones(_0x1a15d8){var _0x50ea06=[_0x119e('0x49'),_0x119e('0x4a'),_0x119e('0x4b'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel['insert']()[_0x119e('0x31')](_0x119e('0x4c'))['fromQuery']([_0x119e('0x4d'),'phone',_0x119e('0x4e'),'createdAt',_0x119e('0x37')],squel[_0x119e('0xf')]()['fields'](_0x50ea06)['from'](_0x119e('0x32'))[_0x119e('0x12')](_0x119e('0x45'),null,_0x119e('0x4f'))[_0x119e('0x12')](_0x119e('0x50'),null,_0x119e('0x51'))['where']('cm_hopper.ListId\x20=\x20?',_0x1a15d8)['where'](_0x119e('0x3d'),NOW))[_0x119e('0x41')]();}function insertCmContact(_0x488154,_0x2d02b3,_0x400994,_0xd1b420){var _0x1a13fc=_['concat'](_[_0x119e('0x52')](_0xd1b420),['ListId',_0x119e('0x53'),_0x119e('0x36'),_0x119e('0x37')]);return squel[_0x119e('0x30')]()[_0x119e('0x31')]('cm_contacts')[_0x119e('0x33')](_0x1a13fc,squel[_0x119e('0xf')]()[_0x119e('0x44')](_0x1a13fc)[_0x119e('0x11')](_0x2d02b3)[_0x119e('0x14')]('('+_0x400994['join'](',')+_0x119e('0x54'),squel[_0x119e('0xf')]()[_0x119e('0x44')](_0x400994)[_0x119e('0x11')](_0x119e('0x45'))['where'](_0x119e('0x48'),_0x488154))[_0x119e('0x14')](_0x119e('0x55'),squel['select']()['field'](_0x119e('0x56'),_0x119e('0x57'))['from'](_0x2d02b3)[_0x119e('0x58')](_0x400994[_0x119e('0x12')](','))))[_0x119e('0x41')]();}function handleStop(){logger['info'](_0x119e('0x59'));stopped=!![];}function handleUncaughtException(_0xacb4bd){logger[_0x119e('0x5a')](_0xacb4bd[_0x119e('0x21')]);process[_0x119e('0x5b')](0x1);}function handleError(_0x3ecbb9,_0x4e1d55){stats[_0x119e('0x5c')]['push']({'name':_0x4e1d55[_0x119e('0x5d')],'message':_0x4e1d55['message'],'row':_0x3ecbb9});}function handleQuery(_0x870ecf){logger[_0x119e('0x5e')](_0x870ecf);return db[_0x119e('0x17')]['query'](_0x870ecf)['spread'](function(_0x1d891c){results[_0x119e('0x1d')](_0x1d891c);})[_0x119e('0x20')](function(_0x543062){logger[_0x119e('0x5a')](_0x543062[_0x119e('0x21')]);});}function main(_0x28866d,_0x1e851c,_0xe24f19,_0x2146bc){logger[_0x119e('0x5e')](_0x119e('0x5f'),_0x28866d,JSON[_0x119e('0x60')](_0x1e851c));process[_0x119e('0x61')](_0x119e('0x62'));var _0x13c0d8=_0x1e851c[_0x119e('0x63')];var _0x51bf9c=_[_0x119e('0x64')](_0x13c0d8);var _0x21ae76=_0x1e851c[_0x119e('0x65')];var _0x47f1ff=path[_0x119e('0x12')](config['root'],_0x119e('0x66'),_0x21ae76+_0x119e('0x67'));logger[_0x119e('0x5e')](_0x119e('0x68'),_0x1e851c);db[_0x119e('0x69')][_0x119e('0x6a')]({'raw':!![],'attributes':['id',_0x119e('0x6b')]})[_0x119e('0x1f')](function(_0x528302){for(var _0x142236=0x0;_0x142236<_0x528302['length'];_0x142236++){if(_0x528302[_0x142236][_0x119e('0x6b')]in _0x13c0d8){contactItemTypes['push'](_0x528302[_0x142236]);delete _0x51bf9c[_0x528302[_0x142236][_0x119e('0x6b')]];hasAdditionalPhones=!![];}for(var _0x3828bc in _0x13c0d8){if(_0x528302[_0x142236]['name']+_0x119e('0x6c')===_0x3828bc){phoneDescriptions[_0x119e('0x1d')]({'itemTypeId':_0x528302[_0x142236]['id'],'description':_0x3828bc});delete _0x51bf9c[_0x3828bc];}}}if(hasAdditionalPhones)_0x51bf9c['AdditionalPhones']='';var _0x5539f8=_['keys'](_0x51bf9c)[_0x119e('0x12')]();logger['info'](_0x119e('0x6d'),_0x5539f8);fs[_0x119e('0x6e')](_0x47f1ff,_0x5539f8+'\x0a');Papa[_0x119e('0x6f')](fs[_0x119e('0x70')](_0x28866d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x38452e,_0x8b1998){try{for(var _0x574e5=0x0,_0x1e453f=[];_0x574e5<_0x38452e[_0x119e('0x71')]['length'];_0x574e5++){stats[_0x119e('0x72')]+=0x1;if(_0x38452e[_0x119e('0x5c')][_0x574e5]){handleError(_0x38452e[_0x119e('0x71')][_0x574e5],_0x38452e['errors'][_0x574e5]);}else{var _0x590599=[];var _0x5eb194=[];var _0x42a412={};for(var _0x17f423 in _0x13c0d8){let _0x3dd9a2=contactItemTypes[_0x119e('0x73')](_0x2b66e3=>_0x2b66e3[_0x119e('0x6b')]===_0x17f423);let _0x13c63c=contactItemTypes['find'](_0x235ffc=>_0x235ffc[_0x119e('0x6b')]+_0x119e('0x6c')===_0x17f423);if(_[_0x119e('0x1b')](_0x3dd9a2)&&_[_0x119e('0x1b')](_0x13c63c)){if(_0x13c0d8[_0x119e('0x74')](_0x17f423)){if(_0x38452e[_0x119e('0x71')][_0x574e5][_0x13c0d8[_0x17f423]]){var _0x3abc01=_[_0x119e('0x75')](_0x38452e['data'][_0x574e5][_0x13c0d8[_0x17f423]][_0x119e('0x76')](/"/g,'\x27'));switch(_0x17f423){case _0x119e('0x77'):var _0xb67e5e=moment(_0x3abc01,_0x119e('0xb'),!![]);if(_0xb67e5e[_0x119e('0x78')]()){_0x1e453f[_0x119e('0x1d')]('\x22'+_0x3abc01+'\x22');}else{_0x590599[_0x119e('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x59a772=parseInt(_0x3abc01);_0x3abc01=_[_0x119e('0x79')](_0x59a772)||_0x59a772<0x0||_0x59a772>0x4?_0x2146bc?0x3:0x2:_0x59a772;_0x1e453f['push']('\x22'+_0x3abc01+'\x22');break;case'UserId':var _0x35f22f=parseInt(_0x3abc01);if(_[_0x119e('0x7a')](_0x35f22f)&&_['includes'](_0xe24f19,_0x35f22f)){_0x1e453f[_0x119e('0x1d')]('\x22'+_0x35f22f+'\x22');}else{_0x590599[_0x119e('0x1d')](_0x119e('0x7b'));}break;case _0x119e('0x7c'):if(isEmail(_0x3abc01)){_0x1e453f[_0x119e('0x1d')]('\x22'+_0x3abc01+'\x22');}else{_0x590599[_0x119e('0x1d')](_0x119e('0x7d'));}break;case _0x119e('0x7e'):var _0x2c9157=moment(_0x3abc01,'YYYY-MM-DD',!![]);if(_0x2c9157[_0x119e('0x78')]()){_0x1e453f[_0x119e('0x1d')]('\x22'+_0x3abc01+'\x22');}else{_0x590599[_0x119e('0x1d')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x1e453f[_0x119e('0x1d')]('\x22'+_0x3abc01+'\x22');}}else{switch(_0x17f423){case _0x119e('0x7f'):case _0x119e('0x10'):_0x590599['push'](_0x17f423+_0x119e('0x80'));break;default:_0x1e453f[_0x119e('0x1d')]('\x22\x22');}}}}else{var _0x1bc648='';if(!_[_0x119e('0x1b')](_0x3dd9a2)){if(!_0x42a412[_0x119e('0x74')](_0x3dd9a2['id'])){for(var _0x274146=0x0;_0x274146<_0x13c0d8[_0x17f423][_0x119e('0x23')];_0x274146++){var _0x3abc01=_[_0x119e('0x75')](_0x38452e[_0x119e('0x71')][_0x574e5][_0x13c0d8[_0x17f423][_0x274146]]['replace'](/"/g,'\x27'));var _0x16772c=phoneDescriptions[_0x119e('0x73')](_0x496402=>_0x496402['itemTypeId']===_0x3dd9a2['id']);if(!_['isNil'](_0x16772c)){var _0x52f67f=_['trim'](_0x38452e[_0x119e('0x71')][_0x574e5][_0x13c0d8[_0x16772c[_0x119e('0x81')]][0x0]][_0x119e('0x76')](/"/g,'\x27'));if(!_[_0x119e('0x1b')](_0x52f67f))_0x3abc01=_0x3abc01+'§'+_0x52f67f;}if(_0x1bc648=='')_0x1bc648=_0x3abc01;else _0x1bc648+='|'+_0x3abc01;}_0x5eb194[_0x119e('0x1d')](_0x3dd9a2['id']+':'+_0x1bc648);_0x42a412[_0x3dd9a2['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1e453f[_0x119e('0x1d')]('\x22'+_0x5eb194[_0x119e('0x12')](';')+'\x22');}if(_0x590599['length']){handleError(_0x38452e['data'][_0x574e5],{'code':_0x119e('0x82'),'message':_0x590599[_0x119e('0x12')]()});}else{fs[_0x119e('0x83')](_0x47f1ff,_0x1e453f['join']()+'\x0a');}_0x1e453f=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0x119e('0x84')+_0x21ae76,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x119e('0x85'));_0x8b1998[_0x119e('0x86')]();}}catch(_0x13550b){handleError(_0x38452e[_0x119e('0x71')][_0x574e5],{'code':'SystemError','message':_0x13550b[_0x119e('0x21')]});logger[_0x119e('0x5a')](_0x119e('0x87'),_0x13550b[_0x119e('0x21')]);}},'complete':function(){try{var _0x5b5975=[];var _0x2bee23=tempTableName;_0x5b5975[_0x119e('0x1d')](_0x119e('0x88')+_0x2bee23+_0x119e('0x89'));logger[_0x119e('0x5e')]('CIS\x20len',contactItemTypes[_0x119e('0x23')]);var _0x5aedff=util['format'](_0x119e('0x8a'),_0x47f1ff,_0x2bee23,_0x5539f8,_0x1e851c[_0x119e('0x35')],_0x1e851c['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x13c0d8[_0x119e('0x77')])){_0x5aedff+=_0x119e('0x8b');}_0x5b5975[_0x119e('0x1d')](_0x5aedff);BPromise[_0x119e('0x8c')](_0x5b5975,handleQuery)[_0x119e('0x1f')](function(_0x307902){BPromise[_0x119e('0x1e')]([handleAdditionalPhones()])[_0x119e('0x1f')](function(){_0x5b5975=[];for(var _0x54eb43=0x0;_0x54eb43\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','TagIds','limit','offset','toString','Setting','findOne','enableEmailPreview','all','COUNT(*)','where','Sequelize','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','./utils','../../mysqldb','getAccountFK','role','search','select','field','name','color','getInteractionFK','user_has_','_interactions','u.fullname','ui.','from','left_join','users','length','\x20IN\x20?','map','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','accounts','messages','me.','interactionsTags','it.','\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','sqlOperator','conditions','type','text','value','read','and','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','tags','clause','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','find','UserId','user','end','body','plainBody'];(function(_0xc3488d,_0x4851c6){var _0x46547f=function(_0x510fcc){while(--_0x510fcc){_0xc3488d['push'](_0xc3488d['shift']());}};_0x46547f(++_0x4851c6);}(_0x8ae5,0x188));var _0x58ae=function(_0x817044,_0xd1ea31){_0x817044=_0x817044-0x0;var _0x4bc04d=_0x8ae5[_0x817044];return _0x4bc04d;};'use strict';var _=require(_0x58ae('0x0'));var squel=require(_0x58ae('0x1'));var as=require(_0x58ae('0x2'));var qs=require(_0x58ae('0x3'));var updateInteraction=require(_0x58ae('0x4'))['updateInteraction'];var utils=require(_0x58ae('0x5'));var db=require(_0x58ae('0x6'))['db'];function skipInteractionsQuery(_0x1d6d89,_0x55970c,_0x122a2f){var _0x9a2f25=![];var _0xc013e8=utils[_0x58ae('0x7')](_0x1d6d89);if(_0x55970c[_0x58ae('0x8')]==='agent'&&!_0x122a2f[_0x58ae('0x9')]&&!_0x122a2f[_0xc013e8]){_0x9a2f25=!![];}return _0x9a2f25;}function getTagsQuery(){return squel[_0x58ae('0xa')]()['field']('id')[_0x58ae('0xb')](_0x58ae('0xc'))[_0x58ae('0xb')](_0x58ae('0xd'))['from']('tools_tags');}function getUsersQuery(_0x5b73c4,_0x316192){var _0x29a924=utils[_0x58ae('0xe')](_0x5b73c4);var _0x3daea7=_0x58ae('0xf')+_0x5b73c4+_0x58ae('0x10');var _0x1b0605=squel[_0x58ae('0xa')]()[_0x58ae('0xb')]('u.id')[_0x58ae('0xb')](_0x58ae('0x11'))['field'](_0x58ae('0x12')+_0x29a924)[_0x58ae('0x13')](_0x3daea7,'ui')[_0x58ae('0x14')](_0x58ae('0x15'),'u','u.id\x20=\x20ui.UserId');if(_0x316192[_0x58ae('0x16')]>0x0){_0x1b0605['where']('ui.'+_0x29a924+_0x58ae('0x17'),_[_0x58ae('0x18')](_0x316192,'id'));}return _0x1b0605;}function getInteractionsQuery(_0x10249a){var _0x5b5324=utils[_0x58ae('0x19')](_0x10249a);var _0x17e418=utils[_0x58ae('0x7')](_0x10249a);var _0x397a20=utils['getInteractionFK'](_0x10249a);return squel[_0x58ae('0xa')]()[_0x58ae('0x13')](_0x5b5324[_0x58ae('0x1a')],'i')[_0x58ae('0x14')](_0x58ae('0x1b'),'c',_0x58ae('0x1c'))[_0x58ae('0x14')](_0x58ae('0x15'),'o','o.id\x20=\x20i.UserId')[_0x58ae('0x14')](_0x5b5324[_0x58ae('0x1d')],'a','a.id\x20=\x20i.'+_0x17e418)[_0x58ae('0x14')](_0x5b5324[_0x58ae('0x1e')],'me',_0x58ae('0x1f')+_0x397a20+'\x20=\x20i.id')['left_join'](_0x5b5324[_0x58ae('0x20')],'it',_0x58ae('0x21')+_0x397a20+_0x58ae('0x22'))['left_join'](_0x58ae('0x23'),'t',_0x58ae('0x24'));}function getSqlClauses(){var _0x3d6d2e={'body':squel['expr'](),'contact':squel[_0x58ae('0x25')](),'default':squel[_0x58ae('0x25')](),'fields':squel['expr'](),'filter':squel[_0x58ae('0x25')](),'read':squel[_0x58ae('0x25')](),'tags':{'clause':squel[_0x58ae('0x25')](),'ids':null},'user':squel[_0x58ae('0x25')]()};return _0x3d6d2e;}function parseTagParameter(_0x49e17a){var _0x26fc15=squel[_0x58ae('0x25')]();if(_0x49e17a){var _0x549245=utils[_0x58ae('0x26')](_0x49e17a);_0x549245[_0x58ae('0x27')](function(_0x5e5cde){_0x26fc15['or'](_0x58ae('0x28'),'%,'+_0x5e5cde+',%');});}return _0x26fc15;}function parseReadParameter(_0x15fc87){var _0x17dc82='';if(_0x15fc87){_0x17dc82='unreadMessages\x20{OPERATOR}\x200';if(_0x15fc87==='1'){_0x17dc82=_0x17dc82[_0x58ae('0x29')](_0x58ae('0x2a'),'=');}else{_0x17dc82=_0x17dc82['replace'](_0x58ae('0x2a'),'>');}}return _0x17dc82;}function parseSearchFilter(_0x251396,_0x32d449){var _0x58666e=squel['expr']();if(_0x32d449){var _0x2d22c8=_0x32d449[_0x58ae('0x29')]('\x5c','\x5c\x5c')[_0x58ae('0x29')](/'/g,'\x27\x27');var _0x1b2f6f=qs['escapeLIKESpecialChars'](_0x2d22c8);if(qs[_0x58ae('0x2b')](_0x2d22c8)){_0x58666e['or'](_0x58ae('0x2c'),_0x1b2f6f+'%');if([_0x58ae('0x2d'),_0x58ae('0x2e')][_0x58ae('0x2f')](_0x251396)){_0x58666e['or'](_0x58ae('0x30'),_0x1b2f6f+'%');}else if(_0x251396===_0x58ae('0x31')){_0x58666e['or'](_0x58ae('0x32'),_0x1b2f6f+'%');}else if(_0x251396===_0x58ae('0x33')){_0x58666e['or'](_0x58ae('0x34'),_0x1b2f6f+'%');}}else if(_0x251396===_0x58ae('0x35')&&qs[_0x58ae('0x36')](_0x2d22c8)){_0x58666e['or']('c.email\x20LIKE\x20?',_0x1b2f6f+'%');}else{if(_0x251396==='mail'){_0x58666e['or'](_0x58ae('0x37'),qs['getFullTextValue'](_0x2d22c8,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x58ae('0x38')](_0x2d22c8));}else if(_0x251396!==_0x58ae('0x31')){_0x58666e['or'](_0x58ae('0x39'),qs[_0x58ae('0x38')](_0x2d22c8));}_0x58666e['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x2d22c8,!![]),null);}}return _0x58666e;}function parseAdvancedSearchFilter(_0xd8bb58,_0x4c3d80){var _0x5ce241=getSqlClauses();var _0x490eaf=as['parseSearch'](_0xd8bb58);var _0x16d5fe=_0x490eaf[_0x58ae('0x3a')];for(var _0x3b19eb=0x0;_0x3b19eb<_0x490eaf[_0x58ae('0x3b')][_0x58ae('0x16')];_0x3b19eb++){var _0x2aa96c=_0x490eaf[_0x58ae('0x3b')][_0x3b19eb];var _0xd6a49d='i';var _0x46e95d=_['find'](_0x4c3d80,[_0x58ae('0xc'),_0x2aa96c[_0x58ae('0xb')]]);if(_0x46e95d){var _0x414c00=as['buildExpression'](_0xd6a49d,_0x46e95d[_0x58ae('0x3c')],_0x2aa96c);_0x5ce241['default'][_0x16d5fe](_0x414c00[_0x58ae('0x3d')],_0x414c00[_0x58ae('0x3e')]['start'],_0x414c00[_0x58ae('0x3e')]['end']);}else{switch(_0x2aa96c[_0x58ae('0xb')]){case'unreadMessages':var _0x5598c0=parseReadParameter(_0x2aa96c[_0x58ae('0x3e')]);_0x5ce241[_0x58ae('0x3f')][_0x58ae('0x40')](_0x5598c0);break;case _0x58ae('0x41'):if(_0x2aa96c[_0x58ae('0x42')]==='$substring'){if(_0x2aa96c[_0x58ae('0x3e')]['split']('\x20')[_0x58ae('0x16')]>0x1){_0x5ce241['contact'][_0x16d5fe](_0x58ae('0x43'),qs[_0x58ae('0x38')](_0x2aa96c[_0x58ae('0x3e')],!![]),null);}else{var _0x35ce1d='%'+_0x2aa96c[_0x58ae('0x3e')]+'%';_0x5ce241[_0x58ae('0x44')][_0x16d5fe](_0x58ae('0x45'),_0x35ce1d,_0x35ce1d,_0x35ce1d);}}else{_0x46e95d=_['find'](_0x4c3d80,[_0x58ae('0xc'),_0x58ae('0x46')]);_0x2aa96c[_0x58ae('0xb')]=_0x58ae('0x46');_0x414c00=as[_0x58ae('0x47')](_0xd6a49d,_0x46e95d['type'],_0x2aa96c);_0x5ce241[_0x58ae('0x44')][_0x16d5fe](_0x414c00[_0x58ae('0x3d')],_0x414c00['value'][_0x58ae('0x48')],_0x414c00[_0x58ae('0x3e')]['end']);}break;case _0x58ae('0x49'):var _0x35efd2=_0x2aa96c[_0x58ae('0x3e')]['split'](',')[_0x58ae('0x18')](function(_0x29fa20){return Number(_0x29fa20);});var _0x3748eb=parseTagParameter(_0x35efd2);_0x5ce241[_0x58ae('0x4a')][_0x58ae('0x4b')][_0x58ae('0x40')](_0x3748eb);_0x5ce241['tags']['ids']=_0x35efd2;break;case _0x58ae('0x4c'):if(_0x2aa96c[_0x58ae('0x42')]===_0x58ae('0x4d')){_0x5ce241['user'][_0x16d5fe](_0x58ae('0x4e'),'%'+_0x2aa96c[_0x58ae('0x3e')]+'%',null);}else{_0x46e95d=_[_0x58ae('0x4f')](_0x4c3d80,[_0x58ae('0xc'),'UserId']);_0x2aa96c[_0x58ae('0xb')]=_0x58ae('0x50');_0x414c00=as[_0x58ae('0x47')](_0xd6a49d,_0x46e95d['type'],_0x2aa96c);_0x5ce241[_0x58ae('0x51')][_0x16d5fe](_0x414c00[_0x58ae('0x3d')],_0x414c00['value'][_0x58ae('0x48')],_0x414c00['value'][_0x58ae('0x52')]);}break;case _0x58ae('0x53'):case _0x58ae('0x54'):_0x414c00=as['buildExpression']('me',null,_0x2aa96c);_0x5ce241['body'][_0x16d5fe](_0x414c00['text'],_0x414c00['value'][_0x58ae('0x48')],_0x414c00[_0x58ae('0x3e')][_0x58ae('0x52')]);break;}}}return _0x5ce241;}function parseModelFields(_0x17b9aa,_0x446a37,_0x1abbbc){var _0x4d61f3=utils[_0x58ae('0x7')](_0x17b9aa);var _0x35f887=squel['expr']();var _0x5ad5bb=_(_0x446a37)[_0x58ae('0x55')]()['map'](function(_0x58935a){return _[_0x58ae('0x56')](_0x1abbbc,[_0x58ae('0xc'),_0x58935a])?_0x58935a:undefined;})[_0x58ae('0x57')]()[_0x58ae('0x3e')]();if(_0x5ad5bb[_0x58ae('0x16')]>0x0){_0x5ad5bb[_0x58ae('0x27')](function(_0xc846d3){if(_0xc846d3===_0x4d61f3){_0x35f887['and']('i.'+_0x4d61f3+_0x58ae('0x17'),[]['concat'](_0x446a37[_0xc846d3]));}else if(_0xc846d3===_0x58ae('0x58')){var _0x329de1=JSON[_0x58ae('0x59')](_0x446a37[_0xc846d3])[_0x58ae('0x5a')];var _0x5125b1=JSON['parse'](_0x446a37[_0xc846d3])['$lte'];_0x35f887[_0x58ae('0x40')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x329de1,_0x5125b1);}else{if(_0x446a37[_0xc846d3]==='null'){_0x35f887[_0x58ae('0x40')]('i.'+_0xc846d3+_0x58ae('0x5b'));}else{_0x35f887[_0x58ae('0x40')]('i.'+_0xc846d3+_0x58ae('0x5c'),_0x446a37[_0xc846d3]);}}});}return _0x35f887;}function parseQueryParameters(_0x5d84b8,_0xc332c,_0x4d3c55){var _0x59ec44=getSqlClauses();return Promise[_0x58ae('0x5d')]()[_0x58ae('0x5e')](function(){return parseModelFields(_0x5d84b8,_0xc332c,_0x4d3c55);})[_0x58ae('0x5e')](function(_0x1fa7d3){_0x59ec44['fields'][_0x58ae('0x40')](_0x1fa7d3);return parseReadParameter(_0xc332c['read']);})['then'](function(_0x353fd0){_0x59ec44[_0x58ae('0x3f')]['and'](_0x353fd0);return parseTagParameter(_0xc332c[_0x58ae('0x5f')]);})[_0x58ae('0x5e')](function(_0x3970b0){_0x59ec44[_0x58ae('0x4a')]['clause'][_0x58ae('0x40')](_0x3970b0);return parseSearchFilter(_0x5d84b8,_0xc332c[_0x58ae('0x60')]);})['then'](function(_0xabb6af){_0x59ec44['filter']=_0xabb6af;return _0x59ec44;});}function checkAccountsRestrictions(_0x1e9189,_0x70df8a,_0x1d33c8){var _0x589ae4=utils[_0x58ae('0x7')](_0x1e9189);var _0x5ceee2=_0x58ae('0x61')+_[_0x58ae('0x62')](_0x1e9189)+(_0x1e9189===_0x58ae('0x63')?_0x58ae('0x64'):'Accounts');var _0x1fad00=squel[_0x58ae('0x25')]();return Promise['resolve']()['then'](function(){if(_0x1d33c8['search']&&_0x70df8a[_0x58ae('0x8')]===_0x58ae('0x65')){return _0x70df8a[_0x5ceee2]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x535b07){if(_0x535b07){if(_0x535b07[_0x58ae('0x16')]===0x0){_0x1fad00[_0x58ae('0x40')]('i.'+_0x589ae4+_0x58ae('0x5b'));}else{_0x1fad00['and']('i.'+_0x589ae4+_0x58ae('0x17'),_[_0x58ae('0x18')](_0x535b07,'id'));}}else if(!_0x1d33c8[_0x589ae4]){_0x1fad00[_0x58ae('0x40')]('i.'+_0x589ae4+'\x20IS\x20NOT\x20NULL');}})['then'](function(){return _0x1fad00;});}function getClosedOrderClause(_0x10a4bd,_0x228553){var _0x4cad82='';var _0x3dc47e=[_0x58ae('0x66'),_0x58ae('0x67'),_0x58ae('0x68')];if(_0x10a4bd==='mail'){_0x3dc47e[_0x58ae('0x69')](_0x58ae('0x6a'));}if(_0x228553[_0x58ae('0x6b')]==='0'&&_0x10a4bd===_0x58ae('0x35')){_0x4cad82=_0x58ae('0x6a');}else{if(_0x228553[_0x58ae('0x6b')]==='1'){_0x3dc47e[_0x58ae('0x6c')]();}_0x4cad82=_0x58ae('0x6d')+_0x3dc47e['join'](',\x20')+')';}return _0x4cad82;}function getFilteredInteractions(_0x191e45,_0x54e700,_0x3625f3,_0x28684f){var _0x37e8ef=utils[_0x58ae('0xe')](_0x191e45);var _0x4d2dde=_[_0x58ae('0x62')](_0x191e45)+'Interaction';var _0x5d998a=[];var _0x223cb9=getTagsQuery();var _0xa9eaeb={'type':db['Sequelize'][_0x58ae('0x6e')]['SELECT'],'raw':!![]};var _0x279cf2=[];var _0x32ab69=[];return db[_0x58ae('0x6f')][_0x58ae('0x70')](_0x223cb9['toString'](),_0xa9eaeb)[_0x58ae('0x5e')](function(_0x2c1a56){_0x5d998a=_[_0x58ae('0x71')](_0x2c1a56,'id');_0xa9eaeb=_['merge'](_0xa9eaeb,{'model':db[_0x4d2dde],'mapToModel':!![],'nest':!![]});if(_0x3625f3[_0x58ae('0x72')]){_0x28684f[_0x58ae('0x73')][_0x58ae('0x27')](function(_0x385833){_0x54e700[_0x58ae('0xb')]('i.'+_0x385833);});}else{_0x54e700[_0x58ae('0xb')](_0x58ae('0x74'),_0x58ae('0x75'));_0x54e700[_0x58ae('0xb')]('a.key','Account.key');_0x54e700[_0x58ae('0xb')](_0x58ae('0x76'),_0x58ae('0x77'));if(_0x191e45===_0x58ae('0x35')){_0x54e700[_0x58ae('0xb')]('a.email',_0x58ae('0x78'));_0x54e700[_0x58ae('0xb')](_0x58ae('0x79'),_0x58ae('0x7a'));_0x54e700[_0x58ae('0xb')](_0x58ae('0x7b'));_0x54e700['field'](_0x58ae('0x7c'));_0x54e700[_0x58ae('0xb')]('i.updatedAt');_0x54e700[_0x58ae('0xb')](_0x58ae('0x7d'));_0x54e700['field'](_0x58ae('0x7e'));_0x54e700[_0x58ae('0xb')](_0x58ae('0x7f'));_0x54e700[_0x58ae('0xb')]('i.lastMsgAt');_0x54e700[_0x58ae('0xb')](_0x58ae('0x80'));_0x54e700[_0x58ae('0xb')](_0x58ae('0x81'));_0x54e700[_0x58ae('0xb')]('i.disposition');_0x54e700[_0x58ae('0xb')]('i.secondDisposition');_0x54e700[_0x58ae('0xb')](_0x58ae('0x66'));_0x54e700[_0x58ae('0xb')](_0x58ae('0x6a'));_0x54e700[_0x58ae('0xb')](_0x58ae('0x82'));_0x54e700[_0x58ae('0xb')](_0x58ae('0x83'));_0x54e700[_0x58ae('0xb')]('i.MailAccountId');_0x54e700[_0x58ae('0xb')](_0x58ae('0x84'));}else if(_0x191e45==='openchannel'){_0x54e700[_0x58ae('0xb')](_0x58ae('0x85'),_0x58ae('0x7a'));}else{_0x54e700[_0x58ae('0xb')](_0x58ae('0x86'),_0x58ae('0x7a'));}if(_0x191e45!==_0x58ae('0x35')){_0x54e700['field'](_0x58ae('0x87'));}_0x54e700['field'](_0x58ae('0x88'),_0x58ae('0x89'));_0x54e700['field'](_0x58ae('0x8a'),'Contact.lastName');_0x54e700['field'](_0x58ae('0x8b'),'Contact.email');_0x54e700[_0x58ae('0xb')](_0x58ae('0x8c'),'Contact.phone');_0x54e700['field']('c.mobile',_0x58ae('0x8d'));_0x54e700[_0x58ae('0xb')](_0x58ae('0x8e'),_0x58ae('0x8f'));_0x54e700[_0x58ae('0xb')](_0x58ae('0x90'),_0x58ae('0x91'));_0x54e700[_0x58ae('0xb')](_0x58ae('0x92'),'Owner.internal');_0x54e700[_0x58ae('0xb')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x58ae('0x93'));}if(_0x28684f[_0x58ae('0x94')]){_0x54e700[_0x58ae('0x94')](_0x28684f['limit']);}if(_0x28684f[_0x58ae('0x95')]){_0x54e700[_0x58ae('0x95')](_0x28684f[_0x58ae('0x95')]);}return db['sequelize'][_0x58ae('0x70')](_0x54e700[_0x58ae('0x96')](),_0xa9eaeb);})[_0x58ae('0x5e')](function(_0x339ddd){_0x279cf2=_0x339ddd;var _0x24e6dd=getUsersQuery(_0x191e45,_0x279cf2);return db[_0x58ae('0x6f')][_0x58ae('0x70')](_0x24e6dd[_0x58ae('0x96')](),_0xa9eaeb);})[_0x58ae('0x5e')](function(_0xa74a85){_0x32ab69=_['groupBy'](_0xa74a85,_0x37e8ef);if(_0x191e45===_0x58ae('0x35')){return db[_0x58ae('0x97')][_0x58ae('0x98')]({'attributes':[_0x58ae('0x99')],'raw':!![]});}})[_0x58ae('0x5e')](function(_0x32457f){var _0x2835d0=_0x32457f?_0x32457f[_0x58ae('0x99')]:undefined;var _0x2e4cfe=_0x279cf2[_0x58ae('0x18')](function(_0x53201b){return updateInteraction(_0x53201b,_0x5d998a,_0x32ab69,_0x2835d0);});return Promise[_0x58ae('0x9a')](_0x2e4cfe);});}function countFilteredInteractions(_0x1f9ddb,_0x659b5f){var _0x1130dc=_0x1f9ddb['clone']();_0x1130dc[_0x58ae('0xb')](_0x58ae('0x9b'));_0x1130dc[_0x58ae('0xb')](_0x58ae('0x74'),_0x58ae('0x75'));var _0x54444e=utils['getSelectedTags'](_0x659b5f);if(!_['isEmpty'](_0x54444e)){_0x1130dc[_0x58ae('0x9c')]('t.id\x20IN\x20?',_0x54444e);}var _0x3bb9d6={'type':db[_0x58ae('0x9d')][_0x58ae('0x6e')]['SELECT'],'raw':!![]};return db[_0x58ae('0x6f')][_0x58ae('0x70')](_0x1130dc[_0x58ae('0x96')](),_0x3bb9d6);}module[_0x58ae('0x9e')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x5816=['fax','i.fax\x20LIKE\x20?','openchannel','isEmail','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression','text','value','start','end','unreadMessages','read','and','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','Tag','tags','clause','ids','operator','user','UserId','body','plainBody','getAccountFK','compact','forEach','concat','createdAt','parse','$gte','\x20IS\x20NULL','\x20=\x20?','then','fields','tag','filter','Accounts','resolve','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','capitalize','Sequelize','QueryTypes','SELECT','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.thirdDisposition','i.to','i.ContactId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','sequelize','groupBy','Setting','findOne','enableEmailPreview','clone','COUNT(*)','t.id\x20IN\x20?','squel','../parsers/qs','./update-interaction','./utils','role','agent','select','name','field','color','from','tools_tags','_interactions','u.id','u.fullname','ui.','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','getInteractionFK','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','escapeLIKESpecialChars','isNumeric','whatsapp','includes','i.phone\x20LIKE\x20?'];(function(_0x543f9f,_0x563bf5){var _0x23e5d3=function(_0x5cd0e0){while(--_0x5cd0e0){_0x543f9f['push'](_0x543f9f['shift']());}};_0x23e5d3(++_0x563bf5);}(_0x5816,0x6f));var _0x6581=function(_0x2e0e91,_0x393e3d){_0x2e0e91=_0x2e0e91-0x0;var _0x173430=_0x5816[_0x2e0e91];return _0x173430;};'use strict';var _=require('lodash');var squel=require(_0x6581('0x0'));var as=require('../parsers/advancedSearch');var qs=require(_0x6581('0x1'));var updateInteraction=require(_0x6581('0x2'))['updateInteraction'];var utils=require(_0x6581('0x3'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x3879ad,_0x2a9533,_0x38a101){var _0xcf03e6=![];var _0x228391=utils['getAccountFK'](_0x3879ad);if(_0x2a9533[_0x6581('0x4')]===_0x6581('0x5')&&!_0x38a101['search']&&!_0x38a101[_0x228391]){_0xcf03e6=!![];}return _0xcf03e6;}function getTagsQuery(){return squel[_0x6581('0x6')]()['field']('id')['field'](_0x6581('0x7'))[_0x6581('0x8')](_0x6581('0x9'))[_0x6581('0xa')](_0x6581('0xb'));}function getUsersQuery(_0x4d4602,_0x15a0b2){var _0x10db5c=utils['getInteractionFK'](_0x4d4602);var _0x2e99d8='user_has_'+_0x4d4602+_0x6581('0xc');var _0x3b954c=squel[_0x6581('0x6')]()[_0x6581('0x8')](_0x6581('0xd'))[_0x6581('0x8')](_0x6581('0xe'))['field'](_0x6581('0xf')+_0x10db5c)[_0x6581('0xa')](_0x2e99d8,'ui')['left_join'](_0x6581('0x10'),'u',_0x6581('0x11'));if(_0x15a0b2[_0x6581('0x12')]>0x0){_0x3b954c[_0x6581('0x13')](_0x6581('0xf')+_0x10db5c+_0x6581('0x14'),_[_0x6581('0x15')](_0x15a0b2,'id'));}return _0x3b954c;}function getInteractionsQuery(_0x2d7bf2){var _0x3adddf=utils[_0x6581('0x16')](_0x2d7bf2);var _0x20b7c4=utils['getAccountFK'](_0x2d7bf2);var _0x56f9e0=utils[_0x6581('0x17')](_0x2d7bf2);return squel[_0x6581('0x6')]()['from'](_0x3adddf['interactions'],'i')[_0x6581('0x18')](_0x6581('0x19'),'c',_0x6581('0x1a'))['left_join']('users','o',_0x6581('0x1b'))[_0x6581('0x18')](_0x3adddf[_0x6581('0x1c')],'a',_0x6581('0x1d')+_0x20b7c4)[_0x6581('0x18')](_0x3adddf['messages'],'me','me.'+_0x56f9e0+'\x20=\x20i.id')['left_join'](_0x3adddf['interactionsTags'],'it',_0x6581('0x1e')+_0x56f9e0+'\x20=\x20i.id')[_0x6581('0x18')](_0x6581('0xb'),'t',_0x6581('0x1f'));}function getSqlClauses(){var _0x4fb8e2={'body':squel[_0x6581('0x20')](),'contact':squel['expr'](),'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0x6581('0x20')](),'read':squel['expr'](),'tags':{'clause':squel[_0x6581('0x20')](),'ids':null},'user':squel[_0x6581('0x20')]()};return _0x4fb8e2;}function parseTagParameter(_0x16b2f2){var _0x5f4c01=squel[_0x6581('0x20')]();if(_0x16b2f2){var _0x5155a4=utils[_0x6581('0x21')](_0x16b2f2);_0x5155a4['forEach'](function(_0x267efe){_0x5f4c01['or'](_0x6581('0x22'),'%,'+_0x267efe+',%');});}return _0x5f4c01;}function parseReadParameter(_0x268d02){var _0x1719ab='';if(_0x268d02){_0x1719ab=_0x6581('0x23');if(_0x268d02==='1'){_0x1719ab=_0x1719ab[_0x6581('0x24')](_0x6581('0x25'),'=');}else{_0x1719ab=_0x1719ab[_0x6581('0x24')](_0x6581('0x25'),'>');}}return _0x1719ab;}function parseSearchFilter(_0x38fc4e,_0x1367e2){var _0x326e73=squel[_0x6581('0x20')]();if(_0x1367e2){var _0x297d1a=_0x1367e2[_0x6581('0x24')]('\x5c','\x5c\x5c')[_0x6581('0x24')](/'/g,'\x27\x27');var _0x3ecf0f=qs[_0x6581('0x26')](_0x297d1a);if(qs[_0x6581('0x27')](_0x297d1a)){_0x326e73['or']('i.id\x20LIKE\x20?',_0x3ecf0f+'%');if(['sms',_0x6581('0x28')][_0x6581('0x29')](_0x38fc4e)){_0x326e73['or'](_0x6581('0x2a'),_0x3ecf0f+'%');}else if(_0x38fc4e===_0x6581('0x2b')){_0x326e73['or'](_0x6581('0x2c'),_0x3ecf0f+'%');}else if(_0x38fc4e===_0x6581('0x2d')){_0x326e73['or']('i.from\x20LIKE\x20?',_0x3ecf0f+'%');}}else if(_0x38fc4e==='mail'&&qs[_0x6581('0x2e')](_0x297d1a)){_0x326e73['or']('c.email\x20LIKE\x20?',_0x3ecf0f+'%');}else{if(_0x38fc4e===_0x6581('0x2f')){_0x326e73['or'](_0x6581('0x30'),qs[_0x6581('0x31')](_0x297d1a,!![]))['or'](_0x6581('0x32'),qs[_0x6581('0x31')](_0x297d1a));}else if(_0x38fc4e!==_0x6581('0x2b')){_0x326e73['or'](_0x6581('0x33'),qs['getFullTextValue'](_0x297d1a));}_0x326e73['or'](_0x6581('0x34'),qs[_0x6581('0x31')](_0x297d1a,!![]),null);}}return _0x326e73;}function parseAdvancedSearchFilter(_0x1c8e39,_0x3635bd){var _0x2291d8=getSqlClauses();var _0x33f9f0=as[_0x6581('0x35')](_0x1c8e39);var _0x355f2f=_0x33f9f0[_0x6581('0x36')];for(var _0x2af9ed=0x0;_0x2af9ed<_0x33f9f0[_0x6581('0x37')][_0x6581('0x12')];_0x2af9ed++){var _0x5d62a8=_0x33f9f0[_0x6581('0x37')][_0x2af9ed];var _0x28d62a='i';var _0x16c2a0=_[_0x6581('0x38')](_0x3635bd,[_0x6581('0x7'),_0x5d62a8[_0x6581('0x8')]]);if(_0x16c2a0){var _0x5ecddf=as[_0x6581('0x39')](_0x28d62a,_0x16c2a0['type'],_0x5d62a8);_0x2291d8['default'][_0x355f2f](_0x5ecddf[_0x6581('0x3a')],_0x5ecddf[_0x6581('0x3b')][_0x6581('0x3c')],_0x5ecddf[_0x6581('0x3b')][_0x6581('0x3d')]);}else{switch(_0x5d62a8[_0x6581('0x8')]){case _0x6581('0x3e'):var _0x51c6a0=parseReadParameter(_0x5d62a8[_0x6581('0x3b')]);_0x2291d8[_0x6581('0x3f')][_0x6581('0x40')](_0x51c6a0);break;case'Contact':if(_0x5d62a8['operator']===_0x6581('0x41')){if(_0x5d62a8[_0x6581('0x3b')][_0x6581('0x42')]('\x20')[_0x6581('0x12')]>0x1){_0x2291d8[_0x6581('0x43')][_0x355f2f](_0x6581('0x34'),qs[_0x6581('0x31')](_0x5d62a8['value'],!![]),null);}else{var _0x4a2c53='%'+_0x5d62a8[_0x6581('0x3b')]+'%';_0x2291d8[_0x6581('0x43')][_0x355f2f](_0x6581('0x44'),_0x4a2c53,_0x4a2c53,_0x4a2c53);}}else{_0x16c2a0=_[_0x6581('0x38')](_0x3635bd,['name',_0x6581('0x45')]);_0x5d62a8[_0x6581('0x8')]=_0x6581('0x45');_0x5ecddf=as[_0x6581('0x39')](_0x28d62a,_0x16c2a0[_0x6581('0x46')],_0x5d62a8);_0x2291d8['contact'][_0x355f2f](_0x5ecddf[_0x6581('0x3a')],_0x5ecddf[_0x6581('0x3b')][_0x6581('0x3c')],_0x5ecddf[_0x6581('0x3b')][_0x6581('0x3d')]);}break;case _0x6581('0x47'):var _0x474eff=_0x5d62a8[_0x6581('0x3b')][_0x6581('0x42')](',')[_0x6581('0x15')](function(_0x4157d9){return Number(_0x4157d9);});var _0x53f7dd=parseTagParameter(_0x474eff);_0x2291d8[_0x6581('0x48')][_0x6581('0x49')][_0x6581('0x40')](_0x53f7dd);_0x2291d8[_0x6581('0x48')][_0x6581('0x4a')]=_0x474eff;break;case'User':if(_0x5d62a8[_0x6581('0x4b')]===_0x6581('0x41')){_0x2291d8[_0x6581('0x4c')][_0x355f2f]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','%'+_0x5d62a8[_0x6581('0x3b')]+'%',null);}else{_0x16c2a0=_[_0x6581('0x38')](_0x3635bd,['name',_0x6581('0x4d')]);_0x5d62a8['field']=_0x6581('0x4d');_0x5ecddf=as[_0x6581('0x39')](_0x28d62a,_0x16c2a0[_0x6581('0x46')],_0x5d62a8);_0x2291d8[_0x6581('0x4c')][_0x355f2f](_0x5ecddf[_0x6581('0x3a')],_0x5ecddf['value']['start'],_0x5ecddf[_0x6581('0x3b')]['end']);}break;case _0x6581('0x4e'):case _0x6581('0x4f'):_0x5ecddf=as[_0x6581('0x39')]('me',null,_0x5d62a8);_0x2291d8[_0x6581('0x4e')][_0x355f2f](_0x5ecddf['text'],_0x5ecddf[_0x6581('0x3b')][_0x6581('0x3c')],_0x5ecddf['value'][_0x6581('0x3d')]);break;}}}return _0x2291d8;}function parseModelFields(_0x20bcfc,_0x4c2d64,_0x35b5ec){var _0x7939f6=utils[_0x6581('0x50')](_0x20bcfc);var _0x1a1073=squel[_0x6581('0x20')]();var _0x51eddc=_(_0x4c2d64)['keys']()[_0x6581('0x15')](function(_0x1e3e1d){return _['some'](_0x35b5ec,[_0x6581('0x7'),_0x1e3e1d])?_0x1e3e1d:undefined;})[_0x6581('0x51')]()[_0x6581('0x3b')]();if(_0x51eddc[_0x6581('0x12')]>0x0){_0x51eddc[_0x6581('0x52')](function(_0x158db5){if(_0x158db5===_0x7939f6){_0x1a1073['and']('i.'+_0x7939f6+_0x6581('0x14'),[][_0x6581('0x53')](_0x4c2d64[_0x158db5]));}else if(_0x158db5===_0x6581('0x54')){var _0x4e3bcd=JSON[_0x6581('0x55')](_0x4c2d64[_0x158db5])[_0x6581('0x56')];var _0x217f2d=JSON['parse'](_0x4c2d64[_0x158db5])['$lte'];_0x1a1073[_0x6581('0x40')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4e3bcd,_0x217f2d);}else{if(_0x4c2d64[_0x158db5]==='null'){_0x1a1073['and']('i.'+_0x158db5+_0x6581('0x57'));}else{_0x1a1073[_0x6581('0x40')]('i.'+_0x158db5+_0x6581('0x58'),_0x4c2d64[_0x158db5]);}}});}return _0x1a1073;}function parseQueryParameters(_0x111141,_0x4d7246,_0x51a1e4){var _0x4f3a0b=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x111141,_0x4d7246,_0x51a1e4);})[_0x6581('0x59')](function(_0x45fae2){_0x4f3a0b[_0x6581('0x5a')][_0x6581('0x40')](_0x45fae2);return parseReadParameter(_0x4d7246[_0x6581('0x3f')]);})[_0x6581('0x59')](function(_0x2348f9){_0x4f3a0b['read']['and'](_0x2348f9);return parseTagParameter(_0x4d7246[_0x6581('0x5b')]);})[_0x6581('0x59')](function(_0x3e556f){_0x4f3a0b[_0x6581('0x48')][_0x6581('0x49')][_0x6581('0x40')](_0x3e556f);return parseSearchFilter(_0x111141,_0x4d7246[_0x6581('0x5c')]);})[_0x6581('0x59')](function(_0x153e91){_0x4f3a0b[_0x6581('0x5c')]=_0x153e91;return _0x4f3a0b;});}function checkAccountsRestrictions(_0x3e722c,_0x39b98e,_0x1163f3){var _0x5a055b=utils['getAccountFK'](_0x3e722c);var _0x268768='get'+_['capitalize'](_0x3e722c)+(_0x3e722c==='chat'?'Websites':_0x6581('0x5d'));var _0x2aa6cc=squel[_0x6581('0x20')]();return Promise[_0x6581('0x5e')]()['then'](function(){if(_0x1163f3['search']&&_0x39b98e['role']==='agent'){return _0x39b98e[_0x268768]({'attributes':['id'],'raw':!![]});}})[_0x6581('0x59')](function(_0x5e446b){if(_0x5e446b){if(_0x5e446b[_0x6581('0x12')]===0x0){_0x2aa6cc[_0x6581('0x40')]('i.'+_0x5a055b+_0x6581('0x57'));}else{_0x2aa6cc[_0x6581('0x40')]('i.'+_0x5a055b+_0x6581('0x14'),_[_0x6581('0x15')](_0x5e446b,'id'));}}else if(!_0x1163f3[_0x5a055b]){_0x2aa6cc[_0x6581('0x40')]('i.'+_0x5a055b+'\x20IS\x20NOT\x20NULL');}})['then'](function(){return _0x2aa6cc;});}function getClosedOrderClause(_0x546035,_0x1f86ad){var _0xf12e82='';var _0x25beae=['i.thirdDisposition',_0x6581('0x5f'),_0x6581('0x60')];if(_0x546035==='mail'){_0x25beae[_0x6581('0x61')](_0x6581('0x62'));}if(_0x1f86ad[_0x6581('0x63')]==='0'&&_0x546035===_0x6581('0x2f')){_0xf12e82=_0x6581('0x62');}else{if(_0x1f86ad[_0x6581('0x63')]==='1'){_0x25beae[_0x6581('0x64')]();}_0xf12e82=_0x6581('0x65')+_0x25beae['join'](',\x20')+')';}return _0xf12e82;}function getFilteredInteractions(_0x3ce0d0,_0x45c731,_0x3f6660,_0x4f3ab5){var _0x48cb19=utils[_0x6581('0x17')](_0x3ce0d0);var _0x24fb5d=_[_0x6581('0x66')](_0x3ce0d0)+'Interaction';var _0x297a0d=[];var _0x51c01d=getTagsQuery();var _0x552e25={'type':db[_0x6581('0x67')][_0x6581('0x68')][_0x6581('0x69')],'raw':!![]};var _0x5c8ec1=[];var _0x4d8399=[];return db['sequelize'][_0x6581('0x6a')](_0x51c01d[_0x6581('0x6b')](),_0x552e25)[_0x6581('0x59')](function(_0x1b9f89){_0x297a0d=_[_0x6581('0x6c')](_0x1b9f89,'id');_0x552e25=_[_0x6581('0x6d')](_0x552e25,{'model':db[_0x24fb5d],'mapToModel':!![],'nest':!![]});if(_0x3f6660[_0x6581('0x5a')]){_0x4f3ab5[_0x6581('0x6e')][_0x6581('0x52')](function(_0x4e07ff){_0x45c731[_0x6581('0x8')]('i.'+_0x4e07ff);});}else{_0x45c731[_0x6581('0x8')](_0x6581('0x6f'),_0x6581('0x3e'));_0x45c731['field'](_0x6581('0x70'),'Account.key');_0x45c731[_0x6581('0x8')](_0x6581('0x71'),_0x6581('0x72'));if(_0x3ce0d0===_0x6581('0x2f')){_0x45c731[_0x6581('0x8')](_0x6581('0x73'),_0x6581('0x74'));_0x45c731['field'](_0x6581('0x75'),_0x6581('0x76'));_0x45c731[_0x6581('0x8')](_0x6581('0x77'));_0x45c731[_0x6581('0x8')](_0x6581('0x78'));_0x45c731[_0x6581('0x8')](_0x6581('0x79'));_0x45c731[_0x6581('0x8')]('i.closed');_0x45c731[_0x6581('0x8')]('i.closedAt');_0x45c731[_0x6581('0x8')]('i.attach');_0x45c731['field'](_0x6581('0x7a'));_0x45c731[_0x6581('0x8')](_0x6581('0x7b'));_0x45c731[_0x6581('0x8')](_0x6581('0x7c'));_0x45c731[_0x6581('0x8')](_0x6581('0x60'));_0x45c731[_0x6581('0x8')](_0x6581('0x5f'));_0x45c731[_0x6581('0x8')](_0x6581('0x7d'));_0x45c731['field']('i.substatus');_0x45c731[_0x6581('0x8')](_0x6581('0x7e'));_0x45c731[_0x6581('0x8')](_0x6581('0x7f'));_0x45c731[_0x6581('0x8')]('i.MailAccountId');_0x45c731['field']('i.UserId');}else if(_0x3ce0d0===_0x6581('0x2d')){_0x45c731[_0x6581('0x8')](_0x6581('0x80'),_0x6581('0x76'));}else{_0x45c731['field'](_0x6581('0x81'),'contactName');}if(_0x3ce0d0!==_0x6581('0x2f')){_0x45c731['field']('i.*');}_0x45c731[_0x6581('0x8')](_0x6581('0x82'),_0x6581('0x83'));_0x45c731[_0x6581('0x8')](_0x6581('0x84'),_0x6581('0x85'));_0x45c731[_0x6581('0x8')]('c.email','Contact.email');_0x45c731[_0x6581('0x8')](_0x6581('0x86'),_0x6581('0x87'));_0x45c731[_0x6581('0x8')](_0x6581('0x88'),_0x6581('0x89'));_0x45c731[_0x6581('0x8')]('c.fax',_0x6581('0x8a'));_0x45c731[_0x6581('0x8')](_0x6581('0x8b'),_0x6581('0x8c'));_0x45c731['field'](_0x6581('0x8d'),_0x6581('0x8e'));_0x45c731[_0x6581('0x8')](_0x6581('0x8f'),'TagIds');}if(_0x4f3ab5[_0x6581('0x90')]){_0x45c731['limit'](_0x4f3ab5[_0x6581('0x90')]);}if(_0x4f3ab5['offset']){_0x45c731[_0x6581('0x91')](_0x4f3ab5['offset']);}return db[_0x6581('0x92')][_0x6581('0x6a')](_0x45c731[_0x6581('0x6b')](),_0x552e25);})['then'](function(_0x33c0de){_0x5c8ec1=_0x33c0de;var _0x3cb13a=getUsersQuery(_0x3ce0d0,_0x5c8ec1);return db[_0x6581('0x92')][_0x6581('0x6a')](_0x3cb13a['toString'](),_0x552e25);})[_0x6581('0x59')](function(_0x259aa7){_0x4d8399=_[_0x6581('0x93')](_0x259aa7,_0x48cb19);if(_0x3ce0d0==='mail'){return db[_0x6581('0x94')][_0x6581('0x95')]({'attributes':[_0x6581('0x96')],'raw':!![]});}})['then'](function(_0x345aaf){var _0x934714=_0x345aaf?_0x345aaf[_0x6581('0x96')]:undefined;var _0x337339=_0x5c8ec1[_0x6581('0x15')](function(_0x541f89){return updateInteraction(_0x541f89,_0x297a0d,_0x4d8399,_0x934714);});return Promise['all'](_0x337339);});}function countFilteredInteractions(_0x23c6dc,_0x59e9b4){var _0xeef4e6=_0x23c6dc[_0x6581('0x97')]();_0xeef4e6[_0x6581('0x8')](_0x6581('0x98'));_0xeef4e6[_0x6581('0x8')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x6581('0x3e'));var _0x2993f4=utils['getSelectedTags'](_0x59e9b4);if(!_['isEmpty'](_0x2993f4)){_0xeef4e6['where'](_0x6581('0x99'),_0x2993f4);}var _0x4a0416={'type':db[_0x6581('0x67')][_0x6581('0x68')][_0x6581('0x69')],'raw':!![]};return db[_0x6581('0x92')][_0x6581('0x6a')](_0xeef4e6[_0x6581('0x6b')](),_0x4a0416);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 2726a63..3ff692e 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa0bf=['MailMessage','findOne','out','plainBody','-id','then','trimStart','TagIds','Tags','catch','lodash','../../mysqldb','fullname','forEach','push','waiting','talking','answered','unmanaged','abandoned','total','disposition','UserId'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xa0bf,0xab));var _0xfa0b=function(_0x3be41e,_0x2301e9){_0x3be41e=_0x3be41e-0x0;var _0x14bbc3=_0xa0bf[_0x3be41e];return _0x14bbc3;};'use strict';var _=require(_0xfa0b('0x0'));var db=require(_0xfa0b('0x1'))['db'];function getInteractionUsers(_0x1cecf4,_0x18d44d){return new Promise(function(_0x156715,_0x2acc2a){try{var _0x3e8f0e=[];if(_0x18d44d[_0x1cecf4]){_0x3e8f0e=_0x18d44d[_0x1cecf4]['map'](function(_0x44d635){return{'id':_0x44d635['id'],'fullname':_0x44d635[_0xfa0b('0x2')]};});}return _0x156715(_0x3e8f0e);}catch(_0xfda428){_0x2acc2a(_0xfda428);}});}function getInteractionTags(_0x39ca7a,_0x156c75){var _0x45c66e=[];if(_0x39ca7a){_0x39ca7a['split'](',')[_0xfa0b('0x3')](function(_0x1a7aa3){_0x45c66e[_0xfa0b('0x4')](_0x156c75[_0x1a7aa3]);});}return _0x45c66e;}function updateWaitingCounter(_0x49343e){if(_0x49343e[_0xfa0b('0x5')]){_0x49343e[_0xfa0b('0x5')]-=0x1;}}function updateInteractionCounters(_0x114f1e){_0x114f1e[_0xfa0b('0x5')]=0x0;_0x114f1e[_0xfa0b('0x6')]=0x0;_0x114f1e[_0xfa0b('0x7')]=0x0;_0x114f1e[_0xfa0b('0x8')]=0x0;_0x114f1e[_0xfa0b('0x9')]=0x0;_0x114f1e[_0xfa0b('0xa')]=0x0;if(_0x114f1e['closed']){if(_0x114f1e[_0xfa0b('0xb')]===_0xfa0b('0x9')){_0x114f1e[_0xfa0b('0x9')]+=0x1;updateWaitingCounter(_0x114f1e);}if(_0x114f1e['UserId']){_0x114f1e[_0xfa0b('0x7')]+=0x1;if(_0x114f1e[_0xfa0b('0x6')]){_0x114f1e[_0xfa0b('0x6')]-=0x1;}}else{if(_0x114f1e[_0xfa0b('0xb')]){_0x114f1e[_0xfa0b('0x8')]+=0x1;updateWaitingCounter(_0x114f1e);}}}else{if(!_0x114f1e[_0xfa0b('0xc')]){_0x114f1e[_0xfa0b('0x5')]+=0x1;}if(_0x114f1e[_0xfa0b('0xc')]){_0x114f1e[_0xfa0b('0x6')]+=0x1;updateWaitingCounter(_0x114f1e);}}_0x114f1e[_0xfa0b('0xa')]+=0x1;return _0x114f1e;}function getLastMessageText(_0xd939b2){return db[_0xfa0b('0xd')][_0xfa0b('0xe')]({'where':{'$and':[{'MailInteractionId':_0xd939b2['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xfa0b('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xfa0b('0x10')],'order':_0xfa0b('0x11'),'raw':!![]})[_0xfa0b('0x12')](function(_0x117742){if(_0x117742&&_0x117742[_0xfa0b('0x10')]){_0xd939b2['lastMsgText']=_[_0xfa0b('0x13')](_0x117742[_0xfa0b('0x10')]);}return _0xd939b2;})['catch'](function(_0x27e226){throw _0x27e226;});}exports['updateInteraction']=function(_0x343184,_0x15a2cf,_0x1da035,_0x50da0f){return new Promise(function(_0x52c3db,_0x3f6a59){return getInteractionUsers(_0x343184['id'],_0x1da035)[_0xfa0b('0x12')](function(_0x27c3d4){_0x343184['Users']=_0x27c3d4;return getInteractionTags(_0x343184[_0xfa0b('0x14')],_0x15a2cf);})[_0xfa0b('0x12')](function(_0x3d456f){_0x343184[_0xfa0b('0x15')]=_0x3d456f;delete _0x343184[_0xfa0b('0x14')];return updateInteractionCounters(_0x343184);})[_0xfa0b('0x12')](function(_0x85b7b3){if(_0x50da0f){return getLastMessageText(_0x85b7b3);}else{return _0x85b7b3;}})[_0xfa0b('0x12')](function(_0x1e3d19){_0x52c3db(_0x1e3d19);})[_0xfa0b('0x16')](function(_0x581329){_0x3f6a59(_0x581329);});});}; \ No newline at end of file +var _0xca32=['forEach','push','waiting','talking','answered','unmanaged','abandoned','total','disposition','UserId','MailMessage','findOne','out','-id','then','plainBody','lastMsgText','trimStart','catch','updateInteraction','Users','Tags','TagIds','lodash','../../mysqldb'];(function(_0x687843,_0x26671e){var _0x5d1a52=function(_0x599034){while(--_0x599034){_0x687843['push'](_0x687843['shift']());}};_0x5d1a52(++_0x26671e);}(_0xca32,0x7b));var _0x2ca3=function(_0x5a1223,_0x3ab86c){_0x5a1223=_0x5a1223-0x0;var _0x2e5ccb=_0xca32[_0x5a1223];return _0x2e5ccb;};'use strict';var _=require(_0x2ca3('0x0'));var db=require(_0x2ca3('0x1'))['db'];function getInteractionUsers(_0x23ecc4,_0x222728){return new Promise(function(_0x104055,_0x4b319b){try{var _0x3fc4bb=[];if(_0x222728[_0x23ecc4]){_0x3fc4bb=_0x222728[_0x23ecc4]['map'](function(_0x384f8f){return{'id':_0x384f8f['id'],'fullname':_0x384f8f['fullname']};});}return _0x104055(_0x3fc4bb);}catch(_0x261871){_0x4b319b(_0x261871);}});}function getInteractionTags(_0x3ad110,_0x3bf309){var _0x4f2440=[];if(_0x3ad110){_0x3ad110['split'](',')[_0x2ca3('0x2')](function(_0x555e50){_0x4f2440[_0x2ca3('0x3')](_0x3bf309[_0x555e50]);});}return _0x4f2440;}function updateWaitingCounter(_0x2efae5){if(_0x2efae5[_0x2ca3('0x4')]){_0x2efae5[_0x2ca3('0x4')]-=0x1;}}function updateInteractionCounters(_0x35ee34){_0x35ee34[_0x2ca3('0x4')]=0x0;_0x35ee34[_0x2ca3('0x5')]=0x0;_0x35ee34[_0x2ca3('0x6')]=0x0;_0x35ee34[_0x2ca3('0x7')]=0x0;_0x35ee34[_0x2ca3('0x8')]=0x0;_0x35ee34[_0x2ca3('0x9')]=0x0;if(_0x35ee34['closed']){if(_0x35ee34[_0x2ca3('0xa')]===_0x2ca3('0x8')){_0x35ee34['abandoned']+=0x1;updateWaitingCounter(_0x35ee34);}if(_0x35ee34['UserId']){_0x35ee34[_0x2ca3('0x6')]+=0x1;if(_0x35ee34[_0x2ca3('0x5')]){_0x35ee34[_0x2ca3('0x5')]-=0x1;}}else{if(_0x35ee34['disposition']){_0x35ee34[_0x2ca3('0x7')]+=0x1;updateWaitingCounter(_0x35ee34);}}}else{if(!_0x35ee34[_0x2ca3('0xb')]){_0x35ee34[_0x2ca3('0x4')]+=0x1;}if(_0x35ee34[_0x2ca3('0xb')]){_0x35ee34['talking']+=0x1;updateWaitingCounter(_0x35ee34);}}_0x35ee34[_0x2ca3('0x9')]+=0x1;return _0x35ee34;}function getLastMessageText(_0x344237){return db[_0x2ca3('0xc')][_0x2ca3('0xd')]({'where':{'$and':[{'MailInteractionId':_0x344237['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x2ca3('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x2ca3('0xf'),'raw':!![]})[_0x2ca3('0x10')](function(_0x297f29){if(_0x297f29&&_0x297f29[_0x2ca3('0x11')]){_0x344237[_0x2ca3('0x12')]=_[_0x2ca3('0x13')](_0x297f29[_0x2ca3('0x11')]);}return _0x344237;})[_0x2ca3('0x14')](function(_0x376d10){throw _0x376d10;});}exports[_0x2ca3('0x15')]=function(_0x5ebed0,_0x6575f6,_0x18a537,_0x3d571e){return new Promise(function(_0x389c3d,_0x26ecb1){return getInteractionUsers(_0x5ebed0['id'],_0x18a537)[_0x2ca3('0x10')](function(_0x31a45a){_0x5ebed0[_0x2ca3('0x16')]=_0x31a45a;return getInteractionTags(_0x5ebed0['TagIds'],_0x6575f6);})['then'](function(_0x3e2ad5){_0x5ebed0[_0x2ca3('0x17')]=_0x3e2ad5;delete _0x5ebed0[_0x2ca3('0x18')];return updateInteractionCounters(_0x5ebed0);})[_0x2ca3('0x10')](function(_0x4c3ff0){if(_0x3d571e){return getLastMessageText(_0x4c3ff0);}else{return _0x4c3ff0;}})[_0x2ca3('0x10')](function(_0x5d8366){_0x389c3d(_0x5d8366);})['catch'](function(_0x37ef5a){_0x26ecb1(_0x37ef5a);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index c61aade..f7e01af 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4e4=['_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','toUpperCase','name','role','stringify','null','Interaction','findOne','update','then','catch','error','exports','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Account','upperFirst','InteractionId','unknown','websites','accounts'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xb4e4,0xb2));var _0x4b4e=function(_0x25ca63,_0xd63671){_0x25ca63=_0x25ca63-0x0;var _0x2e00e6=_0xb4e4[_0x25ca63];return _0x2e00e6;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0x4b4e('0x0')),'mail':require(_0x4b4e('0x1'))(_0x4b4e('0x2')),'fax':require('../../config/logger')(_0x4b4e('0x3')),'sms':require(_0x4b4e('0x1'))('sms-interactions'),'chat':require(_0x4b4e('0x1'))(_0x4b4e('0x4')),'whatsapp':require(_0x4b4e('0x1'))(_0x4b4e('0x5'))};function getAccountFK(_0x1040fc){return _[_0x4b4e('0x6')](_0x1040fc)+(_0x1040fc===_0x4b4e('0x7')?'Website':_0x4b4e('0x8'))+'Id';}function getInteractionFK(_0x30bb40){return _[_0x4b4e('0x6')](_0x30bb40)+'InteractionId';}function getInteractionId(_0x18a857,_0x1f1f97,_0x56290f){if(_0x18a857&&_0x18a857[_[_0x4b4e('0x9')](_0x56290f)+_0x4b4e('0xa')]){return _0x18a857[_['upperFirst'](_0x56290f)+'InteractionId'];}else if(_0x18a857&&_0x18a857['id']){return _0x18a857['id'];}else if(_0x1f1f97&&_0x1f1f97['id']){return _0x1f1f97['id'];}else{return _0x4b4e('0xb');}}function getInteractionsTables(_0x4c6c04){return{'accounts':_0x4c6c04+'_'+(_0x4c6c04===_0x4b4e('0x7')?_0x4b4e('0xc'):_0x4b4e('0xd')),'interactions':_0x4c6c04+_0x4b4e('0xe'),'interactionsTags':_0x4c6c04+_0x4b4e('0xf'),'messages':_0x4c6c04+_0x4b4e('0x10'),'userInteractions':_0x4b4e('0x11')+_0x4c6c04+_0x4b4e('0xe')};}function getSelectedTags(_0x96f67e){var _0x5a700e=[];if(_0x96f67e){_0x5a700e=Array[_0x4b4e('0x12')](_0x96f67e)?_0x96f67e:[_0x96f67e];}return _0x5a700e;}function log(_0x382863,_0xe0f0e1,_0x187b53,_0x3ce0b4,_0x293530,_0x4dd85b){loggers[_0x293530[_0x4b4e('0x13')]()][_0x382863]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4dd85b[_0x4b4e('0x14')](),_0xe0f0e1?_0xe0f0e1['id']:null,_0xe0f0e1?_0xe0f0e1[_0x4b4e('0x15')]:null,_0xe0f0e1?_0xe0f0e1[_0x4b4e('0x16')]:null,getInteractionId(_0x187b53,_0x3ce0b4,_0x293530),_0x187b53?JSON[_0x4b4e('0x17')](_0x187b53):_0x4b4e('0x18'));}function updateUser(_0xd197de,_0x433979,_0x476b4,_0x267652,_0x1924a1){db[_[_0x4b4e('0x9')](_0x267652)+_0x4b4e('0x19')][_0x4b4e('0x1a')]({'where':{'id':getInteractionId(_0x433979,_0x476b4,_0x267652)}})['then'](function(_0x328d2){if(_0x328d2){return _0x328d2[_0x4b4e('0x1b')]({'UserId':_0xd197de?_0xd197de['id']:null});}})[_0x4b4e('0x1c')](function(_0x4d95e5){if(_0x4d95e5){log('info',_0xd197de,_0x433979,_0x476b4,_0x267652,_0x1924a1);}})[_0x4b4e('0x1d')](function(){log(_0x4b4e('0x1e'),_0xd197de,_0x433979,_0x476b4,_0x267652,_0x1924a1);});}module[_0x4b4e('0x1f')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x943d=['stringify','null','Interaction','findOne','then','update','info','catch','error','exports','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','whatsapp-interactions','Website','InteractionId','unknown','chat','websites','accounts','_interactions','_messages','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x943d,0x19f));var _0xd943=function(_0x5a1a51,_0x144c79){_0x5a1a51=_0x5a1a51-0x0;var _0x47edd7=_0x943d[_0x5a1a51];return _0x47edd7;};'use strict';var _=require('lodash');var db=require(_0xd943('0x0'))['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0xd943('0x1'))(_0xd943('0x2')),'fax':require(_0xd943('0x1'))(_0xd943('0x3')),'sms':require(_0xd943('0x1'))('sms-interactions'),'chat':require(_0xd943('0x1'))('chat-interactions'),'whatsapp':require('../../config/logger')(_0xd943('0x4'))};function getAccountFK(_0x1ba2fe){return _['capitalize'](_0x1ba2fe)+(_0x1ba2fe==='chat'?_0xd943('0x5'):'Account')+'Id';}function getInteractionFK(_0x4222cf){return _['capitalize'](_0x4222cf)+'InteractionId';}function getInteractionId(_0x4087b6,_0x34fd85,_0x58223f){if(_0x4087b6&&_0x4087b6[_['upperFirst'](_0x58223f)+_0xd943('0x6')]){return _0x4087b6[_['upperFirst'](_0x58223f)+_0xd943('0x6')];}else if(_0x4087b6&&_0x4087b6['id']){return _0x4087b6['id'];}else if(_0x34fd85&&_0x34fd85['id']){return _0x34fd85['id'];}else{return _0xd943('0x7');}}function getInteractionsTables(_0x3e6779){return{'accounts':_0x3e6779+'_'+(_0x3e6779===_0xd943('0x8')?_0xd943('0x9'):_0xd943('0xa')),'interactions':_0x3e6779+_0xd943('0xb'),'interactionsTags':_0x3e6779+'_interaction_has_tags','messages':_0x3e6779+_0xd943('0xc'),'userInteractions':'user_has_'+_0x3e6779+'_interactions'};}function getSelectedTags(_0x6e4d45){var _0x468c0a=[];if(_0x6e4d45){_0x468c0a=Array['isArray'](_0x6e4d45)?_0x6e4d45:[_0x6e4d45];}return _0x468c0a;}function log(_0xe175e8,_0xffb9e1,_0x1cf0a3,_0x5a0a9d,_0x7282bc,_0x31fcd9){loggers[_0x7282bc[_0xd943('0xd')]()][_0xe175e8](_0xd943('0xe'),_0x31fcd9[_0xd943('0xf')](),_0xffb9e1?_0xffb9e1['id']:null,_0xffb9e1?_0xffb9e1[_0xd943('0x10')]:null,_0xffb9e1?_0xffb9e1['role']:null,getInteractionId(_0x1cf0a3,_0x5a0a9d,_0x7282bc),_0x1cf0a3?JSON[_0xd943('0x11')](_0x1cf0a3):_0xd943('0x12'));}function updateUser(_0x1ef714,_0x4f4bb3,_0x17180b,_0xdbcb0e,_0x4ca57a){db[_['upperFirst'](_0xdbcb0e)+_0xd943('0x13')][_0xd943('0x14')]({'where':{'id':getInteractionId(_0x4f4bb3,_0x17180b,_0xdbcb0e)}})[_0xd943('0x15')](function(_0x1cd58f){if(_0x1cd58f){return _0x1cd58f[_0xd943('0x16')]({'UserId':_0x1ef714?_0x1ef714['id']:null});}})['then'](function(_0x40b1ff){if(_0x40b1ff){log(_0xd943('0x17'),_0x1ef714,_0x4f4bb3,_0x17180b,_0xdbcb0e,_0x4ca57a);}})[_0xd943('0x18')](function(){log(_0xd943('0x19'),_0x1ef714,_0x4f4bb3,_0x17180b,_0xdbcb0e,_0x4ca57a);});}module[_0xd943('0x1a')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index deff2e1..a019376 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c06=['utf8','parse','use','License','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','crypto','util','../../mysqldb','license','split','aes-256-ctr','format','%s:%s:%s','update','base64','final'];(function(_0x49674c,_0x3821d0){var _0x21c8d4=function(_0x58745c){while(--_0x58745c){_0x49674c['push'](_0x49674c['shift']());}};_0x21c8d4(++_0x3821d0);}(_0x9c06,0x68));var _0x69c0=function(_0x140862,_0xfacc31){_0x140862=_0x140862-0x0;var _0x1aa9c3=_0x9c06[_0x140862];return _0x1aa9c3;};'use strict';var crypto=require(_0x69c0('0x0'));var util=require(_0x69c0('0x1'));var compose=require('composable-middleware');var db=require(_0x69c0('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x1598ed,_0x1c9eab){if(_0x1598ed&&_0x1c9eab){if(_0x1c9eab['data1']&&_0x1c9eab[_0x69c0('0x3')]){var _0xc81bba=_0x1c9eab['data1'];var _0x48c134=_0x1c9eab[_0x69c0('0x3')];var _0x32f061=_0xc81bba[_0x69c0('0x4')]('-')[0x4];var _0x1d931b=_0xc81bba[_0x69c0('0x4')]('-')[0x0];var _0x567b17=crypto['createDecipher'](_0x69c0('0x5'),util[_0x69c0('0x6')](_0x69c0('0x7'),_0x32f061,_0xc81bba,_0x1d931b));var _0x2b6437=_0x567b17[_0x69c0('0x8')](_0x48c134,_0x69c0('0x9'),'utf8');_0x2b6437+=_0x567b17[_0x69c0('0xa')](_0x69c0('0xb'));var _0x4c207f=JSON[_0x69c0('0xc')](_0x2b6437);return _0x4c207f['hasOwnProperty'](_0x1598ed)?_0x4c207f[_0x1598ed]:null;}}return null;}function isLimit(_0x14d0e9,_0x584d43,_0x35f288,_0x19d8ac){var _0x450059=_0x584d43;return compose()[_0x69c0('0xd')](function(_0x4689c6,_0xaaec4c,_0x221956){return db[_0x69c0('0xe')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x69c0('0xf')](function(_0x4cdf27){var _0x15d5ca=getValueFromLicense(_0x14d0e9,_0x4cdf27);return _0x15d5ca?_0x15d5ca:_0x450059;})[_0x69c0('0xf')](function(_0x49255d){_0x450059=_0x49255d;return _0x35f288[_0x69c0('0x10')](_0x19d8ac);})[_0x69c0('0xf')](function(_0x4a1e16){if(_0x4a1e16>=_0x450059){return _0xaaec4c[_0x69c0('0x11')](0x193)[_0x69c0('0x12')]({'message':util[_0x69c0('0x6')](_0x69c0('0x13'),_0x14d0e9)});}_0x221956();})[_0x69c0('0x14')](function(_0x10f8e9){_0x221956(_0x10f8e9);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x69c0('0x15')],{'where':{'$or':[{'role':_0x69c0('0x16')},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xd054=['utf8','final','hasOwnProperty','use','License','findOne','then','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','update','base64'];(function(_0x35b208,_0x2b9846){var _0x145e21=function(_0xaf4ff4){while(--_0xaf4ff4){_0x35b208['push'](_0x35b208['shift']());}};_0x145e21(++_0x2b9846);}(_0xd054,0x160));var _0x4d05=function(_0x1b2bbf,_0x314a90){_0x1b2bbf=_0x1b2bbf-0x0;var _0x1cfe40=_0xd054[_0x1b2bbf];return _0x1cfe40;};'use strict';var crypto=require(_0x4d05('0x0'));var util=require(_0x4d05('0x1'));var compose=require(_0x4d05('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x4d05('0x3'));function getValueFromLicense(_0x3808f8,_0x155b29){if(_0x3808f8&&_0x155b29){if(_0x155b29[_0x4d05('0x4')]&&_0x155b29[_0x4d05('0x5')]){var _0x4d33a9=_0x155b29[_0x4d05('0x4')];var _0x2e236d=_0x155b29[_0x4d05('0x5')];var _0x36fe13=_0x4d33a9['split']('-')[0x4];var _0x47bcbc=_0x4d33a9[_0x4d05('0x6')]('-')[0x0];var _0x57f15e=crypto[_0x4d05('0x7')](_0x4d05('0x8'),util[_0x4d05('0x9')]('%s:%s:%s',_0x36fe13,_0x4d33a9,_0x47bcbc));var _0x364757=_0x57f15e[_0x4d05('0xa')](_0x2e236d,_0x4d05('0xb'),_0x4d05('0xc'));_0x364757+=_0x57f15e[_0x4d05('0xd')]('utf8');var _0x47519b=JSON['parse'](_0x364757);return _0x47519b[_0x4d05('0xe')](_0x3808f8)?_0x47519b[_0x3808f8]:null;}}return null;}function isLimit(_0x48bd81,_0x56e1ec,_0x1d4d1c,_0xfdb0b0){var _0x13bebe=_0x56e1ec;return compose()[_0x4d05('0xf')](function(_0x4000b9,_0x14828f,_0x193307){return db[_0x4d05('0x10')][_0x4d05('0x11')]({'where':{'id':0x1},'raw':!![]})[_0x4d05('0x12')](function(_0x4cb937){var _0x2ba4cf=getValueFromLicense(_0x48bd81,_0x4cb937);return _0x2ba4cf?_0x2ba4cf:_0x13bebe;})[_0x4d05('0x12')](function(_0x4c24cb){_0x13bebe=_0x4c24cb;return _0x1d4d1c['count'](_0xfdb0b0);})[_0x4d05('0x12')](function(_0x3f065d){if(_0x3f065d>=_0x13bebe){return _0x14828f[_0x4d05('0x13')](0x193)['json']({'message':util['format'](_0x4d05('0x14'),_0x48bd81)});}_0x193307();})['catch'](function(_0x8354e9){_0x193307(_0x8354e9);});});}function isUserLimit(){return isLimit(_0x4d05('0x15'),0x1,db[_0x4d05('0x16')],{'where':{'$or':[{'role':_0x4d05('0x17')},{'role':_0x4d05('0x18')}]}});}exports[_0x4d05('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 714d284..58a4308 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 _0x9091=['$eq','$between','value','includes','$gt','$lte','add','days','format','castTo','text','\x20AS\x20','field','$notIn','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','shift','utcOffset','hours','minutes','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','split','length','slice','forEach','match','filter','map','push','buildExpression','DATE','operator'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9091,0x1c2));var _0x1909=function(_0x55b35f,_0x5aeae0){_0x55b35f=_0x55b35f-0x0;var _0x4b78f0=_0x9091[_0x55b35f];return _0x4b78f0;};'use strict';var _=require('lodash');var moment=require(_0x1909('0x0'));exports[_0x1909('0x1')]=function(_0x23bed3){var _0x20d3bb={'conditions':[]};_0x20d3bb[_0x1909('0x2')]=_[_0x1909('0x3')](_0x23bed3,_0x1909('0x4'))?'or':_0x1909('0x5');var _0x3e68ee=_0x23bed3['replace']('[$and]','')[_0x1909('0x6')]('[$or]','')[_0x1909('0x7')]('||');for(var _0x3dd1ad=0x0;_0x3dd1ad<_0x3e68ee[_0x1909('0x8')];_0x3dd1ad++){var _0x4b625d=_0x3e68ee[_0x3dd1ad][_0x1909('0x7')](':=');var _0x237af7=_0x4b625d[0x0];var _0x122175=_0x4b625d[_0x1909('0x9')](0x1);_0x122175[_0x1909('0xa')](function(_0x1dcb62){var _0x34d14a=_0x1dcb62[_0x1909('0x7')]('[')['shift']();var _0x1d98b0=_0x1dcb62[_0x1909('0xb')](/\[(.*?)\]/g);_0x1d98b0['forEach'](function(_0xd8d0ac){var _0x5198b8=_0xd8d0ac[_0x1909('0x7')]('[')[_0x1909('0xc')](function(_0x43c1d8){return _0x43c1d8['indexOf'](']')>-0x1;})[_0x1909('0xd')](function(_0x102adb){return _0x102adb[_0x1909('0x7')](']')[0x0];})[0x0];_0x20d3bb['conditions'][_0x1909('0xe')]({'field':_0x237af7,'operator':_0x34d14a,'value':_0x5198b8});});});}return _0x20d3bb;};exports[_0x1909('0xf')]=function(_0x8ece23,_0x11b15e,_0x4777db){var _0x23555e={};if(_0x11b15e===_0x1909('0x10')){if(_0x4777db[_0x1909('0x11')]===_0x1909('0x12')){_0x4777db[_0x1909('0x11')]=_0x1909('0x13');_0x4777db[_0x1909('0x14')]+=','+_0x4777db[_0x1909('0x14')];}else if(_[_0x1909('0x15')]([_0x1909('0x16'),_0x1909('0x17')],_0x4777db[_0x1909('0x11')])){_0x4777db['value']=moment(_0x4777db[_0x1909('0x14')])[_0x1909('0x18')](0x1,_0x1909('0x19'))[_0x1909('0x1a')]('YYYY-MM-DD');}}if(_0x4777db['castTo']){_0x11b15e=_0x4777db[_0x1909('0x1b')];_0x23555e[_0x1909('0x1c')]='CAST('+_0x8ece23+'.'+_0x4777db['field']+_0x1909('0x1d')+_0x4777db[_0x1909('0x1b')]+')\x20'+parseOperator(_0x4777db['operator']);}else{_0x23555e[_0x1909('0x1c')]=_0x8ece23+'.'+_0x4777db[_0x1909('0x1e')]+'\x20'+parseOperator(_0x4777db[_0x1909('0x11')]);}if(_['includes'](['$ne',_0x1909('0x1f')],_0x4777db[_0x1909('0x11')]))_0x23555e[_0x1909('0x1c')]='('+_0x23555e['text']+_0x1909('0x20')+_0x8ece23+'.'+_0x4777db[_0x1909('0x1e')]+'\x20IS\x20NULL)';_0x23555e[_0x1909('0x14')]=parseValue(_0x11b15e,_0x4777db['operator'],_0x4777db['value']);return _0x23555e;};function parseOperator(_0x491b60){var _0x576cae;switch(_0x491b60){case _0x1909('0x21'):_0x576cae=_0x1909('0x22');break;case _0x1909('0x1f'):_0x576cae=_0x1909('0x23');break;case'$eq':_0x576cae='=\x20?';break;case'$ne':_0x576cae=_0x1909('0x24');break;case _0x1909('0x25'):case _0x1909('0x26'):case _0x1909('0x27'):_0x576cae=_0x1909('0x28');break;case _0x1909('0x29'):_0x576cae=_0x1909('0x2a');break;case _0x1909('0x16'):_0x576cae=_0x1909('0x2b');break;case _0x1909('0x17'):_0x576cae='<=\x20?';break;case _0x1909('0x2c'):_0x576cae='>=\x20?';break;case'$between':_0x576cae=_0x1909('0x2d');break;}return _0x576cae;}function parseValue(_0x56c03c,_0x229422,_0x29fb08){var _0x31028d={'start':undefined,'end':undefined};switch(_0x229422){case _0x1909('0x21'):case _0x1909('0x1f'):_0x31028d[_0x1909('0x2e')]=_0x29fb08[_0x1909('0x7')](',');break;case'$substring':_0x31028d['start']='%'+_0x29fb08+'%';break;case _0x1909('0x26'):_0x31028d[_0x1909('0x2e')]=_0x29fb08+'%';break;case _0x1909('0x27'):_0x31028d[_0x1909('0x2e')]='%'+_0x29fb08;break;case _0x1909('0x13'):var _0x42c95d=_0x29fb08[_0x1909('0x7')](',');var _0x29fb08=_0x42c95d[_0x1909('0x2f')]();var _0x3f417d=_0x42c95d['pop']();if(_0x56c03c===_0x1909('0x10')){_0x29fb08=moment(_0x29fb08)[_0x1909('0x30')](0x0,!![])[_0x1909('0x1a')]();_0x3f417d=moment(_0x3f417d)[_0x1909('0x30')](0x0,!![])[_0x1909('0x18')](0x17,_0x1909('0x31'))[_0x1909('0x18')](0x3b,_0x1909('0x32'))[_0x1909('0x18')](0x3b,_0x1909('0x33'))[_0x1909('0x1a')]();}_0x31028d={'start':_0x29fb08,'end':_0x3f417d};break;default:_0x31028d[_0x1909('0x2e')]=_0x29fb08;break;}return _0x31028d;} \ No newline at end of file +var _0x056c=['format','YYYY-MM-DD','castTo','text','CAST(','field','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','LIKE\x20?','$lt','$gt','>\x20?','$lte','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','$in','start','pop','DATE','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','replace','[$and]','split','length','slice','forEach','match','filter','indexOf','map','push','buildExpression','operator','$eq','$between','value','add','days'];(function(_0x2c602e,_0x1d26f5){var _0x1a2650=function(_0x2370d1){while(--_0x2370d1){_0x2c602e['push'](_0x2c602e['shift']());}};_0x1a2650(++_0x1d26f5);}(_0x056c,0x1d7));var _0xc056=function(_0x388778,_0x5c9075){_0x388778=_0x388778-0x0;var _0x561d89=_0x056c[_0x388778];return _0x561d89;};'use strict';var _=require(_0xc056('0x0'));var moment=require(_0xc056('0x1'));exports[_0xc056('0x2')]=function(_0x144f36){var _0x3726d0={'conditions':[]};_0x3726d0[_0xc056('0x3')]=_[_0xc056('0x4')](_0x144f36,_0xc056('0x5'))?'or':'and';var _0x369b77=_0x144f36[_0xc056('0x6')](_0xc056('0x7'),'')[_0xc056('0x6')](_0xc056('0x5'),'')[_0xc056('0x8')]('||');for(var _0x5c1299=0x0;_0x5c1299<_0x369b77[_0xc056('0x9')];_0x5c1299++){var _0x46518d=_0x369b77[_0x5c1299][_0xc056('0x8')](':=');var _0x1612ea=_0x46518d[0x0];var _0x3a34a7=_0x46518d[_0xc056('0xa')](0x1);_0x3a34a7[_0xc056('0xb')](function(_0x116a9b){var _0x22ff87=_0x116a9b[_0xc056('0x8')]('[')['shift']();var _0x15fbef=_0x116a9b[_0xc056('0xc')](/\[(.*?)\]/g);_0x15fbef[_0xc056('0xb')](function(_0x183925){var _0x559574=_0x183925[_0xc056('0x8')]('[')[_0xc056('0xd')](function(_0x452249){return _0x452249[_0xc056('0xe')](']')>-0x1;})[_0xc056('0xf')](function(_0x54166d){return _0x54166d[_0xc056('0x8')](']')[0x0];})[0x0];_0x3726d0['conditions'][_0xc056('0x10')]({'field':_0x1612ea,'operator':_0x22ff87,'value':_0x559574});});});}return _0x3726d0;};exports[_0xc056('0x11')]=function(_0x2d7468,_0xca4513,_0x4ce0f5){var _0x33add7={};if(_0xca4513==='DATE'){if(_0x4ce0f5[_0xc056('0x12')]===_0xc056('0x13')){_0x4ce0f5['operator']=_0xc056('0x14');_0x4ce0f5[_0xc056('0x15')]+=','+_0x4ce0f5[_0xc056('0x15')];}else if(_['includes'](['$gt','$lte'],_0x4ce0f5[_0xc056('0x12')])){_0x4ce0f5[_0xc056('0x15')]=moment(_0x4ce0f5['value'])[_0xc056('0x16')](0x1,_0xc056('0x17'))[_0xc056('0x18')](_0xc056('0x19'));}}if(_0x4ce0f5['castTo']){_0xca4513=_0x4ce0f5[_0xc056('0x1a')];_0x33add7[_0xc056('0x1b')]=_0xc056('0x1c')+_0x2d7468+'.'+_0x4ce0f5[_0xc056('0x1d')]+'\x20AS\x20'+_0x4ce0f5['castTo']+')\x20'+parseOperator(_0x4ce0f5[_0xc056('0x12')]);}else{_0x33add7[_0xc056('0x1b')]=_0x2d7468+'.'+_0x4ce0f5[_0xc056('0x1d')]+'\x20'+parseOperator(_0x4ce0f5['operator']);}if(_[_0xc056('0x1e')]([_0xc056('0x1f'),_0xc056('0x20')],_0x4ce0f5[_0xc056('0x12')]))_0x33add7[_0xc056('0x1b')]='('+_0x33add7[_0xc056('0x1b')]+_0xc056('0x21')+_0x2d7468+'.'+_0x4ce0f5[_0xc056('0x1d')]+_0xc056('0x22');_0x33add7[_0xc056('0x15')]=parseValue(_0xca4513,_0x4ce0f5['operator'],_0x4ce0f5[_0xc056('0x15')]);return _0x33add7;};function parseOperator(_0x56ee56){var _0x3e057b;switch(_0x56ee56){case'$in':_0x3e057b=_0xc056('0x23');break;case _0xc056('0x20'):_0x3e057b='NOT\x20IN\x20?';break;case _0xc056('0x13'):_0x3e057b=_0xc056('0x24');break;case'$ne':_0x3e057b=_0xc056('0x25');break;case'$substring':case _0xc056('0x26'):case _0xc056('0x27'):_0x3e057b=_0xc056('0x28');break;case _0xc056('0x29'):_0x3e057b='<\x20?';break;case _0xc056('0x2a'):_0x3e057b=_0xc056('0x2b');break;case _0xc056('0x2c'):_0x3e057b=_0xc056('0x2d');break;case _0xc056('0x2e'):_0x3e057b='>=\x20?';break;case _0xc056('0x14'):_0x3e057b=_0xc056('0x2f');break;}return _0x3e057b;}function parseValue(_0x577e06,_0x725b5b,_0x5d0ffe){var _0xdcc235={'start':undefined,'end':undefined};switch(_0x725b5b){case _0xc056('0x30'):case _0xc056('0x20'):_0xdcc235[_0xc056('0x31')]=_0x5d0ffe[_0xc056('0x8')](',');break;case'$substring':_0xdcc235[_0xc056('0x31')]='%'+_0x5d0ffe+'%';break;case _0xc056('0x26'):_0xdcc235[_0xc056('0x31')]=_0x5d0ffe+'%';break;case'$endsWith':_0xdcc235[_0xc056('0x31')]='%'+_0x5d0ffe;break;case _0xc056('0x14'):var _0x1e5031=_0x5d0ffe[_0xc056('0x8')](',');var _0x5d0ffe=_0x1e5031['shift']();var _0x5babf5=_0x1e5031[_0xc056('0x32')]();if(_0x577e06===_0xc056('0x33')){_0x5d0ffe=moment(_0x5d0ffe)['utcOffset'](0x0,!![])['format']();_0x5babf5=moment(_0x5babf5)['utcOffset'](0x0,!![])[_0xc056('0x16')](0x17,_0xc056('0x34'))[_0xc056('0x16')](0x3b,_0xc056('0x35'))['add'](0x3b,_0xc056('0x36'))[_0xc056('0x18')]();}_0xdcc235={'start':_0x5d0ffe,'end':_0x5babf5};break;default:_0xdcc235[_0xc056('0x31')]=_0x5d0ffe;break;}return _0xdcc235;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index f0a6400..382dea3 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 _0x4775=['../../mysqldb','parse','keys','includes','model','alias','fields','split','filters','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','offset','sort','map','indexOf','priority','unsigned','substr','DESC','cast','col','ASC','isEmpty','omit','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','replace','forEach','push','join','getOptions','query','$id','intersection','attributes','length','nolimit','limit','order','where','pick','filter','object','columns','value','merge','VIRTUAL','lower','include','includeAll'];(function(_0x56bcd9,_0x2ed159){var _0x4495bd=function(_0x40f2fe){while(--_0x40f2fe){_0x56bcd9['push'](_0x56bcd9['shift']());}};_0x4495bd(++_0x2ed159);}(_0x4775,0x15e));var _0x5477=function(_0x6c0123,_0x4c8d3b){_0x6c0123=_0x6c0123-0x0;var _0x5a87d2=_0x4775[_0x6c0123];return _0x5a87d2;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require('moment');var db=require(_0x5477('0x0'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x3c5366){var _0x29033a=['ne'];try{var _0x1939ce=JSON[_0x5477('0x1')](_0x3c5366);var _0x399ffc=Object[_0x5477('0x2')](_0x1939ce)[0x0];return _0x29033a[_0x5477('0x3')](_0x399ffc);}catch(_0x3b1509){return![];}}function getOperatorValue(_0x33c5ef){var _0x1ce99e=JSON['parse'](_0x33c5ef);var _0x302d3c=Object[_0x5477('0x2')](_0x1ce99e)[0x0];var _0x592e8f=_0x1ce99e[_0x302d3c];return{['$'+_0x302d3c]:_0x592e8f};}function parseIncludeModel(_0x59cdb7){var _0x1a4547=JSON[_0x5477('0x1')](_0x59cdb7);return{'model':db[_0x1a4547[_0x5477('0x4')]],'as':_0x1a4547[_0x5477('0x5')],'attributes':_0x1a4547[_0x5477('0x6')],'raw':_0x1a4547['raw']};}exports['fields']=function(_0xda6dea){var _0x26bcd1=null;if(_0xda6dea){_0x26bcd1=_0xda6dea[_0x5477('0x7')](',');}return _0x26bcd1;};exports[_0x5477('0x8')]=function(_0x4c1a3f,_0x37b4ae){var _0x55afa1={};if(!_['isEmpty'](_0x4c1a3f)){_['forOwn'](_0x4c1a3f,function(_0x23e540,_0x21eb9a){try{if(_0x37b4ae){var _0x9056be=_[_0x5477('0x9')](_0x37b4ae,{'name':_0x21eb9a})||{};if(hasSequelizeOperator(_0x23e540)){_0x55afa1[_0x21eb9a]=getOperatorValue(_0x23e540);}else if(_0x9056be[_0x5477('0xa')]===_0x5477('0xb')&&_[_0x5477('0xc')](_0x23e540)){var _0x3431a1=JSON[_0x5477('0x1')](_0x23e540);var _0x18db6e={'$gte':moment(moment(_0x3431a1[_0x5477('0xd')])[_0x5477('0xe')](_0x5477('0xf')))[_0x5477('0x10')]()[_0x5477('0xe')](),'$lte':moment(moment(_0x3431a1[_0x5477('0x11')])[_0x5477('0xe')]('YYYY-MM-DD'))[_0x5477('0x10')]()[_0x5477('0x12')](0x1,'s')[_0x5477('0xe')]()};_0x55afa1[_0x21eb9a]=_0x18db6e;}else if(_0x9056be[_0x5477('0x13')]===_0x5477('0x14')){_0x55afa1[_0x21eb9a]=_0x23e540;}else{_0x55afa1[_0x21eb9a]=_['isArray'](_0x23e540)?_0x23e540:JSON['parse'](_0x23e540);}}else{_0x55afa1[_0x21eb9a]=_[_0x5477('0x15')](_0x23e540)?_0x23e540:JSON[_0x5477('0x1')](_0x23e540);}}catch(_0x45db36){_0x55afa1[_0x21eb9a]=_0x23e540[_0x5477('0x7')](',');}});}return _0x55afa1;};exports['limit']=function(_0x5913d2){_0x5913d2=parseInt(_0x5913d2,0xa);if(!_0x5913d2||_0x5913d2<0x0){_0x5913d2=LIMIT_VALUE;}return _0x5913d2;};exports[_0x5477('0x16')]=function(_0x10b894){_0x10b894=parseInt(_0x10b894,0xa);if(!_0x10b894||_0x10b894<0x0){_0x10b894=0x0;}return _0x10b894;};exports[_0x5477('0x17')]=function(_0x2c4cc5){var _0x437394,_0x1196e4=null;if(_0x2c4cc5){_0x437394=_0x2c4cc5[_0x5477('0x7')](',');_0x1196e4=_[_0x5477('0x18')](_0x437394,function(_0x476121){if(_0x476121[_0x5477('0x19')]('-')===0x0){return[_0x476121===_0x5477('0x1a')?sequelize['cast'](sequelize['col'](_0x5477('0x1a')),_0x5477('0x1b')):_0x476121[_0x5477('0x1c')](0x1),_0x5477('0x1d')];}else{return[_0x476121===_0x5477('0x1a')?sequelize[_0x5477('0x1e')](sequelize[_0x5477('0x1f')](_0x5477('0x1a')),'unsigned'):_0x476121,_0x5477('0x20')];}});}return _0x1196e4;};exports['omit']=function(_0x5d7e50,_0x17fe62){if(_[_0x5477('0x21')](_0x5d7e50)){return _0x5d7e50;}if(_[_0x5477('0x15')](_0x5d7e50)){for(var _0x24eba0=0x0;_0x24eba0<_0x5d7e50['length'];_0x24eba0+=0x1){_0x5d7e50[_0x24eba0]=this[_0x5477('0x22')](_0x5d7e50[_0x24eba0],_0x17fe62);}return _0x5d7e50;}if(!_[_0x5477('0x23')](_0x5d7e50)){return _0x5d7e50;}if(_[_0x5477('0x24')](_0x17fe62)){_0x17fe62=[_0x17fe62];}if(!_[_0x5477('0x15')](_0x17fe62)){return _0x5d7e50;}for(var _0x497f18=0x0;_0x497f18<_0x17fe62['length'];_0x497f18+=0x1){_[_0x5477('0x25')](_0x5d7e50,_0x17fe62[_0x497f18]);}for(var _0x48ddb3 in _0x5d7e50){if(_0x5d7e50[_0x5477('0x26')](_0x48ddb3)){_0x5d7e50[_0x48ddb3]=this[_0x5477('0x22')](_0x5d7e50[_0x48ddb3],_0x17fe62);}}return _0x5d7e50;};exports[_0x5477('0x27')]=function(_0xc8e6e6){return _0xc8e6e6[_0x5477('0x28')](RegExp(_0x5477('0x29')))?!![]:![];};exports[_0x5477('0x2a')]=function(_0x4a871f){return _0x4a871f[_0x5477('0x28')](/^\S+@\S+$/)?!![]:![];};exports[_0x5477('0x2b')]=function(_0x628e5c,_0x212392){var _0x361025=[];var _0x2ea1a5=/([^:]")"+/g;var _0x393f31=/[*<>~@-]/g;var _0x4d759c=/[ `!@#$%^&*()_\-?~<>]/;var _0x33bcf3=/[ ,]+/;var _0x5e165d=_0x212392?_0x5477('0x2c'):_0x5477('0x2d');if(_0x212392){_0x628e5c=_0x628e5c[_0x5477('0x2e')](_0x393f31,'\x20')['trim']();}_0x628e5c[_0x5477('0x7')](_0x33bcf3)[_0x5477('0x2f')](function(_0x3c69c7){_0x3c69c7=_0x3c69c7[_0x5477('0x2e')](_0x2ea1a5,'$1');_0x3c69c7='+'+_0x3c69c7+'*';var _0x349a64=_0x3c69c7[_0x5477('0x28')](_0x4d759c);if(_0x349a64){_0x3c69c7='\x22'+_0x3c69c7+'\x22';}_0x361025[_0x5477('0x30')](_0x3c69c7);});_0x5e165d=_0x5e165d['replace'](_0x5477('0x2d'),_0x361025[_0x5477('0x31')]('\x20'));return _0x5e165d;};exports[_0x5477('0x32')]=function(_0x1e8ba3,_0x174256,_0x2890f1){var _0x4f2701={},_0x44e8f8={};if(_0x174256[_0x5477('0x33')][_0x5477('0x34')]){_0x174256['query']['id']=_0x174256['query'][_0x5477('0x34')];delete _0x174256[_0x5477('0x33')]['$id'];}_0x4f2701['model']=_[_0x5477('0x18')](_0x1e8ba3,_0x5477('0x13'));_0x4f2701[_0x5477('0x33')]=_[_0x5477('0x2')](_0x174256['query']);_0x4f2701[_0x5477('0x8')]=_[_0x5477('0x35')](_0x4f2701[_0x5477('0x4')],_0x4f2701[_0x5477('0x33')]);_0x44e8f8['attributes']=_[_0x5477('0x35')](_0x4f2701[_0x5477('0x4')],this[_0x5477('0x6')](_0x174256[_0x5477('0x33')][_0x5477('0x6')]));_0x44e8f8[_0x5477('0x36')]=_0x44e8f8[_0x5477('0x36')][_0x5477('0x37')]?_0x44e8f8['attributes']:_0x4f2701[_0x5477('0x4')];if(!_0x174256['query'][_0x5477('0x26')](_0x5477('0x38'))){_0x44e8f8[_0x5477('0x39')]=this[_0x5477('0x39')](_0x174256[_0x5477('0x33')][_0x5477('0x39')]);_0x44e8f8[_0x5477('0x16')]=this[_0x5477('0x16')](_0x174256[_0x5477('0x33')][_0x5477('0x16')]);}_0x44e8f8[_0x5477('0x3a')]=this[_0x5477('0x17')](_0x174256['query'][_0x5477('0x17')]);_0x44e8f8[_0x5477('0x3b')]=this[_0x5477('0x8')](_[_0x5477('0x3c')](_0x174256[_0x5477('0x33')],_0x4f2701[_0x5477('0x8')]),_0x1e8ba3);if(_0x174256[_0x5477('0x33')][_0x5477('0x3d')]){var _0x122538=_0x1e8ba3;var _0x28d732=_0x174256[_0x5477('0x33')]['filter'];if(typeof _0x28d732===_0x5477('0x3e')){_0x122538=_[_0x5477('0x3d')](_0x1e8ba3,function(_0x495502){return _['includes'](_0x28d732[_0x5477('0x3f')],_0x495502['name']);});_0x28d732=_0x28d732[_0x5477('0x40')];}_0x44e8f8[_0x5477('0x3b')]=_[_0x5477('0x41')](_0x44e8f8[_0x5477('0x3b')],{'$or':_[_0x5477('0x18')](_0x122538,function(_0x7c1ef7){if(_0x7c1ef7[_0x5477('0xa')]!==_0x5477('0x42')){if(_0x2890f1){return sequelize[_0x5477('0x3b')](sequelize['fn'](_0x5477('0x43'),sequelize['col'](_0x7c1ef7[_0x5477('0x13')])),{'$like':sequelize['fn'](_0x5477('0x43'),'%'+_0x174256[_0x5477('0x33')]['filter']+'%')});}else{var _0x2cca86={};_0x2cca86[_0x7c1ef7[_0x5477('0x13')]]={'$like':'%'+_0x174256[_0x5477('0x33')]['filter']+'%'};return _0x2cca86;}}})});}_0x44e8f8=_[_0x5477('0x41')]({},_0x44e8f8,_0x174256['options']);return _0x44e8f8;};exports[_0x5477('0x44')]=function(_0xb64737){var _0x816926=[];if(_0xb64737[_0x5477('0x45')]){_0x816926[_0x5477('0x30')]({'all':!![]});}else if(_0xb64737[_0x5477('0x44')]){if(Array['isArray'](_0xb64737[_0x5477('0x44')])){_0x816926=Object[_0x5477('0x2')](_0xb64737[_0x5477('0x44')])[_0x5477('0x18')](function(_0x83b672){return parseIncludeModel(_0xb64737[_0x5477('0x44')][_0x83b672]);});}else{var _0x5cba81=parseIncludeModel(_0xb64737[_0x5477('0x44')]);_0x816926[_0x5477('0x30')](_0x5cba81);}}return _0x816926;};exports['escapeLIKESpecialChars']=function(_0x99ab5b){return _0x99ab5b['replace'](/[%_^-]/g,function(_0x4970cb){return'\x5c'+_0x4970cb;});}; \ No newline at end of file +var _0x6e71=['priority','col','unsigned','ASC','omit','isObject','isString','length','unset','hasOwnProperty','isNumeric','getFullTextValue','{EXPR}','replace','trim','forEach','match','push','join','getOptions','query','$id','model','intersection','attributes','nolimit','where','pick','filter','columns','merge','lower','options','include','includeAll','escapeLIKESpecialChars','lodash','sequelize','moment','../../mysqldb','keys','includes','parse','alias','fields','raw','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','offset','sort','map'];(function(_0x13ed69,_0x229161){var _0x50c72e=function(_0x4f1491){while(--_0x4f1491){_0x13ed69['push'](_0x13ed69['shift']());}};_0x50c72e(++_0x229161);}(_0x6e71,0x67));var _0x16e7=function(_0x37f20f,_0x321935){_0x37f20f=_0x37f20f-0x0;var _0x3639dd=_0x6e71[_0x37f20f];return _0x3639dd;};'use strict';var _=require(_0x16e7('0x0'));var sequelize=require(_0x16e7('0x1'));var moment=require(_0x16e7('0x2'));var db=require(_0x16e7('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x123845){var _0x119387=['ne'];try{var _0x217548=JSON['parse'](_0x123845);var _0xc756f5=Object[_0x16e7('0x4')](_0x217548)[0x0];return _0x119387[_0x16e7('0x5')](_0xc756f5);}catch(_0x4a51fa){return![];}}function getOperatorValue(_0x136f56){var _0x5656d8=JSON[_0x16e7('0x6')](_0x136f56);var _0x312846=Object[_0x16e7('0x4')](_0x5656d8)[0x0];var _0x5749f5=_0x5656d8[_0x312846];return{['$'+_0x312846]:_0x5749f5};}function parseIncludeModel(_0x146575){var _0x4e3cf3=JSON['parse'](_0x146575);return{'model':db[_0x4e3cf3['model']],'as':_0x4e3cf3[_0x16e7('0x7')],'attributes':_0x4e3cf3[_0x16e7('0x8')],'raw':_0x4e3cf3[_0x16e7('0x9')]};}exports[_0x16e7('0x8')]=function(_0x4f49a3){var _0x43a809=null;if(_0x4f49a3){_0x43a809=_0x4f49a3[_0x16e7('0xa')](',');}return _0x43a809;};exports[_0x16e7('0xb')]=function(_0x20ceec,_0x287bec){var _0x41c120={};if(!_[_0x16e7('0xc')](_0x20ceec)){_[_0x16e7('0xd')](_0x20ceec,function(_0x35173a,_0x5796c3){try{if(_0x287bec){var _0x481c56=_[_0x16e7('0xe')](_0x287bec,{'name':_0x5796c3})||{};if(hasSequelizeOperator(_0x35173a)){_0x41c120[_0x5796c3]=getOperatorValue(_0x35173a);}else if(_0x481c56[_0x16e7('0xf')]===_0x16e7('0x10')&&_[_0x16e7('0x11')](_0x35173a)){var _0x2e2af7=JSON[_0x16e7('0x6')](_0x35173a);var _0x49cf2e={'$gte':moment(moment(_0x2e2af7[_0x16e7('0x12')])[_0x16e7('0x13')](_0x16e7('0x14')))[_0x16e7('0x15')]()[_0x16e7('0x13')](),'$lte':moment(moment(_0x2e2af7[_0x16e7('0x16')])[_0x16e7('0x13')]('YYYY-MM-DD'))[_0x16e7('0x15')]()[_0x16e7('0x17')](0x1,'s')[_0x16e7('0x13')]()};_0x41c120[_0x5796c3]=_0x49cf2e;}else if(_0x481c56[_0x16e7('0x18')]===_0x16e7('0x19')){_0x41c120[_0x5796c3]=_0x35173a;}else{_0x41c120[_0x5796c3]=_['isArray'](_0x35173a)?_0x35173a:JSON[_0x16e7('0x6')](_0x35173a);}}else{_0x41c120[_0x5796c3]=_[_0x16e7('0x1a')](_0x35173a)?_0x35173a:JSON[_0x16e7('0x6')](_0x35173a);}}catch(_0x18194c){_0x41c120[_0x5796c3]=_0x35173a[_0x16e7('0xa')](',');}});}return _0x41c120;};exports[_0x16e7('0x1b')]=function(_0x636a64){_0x636a64=parseInt(_0x636a64,0xa);if(!_0x636a64||_0x636a64<0x0){_0x636a64=LIMIT_VALUE;}return _0x636a64;};exports[_0x16e7('0x1c')]=function(_0x35f7b1){_0x35f7b1=parseInt(_0x35f7b1,0xa);if(!_0x35f7b1||_0x35f7b1<0x0){_0x35f7b1=0x0;}return _0x35f7b1;};exports[_0x16e7('0x1d')]=function(_0x124ebb){var _0x16274b,_0xdc9969=null;if(_0x124ebb){_0x16274b=_0x124ebb[_0x16e7('0xa')](',');_0xdc9969=_[_0x16e7('0x1e')](_0x16274b,function(_0x1cc8b2){if(_0x1cc8b2['indexOf']('-')===0x0){return[_0x1cc8b2===_0x16e7('0x1f')?sequelize['cast'](sequelize[_0x16e7('0x20')](_0x16e7('0x1f')),_0x16e7('0x21')):_0x1cc8b2['substr'](0x1),'DESC'];}else{return[_0x1cc8b2===_0x16e7('0x1f')?sequelize['cast'](sequelize[_0x16e7('0x20')]('priority'),_0x16e7('0x21')):_0x1cc8b2,_0x16e7('0x22')];}});}return _0xdc9969;};exports[_0x16e7('0x23')]=function(_0x2358d2,_0x4b118a){if(_[_0x16e7('0xc')](_0x2358d2)){return _0x2358d2;}if(_['isArray'](_0x2358d2)){for(var _0x315677=0x0;_0x315677<_0x2358d2['length'];_0x315677+=0x1){_0x2358d2[_0x315677]=this[_0x16e7('0x23')](_0x2358d2[_0x315677],_0x4b118a);}return _0x2358d2;}if(!_[_0x16e7('0x24')](_0x2358d2)){return _0x2358d2;}if(_[_0x16e7('0x25')](_0x4b118a)){_0x4b118a=[_0x4b118a];}if(!_[_0x16e7('0x1a')](_0x4b118a)){return _0x2358d2;}for(var _0x1177fd=0x0;_0x1177fd<_0x4b118a[_0x16e7('0x26')];_0x1177fd+=0x1){_[_0x16e7('0x27')](_0x2358d2,_0x4b118a[_0x1177fd]);}for(var _0x1df0a0 in _0x2358d2){if(_0x2358d2[_0x16e7('0x28')](_0x1df0a0)){_0x2358d2[_0x1df0a0]=this[_0x16e7('0x23')](_0x2358d2[_0x1df0a0],_0x4b118a);}}return _0x2358d2;};exports[_0x16e7('0x29')]=function(_0x5d2791){return _0x5d2791['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x2f0aa0){return _0x2f0aa0['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x16e7('0x2a')]=function(_0x52d507,_0x71b9eb){var _0x108e1f=[];var _0x475caa=/([^:]")"+/g;var _0x455728=/[*<>~@-]/g;var _0x323a25=/[ `!@#$%^&*()_\-?~<>]/;var _0x14a41c=/[ ,]+/;var _0x3d570e=_0x71b9eb?'\x22{EXPR}\x22':_0x16e7('0x2b');if(_0x71b9eb){_0x52d507=_0x52d507[_0x16e7('0x2c')](_0x455728,'\x20')[_0x16e7('0x2d')]();}_0x52d507[_0x16e7('0xa')](_0x14a41c)[_0x16e7('0x2e')](function(_0x4f0a96){_0x4f0a96=_0x4f0a96[_0x16e7('0x2c')](_0x475caa,'$1');_0x4f0a96='+'+_0x4f0a96+'*';var _0x2b6d09=_0x4f0a96[_0x16e7('0x2f')](_0x323a25);if(_0x2b6d09){_0x4f0a96='\x22'+_0x4f0a96+'\x22';}_0x108e1f[_0x16e7('0x30')](_0x4f0a96);});_0x3d570e=_0x3d570e[_0x16e7('0x2c')](_0x16e7('0x2b'),_0x108e1f[_0x16e7('0x31')]('\x20'));return _0x3d570e;};exports[_0x16e7('0x32')]=function(_0x38af57,_0x33e3c6,_0x533d37){var _0x29c3c4={},_0x4f7caf={};if(_0x33e3c6['query']['$id']){_0x33e3c6['query']['id']=_0x33e3c6[_0x16e7('0x33')][_0x16e7('0x34')];delete _0x33e3c6['query']['$id'];}_0x29c3c4[_0x16e7('0x35')]=_[_0x16e7('0x1e')](_0x38af57,'name');_0x29c3c4['query']=_[_0x16e7('0x4')](_0x33e3c6[_0x16e7('0x33')]);_0x29c3c4[_0x16e7('0xb')]=_[_0x16e7('0x36')](_0x29c3c4['model'],_0x29c3c4['query']);_0x4f7caf[_0x16e7('0x37')]=_[_0x16e7('0x36')](_0x29c3c4[_0x16e7('0x35')],this[_0x16e7('0x8')](_0x33e3c6['query'][_0x16e7('0x8')]));_0x4f7caf['attributes']=_0x4f7caf[_0x16e7('0x37')][_0x16e7('0x26')]?_0x4f7caf[_0x16e7('0x37')]:_0x29c3c4['model'];if(!_0x33e3c6[_0x16e7('0x33')][_0x16e7('0x28')](_0x16e7('0x38'))){_0x4f7caf[_0x16e7('0x1b')]=this[_0x16e7('0x1b')](_0x33e3c6[_0x16e7('0x33')][_0x16e7('0x1b')]);_0x4f7caf['offset']=this[_0x16e7('0x1c')](_0x33e3c6[_0x16e7('0x33')]['offset']);}_0x4f7caf['order']=this[_0x16e7('0x1d')](_0x33e3c6[_0x16e7('0x33')][_0x16e7('0x1d')]);_0x4f7caf[_0x16e7('0x39')]=this['filters'](_[_0x16e7('0x3a')](_0x33e3c6[_0x16e7('0x33')],_0x29c3c4[_0x16e7('0xb')]),_0x38af57);if(_0x33e3c6[_0x16e7('0x33')][_0x16e7('0x3b')]){var _0x36590a=_0x38af57;var _0xc09390=_0x33e3c6[_0x16e7('0x33')]['filter'];if(typeof _0xc09390==='object'){_0x36590a=_[_0x16e7('0x3b')](_0x38af57,function(_0x51183e){return _['includes'](_0xc09390[_0x16e7('0x3c')],_0x51183e[_0x16e7('0x18')]);});_0xc09390=_0xc09390['value'];}_0x4f7caf[_0x16e7('0x39')]=_[_0x16e7('0x3d')](_0x4f7caf['where'],{'$or':_[_0x16e7('0x1e')](_0x36590a,function(_0x516902){if(_0x516902['type']!=='VIRTUAL'){if(_0x533d37){return sequelize[_0x16e7('0x39')](sequelize['fn']('lower',sequelize[_0x16e7('0x20')](_0x516902[_0x16e7('0x18')])),{'$like':sequelize['fn'](_0x16e7('0x3e'),'%'+_0x33e3c6['query'][_0x16e7('0x3b')]+'%')});}else{var _0x568bfc={};_0x568bfc[_0x516902[_0x16e7('0x18')]]={'$like':'%'+_0x33e3c6[_0x16e7('0x33')][_0x16e7('0x3b')]+'%'};return _0x568bfc;}}})});}_0x4f7caf=_[_0x16e7('0x3d')]({},_0x4f7caf,_0x33e3c6[_0x16e7('0x3f')]);return _0x4f7caf;};exports[_0x16e7('0x40')]=function(_0x3de70c){var _0x5561ae=[];if(_0x3de70c[_0x16e7('0x41')]){_0x5561ae[_0x16e7('0x30')]({'all':!![]});}else if(_0x3de70c[_0x16e7('0x40')]){if(Array[_0x16e7('0x1a')](_0x3de70c['include'])){_0x5561ae=Object[_0x16e7('0x4')](_0x3de70c[_0x16e7('0x40')])[_0x16e7('0x1e')](function(_0x4c4c1b){return parseIncludeModel(_0x3de70c[_0x16e7('0x40')][_0x4c4c1b]);});}else{var _0x2ba77c=parseIncludeModel(_0x3de70c['include']);_0x5561ae['push'](_0x2ba77c);}}return _0x5561ae;};exports[_0x16e7('0x42')]=function(_0x51a5b3){return _0x51a5b3[_0x16e7('0x2c')](/[%_^-]/g,function(_0xb15320){return'\x5c'+_0xb15320;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 7859b9a..b4e9346 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57c3=['isNil','voiceStatus','pause','chatStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','error','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','busy','isArray','startCase','Queue','map','findOne','getAgents','all','then','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','findAll','name','fullname','mailPause','pauseType','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','substring','indexOf','sort','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','internal','address','chatPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','faxStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','online','omit','pick','filterAgentAttributes','role','openchannelCurrentCapacity','destconnectedlinenum','onhold','screenrecording','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','http','faxPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing'];(function(_0x91e5da,_0x25ce34){var _0x5533f3=function(_0x15b980){while(--_0x15b980){_0x91e5da['push'](_0x91e5da['shift']());}};_0x5533f3(++_0x25ce34);}(_0x57c3,0xc2));var _0x357c=function(_0xdf0e77,_0x375be8){_0xdf0e77=_0xdf0e77-0x0;var _0x1524ee=_0x57c3[_0xdf0e77];return _0x1524ee;};'use strict';var _=require(_0x357c('0x0'));var jayson=require(_0x357c('0x1'));var db=require(_0x357c('0x2'))['db'];var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson['client'][_0x357c('0x3')]({'port':0x232c});function isAgentPaused(_0x1b6624,_0x2aef77){var _0x1ecca6=[_0x1b6624['chatPause'],_0x1b6624[_0x357c('0x4')],_0x1b6624['mailPause'],_0x1b6624[_0x357c('0x5')],_0x1b6624[_0x357c('0x6')],_0x1b6624[_0x357c('0x7')],_0x1b6624[_0x357c('0x8')]];if(!_0x2aef77)return _[_0x357c('0x9')](_0x1ecca6);var _0x1e4977=_[_0x357c('0xa')](_0x1ecca6);return _0x1e4977['length']>0x0&&_0x1e4977[_0x357c('0xb')]<_0x1ecca6[_0x357c('0xb')]?!![]:![];}function isIdle(_0x214216){return _0x214216===_0x357c('0xc')||_0x214216===_0x357c('0xd')||_0x214216===_0x357c('0xe')||_0x214216===_0x357c('0xf')||_[_0x357c('0x10')](_0x214216);}function isAgentIdle(_0xd4399f){if(_0xd4399f[_0x357c('0x11')]!==_0x357c('0xc')&&_0xd4399f[_0x357c('0x7')]){_0xd4399f['voiceStatus']=_0x357c('0x12');return![];}return _[_0x357c('0x9')]([_0xd4399f[_0x357c('0x13')],_0xd4399f['faxStatus'],_0xd4399f['mailStatus'],_0xd4399f[_0x357c('0x14')],_0xd4399f[_0x357c('0x15')],_0xd4399f[_0x357c('0x11')],_0xd4399f[_0x357c('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x357c('0x17')](_0x357c('0x18'),{})['then'](function(_0x25de41){if(_0x25de41[_0x357c('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x590f6d=_0x25de41[_0x357c('0x1a')];return routingClient[_0x357c('0x17')](_0x357c('0x18'),{})['then'](function(_0x21d0f9){if(_0x21d0f9[_0x357c('0x19')]){throw new Error(_0x357c('0x1b'));}var _0x34b058=_0x21d0f9[_0x357c('0x1a')];return _[_0x357c('0x1c')]({},_0x590f6d,_0x34b058);});})[_0x357c('0x1d')](function(_0x25622d){throw _0x25622d;});}exports[_0x357c('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x5da9b1){var _0x147b66=_0x357c('0xd');if(isAgentPaused(_0x5da9b1))_0x147b66='pause';else if(isAgentPaused(_0x5da9b1,!![]))_0x147b66='*pause';else if(isAgentIdle(_0x5da9b1))_0x147b66=_0x357c('0xc');else _0x147b66=_0x357c('0x1f');return _0x147b66;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x437762,_0x1e6c7f){var _0x5e7f32=_[_0x357c('0x20')](_0x437762)?_0x437762:[_0x437762];var _0x336b14=_[_0x357c('0x21')](_0x1e6c7f)+_0x357c('0x22');var _0x324bff=_[_0x357c('0x23')](_0x5e7f32,function(_0x328dfc){return db[_0x336b14][_0x357c('0x24')]({'where':{'id':_0x328dfc}})['then'](function(_0x563fee){if(!_0x563fee)return[];return _0x563fee[_0x357c('0x25')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x357c('0x26')](_0x324bff)[_0x357c('0x27')](function(_0x1c5c51){var _0x22fbff=_(_0x1c5c51)['flatten']()[_0x357c('0x23')]('id')['uniq']()[_0x357c('0x28')]();return _0x22fbff;});}exports[_0x357c('0x29')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x95e7b5,_0x5f4a8a,_0x11dc9c){try{if(_0x5f4a8a[_0x357c('0xb')]>0x0){_0x95e7b5=_0x95e7b5[_0x357c('0xa')](function(_0x42a97a){return _0x5f4a8a[_0x357c('0x2a')](_0x42a97a['id']);});}var _0x3125be=_0x95e7b5[_0x357c('0xa')](function(_0x1ea128){var _0x542bc1=_0x357c('0x1f');if(isAgentIdle(_0x1ea128)){_0x542bc1=_0x357c('0xc');}return _0x542bc1===_0x11dc9c;});return _[_0x357c('0x23')](_0x3125be,'id');}catch(_0x4e9ea0){throw _0x4e9ea0;}}exports[_0x357c('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x51b7f4,_0x396740,_0x859a04){return Promise[_0x357c('0x2c')]()[_0x357c('0x27')](function(){if(_0x396740[_0x357c('0xb')]>0x0){_0x51b7f4=_0x51b7f4[_0x357c('0xa')](function(_0x3122b1){return _0x396740[_0x357c('0x2a')](_0x3122b1['id']);});}return _0x51b7f4;})[_0x357c('0x27')](function(){return db[_0x357c('0x2d')][_0x357c('0x2e')]({'attributes':['id',_0x357c('0x2f'),_0x357c('0x30'),'chatPause',_0x357c('0x4'),_0x357c('0x31'),'openchannelPause',_0x357c('0x6'),_0x357c('0x7'),_0x357c('0x8'),_0x357c('0x32')],'where':{'id':{'$in':_[_0x357c('0x23')](_0x51b7f4,'id')}},'raw':!![]});})[_0x357c('0x27')](function(_0x4e4294){return _0x4e4294[_0x357c('0x23')](function(_0x3f20a3){var _0x2e5f02=_['find'](_0x51b7f4,['id',_0x3f20a3['id']]);var _0x102170=filterAgentAttributes(_0x2e5f02);_[_0x357c('0x1c')](_0x3f20a3,_0x102170);_0x3f20a3[_0x357c('0x33')]=getAgentStatus(_0x3f20a3);return _0x3f20a3;});})['then'](function(_0x5115c9){var _0x2f0984=sortAgentsByStatus(_0x5115c9,_0x859a04);return _[_0x357c('0x23')](_0x2f0984,'id');})[_0x357c('0x1d')](function(_0x572c07){throw _0x572c07;});}exports[_0x357c('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x4c62cd){var _0x426365={'fields':[],'order':null};var _0x123fc8=_0x4c62cd[_0x357c('0x35')](',');_0x426365[_0x357c('0x36')]=_[_0x357c('0xa')](_0x123fc8,function(_0x48ede7){if(!_0x48ede7[_0x357c('0x2a')](_0x357c('0x33'))){return!![];}_0x426365[_0x357c('0x37')]=_[_0x357c('0x38')](_0x48ede7,'-')?_0x357c('0x39'):_0x357c('0x3a');return![];});return _0x426365;}exports[_0x357c('0x3b')]=getUpdatedSortOptions;function validateSortParameter(_0x14596c){if(!_0x14596c){_0x14596c=_0x357c('0x3c');}if(_0x14596c['includes'](_0x357c('0x30'))&&!_0x14596c[_0x357c('0x2a')]('internal')){var _0x23d3de=_0x14596c[_0x357c('0x3d')](0x0,_0x14596c[_0x357c('0x3e')](_0x357c('0x30')));_0x14596c+=','+_0x23d3de+'internal';}return _0x14596c;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x43ae61,_0x1a94a1){var _0xee2bd4=_0x43ae61[_0x357c('0x3f')](function(_0x5ad4a9,_0x3b08be){if(_0x5ad4a9[_0x357c('0x33')]===_0x3b08be['globalStatus']){if(_0x5ad4a9[_0x357c('0x33')]===_0x357c('0x12')){if(_0x1a94a1==='DESC'){return(_0x5ad4a9[_0x357c('0x32')]||'')<(_0x3b08be[_0x357c('0x32')]||'')||_0x5ad4a9['fullname'][_0x357c('0x40')]()>_0x3b08be[_0x357c('0x30')]['toLowerCase']()?0x1:-0x1;}else{return(_0x5ad4a9[_0x357c('0x32')]||'')<(_0x3b08be[_0x357c('0x32')]||'')||_0x5ad4a9[_0x357c('0x30')][_0x357c('0x40')]()>_0x3b08be[_0x357c('0x30')][_0x357c('0x40')]()?-0x1:0x1;}}else{if(_0x1a94a1===_0x357c('0x39')){return _0x5ad4a9[_0x357c('0x30')][_0x357c('0x40')]()<_0x3b08be[_0x357c('0x30')][_0x357c('0x40')]()?0x1:-0x1;}else{return _0x5ad4a9[_0x357c('0x30')]['toLowerCase']()<_0x3b08be[_0x357c('0x30')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x1a94a1===_0x357c('0x39')){return _0x5ad4a9['globalStatus']<_0x3b08be[_0x357c('0x33')]?0x1:-0x1;}else{return _0x5ad4a9[_0x357c('0x33')]<_0x3b08be[_0x357c('0x33')]?-0x1:0x1;}}});return _0xee2bd4;}exports[_0x357c('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x4a8185){var _0x521a20=[_0x357c('0x42'),'online',_0x357c('0x43'),'lastPauseAt','pauseType',_0x357c('0x44'),_0x357c('0x45'),_0x357c('0x46'),_0x357c('0x47'),_0x357c('0x5'),_0x357c('0x31'),'smsPause',_0x357c('0x8'),'faxPause',_0x357c('0x7'),_0x357c('0x48'),_0x357c('0x49'),_0x357c('0x4a'),_0x357c('0x4b'),_0x357c('0x4c'),_0x357c('0x4d'),_0x357c('0x4e'),'openchannelCurrentCapacity',_0x357c('0x4f'),_0x357c('0x50'),_0x357c('0x51'),_0x357c('0x52'),_0x357c('0x13'),'openchannelStatus',_0x357c('0x53'),_0x357c('0x15'),'whatsappStatus',_0x357c('0x54'),_0x357c('0x11'),_0x357c('0x55'),_0x357c('0x56'),_0x357c('0x57'),_0x357c('0x58'),_0x357c('0x59'),_0x357c('0x5a'),_0x357c('0x5b'),_0x357c('0x5c'),'destconnectedlinenum','screenrecording',_0x357c('0x5d'),_0x357c('0x5e')];var _0x6b2ca7=[_0x357c('0x47'),_0x357c('0x5'),'mailPause',_0x357c('0x6'),_0x357c('0x8'),'faxPause',_0x357c('0x7'),_0x357c('0x5f')];var _0x2adc87=_(_0x4a8185)[_0x357c('0x60')](_0x6b2ca7)[_0x357c('0x61')](_0x521a20)['value']();return _0x2adc87;}exports[_0x357c('0x62')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x357c('0x2f'),'fullname',_0x357c('0x63'),_0x357c('0x45'),'online',_0x357c('0x33'),_0x357c('0x42'),_0x357c('0x43'),_0x357c('0x32'),_0x357c('0x44'),_0x357c('0x4'),'chatPause','mailPause',_0x357c('0x5'),_0x357c('0x6'),_0x357c('0x7'),_0x357c('0x8'),_0x357c('0x13'),_0x357c('0x54'),'mailStatus',_0x357c('0x14'),_0x357c('0x15'),_0x357c('0x11'),_0x357c('0x16'),_0x357c('0x55'),_0x357c('0x5a'),_0x357c('0x57'),_0x357c('0x56'),_0x357c('0x58'),_0x357c('0x5b'),_0x357c('0x59'),_0x357c('0x48'),_0x357c('0x4d'),_0x357c('0x4a'),_0x357c('0x49'),_0x357c('0x4b'),'whatsappCapacity',_0x357c('0x4e'),_0x357c('0x52'),'mailCurrentCapacity',_0x357c('0x64'),_0x357c('0x50'),_0x357c('0x51'),_0x357c('0x5d'),_0x357c('0x5e'),_0x357c('0x65'),_0x357c('0x66'),_0x357c('0x5c'),_0x357c('0x67')];}exports[_0x357c('0x68')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x5ed9=['jayson/promise','client','http','chatPause','mailPause','smsPause','voicePause','whatsappPause','every','filter','length','unknown','ringing','isNil','voiceStatus','idle','pause','mailStatus','openchannelStatus','smsStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','value','getAgentIdsByQueues','includes','User','name','fullname','openchannelPause','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','fullname,internal','internal','substring','indexOf','sort','DESC','pauseType','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','faxPause','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','whatsappStatus','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','screenrecording','phoneBarEnableAutomaticScreenRecording','omit','pick','filterAgentAttributes','role','online','chatCapacity','destconnectedlinenum','onhold','queue','getRealtimeAgentsQueryFields','lodash'];(function(_0x25b8b1,_0xe0b951){var _0x2d04f7=function(_0x1a45b8){while(--_0x1a45b8){_0x25b8b1['push'](_0x25b8b1['shift']());}};_0x2d04f7(++_0xe0b951);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5ed9[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x95ed('0x0'));var jayson=require(_0x95ed('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x95ed('0x2')][_0x95ed('0x3')]({'port':0x232a});var routingClient=jayson[_0x95ed('0x2')][_0x95ed('0x3')]({'port':0x232c});function isAgentPaused(_0x5a9572,_0x3cb5d1){var _0x991cf8=[_0x5a9572[_0x95ed('0x4')],_0x5a9572['faxPause'],_0x5a9572[_0x95ed('0x5')],_0x5a9572['openchannelPause'],_0x5a9572[_0x95ed('0x6')],_0x5a9572[_0x95ed('0x7')],_0x5a9572[_0x95ed('0x8')]];if(!_0x3cb5d1)return _[_0x95ed('0x9')](_0x991cf8);var _0x46ed43=_[_0x95ed('0xa')](_0x991cf8);return _0x46ed43['length']>0x0&&_0x46ed43[_0x95ed('0xb')]<_0x991cf8[_0x95ed('0xb')]?!![]:![];}function isIdle(_0x295fd7){return _0x295fd7==='idle'||_0x295fd7===_0x95ed('0xc')||_0x295fd7==='unavailable'||_0x295fd7===_0x95ed('0xd')||_[_0x95ed('0xe')](_0x295fd7);}function isAgentIdle(_0x2d4091){if(_0x2d4091[_0x95ed('0xf')]!==_0x95ed('0x10')&&_0x2d4091['voicePause']){_0x2d4091['voiceStatus']=_0x95ed('0x11');return![];}return _[_0x95ed('0x9')]([_0x2d4091['chatStatus'],_0x2d4091['faxStatus'],_0x2d4091[_0x95ed('0x12')],_0x2d4091[_0x95ed('0x13')],_0x2d4091[_0x95ed('0x14')],_0x2d4091[_0x95ed('0xf')],_0x2d4091['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x95ed('0x15')](_0x95ed('0x16'),{})[_0x95ed('0x17')](function(_0x597a04){if(_0x597a04[_0x95ed('0x18')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x23c63f=_0x597a04['result'];return routingClient['request']('Agents',{})[_0x95ed('0x17')](function(_0x58fb9e){if(_0x58fb9e[_0x95ed('0x18')]){throw new Error(_0x95ed('0x19'));}var _0x4ad26d=_0x58fb9e[_0x95ed('0x1a')];return _[_0x95ed('0x1b')]({},_0x23c63f,_0x4ad26d);});})[_0x95ed('0x1c')](function(_0x2a8dc3){throw _0x2a8dc3;});}exports[_0x95ed('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x41efe4){var _0x2d427e=_0x95ed('0xc');if(isAgentPaused(_0x41efe4))_0x2d427e=_0x95ed('0x11');else if(isAgentPaused(_0x41efe4,!![]))_0x2d427e=_0x95ed('0x1e');else if(isAgentIdle(_0x41efe4))_0x2d427e='idle';else _0x2d427e=_0x95ed('0x1f');return _0x2d427e;}exports[_0x95ed('0x20')]=getAgentStatus;function getAgentIdsByQueues(_0x4e8a5d,_0x5d5afe){var _0x54c5ae=_[_0x95ed('0x21')](_0x4e8a5d)?_0x4e8a5d:[_0x4e8a5d];var _0x226a60=_[_0x95ed('0x22')](_0x5d5afe)+_0x95ed('0x23');var _0x2c0824=_[_0x95ed('0x24')](_0x54c5ae,function(_0x3ef74c){return db[_0x226a60][_0x95ed('0x25')]({'where':{'id':_0x3ef74c}})[_0x95ed('0x17')](function(_0x3bcb6d){if(!_0x3bcb6d)return[];return _0x3bcb6d[_0x95ed('0x26')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x95ed('0x27')](_0x2c0824)[_0x95ed('0x17')](function(_0x25b1fc){var _0x51ca8b=_(_0x25b1fc)[_0x95ed('0x28')]()['map']('id')['uniq']()[_0x95ed('0x29')]();return _0x51ca8b;});}exports[_0x95ed('0x2a')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x45e403,_0x3096ad,_0x2d5042){try{if(_0x3096ad[_0x95ed('0xb')]>0x0){_0x45e403=_0x45e403[_0x95ed('0xa')](function(_0x190620){return _0x3096ad[_0x95ed('0x2b')](_0x190620['id']);});}var _0x3f3ed9=_0x45e403[_0x95ed('0xa')](function(_0x3a8841){var _0x5c3a7f=_0x95ed('0x1f');if(isAgentIdle(_0x3a8841)){_0x5c3a7f=_0x95ed('0x10');}return _0x5c3a7f===_0x2d5042;});return _['map'](_0x3f3ed9,'id');}catch(_0x28c738){throw _0x28c738;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x5365ae,_0x5d550a,_0x5ecbb5){return Promise['resolve']()[_0x95ed('0x17')](function(){if(_0x5d550a[_0x95ed('0xb')]>0x0){_0x5365ae=_0x5365ae[_0x95ed('0xa')](function(_0x20f565){return _0x5d550a[_0x95ed('0x2b')](_0x20f565['id']);});}return _0x5365ae;})[_0x95ed('0x17')](function(){return db[_0x95ed('0x2c')]['findAll']({'attributes':['id',_0x95ed('0x2d'),_0x95ed('0x2e'),_0x95ed('0x4'),'faxPause','mailPause',_0x95ed('0x2f'),'smsPause','voicePause','whatsappPause','pauseType'],'where':{'id':{'$in':_[_0x95ed('0x24')](_0x5365ae,'id')}},'raw':!![]});})['then'](function(_0x15c1b5){return _0x15c1b5[_0x95ed('0x24')](function(_0x519598){var _0x57c2e2=_['find'](_0x5365ae,['id',_0x519598['id']]);var _0x4e9c3d=filterAgentAttributes(_0x57c2e2);_['merge'](_0x519598,_0x4e9c3d);_0x519598[_0x95ed('0x30')]=getAgentStatus(_0x519598);return _0x519598;});})[_0x95ed('0x17')](function(_0x3a2fe0){var _0x32a95f=sortAgentsByStatus(_0x3a2fe0,_0x5ecbb5);return _[_0x95ed('0x24')](_0x32a95f,'id');})[_0x95ed('0x1c')](function(_0x564410){throw _0x564410;});}exports[_0x95ed('0x31')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0xa6dc11){var _0x46aa73={'fields':[],'order':null};var _0x5218a3=_0xa6dc11[_0x95ed('0x32')](',');_0x46aa73[_0x95ed('0x33')]=_[_0x95ed('0xa')](_0x5218a3,function(_0x2170c5){if(!_0x2170c5[_0x95ed('0x2b')](_0x95ed('0x30'))){return!![];}_0x46aa73[_0x95ed('0x34')]=_[_0x95ed('0x35')](_0x2170c5,'-')?'DESC':'ASC';return![];});return _0x46aa73;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x2b6292){if(!_0x2b6292){_0x2b6292=_0x95ed('0x36');}if(_0x2b6292[_0x95ed('0x2b')](_0x95ed('0x2e'))&&!_0x2b6292[_0x95ed('0x2b')](_0x95ed('0x37'))){var _0x4b9e16=_0x2b6292[_0x95ed('0x38')](0x0,_0x2b6292[_0x95ed('0x39')](_0x95ed('0x2e')));_0x2b6292+=','+_0x4b9e16+'internal';}return _0x2b6292;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x284948,_0x17ee3f){var _0x2dfae2=_0x284948[_0x95ed('0x3a')](function(_0x3754a7,_0x5c4c54){if(_0x3754a7['globalStatus']===_0x5c4c54[_0x95ed('0x30')]){if(_0x3754a7[_0x95ed('0x30')]===_0x95ed('0x11')){if(_0x17ee3f===_0x95ed('0x3b')){return(_0x3754a7['pauseType']||'')<(_0x5c4c54[_0x95ed('0x3c')]||'')||_0x3754a7['fullname'][_0x95ed('0x3d')]()>_0x5c4c54[_0x95ed('0x2e')][_0x95ed('0x3d')]()?0x1:-0x1;}else{return(_0x3754a7['pauseType']||'')<(_0x5c4c54[_0x95ed('0x3c')]||'')||_0x3754a7[_0x95ed('0x2e')][_0x95ed('0x3d')]()>_0x5c4c54['fullname']['toLowerCase']()?-0x1:0x1;}}else{if(_0x17ee3f===_0x95ed('0x3b')){return _0x3754a7['fullname'][_0x95ed('0x3d')]()<_0x5c4c54['fullname'][_0x95ed('0x3d')]()?0x1:-0x1;}else{return _0x3754a7[_0x95ed('0x2e')][_0x95ed('0x3d')]()<_0x5c4c54[_0x95ed('0x2e')][_0x95ed('0x3d')]()?-0x1:0x1;}}}else{if(_0x17ee3f==='DESC'){return _0x3754a7[_0x95ed('0x30')]<_0x5c4c54[_0x95ed('0x30')]?0x1:-0x1;}else{return _0x3754a7[_0x95ed('0x30')]<_0x5c4c54['globalStatus']?-0x1:0x1;}}});return _0x2dfae2;}exports[_0x95ed('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0x5e8c88){var _0x9cac30=[_0x95ed('0x3f'),'online',_0x95ed('0x40'),_0x95ed('0x41'),'pauseType','lastPauseAt',_0x95ed('0x37'),'address',_0x95ed('0x4'),'openchannelPause',_0x95ed('0x5'),_0x95ed('0x6'),_0x95ed('0x8'),_0x95ed('0x42'),_0x95ed('0x7'),'chatCapacity',_0x95ed('0x43'),_0x95ed('0x44'),_0x95ed('0x45'),_0x95ed('0x46'),_0x95ed('0x47'),_0x95ed('0x48'),_0x95ed('0x49'),_0x95ed('0x4a'),_0x95ed('0x4b'),_0x95ed('0x4c'),_0x95ed('0x4d'),_0x95ed('0x4e'),_0x95ed('0x13'),'mailStatus',_0x95ed('0x14'),_0x95ed('0x4f'),'faxStatus',_0x95ed('0xf'),'chatStatusTime',_0x95ed('0x50'),_0x95ed('0x51'),_0x95ed('0x52'),_0x95ed('0x53'),_0x95ed('0x54'),_0x95ed('0x55'),'queue','destconnectedlinenum',_0x95ed('0x56'),'phoneBarEnableScreenRecordingByAgent',_0x95ed('0x57')];var _0xeed7e9=['chatPause',_0x95ed('0x2f'),_0x95ed('0x5'),_0x95ed('0x6'),_0x95ed('0x8'),'faxPause','voicePause','online'];var _0xa0e671=_(_0x5e8c88)[_0x95ed('0x58')](_0xeed7e9)[_0x95ed('0x59')](_0x9cac30)[_0x95ed('0x29')]();return _0xa0e671;}exports[_0x95ed('0x5a')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x95ed('0x2d'),'fullname',_0x95ed('0x5b'),_0x95ed('0x37'),_0x95ed('0x5c'),_0x95ed('0x30'),_0x95ed('0x3f'),'lastLoginAt','pauseType',_0x95ed('0x41'),_0x95ed('0x42'),'chatPause','mailPause',_0x95ed('0x2f'),_0x95ed('0x6'),_0x95ed('0x7'),'whatsappPause','chatStatus','faxStatus',_0x95ed('0x12'),'openchannelStatus',_0x95ed('0x14'),_0x95ed('0xf'),_0x95ed('0x4f'),'chatStatusTime',_0x95ed('0x54'),_0x95ed('0x51'),_0x95ed('0x50'),_0x95ed('0x52'),_0x95ed('0x55'),_0x95ed('0x53'),_0x95ed('0x5d'),'faxCapacity',_0x95ed('0x44'),_0x95ed('0x43'),_0x95ed('0x45'),'whatsappCapacity','chatCurrentCapacity',_0x95ed('0x4d'),'mailCurrentCapacity',_0x95ed('0x49'),_0x95ed('0x4b'),_0x95ed('0x4c'),'phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording',_0x95ed('0x5e'),_0x95ed('0x5f'),_0x95ed('0x60'),_0x95ed('0x56')];}exports[_0x95ed('0x61')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 5ff8523..23fd500 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fcc=['format','catch','voice','inbound','concat','outbound','map','get','paused','merge','initializeQueues','lodash','jayson/promise','util','http','loggedIn','waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','talking','unavailable','unknown','pTalking','originated','statusMessage','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','request','startCase','Queues','then','error'];(function(_0x1dcb08,_0x3e1c1b){var _0x180b7e=function(_0x55ab9e){while(--_0x55ab9e){_0x1dcb08['push'](_0x1dcb08['shift']());}};_0x180b7e(++_0x3e1c1b);}(_0x4fcc,0x73));var _0xc4fc=function(_0x36c34f,_0x3c2730){_0x36c34f=_0x36c34f-0x0;var _0x17e054=_0x4fcc[_0x36c34f];return _0x17e054;};'use strict';var _=require(_0xc4fc('0x0'));var jayson=require(_0xc4fc('0x1'));var util=require(_0xc4fc('0x2'));var amiClient=jayson['client'][_0xc4fc('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0xc4fc('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0xc4fc('0x4'),'paused',_0xc4fc('0x5')];var VOICE_QUEUE_ATTRIBUTES=[_0xc4fc('0x6'),_0xc4fc('0x7'),_0xc4fc('0x8'),_0xc4fc('0x9'),_0xc4fc('0xa'),_0xc4fc('0xb'),_0xc4fc('0xc'),'ringInUse',_0xc4fc('0xd'),_0xc4fc('0xe'),_0xc4fc('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xc4fc('0x10'),_0xc4fc('0x11'),'message',_0xc4fc('0x12'),_0xc4fc('0x13'),_0xc4fc('0x14'),'Trunk',_0xc4fc('0x15'),_0xc4fc('0x16'),_0xc4fc('0x17'),_0xc4fc('0x18'),_0xc4fc('0x19'),_0xc4fc('0x1a'),'dialPredictiveInterval',_0xc4fc('0x1b'),_0xc4fc('0x1c'),_0xc4fc('0x1d'),_0xc4fc('0x1e'),_0xc4fc('0x1f'),_0xc4fc('0x20'),_0xc4fc('0x21'),_0xc4fc('0x22'),_0xc4fc('0x23')];function getRealtimeQueues(_0xb0cdf,_0x44d670){var _0x1b9bfb=_0x44d670==='voice'?amiClient:routingClient;return _0x1b9bfb[_0xc4fc('0x24')](_[_0xc4fc('0x25')](_0x44d670)+_0xc4fc('0x26'),_0xb0cdf)[_0xc4fc('0x27')](function(_0x13c0c8){if(_0x13c0c8[_0xc4fc('0x28')])throw new Error(util[_0xc4fc('0x29')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x44d670));return _0x13c0c8['result'];})[_0xc4fc('0x2a')](function(_0x13f6e1){throw _0x13f6e1;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x44b415,_0x5180f5,_0x198d32,_0x5d46f2){var _0x114959=DEFAULT_QUEUE_ATTRIBUTES;if(_0x198d32===_0xc4fc('0x2b')){if(_0x5d46f2===_0xc4fc('0x2c')){_0x114959=_0x114959[_0xc4fc('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x5d46f2===_0xc4fc('0x2e')){_0x114959=_0x114959['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x44b415[_0xc4fc('0x2f')](function(_0x3b1fc3){var _0x1a9a4e=_0x3b1fc3[_0xc4fc('0x30')]({'plain':!![]});_0x1a9a4e[_0xc4fc('0x31')]=0x0;_0x1a9a4e[_0xc4fc('0x9')]=0x0;_0x1a9a4e[_0xc4fc('0x4')]=0x0;_0x1a9a4e['available']=0x0;_0x1a9a4e['waiting']=0x0;if(_0x198d32==='voice'){_0x1a9a4e[_0xc4fc('0xd')]=0x0;_0x1a9a4e[_0xc4fc('0x6')]=0x0;if(_0x5d46f2==='outbound'){_0x1a9a4e['pTalking']=0x0;_0x1a9a4e[_0xc4fc('0x11')]=0x0;}}var _0xee03dd=_['find'](_0x5180f5,['id',_0x1a9a4e['id']]);if(_0xee03dd){_[_0xc4fc('0x32')](_0x1a9a4e,_['pick'](_0xee03dd,_0x114959));}return _0x1a9a4e;});}exports[_0xc4fc('0x33')]=initializeQueues; \ No newline at end of file +var _0x1358=['get','loggedInDb','outbound','merge','pick','initializeQueues','lodash','jayson/promise','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','notInUse','onHold','ringing','talking','unavailable','unknown','pTalking','originated','message','dialActive','Trunk','startPredictive','startProgressive','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','request','startCase','Queues','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','voice','inbound','concat','map'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x1358,0x6c));var _0x8135=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x1358[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x8135('0x0'));var jayson=require(_0x8135('0x1'));var util=require('util');var amiClient=jayson[_0x8135('0x2')][_0x8135('0x3')]({'port':0x232a});var routingClient=jayson[_0x8135('0x2')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x8135('0x4'),_0x8135('0x5'),_0x8135('0x6'),_0x8135('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x8135('0x8'),_0x8135('0x9'),_0x8135('0xa'),'loggedInDb',_0x8135('0xb'),_0x8135('0xc'),_0x8135('0xd'),'ringInUse',_0x8135('0xe'),_0x8135('0xf'),_0x8135('0x10')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x8135('0x11'),_0x8135('0x12'),_0x8135('0x13'),'statusMessage',_0x8135('0x14'),'dialMethod',_0x8135('0x15'),_0x8135('0x16'),_0x8135('0x17'),'erlangCalls','erlangCallToSecond',_0x8135('0x18'),_0x8135('0x19'),_0x8135('0x1a'),'dialPredictiveIntervalMaxThreshold',_0x8135('0x1b'),'predictiveIntervalAvailable',_0x8135('0x1c'),_0x8135('0x1d'),_0x8135('0x1e'),_0x8135('0x1f'),_0x8135('0x20'),_0x8135('0x21')];function getRealtimeQueues(_0x3b8c72,_0x34e799){var _0x190ecf=_0x34e799==='voice'?amiClient:routingClient;return _0x190ecf[_0x8135('0x22')](_[_0x8135('0x23')](_0x34e799)+_0x8135('0x24'),_0x3b8c72)['then'](function(_0x25de32){if(_0x25de32[_0x8135('0x25')])throw new Error(util[_0x8135('0x26')](_0x8135('0x27'),_0x34e799));return _0x25de32[_0x8135('0x28')];})['catch'](function(_0x1edd81){throw _0x1edd81;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x3d1f2d,_0x1fc72f,_0x2ec6dd,_0x3d7fe3){var _0x58cb50=DEFAULT_QUEUE_ATTRIBUTES;if(_0x2ec6dd===_0x8135('0x29')){if(_0x3d7fe3===_0x8135('0x2a')){_0x58cb50=_0x58cb50[_0x8135('0x2b')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x3d7fe3==='outbound'){_0x58cb50=_0x58cb50['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x3d1f2d[_0x8135('0x2c')](function(_0x2f508a){var _0x57c0b7=_0x2f508a[_0x8135('0x2d')]({'plain':!![]});_0x57c0b7[_0x8135('0x6')]=0x0;_0x57c0b7[_0x8135('0x2e')]=0x0;_0x57c0b7['loggedIn']=0x0;_0x57c0b7['available']=0x0;_0x57c0b7[_0x8135('0x7')]=0x0;if(_0x2ec6dd===_0x8135('0x29')){_0x57c0b7[_0x8135('0xe')]=0x0;_0x57c0b7[_0x8135('0x8')]=0x0;if(_0x3d7fe3===_0x8135('0x2f')){_0x57c0b7[_0x8135('0x11')]=0x0;_0x57c0b7[_0x8135('0x12')]=0x0;}}var _0x16f6ac=_['find'](_0x1fc72f,['id',_0x57c0b7['id']]);if(_0x16f6ac){_[_0x8135('0x30')](_0x57c0b7,_[_0x8135('0x31')](_0x16f6ac,_0x58cb50));}return _0x57c0b7;});}exports[_0x8135('0x32')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index b13622e..217c74b 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x4f8b73,_0x499742){var _0x4ae551=function(_0x11fc3e){while(--_0x11fc3e){_0x4f8b73['push'](_0x4f8b73['shift']());}};_0x4ae551(++_0x499742);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x4baae3,_0x5f0235){var _0x454819=function(_0x4359ff){while(--_0x4359ff){_0x4baae3['push'](_0x4baae3['shift']());}};_0x454819(++_0x5f0235);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 4606388..31e3bfa 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 _0x5ca5=['filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','createHash','md5','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy'];(function(_0x3acb03,_0x148bf6){var _0x53e1ce=function(_0x56e402){while(--_0x56e402){_0x3acb03['push'](_0x3acb03['shift']());}};_0x53e1ce(++_0x148bf6);}(_0x5ca5,0xa2));var _0x55ca=function(_0x30a3bb,_0x9fdc34){_0x30a3bb=_0x30a3bb-0x0;var _0xe098b=_0x5ca5[_0x30a3bb];return _0xe098b;};'use strict';var _=require(_0x55ca('0x0'));var os=require('os');var crypto=require(_0x55ca('0x1'));var machine=require(_0x55ca('0x2'));var exec=require(_0x55ca('0x3'))[_0x55ca('0x4')];var config=require(_0x55ca('0x5'));function getInterfaces(){var _0x23e621=[];var _0x4fb1d3=os[_0x55ca('0x6')]();var _0x349c9a=_[_0x55ca('0x7')](_['keys'](_0x4fb1d3));for(var _0x419e52=0x0;_0x419e52<_0x349c9a['length'];_0x419e52++){var _0x1e9faf=_0x4fb1d3[_0x349c9a[_0x419e52]][_0x55ca('0x8')](function(_0x35bbc7){return _0x35bbc7[_0x55ca('0x9')]===_0x55ca('0xa')&&_0x35bbc7[_0x55ca('0xb')]===![];});_0x23e621=_0x23e621[_0x55ca('0xc')](_0x1e9faf);}return _0x23e621;}function getFirstInterface(){var _0x21f5e8=_[_0x55ca('0xd')](getInterfaces());return{'macAddress':_0x21f5e8&&_0x21f5e8[_0x55ca('0xe')]?_0x21f5e8[_0x55ca('0xe')]:_0x55ca('0xf'),'ipAddress':_0x21f5e8&&_0x21f5e8[_0x55ca('0x10')]?_0x21f5e8['address']:_0x55ca('0x11')};}exports[_0x55ca('0x12')]=getFirstInterface;function getCPUhash(){var _0x2a867b=_[_0x55ca('0x7')](os[_0x55ca('0x13')]()[_0x55ca('0x14')](function(_0x3b879e){return _0x3b879e['model'];}))['join'](':');return crypto[_0x55ca('0x15')](_0x55ca('0x16'))['update'](_0x2a867b)[_0x55ca('0x17')](_0x55ca('0x18'));}exports[_0x55ca('0x19')]=function(){var _0x267a33=os[_0x55ca('0x1a')]();var _0x3ade33=/[0-9a-f-]{36}/;if(config[_0x55ca('0x1b')]&&_0x3ade33[_0x55ca('0x1c')](config[_0x55ca('0x1b')])){return config[_0x55ca('0x1b')];}else if(_0x267a33===_0x55ca('0x1d')){return exec(_0x55ca('0x1e'),{'encoding':_0x55ca('0x1f')})['replace']('\x0d\x0a','');}else{var _0x3a6c57=getFirstInterface();var _0x5a048c=getCPUhash();var _0x58041d=_0x5a048c+'|'+os['hostname']()+'|'+_0x3a6c57['macAddress']+'|'+_0x3a6c57[_0x55ca('0x20')];var _0x5d7010=crypto[_0x55ca('0x15')]('md5')['update'](_0x58041d)[_0x55ca('0x17')](_0x55ca('0x18'));return _0x5d7010[_0x55ca('0x21')](0x0,0x8)+'-'+_0x5d7010[_0x55ca('0x21')](0x8,0xc)+'-'+_0x5d7010['substring'](0xc,0x10)+'-'+_0x5d7010[_0x55ca('0x21')](0x10,0x14)+'-'+_0x5d7010[_0x55ca('0x21')](0x14);}}; \ No newline at end of file +var _0x0297=['utf8','replace','hostname','macAddress','update','digest','substring','lodash','crypto','child_process','execSync','../environment','networkInterfaces','orderBy','keys','filter','IPv4','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','join','createHash','md5','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid'];(function(_0x168cab,_0x1b0292){var _0x437052=function(_0x416c01){while(--_0x416c01){_0x168cab['push'](_0x168cab['shift']());}};_0x437052(++_0x1b0292);}(_0x0297,0xdf));var _0x7029=function(_0x31544d,_0xc3624f){_0x31544d=_0x31544d-0x0;var _0x514218=_0x0297[_0x31544d];return _0x514218;};'use strict';var _=require(_0x7029('0x0'));var os=require('os');var crypto=require(_0x7029('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x7029('0x2'))[_0x7029('0x3')];var config=require(_0x7029('0x4'));function getInterfaces(){var _0x944594=[];var _0x5d5fda=os[_0x7029('0x5')]();var _0x32511d=_[_0x7029('0x6')](_[_0x7029('0x7')](_0x5d5fda));for(var _0x51f086=0x0;_0x51f086<_0x32511d['length'];_0x51f086++){var _0x42811b=_0x5d5fda[_0x32511d[_0x51f086]][_0x7029('0x8')](function(_0x2ccffa){return _0x2ccffa['family']===_0x7029('0x9')&&_0x2ccffa['internal']===![];});_0x944594=_0x944594[_0x7029('0xa')](_0x42811b);}return _0x944594;}function getFirstInterface(){var _0x210ae8=_[_0x7029('0xb')](getInterfaces());return{'macAddress':_0x210ae8&&_0x210ae8[_0x7029('0xc')]?_0x210ae8['mac']:_0x7029('0xd'),'ipAddress':_0x210ae8&&_0x210ae8[_0x7029('0xe')]?_0x210ae8['address']:_0x7029('0xf')};}exports[_0x7029('0x10')]=getFirstInterface;function getCPUhash(){var _0x514b56=_['orderBy'](os[_0x7029('0x11')]()['map'](function(_0x39cb02){return _0x39cb02[_0x7029('0x12')];}))[_0x7029('0x13')](':');return crypto[_0x7029('0x14')](_0x7029('0x15'))['update'](_0x514b56)['digest'](_0x7029('0x16'));}exports[_0x7029('0x17')]=function(){var _0x45ce29=os[_0x7029('0x18')]();var _0x25a021=/[0-9a-f-]{36}/;if(config[_0x7029('0x19')]&&_0x25a021[_0x7029('0x1a')](config['licenseToken'])){return config['licenseToken'];}else if(_0x45ce29===_0x7029('0x1b')){return exec(_0x7029('0x1c'),{'encoding':_0x7029('0x1d')})[_0x7029('0x1e')]('\x0d\x0a','');}else{var _0x2e57d8=getFirstInterface();var _0xe61a60=getCPUhash();var _0x235499=_0xe61a60+'|'+os[_0x7029('0x1f')]()+'|'+_0x2e57d8[_0x7029('0x20')]+'|'+_0x2e57d8['ipAddress'];var _0x4720fb=crypto['createHash'](_0x7029('0x15'))[_0x7029('0x21')](_0x235499)[_0x7029('0x22')]('hex');return _0x4720fb[_0x7029('0x23')](0x0,0x8)+'-'+_0x4720fb[_0x7029('0x23')](0x8,0xc)+'-'+_0x4720fb[_0x7029('0x23')](0xc,0x10)+'-'+_0x4720fb[_0x7029('0x23')](0x10,0x14)+'-'+_0x4720fb[_0x7029('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 14a6308..f24e5cf 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 _0x48df=['exports','GET','catch','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','pkginfo','version','../../mysqldb','./hardware','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s'];(function(_0x1b69aa,_0x5aa147){var _0x42647d=function(_0x1743fd){while(--_0x1743fd){_0x1b69aa['push'](_0x1b69aa['shift']());}};_0x42647d(++_0x5aa147);}(_0x48df,0x1a2));var _0xf48d=function(_0x34ad72,_0x1e43f6){_0x34ad72=_0x34ad72-0x0;var _0x5c9aa8=_0x48df[_0x34ad72];return _0x5c9aa8;};'use strict';var util=require(_0xf48d('0x0'));var moment=require(_0xf48d('0x1'));var rp=require(_0xf48d('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0xf48d('0x3'))(module,_0xf48d('0x4'));var db=require(_0xf48d('0x5'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xf48d('0x6'));var logger=require('../logger')(_0xf48d('0x7'));var HOST=_0xf48d('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x55543b){return new BPromise(function(_0x4cbc79,_0x2b43e0){var _0x245c76=util[_0xf48d('0x9')](_0xf48d('0xa'),HOST,_0x55543b,module[_0xf48d('0xb')][_0xf48d('0x4')]);if(oldToken){_0x245c76=util[_0xf48d('0x9')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x55543b,module[_0xf48d('0xb')][_0xf48d('0x4')],oldToken);}var _0x4d9a43={'uri':_0x245c76,'method':_0xf48d('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x4d9a43)['then'](function(_0x60db2d){_0x4cbc79(_0x60db2d);})[_0xf48d('0xd')](function(_0x57196e){_0x2b43e0(_0x57196e);});});}function manageLicense(_0x1e0b16,_0x3767bb){var _0x21b4a2=_0x3767bb['get']({'plain':!![]});if(!isOldTokenSent&&_0x21b4a2[_0xf48d('0xe')]!==_0x1e0b16&&!_0x21b4a2[_0xf48d('0xf')]){oldToken=_0x21b4a2[_0xf48d('0xe')];}httpRequest(_0x1e0b16)['then'](function(_0x549a0c){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x549a0c[_0xf48d('0x10')]){isOldTokenSent=![];if(!_0x21b4a2['license']&&_0x21b4a2[_0xf48d('0x7')]!=_0x549a0c[_0xf48d('0x7')]||_0x21b4a2[_0xf48d('0x7')]&&_0x21b4a2[_0xf48d('0xf')]){logger[_0xf48d('0x11')](_0xf48d('0x12'));}if(_0x21b4a2[_0xf48d('0x7')]&&!_0x21b4a2[_0xf48d('0xf')]&&_0x21b4a2['license']!=_0x549a0c[_0xf48d('0x7')]){logger[_0xf48d('0x11')](_0xf48d('0x13'));}if(_0x21b4a2[_0xf48d('0x7')]&&!_0x21b4a2[_0xf48d('0xf')]&&_0x21b4a2[_0xf48d('0x7')]==_0x549a0c[_0xf48d('0x7')]){return _0x3767bb;}return _0x3767bb[_0xf48d('0x14')]({'data1':_0x1e0b16,'data2':null,'license':_0x549a0c[_0xf48d('0x7')]});}else{if(_0x549a0c[_0xf48d('0x7')]||_0x21b4a2[_0xf48d('0x7')]){if(!_0x21b4a2[_0xf48d('0xf')]){if(_0x21b4a2['data1']==_0x1e0b16){GRAY_PERIOD_REASON=_0xf48d('0x15');logger[_0xf48d('0x11')](_0xf48d('0x16'));}else{GRAY_PERIOD_REASON=_0xf48d('0x17');logger[_0xf48d('0x11')](_0xf48d('0x18'),_0x21b4a2[_0xf48d('0xe')],_0x1e0b16);}logger[_0xf48d('0x11')](_0xf48d('0x19'),GRAY_PERIOD_REASON['toUpperCase'](),moment()['format'](_0xf48d('0x1a')));return _0x3767bb[_0xf48d('0x14')]({'data2':encryptor[_0xf48d('0x1b')](moment()['format'](_0xf48d('0x1a')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x21b4a2[_0xf48d('0xf')]),_0xf48d('0x1c'))>DAYS){logger[_0xf48d('0x11')](_0xf48d('0x1d'),moment()[_0xf48d('0x9')](_0xf48d('0x1a')));isOldTokenSent=![];return _0x3767bb[_0xf48d('0x14')]({'data1':_0x1e0b16,'data2':null,'license':null});}}}else{if(_0x21b4a2['data1']!=_0x1e0b16){logger[_0xf48d('0x11')](_0xf48d('0x18'),_0x21b4a2[_0xf48d('0xe')],_0x1e0b16);return _0x3767bb[_0xf48d('0x14')]({'data1':_0x1e0b16,'data2':null,'license':null});}}}return _0x3767bb;})['then'](function(_0x4c018f){_0x3767bb=_0x4c018f;})[_0xf48d('0xd')](function(_0x4c378e){logger[_0xf48d('0x1e')](_0x4c378e[_0xf48d('0x1f')]);})[_0xf48d('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0xf48d('0x21')](),_0x3767bb);},TIME);});}function defaultLicense(){var _0x43cf2b=hardware[_0xf48d('0x21')]();if(_0x43cf2b){return db[_0xf48d('0x22')][_0xf48d('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x43cf2b}})[_0xf48d('0x24')](function(_0x27ca90,_0x55000f){logger['info'](_0xf48d('0x25'),_0x43cf2b);manageLicense(_0x43cf2b,_0x27ca90);})['catch'](function(_0x25cffa){logger['error'](_0x25cffa[_0xf48d('0x1f')]);});}}exports[_0xf48d('0x26')]=defaultLicense; \ No newline at end of file +var _0x98b9=['THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','error','message','getUuid','License','findOrCreate','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','license','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','catch','data1','data2','info'];(function(_0x52c0f4,_0x256bb1){var _0x8af134=function(_0xf7d358){while(--_0xf7d358){_0x52c0f4['push'](_0x52c0f4['shift']());}};_0x8af134(++_0x256bb1);}(_0x98b9,0x184));var _0x998b=function(_0x461aff,_0x3f3346){_0x461aff=_0x461aff-0x0;var _0x3c912e=_0x98b9[_0x461aff];return _0x3c912e;};'use strict';var util=require(_0x998b('0x0'));var moment=require(_0x998b('0x1'));var rp=require(_0x998b('0x2'));var BPromise=require(_0x998b('0x3'));var pkginfo=require(_0x998b('0x4'))(module,_0x998b('0x5'));var db=require(_0x998b('0x6'))['db'];var encryptor=require(_0x998b('0x7'));var hardware=require('./hardware');var logger=require('../logger')(_0x998b('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3be849){return new BPromise(function(_0x131c23,_0x4ebf46){var _0x5f0d2e=util[_0x998b('0x9')](_0x998b('0xa'),HOST,_0x3be849,module['exports'][_0x998b('0x5')]);if(oldToken){_0x5f0d2e=util[_0x998b('0x9')](_0x998b('0xb'),HOST,_0x3be849,module[_0x998b('0xc')][_0x998b('0x5')],oldToken);}var _0x321ae9={'uri':_0x5f0d2e,'method':_0x998b('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x321ae9)[_0x998b('0xe')](function(_0x5217a5){_0x131c23(_0x5217a5);})[_0x998b('0xf')](function(_0x16a12f){_0x4ebf46(_0x16a12f);});});}function manageLicense(_0x112aa2,_0x2aab29){var _0x15b955=_0x2aab29['get']({'plain':!![]});if(!isOldTokenSent&&_0x15b955[_0x998b('0x10')]!==_0x112aa2&&!_0x15b955['data2']){oldToken=_0x15b955[_0x998b('0x10')];}httpRequest(_0x112aa2)[_0x998b('0xe')](function(_0x2ec248){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2ec248['active']){isOldTokenSent=![];if(!_0x15b955[_0x998b('0x8')]&&_0x15b955[_0x998b('0x8')]!=_0x2ec248[_0x998b('0x8')]||_0x15b955[_0x998b('0x8')]&&_0x15b955[_0x998b('0x11')]){logger[_0x998b('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x15b955['license']&&!_0x15b955[_0x998b('0x11')]&&_0x15b955[_0x998b('0x8')]!=_0x2ec248[_0x998b('0x8')]){logger[_0x998b('0x12')](_0x998b('0x13'));}if(_0x15b955[_0x998b('0x8')]&&!_0x15b955[_0x998b('0x11')]&&_0x15b955[_0x998b('0x8')]==_0x2ec248[_0x998b('0x8')]){return _0x2aab29;}return _0x2aab29[_0x998b('0x14')]({'data1':_0x112aa2,'data2':null,'license':_0x2ec248[_0x998b('0x8')]});}else{if(_0x2ec248[_0x998b('0x8')]||_0x15b955[_0x998b('0x8')]){if(!_0x15b955[_0x998b('0x11')]){if(_0x15b955[_0x998b('0x10')]==_0x112aa2){GRAY_PERIOD_REASON=_0x998b('0x15');logger[_0x998b('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger[_0x998b('0x12')](_0x998b('0x16'),_0x15b955[_0x998b('0x10')],_0x112aa2);}logger[_0x998b('0x12')](_0x998b('0x17'),GRAY_PERIOD_REASON[_0x998b('0x18')](),moment()[_0x998b('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x2aab29[_0x998b('0x14')]({'data2':encryptor[_0x998b('0x19')](moment()[_0x998b('0x9')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x998b('0x1a')](encryptor[_0x998b('0x1b')](_0x15b955[_0x998b('0x11')]),_0x998b('0x1c'))>DAYS){logger[_0x998b('0x12')](_0x998b('0x1d'),moment()[_0x998b('0x9')](_0x998b('0x1e')));isOldTokenSent=![];return _0x2aab29[_0x998b('0x14')]({'data1':_0x112aa2,'data2':null,'license':null});}}}else{if(_0x15b955[_0x998b('0x10')]!=_0x112aa2){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x15b955['data1'],_0x112aa2);return _0x2aab29['update']({'data1':_0x112aa2,'data2':null,'license':null});}}}return _0x2aab29;})['then'](function(_0x4a797d){_0x2aab29=_0x4a797d;})[_0x998b('0xf')](function(_0x2728dd){logger[_0x998b('0x1f')](_0x2728dd[_0x998b('0x20')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x2aab29);},TIME);});}function defaultLicense(){var _0x1ce823=hardware[_0x998b('0x21')]();if(_0x1ce823){return db[_0x998b('0x22')][_0x998b('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x1ce823}})['spread'](function(_0x262440,_0x5d191b){logger[_0x998b('0x12')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x1ce823);manageLicense(_0x1ce823,_0x262440);})[_0x998b('0xf')](function(_0x20f110){logger[_0x998b('0x1f')](_0x20f110[_0x998b('0x20')]);});}}exports[_0x998b('0x24')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 74359b9..e8576fc 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 _0xceca=['parse','demo','machineUuid','gray','days','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','telephone','users','forEach','user','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','License','find','then','catch','uuid','license','isEmpty','data1','split','decryptString','%s:%s:%s'];(function(_0xcb0e23,_0x1632e2){var _0x5484f2=function(_0x3b936c){while(--_0x3b936c){_0xcb0e23['push'](_0xcb0e23['shift']());}};_0x5484f2(++_0x1632e2);}(_0xceca,0xeb));var _0xacec=function(_0x33d14a,_0x4ae588){_0x33d14a=_0x33d14a-0x0;var _0x184569=_0xceca[_0x33d14a];return _0x184569;};'use strict';var util=require(_0xacec('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require(_0xacec('0x1'));var hardware=require(_0xacec('0x2'));var encryptor=require('../../components/encryptor');var db=require(_0xacec('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xacec('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xacec('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xacec('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xacec('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5b9dfa){return new BPromise(function(_0x59bb31,_0x36223a){return db[_0xacec('0x6')][_0xacec('0x7')](_['defaults'](_0x5b9dfa,{'raw':!![],'where':{'id':0x1}}))[_0xacec('0x8')](function(_0x32733d){return checkLicense(_0x32733d,null);})[_0xacec('0x8')](function(_0x336c1e){_0x59bb31(_0x336c1e);return;})[_0xacec('0x9')](function(_0x501915){_0x36223a(_0x501915);});});}function checkLicense(_0x2bafd0,_0x40644c){if(!_0x2bafd0){demoLicense[_0xacec('0xa')]=_0x2bafd0['data1'];return demoLicense;}try{var _0x9e68e9=_0x40644c||_0x2bafd0[_0xacec('0xb')];if(_[_0xacec('0xc')](_0x9e68e9)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x57ba51=_0x2bafd0[_0xacec('0xd')];var _0x129b4c=_0x2bafd0['data2'];var _0x18cc0=_0x57ba51[_0xacec('0xe')]('-')[0x4];var _0x34ba0b=_0x57ba51[_0xacec('0xe')]('-')[0x0];var _0x541702=encryptor[_0xacec('0xf')](_0x9e68e9,util['format'](_0xacec('0x10'),_0x18cc0,_0x57ba51,_0x34ba0b));var _0x4f7deb=JSON[_0xacec('0x11')](_0x541702);_0x4f7deb[_0xacec('0x12')]=![];_0x4f7deb[_0xacec('0xa')]=_0x57ba51;_0x4f7deb[_0xacec('0x13')]=hardware[_0xacec('0x5')]();if(_0x129b4c){var _0x13a557=encryptor[_0xacec('0xf')](_0x129b4c);_0x4f7deb[_0xacec('0x14')]=_0x13a557;_0x4f7deb['deadline']=moment(_0x13a557)['add'](0x7,_0xacec('0x15'))['format']();_0x4f7deb[_0xacec('0x16')]=_0x4f7deb['uuid']!=_0x4f7deb['machineUuid']?_0xacec('0x17'):_0xacec('0x18');}return _0x4f7deb;}catch(_0x4f8a68){breakingLicense[_0xacec('0xa')]=_0x2bafd0[_0xacec('0xd')];breakingLicense[_0xacec('0x19')]=_0x4f8a68[_0xacec('0x19')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5a8fd2,_0x3094b9){getLicense()[_0xacec('0x8')](function(_0x2e7c2f){return db[_0xacec('0x1a')][_0xacec('0x1b')]({'attributes':[_0xacec('0x1c'),[db[_0xacec('0x1d')]['fn'](_0xacec('0x1e'),db[_0xacec('0x1d')][_0xacec('0x1f')]('role')),_0xacec('0x20')]],'group':_0xacec('0x1c'),'where':{'role':{'$or':[_0xacec('0x21'),'user',_0xacec('0x22')]}},'raw':!![]})[_0xacec('0x8')](function(_0x50fbd3){var _0x50498a={'user':_0x2e7c2f[_0xacec('0x23')]||0x0,'telephone':_0x2e7c2f['telephones']||0x0};_0x50fbd3[_0xacec('0x24')](function(_0x297293){var _0xb3933b=_0x297293[_0xacec('0x1c')]===_0xacec('0x21')?_0xacec('0x25'):_0x297293[_0xacec('0x1c')];_0x50498a[_0xb3933b]-=_0x297293['count'];if(_0x50498a[_0xb3933b]<0x0)_0x50498a[_0xb3933b]=0x0;});_0x5a8fd2(_0x50498a);return;});})['catch'](function(_0x4d467b){_0x3094b9(_0x4d467b);});});}function checkUserLimits(_0x1401a1){return new BPromise(function(_0x2ec1c6,_0x49ed01){getLimits()[_0xacec('0x8')](function(_0x4eb7ac){var _0x1bfa5f=_[_0xacec('0x26')](_[_0xacec('0x27')](_0x1401a1,_0xacec('0x1c')),[_0xacec('0x21'),'user',_0xacec('0x22')]);var _0x238cbf=(_0x1bfa5f[_0xacec('0x21')]||0x0)+(_0x1bfa5f['user']||0x0);var _0x1ed4b7=_0x1bfa5f[_0xacec('0x22')]||0x0;if(_0x238cbf>_0x4eb7ac['user'])return _0x49ed01(_0xacec('0x28'));if(_0x1ed4b7>_0x4eb7ac[_0xacec('0x22')])return _0x49ed01(_0xacec('0x29'));return _0x2ec1c6();})['catch'](function(_0x4057ed){_0x49ed01(_0x4057ed);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x959c=['2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','defaults','then','catch','uuid','license','isEmpty','data2','split','format','parse','demo','machineUuid','decryptString','deadline','add','days','grayReason','changed','disabled','data1','message','User','findAll','sequelize','COUNT','col','role','count','admin','user','telephone','telephones','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor'];(function(_0x5716d5,_0x5150e1){var _0x635f6f=function(_0x4ac572){while(--_0x4ac572){_0x5716d5['push'](_0x5716d5['shift']());}};_0x635f6f(++_0x5150e1);}(_0x959c,0xea));var _0xc959=function(_0x192e06,_0x4aa2a8){_0x192e06=_0x192e06-0x0;var _0x5bc719=_0x959c[_0x192e06];return _0x5bc719;};'use strict';var util=require(_0xc959('0x0'));var _=require(_0xc959('0x1'));var moment=require(_0xc959('0x2'));var BPromise=require(_0xc959('0x3'));var hardware=require(_0xc959('0x4'));var encryptor=require(_0xc959('0x5'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc959('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xc959('0x7'),'machineUuid':hardware[_0xc959('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc959('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xc959('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x53354a){return new BPromise(function(_0x280d61,_0x5900a4){return db[_0xc959('0x9')][_0xc959('0xa')](_[_0xc959('0xb')](_0x53354a,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x47f464){return checkLicense(_0x47f464,null);})[_0xc959('0xc')](function(_0x3c71b4){_0x280d61(_0x3c71b4);return;})[_0xc959('0xd')](function(_0x31833a){_0x5900a4(_0x31833a);});});}function checkLicense(_0x4fe6a8,_0x5bd36c){if(!_0x4fe6a8){demoLicense[_0xc959('0xe')]=_0x4fe6a8['data1'];return demoLicense;}try{var _0x163178=_0x5bd36c||_0x4fe6a8[_0xc959('0xf')];if(_[_0xc959('0x10')](_0x163178)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0xc0541e=_0x4fe6a8['data1'];var _0x1169fe=_0x4fe6a8[_0xc959('0x11')];var _0x29b6e6=_0xc0541e[_0xc959('0x12')]('-')[0x4];var _0x12e4b5=_0xc0541e[_0xc959('0x12')]('-')[0x0];var _0xcf66ee=encryptor['decryptString'](_0x163178,util[_0xc959('0x13')]('%s:%s:%s',_0x29b6e6,_0xc0541e,_0x12e4b5));var _0x5a2cbf=JSON[_0xc959('0x14')](_0xcf66ee);_0x5a2cbf[_0xc959('0x15')]=![];_0x5a2cbf[_0xc959('0xe')]=_0xc0541e;_0x5a2cbf[_0xc959('0x16')]=hardware['getUuid']();if(_0x1169fe){var _0x536333=encryptor[_0xc959('0x17')](_0x1169fe);_0x5a2cbf['gray']=_0x536333;_0x5a2cbf[_0xc959('0x18')]=moment(_0x536333)[_0xc959('0x19')](0x7,_0xc959('0x1a'))[_0xc959('0x13')]();_0x5a2cbf[_0xc959('0x1b')]=_0x5a2cbf[_0xc959('0xe')]!=_0x5a2cbf['machineUuid']?_0xc959('0x1c'):_0xc959('0x1d');}return _0x5a2cbf;}catch(_0x445ada){breakingLicense[_0xc959('0xe')]=_0x4fe6a8[_0xc959('0x1e')];breakingLicense[_0xc959('0x1f')]=_0x445ada[_0xc959('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xc3e509,_0x3a642a){getLicense()['then'](function(_0x29ac7b){return db[_0xc959('0x20')][_0xc959('0x21')]({'attributes':['role',[db[_0xc959('0x22')]['fn'](_0xc959('0x23'),db[_0xc959('0x22')][_0xc959('0x24')](_0xc959('0x25'))),_0xc959('0x26')]],'group':_0xc959('0x25'),'where':{'role':{'$or':[_0xc959('0x27'),_0xc959('0x28'),_0xc959('0x29')]}},'raw':!![]})[_0xc959('0xc')](function(_0xdbc20b){var _0x12c353={'user':_0x29ac7b['users']||0x0,'telephone':_0x29ac7b[_0xc959('0x2a')]||0x0};_0xdbc20b['forEach'](function(_0x5cd56c){var _0x24d062=_0x5cd56c[_0xc959('0x25')]===_0xc959('0x27')?_0xc959('0x28'):_0x5cd56c[_0xc959('0x25')];_0x12c353[_0x24d062]-=_0x5cd56c[_0xc959('0x26')];if(_0x12c353[_0x24d062]<0x0)_0x12c353[_0x24d062]=0x0;});_0xc3e509(_0x12c353);return;});})['catch'](function(_0x7a4dfc){_0x3a642a(_0x7a4dfc);});});}function checkUserLimits(_0x291ab7){return new BPromise(function(_0x28aaac,_0x47bb19){getLimits()['then'](function(_0xd4ccbe){var _0x5c4f7d=_[_0xc959('0x2b')](_[_0xc959('0x2c')](_0x291ab7,'role'),['admin',_0xc959('0x28'),_0xc959('0x29')]);var _0x2153cf=(_0x5c4f7d[_0xc959('0x27')]||0x0)+(_0x5c4f7d[_0xc959('0x28')]||0x0);var _0x2af856=_0x5c4f7d[_0xc959('0x29')]||0x0;if(_0x2153cf>_0xd4ccbe[_0xc959('0x28')])return _0x47bb19(_0xc959('0x2d'));if(_0x2af856>_0xd4ccbe[_0xc959('0x29')])return _0x47bb19(_0xc959('0x2e'));return _0x28aaac();})[_0xc959('0xd')](function(_0x203d71){_0x47bb19(_0x203d71);});});}module[_0xc959('0x2f')]={'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 a6d6f5e..fd08eb2 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 _0x6d11=['http://localhost:9000','myappanuglar-secret','secret','exports'];(function(_0x1aa680,_0x35d302){var _0x5252db=function(_0x2ff9fb){while(--_0x2ff9fb){_0x1aa680['push'](_0x1aa680['shift']());}};_0x5252db(++_0x35d302);}(_0x6d11,0xbf));var _0x16d1=function(_0x41d064,_0x164716){_0x41d064=_0x41d064-0x0;var _0x14267f=_0x6d11[_0x41d064];return _0x14267f;};'use strict';module[_0x16d1('0x0')]={'DOMAIN':_0x16d1('0x1'),'SESSION_SECRET':_0x16d1('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x16d1('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x430c=['exports','app-id','secret'];(function(_0x22e00a,_0x23991a){var _0x13537f=function(_0xbf78b4){while(--_0xbf78b4){_0x22e00a['push'](_0x22e00a['shift']());}};_0x13537f(++_0x23991a);}(_0x430c,0x1a1));var _0xc430=function(_0x380307,_0x440ccd){_0x380307=_0x380307-0x0;var _0x9ea14b=_0x430c[_0x380307];return _0x9ea14b;};'use strict';module[_0xc430('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xc430('0x1'),'GOOGLE_SECRET':_0xc430('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index e37348f..d680f2f 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4cc6=['exports','../utils/loggers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4cc6,0x195));var _0x64cc=function(_0x334599,_0x4b1cfa){_0x334599=_0x334599-0x0;var _0x4cdff2=_0x4cc6[_0x334599];return _0x4cdff2;};'use strict';var fileLogger=require(_0x64cc('0x0'))['fileLogger'];module[_0x64cc('0x1')]=fileLogger; \ No newline at end of file +var _0x8e4f=['exports','../utils/loggers','fileLogger'];(function(_0x2a43b9,_0x2aa7ea){var _0x3b6c90=function(_0x5be37f){while(--_0x5be37f){_0x2a43b9['push'](_0x2a43b9['shift']());}};_0x3b6c90(++_0x2aa7ea);}(_0x8e4f,0xac));var _0xf8e4=function(_0x3c8324,_0x2e94a9){_0x3c8324=_0x3c8324-0x0;var _0x5399f5=_0x8e4f[_0x3c8324];return _0x5399f5;};'use strict';var fileLogger=require(_0xf8e4('0x0'))[_0xf8e4('0x1')];module[_0xf8e4('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index b540343..fd9cb09 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 _0x32da=['email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','exports','join','ami','../../services/agi/index.js'];(function(_0x23d886,_0x313163){var _0x1349e4=function(_0x2cd2be){while(--_0x2cd2be){_0x23d886['push'](_0x23d886['shift']());}};_0x1349e4(++_0x313163);}(_0x32da,0xf9));var _0xa32d=function(_0x127dff,_0x2acb69){_0x127dff=_0x127dff-0x0;var _0x2ed0f9=_0x32da[_0x127dff];return _0x2ed0f9;};'use strict';var path=require('path');var cfg=require('../../config/environment');var env={'NODE_PATH':path['resolve'](path[_0xa32d('0x0')](cfg['root'],'legacy-libs'))};var pm2config={'apps':[{'name':'express','script':path['join'](__dirname,'../../services/express/index.js'),'env':env},{'name':_0xa32d('0x1'),'script':path['join'](__dirname,'../../services/ami/index.js'),'env':env},{'name':'agi','script':path[_0xa32d('0x0')](__dirname,_0xa32d('0x2')),'env':env},{'name':_0xa32d('0x3'),'script':path[_0xa32d('0x0')](__dirname,_0xa32d('0x4')),'env':env},{'name':_0xa32d('0x5'),'script':path[_0xa32d('0x0')](__dirname,_0xa32d('0x6')),'env':env},{'name':_0xa32d('0x7'),'script':path['join'](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0xa32d('0x8')]=pm2config; \ No newline at end of file +var _0x6a35=['ami','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','xdr','exports','path','../../config/environment','join','root','legacy-libs','../../services/express/index.js'];(function(_0x2e3107,_0x25f970){var _0x833d69=function(_0x420e78){while(--_0x420e78){_0x2e3107['push'](_0x2e3107['shift']());}};_0x833d69(++_0x25f970);}(_0x6a35,0x174));var _0x56a3=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x6a35[_0x368fb9];return _0x4892fb;};'use strict';var path=require(_0x56a3('0x0'));var cfg=require(_0x56a3('0x1'));var env={'NODE_PATH':path['resolve'](path[_0x56a3('0x2')](cfg[_0x56a3('0x3')],_0x56a3('0x4')))};var pm2config={'apps':[{'name':'express','script':path[_0x56a3('0x2')](__dirname,_0x56a3('0x5')),'env':env},{'name':_0x56a3('0x6'),'script':path[_0x56a3('0x2')](__dirname,_0x56a3('0x7')),'env':env},{'name':'agi','script':path[_0x56a3('0x2')](__dirname,_0x56a3('0x8')),'env':env},{'name':_0x56a3('0x9'),'script':path[_0x56a3('0x2')](__dirname,_0x56a3('0xa')),'env':env},{'name':_0x56a3('0xb'),'script':path[_0x56a3('0x2')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x56a3('0xc'),'script':path[_0x56a3('0x2')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x56a3('0xd')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index aa79a36..a7f45ff 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 _0x0b49=['dump','pm2','bluebird','connect','connected','start','then','disconnect','restart','list','describe','delete'];(function(_0x28dd46,_0x331653){var _0x1888ac=function(_0x58dc45){while(--_0x58dc45){_0x28dd46['push'](_0x28dd46['shift']());}};_0x1888ac(++_0x331653);}(_0x0b49,0x1a5));var _0x90b4=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x0b49[_0x13b8f3];return _0x1a6d06;};'use strict';var pm2=require(_0x90b4('0x0'));var BPromise=require(_0x90b4('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x1da559,_0x29338a){return pm2[_0x90b4('0x2')](function(_0x16c858){if(_0x16c858){return _0x29338a(_0x16c858);}return _0x1da559(_0x90b4('0x3'));});});};exports[_0x90b4('0x4')]=function(_0x47d94d){return connect()[_0x90b4('0x5')](function(){return new BPromise(function(_0x3cc1c7,_0x182010){return pm2[_0x90b4('0x4')](_0x47d94d,function(_0x3cf62b,_0x1bd2a3){if(_0x3cf62b){return _0x182010(_0x3cf62b);}pm2[_0x90b4('0x6')]();return _0x3cc1c7(_0x1bd2a3);});});});};exports['stop']=function(_0x405d0e){return connect()[_0x90b4('0x5')](function(){return new BPromise(function(_0x56dbec,_0x4fe1ff){return pm2['stop'](_0x405d0e,function(_0x3e4907,_0x479e13){if(_0x3e4907){return _0x4fe1ff(_0x3e4907);}pm2[_0x90b4('0x6')]();return _0x56dbec(_0x479e13);});});});};exports[_0x90b4('0x7')]=function(_0x1f2229){return connect()[_0x90b4('0x5')](function(){return new BPromise(function(_0xf73857,_0x4c4ad8){return pm2[_0x90b4('0x7')](_0x1f2229,function(_0x1c4950,_0x9de983){if(_0x1c4950){return _0x4c4ad8(_0x1c4950);}pm2[_0x90b4('0x6')]();return _0xf73857(_0x9de983);});});});};exports['list']=function(){return connect()[_0x90b4('0x5')](function(){return new BPromise(function(_0x2fb21b,_0xb4b1b7){return pm2[_0x90b4('0x8')](function(_0x1df90f,_0x19f02a){if(_0x1df90f){return _0xb4b1b7(_0x1df90f);}pm2[_0x90b4('0x6')]();return _0x2fb21b(_0x19f02a);});});});};exports[_0x90b4('0x9')]=function(_0x137c4a){return connect()[_0x90b4('0x5')](function(){return new BPromise(function(_0x3cd236,_0x4c707f){return pm2['describe'](_0x137c4a,function(_0x2c4dd4,_0x5d58a1){if(_0x2c4dd4){return _0x4c707f(_0x2c4dd4);}pm2[_0x90b4('0x6')]();return _0x3cd236(_0x5d58a1);});});});};exports[_0x90b4('0xa')]=function(_0x2e4060){return connect()[_0x90b4('0x5')](function(){return new BPromise(function(_0x3b89da,_0x422430){return pm2[_0x90b4('0xa')](_0x2e4060,function(_0x4cc073,_0x274f73){if(_0x4cc073){return _0x422430(_0x4cc073);}pm2[_0x90b4('0x6')]();return _0x3b89da(_0x274f73);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0x38a43c,_0x22f682){return pm2[_0x90b4('0xb')](function(_0x18813){if(_0x18813){return _0x22f682(_0x18813);}return _0x38a43c('saved');});});});}; \ No newline at end of file +var _0x9c71=['describe','delete','dump','saved','pm2','bluebird','./config','connect','connected','start','then','disconnect','stop','restart','list'];(function(_0x32729c,_0xf5afd8){var _0x482cfd=function(_0x231471){while(--_0x231471){_0x32729c['push'](_0x32729c['shift']());}};_0x482cfd(++_0xf5afd8);}(_0x9c71,0x15d));var _0x19c7=function(_0x5eeea9,_0x7951b6){_0x5eeea9=_0x5eeea9-0x0;var _0x3d31ab=_0x9c71[_0x5eeea9];return _0x3d31ab;};'use strict';var pm2=require(_0x19c7('0x0'));var BPromise=require(_0x19c7('0x1'));var config=require(_0x19c7('0x2'));function connect(){return new BPromise(function(_0x260af4,_0x500483){return pm2[_0x19c7('0x3')](function(_0x269a99){if(_0x269a99){return _0x500483(_0x269a99);}return _0x260af4(_0x19c7('0x4'));});});};exports[_0x19c7('0x5')]=function(_0x3328f9){return connect()[_0x19c7('0x6')](function(){return new BPromise(function(_0x3773c6,_0x28a3fd){return pm2[_0x19c7('0x5')](_0x3328f9,function(_0x22dcf4,_0x184347){if(_0x22dcf4){return _0x28a3fd(_0x22dcf4);}pm2[_0x19c7('0x7')]();return _0x3773c6(_0x184347);});});});};exports['stop']=function(_0x48a493){return connect()[_0x19c7('0x6')](function(){return new BPromise(function(_0xd9b72a,_0x1d6b2d){return pm2[_0x19c7('0x8')](_0x48a493,function(_0xa883a8,_0x307372){if(_0xa883a8){return _0x1d6b2d(_0xa883a8);}pm2[_0x19c7('0x7')]();return _0xd9b72a(_0x307372);});});});};exports[_0x19c7('0x9')]=function(_0x5754e4){return connect()[_0x19c7('0x6')](function(){return new BPromise(function(_0x5afe18,_0xbfc973){return pm2['restart'](_0x5754e4,function(_0x686142,_0x3a4a63){if(_0x686142){return _0xbfc973(_0x686142);}pm2[_0x19c7('0x7')]();return _0x5afe18(_0x3a4a63);});});});};exports[_0x19c7('0xa')]=function(){return connect()[_0x19c7('0x6')](function(){return new BPromise(function(_0x3f2038,_0x4288b0){return pm2['list'](function(_0x480767,_0x169492){if(_0x480767){return _0x4288b0(_0x480767);}pm2['disconnect']();return _0x3f2038(_0x169492);});});});};exports[_0x19c7('0xb')]=function(_0x1b9f19){return connect()[_0x19c7('0x6')](function(){return new BPromise(function(_0x156b37,_0x2ca10b){return pm2[_0x19c7('0xb')](_0x1b9f19,function(_0x2f8afa,_0x1fb3fd){if(_0x2f8afa){return _0x2ca10b(_0x2f8afa);}pm2[_0x19c7('0x7')]();return _0x156b37(_0x1fb3fd);});});});};exports[_0x19c7('0xc')]=function(_0x3e77df){return connect()[_0x19c7('0x6')](function(){return new BPromise(function(_0x92fd74,_0x2a1649){return pm2[_0x19c7('0xc')](_0x3e77df,function(_0x5dac95,_0x1b78a5){if(_0x5dac95){return _0x2a1649(_0x5dac95);}pm2[_0x19c7('0x7')]();return _0x92fd74(_0x1b78a5);});});});};exports['dump']=function(){return connect()[_0x19c7('0x6')](function(){return new BPromise(function(_0x57bd32,_0x2cce56){return pm2[_0x19c7('0xd')](function(_0x3948f9){if(_0x3948f9){return _0x2cce56(_0x3948f9);}return _0x57bd32(_0x19c7('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index e70bab5..e74ce65 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 _0x86c6=['schedule','redis','localhost','socket.io-emitter','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','moment','ioredis','util','../../config/environment','../../mysqldb','../logger'];(function(_0x3e372d,_0x430f3b){var _0x53a8af=function(_0x468f1d){while(--_0x468f1d){_0x3e372d['push'](_0x3e372d['shift']());}};_0x53a8af(++_0x430f3b);}(_0x86c6,0xd3));var _0x686c=function(_0x472067,_0x390b86){_0x472067=_0x472067-0x0;var _0x2c6dd9=_0x86c6[_0x472067];return _0x2c6dd9;};'use strict';var _=require('lodash');var moment=require(_0x686c('0x0'));var Redis=require(_0x686c('0x1'));var util=require(_0x686c('0x2'));var config=require(_0x686c('0x3'));var db=require(_0x686c('0x4'))['db'];var logger=require(_0x686c('0x5'))(_0x686c('0x6'));config[_0x686c('0x7')]=_['defaults'](config['redis'],{'host':_0x686c('0x8'),'port':0x18eb});var io=require(_0x686c('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x1e7ddb=0x0;var _0x2744f6=[];return db['Setting']['find']({'raw':!![],'attributes':['id',_0x686c('0xa')],'where':{'id':0x1}})[_0x686c('0xb')](function(_0x1fb80b){_0x1e7ddb=_0x1fb80b[_0x686c('0xa')];if(_0x1e7ddb){return db[_0x686c('0xc')][_0x686c('0xd')]({'raw':!![],'attributes':['id',_0x686c('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x686c('0xf')](_0x1fb80b[_0x686c('0xa')],_0x686c('0x10'))}}});}else{return[];}})['then'](function(_0x460ff0){if(_0x460ff0&&_0x460ff0[_0x686c('0x11')]){_0x2744f6=_[_0x686c('0x12')](_0x460ff0||[],'id');logger[_0x686c('0x13')](_0x686c('0x14'),_0x2744f6[_0x686c('0x15')]());return db[_0x686c('0xc')]['update']({'closeReason':_0x686c('0x16'),'disposition':_0x686c('0x17'),'closed':!![],'closedAt':moment()[_0x686c('0x18')](_0x686c('0x19'))},{'where':{'id':_0x2744f6}});}})[_0x686c('0xb')](function(){if(_0x2744f6&&_0x2744f6['length']){logger[_0x686c('0x13')](_0x686c('0x1a'),_0x2744f6[_0x686c('0x15')]());for(var _0x49b9b6=0x0;_0x49b9b6<_0x2744f6[_0x686c('0x11')];_0x49b9b6++){io['emit'](_0x686c('0x1b'),{'id':_0x2744f6[_0x49b9b6],'closed':!![]});}}})['catch'](function(_0x1a535c){logger[_0x686c('0x1c')](_0x686c('0x1d'),_0x1a535c?util[_0x686c('0x1e')](_0x1a535c,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x8c98=['[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','catch','error','start','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','lastMsgAt','length','map','info'];(function(_0x2edacb,_0x56c7d0){var _0x292220=function(_0x4cad45){while(--_0x4cad45){_0x2edacb['push'](_0x2edacb['shift']());}};_0x292220(++_0x56c7d0);}(_0x8c98,0x19f));var _0x88c9=function(_0x2762fc,_0x4d21a6){_0x2762fc=_0x2762fc-0x0;var _0x1ae50b=_0x8c98[_0x2762fc];return _0x1ae50b;};'use strict';var _=require(_0x88c9('0x0'));var moment=require(_0x88c9('0x1'));var Redis=require(_0x88c9('0x2'));var util=require(_0x88c9('0x3'));var config=require('../../config/environment');var db=require(_0x88c9('0x4'))['db'];var logger=require(_0x88c9('0x5'))(_0x88c9('0x6'));config['redis']=_['defaults'](config[_0x88c9('0x7')],{'host':_0x88c9('0x8'),'port':0x18eb});var io=require(_0x88c9('0x9'))(new Redis(config[_0x88c9('0x7')]));function closeInteractions(){var _0x1a91c9=0x0;var _0x5a3918=[];return db[_0x88c9('0xa')][_0x88c9('0xb')]({'raw':!![],'attributes':['id',_0x88c9('0xc')],'where':{'id':0x1}})[_0x88c9('0xd')](function(_0x5e760e){_0x1a91c9=_0x5e760e[_0x88c9('0xc')];if(_0x1a91c9){return db[_0x88c9('0xe')]['findAll']({'raw':!![],'attributes':['id',_0x88c9('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x5e760e[_0x88c9('0xc')],'minutes')}}});}else{return[];}})[_0x88c9('0xd')](function(_0x53d1ab){if(_0x53d1ab&&_0x53d1ab[_0x88c9('0x10')]){_0x5a3918=_[_0x88c9('0x11')](_0x53d1ab||[],'id');logger[_0x88c9('0x12')](_0x88c9('0x13'),_0x5a3918[_0x88c9('0x14')]());return db[_0x88c9('0xe')][_0x88c9('0x15')]({'closeReason':_0x88c9('0x16'),'disposition':_0x88c9('0x17'),'closed':!![],'closedAt':moment()[_0x88c9('0x18')](_0x88c9('0x19'))},{'where':{'id':_0x5a3918}});}})[_0x88c9('0xd')](function(){if(_0x5a3918&&_0x5a3918[_0x88c9('0x10')]){logger[_0x88c9('0x12')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x5a3918[_0x88c9('0x14')]());for(var _0x28d34a=0x0;_0x28d34a<_0x5a3918[_0x88c9('0x10')];_0x28d34a++){io[_0x88c9('0x1a')](_0x88c9('0x1b'),{'id':_0x5a3918[_0x28d34a],'closed':!![]});}}})[_0x88c9('0x1c')](function(_0x10f7af){logger[_0x88c9('0x1d')]('[CHAT]\x20Error\x20closing\x20interactions',_0x10f7af?util['inspect'](_0x10f7af,{'showHidden':![],'depth':null}):'');});}exports[_0x88c9('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 6585ab6..8376cf6 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b70=['startAllRefreshIntervals','exports'];(function(_0x31b950,_0x48a4e9){var _0x415d87=function(_0x42cb07){while(--_0x42cb07){_0x31b950['push'](_0x31b950['shift']());}};_0x415d87(++_0x48a4e9);}(_0x3b70,0x1ee));var _0x03b7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3b70[_0x2dafbe];return _0x58a45a;};'use strict';function start(){var _0x20fdb0=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x20fdb0[_0x03b7('0x0')]();}module[_0x03b7('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xcf05=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x203416,_0x1de974){var _0x5008c9=function(_0x36de32){while(--_0x36de32){_0x203416['push'](_0x203416['shift']());}};_0x5008c9(++_0x1de974);}(_0xcf05,0x1b3));var _0x5cf0=function(_0xee94ff,_0x2d8b03){_0xee94ff=_0xee94ff-0x0;var _0x361b60=_0xcf05[_0xee94ff];return _0x361b60;};'use strict';function start(){var _0x26b633=require(_0x5cf0('0x0'));return _0x26b633[_0x5cf0('0x1')]();}module[_0x5cf0('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 755a786..9460664 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 _0x0e73=['stop','case\x20failed','Unrecognized\x20status:','dataValues','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','sendMail','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','length','exists','deleteJob','delete\x20cron','toRun','run\x20job','cron','active','startAt','endAt','start','stop\x20cron','isBetween','update','update\x20cron','util','path','lodash','jayson/promise','../logger','schedule','../../mysqldb','retry','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','number','AnalyticExtractedReport','then','catch','error','info','email','MailAccount','\x22%s\x22\x20<%s>','Smtp','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','name','subtractUnit','../../files/reports','savename','%s.%s','basename','zip','join','existsSync','message','attachments','text','status','Sent','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Loading','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','error\x20mail','stringify','email\x20sent','case\x20loading','currentAttempt','retries','job','data','operation','still\x20loading'];(function(_0x5b9715,_0x32e11e){var _0x237f64=function(_0x47d155){while(--_0x47d155){_0x5b9715['push'](_0x5b9715['shift']());}};_0x237f64(++_0x32e11e);}(_0x0e73,0x1bd));var _0x30e7=function(_0x81f000,_0x15df85){_0x81f000=_0x81f000-0x0;var _0x337aa2=_0x0e73[_0x81f000];return _0x337aa2;};'use strict';var fs=require('fs');var util=require(_0x30e7('0x0'));var path=require(_0x30e7('0x1'));var _=require(_0x30e7('0x2'));var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require(_0x30e7('0x3'));var BPromise=require('bluebird');var logger=require(_0x30e7('0x4'))(_0x30e7('0x5'));var db=require(_0x30e7('0x6'))['db'];const retry=require(_0x30e7('0x7'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x30e7('0x8'));var client=jayson[_0x30e7('0x9')][_0x30e7('0xa')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x2bab2c){const _0x106048={};if(typeof _0x2bab2c===_0x30e7('0xb')){_0x106048['id']=_0x2bab2c;}return db[_0x30e7('0xc')]['findOne']({'where':_0x106048})[_0x30e7('0xd')](function(_0x510991){return _0x510991;})[_0x30e7('0xe')](function(_0x20b881){logger[_0x30e7('0xf')](_0x20b881);});}function handleSendEmail(_0x4d70d8,_0xc3c476){logger[_0x30e7('0x10')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x4d70d8[_0x30e7('0x11')]);var _0x182800=!![];var _0x10bcc9=_0x4d70d8[_0x30e7('0x12')]['getSmtpOptions']();var _0xf59eb1={'account':_0x10bcc9,'message':{'from':util['format'](_0x30e7('0x13'),_0x4d70d8[_0x30e7('0x12')]['name'],_0x4d70d8[_0x30e7('0x12')][_0x30e7('0x11')]||_0x4d70d8[_0x30e7('0x12')][_0x30e7('0x14')][_0x30e7('0x15')]),'to':_0x4d70d8[_0x30e7('0x11')],'cc':_0x4d70d8['cc'],'bcc':_0x4d70d8[_0x30e7('0x16')],'subject':util[_0x30e7('0x17')](_0x30e7('0x18'),_0xc3c476[_0x30e7('0x19')],_0x4d70d8['subtractNumber'],_0x4d70d8[_0x30e7('0x1a')])}};var _0x13f58a=path['join'](__dirname,_0x30e7('0x1b'));var _0x1827f9=_0xc3c476[_0x30e7('0x1c')];var _0x43403d=util[_0x30e7('0x17')](_0x30e7('0x1d'),path[_0x30e7('0x1e')](_0xc3c476[_0x30e7('0x1c')],path['extname'](_0xc3c476[_0x30e7('0x1c')])),_0x30e7('0x1f'));var _0x3bd580=path[_0x30e7('0x20')](_0x13f58a,_0x1827f9);var _0xd26627=path[_0x30e7('0x20')](_0x13f58a,_0x43403d);if(fs[_0x30e7('0x21')](_0x3bd580)){_0xc3c476['status']='Sent';_0xf59eb1[_0x30e7('0x22')][_0x30e7('0x23')]=[{'filename':_0x1827f9,'path':_0x3bd580}];_0xf59eb1[_0x30e7('0x22')][_0x30e7('0x24')]=util[_0x30e7('0x17')]('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'](_0xc3c476,null,0x2));}else if(fs[_0x30e7('0x21')](_0xd26627)){_0xc3c476[_0x30e7('0x25')]=_0x30e7('0x26');_0xf59eb1['message'][_0x30e7('0x23')]=[{'filename':_0x43403d,'path':_0xd26627}];}else{if(_0xc3c476[_0x30e7('0x25')]===_0x30e7('0x27')){_0xf59eb1[_0x30e7('0x22')]['text']=_0x30e7('0x28');if(!_0x4d70d8['sendIfEmpty']){_0x182800=![];logger[_0x30e7('0x10')]('empty\x20file,\x20email\x20not\x20sent');}}else if(_0xc3c476['status']===_0x30e7('0x29')){_0xf59eb1[_0x30e7('0x22')][_0x30e7('0x24')]='Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0xc3c476[_0x30e7('0x25')]==='Completed'){_0xf59eb1['message'][_0x30e7('0x24')]=_0x30e7('0x2a');}else if(_0xc3c476[_0x30e7('0x25')]==='Failed'){_0xf59eb1['message']['text']='Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else{logger[_0x30e7('0xf')](_0x30e7('0x2b'),_0xc3c476[_0x30e7('0x25')]);}}if(_0x182800){return client[_0x30e7('0x2c')]('SendMail',_0xf59eb1)[_0x30e7('0xd')](function(_0x1b8072){if(_0x1b8072['error']){return logger[_0x30e7('0xf')](_0x30e7('0x2d'),JSON[_0x30e7('0x2e')](_0x1b8072));}return logger[_0x30e7('0x10')](_0x30e7('0x2f'));})['catch'](function(_0x22b687){return logger[_0x30e7('0xf')](_0x30e7('0x2d'),JSON[_0x30e7('0x2e')](_0x22b687));});}}function handleError(){return function(_0x5c2924){return logger['error'](JSON[_0x30e7('0x2e')](_0x5c2924));};}function loading(_0x1a0f0c){logger[_0x30e7('0x10')](_0x30e7('0x30'));if(_0x1a0f0c[_0x30e7('0x31')]===_0x1a0f0c['retryOptions'][_0x30e7('0x32')]){handleSendEmail(_0x1a0f0c[_0x30e7('0x33')],_0x1a0f0c[_0x30e7('0x34')]);_0x1a0f0c[_0x30e7('0x35')]['stop']();}else{_0x1a0f0c[_0x30e7('0x35')][_0x30e7('0x7')](_0x30e7('0x36'));}}function completed(_0x496371){logger[_0x30e7('0x10')]('case\x20completed');handleSendEmail(_0x496371[_0x30e7('0x33')],_0x496371[_0x30e7('0x34')]);_0x496371[_0x30e7('0x35')]['stop']();}function empty(_0x16d5a6){logger[_0x30e7('0x10')]('case\x20empty');handleSendEmail(_0x16d5a6[_0x30e7('0x33')],_0x16d5a6['data']);_0x16d5a6[_0x30e7('0x35')][_0x30e7('0x37')]();}function failed(_0x4f5e4a){logger[_0x30e7('0x10')](_0x30e7('0x38'));handleSendEmail(_0x4f5e4a[_0x30e7('0x33')],_0x4f5e4a[_0x30e7('0x34')]);_0x4f5e4a[_0x30e7('0x35')][_0x30e7('0x37')]();}function urecognized(_0x1f7a46){logger[_0x30e7('0xf')](_0x30e7('0x39'),_0x1f7a46['entity'][_0x30e7('0x3a')][_0x30e7('0x25')]);_0x1f7a46['operation'][_0x30e7('0x37')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x419ba2,_0x340d95){const _0x1f2ab1={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x1fc2fa=retry[_0x30e7('0x35')](_0x1f2ab1);_0x1fc2fa['attempt'](_0x5d7a4a=>{logger[_0x30e7('0x10')](_0x30e7('0x3b')+_0x419ba2['id']+_0x30e7('0x3c')+_0x5d7a4a);try{getReportData(_0x340d95['id'])[_0x30e7('0xd')](function(_0x49d570){_0x340d95=_0x49d570;logger['info'](_0x30e7('0x3d'),_0x49d570[_0x30e7('0x3a')]['status']);if(!reportStatusStrategies[_0x49d570[_0x30e7('0x3a')]['status']]){logger[_0x30e7('0xf')](_0x30e7('0x3d'),_0x49d570[_0x30e7('0x3a')][_0x30e7('0x25')]);_0x1fc2fa[_0x30e7('0x7')]();}reportStatusStrategies[_0x49d570[_0x30e7('0x3a')][_0x30e7('0x25')]]({'operation':_0x1fc2fa,'currentAttempt':_0x5d7a4a,'retryOptions':_0x1f2ab1,'job':_0x419ba2,'data':_0x340d95,'entity':_0x49d570});});}catch(_0x381289){_0x1fc2fa[_0x30e7('0x7')](_0x381289);}});}function handleResult(_0x19f142){return function(_0x1d90be){if(_0x19f142[_0x30e7('0x3e')]&&_0x19f142[_0x30e7('0x12')]&&_0x19f142[_0x30e7('0x12')][_0x30e7('0x14')]&&!_[_0x30e7('0x3f')](_0x19f142[_0x30e7('0x11')])){retryer(_0x19f142,_0x1d90be);}};}function handleJob(_0x58b7a4){return function(){try{if(_[_0x30e7('0x3f')](_0x58b7a4[_0x30e7('0x40')])){return logger[_0x30e7('0x10')](_0x30e7('0x41'));}if(_[_0x30e7('0x3f')](_0x58b7a4[_0x30e7('0x1a')])){return logger[_0x30e7('0x10')](_0x30e7('0x42'));}var _0x440349={'startDate':moment()[_0x30e7('0x43')](_0x58b7a4[_0x30e7('0x40')],_0x58b7a4['subtractUnit'])[_0x30e7('0x17')](_0x30e7('0x44')),'endDate':moment()['format'](_0x30e7('0x44')),'type':_0x30e7('0x45'),'output':_0x58b7a4[_0x30e7('0x46')],'name':_0x58b7a4[_0x30e7('0x19')]};if(!_[_0x30e7('0x3f')](_0x58b7a4['DefaultReportId'])){logger[_0x30e7('0x10')](_0x30e7('0x47'),_0x58b7a4[_0x30e7('0x48')]);return analyticDefaultReportController[_0x30e7('0x49')]({'id':_0x58b7a4['DefaultReportId']},_0x440349)[_0x30e7('0xd')](handleResult(_0x58b7a4))[_0x30e7('0xe')](handleError());}if(!_['isNil'](_0x58b7a4[_0x30e7('0x4a')])){logger[_0x30e7('0x10')](_0x30e7('0x4b'),_0x58b7a4[_0x30e7('0x4a')]);return analyticCustomReportController['runReport']({'id':_0x58b7a4['CustomReportId']},_0x440349)['then'](handleResult(_0x58b7a4))[_0x30e7('0xe')](handleError());}}catch(_0x3efb38){logger[_0x30e7('0xf')](JSON[_0x30e7('0x2e')](_0x3efb38));}return logger[_0x30e7('0x10')]('no\x20report\x20id');};}function getJobs(_0x1e512a){var _0x4e979b={};if(_0x1e512a){_0x4e979b['id']=_0x1e512a;}return db['Schedule'][_0x30e7('0x4c')]({'where':_0x4e979b,'include':[{'model':db[_0x30e7('0x12')],'attributes':['id',_0x30e7('0x19'),_0x30e7('0x11')],'include':[{'model':db[_0x30e7('0x4d')],'as':_0x30e7('0x14'),'include':[{'model':db[_0x30e7('0x4e')],'as':_0x30e7('0x4e')}]}]}]})[_0x30e7('0xd')](function(_0x517bfe){var _0x35d2d1=_[_0x30e7('0x4f')](manager[_0x30e7('0x50')]);var _0x4d92f6=_[_0x30e7('0x51')](_0x517bfe,function(_0x5dc32b){return _0x5dc32b['id'][_0x30e7('0x52')]();});var _0x166f6b=_[_0x30e7('0x53')](_0x517bfe,function(_0x3523d1){return _0x3523d1['id'][_0x30e7('0x52')]();});var _0x4d6fdf=_0x1e512a?_0x4d92f6:_[_0x30e7('0x54')](_0x4d92f6,_0x35d2d1);var _0x1712d9=_['intersection'](_0x4d92f6,_0x35d2d1);var _0x250636=_['difference'](_0x35d2d1,_0x4d92f6);var _0x1b3792;var _0x3c7751;for(_0x1b3792=0x0;_0x1b3792<_0x250636[_0x30e7('0x55')]&&!_0x1e512a;_0x1b3792+=0x1){_0x3c7751=_0x250636[_0x1b3792][_0x30e7('0x52')]();if(manager[_0x30e7('0x56')](_0x3c7751)){manager['stop'](_0x3c7751);manager[_0x30e7('0x57')](_0x3c7751);logger[_0x30e7('0x10')](_0x30e7('0x58'),_0x3c7751);}}logger[_0x30e7('0x10')](_0x30e7('0x59'),JSON[_0x30e7('0x2e')](_0x4d6fdf));for(_0x1b3792=0x0;_0x1b3792<_0x4d6fdf[_0x30e7('0x55')];_0x1b3792+=0x1){_0x3c7751=_0x4d6fdf[_0x1b3792][_0x30e7('0x52')]();if(_0x1e512a){logger[_0x30e7('0x10')](JSON[_0x30e7('0x2e')](_0x166f6b[_0x3c7751]));BPromise['resolve']()['then'](handleJob(_0x166f6b[_0x3c7751]));logger[_0x30e7('0x10')](_0x30e7('0x5a'),_0x166f6b[_0x3c7751][_0x30e7('0x19')],_0x166f6b[_0x3c7751]['cron']);}else if(_0x166f6b[_0x3c7751][_0x30e7('0x5b')]&&_0x166f6b[_0x3c7751][_0x30e7('0x5c')]&&moment()['isBetween'](_0x166f6b[_0x3c7751][_0x30e7('0x5d')],_0x166f6b[_0x3c7751][_0x30e7('0x5e')])){manager['add'](_0x3c7751,_0x166f6b[_0x3c7751][_0x30e7('0x5b')],handleJob(_0x166f6b[_0x3c7751]));manager[_0x30e7('0x5f')](_0x3c7751);logger[_0x30e7('0x10')]('add\x20cron',_0x166f6b[_0x3c7751][_0x30e7('0x19')],_0x166f6b[_0x3c7751][_0x30e7('0x5b')]);}else if(manager['exists'](_0x3c7751)){manager[_0x30e7('0x37')](_0x3c7751);manager[_0x30e7('0x57')](_0x3c7751);logger[_0x30e7('0x10')](_0x30e7('0x60'),_0x166f6b[_0x3c7751][_0x30e7('0x19')],_0x166f6b[_0x3c7751]['cron']);}}for(_0x1b3792=0x0,_0x3c7751;_0x1b3792<_0x1712d9[_0x30e7('0x55')]&&!_0x1e512a;_0x1b3792+=0x1){_0x3c7751=_0x1712d9[_0x1b3792][_0x30e7('0x52')]();if(manager[_0x30e7('0x56')](_0x3c7751)){if(_0x166f6b[_0x3c7751][_0x30e7('0x5b')]&&_0x166f6b[_0x3c7751][_0x30e7('0x5c')]&&moment()[_0x30e7('0x61')](_0x166f6b[_0x3c7751][_0x30e7('0x5d')],_0x166f6b[_0x3c7751][_0x30e7('0x5e')])){manager[_0x30e7('0x62')](_0x3c7751,_0x166f6b[_0x3c7751][_0x30e7('0x5b')],handleJob(_0x166f6b[_0x3c7751]));logger[_0x30e7('0x10')](_0x30e7('0x63'),_0x166f6b[_0x3c7751]['name'],_0x166f6b[_0x3c7751][_0x30e7('0x5b')]);}else{manager[_0x30e7('0x37')](_0x3c7751);manager['deleteJob'](_0x3c7751);logger['info'](_0x30e7('0x60'),_0x166f6b[_0x3c7751][_0x30e7('0x19')],_0x166f6b[_0x3c7751][_0x30e7('0x5b')]);}}}})['catch'](function(_0x2d5122){logger['error'](JSON['stringify'](_0x2d5122));});}exports['run']=function(_0x5ba902){return getJobs(_0x5ba902);};exports[_0x30e7('0x5f')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x69b9=['jayson/promise','bluebird','../logger','schedule','../../mysqldb','retry','../../api/analyticDefaultReport/analyticDefaultReport.controller','number','AnalyticExtractedReport','error','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','format','\x22%s\x22\x20<%s>','name','email','Smtp','user','subtractUnit','join','../../files/reports','savename','basename','status','Sent','message','text','stringify','attachments','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Failed','request','SendMail','then','error\x20mail','email\x20sent','catch','case\x20loading','retryOptions','retries','job','operation','stop','still\x20loading','case\x20completed','data','case\x20failed','Unrecognized\x20status:','entity','\x20Attempt\x20#:','report\x20status:','dataValues','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20custom\x20report\x20id:%s','CustomReportId','runReport','no\x20report\x20id','findAll','MailServerOut','CloudProvider','map','toString','difference','exists','delete\x20cron','toRun','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','deleteJob','stop\x20cron','length','update','update\x20cron','run','util','path','lodash','cron-job-manager'];(function(_0x360206,_0x7c26ef){var _0x48eaad=function(_0x8bbd62){while(--_0x8bbd62){_0x360206['push'](_0x360206['shift']());}};_0x48eaad(++_0x7c26ef);}(_0x69b9,0x125));var _0x969b=function(_0x56a1b7,_0x5eef01){_0x56a1b7=_0x56a1b7-0x0;var _0x442c19=_0x69b9[_0x56a1b7];return _0x442c19;};'use strict';var fs=require('fs');var util=require(_0x969b('0x0'));var path=require(_0x969b('0x1'));var _=require(_0x969b('0x2'));var moment=require('moment');var CronJobManager=require(_0x969b('0x3'));var jayson=require(_0x969b('0x4'));var BPromise=require(_0x969b('0x5'));var logger=require(_0x969b('0x6'))(_0x969b('0x7'));var db=require(_0x969b('0x8'))['db'];const retry=require(_0x969b('0x9'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x969b('0xa'));var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x5ca5fe){const _0x2f4992={};if(typeof _0x5ca5fe===_0x969b('0xb')){_0x2f4992['id']=_0x5ca5fe;}return db[_0x969b('0xc')]['findOne']({'where':_0x2f4992})['then'](function(_0x32af98){return _0x32af98;})['catch'](function(_0x21bde3){logger[_0x969b('0xd')](_0x21bde3);});}function handleSendEmail(_0x367f34,_0xba4598){logger[_0x969b('0xe')](_0x969b('0xf'),_0x367f34['email']);var _0x53f88d=!![];var _0xf6686=_0x367f34[_0x969b('0x10')]['getSmtpOptions']();var _0x4e577d={'account':_0xf6686,'message':{'from':util[_0x969b('0x11')](_0x969b('0x12'),_0x367f34[_0x969b('0x10')][_0x969b('0x13')],_0x367f34['MailAccount'][_0x969b('0x14')]||_0x367f34[_0x969b('0x10')][_0x969b('0x15')][_0x969b('0x16')]),'to':_0x367f34[_0x969b('0x14')],'cc':_0x367f34['cc'],'bcc':_0x367f34['bcc'],'subject':util[_0x969b('0x11')]('Report\x20%s\x20last\x20%s\x20%s',_0xba4598['name'],_0x367f34['subtractNumber'],_0x367f34[_0x969b('0x17')])}};var _0x4c45b2=path[_0x969b('0x18')](__dirname,_0x969b('0x19'));var _0x84a5ad=_0xba4598[_0x969b('0x1a')];var _0x3206fa=util[_0x969b('0x11')]('%s.%s',path[_0x969b('0x1b')](_0xba4598['savename'],path['extname'](_0xba4598[_0x969b('0x1a')])),'zip');var _0x31b9bc=path['join'](_0x4c45b2,_0x84a5ad);var _0x31b53f=path['join'](_0x4c45b2,_0x3206fa);if(fs['existsSync'](_0x31b9bc)){_0xba4598[_0x969b('0x1c')]=_0x969b('0x1d');_0x4e577d[_0x969b('0x1e')]['attachments']=[{'filename':_0x84a5ad,'path':_0x31b9bc}];_0x4e577d[_0x969b('0x1e')][_0x969b('0x1f')]=util[_0x969b('0x11')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x969b('0x20')](_0xba4598,null,0x2));}else if(fs['existsSync'](_0x31b53f)){_0xba4598[_0x969b('0x1c')]=_0x969b('0x1d');_0x4e577d[_0x969b('0x1e')][_0x969b('0x21')]=[{'filename':_0x3206fa,'path':_0x31b53f}];}else{if(_0xba4598[_0x969b('0x1c')]===_0x969b('0x22')){_0x4e577d[_0x969b('0x1e')]['text']=_0x969b('0x23');if(!_0x367f34['sendIfEmpty']){_0x53f88d=![];logger[_0x969b('0xe')](_0x969b('0x24'));}}else if(_0xba4598[_0x969b('0x1c')]==='Loading'){_0x4e577d[_0x969b('0x1e')][_0x969b('0x1f')]=_0x969b('0x25');}else if(_0xba4598[_0x969b('0x1c')]===_0x969b('0x26')){_0x4e577d[_0x969b('0x1e')][_0x969b('0x1f')]='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0xba4598[_0x969b('0x1c')]===_0x969b('0x27')){_0x4e577d['message']['text']='Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else{logger[_0x969b('0xd')]('[handleSendEmail]\x20Unrecognized\x20status:',_0xba4598[_0x969b('0x1c')]);}}if(_0x53f88d){return client[_0x969b('0x28')](_0x969b('0x29'),_0x4e577d)[_0x969b('0x2a')](function(_0x48c1d9){if(_0x48c1d9['error']){return logger[_0x969b('0xd')](_0x969b('0x2b'),JSON[_0x969b('0x20')](_0x48c1d9));}return logger[_0x969b('0xe')](_0x969b('0x2c'));})[_0x969b('0x2d')](function(_0x2c6b72){return logger[_0x969b('0xd')](_0x969b('0x2b'),JSON[_0x969b('0x20')](_0x2c6b72));});}}function handleError(){return function(_0xf87844){return logger[_0x969b('0xd')](JSON['stringify'](_0xf87844));};}function loading(_0x3892f0){logger['info'](_0x969b('0x2e'));if(_0x3892f0['currentAttempt']===_0x3892f0[_0x969b('0x2f')][_0x969b('0x30')]){handleSendEmail(_0x3892f0[_0x969b('0x31')],_0x3892f0['data']);_0x3892f0[_0x969b('0x32')][_0x969b('0x33')]();}else{_0x3892f0[_0x969b('0x32')][_0x969b('0x9')](_0x969b('0x34'));}}function completed(_0x54dc59){logger[_0x969b('0xe')](_0x969b('0x35'));handleSendEmail(_0x54dc59[_0x969b('0x31')],_0x54dc59[_0x969b('0x36')]);_0x54dc59[_0x969b('0x32')][_0x969b('0x33')]();}function empty(_0x47fa1e){logger[_0x969b('0xe')]('case\x20empty');handleSendEmail(_0x47fa1e['job'],_0x47fa1e[_0x969b('0x36')]);_0x47fa1e[_0x969b('0x32')]['stop']();}function failed(_0x2ff3d2){logger[_0x969b('0xe')](_0x969b('0x37'));handleSendEmail(_0x2ff3d2[_0x969b('0x31')],_0x2ff3d2[_0x969b('0x36')]);_0x2ff3d2[_0x969b('0x32')]['stop']();}function urecognized(_0x202b72){logger[_0x969b('0xd')](_0x969b('0x38'),_0x202b72[_0x969b('0x39')]['dataValues'][_0x969b('0x1c')]);_0x202b72[_0x969b('0x32')]['stop']();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x5950a7,_0x437e02){const _0x9e35f2={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x52c360=retry[_0x969b('0x32')](_0x9e35f2);_0x52c360['attempt'](_0x4e0d7f=>{logger[_0x969b('0xe')]('Job\x20ID\x20'+_0x5950a7['id']+_0x969b('0x3a')+_0x4e0d7f);try{getReportData(_0x437e02['id'])[_0x969b('0x2a')](function(_0x275dae){_0x437e02=_0x275dae;logger['info'](_0x969b('0x3b'),_0x275dae[_0x969b('0x3c')][_0x969b('0x1c')]);if(!reportStatusStrategies[_0x275dae[_0x969b('0x3c')][_0x969b('0x1c')]]){logger[_0x969b('0xd')](_0x969b('0x3b'),_0x275dae[_0x969b('0x3c')][_0x969b('0x1c')]);_0x52c360[_0x969b('0x9')]();}reportStatusStrategies[_0x275dae[_0x969b('0x3c')][_0x969b('0x1c')]]({'operation':_0x52c360,'currentAttempt':_0x4e0d7f,'retryOptions':_0x9e35f2,'job':_0x5950a7,'data':_0x437e02,'entity':_0x275dae});});}catch(_0x552286){_0x52c360['retry'](_0x552286);}});}function handleResult(_0xa06f1e){return function(_0x41d26e){if(_0xa06f1e['sendMail']&&_0xa06f1e[_0x969b('0x10')]&&_0xa06f1e['MailAccount'][_0x969b('0x15')]&&!_['isNil'](_0xa06f1e[_0x969b('0x14')])){retryer(_0xa06f1e,_0x41d26e);}};}function handleJob(_0x5c3da0){return function(){try{if(_[_0x969b('0x3d')](_0x5c3da0[_0x969b('0x3e')])){return logger[_0x969b('0xe')](_0x969b('0x3f'));}if(_[_0x969b('0x3d')](_0x5c3da0[_0x969b('0x17')])){return logger['info'](_0x969b('0x40'));}var _0x4f99a3={'startDate':moment()[_0x969b('0x41')](_0x5c3da0[_0x969b('0x3e')],_0x5c3da0['subtractUnit'])[_0x969b('0x11')](_0x969b('0x42')),'endDate':moment()[_0x969b('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x969b('0x43'),'output':_0x5c3da0[_0x969b('0x44')],'name':_0x5c3da0[_0x969b('0x13')]};if(!_['isNil'](_0x5c3da0[_0x969b('0x45')])){logger[_0x969b('0xe')]('exec\x20defaul\x20report\x20id:%s',_0x5c3da0[_0x969b('0x45')]);return analyticDefaultReportController['runReport']({'id':_0x5c3da0[_0x969b('0x45')]},_0x4f99a3)[_0x969b('0x2a')](handleResult(_0x5c3da0))[_0x969b('0x2d')](handleError());}if(!_[_0x969b('0x3d')](_0x5c3da0['CustomReportId'])){logger['info'](_0x969b('0x46'),_0x5c3da0[_0x969b('0x47')]);return analyticCustomReportController[_0x969b('0x48')]({'id':_0x5c3da0[_0x969b('0x47')]},_0x4f99a3)[_0x969b('0x2a')](handleResult(_0x5c3da0))['catch'](handleError());}}catch(_0x88b78){logger[_0x969b('0xd')](JSON['stringify'](_0x88b78));}return logger['info'](_0x969b('0x49'));};}function getJobs(_0x1227ec){var _0x3b08d1={};if(_0x1227ec){_0x3b08d1['id']=_0x1227ec;}return db['Schedule'][_0x969b('0x4a')]({'where':_0x3b08d1,'include':[{'model':db[_0x969b('0x10')],'attributes':['id','name',_0x969b('0x14')],'include':[{'model':db[_0x969b('0x4b')],'as':_0x969b('0x15'),'include':[{'model':db['CloudProvider'],'as':_0x969b('0x4c')}]}]}]})[_0x969b('0x2a')](function(_0x174285){var _0xa983c4=_['keys'](manager['jobs']);var _0x3135cc=_[_0x969b('0x4d')](_0x174285,function(_0x4dc5c1){return _0x4dc5c1['id']['toString']();});var _0x4721a9=_['keyBy'](_0x174285,function(_0x1aa07e){return _0x1aa07e['id'][_0x969b('0x4e')]();});var _0x181474=_0x1227ec?_0x3135cc:_[_0x969b('0x4f')](_0x3135cc,_0xa983c4);var _0x56f4d4=_['intersection'](_0x3135cc,_0xa983c4);var _0x85abf6=_[_0x969b('0x4f')](_0xa983c4,_0x3135cc);var _0x498f7d;var _0x2fd40c;for(_0x498f7d=0x0;_0x498f7d<_0x85abf6['length']&&!_0x1227ec;_0x498f7d+=0x1){_0x2fd40c=_0x85abf6[_0x498f7d][_0x969b('0x4e')]();if(manager[_0x969b('0x50')](_0x2fd40c)){manager[_0x969b('0x33')](_0x2fd40c);manager['deleteJob'](_0x2fd40c);logger[_0x969b('0xe')](_0x969b('0x51'),_0x2fd40c);}}logger[_0x969b('0xe')](_0x969b('0x52'),JSON[_0x969b('0x20')](_0x181474));for(_0x498f7d=0x0;_0x498f7d<_0x181474['length'];_0x498f7d+=0x1){_0x2fd40c=_0x181474[_0x498f7d][_0x969b('0x4e')]();if(_0x1227ec){logger['info'](JSON[_0x969b('0x20')](_0x4721a9[_0x2fd40c]));BPromise[_0x969b('0x53')]()['then'](handleJob(_0x4721a9[_0x2fd40c]));logger['info'](_0x969b('0x54'),_0x4721a9[_0x2fd40c][_0x969b('0x13')],_0x4721a9[_0x2fd40c][_0x969b('0x55')]);}else if(_0x4721a9[_0x2fd40c]['cron']&&_0x4721a9[_0x2fd40c][_0x969b('0x56')]&&moment()[_0x969b('0x57')](_0x4721a9[_0x2fd40c][_0x969b('0x58')],_0x4721a9[_0x2fd40c][_0x969b('0x59')])){manager[_0x969b('0x5a')](_0x2fd40c,_0x4721a9[_0x2fd40c][_0x969b('0x55')],handleJob(_0x4721a9[_0x2fd40c]));manager[_0x969b('0x5b')](_0x2fd40c);logger[_0x969b('0xe')](_0x969b('0x5c'),_0x4721a9[_0x2fd40c][_0x969b('0x13')],_0x4721a9[_0x2fd40c][_0x969b('0x55')]);}else if(manager[_0x969b('0x50')](_0x2fd40c)){manager[_0x969b('0x33')](_0x2fd40c);manager[_0x969b('0x5d')](_0x2fd40c);logger[_0x969b('0xe')](_0x969b('0x5e'),_0x4721a9[_0x2fd40c][_0x969b('0x13')],_0x4721a9[_0x2fd40c][_0x969b('0x55')]);}}for(_0x498f7d=0x0,_0x2fd40c;_0x498f7d<_0x56f4d4[_0x969b('0x5f')]&&!_0x1227ec;_0x498f7d+=0x1){_0x2fd40c=_0x56f4d4[_0x498f7d][_0x969b('0x4e')]();if(manager['exists'](_0x2fd40c)){if(_0x4721a9[_0x2fd40c][_0x969b('0x55')]&&_0x4721a9[_0x2fd40c][_0x969b('0x56')]&&moment()[_0x969b('0x57')](_0x4721a9[_0x2fd40c][_0x969b('0x58')],_0x4721a9[_0x2fd40c][_0x969b('0x59')])){manager[_0x969b('0x60')](_0x2fd40c,_0x4721a9[_0x2fd40c][_0x969b('0x55')],handleJob(_0x4721a9[_0x2fd40c]));logger[_0x969b('0xe')](_0x969b('0x61'),_0x4721a9[_0x2fd40c][_0x969b('0x13')],_0x4721a9[_0x2fd40c]['cron']);}else{manager[_0x969b('0x33')](_0x2fd40c);manager[_0x969b('0x5d')](_0x2fd40c);logger[_0x969b('0xe')](_0x969b('0x5e'),_0x4721a9[_0x2fd40c][_0x969b('0x13')],_0x4721a9[_0x2fd40c]['cron']);}}}})['catch'](function(_0x279644){logger['error'](JSON[_0x969b('0x20')](_0x279644));});}exports[_0x969b('0x62')]=function(_0x336ffa){return getJobs(_0x336ffa);};exports[_0x969b('0x5b')]=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 b0a5d35..3877861 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 _0x3264=['TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','info','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','sentiment','sentimentAccountId','language','bucket','Sequelize','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','Positive','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','all','start','aws-sdk','request-promise','util','bluebird','transcribe','TranscribeService','getTranscriptionJob','Comprehend','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText'];(function(_0x45249f,_0x2c7830){var _0x2afee9=function(_0x2111cd){while(--_0x2111cd){_0x45249f['push'](_0x45249f['shift']());}};_0x2afee9(++_0x2c7830);}(_0x3264,0x7f));var _0x4326=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x3264[_0x2dea24];return _0x309d58;};var _=require('lodash');var AWS=require(_0x4326('0x0'));var rp=require(_0x4326('0x1'));var util=require(_0x4326('0x2'));var BPromise=require(_0x4326('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x4326('0x4'));function getTranscriptionJob(_0x510181,_0x5555ac,_0x27ff99,_0x34ce4f){return new Promise(function(_0xed0465,_0x3f8d4e){var _0x56bcce=new AWS[(_0x4326('0x5'))]({'accessKeyId':_0x5555ac,'secretAccessKey':_0x510181,'region':_0x27ff99});_0x56bcce[_0x4326('0x6')]({'TranscriptionJobName':_0x34ce4f},function(_0x22071c,_0x129365){if(_0x22071c){return _0x3f8d4e(_0x22071c);}else{return _0xed0465(_0x129365);}});});}function sentiment(_0x7a4796,_0x2b3f1e,_0x1609f,_0x5cde0b,_0x58bade){return new Promise(function(_0x51323a,_0x97d63e){var _0x9daa3f=new AWS[(_0x4326('0x7'))]({'accessKeyId':_0x2b3f1e,'secretAccessKey':_0x7a4796,'region':_0x1609f});_0x9daa3f['detectSentiment']({'Text':_0x5cde0b,'LanguageCode':_0x58bade['substring'](0x0,0x2)},function(_0x1bc3ff,_0x4d6d36){if(_0x1bc3ff){return _0x97d63e(_0x1bc3ff);}else{return _0x51323a(_0x4d6d36);}});});}function checkTranscribeJob(_0xd45b39,_0x2893f1,_0x3515af){var _0x4f8f3d;return new BPromise(function(_0x5f17ac,_0x1087d9){logger['info'](util['format'](_0x4326('0x8'),_0xd45b39['id'],_0xd45b39[_0x4326('0x9')]));return getTranscriptionJob(_0x3515af[_0x4326('0xa')],_0x3515af[_0x4326('0xb')],_0x2893f1['transcribeRegion'],_0xd45b39[_0x4326('0x9')])[_0x4326('0xc')](function(_0x33112f){logger['info'](util[_0x4326('0xd')](_0x4326('0xe'),_0xd45b39['id'],_0xd45b39[_0x4326('0x9')],_0x33112f[_0x4326('0xf')]['TranscriptionJobStatus']));if(!_0xd45b39[_0x4326('0x10')]){switch(_0x33112f['TranscriptionJob'][_0x4326('0x11')]){case _0x4326('0x12'):var _0x35f24b={'transcribeStatus':_0x33112f[_0x4326('0xf')][_0x4326('0x11')],'fileUri':_0x33112f['TranscriptionJob'][_0x4326('0x13')][_0x4326('0x14')]};logger['info'](util[_0x4326('0xd')](_0x4326('0x15'),_0xd45b39['id']));return rp({'uri':_0x33112f[_0x4326('0xf')]['Transcript'][_0x4326('0x14')],'json':!![]})[_0x4326('0xc')](function(_0xde8632){logger[_0x4326('0x16')](util[_0x4326('0xd')](_0x4326('0x17'),_0xd45b39['id']));if(_0xde8632&&_0xde8632[_0x4326('0x18')]&&_0xde8632[_0x4326('0x18')]['transcripts']&&_0xde8632[_0x4326('0x18')][_0x4326('0x19')]['length']){_0x35f24b[_0x4326('0x10')]='';for(var _0x3d5e8f=0x0;_0x3d5e8f<_0xde8632[_0x4326('0x18')][_0x4326('0x19')][_0x4326('0x1a')];_0x3d5e8f++){_0x35f24b['fileText']+=_0xde8632['results'][_0x4326('0x19')][_0x3d5e8f][_0x4326('0x1b')]+'';}}return _0xd45b39[_0x4326('0x1c')](_0x35f24b);})[_0x4326('0xc')](function(){logger['info'](util[_0x4326('0xd')](_0x4326('0x1d'),_0xd45b39['id']));if(!_0xd45b39[_0x4326('0x1e')]){throw new db['Sequelize'][(_0x4326('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2893f1[_0x4326('0x20')]||!_0x2893f1[_0x4326('0x21')]||!_0x2893f1['sentimentRegion']||!_0x2893f1[_0x4326('0x22')]||!_0x2893f1[_0x4326('0x23')]){throw new db[(_0x4326('0x24'))][(_0x4326('0x1f'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x35f24b['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x2893f1[_0x4326('0x21')]===_0x3515af['id']){return _0x3515af;}else{return db[_0x4326('0x25')][_0x4326('0x26')]({'where':{'id':_settings[_0x4326('0x21')]}});}})[_0x4326('0xc')](function(_0x2d0d14){if(!_0x2d0d14){throw new db[(_0x4326('0x24'))][(_0x4326('0x1f'))](_0x4326('0x27'));}if(!_0x2d0d14[_0x4326('0xa')]||!_0x2d0d14['data2']){throw new db[(_0x4326('0x24'))][(_0x4326('0x1f'))](_0x4326('0x28'));}_0x4f8f3d=_0x2d0d14;logger[_0x4326('0x16')](util['format'](_0x4326('0x29'),_0xd45b39['id']));return sentiment(_0x4f8f3d[_0x4326('0xa')],_0x4f8f3d[_0x4326('0xb')],_0x2893f1[_0x4326('0x2a')],_0x35f24b[_0x4326('0x10')],_0x2893f1[_0x4326('0x22')]);})['then'](function(_0x40c1a0){logger[_0x4326('0x16')](util[_0x4326('0xd')](_0x4326('0x2b'),_0xd45b39['id']));return _0xd45b39[_0x4326('0x1c')]({'sentiment':_0x40c1a0[_0x4326('0x2c')],'sPositive':_0x40c1a0[_0x4326('0x2d')]['Positive'],'sNegative':_0x40c1a0['SentimentScore'][_0x4326('0x2e')],'sMixed':_0x40c1a0['SentimentScore'][_0x4326('0x2f')],'sNeutral':_0x40c1a0[_0x4326('0x2d')][_0x4326('0x30')]});})[_0x4326('0xc')](function(){logger['info'](util['format'](_0x4326('0x1d'),_0xd45b39['id']));_0x5f17ac();});case _0x4326('0x31'):return _0xd45b39['update']({'transcribeStatus':_0x4326('0x31'),'failureReason':_0x33112f[_0x4326('0xf')][_0x4326('0x32')]})[_0x4326('0xc')](function(){logger[_0x4326('0x16')](util[_0x4326('0xd')](_0x4326('0x1d'),_0xd45b39['id']));_0x5f17ac();});default:logger[_0x4326('0x16')](util[_0x4326('0xd')](_0x4326('0x33'),_0xd45b39['id']));break;}}else{return BPromise['resolve']()['then'](function(){if(!_0xd45b39['tempSentiment']){throw new db[(_0x4326('0x24'))][(_0x4326('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x2893f1[_0x4326('0x20')]||!_0x2893f1[_0x4326('0x21')]||!_0x2893f1[_0x4326('0x2a')]||!_0x2893f1[_0x4326('0x22')]||!_0x2893f1[_0x4326('0x23')]){throw new db['Sequelize'][(_0x4326('0x1f'))](_0x4326('0x34'));}if(!_0xd45b39[_0x4326('0x10')]){throw new Error(_0x4326('0x35'));}if(_0x2893f1[_0x4326('0x21')]===_0x3515af['id']){return _0x3515af;}else{return db[_0x4326('0x25')][_0x4326('0x26')]({'where':{'id':_settings[_0x4326('0x21')]}});}})[_0x4326('0xc')](function(_0x52d0d1){if(!_0x52d0d1){throw new db[(_0x4326('0x24'))][(_0x4326('0x1f'))](_0x4326('0x27'));}if(!_0x52d0d1['data1']||!_0x52d0d1[_0x4326('0xb')]){throw new db['Sequelize'][(_0x4326('0x1f'))](_0x4326('0x28'));}_0x4f8f3d=_0x52d0d1;logger[_0x4326('0x16')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0xd45b39['id']));return sentiment(_0x4f8f3d[_0x4326('0xa')],_0x4f8f3d[_0x4326('0xb')],_0x2893f1[_0x4326('0x2a')],_0xd45b39['fileText'],_0x2893f1[_0x4326('0x22')]);})[_0x4326('0xc')](function(_0x140651){logger[_0x4326('0x16')](util[_0x4326('0xd')](_0x4326('0x2b'),_0xd45b39['id']));return _0xd45b39[_0x4326('0x1c')]({'sentiment':_0x140651['Sentiment'],'sPositive':_0x140651[_0x4326('0x2d')][_0x4326('0x36')],'sNegative':_0x140651[_0x4326('0x2d')][_0x4326('0x2e')],'sMixed':_0x140651['SentimentScore']['Mixed'],'sNeutral':_0x140651[_0x4326('0x2d')][_0x4326('0x30')],'transcribeStatus':'COMPLETED'});})[_0x4326('0xc')](function(){logger[_0x4326('0x16')](util[_0x4326('0xd')](_0x4326('0x1d'),_0xd45b39['id']));_0x5f17ac();});}})[_0x4326('0x37')](function(_0x5d5983){if(_0x5d5983){if(!_0x5d5983['name']||_0x5d5983[_0x4326('0x38')]!==_0x4326('0x39')){logger[_0x4326('0x3a')](util[_0x4326('0xd')](_0x4326('0x3b'),_0xd45b39['id']),util[_0x4326('0x3c')](_0x5d5983,{'showHidden':![],'depth':null}));}}_0x5f17ac();});});}function checkTranscribe(){var _0x42cfac;var _0x491d3f;var _0x20796e;return db[_0x4326('0x3d')][_0x4326('0x3e')]({'where':{'transcribeStatus':_0x4326('0x3f')}})[_0x4326('0xc')](function(_0x487c7f){if(!_0x487c7f||!_0x487c7f['length']){throw new db[(_0x4326('0x24'))][(_0x4326('0x1f'))](_0x4326('0x40'));}_0x42cfac=_0x487c7f;return db['Setting'][_0x4326('0x26')]({'where':{'id':0x1}});})[_0x4326('0xc')](function(_0x264744){if(!_0x264744){throw new db[(_0x4326('0x24'))][(_0x4326('0x1f'))]('Settings\x20not\x20available');}_0x491d3f=_0x264744;if(!_0x491d3f[_0x4326('0x4')]||!_0x491d3f[_0x4326('0x41')]||!_0x491d3f[_0x4326('0x42')]||!_0x491d3f[_0x4326('0x22')]||!_0x491d3f['bucket']){throw new db['Sequelize'][(_0x4326('0x1f'))](_0x4326('0x43'));}return db['CloudProvider'][_0x4326('0x26')]({'where':{'id':_0x491d3f[_0x4326('0x41')]}});})['then'](function(_0x234f18){if(!_0x234f18){throw new db[(_0x4326('0x24'))][(_0x4326('0x1f'))](_0x4326('0x27'));}if(!_0x234f18['data1']||!_0x234f18[_0x4326('0xb')]){throw new db['Sequelize'][(_0x4326('0x1f'))](_0x4326('0x28'));}_0x20796e=_0x234f18;var _0x48c7ce=[];_0x42cfac[_0x4326('0x44')](function(_0x59a0be){_0x48c7ce[_0x4326('0x45')](checkTranscribeJob(_0x59a0be,_0x491d3f,_0x20796e));});return BPromise[_0x4326('0x46')](_0x48c7ce);})['catch'](function(_0x10c890){if(_0x10c890){if(!_0x10c890['name']||_0x10c890[_0x4326('0x38')]!==_0x4326('0x39')){logger[_0x4326('0x3a')](util[_0x4326('0x3c')](_0x10c890,{'showHidden':![],'depth':null}));}}});}exports[_0x4326('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x2ec8=['Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','sentimentAccountId','CloudProvider','findOne','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20available','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribe','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','lodash','aws-sdk','request-promise','util','../../mysqldb','getTranscriptionJob','Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','transcribeName','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','Transcript','then','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment'];(function(_0x10f281,_0x5e8e8f){var _0x495274=function(_0x67b0c5){while(--_0x67b0c5){_0x10f281['push'](_0x10f281['shift']());}};_0x495274(++_0x5e8e8f);}(_0x2ec8,0x188));var _0x82ec=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2ec8[_0x501510];return _0x1e6ee5;};var _=require(_0x82ec('0x0'));var AWS=require(_0x82ec('0x1'));var rp=require(_0x82ec('0x2'));var util=require(_0x82ec('0x3'));var BPromise=require('bluebird');var db=require(_0x82ec('0x4'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x1b21cd,_0x51192a,_0x1ba7b4,_0x1baccd){return new Promise(function(_0x528e26,_0x4c9400){var _0x5c786a=new AWS['TranscribeService']({'accessKeyId':_0x51192a,'secretAccessKey':_0x1b21cd,'region':_0x1ba7b4});_0x5c786a[_0x82ec('0x5')]({'TranscriptionJobName':_0x1baccd},function(_0x3ceabc,_0x4dd14f){if(_0x3ceabc){return _0x4c9400(_0x3ceabc);}else{return _0x528e26(_0x4dd14f);}});});}function sentiment(_0x53c644,_0x1c3022,_0x132ac9,_0x4da5d8,_0x2810d4){return new Promise(function(_0xf1ab6c,_0x749932){var _0x46a3be=new AWS[(_0x82ec('0x6'))]({'accessKeyId':_0x1c3022,'secretAccessKey':_0x53c644,'region':_0x132ac9});_0x46a3be['detectSentiment']({'Text':_0x4da5d8,'LanguageCode':_0x2810d4[_0x82ec('0x7')](0x0,0x2)},function(_0x1a53f5,_0x445d3f){if(_0x1a53f5){return _0x749932(_0x1a53f5);}else{return _0xf1ab6c(_0x445d3f);}});});}function checkTranscribeJob(_0x55717e,_0x317339,_0x1eb33e){var _0x53d03a;return new BPromise(function(_0x26181f,_0x52f476){logger[_0x82ec('0x8')](util[_0x82ec('0x9')](_0x82ec('0xa'),_0x55717e['id'],_0x55717e['transcribeName']));return getTranscriptionJob(_0x1eb33e[_0x82ec('0xb')],_0x1eb33e['data2'],_0x317339[_0x82ec('0xc')],_0x55717e[_0x82ec('0xd')])['then'](function(_0x57a4f3){logger[_0x82ec('0x8')](util[_0x82ec('0x9')](_0x82ec('0xe'),_0x55717e['id'],_0x55717e[_0x82ec('0xd')],_0x57a4f3[_0x82ec('0xf')][_0x82ec('0x10')]));if(!_0x55717e[_0x82ec('0x11')]){switch(_0x57a4f3['TranscriptionJob'][_0x82ec('0x10')]){case _0x82ec('0x12'):var _0x5430a9={'transcribeStatus':_0x57a4f3['TranscriptionJob'][_0x82ec('0x10')],'fileUri':_0x57a4f3[_0x82ec('0xf')]['Transcript'][_0x82ec('0x13')]};logger['info'](util[_0x82ec('0x9')]('[RECORDING:%d]\x20Get\x20transcript',_0x55717e['id']));return rp({'uri':_0x57a4f3[_0x82ec('0xf')][_0x82ec('0x14')][_0x82ec('0x13')],'json':!![]})[_0x82ec('0x15')](function(_0x161cb4){logger[_0x82ec('0x8')](util[_0x82ec('0x9')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x55717e['id']));if(_0x161cb4&&_0x161cb4[_0x82ec('0x16')]&&_0x161cb4['results'][_0x82ec('0x17')]&&_0x161cb4[_0x82ec('0x16')][_0x82ec('0x17')][_0x82ec('0x18')]){_0x5430a9[_0x82ec('0x11')]='';for(var _0x49d36c=0x0;_0x49d36c<_0x161cb4[_0x82ec('0x16')][_0x82ec('0x17')][_0x82ec('0x18')];_0x49d36c++){_0x5430a9[_0x82ec('0x11')]+=_0x161cb4['results'][_0x82ec('0x17')][_0x49d36c]['transcript']+'';}}return _0x55717e[_0x82ec('0x19')](_0x5430a9);})['then'](function(){logger[_0x82ec('0x8')](util[_0x82ec('0x9')](_0x82ec('0x1a'),_0x55717e['id']));if(!_0x55717e[_0x82ec('0x1b')]){throw new db[(_0x82ec('0x1c'))][(_0x82ec('0x1d'))](_0x82ec('0x1e'));}if(!_0x317339[_0x82ec('0x1f')]||!_0x317339['sentimentAccountId']||!_0x317339[_0x82ec('0x20')]||!_0x317339[_0x82ec('0x21')]||!_0x317339[_0x82ec('0x22')]){throw new db[(_0x82ec('0x1c'))]['ValidationError'](_0x82ec('0x23'));}if(!_0x5430a9[_0x82ec('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x317339[_0x82ec('0x24')]===_0x1eb33e['id']){return _0x1eb33e;}else{return db[_0x82ec('0x25')][_0x82ec('0x26')]({'where':{'id':_settings[_0x82ec('0x24')]}});}})[_0x82ec('0x15')](function(_0x538802){if(!_0x538802){throw new db[(_0x82ec('0x1c'))][(_0x82ec('0x1d'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x538802[_0x82ec('0xb')]||!_0x538802[_0x82ec('0x27')]){throw new db[(_0x82ec('0x1c'))]['ValidationError'](_0x82ec('0x28'));}_0x53d03a=_0x538802;logger[_0x82ec('0x8')](util['format'](_0x82ec('0x29'),_0x55717e['id']));return sentiment(_0x53d03a[_0x82ec('0xb')],_0x53d03a[_0x82ec('0x27')],_0x317339['sentimentRegion'],_0x5430a9[_0x82ec('0x11')],_0x317339[_0x82ec('0x21')]);})[_0x82ec('0x15')](function(_0x116f8a){logger[_0x82ec('0x8')](util['format'](_0x82ec('0x2a'),_0x55717e['id']));return _0x55717e[_0x82ec('0x19')]({'sentiment':_0x116f8a[_0x82ec('0x2b')],'sPositive':_0x116f8a[_0x82ec('0x2c')][_0x82ec('0x2d')],'sNegative':_0x116f8a[_0x82ec('0x2c')][_0x82ec('0x2e')],'sMixed':_0x116f8a['SentimentScore'][_0x82ec('0x2f')],'sNeutral':_0x116f8a[_0x82ec('0x2c')][_0x82ec('0x30')]});})[_0x82ec('0x15')](function(){logger[_0x82ec('0x8')](util[_0x82ec('0x9')](_0x82ec('0x1a'),_0x55717e['id']));_0x26181f();});case _0x82ec('0x31'):return _0x55717e[_0x82ec('0x19')]({'transcribeStatus':_0x82ec('0x31'),'failureReason':_0x57a4f3['TranscriptionJob']['FailureReason']})['then'](function(){logger[_0x82ec('0x8')](util[_0x82ec('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x55717e['id']));_0x26181f();});default:logger[_0x82ec('0x8')](util[_0x82ec('0x9')](_0x82ec('0x32'),_0x55717e['id']));break;}}else{return BPromise[_0x82ec('0x33')]()['then'](function(){if(!_0x55717e[_0x82ec('0x1b')]){throw new db[(_0x82ec('0x1c'))][(_0x82ec('0x1d'))](_0x82ec('0x1e'));}if(!_0x317339[_0x82ec('0x1f')]||!_0x317339[_0x82ec('0x24')]||!_0x317339[_0x82ec('0x20')]||!_0x317339[_0x82ec('0x21')]||!_0x317339[_0x82ec('0x22')]){throw new db[(_0x82ec('0x1c'))][(_0x82ec('0x1d'))](_0x82ec('0x23'));}if(!_0x55717e[_0x82ec('0x11')]){throw new Error(_0x82ec('0x34'));}if(_0x317339['sentimentAccountId']===_0x1eb33e['id']){return _0x1eb33e;}else{return db[_0x82ec('0x25')][_0x82ec('0x26')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x4b9eaf){if(!_0x4b9eaf){throw new db[(_0x82ec('0x1c'))]['ValidationError'](_0x82ec('0x35'));}if(!_0x4b9eaf[_0x82ec('0xb')]||!_0x4b9eaf[_0x82ec('0x27')]){throw new db['Sequelize'][(_0x82ec('0x1d'))](_0x82ec('0x28'));}_0x53d03a=_0x4b9eaf;logger[_0x82ec('0x8')](util[_0x82ec('0x9')](_0x82ec('0x29'),_0x55717e['id']));return sentiment(_0x53d03a[_0x82ec('0xb')],_0x53d03a[_0x82ec('0x27')],_0x317339[_0x82ec('0x20')],_0x55717e['fileText'],_0x317339['language']);})['then'](function(_0x4957f){logger[_0x82ec('0x8')](util[_0x82ec('0x9')](_0x82ec('0x2a'),_0x55717e['id']));return _0x55717e[_0x82ec('0x19')]({'sentiment':_0x4957f[_0x82ec('0x2b')],'sPositive':_0x4957f['SentimentScore'][_0x82ec('0x2d')],'sNegative':_0x4957f[_0x82ec('0x2c')][_0x82ec('0x2e')],'sMixed':_0x4957f[_0x82ec('0x2c')][_0x82ec('0x2f')],'sNeutral':_0x4957f[_0x82ec('0x2c')][_0x82ec('0x30')],'transcribeStatus':'COMPLETED'});})[_0x82ec('0x15')](function(){logger[_0x82ec('0x8')](util[_0x82ec('0x9')](_0x82ec('0x1a'),_0x55717e['id']));_0x26181f();});}})[_0x82ec('0x36')](function(_0x1d7551){if(_0x1d7551){if(!_0x1d7551[_0x82ec('0x37')]||_0x1d7551['name']!==_0x82ec('0x38')){logger[_0x82ec('0x39')](util[_0x82ec('0x9')](_0x82ec('0x3a'),_0x55717e['id']),util[_0x82ec('0x3b')](_0x1d7551,{'showHidden':![],'depth':null}));}}_0x26181f();});});}function checkTranscribe(){var _0x2f888a;var _0x4a9901;var _0x34b20b;return db[_0x82ec('0x3c')][_0x82ec('0x3d')]({'where':{'transcribeStatus':_0x82ec('0x3e')}})[_0x82ec('0x15')](function(_0x3f6820){if(!_0x3f6820||!_0x3f6820[_0x82ec('0x18')]){throw new db['Sequelize']['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x2f888a=_0x3f6820;return db[_0x82ec('0x3f')][_0x82ec('0x26')]({'where':{'id':0x1}});})['then'](function(_0x528907){if(!_0x528907){throw new db[(_0x82ec('0x1c'))][(_0x82ec('0x1d'))](_0x82ec('0x40'));}_0x4a9901=_0x528907;if(!_0x4a9901[_0x82ec('0x41')]||!_0x4a9901['transcribeAccountId']||!_0x4a9901[_0x82ec('0xc')]||!_0x4a9901[_0x82ec('0x21')]||!_0x4a9901[_0x82ec('0x22')]){throw new db[(_0x82ec('0x1c'))]['ValidationError'](_0x82ec('0x42'));}return db[_0x82ec('0x25')]['findOne']({'where':{'id':_0x4a9901[_0x82ec('0x43')]}});})['then'](function(_0x518af8){if(!_0x518af8){throw new db['Sequelize'][(_0x82ec('0x1d'))](_0x82ec('0x35'));}if(!_0x518af8[_0x82ec('0xb')]||!_0x518af8[_0x82ec('0x27')]){throw new db[(_0x82ec('0x1c'))][(_0x82ec('0x1d'))](_0x82ec('0x28'));}_0x34b20b=_0x518af8;var _0x35a863=[];_0x2f888a[_0x82ec('0x44')](function(_0x15570b){_0x35a863[_0x82ec('0x45')](checkTranscribeJob(_0x15570b,_0x4a9901,_0x34b20b));});return BPromise['all'](_0x35a863);})[_0x82ec('0x36')](function(_0x307267){if(_0x307267){if(!_0x307267[_0x82ec('0x37')]||_0x307267[_0x82ec('0x37')]!==_0x82ec('0x38')){logger[_0x82ec('0x39')](util[_0x82ec('0x3b')](_0x307267,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index ea35ffb..ee0de1a 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 _0x7d95=['ioredis','../../config/environment','../../mysqldb','../logger','defaults','redis','localhost','socket.io-emitter','findAll','subtract','hours','then','length','map','info','join','WhatsappInteraction','update','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment'];(function(_0x2ecad4,_0x8dca5a){var _0x5b4a47=function(_0x5e21cc){while(--_0x5e21cc){_0x2ecad4['push'](_0x2ecad4['shift']());}};_0x5b4a47(++_0x8dca5a);}(_0x7d95,0x1ec));var _0x57d9=function(_0x6306d2,_0x4ae91b){_0x6306d2=_0x6306d2-0x0;var _0x4d13aa=_0x7d95[_0x6306d2];return _0x4d13aa;};'use strict';var _=require(_0x57d9('0x0'));var moment=require(_0x57d9('0x1'));var Redis=require(_0x57d9('0x2'));var util=require('util');var config=require(_0x57d9('0x3'));var db=require(_0x57d9('0x4'))['db'];var logger=require(_0x57d9('0x5'))('schedule');config['redis']=_[_0x57d9('0x6')](config[_0x57d9('0x7')],{'host':_0x57d9('0x8'),'port':0x18eb});var io=require(_0x57d9('0x9'))(new Redis(config[_0x57d9('0x7')]));function closeInteractions(){var _0x39172b=[];return db['WhatsappInteraction'][_0x57d9('0xa')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x57d9('0xb')](0x18,_0x57d9('0xc'))}}})[_0x57d9('0xd')](function(_0x215e15){if(_0x215e15&&_0x215e15[_0x57d9('0xe')]){_0x39172b=_[_0x57d9('0xf')](_0x215e15||[],'id');logger[_0x57d9('0x10')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x39172b[_0x57d9('0x11')]());return db[_0x57d9('0x12')][_0x57d9('0x13')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x57d9('0x14'))},{'where':{'id':_0x39172b}});}})[_0x57d9('0xd')](function(){if(_0x39172b&&_0x39172b[_0x57d9('0xe')]){logger[_0x57d9('0x10')](_0x57d9('0x15'),_0x39172b['join']());for(var _0x236799=0x0;_0x236799<_0x39172b['length'];_0x236799++){io['emit'](_0x57d9('0x16'),{'id':_0x39172b[_0x236799],'closed':!![]});}}})[_0x57d9('0x17')](function(_0x351a70){logger['error'](_0x57d9('0x18'),_0x351a70?util[_0x57d9('0x19')](_0x351a70,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x59c7=['then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','util','../../config/environment','../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','hours'];(function(_0x259d1b,_0x548317){var _0x55a111=function(_0x43743a){while(--_0x43743a){_0x259d1b['push'](_0x259d1b['shift']());}};_0x55a111(++_0x548317);}(_0x59c7,0x1b4));var _0x759c=function(_0xe3d179,_0x2a4698){_0xe3d179=_0xe3d179-0x0;var _0xf8eb37=_0x59c7[_0xe3d179];return _0xf8eb37;};'use strict';var _=require(_0x759c('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0x759c('0x1'));var config=require(_0x759c('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x759c('0x3'))(_0x759c('0x4'));config['redis']=_['defaults'](config[_0x759c('0x5')],{'host':_0x759c('0x6'),'port':0x18eb});var io=require(_0x759c('0x7'))(new Redis(config[_0x759c('0x5')]));function closeInteractions(){var _0x4583f3=[];return db[_0x759c('0x8')]['findAll']({'raw':!![],'attributes':['id',_0x759c('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x759c('0xa')](0x18,_0x759c('0xb'))}}})[_0x759c('0xc')](function(_0x633652){if(_0x633652&&_0x633652[_0x759c('0xd')]){_0x4583f3=_['map'](_0x633652||[],'id');logger[_0x759c('0xe')](_0x759c('0xf'),_0x4583f3[_0x759c('0x10')]());return db['WhatsappInteraction'][_0x759c('0x11')]({'closeReason':_0x759c('0x12'),'disposition':_0x759c('0x13'),'closed':!![],'closedAt':moment()[_0x759c('0x14')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x4583f3}});}})['then'](function(){if(_0x4583f3&&_0x4583f3['length']){logger['info'](_0x759c('0x15'),_0x4583f3['join']());for(var _0x4dfaf0=0x0;_0x4dfaf0<_0x4583f3[_0x759c('0xd')];_0x4dfaf0++){io[_0x759c('0x16')](_0x759c('0x17'),{'id':_0x4583f3[_0x4dfaf0],'closed':!![]});}}})[_0x759c('0x18')](function(_0x272284){logger[_0x759c('0x19')](_0x759c('0x1a'),_0x272284?util['inspect'](_0x272284,{'showHidden':![],'depth':null}):'');});}exports[_0x759c('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 569fc83..5e5e774 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x273f=['log','CmHopper','bulkCreate','finished\x20populating','contacts2','hopper2','catch','util','../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','destroy','then'];(function(_0x56ce3a,_0x446032){var _0x5af0b4=function(_0x30678a){while(--_0x30678a){_0x56ce3a['push'](_0x56ce3a['shift']());}};_0x5af0b4(++_0x446032);}(_0x273f,0x181));var _0xf273=function(_0x330bd4,_0xaf82e3){_0x330bd4=_0x330bd4-0x0;var _0x3d6329=_0x273f[_0x330bd4];return _0x3d6329;};'use strict';var util=require(_0xf273('0x0'));var db=require(_0xf273('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xf273('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xf273('0x3')+i,'phone':0xf879fb460+i,'email':_0xf273('0x4')+i+_0xf273('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xf273('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xf273('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf273('0x6')](),'updatedAt':Date[_0xf273('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xf273('0x7')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}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[_0xf273('0x6')](),'updatedAt':Date['now']()});}db[_0xf273('0x8')][_0xf273('0x9')]({'where':{}})[_0xf273('0xa')](function(){return db[_0xf273('0x8')]['bulkCreate'](contacts);})[_0xf273('0xa')](function(){console[_0xf273('0xb')]('finished\x20populating','contacts1');return db[_0xf273('0xc')][_0xf273('0x9')]({'where':{}});})['then'](function(){return db[_0xf273('0xc')][_0xf273('0xd')](hopper);})[_0xf273('0xa')](function(){console['log'](_0xf273('0xe'),'hopper1');return db[_0xf273('0x8')]['bulkCreate'](contacts2);})[_0xf273('0xa')](function(){console[_0xf273('0xb')](_0xf273('0xe'),_0xf273('0xf'));return db['CmHopper']['bulkCreate'](hopper2);})[_0xf273('0xa')](function(){console[_0xf273('0xb')](_0xf273('0xe'),_0xf273('0x10'));})[_0xf273('0x11')](function(_0x515df7){console['log'](_0x515df7);}); \ No newline at end of file +var _0xe1c0=['finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','util','../mysqldb','Innocenzo','@xcally.com','push','now','Biondo','innocenzo.biondo','CmContact','destroy','then','bulkCreate','log'];(function(_0x295317,_0x46aebf){var _0x458246=function(_0x46f6ee){while(--_0x46f6ee){_0x295317['push'](_0x295317['shift']());}};_0x458246(++_0x46aebf);}(_0xe1c0,0x110));var _0x0e1c=function(_0x356bf0,_0x2315cf){_0x356bf0=_0x356bf0-0x0;var _0x480b0b=_0xe1c0[_0x356bf0];return _0x480b0b;};'use strict';var util=require(_0x0e1c('0x0'));var db=require(_0x0e1c('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x0e1c('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x0e1c('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x0e1c('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x0e1c('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0e1c('0x5')](),'updatedAt':Date[_0x0e1c('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x0e1c('0x4')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x0e1c('0x6')+i,'phone':0xf879fb460+i,'email':_0x0e1c('0x7')+i+_0x0e1c('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x0e1c('0x4')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0e1c('0x5')](),'updatedAt':Date[_0x0e1c('0x5')]()});}db[_0x0e1c('0x8')][_0x0e1c('0x9')]({'where':{}})[_0x0e1c('0xa')](function(){return db[_0x0e1c('0x8')][_0x0e1c('0xb')](contacts);})[_0x0e1c('0xa')](function(){console[_0x0e1c('0xc')](_0x0e1c('0xd'),_0x0e1c('0xe'));return db[_0x0e1c('0xf')][_0x0e1c('0x9')]({'where':{}});})[_0x0e1c('0xa')](function(){return db[_0x0e1c('0xf')][_0x0e1c('0xb')](hopper);})[_0x0e1c('0xa')](function(){console[_0x0e1c('0xc')](_0x0e1c('0xd'),_0x0e1c('0x10'));return db[_0x0e1c('0x8')][_0x0e1c('0xb')](contacts2);})[_0x0e1c('0xa')](function(){console[_0x0e1c('0xc')]('finished\x20populating',_0x0e1c('0x11'));return db[_0x0e1c('0xf')][_0x0e1c('0xb')](hopper2);})['then'](function(){console[_0x0e1c('0xc')](_0x0e1c('0xd'),_0x0e1c('0x12'));})['catch'](function(_0x412c9c){console[_0x0e1c('0xc')](_0x412c9c);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 3eedc13..e06ca81 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd18=['format','%s%s@xcally.com','password','friend','wss','all','ulaw','yes','\x22%s\x22\x20<%s>','User','bulkCreate','log','add\x20user','catch','util','push','%s%s','agent'];(function(_0x5581ba,_0x268887){var _0x1e927f=function(_0x1803b2){while(--_0x1803b2){_0x5581ba['push'](_0x5581ba['shift']());}};_0x1e927f(++_0x268887);}(_0xfd18,0x19a));var _0x8fd1=function(_0x8fc9d1,_0x55be5e){_0x8fc9d1=_0x8fc9d1-0x0;var _0x445c72=_0xfd18[_0x8fc9d1];return _0x445c72;};'use strict';var util=require(_0x8fd1('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x8fd1('0x1')]({'name':util['format'](_0x8fd1('0x2'),_0x8fd1('0x3'),i),'fullname':util[_0x8fd1('0x4')](_0x8fd1('0x2'),_0x8fd1('0x3'),i),'email':util['format'](_0x8fd1('0x5'),_0x8fd1('0x3'),i),'role':_0x8fd1('0x3'),'password':_0x8fd1('0x6'),'internal':0xfa0+i,'type':_0x8fd1('0x7'),'transport':['udp','ws',_0x8fd1('0x8')],'disallow':[_0x8fd1('0x9')],'allow':[_0x8fd1('0xa')],'defaultuser':util[_0x8fd1('0x4')](_0x8fd1('0x2'),_0x8fd1('0x3'),i),'encryption':_0x8fd1('0xb'),'avpf':_0x8fd1('0xb'),'force_avp':_0x8fd1('0xb'),'icesupport':_0x8fd1('0xb'),'dtlsenable':_0x8fd1('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0x8fd1('0x4')](_0x8fd1('0xc'),util[_0x8fd1('0x4')](_0x8fd1('0x2'),'agent',i),0xfa0+i)});}db[_0x8fd1('0xd')][_0x8fd1('0xe')](users)['then'](function(){console[_0x8fd1('0xf')](_0x8fd1('0x10'));})[_0x8fd1('0x11')](function(_0xfe38e1){console[_0x8fd1('0xf')](_0xfe38e1);}); \ No newline at end of file +var _0xed7a=['bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','agent','%s%s','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User'];(function(_0xcf5436,_0x4632c3){var _0xc4f5c8=function(_0x567528){while(--_0x567528){_0xcf5436['push'](_0xcf5436['shift']());}};_0xc4f5c8(++_0x4632c3);}(_0xed7a,0xb5));var _0xaed7=function(_0x40e16d,_0x57ec73){_0x40e16d=_0x40e16d-0x0;var _0x3d0d84=_0xed7a[_0x40e16d];return _0x3d0d84;};'use strict';var util=require(_0xaed7('0x0'));var db=require(_0xaed7('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xaed7('0x2')]({'name':util[_0xaed7('0x3')]('%s%s',_0xaed7('0x4'),i),'fullname':util[_0xaed7('0x3')](_0xaed7('0x5'),_0xaed7('0x4'),i),'email':util[_0xaed7('0x3')]('%s%s@xcally.com',_0xaed7('0x4'),i),'role':'agent','password':_0xaed7('0x6'),'internal':0xfa0+i,'type':_0xaed7('0x7'),'transport':[_0xaed7('0x8'),'ws',_0xaed7('0x9')],'disallow':[_0xaed7('0xa')],'allow':[_0xaed7('0xb')],'defaultuser':util['format'](_0xaed7('0x5'),_0xaed7('0x4'),i),'encryption':_0xaed7('0xc'),'avpf':_0xaed7('0xc'),'force_avp':'yes','icesupport':_0xaed7('0xc'),'dtlsenable':_0xaed7('0xc'),'dtlsverify':'no','dtlscertfile':_0xaed7('0xd'),'dtlsprivatekey':_0xaed7('0xe'),'dtlssetup':_0xaed7('0xf'),'callerid':util[_0xaed7('0x3')]('\x22%s\x22\x20<%s>',util['format']('%s%s',_0xaed7('0x4'),i),0xfa0+i)});}db[_0xaed7('0x10')][_0xaed7('0x11')](users)[_0xaed7('0x12')](function(){console[_0xaed7('0x13')](_0xaed7('0x14'));})[_0xaed7('0x15')](function(_0x4513b9){console[_0xaed7('0x13')](_0x4513b9);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 659e501..0a24e3b 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9851=['openchannel','whatsapp','telephone:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','emit','user_has_mail_interactions:remove','FaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','join','default','connection','address','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','UserProfileResource','resourceId','map','Campaign','where','%s:queue:%s','length','format','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','OpenchannelQueue','IvrCampaigns','voice:outbound','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getWhatsappQueues','voice','mail'];(function(_0x28f6fa,_0x4764e2){var _0x505e48=function(_0x41b303){while(--_0x41b303){_0x28f6fa['push'](_0x28f6fa['shift']());}};_0x505e48(++_0x4764e2);}(_0x9851,0x1f1));var _0x1985=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9851[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1985('0x0'));var util=require('util');var BPromise=require(_0x1985('0x1'));var db=require(_0x1985('0x2'))['db'];var config=require(_0x1985('0x3'));var queryQueues={'attributes':['id',_0x1985('0x4')],'include':[{'as':_0x1985('0x5'),'model':db[_0x1985('0x6')],'attributes':['id',_0x1985('0x4'),_0x1985('0x7')],'raw':!![],'where':{'role':_0x1985('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x1985('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x1985('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0x1985('0x4')],'where':{'role':_0x1985('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x1985('0x9')],'where':{'type':_0x1985('0xa')}};function getAssociatedResources(_0x566a27,_0x16bbec,_0x4cf7a7){return db[_0x1985('0xb')][_0x1985('0xc')]({'where':{'name':_0x566a27,'userProfileId':_0x16bbec},'raw':!![]})[_0x1985('0xd')](function(_0xea819d){if(_0xea819d){if(_0xea819d[_0x1985('0xe')]){switch(_0x566a27){case _0x1985('0xf'):case _0x1985('0x10'):case _0x1985('0x11'):case _0x1985('0x12'):case _0x1985('0x13'):case _0x1985('0x14'):case _0x1985('0x15'):return db[_0x4cf7a7]['findAll'](queryQueues);case _0x1985('0x16'):return db[_0x4cf7a7][_0x1985('0x17')](queryTelephones);case'Trunks':return db[_0x4cf7a7]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x4cf7a7][_0x1985('0x17')](queryCampaigns);}}else{return db[_0x1985('0x18')]['findAll']({'attributes':[_0x1985('0x19')],'where':{'sectionId':_0xea819d['id']},'raw':!![]})[_0x1985('0xd')](function(_0x131884){if(_0x131884){var _0x49ec6e={'where':{'id':_[_0x1985('0x1a')](_0x131884,'resourceId')},'raw':!![]};switch(_0x4cf7a7){case _0x1985('0x6'):_0x49ec6e['where'][_0x1985('0x7')]='telephone';break;case _0x1985('0x1b'):_0x49ec6e[_0x1985('0x1c')][_0x1985('0x9')]=_0x1985('0xa');break;}return db[_0x4cf7a7][_0x1985('0x17')](_0x49ec6e);}else{return[];}});}}else{return[];}})[_0x1985('0xd')](function(_0x285484){return _0x285484;});}function joinOrLeaveQueues(_0x112913,_0x54f2a8,_0xc216b3,_0x153de0){_0x112913[_0x54f2a8](util['format'](_0x1985('0x1d'),_0xc216b3,_0x153de0[_0x1985('0x4')]));if(_0x153de0[_0x1985('0x5')]){for(var _0x435422=0x0;_0x435422<_0x153de0[_0x1985('0x5')][_0x1985('0x1e')];_0x435422+=0x1){_0x112913[_0x54f2a8](util[_0x1985('0x1f')](_0x1985('0x20'),_0x153de0[_0x1985('0x5')][_0x435422][_0x1985('0x4')]));}}}function joinOrLeave(_0x102ced,_0x5506a7,_0xeac967){var _0x6d7358;if(_0x102ced[_0x1985('0x21')][_0x1985('0x22')]['id']){db[_0x1985('0x6')]['find']({'attributes':['id',_0x1985('0x4'),_0x1985('0x7'),_0x1985('0x23')],'where':{'id':_0x102ced[_0x1985('0x21')]['query']['id']},'include':[{'model':db[_0x1985('0x24')],'as':_0x1985('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x1985('0x26')],'as':_0x1985('0x27'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x1985('0x28')],'as':_0x1985('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x1985('0x2a')],'as':_0x1985('0x2b'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x1985('0x2c'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x5ed429){if(_0x5ed429){_0x6d7358=_0x5ed429;_0x102ced[_0x5506a7](util[_0x1985('0x1f')]('user:%s',_0x5ed429['name']));var _0x430211=[];switch(_0x5ed429[_0x1985('0x7')]){case _0x1985('0x2d'):_0x102ced[_0x5506a7](_0x1985('0x2e'));_0x102ced[_0x5506a7]('voice:outbound');if(queryQueues[_0x1985('0x2f')](_0x1985('0x30'))){delete queryQueues[_0x1985('0x30')];}_0x430211[_0x1985('0x31')](db[_0x1985('0x32')]['findAll'](queryQueues));_0x430211[_0x1985('0x31')](db[_0x1985('0x33')][_0x1985('0x17')](queryQueues));_0x430211[_0x1985('0x31')](db[_0x1985('0x34')][_0x1985('0x17')](queryQueues));_0x430211['push'](db[_0x1985('0x35')][_0x1985('0x17')](queryQueues));_0x430211[_0x1985('0x31')](db[_0x1985('0x36')]['findAll'](queryQueues));_0x430211[_0x1985('0x31')](db['OpenchannelQueue']['findAll'](queryQueues));_0x430211[_0x1985('0x31')](db[_0x1985('0x37')]['findAll'](queryQueues));_0x430211['push'](db[_0x1985('0x6')][_0x1985('0x17')](queryTelephones));_0x430211[_0x1985('0x31')](db[_0x1985('0x38')][_0x1985('0x17')](queryTrunks));_0x430211[_0x1985('0x31')](db[_0x1985('0x1b')][_0x1985('0x17')](queryCampaigns));_0x430211[_0x1985('0x31')](db[_0x1985('0x6')][_0x1985('0x17')](queryAgents));break;case'user':_0x102ced[_0x5506a7](_0x1985('0x2e'));_0x102ced[_0x5506a7]('voice:outbound');_0x430211['push'](getAssociatedResources('VoiceQueues',_0x5ed429[_0x1985('0x23')],_0x1985('0x32')));_0x430211['push'](getAssociatedResources(_0x1985('0x10'),_0x5ed429['userProfileId'],_0x1985('0x33')));_0x430211[_0x1985('0x31')](getAssociatedResources(_0x1985('0x11'),_0x5ed429['userProfileId'],_0x1985('0x34')));_0x430211['push'](getAssociatedResources(_0x1985('0x12'),_0x5ed429['userProfileId'],_0x1985('0x35')));_0x430211[_0x1985('0x31')](getAssociatedResources(_0x1985('0x13'),_0x5ed429[_0x1985('0x23')],_0x1985('0x36')));_0x430211['push'](getAssociatedResources(_0x1985('0x14'),_0x5ed429[_0x1985('0x23')],_0x1985('0x39')));_0x430211[_0x1985('0x31')](getAssociatedResources(_0x1985('0x15'),_0x5ed429['userProfileId'],'WhatsappQueue'));_0x430211[_0x1985('0x31')](getAssociatedResources('Telephones',_0x5ed429[_0x1985('0x23')],_0x1985('0x6')));_0x430211[_0x1985('0x31')](getAssociatedResources('Trunks',_0x5ed429['userProfileId'],_0x1985('0x38')));_0x430211[_0x1985('0x31')](getAssociatedResources(_0x1985('0x3a'),_0x5ed429['userProfileId'],'Campaign'));_0x430211[_0x1985('0x31')](db[_0x1985('0x6')][_0x1985('0x17')](queryAgents));break;case _0x1985('0x8'):_0x102ced[_0x5506a7](_0x1985('0x2e'));_0x102ced[_0x5506a7](_0x1985('0x3b'));_0x430211[_0x1985('0x31')](_0x5ed429[_0x1985('0x3c')]({'attributes':['id',_0x1985('0x4')]}));_0x430211[_0x1985('0x31')](_0x5ed429[_0x1985('0x3d')]({'attributes':['id',_0x1985('0x4')]}));_0x430211[_0x1985('0x31')](_0x5ed429[_0x1985('0x3e')]({'attributes':['id',_0x1985('0x4')]}));_0x430211[_0x1985('0x31')](_0x5ed429['getSmsQueues']({'attributes':['id','name']}));_0x430211['push'](_0x5ed429[_0x1985('0x3f')]({'attributes':['id',_0x1985('0x4')]}));_0x430211[_0x1985('0x31')](_0x5ed429['getOpenchannelQueues']({'attributes':['id',_0x1985('0x4')]}));_0x430211[_0x1985('0x31')](_0x5ed429[_0x1985('0x40')]({'attributes':['id','name']}));break;}return BPromise['all'](_0x430211);}})['then'](function(_0x4834bb){if(_0x4834bb&&_0x4834bb[_0x1985('0x1e')]){for(var _0x157fe8=0x0;_0x157fe8<_0x4834bb[_0x1985('0x1e')];_0x157fe8+=0x1){for(var _0x30406b=0x0;_0x30406b<_0x4834bb[_0x157fe8][_0x1985('0x1e')];_0x30406b+=0x1){switch(_0x157fe8){case 0x0:joinOrLeaveQueues(_0x102ced,_0x5506a7,_0x1985('0x41'),_0x4834bb[_0x157fe8][_0x30406b]);break;case 0x1:joinOrLeaveQueues(_0x102ced,_0x5506a7,'chat',_0x4834bb[_0x157fe8][_0x30406b]);break;case 0x2:joinOrLeaveQueues(_0x102ced,_0x5506a7,'fax',_0x4834bb[_0x157fe8][_0x30406b]);break;case 0x3:joinOrLeaveQueues(_0x102ced,_0x5506a7,'sms',_0x4834bb[_0x157fe8][_0x30406b]);break;case 0x4:joinOrLeaveQueues(_0x102ced,_0x5506a7,_0x1985('0x42'),_0x4834bb[_0x157fe8][_0x30406b]);break;case 0x5:joinOrLeaveQueues(_0x102ced,_0x5506a7,_0x1985('0x43'),_0x4834bb[_0x157fe8][_0x30406b]);break;case 0x6:joinOrLeaveQueues(_0x102ced,_0x5506a7,_0x1985('0x44'),_0x4834bb[_0x157fe8][_0x30406b]);break;case 0x7:if(_0x6d7358[_0x1985('0x7')]!==_0x1985('0x8'))_0x102ced[_0x5506a7](util[_0x1985('0x1f')](_0x1985('0x45'),_0x4834bb[_0x157fe8][_0x30406b][_0x1985('0x4')]));break;case 0x8:if(_0x6d7358[_0x1985('0x7')]!==_0x1985('0x8'))_0x102ced[_0x5506a7](util[_0x1985('0x1f')]('trunk:%s',_0x4834bb[_0x157fe8][_0x30406b][_0x1985('0x4')]));break;case 0x9:if(_0x6d7358['role']!==_0x1985('0x8'))_0x102ced[_0x5506a7](util[_0x1985('0x1f')]('campaign:%s:%s',_0x4834bb[_0x157fe8][_0x30406b][_0x1985('0x9')],_0x4834bb[_0x157fe8][_0x30406b][_0x1985('0x4')]));break;case 0xa:_0x102ced[_0x5506a7](util[_0x1985('0x1f')](_0x1985('0x20'),_0x4834bb[_0x157fe8][_0x30406b][_0x1985('0x4')]));break;}}}}})[_0x1985('0xd')](function(){if(_0x5506a7===_0x1985('0x46')){var _0x1b78bb=_['map'](_0x6d7358[_0x1985('0x25')],'id');return _0x6d7358[_0x1985('0x47')](_0x1b78bb)['then'](function(){for(var _0x375a99=0x0;_0x375a99<_0x1b78bb[_0x1985('0x1e')];_0x375a99+=0x1){_0xeac967['emit'](_0x1985('0x48'),{'ChatInteractionId':Number(_0x1b78bb[_0x375a99]),'UserId':Number(_0x6d7358['id'])});}});}})[_0x1985('0xd')](function(){if(_0x5506a7===_0x1985('0x46')){var _0x53fc65=_['map'](_0x6d7358[_0x1985('0x27')],'id');return _0x6d7358['removeMailInteractions'](_0x53fc65)[_0x1985('0xd')](function(){for(var _0x40819e=0x0;_0x40819e<_0x53fc65['length'];_0x40819e+=0x1){_0xeac967[_0x1985('0x49')](_0x1985('0x4a'),{'MailInteractionId':Number(_0x53fc65[_0x40819e]),'UserId':Number(_0x6d7358['id'])});}});}})[_0x1985('0xd')](function(){if(_0x5506a7===_0x1985('0x46')){var _0x26b231=_[_0x1985('0x1a')](_0x6d7358[_0x1985('0x4b')],'id');return _0x6d7358['removeFaxInteractions'](_0x26b231)[_0x1985('0xd')](function(){for(var _0x51a8b0=0x0;_0x51a8b0<_0x26b231[_0x1985('0x1e')];_0x51a8b0+=0x1){_0xeac967['emit'](_0x1985('0x4c'),{'FaxInteractionId':Number(_0x26b231[_0x51a8b0]),'UserId':Number(_0x6d7358['id'])});}});}})[_0x1985('0xd')](function(){if(_0x5506a7==='leave'){var _0x2603de=_[_0x1985('0x1a')](_0x6d7358[_0x1985('0x29')],'id');return _0x6d7358['removeSmsInteractions'](_0x2603de)[_0x1985('0xd')](function(){for(var _0x21c856=0x0;_0x21c856<_0x2603de[_0x1985('0x1e')];_0x21c856+=0x1){_0xeac967[_0x1985('0x49')](_0x1985('0x4d'),{'SmsInteractionId':Number(_0x2603de[_0x21c856]),'UserId':Number(_0x6d7358['id'])});}});}})[_0x1985('0xd')](function(){if(_0x5506a7==='leave'){var _0x4bc46a=_[_0x1985('0x1a')](_0x6d7358[_0x1985('0x2b')],'id');return _0x6d7358['removeOpenchannelInteractions'](_0x4bc46a)[_0x1985('0xd')](function(){for(var _0x31112c=0x0;_0x31112c<_0x4bc46a[_0x1985('0x1e')];_0x31112c+=0x1){_0xeac967[_0x1985('0x49')](_0x1985('0x4e'),{'OpenchannelInteractionId':Number(_0x4bc46a[_0x31112c]),'UserId':Number(_0x6d7358['id'])});}});}})[_0x1985('0xd')](function(){if(_0x5506a7==='leave'){var _0x3d5e46=_[_0x1985('0x1a')](_0x6d7358[_0x1985('0x2c')],'id');return _0x6d7358[_0x1985('0x4f')](_0x3d5e46)[_0x1985('0xd')](function(){for(var _0x31f4d0=0x0;_0x31f4d0<_0x3d5e46[_0x1985('0x1e')];_0x31f4d0+=0x1){_0xeac967['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x3d5e46[_0x31f4d0]),'UserId':Number(_0x6d7358['id'])});}});}})[_0x1985('0x50')](function(_0x311171){_0x102ced['log'](_0x311171);});}}function onDisconnect(_0x1ece48,_0x5d3bea){joinOrLeave(_0x1ece48,_0x1985('0x46'),_0x5d3bea);}function onConnect(_0x37467d){joinOrLeave(_0x37467d,_0x1985('0x51'));}exports[_0x1985('0x52')]=function(_0x307d96){_0x307d96['on'](_0x1985('0x53'),function(_0x460728){_0x460728['setMaxListeners'](0x0);_0x460728[_0x1985('0x54')]=_0x460728[_0x1985('0x55')][_0x1985('0x53')][_0x1985('0x56')]+':'+_0x460728[_0x1985('0x55')]['connection'][_0x1985('0x57')];_0x460728[_0x1985('0x58')]=new Date();_0x460728[_0x1985('0x59')]=function(_0x5f75aa){console[_0x1985('0x59')](_0x1985('0x5a')+_0x460728[_0x1985('0x5b')][_0x1985('0x4')]+'['+_0x460728[_0x1985('0x54')]+']',_0x5f75aa);};_0x460728['on']('disconnect',function(){onDisconnect(_0x460728,_0x307d96);_0x460728[_0x1985('0x59')](_0x1985('0x5c'));});onConnect(_0x460728);_0x460728[_0x1985('0x59')](_0x1985('0x5d'));});}; \ No newline at end of file +var _0x3759=['user_has_openchannel_interactions:remove','removeWhatsappInteractions','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','log','nsp','DISCONNECTED','lodash','util','bluebird','../mysqldb','./environment','User','name','agent','type','ivr','then','autoAssociation','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','resourceId','map','where','telephone','format','%s:queue:%s','Agents','length','user:%s','handshake','query','find','ChatInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','push','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user','VoiceQueues','userProfileId','VoiceQueue','MailQueue','OpenchannelQueues','Trunks','IvrCampaigns','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','fax','mail','openchannel','role','telephone:%s','trunk:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions'];(function(_0x134cab,_0xdcaa87){var _0xe5a8ab=function(_0x1d1ef5){while(--_0x1d1ef5){_0x134cab['push'](_0x134cab['shift']());}};_0xe5a8ab(++_0xdcaa87);}(_0x3759,0x131));var _0x9375=function(_0x1a3e75,_0x4e1afa){_0x1a3e75=_0x1a3e75-0x0;var _0x1b0227=_0x3759[_0x1a3e75];return _0x1b0227;};'use strict';var _=require(_0x9375('0x0'));var util=require(_0x9375('0x1'));var BPromise=require(_0x9375('0x2'));var db=require(_0x9375('0x3'))['db'];var config=require(_0x9375('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0x9375('0x5')],'attributes':['id',_0x9375('0x6'),'role'],'raw':!![],'where':{'role':_0x9375('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x9375('0x6')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x9375('0x6')]};var queryAgents={'raw':!![],'attributes':['id',_0x9375('0x6')],'where':{'role':_0x9375('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x9375('0x6'),_0x9375('0x8')],'where':{'type':_0x9375('0x9')}};function getAssociatedResources(_0x3d8bc8,_0x44fa56,_0x5798fe){return db['UserProfileSection']['findOne']({'where':{'name':_0x3d8bc8,'userProfileId':_0x44fa56},'raw':!![]})[_0x9375('0xa')](function(_0x14c75c){if(_0x14c75c){if(_0x14c75c[_0x9375('0xb')]){switch(_0x3d8bc8){case'VoiceQueues':case _0x9375('0xc'):case _0x9375('0xd'):case _0x9375('0xe'):case _0x9375('0xf'):case'OpenchannelQueues':case _0x9375('0x10'):return db[_0x5798fe][_0x9375('0x11')](queryQueues);case _0x9375('0x12'):return db[_0x5798fe][_0x9375('0x11')](queryTelephones);case'Trunks':return db[_0x5798fe]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x5798fe][_0x9375('0x11')](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':[_0x9375('0x13')],'where':{'sectionId':_0x14c75c['id']},'raw':!![]})[_0x9375('0xa')](function(_0x1e58e4){if(_0x1e58e4){var _0x58c8ea={'where':{'id':_[_0x9375('0x14')](_0x1e58e4,'resourceId')},'raw':!![]};switch(_0x5798fe){case _0x9375('0x5'):_0x58c8ea[_0x9375('0x15')]['role']=_0x9375('0x16');break;case'Campaign':_0x58c8ea['where'][_0x9375('0x8')]=_0x9375('0x9');break;}return db[_0x5798fe][_0x9375('0x11')](_0x58c8ea);}else{return[];}});}}else{return[];}})[_0x9375('0xa')](function(_0x5eb935){return _0x5eb935;});}function joinOrLeaveQueues(_0x18d80c,_0x3012e1,_0x4d1882,_0x19146f){_0x18d80c[_0x3012e1](util[_0x9375('0x17')](_0x9375('0x18'),_0x4d1882,_0x19146f[_0x9375('0x6')]));if(_0x19146f['Agents']){for(var _0x298a8b=0x0;_0x298a8b<_0x19146f[_0x9375('0x19')][_0x9375('0x1a')];_0x298a8b+=0x1){_0x18d80c[_0x3012e1](util[_0x9375('0x17')](_0x9375('0x1b'),_0x19146f[_0x9375('0x19')][_0x298a8b][_0x9375('0x6')]));}}}function joinOrLeave(_0x548b78,_0x4ccc28,_0x273091){var _0x1c36b0;if(_0x548b78[_0x9375('0x1c')][_0x9375('0x1d')]['id']){db[_0x9375('0x5')][_0x9375('0x1e')]({'attributes':['id',_0x9375('0x6'),'role','userProfileId'],'where':{'id':_0x548b78[_0x9375('0x1c')][_0x9375('0x1d')]['id']},'include':[{'model':db[_0x9375('0x1f')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x9375('0x20'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x9375('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x9375('0x22')],'as':_0x9375('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x9375('0x24')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9375('0x25')],'as':_0x9375('0x26'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x39f75c){if(_0x39f75c){_0x1c36b0=_0x39f75c;_0x548b78[_0x4ccc28](util[_0x9375('0x17')](_0x9375('0x1b'),_0x39f75c[_0x9375('0x6')]));var _0x5d990b=[];switch(_0x39f75c['role']){case _0x9375('0x27'):_0x548b78[_0x4ccc28](_0x9375('0x28'));_0x548b78[_0x4ccc28](_0x9375('0x29'));if(queryQueues['hasOwnProperty'](_0x9375('0x2a'))){delete queryQueues[_0x9375('0x2a')];}_0x5d990b['push'](db['VoiceQueue'][_0x9375('0x11')](queryQueues));_0x5d990b[_0x9375('0x2b')](db[_0x9375('0x2c')][_0x9375('0x11')](queryQueues));_0x5d990b['push'](db[_0x9375('0x2d')][_0x9375('0x11')](queryQueues));_0x5d990b['push'](db[_0x9375('0x2e')]['findAll'](queryQueues));_0x5d990b['push'](db['MailQueue']['findAll'](queryQueues));_0x5d990b[_0x9375('0x2b')](db[_0x9375('0x2f')][_0x9375('0x11')](queryQueues));_0x5d990b['push'](db[_0x9375('0x30')][_0x9375('0x11')](queryQueues));_0x5d990b[_0x9375('0x2b')](db[_0x9375('0x5')][_0x9375('0x11')](queryTelephones));_0x5d990b['push'](db[_0x9375('0x31')][_0x9375('0x11')](queryTrunks));_0x5d990b[_0x9375('0x2b')](db[_0x9375('0x32')]['findAll'](queryCampaigns));_0x5d990b[_0x9375('0x2b')](db[_0x9375('0x5')]['findAll'](queryAgents));break;case _0x9375('0x33'):_0x548b78[_0x4ccc28](_0x9375('0x28'));_0x548b78[_0x4ccc28](_0x9375('0x29'));_0x5d990b['push'](getAssociatedResources(_0x9375('0x34'),_0x39f75c[_0x9375('0x35')],_0x9375('0x36')));_0x5d990b['push'](getAssociatedResources('ChatQueues',_0x39f75c[_0x9375('0x35')],_0x9375('0x2c')));_0x5d990b[_0x9375('0x2b')](getAssociatedResources(_0x9375('0xd'),_0x39f75c[_0x9375('0x35')],_0x9375('0x2d')));_0x5d990b['push'](getAssociatedResources(_0x9375('0xe'),_0x39f75c['userProfileId'],_0x9375('0x2e')));_0x5d990b['push'](getAssociatedResources('MailQueues',_0x39f75c[_0x9375('0x35')],_0x9375('0x37')));_0x5d990b[_0x9375('0x2b')](getAssociatedResources(_0x9375('0x38'),_0x39f75c[_0x9375('0x35')],_0x9375('0x2f')));_0x5d990b[_0x9375('0x2b')](getAssociatedResources('WhatsappQueues',_0x39f75c[_0x9375('0x35')],_0x9375('0x30')));_0x5d990b['push'](getAssociatedResources(_0x9375('0x12'),_0x39f75c[_0x9375('0x35')],_0x9375('0x5')));_0x5d990b[_0x9375('0x2b')](getAssociatedResources(_0x9375('0x39'),_0x39f75c[_0x9375('0x35')],_0x9375('0x31')));_0x5d990b[_0x9375('0x2b')](getAssociatedResources(_0x9375('0x3a'),_0x39f75c[_0x9375('0x35')],_0x9375('0x32')));_0x5d990b[_0x9375('0x2b')](db[_0x9375('0x5')][_0x9375('0x11')](queryAgents));break;case _0x9375('0x7'):_0x548b78[_0x4ccc28]('voice:inbound');_0x548b78[_0x4ccc28](_0x9375('0x29'));_0x5d990b[_0x9375('0x2b')](_0x39f75c[_0x9375('0x3b')]({'attributes':['id','name']}));_0x5d990b[_0x9375('0x2b')](_0x39f75c[_0x9375('0x3c')]({'attributes':['id',_0x9375('0x6')]}));_0x5d990b['push'](_0x39f75c['getFaxQueues']({'attributes':['id',_0x9375('0x6')]}));_0x5d990b[_0x9375('0x2b')](_0x39f75c[_0x9375('0x3d')]({'attributes':['id',_0x9375('0x6')]}));_0x5d990b[_0x9375('0x2b')](_0x39f75c[_0x9375('0x3e')]({'attributes':['id',_0x9375('0x6')]}));_0x5d990b[_0x9375('0x2b')](_0x39f75c[_0x9375('0x3f')]({'attributes':['id',_0x9375('0x6')]}));_0x5d990b['push'](_0x39f75c[_0x9375('0x40')]({'attributes':['id','name']}));break;}return BPromise[_0x9375('0x41')](_0x5d990b);}})[_0x9375('0xa')](function(_0x226ad3){if(_0x226ad3&&_0x226ad3['length']){for(var _0x87ee2c=0x0;_0x87ee2c<_0x226ad3['length'];_0x87ee2c+=0x1){for(var _0x1b3d8e=0x0;_0x1b3d8e<_0x226ad3[_0x87ee2c]['length'];_0x1b3d8e+=0x1){switch(_0x87ee2c){case 0x0:joinOrLeaveQueues(_0x548b78,_0x4ccc28,'voice',_0x226ad3[_0x87ee2c][_0x1b3d8e]);break;case 0x1:joinOrLeaveQueues(_0x548b78,_0x4ccc28,_0x9375('0x42'),_0x226ad3[_0x87ee2c][_0x1b3d8e]);break;case 0x2:joinOrLeaveQueues(_0x548b78,_0x4ccc28,_0x9375('0x43'),_0x226ad3[_0x87ee2c][_0x1b3d8e]);break;case 0x3:joinOrLeaveQueues(_0x548b78,_0x4ccc28,'sms',_0x226ad3[_0x87ee2c][_0x1b3d8e]);break;case 0x4:joinOrLeaveQueues(_0x548b78,_0x4ccc28,_0x9375('0x44'),_0x226ad3[_0x87ee2c][_0x1b3d8e]);break;case 0x5:joinOrLeaveQueues(_0x548b78,_0x4ccc28,_0x9375('0x45'),_0x226ad3[_0x87ee2c][_0x1b3d8e]);break;case 0x6:joinOrLeaveQueues(_0x548b78,_0x4ccc28,'whatsapp',_0x226ad3[_0x87ee2c][_0x1b3d8e]);break;case 0x7:if(_0x1c36b0[_0x9375('0x46')]!==_0x9375('0x7'))_0x548b78[_0x4ccc28](util['format'](_0x9375('0x47'),_0x226ad3[_0x87ee2c][_0x1b3d8e][_0x9375('0x6')]));break;case 0x8:if(_0x1c36b0[_0x9375('0x46')]!=='agent')_0x548b78[_0x4ccc28](util['format'](_0x9375('0x48'),_0x226ad3[_0x87ee2c][_0x1b3d8e][_0x9375('0x6')]));break;case 0x9:if(_0x1c36b0['role']!==_0x9375('0x7'))_0x548b78[_0x4ccc28](util[_0x9375('0x17')]('campaign:%s:%s',_0x226ad3[_0x87ee2c][_0x1b3d8e]['type'],_0x226ad3[_0x87ee2c][_0x1b3d8e][_0x9375('0x6')]));break;case 0xa:_0x548b78[_0x4ccc28](util[_0x9375('0x17')]('user:%s',_0x226ad3[_0x87ee2c][_0x1b3d8e][_0x9375('0x6')]));break;}}}}})[_0x9375('0xa')](function(){if(_0x4ccc28===_0x9375('0x49')){var _0x25abb6=_[_0x9375('0x14')](_0x1c36b0[_0x9375('0x4a')],'id');return _0x1c36b0[_0x9375('0x4b')](_0x25abb6)[_0x9375('0xa')](function(){for(var _0x40aaba=0x0;_0x40aaba<_0x25abb6['length'];_0x40aaba+=0x1){_0x273091[_0x9375('0x4c')](_0x9375('0x4d'),{'ChatInteractionId':Number(_0x25abb6[_0x40aaba]),'UserId':Number(_0x1c36b0['id'])});}});}})[_0x9375('0xa')](function(){if(_0x4ccc28==='leave'){var _0x301fc9=_['map'](_0x1c36b0[_0x9375('0x20')],'id');return _0x1c36b0[_0x9375('0x4e')](_0x301fc9)[_0x9375('0xa')](function(){for(var _0x1f9c3b=0x0;_0x1f9c3b<_0x301fc9[_0x9375('0x1a')];_0x1f9c3b+=0x1){_0x273091[_0x9375('0x4c')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x301fc9[_0x1f9c3b]),'UserId':Number(_0x1c36b0['id'])});}});}})[_0x9375('0xa')](function(){if(_0x4ccc28===_0x9375('0x49')){var _0x43dd0b=_[_0x9375('0x14')](_0x1c36b0[_0x9375('0x21')],'id');return _0x1c36b0['removeFaxInteractions'](_0x43dd0b)[_0x9375('0xa')](function(){for(var _0xf123e5=0x0;_0xf123e5<_0x43dd0b[_0x9375('0x1a')];_0xf123e5+=0x1){_0x273091['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x43dd0b[_0xf123e5]),'UserId':Number(_0x1c36b0['id'])});}});}})[_0x9375('0xa')](function(){if(_0x4ccc28===_0x9375('0x49')){var _0x5bcf82=_['map'](_0x1c36b0['SmsInteractions'],'id');return _0x1c36b0[_0x9375('0x4f')](_0x5bcf82)[_0x9375('0xa')](function(){for(var _0x9440ec=0x0;_0x9440ec<_0x5bcf82['length'];_0x9440ec+=0x1){_0x273091[_0x9375('0x4c')](_0x9375('0x50'),{'SmsInteractionId':Number(_0x5bcf82[_0x9440ec]),'UserId':Number(_0x1c36b0['id'])});}});}})['then'](function(){if(_0x4ccc28===_0x9375('0x49')){var _0x1dab1c=_[_0x9375('0x14')](_0x1c36b0[_0x9375('0x51')],'id');return _0x1c36b0[_0x9375('0x52')](_0x1dab1c)['then'](function(){for(var _0x1df024=0x0;_0x1df024<_0x1dab1c[_0x9375('0x1a')];_0x1df024+=0x1){_0x273091[_0x9375('0x4c')](_0x9375('0x53'),{'OpenchannelInteractionId':Number(_0x1dab1c[_0x1df024]),'UserId':Number(_0x1c36b0['id'])});}});}})[_0x9375('0xa')](function(){if(_0x4ccc28===_0x9375('0x49')){var _0x58e412=_['map'](_0x1c36b0[_0x9375('0x26')],'id');return _0x1c36b0[_0x9375('0x54')](_0x58e412)['then'](function(){for(var _0x3680b8=0x0;_0x3680b8<_0x58e412[_0x9375('0x1a')];_0x3680b8+=0x1){_0x273091[_0x9375('0x4c')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x58e412[_0x3680b8]),'UserId':Number(_0x1c36b0['id'])});}});}})['catch'](function(_0x5f169d){_0x548b78['log'](_0x5f169d);});}}function onDisconnect(_0x192979,_0x36b41b){joinOrLeave(_0x192979,_0x9375('0x49'),_0x36b41b);}function onConnect(_0x91d140){joinOrLeave(_0x91d140,_0x9375('0x55'));}exports[_0x9375('0x56')]=function(_0x5a935b){_0x5a935b['on'](_0x9375('0x57'),function(_0x1e52e6){_0x1e52e6[_0x9375('0x58')](0x0);_0x1e52e6[_0x9375('0x59')]=_0x1e52e6[_0x9375('0x5a')][_0x9375('0x57')][_0x9375('0x5b')]+':'+_0x1e52e6[_0x9375('0x5a')][_0x9375('0x57')][_0x9375('0x5c')];_0x1e52e6[_0x9375('0x5d')]=new Date();_0x1e52e6['log']=function(_0x4e0284){console[_0x9375('0x5e')]('SocketIO\x20'+_0x1e52e6[_0x9375('0x5f')]['name']+'['+_0x1e52e6[_0x9375('0x59')]+']',_0x4e0284);};_0x1e52e6['on']('disconnect',function(){onDisconnect(_0x1e52e6,_0x5a935b);_0x1e52e6[_0x9375('0x5e')](_0x9375('0x60'));});onConnect(_0x1e52e6);_0x1e52e6[_0x9375('0x5e')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 6d8d926..dd8dd22 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 _0x7802=['undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','query','Sequelize','SELECT','contact','UserId','interface','format','SIP/%s','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','opened','ContactId','sequelize','QueryTypes','AfterCreate','changed','closed','substatus','AfterUpdate','find','fullname','email','default','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','closedinteraction','SmsMessage','WhatsappInteraction','Whatsapp','WhatsappMessage','FaxInteraction','Fax','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','afterUpdate','OpenchannelMessage','request','then','info','Trigger,\x20%s','EventManager','error','code','catch','get','channel','motionChannel','event','direction','resolve'];(function(_0x55d8fe,_0x771a79){var _0x3d6ccd=function(_0xec96ac){while(--_0xec96ac){_0x55d8fe['push'](_0x55d8fe['shift']());}};_0x3d6ccd(++_0x771a79);}(_0x7802,0xbf));var _0x2780=function(_0x3e5595,_0xbe4275){_0x3e5595=_0x3e5595-0x0;var _0x3fd3a6=_0x7802[_0x3e5595];return _0x3fd3a6;};'use strict';var util=require(_0x2780('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0x2780('0x1'));var logger=require(_0x2780('0x2'))(_0x2780('0x3'));var client=jayson[_0x2780('0x4')][_0x2780('0x5')]({'port':0x232a});var triggers=[{'channel':_0x2780('0x6'),'model':_0x2780('0x7'),'event':_0x2780('0x8'),'condition':_0x2780('0x9'),'callback':afterCreate},{'channel':_0x2780('0x6'),'model':'ChatInteraction','event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x2780('0x6'),'model':_0x2780('0xa'),'event':'afterCreate','condition':_0x2780('0xb'),'callback':afterCreateMessage},{'channel':_0x2780('0x6'),'model':_0x2780('0xc'),'event':_0x2780('0x8'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0x2780('0xd'),'model':_0x2780('0xe'),'event':_0x2780('0x8'),'condition':_0x2780('0x9'),'callback':afterCreate},{'channel':_0x2780('0xd'),'model':_0x2780('0xe'),'event':'afterUpdate','condition':_0x2780('0xf'),'callback':afterUpdate},{'channel':'Sms','model':_0x2780('0x10'),'event':_0x2780('0x8'),'condition':_0x2780('0xb'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x2780('0x11'),'event':'afterCreate','condition':_0x2780('0x9'),'callback':afterCreate},{'channel':'Whatsapp','model':_0x2780('0x11'),'event':'afterUpdate','condition':_0x2780('0xf'),'callback':afterUpdate},{'channel':_0x2780('0x12'),'model':_0x2780('0x13'),'event':_0x2780('0x8'),'condition':_0x2780('0xb'),'callback':afterCreateMessage},{'channel':'Fax','model':_0x2780('0x14'),'event':_0x2780('0x8'),'condition':_0x2780('0x9'),'callback':afterCreate},{'channel':_0x2780('0x15'),'model':_0x2780('0x14'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x2780('0x15'),'model':'FaxMessage','event':_0x2780('0x8'),'condition':_0x2780('0xb'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x2780('0x16'),'event':'afterCreate','condition':_0x2780('0x9'),'callback':afterCreate},{'channel':_0x2780('0x17'),'model':_0x2780('0x16'),'event':'afterUpdate','condition':_0x2780('0xf'),'callback':afterUpdate},{'channel':_0x2780('0x17'),'model':_0x2780('0x18'),'event':_0x2780('0x8'),'condition':_0x2780('0xb'),'callback':afterCreateMessage},{'channel':_0x2780('0x19'),'model':'OpenchannelInteraction','event':_0x2780('0x8'),'condition':_0x2780('0x9'),'callback':afterCreate},{'channel':_0x2780('0x19'),'model':_0x2780('0x1a'),'event':_0x2780('0x1b'),'condition':_0x2780('0xf'),'callback':afterUpdate},{'channel':_0x2780('0x19'),'model':_0x2780('0x1c'),'event':_0x2780('0x8'),'condition':_0x2780('0xb'),'callback':afterCreateMessage}];function request(_0x2c99b8){return client[_0x2780('0x1d')]('EventManager',_0x2c99b8)[_0x2780('0x1e')](function(_0x18d1a2){logger[_0x2780('0x1f')](_0x2780('0x20'),_0x2780('0x21'),_0x18d1a2);if(_0x18d1a2[_0x2780('0x22')]){if(_0x18d1a2[_0x2780('0x22')][_0x2780('0x23')]===0x1f4){logger[_0x2780('0x22')]('Trigger,\x20%s','EventManager',_0x18d1a2[_0x2780('0x22')]);}}})[_0x2780('0x24')](function(_0x1c1ce3){logger[_0x2780('0x22')]('Trigger,\x20%s',_0x2780('0x21'),_0x1c1ce3);});}function afterCreateMessage(_0x304ef9){return function(_0x44c851){_0x44c851=_0x44c851[_0x2780('0x25')]({'plain':!![]});_0x44c851[_0x2780('0x26')]=_0x304ef9;_0x44c851[_0x2780('0x27')]=_0x304ef9;_0x44c851[_0x2780('0x28')]=_0x44c851[_0x2780('0x29')];Promise[_0x2780('0x2a')]()[_0x2780('0x1e')](function(){if(typeof _0x44c851['ContactId']===_0x2780('0x2b'))return null;var _0x1d1351=_0x2780('0x2c')+_0x44c851['ContactId'];return db['sequelize'][_0x2780('0x2d')](_0x1d1351,{'type':db[_0x2780('0x2e')]['QueryTypes'][_0x2780('0x2f')],'raw':!![]});})[_0x2780('0x1e')](function(_0x259bce){if(_0x259bce){_0x44c851[_0x2780('0x30')]=_0x259bce[0x0];}if(typeof _0x44c851[_0x2780('0x31')]===_0x2780('0x2b'))return;return getAgent(_0x44c851['UserId']);})[_0x2780('0x1e')](function(_0x25fc71){if(_0x25fc71){_0x44c851[_0x2780('0x32')]=util[_0x2780('0x33')](_0x2780('0x34'),_0x25fc71[_0x2780('0x35')]);_0x44c851[_0x2780('0x36')]=_0x25fc71;_0x44c851[_0x2780('0x26')]=_0x304ef9;return request({'event':_0x2780('0x37'),'message':_0x44c851});}else{return request({'event':_0x2780('0x38'),'message':_0x44c851});}})[_0x2780('0x24')](function(_0x22fa1a){logger[_0x2780('0x22')]('Trigger,\x20%s',_0x2780('0x39'),_0x22fa1a);});};}function afterCreateOfflineMessage(_0x206728){return function(_0xa69924){_0xa69924=_0xa69924[_0x2780('0x25')]({'plain':!![]});_0xa69924['channel']=_0x206728;_0xa69924[_0x2780('0x27')]=_0x206728;_0xa69924[_0x2780('0x28')]=_0x2780('0x3a');return request({'event':_0xa69924[_0x2780('0x28')],'message':_0xa69924});};}function afterCreate(_0x31c97b,_0x1d6337){return function(_0x4e137b){_0x4e137b=_0x4e137b[_0x2780('0x25')]({'plain':!![]});_0x4e137b['channel']=_0x31c97b;_0x4e137b['motionChannel']=_0x31c97b;_0x4e137b['event']=_0x2780('0x3b');Promise['resolve']()[_0x2780('0x1e')](function(){var _0x374e57='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e137b[_0x2780('0x3c')];return db[_0x2780('0x3d')]['query'](_0x374e57,{'type':db['Sequelize'][_0x2780('0x3e')][_0x2780('0x2f')],'raw':!![]});})[_0x2780('0x1e')](function(_0x369f07){if(_0x369f07){_0x4e137b[_0x2780('0x30')]=_0x369f07[0x0];}if(typeof _0x4e137b[_0x2780('0x31')]===_0x2780('0x2b'))return;return getAgent(_0x4e137b[_0x2780('0x31')]);})[_0x2780('0x1e')](function(_0x27110d){if(_0x27110d){_0x4e137b[_0x2780('0x32')]=util[_0x2780('0x33')]('SIP/%s',_0x27110d['name']);_0x4e137b[_0x2780('0x36')]=_0x27110d;}return request({'event':_0x1d6337,'message':_0x4e137b});})[_0x2780('0x24')](function(_0x298092){logger[_0x2780('0x22')](_0x2780('0x20'),_0x2780('0x3f'),_0x298092);});};}function afterUpdate(_0x14867f){return function(_0x2ca8a3){var _0x9f8347=_0x2ca8a3[_0x2780('0x40')](_0x2780('0x41'))&&_0x2ca8a3[_0x2780('0x41')];var _0x26d3cb=_0x2ca8a3['changed'](_0x2780('0x42'));if(_0x9f8347||_0x26d3cb){var _0x2a7ca3=_0x9f8347?'closedinteraction':_0x2780('0x42');var _0x278a06=_0x2ca8a3[_0x2780('0x25')]({'plain':!![]});_0x278a06['channel']=_0x14867f;_0x278a06[_0x2780('0x27')]=_0x14867f;_0x278a06['event']=_0x9f8347?_0x2780('0x41'):_0x2780('0x42');var _0x45dc6f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x278a06[_0x2780('0x3c')];return db[_0x2780('0x3d')][_0x2780('0x2d')](_0x45dc6f,{'type':db[_0x2780('0x2e')][_0x2780('0x3e')][_0x2780('0x2f')],'raw':!![]})[_0x2780('0x1e')](function(_0x1ce2ad){if(_0x1ce2ad){_0x278a06[_0x2780('0x30')]=_0x1ce2ad[0x0];}if(typeof _0x278a06[_0x2780('0x31')]==='undefined')return;return getAgent(_0x278a06[_0x2780('0x31')]);})['then'](function(_0x49678b){if(_0x49678b){_0x278a06[_0x2780('0x32')]=util['format'](_0x2780('0x34'),_0x49678b[_0x2780('0x35')]);_0x278a06[_0x2780('0x36')]=_0x49678b;}return request({'event':_0x2a7ca3,'message':_0x278a06});})[_0x2780('0x24')](function(_0xb3b933){logger['error'](_0x2780('0x20'),_0x2780('0x43'),_0xb3b933);});}};}function getAgent(_0x45ffca){return db['User'][_0x2780('0x44')]({'where':{'id':_0x45ffca},'attributes':['id',_0x2780('0x35'),_0x2780('0x45'),_0x2780('0x46'),'internal'],'raw':!![]})[_0x2780('0x1e')](function(_0x37ccd3){return _0x37ccd3;});}exports[_0x2780('0x47')]=function(){for(var _0x1aa9df=0x0;_0x1aa9df=_0xf9e552[_0xbbc9('0x18')]){throw Error(_0xbbc9('0x19'));}_0x4f95c6(_0xf48c7f);})[_0xbbc9('0x1a')](function(_0x49ecdf){_0x98fcec(_0x49ecdf);});});}; \ No newline at end of file +var _0x9931=['clearBlockUser','isUndefined','blockedAt','updateAttributes','role','agent','count','then','agents','catch','lodash','../mysqldb','./license/util','voice','chat','fax','sms','whatsapp','openchannel','toLowerCase','includes'];(function(_0x53cbda,_0x2f5cc7){var _0x142465=function(_0x4a07be){while(--_0x4a07be){_0x53cbda['push'](_0x53cbda['shift']());}};_0x142465(++_0x2f5cc7);}(_0x9931,0x1c3));var _0x1993=function(_0x366674,_0x590e4c){_0x366674=_0x366674-0x0;var _0x152f8e=_0x9931[_0x366674];return _0x152f8e;};'use strict';var _=require(_0x1993('0x0'));var BPromise=require('bluebird');var db=require(_0x1993('0x1'))['db'];var util=require(_0x1993('0x2'));var channels=[_0x1993('0x3'),'mail',_0x1993('0x4'),_0x1993('0x5'),_0x1993('0x6'),_0x1993('0x7'),_0x1993('0x8')];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0x58fa10){_0x58fa10=_0x58fa10[_0x1993('0x9')]();return _[_0x1993('0xa')](channels,_0x58fa10);};exports[_0x1993('0xb')]=function(_0x2da079,_0x579b65,_0x83938c,_0x5a1ae9){var _0x505ee8={'loginAttempts':_0x579b65,'blocked':_0x83938c};if(!_[_0x1993('0xc')](_0x5a1ae9)){_0x505ee8[_0x1993('0xd')]=_0x5a1ae9;}return _0x2da079[_0x1993('0xe')](_0x505ee8);};exports['getLicense']=function(_0x43eb62){return new BPromise(function(_0x1af745,_0x102905){var _0x1f9706=0x0;if(_0x43eb62[_0x1993('0xf')]!==_0x1993('0x10')){_0x1af745(_0x43eb62);}db['User'][_0x1993('0x11')]({'where':{'role':_0x1993('0x10'),'online':!![],'id':{'$ne':_0x43eb62['id']}}})[_0x1993('0x12')](function(_0x3fdad4){_0x1f9706=_0x3fdad4;return util['getLicense']();})[_0x1993('0x12')](function(_0x5b5f1b){if(_0x5b5f1b&&_0x5b5f1b[_0x1993('0x13')]&&_0x1f9706>=_0x5b5f1b['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x1af745(_0x43eb62);})[_0x1993('0x14')](function(_0x56a7df){_0x102905(_0x56a7df);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index fda2292..3cd5d57 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbfa5=['stack','statusMessage','status','send','exports','api','Internal\x20Server\x20Error','Error','message','Bad\x20Request','name','inherits','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','OutOfInterval','Conflict','error'];(function(_0x5a3785,_0x2de636){var _0x4d058a=function(_0x2852fc){while(--_0x2852fc){_0x5a3785['push'](_0x5a3785['shift']());}};_0x4d058a(++_0x2de636);}(_0xbfa5,0x1be));var _0x5bfa=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xbfa5[_0x7e2eb0];return _0xd92de4;};'use strict';var util=require('util');var logger=require('../config/logger')(_0x5bfa('0x0'));var APIError=function(_0x48f71e,_0x2c1c43){this['message']=_0x48f71e||_0x5bfa('0x1');this['name']=_0x2c1c43||_0x5bfa('0x2');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x3adf5b){this[_0x5bfa('0x3')]=_0x3adf5b||_0x5bfa('0x4');this[_0x5bfa('0x5')]=_0x5bfa('0x4');util[_0x5bfa('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x204e59){this[_0x5bfa('0x3')]=_0x204e59||_0x5bfa('0x7');this[_0x5bfa('0x5')]=_0x5bfa('0x7');util[_0x5bfa('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x2e8e9d){this[_0x5bfa('0x3')]=_0x2e8e9d||_0x5bfa('0x8');this[_0x5bfa('0x5')]=_0x5bfa('0x9');util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0xe3f06c){this[_0x5bfa('0x3')]=_0xe3f06c||_0x5bfa('0xa');this[_0x5bfa('0x5')]=_0x5bfa('0xb');this[_0x5bfa('0xc')]=0x193;this['details']={'type':_0x5bfa('0xd')};util[_0x5bfa('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x160fcd){this[_0x5bfa('0x3')]=_0x160fcd||'Resource\x20Conflict';this['name']='Conflict';util[_0x5bfa('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x2fc3d8){switch(_0x2fc3d8){case _0x5bfa('0x4'):return 0x190;case'Forbidden',_0x5bfa('0xb'):return 0x193;case _0x5bfa('0x9'):return 0x194;case _0x5bfa('0xe'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x1f731a){if(_0x1f731a===_0x5bfa('0xb'))return _0x1f731a;return null;}function handleError(_0x2bff63){return function(_0x2efbfe){logger[_0x5bfa('0xf')](_0x2efbfe[_0x5bfa('0x10')]);var _0x332f4f=getStatusCode(_0x2efbfe['name']);var _0x5b0ecd=getCustomStatusMessage(_0x2efbfe[_0x5bfa('0x5')]);if(_0x2efbfe[_0x5bfa('0x5')]){delete _0x2efbfe[_0x5bfa('0x5')];}if(_0x5b0ecd){_0x2bff63[_0x5bfa('0x11')]=_0x5b0ecd;}return _0x2bff63[_0x5bfa('0x12')](_0x332f4f)[_0x5bfa('0x13')](_0x2efbfe);};}module[_0x5bfa('0x14')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x7401=['Conflict','Out\x20Of\x20Interval','error','stack','statusMessage','send','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','inherits','Bad\x20Request','name','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','code','Resource\x20Conflict'];(function(_0x33b1f2,_0x39c940){var _0x487207=function(_0x411157){while(--_0x411157){_0x33b1f2['push'](_0x33b1f2['shift']());}};_0x487207(++_0x39c940);}(_0x7401,0xaf));var _0x1740=function(_0x287ee2,_0x339134){_0x287ee2=_0x287ee2-0x0;var _0x40e98b=_0x7401[_0x287ee2];return _0x40e98b;};'use strict';var util=require(_0x1740('0x0'));var logger=require(_0x1740('0x1'))(_0x1740('0x2'));var APIError=function(_0x137319,_0x2212a9){this[_0x1740('0x3')]=_0x137319||_0x1740('0x4');this['name']=_0x2212a9||'Error';util[_0x1740('0x5')](APIError,Error);};var APIBadRequestError=function(_0x1daf38){this[_0x1740('0x3')]=_0x1daf38||_0x1740('0x6');this[_0x1740('0x7')]=_0x1740('0x6');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0xc4c3b3){this[_0x1740('0x3')]=_0xc4c3b3||_0x1740('0x8');this['name']=_0x1740('0x8');util['inherits'](APIForbiddenError,APIError);};var APINotFoundError=function(_0x214b61){this['message']=_0x214b61||_0x1740('0x9');this[_0x1740('0x7')]=_0x1740('0xa');util[_0x1740('0x5')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x219479){this[_0x1740('0x3')]=_0x219479||_0x1740('0xb');this[_0x1740('0x7')]='Out\x20Of\x20Interval';this[_0x1740('0xc')]=0x193;this['details']={'type':'OutOfInterval'};util[_0x1740('0x5')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x3a4d48){this[_0x1740('0x3')]=_0x3a4d48||_0x1740('0xd');this['name']='Conflict';util[_0x1740('0x5')](APIBadRequestError,APIError);};function getStatusCode(_0xd9741b){switch(_0xd9741b){case _0x1740('0x6'):return 0x190;case'Forbidden','Out\x20Of\x20Interval':return 0x193;case'Not\x20Found':return 0x194;case _0x1740('0xe'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x3130a8){if(_0x3130a8===_0x1740('0xf'))return _0x3130a8;return null;}function handleError(_0x424585){return function(_0x49e1a5){logger[_0x1740('0x10')](_0x49e1a5[_0x1740('0x11')]);var _0x53635b=getStatusCode(_0x49e1a5[_0x1740('0x7')]);var _0x4f1a62=getCustomStatusMessage(_0x49e1a5[_0x1740('0x7')]);if(_0x49e1a5[_0x1740('0x7')]){delete _0x49e1a5['name'];}if(_0x4f1a62){_0x424585[_0x1740('0x12')]=_0x4f1a62;}return _0x424585['status'](_0x53635b)[_0x1740('0x13')](_0x49e1a5);};}module[_0x1740('0x14')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index ccbd08f..b68ef50 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a82=['json','send','exports','status'];(function(_0x483a6c,_0x1ec143){var _0x22700f=function(_0x5e362d){while(--_0x5e362d){_0x483a6c['push'](_0x483a6c['shift']());}};_0x22700f(++_0x1ec143);}(_0x7a82,0x8a));var _0x27a8=function(_0x415076,_0x2faa32){_0x415076=_0x415076-0x0;var _0x3b519e=_0x7a82[_0x415076];return _0x3b519e;};'use strict';module[_0x27a8('0x0')][0x194]=function pageNotFound(_0x10c19a,_0x594490){var _0x18df8b='404';var _0x36d4ac=0x194;var _0x2c12ad={'status':_0x36d4ac};_0x594490[_0x27a8('0x1')](_0x2c12ad[_0x27a8('0x1')]);_0x594490['render'](_0x18df8b,{},function(_0x3c6157,_0x50d32e){if(_0x3c6157){return _0x594490['status'](_0x2c12ad[_0x27a8('0x1')])[_0x27a8('0x2')](_0x2c12ad);}_0x594490[_0x27a8('0x3')](_0x50d32e);});}; \ No newline at end of file +var _0x84d1=['json','send','exports','404','status','render'];(function(_0x1d8bfa,_0x3035eb){var _0x3bdd83=function(_0x481c70){while(--_0x481c70){_0x1d8bfa['push'](_0x1d8bfa['shift']());}};_0x3bdd83(++_0x3035eb);}(_0x84d1,0xa4));var _0x184d=function(_0xaa4f3,_0x37be20){_0xaa4f3=_0xaa4f3-0x0;var _0x163cc9=_0x84d1[_0xaa4f3];return _0x163cc9;};'use strict';module[_0x184d('0x0')][0x194]=function pageNotFound(_0x516af6,_0x49097e){var _0x87f27c=_0x184d('0x1');var _0x2e02f8=0x194;var _0x14a280={'status':_0x2e02f8};_0x49097e[_0x184d('0x2')](_0x14a280['status']);_0x49097e[_0x184d('0x3')](_0x87f27c,{},function(_0x3c1e6b,_0x495f05){if(_0x3c1e6b){return _0x49097e['status'](_0x14a280[_0x184d('0x2')])[_0x184d('0x4')](_0x14a280);}_0x49097e[_0x184d('0x5')](_0x495f05);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 2b792c8..2ea701a 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x459c=['../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','../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','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../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','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','hasOne','cascade','UserId','userSetting','hasMany','VoiceQueuesRt','Extensions','HopperFinals','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','SET\x20NULL','belongsTo','UserProfile','belongsToMany','Groups','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','VoiceQueues','VoicePrefix','VoicePrefixes','UserVoicePrefix','UserMailQueue','FaxQueues','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','Applications','Sounds','Hoppers','VoiceQueueId','HopperHistories','TrunkId','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','mailboxuser','mailbox','QueueCalls','uniqueid','Contact','ContactId','MailServerIn','MailAccountId','MailServerOut','CloudProviderId','restrict','Imap','Smtp','Dispositions','CannedAnswer','Answers','Messages','Interactions','ListId','TemplateId','mandatoryDispositionPauseId','Agents','user_has_mail_accounts','Team','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Attachments','Interaction','ChatWebsite','ChatWebsiteId','ChatOfflineMessageId','TagId','List','FaxAccountId','FaxApplication','FaxInteractionId','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','FaxQueueReport','Disposition','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','ProactiveActions','ChatMessage','OpenchannelQueueReport','Agent','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','team_has_chat_queues','Members','chat_group_has_users','Website','CompanyId','CmContactId','JscriptySessions','Company','cm_contact_has_tags','AdditionalPhones','Queue','Campaign','OwnerId','CampaignId','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','VoiceMusicOnHold','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','CmHopperId','AllConditions','TriggerAllId','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','MetricId','Configurations','AccountId','SubjectId','SalesforceField','Descriptions','DescriptionId','Fields','Subject','Description','Field','FieldId','VariableId','SugarcrmAccount','Subjects','int_desk_configuration_has_tags','ZohoField','int_freshdesk_configuration_has_tags','Dynamics365Account','Dynamics365Field','FreshsalesAccount','FreshsalesField','ChatQueueReport','FromId','ToId','SessionId','ProjectId','MailQueues','ChatQueues','team_has_openchannel_queues','team_has_whatsapp_queues','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToMailQueueId','ToQueue','ToAccount','ToUserId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToAgent','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','HopperHistory','Queues','userProfileId','UserProfileSections','Resources','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','sequelize','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','mysql','utf8mb4','utf8_general_ci','sequelizeHistory','name','database','username','password','options','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceCallReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/chatWebsite/chatWebsite.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','Tag','ContactItemType','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','Trigger','../api/trigger/trigger.model','Variable','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Configuration','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesConfiguration','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/integration/integration.model','../api/network/network.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x459c,0x12b));var _0xc459=function(_0x5de021,_0x226551){_0x5de021=_0x5de021-0x0;var _0x3a6030=_0x459c[_0x5de021];return _0x3a6030;};'use strict';var config=require('../config/environment');var Sequelize=require(_0xc459('0x0'));var _=require('lodash');var jstz=require(_0xc459('0x1'));var timezone=jstz[_0xc459('0x2')]();config[_0xc459('0x0')]=_[_0xc459('0x3')](config[_0xc459('0x0')],{'database':_0xc459('0x4'),'username':_0xc459('0x5'),'password':_0xc459('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xc459('0x7'),'dialectOptions':{'charset':_0xc459('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0xc459('0x9')}}});config[_0xc459('0xa')]=_[_0xc459('0x3')](config[_0xc459('0xa')],{'database':_0xc459('0x4'),'username':_0xc459('0x5'),'password':_0xc459('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xc459('0x7'),'dialectOptions':{'charset':_0xc459('0x8')},'logging':![],'timezone':timezone[_0xc459('0xb')](),'define':{'charset':'utf8','collate':_0xc459('0x9')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xc459('0xc')],config['sequelize'][_0xc459('0xd')],config[_0xc459('0x0')][_0xc459('0xe')],config['sequelize'][_0xc459('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xc459('0xc')],config['sequelizeHistory'][_0xc459('0xd')],config[_0xc459('0xa')][_0xc459('0xe')],config[_0xc459('0xa')]['options'])};db[_0xc459('0x10')]=db['sequelize'][_0xc459('0x11')]('../api/user/user.model');db[_0xc459('0x12')]=db[_0xc459('0x0')]['import'](_0xc459('0x13'));db[_0xc459('0x14')]=db[_0xc459('0x0')]['import']('../api/voiceContext/voiceContext.model');db[_0xc459('0x15')]=db['sequelize'][_0xc459('0x11')](_0xc459('0x16'));db['VoiceMusicOnHold']=db['sequelize'][_0xc459('0x11')](_0xc459('0x17'));db[_0xc459('0x18')]=db['sequelize'][_0xc459('0x11')](_0xc459('0x19'));db[_0xc459('0x1a')]=db[_0xc459('0x0')]['import'](_0xc459('0x1b'));db[_0xc459('0x1c')]=db[_0xc459('0x0')]['import'](_0xc459('0x1d'));db[_0xc459('0x1e')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x1f'));db['VoiceMailMessage']=db[_0xc459('0x0')]['import']('../api/voiceMailMessage/voiceMailMessage.model');db[_0xc459('0x20')]=db[_0xc459('0x0')][_0xc459('0x11')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x21'));db[_0xc459('0x22')]=db['sequelize'][_0xc459('0x11')](_0xc459('0x23'));db[_0xc459('0x24')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x25'));db['MemberReport']=db['sequelize'][_0xc459('0x11')]('../api/memberReport/memberReport.model');db[_0xc459('0x26')]=db['sequelize'][_0xc459('0x11')](_0xc459('0x27'));db[_0xc459('0x28')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x29'));db[_0xc459('0x2a')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x2b'));db[_0xc459('0x2c')]=db[_0xc459('0x0')]['import'](_0xc459('0x2d'));db[_0xc459('0x2e')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x2f'));db['UserMailQueue']=db[_0xc459('0x0')][_0xc459('0x11')]('../api/userMailQueue/userMailQueue.model');db[_0xc459('0x30')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x31'));db[_0xc459('0x32')]=db[_0xc459('0x0')][_0xc459('0x11')]('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db[_0xc459('0x0')]['import'](_0xc459('0x33'));db[_0xc459('0x34')]=db['sequelize'][_0xc459('0x11')](_0xc459('0x35'));db['MailServerIn']=db[_0xc459('0x0')]['import']('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db['sequelize'][_0xc459('0x11')](_0xc459('0x36'));db[_0xc459('0x37')]=db[_0xc459('0x0')][_0xc459('0x11')]('../api/mailAccount/mailAccount.model');db[_0xc459('0x38')]=db['sequelize'][_0xc459('0x11')](_0xc459('0x39'));db[_0xc459('0x3a')]=db[_0xc459('0x0')][_0xc459('0x11')]('../api/mailSubstatus/mailSubstatus.model');db[_0xc459('0x3b')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x3c'));db[_0xc459('0x3d')]=db[_0xc459('0x0')]['import']('../api/mailMessage/mailMessage.model');db[_0xc459('0x3e')]=db[_0xc459('0x0')]['import'](_0xc459('0x3f'));db[_0xc459('0x40')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x41'));db[_0xc459('0x42')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x43'));db[_0xc459('0x44')]=db[_0xc459('0x0')][_0xc459('0x11')]('../api/dashboardItem/dashboardItem.model');db[_0xc459('0x45')]=db[_0xc459('0x0')]['import'](_0xc459('0x46'));db['FaxApplication']=db[_0xc459('0x0')][_0xc459('0x11')]('../api/faxApplication/faxApplication.model');db[_0xc459('0x47')]=db[_0xc459('0x0')]['import']('../api/faxInteraction/faxInteraction.model');db[_0xc459('0x48')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x49'));db[_0xc459('0x4a')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x4b'));db['FaxQueueReport']=db['sequelize'][_0xc459('0x11')](_0xc459('0x4c'));db[_0xc459('0x4d')]=db['sequelize'][_0xc459('0x11')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db[_0xc459('0x0')][_0xc459('0x11')]('../api/smsApplication/smsApplication.model');db[_0xc459('0x4e')]=db[_0xc459('0x0')][_0xc459('0x11')]('../api/smsInteraction/smsInteraction.model');db[_0xc459('0x4f')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x50'));db[_0xc459('0x51')]=db[_0xc459('0x0')][_0xc459('0x11')]('../api/smsQueue/smsQueue.model');db[_0xc459('0x52')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x53'));db[_0xc459('0x54')]=db['sequelize']['import'](_0xc459('0x55'));db[_0xc459('0x56')]=db[_0xc459('0x0')][_0xc459('0x11')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x57'));db[_0xc459('0x58')]=db[_0xc459('0x0')]['import']('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db['sequelize'][_0xc459('0x11')](_0xc459('0x59'));db['OpenchannelQueueReport']=db[_0xc459('0x0')]['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xc459('0x5a')]=db['sequelize'][_0xc459('0x11')](_0xc459('0x5b'));db['ChatInteraction']=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x5c'));db['ChatMessage']=db[_0xc459('0x0')][_0xc459('0x11')]('../api/chatMessage/chatMessage.model');db[_0xc459('0x5d')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x5e'));db[_0xc459('0x5f')]=db[_0xc459('0x0')][_0xc459('0x11')]('../api/chatQueue/chatQueue.model');db[_0xc459('0x60')]=db[_0xc459('0x0')][_0xc459('0x11')]('../api/chatGroup/chatGroup.model');db[_0xc459('0x61')]=db['sequelize']['import'](_0xc459('0x62'));db[_0xc459('0x63')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x64'));db[_0xc459('0x65')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x66'));db[_0xc459('0x67')]=db['sequelize'][_0xc459('0x11')](_0xc459('0x68'));db[_0xc459('0x69')]=db['sequelize']['import'](_0xc459('0x6a'));db[_0xc459('0x6b')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x6c'));db[_0xc459('0x6d')]=db[_0xc459('0x0')][_0xc459('0x11')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0xc459('0x6e')]=db['sequelize']['import'](_0xc459('0x6f'));db[_0xc459('0x70')]=db[_0xc459('0x0')]['import'](_0xc459('0x71'));db[_0xc459('0x72')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x73'));db[_0xc459('0x74')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x75'));db['CannedAnswer']=db[_0xc459('0x0')]['import'](_0xc459('0x76'));db['Disposition']=db[_0xc459('0x0')]['import'](_0xc459('0x77'));db[_0xc459('0x78')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x79'));db[_0xc459('0x7a')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x7b'));db[_0xc459('0x7c')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x7d'));db[_0xc459('0x7e')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x7f'));db[_0xc459('0x80')]=db['sequelize']['import'](_0xc459('0x81'));db[_0xc459('0x82')]=db['sequelize'][_0xc459('0x11')]('../api/schedule/schedule.model');db[_0xc459('0x83')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x84'));db[_0xc459('0x85')]=db['sequelize'][_0xc459('0x11')]('../api/tag/tag.model');db[_0xc459('0x86')]=db['sequelize'][_0xc459('0x11')]('../api/contactItemType/contactItemType.model');db[_0xc459('0x87')]=db['sequelize']['import'](_0xc459('0x88'));db[_0xc459('0x89')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x8a'));db[_0xc459('0x8b')]=db['sequelize'][_0xc459('0x11')]('../api/template/template.model');db[_0xc459('0x8c')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x8d'));db[_0xc459('0x8e')]=db[_0xc459('0x0')][_0xc459('0x11')]('../api/variable/variable.model');db['Integration']=db[_0xc459('0x0')][_0xc459('0x11')]('../api/integration/integration.model');db[_0xc459('0x8f')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x90'));db[_0xc459('0x91')]=db['sequelize']['import'](_0xc459('0x92'));db['AnalyticDefaultReport']=db[_0xc459('0x0')]['import'](_0xc459('0x93'));db[_0xc459('0x94')]=db[_0xc459('0x0')]['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xc459('0x95')]=db[_0xc459('0x0')][_0xc459('0x11')]('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x96'));db[_0xc459('0x97')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x98'));db[_0xc459('0x99')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x9a'));db[_0xc459('0x9b')]=db[_0xc459('0x0')]['import'](_0xc459('0x9c'));db['SalesforceField']=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x9d'));db['SugarcrmAccount']=db['sequelize'][_0xc459('0x11')](_0xc459('0x9e'));db[_0xc459('0x9f')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xa0'));db[_0xc459('0xa1')]=db[_0xc459('0x0')][_0xc459('0x11')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xc459('0xa2')]=db[_0xc459('0x0')]['import'](_0xc459('0xa3'));db[_0xc459('0xa4')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xa5'));db[_0xc459('0xa6')]=db[_0xc459('0x0')][_0xc459('0x11')]('../api/intDeskField/intDeskField.model');db[_0xc459('0xa7')]=db[_0xc459('0x0')]['import']('../api/intZohoAccount/intZohoAccount.model');db[_0xc459('0xa8')]=db['sequelize'][_0xc459('0x11')](_0xc459('0xa9'));db['ZohoField']=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xaa'));db[_0xc459('0xab')]=db[_0xc459('0x0')][_0xc459('0x11')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xc459('0xac')]=db[_0xc459('0x0')]['import'](_0xc459('0xad'));db[_0xc459('0xae')]=db['sequelize'][_0xc459('0x11')]('../api/intZendeskField/intZendeskField.model');db[_0xc459('0xaf')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xb0'));db[_0xc459('0xb1')]=db[_0xc459('0x0')][_0xc459('0x11')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xc459('0xb2')]=db['sequelize'][_0xc459('0x11')](_0xc459('0xb3'));db[_0xc459('0xb4')]=db['sequelize'][_0xc459('0x11')](_0xc459('0xb5'));db[_0xc459('0xb6')]=db[_0xc459('0x0')]['import'](_0xc459('0xb7'));db[_0xc459('0xb8')]=db[_0xc459('0x0')]['import'](_0xc459('0xb9'));db[_0xc459('0xba')]=db['sequelize']['import'](_0xc459('0xbb'));db[_0xc459('0xbc')]=db['sequelize'][_0xc459('0x11')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xc459('0xbd')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xbe'));db['Dynamics365Account']=db[_0xc459('0x0')][_0xc459('0x11')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0xc459('0xbf')]=db[_0xc459('0x0')][_0xc459('0x11')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xc0'));db['FreshsalesAccount']=db[_0xc459('0x0')][_0xc459('0x11')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xc459('0xc1')]=db['sequelize']['import']('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db['sequelize'][_0xc459('0x11')](_0xc459('0xc2'));db[_0xc459('0xc3')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xc4'));db['Network']=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xc5'));db['ChatQueueReport']=db[_0xc459('0x0')][_0xc459('0x11')]('../api/chatQueueReport/chatQueueReport.model');db[_0xc459('0xc6')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xc7'));db[_0xc459('0xc8')]=db[_0xc459('0x0')]['import']('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0xc459('0xc9')]=db[_0xc459('0x0')]['import'](_0xc459('0xca'));db[_0xc459('0xcb')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xcc'));db[_0xc459('0xcd')]=db['sequelize']['import']('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xce'));db[_0xc459('0xcf')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xd0'));db[_0xc459('0xd1')]=db['sequelize']['import'](_0xc459('0xd2'));db[_0xc459('0xd3')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xd4'));db[_0xc459('0xd5')]=db['sequelize']['import'](_0xc459('0xd6'));db[_0xc459('0xd7')]=db['sequelize'][_0xc459('0x11')](_0xc459('0xd8'));db[_0xc459('0xd9')]=db['sequelize']['import'](_0xc459('0xda'));db[_0xc459('0xdb')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xdc'));db['Team']=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xdd'));db[_0xc459('0xde')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xdf'));db['Campaign']=db['sequelize'][_0xc459('0x11')](_0xc459('0xe0'));db[_0xc459('0xe1')]=db[_0xc459('0x0')]['import'](_0xc459('0xe2'));db[_0xc459('0xe3')]=db['sequelize'][_0xc459('0x11')](_0xc459('0xe4'));db[_0xc459('0xe5')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xe6'));db[_0xc459('0xe7')]=db[_0xc459('0x0')][_0xc459('0x11')]('../api/mailTransferReport/mailTransferReport.model');db[_0xc459('0xe8')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xe9'));db['FaxTransferReport']=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xea'));db[_0xc459('0xeb')]=db['sequelize'][_0xc459('0x11')](_0xc459('0xec'));db[_0xc459('0xed')]=db['sequelize'][_0xc459('0x11')](_0xc459('0xee'));db[_0xc459('0xef')]=db[_0xc459('0x0')][_0xc459('0x11')]('../api/cmList/cmList.model');db['VoicePrefix']=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xf0'));db['UserProfile']=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xf1'));db[_0xc459('0xf2')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xf3'));db[_0xc459('0xf4')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xf5'));db[_0xc459('0xf6')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xf7'));db[_0xc459('0xf8')]=db['sequelize'][_0xc459('0x11')]('../api/whatsappAccount/whatsappAccount.model');db['WhatsappApplication']=db['sequelize'][_0xc459('0x11')](_0xc459('0xf9'));db[_0xc459('0xfa')]=db[_0xc459('0x0')]['import'](_0xc459('0xfb'));db[_0xc459('0xfc')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xfd'));db[_0xc459('0xfe')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0xff'));db['WhatsappTransferReport']=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x100'));db[_0xc459('0x101')]=db[_0xc459('0x0')]['import'](_0xc459('0x102'));db[_0xc459('0x103')]=db['sequelize'][_0xc459('0x11')](_0xc459('0x104'));db['TeamVoiceQueue']=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x105'));db['TeamVoicePrefix']=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x106'));db['UserVoicePrefix']=db['sequelize'][_0xc459('0x11')](_0xc459('0x107'));db[_0xc459('0x108')]=db[_0xc459('0x0')][_0xc459('0x11')](_0xc459('0x109'));db[_0xc459('0x10a')]=db[_0xc459('0x0')][_0xc459('0x11')]('../api/mailInteractionHasTag/mailInteractionHasTag.model');db[_0xc459('0x10')][_0xc459('0x10b')](db[_0xc459('0x1e')],{'as':'VoiceMail','onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x10d')});db[_0xc459('0x10')][_0xc459('0x10b')](db[_0xc459('0x108')],{'as':_0xc459('0x10e'),'onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x10d')});db[_0xc459('0x10')][_0xc459('0x10f')](db[_0xc459('0x1a')],{'as':'Recordings','foreignKey':_0xc459('0x10d')});db[_0xc459('0x10')][_0xc459('0x10f')](db[_0xc459('0x2a')],{'as':_0xc459('0x110'),'foreignKey':_0xc459('0x10d')});db[_0xc459('0x10')]['hasMany'](db[_0xc459('0x15')],{'as':_0xc459('0x111'),'onDelete':'cascade','hooks':!![]});db['User']['hasMany'](db[_0xc459('0x6b')],{'as':_0xc459('0x112'),'foreignKey':_0xc459('0x10d')});db[_0xc459('0x10')][_0xc459('0x10f')](db[_0xc459('0x6d')],{'as':'HopperHistory','foreignKey':_0xc459('0x10d')});db[_0xc459('0x10')][_0xc459('0x10f')](db[_0xc459('0x6e')],{'as':'ReportAgentPreview','foreignKey':'UserId'});db[_0xc459('0x10')]['hasMany'](db[_0xc459('0x56')],{'as':'OpenchannelInteractions','foreignKey':_0xc459('0x10d')});db[_0xc459('0x10')][_0xc459('0x10f')](db[_0xc459('0x113')],{'as':_0xc459('0x114'),'foreignKey':_0xc459('0x10d')});db[_0xc459('0x10')][_0xc459('0x10f')](db[_0xc459('0x4e')],{'as':_0xc459('0x115'),'foreignKey':_0xc459('0x10d')});db['User'][_0xc459('0x10f')](db[_0xc459('0x47')],{'as':_0xc459('0x116'),'foreignKey':_0xc459('0x10d')});db[_0xc459('0x10')][_0xc459('0x10f')](db[_0xc459('0x3b')],{'as':_0xc459('0x117'),'foreignKey':_0xc459('0x10d')});db[_0xc459('0x10')][_0xc459('0x10f')](db['WhatsappInteraction'],{'as':_0xc459('0x118'),'foreignKey':_0xc459('0x10d')});db['User'][_0xc459('0x10f')](db[_0xc459('0xf6')],{'as':_0xc459('0x119'),'foreignKey':_0xc459('0x11a')});db[_0xc459('0x10')][_0xc459('0x10f')](db[_0xc459('0x67')],{'as':'Hoppers','foreignKey':'UserId','onDelete':_0xc459('0x11b')});db[_0xc459('0x10')][_0xc459('0x11c')](db[_0xc459('0x11d')],{'as':_0xc459('0x11d'),'foreignKey':'userProfileId'});db[_0xc459('0x10')][_0xc459('0x11e')](db[_0xc459('0x60')],{'as':_0xc459('0x11f'),'through':'chat_group_has_users'});db[_0xc459('0x10')][_0xc459('0x11e')](db[_0xc459('0x65')],{'as':_0xc459('0x120'),'through':_0xc459('0x121')});db[_0xc459('0x10')][_0xc459('0x11e')](db[_0xc459('0xef')],{'as':_0xc459('0x122'),'through':_0xc459('0x123')});db[_0xc459('0x10')][_0xc459('0x11e')](db['Team'],{'through':_0xc459('0x124')});db[_0xc459('0x10')][_0xc459('0x11e')](db[_0xc459('0x3b')],{'as':_0xc459('0x117'),'through':_0xc459('0x125')});db[_0xc459('0x10')][_0xc459('0x11e')](db[_0xc459('0x113')],{'as':_0xc459('0x114'),'through':'user_has_chat_interactions'});db[_0xc459('0x10')][_0xc459('0x11e')](db[_0xc459('0x47')],{'as':_0xc459('0x116'),'through':_0xc459('0x126')});db[_0xc459('0x10')][_0xc459('0x11e')](db[_0xc459('0x4e')],{'as':_0xc459('0x115'),'through':_0xc459('0x127')});db[_0xc459('0x10')][_0xc459('0x11e')](db[_0xc459('0x56')],{'as':_0xc459('0x128'),'through':_0xc459('0x129')});db[_0xc459('0x10')]['belongsToMany'](db[_0xc459('0xfa')],{'as':_0xc459('0x118'),'through':'user_has_whatsapp_interactions'});db[_0xc459('0x10')][_0xc459('0x11e')](db[_0xc459('0x18')],{'as':_0xc459('0x12a'),'through':_0xc459('0x2c'),'required':![]});db['User']['belongsToMany'](db[_0xc459('0x12b')],{'as':_0xc459('0x12c'),'through':_0xc459('0x12d'),'required':![]});db['User'][_0xc459('0x11e')](db[_0xc459('0x38')],{'as':'MailQueues','through':_0xc459('0x12e'),'required':![]});db[_0xc459('0x10')][_0xc459('0x11e')](db[_0xc459('0x5f')],{'as':'ChatQueues','through':_0xc459('0x2e'),'required':![],'hooks':!![]});db['User'][_0xc459('0x11e')](db[_0xc459('0x4a')],{'as':_0xc459('0x12f'),'through':_0xc459('0x30'),'required':![]});db[_0xc459('0x10')][_0xc459('0x11e')](db[_0xc459('0x51')],{'as':_0xc459('0x130'),'through':_0xc459('0x32'),'required':![]});db['User'][_0xc459('0x11e')](db[_0xc459('0x58')],{'as':_0xc459('0x131'),'through':_0xc459('0x132'),'required':![]});db[_0xc459('0x10')][_0xc459('0x11e')](db[_0xc459('0x101')],{'as':'WhatsappQueues','through':_0xc459('0x34'),'required':![]});db[_0xc459('0x10')]['belongsToMany'](db[_0xc459('0xef')],{'through':_0xc459('0x123')});db[_0xc459('0x10')][_0xc459('0x11e')](db['ChatWebsite'],{'as':'ChatWebsites','through':_0xc459('0x133')});db[_0xc459('0x10')][_0xc459('0x11e')](db['FaxAccount'],{'as':'FaxAccounts','through':_0xc459('0x134')});db[_0xc459('0x10')]['belongsToMany'](db['MailAccount'],{'as':_0xc459('0x135'),'through':'user_has_mail_accounts'});db[_0xc459('0x10')]['belongsToMany'](db[_0xc459('0x52')],{'as':'OpenchannelAccounts','through':_0xc459('0x136')});db[_0xc459('0x10')][_0xc459('0x11e')](db['SmsAccount'],{'as':'SmsAccounts','through':_0xc459('0x137')});db[_0xc459('0x10')][_0xc459('0x11e')](db[_0xc459('0xf8')],{'as':_0xc459('0x138'),'through':_0xc459('0x139')});db[_0xc459('0x12')]['hasMany'](db['VoiceExtension'],{'as':_0xc459('0x13a'),'onDelete':_0xc459('0x10c'),'foreignKey':'ChanSpyId'});db['VoiceContext']['hasMany'](db[_0xc459('0x15')],{'onDelete':_0xc459('0x10c')});db[_0xc459('0x15')][_0xc459('0x10f')](db['VoiceExtension'],{'as':_0xc459('0x13b'),'onDelete':_0xc459('0x10c')});db['VoiceMusicOnHold'][_0xc459('0x11e')](db['Sound'],{'as':_0xc459('0x13c'),'through':'moh_has_sounds'});db[_0xc459('0x18')][_0xc459('0x10f')](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0xc459('0x18')][_0xc459('0x10f')](db[_0xc459('0x67')],{'as':_0xc459('0x13d'),'foreignKey':'VoiceQueueId'});db[_0xc459('0x18')][_0xc459('0x10f')](db[_0xc459('0x6b')],{'as':'HopperFinals','foreignKey':_0xc459('0x13e')});db[_0xc459('0x18')][_0xc459('0x10f')](db[_0xc459('0x6d')],{'as':_0xc459('0x13f'),'foreignKey':'VoiceQueueId'});db[_0xc459('0x18')]['hasMany'](db[_0xc459('0x6e')],{'as':'ReportAgentPreview','foreignKey':_0xc459('0x13e')});db[_0xc459('0x18')]['hasMany'](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db[_0xc459('0x18')][_0xc459('0x10f')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db[_0xc459('0x18')][_0xc459('0x11c')](db[_0xc459('0x26')],{'as':'Trunk','foreignKey':_0xc459('0x140')});db[_0xc459('0x18')][_0xc459('0x11c')](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0xc459('0x141')});db['VoiceQueue'][_0xc459('0x11c')](db['Interval'],{'as':_0xc459('0x7a'),'foreignKey':_0xc459('0x142')});db['VoiceQueue'][_0xc459('0x11c')](db[_0xc459('0x7c')],{'as':_0xc459('0x143'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xc459('0x18')][_0xc459('0x11e')](db[_0xc459('0xef')],{'as':_0xc459('0x122'),'through':_0xc459('0x144')});db[_0xc459('0x18')]['belongsToMany'](db[_0xc459('0x10')],{'as':'Agents','through':_0xc459('0x2c')});db[_0xc459('0x18')][_0xc459('0x11e')](db['Team'],{'as':_0xc459('0x145'),'through':_0xc459('0x146')});db[_0xc459('0x18')][_0xc459('0x11e')](db[_0xc459('0xef')],{'as':_0xc459('0x147'),'through':_0xc459('0x148')});db[_0xc459('0x1a')][_0xc459('0x11c')](db[_0xc459('0x10')],{'as':_0xc459('0x10'),'foreignKey':_0xc459('0x10d')});db['ScreenRecording'][_0xc459('0x11c')](db[_0xc459('0x10')],{'as':_0xc459('0x10'),'foreignKey':_0xc459('0x10d')});db[_0xc459('0x1e')][_0xc459('0x10f')](db[_0xc459('0x149')],{'as':'Messages','onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x14a'),'sourceKey':'mailbox'});db[_0xc459('0x149')][_0xc459('0x11c')](db[_0xc459('0x1e')],{'foreignKey':'mailboxuser','targetKey':_0xc459('0x14b')});db[_0xc459('0x20')]['hasMany'](db['VoiceQueueReport'],{'as':_0xc459('0x14c'),'foreignKey':_0xc459('0x14d'),'constraints':![]});db[_0xc459('0x20')][_0xc459('0x10f')](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0xc459('0x20')][_0xc459('0x11c')](db[_0xc459('0x10')],{'as':'User','foreignKey':_0xc459('0x10d')});db['VoiceCallReport']['belongsTo'](db[_0xc459('0x65')],{'as':_0xc459('0x14e'),'foreignKey':_0xc459('0x14f')});db[_0xc459('0x150')][_0xc459('0x11c')](db[_0xc459('0x37')],{'as':_0xc459('0x37'),'foreignKey':_0xc459('0x151')});db[_0xc459('0x150')]['belongsTo'](db['CloudProvider'],{'as':_0xc459('0x103'),'foreignKey':'CloudProviderId','onDelete':'restrict'});db[_0xc459('0x152')][_0xc459('0x11c')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0xc459('0x151')});db[_0xc459('0x152')][_0xc459('0x11c')](db[_0xc459('0x103')],{'as':_0xc459('0x103'),'foreignKey':_0xc459('0x153'),'onDelete':_0xc459('0x154')});db[_0xc459('0x37')][_0xc459('0x10b')](db[_0xc459('0x150')],{'as':_0xc459('0x155'),'onDelete':_0xc459('0x10c')});db[_0xc459('0x37')][_0xc459('0x10b')](db[_0xc459('0x152')],{'as':_0xc459('0x156'),'onDelete':_0xc459('0x10c')});db[_0xc459('0x37')][_0xc459('0x10f')](db['Disposition'],{'as':_0xc459('0x157'),'foreignKey':_0xc459('0x151'),'onDelete':_0xc459('0x10c')});db[_0xc459('0x37')]['hasMany'](db[_0xc459('0x158')],{'as':_0xc459('0x159'),'foreignKey':_0xc459('0x151')});db['MailAccount'][_0xc459('0x10f')](db[_0xc459('0x3d')],{'as':_0xc459('0x15a'),'foreignKey':_0xc459('0x151')});db['MailAccount']['hasMany'](db[_0xc459('0x3b')],{'as':_0xc459('0x15b')});db[_0xc459('0x37')][_0xc459('0x10f')](db[_0xc459('0x3e')],{'as':'Applications','foreignKey':_0xc459('0x151'),'onDelete':_0xc459('0x10c')});db[_0xc459('0x37')][_0xc459('0x11c')](db[_0xc459('0xef')],{'as':'List','foreignKey':_0xc459('0x15c')});db[_0xc459('0x37')][_0xc459('0x11c')](db['Template'],{'as':_0xc459('0x8b'),'foreignKey':_0xc459('0x15d')});db['MailAccount'][_0xc459('0x11c')](db[_0xc459('0x7c')],{'as':'mandatoryDispositionPause','foreignKey':_0xc459('0x15e')});db[_0xc459('0x37')][_0xc459('0x11e')](db['User'],{'as':_0xc459('0x15f'),'through':_0xc459('0x160')});db[_0xc459('0x38')][_0xc459('0x11e')](db['User'],{'as':_0xc459('0x15f'),'through':'UserMailQueue'});db[_0xc459('0x38')][_0xc459('0x11e')](db[_0xc459('0x161')],{'through':_0xc459('0x162'),'as':_0xc459('0x145')});db['MailInteraction'][_0xc459('0x10f')](db[_0xc459('0x3d')],{'as':_0xc459('0x15a'),'onDelete':'cascade','foreignKey':_0xc459('0x163')});db[_0xc459('0x3b')][_0xc459('0x11c')](db['MailAccount'],{'as':_0xc459('0x164'),'foreignKey':_0xc459('0x151')});db[_0xc459('0x3b')][_0xc459('0x11c')](db[_0xc459('0x65')],{'as':'Contact','foreignKey':'ContactId'});db[_0xc459('0x3b')][_0xc459('0x11c')](db[_0xc459('0x10')],{'as':_0xc459('0x165'),'foreignKey':_0xc459('0x10d')});db[_0xc459('0x3b')]['belongsToMany'](db[_0xc459('0x85')],{'through':_0xc459('0x166'),'as':_0xc459('0x167')});db['MailInteraction'][_0xc459('0x11e')](db['Tag'],{'through':_0xc459('0x166'),'as':_0xc459('0x168')});db[_0xc459('0x3b')][_0xc459('0x11e')](db[_0xc459('0x10')],{'as':'Users','through':_0xc459('0x125'),'foreignKey':_0xc459('0x163')});db[_0xc459('0x3d')][_0xc459('0x10f')](db[_0xc459('0xe3')],{'as':_0xc459('0x169'),'onDelete':_0xc459('0x10c')});db['MailMessage'][_0xc459('0x11c')](db['User'],{'as':_0xc459('0x10')});db[_0xc459('0x3d')][_0xc459('0x11c')](db[_0xc459('0x65')],{'onDelete':'cascade','as':_0xc459('0x14e')});db[_0xc459('0x3d')]['belongsTo'](db['MailInteraction'],{'as':_0xc459('0x16a'),'foreignKey':_0xc459('0x163')});db['MailMessage'][_0xc459('0x11c')](db[_0xc459('0x37')],{'as':'Account','foreignKey':_0xc459('0x151')});db[_0xc459('0x3d')][_0xc459('0x11c')](db['ChatWebsite'],{'as':_0xc459('0x16b'),'foreignKey':_0xc459('0x16c')});db[_0xc459('0x3d')][_0xc459('0x11c')](db[_0xc459('0x5d')],{'as':'ChatOfflineMessage','foreignKey':_0xc459('0x16d')});db[_0xc459('0x3e')][_0xc459('0x11c')](db[_0xc459('0x10')],{'onDelete':_0xc459('0x154')});db['MailApplication'][_0xc459('0x11c')](db[_0xc459('0x38')],{'onDelete':_0xc459('0x154')});db['MailApplication'][_0xc459('0x11c')](db[_0xc459('0x37')],{'onDelete':_0xc459('0x154')});db[_0xc459('0x3e')][_0xc459('0x11c')](db[_0xc459('0x7a')],{'onDelete':_0xc459('0x154'),'foreignKey':'IntervalId'});db[_0xc459('0x3e')][_0xc459('0x11c')](db[_0xc459('0x85')],{'onDelete':_0xc459('0x154'),'foreignKey':_0xc459('0x16e')});db[_0xc459('0x40')]['belongsTo'](db['MailAccount'],{});db[_0xc459('0x40')][_0xc459('0x11c')](db[_0xc459('0xef')],{'as':_0xc459('0x16f'),'foreignKey':'ListId'});db['MailQueueReport']['belongsTo'](db[_0xc459('0x65')],{'as':'Contact','foreignKey':_0xc459('0x14f')});db[_0xc459('0x40')][_0xc459('0x11c')](db[_0xc459('0x3b')],{});db[_0xc459('0x40')]['belongsTo'](db[_0xc459('0x3d')],{});db['MailQueueReport'][_0xc459('0x11c')](db[_0xc459('0x10')],{});db[_0xc459('0x40')][_0xc459('0x11c')](db[_0xc459('0x38')],{});db[_0xc459('0x42')][_0xc459('0x10f')](db[_0xc459('0x44')],{'as':'Items','onDelete':'cascade'});db[_0xc459('0x45')][_0xc459('0x10f')](db['Disposition'],{'as':_0xc459('0x157'),'foreignKey':_0xc459('0x170'),'onDelete':_0xc459('0x10c')});db[_0xc459('0x45')][_0xc459('0x10f')](db['CannedAnswer'],{'as':_0xc459('0x159'),'foreignKey':_0xc459('0x170')});db[_0xc459('0x45')][_0xc459('0x10f')](db[_0xc459('0x47')],{'as':_0xc459('0x15b')});db[_0xc459('0x45')]['hasMany'](db[_0xc459('0x171')],{'as':_0xc459('0x13b'),'foreignKey':_0xc459('0x170'),'onDelete':_0xc459('0x10c')});db[_0xc459('0x45')][_0xc459('0x10f')](db['VoiceExtension'],{'as':'Exntensions','onDelete':_0xc459('0x10c')});db['FaxAccount'][_0xc459('0x10f')](db[_0xc459('0x48')],{'as':_0xc459('0x15a')});db['FaxAccount']['belongsTo'](db[_0xc459('0x26')],{'as':_0xc459('0x26')});db[_0xc459('0x45')][_0xc459('0x11c')](db['CmList'],{'as':'List','foreignKey':_0xc459('0x15c')});db[_0xc459('0x45')][_0xc459('0x11c')](db[_0xc459('0x7c')],{'as':'mandatoryDispositionPause','foreignKey':_0xc459('0x15e')});db[_0xc459('0x45')][_0xc459('0x11e')](db[_0xc459('0x10')],{'as':_0xc459('0x15f'),'through':_0xc459('0x134')});db['FaxApplication'][_0xc459('0x11c')](db['User'],{'onDelete':_0xc459('0x154')});db[_0xc459('0x171')][_0xc459('0x11c')](db[_0xc459('0x4a')],{'onDelete':'restrict'});db['FaxApplication'][_0xc459('0x11c')](db['FaxAccount'],{'onDelete':_0xc459('0x154')});db[_0xc459('0x171')][_0xc459('0x11c')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xc459('0x16e')});db[_0xc459('0x47')][_0xc459('0x10f')](db[_0xc459('0x48')],{'as':_0xc459('0x15a'),'onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x172')});db[_0xc459('0x47')][_0xc459('0x11c')](db['FaxAccount'],{'as':'Account','foreignKey':_0xc459('0x170')});db['FaxInteraction'][_0xc459('0x11c')](db[_0xc459('0x65')],{'as':'Contact','foreignKey':_0xc459('0x14f')});db[_0xc459('0x47')][_0xc459('0x11c')](db['User'],{'as':_0xc459('0x165'),'foreignKey':_0xc459('0x10d')});db['FaxInteraction'][_0xc459('0x11e')](db[_0xc459('0x85')],{'through':'fax_interaction_has_tags','as':_0xc459('0x167')});db[_0xc459('0x47')][_0xc459('0x11e')](db[_0xc459('0x85')],{'through':_0xc459('0x173'),'as':_0xc459('0x168')});db[_0xc459('0x47')][_0xc459('0x11e')](db[_0xc459('0x10')],{'as':_0xc459('0x174'),'through':_0xc459('0x126'),'foreignKey':_0xc459('0x172')});db[_0xc459('0x48')][_0xc459('0x11c')](db[_0xc459('0x10')],{'onDelete':_0xc459('0x10c'),'as':'User'});db['FaxMessage'][_0xc459('0x11c')](db['FaxInteraction'],{'as':'Interaction','foreignKey':_0xc459('0x172')});db['FaxMessage'][_0xc459('0x11c')](db[_0xc459('0x65')],{'onDelete':'cascade','as':_0xc459('0x14e')});db[_0xc459('0x48')][_0xc459('0x11c')](db[_0xc459('0xe3')],{'as':_0xc459('0xe3'),'foreignKey':_0xc459('0x175')});db[_0xc459('0x48')][_0xc459('0x11c')](db['FaxAccount'],{'as':_0xc459('0x164'),'foreignKey':'FaxAccountId'});db[_0xc459('0x4a')][_0xc459('0x11e')](db['User'],{'as':_0xc459('0x15f'),'through':_0xc459('0x30')});db[_0xc459('0x4a')][_0xc459('0x11e')](db[_0xc459('0x161')],{'through':_0xc459('0x176'),'as':_0xc459('0x145')});db[_0xc459('0x177')]['belongsTo'](db[_0xc459('0x45')],{});db[_0xc459('0x177')][_0xc459('0x11c')](db[_0xc459('0xef')],{'as':_0xc459('0x16f'),'foreignKey':_0xc459('0x15c')});db[_0xc459('0x177')]['belongsTo'](db[_0xc459('0x65')],{'as':_0xc459('0x14e'),'foreignKey':_0xc459('0x14f')});db['FaxQueueReport'][_0xc459('0x11c')](db['FaxInteraction'],{});db['FaxQueueReport']['belongsTo'](db[_0xc459('0x48')],{});db[_0xc459('0x177')][_0xc459('0x11c')](db[_0xc459('0x10')],{});db['FaxQueueReport'][_0xc459('0x11c')](db['FaxQueue'],{});db[_0xc459('0x4d')][_0xc459('0x10f')](db[_0xc459('0x178')],{'as':_0xc459('0x157'),'foreignKey':_0xc459('0x179'),'onDelete':_0xc459('0x10c')});db[_0xc459('0x4d')][_0xc459('0x10f')](db[_0xc459('0x158')],{'as':_0xc459('0x159'),'foreignKey':_0xc459('0x179')});db['SmsAccount'][_0xc459('0x10f')](db[_0xc459('0x4f')],{'as':'Messages','foreignKey':_0xc459('0x179')});db[_0xc459('0x4d')]['hasMany'](db['SmsInteraction'],{'as':_0xc459('0x15b')});db[_0xc459('0x4d')]['hasMany'](db[_0xc459('0x17a')],{'as':_0xc459('0x13b'),'foreignKey':'SmsAccountId','onDelete':_0xc459('0x10c')});db[_0xc459('0x4d')]['belongsTo'](db[_0xc459('0xef')],{'as':_0xc459('0x16f'),'foreignKey':'ListId'});db['SmsAccount'][_0xc459('0x11c')](db['Pause'],{'as':_0xc459('0x143'),'foreignKey':_0xc459('0x15e')});db[_0xc459('0x4d')][_0xc459('0x11e')](db[_0xc459('0x10')],{'as':_0xc459('0x15f'),'through':_0xc459('0x137')});db[_0xc459('0x17a')][_0xc459('0x11c')](db['User'],{'onDelete':_0xc459('0x154')});db['SmsApplication'][_0xc459('0x11c')](db['SmsQueue'],{'onDelete':'restrict'});db[_0xc459('0x17a')][_0xc459('0x11c')](db[_0xc459('0x4d')],{'onDelete':_0xc459('0x154')});db[_0xc459('0x17a')]['belongsTo'](db[_0xc459('0x7a')],{'onDelete':'restrict','foreignKey':_0xc459('0x142')});db[_0xc459('0x17a')][_0xc459('0x11c')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xc459('0x16e')});db[_0xc459('0x4e')]['hasMany'](db[_0xc459('0x4f')],{'as':_0xc459('0x15a'),'onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x17b')});db[_0xc459('0x4e')][_0xc459('0x11c')](db[_0xc459('0x4d')],{'as':_0xc459('0x164'),'foreignKey':_0xc459('0x179')});db[_0xc459('0x4e')]['belongsTo'](db[_0xc459('0x65')],{'as':_0xc459('0x14e'),'foreignKey':'ContactId'});db[_0xc459('0x4e')]['belongsTo'](db[_0xc459('0x10')],{'as':_0xc459('0x165'),'foreignKey':_0xc459('0x10d')});db[_0xc459('0x4e')][_0xc459('0x11e')](db['Tag'],{'through':_0xc459('0x17c'),'as':_0xc459('0x167')});db[_0xc459('0x4e')][_0xc459('0x11e')](db[_0xc459('0x85')],{'through':_0xc459('0x17c'),'as':_0xc459('0x168')});db['SmsInteraction']['belongsToMany'](db[_0xc459('0x10')],{'as':_0xc459('0x174'),'through':_0xc459('0x127'),'foreignKey':_0xc459('0x17b')});db[_0xc459('0x4f')][_0xc459('0x11c')](db['User'],{'as':_0xc459('0x10')});db[_0xc459('0x4f')][_0xc459('0x11c')](db['CmContact'],{'onDelete':_0xc459('0x10c'),'as':_0xc459('0x14e')});db[_0xc459('0x4f')]['belongsTo'](db[_0xc459('0x4e')],{'onDelete':_0xc459('0x10c'),'as':_0xc459('0x16a'),'foreignKey':_0xc459('0x17b')});db[_0xc459('0x4f')]['belongsTo'](db[_0xc459('0x4d')],{'as':_0xc459('0x164'),'foreignKey':'SmsAccountId'});db[_0xc459('0x51')][_0xc459('0x11e')](db[_0xc459('0x10')],{'as':_0xc459('0x15f'),'through':_0xc459('0x32'),'foreignKey':_0xc459('0x17d')});db['SmsQueue'][_0xc459('0x11e')](db[_0xc459('0x161')],{'through':_0xc459('0x17e'),'as':_0xc459('0x145')});db[_0xc459('0x52')][_0xc459('0x10f')](db[_0xc459('0x178')],{'as':'Dispositions','foreignKey':'OpenchannelAccountId','onDelete':_0xc459('0x10c')});db[_0xc459('0x52')][_0xc459('0x10f')](db[_0xc459('0x158')],{'as':'Answers','foreignKey':_0xc459('0x17f')});db[_0xc459('0x52')]['hasMany'](db[_0xc459('0x56')],{'as':_0xc459('0x15b'),'foreignKey':_0xc459('0x17f')});db[_0xc459('0x52')][_0xc459('0x10f')](db[_0xc459('0x180')],{'as':_0xc459('0x15a'),'foreignKey':'OpenchannelAccountId'});db[_0xc459('0x52')][_0xc459('0x10f')](db['OpenchannelApplication'],{'as':'Applications','foreignKey':_0xc459('0x17f'),'onDelete':_0xc459('0x10c')});db[_0xc459('0x52')][_0xc459('0x11c')](db[_0xc459('0xef')],{'as':_0xc459('0x16f'),'foreignKey':'ListId'});db[_0xc459('0x52')][_0xc459('0x11c')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xc459('0x15e')});db['OpenchannelAccount']['belongsToMany'](db[_0xc459('0x10')],{'as':_0xc459('0x15f'),'through':_0xc459('0x136')});db[_0xc459('0x54')][_0xc459('0x11c')](db[_0xc459('0x10')],{'onDelete':_0xc459('0x154')});db['OpenchannelApplication'][_0xc459('0x11c')](db[_0xc459('0x58')],{'onDelete':_0xc459('0x154'),'foreignKey':_0xc459('0x181')});db[_0xc459('0x54')][_0xc459('0x11c')](db[_0xc459('0x52')],{'onDelete':'restrict','foreignKey':_0xc459('0x17f')});db[_0xc459('0x54')][_0xc459('0x11c')](db[_0xc459('0x7a')],{'onDelete':_0xc459('0x154'),'foreignKey':_0xc459('0x142')});db['OpenchannelApplication'][_0xc459('0x11c')](db[_0xc459('0x85')],{'onDelete':'restrict','foreignKey':_0xc459('0x16e')});db['OpenchannelInteraction'][_0xc459('0x10f')](db[_0xc459('0x180')],{'as':_0xc459('0x15a'),'onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x182')});db[_0xc459('0x56')][_0xc459('0x11c')](db[_0xc459('0x52')],{'as':_0xc459('0x164'),'foreignKey':_0xc459('0x17f')});db[_0xc459('0x56')][_0xc459('0x11c')](db[_0xc459('0x65')],{'as':_0xc459('0x14e'),'foreignKey':_0xc459('0x14f')});db[_0xc459('0x56')][_0xc459('0x11c')](db[_0xc459('0x10')],{'as':_0xc459('0x165'),'foreignKey':_0xc459('0x10d')});db['OpenchannelInteraction']['belongsToMany'](db[_0xc459('0x85')],{'through':_0xc459('0x183'),'as':'Tags'});db[_0xc459('0x56')]['belongsToMany'](db[_0xc459('0x85')],{'through':_0xc459('0x183'),'as':'ThroughTags'});db[_0xc459('0x56')][_0xc459('0x11e')](db[_0xc459('0x10')],{'as':_0xc459('0x174'),'through':_0xc459('0x129'),'foreignKey':_0xc459('0x182')});db[_0xc459('0x180')][_0xc459('0x11c')](db['User'],{'onDelete':'cascade','as':_0xc459('0x10')});db[_0xc459('0x180')][_0xc459('0x11c')](db['CmContact'],{'onDelete':_0xc459('0x10c'),'as':'Contact'});db[_0xc459('0x180')][_0xc459('0x11c')](db['OpenchannelInteraction'],{'onDelete':_0xc459('0x10c'),'as':'Interaction','foreignKey':_0xc459('0x182')});db['OpenchannelMessage'][_0xc459('0x11c')](db[_0xc459('0xe3')],{'as':_0xc459('0xe3'),'foreignKey':'AttachmentId'});db[_0xc459('0x180')]['belongsTo'](db[_0xc459('0x52')],{'as':_0xc459('0x164'),'foreignKey':_0xc459('0x17f')});db[_0xc459('0x58')][_0xc459('0x11e')](db['User'],{'as':_0xc459('0x15f'),'through':_0xc459('0x132'),'foreignKey':_0xc459('0x181')});db[_0xc459('0x58')][_0xc459('0x11e')](db[_0xc459('0x161')],{'through':'team_has_openchannel_queues','as':_0xc459('0x145')});db['ChatWebsite']['hasMany'](db[_0xc459('0x178')],{'as':_0xc459('0x157'),'foreignKey':_0xc459('0x16c'),'onDelete':_0xc459('0x10c')});db[_0xc459('0x16b')][_0xc459('0x10f')](db['CannedAnswer'],{'as':_0xc459('0x159'),'foreignKey':_0xc459('0x16c')});db[_0xc459('0x16b')][_0xc459('0x10f')](db['ChatProactiveAction'],{'as':_0xc459('0x184')});db[_0xc459('0x16b')][_0xc459('0x10f')](db[_0xc459('0x113')],{'as':_0xc459('0x15b')});db['ChatWebsite'][_0xc459('0x10f')](db[_0xc459('0x5a')],{'as':_0xc459('0x13b'),'foreignKey':_0xc459('0x16c'),'onDelete':_0xc459('0x10c')});db[_0xc459('0x16b')][_0xc459('0x10f')](db[_0xc459('0x185')],{'as':_0xc459('0x15a')});db[_0xc459('0x16b')][_0xc459('0x11c')](db[_0xc459('0xef')],{'as':_0xc459('0x16f'),'foreignKey':_0xc459('0x15c')});db[_0xc459('0x16b')][_0xc459('0x11c')](db['Interval'],{'as':_0xc459('0x7a'),'foreignKey':_0xc459('0x142')});db[_0xc459('0x16b')][_0xc459('0x11c')](db[_0xc459('0x37')],{'as':_0xc459('0x37'),'foreignKey':_0xc459('0x151')});db[_0xc459('0x16b')]['belongsTo'](db[_0xc459('0x7c')],{'as':_0xc459('0x143'),'foreignKey':_0xc459('0x15e')});db[_0xc459('0x16b')][_0xc459('0x11e')](db['User'],{'as':_0xc459('0x15f'),'through':_0xc459('0x133')});db[_0xc459('0x186')]['belongsTo'](db['OpenchannelAccount'],{});db[_0xc459('0x186')]['belongsTo'](db['CmList'],{'as':_0xc459('0x16f'),'foreignKey':_0xc459('0x15c')});db[_0xc459('0x186')][_0xc459('0x11c')](db[_0xc459('0x65')],{'as':_0xc459('0x14e'),'foreignKey':_0xc459('0x14f')});db['OpenchannelQueueReport'][_0xc459('0x11c')](db['OpenchannelInteraction'],{});db[_0xc459('0x186')]['belongsTo'](db[_0xc459('0x180')],{});db['OpenchannelQueueReport'][_0xc459('0x11c')](db[_0xc459('0x10')],{});db['OpenchannelQueueReport'][_0xc459('0x11c')](db[_0xc459('0x58')],{});db['ChatApplication']['belongsTo'](db[_0xc459('0x10')],{'as':_0xc459('0x187'),'foreignKey':_0xc459('0x10d'),'onDelete':_0xc459('0x154')});db[_0xc459('0x5a')][_0xc459('0x11c')](db[_0xc459('0x5f')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0xc459('0x154')});db['ChatApplication'][_0xc459('0x11c')](db['ChatWebsite'],{'as':'Website','foreignKey':_0xc459('0x16c'),'onDelete':_0xc459('0x154')});db['ChatApplication'][_0xc459('0x11c')](db[_0xc459('0x85')],{'onDelete':_0xc459('0x154'),'foreignKey':_0xc459('0x16e')});db[_0xc459('0x113')][_0xc459('0x10f')](db[_0xc459('0x185')],{'as':_0xc459('0x15a'),'onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x188')});db['ChatInteraction'][_0xc459('0x11c')](db['ChatWebsite'],{'as':'Account','foreignKey':_0xc459('0x16c')});db[_0xc459('0x113')][_0xc459('0x11c')](db[_0xc459('0x65')],{'as':_0xc459('0x14e'),'foreignKey':'ContactId'});db[_0xc459('0x113')][_0xc459('0x11c')](db[_0xc459('0x10')],{'as':_0xc459('0x165'),'foreignKey':_0xc459('0x10d')});db['ChatInteraction']['belongsToMany'](db[_0xc459('0x85')],{'through':_0xc459('0x189'),'as':_0xc459('0x167')});db['ChatInteraction'][_0xc459('0x11e')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0xc459('0x168')});db[_0xc459('0x113')][_0xc459('0x11e')](db[_0xc459('0x10')],{'as':_0xc459('0x174'),'through':_0xc459('0x18a'),'foreignKey':_0xc459('0x188')});db[_0xc459('0x185')][_0xc459('0x11c')](db[_0xc459('0x10')],{'onDelete':_0xc459('0x10c'),'as':'User'});db[_0xc459('0x185')][_0xc459('0x11c')](db[_0xc459('0x65')],{'onDelete':'cascade','as':'Contact','foreignKey':'ContactId'});db['ChatMessage'][_0xc459('0x11c')](db[_0xc459('0x113')],{'onDelete':_0xc459('0x10c'),'as':_0xc459('0x16a'),'foreignKey':_0xc459('0x188')});db[_0xc459('0x185')][_0xc459('0x11c')](db['Attachment'],{'as':_0xc459('0xe3'),'foreignKey':'AttachmentId'});db[_0xc459('0x185')]['belongsTo'](db['ChatWebsite'],{'as':_0xc459('0x164'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0xc459('0x10f')](db[_0xc459('0xe3')],{'as':_0xc459('0x169'),'foreignKey':'ChatOfflineMessageId','onDelete':_0xc459('0x10c'),'hooks':!![]});db[_0xc459('0x5d')]['belongsTo'](db[_0xc459('0x65')],{'onDelete':_0xc459('0x10c'),'as':_0xc459('0x14e'),'foreignKey':'ContactId'});db['ChatOfflineMessage'][_0xc459('0x11c')](db[_0xc459('0x16b')],{'as':_0xc459('0x164'),'foreignKey':'ChatWebsiteId'});db[_0xc459('0x5f')][_0xc459('0x11e')](db['User'],{'as':'Agents','through':_0xc459('0x2e'),'hooks':!![]});db[_0xc459('0x5f')]['belongsToMany'](db[_0xc459('0x161')],{'through':_0xc459('0x18b'),'as':_0xc459('0x145')});db['ChatGroup'][_0xc459('0x10f')](db[_0xc459('0xc6')],{'as':_0xc459('0x15a'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0xc459('0x60')][_0xc459('0x11e')](db[_0xc459('0x10')],{'as':_0xc459('0x18c'),'through':_0xc459('0x18d')});db[_0xc459('0x61')][_0xc459('0x11c')](db[_0xc459('0x16b')],{'as':_0xc459('0x18e'),'foreignKey':_0xc459('0x16c')});db[_0xc459('0x63')]['hasMany'](db[_0xc459('0x65')],{'as':_0xc459('0x120'),'foreignKey':_0xc459('0x18f')});db[_0xc459('0x65')][_0xc459('0x10f')](db[_0xc459('0x87')],{'as':'Phones','foreignKey':_0xc459('0x190')});db['CmContact'][_0xc459('0x10f')](db['CmHopper'],{'as':_0xc459('0x13d'),'foreignKey':_0xc459('0x14f')});db[_0xc459('0x65')][_0xc459('0x10f')](db[_0xc459('0x6b')],{'as':_0xc459('0x112'),'foreignKey':_0xc459('0x14f')});db[_0xc459('0x65')][_0xc459('0x10f')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'ContactId'});db[_0xc459('0x65')][_0xc459('0x10f')](db[_0xc459('0x6e')],{'as':'ReportAgentPreview','foreignKey':_0xc459('0x14f')});db[_0xc459('0x65')][_0xc459('0x10f')](db[_0xc459('0xcb')],{'as':_0xc459('0x191'),'foreignKey':_0xc459('0x14f')});db['CmContact'][_0xc459('0x10f')](db[_0xc459('0x56')],{'as':'OpenchannelInteractions','foreignKey':_0xc459('0x14f'),'onDelete':_0xc459('0x154')});db[_0xc459('0x65')]['hasMany'](db[_0xc459('0x113')],{'as':_0xc459('0x114'),'foreignKey':_0xc459('0x14f'),'onDelete':_0xc459('0x154')});db[_0xc459('0x65')]['hasMany'](db[_0xc459('0x4e')],{'as':_0xc459('0x115'),'foreignKey':_0xc459('0x14f'),'onDelete':'restrict'});db[_0xc459('0x65')]['hasMany'](db[_0xc459('0x47')],{'as':_0xc459('0x116'),'foreignKey':'ContactId','onDelete':_0xc459('0x154')});db[_0xc459('0x65')]['hasMany'](db[_0xc459('0x3b')],{'as':_0xc459('0x117'),'foreignKey':'ContactId','onDelete':_0xc459('0x154')});db[_0xc459('0x65')][_0xc459('0x11c')](db[_0xc459('0x63')],{'as':_0xc459('0x192'),'foreignKey':_0xc459('0x18f')});db['CmContact'][_0xc459('0x11c')](db[_0xc459('0xef')],{'as':_0xc459('0x16f'),'foreignKey':'ListId','onDelete':_0xc459('0x10c')});db[_0xc459('0x65')][_0xc459('0x11e')](db[_0xc459('0x10')],{'as':_0xc459('0x174'),'through':_0xc459('0x121')});db[_0xc459('0x65')][_0xc459('0x11e')](db[_0xc459('0x85')],{'as':'Tags','through':'cm_contact_has_tags'});db[_0xc459('0x65')][_0xc459('0x11e')](db['Tag'],{'through':_0xc459('0x193'),'as':'ThroughTags'});db[_0xc459('0x67')]['hasMany'](db['CmHopperAdditionalPhone'],{'as':_0xc459('0x194'),'foreignKey':'CmHopperId'});db[_0xc459('0x67')][_0xc459('0x11c')](db['CmContact'],{'as':_0xc459('0x14e'),'foreignKey':_0xc459('0x14f'),'onDelete':_0xc459('0x10c')});db[_0xc459('0x67')]['belongsTo'](db['CmList'],{'as':_0xc459('0x16f'),'foreignKey':_0xc459('0x15c'),'onDelete':_0xc459('0x10c')});db[_0xc459('0x67')][_0xc459('0x11c')](db['User'],{'as':_0xc459('0x187'),'foreignKey':_0xc459('0x10d')});db['CmHopper'][_0xc459('0x11c')](db[_0xc459('0x18')],{'as':_0xc459('0x195'),'foreignKey':_0xc459('0x13e'),'onDelete':_0xc459('0x10c')});db[_0xc459('0x67')]['belongsTo'](db[_0xc459('0x196')],{'as':_0xc459('0x196'),'foreignKey':'CampaignId','onDelete':_0xc459('0x10c')});db[_0xc459('0x67')][_0xc459('0x11c')](db[_0xc459('0x10')],{'as':_0xc459('0x165'),'foreignKey':_0xc459('0x197')});db[_0xc459('0x69')][_0xc459('0x11c')](db[_0xc459('0x65')],{'as':'Contact','foreignKey':_0xc459('0x14f'),'onDelete':'cascade'});db['CmHopperBlack'][_0xc459('0x11c')](db[_0xc459('0xef')],{'as':'List','foreignKey':_0xc459('0x15c'),'onDelete':_0xc459('0x10c')});db[_0xc459('0x69')][_0xc459('0x11c')](db['VoiceQueue'],{'as':_0xc459('0x195'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0xc459('0x69')][_0xc459('0x11c')](db[_0xc459('0x196')],{'as':_0xc459('0x196'),'foreignKey':_0xc459('0x198'),'onDelete':_0xc459('0x10c')});db[_0xc459('0x74')]['hasMany'](db[_0xc459('0x78')],{'as':{'plural':'All','singular':_0xc459('0x199')},'foreignKey':_0xc459('0x19a'),'onDelete':_0xc459('0x10c'),'hooks':!![]});db[_0xc459('0x74')][_0xc459('0x10f')](db[_0xc459('0x78')],{'as':{'plural':_0xc459('0x19b'),'singular':_0xc459('0x19c')},'foreignKey':_0xc459('0x19d'),'onDelete':'cascade','hooks':!![]});db[_0xc459('0x74')][_0xc459('0x10f')](db[_0xc459('0x72')],{'as':_0xc459('0x19e'),'foreignKey':_0xc459('0x19f'),'onDelete':'cascade','hooks':!![]});db['Disposition'][_0xc459('0x10f')](db[_0xc459('0x178')],{'as':_0xc459('0x157'),'foreignKey':'ParentId','onDelete':_0xc459('0x10c')});db[_0xc459('0x7a')][_0xc459('0x10f')](db['Interval'],{'as':_0xc459('0x1a0'),'foreignKey':_0xc459('0x142'),'onDelete':_0xc459('0x10c'),'hooks':!![],'required':![]});db[_0xc459('0x7a')][_0xc459('0x10f')](db['VoiceExtension'],{'as':_0xc459('0x111'),'foreignKey':'IntervalId','onDelete':'restrict'});db[_0xc459('0x7a')]['hasMany'](db[_0xc459('0x3e')],{'as':_0xc459('0x1a1'),'foreignKey':_0xc459('0x142')});db['Interval']['hasMany'](db[_0xc459('0x5a')],{'as':_0xc459('0x1a2'),'foreignKey':_0xc459('0x142')});db[_0xc459('0x7a')][_0xc459('0x10f')](db[_0xc459('0x171')],{'as':_0xc459('0x1a3'),'foreignKey':_0xc459('0x142')});db['Interval'][_0xc459('0x10f')](db[_0xc459('0x17a')],{'as':_0xc459('0x1a4'),'foreignKey':'IntervalId'});db['Schedule'][_0xc459('0x11c')](db['MailAccount'],{});db[_0xc459('0x82')][_0xc459('0x11c')](db[_0xc459('0x1a5')],{'foreignKey':_0xc459('0x1a6')});db[_0xc459('0x82')][_0xc459('0x11c')](db['AnalyticCustomReport'],{'foreignKey':_0xc459('0x1a7')});db[_0xc459('0x83')][_0xc459('0x11e')](db[_0xc459('0x1a8')],{'as':_0xc459('0x1a9'),'through':_0xc459('0x1aa'),'onDelete':_0xc459('0x154')});db[_0xc459('0x85')][_0xc459('0x11e')](db[_0xc459('0x65')],{'through':'cm_contact_has_tags'});db[_0xc459('0x85')][_0xc459('0x11e')](db['ChatInteraction'],{'through':_0xc459('0x189')});db['Tag']['belongsToMany'](db[_0xc459('0x3b')],{'through':_0xc459('0x166')});db[_0xc459('0x85')]['belongsToMany'](db[_0xc459('0x4e')],{'through':'sms_interaction_has_tags'});db[_0xc459('0x85')][_0xc459('0x11e')](db[_0xc459('0x47')],{'through':_0xc459('0x173')});db[_0xc459('0x85')][_0xc459('0x11e')](db[_0xc459('0x56')],{'through':_0xc459('0x183')});db[_0xc459('0x85')][_0xc459('0x11e')](db[_0xc459('0xfa')],{'through':_0xc459('0x1ab')});db[_0xc459('0x87')][_0xc459('0x11c')](db['ContactItemType'],{'as':_0xc459('0x1ac'),'foreignKey':_0xc459('0x1ad')});db[_0xc459('0x89')][_0xc459('0x11c')](db[_0xc459('0x67')],{'as':_0xc459('0x1ae'),'foreignKey':_0xc459('0x1af')});db[_0xc459('0x87')][_0xc459('0x11c')](db[_0xc459('0x65')],{'as':_0xc459('0x14e'),'foreignKey':'CmContactId'});db['Trigger'][_0xc459('0x10f')](db[_0xc459('0x78')],{'as':{'plural':_0xc459('0x1b0'),'singular':'AllCondition'},'foreignKey':_0xc459('0x1b1'),'onDelete':_0xc459('0x10c'),'hooks':!![]});db[_0xc459('0x8c')][_0xc459('0x10f')](db['Condition'],{'as':{'plural':'AnyConditions','singular':_0xc459('0x1b2')},'foreignKey':_0xc459('0x1b3'),'onDelete':'cascade','hooks':!![]});db[_0xc459('0x8c')][_0xc459('0x10f')](db[_0xc459('0x72')],{'as':_0xc459('0x19e'),'foreignKey':_0xc459('0x1b4'),'onDelete':'cascade','hooks':!![]});db[_0xc459('0x91')][_0xc459('0x10f')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0xc459('0x10c'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0xc459('0x10f')](db[_0xc459('0x1b5')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xc459('0x1a6')});db[_0xc459('0x95')][_0xc459('0x10f')](db[_0xc459('0x1b5')],{'as':'Fields','onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x1b6')});db[_0xc459('0x1b5')][_0xc459('0x11c')](db['AnalyticMetric'],{'foreignKey':_0xc459('0x1b6')});db[_0xc459('0x99')]['hasMany'](db[_0xc459('0x9b')],{'as':_0xc459('0x1b7'),'onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x1b8')});db[_0xc459('0x9b')][_0xc459('0x10f')](db['SalesforceField'],{'as':'Subjects','onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x1b9')});db[_0xc459('0x9b')][_0xc459('0x10f')](db[_0xc459('0x1ba')],{'as':_0xc459('0x1bb'),'onDelete':'cascade','foreignKey':_0xc459('0x1bc')});db[_0xc459('0x9b')][_0xc459('0x10f')](db[_0xc459('0x1ba')],{'as':_0xc459('0x1bd'),'onDelete':_0xc459('0x10c'),'foreignKey':'FieldId'});db[_0xc459('0x9b')][_0xc459('0x11c')](db['SalesforceAccount'],{'as':_0xc459('0x164'),'foreignKey':'AccountId'});db[_0xc459('0x1ba')][_0xc459('0x10f')](db['SalesforceField'],{'as':_0xc459('0x1be'),'foreignKey':_0xc459('0x1b9')});db['SalesforceField'][_0xc459('0x10f')](db['SalesforceField'],{'as':_0xc459('0x1bf'),'foreignKey':_0xc459('0x1bc')});db[_0xc459('0x1ba')][_0xc459('0x10f')](db['SalesforceField'],{'as':_0xc459('0x1c0'),'foreignKey':_0xc459('0x1c1')});db['SalesforceField'][_0xc459('0x11c')](db[_0xc459('0x8e')],{'as':_0xc459('0x8e'),'foreignKey':_0xc459('0x1c2')});db[_0xc459('0x1c3')][_0xc459('0x10f')](db[_0xc459('0x9f')],{'as':_0xc459('0x1b7'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xc459('0x9f')]['hasMany'](db[_0xc459('0xa1')],{'as':'Subjects','onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x1b9')});db[_0xc459('0x9f')]['hasMany'](db[_0xc459('0xa1')],{'as':_0xc459('0x1bb'),'onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x1bc')});db[_0xc459('0x9f')][_0xc459('0x10f')](db[_0xc459('0xa1')],{'as':'Fields','onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x1c1')});db['SugarcrmConfiguration'][_0xc459('0x11c')](db[_0xc459('0x1c3')],{'as':'Account','foreignKey':'AccountId'});db[_0xc459('0xa1')][_0xc459('0x10f')](db[_0xc459('0xa1')],{'as':_0xc459('0x1be'),'foreignKey':'SubjectId'});db[_0xc459('0xa1')]['hasMany'](db['SugarcrmField'],{'as':_0xc459('0x1bf'),'foreignKey':_0xc459('0x1bc')});db[_0xc459('0xa1')][_0xc459('0x10f')](db[_0xc459('0xa1')],{'as':_0xc459('0x1c0'),'foreignKey':'FieldId'});db[_0xc459('0xa1')]['belongsTo'](db[_0xc459('0x8e')],{'as':_0xc459('0x8e'),'foreignKey':'VariableId'});db['DeskAccount']['hasMany'](db[_0xc459('0xa4')],{'as':_0xc459('0x1b7'),'onDelete':'cascade','foreignKey':_0xc459('0x1b8')});db[_0xc459('0xa4')][_0xc459('0x10f')](db[_0xc459('0xa6')],{'as':_0xc459('0x1c4'),'onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x1b9')});db[_0xc459('0xa4')]['hasMany'](db[_0xc459('0xa6')],{'as':_0xc459('0x1bb'),'onDelete':'cascade','foreignKey':_0xc459('0x1bc')});db[_0xc459('0xa4')][_0xc459('0x10f')](db[_0xc459('0xa6')],{'as':_0xc459('0x1bd'),'onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x1c1')});db[_0xc459('0xa4')][_0xc459('0x11c')](db['DeskAccount'],{'as':_0xc459('0x164'),'foreignKey':_0xc459('0x1b8')});db[_0xc459('0xa4')][_0xc459('0x11e')](db[_0xc459('0x85')],{'through':_0xc459('0x1c5')});db['DeskField'][_0xc459('0x10f')](db[_0xc459('0xa6')],{'as':'Subject','foreignKey':_0xc459('0x1b9')});db['DeskField'][_0xc459('0x10f')](db[_0xc459('0xa6')],{'as':_0xc459('0x1bf'),'foreignKey':_0xc459('0x1bc')});db[_0xc459('0xa6')]['hasMany'](db[_0xc459('0xa6')],{'as':_0xc459('0x1c0'),'foreignKey':'FieldId'});db[_0xc459('0xa6')][_0xc459('0x11c')](db[_0xc459('0x8e')],{'as':_0xc459('0x8e'),'foreignKey':'VariableId'});db['ZohoAccount'][_0xc459('0x10f')](db[_0xc459('0xa8')],{'as':'Configurations','onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x1b8')});db[_0xc459('0xa8')][_0xc459('0x10f')](db[_0xc459('0x1c6')],{'as':'Subjects','onDelete':_0xc459('0x10c'),'foreignKey':'SubjectId'});db[_0xc459('0xa8')][_0xc459('0x10f')](db[_0xc459('0x1c6')],{'as':_0xc459('0x1bb'),'onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x1bc')});db['ZohoConfiguration'][_0xc459('0x10f')](db[_0xc459('0x1c6')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xc459('0x1c1')});db[_0xc459('0xa8')][_0xc459('0x11c')](db[_0xc459('0xa7')],{'as':_0xc459('0x164'),'foreignKey':'AccountId'});db[_0xc459('0x1c6')]['hasMany'](db['ZohoField'],{'as':_0xc459('0x1be'),'foreignKey':'SubjectId'});db[_0xc459('0x1c6')][_0xc459('0x10f')](db[_0xc459('0x1c6')],{'as':_0xc459('0x1bf'),'foreignKey':_0xc459('0x1bc')});db[_0xc459('0x1c6')][_0xc459('0x10f')](db[_0xc459('0x1c6')],{'as':_0xc459('0x1c0'),'foreignKey':_0xc459('0x1c1')});db[_0xc459('0x1c6')][_0xc459('0x11c')](db[_0xc459('0x8e')],{'as':_0xc459('0x8e'),'foreignKey':'VariableId'});db[_0xc459('0xab')][_0xc459('0x10f')](db[_0xc459('0xac')],{'as':_0xc459('0x1b7'),'onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x1b8')});db[_0xc459('0xac')][_0xc459('0x10f')](db[_0xc459('0xae')],{'as':_0xc459('0x1c4'),'foreignKey':_0xc459('0x1b9')});db[_0xc459('0xac')][_0xc459('0x10f')](db['ZendeskField'],{'as':_0xc459('0x1bb'),'foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0xc459('0x10f')](db['ZendeskField'],{'as':_0xc459('0x1bd'),'foreignKey':_0xc459('0x1c1')});db['ZendeskConfiguration'][_0xc459('0x11c')](db[_0xc459('0xab')],{'as':_0xc459('0x164'),'foreignKey':'AccountId'});db[_0xc459('0xac')][_0xc459('0x11e')](db[_0xc459('0x85')],{'through':'int_zendesk_configuration_has_tags'});db[_0xc459('0xae')][_0xc459('0x10f')](db[_0xc459('0xae')],{'as':_0xc459('0x1be'),'foreignKey':'SubjectId'});db[_0xc459('0xae')][_0xc459('0x10f')](db['ZendeskField'],{'as':_0xc459('0x1bf'),'foreignKey':'DescriptionId'});db[_0xc459('0xae')]['hasMany'](db['ZendeskField'],{'as':'Field','foreignKey':'FieldId'});db[_0xc459('0xae')][_0xc459('0x11c')](db['Variable'],{'as':_0xc459('0x8e'),'foreignKey':_0xc459('0x1c2')});db[_0xc459('0xaf')][_0xc459('0x10f')](db[_0xc459('0xb1')],{'as':_0xc459('0x1b7'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xc459('0xb1')][_0xc459('0x10f')](db['FreshdeskField'],{'as':'Subjects','onDelete':_0xc459('0x10c'),'foreignKey':'SubjectId'});db[_0xc459('0xb1')][_0xc459('0x10f')](db[_0xc459('0xb2')],{'as':'Descriptions','onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x1bc')});db[_0xc459('0xb1')][_0xc459('0x10f')](db[_0xc459('0xb2')],{'as':_0xc459('0x1bd'),'onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x1c1')});db[_0xc459('0xb1')]['belongsTo'](db[_0xc459('0xaf')],{'as':_0xc459('0x164'),'foreignKey':_0xc459('0x1b8')});db[_0xc459('0xb1')][_0xc459('0x11e')](db[_0xc459('0x85')],{'through':_0xc459('0x1c7')});db['FreshdeskField'][_0xc459('0x10f')](db[_0xc459('0xb2')],{'as':_0xc459('0x1be'),'foreignKey':_0xc459('0x1b9')});db['FreshdeskField'][_0xc459('0x10f')](db[_0xc459('0xb2')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xc459('0xb2')][_0xc459('0x10f')](db[_0xc459('0xb2')],{'as':_0xc459('0x1c0'),'foreignKey':_0xc459('0x1c1')});db[_0xc459('0xb2')]['belongsTo'](db[_0xc459('0x8e')],{'as':_0xc459('0x8e'),'foreignKey':_0xc459('0x1c2')});db[_0xc459('0xb4')][_0xc459('0x10f')](db[_0xc459('0xb6')],{'as':_0xc459('0x1b7'),'onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x1b8')});db[_0xc459('0xb6')]['hasMany'](db[_0xc459('0xb8')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0xc459('0xb6')][_0xc459('0x10f')](db[_0xc459('0xb8')],{'as':_0xc459('0x1bb'),'foreignKey':_0xc459('0x1bc')});db[_0xc459('0xb6')][_0xc459('0x10f')](db[_0xc459('0xb8')],{'as':_0xc459('0x1bd'),'foreignKey':_0xc459('0x1c1')});db[_0xc459('0xb6')][_0xc459('0x11c')](db['VtigerAccount'],{'as':_0xc459('0x164'),'foreignKey':_0xc459('0x1b8')});db[_0xc459('0xb8')][_0xc459('0x10f')](db[_0xc459('0xb8')],{'as':_0xc459('0x1be'),'foreignKey':_0xc459('0x1b9')});db[_0xc459('0xb8')][_0xc459('0x10f')](db['VtigerField'],{'as':_0xc459('0x1bf'),'foreignKey':_0xc459('0x1bc')});db[_0xc459('0xb8')][_0xc459('0x10f')](db[_0xc459('0xb8')],{'as':_0xc459('0x1c0'),'foreignKey':_0xc459('0x1c1')});db[_0xc459('0xb8')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0xc459('0x1c2')});db['ServicenowAccount'][_0xc459('0x10f')](db[_0xc459('0xbc')],{'as':_0xc459('0x1b7'),'onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x1b8')});db['ServicenowConfiguration'][_0xc459('0x10f')](db[_0xc459('0xbd')],{'as':_0xc459('0x1c4'),'foreignKey':_0xc459('0x1b9')});db['ServicenowConfiguration']['hasMany'](db[_0xc459('0xbd')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ServicenowConfiguration'][_0xc459('0x10f')](db['ServicenowField'],{'as':'Fields','foreignKey':'FieldId'});db[_0xc459('0xbc')][_0xc459('0x11c')](db[_0xc459('0xba')],{'as':_0xc459('0x164'),'foreignKey':_0xc459('0x1b8')});db[_0xc459('0xbd')][_0xc459('0x10f')](db[_0xc459('0xbd')],{'as':_0xc459('0x1be'),'foreignKey':_0xc459('0x1b9')});db[_0xc459('0xbd')][_0xc459('0x10f')](db['ServicenowField'],{'as':_0xc459('0x1bf'),'foreignKey':_0xc459('0x1bc')});db[_0xc459('0xbd')]['hasMany'](db[_0xc459('0xbd')],{'as':_0xc459('0x1c0'),'foreignKey':_0xc459('0x1c1')});db['ServicenowField'][_0xc459('0x11c')](db[_0xc459('0x8e')],{'as':_0xc459('0x8e'),'foreignKey':_0xc459('0x1c2')});db[_0xc459('0x1c8')]['hasMany'](db[_0xc459('0xbf')],{'as':_0xc459('0x1b7'),'onDelete':_0xc459('0x10c'),'foreignKey':'AccountId'});db[_0xc459('0x1c8')][_0xc459('0x11c')](db['CloudProvider'],{'as':_0xc459('0x103'),'foreignKey':_0xc459('0x153')});db[_0xc459('0xbf')]['hasMany'](db[_0xc459('0x1c9')],{'as':_0xc459('0x1c4'),'onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x1b9')});db[_0xc459('0xbf')][_0xc459('0x10f')](db[_0xc459('0x1c9')],{'as':_0xc459('0x1bb'),'onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x1bc')});db['Dynamics365Configuration'][_0xc459('0x10f')](db['Dynamics365Field'],{'as':_0xc459('0x1bd'),'onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x1c1')});db[_0xc459('0xbf')]['belongsTo'](db['Dynamics365Account'],{'as':_0xc459('0x164'),'foreignKey':'AccountId'});db[_0xc459('0x1c9')][_0xc459('0x10f')](db[_0xc459('0x1c9')],{'as':_0xc459('0x1be'),'foreignKey':_0xc459('0x1b9')});db[_0xc459('0x1c9')][_0xc459('0x10f')](db[_0xc459('0x1c9')],{'as':_0xc459('0x1bf'),'foreignKey':_0xc459('0x1bc')});db['Dynamics365Field'][_0xc459('0x10f')](db[_0xc459('0x1c9')],{'as':_0xc459('0x1c0'),'foreignKey':_0xc459('0x1c1')});db[_0xc459('0x1c9')]['belongsTo'](db[_0xc459('0x8e')],{'as':_0xc459('0x8e'),'foreignKey':'VariableId'});db[_0xc459('0x1ca')][_0xc459('0x10f')](db['FreshsalesConfiguration'],{'as':_0xc459('0x1b7'),'onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x1b8')});db[_0xc459('0xc1')][_0xc459('0x10f')](db[_0xc459('0x1cb')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0xc459('0xc1')]['hasMany'](db[_0xc459('0x1cb')],{'as':'Descriptions','foreignKey':_0xc459('0x1bc')});db[_0xc459('0xc1')]['hasMany'](db[_0xc459('0x1cb')],{'as':'Fields','foreignKey':_0xc459('0x1c1')});db[_0xc459('0xc1')]['belongsTo'](db[_0xc459('0x1ca')],{'as':_0xc459('0x164'),'foreignKey':'AccountId'});db[_0xc459('0x1cb')]['hasMany'](db[_0xc459('0x1cb')],{'as':_0xc459('0x1be'),'foreignKey':_0xc459('0x1b9')});db[_0xc459('0x1cb')][_0xc459('0x10f')](db[_0xc459('0x1cb')],{'as':'Description','foreignKey':_0xc459('0x1bc')});db[_0xc459('0x1cb')][_0xc459('0x10f')](db['FreshsalesField'],{'as':'Field','foreignKey':_0xc459('0x1c1')});db[_0xc459('0x1cb')][_0xc459('0x11c')](db[_0xc459('0x8e')],{'as':_0xc459('0x8e'),'foreignKey':_0xc459('0x1c2')});db[_0xc459('0x1cc')][_0xc459('0x11c')](db[_0xc459('0x16b')],{});db['ChatQueueReport'][_0xc459('0x11c')](db[_0xc459('0xef')],{'as':_0xc459('0x16f'),'foreignKey':_0xc459('0x15c')});db['ChatQueueReport']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xc459('0x14f')});db[_0xc459('0x1cc')][_0xc459('0x11c')](db['ChatInteraction'],{});db[_0xc459('0x1cc')][_0xc459('0x11c')](db['ChatMessage'],{});db[_0xc459('0x1cc')][_0xc459('0x11c')](db[_0xc459('0x10')],{});db[_0xc459('0x1cc')][_0xc459('0x11c')](db[_0xc459('0x5f')],{});db[_0xc459('0xc6')][_0xc459('0x11c')](db[_0xc459('0x10')],{'onDelete':'cascade','foreignKey':_0xc459('0x1cd')});db[_0xc459('0xc6')][_0xc459('0x11c')](db[_0xc459('0x10')],{'onDelete':'cascade','foreignKey':_0xc459('0x1ce')});db[_0xc459('0xcb')][_0xc459('0x10f')](db[_0xc459('0xc9')],{'foreignKey':_0xc459('0x1cf'),'onDelete':_0xc459('0x10c')});db[_0xc459('0xcb')]['hasMany'](db[_0xc459('0xc8')],{'foreignKey':_0xc459('0x1cf'),'onDelete':_0xc459('0x10c')});db[_0xc459('0xcd')][_0xc459('0x11c')](db['SmsAccount'],{});db[_0xc459('0xcd')][_0xc459('0x11c')](db[_0xc459('0xef')],{'as':'List','foreignKey':_0xc459('0x15c')});db['SmsQueueReport'][_0xc459('0x11c')](db[_0xc459('0x65')],{'as':_0xc459('0x14e'),'foreignKey':_0xc459('0x14f')});db[_0xc459('0xcd')][_0xc459('0x11c')](db[_0xc459('0x4e')],{});db[_0xc459('0xcd')][_0xc459('0x11c')](db[_0xc459('0x4f')],{});db[_0xc459('0xcd')]['belongsTo'](db['User'],{});db[_0xc459('0xcd')][_0xc459('0x11c')](db[_0xc459('0x51')],{});db['JscriptyProject'][_0xc459('0x10f')](db[_0xc459('0xcb')],{'foreignKey':_0xc459('0x1d0')});db['JscriptyProject'][_0xc459('0x10f')](db[_0xc459('0xc9')],{'foreignKey':_0xc459('0x1d0')});db[_0xc459('0xd1')][_0xc459('0x10f')](db['JscriptyAnswerReport'],{'foreignKey':_0xc459('0x1d0')});db[_0xc459('0x161')][_0xc459('0x11e')](db[_0xc459('0x10')],{'as':_0xc459('0x15f'),'through':_0xc459('0x124')});db[_0xc459('0x161')][_0xc459('0x11e')](db[_0xc459('0x18')],{'through':'TeamVoiceQueue','as':'VoiceQueues'});db[_0xc459('0x161')][_0xc459('0x11e')](db[_0xc459('0x38')],{'through':'team_has_mail_queues','as':_0xc459('0x1d1')});db['Team']['belongsToMany'](db['ChatQueue'],{'through':_0xc459('0x18b'),'as':_0xc459('0x1d2')});db['Team']['belongsToMany'](db[_0xc459('0x4a')],{'through':_0xc459('0x176'),'as':'FaxQueues'});db[_0xc459('0x161')]['belongsToMany'](db[_0xc459('0x51')],{'through':_0xc459('0x17e'),'as':'SmsQueues'});db['Team']['belongsToMany'](db[_0xc459('0x58')],{'through':_0xc459('0x1d3'),'as':_0xc459('0x131')});db[_0xc459('0x161')][_0xc459('0x11e')](db[_0xc459('0x101')],{'through':_0xc459('0x1d4'),'as':'WhatsappQueues'});db['Team'][_0xc459('0x11e')](db[_0xc459('0x12b')],{'through':'TeamVoicePrefix','as':'VoicePrefixes'});db[_0xc459('0x196')][_0xc459('0x10f')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xc459('0x198')});db['Campaign'][_0xc459('0x10f')](db[_0xc459('0x6b')],{'as':_0xc459('0x112'),'foreignKey':_0xc459('0x198')});db[_0xc459('0x196')][_0xc459('0x10f')](db[_0xc459('0x6d')],{'as':_0xc459('0x13f'),'foreignKey':_0xc459('0x198')});db[_0xc459('0x196')]['hasMany'](db[_0xc459('0x69')],{'as':'HopperBlacks','foreignKey':_0xc459('0x198')});db[_0xc459('0x196')][_0xc459('0x11c')](db[_0xc459('0x26')],{'as':_0xc459('0x26'),'foreignKey':_0xc459('0x140')});db[_0xc459('0x196')][_0xc459('0x11c')](db[_0xc459('0x26')],{'as':_0xc459('0x1d5'),'foreignKey':_0xc459('0x141')});db['Campaign'][_0xc459('0x11c')](db[_0xc459('0x7a')],{'as':_0xc459('0x7a'),'foreignKey':'IntervalId'});db[_0xc459('0x196')][_0xc459('0x11c')](db[_0xc459('0xd7')],{'as':_0xc459('0xd7'),'foreignKey':_0xc459('0x1d6')});db[_0xc459('0x196')][_0xc459('0x11e')](db['CmList'],{'as':_0xc459('0x122'),'through':_0xc459('0x1d7')});db[_0xc459('0x196')][_0xc459('0x11e')](db[_0xc459('0xef')],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db[_0xc459('0xe3')][_0xc459('0x11c')](db[_0xc459('0x5d')],{'as':_0xc459('0x5d'),'foreignKey':_0xc459('0x16d')});db[_0xc459('0xe7')][_0xc459('0x11c')](db[_0xc459('0x3d')],{});db[_0xc459('0xe7')][_0xc459('0x11c')](db[_0xc459('0x3b')],{});db[_0xc459('0xe7')][_0xc459('0x11c')](db[_0xc459('0x37')],{'foreignKey':_0xc459('0x1d8'),'as':_0xc459('0x1d9')});db[_0xc459('0xe7')][_0xc459('0x11c')](db[_0xc459('0x10')],{'foreignKey':_0xc459('0x1da'),'as':_0xc459('0x1db')});db[_0xc459('0xe7')][_0xc459('0x11c')](db[_0xc459('0x10')],{'foreignKey':'ToUserId','as':'ToAgent'});db['MailTransferReport'][_0xc459('0x11c')](db['MailQueue'],{'foreignKey':_0xc459('0x1dc'),'as':_0xc459('0x1dd')});db[_0xc459('0xe7')]['belongsTo'](db[_0xc459('0x37')],{'foreignKey':'ToMailAccountId','as':_0xc459('0x1de')});db[_0xc459('0xe8')]['belongsTo'](db[_0xc459('0x185')],{});db[_0xc459('0xe8')][_0xc459('0x11c')](db['ChatInteraction'],{});db[_0xc459('0xe8')][_0xc459('0x11c')](db[_0xc459('0x16b')],{'foreignKey':'FromChatWebsiteId','as':_0xc459('0x1d9')});db[_0xc459('0xe8')][_0xc459('0x11c')](db['User'],{'foreignKey':_0xc459('0x1da'),'as':'FromAgent'});db['ChatTransferReport'][_0xc459('0x11c')](db['User'],{'foreignKey':_0xc459('0x1df'),'as':'ToAgent'});db[_0xc459('0xe8')]['belongsTo'](db[_0xc459('0x5f')],{'foreignKey':'ToChatQueueId','as':_0xc459('0x1dd')});db[_0xc459('0xe8')][_0xc459('0x11c')](db[_0xc459('0x16b')],{'foreignKey':_0xc459('0x1e0'),'as':_0xc459('0x1de')});db[_0xc459('0x1e1')][_0xc459('0x11c')](db[_0xc459('0x48')],{});db['FaxTransferReport'][_0xc459('0x11c')](db[_0xc459('0x47')],{});db[_0xc459('0x1e1')][_0xc459('0x11c')](db[_0xc459('0x45')],{'foreignKey':_0xc459('0x1e2'),'as':_0xc459('0x1d9')});db[_0xc459('0x1e1')][_0xc459('0x11c')](db[_0xc459('0x10')],{'foreignKey':_0xc459('0x1da'),'as':_0xc459('0x1db')});db['FaxTransferReport'][_0xc459('0x11c')](db[_0xc459('0x10')],{'foreignKey':_0xc459('0x1df'),'as':'ToAgent'});db[_0xc459('0x1e1')][_0xc459('0x11c')](db['FaxQueue'],{'foreignKey':_0xc459('0x1e3'),'as':_0xc459('0x1dd')});db[_0xc459('0x1e1')][_0xc459('0x11c')](db[_0xc459('0x45')],{'foreignKey':_0xc459('0x1e4'),'as':_0xc459('0x1de')});db[_0xc459('0xeb')][_0xc459('0x11c')](db['OpenchannelMessage'],{});db[_0xc459('0xeb')][_0xc459('0x11c')](db[_0xc459('0x56')],{});db[_0xc459('0xeb')][_0xc459('0x11c')](db[_0xc459('0x52')],{'foreignKey':_0xc459('0x1e5'),'as':_0xc459('0x1d9')});db['OpenchannelTransferReport'][_0xc459('0x11c')](db[_0xc459('0x10')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xc459('0xeb')][_0xc459('0x11c')](db[_0xc459('0x10')],{'foreignKey':_0xc459('0x1df'),'as':_0xc459('0x1e6')});db[_0xc459('0xeb')][_0xc459('0x11c')](db[_0xc459('0x58')],{'foreignKey':_0xc459('0x1e7'),'as':_0xc459('0x1dd')});db['OpenchannelTransferReport'][_0xc459('0x11c')](db[_0xc459('0x52')],{'foreignKey':_0xc459('0x1e8'),'as':'ToAccount'});db[_0xc459('0xed')]['belongsTo'](db['SmsMessage'],{});db[_0xc459('0xed')]['belongsTo'](db[_0xc459('0x4e')],{});db[_0xc459('0xed')][_0xc459('0x11c')](db[_0xc459('0x4d')],{'foreignKey':'FromSmsAccountId','as':_0xc459('0x1d9')});db[_0xc459('0xed')][_0xc459('0x11c')](db[_0xc459('0x10')],{'foreignKey':_0xc459('0x1da'),'as':'FromAgent'});db['SmsTransferReport'][_0xc459('0x11c')](db[_0xc459('0x10')],{'foreignKey':_0xc459('0x1df'),'as':_0xc459('0x1e6')});db[_0xc459('0xed')][_0xc459('0x11c')](db[_0xc459('0x51')],{'foreignKey':_0xc459('0x1e9'),'as':_0xc459('0x1dd')});db[_0xc459('0xed')][_0xc459('0x11c')](db[_0xc459('0x4d')],{'foreignKey':_0xc459('0x1ea'),'as':_0xc459('0x1de')});db['CmList'][_0xc459('0x10f')](db[_0xc459('0x178')],{'as':_0xc459('0x157'),'foreignKey':'ListId','onDelete':_0xc459('0x10c')});db['CmList'][_0xc459('0x10f')](db[_0xc459('0x70')],{'as':'CustomFields','foreignKey':_0xc459('0x15c')});db[_0xc459('0xef')][_0xc459('0x10f')](db[_0xc459('0x65')],{'as':'Contacts','onDelete':_0xc459('0x10c'),'foreignKey':_0xc459('0x15c')});db[_0xc459('0xef')][_0xc459('0x10f')](db[_0xc459('0x6b')],{'as':_0xc459('0x112'),'foreignKey':'ListId'});db['CmList'][_0xc459('0x10f')](db[_0xc459('0x6d')],{'as':_0xc459('0x1eb'),'foreignKey':'ListId'});db[_0xc459('0xef')][_0xc459('0x10f')](db[_0xc459('0x6e')],{'as':_0xc459('0x6e'),'foreignKey':_0xc459('0x15c')});db[_0xc459('0xef')][_0xc459('0x11e')](db[_0xc459('0x18')],{'as':_0xc459('0x1ec'),'through':'voice_queues_has_cm_lists'});db['CmList'][_0xc459('0x11e')](db['User'],{'as':_0xc459('0x15f'),'through':_0xc459('0x123')});db['VoicePrefix']['hasMany'](db['VoiceExtension'],{'as':_0xc459('0x111'),'onDelete':'cascade'});db[_0xc459('0x12b')]['belongsToMany'](db[_0xc459('0x10')],{'as':_0xc459('0x15f'),'through':_0xc459('0x12d')});db['VoicePrefix']['belongsToMany'](db[_0xc459('0x161')],{'through':'TeamVoicePrefix','as':_0xc459('0x145')});db[_0xc459('0x11d')]['hasMany'](db[_0xc459('0x10')],{'as':_0xc459('0x174'),'foreignKey':_0xc459('0x1ed')});db[_0xc459('0x11d')][_0xc459('0x10f')](db[_0xc459('0xf2')],{'as':_0xc459('0x1ee'),'foreignKey':_0xc459('0x1ed'),'onDelete':_0xc459('0x10c')});db[_0xc459('0xf2')][_0xc459('0x10f')](db[_0xc459('0xf4')],{'as':_0xc459('0x1ef'),'foreignKey':'sectionId','onDelete':_0xc459('0x10c')});db[_0xc459('0xf8')][_0xc459('0x10f')](db['Disposition'],{'as':_0xc459('0x157'),'foreignKey':'WhatsappAccountId','onDelete':_0xc459('0x10c')});db[_0xc459('0xf8')]['hasMany'](db[_0xc459('0x158')],{'as':_0xc459('0x159'),'foreignKey':_0xc459('0x1f0')});db[_0xc459('0xf8')][_0xc459('0x10f')](db['WhatsappMessage'],{'as':_0xc459('0x15a'),'foreignKey':_0xc459('0x1f0')});db[_0xc459('0xf8')][_0xc459('0x10f')](db[_0xc459('0xfa')],{'as':_0xc459('0x15b')});db[_0xc459('0xf8')][_0xc459('0x10f')](db['WhatsappApplication'],{'as':'Applications','foreignKey':_0xc459('0x1f0'),'onDelete':_0xc459('0x10c')});db[_0xc459('0xf8')]['belongsTo'](db[_0xc459('0xef')],{'as':'List','foreignKey':_0xc459('0x15c')});db['WhatsappAccount'][_0xc459('0x11c')](db[_0xc459('0x7c')],{'as':_0xc459('0x143'),'foreignKey':_0xc459('0x15e')});db[_0xc459('0xf8')][_0xc459('0x11e')](db[_0xc459('0x10')],{'as':'Agents','through':_0xc459('0x139')});db[_0xc459('0x1f1')][_0xc459('0x11c')](db['User'],{'onDelete':_0xc459('0x154')});db[_0xc459('0x1f1')][_0xc459('0x11c')](db[_0xc459('0x101')],{'onDelete':_0xc459('0x154')});db['WhatsappApplication'][_0xc459('0x11c')](db[_0xc459('0xf8')],{'onDelete':'restrict'});db[_0xc459('0x1f1')]['belongsTo'](db[_0xc459('0x7a')],{'onDelete':_0xc459('0x154'),'foreignKey':_0xc459('0x142')});db[_0xc459('0x1f1')]['belongsTo'](db[_0xc459('0x85')],{'onDelete':_0xc459('0x154'),'foreignKey':_0xc459('0x16e')});db[_0xc459('0xfa')][_0xc459('0x10f')](db[_0xc459('0xfc')],{'as':_0xc459('0x15a'),'onDelete':'cascade','foreignKey':_0xc459('0x1f2')});db[_0xc459('0xfa')][_0xc459('0x11c')](db[_0xc459('0xf8')],{'as':_0xc459('0x164'),'foreignKey':'WhatsappAccountId'});db[_0xc459('0xfa')][_0xc459('0x11c')](db[_0xc459('0x65')],{'as':_0xc459('0x14e'),'foreignKey':_0xc459('0x14f')});db[_0xc459('0xfa')]['belongsTo'](db[_0xc459('0x10')],{'as':_0xc459('0x165'),'foreignKey':_0xc459('0x10d')});db[_0xc459('0xfa')][_0xc459('0x11e')](db[_0xc459('0x85')],{'through':'whatsapp_interaction_has_tags','as':_0xc459('0x167')});db[_0xc459('0xfa')][_0xc459('0x11e')](db['Tag'],{'through':_0xc459('0x1ab'),'as':_0xc459('0x168')});db['WhatsappInteraction'][_0xc459('0x11e')](db[_0xc459('0x10')],{'as':'Users','through':'user_has_whatsapp_interactions','foreignKey':'WhatsappInteractionId'});db[_0xc459('0xfc')][_0xc459('0x11c')](db['User'],{'as':_0xc459('0x10')});db['WhatsappMessage'][_0xc459('0x11c')](db['CmContact'],{'onDelete':'cascade','as':_0xc459('0x14e')});db[_0xc459('0xfc')][_0xc459('0x11c')](db[_0xc459('0xfa')],{'onDelete':_0xc459('0x10c'),'as':'Interaction','foreignKey':_0xc459('0x1f2')});db[_0xc459('0xfc')]['belongsTo'](db[_0xc459('0xf8')],{'as':'Account','foreignKey':_0xc459('0x1f0')});db[_0xc459('0xfe')][_0xc459('0x11c')](db['WhatsappAccount'],{});db[_0xc459('0xfe')][_0xc459('0x11c')](db[_0xc459('0xef')],{'as':_0xc459('0x16f'),'foreignKey':_0xc459('0x15c')});db[_0xc459('0xfe')][_0xc459('0x11c')](db['CmContact'],{'as':_0xc459('0x14e'),'foreignKey':_0xc459('0x14f')});db[_0xc459('0xfe')][_0xc459('0x11c')](db[_0xc459('0xfa')],{});db[_0xc459('0xfe')][_0xc459('0x11c')](db['WhatsappQueue'],{});db[_0xc459('0xfe')][_0xc459('0x11c')](db[_0xc459('0xfc')],{});db[_0xc459('0xfe')][_0xc459('0x11c')](db['User'],{});db['WhatsappTransferReport'][_0xc459('0x11c')](db[_0xc459('0xfc')],{});db[_0xc459('0x1f3')]['belongsTo'](db[_0xc459('0xfa')],{});db[_0xc459('0x1f3')]['belongsTo'](db[_0xc459('0xf8')],{'foreignKey':_0xc459('0x1f4'),'as':_0xc459('0x1d9')});db[_0xc459('0x1f3')][_0xc459('0x11c')](db[_0xc459('0xf8')],{'foreignKey':'ToWhatsappAccountId','as':_0xc459('0x1de')});db['WhatsappTransferReport']['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0xc459('0x1f5'),'as':_0xc459('0x1dd')});db[_0xc459('0x1f3')]['belongsTo'](db['User'],{'foreignKey':_0xc459('0x1da'),'as':'FromAgent'});db[_0xc459('0x1f3')][_0xc459('0x11c')](db[_0xc459('0x10')],{'foreignKey':_0xc459('0x1df'),'as':_0xc459('0x1e6')});db[_0xc459('0x101')][_0xc459('0x11e')](db[_0xc459('0x10')],{'as':_0xc459('0x15f'),'through':_0xc459('0x34'),'foreignKey':_0xc459('0x1f6')});db[_0xc459('0x101')][_0xc459('0x11e')](db[_0xc459('0x161')],{'through':_0xc459('0x1d4'),'as':_0xc459('0x145')});db[_0xc459('0x108')][_0xc459('0x11c')](db[_0xc459('0x10')],{'as':'user','foreignKey':_0xc459('0x10d'),'onDelete':_0xc459('0x10c'),'hooks':!![]});db['CloudProvider'][_0xc459('0x10b')](db[_0xc459('0x1c8')],{'as':_0xc459('0x1c8'),'onDelete':_0xc459('0x154')});db[_0xc459('0x103')][_0xc459('0x10b')](db[_0xc459('0x150')],{'as':_0xc459('0x155'),'onDelete':_0xc459('0x154')});db['CloudProvider'][_0xc459('0x10b')](db[_0xc459('0x152')],{'as':_0xc459('0x156'),'onDelete':_0xc459('0x154')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x3da7=['SenderId','Hoppers','SET\x20NULL','userProfileId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SpiedAgents','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','belongsTo','TrunkId','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Teams','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceQueueReport','QueueCalls','AgentReports','Contact','ContactId','MailServerIn','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Interactions','List','ListId','TemplateId','Agents','team_has_mail_queues','MailInteractionId','Account','Owner','Tags','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','TagId','MailQueueReport','DashboardItem','Items','FaxAccountId','Exntensions','fax_interaction_has_tags','FaxInteractionId','AttachmentId','SmsAccountId','SmsMessage','SmsApplication','sms_interaction_has_tags','SmsInteractionId','UserSmsQueue','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','OpenchannelQueueReport','Agent','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','CompanyId','Phones','CmContactId','JscriptySessions','ChatInteractions','Company','cm_contact_has_tags','AdditionalPhones','OwnerId','CmHopperBlack','Queue','CampaignId','Condition','All','AutomationAllId','Any','OneAny','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','DefaultReportId','CustomReportId','whatsapp_interaction_has_tags','ItemType','ItemTypeId','CmHopperId','AllConditions','AnyConditions','AnyCondition','Fields','AnalyticFieldReport','MetricId','Configurations','AccountId','Subjects','SubjectId','SalesforceField','Descriptions','DescriptionId','Subject','Description','Field','FieldId','Variable','VariableId','SugarcrmAccount','int_desk_configuration_has_tags','ZohoConfiguration','ZohoField','int_zendesk_configuration_has_tags','FreshdeskAccount','VtigerAccount','VtigerField','ServicenowConfiguration','Dynamics365Account','FreshsalesConfiguration','ChatQueueReport','FromId','JscriptyAnswerReport','ProjectId','TeamVoiceQueue','team_has_chat_queues','team_has_fax_queues','team_has_whatsapp_queues','WhatsappQueues','VoicePrefix','TeamVoicePrefix','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToAccount','ChatTransferReport','FromChatWebsiteId','ToAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','voice_queues_has_cm_lists','UserProfileSections','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','WhatsappQueueReport','ToWhatsappAccountId','ToQueueId','UserWhatsappQueue','WhatsappQueueId','exports','../config/environment','lodash','jstz','determine','sequelize','defaultsDeep','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8_general_ci','sequelizeHistory','motion2','name','database','username','password','options','User','import','VoiceChanSpy','../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','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','JscriptyProject','Setting','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappMessage','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications'];(function(_0x39cf70,_0x3ec55b){var _0x580424=function(_0x580a4e){while(--_0x580a4e){_0x39cf70['push'](_0x39cf70['shift']());}};_0x580424(++_0x3ec55b);}(_0x3da7,0xe2));var _0x73da=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0x3da7[_0x1147ab];return _0x55cb5a;};'use strict';var config=require(_0x73da('0x0'));var Sequelize=require('sequelize');var _=require(_0x73da('0x1'));var jstz=require(_0x73da('0x2'));var timezone=jstz[_0x73da('0x3')]();config[_0x73da('0x4')]=_[_0x73da('0x5')](config[_0x73da('0x4')],{'database':'motion2','username':_0x73da('0x6'),'password':_0x73da('0x7'),'options':{'host':_0x73da('0x8'),'port':0xcea,'dialect':_0x73da('0x9'),'dialectOptions':{'charset':_0x73da('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x73da('0xb')}}});config[_0x73da('0xc')]=_['defaultsDeep'](config[_0x73da('0xc')],{'database':_0x73da('0xd'),'username':_0x73da('0x6'),'password':'xC@LL1234','options':{'host':_0x73da('0x8'),'port':0xcea,'dialect':_0x73da('0x9'),'dialectOptions':{'charset':_0x73da('0xa')},'logging':![],'timezone':timezone[_0x73da('0xe')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x73da('0xf')],config[_0x73da('0x4')][_0x73da('0x10')],config[_0x73da('0x4')][_0x73da('0x11')],config['sequelize'][_0x73da('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x73da('0xc')][_0x73da('0xf')],config[_0x73da('0xc')]['username'],config['sequelizeHistory'][_0x73da('0x11')],config['sequelizeHistory'][_0x73da('0x12')])};db[_0x73da('0x13')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/user/user.model');db[_0x73da('0x15')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x16'));db[_0x73da('0x17')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x18'));db[_0x73da('0x19')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x1a'));db[_0x73da('0x1b')]=db['sequelize'][_0x73da('0x14')](_0x73da('0x1c'));db[_0x73da('0x1d')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x1e'));db[_0x73da('0x1f')]=db['sequelize']['import'](_0x73da('0x20'));db[_0x73da('0x21')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/screenRecording/screenRecording.model');db[_0x73da('0x22')]=db[_0x73da('0x4')]['import'](_0x73da('0x23'));db[_0x73da('0x24')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x73da('0x25')]=db[_0x73da('0x4')]['import'](_0x73da('0x26'));db[_0x73da('0x27')]=db['sequelize'][_0x73da('0x14')](_0x73da('0x28'));db[_0x73da('0x29')]=db[_0x73da('0x4')]['import'](_0x73da('0x2a'));db['VoiceQueueReport']=db[_0x73da('0x4')]['import'](_0x73da('0x2b'));db[_0x73da('0x2c')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/memberReport/memberReport.model');db[_0x73da('0x2d')]=db[_0x73da('0x4')]['import'](_0x73da('0x2e'));db[_0x73da('0x2f')]=db[_0x73da('0x4')]['import'](_0x73da('0x30'));db[_0x73da('0x31')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x32'));db['UserVoiceQueue']=db[_0x73da('0x4')]['import'](_0x73da('0x33'));db[_0x73da('0x34')]=db['sequelize'][_0x73da('0x14')](_0x73da('0x35'));db[_0x73da('0x36')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/userMailQueue/userMailQueue.model');db[_0x73da('0x37')]=db['sequelize'][_0x73da('0x14')](_0x73da('0x38'));db['UserSmsQueue']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x39'));db[_0x73da('0x3a')]=db['sequelize'][_0x73da('0x14')](_0x73da('0x3b'));db['UserWhatsappQueue']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x3c'));db['MailServerIn']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x3d'));db[_0x73da('0x3e')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/mailServerOut/mailServerOut.model');db[_0x73da('0x3f')]=db['sequelize'][_0x73da('0x14')](_0x73da('0x40'));db[_0x73da('0x41')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x42'));db[_0x73da('0x43')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x44'));db[_0x73da('0x45')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x46'));db[_0x73da('0x47')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x48'));db[_0x73da('0x49')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x4a'));db['MailQueueReport']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x4b'));db[_0x73da('0x4c')]=db[_0x73da('0x4')]['import'](_0x73da('0x4d'));db['DashboardItem']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x4e'));db['FaxAccount']=db[_0x73da('0x4')][_0x73da('0x14')]('../api/faxAccount/faxAccount.model');db[_0x73da('0x4f')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x50'));db['FaxInteraction']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x51'));db[_0x73da('0x52')]=db['sequelize'][_0x73da('0x14')](_0x73da('0x53'));db[_0x73da('0x54')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/faxQueue/faxQueue.model');db[_0x73da('0x55')]=db[_0x73da('0x4')]['import'](_0x73da('0x56'));db[_0x73da('0x57')]=db['sequelize']['import'](_0x73da('0x58'));db['SmsApplication']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x59'));db[_0x73da('0x5a')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x5b'));db['SmsMessage']=db[_0x73da('0x4')]['import'](_0x73da('0x5c'));db[_0x73da('0x5d')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x5e'));db[_0x73da('0x5f')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x60'));db[_0x73da('0x61')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x62'));db[_0x73da('0x63')]=db[_0x73da('0x4')]['import'](_0x73da('0x64'));db[_0x73da('0x65')]=db['sequelize'][_0x73da('0x14')](_0x73da('0x66'));db[_0x73da('0x67')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/openchannelQueue/openchannelQueue.model');db[_0x73da('0x68')]=db[_0x73da('0x4')]['import'](_0x73da('0x69'));db['OpenchannelQueueReport']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x6a'));db[_0x73da('0x6b')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x6c'));db[_0x73da('0x6d')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x6e'));db[_0x73da('0x6f')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x70'));db['ChatOfflineMessage']=db[_0x73da('0x4')][_0x73da('0x14')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x73da('0x71')]=db[_0x73da('0x4')]['import'](_0x73da('0x72'));db[_0x73da('0x73')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x74'));db[_0x73da('0x75')]=db[_0x73da('0x4')]['import'](_0x73da('0x76'));db['CmCompany']=db[_0x73da('0x4')][_0x73da('0x14')]('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x77'));db[_0x73da('0x78')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x79'));db['CmHopperBlack']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x7a'));db[_0x73da('0x7b')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x7c'));db['CmHopperHistory']=db[_0x73da('0x4')][_0x73da('0x14')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x73da('0x7d')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x7e'));db[_0x73da('0x7f')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/cmCustomField/cmCustomField.model');db[_0x73da('0x80')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x81'));db[_0x73da('0x82')]=db['sequelize'][_0x73da('0x14')](_0x73da('0x83'));db[_0x73da('0x84')]=db['sequelize'][_0x73da('0x14')](_0x73da('0x85'));db[_0x73da('0x86')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/disposition/disposition.model');db['Condition']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x87'));db[_0x73da('0x88')]=db['sequelize']['import'](_0x73da('0x89'));db[_0x73da('0x8a')]=db[_0x73da('0x4')]['import'](_0x73da('0x8b'));db[_0x73da('0x8c')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/cdr/cdr.model');db[_0x73da('0x8d')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x8e'));db[_0x73da('0x8f')]=db[_0x73da('0x4')]['import']('../api/schedule/schedule.model');db[_0x73da('0x90')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x91'));db[_0x73da('0x92')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x93'));db[_0x73da('0x94')]=db[_0x73da('0x4')]['import'](_0x73da('0x95'));db[_0x73da('0x96')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x97'));db['CmHopperAdditionalPhone']=db['sequelize'][_0x73da('0x14')](_0x73da('0x98'));db[_0x73da('0x99')]=db['sequelize'][_0x73da('0x14')](_0x73da('0x9a'));db[_0x73da('0x9b')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/trigger/trigger.model');db['Variable']=db[_0x73da('0x4')][_0x73da('0x14')]('../api/variable/variable.model');db[_0x73da('0x9c')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x9d'));db[_0x73da('0x9e')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x9f'));db[_0x73da('0xa0')]=db[_0x73da('0x4')]['import'](_0x73da('0xa1'));db[_0x73da('0xa2')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xa3'));db['AnalyticExtractedReport']=db[_0x73da('0x4')]['import'](_0x73da('0xa4'));db[_0x73da('0xa5')]=db[_0x73da('0x4')]['import']('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xa6'));db[_0x73da('0xa7')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xa8'));db[_0x73da('0xa9')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xaa'));db[_0x73da('0xab')]=db['sequelize'][_0x73da('0x14')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xac'));db['SugarcrmAccount']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xad'));db[_0x73da('0xae')]=db[_0x73da('0x4')]['import'](_0x73da('0xaf'));db[_0x73da('0xb0')]=db['sequelize'][_0x73da('0x14')](_0x73da('0xb1'));db[_0x73da('0xb2')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xb3'));db[_0x73da('0xb4')]=db[_0x73da('0x4')]['import'](_0x73da('0xb5'));db[_0x73da('0xb6')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/intDeskField/intDeskField.model');db[_0x73da('0xb7')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xb8'));db['ZohoConfiguration']=db['sequelize'][_0x73da('0x14')](_0x73da('0xb9'));db['ZohoField']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xba'));db[_0x73da('0xbb')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xbc'));db[_0x73da('0xbd')]=db['sequelize'][_0x73da('0x14')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x73da('0xbe')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xbf'));db[_0x73da('0xc0')]=db['sequelize']['import'](_0x73da('0xc1'));db[_0x73da('0xc2')]=db[_0x73da('0x4')]['import'](_0x73da('0xc3'));db['VtigerAccount']=db['sequelize'][_0x73da('0x14')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x73da('0xc4')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xc5'));db['VtigerField']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xc6'));db[_0x73da('0xc7')]=db['sequelize'][_0x73da('0x14')](_0x73da('0xc8'));db['ServicenowConfiguration']=db['sequelize'][_0x73da('0x14')](_0x73da('0xc9'));db[_0x73da('0xca')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xcb'));db['Dynamics365Account']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xcc'));db[_0x73da('0xcd')]=db['sequelize'][_0x73da('0x14')](_0x73da('0xce'));db[_0x73da('0xcf')]=db['sequelize']['import'](_0x73da('0xd0'));db[_0x73da('0xd1')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xd2'));db['FreshsalesConfiguration']=db[_0x73da('0x4')]['import'](_0x73da('0xd3'));db[_0x73da('0xd4')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xd5'));db[_0x73da('0x9c')]=db[_0x73da('0x4')]['import'](_0x73da('0x9d'));db[_0x73da('0xd6')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xd7'));db['ChatQueueReport']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xd8'));db[_0x73da('0xd9')]=db[_0x73da('0x4')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db['sequelize'][_0x73da('0x14')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x73da('0xda')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xdb'));db[_0x73da('0xdc')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xdd'));db[_0x73da('0xde')]=db['sequelize'][_0x73da('0x14')](_0x73da('0xdf'));db[_0x73da('0xe0')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/squareReport/squareReport.model');db[_0x73da('0xe1')]=db['sequelize']['import']('../api/squareReportDetail/squareReportDetail.model');db[_0x73da('0xe2')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/jscriptyProject/jscriptyProject.model');db[_0x73da('0xe3')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/setting/setting.model');db[_0x73da('0xe4')]=db[_0x73da('0x4')]['import']('../api/squareOdbc/squareOdbc.model');db[_0x73da('0xe5')]=db[_0x73da('0x4')]['import'](_0x73da('0xe6'));db[_0x73da('0xe7')]=db['sequelize'][_0x73da('0x14')](_0x73da('0xe8'));db[_0x73da('0xe9')]=db[_0x73da('0x4')]['import'](_0x73da('0xea'));db[_0x73da('0xeb')]=db['sequelize'][_0x73da('0x14')](_0x73da('0xec'));db[_0x73da('0xed')]=db[_0x73da('0x4')]['import'](_0x73da('0xee'));db[_0x73da('0xef')]=db['sequelize'][_0x73da('0x14')](_0x73da('0xf0'));db[_0x73da('0xf1')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xf2'));db[_0x73da('0xf3')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xf4'));db['Plugin']=db[_0x73da('0x4')]['import'](_0x73da('0xf5'));db['MailTransferReport']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xf6'));db['ChatTransferReport']=db[_0x73da('0x4')][_0x73da('0x14')]('../api/chatTransferReport/chatTransferReport.model');db[_0x73da('0xf7')]=db[_0x73da('0x4')]['import'](_0x73da('0xf8'));db[_0x73da('0xf9')]=db[_0x73da('0x4')]['import'](_0x73da('0xfa'));db[_0x73da('0xfb')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0xfc'));db[_0x73da('0xfd')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/cmList/cmList.model');db['VoicePrefix']=db[_0x73da('0x4')]['import']('../api/voicePrefix/voicePrefix.model');db[_0x73da('0xfe')]=db['sequelize'][_0x73da('0x14')](_0x73da('0xff'));db[_0x73da('0x100')]=db[_0x73da('0x4')]['import']('../api/userProfileSection/userProfileSection.model');db[_0x73da('0x101')]=db[_0x73da('0x4')]['import'](_0x73da('0x102'));db[_0x73da('0x103')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x104'));db[_0x73da('0x105')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x106'));db['WhatsappApplication']=db[_0x73da('0x4')]['import'](_0x73da('0x107'));db['WhatsappInteraction']=db[_0x73da('0x4')]['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0x73da('0x108')]=db['sequelize']['import']('../api/whatsappMessage/whatsappMessage.model');db['WhatsappQueueReport']=db[_0x73da('0x4')]['import'](_0x73da('0x109'));db[_0x73da('0x10a')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x10b'));db[_0x73da('0x10c')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x10d'));db[_0x73da('0x10e')]=db[_0x73da('0x4')]['import'](_0x73da('0x10f'));db['TeamVoiceQueue']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x110'));db['TeamVoicePrefix']=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x111'));db[_0x73da('0x112')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x113'));db[_0x73da('0x114')]=db[_0x73da('0x4')][_0x73da('0x14')]('../api/user-setting/user-setting.model');db[_0x73da('0x115')]=db[_0x73da('0x4')][_0x73da('0x14')](_0x73da('0x116'));db[_0x73da('0x13')][_0x73da('0x117')](db[_0x73da('0x22')],{'as':'VoiceMail','onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x119')});db[_0x73da('0x13')]['hasOne'](db[_0x73da('0x114')],{'as':'userSetting','onDelete':'cascade','foreignKey':_0x73da('0x119')});db['User'][_0x73da('0x11a')](db[_0x73da('0x1f')],{'as':_0x73da('0x11b'),'foreignKey':_0x73da('0x119')});db[_0x73da('0x13')][_0x73da('0x11a')](db['UserVoiceQueueRt'],{'as':_0x73da('0x11c'),'foreignKey':'UserId'});db[_0x73da('0x13')][_0x73da('0x11a')](db[_0x73da('0x19')],{'as':_0x73da('0x11d'),'onDelete':_0x73da('0x118'),'hooks':!![]});db[_0x73da('0x13')]['hasMany'](db[_0x73da('0x7b')],{'as':_0x73da('0x11e'),'foreignKey':_0x73da('0x119')});db['User'][_0x73da('0x11a')](db[_0x73da('0x11f')],{'as':_0x73da('0x120'),'foreignKey':'UserId'});db[_0x73da('0x13')][_0x73da('0x11a')](db[_0x73da('0x7d')],{'as':_0x73da('0x7d'),'foreignKey':_0x73da('0x119')});db[_0x73da('0x13')][_0x73da('0x11a')](db[_0x73da('0x63')],{'as':_0x73da('0x121'),'foreignKey':_0x73da('0x119')});db[_0x73da('0x13')][_0x73da('0x11a')](db[_0x73da('0x6d')],{'as':'ChatInteractions','foreignKey':_0x73da('0x119')});db[_0x73da('0x13')][_0x73da('0x11a')](db['SmsInteraction'],{'as':_0x73da('0x122'),'foreignKey':_0x73da('0x119')});db[_0x73da('0x13')][_0x73da('0x11a')](db[_0x73da('0x123')],{'as':_0x73da('0x124'),'foreignKey':_0x73da('0x119')});db[_0x73da('0x13')]['hasMany'](db[_0x73da('0x45')],{'as':_0x73da('0x125'),'foreignKey':_0x73da('0x119')});db[_0x73da('0x13')][_0x73da('0x11a')](db[_0x73da('0x126')],{'as':_0x73da('0x127'),'foreignKey':'UserId'});db[_0x73da('0x13')][_0x73da('0x11a')](db[_0x73da('0x103')],{'as':_0x73da('0x128'),'foreignKey':_0x73da('0x129')});db[_0x73da('0x13')][_0x73da('0x11a')](db[_0x73da('0x78')],{'as':_0x73da('0x12a'),'foreignKey':_0x73da('0x119'),'onDelete':_0x73da('0x12b')});db[_0x73da('0x13')]['belongsTo'](db['UserProfile'],{'as':_0x73da('0xfe'),'foreignKey':_0x73da('0x12c')});db[_0x73da('0x13')][_0x73da('0x12d')](db[_0x73da('0x73')],{'as':_0x73da('0x12e'),'through':_0x73da('0x12f')});db[_0x73da('0x13')][_0x73da('0x12d')](db[_0x73da('0x130')],{'as':_0x73da('0x131'),'through':_0x73da('0x132')});db[_0x73da('0x13')][_0x73da('0x12d')](db[_0x73da('0xfd')],{'as':_0x73da('0x133'),'through':_0x73da('0x134')});db['User'][_0x73da('0x12d')](db['Team'],{'through':_0x73da('0x135')});db[_0x73da('0x13')][_0x73da('0x12d')](db[_0x73da('0x45')],{'as':_0x73da('0x125'),'through':_0x73da('0x136')});db[_0x73da('0x13')]['belongsToMany'](db['ChatInteraction'],{'as':'ChatInteractions','through':_0x73da('0x137')});db['User'][_0x73da('0x12d')](db[_0x73da('0x123')],{'as':_0x73da('0x124'),'through':_0x73da('0x138')});db['User'][_0x73da('0x12d')](db[_0x73da('0x5a')],{'as':_0x73da('0x122'),'through':_0x73da('0x139')});db[_0x73da('0x13')]['belongsToMany'](db[_0x73da('0x63')],{'as':_0x73da('0x121'),'through':_0x73da('0x13a')});db['User'][_0x73da('0x12d')](db[_0x73da('0x126')],{'as':_0x73da('0x127'),'through':_0x73da('0x13b')});db[_0x73da('0x13')][_0x73da('0x12d')](db[_0x73da('0x1d')],{'as':_0x73da('0x13c'),'through':_0x73da('0x13d'),'required':![]});db[_0x73da('0x13')]['belongsToMany'](db['VoicePrefix'],{'as':_0x73da('0x13e'),'through':_0x73da('0x112'),'required':![]});db['User']['belongsToMany'](db[_0x73da('0x41')],{'as':_0x73da('0x13f'),'through':'UserMailQueue','required':![]});db[_0x73da('0x13')]['belongsToMany'](db[_0x73da('0x71')],{'as':_0x73da('0x140'),'through':_0x73da('0x34'),'required':![],'hooks':!![]});db[_0x73da('0x13')]['belongsToMany'](db[_0x73da('0x54')],{'as':_0x73da('0x141'),'through':_0x73da('0x37'),'required':![]});db[_0x73da('0x13')][_0x73da('0x12d')](db['SmsQueue'],{'as':_0x73da('0x142'),'through':'UserSmsQueue','required':![]});db[_0x73da('0x13')][_0x73da('0x12d')](db[_0x73da('0x67')],{'as':_0x73da('0x143'),'through':_0x73da('0x3a'),'required':![]});db[_0x73da('0x13')][_0x73da('0x12d')](db[_0x73da('0x10c')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db['User'][_0x73da('0x12d')](db[_0x73da('0xfd')],{'through':_0x73da('0x134')});db[_0x73da('0x13')]['belongsToMany'](db[_0x73da('0x68')],{'as':_0x73da('0x144'),'through':_0x73da('0x145')});db['User'][_0x73da('0x12d')](db[_0x73da('0x146')],{'as':_0x73da('0x147'),'through':_0x73da('0x148')});db['User']['belongsToMany'](db[_0x73da('0x3f')],{'as':_0x73da('0x149'),'through':_0x73da('0x14a')});db[_0x73da('0x13')][_0x73da('0x12d')](db[_0x73da('0x5f')],{'as':_0x73da('0x14b'),'through':'user_has_openchannel_accounts'});db[_0x73da('0x13')]['belongsToMany'](db[_0x73da('0x57')],{'as':_0x73da('0x14c'),'through':_0x73da('0x14d')});db[_0x73da('0x13')][_0x73da('0x12d')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0x73da('0x14e')});db[_0x73da('0x15')][_0x73da('0x11a')](db[_0x73da('0x19')],{'as':_0x73da('0x14f'),'onDelete':_0x73da('0x118'),'foreignKey':'ChanSpyId'});db[_0x73da('0x17')]['hasMany'](db['VoiceExtension'],{'onDelete':_0x73da('0x118')});db[_0x73da('0x19')][_0x73da('0x11a')](db['VoiceExtension'],{'as':_0x73da('0x150'),'onDelete':_0x73da('0x118')});db[_0x73da('0x1b')][_0x73da('0x12d')](db[_0x73da('0x90')],{'as':_0x73da('0x151'),'through':_0x73da('0x152')});db['VoiceQueue'][_0x73da('0x11a')](db[_0x73da('0x31')],{'as':_0x73da('0x153'),'foreignKey':_0x73da('0x154')});db[_0x73da('0x1d')][_0x73da('0x11a')](db[_0x73da('0x78')],{'as':_0x73da('0x12a'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x73da('0x11a')](db['CmHopperFinal'],{'as':_0x73da('0x11e'),'foreignKey':_0x73da('0x154')});db[_0x73da('0x1d')][_0x73da('0x11a')](db[_0x73da('0x11f')],{'as':_0x73da('0x155'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x73da('0x11a')](db[_0x73da('0x7d')],{'as':_0x73da('0x7d'),'foreignKey':_0x73da('0x154')});db[_0x73da('0x1d')][_0x73da('0x11a')](db['CmHopperBlack'],{'as':_0x73da('0x156'),'foreignKey':_0x73da('0x154')});db[_0x73da('0x1d')][_0x73da('0x11a')](db[_0x73da('0xdc')],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db[_0x73da('0x1d')][_0x73da('0x157')](db[_0x73da('0x2d')],{'as':_0x73da('0x2d'),'foreignKey':_0x73da('0x158')});db['VoiceQueue'][_0x73da('0x157')](db[_0x73da('0x2d')],{'as':'TrunkBackup','foreignKey':_0x73da('0x159')});db[_0x73da('0x1d')]['belongsTo'](db[_0x73da('0x88')],{'as':_0x73da('0x88'),'foreignKey':_0x73da('0x15a')});db[_0x73da('0x1d')][_0x73da('0x157')](db['Pause'],{'as':_0x73da('0x15b'),'foreignKey':_0x73da('0x15c')});db['VoiceQueue'][_0x73da('0x12d')](db[_0x73da('0xfd')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0x73da('0x1d')][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':'Agents','through':_0x73da('0x13d')});db[_0x73da('0x1d')][_0x73da('0x12d')](db[_0x73da('0xeb')],{'as':_0x73da('0x15d'),'through':'TeamVoiceQueue'});db[_0x73da('0x1d')][_0x73da('0x12d')](db[_0x73da('0xfd')],{'as':'BlackLists','through':_0x73da('0x15e')});db[_0x73da('0x1f')][_0x73da('0x157')](db['User'],{'as':_0x73da('0x13'),'foreignKey':_0x73da('0x119')});db['ScreenRecording'][_0x73da('0x157')](db[_0x73da('0x13')],{'as':_0x73da('0x13'),'foreignKey':'UserId'});db[_0x73da('0x22')]['hasMany'](db[_0x73da('0x24')],{'as':_0x73da('0x15f'),'onDelete':_0x73da('0x118'),'foreignKey':'mailboxuser','sourceKey':_0x73da('0x160')});db['VoiceMailMessage'][_0x73da('0x157')](db[_0x73da('0x22')],{'foreignKey':_0x73da('0x161'),'targetKey':_0x73da('0x160')});db[_0x73da('0x25')][_0x73da('0x11a')](db[_0x73da('0x162')],{'as':_0x73da('0x163'),'foreignKey':'uniqueid','constraints':![]});db[_0x73da('0x25')][_0x73da('0x11a')](db['VoiceAgentReport'],{'as':_0x73da('0x164'),'foreignKey':'uniqueid','constraints':![]});db[_0x73da('0x25')][_0x73da('0x157')](db[_0x73da('0x13')],{'as':_0x73da('0x13'),'foreignKey':_0x73da('0x119')});db[_0x73da('0x25')][_0x73da('0x157')](db['CmContact'],{'as':_0x73da('0x165'),'foreignKey':_0x73da('0x166')});db[_0x73da('0x167')][_0x73da('0x157')](db[_0x73da('0x3f')],{'as':_0x73da('0x3f'),'foreignKey':_0x73da('0x168')});db['MailServerIn'][_0x73da('0x157')](db['CloudProvider'],{'as':_0x73da('0x10e'),'foreignKey':_0x73da('0x169'),'onDelete':_0x73da('0x16a')});db[_0x73da('0x3e')][_0x73da('0x157')](db[_0x73da('0x3f')],{'as':_0x73da('0x3f'),'foreignKey':_0x73da('0x168')});db[_0x73da('0x3e')][_0x73da('0x157')](db[_0x73da('0x10e')],{'as':_0x73da('0x10e'),'foreignKey':'CloudProviderId','onDelete':_0x73da('0x16a')});db['MailAccount'][_0x73da('0x117')](db[_0x73da('0x167')],{'as':_0x73da('0x16b'),'onDelete':_0x73da('0x118')});db[_0x73da('0x3f')][_0x73da('0x117')](db['MailServerOut'],{'as':_0x73da('0x16c'),'onDelete':_0x73da('0x118')});db[_0x73da('0x3f')][_0x73da('0x11a')](db[_0x73da('0x86')],{'as':_0x73da('0x16d'),'foreignKey':_0x73da('0x168'),'onDelete':_0x73da('0x118')});db[_0x73da('0x3f')][_0x73da('0x11a')](db[_0x73da('0x84')],{'as':_0x73da('0x16e'),'foreignKey':'MailAccountId'});db[_0x73da('0x3f')]['hasMany'](db['MailMessage'],{'as':_0x73da('0x15f'),'foreignKey':_0x73da('0x168')});db['MailAccount'][_0x73da('0x11a')](db[_0x73da('0x45')],{'as':_0x73da('0x16f')});db[_0x73da('0x3f')][_0x73da('0x11a')](db[_0x73da('0x49')],{'as':'Applications','foreignKey':_0x73da('0x168'),'onDelete':'cascade'});db['MailAccount'][_0x73da('0x157')](db[_0x73da('0xfd')],{'as':_0x73da('0x170'),'foreignKey':_0x73da('0x171')});db[_0x73da('0x3f')][_0x73da('0x157')](db['Template'],{'as':_0x73da('0x99'),'foreignKey':_0x73da('0x172')});db['MailAccount']['belongsTo'](db[_0x73da('0x8a')],{'as':'mandatoryDispositionPause','foreignKey':_0x73da('0x15c')});db[_0x73da('0x3f')][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':_0x73da('0x173'),'through':'user_has_mail_accounts'});db['MailQueue'][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':_0x73da('0x173'),'through':_0x73da('0x36')});db['MailQueue'][_0x73da('0x12d')](db[_0x73da('0xeb')],{'through':_0x73da('0x174'),'as':'Teams'});db['MailInteraction']['hasMany'](db['MailMessage'],{'as':'Messages','onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x175')});db[_0x73da('0x45')][_0x73da('0x157')](db[_0x73da('0x3f')],{'as':_0x73da('0x176'),'foreignKey':'MailAccountId'});db[_0x73da('0x45')][_0x73da('0x157')](db[_0x73da('0x130')],{'as':'Contact','foreignKey':_0x73da('0x166')});db[_0x73da('0x45')][_0x73da('0x157')](db[_0x73da('0x13')],{'as':_0x73da('0x177'),'foreignKey':'UserId'});db[_0x73da('0x45')][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':'mail_interaction_has_tags','as':_0x73da('0x178')});db['MailInteraction'][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':_0x73da('0x179'),'as':_0x73da('0x17a')});db[_0x73da('0x45')][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':_0x73da('0x17b'),'through':_0x73da('0x136'),'foreignKey':_0x73da('0x175')});db[_0x73da('0x47')][_0x73da('0x11a')](db[_0x73da('0xf3')],{'as':_0x73da('0x17c'),'onDelete':_0x73da('0x118')});db['MailMessage'][_0x73da('0x157')](db[_0x73da('0x13')],{'as':_0x73da('0x13')});db[_0x73da('0x47')][_0x73da('0x157')](db[_0x73da('0x130')],{'onDelete':_0x73da('0x118'),'as':_0x73da('0x165')});db[_0x73da('0x47')][_0x73da('0x157')](db['MailInteraction'],{'as':_0x73da('0x17d'),'foreignKey':_0x73da('0x175')});db[_0x73da('0x47')][_0x73da('0x157')](db[_0x73da('0x3f')],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x168')});db[_0x73da('0x47')][_0x73da('0x157')](db[_0x73da('0x68')],{'as':_0x73da('0x68'),'foreignKey':_0x73da('0x17e')});db[_0x73da('0x47')][_0x73da('0x157')](db[_0x73da('0x17f')],{'as':'ChatOfflineMessage','foreignKey':_0x73da('0x180')});db['MailApplication'][_0x73da('0x157')](db['User'],{'onDelete':'restrict'});db[_0x73da('0x49')][_0x73da('0x157')](db['MailQueue'],{'onDelete':'restrict'});db[_0x73da('0x49')][_0x73da('0x157')](db[_0x73da('0x3f')],{'onDelete':_0x73da('0x16a')});db[_0x73da('0x49')][_0x73da('0x157')](db[_0x73da('0x88')],{'onDelete':_0x73da('0x16a'),'foreignKey':'IntervalId'});db[_0x73da('0x49')][_0x73da('0x157')](db['Tag'],{'onDelete':_0x73da('0x16a'),'foreignKey':_0x73da('0x181')});db[_0x73da('0x182')][_0x73da('0x157')](db[_0x73da('0x3f')],{});db[_0x73da('0x182')][_0x73da('0x157')](db[_0x73da('0xfd')],{'as':_0x73da('0x170'),'foreignKey':_0x73da('0x171')});db['MailQueueReport']['belongsTo'](db[_0x73da('0x130')],{'as':_0x73da('0x165'),'foreignKey':_0x73da('0x166')});db[_0x73da('0x182')][_0x73da('0x157')](db[_0x73da('0x45')],{});db[_0x73da('0x182')][_0x73da('0x157')](db[_0x73da('0x47')],{});db['MailQueueReport'][_0x73da('0x157')](db['User'],{});db[_0x73da('0x182')]['belongsTo'](db['MailQueue'],{});db['Dashboard'][_0x73da('0x11a')](db[_0x73da('0x183')],{'as':_0x73da('0x184'),'onDelete':_0x73da('0x118')});db[_0x73da('0x146')]['hasMany'](db[_0x73da('0x86')],{'as':_0x73da('0x16d'),'foreignKey':_0x73da('0x185'),'onDelete':_0x73da('0x118')});db[_0x73da('0x146')]['hasMany'](db[_0x73da('0x84')],{'as':_0x73da('0x16e'),'foreignKey':_0x73da('0x185')});db[_0x73da('0x146')][_0x73da('0x11a')](db[_0x73da('0x123')],{'as':_0x73da('0x16f')});db['FaxAccount'][_0x73da('0x11a')](db[_0x73da('0x4f')],{'as':_0x73da('0x150'),'foreignKey':_0x73da('0x185'),'onDelete':_0x73da('0x118')});db[_0x73da('0x146')][_0x73da('0x11a')](db['VoiceExtension'],{'as':_0x73da('0x186'),'onDelete':_0x73da('0x118')});db[_0x73da('0x146')][_0x73da('0x11a')](db['FaxMessage'],{'as':_0x73da('0x15f')});db['FaxAccount'][_0x73da('0x157')](db[_0x73da('0x2d')],{'as':_0x73da('0x2d')});db[_0x73da('0x146')][_0x73da('0x157')](db[_0x73da('0xfd')],{'as':_0x73da('0x170'),'foreignKey':_0x73da('0x171')});db[_0x73da('0x146')][_0x73da('0x157')](db[_0x73da('0x8a')],{'as':'mandatoryDispositionPause','foreignKey':_0x73da('0x15c')});db[_0x73da('0x146')][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':_0x73da('0x173'),'through':_0x73da('0x148')});db[_0x73da('0x4f')][_0x73da('0x157')](db[_0x73da('0x13')],{'onDelete':_0x73da('0x16a')});db['FaxApplication'][_0x73da('0x157')](db[_0x73da('0x54')],{'onDelete':_0x73da('0x16a')});db[_0x73da('0x4f')]['belongsTo'](db['FaxAccount'],{'onDelete':'restrict'});db['FaxApplication'][_0x73da('0x157')](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x73da('0x123')]['hasMany'](db['FaxMessage'],{'as':_0x73da('0x15f'),'onDelete':_0x73da('0x118'),'foreignKey':'FaxInteractionId'});db[_0x73da('0x123')][_0x73da('0x157')](db[_0x73da('0x146')],{'as':'Account','foreignKey':_0x73da('0x185')});db[_0x73da('0x123')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x73da('0x123')][_0x73da('0x157')](db[_0x73da('0x13')],{'as':_0x73da('0x177'),'foreignKey':_0x73da('0x119')});db[_0x73da('0x123')]['belongsToMany'](db[_0x73da('0x92')],{'through':_0x73da('0x187'),'as':_0x73da('0x178')});db['FaxInteraction'][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':_0x73da('0x187'),'as':'ThroughTags'});db['FaxInteraction'][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':_0x73da('0x17b'),'through':_0x73da('0x138'),'foreignKey':_0x73da('0x188')});db[_0x73da('0x52')][_0x73da('0x157')](db['User'],{'onDelete':'cascade','as':_0x73da('0x13')});db[_0x73da('0x52')]['belongsTo'](db[_0x73da('0x123')],{'as':_0x73da('0x17d'),'foreignKey':_0x73da('0x188')});db[_0x73da('0x52')][_0x73da('0x157')](db[_0x73da('0x130')],{'onDelete':_0x73da('0x118'),'as':'Contact'});db['FaxMessage'][_0x73da('0x157')](db[_0x73da('0xf3')],{'as':_0x73da('0xf3'),'foreignKey':_0x73da('0x189')});db[_0x73da('0x52')][_0x73da('0x157')](db[_0x73da('0x146')],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x185')});db['FaxQueue'][_0x73da('0x12d')](db['User'],{'as':'Agents','through':_0x73da('0x37')});db[_0x73da('0x54')][_0x73da('0x12d')](db[_0x73da('0xeb')],{'through':'team_has_fax_queues','as':'Teams'});db[_0x73da('0x55')][_0x73da('0x157')](db[_0x73da('0x146')],{});db['FaxQueueReport']['belongsTo'](db['CmList'],{'as':_0x73da('0x170'),'foreignKey':_0x73da('0x171')});db['FaxQueueReport'][_0x73da('0x157')](db['CmContact'],{'as':_0x73da('0x165'),'foreignKey':_0x73da('0x166')});db['FaxQueueReport']['belongsTo'](db[_0x73da('0x123')],{});db[_0x73da('0x55')]['belongsTo'](db[_0x73da('0x52')],{});db[_0x73da('0x55')][_0x73da('0x157')](db[_0x73da('0x13')],{});db[_0x73da('0x55')]['belongsTo'](db[_0x73da('0x54')],{});db[_0x73da('0x57')][_0x73da('0x11a')](db[_0x73da('0x86')],{'as':'Dispositions','foreignKey':'SmsAccountId','onDelete':_0x73da('0x118')});db['SmsAccount'][_0x73da('0x11a')](db[_0x73da('0x84')],{'as':'Answers','foreignKey':_0x73da('0x18a')});db[_0x73da('0x57')][_0x73da('0x11a')](db[_0x73da('0x18b')],{'as':_0x73da('0x15f'),'foreignKey':_0x73da('0x18a')});db[_0x73da('0x57')]['hasMany'](db[_0x73da('0x5a')],{'as':_0x73da('0x16f')});db[_0x73da('0x57')]['hasMany'](db[_0x73da('0x18c')],{'as':_0x73da('0x150'),'foreignKey':'SmsAccountId','onDelete':'cascade'});db[_0x73da('0x57')]['belongsTo'](db['CmList'],{'as':_0x73da('0x170'),'foreignKey':_0x73da('0x171')});db[_0x73da('0x57')][_0x73da('0x157')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x73da('0x15c')});db[_0x73da('0x57')][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':'Agents','through':_0x73da('0x14d')});db[_0x73da('0x18c')]['belongsTo'](db[_0x73da('0x13')],{'onDelete':_0x73da('0x16a')});db['SmsApplication'][_0x73da('0x157')](db[_0x73da('0x5d')],{'onDelete':_0x73da('0x16a')});db[_0x73da('0x18c')][_0x73da('0x157')](db[_0x73da('0x57')],{'onDelete':'restrict'});db[_0x73da('0x18c')][_0x73da('0x157')](db['Interval'],{'onDelete':_0x73da('0x16a'),'foreignKey':'IntervalId'});db[_0x73da('0x18c')][_0x73da('0x157')](db[_0x73da('0x92')],{'onDelete':_0x73da('0x16a'),'foreignKey':_0x73da('0x181')});db[_0x73da('0x5a')][_0x73da('0x11a')](db['SmsMessage'],{'as':_0x73da('0x15f'),'onDelete':_0x73da('0x118'),'foreignKey':'SmsInteractionId'});db[_0x73da('0x5a')]['belongsTo'](db[_0x73da('0x57')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0x73da('0x5a')][_0x73da('0x157')](db['CmContact'],{'as':_0x73da('0x165'),'foreignKey':_0x73da('0x166')});db[_0x73da('0x5a')]['belongsTo'](db[_0x73da('0x13')],{'as':_0x73da('0x177'),'foreignKey':_0x73da('0x119')});db[_0x73da('0x5a')][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':'sms_interaction_has_tags','as':_0x73da('0x178')});db[_0x73da('0x5a')][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':_0x73da('0x18d'),'as':_0x73da('0x17a')});db[_0x73da('0x5a')][_0x73da('0x12d')](db['User'],{'as':_0x73da('0x17b'),'through':_0x73da('0x139'),'foreignKey':_0x73da('0x18e')});db[_0x73da('0x18b')][_0x73da('0x157')](db[_0x73da('0x13')],{'as':_0x73da('0x13')});db[_0x73da('0x18b')]['belongsTo'](db[_0x73da('0x130')],{'onDelete':_0x73da('0x118'),'as':_0x73da('0x165')});db['SmsMessage'][_0x73da('0x157')](db[_0x73da('0x5a')],{'onDelete':_0x73da('0x118'),'as':'Interaction','foreignKey':'SmsInteractionId'});db[_0x73da('0x18b')][_0x73da('0x157')](db[_0x73da('0x57')],{'as':'Account','foreignKey':_0x73da('0x18a')});db[_0x73da('0x5d')][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':'Agents','through':_0x73da('0x18f'),'foreignKey':_0x73da('0x190')});db[_0x73da('0x5d')][_0x73da('0x12d')](db[_0x73da('0xeb')],{'through':_0x73da('0x191'),'as':_0x73da('0x15d')});db['OpenchannelAccount'][_0x73da('0x11a')](db[_0x73da('0x86')],{'as':_0x73da('0x16d'),'foreignKey':_0x73da('0x192'),'onDelete':_0x73da('0x118')});db[_0x73da('0x5f')]['hasMany'](db[_0x73da('0x84')],{'as':'Answers','foreignKey':_0x73da('0x192')});db[_0x73da('0x5f')][_0x73da('0x11a')](db[_0x73da('0x63')],{'as':_0x73da('0x16f'),'foreignKey':'OpenchannelAccountId'});db[_0x73da('0x5f')][_0x73da('0x11a')](db[_0x73da('0x65')],{'as':_0x73da('0x15f'),'foreignKey':_0x73da('0x192')});db[_0x73da('0x5f')]['hasMany'](db[_0x73da('0x61')],{'as':'Applications','foreignKey':_0x73da('0x192'),'onDelete':_0x73da('0x118')});db['OpenchannelAccount']['belongsTo'](db[_0x73da('0xfd')],{'as':_0x73da('0x170'),'foreignKey':_0x73da('0x171')});db[_0x73da('0x5f')]['belongsTo'](db[_0x73da('0x8a')],{'as':_0x73da('0x15b'),'foreignKey':_0x73da('0x15c')});db[_0x73da('0x5f')][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':_0x73da('0x173'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication'][_0x73da('0x157')](db[_0x73da('0x13')],{'onDelete':_0x73da('0x16a')});db[_0x73da('0x61')][_0x73da('0x157')](db[_0x73da('0x67')],{'onDelete':_0x73da('0x16a'),'foreignKey':_0x73da('0x193')});db[_0x73da('0x61')][_0x73da('0x157')](db[_0x73da('0x5f')],{'onDelete':_0x73da('0x16a'),'foreignKey':_0x73da('0x192')});db['OpenchannelApplication'][_0x73da('0x157')](db[_0x73da('0x88')],{'onDelete':_0x73da('0x16a'),'foreignKey':_0x73da('0x15a')});db[_0x73da('0x61')][_0x73da('0x157')](db['Tag'],{'onDelete':_0x73da('0x16a'),'foreignKey':'TagId'});db[_0x73da('0x63')][_0x73da('0x11a')](db[_0x73da('0x65')],{'as':_0x73da('0x15f'),'onDelete':_0x73da('0x118'),'foreignKey':'OpenchannelInteractionId'});db[_0x73da('0x63')][_0x73da('0x157')](db[_0x73da('0x5f')],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x192')});db[_0x73da('0x63')][_0x73da('0x157')](db[_0x73da('0x130')],{'as':_0x73da('0x165'),'foreignKey':'ContactId'});db['OpenchannelInteraction'][_0x73da('0x157')](db[_0x73da('0x13')],{'as':'Owner','foreignKey':_0x73da('0x119')});db[_0x73da('0x63')]['belongsToMany'](db['Tag'],{'through':_0x73da('0x194'),'as':_0x73da('0x178')});db[_0x73da('0x63')][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':_0x73da('0x194'),'as':_0x73da('0x17a')});db[_0x73da('0x63')]['belongsToMany'](db[_0x73da('0x13')],{'as':'Users','through':_0x73da('0x13a'),'foreignKey':_0x73da('0x195')});db['OpenchannelMessage'][_0x73da('0x157')](db[_0x73da('0x13')],{'onDelete':_0x73da('0x118'),'as':'User'});db['OpenchannelMessage'][_0x73da('0x157')](db[_0x73da('0x130')],{'onDelete':'cascade','as':_0x73da('0x165')});db[_0x73da('0x65')][_0x73da('0x157')](db[_0x73da('0x63')],{'onDelete':_0x73da('0x118'),'as':_0x73da('0x17d'),'foreignKey':_0x73da('0x195')});db[_0x73da('0x65')]['belongsTo'](db[_0x73da('0xf3')],{'as':_0x73da('0xf3'),'foreignKey':'AttachmentId'});db['OpenchannelMessage'][_0x73da('0x157')](db[_0x73da('0x5f')],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x192')});db['OpenchannelQueue'][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':_0x73da('0x173'),'through':_0x73da('0x3a'),'foreignKey':'OpenchannelQueueId'});db[_0x73da('0x67')][_0x73da('0x12d')](db[_0x73da('0xeb')],{'through':_0x73da('0x196'),'as':_0x73da('0x15d')});db[_0x73da('0x68')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x73da('0x17e'),'onDelete':_0x73da('0x118')});db['ChatWebsite']['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x73da('0x17e')});db[_0x73da('0x68')]['hasMany'](db[_0x73da('0x75')],{'as':'ProactiveActions'});db[_0x73da('0x68')][_0x73da('0x11a')](db[_0x73da('0x6d')],{'as':_0x73da('0x16f')});db[_0x73da('0x68')][_0x73da('0x11a')](db[_0x73da('0x6b')],{'as':_0x73da('0x150'),'foreignKey':'ChatWebsiteId','onDelete':_0x73da('0x118')});db[_0x73da('0x68')][_0x73da('0x11a')](db[_0x73da('0x6f')],{'as':_0x73da('0x15f')});db[_0x73da('0x68')][_0x73da('0x157')](db[_0x73da('0xfd')],{'as':_0x73da('0x170'),'foreignKey':_0x73da('0x171')});db[_0x73da('0x68')][_0x73da('0x157')](db['Interval'],{'as':'Interval','foreignKey':_0x73da('0x15a')});db[_0x73da('0x68')][_0x73da('0x157')](db[_0x73da('0x3f')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x73da('0x68')][_0x73da('0x157')](db['Pause'],{'as':_0x73da('0x15b'),'foreignKey':_0x73da('0x15c')});db[_0x73da('0x68')]['belongsToMany'](db[_0x73da('0x13')],{'as':_0x73da('0x173'),'through':_0x73da('0x145')});db['OpenchannelQueueReport'][_0x73da('0x157')](db[_0x73da('0x5f')],{});db[_0x73da('0x197')][_0x73da('0x157')](db[_0x73da('0xfd')],{'as':_0x73da('0x170'),'foreignKey':_0x73da('0x171')});db[_0x73da('0x197')][_0x73da('0x157')](db['CmContact'],{'as':_0x73da('0x165'),'foreignKey':_0x73da('0x166')});db[_0x73da('0x197')][_0x73da('0x157')](db[_0x73da('0x63')],{});db[_0x73da('0x197')]['belongsTo'](db[_0x73da('0x65')],{});db[_0x73da('0x197')][_0x73da('0x157')](db[_0x73da('0x13')],{});db[_0x73da('0x197')][_0x73da('0x157')](db[_0x73da('0x67')],{});db['ChatApplication'][_0x73da('0x157')](db[_0x73da('0x13')],{'as':_0x73da('0x198'),'foreignKey':_0x73da('0x119'),'onDelete':'restrict'});db[_0x73da('0x6b')][_0x73da('0x157')](db[_0x73da('0x71')],{'as':'Queue','foreignKey':_0x73da('0x199'),'onDelete':_0x73da('0x16a')});db[_0x73da('0x6b')]['belongsTo'](db['ChatWebsite'],{'as':_0x73da('0x19a'),'foreignKey':_0x73da('0x17e'),'onDelete':'restrict'});db[_0x73da('0x6b')][_0x73da('0x157')](db['Tag'],{'onDelete':_0x73da('0x16a'),'foreignKey':'TagId'});db[_0x73da('0x6d')][_0x73da('0x11a')](db[_0x73da('0x6f')],{'as':_0x73da('0x15f'),'onDelete':'cascade','foreignKey':_0x73da('0x19b')});db[_0x73da('0x6d')]['belongsTo'](db[_0x73da('0x68')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x73da('0x6d')][_0x73da('0x157')](db[_0x73da('0x130')],{'as':_0x73da('0x165'),'foreignKey':_0x73da('0x166')});db[_0x73da('0x6d')][_0x73da('0x157')](db[_0x73da('0x13')],{'as':_0x73da('0x177'),'foreignKey':'UserId'});db['ChatInteraction'][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':_0x73da('0x19c'),'as':_0x73da('0x178')});db[_0x73da('0x6d')][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':_0x73da('0x19c'),'as':_0x73da('0x17a')});db['ChatInteraction'][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':'Users','through':'user_has_chat_interactions','foreignKey':_0x73da('0x19b')});db[_0x73da('0x6f')][_0x73da('0x157')](db[_0x73da('0x13')],{'onDelete':_0x73da('0x118'),'as':'User'});db[_0x73da('0x6f')][_0x73da('0x157')](db[_0x73da('0x130')],{'onDelete':_0x73da('0x118'),'as':_0x73da('0x165'),'foreignKey':_0x73da('0x166')});db['ChatMessage'][_0x73da('0x157')](db[_0x73da('0x6d')],{'onDelete':_0x73da('0x118'),'as':'Interaction','foreignKey':_0x73da('0x19b')});db['ChatMessage'][_0x73da('0x157')](db['Attachment'],{'as':_0x73da('0xf3'),'foreignKey':_0x73da('0x189')});db[_0x73da('0x6f')]['belongsTo'](db['ChatWebsite'],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x17e')});db[_0x73da('0x17f')][_0x73da('0x11a')](db[_0x73da('0xf3')],{'as':_0x73da('0x17c'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x73da('0x118'),'hooks':!![]});db[_0x73da('0x17f')][_0x73da('0x157')](db[_0x73da('0x130')],{'onDelete':_0x73da('0x118'),'as':_0x73da('0x165'),'foreignKey':_0x73da('0x166')});db['ChatOfflineMessage'][_0x73da('0x157')](db[_0x73da('0x68')],{'as':'Account','foreignKey':_0x73da('0x17e')});db['ChatQueue'][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':_0x73da('0x173'),'through':_0x73da('0x34'),'hooks':!![]});db[_0x73da('0x71')]['belongsToMany'](db[_0x73da('0xeb')],{'through':'team_has_chat_queues','as':_0x73da('0x15d')});db[_0x73da('0x73')][_0x73da('0x11a')](db[_0x73da('0xd9')],{'as':_0x73da('0x15f'),'foreignKey':'ChatGroupId','onDelete':_0x73da('0x118')});db[_0x73da('0x73')][_0x73da('0x12d')](db['User'],{'as':_0x73da('0x153'),'through':_0x73da('0x12f')});db['ChatProactiveAction']['belongsTo'](db[_0x73da('0x68')],{'as':_0x73da('0x19a'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x73da('0x11a')](db['CmContact'],{'as':'Contacts','foreignKey':_0x73da('0x19d')});db['CmContact'][_0x73da('0x11a')](db['CmContactHasItem'],{'as':_0x73da('0x19e'),'foreignKey':_0x73da('0x19f')});db[_0x73da('0x130')]['hasMany'](db[_0x73da('0x78')],{'as':_0x73da('0x12a'),'foreignKey':_0x73da('0x166')});db[_0x73da('0x130')][_0x73da('0x11a')](db[_0x73da('0x7b')],{'as':'HopperFinals','foreignKey':_0x73da('0x166')});db[_0x73da('0x130')][_0x73da('0x11a')](db[_0x73da('0x11f')],{'as':_0x73da('0x155'),'foreignKey':'ContactId'});db[_0x73da('0x130')][_0x73da('0x11a')](db[_0x73da('0x7d')],{'as':_0x73da('0x7d'),'foreignKey':_0x73da('0x166')});db[_0x73da('0x130')][_0x73da('0x11a')](db[_0x73da('0xdc')],{'as':_0x73da('0x1a0'),'foreignKey':'ContactId'});db[_0x73da('0x130')][_0x73da('0x11a')](db[_0x73da('0x63')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x73da('0x16a')});db['CmContact'][_0x73da('0x11a')](db['ChatInteraction'],{'as':_0x73da('0x1a1'),'foreignKey':_0x73da('0x166'),'onDelete':_0x73da('0x16a')});db[_0x73da('0x130')][_0x73da('0x11a')](db[_0x73da('0x5a')],{'as':_0x73da('0x122'),'foreignKey':_0x73da('0x166'),'onDelete':_0x73da('0x16a')});db[_0x73da('0x130')][_0x73da('0x11a')](db[_0x73da('0x123')],{'as':'FaxInteractions','foreignKey':_0x73da('0x166'),'onDelete':_0x73da('0x16a')});db[_0x73da('0x130')][_0x73da('0x11a')](db[_0x73da('0x45')],{'as':_0x73da('0x125'),'foreignKey':_0x73da('0x166'),'onDelete':_0x73da('0x16a')});db[_0x73da('0x130')][_0x73da('0x157')](db['CmCompany'],{'as':_0x73da('0x1a2'),'foreignKey':'CompanyId'});db[_0x73da('0x130')][_0x73da('0x157')](db[_0x73da('0xfd')],{'as':'List','foreignKey':_0x73da('0x171'),'onDelete':_0x73da('0x118')});db[_0x73da('0x130')][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':'Users','through':_0x73da('0x132')});db[_0x73da('0x130')]['belongsToMany'](db['Tag'],{'as':_0x73da('0x178'),'through':_0x73da('0x1a3')});db['CmContact'][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':'cm_contact_has_tags','as':_0x73da('0x17a')});db[_0x73da('0x78')][_0x73da('0x11a')](db['CmHopperAdditionalPhone'],{'as':_0x73da('0x1a4'),'foreignKey':'CmHopperId'});db[_0x73da('0x78')][_0x73da('0x157')](db['CmContact'],{'as':_0x73da('0x165'),'foreignKey':_0x73da('0x166'),'onDelete':_0x73da('0x118')});db[_0x73da('0x78')]['belongsTo'](db[_0x73da('0xfd')],{'as':_0x73da('0x170'),'foreignKey':_0x73da('0x171'),'onDelete':_0x73da('0x118')});db['CmHopper'][_0x73da('0x157')](db['User'],{'as':_0x73da('0x198'),'foreignKey':_0x73da('0x119')});db[_0x73da('0x78')]['belongsTo'](db[_0x73da('0x1d')],{'as':'Queue','foreignKey':_0x73da('0x154'),'onDelete':_0x73da('0x118')});db['CmHopper']['belongsTo'](db[_0x73da('0xef')],{'as':_0x73da('0xef'),'foreignKey':'CampaignId','onDelete':_0x73da('0x118')});db['CmHopper'][_0x73da('0x157')](db[_0x73da('0x13')],{'as':_0x73da('0x177'),'foreignKey':_0x73da('0x1a5')});db['CmHopperBlack'][_0x73da('0x157')](db['CmContact'],{'as':'Contact','foreignKey':_0x73da('0x166'),'onDelete':_0x73da('0x118')});db['CmHopperBlack'][_0x73da('0x157')](db[_0x73da('0xfd')],{'as':'List','foreignKey':_0x73da('0x171'),'onDelete':_0x73da('0x118')});db[_0x73da('0x1a6')][_0x73da('0x157')](db[_0x73da('0x1d')],{'as':_0x73da('0x1a7'),'foreignKey':_0x73da('0x154'),'onDelete':_0x73da('0x118')});db[_0x73da('0x1a6')][_0x73da('0x157')](db[_0x73da('0xef')],{'as':_0x73da('0xef'),'foreignKey':_0x73da('0x1a8'),'onDelete':'cascade'});db['Automation'][_0x73da('0x11a')](db[_0x73da('0x1a9')],{'as':{'plural':_0x73da('0x1aa'),'singular':'OneAll'},'foreignKey':_0x73da('0x1ab'),'onDelete':'cascade','hooks':!![]});db[_0x73da('0x82')][_0x73da('0x11a')](db[_0x73da('0x1a9')],{'as':{'plural':_0x73da('0x1ac'),'singular':_0x73da('0x1ad')},'foreignKey':'AutomationAnyId','onDelete':_0x73da('0x118'),'hooks':!![]});db[_0x73da('0x82')][_0x73da('0x11a')](db[_0x73da('0x80')],{'as':_0x73da('0x1ae'),'foreignKey':_0x73da('0x1af'),'onDelete':'cascade','hooks':!![]});db['Disposition'][_0x73da('0x11a')](db['Disposition'],{'as':_0x73da('0x16d'),'foreignKey':_0x73da('0x1b0'),'onDelete':_0x73da('0x118')});db['Interval'][_0x73da('0x11a')](db[_0x73da('0x88')],{'as':_0x73da('0x1b1'),'foreignKey':'IntervalId','onDelete':_0x73da('0x118'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db[_0x73da('0x19')],{'as':'Extensions','foreignKey':_0x73da('0x15a'),'onDelete':'restrict'});db[_0x73da('0x88')]['hasMany'](db['MailApplication'],{'as':_0x73da('0x1b2'),'foreignKey':_0x73da('0x15a')});db['Interval'][_0x73da('0x11a')](db[_0x73da('0x6b')],{'as':_0x73da('0x1b3'),'foreignKey':_0x73da('0x15a')});db['Interval'][_0x73da('0x11a')](db[_0x73da('0x4f')],{'as':'FaxApplications','foreignKey':_0x73da('0x15a')});db['Interval'][_0x73da('0x11a')](db[_0x73da('0x18c')],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0x73da('0x8f')][_0x73da('0x157')](db[_0x73da('0x3f')],{});db['Schedule'][_0x73da('0x157')](db['AnalyticDefaultReport'],{'foreignKey':_0x73da('0x1b4')});db['Schedule']['belongsTo'](db[_0x73da('0xa0')],{'foreignKey':_0x73da('0x1b5')});db[_0x73da('0x90')][_0x73da('0x12d')](db[_0x73da('0x1b')],{'as':'Mohs','through':_0x73da('0x152'),'onDelete':_0x73da('0x16a')});db['Tag'][_0x73da('0x12d')](db[_0x73da('0x130')],{'through':_0x73da('0x1a3')});db[_0x73da('0x92')]['belongsToMany'](db[_0x73da('0x6d')],{'through':_0x73da('0x19c')});db[_0x73da('0x92')][_0x73da('0x12d')](db[_0x73da('0x45')],{'through':_0x73da('0x179')});db[_0x73da('0x92')]['belongsToMany'](db[_0x73da('0x5a')],{'through':_0x73da('0x18d')});db[_0x73da('0x92')]['belongsToMany'](db[_0x73da('0x123')],{'through':_0x73da('0x187')});db[_0x73da('0x92')][_0x73da('0x12d')](db[_0x73da('0x63')],{'through':'openchannel_interaction_has_tags'});db[_0x73da('0x92')]['belongsToMany'](db['WhatsappInteraction'],{'through':_0x73da('0x1b6')});db[_0x73da('0x96')][_0x73da('0x157')](db[_0x73da('0x94')],{'as':_0x73da('0x1b7'),'foreignKey':_0x73da('0x1b8')});db['CmHopperAdditionalPhone'][_0x73da('0x157')](db[_0x73da('0x78')],{'as':'Hopper','foreignKey':_0x73da('0x1b9')});db[_0x73da('0x96')]['belongsTo'](db[_0x73da('0x130')],{'as':_0x73da('0x165'),'foreignKey':_0x73da('0x19f')});db[_0x73da('0x9b')]['hasMany'](db[_0x73da('0x1a9')],{'as':{'plural':_0x73da('0x1ba'),'singular':'AllCondition'},'foreignKey':'TriggerAllId','onDelete':_0x73da('0x118'),'hooks':!![]});db[_0x73da('0x9b')]['hasMany'](db[_0x73da('0x1a9')],{'as':{'plural':_0x73da('0x1bb'),'singular':_0x73da('0x1bc')},'foreignKey':'TriggerAnyId','onDelete':_0x73da('0x118'),'hooks':!![]});db[_0x73da('0x9b')]['hasMany'](db['Action'],{'as':_0x73da('0x1ae'),'foreignKey':'TriggerId','onDelete':_0x73da('0x118'),'hooks':!![]});db['AnalyticCustomReport'][_0x73da('0x11a')](db['AnalyticFieldReport'],{'as':_0x73da('0x1bd'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1b5'),'hooks':!![]});db[_0x73da('0xa2')][_0x73da('0x11a')](db[_0x73da('0x1be')],{'as':_0x73da('0x1bd'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1b4')});db[_0x73da('0xa5')][_0x73da('0x11a')](db[_0x73da('0x1be')],{'as':_0x73da('0x1bd'),'onDelete':'cascade','foreignKey':_0x73da('0x1bf')});db[_0x73da('0x1be')][_0x73da('0x157')](db[_0x73da('0xa5')],{'foreignKey':_0x73da('0x1bf')});db[_0x73da('0xa9')][_0x73da('0x11a')](db[_0x73da('0xab')],{'as':_0x73da('0x1c0'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c1')});db['SalesforceConfiguration']['hasMany'](db['SalesforceField'],{'as':_0x73da('0x1c2'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c3')});db['SalesforceConfiguration'][_0x73da('0x11a')](db[_0x73da('0x1c4')],{'as':_0x73da('0x1c5'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c6')});db['SalesforceConfiguration'][_0x73da('0x11a')](db[_0x73da('0x1c4')],{'as':_0x73da('0x1bd'),'onDelete':_0x73da('0x118'),'foreignKey':'FieldId'});db[_0x73da('0xab')][_0x73da('0x157')](db[_0x73da('0xa9')],{'as':'Account','foreignKey':'AccountId'});db[_0x73da('0x1c4')]['hasMany'](db[_0x73da('0x1c4')],{'as':_0x73da('0x1c7'),'foreignKey':_0x73da('0x1c3')});db['SalesforceField'][_0x73da('0x11a')](db[_0x73da('0x1c4')],{'as':_0x73da('0x1c8'),'foreignKey':_0x73da('0x1c6')});db['SalesforceField'][_0x73da('0x11a')](db[_0x73da('0x1c4')],{'as':_0x73da('0x1c9'),'foreignKey':_0x73da('0x1ca')});db[_0x73da('0x1c4')][_0x73da('0x157')](db[_0x73da('0x1cb')],{'as':'Variable','foreignKey':_0x73da('0x1cc')});db[_0x73da('0x1cd')][_0x73da('0x11a')](db['SugarcrmConfiguration'],{'as':_0x73da('0x1c0'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x73da('0xae')][_0x73da('0x11a')](db[_0x73da('0xb0')],{'as':_0x73da('0x1c2'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c3')});db[_0x73da('0xae')][_0x73da('0x11a')](db[_0x73da('0xb0')],{'as':'Descriptions','onDelete':_0x73da('0x118'),'foreignKey':'DescriptionId'});db[_0x73da('0xae')][_0x73da('0x11a')](db[_0x73da('0xb0')],{'as':_0x73da('0x1bd'),'onDelete':'cascade','foreignKey':_0x73da('0x1ca')});db[_0x73da('0xae')][_0x73da('0x157')](db[_0x73da('0x1cd')],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0xb0')][_0x73da('0x11a')](db[_0x73da('0xb0')],{'as':_0x73da('0x1c7'),'foreignKey':_0x73da('0x1c3')});db['SugarcrmField'][_0x73da('0x11a')](db[_0x73da('0xb0')],{'as':'Description','foreignKey':_0x73da('0x1c6')});db[_0x73da('0xb0')]['hasMany'](db['SugarcrmField'],{'as':_0x73da('0x1c9'),'foreignKey':_0x73da('0x1ca')});db[_0x73da('0xb0')]['belongsTo'](db[_0x73da('0x1cb')],{'as':_0x73da('0x1cb'),'foreignKey':_0x73da('0x1cc')});db[_0x73da('0xb2')]['hasMany'](db[_0x73da('0xb4')],{'as':_0x73da('0x1c0'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0xb4')]['hasMany'](db[_0x73da('0xb6')],{'as':_0x73da('0x1c2'),'onDelete':_0x73da('0x118'),'foreignKey':'SubjectId'});db[_0x73da('0xb4')][_0x73da('0x11a')](db[_0x73da('0xb6')],{'as':_0x73da('0x1c5'),'onDelete':_0x73da('0x118'),'foreignKey':'DescriptionId'});db[_0x73da('0xb4')][_0x73da('0x11a')](db[_0x73da('0xb6')],{'as':_0x73da('0x1bd'),'onDelete':'cascade','foreignKey':'FieldId'});db['DeskConfiguration']['belongsTo'](db['DeskAccount'],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x1c1')});db['DeskConfiguration'][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':_0x73da('0x1ce')});db[_0x73da('0xb6')][_0x73da('0x11a')](db[_0x73da('0xb6')],{'as':_0x73da('0x1c7'),'foreignKey':_0x73da('0x1c3')});db[_0x73da('0xb6')][_0x73da('0x11a')](db[_0x73da('0xb6')],{'as':_0x73da('0x1c8'),'foreignKey':_0x73da('0x1c6')});db[_0x73da('0xb6')]['hasMany'](db['DeskField'],{'as':'Field','foreignKey':_0x73da('0x1ca')});db[_0x73da('0xb6')][_0x73da('0x157')](db[_0x73da('0x1cb')],{'as':_0x73da('0x1cb'),'foreignKey':_0x73da('0x1cc')});db['ZohoAccount'][_0x73da('0x11a')](db[_0x73da('0x1cf')],{'as':'Configurations','onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0x1cf')][_0x73da('0x11a')](db[_0x73da('0x1d0')],{'as':_0x73da('0x1c2'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c3')});db['ZohoConfiguration'][_0x73da('0x11a')](db[_0x73da('0x1d0')],{'as':_0x73da('0x1c5'),'onDelete':_0x73da('0x118'),'foreignKey':'DescriptionId'});db[_0x73da('0x1cf')]['hasMany'](db[_0x73da('0x1d0')],{'as':_0x73da('0x1bd'),'onDelete':_0x73da('0x118'),'foreignKey':'FieldId'});db[_0x73da('0x1cf')][_0x73da('0x157')](db[_0x73da('0xb7')],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0x1d0')]['hasMany'](db[_0x73da('0x1d0')],{'as':_0x73da('0x1c7'),'foreignKey':_0x73da('0x1c3')});db[_0x73da('0x1d0')][_0x73da('0x11a')](db['ZohoField'],{'as':_0x73da('0x1c8'),'foreignKey':'DescriptionId'});db['ZohoField']['hasMany'](db[_0x73da('0x1d0')],{'as':_0x73da('0x1c9'),'foreignKey':_0x73da('0x1ca')});db[_0x73da('0x1d0')][_0x73da('0x157')](db['Variable'],{'as':'Variable','foreignKey':_0x73da('0x1cc')});db['ZendeskAccount'][_0x73da('0x11a')](db[_0x73da('0xbd')],{'as':_0x73da('0x1c0'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0xbd')][_0x73da('0x11a')](db[_0x73da('0xbe')],{'as':'Subjects','foreignKey':_0x73da('0x1c3')});db[_0x73da('0xbd')]['hasMany'](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0x73da('0x1c6')});db['ZendeskConfiguration'][_0x73da('0x11a')](db[_0x73da('0xbe')],{'as':_0x73da('0x1bd'),'foreignKey':'FieldId'});db['ZendeskConfiguration']['belongsTo'](db['ZendeskAccount'],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0xbd')][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':_0x73da('0x1d1')});db['ZendeskField']['hasMany'](db[_0x73da('0xbe')],{'as':_0x73da('0x1c7'),'foreignKey':_0x73da('0x1c3')});db[_0x73da('0xbe')]['hasMany'](db[_0x73da('0xbe')],{'as':_0x73da('0x1c8'),'foreignKey':'DescriptionId'});db[_0x73da('0xbe')][_0x73da('0x11a')](db[_0x73da('0xbe')],{'as':_0x73da('0x1c9'),'foreignKey':_0x73da('0x1ca')});db[_0x73da('0xbe')][_0x73da('0x157')](db[_0x73da('0x1cb')],{'as':_0x73da('0x1cb'),'foreignKey':_0x73da('0x1cc')});db[_0x73da('0x1d2')]['hasMany'](db['FreshdeskConfiguration'],{'as':_0x73da('0x1c0'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0xc0')][_0x73da('0x11a')](db[_0x73da('0xc2')],{'as':_0x73da('0x1c2'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c3')});db[_0x73da('0xc0')]['hasMany'](db[_0x73da('0xc2')],{'as':_0x73da('0x1c5'),'onDelete':'cascade','foreignKey':_0x73da('0x1c6')});db[_0x73da('0xc0')][_0x73da('0x11a')](db[_0x73da('0xc2')],{'as':_0x73da('0x1bd'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1ca')});db['FreshdeskConfiguration'][_0x73da('0x157')](db[_0x73da('0x1d2')],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0xc0')][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x73da('0xc2')][_0x73da('0x11a')](db[_0x73da('0xc2')],{'as':'Subject','foreignKey':_0x73da('0x1c3')});db[_0x73da('0xc2')][_0x73da('0x11a')](db[_0x73da('0xc2')],{'as':_0x73da('0x1c8'),'foreignKey':_0x73da('0x1c6')});db[_0x73da('0xc2')][_0x73da('0x11a')](db[_0x73da('0xc2')],{'as':_0x73da('0x1c9'),'foreignKey':_0x73da('0x1ca')});db[_0x73da('0xc2')][_0x73da('0x157')](db[_0x73da('0x1cb')],{'as':'Variable','foreignKey':'VariableId'});db[_0x73da('0x1d3')]['hasMany'](db['VtigerConfiguration'],{'as':'Configurations','onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0xc4')]['hasMany'](db['VtigerField'],{'as':_0x73da('0x1c2'),'foreignKey':'SubjectId'});db[_0x73da('0xc4')][_0x73da('0x11a')](db[_0x73da('0x1d4')],{'as':_0x73da('0x1c5'),'foreignKey':_0x73da('0x1c6')});db[_0x73da('0xc4')][_0x73da('0x11a')](db[_0x73da('0x1d4')],{'as':_0x73da('0x1bd'),'foreignKey':_0x73da('0x1ca')});db[_0x73da('0xc4')][_0x73da('0x157')](db[_0x73da('0x1d3')],{'as':_0x73da('0x176'),'foreignKey':'AccountId'});db[_0x73da('0x1d4')][_0x73da('0x11a')](db['VtigerField'],{'as':_0x73da('0x1c7'),'foreignKey':'SubjectId'});db[_0x73da('0x1d4')][_0x73da('0x11a')](db[_0x73da('0x1d4')],{'as':'Description','foreignKey':_0x73da('0x1c6')});db[_0x73da('0x1d4')][_0x73da('0x11a')](db[_0x73da('0x1d4')],{'as':_0x73da('0x1c9'),'foreignKey':'FieldId'});db[_0x73da('0x1d4')][_0x73da('0x157')](db['Variable'],{'as':_0x73da('0x1cb'),'foreignKey':_0x73da('0x1cc')});db['ServicenowAccount']['hasMany'](db[_0x73da('0x1d5')],{'as':_0x73da('0x1c0'),'onDelete':'cascade','foreignKey':_0x73da('0x1c1')});db[_0x73da('0x1d5')][_0x73da('0x11a')](db[_0x73da('0xca')],{'as':'Subjects','foreignKey':_0x73da('0x1c3')});db[_0x73da('0x1d5')][_0x73da('0x11a')](db['ServicenowField'],{'as':_0x73da('0x1c5'),'foreignKey':_0x73da('0x1c6')});db['ServicenowConfiguration'][_0x73da('0x11a')](db[_0x73da('0xca')],{'as':_0x73da('0x1bd'),'foreignKey':_0x73da('0x1ca')});db['ServicenowConfiguration'][_0x73da('0x157')](db[_0x73da('0xc7')],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0xca')][_0x73da('0x11a')](db[_0x73da('0xca')],{'as':_0x73da('0x1c7'),'foreignKey':_0x73da('0x1c3')});db[_0x73da('0xca')][_0x73da('0x11a')](db[_0x73da('0xca')],{'as':_0x73da('0x1c8'),'foreignKey':_0x73da('0x1c6')});db['ServicenowField'][_0x73da('0x11a')](db[_0x73da('0xca')],{'as':_0x73da('0x1c9'),'foreignKey':_0x73da('0x1ca')});db[_0x73da('0xca')]['belongsTo'](db[_0x73da('0x1cb')],{'as':_0x73da('0x1cb'),'foreignKey':_0x73da('0x1cc')});db['Dynamics365Account']['hasMany'](db[_0x73da('0xcd')],{'as':_0x73da('0x1c0'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x73da('0x1d6')]['belongsTo'](db[_0x73da('0x10e')],{'as':_0x73da('0x10e'),'foreignKey':_0x73da('0x169')});db[_0x73da('0xcd')][_0x73da('0x11a')](db[_0x73da('0xcf')],{'as':_0x73da('0x1c2'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c3')});db['Dynamics365Configuration']['hasMany'](db[_0x73da('0xcf')],{'as':_0x73da('0x1c5'),'onDelete':'cascade','foreignKey':_0x73da('0x1c6')});db['Dynamics365Configuration'][_0x73da('0x11a')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1ca')});db[_0x73da('0xcd')][_0x73da('0x157')](db[_0x73da('0x1d6')],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0xcf')][_0x73da('0x11a')](db['Dynamics365Field'],{'as':_0x73da('0x1c7'),'foreignKey':_0x73da('0x1c3')});db[_0x73da('0xcf')][_0x73da('0x11a')](db[_0x73da('0xcf')],{'as':_0x73da('0x1c8'),'foreignKey':_0x73da('0x1c6')});db[_0x73da('0xcf')][_0x73da('0x11a')](db[_0x73da('0xcf')],{'as':_0x73da('0x1c9'),'foreignKey':_0x73da('0x1ca')});db[_0x73da('0xcf')][_0x73da('0x157')](db[_0x73da('0x1cb')],{'as':_0x73da('0x1cb'),'foreignKey':_0x73da('0x1cc')});db[_0x73da('0xd1')][_0x73da('0x11a')](db[_0x73da('0x1d7')],{'as':'Configurations','onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0x1d7')][_0x73da('0x11a')](db[_0x73da('0xd4')],{'as':'Subjects','foreignKey':_0x73da('0x1c3')});db['FreshsalesConfiguration'][_0x73da('0x11a')](db[_0x73da('0xd4')],{'as':_0x73da('0x1c5'),'foreignKey':_0x73da('0x1c6')});db['FreshsalesConfiguration'][_0x73da('0x11a')](db[_0x73da('0xd4')],{'as':_0x73da('0x1bd'),'foreignKey':_0x73da('0x1ca')});db[_0x73da('0x1d7')]['belongsTo'](db[_0x73da('0xd1')],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x1c1')});db[_0x73da('0xd4')][_0x73da('0x11a')](db[_0x73da('0xd4')],{'as':_0x73da('0x1c7'),'foreignKey':'SubjectId'});db[_0x73da('0xd4')][_0x73da('0x11a')](db[_0x73da('0xd4')],{'as':_0x73da('0x1c8'),'foreignKey':_0x73da('0x1c6')});db[_0x73da('0xd4')]['hasMany'](db[_0x73da('0xd4')],{'as':'Field','foreignKey':_0x73da('0x1ca')});db[_0x73da('0xd4')]['belongsTo'](db[_0x73da('0x1cb')],{'as':_0x73da('0x1cb'),'foreignKey':_0x73da('0x1cc')});db[_0x73da('0x1d8')]['belongsTo'](db[_0x73da('0x68')],{});db[_0x73da('0x1d8')]['belongsTo'](db[_0x73da('0xfd')],{'as':'List','foreignKey':'ListId'});db[_0x73da('0x1d8')][_0x73da('0x157')](db[_0x73da('0x130')],{'as':_0x73da('0x165'),'foreignKey':_0x73da('0x166')});db[_0x73da('0x1d8')][_0x73da('0x157')](db['ChatInteraction'],{});db['ChatQueueReport']['belongsTo'](db['ChatMessage'],{});db['ChatQueueReport'][_0x73da('0x157')](db[_0x73da('0x13')],{});db['ChatQueueReport']['belongsTo'](db[_0x73da('0x71')],{});db[_0x73da('0xd9')][_0x73da('0x157')](db[_0x73da('0x13')],{'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x1d9')});db[_0x73da('0xd9')][_0x73da('0x157')](db[_0x73da('0x13')],{'onDelete':_0x73da('0x118'),'foreignKey':'ToId'});db[_0x73da('0xdc')][_0x73da('0x11a')](db[_0x73da('0xda')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x73da('0xdc')][_0x73da('0x11a')](db[_0x73da('0x1da')],{'foreignKey':'SessionId','onDelete':_0x73da('0x118')});db[_0x73da('0xde')][_0x73da('0x157')](db['SmsAccount'],{});db[_0x73da('0xde')][_0x73da('0x157')](db['CmList'],{'as':_0x73da('0x170'),'foreignKey':'ListId'});db['SmsQueueReport']['belongsTo'](db[_0x73da('0x130')],{'as':_0x73da('0x165'),'foreignKey':_0x73da('0x166')});db[_0x73da('0xde')]['belongsTo'](db[_0x73da('0x5a')],{});db[_0x73da('0xde')][_0x73da('0x157')](db[_0x73da('0x18b')],{});db['SmsQueueReport'][_0x73da('0x157')](db[_0x73da('0x13')],{});db[_0x73da('0xde')][_0x73da('0x157')](db['SmsQueue'],{});db[_0x73da('0xe2')]['hasMany'](db['JscriptySessionReport'],{'foreignKey':_0x73da('0x1db')});db[_0x73da('0xe2')][_0x73da('0x11a')](db[_0x73da('0xda')],{'foreignKey':_0x73da('0x1db')});db['JscriptyProject'][_0x73da('0x11a')](db['JscriptyAnswerReport'],{'foreignKey':_0x73da('0x1db')});db[_0x73da('0xeb')][_0x73da('0x12d')](db['User'],{'as':_0x73da('0x173'),'through':_0x73da('0x135')});db[_0x73da('0xeb')]['belongsToMany'](db[_0x73da('0x1d')],{'through':_0x73da('0x1dc'),'as':_0x73da('0x13c')});db[_0x73da('0xeb')]['belongsToMany'](db[_0x73da('0x41')],{'through':_0x73da('0x174'),'as':_0x73da('0x13f')});db[_0x73da('0xeb')]['belongsToMany'](db['ChatQueue'],{'through':_0x73da('0x1dd'),'as':_0x73da('0x140')});db['Team'][_0x73da('0x12d')](db[_0x73da('0x54')],{'through':_0x73da('0x1de'),'as':_0x73da('0x141')});db[_0x73da('0xeb')][_0x73da('0x12d')](db['SmsQueue'],{'through':_0x73da('0x191'),'as':_0x73da('0x142')});db[_0x73da('0xeb')]['belongsToMany'](db[_0x73da('0x67')],{'through':'team_has_openchannel_queues','as':_0x73da('0x143')});db[_0x73da('0xeb')][_0x73da('0x12d')](db[_0x73da('0x10c')],{'through':_0x73da('0x1df'),'as':_0x73da('0x1e0')});db[_0x73da('0xeb')][_0x73da('0x12d')](db[_0x73da('0x1e1')],{'through':_0x73da('0x1e2'),'as':_0x73da('0x13e')});db[_0x73da('0xef')][_0x73da('0x11a')](db[_0x73da('0x78')],{'as':_0x73da('0x12a'),'foreignKey':_0x73da('0x1a8')});db[_0x73da('0xef')][_0x73da('0x11a')](db['CmHopperFinal'],{'as':_0x73da('0x11e'),'foreignKey':_0x73da('0x1a8')});db[_0x73da('0xef')]['hasMany'](db[_0x73da('0x11f')],{'as':_0x73da('0x155'),'foreignKey':_0x73da('0x1a8')});db[_0x73da('0xef')][_0x73da('0x11a')](db[_0x73da('0x1a6')],{'as':_0x73da('0x156'),'foreignKey':_0x73da('0x1a8')});db[_0x73da('0xef')][_0x73da('0x157')](db[_0x73da('0x2d')],{'as':'Trunk','foreignKey':_0x73da('0x158')});db['Campaign'][_0x73da('0x157')](db[_0x73da('0x2d')],{'as':_0x73da('0x1e3'),'foreignKey':'TrunkBackupId'});db[_0x73da('0xef')][_0x73da('0x157')](db[_0x73da('0x88')],{'as':_0x73da('0x88'),'foreignKey':_0x73da('0x15a')});db[_0x73da('0xef')]['belongsTo'](db[_0x73da('0xe5')],{'as':_0x73da('0xe5'),'foreignKey':_0x73da('0x1e4')});db[_0x73da('0xef')][_0x73da('0x12d')](db[_0x73da('0xfd')],{'as':_0x73da('0x133'),'through':_0x73da('0x1e5')});db[_0x73da('0xef')][_0x73da('0x12d')](db[_0x73da('0xfd')],{'as':_0x73da('0x1e6'),'through':_0x73da('0x1e7')});db['Attachment'][_0x73da('0x157')](db[_0x73da('0x17f')],{'as':_0x73da('0x17f'),'foreignKey':_0x73da('0x180')});db[_0x73da('0x1e8')]['belongsTo'](db[_0x73da('0x47')],{});db[_0x73da('0x1e8')][_0x73da('0x157')](db[_0x73da('0x45')],{});db[_0x73da('0x1e8')]['belongsTo'](db[_0x73da('0x3f')],{'foreignKey':_0x73da('0x1e9'),'as':_0x73da('0x1ea')});db[_0x73da('0x1e8')][_0x73da('0x157')](db[_0x73da('0x13')],{'foreignKey':_0x73da('0x1eb'),'as':_0x73da('0x1ec')});db[_0x73da('0x1e8')][_0x73da('0x157')](db[_0x73da('0x13')],{'foreignKey':_0x73da('0x1ed'),'as':'ToAgent'});db[_0x73da('0x1e8')]['belongsTo'](db[_0x73da('0x41')],{'foreignKey':_0x73da('0x1ee'),'as':_0x73da('0x1ef')});db['MailTransferReport'][_0x73da('0x157')](db[_0x73da('0x3f')],{'foreignKey':'ToMailAccountId','as':_0x73da('0x1f0')});db[_0x73da('0x1f1')][_0x73da('0x157')](db[_0x73da('0x6f')],{});db['ChatTransferReport'][_0x73da('0x157')](db['ChatInteraction'],{});db[_0x73da('0x1f1')][_0x73da('0x157')](db[_0x73da('0x68')],{'foreignKey':_0x73da('0x1f2'),'as':_0x73da('0x1ea')});db[_0x73da('0x1f1')][_0x73da('0x157')](db[_0x73da('0x13')],{'foreignKey':_0x73da('0x1eb'),'as':_0x73da('0x1ec')});db[_0x73da('0x1f1')][_0x73da('0x157')](db[_0x73da('0x13')],{'foreignKey':_0x73da('0x1ed'),'as':_0x73da('0x1f3')});db[_0x73da('0x1f1')][_0x73da('0x157')](db[_0x73da('0x71')],{'foreignKey':_0x73da('0x1f4'),'as':'ToQueue'});db[_0x73da('0x1f1')][_0x73da('0x157')](db[_0x73da('0x68')],{'foreignKey':_0x73da('0x1f5'),'as':_0x73da('0x1f0')});db[_0x73da('0xf7')][_0x73da('0x157')](db[_0x73da('0x52')],{});db['FaxTransferReport'][_0x73da('0x157')](db['FaxInteraction'],{});db[_0x73da('0xf7')]['belongsTo'](db[_0x73da('0x146')],{'foreignKey':_0x73da('0x1f6'),'as':_0x73da('0x1ea')});db[_0x73da('0xf7')][_0x73da('0x157')](db[_0x73da('0x13')],{'foreignKey':_0x73da('0x1eb'),'as':'FromAgent'});db[_0x73da('0xf7')][_0x73da('0x157')](db[_0x73da('0x13')],{'foreignKey':_0x73da('0x1ed'),'as':_0x73da('0x1f3')});db['FaxTransferReport'][_0x73da('0x157')](db['FaxQueue'],{'foreignKey':_0x73da('0x1f7'),'as':_0x73da('0x1ef')});db[_0x73da('0xf7')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x73da('0x1f8'),'as':_0x73da('0x1f0')});db[_0x73da('0xf9')][_0x73da('0x157')](db[_0x73da('0x65')],{});db[_0x73da('0xf9')][_0x73da('0x157')](db[_0x73da('0x63')],{});db[_0x73da('0xf9')]['belongsTo'](db[_0x73da('0x5f')],{'foreignKey':_0x73da('0x1f9'),'as':'FromAccount'});db['OpenchannelTransferReport'][_0x73da('0x157')](db[_0x73da('0x13')],{'foreignKey':_0x73da('0x1eb'),'as':_0x73da('0x1ec')});db[_0x73da('0xf9')][_0x73da('0x157')](db[_0x73da('0x13')],{'foreignKey':_0x73da('0x1ed'),'as':'ToAgent'});db[_0x73da('0xf9')][_0x73da('0x157')](db['OpenchannelQueue'],{'foreignKey':_0x73da('0x1fa'),'as':'ToQueue'});db[_0x73da('0xf9')][_0x73da('0x157')](db[_0x73da('0x5f')],{'foreignKey':_0x73da('0x1fb'),'as':_0x73da('0x1f0')});db[_0x73da('0xfb')][_0x73da('0x157')](db[_0x73da('0x18b')],{});db['SmsTransferReport'][_0x73da('0x157')](db[_0x73da('0x5a')],{});db[_0x73da('0xfb')][_0x73da('0x157')](db['SmsAccount'],{'foreignKey':_0x73da('0x1fc'),'as':_0x73da('0x1ea')});db[_0x73da('0xfb')][_0x73da('0x157')](db[_0x73da('0x13')],{'foreignKey':_0x73da('0x1eb'),'as':_0x73da('0x1ec')});db['SmsTransferReport'][_0x73da('0x157')](db[_0x73da('0x13')],{'foreignKey':'ToUserId','as':_0x73da('0x1f3')});db[_0x73da('0xfb')]['belongsTo'](db[_0x73da('0x5d')],{'foreignKey':_0x73da('0x1fd'),'as':'ToQueue'});db[_0x73da('0xfb')][_0x73da('0x157')](db['SmsAccount'],{'foreignKey':_0x73da('0x1fe'),'as':_0x73da('0x1f0')});db[_0x73da('0xfd')][_0x73da('0x11a')](db[_0x73da('0x86')],{'as':'Dispositions','foreignKey':'ListId','onDelete':'cascade'});db[_0x73da('0xfd')][_0x73da('0x11a')](db['CmCustomField'],{'as':'CustomFields','foreignKey':'ListId'});db[_0x73da('0xfd')][_0x73da('0x11a')](db['CmContact'],{'as':_0x73da('0x131'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x171')});db[_0x73da('0xfd')][_0x73da('0x11a')](db['CmHopperFinal'],{'as':_0x73da('0x11e'),'foreignKey':'ListId'});db['CmList'][_0x73da('0x11a')](db[_0x73da('0x11f')],{'as':_0x73da('0x120'),'foreignKey':_0x73da('0x171')});db['CmList'][_0x73da('0x11a')](db[_0x73da('0x7d')],{'as':_0x73da('0x7d'),'foreignKey':_0x73da('0x171')});db[_0x73da('0xfd')][_0x73da('0x12d')](db[_0x73da('0x1d')],{'as':_0x73da('0x1ff'),'through':_0x73da('0x200')});db['CmList']['belongsToMany'](db[_0x73da('0x13')],{'as':'Agents','through':_0x73da('0x134')});db[_0x73da('0x1e1')][_0x73da('0x11a')](db['VoiceExtension'],{'as':_0x73da('0x11d'),'onDelete':_0x73da('0x118')});db[_0x73da('0x1e1')][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':_0x73da('0x173'),'through':_0x73da('0x112')});db['VoicePrefix'][_0x73da('0x12d')](db['Team'],{'through':_0x73da('0x1e2'),'as':_0x73da('0x15d')});db[_0x73da('0xfe')][_0x73da('0x11a')](db['User'],{'as':_0x73da('0x17b'),'foreignKey':_0x73da('0x12c')});db['UserProfile'][_0x73da('0x11a')](db['UserProfileSection'],{'as':_0x73da('0x201'),'foreignKey':_0x73da('0x12c'),'onDelete':_0x73da('0x118')});db[_0x73da('0x100')][_0x73da('0x11a')](db[_0x73da('0x101')],{'as':'Resources','foreignKey':'sectionId','onDelete':_0x73da('0x118')});db[_0x73da('0x105')][_0x73da('0x11a')](db[_0x73da('0x86')],{'as':_0x73da('0x16d'),'foreignKey':_0x73da('0x202'),'onDelete':'cascade'});db['WhatsappAccount'][_0x73da('0x11a')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x73da('0x202')});db[_0x73da('0x105')]['hasMany'](db[_0x73da('0x108')],{'as':_0x73da('0x15f'),'foreignKey':_0x73da('0x202')});db['WhatsappAccount']['hasMany'](db[_0x73da('0x126')],{'as':_0x73da('0x16f')});db[_0x73da('0x105')][_0x73da('0x11a')](db['WhatsappApplication'],{'as':_0x73da('0x150'),'foreignKey':'WhatsappAccountId','onDelete':_0x73da('0x118')});db[_0x73da('0x105')][_0x73da('0x157')](db[_0x73da('0xfd')],{'as':_0x73da('0x170'),'foreignKey':_0x73da('0x171')});db[_0x73da('0x105')][_0x73da('0x157')](db[_0x73da('0x8a')],{'as':_0x73da('0x15b'),'foreignKey':_0x73da('0x15c')});db['WhatsappAccount'][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':_0x73da('0x173'),'through':_0x73da('0x14e')});db[_0x73da('0x203')][_0x73da('0x157')](db[_0x73da('0x13')],{'onDelete':_0x73da('0x16a')});db['WhatsappApplication'][_0x73da('0x157')](db[_0x73da('0x10c')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x73da('0x157')](db['WhatsappAccount'],{'onDelete':'restrict'});db['WhatsappApplication'][_0x73da('0x157')](db[_0x73da('0x88')],{'onDelete':'restrict','foreignKey':_0x73da('0x15a')});db[_0x73da('0x203')][_0x73da('0x157')](db[_0x73da('0x92')],{'onDelete':_0x73da('0x16a'),'foreignKey':_0x73da('0x181')});db[_0x73da('0x126')][_0x73da('0x11a')](db['WhatsappMessage'],{'as':_0x73da('0x15f'),'onDelete':_0x73da('0x118'),'foreignKey':_0x73da('0x204')});db[_0x73da('0x126')][_0x73da('0x157')](db[_0x73da('0x105')],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x202')});db['WhatsappInteraction']['belongsTo'](db[_0x73da('0x130')],{'as':'Contact','foreignKey':_0x73da('0x166')});db['WhatsappInteraction'][_0x73da('0x157')](db[_0x73da('0x13')],{'as':'Owner','foreignKey':_0x73da('0x119')});db[_0x73da('0x126')][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':_0x73da('0x1b6'),'as':_0x73da('0x178')});db['WhatsappInteraction'][_0x73da('0x12d')](db[_0x73da('0x92')],{'through':_0x73da('0x1b6'),'as':'ThroughTags'});db[_0x73da('0x126')][_0x73da('0x12d')](db[_0x73da('0x13')],{'as':_0x73da('0x17b'),'through':_0x73da('0x13b'),'foreignKey':_0x73da('0x204')});db[_0x73da('0x108')][_0x73da('0x157')](db['User'],{'as':_0x73da('0x13')});db[_0x73da('0x108')][_0x73da('0x157')](db['CmContact'],{'onDelete':_0x73da('0x118'),'as':'Contact'});db[_0x73da('0x108')][_0x73da('0x157')](db[_0x73da('0x126')],{'onDelete':_0x73da('0x118'),'as':_0x73da('0x17d'),'foreignKey':_0x73da('0x204')});db['WhatsappMessage'][_0x73da('0x157')](db[_0x73da('0x105')],{'as':_0x73da('0x176'),'foreignKey':_0x73da('0x202')});db['WhatsappQueueReport'][_0x73da('0x157')](db['WhatsappAccount'],{});db[_0x73da('0x205')][_0x73da('0x157')](db[_0x73da('0xfd')],{'as':_0x73da('0x170'),'foreignKey':'ListId'});db[_0x73da('0x205')][_0x73da('0x157')](db['CmContact'],{'as':_0x73da('0x165'),'foreignKey':'ContactId'});db['WhatsappQueueReport'][_0x73da('0x157')](db[_0x73da('0x126')],{});db[_0x73da('0x205')][_0x73da('0x157')](db['WhatsappQueue'],{});db[_0x73da('0x205')]['belongsTo'](db[_0x73da('0x108')],{});db[_0x73da('0x205')]['belongsTo'](db[_0x73da('0x13')],{});db[_0x73da('0x10a')][_0x73da('0x157')](db[_0x73da('0x108')],{});db[_0x73da('0x10a')][_0x73da('0x157')](db['WhatsappInteraction'],{});db[_0x73da('0x10a')][_0x73da('0x157')](db[_0x73da('0x105')],{'foreignKey':'FromWhatsappAccountId','as':_0x73da('0x1ea')});db[_0x73da('0x10a')][_0x73da('0x157')](db[_0x73da('0x105')],{'foreignKey':_0x73da('0x206'),'as':_0x73da('0x1f0')});db['WhatsappTransferReport'][_0x73da('0x157')](db[_0x73da('0x10c')],{'foreignKey':_0x73da('0x207'),'as':_0x73da('0x1ef')});db[_0x73da('0x10a')][_0x73da('0x157')](db['User'],{'foreignKey':_0x73da('0x1eb'),'as':'FromAgent'});db[_0x73da('0x10a')]['belongsTo'](db['User'],{'foreignKey':_0x73da('0x1ed'),'as':_0x73da('0x1f3')});db[_0x73da('0x10c')]['belongsToMany'](db[_0x73da('0x13')],{'as':'Agents','through':_0x73da('0x208'),'foreignKey':_0x73da('0x209')});db[_0x73da('0x10c')][_0x73da('0x12d')](db['Team'],{'through':'team_has_whatsapp_queues','as':'Teams'});db[_0x73da('0x114')][_0x73da('0x157')](db[_0x73da('0x13')],{'as':'user','foreignKey':_0x73da('0x119'),'onDelete':_0x73da('0x118'),'hooks':!![]});db['CloudProvider'][_0x73da('0x117')](db[_0x73da('0x1d6')],{'as':_0x73da('0x1d6'),'onDelete':_0x73da('0x16a')});db[_0x73da('0x10e')][_0x73da('0x117')](db[_0x73da('0x167')],{'as':'Imap','onDelete':_0x73da('0x16a')});db[_0x73da('0x10e')]['hasOne'](db[_0x73da('0x3e')],{'as':_0x73da('0x16c'),'onDelete':_0x73da('0x16a')});module[_0x73da('0x20a')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index c33c15f..825a4ae 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb04=['./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/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/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZendeskAccount','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./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/intFreshsalesField','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','/apidoc','static','root','/www','join','/demo','/snippet','snippet','3.10.1','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','./api/pause','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','./api/trigger','/api/variables','./api/variable'];(function(_0x561981,_0x15a293){var _0x3c9a83=function(_0x2b8896){while(--_0x2b8896){_0x561981['push'](_0x561981['shift']());}};_0x3c9a83(++_0x15a293);}(_0xcb04,0x9a));var _0x4cb0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcb04[_0x20a584];return _0x4b41a8;};'use strict';var path=require(_0x4cb0('0x0'));var express=require(_0x4cb0('0x1'));var errors=require(_0x4cb0('0x2'));var config=require(_0x4cb0('0x3'));var setupLoggers=require(_0x4cb0('0x4'))[_0x4cb0('0x5')];var clientSideLogs=require(_0x4cb0('0x6'));exports[_0x4cb0('0x7')]=function(_0x392bd7){return setupLoggers(_0x392bd7)[_0x4cb0('0x8')](function(){_0x392bd7['use'](_0x4cb0('0x9'),require(_0x4cb0('0xa')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xc'),require(_0x4cb0('0xd')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xe'),require(_0x4cb0('0xf')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x10'),require(_0x4cb0('0x11')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x12'),require(_0x4cb0('0x13')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x14'),require(_0x4cb0('0x15')));_0x392bd7[_0x4cb0('0xb')]('/api/voice/recordings',require(_0x4cb0('0x16')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x17'),require(_0x4cb0('0x18')));_0x392bd7['use'](_0x4cb0('0x19'),require(_0x4cb0('0x1a')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x1b'),require(_0x4cb0('0x1c')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x1d'),require(_0x4cb0('0x1e')));_0x392bd7[_0x4cb0('0xb')]('/api/voice/dials/reports',require(_0x4cb0('0x1f')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x20'),require(_0x4cb0('0x21')));_0x392bd7['use']('/api/voice/queues/reports',require(_0x4cb0('0x22')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x23'),require(_0x4cb0('0x24')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x25'),require(_0x4cb0('0x26')));_0x392bd7['use']('/api/voice/transfers/reports',require(_0x4cb0('0x27')));_0x392bd7['use']('/api/mail/out_servers',require(_0x4cb0('0x28')));_0x392bd7[_0x4cb0('0xb')]('/api/mail/accounts',require(_0x4cb0('0x29')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x2a'),require('./api/mailQueue'));_0x392bd7[_0x4cb0('0xb')]('/api/mail/substatuses',require(_0x4cb0('0x2b')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x2c'),require(_0x4cb0('0x2d')));_0x392bd7['use'](_0x4cb0('0x2e'),require(_0x4cb0('0x2f')));_0x392bd7['use']('/api/mail/applications',require(_0x4cb0('0x30')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x31'),require(_0x4cb0('0x32')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x33'),require(_0x4cb0('0x34')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x35'),require(_0x4cb0('0x36')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x37'),require('./api/faxAccount'));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x38'),require(_0x4cb0('0x39')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x3a'),require('./api/faxInteraction'));_0x392bd7[_0x4cb0('0xb')]('/api/fax/messages',require(_0x4cb0('0x3b')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x3c'),require('./api/faxQueue'));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x3d'),require(_0x4cb0('0x3e')));_0x392bd7[_0x4cb0('0xb')]('/api/sms/accounts',require(_0x4cb0('0x3f')));_0x392bd7['use']('/api/sms/applications',require(_0x4cb0('0x40')));_0x392bd7[_0x4cb0('0xb')]('/api/sms/interactions',require(_0x4cb0('0x41')));_0x392bd7['use'](_0x4cb0('0x42'),require(_0x4cb0('0x43')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x44'),require('./api/smsQueue'));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x45'),require(_0x4cb0('0x46')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x47'),require(_0x4cb0('0x48')));_0x392bd7[_0x4cb0('0xb')]('/api/openchannel/interactions',require(_0x4cb0('0x49')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x4a'),require(_0x4cb0('0x4b')));_0x392bd7['use']('/api/openchannel/queues',require(_0x4cb0('0x4c')));_0x392bd7['use'](_0x4cb0('0x4d'),require(_0x4cb0('0x4e')));_0x392bd7['use'](_0x4cb0('0x4f'),require('./api/openchannelQueueReport'));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x50'),require(_0x4cb0('0x51')));_0x392bd7[_0x4cb0('0xb')]('/api/chat/interactions',require(_0x4cb0('0x52')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x53'),require(_0x4cb0('0x54')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x55'),require(_0x4cb0('0x56')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x57'),require(_0x4cb0('0x58')));_0x392bd7['use']('/api/chat/groups',require(_0x4cb0('0x59')));_0x392bd7['use'](_0x4cb0('0x5a'),require(_0x4cb0('0x5b')));_0x392bd7[_0x4cb0('0xb')]('/api/cm/companies',require(_0x4cb0('0x5c')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x5d'),require('./api/cmContact'));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x5e'),require(_0x4cb0('0x5f')));_0x392bd7[_0x4cb0('0xb')]('/api/cm/hopper_black',require(_0x4cb0('0x60')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x61'),require(_0x4cb0('0x62')));_0x392bd7[_0x4cb0('0xb')]('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x63'),require(_0x4cb0('0x64')));_0x392bd7['use']('/api/actions',require(_0x4cb0('0x65')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x66'),require(_0x4cb0('0x67')));_0x392bd7['use'](_0x4cb0('0x68'),require(_0x4cb0('0x69')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x6a'),require(_0x4cb0('0x6b')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x6c'),require('./api/condition'));_0x392bd7['use'](_0x4cb0('0x6d'),require(_0x4cb0('0x6e')));_0x392bd7[_0x4cb0('0xb')]('/api/pauses',require(_0x4cb0('0x6f')));_0x392bd7['use']('/api/cdr',require('./api/cdr'));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x70'),require(_0x4cb0('0x71')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x72'),require(_0x4cb0('0x73')));_0x392bd7['use'](_0x4cb0('0x74'),require(_0x4cb0('0x75')));_0x392bd7[_0x4cb0('0xb')]('/api/tags',require(_0x4cb0('0x76')));_0x392bd7['use'](_0x4cb0('0x77'),require(_0x4cb0('0x78')));_0x392bd7['use'](_0x4cb0('0x79'),require(_0x4cb0('0x7a')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x7b'),require(_0x4cb0('0x7c')));_0x392bd7[_0x4cb0('0xb')]('/api/templates',require(_0x4cb0('0x7d')));_0x392bd7[_0x4cb0('0xb')]('/api/triggers',require(_0x4cb0('0x7e')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x7f'),require(_0x4cb0('0x80')));_0x392bd7['use']('/api/integrations',require(_0x4cb0('0x81')));_0x392bd7['use'](_0x4cb0('0x82'),require(_0x4cb0('0x83')));_0x392bd7[_0x4cb0('0xb')]('/api/analytics/custom_reports',require(_0x4cb0('0x84')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x85'),require(_0x4cb0('0x86')));_0x392bd7['use']('/api/analytics/extracted_reports',require(_0x4cb0('0x87')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x88'),require(_0x4cb0('0x89')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x8a'),require(_0x4cb0('0x8b')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x8c'),require(_0x4cb0('0x8d')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x8e'),require('./api/intSalesforceAccount'));_0x392bd7['use'](_0x4cb0('0x8f'),require(_0x4cb0('0x90')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x91'),require('./api/intSalesforceField'));_0x392bd7['use'](_0x4cb0('0x92'),require('./api/intSugarcrmAccount'));_0x392bd7['use'](_0x4cb0('0x93'),require(_0x4cb0('0x94')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x95'),require(_0x4cb0('0x96')));_0x392bd7['use'](_0x4cb0('0x97'),require('./api/intDeskAccount'));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x98'),require(_0x4cb0('0x99')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x9a'),require(_0x4cb0('0x9b')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x9c'),require('./api/intZohoAccount'));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x9d'),require(_0x4cb0('0x9e')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x9f'),require('./api/intZohoField'));_0x392bd7[_0x4cb0('0xb')]('/api/integrations/zendesk/accounts',require(_0x4cb0('0xa0')));_0x392bd7[_0x4cb0('0xb')]('/api/integrations/zendesk/configurations',require(_0x4cb0('0xa1')));_0x392bd7[_0x4cb0('0xb')]('/api/integrations/zendesk/fields',require(_0x4cb0('0xa2')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xa3'),require(_0x4cb0('0xa4')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xa5'),require(_0x4cb0('0xa6')));_0x392bd7['use']('/api/integrations/freshdesk/fields',require(_0x4cb0('0xa7')));_0x392bd7['use'](_0x4cb0('0xa8'),require(_0x4cb0('0xa9')));_0x392bd7['use'](_0x4cb0('0xaa'),require(_0x4cb0('0xab')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xac'),require(_0x4cb0('0xad')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xae'),require(_0x4cb0('0xaf')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xb0'),require(_0x4cb0('0xb1')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xb2'),require('./api/intServicenowField'));_0x392bd7[_0x4cb0('0xb')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x392bd7['use']('/api/integrations/dynamics365/configurations',require(_0x4cb0('0xb3')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xb4'),require(_0x4cb0('0xb5')));_0x392bd7['use'](_0x4cb0('0xb6'),require(_0x4cb0('0xb7')));_0x392bd7['use'](_0x4cb0('0xb8'),require(_0x4cb0('0xb9')));_0x392bd7['use'](_0x4cb0('0xba'),require(_0x4cb0('0xbb')));_0x392bd7[_0x4cb0('0xb')]('/api/networks',require(_0x4cb0('0xbc')));_0x392bd7[_0x4cb0('0xb')]('/api/chat/reports/queue',require(_0x4cb0('0xbd')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xbe'),require(_0x4cb0('0xbf')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xc0'),require(_0x4cb0('0xc1')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xc2'),require('./api/jscriptyQuestionReport'));_0x392bd7['use'](_0x4cb0('0xc3'),require(_0x4cb0('0xc4')));_0x392bd7['use'](_0x4cb0('0xc5'),require('./api/smsQueueReport'));_0x392bd7[_0x4cb0('0xb')]('/api/square/reports',require(_0x4cb0('0xc6')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xc7'),require(_0x4cb0('0xc8')));_0x392bd7[_0x4cb0('0xb')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x392bd7[_0x4cb0('0xb')]('/api/settings',require(_0x4cb0('0xc9')));_0x392bd7['use'](_0x4cb0('0xca'),require('./api/squareOdbc'));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xcb'),require(_0x4cb0('0xcc')));_0x392bd7[_0x4cb0('0xb')]('/api/square/recordings',require(_0x4cb0('0xcd')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xce'),require(_0x4cb0('0xcf')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xd0'),require(_0x4cb0('0xd1')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xd2'),require(_0x4cb0('0xd3')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xd4'),require(_0x4cb0('0xd5')));_0x392bd7[_0x4cb0('0xb')]('/api/migrations',require(_0x4cb0('0xd6')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xd7'),require(_0x4cb0('0xd8')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xd9'),require(_0x4cb0('0xda')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xdb'),require(_0x4cb0('0xdc')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xdd'),require('./api/chatTransferReport'));_0x392bd7['use'](_0x4cb0('0xde'),require(_0x4cb0('0xdf')));_0x392bd7[_0x4cb0('0xb')]('/api/openchannel/reports/transfer',require(_0x4cb0('0xe0')));_0x392bd7['use'](_0x4cb0('0xe1'),require('./api/smsTransferReport'));_0x392bd7[_0x4cb0('0xb')]('/api/cm/lists',require(_0x4cb0('0xe2')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xe3'),require(_0x4cb0('0xe4')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xe5'),require(_0x4cb0('0xe6')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xe7'),require(_0x4cb0('0xe8')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xe9'),require(_0x4cb0('0xea')));_0x392bd7['use'](_0x4cb0('0xeb'),require(_0x4cb0('0xec')));_0x392bd7['use']('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xed'),require(_0x4cb0('0xee')));_0x392bd7['use'](_0x4cb0('0xef'),require('./api/whatsappInteraction'));_0x392bd7['use']('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xf0'),require(_0x4cb0('0xf1')));_0x392bd7[_0x4cb0('0xb')]('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xf2'),require('./api/whatsappQueue'));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xf3'),require(_0x4cb0('0xf4')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xf5'),require(_0x4cb0('0xf6')));_0x392bd7['use'](_0x4cb0('0xf7'),require(_0x4cb0('0xf8')));_0x392bd7[_0x4cb0('0xb')]('/api/mail_interaction_has_tags',require(_0x4cb0('0xf9')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xfa'),require(_0x4cb0('0xfb')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xfc'),require(_0x4cb0('0xfd')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0xfe'),require(_0x4cb0('0xff')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x100'),require('./api/jira'));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x101'),require(_0x4cb0('0x102')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x103'),require(_0x4cb0('0x104')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x105'),require(_0x4cb0('0x106')));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x107'),require(_0x4cb0('0x108')));_0x392bd7['use'](_0x4cb0('0x109'),require('./api/webbar'));_0x392bd7['use'](_0x4cb0('0x10a'),clientSideLogs);_0x392bd7['use'](_0x4cb0('0x10b'),express[_0x4cb0('0x10c')](path['join'](config[_0x4cb0('0x10d')],_0x4cb0('0x10b'))));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x10e'),express[_0x4cb0('0x10c')](path[_0x4cb0('0x10f')](config[_0x4cb0('0x10d')],_0x4cb0('0x10e'))));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x110'),express[_0x4cb0('0x10c')](path[_0x4cb0('0x10f')](config[_0x4cb0('0x10d')],_0x4cb0('0x110'))));_0x392bd7['use'](_0x4cb0('0x111'),express[_0x4cb0('0x10c')](path['join'](config['root'],_0x4cb0('0x112'),_0x4cb0('0x113'))));_0x392bd7[_0x4cb0('0xb')](_0x4cb0('0x114'),express[_0x4cb0('0x10c')](path[_0x4cb0('0x10f')](config[_0x4cb0('0x10d')],_0x4cb0('0x115'))));_0x392bd7[_0x4cb0('0x116')](_0x4cb0('0x117'))[_0x4cb0('0x118')](errors[0x194]);_0x392bd7['route']('/*')[_0x4cb0('0x118')](function(_0x5e950c,_0x1d9e04){_0x1d9e04['sendFile'](path['resolve'](_0x392bd7[_0x4cb0('0x118')](_0x4cb0('0x119'))+_0x4cb0('0x11a')));});return _0x392bd7;});}; \ No newline at end of file +var _0xfa9f=['/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/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/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','./api/license','./api/campaign','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/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/cloudProviders','./api/cloudProvider','/api/realtime','/api/user-settings','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','./api/version','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','join','/apidoc','/www','static','root','/snippet','snippet','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','default','then','use','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/cm/companies','./api/cmCompany','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport'];(function(_0x4d09cb,_0x410341){var _0x64958b=function(_0x3ed018){while(--_0x3ed018){_0x4d09cb['push'](_0x4d09cb['shift']());}};_0x64958b(++_0x410341);}(_0xfa9f,0x93));var _0xffa9=function(_0x170772,_0x1f1ee7){_0x170772=_0x170772-0x0;var _0x3ef69c=_0xfa9f[_0x170772];return _0x3ef69c;};'use strict';var path=require('path');var express=require(_0xffa9('0x0'));var errors=require(_0xffa9('0x1'));var config=require(_0xffa9('0x2'));var setupLoggers=require(_0xffa9('0x3'))[_0xffa9('0x4')];var clientSideLogs=require('./api/client-side-logs');exports[_0xffa9('0x5')]=function(_0x5bed37){return setupLoggers(_0x5bed37)[_0xffa9('0x6')](function(){_0x5bed37[_0xffa9('0x7')]('/api/users',require(_0xffa9('0x8')));_0x5bed37['use']('/api/voice/chanspy',require(_0xffa9('0x9')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xa'),require(_0xffa9('0xb')));_0x5bed37['use'](_0xffa9('0xc'),require(_0xffa9('0xd')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xe'),require(_0xffa9('0xf')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x10'),require(_0xffa9('0x11')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x12'),require(_0xffa9('0x13')));_0x5bed37['use'](_0xffa9('0x14'),require(_0xffa9('0x15')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x16'),require(_0xffa9('0x17')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x18'),require(_0xffa9('0x19')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x1a'),require('./api/voiceCallReport'));_0x5bed37[_0xffa9('0x7')]('/api/voice/dials/reports',require(_0xffa9('0x1b')));_0x5bed37[_0xffa9('0x7')]('/api/voice/agents/reports',require(_0xffa9('0x1c')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x1d'),require('./api/voiceQueueReport'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x1e'),require(_0xffa9('0x1f')));_0x5bed37[_0xffa9('0x7')]('/api/trunks',require(_0xffa9('0x20')));_0x5bed37['use'](_0xffa9('0x21'),require(_0xffa9('0x22')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x23'),require(_0xffa9('0x24')));_0x5bed37[_0xffa9('0x7')]('/api/mail/accounts',require(_0xffa9('0x25')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x26'),require(_0xffa9('0x27')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x28'),require(_0xffa9('0x29')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x2a'),require('./api/mailInteraction'));_0x5bed37['use'](_0xffa9('0x2b'),require(_0xffa9('0x2c')));_0x5bed37[_0xffa9('0x7')]('/api/mail/applications',require('./api/mailApplication'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x2d'),require(_0xffa9('0x2e')));_0x5bed37['use']('/api/dashboards',require(_0xffa9('0x2f')));_0x5bed37['use'](_0xffa9('0x30'),require(_0xffa9('0x31')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x32'),require(_0xffa9('0x33')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x34'),require('./api/faxApplication'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x35'),require(_0xffa9('0x36')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x37'),require(_0xffa9('0x38')));_0x5bed37['use']('/api/fax/queues',require(_0xffa9('0x39')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x3a'),require(_0xffa9('0x3b')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x3c'),require(_0xffa9('0x3d')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x3e'),require('./api/smsApplication'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x3f'),require(_0xffa9('0x40')));_0x5bed37['use'](_0xffa9('0x41'),require(_0xffa9('0x42')));_0x5bed37[_0xffa9('0x7')]('/api/sms/queues',require(_0xffa9('0x43')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x44'),require('./api/openchannelAccount'));_0x5bed37[_0xffa9('0x7')]('/api/openchannel/applications',require('./api/openchannelApplication'));_0x5bed37[_0xffa9('0x7')]('/api/openchannel/interactions',require(_0xffa9('0x45')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x46'),require(_0xffa9('0x47')));_0x5bed37[_0xffa9('0x7')]('/api/openchannel/queues',require(_0xffa9('0x48')));_0x5bed37['use']('/api/chat/websites',require(_0xffa9('0x49')));_0x5bed37['use'](_0xffa9('0x4a'),require(_0xffa9('0x4b')));_0x5bed37['use']('/api/chat/applications',require(_0xffa9('0x4c')));_0x5bed37['use'](_0xffa9('0x4d'),require(_0xffa9('0x4e')));_0x5bed37['use']('/api/chat/messages',require('./api/chatMessage'));_0x5bed37['use'](_0xffa9('0x4f'),require(_0xffa9('0x50')));_0x5bed37[_0xffa9('0x7')]('/api/chat/queues',require(_0xffa9('0x51')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x52'),require(_0xffa9('0x53')));_0x5bed37[_0xffa9('0x7')]('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x54'),require(_0xffa9('0x55')));_0x5bed37[_0xffa9('0x7')]('/api/cm/contacts',require(_0xffa9('0x56')));_0x5bed37[_0xffa9('0x7')]('/api/cm/hopper',require(_0xffa9('0x57')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x58'),require('./api/cmHopperBlack'));_0x5bed37['use'](_0xffa9('0x59'),require(_0xffa9('0x5a')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x5b'),require('./api/cmHopperHistory'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x5c'),require(_0xffa9('0x5d')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x5e'),require(_0xffa9('0x5f')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x60'),require(_0xffa9('0x61')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x62'),require(_0xffa9('0x63')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x64'),require(_0xffa9('0x65')));_0x5bed37['use']('/api/conditions',require(_0xffa9('0x66')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x67'),require(_0xffa9('0x68')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x69'),require('./api/pause'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x6a'),require('./api/cdr'));_0x5bed37['use'](_0xffa9('0x6b'),require(_0xffa9('0x6c')));_0x5bed37[_0xffa9('0x7')]('/api/schedules',require('./api/schedule'));_0x5bed37['use'](_0xffa9('0x6d'),require(_0xffa9('0x6e')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x6f'),require(_0xffa9('0x70')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x71'),require('./api/contactItemType'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x72'),require(_0xffa9('0x73')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x74'),require(_0xffa9('0x75')));_0x5bed37['use'](_0xffa9('0x76'),require('./api/template'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x77'),require(_0xffa9('0x78')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x79'),require(_0xffa9('0x7a')));_0x5bed37['use']('/api/integrations',require('./api/integration'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x7b'),require('./api/integrationReport'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x7c'),require(_0xffa9('0x7d')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x7e'),require(_0xffa9('0x7f')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x80'),require(_0xffa9('0x81')));_0x5bed37[_0xffa9('0x7')]('/api/analytics/metrics',require(_0xffa9('0x82')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x83'),require(_0xffa9('0x84')));_0x5bed37['use'](_0xffa9('0x85'),require(_0xffa9('0x86')));_0x5bed37[_0xffa9('0x7')]('/api/integrations/salesforce/accounts',require(_0xffa9('0x87')));_0x5bed37[_0xffa9('0x7')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x88'),require(_0xffa9('0x89')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x8a'),require('./api/intSugarcrmAccount'));_0x5bed37['use']('/api/integrations/sugarcrm/configurations',require(_0xffa9('0x8b')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x8c'),require(_0xffa9('0x8d')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x8e'),require('./api/intDeskAccount'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x8f'),require(_0xffa9('0x90')));_0x5bed37[_0xffa9('0x7')]('/api/integrations/desk/fields',require(_0xffa9('0x91')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x92'),require(_0xffa9('0x93')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x94'),require(_0xffa9('0x95')));_0x5bed37[_0xffa9('0x7')]('/api/integrations/zoho/fields',require(_0xffa9('0x96')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x97'),require(_0xffa9('0x98')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x99'),require(_0xffa9('0x9a')));_0x5bed37[_0xffa9('0x7')]('/api/integrations/zendesk/fields',require(_0xffa9('0x9b')));_0x5bed37['use'](_0xffa9('0x9c'),require(_0xffa9('0x9d')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x9e'),require('./api/intFreshdeskConfiguration'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0x9f'),require(_0xffa9('0xa0')));_0x5bed37['use'](_0xffa9('0xa1'),require(_0xffa9('0xa2')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xa3'),require('./api/intVtigerConfiguration'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xa4'),require('./api/intVtigerField'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xa5'),require(_0xffa9('0xa6')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xa7'),require(_0xffa9('0xa8')));_0x5bed37['use'](_0xffa9('0xa9'),require(_0xffa9('0xaa')));_0x5bed37[_0xffa9('0x7')]('/api/integrations/dynamics365/accounts',require(_0xffa9('0xab')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xac'),require(_0xffa9('0xad')));_0x5bed37['use'](_0xffa9('0xae'),require('./api/intDynamics365Field'));_0x5bed37['use'](_0xffa9('0xaf'),require('./api/intFreshsalesAccount'));_0x5bed37['use'](_0xffa9('0xb0'),require(_0xffa9('0xb1')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xb2'),require(_0xffa9('0xb3')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xb4'),require(_0xffa9('0xb5')));_0x5bed37[_0xffa9('0x7')]('/api/chat/reports/queue',require(_0xffa9('0xb6')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xb7'),require('./api/chatInternalMessage'));_0x5bed37['use']('/api/jscripty/answers/reports',require(_0xffa9('0xb8')));_0x5bed37['use'](_0xffa9('0xb9'),require(_0xffa9('0xba')));_0x5bed37['use'](_0xffa9('0xbb'),require(_0xffa9('0xbc')));_0x5bed37[_0xffa9('0x7')]('/api/sms/reports/queue',require(_0xffa9('0xbd')));_0x5bed37['use'](_0xffa9('0xbe'),require(_0xffa9('0xbf')));_0x5bed37['use']('/api/square/details/reports',require(_0xffa9('0xc0')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xc1'),require('./api/jscriptyProject'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xc2'),require('./api/setting'));_0x5bed37['use']('/api/square/odbc',require(_0xffa9('0xc3')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xc4'),require(_0xffa9('0xc5')));_0x5bed37['use'](_0xffa9('0xc6'),require(_0xffa9('0xc7')));_0x5bed37[_0xffa9('0x7')]('/api/square/messages',require(_0xffa9('0xc8')));_0x5bed37[_0xffa9('0x7')]('/api/teams',require('./api/team'));_0x5bed37[_0xffa9('0x7')]('/api/license',require(_0xffa9('0xc9')));_0x5bed37['use']('/api/campaigns',require(_0xffa9('0xca')));_0x5bed37[_0xffa9('0x7')]('/api/migrations',require('./api/migration'));_0x5bed37['use'](_0xffa9('0xcb'),require(_0xffa9('0xcc')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xcd'),require(_0xffa9('0xce')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xcf'),require(_0xffa9('0xd0')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xd1'),require(_0xffa9('0xd2')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xd3'),require(_0xffa9('0xd4')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xd5'),require(_0xffa9('0xd6')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xd7'),require(_0xffa9('0xd8')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xd9'),require(_0xffa9('0xda')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xdb'),require(_0xffa9('0xdc')));_0x5bed37['use'](_0xffa9('0xdd'),require(_0xffa9('0xde')));_0x5bed37[_0xffa9('0x7')]('/api/userProfile/sections',require(_0xffa9('0xdf')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xe0'),require(_0xffa9('0xe1')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xe2'),require(_0xffa9('0xe3')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xe4'),require('./api/whatsappAccount'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xe5'),require(_0xffa9('0xe6')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xe7'),require(_0xffa9('0xe8')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xe9'),require(_0xffa9('0xea')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xeb'),require(_0xffa9('0xec')));_0x5bed37['use'](_0xffa9('0xed'),require('./api/whatsappTransferReport'));_0x5bed37[_0xffa9('0x7')]('/api/whatsapp/queues',require('./api/whatsappQueue'));_0x5bed37['use'](_0xffa9('0xee'),require(_0xffa9('0xef')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xf0'),require('./api/realtime'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xf1'),require('./api/user-setting'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xf2'),require(_0xffa9('0xf3')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xf4'),require('./api/authLocal'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xf5'),require(_0xffa9('0xf6')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xf7'),require(_0xffa9('0xf8')));_0x5bed37[_0xffa9('0x7')]('/api/jira',require(_0xffa9('0xf9')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xfa'),require(_0xffa9('0xfb')));_0x5bed37[_0xffa9('0x7')]('/api/version',require(_0xffa9('0xfc')));_0x5bed37[_0xffa9('0x7')]('/api/system',require('./api/system'));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xfd'),require(_0xffa9('0xfe')));_0x5bed37[_0xffa9('0x7')](_0xffa9('0xff'),require(_0xffa9('0x100')));_0x5bed37['use'](_0xffa9('0x101'),clientSideLogs);_0x5bed37[_0xffa9('0x7')]('/apidoc',express['static'](path[_0xffa9('0x102')](config['root'],_0xffa9('0x103'))));_0x5bed37['use'](_0xffa9('0x104'),express[_0xffa9('0x105')](path['join'](config[_0xffa9('0x106')],'/www')));_0x5bed37['use']('/demo',express['static'](path[_0xffa9('0x102')](config['root'],'/demo')));_0x5bed37['use'](_0xffa9('0x107'),express[_0xffa9('0x105')](path['join'](config[_0xffa9('0x106')],_0xffa9('0x108'),'3.10.1')));_0x5bed37[_0xffa9('0x7')]('/plugins',express[_0xffa9('0x105')](path[_0xffa9('0x102')](config[_0xffa9('0x106')],_0xffa9('0x109'))));_0x5bed37[_0xffa9('0x10a')](_0xffa9('0x10b'))[_0xffa9('0x10c')](errors[0x194]);_0x5bed37[_0xffa9('0x10a')]('/*')[_0xffa9('0x10c')](function(_0x5b3df3,_0x46d0f1){_0x46d0f1[_0xffa9('0x10d')](path[_0xffa9('0x10e')](_0x5bed37[_0xffa9('0x10c')](_0xffa9('0x10f'))+_0xffa9('0x110')));});return _0x5bed37;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index be5e836..4f71bca 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5064=['../api/openchannelInteraction/openchannelInteraction.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/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.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/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailMessage/mailMessage.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/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x5064,0xbe));var _0x4506=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5064[_0x501510];return _0x1e6ee5;};'use strict';var jayson=require(_0x4506('0x0'));var _=require(_0x4506('0x1'));var config=require(_0x4506('0x2'));exports[_0x4506('0x3')]=function(){return new Promise(function(_0x4f549b,_0x3e86c9){var _0x12a55c={};_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x5')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x6')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x7')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x8')));_0x12a55c=_['merge'](_0x12a55c,require(_0x4506('0x9')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0xa')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0xb')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0xc')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require('../api/trunk/trunk.rpc'));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0xd')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require('../api/mailServerIn/mailServerIn.rpc'));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require('../api/mailAccount/mailAccount.rpc'));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require('../api/mailQueue/mailQueue.rpc'));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require('../api/mailInteraction/mailInteraction.rpc'));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0xe')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0xf')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x10')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x11')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require('../api/faxApplication/faxApplication.rpc'));_0x12a55c=_['merge'](_0x12a55c,require(_0x4506('0x12')));_0x12a55c=_['merge'](_0x12a55c,require(_0x4506('0x13')));_0x12a55c=_['merge'](_0x12a55c,require(_0x4506('0x14')));_0x12a55c=_['merge'](_0x12a55c,require(_0x4506('0x15')));_0x12a55c=_['merge'](_0x12a55c,require('../api/smsAccount/smsAccount.rpc'));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x16')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x17')));_0x12a55c=_['merge'](_0x12a55c,require(_0x4506('0x18')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x19')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x1a')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x1b')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x1c')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x1d')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x1e')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x1f')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x20')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x21')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x22')));_0x12a55c=_['merge'](_0x12a55c,require(_0x4506('0x23')));_0x12a55c=_['merge'](_0x12a55c,require(_0x4506('0x24')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x25')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x26')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x27')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x28')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x29')));_0x12a55c=_['merge'](_0x12a55c,require(_0x4506('0x2a')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require('../api/template/template.rpc'));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x2b')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require('../api/variable/variable.rpc'));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x2c')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x2d')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x12a55c=_['merge'](_0x12a55c,require(_0x4506('0x2e')));_0x12a55c=_['merge'](_0x12a55c,require(_0x4506('0x2f')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x30')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x31')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x32')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x33')));_0x12a55c=_['merge'](_0x12a55c,require(_0x4506('0x34')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x35')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require('../api/setting/setting.rpc'));_0x12a55c=_['merge'](_0x12a55c,require(_0x4506('0x36')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x37')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x38')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x39')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require('../api/campaign/campaign.rpc'));_0x12a55c=_['merge'](_0x12a55c,require(_0x4506('0x3a')));_0x12a55c=_['merge'](_0x12a55c,require(_0x4506('0x3b')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x3c')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x3d')));_0x12a55c=_[_0x4506('0x4')](_0x12a55c,require(_0x4506('0x3e')));var _0x567306=jayson[_0x4506('0x3f')](_0x12a55c)[_0x4506('0x40')]();var _0x363c0c=config[_0x4506('0x41')]['port']||config[_0x4506('0x42')]+0x1;var _0x2f1ec9=config[_0x4506('0x41')]['ip']||'localhost';_0x567306['on'](_0x4506('0x43'),function(_0xce17b5){return _0x3e86c9(_0xce17b5);});_0x567306[_0x4506('0x3')](_0x363c0c,_0x2f1ec9,function(){console[_0x4506('0x44')](_0x4506('0x45'),_0x2f1ec9,_0x363c0c);require(_0x4506('0x46'))['default']();return _0x4f549b(_0x4506('0x47')+_0x2f1ec9+':'+_0x363c0c);});});}; \ No newline at end of file +var _0x51f2=['../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','http','rpc','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc'];(function(_0x1254a5,_0x2ba0be){var _0x2fbf81=function(_0x1f5c83){while(--_0x1f5c83){_0x1254a5['push'](_0x1254a5['shift']());}};_0x2fbf81(++_0x2ba0be);}(_0x51f2,0xeb));var _0x251f=function(_0x233cd3,_0x474ec3){_0x233cd3=_0x233cd3-0x0;var _0x19c11a=_0x51f2[_0x233cd3];return _0x19c11a;};'use strict';var jayson=require(_0x251f('0x0'));var _=require(_0x251f('0x1'));var config=require(_0x251f('0x2'));exports[_0x251f('0x3')]=function(){return new Promise(function(_0x2afc7f,_0x243816){var _0x1d0c48={};_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x5')));_0x1d0c48=_['merge'](_0x1d0c48,require(_0x251f('0x6')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x7')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x8')));_0x1d0c48=_['merge'](_0x1d0c48,require(_0x251f('0x9')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0xa')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0xb')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0xc')));_0x1d0c48=_['merge'](_0x1d0c48,require(_0x251f('0xd')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0xe')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0xf')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x10')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x11')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x12')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x13')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/mailApplication/mailApplication.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x14')));_0x1d0c48=_['merge'](_0x1d0c48,require(_0x251f('0x15')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x16')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x17')));_0x1d0c48=_['merge'](_0x1d0c48,require('../api/faxMessage/faxMessage.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x18')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x19')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/smsAccount/smsAccount.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x1a')));_0x1d0c48=_['merge'](_0x1d0c48,require('../api/smsMessage/smsMessage.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x1b')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x1c')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x1d0c48=_['merge'](_0x1d0c48,require(_0x251f('0x1d')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x1d0c48=_['merge'](_0x1d0c48,require(_0x251f('0x1e')));_0x1d0c48=_['merge'](_0x1d0c48,require('../api/chatMessage/chatMessage.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x1f')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/cmContact/cmContact.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x20')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x21')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x22')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x23')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x24')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/pause/pause.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x25')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x26')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x27')));_0x1d0c48=_['merge'](_0x1d0c48,require('../api/trigger/trigger.rpc'));_0x1d0c48=_['merge'](_0x1d0c48,require(_0x251f('0x28')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x29')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x2a')));_0x1d0c48=_['merge'](_0x1d0c48,require(_0x251f('0x2b')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x2c')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x2d')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x2e')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x2f')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x30')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x31')));_0x1d0c48=_['merge'](_0x1d0c48,require(_0x251f('0x32')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x33')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x34')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/squareRecording/squareRecording.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x35')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/campaign/campaign.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/attachment/attachment.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x36')));_0x1d0c48=_['merge'](_0x1d0c48,require(_0x251f('0x37')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x38')));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x1d0c48=_[_0x251f('0x4')](_0x1d0c48,require(_0x251f('0x39')));_0x1d0c48=_['merge'](_0x1d0c48,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x55236a=jayson['server'](_0x1d0c48)[_0x251f('0x3a')]();var _0x3f611b=config[_0x251f('0x3b')][_0x251f('0x3c')]||config[_0x251f('0x3c')]+0x1;var _0x414987=config['rpc']['ip']||_0x251f('0x3d');_0x55236a['on']('error',function(_0x529078){return _0x243816(_0x529078);});_0x55236a['listen'](_0x3f611b,_0x414987,function(){console[_0x251f('0x3e')](_0x251f('0x3f'),_0x414987,_0x3f611b);require(_0x251f('0x40'))[_0x251f('0x41')]();return _0x2afc7f(_0x251f('0x42')+_0x414987+':'+_0x3f611b);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 94c07e1..defe665 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 _0x90c5=['emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','substr','startsWith','split','length','error','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','function','write','inherits','prototype','sendRequest','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','hangup','HANGUP','setVariable','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','replace','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','WAIT','label','exports','events','EventEmitter','./reply','./error','setEncoding','setTimeout','headers','ready'];(function(_0x981d51,_0x2188df){var _0x316681=function(_0x1a21d4){while(--_0x1a21d4){_0x981d51['push'](_0x981d51['shift']());}};_0x316681(++_0x2188df);}(_0x90c5,0x17e));var _0x590c=function(_0x5b96e6,_0x2bb5c9){_0x5b96e6=_0x5b96e6-0x0;var _0x4568fc=_0x90c5[_0x5b96e6];return _0x4568fc;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x590c('0x0'))[_0x590c('0x1')];var AGIReply=require(_0x590c('0x2'));var AGIError=require(_0x590c('0x3'));function AGIChannel(_0x403d9e){var _0x23c93e=this,_0x25fba7=new AGIReply(),_0xb0712d=![],_0x379fc5={};EventEmitter['call'](_0x23c93e);_0x403d9e[_0x590c('0x4')]('utf8');_0x403d9e[_0x590c('0x5')](0x8*0x3c*0x3c*0x3e8);_0x25fba7[_0x590c('0x4')]('utf8');_0x25fba7['on'](_0x590c('0x6'),function(_0x2f2812){for(var _0x47880d in _0x2f2812){_0x23c93e[_0x47880d]=_0x2f2812[_0x47880d];}_0x23c93e['emit'](_0x590c('0x7'));});_0x25fba7['on']('line',function(_0x1a6e96){if(_0x1a6e96['toLowerCase']()=='hangup'){_0x23c93e[_0x590c('0x8')]('hangup');return;}if(_0x1a6e96[_0x590c('0x9')](0x0,0xb)==_0x590c('0xa')){_0xb0712d=!![];}if(_0xb0712d){_0x379fc5['rx']+=_0x1a6e96+'\x0a';if(_0x1a6e96[_0x590c('0xb')](_0x590c('0xc'))!=-0x1){_0xb0712d=![];}}else{_0x379fc5['rx']=_0x1a6e96;}if(_0xb0712d){return;}if(typeof _0x379fc5['cb']=='function'){var _0x31cd51=_0x379fc5['rx'][_0x590c('0x9')](0x0,0x3),_0x4d1d35=null,_0x6e23b1=null;_0x31cd51=parseInt(_0x31cd51);if(isNaN(_0x31cd51)){_0x379fc5['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x590c('0xd')});return;}if(_0x31cd51!=0xc8){_0x379fc5['cb'](null,{'code':_0x31cd51,'result':-0x1,'extra':'KO'});return;}_0x4d1d35=_0x379fc5['rx'][_0x590c('0x9')](0x4)['replace']('result=','');if(_0x4d1d35['indexOf']('\x20')!=-0x1){_0x4d1d35=_0x4d1d35[_0x590c('0xe')](0x0,_0x4d1d35['indexOf']('\x20'));}if(_[_0x590c('0xf')](_0x4d1d35,'-1')){_0x4d1d35=parseInt(_0x4d1d35);}_0x6e23b1=_0x379fc5['rx'][_0x590c('0x10')]('\x20');if(_0x6e23b1[_0x590c('0x11')]==0x3){_0x6e23b1=_0x6e23b1[0x2][_0x590c('0x9')](0x1,_0x6e23b1[0x2][_0x590c('0x11')]-0x1);}else if(_0x6e23b1[_0x590c('0x11')]>0x3){var _0x531bd6=/\((.+)\)/;var _0x1cc806=_0x379fc5['rx']['match'](_0x531bd6);if(_0x1cc806){_0x6e23b1=_0x1cc806[0x1];}else{_0x6e23b1=null;}}else{_0x6e23b1=null;}_0x379fc5['cb'](null,{'code':_0x31cd51,'result':_0x4d1d35,'extra':_0x6e23b1});}});_0x403d9e['on'](_0x590c('0x12'),function(_0x2ce962){_0x23c93e[_0x590c('0x8')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0x2ce962['code']));});_0x403d9e['on']('close',function(){_0x23c93e[_0x590c('0x8')](_0x590c('0x13'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x403d9e['on'](_0x590c('0x14'),function(){_0x23c93e[_0x590c('0x8')](_0x590c('0x14'),new AGIError(_0x590c('0x15')));_0x403d9e[_0x590c('0x16')]();});_0x403d9e[_0x590c('0x17')](_0x25fba7);this[_0x590c('0x18')]=function(_0x5da125,_0x577d6b){var _0x5da125=_0x5da125||'',_0x577d6b=typeof _0x577d6b==_0x590c('0x19')?_0x577d6b:new Function();_0x379fc5={'tx':_0x5da125,'rx':'','cb':_0x577d6b};_0x403d9e[_0x590c('0x1a')](_0x5da125+'\x0a');},this[_0x590c('0x13')]=function(){_0x403d9e[_0x590c('0x16')]();};}util[_0x590c('0x1b')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x3a1d5d){return this[_0x590c('0x18')]['sync'](this,_0x3a1d5d);};AGIChannel[_0x590c('0x1c')]['answer']=function(){return this[_0x590c('0x1d')](_0x590c('0x1e'));};AGIChannel[_0x590c('0x1c')][_0x590c('0x1f')]=function(_0x5499e8,_0x3e29d3,_0x253760){_0x5499e8=_0x5499e8===undefined?_0x590c('0x20'):_0x5499e8;_0x3e29d3=_0x3e29d3===undefined?'5':_0x3e29d3;_0x253760=_0x253760===undefined?'1':_0x253760;return this[_0x590c('0x1d')](util[_0x590c('0x21')](_0x590c('0x22'),_0x5499e8,_0x3e29d3*0x3e8,_0x253760));};AGIChannel[_0x590c('0x1c')][_0x590c('0x23')]=function(_0x4f0d8b){_0x4f0d8b=_0x4f0d8b||_0x590c('0x24');return this['sendRequest'](util[_0x590c('0x21')]('VERBOSE\x20\x22%s\x22',_0x4f0d8b));};AGIChannel[_0x590c('0x1c')][_0x590c('0x25')]=function(_0x32e2f4,_0x28e561){if(_['isArray'](_0x28e561)){return this[_0x590c('0x1d')](util[_0x590c('0x21')](_0x590c('0x26'),_0x32e2f4,_0x28e561[_0x590c('0x27')](',')));}return this[_0x590c('0x1d')](util[_0x590c('0x21')](_0x590c('0x26'),_0x32e2f4,_0x28e561));};AGIChannel['prototype'][_0x590c('0x28')]=function(_0x46485b){return this[_0x590c('0x1d')](util[_0x590c('0x21')](_0x590c('0x29'),_0x46485b));};AGIChannel[_0x590c('0x1c')]['setExtension']=function(_0x8de4e){return this['sendRequest'](util[_0x590c('0x21')](_0x590c('0x2a'),_0x8de4e));};AGIChannel[_0x590c('0x1c')][_0x590c('0x2b')]=function(_0x281da8){return this['sendRequest'](util[_0x590c('0x21')](_0x590c('0x2c'),_0x281da8));};AGIChannel[_0x590c('0x1c')][_0x590c('0x2d')]=function(){return this['sendRequest'](_0x590c('0x2e'));};AGIChannel[_0x590c('0x1c')][_0x590c('0x2f')]=function(_0x16b7c0,_0x341012){var _0x14533b=_['isBoolean'](_0x341012)||_['isNumber'](_0x341012)?_0x341012['toString']():_0x341012;return this[_0x590c('0x1d')](util[_0x590c('0x21')](_0x590c('0x30'),_0x16b7c0,_0x14533b?_0x14533b[_0x590c('0x31')]()[_0x590c('0x32')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x590c('0x1c')]['sayNumber']=function(_0x53c483,_0x95fae2){return this['sendRequest'](util[_0x590c('0x21')]('SAY\x20NUMBER\x20%s\x20%s',_0x53c483,_0x95fae2));};AGIChannel[_0x590c('0x1c')][_0x590c('0x33')]=function(_0xd0ed57,_0x4a4ffa){return this[_0x590c('0x1d')](util['format'](_0x590c('0x34'),_0xd0ed57,_0x4a4ffa));};AGIChannel[_0x590c('0x1c')][_0x590c('0x35')]=function(_0x410bfa,_0x80ac65){return this['sendRequest'](util[_0x590c('0x21')](_0x590c('0x36'),_0x410bfa,_0x80ac65));};AGIChannel['prototype']['continueAt']=function(_0x4bcd29,_0x18f545,_0x21d35c){_0x18f545=_0x18f545||this[_0x590c('0x37')];_0x21d35c=_0x21d35c||0x1;this[_0x590c('0x28')](_0x4bcd29);this['setExtension'](_0x18f545);this['setPriority'](_0x21d35c);return this['noop'](util[_0x590c('0x21')]('GOTO\x20%s\x20%s\x20%s',_0x4bcd29,_0x18f545,_0x21d35c));};AGIChannel[_0x590c('0x1c')]['getVariable']=function(_0x4d03b5){return this[_0x590c('0x1d')](util[_0x590c('0x21')](_0x590c('0x38'),_0x4d03b5));};AGIChannel['prototype'][_0x590c('0x39')]=function(_0x3faff5,_0x5b5f2a,_0x50956b,_0x171c21,_0x1dc62b,_0x417a04){_0x5b5f2a=_0x5b5f2a||_0x590c('0x3a');_0x50956b=_0x50956b||'';_0x171c21=_0x171c21===undefined?-0x1:_0x171c21==='-1'?-0x1:_0x171c21*0x3e8;_0x1dc62b=_0x1dc62b===undefined?'':'s='+_0x1dc62b;_0x417a04=_0x417a04?'BEEP':'';return this[_0x590c('0x1d')](util[_0x590c('0x21')](_0x590c('0x3b'),_0x3faff5,_0x5b5f2a,_0x50956b,_0x171c21,_0x417a04,_0x1dc62b));};AGIChannel[_0x590c('0x1c')][_0x590c('0x3c')]=function(_0x45fe80,_0x230cf3){_0x230cf3=_0x230cf3||'';return this[_0x590c('0x1d')](util[_0x590c('0x21')](_0x590c('0x3d'),_0x45fe80,_0x230cf3));};AGIChannel[_0x590c('0x1c')]['agi']=function(_0x26f113){return this[_0x590c('0x25')]('AGI',_0x26f113);};AGIChannel[_0x590c('0x1c')]['wait']=function(_0x3056f5){return this['exec'](_0x590c('0x3e'),_0x3056f5);};AGIChannel[_0x590c('0x1c')]['error']=function(_0x1c202c,_0x116819){this['noop'](util[_0x590c('0x21')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x1c202c['id'],_0x1c202c[_0x590c('0x3f')],_0x116819));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x590c('0x40')]=AGIChannel; \ No newline at end of file +var _0x3f54=['noop','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','label','exports','util','lodash','events','EventEmitter','./reply','call','utf8','setTimeout','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','inherits','sync','prototype','sendRequest','ANSWER','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext'];(function(_0x5e6515,_0x2954b1){var _0xd33ce2=function(_0x5ce7ea){while(--_0x5ce7ea){_0x5e6515['push'](_0x5e6515['shift']());}};_0xd33ce2(++_0x2954b1);}(_0x3f54,0xe4));var _0x43f5=function(_0x4d0662,_0x145963){_0x4d0662=_0x4d0662-0x0;var _0x6eea6d=_0x3f54[_0x4d0662];return _0x6eea6d;};'use strict';var util=require(_0x43f5('0x0'));var _=require(_0x43f5('0x1'));var EventEmitter=require(_0x43f5('0x2'))[_0x43f5('0x3')];var AGIReply=require(_0x43f5('0x4'));var AGIError=require('./error');function AGIChannel(_0x435c5b){var _0x537da4=this,_0x5bb3d8=new AGIReply(),_0xde8c2d=![],_0x3d4a6a={};EventEmitter[_0x43f5('0x5')](_0x537da4);_0x435c5b['setEncoding'](_0x43f5('0x6'));_0x435c5b[_0x43f5('0x7')](0x8*0x3c*0x3c*0x3e8);_0x5bb3d8['setEncoding'](_0x43f5('0x6'));_0x5bb3d8['on']('headers',function(_0x147b80){for(var _0xa5d6f8 in _0x147b80){_0x537da4[_0xa5d6f8]=_0x147b80[_0xa5d6f8];}_0x537da4[_0x43f5('0x8')](_0x43f5('0x9'));});_0x5bb3d8['on'](_0x43f5('0xa'),function(_0x63a68f){if(_0x63a68f[_0x43f5('0xb')]()==_0x43f5('0xc')){_0x537da4[_0x43f5('0x8')](_0x43f5('0xc'));return;}if(_0x63a68f[_0x43f5('0xd')](0x0,0xb)==_0x43f5('0xe')){_0xde8c2d=!![];}if(_0xde8c2d){_0x3d4a6a['rx']+=_0x63a68f+'\x0a';if(_0x63a68f['search'](_0x43f5('0xf'))!=-0x1){_0xde8c2d=![];}}else{_0x3d4a6a['rx']=_0x63a68f;}if(_0xde8c2d){return;}if(typeof _0x3d4a6a['cb']==_0x43f5('0x10')){var _0x3c9e06=_0x3d4a6a['rx'][_0x43f5('0xd')](0x0,0x3),_0xfc6d32=null,_0x345441=null;_0x3c9e06=parseInt(_0x3c9e06);if(isNaN(_0x3c9e06)){_0x3d4a6a['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x43f5('0x11')});return;}if(_0x3c9e06!=0xc8){_0x3d4a6a['cb'](null,{'code':_0x3c9e06,'result':-0x1,'extra':'KO'});return;}_0xfc6d32=_0x3d4a6a['rx'][_0x43f5('0xd')](0x4)[_0x43f5('0x12')]('result=','');if(_0xfc6d32[_0x43f5('0x13')]('\x20')!=-0x1){_0xfc6d32=_0xfc6d32[_0x43f5('0x14')](0x0,_0xfc6d32['indexOf']('\x20'));}if(_['startsWith'](_0xfc6d32,'-1')){_0xfc6d32=parseInt(_0xfc6d32);}_0x345441=_0x3d4a6a['rx'][_0x43f5('0x15')]('\x20');if(_0x345441[_0x43f5('0x16')]==0x3){_0x345441=_0x345441[0x2][_0x43f5('0xd')](0x1,_0x345441[0x2][_0x43f5('0x16')]-0x1);}else if(_0x345441[_0x43f5('0x16')]>0x3){var _0x2a69e4=/\((.+)\)/;var _0x303580=_0x3d4a6a['rx']['match'](_0x2a69e4);if(_0x303580){_0x345441=_0x303580[0x1];}else{_0x345441=null;}}else{_0x345441=null;}_0x3d4a6a['cb'](null,{'code':_0x3c9e06,'result':_0xfc6d32,'extra':_0x345441});}});_0x435c5b['on']('error',function(_0x48452d){_0x537da4[_0x43f5('0x8')](_0x43f5('0x17'),new AGIError(_0x43f5('0x18'),_0x48452d[_0x43f5('0x19')]));});_0x435c5b['on'](_0x43f5('0x1a'),function(){_0x537da4[_0x43f5('0x8')](_0x43f5('0x1a'),new AGIError(_0x43f5('0x1b')));});_0x435c5b['on'](_0x43f5('0x1c'),function(){_0x537da4['emit']('timeout',new AGIError(_0x43f5('0x1d')));_0x435c5b['destroy']();});_0x435c5b[_0x43f5('0x1e')](_0x5bb3d8);this[_0x43f5('0x1f')]=function(_0x1a9d21,_0x18f7f7){var _0x1a9d21=_0x1a9d21||'',_0x18f7f7=typeof _0x18f7f7==_0x43f5('0x10')?_0x18f7f7:new Function();_0x3d4a6a={'tx':_0x1a9d21,'rx':'','cb':_0x18f7f7};_0x435c5b[_0x43f5('0x20')](_0x1a9d21+'\x0a');},this[_0x43f5('0x1a')]=function(){_0x435c5b[_0x43f5('0x21')]();};}util[_0x43f5('0x22')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x31abd9){return this['command'][_0x43f5('0x23')](this,_0x31abd9);};AGIChannel[_0x43f5('0x24')]['answer']=function(){return this[_0x43f5('0x25')](_0x43f5('0x26'));};AGIChannel['prototype']['getData']=function(_0x5db596,_0x1649e6,_0xbf947d){_0x5db596=_0x5db596===undefined?'beep':_0x5db596;_0x1649e6=_0x1649e6===undefined?'5':_0x1649e6;_0xbf947d=_0xbf947d===undefined?'1':_0xbf947d;return this[_0x43f5('0x25')](util[_0x43f5('0x27')](_0x43f5('0x28'),_0x5db596,_0x1649e6*0x3e8,_0xbf947d));};AGIChannel[_0x43f5('0x24')]['noop']=function(_0x3b56c7){_0x3b56c7=_0x3b56c7||_0x43f5('0x29');return this[_0x43f5('0x25')](util[_0x43f5('0x27')]('VERBOSE\x20\x22%s\x22',_0x3b56c7));};AGIChannel[_0x43f5('0x24')][_0x43f5('0x2a')]=function(_0x1acea9,_0x147a09){if(_[_0x43f5('0x2b')](_0x147a09)){return this[_0x43f5('0x25')](util[_0x43f5('0x27')](_0x43f5('0x2c'),_0x1acea9,_0x147a09[_0x43f5('0x2d')](',')));}return this[_0x43f5('0x25')](util[_0x43f5('0x27')](_0x43f5('0x2c'),_0x1acea9,_0x147a09));};AGIChannel['prototype']['setContext']=function(_0x535a9c){return this[_0x43f5('0x25')](util[_0x43f5('0x27')](_0x43f5('0x2e'),_0x535a9c));};AGIChannel[_0x43f5('0x24')][_0x43f5('0x2f')]=function(_0x4be8f6){return this[_0x43f5('0x25')](util[_0x43f5('0x27')](_0x43f5('0x30'),_0x4be8f6));};AGIChannel['prototype']['setPriority']=function(_0x33333c){return this[_0x43f5('0x25')](util[_0x43f5('0x27')](_0x43f5('0x31'),_0x33333c));};AGIChannel['prototype']['hangup']=function(){return this['sendRequest'](_0x43f5('0x32'));};AGIChannel[_0x43f5('0x24')]['setVariable']=function(_0x170c52,_0x13a83a){var _0x5f07b8=_[_0x43f5('0x33')](_0x13a83a)||_[_0x43f5('0x34')](_0x13a83a)?_0x13a83a[_0x43f5('0x35')]():_0x13a83a;return this[_0x43f5('0x25')](util[_0x43f5('0x27')](_0x43f5('0x36'),_0x170c52,_0x5f07b8?_0x5f07b8['toString']()[_0x43f5('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x43f5('0x24')]['sayNumber']=function(_0x58ed5a,_0x52e390){return this[_0x43f5('0x25')](util[_0x43f5('0x27')]('SAY\x20NUMBER\x20%s\x20%s',_0x58ed5a,_0x52e390));};AGIChannel[_0x43f5('0x24')]['sayDigits']=function(_0x50a4a8,_0x1b4c1d){return this[_0x43f5('0x25')](util[_0x43f5('0x27')](_0x43f5('0x37'),_0x50a4a8,_0x1b4c1d));};AGIChannel[_0x43f5('0x24')][_0x43f5('0x38')]=function(_0xf34407,_0x422fb7){return this['sendRequest'](util[_0x43f5('0x27')](_0x43f5('0x39'),_0xf34407,_0x422fb7));};AGIChannel[_0x43f5('0x24')][_0x43f5('0x3a')]=function(_0x49820e,_0x9bb8cb,_0xcaa0ee){_0x9bb8cb=_0x9bb8cb||this['extension'];_0xcaa0ee=_0xcaa0ee||0x1;this[_0x43f5('0x3b')](_0x49820e);this[_0x43f5('0x2f')](_0x9bb8cb);this['setPriority'](_0xcaa0ee);return this[_0x43f5('0x3c')](util['format']('GOTO\x20%s\x20%s\x20%s',_0x49820e,_0x9bb8cb,_0xcaa0ee));};AGIChannel['prototype']['getVariable']=function(_0x3cdf92){return this[_0x43f5('0x25')](util[_0x43f5('0x27')](_0x43f5('0x3d'),_0x3cdf92));};AGIChannel[_0x43f5('0x24')][_0x43f5('0x3e')]=function(_0x115da5,_0x5173bb,_0x29baaa,_0x224e65,_0x2d7f6b,_0x38bf4f){_0x5173bb=_0x5173bb||_0x43f5('0x3f');_0x29baaa=_0x29baaa||'';_0x224e65=_0x224e65===undefined?-0x1:_0x224e65==='-1'?-0x1:_0x224e65*0x3e8;_0x2d7f6b=_0x2d7f6b===undefined?'':'s='+_0x2d7f6b;_0x38bf4f=_0x38bf4f?_0x43f5('0x40'):'';return this[_0x43f5('0x25')](util[_0x43f5('0x27')](_0x43f5('0x41'),_0x115da5,_0x5173bb,_0x29baaa,_0x224e65,_0x38bf4f,_0x2d7f6b));};AGIChannel[_0x43f5('0x24')]['streamFile']=function(_0x5cb34b,_0x188bd8){_0x188bd8=_0x188bd8||'';return this[_0x43f5('0x25')](util[_0x43f5('0x27')](_0x43f5('0x42'),_0x5cb34b,_0x188bd8));};AGIChannel[_0x43f5('0x24')][_0x43f5('0x43')]=function(_0x23aa43){return this[_0x43f5('0x2a')](_0x43f5('0x44'),_0x23aa43);};AGIChannel['prototype']['wait']=function(_0x88bc22){return this['exec'](_0x43f5('0x45'),_0x88bc22);};AGIChannel['prototype'][_0x43f5('0x17')]=function(_0x57caeb,_0x50988d){this[_0x43f5('0x3c')](util[_0x43f5('0x27')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x57caeb['id'],_0x57caeb[_0x43f5('0x46')],_0x50988d));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x43f5('0x47')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 96db8da..f69cd67 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 _0x9b74=['Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','push','format','apply','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.'];(function(_0x2d00a4,_0x31f8a4){var _0x56d6b1=function(_0x4ba732){while(--_0x4ba732){_0x2d00a4['push'](_0x2d00a4['shift']());}};_0x56d6b1(++_0x31f8a4);}(_0x9b74,0x115));var _0x49b7=function(_0x2e6b54,_0x1539ef){_0x2e6b54=_0x2e6b54-0x0;var _0x491a33=_0x9b74[_0x2e6b54];return _0x491a33;};'use strict';var util=require(_0x49b7('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x49b7('0x1'),'E_AGI_SERVER_ERROR':_0x49b7('0x2'),'E_AGI_SERVER_CLOSE':_0x49b7('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x49b7('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x49b7('0x5'),'E_AGI_SOCKET_ERROR':_0x49b7('0x6'),'E_AGI_SOCKET_CLOSE':_0x49b7('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x49b7('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x49b7('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x46c643){var _0x46c643=_0x46c643||null,_0x47290f=_0x47290f||[],_0x44de83=0x1,_0x1bc3b5='';if(!error[_0x46c643]){_0x46c643='E_AGI_UNDEFINED';}_0x47290f['push'](error[_0x46c643]);while(arguments[_0x44de83]){_0x47290f[_0x49b7('0xa')](arguments[_0x44de83]);_0x44de83++;}_0x1bc3b5=util[_0x49b7('0xb')][_0x49b7('0xc')](util,_0x47290f);this['message']=_0x1bc3b5;this[_0x49b7('0xd')]=_0x46c643;}module[_0x49b7('0xe')]=AGIError; \ No newline at end of file +var _0xd863=['apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format'];(function(_0x5186be,_0x560353){var _0x2b278b=function(_0x66aff6){while(--_0x66aff6){_0x5186be['push'](_0x5186be['shift']());}};_0x2b278b(++_0x560353);}(_0xd863,0x158));var _0x3d86=function(_0x5e1ce9,_0x2fae3e){_0x5e1ce9=_0x5e1ce9-0x0;var _0x41fb67=_0xd863[_0x5e1ce9];return _0x41fb67;};'use strict';var util=require(_0x3d86('0x0'));var error={'E_AGI_UNDEFINED':_0x3d86('0x1'),'E_AGI_ARGUMENT_PORT':_0x3d86('0x2'),'E_AGI_SERVER_ERROR':_0x3d86('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x3d86('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x3d86('0x5'),'E_AGI_SOCKET_ERROR':_0x3d86('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x3d86('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x3d86('0x8'),'E_AGI_IVR_ENTRY':_0x3d86('0x9')};function AGIError(_0x474ed9){var _0x474ed9=_0x474ed9||null,_0x1267bf=_0x1267bf||[],_0x389413=0x1,_0x7b33f6='';if(!error[_0x474ed9]){_0x474ed9=_0x3d86('0xa');}_0x1267bf['push'](error[_0x474ed9]);while(arguments[_0x389413]){_0x1267bf[_0x3d86('0xb')](arguments[_0x389413]);_0x389413++;}_0x7b33f6=util[_0x3d86('0xc')][_0x3d86('0xd')](util,_0x1267bf);this[_0x3d86('0xe')]=_0x7b33f6;this[_0x3d86('0xf')]=_0x474ed9;}module[_0x3d86('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 87b4c34..bdf4f20 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a73=['events','ioredis','../../config/environment','redis','defaults','localhost','subscribe','emit','E_AGI_SERVER_ERROR','parse','projectUpdate','error','lodash'];(function(_0x44adbc,_0x26d05b){var _0x392835=function(_0x14effc){while(--_0x14effc){_0x44adbc['push'](_0x44adbc['shift']());}};_0x392835(++_0x26d05b);}(_0x2a73,0x1ac));var _0x32a7=function(_0x1c756c,_0x168098){_0x1c756c=_0x1c756c-0x0;var _0x404945=_0x2a73[_0x1c756c];return _0x404945;};'use strict';var _=require(_0x32a7('0x0'));var EventEmitter=require(_0x32a7('0x1'))['EventEmitter'];var Redis=require(_0x32a7('0x2'));var AGIError=require('./error');var config=require(_0x32a7('0x3'));config[_0x32a7('0x4')]=_[_0x32a7('0x5')](config[_0x32a7('0x4')],{'host':_0x32a7('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x32a7('0x4')]);sub[_0x32a7('0x7')]('agi',function(_0xc3db53){if(_0xc3db53)return eventEmitter[_0x32a7('0x8')]('error',new AGIError(_0x32a7('0x9'),_0xc3db53));});sub['on']('message',function(_0x572ee2,_0x4f4a45){if(_0x572ee2!=='agi')return;try{var _0x25331e=JSON[_0x32a7('0xa')](_0x4f4a45);eventEmitter['emit'](_0x32a7('0xb'),_0x25331e);}catch(_0x2ac914){eventEmitter['emit'](_0x32a7('0xc'),new AGIError(_0x32a7('0x9'),_0x2ac914));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x8465=['exports','lodash','events','EventEmitter','./error','../../config/environment','redis','localhost','emit','error','message','agi','parse'];(function(_0x44216d,_0x4938a7){var _0xeca523=function(_0x11faf1){while(--_0x11faf1){_0x44216d['push'](_0x44216d['shift']());}};_0xeca523(++_0x4938a7);}(_0x8465,0x1bb));var _0x5846=function(_0x1e1020,_0xd64a27){_0x1e1020=_0x1e1020-0x0;var _0x464719=_0x8465[_0x1e1020];return _0x464719;};'use strict';var _=require(_0x5846('0x0'));var EventEmitter=require(_0x5846('0x1'))[_0x5846('0x2')];var Redis=require('ioredis');var AGIError=require(_0x5846('0x3'));var config=require(_0x5846('0x4'));config[_0x5846('0x5')]=_['defaults'](config[_0x5846('0x5')],{'host':_0x5846('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x5846('0x5')]);sub['subscribe']('agi',function(_0x3bf683){if(_0x3bf683)return eventEmitter[_0x5846('0x7')](_0x5846('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x3bf683));});sub['on'](_0x5846('0x9'),function(_0x83362f,_0x273da){if(_0x83362f!==_0x5846('0xa'))return;try{var _0x5849f3=JSON[_0x5846('0xb')](_0x273da);eventEmitter[_0x5846('0x7')]('projectUpdate',_0x5849f3);}catch(_0x22c8cd){eventEmitter[_0x5846('0x7')](_0x5846('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x22c8cd));}});module[_0x5846('0xc')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 347cbc1..be518db 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 _0xae58=['condition\x20not\x20found','exports','lodash','../../../config/logger','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','size','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','length','condition','split','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach'];(function(_0x1ebcaa,_0x1a902b){var _0x77b9cc=function(_0x584af7){while(--_0x584af7){_0x1ebcaa['push'](_0x1ebcaa['shift']());}};_0x77b9cc(++_0x1a902b);}(_0xae58,0x1a6));var _0x8ae5=function(_0x529296,_0x1a6a23){_0x529296=_0x529296-0x0;var _0x1796bf=_0xae58[_0x529296];return _0x1796bf;};'use strict';var _=require(_0x8ae5('0x0'));var logger=require(_0x8ae5('0x1'))('agi');var verticesWithRetry=[_0x8ae5('0x2'),_0x8ae5('0x3'),_0x8ae5('0x4')];var Graph=function(){this[_0x8ae5('0x5')]={};this[_0x8ae5('0x6')]={};this[_0x8ae5('0x7')]=0x0;};Graph[_0x8ae5('0x8')][_0x8ae5('0x9')]=function(_0x459bb5){this[_0x8ae5('0x5')][_0x459bb5['id']]=_0x459bb5;this[_0x8ae5('0x6')][_0x459bb5['id']]=[];};Graph[_0x8ae5('0x8')][_0x8ae5('0xa')]=function(_0x3c1112,_0x486f99,_0x34dbb8){this[_0x8ae5('0x6')][_0x3c1112][_0x8ae5('0xb')]({'target':_0x486f99,'condition':_0x34dbb8});this['numberOfEdges']+=0x1;};Graph[_0x8ae5('0x8')][_0x8ae5('0xc')]=function(){return _['size'](this[_0x8ae5('0x5')]);};Graph['prototype']['relations']=function(){return this['numberOfEdges'];};Graph[_0x8ae5('0x8')]['getVertex']=function(_0x32a445){return this[_0x8ae5('0x5')][_0x32a445];};Graph[_0x8ae5('0x8')][_0x8ae5('0xd')]=function(_0x4550a4,_0x3e5b45){if(!this[_0x8ae5('0x5')][_0x4550a4]){return logger['info'](_0x8ae5('0xe'));}var _0x2f37ca=_0x3e5b45(this[_0x8ae5('0x5')][_0x4550a4]);if(!_0x2f37ca){return logger[_0x8ae5('0xf')](_0x8ae5('0x10'));}if(this[_0x8ae5('0x6')][_0x4550a4][_0x8ae5('0x11')]===0x0){return logger[_0x8ae5('0xf')]('no\x20edge/s\x20available');}for(var _0x34f3a2=0x0,_0x10bb51=[],_0xd735d6=![];_0x34f3a2\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','find','handleNotFound','production','handleUnpublished','initialize','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','./server','listening','connection','lodash','syncho','../../config/environment','agi','../../config/license/util','./rpc','./project','./events'];(function(_0x20118f,_0x3f692f){var _0x377e8f=function(_0xb665cf){while(--_0xb665cf){_0x20118f['push'](_0x20118f['shift']());}};_0x377e8f(++_0x3f692f);}(_0x925f,0x15a));var _0xf925=function(_0x496997,_0x5a576c){_0x496997=_0x496997-0x0;var _0x3d16b2=_0x925f[_0x496997];return _0x3d16b2;};'use strict';var _=require(_0xf925('0x0'));var syncho=require(_0xf925('0x1'));var util=require('util');var config=require(_0xf925('0x2'));var logger=require('../../config/logger')(_0xf925('0x3'));var utilLicense=require(_0xf925('0x4'));var rpc=require(_0xf925('0x5'));var Project=require(_0xf925('0x6'));var AGIEmitter=require(_0xf925('0x7'))[_0xf925('0x8')];var projects=[];config['agi']=_['defaults'](config[_0xf925('0x3')],{'ip':_0xf925('0x9'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x4637d9){process[_0xf925('0xa')](function(){syncho(function(){try{setChannelVariables(_0x4637d9);agiHandler(_0x4637d9);}catch(_0x48af4c){logger['error'](_0x48af4c['stack']);}});});}function projectUpdateHandler(_0xce94ae){try{var _0x32c7b3=_[_0xf925('0xb')](projects,['id',_0xce94ae['id']]);if(_0x32c7b3>-0x1){if(_0xce94ae[_0xf925('0xc')]===!![]){projects[_0xf925('0xd')](_0x32c7b3,0x1);}else{projects[_0x32c7b3]=_0xce94ae;}}else{projects[_0xf925('0xe')](_0xce94ae);}}catch(_0x4c0935){logger[_0xf925('0xf')](_0x4c0935[_0xf925('0x10')]);}}function listeningHandler(){console['log'](_0xf925('0x11'),config[_0xf925('0x3')][_0xf925('0x12')]);logger['info'](util['format'](_0xf925('0x13'),config['agi']['ip'],config[_0xf925('0x3')]['port']));}function errorHandler(_0x47c772){if(_0x47c772&&_0x47c772[_0xf925('0x14')]&&_0x47c772['message']){logger[_0xf925('0xf')](util[_0xf925('0x15')](_0xf925('0x16'),_0x47c772['name'],_0x47c772[_0xf925('0x17')]));}else{logger[_0xf925('0xf')](util[_0xf925('0x15')](_0xf925('0x18'),_0x47c772[_0xf925('0x10')]));}}function closeHandler(){logger[_0xf925('0x19')](util[_0xf925('0x15')](_0xf925('0x1a'),this[_0xf925('0x1b')],this['calleridname'],this[_0xf925('0x1c')],this[_0xf925('0x1d')],this[_0xf925('0x1e')]));try{createSquareReport(this);}catch(_0xf289d7){logger[_0xf925('0xf')](_0xf289d7[_0xf925('0x10')]);}}function timeoutHandler(){logger[_0xf925('0x19')](util[_0xf925('0x15')](_0xf925('0x1f'),this['arg_1'],this[_0xf925('0x20')],this[_0xf925('0x1c')],this[_0xf925('0x1d')],this['uniqueid']));}function hangupHandler(){logger[_0xf925('0x19')](util[_0xf925('0x15')](_0xf925('0x21'),this[_0xf925('0x1b')],this[_0xf925('0x20')],this['callerid'],this[_0xf925('0x1d')],this[_0xf925('0x1e')]));this[_0xf925('0x22')]=!![];}function createSquareReport(_0x598b04,_0x274f79){rpc[_0xf925('0x23')](_0x598b04)['then'](function(_0xa507b){if(_0x274f79){_0x274f79(null,_0xa507b);}})['catch'](function(_0x5e1ec9){if(_0x274f79){_0x274f79(null,_0x5e1ec9);}});}function setChannelVariables(_0x7e0795){for(var _0x1ae515 in _0x7e0795){if(_0x7e0795[_0xf925('0x24')](_0x1ae515)){if(_0x1ae515[_0xf925('0x25')](_0xf925('0x26'))===0x0){_0x7e0795[_0x1ae515[_0xf925('0x27')](0x4)]=_0x7e0795[_0x1ae515];delete _0x7e0795[_0x1ae515];}}}}function agiHandler(_0x51c1a0){logger[_0xf925('0x28')](_0xf925('0x29'),JSON[_0xf925('0x2a')](_0x51c1a0,null,0x2));logger[_0xf925('0x19')](util[_0xf925('0x15')](_0xf925('0x2b'),_0x51c1a0[_0xf925('0x1b')],_0x51c1a0[_0xf925('0x20')],_0x51c1a0[_0xf925('0x1c')],_0x51c1a0[_0xf925('0x1d')],_0x51c1a0['uniqueid']));_0x51c1a0['on']('error',errorHandler);_0x51c1a0['on'](_0xf925('0x2c'),closeHandler);_0x51c1a0['on']('timeout',timeoutHandler);_0x51c1a0[_0xf925('0x22')]=![];_0x51c1a0['on'](_0xf925('0x2d'),hangupHandler);var _0x1823d8=_[_0xf925('0x2e')](projects,[_0xf925('0x14'),_0x51c1a0[_0xf925('0x1b')]]);if(!_0x1823d8)return Project[_0xf925('0x2f')](_0x51c1a0);if(!_0x1823d8[_0xf925('0x30')])return Project[_0xf925('0x31')](_0x51c1a0);return Project[_0xf925('0x32')](_0x1823d8,_0x51c1a0);}function main(){var _0x362299;return utilLicense['getLicense']()[_0xf925('0x33')](function(_0x9274a2){if(!_0x9274a2)return;if(_0x9274a2[_0xf925('0x34')]){if(_0x9274a2['callysquare']&&_0x9274a2[_0xf925('0x35')]>0x0){logger[_0xf925('0x19')](util[_0xf925('0x15')]('[LICENSE]\x20CHANNELS:\x20%s',_0x9274a2[_0xf925('0x35')]));_0x362299=_0x9274a2[_0xf925('0x35')];}else{logger[_0xf925('0x19')](_0xf925('0x36'));}}else{logger[_0xf925('0x19')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x362299=-0x1;}})[_0xf925('0x33')](function(){return Project[_0xf925('0x37')]();})['then'](function(_0x1b742f){projects=_0x1b742f;return;})['catch'](function(_0x2b96ce){logger[_0xf925('0xf')]('[LICENSE]',_0x2b96ce[_0xf925('0x10')]);})['finally'](function(){var _0x1ab552=require(_0xf925('0x38'))(config[_0xf925('0x3')][_0xf925('0x12')],config[_0xf925('0x3')]['ip'],_0x362299);_0x1ab552['on'](_0xf925('0xf'),errorHandler);_0x1ab552['on'](_0xf925('0x39'),listeningHandler);_0x1ab552['on'](_0xf925('0x3a'),connectionHandler);_0x1ab552['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0xa53f=['getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]','connection','close','lodash','../../config/logger','agi','../../config/license/util','./rpc','./project','defaults','127.0.0.1','projectUpdate','nextTick','error','stack','findIndex','deleted','splice','push','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','stringify','timeout','hangup','find','handleNotFound','production','handleUnpublished'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xa53f,0x10a));var _0xfa53=function(_0x59e533,_0x553f58){_0x59e533=_0x59e533-0x0;var _0x2fe362=_0xa53f[_0x59e533];return _0x2fe362;};'use strict';var _=require(_0xfa53('0x0'));var syncho=require('syncho');var util=require('util');var config=require('../../config/environment');var logger=require(_0xfa53('0x1'))(_0xfa53('0x2'));var utilLicense=require(_0xfa53('0x3'));var rpc=require(_0xfa53('0x4'));var Project=require(_0xfa53('0x5'));var AGIEmitter=require('./events')['EventEmitter'];var projects=[];config[_0xfa53('0x2')]=_[_0xfa53('0x6')](config[_0xfa53('0x2')],{'ip':_0xfa53('0x7'),'port':0x11dd});AGIEmitter['on'](_0xfa53('0x8'),projectUpdateHandler);function connectionHandler(_0x5151a3){process[_0xfa53('0x9')](function(){syncho(function(){try{setChannelVariables(_0x5151a3);agiHandler(_0x5151a3);}catch(_0x5315f5){logger[_0xfa53('0xa')](_0x5315f5[_0xfa53('0xb')]);}});});}function projectUpdateHandler(_0x1494d2){try{var _0x4e501c=_[_0xfa53('0xc')](projects,['id',_0x1494d2['id']]);if(_0x4e501c>-0x1){if(_0x1494d2[_0xfa53('0xd')]===!![]){projects[_0xfa53('0xe')](_0x4e501c,0x1);}else{projects[_0x4e501c]=_0x1494d2;}}else{projects[_0xfa53('0xf')](_0x1494d2);}}catch(_0x5df76c){logger['error'](_0x5df76c['stack']);}}function listeningHandler(){console[_0xfa53('0x10')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0xfa53('0x11')]);logger[_0xfa53('0x12')](util[_0xfa53('0x13')](_0xfa53('0x14'),config[_0xfa53('0x2')]['ip'],config[_0xfa53('0x2')][_0xfa53('0x11')]));}function errorHandler(_0x42ef77){if(_0x42ef77&&_0x42ef77[_0xfa53('0x15')]&&_0x42ef77['message']){logger[_0xfa53('0xa')](util[_0xfa53('0x13')](_0xfa53('0x16'),_0x42ef77[_0xfa53('0x15')],_0x42ef77[_0xfa53('0x17')]));}else{logger['error'](util[_0xfa53('0x13')](_0xfa53('0x18'),_0x42ef77[_0xfa53('0xb')]));}}function closeHandler(){logger[_0xfa53('0x12')](util[_0xfa53('0x13')](_0xfa53('0x19'),this[_0xfa53('0x1a')],this[_0xfa53('0x1b')],this[_0xfa53('0x1c')],this[_0xfa53('0x1d')],this[_0xfa53('0x1e')]));try{createSquareReport(this);}catch(_0x35b982){logger[_0xfa53('0xa')](_0x35b982[_0xfa53('0xb')]);}}function timeoutHandler(){logger['info'](util[_0xfa53('0x13')](_0xfa53('0x1f'),this[_0xfa53('0x1a')],this[_0xfa53('0x1b')],this[_0xfa53('0x1c')],this['dnid'],this[_0xfa53('0x1e')]));}function hangupHandler(){logger[_0xfa53('0x12')](util[_0xfa53('0x13')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xfa53('0x1a')],this[_0xfa53('0x1b')],this[_0xfa53('0x1c')],this[_0xfa53('0x1d')],this[_0xfa53('0x1e')]));this[_0xfa53('0x20')]=!![];}function createSquareReport(_0x577c2e,_0x280654){rpc[_0xfa53('0x21')](_0x577c2e)[_0xfa53('0x22')](function(_0x2e3262){if(_0x280654){_0x280654(null,_0x2e3262);}})[_0xfa53('0x23')](function(_0x90a092){if(_0x280654){_0x280654(null,_0x90a092);}});}function setChannelVariables(_0x29cc7a){for(var _0x3b3c8e in _0x29cc7a){if(_0x29cc7a[_0xfa53('0x24')](_0x3b3c8e)){if(_0x3b3c8e[_0xfa53('0x25')](_0xfa53('0x26'))===0x0){_0x29cc7a[_0x3b3c8e['substring'](0x4)]=_0x29cc7a[_0x3b3c8e];delete _0x29cc7a[_0x3b3c8e];}}}}function agiHandler(_0x4952fe){logger['debug']('variables',JSON[_0xfa53('0x27')](_0x4952fe,null,0x2));logger[_0xfa53('0x12')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4952fe[_0xfa53('0x1a')],_0x4952fe['calleridname'],_0x4952fe['callerid'],_0x4952fe[_0xfa53('0x1d')],_0x4952fe['uniqueid']));_0x4952fe['on'](_0xfa53('0xa'),errorHandler);_0x4952fe['on']('close',closeHandler);_0x4952fe['on'](_0xfa53('0x28'),timeoutHandler);_0x4952fe[_0xfa53('0x20')]=![];_0x4952fe['on'](_0xfa53('0x29'),hangupHandler);var _0x4edb03=_[_0xfa53('0x2a')](projects,['name',_0x4952fe[_0xfa53('0x1a')]]);if(!_0x4edb03)return Project[_0xfa53('0x2b')](_0x4952fe);if(!_0x4edb03[_0xfa53('0x2c')])return Project[_0xfa53('0x2d')](_0x4952fe);return Project['initialize'](_0x4edb03,_0x4952fe);}function main(){var _0x581d0c;return utilLicense[_0xfa53('0x2e')]()[_0xfa53('0x22')](function(_0x3c0c69){if(!_0x3c0c69)return;if(_0x3c0c69['voice']){if(_0x3c0c69['callysquare']&&_0x3c0c69[_0xfa53('0x2f')]>0x0){logger[_0xfa53('0x12')](util[_0xfa53('0x13')](_0xfa53('0x30'),_0x3c0c69['callysquare']));_0x581d0c=_0x3c0c69['callysquare'];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xfa53('0x12')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x581d0c=-0x1;}})[_0xfa53('0x22')](function(){return Project['getAll']();})[_0xfa53('0x22')](function(_0x114a2b){projects=_0x114a2b;return;})[_0xfa53('0x23')](function(_0x34ac83){logger[_0xfa53('0xa')](_0xfa53('0x31'),_0x34ac83[_0xfa53('0xb')]);})['finally'](function(){var _0x47ee90=require('./server')(config[_0xfa53('0x2')][_0xfa53('0x11')],config[_0xfa53('0x2')]['ip'],_0x581d0c);_0x47ee90['on'](_0xfa53('0xa'),errorHandler);_0x47ee90['on']('listening',listeningHandler);_0x47ee90['on'](_0xfa53('0x32'),connectionHandler);_0x47ee90['on'](_0xfa53('0x33'),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 6da536b..1da38f7 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 _0x45db=['bluebird','client','http','request','then','error','message','catch','sendMailMessage','SendMail'];(function(_0x5ddd88,_0x38bed7){var _0x444447=function(_0x863c7a){while(--_0x863c7a){_0x5ddd88['push'](_0x5ddd88['shift']());}};_0x444447(++_0x38bed7);}(_0x45db,0x168));var _0xb45d=function(_0x355e53,_0x27d04c){_0x355e53=_0x355e53-0x0;var _0x3aba3a=_0x45db[_0x355e53];return _0x3aba3a;};'use strict';var BPromise=require(_0xb45d('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xb45d('0x1')][_0xb45d('0x2')]({'port':0x232b});function request(_0x27c184,_0x113189){return new BPromise(function(_0x31958c,_0x3c9226){return client[_0xb45d('0x3')](_0x27c184,_0x113189)[_0xb45d('0x4')](function(_0x56bcbe){if(_0x56bcbe[_0xb45d('0x5')]){return _0x3c9226(_0x56bcbe[_0xb45d('0x5')][_0xb45d('0x6')]);}else{return _0x31958c(_0x56bcbe['result']);}})[_0xb45d('0x7')](function(_0x485c66){return _0x3c9226(_0x485c66);});});}exports[_0xb45d('0x8')]=function(_0x40028f,_0x56095a){return request(_0xb45d('0x9'),{'account':_0x40028f,'message':_0x56095a});}; \ No newline at end of file +var _0x6ecc=['error','message','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request'];(function(_0x5c6071,_0x1fed8a){var _0x45b025=function(_0x311f05){while(--_0x311f05){_0x5c6071['push'](_0x5c6071['shift']());}};_0x45b025(++_0x1fed8a);}(_0x6ecc,0xe1));var _0xc6ec=function(_0x11ccff,_0x508477){_0x11ccff=_0x11ccff-0x0;var _0x10827b=_0x6ecc[_0x11ccff];return _0x10827b;};'use strict';var BPromise=require(_0xc6ec('0x0'));var jayson=require(_0xc6ec('0x1'));var client=jayson[_0xc6ec('0x2')][_0xc6ec('0x3')]({'port':0x232b});function request(_0x345f1d,_0x4eee76){return new BPromise(function(_0x2e679a,_0x2d7cfd){return client[_0xc6ec('0x4')](_0x345f1d,_0x4eee76)['then'](function(_0x2e4823){if(_0x2e4823[_0xc6ec('0x5')]){return _0x2d7cfd(_0x2e4823[_0xc6ec('0x5')][_0xc6ec('0x6')]);}else{return _0x2e679a(_0x2e4823['result']);}})[_0xc6ec('0x7')](function(_0x1dff54){return _0x2d7cfd(_0x1dff54);});});}exports[_0xc6ec('0x8')]=function(_0x185e7e,_0x27c0f8){return request(_0xc6ec('0x9'),{'account':_0x185e7e,'message':_0x27c0f8});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 2d6c3a1..7083e69 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x049e=['traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','evtHangup','response','isUndefined','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','stack','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','close','xml2json','util','../../config/logger','./rpc','./mailRpc','error','agicommand','hasOwnProperty','retry','addVertex','omit','mxCell','length','source','target','addEdge','value','toJson','mxGraphModel','inspect','production','start','debug','root','stringify','format','YYYY-MM-DD\x20HH:mm:ss','info','calleridname','callerid','dnid','uniqueid'];(function(_0x5066ea,_0x345c76){var _0x36a2c8=function(_0x50b43f){while(--_0x50b43f){_0x5066ea['push'](_0x5066ea['shift']());}};_0x36a2c8(++_0x345c76);}(_0x049e,0x1f2));var _0xe049=function(_0xe719ec,_0x5a280e){_0xe719ec=_0xe719ec-0x0;var _0x4842a1=_0x049e[_0xe719ec];return _0x4842a1;};'use strict';var _=require('lodash');var moment=require('moment');var parser=require(_0xe049('0x0'));var util=require(_0xe049('0x1'));var logger=require(_0xe049('0x2'))('agi');var rpc=require(_0xe049('0x3'));var mailRpc=require(_0xe049('0x4'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()['catch'](function(_0x2ec06f){logger[_0xe049('0x5')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x2ec06f['stack']);return[];});}function addVertex(_0x5ea5d3,_0x2a5c06,_0x5b4ce8){_0x2a5c06[_0xe049('0x6')]=_0x5b4ce8;if(_0x2a5c06[_0xe049('0x7')](_0xe049('0x8'))){_0x2a5c06['maxRetry']=parseInt(_0x2a5c06[_0xe049('0x8')],0xa);}_0x5ea5d3[_0xe049('0x9')](_[_0xe049('0xa')](_0x2a5c06,_0xe049('0xb')));}function initGraph(_0x5b6457,_0x37ec3a){var _0x236ef7=new Graph();for(var _0xe539bb in _0x5b6457){if(_0x5b6457['hasOwnProperty'](_0xe539bb)){if(_['isArray'](_0x5b6457[_0xe539bb])){for(var _0x451e1a=0x0;_0x451e1a<_0x5b6457[_0xe539bb][_0xe049('0xc')];_0x451e1a+=0x1){addVertex(_0x236ef7,_0x5b6457[_0xe539bb][_0x451e1a],_0xe539bb);}}else{addVertex(_0x236ef7,_0x5b6457[_0xe539bb],_0xe539bb);}}}for(var _0xa5b00f=0x0;_0xa5b00f<_0x37ec3a[_0xe049('0xc')];_0xa5b00f+=0x1){if(_0x37ec3a[_0xa5b00f][_0xe049('0xd')]&&_0x37ec3a[_0xa5b00f][_0xe049('0xe')]){_0x236ef7[_0xe049('0xf')](_0x37ec3a[_0xa5b00f][_0xe049('0xd')],_0x37ec3a[_0xa5b00f][_0xe049('0xe')],_0x37ec3a[_0xa5b00f][_0xe049('0x10')]);}}return _0x236ef7;}function getRoot(_0x7a8a1b){return parser[_0xe049('0x11')](_0x7a8a1b,{'object':!![]})[_0xe049('0x12')]['root'];}function inspect(_0x5d0abf){return util[_0xe049('0x13')](_0x5d0abf,{'showHidden':![],'depth':null});}function initialize(_0xabcc92,_0x525920){var _0x498373=getRoot(_0xabcc92[_0xe049('0x14')]);if(!_0x498373||!_0x498373[_0xe049('0x15')])return;var _0x565e8e,_0x19a090,_0xfd6a2f;logger[_0xe049('0x16')](_0xe049('0x17'),JSON[_0xe049('0x18')](_0x498373,null,0x2));_0x525920['joinAt']=moment()[_0xe049('0x19')](_0xe049('0x1a'));_0x565e8e=initGraph(_['omit'](_0x498373,_0xe049('0xb')),_0x498373['mxCell']);_0x19a090=new Vertices(_0x525920,rpc,mailRpc);logger[_0xe049('0x1b')](util[_0xe049('0x19')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x525920['arg_1'],_0x525920[_0xe049('0x1c')],_0x525920[_0xe049('0x1d')],_0x525920[_0xe049('0x1e')],_0x525920[_0xe049('0x1f')]));_0x565e8e[_0xe049('0x20')](_0x498373['start']['id'],function(_0x20b79f){try{_0x20b79f=_0x19a090[_0xe049('0x21')](_0x20b79f);logger[_0xe049('0x16')](_0xe049('0x22'),JSON[_0xe049('0x18')](_0x20b79f,null,0x2));if(_0x20b79f[_0xe049('0x6')]===_0xe049('0x23')){logger[_0xe049('0x1b')](_0xe049('0x24'));_0x525920[_0xe049('0x25')]=_0x20b79f[_0xe049('0x25')]||_0x525920['context'];_0x525920[_0xe049('0x26')]=_0x20b79f[_0xe049('0x26')];_0x525920['priority']=_0x20b79f[_0xe049('0x27')]?_0x20b79f['priority']-0x1:0x1;return null;}else if(_0x20b79f&&_0x19a090[_0x20b79f[_0xe049('0x6')]]){_0xfd6a2f=_0x19a090[_0x20b79f[_0xe049('0x6')]](_0x20b79f);logger[_0xe049('0x1b')]('response',JSON[_0xe049('0x18')](_0xfd6a2f,null,0x2));if(_0xfd6a2f&&_0xfd6a2f[_0xe049('0x28')]===AGI_CODE_SUCCESS&&_0xfd6a2f[_0xe049('0x29')]!==AGI_RESULT_ERROR&&!_0x525920[_0xe049('0x2a')]){logger['debug'](_0xe049('0x2b'),inspect(_0xfd6a2f));return _[_0xe049('0x2c')](_0xfd6a2f[_0xe049('0x29')])?null:_0xfd6a2f[_0xe049('0x29')]['toString']();}else{logger['error'](_0xe049('0x2b'),inspect(_0xfd6a2f));return null;}}else{logger['error'](_0xe049('0x2d'));return null;}}catch(_0x58f7bb){logger[_0xe049('0x5')](_0x58f7bb['stack']);return null;}});if(_0x498373['finally']){logger[_0xe049('0x1b')](util[_0xe049('0x19')](_0xe049('0x2e'),_0x525920[_0xe049('0x2f')],_0x525920[_0xe049('0x1c')],_0x525920[_0xe049('0x1d')],_0x525920['dnid'],_0x525920[_0xe049('0x1f')]));_0x565e8e[_0xe049('0x20')](_0x498373['finally']['id'],function(_0x1d2c02){try{_0x1d2c02=_0x19a090[_0xe049('0x21')](_0x1d2c02);logger[_0xe049('0x16')](_0xe049('0x22'),JSON[_0xe049('0x18')](_0x1d2c02,null,0x2));if(_0x1d2c02&&_0x19a090[_0x1d2c02['agicommand']]){_0xfd6a2f=_0x19a090[_0x1d2c02['agicommand']](_0x1d2c02);if(_0xfd6a2f){logger[_0xe049('0x16')](_0xe049('0x2b'),inspect(_0xfd6a2f));return _[_0xe049('0x2c')](_0xfd6a2f[_0xe049('0x29')])?null:_0xfd6a2f[_0xe049('0x29')]['toString']();}else{logger[_0xe049('0x5')]('response',inspect(_0xfd6a2f));return null;}}else{logger['error'](_0xe049('0x2d'));return null;}}catch(_0x23c2ce){logger[_0xe049('0x5')](_0x23c2ce[_0xe049('0x30')]);return null;}});}logger['info'](util[_0xe049('0x19')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x525920['arg_1'],_0x525920[_0xe049('0x1c')],_0x525920['callerid'],_0x525920[_0xe049('0x1e')],_0x525920[_0xe049('0x1f')]));logger['info'](util['format'](_0xe049('0x31'),_0x525920[_0xe049('0x25')],_0x525920['extension'],parseInt(_0x525920[_0xe049('0x27')],0xa)+0x1));_0x525920[_0xe049('0x32')](_0x525920[_0xe049('0x25')],_0x525920['extension'],parseInt(_0x525920[_0xe049('0x27')],0xa)+0x1);_0x525920['close']();}function handleNotFound(_0x492c70){logger[_0xe049('0x5')](util[_0xe049('0x19')](_0xe049('0x33'),_0x492c70['arg_1']));_0x492c70['continueAt'](_0x492c70[_0xe049('0x25')],_0x492c70[_0xe049('0x26')],parseInt(_0x492c70['priority'],0xa)+0x1);_0x492c70[_0xe049('0x34')]();}function handleUnpublished(_0x133ac5){logger[_0xe049('0x5')](util[_0xe049('0x19')]('Project\x20%s\x20not\x20published',_0x133ac5[_0xe049('0x2f')]));_0x133ac5[_0xe049('0x32')](_0x133ac5['context'],_0x133ac5[_0xe049('0x26')],parseInt(_0x133ac5['priority'],0xa)+0x1);_0x133ac5[_0xe049('0x34')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xf296=['response','code','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','stack','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','agi','./mailRpc','./graph','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','inspect','start','debug','root','stringify','joinAt','omit','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','clear','vertex','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority'];(function(_0x3ad4c5,_0x3fd451){var _0x2808fd=function(_0x1fd5ab){while(--_0x1fd5ab){_0x3ad4c5['push'](_0x3ad4c5['shift']());}};_0x2808fd(++_0x3fd451);}(_0xf296,0x91));var _0x6f29=function(_0x2fb28c,_0x458fc5){_0x2fb28c=_0x2fb28c-0x0;var _0x22ee82=_0xf296[_0x2fb28c];return _0x22ee82;};'use strict';var _=require(_0x6f29('0x0'));var moment=require(_0x6f29('0x1'));var parser=require(_0x6f29('0x2'));var util=require(_0x6f29('0x3'));var logger=require('../../config/logger')(_0x6f29('0x4'));var rpc=require('./rpc');var mailRpc=require(_0x6f29('0x5'));var Graph=require(_0x6f29('0x6'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x6f29('0x7')]()[_0x6f29('0x8')](function(_0x4a66e3){logger[_0x6f29('0x9')](_0x6f29('0xa'),_0x4a66e3['stack']);return[];});}function addVertex(_0x18f0fb,_0x4e283b,_0x3263d7){_0x4e283b[_0x6f29('0xb')]=_0x3263d7;if(_0x4e283b[_0x6f29('0xc')](_0x6f29('0xd'))){_0x4e283b[_0x6f29('0xe')]=parseInt(_0x4e283b[_0x6f29('0xd')],0xa);}_0x18f0fb[_0x6f29('0xf')](_['omit'](_0x4e283b,_0x6f29('0x10')));}function initGraph(_0x29b875,_0x32c43c){var _0x31af3f=new Graph();for(var _0x459817 in _0x29b875){if(_0x29b875[_0x6f29('0xc')](_0x459817)){if(_[_0x6f29('0x11')](_0x29b875[_0x459817])){for(var _0x28e8a8=0x0;_0x28e8a8<_0x29b875[_0x459817][_0x6f29('0x12')];_0x28e8a8+=0x1){addVertex(_0x31af3f,_0x29b875[_0x459817][_0x28e8a8],_0x459817);}}else{addVertex(_0x31af3f,_0x29b875[_0x459817],_0x459817);}}}for(var _0x5b9704=0x0;_0x5b9704<_0x32c43c[_0x6f29('0x12')];_0x5b9704+=0x1){if(_0x32c43c[_0x5b9704][_0x6f29('0x13')]&&_0x32c43c[_0x5b9704][_0x6f29('0x14')]){_0x31af3f[_0x6f29('0x15')](_0x32c43c[_0x5b9704]['source'],_0x32c43c[_0x5b9704]['target'],_0x32c43c[_0x5b9704][_0x6f29('0x16')]);}}return _0x31af3f;}function getRoot(_0x27cc81){return parser[_0x6f29('0x17')](_0x27cc81,{'object':!![]})[_0x6f29('0x18')]['root'];}function inspect(_0x3eca82){return util[_0x6f29('0x19')](_0x3eca82,{'showHidden':![],'depth':null});}function initialize(_0x300466,_0x19b355){var _0x1af1c9=getRoot(_0x300466['production']);if(!_0x1af1c9||!_0x1af1c9[_0x6f29('0x1a')])return;var _0x37e240,_0x36171e,_0x4f7651;logger[_0x6f29('0x1b')](_0x6f29('0x1c'),JSON[_0x6f29('0x1d')](_0x1af1c9,null,0x2));_0x19b355[_0x6f29('0x1e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x37e240=initGraph(_[_0x6f29('0x1f')](_0x1af1c9,_0x6f29('0x10')),_0x1af1c9[_0x6f29('0x10')]);_0x36171e=new Vertices(_0x19b355,rpc,mailRpc);logger['info'](util[_0x6f29('0x20')](_0x6f29('0x21'),_0x19b355[_0x6f29('0x22')],_0x19b355[_0x6f29('0x23')],_0x19b355[_0x6f29('0x24')],_0x19b355[_0x6f29('0x25')],_0x19b355[_0x6f29('0x26')]));_0x37e240['traverseBFS'](_0x1af1c9['start']['id'],function(_0x122076){try{_0x122076=_0x36171e[_0x6f29('0x27')](_0x122076);logger[_0x6f29('0x1b')](_0x6f29('0x28'),JSON[_0x6f29('0x1d')](_0x122076,null,0x2));if(_0x122076[_0x6f29('0xb')]===_0x6f29('0x29')){logger[_0x6f29('0x2a')](_0x6f29('0x2b'));_0x19b355[_0x6f29('0x2c')]=_0x122076['context']||_0x19b355[_0x6f29('0x2c')];_0x19b355[_0x6f29('0x2d')]=_0x122076['extension'];_0x19b355[_0x6f29('0x2e')]=_0x122076[_0x6f29('0x2e')]?_0x122076[_0x6f29('0x2e')]-0x1:0x1;return null;}else if(_0x122076&&_0x36171e[_0x122076[_0x6f29('0xb')]]){_0x4f7651=_0x36171e[_0x122076[_0x6f29('0xb')]](_0x122076);logger[_0x6f29('0x2a')](_0x6f29('0x2f'),JSON[_0x6f29('0x1d')](_0x4f7651,null,0x2));if(_0x4f7651&&_0x4f7651[_0x6f29('0x30')]===AGI_CODE_SUCCESS&&_0x4f7651[_0x6f29('0x31')]!==AGI_RESULT_ERROR&&!_0x19b355[_0x6f29('0x32')]){logger[_0x6f29('0x1b')](_0x6f29('0x2f'),inspect(_0x4f7651));return _[_0x6f29('0x33')](_0x4f7651['result'])?null:_0x4f7651['result'][_0x6f29('0x34')]();}else{logger[_0x6f29('0x9')](_0x6f29('0x2f'),inspect(_0x4f7651));return null;}}else{logger[_0x6f29('0x9')](_0x6f29('0x35'));return null;}}catch(_0x46817c){logger['error'](_0x46817c[_0x6f29('0x36')]);return null;}});if(_0x1af1c9[_0x6f29('0x37')]){logger[_0x6f29('0x2a')](util[_0x6f29('0x20')](_0x6f29('0x38'),_0x19b355['arg_1'],_0x19b355[_0x6f29('0x23')],_0x19b355[_0x6f29('0x24')],_0x19b355[_0x6f29('0x25')],_0x19b355[_0x6f29('0x26')]));_0x37e240[_0x6f29('0x39')](_0x1af1c9['finally']['id'],function(_0x4a6ce7){try{_0x4a6ce7=_0x36171e['clear'](_0x4a6ce7);logger[_0x6f29('0x1b')](_0x6f29('0x28'),JSON[_0x6f29('0x1d')](_0x4a6ce7,null,0x2));if(_0x4a6ce7&&_0x36171e[_0x4a6ce7['agicommand']]){_0x4f7651=_0x36171e[_0x4a6ce7[_0x6f29('0xb')]](_0x4a6ce7);if(_0x4f7651){logger[_0x6f29('0x1b')](_0x6f29('0x2f'),inspect(_0x4f7651));return _['isUndefined'](_0x4f7651['result'])?null:_0x4f7651[_0x6f29('0x31')]['toString']();}else{logger[_0x6f29('0x9')](_0x6f29('0x2f'),inspect(_0x4f7651));return null;}}else{logger[_0x6f29('0x9')](_0x6f29('0x35'));return null;}}catch(_0x4067bc){logger[_0x6f29('0x9')](_0x4067bc[_0x6f29('0x36')]);return null;}});}logger[_0x6f29('0x2a')](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x19b355['arg_1'],_0x19b355[_0x6f29('0x23')],_0x19b355[_0x6f29('0x24')],_0x19b355[_0x6f29('0x25')],_0x19b355[_0x6f29('0x26')]));logger[_0x6f29('0x2a')](util[_0x6f29('0x20')](_0x6f29('0x3a'),_0x19b355[_0x6f29('0x2c')],_0x19b355[_0x6f29('0x2d')],parseInt(_0x19b355[_0x6f29('0x2e')],0xa)+0x1));_0x19b355[_0x6f29('0x3b')](_0x19b355[_0x6f29('0x2c')],_0x19b355[_0x6f29('0x2d')],parseInt(_0x19b355[_0x6f29('0x2e')],0xa)+0x1);_0x19b355[_0x6f29('0x3c')]();}function handleNotFound(_0x4aff0d){logger['error'](util['format'](_0x6f29('0x3d'),_0x4aff0d[_0x6f29('0x22')]));_0x4aff0d[_0x6f29('0x3b')](_0x4aff0d['context'],_0x4aff0d[_0x6f29('0x2d')],parseInt(_0x4aff0d[_0x6f29('0x2e')],0xa)+0x1);_0x4aff0d[_0x6f29('0x3c')]();}function handleUnpublished(_0x132fff){logger[_0x6f29('0x9')](util[_0x6f29('0x20')](_0x6f29('0x3e'),_0x132fff['arg_1']));_0x132fff['continueAt'](_0x132fff['context'],_0x132fff['extension'],parseInt(_0x132fff[_0x6f29('0x2e')],0xa)+0x1);_0x132fff[_0x6f29('0x3c')]();}module[_0x6f29('0x3f')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index a0d2810..1bff09c 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 _0x8c98=['\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','emit','headers','line','exports','call','_localBuffer','_inBody','inherits','prototype'];(function(_0x34e485,_0x45a486){var _0x56e7bf=function(_0x1e470e){while(--_0x1e470e){_0x34e485['push'](_0x34e485['shift']());}};_0x56e7bf(++_0x45a486);}(_0x8c98,0x193));var _0x88c9=function(_0x53278e,_0x2da932){_0x53278e=_0x53278e-0x0;var _0x5434dc=_0x8c98[_0x53278e];return _0x5434dc;};'use strict';var util=require('util');var Transform=require('stream')['Transform'];function AGIReply(_0x208cf6){Transform[_0x88c9('0x0')](this,_0x208cf6);this[_0x88c9('0x1')]='';this[_0x88c9('0x2')]=![];}util[_0x88c9('0x3')](AGIReply,Transform);AGIReply[_0x88c9('0x4')]['_transform']=function(_0x3fca09,_0x27dd35,_0x11dbd9){var _0x1c67a9='\x0a',_0x5e6d2b=['\x0a\x0a',_0x88c9('0x5')],_0x4d2129=-0x1,_0x412a34=-0x1,_0x4eb38b='',_0x379c0c=0x0,_0x5ed22a='',_0x22ba63='';this[_0x88c9('0x1')]+=_0x3fca09[_0x88c9('0x6')]();_0x5ed22a=this['_localBuffer'];if(!this[_0x88c9('0x2')]){_0x379c0c=0x0;while(_0x5e6d2b[_0x379c0c]){while((_0x412a34=_0x5ed22a[_0x88c9('0x7')](_0x5e6d2b[_0x379c0c]))!=-0x1){_0x4eb38b=_0x5e6d2b[_0x379c0c];_0x22ba63=_0x5ed22a[_0x88c9('0x8')](0x0,_0x412a34);_0x5ed22a=_0x5ed22a[_0x88c9('0x8')](_0x412a34+_0x4eb38b[_0x88c9('0x9')]);var _0x1ccabf=_0x22ba63[_0x88c9('0xa')](_0x1c67a9),_0x4c06cc=0x0,_0xd04035={},_0xa5bd2='',_0x51c806='',_0x331907=-0x1;while(_0x1ccabf[_0x4c06cc]){_0x331907=_0x1ccabf[_0x4c06cc][_0x88c9('0x7')](':');if(_0x331907!=-0x1){_0xa5bd2=_0x1ccabf[_0x4c06cc][_0x88c9('0xb')](0x0,_0x331907)['trim']();_0x51c806=_0x1ccabf[_0x4c06cc][_0x88c9('0xb')](_0x331907+0x1)[_0x88c9('0xc')]();if(_0xa5bd2[_0x88c9('0x9')]>0x0){_0xd04035[_0xa5bd2]=_0x51c806;}}else{}_0x4c06cc++;}this[_0x88c9('0xd')](_0x88c9('0xe'),_0xd04035);this[_0x88c9('0x2')]=!![];}_0x379c0c++;}this[_0x88c9('0x1')]=_0x5ed22a;}else{while((_0x4d2129=_0x5ed22a[_0x88c9('0x7')](_0x1c67a9))!=-0x1){_0x22ba63=_0x5ed22a[_0x88c9('0x8')](0x0,_0x4d2129);this[_0x88c9('0xd')](_0x88c9('0xf'),_0x22ba63);_0x5ed22a=_0x5ed22a[_0x88c9('0x8')](_0x4d2129+_0x1c67a9['length']);}this[_0x88c9('0x1')]=_0x5ed22a;}_0x11dbd9();};module[_0x88c9('0x10')]=AGIReply; \ No newline at end of file +var _0x3f2b=['split','slice','trim','emit','line','exports','util','Transform','call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','length'];(function(_0x4286c3,_0xf41590){var _0x3520d2=function(_0x10dbd3){while(--_0x10dbd3){_0x4286c3['push'](_0x4286c3['shift']());}};_0x3520d2(++_0xf41590);}(_0x3f2b,0x1f4));var _0xb3f2=function(_0x27a0bf,_0x261918){_0x27a0bf=_0x27a0bf-0x0;var _0x33249f=_0x3f2b[_0x27a0bf];return _0x33249f;};'use strict';var util=require(_0xb3f2('0x0'));var Transform=require('stream')[_0xb3f2('0x1')];function AGIReply(_0x41e901){Transform[_0xb3f2('0x2')](this,_0x41e901);this['_localBuffer']='';this[_0xb3f2('0x3')]=![];}util[_0xb3f2('0x4')](AGIReply,Transform);AGIReply[_0xb3f2('0x5')][_0xb3f2('0x6')]=function(_0x4dc3f6,_0x58de6b,_0x4e3265){var _0x1be817='\x0a',_0x341b53=['\x0a\x0a',_0xb3f2('0x7')],_0x5f4564=-0x1,_0x2bbf7f=-0x1,_0x35e243='',_0x388539=0x0,_0x326c40='',_0x39fb4d='';this[_0xb3f2('0x8')]+=_0x4dc3f6[_0xb3f2('0x9')]();_0x326c40=this['_localBuffer'];if(!this[_0xb3f2('0x3')]){_0x388539=0x0;while(_0x341b53[_0x388539]){while((_0x2bbf7f=_0x326c40[_0xb3f2('0xa')](_0x341b53[_0x388539]))!=-0x1){_0x35e243=_0x341b53[_0x388539];_0x39fb4d=_0x326c40[_0xb3f2('0xb')](0x0,_0x2bbf7f);_0x326c40=_0x326c40[_0xb3f2('0xb')](_0x2bbf7f+_0x35e243[_0xb3f2('0xc')]);var _0x388edc=_0x39fb4d[_0xb3f2('0xd')](_0x1be817),_0x4fa00e=0x0,_0x4561e1={},_0x10bd9c='',_0x1fc7cf='',_0x14e3ec=-0x1;while(_0x388edc[_0x4fa00e]){_0x14e3ec=_0x388edc[_0x4fa00e][_0xb3f2('0xa')](':');if(_0x14e3ec!=-0x1){_0x10bd9c=_0x388edc[_0x4fa00e][_0xb3f2('0xe')](0x0,_0x14e3ec)[_0xb3f2('0xf')]();_0x1fc7cf=_0x388edc[_0x4fa00e]['slice'](_0x14e3ec+0x1)['trim']();if(_0x10bd9c['length']>0x0){_0x4561e1[_0x10bd9c]=_0x1fc7cf;}}else{}_0x4fa00e++;}this[_0xb3f2('0x10')]('headers',_0x4561e1);this[_0xb3f2('0x3')]=!![];}_0x388539++;}this['_localBuffer']=_0x326c40;}else{while((_0x5f4564=_0x326c40[_0xb3f2('0xa')](_0x1be817))!=-0x1){_0x39fb4d=_0x326c40[_0xb3f2('0xb')](0x0,_0x5f4564);this[_0xb3f2('0x10')](_0xb3f2('0x11'),_0x39fb4d);_0x326c40=_0x326c40[_0xb3f2('0xb')](_0x5f4564+_0x1be817[_0xb3f2('0xc')]);}this[_0xb3f2('0x8')]=_0x326c40;}_0x4e3265();};module[_0xb3f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 767502e..89e19fb 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 _0x4a9c=['Smtp','CloudProvider','email','getVariableById','ShowVariable','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','createCmContact','ListId','then','getPauseById','agentLogin','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','request','error','message','result','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut'];(function(_0x1881a1,_0x2462b9){var _0x5d3ffd=function(_0x1e0138){while(--_0x1e0138){_0x1881a1['push'](_0x1881a1['shift']());}};_0x5d3ffd(++_0x2462b9);}(_0x4a9c,0xcc));var _0xc4a9=function(_0x4610d1,_0x5ac26b){_0x4610d1=_0x4610d1-0x0;var _0x3d4643=_0x4a9c[_0x4610d1];return _0x3d4643;};'use strict';var _=require(_0xc4a9('0x0'));var moment=require(_0xc4a9('0x1'));var jayson=require(_0xc4a9('0x2'));var client=jayson[_0xc4a9('0x3')][_0xc4a9('0x4')]({'port':0x2329});function request(_0x347450,_0x552cfa){return new Promise(function(_0x282978,_0x935998){return client[_0xc4a9('0x5')](_0x347450,_0x552cfa)['then'](function(_0x55527c){if(_0x55527c[_0xc4a9('0x6')]){return _0x935998(_0x55527c[_0xc4a9('0x6')][_0xc4a9('0x7')]);}else{return _0x282978(_0x55527c[_0xc4a9('0x8')]);}})['catch'](function(_0x2853c8){return _0x935998(_0x2853c8);});});}exports['getSquareProjects']=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0xc4a9('0x9'),_0xc4a9('0xa')]}});};exports[_0xc4a9('0xb')]=function(_0x44feae){return request(_0xc4a9('0xc'),{'options':{'raw':![],'where':{'name':_0x44feae},'attributes':[_0xc4a9('0xa')]}});};exports[_0xc4a9('0xd')]=function(_0x3ddfc4){return request(_0xc4a9('0xe'),{'options':{'raw':![],'where':{'id':_0x3ddfc4},'include':[{'model':_0xc4a9('0xf'),'as':_0xc4a9('0x10'),'include':[{'model':'CloudProvider','as':_0xc4a9('0x11')}]}],'attributes':['id',_0xc4a9('0x9'),_0xc4a9('0x12')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x1fd30f){return request(_0xc4a9('0xc'),{'options':{'where':{'id':_0x1fd30f},'attributes':['name']}});};exports['getVoiceQueueById']=function(_0x805c71){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x805c71},'attributes':[_0xc4a9('0x9')]}});};exports[_0xc4a9('0x13')]=function(_0x3a955e){return request(_0xc4a9('0x14'),{'options':{'where':{'id':_0x3a955e},'attributes':[_0xc4a9('0x9')]}});};exports['getSquareOdbcById']=function(_0xaaecf0){return request('ShowSquareOdbc',{'options':{'where':{'id':_0xaaecf0},'attributes':['dsn']}});};exports['getUserById']=function(_0x3a3d5c){return request(_0xc4a9('0x15'),{'options':{'where':{'id':_0x3a3d5c},'attributes':['name']}});};exports[_0xc4a9('0x16')]=function(_0x48912e){return request(_0xc4a9('0x17'),{'options':{'where':{'phone':_0x48912e[_0xc4a9('0x18')]},'attributes':['id']}});};exports[_0xc4a9('0x19')]=function(_0x4eec0e){return request(_0xc4a9('0x1a'),{'options':{'where':{'id':_0x4eec0e},'attributes':[_0xc4a9('0x9')]}});};exports[_0xc4a9('0x1b')]=function(_0x344a1c){return request(_0xc4a9('0x1c'),{'options':{'where':{'id':_0x344a1c},'attributes':['save_name']}});};exports[_0xc4a9('0x1d')]=function(_0x4f5512){return request(_0xc4a9('0x1e'),{'options':{'raw':![],'where':{'id':_0x4f5512},'include':[{'model':_0xc4a9('0x1f'),'as':_0xc4a9('0x20')}]}});};exports[_0xc4a9('0x21')]=function(_0x56dc6b){return request(_0xc4a9('0x22'),{'options':{'where':{'id':_0x56dc6b},'attributes':['id',_0xc4a9('0x9')]}});};exports['createSmsMessage']=function(_0x3893ed){return request(_0xc4a9('0x23'),{'body':_0x3893ed});};exports['createSquareDetailsReport']=function(_0x127e17){return request(_0xc4a9('0x24'),{'body':_0x127e17});};exports['createSquareReport']=function(_0x56a436){return request(_0xc4a9('0x25'),{'body':_[_0xc4a9('0x26')](_0x56a436,{'project_name':_0x56a436[_0xc4a9('0x27')],'prev_project_name':_0x56a436[_0xc4a9('0x28')]||'','is_subproject':_0x56a436[_0xc4a9('0x28')]?!![]:![],'leaveAt':moment()[_0xc4a9('0x29')](_0xc4a9('0x2a'))})});};exports[_0xc4a9('0x2b')]=function(_0x5b20e4){return request('CreateSquareRecording',{'body':_0x5b20e4});};exports[_0xc4a9('0x2c')]=function(_0xa31b6f){return request('CreateSquareMessage',{'body':_0xa31b6f});};exports[_0xc4a9('0x2d')]=function(_0x36885c){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x36885c['phone'],'ListId':_0x36885c[_0xc4a9('0x2e')]}}})[_0xc4a9('0x2f')](function(_0x2b3967){if(_0x2b3967){return _0x2b3967;}return request('CreateCmContact',{'body':_0x36885c});});};exports[_0xc4a9('0x30')]=function(_0x1f30f3){return request('ShowPause',{'options':{'where':{'id':_0x1f30f3},'attributes':[_0xc4a9('0x9')]}});};exports[_0xc4a9('0x31')]=function(_0xa71c6f,_0xfe73f8){return request('LoginUser',{'body':{'interface':_0xfe73f8},'options':{'where':_0xa71c6f}});};exports['agentPause']=function(_0x43349f,_0x56af7f,_0x58981a){return request(_0xc4a9('0x32'),{'body':{'type':_0x56af7f,'uniqueid':_0x58981a},'options':{'where':_0x43349f}});};exports[_0xc4a9('0x33')]=function(_0x59cf52){return request(_0xc4a9('0x34'),{'body':{},'options':{'where':_0x59cf52}});};exports[_0xc4a9('0x35')]=function(_0x5dae13){return request(_0xc4a9('0x36'),{'body':{},'options':{'where':_0x5dae13}});}; \ No newline at end of file +var _0x7a08=['getTrunkById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','http','request','then','error','message','catch','getSquareProjects','GetSquareProjects','name','ShowSquareProject','production','getMailAccountById','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','phone'];(function(_0x36f243,_0x188505){var _0x426436=function(_0x1c8622){while(--_0x1c8622){_0x36f243['push'](_0x36f243['shift']());}};_0x426436(++_0x188505);}(_0x7a08,0x11e));var _0x87a0=function(_0x45dd0e,_0x28e603){_0x45dd0e=_0x45dd0e-0x0;var _0x50e5ca=_0x7a08[_0x45dd0e];return _0x50e5ca;};'use strict';var _=require(_0x87a0('0x0'));var moment=require(_0x87a0('0x1'));var jayson=require('jayson/promise');var client=jayson['client'][_0x87a0('0x2')]({'port':0x2329});function request(_0x5e6791,_0x1b3e4d){return new Promise(function(_0x8fd36d,_0x28c28f){return client[_0x87a0('0x3')](_0x5e6791,_0x1b3e4d)[_0x87a0('0x4')](function(_0x3c26e2){if(_0x3c26e2[_0x87a0('0x5')]){return _0x28c28f(_0x3c26e2[_0x87a0('0x5')][_0x87a0('0x6')]);}else{return _0x8fd36d(_0x3c26e2['result']);}})[_0x87a0('0x7')](function(_0x1bb04b){return _0x28c28f(_0x1bb04b);});});}exports[_0x87a0('0x8')]=function(){return request(_0x87a0('0x9'),{'options':{'raw':![],'attributes':['id',_0x87a0('0xa'),'production']}});};exports['getSquareProject']=function(_0x253737){return request(_0x87a0('0xb'),{'options':{'raw':![],'where':{'name':_0x253737},'attributes':[_0x87a0('0xc')]}});};exports[_0x87a0('0xd')]=function(_0x34ba3a){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x34ba3a},'include':[{'model':_0x87a0('0xe'),'as':_0x87a0('0xf'),'include':[{'model':_0x87a0('0x10'),'as':'CloudProvider'}]}],'attributes':['id',_0x87a0('0xa'),_0x87a0('0x11')],'smtp':!![]}});};exports[_0x87a0('0x12')]=function(_0x45a170){return request('ShowSquareProject',{'options':{'where':{'id':_0x45a170},'attributes':[_0x87a0('0xa')]}});};exports[_0x87a0('0x13')]=function(_0x290a29){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x290a29},'attributes':[_0x87a0('0xa')]}});};exports[_0x87a0('0x14')]=function(_0x3f69f3){return request(_0x87a0('0x15'),{'options':{'where':{'id':_0x3f69f3},'attributes':['name']}});};exports[_0x87a0('0x16')]=function(_0x57a941){return request(_0x87a0('0x17'),{'options':{'where':{'id':_0x57a941},'attributes':[_0x87a0('0x18')]}});};exports[_0x87a0('0x19')]=function(_0x26a72e){return request(_0x87a0('0x1a'),{'options':{'where':{'id':_0x26a72e},'attributes':['name']}});};exports[_0x87a0('0x1b')]=function(_0x57bf72){return request('GetContactByPhone',{'options':{'where':{'phone':_0x57bf72[_0x87a0('0x1c')]},'attributes':['id']}});};exports[_0x87a0('0x1d')]=function(_0x2a42ea){return request('ShowTrunk',{'options':{'where':{'id':_0x2a42ea},'attributes':[_0x87a0('0xa')]}});};exports['getSoundById']=function(_0x5a2c23){return request(_0x87a0('0x1e'),{'options':{'where':{'id':_0x5a2c23},'attributes':[_0x87a0('0x1f')]}});};exports[_0x87a0('0x20')]=function(_0x390bb2){return request(_0x87a0('0x21'),{'options':{'raw':![],'where':{'id':_0x390bb2},'include':[{'model':_0x87a0('0x22'),'as':'Intervals'}]}});};exports[_0x87a0('0x23')]=function(_0x1f59f7){return request('ShowSmsAccount',{'options':{'where':{'id':_0x1f59f7},'attributes':['id',_0x87a0('0xa')]}});};exports[_0x87a0('0x24')]=function(_0x48dfe2){return request(_0x87a0('0x25'),{'body':_0x48dfe2});};exports['createSquareDetailsReport']=function(_0x152ae5){return request(_0x87a0('0x26'),{'body':_0x152ae5});};exports[_0x87a0('0x27')]=function(_0x39ef35){return request(_0x87a0('0x28'),{'body':_[_0x87a0('0x29')](_0x39ef35,{'project_name':_0x39ef35[_0x87a0('0x2a')],'prev_project_name':_0x39ef35[_0x87a0('0x2b')]||'','is_subproject':_0x39ef35[_0x87a0('0x2b')]?!![]:![],'leaveAt':moment()[_0x87a0('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x87a0('0x2d')]=function(_0x15f0f1){return request(_0x87a0('0x2e'),{'body':_0x15f0f1});};exports[_0x87a0('0x2f')]=function(_0x17ee9e){return request(_0x87a0('0x30'),{'body':_0x17ee9e});};exports[_0x87a0('0x31')]=function(_0x55dbf7){return request(_0x87a0('0x32'),{'options':{'raw':![],'where':{'phone':_0x55dbf7[_0x87a0('0x1c')],'ListId':_0x55dbf7[_0x87a0('0x33')]}}})[_0x87a0('0x4')](function(_0x482f6b){if(_0x482f6b){return _0x482f6b;}return request(_0x87a0('0x34'),{'body':_0x55dbf7});});};exports[_0x87a0('0x35')]=function(_0x4c511c){return request(_0x87a0('0x36'),{'options':{'where':{'id':_0x4c511c},'attributes':[_0x87a0('0xa')]}});};exports[_0x87a0('0x37')]=function(_0x50f24d,_0x2f02d1){return request(_0x87a0('0x38'),{'body':{'interface':_0x2f02d1},'options':{'where':_0x50f24d}});};exports[_0x87a0('0x39')]=function(_0x1b3769,_0x40c48a,_0x4b4cf9){return request(_0x87a0('0x3a'),{'body':{'type':_0x40c48a,'uniqueid':_0x4b4cf9},'options':{'where':_0x1b3769}});};exports[_0x87a0('0x3b')]=function(_0x33c335){return request(_0x87a0('0x3c'),{'body':{},'options':{'where':_0x33c335}});};exports[_0x87a0('0x3d')]=function(_0x6710bd){return request(_0x87a0('0x3e'),{'body':{},'options':{'where':_0x6710bd}});}; \ 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 59d490c..73003bb 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 _0x81c6=['./lex'];(function(_0x271c46,_0x1a585d){var _0x234fb6=function(_0x57a01d){while(--_0x57a01d){_0x271c46['push'](_0x271c46['shift']());}};_0x234fb6(++_0x1a585d);}(_0x81c6,0x1d5));var _0x681c=function(_0x421d1f,_0x103891){_0x421d1f=_0x421d1f-0x0;var _0x4228bf=_0x81c6[_0x421d1f];return _0x4228bf;};var polly=require('./polly');var lex=require(_0x681c('0x0'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x7923=['./lex','exports','./polly'];(function(_0x1a014b,_0x48acae){var _0x462258=function(_0x1473be){while(--_0x1473be){_0x1a014b['push'](_0x1a014b['shift']());}};_0x462258(++_0x48acae);}(_0x7923,0x8f));var _0x3792=function(_0x1aa795,_0x7ef1e4){_0x1aa795=_0x1aa795-0x0;var _0x252a82=_0x7923[_0x1aa795];return _0x252a82;};var polly=require(_0x3792('0x0'));var lex=require(_0x3792('0x1'));module[_0x3792('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 83c4c78..1273693 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 _0x55e0=['./lib/api','exports'];(function(_0x505d68,_0xb0de94){var _0x3c17d6=function(_0x2c300b){while(--_0x2c300b){_0x505d68['push'](_0x505d68['shift']());}};_0x3c17d6(++_0xb0de94);}(_0x55e0,0xdc));var _0x055e=function(_0x12f77b,_0x3ef0bd){_0x12f77b=_0x12f77b-0x0;var _0x3eef58=_0x55e0[_0x12f77b];return _0x3eef58;};'use strict';var lex=require(_0x055e('0x0'));module[_0x055e('0x1')]=function(_0x2e09a6,_0x414740,_0x5b82b9,_0x578882,_0x3a2ee6,_0x2d9bd5){return lex(_0x2e09a6,_0x414740,_0x5b82b9,_0x578882,_0x3a2ee6,_0x2d9bd5);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x3d5d4e,_0x33a55d,_0x5527b3,_0x175deb,_0xd002ca,_0x200b2a){return lex(_0x3d5d4e,_0x33a55d,_0x5527b3,_0x175deb,_0xd002ca,_0x200b2a);}; \ 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 7b5c8a2..a1f33a1 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(_0x330101,_0x36cc3e){var _0x56c51a=function(_0x3e6169){while(--_0x3e6169){_0x330101['push'](_0x330101['shift']());}};_0x56c51a(++_0x36cc3e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x401e1d,_0x36973a){var _0x270200=function(_0x369de8){while(--_0x369de8){_0x401e1d['push'](_0x401e1d['shift']());}};_0x270200(++_0x36973a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 24ade55..a25a057 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 _0x102d=['exports','./lib/api'];(function(_0x47895d,_0x44d829){var _0x27223f=function(_0x3cc4c9){while(--_0x3cc4c9){_0x47895d['push'](_0x47895d['shift']());}};_0x27223f(++_0x44d829);}(_0x102d,0x1af));var _0xd102=function(_0xdb8e55,_0x31a538){_0xdb8e55=_0xdb8e55-0x0;var _0x423cfa=_0x102d[_0xdb8e55];return _0x423cfa;};'use strict';var polly=require(_0xd102('0x0'));module[_0xd102('0x1')]=function(_0x3f30f1,_0x53d51e,_0x4fe753,_0x3ac111,_0x40d6ce,_0x3f2e74,_0x4d8e00){return polly(_0x3f30f1,_0x53d51e,_0x4fe753,_0x3ac111,_0x40d6ce,_0x3f2e74,_0x4d8e00);}; \ No newline at end of file +var _0xcffc=['exports','./lib/api'];(function(_0x487fee,_0x35c911){var _0x2d1cab=function(_0x2738dd){while(--_0x2738dd){_0x487fee['push'](_0x487fee['shift']());}};_0x2d1cab(++_0x35c911);}(_0xcffc,0x13f));var _0xccff=function(_0x698023,_0x20f9ce){_0x698023=_0x698023-0x0;var _0x2a7704=_0xcffc[_0x698023];return _0x2a7704;};'use strict';var polly=require(_0xccff('0x0'));module[_0xccff('0x1')]=function(_0x427e37,_0x49d4bb,_0x31fe33,_0x225813,_0x379579,_0x2b0cad,_0x5f03cb){return polly(_0x427e37,_0x49d4bb,_0x31fe33,_0x225813,_0x379579,_0x2b0cad,_0x5f03cb);}; \ 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 7227817..3b793b6 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 _0x8212=['randomstring','aws-sdk','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','text','mp3','path','bluebird'];(function(_0x2aeb07,_0x2229f2){var _0x144b99=function(_0x5a0116){while(--_0x5a0116){_0x2aeb07['push'](_0x2aeb07['shift']());}};_0x144b99(++_0x2229f2);}(_0x8212,0x193));var _0x2821=function(_0x2977fa,_0x1bef01){_0x2977fa=_0x2977fa-0x0;var _0x2a489f=_0x8212[_0x2977fa];return _0x2a489f;};'use strict';var fs=require('fs');var path=require(_0x2821('0x0'));var BPromise=require(_0x2821('0x1'));var rs=require(_0x2821('0x2'));var AWS=require(_0x2821('0x3'));function pollyResult(_0x3343e2,_0x4eaf10,_0x52b7f3){return new BPromise(function(_0x80e6a9,_0x14f9e3){_0x3343e2['synthesizeSpeech'](_0x4eaf10,function(_0x3f88b2,_0x463da7){if(_0x3f88b2){_0x14f9e3(_0x3f88b2);}else if(_0x463da7){if(_0x463da7[_0x2821('0x4')]instanceof Buffer){fs['writeFile'](_0x52b7f3,_0x463da7[_0x2821('0x4')],function(_0xf1a43b){if(_0xf1a43b){_0x14f9e3(_0xf1a43b);}else{_0x80e6a9();}});}else{_0x14f9e3(new Error(_0x2821('0x5')));}}else{_0x14f9e3(new Error(_0x2821('0x6')));}});});}module['exports']=function(_0x5bcf0c,_0x48b697,_0x31f8f9,_0xeb0624,_0x1e5780,_0x407dea,_0xd24886){var _0x7bd76e=new AWS['Polly']({'accessKeyId':_0x5bcf0c,'secretAccessKey':_0x48b697,'region':_0x31f8f9});var _0x176b4a={'Text':_0x1e5780,'TextType':_0x407dea||_0x2821('0x7'),'OutputFormat':_0x2821('0x8'),'VoiceId':_0xeb0624};return pollyResult(_0x7bd76e,_0x176b4a,_0xd24886);}; \ No newline at end of file +var _0x882a=['randomstring','aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','bluebird'];(function(_0x56b2df,_0x123d50){var _0x21206f=function(_0x3ced14){while(--_0x3ced14){_0x56b2df['push'](_0x56b2df['shift']());}};_0x21206f(++_0x123d50);}(_0x882a,0x83));var _0xa882=function(_0x1161df,_0x25b582){_0x1161df=_0x1161df-0x0;var _0x4594cc=_0x882a[_0x1161df];return _0x4594cc;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xa882('0x0'));var rs=require(_0xa882('0x1'));var AWS=require(_0xa882('0x2'));function pollyResult(_0x76c939,_0xa440f7,_0x351b22){return new BPromise(function(_0x55e154,_0x168810){_0x76c939[_0xa882('0x3')](_0xa440f7,function(_0x242841,_0x237bbd){if(_0x242841){_0x168810(_0x242841);}else if(_0x237bbd){if(_0x237bbd['AudioStream']instanceof Buffer){fs[_0xa882('0x4')](_0x351b22,_0x237bbd[_0xa882('0x5')],function(_0x522feb){if(_0x522feb){_0x168810(_0x522feb);}else{_0x55e154();}});}else{_0x168810(new Error(_0xa882('0x6')));}}else{_0x168810(new Error(_0xa882('0x7')));}});});}module[_0xa882('0x8')]=function(_0x3495c6,_0x4c07b5,_0x4f004c,_0x258dd4,_0x4b7f9f,_0x584dde,_0x5a6a9a){var _0x46c78e=new AWS[(_0xa882('0x9'))]({'accessKeyId':_0x3495c6,'secretAccessKey':_0x4c07b5,'region':_0x4f004c});var _0x477260={'Text':_0x4b7f9f,'TextType':_0x584dde||_0xa882('0xa'),'OutputFormat':_0xa882('0xb'),'VoiceId':_0x258dd4};return pollyResult(_0x46c78e,_0x477260,_0x5a6a9a);}; \ 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 010a691..3a8fbc3 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 _0xc853=['./lib/api','exports'];(function(_0x19a9b5,_0x198382){var _0x632733=function(_0x2b4f07){while(--_0x2b4f07){_0x19a9b5['push'](_0x19a9b5['shift']());}};_0x632733(++_0x198382);}(_0xc853,0xd4));var _0x3c85=function(_0x137afb,_0x24e0b1){_0x137afb=_0x137afb-0x0;var _0x25a41c=_0xc853[_0x137afb];return _0x25a41c;};'use strict';var asr=require(_0x3c85('0x0'));module[_0x3c85('0x1')]=function(_0x3f9176,_0x59aeb8,_0x3c7d0d,_0x439ea2){return asr(_0x3f9176,_0x59aeb8,_0x3c7d0d);}; \ No newline at end of file +var _0x080f=['./lib/api'];(function(_0x489fe3,_0x5ebb81){var _0x592190=function(_0x1612a7){while(--_0x1612a7){_0x489fe3['push'](_0x489fe3['shift']());}};_0x592190(++_0x5ebb81);}(_0x080f,0x17f));var _0xf080=function(_0x1eaa79,_0x204f8f){_0x1eaa79=_0x1eaa79-0x0;var _0x448bed=_0x080f[_0x1eaa79];return _0x448bed;};'use strict';var asr=require(_0xf080('0x0'));module['exports']=function(_0x301948,_0x582b28,_0x4e8a77,_0x40829f){return asr(_0x301948,_0x582b28,_0x4e8a77);}; \ 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 a6ba83e..e86ee9e 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 _0x803f=['/v1/speech:recognize?key=','8000','url','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST'];(function(_0x1fe8be,_0x5e7860){var _0x1449bb=function(_0x17b23e){while(--_0x17b23e){_0x1fe8be['push'](_0x1fe8be['shift']());}};_0x1449bb(++_0x5e7860);}(_0x803f,0x64));var _0xf803=function(_0x315934,_0x5b3c25){_0x315934=_0x315934-0x0;var _0xe6d9cf=_0x803f[_0x315934];return _0xe6d9cf;};'use strict';var url=require(_0xf803('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xf803('0x1');module[_0xf803('0x2')]=function(_0x4ce875,_0x1a8691,_0x43fb3b){return new BPromise(function(_0x19ff73,_0x6baafe){var _0x5c2cd6;if(typeof _0x4ce875!=='string'||_0x4ce875[_0xf803('0x3')]===0x0){return _0x6baafe(_0xf803('0x4'));}if(typeof _0x1a8691!==_0xf803('0x5')||_0x1a8691['length']===0x0){return _0x6baafe(_0xf803('0x6'));}if(typeof _0x43fb3b!==_0xf803('0x7')&&(typeof _0x43fb3b!=='string'||_0x43fb3b[_0xf803('0x3')]===0x0)){return _0x6baafe(_0xf803('0x8'));}try{_0x5c2cd6=fs[_0xf803('0x9')](_0x4ce875)['toString'](_0xf803('0xa'));}catch(_0x5cd4b4){return _0x6baafe(_0x5cd4b4);}return _0x19ff73({'method':_0xf803('0xb'),'uri':host+_0xf803('0xc')+_0x1a8691,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xf803('0xd'),'languageCode':_0x43fb3b},'audio':{'content':_0x5c2cd6}},'json':!![]});});}; \ No newline at end of file +var _0xde6c=['undefined','length','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','LINEAR16','8000','url','bluebird','exports','string','filepath\x20should\x20be\x20a\x20string'];(function(_0x4be00f,_0x439698){var _0x4fee70=function(_0x576e19){while(--_0x576e19){_0x4be00f['push'](_0x4be00f['shift']());}};_0x4fee70(++_0x439698);}(_0xde6c,0x119));var _0xcde6=function(_0x45b625,_0x165113){_0x45b625=_0x45b625-0x0;var _0x2a1e5c=_0xde6c[_0x45b625];return _0x2a1e5c;};'use strict';var url=require(_0xcde6('0x0'));var BPromise=require(_0xcde6('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xcde6('0x2')]=function(_0x330d58,_0x22fa0d,_0x31ac8c){return new BPromise(function(_0x494a32,_0x145150){var _0x262a54;if(typeof _0x330d58!==_0xcde6('0x3')||_0x330d58['length']===0x0){return _0x145150(_0xcde6('0x4'));}if(typeof _0x22fa0d!==_0xcde6('0x3')||_0x22fa0d['length']===0x0){return _0x145150('key\x20should\x20be\x20a\x20string');}if(typeof _0x31ac8c!==_0xcde6('0x5')&&(typeof _0x31ac8c!=='string'||_0x31ac8c[_0xcde6('0x6')]===0x0)){return _0x145150(_0xcde6('0x7'));}try{_0x262a54=fs[_0xcde6('0x8')](_0x330d58)[_0xcde6('0x9')]('base64');}catch(_0x34eadd){return _0x145150(_0x34eadd);}return _0x494a32({'method':_0xcde6('0xa'),'uri':host+'/v1/speech:recognize?key='+_0x22fa0d,'body':{'config':{'encoding':_0xcde6('0xb'),'sampleRateHertz':_0xcde6('0xc'),'languageCode':_0x31ac8c},'audio':{'content':_0x262a54}},'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 10cb4be..58ec9d1 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 asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0xe5a8=['exports'];(function(_0x420665,_0x58c4c7){var _0x1944c2=function(_0x27fbfc){while(--_0x27fbfc){_0x420665['push'](_0x420665['shift']());}};_0x1944c2(++_0x58c4c7);}(_0xe5a8,0x184));var _0x8e5a=function(_0xd2fef4,_0x5741e0){_0xd2fef4=_0xd2fef4-0x0;var _0x13eb62=_0xe5a8[_0xd2fef4];return _0x13eb62;};var asr=require('./asr');module[_0x8e5a('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index bdf8299..3acc63f 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 _0xb3a3=['statusMessage','finish','info','finish\x20download\x20file','close','error','unlink','pipe','protocol','path','WHAT_EVER','data','end','transcode','wav','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','?key=','ssml','input','MP3','text:synthesize','.mp3','from','audioContent','writeFile','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','googleASR','uri','results','alternatives','transcript','map','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','googleDialogflowV2','replace','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','ispeechTTS','format','model=%s','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','http','https','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','https:','host','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20'];(function(_0x3773f8,_0x15b419){var _0x1525d5=function(_0x45f811){while(--_0x45f811){_0x3773f8['push'](_0x3773f8['shift']());}};_0x1525d5(++_0x15b419);}(_0xb3a3,0x183));var _0x3b3a=function(_0x338900,_0x555916){_0x338900=_0x338900-0x0;var _0x3861dd=_0xb3a3[_0x338900];return _0x3861dd;};'use strict';var apiai=require(_0x3b3a('0x0'));var BPromise=require(_0x3b3a('0x1'));var dialogflow=require(_0x3b3a('0x2'));var fs=require('fs');var http=require(_0x3b3a('0x3'));var https=require(_0x3b3a('0x4'));var md5=require('md5');var path=require('path');var querystring=require(_0x3b3a('0x5'));var rp=require(_0x3b3a('0x6'));var rs=require(_0x3b3a('0x7'));var sox=require(_0x3b3a('0x8'));var tts=require(_0x3b3a('0x9'));var urlParse=require(_0x3b3a('0xa'))[_0x3b3a('0xb')];var util=require(_0x3b3a('0xc'));var aws=require(_0x3b3a('0xd'));var google=require('./google');var sestek=require(_0x3b3a('0xe'));var tilde=require(_0x3b3a('0xf'));var logger=require('../../../config/logger')(_0x3b3a('0x10'));var ISPEECH_API=_0x3b3a('0x11');function downloadFile(_0x4135bf,_0x5417ec){return new BPromise(function(_0x1bcca,_0x2cadb4){var _0x4ca6e0=urlParse(_0x4135bf);var _0x4f90a0=_0x4ca6e0['protocol']===_0x3b3a('0x12')?https:http;var _0x113cb0={'host':_0x4ca6e0[_0x3b3a('0x13')],'path':_0x4ca6e0['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x4f90a0[_0x3b3a('0x14')](_0x113cb0,function(_0x13ce4e){if(_0x13ce4e[_0x3b3a('0x15')]!==0xc8){logger['error'](_0x3b3a('0x16')+_0x4135bf+_0x3b3a('0x17')+_0x13ce4e[_0x3b3a('0x15')]+'\x20('+_0x13ce4e[_0x3b3a('0x18')]+')');_0x2cadb4(new Error(_0x3b3a('0x16')+_0x4135bf+_0x3b3a('0x17')+_0x13ce4e[_0x3b3a('0x15')]+'\x20('+_0x13ce4e[_0x3b3a('0x18')]+')'));return;}var _0x4d90be=fs['createWriteStream'](_0x5417ec);_0x4d90be['on'](_0x3b3a('0x19'),function(){logger[_0x3b3a('0x1a')](_0x3b3a('0x1b'));_0x4d90be[_0x3b3a('0x1c')](_0x1bcca);});_0x4d90be['on'](_0x3b3a('0x1d'),function(_0x37d82e){fs[_0x3b3a('0x1e')](_0x5417ec);logger['error']('download\x20error',_0x37d82e);_0x2cadb4(_0x37d82e);});_0x13ce4e[_0x3b3a('0x1f')](_0x4d90be);})['on']('error',function(_0x19e589){logger[_0x3b3a('0x1d')](_0x19e589);_0x2cadb4(_0x19e589);})['end']();});}function uploadFile(_0x2f45c6){return new BPromise(function(_0x40938c,_0x575a18){var _0x632be1=urlParse(_0x2f45c6);var _0x4fa403=_0x632be1[_0x3b3a('0x20')]===_0x3b3a('0x12')?https:http;var _0x113aac={'host':_0x632be1['host'],'path':_0x632be1[_0x3b3a('0x21')],'headers':{'user-agent':_0x3b3a('0x22')}};_0x4fa403['get'](_0x113aac,function(_0x21ccfa){if(_0x21ccfa[_0x3b3a('0x15')]!==0xc8){_0x575a18(new Error(_0x3b3a('0x16')+_0x2f45c6+'\x20failed,\x20status\x20code\x20=\x20'+_0x21ccfa[_0x3b3a('0x15')]+'\x20('+_0x21ccfa['statusMessage']+')'));return;}var _0x56d7ec='';_0x21ccfa['on'](_0x3b3a('0x23'),function(_0xd3870f){_0x56d7ec+=_0xd3870f;});_0x21ccfa['on'](_0x3b3a('0x24'),function(){_0x40938c(_0x56d7ec);});})['on'](_0x3b3a('0x1d'),function(_0x5c4cec){_0x575a18(_0x5c4cec);})['end']();});}function convertFile(_0x47ca52,_0x48f9ea){return new BPromise(function(_0xe02aa5,_0x166796){var _0xe0fa0f=sox[_0x3b3a('0x25')](_0x47ca52,_0x48f9ea,{'sampleRate':0x1f40,'format':_0x3b3a('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xe0fa0f['on'](_0x3b3a('0x1d'),function(_0x3d854a){logger[_0x3b3a('0x1d')]('error\x20convert',_0x3d854a);_0x166796(_0x3d854a);});_0xe0fa0f['on'](_0x3b3a('0x24'),function(){logger[_0x3b3a('0x1a')](_0x3b3a('0x27'));_0xe02aa5();});_0xe0fa0f['start']();});}function base64Decode(_0x5808af,_0x1b4db6){var _0x140566=path[_0x3b3a('0x28')](__dirname,_0x3b3a('0x29'),rs[_0x3b3a('0x2a')](0x4)+_0x3b3a('0x2b'));fs[_0x3b3a('0x2c')](_0x140566,_0x5808af,_0x3b3a('0x2d'));return convertFile(_0x140566,_0x1b4db6)[_0x3b3a('0x2e')](function(){try{fs[_0x3b3a('0x1e')](_0x140566);fs[_0x3b3a('0x2f')](_0x1b4db6,_0x3b3a('0x30'));}catch(_0x3c0c13){logger[_0x3b3a('0x1d')](_0x3c0c13);}return _0x1b4db6[_0x3b3a('0x31')]('.')[0x0];});}function base64Encode(_0x5a05fb){var _0x4ceedb=fs[_0x3b3a('0x32')](_0x5a05fb);return new Buffer(_0x4ceedb)[_0x3b3a('0x33')](_0x3b3a('0x2d'));}exports['googleCloudTTS']=function(_0x572e5d,_0x627e44,_0x570fa8,_0x10cc13,_0x4dd3d1,_0x541ce1){var _0x5b3c2e,_0x26c84a;var _0x5b44ab='https://texttospeech.googleapis.com/v1/';var _0x444329=_0x3b3a('0x34')+_0x572e5d;var _0x3d025d={};if(_0x627e44===_0x3b3a('0x35')){_0x3d025d[_0x3b3a('0x36')]={'ssml':_0x570fa8};}else{_0x3d025d[_0x3b3a('0x36')]={'text':_0x570fa8};};_0x3d025d['voice']={'languageCode':_0x10cc13,'ssmlGender':_0x4dd3d1};_0x3d025d['audioConfig']={'audioEncoding':_0x3b3a('0x37'),'sampleRateHertz':0x1f40};var _0x208e2a={'url':_0x5b44ab+_0x3b3a('0x38')+_0x444329,'method':'POST','json':!![],'body':_0x3d025d};return rp(_0x208e2a)[_0x3b3a('0x2e')](function(_0x5b3f96){return new BPromise(function(_0x4ea858,_0x19b42b){_0x5b3c2e=path[_0x3b3a('0x28')](__dirname,'tmp',rs[_0x3b3a('0x2a')](0x4)+_0x3b3a('0x39'));var _0x587641=Buffer[_0x3b3a('0x3a')](_0x5b3f96[_0x3b3a('0x3b')],'base64');return fs[_0x3b3a('0x3c')](_0x5b3c2e,_0x587641,function(_0x2bc3c1){_0x19b42b(_0x2bc3c1);},function(_0x546af4){fs[_0x3b3a('0x2f')](_0x5b3c2e,_0x3b3a('0x30'));_0x4ea858(_0x546af4);});});})[_0x3b3a('0x2e')](function(_0x41871c){_0x26c84a=path[_0x3b3a('0x28')](__dirname,_0x3b3a('0x29'),rs[_0x3b3a('0x2a')](0x4)+_0x3b3a('0x2b'));return convertFile(_0x5b3c2e,_0x26c84a);})[_0x3b3a('0x2e')](function(){try{fs['unlink'](_0x5b3c2e);fs['chmodSync'](_0x26c84a,'777');}catch(_0xd923c9){logger['error'](_0xd923c9);}logger['info']('googleCloudTTS\x20path',_0x26c84a[_0x3b3a('0x31')]('.')[0x0]);return _0x26c84a[_0x3b3a('0x31')]('.')[0x0];});};exports[_0x3b3a('0x3d')]=function(_0x5065aa,_0x513dda){var _0x9a070a=_0x3b3a('0x3e');var _0x2c507f,_0x284434;var _0x42119e;var _0xa12c04={'encoding':_0x3b3a('0x3f'),'method':_0x3b3a('0x40'),'timeout':0x2710,'url':_0x9a070a,'headers':{'Content-Type':_0x3b3a('0x41')},'body':_0x3b3a('0x42')+encodeURIComponent(JSON[_0x3b3a('0x43')]([[[_0x3b3a('0x44'),JSON[_0x3b3a('0x43')]([_0x5065aa,_0x513dda||'en',![],_0x3b3a('0x45')]),null,'generic']]]))};return rp(_0xa12c04)[_0x3b3a('0x2e')](function(_0x13bdb6){try{_0x42119e=eval(_0x13bdb6[_0x3b3a('0x46')](0x5))[0x0][0x2];}catch(_0x17234d){throw new Error(_0x3b3a('0x47')+_0x13bdb6['data']);}if(!_0x42119e){if(_0x5065aa[_0x3b3a('0x48')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x3b3a('0x49')+_0x513dda+_0x3b3a('0x4a'));}}try{_0x42119e=eval(_0x42119e)[0x0];}catch(_0x188d14){throw new Error(_0x3b3a('0x47')+res[_0x3b3a('0x23')]);}const _0x38b646=_0x42119e;_0x2c507f=path[_0x3b3a('0x28')](__dirname,'tmp',rs[_0x3b3a('0x2a')](0x4)+_0x3b3a('0x39'));fs[_0x3b3a('0x2c')](_0x2c507f,_0x42119e,{'encoding':_0x3b3a('0x2d')});_0x284434=path[_0x3b3a('0x28')](__dirname,_0x3b3a('0x29'),rs[_0x3b3a('0x2a')](0x4)+_0x3b3a('0x2b'));return convertFile(_0x2c507f,_0x284434);})[_0x3b3a('0x2e')](function(){try{fs['unlink'](_0x2c507f);fs[_0x3b3a('0x2f')](_0x284434,'777');}catch(_0x2eca2a){logger[_0x3b3a('0x1d')](_0x2eca2a);}logger[_0x3b3a('0x1a')]('goggleTTS\x20path',_0x284434['split']('.')[0x0]);return _0x284434[_0x3b3a('0x31')]('.')[0x0];});};exports[_0x3b3a('0x4b')]=function(_0x16172e,_0x3db832,_0x4239e0){return google['asr'](_0x16172e,_0x3db832,_0x4239e0)['then'](function(_0x38a64d){logger[_0x3b3a('0x1a')](_0x38a64d[_0x3b3a('0x4c')]);return rp(_0x38a64d);})['then'](function(_0x2f1390){var _0x361ccb='';var _0x341a67=0x0;try{fs[_0x3b3a('0x1e')](_0x16172e);}catch(_0x48fe48){logger[_0x3b3a('0x1d')](_0x48fe48);}if(_0x2f1390&&_0x2f1390[_0x3b3a('0x4d')]){_0x361ccb=_0x2f1390['results']['map'](function(_0x4203f9){return _0x4203f9&&_0x4203f9[_0x3b3a('0x4e')][0x0]&&_0x4203f9['alternatives'][0x0][_0x3b3a('0x4f')]?_0x4203f9[_0x3b3a('0x4e')][0x0][_0x3b3a('0x4f')]:'';})['join']('\x0a');_0x341a67=_0x2f1390[_0x3b3a('0x4d')][_0x3b3a('0x50')](function(_0x3f9903){return _0x3f9903&&_0x3f9903[_0x3b3a('0x4e')][0x0]&&_0x3f9903[_0x3b3a('0x4e')][0x0][_0x3b3a('0x51')]?_0x3f9903[_0x3b3a('0x4e')][0x0][_0x3b3a('0x51')]:0x0;})[_0x3b3a('0x52')]('\x0a');}logger[_0x3b3a('0x1a')](_0x3b3a('0x53'),_0x361ccb);logger[_0x3b3a('0x1a')](_0x3b3a('0x54'),_0x341a67);return{'transcript':_0x361ccb,'confidence':_0x341a67};})[_0x3b3a('0x55')](function(_0x2fed51){logger[_0x3b3a('0x1d')]('[%s]\x20%s:%s',_0x2fed51['statusCode'],_0x2fed51[_0x3b3a('0x56')],_0x2fed51[_0x3b3a('0x57')]);});};exports[_0x3b3a('0x58')]=function(_0x2fed7c,_0x1848d5,_0x46f43d,_0x25aa32){var _0x1233d2=apiai(_0x1848d5,{'language':_0x25aa32||'en'});return _0x1233d2[_0x3b3a('0x59')](_0x46f43d,{'sessionId':md5(_0x2fed7c)})['then'](function(_0x2b5847){logger[_0x3b3a('0x1a')](JSON['stringify'](_0x2b5847));return{'source':_0x2b5847['result'][_0x3b3a('0x5a')],'resolvedQuery':_0x2b5847[_0x3b3a('0x5b')][_0x3b3a('0x5c')],'action':_0x2b5847[_0x3b3a('0x5b')][_0x3b3a('0x5d')],'actionIncomplete':_0x2b5847['result'][_0x3b3a('0x5e')],'speech':_0x2b5847[_0x3b3a('0x5b')][_0x3b3a('0x5f')][_0x3b3a('0x60')],'score':_0x2b5847[_0x3b3a('0x5b')][_0x3b3a('0x61')],'statusCode':_0x2b5847[_0x3b3a('0x62')][_0x3b3a('0x63')],'endConversation':_0x2b5847[_0x3b3a('0x5b')][_0x3b3a('0x64')][_0x3b3a('0x65')]||![],'isFallbackIntent':_0x2b5847['result'][_0x3b3a('0x64')]['isFallbackIntent']};});};exports[_0x3b3a('0x66')]=function(_0x379f03,_0xa3249c,_0x3a1da5,_0x36a373,_0xce6ffa,_0x2f08e4){var _0x5d40bb=_0x36a373[_0x3b3a('0x67')](/\\n/g,'\x0a');var _0x138bc4={'credentials':{'private_key':_0x5d40bb,'client_email':_0x3a1da5}};var _0x195700=new dialogflow['SessionsClient'](_0x138bc4);var _0x9bcacf=_0x195700['sessionPath'](_0xa3249c,md5(_0x379f03));var _0x160007={'session':_0x9bcacf,'queryInput':{'text':{'text':_0xce6ffa,'languageCode':_0x2f08e4}}};return _0x195700[_0x3b3a('0x68')](_0x160007)[_0x3b3a('0x2e')](function(_0x22d15d){if(_0x22d15d&&_0x22d15d[_0x3b3a('0x48')]){logger[_0x3b3a('0x1a')](_0x3b3a('0x69'),JSON[_0x3b3a('0x43')](_0x22d15d));var _0x18dc5e=_0x22d15d[0x0];if(_0x18dc5e){var _0xa3b4c1={'action':_0x18dc5e[_0x3b3a('0x6a')]['action'],'allRequiredParamsPresent':_0x18dc5e[_0x3b3a('0x6a')][_0x3b3a('0x6b')],'endConversation':_0x18dc5e[_0x3b3a('0x6a')]['diagnosticInfo']&&_0x18dc5e[_0x3b3a('0x6a')][_0x3b3a('0x6c')][_0x3b3a('0x6d')]?_0x18dc5e[_0x3b3a('0x6a')][_0x3b3a('0x6c')]['fields']['end_conversation'][_0x3b3a('0x6e')]:![],'fulfillmentText':_0x18dc5e[_0x3b3a('0x6a')]['fulfillmentText'],'intentName':_0x18dc5e['queryResult'][_0x3b3a('0x6f')][_0x3b3a('0x56')],'intentDisplayName':_0x18dc5e['queryResult']['intent'][_0x3b3a('0x70')],'isFallbackIntent':_0x18dc5e[_0x3b3a('0x6a')]['intent'][_0x3b3a('0x71')],'languageCode':_0x18dc5e[_0x3b3a('0x6a')][_0x3b3a('0x72')],'queryText':_0x18dc5e[_0x3b3a('0x6a')][_0x3b3a('0x73')],'responseId':_0x18dc5e[_0x3b3a('0x74')],'score':_0x18dc5e[_0x3b3a('0x6a')][_0x3b3a('0x75')],'speech':_0x18dc5e[_0x3b3a('0x6a')][_0x3b3a('0x76')],'providerResponse':JSON[_0x3b3a('0x43')](_0x22d15d)};return _0xa3b4c1;}}});};exports[_0x3b3a('0x77')]=function(_0x3cb59f,_0x19b5f8,_0x1bf070,_0x455c8f){return tilde[_0x3b3a('0x78')](_0x3cb59f,_0x19b5f8,_0x1bf070,_0x455c8f)[_0x3b3a('0x2e')](function(_0x2cbbe1){try{fs[_0x3b3a('0x1e')](_0x3cb59f);}catch(_0x377f5b){logger[_0x3b3a('0x1d')](_0x377f5b);}logger[_0x3b3a('0x1a')](_0x3b3a('0x79'),_0x2cbbe1[_0x3b3a('0x4f')]);logger[_0x3b3a('0x1a')](_0x3b3a('0x7a'),_0x2cbbe1['confidence']);return _0x2cbbe1;});};exports[_0x3b3a('0x7b')]=function(_0x536e6f,_0xb3592c,_0x54f234,_0x211fb7,_0x27925c,_0x354888){var _0x41df98=path[_0x3b3a('0x28')](__dirname,_0x3b3a('0x29'),rs['generate'](0x4)+_0x3b3a('0x39'));var _0x181520;return aws['polly'](_0x536e6f,_0xb3592c,_0x54f234,_0x211fb7,_0x27925c,_0x354888,_0x41df98)['then'](function(){_0x181520=path[_0x3b3a('0x28')](__dirname,_0x3b3a('0x29'),rs[_0x3b3a('0x2a')](0x4)+_0x3b3a('0x2b'));return convertFile(_0x41df98,_0x181520);})[_0x3b3a('0x2e')](function(){try{fs[_0x3b3a('0x1e')](_0x41df98);fs[_0x3b3a('0x2f')](_0x181520,_0x3b3a('0x30'));}catch(_0x428755){logger[_0x3b3a('0x1d')](_0x428755);}return _0x181520[_0x3b3a('0x31')]('.')[0x0];});};exports[_0x3b3a('0x7c')]=function(_0x131f89,_0x15d3a6,_0x1ff0e5,_0x1ef60c,_0x114ccb,_0x54f69b){return aws[_0x3b3a('0x7d')](_0x131f89,_0x15d3a6,_0x1ff0e5,_0x1ef60c,_0x114ccb,_0x54f69b)[_0x3b3a('0x2e')](function(_0x1a155e){logger['info'](JSON['stringify'](_0x1a155e));return _0x1a155e;});};exports[_0x3b3a('0x7e')]=function(_0xab294b,_0x52c61b,_0xb49285,_0x1369da){var _0x284add=util[_0x3b3a('0x7f')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0xab294b,encodeURIComponent(_0x52c61b),_0xb49285,_0x1369da);var _0xf78222=path[_0x3b3a('0x28')](__dirname,'tmp',rs[_0x3b3a('0x2a')](0x4)+'.mp3');var _0x5be981;return downloadFile(_0x284add,_0xf78222)['then'](function(){_0x5be981=path[_0x3b3a('0x28')](__dirname,_0x3b3a('0x29'),rs['generate'](0x4)+'.wav');return convertFile(_0xf78222,_0x5be981);})[_0x3b3a('0x2e')](function(){try{fs[_0x3b3a('0x1e')](_0xf78222);fs[_0x3b3a('0x2f')](_0x5be981,_0x3b3a('0x30'));}catch(_0x4495d3){logger['error'](_0x4495d3);}return _0x5be981[_0x3b3a('0x31')]('.')[0x0];});};exports['ispeechASR']=function(_0x351fe6,_0x5eba5c,_0x53efcc,_0x3166eb){var _0x548046=util[_0x3b3a('0x7f')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x5eba5c,_0x53efcc,base64Encode(_0x351fe6),_0x3166eb?util[_0x3b3a('0x7f')](_0x3b3a('0x80'),encodeURIComponent(_0x3166eb)):'freeform=3');return uploadFile(_0x548046)[_0x3b3a('0x2e')](function(_0x452d04){return querystring[_0x3b3a('0xb')](_0x452d04);});};exports[_0x3b3a('0x81')]=function(_0x210481,_0x27ac13){return sestek[_0x3b3a('0x82')](_0x210481,_0x27ac13)[_0x3b3a('0x2e')](function(_0x2ec7c6){logger[_0x3b3a('0x1a')](JSON['stringify'](_0x2ec7c6));var _0x107ef7={'speech':_0x2ec7c6[_0x3b3a('0x83')],'action':_0x2ec7c6[_0x3b3a('0x84')]?_0x2ec7c6[_0x3b3a('0x84')]['CustomAction']:undefined,'actiondata':_0x2ec7c6[_0x3b3a('0x84')]?_0x2ec7c6[_0x3b3a('0x84')][_0x3b3a('0x85')]:undefined};if(_0x2ec7c6[_0x3b3a('0x84')]&&_0x2ec7c6[_0x3b3a('0x84')][_0x3b3a('0x86')]){return base64Decode(_0x2ec7c6[_0x3b3a('0x84')]['AudioFromTts'][_0x3b3a('0x87')],path[_0x3b3a('0x28')](__dirname,_0x3b3a('0x29'),rs[_0x3b3a('0x2a')](0x4)+_0x3b3a('0x2b')))[_0x3b3a('0x2e')](function(_0x499136){_0x107ef7[_0x3b3a('0x88')]=_0x499136;return _0x107ef7;});}return _0x107ef7;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0xdc6c=['path','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','pipe','end','https:','host','request\x20to\x20','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','base64','then','readFileSync','toString','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','chmodSync','777','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','jQ1olc','stringify','null','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','writeFileSync','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','name','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','isFallbackIntent','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','intent','displayName','isFallback','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol'];(function(_0xac56ce,_0xb73e4){var _0x5105e1=function(_0x52768d){while(--_0x52768d){_0xac56ce['push'](_0xac56ce['shift']());}};_0x5105e1(++_0xb73e4);}(_0xdc6c,0xf3));var _0xcdc6=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0xdc6c[_0x35007a];return _0x574f68;};'use strict';var apiai=require(_0xcdc6('0x0'));var BPromise=require(_0xcdc6('0x1'));var dialogflow=require(_0xcdc6('0x2'));var fs=require('fs');var http=require(_0xcdc6('0x3'));var https=require('https');var md5=require('md5');var path=require('path');var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0xcdc6('0x4'));var sox=require(_0xcdc6('0x5'));var tts=require(_0xcdc6('0x6'));var urlParse=require(_0xcdc6('0x7'))[_0xcdc6('0x8')];var util=require(_0xcdc6('0x9'));var aws=require(_0xcdc6('0xa'));var google=require(_0xcdc6('0xb'));var sestek=require('./sestek');var tilde=require(_0xcdc6('0xc'));var logger=require(_0xcdc6('0xd'))(_0xcdc6('0xe'));var ISPEECH_API=_0xcdc6('0xf');function downloadFile(_0x2a5688,_0x7afe6f){return new BPromise(function(_0x20effa,_0x5e4cdc){var _0x60e3eb=urlParse(_0x2a5688);var _0x3f8edc=_0x60e3eb[_0xcdc6('0x10')]==='https:'?https:http;var _0x4c031f={'host':_0x60e3eb['host'],'path':_0x60e3eb[_0xcdc6('0x11')],'headers':{'user-agent':'WHAT_EVER'}};_0x3f8edc[_0xcdc6('0x12')](_0x4c031f,function(_0xce95c6){if(_0xce95c6[_0xcdc6('0x13')]!==0xc8){logger[_0xcdc6('0x14')]('request\x20to\x20'+_0x2a5688+_0xcdc6('0x15')+_0xce95c6[_0xcdc6('0x13')]+'\x20('+_0xce95c6[_0xcdc6('0x16')]+')');_0x5e4cdc(new Error('request\x20to\x20'+_0x2a5688+_0xcdc6('0x15')+_0xce95c6[_0xcdc6('0x13')]+'\x20('+_0xce95c6[_0xcdc6('0x16')]+')'));return;}var _0x22ef4e=fs[_0xcdc6('0x17')](_0x7afe6f);_0x22ef4e['on'](_0xcdc6('0x18'),function(){logger[_0xcdc6('0x19')](_0xcdc6('0x1a'));_0x22ef4e[_0xcdc6('0x1b')](_0x20effa);});_0x22ef4e['on']('error',function(_0x12f92d){fs[_0xcdc6('0x1c')](_0x7afe6f);logger[_0xcdc6('0x14')]('download\x20error',_0x12f92d);_0x5e4cdc(_0x12f92d);});_0xce95c6[_0xcdc6('0x1d')](_0x22ef4e);})['on']('error',function(_0x314af4){logger[_0xcdc6('0x14')](_0x314af4);_0x5e4cdc(_0x314af4);})[_0xcdc6('0x1e')]();});}function uploadFile(_0x36a289){return new BPromise(function(_0x3a8f46,_0x5919b7){var _0x3cae64=urlParse(_0x36a289);var _0x51d7db=_0x3cae64[_0xcdc6('0x10')]===_0xcdc6('0x1f')?https:http;var _0x30c8ff={'host':_0x3cae64[_0xcdc6('0x20')],'path':_0x3cae64[_0xcdc6('0x11')],'headers':{'user-agent':'WHAT_EVER'}};_0x51d7db[_0xcdc6('0x12')](_0x30c8ff,function(_0x2cea03){if(_0x2cea03[_0xcdc6('0x13')]!==0xc8){_0x5919b7(new Error(_0xcdc6('0x21')+_0x36a289+_0xcdc6('0x15')+_0x2cea03['statusCode']+'\x20('+_0x2cea03[_0xcdc6('0x16')]+')'));return;}var _0x3084ad='';_0x2cea03['on'](_0xcdc6('0x22'),function(_0x3bcca3){_0x3084ad+=_0x3bcca3;});_0x2cea03['on'](_0xcdc6('0x1e'),function(){_0x3a8f46(_0x3084ad);});})['on']('error',function(_0x5278f0){_0x5919b7(_0x5278f0);})['end']();});}function convertFile(_0x1e8d97,_0x4a391e){return new BPromise(function(_0x3e8c21,_0x39c7fb){var _0x1bcf0f=sox[_0xcdc6('0x23')](_0x1e8d97,_0x4a391e,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1bcf0f['on']('error',function(_0x3aed93){logger[_0xcdc6('0x14')](_0xcdc6('0x24'),_0x3aed93);_0x39c7fb(_0x3aed93);});_0x1bcf0f['on'](_0xcdc6('0x1e'),function(){logger[_0xcdc6('0x19')](_0xcdc6('0x25'));_0x3e8c21();});_0x1bcf0f[_0xcdc6('0x26')]();});}function base64Decode(_0x18fa9e,_0x59a286){var _0x58ee0a=path[_0xcdc6('0x27')](__dirname,_0xcdc6('0x28'),rs[_0xcdc6('0x29')](0x4)+_0xcdc6('0x2a'));fs['writeFileSync'](_0x58ee0a,_0x18fa9e,_0xcdc6('0x2b'));return convertFile(_0x58ee0a,_0x59a286)[_0xcdc6('0x2c')](function(){try{fs['unlink'](_0x58ee0a);fs['chmodSync'](_0x59a286,'777');}catch(_0x275e3e){logger[_0xcdc6('0x14')](_0x275e3e);}return _0x59a286['split']('.')[0x0];});}function base64Encode(_0x208a62){var _0x23820a=fs[_0xcdc6('0x2d')](_0x208a62);return new Buffer(_0x23820a)[_0xcdc6('0x2e')]('base64');}exports[_0xcdc6('0x2f')]=function(_0x3d1301,_0x505f01,_0x521aa4,_0x2e6e23,_0x347a50,_0x53c304){var _0x5e25d4,_0xe6fa7f;var _0x589ad1='https://texttospeech.googleapis.com/v1/';var _0x4aabc7=_0xcdc6('0x30')+_0x3d1301;var _0x453de9={};if(_0x505f01===_0xcdc6('0x31')){_0x453de9[_0xcdc6('0x32')]={'ssml':_0x521aa4};}else{_0x453de9[_0xcdc6('0x32')]={'text':_0x521aa4};};_0x453de9[_0xcdc6('0x33')]={'languageCode':_0x2e6e23,'ssmlGender':_0x347a50};_0x453de9[_0xcdc6('0x34')]={'audioEncoding':_0xcdc6('0x35'),'sampleRateHertz':0x1f40};var _0x1d9a3f={'url':_0x589ad1+_0xcdc6('0x36')+_0x4aabc7,'method':_0xcdc6('0x37'),'json':!![],'body':_0x453de9};return rp(_0x1d9a3f)[_0xcdc6('0x2c')](function(_0x288f63){return new BPromise(function(_0x5759b4,_0x4d33aa){_0x5e25d4=path['resolve'](__dirname,_0xcdc6('0x28'),rs['generate'](0x4)+_0xcdc6('0x38'));var _0x412c55=Buffer[_0xcdc6('0x39')](_0x288f63[_0xcdc6('0x3a')],'base64');return fs['writeFile'](_0x5e25d4,_0x412c55,function(_0x8e698c){_0x4d33aa(_0x8e698c);},function(_0x124b5f){fs[_0xcdc6('0x3b')](_0x5e25d4,_0xcdc6('0x3c'));_0x5759b4(_0x124b5f);});});})['then'](function(_0xcaa765){_0xe6fa7f=path[_0xcdc6('0x27')](__dirname,_0xcdc6('0x28'),rs[_0xcdc6('0x29')](0x4)+'.wav');return convertFile(_0x5e25d4,_0xe6fa7f);})['then'](function(){try{fs[_0xcdc6('0x1c')](_0x5e25d4);fs[_0xcdc6('0x3b')](_0xe6fa7f,_0xcdc6('0x3c'));}catch(_0x2f8808){logger['error'](_0x2f8808);}logger['info']('googleCloudTTS\x20path',_0xe6fa7f[_0xcdc6('0x3d')]('.')[0x0]);return _0xe6fa7f['split']('.')[0x0];});};exports[_0xcdc6('0x3e')]=function(_0xb037fe,_0x4bfb59){var _0x4ad9a2=_0xcdc6('0x3f');var _0x257680,_0xfcb0d3;var _0x5d25ba;var _0x51398b={'encoding':_0xcdc6('0x40'),'method':_0xcdc6('0x37'),'timeout':0x2710,'url':_0x4ad9a2,'headers':{'Content-Type':_0xcdc6('0x41')},'body':'f.req='+encodeURIComponent(JSON['stringify']([[[_0xcdc6('0x42'),JSON[_0xcdc6('0x43')]([_0xb037fe,_0x4bfb59||'en',![],_0xcdc6('0x44')]),null,'generic']]]))};return rp(_0x51398b)['then'](function(_0x3313ce){try{_0x5d25ba=eval(_0x3313ce['slice'](0x5))[0x0][0x2];}catch(_0x44cd66){throw new Error('parse\x20response\x20failed:\x0a'+_0x3313ce[_0xcdc6('0x22')]);}if(!_0x5d25ba){if(_0xb037fe[_0xcdc6('0x45')]>0xc8){throw new Error(_0xcdc6('0x46'));}else{throw new Error(_0xcdc6('0x47')+_0x4bfb59+_0xcdc6('0x48'));}}try{_0x5d25ba=eval(_0x5d25ba)[0x0];}catch(_0xbbfba5){throw new Error(_0xcdc6('0x49')+res[_0xcdc6('0x22')]);}const _0x5473e3=_0x5d25ba;_0x257680=path['resolve'](__dirname,_0xcdc6('0x28'),rs[_0xcdc6('0x29')](0x4)+_0xcdc6('0x38'));fs[_0xcdc6('0x4a')](_0x257680,_0x5d25ba,{'encoding':_0xcdc6('0x2b')});_0xfcb0d3=path[_0xcdc6('0x27')](__dirname,'tmp',rs[_0xcdc6('0x29')](0x4)+'.wav');return convertFile(_0x257680,_0xfcb0d3);})['then'](function(){try{fs['unlink'](_0x257680);fs[_0xcdc6('0x3b')](_0xfcb0d3,'777');}catch(_0xe13158){logger[_0xcdc6('0x14')](_0xe13158);}logger[_0xcdc6('0x19')](_0xcdc6('0x4b'),_0xfcb0d3[_0xcdc6('0x3d')]('.')[0x0]);return _0xfcb0d3[_0xcdc6('0x3d')]('.')[0x0];});};exports['googleASR']=function(_0x9dfa36,_0x152f8a,_0x559097){return google[_0xcdc6('0x4c')](_0x9dfa36,_0x152f8a,_0x559097)[_0xcdc6('0x2c')](function(_0x5570bd){logger[_0xcdc6('0x19')](_0x5570bd[_0xcdc6('0x4d')]);return rp(_0x5570bd);})[_0xcdc6('0x2c')](function(_0x1bc6f2){var _0x5e1f9b='';var _0x34e50b=0x0;try{fs['unlink'](_0x9dfa36);}catch(_0x28db2e){logger[_0xcdc6('0x14')](_0x28db2e);}if(_0x1bc6f2&&_0x1bc6f2[_0xcdc6('0x4e')]){_0x5e1f9b=_0x1bc6f2[_0xcdc6('0x4e')][_0xcdc6('0x4f')](function(_0x49bd4c){return _0x49bd4c&&_0x49bd4c[_0xcdc6('0x50')][0x0]&&_0x49bd4c[_0xcdc6('0x50')][0x0][_0xcdc6('0x51')]?_0x49bd4c[_0xcdc6('0x50')][0x0][_0xcdc6('0x51')]:'';})[_0xcdc6('0x52')]('\x0a');_0x34e50b=_0x1bc6f2[_0xcdc6('0x4e')][_0xcdc6('0x4f')](function(_0x197638){return _0x197638&&_0x197638[_0xcdc6('0x50')][0x0]&&_0x197638[_0xcdc6('0x50')][0x0]['confidence']?_0x197638[_0xcdc6('0x50')][0x0][_0xcdc6('0x53')]:0x0;})[_0xcdc6('0x52')]('\x0a');}logger[_0xcdc6('0x19')](_0xcdc6('0x54'),_0x5e1f9b);logger[_0xcdc6('0x19')](_0xcdc6('0x55'),_0x34e50b);return{'transcript':_0x5e1f9b,'confidence':_0x34e50b};})['catch'](function(_0x4d7348){logger[_0xcdc6('0x14')]('[%s]\x20%s:%s',_0x4d7348[_0xcdc6('0x13')],_0x4d7348[_0xcdc6('0x56')],_0x4d7348['message']);});};exports['googleDialogflow']=function(_0x54ce70,_0x4ae66d,_0x3627dd,_0x5d5154){var _0x4901df=apiai(_0x4ae66d,{'language':_0x5d5154||'en'});return _0x4901df['textRequest'](_0x3627dd,{'sessionId':md5(_0x54ce70)})[_0xcdc6('0x2c')](function(_0x1ed5bf){logger['info'](JSON[_0xcdc6('0x43')](_0x1ed5bf));return{'source':_0x1ed5bf[_0xcdc6('0x57')][_0xcdc6('0x58')],'resolvedQuery':_0x1ed5bf[_0xcdc6('0x57')][_0xcdc6('0x59')],'action':_0x1ed5bf[_0xcdc6('0x57')][_0xcdc6('0x5a')],'actionIncomplete':_0x1ed5bf[_0xcdc6('0x57')][_0xcdc6('0x5b')],'speech':_0x1ed5bf['result'][_0xcdc6('0x5c')][_0xcdc6('0x5d')],'score':_0x1ed5bf[_0xcdc6('0x57')][_0xcdc6('0x5e')],'statusCode':_0x1ed5bf[_0xcdc6('0x5f')][_0xcdc6('0x60')],'endConversation':_0x1ed5bf[_0xcdc6('0x57')][_0xcdc6('0x61')]['endConversation']||![],'isFallbackIntent':_0x1ed5bf[_0xcdc6('0x57')]['metadata'][_0xcdc6('0x62')]};});};exports['googleDialogflowV2']=function(_0x77426f,_0x2f601c,_0x50da57,_0x21a59e,_0x4a2807,_0x26fa34){var _0x2d60a4=_0x21a59e[_0xcdc6('0x63')](/\\n/g,'\x0a');var _0x162c4b={'credentials':{'private_key':_0x2d60a4,'client_email':_0x50da57}};var _0x16420b=new dialogflow[(_0xcdc6('0x64'))](_0x162c4b);var _0x4b4933=_0x16420b[_0xcdc6('0x65')](_0x2f601c,md5(_0x77426f));var _0x4c5875={'session':_0x4b4933,'queryInput':{'text':{'text':_0x4a2807,'languageCode':_0x26fa34}}};return _0x16420b['detectIntent'](_0x4c5875)[_0xcdc6('0x2c')](function(_0x1c36d6){if(_0x1c36d6&&_0x1c36d6[_0xcdc6('0x45')]){logger[_0xcdc6('0x19')](_0xcdc6('0x66'),JSON[_0xcdc6('0x43')](_0x1c36d6));var _0x41b3be=_0x1c36d6[0x0];if(_0x41b3be){var _0x109f68={'action':_0x41b3be['queryResult'][_0xcdc6('0x5a')],'allRequiredParamsPresent':_0x41b3be[_0xcdc6('0x67')]['allRequiredParamsPresent'],'endConversation':_0x41b3be[_0xcdc6('0x67')][_0xcdc6('0x68')]&&_0x41b3be['queryResult'][_0xcdc6('0x68')][_0xcdc6('0x69')]?_0x41b3be['queryResult'][_0xcdc6('0x68')]['fields']['end_conversation']['boolValue']:![],'fulfillmentText':_0x41b3be['queryResult']['fulfillmentText'],'intentName':_0x41b3be[_0xcdc6('0x67')][_0xcdc6('0x6a')][_0xcdc6('0x56')],'intentDisplayName':_0x41b3be[_0xcdc6('0x67')][_0xcdc6('0x6a')][_0xcdc6('0x6b')],'isFallbackIntent':_0x41b3be[_0xcdc6('0x67')]['intent'][_0xcdc6('0x6c')],'languageCode':_0x41b3be[_0xcdc6('0x67')]['languageCode'],'queryText':_0x41b3be[_0xcdc6('0x67')]['queryText'],'responseId':_0x41b3be[_0xcdc6('0x6d')],'score':_0x41b3be['queryResult'][_0xcdc6('0x6e')],'speech':_0x41b3be[_0xcdc6('0x67')]['fulfillmentText'],'providerResponse':JSON[_0xcdc6('0x43')](_0x1c36d6)};return _0x109f68;}}});};exports[_0xcdc6('0x6f')]=function(_0x48d628,_0x24f514,_0x2d35a1,_0x2fca16){return tilde['asr'](_0x48d628,_0x24f514,_0x2d35a1,_0x2fca16)[_0xcdc6('0x2c')](function(_0x59d54f){try{fs[_0xcdc6('0x1c')](_0x48d628);}catch(_0x53a0b9){logger['error'](_0x53a0b9);}logger[_0xcdc6('0x19')](_0xcdc6('0x70'),_0x59d54f[_0xcdc6('0x51')]);logger[_0xcdc6('0x19')](_0xcdc6('0x71'),_0x59d54f[_0xcdc6('0x53')]);return _0x59d54f;});};exports[_0xcdc6('0x72')]=function(_0x37fc32,_0x21c3d1,_0x342e9c,_0x314ecc,_0x257bd8,_0x207813){var _0x321e08=path['resolve'](__dirname,_0xcdc6('0x28'),rs[_0xcdc6('0x29')](0x4)+'.mp3');var _0x4f5c58;return aws[_0xcdc6('0x73')](_0x37fc32,_0x21c3d1,_0x342e9c,_0x314ecc,_0x257bd8,_0x207813,_0x321e08)[_0xcdc6('0x2c')](function(){_0x4f5c58=path[_0xcdc6('0x27')](__dirname,_0xcdc6('0x28'),rs[_0xcdc6('0x29')](0x4)+'.wav');return convertFile(_0x321e08,_0x4f5c58);})['then'](function(){try{fs[_0xcdc6('0x1c')](_0x321e08);fs[_0xcdc6('0x3b')](_0x4f5c58,_0xcdc6('0x3c'));}catch(_0x2b56e2){logger[_0xcdc6('0x14')](_0x2b56e2);}return _0x4f5c58['split']('.')[0x0];});};exports['awsLex']=function(_0x41c493,_0x5ebbc4,_0x103aed,_0x2912bc,_0x1fa819,_0x5f3cae){return aws['lex'](_0x41c493,_0x5ebbc4,_0x103aed,_0x2912bc,_0x1fa819,_0x5f3cae)[_0xcdc6('0x2c')](function(_0x556d48){logger[_0xcdc6('0x19')](JSON['stringify'](_0x556d48));return _0x556d48;});};exports[_0xcdc6('0x74')]=function(_0x5634dd,_0x4581ef,_0x39bf1a,_0x136e31){var _0x519a4a=util[_0xcdc6('0x75')](_0xcdc6('0x76'),ISPEECH_API,_0x5634dd,encodeURIComponent(_0x4581ef),_0x39bf1a,_0x136e31);var _0x53a5d6=path[_0xcdc6('0x27')](__dirname,_0xcdc6('0x28'),rs[_0xcdc6('0x29')](0x4)+_0xcdc6('0x38'));var _0x2537bc;return downloadFile(_0x519a4a,_0x53a5d6)['then'](function(){_0x2537bc=path[_0xcdc6('0x27')](__dirname,_0xcdc6('0x28'),rs[_0xcdc6('0x29')](0x4)+_0xcdc6('0x2a'));return convertFile(_0x53a5d6,_0x2537bc);})['then'](function(){try{fs[_0xcdc6('0x1c')](_0x53a5d6);fs[_0xcdc6('0x3b')](_0x2537bc,_0xcdc6('0x3c'));}catch(_0x2a466a){logger['error'](_0x2a466a);}return _0x2537bc[_0xcdc6('0x3d')]('.')[0x0];});};exports['ispeechASR']=function(_0x4410ff,_0x41037b,_0xc8144a,_0x3a679b){var _0x37906f=util['format'](_0xcdc6('0x77'),ISPEECH_API,_0x41037b,_0xc8144a,base64Encode(_0x4410ff),_0x3a679b?util['format'](_0xcdc6('0x78'),encodeURIComponent(_0x3a679b)):_0xcdc6('0x79'));return uploadFile(_0x37906f)[_0xcdc6('0x2c')](function(_0x48351b){return querystring['parse'](_0x48351b);});};exports[_0xcdc6('0x7a')]=function(_0x4bc9c1,_0x1d66f8){return sestek[_0xcdc6('0x7b')](_0x4bc9c1,_0x1d66f8)[_0xcdc6('0x2c')](function(_0x268165){logger[_0xcdc6('0x19')](JSON['stringify'](_0x268165));var _0x293f7b={'speech':_0x268165['text'],'action':_0x268165['channelData']?_0x268165[_0xcdc6('0x7c')][_0xcdc6('0x7d')]:undefined,'actiondata':_0x268165[_0xcdc6('0x7c')]?_0x268165[_0xcdc6('0x7c')]['CustomActionData']:undefined};if(_0x268165[_0xcdc6('0x7c')]&&_0x268165[_0xcdc6('0x7c')]['AudioFromTts']){return base64Decode(_0x268165[_0xcdc6('0x7c')][_0xcdc6('0x7e')][_0xcdc6('0x7f')],path[_0xcdc6('0x27')](__dirname,_0xcdc6('0x28'),rs['generate'](0x4)+_0xcdc6('0x2a')))[_0xcdc6('0x2c')](function(_0x306d1f){_0x293f7b[_0xcdc6('0x80')]=_0x306d1f;return _0x293f7b;});}return _0x293f7b;});};exports[_0xcdc6('0x81')]=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 61971ae..a1a67cf 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 _0x5f19=['./nda','exports'];(function(_0x4c80d7,_0x2bef29){var _0x3c5095=function(_0x1b0e67){while(--_0x1b0e67){_0x4c80d7['push'](_0x4c80d7['shift']());}};_0x3c5095(++_0x2bef29);}(_0x5f19,0x1c4));var _0x95f1=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x5f19[_0x5a79e2];return _0x266c45;};var nda=require(_0x95f1('0x0'));module[_0x95f1('0x1')]={'nda':nda}; \ No newline at end of file +var _0x2d14=['exports','./nda'];(function(_0x87ffc2,_0x38d737){var _0x5179be=function(_0x533e09){while(--_0x533e09){_0x87ffc2['push'](_0x87ffc2['shift']());}};_0x5179be(++_0x38d737);}(_0x2d14,0x9b));var _0x42d1=function(_0x3f260d,_0x8c2760){_0x3f260d=_0x3f260d-0x0;var _0x467280=_0x2d14[_0x3f260d];return _0x467280;};var nda=require(_0x42d1('0x0'));module[_0x42d1('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 04fee74..73074e3 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 _0xe630=['ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','AudioOutputSettings','audio/wav','custom_action','CustomActionData','custom_action_data','request-promise','url','agi','exports','POST','resolve','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe630,0x149));var _0x0e63=function(_0x39de46,_0x475bc7){_0x39de46=_0x39de46-0x0;var _0x401672=_0xe630[_0x39de46];return _0x401672;};'use strict';var rp=require(_0x0e63('0x0'));var url=require(_0x0e63('0x1'));var logger=require('../../../../../config/logger')(_0x0e63('0x2'));module[_0x0e63('0x3')]=function(_0x45c680,_0x500458){var _0x103691={'method':_0x0e63('0x4'),'uri':url[_0x0e63('0x5')](_0x500458['ndauth_url'],_0x0e63('0x6')),'form':{'grant_type':_0x0e63('0x7'),'username':_0x500458[_0x0e63('0x8')],'password':_0x500458[_0x0e63('0x7')]},'json':!![]};return rp(_0x103691)[_0x0e63('0x9')](function(_0x563ad9){var _0x35e304={'method':_0x0e63('0x4'),'uri':url[_0x0e63('0x5')](_0x500458[_0x0e63('0xa')],_0x0e63('0xb')),'body':{'type':_0x500458[_0x0e63('0xc')]||_0x0e63('0xd'),'channelId':_0x0e63('0xe'),'conversation':{'id':_0x45c680[_0x0e63('0xf')]},'from':{'id':_0x45c680[_0x0e63('0x10')],'name':_0x45c680[_0x0e63('0x11')]},'recipient':{'id':_0x45c680['dnid'],'name':_0x45c680[_0x0e63('0x12')]},'text':_0x500458[_0x0e63('0x13')],'channelData':{}},'headers':{'Authorization':_0x0e63('0x14')+_0x563ad9[_0x0e63('0x15')]},'json':!![]};if(_0x500458[_0x0e63('0x16')]){_0x35e304[_0x0e63('0x17')][_0x0e63('0x18')][_0x0e63('0x19')]=_0x500458[_0x0e63('0x16')];}if(_0x500458['ndagenerate_audio']=='1'){_0x35e304['body'][_0x0e63('0x18')][_0x0e63('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x0e63('0x1b')};}if(_0x500458[_0x0e63('0x1c')]){_0x35e304[_0x0e63('0x17')][_0x0e63('0x18')]['CustomAction']=_0x500458['custom_action'];if(_0x500458['custom_action_data']){_0x35e304['body'][_0x0e63('0x18')][_0x0e63('0x1d')]=_0x500458[_0x0e63('0x1e')];}}logger['info'](JSON['stringify'](_0x35e304));return rp(_0x35e304);});}; \ No newline at end of file +var _0x76a3=['callerid','calleridname','extension','Bearer\x20','access_token','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type'];(function(_0x34c228,_0x5996ec){var _0x2a687c=function(_0x51b678){while(--_0x51b678){_0x34c228['push'](_0x34c228['shift']());}};_0x2a687c(++_0x5996ec);}(_0x76a3,0xf8));var _0x376a=function(_0x5ef905,_0x564b87){_0x5ef905=_0x5ef905-0x0;var _0x367808=_0x76a3[_0x5ef905];return _0x367808;};'use strict';var rp=require(_0x376a('0x0'));var url=require(_0x376a('0x1'));var logger=require(_0x376a('0x2'))(_0x376a('0x3'));module[_0x376a('0x4')]=function(_0x13385a,_0x36d708){var _0x433678={'method':_0x376a('0x5'),'uri':url[_0x376a('0x6')](_0x36d708['ndauth_url'],'/token'),'form':{'grant_type':_0x376a('0x7'),'username':_0x36d708[_0x376a('0x8')],'password':_0x36d708[_0x376a('0x7')]},'json':!![]};return rp(_0x433678)[_0x376a('0x9')](function(_0x548516){var _0x3e2261={'method':_0x376a('0x5'),'uri':url[_0x376a('0x6')](_0x36d708[_0x376a('0xa')],_0x376a('0xb')),'body':{'type':_0x36d708[_0x376a('0xc')]||'message','channelId':'Nda','conversation':{'id':_0x13385a['uniqueid']},'from':{'id':_0x13385a[_0x376a('0xd')],'name':_0x13385a[_0x376a('0xe')]},'recipient':{'id':_0x13385a['dnid'],'name':_0x13385a[_0x376a('0xf')]},'text':_0x36d708['text'],'channelData':{}},'headers':{'Authorization':_0x376a('0x10')+_0x548516[_0x376a('0x11')]},'json':!![]};if(_0x36d708['project']){_0x3e2261[_0x376a('0x12')][_0x376a('0x13')][_0x376a('0x14')]=_0x36d708['project'];}if(_0x36d708[_0x376a('0x15')]=='1'){_0x3e2261['body'][_0x376a('0x13')][_0x376a('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x376a('0x17')};}if(_0x36d708[_0x376a('0x18')]){_0x3e2261[_0x376a('0x12')][_0x376a('0x13')][_0x376a('0x19')]=_0x36d708[_0x376a('0x18')];if(_0x36d708['custom_action_data']){_0x3e2261[_0x376a('0x12')][_0x376a('0x13')]['CustomActionData']=_0x36d708[_0x376a('0x1a')];}}logger[_0x376a('0x1b')](JSON[_0x376a('0x1c')](_0x3e2261));return rp(_0x3e2261);});}; \ 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 1c254cb..636a024 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 _0x4cbd=['exports','./lib/api'];(function(_0x9c0ce1,_0x1d8378){var _0x1d0876=function(_0x6b09f4){while(--_0x6b09f4){_0x9c0ce1['push'](_0x9c0ce1['shift']());}};_0x1d0876(++_0x1d8378);}(_0x4cbd,0xa9));var _0xd4cb=function(_0x48466b,_0x24c497){_0x48466b=_0x48466b-0x0;var _0x488ce0=_0x4cbd[_0x48466b];return _0x488ce0;};'use strict';var asr=require(_0xd4cb('0x0'));module[_0xd4cb('0x1')]=function(_0x2604df,_0xf4fb89,_0x13f968,_0x267aaa){return asr(_0x2604df,_0xf4fb89,_0x13f968,_0x267aaa);}; \ No newline at end of file +var _0x4ccc=['exports'];(function(_0x29dfa0,_0x2d166b){var _0x41deb0=function(_0x40c0e8){while(--_0x40c0e8){_0x29dfa0['push'](_0x29dfa0['shift']());}};_0x41deb0(++_0x2d166b);}(_0x4ccc,0xa3));var _0xc4cc=function(_0x17b796,_0x13308a){_0x17b796=_0x17b796-0x0;var _0x436adc=_0x4ccc[_0x17b796];return _0x436adc;};'use strict';var asr=require('./lib/api');module[_0xc4cc('0x0')]=function(_0x154cfa,_0x11c456,_0x486f66,_0x1de6c1){return asr(_0x154cfa,_0x11c456,_0x486f66,_0x1de6c1);}; \ 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 3b7ee7e..9765da9 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 _0x23b8=['isObject','open','message','bluebird','lodash','moment','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','EOS','Tilde\x20ASR\x20send\x20error','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','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','terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil'];(function(_0xae1a1a,_0x44ee80){var _0x1e1f37=function(_0x4b2494){while(--_0x4b2494){_0xae1a1a['push'](_0xae1a1a['shift']());}};_0x1e1f37(++_0x44ee80);}(_0x23b8,0xf9));var _0x823b=function(_0x4a690d,_0x51473d){_0x4a690d=_0x4a690d-0x0;var _0x31e44c=_0x23b8[_0x4a690d];return _0x31e44c;};'use strict';var BPromise=require(_0x823b('0x0'));var _=require(_0x823b('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x823b('0x2'));var crypto=require('crypto');var logger=require(_0x823b('0x3'))(_0x823b('0x4'));module[_0x823b('0x5')]=function(_0x26aad1,_0x37dc9e,_0x562522,_0x517a98){return new BPromise(function(_0x4bf92d,_0x2bfab5){logger[_0x823b('0x6')](_0x823b('0x7'),_0x517a98||_0x823b('0x8'));var _0xed4c22=new WebSocket(_0x517a98||_0x823b('0x8'),{'perMessageDeflate':![]});var _0x3b0890='';var _0x5abf4f='0';var _0xd44bf2='1';var _0x32b05c=_0x823b('0x9');function _0x128ee1(_0x4bf119){var _0x9f1d65=crypto[_0x823b('0xa')](_0x823b('0xb'));_0x9f1d65[_0x823b('0xc')](_0x4bf119);return _0x9f1d65[_0x823b('0xd')]('hex');}function _0x2096ad(){try{logger[_0x823b('0x6')](_0x823b('0xe'));var _0x169d72=moment()[_0x823b('0xf')]();var _0x42c892=_0x128ee1(_0x169d72+_0x37dc9e+_0x562522);_0xed4c22[_0x823b('0x10')](JSON[_0x823b('0x11')]({'appID':_0x37dc9e,'timestamp':_0x169d72,'appKey':_0x42c892}));var _0x8960f3=fs['createReadStream'](_0x26aad1);_0x8960f3['on'](_0x823b('0x12'),function(_0x1b455){_0xed4c22['send'](_0x1b455);});_0x8960f3['on'](_0x823b('0x13'),function(){_0xed4c22[_0x823b('0x10')](_0x823b('0x14'));});}catch(_0x5abe58){logger['error'](_0x823b('0x15'),JSON[_0x823b('0x11')](_0x5abe58));_0xed4c22['terminate']();}}function _0x495625(_0x50e50b){try{if(_0x50e50b){var _0x288147=JSON[_0x823b('0x16')](_0x50e50b);switch(_0x288147[_0x823b('0x17')]){case 0x0:if(_0x288147[_0x823b('0x18')]){if(_0x288147['result'][_0x823b('0x19')]){logger[_0x823b('0x6')](_0x823b('0x1a'),JSON[_0x823b('0x11')](_0x288147[_0x823b('0x18')]['hypotheses']));_0x3b0890=_0x288147[_0x823b('0x18')][_0x823b('0x1b')][0x0]['transcript'];_0x5abf4f=_0x288147[_0x823b('0x18')][_0x823b('0x1b')][0x0][_0x823b('0x1c')];_0xd44bf2='0';_0x32b05c='Success.';_0xed4c22['terminate']();}}break;case 0x1:logger[_0x823b('0x6')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0xd44bf2='1';_0x32b05c=_0x823b('0x9');break;case 0x2:logger[_0x823b('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0xd44bf2='2';_0x32b05c=_0x823b('0x1d');break;case 0x9:logger[_0x823b('0x6')](_0x823b('0x1e'));_0xd44bf2='9';_0x32b05c=_0x823b('0x1e');break;case 0xa:logger[_0x823b('0x6')]('Authentication\x20failed.');_0xd44bf2='10';_0x32b05c=_0x823b('0x1f');break;case 0xb:logger[_0x823b('0x6')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0xd44bf2='11';_0x32b05c=_0x823b('0x20');}}}catch(_0x5a01e3){logger[_0x823b('0x21')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x823b('0x11')](_0x5a01e3));_0xed4c22[_0x823b('0x22')]();}}function _0x3d482b(){logger['info'](_0x823b('0x23'));_0x4bf92d({'transcript':_0x3b0890,'confidence':_0x5abf4f,'status':_0xd44bf2,'status_message':_0x32b05c});}function _0x3584c0(_0x2eb04a){logger[_0x823b('0x21')](_0x823b('0x24'));if(!_[_0x823b('0x25')](_0x2eb04a)){logger['error'](_[_0x823b('0x26')](_0x2eb04a)?JSON[_0x823b('0x11')](_0x2eb04a):_0x2eb04a);}}_0xed4c22['on'](_0x823b('0x27'),_0x2096ad);_0xed4c22['on'](_0x823b('0x28'),_0x495625);_0xed4c22['on']('close',_0x3d482b);_0xed4c22['on'](_0x823b('0x21'),_0x3584c0);});}; \ No newline at end of file +var _0xba9e=['Tilde\x20ASR\x20send\x20error','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','close','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','stringify','createReadStream','data','send','EOS'];(function(_0x3512f9,_0x32aa57){var _0x15e389=function(_0x53e61c){while(--_0x53e61c){_0x3512f9['push'](_0x3512f9['shift']());}};_0x15e389(++_0x32aa57);}(_0xba9e,0x1eb));var _0xeba9=function(_0x16aa06,_0x502d62){_0x16aa06=_0x16aa06-0x0;var _0xf28a7e=_0xba9e[_0x16aa06];return _0xf28a7e;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require(_0xeba9('0x0'))('agi');module[_0xeba9('0x1')]=function(_0x585a2b,_0x27669d,_0x52edb4,_0xbd879c){return new BPromise(function(_0x47da09,_0x3af3a4){logger[_0xeba9('0x2')](_0xeba9('0x3'),_0xbd879c||_0xeba9('0x4'));var _0x4b15e2=new WebSocket(_0xbd879c||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x560493='';var _0x199da2='0';var _0x370c43='1';var _0x4067cc=_0xeba9('0x5');function _0x33e0b3(_0x3f3364){var _0x566f21=crypto[_0xeba9('0x6')](_0xeba9('0x7'));_0x566f21[_0xeba9('0x8')](_0x3f3364);return _0x566f21['digest'](_0xeba9('0x9'));}function _0x1b2814(){try{logger[_0xeba9('0x2')](_0xeba9('0xa'));var _0x4a3ae8=moment()['unix']();var _0x532bca=_0x33e0b3(_0x4a3ae8+_0x27669d+_0x52edb4);_0x4b15e2['send'](JSON[_0xeba9('0xb')]({'appID':_0x27669d,'timestamp':_0x4a3ae8,'appKey':_0x532bca}));var _0x4775f7=fs[_0xeba9('0xc')](_0x585a2b);_0x4775f7['on'](_0xeba9('0xd'),function(_0x5180b4){_0x4b15e2[_0xeba9('0xe')](_0x5180b4);});_0x4775f7['on']('close',function(){_0x4b15e2[_0xeba9('0xe')](_0xeba9('0xf'));});}catch(_0x3c39d3){logger['error'](_0xeba9('0x10'),JSON['stringify'](_0x3c39d3));_0x4b15e2['terminate']();}}function _0x3da8e0(_0xb0c0e3){try{if(_0xb0c0e3){var _0x4d3775=JSON[_0xeba9('0x11')](_0xb0c0e3);switch(_0x4d3775[_0xeba9('0x12')]){case 0x0:if(_0x4d3775[_0xeba9('0x13')]){if(_0x4d3775[_0xeba9('0x13')][_0xeba9('0x14')]){logger[_0xeba9('0x2')](_0xeba9('0x15'),JSON[_0xeba9('0xb')](_0x4d3775[_0xeba9('0x13')][_0xeba9('0x16')]));_0x560493=_0x4d3775[_0xeba9('0x13')][_0xeba9('0x16')][0x0][_0xeba9('0x17')];_0x199da2=_0x4d3775['result'][_0xeba9('0x16')][0x0]['likelihood'];_0x370c43='0';_0x4067cc=_0xeba9('0x18');_0x4b15e2[_0xeba9('0x19')]();}}break;case 0x1:logger['info'](_0xeba9('0x5'));_0x370c43='1';_0x4067cc=_0xeba9('0x5');break;case 0x2:logger['info'](_0xeba9('0x1a'));_0x370c43='2';_0x4067cc=_0xeba9('0x1a');break;case 0x9:logger[_0xeba9('0x2')](_0xeba9('0x1b'));_0x370c43='9';_0x4067cc=_0xeba9('0x1b');break;case 0xa:logger[_0xeba9('0x2')](_0xeba9('0x1c'));_0x370c43='10';_0x4067cc='Authentication\x20failed.';break;case 0xb:logger[_0xeba9('0x2')](_0xeba9('0x1d'));_0x370c43='11';_0x4067cc=_0xeba9('0x1d');}}}catch(_0x46ee4f){logger[_0xeba9('0x1e')](_0xeba9('0x1f'),JSON[_0xeba9('0xb')](_0x46ee4f));_0x4b15e2[_0xeba9('0x19')]();}}function _0x361270(){logger['info'](_0xeba9('0x20'));_0x47da09({'transcript':_0x560493,'confidence':_0x199da2,'status':_0x370c43,'status_message':_0x4067cc});}function _0x2c14ac(_0x1eb761){logger[_0xeba9('0x1e')](_0xeba9('0x21'));if(!_[_0xeba9('0x22')](_0x1eb761)){logger[_0xeba9('0x1e')](_[_0xeba9('0x23')](_0x1eb761)?JSON[_0xeba9('0xb')](_0x1eb761):_0x1eb761);}}_0x4b15e2['on'](_0xeba9('0x24'),_0x1b2814);_0x4b15e2['on'](_0xeba9('0x25'),_0x3da8e0);_0x4b15e2['on'](_0xeba9('0x26'),_0x361270);_0x4b15e2['on']('error',_0x2c14ac);});}; \ 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 b87a493..78a98c1 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 _0x4b6c=['exports'];(function(_0x37827e,_0x14f6c6){var _0x180b9a=function(_0x445764){while(--_0x445764){_0x37827e['push'](_0x37827e['shift']());}};_0x180b9a(++_0x14f6c6);}(_0x4b6c,0x172));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};var asr=require('./asr');module[_0xc4b6('0x0')]={'asr':asr}; \ No newline at end of file +var _0xec05=['exports','./asr'];(function(_0xbc6a44,_0x332ae9){var _0x22bb50=function(_0x40e28d){while(--_0x40e28d){_0xbc6a44['push'](_0xbc6a44['shift']());}};_0x22bb50(++_0x332ae9);}(_0xec05,0x11d));var _0x5ec0=function(_0x1976dc,_0xdae9c8){_0x1976dc=_0x1976dc-0x0;var _0xef2542=_0xec05[_0x1976dc];return _0xef2542;};var asr=require(_0x5ec0('0x0'));module[_0x5ec0('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 2c9dbf7..f8664b7 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 _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x81dcac,_0x8ff7db){var _0xc7803b=function(_0x499b29){while(--_0x499b29){_0x81dcac['push'](_0x81dcac['shift']());}};_0xc7803b(++_0x8ff7db);}(_0xe706,0xa3));var _0x6e70=function(_0x641afe,_0x22d726){_0x641afe=_0x641afe-0x0;var _0x2dfe9a=_0xe706[_0x641afe];return _0x2dfe9a;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 28295be..cf24daf 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 _0x3baf=['Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','SIP/%s','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','toUpperCase','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','username','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','phone','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','getdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','appsecret','no\x20appsecret\x20configured','beep','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','false','gotoiftime','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','failure','logout','no\x20find\x20by\x20configured','AGENT\x20%s\x20NOT\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','menu','Enter\x20in\x20MENU\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','digit','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','gosub','position','record','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','getMailAccount','account_id','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','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','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getSquareProject','getSquareProjectById','getSquareOdbcById','dsn','getUser','getTrunkById','getSound','getSoundPath','sendMailMessage','getIntervals','map','Intervals','interval','format','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPause','agentPause','agent','agentUnpause','agentLogout','internal','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','includes','POST','method','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','ispeechASR','ispeech_asr_language','model','awsPolly','aws_polly_region','aws_polly_voice','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','agicommand','hasOwnProperty','isString','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','split','replaceAll','extra','replaceAllVariables','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','noop','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','result','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','delay','add','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database'];(function(_0x1187f8,_0x6b1fd4){var _0x3a5535=function(_0x4f03ca){while(--_0x4f03ca){_0x1187f8['push'](_0x1187f8['shift']());}};_0x3a5535(++_0x6b1fd4);}(_0x3baf,0xf7));var _0xf3ba=function(_0x1b70f7,_0xd1d2c8){_0x1b70f7=_0x1b70f7-0x0;var _0x18f09f=_0x3baf[_0x1b70f7];return _0x18f09f;};'use strict';var fs=require('fs');var util=require(_0xf3ba('0x0'));var _=require(_0xf3ba('0x1'));var sh=require(_0xf3ba('0x2'));var odbc=require(_0xf3ba('0x3'))();var rs=require(_0xf3ba('0x4'));var moment=require(_0xf3ba('0x5'));var Mustache=require(_0xf3ba('0x6'));var rp=require(_0xf3ba('0x7'));var logger=require(_0xf3ba('0x8'))(_0xf3ba('0x9'));var config=require(_0xf3ba('0xa'));var scripts=require(_0xf3ba('0xb'));var FILES_PATH=_0xf3ba('0xc');var recursiveMapAttributes=[_0xf3ba('0xd'),_0xf3ba('0xe')];var verticesWithRetry=['menu','getdigits','getsecretdigits'];var AGIVertices=function(_0x32f810,_0x5affaf,_0x346f5b){this[_0xf3ba('0xf')]=_0x32f810;this[_0xf3ba('0x10')]=_0x5affaf;this[_0xf3ba('0x11')]=_0x346f5b;};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x13')]=function(_0x3c7c1d,_0x318b41){this[_0xf3ba('0x10')][_0xf3ba('0x14')](_0x3c7c1d)[_0xf3ba('0x15')](function(_0x3f9ed8){_0x318b41(null,_0x3f9ed8?_0x3f9ed8[_0xf3ba('0x16')]:![]);})[_0xf3ba('0x17')](function(_0x26cefe){_0x318b41(_0x26cefe);});};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x18')]=function(_0x3e44d6,_0x505b8d){this[_0xf3ba('0x10')]['getVoiceQueueById'](_0x3e44d6)[_0xf3ba('0x15')](function(_0x345fc9){_0x505b8d(null,_0x345fc9?_0x345fc9[_0xf3ba('0x16')]:![]);})[_0xf3ba('0x17')](function(_0x235c8a){_0x505b8d(_0x235c8a);});};AGIVertices['prototype'][_0xf3ba('0x19')]=function(_0x29e45b,_0x13d899){this['rpc'][_0xf3ba('0x1a')](_0x29e45b)[_0xf3ba('0x15')](function(_0x430d64){_0x13d899(null,_0x430d64?_0x430d64[_0xf3ba('0x16')]:![]);})['catch'](function(_0x1e18ed){_0x13d899(_0x1e18ed);});};AGIVertices[_0xf3ba('0x12')]['getSquareOdbc']=function(_0x479d65,_0x35a03c){this[_0xf3ba('0x10')][_0xf3ba('0x1b')](_0x479d65)['then'](function(_0x375bcf){_0x35a03c(null,_0x375bcf?_0x375bcf[_0xf3ba('0x1c')]:![]);})[_0xf3ba('0x17')](function(_0x7ebcea){_0x35a03c(_0x7ebcea);});};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x1d')]=function(_0x168961,_0x4caf74){this['rpc']['getUserById'](_0x168961)[_0xf3ba('0x15')](function(_0x220588){_0x4caf74(null,_0x220588?_0x220588[_0xf3ba('0x16')]:![]);})[_0xf3ba('0x17')](function(_0x2cc01a){_0x4caf74(_0x2cc01a);});};AGIVertices['prototype']['getTrunk']=function(_0x37fdda,_0xd6c2da){this['rpc'][_0xf3ba('0x1e')](_0x37fdda)[_0xf3ba('0x15')](function(_0x59ce48){_0xd6c2da(null,_0x59ce48?_0x59ce48['name']:![]);})[_0xf3ba('0x17')](function(_0x7effa1){_0xd6c2da(_0x7effa1);});};AGIVertices['prototype'][_0xf3ba('0x1f')]=function(_0x318817,_0x15ac44){var _0x5a880e=this;this[_0xf3ba('0x10')]['getSoundById'](_0x318817)['then'](function(_0x7c1a60){_0x15ac44(null,_0x7c1a60?_0x5a880e[_0xf3ba('0x20')](_0x7c1a60['save_name']):![]);})[_0xf3ba('0x17')](function(_0x118aeb){_0x15ac44(_0x118aeb);});};AGIVertices['prototype']['getMailAccount']=function(_0x49f234,_0x1c6062){this[_0xf3ba('0x10')]['getMailAccountById'](_0x49f234)[_0xf3ba('0x15')](function(_0x5b2f0d){_0x1c6062(null,_0x5b2f0d?_0x5b2f0d:![]);})['catch'](function(_0x28dee0){_0x1c6062(_0x28dee0);});};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x21')]=function(_0x7af1e4,_0x1df823,_0xf1b77a){this['mailRpc'][_0xf3ba('0x21')](_0x7af1e4,_0x1df823)['then'](function(){_0xf1b77a(null);})[_0xf3ba('0x17')](function(_0x44c489){_0xf1b77a(_0x44c489);});};AGIVertices['prototype'][_0xf3ba('0x22')]=function(_0x36b6a1,_0x23ccad){this[_0xf3ba('0x10')]['getIntervalById'](_0x36b6a1)[_0xf3ba('0x15')](function(_0x553573){if(_0x553573){if(_0x553573['IntervalId']){_0x23ccad(null,[_0x553573['interval']]);}else{_0x23ccad(null,_[_0xf3ba('0x23')](_0x553573[_0xf3ba('0x24')],_0xf3ba('0x25')));}}else{_0x23ccad(null,![]);}})[_0xf3ba('0x17')](function(_0x3bab98){_0x23ccad(_0x3bab98);});};AGIVertices['prototype'][_0xf3ba('0x20')]=function(_0x47f269){return util[_0xf3ba('0x26')]('%s/sounds/converted/%s',FILES_PATH,_0x47f269);};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x27')]=function(_0x4232e0,_0x1607a4,_0x55d9be){odbc[_0xf3ba('0x28')](_0x4232e0,function(_0x416393){if(_0x416393){logger['error'](_0xf3ba('0x29'),_0x416393);_0x55d9be(_0x416393);}else{logger[_0xf3ba('0x2a')](_0xf3ba('0x2b'));odbc[_0xf3ba('0x2c')](_0x1607a4,function(_0x468dee,_0x196ab2){if(_0x468dee){logger[_0xf3ba('0x2a')]('Error\x20executing\x20query\x20%s',_0x1607a4);_0x55d9be(_0x468dee);}else{logger[_0xf3ba('0x2a')]('Query\x20executed\x20correctly\x20%s',_0x1607a4);odbc[_0xf3ba('0x2d')](function(_0x5a5ed3){if(_0x5a5ed3){logger[_0xf3ba('0x2e')](_0xf3ba('0x2f'),_0x5a5ed3);}_0x55d9be(null,_0x196ab2);});}});}});};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x30')]=function(_0x2cbfca,_0x5f3dcc){this['rpc'][_0xf3ba('0x31')](_0x2cbfca)[_0xf3ba('0x15')](function(_0x417911){_0x5f3dcc(null,_0x417911?_0x417911:![]);})[_0xf3ba('0x17')](function(_0xd51c31){_0x5f3dcc(_0xd51c31);});};AGIVertices[_0xf3ba('0x12')]['createSmsMessage']=function(_0x1859f6,_0x4b9c9e){this[_0xf3ba('0x10')][_0xf3ba('0x32')](_0x1859f6)[_0xf3ba('0x15')](function(_0xa7fd7f){_0x4b9c9e(null,_0xa7fd7f);})[_0xf3ba('0x17')](function(_0x1e2de8){_0x4b9c9e(_0x1e2de8);});};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x33')]=function(_0x5b9a0c,_0xd15662,_0x2ab55d){this[_0xf3ba('0x10')][_0xf3ba('0x33')]({'uniqueid':this[_0xf3ba('0xf')][_0xf3ba('0x34')],'node':_0x5b9a0c[_0xf3ba('0x35')],'application':_0x5b9a0c['agicommand'],'data':_0xd15662||null,'project_name':this[_0xf3ba('0xf')][_0xf3ba('0x36')],'callerid':this['channel'][_0xf3ba('0x37')]})[_0xf3ba('0x15')](function(_0x13f42a){if(_0x2ab55d){_0x2ab55d(null,_0x13f42a);}})[_0xf3ba('0x17')](function(_0x3c454e){if(_0x2ab55d){_0x2ab55d(_0x3c454e);}});};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x38')]=function(_0x166e69,_0x2a6255,_0x140312,_0x2768f0){this[_0xf3ba('0x10')][_0xf3ba('0x38')]({'uniqueid':this[_0xf3ba('0xf')][_0xf3ba('0x34')],'callerid':this[_0xf3ba('0xf')][_0xf3ba('0x37')],'calleridname':this[_0xf3ba('0xf')]['calleridname'],'context':this[_0xf3ba('0xf')][_0xf3ba('0x39')],'extension':this['channel'][_0xf3ba('0x3a')],'priority':this[_0xf3ba('0xf')][_0xf3ba('0x3b')],'accountcode':this[_0xf3ba('0xf')]['accountcode'],'dnid':this['channel'][_0xf3ba('0x3c')],'projectName':this[_0xf3ba('0xf')][_0xf3ba('0x36')],'saveName':_0x2a6255,'filename':_0x166e69[_0xf3ba('0x3d')]||_0x2a6255,'savePath':_0x140312})['then'](function(_0x2d3a0d){_0x2768f0(null,_0x2d3a0d);})[_0xf3ba('0x17')](function(_0x221050){_0x2768f0(_0x221050);});};AGIVertices['prototype'][_0xf3ba('0x3e')]=function(_0x425304,_0x3dd531,_0x3639d2,_0x18f913,_0xaaf8b){this[_0xf3ba('0x10')][_0xf3ba('0x3e')]({'uniqueid':this[_0xf3ba('0xf')][_0xf3ba('0x34')],'body':_0x425304,'direction':_0x3dd531,'providerName':_0x3639d2,'providerResponse':_0x18f913})['then'](function(_0x5a30f9){if(_0xaaf8b){_0xaaf8b(null,_0x5a30f9);}})[_0xf3ba('0x17')](function(_0x41c4c6){if(_0xaaf8b){_0xaaf8b(_0x41c4c6);}});};AGIVertices[_0xf3ba('0x12')]['createCmContact']=function(_0x443845,_0x5e275b){this['rpc'][_0xf3ba('0x3f')]({'firstName':_[_0xf3ba('0x40')](_0x443845[_0xf3ba('0x16')])||_[_0xf3ba('0x41')](_0x443845[_0xf3ba('0x16')])?_0xf3ba('0x42')+Math[_0xf3ba('0x43')]():_0x443845[_0xf3ba('0x16')],'lastName':_['isEmpty'](_0x443845[_0xf3ba('0x44')])||_[_0xf3ba('0x41')](_0x443845[_0xf3ba('0x44')])?null:_0x443845[_0xf3ba('0x44')],'phone':_0x443845['phone'],'ListId':_0x443845['list_id'],'scheduledat':_0x443845[_0xf3ba('0x45')],'callbackUniqueid':this[_0xf3ba('0xf')][_0xf3ba('0x34')],'tags':_0xf3ba('0x46'),'description':_0xf3ba('0x47')+_0x443845['scheduledAt'][_0xf3ba('0x48')](),'priority':_0x443845['callback_priority']})[_0xf3ba('0x15')](function(_0x5e6107){_0x5e275b(null,_0x5e6107);})[_0xf3ba('0x17')](function(_0x578000){_0x5e275b(_0x578000);});};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x49')]=function(_0x3f43db,_0x9c3326){this[_0xf3ba('0x10')]['getPauseById'](_0x3f43db)[_0xf3ba('0x15')](function(_0x461e80){_0x9c3326(null,_0x461e80?_0x461e80[_0xf3ba('0x16')]:![]);})['catch'](function(_0x2271cb){_0x9c3326(_0x2271cb);});};AGIVertices['prototype'][_0xf3ba('0x4a')]=function(_0x14b7b1,_0x471f81,_0x21b9c6){var _0x3def85={'role':_0xf3ba('0x4b')};_0x3def85[_0x14b7b1]=this[_0xf3ba('0xf')][_0xf3ba('0x37')];this[_0xf3ba('0x10')][_0xf3ba('0x4a')](_0x3def85,_0x471f81,this[_0xf3ba('0xf')]['uniqueid'])[_0xf3ba('0x15')](function(_0x530298){_0x21b9c6(null,_[_0xf3ba('0x41')](_0x530298)?![]:!![]);})[_0xf3ba('0x17')](function(_0x122e14){logger[_0xf3ba('0x2e')](_0x122e14);_0x21b9c6(null,![]);});};AGIVertices['prototype'][_0xf3ba('0x4c')]=function(_0x307a22,_0x437458){var _0x17b79c={'role':_0xf3ba('0x4b')};_0x17b79c[_0x307a22]=this[_0xf3ba('0xf')][_0xf3ba('0x37')];this[_0xf3ba('0x10')][_0xf3ba('0x4c')](_0x17b79c)[_0xf3ba('0x15')](function(_0x494c25){_0x437458(null,_['isNil'](_0x494c25)?![]:!![]);})['catch'](function(_0x5c629e){logger[_0xf3ba('0x2e')](_0x5c629e);_0x437458(null,![]);});};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x4d')]=function(_0x563a01,_0x3b188f){var _0x5797a5={'role':_0xf3ba('0x4b')};_0x5797a5[_0x563a01]=this[_0xf3ba('0xf')]['callerid'];this['rpc'][_0xf3ba('0x4d')](_0x5797a5)['then'](function(_0x2c0d34){_0x3b188f(null,_['isNil'](_0x2c0d34)?![]:!![]);})[_0xf3ba('0x17')](function(_0x370a05){logger[_0xf3ba('0x2e')](_0x370a05);_0x3b188f(null,![]);});};AGIVertices[_0xf3ba('0x12')]['agentLogin']=function(_0x386bf2,_0x5de0db){var _0x5471fb={'role':_0xf3ba('0x4b')};_0x5471fb[_0x386bf2]=this[_0xf3ba('0xf')][_0xf3ba('0x37')];var _0x2d240c=_0x386bf2!=_0xf3ba('0x4e')?util[_0xf3ba('0x26')]('%s/%s@from-sip/n',_0xf3ba('0x4f'),this[_0xf3ba('0xf')][_0xf3ba('0x37')]):undefined;this['rpc'][_0xf3ba('0x50')](_0x5471fb,_0x2d240c)[_0xf3ba('0x15')](function(_0x1eea8c){_0x5de0db(null,_[_0xf3ba('0x41')](_0x1eea8c)?![]:!![]);})['catch'](function(_0x143ceb){logger[_0xf3ba('0x2e')](_0x143ceb);_0x5de0db(null,![]);});};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x51')]=function(_0x2b90a2,_0x5b964a){sh[_0xf3ba('0x52')](_[_0xf3ba('0x53')](_0x2b90a2),function(_0x2ae7cb,_0x1d5d2a){var _0x33047b=_0x1d5d2a[_0xf3ba('0x54')](/(\r\n|\n|\r)/gm,'');_0x5b964a(null,_0x33047b);});};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x55')]=function(_0x4e20c0,_0x64f75e){scripts[_0xf3ba('0x55')](_0x4e20c0[_0xf3ba('0x56')],_0x4e20c0[_0xf3ba('0x57')]||'text',_0x4e20c0[_0xf3ba('0x58')],_0x4e20c0['languageCode']||_0xf3ba('0x59'),_0x4e20c0[_0xf3ba('0x5a')]||_0xf3ba('0x5b'),_0x4e20c0[_0xf3ba('0x5c')]||_0xf3ba('0x5d'))[_0xf3ba('0x15')](function(_0x7c61c9){_0x64f75e(null,_0x7c61c9);})[_0xf3ba('0x17')](function(_0x4808f1){_0x64f75e(_0x4808f1);});};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x5e')]=function(_0x3e9261,_0x5ed946){scripts[_0xf3ba('0x5e')](_0x3e9261[_0xf3ba('0x58')],_0x3e9261[_0xf3ba('0x5f')]||'en',0x1)[_0xf3ba('0x15')](function(_0x323fd1){_0x5ed946(null,_0x323fd1);})[_0xf3ba('0x17')](function(_0x29b120){_0x5ed946(_0x29b120);});};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x60')]=function(_0x4b4267,_0x588ef2){var _0x1060e4={'uri':_0x4b4267[_0xf3ba('0x61')],'method':_0x4b4267['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4b4267[_0xf3ba('0x62')])==='number'&&parseInt(_0x4b4267[_0xf3ba('0x62')])>=0x1?parseInt(_0x4b4267['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xf3ba('0x63')]([_0xf3ba('0x64'),'PUT'],_0x1060e4[_0xf3ba('0x65')]['toUpperCase']())){try{_0x1060e4[_0xf3ba('0x66')]=_0x4b4267[_0xf3ba('0xe')]?JSON[_0xf3ba('0x67')](_0x4b4267[_0xf3ba('0xe')]):{};}catch(_0x3203d5){logger[_0xf3ba('0x2e')](_0xf3ba('0x68'),_0x3203d5);}}try{_0x1060e4[_0xf3ba('0x69')]=_0x4b4267[_0xf3ba('0xd')]?JSON['parse'](_0x4b4267[_0xf3ba('0xd')]):{};}catch(_0x1def46){logger[_0xf3ba('0x2e')](_0xf3ba('0x6a'),_0x1def46);}if(_0x4b4267[_0xf3ba('0x6b')]){try{var _0x1e9f14=require(_0x4b4267['computedVariables'])[_0xf3ba('0x6c')](this,_0x1060e4);_0x1060e4[_0xf3ba('0x6d')]=Mustache[_0xf3ba('0x6e')](_0x4b4267['url'],_0x1e9f14,{},['$$','$$']);if(_0x1060e4[_0xf3ba('0x69')]){_0x1060e4[_0xf3ba('0x69')]=JSON[_0xf3ba('0x67')](Mustache[_0xf3ba('0x6e')](JSON[_0xf3ba('0x6f')](_0x1060e4[_0xf3ba('0x69')]),_0x1e9f14,{},['$$','$$']));}if(_0x1060e4['body']){_0x1060e4[_0xf3ba('0x66')]=JSON['parse'](Mustache['render'](JSON[_0xf3ba('0x6f')](_0x1060e4[_0xf3ba('0x66')]),_0x1e9f14,{},['$$','$$']));}}catch(_0x5c488f){logger['error'](_0xf3ba('0x70'),_0x5c488f);}}rp(_0x1060e4)[_0xf3ba('0x15')](function(_0x385141){var _0xf366be={'statusCode':_0x385141[_0xf3ba('0x71')]||0xc8,'statusMessage':_0x385141[_0xf3ba('0x72')]||'OK','headers':_0x385141[_0xf3ba('0x69')]||{},'body':_0x385141['body']||{}};_0x588ef2(null,_0xf366be);})[_0xf3ba('0x17')](function(_0x118b25){var _0x4de6d1={'statusCode':_0x118b25[_0xf3ba('0x71')]||0x1f4,'statusMessage':_0x118b25[_0xf3ba('0x73')]||_0xf3ba('0x74'),'headers':_0x118b25[_0xf3ba('0x75')][_0xf3ba('0x69')]||{},'body':_0x118b25[_0xf3ba('0x75')][_0xf3ba('0x66')]||{}};_0x588ef2(null,_0x4de6d1);});};AGIVertices[_0xf3ba('0x12')]['googleDialogflow']=function(_0x504e6a,_0x5626a1){scripts[_0xf3ba('0x76')](this[_0xf3ba('0xf')]['uniqueid'],_0x504e6a['key'],_0x504e6a['text'],_0x504e6a[_0xf3ba('0x77')]||'en')[_0xf3ba('0x15')](function(_0x5cf8ec){_0x5626a1(null,_0x5cf8ec);})[_0xf3ba('0x17')](function(_0x3eee19){_0x5626a1(_0x3eee19);});};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x78')]=function(_0x41eb6b,_0x2cd284){scripts[_0xf3ba('0x78')](this[_0xf3ba('0xf')][_0xf3ba('0x34')],_0x41eb6b['dialogflowV2_project_id'],_0x41eb6b[_0xf3ba('0x79')],_0x41eb6b[_0xf3ba('0x7a')],_0x41eb6b[_0xf3ba('0x58')],_0x41eb6b[_0xf3ba('0x7b')]||'en')[_0xf3ba('0x15')](function(_0x15fd50){_0x2cd284(null,_0x15fd50);})[_0xf3ba('0x17')](function(_0x28b3cb){_0x2cd284(_0x28b3cb);});};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x7c')]=function(_0x3c9f0e,_0x48540c){scripts[_0xf3ba('0x7c')](this[_0xf3ba('0xf')],_0x3c9f0e)['then'](function(_0x7e602f){_0x48540c(null,_0x7e602f);})[_0xf3ba('0x17')](function(_0x1ea8e3){_0x48540c(_0x1ea8e3);});};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x7d')]=function(_0x17adc6,_0x4c74f3){scripts[_0xf3ba('0x7d')](_0x17adc6[_0xf3ba('0x7e')],_0x17adc6[_0xf3ba('0x58')],_0x17adc6[_0xf3ba('0x7f')]||_0xf3ba('0x59'),_0x17adc6['speed'])[_0xf3ba('0x15')](function(_0x46c4d8){_0x4c74f3(null,_0x46c4d8);})['catch'](function(_0xa74c81){_0x4c74f3(_0xa74c81);});};AGIVertices[_0xf3ba('0x12')]['ispeechASR']=function(_0x88558e,_0x112377,_0x4b4a81){scripts[_0xf3ba('0x80')](_0x112377,_0x88558e[_0xf3ba('0x7e')],_0x88558e[_0xf3ba('0x81')]||_0xf3ba('0x59'),this['isConfigured'](_0x88558e[_0xf3ba('0x82')])?_0x88558e[_0xf3ba('0x82')]:undefined)[_0xf3ba('0x15')](function(_0x5d35d0){_0x4b4a81(null,_0x5d35d0);})[_0xf3ba('0x17')](function(_0x1a7232){_0x4b4a81(_0x1a7232);});};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x83')]=function(_0xce585b,_0x6e4f1c){scripts[_0xf3ba('0x83')](_0xce585b['aws_access_key_id'],_0xce585b['aws_secret_access_key'],_0xce585b[_0xf3ba('0x84')],_0xce585b[_0xf3ba('0x85')]||'Amy',_0xce585b['text'],_0xce585b['aws_text_type']||_0xf3ba('0x58'))[_0xf3ba('0x15')](function(_0x523481){_0x6e4f1c(null,_0x523481);})[_0xf3ba('0x17')](function(_0x1109cb){_0x6e4f1c(_0x1109cb);});};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x86')]=function(_0x44b128,_0x547bde){scripts[_0xf3ba('0x86')](this[_0xf3ba('0xf')]['uniqueid'],_0x44b128['aws_access_key_id'],_0x44b128[_0xf3ba('0x87')],_0x44b128[_0xf3ba('0x88')],_0x44b128[_0xf3ba('0x58')],_0x44b128[_0xf3ba('0x89')])['then'](function(_0x295add){_0x547bde(null,_0x295add);})['catch'](function(_0x49e0d7){_0x547bde(_0x49e0d7);});};AGIVertices['prototype']['googleASR']=function(_0xac1066,_0x3dda7a,_0x186d07){scripts[_0xf3ba('0x8a')](_0x3dda7a,_0xac1066[_0xf3ba('0x7e')],_0xac1066[_0xf3ba('0x8b')]||'en-US')[_0xf3ba('0x15')](function(_0x5076d7){_0x186d07(null,_0x5076d7);})[_0xf3ba('0x17')](function(_0x357c2){_0x186d07(_0x357c2);});};AGIVertices[_0xf3ba('0x12')]['tildeASR']=function(_0x37d796,_0x40c86d,_0x507082){scripts[_0xf3ba('0x8c')](_0x40c86d,_0x37d796[_0xf3ba('0x8d')],_0x37d796['appsecret'],_0x37d796[_0xf3ba('0x6d')])[_0xf3ba('0x15')](function(_0x17bf7f){_0x507082(null,_0x17bf7f);})[_0xf3ba('0x17')](function(_0x5b6965){_0x507082(_0x5b6965);});};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x8e')]=function(_0x1df257){var _0x125aee=_[_0xf3ba('0x63')](verticesWithRetry,_0x1df257[_0xf3ba('0x8f')])?_0x1df257:_['clone'](_0x1df257);for(var _0x503358 in _0x125aee){if(_0x125aee[_0xf3ba('0x90')](_0x503358)){if(_0x125aee[_0x503358]&&_[_0xf3ba('0x91')](_0x125aee[_0x503358])){if(_[_0xf3ba('0x63')](recursiveMapAttributes,_0x503358)){_0x125aee[_0x503358]=this['replaceObjectAllVariables'](_0x125aee[_0x503358]);}else{_0x125aee[_0x503358]=this['replaceAllVariables'](_0x125aee[_0x503358]);}}}}return _0x125aee;};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x92')]=function(_0x50402d){for(var _0x512e62 in _0x50402d){if(_0x50402d['hasOwnProperty'](_0x512e62)){if(_[_0xf3ba('0x93')](_0x50402d[_0x512e62])){this['recursiveNodeIndex'](_0x50402d[_0x512e62]);}else if(_[_0xf3ba('0x94')](_0x50402d[_0x512e62])){for(var _0x5de5bc=0x0;_0x5de5bc<_0x50402d[_0x512e62][_0xf3ba('0x95')];_0x5de5bc++){this[_0xf3ba('0x92')](_0x50402d[_0x512e62][_0x5de5bc]);}}else if(_[_0xf3ba('0x91')](_0x50402d[_0x512e62])){_0x50402d[_0x512e62]=this['replaceAllVariables'](_0x50402d[_0x512e62]);}}}};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x96')]=function(_0x3d41e3,_0x4f922f){for(var _0x1f27e2 in _0x3d41e3){if(_0x3d41e3['hasOwnProperty'](_0x1f27e2)){if(_[_0xf3ba('0x93')](_0x3d41e3[_0x1f27e2])){if(!_[_0xf3ba('0x40')](_0x3d41e3[_0x1f27e2])){this['saveRestApiResult'](_0x3d41e3[_0x1f27e2],util[_0xf3ba('0x26')](_0xf3ba('0x97'),_0x4f922f,_0x1f27e2));}}else if(_[_0xf3ba('0x94')](_0x3d41e3[_0x1f27e2])){for(var _0x4228c0=0x0;_0x4228c0<_0x3d41e3[_0x1f27e2]['length'];_0x4228c0++){this[_0xf3ba('0x96')](_0x3d41e3[_0x1f27e2][_0x4228c0],util[_0xf3ba('0x26')](_0xf3ba('0x97'),_0x4f922f,_0x1f27e2+'['+_0x4228c0+']'));}}else{if(!_[_0xf3ba('0x41')](_0x3d41e3[_0x1f27e2])){this[_0xf3ba('0xf')][_0xf3ba('0x98')](util['format'](_0xf3ba('0x97'),_0x4f922f,_0x1f27e2),_0x3d41e3[_0x1f27e2]);}}}}};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x99')]=function(_0x3b02ca){try{var _0x320cd1=JSON[_0xf3ba('0x67')](_0x3b02ca);this[_0xf3ba('0x92')](_0x320cd1);return JSON['stringify'](_0x320cd1);}catch(_0x59eb28){return this['replaceAllVariables'](_0x3b02ca);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x596eab){var _0x14176c=_0x596eab[_0xf3ba('0x9a')]('{');for(var _0x41958e=0x1;_0x41958e<_0x14176c['length'];_0x41958e+=0x1){var _0x386c5c=_0x14176c[_0x41958e]['split']('}');if(_0x386c5c[_0xf3ba('0x95')]>0x1){_0x596eab=_0x596eab[_0xf3ba('0x9b')]('{'+_0x386c5c[0x0]+'}',this['channel']['getVariable'](_0x386c5c[0x0])[_0xf3ba('0x9c')]||_0x386c5c[0x0]);}}if(_0x14176c[_0xf3ba('0x95')]===0x1){return _0x596eab[_0xf3ba('0x48')]();}return this[_0xf3ba('0x9d')](_0x596eab);};AGIVertices[_0xf3ba('0x12')]['getAndSetVariable']=function(_0x215fa3,_0x34a2e){var _0x159a10=this[_0xf3ba('0xf')][_0xf3ba('0x13')](_0x215fa3);if(_0x159a10['result']===-0x1){return _0x159a10;}logger['info'](util['format'](_0xf3ba('0x9e'),_0x34a2e,_0x159a10[_0xf3ba('0x9c')]));return this['channel'][_0xf3ba('0x98')](_0x34a2e,_0x159a10['extra']);};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x9f')]=function(_0x44ed1a){return _0x44ed1a&&_0x44ed1a!=='0'&&_0x44ed1a!=='-1'&&_0x44ed1a!=='';};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0xa0')]=function(_0x44d8d8){this[_0xf3ba('0x33')][_0xf3ba('0x6c')](this,_0x44d8d8,'-');_0x44d8d8[_0xf3ba('0xa1')]=_0x44d8d8[_0xf3ba('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0xa2')]=function(_0x4d2760){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')](_0xf3ba('0xa3'),_0x4d2760['label']));if(!this['isConfigured'](_0x4d2760[_0xf3ba('0x58')])){return this[_0xf3ba('0xf')]['noop'](_0xf3ba('0xa4'));}var _0x26c865='\x22'+_0x4d2760[_0xf3ba('0x58')]+'\x22';if(this[_0xf3ba('0x9f')](_0x4d2760[_0xf3ba('0x75')])){_0x26c865+=','+_0x4d2760[_0xf3ba('0x75')];}var _0x2cf69f=this[_0xf3ba('0xf')][_0xf3ba('0x52')](_0xf3ba('0xa5'),_0x26c865);if(_0x2cf69f['result']===-0x1){return _0x2cf69f;}return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x26c865));};AGIVertices['prototype'][_0xf3ba('0xa7')]=function(_0x4ab4ef){logger['info'](util[_0xf3ba('0x26')](_0xf3ba('0xa8'),_0x4ab4ef[_0xf3ba('0x35')]));if(!this[_0xf3ba('0x9f')](_0x4ab4ef[_0xf3ba('0xa9')])){return this[_0xf3ba('0xf')]['noop'](_0xf3ba('0xaa'));}var _0x5c10c7=_0x4ab4ef['grammar'];if(this['isConfigured'](_0x4ab4ef[_0xf3ba('0x75')])){_0x5c10c7+=','+_0x4ab4ef[_0xf3ba('0x75')];}var _0x207d03=this[_0xf3ba('0xf')][_0xf3ba('0x52')](_0xf3ba('0xab'),_0x5c10c7);if(_0x207d03[_0xf3ba('0xac')]===-0x1){return _0x207d03;}var _0x5ae88f=this[_0xf3ba('0xad')](_0xf3ba('0xae'),_0xf3ba('0xaf'));if(_0x5ae88f[_0xf3ba('0xac')]===-0x1){return _0x5ae88f;}var _0x341a83=this[_0xf3ba('0xad')](_0xf3ba('0xb0'),'MRCP_RECOG_TRANSCRIPT');if(_0x341a83[_0xf3ba('0xac')]===-0x1){return _0x341a83;}var _0x54185c=this['getAndSetVariable'](_0xf3ba('0xb1'),_0xf3ba('0xb2'));if(_0x54185c[_0xf3ba('0xac')]===-0x1){return _0x54185c;}return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util[_0xf3ba('0x26')](_0xf3ba('0xb3'),_0x5c10c7));};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x9')]=function(_0x1633ac){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')](_0xf3ba('0xb4'),_0x1633ac[_0xf3ba('0x35')]));return this['channel'][_0xf3ba('0x9')]([_0x1633ac[_0xf3ba('0xb5')],_0x1633ac[_0xf3ba('0xb6')]]);};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0xb7')]=function(_0xe6b1d){logger['info'](util[_0xf3ba('0x26')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0xe6b1d[_0xf3ba('0x35')]));if(this[_0xf3ba('0x9f')](_0xe6b1d['timeout'])){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')]('Wait\x20%s\x20seconds\x20before\x20answer',_0xe6b1d[_0xf3ba('0x62')]));var _0x166ad8=this[_0xf3ba('0xf')]['wait'](_0xe6b1d[_0xf3ba('0x62')]);if(_0x166ad8[_0xf3ba('0xac')]===-0x1){return _0x166ad8;}}return this[_0xf3ba('0xf')][_0xf3ba('0xb7')]();};AGIVertices['prototype']['callback']=function(_0x1b2bbc){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x1b2bbc['label']));if(!this[_0xf3ba('0x9f')](_0x1b2bbc['list_id'])){return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0x1b2bbc,'no\x20list\x20selected');}_0x1b2bbc[_0xf3ba('0x45')]=moment();if(this[_0xf3ba('0x9f')](_0x1b2bbc[_0xf3ba('0xb8')])){_0x1b2bbc['scheduledAt']=moment()[_0xf3ba('0xb9')](_0x1b2bbc[_0xf3ba('0xb8')],'minutes');}if(!this['isConfigured'](_0x1b2bbc['callback_priority'])){_0x1b2bbc['callback_priority']=0x2;}this['createCmContact'][_0xf3ba('0x6c')](this,_0x1b2bbc);return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util[_0xf3ba('0x26')](_0xf3ba('0xba'),_0x1b2bbc['phone'],_0x1b2bbc['list_id'],_0x1b2bbc['scheduledAt']));};AGIVertices[_0xf3ba('0x12')]['custom_app']=function(_0x5e7ef9){logger['info'](util[_0xf3ba('0x26')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x5e7ef9[_0xf3ba('0x35')]));var _0x3d889d=this['channel'][_0xf3ba('0x52')](_0x5e7ef9[_0xf3ba('0xbb')],_0x5e7ef9[_0xf3ba('0x75')]);if(_0x3d889d[_0xf3ba('0xac')]===-0x1){return _0x3d889d;}return this['channel'][_0xf3ba('0xa6')](util[_0xf3ba('0x26')](_0xf3ba('0xbc'),_0x5e7ef9[_0xf3ba('0xbb')],_0x5e7ef9['options']));};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0xbd')]=function(_0x5577a1){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')](_0xf3ba('0xbe'),_0x5577a1[_0xf3ba('0x35')]));if(!this[_0xf3ba('0x9f')](_0x5577a1[_0xf3ba('0x58')])){return this[_0xf3ba('0xf')][_0xf3ba('0xa6')]('no\x20text\x20configured');}var _0x50f58c='\x22'+_0x5577a1[_0xf3ba('0x58')]+'\x22';if(this[_0xf3ba('0x9f')](_0x5577a1[_0xf3ba('0x75')])){_0x50f58c+=','+_0x5577a1[_0xf3ba('0x75')];}var _0x53a56c=this[_0xf3ba('0xf')]['exec'](_0xf3ba('0xa5'),_0x50f58c);if(_0x53a56c['result']===-0x1){return _0x53a56c;}return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util[_0xf3ba('0x26')](_0xf3ba('0xbf'),_0x50f58c));};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0xc0')]=function(_0x1b00ac){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')](_0xf3ba('0xc1'),_0x1b00ac['label']));if(!this[_0xf3ba('0x9f')](_0x1b00ac[_0xf3ba('0x58')])){return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](_0xf3ba('0xa4'));}var _0x2a2ab7='\x22'+_0x1b00ac[_0xf3ba('0x58')]+'\x22';if(this[_0xf3ba('0x9f')](_0x1b00ac['options'])){_0x2a2ab7+=','+_0x1b00ac[_0xf3ba('0x75')];}var _0x43155b=this[_0xf3ba('0xf')][_0xf3ba('0x52')]('MRCPSynth',_0x2a2ab7);if(_0x43155b[_0xf3ba('0xac')]===-0x1){return _0x43155b;}return this['channel'][_0xf3ba('0xa6')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x2a2ab7));};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0xc2')]=function(_0xb0b785){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')](_0xf3ba('0xc3'),_0xb0b785[_0xf3ba('0x35')]));if(!this[_0xf3ba('0x9f')](_0xb0b785[_0xf3ba('0xa9')])){return this[_0xf3ba('0xf')]['noop'](_0xf3ba('0xaa'));}var _0x3747c0=_0xb0b785['grammar'];if(this[_0xf3ba('0x9f')](_0xb0b785[_0xf3ba('0x75')])){_0x3747c0+=','+_0xb0b785[_0xf3ba('0x75')];}var _0x434c26=this[_0xf3ba('0xf')]['exec'](_0xf3ba('0xab'),_0x3747c0);if(_0x434c26[_0xf3ba('0xac')]===-0x1){return _0x434c26;}var _0x318d8f=this[_0xf3ba('0xad')](_0xf3ba('0xae'),_0xf3ba('0xc4'));if(_0x318d8f[_0xf3ba('0xac')]===-0x1){return _0x318d8f;}var _0x391a41=this[_0xf3ba('0xad')](_0xf3ba('0xb0'),_0xf3ba('0xc5'));if(_0x391a41[_0xf3ba('0xac')]===-0x1){return _0x391a41;}var _0x5bce23=this['getAndSetVariable'](_0xf3ba('0xb1'),_0xf3ba('0xc6'));if(_0x5bce23[_0xf3ba('0xac')]===-0x1){return _0x5bce23;}return this['channel'][_0xf3ba('0xa6')](util[_0xf3ba('0x26')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3747c0));};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0xc7')]=function(_0x2c9685){logger[_0xf3ba('0x2a')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x2c9685[_0xf3ba('0x35')]));if(!this['isConfigured'](_0x2c9685[_0xf3ba('0xa9')])){return this['channel'][_0xf3ba('0xa6')]('no\x20grammar\x20configured');}var _0x481765=_0x2c9685[_0xf3ba('0xa9')];if(this['isConfigured'](_0x2c9685['options'])){_0x481765+=','+_0x2c9685[_0xf3ba('0x75')];}var _0x5a7212=this[_0xf3ba('0xf')][_0xf3ba('0x52')](_0xf3ba('0xab'),_0x481765);if(_0x5a7212[_0xf3ba('0xac')]===-0x1){return _0x5a7212;}var _0x4706cc=this['getAndSetVariable'](_0xf3ba('0xae'),'SESTEK_ASR_CONFIDENCE');if(_0x4706cc[_0xf3ba('0xac')]===-0x1){return _0x4706cc;}var _0x52f48e=this[_0xf3ba('0xad')](_0xf3ba('0xb0'),_0xf3ba('0xc8'));if(_0x52f48e[_0xf3ba('0xac')]===-0x1){return _0x52f48e;}var _0x48a4ec=this[_0xf3ba('0xad')](_0xf3ba('0xb1'),_0xf3ba('0xc9'));if(_0x48a4ec[_0xf3ba('0xac')]===-0x1){return _0x48a4ec;}return this['channel']['noop'](util['format'](_0xf3ba('0xb3'),_0x481765));};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0xca')]=function(_0x121912){logger['info'](util[_0xf3ba('0x26')](_0xf3ba('0xcb'),_0x121912[_0xf3ba('0x35')]));if(!this[_0xf3ba('0x9f')](_0x121912[_0xf3ba('0xcc')])){return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0x121912,'no\x20database\x20selected');}var _0x2718ab=this[_0xf3ba('0xcd')][_0xf3ba('0x6c')](this,_0x121912[_0xf3ba('0xcc')]);if(!_0x2718ab){return this['channel'][_0xf3ba('0x2e')](_0x121912,_0xf3ba('0xce'));}if(!this[_0xf3ba('0x9f')](_0x121912[_0xf3ba('0x2c')])){return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0x121912,_0xf3ba('0xcf'));}var _0x1e4632=_0x121912[_0xf3ba('0x2c')][_0xf3ba('0x54')](/(\r\n|\n|\r)/gm,'\x20');this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util[_0xf3ba('0x26')](_0xf3ba('0xd0'),_0x1e4632));var _0x2d060d=this['getQueryOdbc'][_0xf3ba('0x6c')](this,_0x2718ab,_0x1e4632);this[_0xf3ba('0x33')][_0xf3ba('0x6c')](this,_0x121912,_0x1e4632);if(!this[_0xf3ba('0x9f')](_0x121912[_0xf3ba('0xd1')])){return this['channel'][_0xf3ba('0xa6')](_0xf3ba('0xd2'));}var _0x575996=this[_0xf3ba('0x13')][_0xf3ba('0x6c')](this,_0x121912[_0xf3ba('0xd1')]);if(!_0x575996){return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0x121912,_0xf3ba('0xd3'));}var _0x22e6d4=this;_0x2d060d['forEach'](function(_0x58f9da,_0x25cc06){Object[_0xf3ba('0xd4')](_0x58f9da)[_0xf3ba('0xd5')](function(_0x2bc9a8){_0x22e6d4['channel'][_0xf3ba('0x98')](util[_0xf3ba('0x26')]('%s[%s][%s]',_0x575996,_0x25cc06,_0x2bc9a8),_0x58f9da[_0x2bc9a8]);});});this[_0xf3ba('0xf')][_0xf3ba('0x98')](util[_0xf3ba('0x26')](_0xf3ba('0xd6'),_0x575996),_0x2d060d[_0xf3ba('0x95')]);return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util['format'](_0xf3ba('0xd7'),_0x575996));};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0xd8')]=function(_0x167898){logger['debug'](util['format'](_0xf3ba('0xd9'),_0x167898[_0xf3ba('0x35')]));if(!this['isConfigured'](_0x167898[_0xf3ba('0xda')])){return this['channel']['error'](_0x167898,_0xf3ba('0xdb'));}var _0xfd3fba=this[_0xf3ba('0x1d')][_0xf3ba('0x6c')](this,_0x167898[_0xf3ba('0xda')]);if(!_0xfd3fba){return this[_0xf3ba('0xf')]['error'](_0x167898,'no\x20user\x20found');}var _0x642fff=this['channel'][_0xf3ba('0x52')](_0xf3ba('0xdc'),[util[_0xf3ba('0x26')](_0xf3ba('0xdd'),_0xfd3fba),_0x167898[_0xf3ba('0x62')],_0x167898['opts'],_0x167898[_0xf3ba('0x61')]]);if(_0x642fff[_0xf3ba('0xac')]===-0x1){return _0x642fff;}return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util[_0xf3ba('0x26')](_0xf3ba('0xde'),_0xf3ba('0xdc')));};AGIVertices['prototype']['dialogflow']=function(_0x4bc203){logger['info'](util[_0xf3ba('0x26')](_0xf3ba('0xdf'),_0x4bc203[_0xf3ba('0x35')]));if(!this[_0xf3ba('0x9f')](_0x4bc203[_0xf3ba('0x7e')])){return this[_0xf3ba('0xf')]['noop'](_0xf3ba('0xe0'));}if(!this['isConfigured'](_0x4bc203[_0xf3ba('0x58')])){return this['channel'][_0xf3ba('0xa6')](_0xf3ba('0xa4'));}this[_0xf3ba('0xf')][_0xf3ba('0xe1')]=!![];this[_0xf3ba('0x33')](_0x4bc203);this[_0xf3ba('0x3e')](_0x4bc203[_0xf3ba('0x58')],'in','','');this['channel'][_0xf3ba('0xa6')](util['format'](_0xf3ba('0xe2'),_0x4bc203['text']));var _0x4ba190=this['googleDialogflow'][_0xf3ba('0x6c')](this,_0x4bc203);if(_0x4ba190){for(var _0x5b0d39 in _0x4ba190){if(_0x4ba190[_0xf3ba('0x90')](_0x5b0d39)){this[_0xf3ba('0xf')]['setVariable'](util[_0xf3ba('0x26')](_0xf3ba('0xe3'),_0x5b0d39['toUpperCase']()),_0x4ba190[_0x5b0d39]);}}this['createSquareMessage'](_0x4ba190['speech'],_0xf3ba('0xe4'),'dialogflow','');return this[_0xf3ba('0xf')]['noop'](util[_0xf3ba('0x26')](_0xf3ba('0xe5'),_0x4ba190[_0xf3ba('0xe6')]));}return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0x4bc203,_0xf3ba('0xe7'));};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0xe8')]=function(_0x206717){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')](_0xf3ba('0xe9'),_0x206717[_0xf3ba('0x35')]));if(!this[_0xf3ba('0x9f')](_0x206717['dialogflowV2_project_id'])){return this['channel']['noop'](_0xf3ba('0xea'));}if(!this['isConfigured'](_0x206717[_0xf3ba('0x79')])){return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](_0xf3ba('0xeb'));}if(!this[_0xf3ba('0x9f')](_0x206717[_0xf3ba('0x7a')])){return this['channel'][_0xf3ba('0xa6')](_0xf3ba('0xec'));}if(!this[_0xf3ba('0x9f')](_0x206717[_0xf3ba('0x7b')])){return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](_0xf3ba('0xed'));}if(!this[_0xf3ba('0x9f')](_0x206717[_0xf3ba('0x58')])){return this[_0xf3ba('0xf')][_0xf3ba('0xa6')]('no\x20text\x20configured');}this[_0xf3ba('0xf')]['bot']=!![];this[_0xf3ba('0x33')](_0x206717);this['createSquareMessage'](_0x206717['text'],'in','','');this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util[_0xf3ba('0x26')]('Trying\x20DialogflowV2:\x20%s',_0x206717['text']));var _0x59d550=this[_0xf3ba('0x78')][_0xf3ba('0x6c')](this,_0x206717);if(_0x59d550){for(var _0x5adc24 in _0x59d550){if(_0x59d550['hasOwnProperty'](_0x5adc24)){if(_0x5adc24!==_0xf3ba('0xee')){this[_0xf3ba('0xf')][_0xf3ba('0x98')](util[_0xf3ba('0x26')](_0xf3ba('0xe3'),_0x5adc24[_0xf3ba('0xef')]()),_0x59d550[_0x5adc24]);}}}this[_0xf3ba('0x3e')](_0x59d550['speech'],_0xf3ba('0xe4'),_0xf3ba('0xe8'),_0x59d550[_0xf3ba('0xee')]);return this['channel'][_0xf3ba('0xa6')](util['format']('DialogflowV2\x20Result\x20%s',_0x59d550['speech']));}return this['channel'][_0xf3ba('0x2e')](_0x206717,_0xf3ba('0xf0'));};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0xf1')]=function(_0x10d917){logger[_0xf3ba('0x2a')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x10d917['label']));if(!this[_0xf3ba('0x9f')](_0x10d917[_0xf3ba('0xf2')])){return this[_0xf3ba('0xf')][_0xf3ba('0xa6')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xf3ba('0x9f')](_0x10d917[_0xf3ba('0xf3')])){return this[_0xf3ba('0xf')]['noop'](_0xf3ba('0xf4'));}if(!this[_0xf3ba('0x9f')](_0x10d917[_0xf3ba('0xf5')])){return this[_0xf3ba('0xf')][_0xf3ba('0xa6')]('no\x20password\x20configured');}if(!this['isConfigured'](_0x10d917[_0xf3ba('0xf6')])){return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](_0xf3ba('0xa4'));}this['channel'][_0xf3ba('0xe1')]=!![];this[_0xf3ba('0x33')](_0x10d917);this[_0xf3ba('0x3e')](_0x10d917[_0xf3ba('0x58')],'in','','');this['channel'][_0xf3ba('0xa6')](util[_0xf3ba('0x26')](_0xf3ba('0xf7'),_0x10d917[_0xf3ba('0x58')]));var _0x540b36=this[_0xf3ba('0x7c')][_0xf3ba('0x6c')](this,_0x10d917);if(_0x540b36){for(var _0x56b8d9 in _0x540b36){if(_0x540b36[_0xf3ba('0x90')](_0x56b8d9)){this['channel'][_0xf3ba('0x98')](util[_0xf3ba('0x26')](_0xf3ba('0xf8'),_0x56b8d9[_0xf3ba('0xef')]()),_0x540b36[_0x56b8d9]);}}this[_0xf3ba('0x3e')](_0x540b36[_0xf3ba('0xe6')],_0xf3ba('0xe4'),_0xf3ba('0xf1'),'');if(_0x540b36[_0xf3ba('0xf9')]){this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util['format'](_0xf3ba('0xfa'),_0x540b36['audiofile']));var _0x5ed325=this[_0xf3ba('0xf')][_0xf3ba('0xfb')](_0x540b36[_0xf3ba('0xf9')]);try{fs[_0xf3ba('0xfc')](_0x540b36[_0xf3ba('0xf9')]+_0xf3ba('0xfd'));}catch(_0x3d742c){logger[_0xf3ba('0x2e')](_0x3d742c);}return _0x5ed325;}else{return this[_0xf3ba('0xf')]['noop'](util[_0xf3ba('0x26')](_0xf3ba('0xfe'),_0x540b36[_0xf3ba('0xe6')]));}}return this[_0xf3ba('0xf')]['error'](_0x10d917,_0xf3ba('0xff'));};AGIVertices[_0xf3ba('0x12')]['end']=function(_0x1e3eba){logger[_0xf3ba('0x2a')](util['format'](_0xf3ba('0x100'),_0x1e3eba[_0xf3ba('0x35')]));return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](_0xf3ba('0x101'));};AGIVertices['prototype']['ext_dial']=function(_0x517861){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')](_0xf3ba('0x102'),_0x517861[_0xf3ba('0x35')]));var _0x44d782='';if(_0x517861[_0xf3ba('0x103')]){if(!this[_0xf3ba('0x9f')](_0x517861[_0xf3ba('0x103')])){return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0x517861,_0xf3ba('0x104'));}else{var _0x3a0ef8=parseInt(_0x517861['trunk_id'],0xa);if(isNaN(_0x3a0ef8)){_0x44d782=_0x517861[_0xf3ba('0x103')];}else{_0x44d782=this['getTrunk'][_0xf3ba('0x6c')](this,_0x517861[_0xf3ba('0x103')]);if(!_0x44d782){return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0x517861,_0xf3ba('0x105'));}}}}else if(_0x517861[_0xf3ba('0x106')]){_0x44d782=_0x517861[_0xf3ba('0x106')];}else{return this[_0xf3ba('0xf')]['error'](_0x517861,_0xf3ba('0x104'));}var _0x53d01c=this['channel'][_0xf3ba('0x52')](_0xf3ba('0xdc'),[util[_0xf3ba('0x26')](_0xf3ba('0x107'),_0x44d782,_0x517861[_0xf3ba('0x108')]),_0x517861[_0xf3ba('0x62')],_0x517861[_0xf3ba('0x109')],_0x517861[_0xf3ba('0x61')]]);if(_0x53d01c[_0xf3ba('0xac')]===-0x1){return _0x53d01c;}return this['channel'][_0xf3ba('0xa6')](util['format'](_0xf3ba('0xde'),_0xf3ba('0xdc')));};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x10a')]=function(_0x5b5b95){logger[_0xf3ba('0x2a')](util['format'](_0xf3ba('0x10b'),_0x5b5b95['label']));return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](_0xf3ba('0x10a'));};AGIVertices[_0xf3ba('0x12')]['getdigits']=function(_0xcff6ac){logger['info'](util['format'](_0xf3ba('0x10c'),_0xcff6ac[_0xf3ba('0x35')]));if(_0xcff6ac[_0xf3ba('0xa1')]===0x0){return this[_0xf3ba('0xa0')](_0xcff6ac);}_0xcff6ac[_0xf3ba('0xa1')]-=0x1;if(!this[_0xf3ba('0x9f')](_0xcff6ac['file_id'])){return this['channel'][_0xf3ba('0x2e')](_0xcff6ac,'no\x20file\x20audio\x20selected');}var _0x1f2761=this[_0xf3ba('0x1f')][_0xf3ba('0x6c')](this,_0xcff6ac['file_id']);if(!_0x1f2761){return this['channel'][_0xf3ba('0x2e')](_0xcff6ac,_0xf3ba('0x10d'));}if(!this['isConfigured'](_0xcff6ac['variable_id'])){return this[_0xf3ba('0xf')][_0xf3ba('0x2e')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1b25a3=this['channel'][_0xf3ba('0x10e')](_0x1f2761,_0xcff6ac[_0xf3ba('0x10f')],_0xcff6ac['maxdigit']);var _0x4028a6=_0x1b25a3['result']?_0x1b25a3[_0xf3ba('0xac')]['toString']():'';logger['info'](_0xf3ba('0x110'),JSON[_0xf3ba('0x6f')](_0x1b25a3));if(_0x1b25a3[_0xf3ba('0xac')]===-0x1){this[_0xf3ba('0x33')][_0xf3ba('0x6c')](this,_0xcff6ac,_0x4028a6);return _0x1b25a3;}else if(_0x1b25a3[_0xf3ba('0x9c')]==='timeout'){_0x1b25a3[_0xf3ba('0xac')]=_0x4028a6[_0xf3ba('0x95')]>=parseInt(_0xcff6ac['mindigit'])?'x':'i';}else{_0x1b25a3['result']=_0x4028a6['length']>=parseInt(_0xcff6ac[_0xf3ba('0x111')])&&_0x4028a6[_0xf3ba('0x95')]<=parseInt(_0xcff6ac[_0xf3ba('0x112')])?'x':'i';}var _0x9e6bfd=this[_0xf3ba('0x13')][_0xf3ba('0x6c')](this,_0xcff6ac[_0xf3ba('0xd1')]);if(!_0x9e6bfd){return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0xcff6ac,'no\x20variable\x20found');}this[_0xf3ba('0xf')][_0xf3ba('0x98')](_0x9e6bfd,_0x4028a6);if(this[_0xf3ba('0x9f')](_0xcff6ac[_0xf3ba('0x113')])){var _0x2f2903=parseInt(_0xcff6ac[_0xf3ba('0x113')],0xa);var _0x49c8db=rs['generate']({'charset':'*','length':_0x2f2903});var _0x5b0249=_0x4028a6[_0xf3ba('0x95')];if(_0x5b0249>0x0){if(_0x5b0249>_0x2f2903){this['createSquareDetailsReport'][_0xf3ba('0x6c')](this,_0xcff6ac,_0xcff6ac[_0xf3ba('0x114')]===_0xf3ba('0x115')?_0x49c8db+_0x4028a6[_0xf3ba('0x116')](_0x2f2903):_0x4028a6['substr'](0x0,_0x5b0249-_0x2f2903)+_0x49c8db);}else{this['createSquareDetailsReport'][_0xf3ba('0x6c')](this,_0xcff6ac,rs[_0xf3ba('0x117')]({'charset':'*','length':_0x5b0249}));}}else{this[_0xf3ba('0x33')]['sync'](this,_0xcff6ac,'');}}else{this[_0xf3ba('0x33')][_0xf3ba('0x6c')](this,_0xcff6ac,_0x4028a6);}return _0x1b25a3;};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x118')]=function(_0x252361){logger[_0xf3ba('0x2a')](util['format'](_0xf3ba('0x119'),_0x252361[_0xf3ba('0x35')]));return this[_0xf3ba('0x11a')](_0x252361);};AGIVertices['prototype'][_0xf3ba('0x11b')]=function(_0x3e236a){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')](_0xf3ba('0x11c'),_0x3e236a[_0xf3ba('0x35')]));this[_0xf3ba('0x33')][_0xf3ba('0x6c')](this,_0x3e236a,_0x3e236a[_0xf3ba('0x11d')]);return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util['format'](_0xf3ba('0x11e'),_0x3e236a[_0xf3ba('0x11d')]));};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x11f')]=function(_0x461a64){logger[_0xf3ba('0x2a')](util['format'](_0xf3ba('0x120'),_0x461a64[_0xf3ba('0x35')]));if(!this[_0xf3ba('0x9f')](_0x461a64[_0xf3ba('0x121')])||!this[_0xf3ba('0x9f')](_0x461a64[_0xf3ba('0x87')])){return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](_0xf3ba('0x122'));}if(!this['isConfigured'](_0x461a64[_0xf3ba('0x58')])){return this['channel'][_0xf3ba('0xa6')](_0xf3ba('0xa4'));}this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util['format'](_0xf3ba('0x123'),_0x461a64[_0xf3ba('0x58')]));var _0x1b4eda=this[_0xf3ba('0x83')][_0xf3ba('0x6c')](this,_0x461a64);if(_0x1b4eda){this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util[_0xf3ba('0x26')]('aws\x20Polly\x20%s\x20file\x20created',_0x1b4eda));var _0x224b1f=this[_0xf3ba('0xf')]['streamFile'](_0x1b4eda);try{fs[_0xf3ba('0xfc')](_0x1b4eda+_0xf3ba('0xfd'));}catch(_0x7de289){logger['error'](_0x7de289);}return _0x224b1f;}return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0x461a64,_0xf3ba('0x124'));};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x125')]=function(_0x1390e5){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')](_0xf3ba('0x126'),_0x1390e5[_0xf3ba('0x35')]));if(!this[_0xf3ba('0x9f')](_0x1390e5['aws_access_key_id'])||!this[_0xf3ba('0x9f')](_0x1390e5['aws_secret_access_key'])){return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](_0xf3ba('0x122'));}if(!this[_0xf3ba('0x9f')](_0x1390e5[_0xf3ba('0x89')])){return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](_0xf3ba('0x127'));}if(!this[_0xf3ba('0x9f')](_0x1390e5[_0xf3ba('0x58')])){return this['channel'][_0xf3ba('0xa6')](_0xf3ba('0xa4'));}this[_0xf3ba('0xf')]['bot']=!![];this['createSquareDetailsReport'](_0x1390e5);this[_0xf3ba('0x3e')](_0x1390e5[_0xf3ba('0x58')],'in','','');this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util[_0xf3ba('0x26')](_0xf3ba('0x128'),_0x1390e5['text']));var _0x7ada84=this[_0xf3ba('0x86')][_0xf3ba('0x6c')](this,_0x1390e5);if(_0x7ada84){for(var _0x52a79d in _0x7ada84){if(_0x7ada84[_0xf3ba('0x90')](_0x52a79d)&&_[_0xf3ba('0x91')](_0x7ada84[_0x52a79d])){this[_0xf3ba('0xf')][_0xf3ba('0x98')](util[_0xf3ba('0x26')](_0xf3ba('0x129'),_0x52a79d[_0xf3ba('0xef')]()),_0x7ada84[_0x52a79d]);}}if(_[_0xf3ba('0x41')](_0x7ada84[_0xf3ba('0x73')])){return this[_0xf3ba('0xf')]['noop'](_0xf3ba('0x12a'));}else{this[_0xf3ba('0x3e')](_0x7ada84['message'],'out','amazonlex','');return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x7ada84['message']));}}return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0x1390e5,_0xf3ba('0x12b'));};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x12c')]=function(_0x2c1975){logger['info'](util[_0xf3ba('0x26')](_0xf3ba('0x12d'),_0x2c1975['label'],_0x2c1975[_0xf3ba('0x62')]));if(!this[_0xf3ba('0x9f')](_0x2c1975[_0xf3ba('0x7e')])){return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](_0xf3ba('0xe0'));}var _0x1e1ad3=_0xf3ba('0x12e');var _0x1ecf6d=util[_0xf3ba('0x26')](_0xf3ba('0x12f'),FILES_PATH,rs[_0xf3ba('0x117')](0x4));var _0x4afc23=util['format'](_0xf3ba('0x97'),_0x1ecf6d,_0x1e1ad3);var _0x360926=!![];if(_0x2c1975['beep']===_0xf3ba('0x130')){_0x360926=![];}var _0x38320f=this[_0xf3ba('0xf')][_0xf3ba('0x131')](_0x1ecf6d,_0x1e1ad3,_0x2c1975[_0xf3ba('0x132')],_0x2c1975['timeout'],undefined,_0x360926);if(_0x38320f[_0xf3ba('0xac')]!==-0x1){this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util[_0xf3ba('0x26')](_0xf3ba('0x133'),_0x4afc23));var _0x2cec84=this[_0xf3ba('0x8a')]['sync'](this,_0x2c1975,_0x4afc23);if(_0x2cec84){for(var _0x571d05 in _0x2cec84){if(_0x2cec84[_0xf3ba('0x90')](_0x571d05)){this[_0xf3ba('0xf')][_0xf3ba('0x98')](util[_0xf3ba('0x26')](_0xf3ba('0x134'),_0x571d05[_0xf3ba('0xef')]()),_0x2cec84[_0x571d05]);}}return this[_0xf3ba('0xf')]['noop'](util[_0xf3ba('0x26')]('GoogleASR\x20Result\x20%s',JSON[_0xf3ba('0x6f')](_0x2cec84)));}}return _0x38320f;};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x135')]=function(_0x1c3372){logger['info'](util[_0xf3ba('0x26')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x1c3372[_0xf3ba('0x35')]));if(!this[_0xf3ba('0x9f')](_0x1c3372[_0xf3ba('0x8d')])){return this[_0xf3ba('0xf')][_0xf3ba('0xa6')]('no\x20appid\x20configured');}if(!this[_0xf3ba('0x9f')](_0x1c3372[_0xf3ba('0x136')])){return this[_0xf3ba('0xf')]['noop'](_0xf3ba('0x137'));}var _0x3457dc=_0xf3ba('0x12e');var _0x3712a6=util[_0xf3ba('0x26')]('%s/recordings/%s',FILES_PATH,rs[_0xf3ba('0x117')](0x4));var _0x270932=util['format'](_0xf3ba('0x97'),_0x3712a6,_0x3457dc);var _0x1a0cc0=!![];if(_0x1c3372[_0xf3ba('0x138')]==='NOBEEP'){_0x1a0cc0=![];}var _0x1d5ff5=this['channel'][_0xf3ba('0x131')](_0x3712a6,_0x3457dc,_0x1c3372['intKey'],_0x1c3372[_0xf3ba('0x62')],undefined,_0x1a0cc0);if(_0x1d5ff5['result']!==-0x1){this[_0xf3ba('0xf')]['noop'](util[_0xf3ba('0x26')]('tilde\x20%s\x20file\x20created',_0x270932));var _0x495367=this['tildeASR'][_0xf3ba('0x6c')](this,_0x1c3372,_0x270932);if(_0x495367){for(var _0x1f31ed in _0x495367){if(_0x495367[_0xf3ba('0x90')](_0x1f31ed)){this[_0xf3ba('0xf')][_0xf3ba('0x98')](util[_0xf3ba('0x26')](_0xf3ba('0x139'),_0x1f31ed[_0xf3ba('0xef')]()),_0x495367[_0x1f31ed]);}}return this[_0xf3ba('0xf')]['noop'](util[_0xf3ba('0x26')](_0xf3ba('0x13a'),JSON[_0xf3ba('0x6f')](_0x495367)));}}return _0x1d5ff5;};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x13b')]=function(_0x2cbc3a){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')](_0xf3ba('0x13c'),_0x2cbc3a[_0xf3ba('0x35')]));return this['channel'][_0xf3ba('0x13d')](_0x2cbc3a['context'],_0x2cbc3a[_0xf3ba('0x3a')],_0x2cbc3a[_0xf3ba('0x3b')]);};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x13e')]=function(_0x39ce4b){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')](_0xf3ba('0x13f'),_0x39ce4b[_0xf3ba('0x35')]));if(!this['isConfigured'](_0x39ce4b[_0xf3ba('0x140')])){return this['channel'][_0xf3ba('0x2e')](_0x39ce4b,'no\x20condition\x20configured');}try{var _0x341e2a=eval(_0x39ce4b['condition'])?'true':_0xf3ba('0x141');this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util[_0xf3ba('0x26')]('EVAL\x20CONDITION\x20%s\x20%s',_0x39ce4b[_0xf3ba('0x140')],_0x341e2a));return{'code':0xc8,'result':_0x341e2a};}catch(_0x44c6df){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x142')]=function(_0x25ed6f){logger[_0xf3ba('0x2a')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x25ed6f[_0xf3ba('0x35')]));if(!this['isConfigured'](_0x25ed6f[_0xf3ba('0x143')])){return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0x25ed6f,_0xf3ba('0x144'));}var _0xfe895d=this[_0xf3ba('0x22')][_0xf3ba('0x6c')](this,_0x25ed6f[_0xf3ba('0x143')]);if(!_0xfe895d){return this['channel'][_0xf3ba('0x2e')](_0x25ed6f,'no\x20intervals\x20found');}for(var _0xf9b78b=0x0;_0xf9b78b<_0xfe895d[_0xf3ba('0x95')];_0xf9b78b+=0x1){var _0x1f6c9a=this[_0xf3ba('0xf')][_0xf3ba('0x13')](util[_0xf3ba('0x26')](_0xf3ba('0x145'),_0xfe895d[_0xf9b78b]));if(_0x1f6c9a['result']===-0x1){return _0x1f6c9a;}logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')](_0xf3ba('0x146'),_0xfe895d[_0xf9b78b],_0x1f6c9a[_0xf3ba('0x9c')]));if(_0x1f6c9a[_0xf3ba('0x9c')]===_0xf3ba('0x147')){logger['info'](util['format'](_0xf3ba('0x146'),_0xfe895d[_0xf9b78b],'true'));this['channel'][_0xf3ba('0xa6')](util[_0xf3ba('0x26')](_0xf3ba('0x146'),_0xfe895d[_0xf9b78b],_0xf3ba('0x147')));return{'code':0xc8,'result':_0xf3ba('0x147')};}else{logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')]('IFTIME\x20%s\x20%s',_0xfe895d[_0xf9b78b],_0xf3ba('0x141')));this[_0xf3ba('0xf')]['noop'](util[_0xf3ba('0x26')](_0xf3ba('0x146'),_0xfe895d[_0xf9b78b],'false'));}}return{'code':0xc8,'result':_0xf3ba('0x141')};};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x148')]=function(_0x1cde13){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')](_0xf3ba('0x149'),_0x1cde13['label']));return this[_0xf3ba('0xf')]['hangup']();};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x14a')]=function(_0x167961){logger[_0xf3ba('0x2a')](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x167961[_0xf3ba('0x35')]));if(!this['isConfigured'](_0x167961[_0xf3ba('0x7e')])){return this[_0xf3ba('0xf')][_0xf3ba('0xa6')]('no\x20key\x20configured');}var _0x1ee168=_0xf3ba('0x12e');var _0x21b9de=util['format'](_0xf3ba('0x12f'),FILES_PATH,rs[_0xf3ba('0x117')](0x4));var _0x535f9f=util['format'](_0xf3ba('0x97'),_0x21b9de,_0x1ee168);var _0xca58da=!![];if(_0x167961[_0xf3ba('0x138')]===_0xf3ba('0x130')){_0xca58da=![];}var _0x8f1688=this['channel'][_0xf3ba('0x131')](_0x21b9de,_0x1ee168,_0x167961[_0xf3ba('0x132')],_0x167961[_0xf3ba('0x62')],undefined,_0xca58da);if(_0x8f1688['result']!==-0x1){this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util[_0xf3ba('0x26')](_0xf3ba('0x14b'),_0x535f9f));var _0x392770=this['ispeechASR'][_0xf3ba('0x6c')](this,_0x167961,_0x535f9f);if(_0x392770){for(var _0x443153 in _0x392770){if(_0x392770['hasOwnProperty'](_0x443153)){this[_0xf3ba('0xf')][_0xf3ba('0x98')](util[_0xf3ba('0x26')](_0xf3ba('0x14c'),_0x443153['toUpperCase']()),_0x392770[_0x443153]);}}return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util['format'](_0xf3ba('0x14d'),JSON['stringify'](_0x392770)));}}return _0x8f1688;};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x14e')]=function(_0x540f90){logger['info'](util[_0xf3ba('0x26')](_0xf3ba('0x14f'),_0x540f90[_0xf3ba('0x35')]));if(!this[_0xf3ba('0x9f')](_0x540f90['key'])){return this[_0xf3ba('0xf')]['noop'](_0xf3ba('0xe0'));}if(!this[_0xf3ba('0x9f')](_0x540f90[_0xf3ba('0x58')])){return this[_0xf3ba('0xf')][_0xf3ba('0xa6')]('no\x20text\x20configured');}this['channel']['noop'](util[_0xf3ba('0x26')]('Trying\x20ispeech\x20TTS\x20%s',_0x540f90[_0xf3ba('0x58')]));var _0x38769f=this[_0xf3ba('0x7d')][_0xf3ba('0x6c')](this,_0x540f90);if(_0x38769f){this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util[_0xf3ba('0x26')]('ispeech\x20%s\x20file\x20created',_0x38769f));var _0x5912df=this[_0xf3ba('0xf')][_0xf3ba('0xfb')](_0x38769f,_0x540f90[_0xf3ba('0x132')]);try{fs[_0xf3ba('0xfc')](_0x38769f+_0xf3ba('0xfd'));}catch(_0x485ce7){logger['error'](_0x485ce7);}return _0x5912df;}return this['channel'][_0xf3ba('0x2e')](_0x540f90,_0xf3ba('0x150'));};AGIVertices[_0xf3ba('0x12')]['login']=function(_0x2ea594){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x2ea594[_0xf3ba('0x35')]));if(!this[_0xf3ba('0x9f')](_0x2ea594[_0xf3ba('0x151')])){return this[_0xf3ba('0xf')]['error'](_0x2ea594,'no\x20find\x20by\x20configured');}logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')](_0xf3ba('0x152'),this[_0xf3ba('0xf')][_0xf3ba('0x37')],_0x2ea594[_0xf3ba('0x151')]));var _0x44261b=this[_0xf3ba('0x50')][_0xf3ba('0x6c')](this,_0x2ea594[_0xf3ba('0x151')]);if(_0x44261b){logger['info'](util['format'](_0xf3ba('0x153'),this['channel'][_0xf3ba('0x37')],_0x2ea594[_0xf3ba('0x151')]));this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util[_0xf3ba('0x26')](_0xf3ba('0x153'),this[_0xf3ba('0xf')][_0xf3ba('0x37')],_0x2ea594[_0xf3ba('0x151')]));return{'code':0xc8,'result':_0xf3ba('0x154')};}else{logger['info'](util[_0xf3ba('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xf3ba('0xf')][_0xf3ba('0x37')],_0x2ea594[_0xf3ba('0x151')]));this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util[_0xf3ba('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xf3ba('0xf')][_0xf3ba('0x37')],_0x2ea594[_0xf3ba('0x151')]));return{'code':0xc8,'result':_0xf3ba('0x155')};}};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x156')]=function(_0xbd34bc){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0xbd34bc['label']));if(!this[_0xf3ba('0x9f')](_0xbd34bc[_0xf3ba('0x151')])){return this[_0xf3ba('0xf')]['error'](_0xbd34bc,_0xf3ba('0x157'));}logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xf3ba('0xf')][_0xf3ba('0x37')],_0xbd34bc[_0xf3ba('0x151')]));var _0x413a9d=this[_0xf3ba('0x4d')]['sync'](this,_0xbd34bc[_0xf3ba('0x151')]);if(_0x413a9d){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xf3ba('0xf')]['callerid'],_0xbd34bc[_0xf3ba('0x151')]));this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util[_0xf3ba('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xf3ba('0xf')][_0xf3ba('0x37')],_0xbd34bc['findBy']));return{'code':0xc8,'result':_0xf3ba('0x154')};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xf3ba('0xf')]['callerid'],_0xbd34bc[_0xf3ba('0x151')]));this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util['format'](_0xf3ba('0x158'),this['channel']['callerid'],_0xbd34bc[_0xf3ba('0x151')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x159')]=function(_0x4bfc14){logger['info'](util[_0xf3ba('0x26')](_0xf3ba('0x15a'),_0x4bfc14['label']));if(!this[_0xf3ba('0x9f')](_0x4bfc14[_0xf3ba('0x15b')])){return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0x4bfc14,_0xf3ba('0x15c'));}this['channel'][_0xf3ba('0xa6')](util[_0xf3ba('0x26')](_0xf3ba('0x15d'),_0x4bfc14[_0xf3ba('0x15b')]));var _0x8bc40a=eval(_0x4bfc14[_0xf3ba('0x15b')]);if(!this[_0xf3ba('0x9f')](_0x4bfc14['variable_id'])){return this['channel']['noop'](_0xf3ba('0xd2'));}var _0x36de53=this[_0xf3ba('0x13')][_0xf3ba('0x6c')](this,_0x4bfc14['variable_id']);if(!_0x36de53){return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0x4bfc14,_0xf3ba('0xd3'));}if(_['isArray'](_0x8bc40a)){var _0x4c8c61=this;_0x8bc40a[_0xf3ba('0xd5')](function(_0x17a8d5,_0xee0817){_0x4c8c61[_0xf3ba('0xf')]['setVariable'](util['format'](_0xf3ba('0x15e'),_0x36de53,_0xee0817),_0x17a8d5);});return this[_0xf3ba('0xf')]['noop'](util[_0xf3ba('0x26')]('variable\x20%s[key]\x20set',_0x36de53));}else{return this['channel'][_0xf3ba('0x98')](_0x36de53,_0x8bc40a);}};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x15f')]=function(_0x45bb50){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')](_0xf3ba('0x160'),_0x45bb50[_0xf3ba('0x35')]));if(_0x45bb50[_0xf3ba('0xa1')]===0x0){return this[_0xf3ba('0xa0')](_0x45bb50);}_0x45bb50[_0xf3ba('0xa1')]-=0x1;if(!this[_0xf3ba('0x9f')](_0x45bb50[_0xf3ba('0x161')])){return this[_0xf3ba('0xf')]['error'](_0x45bb50,_0xf3ba('0x162'));}var _0x250070=this[_0xf3ba('0x1f')][_0xf3ba('0x6c')](this,_0x45bb50[_0xf3ba('0x161')]);if(!_0x250070){return this['channel']['error'](_0x45bb50,'no\x20file\x20audio\x20found');}var _0x2bfd0f=this['channel'][_0xf3ba('0x10e')](_0x250070,_0x45bb50['response'],_0x45bb50[_0xf3ba('0x163')]);var _0x1cd0d2=_0x2bfd0f[_0xf3ba('0xac')];if(_0x2bfd0f[_0xf3ba('0xac')]===-0x1){this['createSquareDetailsReport'][_0xf3ba('0x6c')](this,_0x45bb50,'-1');return _0x2bfd0f;}else if(_0x2bfd0f['extra']===_0xf3ba('0x62')){_0x2bfd0f[_0xf3ba('0xac')]=_0x2bfd0f[_0xf3ba('0xac')][_0xf3ba('0x95')]>0x0?_0x2bfd0f[_0xf3ba('0xac')]:'t';}else if(_[_0xf3ba('0x40')](_0x2bfd0f[_0xf3ba('0xac')])){_0x2bfd0f[_0xf3ba('0xac')]='#';_0x1cd0d2='#';}if(!this[_0xf3ba('0x9f')](_0x45bb50[_0xf3ba('0xd1')])){this[_0xf3ba('0xf')][_0xf3ba('0xa6')](_0xf3ba('0xd2'));}else{var _0x23e2b1=this['getVariable'][_0xf3ba('0x6c')](this,_0x45bb50['variable_id']);if(!_0x23e2b1){return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0x45bb50,'no\x20variable\x20found');}this['channel'][_0xf3ba('0x98')](_0x23e2b1,_0x1cd0d2);}this[_0xf3ba('0x33')]['sync'](this,_0x45bb50,_0x1cd0d2);return _0x2bfd0f;};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0xa6')]=function(_0x344071){logger[_0xf3ba('0x2a')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x344071[_0xf3ba('0x35')]));return this['channel']['noop'](_0x344071['output']||_0x344071[_0xf3ba('0x35')]);};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x164')]=function(_0x178cbc){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')](_0xf3ba('0x165'),_0x178cbc[_0xf3ba('0x35')]));if(!this['isConfigured'](_0x178cbc[_0xf3ba('0x151')])){return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0x178cbc,'no\x20find\x20by\x20configured');}logger[_0xf3ba('0x2a')](util['format'](_0xf3ba('0x152'),this[_0xf3ba('0xf')]['callerid'],_0x178cbc['findBy']));var _0xbbc1fc=this[_0xf3ba('0x49')][_0xf3ba('0x6c')](this,_0x178cbc['pause_id']);var _0xfbac97=this[_0xf3ba('0x4a')][_0xf3ba('0x6c')](this,_0x178cbc[_0xf3ba('0x151')],_0xbbc1fc);if(_0xfbac97){logger['info'](util['format'](_0xf3ba('0x153'),this[_0xf3ba('0xf')][_0xf3ba('0x37')],_0x178cbc[_0xf3ba('0x151')]));this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util[_0xf3ba('0x26')](_0xf3ba('0x153'),this[_0xf3ba('0xf')][_0xf3ba('0x37')],_0x178cbc[_0xf3ba('0x151')]));return{'code':0xc8,'result':_0xf3ba('0x154')};}else{logger['info'](util[_0xf3ba('0x26')](_0xf3ba('0x158'),this[_0xf3ba('0xf')][_0xf3ba('0x37')],_0x178cbc[_0xf3ba('0x151')]));this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util['format'](_0xf3ba('0x153'),this[_0xf3ba('0xf')]['callerid'],_0x178cbc[_0xf3ba('0x151')]));return{'code':0xc8,'result':_0xf3ba('0x155')};}};AGIVertices[_0xf3ba('0x12')]['playback']=function(_0x4dd321){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')](_0xf3ba('0x166'),_0x4dd321[_0xf3ba('0x35')]));if(!this['isConfigured'](_0x4dd321[_0xf3ba('0x161')])){return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0x4dd321,_0xf3ba('0x162'));}var _0x69ab0f=this['getSound'][_0xf3ba('0x6c')](this,_0x4dd321[_0xf3ba('0x161')]);if(!_0x69ab0f){return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0x4dd321,_0xf3ba('0x10d'));}var _0x55d801=this[_0xf3ba('0xf')][_0xf3ba('0x52')](_0xf3ba('0x167'),[_0x69ab0f,_0x4dd321[_0xf3ba('0x109')]]);if(_0x55d801['result']===-0x1){return _0x55d801;}return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util['format'](_0xf3ba('0xbc'),_0xf3ba('0x167'),_0x69ab0f));};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x168')]=function(_0x2625ef){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')](_0xf3ba('0x169'),_0x2625ef[_0xf3ba('0x35')]));if(!this[_0xf3ba('0x9f')](_0x2625ef[_0xf3ba('0x16a')])){return this['channel'][_0xf3ba('0x2e')](_0x2625ef,_0xf3ba('0x16b'));}var _0x3ad1ee='';var _0xebd7c0=parseInt(_0x2625ef[_0xf3ba('0x16a')],0xa);if(isNaN(_0xebd7c0)){_0x3ad1ee=_0x2625ef[_0xf3ba('0x16a')];}else{_0x3ad1ee=this[_0xf3ba('0x18')][_0xf3ba('0x6c')](this,_0x2625ef[_0xf3ba('0x16a')]);if(!_0x3ad1ee){return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0x2625ef,_0xf3ba('0x16c'));}}var _0xe09624='';if(this[_0xf3ba('0x9f')](_0x2625ef[_0xf3ba('0x161')])){var _0x36e27a=this['getSound'][_0xf3ba('0x6c')](this,_0x2625ef['file_id']);if(_0x36e27a){_0xe09624=_0x36e27a;}}this[_0xf3ba('0x33')][_0xf3ba('0x6c')](this,_0x2625ef,_0x3ad1ee);if(_0x2625ef[_0xf3ba('0x109')]['indexOf']('x')<0x0){_0x2625ef[_0xf3ba('0x109')]+='x';}if(_0x2625ef[_0xf3ba('0x109')][_0xf3ba('0x16d')]('X')<0x0){_0x2625ef['opts']+='X';}this[_0xf3ba('0xf')][_0xf3ba('0x98')](_0xf3ba('0x16e'),_0x3ad1ee?_0x3ad1ee['toLowerCase']():'');var _0xdf7d21=this[_0xf3ba('0xf')][_0xf3ba('0x52')](_0xf3ba('0x16f'),[_0x3ad1ee,_0x2625ef['opts'],_0x2625ef[_0xf3ba('0x61')],_0xe09624,_0x2625ef[_0xf3ba('0x62')],_0x2625ef[_0xf3ba('0x9')],_0x2625ef['macro'],_0x2625ef[_0xf3ba('0x170')],'',_0x2625ef[_0xf3ba('0x171')]]);if(_0xdf7d21[_0xf3ba('0xac')]===-0x1){return _0xdf7d21;}return this['channel'][_0xf3ba('0xa6')](util[_0xf3ba('0x26')](_0xf3ba('0xbc'),_0xf3ba('0x16f'),_0x3ad1ee));};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x172')]=function(_0x58a7dc){logger[_0xf3ba('0x2a')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x58a7dc[_0xf3ba('0x35')]));var _0x153b41=_0x58a7dc[_0xf3ba('0x173')]||_0xf3ba('0x12e');var _0x20bab1=util[_0xf3ba('0x26')]('%s_%s',this[_0xf3ba('0xf')][_0xf3ba('0x34')],rs[_0xf3ba('0x117')](0x5));var _0x31a421=util[_0xf3ba('0x26')](_0xf3ba('0x174'),FILES_PATH,_0x20bab1,_0x153b41);var _0x30d3c9=util['format'](_0xf3ba('0x12f'),FILES_PATH,_0x20bab1);this['createSquareRecording'][_0xf3ba('0x6c')](this,_0x58a7dc,_0x20bab1,_0x31a421);this[_0xf3ba('0xf')][_0xf3ba('0x98')](_0xf3ba('0x175'),_0x20bab1);logger[_0xf3ba('0x2a')](_0xf3ba('0x176'),_0x30d3c9,_0x153b41,_0x58a7dc[_0xf3ba('0x177')],_0x58a7dc[_0xf3ba('0x62')]);return this[_0xf3ba('0xf')][_0xf3ba('0x131')](_0x30d3c9,_0x153b41,_0x58a7dc[_0xf3ba('0x177')],_0x58a7dc['timeout'],undefined,!![]);};AGIVertices[_0xf3ba('0x12')]['restapi']=function(_0x5104df){logger[_0xf3ba('0x2a')](util['format'](_0xf3ba('0x178'),_0x5104df[_0xf3ba('0x35')]));if(!this['isConfigured'](_0x5104df[_0xf3ba('0x61')])){return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](_0xf3ba('0x179'));}var _0x5be3a8=this[_0xf3ba('0x60')]['sync'](this,_0x5104df);logger[_0xf3ba('0x2a')](util['format']('Response:',util['inspect'](_0x5be3a8,{'showHidden':![],'depth':null})));if(!this[_0xf3ba('0x9f')](_0x5104df[_0xf3ba('0xd1')])){return this[_0xf3ba('0xf')]['noop'](_0xf3ba('0x17a'));}var _0x245212=this[_0xf3ba('0x13')][_0xf3ba('0x6c')](this,_0x5104df['variable_id']);if(!_0x245212){return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0x5104df,_0xf3ba('0xd3'));}this[_0xf3ba('0xf')]['setVariable'](util[_0xf3ba('0x26')](_0xf3ba('0x17b'),_0x245212),_0x5be3a8[_0xf3ba('0x71')]?_0x5be3a8['statusCode']:_0xf3ba('0x17c'));this[_0xf3ba('0xf')]['setVariable'](util['format'](_0xf3ba('0x17d'),_0x245212),_0x5be3a8[_0xf3ba('0x72')]?_0x5be3a8[_0xf3ba('0x72')]:'OK');if(_0x5be3a8['body']){try{this[_0xf3ba('0x96')](_0x5be3a8['body'],_0x245212);}catch(_0x25a4dd){logger[_0xf3ba('0x2e')](util[_0xf3ba('0x26')](_0xf3ba('0x17e'),_0x245212));}}return this[_0xf3ba('0xf')]['noop'](util[_0xf3ba('0x26')](_0xf3ba('0xd7'),_0x245212));};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x17f')]=function(_0x246e46){logger['info'](util[_0xf3ba('0x26')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x246e46[_0xf3ba('0x35')]));return this['channel'][_0xf3ba('0x180')](_0x246e46['digits'][_0xf3ba('0x54')](/\s+/g,''),_0x246e46[_0xf3ba('0x177')]);};AGIVertices[_0xf3ba('0x12')]['saynumber']=function(_0x177a06){logger['info'](util['format'](_0xf3ba('0x181'),_0x177a06[_0xf3ba('0x35')]));return this[_0xf3ba('0xf')][_0xf3ba('0x182')](_0x177a06[_0xf3ba('0x183')][_0xf3ba('0x54')](/\s+/g,''),_0x177a06[_0xf3ba('0x177')]);};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x184')]=function(_0x3767c6){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')](_0xf3ba('0x185'),_0x3767c6[_0xf3ba('0x35')]));return this[_0xf3ba('0xf')][_0xf3ba('0x186')](_0x3767c6[_0xf3ba('0x58')],_0x3767c6['escape_digits']);};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x187')]=function(_0x1c53a5){logger[_0xf3ba('0x2a')](util['format'](_0xf3ba('0x188'),_0x1c53a5[_0xf3ba('0x35')]));if(!this['isConfigured'](_0x1c53a5['account_id'])){return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](_0xf3ba('0x189'));}var _0x3ae56f=this[_0xf3ba('0x18a')]['sync'](this,_0x1c53a5[_0xf3ba('0x18b')]);if(!_0x3ae56f||!_0x3ae56f['Smtp']){return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0x1c53a5,_0xf3ba('0x18c'));}var _0x5b3133={'from':util[_0xf3ba('0x26')](_0xf3ba('0x18d'),_0x3ae56f[_0xf3ba('0x16')],_0x3ae56f[_0xf3ba('0x18e')]||_0x3ae56f[_0xf3ba('0x18f')][_0xf3ba('0x190')]),'to':_0x1c53a5['to']||'','cc':_0x1c53a5['cc']||'','bcc':_0x1c53a5[_0xf3ba('0x191')]||'','subject':_0x1c53a5[_0xf3ba('0x192')],'html':_0x1c53a5[_0xf3ba('0x58')],'text':_0x1c53a5[_0xf3ba('0x58')]};if(this['isConfigured'](_0x1c53a5['template_id'])){}logger[_0xf3ba('0x193')](_0xf3ba('0x194'),JSON[_0xf3ba('0x6f')](_0x5b3133));this[_0xf3ba('0x33')]['sync'](this,_0x1c53a5,_0x1c53a5[_0xf3ba('0x18b')]);this['channel']['noop'](util[_0xf3ba('0x26')](_0xf3ba('0x195'),_0x3ae56f[_0xf3ba('0x16')]));this['sendMailMessage']['sync'](this,_0x3ae56f[_0xf3ba('0x196')],_0x5b3133);return this['channel'][_0xf3ba('0xa6')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x197')]=function(_0x199159){logger['info'](util[_0xf3ba('0x26')](_0xf3ba('0x198'),_0x199159[_0xf3ba('0x35')]));return this[_0xf3ba('0xf')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x199')]=function(_0xc19f39){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0xc19f39['label']));if(!this[_0xf3ba('0x9f')](_0xc19f39[_0xf3ba('0x19a')])){return this[_0xf3ba('0xf')]['noop'](_0xf3ba('0x19b'));}var _0x27f136=this['getSmsAccount']['sync'](this,_0xc19f39[_0xf3ba('0x19a')]);if(!_0x27f136){return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0xc19f39,'no\x20sms\x20account\x20found');}var _0x1fff3e={'body':_0xc19f39[_0xf3ba('0x19c')],'phone':_0xc19f39['to']||'','SmsAccountId':_0x27f136['id']};logger['debug'](_0xf3ba('0x19d'),JSON['stringify'](_0x1fff3e));this[_0xf3ba('0x33')]['sync'](this,_0xc19f39,_0xc19f39['sms_account_id']);this[_0xf3ba('0xf')]['noop'](util[_0xf3ba('0x26')](_0xf3ba('0x19e'),_0x27f136[_0xf3ba('0x16')]));this[_0xf3ba('0x32')][_0xf3ba('0x6c')](this,_0x1fff3e);return this[_0xf3ba('0xf')]['noop'](_0xf3ba('0x19f'));};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x1a0')]=function(_0x2a9101){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')](_0xf3ba('0x1a1'),_0x2a9101['label']));if(!this[_0xf3ba('0x9f')](_0x2a9101['variable_id'])){return this[_0xf3ba('0xf')]['error'](_0x2a9101,_0xf3ba('0x1a2'));}var _0x35e393=this[_0xf3ba('0x13')][_0xf3ba('0x6c')](this,_0x2a9101[_0xf3ba('0xd1')]);if(!_0x35e393){return this['channel'][_0xf3ba('0x2e')](_0x2a9101,_0xf3ba('0xd3'));}return this[_0xf3ba('0xf')][_0xf3ba('0x98')](_0x35e393,_0x2a9101[_0xf3ba('0x1a3')]);};AGIVertices['prototype'][_0xf3ba('0x1a4')]=function(_0x4c63ad){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')](_0xf3ba('0x1a5'),_0x4c63ad['label']));this['channel'][_0xf3ba('0xa6')](_0xf3ba('0x1a6'));var _0x238836=this[_0xf3ba('0xf')]['getVariable'](_0xf3ba('0x1a7'));if(!_['isEmpty'](_0x238836[_0xf3ba('0x9c')])){this[_0xf3ba('0xf')]['uniqueid']=_0x238836['extra'];}if(_0x4c63ad[_0xf3ba('0xb7')]===_0xf3ba('0x1a8')){this[_0xf3ba('0xf')][_0xf3ba('0xa6')](_0xf3ba('0x1a9'));return this[_0xf3ba('0xf')][_0xf3ba('0xb7')]();}return this['channel'][_0xf3ba('0xa6')](_0xf3ba('0x1aa'));};AGIVertices[_0xf3ba('0x12')]['subproject']=function(_0x4d67b7){logger[_0xf3ba('0x2a')](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x4d67b7[_0xf3ba('0x35')]));if(!this[_0xf3ba('0x9f')](_0x4d67b7[_0xf3ba('0x1ab')])){return this[_0xf3ba('0xf')]['error'](_0x4d67b7,_0xf3ba('0x1ac'));}var _0x3fe4a4=this[_0xf3ba('0x19')][_0xf3ba('0x6c')](this,_0x4d67b7[_0xf3ba('0x1ab')]);if(!this[_0xf3ba('0x9f')](_0x3fe4a4)){return this['channel'][_0xf3ba('0x2e')](_0x4d67b7,util[_0xf3ba('0x26')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x4d67b7[_0xf3ba('0x1ab')]));}if(_0x3fe4a4===this[_0xf3ba('0xf')][_0xf3ba('0x36')]){return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0x4d67b7,_0xf3ba('0x1ad'));}this[_0xf3ba('0x33')][_0xf3ba('0x6c')](this,_0x4d67b7,_0x3fe4a4);var _0x9a9420=this[_0xf3ba('0xf')][_0xf3ba('0x52')](_0xf3ba('0x1ae'),util[_0xf3ba('0x26')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0xf3ba('0x1af')]||'127.0.0.1',_0x3fe4a4,this['channel'][_0xf3ba('0x36')]));if(_0x9a9420[_0xf3ba('0xac')]===-0x1){return _0x9a9420;}return this[_0xf3ba('0xf')]['noop'](util['format'](_0xf3ba('0xbc'),_0xf3ba('0x1ae'),_0x3fe4a4));};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x1b0')]=function(_0x3f16d7){logger[_0xf3ba('0x2a')](util['format']('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x3f16d7[_0xf3ba('0x35')]));var _0x12c6b6=this[_0xf3ba('0x51')]['sync'](this,_0x3f16d7[_0xf3ba('0xb5')]);this[_0xf3ba('0x33')][_0xf3ba('0x6c')](this,_0x3f16d7,_0x3f16d7[_0xf3ba('0xb5')]);if(this['isConfigured'](_0x3f16d7[_0xf3ba('0xd1')])){var _0x5ae9a7=this[_0xf3ba('0x13')][_0xf3ba('0x6c')](this,_0x3f16d7[_0xf3ba('0xd1')]);if(_0x5ae9a7){this['channel'][_0xf3ba('0x98')](_0x5ae9a7,_0x12c6b6);return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util[_0xf3ba('0x26')](_0xf3ba('0x1b1'),_0x3f16d7[_0xf3ba('0xb5')],_0x5ae9a7));}}return this['channel'][_0xf3ba('0xa6')](util[_0xf3ba('0x26')](_0xf3ba('0x1b2'),_0x3f16d7[_0xf3ba('0xb5')]));};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x1b3')]=function(_0x96c8f8){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x96c8f8['label']));_0x96c8f8[_0xf3ba('0x58')]=_0x96c8f8[_0xf3ba('0x58')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x96c8f8[_0xf3ba('0x56')])){return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](_0xf3ba('0x1b4'));}if(!this[_0xf3ba('0x9f')](_0x96c8f8[_0xf3ba('0x58')])){return this['channel'][_0xf3ba('0xa6')](_0xf3ba('0xa4'));}this[_0xf3ba('0xf')]['noop'](util[_0xf3ba('0x26')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x96c8f8[_0xf3ba('0x58')]));var _0x5790a9=this[_0xf3ba('0x55')][_0xf3ba('0x6c')](this,_0x96c8f8);if(_0x5790a9){this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util[_0xf3ba('0x26')](_0xf3ba('0x1b5'),_0x5790a9));var _0x261c2b=this['channel'][_0xf3ba('0xfb')](_0x5790a9);try{fs[_0xf3ba('0xfc')](_0x5790a9+'.wav');}catch(_0xca1d45){logger['error'](_0xca1d45);}return _0x261c2b;}return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0x96c8f8,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['tts']=function(_0x140b19){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x140b19['label']));_0x140b19[_0xf3ba('0x58')]=_0x140b19[_0xf3ba('0x58')][_0xf3ba('0x54')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xf3ba('0x9f')](_0x140b19[_0xf3ba('0x58')])){return this['channel'][_0xf3ba('0xa6')](_0xf3ba('0xa4'));}this[_0xf3ba('0xf')]['noop'](util[_0xf3ba('0x26')](_0xf3ba('0x1b6'),_0x140b19[_0xf3ba('0x58')]));var _0x4dcd35=this[_0xf3ba('0x5e')][_0xf3ba('0x6c')](this,_0x140b19);if(_0x4dcd35){this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util[_0xf3ba('0x26')](_0xf3ba('0x1b7'),_0x4dcd35));var _0x5c55c5=this[_0xf3ba('0xf')]['streamFile'](_0x4dcd35);try{fs[_0xf3ba('0xfc')](_0x4dcd35+_0xf3ba('0xfd'));}catch(_0x48bdc1){logger[_0xf3ba('0x2e')](_0x48bdc1);}return _0x5c55c5;}return this[_0xf3ba('0xf')]['error'](_0x140b19,_0xf3ba('0x1b8'));};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x1b9')]=function(_0xeda88a){logger['info'](util['format'](_0xf3ba('0x1ba'),_0xeda88a[_0xf3ba('0x35')]));if(!this[_0xf3ba('0x9f')](_0xeda88a[_0xf3ba('0x151')])){return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0xeda88a,_0xf3ba('0x157'));}logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')](_0xf3ba('0x152'),this['channel'][_0xf3ba('0x37')],_0xeda88a[_0xf3ba('0x151')]));var _0x35a1c3=this['agentUnpause']['sync'](this,_0xeda88a[_0xf3ba('0x151')]);if(_0x35a1c3){logger['info'](util[_0xf3ba('0x26')](_0xf3ba('0x153'),this[_0xf3ba('0xf')]['callerid'],_0xeda88a['findBy']));this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util[_0xf3ba('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xf3ba('0x37')],_0xeda88a[_0xf3ba('0x151')]));return{'code':0xc8,'result':_0xf3ba('0x154')};}else{logger[_0xf3ba('0x2a')](util['format'](_0xf3ba('0x158'),this[_0xf3ba('0xf')]['callerid'],_0xeda88a['findBy']));this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util['format'](_0xf3ba('0x158'),this[_0xf3ba('0xf')][_0xf3ba('0x37')],_0xeda88a[_0xf3ba('0x151')]));return{'code':0xc8,'result':_0xf3ba('0x155')};}};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x1bb')]=function(_0x3a44b9){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')](_0xf3ba('0x1bc'),_0x3a44b9['label']));var _0x20d95a=this['channel']['exec'](_0xf3ba('0x1bd'),[_0x3a44b9['mailbox'],_0x3a44b9[_0xf3ba('0x75')]]);if(_0x20d95a[_0xf3ba('0xac')]===-0x1){return _0x20d95a;}return this[_0xf3ba('0xf')][_0xf3ba('0xa6')](util['format']('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x3a44b9[_0xf3ba('0x1be')]));};AGIVertices[_0xf3ba('0x12')][_0xf3ba('0x1bf')]=function(_0x2b1035){logger[_0xf3ba('0x2a')](util[_0xf3ba('0x26')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x2b1035[_0xf3ba('0x35')]));if(!this['isConfigured'](_0x2b1035[_0xf3ba('0xd1')])){return this[_0xf3ba('0xf')][_0xf3ba('0x2e')](_0x2b1035,'no\x20variable\x20selected');}var _0x430221=this['getVariable'][_0xf3ba('0x6c')](this,_0x2b1035[_0xf3ba('0xd1')]);if(!_0x430221){return this[_0xf3ba('0xf')]['error'](_0x2b1035,'no\x20variable\x20found');}var _0x4282ba=this['channel']['getVariable'](_0x430221);return{'code':0xc8,'result':_0x4282ba[_0xf3ba('0x9c')]?_0x4282ba['extra']:'-'};};String['prototype'][_0xf3ba('0x9b')]=function(_0x50de1a,_0x42a41e){return this['split'](_0x50de1a)[_0xf3ba('0x1c0')](_0x42a41e);};module[_0xf3ba('0x1c1')]=AGIVertices; \ No newline at end of file +var _0x3685=['Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','no\x20user\x20found','Executed\x20command\x20%s','DIAL','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','awslex','no\x20bot\x20name\x20configured','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','no\x20appid\x20configured','no\x20appsecret\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','interval_id','no\x20interval\x20configured','getIntervals','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','isArray','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','template_id','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','project_id','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','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','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','rawBody','menu','getdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','name','getVoiceQueue','getVoiceQueueById','then','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','IntervalId','interval','map','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','en-US','audioEncoding','MP3','googleTTS','google_tts_language','url','timeout','includes','method','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','parse','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','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','agicommand','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','length','isString','isPlainObject','saveRestApiResult','setVariable','%s.%s','split','replaceAll','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','mrcpsynth','isConfigured','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','grammar','MRCPRecog','result','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','getAndSetVariable','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','minutes','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','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE'];(function(_0x22a540,_0x29af91){var _0x35809c=function(_0x744bb){while(--_0x744bb){_0x22a540['push'](_0x22a540['shift']());}};_0x35809c(++_0x29af91);}(_0x3685,0xf8));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var fs=require('fs');var util=require(_0x5368('0x0'));var _=require('lodash');var sh=require(_0x5368('0x1'));var odbc=require(_0x5368('0x2'))();var rs=require(_0x5368('0x3'));var moment=require(_0x5368('0x4'));var Mustache=require(_0x5368('0x5'));var rp=require(_0x5368('0x6'));var logger=require(_0x5368('0x7'))(_0x5368('0x8'));var config=require(_0x5368('0x9'));var scripts=require(_0x5368('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x5368('0xb'),_0x5368('0xc')];var verticesWithRetry=[_0x5368('0xd'),_0x5368('0xe'),'getsecretdigits'];var AGIVertices=function(_0x14e621,_0x374865,_0x3e6051){this[_0x5368('0xf')]=_0x14e621;this[_0x5368('0x10')]=_0x374865;this[_0x5368('0x11')]=_0x3e6051;};AGIVertices[_0x5368('0x12')][_0x5368('0x13')]=function(_0x521e25,_0x3d9625){this[_0x5368('0x10')][_0x5368('0x14')](_0x521e25)['then'](function(_0x164bec){_0x3d9625(null,_0x164bec?_0x164bec[_0x5368('0x15')]:![]);})['catch'](function(_0x5d6a86){_0x3d9625(_0x5d6a86);});};AGIVertices['prototype'][_0x5368('0x16')]=function(_0x28d957,_0x3a6157){this[_0x5368('0x10')][_0x5368('0x17')](_0x28d957)[_0x5368('0x18')](function(_0x173cd2){_0x3a6157(null,_0x173cd2?_0x173cd2[_0x5368('0x15')]:![]);})[_0x5368('0x19')](function(_0x5b1da2){_0x3a6157(_0x5b1da2);});};AGIVertices['prototype'][_0x5368('0x1a')]=function(_0x183041,_0x59c422){this[_0x5368('0x10')][_0x5368('0x1b')](_0x183041)[_0x5368('0x18')](function(_0x24a4b3){_0x59c422(null,_0x24a4b3?_0x24a4b3['name']:![]);})[_0x5368('0x19')](function(_0x56ac4d){_0x59c422(_0x56ac4d);});};AGIVertices['prototype'][_0x5368('0x1c')]=function(_0x5e1398,_0x52afa9){this['rpc'][_0x5368('0x1d')](_0x5e1398)[_0x5368('0x18')](function(_0x2dda00){_0x52afa9(null,_0x2dda00?_0x2dda00['dsn']:![]);})['catch'](function(_0x2f21fc){_0x52afa9(_0x2f21fc);});};AGIVertices[_0x5368('0x12')][_0x5368('0x1e')]=function(_0x38f367,_0x1c2fcd){this[_0x5368('0x10')][_0x5368('0x1f')](_0x38f367)[_0x5368('0x18')](function(_0x380945){_0x1c2fcd(null,_0x380945?_0x380945[_0x5368('0x15')]:![]);})['catch'](function(_0x45884f){_0x1c2fcd(_0x45884f);});};AGIVertices[_0x5368('0x12')][_0x5368('0x20')]=function(_0x30d098,_0x1c287f){this[_0x5368('0x10')][_0x5368('0x21')](_0x30d098)[_0x5368('0x18')](function(_0x47c30f){_0x1c287f(null,_0x47c30f?_0x47c30f['name']:![]);})['catch'](function(_0x15c206){_0x1c287f(_0x15c206);});};AGIVertices[_0x5368('0x12')][_0x5368('0x22')]=function(_0x452c81,_0x131722){var _0x4b94cd=this;this[_0x5368('0x10')][_0x5368('0x23')](_0x452c81)[_0x5368('0x18')](function(_0x2bcf41){_0x131722(null,_0x2bcf41?_0x4b94cd[_0x5368('0x24')](_0x2bcf41[_0x5368('0x25')]):![]);})[_0x5368('0x19')](function(_0x2963a6){_0x131722(_0x2963a6);});};AGIVertices[_0x5368('0x12')][_0x5368('0x26')]=function(_0x260eab,_0x46ea22){this[_0x5368('0x10')]['getMailAccountById'](_0x260eab)[_0x5368('0x18')](function(_0x256abd){_0x46ea22(null,_0x256abd?_0x256abd:![]);})[_0x5368('0x19')](function(_0x5953b6){_0x46ea22(_0x5953b6);});};AGIVertices[_0x5368('0x12')]['sendMailMessage']=function(_0x26fc48,_0x18b186,_0x5007b6){this[_0x5368('0x11')][_0x5368('0x27')](_0x26fc48,_0x18b186)['then'](function(){_0x5007b6(null);})['catch'](function(_0x32a50e){_0x5007b6(_0x32a50e);});};AGIVertices[_0x5368('0x12')]['getIntervals']=function(_0x46169e,_0x2fde35){this[_0x5368('0x10')]['getIntervalById'](_0x46169e)[_0x5368('0x18')](function(_0x5b4993){if(_0x5b4993){if(_0x5b4993[_0x5368('0x28')]){_0x2fde35(null,[_0x5b4993[_0x5368('0x29')]]);}else{_0x2fde35(null,_[_0x5368('0x2a')](_0x5b4993['Intervals'],_0x5368('0x29')));}}else{_0x2fde35(null,![]);}})[_0x5368('0x19')](function(_0xce8b4){_0x2fde35(_0xce8b4);});};AGIVertices[_0x5368('0x12')]['getSoundPath']=function(_0x3818ad){return util['format'](_0x5368('0x2b'),FILES_PATH,_0x3818ad);};AGIVertices[_0x5368('0x12')]['getQueryOdbc']=function(_0x1b84fb,_0x197659,_0x46e59a){odbc[_0x5368('0x2c')](_0x1b84fb,function(_0x584e82){if(_0x584e82){logger[_0x5368('0x2d')](_0x5368('0x2e'),_0x584e82);_0x46e59a(_0x584e82);}else{logger[_0x5368('0x2f')](_0x5368('0x30'));odbc[_0x5368('0x31')](_0x197659,function(_0x5d384a,_0x1183a1){if(_0x5d384a){logger[_0x5368('0x2f')]('Error\x20executing\x20query\x20%s',_0x197659);_0x46e59a(_0x5d384a);}else{logger[_0x5368('0x2f')](_0x5368('0x32'),_0x197659);odbc[_0x5368('0x33')](function(_0x5e796f){if(_0x5e796f){logger[_0x5368('0x2d')](_0x5368('0x34'),_0x5e796f);}_0x46e59a(null,_0x1183a1);});}});}});};AGIVertices[_0x5368('0x12')][_0x5368('0x35')]=function(_0x55449f,_0x592536){this[_0x5368('0x10')][_0x5368('0x36')](_0x55449f)[_0x5368('0x18')](function(_0x4e7278){_0x592536(null,_0x4e7278?_0x4e7278:![]);})['catch'](function(_0x328ee5){_0x592536(_0x328ee5);});};AGIVertices['prototype'][_0x5368('0x37')]=function(_0x14f426,_0x50a593){this[_0x5368('0x10')][_0x5368('0x37')](_0x14f426)[_0x5368('0x18')](function(_0xed1792){_0x50a593(null,_0xed1792);})[_0x5368('0x19')](function(_0x404290){_0x50a593(_0x404290);});};AGIVertices[_0x5368('0x12')][_0x5368('0x38')]=function(_0x48c86,_0x43c776,_0x311c7c){this[_0x5368('0x10')]['createSquareDetailsReport']({'uniqueid':this[_0x5368('0xf')][_0x5368('0x39')],'node':_0x48c86[_0x5368('0x3a')],'application':_0x48c86['agicommand'],'data':_0x43c776||null,'project_name':this[_0x5368('0xf')][_0x5368('0x3b')],'callerid':this['channel'][_0x5368('0x3c')]})[_0x5368('0x18')](function(_0xffa746){if(_0x311c7c){_0x311c7c(null,_0xffa746);}})[_0x5368('0x19')](function(_0x43f2d3){if(_0x311c7c){_0x311c7c(_0x43f2d3);}});};AGIVertices[_0x5368('0x12')][_0x5368('0x3d')]=function(_0x5b562d,_0x315a7d,_0x17ad01,_0x5dc8bf){this['rpc'][_0x5368('0x3d')]({'uniqueid':this[_0x5368('0xf')][_0x5368('0x39')],'callerid':this[_0x5368('0xf')]['callerid'],'calleridname':this['channel'][_0x5368('0x3e')],'context':this['channel'][_0x5368('0x3f')],'extension':this['channel'][_0x5368('0x40')],'priority':this['channel'][_0x5368('0x41')],'accountcode':this[_0x5368('0xf')]['accountcode'],'dnid':this['channel'][_0x5368('0x42')],'projectName':this['channel'][_0x5368('0x3b')],'saveName':_0x315a7d,'filename':_0x5b562d[_0x5368('0x43')]||_0x315a7d,'savePath':_0x17ad01})[_0x5368('0x18')](function(_0x121d8d){_0x5dc8bf(null,_0x121d8d);})['catch'](function(_0x1adfc8){_0x5dc8bf(_0x1adfc8);});};AGIVertices[_0x5368('0x12')][_0x5368('0x44')]=function(_0x1d9c87,_0x20e641,_0x4399c3,_0x33626d,_0x489b4d){this['rpc'][_0x5368('0x44')]({'uniqueid':this[_0x5368('0xf')][_0x5368('0x39')],'body':_0x1d9c87,'direction':_0x20e641,'providerName':_0x4399c3,'providerResponse':_0x33626d})['then'](function(_0x42b09e){if(_0x489b4d){_0x489b4d(null,_0x42b09e);}})[_0x5368('0x19')](function(_0x1791d4){if(_0x489b4d){_0x489b4d(_0x1791d4);}});};AGIVertices[_0x5368('0x12')][_0x5368('0x45')]=function(_0x233bf6,_0x13e1eb){this[_0x5368('0x10')]['createCmContact']({'firstName':_[_0x5368('0x46')](_0x233bf6[_0x5368('0x15')])||_[_0x5368('0x47')](_0x233bf6[_0x5368('0x15')])?'callback_'+Math[_0x5368('0x48')]():_0x233bf6[_0x5368('0x15')],'lastName':_[_0x5368('0x46')](_0x233bf6[_0x5368('0x49')])||_[_0x5368('0x47')](_0x233bf6[_0x5368('0x49')])?null:_0x233bf6[_0x5368('0x49')],'phone':_0x233bf6[_0x5368('0x4a')],'ListId':_0x233bf6[_0x5368('0x4b')],'scheduledat':_0x233bf6[_0x5368('0x4c')],'callbackUniqueid':this[_0x5368('0xf')][_0x5368('0x39')],'tags':_0x5368('0x4d'),'description':_0x5368('0x4e')+_0x233bf6['scheduledAt'][_0x5368('0x4f')](),'priority':_0x233bf6[_0x5368('0x50')]})[_0x5368('0x18')](function(_0x2971de){_0x13e1eb(null,_0x2971de);})[_0x5368('0x19')](function(_0x4631b5){_0x13e1eb(_0x4631b5);});};AGIVertices['prototype'][_0x5368('0x51')]=function(_0x4a5654,_0x3cc107){this[_0x5368('0x10')][_0x5368('0x52')](_0x4a5654)[_0x5368('0x18')](function(_0xe348e1){_0x3cc107(null,_0xe348e1?_0xe348e1[_0x5368('0x15')]:![]);})[_0x5368('0x19')](function(_0x5e17d0){_0x3cc107(_0x5e17d0);});};AGIVertices[_0x5368('0x12')][_0x5368('0x53')]=function(_0x45bba1,_0x3822ff,_0xf127d0){var _0x7bf888={'role':_0x5368('0x54')};_0x7bf888[_0x45bba1]=this[_0x5368('0xf')][_0x5368('0x3c')];this[_0x5368('0x10')][_0x5368('0x53')](_0x7bf888,_0x3822ff,this[_0x5368('0xf')][_0x5368('0x39')])['then'](function(_0x4fa56e){_0xf127d0(null,_['isNil'](_0x4fa56e)?![]:!![]);})[_0x5368('0x19')](function(_0x32532a){logger[_0x5368('0x2d')](_0x32532a);_0xf127d0(null,![]);});};AGIVertices[_0x5368('0x12')]['agentUnpause']=function(_0x4935ef,_0x382421){var _0x3192e4={'role':_0x5368('0x54')};_0x3192e4[_0x4935ef]=this['channel'][_0x5368('0x3c')];this['rpc'][_0x5368('0x55')](_0x3192e4)[_0x5368('0x18')](function(_0x5d3c3d){_0x382421(null,_[_0x5368('0x47')](_0x5d3c3d)?![]:!![]);})[_0x5368('0x19')](function(_0x59dae2){logger[_0x5368('0x2d')](_0x59dae2);_0x382421(null,![]);});};AGIVertices[_0x5368('0x12')][_0x5368('0x56')]=function(_0x58685a,_0x501658){var _0x3b047f={'role':_0x5368('0x54')};_0x3b047f[_0x58685a]=this['channel']['callerid'];this[_0x5368('0x10')][_0x5368('0x56')](_0x3b047f)[_0x5368('0x18')](function(_0x5834d6){_0x501658(null,_[_0x5368('0x47')](_0x5834d6)?![]:!![]);})[_0x5368('0x19')](function(_0x2940a1){logger[_0x5368('0x2d')](_0x2940a1);_0x501658(null,![]);});};AGIVertices['prototype'][_0x5368('0x57')]=function(_0x5a70f4,_0x21b54b){var _0xfbb98c={'role':_0x5368('0x54')};_0xfbb98c[_0x5a70f4]=this['channel'][_0x5368('0x3c')];var _0x242a9a=_0x5a70f4!=_0x5368('0x58')?util[_0x5368('0x59')](_0x5368('0x5a'),_0x5368('0x5b'),this[_0x5368('0xf')][_0x5368('0x3c')]):undefined;this[_0x5368('0x10')][_0x5368('0x57')](_0xfbb98c,_0x242a9a)[_0x5368('0x18')](function(_0x23dd59){_0x21b54b(null,_[_0x5368('0x47')](_0x23dd59)?![]:!![]);})[_0x5368('0x19')](function(_0x27e47a){logger[_0x5368('0x2d')](_0x27e47a);_0x21b54b(null,![]);});};AGIVertices[_0x5368('0x12')][_0x5368('0x5c')]=function(_0x3debf0,_0x5ec9ca){sh[_0x5368('0x5d')](_[_0x5368('0x5e')](_0x3debf0),function(_0x2f8493,_0x486ab6){var _0x35ff81=_0x486ab6[_0x5368('0x5f')](/(\r\n|\n|\r)/gm,'');_0x5ec9ca(null,_0x35ff81);});};AGIVertices[_0x5368('0x12')][_0x5368('0x60')]=function(_0x433096,_0x5eea25){scripts['googleCloudTTS'](_0x433096['apiKey'],_0x433096[_0x5368('0x61')]||_0x5368('0x62'),_0x433096[_0x5368('0x62')],_0x433096['languageCode']||_0x5368('0x63'),_0x433096['ssmlGender']||'MALE',_0x433096[_0x5368('0x64')]||_0x5368('0x65'))[_0x5368('0x18')](function(_0x17eed8){_0x5eea25(null,_0x17eed8);})[_0x5368('0x19')](function(_0x39c550){_0x5eea25(_0x39c550);});};AGIVertices[_0x5368('0x12')][_0x5368('0x66')]=function(_0x339283,_0x2ce9da){scripts['googleTTS'](_0x339283[_0x5368('0x62')],_0x339283[_0x5368('0x67')]||'en',0x1)[_0x5368('0x18')](function(_0x53875a){_0x2ce9da(null,_0x53875a);})[_0x5368('0x19')](function(_0x1227b2){_0x2ce9da(_0x1227b2);});};AGIVertices[_0x5368('0x12')]['restAPI']=function(_0x3a296c,_0xcf017e){var _0x54f932={'uri':_0x3a296c[_0x5368('0x68')],'method':_0x3a296c['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3a296c[_0x5368('0x69')])==='number'&&parseInt(_0x3a296c[_0x5368('0x69')])>=0x1?parseInt(_0x3a296c[_0x5368('0x69')])*0x3e8:0x5*0x3e8};if(_[_0x5368('0x6a')](['POST','PUT'],_0x54f932[_0x5368('0x6b')][_0x5368('0x6c')]())){try{_0x54f932[_0x5368('0x6d')]=_0x3a296c[_0x5368('0xc')]?JSON['parse'](_0x3a296c['rawBody']):{};}catch(_0xc04ddb){logger['error'](_0x5368('0x6e'),_0xc04ddb);}}try{_0x54f932['headers']=_0x3a296c[_0x5368('0xb')]?JSON['parse'](_0x3a296c['rawHeaders']):{};}catch(_0xb9f734){logger['error'](_0x5368('0x6f'),_0xb9f734);}if(_0x3a296c[_0x5368('0x70')]){try{var _0x4c1a45=require(_0x3a296c[_0x5368('0x70')])[_0x5368('0x71')](this,_0x54f932);_0x54f932[_0x5368('0x72')]=Mustache[_0x5368('0x73')](_0x3a296c['url'],_0x4c1a45,{},['$$','$$']);if(_0x54f932[_0x5368('0x74')]){_0x54f932[_0x5368('0x74')]=JSON[_0x5368('0x75')](Mustache[_0x5368('0x73')](JSON[_0x5368('0x76')](_0x54f932[_0x5368('0x74')]),_0x4c1a45,{},['$$','$$']));}if(_0x54f932['body']){_0x54f932[_0x5368('0x6d')]=JSON[_0x5368('0x75')](Mustache[_0x5368('0x73')](JSON[_0x5368('0x76')](_0x54f932[_0x5368('0x6d')]),_0x4c1a45,{},['$$','$$']));}}catch(_0x257055){logger[_0x5368('0x2d')](_0x5368('0x77'),_0x257055);}}rp(_0x54f932)[_0x5368('0x18')](function(_0x58fbd5){var _0x9edb90={'statusCode':_0x58fbd5[_0x5368('0x78')]||0xc8,'statusMessage':_0x58fbd5[_0x5368('0x79')]||'OK','headers':_0x58fbd5[_0x5368('0x74')]||{},'body':_0x58fbd5[_0x5368('0x6d')]||{}};_0xcf017e(null,_0x9edb90);})[_0x5368('0x19')](function(_0x28ecb9){var _0x290bb8={'statusCode':_0x28ecb9[_0x5368('0x78')]||0x1f4,'statusMessage':_0x28ecb9[_0x5368('0x7a')]||_0x5368('0x7b'),'headers':_0x28ecb9[_0x5368('0x7c')][_0x5368('0x74')]||{},'body':_0x28ecb9[_0x5368('0x7c')]['body']||{}};_0xcf017e(null,_0x290bb8);});};AGIVertices[_0x5368('0x12')][_0x5368('0x7d')]=function(_0x4f50c7,_0x460ff3){scripts['googleDialogflow'](this[_0x5368('0xf')][_0x5368('0x39')],_0x4f50c7[_0x5368('0x7e')],_0x4f50c7['text'],_0x4f50c7[_0x5368('0x7f')]||'en')[_0x5368('0x18')](function(_0x574f33){_0x460ff3(null,_0x574f33);})[_0x5368('0x19')](function(_0xd179){_0x460ff3(_0xd179);});};AGIVertices[_0x5368('0x12')][_0x5368('0x80')]=function(_0x2ef8e3,_0x40e04a){scripts[_0x5368('0x80')](this[_0x5368('0xf')]['uniqueid'],_0x2ef8e3[_0x5368('0x81')],_0x2ef8e3[_0x5368('0x82')],_0x2ef8e3[_0x5368('0x83')],_0x2ef8e3[_0x5368('0x62')],_0x2ef8e3['dialogflowV2_language']||'en')[_0x5368('0x18')](function(_0x548708){_0x40e04a(null,_0x548708);})['catch'](function(_0x599fc8){_0x40e04a(_0x599fc8);});};AGIVertices['prototype'][_0x5368('0x84')]=function(_0x54a74c,_0x28803a){scripts['sestekNDA'](this[_0x5368('0xf')],_0x54a74c)[_0x5368('0x18')](function(_0x4d73e6){_0x28803a(null,_0x4d73e6);})[_0x5368('0x19')](function(_0x53a93f){_0x28803a(_0x53a93f);});};AGIVertices[_0x5368('0x12')][_0x5368('0x85')]=function(_0x338b4b,_0x4aade6){scripts[_0x5368('0x85')](_0x338b4b[_0x5368('0x7e')],_0x338b4b[_0x5368('0x62')],_0x338b4b[_0x5368('0x86')]||_0x5368('0x63'),_0x338b4b[_0x5368('0x87')])[_0x5368('0x18')](function(_0x3ea3fe){_0x4aade6(null,_0x3ea3fe);})[_0x5368('0x19')](function(_0x4944de){_0x4aade6(_0x4944de);});};AGIVertices[_0x5368('0x12')][_0x5368('0x88')]=function(_0xb093c,_0x566b21,_0x4741af){scripts['ispeechASR'](_0x566b21,_0xb093c[_0x5368('0x7e')],_0xb093c[_0x5368('0x89')]||'en-US',this['isConfigured'](_0xb093c[_0x5368('0x8a')])?_0xb093c[_0x5368('0x8a')]:undefined)[_0x5368('0x18')](function(_0x3a0638){_0x4741af(null,_0x3a0638);})['catch'](function(_0x80a8b0){_0x4741af(_0x80a8b0);});};AGIVertices[_0x5368('0x12')][_0x5368('0x8b')]=function(_0x2f1623,_0x7c35c4){scripts[_0x5368('0x8b')](_0x2f1623[_0x5368('0x8c')],_0x2f1623['aws_secret_access_key'],_0x2f1623[_0x5368('0x8d')],_0x2f1623[_0x5368('0x8e')]||_0x5368('0x8f'),_0x2f1623[_0x5368('0x62')],_0x2f1623[_0x5368('0x90')]||_0x5368('0x62'))[_0x5368('0x18')](function(_0x13f17a){_0x7c35c4(null,_0x13f17a);})[_0x5368('0x19')](function(_0x509fe9){_0x7c35c4(_0x509fe9);});};AGIVertices[_0x5368('0x12')][_0x5368('0x91')]=function(_0x3f497e,_0x421ad6){scripts['awsLex'](this[_0x5368('0xf')][_0x5368('0x39')],_0x3f497e[_0x5368('0x8c')],_0x3f497e[_0x5368('0x92')],_0x3f497e[_0x5368('0x93')],_0x3f497e[_0x5368('0x62')],_0x3f497e[_0x5368('0x94')])[_0x5368('0x18')](function(_0x227040){_0x421ad6(null,_0x227040);})['catch'](function(_0x1dd220){_0x421ad6(_0x1dd220);});};AGIVertices[_0x5368('0x12')][_0x5368('0x95')]=function(_0x21a7b0,_0x14a279,_0x2776a5){scripts[_0x5368('0x95')](_0x14a279,_0x21a7b0[_0x5368('0x7e')],_0x21a7b0['google_asr_language']||_0x5368('0x63'))[_0x5368('0x18')](function(_0x130e44){_0x2776a5(null,_0x130e44);})['catch'](function(_0x1f3ca8){_0x2776a5(_0x1f3ca8);});};AGIVertices[_0x5368('0x12')][_0x5368('0x96')]=function(_0x2339a6,_0x257e05,_0x2dc9a1){scripts[_0x5368('0x96')](_0x257e05,_0x2339a6[_0x5368('0x97')],_0x2339a6[_0x5368('0x98')],_0x2339a6[_0x5368('0x72')])[_0x5368('0x18')](function(_0x50137e){_0x2dc9a1(null,_0x50137e);})[_0x5368('0x19')](function(_0x45b55e){_0x2dc9a1(_0x45b55e);});};AGIVertices[_0x5368('0x12')][_0x5368('0x99')]=function(_0x50cbf2){var _0x2dbe1e=_['includes'](verticesWithRetry,_0x50cbf2[_0x5368('0x9a')])?_0x50cbf2:_['clone'](_0x50cbf2);for(var _0x1247d0 in _0x2dbe1e){if(_0x2dbe1e[_0x5368('0x9b')](_0x1247d0)){if(_0x2dbe1e[_0x1247d0]&&_['isString'](_0x2dbe1e[_0x1247d0])){if(_['includes'](recursiveMapAttributes,_0x1247d0)){_0x2dbe1e[_0x1247d0]=this[_0x5368('0x9c')](_0x2dbe1e[_0x1247d0]);}else{_0x2dbe1e[_0x1247d0]=this[_0x5368('0x9d')](_0x2dbe1e[_0x1247d0]);}}}}return _0x2dbe1e;};AGIVertices['prototype']['recursiveNodeIndex']=function(_0x5e21a7){for(var _0x268bd2 in _0x5e21a7){if(_0x5e21a7[_0x5368('0x9b')](_0x268bd2)){if(_['isPlainObject'](_0x5e21a7[_0x268bd2])){this[_0x5368('0x9e')](_0x5e21a7[_0x268bd2]);}else if(_['isArray'](_0x5e21a7[_0x268bd2])){for(var _0x24fd25=0x0;_0x24fd25<_0x5e21a7[_0x268bd2][_0x5368('0x9f')];_0x24fd25++){this[_0x5368('0x9e')](_0x5e21a7[_0x268bd2][_0x24fd25]);}}else if(_[_0x5368('0xa0')](_0x5e21a7[_0x268bd2])){_0x5e21a7[_0x268bd2]=this[_0x5368('0x9d')](_0x5e21a7[_0x268bd2]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x543c89,_0x143d3b){for(var _0x16c465 in _0x543c89){if(_0x543c89[_0x5368('0x9b')](_0x16c465)){if(_[_0x5368('0xa1')](_0x543c89[_0x16c465])){if(!_[_0x5368('0x46')](_0x543c89[_0x16c465])){this[_0x5368('0xa2')](_0x543c89[_0x16c465],util[_0x5368('0x59')]('%s.%s',_0x143d3b,_0x16c465));}}else if(_['isArray'](_0x543c89[_0x16c465])){for(var _0x25e15f=0x0;_0x25e15f<_0x543c89[_0x16c465][_0x5368('0x9f')];_0x25e15f++){this[_0x5368('0xa2')](_0x543c89[_0x16c465][_0x25e15f],util['format']('%s.%s',_0x143d3b,_0x16c465+'['+_0x25e15f+']'));}}else{if(!_[_0x5368('0x47')](_0x543c89[_0x16c465])){this[_0x5368('0xf')][_0x5368('0xa3')](util[_0x5368('0x59')](_0x5368('0xa4'),_0x143d3b,_0x16c465),_0x543c89[_0x16c465]);}}}}};AGIVertices[_0x5368('0x12')][_0x5368('0x9c')]=function(_0x52b55e){try{var _0x2bf1aa=JSON['parse'](_0x52b55e);this[_0x5368('0x9e')](_0x2bf1aa);return JSON[_0x5368('0x76')](_0x2bf1aa);}catch(_0x4fb269){return this['replaceAllVariables'](_0x52b55e);}};AGIVertices[_0x5368('0x12')][_0x5368('0x9d')]=function(_0x13843d){var _0x51bd1e=_0x13843d[_0x5368('0xa5')]('{');for(var _0x7765ff=0x1;_0x7765ff<_0x51bd1e[_0x5368('0x9f')];_0x7765ff+=0x1){var _0x27d207=_0x51bd1e[_0x7765ff]['split']('}');if(_0x27d207['length']>0x1){_0x13843d=_0x13843d[_0x5368('0xa6')]('{'+_0x27d207[0x0]+'}',this[_0x5368('0xf')][_0x5368('0x13')](_0x27d207[0x0])['extra']||_0x27d207[0x0]);}}if(_0x51bd1e[_0x5368('0x9f')]===0x1){return _0x13843d[_0x5368('0x4f')]();}return this[_0x5368('0x9d')](_0x13843d);};AGIVertices[_0x5368('0x12')]['getAndSetVariable']=function(_0x40e962,_0x51c9c9){var _0x47b392=this[_0x5368('0xf')][_0x5368('0x13')](_0x40e962);if(_0x47b392['result']===-0x1){return _0x47b392;}logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0xa7'),_0x51c9c9,_0x47b392['extra']));return this[_0x5368('0xf')][_0x5368('0xa3')](_0x51c9c9,_0x47b392[_0x5368('0xa8')]);};AGIVertices[_0x5368('0x12')]['isConfigured']=function(_0x14b2b1){return _0x14b2b1&&_0x14b2b1!=='0'&&_0x14b2b1!=='-1'&&_0x14b2b1!=='';};AGIVertices[_0x5368('0x12')][_0x5368('0xa9')]=function(_0x2f78ba){this[_0x5368('0x38')][_0x5368('0x71')](this,_0x2f78ba,'-');_0x2f78ba['retry']=_0x2f78ba[_0x5368('0xa9')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x5368('0x12')][_0x5368('0xaa')]=function(_0x205465){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x205465[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x205465[_0x5368('0x62')])){return this['channel']['noop'](_0x5368('0xac'));}var _0x2a1b43='\x22'+_0x205465[_0x5368('0x62')]+'\x22';if(this[_0x5368('0xab')](_0x205465['options'])){_0x2a1b43+=','+_0x205465[_0x5368('0x7c')];}var _0x45cb3c=this[_0x5368('0xf')][_0x5368('0x5d')](_0x5368('0xad'),_0x2a1b43);if(_0x45cb3c['result']===-0x1){return _0x45cb3c;}return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0xaf'),_0x2a1b43));};AGIVertices[_0x5368('0x12')]['mrcprecog']=function(_0x17e874){logger['info'](util[_0x5368('0x59')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x17e874['label']));if(!this[_0x5368('0xab')](_0x17e874[_0x5368('0xb0')])){return this[_0x5368('0xf')][_0x5368('0xae')]('no\x20grammar\x20configured');}var _0x1c5d2b=_0x17e874['grammar'];if(this['isConfigured'](_0x17e874[_0x5368('0x7c')])){_0x1c5d2b+=','+_0x17e874[_0x5368('0x7c')];}var _0x4ae15a=this[_0x5368('0xf')]['exec'](_0x5368('0xb1'),_0x1c5d2b);if(_0x4ae15a[_0x5368('0xb2')]===-0x1){return _0x4ae15a;}var _0x538ae9=this['getAndSetVariable'](_0x5368('0xb3'),'MRCP_RECOG_CONFIDENCE');if(_0x538ae9[_0x5368('0xb2')]===-0x1){return _0x538ae9;}var _0x186169=this['getAndSetVariable'](_0x5368('0xb4'),_0x5368('0xb5'));if(_0x186169[_0x5368('0xb2')]===-0x1){return _0x186169;}var _0x2c34cd=this[_0x5368('0xb6')]('RECOG_INSTANCE()',_0x5368('0xb7'));if(_0x2c34cd[_0x5368('0xb2')]===-0x1){return _0x2c34cd;}return this[_0x5368('0xf')][_0x5368('0xae')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x1c5d2b));};AGIVertices[_0x5368('0x12')][_0x5368('0x8')]=function(_0x103b03){logger['info'](util[_0x5368('0x59')](_0x5368('0xb8'),_0x103b03[_0x5368('0x3a')]));return this[_0x5368('0xf')][_0x5368('0x8')]([_0x103b03[_0x5368('0xb9')],_0x103b03[_0x5368('0xba')]]);};AGIVertices[_0x5368('0x12')][_0x5368('0xbb')]=function(_0x1421a2){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x1421a2[_0x5368('0x3a')]));if(this['isConfigured'](_0x1421a2[_0x5368('0x69')])){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0xbc'),_0x1421a2[_0x5368('0x69')]));var _0x39219b=this[_0x5368('0xf')][_0x5368('0xbd')](_0x1421a2[_0x5368('0x69')]);if(_0x39219b[_0x5368('0xb2')]===-0x1){return _0x39219b;}}return this['channel'][_0x5368('0xbb')]();};AGIVertices[_0x5368('0x12')][_0x5368('0x4d')]=function(_0x26ab21){logger['info'](util[_0x5368('0x59')](_0x5368('0xbe'),_0x26ab21[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x26ab21['list_id'])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x26ab21,'no\x20list\x20selected');}_0x26ab21[_0x5368('0x4c')]=moment();if(this[_0x5368('0xab')](_0x26ab21['delay'])){_0x26ab21['scheduledAt']=moment()['add'](_0x26ab21[_0x5368('0xbf')],_0x5368('0xc0'));}if(!this[_0x5368('0xab')](_0x26ab21[_0x5368('0x50')])){_0x26ab21[_0x5368('0x50')]=0x2;}this[_0x5368('0x45')]['sync'](this,_0x26ab21);return this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0xc1'),_0x26ab21[_0x5368('0x4a')],_0x26ab21[_0x5368('0x4b')],_0x26ab21[_0x5368('0x4c')]));};AGIVertices[_0x5368('0x12')][_0x5368('0xc2')]=function(_0x14ac47){logger['info'](util[_0x5368('0x59')](_0x5368('0xc3'),_0x14ac47[_0x5368('0x3a')]));var _0x3225ba=this[_0x5368('0xf')][_0x5368('0x5d')](_0x14ac47[_0x5368('0xc4')],_0x14ac47['options']);if(_0x3225ba[_0x5368('0xb2')]===-0x1){return _0x3225ba;}return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0xc5'),_0x14ac47['application'],_0x14ac47[_0x5368('0x7c')]));};AGIVertices[_0x5368('0x12')]['lumenvoxtts']=function(_0x20fd08){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x20fd08[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x20fd08['text'])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xac'));}var _0x1289ab='\x22'+_0x20fd08[_0x5368('0x62')]+'\x22';if(this['isConfigured'](_0x20fd08[_0x5368('0x7c')])){_0x1289ab+=','+_0x20fd08[_0x5368('0x7c')];}var _0xabf083=this[_0x5368('0xf')]['exec'](_0x5368('0xad'),_0x1289ab);if(_0xabf083[_0x5368('0xb2')]===-0x1){return _0xabf083;}return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0xaf'),_0x1289ab));};AGIVertices[_0x5368('0x12')]['sestektts']=function(_0x5c5eb2){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x5c5eb2[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x5c5eb2[_0x5368('0x62')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xac'));}var _0x37e03b='\x22'+_0x5c5eb2[_0x5368('0x62')]+'\x22';if(this[_0x5368('0xab')](_0x5c5eb2['options'])){_0x37e03b+=','+_0x5c5eb2['options'];}var _0x583382=this[_0x5368('0xf')]['exec'](_0x5368('0xad'),_0x37e03b);if(_0x583382[_0x5368('0xb2')]===-0x1){return _0x583382;}return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0xaf'),_0x37e03b));};AGIVertices[_0x5368('0x12')]['lumenvoxasr']=function(_0x3ca129){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0xc6'),_0x3ca129['label']));if(!this[_0x5368('0xab')](_0x3ca129['grammar'])){return this[_0x5368('0xf')][_0x5368('0xae')]('no\x20grammar\x20configured');}var _0x1210e9=_0x3ca129[_0x5368('0xb0')];if(this['isConfigured'](_0x3ca129[_0x5368('0x7c')])){_0x1210e9+=','+_0x3ca129[_0x5368('0x7c')];}var _0x4f31d0=this[_0x5368('0xf')][_0x5368('0x5d')](_0x5368('0xb1'),_0x1210e9);if(_0x4f31d0[_0x5368('0xb2')]===-0x1){return _0x4f31d0;}var _0x2eb508=this[_0x5368('0xb6')]('RECOG_CONFIDENCE()',_0x5368('0xc7'));if(_0x2eb508[_0x5368('0xb2')]===-0x1){return _0x2eb508;}var _0x213204=this['getAndSetVariable'](_0x5368('0xb4'),_0x5368('0xc8'));if(_0x213204['result']===-0x1){return _0x213204;}var _0x5c1213=this['getAndSetVariable'](_0x5368('0xc9'),_0x5368('0xca'));if(_0x5c1213[_0x5368('0xb2')]===-0x1){return _0x5c1213;}return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0xcb'),_0x1210e9));};AGIVertices['prototype'][_0x5368('0xcc')]=function(_0x31943c){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x31943c[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x31943c['grammar'])){return this[_0x5368('0xf')][_0x5368('0xae')]('no\x20grammar\x20configured');}var _0xdb07d3=_0x31943c['grammar'];if(this[_0x5368('0xab')](_0x31943c[_0x5368('0x7c')])){_0xdb07d3+=','+_0x31943c[_0x5368('0x7c')];}var _0x3f5cfe=this[_0x5368('0xf')][_0x5368('0x5d')](_0x5368('0xb1'),_0xdb07d3);if(_0x3f5cfe[_0x5368('0xb2')]===-0x1){return _0x3f5cfe;}var _0x147341=this['getAndSetVariable'](_0x5368('0xb3'),_0x5368('0xcd'));if(_0x147341[_0x5368('0xb2')]===-0x1){return _0x147341;}var _0x265dc5=this[_0x5368('0xb6')](_0x5368('0xb4'),_0x5368('0xce'));if(_0x265dc5[_0x5368('0xb2')]===-0x1){return _0x265dc5;}var _0x24c8a1=this[_0x5368('0xb6')](_0x5368('0xc9'),_0x5368('0xcf'));if(_0x24c8a1['result']===-0x1){return _0x24c8a1;}return this['channel'][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0xcb'),_0xdb07d3));};AGIVertices[_0x5368('0x12')][_0x5368('0xd0')]=function(_0x599f9d){logger['info'](util['format'](_0x5368('0xd1'),_0x599f9d['label']));if(!this['isConfigured'](_0x599f9d['odbc_id'])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x599f9d,_0x5368('0xd2'));}var _0x4e62cd=this['getSquareOdbc']['sync'](this,_0x599f9d[_0x5368('0xd3')]);if(!_0x4e62cd){return this['channel'][_0x5368('0x2d')](_0x599f9d,_0x5368('0xd4'));}if(!this['isConfigured'](_0x599f9d[_0x5368('0x31')])){return this[_0x5368('0xf')]['error'](_0x599f9d,_0x5368('0xd5'));}var _0x532f3d=_0x599f9d[_0x5368('0x31')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')]('query:\x20%s',_0x532f3d));var _0x1c095d=this['getQueryOdbc'][_0x5368('0x71')](this,_0x4e62cd,_0x532f3d);this[_0x5368('0x38')][_0x5368('0x71')](this,_0x599f9d,_0x532f3d);if(!this[_0x5368('0xab')](_0x599f9d[_0x5368('0xd6')])){return this['channel'][_0x5368('0xae')](_0x5368('0xd7'));}var _0xac2075=this['getVariable']['sync'](this,_0x599f9d[_0x5368('0xd6')]);if(!_0xac2075){return this['channel']['error'](_0x599f9d,_0x5368('0xd8'));}var _0x28a052=this;_0x1c095d['forEach'](function(_0x5f0f8d,_0x4edeb7){Object[_0x5368('0xd9')](_0x5f0f8d)[_0x5368('0xda')](function(_0x117f59){_0x28a052[_0x5368('0xf')]['setVariable'](util['format'](_0x5368('0xdb'),_0xac2075,_0x4edeb7,_0x117f59),_0x5f0f8d[_0x117f59]);});});this['channel'][_0x5368('0xa3')](util[_0x5368('0x59')](_0x5368('0xdc'),_0xac2075),_0x1c095d['length']);return this['channel'][_0x5368('0xae')](util[_0x5368('0x59')]('variable\x20%s\x20set',_0xac2075));};AGIVertices[_0x5368('0x12')][_0x5368('0xdd')]=function(_0x3b206b){logger[_0x5368('0xde')](util[_0x5368('0x59')](_0x5368('0xdf'),_0x3b206b['label']));if(!this[_0x5368('0xab')](_0x3b206b['sip_id'])){return this['channel'][_0x5368('0x2d')](_0x3b206b,_0x5368('0xe0'));}var _0x41a1eb=this[_0x5368('0x1e')][_0x5368('0x71')](this,_0x3b206b['sip_id']);if(!_0x41a1eb){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x3b206b,_0x5368('0xe1'));}var _0x2227db=this['channel'][_0x5368('0x5d')]('DIAL',[util[_0x5368('0x59')]('SIP/%s',_0x41a1eb),_0x3b206b[_0x5368('0x69')],_0x3b206b['opts'],_0x3b206b[_0x5368('0x68')]]);if(_0x2227db[_0x5368('0xb2')]===-0x1){return _0x2227db;}return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0xe2'),_0x5368('0xe3')));};AGIVertices[_0x5368('0x12')][_0x5368('0xe4')]=function(_0x9f0dc3){logger['info'](util[_0x5368('0x59')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x9f0dc3['label']));if(!this[_0x5368('0xab')](_0x9f0dc3[_0x5368('0x7e')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xe5'));}if(!this[_0x5368('0xab')](_0x9f0dc3[_0x5368('0x62')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xac'));}this[_0x5368('0xf')][_0x5368('0xe6')]=!![];this[_0x5368('0x38')](_0x9f0dc3);this[_0x5368('0x44')](_0x9f0dc3[_0x5368('0x62')],'in','','');this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0xe7'),_0x9f0dc3['text']));var _0x1c0922=this['googleDialogflow'][_0x5368('0x71')](this,_0x9f0dc3);if(_0x1c0922){for(var _0x8952b0 in _0x1c0922){if(_0x1c0922[_0x5368('0x9b')](_0x8952b0)){this[_0x5368('0xf')][_0x5368('0xa3')](util[_0x5368('0x59')](_0x5368('0xe8'),_0x8952b0[_0x5368('0x6c')]()),_0x1c0922[_0x8952b0]);}}this[_0x5368('0x44')](_0x1c0922[_0x5368('0xe9')],_0x5368('0xea'),_0x5368('0xe4'),'');return this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0xeb'),_0x1c0922['speech']));}return this[_0x5368('0xf')]['error'](_0x9f0dc3,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x5368('0x12')][_0x5368('0xec')]=function(_0x54ba44){logger[_0x5368('0x2f')](util['format'](_0x5368('0xed'),_0x54ba44[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x54ba44[_0x5368('0x81')])){return this['channel'][_0x5368('0xae')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x54ba44[_0x5368('0x82')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xee'));}if(!this[_0x5368('0xab')](_0x54ba44['private_key'])){return this[_0x5368('0xf')]['noop'](_0x5368('0xef'));}if(!this[_0x5368('0xab')](_0x54ba44['dialogflowV2_language'])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xf0'));}if(!this[_0x5368('0xab')](_0x54ba44[_0x5368('0x62')])){return this[_0x5368('0xf')]['noop'](_0x5368('0xac'));}this[_0x5368('0xf')][_0x5368('0xe6')]=!![];this[_0x5368('0x38')](_0x54ba44);this[_0x5368('0x44')](_0x54ba44['text'],'in','','');this['channel'][_0x5368('0xae')](util['format'](_0x5368('0xf1'),_0x54ba44['text']));var _0x1f0aeb=this['googleDialogflowV2'][_0x5368('0x71')](this,_0x54ba44);if(_0x1f0aeb){for(var _0x327850 in _0x1f0aeb){if(_0x1f0aeb[_0x5368('0x9b')](_0x327850)){if(_0x327850!==_0x5368('0xf2')){this[_0x5368('0xf')]['setVariable'](util[_0x5368('0x59')](_0x5368('0xe8'),_0x327850['toUpperCase']()),_0x1f0aeb[_0x327850]);}}}this[_0x5368('0x44')](_0x1f0aeb[_0x5368('0xe9')],'out',_0x5368('0xec'),_0x1f0aeb[_0x5368('0xf2')]);return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0xf3'),_0x1f0aeb['speech']));}return this['channel'][_0x5368('0x2d')](_0x54ba44,_0x5368('0xf4'));};AGIVertices['prototype'][_0x5368('0xf5')]=function(_0x222ee0){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0xf6'),_0x222ee0[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x222ee0[_0x5368('0xf7')])){return this[_0x5368('0xf')]['noop']('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x222ee0[_0x5368('0xf8')])){return this[_0x5368('0xf')]['noop'](_0x5368('0xf9'));}if(!this[_0x5368('0xab')](_0x222ee0[_0x5368('0xfa')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xfb'));}if(!this['isConfigured'](_0x222ee0['ndassistant_url'])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xac'));}this[_0x5368('0xf')][_0x5368('0xe6')]=!![];this['createSquareDetailsReport'](_0x222ee0);this['createSquareMessage'](_0x222ee0['text'],'in','','');this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')]('Trying\x20SestekNDA:\x20%s',_0x222ee0[_0x5368('0x62')]));var _0x3584dd=this['sestekNDA'][_0x5368('0x71')](this,_0x222ee0);if(_0x3584dd){for(var _0x5a2cdd in _0x3584dd){if(_0x3584dd[_0x5368('0x9b')](_0x5a2cdd)){this['channel'][_0x5368('0xa3')](util[_0x5368('0x59')](_0x5368('0xfc'),_0x5a2cdd[_0x5368('0x6c')]()),_0x3584dd[_0x5a2cdd]);}}this[_0x5368('0x44')](_0x3584dd['speech'],'out','sesteknda','');if(_0x3584dd['audiofile']){this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0xfd'),_0x3584dd[_0x5368('0xfe')]));var _0x23f2e9=this[_0x5368('0xf')]['streamFile'](_0x3584dd[_0x5368('0xfe')]);try{fs[_0x5368('0xff')](_0x3584dd['audiofile']+_0x5368('0x100'));}catch(_0x5a433b){logger[_0x5368('0x2d')](_0x5a433b);}return _0x23f2e9;}else{return this[_0x5368('0xf')][_0x5368('0xae')](util['format']('SestekNDA\x20Result\x20%s',_0x3584dd[_0x5368('0xe9')]));}}return this[_0x5368('0xf')][_0x5368('0x2d')](_0x222ee0,_0x5368('0x101'));};AGIVertices['prototype'][_0x5368('0x102')]=function(_0x50f41a){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x103'),_0x50f41a[_0x5368('0x3a')]));return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0x102'));};AGIVertices['prototype'][_0x5368('0x104')]=function(_0xede30e){logger['info'](util[_0x5368('0x59')](_0x5368('0x105'),_0xede30e['label']));var _0x281e7e='';if(_0xede30e[_0x5368('0x106')]){if(!this['isConfigured'](_0xede30e[_0x5368('0x106')])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0xede30e,'no\x20trunk\x20selected');}else{var _0x34f89a=parseInt(_0xede30e['trunk_id'],0xa);if(isNaN(_0x34f89a)){_0x281e7e=_0xede30e[_0x5368('0x106')];}else{_0x281e7e=this[_0x5368('0x20')]['sync'](this,_0xede30e[_0x5368('0x106')]);if(!_0x281e7e){return this[_0x5368('0xf')][_0x5368('0x2d')](_0xede30e,_0x5368('0x107'));}}}}else if(_0xede30e[_0x5368('0x108')]){_0x281e7e=_0xede30e[_0x5368('0x108')];}else{return this[_0x5368('0xf')]['error'](_0xede30e,_0x5368('0x109'));}var _0x33959b=this[_0x5368('0xf')][_0x5368('0x5d')](_0x5368('0xe3'),[util[_0x5368('0x59')](_0x5368('0x10a'),_0x281e7e,_0xede30e[_0x5368('0x4a')]),_0xede30e[_0x5368('0x69')],_0xede30e[_0x5368('0x10b')],_0xede30e['url']]);if(_0x33959b[_0x5368('0xb2')]===-0x1){return _0x33959b;}return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0xe2'),_0x5368('0xe3')));};AGIVertices[_0x5368('0x12')][_0x5368('0x10c')]=function(_0x5280ee){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x10d'),_0x5280ee[_0x5368('0x3a')]));return this['channel'][_0x5368('0xae')](_0x5368('0x10c'));};AGIVertices[_0x5368('0x12')][_0x5368('0xe')]=function(_0x55bc2a){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x10e'),_0x55bc2a[_0x5368('0x3a')]));if(_0x55bc2a[_0x5368('0x10f')]===0x0){return this[_0x5368('0xa9')](_0x55bc2a);}_0x55bc2a[_0x5368('0x10f')]-=0x1;if(!this['isConfigured'](_0x55bc2a[_0x5368('0x110')])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x55bc2a,'no\x20file\x20audio\x20selected');}var _0x251897=this[_0x5368('0x22')][_0x5368('0x71')](this,_0x55bc2a[_0x5368('0x110')]);if(!_0x251897){return this['channel']['error'](_0x55bc2a,_0x5368('0x111'));}if(!this[_0x5368('0xab')](_0x55bc2a[_0x5368('0xd6')])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x5368('0xd7'));}var _0x56521f=this[_0x5368('0xf')][_0x5368('0x112')](_0x251897,_0x55bc2a[_0x5368('0x113')],_0x55bc2a[_0x5368('0x114')]);var _0x1d81d8=_0x56521f['result']?_0x56521f['result'][_0x5368('0x4f')]():'';logger[_0x5368('0x2f')](_0x5368('0x115'),JSON[_0x5368('0x76')](_0x56521f));if(_0x56521f[_0x5368('0xb2')]===-0x1){this[_0x5368('0x38')]['sync'](this,_0x55bc2a,_0x1d81d8);return _0x56521f;}else if(_0x56521f[_0x5368('0xa8')]==='timeout'){_0x56521f[_0x5368('0xb2')]=_0x1d81d8[_0x5368('0x9f')]>=parseInt(_0x55bc2a['mindigit'])?'x':'i';}else{_0x56521f['result']=_0x1d81d8['length']>=parseInt(_0x55bc2a[_0x5368('0x116')])&&_0x1d81d8[_0x5368('0x9f')]<=parseInt(_0x55bc2a[_0x5368('0x114')])?'x':'i';}var _0x11c004=this[_0x5368('0x13')][_0x5368('0x71')](this,_0x55bc2a['variable_id']);if(!_0x11c004){return this['channel']['error'](_0x55bc2a,'no\x20variable\x20found');}this[_0x5368('0xf')]['setVariable'](_0x11c004,_0x1d81d8);if(this[_0x5368('0xab')](_0x55bc2a[_0x5368('0x117')])){var _0x37acda=parseInt(_0x55bc2a[_0x5368('0x117')],0xa);var _0x2ab8cb=rs[_0x5368('0x118')]({'charset':'*','length':_0x37acda});var _0x24e39c=_0x1d81d8[_0x5368('0x9f')];if(_0x24e39c>0x0){if(_0x24e39c>_0x37acda){this['createSquareDetailsReport'][_0x5368('0x71')](this,_0x55bc2a,_0x55bc2a[_0x5368('0x119')]==='first'?_0x2ab8cb+_0x1d81d8[_0x5368('0x11a')](_0x37acda):_0x1d81d8['substr'](0x0,_0x24e39c-_0x37acda)+_0x2ab8cb);}else{this['createSquareDetailsReport'][_0x5368('0x71')](this,_0x55bc2a,rs[_0x5368('0x118')]({'charset':'*','length':_0x24e39c}));}}else{this['createSquareDetailsReport'][_0x5368('0x71')](this,_0x55bc2a,'');}}else{this[_0x5368('0x38')][_0x5368('0x71')](this,_0x55bc2a,_0x1d81d8);}return _0x56521f;};AGIVertices[_0x5368('0x12')][_0x5368('0x11b')]=function(_0x1e4cad){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x11c'),_0x1e4cad[_0x5368('0x3a')]));return this[_0x5368('0xe')](_0x1e4cad);};AGIVertices['prototype']['goal']=function(_0x119d68){logger[_0x5368('0x2f')](util['format'](_0x5368('0x11d'),_0x119d68[_0x5368('0x3a')]));this[_0x5368('0x38')][_0x5368('0x71')](this,_0x119d68,_0x119d68[_0x5368('0x11e')]);return this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x11f'),_0x119d68[_0x5368('0x11e')]));};AGIVertices['prototype'][_0x5368('0x120')]=function(_0x3c68fb){logger['info'](util[_0x5368('0x59')](_0x5368('0x121'),_0x3c68fb[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x3c68fb[_0x5368('0x8c')])||!this[_0x5368('0xab')](_0x3c68fb[_0x5368('0x92')])){return this[_0x5368('0xf')]['noop'](_0x5368('0x122'));}if(!this[_0x5368('0xab')](_0x3c68fb[_0x5368('0x62')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xac'));}this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0x123'),_0x3c68fb['text']));var _0xe95422=this[_0x5368('0x8b')]['sync'](this,_0x3c68fb);if(_0xe95422){this['channel']['noop'](util[_0x5368('0x59')](_0x5368('0x124'),_0xe95422));var _0x3345b1=this[_0x5368('0xf')][_0x5368('0x125')](_0xe95422);try{fs[_0x5368('0xff')](_0xe95422+_0x5368('0x100'));}catch(_0x440ab3){logger[_0x5368('0x2d')](_0x440ab3);}return _0x3345b1;}return this[_0x5368('0xf')]['error'](_0x3c68fb,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x5368('0x12')][_0x5368('0x126')]=function(_0x1b6ada){logger['info'](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x1b6ada[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x1b6ada[_0x5368('0x8c')])||!this['isConfigured'](_0x1b6ada[_0x5368('0x92')])){return this[_0x5368('0xf')]['noop'](_0x5368('0x122'));}if(!this[_0x5368('0xab')](_0x1b6ada[_0x5368('0x94')])){return this['channel'][_0x5368('0xae')](_0x5368('0x127'));}if(!this[_0x5368('0xab')](_0x1b6ada[_0x5368('0x62')])){return this[_0x5368('0xf')]['noop'](_0x5368('0xac'));}this[_0x5368('0xf')][_0x5368('0xe6')]=!![];this[_0x5368('0x38')](_0x1b6ada);this[_0x5368('0x44')](_0x1b6ada['text'],'in','','');this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')]('Trying\x20Amazon\x20Lex:\x20%s',_0x1b6ada[_0x5368('0x62')]));var _0x34a43a=this[_0x5368('0x91')][_0x5368('0x71')](this,_0x1b6ada);if(_0x34a43a){for(var _0x2ca6e2 in _0x34a43a){if(_0x34a43a[_0x5368('0x9b')](_0x2ca6e2)&&_[_0x5368('0xa0')](_0x34a43a[_0x2ca6e2])){this[_0x5368('0xf')][_0x5368('0xa3')](util[_0x5368('0x59')]('AWS_LEX_%s',_0x2ca6e2[_0x5368('0x6c')]()),_0x34a43a[_0x2ca6e2]);}}if(_['isNil'](_0x34a43a[_0x5368('0x7a')])){return this[_0x5368('0xf')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x5368('0x44')](_0x34a43a[_0x5368('0x7a')],_0x5368('0xea'),_0x5368('0x128'),'');return this['channel'][_0x5368('0xae')](util['format'](_0x5368('0x129'),_0x34a43a['message']));}}return this['channel'][_0x5368('0x2d')](_0x1b6ada,_0x5368('0x12a'));};AGIVertices[_0x5368('0x12')][_0x5368('0x12b')]=function(_0x1f2692){logger[_0x5368('0x2f')](util['format'](_0x5368('0x12c'),_0x1f2692[_0x5368('0x3a')],_0x1f2692[_0x5368('0x69')]));if(!this[_0x5368('0xab')](_0x1f2692[_0x5368('0x7e')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xe5'));}var _0x1c9b6c=_0x5368('0x12d');var _0x7c87ab=util[_0x5368('0x59')](_0x5368('0x12e'),FILES_PATH,rs[_0x5368('0x118')](0x4));var _0x45f16=util[_0x5368('0x59')](_0x5368('0xa4'),_0x7c87ab,_0x1c9b6c);var _0x32350=!![];if(_0x1f2692[_0x5368('0x12f')]==='NOBEEP'){_0x32350=![];}var _0xfd4698=this[_0x5368('0xf')][_0x5368('0x130')](_0x7c87ab,_0x1c9b6c,_0x1f2692[_0x5368('0x131')],_0x1f2692[_0x5368('0x69')],undefined,_0x32350);if(_0xfd4698[_0x5368('0xb2')]!==-0x1){this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x132'),_0x45f16));var _0x39cdf9=this[_0x5368('0x95')][_0x5368('0x71')](this,_0x1f2692,_0x45f16);if(_0x39cdf9){for(var _0x55d31f in _0x39cdf9){if(_0x39cdf9[_0x5368('0x9b')](_0x55d31f)){this[_0x5368('0xf')][_0x5368('0xa3')](util[_0x5368('0x59')]('GOOGLE_ASR_%s',_0x55d31f[_0x5368('0x6c')]()),_0x39cdf9[_0x55d31f]);}}return this['channel']['noop'](util[_0x5368('0x59')](_0x5368('0x133'),JSON[_0x5368('0x76')](_0x39cdf9)));}}return _0xfd4698;};AGIVertices['prototype']['tildeasr']=function(_0x1c0b00){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x1c0b00['label']));if(!this[_0x5368('0xab')](_0x1c0b00[_0x5368('0x97')])){return this[_0x5368('0xf')]['noop'](_0x5368('0x134'));}if(!this[_0x5368('0xab')](_0x1c0b00[_0x5368('0x98')])){return this[_0x5368('0xf')]['noop'](_0x5368('0x135'));}var _0x46d905=_0x5368('0x12d');var _0x32581d=util[_0x5368('0x59')](_0x5368('0x12e'),FILES_PATH,rs[_0x5368('0x118')](0x4));var _0x4cca3c=util[_0x5368('0x59')]('%s.%s',_0x32581d,_0x46d905);var _0x172e78=!![];if(_0x1c0b00[_0x5368('0x12f')]===_0x5368('0x136')){_0x172e78=![];}var _0x563927=this['channel'][_0x5368('0x130')](_0x32581d,_0x46d905,_0x1c0b00['intKey'],_0x1c0b00[_0x5368('0x69')],undefined,_0x172e78);if(_0x563927['result']!==-0x1){this[_0x5368('0xf')]['noop'](util['format'](_0x5368('0x137'),_0x4cca3c));var _0x3c3312=this['tildeASR'][_0x5368('0x71')](this,_0x1c0b00,_0x4cca3c);if(_0x3c3312){for(var _0x5c5deb in _0x3c3312){if(_0x3c3312[_0x5368('0x9b')](_0x5c5deb)){this[_0x5368('0xf')][_0x5368('0xa3')](util[_0x5368('0x59')](_0x5368('0x138'),_0x5c5deb[_0x5368('0x6c')]()),_0x3c3312[_0x5c5deb]);}}return this[_0x5368('0xf')][_0x5368('0xae')](util['format']('TildeASR\x20Result\x20%s',JSON[_0x5368('0x76')](_0x3c3312)));}}return _0x563927;};AGIVertices[_0x5368('0x12')][_0x5368('0x139')]=function(_0xfbadd0){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x13a'),_0xfbadd0['label']));return this[_0x5368('0xf')][_0x5368('0x13b')](_0xfbadd0[_0x5368('0x3f')],_0xfbadd0['extension'],_0xfbadd0[_0x5368('0x41')]);};AGIVertices['prototype'][_0x5368('0x13c')]=function(_0x5aff03){logger[_0x5368('0x2f')](util['format'](_0x5368('0x13d'),_0x5aff03[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x5aff03['condition'])){return this['channel']['error'](_0x5aff03,_0x5368('0x13e'));}try{var _0x215a70=eval(_0x5aff03[_0x5368('0x13f')])?'true':'false';this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x140'),_0x5aff03[_0x5368('0x13f')],_0x215a70));return{'code':0xc8,'result':_0x215a70};}catch(_0x1c24dd){return{'code':0xc8,'result':_0x5368('0x141')};}};AGIVertices[_0x5368('0x12')][_0x5368('0x142')]=function(_0x5a7a9c){logger[_0x5368('0x2f')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5a7a9c[_0x5368('0x3a')]));if(!this['isConfigured'](_0x5a7a9c[_0x5368('0x143')])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x5a7a9c,_0x5368('0x144'));}var _0x5d49e9=this[_0x5368('0x145')]['sync'](this,_0x5a7a9c[_0x5368('0x143')]);if(!_0x5d49e9){return this['channel'][_0x5368('0x2d')](_0x5a7a9c,'no\x20intervals\x20found');}for(var _0x3abd42=0x0;_0x3abd42<_0x5d49e9[_0x5368('0x9f')];_0x3abd42+=0x1){var _0x1075cf=this[_0x5368('0xf')]['getVariable'](util[_0x5368('0x59')](_0x5368('0x146'),_0x5d49e9[_0x3abd42]));if(_0x1075cf[_0x5368('0xb2')]===-0x1){return _0x1075cf;}logger[_0x5368('0x2f')](util[_0x5368('0x59')]('IFTIME\x20%s\x20%s',_0x5d49e9[_0x3abd42],_0x1075cf['extra']));if(_0x1075cf[_0x5368('0xa8')]==='true'){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x147'),_0x5d49e9[_0x3abd42],_0x5368('0x148')));this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x147'),_0x5d49e9[_0x3abd42],_0x5368('0x148')));return{'code':0xc8,'result':_0x5368('0x148')};}else{logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x147'),_0x5d49e9[_0x3abd42],_0x5368('0x141')));this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')](_0x5368('0x147'),_0x5d49e9[_0x3abd42],'false'));}}return{'code':0xc8,'result':_0x5368('0x141')};};AGIVertices[_0x5368('0x12')][_0x5368('0x149')]=function(_0x521db6){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x521db6['label']));return this[_0x5368('0xf')][_0x5368('0x149')]();};AGIVertices[_0x5368('0x12')][_0x5368('0x14a')]=function(_0x4808a7){logger['info'](util[_0x5368('0x59')](_0x5368('0x14b'),_0x4808a7[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x4808a7[_0x5368('0x7e')])){return this['channel'][_0x5368('0xae')]('no\x20key\x20configured');}var _0x3fb75d='wav';var _0x4f7d0c=util['format'](_0x5368('0x12e'),FILES_PATH,rs[_0x5368('0x118')](0x4));var _0x4d8785=util['format'](_0x5368('0xa4'),_0x4f7d0c,_0x3fb75d);var _0x520d4b=!![];if(_0x4808a7[_0x5368('0x12f')]===_0x5368('0x136')){_0x520d4b=![];}var _0xa1f97b=this[_0x5368('0xf')][_0x5368('0x130')](_0x4f7d0c,_0x3fb75d,_0x4808a7['intKey'],_0x4808a7[_0x5368('0x69')],undefined,_0x520d4b);if(_0xa1f97b[_0x5368('0xb2')]!==-0x1){this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')]('ispeech\x20%s\x20file\x20created',_0x4d8785));var _0x4de0f5=this[_0x5368('0x88')][_0x5368('0x71')](this,_0x4808a7,_0x4d8785);if(_0x4de0f5){for(var _0x234409 in _0x4de0f5){if(_0x4de0f5[_0x5368('0x9b')](_0x234409)){this[_0x5368('0xf')]['setVariable'](util[_0x5368('0x59')](_0x5368('0x14c'),_0x234409[_0x5368('0x6c')]()),_0x4de0f5[_0x234409]);}}return this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x4de0f5)));}}return _0xa1f97b;};AGIVertices['prototype'][_0x5368('0x14d')]=function(_0x556266){logger['info'](util['format'](_0x5368('0x14e'),_0x556266[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x556266['key'])){return this[_0x5368('0xf')]['noop'](_0x5368('0xe5'));}if(!this[_0x5368('0xab')](_0x556266[_0x5368('0x62')])){return this['channel'][_0x5368('0xae')](_0x5368('0xac'));}this['channel'][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x14f'),_0x556266[_0x5368('0x62')]));var _0x1a5b5f=this[_0x5368('0x85')][_0x5368('0x71')](this,_0x556266);if(_0x1a5b5f){this[_0x5368('0xf')][_0x5368('0xae')](util['format']('ispeech\x20%s\x20file\x20created',_0x1a5b5f));var _0x49cfa4=this[_0x5368('0xf')][_0x5368('0x125')](_0x1a5b5f,_0x556266['intKey']);try{fs[_0x5368('0xff')](_0x1a5b5f+'.wav');}catch(_0x47d45a){logger[_0x5368('0x2d')](_0x47d45a);}return _0x49cfa4;}return this[_0x5368('0xf')][_0x5368('0x2d')](_0x556266,_0x5368('0x150'));};AGIVertices[_0x5368('0x12')]['login']=function(_0xd2b6bf){logger['info'](util[_0x5368('0x59')](_0x5368('0x151'),_0xd2b6bf[_0x5368('0x3a')]));if(!this['isConfigured'](_0xd2b6bf[_0x5368('0x152')])){return this[_0x5368('0xf')]['error'](_0xd2b6bf,_0x5368('0x153'));}logger['info'](util[_0x5368('0x59')](_0x5368('0x154'),this['channel']['callerid'],_0xd2b6bf['findBy']));var _0x488470=this['agentLogin'][_0x5368('0x71')](this,_0xd2b6bf['findBy']);if(_0x488470){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x155'),this[_0x5368('0xf')][_0x5368('0x3c')],_0xd2b6bf['findBy']));this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x155'),this[_0x5368('0xf')][_0x5368('0x3c')],_0xd2b6bf[_0x5368('0x152')]));return{'code':0xc8,'result':_0x5368('0x156')};}else{logger['info'](util[_0x5368('0x59')](_0x5368('0x157'),this[_0x5368('0xf')][_0x5368('0x3c')],_0xd2b6bf[_0x5368('0x152')]));this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x5368('0x3c')],_0xd2b6bf['findBy']));return{'code':0xc8,'result':_0x5368('0x158')};}};AGIVertices[_0x5368('0x12')]['logout']=function(_0x371452){logger['info'](util[_0x5368('0x59')](_0x5368('0x159'),_0x371452['label']));if(!this[_0x5368('0xab')](_0x371452[_0x5368('0x152')])){return this[_0x5368('0xf')]['error'](_0x371452,_0x5368('0x153'));}logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x154'),this['channel'][_0x5368('0x3c')],_0x371452[_0x5368('0x152')]));var _0x41477b=this[_0x5368('0x56')]['sync'](this,_0x371452[_0x5368('0x152')]);if(_0x41477b){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x155'),this[_0x5368('0xf')]['callerid'],_0x371452[_0x5368('0x152')]));this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x155'),this[_0x5368('0xf')]['callerid'],_0x371452['findBy']));return{'code':0xc8,'result':_0x5368('0x156')};}else{logger['info'](util[_0x5368('0x59')](_0x5368('0x157'),this[_0x5368('0xf')]['callerid'],_0x371452['findBy']));this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x157'),this[_0x5368('0xf')][_0x5368('0x3c')],_0x371452[_0x5368('0x152')]));return{'code':0xc8,'result':_0x5368('0x158')};}};AGIVertices[_0x5368('0x12')][_0x5368('0x15a')]=function(_0x403175){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x15b'),_0x403175[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x403175[_0x5368('0x15c')])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x403175,_0x5368('0x15d'));}this['channel']['noop'](util['format'](_0x5368('0x15e'),_0x403175[_0x5368('0x15c')]));var _0x19695f=eval(_0x403175[_0x5368('0x15c')]);if(!this['isConfigured'](_0x403175[_0x5368('0xd6')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0xd7'));}var _0x4db42c=this[_0x5368('0x13')]['sync'](this,_0x403175['variable_id']);if(!_0x4db42c){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x403175,_0x5368('0xd8'));}if(_[_0x5368('0x15f')](_0x19695f)){var _0x573e4f=this;_0x19695f[_0x5368('0xda')](function(_0x15e216,_0x2b4e89){_0x573e4f[_0x5368('0xf')][_0x5368('0xa3')](util[_0x5368('0x59')](_0x5368('0x160'),_0x4db42c,_0x2b4e89),_0x15e216);});return this[_0x5368('0xf')]['noop'](util['format'](_0x5368('0x161'),_0x4db42c));}else{return this[_0x5368('0xf')][_0x5368('0xa3')](_0x4db42c,_0x19695f);}};AGIVertices[_0x5368('0x12')][_0x5368('0xd')]=function(_0x3e1661){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x162'),_0x3e1661['label']));if(_0x3e1661[_0x5368('0x10f')]===0x0){return this['maxRetry'](_0x3e1661);}_0x3e1661[_0x5368('0x10f')]-=0x1;if(!this[_0x5368('0xab')](_0x3e1661[_0x5368('0x110')])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x3e1661,'no\x20file\x20audio\x20selected');}var _0xe04abc=this['getSound'][_0x5368('0x71')](this,_0x3e1661[_0x5368('0x110')]);if(!_0xe04abc){return this['channel'][_0x5368('0x2d')](_0x3e1661,_0x5368('0x111'));}var _0x107153=this['channel'][_0x5368('0x112')](_0xe04abc,_0x3e1661[_0x5368('0x113')],_0x3e1661[_0x5368('0x163')]);var _0x85e78d=_0x107153[_0x5368('0xb2')];if(_0x107153[_0x5368('0xb2')]===-0x1){this[_0x5368('0x38')]['sync'](this,_0x3e1661,'-1');return _0x107153;}else if(_0x107153[_0x5368('0xa8')]===_0x5368('0x69')){_0x107153[_0x5368('0xb2')]=_0x107153['result'][_0x5368('0x9f')]>0x0?_0x107153[_0x5368('0xb2')]:'t';}else if(_[_0x5368('0x46')](_0x107153[_0x5368('0xb2')])){_0x107153[_0x5368('0xb2')]='#';_0x85e78d='#';}if(!this[_0x5368('0xab')](_0x3e1661[_0x5368('0xd6')])){this['channel'][_0x5368('0xae')](_0x5368('0xd7'));}else{var _0x95f32f=this['getVariable'][_0x5368('0x71')](this,_0x3e1661[_0x5368('0xd6')]);if(!_0x95f32f){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x3e1661,_0x5368('0xd8'));}this[_0x5368('0xf')][_0x5368('0xa3')](_0x95f32f,_0x85e78d);}this[_0x5368('0x38')][_0x5368('0x71')](this,_0x3e1661,_0x85e78d);return _0x107153;};AGIVertices[_0x5368('0x12')]['noop']=function(_0x4acf05){logger['info'](util[_0x5368('0x59')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x4acf05[_0x5368('0x3a')]));return this[_0x5368('0xf')][_0x5368('0xae')](_0x4acf05[_0x5368('0x164')]||_0x4acf05[_0x5368('0x3a')]);};AGIVertices[_0x5368('0x12')]['pause']=function(_0x23ff7e){logger['info'](util[_0x5368('0x59')](_0x5368('0x165'),_0x23ff7e[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x23ff7e[_0x5368('0x152')])){return this[_0x5368('0xf')]['error'](_0x23ff7e,_0x5368('0x153'));}logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x154'),this['channel']['callerid'],_0x23ff7e[_0x5368('0x152')]));var _0x33a274=this[_0x5368('0x51')][_0x5368('0x71')](this,_0x23ff7e[_0x5368('0x166')]);var _0xf09bcf=this['agentPause'][_0x5368('0x71')](this,_0x23ff7e[_0x5368('0x152')],_0x33a274);if(_0xf09bcf){logger['info'](util[_0x5368('0x59')](_0x5368('0x155'),this['channel']['callerid'],_0x23ff7e[_0x5368('0x152')]));this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0x155'),this['channel'][_0x5368('0x3c')],_0x23ff7e[_0x5368('0x152')]));return{'code':0xc8,'result':_0x5368('0x156')};}else{logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x157'),this[_0x5368('0xf')][_0x5368('0x3c')],_0x23ff7e['findBy']));this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')](_0x5368('0x155'),this['channel'][_0x5368('0x3c')],_0x23ff7e['findBy']));return{'code':0xc8,'result':_0x5368('0x158')};}};AGIVertices[_0x5368('0x12')][_0x5368('0x167')]=function(_0x3b0bb5){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x168'),_0x3b0bb5['label']));if(!this['isConfigured'](_0x3b0bb5[_0x5368('0x110')])){return this['channel'][_0x5368('0x2d')](_0x3b0bb5,'no\x20file\x20audio\x20selected');}var _0x3a0735=this['getSound'][_0x5368('0x71')](this,_0x3b0bb5['file_id']);if(!_0x3a0735){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x3b0bb5,'no\x20file\x20audio\x20found');}var _0x47b350=this[_0x5368('0xf')][_0x5368('0x5d')]('PLAYBACK',[_0x3a0735,_0x3b0bb5['opts']]);if(_0x47b350['result']===-0x1){return _0x47b350;}return this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0xc5'),_0x5368('0x169'),_0x3a0735));};AGIVertices[_0x5368('0x12')][_0x5368('0x16a')]=function(_0x49710c){logger[_0x5368('0x2f')](util['format'](_0x5368('0x16b'),_0x49710c[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x49710c[_0x5368('0x16c')])){return this[_0x5368('0xf')]['error'](_0x49710c,_0x5368('0x16d'));}var _0x554ece='';var _0x18e065=parseInt(_0x49710c[_0x5368('0x16c')],0xa);if(isNaN(_0x18e065)){_0x554ece=_0x49710c[_0x5368('0x16c')];}else{_0x554ece=this[_0x5368('0x16')][_0x5368('0x71')](this,_0x49710c[_0x5368('0x16c')]);if(!_0x554ece){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x49710c,_0x5368('0x16e'));}}var _0x12f783='';if(this[_0x5368('0xab')](_0x49710c[_0x5368('0x110')])){var _0x1f59a5=this['getSound'][_0x5368('0x71')](this,_0x49710c[_0x5368('0x110')]);if(_0x1f59a5){_0x12f783=_0x1f59a5;}}this[_0x5368('0x38')][_0x5368('0x71')](this,_0x49710c,_0x554ece);if(_0x49710c[_0x5368('0x10b')][_0x5368('0x16f')]('x')<0x0){_0x49710c[_0x5368('0x10b')]+='x';}if(_0x49710c[_0x5368('0x10b')][_0x5368('0x16f')]('X')<0x0){_0x49710c['opts']+='X';}this[_0x5368('0xf')][_0x5368('0xa3')](_0x5368('0x170'),_0x554ece?_0x554ece[_0x5368('0x171')]():'');var _0x354dcf=this[_0x5368('0xf')][_0x5368('0x5d')](_0x5368('0x172'),[_0x554ece,_0x49710c[_0x5368('0x10b')],_0x49710c[_0x5368('0x68')],_0x12f783,_0x49710c[_0x5368('0x69')],_0x49710c['agi'],_0x49710c[_0x5368('0x173')],_0x49710c[_0x5368('0x174')],'',_0x49710c[_0x5368('0x175')]]);if(_0x354dcf[_0x5368('0xb2')]===-0x1){return _0x354dcf;}return this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')]('Executed\x20command\x20%s\x20%s',_0x5368('0x172'),_0x554ece));};AGIVertices[_0x5368('0x12')]['record']=function(_0x2bd076){logger[_0x5368('0x2f')](util['format'](_0x5368('0x176'),_0x2bd076['label']));var _0x4ec64a=_0x2bd076[_0x5368('0x177')]||_0x5368('0x12d');var _0x451c98=util[_0x5368('0x59')]('%s_%s',this[_0x5368('0xf')][_0x5368('0x39')],rs[_0x5368('0x118')](0x5));var _0x330dec=util[_0x5368('0x59')](_0x5368('0x178'),FILES_PATH,_0x451c98,_0x4ec64a);var _0x5a506d=util['format'](_0x5368('0x12e'),FILES_PATH,_0x451c98);this[_0x5368('0x3d')][_0x5368('0x71')](this,_0x2bd076,_0x451c98,_0x330dec);this['channel']['setVariable'](_0x5368('0x179'),_0x451c98);logger[_0x5368('0x2f')](_0x5368('0x17a'),_0x5a506d,_0x4ec64a,_0x2bd076[_0x5368('0x17b')],_0x2bd076[_0x5368('0x69')]);return this['channel'][_0x5368('0x130')](_0x5a506d,_0x4ec64a,_0x2bd076['escape_digits'],_0x2bd076[_0x5368('0x69')],undefined,!![]);};AGIVertices['prototype'][_0x5368('0x17c')]=function(_0x4eeb36){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x17d'),_0x4eeb36[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x4eeb36['url'])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0x17e'));}var _0xd8540a=this['restAPI'][_0x5368('0x71')](this,_0x4eeb36);logger['info'](util[_0x5368('0x59')](_0x5368('0x17f'),util[_0x5368('0x180')](_0xd8540a,{'showHidden':![],'depth':null})));if(!this[_0x5368('0xab')](_0x4eeb36[_0x5368('0xd6')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0x181'));}var _0x1db020=this[_0x5368('0x13')]['sync'](this,_0x4eeb36[_0x5368('0xd6')]);if(!_0x1db020){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x4eeb36,'no\x20variable\x20found');}this[_0x5368('0xf')][_0x5368('0xa3')](util[_0x5368('0x59')](_0x5368('0x182'),_0x1db020),_0xd8540a[_0x5368('0x78')]?_0xd8540a[_0x5368('0x78')]:'200');this['channel']['setVariable'](util[_0x5368('0x59')]('%s_STATUS_MESSAGE',_0x1db020),_0xd8540a[_0x5368('0x79')]?_0xd8540a[_0x5368('0x79')]:'OK');if(_0xd8540a[_0x5368('0x6d')]){try{this[_0x5368('0xa2')](_0xd8540a[_0x5368('0x6d')],_0x1db020);}catch(_0x3d7689){logger[_0x5368('0x2d')](util['format'](_0x5368('0x183'),_0x1db020));}}return this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0x184'),_0x1db020));};AGIVertices[_0x5368('0x12')][_0x5368('0x185')]=function(_0x4030d4){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x4030d4['label']));return this[_0x5368('0xf')][_0x5368('0x186')](_0x4030d4[_0x5368('0x187')]['replace'](/\s+/g,''),_0x4030d4[_0x5368('0x17b')]);};AGIVertices['prototype']['saynumber']=function(_0xfbf8df){logger[_0x5368('0x2f')](util['format'](_0x5368('0x188'),_0xfbf8df['label']));return this[_0x5368('0xf')]['sayNumber'](_0xfbf8df[_0x5368('0x189')][_0x5368('0x5f')](/\s+/g,''),_0xfbf8df[_0x5368('0x17b')]);};AGIVertices[_0x5368('0x12')][_0x5368('0x18a')]=function(_0x214200){logger[_0x5368('0x2f')](util['format'](_0x5368('0x18b'),_0x214200[_0x5368('0x3a')]));return this[_0x5368('0xf')]['sayPhonetic'](_0x214200[_0x5368('0x62')],_0x214200[_0x5368('0x17b')]);};AGIVertices['prototype'][_0x5368('0x18c')]=function(_0x2761f4){logger['info'](util['format'](_0x5368('0x18d'),_0x2761f4[_0x5368('0x3a')]));if(!this['isConfigured'](_0x2761f4[_0x5368('0x18e')])){return this['channel'][_0x5368('0xae')](_0x5368('0x18f'));}var _0x1d44c4=this['getMailAccount'][_0x5368('0x71')](this,_0x2761f4[_0x5368('0x18e')]);if(!_0x1d44c4||!_0x1d44c4['Smtp']){return this[_0x5368('0xf')]['error'](_0x2761f4,'no\x20mail\x20account\x20found');}var _0x11be20={'from':util[_0x5368('0x59')](_0x5368('0x190'),_0x1d44c4['name'],_0x1d44c4[_0x5368('0x191')]||_0x1d44c4[_0x5368('0x192')][_0x5368('0x193')]),'to':_0x2761f4['to']||'','cc':_0x2761f4['cc']||'','bcc':_0x2761f4[_0x5368('0x194')]||'','subject':_0x2761f4['subject'],'html':_0x2761f4[_0x5368('0x62')],'text':_0x2761f4[_0x5368('0x62')]};if(this[_0x5368('0xab')](_0x2761f4[_0x5368('0x195')])){}logger[_0x5368('0xde')](_0x5368('0x196'),JSON[_0x5368('0x76')](_0x11be20));this[_0x5368('0x38')][_0x5368('0x71')](this,_0x2761f4,_0x2761f4[_0x5368('0x18e')]);this['channel'][_0x5368('0xae')](util[_0x5368('0x59')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x1d44c4[_0x5368('0x15')]));this[_0x5368('0x27')][_0x5368('0x71')](this,_0x1d44c4['smtpOptions'],_0x11be20);return this['channel'][_0x5368('0xae')](_0x5368('0x197'));};AGIVertices[_0x5368('0x12')]['sendFax']=function(_0x58fba2){logger[_0x5368('0x2f')](util[_0x5368('0x59')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x58fba2[_0x5368('0x3a')]));return this['channel'][_0x5368('0xae')](_0x5368('0x198'));};AGIVertices[_0x5368('0x12')][_0x5368('0x199')]=function(_0xd6b618){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x19a'),_0xd6b618['label']));if(!this[_0x5368('0xab')](_0xd6b618['sms_account_id'])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0x19b'));}var _0x17c060=this[_0x5368('0x35')][_0x5368('0x71')](this,_0xd6b618['sms_account_id']);if(!_0x17c060){return this[_0x5368('0xf')][_0x5368('0x2d')](_0xd6b618,_0x5368('0x19c'));}var _0x48a79c={'body':_0xd6b618[_0x5368('0x19d')],'phone':_0xd6b618['to']||'','SmsAccountId':_0x17c060['id']};logger[_0x5368('0xde')](_0x5368('0x19e'),JSON['stringify'](_0x48a79c));this['createSquareDetailsReport']['sync'](this,_0xd6b618,_0xd6b618['sms_account_id']);this['channel'][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x19f'),_0x17c060['name']));this[_0x5368('0x37')]['sync'](this,_0x48a79c);return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0x1a0'));};AGIVertices['prototype']['set']=function(_0x500769){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x1a1'),_0x500769[_0x5368('0x3a')]));if(!this[_0x5368('0xab')](_0x500769[_0x5368('0xd6')])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x500769,_0x5368('0x1a2'));}var _0x48d159=this[_0x5368('0x13')][_0x5368('0x71')](this,_0x500769[_0x5368('0xd6')]);if(!_0x48d159){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x500769,_0x5368('0xd8'));}return this['channel']['setVariable'](_0x48d159,_0x500769[_0x5368('0x1a3')]);};AGIVertices['prototype']['start']=function(_0x55ebc4){logger[_0x5368('0x2f')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x55ebc4[_0x5368('0x3a')]));this[_0x5368('0xf')][_0x5368('0xae')]('START\x20CALLY\x20SQUARE');var _0x34a155=this[_0x5368('0xf')][_0x5368('0x13')](_0x5368('0x1a4'));if(!_[_0x5368('0x46')](_0x34a155['extra'])){this[_0x5368('0xf')]['uniqueid']=_0x34a155[_0x5368('0xa8')];}if(_0x55ebc4[_0x5368('0xbb')]===_0x5368('0x1a5')){this['channel']['noop'](_0x5368('0x1a6'));return this[_0x5368('0xf')][_0x5368('0xbb')]();}return this[_0x5368('0xf')]['noop'](_0x5368('0x1a7'));};AGIVertices['prototype'][_0x5368('0x1a8')]=function(_0x56fb0d){logger[_0x5368('0x2f')](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x56fb0d[_0x5368('0x3a')]));if(!this['isConfigured'](_0x56fb0d['project_id'])){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x56fb0d,'no\x20subproject\x20selected');}var _0xa07511=this[_0x5368('0x1a')][_0x5368('0x71')](this,_0x56fb0d['project_id']);if(!this[_0x5368('0xab')](_0xa07511)){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x56fb0d,util[_0x5368('0x59')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x56fb0d[_0x5368('0x1a9')]));}if(_0xa07511===this[_0x5368('0xf')][_0x5368('0x3b')]){return this[_0x5368('0xf')][_0x5368('0x2d')](_0x56fb0d,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport'][_0x5368('0x71')](this,_0x56fb0d,_0xa07511);var _0x13230e=this[_0x5368('0xf')][_0x5368('0x5d')](_0x5368('0x1aa'),util[_0x5368('0x59')](_0x5368('0x1ab'),config[_0x5368('0x8')][_0x5368('0x1ac')]||'127.0.0.1',_0xa07511,this['channel'][_0x5368('0x3b')]));if(_0x13230e['result']===-0x1){return _0x13230e;}return this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0xc5'),_0x5368('0x1aa'),_0xa07511));};AGIVertices[_0x5368('0x12')][_0x5368('0x1ad')]=function(_0x1ec487){logger[_0x5368('0x2f')](util['format'](_0x5368('0x1ae'),_0x1ec487[_0x5368('0x3a')]));var _0x173525=this[_0x5368('0x5c')]['sync'](this,_0x1ec487['command']);this['createSquareDetailsReport'][_0x5368('0x71')](this,_0x1ec487,_0x1ec487[_0x5368('0xb9')]);if(this[_0x5368('0xab')](_0x1ec487[_0x5368('0xd6')])){var _0x2eb8ff=this[_0x5368('0x13')][_0x5368('0x71')](this,_0x1ec487[_0x5368('0xd6')]);if(_0x2eb8ff){this[_0x5368('0xf')][_0x5368('0xa3')](_0x2eb8ff,_0x173525);return this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x1ec487['command'],_0x2eb8ff));}}return this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x1af'),_0x1ec487['command']));};AGIVertices[_0x5368('0x12')][_0x5368('0x1b0')]=function(_0x2869bb){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x1b1'),_0x2869bb[_0x5368('0x3a')]));_0x2869bb[_0x5368('0x62')]=_0x2869bb[_0x5368('0x62')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5368('0xab')](_0x2869bb[_0x5368('0x1b2')])){return this[_0x5368('0xf')][_0x5368('0xae')](_0x5368('0x1b3'));}if(!this[_0x5368('0xab')](_0x2869bb[_0x5368('0x62')])){return this[_0x5368('0xf')]['noop']('no\x20text\x20configured');}this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x1b4'),_0x2869bb[_0x5368('0x62')]));var _0x4b17fb=this[_0x5368('0x60')]['sync'](this,_0x2869bb);if(_0x4b17fb){this['channel']['noop'](util[_0x5368('0x59')](_0x5368('0x1b5'),_0x4b17fb));var _0x536990=this[_0x5368('0xf')]['streamFile'](_0x4b17fb);try{fs[_0x5368('0xff')](_0x4b17fb+'.wav');}catch(_0x2f0916){logger['error'](_0x2f0916);}return _0x536990;}return this['channel'][_0x5368('0x2d')](_0x2869bb,_0x5368('0x1b6'));};AGIVertices[_0x5368('0x12')]['tts']=function(_0x4ba0c7){logger['info'](util[_0x5368('0x59')](_0x5368('0x1b7'),_0x4ba0c7[_0x5368('0x3a')]));_0x4ba0c7['text']=_0x4ba0c7[_0x5368('0x62')][_0x5368('0x5f')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x5368('0xab')](_0x4ba0c7[_0x5368('0x62')])){return this[_0x5368('0xf')][_0x5368('0xae')]('no\x20text\x20configured');}this['channel'][_0x5368('0xae')](util['format'](_0x5368('0x1b8'),_0x4ba0c7[_0x5368('0x62')]));var _0x3c90d6=this[_0x5368('0x66')][_0x5368('0x71')](this,_0x4ba0c7);if(_0x3c90d6){this[_0x5368('0xf')][_0x5368('0xae')](util['format'](_0x5368('0x1b9'),_0x3c90d6));var _0x507dda=this[_0x5368('0xf')][_0x5368('0x125')](_0x3c90d6);try{fs[_0x5368('0xff')](_0x3c90d6+_0x5368('0x100'));}catch(_0x2ee236){logger[_0x5368('0x2d')](_0x2ee236);}return _0x507dda;}return this[_0x5368('0xf')][_0x5368('0x2d')](_0x4ba0c7,_0x5368('0x1ba'));};AGIVertices['prototype'][_0x5368('0x1bb')]=function(_0x5ef8a0){logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x1bc'),_0x5ef8a0['label']));if(!this[_0x5368('0xab')](_0x5ef8a0['findBy'])){return this['channel'][_0x5368('0x2d')](_0x5ef8a0,_0x5368('0x153'));}logger[_0x5368('0x2f')](util[_0x5368('0x59')](_0x5368('0x154'),this[_0x5368('0xf')][_0x5368('0x3c')],_0x5ef8a0['findBy']));var _0x5c37c1=this[_0x5368('0x55')]['sync'](this,_0x5ef8a0[_0x5368('0x152')]);if(_0x5c37c1){logger[_0x5368('0x2f')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x5368('0xf')][_0x5368('0x3c')],_0x5ef8a0[_0x5368('0x152')]));this[_0x5368('0xf')][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x155'),this[_0x5368('0xf')][_0x5368('0x3c')],_0x5ef8a0[_0x5368('0x152')]));return{'code':0xc8,'result':_0x5368('0x156')};}else{logger['info'](util[_0x5368('0x59')](_0x5368('0x157'),this[_0x5368('0xf')]['callerid'],_0x5ef8a0[_0x5368('0x152')]));this['channel'][_0x5368('0xae')](util[_0x5368('0x59')](_0x5368('0x157'),this[_0x5368('0xf')][_0x5368('0x3c')],_0x5ef8a0[_0x5368('0x152')]));return{'code':0xc8,'result':_0x5368('0x158')};}};AGIVertices[_0x5368('0x12')][_0x5368('0x1bd')]=function(_0x2fabbc){logger[_0x5368('0x2f')](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x2fabbc[_0x5368('0x3a')]));var _0x219e77=this['channel'][_0x5368('0x5d')]('VOICEMAIL',[_0x2fabbc[_0x5368('0x1be')],_0x2fabbc[_0x5368('0x7c')]]);if(_0x219e77[_0x5368('0xb2')]===-0x1){return _0x219e77;}return this[_0x5368('0xf')]['noop'](util[_0x5368('0x59')](_0x5368('0xc5'),'VOICEMAIL',_0x2fabbc['mailbox']));};AGIVertices[_0x5368('0x12')][_0x5368('0x1bf')]=function(_0x4b0729){logger[_0x5368('0x2f')](util['format'](_0x5368('0x1c0'),_0x4b0729['label']));if(!this[_0x5368('0xab')](_0x4b0729['variable_id'])){return this['channel'][_0x5368('0x2d')](_0x4b0729,_0x5368('0x1a2'));}var _0x433413=this[_0x5368('0x13')][_0x5368('0x71')](this,_0x4b0729[_0x5368('0xd6')]);if(!_0x433413){return this['channel'][_0x5368('0x2d')](_0x4b0729,_0x5368('0xd8'));}var _0x708d77=this['channel']['getVariable'](_0x433413);return{'code':0xc8,'result':_0x708d77[_0x5368('0xa8')]?_0x708d77[_0x5368('0xa8')]:'-'};};String[_0x5368('0x12')][_0x5368('0xa6')]=function(_0x17e661,_0x396e88){return this[_0x5368('0xa5')](_0x17e661)[_0x5368('0x1c1')](_0x396e88);};module[_0x5368('0x1c2')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 53c7f51..cafa459 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 _0x98df=['queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','[ACW][START]\x20%s','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\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','deleteChannelAfterTimeout','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','lastPauseAt','timer','update','then','info','catch','error','finally','startAcw','channels','interface'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x98df,0x150));var _0xf98d=function(_0x2e9e47,_0x16a9af){_0x2e9e47=_0x2e9e47-0x0;var _0x1a3cca=_0x98df[_0x2e9e47];return _0x1a3cca;};'use strict';var _=require(_0xf98d('0x0'));var moment=require(_0xf98d('0x1'));var ami=require(_0xf98d('0x2'));var logger=require('../../../config/logger')(_0xf98d('0x3'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xf98d('0x4'));function Acw(_0x17e4d6){this[_0xf98d('0x5')]=_0x17e4d6[_0xf98d('0x5')];this['agents']=_0x17e4d6[_0xf98d('0x6')];this[_0xf98d('0x7')]=_0x17e4d6[_0xf98d('0x7')];this['channels']={};ami['on'](_0xf98d('0x8'),this[_0xf98d('0x9')][_0xf98d('0xa')](this));ami['on'](_0xf98d('0xb'),this[_0xf98d('0xc')]['bind'](this));ami['on'](_0xf98d('0xd'),this['syncHangup'][_0xf98d('0xa')](this));ami['on'](_0xf98d('0xe'),this[_0xf98d('0xf')]['bind'](this));ami['on']('attendedtransfer',this[_0xf98d('0x10')][_0xf98d('0xa')](this));ami['on'](_0xf98d('0x11'),this[_0xf98d('0x12')][_0xf98d('0xa')](this));ami['on'](_0xf98d('0x13'),this[_0xf98d('0x14')]['bind'](this));}function getDiff(_0x3f84ff){var _0x55d4eb=moment()[_0xf98d('0x15')](0x0);var _0x15cb7c=moment(_0x3f84ff)[_0xf98d('0x15')](0x0);return _0x55d4eb[_0xf98d('0x16')](_0x15cb7c,_0xf98d('0x17'));}Acw[_0xf98d('0x18')]['updateAcw']=function(_0x184512,_0x11e2c0){var _0x2ae4a7=this;var _0x5e63e5=getDiff(_0x2ae4a7[_0xf98d('0x7')][_0x184512][_0xf98d('0x19')]);clearTimeout(_0x2ae4a7[_0xf98d('0x7')][_0x184512][_0xf98d('0x1a')]);_0x2ae4a7['timers'][_0x184512][_0xf98d('0x1a')]=![];return RpcVoiceAgentReport[_0xf98d('0x1b')]({'acwtime':_0x5e63e5},_0x2ae4a7[_0xf98d('0x7')][_0x184512]['uniqueid'],_0x184512)[_0xf98d('0x1c')](function(_0x3ee33a){logger[_0xf98d('0x1d')]('[%s][UPDATE][ACWTIME:%s]',_0x11e2c0,_0x5e63e5,_0x3ee33a);})[_0xf98d('0x1e')](function(_0xd488c5){logger[_0xf98d('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x11e2c0,_0xd488c5);})[_0xf98d('0x20')](function(){delete _0x2ae4a7[_0xf98d('0x7')][_0x184512];});};Acw['prototype'][_0xf98d('0x21')]=function(_0x4a2571){try{var _0x48d63e=this;var _0x58c4c7=this[_0xf98d('0x22')][_0x4a2571][_0xf98d('0x23')];var _0x38802e=this['channels'][_0x4a2571][_0xf98d('0x24')];var _0x3bee1a=this[_0xf98d('0x5')][_0x38802e];var _0x1fffde=![];var _0x40a148=_0xf98d('0x25');if(_0x3bee1a[_0xf98d('0x26')]&&_0x3bee1a[_0xf98d('0x27')]['name']){_0x1fffde=!![];_0x40a148=_0x3bee1a['mandatoryDispositionPause'][_0xf98d('0x28')];}return ami['Action']({'action':_0xf98d('0x29'),'interface':_0x58c4c7,'paused':!![],'reason':_0x40a148})[_0xf98d('0x1c')](function(){if(_0x48d63e[_0xf98d('0x6')][_0x58c4c7]){return RpcUser[_0xf98d('0x2a')](_0x48d63e[_0xf98d('0x6')][_0x58c4c7]['id'])[_0xf98d('0x1c')](function(_0x3bad31){if(!_0x3bad31||_0x3bad31[_0xf98d('0x2b')]){logger[_0xf98d('0x1d')](_0xf98d('0x2c'),_0x4a2571,_0x58c4c7,_0x38802e);return;}logger['info'](_0xf98d('0x2d'),_0x4a2571,_0x58c4c7,_0x38802e);var _0xd36d31=_0x48d63e[_0xf98d('0x22')][_0x4a2571][_0xf98d('0x2e')]&&_0x48d63e[_0xf98d('0x22')][_0x4a2571]['destlinkedid']?_0x48d63e[_0xf98d('0x22')][_0x4a2571][_0xf98d('0x2f')]:_0x4a2571;return RpcUser[_0xf98d('0x30')](_0x48d63e['agents'][_0x58c4c7],_0x40a148,_0xd36d31)[_0xf98d('0x1c')](function(_0x5bec3b){_0x48d63e['voiceQueues'][_0x38802e][_0xf98d('0x31')]-=0x1;_0x48d63e[_0xf98d('0x5')][_0x38802e][_0xf98d('0x32')]+=0x1;return _0x5bec3b;});})[_0xf98d('0x1c')](function(_0x19e073){if(_0x1fffde||!_0x19e073){return;}_0x48d63e['timers'][_0x58c4c7]={};logger['info'](_0xf98d('0x33'),_0x4a2571,_0x48d63e[_0xf98d('0x5')][_0x38802e]['acwTimeout'],_0x58c4c7,_0x38802e);_0x48d63e[_0xf98d('0x7')][_0x58c4c7][_0xf98d('0x1a')]=setTimeout(_0x48d63e['stopAcw'][_0xf98d('0xa')](_0x48d63e,_0x58c4c7),_0x48d63e['voiceQueues'][_0x38802e][_0xf98d('0x34')]*0x3e8);_0x48d63e[_0xf98d('0x7')][_0x58c4c7][_0xf98d('0x19')]=moment()[_0xf98d('0x35')](_0xf98d('0x36'));_0x48d63e[_0xf98d('0x7')][_0x58c4c7][_0xf98d('0x37')]=_0x4a2571;_0x48d63e[_0xf98d('0x7')][_0x58c4c7][_0xf98d('0x24')]=_0x38802e;_0x48d63e['timers'][_0x58c4c7]['updateAcw']=_0x48d63e[_0xf98d('0x38')]['bind'](_0x48d63e,_0x58c4c7,_0x4a2571);});}})['catch'](function(){logger[_0xf98d('0x1f')](_0xf98d('0x33'),_0x4a2571,_0x48d63e[_0xf98d('0x5')][_0x38802e][_0xf98d('0x34')],_0x58c4c7,_0x38802e);})[_0xf98d('0x20')](function(){delete _0x48d63e['channels'][_0x4a2571];});}catch(_0x5b6ac4){logger['error'](_0xf98d('0x39'),_0x5b6ac4[_0xf98d('0x3a')]);}};Acw['prototype'][_0xf98d('0x3b')]=function(_0x145568){try{var _0x40b90e=this;if(_0x40b90e[_0xf98d('0x7')][_0x145568]){_0x40b90e[_0xf98d('0x7')][_0x145568][_0xf98d('0x1a')]=![];var _0x56490e=_0x40b90e[_0xf98d('0x7')][_0x145568][_0xf98d('0x37')];var _0x11d85b=_0x40b90e[_0xf98d('0x7')][_0x145568][_0xf98d('0x24')];var _0x2a8202=_0x40b90e[_0xf98d('0x5')][_0x11d85b][_0xf98d('0x34')];logger[_0xf98d('0x1d')](_0xf98d('0x3c'),_0x56490e,_0x145568);RpcUser[_0xf98d('0x2a')](this['agents'][_0x145568]['id'])[_0xf98d('0x1c')](function(_0x47fd5d){if(_0x47fd5d['pauseType']===_0xf98d('0x25')){return RpcUser[_0xf98d('0x3d')](_0x40b90e[_0xf98d('0x6')][_0x145568]);}});RpcVoiceAgentReport[_0xf98d('0x1b')]({'acwtime':_0x2a8202,'agentacw':!![]},_0x56490e,_0x145568)[_0xf98d('0x1c')](function(_0x163a8d){logger['info'](_0xf98d('0x3e'),_0x56490e,_0x2a8202,_0x163a8d);})['catch'](function(_0x55a278){logger[_0xf98d('0x1f')](_0xf98d('0x3f'),_0x56490e,_0x55a278);});}else{logger['error'](_0xf98d('0x40'),_0x145568);if(_0x40b90e[_0xf98d('0x7')]){logger[_0xf98d('0x1d')](_0xf98d('0x41'),JSON['stringify'](_0x40b90e['timers']));}}}catch(_0x4c564d){logger[_0xf98d('0x1f')](_0xf98d('0x42'),_0x4c564d[_0xf98d('0x3a')]);}};Acw['prototype'][_0xf98d('0x9')]=function(_0x5dac6b){try{if(this['voiceQueues'][_0x5dac6b[_0xf98d('0x24')]]&&(this['voiceQueues'][_0x5dac6b[_0xf98d('0x24')]]['acw']||this['voiceQueues'][_0x5dac6b['queue']][_0xf98d('0x26')])){if(this['agents'][_0x5dac6b[_0xf98d('0x23')]]){this[_0xf98d('0x22')][_0x5dac6b['uniqueid']]={'queue':_0x5dac6b[_0xf98d('0x24')],'interface':_0x5dac6b['interface'],'destlinkedid':_0x5dac6b[_0xf98d('0x2f')]};}}}catch(_0x5dc007){logger['error'](_0xf98d('0x43'),_0x5dc007[_0xf98d('0x3a')]);}};Acw[_0xf98d('0x18')]['syncAgentConnectPreview']=function(_0x3c2640){try{if(this[_0xf98d('0x5')][_0x3c2640['queue']]&&(this[_0xf98d('0x5')][_0x3c2640['queue']][_0xf98d('0x3')]||this[_0xf98d('0x5')][_0x3c2640[_0xf98d('0x24')]][_0xf98d('0x26')])){if(this[_0xf98d('0x6')][_0x3c2640[_0xf98d('0x23')]]){this[_0xf98d('0x22')][_0x3c2640[_0xf98d('0x37')]]={'queue':_0x3c2640['queue'],'interface':_0x3c2640[_0xf98d('0x23')]};}}}catch(_0x12afec){logger[_0xf98d('0x1f')]('[ACW][syncAgentConnectPreview]\x20%s',_0x12afec[_0xf98d('0x3a')]);}};Acw['prototype']['syncHangupRequest']=function(_0x4e7925){try{if(this[_0xf98d('0x22')][_0x4e7925['uniqueid']]&&_[_0xf98d('0x44')](this[_0xf98d('0x22')][_0x4e7925[_0xf98d('0x37')]][_0xf98d('0x2e')])){logger[_0xf98d('0x1d')](_0xf98d('0x45'),_0x4e7925[_0xf98d('0x37')]);this[_0xf98d('0x21')](_0x4e7925[_0xf98d('0x37')]);}else if(this[_0xf98d('0x22')][_0x4e7925[_0xf98d('0x46')]]&&_[_0xf98d('0x44')](this[_0xf98d('0x22')][_0x4e7925[_0xf98d('0x46')]][_0xf98d('0x2e')])){logger[_0xf98d('0x1d')](_0xf98d('0x47'),_0x4e7925[_0xf98d('0x46')]);this['startAcw'](_0x4e7925[_0xf98d('0x46')]);}}catch(_0x1942e9){logger[_0xf98d('0x1f')](_0xf98d('0x48'),_0x1942e9[_0xf98d('0x3a')]);}};Acw[_0xf98d('0x18')][_0xf98d('0x49')]=function(_0x34daf7){try{if(this[_0xf98d('0x22')][_0x34daf7[_0xf98d('0x37')]]&&this[_0xf98d('0x22')][_0x34daf7[_0xf98d('0x37')]][_0xf98d('0x2e')]){logger[_0xf98d('0x1d')](_0xf98d('0x4a'),_0x34daf7[_0xf98d('0x37')]);this[_0xf98d('0x21')](_0x34daf7[_0xf98d('0x37')]);}else if(this[_0xf98d('0x22')][_0x34daf7[_0xf98d('0x46')]]&&this[_0xf98d('0x22')][_0x34daf7[_0xf98d('0x46')]]['attended']){logger[_0xf98d('0x1d')](_0xf98d('0x4b'),_0x34daf7['linkedid']);this[_0xf98d('0x21')](_0x34daf7['linkedid']);}}catch(_0x15a707){logger[_0xf98d('0x1f')](_0xf98d('0x4c'),_0x15a707[_0xf98d('0x3a')]);}};Acw[_0xf98d('0x18')][_0xf98d('0x10')]=function(_0x3e98ed){try{if(!_[_0xf98d('0x4d')](this[_0xf98d('0x22')][_0x3e98ed[_0xf98d('0x4e')]])){this[_0xf98d('0x21')](_0x3e98ed['transfereeuniqueid']);if(this['channels'][_0x3e98ed[_0xf98d('0x4f')]]){this[_0xf98d('0x22')][_0x3e98ed[_0xf98d('0x4f')]][_0xf98d('0x2e')]=!![];this[_0xf98d('0x22')][_0x3e98ed[_0xf98d('0x50')]]=this[_0xf98d('0x22')][_0x3e98ed['secondtransfereruniqueid']];this[_0xf98d('0x51')](_0x3e98ed[_0xf98d('0x4f')]);}}else if(!_[_0xf98d('0x4d')](this[_0xf98d('0x22')][_0x3e98ed[_0xf98d('0x50')]])){this[_0xf98d('0x21')](_0x3e98ed[_0xf98d('0x50')]);if(this['channels'][_0x3e98ed[_0xf98d('0x52')]]){this[_0xf98d('0x22')][_0x3e98ed[_0xf98d('0x52')]][_0xf98d('0x2e')]=!![];this['channels'][_0x3e98ed['transfereeuniqueid']]=this['channels'][_0x3e98ed[_0xf98d('0x52')]];this[_0xf98d('0x51')](_0x3e98ed[_0xf98d('0x52')]);}}}catch(_0x31192b){logger[_0xf98d('0x1f')]('[ACW][syncAttendedTransfer]\x20%s',_0x31192b[_0xf98d('0x3a')]);}};Acw['prototype'][_0xf98d('0x12')]=function(_0x3b2b25){try{if(this[_0xf98d('0x22')][_0x3b2b25[_0xf98d('0x53')]]){logger['info'](_0xf98d('0x54'),JSON[_0xf98d('0x55')](_0x3b2b25[_0xf98d('0x53')]));this[_0xf98d('0x21')](_0x3b2b25[_0xf98d('0x53')]);}else if(this[_0xf98d('0x22')][_0x3b2b25[_0xf98d('0x56')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xf98d('0x55')](_0x3b2b25['transfererlinkedid']));this[_0xf98d('0x21')](_0x3b2b25['transfererlinkedid']);}}catch(_0xab6015){logger['error'](_0xf98d('0x57'),_0xab6015[_0xf98d('0x3a')]);}};Acw[_0xf98d('0x18')]['syncAgentRingNoAnswer']=function(_0xa20861){try{if(this['voiceQueues'][_0xa20861['queue']]&&this[_0xf98d('0x5')][_0xa20861[_0xf98d('0x24')]][_0xf98d('0x58')]===_0xf98d('0x59')){if(this['agents'][_0xa20861[_0xf98d('0x23')]]){logger[_0xf98d('0x1d')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0xa20861[_0xf98d('0x37')],_0xa20861['interface'],_0xa20861[_0xf98d('0x24')]);return RpcUser[_0xf98d('0x30')](this[_0xf98d('0x6')][_0xa20861['interface']],_0xf98d('0x5a'),_0xa20861[_0xf98d('0x37')]);}}}catch(_0x262bc1){logger[_0xf98d('0x1f')](_0xf98d('0x5b'),_0x262bc1[_0xf98d('0x3a')]);}};Acw[_0xf98d('0x18')][_0xf98d('0x51')]=function(_0x1ce8f7,_0x32e1e9=0x2710){if(this[_0xf98d('0x22')][_0x1ce8f7]){setTimeout(()=>{delete this[_0xf98d('0x22')][_0x1ce8f7];},_0x32e1e9);}};module[_0xf98d('0x5c')]=Acw; \ No newline at end of file +var _0xb1dd=['attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','finally','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','[ACW][START]\x20%s','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','[ACW][TIMERS]','acw','interface','destlinkedid','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','startAcw','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','stringify','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','moment','../ami','../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xb1dd,0x9b));var _0xdb1d=function(_0x4a7eeb,_0x328fba){_0x4a7eeb=_0x4a7eeb-0x0;var _0x294879=_0xb1dd[_0x4a7eeb];return _0x294879;};'use strict';var _=require('lodash');var moment=require(_0xdb1d('0x0'));var ami=require(_0xdb1d('0x1'));var logger=require(_0xdb1d('0x2'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xdb1d('0x3'));function Acw(_0xe7606b){this[_0xdb1d('0x4')]=_0xe7606b[_0xdb1d('0x4')];this[_0xdb1d('0x5')]=_0xe7606b['agents'];this[_0xdb1d('0x6')]=_0xe7606b['timers'];this[_0xdb1d('0x7')]={};ami['on']('agentconnect',this[_0xdb1d('0x8')][_0xdb1d('0x9')](this));ami['on'](_0xdb1d('0xa'),this[_0xdb1d('0xb')][_0xdb1d('0x9')](this));ami['on']('hangup',this[_0xdb1d('0xc')][_0xdb1d('0x9')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0xdb1d('0x9')](this));ami['on'](_0xdb1d('0xd'),this[_0xdb1d('0xe')][_0xdb1d('0x9')](this));ami['on'](_0xdb1d('0xf'),this[_0xdb1d('0x10')][_0xdb1d('0x9')](this));ami['on'](_0xdb1d('0x11'),this[_0xdb1d('0x12')][_0xdb1d('0x9')](this));}function getDiff(_0x268f8b){var _0x11eccc=moment()[_0xdb1d('0x13')](0x0);var _0x3378db=moment(_0x268f8b)[_0xdb1d('0x13')](0x0);return _0x11eccc[_0xdb1d('0x14')](_0x3378db,_0xdb1d('0x15'));}Acw[_0xdb1d('0x16')][_0xdb1d('0x17')]=function(_0x491f98,_0x16bb14){var _0x52c495=this;var _0x3c6a96=getDiff(_0x52c495[_0xdb1d('0x6')][_0x491f98][_0xdb1d('0x18')]);clearTimeout(_0x52c495[_0xdb1d('0x6')][_0x491f98][_0xdb1d('0x19')]);_0x52c495[_0xdb1d('0x6')][_0x491f98][_0xdb1d('0x19')]=![];return RpcVoiceAgentReport[_0xdb1d('0x1a')]({'acwtime':_0x3c6a96},_0x52c495[_0xdb1d('0x6')][_0x491f98]['uniqueid'],_0x491f98)[_0xdb1d('0x1b')](function(_0x126830){logger[_0xdb1d('0x1c')](_0xdb1d('0x1d'),_0x16bb14,_0x3c6a96,_0x126830);})[_0xdb1d('0x1e')](function(_0x57d01a){logger[_0xdb1d('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x16bb14,_0x57d01a);})[_0xdb1d('0x20')](function(){delete _0x52c495[_0xdb1d('0x6')][_0x491f98];});};Acw[_0xdb1d('0x16')]['startAcw']=function(_0x1745cb){try{var _0x3f819c=this;var _0x54813d=this[_0xdb1d('0x7')][_0x1745cb]['interface'];var _0x4d1cae=this[_0xdb1d('0x7')][_0x1745cb][_0xdb1d('0x21')];var _0x5beced=this[_0xdb1d('0x4')][_0x4d1cae];var _0x45be96=![];var _0x2de8b4=_0xdb1d('0x22');if(_0x5beced[_0xdb1d('0x23')]&&_0x5beced['mandatoryDispositionPause'][_0xdb1d('0x24')]){_0x45be96=!![];_0x2de8b4=_0x5beced[_0xdb1d('0x25')][_0xdb1d('0x24')];}return ami[_0xdb1d('0x26')]({'action':_0xdb1d('0x27'),'interface':_0x54813d,'paused':!![],'reason':_0x2de8b4})['then'](function(){if(_0x3f819c[_0xdb1d('0x5')][_0x54813d]){return RpcUser[_0xdb1d('0x28')](_0x3f819c[_0xdb1d('0x5')][_0x54813d]['id'])[_0xdb1d('0x1b')](function(_0x4ec640){if(!_0x4ec640||_0x4ec640[_0xdb1d('0x29')]){logger[_0xdb1d('0x1c')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x1745cb,_0x54813d,_0x4d1cae);return;}logger[_0xdb1d('0x1c')](_0xdb1d('0x2a'),_0x1745cb,_0x54813d,_0x4d1cae);var _0x322946=_0x3f819c[_0xdb1d('0x7')][_0x1745cb]['attended']&&_0x3f819c['channels'][_0x1745cb]['destlinkedid']?_0x3f819c['channels'][_0x1745cb]['destlinkedid']:_0x1745cb;return RpcUser[_0xdb1d('0x2b')](_0x3f819c[_0xdb1d('0x5')][_0x54813d],_0x2de8b4,_0x322946)[_0xdb1d('0x1b')](function(_0x3c4d12){_0x3f819c['voiceQueues'][_0x4d1cae]['available']-=0x1;_0x3f819c[_0xdb1d('0x4')][_0x4d1cae]['paused']+=0x1;return _0x3c4d12;});})['then'](function(_0x1f24e0){if(_0x45be96||!_0x1f24e0){return;}_0x3f819c[_0xdb1d('0x6')][_0x54813d]={};logger[_0xdb1d('0x1c')](_0xdb1d('0x2c'),_0x1745cb,_0x3f819c['voiceQueues'][_0x4d1cae]['acwTimeout'],_0x54813d,_0x4d1cae);_0x3f819c[_0xdb1d('0x6')][_0x54813d]['timer']=setTimeout(_0x3f819c['stopAcw'][_0xdb1d('0x9')](_0x3f819c,_0x54813d),_0x3f819c[_0xdb1d('0x4')][_0x4d1cae][_0xdb1d('0x2d')]*0x3e8);_0x3f819c[_0xdb1d('0x6')][_0x54813d]['lastPauseAt']=moment()[_0xdb1d('0x2e')](_0xdb1d('0x2f'));_0x3f819c[_0xdb1d('0x6')][_0x54813d][_0xdb1d('0x30')]=_0x1745cb;_0x3f819c['timers'][_0x54813d][_0xdb1d('0x21')]=_0x4d1cae;_0x3f819c['timers'][_0x54813d][_0xdb1d('0x17')]=_0x3f819c[_0xdb1d('0x17')][_0xdb1d('0x9')](_0x3f819c,_0x54813d,_0x1745cb);});}})[_0xdb1d('0x1e')](function(){logger['error'](_0xdb1d('0x2c'),_0x1745cb,_0x3f819c[_0xdb1d('0x4')][_0x4d1cae][_0xdb1d('0x2d')],_0x54813d,_0x4d1cae);})[_0xdb1d('0x20')](function(){delete _0x3f819c[_0xdb1d('0x7')][_0x1745cb];});}catch(_0x33d0c0){logger['error'](_0xdb1d('0x31'),_0x33d0c0[_0xdb1d('0x32')]);}};Acw['prototype'][_0xdb1d('0x33')]=function(_0x315a0f){try{var _0x35bb2c=this;if(_0x35bb2c[_0xdb1d('0x6')][_0x315a0f]){_0x35bb2c[_0xdb1d('0x6')][_0x315a0f]['timer']=![];var _0x45886f=_0x35bb2c[_0xdb1d('0x6')][_0x315a0f][_0xdb1d('0x30')];var _0x1474f7=_0x35bb2c[_0xdb1d('0x6')][_0x315a0f]['queue'];var _0x5c5e8c=_0x35bb2c['voiceQueues'][_0x1474f7][_0xdb1d('0x2d')];logger[_0xdb1d('0x1c')](_0xdb1d('0x34'),_0x45886f,_0x315a0f);RpcUser[_0xdb1d('0x28')](this[_0xdb1d('0x5')][_0x315a0f]['id'])[_0xdb1d('0x1b')](function(_0x4fcfa1){if(_0x4fcfa1['pauseType']===_0xdb1d('0x22')){return RpcUser['saveUnpause'](_0x35bb2c[_0xdb1d('0x5')][_0x315a0f]);}});RpcVoiceAgentReport[_0xdb1d('0x1a')]({'acwtime':_0x5c5e8c,'agentacw':!![]},_0x45886f,_0x315a0f)[_0xdb1d('0x1b')](function(_0x30e9a1){logger[_0xdb1d('0x1c')]('[%s][UPDATE][ACWTIME:%s]',_0x45886f,_0x5c5e8c,_0x30e9a1);})[_0xdb1d('0x1e')](function(_0x565e18){logger[_0xdb1d('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x45886f,_0x565e18);});}else{logger[_0xdb1d('0x1f')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x315a0f);if(_0x35bb2c[_0xdb1d('0x6')]){logger['info'](_0xdb1d('0x35'),JSON['stringify'](_0x35bb2c[_0xdb1d('0x6')]));}}}catch(_0x31860c){logger[_0xdb1d('0x1f')]('[ACW][STOP]\x20%s',_0x31860c[_0xdb1d('0x32')]);}};Acw[_0xdb1d('0x16')][_0xdb1d('0x8')]=function(_0x1b3aca){try{if(this[_0xdb1d('0x4')][_0x1b3aca[_0xdb1d('0x21')]]&&(this['voiceQueues'][_0x1b3aca[_0xdb1d('0x21')]][_0xdb1d('0x36')]||this['voiceQueues'][_0x1b3aca[_0xdb1d('0x21')]][_0xdb1d('0x23')])){if(this[_0xdb1d('0x5')][_0x1b3aca[_0xdb1d('0x37')]]){this[_0xdb1d('0x7')][_0x1b3aca[_0xdb1d('0x30')]]={'queue':_0x1b3aca[_0xdb1d('0x21')],'interface':_0x1b3aca['interface'],'destlinkedid':_0x1b3aca[_0xdb1d('0x38')]};}}}catch(_0x1d4002){logger[_0xdb1d('0x1f')](_0xdb1d('0x39'),_0x1d4002['message']);}};Acw['prototype'][_0xdb1d('0x12')]=function(_0x2b20a9){try{if(this[_0xdb1d('0x4')][_0x2b20a9[_0xdb1d('0x21')]]&&(this['voiceQueues'][_0x2b20a9['queue']][_0xdb1d('0x36')]||this['voiceQueues'][_0x2b20a9[_0xdb1d('0x21')]][_0xdb1d('0x23')])){if(this[_0xdb1d('0x5')][_0x2b20a9[_0xdb1d('0x37')]]){this[_0xdb1d('0x7')][_0x2b20a9['uniqueid']]={'queue':_0x2b20a9[_0xdb1d('0x21')],'interface':_0x2b20a9['interface']};}}}catch(_0x38445d){logger[_0xdb1d('0x1f')](_0xdb1d('0x3a'),_0x38445d[_0xdb1d('0x32')]);}};Acw['prototype'][_0xdb1d('0xb')]=function(_0x371b80){try{if(this[_0xdb1d('0x7')][_0x371b80['uniqueid']]&&_[_0xdb1d('0x3b')](this[_0xdb1d('0x7')][_0x371b80['uniqueid']][_0xdb1d('0x3c')])){logger[_0xdb1d('0x1c')](_0xdb1d('0x3d'),_0x371b80[_0xdb1d('0x30')]);this['startAcw'](_0x371b80[_0xdb1d('0x30')]);}else if(this[_0xdb1d('0x7')][_0x371b80[_0xdb1d('0x3e')]]&&_[_0xdb1d('0x3b')](this[_0xdb1d('0x7')][_0x371b80['linkedid']][_0xdb1d('0x3c')])){logger[_0xdb1d('0x1c')](_0xdb1d('0x3f'),_0x371b80['linkedid']);this['startAcw'](_0x371b80[_0xdb1d('0x3e')]);}}catch(_0x3c141f){logger[_0xdb1d('0x1f')](_0xdb1d('0x40'),_0x3c141f[_0xdb1d('0x32')]);}};Acw[_0xdb1d('0x16')][_0xdb1d('0xc')]=function(_0x53540a){try{if(this[_0xdb1d('0x7')][_0x53540a[_0xdb1d('0x30')]]&&this[_0xdb1d('0x7')][_0x53540a[_0xdb1d('0x30')]]['attended']){logger[_0xdb1d('0x1c')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x53540a['uniqueid']);this[_0xdb1d('0x41')](_0x53540a[_0xdb1d('0x30')]);}else if(this[_0xdb1d('0x7')][_0x53540a[_0xdb1d('0x3e')]]&&this['channels'][_0x53540a['linkedid']]['attended']){logger[_0xdb1d('0x1c')](_0xdb1d('0x42'),_0x53540a[_0xdb1d('0x3e')]);this[_0xdb1d('0x41')](_0x53540a[_0xdb1d('0x3e')]);}}catch(_0x70a2f5){logger[_0xdb1d('0x1f')]('[ACW][syncHangup]\x20%s',_0x70a2f5[_0xdb1d('0x32')]);}};Acw['prototype'][_0xdb1d('0xe')]=function(_0x392a7d){try{if(!_[_0xdb1d('0x43')](this[_0xdb1d('0x7')][_0x392a7d['transfereeuniqueid']])){this[_0xdb1d('0x41')](_0x392a7d['transfereeuniqueid']);if(this[_0xdb1d('0x7')][_0x392a7d[_0xdb1d('0x44')]]){this[_0xdb1d('0x7')][_0x392a7d[_0xdb1d('0x44')]][_0xdb1d('0x3c')]=!![];this[_0xdb1d('0x7')][_0x392a7d[_0xdb1d('0x45')]]=this[_0xdb1d('0x7')][_0x392a7d[_0xdb1d('0x44')]];this[_0xdb1d('0x46')](_0x392a7d['secondtransfereruniqueid']);}}else if(!_[_0xdb1d('0x43')](this[_0xdb1d('0x7')][_0x392a7d[_0xdb1d('0x45')]])){this[_0xdb1d('0x41')](_0x392a7d['transfertargetuniqueid']);if(this[_0xdb1d('0x7')][_0x392a7d[_0xdb1d('0x47')]]){this[_0xdb1d('0x7')][_0x392a7d[_0xdb1d('0x47')]][_0xdb1d('0x3c')]=!![];this[_0xdb1d('0x7')][_0x392a7d[_0xdb1d('0x48')]]=this['channels'][_0x392a7d['origtransfereruniqueid']];this['deleteChannelAfterTimeout'](_0x392a7d[_0xdb1d('0x47')]);}}}catch(_0x1b0cb0){logger[_0xdb1d('0x1f')](_0xdb1d('0x49'),_0x1b0cb0[_0xdb1d('0x32')]);}};Acw[_0xdb1d('0x16')][_0xdb1d('0x10')]=function(_0x59d3a3){try{if(this[_0xdb1d('0x7')][_0x59d3a3[_0xdb1d('0x4a')]]){logger['info'](_0xdb1d('0x4b'),JSON['stringify'](_0x59d3a3['transfereruniqueid']));this[_0xdb1d('0x41')](_0x59d3a3[_0xdb1d('0x4a')]);}else if(this[_0xdb1d('0x7')][_0x59d3a3[_0xdb1d('0x4c')]]){logger[_0xdb1d('0x1c')](_0xdb1d('0x4d'),JSON[_0xdb1d('0x4e')](_0x59d3a3[_0xdb1d('0x4c')]));this['startAcw'](_0x59d3a3[_0xdb1d('0x4c')]);}}catch(_0x3c2e01){logger[_0xdb1d('0x1f')](_0xdb1d('0x4f'),_0x3c2e01['message']);}};Acw['prototype'][_0xdb1d('0x50')]=function(_0x226820){try{if(this[_0xdb1d('0x4')][_0x226820[_0xdb1d('0x21')]]&&this[_0xdb1d('0x4')][_0x226820[_0xdb1d('0x21')]][_0xdb1d('0x51')]==='all'){if(this[_0xdb1d('0x5')][_0x226820[_0xdb1d('0x37')]]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x226820[_0xdb1d('0x30')],_0x226820[_0xdb1d('0x37')],_0x226820[_0xdb1d('0x21')]);return RpcUser['savePause'](this['agents'][_0x226820['interface']],_0xdb1d('0x52'),_0x226820[_0xdb1d('0x30')]);}}}catch(_0x19f0ea){logger[_0xdb1d('0x1f')](_0xdb1d('0x53'),_0x19f0ea[_0xdb1d('0x32')]);}};Acw[_0xdb1d('0x16')][_0xdb1d('0x46')]=function(_0x47cdd2,_0xa813b=0x2710){if(this[_0xdb1d('0x7')][_0x47cdd2]){setTimeout(()=>{delete this['channels'][_0x47cdd2];},_0xa813b);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 953a9f3..1b65a60 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 _0x485c=['port','username','keepConnected','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionSipPeerStatus','actionCoreShowChannels','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','asterisk'];(function(_0x2822b3,_0x49842b){var _0x4b9178=function(_0x265ccd){while(--_0x265ccd){_0x2822b3['push'](_0x2822b3['shift']());}};_0x4b9178(++_0x49842b);}(_0x485c,0x68));var _0xc485=function(_0xd5da2b,_0xe0e5f8){_0xd5da2b=_0xd5da2b-0x0;var _0x18b8f5=_0x485c[_0xd5da2b];return _0x18b8f5;};'use strict';var Manager=require(_0xc485('0x0'));var BPromise=require(_0xc485('0x1'));var util=require(_0xc485('0x2'));var logger=require(_0xc485('0x3'))(_0xc485('0x4'));var config=require(_0xc485('0x5'));var ami=new Manager(config[_0xc485('0x6')][_0xc485('0x7')],config['asterisk']['ip'],config[_0xc485('0x6')][_0xc485('0x8')],config[_0xc485('0x6')]['password'],!![]);ami[_0xc485('0x9')]();ami[_0xc485('0xa')]=BPromise[_0xc485('0xb')](ami[_0xc485('0xc')]);function error(_0x482a05){logger['error'](util[_0xc485('0xd')](_0xc485('0xe'),config[_0xc485('0x6')][_0xc485('0x8')],config['asterisk']['ip'],config['asterisk'][_0xc485('0x7')],util[_0xc485('0xf')](_0x482a05,![],null)));}function close(){logger[_0xc485('0x10')](util[_0xc485('0xd')](_0xc485('0x11'),config[_0xc485('0x6')]['username'],config['asterisk']['ip'],config[_0xc485('0x6')][_0xc485('0x7')]));}ami[_0xc485('0x12')]=function(){return function(){return ami[_0xc485('0xa')]({'action':_0xc485('0x13')});};};ami[_0xc485('0x14')]=function(){return function(){return ami[_0xc485('0xa')]({'action':_0xc485('0x15')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xc485('0xa')]({'action':_0xc485('0x16')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xc485('0xa')]({'action':_0xc485('0x17')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xc485('0xa')]({'action':_0xc485('0x18')});};};function connect(){logger[_0xc485('0x19')](util[_0xc485('0xd')](_0xc485('0x1a'),config[_0xc485('0x6')][_0xc485('0x8')],config[_0xc485('0x6')]['ip'],config[_0xc485('0x6')]['port']));ami[_0xc485('0x1b')](_0xc485('0x10'),error);ami[_0xc485('0x1b')](_0xc485('0x1c'),close);}ami['on'](_0xc485('0x1d'),connect);ami['on']('shutdown',function(_0x37f527){logger['info'](util[_0xc485('0xd')](_0xc485('0x1e'),config['asterisk'][_0xc485('0x8')],config[_0xc485('0x6')]['ip'],config['asterisk'][_0xc485('0x7')],util[_0xc485('0xf')](_0x37f527,![],null)));});ami['on']('fullybooted',function(){logger[_0xc485('0x19')](util['format'](_0xc485('0x1f'),config[_0xc485('0x6')]['username'],config[_0xc485('0x6')]['ip'],config[_0xc485('0x6')][_0xc485('0x7')]));return Promise['resolve']()[_0xc485('0x20')](ami['actionSipShowRegistry']())['then'](ami['actionDeviceStateList']())[_0xc485('0x20')](ami[_0xc485('0x21')]())[_0xc485('0x20')](ami['actionQueueSummary']())[_0xc485('0x20')](ami[_0xc485('0x22')]())['catch'](function(_0x10e6f0){logger[_0xc485('0x10')](_0xc485('0x23'),util[_0xc485('0xf')](_0x10e6f0,{'showHidden':![],'depth':null}));});});ami['once'](_0xc485('0x10'),error);ami['once'](_0xc485('0x1c'),close);module[_0xc485('0x24')]=ami; \ No newline at end of file +var _0x346b=['exports','asterisk-manager','bluebird','ami','asterisk','port','password','keepConnected','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','username','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','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','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch'];(function(_0x3ee8db,_0x2d91af){var _0x3fa1a3=function(_0x28fef3){while(--_0x28fef3){_0x3ee8db['push'](_0x3ee8db['shift']());}};_0x3fa1a3(++_0x2d91af);}(_0x346b,0x157));var _0xb346=function(_0x14ec70,_0x24f0ff){_0x14ec70=_0x14ec70-0x0;var _0x5c1b44=_0x346b[_0x14ec70];return _0x5c1b44;};'use strict';var Manager=require(_0xb346('0x0'));var BPromise=require(_0xb346('0x1'));var util=require('util');var logger=require('../../config/logger')(_0xb346('0x2'));var config=require('../../config/environment');var ami=new Manager(config[_0xb346('0x3')][_0xb346('0x4')],config['asterisk']['ip'],config[_0xb346('0x3')]['username'],config['asterisk'][_0xb346('0x5')],!![]);ami[_0xb346('0x6')]();ami['Action']=BPromise[_0xb346('0x7')](ami[_0xb346('0x8')]);function error(_0x459be9){logger[_0xb346('0x9')](util['format'](_0xb346('0xa'),config[_0xb346('0x3')]['username'],config[_0xb346('0x3')]['ip'],config[_0xb346('0x3')]['port'],util[_0xb346('0xb')](_0x459be9,![],null)));}function close(){logger[_0xb346('0x9')](util[_0xb346('0xc')](_0xb346('0xd'),config['asterisk'][_0xb346('0xe')],config['asterisk']['ip'],config[_0xb346('0x3')]['port']));}ami[_0xb346('0xf')]=function(){return function(){return ami[_0xb346('0x10')]({'action':_0xb346('0x11')});};};ami[_0xb346('0x12')]=function(){return function(){return ami['Action']({'action':_0xb346('0x13')});};};ami[_0xb346('0x14')]=function(){return function(){return ami['Action']({'action':_0xb346('0x15')});};};ami[_0xb346('0x16')]=function(){return function(){return ami[_0xb346('0x10')]({'action':_0xb346('0x17')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xb346('0x10')]({'action':_0xb346('0x18')});};};function connect(){logger[_0xb346('0x19')](util[_0xb346('0xc')](_0xb346('0x1a'),config[_0xb346('0x3')][_0xb346('0xe')],config[_0xb346('0x3')]['ip'],config[_0xb346('0x3')][_0xb346('0x4')]));ami['once'](_0xb346('0x9'),error);ami[_0xb346('0x1b')](_0xb346('0x1c'),close);}ami['on'](_0xb346('0x1d'),connect);ami['on'](_0xb346('0x1e'),function(_0x116391){logger[_0xb346('0x19')](util['format'](_0xb346('0x1f'),config[_0xb346('0x3')][_0xb346('0xe')],config['asterisk']['ip'],config[_0xb346('0x3')][_0xb346('0x4')],util[_0xb346('0xb')](_0x116391,![],null)));});ami['on'](_0xb346('0x20'),function(){logger['info'](util[_0xb346('0xc')](_0xb346('0x21'),config[_0xb346('0x3')][_0xb346('0xe')],config[_0xb346('0x3')]['ip'],config['asterisk']['port']));return Promise[_0xb346('0x22')]()[_0xb346('0x23')](ami[_0xb346('0xf')]())['then'](ami[_0xb346('0x12')]())['then'](ami[_0xb346('0x14')]())['then'](ami[_0xb346('0x16')]())[_0xb346('0x23')](ami['actionCoreShowChannels']())[_0xb346('0x24')](function(_0x4c81df){logger[_0xb346('0x9')]('[ami.js][fullybooted]',util[_0xb346('0xb')](_0x4c81df,{'showHidden':![],'depth':null}));});});ami['once'](_0xb346('0x9'),error);ami[_0xb346('0x1b')](_0xb346('0x1c'),close);module[_0xb346('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 3e7b68d..7d32509 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 _0xd8b0=['message','result','catch','exports','jayson/promise','bluebird','http','Request','then','debug','memberReport','error','rpc'];(function(_0x2b7758,_0x1dada2){var _0x1f1caf=function(_0x458542){while(--_0x458542){_0x2b7758['push'](_0x2b7758['shift']());}};_0x1f1caf(++_0x1dada2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('ami');var client=jayson['client'][_0x0d8b('0x2')]({'port':0x2329});client[_0x0d8b('0x3')]=function(_0x43bca1,_0x364286){return new BPromise(function(_0x8196ed,_0x577834){return client['request'](_0x43bca1,_0x364286)[_0x0d8b('0x4')](function(_0x227c63){logger[_0x0d8b('0x5')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x364286,_0x227c63);if(_0x227c63[_0x0d8b('0x7')]){logger['error'](_0x0d8b('0x8'),_0x0d8b('0x6'),_0x43bca1,_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')],_0x364286);return _0x577834(_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')]);}else{return _0x8196ed(_0x227c63[_0x0d8b('0xa')]);}})[_0x0d8b('0xb')](function(_0x48fa16){logger[_0x0d8b('0x7')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x48fa16,_0x364286);return _0x577834(_0x48fa16);});});};module[_0x0d8b('0xc')]=client; \ No newline at end of file +var _0xb43b=['catch','exports','jayson/promise','bluebird','ami','client','http','rpc','memberReport','error','message','result'];(function(_0x251669,_0x4cfefe){var _0x476916=function(_0x3f4e9b){while(--_0x3f4e9b){_0x251669['push'](_0x251669['shift']());}};_0x476916(++_0x4cfefe);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1a022a,_0x5a16a0){_0x1a022a=_0x1a022a-0x0;var _0x403f91=_0xb43b[_0x1a022a];return _0x403f91;};'use strict';var jayson=require(_0xbb43('0x0'));var BPromise=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var client=jayson[_0xbb43('0x3')][_0xbb43('0x4')]({'port':0x2329});client['Request']=function(_0x131e9e,_0x41aff6){return new BPromise(function(_0x351254,_0x16432a){return client['request'](_0x131e9e,_0x41aff6)['then'](function(_0x378df5){logger['debug'](_0xbb43('0x5'),_0xbb43('0x6'),_0x131e9e,_0x41aff6,_0x378df5);if(_0x378df5[_0xbb43('0x7')]){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x378df5[_0xbb43('0x7')][_0xbb43('0x8')],_0x41aff6);return _0x16432a(_0x378df5['error'][_0xbb43('0x8')]);}else{return _0x351254(_0x378df5[_0xbb43('0x9')]);}})[_0xbb43('0xa')](function(_0x5e3611){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x5e3611,_0x41aff6);return _0x16432a(_0x5e3611);});});};module[_0xbb43('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 0a67983..e12b99d 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 _0xdf11=['swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','dropreason','CALLEREXIT','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','dialAbandonedMaxRetry','countabandonedretry','ContactId','ListId','[rescheduleContact][Abandoned]','calleridnum','syncNewExten','channel','syncQueueMember','actionid','strategy','rrmemory','paused','locked','stateinterface','pick','idHopper','roundrobin','[Catch][Preview][syncQueueStatusComplete]','updateOriginated','[unlock][syncQueueStatusComplete]','_rr','length','isNil','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','buildObj','amd','saveInDb','[syncHangupInAMD]','dialAMDActive','value','Machine','AMD','countmachineretry','custom:amd','[syncAgentComplete][createHistory][0]','countnoanswerretry','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countbusyretry','countcongestionretry','createStateFinal','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','cause-txt','Normal\x20Clearing','[syncAgentComplete]','outboundUnknownCallsDay','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','pTalking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','throttle','dialPreviewRecallmeReminder','filter','handlePreviewRecallNotifications','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','sequence','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','Agent','object','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialQueueOptions','dialer','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','assign','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','dialCutDigit','phone','substring','SIP/%s/%s%s','trim','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countagentrejectretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','Success','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','round','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','loggedIn','predictiveIntervalPauses','outboundQueuePauses','agentBusyFactor','[CatchErlangB]','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','dialRecallMeTimeout','voicePause','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','temp','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact','checkIsBlackListIvr','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','ACTIVE','[actionOriginate]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\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','lodash','moment','ioredis','./utils','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/voiceQueueRt','../rpc/setting','./models/action','./models/agentComplete','./models/hangup','env','XCALLY_IP_AGI','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncHangup','newexten','varset','syncVarSet','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','emit','type','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','debug','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','format','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','stringify','active','reachable','SIP/%s','status','checkIsTrunkReachable','isTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTimeIntervals','ifTimeIvr','Intervals','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','push','Action','command','iftime\x20%s,%s','interval','indexOf','true','catch','content','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','ifTime','resetActiveCalls','undefined','isIVRCampaign','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','handlePower','power','dialPowerLevel','method\x20not\x20recognized','silly','intervalIftime','Global:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','[ifTime][Action]','Error','uniqueId','uniqueid','ivr','queue','answertime','outboundAnswerCallsDay','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','getSeconds','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','voiceQueue','queueCallerAbandonCreateState','additional','rescheduleContact','add','minutes','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','endtime','calleridname'];(function(_0x43a538,_0x319c77){var _0x4a0eea=function(_0x50775c){while(--_0x50775c){_0x43a538['push'](_0x43a538['shift']());}};_0x4a0eea(++_0x319c77);}(_0xdf11,0x142));var _0x1df1=function(_0x105ef8,_0x4155e7){_0x105ef8=_0x105ef8-0x0;var _0x1c5bae=_0xdf11[_0x105ef8];return _0x1c5bae;};'use strict';var util=require('util');var _=require(_0x1df1('0x0'));var uuid=require('uuid');var moment=require(_0x1df1('0x1'));var rr=require('rr');var Redis=require(_0x1df1('0x2'));var utils=require(_0x1df1('0x3'));var hopperUtils=require('./utils/hopper');var ut=require(_0x1df1('0x4'));var config=require(_0x1df1('0x5'));var logger=require('../../../config/logger')('dialer');var loggerBooked=require(_0x1df1('0x6'))(_0x1df1('0x7'));var loggerPredictive=require(_0x1df1('0x6'))(_0x1df1('0x8'));var loggerPredictiveCalls=require(_0x1df1('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x1df1('0x6'))(_0x1df1('0x9'));var ami=require(_0x1df1('0xa'));config[_0x1df1('0xb')]=_[_0x1df1('0xc')](config[_0x1df1('0xb')],{'host':_0x1df1('0xd'),'port':0x18eb});var io=require(_0x1df1('0xe'))(new Redis(config[_0x1df1('0xb')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x1df1('0xf'));var RpcSetting=require(_0x1df1('0x10'));var Interval=require('../rpc/interval');var Action=require(_0x1df1('0x11'));var History=require('./models/history');var Final=require('./models/final');var AgentComplete=require(_0x1df1('0x12'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x1df1('0x13'));var ipAgi=process[_0x1df1('0x14')][_0x1df1('0x15')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x1df1('0x16')][_0x1df1('0x17')]=function(_0x59f0b7){this['tail']=this['tail']?this[_0x1df1('0x18')][_0x1df1('0x19')](_0x59f0b7):_0x59f0b7();};function Dialer(_0x26e2fd,_0x321898){this['sequence']=new Sequence();this[_0x1df1('0x1a')]=_0x321898;this[_0x1df1('0x1b')]=_0x26e2fd[_0x1df1('0x1b')];this[_0x1df1('0x1c')]=_0x26e2fd[_0x1df1('0x1c')];this[_0x1df1('0x1d')]=_0x26e2fd[_0x1df1('0x1d')];this[_0x1df1('0x1e')]=_0x26e2fd[_0x1df1('0x1e')];this['maxNumberOriginate']=config[_0x1df1('0x1f')]||0x2;this['channels']={};this[_0x1df1('0x20')]={};this['contactsId']={};this['uniqueId']={};this['optionPredictive']={};this[_0x1df1('0x21')]={};this[_0x1df1('0x22')]={};this[_0x1df1('0x23')]={};this[_0x1df1('0x24')]={};this[_0x1df1('0x25')]={};this[_0x1df1('0x26')]={};ami['on'](_0x1df1('0x27'),this[_0x1df1('0x28')]['bind'](this));ami['on'](_0x1df1('0x29'),this[_0x1df1('0x2a')][_0x1df1('0x2b')](this));ami['on'](_0x1df1('0x2c'),this['syncOriginateResponse']['bind'](this));ami['on'](_0x1df1('0x2d'),this[_0x1df1('0x2e')][_0x1df1('0x2b')](this));ami['on'](_0x1df1('0x2f'),this[_0x1df1('0x9')][_0x1df1('0x2b')](this));ami['on'](_0x1df1('0x30'),this['syncQueueSummaryComplete']['bind'](this));ami['on']('hangup',this[_0x1df1('0x31')][_0x1df1('0x2b')](this));ami['on'](_0x1df1('0x32'),this['syncNewExten'][_0x1df1('0x2b')](this));ami['on'](_0x1df1('0x33'),this[_0x1df1('0x34')][_0x1df1('0x2b')](this));ami['on']('queuemember',this['syncQueueMember'][_0x1df1('0x2b')](this));ami['on']('queuestatuscomplete',this[_0x1df1('0x35')][_0x1df1('0x2b')](this));this[_0x1df1('0x36')]();this[_0x1df1('0x37')]();RpcSetting[_0x1df1('0x38')]()[_0x1df1('0x39')](function(_0xe389f0){previewRecallmeReminderInterval=_0xe389f0[_0x1df1('0x3a')];});}function isNotNull(_0x40cfb3){return _0x40cfb3!==null&&!_['isUndefined'](_0x40cfb3);}function msgResponse(_0x402905,_0x5b3278,_0x51da58){return{'action':_0x402905,'response':_0x5b3278,'message':_0x51da58,'stack':_0x51da58};}function emit(_0x25186c,_0x5d1bbb,_0x2712ed){io['to'](_0x25186c)[_0x1df1('0x3b')](_0x5d1bbb,_0x2712ed);}function emitOutboundVoiceQueueSummary(_0xaa78e0){if(_0xaa78e0[_0x1df1('0x3c')]===_0x1df1('0x3d')){logger['debug'](_0x1df1('0x3e'),util[_0x1df1('0x3f')](_0xaa78e0,{'showHidden':![],'depth':null}));emit(util['format']('voice:queue:%s',_0xaa78e0[_0x1df1('0x40')]),_0x1df1('0x41'),_0xaa78e0);}}function checkGetDataPredictive(_0x1a98b1){if(isNotNull(_0x1a98b1)&&!_[_0x1df1('0x42')](_0x1a98b1)){loggerPredictive[_0x1df1('0x43')](_0x1df1('0x44'));loggerPredictive['info'](_0x1df1('0x45'),_0x1a98b1[_0x1df1('0x46')]);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1a98b1['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x1df1('0x43')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1a98b1[_0x1df1('0x47')]);loggerPredictive[_0x1df1('0x43')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1a98b1[_0x1df1('0x48')]);loggerPredictive[_0x1df1('0x43')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1a98b1[_0x1df1('0x49')]);loggerPredictive[_0x1df1('0x43')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1a98b1[_0x1df1('0x4a')]);loggerPredictive[_0x1df1('0x43')](_0x1df1('0x4b'));if(_0x1a98b1['predictiveIntervalTotalCalls']>0x0){if(!_[_0x1df1('0x4c')](_0x1a98b1[_0x1df1('0x4a')])&&_0x1a98b1['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x1df1('0x43')](_0x1df1('0x4d'));if(!_['isUndefined'](_0x1a98b1['predictiveIntervalAvgHoldtime'])&&_0x1a98b1[_0x1df1('0x49')]>0x0){return!![];}loggerPredictive[_0x1df1('0x43')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x1df1('0x43')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x166a6f){return function(_0x10c1cb){loggerPredictive[_0x1df1('0x43')](_0x1df1('0x4e'));loggerPredictive[_0x1df1('0x43')](_0x1df1('0x4f'),_0x10c1cb[_0x1df1('0x50')]);loggerPredictive[_0x1df1('0x43')](_0x1df1('0x51'),_0x10c1cb[_0x1df1('0x52')]);loggerPredictive[_0x1df1('0x43')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x10c1cb[_0x1df1('0x53')]);loggerPredictive[_0x1df1('0x43')](_0x1df1('0x54'),_0x10c1cb['erlangBusyFactor']);loggerPredictive[_0x1df1('0x43')](_0x1df1('0x55'),_0x10c1cb[_0x1df1('0x53')]);loggerPredictive[_0x1df1('0x43')](_0x1df1('0x4b'));_[_0x1df1('0x56')](_0x166a6f,_0x10c1cb);};}function ifInterval(_0xbf14db,_0x137a84){if(_[_0x1df1('0x4c')](_0x137a84)){return![];}return utils['getSeconds'](undefined,_0x137a84)<_0xbf14db*0x3c;}function clearPredictiveAttributes(_0x29d67d){if(_0x29d67d[_0x1df1('0x22')]){_0x29d67d[_0x1df1('0x22')]=undefined;loggerPredictive[_0x1df1('0x57')](_0x29d67d[_0x1df1('0x40')],_0x1df1('0x58'));}if(_0x29d67d[_0x1df1('0x21')]){_0x29d67d[_0x1df1('0x21')]=undefined;loggerPredictive[_0x1df1('0x57')](_0x29d67d['name'],_0x1df1('0x59'));}if(_0x29d67d[_0x1df1('0x5a')]){clearInterval(_0x29d67d[_0x1df1('0x5a')]);_0x29d67d[_0x1df1('0x5a')]=undefined;loggerPredictive[_0x1df1('0x57')](_0x29d67d[_0x1df1('0x40')],_0x1df1('0x5b'));}}function loggerCatchPredictive(_0x54ee98,_0x3c533b){return function(_0x4c65bd){loggerPredictive[_0x1df1('0x5c')](_0x3c533b[_0x1df1('0x40')],_0x54ee98);loggerPredictive[_0x1df1('0x5c')](_0x4c65bd[_0x1df1('0x5d')]);clearPredictiveAttributes(_0x3c533b);};}function loggerCatch(_0x28baec){return function(_0x5cc1c7){logger[_0x1df1('0x5c')](_0x28baec,util[_0x1df1('0x3f')](_0x5cc1c7,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0xef8f6c,_0x37c8a6,_0x2237a4){return function(_0x4b7326){utils[_0x1df1('0x5e')](_0x37c8a6,_0x2237a4,0x0);_0x37c8a6['temp']=0x0;logger[_0x1df1('0x5c')](_0xef8f6c,util[_0x1df1('0x3f')](_0x4b7326,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x6c2065){return function(_0x46ae12){if(isNotNull(_0x46ae12)&&isNotNull(_0x46ae12[0x0])){if(_0x46ae12[0x0][_0x1df1('0x5f')]>0x0){_0x6c2065[_0x1df1('0x60')]=utils[_0x1df1('0x61')][_0x1df1('0x62')];logger[_0x1df1('0x43')]('[getContactDialer2][ReScheduled]'+_0x6c2065[_0x1df1('0x40')],_0x46ae12[0x0][_0x1df1('0x5f')],_0x1df1('0x63'));}else{_0x6c2065[_0x1df1('0x60')]=utils[_0x1df1('0x61')][_0x1df1('0x64')];logger[_0x1df1('0x43')](_0x1df1('0x65')+_0x6c2065[_0x1df1('0x40')]);}}};}function createObjHistory(_0x135e63,_0x1be648,_0xe175aa,_0x4fa781,_0x340815){_0x135e63[_0x1df1('0x60')]=_0xe175aa;var _0x56195d=new Action(_0x135e63,_0x1be648);var _0x2b2b4f=new History(_0x56195d);_0x2b2b4f[_0x1df1('0x66')]=_0x4fa781;_0x2b2b4f[_0x1df1('0x67')]=_0x340815;_0x2b2b4f['endtime']=_0x56195d[_0x1df1('0x68')];return _0x2b2b4f;}function unlockQueueStatus(_0x5c2977,_0x121f6e){setTimeout(function(){if(_['isUndefined'](_0x5c2977[_0x1df1('0x69')])){loggerBooked[_0x1df1('0x5c')](_0x1df1('0x6a'),_0x121f6e);}_0x5c2977[_0x1df1('0x69')]=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x121f6e,JSON['stringify'](_['pick'](_0x5c2977,[_0x1df1('0x40'),_0x1df1('0x69')])));},0x1f3);}function checkInterval(_0x3a0ab2){return function(){if(!isNotNull(_0x3a0ab2[_0x1df1('0x6b')])){_0x3a0ab2['message']=utils['CAMPAIGN_STATUS'][_0x1df1('0x6c')];throw _0x3a0ab2[_0x1df1('0x40')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x3a0ab2[_0x1df1('0x6b')]['Intervals'])){_0x3a0ab2[_0x1df1('0x60')]=utils['CAMPAIGN_STATUS'][_0x1df1('0x6c')];throw _0x3a0ab2[_0x1df1('0x40')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x3a0ab2[_0x1df1('0x6b')]['Intervals']))){_0x3a0ab2[_0x1df1('0x60')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x3a0ab2['name']+_0x1df1('0x6d');}};}function checkIsIVRCampaignActive(_0x12807d){return function(){if(!utils[_0x1df1('0x6e')](_0x12807d)){_0x12807d['message']=utils['CAMPAIGN_STATUS'][_0x1df1('0x6f')];throw _0x12807d[_0x1df1('0x40')]+_0x1df1('0x70');}};}function emitCampaignSummary(_0x2a29ea){if(utils['isIVRCampaign'](_0x2a29ea)){emit(util[_0x1df1('0x71')](_0x1df1('0x72'),_0x2a29ea['name']),_0x1df1('0x73'),_0x2a29ea);}}function loggerCatchQueueSummary(_0xccb582,_0x21eb4b){return function(_0x4c4597){clearPredictiveAttributes(_0x21eb4b);emitCampaignSummary(_0x21eb4b);loggerSyncQueueSummary['debug'](_0xccb582,util['inspect'](_0x4c4597,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x3aeff7){if(_0x3aeff7[_0x1df1('0x74')]){if(_0x3aeff7[_0x1df1('0x75')]===0x0){_0x3aeff7[_0x1df1('0x74')]=![];_0x3aeff7[_0x1df1('0x60')]=utils['CAMPAIGN_STATUS'][_0x1df1('0x6f')];loggerSyncQueueSummary[_0x1df1('0x57')](_0x1df1('0x76'),_0x3aeff7[_0x1df1('0x40')],_0x1df1('0x77'));}else{_0x3aeff7[_0x1df1('0x60')]=utils[_0x1df1('0x61')][_0x1df1('0x78')];loggerSyncQueueSummary[_0x1df1('0x57')](_0x1df1('0x76'),_0x3aeff7[_0x1df1('0x40')],_0x1df1('0x79'));}emitCampaignSummary(_0x3aeff7);}}function myreject(_0x45fe4a){return function(_0x34f271){return _0x45fe4a(msgResponse('[ifTime][Action]','Error',JSON[_0x1df1('0x7a')](_0x34f271)));};}Dialer['prototype']['isTrunkReachable']=function(_0x461aa1){return!_[_0x1df1('0x4c')](_0x461aa1)&&_0x461aa1&&!_[_0x1df1('0x4c')](_0x461aa1[_0x1df1('0x40')])&&!_[_0x1df1('0x4c')](_0x461aa1[_0x1df1('0x7b')])&&_0x461aa1['active']&&(this[_0x1df1('0x1e')][util[_0x1df1('0x71')]('SIP/%s',_0x461aa1[_0x1df1('0x40')])]['status']===_0x1df1('0x7c')||this[_0x1df1('0x1e')][util['format'](_0x1df1('0x7d'),_0x461aa1[_0x1df1('0x40')])][_0x1df1('0x7e')]==='unmonitored');};Dialer[_0x1df1('0x16')][_0x1df1('0x7f')]=function(_0x10ff61){var _0x487e8e=this;return function(){if(!_0x487e8e[_0x1df1('0x80')](_0x10ff61[_0x1df1('0x81')])){if(!_0x487e8e['isTrunkReachable'](_0x10ff61[_0x1df1('0x82')])){_0x10ff61[_0x1df1('0x60')]=utils[_0x1df1('0x61')][_0x1df1('0x83')];throw _0x10ff61[_0x1df1('0x40')]+_0x1df1('0x84');}}};};Dialer[_0x1df1('0x16')]['checkIfTime']=function(_0x56954b,_0x14c8ec,_0xdfeaf,_0xd97f86){var _0x400453=this;return function(){var _0xa095b6=!![];return _0x400453['ifTimeIvr'](_0x56954b,_0x14c8ec,_0xdfeaf,_0xd97f86,_0xa095b6);};};Dialer['prototype'][_0x1df1('0x85')]=function(_0x58c1ff,_0x363a96,_0x12da91,_0xaeee88){var _0x53d1a5=this;return function(){var _0x37c32e=![];return _0x53d1a5[_0x1df1('0x86')](_0x58c1ff[_0x1df1('0x87')],_0x363a96,_0x12da91,_0xaeee88,_0x37c32e);};};Dialer['prototype'][_0x1df1('0x86')]=function(_0x461717,_0x2df406,_0x323b9d,_0xf7ca7c,_0x2e0147){var _0xe19ae3=[];return new Promise(function(_0x23d3e7,_0x4b1208){if(!isNotNull(_0x461717)){_0xf7ca7c['message']=utils[_0x1df1('0x61')]['NULL_INTERVAL'];return _0x4b1208(msgResponse('ifTime',_0x1df1('0x88'),_0x323b9d+_0x1df1('0x89')));}if(_[_0x1df1('0x42')](_0x461717)){_0xf7ca7c[_0x1df1('0x60')]=utils[_0x1df1('0x61')][_0x1df1('0x8a')];return _0x4b1208(msgResponse('ifTime',_0x1df1('0x88'),_0x323b9d+_0x1df1('0x8b')));}if(_0x2df406&&_[_0x1df1('0x4c')](config[_0x1df1('0x8c')][_0x2df406])){_0xf7ca7c[_0x1df1('0x60')]=utils[_0x1df1('0x61')][_0x1df1('0x8d')];return _0x4b1208(msgResponse('ifTime','Failure',_0x323b9d+_0x1df1('0x8e')+_0x2df406));}if(_[_0x1df1('0x8f')](_0x461717)){for(var _0x5d28ca=0x0;_0x5d28ca<_0x461717['length'];_0x5d28ca+=0x1){_0xe19ae3[_0x1df1('0x90')](ami[_0x1df1('0x91')]({'action':_0x1df1('0x92'),'command':util[_0x1df1('0x71')](_0x1df1('0x93'),_0x461717[_0x5d28ca][_0x1df1('0x94')],!_[_0x1df1('0x4c')](config[_0x1df1('0x8c')][_0x2df406])?_0x2df406:'')})[_0x1df1('0x39')](function(_0x38550a){return _0x38550a['content'][_0x1df1('0x95')](_0x1df1('0x96'))>=0x0;})[_0x1df1('0x97')](myreject(_0x4b1208)));}}else{_0xe19ae3['push'](ami[_0x1df1('0x91')]({'action':_0x1df1('0x92'),'command':util[_0x1df1('0x71')]('iftime\x20%s,%s',_0x461717,!_['isUndefined'](config['timezones'][_0x2df406])?_0x2df406:'')})[_0x1df1('0x39')](function(_0x35bc78){return _0x35bc78[_0x1df1('0x98')][_0x1df1('0x95')]('true')>=0x0;})['catch'](myreject(_0x4b1208)));}Promise['all'](_0xe19ae3)[_0x1df1('0x39')](function(_0x3b230b){var _0x12918c=_[_0x1df1('0x99')](_0x3b230b);if(_0x12918c){return _0x23d3e7(_0x12918c);}else{_0xf7ca7c['message']=_0x2e0147?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils[_0x1df1('0x61')][_0x1df1('0x9a')];return _0x4b1208(msgResponse(_0x1df1('0x9b'),_0x1df1('0x88'),'Global:\x20'+_0x2e0147+'\x20'+_0x323b9d+_0x1df1('0x9c')+util['inspect'](_0x461717,{'showHidden':![],'depth':null})+_0x1df1('0x9d')+_0x2df406));}})['catch'](function(_0x29ac25){return _0x4b1208(msgResponse(_0x1df1('0x9e'),_0x1df1('0x88'),JSON[_0x1df1('0x7a')](_0x29ac25)));});});};Dialer[_0x1df1('0x16')]['loopCampaigns']=function(){var _0x41867d=this;return cmHopper[_0x1df1('0x9f')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x41867d['syncCampaigns']();},0x3e8);});};Dialer[_0x1df1('0x16')]['syncCampaigns']=function(){var _0x137815=this;var _0x50f37c;for(var _0xe9e1b1 in this[_0x1df1('0x1c')]){if(typeof this[_0x1df1('0x1c')][_0xe9e1b1]!==_0x1df1('0xa0')){_0x50f37c=this['campaigns'][_0xe9e1b1];if(utils[_0x1df1('0xa1')](_0x50f37c)&&utils[_0x1df1('0x6e')](_0x50f37c)){_0x50f37c[_0x1df1('0x74')]=!![];Promise[_0x1df1('0xa2')]()[_0x1df1('0x39')](checkIsIVRCampaignActive(_0x50f37c))['then'](checkInterval(_0x50f37c))[_0x1df1('0x39')](_0x137815[_0x1df1('0x7f')](_0x50f37c))[_0x1df1('0x39')](_0x137815['checkIfTime'](_0x50f37c[_0x1df1('0xa3')],_0x50f37c[_0x1df1('0xa4')],_0x50f37c[_0x1df1('0x40')],_0x50f37c))[_0x1df1('0x39')](_0x137815[_0x1df1('0x85')](_0x50f37c[_0x1df1('0x6b')],_0x50f37c[_0x1df1('0xa4')],_0x50f37c[_0x1df1('0x40')],_0x50f37c))[_0x1df1('0x39')](_0x137815[_0x1df1('0xa5')](_0x50f37c))[_0x1df1('0x97')](loggerCatchQueueSummary(_0x1df1('0xa6'),_0x50f37c));}else{notSendMessagesCampaign(_0x50f37c);}}}};Dialer[_0x1df1('0x16')][_0x1df1('0xa7')]=function(_0x39ab42){if(_0x39ab42[_0x1df1('0xa8')]!==_0x1df1('0x8')){clearPredictiveAttributes(_0x39ab42);}switch(_0x39ab42[_0x1df1('0xa8')]){case'progressive':this[_0x1df1('0xa9')](_0x39ab42,0x1);break;case _0x1df1('0xaa'):this[_0x1df1('0xa9')](_0x39ab42,_0x39ab42[_0x1df1('0xab')]);break;case _0x1df1('0x8'):this['predictive'](_0x39ab42);break;case _0x1df1('0x7'):this[_0x1df1('0xa9')](_0x39ab42,0x1);break;default:logger[_0x1df1('0x5c')]('Queue',_0x39ab42[_0x1df1('0x40')],_0x1df1('0xac'));}};Dialer[_0x1df1('0x16')][_0x1df1('0x9e')]=function(_0x29dabc,_0x274d3a){var _0x48703a=_0x29dabc['dialTimezone'];var _0x173bbb=_0x274d3a?_0x29dabc[_0x1df1('0xa3')]:_0x29dabc[_0x1df1('0x6b')][_0x1df1('0x87')];logger[_0x1df1('0xad')]('Dialer::ifTime()',_0x173bbb,_0x48703a,_0x29dabc[_0x1df1('0x40')],util[_0x1df1('0x71')]('Voice\x20Queue\x20%s\x20$s',_0x29dabc[_0x1df1('0x40')],_0x29dabc['id']));var _0x1ea1ea=null;return Interval[_0x1df1('0xae')](_0x173bbb,_0x48703a)[_0x1df1('0x39')](function(_0x132baa){if(_0x132baa===!![]){return _0x132baa;}else{_0x29dabc['message']=_0x274d3a?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0x1df1('0x9a')];_0x1ea1ea=msgResponse('[ifTime][promiseAll]',_0x1df1('0x88'),_0x1df1('0xaf')+_0x274d3a+'\x20'+_0x29dabc[_0x1df1('0x40')]+_0x1df1('0x9c')+util['inspect'](_0x173bbb,{'showHidden':![],'depth':null})+_0x1df1('0x9d')+_0x48703a);}if(_0x1ea1ea!==null){logger[_0x1df1('0xad')](_0x1df1('0xb0'),_0x1ea1ea);_0x1ea1ea['isGlobal']=_0x274d3a;throw _0x1ea1ea;}})[_0x1df1('0x97')](function(_0x40b8c4){logger['error'](_0x1df1('0xb1'),_0x40b8c4);throw msgResponse(_0x1df1('0xb2'),_0x1df1('0xb3'),util[_0x1df1('0x3f')](_0x40b8c4,{'showHidden':![],'depth':null}));});};Dialer[_0x1df1('0x16')]['syncAgentConnect']=function(_0x5ddbd0){if(this['voiceQueues'][_0x5ddbd0['queue']]){if(this[_0x1df1('0xb4')][_0x5ddbd0['uniqueid']]&&this[_0x1df1('0xb4')][_0x5ddbd0[_0x1df1('0xb5')]][_0x1df1('0x3c')]!==_0x1df1('0xb6')){this['updateOriginated'](this['voiceQueues'][_0x5ddbd0[_0x1df1('0xb7')]]);this[_0x1df1('0xb4')][_0x5ddbd0[_0x1df1('0xb5')]][_0x1df1('0xb8')]=moment()[_0x1df1('0x71')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x1df1('0x16')]['syncAgentComplete']=function(_0x213f2b){var _0x446e22=this[_0x1df1('0xb4')][_0x213f2b[_0x1df1('0xb5')]];if(this[_0x1df1('0x1b')][_0x213f2b[_0x1df1('0xb7')]]){if(_0x446e22&&_0x446e22[_0x1df1('0x3c')]!==_0x1df1('0xb6')){delete this['uniqueId'][_0x213f2b[_0x1df1('0xb5')]];this['voiceQueues'][_0x213f2b[_0x1df1('0xb7')]][_0x1df1('0xb9')]+=0x1;var _0x359836=new AgentComplete(_0x446e22,_0x213f2b);if(_0x213f2b[_0x1df1('0xba')]==='agent'){_0x359836[_0x1df1('0xbb')]=this[_0x1df1('0x1b')][_0x213f2b['queue']][_0x1df1('0xbc')]&&this['voiceQueues'][_0x213f2b[_0x1df1('0xb7')]][_0x1df1('0xbd')]?moment()['format'](_0x1df1('0xbe')):undefined;}hopperUtils[_0x1df1('0xbf')](_0x359836)[_0x1df1('0x97')](loggerCatch(_0x1df1('0xc0')));hopperUtils[_0x1df1('0xc1')](_0x359836)[_0x1df1('0x97')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x1df1('0x16')][_0x1df1('0x2a')]=function(_0x7454c6){var _0x410ea1=this[_0x1df1('0xb4')][_0x7454c6[_0x1df1('0xb5')]];var _0x2a3314=this;var _0x7079dd=![];var _0x1de067;var _0x4c82ab;if(this['voiceQueues'][_0x7454c6[_0x1df1('0xb7')]]){if(_0x410ea1&&_0x410ea1[_0x1df1('0x3c')]!=='ivr'){delete this[_0x1df1('0xb4')][_0x7454c6[_0x1df1('0xb5')]];this['updateOriginated'](this[_0x1df1('0x1b')][_0x7454c6['queue']]);_0x410ea1['droptime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x541c9f=new QueueCallerAbandon(_0x410ea1,_0x7454c6);if(utils[_0x1df1('0xc2')](_0x410ea1['droptime'],_0x410ea1[_0x1df1('0xc3')])>=_0x410ea1[_0x1df1('0xc4')]){this[_0x1df1('0x1b')][_0x7454c6[_0x1df1('0xb7')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x1df1('0x1b')][_0x7454c6['queue']][_0x1df1('0xc5')]+=0x1;this[_0x1df1('0x1b')][_0x7454c6[_0x1df1('0xb7')]][_0x1df1('0xc6')]+=0x1;_0x541c9f[_0x1df1('0x66')]=0xa;_0x541c9f[_0x1df1('0x67')]=_0x1df1('0xc7');_0x541c9f['dropreason']=_0x1df1('0xc8');_0x541c9f[_0x1df1('0xbb')]=this[_0x1df1('0x1b')][_0x7454c6['queue']][_0x1df1('0xbc')]?moment()[_0x1df1('0x71')](_0x1df1('0xbe')):undefined;_0x541c9f[_0x1df1('0xc9')]+=0x1;_0x541c9f[_0x1df1('0xca')]+=0x1;_0x1de067=this['voiceQueues'][_0x7454c6[_0x1df1('0xb7')]][_0x1df1('0xcb')];_0x4c82ab=this[_0x1df1('0x1b')][_0x7454c6[_0x1df1('0xb7')]]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x541c9f,_0x541c9f[_0x1df1('0x66')],_0x410ea1[_0x1df1('0xcc')])[_0x1df1('0x39')](function(_0x55123c){_0x7079dd=_0x55123c['additional']==0x1;if(_0x541c9f['countdropretry']>=_0x2a3314[_0x1df1('0x1b')][_0x7454c6[_0x1df1('0xb7')]]['dialDropMaxRetry']){_0x2a3314[_0x1df1('0xcd')](_0x541c9f,_0x55123c[_0x1df1('0xce')]);}else{hopperUtils[_0x1df1('0xcf')]({'active':![],'countdropretry':_0x541c9f[_0x1df1('0xc9')],'scheduledat':moment()[_0x1df1('0xd0')](_0x2a3314['voiceQueues'][_0x7454c6[_0x1df1('0xb7')]][_0x1df1('0xcb')],_0x1df1('0xd1'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x410ea1['ContactId'],'ListId':_0x410ea1['ListId'],'VoiceQueueId':_0x410ea1[_0x1df1('0xd2')]||undefined,'CampaignId':_0x410ea1[_0x1df1('0xd3')]||undefined})[_0x1df1('0x97')](loggerCatch(_0x1df1('0xd4')));var _0x1044f7=new History(_0x541c9f);_0x1044f7[_0x1df1('0x66')]=0xa;_0x1044f7[_0x1df1('0x67')]=_0x1df1('0xc7');_0x1044f7['starttime']=moment()['format'](_0x1df1('0xbe'));_0x1044f7[_0x1df1('0xd5')]=_0x1044f7[_0x1df1('0x68')];_0x1044f7[_0x1df1('0xd6')]=_0x541c9f[_0x1df1('0xd6')];_0x1044f7['calleridnum']=_0x541c9f['calleridnum'];hopperUtils[_0x1df1('0xbf')](_0x1044f7)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x1df1('0x39')](function(){if(_0x7079dd)hopperUtils[_0x1df1('0xd7')](_0x541c9f,_0x1de067,_0x4c82ab)[_0x1df1('0x39')](function(){return 0x1;});});}else{this['voiceQueues'][_0x7454c6[_0x1df1('0xb7')]][_0x1df1('0x48')]+=0x1;this['voiceQueues'][_0x7454c6['queue']][_0x1df1('0xd8')]+=0x1;_0x541c9f['state']=0xb;_0x541c9f[_0x1df1('0x67')]=_0x1df1('0xd9');_0x541c9f[_0x1df1('0xda')]=_0x1df1('0xdb');_0x541c9f['countabandonedretry']+=0x1;_0x541c9f[_0x1df1('0xca')]+=0x1;_0x1de067=this[_0x1df1('0x1b')][_0x7454c6['queue']][_0x1df1('0xdc')];_0x4c82ab=this[_0x1df1('0x1b')][_0x7454c6['queue']][_0x1df1('0xdd')];hopperUtils[_0x1df1('0xde')](_0x541c9f,_0x541c9f[_0x1df1('0x66')],_0x410ea1[_0x1df1('0xcc')])['then'](function(_0x19a8eb){if(_0x541c9f['countabandonedretry']>=_0x2a3314[_0x1df1('0x1b')][_0x7454c6['queue']][_0x1df1('0xdf')]){_0x2a3314[_0x1df1('0xcd')](_0x541c9f,_0x19a8eb[_0x1df1('0xce')]);}else{hopperUtils[_0x1df1('0xcf')]({'active':![],'countabandonedretry':_0x541c9f[_0x1df1('0xe0')],'scheduledat':moment()['add'](_0x2a3314[_0x1df1('0x1b')][_0x7454c6[_0x1df1('0xb7')]][_0x1df1('0xdc')],_0x1df1('0xd1'))[_0x1df1('0x71')](_0x1df1('0xbe')),'ContactId':_0x410ea1[_0x1df1('0xe1')],'ListId':_0x410ea1[_0x1df1('0xe2')],'VoiceQueueId':_0x410ea1[_0x1df1('0xd2')]||undefined,'CampaignId':_0x410ea1[_0x1df1('0xd3')]||undefined})['catch'](loggerCatch(_0x1df1('0xe3')));var _0x225e8d=new History(_0x541c9f);_0x225e8d[_0x1df1('0x66')]=0xb;_0x225e8d['statedesc']='Abandoned';_0x225e8d[_0x1df1('0x68')]=moment()['format'](_0x1df1('0xbe'));_0x225e8d['endtime']=_0x225e8d[_0x1df1('0x68')];_0x225e8d[_0x1df1('0xd6')]=_0x541c9f[_0x1df1('0xd6')];_0x225e8d[_0x1df1('0xe4')]=_0x541c9f['calleridnum'];hopperUtils[_0x1df1('0xbf')](_0x225e8d)[_0x1df1('0x97')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x1df1('0x39')](function(){if(_0x7079dd)hopperUtils[_0x1df1('0xd7')](_0x541c9f,_0x1de067,_0x4c82ab)[_0x1df1('0x39')](function(){return 0x1;});});}}}};Dialer[_0x1df1('0x16')][_0x1df1('0xe5')]=function(_0x54ed2e){if(this[_0x1df1('0x20')][_0x54ed2e[_0x1df1('0xb5')]]){this['actions'][_0x54ed2e['uniqueid']][_0x1df1('0xe6')]=_0x54ed2e[_0x1df1('0xe6')];}if(this[_0x1df1('0xb4')][_0x54ed2e[_0x1df1('0xb5')]]){this[_0x1df1('0xb4')][_0x54ed2e[_0x1df1('0xb5')]][_0x1df1('0xe6')]=_0x54ed2e[_0x1df1('0xe6')];}};Dialer[_0x1df1('0x16')][_0x1df1('0xe7')]=function(_0x566555){if(!this[_0x1df1('0x20')][_0x566555[_0x1df1('0xe8')]]){return;}var _0x342f67=this[_0x1df1('0x1b')][this[_0x1df1('0x20')][_0x566555[_0x1df1('0xe8')]][_0x1df1('0xb7')]][_0x1df1('0xe9')]||_0x1df1('0xea');if(_0x342f67==='roundrobin'){if(this[_0x1df1('0x20')][_0x566555['actionid']]&&_['isNil'](this[_0x1df1('0x20')][_0x566555['actionid']]['locked'])&&_0x566555[_0x1df1('0x7e')]==='1'&&_0x566555[_0x1df1('0xeb')]==='0'){if(this['agents'][_0x566555['stateinterface']]){if(!this['agents'][_0x566555['stateinterface']][_0x1df1('0xec')]){this[_0x1df1('0x1d')][_0x566555[_0x1df1('0xed')]]['locked']=!![];this[_0x1df1('0x20')][_0x566555[_0x1df1('0xe8')]]['locked']=!![];this[_0x1df1('0x20')][_0x566555[_0x1df1('0xe8')]][_0x1df1('0xed')]=_0x566555[_0x1df1('0xed')];}}}}else if(_0x342f67===_0x1df1('0xea')){if(this[_0x1df1('0x20')][_0x566555[_0x1df1('0xe8')]]){if(this[_0x1df1('0x1d')][_0x566555[_0x1df1('0xed')]]){this[_0x1df1('0x20')][_0x566555[_0x1df1('0xe8')]]['stateinterface']=_0x566555[_0x1df1('0xed')];if(_['isNil'](this[_0x1df1('0x24')][this[_0x1df1('0x20')][_0x566555[_0x1df1('0xe8')]][_0x1df1('0xb7')]])){this[_0x1df1('0x24')][this[_0x1df1('0x20')][_0x566555[_0x1df1('0xe8')]][_0x1df1('0xb7')]]=[];}this[_0x1df1('0x24')][this[_0x1df1('0x20')][_0x566555[_0x1df1('0xe8')]][_0x1df1('0xb7')]][_0x1df1('0x90')](_[_0x1df1('0x56')](_[_0x1df1('0xee')](this[_0x1df1('0x20')][_0x566555[_0x1df1('0xe8')]],[_0x1df1('0xef'),_0x1df1('0xed')]),{'status':_0x566555[_0x1df1('0x7e')],'paused':_0x566555[_0x1df1('0xeb')]}));}}}};Dialer[_0x1df1('0x16')][_0x1df1('0x35')]=function(_0x29b6f2){if(!this[_0x1df1('0x20')][_0x29b6f2[_0x1df1('0xe8')]]){return;}var _0x2b40c2=this;var _0x5c97e4=this[_0x1df1('0x1b')][this[_0x1df1('0x20')][_0x29b6f2[_0x1df1('0xe8')]][_0x1df1('0xb7')]];var _0x14f33a=_0x5c97e4[_0x1df1('0xe9')]||_0x1df1('0xea');if(_0x14f33a===_0x1df1('0xf0')){if(this[_0x1df1('0x20')][_0x29b6f2['actionid']]&&this[_0x1df1('0x20')][_0x29b6f2[_0x1df1('0xe8')]][_0x1df1('0xed')]){this['preview']['run'](this['actions'][_0x29b6f2['actionid']][_0x1df1('0xef')],this[_0x1df1('0x20')][_0x29b6f2[_0x1df1('0xe8')]][_0x1df1('0xed')])[_0x1df1('0x97')](function(_0x38e261){logger[_0x1df1('0x5c')](_0x1df1('0xf1'),util[_0x1df1('0x3f')](_0x38e261,{'showHidden':![],'depth':null}));})[_0x1df1('0x19')](function(){_0x2b40c2[_0x1df1('0xf2')](_0x2b40c2['voiceQueues'][_0x2b40c2[_0x1df1('0x20')][_0x29b6f2['actionid']][_0x1df1('0xb7')]]);_0x2b40c2[_0x1df1('0x1d')][_0x2b40c2[_0x1df1('0x20')][_0x29b6f2[_0x1df1('0xe8')]][_0x1df1('0xed')]][_0x1df1('0xec')]=![];delete _0x2b40c2[_0x1df1('0x20')][_0x29b6f2[_0x1df1('0xe8')]];unlockQueueStatus(_0x5c97e4);});}else{this[_0x1df1('0xf2')](this[_0x1df1('0x1b')][this[_0x1df1('0x20')][_0x29b6f2[_0x1df1('0xe8')]]['queue']]);hopperUtils[_0x1df1('0xcf')]({'active':![],'ContactId':this[_0x1df1('0x20')][_0x29b6f2[_0x1df1('0xe8')]][_0x1df1('0xe1')],'ListId':this[_0x1df1('0x20')][_0x29b6f2[_0x1df1('0xe8')]]['ListId'],'VoiceQueueId':this[_0x1df1('0x20')][_0x29b6f2[_0x1df1('0xe8')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x29b6f2[_0x1df1('0xe8')]]['CampaignId']||undefined})[_0x1df1('0x97')](loggerCatch(_0x1df1('0xf3')));delete this[_0x1df1('0x20')][_0x29b6f2[_0x1df1('0xe8')]];unlockQueueStatus(_0x5c97e4);}}else if(_0x14f33a===_0x1df1('0xea')){var _0x2202e6;if(this[_0x1df1('0x20')][_0x29b6f2[_0x1df1('0xe8')]]&&!_[_0x1df1('0x42')](this[_0x1df1('0x24')][this[_0x1df1('0x20')][_0x29b6f2[_0x1df1('0xe8')]][_0x1df1('0xb7')]])){if(this['queueBookedRR'][_0x2b40c2[_0x1df1('0x20')][_0x29b6f2[_0x1df1('0xe8')]][_0x1df1('0xb7')]]){this['queueBookedRR'][_0x2b40c2[_0x1df1('0x20')][_0x29b6f2[_0x1df1('0xe8')]]['queue']]=this['queueBookedRR'][this[_0x1df1('0x20')][_0x29b6f2[_0x1df1('0xe8')]][_0x1df1('0xb7')]]?this['queueBookedRR'][this[_0x1df1('0x20')][_0x29b6f2[_0x1df1('0xe8')]]['queue']]:this[_0x1df1('0x24')][this['actions'][_0x29b6f2[_0x1df1('0xe8')]][_0x1df1('0xb7')]]?this[_0x1df1('0x24')][this[_0x1df1('0x20')][_0x29b6f2[_0x1df1('0xe8')]][_0x1df1('0xb7')]]['_rr']||0x0:0x0;}this[_0x1df1('0x24')][this['actions'][_0x29b6f2[_0x1df1('0xe8')]][_0x1df1('0xb7')]][_0x1df1('0xf4')]=this[_0x1df1('0x25')][this[_0x1df1('0x20')][_0x29b6f2[_0x1df1('0xe8')]][_0x1df1('0xb7')]];for(var _0x814527=0x0;_0x814527=_0x413cf1[_0x1df1('0x118')]){_0x36cbc3[_0x1df1('0x119')](_0x589d29,_0x19cba0,_0x293387,_0x1df1('0x11a'));}else{if(_0x589d29['countmachineretry']>=_0x413cf1[_0x1df1('0x11b')]){_0x36cbc3['createStateFinal'](_0x589d29,_0x19cba0,_0x293387,'reason\x2019\x20machine....');}else{hopperUtils[_0x1df1('0xcf')]({'active':![],'countmachineretry':_0x589d29[_0x1df1('0x113')],'scheduledat':moment()[_0x1df1('0xd0')](_0x413cf1[_0x1df1('0x11c')],_0x1df1('0xd1'))['format'](_0x1df1('0xbe')),'ContactId':_0x589d29[_0x1df1('0xe1')],'ListId':_0x589d29['ListId'],'VoiceQueueId':_0x589d29[_0x1df1('0xd2')]||undefined,'CampaignId':_0x589d29[_0x1df1('0xd3')]||undefined})[_0x1df1('0x97')](loggerCatch(_0x1df1('0x11d')));_0x19cba0({'reschedule':0x1});}}});}if(_0x46b4fc['type']===_0x1df1('0xb6')&&this[_0x1df1('0x1c')][_0x46b4fc[_0x1df1('0xb7')]][_0x1df1('0x10f')]&&_0xff1c5f[_0x1df1('0x110')]===_0x1df1('0x107')){delete this[_0x1df1('0xb4')][_0xff1c5f[_0x1df1('0xb5')]];this[_0x1df1('0xf2')](this[_0x1df1('0x1c')][_0x46b4fc[_0x1df1('0xb7')]]);_0xee9ed2=new Hangup(_0x46b4fc,_0xff1c5f);_0xee9ed2[_0x1df1('0x66')]=0x12;_0xee9ed2['statedesc']=_0x1df1('0x109');_0xee9ed2['membername']=_0x1df1('0x112');ami[_0x1df1('0x3b')](_0x1df1('0x114'),ut['buildObj'](_0xee9ed2,_0x1df1('0x10c')));this[_0x1df1('0x10d')](_0xee9ed2,_0x1df1('0x11e'),_0x1df1('0x11f'));}if(_0x46b4fc[_0x1df1('0x3c')]===_0x1df1('0xb6')&&this['campaigns'][_0x46b4fc['queue']][_0x1df1('0x10f')]&&_0xff1c5f[_0x1df1('0x110')]==='MACHINE'){return new Promise(function(_0x185309,_0x4b6c27){delete _0x36cbc3[_0x1df1('0xb4')][_0xff1c5f[_0x1df1('0xb5')]];_0x36cbc3[_0x1df1('0xf2')](_0x36cbc3[_0x1df1('0x1c')][_0x46b4fc[_0x1df1('0xb7')]]);_0x36cbc3[_0x1df1('0x1c')][_0x46b4fc['queue']][_0x1df1('0xb9')]+=0x1;_0x36cbc3[_0x1df1('0x1c')][_0x46b4fc['queue']][_0x1df1('0x108')]+=0x1;var _0x425ea0=_0x36cbc3[_0x1df1('0x1c')][_0x46b4fc['queue']];var _0x55dbac=new Hangup(_0x46b4fc,_0xff1c5f);_0x55dbac['state']=0x13;_0x55dbac[_0x1df1('0x67')]='Machine';_0x55dbac[_0x1df1('0x10a')]=_0x1df1('0x112');_0x55dbac[_0x1df1('0x113')]+=0x1;_0x55dbac['countglobal']+=0x1;_0x55dbac[_0x1df1('0x10c')]=!![];ami['emit'](_0x1df1('0x114'),ut[_0x1df1('0x10b')](_0x55dbac,_0x1df1('0x10c')));hopperUtils['createHistory'](_0x55dbac)['catch'](loggerCatch(_0x1df1('0x115')));if(_0x55dbac[_0x1df1('0x120')]+_0x55dbac[_0x1df1('0x121')]+_0x55dbac[_0x1df1('0x116')]+_0x55dbac[_0x1df1('0x117')]+_0x55dbac[_0x1df1('0xc9')]+_0x55dbac[_0x1df1('0xe0')]+_0x55dbac[_0x1df1('0x113')]+_0x55dbac['countagentrejectretry']>=_0x425ea0[_0x1df1('0x118')]){_0x36cbc3[_0x1df1('0x119')](_0x55dbac,_0x185309,_0x4b6c27,_0x1df1('0x11a'));}else{if(_0x55dbac[_0x1df1('0x113')]>=_0x425ea0[_0x1df1('0x11b')]){_0x36cbc3[_0x1df1('0x122')](_0x55dbac,_0x185309,_0x4b6c27,'reason\x2019\x20machine....');}else{hopperUtils[_0x1df1('0xcf')]({'active':![],'countmachineretry':_0x55dbac[_0x1df1('0x113')],'scheduledat':moment()[_0x1df1('0xd0')](_0x425ea0[_0x1df1('0x11c')],_0x1df1('0xd1'))['format'](_0x1df1('0xbe')),'ContactId':_0x55dbac[_0x1df1('0xe1')],'ListId':_0x55dbac['ListId'],'VoiceQueueId':_0x55dbac['VoiceQueueId']||undefined,'CampaignId':_0x55dbac['CampaignId']||undefined})[_0x1df1('0x97')](loggerCatch(_0x1df1('0x11d')));_0x185309({'reschedule':0x1});}}});}}};Dialer[_0x1df1('0x16')][_0x1df1('0x31')]=function(_0x23649b){var _0x209137=this[_0x1df1('0xb4')][_0x23649b[_0x1df1('0xb5')]];var _0x50faf7;if(_0x209137&&_0x209137[_0x1df1('0x3c')]==='ivr'){delete this['uniqueId'][_0x23649b[_0x1df1('0xb5')]];this['updateOriginated'](this[_0x1df1('0x1c')][_0x209137[_0x1df1('0xb7')]]);this[_0x1df1('0x1c')][_0x209137[_0x1df1('0xb7')]]['ivrAnswerCallsDay']+=0x1;_0x50faf7=new Hangup(_0x209137,_0x23649b);hopperUtils[_0x1df1('0xbf')](_0x50faf7)[_0x1df1('0x97')](loggerCatch(_0x1df1('0x123')));hopperUtils[_0x1df1('0xc1')](_0x50faf7)[_0x1df1('0x97')](loggerCatch(_0x1df1('0x124')));}if(_0x209137&&_0x209137[_0x1df1('0x3c')]!==_0x1df1('0xb6')&&isNotNull(this[_0x1df1('0x1b')][_0x209137[_0x1df1('0xb7')]]['dialQueueProject'])){delete this[_0x1df1('0xb4')][_0x23649b['uniqueid']];this[_0x1df1('0xf2')](this['voiceQueues'][_0x209137[_0x1df1('0xb7')]]);this[_0x1df1('0x1b')][_0x209137['queue']][_0x1df1('0xb9')]+=0x1;this['voiceQueues'][_0x209137[_0x1df1('0xb7')]][_0x1df1('0x108')]+=0x1;_0x50faf7=new Hangup(_0x209137,_0x23649b);_0x50faf7[_0x1df1('0x66')]=0x10;_0x50faf7[_0x1df1('0x67')]=_0x1df1('0x125');_0x50faf7[_0x1df1('0x10a')]=_0x1df1('0x126');hopperUtils[_0x1df1('0xbf')](_0x50faf7)[_0x1df1('0x97')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x50faf7)['catch'](loggerCatch(_0x1df1('0x124')));}if(_0x209137&&_0x209137[_0x1df1('0x3c')]!==_0x1df1('0xb6')&&!isNotNull(this['voiceQueues'][_0x209137[_0x1df1('0xb7')]][_0x1df1('0x127')])){if(_0x23649b[_0x1df1('0x128')]===_0x1df1('0x129')){delete this['uniqueId'][_0x23649b[_0x1df1('0xb5')]];this[_0x1df1('0x1b')][_0x209137['queue']][_0x1df1('0xb9')]+=0x1;const _0x23aeaf=new AgentComplete(_0x209137,_0x23649b);_0x23aeaf[_0x1df1('0xd3')]=this['voiceQueues'][_0x209137[_0x1df1('0xb7')]]['id'];hopperUtils['createHistory'](_0x23aeaf)[_0x1df1('0x97')](loggerCatch(_0x1df1('0xc0')));hopperUtils[_0x1df1('0xc1')](_0x23aeaf)[_0x1df1('0x97')](loggerCatch(_0x1df1('0x12a')));}else{delete this[_0x1df1('0xb4')][_0x23649b[_0x1df1('0xb5')]];this[_0x1df1('0xf2')](this['voiceQueues'][_0x209137[_0x1df1('0xb7')]]);this[_0x1df1('0x1b')][_0x209137[_0x1df1('0xb7')]][_0x1df1('0x12b')]+=0x1;_0x50faf7=new Hangup(_0x209137,_0x23649b);_0x50faf7[_0x1df1('0x66')]=0xc;_0x50faf7['statedesc']=_0x23649b[_0x1df1('0x128')];_0x50faf7[_0x1df1('0x10a')]=_0x1df1('0x12c');hopperUtils[_0x1df1('0xbf')](_0x50faf7)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x1df1('0xc1')](_0x50faf7)[_0x1df1('0x97')](loggerCatch(_0x1df1('0x124')));}}};Dialer[_0x1df1('0x16')][_0x1df1('0x9')]=function(_0x1dc6ab){var _0x4af13c=this;if(!_0x4af13c[_0x1df1('0x26')][_0x1dc6ab[_0x1df1('0x40')]]){_0x4af13c[_0x1df1('0x26')][_0x1dc6ab['name']]={'running':![]};}else if(_0x4af13c[_0x1df1('0x26')][_0x1dc6ab[_0x1df1('0x40')]]['running']===!![]){return;}else if(_0x4af13c[_0x1df1('0x26')][_0x1dc6ab[_0x1df1('0x40')]][_0x1df1('0x12d')]===![]){_0x4af13c['queuesSummary'][_0x1dc6ab[_0x1df1('0x40')]][_0x1df1('0x12d')]=!![];}var _0x5bbe54=_0x4af13c[_0x1df1('0x1b')][_0x1dc6ab[_0x1df1('0x40')]];var _0x4c1793=_0x5bbe54[_0x1df1('0x60')]!==utils[_0x1df1('0x61')][_0x1df1('0x6f')];var _0xdc6514=utils[_0x1df1('0x12e')](_0x5bbe54);_0x5bbe54[_0x1df1('0x12f')]=utils[_0x1df1('0x130')](_0x5bbe54,_0x4af13c[_0x1df1('0x1e')]);Promise['resolve']()[_0x1df1('0x39')](function(){if(_0x5bbe54[_0x1df1('0x12f')]===utils[_0x1df1('0x61')][_0x1df1('0x6f')]){if(_0x4c1793){clearPredictiveAttributes(_0x5bbe54);_0x1dc6ab['startPredictive']=undefined;_0x1dc6ab['startProgressive']=undefined;}if(_0x5bbe54[_0x1df1('0x12f')]===utils['CAMPAIGN_STATUS'][_0x1df1('0x6f')]){_0x1dc6ab[_0x1df1('0x131')]=0x0;_0x1dc6ab[_0x1df1('0xeb')]=0x0;_0x1dc6ab[_0x1df1('0x132')]=0x0;_0x1dc6ab[_0x1df1('0x133')]=0x0;_0x1dc6ab[_0x1df1('0x134')]=0x0;}}else if(_0x5bbe54['statusMessage']===utils[_0x1df1('0x61')]['ACTIVE']&&!_0xdc6514){return _0x4af13c[_0x1df1('0x9e')](_0x5bbe54,!![])[_0x1df1('0x39')](function(){return _0x4af13c['ifTime'](_0x5bbe54,![]);})['then'](function(){return _0x4af13c[_0x1df1('0xa7')](_0x5bbe54);})[_0x1df1('0x97')](function(_0x373e10){loggerSyncQueueSummary[_0x1df1('0x57')](_0x1df1('0x135'),util[_0x1df1('0x3f')](_0x373e10,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x5bbe54);});}else{clearPredictiveAttributes(_0x5bbe54);}})[_0x1df1('0x39')](function(){var _0x3517fe=_0x1dc6ab[_0x1df1('0x136')](_0x5bbe54);if(_0x3517fe||_0x5bbe54['queueSummaryCountersUpdated']){_0x5bbe54[_0x1df1('0x137')]=![];_0x1dc6ab[_0x1df1('0x138')](_0x5bbe54);Object['assign'](_0x5bbe54,_0x1dc6ab);emitOutboundVoiceQueueSummary(_0x1dc6ab);}_0x4af13c[_0x1df1('0x26')][_0x5bbe54[_0x1df1('0x40')]][_0x1df1('0x12d')]=![];})[_0x1df1('0x97')](function(_0x1ea419){logger[_0x1df1('0x5c')](_0x1df1('0x135'),util[_0x1df1('0x3f')](_0x1ea419,{'showHidden':![],'depth':null}));_0x4af13c[_0x1df1('0x26')][_0x5bbe54[_0x1df1('0x40')]][_0x1df1('0x12d')]=![];});};Dialer[_0x1df1('0x16')]['syncQueueSummaryComplete']=_[_0x1df1('0x139')](function(){var _0x2b34f0=_['filter'](this[_0x1df1('0x1b')],function(_0x23bc87){return _0x23bc87[_0x1df1('0x13a')];});var _0x507d58=_[_0x1df1('0x13b')](this[_0x1df1('0x1d')],function(_0x430cd3){return _0x430cd3['online']&&_0x430cd3[_0x1df1('0x7e')]==='reachable';});if(_0x2b34f0[_0x1df1('0xf5')]>0x0&&_0x507d58[_0x1df1('0xf5')]>0x0){return Promise['resolve']()[_0x1df1('0x39')](cmHopper[_0x1df1('0x13c')](_[_0x1df1('0x13d')](_0x2b34f0,'id'),previewRecallmeReminderInterval,_[_0x1df1('0x13d')](_0x507d58,'id')))['then'](function(_0xe4bd8a){for(var _0x5a3b62=0x0;_0x5a3b62<_0xe4bd8a[_0x1df1('0xf5')];_0x5a3b62++){var _0x2edf11=_0xe4bd8a[_0x5a3b62]['Agent'][_0x1df1('0x40')];if(_0x2edf11)io['to'](util[_0x1df1('0x71')](_0x1df1('0x13e'),_0x2edf11))[_0x1df1('0x3b')](_0x1df1('0x13f'),{'hopper':_0xe4bd8a[_0x5a3b62]});}})['catch'](function(_0xc57af8){logger[_0x1df1('0x5c')](_0x1df1('0x140'),_0xc57af8);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x1df1('0x16')][_0x1df1('0x37')]=function(){var _0x3860fa=this;setInterval(function(){_0x3860fa[_0x1df1('0x141')](_0x3860fa[_0x1df1('0xb4')],_0x1df1('0x142'));_0x3860fa[_0x1df1('0x141')](_0x3860fa['actions'],'[actions]');},0x32c8);};Dialer[_0x1df1('0x16')][_0x1df1('0x141')]=function(_0x3a64ef,_0x2c9047){var _0x69f8a2=this;for(var _0x40bb72 in _0x3a64ef){if(typeof _0x3a64ef[_0x40bb72]!==_0x1df1('0xa0')){this[_0x1df1('0x143')][_0x1df1('0x17')](function(){if(!_['isNil'](_0x3a64ef[_0x40bb72])){return ami[_0x1df1('0x91')]({'action':_0x1df1('0x7e'),'channel':_0x3a64ef[_0x40bb72][_0x1df1('0xe6')]})['catch'](function(_0x2893eb){if(_0x2893eb[_0x1df1('0x60')]===_0x1df1('0x144')){setTimeout(function(){if(_0x3a64ef[_0x40bb72]&&_0x3a64ef[_0x40bb72][_0x1df1('0x3c')]!==_0x1df1('0xb6')){_0x69f8a2['updateOriginated'](_0x69f8a2[_0x1df1('0x1b')][_0x3a64ef[_0x40bb72]['queue']]);logger['error'](_0x1df1('0x145'),_0x2c9047,_0x40bb72,_0x3a64ef[_0x40bb72]['queue']);delete _0x3a64ef[_0x40bb72];}if(_0x3a64ef[_0x40bb72]&&_0x3a64ef[_0x40bb72][_0x1df1('0x3c')]===_0x1df1('0xb6')){_0x69f8a2['updateOriginated'](_0x69f8a2[_0x1df1('0x1c')][_0x3a64ef[_0x40bb72]['queue']]);logger[_0x1df1('0x5c')](_0x1df1('0x146'),_0x2c9047,_0x40bb72,_0x3a64ef[_0x40bb72][_0x1df1('0xb7')]);delete _0x3a64ef[_0x40bb72];}},0x2328);}});}});}}};Dialer[_0x1df1('0x16')][_0x1df1('0x147')]=function(_0x11f61c){return Promise[_0x1df1('0xa2')]()[_0x1df1('0x39')](voiceQueueRt[_0x1df1('0x147')](_0x11f61c))[_0x1df1('0x97')](loggerCatch(_0x1df1('0x148')));};Dialer[_0x1df1('0x16')][_0x1df1('0xf2')]=function(_0x6222b4){if(!_[_0x1df1('0x4c')](_0x6222b4)&&_0x6222b4!==null){if(typeof _0x6222b4[_0x1df1('0x75')]!==_0x1df1('0xa0')){if(_0x6222b4[_0x1df1('0x75')]>0x0){_0x6222b4['originated']-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x1df1('0x5c')](_0x1df1('0x149'));}};Dialer[_0x1df1('0x16')][_0x1df1('0x14a')]=function(_0x5214f2,_0x23a6d2){var _0x35fe4d=this;return function(_0x2eaef3){_0x35fe4d[_0x1df1('0xf2')](_0x23a6d2);logger[_0x1df1('0x5c')](_0x5214f2,util[_0x1df1('0x3f')](_0x2eaef3,{'showHidden':![],'depth':null}));};};Dialer[_0x1df1('0x16')][_0x1df1('0x14b')]=function(_0x4c1d79,_0x38a163,_0x2ece85){var _0x56b697={'state':0x19,'statedesc':_0x1df1('0x14c')};this[_0x1df1('0xf2')](_0x38a163);this[_0x1df1('0x10d')](_[_0x1df1('0x56')](_0x56b697,_[_0x1df1('0xee')](_0x2ece85,[_0x1df1('0xe1'),_0x1df1('0xe2'),_0x1df1('0x14d'),_0x1df1('0xd2'),_0x1df1('0xd3')])),_0x1df1('0x14e'),'[emptyContact]');logger['error'](_0x4c1d79);};Dialer[_0x1df1('0x16')]['saveInDb']=function(_0x2e4269,_0x27bf2b,_0x3f6e70){hopperUtils[_0x1df1('0xbf')](_0x2e4269)[_0x1df1('0x97')](loggerCatch(_0x27bf2b));hopperUtils[_0x1df1('0xc1')](_0x2e4269)[_0x1df1('0x97')](loggerCatch(_0x3f6e70));};Dialer[_0x1df1('0x16')][_0x1df1('0xcd')]=function(_0x14a2aa,_0x3037a8){hopperUtils['createHistory'](_0x14a2aa)[_0x1df1('0x97')](loggerCatch(_0x1df1('0xc0')));if(_0x3037a8==0x0){hopperUtils['moveContactManagedDialer'](_0x14a2aa)[_0x1df1('0x97')](loggerCatch(_0x1df1('0x14f')));}};Dialer[_0x1df1('0x16')][_0x1df1('0x140')]=function(_0x48ff10){return Promise[_0x1df1('0xa2')]()[_0x1df1('0x39')](cmHopper[_0x1df1('0x13c')](_0x48ff10['id'],previewRecallmeReminderInterval))[_0x1df1('0x39')](function(_0x41fcc9){for(var _0x27b493=0x0;_0x27b493<_0x41fcc9['length'];_0x27b493++){var _0x2cd43a=_0x41fcc9[_0x27b493][_0x1df1('0x150')][_0x1df1('0x40')];if(_0x2cd43a)io['to'](util['format']('user:%s',_0x2cd43a))[_0x1df1('0x3b')](_0x1df1('0x13f'),{'hopper':_0x41fcc9[_0x27b493]});}})[_0x1df1('0x97')](function(){});};Dialer[_0x1df1('0x16')][_0x1df1('0xa5')]=function(_0x1a9a25){var _0x5876d2=this;return function(){_0x5876d2['handleIvr'](_0x1a9a25);};};Dialer[_0x1df1('0x16')]['actionOriginate']=function(_0x44065f,_0x2a5838){var _0x136aac=this;var _0x361b1c=uuid['v4']();this[_0x1df1('0x20')][_0x361b1c]=new Action(_0x44065f,_0x2a5838,_0x361b1c);return new Promise(function(_0x120632,_0x401fbb){if(_[_0x1df1('0x4c')](_0x44065f)&&typeof _0x44065f!==_0x1df1('0x151')){return _0x401fbb(msgResponse(_0x1df1('0x152'),_0x1df1('0x88'),'voiceQueue\x20is\x20undefine'));}if(_[_0x1df1('0x4c')](_0x2a5838['phone'])||_0x2a5838['phone']===null){return _0x401fbb(msgResponse(_0x1df1('0x152'),_0x1df1('0x88'),'contact\x20is\x20undefine'));}var _0x13447c={'XMD-CALLERID':_0x136aac['actions'][_0x361b1c][_0x1df1('0x153')](),'XMD-AGI':_0x44065f['dialQueueProject']?util['format'](_0x1df1('0x154'),ipAgi,_0x44065f[_0x1df1('0x127')]):_0x1df1('0x155'),'XMD-AGIAFTER':_0x44065f[_0x1df1('0xbc')]?util[_0x1df1('0x71')](_0x1df1('0x154'),ipAgi,_0x44065f['dialQueueProject2']):_0x1df1('0x155'),'XMD-QUEUE':utils[_0x1df1('0x156')](_0x44065f)?util[_0x1df1('0x71')]('\x22%s,%s%s,,,%s\x22',_0x44065f[_0x1df1('0x40')],_0x44065f[_0x1df1('0x157')]||'',_0x44065f[_0x1df1('0xbd')]?'c':'',_0x44065f[_0x1df1('0xc4')]||0x3):_0x1df1('0x155'),'XMD-CONTACTID':_0x2a5838['ContactId'],'XMD-CDRTYPE':_0x1df1('0x158'),'CALLERID(all)':_0x136aac['actions'][_0x361b1c][_0x1df1('0x153')](),'XMD-AMD':_0x44065f[_0x1df1('0x10f')]?'ACTIVE':_0x1df1('0x155'),'XMD-DESTINATION':_0x1df1('0x159')};if(_0x44065f[_0x1df1('0x10f')]){_0x13447c[_0x1df1('0x15a')]=_0x44065f[_0x1df1('0x15b')]||0x9c4;_0x13447c[_0x1df1('0x15c')]=_0x44065f[_0x1df1('0x15d')]||0x5dc;_0x13447c[_0x1df1('0x15e')]=_0x44065f[_0x1df1('0x15f')]||0x320;_0x13447c['XMD-AMDTOTALANALYSISTIME']=_0x44065f[_0x1df1('0x160')]||0x1388;_0x13447c[_0x1df1('0x161')]=_0x44065f[_0x1df1('0x162')]||0x64;_0x13447c[_0x1df1('0x163')]=_0x44065f[_0x1df1('0x164')]||0x32;_0x13447c['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x44065f[_0x1df1('0x165')]||0x3;_0x13447c[_0x1df1('0x166')]=_0x44065f[_0x1df1('0x167')]||0x100;_0x13447c['XMD-AMDMAXIMUMWORDLENGTH']=_0x44065f['dialAMDMaximumWordLength']||0x1388;}if(utils[_0x1df1('0x156')](_0x44065f)){_0x13447c[_0x1df1('0x168')]=_0x2a5838['VoiceQueueId'];}else{_0x13447c[_0x1df1('0x169')]=_0x2a5838['CampaignId'];}var _0x51439b=utils[_0x1df1('0x16a')](_0x2a5838['Contact']);Object[_0x1df1('0x16b')](_0x13447c,_0x51439b);var _0x5ec063=_0x136aac['isTrunkReachable'](_0x44065f['Trunk'])?utils[_0x1df1('0x16c')](_0x44065f['Trunk'][_0x1df1('0x16d')],_0x44065f[_0x1df1('0x16e')],_0x44065f['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x1df1('0x16f')](_0x44065f[_0x1df1('0x170')],_0x44065f[_0x1df1('0x171')]):_0x44065f['dialOriginateCallerIdNumber']):utils[_0x1df1('0x16c')](_[_0x1df1('0xf6')](_0x44065f[_0x1df1('0x82')])?_0x44065f['Trunk'][_0x1df1('0x16d')]:_0x44065f['TrunkBackup'][_0x1df1('0x16d')],_0x44065f['dialOriginateCallerIdName'],_0x44065f['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x1df1('0x16f')](_0x44065f[_0x1df1('0x170')],_0x44065f[_0x1df1('0x171')]):_0x44065f['dialOriginateCallerIdNumber']);if(_0x5ec063){_0x13447c[_0x1df1('0x172')]=_0x136aac['actions'][_0x361b1c][_0x1df1('0x173')]=utils[_0x1df1('0x174')](_0x5ec063);_0x13447c[_0x1df1('0x175')]=_0x2a5838['phone'];}_0x44065f[_0x1df1('0x176')]=_0x13447c;return ami[_0x1df1('0x91')]({'actionid':_0x361b1c,'action':'originate','channel':_0x136aac[_0x1df1('0x80')](_0x44065f[_0x1df1('0x81')])?util[_0x1df1('0x71')]('SIP/%s/%s%s',_0x44065f[_0x1df1('0x81')]['name'],isNotNull(_0x44065f[_0x1df1('0x177')])?_0x44065f[_0x1df1('0x177')]['trim']()||'':'',_0x44065f[_0x1df1('0x178')]>0x0?_0x2a5838[_0x1df1('0x179')][_0x1df1('0x17a')](_0x44065f[_0x1df1('0x178')]):_0x2a5838[_0x1df1('0x179')]):util[_0x1df1('0x71')](_0x1df1('0x17b'),_[_0x1df1('0xf6')](_0x44065f[_0x1df1('0x82')])?_0x44065f[_0x1df1('0x81')][_0x1df1('0x40')]:_0x44065f[_0x1df1('0x82')]['name'],isNotNull(_0x44065f[_0x1df1('0x177')])?_0x44065f[_0x1df1('0x177')][_0x1df1('0x17c')]()||'':'',_0x44065f[_0x1df1('0x178')]>0x0?_0x2a5838[_0x1df1('0x179')][_0x1df1('0x17a')](_0x44065f[_0x1df1('0x178')]):_0x2a5838[_0x1df1('0x179')]),'callerid':_0x5ec063,'Exten':_0x1df1('0x159'),'Context':_0x1df1('0x17d'),'Priority':'1','variable':_0x13447c,'timeout':(_0x44065f[_0x1df1('0x17e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x361b1c})['then'](function(_0x4cd238){return _0x120632(_0x4cd238);})[_0x1df1('0x97')](function(_0x1b755f){_0x44065f[_0x1df1('0x17f')]+=0x1;var _0x5e883e=new History(_0x136aac[_0x1df1('0x20')][_0x361b1c]);logger[_0x1df1('0x5c')](util['format']('[originateError]:\x20%s',JSON[_0x1df1('0x7a')](_0x1b755f)));_0x5e883e[_0x1df1('0x66')]=0xe;_0x5e883e[_0x1df1('0x67')]='OriginateError';_0x5e883e[_0x1df1('0x68')]=moment()[_0x1df1('0x71')](_0x1df1('0xbe'));_0x5e883e['endtime']=_0x5e883e[_0x1df1('0x68')];hopperUtils[_0x1df1('0xbf')](_0x5e883e)[_0x1df1('0x97')](loggerCatch(_0x1df1('0x180')));_0x136aac[_0x1df1('0xc1')](_0x5e883e)[_0x1df1('0x97')](loggerCatch(_0x1df1('0x180')))[_0x1df1('0x19')](function(){delete _0x136aac[_0x1df1('0x20')][_0x361b1c];return _0x401fbb(msgResponse(_0x1df1('0x152'),_0x1df1('0xb3'),_0x1df1('0x181')));});});});};Dialer['prototype'][_0x1df1('0x182')]=function(_0x471ed5,_0x38588b,_0x778610){var _0x3b84cd=new History(_0x38588b);if(_0x3b84cd[_0x1df1('0x120')]+_0x3b84cd[_0x1df1('0x121')]+_0x3b84cd[_0x1df1('0x116')]+_0x3b84cd[_0x1df1('0x117')]+_0x3b84cd[_0x1df1('0xc9')]+_0x3b84cd[_0x1df1('0xe0')]+_0x3b84cd['countmachineretry']+_0x3b84cd[_0x1df1('0x183')]>=_0x778610[_0x1df1('0x118')]-0x1){return!![];}switch(_0x471ed5){case 0x3:if(_0x3b84cd[_0x1df1('0x116')]>=_0x778610[_0x1df1('0x184')]-0x1){return!![];}hopperUtils[_0x1df1('0xcf')]({'active':![],'countnoanswerretry':_0x3b84cd[_0x1df1('0x116')]+=0x1,'scheduledat':moment()[_0x1df1('0xd0')](_0x778610[_0x1df1('0x185')],'minutes')[_0x1df1('0x71')](_0x1df1('0xbe')),'ContactId':_0x3b84cd[_0x1df1('0xe1')],'ListId':_0x3b84cd[_0x1df1('0xe2')],'VoiceQueueId':_0x3b84cd['VoiceQueueId']||undefined,'CampaignId':_0x3b84cd[_0x1df1('0xd3')]||undefined})[_0x1df1('0x97')](loggerCatch(_0x1df1('0x186')));break;case 0x5:if(_0x3b84cd[_0x1df1('0x120')]>=_0x778610[_0x1df1('0x187')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x3b84cd[_0x1df1('0x120')]+=0x1,'scheduledat':moment()[_0x1df1('0xd0')](_0x778610[_0x1df1('0x188')],_0x1df1('0xd1'))[_0x1df1('0x71')](_0x1df1('0xbe')),'ContactId':_0x3b84cd['ContactId'],'ListId':_0x3b84cd['ListId'],'VoiceQueueId':_0x3b84cd['VoiceQueueId']||undefined,'CampaignId':_0x3b84cd[_0x1df1('0xd3')]||undefined})[_0x1df1('0x97')](loggerCatch(_0x1df1('0x189')));break;case 0x8:if(_0x3b84cd[_0x1df1('0x121')]>=_0x778610[_0x1df1('0x18a')]-0x1){return!![];}hopperUtils[_0x1df1('0xcf')]({'active':![],'countcongestionretry':_0x3b84cd[_0x1df1('0x121')]+=0x1,'scheduledat':moment()['add'](_0x778610[_0x1df1('0x18b')],_0x1df1('0xd1'))[_0x1df1('0x71')](_0x1df1('0xbe')),'ContactId':_0x3b84cd[_0x1df1('0xe1')],'ListId':_0x3b84cd['ListId'],'VoiceQueueId':_0x3b84cd[_0x1df1('0xd2')]||undefined,'CampaignId':_0x3b84cd[_0x1df1('0xd3')]||undefined})['catch'](loggerCatch(_0x1df1('0x18c')));break;case 0x0:if(_0x3b84cd[_0x1df1('0x117')]>=_0x778610[_0x1df1('0x18d')]-0x1){return!![];}else{hopperUtils[_0x1df1('0xcf')]({'active':![],'countnosuchnumberretry':_0x3b84cd[_0x1df1('0x117')]+=0x1,'scheduledat':moment()[_0x1df1('0xd0')](_0x778610['dialNoSuchNumberRetryFrequency'],_0x1df1('0xd1'))[_0x1df1('0x71')](_0x1df1('0xbe')),'ContactId':_0x3b84cd[_0x1df1('0xe1')],'ListId':_0x3b84cd['ListId'],'VoiceQueueId':_0x3b84cd[_0x1df1('0xd2')]||undefined,'CampaignId':_0x3b84cd[_0x1df1('0xd3')]||undefined})['catch'](loggerCatch(_0x1df1('0x18e')));}break;case 0xa:if(_0x3b84cd[_0x1df1('0xc9')]>=_0x778610[_0x1df1('0x18f')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x3b84cd['countdropretry']+=0x1,'scheduledat':moment()[_0x1df1('0xd0')](_0x778610[_0x1df1('0xcb')],_0x1df1('0xd1'))[_0x1df1('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3b84cd['ContactId'],'ListId':_0x3b84cd[_0x1df1('0xe2')],'VoiceQueueId':_0x3b84cd[_0x1df1('0xd2')]||undefined,'CampaignId':_0x3b84cd[_0x1df1('0xd3')]||undefined})[_0x1df1('0x97')](loggerCatch(_0x1df1('0xd4')));break;case 0xb:if(_0x3b84cd[_0x1df1('0xe0')]>=_0x778610[_0x1df1('0xdf')]-0x1){return!![];}hopperUtils[_0x1df1('0xcf')]({'active':![],'countabandonedretry':_0x3b84cd[_0x1df1('0xe0')]+=0x1,'scheduledat':moment()['add'](_0x778610[_0x1df1('0xdc')],_0x1df1('0xd1'))[_0x1df1('0x71')](_0x1df1('0xbe')),'ContactId':_0x3b84cd[_0x1df1('0xe1')],'ListId':_0x3b84cd[_0x1df1('0xe2')],'VoiceQueueId':_0x3b84cd[_0x1df1('0xd2')]||undefined,'CampaignId':_0x3b84cd[_0x1df1('0xd3')]||undefined})[_0x1df1('0x97')](loggerCatch(_0x1df1('0xe3')));break;case 0x13:if(_0x3b84cd[_0x1df1('0x113')]>=_0x778610[_0x1df1('0x11b')]-0x1){return!![];}hopperUtils[_0x1df1('0xcf')]({'active':![],'countmachineretry':_0x3b84cd[_0x1df1('0x113')]+=0x1,'scheduledat':moment()[_0x1df1('0xd0')](_0x778610['dialMachineRetryFrequency'],_0x1df1('0xd1'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3b84cd['ContactId'],'ListId':_0x3b84cd[_0x1df1('0xe2')],'VoiceQueueId':_0x3b84cd['VoiceQueueId']||undefined,'CampaignId':_0x3b84cd['CampaignId']||undefined})[_0x1df1('0x97')](loggerCatch(_0x1df1('0x11d')));break;case 0x14:if(_0x3b84cd[_0x1df1('0x183')]>=_0x778610['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x3b84cd['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x1df1('0xd0')](_0x778610[_0x1df1('0x190')],_0x1df1('0xd1'))[_0x1df1('0x71')](_0x1df1('0xbe')),'ContactId':_0x3b84cd['ContactId'],'ListId':_0x3b84cd[_0x1df1('0xe2')],'VoiceQueueId':_0x3b84cd[_0x1df1('0xd2')]||undefined,'CampaignId':_0x3b84cd[_0x1df1('0xd3')]||undefined})['catch'](loggerCatch(_0x1df1('0x191')));break;default:return!![];}};Dialer[_0x1df1('0x16')]['callProgressDetecting']=function(_0xc4c03c,_0x1bc4da,_0x138097){var _0x4e7b6a=this;var _0x5a20d1=new History(_0xc4c03c);var _0xbe02ac=![];var _0x57dd6f;var _0x2ba36e;return new Promise(function(_0x186b08,_0x4f3a91){if(_[_0x1df1('0x4c')](_0x1bc4da)&&typeof _0x1bc4da!==_0x1df1('0x151')){return _0x4f3a91(msgResponse('[callProgressDetecting]',_0x1df1('0x88'),_0x1df1('0x192')));}if(_[_0x1df1('0x4c')](_0x138097)&&typeof _0x138097!==_0x1df1('0x151')){return _0x4f3a91(msgResponse(_0x1df1('0x193'),_0x1df1('0x88'),_0x1df1('0x194')));}hopperUtils['verifyAdditionalPhones'](_0x5a20d1,_0x138097[_0x1df1('0xba')],_0x1bc4da)[_0x1df1('0x39')](function(_0x3f2848){if(_0x3f2848[_0x1df1('0xce')]==0x1)_0xbe02ac=!![];switch(_0x138097[_0x1df1('0xba')]){case'0':_0x1bc4da[_0x1df1('0x195')]+=0x1;_0x5a20d1[_0x1df1('0x66')]=0x0;_0x5a20d1[_0x1df1('0x67')]=_0x1df1('0x196');_0x5a20d1[_0x1df1('0x117')]+=0x1;_0x5a20d1[_0x1df1('0xca')]+=0x1;ami[_0x1df1('0x3b')](_0x1df1('0x197'),ut[_0x1df1('0x10b')](_0xc4c03c,_0x1df1('0x198')));_0x57dd6f=_0x1bc4da[_0x1df1('0x199')];_0x2ba36e=_0x1bc4da[_0x1df1('0xdd')];hopperUtils[_0x1df1('0xbf')](_0x5a20d1)[_0x1df1('0x97')](loggerCatch(_0x1df1('0x115')));if(_0x4e7b6a[_0x1df1('0x182')](0x0,_0xc4c03c,_0x1bc4da)&&!_0xbe02ac){if(_0x5a20d1[_0x1df1('0x117')]>=_0x1bc4da[_0x1df1('0x18d')]){_0x4e7b6a[_0x1df1('0x122')](_0x5a20d1,_0x186b08,_0x4f3a91,_0x1df1('0x19a'));}else{_0x4e7b6a[_0x1df1('0x119')](_0x5a20d1,_0x186b08,_0x4f3a91,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x1bc4da[_0x1df1('0x19b')]+=0x1;_0x5a20d1[_0x1df1('0x66')]=0x3;_0x5a20d1[_0x1df1('0x67')]=_0x1df1('0x19c');_0x5a20d1[_0x1df1('0x116')]+=0x1;_0x5a20d1['countglobal']+=0x1;var _0x33a70e=ut['buildNoAnswerEventPayload'](_0xc4c03c,_0x1bc4da);ami['emit'](_0x1df1('0x19d'),_0x33a70e);_0x57dd6f=_0x1bc4da['dialNoAnswerRetryFrequency'];_0x2ba36e=_0x1bc4da[_0x1df1('0xdd')];hopperUtils[_0x1df1('0xbf')](_0x5a20d1)['catch'](loggerCatch(_0x1df1('0x19e')));if(_0x4e7b6a[_0x1df1('0x182')](0x3,_0xc4c03c,_0x1bc4da)&&!_0xbe02ac){if(_0x5a20d1[_0x1df1('0x116')]>=_0x1bc4da[_0x1df1('0x184')]){_0x4e7b6a[_0x1df1('0x122')](_0x5a20d1,_0x186b08,_0x4f3a91,_0x1df1('0x19f'));}else{_0x4e7b6a[_0x1df1('0x119')](_0x5a20d1,_0x186b08,_0x4f3a91,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x1bc4da[_0x1df1('0x1a0')]+=0x1;_0x5a20d1['state']=0x5;_0x5a20d1[_0x1df1('0x67')]='Busy';_0x5a20d1[_0x1df1('0x120')]+=0x1;_0x5a20d1['countglobal']+=0x1;ami[_0x1df1('0x3b')](_0x1df1('0x1a1'),ut['buildObj'](_0xc4c03c,_0x1df1('0x1a2')));_0x57dd6f=_0x1bc4da[_0x1df1('0x188')];_0x2ba36e=_0x1bc4da[_0x1df1('0xdd')];hopperUtils[_0x1df1('0xbf')](_0x5a20d1)[_0x1df1('0x97')](loggerCatch(_0x1df1('0x1a3')));if(_0x4e7b6a[_0x1df1('0x182')](0x5,_0xc4c03c,_0x1bc4da)&&!_0xbe02ac){if(_0x5a20d1[_0x1df1('0x120')]>=_0x1bc4da[_0x1df1('0x187')]){_0x4e7b6a[_0x1df1('0x122')](_0x5a20d1,_0x186b08,_0x4f3a91,_0x1df1('0x1a4'));}else{_0x4e7b6a[_0x1df1('0x119')](_0x5a20d1,_0x186b08,_0x4f3a91,_0x1df1('0x1a4'));}}break;case'8':_0x1bc4da[_0x1df1('0x1a5')]+=0x1;_0x5a20d1[_0x1df1('0x66')]=0x8;_0x5a20d1[_0x1df1('0x67')]=_0x1df1('0x1a6');_0x5a20d1[_0x1df1('0x121')]+=0x1;_0x5a20d1['countglobal']+=0x1;_0x57dd6f=_0x1bc4da[_0x1df1('0x18b')];_0x2ba36e=_0x1bc4da[_0x1df1('0xdd')];ami[_0x1df1('0x3b')](_0x1df1('0x1a7'),ut[_0x1df1('0x10b')](_0xc4c03c,_0x1df1('0x1a8')));hopperUtils[_0x1df1('0xbf')](_0x5a20d1)[_0x1df1('0x97')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x4e7b6a['checkRetriveMax'](0x8,_0xc4c03c,_0x1bc4da)&&!_0xbe02ac){if(_0x5a20d1[_0x1df1('0x121')]>=_0x1bc4da['dialCongestionMaxRetry']){_0x4e7b6a[_0x1df1('0x122')](_0x5a20d1,_0x186b08,_0x4f3a91,_0x1df1('0x1a9'));}else{_0x4e7b6a[_0x1df1('0x119')](_0x5a20d1,_0x186b08,_0x4f3a91,_0x1df1('0x1a9'));}}break;case'11':_0x1bc4da[_0x1df1('0x1aa')]+=0x1;_0x5a20d1[_0x1df1('0x66')]=0xb;_0x5a20d1['statedesc']=_0x1df1('0xd9');_0x5a20d1[_0x1df1('0xe0')]+=0x1;_0x5a20d1[_0x1df1('0xca')]+=0x1;_0x57dd6f=_0x1bc4da[_0x1df1('0xdc')];_0x2ba36e=_0x1bc4da[_0x1df1('0xdd')];hopperUtils[_0x1df1('0xbf')](_0x5a20d1)[_0x1df1('0x97')](loggerCatch(_0x1df1('0x1ab')));if(_0x4e7b6a[_0x1df1('0x182')](0xb,_0xc4c03c,_0x1bc4da)&&!_0xbe02ac){if(_0x5a20d1['countabandonedretry']>=_0x1bc4da['dialAbandonedMaxRetry']){_0x4e7b6a['createStateFinal'](_0x5a20d1,_0x186b08,_0x4f3a91,_0x1df1('0x1ac'));}else{_0x4e7b6a['stateGlobal'](_0x5a20d1,_0x186b08,_0x4f3a91,_0x1df1('0x1ac'));}}break;case'20':_0x1bc4da['outboundRejectCallsDay']+=0x1;_0x5a20d1[_0x1df1('0x66')]=0x14;_0x5a20d1[_0x1df1('0x67')]=_0x1df1('0x1ad');_0x5a20d1['countagentrejectretry']+=0x1;_0x5a20d1['countglobal']+=0x1;_0x57dd6f=_0x1bc4da[_0x1df1('0x190')];_0x2ba36e=_0x1bc4da[_0x1df1('0xdd')];ami[_0x1df1('0x3b')]('custom:agentreject',ut[_0x1df1('0x10b')](_0xc4c03c,_0x1df1('0x1ae')));hopperUtils[_0x1df1('0xbf')](_0x5a20d1)[_0x1df1('0x97')](loggerCatch(_0x1df1('0x1af')));if(_0x4e7b6a['checkRetriveMax'](0x14,_0xc4c03c,_0x1bc4da)&&!_0xbe02ac){if(_0x5a20d1[_0x1df1('0x183')]>=_0x1bc4da[_0x1df1('0x1b0')]){_0x4e7b6a[_0x1df1('0x122')](_0x5a20d1,_0x186b08,_0x4f3a91,'reason\x2020\x20agentreject');}else{_0x4e7b6a['stateGlobal'](_0x5a20d1,_0x186b08,_0x4f3a91,_0x1df1('0x1b1'));}}break;default:_0x1bc4da[_0x1df1('0x12b')]+=0x1;_0x5a20d1[_0x1df1('0x66')]=0xc;_0x5a20d1['statedesc']=_0x138097['reason'];_0x57dd6f=_0x1bc4da[_0x1df1('0x190')];_0x2ba36e=_0x1bc4da[_0x1df1('0xdd')];hopperUtils[_0x1df1('0xbf')](_0x5a20d1)[_0x1df1('0x97')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x4e7b6a[_0x1df1('0x182')](_0x138097[_0x1df1('0xba')],_0xc4c03c,_0x1bc4da)&&!_0xbe02ac){if(_0x5a20d1[_0x1df1('0x120')]+_0x5a20d1['countcongestionretry']+_0x5a20d1[_0x1df1('0x116')]+_0x5a20d1['countnosuchnumberretry']+_0x5a20d1[_0x1df1('0xc9')]+_0x5a20d1[_0x1df1('0xe0')]+_0x5a20d1[_0x1df1('0x113')]+_0x5a20d1['countagentrejectretry']>=_0x1bc4da[_0x1df1('0x118')]){_0x4e7b6a[_0x1df1('0x119')](_0x5a20d1,_0x186b08,_0x4f3a91,_0x138097[_0x1df1('0xba')]);}else{_0x4e7b6a[_0x1df1('0x122')](_0x5a20d1,_0x186b08,_0x4f3a91,_0x138097['reason']);}}}})[_0x1df1('0x39')](function(){if(_0xbe02ac){hopperUtils[_0x1df1('0xd7')](_0x5a20d1,_0x57dd6f,_0x2ba36e)[_0x1df1('0x39')](function(){return _0x186b08(0x1);});}});});};Dialer[_0x1df1('0x16')][_0x1df1('0x119')]=function(_0x3df0db,_0x3aae7e,_0x33df2b,_0x2f0e66){var _0x3f0930=new Final(_0x3df0db);_0x3f0930['state']=0xf;_0x3f0930[_0x1df1('0x67')]='Global';this[_0x1df1('0x122')](_0x3f0930,_0x3aae7e,_0x33df2b,_0x2f0e66);};Dialer[_0x1df1('0x16')][_0x1df1('0x122')]=function(_0x3d2c24,_0x56751b,_0x4aedc5,_0x4f9ea8){hopperUtils['moveContactManagedDialer'](_0x3d2c24)[_0x1df1('0x39')](function(){return _0x56751b(msgResponse(_0x1df1('0x193'),_0x1df1('0x1b2'),_0x4f9ea8));})[_0x1df1('0x97')](function(){return _0x4aedc5(msgResponse('[moveContactManagedDialer][0]',_0x1df1('0x88'),'contact\x20not\x20moved'));});};Dialer[_0x1df1('0x16')][_0x1df1('0x8')]=function(_0x5257ec){var _0x460e5a=_0x5257ec[_0x1df1('0x1b3')]/0x64;var _0x12bf57=_0x5257ec[_0x1df1('0xc5')]/(_0x5257ec['outboundDropCallsDayTimeout']+_0x5257ec[_0x1df1('0xb9')]);var _0x1e1428=Math['round'](_0x5257ec[_0x1df1('0x1b4')]*(_0x5257ec[_0x1df1('0x1b5')]/0x64));var _0x4a95e8=Math[_0x1df1('0x1b6')](_0x5257ec[_0x1df1('0x1b4')]*(_0x5257ec['predictiveIntervalMinThreshold']/0x64));var _0x3f9c34=_0x5257ec[_0x1df1('0x131')]+_0x5257ec[_0x1df1('0x133')];var _0x4eea83=Math[_0x1df1('0x1b7')](_0x5257ec['erlangCalls']*_0x5257ec[_0x1df1('0x53')]*_0x5257ec[_0x1df1('0x1b8')]*_0x5257ec[_0x1df1('0x1b9')]);if(_[_0x1df1('0x4c')](_0x5257ec[_0x1df1('0x22')])){if(!_[_0x1df1('0x4c')](_0x5257ec[_0x1df1('0x21')])){_0x5257ec[_0x1df1('0x21')]=undefined;loggerPredictive['error'](_0x1df1('0x1ba'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x5257ec[_0x1df1('0x5a')])){loggerPredictive[_0x1df1('0x5c')]('[startMethodPredictive][StartProgressive]',_0x1df1('0x1bb'));clearInterval(_0x5257ec[_0x1df1('0x5a')]);_0x5257ec[_0x1df1('0x5a')]=undefined;}_0x5257ec[_0x1df1('0x22')]=moment()[_0x1df1('0x71')](_0x1df1('0xbe'));loggerPredictive[_0x1df1('0x43')](_0x5257ec[_0x1df1('0x40')],_0x1df1('0x1bc'),_0x5257ec[_0x1df1('0x22')]);this[_0x1df1('0xa9')](_0x5257ec,0x1);}else if(ifInterval(_0x5257ec[_0x1df1('0x1bd')],_0x5257ec[_0x1df1('0x22')])){this[_0x1df1('0xa9')](_0x5257ec,0x1);loggerPredictiveCalls[_0x1df1('0x43')]('[startMethodPredictive][StartProgressive][Loop]',_0x5257ec[_0x1df1('0x22')],_0x5257ec[_0x1df1('0x40')]);_0x5257ec[_0x1df1('0x50')]=0x0;_0x5257ec[_0x1df1('0xc6')]=0x0;}else if(_0x460e5a<_0x12bf57&&_0x5257ec[_0x1df1('0x1be')]===_0x1df1('0x1bf')){clearPredictiveAttributes(_0x5257ec);loggerPredictive[_0x1df1('0x43')](_0x1df1('0x1c0'),_0x1df1('0x1c1'),_0x12bf57,'startProgressive',_0x5257ec[_0x1df1('0x40')]);}else if(_0x4eea83<_0x5257ec[_0x1df1('0xc6')]&&_0x5257ec[_0x1df1('0x1be')]===_0x1df1('0x1bf')){clearPredictiveAttributes(_0x5257ec);loggerPredictive[_0x1df1('0x43')](_0x1df1('0x1c2'),_0x1df1('0x1c3'),_0x4eea83,_0x1df1('0x1c4'),_0x5257ec[_0x1df1('0xc6')],'startProgressive',_0x5257ec[_0x1df1('0x40')]);}else if(!ifInterval(_0x5257ec['dialPredictiveInterval'],_0x5257ec[_0x1df1('0x22')])&&_['isUndefined'](_0x5257ec[_0x1df1('0x21')])&&!_[_0x1df1('0x4c')](_0x5257ec[_0x1df1('0x22')])){_0x5257ec[_0x1df1('0x21')]=moment()['format'](_0x1df1('0xbe'));loggerPredictive[_0x1df1('0x43')](_0x5257ec['name'],_0x1df1('0x1c5'),_0x5257ec[_0x1df1('0x21')]);hopperUtils[_0x1df1('0x1c6')](_0x5257ec['dialPredictiveInterval'])[_0x1df1('0x39')](this[_0x1df1('0x1c7')](_0x5257ec))[_0x1df1('0x39')](mergeDataErlangB(_0x5257ec))['then'](this[_0x1df1('0x1c8')](_0x5257ec))[_0x1df1('0x97')](loggerCatchPredictive(_0x1df1('0x1c9'),_0x5257ec));}else if(!ifInterval(_0x5257ec[_0x1df1('0x1bd')],_0x5257ec['startPredictive'])){_0x5257ec['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x5257ec[_0x1df1('0x21')]=moment()[_0x1df1('0x71')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x5257ec[_0x1df1('0x40')],'recalculate\x20predictive\x20at',_0x5257ec[_0x1df1('0x21')]);clearInterval(_0x5257ec[_0x1df1('0x5a')]);_0x5257ec[_0x1df1('0x5a')]=undefined;hopperUtils[_0x1df1('0x1c6')](_0x5257ec[_0x1df1('0x1bd')])[_0x1df1('0x39')](this[_0x1df1('0x1c7')](_0x5257ec))['then'](mergeDataErlangB(_0x5257ec))[_0x1df1('0x39')](this[_0x1df1('0x1c8')](_0x5257ec))[_0x1df1('0x97')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x5257ec));}else if(_0x5257ec[_0x1df1('0x1b4')]&&_0x3f9c34<_0x5257ec[_0x1df1('0x1b4')]-_0x4a95e8){clearPredictiveAttributes(_0x5257ec);loggerPredictive[_0x1df1('0x43')](_0x5257ec[_0x1df1('0x40')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x3f9c34,_0x1df1('0x1ca'),_0x5257ec[_0x1df1('0x1b4')],'-',_0x4a95e8,'=',_0x5257ec[_0x1df1('0x1b4')]-_0x4a95e8,')');}else if(_0x5257ec[_0x1df1('0x1b4')]&&_0x3f9c34>_0x5257ec[_0x1df1('0x1b4')]+_0x1e1428){clearPredictiveAttributes(_0x5257ec);loggerPredictive[_0x1df1('0x43')](_0x5257ec[_0x1df1('0x40')],_0x1df1('0x1cb'),_0x3f9c34,_0x1df1('0x1cc'),_0x5257ec[_0x1df1('0x1b4')],'+',_0x1e1428,'=',_0x5257ec['predictiveIntervalAvailable']+_0x1e1428,')');}};Dialer[_0x1df1('0x16')][_0x1df1('0x1c7')]=function(_0x234177){var _0x35470f=this;return function(_0x206dbc){return new Promise(function(_0x1e21a9,_0x4fe620){_[_0x1df1('0x56')](_0x234177,_0x206dbc[0x0]);if(checkGetDataPredictive(_0x206dbc[0x0])){var _0x4e0de9=_0x234177[_0x1df1('0x1b4')]=_0x234177[_0x1df1('0x133')]+_0x234177[_0x1df1('0x131')];var _0x22aa68=_0x234177[_0x1df1('0x1bd')]*0x3c;var _0x365275=_0x206dbc[0x0][_0x1df1('0x4a')]+_0x206dbc[0x0][_0x1df1('0x49')];var _0xd591be=(_0x206dbc[0x0][_0x1df1('0x1cd')]+_0x206dbc[0x0][_0x1df1('0x47')]+_0x206dbc[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x206dbc[0x0][_0x1df1('0x46')];_0x234177[_0x1df1('0x1b8')]=_0xd591be>0x0?_0xd591be:0x1;switch(_0x234177[_0x1df1('0x1be')]){case'dropRate':var _0x533995=_0x234177['dialPredictiveOptimizationPercentage']/0x64;return _0x35470f[_0x1df1('0x1ce')](_0x4e0de9,_0x22aa68,_0x365275,_0xd591be,_0x533995)[_0x1df1('0x39')](function(_0x530583){return _0x1e21a9(_0x530583);});case'agentBusyFactor':var _0x3ab7eb=_0x234177[_0x1df1('0x1b3')]/0x64;return _0x35470f[_0x1df1('0x1cf')](_0x4e0de9,_0x22aa68,_0x365275,_0xd591be,_0x3ab7eb)[_0x1df1('0x39')](function(_0x28b41b){return _0x1e21a9(_0x28b41b);});default:return _0x4fe620(msgResponse(_0x1df1('0x1d0'),'Failure',_0x1df1('0x1d1')));}}else{return _0x4fe620(msgResponse(_0x1df1('0x1d0'),_0x1df1('0x88'),_0x1df1('0x1d2')));}});};};Dialer[_0x1df1('0x16')]['getDataPredictiveOld']=function(_0x5f13e5){var _0x21ba2b=this;return function(_0x658baf){return new Promise(function(_0x20ec60,_0xdf6254){_['merge'](_0x5f13e5,_0x658baf[0x0]);if(checkGetDataPredictive(_0x658baf[0x0])){loggerPredictive[_0x1df1('0x43')](JSON[_0x1df1('0x7a')](_0x658baf[0x0]));if(_0x5f13e5[_0x1df1('0x1be')]===_0x1df1('0x1bf')){return _0x21ba2b[_0x1df1('0x147')](_0x5f13e5['id'])['then'](function(_0xc196b9){var _0x5f5728=_0x5f13e5[_0x1df1('0x1d3')]-_0xc196b9[0x0]['outboundQueuePauses'];var _0xfe936=_0x5f13e5[_0x1df1('0x1bd')]*0x3c;var _0x3de7b5=_0x658baf[0x0][_0x1df1('0x4a')]+_0x658baf[0x0][_0x1df1('0x49')];var _0x4ff84e=(_0x658baf[0x0][_0x1df1('0x1cd')]+_0x658baf[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x658baf[0x0][_0x1df1('0x48')])/_0x658baf[0x0]['predictiveIntervalTotalCalls'];var _0x534866=_0x5f13e5[_0x1df1('0x1b3')]/0x64;_0x5f13e5[_0x1df1('0x1d4')]=_0xc196b9[0x0][_0x1df1('0x1d5')]||0x0;_0x5f13e5['predictiveIntervalHitRate']=_0x4ff84e>0x0?_0x4ff84e:0x1;return _0x21ba2b[_0x1df1('0x1ce')](_0x5f5728,_0xfe936,_0x3de7b5,_0x4ff84e,_0x534866);})['then'](function(_0x1e407b){return _0x20ec60(_0x1e407b);})[_0x1df1('0x97')](function(_0x4d3739){return _0xdf6254(msgResponse('[CatchErlangB]',_0x1df1('0x88'),JSON[_0x1df1('0x7a')](_0x4d3739)));});}if(_0x5f13e5[_0x1df1('0x1be')]===_0x1df1('0x1d6')){return _0x21ba2b[_0x1df1('0x147')](_0x5f13e5['id'])['then'](function(_0x44469f){var _0x1ef101=_0x5f13e5[_0x1df1('0x1d3')]-_0x44469f[0x0][_0x1df1('0x1d5')];var _0x371932=_0x5f13e5[_0x1df1('0x1bd')]*0x3c;var _0x10041b=_0x658baf[0x0][_0x1df1('0x4a')]+_0x658baf[0x0]['predictiveIntervalAvgHoldtime'];var _0x2aa28e=(_0x658baf[0x0][_0x1df1('0x1cd')]+_0x658baf[0x0][_0x1df1('0x47')]+_0x658baf[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x658baf[0x0][_0x1df1('0x46')];var _0x595c29=_0x5f13e5[_0x1df1('0x1b3')]/0x64;_0x5f13e5[_0x1df1('0x1d4')]=_0x44469f[0x0][_0x1df1('0x1d5')]||0x0;_0x5f13e5[_0x1df1('0x1b8')]=_0x2aa28e>0x0?_0x2aa28e:0x1;return _0x21ba2b[_0x1df1('0x1cf')](_0x1ef101,_0x371932,_0x10041b,_0x2aa28e,_0x595c29);})[_0x1df1('0x39')](function(_0x3ba5ea){return _0x20ec60(_0x3ba5ea);})[_0x1df1('0x97')](function(_0x2cd132){return _0xdf6254(msgResponse(_0x1df1('0x1d7'),'Failure',JSON[_0x1df1('0x7a')](_0x2cd132)));});}}else{return _0xdf6254(msgResponse(_0x1df1('0x1d0'),_0x1df1('0x88'),_0x1df1('0x1d2')));}});};};Dialer[_0x1df1('0x16')][_0x1df1('0x1c8')]=function(_0x44d81f){var _0x3005ef=this;return function(){var _0x1ed401=0x0;var _0x1aeeab=Math[_0x1df1('0x1b7')](_0x44d81f['erlangCallToSecond']*0x3e8);if(_0x1aeeab>0x0){_0x1aeeab=_0x1aeeab<0x64?0x64:_0x1aeeab;loggerPredictive[_0x1df1('0x43')](_0x44d81f[_0x1df1('0x40')],'one\x20call\x20every:',_0x1aeeab,'milliseconds');_0x44d81f[_0x1df1('0x5a')]=setInterval(function(){_0x3005ef[_0x1df1('0x5a')](_0x44d81f);loggerPredictiveCalls[_0x1df1('0x43')](_0x1df1('0x1d8'),_0x1ed401+=0x1);},_0x1aeeab);}else{loggerPredictive[_0x1df1('0x43')](_0x44d81f[_0x1df1('0x40')],_0x1df1('0x1d9'));}};};Dialer[_0x1df1('0x16')][_0x1df1('0x1da')]=function(_0x234fab,_0x2eabb6){var _0x4067a6=this;return function(_0x10cfab){if(_[_0x1df1('0x42')](_0x10cfab)){if(_['isNil'](_0x2eabb6['UserId'])||!_0x2eabb6[_0x1df1('0x1db')]){if(_0x234fab['dialMethod']===_0x1df1('0x7')){_0x234fab[_0x1df1('0x69')]=_[_0x1df1('0x4c')](_0x234fab[_0x1df1('0x69')])?!![]:_0x234fab[_0x1df1('0x69')];var _0x531ee8=uuid['v4']();_0x4067a6['actions'][_0x531ee8]=new Action(_0x234fab,_0x2eabb6,_0x531ee8);loggerBooked[_0x1df1('0x43')](_0x1df1('0x1dc'),_0x531ee8,'queueStatusComplete:\x20',JSON['stringify'](_0x234fab[_0x1df1('0x69')]),_0x1df1('0x1dd'),_0x234fab[_0x1df1('0x40')]);if(_0x234fab[_0x1df1('0x69')]){_0x234fab['queueStatusComplete']=![];_0x4067a6[_0x1df1('0x24')][_0x4067a6[_0x1df1('0x20')][_0x531ee8]['queue']]=[];ami[_0x1df1('0x91')]({'actionid':_0x531ee8,'action':_0x1df1('0x1de'),'queue':_0x234fab['name']})[_0x1df1('0x97')](function(){_0x4067a6[_0x1df1('0xf2')](_0x234fab);hopperUtils[_0x1df1('0xcf')]({'active':![],'ContactId':_0x4067a6[_0x1df1('0x20')][_0x531ee8]['ContactId'],'ListId':_0x4067a6['actions'][_0x531ee8][_0x1df1('0xe2')],'VoiceQueueId':_0x4067a6['actions'][_0x531ee8][_0x1df1('0xd2')]||undefined,'CampaignId':_0x4067a6['actions'][_0x531ee8][_0x1df1('0xd3')]||undefined})['catch'](loggerCatch(_0x1df1('0x1df')));delete _0x4067a6[_0x1df1('0x20')][_0x531ee8];});}else{loggerBooked[_0x1df1('0x43')](_0x1df1('0x1e0'),JSON[_0x1df1('0x7a')](_0x234fab['queueStatusComplete']),_0x1df1('0x1dd'),_0x234fab[_0x1df1('0x40')]);_0x4067a6[_0x1df1('0xf2')](_0x234fab);hopperUtils[_0x1df1('0xcf')]({'active':![],'ContactId':_0x4067a6[_0x1df1('0x20')][_0x531ee8]['ContactId'],'ListId':_0x4067a6[_0x1df1('0x20')][_0x531ee8][_0x1df1('0xe2')],'VoiceQueueId':_0x4067a6[_0x1df1('0x20')][_0x531ee8][_0x1df1('0xd2')]||undefined,'CampaignId':_0x4067a6[_0x1df1('0x20')][_0x531ee8][_0x1df1('0xd3')]||undefined})[_0x1df1('0x97')](loggerCatch(_0x1df1('0x1df')));delete _0x4067a6[_0x1df1('0x20')][_0x531ee8];}}else{return _0x4067a6[_0x1df1('0x1e1')](_0x234fab,_0x2eabb6);}}else{if(utils[_0x1df1('0xc2')](undefined,_0x2eabb6['scheduledat'])<_0x234fab[_0x1df1('0x1e2')]*0x3c){if(_0x2eabb6[_0x1df1('0x150')]&&!_0x2eabb6[_0x1df1('0x150')][_0x1df1('0x1e3')]){_0x4067a6['preview'][_0x1df1('0xfa')](_0x2eabb6['id'])['finally'](function(){_0x4067a6['updateOriginated'](_0x234fab);});}else{hopperUtils[_0x1df1('0x1e4')]({'active':![]},_0x2eabb6['id'],0x1)[_0x1df1('0x19')](function(){_0x4067a6[_0x1df1('0xf2')](_0x234fab);});}}else{_0x234fab['outboundReCallsDay']+=0x1;_0x4067a6['updateOriginated'](_0x234fab);if(_0x234fab[_0x1df1('0x1e5')]){hopperUtils[_0x1df1('0xcf')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2eabb6['ContactId'],'ListId':_0x2eabb6[_0x1df1('0xe2')],'VoiceQueueId':_0x2eabb6['VoiceQueueId']||undefined,'CampaignId':_0x2eabb6[_0x1df1('0xd3')]||undefined})[_0x1df1('0x97')](loggerCatch(_0x1df1('0x1e6')));hopperUtils[_0x1df1('0xbf')](createObjHistory(_0x234fab,_0x2eabb6,utils['CAMPAIGN_STATUS']['QUEUE_RECALL'],0x17,_0x1df1('0x1e7')))['catch'](loggerCatch(_0x1df1('0x1e8')));}else{_0x4067a6[_0x1df1('0x10d')](createObjHistory(_0x234fab,_0x2eabb6,utils[_0x1df1('0x61')][_0x1df1('0x1e9')],0x16,'RecallFailedTimeout'),_0x1df1('0x1ea'),_0x1df1('0x1eb'));}}}}else{_0x234fab['outboundBlacklistCallsDay']+=0x1;_0x4067a6[_0x1df1('0x10d')](createObjHistory(_0x234fab,_0x2eabb6,utils['CAMPAIGN_STATUS']['BLACKLIST'],0xd,_0x1df1('0x1ec')),_0x1df1('0x1ed'),_0x1df1('0x1ee'));throw _0x1df1('0x1ef');}};};Dialer[_0x1df1('0x16')][_0x1df1('0x1f0')]=function(_0x167dbc){var _0x5cc37e=this;var _0x2b92ea=_0x167dbc[_0x1df1('0x1f1')]-_0x167dbc[_0x1df1('0x75')];emitCampaignSummary(_0x167dbc);if(_0x2b92ea>0x0&&_0x167dbc[_0x1df1('0x1f2')]==0x0){if(_0x2b92ea>this[_0x1df1('0x1f')]){_0x2b92ea=this[_0x1df1('0x1f')];}_0x167dbc[_0x1df1('0x1f2')]=0x1;hopperUtils[_0x1df1('0x1f3')](_0x167dbc,_0x2b92ea)[_0x1df1('0x39')](function(_0x48469f){_0x167dbc[_0x1df1('0x1f2')]=0x0;if(_0x48469f){if(!utils[_0x1df1('0x1f4')](_0x48469f)){_0x167dbc['message']=utils[_0x1df1('0x61')][_0x1df1('0x64')];logger[_0x1df1('0x43')](_0x1df1('0x1f5')+_0x167dbc[_0x1df1('0x40')]);}else{_0x167dbc[_0x1df1('0x75')]+=_0x48469f[_0x1df1('0xf5')];_0x167dbc[_0x1df1('0x60')]=utils[_0x1df1('0x61')][_0x1df1('0x1f6')];for(var _0x52ce21=0x0;_0x52ce21<_0x48469f[_0x1df1('0xf5')];_0x52ce21+=0x1){_0x167dbc[_0x1df1('0x1f7')]+=0x1;if(_['isNil'](_0x48469f[_0x52ce21])||_[_0x1df1('0xf6')](_0x48469f[_0x52ce21][_0x1df1('0x1f8')])||_['isNil'](_0x48469f[_0x52ce21]['phone'])){_0x5cc37e[_0x1df1('0x14b')]('[actionOriginate]\x20',_0x167dbc,_0x48469f[_0x52ce21]);}else{hopperUtils[_0x1df1('0x1f9')](_['pick'](_0x48469f[_0x52ce21],['CampaignId',_0x1df1('0x179')]))[_0x1df1('0x39')](_0x5cc37e[_0x1df1('0x1da')](_0x167dbc,_0x48469f[_0x52ce21]))[_0x1df1('0x97')](_0x5cc37e[_0x1df1('0x14a')]('[actionOriginateIvr]\x20',_0x167dbc));}}}}})[_0x1df1('0x97')](loggerGetContactDialer(_0x1df1('0x1fa'),_0x167dbc,_0x2b92ea));}};Dialer['prototype'][_0x1df1('0xa9')]=function(_0x197115,_0x142d93){var _0x115e22=this;var _0x38e83b=[];if(_0x142d93<0x1||_0x197115['dialMethod']===_0x1df1('0x7')){_0x142d93=0x1;}var _0x3b9f4b=Math[_0x1df1('0x1b7')](_0x197115[_0x1df1('0x131')]*_0x142d93)-_0x197115['originated'];if(_0x197115[_0x1df1('0x1fb')]>0x0){var _0x170724=_0x197115[_0x1df1('0x1fb')]-_0x197115[_0x1df1('0x75')]-_0x197115[_0x1df1('0x133')]-_0x197115[_0x1df1('0x134')];if(_0x3b9f4b>_0x170724){_0x3b9f4b=_0x170724;}}if(_0x3b9f4b>0x0&&_0x197115['temp']==0x0){if(_0x197115[_0x1df1('0xa8')]===_0x1df1('0x7')){_0x3b9f4b=0x1;}if(_0x3b9f4b>this[_0x1df1('0x1f')]){_0x3b9f4b=this[_0x1df1('0x1f')];}for(var _0x7fdf88 in this[_0x1df1('0x1d')]){if(typeof this[_0x1df1('0x1d')][_0x7fdf88]!==_0x1df1('0xa0')){if(this[_0x1df1('0x1d')][_0x7fdf88]['state']===_0x1df1('0x1fc')&&this[_0x1df1('0x1d')][_0x7fdf88][_0x1df1('0x7e')]==='reachable'){_0x38e83b[_0x1df1('0x90')](this[_0x1df1('0x1d')][_0x7fdf88]['id']);}}}_0x197115[_0x1df1('0x1f2')]=0x1;hopperUtils[_0x1df1('0x1fd')](_0x197115,_0x38e83b,_0x3b9f4b)[_0x1df1('0x39')](function(_0xa9f7e3){_0x197115[_0x1df1('0x1f2')]=0x0;if(_0xa9f7e3){if(!utils['checkContactEmpty'](_0xa9f7e3)){hopperUtils[_0x1df1('0x1fe')](_0x197115)[_0x1df1('0x39')](sendMessageReschedule(_0x197115))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x197115[_0x1df1('0x75')]+=_0xa9f7e3[_0x1df1('0xf5')];_0x197115[_0x1df1('0x60')]=_0x197115[_0x1df1('0xa8')]==='booked'?utils[_0x1df1('0x61')][_0x1df1('0x1ff')]:utils['CAMPAIGN_STATUS'][_0x1df1('0x1f6')];for(var _0x6b933b=0x0;_0x6b933b<_0xa9f7e3[_0x1df1('0xf5')];_0x6b933b+=0x1){if(_['isNil'](_0xa9f7e3[_0x6b933b])||_[_0x1df1('0xf6')](_0xa9f7e3[_0x6b933b][_0x1df1('0x1f8')])||_['isNil'](_0xa9f7e3[_0x6b933b][_0x1df1('0x179')])){_0x115e22[_0x1df1('0x14b')](_0x1df1('0x200'),_0x197115,_0xa9f7e3[_0x6b933b]);}else{hopperUtils[_0x1df1('0x201')](_[_0x1df1('0xee')](_0xa9f7e3[_0x6b933b],[_0x1df1('0xd2'),'phone']))[_0x1df1('0x39')](_0x115e22['checkContactBlack'](_0x197115,_0xa9f7e3[_0x6b933b]))['catch'](_0x115e22[_0x1df1('0x14a')](_0x1df1('0x200'),_0x197115));}}}}})[_0x1df1('0x97')](loggerGetContactDialer(_0x1df1('0x202'),_0x197115,_0x3b9f4b));}};Dialer['prototype'][_0x1df1('0x5a')]=function(_0x44f3bc){if(_0x44f3bc[_0x1df1('0x1fb')]>0x0){var _0x3d869c=_0x44f3bc[_0x1df1('0x1fb')]-_0x44f3bc[_0x1df1('0x75')]-_0x44f3bc['talking'];if(_0x3d869c>0x0&&_0x44f3bc['temp']==0x0){this[_0x1df1('0x203')](_0x44f3bc);}else{loggerPredictiveCalls[_0x1df1('0x43')](_0x1df1('0x204'));}}else{this[_0x1df1('0x203')](_0x44f3bc);}};Dialer['prototype'][_0x1df1('0x203')]=function(_0x3093eb){var _0x3ecce5=this;var _0x5b5b73=[];_0x3093eb[_0x1df1('0x75')]+=0x1;for(var _0x982984 in this[_0x1df1('0x1d')]){if(typeof this['agents'][_0x982984]!==_0x1df1('0xa0')){if(this[_0x1df1('0x1d')][_0x982984][_0x1df1('0x66')]==='not_inuse'&&this[_0x1df1('0x1d')][_0x982984][_0x1df1('0x7e')]===_0x1df1('0x7c')){_0x5b5b73['push'](this['agents'][_0x982984]['id']);}}}_0x3093eb[_0x1df1('0x1f2')]=0x1;return this[_0x1df1('0x1fd')](_0x3093eb['id'],_0x5b5b73,0x1,_0x3093eb[_0x1df1('0x205')],_0x3093eb)[_0x1df1('0x39')](function(_0x1c80a9){_0x3093eb[_0x1df1('0x1f2')]=0x1;if(_0x1c80a9){if(!utils['checkContactEmpty'](_0x1c80a9)){utils[_0x1df1('0x5e')](_0x3093eb,0x1,0x0);return hopperUtils[_0x1df1('0x1fe')](_0x3093eb)['then'](sendMessageReschedule(_0x3093eb))[_0x1df1('0x97')](loggerCatch('[countReScheduled]\x20'));}else{_0x3093eb[_0x1df1('0x60')]=utils[_0x1df1('0x61')][_0x1df1('0x1f6')];if(_['isNil'](_0x1c80a9[0x0])||_['isNil'](_0x1c80a9[0x0][_0x1df1('0x1f8')])||_[_0x1df1('0xf6')](_0x1c80a9[0x0]['phone'])){_0x3ecce5[_0x1df1('0x14b')](_0x1df1('0x200'),_0x3093eb,_0x1c80a9[0x0]);}else{return hopperUtils[_0x1df1('0x201')](_['pick'](_0x1c80a9[0x0],[_0x1df1('0xd2'),_0x1df1('0x179')]))[_0x1df1('0x39')](_0x3ecce5[_0x1df1('0x1da')](_0x3093eb,_0x1c80a9[0x0]))[_0x1df1('0x97')](_0x3ecce5[_0x1df1('0x14a')](_0x1df1('0x206'),_0x3093eb));}}}})[_0x1df1('0x97')](loggerGetContactDialer(_0x1df1('0x207'),_0x3093eb,0x1));};Dialer[_0x1df1('0x16')][_0x1df1('0x1ce')]=function(_0x395d9c,_0x28fabf,_0x57fb28,_0x4fb72b,_0x1aacd8,_0x2ed825){loggerPredictive[_0x1df1('0x43')](_0x1df1('0x208'));loggerPredictive[_0x1df1('0x43')](_0x1df1('0x209'),_0x395d9c);loggerPredictive[_0x1df1('0x43')](_0x1df1('0x20a'),_0x28fabf);loggerPredictive[_0x1df1('0x43')](_0x1df1('0x20b'),_0x57fb28);loggerPredictive[_0x1df1('0x43')](_0x1df1('0x20c'),_0x4fb72b);loggerPredictive[_0x1df1('0x43')](_0x1df1('0x20d'),_0x1aacd8);loggerPredictive[_0x1df1('0x43')]('---------------------------');return new Promise(function(_0x55b829,_0x5fb20c){if(_0x395d9c<=0x0||isNaN(_0x395d9c)){return _0x5fb20c(msgResponse(_0x1df1('0x20e'),'Error',_0x1df1('0x20f')+_0x395d9c));}if(_0x57fb28<=0x0||isNaN(_0x57fb28)){return _0x5fb20c(msgResponse(_0x1df1('0x20e'),_0x1df1('0xb3'),_0x1df1('0x210')+_0x57fb28));}if(_0x4fb72b<=0x0||isNaN(_0x4fb72b)){return _0x5fb20c(msgResponse(_0x1df1('0x20e'),_0x1df1('0xb3'),_0x1df1('0x211')+_0x4fb72b));}if(_0x28fabf<=0x0||isNaN(_0x28fabf)){return _0x5fb20c(msgResponse(_0x1df1('0x20e'),_0x1df1('0xb3'),_0x1df1('0x212')+_0x28fabf));}if(_0x1aacd8<=0x0||isNaN(_0x1aacd8)){return _0x5fb20c(msgResponse('[abandonmentRate]',_0x1df1('0xb3'),_0x1df1('0x213')+_0x1aacd8));}_0x2ed825=_0x2ed825||0x0;var _0x2454a6=0x1/_0x57fb28;var _0x3bb280=0x0;var _0x572698=0x0;var _0x55d81f=0x0;var _0x1c401b=0x0;for(var _0x352913=0x0;_0x55d81f<_0x1aacd8;_0x352913+=0x1){_0x572698=_0x352913/_0x28fabf;_0x3bb280=(_0x4fb72b*_0x572698+_0x2ed825)/_0x2454a6;_0x55d81f=utils[_0x1df1('0x214')](_0x3bb280,_0x395d9c);_0x1c401b=_0x3bb280/_0x395d9c*(0x1-utils[_0x1df1('0x214')](_0x3bb280,_0x395d9c));}return _0x55b829({'erlangCalls':_0x352913,'erlangCallToSecond':_0x28fabf/_0x352913,'erlangAbandonmentRate':_0x55d81f,'erlangBusyFactor':_0x1c401b});});};Dialer[_0x1df1('0x16')][_0x1df1('0x1cf')]=function(_0x5c0123,_0x2b4f42,_0x18db7c,_0x5b5fdc,_0x20399e,_0x456437){loggerPredictive[_0x1df1('0x43')](_0x1df1('0x215'));loggerPredictive['info'](_0x1df1('0x209'),_0x5c0123);loggerPredictive['info'](_0x1df1('0x20a'),_0x2b4f42);loggerPredictive[_0x1df1('0x43')](_0x1df1('0x20b'),_0x18db7c);loggerPredictive[_0x1df1('0x43')]('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',_0x5b5fdc);loggerPredictive[_0x1df1('0x43')](_0x1df1('0x216'),_0x20399e);loggerPredictive[_0x1df1('0x43')]('---------------------------');return new Promise(function(_0x31a876,_0xfe545e){if(_0x5c0123<=0x0||isNaN(_0x5c0123)){return _0xfe545e(msgResponse(_0x1df1('0x217'),_0x1df1('0xb3'),_0x1df1('0x20f')+_0x5c0123));}if(_0x18db7c<=0x0||isNaN(_0x18db7c)){return _0xfe545e(msgResponse(_0x1df1('0x217'),_0x1df1('0xb3'),_0x1df1('0x210')+_0x18db7c));}if(_0x5b5fdc<=0x0||isNaN(_0x5b5fdc)){return _0xfe545e(msgResponse(_0x1df1('0x217'),_0x1df1('0xb3'),_0x1df1('0x211')+_0x5b5fdc));}if(_0x2b4f42<=0x0||isNaN(_0x2b4f42)){return _0xfe545e(msgResponse('[busyFactor]',_0x1df1('0xb3'),_0x1df1('0x212')+_0x2b4f42));}if(_0x20399e<=0x0||isNaN(_0x20399e)){return _0xfe545e(msgResponse(_0x1df1('0x217'),_0x1df1('0xb3'),_0x1df1('0x218')+_0x20399e));}_0x456437=_0x456437||0x0;var _0x3d261e=0x1/_0x18db7c;var _0x463a36=0x0;var _0x2bda4c=0x0;var _0x4be49e=0x0;var _0x383824=0x0;for(var _0x3a285d=0x0;_0x383824<_0x20399e;_0x3a285d+=0x1){_0x2bda4c=_0x3a285d/_0x2b4f42;_0x463a36=(_0x5b5fdc*_0x2bda4c+_0x456437)/_0x3d261e;_0x4be49e=utils['erlangb'](_0x463a36,_0x5c0123);_0x383824=_0x463a36/_0x5c0123*(0x1-utils['erlangb'](_0x463a36,_0x5c0123));}return _0x31a876({'erlangCalls':_0x3a285d,'erlangCallToSecond':_0x2b4f42/_0x3a285d,'erlangAbandonmentRate':_0x4be49e,'erlangBusyFactor':_0x383824});});};module['exports']=Dialer; \ No newline at end of file +var _0xc092=['run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','pick','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','exten','xcally-motion-dialer','value','HANGUP','membername','AMD','buildObj','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','outboundAnswerAgiCallsDay','Machine','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','custom:amd','countagentrejectretry','reason\x2019\x20machine....','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','cause-txt','Normal\x20Clearing','outboundUnknownCallsDay','running','getQueueCampaignStatusMessage','statusMessage','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','filter','dialPreviewRecallmeReminder','online','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','No\x20such\x20channel','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','Agent','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','isOutboundQueue','XMD-VOICEQUEUEID','Contact','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','TrunkBackup','XMD-ORIGINATECALLERIDNAME','extractCalleridName','variables','trim','dialCutDigit','substring','SIP/%s/%s%s','dialPrefix','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','nosuchnumber','[syncAgentComplete][createHistory][0]','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalMaxThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','Max\x20Drop\x20','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','predictiveIntervalAvailable','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','dialPredictiveOptimization','loggedIn','predictiveIntervalPauses','outboundQueuePauses','[CatchErlangB]','busyFactor','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','temp','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','maxNumberOriginate','not_inuse','getContactDialer','checkContactEmpty','countReScheduled','[countReScheduled]\x20','checkContactBlack','[getContactDialer2]','dialLimitQueue','[handlePredictive][limitChannel]','tryOriginatePredictive','checkIsBlackList','[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','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','p\x20=\x20','interval\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','erlangb','exports','util','lodash','uuid','./utils','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','./models/action','./models/history','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','tail','finally','sequence','preview','voiceQueues','campaigns','agents','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','inspect','format','voice:queue:%s','name','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','NO_AVAILABLE_CONTACTS','endtime','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','stringify','Interval','NULL_INTERVAL','Intervals','\x20INTERVAL_IS_NULL','isEmpty','isIVRCampaignActive','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','prototype','isTrunkReachable','active','trunks','SIP/%s','status','reachable','checkIsTrunkReachable','Trunk','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','Action','interval','then','content','indexOf','true','push','command','iftime\x20%s,%s','catch','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','isGlobal','AMI\x20IfTime','uniqueid','ivr','queue','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','updateOriginated','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','dropreason','countdropretry','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','additional','queueCallerAbandonCreateState','rescheduleContact','ContactId','ListId','VoiceQueueId','[rescheduleContact][Drop]','state','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','countglobal','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','add','minutes','CampaignId','[syncAgentComplete][createHistory][11]','channel','syncQueueMember','actionid','strategy','rrmemory','isNil','locked','paused','stateinterface','idHopper','roundrobin'];(function(_0x191154,_0x56f74c){var _0x3dcd73=function(_0x51c321){while(--_0x51c321){_0x191154['push'](_0x191154['shift']());}};_0x3dcd73(++_0x56f74c);}(_0xc092,0x122));var _0x2c09=function(_0x3b9558,_0x7ca311){_0x3b9558=_0x3b9558-0x0;var _0x3df7e8=_0xc092[_0x3b9558];return _0x3df7e8;};'use strict';var util=require(_0x2c09('0x0'));var _=require(_0x2c09('0x1'));var uuid=require(_0x2c09('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x2c09('0x3'));var hopperUtils=require('./utils/hopper');var ut=require(_0x2c09('0x4'));var config=require(_0x2c09('0x5'));var logger=require(_0x2c09('0x6'))('dialer');var loggerBooked=require(_0x2c09('0x6'))(_0x2c09('0x7'));var loggerPredictive=require(_0x2c09('0x6'))(_0x2c09('0x8'));var loggerPredictiveCalls=require(_0x2c09('0x6'))(_0x2c09('0x9'));var loggerSyncQueueSummary=require(_0x2c09('0x6'))(_0x2c09('0xa'));var ami=require(_0x2c09('0xb'));config['redis']=_[_0x2c09('0xc')](config[_0x2c09('0xd')],{'host':_0x2c09('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2c09('0xd')]));var cmHopper=require(_0x2c09('0xf'));var voiceQueueRt=require(_0x2c09('0x10'));var RpcSetting=require(_0x2c09('0x11'));var Interval=require('../rpc/interval');var Action=require(_0x2c09('0x12'));var History=require(_0x2c09('0x13'));var Final=require('./models/final');var AgentComplete=require(_0x2c09('0x14'));var QueueCallerAbandon=require(_0x2c09('0x15'));var Hangup=require(_0x2c09('0x16'));var ipAgi=process[_0x2c09('0x17')][_0x2c09('0x18')]||_0x2c09('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x1e8e3f){this[_0x2c09('0x1a')]=this[_0x2c09('0x1a')]?this[_0x2c09('0x1a')][_0x2c09('0x1b')](_0x1e8e3f):_0x1e8e3f();};function Dialer(_0x14e032,_0x27ccf4){this[_0x2c09('0x1c')]=new Sequence();this[_0x2c09('0x1d')]=_0x27ccf4;this[_0x2c09('0x1e')]=_0x14e032[_0x2c09('0x1e')];this[_0x2c09('0x1f')]=_0x14e032['campaigns'];this[_0x2c09('0x20')]=_0x14e032['agents'];this['trunks']=_0x14e032['trunks'];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this[_0x2c09('0x21')]={};this[_0x2c09('0x22')]={};this['contactsId']={};this[_0x2c09('0x23')]={};this[_0x2c09('0x24')]={};this[_0x2c09('0x25')]={};this[_0x2c09('0x26')]={};this['ivrOriginated']={};this[_0x2c09('0x27')]={};this[_0x2c09('0x28')]={};this[_0x2c09('0x29')]={};ami['on'](_0x2c09('0x2a'),this[_0x2c09('0x2b')]['bind'](this));ami['on'](_0x2c09('0x2c'),this[_0x2c09('0x2d')][_0x2c09('0x2e')](this));ami['on'](_0x2c09('0x2f'),this[_0x2c09('0x30')][_0x2c09('0x2e')](this));ami['on'](_0x2c09('0x31'),this[_0x2c09('0x32')][_0x2c09('0x2e')](this));ami['on']('custom:queuesummary',this[_0x2c09('0xa')][_0x2c09('0x2e')](this));ami['on'](_0x2c09('0x33'),this[_0x2c09('0x34')][_0x2c09('0x2e')](this));ami['on'](_0x2c09('0x35'),this[_0x2c09('0x36')][_0x2c09('0x2e')](this));ami['on'](_0x2c09('0x37'),this[_0x2c09('0x38')][_0x2c09('0x2e')](this));ami['on']('varset',this[_0x2c09('0x39')][_0x2c09('0x2e')](this));ami['on'](_0x2c09('0x3a'),this['syncQueueMember'][_0x2c09('0x2e')](this));ami['on']('queuestatuscomplete',this[_0x2c09('0x3b')][_0x2c09('0x2e')](this));this[_0x2c09('0x3c')]();this[_0x2c09('0x3d')]();RpcSetting['getSettings']()['then'](function(_0x3f0226){previewRecallmeReminderInterval=_0x3f0226[_0x2c09('0x3e')];});}function isNotNull(_0x526524){return _0x526524!==null&&!_[_0x2c09('0x3f')](_0x526524);}function msgResponse(_0x313509,_0x28ac3a,_0xfdd8b0){return{'action':_0x313509,'response':_0x28ac3a,'message':_0xfdd8b0,'stack':_0xfdd8b0};}function emit(_0x1950b7,_0xfab2fe,_0x24139c){io['to'](_0x1950b7)[_0x2c09('0x40')](_0xfab2fe,_0x24139c);}function emitOutboundVoiceQueueSummary(_0x212774){if(_0x212774[_0x2c09('0x41')]===_0x2c09('0x42')){logger[_0x2c09('0x43')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x2c09('0x44')](_0x212774,{'showHidden':![],'depth':null}));emit(util[_0x2c09('0x45')](_0x2c09('0x46'),_0x212774[_0x2c09('0x47')]),_0x2c09('0x48'),_0x212774);}}function checkGetDataPredictive(_0x43ea01){if(isNotNull(_0x43ea01)&&!_['isEmpty'](_0x43ea01)){loggerPredictive[_0x2c09('0x49')](_0x2c09('0x4a'));loggerPredictive[_0x2c09('0x49')](_0x2c09('0x4b'),_0x43ea01[_0x2c09('0x4c')]);loggerPredictive['info'](_0x2c09('0x4d'),_0x43ea01[_0x2c09('0x4e')]);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x4f'),_0x43ea01[_0x2c09('0x50')]);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x51'),_0x43ea01[_0x2c09('0x52')]);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x53'),_0x43ea01[_0x2c09('0x54')]);loggerPredictive[_0x2c09('0x49')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x43ea01[_0x2c09('0x55')]);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x56'));if(_0x43ea01['predictiveIntervalTotalCalls']>0x0){if(!_[_0x2c09('0x3f')](_0x43ea01[_0x2c09('0x55')])&&_0x43ea01['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x2c09('0x49')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x2c09('0x3f')](_0x43ea01[_0x2c09('0x54')])&&_0x43ea01[_0x2c09('0x54')]>0x0){return!![];}loggerPredictive[_0x2c09('0x49')](_0x2c09('0x57'));}else{loggerPredictive[_0x2c09('0x49')](_0x2c09('0x58'));}}else{loggerPredictive[_0x2c09('0x49')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x5ca757){return function(_0x38be36){loggerPredictive[_0x2c09('0x49')](_0x2c09('0x59'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x38be36[_0x2c09('0x5a')]);loggerPredictive['info'](_0x2c09('0x5b'),_0x38be36[_0x2c09('0x5c')]);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x5d'),_0x38be36[_0x2c09('0x5e')]);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x5f'),_0x38be36['erlangBusyFactor']);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x5d'),_0x38be36[_0x2c09('0x5e')]);loggerPredictive[_0x2c09('0x49')]('---------------------------');_[_0x2c09('0x60')](_0x5ca757,_0x38be36);};}function ifInterval(_0x5dd50f,_0x2637b6){if(_['isUndefined'](_0x2637b6)){return![];}return utils[_0x2c09('0x61')](undefined,_0x2637b6)<_0x5dd50f*0x3c;}function clearPredictiveAttributes(_0x5ad14d){if(_0x5ad14d[_0x2c09('0x26')]){_0x5ad14d['startProgressive']=undefined;loggerPredictive[_0x2c09('0x43')](_0x5ad14d[_0x2c09('0x47')],'startProgressive\x20value\x20cleared');}if(_0x5ad14d[_0x2c09('0x25')]){_0x5ad14d[_0x2c09('0x25')]=undefined;loggerPredictive['debug'](_0x5ad14d[_0x2c09('0x47')],_0x2c09('0x62'));}if(_0x5ad14d[_0x2c09('0x63')]){clearInterval(_0x5ad14d[_0x2c09('0x63')]);_0x5ad14d[_0x2c09('0x63')]=undefined;loggerPredictive[_0x2c09('0x43')](_0x5ad14d[_0x2c09('0x47')],_0x2c09('0x64'));}}function loggerCatchPredictive(_0x29079c,_0x4c907e){return function(_0x5cece8){loggerPredictive[_0x2c09('0x65')](_0x4c907e[_0x2c09('0x47')],_0x29079c);loggerPredictive[_0x2c09('0x65')](_0x5cece8[_0x2c09('0x66')]);clearPredictiveAttributes(_0x4c907e);};}function loggerCatch(_0x57a630){return function(_0x379276){logger[_0x2c09('0x65')](_0x57a630,util[_0x2c09('0x44')](_0x379276,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4f8d0c,_0x1011f4,_0x49bbc5){return function(_0x471c99){utils[_0x2c09('0x67')](_0x1011f4,_0x49bbc5,0x0);_0x1011f4['temp']=0x0;logger[_0x2c09('0x65')](_0x4f8d0c,util[_0x2c09('0x44')](_0x471c99,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2de3f7){return function(_0x23706c){if(isNotNull(_0x23706c)&&isNotNull(_0x23706c[0x0])){if(_0x23706c[0x0][_0x2c09('0x68')]>0x0){_0x2de3f7[_0x2c09('0x69')]=utils[_0x2c09('0x6a')]['CONTACTS_RESCHEDULED'];logger['info'](_0x2c09('0x6b')+_0x2de3f7[_0x2c09('0x47')],_0x23706c[0x0][_0x2c09('0x68')],'contacts');}else{_0x2de3f7[_0x2c09('0x69')]=utils[_0x2c09('0x6a')][_0x2c09('0x6c')];logger['info']('[getContactDialer2][Empty]'+_0x2de3f7[_0x2c09('0x47')]);}}};}function createObjHistory(_0x1baae3,_0x2b7a65,_0x3d9fa4,_0x284ee9,_0x5d77e4){_0x1baae3[_0x2c09('0x69')]=_0x3d9fa4;var _0x580bf4=new Action(_0x1baae3,_0x2b7a65);var _0x1a05cd=new History(_0x580bf4);_0x1a05cd['state']=_0x284ee9;_0x1a05cd['statedesc']=_0x5d77e4;_0x1a05cd[_0x2c09('0x6d')]=_0x580bf4['starttime'];return _0x1a05cd;}function unlockQueueStatus(_0x4993c8,_0x269bbf){setTimeout(function(){if(_[_0x2c09('0x3f')](_0x4993c8['queueStatusComplete'])){loggerBooked['error'](_0x2c09('0x6e'),_0x269bbf);}_0x4993c8[_0x2c09('0x6f')]=!![];loggerBooked[_0x2c09('0x49')](_0x2c09('0x70'),_0x269bbf,JSON[_0x2c09('0x71')](_['pick'](_0x4993c8,['name',_0x2c09('0x6f')])));},0x1f3);}function checkInterval(_0x32d767){return function(){if(!isNotNull(_0x32d767[_0x2c09('0x72')])){_0x32d767[_0x2c09('0x69')]=utils[_0x2c09('0x6a')][_0x2c09('0x73')];throw _0x32d767[_0x2c09('0x47')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x32d767[_0x2c09('0x72')][_0x2c09('0x74')])){_0x32d767[_0x2c09('0x69')]=utils[_0x2c09('0x6a')][_0x2c09('0x73')];throw _0x32d767[_0x2c09('0x47')]+_0x2c09('0x75');}if(!isNotNull(_[_0x2c09('0x76')](_0x32d767[_0x2c09('0x72')][_0x2c09('0x74')]))){_0x32d767[_0x2c09('0x69')]=utils['CAMPAIGN_STATUS'][_0x2c09('0x73')];throw _0x32d767[_0x2c09('0x47')]+_0x2c09('0x75');}};}function checkIsIVRCampaignActive(_0x5c17e9){return function(){if(!utils[_0x2c09('0x77')](_0x5c17e9)){_0x5c17e9[_0x2c09('0x69')]=utils[_0x2c09('0x6a')]['INACTIVE'];throw _0x5c17e9[_0x2c09('0x47')]+_0x2c09('0x78');}};}function emitCampaignSummary(_0x420c79){if(utils[_0x2c09('0x79')](_0x420c79)){emit(util['format'](_0x2c09('0x7a'),_0x420c79[_0x2c09('0x47')]),_0x2c09('0x7b'),_0x420c79);}}function loggerCatchQueueSummary(_0x2d15c0,_0x4437ab){return function(_0x2da3ab){clearPredictiveAttributes(_0x4437ab);emitCampaignSummary(_0x4437ab);loggerSyncQueueSummary[_0x2c09('0x43')](_0x2d15c0,util[_0x2c09('0x44')](_0x2da3ab,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x57842d){if(_0x57842d[_0x2c09('0x7c')]){if(_0x57842d[_0x2c09('0x7d')]===0x0){_0x57842d[_0x2c09('0x7c')]=![];_0x57842d[_0x2c09('0x69')]=utils[_0x2c09('0x6a')][_0x2c09('0x7e')];loggerSyncQueueSummary['debug'](_0x2c09('0x7f'),_0x57842d[_0x2c09('0x47')],_0x2c09('0x80'));}else{_0x57842d[_0x2c09('0x69')]=utils['CAMPAIGN_STATUS'][_0x2c09('0x81')];loggerSyncQueueSummary[_0x2c09('0x43')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x57842d[_0x2c09('0x47')],_0x2c09('0x82'));}emitCampaignSummary(_0x57842d);}}function myreject(_0x1376a6){return function(_0x3c4dbf){return _0x1376a6(msgResponse(_0x2c09('0x83'),_0x2c09('0x84'),JSON[_0x2c09('0x71')](_0x3c4dbf)));};}Dialer[_0x2c09('0x85')][_0x2c09('0x86')]=function(_0xf230f3){return!_[_0x2c09('0x3f')](_0xf230f3)&&_0xf230f3&&!_['isUndefined'](_0xf230f3[_0x2c09('0x47')])&&!_[_0x2c09('0x3f')](_0xf230f3[_0x2c09('0x87')])&&_0xf230f3[_0x2c09('0x87')]&&(this[_0x2c09('0x88')][util[_0x2c09('0x45')](_0x2c09('0x89'),_0xf230f3['name'])][_0x2c09('0x8a')]===_0x2c09('0x8b')||this[_0x2c09('0x88')][util[_0x2c09('0x45')]('SIP/%s',_0xf230f3[_0x2c09('0x47')])][_0x2c09('0x8a')]==='unmonitored');};Dialer[_0x2c09('0x85')][_0x2c09('0x8c')]=function(_0x55cc0e){var _0xad0ab6=this;return function(){if(!_0xad0ab6[_0x2c09('0x86')](_0x55cc0e[_0x2c09('0x8d')])){if(!_0xad0ab6[_0x2c09('0x86')](_0x55cc0e['TrunkBackup'])){_0x55cc0e['message']=utils['CAMPAIGN_STATUS']['TRUNK_NOT_REACHABLE'];throw _0x55cc0e[_0x2c09('0x47')]+_0x2c09('0x8e');}}};};Dialer[_0x2c09('0x85')][_0x2c09('0x8f')]=function(_0x51f462,_0x2fd4a3,_0x114e91,_0x18ed5d){var _0xbe34bd=this;return function(){var _0xe41312=!![];return _0xbe34bd['ifTimeIvr'](_0x51f462,_0x2fd4a3,_0x114e91,_0x18ed5d,_0xe41312);};};Dialer['prototype'][_0x2c09('0x90')]=function(_0xc0aaa6,_0x4e6066,_0x568eeb,_0x195004){var _0x1d3d83=this;return function(){var _0x3f3b88=![];return _0x1d3d83[_0x2c09('0x91')](_0xc0aaa6[_0x2c09('0x74')],_0x4e6066,_0x568eeb,_0x195004,_0x3f3b88);};};Dialer['prototype'][_0x2c09('0x91')]=function(_0x5e4bf0,_0x971b42,_0x201767,_0x5cf094,_0x268b44){var _0x40300a=[];return new Promise(function(_0x472b5b,_0x5f50ab){if(!isNotNull(_0x5e4bf0)){_0x5cf094[_0x2c09('0x69')]=utils[_0x2c09('0x6a')][_0x2c09('0x73')];return _0x5f50ab(msgResponse(_0x2c09('0x92'),_0x2c09('0x93'),_0x201767+_0x2c09('0x94')));}if(_[_0x2c09('0x76')](_0x5e4bf0)){_0x5cf094['message']=utils[_0x2c09('0x6a')][_0x2c09('0x95')];return _0x5f50ab(msgResponse(_0x2c09('0x92'),_0x2c09('0x93'),_0x201767+_0x2c09('0x96')));}if(_0x971b42&&_[_0x2c09('0x3f')](config[_0x2c09('0x97')][_0x971b42])){_0x5cf094[_0x2c09('0x69')]=utils[_0x2c09('0x6a')][_0x2c09('0x98')];return _0x5f50ab(msgResponse(_0x2c09('0x92'),_0x2c09('0x93'),_0x201767+_0x2c09('0x99')+_0x971b42));}if(_[_0x2c09('0x9a')](_0x5e4bf0)){for(var _0x1a760a=0x0;_0x1a760a<_0x5e4bf0['length'];_0x1a760a+=0x1){_0x40300a['push'](ami[_0x2c09('0x9b')]({'action':'command','command':util[_0x2c09('0x45')]('iftime\x20%s,%s',_0x5e4bf0[_0x1a760a][_0x2c09('0x9c')],!_[_0x2c09('0x3f')](config[_0x2c09('0x97')][_0x971b42])?_0x971b42:'')})[_0x2c09('0x9d')](function(_0x21009c){return _0x21009c[_0x2c09('0x9e')][_0x2c09('0x9f')](_0x2c09('0xa0'))>=0x0;})['catch'](myreject(_0x5f50ab)));}}else{_0x40300a[_0x2c09('0xa1')](ami[_0x2c09('0x9b')]({'action':_0x2c09('0xa2'),'command':util[_0x2c09('0x45')](_0x2c09('0xa3'),_0x5e4bf0,!_[_0x2c09('0x3f')](config['timezones'][_0x971b42])?_0x971b42:'')})[_0x2c09('0x9d')](function(_0x340e74){return _0x340e74[_0x2c09('0x9e')]['indexOf'](_0x2c09('0xa0'))>=0x0;})[_0x2c09('0xa4')](myreject(_0x5f50ab)));}Promise[_0x2c09('0xa5')](_0x40300a)[_0x2c09('0x9d')](function(_0x367af8){var _0x1e5500=_['some'](_0x367af8);if(_0x1e5500){return _0x472b5b(_0x1e5500);}else{_0x5cf094[_0x2c09('0x69')]=_0x268b44?utils[_0x2c09('0x6a')][_0x2c09('0xa6')]:utils[_0x2c09('0x6a')][_0x2c09('0xa7')];return _0x5f50ab(msgResponse(_0x2c09('0xa8'),_0x2c09('0x93'),_0x2c09('0xa9')+_0x268b44+'\x20'+_0x201767+_0x2c09('0xaa')+util[_0x2c09('0x44')](_0x5e4bf0,{'showHidden':![],'depth':null})+_0x2c09('0xab')+_0x971b42));}})[_0x2c09('0xa4')](function(_0x6b8d08){return _0x5f50ab(msgResponse('ifTime',_0x2c09('0x93'),JSON[_0x2c09('0x71')](_0x6b8d08)));});});};Dialer[_0x2c09('0x85')][_0x2c09('0x3c')]=function(){var _0x55cfa5=this;return cmHopper[_0x2c09('0xac')]({'active':![]},{'where':{'active':!![]}})[_0x2c09('0x9d')](function(){setInterval(function(){_0x55cfa5[_0x2c09('0xad')]();},0x3e8);});};Dialer[_0x2c09('0x85')][_0x2c09('0xad')]=function(){var _0x26425c=this;var _0x4f0533;for(var _0x3965fd in this[_0x2c09('0x1f')]){if(typeof this['campaigns'][_0x3965fd]!==_0x2c09('0xae')){_0x4f0533=this[_0x2c09('0x1f')][_0x3965fd];if(utils[_0x2c09('0x79')](_0x4f0533)&&utils[_0x2c09('0x77')](_0x4f0533)){_0x4f0533[_0x2c09('0x7c')]=!![];Promise[_0x2c09('0xaf')]()[_0x2c09('0x9d')](checkIsIVRCampaignActive(_0x4f0533))['then'](checkInterval(_0x4f0533))[_0x2c09('0x9d')](_0x26425c[_0x2c09('0x8c')](_0x4f0533))['then'](_0x26425c[_0x2c09('0x8f')](_0x4f0533[_0x2c09('0xb0')],_0x4f0533[_0x2c09('0xb1')],_0x4f0533[_0x2c09('0x47')],_0x4f0533))['then'](_0x26425c[_0x2c09('0x90')](_0x4f0533[_0x2c09('0x72')],_0x4f0533[_0x2c09('0xb1')],_0x4f0533[_0x2c09('0x47')],_0x4f0533))[_0x2c09('0x9d')](_0x26425c[_0x2c09('0xb2')](_0x4f0533))['catch'](loggerCatchQueueSummary(_0x2c09('0xb3'),_0x4f0533));}else{notSendMessagesCampaign(_0x4f0533);}}}};Dialer[_0x2c09('0x85')][_0x2c09('0xb4')]=function(_0x1f52bc){if(_0x1f52bc[_0x2c09('0xb5')]!==_0x2c09('0x8')){clearPredictiveAttributes(_0x1f52bc);}switch(_0x1f52bc[_0x2c09('0xb5')]){case _0x2c09('0xb6'):this[_0x2c09('0xb7')](_0x1f52bc,0x1);break;case'power':this['handlePower'](_0x1f52bc,_0x1f52bc['dialPowerLevel']);break;case _0x2c09('0x8'):this[_0x2c09('0x8')](_0x1f52bc);break;case'booked':this['handlePower'](_0x1f52bc,0x1);break;default:logger[_0x2c09('0x65')](_0x2c09('0xb8'),_0x1f52bc[_0x2c09('0x47')],_0x2c09('0xb9'));}};Dialer[_0x2c09('0x85')]['ifTime']=function(_0x4ce8ec,_0xe8260d){var _0x241766=_0x4ce8ec[_0x2c09('0xb1')];var _0xed15b5=_0xe8260d?_0x4ce8ec[_0x2c09('0xb0')]:_0x4ce8ec[_0x2c09('0x72')]['Intervals'];logger[_0x2c09('0xba')](_0x2c09('0xbb'),_0xed15b5,_0x241766,_0x4ce8ec[_0x2c09('0x47')],util['format'](_0x2c09('0xbc'),_0x4ce8ec[_0x2c09('0x47')],_0x4ce8ec['id']));var _0x9a3cec=null;return Interval[_0x2c09('0xbd')](_0xed15b5,_0x241766)[_0x2c09('0x9d')](function(_0x1e4f54){if(_0x1e4f54===!![]){return _0x1e4f54;}else{_0x4ce8ec['message']=_0xe8260d?utils[_0x2c09('0x6a')]['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0x2c09('0xa7')];_0x9a3cec=msgResponse(_0x2c09('0xa8'),_0x2c09('0x93'),_0x2c09('0xa9')+_0xe8260d+'\x20'+_0x4ce8ec[_0x2c09('0x47')]+_0x2c09('0xaa')+util['inspect'](_0xed15b5,{'showHidden':![],'depth':null})+_0x2c09('0xab')+_0x241766);}if(_0x9a3cec!==null){logger[_0x2c09('0xba')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x9a3cec);_0x9a3cec[_0x2c09('0xbe')]=_0xe8260d;throw _0x9a3cec;}})[_0x2c09('0xa4')](function(_0x54ecf7){logger[_0x2c09('0x65')](_0x2c09('0xbf'),_0x54ecf7);throw msgResponse(_0x2c09('0x83'),_0x2c09('0x84'),util[_0x2c09('0x44')](_0x54ecf7,{'showHidden':![],'depth':null}));});};Dialer[_0x2c09('0x85')][_0x2c09('0x2b')]=function(_0xf9eb51){if(this[_0x2c09('0x1e')][_0xf9eb51['queue']]){if(this[_0x2c09('0x23')][_0xf9eb51['uniqueid']]&&this[_0x2c09('0x23')][_0xf9eb51[_0x2c09('0xc0')]]['type']!==_0x2c09('0xc1')){this['updateOriginated'](this[_0x2c09('0x1e')][_0xf9eb51[_0x2c09('0xc2')]]);this[_0x2c09('0x23')][_0xf9eb51[_0x2c09('0xc0')]][_0x2c09('0xc3')]=moment()[_0x2c09('0x45')](_0x2c09('0xc4'));}}};Dialer[_0x2c09('0x85')]['syncAgentComplete']=function(_0x368d51){var _0x55bd77=this[_0x2c09('0x23')][_0x368d51['uniqueid']];if(this[_0x2c09('0x1e')][_0x368d51[_0x2c09('0xc2')]]){if(_0x55bd77&&_0x55bd77['type']!==_0x2c09('0xc1')){delete this[_0x2c09('0x23')][_0x368d51[_0x2c09('0xc0')]];this[_0x2c09('0x1e')][_0x368d51[_0x2c09('0xc2')]][_0x2c09('0xc5')]+=0x1;var _0x354952=new AgentComplete(_0x55bd77,_0x368d51);if(_0x368d51[_0x2c09('0xc6')]===_0x2c09('0xc7')){_0x354952[_0x2c09('0xc8')]=this[_0x2c09('0x1e')][_0x368d51[_0x2c09('0xc2')]][_0x2c09('0xc9')]&&this[_0x2c09('0x1e')][_0x368d51[_0x2c09('0xc2')]]['dialAgiAfterHangupAgent']?moment()[_0x2c09('0x45')](_0x2c09('0xc4')):undefined;}hopperUtils[_0x2c09('0xca')](_0x354952)[_0x2c09('0xa4')](loggerCatch(_0x2c09('0xcb')));hopperUtils[_0x2c09('0xcc')](_0x354952)[_0x2c09('0xa4')](loggerCatch(_0x2c09('0xcd')));}}};Dialer[_0x2c09('0x85')][_0x2c09('0x2d')]=function(_0x1c9a7c){var _0x28a82a=this['uniqueId'][_0x1c9a7c[_0x2c09('0xc0')]];var _0x7670b2=this;var _0x37bb32=![];var _0x492378;var _0x27c16e;if(this[_0x2c09('0x1e')][_0x1c9a7c[_0x2c09('0xc2')]]){if(_0x28a82a&&_0x28a82a['type']!=='ivr'){delete this['uniqueId'][_0x1c9a7c[_0x2c09('0xc0')]];this[_0x2c09('0xce')](this[_0x2c09('0x1e')][_0x1c9a7c[_0x2c09('0xc2')]]);_0x28a82a[_0x2c09('0xcf')]=moment()[_0x2c09('0x45')](_0x2c09('0xc4'));var _0x26d315=new QueueCallerAbandon(_0x28a82a,_0x1c9a7c);if(utils[_0x2c09('0x61')](_0x28a82a[_0x2c09('0xcf')],_0x28a82a[_0x2c09('0xd0')])>=_0x28a82a[_0x2c09('0xd1')]){this[_0x2c09('0x1e')][_0x1c9a7c['queue']][_0x2c09('0x50')]+=0x1;this[_0x2c09('0x1e')][_0x1c9a7c['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0x2c09('0x1e')][_0x1c9a7c[_0x2c09('0xc2')]][_0x2c09('0xd2')]+=0x1;_0x26d315['state']=0xa;_0x26d315[_0x2c09('0xd3')]=_0x2c09('0xd4');_0x26d315[_0x2c09('0xd5')]='TIMEOUT';_0x26d315[_0x2c09('0xc8')]=this[_0x2c09('0x1e')][_0x1c9a7c['queue']]['dialQueueProject2']?moment()[_0x2c09('0x45')](_0x2c09('0xc4')):undefined;_0x26d315[_0x2c09('0xd6')]+=0x1;_0x26d315['countglobal']+=0x1;_0x492378=this[_0x2c09('0x1e')][_0x1c9a7c[_0x2c09('0xc2')]][_0x2c09('0xd7')];_0x27c16e=this['voiceQueues'][_0x1c9a7c[_0x2c09('0xc2')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x2c09('0xd8')](_0x26d315,_0x26d315['state'],_0x28a82a[_0x2c09('0xd9')])[_0x2c09('0x9d')](function(_0x42e80f){_0x37bb32=_0x42e80f[_0x2c09('0xda')]==0x1;if(_0x26d315[_0x2c09('0xd6')]>=_0x7670b2['voiceQueues'][_0x1c9a7c[_0x2c09('0xc2')]]['dialDropMaxRetry']){_0x7670b2[_0x2c09('0xdb')](_0x26d315,_0x42e80f[_0x2c09('0xda')]);}else{hopperUtils[_0x2c09('0xdc')]({'active':![],'countdropretry':_0x26d315[_0x2c09('0xd6')],'scheduledat':moment()['add'](_0x7670b2[_0x2c09('0x1e')][_0x1c9a7c[_0x2c09('0xc2')]][_0x2c09('0xd7')],'minutes')[_0x2c09('0x45')](_0x2c09('0xc4')),'ContactId':_0x28a82a[_0x2c09('0xdd')],'ListId':_0x28a82a[_0x2c09('0xde')],'VoiceQueueId':_0x28a82a[_0x2c09('0xdf')]||undefined,'CampaignId':_0x28a82a['CampaignId']||undefined})['catch'](loggerCatch(_0x2c09('0xe0')));var _0x4fee7c=new History(_0x26d315);_0x4fee7c[_0x2c09('0xe1')]=0xa;_0x4fee7c[_0x2c09('0xd3')]=_0x2c09('0xd4');_0x4fee7c[_0x2c09('0xe2')]=moment()['format'](_0x2c09('0xc4'));_0x4fee7c[_0x2c09('0x6d')]=_0x4fee7c[_0x2c09('0xe2')];_0x4fee7c[_0x2c09('0xe3')]=_0x26d315[_0x2c09('0xe3')];_0x4fee7c['calleridnum']=_0x26d315[_0x2c09('0xe4')];hopperUtils[_0x2c09('0xca')](_0x4fee7c)[_0x2c09('0xa4')](loggerCatch(_0x2c09('0xe5')));}})[_0x2c09('0x9d')](function(){if(_0x37bb32)hopperUtils[_0x2c09('0xe6')](_0x26d315,_0x492378,_0x27c16e)[_0x2c09('0x9d')](function(){return 0x1;});});}else{this[_0x2c09('0x1e')][_0x1c9a7c[_0x2c09('0xc2')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x2c09('0x1e')][_0x1c9a7c[_0x2c09('0xc2')]][_0x2c09('0xe7')]+=0x1;_0x26d315[_0x2c09('0xe1')]=0xb;_0x26d315[_0x2c09('0xd3')]=_0x2c09('0xe8');_0x26d315[_0x2c09('0xd5')]=_0x2c09('0xe9');_0x26d315[_0x2c09('0xea')]+=0x1;_0x26d315[_0x2c09('0xeb')]+=0x1;_0x492378=this[_0x2c09('0x1e')][_0x1c9a7c[_0x2c09('0xc2')]][_0x2c09('0xec')];_0x27c16e=this[_0x2c09('0x1e')][_0x1c9a7c[_0x2c09('0xc2')]][_0x2c09('0xed')];hopperUtils[_0x2c09('0xd8')](_0x26d315,_0x26d315['state'],_0x28a82a[_0x2c09('0xd9')])[_0x2c09('0x9d')](function(_0x496705){if(_0x26d315[_0x2c09('0xea')]>=_0x7670b2[_0x2c09('0x1e')][_0x1c9a7c[_0x2c09('0xc2')]][_0x2c09('0xee')]){_0x7670b2[_0x2c09('0xdb')](_0x26d315,_0x496705[_0x2c09('0xda')]);}else{hopperUtils[_0x2c09('0xdc')]({'active':![],'countabandonedretry':_0x26d315['countabandonedretry'],'scheduledat':moment()[_0x2c09('0xef')](_0x7670b2[_0x2c09('0x1e')][_0x1c9a7c['queue']]['dialAbandonedRetryFrequency'],_0x2c09('0xf0'))[_0x2c09('0x45')](_0x2c09('0xc4')),'ContactId':_0x28a82a[_0x2c09('0xdd')],'ListId':_0x28a82a['ListId'],'VoiceQueueId':_0x28a82a[_0x2c09('0xdf')]||undefined,'CampaignId':_0x28a82a[_0x2c09('0xf1')]||undefined})[_0x2c09('0xa4')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x17245c=new History(_0x26d315);_0x17245c[_0x2c09('0xe1')]=0xb;_0x17245c[_0x2c09('0xd3')]=_0x2c09('0xe8');_0x17245c[_0x2c09('0xe2')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x17245c[_0x2c09('0x6d')]=_0x17245c[_0x2c09('0xe2')];_0x17245c[_0x2c09('0xe3')]=_0x26d315[_0x2c09('0xe3')];_0x17245c[_0x2c09('0xe4')]=_0x26d315[_0x2c09('0xe4')];hopperUtils[_0x2c09('0xca')](_0x17245c)['catch'](loggerCatch(_0x2c09('0xf2')));}})[_0x2c09('0x9d')](function(){if(_0x37bb32)hopperUtils[_0x2c09('0xe6')](_0x26d315,_0x492378,_0x27c16e)['then'](function(){return 0x1;});});}}}};Dialer[_0x2c09('0x85')]['syncNewExten']=function(_0x10d777){if(this['actions'][_0x10d777['uniqueid']]){this[_0x2c09('0x22')][_0x10d777[_0x2c09('0xc0')]][_0x2c09('0xf3')]=_0x10d777[_0x2c09('0xf3')];}if(this[_0x2c09('0x23')][_0x10d777[_0x2c09('0xc0')]]){this[_0x2c09('0x23')][_0x10d777[_0x2c09('0xc0')]][_0x2c09('0xf3')]=_0x10d777[_0x2c09('0xf3')];}};Dialer['prototype'][_0x2c09('0xf4')]=function(_0x27d869){if(!this[_0x2c09('0x22')][_0x27d869[_0x2c09('0xf5')]]){return;}var _0x231c1d=this['voiceQueues'][this[_0x2c09('0x22')][_0x27d869['actionid']][_0x2c09('0xc2')]][_0x2c09('0xf6')]||_0x2c09('0xf7');if(_0x231c1d==='roundrobin'){if(this[_0x2c09('0x22')][_0x27d869[_0x2c09('0xf5')]]&&_[_0x2c09('0xf8')](this[_0x2c09('0x22')][_0x27d869[_0x2c09('0xf5')]][_0x2c09('0xf9')])&&_0x27d869[_0x2c09('0x8a')]==='1'&&_0x27d869[_0x2c09('0xfa')]==='0'){if(this[_0x2c09('0x20')][_0x27d869[_0x2c09('0xfb')]]){if(!this['agents'][_0x27d869[_0x2c09('0xfb')]][_0x2c09('0xf9')]){this[_0x2c09('0x20')][_0x27d869[_0x2c09('0xfb')]][_0x2c09('0xf9')]=!![];this[_0x2c09('0x22')][_0x27d869[_0x2c09('0xf5')]]['locked']=!![];this[_0x2c09('0x22')][_0x27d869['actionid']]['stateinterface']=_0x27d869['stateinterface'];}}}}else if(_0x231c1d===_0x2c09('0xf7')){if(this['actions'][_0x27d869[_0x2c09('0xf5')]]){if(this[_0x2c09('0x20')][_0x27d869[_0x2c09('0xfb')]]){this[_0x2c09('0x22')][_0x27d869[_0x2c09('0xf5')]][_0x2c09('0xfb')]=_0x27d869[_0x2c09('0xfb')];if(_[_0x2c09('0xf8')](this['queueBooked'][this[_0x2c09('0x22')][_0x27d869['actionid']][_0x2c09('0xc2')]])){this[_0x2c09('0x27')][this['actions'][_0x27d869[_0x2c09('0xf5')]][_0x2c09('0xc2')]]=[];}this[_0x2c09('0x27')][this[_0x2c09('0x22')][_0x27d869[_0x2c09('0xf5')]][_0x2c09('0xc2')]][_0x2c09('0xa1')](_[_0x2c09('0x60')](_['pick'](this[_0x2c09('0x22')][_0x27d869[_0x2c09('0xf5')]],[_0x2c09('0xfc'),'stateinterface']),{'status':_0x27d869['status'],'paused':_0x27d869[_0x2c09('0xfa')]}));}}}};Dialer[_0x2c09('0x85')]['syncQueueStatusComplete']=function(_0x475d03){if(!this['actions'][_0x475d03['actionid']]){return;}var _0x1349c8=this;var _0x32083f=this[_0x2c09('0x1e')][this['actions'][_0x475d03[_0x2c09('0xf5')]][_0x2c09('0xc2')]];var _0x1ec62c=_0x32083f[_0x2c09('0xf6')]||'rrmemory';if(_0x1ec62c===_0x2c09('0xfd')){if(this[_0x2c09('0x22')][_0x475d03['actionid']]&&this[_0x2c09('0x22')][_0x475d03[_0x2c09('0xf5')]]['stateinterface']){this['preview'][_0x2c09('0xfe')](this[_0x2c09('0x22')][_0x475d03['actionid']][_0x2c09('0xfc')],this['actions'][_0x475d03[_0x2c09('0xf5')]][_0x2c09('0xfb')])[_0x2c09('0xa4')](function(_0x5b5775){logger['error'](_0x2c09('0xff'),util[_0x2c09('0x44')](_0x5b5775,{'showHidden':![],'depth':null}));})[_0x2c09('0x1b')](function(){_0x1349c8[_0x2c09('0xce')](_0x1349c8[_0x2c09('0x1e')][_0x1349c8['actions'][_0x475d03[_0x2c09('0xf5')]][_0x2c09('0xc2')]]);_0x1349c8['agents'][_0x1349c8['actions'][_0x475d03['actionid']][_0x2c09('0xfb')]]['locked']=![];delete _0x1349c8[_0x2c09('0x22')][_0x475d03[_0x2c09('0xf5')]];unlockQueueStatus(_0x32083f);});}else{this['updateOriginated'](this[_0x2c09('0x1e')][this[_0x2c09('0x22')][_0x475d03['actionid']][_0x2c09('0xc2')]]);hopperUtils[_0x2c09('0xdc')]({'active':![],'ContactId':this[_0x2c09('0x22')][_0x475d03[_0x2c09('0xf5')]]['ContactId'],'ListId':this[_0x2c09('0x22')][_0x475d03[_0x2c09('0xf5')]][_0x2c09('0xde')],'VoiceQueueId':this[_0x2c09('0x22')][_0x475d03[_0x2c09('0xf5')]][_0x2c09('0xdf')]||undefined,'CampaignId':this['actions'][_0x475d03['actionid']][_0x2c09('0xf1')]||undefined})['catch'](loggerCatch(_0x2c09('0x100')));delete this[_0x2c09('0x22')][_0x475d03[_0x2c09('0xf5')]];unlockQueueStatus(_0x32083f);}}else if(_0x1ec62c===_0x2c09('0xf7')){var _0x1f7401;if(this[_0x2c09('0x22')][_0x475d03[_0x2c09('0xf5')]]&&!_[_0x2c09('0x76')](this[_0x2c09('0x27')][this['actions'][_0x475d03[_0x2c09('0xf5')]][_0x2c09('0xc2')]])){if(this[_0x2c09('0x28')][_0x1349c8[_0x2c09('0x22')][_0x475d03[_0x2c09('0xf5')]][_0x2c09('0xc2')]]){this[_0x2c09('0x28')][_0x1349c8['actions'][_0x475d03[_0x2c09('0xf5')]][_0x2c09('0xc2')]]=this[_0x2c09('0x28')][this[_0x2c09('0x22')][_0x475d03['actionid']][_0x2c09('0xc2')]]?this['queueBookedRR'][this[_0x2c09('0x22')][_0x475d03[_0x2c09('0xf5')]][_0x2c09('0xc2')]]:this[_0x2c09('0x27')][this[_0x2c09('0x22')][_0x475d03['actionid']][_0x2c09('0xc2')]]?this[_0x2c09('0x27')][this[_0x2c09('0x22')][_0x475d03['actionid']]['queue']][_0x2c09('0x101')]||0x0:0x0;}this[_0x2c09('0x27')][this[_0x2c09('0x22')][_0x475d03[_0x2c09('0xf5')]][_0x2c09('0xc2')]][_0x2c09('0x101')]=this[_0x2c09('0x28')][this[_0x2c09('0x22')][_0x475d03['actionid']][_0x2c09('0xc2')]];for(var _0x2fb405=0x0;_0x2fb405=_0x3fd7e2[_0x2c09('0x126')]){_0x57b466[_0x2c09('0x127')](_0xf91204,_0x4b0cb5,_0x1d1327,_0x2c09('0x128'));}else{if(_0xf91204['countmachineretry']>=_0x3fd7e2[_0x2c09('0x129')]){_0x57b466[_0x2c09('0x12a')](_0xf91204,_0x4b0cb5,_0x1d1327,'reason\x2019\x20machine....');}else{hopperUtils[_0x2c09('0xdc')]({'active':![],'countmachineretry':_0xf91204[_0x2c09('0x125')],'scheduledat':moment()['add'](_0x3fd7e2[_0x2c09('0x12b')],_0x2c09('0xf0'))[_0x2c09('0x45')](_0x2c09('0xc4')),'ContactId':_0xf91204[_0x2c09('0xdd')],'ListId':_0xf91204[_0x2c09('0xde')],'VoiceQueueId':_0xf91204[_0x2c09('0xdf')]||undefined,'CampaignId':_0xf91204[_0x2c09('0xf1')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x4b0cb5({'reschedule':0x1});}}});}if(_0x252267['type']===_0x2c09('0xc1')&&this[_0x2c09('0x1f')][_0x252267['queue']][_0x2c09('0x11c')]&&_0xe763ee['value']===_0x2c09('0x115')){delete this[_0x2c09('0x23')][_0xe763ee[_0x2c09('0xc0')]];this['updateOriginated'](this['campaigns'][_0x252267['queue']]);_0x132a3d=new Hangup(_0x252267,_0xe763ee);_0x132a3d['state']=0x12;_0x132a3d[_0x2c09('0xd3')]='HangupInAMD';_0x132a3d[_0x2c09('0x116')]=_0x2c09('0x117');ami['emit']('custom:amd',ut[_0x2c09('0x118')](_0x132a3d,_0x2c09('0x120')));this['saveInDb'](_0x132a3d,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x252267[_0x2c09('0x41')]===_0x2c09('0xc1')&&this[_0x2c09('0x1f')][_0x252267[_0x2c09('0xc2')]][_0x2c09('0x11c')]&&_0xe763ee[_0x2c09('0x114')]===_0x2c09('0x11d')){return new Promise(function(_0x557294,_0x3c7c60){delete _0x57b466['uniqueId'][_0xe763ee[_0x2c09('0xc0')]];_0x57b466['updateOriginated'](_0x57b466[_0x2c09('0x1f')][_0x252267['queue']]);_0x57b466[_0x2c09('0x1f')][_0x252267[_0x2c09('0xc2')]][_0x2c09('0xc5')]+=0x1;_0x57b466[_0x2c09('0x1f')][_0x252267['queue']][_0x2c09('0x11e')]+=0x1;var _0x4fd592=_0x57b466['campaigns'][_0x252267['queue']];var _0x567384=new Hangup(_0x252267,_0xe763ee);_0x567384[_0x2c09('0xe1')]=0x13;_0x567384[_0x2c09('0xd3')]=_0x2c09('0x11f');_0x567384[_0x2c09('0x116')]='AMD';_0x567384[_0x2c09('0x125')]+=0x1;_0x567384['countglobal']+=0x1;_0x567384[_0x2c09('0x120')]=!![];ami[_0x2c09('0x40')](_0x2c09('0x12c'),ut[_0x2c09('0x118')](_0x567384,_0x2c09('0x120')));hopperUtils[_0x2c09('0xca')](_0x567384)[_0x2c09('0xa4')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x567384['countbusyretry']+_0x567384[_0x2c09('0x122')]+_0x567384[_0x2c09('0x123')]+_0x567384['countnosuchnumberretry']+_0x567384[_0x2c09('0xd6')]+_0x567384[_0x2c09('0xea')]+_0x567384['countmachineretry']+_0x567384[_0x2c09('0x12d')]>=_0x4fd592[_0x2c09('0x126')]){_0x57b466[_0x2c09('0x127')](_0x567384,_0x557294,_0x3c7c60,_0x2c09('0x128'));}else{if(_0x567384[_0x2c09('0x125')]>=_0x4fd592[_0x2c09('0x129')]){_0x57b466[_0x2c09('0x12a')](_0x567384,_0x557294,_0x3c7c60,_0x2c09('0x12e'));}else{hopperUtils[_0x2c09('0xdc')]({'active':![],'countmachineretry':_0x567384[_0x2c09('0x125')],'scheduledat':moment()[_0x2c09('0xef')](_0x4fd592[_0x2c09('0x12b')],'minutes')[_0x2c09('0x45')](_0x2c09('0xc4')),'ContactId':_0x567384[_0x2c09('0xdd')],'ListId':_0x567384['ListId'],'VoiceQueueId':_0x567384['VoiceQueueId']||undefined,'CampaignId':_0x567384[_0x2c09('0xf1')]||undefined})[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x12f')));_0x557294({'reschedule':0x1});}}});}}};Dialer[_0x2c09('0x85')]['syncHangup']=function(_0x110739){var _0x184c60=this['uniqueId'][_0x110739['uniqueid']];var _0x475988;if(_0x184c60&&_0x184c60[_0x2c09('0x41')]===_0x2c09('0xc1')){delete this['uniqueId'][_0x110739['uniqueid']];this[_0x2c09('0xce')](this['campaigns'][_0x184c60['queue']]);this[_0x2c09('0x1f')][_0x184c60[_0x2c09('0xc2')]][_0x2c09('0x130')]+=0x1;_0x475988=new Hangup(_0x184c60,_0x110739);hopperUtils[_0x2c09('0xca')](_0x475988)[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x131')));hopperUtils['moveContactManagedDialer'](_0x475988)[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x132')));}if(_0x184c60&&_0x184c60[_0x2c09('0x41')]!==_0x2c09('0xc1')&&isNotNull(this[_0x2c09('0x1e')][_0x184c60[_0x2c09('0xc2')]][_0x2c09('0x133')])){delete this[_0x2c09('0x23')][_0x110739[_0x2c09('0xc0')]];this['updateOriginated'](this[_0x2c09('0x1e')][_0x184c60[_0x2c09('0xc2')]]);this[_0x2c09('0x1e')][_0x184c60[_0x2c09('0xc2')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x184c60[_0x2c09('0xc2')]][_0x2c09('0x11e')]+=0x1;_0x475988=new Hangup(_0x184c60,_0x110739);_0x475988[_0x2c09('0xe1')]=0x10;_0x475988[_0x2c09('0xd3')]=_0x2c09('0x134');_0x475988[_0x2c09('0x116')]='AGI';hopperUtils[_0x2c09('0xca')](_0x475988)['catch'](loggerCatch(_0x2c09('0x131')));hopperUtils[_0x2c09('0xcc')](_0x475988)[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x132')));}if(_0x184c60&&_0x184c60['type']!==_0x2c09('0xc1')&&!isNotNull(this[_0x2c09('0x1e')][_0x184c60[_0x2c09('0xc2')]][_0x2c09('0x133')])){if(_0x110739[_0x2c09('0x135')]===_0x2c09('0x136')){delete this[_0x2c09('0x23')][_0x110739[_0x2c09('0xc0')]];this['voiceQueues'][_0x184c60[_0x2c09('0xc2')]][_0x2c09('0xc5')]+=0x1;const _0xeb4576=new AgentComplete(_0x184c60,_0x110739);_0xeb4576[_0x2c09('0xf1')]=this[_0x2c09('0x1e')][_0x184c60[_0x2c09('0xc2')]]['id'];hopperUtils[_0x2c09('0xca')](_0xeb4576)[_0x2c09('0xa4')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils['moveContactManagedDialer'](_0xeb4576)['catch'](loggerCatch(_0x2c09('0xcd')));}else{delete this[_0x2c09('0x23')][_0x110739['uniqueid']];this[_0x2c09('0xce')](this[_0x2c09('0x1e')][_0x184c60[_0x2c09('0xc2')]]);this[_0x2c09('0x1e')][_0x184c60[_0x2c09('0xc2')]][_0x2c09('0x137')]+=0x1;_0x475988=new Hangup(_0x184c60,_0x110739);_0x475988[_0x2c09('0xe1')]=0xc;_0x475988[_0x2c09('0xd3')]=_0x110739[_0x2c09('0x135')];_0x475988[_0x2c09('0x116')]='Unknow';hopperUtils['createHistory'](_0x475988)[_0x2c09('0xa4')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x475988)['catch'](loggerCatch(_0x2c09('0x132')));}}};Dialer[_0x2c09('0x85')]['syncQueueSummary']=function(_0x1f5fd4){var _0x5b73e0=this;if(!_0x5b73e0[_0x2c09('0x29')][_0x1f5fd4['name']]){_0x5b73e0[_0x2c09('0x29')][_0x1f5fd4[_0x2c09('0x47')]]={'running':![]};}else if(_0x5b73e0[_0x2c09('0x29')][_0x1f5fd4[_0x2c09('0x47')]]['running']===!![]){return;}else if(_0x5b73e0['queuesSummary'][_0x1f5fd4['name']][_0x2c09('0x138')]===![]){_0x5b73e0[_0x2c09('0x29')][_0x1f5fd4[_0x2c09('0x47')]][_0x2c09('0x138')]=!![];}var _0x3f7fa5=_0x5b73e0[_0x2c09('0x1e')][_0x1f5fd4['name']];var _0x1f5c27=_0x3f7fa5['message']!==utils['CAMPAIGN_STATUS'][_0x2c09('0x7e')];var _0x238e4f=utils['isPreviewCampaign'](_0x3f7fa5);_0x3f7fa5['statusMessage']=utils[_0x2c09('0x139')](_0x3f7fa5,_0x5b73e0['trunks']);Promise[_0x2c09('0xaf')]()['then'](function(){if(_0x3f7fa5[_0x2c09('0x13a')]===utils[_0x2c09('0x6a')][_0x2c09('0x7e')]){if(_0x1f5c27){clearPredictiveAttributes(_0x3f7fa5);_0x1f5fd4['startPredictive']=undefined;_0x1f5fd4['startProgressive']=undefined;}if(_0x3f7fa5['statusMessage']===utils[_0x2c09('0x6a')][_0x2c09('0x7e')]){_0x1f5fd4[_0x2c09('0x13b')]=0x0;_0x1f5fd4[_0x2c09('0xfa')]=0x0;_0x1f5fd4[_0x2c09('0x13c')]=0x0;_0x1f5fd4[_0x2c09('0x13d')]=0x0;_0x1f5fd4[_0x2c09('0x13e')]=0x0;}}else if(_0x3f7fa5['statusMessage']===utils['CAMPAIGN_STATUS'][_0x2c09('0x13f')]&&!_0x238e4f){return _0x5b73e0[_0x2c09('0x92')](_0x3f7fa5,!![])['then'](function(){return _0x5b73e0[_0x2c09('0x92')](_0x3f7fa5,![]);})['then'](function(){return _0x5b73e0[_0x2c09('0xb4')](_0x3f7fa5);})[_0x2c09('0xa4')](function(_0x3b885c){loggerSyncQueueSummary['debug'](_0x2c09('0x140'),util[_0x2c09('0x44')](_0x3b885c,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x3f7fa5);});}else{clearPredictiveAttributes(_0x3f7fa5);}})[_0x2c09('0x9d')](function(){var _0x662bd3=_0x1f5fd4[_0x2c09('0x141')](_0x3f7fa5);if(_0x662bd3||_0x3f7fa5[_0x2c09('0x142')]){_0x3f7fa5['queueSummaryCountersUpdated']=![];_0x1f5fd4[_0x2c09('0x143')](_0x3f7fa5);Object[_0x2c09('0x144')](_0x3f7fa5,_0x1f5fd4);emitOutboundVoiceQueueSummary(_0x1f5fd4);}_0x5b73e0[_0x2c09('0x29')][_0x3f7fa5[_0x2c09('0x47')]][_0x2c09('0x138')]=![];})[_0x2c09('0xa4')](function(_0x1255ef){logger[_0x2c09('0x65')](_0x2c09('0x140'),util[_0x2c09('0x44')](_0x1255ef,{'showHidden':![],'depth':null}));_0x5b73e0[_0x2c09('0x29')][_0x3f7fa5[_0x2c09('0x47')]][_0x2c09('0x138')]=![];});};Dialer[_0x2c09('0x85')][_0x2c09('0x34')]=_['throttle'](function(){var _0x28c646=_[_0x2c09('0x145')](this[_0x2c09('0x1e')],function(_0x2bc302){return _0x2bc302[_0x2c09('0x146')];});var _0x3f6e10=_[_0x2c09('0x145')](this[_0x2c09('0x20')],function(_0x26f6d7){return _0x26f6d7[_0x2c09('0x147')]&&_0x26f6d7[_0x2c09('0x8a')]===_0x2c09('0x8b');});if(_0x28c646[_0x2c09('0x102')]>0x0&&_0x3f6e10[_0x2c09('0x102')]>0x0){return Promise[_0x2c09('0xaf')]()[_0x2c09('0x9d')](cmHopper['handlePreviewRecallNotifications'](_[_0x2c09('0x148')](_0x28c646,'id'),previewRecallmeReminderInterval,_[_0x2c09('0x148')](_0x3f6e10,'id')))['then'](function(_0x26962f){for(var _0x5db53b=0x0;_0x5db53b<_0x26962f[_0x2c09('0x102')];_0x5db53b++){var _0x56417c=_0x26962f[_0x5db53b]['Agent'][_0x2c09('0x47')];if(_0x56417c)io['to'](util[_0x2c09('0x45')](_0x2c09('0x149'),_0x56417c))[_0x2c09('0x40')](_0x2c09('0x14a'),{'hopper':_0x26962f[_0x5db53b]});}})[_0x2c09('0xa4')](function(_0x11230b){logger[_0x2c09('0x65')](_0x2c09('0x14b'),_0x11230b);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x2c09('0x85')][_0x2c09('0x3d')]=function(){var _0x4fa3ba=this;setInterval(function(){_0x4fa3ba[_0x2c09('0x14c')](_0x4fa3ba['uniqueId'],_0x2c09('0x14d'));_0x4fa3ba[_0x2c09('0x14c')](_0x4fa3ba[_0x2c09('0x22')],'[actions]');},0x32c8);};Dialer[_0x2c09('0x85')][_0x2c09('0x14c')]=function(_0x492c13,_0x292f4d){var _0x4ba159=this;for(var _0x413484 in _0x492c13){if(typeof _0x492c13[_0x413484]!==_0x2c09('0xae')){this['sequence']['enqueue'](function(){if(!_[_0x2c09('0xf8')](_0x492c13[_0x413484])){return ami[_0x2c09('0x9b')]({'action':'status','channel':_0x492c13[_0x413484][_0x2c09('0xf3')]})[_0x2c09('0xa4')](function(_0x377050){if(_0x377050[_0x2c09('0x69')]===_0x2c09('0x14e')){setTimeout(function(){if(_0x492c13[_0x413484]&&_0x492c13[_0x413484][_0x2c09('0x41')]!==_0x2c09('0xc1')){_0x4ba159[_0x2c09('0xce')](_0x4ba159[_0x2c09('0x1e')][_0x492c13[_0x413484]['queue']]);logger[_0x2c09('0x65')]('[Dialer][checkChannel]',_0x292f4d,_0x413484,_0x492c13[_0x413484][_0x2c09('0xc2')]);delete _0x492c13[_0x413484];}if(_0x492c13[_0x413484]&&_0x492c13[_0x413484][_0x2c09('0x41')]===_0x2c09('0xc1')){_0x4ba159[_0x2c09('0xce')](_0x4ba159['campaigns'][_0x492c13[_0x413484][_0x2c09('0xc2')]]);logger[_0x2c09('0x65')](_0x2c09('0x14f'),_0x292f4d,_0x413484,_0x492c13[_0x413484][_0x2c09('0xc2')]);delete _0x492c13[_0x413484];}},0x2328);}});}});}}};Dialer[_0x2c09('0x85')]['getVoiceQueueRtPauses']=function(_0x2a45ee){return Promise[_0x2c09('0xaf')]()[_0x2c09('0x9d')](voiceQueueRt[_0x2c09('0x150')](_0x2a45ee))['catch'](loggerCatch(_0x2c09('0x151')));};Dialer[_0x2c09('0x85')][_0x2c09('0xce')]=function(_0x1f6d0d){if(!_['isUndefined'](_0x1f6d0d)&&_0x1f6d0d!==null){if(typeof _0x1f6d0d[_0x2c09('0x7d')]!=='undefined'){if(_0x1f6d0d[_0x2c09('0x7d')]>0x0){_0x1f6d0d['originated']-=0x1;}else{logger[_0x2c09('0x65')](_0x2c09('0x152'));}}}else{logger[_0x2c09('0x65')](_0x2c09('0x153'));}};Dialer[_0x2c09('0x85')]['loggerHandler']=function(_0x243a66,_0x4aa21f){var _0x591e7d=this;return function(_0x3abfaa){_0x591e7d[_0x2c09('0xce')](_0x4aa21f);logger[_0x2c09('0x65')](_0x243a66,util[_0x2c09('0x44')](_0x3abfaa,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x53ecdd,_0x2cb837,_0x19db80){var _0x2edf34={'state':0x19,'statedesc':_0x2c09('0x154')};this[_0x2c09('0xce')](_0x2cb837);this[_0x2c09('0x119')](_[_0x2c09('0x60')](_0x2edf34,_['pick'](_0x19db80,[_0x2c09('0xdd'),_0x2c09('0xde'),_0x2c09('0x155'),_0x2c09('0xdf'),_0x2c09('0xf1')])),_0x2c09('0x156'),_0x2c09('0x157'));logger[_0x2c09('0x65')](_0x53ecdd);};Dialer['prototype'][_0x2c09('0x119')]=function(_0xe47d4e,_0x35dfd9,_0x567425){hopperUtils[_0x2c09('0xca')](_0xe47d4e)['catch'](loggerCatch(_0x35dfd9));hopperUtils[_0x2c09('0xcc')](_0xe47d4e)[_0x2c09('0xa4')](loggerCatch(_0x567425));};Dialer[_0x2c09('0x85')][_0x2c09('0xdb')]=function(_0x5f33a8,_0x4f0507){hopperUtils[_0x2c09('0xca')](_0x5f33a8)['catch'](loggerCatch(_0x2c09('0xcb')));if(_0x4f0507==0x0){hopperUtils[_0x2c09('0xcc')](_0x5f33a8)[_0x2c09('0xa4')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer['prototype']['checkPreviewRecallReminder']=function(_0x2d1bac){return Promise[_0x2c09('0xaf')]()[_0x2c09('0x9d')](cmHopper['handlePreviewRecallNotifications'](_0x2d1bac['id'],previewRecallmeReminderInterval))[_0x2c09('0x9d')](function(_0x40e478){for(var _0x10887f=0x0;_0x10887f<_0x40e478[_0x2c09('0x102')];_0x10887f++){var _0x16fef0=_0x40e478[_0x10887f][_0x2c09('0x158')][_0x2c09('0x47')];if(_0x16fef0)io['to'](util[_0x2c09('0x45')](_0x2c09('0x149'),_0x16fef0))['emit'](_0x2c09('0x14a'),{'hopper':_0x40e478[_0x10887f]});}})[_0x2c09('0xa4')](function(){});};Dialer['prototype'][_0x2c09('0xb2')]=function(_0x57af0b){var _0x494948=this;return function(){_0x494948['handleIvr'](_0x57af0b);};};Dialer['prototype'][_0x2c09('0x159')]=function(_0x572e2c,_0x463a95){var _0x4b57d3=this;var _0x10c421=uuid['v4']();this[_0x2c09('0x22')][_0x10c421]=new Action(_0x572e2c,_0x463a95,_0x10c421);return new Promise(function(_0x2967cf,_0x3359d9){if(_[_0x2c09('0x3f')](_0x572e2c)&&typeof _0x572e2c!==_0x2c09('0x15a')){return _0x3359d9(msgResponse('originate','Failure',_0x2c09('0x15b')));}if(_[_0x2c09('0x3f')](_0x463a95[_0x2c09('0x15c')])||_0x463a95[_0x2c09('0x15c')]===null){return _0x3359d9(msgResponse(_0x2c09('0x15d'),_0x2c09('0x93'),_0x2c09('0x15e')));}var _0x4ca9ad={'XMD-CALLERID':_0x4b57d3[_0x2c09('0x22')][_0x10c421][_0x2c09('0x15f')](),'XMD-AGI':_0x572e2c[_0x2c09('0x133')]?util['format'](_0x2c09('0x160'),ipAgi,_0x572e2c[_0x2c09('0x133')]):_0x2c09('0x161'),'XMD-AGIAFTER':_0x572e2c[_0x2c09('0xc9')]?util[_0x2c09('0x45')](_0x2c09('0x160'),ipAgi,_0x572e2c['dialQueueProject2']):_0x2c09('0x161'),'XMD-QUEUE':utils['isOutboundQueue'](_0x572e2c)?util[_0x2c09('0x45')](_0x2c09('0x162'),_0x572e2c[_0x2c09('0x47')],_0x572e2c[_0x2c09('0x163')]||'',_0x572e2c[_0x2c09('0x164')]?'c':'',_0x572e2c['dialQueueTimeout']||0x3):_0x2c09('0x161'),'XMD-CONTACTID':_0x463a95[_0x2c09('0xdd')],'XMD-CDRTYPE':_0x2c09('0x165'),'CALLERID(all)':_0x4b57d3['actions'][_0x10c421][_0x2c09('0x15f')](),'XMD-AMD':_0x572e2c['dialAMDActive']?_0x2c09('0x13f'):_0x2c09('0x161'),'XMD-DESTINATION':_0x2c09('0x113')};if(_0x572e2c[_0x2c09('0x11c')]){_0x4ca9ad[_0x2c09('0x166')]=_0x572e2c[_0x2c09('0x167')]||0x9c4;_0x4ca9ad['XMD-AMDGREETING']=_0x572e2c[_0x2c09('0x168')]||0x5dc;_0x4ca9ad['XMD-AMDAFTERGREETINGSILENCE']=_0x572e2c[_0x2c09('0x169')]||0x320;_0x4ca9ad[_0x2c09('0x16a')]=_0x572e2c[_0x2c09('0x16b')]||0x1388;_0x4ca9ad[_0x2c09('0x16c')]=_0x572e2c[_0x2c09('0x16d')]||0x64;_0x4ca9ad[_0x2c09('0x16e')]=_0x572e2c['dialAMDBetweenWordsSilence']||0x32;_0x4ca9ad[_0x2c09('0x16f')]=_0x572e2c['dialAMDMaximumNumberOfWords']||0x3;_0x4ca9ad[_0x2c09('0x170')]=_0x572e2c['dialAMDSilenceThreshold']||0x100;_0x4ca9ad[_0x2c09('0x171')]=_0x572e2c[_0x2c09('0x172')]||0x1388;}if(utils[_0x2c09('0x173')](_0x572e2c)){_0x4ca9ad[_0x2c09('0x174')]=_0x463a95[_0x2c09('0xdf')];}else{_0x4ca9ad['XMD-CAMPAIGNID']=_0x463a95['CampaignId'];}var _0x1273b0=utils['setXMDContactVariables'](_0x463a95[_0x2c09('0x175')]);Object[_0x2c09('0x144')](_0x4ca9ad,_0x1273b0);var _0x2e5652=_0x4b57d3['isTrunkReachable'](_0x572e2c[_0x2c09('0x8d')])?utils['getCallerId'](_0x572e2c[_0x2c09('0x8d')][_0x2c09('0x176')],_0x572e2c[_0x2c09('0x177')],_0x572e2c[_0x2c09('0x178')]>0x0?utils[_0x2c09('0x179')](_0x572e2c[_0x2c09('0x17a')],_0x572e2c[_0x2c09('0x178')]):_0x572e2c[_0x2c09('0x17a')]):utils[_0x2c09('0x17b')](_['isNil'](_0x572e2c[_0x2c09('0x17c')])?_0x572e2c['Trunk'][_0x2c09('0x176')]:_0x572e2c[_0x2c09('0x17c')][_0x2c09('0x176')],_0x572e2c[_0x2c09('0x177')],_0x572e2c[_0x2c09('0x178')]>0x0?utils['getCallerIdRandom'](_0x572e2c[_0x2c09('0x17a')],_0x572e2c[_0x2c09('0x178')]):_0x572e2c[_0x2c09('0x17a')]);if(_0x2e5652){_0x4ca9ad[_0x2c09('0x17d')]=_0x4b57d3['actions'][_0x10c421]['originatecalleridname']=utils[_0x2c09('0x17e')](_0x2e5652);_0x4ca9ad['XMD-ORIGINATECALLERIDNUM']=_0x463a95['phone'];}_0x572e2c[_0x2c09('0x17f')]=_0x4ca9ad;return ami['Action']({'actionid':_0x10c421,'action':_0x2c09('0x15d'),'channel':_0x4b57d3[_0x2c09('0x86')](_0x572e2c[_0x2c09('0x8d')])?util[_0x2c09('0x45')]('SIP/%s/%s%s',_0x572e2c[_0x2c09('0x8d')]['name'],isNotNull(_0x572e2c['dialPrefix'])?_0x572e2c['dialPrefix'][_0x2c09('0x180')]()||'':'',_0x572e2c[_0x2c09('0x181')]>0x0?_0x463a95[_0x2c09('0x15c')][_0x2c09('0x182')](_0x572e2c[_0x2c09('0x181')]):_0x463a95[_0x2c09('0x15c')]):util['format'](_0x2c09('0x183'),_[_0x2c09('0xf8')](_0x572e2c[_0x2c09('0x17c')])?_0x572e2c['Trunk'][_0x2c09('0x47')]:_0x572e2c['TrunkBackup']['name'],isNotNull(_0x572e2c[_0x2c09('0x184')])?_0x572e2c[_0x2c09('0x184')]['trim']()||'':'',_0x572e2c[_0x2c09('0x181')]>0x0?_0x463a95[_0x2c09('0x15c')]['substring'](_0x572e2c[_0x2c09('0x181')]):_0x463a95[_0x2c09('0x15c')]),'callerid':_0x2e5652,'Exten':_0x2c09('0x113'),'Context':'from-sip','Priority':'1','variable':_0x4ca9ad,'timeout':(_0x572e2c[_0x2c09('0x185')]||0x1e)*0x3e8,'async':!![],'channelid':_0x10c421})[_0x2c09('0x9d')](function(_0x151c26){return _0x2967cf(_0x151c26);})[_0x2c09('0xa4')](function(_0x1f5be6){_0x572e2c[_0x2c09('0x186')]+=0x1;var _0x40d608=new History(_0x4b57d3[_0x2c09('0x22')][_0x10c421]);logger['error'](util[_0x2c09('0x45')](_0x2c09('0x187'),JSON[_0x2c09('0x71')](_0x1f5be6)));_0x40d608[_0x2c09('0xe1')]=0xe;_0x40d608[_0x2c09('0xd3')]=_0x2c09('0x188');_0x40d608[_0x2c09('0xe2')]=moment()['format'](_0x2c09('0xc4'));_0x40d608[_0x2c09('0x6d')]=_0x40d608[_0x2c09('0xe2')];hopperUtils[_0x2c09('0xca')](_0x40d608)['catch'](loggerCatch(_0x2c09('0x189')));_0x4b57d3[_0x2c09('0xcc')](_0x40d608)[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x189')))[_0x2c09('0x1b')](function(){delete _0x4b57d3['actions'][_0x10c421];return _0x3359d9(msgResponse('originate',_0x2c09('0x84'),_0x2c09('0x18a')));});});});};Dialer[_0x2c09('0x85')][_0x2c09('0x18b')]=function(_0x5d464e,_0x5ab359,_0x43facd){var _0x1bd07e=new History(_0x5ab359);if(_0x1bd07e[_0x2c09('0x121')]+_0x1bd07e['countcongestionretry']+_0x1bd07e[_0x2c09('0x123')]+_0x1bd07e[_0x2c09('0x124')]+_0x1bd07e[_0x2c09('0xd6')]+_0x1bd07e['countabandonedretry']+_0x1bd07e[_0x2c09('0x125')]+_0x1bd07e[_0x2c09('0x12d')]>=_0x43facd[_0x2c09('0x126')]-0x1){return!![];}switch(_0x5d464e){case 0x3:if(_0x1bd07e['countnoanswerretry']>=_0x43facd['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x2c09('0xdc')]({'active':![],'countnoanswerretry':_0x1bd07e[_0x2c09('0x123')]+=0x1,'scheduledat':moment()[_0x2c09('0xef')](_0x43facd[_0x2c09('0x18c')],_0x2c09('0xf0'))[_0x2c09('0x45')](_0x2c09('0xc4')),'ContactId':_0x1bd07e[_0x2c09('0xdd')],'ListId':_0x1bd07e[_0x2c09('0xde')],'VoiceQueueId':_0x1bd07e[_0x2c09('0xdf')]||undefined,'CampaignId':_0x1bd07e[_0x2c09('0xf1')]||undefined})[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x18d')));break;case 0x5:if(_0x1bd07e[_0x2c09('0x121')]>=_0x43facd['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x2c09('0xdc')]({'active':![],'countbusyretry':_0x1bd07e[_0x2c09('0x121')]+=0x1,'scheduledat':moment()[_0x2c09('0xef')](_0x43facd[_0x2c09('0x18e')],_0x2c09('0xf0'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1bd07e[_0x2c09('0xdd')],'ListId':_0x1bd07e['ListId'],'VoiceQueueId':_0x1bd07e[_0x2c09('0xdf')]||undefined,'CampaignId':_0x1bd07e[_0x2c09('0xf1')]||undefined})[_0x2c09('0xa4')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x1bd07e[_0x2c09('0x122')]>=_0x43facd[_0x2c09('0x18f')]-0x1){return!![];}hopperUtils[_0x2c09('0xdc')]({'active':![],'countcongestionretry':_0x1bd07e[_0x2c09('0x122')]+=0x1,'scheduledat':moment()[_0x2c09('0xef')](_0x43facd[_0x2c09('0x190')],_0x2c09('0xf0'))[_0x2c09('0x45')](_0x2c09('0xc4')),'ContactId':_0x1bd07e['ContactId'],'ListId':_0x1bd07e[_0x2c09('0xde')],'VoiceQueueId':_0x1bd07e['VoiceQueueId']||undefined,'CampaignId':_0x1bd07e['CampaignId']||undefined})['catch'](loggerCatch(_0x2c09('0x191')));break;case 0x0:if(_0x1bd07e[_0x2c09('0x124')]>=_0x43facd['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x2c09('0xdc')]({'active':![],'countnosuchnumberretry':_0x1bd07e[_0x2c09('0x124')]+=0x1,'scheduledat':moment()[_0x2c09('0xef')](_0x43facd[_0x2c09('0x192')],_0x2c09('0xf0'))[_0x2c09('0x45')](_0x2c09('0xc4')),'ContactId':_0x1bd07e[_0x2c09('0xdd')],'ListId':_0x1bd07e[_0x2c09('0xde')],'VoiceQueueId':_0x1bd07e['VoiceQueueId']||undefined,'CampaignId':_0x1bd07e[_0x2c09('0xf1')]||undefined})[_0x2c09('0xa4')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x1bd07e['countdropretry']>=_0x43facd[_0x2c09('0x193')]-0x1){return!![];}hopperUtils[_0x2c09('0xdc')]({'active':![],'countdropretry':_0x1bd07e[_0x2c09('0xd6')]+=0x1,'scheduledat':moment()[_0x2c09('0xef')](_0x43facd[_0x2c09('0xd7')],_0x2c09('0xf0'))[_0x2c09('0x45')](_0x2c09('0xc4')),'ContactId':_0x1bd07e[_0x2c09('0xdd')],'ListId':_0x1bd07e['ListId'],'VoiceQueueId':_0x1bd07e['VoiceQueueId']||undefined,'CampaignId':_0x1bd07e['CampaignId']||undefined})[_0x2c09('0xa4')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x1bd07e[_0x2c09('0xea')]>=_0x43facd[_0x2c09('0xee')]-0x1){return!![];}hopperUtils[_0x2c09('0xdc')]({'active':![],'countabandonedretry':_0x1bd07e['countabandonedretry']+=0x1,'scheduledat':moment()[_0x2c09('0xef')](_0x43facd[_0x2c09('0xec')],_0x2c09('0xf0'))[_0x2c09('0x45')](_0x2c09('0xc4')),'ContactId':_0x1bd07e['ContactId'],'ListId':_0x1bd07e[_0x2c09('0xde')],'VoiceQueueId':_0x1bd07e['VoiceQueueId']||undefined,'CampaignId':_0x1bd07e[_0x2c09('0xf1')]||undefined})[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x194')));break;case 0x13:if(_0x1bd07e[_0x2c09('0x125')]>=_0x43facd['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x2c09('0xdc')]({'active':![],'countmachineretry':_0x1bd07e[_0x2c09('0x125')]+=0x1,'scheduledat':moment()[_0x2c09('0xef')](_0x43facd[_0x2c09('0x12b')],'minutes')[_0x2c09('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1bd07e[_0x2c09('0xdd')],'ListId':_0x1bd07e[_0x2c09('0xde')],'VoiceQueueId':_0x1bd07e['VoiceQueueId']||undefined,'CampaignId':_0x1bd07e['CampaignId']||undefined})['catch'](loggerCatch(_0x2c09('0x12f')));break;case 0x14:if(_0x1bd07e[_0x2c09('0x12d')]>=_0x43facd[_0x2c09('0x195')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x1bd07e['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x43facd[_0x2c09('0x196')],_0x2c09('0xf0'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1bd07e[_0x2c09('0xdd')],'ListId':_0x1bd07e[_0x2c09('0xde')],'VoiceQueueId':_0x1bd07e[_0x2c09('0xdf')]||undefined,'CampaignId':_0x1bd07e['CampaignId']||undefined})['catch'](loggerCatch(_0x2c09('0x197')));break;default:return!![];}};Dialer['prototype'][_0x2c09('0x10f')]=function(_0x52da9d,_0x3e63f5,_0x26bfc3){var _0x1011cc=this;var _0x381611=new History(_0x52da9d);var _0x3f3fd1=![];var _0xddd60a;var _0x56a215;return new Promise(function(_0x2e2ca6,_0x44f340){if(_[_0x2c09('0x3f')](_0x3e63f5)&&typeof _0x3e63f5!==_0x2c09('0x15a')){return _0x44f340(msgResponse(_0x2c09('0x198'),_0x2c09('0x93'),_0x2c09('0x199')));}if(_[_0x2c09('0x3f')](_0x26bfc3)&&typeof _0x26bfc3!=='object'){return _0x44f340(msgResponse(_0x2c09('0x198'),'Failure',_0x2c09('0x19a')));}hopperUtils[_0x2c09('0xd8')](_0x381611,_0x26bfc3['reason'],_0x3e63f5)[_0x2c09('0x9d')](function(_0x267ac2){if(_0x267ac2['additional']==0x1)_0x3f3fd1=!![];switch(_0x26bfc3[_0x2c09('0xc6')]){case'0':_0x3e63f5[_0x2c09('0x19b')]+=0x1;_0x381611['state']=0x0;_0x381611[_0x2c09('0xd3')]='NoSuchNumber';_0x381611[_0x2c09('0x124')]+=0x1;_0x381611['countglobal']+=0x1;ami[_0x2c09('0x40')]('custom:agentnosuchnumber',ut[_0x2c09('0x118')](_0x52da9d,_0x2c09('0x19c')));_0xddd60a=_0x3e63f5[_0x2c09('0x192')];_0x56a215=_0x3e63f5[_0x2c09('0xed')];hopperUtils[_0x2c09('0xca')](_0x381611)['catch'](loggerCatch(_0x2c09('0x19d')));if(_0x1011cc[_0x2c09('0x18b')](0x0,_0x52da9d,_0x3e63f5)&&!_0x3f3fd1){if(_0x381611[_0x2c09('0x124')]>=_0x3e63f5['dialNoSuchNumberMaxRetry']){_0x1011cc[_0x2c09('0x12a')](_0x381611,_0x2e2ca6,_0x44f340,'reason\x200\x20no\x20such\x20number....');}else{_0x1011cc[_0x2c09('0x127')](_0x381611,_0x2e2ca6,_0x44f340,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x3e63f5[_0x2c09('0x19e')]+=0x1;_0x381611[_0x2c09('0xe1')]=0x3;_0x381611[_0x2c09('0xd3')]='NoAnswer';_0x381611['countnoanswerretry']+=0x1;_0x381611[_0x2c09('0xeb')]+=0x1;var _0x531611=ut[_0x2c09('0x19f')](_0x52da9d,_0x3e63f5);ami[_0x2c09('0x40')]('custom:agentnoanswer',_0x531611);_0xddd60a=_0x3e63f5[_0x2c09('0x18c')];_0x56a215=_0x3e63f5[_0x2c09('0xed')];hopperUtils[_0x2c09('0xca')](_0x381611)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x1011cc['checkRetriveMax'](0x3,_0x52da9d,_0x3e63f5)&&!_0x3f3fd1){if(_0x381611['countnoanswerretry']>=_0x3e63f5[_0x2c09('0x1a0')]){_0x1011cc['createStateFinal'](_0x381611,_0x2e2ca6,_0x44f340,_0x2c09('0x1a1'));}else{_0x1011cc[_0x2c09('0x127')](_0x381611,_0x2e2ca6,_0x44f340,_0x2c09('0x1a1'));}}break;case'5':_0x3e63f5['outboundBusyCallsDay']+=0x1;_0x381611[_0x2c09('0xe1')]=0x5;_0x381611['statedesc']=_0x2c09('0x1a2');_0x381611['countbusyretry']+=0x1;_0x381611[_0x2c09('0xeb')]+=0x1;ami[_0x2c09('0x40')](_0x2c09('0x1a3'),ut[_0x2c09('0x118')](_0x52da9d,_0x2c09('0x1a4')));_0xddd60a=_0x3e63f5[_0x2c09('0x18e')];_0x56a215=_0x3e63f5['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x381611)[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x1a5')));if(_0x1011cc['checkRetriveMax'](0x5,_0x52da9d,_0x3e63f5)&&!_0x3f3fd1){if(_0x381611[_0x2c09('0x121')]>=_0x3e63f5['dialBusyMaxRetry']){_0x1011cc[_0x2c09('0x12a')](_0x381611,_0x2e2ca6,_0x44f340,_0x2c09('0x1a6'));}else{_0x1011cc['stateGlobal'](_0x381611,_0x2e2ca6,_0x44f340,_0x2c09('0x1a6'));}}break;case'8':_0x3e63f5['outboundCongestionCallsDay']+=0x1;_0x381611[_0x2c09('0xe1')]=0x8;_0x381611[_0x2c09('0xd3')]=_0x2c09('0x1a7');_0x381611[_0x2c09('0x122')]+=0x1;_0x381611[_0x2c09('0xeb')]+=0x1;_0xddd60a=_0x3e63f5[_0x2c09('0x190')];_0x56a215=_0x3e63f5['callAdditionalPhoneAfterMin'];ami[_0x2c09('0x40')]('custom:agentcongestion',ut['buildObj'](_0x52da9d,'congestion'));hopperUtils[_0x2c09('0xca')](_0x381611)[_0x2c09('0xa4')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x1011cc['checkRetriveMax'](0x8,_0x52da9d,_0x3e63f5)&&!_0x3f3fd1){if(_0x381611[_0x2c09('0x122')]>=_0x3e63f5[_0x2c09('0x18f')]){_0x1011cc[_0x2c09('0x12a')](_0x381611,_0x2e2ca6,_0x44f340,'reason\x208\x20congestion');}else{_0x1011cc[_0x2c09('0x127')](_0x381611,_0x2e2ca6,_0x44f340,_0x2c09('0x1a8'));}}break;case'11':_0x3e63f5[_0x2c09('0x1a9')]+=0x1;_0x381611[_0x2c09('0xe1')]=0xb;_0x381611['statedesc']=_0x2c09('0xe8');_0x381611[_0x2c09('0xea')]+=0x1;_0x381611['countglobal']+=0x1;_0xddd60a=_0x3e63f5[_0x2c09('0xec')];_0x56a215=_0x3e63f5[_0x2c09('0xed')];hopperUtils[_0x2c09('0xca')](_0x381611)[_0x2c09('0xa4')](loggerCatch(_0x2c09('0xf2')));if(_0x1011cc['checkRetriveMax'](0xb,_0x52da9d,_0x3e63f5)&&!_0x3f3fd1){if(_0x381611[_0x2c09('0xea')]>=_0x3e63f5['dialAbandonedMaxRetry']){_0x1011cc['createStateFinal'](_0x381611,_0x2e2ca6,_0x44f340,'reason\x2011\x20abandoned');}else{_0x1011cc[_0x2c09('0x127')](_0x381611,_0x2e2ca6,_0x44f340,_0x2c09('0x1aa'));}}break;case'20':_0x3e63f5['outboundRejectCallsDay']+=0x1;_0x381611['state']=0x14;_0x381611['statedesc']=_0x2c09('0x1ab');_0x381611['countagentrejectretry']+=0x1;_0x381611['countglobal']+=0x1;_0xddd60a=_0x3e63f5['dialAgentRejectRetryFrequency'];_0x56a215=_0x3e63f5[_0x2c09('0xed')];ami[_0x2c09('0x40')](_0x2c09('0x1ac'),ut[_0x2c09('0x118')](_0x52da9d,_0x2c09('0x1ad')));hopperUtils[_0x2c09('0xca')](_0x381611)[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x1ae')));if(_0x1011cc[_0x2c09('0x18b')](0x14,_0x52da9d,_0x3e63f5)&&!_0x3f3fd1){if(_0x381611[_0x2c09('0x12d')]>=_0x3e63f5[_0x2c09('0x195')]){_0x1011cc[_0x2c09('0x12a')](_0x381611,_0x2e2ca6,_0x44f340,_0x2c09('0x1af'));}else{_0x1011cc[_0x2c09('0x127')](_0x381611,_0x2e2ca6,_0x44f340,_0x2c09('0x1af'));}}break;default:_0x3e63f5[_0x2c09('0x137')]+=0x1;_0x381611[_0x2c09('0xe1')]=0xc;_0x381611[_0x2c09('0xd3')]=_0x26bfc3['reason'];_0xddd60a=_0x3e63f5[_0x2c09('0x196')];_0x56a215=_0x3e63f5['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x381611)[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x1b0')));if(_0x1011cc[_0x2c09('0x18b')](_0x26bfc3['reason'],_0x52da9d,_0x3e63f5)&&!_0x3f3fd1){if(_0x381611[_0x2c09('0x121')]+_0x381611[_0x2c09('0x122')]+_0x381611[_0x2c09('0x123')]+_0x381611[_0x2c09('0x124')]+_0x381611[_0x2c09('0xd6')]+_0x381611[_0x2c09('0xea')]+_0x381611[_0x2c09('0x125')]+_0x381611[_0x2c09('0x12d')]>=_0x3e63f5[_0x2c09('0x126')]){_0x1011cc[_0x2c09('0x127')](_0x381611,_0x2e2ca6,_0x44f340,_0x26bfc3['reason']);}else{_0x1011cc[_0x2c09('0x12a')](_0x381611,_0x2e2ca6,_0x44f340,_0x26bfc3[_0x2c09('0xc6')]);}}}})[_0x2c09('0x9d')](function(){if(_0x3f3fd1){hopperUtils[_0x2c09('0xe6')](_0x381611,_0xddd60a,_0x56a215)[_0x2c09('0x9d')](function(){return _0x2e2ca6(0x1);});}});});};Dialer[_0x2c09('0x85')]['stateGlobal']=function(_0x47a46b,_0x280161,_0x5a74f8,_0xa45ae5){var _0x38e27b=new Final(_0x47a46b);_0x38e27b['state']=0xf;_0x38e27b['statedesc']=_0x2c09('0x1b1');this['createStateFinal'](_0x38e27b,_0x280161,_0x5a74f8,_0xa45ae5);};Dialer[_0x2c09('0x85')][_0x2c09('0x12a')]=function(_0x574bf4,_0x313abe,_0x4b8e94,_0x2441c9){hopperUtils[_0x2c09('0xcc')](_0x574bf4)['then'](function(){return _0x313abe(msgResponse('[callProgressDetecting]','Success',_0x2441c9));})[_0x2c09('0xa4')](function(){return _0x4b8e94(msgResponse(_0x2c09('0x1b2'),_0x2c09('0x93'),_0x2c09('0x1b3')));});};Dialer[_0x2c09('0x85')]['predictive']=function(_0x4d274c){var _0x3a1999=_0x4d274c[_0x2c09('0x1b4')]/0x64;var _0x2f13f0=_0x4d274c['outboundDropCallsDayTimeout']/(_0x4d274c[_0x2c09('0x1b5')]+_0x4d274c[_0x2c09('0xc5')]);var _0x4d56db=Math[_0x2c09('0x1b6')](_0x4d274c['predictiveIntervalAvailable']*(_0x4d274c[_0x2c09('0x1b7')]/0x64));var _0x2a7df4=Math[_0x2c09('0x1b6')](_0x4d274c['predictiveIntervalAvailable']*(_0x4d274c['predictiveIntervalMinThreshold']/0x64));var _0x4dbb18=_0x4d274c[_0x2c09('0x13b')]+_0x4d274c[_0x2c09('0x13d')];var _0x46a9f4=Math[_0x2c09('0x1b8')](_0x4d274c[_0x2c09('0x5a')]*_0x4d274c[_0x2c09('0x5e')]*_0x4d274c[_0x2c09('0x1b9')]*_0x4d274c[_0x2c09('0x1ba')]);if(_['isUndefined'](_0x4d274c[_0x2c09('0x26')])){if(!_['isUndefined'](_0x4d274c['startPredictive'])){_0x4d274c[_0x2c09('0x25')]=undefined;loggerPredictive[_0x2c09('0x65')](_0x2c09('0x1bb'),_0x2c09('0x1bc'));}if(!_[_0x2c09('0x3f')](_0x4d274c[_0x2c09('0x63')])){loggerPredictive[_0x2c09('0x65')](_0x2c09('0x1bb'),_0x2c09('0x1bd'));clearInterval(_0x4d274c[_0x2c09('0x63')]);_0x4d274c[_0x2c09('0x63')]=undefined;}_0x4d274c['startProgressive']=moment()[_0x2c09('0x45')](_0x2c09('0xc4'));loggerPredictive[_0x2c09('0x49')](_0x4d274c[_0x2c09('0x47')],_0x2c09('0x1be'),_0x4d274c[_0x2c09('0x26')]);this[_0x2c09('0xb7')](_0x4d274c,0x1);}else if(ifInterval(_0x4d274c[_0x2c09('0x1bf')],_0x4d274c['startProgressive'])){this['handlePower'](_0x4d274c,0x1);loggerPredictiveCalls[_0x2c09('0x49')](_0x2c09('0x1c0'),_0x4d274c[_0x2c09('0x26')],_0x4d274c[_0x2c09('0x47')]);_0x4d274c[_0x2c09('0x5a')]=0x0;_0x4d274c['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x3a1999<_0x2f13f0&&_0x4d274c['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x4d274c);loggerPredictive['info'](_0x2c09('0x1c1'),_0x2c09('0x1c2'),_0x2f13f0,_0x2c09('0x26'),_0x4d274c['name']);}else if(_0x46a9f4<_0x4d274c[_0x2c09('0xd2')]&&_0x4d274c['dialPredictiveOptimization']===_0x2c09('0x1c3')){clearPredictiveAttributes(_0x4d274c);loggerPredictive[_0x2c09('0x49')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x2c09('0x1c4'),_0x46a9f4,'Drop\x20in\x20this\x20interval',_0x4d274c[_0x2c09('0xd2')],_0x2c09('0x26'),_0x4d274c[_0x2c09('0x47')]);}else if(!ifInterval(_0x4d274c[_0x2c09('0x1bf')],_0x4d274c[_0x2c09('0x26')])&&_['isUndefined'](_0x4d274c[_0x2c09('0x25')])&&!_[_0x2c09('0x3f')](_0x4d274c[_0x2c09('0x26')])){_0x4d274c[_0x2c09('0x25')]=moment()['format'](_0x2c09('0xc4'));loggerPredictive[_0x2c09('0x49')](_0x4d274c[_0x2c09('0x47')],'started\x20in\x20predictive\x20at',_0x4d274c[_0x2c09('0x25')]);hopperUtils[_0x2c09('0x1c5')](_0x4d274c[_0x2c09('0x1bf')])[_0x2c09('0x9d')](this['getDataPredictive'](_0x4d274c))['then'](mergeDataErlangB(_0x4d274c))[_0x2c09('0x9d')](this[_0x2c09('0x1c6')](_0x4d274c))[_0x2c09('0xa4')](loggerCatchPredictive(_0x2c09('0x1c7'),_0x4d274c));}else if(!ifInterval(_0x4d274c[_0x2c09('0x1bf')],_0x4d274c['startPredictive'])){_0x4d274c['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x4d274c[_0x2c09('0x25')]=moment()['format'](_0x2c09('0xc4'));loggerPredictive[_0x2c09('0x49')](_0x4d274c[_0x2c09('0x47')],_0x2c09('0x1c8'),_0x4d274c[_0x2c09('0x25')]);clearInterval(_0x4d274c[_0x2c09('0x63')]);_0x4d274c['handlePredictive']=undefined;hopperUtils[_0x2c09('0x1c5')](_0x4d274c[_0x2c09('0x1bf')])[_0x2c09('0x9d')](this[_0x2c09('0x1c9')](_0x4d274c))[_0x2c09('0x9d')](mergeDataErlangB(_0x4d274c))[_0x2c09('0x9d')](this[_0x2c09('0x1c6')](_0x4d274c))['catch'](loggerCatchPredictive(_0x2c09('0x1ca'),_0x4d274c));}else if(_0x4d274c[_0x2c09('0x1cb')]&&_0x4dbb18<_0x4d274c['predictiveIntervalAvailable']-_0x2a7df4){clearPredictiveAttributes(_0x4d274c);loggerPredictive[_0x2c09('0x49')](_0x4d274c[_0x2c09('0x47')],_0x2c09('0x1cc'),_0x4dbb18,_0x2c09('0x1cd'),_0x4d274c[_0x2c09('0x1cb')],'-',_0x2a7df4,'=',_0x4d274c[_0x2c09('0x1cb')]-_0x2a7df4,')');}else if(_0x4d274c[_0x2c09('0x1cb')]&&_0x4dbb18>_0x4d274c[_0x2c09('0x1cb')]+_0x4d56db){clearPredictiveAttributes(_0x4d274c);loggerPredictive[_0x2c09('0x49')](_0x4d274c[_0x2c09('0x47')],_0x2c09('0x1cc'),_0x4dbb18,_0x2c09('0x1ce'),_0x4d274c['predictiveIntervalAvailable'],'+',_0x4d56db,'=',_0x4d274c[_0x2c09('0x1cb')]+_0x4d56db,')');}};Dialer[_0x2c09('0x85')][_0x2c09('0x1c9')]=function(_0xa65610){var _0x1d7048=this;return function(_0x7c19aa){return new Promise(function(_0x1be0a0,_0x3b4ed3){_['merge'](_0xa65610,_0x7c19aa[0x0]);if(checkGetDataPredictive(_0x7c19aa[0x0])){var _0x4b244f=_0xa65610['predictiveIntervalAvailable']=_0xa65610['talking']+_0xa65610[_0x2c09('0x13b')];var _0x34c56e=_0xa65610[_0x2c09('0x1bf')]*0x3c;var _0x50d028=_0x7c19aa[0x0][_0x2c09('0x55')]+_0x7c19aa[0x0][_0x2c09('0x54')];var _0x523654=(_0x7c19aa[0x0][_0x2c09('0x4e')]+_0x7c19aa[0x0][_0x2c09('0x50')]+_0x7c19aa[0x0][_0x2c09('0x52')])/_0x7c19aa[0x0][_0x2c09('0x4c')];_0xa65610[_0x2c09('0x1b9')]=_0x523654>0x0?_0x523654:0x1;switch(_0xa65610['dialPredictiveOptimization']){case _0x2c09('0x1c3'):var _0x5f3762=_0xa65610['dialPredictiveOptimizationPercentage']/0x64;return _0x1d7048[_0x2c09('0x1cf')](_0x4b244f,_0x34c56e,_0x50d028,_0x523654,_0x5f3762)[_0x2c09('0x9d')](function(_0x5aa5c7){return _0x1be0a0(_0x5aa5c7);});case _0x2c09('0x1d0'):var _0xe73718=_0xa65610[_0x2c09('0x1b4')]/0x64;return _0x1d7048['busyFactor'](_0x4b244f,_0x34c56e,_0x50d028,_0x523654,_0xe73718)[_0x2c09('0x9d')](function(_0x1c99f3){return _0x1be0a0(_0x1c99f3);});default:return _0x3b4ed3(msgResponse('[getDataPredictive]',_0x2c09('0x93'),_0x2c09('0x1d1')));}}else{return _0x3b4ed3(msgResponse(_0x2c09('0x1d2'),'Failure',_0x2c09('0x1d3')));}});};};Dialer[_0x2c09('0x85')][_0x2c09('0x1d4')]=function(_0x3641b4){var _0x3c414c=this;return function(_0x273874){return new Promise(function(_0x5af621,_0x1518c0){_[_0x2c09('0x60')](_0x3641b4,_0x273874[0x0]);if(checkGetDataPredictive(_0x273874[0x0])){loggerPredictive[_0x2c09('0x49')](JSON[_0x2c09('0x71')](_0x273874[0x0]));if(_0x3641b4[_0x2c09('0x1d5')]===_0x2c09('0x1c3')){return _0x3c414c[_0x2c09('0x150')](_0x3641b4['id'])[_0x2c09('0x9d')](function(_0x2b1429){var _0x3388e9=_0x3641b4[_0x2c09('0x1d6')]-_0x2b1429[0x0]['outboundQueuePauses'];var _0x548ec5=_0x3641b4[_0x2c09('0x1bf')]*0x3c;var _0x25f944=_0x273874[0x0][_0x2c09('0x55')]+_0x273874[0x0]['predictiveIntervalAvgHoldtime'];var _0x46e02b=(_0x273874[0x0]['predictiveIntervalAnsweredCalls']+_0x273874[0x0][_0x2c09('0x50')]+_0x273874[0x0][_0x2c09('0x52')])/_0x273874[0x0][_0x2c09('0x4c')];var _0x5bd551=_0x3641b4['dialPredictiveOptimizationPercentage']/0x64;_0x3641b4[_0x2c09('0x1d7')]=_0x2b1429[0x0][_0x2c09('0x1d8')]||0x0;_0x3641b4[_0x2c09('0x1b9')]=_0x46e02b>0x0?_0x46e02b:0x1;return _0x3c414c[_0x2c09('0x1cf')](_0x3388e9,_0x548ec5,_0x25f944,_0x46e02b,_0x5bd551);})['then'](function(_0x1ac974){return _0x5af621(_0x1ac974);})['catch'](function(_0x3211c7){return _0x1518c0(msgResponse(_0x2c09('0x1d9'),_0x2c09('0x93'),JSON['stringify'](_0x3211c7)));});}if(_0x3641b4['dialPredictiveOptimization']===_0x2c09('0x1d0')){return _0x3c414c[_0x2c09('0x150')](_0x3641b4['id'])[_0x2c09('0x9d')](function(_0x318e7d){var _0x36a043=_0x3641b4[_0x2c09('0x1d6')]-_0x318e7d[0x0][_0x2c09('0x1d8')];var _0x31da9d=_0x3641b4[_0x2c09('0x1bf')]*0x3c;var _0x23a19b=_0x273874[0x0][_0x2c09('0x55')]+_0x273874[0x0][_0x2c09('0x54')];var _0x44366b=(_0x273874[0x0][_0x2c09('0x4e')]+_0x273874[0x0][_0x2c09('0x50')]+_0x273874[0x0][_0x2c09('0x52')])/_0x273874[0x0][_0x2c09('0x4c')];var _0x15d6e8=_0x3641b4[_0x2c09('0x1b4')]/0x64;_0x3641b4[_0x2c09('0x1d7')]=_0x318e7d[0x0][_0x2c09('0x1d8')]||0x0;_0x3641b4[_0x2c09('0x1b9')]=_0x44366b>0x0?_0x44366b:0x1;return _0x3c414c[_0x2c09('0x1da')](_0x36a043,_0x31da9d,_0x23a19b,_0x44366b,_0x15d6e8);})[_0x2c09('0x9d')](function(_0x532716){return _0x5af621(_0x532716);})[_0x2c09('0xa4')](function(_0x1d4ba4){return _0x1518c0(msgResponse(_0x2c09('0x1d9'),_0x2c09('0x93'),JSON[_0x2c09('0x71')](_0x1d4ba4)));});}}else{return _0x1518c0(msgResponse('[getDataPredictive]',_0x2c09('0x93'),_0x2c09('0x1d3')));}});};};Dialer[_0x2c09('0x85')][_0x2c09('0x1c6')]=function(_0xec78dc){var _0x2cfbe2=this;return function(){var _0x5a1d5e=0x0;var _0x85c150=Math[_0x2c09('0x1b8')](_0xec78dc[_0x2c09('0x5c')]*0x3e8);if(_0x85c150>0x0){_0x85c150=_0x85c150<0x64?0x64:_0x85c150;loggerPredictive[_0x2c09('0x49')](_0xec78dc['name'],_0x2c09('0x1db'),_0x85c150,_0x2c09('0x1dc'));_0xec78dc['handlePredictive']=setInterval(function(){_0x2cfbe2[_0x2c09('0x63')](_0xec78dc);loggerPredictiveCalls[_0x2c09('0x49')](_0x2c09('0x1dd'),_0x5a1d5e+=0x1);},_0x85c150);}else{loggerPredictive[_0x2c09('0x49')](_0xec78dc[_0x2c09('0x47')],_0x2c09('0x1de'));}};};Dialer['prototype']['checkContactBlack']=function(_0x4a9aef,_0x2122ce){var _0x4894a7=this;return function(_0x498402){if(_[_0x2c09('0x76')](_0x498402)){if(_[_0x2c09('0xf8')](_0x2122ce['UserId'])||!_0x2122ce[_0x2c09('0x1df')]){if(_0x4a9aef[_0x2c09('0xb5')]===_0x2c09('0x7')){_0x4a9aef[_0x2c09('0x6f')]=_['isUndefined'](_0x4a9aef[_0x2c09('0x6f')])?!![]:_0x4a9aef['queueStatusComplete'];var _0x93be1e=uuid['v4']();_0x4894a7['actions'][_0x93be1e]=new Action(_0x4a9aef,_0x2122ce,_0x93be1e);loggerBooked[_0x2c09('0x49')](_0x2c09('0x1e0'),_0x93be1e,_0x2c09('0x1e1'),JSON[_0x2c09('0x71')](_0x4a9aef[_0x2c09('0x6f')]),_0x2c09('0x1e2'),_0x4a9aef[_0x2c09('0x47')]);if(_0x4a9aef['queueStatusComplete']){_0x4a9aef['queueStatusComplete']=![];_0x4894a7['queueBooked'][_0x4894a7['actions'][_0x93be1e][_0x2c09('0xc2')]]=[];ami[_0x2c09('0x9b')]({'actionid':_0x93be1e,'action':_0x2c09('0x1e3'),'queue':_0x4a9aef[_0x2c09('0x47')]})['catch'](function(){_0x4894a7[_0x2c09('0xce')](_0x4a9aef);hopperUtils[_0x2c09('0xdc')]({'active':![],'ContactId':_0x4894a7['actions'][_0x93be1e]['ContactId'],'ListId':_0x4894a7[_0x2c09('0x22')][_0x93be1e][_0x2c09('0xde')],'VoiceQueueId':_0x4894a7['actions'][_0x93be1e]['VoiceQueueId']||undefined,'CampaignId':_0x4894a7[_0x2c09('0x22')][_0x93be1e]['CampaignId']||undefined})[_0x2c09('0xa4')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4894a7[_0x2c09('0x22')][_0x93be1e];});}else{loggerBooked[_0x2c09('0x49')](_0x2c09('0x1e4'),JSON['stringify'](_0x4a9aef['queueStatusComplete']),_0x2c09('0x1e2'),_0x4a9aef[_0x2c09('0x47')]);_0x4894a7['updateOriginated'](_0x4a9aef);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x4894a7[_0x2c09('0x22')][_0x93be1e][_0x2c09('0xdd')],'ListId':_0x4894a7[_0x2c09('0x22')][_0x93be1e][_0x2c09('0xde')],'VoiceQueueId':_0x4894a7['actions'][_0x93be1e]['VoiceQueueId']||undefined,'CampaignId':_0x4894a7[_0x2c09('0x22')][_0x93be1e]['CampaignId']||undefined})['catch'](loggerCatch(_0x2c09('0x1e5')));delete _0x4894a7['actions'][_0x93be1e];}}else{return _0x4894a7[_0x2c09('0x159')](_0x4a9aef,_0x2122ce);}}else{if(utils[_0x2c09('0x61')](undefined,_0x2122ce[_0x2c09('0x1e6')])<_0x4a9aef['dialRecallMeTimeout']*0x3c){if(_0x2122ce[_0x2c09('0x158')]&&!_0x2122ce[_0x2c09('0x158')][_0x2c09('0x1e7')]){_0x4894a7['preview']['run'](_0x2122ce['id'])[_0x2c09('0x1b')](function(){_0x4894a7[_0x2c09('0xce')](_0x4a9aef);});}else{hopperUtils['unlockContact']({'active':![]},_0x2122ce['id'],0x1)[_0x2c09('0x1b')](function(){_0x4894a7[_0x2c09('0xce')](_0x4a9aef);});}}else{_0x4a9aef[_0x2c09('0x1e8')]+=0x1;_0x4894a7[_0x2c09('0xce')](_0x4a9aef);if(_0x4a9aef[_0x2c09('0x1e9')]){hopperUtils[_0x2c09('0xdc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2122ce['ContactId'],'ListId':_0x2122ce[_0x2c09('0xde')],'VoiceQueueId':_0x2122ce[_0x2c09('0xdf')]||undefined,'CampaignId':_0x2122ce[_0x2c09('0xf1')]||undefined})[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x1ea')));hopperUtils[_0x2c09('0xca')](createObjHistory(_0x4a9aef,_0x2122ce,utils[_0x2c09('0x6a')][_0x2c09('0x1eb')],0x17,_0x2c09('0x1ec')))[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x1ed')));}else{_0x4894a7[_0x2c09('0x119')](createObjHistory(_0x4a9aef,_0x2122ce,utils[_0x2c09('0x6a')][_0x2c09('0x1ee')],0x16,_0x2c09('0x1ef')),_0x2c09('0x1f0'),_0x2c09('0x1f1'));}}}}else{_0x4a9aef[_0x2c09('0x1f2')]+=0x1;_0x4894a7[_0x2c09('0x119')](createObjHistory(_0x4a9aef,_0x2122ce,utils[_0x2c09('0x6a')][_0x2c09('0x1f3')],0xd,_0x2c09('0x1f4')),_0x2c09('0x1f5'),_0x2c09('0x1f6'));throw _0x2c09('0x1f7');}};};Dialer[_0x2c09('0x85')][_0x2c09('0x1f8')]=function(_0x276305){var _0xb9f79=this;var _0xbf5ba4=_0x276305[_0x2c09('0x1f9')]-_0x276305[_0x2c09('0x7d')];emitCampaignSummary(_0x276305);if(_0xbf5ba4>0x0&&_0x276305['temp']==0x0){if(_0xbf5ba4>this['maxNumberOriginate']){_0xbf5ba4=this['maxNumberOriginate'];}_0x276305[_0x2c09('0x1fa')]=0x1;hopperUtils['getContactDialerIvr'](_0x276305,_0xbf5ba4)[_0x2c09('0x9d')](function(_0x4cc6c3){_0x276305['temp']=0x0;if(_0x4cc6c3){if(!utils['checkContactEmpty'](_0x4cc6c3)){_0x276305[_0x2c09('0x69')]=utils[_0x2c09('0x6a')][_0x2c09('0x6c')];logger[_0x2c09('0x49')](_0x2c09('0x1fb')+_0x276305['name']);}else{_0x276305['originated']+=_0x4cc6c3[_0x2c09('0x102')];_0x276305[_0x2c09('0x69')]=utils[_0x2c09('0x6a')][_0x2c09('0x1fc')];for(var _0x4ac80e=0x0;_0x4ac80e<_0x4cc6c3[_0x2c09('0x102')];_0x4ac80e+=0x1){_0x276305[_0x2c09('0x1fd')]+=0x1;if(_[_0x2c09('0xf8')](_0x4cc6c3[_0x4ac80e])||_[_0x2c09('0xf8')](_0x4cc6c3[_0x4ac80e][_0x2c09('0x175')])||_[_0x2c09('0xf8')](_0x4cc6c3[_0x4ac80e]['phone'])){_0xb9f79[_0x2c09('0x1fe')](_0x2c09('0x1ff'),_0x276305,_0x4cc6c3[_0x4ac80e]);}else{hopperUtils[_0x2c09('0x200')](_[_0x2c09('0x105')](_0x4cc6c3[_0x4ac80e],[_0x2c09('0xf1'),_0x2c09('0x15c')]))[_0x2c09('0x9d')](_0xb9f79['checkContactBlack'](_0x276305,_0x4cc6c3[_0x4ac80e]))['catch'](_0xb9f79[_0x2c09('0x201')](_0x2c09('0x202'),_0x276305));}}}}})[_0x2c09('0xa4')](loggerGetContactDialer(_0x2c09('0x203'),_0x276305,_0xbf5ba4));}};Dialer[_0x2c09('0x85')][_0x2c09('0xb7')]=function(_0x166a24,_0x421bda){var _0x3977f8=this;var _0x7b7c31=[];if(_0x421bda<0x1||_0x166a24[_0x2c09('0xb5')]==='booked'){_0x421bda=0x1;}var _0x7d5a41=Math[_0x2c09('0x1b8')](_0x166a24[_0x2c09('0x13b')]*_0x421bda)-_0x166a24[_0x2c09('0x7d')];if(_0x166a24['dialLimitQueue']>0x0){var _0x18abc9=_0x166a24['dialLimitQueue']-_0x166a24[_0x2c09('0x7d')]-_0x166a24[_0x2c09('0x13d')]-_0x166a24['pTalking'];if(_0x7d5a41>_0x18abc9){_0x7d5a41=_0x18abc9;}}if(_0x7d5a41>0x0&&_0x166a24[_0x2c09('0x1fa')]==0x0){if(_0x166a24[_0x2c09('0xb5')]===_0x2c09('0x7')){_0x7d5a41=0x1;}if(_0x7d5a41>this[_0x2c09('0x204')]){_0x7d5a41=this[_0x2c09('0x204')];}for(var _0xa65de1 in this['agents']){if(typeof this[_0x2c09('0x20')][_0xa65de1]!==_0x2c09('0xae')){if(this[_0x2c09('0x20')][_0xa65de1][_0x2c09('0xe1')]===_0x2c09('0x205')&&this[_0x2c09('0x20')][_0xa65de1][_0x2c09('0x8a')]===_0x2c09('0x8b')){_0x7b7c31[_0x2c09('0xa1')](this[_0x2c09('0x20')][_0xa65de1]['id']);}}}_0x166a24['temp']=0x1;hopperUtils[_0x2c09('0x206')](_0x166a24,_0x7b7c31,_0x7d5a41)[_0x2c09('0x9d')](function(_0x3a99f8){_0x166a24[_0x2c09('0x1fa')]=0x0;if(_0x3a99f8){if(!utils[_0x2c09('0x207')](_0x3a99f8)){hopperUtils[_0x2c09('0x208')](_0x166a24)[_0x2c09('0x9d')](sendMessageReschedule(_0x166a24))[_0x2c09('0xa4')](loggerCatch(_0x2c09('0x209')));}else{_0x166a24[_0x2c09('0x7d')]+=_0x3a99f8['length'];_0x166a24[_0x2c09('0x69')]=_0x166a24[_0x2c09('0xb5')]===_0x2c09('0x7')?utils[_0x2c09('0x6a')][_0x2c09('0x13f')]:utils[_0x2c09('0x6a')][_0x2c09('0x1fc')];for(var _0x11ee16=0x0;_0x11ee16<_0x3a99f8[_0x2c09('0x102')];_0x11ee16+=0x1){if(_[_0x2c09('0xf8')](_0x3a99f8[_0x11ee16])||_[_0x2c09('0xf8')](_0x3a99f8[_0x11ee16][_0x2c09('0x175')])||_['isNil'](_0x3a99f8[_0x11ee16][_0x2c09('0x15c')])){_0x3977f8[_0x2c09('0x1fe')](_0x2c09('0x1ff'),_0x166a24,_0x3a99f8[_0x11ee16]);}else{hopperUtils['checkIsBlackList'](_[_0x2c09('0x105')](_0x3a99f8[_0x11ee16],['VoiceQueueId','phone']))[_0x2c09('0x9d')](_0x3977f8[_0x2c09('0x20a')](_0x166a24,_0x3a99f8[_0x11ee16]))['catch'](_0x3977f8['loggerHandler'](_0x2c09('0x1ff'),_0x166a24));}}}}})[_0x2c09('0xa4')](loggerGetContactDialer(_0x2c09('0x20b'),_0x166a24,_0x7d5a41));}};Dialer[_0x2c09('0x85')]['handlePredictive']=function(_0x19bbf1){if(_0x19bbf1[_0x2c09('0x20c')]>0x0){var _0x4559e9=_0x19bbf1[_0x2c09('0x20c')]-_0x19bbf1[_0x2c09('0x7d')]-_0x19bbf1[_0x2c09('0x13d')];if(_0x4559e9>0x0&&_0x19bbf1[_0x2c09('0x1fa')]==0x0){this['tryOriginatePredictive'](_0x19bbf1);}else{loggerPredictiveCalls[_0x2c09('0x49')](_0x2c09('0x20d'));}}else{this['tryOriginatePredictive'](_0x19bbf1);}};Dialer[_0x2c09('0x85')][_0x2c09('0x20e')]=function(_0x863ac7){var _0x56c544=this;var _0x3d316c=[];_0x863ac7[_0x2c09('0x7d')]+=0x1;for(var _0x17c9c2 in this[_0x2c09('0x20')]){if(typeof this['agents'][_0x17c9c2]!==_0x2c09('0xae')){if(this[_0x2c09('0x20')][_0x17c9c2][_0x2c09('0xe1')]===_0x2c09('0x205')&&this[_0x2c09('0x20')][_0x17c9c2][_0x2c09('0x8a')]===_0x2c09('0x8b')){_0x3d316c['push'](this[_0x2c09('0x20')][_0x17c9c2]['id']);}}}_0x863ac7['temp']=0x1;return this['getContactDialer'](_0x863ac7['id'],_0x3d316c,0x1,_0x863ac7['dialOrderByScheduledAt'],_0x863ac7)[_0x2c09('0x9d')](function(_0x4d7d80){_0x863ac7[_0x2c09('0x1fa')]=0x1;if(_0x4d7d80){if(!utils[_0x2c09('0x207')](_0x4d7d80)){utils[_0x2c09('0x67')](_0x863ac7,0x1,0x0);return hopperUtils['countReScheduled'](_0x863ac7)[_0x2c09('0x9d')](sendMessageReschedule(_0x863ac7))['catch'](loggerCatch(_0x2c09('0x209')));}else{_0x863ac7['message']=utils[_0x2c09('0x6a')][_0x2c09('0x1fc')];if(_[_0x2c09('0xf8')](_0x4d7d80[0x0])||_[_0x2c09('0xf8')](_0x4d7d80[0x0][_0x2c09('0x175')])||_[_0x2c09('0xf8')](_0x4d7d80[0x0][_0x2c09('0x15c')])){_0x56c544[_0x2c09('0x1fe')](_0x2c09('0x1ff'),_0x863ac7,_0x4d7d80[0x0]);}else{return hopperUtils[_0x2c09('0x20f')](_['pick'](_0x4d7d80[0x0],[_0x2c09('0xdf'),_0x2c09('0x15c')]))['then'](_0x56c544[_0x2c09('0x20a')](_0x863ac7,_0x4d7d80[0x0]))[_0x2c09('0xa4')](_0x56c544['loggerHandler'](_0x2c09('0x210'),_0x863ac7));}}}})[_0x2c09('0xa4')](loggerGetContactDialer('[getContactDialerPredictive]',_0x863ac7,0x1));};Dialer['prototype'][_0x2c09('0x1cf')]=function(_0x453373,_0x16e3ae,_0x3098ae,_0x20c737,_0x2ef9fd,_0x5dd29a){loggerPredictive[_0x2c09('0x49')](_0x2c09('0x211'));loggerPredictive[_0x2c09('0x49')](_0x2c09('0x212'),_0x453373);loggerPredictive[_0x2c09('0x49')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x16e3ae);loggerPredictive['info']('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',_0x3098ae);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x213'),_0x20c737);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x214'),_0x2ef9fd);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x56'));return new Promise(function(_0xefa0ff,_0x2b3c3f){if(_0x453373<=0x0||isNaN(_0x453373)){return _0x2b3c3f(msgResponse(_0x2c09('0x215'),_0x2c09('0x84'),_0x2c09('0x216')+_0x453373));}if(_0x3098ae<=0x0||isNaN(_0x3098ae)){return _0x2b3c3f(msgResponse(_0x2c09('0x215'),'Error','Ts\x20=\x20'+_0x3098ae));}if(_0x20c737<=0x0||isNaN(_0x20c737)){return _0x2b3c3f(msgResponse(_0x2c09('0x215'),_0x2c09('0x84'),_0x2c09('0x217')+_0x20c737));}if(_0x16e3ae<=0x0||isNaN(_0x16e3ae)){return _0x2b3c3f(msgResponse(_0x2c09('0x215'),_0x2c09('0x84'),_0x2c09('0x218')+_0x16e3ae));}if(_0x2ef9fd<=0x0||isNaN(_0x2ef9fd)){return _0x2b3c3f(msgResponse(_0x2c09('0x215'),'Error','Amax\x20=\x20'+_0x2ef9fd));}_0x5dd29a=_0x5dd29a||0x0;var _0x1aac6e=0x1/_0x3098ae;var _0x5c899a=0x0;var _0x348d13=0x0;var _0x4e5c2b=0x0;var _0x1834e9=0x0;for(var _0x57d378=0x0;_0x4e5c2b<_0x2ef9fd;_0x57d378+=0x1){_0x348d13=_0x57d378/_0x16e3ae;_0x5c899a=(_0x20c737*_0x348d13+_0x5dd29a)/_0x1aac6e;_0x4e5c2b=utils['erlangb'](_0x5c899a,_0x453373);_0x1834e9=_0x5c899a/_0x453373*(0x1-utils['erlangb'](_0x5c899a,_0x453373));}return _0xefa0ff({'erlangCalls':_0x57d378,'erlangCallToSecond':_0x16e3ae/_0x57d378,'erlangAbandonmentRate':_0x4e5c2b,'erlangBusyFactor':_0x1834e9});});};Dialer[_0x2c09('0x85')]['busyFactor']=function(_0x418b8a,_0x27c5c4,_0x5617b8,_0x421616,_0x4f9e8c,_0x2d109e){loggerPredictive[_0x2c09('0x49')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive['info'](_0x2c09('0x212'),_0x418b8a);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x219'),_0x27c5c4);loggerPredictive['info'](_0x2c09('0x21a'),_0x5617b8);loggerPredictive['info'](_0x2c09('0x213'),_0x421616);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x21b'),_0x4f9e8c);loggerPredictive[_0x2c09('0x49')](_0x2c09('0x56'));return new Promise(function(_0x5928ed,_0x315637){if(_0x418b8a<=0x0||isNaN(_0x418b8a)){return _0x315637(msgResponse(_0x2c09('0x21c'),'Error',_0x2c09('0x216')+_0x418b8a));}if(_0x5617b8<=0x0||isNaN(_0x5617b8)){return _0x315637(msgResponse(_0x2c09('0x21c'),'Error',_0x2c09('0x21d')+_0x5617b8));}if(_0x421616<=0x0||isNaN(_0x421616)){return _0x315637(msgResponse(_0x2c09('0x21c'),_0x2c09('0x84'),'p\x20=\x20'+_0x421616));}if(_0x27c5c4<=0x0||isNaN(_0x27c5c4)){return _0x315637(msgResponse(_0x2c09('0x21c'),'Error','interval\x20=\x20'+_0x27c5c4));}if(_0x4f9e8c<=0x0||isNaN(_0x4f9e8c)){return _0x315637(msgResponse(_0x2c09('0x21c'),_0x2c09('0x84'),'Umin\x20=\x20'+_0x4f9e8c));}_0x2d109e=_0x2d109e||0x0;var _0x4cb61f=0x1/_0x5617b8;var _0x383781=0x0;var _0x988ba2=0x0;var _0x209283=0x0;var _0x12f885=0x0;for(var _0x409be3=0x0;_0x12f885<_0x4f9e8c;_0x409be3+=0x1){_0x988ba2=_0x409be3/_0x27c5c4;_0x383781=(_0x421616*_0x988ba2+_0x2d109e)/_0x4cb61f;_0x209283=utils[_0x2c09('0x21e')](_0x383781,_0x418b8a);_0x12f885=_0x383781/_0x418b8a*(0x1-utils[_0x2c09('0x21e')](_0x383781,_0x418b8a));}return _0x5928ed({'erlangCalls':_0x409be3,'erlangCallToSecond':_0x27c5c4/_0x409be3,'erlangAbandonmentRate':_0x209283,'erlangBusyFactor':_0x12f885});});};module[_0x2c09('0x21f')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 159274d..8cac14c 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4084=['getQueue','exports','util','lodash','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit'];(function(_0x1799b3,_0x2de866){var _0xe1b6e=function(_0x1ffb28){while(--_0x1ffb28){_0x1799b3['push'](_0x1799b3['shift']());}};_0xe1b6e(++_0x2de866);}(_0x4084,0x86));var _0x4408=function(_0x3d1a09,_0xa5fa84){_0x3d1a09=_0x3d1a09-0x0;var _0x4f218c=_0x4084[_0x3d1a09];return _0x4f218c;};'use strict';var util=require(_0x4408('0x0'));var _=require(_0x4408('0x1'));var moment=require('moment');function checkNameSurname(_0x427252,_0x2bebf9,_0x2cc003){var _0x27d279='';if(!_[_0x4408('0x2')](_0x2bebf9)&&'string'===typeof _0x2bebf9){_0x27d279+=_0x2bebf9;}if(!_['isNil'](_0x2cc003)&&_0x4408('0x3')===typeof _0x2cc003){_0x27d279+='\x20'+_0x2cc003;}if(_0x27d279!==''){return _0x27d279;}return _0x427252;}function Action(_0x244eea,_0x39e55e,_0x2b65bc){this[_0x4408('0x4')]=_0x244eea;this[_0x4408('0x5')]=_0x2b65bc||undefined;this[_0x4408('0x6')]=checkNameSurname(_0x39e55e[_0x4408('0x7')]['phone'],_0x39e55e[_0x4408('0x7')][_0x4408('0x8')],_0x39e55e[_0x4408('0x7')][_0x4408('0x9')]);this[_0x4408('0xa')]=_0x39e55e['phone'];this[_0x4408('0xb')]=_0x244eea[_0x4408('0x6')];this[_0x4408('0xc')]=_0x39e55e[_0x4408('0xc')]||![];this[_0x4408('0xd')]=_0x244eea['type'];this[_0x4408('0xe')]=_0x244eea[_0x4408('0xe')]||0x3;this[_0x4408('0xf')]=_0x39e55e[_0x4408('0xf')];this['countbusyretry']=_0x39e55e[_0x4408('0x10')];this[_0x4408('0x11')]=_0x39e55e[_0x4408('0x11')];this['countnoanswerretry']=_0x39e55e[_0x4408('0x12')];this[_0x4408('0x13')]=_0x39e55e['countnosuchnumberretry'];this['countdropretry']=_0x39e55e['countdropretry'];this[_0x4408('0x14')]=_0x39e55e[_0x4408('0x14')];this[_0x4408('0x15')]=_0x39e55e[_0x4408('0x15')];this[_0x4408('0x16')]=_0x39e55e[_0x4408('0x16')];this['ContactId']=_0x39e55e[_0x4408('0x17')];this[_0x4408('0x18')]=_0x39e55e[_0x4408('0x18')];this[_0x4408('0x19')]=_0x39e55e[_0x4408('0x19')];this[_0x4408('0x1a')]=_0x39e55e[_0x4408('0x1a')];this[_0x4408('0x1b')]=_0x39e55e[_0x4408('0x1b')];this['idHopper']=_0x39e55e['id'];this[_0x4408('0x1c')]=_0x39e55e['Contact'][_0x4408('0x8')]||'';this[_0x4408('0x1d')]=moment()[_0x4408('0x1e')](_0x4408('0x1f'));this['callback']=_0x39e55e[_0x4408('0x20')];this[_0x4408('0x21')]=_0x39e55e[_0x4408('0x21')];this[_0x4408('0x22')]=_0x39e55e['callbackat'];this[_0x4408('0x23')]=_0x39e55e[_0x4408('0x23')];this[_0x4408('0x24')]='';this[_0x4408('0x25')]='';}Action[_0x4408('0x26')][_0x4408('0x27')]=function(){return util[_0x4408('0x1e')](_0x4408('0x28'),this['name'],this[_0x4408('0x4')][_0x4408('0x29')]>0x0?this['number']['substring'](this[_0x4408('0x4')][_0x4408('0x29')]):this[_0x4408('0xa')]);};Action[_0x4408('0x26')][_0x4408('0x2a')]=function(){return this[_0x4408('0xb')];};module[_0x4408('0x2b')]=Action; \ No newline at end of file +var _0x28f8=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','prototype','getQueue','exports','util','lodash','moment','isNil','string','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x16e1ab,_0x2aa823){var _0x2d311e=function(_0x3f08bb){while(--_0x3f08bb){_0x16e1ab['push'](_0x16e1ab['shift']());}};_0x2d311e(++_0x2aa823);}(_0x28f8,0xa7));var _0x828f=function(_0x387dc1,_0x3ba649){_0x387dc1=_0x387dc1-0x0;var _0x17567c=_0x28f8[_0x387dc1];return _0x17567c;};'use strict';var util=require(_0x828f('0x0'));var _=require(_0x828f('0x1'));var moment=require(_0x828f('0x2'));function checkNameSurname(_0x54507d,_0x1aaca5,_0x4cb03a){var _0x4dff72='';if(!_[_0x828f('0x3')](_0x1aaca5)&&_0x828f('0x4')===typeof _0x1aaca5){_0x4dff72+=_0x1aaca5;}if(!_[_0x828f('0x3')](_0x4cb03a)&&_0x828f('0x4')===typeof _0x4cb03a){_0x4dff72+='\x20'+_0x4cb03a;}if(_0x4dff72!==''){return _0x4dff72;}return _0x54507d;}function Action(_0x580c92,_0x2222b4,_0x242fd6){this['voiceQueue']=_0x580c92;this[_0x828f('0x5')]=_0x242fd6||undefined;this[_0x828f('0x6')]=checkNameSurname(_0x2222b4[_0x828f('0x7')][_0x828f('0x8')],_0x2222b4[_0x828f('0x7')][_0x828f('0x9')],_0x2222b4[_0x828f('0x7')][_0x828f('0xa')]);this[_0x828f('0xb')]=_0x2222b4['phone'];this[_0x828f('0xc')]=_0x580c92[_0x828f('0x6')];this['active']=_0x2222b4[_0x828f('0xd')]||![];this[_0x828f('0xe')]=_0x580c92[_0x828f('0xe')];this[_0x828f('0xf')]=_0x580c92[_0x828f('0xf')]||0x3;this[_0x828f('0x10')]=_0x2222b4[_0x828f('0x10')];this['countbusyretry']=_0x2222b4[_0x828f('0x11')];this[_0x828f('0x12')]=_0x2222b4['countcongestionretry'];this[_0x828f('0x13')]=_0x2222b4[_0x828f('0x13')];this[_0x828f('0x14')]=_0x2222b4['countnosuchnumberretry'];this['countdropretry']=_0x2222b4[_0x828f('0x15')];this[_0x828f('0x16')]=_0x2222b4[_0x828f('0x16')];this[_0x828f('0x17')]=_0x2222b4[_0x828f('0x17')];this[_0x828f('0x18')]=_0x2222b4[_0x828f('0x18')];this[_0x828f('0x19')]=_0x2222b4['ContactId'];this[_0x828f('0x1a')]=_0x2222b4['ListId'];this[_0x828f('0x1b')]=_0x2222b4[_0x828f('0x1b')];this['VoiceQueueId']=_0x2222b4[_0x828f('0x1c')];this[_0x828f('0x1d')]=_0x2222b4['CampaignId'];this[_0x828f('0x1e')]=_0x2222b4['id'];this[_0x828f('0x1f')]=_0x2222b4[_0x828f('0x7')][_0x828f('0x9')]||'';this[_0x828f('0x20')]=moment()[_0x828f('0x21')](_0x828f('0x22'));this['callback']=_0x2222b4[_0x828f('0x23')];this[_0x828f('0x24')]=_0x2222b4[_0x828f('0x24')];this['callbackat']=_0x2222b4[_0x828f('0x25')];this[_0x828f('0x26')]=_0x2222b4[_0x828f('0x26')];this[_0x828f('0x27')]='';this['originatecalleridname']='';}Action['prototype'][_0x828f('0x28')]=function(){return util['format'](_0x828f('0x29'),this[_0x828f('0x6')],this[_0x828f('0x2a')][_0x828f('0x2b')]>0x0?this['number']['substring'](this['voiceQueue'][_0x828f('0x2b')]):this['number']);};Action[_0x828f('0x2c')][_0x828f('0x2d')]=function(){return this[_0x828f('0xc')];};module[_0x828f('0x2e')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 78c1028..6fbac37 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x336d=['name','calleridnum','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','../utils','state','statedesc','Answer','scheduledat','type','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname'];(function(_0x38842b,_0x126ec9){var _0x4b56f7=function(_0xee4a6){while(--_0xee4a6){_0x38842b['push'](_0x38842b['shift']());}};_0x4b56f7(++_0x126ec9);}(_0x336d,0xb7));var _0xd336=function(_0x34265d,_0x44c9e5){_0x34265d=_0x34265d-0x0;var _0x3e1c38=_0x336d[_0x34265d];return _0x3e1c38;};'use strict';var moment=require('moment');var utils=require(_0xd336('0x0'));function AgentComplete(_0x49d2e3,_0x2ace95){this[_0xd336('0x1')]=0x4;this[_0xd336('0x2')]=_0xd336('0x3');this[_0xd336('0x4')]=_0x49d2e3[_0xd336('0x4')];this[_0xd336('0x5')]=_0x49d2e3[_0xd336('0x5')];this['campaigntype']=_0x49d2e3[_0xd336('0x5')]==='outbound'?_0xd336('0x6'):_0x49d2e3['type'];this[_0xd336('0x7')]=_0x49d2e3['countbusyretry'];this['countcongestionretry']=_0x49d2e3['countcongestionretry'];this['countnoanswerretry']=_0x49d2e3[_0xd336('0x8')];this[_0xd336('0x9')]=_0x49d2e3[_0xd336('0x7')]+_0x49d2e3[_0xd336('0xa')]+_0x49d2e3[_0xd336('0x8')]+_0x49d2e3[_0xd336('0xb')]+_0x49d2e3[_0xd336('0xc')]+_0x49d2e3['countabandonedretry']+_0x49d2e3['countmachineretry']+_0x49d2e3[_0xd336('0xd')];this[_0xd336('0xb')]=_0x49d2e3[_0xd336('0xb')];this['countdropretry']=_0x49d2e3['countdropretry'];this[_0xd336('0xe')]=_0x49d2e3[_0xd336('0xe')];this['countmachineretry']=_0x49d2e3['countmachineretry'];this[_0xd336('0xd')]=_0x49d2e3[_0xd336('0xd')];this['uniqueid']=_0x2ace95[_0xd336('0xf')];this[_0xd336('0x10')]=_0x49d2e3[_0xd336('0x11')];this[_0xd336('0x12')]=_0x49d2e3['number'];this['starttime']=_0x49d2e3[_0xd336('0x13')];this[_0xd336('0x14')]=_0x49d2e3[_0xd336('0x14')];this[_0xd336('0x15')]=_0x49d2e3[_0xd336('0x15')];this['endtime']=moment()[_0xd336('0x16')](_0xd336('0x17'));this[_0xd336('0x18')]=utils['getSeconds'](_0x49d2e3[_0xd336('0x14')],_0x49d2e3[_0xd336('0x13')]);this['holdtime']=utils[_0xd336('0x19')](_0x49d2e3[_0xd336('0x15')],_0x49d2e3[_0xd336('0x14')]);this[_0xd336('0x1a')]=utils[_0xd336('0x19')](this['endtime'],_0x49d2e3[_0xd336('0x15')]);this[_0xd336('0x6')]=_0x2ace95[_0xd336('0x6')];this[_0xd336('0x1b')]=_0x2ace95['membername'];this['reason']=_0x2ace95[_0xd336('0x1c')];this['callback']=_0x49d2e3[_0xd336('0x1d')];this[_0xd336('0x1e')]=_0x49d2e3[_0xd336('0x1e')];this[_0xd336('0x1f')]=_0x49d2e3['callbackat'];this[_0xd336('0x20')]=_0x49d2e3[_0xd336('0x20')];this[_0xd336('0x21')]=_0x49d2e3[_0xd336('0x21')];this[_0xd336('0x22')]=_0x49d2e3[_0xd336('0x22')];this[_0xd336('0x23')]=_0x49d2e3[_0xd336('0x23')];this[_0xd336('0x24')]=_0x49d2e3['VoiceQueueId'];this['CampaignId']=_0x49d2e3[_0xd336('0x25')];this[_0xd336('0x26')]=_0x49d2e3['originatecalleridnum']||'';this[_0xd336('0x27')]=_0x49d2e3[_0xd336('0x27')]||'';this['agiafterat']=_0x49d2e3['agiafterat'];}module['exports']=AgentComplete; \ No newline at end of file +var _0x4246=['scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','ringtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','Answer'];(function(_0x58128a,_0x8ab991){var _0x56f353=function(_0x925531){while(--_0x925531){_0x58128a['push'](_0x58128a['shift']());}};_0x56f353(++_0x8ab991);}(_0x4246,0xd4));var _0x6424=function(_0x2f80e7,_0x349c8d){_0x2f80e7=_0x2f80e7-0x0;var _0x5a7fa2=_0x4246[_0x2f80e7];return _0x5a7fa2;};'use strict';var moment=require(_0x6424('0x0'));var utils=require(_0x6424('0x1'));function AgentComplete(_0x46ed1c,_0x1660e2){this['state']=0x4;this['statedesc']=_0x6424('0x2');this[_0x6424('0x3')]=_0x46ed1c[_0x6424('0x3')];this[_0x6424('0x4')]=_0x46ed1c[_0x6424('0x4')];this['campaigntype']=_0x46ed1c[_0x6424('0x4')]===_0x6424('0x5')?_0x6424('0x6'):_0x46ed1c[_0x6424('0x4')];this[_0x6424('0x7')]=_0x46ed1c[_0x6424('0x7')];this[_0x6424('0x8')]=_0x46ed1c[_0x6424('0x8')];this[_0x6424('0x9')]=_0x46ed1c[_0x6424('0x9')];this['countglobal']=_0x46ed1c['countbusyretry']+_0x46ed1c[_0x6424('0x8')]+_0x46ed1c['countnoanswerretry']+_0x46ed1c[_0x6424('0xa')]+_0x46ed1c[_0x6424('0xb')]+_0x46ed1c['countabandonedretry']+_0x46ed1c[_0x6424('0xc')]+_0x46ed1c['countagentrejectretry'];this[_0x6424('0xa')]=_0x46ed1c[_0x6424('0xa')];this[_0x6424('0xb')]=_0x46ed1c['countdropretry'];this[_0x6424('0xd')]=_0x46ed1c[_0x6424('0xd')];this[_0x6424('0xc')]=_0x46ed1c[_0x6424('0xc')];this[_0x6424('0xe')]=_0x46ed1c[_0x6424('0xe')];this['uniqueid']=_0x1660e2[_0x6424('0xf')];this[_0x6424('0x10')]=_0x46ed1c[_0x6424('0x11')];this[_0x6424('0x12')]=_0x46ed1c[_0x6424('0x13')];this[_0x6424('0x14')]=_0x46ed1c[_0x6424('0x14')];this[_0x6424('0x15')]=_0x46ed1c[_0x6424('0x15')];this['answertime']=_0x46ed1c[_0x6424('0x16')];this[_0x6424('0x17')]=moment()[_0x6424('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6424('0x19')]=utils[_0x6424('0x1a')](_0x46ed1c[_0x6424('0x15')],_0x46ed1c[_0x6424('0x14')]);this['holdtime']=utils['getSeconds'](_0x46ed1c[_0x6424('0x16')],_0x46ed1c[_0x6424('0x15')]);this[_0x6424('0x1b')]=utils[_0x6424('0x1a')](this[_0x6424('0x17')],_0x46ed1c[_0x6424('0x16')]);this[_0x6424('0x6')]=_0x1660e2[_0x6424('0x6')];this['membername']=_0x1660e2[_0x6424('0x1c')];this['reason']=_0x1660e2[_0x6424('0x1d')];this[_0x6424('0x1e')]=_0x46ed1c[_0x6424('0x1e')];this[_0x6424('0x1f')]=_0x46ed1c[_0x6424('0x1f')];this[_0x6424('0x20')]=_0x46ed1c[_0x6424('0x20')];this['recallme']=_0x46ed1c[_0x6424('0x21')];this[_0x6424('0x22')]=_0x46ed1c['ContactId'];this[_0x6424('0x23')]=_0x46ed1c['ListId'];this[_0x6424('0x24')]=_0x46ed1c['UserId'];this[_0x6424('0x25')]=_0x46ed1c[_0x6424('0x25')];this[_0x6424('0x26')]=_0x46ed1c[_0x6424('0x26')];this['originatecalleridnum']=_0x46ed1c[_0x6424('0x27')]||'';this[_0x6424('0x28')]=_0x46ed1c[_0x6424('0x28')]||'';this['agiafterat']=_0x46ed1c[_0x6424('0x29')];}module[_0x6424('0x2a')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index d6d9e08..ee88087 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x387a=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x5a8729,_0x4b469c){var _0x530c3b=function(_0x2c3532){while(--_0x2c3532){_0x5a8729['push'](_0x5a8729['shift']());}};_0x530c3b(++_0x4b469c);}(_0x387a,0x1d0));var _0xa387=function(_0x28bac5,_0x383975){_0x28bac5=_0x28bac5-0x0;var _0x2eae28=_0x387a[_0x28bac5];return _0x2eae28;};'use strict';function Final(_0x19c510){this[_0xa387('0x0')]=_0x19c510[_0xa387('0x0')];this[_0xa387('0x1')]=_0x19c510['scheduledat'];this['type']=_0x19c510[_0xa387('0x2')];this[_0xa387('0x3')]=_0x19c510[_0xa387('0x2')]==='outbound'?_0xa387('0x4'):_0x19c510['type'];this[_0xa387('0x5')]=_0x19c510[_0xa387('0x5')];this[_0xa387('0x6')]=_0x19c510[_0xa387('0x6')];this[_0xa387('0x7')]=_0x19c510[_0xa387('0x7')];this[_0xa387('0x8')]=_0x19c510[_0xa387('0x5')]+_0x19c510[_0xa387('0x6')]+_0x19c510[_0xa387('0x7')]+_0x19c510[_0xa387('0x9')]+_0x19c510[_0xa387('0xa')]+_0x19c510[_0xa387('0xb')]+_0x19c510['countmachineretry']+_0x19c510[_0xa387('0xc')];this['countnosuchnumberretry']=_0x19c510[_0xa387('0x9')];this[_0xa387('0xa')]=_0x19c510['countdropretry'];this['countabandonedretry']=_0x19c510[_0xa387('0xb')];this[_0xa387('0xd')]=_0x19c510[_0xa387('0xd')];this['countagentrejectretry']=_0x19c510[_0xa387('0xc')];this[_0xa387('0x4')]=_0x19c510[_0xa387('0x4')];this[_0xa387('0xe')]=_0x19c510[_0xa387('0xe')];this[_0xa387('0xf')]=_0x19c510['calleridnum'];this[_0xa387('0x10')]=_0x19c510[_0xa387('0x10')];this[_0xa387('0x11')]=_0x19c510[_0xa387('0x11')];this[_0xa387('0x12')]=_0x19c510[_0xa387('0x11')];this[_0xa387('0x13')]=_0x19c510[_0xa387('0x13')]||0x0;this[_0xa387('0x14')]=_0x19c510[_0xa387('0x14')]||0x0;this['talktime']=_0x19c510['talktime']||0x0;this[_0xa387('0x15')]=_0x19c510[_0xa387('0x15')];this[_0xa387('0x16')]=_0x19c510[_0xa387('0x16')];this[_0xa387('0x17')]=_0x19c510['callbackat'];this[_0xa387('0x18')]=_0x19c510[_0xa387('0x18')];this[_0xa387('0x19')]=_0x19c510[_0xa387('0x19')];this['ListId']=_0x19c510[_0xa387('0x1a')];this[_0xa387('0x1b')]=_0x19c510['UserId'];this[_0xa387('0x1c')]=_0x19c510[_0xa387('0x1c')];this['CampaignId']=_0x19c510[_0xa387('0x1d')];this[_0xa387('0x1e')]=_0x19c510['originatecalleridnum']||'';this[_0xa387('0x1f')]=_0x19c510[_0xa387('0x1f')]||'';this['state']=_0x19c510[_0xa387('0x20')];this[_0xa387('0x21')]=_0x19c510[_0xa387('0x21')];}module[_0xa387('0x22')]=Final; \ No newline at end of file +var _0xe416=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','callback'];(function(_0xd2dfeb,_0x51aa27){var _0x313172=function(_0x4cc2ba){while(--_0x4cc2ba){_0xd2dfeb['push'](_0xd2dfeb['shift']());}};_0x313172(++_0x51aa27);}(_0xe416,0xb7));var _0x6e41=function(_0x51b218,_0x1b7fce){_0x51b218=_0x51b218-0x0;var _0x45b01a=_0xe416[_0x51b218];return _0x45b01a;};'use strict';function Final(_0x18ac4d){this[_0x6e41('0x0')]=_0x18ac4d['uniqueid'];this['scheduledat']=_0x18ac4d[_0x6e41('0x1')];this[_0x6e41('0x2')]=_0x18ac4d['type'];this['campaigntype']=_0x18ac4d[_0x6e41('0x2')]===_0x6e41('0x3')?_0x6e41('0x4'):_0x18ac4d[_0x6e41('0x2')];this[_0x6e41('0x5')]=_0x18ac4d[_0x6e41('0x5')];this[_0x6e41('0x6')]=_0x18ac4d[_0x6e41('0x6')];this[_0x6e41('0x7')]=_0x18ac4d[_0x6e41('0x7')];this[_0x6e41('0x8')]=_0x18ac4d[_0x6e41('0x5')]+_0x18ac4d[_0x6e41('0x6')]+_0x18ac4d['countnoanswerretry']+_0x18ac4d[_0x6e41('0x9')]+_0x18ac4d[_0x6e41('0xa')]+_0x18ac4d['countabandonedretry']+_0x18ac4d[_0x6e41('0xb')]+_0x18ac4d[_0x6e41('0xc')];this[_0x6e41('0x9')]=_0x18ac4d[_0x6e41('0x9')];this['countdropretry']=_0x18ac4d[_0x6e41('0xa')];this[_0x6e41('0xd')]=_0x18ac4d[_0x6e41('0xd')];this[_0x6e41('0xb')]=_0x18ac4d[_0x6e41('0xb')];this[_0x6e41('0xc')]=_0x18ac4d[_0x6e41('0xc')];this[_0x6e41('0x4')]=_0x18ac4d['queue'];this[_0x6e41('0xe')]=_0x18ac4d[_0x6e41('0xe')];this[_0x6e41('0xf')]=_0x18ac4d[_0x6e41('0xf')];this['starttime']=_0x18ac4d[_0x6e41('0x10')];this[_0x6e41('0x11')]=_0x18ac4d[_0x6e41('0x11')];this['endtime']=_0x18ac4d[_0x6e41('0x11')];this[_0x6e41('0x12')]=_0x18ac4d[_0x6e41('0x12')]||0x0;this[_0x6e41('0x13')]=_0x18ac4d[_0x6e41('0x13')]||0x0;this['talktime']=_0x18ac4d['talktime']||0x0;this[_0x6e41('0x14')]=_0x18ac4d['callback'];this[_0x6e41('0x15')]=_0x18ac4d['callbackuniqueid'];this[_0x6e41('0x16')]=_0x18ac4d[_0x6e41('0x16')];this[_0x6e41('0x17')]=_0x18ac4d[_0x6e41('0x17')];this[_0x6e41('0x18')]=_0x18ac4d[_0x6e41('0x18')];this[_0x6e41('0x19')]=_0x18ac4d[_0x6e41('0x19')];this[_0x6e41('0x1a')]=_0x18ac4d[_0x6e41('0x1a')];this[_0x6e41('0x1b')]=_0x18ac4d[_0x6e41('0x1b')];this[_0x6e41('0x1c')]=_0x18ac4d[_0x6e41('0x1c')];this[_0x6e41('0x1d')]=_0x18ac4d[_0x6e41('0x1d')]||'';this[_0x6e41('0x1e')]=_0x18ac4d[_0x6e41('0x1e')]||'';this[_0x6e41('0x1f')]=_0x18ac4d[_0x6e41('0x1f')];this[_0x6e41('0x20')]=_0x18ac4d[_0x6e41('0x20')];}module[_0x6e41('0x21')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index c2013c8..605957e 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd1c5=['UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','Answer','scheduledat','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','name','calleridnum','number','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','getSeconds','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xd1c5,0x190));var _0x5d1c=function(_0x580016,_0x43d564){_0x580016=_0x580016-0x0;var _0x2aaa99=_0xd1c5[_0x580016];return _0x2aaa99;};'use strict';var moment=require(_0x5d1c('0x0'));var utils=require(_0x5d1c('0x1'));function Hangup(_0x2dee64,_0x1f1833){this[_0x5d1c('0x2')]=0x4;this['statedesc']=_0x5d1c('0x3');this[_0x5d1c('0x4')]=_0x2dee64[_0x5d1c('0x4')];this[_0x5d1c('0x5')]=_0x2dee64[_0x5d1c('0x5')];this['campaigntype']=_0x2dee64['type']===_0x5d1c('0x6')?_0x5d1c('0x7'):_0x2dee64[_0x5d1c('0x5')];this[_0x5d1c('0x8')]=_0x2dee64[_0x5d1c('0x8')]||![];this['countbusyretry']=_0x2dee64[_0x5d1c('0x9')];this['countcongestionretry']=_0x2dee64[_0x5d1c('0xa')];this[_0x5d1c('0xb')]=_0x2dee64[_0x5d1c('0xb')];this[_0x5d1c('0xc')]=_0x2dee64[_0x5d1c('0x9')]+_0x2dee64[_0x5d1c('0xa')]+_0x2dee64[_0x5d1c('0xb')]+_0x2dee64[_0x5d1c('0xd')]+_0x2dee64['countdropretry']+_0x2dee64['countabandonedretry']+_0x2dee64[_0x5d1c('0xe')]+_0x2dee64[_0x5d1c('0xf')];this['countnosuchnumberretry']=_0x2dee64[_0x5d1c('0xd')];this[_0x5d1c('0x10')]=_0x2dee64[_0x5d1c('0x10')];this[_0x5d1c('0x11')]=_0x2dee64['countabandonedretry'];this[_0x5d1c('0xe')]=_0x2dee64[_0x5d1c('0xe')];this[_0x5d1c('0xf')]=_0x2dee64[_0x5d1c('0xf')];this[_0x5d1c('0x12')]=_0x1f1833['uniqueid'];this['calleridname']=_0x2dee64[_0x5d1c('0x13')];this[_0x5d1c('0x14')]=_0x2dee64[_0x5d1c('0x15')];this[_0x5d1c('0x16')]=_0x2dee64[_0x5d1c('0x16')];this['responsetime']=_0x2dee64['responsetime'];this[_0x5d1c('0x17')]=moment()[_0x5d1c('0x18')](_0x5d1c('0x19'));this[_0x5d1c('0x1a')]=utils['getSeconds'](_0x2dee64[_0x5d1c('0x1b')],_0x2dee64[_0x5d1c('0x16')]);this[_0x5d1c('0x1c')]=0x0;this['talktime']=utils[_0x5d1c('0x1d')](this[_0x5d1c('0x17')],_0x2dee64[_0x5d1c('0x1b')]);this['queue']=_0x2dee64['queue'];this[_0x5d1c('0x1e')]=_0x5d1c('0x1f');this[_0x5d1c('0x20')]=_0x1f1833[_0x5d1c('0x21')];this['callback']=_0x2dee64[_0x5d1c('0x22')];this[_0x5d1c('0x23')]=_0x2dee64[_0x5d1c('0x23')];this[_0x5d1c('0x24')]=_0x2dee64[_0x5d1c('0x24')];this[_0x5d1c('0x25')]=_0x2dee64[_0x5d1c('0x25')];this[_0x5d1c('0x26')]=_0x2dee64[_0x5d1c('0x26')];this['ListId']=_0x2dee64[_0x5d1c('0x27')];this[_0x5d1c('0x28')]=_0x2dee64['UserId'];this[_0x5d1c('0x29')]=_0x2dee64[_0x5d1c('0x29')];this['CampaignId']=_0x2dee64[_0x5d1c('0x2a')];}module[_0x5d1c('0x2b')]=Hangup; \ No newline at end of file +var _0x9837=['responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','exports','moment','state','statedesc','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','calleridnum','number','starttime'];(function(_0x267656,_0x3e273e){var _0x2a4d02=function(_0x8c63ad){while(--_0x8c63ad){_0x267656['push'](_0x267656['shift']());}};_0x2a4d02(++_0x3e273e);}(_0x9837,0x84));var _0x7983=function(_0x24d34e,_0x5addea){_0x24d34e=_0x24d34e-0x0;var _0x50e117=_0x9837[_0x24d34e];return _0x50e117;};'use strict';var moment=require(_0x7983('0x0'));var utils=require('../utils');function Hangup(_0x49db9e,_0x4fcaba){this[_0x7983('0x1')]=0x4;this[_0x7983('0x2')]='Answer';this['scheduledat']=_0x49db9e['scheduledat'];this[_0x7983('0x3')]=_0x49db9e[_0x7983('0x3')];this['campaigntype']=_0x49db9e[_0x7983('0x3')]===_0x7983('0x4')?_0x7983('0x5'):_0x49db9e[_0x7983('0x3')];this['amd']=_0x49db9e[_0x7983('0x6')]||![];this[_0x7983('0x7')]=_0x49db9e[_0x7983('0x7')];this[_0x7983('0x8')]=_0x49db9e[_0x7983('0x8')];this[_0x7983('0x9')]=_0x49db9e['countnoanswerretry'];this['countglobal']=_0x49db9e[_0x7983('0x7')]+_0x49db9e[_0x7983('0x8')]+_0x49db9e[_0x7983('0x9')]+_0x49db9e['countnosuchnumberretry']+_0x49db9e[_0x7983('0xa')]+_0x49db9e[_0x7983('0xb')]+_0x49db9e[_0x7983('0xc')]+_0x49db9e[_0x7983('0xd')];this['countnosuchnumberretry']=_0x49db9e[_0x7983('0xe')];this[_0x7983('0xa')]=_0x49db9e[_0x7983('0xa')];this[_0x7983('0xb')]=_0x49db9e[_0x7983('0xb')];this[_0x7983('0xc')]=_0x49db9e[_0x7983('0xc')];this[_0x7983('0xd')]=_0x49db9e[_0x7983('0xd')];this[_0x7983('0xf')]=_0x4fcaba[_0x7983('0xf')];this['calleridname']=_0x49db9e[_0x7983('0x10')];this[_0x7983('0x11')]=_0x49db9e[_0x7983('0x12')];this[_0x7983('0x13')]=_0x49db9e[_0x7983('0x13')];this[_0x7983('0x14')]=_0x49db9e[_0x7983('0x14')];this[_0x7983('0x15')]=moment()[_0x7983('0x16')](_0x7983('0x17'));this['ringtime']=utils['getSeconds'](_0x49db9e[_0x7983('0x14')],_0x49db9e[_0x7983('0x13')]);this[_0x7983('0x18')]=0x0;this[_0x7983('0x19')]=utils['getSeconds'](this[_0x7983('0x15')],_0x49db9e[_0x7983('0x14')]);this['queue']=_0x49db9e[_0x7983('0x5')];this[_0x7983('0x1a')]=_0x7983('0x1b');this['reason']=_0x4fcaba[_0x7983('0x1c')];this[_0x7983('0x1d')]=_0x49db9e[_0x7983('0x1d')];this[_0x7983('0x1e')]=_0x49db9e[_0x7983('0x1e')];this[_0x7983('0x1f')]=_0x49db9e[_0x7983('0x1f')];this[_0x7983('0x20')]=_0x49db9e[_0x7983('0x20')];this[_0x7983('0x21')]=_0x49db9e[_0x7983('0x21')];this[_0x7983('0x22')]=_0x49db9e[_0x7983('0x22')];this['UserId']=_0x49db9e[_0x7983('0x23')];this[_0x7983('0x24')]=_0x49db9e[_0x7983('0x24')];this['CampaignId']=_0x49db9e['CampaignId'];}module[_0x7983('0x25')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 728ef57..d7391d1 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x613e=['countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','calleridname','name','calleridnum','starttime','responsetime','endtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x50d7ba,_0x4e1afe){var _0x1c64ae=function(_0x4419a8){while(--_0x4419a8){_0x50d7ba['push'](_0x50d7ba['shift']());}};_0x1c64ae(++_0x4e1afe);}(_0x613e,0x115));var _0xe613=function(_0x4170aa,_0x1f16a9){_0x4170aa=_0x4170aa-0x0;var _0x3f9ae5=_0x613e[_0x4170aa];return _0x3f9ae5;};'use strict';var utils=require('../utils');function History(_0x5ac130){this[_0xe613('0x0')]=_0x5ac130[_0xe613('0x0')];this[_0xe613('0x1')]=_0x5ac130[_0xe613('0x1')]||undefined;this[_0xe613('0x2')]=_0x5ac130[_0xe613('0x2')];this[_0xe613('0x3')]=_0x5ac130[_0xe613('0x2')]===_0xe613('0x4')?_0xe613('0x5'):_0x5ac130['type'];this[_0xe613('0x6')]=_0x5ac130[_0xe613('0x6')];this[_0xe613('0x7')]=_0x5ac130[_0xe613('0x7')];this[_0xe613('0x8')]=_0x5ac130[_0xe613('0x8')];this[_0xe613('0x9')]=_0x5ac130[_0xe613('0x6')]+_0x5ac130[_0xe613('0x7')]+_0x5ac130[_0xe613('0x8')]+_0x5ac130[_0xe613('0xa')]+_0x5ac130['countdropretry']+_0x5ac130[_0xe613('0xb')]+_0x5ac130['countmachineretry']+_0x5ac130[_0xe613('0xc')];this[_0xe613('0xa')]=_0x5ac130[_0xe613('0xa')];this[_0xe613('0xd')]=_0x5ac130['countdropretry'];this[_0xe613('0xb')]=_0x5ac130[_0xe613('0xb')];this[_0xe613('0xe')]=_0x5ac130[_0xe613('0xe')];this[_0xe613('0xc')]=_0x5ac130[_0xe613('0xc')];this[_0xe613('0x5')]=_0x5ac130[_0xe613('0x5')];this[_0xe613('0xf')]=_0x5ac130[_0xe613('0x10')];this[_0xe613('0x11')]=_0x5ac130['number'];this[_0xe613('0x12')]=_0x5ac130['starttime'];this['responsetime']=_0x5ac130[_0xe613('0x13')];this[_0xe613('0x14')]=_0x5ac130['responsetime'];this['ringtime']=utils[_0xe613('0x15')](_0x5ac130[_0xe613('0x13')],_0x5ac130[_0xe613('0x12')]);this[_0xe613('0x16')]=0x0;this[_0xe613('0x17')]=0x0;this[_0xe613('0x18')]=_0x5ac130[_0xe613('0x18')];this[_0xe613('0x19')]=_0x5ac130[_0xe613('0x19')];this[_0xe613('0x1a')]=_0x5ac130[_0xe613('0x1a')];this[_0xe613('0x1b')]=_0x5ac130['recallme'];this['ContactId']=_0x5ac130['ContactId'];this[_0xe613('0x1c')]=_0x5ac130['ListId'];this['UserId']=_0x5ac130['UserId'];this['VoiceQueueId']=_0x5ac130[_0xe613('0x1d')];this[_0xe613('0x1e')]=_0x5ac130[_0xe613('0x1e')];this[_0xe613('0x1f')]=_0x5ac130[_0xe613('0x1f')]||'';this[_0xe613('0x20')]=_0x5ac130[_0xe613('0x20')]||'';this[_0xe613('0x21')]=_0x5ac130['state'];this['statedesc']=_0x5ac130[_0xe613('0x22')];}module[_0xe613('0x23')]=History; \ No newline at end of file +var _0xe2f2=['responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','number','starttime'];(function(_0x239189,_0x1f8fab){var _0x5a545d=function(_0x576228){while(--_0x576228){_0x239189['push'](_0x239189['shift']());}};_0x5a545d(++_0x1f8fab);}(_0xe2f2,0x9f));var _0x2e2f=function(_0x334ab5,_0x33d31b){_0x334ab5=_0x334ab5-0x0;var _0x36303c=_0xe2f2[_0x334ab5];return _0x36303c;};'use strict';var utils=require('../utils');function History(_0x70e0f){this[_0x2e2f('0x0')]=_0x70e0f[_0x2e2f('0x0')];this[_0x2e2f('0x1')]=_0x70e0f['scheduledat']||undefined;this[_0x2e2f('0x2')]=_0x70e0f[_0x2e2f('0x2')];this['campaigntype']=_0x70e0f[_0x2e2f('0x2')]===_0x2e2f('0x3')?'queue':_0x70e0f[_0x2e2f('0x2')];this[_0x2e2f('0x4')]=_0x70e0f[_0x2e2f('0x4')];this[_0x2e2f('0x5')]=_0x70e0f[_0x2e2f('0x5')];this[_0x2e2f('0x6')]=_0x70e0f[_0x2e2f('0x6')];this[_0x2e2f('0x7')]=_0x70e0f[_0x2e2f('0x4')]+_0x70e0f['countcongestionretry']+_0x70e0f[_0x2e2f('0x6')]+_0x70e0f[_0x2e2f('0x8')]+_0x70e0f[_0x2e2f('0x9')]+_0x70e0f[_0x2e2f('0xa')]+_0x70e0f[_0x2e2f('0xb')]+_0x70e0f['countagentrejectretry'];this[_0x2e2f('0x8')]=_0x70e0f[_0x2e2f('0x8')];this['countdropretry']=_0x70e0f['countdropretry'];this[_0x2e2f('0xa')]=_0x70e0f[_0x2e2f('0xa')];this['countmachineretry']=_0x70e0f[_0x2e2f('0xb')];this[_0x2e2f('0xc')]=_0x70e0f['countagentrejectretry'];this['queue']=_0x70e0f['queue'];this['calleridname']=_0x70e0f[_0x2e2f('0xd')];this['calleridnum']=_0x70e0f[_0x2e2f('0xe')];this[_0x2e2f('0xf')]=_0x70e0f[_0x2e2f('0xf')];this[_0x2e2f('0x10')]=_0x70e0f[_0x2e2f('0x10')];this[_0x2e2f('0x11')]=_0x70e0f['responsetime'];this[_0x2e2f('0x12')]=utils[_0x2e2f('0x13')](_0x70e0f[_0x2e2f('0x10')],_0x70e0f['starttime']);this[_0x2e2f('0x14')]=0x0;this[_0x2e2f('0x15')]=0x0;this[_0x2e2f('0x16')]=_0x70e0f[_0x2e2f('0x16')];this[_0x2e2f('0x17')]=_0x70e0f['callbackuniqueid'];this[_0x2e2f('0x18')]=_0x70e0f[_0x2e2f('0x18')];this['recallme']=_0x70e0f['recallme'];this[_0x2e2f('0x19')]=_0x70e0f[_0x2e2f('0x19')];this[_0x2e2f('0x1a')]=_0x70e0f[_0x2e2f('0x1a')];this[_0x2e2f('0x1b')]=_0x70e0f['UserId'];this['VoiceQueueId']=_0x70e0f[_0x2e2f('0x1c')];this[_0x2e2f('0x1d')]=_0x70e0f[_0x2e2f('0x1d')];this[_0x2e2f('0x1e')]=_0x70e0f['originatecalleridnum']||'';this[_0x2e2f('0x1f')]=_0x70e0f[_0x2e2f('0x1f')]||'';this[_0x2e2f('0x20')]=_0x70e0f[_0x2e2f('0x20')];this[_0x2e2f('0x21')]=_0x70e0f[_0x2e2f('0x21')];}module[_0x2e2f('0x22')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index d7d8cca..400e201 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfbf1=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','holdtime','getSeconds','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry'];(function(_0x32ea48,_0x5384e8){var _0xdf885a=function(_0x37f6d3){while(--_0x37f6d3){_0x32ea48['push'](_0x32ea48['shift']());}};_0xdf885a(++_0x5384e8);}(_0xfbf1,0xc9));var _0x1fbf=function(_0x24b59a,_0x56a3dd){_0x24b59a=_0x24b59a-0x0;var _0x184994=_0xfbf1[_0x24b59a];return _0x184994;};'use strict';var utils=require(_0x1fbf('0x0'));function QueueCallerAbandon(_0x5d99d2,_0x13c47f){this[_0x1fbf('0x1')]=_0x5d99d2[_0x1fbf('0x1')];this['type']=_0x5d99d2[_0x1fbf('0x2')];this['campaigntype']=_0x5d99d2[_0x1fbf('0x2')]===_0x1fbf('0x3')?_0x1fbf('0x4'):_0x5d99d2[_0x1fbf('0x2')];this[_0x1fbf('0x5')]=_0x5d99d2[_0x1fbf('0x5')];this[_0x1fbf('0x6')]=_0x5d99d2[_0x1fbf('0x6')];this['countnoanswerretry']=_0x5d99d2['countnoanswerretry'];this[_0x1fbf('0x7')]=_0x5d99d2[_0x1fbf('0x5')]+_0x5d99d2[_0x1fbf('0x6')]+_0x5d99d2[_0x1fbf('0x8')]+_0x5d99d2['countnosuchnumberretry']+_0x5d99d2[_0x1fbf('0x9')]+_0x5d99d2[_0x1fbf('0xa')]+_0x5d99d2[_0x1fbf('0xb')]+_0x5d99d2[_0x1fbf('0xc')];this[_0x1fbf('0xd')]=_0x5d99d2[_0x1fbf('0xd')];this[_0x1fbf('0x9')]=_0x5d99d2[_0x1fbf('0x9')];this[_0x1fbf('0xa')]=_0x5d99d2[_0x1fbf('0xa')];this[_0x1fbf('0xb')]=_0x5d99d2['countmachineretry'];this[_0x1fbf('0xc')]=_0x5d99d2[_0x1fbf('0xc')];this[_0x1fbf('0xe')]=_0x13c47f[_0x1fbf('0xe')];this['calleridname']=_0x5d99d2[_0x1fbf('0xf')];this[_0x1fbf('0x10')]=_0x5d99d2[_0x1fbf('0x11')];this[_0x1fbf('0x12')]=_0x5d99d2['starttime'];this['responsetime']=_0x5d99d2[_0x1fbf('0x13')];this['droptime']=_0x5d99d2[_0x1fbf('0x14')];this[_0x1fbf('0x15')]=_0x5d99d2[_0x1fbf('0x15')];this[_0x1fbf('0x16')]=this['droptime'];this['ringtime']=utils['getSeconds'](_0x5d99d2[_0x1fbf('0x13')],_0x5d99d2[_0x1fbf('0x12')]);this[_0x1fbf('0x17')]=utils[_0x1fbf('0x18')](this[_0x1fbf('0x14')],_0x5d99d2[_0x1fbf('0x13')]);this[_0x1fbf('0x19')]=0x0;this[_0x1fbf('0x4')]=_0x13c47f[_0x1fbf('0x4')];this['membername']=_0x13c47f[_0x1fbf('0x1a')];this[_0x1fbf('0x1b')]=_0x13c47f[_0x1fbf('0x1b')];this[_0x1fbf('0x1c')]=_0x5d99d2[_0x1fbf('0x1c')];this[_0x1fbf('0x1d')]=_0x5d99d2[_0x1fbf('0x1d')];this[_0x1fbf('0x1e')]=_0x5d99d2[_0x1fbf('0x1e')];this[_0x1fbf('0x1f')]=_0x5d99d2[_0x1fbf('0x1f')];this[_0x1fbf('0x20')]=_0x5d99d2['ContactId'];this[_0x1fbf('0x21')]=_0x5d99d2[_0x1fbf('0x21')];this[_0x1fbf('0x22')]=_0x5d99d2[_0x1fbf('0x22')];this['VoiceQueueId']=_0x5d99d2['VoiceQueueId'];this[_0x1fbf('0x23')]=_0x5d99d2[_0x1fbf('0x23')];this[_0x1fbf('0x24')]=_0x5d99d2['originatecalleridnum']||'';this[_0x1fbf('0x25')]=_0x5d99d2[_0x1fbf('0x25')]||'';this[_0x1fbf('0x26')]=_0x5d99d2[_0x1fbf('0x26')];this[_0x1fbf('0x27')]=_0x5d99d2[_0x1fbf('0x27')];this[_0x1fbf('0x28')]=_0x5d99d2[_0x1fbf('0x28')];}module[_0x1fbf('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x1391=['originatecalleridname','agiafterat','statedesc','exports','scheduledat','type','campaigntype','outbound','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','queue','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridnum'];(function(_0xe80ab0,_0x5a4886){var _0x35d631=function(_0x4c418b){while(--_0x4c418b){_0xe80ab0['push'](_0xe80ab0['shift']());}};_0x35d631(++_0x5a4886);}(_0x1391,0x1b1));var _0x1139=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x1391[_0x491a7f];return _0x3d8f44;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x1573a8,_0x14b320){this[_0x1139('0x0')]=_0x1573a8['scheduledat'];this[_0x1139('0x1')]=_0x1573a8[_0x1139('0x1')];this[_0x1139('0x2')]=_0x1573a8['type']===_0x1139('0x3')?'queue':_0x1573a8[_0x1139('0x1')];this['countbusyretry']=_0x1573a8['countbusyretry'];this[_0x1139('0x4')]=_0x1573a8[_0x1139('0x4')];this[_0x1139('0x5')]=_0x1573a8['countnoanswerretry'];this[_0x1139('0x6')]=_0x1573a8[_0x1139('0x7')]+_0x1573a8['countcongestionretry']+_0x1573a8[_0x1139('0x5')]+_0x1573a8[_0x1139('0x8')]+_0x1573a8['countdropretry']+_0x1573a8['countabandonedretry']+_0x1573a8[_0x1139('0x9')]+_0x1573a8['countagentrejectretry'];this[_0x1139('0x8')]=_0x1573a8[_0x1139('0x8')];this['countdropretry']=_0x1573a8['countdropretry'];this[_0x1139('0xa')]=_0x1573a8['countabandonedretry'];this['countmachineretry']=_0x1573a8[_0x1139('0x9')];this[_0x1139('0xb')]=_0x1573a8['countagentrejectretry'];this[_0x1139('0xc')]=_0x14b320[_0x1139('0xc')];this[_0x1139('0xd')]=_0x1573a8[_0x1139('0xe')];this['calleridnum']=_0x1573a8[_0x1139('0xf')];this[_0x1139('0x10')]=_0x1573a8['starttime'];this[_0x1139('0x11')]=_0x1573a8[_0x1139('0x11')];this['droptime']=_0x1573a8[_0x1139('0x12')];this['dropreason']=_0x1573a8[_0x1139('0x13')];this[_0x1139('0x14')]=this[_0x1139('0x12')];this[_0x1139('0x15')]=utils[_0x1139('0x16')](_0x1573a8[_0x1139('0x11')],_0x1573a8[_0x1139('0x10')]);this[_0x1139('0x17')]=utils[_0x1139('0x16')](this[_0x1139('0x12')],_0x1573a8['responsetime']);this['talktime']=0x0;this[_0x1139('0x18')]=_0x14b320[_0x1139('0x18')];this['membername']=_0x14b320[_0x1139('0x19')];this[_0x1139('0x1a')]=_0x14b320['reason'];this[_0x1139('0x1b')]=_0x1573a8['callback'];this[_0x1139('0x1c')]=_0x1573a8['callbackuniqueid'];this[_0x1139('0x1d')]=_0x1573a8[_0x1139('0x1d')];this[_0x1139('0x1e')]=_0x1573a8[_0x1139('0x1e')];this['ContactId']=_0x1573a8['ContactId'];this[_0x1139('0x1f')]=_0x1573a8[_0x1139('0x1f')];this['UserId']=_0x1573a8[_0x1139('0x20')];this[_0x1139('0x21')]=_0x1573a8['VoiceQueueId'];this['CampaignId']=_0x1573a8['CampaignId'];this[_0x1139('0x22')]=_0x1573a8[_0x1139('0x22')]||'';this[_0x1139('0x23')]=_0x1573a8['originatecalleridname']||'';this[_0x1139('0x24')]=_0x1573a8[_0x1139('0x24')];this['state']=_0x1573a8['state'];this[_0x1139('0x25')]=_0x1573a8[_0x1139('0x25')];}module[_0x1139('0x26')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index c0df99e..6c5e2d6 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['[checkIsBlackListIvr]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','util','../../../../config/logger','dialer','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','error','[getContactDialer]','getContactDialerIvr','temp','[countReScheduled]','countReScheduled','rescheduleContact','unlockContact','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf494,0x1c6));var _0x4f49=function(_0x101b82,_0x26e3ac){_0x101b82=_0x101b82-0x0;var _0xfb5edd=_0xf494[_0x101b82];return _0xfb5edd;};'use strict';var util=require(_0x4f49('0x0'));var logger=require(_0x4f49('0x1'))(_0x4f49('0x2'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0x4f49('0x3'));var cmHopperBlack=require(_0x4f49('0x4'));var cmHopperHistory=require(_0x4f49('0x5'));function inspectError(_0x25677c){return util[_0x4f49('0x6')](_0x25677c,{'showHidden':![],'depth':null});}function getContactDialer(_0x2a15fb,_0x3267c1,_0x790e8b){return cmHopper[_0x4f49('0x7')](_0x2a15fb['id'],_0x3267c1,_0x790e8b,_0x2a15fb[_0x4f49('0x8')])[_0x4f49('0x9')](function(_0x5eb186){_0x2a15fb['temp']=0x0;logger[_0x4f49('0xa')](_0x4f49('0xb'),inspectError(_0x5eb186));});}exports[_0x4f49('0x7')]=getContactDialer;function getContactDialerIvr(_0x30ca57,_0x185174){return cmHopper[_0x4f49('0xc')](_0x30ca57['id'],_0x185174,_0x30ca57[_0x4f49('0x8')])[_0x4f49('0x9')](function(_0x53ee74){_0x30ca57[_0x4f49('0xd')]=0x0;logger[_0x4f49('0xa')]('[getContactDialerIvr]',inspectError(_0x53ee74));});}exports[_0x4f49('0xc')]=getContactDialerIvr;function countReScheduled(_0x5bbc75){return cmHopper['countReScheduled'](_0x5bbc75)[_0x4f49('0x9')](function(_0x12527d){logger['error'](_0x4f49('0xe'),inspectError(_0x12527d));});}exports[_0x4f49('0xf')]=countReScheduled;function rescheduleContact(_0x1b9145){return cmHopper[_0x4f49('0x10')](_0x1b9145)[_0x4f49('0x9')](function(_0x2f0131){logger[_0x4f49('0xa')]('[rescheduleContact]',inspectError(_0x2f0131));});}exports[_0x4f49('0x10')]=rescheduleContact;function unlockContact(_0x1f2d0d,_0x415e83,_0x5878f4){return cmHopper['unlockContact'](_0x1f2d0d,_0x415e83,_0x5878f4)[_0x4f49('0x9')](function(_0x2ecaaa){logger[_0x4f49('0xa')]('[unlockContact]',inspectError(_0x2ecaaa));});}exports[_0x4f49('0x11')]=unlockContact;function moveContactManagedDialer(_0x399be7){return cmHopper[_0x4f49('0x12')](_0x399be7)['catch'](function(_0x5bb23b){logger['error']('[moveContactManagedDialer]',inspectError(_0x5bb23b));});}exports[_0x4f49('0x12')]=moveContactManagedDialer;function checkIsBlackList(_0x1834f4){return cmHopperBlack[_0x4f49('0x13')](_0x1834f4)[_0x4f49('0x9')](function(_0x5793ac){logger[_0x4f49('0xa')](_0x4f49('0x14'),inspectError(_0x5793ac));});}exports[_0x4f49('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0xaab5e7){return cmHopperBlack[_0x4f49('0x15')](_0xaab5e7)['catch'](function(_0x3e7e28){logger[_0x4f49('0xa')](_0x4f49('0x16'),inspectError(_0x3e7e28));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x40755e,_0x1d70a7,_0x32ca7b){return cmHopperAdditionalPhone[_0x4f49('0x17')](_0x40755e,_0x1d70a7,_0x32ca7b)[_0x4f49('0x9')](function(_0x36187b){logger['error']('[verifyAdditionalPhone]',inspectError(_0x36187b));});}exports[_0x4f49('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x429de7,_0x4fedbb,_0x408552){return cmHopperAdditionalPhone[_0x4f49('0x18')](_0x429de7,_0x4fedbb,_0x408552)[_0x4f49('0x9')](function(_0x525950){logger[_0x4f49('0xa')](_0x4f49('0x19'),inspectError(_0x525950));});}exports[_0x4f49('0x18')]=swapAdditionalPhones;function avgHandleTime(_0x148153){return cmHopperHistory[_0x4f49('0x1a')](_0x148153)[_0x4f49('0x9')](function(_0x4915af){logger['error'](_0x4f49('0x1b'),inspectError(_0x4915af));});}exports[_0x4f49('0x1a')]=avgHandleTime;function createHistory(_0x605c91){return cmHopperHistory['createHistory'](_0x605c91)[_0x4f49('0x9')](function(_0x206203){logger[_0x4f49('0xa')]('[createHistory]',inspectError(_0x206203));});}exports['createHistory']=createHistory; \ No newline at end of file +var _0x430c=['[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory','util','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','dialOrderByScheduledAt','temp','error','[getContactDialer]','getContactDialer','getContactDialerIvr','[getContactDialerIvr]','catch','[countReScheduled]','countReScheduled','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]'];(function(_0x644560,_0x1783aa){var _0x41b76b=function(_0xff8c89){while(--_0xff8c89){_0x644560['push'](_0x644560['shift']());}};_0x41b76b(++_0x1783aa);}(_0x430c,0x1a1));var _0xc430=function(_0x5b8b97,_0x6b4dfa){_0x5b8b97=_0x5b8b97-0x0;var _0x1fdf84=_0x430c[_0x5b8b97];return _0x1fdf84;};'use strict';var util=require(_0xc430('0x0'));var logger=require('../../../../config/logger')('dialer');var cmHopper=require(_0xc430('0x1'));var cmHopperAdditionalPhone=require(_0xc430('0x2'));var cmHopperBlack=require(_0xc430('0x3'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x4f0118){return util['inspect'](_0x4f0118,{'showHidden':![],'depth':null});}function getContactDialer(_0x47d8b9,_0x338a82,_0x2408f5){return cmHopper['getContactDialer'](_0x47d8b9['id'],_0x338a82,_0x2408f5,_0x47d8b9[_0xc430('0x4')])['catch'](function(_0x212354){_0x47d8b9[_0xc430('0x5')]=0x0;logger[_0xc430('0x6')](_0xc430('0x7'),inspectError(_0x212354));});}exports[_0xc430('0x8')]=getContactDialer;function getContactDialerIvr(_0x11f4b0,_0x861581){return cmHopper[_0xc430('0x9')](_0x11f4b0['id'],_0x861581,_0x11f4b0[_0xc430('0x4')])['catch'](function(_0x97fa5b){_0x11f4b0[_0xc430('0x5')]=0x0;logger['error'](_0xc430('0xa'),inspectError(_0x97fa5b));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x3b84bc){return cmHopper['countReScheduled'](_0x3b84bc)[_0xc430('0xb')](function(_0x8aa2e6){logger[_0xc430('0x6')](_0xc430('0xc'),inspectError(_0x8aa2e6));});}exports[_0xc430('0xd')]=countReScheduled;function rescheduleContact(_0x2777af){return cmHopper[_0xc430('0xe')](_0x2777af)['catch'](function(_0x4e9134){logger[_0xc430('0x6')](_0xc430('0xf'),inspectError(_0x4e9134));});}exports[_0xc430('0xe')]=rescheduleContact;function unlockContact(_0x2ef538,_0x31d3b7,_0x55cc6c){return cmHopper[_0xc430('0x10')](_0x2ef538,_0x31d3b7,_0x55cc6c)['catch'](function(_0x4bf91f){logger[_0xc430('0x6')](_0xc430('0x11'),inspectError(_0x4bf91f));});}exports[_0xc430('0x10')]=unlockContact;function moveContactManagedDialer(_0x5830b0){return cmHopper['moveContactManagedDialer'](_0x5830b0)[_0xc430('0xb')](function(_0x4c1937){logger[_0xc430('0x6')]('[moveContactManagedDialer]',inspectError(_0x4c1937));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x2f3203){return cmHopperBlack['checkIsBlackList'](_0x2f3203)[_0xc430('0xb')](function(_0x1eae3b){logger[_0xc430('0x6')](_0xc430('0x12'),inspectError(_0x1eae3b));});}exports[_0xc430('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x5af282){return cmHopperBlack[_0xc430('0x14')](_0x5af282)['catch'](function(_0x4d2d43){logger[_0xc430('0x6')](_0xc430('0x15'),inspectError(_0x4d2d43));});}exports[_0xc430('0x14')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x56dd16,_0x3fd56b,_0x57d26e){return cmHopperAdditionalPhone[_0xc430('0x16')](_0x56dd16,_0x3fd56b,_0x57d26e)[_0xc430('0xb')](function(_0x4efecd){logger[_0xc430('0x6')](_0xc430('0x17'),inspectError(_0x4efecd));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x2f9af4,_0x59c498,_0x3aa85e){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x2f9af4,_0x59c498,_0x3aa85e)[_0xc430('0xb')](function(_0x21e28a){logger['error'](_0xc430('0x18'),inspectError(_0x21e28a));});}exports[_0xc430('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x2c0422){return cmHopperHistory[_0xc430('0x1a')](_0x2c0422)[_0xc430('0xb')](function(_0x57cd72){logger[_0xc430('0x6')](_0xc430('0x1b'),inspectError(_0x57cd72));});}exports[_0xc430('0x1a')]=avgHandleTime;function createHistory(_0x1591e3){return cmHopperHistory['createHistory'](_0x1591e3)[_0xc430('0xb')](function(_0x4cf56c){logger[_0xc430('0x6')]('[createHistory]',inspectError(_0x4cf56c));});}exports[_0xc430('0x1c')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index b01c45f..299f31e 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5248=['length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','undefined','description','XMD-','toUpperCase','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','RESCHEDULED_CONTACTS','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TRUNK_IS_NOT_REACHABLE','dialMethod','isIVRCampaign','type','outbound','isOutboundQueue','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','includes','status','TrunkBackup','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','random','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative'];(function(_0x2ae974,_0x11cf4a){var _0x25728f=function(_0x41e153){while(--_0x41e153){_0x2ae974['push'](_0x2ae974['shift']());}};_0x25728f(++_0x11cf4a);}(_0x5248,0x170));var _0x8524=function(_0x1bf757,_0x3bb3d5){_0x1bf757=_0x1bf757-0x0;var _0x3113c2=_0x5248[_0x1bf757];return _0x3113c2;};'use strict';var _=require(_0x8524('0x0'));var moment=require(_0x8524('0x1'));var util=require(_0x8524('0x2'));var logger=require(_0x8524('0x3'))(_0x8524('0x4'));var timezones=require(_0x8524('0x5'))[_0x8524('0x6')];var CAMPAIGN_STATUS={'ACTIVE':_0x8524('0x7'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0x8524('0x8'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x8524('0x9'),'EMPTY_INTERVAL':_0x8524('0xa'),'INACTIVE':_0x8524('0xb'),'NO_AGENTS_LOGGED':_0x8524('0xc'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0x8524('0xd'),'OVERTIME_INTERVAL':_0x8524('0xe'),'OVERTIME_GLOBAL_INTERVAL':_0x8524('0xf'),'QUEUE_RECALL':_0x8524('0x10'),'RECALL_TIMEOUT':_0x8524('0x11'),'RUNNING':_0x8524('0x12'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0x8524('0x13')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x3fafd9){return _0x3fafd9[_0x8524('0x14')]==='preview';}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x549e81){return _0x549e81['type']==='ivr';}exports[_0x8524('0x15')]=isIVRCampaign;function isOutboundQueue(_0x570085){return _0x570085[_0x8524('0x16')]===_0x8524('0x17');}exports[_0x8524('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x3eacaf){return _0x3eacaf['dialActive'];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x195ed1){return _0x195ed1[_0x8524('0x19')];}exports[_0x8524('0x1a')]=isIVRCampaignActive;function getSeconds(_0x297e24,_0x5892a0){var _0x31ad5e=moment(_0x297e24)[_0x8524('0x1b')](0x0);var _0x4e473c=moment(_0x5892a0)['milliseconds'](0x0);return _0x31ad5e[_0x8524('0x1c')](_0x4e473c,_0x8524('0x1d'));}exports[_0x8524('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x4f9159,_0x86c83f){var _0x5ba143=![];var _0x396982=_0x4f9159[_0x8524('0x14')]!==_0x86c83f[_0x8524('0x14')]||_0x4f9159[_0x8524('0x1f')]!==_0x86c83f[_0x8524('0x1f')]||_0x4f9159[_0x8524('0x20')]!==_0x86c83f[_0x8524('0x20')];var _0xea264c=_0x4f9159[_0x8524('0x21')]!==_0x86c83f[_0x8524('0x21')]||_0x4f9159[_0x8524('0x22')]!==_0x86c83f[_0x8524('0x22')]||_0x4f9159['loggedInDb']!==_0x86c83f[_0x8524('0x23')]||_0x4f9159[_0x8524('0x24')]!==_0x86c83f[_0x8524('0x24')]||_0x4f9159[_0x8524('0x25')]!==_0x86c83f[_0x8524('0x25')]||_0x4f9159[_0x8524('0x26')]!==_0x86c83f['pTalking']||_0x4f9159[_0x8524('0x27')]!==_0x86c83f['waiting']||_0x4f9159[_0x8524('0x28')]!==_0x86c83f['inUse']||_0x4f9159[_0x8524('0x29')]!==_0x86c83f[_0x8524('0x29')];if(_0x4f9159[_0x8524('0x2a')]&&_0x86c83f['Trunk']){_0x5ba143=_0x4f9159['Trunk'][_0x8524('0x2b')]!==_0x86c83f[_0x8524('0x2a')]['name']||_0x4f9159[_0x8524('0x2a')][_0x8524('0x19')]!==_0x86c83f[_0x8524('0x2a')][_0x8524('0x19')];}return _0x396982||_0xea264c||_0x5ba143;}exports[_0x8524('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x18b619){var _0x3fa7ae=null;var _0x32af9b=_0x18b619[_0x8524('0x2d')];if(_[_0x8524('0x2e')](_0x18b619[_0x8524('0x2f')])||_[_0x8524('0x2e')](_0x18b619[_0x8524('0x30')])||_['isNil'](_0x18b619[_0x8524('0x30')][_0x8524('0x31')])){_0x3fa7ae=CAMPAIGN_STATUS[_0x8524('0x32')];}else if(_[_0x8524('0x33')](_0x18b619[_0x8524('0x2f')])||_['isEmpty'](_0x18b619[_0x8524('0x30')][_0x8524('0x31')])){_0x3fa7ae=CAMPAIGN_STATUS[_0x8524('0x34')];}else if(_0x32af9b&&!timezones[_0x32af9b]){_0x3fa7ae=CAMPAIGN_STATUS[_0x8524('0x35')];}return _0x3fa7ae;}function checkAnyValidTrunk(_0x57af39,_0x4e31d5){var _0x41323a=null;var _0x57b9fb=_0x8524('0x36');var _0x437314=[_0x8524('0x37'),'unmonitored'];var _0x2f0f72=!![];if(_0x57af39[_0x8524('0x2a')]&&_0x57af39['Trunk'][_0x8524('0x19')]){_0x57b9fb+=_0x57af39['Trunk']['name'];_0x41323a=_0x4e31d5[_0x57b9fb];_0x2f0f72=_0x437314[_0x8524('0x38')](_0x41323a[_0x8524('0x39')]);}else if(_0x57af39[_0x8524('0x3a')]&&_0x57af39[_0x8524('0x3a')][_0x8524('0x19')]){_0x57b9fb+=_0x57af39[_0x8524('0x3a')][_0x8524('0x2b')];_0x41323a=_0x4e31d5[_0x57b9fb];_0x2f0f72=_0x437314[_0x8524('0x38')](_0x41323a[_0x8524('0x39')]);}return _0x2f0f72;}function getQueueCampaignStatusMessage(_0x2197aa,_0x34df25){var _0x51c8a2=CAMPAIGN_STATUS[_0x8524('0x7')];var _0x5a2e93=isPreviewCampaign(_0x2197aa);if(!isQueueCampaignActive(_0x2197aa)){if(_0x5a2e93){_0x51c8a2=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x2197aa['originated']===0x0&&_0x2197aa[_0x8524('0x25')]===0x0&&_0x2197aa['waiting']===0x0&&(_0x2197aa[_0x8524('0x26')]||0x0)===0x0){_0x51c8a2=CAMPAIGN_STATUS['INACTIVE'];}else{_0x51c8a2=CAMPAIGN_STATUS[_0x8524('0x3b')];}}}else if(_0x2197aa[_0x8524('0x22')]===0x0){_0x51c8a2=CAMPAIGN_STATUS[_0x8524('0x3c')];}else if(!checkAnyValidTrunk(_0x2197aa,_0x34df25)){_0x51c8a2=CAMPAIGN_STATUS[_0x8524('0x3d')];}else if(!isPreviewCampaign(_0x2197aa)){var _0x3ce000=checkAnyValidQueueCampaignInterval(_0x2197aa);if(_0x3ce000){_0x51c8a2=_0x3ce000;}}return _0x51c8a2;}exports[_0x8524('0x3e')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x19981a){var _0x318383=CAMPAIGN_STATUS['DISACTIVED'];if(_0x19981a[_0x8524('0x29')]===0x0&&_0x19981a['talking']===0x0&&_0x19981a[_0x8524('0x27')]===0x0&&(_0x19981a[_0x8524('0x26')]||0x0)===0x0){_0x318383=CAMPAIGN_STATUS['INACTIVE'];}return _0x318383;}exports[_0x8524('0x3f')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x552562){var _0x460365=_0x552562[_0x8524('0x40')](/"(.*?)"/);return _0x460365?_0x460365[0x1]:_0x552562;}exports[_0x8524('0x41')]=extractCalleridName;function getCallerId(_0x1a9448,_0x2a6b20,_0x418030){if(!_[_0x8524('0x42')](_0x418030)&&typeof _0x418030===_0x8524('0x43')&&!_[_0x8524('0x33')](_0x418030)){if(!_[_0x8524('0x42')](_0x2a6b20)&&typeof _0x2a6b20===_0x8524('0x43')&&!_[_0x8524('0x33')](_0x2a6b20)){return util['format']('\x22%s\x22\x20<%s>',_0x2a6b20,_0x418030);}return util[_0x8524('0x44')]('\x22%s\x22\x20<%s>',_0x418030,_0x418030);}if(!_[_0x8524('0x42')](_0x1a9448)&&typeof _0x1a9448==='string'&&!_[_0x8524('0x33')](_0x1a9448)){return _0x1a9448;}return _0x8524('0x45');}exports[_0x8524('0x46')]=getCallerId;function getCallerIdRandom(_0x1c3a39,_0x641da7){var _0x44f244;var _0x1d07db;var _0x18107d;if(_0x641da7<=0x0){_0x641da7=0x1;}_0x44f244=new RegExp(_0x8524('0x47')+_0x641da7+'}$');_0x1d07db=Math[_0x8524('0x48')](0xa,_0x641da7-0x1);_0x18107d=Math[_0x8524('0x48')](0xa,_0x641da7)-0x1;return util[_0x8524('0x44')]('%s',_['replace'](_0x1c3a39,_0x44f244,_[_0x8524('0x49')](_0x1d07db,_0x18107d)[_0x8524('0x4a')]()));}exports[_0x8524('0x4b')]=getCallerIdRandom;function decrementOriginate(_0x21ae03){if(_0x21ae03[_0x8524('0x29')]&&_0x21ae03[_0x8524('0x29')]>0x0){_0x21ae03[_0x8524('0x29')]-=0x1;}else{logger['error'](_0x8524('0x4c'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x36e213){return _0x36e213&&_0x36e213[_0x8524('0x4d')]>0x0;}exports[_0x8524('0x4e')]=checkContactEmpty;function erlangb(_0x29f219,_0x5dac18){if(_0x5dac18===0x0){return 0x0;}var _0x40030b=0x1;for(var _0x2ffa3e=0x1;_0x2ffa3e<=_0x5dac18;_0x2ffa3e+=0x1){_0x40030b=0x1+_0x40030b*_0x2ffa3e/_0x29f219;}return 0x1/_0x40030b;}exports[_0x8524('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0x390365,_0x2e3088,_0x477b1a){if(_0x2e3088>_0x477b1a){for(var _0x1420af=0x0;_0x1420af<_0x2e3088-_0x477b1a;_0x1420af+=0x1){decrementOriginate(_0x390365);}}}exports[_0x8524('0x50')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x45d4da){var _0x1ec1d3={};var _0x3c62d3=['id',_0x8524('0x51'),_0x8524('0x52'),_0x8524('0x53')];const _0x2bcaa1=0xfa;if(_0x45d4da){for(var _0x31b0d1 in _0x45d4da){if(typeof _0x45d4da[_0x31b0d1]!==_0x8524('0x54')){if(!_[_0x8524('0x2e')](_0x45d4da[_0x31b0d1])&&!_0x3c62d3[_0x8524('0x38')](_0x31b0d1)){if(_0x31b0d1===_0x8524('0x55')&&_0x45d4da[_0x31b0d1]['length']>_0x2bcaa1){_0x1ec1d3[_0x8524('0x56')+_0x31b0d1[_0x8524('0x57')]()]=_0x45d4da[_0x31b0d1][_0x8524('0x4a')]()['substring'](0x0,_0x2bcaa1);}else{_0x1ec1d3[_0x8524('0x56')+_0x31b0d1[_0x8524('0x57')]()]=_0x45d4da[_0x31b0d1];}}}}}return _0x1ec1d3;}exports[_0x8524('0x58')]=setXMDContactVariables; \ No newline at end of file +var _0x3540=['loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','TrunkBackup','status','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','match','extractCalleridName','string','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','undefined','description','XMD-','toUpperCase','toString','setXMDContactVariables','lodash','moment','../../../../config/logger','dialer','timezones','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','active','isIVRCampaignActive','milliseconds','seconds','message','available'];(function(_0x52732e,_0x3abb82){var _0x243c98=function(_0x25bb94){while(--_0x25bb94){_0x52732e['push'](_0x52732e['shift']());}};_0x243c98(++_0x3abb82);}(_0x3540,0x92));var _0x0354=function(_0x1bee7a,_0xacfa2a){_0x1bee7a=_0x1bee7a-0x0;var _0x5d69d7=_0x3540[_0x1bee7a];return _0x5d69d7;};'use strict';var _=require(_0x0354('0x0'));var moment=require(_0x0354('0x1'));var util=require('util');var logger=require(_0x0354('0x2'))(_0x0354('0x3'));var timezones=require('../../../../config/environment/shared')[_0x0354('0x4')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x0354('0x5'),'EMPTY_INTERVAL':_0x0354('0x6'),'INACTIVE':_0x0354('0x7'),'NO_AGENTS_LOGGED':_0x0354('0x8'),'NO_AVAILABLE_CONTACTS':_0x0354('0x9'),'NULL_INTERVAL':_0x0354('0xa'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x0354('0xb'),'QUEUE_RECALL':_0x0354('0xc'),'RECALL_TIMEOUT':_0x0354('0xd'),'RUNNING':_0x0354('0xe'),'UNKNOWN_TIMEZONE':_0x0354('0xf'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x0354('0x10')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x1a5c5f){return _0x1a5c5f[_0x0354('0x11')]===_0x0354('0x12');}exports[_0x0354('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x276c39){return _0x276c39[_0x0354('0x14')]===_0x0354('0x15');}exports[_0x0354('0x16')]=isIVRCampaign;function isOutboundQueue(_0x55d1e0){return _0x55d1e0[_0x0354('0x14')]===_0x0354('0x17');}exports[_0x0354('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x226fe9){return _0x226fe9[_0x0354('0x19')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x57a83d){return _0x57a83d[_0x0354('0x1a')];}exports[_0x0354('0x1b')]=isIVRCampaignActive;function getSeconds(_0x10b2ad,_0x20e3ec){var _0x509279=moment(_0x10b2ad)[_0x0354('0x1c')](0x0);var _0x39dcf9=moment(_0x20e3ec)[_0x0354('0x1c')](0x0);return _0x509279['diff'](_0x39dcf9,_0x0354('0x1d'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x2f0e40,_0x299f65){var _0x595d88=![];var _0x5b0a69=_0x2f0e40['dialMethod']!==_0x299f65[_0x0354('0x11')]||_0x2f0e40[_0x0354('0x19')]!==_0x299f65[_0x0354('0x19')]||_0x2f0e40['message']!==_0x299f65[_0x0354('0x1e')];var _0x3146e7=_0x2f0e40[_0x0354('0x1f')]!==_0x299f65[_0x0354('0x1f')]||_0x2f0e40[_0x0354('0x20')]!==_0x299f65[_0x0354('0x20')]||_0x2f0e40['loggedInDb']!==_0x299f65[_0x0354('0x21')]||_0x2f0e40[_0x0354('0x22')]!==_0x299f65[_0x0354('0x22')]||_0x2f0e40[_0x0354('0x23')]!==_0x299f65[_0x0354('0x23')]||_0x2f0e40[_0x0354('0x24')]!==_0x299f65['pTalking']||_0x2f0e40['waiting']!==_0x299f65[_0x0354('0x25')]||_0x2f0e40[_0x0354('0x26')]!==_0x299f65[_0x0354('0x26')]||_0x2f0e40[_0x0354('0x27')]!==_0x299f65[_0x0354('0x27')];if(_0x2f0e40[_0x0354('0x28')]&&_0x299f65[_0x0354('0x28')]){_0x595d88=_0x2f0e40[_0x0354('0x28')]['name']!==_0x299f65[_0x0354('0x28')][_0x0354('0x29')]||_0x2f0e40[_0x0354('0x28')][_0x0354('0x1a')]!==_0x299f65['Trunk'][_0x0354('0x1a')];}return _0x5b0a69||_0x3146e7||_0x595d88;}exports[_0x0354('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x45da62){var _0x4984ce=null;var _0x8ba5b1=_0x45da62[_0x0354('0x2b')];if(_[_0x0354('0x2c')](_0x45da62[_0x0354('0x2d')])||_['isNil'](_0x45da62[_0x0354('0x2e')])||_[_0x0354('0x2c')](_0x45da62[_0x0354('0x2e')][_0x0354('0x2f')])){_0x4984ce=CAMPAIGN_STATUS[_0x0354('0x30')];}else if(_[_0x0354('0x31')](_0x45da62[_0x0354('0x2d')])||_[_0x0354('0x31')](_0x45da62[_0x0354('0x2e')]['Intervals'])){_0x4984ce=CAMPAIGN_STATUS[_0x0354('0x32')];}else if(_0x8ba5b1&&!timezones[_0x8ba5b1]){_0x4984ce=CAMPAIGN_STATUS[_0x0354('0x33')];}return _0x4984ce;}function checkAnyValidTrunk(_0x317fe2,_0x1507b0){var _0x54753a=null;var _0x2d78c4='SIP/';var _0x2a60e3=[_0x0354('0x34'),_0x0354('0x35')];var _0x5a8ad2=!![];if(_0x317fe2[_0x0354('0x28')]&&_0x317fe2[_0x0354('0x28')][_0x0354('0x1a')]){_0x2d78c4+=_0x317fe2[_0x0354('0x28')]['name'];_0x54753a=_0x1507b0[_0x2d78c4];_0x5a8ad2=_0x2a60e3['includes'](_0x54753a['status']);}else if(_0x317fe2[_0x0354('0x36')]&&_0x317fe2[_0x0354('0x36')][_0x0354('0x1a')]){_0x2d78c4+=_0x317fe2[_0x0354('0x36')]['name'];_0x54753a=_0x1507b0[_0x2d78c4];_0x5a8ad2=_0x2a60e3['includes'](_0x54753a[_0x0354('0x37')]);}return _0x5a8ad2;}function getQueueCampaignStatusMessage(_0x4d5a53,_0x27c7a0){var _0xbbce55=CAMPAIGN_STATUS['ACTIVE'];var _0x2f9eec=isPreviewCampaign(_0x4d5a53);if(!isQueueCampaignActive(_0x4d5a53)){if(_0x2f9eec){_0xbbce55=CAMPAIGN_STATUS[_0x0354('0x38')];}else{if(_0x4d5a53[_0x0354('0x27')]===0x0&&_0x4d5a53[_0x0354('0x23')]===0x0&&_0x4d5a53[_0x0354('0x25')]===0x0&&(_0x4d5a53[_0x0354('0x24')]||0x0)===0x0){_0xbbce55=CAMPAIGN_STATUS[_0x0354('0x38')];}else{_0xbbce55=CAMPAIGN_STATUS[_0x0354('0x39')];}}}else if(_0x4d5a53[_0x0354('0x20')]===0x0){_0xbbce55=CAMPAIGN_STATUS[_0x0354('0x3a')];}else if(!checkAnyValidTrunk(_0x4d5a53,_0x27c7a0)){_0xbbce55=CAMPAIGN_STATUS[_0x0354('0x3b')];}else if(!isPreviewCampaign(_0x4d5a53)){var _0x4fe875=checkAnyValidQueueCampaignInterval(_0x4d5a53);if(_0x4fe875){_0xbbce55=_0x4fe875;}}return _0xbbce55;}exports[_0x0354('0x3c')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x42e600){var _0x3ad9ad=CAMPAIGN_STATUS[_0x0354('0x39')];if(_0x42e600[_0x0354('0x27')]===0x0&&_0x42e600['talking']===0x0&&_0x42e600[_0x0354('0x25')]===0x0&&(_0x42e600[_0x0354('0x24')]||0x0)===0x0){_0x3ad9ad=CAMPAIGN_STATUS[_0x0354('0x38')];}return _0x3ad9ad;}exports['getQueueCampaignActiveStatusMessage']=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0xebc667){var _0xcd22fe=_0xebc667[_0x0354('0x3d')](/"(.*?)"/);return _0xcd22fe?_0xcd22fe[0x1]:_0xebc667;}exports[_0x0354('0x3e')]=extractCalleridName;function getCallerId(_0x867a6d,_0x2f7938,_0x5a26fb){if(!_['isUndefined'](_0x5a26fb)&&typeof _0x5a26fb===_0x0354('0x3f')&&!_[_0x0354('0x31')](_0x5a26fb)){if(!_[_0x0354('0x40')](_0x2f7938)&&typeof _0x2f7938===_0x0354('0x3f')&&!_[_0x0354('0x31')](_0x2f7938)){return util[_0x0354('0x41')](_0x0354('0x42'),_0x2f7938,_0x5a26fb);}return util[_0x0354('0x41')](_0x0354('0x42'),_0x5a26fb,_0x5a26fb);}if(!_[_0x0354('0x40')](_0x867a6d)&&typeof _0x867a6d==='string'&&!_[_0x0354('0x31')](_0x867a6d)){return _0x867a6d;}return _0x0354('0x43');}exports[_0x0354('0x44')]=getCallerId;function getCallerIdRandom(_0x1366f1,_0x3b00c3){var _0x5e0d24;var _0x27595f;var _0x5cfa7;if(_0x3b00c3<=0x0){_0x3b00c3=0x1;}_0x5e0d24=new RegExp(_0x0354('0x45')+_0x3b00c3+'}$');_0x27595f=Math[_0x0354('0x46')](0xa,_0x3b00c3-0x1);_0x5cfa7=Math[_0x0354('0x46')](0xa,_0x3b00c3)-0x1;return util[_0x0354('0x41')]('%s',_[_0x0354('0x47')](_0x1366f1,_0x5e0d24,_[_0x0354('0x48')](_0x27595f,_0x5cfa7)['toString']()));}exports[_0x0354('0x49')]=getCallerIdRandom;function decrementOriginate(_0x3b2aba){if(_0x3b2aba[_0x0354('0x27')]&&_0x3b2aba[_0x0354('0x27')]>0x0){_0x3b2aba['originated']-=0x1;}else{logger['error'](_0x0354('0x4a'));}}exports[_0x0354('0x4b')]=decrementOriginate;function checkContactEmpty(_0x1639eb){return _0x1639eb&&_0x1639eb[_0x0354('0x4c')]>0x0;}exports[_0x0354('0x4d')]=checkContactEmpty;function erlangb(_0x487cc5,_0x57c96f){if(_0x57c96f===0x0){return 0x0;}var _0xbaea31=0x1;for(var _0x465b8=0x1;_0x465b8<=_0x57c96f;_0x465b8+=0x1){_0xbaea31=0x1+_0xbaea31*_0x465b8/_0x487cc5;}return 0x1/_0xbaea31;}exports[_0x0354('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x56732c,_0x4c8d74,_0x1820d6){if(_0x4c8d74>_0x1820d6){for(var _0x4889ca=0x0;_0x4889ca<_0x4c8d74-_0x1820d6;_0x4889ca+=0x1){decrementOriginate(_0x56732c);}}}exports[_0x0354('0x4f')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x5b93e4){var _0x55fbf2={};var _0x3111ae=['id',_0x0354('0x50'),_0x0354('0x51'),_0x0354('0x52')];const _0x7a884c=0xfa;if(_0x5b93e4){for(var _0x28356a in _0x5b93e4){if(typeof _0x5b93e4[_0x28356a]!==_0x0354('0x53')){if(!_[_0x0354('0x2c')](_0x5b93e4[_0x28356a])&&!_0x3111ae['includes'](_0x28356a)){if(_0x28356a===_0x0354('0x54')&&_0x5b93e4[_0x28356a][_0x0354('0x4c')]>_0x7a884c){_0x55fbf2[_0x0354('0x55')+_0x28356a[_0x0354('0x56')]()]=_0x5b93e4[_0x28356a][_0x0354('0x57')]()['substring'](0x0,_0x7a884c);}else{_0x55fbf2['XMD-'+_0x28356a[_0x0354('0x56')]()]=_0x5b93e4[_0x28356a];}}}}}return _0x55fbf2;}exports[_0x0354('0x58')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 6215dbd..59de0e4 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(_0x41cef9,_0x33c7dd){var _0x396eff=function(_0x29859f){while(--_0x29859f){_0x41cef9['push'](_0x41cef9['shift']());}};_0x396eff(++_0x33c7dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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(_0x3f4875,_0x1eee06){var _0x1727cf=function(_0x92fc15){while(--_0x92fc15){_0x3f4875['push'](_0x3f4875['shift']());}};_0x1727cf(++_0x1eee06);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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 55c10e1..f28c5b6 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 _0x32e7=['FaxAccountId','[Fax][execOriginate][success]','message','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','%s/%s.tif','XMF-PATH','variablesAction','Action','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','uuid','path','tiff2pdf','./util/gs','../../../config/logger','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncNewState','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','prototype','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','hasOwnProperty','value','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','transferrate','calleridnum','pagestransferred','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','then','logger','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20sendFile\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate'];(function(_0x5b264d,_0x23074a){var _0x27de1c=function(_0x242aec){while(--_0x242aec){_0x5b264d['push'](_0x5b264d['shift']());}};_0x27de1c(++_0x23074a);}(_0x32e7,0x98));var _0x732e=function(_0x4271d0,_0x5df0c7){_0x4271d0=_0x4271d0-0x0;var _0x361bf1=_0x32e7[_0x4271d0];return _0x361bf1;};'use strict';var util=require(_0x732e('0x0'));var _=require(_0x732e('0x1'));var BPromise=require(_0x732e('0x2'));var uuid=require(_0x732e('0x3'));var moment=require('moment');var path=require(_0x732e('0x4'));var tiff2pdf=require(_0x732e('0x5'));var gs=require(_0x732e('0x6'));var logger=require(_0x732e('0x7'))('fax');var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0x732e('0x8'));var ut=require(_0x732e('0x9'));var Action=require(_0x732e('0xa'));var faxAccount=require(_0x732e('0xb'));var attachment=require(_0x732e('0xc'));var faxMessage=require(_0x732e('0xd'));function Fax(_0x3641d0){this[_0x732e('0xe')]={};this['faxAccounts']=_0x3641d0[_0x732e('0xf')];this['trunks']=_0x3641d0[_0x732e('0x10')];this[_0x732e('0x11')]={};ami['on'](_0x732e('0x12'),this[_0x732e('0x13')][_0x732e('0x14')](this));ami['on']('varset',this['syncVarSet'][_0x732e('0x14')](this));ami['on']('newstate',this[_0x732e('0x15')][_0x732e('0x14')](this));ami['on']('newexten',this[_0x732e('0x16')][_0x732e('0x14')](this));ami['on'](_0x732e('0x17'),this[_0x732e('0x18')][_0x732e('0x14')](this));ami['on'](_0x732e('0x19'),this[_0x732e('0x1a')][_0x732e('0x14')](this));ami['on'](_0x732e('0x1b'),this[_0x732e('0x1c')][_0x732e('0x14')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x732e('0x14')](this));}Fax[_0x732e('0x1d')]['syncNewchannel']=function(_0xd67bc4){if(_0xd67bc4[_0x732e('0x1e')]===_0x732e('0x1f')){for(var _0x2c14e0 in this[_0x732e('0xf')]){if(this[_0x732e('0xf')]['hasOwnProperty'](_0x2c14e0)){if(_0xd67bc4[_0x732e('0x20')]===this[_0x732e('0xf')][_0x2c14e0][_0x732e('0x21')]){this[_0x732e('0xe')][_0xd67bc4['uniqueid']]={};this[_0x732e('0xe')][_0xd67bc4[_0x732e('0x22')]][_0x732e('0x23')]=_0xd67bc4['channel'];this['channels'][_0xd67bc4[_0x732e('0x22')]]['id']=this[_0x732e('0xf')][_0x2c14e0]['id'];this[_0x732e('0xe')][_0xd67bc4[_0x732e('0x22')]][_0x732e('0x24')]=this[_0x732e('0xf')][_0x2c14e0][_0x732e('0x24')];logger[_0x732e('0x25')](_0xd67bc4[_0x732e('0x22')],_0x732e('0x26'));}}}}if(this[_0x732e('0x11')][_0xd67bc4['uniqueid']]){this[_0x732e('0xe')][_0xd67bc4['uniqueid']]={};this[_0x732e('0xe')][_0xd67bc4[_0x732e('0x22')]][_0x732e('0x23')]=_0xd67bc4['channel'];logger[_0x732e('0x25')](_0xd67bc4[_0x732e('0x22')],_0x732e('0x26'));}};Fax[_0x732e('0x1d')][_0x732e('0x27')]=function(_0x299fac){if(this[_0x732e('0xe')][_0x299fac['uniqueid']]){for(var _0xbd060e in _0x299fac[_0x732e('0x28')]){if(_0x299fac[_0x732e('0x28')][_0x732e('0x29')](_0xbd060e)){this[_0x732e('0xe')][_0x299fac[_0x732e('0x22')]][_0xbd060e]=_0x299fac[_0x732e('0x2a')];}}}};Fax['prototype'][_0x732e('0x15')]=function(_0x2e6f60){if(this[_0x732e('0xe')][_0x2e6f60[_0x732e('0x22')]]){this[_0x732e('0xe')][_0x2e6f60[_0x732e('0x22')]]['channelstate']=_0x2e6f60['channelstate'];this[_0x732e('0xe')][_0x2e6f60[_0x732e('0x22')]][_0x732e('0x2b')]=_0x2e6f60[_0x732e('0x2b')];}};Fax[_0x732e('0x1d')][_0x732e('0x16')]=function(_0x5cead2){if(this[_0x732e('0xe')][_0x5cead2[_0x732e('0x22')]]){for(var _0x5dffae in _0x5cead2[_0x732e('0x28')]){if(_0x5cead2[_0x732e('0x28')][_0x732e('0x29')](_0x5dffae)){this[_0x732e('0xe')][_0x5cead2['uniqueid']][_0x5dffae]=_0x5cead2[_0x732e('0x2a')];}}}};Fax[_0x732e('0x1d')][_0x732e('0x18')]=function(_0x5cb90c){if(this[_0x732e('0xe')][_0x5cb90c[_0x732e('0x22')]]){this[_0x732e('0xe')][_0x5cb90c['uniqueid']][_0x732e('0x2c')]=_0x5cb90c[_0x732e('0x2c')];this[_0x732e('0xe')][_0x5cb90c[_0x732e('0x22')]][_0x732e('0x2d')]=_0x5cb90c['status'];this['channels'][_0x5cb90c[_0x732e('0x22')]]['localstationid']=_0x5cb90c['localstationid'];this[_0x732e('0xe')][_0x5cb90c[_0x732e('0x22')]][_0x732e('0x2e')]=_0x5cb90c[_0x732e('0x2e')];logger[_0x732e('0x25')](_0x5cb90c['uniqueid'],_0x732e('0x2f'));}};Fax[_0x732e('0x1d')][_0x732e('0x1a')]=function(_0x2a1b11){var _0x43a1e8=this;if(this[_0x732e('0xe')][_0x2a1b11[_0x732e('0x22')]]){var _0x36156e=this['channels'][_0x2a1b11[_0x732e('0x22')]]['id'];this[_0x732e('0xe')][_0x2a1b11[_0x732e('0x22')]][_0x732e('0x30')]=_0x2a1b11[_0x732e('0x30')];this[_0x732e('0xe')][_0x2a1b11[_0x732e('0x22')]]['pagestransferred']=_0x2a1b11['pagestransferred'];this[_0x732e('0xe')][_0x2a1b11[_0x732e('0x22')]][_0x732e('0x21')]=_0x2a1b11[_0x732e('0x21')];this[_0x732e('0xe')][_0x2a1b11[_0x732e('0x22')]]['resolution']=_0x2a1b11['resolution'];this[_0x732e('0xe')][_0x2a1b11[_0x732e('0x22')]][_0x732e('0x31')]=_0x2a1b11[_0x732e('0x31')];this[_0x732e('0xe')][_0x2a1b11['uniqueid']][_0x732e('0x2e')]=_0x2a1b11[_0x732e('0x2e')];this[_0x732e('0xe')][_0x2a1b11['uniqueid']][_0x732e('0x32')]=_0x2a1b11[_0x732e('0x32')];if(this[_0x732e('0xe')][_0x2a1b11[_0x732e('0x22')]][_0x732e('0x33')]>0x0){tiff2pdf(_0x2a1b11[_0x732e('0x2e')],_0x732e('0x34'),function(_0x431350){logger['info'](_0x2a1b11[_0x732e('0x22')],_0x732e('0x35'),_0x431350['message']);attachment[_0x732e('0x36')]({'name':path[_0x732e('0x37')](_0x2a1b11[_0x732e('0x2e')])[_0x732e('0x24')],'basename':path[_0x732e('0x37')](_0x2a1b11[_0x732e('0x2e')])['name']+_0x732e('0x38'),'type':_0x732e('0x39')})['then'](function(_0x3d142a){faxAccount[_0x732e('0x3a')](_0x36156e,{'from':_0x2a1b11[_0x732e('0x32')],'mapKey':_0x732e('0x3b'),'body':path[_0x732e('0x37')](_0x2a1b11[_0x732e('0x2e')])[_0x732e('0x24')]+'.pdf','AttachmentId':_0x3d142a['id']})[_0x732e('0x3c')](function(_0x148945){logger[_0x732e('0x3d')](_0x2a1b11[_0x732e('0x22')],_0x732e('0x3e'),JSON[_0x732e('0x3f')](_0x148945));});})[_0x732e('0x3c')](function(_0x4ffdfe){logger[_0x732e('0x3d')](_0x2a1b11[_0x732e('0x22')],'\x20receiveFax\x20',JSON['stringify'](_0x4ffdfe));});});}logger[_0x732e('0x25')](_0x2a1b11[_0x732e('0x22')],_0x732e('0x40'));}};Fax[_0x732e('0x1d')][_0x732e('0x41')]=function(_0x454513){if(this[_0x732e('0x11')][_0x454513[_0x732e('0x22')]]){_[_0x732e('0x42')](this[_0x732e('0xe')][_0x454513['uniqueid']],_[_0x732e('0x43')](_0x454513,[_0x732e('0x44'),_0x732e('0x45')]));}};function updateStatus(_0x52bf6f){if(_0x52bf6f[_0x732e('0x46')]){faxMessage[_0x732e('0x47')](_0x52bf6f[_0x732e('0x46')],{'failMessage':_0x732e('0x48')})['then'](function(_0x1b8406){ut['logger'](_0x732e('0x49'),_0x1b8406);})[_0x732e('0x3c')](function(_0x3c2b8b){ut['logger'](_0x732e('0x4a'),_0x3c2b8b);});}else{ut['logger'](_0x732e('0x4b'));}}Fax['prototype'][_0x732e('0x4c')]=function(_0x173748,_0x1eb026,_0x5ec64b){var _0x11225d=this;var _0x4699d9={};if(_0x1eb026){_0x4699d9={'read':_0x1eb026};}else{_0x4699d9={'failMessage':_0x5ec64b};}if(this[_0x732e('0x11')][_0x173748][_0x732e('0x46')]){faxMessage[_0x732e('0x47')](this['actions'][_0x173748]['AttachmentId'],_0x4699d9)[_0x732e('0x4d')](function(_0x13bcaf){ut[_0x732e('0x4e')](_0x732e('0x4f'),_0x13bcaf);})[_0x732e('0x3c')](function(_0x56a79f){ut[_0x732e('0x4e')](_0x732e('0x50'),_0x56a79f);})[_0x732e('0x51')](function(){delete _0x11225d[_0x732e('0xe')][_0x173748];delete _0x11225d[_0x732e('0x11')][_0x173748];});}else{ut[_0x732e('0x4e')](_0x732e('0x52'));this[_0x732e('0x53')](_0x173748);delete this[_0x732e('0x11')][_0x173748];}};Fax[_0x732e('0x1d')]['syncHangup']=function(_0x522292){var _0x29bfc2=this;if(this[_0x732e('0xe')][_0x522292[_0x732e('0x22')]]){if(this['actions'][_0x522292[_0x732e('0x22')]]){this[_0x732e('0xe')][_0x522292[_0x732e('0x22')]]['id']=this[_0x732e('0x11')][_0x522292[_0x732e('0x22')]]['id'];this[_0x732e('0xe')][_0x522292[_0x732e('0x22')]][_0x732e('0x24')]=this[_0x732e('0x11')][_0x522292[_0x732e('0x22')]][_0x732e('0x24')];}logger['info'](_0x522292[_0x732e('0x22')],this[_0x732e('0x11')][_0x522292[_0x732e('0x22')]]?_0x732e('0x54'):'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this['channels'][_0x522292[_0x732e('0x22')]]));if(this[_0x732e('0x11')][_0x522292[_0x732e('0x22')]]){if(this[_0x732e('0xe')][_0x522292['uniqueid']]['faxpages']>0x0&&this[_0x732e('0xe')][_0x522292[_0x732e('0x22')]][_0x732e('0x17')]===_0x732e('0x55')){this[_0x732e('0x4c')](_0x522292[_0x732e('0x22')],!![]);}else{this[_0x732e('0x4c')](_0x522292[_0x732e('0x22')],![],this[_0x732e('0xe')][_0x522292['uniqueid']][_0x732e('0x56')]?_0x732e('0x57')+this[_0x732e('0xe')][_0x522292[_0x732e('0x22')]][_0x732e('0x56')]:'SENDING\x20FAILED');}}}};Fax['prototype'][_0x732e('0x58')]=function(_0x2ab872){var _0x10fc42=this;return new BPromise(function(_0x16ca12,_0x20e1d4){_0x10fc42[_0x732e('0x59')](_0x2ab872,_0x10fc42[_0x732e('0xf')][_0x2ab872[_0x732e('0x5a')]])['then'](function(_0x13553b){ut[_0x732e('0x4e')](_0x732e('0x5b'),_0x13553b);_0x16ca12(ut[_0x732e('0x5c')](_0x732e('0x5d')));})[_0x732e('0x3c')](function(_0x2a2ccd){ut[_0x732e('0x4e')](_0x732e('0x5e'),_0x2a2ccd);updateStatus(_0x2ab872);_0x20e1d4(ut[_0x732e('0x5c')](_0x732e('0x5f')));});});};Fax[_0x732e('0x1d')]['checkAfterSend']=function(_0x8c69ff){var _0x375240=this;return new BPromise(function(_0x47c17d,_0x4db8c5){var _0x5e4adc=_0x375240[_0x732e('0x60')](_0x375240['faxAccounts'][_0x8c69ff[_0x732e('0x5a')]][_0x732e('0x61')],_0x8c69ff);if(_0x5e4adc[_0x732e('0x62')]){_0x47c17d(ut[_0x732e('0x5c')](_0x732e('0x63')));}else{_0x4db8c5(ut[_0x732e('0x5c')](_0x5e4adc[_0x732e('0x5c')]));}});};function originate(_0x3a0fcc,_0x4753ac,_0x29810d){return new BPromise(function(_0xac5132,_0x8ed090){if(_0x29810d){var _0x246240=util[_0x732e('0x64')](_0x732e('0x65'),path[_0x732e('0x37')](_0x3a0fcc[_0x732e('0x4')])[_0x732e('0x24')],_0x3a0fcc['path']);gs['execute'](_0x246240)[_0x732e('0x4d')](function(){_0x3a0fcc['path']=util[_0x732e('0x64')](_0x732e('0x66'),path[_0x732e('0x37')](_0x3a0fcc[_0x732e('0x4')])['dir'],path[_0x732e('0x37')](_0x3a0fcc[_0x732e('0x4')])['name']);_0x4753ac[_0x732e('0x67')]=_0x3a0fcc['path'];ut[_0x732e('0x4e')]('Convert\x20pdf\x20to\x20tif','');ami['Action'](ut[_0x732e('0x68')](_0x3a0fcc,_0x4753ac))[_0x732e('0x4d')](function(_0xdace92){_0xac5132(_0xdace92);})[_0x732e('0x3c')](function(_0x65e5e1){_0x8ed090(_0x65e5e1);});})[_0x732e('0x3c')](function(_0x473abc){_0x8ed090(_0x473abc);});}else{ami[_0x732e('0x69')](ut['variablesAction'](_0x3a0fcc,_0x4753ac))['then'](function(_0x482327){_0xac5132(_0x482327);})[_0x732e('0x3c')](function(_0x3b8867){_0x8ed090(_0x3b8867);});}});}Fax[_0x732e('0x1d')][_0x732e('0x59')]=function(_0x46edb6,_0x51d4a0){var _0x58d2a5=this;return new BPromise(function(_0x47c794,_0x249076){var _0x58ebad=uuid['v4']();var _0x1703d8=ut[_0x732e('0x6a')](_0x46edb6,_0x51d4a0);_0x58d2a5[_0x732e('0x11')][_0x58ebad]=new Action(_0x58ebad,_0x51d4a0,_0x46edb6);var _0x24a983=_0x58d2a5['actions'][_0x58ebad];if(path[_0x732e('0x37')](_0x46edb6[_0x732e('0x4')])[_0x732e('0x6b')]===_0x732e('0x38')){originate(_0x24a983,_0x1703d8,!![])[_0x732e('0x4d')](function(_0x5431d8){_0x47c794(_0x5431d8);})[_0x732e('0x3c')](function(_0x1db9e6){_0x249076(_0x1db9e6);});}else{originate(_0x24a983,_0x1703d8,![])['then'](function(_0x447c5c){_0x47c794(_0x447c5c);})[_0x732e('0x3c')](function(_0x3263c9){_0x249076(_0x3263c9);});}});};Fax[_0x732e('0x1d')][_0x732e('0x6c')]=function(_0x45f74f){return!_['isNil'](_0x45f74f)&&!_[_0x732e('0x6d')](_0x45f74f['name'])&&!_[_0x732e('0x6d')](_0x45f74f[_0x732e('0x6e')])&&_0x45f74f[_0x732e('0x6e')]&&!_[_0x732e('0x6d')](this[_0x732e('0x10')][util[_0x732e('0x64')](_0x732e('0x6f'),_0x45f74f[_0x732e('0x24')])])&&!_[_0x732e('0x6d')](this[_0x732e('0x10')][util[_0x732e('0x64')]('SIP/%s',_0x45f74f[_0x732e('0x24')])][_0x732e('0x2d')])&&(this[_0x732e('0x10')][util[_0x732e('0x64')](_0x732e('0x6f'),_0x45f74f['name'])][_0x732e('0x2d')]==='reachable'||this[_0x732e('0x10')][util[_0x732e('0x64')](_0x732e('0x6f'),_0x45f74f[_0x732e('0x24')])][_0x732e('0x2d')]===_0x732e('0x70'));};Fax['prototype'][_0x732e('0x60')]=function(_0x2b8543,_0x37f242){if(!this[_0x732e('0x6c')](_0x2b8543)){ut[_0x732e('0x4e')](_0x732e('0x71'),_[_0x732e('0x6d')](_0x2b8543)?'':_0x2b8543[_0x732e('0x24')]+_0x732e('0x72'));return{'isValid':![],'message':_0x732e('0x73')};}if(_[_0x732e('0x6d')](_0x37f242[_0x732e('0x3b')])){ut['logger'](_0x732e('0x74'),JSON['stringify'](_0x37f242));return{'isValid':![],'message':_0x732e('0x75')};}if(_[_0x732e('0x6d')](_0x37f242[_0x732e('0x4')])){ut['logger'](_0x732e('0x76'),JSON[_0x732e('0x3f')](_0x37f242));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x732e('0x77')};};Fax[_0x732e('0x1d')][_0x732e('0x53')]=function(_0xb6ca4b,_0x593c90=0x2710){if(this[_0x732e('0xe')][_0xb6ca4b]){setTimeout(()=>{delete this[_0x732e('0xe')][_0xb6ca4b];},_0x593c90);}};module[_0x732e('0x78')]=Fax; \ No newline at end of file +var _0x39fd=['[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','path','execute','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','.pdf','isTrunkReachable','isNil','active','SIP/%s','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','moment','./util/gs','fax','../ami','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','bind','syncVarSet','newstate','syncNewState','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','[Fax][Message][Error][Updated]','logger'];(function(_0x39b5c7,_0x59e89e){var _0x594a85=function(_0x78002){while(--_0x78002){_0x39b5c7['push'](_0x39b5c7['shift']());}};_0x594a85(++_0x59e89e);}(_0x39fd,0xa2));var _0xd39f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x39fd[_0x4a9fb1];return _0x348672;};'use strict';var util=require(_0xd39f('0x0'));var _=require(_0xd39f('0x1'));var BPromise=require(_0xd39f('0x2'));var uuid=require('uuid');var moment=require(_0xd39f('0x3'));var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require(_0xd39f('0x4'));var logger=require('../../../config/logger')(_0xd39f('0x5'));var ami=require(_0xd39f('0x6'));var rpcDb=require('./rpcDb');var Channel=require(_0xd39f('0x7'));var ut=require(_0xd39f('0x8'));var Action=require(_0xd39f('0x9'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xd39f('0xa'));var faxMessage=require(_0xd39f('0xb'));function Fax(_0x5ecb24){this[_0xd39f('0xc')]={};this['faxAccounts']=_0x5ecb24[_0xd39f('0xd')];this['trunks']=_0x5ecb24[_0xd39f('0xe')];this[_0xd39f('0xf')]={};ami['on'](_0xd39f('0x10'),this['syncNewchannel'][_0xd39f('0x11')](this));ami['on']('varset',this[_0xd39f('0x12')][_0xd39f('0x11')](this));ami['on'](_0xd39f('0x13'),this[_0xd39f('0x14')]['bind'](this));ami['on']('newexten',this['syncNewExten'][_0xd39f('0x11')](this));ami['on']('faxstatus',this[_0xd39f('0x15')][_0xd39f('0x11')](this));ami['on'](_0xd39f('0x16'),this[_0xd39f('0x17')][_0xd39f('0x11')](this));ami['on'](_0xd39f('0x18'),this[_0xd39f('0x19')]['bind'](this));ami['on'](_0xd39f('0x1a'),this[_0xd39f('0x1b')]['bind'](this));}Fax[_0xd39f('0x1c')]['syncNewchannel']=function(_0xb3c112){if(_0xb3c112[_0xd39f('0x1d')]===_0xd39f('0x1e')){for(var _0x3e1a71 in this[_0xd39f('0xd')]){if(this[_0xd39f('0xd')][_0xd39f('0x1f')](_0x3e1a71)){if(_0xb3c112['exten']===this['faxAccounts'][_0x3e1a71][_0xd39f('0x20')]){this['channels'][_0xb3c112['uniqueid']]={};this[_0xd39f('0xc')][_0xb3c112[_0xd39f('0x21')]][_0xd39f('0x22')]=_0xb3c112[_0xd39f('0x22')];this[_0xd39f('0xc')][_0xb3c112[_0xd39f('0x21')]]['id']=this[_0xd39f('0xd')][_0x3e1a71]['id'];this[_0xd39f('0xc')][_0xb3c112['uniqueid']][_0xd39f('0x23')]=this[_0xd39f('0xd')][_0x3e1a71]['name'];logger['info'](_0xb3c112[_0xd39f('0x21')],_0xd39f('0x24'));}}}}if(this[_0xd39f('0xf')][_0xb3c112[_0xd39f('0x21')]]){this[_0xd39f('0xc')][_0xb3c112['uniqueid']]={};this['channels'][_0xb3c112[_0xd39f('0x21')]][_0xd39f('0x22')]=_0xb3c112[_0xd39f('0x22')];logger[_0xd39f('0x25')](_0xb3c112[_0xd39f('0x21')],_0xd39f('0x24'));}};Fax['prototype'][_0xd39f('0x12')]=function(_0x46e542){if(this[_0xd39f('0xc')][_0x46e542['uniqueid']]){for(var _0xfa8161 in _0x46e542[_0xd39f('0x26')]){if(_0x46e542[_0xd39f('0x26')][_0xd39f('0x1f')](_0xfa8161)){this[_0xd39f('0xc')][_0x46e542[_0xd39f('0x21')]][_0xfa8161]=_0x46e542[_0xd39f('0x27')];}}}};Fax[_0xd39f('0x1c')]['syncNewState']=function(_0x4a6ec6){if(this[_0xd39f('0xc')][_0x4a6ec6[_0xd39f('0x21')]]){this['channels'][_0x4a6ec6['uniqueid']][_0xd39f('0x28')]=_0x4a6ec6[_0xd39f('0x28')];this['channels'][_0x4a6ec6['uniqueid']][_0xd39f('0x29')]=_0x4a6ec6[_0xd39f('0x29')];}};Fax[_0xd39f('0x1c')][_0xd39f('0x2a')]=function(_0x6f9232){if(this[_0xd39f('0xc')][_0x6f9232[_0xd39f('0x21')]]){for(var _0x1a22ab in _0x6f9232[_0xd39f('0x26')]){if(_0x6f9232[_0xd39f('0x26')][_0xd39f('0x1f')](_0x1a22ab)){this['channels'][_0x6f9232[_0xd39f('0x21')]][_0x1a22ab]=_0x6f9232['value'];}}}};Fax[_0xd39f('0x1c')][_0xd39f('0x15')]=function(_0x1b95d8){if(this[_0xd39f('0xc')][_0x1b95d8['uniqueid']]){this['channels'][_0x1b95d8[_0xd39f('0x21')]][_0xd39f('0x2b')]=_0x1b95d8[_0xd39f('0x2b')];this[_0xd39f('0xc')][_0x1b95d8[_0xd39f('0x21')]]['status']=_0x1b95d8[_0xd39f('0x2c')];this[_0xd39f('0xc')][_0x1b95d8[_0xd39f('0x21')]][_0xd39f('0x20')]=_0x1b95d8['localstationid'];this[_0xd39f('0xc')][_0x1b95d8[_0xd39f('0x21')]][_0xd39f('0x2d')]=_0x1b95d8[_0xd39f('0x2d')];logger[_0xd39f('0x25')](_0x1b95d8[_0xd39f('0x21')],_0xd39f('0x2e'));}};Fax[_0xd39f('0x1c')][_0xd39f('0x17')]=function(_0x41d09e){var _0x3ffa71=this;if(this['channels'][_0x41d09e['uniqueid']]){var _0x40531e=this[_0xd39f('0xc')][_0x41d09e[_0xd39f('0x21')]]['id'];this[_0xd39f('0xc')][_0x41d09e[_0xd39f('0x21')]][_0xd39f('0x2f')]=_0x41d09e[_0xd39f('0x2f')];this[_0xd39f('0xc')][_0x41d09e[_0xd39f('0x21')]]['pagestransferred']=_0x41d09e[_0xd39f('0x30')];this[_0xd39f('0xc')][_0x41d09e[_0xd39f('0x21')]][_0xd39f('0x20')]=_0x41d09e[_0xd39f('0x20')];this[_0xd39f('0xc')][_0x41d09e[_0xd39f('0x21')]]['resolution']=_0x41d09e['resolution'];this[_0xd39f('0xc')][_0x41d09e[_0xd39f('0x21')]]['transferrate']=_0x41d09e[_0xd39f('0x31')];this[_0xd39f('0xc')][_0x41d09e[_0xd39f('0x21')]]['filename']=_0x41d09e[_0xd39f('0x2d')];this[_0xd39f('0xc')][_0x41d09e[_0xd39f('0x21')]][_0xd39f('0x32')]=_0x41d09e['calleridnum'];if(this['channels'][_0x41d09e[_0xd39f('0x21')]]['pagestransferred']>0x0){tiff2pdf(_0x41d09e['filename'],_0xd39f('0x33'),function(_0x510eea){logger[_0xd39f('0x25')](_0x41d09e[_0xd39f('0x21')],_0xd39f('0x34'),_0x510eea[_0xd39f('0x35')]);attachment['create']({'name':path[_0xd39f('0x36')](_0x41d09e[_0xd39f('0x2d')])[_0xd39f('0x23')],'basename':path[_0xd39f('0x36')](_0x41d09e[_0xd39f('0x2d')])[_0xd39f('0x23')]+'.pdf','type':'application/pdf'})[_0xd39f('0x37')](function(_0x17ee6e){faxAccount[_0xd39f('0x38')](_0x40531e,{'from':_0x41d09e[_0xd39f('0x32')],'mapKey':'fax','body':path[_0xd39f('0x36')](_0x41d09e[_0xd39f('0x2d')])[_0xd39f('0x23')]+'.pdf','AttachmentId':_0x17ee6e['id']})[_0xd39f('0x39')](function(_0x25f2d3){logger[_0xd39f('0x3a')](_0x41d09e[_0xd39f('0x21')],_0xd39f('0x3b'),JSON[_0xd39f('0x3c')](_0x25f2d3));});})['catch'](function(_0x5674a2){logger['error'](_0x41d09e[_0xd39f('0x21')],_0xd39f('0x3d'),JSON[_0xd39f('0x3c')](_0x5674a2));});});}logger['info'](_0x41d09e['uniqueid'],'\x20receiveFax\x20');}};Fax[_0xd39f('0x1c')]['syncOriginateResponse']=function(_0x3d08f9){if(this[_0xd39f('0xf')][_0x3d08f9[_0xd39f('0x21')]]){_[_0xd39f('0x3e')](this['channels'][_0x3d08f9[_0xd39f('0x21')]],_[_0xd39f('0x3f')](_0x3d08f9,[_0xd39f('0x40'),_0xd39f('0x41')]));}};function updateStatus(_0x234e2b){if(_0x234e2b[_0xd39f('0x42')]){faxMessage[_0xd39f('0x43')](_0x234e2b[_0xd39f('0x42')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xd39f('0x37')](function(_0x50cb1d){ut['logger'](_0xd39f('0x44'),_0x50cb1d);})[_0xd39f('0x39')](function(_0x43902f){ut[_0xd39f('0x45')](_0xd39f('0x46'),_0x43902f);});}else{ut[_0xd39f('0x45')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xd39f('0x1c')][_0xd39f('0x47')]=function(_0x68e448,_0x2eeb18,_0x5c9941){var _0xd9f56b=this;var _0x12a932={};if(_0x2eeb18){_0x12a932={'read':_0x2eeb18};}else{_0x12a932={'failMessage':_0x5c9941};}if(this[_0xd39f('0xf')][_0x68e448]['AttachmentId']){faxMessage[_0xd39f('0x43')](this['actions'][_0x68e448]['AttachmentId'],_0x12a932)[_0xd39f('0x37')](function(_0x26e9c3){ut['logger'](_0xd39f('0x48'),_0x26e9c3);})['catch'](function(_0x53f381){ut['logger']('[Fax][Message][NoUpdate1]',_0x53f381);})[_0xd39f('0x49')](function(){delete _0xd9f56b[_0xd39f('0xc')][_0x68e448];delete _0xd9f56b[_0xd39f('0xf')][_0x68e448];});}else{ut[_0xd39f('0x45')](_0xd39f('0x4a'));this[_0xd39f('0x4b')](_0x68e448);delete this[_0xd39f('0xf')][_0x68e448];}};Fax[_0xd39f('0x1c')]['syncHangup']=function(_0x439b9f){var _0x200e83=this;if(this['channels'][_0x439b9f[_0xd39f('0x21')]]){if(this[_0xd39f('0xf')][_0x439b9f[_0xd39f('0x21')]]){this[_0xd39f('0xc')][_0x439b9f['uniqueid']]['id']=this['actions'][_0x439b9f[_0xd39f('0x21')]]['id'];this['channels'][_0x439b9f[_0xd39f('0x21')]]['name']=this[_0xd39f('0xf')][_0x439b9f[_0xd39f('0x21')]][_0xd39f('0x23')];}logger[_0xd39f('0x25')](_0x439b9f[_0xd39f('0x21')],this[_0xd39f('0xf')][_0x439b9f[_0xd39f('0x21')]]?_0xd39f('0x4c'):_0xd39f('0x4d'),JSON[_0xd39f('0x3c')](this[_0xd39f('0xc')][_0x439b9f[_0xd39f('0x21')]]));if(this[_0xd39f('0xf')][_0x439b9f[_0xd39f('0x21')]]){if(this[_0xd39f('0xc')][_0x439b9f[_0xd39f('0x21')]][_0xd39f('0x4e')]>0x0&&this[_0xd39f('0xc')][_0x439b9f[_0xd39f('0x21')]][_0xd39f('0x4f')]===_0xd39f('0x50')){this[_0xd39f('0x47')](_0x439b9f[_0xd39f('0x21')],!![]);}else{this[_0xd39f('0x47')](_0x439b9f[_0xd39f('0x21')],![],this[_0xd39f('0xc')][_0x439b9f[_0xd39f('0x21')]][_0xd39f('0x51')]?_0xd39f('0x52')+this[_0xd39f('0xc')][_0x439b9f[_0xd39f('0x21')]][_0xd39f('0x51')]:_0xd39f('0x53'));}}}};Fax['prototype'][_0xd39f('0x54')]=function(_0x4a6c0e){var _0xb1271e=this;return new BPromise(function(_0x52450f,_0x31068a){_0xb1271e[_0xd39f('0x55')](_0x4a6c0e,_0xb1271e[_0xd39f('0xd')][_0x4a6c0e['FaxAccountId']])['then'](function(_0x377c5e){ut[_0xd39f('0x45')](_0xd39f('0x56'),_0x377c5e);_0x52450f(ut['message'](_0xd39f('0x57')));})[_0xd39f('0x39')](function(_0x4ea63f){ut[_0xd39f('0x45')](_0xd39f('0x58'),_0x4ea63f);updateStatus(_0x4a6c0e);_0x31068a(ut['message'](_0xd39f('0x59')));});});};Fax[_0xd39f('0x1c')]['checkAfterSend']=function(_0x1f8e42){var _0x589200=this;return new BPromise(function(_0x4a3c93,_0xb9ecb4){var _0x193cd1=_0x589200[_0xd39f('0x5a')](_0x589200[_0xd39f('0xd')][_0x1f8e42['FaxAccountId']][_0xd39f('0x5b')],_0x1f8e42);if(_0x193cd1[_0xd39f('0x5c')]){_0x4a3c93(ut['message'](_0xd39f('0x5d')));}else{_0xb9ecb4(ut[_0xd39f('0x35')](_0x193cd1[_0xd39f('0x35')]));}});};function originate(_0x526061,_0x3cb5db,_0x5c6537){return new BPromise(function(_0x1f9081,_0x344ce8){if(_0x5c6537){var _0x31ee53=util[_0xd39f('0x5e')]('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[_0xd39f('0x36')](_0x526061[_0xd39f('0x5f')])[_0xd39f('0x23')],_0x526061[_0xd39f('0x5f')]);gs[_0xd39f('0x60')](_0x31ee53)[_0xd39f('0x37')](function(){_0x526061[_0xd39f('0x5f')]=util[_0xd39f('0x5e')]('%s/%s.tif',path[_0xd39f('0x36')](_0x526061[_0xd39f('0x5f')])[_0xd39f('0x61')],path[_0xd39f('0x36')](_0x526061[_0xd39f('0x5f')])[_0xd39f('0x23')]);_0x3cb5db['XMF-PATH']=_0x526061[_0xd39f('0x5f')];ut['logger'](_0xd39f('0x62'),'');ami['Action'](ut['variablesAction'](_0x526061,_0x3cb5db))[_0xd39f('0x37')](function(_0x3f3b33){_0x1f9081(_0x3f3b33);})['catch'](function(_0x420791){_0x344ce8(_0x420791);});})[_0xd39f('0x39')](function(_0x4e8575){_0x344ce8(_0x4e8575);});}else{ami[_0xd39f('0x63')](ut[_0xd39f('0x64')](_0x526061,_0x3cb5db))['then'](function(_0x4a5f06){_0x1f9081(_0x4a5f06);})[_0xd39f('0x39')](function(_0x578721){_0x344ce8(_0x578721);});}});}Fax[_0xd39f('0x1c')][_0xd39f('0x55')]=function(_0x139e66,_0x2b34a){var _0x1bc8c2=this;return new BPromise(function(_0x4533a7,_0x55f13a){var _0x41c110=uuid['v4']();var _0x2be5e3=ut[_0xd39f('0x65')](_0x139e66,_0x2b34a);_0x1bc8c2['actions'][_0x41c110]=new Action(_0x41c110,_0x2b34a,_0x139e66);var _0x2b9a84=_0x1bc8c2[_0xd39f('0xf')][_0x41c110];if(path[_0xd39f('0x36')](_0x139e66[_0xd39f('0x5f')])[_0xd39f('0x66')]===_0xd39f('0x67')){originate(_0x2b9a84,_0x2be5e3,!![])[_0xd39f('0x37')](function(_0x4ef0e1){_0x4533a7(_0x4ef0e1);})['catch'](function(_0x30460a){_0x55f13a(_0x30460a);});}else{originate(_0x2b9a84,_0x2be5e3,![])[_0xd39f('0x37')](function(_0x33165b){_0x4533a7(_0x33165b);})[_0xd39f('0x39')](function(_0x19c40c){_0x55f13a(_0x19c40c);});}});};Fax[_0xd39f('0x1c')][_0xd39f('0x68')]=function(_0x59c33c){return!_[_0xd39f('0x69')](_0x59c33c)&&!_[_0xd39f('0x69')](_0x59c33c['name'])&&!_[_0xd39f('0x69')](_0x59c33c[_0xd39f('0x6a')])&&_0x59c33c[_0xd39f('0x6a')]&&!_[_0xd39f('0x69')](this['trunks'][util[_0xd39f('0x5e')](_0xd39f('0x6b'),_0x59c33c['name'])])&&!_['isNil'](this[_0xd39f('0xe')][util[_0xd39f('0x5e')](_0xd39f('0x6b'),_0x59c33c[_0xd39f('0x23')])][_0xd39f('0x2c')])&&(this[_0xd39f('0xe')][util[_0xd39f('0x5e')](_0xd39f('0x6b'),_0x59c33c[_0xd39f('0x23')])][_0xd39f('0x2c')]==='reachable'||this[_0xd39f('0xe')][util[_0xd39f('0x5e')](_0xd39f('0x6b'),_0x59c33c[_0xd39f('0x23')])][_0xd39f('0x2c')]==='unmonitored');};Fax[_0xd39f('0x1c')][_0xd39f('0x5a')]=function(_0x5646a7,_0x1a05af){if(!this[_0xd39f('0x68')](_0x5646a7)){ut[_0xd39f('0x45')](_0xd39f('0x6c'),_['isNil'](_0x5646a7)?'':_0x5646a7['name']+_0xd39f('0x6d'));return{'isValid':![],'message':_0xd39f('0x6e')};}if(_[_0xd39f('0x69')](_0x1a05af[_0xd39f('0x5')])){ut[_0xd39f('0x45')](_0xd39f('0x6f'),JSON[_0xd39f('0x3c')](_0x1a05af));return{'isValid':![],'message':_0xd39f('0x70')};}if(_[_0xd39f('0x69')](_0x1a05af[_0xd39f('0x5f')])){ut[_0xd39f('0x45')](_0xd39f('0x71'),JSON[_0xd39f('0x3c')](_0x1a05af));return{'isValid':![],'message':_0xd39f('0x72')};}return{'isValid':!![],'message':'Is\x20Valid'};};Fax[_0xd39f('0x1c')][_0xd39f('0x4b')]=function(_0x169b19,_0x36b72f=0x2710){if(this['channels'][_0x169b19]){setTimeout(()=>{delete this[_0xd39f('0xc')][_0x169b19];},_0x36b72f);}};module[_0xd39f('0x73')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 72472d8..b5c3ab3 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 _0x7ae6=['resolve','then','catch','[Notify]\x20','util','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify'];(function(_0x1e48d3,_0x5d8c43){var _0x2852b1=function(_0x11d7b3){while(--_0x11d7b3){_0x1e48d3['push'](_0x1e48d3['shift']());}};_0x2852b1(++_0x5d8c43);}(_0x7ae6,0xd0));var _0x67ae=function(_0x591759,_0x3d9052){_0x591759=_0x591759-0x0;var _0x4ac92e=_0x7ae6[_0x591759];return _0x4ac92e;};'use strict';var util=require(_0x67ae('0x0'));var BPromise=require('bluebird');var logger=require(_0x67ae('0x1'))(_0x67ae('0x2'));var _=require(_0x67ae('0x3'));var faxAccount=require(_0x67ae('0x4'));function loggerCatch(_0x29a565){return function(_0x3e8d34){logger[_0x67ae('0x5')](_0x29a565,util[_0x67ae('0x6')](_0x3e8d34,{'showHidden':![],'depth':null}));};}exports[_0x67ae('0x7')]=function(_0x2d4e1f,_0x221128){return BPromise[_0x67ae('0x8')]()[_0x67ae('0x9')](faxAccount[_0x67ae('0x7')](_0x2d4e1f,_0x221128))[_0x67ae('0xa')](loggerCatch(_0x67ae('0xb')));}; \ No newline at end of file +var _0x6654=['lodash','../rpc/faxAccount','error','notify','resolve','then','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview'];(function(_0x5ea451,_0x52741e){var _0x437c02=function(_0x464bd3){while(--_0x464bd3){_0x5ea451['push'](_0x5ea451['shift']());}};_0x437c02(++_0x52741e);}(_0x6654,0x98));var _0x4665=function(_0x2d66d5,_0x4d71d1){_0x2d66d5=_0x2d66d5-0x0;var _0x128e84=_0x6654[_0x2d66d5];return _0x128e84;};'use strict';var util=require(_0x4665('0x0'));var BPromise=require(_0x4665('0x1'));var logger=require(_0x4665('0x2'))(_0x4665('0x3'));var _=require(_0x4665('0x4'));var faxAccount=require(_0x4665('0x5'));function loggerCatch(_0x21dc90){return function(_0x5549ce){logger[_0x4665('0x6')](_0x21dc90,util['inspect'](_0x5549ce,{'showHidden':![],'depth':null}));};}exports[_0x4665('0x7')]=function(_0x47141e,_0x3072d1){return BPromise[_0x4665('0x8')]()[_0x4665('0x9')](faxAccount['notify'](_0x47141e,_0x3072d1))[_0x4665('0xa')](loggerCatch(_0x4665('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 8cd99af..818db45 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 _0x0649=['fax','bluebird','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger'];(function(_0x217a98,_0x4a1728){var _0x1d7547=function(_0x43480f){while(--_0x43480f){_0x217a98['push'](_0x217a98['shift']());}};_0x1d7547(++_0x4a1728);}(_0x0649,0x16d));var _0x9064=function(_0x257369,_0xa12d5e){_0x257369=_0x257369-0x0;var _0x2c1954=_0x0649[_0x257369];return _0x2c1954;};'use strict';var util=require('util');var logger=require(_0x9064('0x0'))(_0x9064('0x1'));var BPromise=require(_0x9064('0x2'));var exec=require('child_process')['exec'];exports['execute']=function(_0x11a42e){return new BPromise(function(_0x53ef85,_0xfe8894){exec(_0x11a42e,function(_0x24787c,_0x12fa27,_0xfc81a0){logger['info'](_0x9064('0x3'),_0x12fa27);if(_0x24787c){logger['info'](_0x9064('0x3'),_0x9064('0x4'),util[_0x9064('0x5')](_0x24787c,{'showHidden':![],'depth':null}),_0x12fa27,_0xfc81a0);_0xfe8894(_0x24787c);}_0x53ef85(_0x12fa27);});});}; \ No newline at end of file +var _0x9379=['Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','exec','execute','info'];(function(_0x375645,_0xe5e13b){var _0x4f53ac=function(_0x3e7ef3){while(--_0x3e7ef3){_0x375645['push'](_0x375645['shift']());}};_0x4f53ac(++_0xe5e13b);}(_0x9379,0x157));var _0x9937=function(_0x545699,_0x41b0cf){_0x545699=_0x545699-0x0;var _0x364bcc=_0x9379[_0x545699];return _0x364bcc;};'use strict';var util=require(_0x9937('0x0'));var logger=require(_0x9937('0x1'))(_0x9937('0x2'));var BPromise=require(_0x9937('0x3'));var exec=require('child_process')[_0x9937('0x4')];exports[_0x9937('0x5')]=function(_0x35306d){return new BPromise(function(_0x31fb15,_0x229778){exec(_0x35306d,function(_0x32a13e,_0x4cce90,_0x4cb09c){logger[_0x9937('0x6')](_0x9937('0x7'),_0x4cce90);if(_0x32a13e){logger[_0x9937('0x6')](_0x9937('0x7'),_0x9937('0x8'),util[_0x9937('0x9')](_0x32a13e,{'showHidden':![],'depth':null}),_0x4cce90,_0x4cb09c);_0x229778(_0x32a13e);}_0x31fb15(_0x4cce90);});});}; \ 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 4ddd299..9c4a875 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 _0x4ec8=['minrate','maxrate','format','modem','t38timeout','path','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','moment','../../../../config/logger','fax','logger','info','addVariables','ecm','headerinfo'];(function(_0x1e27b1,_0x10123){var _0x3e5a0f=function(_0x1eff0f){while(--_0x1eff0f){_0x1e27b1['push'](_0x1e27b1['shift']());}};_0x3e5a0f(++_0x10123);}(_0x4ec8,0x1ec));var _0x84ec=function(_0x17a5ad,_0x5e4f36){_0x17a5ad=_0x17a5ad-0x0;var _0x423a1b=_0x4ec8[_0x17a5ad];return _0x423a1b;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x84ec('0x0'));var logger=require(_0x84ec('0x1'))(_0x84ec('0x2'));exports['message']=function(_0x2558c1){return{'message':_0x2558c1};};exports[_0x84ec('0x3')]=function(_0x2cb87a,_0x4395b7){logger[_0x84ec('0x4')](_0x2cb87a,util['inspect'](_0x4395b7,{'showHidden':![],'depth':null}));};exports[_0x84ec('0x5')]=function(_0x2b573d,_0x1c9c30){var _0x50f8f4={'XMF-ECM':_0x1c9c30[_0x84ec('0x6')],'XMF-HEADERINFO':_0x1c9c30[_0x84ec('0x7')],'XMF-MINRATE':_0x1c9c30[_0x84ec('0x8')],'XMF-MAXRATE':_0x1c9c30[_0x84ec('0x9')],'XMF-MODEM':util[_0x84ec('0xa')]('\x22%s\x22',_0x1c9c30[_0x84ec('0xb')]),'XMF-GATEWAY':_0x1c9c30['gateway'],'XMF-FAXDETECT':_0x1c9c30['faxdetect'],'XMF-T38TIMEOUT':_0x1c9c30[_0x84ec('0xc')],'XMF-LOCALSTATIONID':_0x1c9c30['localstationid'],'XMF-PATH':_0x2b573d[_0x84ec('0xd')]};return _0x50f8f4;};exports[_0x84ec('0xe')]=function(_0x353868,_0x499af6){return{'actionid':_0x353868[_0x84ec('0xf')],'action':_0x84ec('0x10'),'channel':_0x353868['channel'],'Exten':_0x84ec('0x11'),'Context':_0x84ec('0x12'),'Priority':'1','callerid':util[_0x84ec('0xa')](_0x84ec('0x13'),_0x353868['headerinfo']?_0x353868[_0x84ec('0x7')]:'',_0x353868['localstationid']),'variable':_0x499af6,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x353868[_0x84ec('0xf')]};}; \ No newline at end of file +var _0xa716=['info','inspect','addVariables','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','localstationid','variablesAction','uniqueid','originate','xcally-motion-fax','\x22%s\x22\x20<%s>','headerinfo','lodash','moment','../../../../config/logger','logger'];(function(_0x15b939,_0x4a4fca){var _0x2da954=function(_0x3d4b97){while(--_0x3d4b97){_0x15b939['push'](_0x15b939['shift']());}};_0x2da954(++_0x4a4fca);}(_0xa716,0x10d));var _0x6a71=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa716[_0x19950b];return _0x3c6b41;};'use strict';var util=require('util');var _=require(_0x6a71('0x0'));var moment=require(_0x6a71('0x1'));var logger=require(_0x6a71('0x2'))('fax');exports['message']=function(_0x410106){return{'message':_0x410106};};exports[_0x6a71('0x3')]=function(_0x38388f,_0x24111b){logger[_0x6a71('0x4')](_0x38388f,util[_0x6a71('0x5')](_0x24111b,{'showHidden':![],'depth':null}));};exports[_0x6a71('0x6')]=function(_0x424baf,_0x55b1a4){var _0x124e92={'XMF-ECM':_0x55b1a4['ecm'],'XMF-HEADERINFO':_0x55b1a4['headerinfo'],'XMF-MINRATE':_0x55b1a4[_0x6a71('0x7')],'XMF-MAXRATE':_0x55b1a4[_0x6a71('0x8')],'XMF-MODEM':util[_0x6a71('0x9')](_0x6a71('0xa'),_0x55b1a4[_0x6a71('0xb')]),'XMF-GATEWAY':_0x55b1a4[_0x6a71('0xc')],'XMF-FAXDETECT':_0x55b1a4[_0x6a71('0xd')],'XMF-T38TIMEOUT':_0x55b1a4['t38timeout'],'XMF-LOCALSTATIONID':_0x55b1a4[_0x6a71('0xe')],'XMF-PATH':_0x424baf['path']};return _0x124e92;};exports[_0x6a71('0xf')]=function(_0x12229d,_0x1ef517){return{'actionid':_0x12229d[_0x6a71('0x10')],'action':_0x6a71('0x11'),'channel':_0x12229d['channel'],'Exten':_0x6a71('0x12'),'Context':'from-sip','Priority':'1','callerid':util['format'](_0x6a71('0x13'),_0x12229d[_0x6a71('0x14')]?_0x12229d[_0x6a71('0x14')]:'',_0x12229d[_0x6a71('0xe')]),'variable':_0x1ef517,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x12229d['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 740001a..5c09a48 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 _0x4260=['[index.js][main]','inspect','util','moment','./server','./report','./acw','./dialer','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','../../config/logger','ami','hour','get','resolve','getAgents','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','error','listen','sync'];(function(_0x273a98,_0x535a1c){var _0x19e0ad=function(_0x52eec6){while(--_0x52eec6){_0x273a98['push'](_0x273a98['shift']());}};_0x19e0ad(++_0x535a1c);}(_0x4260,0xcb));var _0x0426=function(_0x3c9e47,_0x5c1342){_0x3c9e47=_0x3c9e47-0x0;var _0x38f4df=_0x4260[_0x3c9e47];return _0x38f4df;};'use strict';var util=require(_0x0426('0x0'));var moment=require(_0x0426('0x1'));var server=require(_0x0426('0x2'));var Realtime=require('./realtime');var Report=require(_0x0426('0x3'));var Acw=require(_0x0426('0x4'));var Trigger=require('./trigger');var Dialer=require(_0x0426('0x5'));var Preview=require('./preview');var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require(_0x0426('0x6'));var voiceQueueReport=require(_0x0426('0x7'));var voiceCallReport=require(_0x0426('0x8'));var trunk=require(_0x0426('0x9'));var trigger=require(_0x0426('0xa'));var template=require(_0x0426('0xb'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0x0426('0xc'));var faxAccount=require(_0x0426('0xd'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x0426('0xe'));var sugarcrm=require(_0x0426('0xf'));var freshdesk=require(_0x0426('0x10'));var desk=require(_0x0426('0x11'));var zoho=require(_0x0426('0x12'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x0426('0x13'));var servicenow=require(_0x0426('0x14'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x0426('0x15'))(_0x0426('0x16'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x0426('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0426('0x18')](_0x0426('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x0426('0x19')]()['then'](user[_0x0426('0x1a')]())[_0x0426('0x1b')](realtime[_0x0426('0x1c')]())[_0x0426('0x1b')](user[_0x0426('0x1d')]())[_0x0426('0x1b')](realtime[_0x0426('0x1e')]())[_0x0426('0x1b')](trunk[_0x0426('0x1f')]())['then'](realtime[_0x0426('0x20')]())[_0x0426('0x1b')](voiceQueue[_0x0426('0x21')]())[_0x0426('0x1b')](realtime[_0x0426('0x22')]())['then'](trigger[_0x0426('0x23')]())[_0x0426('0x1b')](realtime['initTriggers']())['then'](template[_0x0426('0x24')]())[_0x0426('0x1b')](realtime[_0x0426('0x25')]())[_0x0426('0x1b')](zendesk[_0x0426('0x26')]())['then'](realtime[_0x0426('0x27')]())['then'](salesforce[_0x0426('0x28')]())[_0x0426('0x1b')](realtime[_0x0426('0x29')]())[_0x0426('0x1b')](sugarcrm['getSugarcrmAccounts']())[_0x0426('0x1b')](realtime['initSugarcrmAccounts']())[_0x0426('0x1b')](freshdesk[_0x0426('0x2a')]())[_0x0426('0x1b')](realtime[_0x0426('0x2b')]())[_0x0426('0x1b')](desk[_0x0426('0x2c')]())['then'](realtime[_0x0426('0x2d')]())[_0x0426('0x1b')](zoho['getZohoAccounts']())['then'](realtime[_0x0426('0x2e')]())[_0x0426('0x1b')](vtiger[_0x0426('0x2f')]())[_0x0426('0x1b')](realtime[_0x0426('0x30')]())[_0x0426('0x1b')](freshsales[_0x0426('0x31')]())['then'](realtime[_0x0426('0x32')]())['then'](servicenow[_0x0426('0x33')]())['then'](realtime[_0x0426('0x34')]())[_0x0426('0x1b')](dynamics365['getDynamics365Accounts']())['then'](realtime['initDynamics365Accounts']())[_0x0426('0x1b')](campaign[_0x0426('0x35')]())[_0x0426('0x1b')](realtime[_0x0426('0x36')]())[_0x0426('0x1b')](voiceExtension[_0x0426('0x37')]())[_0x0426('0x1b')](realtime[_0x0426('0x38')]())[_0x0426('0x1b')](faxAccount['getFaxAccounts']())[_0x0426('0x1b')](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return Promise[_0x0426('0x19')]()[_0x0426('0x1b')](voiceQueueReport[_0x0426('0x39')]())['then'](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0x0426('0x3a')]())[_0x0426('0x1b')](realtime['initVoiceQueueHopperHistory']())[_0x0426('0x1b')](cmHopperHistory[_0x0426('0x3b')]())[_0x0426('0x1b')](realtime[_0x0426('0x3c')]())[_0x0426('0x1b')](voiceCallReport[_0x0426('0x3d')]())[_0x0426('0x1b')](realtime['initVoiceCallReports']())['catch'](function(_0x1a46cc){logger[_0x0426('0x3e')]('[index.js][initParams]',util['inspect'](_0x1a46cc,{'showHidden':![],'depth':null}));});}function main(){return server[_0x0426('0x3f')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x0426('0x1b')](function(){return initParams();})[_0x0426('0x1b')](function(){report[_0x0426('0x40')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x32bfad){logger[_0x0426('0x3e')](_0x0426('0x41'),util[_0x0426('0x42')](_0x32bfad,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x09fb=['./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','listen','sync','[index.js][main]','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview'];(function(_0x543616,_0x4c4f3d){var _0x1a6661=function(_0x3f9780){while(--_0x3f9780){_0x543616['push'](_0x543616['shift']());}};_0x1a6661(++_0x4c4f3d);}(_0x09fb,0x14c));var _0xb09f=function(_0x401882,_0x5885d0){_0x401882=_0x401882-0x0;var _0x4245a5=_0x09fb[_0x401882];return _0x4245a5;};'use strict';var util=require('util');var moment=require(_0xb09f('0x0'));var server=require(_0xb09f('0x1'));var Realtime=require(_0xb09f('0x2'));var Report=require(_0xb09f('0x3'));var Acw=require(_0xb09f('0x4'));var Trigger=require(_0xb09f('0x5'));var Dialer=require(_0xb09f('0x6'));var Preview=require(_0xb09f('0x7'));var Fax=require(_0xb09f('0x8'));var user=require(_0xb09f('0x9'));var voiceQueue=require(_0xb09f('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xb09f('0xb'));var trunk=require(_0xb09f('0xc'));var trigger=require(_0xb09f('0xd'));var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xb09f('0xe'));var voiceExtension=require(_0xb09f('0xf'));var faxAccount=require(_0xb09f('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xb09f('0x11'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xb09f('0x12'));var desk=require(_0xb09f('0x13'));var zoho=require(_0xb09f('0x14'));var vtiger=require(_0xb09f('0x15'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xb09f('0x16'));var dynamics365=require(_0xb09f('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xb09f('0x18'))(_0xb09f('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xb09f('0x1a')](_0xb09f('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xb09f('0x1a')](_0xb09f('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xb09f('0x1c')]()[_0xb09f('0x1d')](user[_0xb09f('0x1e')]())['then'](realtime[_0xb09f('0x1f')]())['then'](user[_0xb09f('0x20')]())[_0xb09f('0x1d')](realtime[_0xb09f('0x21')]())[_0xb09f('0x1d')](trunk[_0xb09f('0x22')]())[_0xb09f('0x1d')](realtime['initTrunks']())[_0xb09f('0x1d')](voiceQueue[_0xb09f('0x23')]())[_0xb09f('0x1d')](realtime['initVoiceQueues']())['then'](trigger['getTriggers']())[_0xb09f('0x1d')](realtime['initTriggers']())[_0xb09f('0x1d')](template[_0xb09f('0x24')]())['then'](realtime[_0xb09f('0x25')]())[_0xb09f('0x1d')](zendesk[_0xb09f('0x26')]())[_0xb09f('0x1d')](realtime[_0xb09f('0x27')]())[_0xb09f('0x1d')](salesforce['getSalesforceAccounts']())[_0xb09f('0x1d')](realtime[_0xb09f('0x28')]())[_0xb09f('0x1d')](sugarcrm[_0xb09f('0x29')]())[_0xb09f('0x1d')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0xb09f('0x2a')]())[_0xb09f('0x1d')](realtime['initFreshdeskAccounts']())[_0xb09f('0x1d')](desk['getDeskAccounts']())[_0xb09f('0x1d')](realtime[_0xb09f('0x2b')]())[_0xb09f('0x1d')](zoho[_0xb09f('0x2c')]())[_0xb09f('0x1d')](realtime[_0xb09f('0x2d')]())[_0xb09f('0x1d')](vtiger[_0xb09f('0x2e')]())[_0xb09f('0x1d')](realtime[_0xb09f('0x2f')]())[_0xb09f('0x1d')](freshsales['getFreshsalesAccounts']())[_0xb09f('0x1d')](realtime['initFreshsalesAccounts']())[_0xb09f('0x1d')](servicenow[_0xb09f('0x30')]())['then'](realtime[_0xb09f('0x31')]())[_0xb09f('0x1d')](dynamics365[_0xb09f('0x32')]())[_0xb09f('0x1d')](realtime[_0xb09f('0x33')]())['then'](campaign['getCampaigns']())['then'](realtime['initCampaigns']())['then'](voiceExtension[_0xb09f('0x34')]())[_0xb09f('0x1d')](realtime[_0xb09f('0x35')]())[_0xb09f('0x1d')](faxAccount[_0xb09f('0x36')]())['then'](realtime['initFaxAccounts']())[_0xb09f('0x1d')](function(){return realtime;});}function initParams(){return Promise[_0xb09f('0x1c')]()[_0xb09f('0x1d')](voiceQueueReport[_0xb09f('0x37')]())[_0xb09f('0x1d')](realtime[_0xb09f('0x38')]())[_0xb09f('0x1d')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xb09f('0x1d')](realtime[_0xb09f('0x39')]())['then'](cmHopperHistory[_0xb09f('0x3a')]())[_0xb09f('0x1d')](realtime[_0xb09f('0x3b')]())['then'](voiceCallReport[_0xb09f('0x3c')]())[_0xb09f('0x1d')](realtime[_0xb09f('0x3d')]())[_0xb09f('0x3e')](function(_0x53ca26){logger[_0xb09f('0x3f')](_0xb09f('0x40'),util['inspect'](_0x53ca26,{'showHidden':![],'depth':null}));});}function main(){return server[_0xb09f('0x41')](realtime,preview,fax)[_0xb09f('0x1d')](function(){return initRealtime();})[_0xb09f('0x1d')](function(){return initParams();})[_0xb09f('0x1d')](function(){report[_0xb09f('0x42')]();setInterval(initRealtime,0x1388);})[_0xb09f('0x3e')](function(_0x10b8b1){logger[_0xb09f('0x3f')](_0xb09f('0x43'),util['inspect'](_0x10b8b1,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 6233c4a..69a5552 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 _0xa31a=['omit','user:presence','lodash','moment','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','status','unknown','address','mobile','interface','online','voiceStatus','voiceStatusQueue','onhold','local','md5','prototype','state','not_inuse','inuse','talking','statePause','voiceStatusTime','format','stateTime','voiceStatusCallerIdNumber','user:%s','emit','user:ami:update'];(function(_0x38c632,_0x14e8e6){var _0x12737e=function(_0x3e0fe4){while(--_0x3e0fe4){_0x38c632['push'](_0x38c632['shift']());}};_0x12737e(++_0x14e8e6);}(_0xa31a,0x1b2));var _0xaa31=function(_0x758122,_0x3c9b42){_0x758122=_0x758122-0x0;var _0x3ff10b=_0xa31a[_0x758122];return _0x3ff10b;};'use strict';var _=require(_0xaa31('0x0'));var util=require('util');var moment=require(_0xaa31('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xaa31('0x2'));config[_0xaa31('0x3')]=_['defaults'](config['redis'],{'host':_0xaa31('0x4'),'port':0x18eb});var io=require(_0xaa31('0x5'))(new Redis(config['redis']));function Agent(_0x3d1790){this['id']=_0x3d1790['id']||0x0;this[_0xaa31('0x6')]=_0x3d1790['name']||'';this[_0xaa31('0x7')]=_0x3d1790[_0xaa31('0x7')]||'';this[_0xaa31('0x8')]=_0x3d1790['accountcode']||'';this['fullname']=_0x3d1790[_0xaa31('0x9')]||'';this['state']='unknown';this['stateTime']=0x0;this[_0xaa31('0xa')]=_0xaa31('0xb');this[_0xaa31('0xc')]='';this['phone']='';this[_0xaa31('0xd')]='';this[_0xaa31('0xe')]='';this[_0xaa31('0xf')]=_0x3d1790[_0xaa31('0xf')]||![];this[_0xaa31('0x10')]=_0xaa31('0xb');this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0xaa31('0x11')]='';this[_0xaa31('0x12')]=![];this[_0xaa31('0x13')]=![];this[_0xaa31('0x14')]='';}Agent[_0xaa31('0x15')]['updateStatusRealtime']=function(_0x26d174){var _0x2bf889;if(_0x26d174&&_0x26d174[_0xaa31('0x16')]){_0x2bf889=_0x26d174[_0xaa31('0x16')]['toLowerCase']();switch(_0x2bf889){case _0xaa31('0x17'):_0x2bf889='idle';break;case _0xaa31('0x18'):_0x2bf889=_0xaa31('0x19');break;}}if(_0x2bf889&&this[_0xaa31('0x10')]!==_0x2bf889||_0x26d174[_0xaa31('0x1a')]){this[_0xaa31('0x1b')]=_['toNumber'](moment()[_0xaa31('0x1c')]('x'));}if(_0x2bf889){this['voiceStatus']=_0x2bf889;}var _0x334da3={'id':this['id'],'name':this['name'],'email':this[_0xaa31('0x7')],'accountcode':this['accountcode'],'fullname':this[_0xaa31('0x9')],'state':this[_0xaa31('0x16')],'stateTime':this[_0xaa31('0x1d')],'status':this[_0xaa31('0xa')],'address':this['address'],'online':this[_0xaa31('0xf')],'voiceStatus':this[_0xaa31('0x10')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0xaa31('0x1e')],'voiceStatusQueue':this[_0xaa31('0x11')],'interface':this['interface'],'onhold':this[_0xaa31('0x12')]};var _0x2cbe37=md5(JSON['stringify'](_0x334da3));if(this[_0xaa31('0x14')]!==_0x2cbe37){this['md5']=_0x2cbe37;io['to'](util[_0xaa31('0x1c')](_0xaa31('0x1f'),_0x334da3[_0xaa31('0x6')]))[_0xaa31('0x20')](_0xaa31('0x21'),_[_0xaa31('0x22')](_0x334da3,[_0xaa31('0xf')]));io[_0xaa31('0x20')](_0xaa31('0x23'),_0x334da3);}};module['exports']=Agent; \ No newline at end of file +var _0x3fd8=['voiceStatusQueue','local','updateStatusRealtime','toLowerCase','idle','inuse','voiceStatus','statePause','toNumber','accountcode','status','onhold','stringify','format','user:%s','user:ami:update','omit','emit','user:presence','lodash','md5','ioredis','../../../config/environment','redis','socket.io-emitter','name','email','fullname','state','unknown','stateTime','address','mobile','online','voiceStatusTime','voiceStatusCallerIdNumber'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x3fd8,0xa3));var _0x83fd=function(_0x1b62ca,_0x3f621a){_0x1b62ca=_0x1b62ca-0x0;var _0x2f71a9=_0x3fd8[_0x1b62ca];return _0x2f71a9;};'use strict';var _=require(_0x83fd('0x0'));var util=require('util');var moment=require('moment');var md5=require(_0x83fd('0x1'));var Redis=require(_0x83fd('0x2'));var config=require(_0x83fd('0x3'));config[_0x83fd('0x4')]=_['defaults'](config[_0x83fd('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x83fd('0x5'))(new Redis(config[_0x83fd('0x4')]));function Agent(_0x4d948c){this['id']=_0x4d948c['id']||0x0;this[_0x83fd('0x6')]=_0x4d948c[_0x83fd('0x6')]||'';this[_0x83fd('0x7')]=_0x4d948c[_0x83fd('0x7')]||'';this['accountcode']=_0x4d948c['accountcode']||'';this['fullname']=_0x4d948c[_0x83fd('0x8')]||'';this[_0x83fd('0x9')]=_0x83fd('0xa');this[_0x83fd('0xb')]=0x0;this['status']=_0x83fd('0xa');this[_0x83fd('0xc')]='';this['phone']='';this[_0x83fd('0xd')]='';this['interface']='';this[_0x83fd('0xe')]=_0x4d948c[_0x83fd('0xe')]||![];this['voiceStatus']=_0x83fd('0xa');this[_0x83fd('0xf')]=0x0;this[_0x83fd('0x10')]='';this[_0x83fd('0x11')]='';this['onhold']=![];this[_0x83fd('0x12')]=![];this['md5']='';}Agent['prototype'][_0x83fd('0x13')]=function(_0x2d99b4){var _0x68ef17;if(_0x2d99b4&&_0x2d99b4[_0x83fd('0x9')]){_0x68ef17=_0x2d99b4['state'][_0x83fd('0x14')]();switch(_0x68ef17){case'not_inuse':_0x68ef17=_0x83fd('0x15');break;case _0x83fd('0x16'):_0x68ef17='talking';break;}}if(_0x68ef17&&this[_0x83fd('0x17')]!==_0x68ef17||_0x2d99b4[_0x83fd('0x18')]){this[_0x83fd('0xf')]=_[_0x83fd('0x19')](moment()['format']('x'));}if(_0x68ef17){this[_0x83fd('0x17')]=_0x68ef17;}var _0x2db2ab={'id':this['id'],'name':this[_0x83fd('0x6')],'email':this[_0x83fd('0x7')],'accountcode':this[_0x83fd('0x1a')],'fullname':this[_0x83fd('0x8')],'state':this[_0x83fd('0x9')],'stateTime':this['stateTime'],'status':this[_0x83fd('0x1b')],'address':this[_0x83fd('0xc')],'online':this[_0x83fd('0xe')],'voiceStatus':this[_0x83fd('0x17')],'voiceStatusTime':this[_0x83fd('0xf')],'voiceStatusCallerIdNumber':this[_0x83fd('0x10')],'voiceStatusQueue':this[_0x83fd('0x11')],'interface':this['interface'],'onhold':this[_0x83fd('0x1c')]};var _0x606062=md5(JSON[_0x83fd('0x1d')](_0x2db2ab));if(this['md5']!==_0x606062){this[_0x83fd('0x1')]=_0x606062;io['to'](util[_0x83fd('0x1e')](_0x83fd('0x1f'),_0x2db2ab[_0x83fd('0x6')]))['emit'](_0x83fd('0x20'),_[_0x83fd('0x21')](_0x2db2ab,[_0x83fd('0xe')]));io[_0x83fd('0x22')](_0x83fd('0x23'),_0x2db2ab);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 5b06432..5c1802f 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 _0x0b9d=['dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','campaign','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC'];(function(_0x1514c6,_0x127cd0){var _0x57a922=function(_0x174e03){while(--_0x174e03){_0x1514c6['push'](_0x1514c6['shift']());}};_0x57a922(++_0x127cd0);}(_0x0b9d,0x1ca));var _0xd0b9=function(_0x1e44ac,_0x34b757){_0x1e44ac=_0x1e44ac-0x0;var _0x454c8f=_0x0b9d[_0x1e44ac];return _0x454c8f;};'use strict';function Campaign(_0x3df98e){this['id']=_0x3df98e['id']||0x0;this[_0xd0b9('0x0')]=_0x3df98e[_0xd0b9('0x0')]||'';this['type']=_0x3df98e['type']||_0xd0b9('0x1');this['originated']=0x0;this[_0xd0b9('0x2')]=0x0;this[_0xd0b9('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0xd0b9('0x4')]='';this[_0xd0b9('0x5')]=!![];this['active']=_0x3df98e[_0xd0b9('0x6')];this[_0xd0b9('0x7')]=_0x3df98e['limitCalls'];this['dialTimezone']=_0x3df98e[_0xd0b9('0x8')]||null;this[_0xd0b9('0x9')]=_0x3df98e['dialGlobalInterval']?_0x3df98e['dialGlobalInterval']:null;this[_0xd0b9('0xa')]=_0x3df98e[_0xd0b9('0xa')];this[_0xd0b9('0xb')]=_0x3df98e[_0xd0b9('0xb')];this[_0xd0b9('0xc')]=_0x3df98e[_0xd0b9('0xc')]||0x1e;this[_0xd0b9('0xd')]=_0x3df98e[_0xd0b9('0xd')];this['dialCongestionRetryFrequency']=_0x3df98e[_0xd0b9('0xe')];this[_0xd0b9('0xf')]=_0x3df98e[_0xd0b9('0xf')];this[_0xd0b9('0x10')]=_0x3df98e[_0xd0b9('0x10')];this[_0xd0b9('0x11')]=_0x3df98e[_0xd0b9('0x11')];this['dialNoAnswerRetryFrequency']=_0x3df98e[_0xd0b9('0x12')];this[_0xd0b9('0x13')]=_0x3df98e['dialGlobalMaxRetry'];this[_0xd0b9('0x14')]=_0x3df98e[_0xd0b9('0x14')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x3df98e[_0xd0b9('0x15')]||0x96;this['dialDropMaxRetry']=_0x3df98e[_0xd0b9('0x16')]||0x3;this[_0xd0b9('0x17')]=_0x3df98e[_0xd0b9('0x17')]||0x96;this[_0xd0b9('0x18')]=_0x3df98e[_0xd0b9('0x18')]||0x3;this[_0xd0b9('0x19')]=_0x3df98e[_0xd0b9('0x19')]||0x96;this[_0xd0b9('0x1a')]=_0x3df98e[_0xd0b9('0x1a')]||0x3;this[_0xd0b9('0x1b')]=_0x3df98e['dialMachineRetryFrequency']||0x96;this[_0xd0b9('0x1c')]=_0x3df98e[_0xd0b9('0x1c')]||0x3;this[_0xd0b9('0x1d')]=_0x3df98e[_0xd0b9('0x1d')]||0x96;this[_0xd0b9('0x1e')]=_0x3df98e['dialOrderByScheduledAt']||_0xd0b9('0x1f');this[_0xd0b9('0x20')]=_0x3df98e[_0xd0b9('0x20')]||undefined;this[_0xd0b9('0x21')]=_0x3df98e[_0xd0b9('0x21')]||undefined;this['dialCutDigit']=_0x3df98e['dialCutDigit']||undefined;this['TrunkBackup']=_0x3df98e[_0xd0b9('0x22')]?_0x3df98e[_0xd0b9('0x22')]:undefined;this['Trunk']=_0x3df98e['Trunk']?_0x3df98e[_0xd0b9('0x23')]:undefined;this['Interval']=_0x3df98e['Interval']?_0x3df98e[_0xd0b9('0x24')]:undefined;this[_0xd0b9('0x25')]=_0x3df98e[_0xd0b9('0x25')]?_0x3df98e[_0xd0b9('0x25')]:undefined;this[_0xd0b9('0x26')]=_0x3df98e[_0xd0b9('0x25')]?_0x3df98e['SquareProject'][_0xd0b9('0x0')]:undefined;this['dialAMDActive']=_0x3df98e[_0xd0b9('0x27')]||![];this[_0xd0b9('0x28')]=_0x3df98e['dialAMDInitialSilence'];this[_0xd0b9('0x29')]=_0x3df98e[_0xd0b9('0x29')];this['dialAMDAfterGreetingSilence']=_0x3df98e[_0xd0b9('0x2a')];this['dialAMDTotalAnalysisTime']=_0x3df98e[_0xd0b9('0x2b')];this['dialAMDMinWordLength']=_0x3df98e['dialAMDMinWordLength'];this[_0xd0b9('0x2c')]=_0x3df98e[_0xd0b9('0x2c')];this[_0xd0b9('0x2d')]=_0x3df98e[_0xd0b9('0x2d')];this[_0xd0b9('0x2e')]=_0x3df98e[_0xd0b9('0x2e')];this[_0xd0b9('0x2f')]=_0x3df98e[_0xd0b9('0x2f')];}module[_0xd0b9('0x30')]=Campaign; \ No newline at end of file +var _0xe6e6=['dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xe6e6,0x79));var _0x6e6e=function(_0x25e495,_0x239afd){_0x25e495=_0x25e495-0x0;var _0x138bc7=_0xe6e6[_0x25e495];return _0x138bc7;};'use strict';function Campaign(_0x461f03){this['id']=_0x461f03['id']||0x0;this[_0x6e6e('0x0')]=_0x461f03[_0x6e6e('0x0')]||'';this[_0x6e6e('0x1')]=_0x461f03[_0x6e6e('0x1')]||_0x6e6e('0x2');this['originated']=0x0;this[_0x6e6e('0x3')]=0x0;this[_0x6e6e('0x4')]=0x0;this[_0x6e6e('0x5')]=0x0;this[_0x6e6e('0x6')]='';this[_0x6e6e('0x7')]=!![];this[_0x6e6e('0x8')]=_0x461f03[_0x6e6e('0x8')];this['limitCalls']=_0x461f03[_0x6e6e('0x9')];this[_0x6e6e('0xa')]=_0x461f03[_0x6e6e('0xa')]||null;this[_0x6e6e('0xb')]=_0x461f03['dialGlobalInterval']?_0x461f03[_0x6e6e('0xb')]:null;this[_0x6e6e('0xc')]=_0x461f03[_0x6e6e('0xc')];this[_0x6e6e('0xd')]=_0x461f03['dialOriginateCallerIdNumber'];this[_0x6e6e('0xe')]=_0x461f03['dialOriginateTimeout']||0x1e;this[_0x6e6e('0xf')]=_0x461f03[_0x6e6e('0xf')];this[_0x6e6e('0x10')]=_0x461f03[_0x6e6e('0x10')];this[_0x6e6e('0x11')]=_0x461f03[_0x6e6e('0x11')];this[_0x6e6e('0x12')]=_0x461f03[_0x6e6e('0x12')];this[_0x6e6e('0x13')]=_0x461f03[_0x6e6e('0x13')];this['dialNoAnswerRetryFrequency']=_0x461f03[_0x6e6e('0x14')];this[_0x6e6e('0x15')]=_0x461f03[_0x6e6e('0x15')];this['dialNoSuchNumberMaxRetry']=_0x461f03[_0x6e6e('0x16')]||0x3;this[_0x6e6e('0x17')]=_0x461f03[_0x6e6e('0x17')]||0x96;this[_0x6e6e('0x18')]=_0x461f03[_0x6e6e('0x18')]||0x3;this[_0x6e6e('0x19')]=_0x461f03[_0x6e6e('0x19')]||0x96;this[_0x6e6e('0x1a')]=_0x461f03['dialAbandonedMaxRetry']||0x3;this[_0x6e6e('0x1b')]=_0x461f03[_0x6e6e('0x1b')]||0x96;this['dialMachineMaxRetry']=_0x461f03['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x461f03[_0x6e6e('0x1c')]||0x96;this[_0x6e6e('0x1d')]=_0x461f03[_0x6e6e('0x1d')]||0x3;this[_0x6e6e('0x1e')]=_0x461f03['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x461f03[_0x6e6e('0x1f')]||_0x6e6e('0x20');this[_0x6e6e('0x21')]=_0x461f03[_0x6e6e('0x21')]||undefined;this[_0x6e6e('0x22')]=_0x461f03[_0x6e6e('0x22')]||undefined;this['dialCutDigit']=_0x461f03[_0x6e6e('0x23')]||undefined;this['TrunkBackup']=_0x461f03[_0x6e6e('0x24')]?_0x461f03[_0x6e6e('0x24')]:undefined;this['Trunk']=_0x461f03[_0x6e6e('0x25')]?_0x461f03[_0x6e6e('0x25')]:undefined;this[_0x6e6e('0x26')]=_0x461f03[_0x6e6e('0x26')]?_0x461f03[_0x6e6e('0x26')]:undefined;this[_0x6e6e('0x27')]=_0x461f03[_0x6e6e('0x27')]?_0x461f03[_0x6e6e('0x27')]:undefined;this[_0x6e6e('0x28')]=_0x461f03[_0x6e6e('0x27')]?_0x461f03['SquareProject'][_0x6e6e('0x0')]:undefined;this[_0x6e6e('0x29')]=_0x461f03[_0x6e6e('0x29')]||![];this[_0x6e6e('0x2a')]=_0x461f03['dialAMDInitialSilence'];this[_0x6e6e('0x2b')]=_0x461f03[_0x6e6e('0x2b')];this[_0x6e6e('0x2c')]=_0x461f03['dialAMDAfterGreetingSilence'];this[_0x6e6e('0x2d')]=_0x461f03[_0x6e6e('0x2d')];this[_0x6e6e('0x2e')]=_0x461f03['dialAMDMinWordLength'];this[_0x6e6e('0x2f')]=_0x461f03[_0x6e6e('0x2f')];this['dialAMDMaximumNumberOfWords']=_0x461f03[_0x6e6e('0x30')];this[_0x6e6e('0x31')]=_0x461f03[_0x6e6e('0x31')];this[_0x6e6e('0x32')]=_0x461f03['dialAMDMaximumWordLength'];}module[_0x6e6e('0x33')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 29ade5c..551aebe 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 _0x9d62=['connectedlinename','accountcode','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','abandoned','lastapplication','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname'];(function(_0x1b0db2,_0x105e3e){var _0xc18de3=function(_0x3498b3){while(--_0x3498b3){_0x1b0db2['push'](_0x1b0db2['shift']());}};_0xc18de3(++_0x105e3e);}(_0x9d62,0xaf));var _0x29d6=function(_0x333467,_0x505235){_0x333467=_0x333467-0x0;var _0x285529=_0x9d62[_0x333467];return _0x285529;};'use strict';function Channel(){this[_0x29d6('0x0')]=null;this[_0x29d6('0x1')]='';this[_0x29d6('0x2')]='';this[_0x29d6('0x3')]=0x0;this[_0x29d6('0x4')]='';this['connectedlinenum']=undefined;this[_0x29d6('0x5')]=undefined;this[_0x29d6('0x6')]=0x0;this[_0x29d6('0x7')]='';this[_0x29d6('0x8')]=0x0;this[_0x29d6('0x9')]=0x0;this['exten']=0x0;this[_0x29d6('0xa')]=![];this[_0x29d6('0xb')]=null;this[_0x29d6('0xc')]=null;this[_0x29d6('0xd')]=![];this[_0x29d6('0xe')]=![];this[_0x29d6('0xf')]='';this['lastdata']='';this[_0x29d6('0x10')]=0x0;this[_0x29d6('0x11')]=0x0;this[_0x29d6('0x12')]=0x0;this[_0x29d6('0x13')]=null;this[_0x29d6('0x14')]=null;this[_0x29d6('0x15')]=null;this[_0x29d6('0x16')]=![];this[_0x29d6('0x17')]=null;this['queue']=null;this[_0x29d6('0x18')]=[];this[_0x29d6('0x19')]=undefined;this[_0x29d6('0x1a')]=undefined;this[_0x29d6('0x1b')]=undefined;this[_0x29d6('0x1c')]=0x0;}module[_0x29d6('0x1d')]=Channel; \ No newline at end of file +var _0x1537=['disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferType','mohtime','exports','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','uniqueid','exten','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','holdtime','tag'];(function(_0x526bda,_0x3d2f95){var _0x929204=function(_0x3ca2c9){while(--_0x3ca2c9){_0x526bda['push'](_0x526bda['shift']());}};_0x929204(++_0x3d2f95);}(_0x1537,0x132));var _0x7153=function(_0x34cc1d,_0x5574f0){_0x34cc1d=_0x34cc1d-0x0;var _0x38f595=_0x1537[_0x34cc1d];return _0x38f595;};'use strict';function Channel(){this[_0x7153('0x0')]=null;this[_0x7153('0x1')]='';this['destinationchannel']='';this[_0x7153('0x2')]=0x0;this[_0x7153('0x3')]='';this[_0x7153('0x4')]=undefined;this[_0x7153('0x5')]=undefined;this[_0x7153('0x6')]=0x0;this['context']='';this[_0x7153('0x7')]=0x0;this['linkedid']=0x0;this[_0x7153('0x8')]=0x0;this['answered']=![];this[_0x7153('0x9')]=null;this[_0x7153('0xa')]=null;this[_0x7153('0xb')]=![];this[_0x7153('0xc')]=![];this[_0x7153('0xd')]='';this[_0x7153('0xe')]='';this[_0x7153('0xf')]=0x0;this['billableseconds']=0x0;this[_0x7153('0x10')]=0x0;this['type']=null;this[_0x7153('0x11')]=null;this[_0x7153('0x12')]=null;this[_0x7153('0x13')]=![];this[_0x7153('0x14')]=null;this[_0x7153('0x15')]=null;this[_0x7153('0x16')]=[];this[_0x7153('0x17')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x7153('0x18')]=undefined;this[_0x7153('0x19')]=0x0;}module[_0x7153('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index a301155..55fabfc 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 _0x507a=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0x1aec2d,_0x166b52){var _0xb5ad96=function(_0x5d96c4){while(--_0x5d96c4){_0x1aec2d['push'](_0x1aec2d['shift']());}};_0xb5ad96(++_0x166b52);}(_0x507a,0x111));var _0xa507=function(_0x111e3b,_0x1fff70){_0x111e3b=_0x111e3b-0x0;var _0x2a951a=_0x507a[_0x111e3b];return _0x2a951a;};'use strict';function DeskAccount(_0x3e84f7){this['id']=_0x3e84f7['id']||0x0;this[_0xa507('0x0')]=_0x3e84f7[_0xa507('0x0')]||'';this[_0xa507('0x1')]=_0x3e84f7[_0xa507('0x1')]||'';this[_0xa507('0x2')]=_0x3e84f7['remoteUri']||'';this['authType']=_0x3e84f7[_0xa507('0x3')]||'';this[_0xa507('0x4')]=_0x3e84f7[_0xa507('0x4')]||'';this[_0xa507('0x5')]=_0x3e84f7[_0xa507('0x5')]||'';this[_0xa507('0x6')]=_0x3e84f7[_0xa507('0x6')]||'';this[_0xa507('0x7')]=_0x3e84f7['token']||'';this[_0xa507('0x8')]=_0x3e84f7['tokenSecret']||'';this['type']=_0x3e84f7[_0xa507('0x9')]||'';this[_0xa507('0xa')]=_0x3e84f7['serverUrl']||'';this[_0xa507('0xb')]=_0x3e84f7[_0xa507('0xb')]||{};}module[_0xa507('0xc')]=DeskAccount; \ No newline at end of file +var _0xbeec=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0xf91841,_0x182ae3){var _0x4b9c44=function(_0x2e216e){while(--_0x2e216e){_0xf91841['push'](_0xf91841['shift']());}};_0x4b9c44(++_0x182ae3);}(_0xbeec,0x1ee));var _0xcbee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbeec[_0x3dd15e];return _0x231fd0;};'use strict';function DeskAccount(_0x18ffcc){this['id']=_0x18ffcc['id']||0x0;this[_0xcbee('0x0')]=_0x18ffcc['name']||'';this[_0xcbee('0x1')]=_0x18ffcc['username']||'';this['remoteUri']=_0x18ffcc[_0xcbee('0x2')]||'';this[_0xcbee('0x3')]=_0x18ffcc['authType']||'';this['password']=_0x18ffcc[_0xcbee('0x4')]||'';this['consumerKey']=_0x18ffcc[_0xcbee('0x5')]||'';this[_0xcbee('0x6')]=_0x18ffcc[_0xcbee('0x6')]||'';this['token']=_0x18ffcc[_0xcbee('0x7')]||'';this['tokenSecret']=_0x18ffcc[_0xcbee('0x8')]||'';this[_0xcbee('0x9')]=_0x18ffcc[_0xcbee('0x9')]||'';this[_0xcbee('0xa')]=_0x18ffcc[_0xcbee('0xa')]||'';this[_0xcbee('0xb')]=_0x18ffcc[_0xcbee('0xb')]||{};}module[_0xcbee('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 ea6bc6d..2f9ddc8 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 _0x7a73=['serverUrl','modernAuthentication','Configurations','exports','username','password','remoteUri','tenantId','clientSecret'];(function(_0x4fadb8,_0x11b539){var _0x3c9e20=function(_0x134c11){while(--_0x134c11){_0x4fadb8['push'](_0x4fadb8['shift']());}};_0x3c9e20(++_0x11b539);}(_0x7a73,0x1a2));var _0x37a7=function(_0x404713,_0x563d0e){_0x404713=_0x404713-0x0;var _0x40dfee=_0x7a73[_0x404713];return _0x40dfee;};'use strict';function Dynamics365Account(_0x19a68f){this['id']=_0x19a68f['id']||0x0;this['name']=_0x19a68f['name']||'';this[_0x37a7('0x0')]=_0x19a68f['username']||'';this[_0x37a7('0x1')]=_0x19a68f[_0x37a7('0x1')]||'';this[_0x37a7('0x2')]=_0x19a68f[_0x37a7('0x2')]||'';this[_0x37a7('0x3')]=_0x19a68f['tenantId']||'';this['clientId']=_0x19a68f['clientId']||'';this[_0x37a7('0x4')]=_0x19a68f[_0x37a7('0x4')]||{};this[_0x37a7('0x5')]=_0x19a68f['serverUrl']||'';this['modernAuthentication']=_0x19a68f[_0x37a7('0x6')]||![];this[_0x37a7('0x7')]=_0x19a68f['Configurations']||{};this['CloudProvider']=_0x19a68f['CloudProvider']||{};}module[_0x37a7('0x8')]=Dynamics365Account; \ No newline at end of file +var _0xa4a2=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','name','username'];(function(_0x5a0885,_0x47f82f){var _0x529bee=function(_0x55d3c6){while(--_0x55d3c6){_0x5a0885['push'](_0x5a0885['shift']());}};_0x529bee(++_0x47f82f);}(_0xa4a2,0x1cc));var _0x2a4a=function(_0x8d5a2,_0x19e7b0){_0x8d5a2=_0x8d5a2-0x0;var _0x5d2b2e=_0xa4a2[_0x8d5a2];return _0x5d2b2e;};'use strict';function Dynamics365Account(_0x45324e){this['id']=_0x45324e['id']||0x0;this['name']=_0x45324e[_0x2a4a('0x0')]||'';this['username']=_0x45324e[_0x2a4a('0x1')]||'';this[_0x2a4a('0x2')]=_0x45324e[_0x2a4a('0x2')]||'';this[_0x2a4a('0x3')]=_0x45324e[_0x2a4a('0x3')]||'';this[_0x2a4a('0x4')]=_0x45324e[_0x2a4a('0x4')]||'';this['clientId']=_0x45324e[_0x2a4a('0x5')]||'';this[_0x2a4a('0x6')]=_0x45324e['clientSecret']||{};this[_0x2a4a('0x7')]=_0x45324e['serverUrl']||'';this[_0x2a4a('0x8')]=_0x45324e[_0x2a4a('0x8')]||![];this[_0x2a4a('0x9')]=_0x45324e['Configurations']||{};this[_0x2a4a('0xa')]=_0x45324e[_0x2a4a('0xa')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index ad08868..d708936 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 _0x25e8=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x5a933d,_0xc5f2b7){var _0xa52241=function(_0x266036){while(--_0x266036){_0x5a933d['push'](_0x5a933d['shift']());}};_0xa52241(++_0xc5f2b7);}(_0x25e8,0x1d8));var _0x825e=function(_0x23e225,_0x33ed70){_0x23e225=_0x23e225-0x0;var _0x41514e=_0x25e8[_0x23e225];return _0x41514e;};'use strict';function FaxAccount(_0x47f565){this['id']=_0x47f565['id']||0x0;this[_0x825e('0x0')]=_0x47f565[_0x825e('0x0')]||'';this[_0x825e('0x1')]=_0x47f565['description'];this['ecm']=_0x47f565[_0x825e('0x2')];this['headerinfo']=_0x47f565[_0x825e('0x3')];this[_0x825e('0x4')]=_0x47f565['localstationid'];this[_0x825e('0x5')]=_0x47f565[_0x825e('0x5')]||0x960;this['maxrate']=_0x47f565[_0x825e('0x6')]||0x3840;this['modem']=_0x47f565[_0x825e('0x7')]||_0x825e('0x8');this[_0x825e('0x9')]=_0x47f565[_0x825e('0x9')]||'no';this[_0x825e('0xa')]=_0x47f565[_0x825e('0xa')]||'no';this[_0x825e('0xb')]=_0x47f565['t38timeout']||0x1388;this[_0x825e('0xc')]=_0x47f565[_0x825e('0xc')]||_0x825e('0xd');this['Trunk']=_0x47f565[_0x825e('0xe')]?_0x47f565[_0x825e('0xe')]:undefined;this['ListId']=_0x47f565['ListId'];this[_0x825e('0xf')]=_0x47f565[_0x825e('0xf')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x6152=['modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','minrate','maxrate'];(function(_0x36832f,_0x270f35){var _0x496c6a=function(_0x1fe6c3){while(--_0x1fe6c3){_0x36832f['push'](_0x36832f['shift']());}};_0x496c6a(++_0x270f35);}(_0x6152,0x170));var _0x2615=function(_0x301430,_0x1f5424){_0x301430=_0x301430-0x0;var _0x5d16a6=_0x6152[_0x301430];return _0x5d16a6;};'use strict';function FaxAccount(_0x366760){this['id']=_0x366760['id']||0x0;this[_0x2615('0x0')]=_0x366760['name']||'';this[_0x2615('0x1')]=_0x366760[_0x2615('0x1')];this[_0x2615('0x2')]=_0x366760[_0x2615('0x2')];this[_0x2615('0x3')]=_0x366760[_0x2615('0x3')];this['localstationid']=_0x366760['localstationid'];this[_0x2615('0x4')]=_0x366760[_0x2615('0x4')]||0x960;this['maxrate']=_0x366760[_0x2615('0x5')]||0x3840;this[_0x2615('0x6')]=_0x366760['modem']||_0x2615('0x7');this[_0x2615('0x8')]=_0x366760['gateway']||'no';this['faxdetect']=_0x366760[_0x2615('0x9')]||'no';this[_0x2615('0xa')]=_0x366760[_0x2615('0xa')]||0x1388;this['tech']=_0x366760[_0x2615('0xb')]||_0x2615('0xc');this[_0x2615('0xd')]=_0x366760[_0x2615('0xd')]?_0x366760[_0x2615('0xd')]:undefined;this['ListId']=_0x366760[_0x2615('0xe')];this[_0x2615('0xf')]=_0x366760['key'];}module[_0x2615('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 31bfee8..632fecb 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 _0x5579=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x5579,0x7f));var _0x9557=function(_0x1a9147,_0x2b9b37){_0x1a9147=_0x1a9147-0x0;var _0x41dc59=_0x5579[_0x1a9147];return _0x41dc59;};'use strict';function FreshdeskAccount(_0x579403){this['id']=_0x579403['id']||0x0;this[_0x9557('0x0')]=_0x579403[_0x9557('0x0')]||'';this['username']=_0x579403[_0x9557('0x1')]||'';this['apiKey']=_0x579403[_0x9557('0x2')]||'';this[_0x9557('0x3')]=_0x579403[_0x9557('0x3')]||'';this[_0x9557('0x4')]=_0x579403[_0x9557('0x4')]||'';this[_0x9557('0x5')]=_0x579403['Configurations']||{};}module[_0x9557('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xf3d5=['remoteUri','serverUrl','Configurations','exports','name','username','token'];(function(_0x151721,_0x20d5bc){var _0x2deaa7=function(_0x499812){while(--_0x499812){_0x151721['push'](_0x151721['shift']());}};_0x2deaa7(++_0x20d5bc);}(_0xf3d5,0x162));var _0x5f3d=function(_0xfc3f65,_0x21f988){_0xfc3f65=_0xfc3f65-0x0;var _0xc3d341=_0xf3d5[_0xfc3f65];return _0xc3d341;};'use strict';function FreshdeskAccount(_0x2575f5){this['id']=_0x2575f5['id']||0x0;this[_0x5f3d('0x0')]=_0x2575f5[_0x5f3d('0x0')]||'';this[_0x5f3d('0x1')]=_0x2575f5['username']||'';this['apiKey']=_0x2575f5[_0x5f3d('0x2')]||'';this[_0x5f3d('0x3')]=_0x2575f5[_0x5f3d('0x3')]||'';this[_0x5f3d('0x4')]=_0x2575f5[_0x5f3d('0x4')]||'';this[_0x5f3d('0x5')]=_0x2575f5[_0x5f3d('0x5')]||{};}module[_0x5f3d('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 5530f76..d1f539e 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 _0x7d9f=['name','username','token','remoteUri','serverUrl','exports'];(function(_0x4e7079,_0x4c5ed3){var _0x3e53ea=function(_0x2f6050){while(--_0x2f6050){_0x4e7079['push'](_0x4e7079['shift']());}};_0x3e53ea(++_0x4c5ed3);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x3ccc28,_0x5036d5){_0x3ccc28=_0x3ccc28-0x0;var _0x47dd45=_0x7d9f[_0x3ccc28];return _0x47dd45;};'use strict';function FreshsalesAccount(_0x1adc1f){this['id']=_0x1adc1f['id']||0x0;this[_0xf7d9('0x0')]=_0x1adc1f[_0xf7d9('0x0')]||'';this[_0xf7d9('0x1')]=_0x1adc1f[_0xf7d9('0x1')]||'';this['apiKey']=_0x1adc1f[_0xf7d9('0x2')]||'';this[_0xf7d9('0x3')]=_0x1adc1f[_0xf7d9('0x3')]||'';this[_0xf7d9('0x4')]=_0x1adc1f[_0xf7d9('0x4')]||'';this['Configurations']=_0x1adc1f['Configurations']||{};}module[_0xf7d9('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0xe700=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0xe700,0x75));var _0x0e70=function(_0x27e46d,_0x188bab){_0x27e46d=_0x27e46d-0x0;var _0x4c9cef=_0xe700[_0x27e46d];return _0x4c9cef;};'use strict';function FreshsalesAccount(_0x3600e2){this['id']=_0x3600e2['id']||0x0;this[_0x0e70('0x0')]=_0x3600e2[_0x0e70('0x0')]||'';this[_0x0e70('0x1')]=_0x3600e2[_0x0e70('0x1')]||'';this[_0x0e70('0x2')]=_0x3600e2[_0x0e70('0x3')]||'';this[_0x0e70('0x4')]=_0x3600e2[_0x0e70('0x4')]||'';this[_0x0e70('0x5')]=_0x3600e2['serverUrl']||'';this[_0x0e70('0x6')]=_0x3600e2['Configurations']||{};}module[_0x0e70('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 6f0930e..b82dbfb 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 _0x8444=['accountcode','holdtime','lastAssignedTo','voice','mohtime','variables','type','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename'];(function(_0x3324b4,_0x2b1e1a){var _0x4a8dda=function(_0x2d0951){while(--_0x2d0951){_0x3324b4['push'](_0x3324b4['shift']());}};_0x4a8dda(++_0x2b1e1a);}(_0x8444,0xf8));var _0x4844=function(_0x1f8076,_0x2af2fd){_0x1f8076=_0x1f8076-0x0;var _0x4f2882=_0x8444[_0x1f8076];return _0x4f2882;};'use strict';function QueueReport(){this[_0x4844('0x0')]=_0x4844('0x1');this[_0x4844('0x2')]='';this['calleridnum']='';this[_0x4844('0x3')]='';this[_0x4844('0x4')]='';this[_0x4844('0x5')]=null;this[_0x4844('0x6')]=null;this[_0x4844('0x7')]=0x1;this[_0x4844('0x8')]=0x1;this['queuecallerabandon']=![];this[_0x4844('0x9')]=null;this[_0x4844('0xa')]=![];this['queuecallercompleteAt']=null;this[_0x4844('0xb')]=![];this[_0x4844('0xc')]=null;this[_0x4844('0xd')]=0x1;this[_0x4844('0xe')]='';this['connectedlinenum']='';this[_0x4844('0xf')]='';this[_0x4844('0x10')]='';this['context']='';this['exten']='';this['priority']='';this[_0x4844('0x11')]=0x0;this['assigned']=![];this[_0x4844('0x12')]='';this['motionChannel']=_0x4844('0x13');this[_0x4844('0x14')]=0x0;this[_0x4844('0x15')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0xe620=['uniqueid','calleridname','queuecallerleaveAt','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','context','exten','priority','holdtime','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type'];(function(_0x5afc49,_0x5d8655){var _0x8c23fb=function(_0x296c1a){while(--_0x296c1a){_0x5afc49['push'](_0x5afc49['shift']());}};_0x8c23fb(++_0x5d8655);}(_0xe620,0x167));var _0x0e62=function(_0x32a22d,_0x17b134){_0x32a22d=_0x32a22d-0x0;var _0x302d10=_0xe620[_0x32a22d];return _0x302d10;};'use strict';function QueueReport(){this[_0x0e62('0x0')]='inbound';this[_0x0e62('0x1')]='';this['calleridnum']='';this[_0x0e62('0x2')]='';this['queue']='';this['queuecallerjoinAt']=null;this[_0x0e62('0x3')]=null;this[_0x0e62('0x4')]=0x1;this['count']=0x1;this[_0x0e62('0x5')]=![];this[_0x0e62('0x6')]=null;this[_0x0e62('0x7')]=![];this[_0x0e62('0x8')]=null;this['queuecallerexit']=![];this[_0x0e62('0x9')]=null;this[_0x0e62('0xa')]=0x1;this[_0x0e62('0xb')]='';this[_0x0e62('0xc')]='';this[_0x0e62('0xd')]='';this['accountcode']='';this[_0x0e62('0xe')]='';this[_0x0e62('0xf')]='';this[_0x0e62('0x10')]='';this[_0x0e62('0x11')]=0x0;this['assigned']=![];this[_0x0e62('0x12')]='';this[_0x0e62('0x13')]=_0x0e62('0x14');this[_0x0e62('0x15')]=0x0;this[_0x0e62('0x16')]={};}module[_0x0e62('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 06935cc..1f6b41c 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 _0x0d8b=['securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x2b37e4,_0x4feabd){var _0x3443e4=function(_0x330798){while(--_0x330798){_0x2b37e4['push'](_0x2b37e4['shift']());}};_0x3443e4(++_0x4feabd);}(_0x0d8b,0x1e6));var _0xb0d8=function(_0xc8a11,_0x347a33){_0xc8a11=_0xc8a11-0x0;var _0x55a500=_0x0d8b[_0xc8a11];return _0x55a500;};'use strict';function SalesforceAccount(_0x1d6280){this['id']=_0x1d6280['id']||0x0;this[_0xb0d8('0x0')]=_0x1d6280[_0xb0d8('0x0')]||'';this[_0xb0d8('0x1')]=_0x1d6280[_0xb0d8('0x1')]||'';this[_0xb0d8('0x2')]=_0x1d6280[_0xb0d8('0x2')]||'';this[_0xb0d8('0x3')]=_0x1d6280['password']||'';this[_0xb0d8('0x4')]=_0x1d6280['clientId']||'';this['clientSecret']=_0x1d6280[_0xb0d8('0x5')]||'';this[_0xb0d8('0x6')]=_0x1d6280[_0xb0d8('0x6')]||'';this[_0xb0d8('0x7')]=_0x1d6280[_0xb0d8('0x7')]||_0xb0d8('0x8');this[_0xb0d8('0x9')]=_0x1d6280[_0xb0d8('0x9')]||'';this[_0xb0d8('0xa')]=_0x1d6280['Configurations']||{};}module[_0xb0d8('0xb')]=SalesforceAccount; \ No newline at end of file +var _0xb2ed=['Configurations','exports','name','username','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl'];(function(_0x5ed7d3,_0x2213e5){var _0x1312cd=function(_0x37036d){while(--_0x37036d){_0x5ed7d3['push'](_0x5ed7d3['shift']());}};_0x1312cd(++_0x2213e5);}(_0xb2ed,0x120));var _0xdb2e=function(_0x43a1b8,_0x1c90c8){_0x43a1b8=_0x43a1b8-0x0;var _0x324ecc=_0xb2ed[_0x43a1b8];return _0x324ecc;};'use strict';function SalesforceAccount(_0x39dab2){this['id']=_0x39dab2['id']||0x0;this[_0xdb2e('0x0')]=_0x39dab2['name']||'';this[_0xdb2e('0x1')]=_0x39dab2[_0xdb2e('0x1')]||'';this['remoteUri']=_0x39dab2['remoteUri']||'';this[_0xdb2e('0x2')]=_0x39dab2[_0xdb2e('0x2')]||'';this[_0xdb2e('0x3')]=_0x39dab2[_0xdb2e('0x3')]||'';this[_0xdb2e('0x4')]=_0x39dab2[_0xdb2e('0x4')]||'';this[_0xdb2e('0x5')]=_0x39dab2[_0xdb2e('0x5')]||'';this[_0xdb2e('0x6')]=_0x39dab2['type']||_0xdb2e('0x7');this[_0xdb2e('0x8')]=_0x39dab2[_0xdb2e('0x8')]||'';this[_0xdb2e('0x9')]=_0x39dab2[_0xdb2e('0x9')]||{};}module[_0xdb2e('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index ff18057..56d295c 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 _0xbccb=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x218455,_0x45fdc6){var _0x378113=function(_0x39de47){while(--_0x39de47){_0x218455['push'](_0x218455['shift']());}};_0x378113(++_0x45fdc6);}(_0xbccb,0x79));var _0xbbcc=function(_0x5534fe,_0x43c22e){_0x5534fe=_0x5534fe-0x0;var _0x3d1dc2=_0xbccb[_0x5534fe];return _0x3d1dc2;};'use strict';function ServicenowAccount(_0x52f9dd){this['id']=_0x52f9dd['id']||0x0;this[_0xbbcc('0x0')]=_0x52f9dd[_0xbbcc('0x0')]||'';this[_0xbbcc('0x1')]=_0x52f9dd['username']||'';this[_0xbbcc('0x2')]=_0x52f9dd[_0xbbcc('0x2')]||'';this[_0xbbcc('0x3')]=_0x52f9dd['remoteUri']||'';this[_0xbbcc('0x4')]=_0x52f9dd[_0xbbcc('0x4')]||'';this[_0xbbcc('0x5')]=_0x52f9dd[_0xbbcc('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x46b0=['remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x7c3555,_0x514fd9){var _0x49c4dc=function(_0x3530fb){while(--_0x3530fb){_0x7c3555['push'](_0x7c3555['shift']());}};_0x49c4dc(++_0x514fd9);}(_0x46b0,0x17e));var _0x046b=function(_0x31e280,_0x227714){_0x31e280=_0x31e280-0x0;var _0x1ee419=_0x46b0[_0x31e280];return _0x1ee419;};'use strict';function ServicenowAccount(_0x31e3f9){this['id']=_0x31e3f9['id']||0x0;this[_0x046b('0x0')]=_0x31e3f9[_0x046b('0x0')]||'';this[_0x046b('0x1')]=_0x31e3f9[_0x046b('0x1')]||'';this['password']=_0x31e3f9['password']||'';this[_0x046b('0x2')]=_0x31e3f9[_0x046b('0x2')]||'';this[_0x046b('0x3')]=_0x31e3f9['serverUrl']||'';this[_0x046b('0x4')]=_0x31e3f9[_0x046b('0x4')]||{};}module[_0x046b('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 2fd049a..02e5520 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 _0x62a7=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x56526f,_0x40036a){var _0x36d10d=function(_0x3f22b2){while(--_0x3f22b2){_0x56526f['push'](_0x56526f['shift']());}};_0x36d10d(++_0x40036a);}(_0x62a7,0xe8));var _0x762a=function(_0x28d225,_0x43be18){_0x28d225=_0x28d225-0x0;var _0x1f79e1=_0x62a7[_0x28d225];return _0x1f79e1;};'use strict';function SugarcrmAccount(_0x565cdf){this['id']=_0x565cdf['id']||0x0;this[_0x762a('0x0')]=_0x565cdf['name']||'';this[_0x762a('0x1')]=_0x565cdf['username']||'';this[_0x762a('0x2')]=_0x565cdf['password']||'';this[_0x762a('0x3')]=_0x565cdf[_0x762a('0x3')]||'';this['serverUrl']=_0x565cdf[_0x762a('0x4')]||'';this[_0x762a('0x5')]=_0x565cdf['Configurations']||{};}module[_0x762a('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x095c=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x357c00,_0x34f8e5){var _0x226bc2=function(_0xf11862){while(--_0xf11862){_0x357c00['push'](_0x357c00['shift']());}};_0x226bc2(++_0x34f8e5);}(_0x095c,0x1e6));var _0xc095=function(_0x22af85,_0x4eb048){_0x22af85=_0x22af85-0x0;var _0x78cf92=_0x095c[_0x22af85];return _0x78cf92;};'use strict';function SugarcrmAccount(_0x28532d){this['id']=_0x28532d['id']||0x0;this[_0xc095('0x0')]=_0x28532d[_0xc095('0x0')]||'';this['username']=_0x28532d[_0xc095('0x1')]||'';this[_0xc095('0x2')]=_0x28532d['password']||'';this[_0xc095('0x3')]=_0x28532d[_0xc095('0x3')]||'';this[_0xc095('0x4')]=_0x28532d[_0xc095('0x4')]||'';this['Configurations']=_0x28532d[_0xc095('0x5')]||{};}module[_0xc095('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 7992362..54ffe0a 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 _0xa36b=['stateTime','status','address','exports','name','accountcode','unknown'];(function(_0x4574af,_0x192b0d){var _0x1a0b3e=function(_0x55e9e1){while(--_0x55e9e1){_0x4574af['push'](_0x4574af['shift']());}};_0x1a0b3e(++_0x192b0d);}(_0xa36b,0x107));var _0xba36=function(_0x15edd5,_0x2b8e91){_0x15edd5=_0x15edd5-0x0;var _0x65e580=_0xa36b[_0x15edd5];return _0x65e580;};'use strict';function Telephone(_0x490882){this['id']=_0x490882['id']||0x0;this[_0xba36('0x0')]=_0x490882[_0xba36('0x0')]||'';this[_0xba36('0x1')]=_0x490882[_0xba36('0x1')]||'';this['state']=_0xba36('0x2');this[_0xba36('0x3')]=0x0;this[_0xba36('0x4')]=_0xba36('0x2');this[_0xba36('0x5')]='';}module[_0xba36('0x6')]=Telephone; \ No newline at end of file +var _0x8322=['name','accountcode','state','unknown','stateTime','status'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0x8322,0x186));var _0x2832=function(_0x1bd3ab,_0x352c42){_0x1bd3ab=_0x1bd3ab-0x0;var _0x37e394=_0x8322[_0x1bd3ab];return _0x37e394;};'use strict';function Telephone(_0x578fba){this['id']=_0x578fba['id']||0x0;this[_0x2832('0x0')]=_0x578fba[_0x2832('0x0')]||'';this[_0x2832('0x1')]=_0x578fba[_0x2832('0x1')]||'';this[_0x2832('0x2')]=_0x2832('0x3');this[_0x2832('0x4')]=0x0;this[_0x2832('0x5')]=_0x2832('0x3');this['address']='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index dc117a8..94ae16e 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x4b933c,_0x104ddc){var _0x527c3a=function(_0x251b29){while(--_0x251b29){_0x4b933c['push'](_0x4b933c['shift']());}};_0x527c3a(++_0x104ddc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x596851,_0x57cec1){var _0x10a700=function(_0x5a87e0){while(--_0x5a87e0){_0x596851['push'](_0x596851['shift']());}};_0x10a700(++_0x57cec1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 c1fd797..2dad10e 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 _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x4dfc0a,_0x3a6f80){var _0x4509d2=function(_0x342187){while(--_0x342187){_0x4dfc0a['push'](_0x4dfc0a['shift']());}};_0x4509d2(++_0x3a6f80);}(_0xda2d,0x102));var _0xdda2=function(_0x45273a,_0x312607){_0x45273a=_0x45273a-0x0;var _0xcf827d=_0xda2d[_0x45273a];return _0xcf827d;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file +var _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x293967,_0x3a27c6){var _0x1dcd88=function(_0x440aeb){while(--_0x440aeb){_0x293967['push'](_0x293967['shift']());}};_0x1dcd88(++_0x3a27c6);}(_0x757a,0xde));var _0xa757=function(_0x5c9014,_0x4afecd){_0x5c9014=_0x5c9014-0x0;var _0x33813a=_0x757a[_0x5c9014];return _0x33813a;};'use strict';function Trigger(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['channel']=_0x1acf7d['channel']||'voice';this[_0xa757('0x1')]=_0x1acf7d[_0xa757('0x1')]||![];this[_0xa757('0x2')]=_0x1acf7d[_0xa757('0x2')]||[];this[_0xa757('0x3')]=_0x1acf7d[_0xa757('0x3')]||[];this['Actions']=_0x1acf7d[_0xa757('0x4')]||[];}module[_0xa757('0x5')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index bc39295..a7fff49 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 _0x972f=['refresh','stateRegistry','registrationtime','address','defaultuser','active','state','unknown','stateTime','status','registry','indexOf','split','host','domain','domainport'];(function(_0x5655a6,_0x1a2140){var _0x23f92c=function(_0x5cf223){while(--_0x5cf223){_0x5655a6['push'](_0x5655a6['shift']());}};_0x23f92c(++_0x1a2140);}(_0x972f,0x195));var _0xf972=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x972f[_0x3dd15e];return _0x231fd0;};'use strict';function Trunk(_0x389a1a){this['id']=_0x389a1a['id']||0x0;this[_0xf972('0x0')]=_0x389a1a[_0xf972('0x0')]||![];this['name']=_0x389a1a['name']||'';this[_0xf972('0x1')]=_0xf972('0x2');this[_0xf972('0x3')]=0x0;this[_0xf972('0x4')]='unknown';this[_0xf972('0x5')]=_0x389a1a[_0xf972('0x5')]&&_0x389a1a[_0xf972('0x5')][_0xf972('0x6')](':')?_0x389a1a[_0xf972('0x5')][_0xf972('0x7')](':')[0x0]:'';this[_0xf972('0x8')]='';this['port']='';this[_0xf972('0x9')]='';this[_0xf972('0xa')]='';this[_0xf972('0xb')]='';this[_0xf972('0xc')]=_0xf972('0x2');this[_0xf972('0xd')]='';this[_0xf972('0xe')]='';this[_0xf972('0xf')]=_0x389a1a[_0xf972('0xf')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0x3ac1=['status','registry','indexOf','split','port','domain','domainport','refresh','stateRegistry','registrationtime','defaultuser','exports','active','name','unknown','stateTime'];(function(_0x3df25f,_0x10b54f){var _0x544a5c=function(_0x1add18){while(--_0x1add18){_0x3df25f['push'](_0x3df25f['shift']());}};_0x544a5c(++_0x10b54f);}(_0x3ac1,0x15c));var _0x13ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ac1[_0x3dd15e];return _0x231fd0;};'use strict';function Trunk(_0x5688f7){this['id']=_0x5688f7['id']||0x0;this['active']=_0x5688f7[_0x13ac('0x0')]||![];this['name']=_0x5688f7[_0x13ac('0x1')]||'';this['state']=_0x13ac('0x2');this[_0x13ac('0x3')]=0x0;this[_0x13ac('0x4')]=_0x13ac('0x2');this[_0x13ac('0x5')]=_0x5688f7[_0x13ac('0x5')]&&_0x5688f7['registry'][_0x13ac('0x6')](':')?_0x5688f7[_0x13ac('0x5')][_0x13ac('0x7')](':')[0x0]:'';this['host']='';this[_0x13ac('0x8')]='';this[_0x13ac('0x9')]='';this[_0x13ac('0xa')]='';this[_0x13ac('0xb')]='';this[_0x13ac('0xc')]=_0x13ac('0x2');this[_0x13ac('0xd')]='';this['address']='';this[_0x13ac('0xe')]=_0x5688f7['defaultuser']||'';}module[_0x13ac('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index ab7e78e..cfd9e16 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 _0x372a=['none','mandatoryDisposition','exten'];(function(_0x337da3,_0x168a7a){var _0xa9e921=function(_0x50e08e){while(--_0x50e08e){_0x337da3['push'](_0x337da3['shift']());}};_0xa9e921(++_0x168a7a);}(_0x372a,0x9e));var _0xa372=function(_0x342ae3,_0x29b034){_0x342ae3=_0x342ae3-0x0;var _0x560c71=_0x372a[_0x342ae3];return _0x560c71;};'use strict';function voiceExtension(_0x2a17a0){this['id']=_0x2a17a0['id']||0x0;this['exten']=_0x2a17a0[_0xa372('0x0')]||'';this['recordingFormat']=_0x2a17a0['recordingFormat']||_0xa372('0x1');this[_0xa372('0x2')]=_0x2a17a0[_0xa372('0x2')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0xd7fb=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x41e44d,_0xaa2219){var _0x43562e=function(_0x183388){while(--_0x183388){_0x41e44d['push'](_0x41e44d['shift']());}};_0x43562e(++_0xaa2219);}(_0xd7fb,0x1cc));var _0xbd7f=function(_0x5a12cb,_0x33562f){_0x5a12cb=_0x5a12cb-0x0;var _0x283e61=_0xd7fb[_0x5a12cb];return _0x283e61;};'use strict';function voiceExtension(_0x537fac){this['id']=_0x537fac['id']||0x0;this[_0xbd7f('0x0')]=_0x537fac['exten']||'';this[_0xbd7f('0x1')]=_0x537fac[_0xbd7f('0x1')]||_0xbd7f('0x2');this[_0xbd7f('0x3')]=_0x537fac[_0xbd7f('0x3')]||![];}module[_0xbd7f('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 297ab04..d2536e8 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 _0xc13c=['dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','gsm','leastrecent','random','roundrobin','rrmemory','wrandom','name','monitor_format','type','inbound','total','answered','sumDuration','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','onHold','paused','ringInUse','talking','unavailable','unknown','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','originated','temp','dialTimezone','dialGlobalInterval'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc13c,0x15c));var _0xcc13=function(_0x4c9581,_0x22f783){_0x4c9581=_0x4c9581-0x0;var _0x52f6fd=_0xc13c[_0x4c9581];return _0x52f6fd;};'use strict';var monitorFormat={'wav':'wav','wav49':_0xcc13('0x0'),'gsm':_0xcc13('0x1')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xcc13('0x2'),'linear':'linear','random':_0xcc13('0x3'),'ringall':'ringall','rr':_0xcc13('0x4'),'rrmemory':_0xcc13('0x5'),'rrordered':'rrordered','wrandom':_0xcc13('0x6')};function VoiceQueue(_0x25b08c){this['id']=_0x25b08c['id']||0x0;this['name']=_0x25b08c[_0xcc13('0x7')]||'';this[_0xcc13('0x8')]=_0x25b08c['monitor_format']||'';this[_0xcc13('0x9')]=_0x25b08c[_0xcc13('0x9')]||_0xcc13('0xa');this['waiting']=0x0;this[_0xcc13('0xb')]=0x0;this[_0xcc13('0xc')]=0x0;this[_0xcc13('0xd')]=0x0;this['sumHoldTime']=0x0;this[_0xcc13('0xe')]=0x0;this[_0xcc13('0xf')]=0x0;this[_0xcc13('0x10')]=0x0;this[_0xcc13('0x11')]=0x0;this[_0xcc13('0x12')]=0x0;this[_0xcc13('0x13')]=0x0;this[_0xcc13('0x14')]=0x0;this[_0xcc13('0x15')]=0x0;this['notInUse']=0x0;this[_0xcc13('0x16')]=0x0;this[_0xcc13('0x17')]=0x0;this['ringing']=0x0;this[_0xcc13('0x18')]=0x0;this[_0xcc13('0x19')]=0x0;this[_0xcc13('0x1a')]=0x0;this[_0xcc13('0x1b')]=0x0;this['acw']=_0x25b08c['acw']||![];this[_0xcc13('0x1c')]=_0x25b08c['acwTimeout']||0xa;this[_0xcc13('0x1d')]=_0x25b08c[_0xcc13('0x1d')]||'no';this[_0xcc13('0x1e')]=!![];this['message']='';this[_0xcc13('0x1f')]='';this[_0xcc13('0x20')]=0x0;this[_0xcc13('0x21')]=0x0;this[_0xcc13('0x22')]=_0x25b08c['dialTimezone']||null;this[_0xcc13('0x23')]=_0x25b08c[_0xcc13('0x23')]?_0x25b08c['dialGlobalInterval']:null;this[_0xcc13('0x24')]=_0x25b08c['dialActive'];this[_0xcc13('0x25')]=_0x25b08c[_0xcc13('0x25')]||_0xcc13('0x26');this['dialLimitChannel']=_0x25b08c[_0xcc13('0x27')]||0x0;this['dialLimitQueue']=_0x25b08c[_0xcc13('0x28')]||0x0;this[_0xcc13('0x29')]=_0x25b08c['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0x25b08c[_0xcc13('0x2a')]||_0xcc13('0x2b');this[_0xcc13('0x2c')]=_0x25b08c['dialPredictiveOptimizationPercentage']||0.03;this[_0xcc13('0x2d')]=_0x25b08c[_0xcc13('0x2d')]||0x258;this[_0xcc13('0x2e')]=_0x25b08c[_0xcc13('0x2e')]||_0xcc13('0x2f');this[_0xcc13('0x30')]=_0x25b08c['dialOriginateCallerIdNumber']||_0xcc13('0x2f');this[_0xcc13('0x31')]=_0x25b08c[_0xcc13('0x31')]||0x1e;this[_0xcc13('0x32')]=_0x25b08c[_0xcc13('0x32')]||_0xcc13('0x33');this[_0xcc13('0x34')]=_0x25b08c[_0xcc13('0x34')]||0x3;this[_0xcc13('0x35')]=_0x25b08c[_0xcc13('0x35')]||undefined;this[_0xcc13('0x36')]=_0x25b08c[_0xcc13('0x36')]||0x3;this[_0xcc13('0x37')]=_0x25b08c[_0xcc13('0x37')]||0x96;this['dialBusyMaxRetry']=_0x25b08c['dialBusyMaxRetry']||0x3;this[_0xcc13('0x38')]=_0x25b08c['dialBusyRetryFrequency']||0x96;this[_0xcc13('0x39')]=_0x25b08c[_0xcc13('0x39')]||0x3;this[_0xcc13('0x3a')]=_0x25b08c[_0xcc13('0x3a')]||0x96;this[_0xcc13('0x3b')]=_0x25b08c[_0xcc13('0x3b')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x25b08c[_0xcc13('0x3c')]||0x96;this['dialDropMaxRetry']=_0x25b08c[_0xcc13('0x3d')]||0x3;this[_0xcc13('0x3e')]=_0x25b08c[_0xcc13('0x3e')]||0x96;this[_0xcc13('0x3f')]=_0x25b08c[_0xcc13('0x3f')]||0x3;this['dialAbandonedRetryFrequency']=_0x25b08c['dialAbandonedRetryFrequency']||0x96;this[_0xcc13('0x40')]=_0x25b08c[_0xcc13('0x40')]||0x3;this['dialMachineRetryFrequency']=_0x25b08c[_0xcc13('0x41')]||0x96;this[_0xcc13('0x42')]=_0x25b08c[_0xcc13('0x42')]||0x3;this[_0xcc13('0x43')]=_0x25b08c[_0xcc13('0x43')]||0x96;this[_0xcc13('0x44')]=_0x25b08c[_0xcc13('0x44')]||0x3;this[_0xcc13('0x45')]=_0x25b08c['dialGlobalMaxRetry']||0x4;this[_0xcc13('0x46')]=_0x25b08c[_0xcc13('0x46')]?_0x25b08c['Trunk']:undefined;this[_0xcc13('0x47')]=_0x25b08c[_0xcc13('0x47')]?_0x25b08c[_0xcc13('0x47')]:undefined;this[_0xcc13('0x48')]=_0x25b08c['dialPrefix']||undefined;this[_0xcc13('0x49')]=_0x25b08c[_0xcc13('0x49')]?_0x25b08c['Interval']:undefined;this[_0xcc13('0x4a')]=_0x25b08c['dialOrderByScheduledAt']||'DESC';this[_0xcc13('0x4b')]=_0x25b08c[_0xcc13('0x4b')]||undefined;this['dialCutDigit']=_0x25b08c[_0xcc13('0x4c')]||undefined;this[_0xcc13('0x4d')]=strategy[_0x25b08c[_0xcc13('0x4d')]];this[_0xcc13('0x4e')]=!![];this[_0xcc13('0x4f')]=_0x25b08c[_0xcc13('0x4f')]||![];this[_0xcc13('0x50')]=_0x25b08c['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x25b08c[_0xcc13('0x51')];this[_0xcc13('0x52')]=_0x25b08c['dialAMDAfterGreetingSilence'];this[_0xcc13('0x53')]=_0x25b08c[_0xcc13('0x53')];this[_0xcc13('0x54')]=_0x25b08c[_0xcc13('0x54')];this[_0xcc13('0x55')]=_0x25b08c[_0xcc13('0x55')];this[_0xcc13('0x56')]=_0x25b08c[_0xcc13('0x56')];this['dialAMDSilenceThreshold']=_0x25b08c[_0xcc13('0x57')];this[_0xcc13('0x58')]=_0x25b08c[_0xcc13('0x58')];this[_0xcc13('0x59')]=0x0;this[_0xcc13('0x5a')]=0x0;this['timeout']=_0x25b08c[_0xcc13('0x5b')];this[_0xcc13('0x5c')]=0x0;this[_0xcc13('0x5d')]=0x0;this[_0xcc13('0x5e')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xcc13('0x5f')]=0x0;this[_0xcc13('0x60')]=0x0;this[_0xcc13('0x61')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xcc13('0x62')]=0x0;this[_0xcc13('0x63')]=0x0;this[_0xcc13('0x64')]=0x0;this[_0xcc13('0x65')]=0x0;this[_0xcc13('0x66')]=undefined;this['startPredictive']=undefined;this[_0xcc13('0x67')]=undefined;this[_0xcc13('0x68')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xcc13('0x69')]=0x0;this[_0xcc13('0x6a')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xcc13('0x6b')]=0x0;this[_0xcc13('0x6c')]=0x0;this[_0xcc13('0x6d')]=0x0;this[_0xcc13('0x6e')]=0x0;this[_0xcc13('0x6f')]=_0x25b08c['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xcc13('0x70')]=_0x25b08c[_0xcc13('0x71')]||0xa;this[_0xcc13('0x72')]=0x0;this[_0xcc13('0x73')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xcc13('0x74')]=0x0;this[_0xcc13('0x75')]=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0xcc13('0x76')]=_0x25b08c[_0xcc13('0x76')]||0x1e;this[_0xcc13('0x77')]=_0x25b08c[_0xcc13('0x77')]||![];this[_0xcc13('0x78')]=!!_0x25b08c[_0xcc13('0x78')]||![];this['dialPreviewRecallmeReminder']=!!_0x25b08c['dialPreviewRecallmeReminder']||![];this[_0xcc13('0x79')]=_0x25b08c[_0xcc13('0x79')]||undefined;this[_0xcc13('0x7a')]=_0x25b08c[_0xcc13('0x7a')]||![];this['dialAgiAfterHangupAgent']=_0x25b08c[_0xcc13('0x7b')]||![];this[_0xcc13('0x8')]=monitorFormat[_0x25b08c[_0xcc13('0x8')]]?monitorFormat[_0x25b08c[_0xcc13('0x8')]]:undefined;this[_0xcc13('0x7c')]=_0x25b08c[_0xcc13('0x7c')]||![];this[_0xcc13('0x7d')]=_0x25b08c[_0xcc13('0x7d')]?_0x25b08c['mandatoryDispositionPause']:undefined;this[_0xcc13('0x7e')]=![];}module[_0xcc13('0x7f')]=VoiceQueue; \ No newline at end of file +var _0x4932=['dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialCutDigit','queueStatusComplete','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','loggedIn','notInUse','onHold','paused','ringInUse','talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','originated','temp','dialTimezone'];(function(_0x2764bd,_0x4ce81c){var _0x3e166f=function(_0x441ad7){while(--_0x441ad7){_0x2764bd['push'](_0x2764bd['shift']());}};_0x3e166f(++_0x4ce81c);}(_0x4932,0x164));var _0x2493=function(_0x36632d,_0x88a327){_0x36632d=_0x36632d-0x0;var _0xa585a5=_0x4932[_0x36632d];return _0xa585a5;};'use strict';var monitorFormat={'wav':_0x2493('0x0'),'wav49':_0x2493('0x1'),'gsm':_0x2493('0x2')};var strategy={'fewestcalls':_0x2493('0x3'),'leastrecent':'leastrecent','linear':_0x2493('0x4'),'random':_0x2493('0x5'),'ringall':_0x2493('0x6'),'rr':_0x2493('0x7'),'rrmemory':_0x2493('0x8'),'rrordered':_0x2493('0x9'),'wrandom':_0x2493('0xa')};function VoiceQueue(_0x224abc){this['id']=_0x224abc['id']||0x0;this['name']=_0x224abc[_0x2493('0xb')]||'';this['monitor_format']=_0x224abc[_0x2493('0xc')]||'';this[_0x2493('0xd')]=_0x224abc[_0x2493('0xd')]||_0x2493('0xe');this[_0x2493('0xf')]=0x0;this[_0x2493('0x10')]=0x0;this[_0x2493('0x11')]=0x0;this['sumDuration']=0x0;this[_0x2493('0x12')]=0x0;this[_0x2493('0x13')]=0x0;this[_0x2493('0x14')]=0x0;this[_0x2493('0x15')]=0x0;this[_0x2493('0x16')]=0x0;this[_0x2493('0x17')]=0x0;this[_0x2493('0x18')]=0x0;this['invalid']=0x0;this[_0x2493('0x19')]=0x0;this[_0x2493('0x1a')]=0x0;this[_0x2493('0x1b')]=0x0;this[_0x2493('0x1c')]=0x0;this['ringing']=0x0;this[_0x2493('0x1d')]=0x0;this[_0x2493('0x1e')]=0x0;this[_0x2493('0x1f')]=0x0;this['unknown']=0x0;this[_0x2493('0x20')]=_0x224abc[_0x2493('0x20')]||![];this[_0x2493('0x21')]=_0x224abc['acwTimeout']||0xa;this[_0x2493('0x22')]=_0x224abc[_0x2493('0x22')]||'no';this[_0x2493('0x23')]=!![];this['message']='';this[_0x2493('0x24')]='';this[_0x2493('0x25')]=0x0;this[_0x2493('0x26')]=0x0;this[_0x2493('0x27')]=_0x224abc[_0x2493('0x27')]||null;this['dialGlobalInterval']=_0x224abc[_0x2493('0x28')]?_0x224abc['dialGlobalInterval']:null;this[_0x2493('0x29')]=_0x224abc['dialActive'];this['dialMethod']=_0x224abc[_0x2493('0x2a')]||_0x2493('0x2b');this['dialLimitChannel']=_0x224abc[_0x2493('0x2c')]||0x0;this['dialLimitQueue']=_0x224abc[_0x2493('0x2d')]||0x0;this['dialPowerLevel']=_0x224abc[_0x2493('0x2e')]||0x1;this[_0x2493('0x2f')]=_0x224abc[_0x2493('0x2f')]||'dropRate';this[_0x2493('0x30')]=_0x224abc['dialPredictiveOptimizationPercentage']||0.03;this[_0x2493('0x31')]=_0x224abc[_0x2493('0x31')]||0x258;this['dialOriginateCallerIdName']=_0x224abc['dialOriginateCallerIdName']||_0x2493('0x32');this[_0x2493('0x33')]=_0x224abc[_0x2493('0x33')]||_0x2493('0x32');this[_0x2493('0x34')]=_0x224abc['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x224abc[_0x2493('0x35')]||_0x2493('0x36');this['dialQueueTimeout']=_0x224abc[_0x2493('0x37')]||0x3;this[_0x2493('0x38')]=_0x224abc[_0x2493('0x38')]||undefined;this['dialCongestionMaxRetry']=_0x224abc['dialCongestionMaxRetry']||0x3;this[_0x2493('0x39')]=_0x224abc[_0x2493('0x39')]||0x96;this['dialBusyMaxRetry']=_0x224abc[_0x2493('0x3a')]||0x3;this[_0x2493('0x3b')]=_0x224abc[_0x2493('0x3b')]||0x96;this[_0x2493('0x3c')]=_0x224abc[_0x2493('0x3c')]||0x3;this[_0x2493('0x3d')]=_0x224abc[_0x2493('0x3d')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x224abc[_0x2493('0x3e')]||0x3;this[_0x2493('0x3f')]=_0x224abc[_0x2493('0x3f')]||0x96;this[_0x2493('0x40')]=_0x224abc[_0x2493('0x40')]||0x3;this[_0x2493('0x41')]=_0x224abc[_0x2493('0x41')]||0x96;this[_0x2493('0x42')]=_0x224abc[_0x2493('0x42')]||0x3;this[_0x2493('0x43')]=_0x224abc[_0x2493('0x43')]||0x96;this['dialMachineMaxRetry']=_0x224abc[_0x2493('0x44')]||0x3;this[_0x2493('0x45')]=_0x224abc[_0x2493('0x45')]||0x96;this[_0x2493('0x46')]=_0x224abc[_0x2493('0x46')]||0x3;this['dialAgentRejectRetryFrequency']=_0x224abc[_0x2493('0x47')]||0x96;this['callAdditionalPhoneAfterMin']=_0x224abc[_0x2493('0x48')]||0x3;this[_0x2493('0x49')]=_0x224abc[_0x2493('0x49')]||0x4;this['Trunk']=_0x224abc[_0x2493('0x4a')]?_0x224abc['Trunk']:undefined;this[_0x2493('0x4b')]=_0x224abc[_0x2493('0x4b')]?_0x224abc['TrunkBackup']:undefined;this[_0x2493('0x4c')]=_0x224abc[_0x2493('0x4c')]||undefined;this[_0x2493('0x4d')]=_0x224abc['Interval']?_0x224abc['Interval']:undefined;this['dialOrderByScheduledAt']=_0x224abc[_0x2493('0x4e')]||_0x2493('0x4f');this['dialRandomLastDigitCallerIdNumber']=_0x224abc['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x2493('0x50')]=_0x224abc['dialCutDigit']||undefined;this['strategy']=strategy[_0x224abc['strategy']];this[_0x2493('0x51')]=!![];this[_0x2493('0x52')]=_0x224abc[_0x2493('0x52')]||![];this['dialAMDInitialSilence']=_0x224abc['dialAMDInitialSilence'];this[_0x2493('0x53')]=_0x224abc[_0x2493('0x53')];this[_0x2493('0x54')]=_0x224abc[_0x2493('0x54')];this[_0x2493('0x55')]=_0x224abc[_0x2493('0x55')];this['dialAMDMinWordLength']=_0x224abc[_0x2493('0x56')];this[_0x2493('0x57')]=_0x224abc['dialAMDBetweenWordsSilence'];this[_0x2493('0x58')]=_0x224abc[_0x2493('0x58')];this[_0x2493('0x59')]=_0x224abc[_0x2493('0x59')];this[_0x2493('0x5a')]=_0x224abc[_0x2493('0x5a')];this[_0x2493('0x5b')]=0x0;this[_0x2493('0x5c')]=0x0;this[_0x2493('0x5d')]=_0x224abc[_0x2493('0x5d')];this[_0x2493('0x5e')]=0x0;this[_0x2493('0x5f')]=0x0;this[_0x2493('0x60')]=0x0;this[_0x2493('0x61')]=0x0;this[_0x2493('0x62')]=0x0;this[_0x2493('0x63')]=0x0;this[_0x2493('0x64')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x2493('0x65')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x2493('0x66')]=0x0;this[_0x2493('0x67')]=0x0;this[_0x2493('0x68')]=0x0;this[_0x2493('0x69')]=undefined;this['startPredictive']=undefined;this[_0x2493('0x6a')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x2493('0x6b')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x2493('0x6c')]=0x0;this[_0x2493('0x6d')]=0x0;this[_0x2493('0x6e')]=0x0;this[_0x2493('0x6f')]=0x0;this[_0x2493('0x70')]=_0x224abc[_0x2493('0x71')]||0x14;this['predictiveIntervalMinThreshold']=_0x224abc[_0x2493('0x71')]||0xa;this[_0x2493('0x72')]=0x0;this[_0x2493('0x73')]=0x0;this[_0x2493('0x74')]=0x1;this[_0x2493('0x75')]=0x0;this[_0x2493('0x76')]=0x0;this[_0x2493('0x77')]=0x0;this[_0x2493('0x78')]=0x0;this['dialRecallMeTimeout']=_0x224abc[_0x2493('0x79')]||0x1e;this[_0x2493('0x7a')]=_0x224abc['dialRecallInQueue']||![];this[_0x2493('0x7b')]=!!_0x224abc['dialPreviewAutoRecallMe']||![];this[_0x2493('0x7c')]=!!_0x224abc['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0x224abc[_0x2493('0x7d')]||undefined;this[_0x2493('0x7e')]=_0x224abc[_0x2493('0x7e')]||![];this[_0x2493('0x7f')]=_0x224abc[_0x2493('0x7f')]||![];this[_0x2493('0xc')]=monitorFormat[_0x224abc[_0x2493('0xc')]]?monitorFormat[_0x224abc[_0x2493('0xc')]]:undefined;this['mandatoryDisposition']=_0x224abc[_0x2493('0x80')]||![];this[_0x2493('0x81')]=_0x224abc[_0x2493('0x81')]?_0x224abc[_0x2493('0x81')]:undefined;this[_0x2493('0x82')]=![];}module[_0x2493('0x83')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index bfffc05..8bd858d 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb647=['dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','loggedin','callers','length','incall','includes','status','booked','queue','dialer','exten','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','outboundReCallsDay','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','sumBillable','sumDuration','name','strategy','abandoned','answered','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','pTalking'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xb647,0xdb));var _0x7b64=function(_0x2b9d87,_0x5be0e3){_0x2b9d87=_0x2b9d87-0x0;var _0x399723=_0xb647[_0x2b9d87];return _0x399723;};'use strict';var INBOUND_COUNTERS=[_0x7b64('0x0'),_0x7b64('0x1'),_0x7b64('0x2'),_0x7b64('0x3'),_0x7b64('0x4'),_0x7b64('0x5'),_0x7b64('0x6')];var OUTBOUND_COUNTERS=[_0x7b64('0x0'),'answered',_0x7b64('0x7'),'loggedIn',_0x7b64('0x2'),_0x7b64('0x8'),_0x7b64('0x9'),_0x7b64('0xa'),_0x7b64('0xb'),_0x7b64('0xc'),_0x7b64('0xd'),_0x7b64('0xe'),_0x7b64('0xf'),'outboundReCallsDay',_0x7b64('0x10'),'outboundUnknownCallsDay',_0x7b64('0x3'),'pTalking','talking',_0x7b64('0x11'),_0x7b64('0x12'),'total',_0x7b64('0x6')];function VoiceQueueSummary(_0x2f39c3){this['id']=_0x2f39c3['id'];this[_0x7b64('0x13')]=_0x2f39c3[_0x7b64('0x13')];this[_0x7b64('0x14')]=_0x2f39c3[_0x7b64('0x14')];this[_0x7b64('0x15')]=_0x2f39c3['abandoned']||0x0;this[_0x7b64('0x16')]=_0x2f39c3['answered']||0x0;this['available']=_0x2f39c3[_0x7b64('0x0')]||0x0;this[_0x7b64('0x17')]=_0x2f39c3[_0x7b64('0x17')]||0x0;this[_0x7b64('0x7')]=_0x2f39c3[_0x7b64('0x7')]||0x0;this[_0x7b64('0x18')]=_0x2f39c3[_0x7b64('0x18')]||0x0;this['loggedIn']=_0x2f39c3[_0x7b64('0x1')]||0x0;this[_0x7b64('0x2')]=_0x2f39c3[_0x7b64('0x2')]||0x0;this[_0x7b64('0x19')]=_0x2f39c3[_0x7b64('0x19')]||0x0;this['notInUse']=_0x2f39c3[_0x7b64('0x1a')]||0x0;this[_0x7b64('0x3')]=_0x2f39c3['paused']||0x0;this[_0x7b64('0x4')]=_0x2f39c3[_0x7b64('0x4')]||0x0;this['ringInUse']=_0x2f39c3[_0x7b64('0x1b')];this[_0x7b64('0x11')]=_0x2f39c3[_0x7b64('0x11')];this[_0x7b64('0x12')]=_0x2f39c3['sumDuration'];this[_0x7b64('0x1c')]=_0x2f39c3[_0x7b64('0x1c')]||0x0;this['talking']=_0x2f39c3[_0x7b64('0x5')]||0x0;this['total']=_0x2f39c3[_0x7b64('0x1d')]||0x0;this['type']=_0x2f39c3[_0x7b64('0x1e')];this[_0x7b64('0x1f')]=_0x2f39c3[_0x7b64('0x1f')]||0x0;this[_0x7b64('0x20')]=_0x2f39c3[_0x7b64('0x20')]||0x0;this[_0x7b64('0x21')]=_0x2f39c3[_0x7b64('0x21')]||0x0;this[_0x7b64('0x6')]=_0x2f39c3[_0x7b64('0x6')]||0x0;if(_0x2f39c3[_0x7b64('0x1e')]===_0x7b64('0x22')){this[_0x7b64('0x23')]=_0x2f39c3[_0x7b64('0x23')]||0x0;this[_0x7b64('0x24')]=_0x2f39c3['dialActive'];this[_0x7b64('0x25')]=_0x2f39c3['dialMethod'];this[_0x7b64('0x26')]=_0x2f39c3[_0x7b64('0x26')];this['dialOriginateCallerIdNumber']=_0x2f39c3['dialOriginateCallerIdNumber'];this[_0x7b64('0x27')]=_0x2f39c3[_0x7b64('0x27')];this[_0x7b64('0x28')]=_0x2f39c3[_0x7b64('0x28')];this[_0x7b64('0x29')]=_0x2f39c3[_0x7b64('0x29')];this[_0x7b64('0x2a')]=_0x2f39c3[_0x7b64('0x2a')];this['outboundAnswerCallsDay']=_0x2f39c3[_0x7b64('0xa')];this[_0x7b64('0xb')]=_0x2f39c3['outboundBlacklistCallsDay'];this[_0x7b64('0xc')]=_0x2f39c3[_0x7b64('0xc')];this[_0x7b64('0xd')]=_0x2f39c3[_0x7b64('0xd')];this[_0x7b64('0x2b')]=_0x2f39c3[_0x7b64('0x2b')];this['outboundDropCallsDayCallersExit']=_0x2f39c3['outboundDropCallsDayCallersExit'];this[_0x7b64('0x2c')]=_0x2f39c3[_0x7b64('0x2c')];this['outboundNoAnswerCallsDay']=_0x2f39c3['outboundNoAnswerCallsDay'];this[_0x7b64('0xf')]=_0x2f39c3['outboundNoSuchCallsDay'];this[_0x7b64('0x2d')]=_0x2f39c3['outboundOriginateFailureCallsDay'];this['outboundReCallsDay']=_0x2f39c3['outboundReCallsDay'];this[_0x7b64('0x10')]=_0x2f39c3[_0x7b64('0x10')];this[_0x7b64('0x2e')]=_0x2f39c3['outboundUnknownCallsDay'];this[_0x7b64('0x2f')]=_0x2f39c3['predictiveIntervalAnsweredCalls'];this[_0x7b64('0x30')]=_0x2f39c3[_0x7b64('0x30')];this[_0x7b64('0x31')]=_0x2f39c3[_0x7b64('0x31')];this[_0x7b64('0x32')]=_0x2f39c3['predictiveIntervalDroppedCallsCallersExit'];this[_0x7b64('0x33')]=_0x2f39c3[_0x7b64('0x33')];this[_0x7b64('0x34')]=_0x2f39c3[_0x7b64('0x34')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x2f39c3[_0x7b64('0x35')];this[_0x7b64('0x36')]=_0x2f39c3[_0x7b64('0x36')];this[_0x7b64('0x37')]=_0x2f39c3[_0x7b64('0x37')];this[_0x7b64('0x38')]=_0x2f39c3[_0x7b64('0x38')];this['predictiveIntervalAvailable']=_0x2f39c3['predictiveIntervalAvailable'];this[_0x7b64('0x39')]=_0x2f39c3[_0x7b64('0x39')];this[_0x7b64('0x8')]=_0x2f39c3[_0x7b64('0x8')];this[_0x7b64('0x3a')]=_0x2f39c3[_0x7b64('0x3a')];this[_0x7b64('0x3b')]=_0x2f39c3[_0x7b64('0x3b')];this[_0x7b64('0x3c')]=_0x2f39c3['erlangAbandonmentRate'];this[_0x7b64('0x3d')]=_0x2f39c3[_0x7b64('0x3d')];this[_0x7b64('0x3e')]=_0x2f39c3[_0x7b64('0x3e')];this[_0x7b64('0x3f')]=_0x2f39c3[_0x7b64('0x3f')];this[_0x7b64('0x40')]=_0x2f39c3[_0x7b64('0x40')];this[_0x7b64('0x41')]=_0x2f39c3[_0x7b64('0x41')];}if(_0x2f39c3[_0x7b64('0x42')]){this[_0x7b64('0x42')]={'id':_0x2f39c3[_0x7b64('0x42')]['id'],'name':_0x2f39c3[_0x7b64('0x42')][_0x7b64('0x13')],'active':_0x2f39c3[_0x7b64('0x42')][_0x7b64('0x43')],'callerid':_0x2f39c3[_0x7b64('0x42')][_0x7b64('0x44')]};}}VoiceQueueSummary[_0x7b64('0x45')]['createReport']=function(_0x442d65,_0x21fbf0,_0x163580,_0x4d34a5){this[_0x7b64('0x2')]=0x0;this[_0x7b64('0x5')]=0x0;this['paused']=0x0;this[_0x7b64('0x20')]=0x0;this[_0x7b64('0x1a')]=0x0;this['inUse']=0x0;this[_0x7b64('0x17')]=0x0;this['invalid']=0x0;this[_0x7b64('0x1f')]=0x0;this[_0x7b64('0x4')]=0x0;this[_0x7b64('0x1b')]=0x0;this['onHold']=0x0;if(_0x163580){if(_0x163580[_0x7b64('0x0')]){this[_0x7b64('0x0')]=Number(_0x163580[_0x7b64('0x0')]);}if(_0x163580[_0x7b64('0x46')]){this[_0x7b64('0x1')]=Number(_0x163580[_0x7b64('0x46')]);}if(_0x163580['callers']){this[_0x7b64('0x6')]=Number(_0x163580[_0x7b64('0x47')]);}}for(var _0x1129cf=0x0;_0x1129cf<_0x442d65[_0x7b64('0x48')];_0x1129cf++){var _0xdcca4e=_0x21fbf0['SIP/'+_0x442d65[_0x1129cf]['name']];if(_0xdcca4e&&_0xdcca4e['online']){this['loggedInDb']+=0x1;}if(_0x442d65[_0x1129cf][_0x7b64('0x49')]==='1'){this[_0x7b64('0x5')]+=0x1;}if(_0x442d65[_0x1129cf][_0x7b64('0x3')]==='1'&&!['2','7','8'][_0x7b64('0x4a')](_0x442d65[_0x1129cf][_0x7b64('0x4b')])){this[_0x7b64('0x3')]+=0x1;}switch(_0x442d65[_0x1129cf][_0x7b64('0x4b')]){case'0':this[_0x7b64('0x20')]+=0x1;break;case'1':this[_0x7b64('0x1a')]+=0x1;break;case'2':this[_0x7b64('0x7')]+=0x1;break;case'3':this[_0x7b64('0x17')]+=0x1;break;case'4':this[_0x7b64('0x18')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x7b64('0x1b')]+=0x1;break;case'8':this[_0x7b64('0x19')]+=0x1;break;}}if(this[_0x7b64('0x25')]===_0x7b64('0x4c')){var _0x12b380=Object['keys'](_0x4d34a5);for(var _0x3e5321=0x0;_0x3e5321<_0x12b380[_0x7b64('0x48')];_0x3e5321++){var _0x476890=_0x12b380[_0x3e5321];var _0x478bb3=_0x4d34a5[_0x476890];if(_0x478bb3[_0x7b64('0x4d')]===this[_0x7b64('0x13')]&&_0x478bb3[_0x7b64('0x1e')]===_0x7b64('0x4e')&&_0x478bb3[_0x7b64('0x4f')]==='xcally-motion-preview'){this[_0x7b64('0x5')]+=0x1;}}if(this[_0x7b64('0x5')]>this['inUse']){this[_0x7b64('0x5')]=this[_0x7b64('0x7')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0x7b64('0x45')][_0x7b64('0x50')]=function(_0x36d930){var _0x30bf26=![];if(_0x36d930){_0x30bf26=INBOUND_COUNTERS[_0x7b64('0x51')](function(_0x79cbc9){return this[_0x79cbc9]!==_0x36d930[_0x79cbc9];},this);}return _0x30bf26;};VoiceQueueSummary[_0x7b64('0x45')][_0x7b64('0x52')]=function(_0x360a47){var _0xc5cbe8=![];var _0xa7550a=![];var _0x1dfd23=![];if(_0x360a47){_0xc5cbe8=this[_0x7b64('0x25')]!==_0x360a47[_0x7b64('0x25')]||this[_0x7b64('0x24')]!==_0x360a47[_0x7b64('0x24')]||this[_0x7b64('0x40')]!==_0x360a47[_0x7b64('0x40')]||this['statusMessage']!==_0x360a47[_0x7b64('0x41')];_0xa7550a=OUTBOUND_COUNTERS['some'](function(_0x30a1b2){return this[_0x30a1b2]!==_0x360a47[_0x30a1b2];},this);if(this[_0x7b64('0x42')]&&_0x360a47[_0x7b64('0x42')]){_0x1dfd23=this['Trunk']['name']!==_0x360a47[_0x7b64('0x42')]['name']||this['Trunk'][_0x7b64('0x43')]!==_0x360a47[_0x7b64('0x42')][_0x7b64('0x43')];}}return _0xc5cbe8||_0xa7550a||_0x1dfd23;};VoiceQueueSummary['prototype'][_0x7b64('0x53')]=function(_0x9721a9){this[_0x7b64('0x16')]=_0x9721a9[_0x7b64('0x16')];this[_0x7b64('0x40')]=_0x9721a9['message'];this['statusMessage']=_0x9721a9[_0x7b64('0x41')];this[_0x7b64('0x8')]=_0x9721a9[_0x7b64('0x8')];this[_0x7b64('0x9')]=_0x9721a9[_0x7b64('0x9')];this[_0x7b64('0xa')]=_0x9721a9[_0x7b64('0xa')];this[_0x7b64('0xb')]=_0x9721a9[_0x7b64('0xb')];this['outboundBusyCallsDay']=_0x9721a9[_0x7b64('0xc')];this['outboundCongestionCallsDay']=_0x9721a9[_0x7b64('0xd')];this['outboundNoAnswerCallsDay']=_0x9721a9['outboundNoAnswerCallsDay'];this['outboundNoSuchCallsDay']=_0x9721a9['outboundNoSuchCallsDay'];this[_0x7b64('0x54')]=_0x9721a9[_0x7b64('0x54')];this['outboundRejectCallsDay']=_0x9721a9[_0x7b64('0x10')];this[_0x7b64('0x2e')]=_0x9721a9[_0x7b64('0x2e')];this['sumBillable']=_0x9721a9[_0x7b64('0x11')];this[_0x7b64('0x12')]=_0x9721a9['sumDuration'];this['total']=_0x9721a9[_0x7b64('0x1d')];if(this['dialMethod']==='preview'){this[_0x7b64('0x23')]=_0x9721a9[_0x7b64('0x23')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0xfa45=['queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','inUse','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','includes','status','dialMethod','booked'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfa45,0x11b));var _0x5fa4=function(_0x40671a,_0x3f74a2){_0x40671a=_0x40671a-0x0;var _0x3ddfc1=_0xfa45[_0x40671a];return _0x3ddfc1;};'use strict';var INBOUND_COUNTERS=[_0x5fa4('0x0'),_0x5fa4('0x1'),_0x5fa4('0x2'),_0x5fa4('0x3'),_0x5fa4('0x4'),_0x5fa4('0x5'),_0x5fa4('0x6')];var OUTBOUND_COUNTERS=['available',_0x5fa4('0x7'),'inUse',_0x5fa4('0x1'),_0x5fa4('0x2'),_0x5fa4('0x8'),_0x5fa4('0x9'),_0x5fa4('0xa'),_0x5fa4('0xb'),_0x5fa4('0xc'),_0x5fa4('0xd'),_0x5fa4('0xe'),_0x5fa4('0xf'),'outboundReCallsDay',_0x5fa4('0x10'),'outboundUnknownCallsDay',_0x5fa4('0x3'),_0x5fa4('0x11'),_0x5fa4('0x5'),_0x5fa4('0x12'),_0x5fa4('0x13'),_0x5fa4('0x14'),_0x5fa4('0x6')];function VoiceQueueSummary(_0x18ae74){this['id']=_0x18ae74['id'];this['name']=_0x18ae74[_0x5fa4('0x15')];this['strategy']=_0x18ae74[_0x5fa4('0x16')];this[_0x5fa4('0x17')]=_0x18ae74[_0x5fa4('0x17')]||0x0;this[_0x5fa4('0x7')]=_0x18ae74[_0x5fa4('0x7')]||0x0;this['available']=_0x18ae74[_0x5fa4('0x0')]||0x0;this[_0x5fa4('0x18')]=_0x18ae74['busy']||0x0;this[_0x5fa4('0x19')]=_0x18ae74[_0x5fa4('0x19')]||0x0;this['invalid']=_0x18ae74[_0x5fa4('0x1a')]||0x0;this['loggedIn']=_0x18ae74['loggedIn']||0x0;this[_0x5fa4('0x2')]=_0x18ae74[_0x5fa4('0x2')]||0x0;this[_0x5fa4('0x1b')]=_0x18ae74[_0x5fa4('0x1b')]||0x0;this[_0x5fa4('0x1c')]=_0x18ae74[_0x5fa4('0x1c')]||0x0;this['paused']=_0x18ae74[_0x5fa4('0x3')]||0x0;this[_0x5fa4('0x4')]=_0x18ae74[_0x5fa4('0x4')]||0x0;this[_0x5fa4('0x1d')]=_0x18ae74[_0x5fa4('0x1d')];this[_0x5fa4('0x12')]=_0x18ae74[_0x5fa4('0x12')];this[_0x5fa4('0x13')]=_0x18ae74[_0x5fa4('0x13')];this[_0x5fa4('0x1e')]=_0x18ae74[_0x5fa4('0x1e')]||0x0;this[_0x5fa4('0x5')]=_0x18ae74['talking']||0x0;this['total']=_0x18ae74[_0x5fa4('0x14')]||0x0;this[_0x5fa4('0x1f')]=_0x18ae74[_0x5fa4('0x1f')];this[_0x5fa4('0x20')]=_0x18ae74['unavailable']||0x0;this['unknown']=_0x18ae74[_0x5fa4('0x21')]||0x0;this['unmanaged']=_0x18ae74[_0x5fa4('0x22')]||0x0;this[_0x5fa4('0x6')]=_0x18ae74[_0x5fa4('0x6')]||0x0;if(_0x18ae74[_0x5fa4('0x1f')]==='outbound'){this[_0x5fa4('0x11')]=_0x18ae74[_0x5fa4('0x11')]||0x0;this[_0x5fa4('0x23')]=_0x18ae74[_0x5fa4('0x23')];this['dialMethod']=_0x18ae74['dialMethod'];this[_0x5fa4('0x24')]=_0x18ae74[_0x5fa4('0x24')];this[_0x5fa4('0x25')]=_0x18ae74[_0x5fa4('0x25')];this['dialOriginateTimeout']=_0x18ae74[_0x5fa4('0x26')];this[_0x5fa4('0x27')]=_0x18ae74[_0x5fa4('0x27')];this[_0x5fa4('0x28')]=_0x18ae74['temp'];this['outboundAnswerAgiCallsDay']=_0x18ae74[_0x5fa4('0x29')];this[_0x5fa4('0xa')]=_0x18ae74[_0x5fa4('0xa')];this[_0x5fa4('0xb')]=_0x18ae74['outboundBlacklistCallsDay'];this[_0x5fa4('0xc')]=_0x18ae74[_0x5fa4('0xc')];this[_0x5fa4('0xd')]=_0x18ae74[_0x5fa4('0xd')];this[_0x5fa4('0x2a')]=_0x18ae74[_0x5fa4('0x2a')];this[_0x5fa4('0x2b')]=_0x18ae74[_0x5fa4('0x2b')];this[_0x5fa4('0x2c')]=_0x18ae74['outboundDropCallsDayTimeout'];this[_0x5fa4('0xe')]=_0x18ae74[_0x5fa4('0xe')];this[_0x5fa4('0xf')]=_0x18ae74['outboundNoSuchCallsDay'];this[_0x5fa4('0x2d')]=_0x18ae74[_0x5fa4('0x2d')];this[_0x5fa4('0x2e')]=_0x18ae74[_0x5fa4('0x2e')];this[_0x5fa4('0x10')]=_0x18ae74[_0x5fa4('0x10')];this['outboundUnknownCallsDay']=_0x18ae74[_0x5fa4('0x2f')];this[_0x5fa4('0x30')]=_0x18ae74[_0x5fa4('0x30')];this[_0x5fa4('0x31')]=_0x18ae74[_0x5fa4('0x31')];this['predictiveIntervalAvgTalktime']=_0x18ae74[_0x5fa4('0x32')];this[_0x5fa4('0x33')]=_0x18ae74['predictiveIntervalDroppedCallsCallersExit'];this[_0x5fa4('0x34')]=_0x18ae74['predictiveIntervalDroppedCallsTimeout'];this[_0x5fa4('0x35')]=_0x18ae74['predictiveIntervalErlangCalls'];this[_0x5fa4('0x36')]=_0x18ae74[_0x5fa4('0x36')];this['predictiveIntervalHitRate']=_0x18ae74['predictiveIntervalHitRate'];this['predictiveIntervalMultiplicativeFactor']=_0x18ae74[_0x5fa4('0x37')];this[_0x5fa4('0x38')]=_0x18ae74[_0x5fa4('0x38')];this[_0x5fa4('0x39')]=_0x18ae74['predictiveIntervalAvailable'];this['predictiveIntervalTotalCalls']=_0x18ae74[_0x5fa4('0x3a')];this[_0x5fa4('0x8')]=_0x18ae74[_0x5fa4('0x8')];this['erlangCalls']=_0x18ae74[_0x5fa4('0x3b')];this[_0x5fa4('0x3c')]=_0x18ae74[_0x5fa4('0x3c')];this['erlangAbandonmentRate']=_0x18ae74[_0x5fa4('0x3d')];this[_0x5fa4('0x3e')]=_0x18ae74['erlangBusyFactor'];this[_0x5fa4('0x3f')]=_0x18ae74['startPredictive'];this[_0x5fa4('0x40')]=_0x18ae74[_0x5fa4('0x40')];this[_0x5fa4('0x41')]=_0x18ae74[_0x5fa4('0x41')];this['statusMessage']=_0x18ae74[_0x5fa4('0x42')];}if(_0x18ae74[_0x5fa4('0x43')]){this[_0x5fa4('0x43')]={'id':_0x18ae74[_0x5fa4('0x43')]['id'],'name':_0x18ae74['Trunk'][_0x5fa4('0x15')],'active':_0x18ae74[_0x5fa4('0x43')][_0x5fa4('0x44')],'callerid':_0x18ae74[_0x5fa4('0x43')][_0x5fa4('0x45')]};}}VoiceQueueSummary[_0x5fa4('0x46')][_0x5fa4('0x47')]=function(_0x41683c,_0x2d8f0f,_0x530745,_0x1b0476){this[_0x5fa4('0x2')]=0x0;this[_0x5fa4('0x5')]=0x0;this[_0x5fa4('0x3')]=0x0;this[_0x5fa4('0x21')]=0x0;this[_0x5fa4('0x1c')]=0x0;this[_0x5fa4('0x19')]=0x0;this[_0x5fa4('0x18')]=0x0;this[_0x5fa4('0x1a')]=0x0;this[_0x5fa4('0x20')]=0x0;this[_0x5fa4('0x4')]=0x0;this[_0x5fa4('0x1d')]=0x0;this['onHold']=0x0;if(_0x530745){if(_0x530745[_0x5fa4('0x0')]){this[_0x5fa4('0x0')]=Number(_0x530745[_0x5fa4('0x0')]);}if(_0x530745[_0x5fa4('0x48')]){this[_0x5fa4('0x1')]=Number(_0x530745['loggedin']);}if(_0x530745[_0x5fa4('0x49')]){this[_0x5fa4('0x6')]=Number(_0x530745[_0x5fa4('0x49')]);}}for(var _0x3564a=0x0;_0x3564a<_0x41683c[_0x5fa4('0x4a')];_0x3564a++){var _0x343050=_0x2d8f0f[_0x5fa4('0x4b')+_0x41683c[_0x3564a][_0x5fa4('0x15')]];if(_0x343050&&_0x343050[_0x5fa4('0x4c')]){this[_0x5fa4('0x2')]+=0x1;}if(_0x41683c[_0x3564a]['incall']==='1'){this[_0x5fa4('0x5')]+=0x1;}if(_0x41683c[_0x3564a][_0x5fa4('0x3')]==='1'&&!['2','7','8'][_0x5fa4('0x4d')](_0x41683c[_0x3564a][_0x5fa4('0x4e')])){this[_0x5fa4('0x3')]+=0x1;}switch(_0x41683c[_0x3564a][_0x5fa4('0x4e')]){case'0':this[_0x5fa4('0x21')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x5fa4('0x18')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x5fa4('0x20')]+=0x1;break;case'6':this[_0x5fa4('0x4')]+=0x1;break;case'7':this[_0x5fa4('0x1d')]+=0x1;break;case'8':this[_0x5fa4('0x1b')]+=0x1;break;}}if(this[_0x5fa4('0x4f')]===_0x5fa4('0x50')){var _0x3c15f8=Object['keys'](_0x1b0476);for(var _0x6e95a=0x0;_0x6e95a<_0x3c15f8[_0x5fa4('0x4a')];_0x6e95a++){var _0x3e1713=_0x3c15f8[_0x6e95a];var _0x56524d=_0x1b0476[_0x3e1713];if(_0x56524d[_0x5fa4('0x51')]===this['name']&&_0x56524d[_0x5fa4('0x1f')]===_0x5fa4('0x52')&&_0x56524d[_0x5fa4('0x53')]===_0x5fa4('0x54')){this[_0x5fa4('0x5')]+=0x1;}}if(this[_0x5fa4('0x5')]>this[_0x5fa4('0x19')]){this['talking']=this[_0x5fa4('0x19')];}this[_0x5fa4('0x11')]=0x0;}return this;};VoiceQueueSummary[_0x5fa4('0x46')][_0x5fa4('0x55')]=function(_0xe060e6){var _0x53f975=![];if(_0xe060e6){_0x53f975=INBOUND_COUNTERS[_0x5fa4('0x56')](function(_0x3588ef){return this[_0x3588ef]!==_0xe060e6[_0x3588ef];},this);}return _0x53f975;};VoiceQueueSummary[_0x5fa4('0x46')][_0x5fa4('0x57')]=function(_0x51b344){var _0x2eb78e=![];var _0x408669=![];var _0x4a4660=![];if(_0x51b344){_0x2eb78e=this[_0x5fa4('0x4f')]!==_0x51b344[_0x5fa4('0x4f')]||this['dialActive']!==_0x51b344[_0x5fa4('0x23')]||this[_0x5fa4('0x41')]!==_0x51b344[_0x5fa4('0x41')]||this[_0x5fa4('0x42')]!==_0x51b344[_0x5fa4('0x42')];_0x408669=OUTBOUND_COUNTERS[_0x5fa4('0x56')](function(_0x110b49){return this[_0x110b49]!==_0x51b344[_0x110b49];},this);if(this[_0x5fa4('0x43')]&&_0x51b344[_0x5fa4('0x43')]){_0x4a4660=this[_0x5fa4('0x43')][_0x5fa4('0x15')]!==_0x51b344['Trunk'][_0x5fa4('0x15')]||this[_0x5fa4('0x43')][_0x5fa4('0x44')]!==_0x51b344[_0x5fa4('0x43')]['active'];}}return _0x2eb78e||_0x408669||_0x4a4660;};VoiceQueueSummary[_0x5fa4('0x46')][_0x5fa4('0x58')]=function(_0x1e5378){this[_0x5fa4('0x7')]=_0x1e5378[_0x5fa4('0x7')];this[_0x5fa4('0x41')]=_0x1e5378['message'];this[_0x5fa4('0x42')]=_0x1e5378['statusMessage'];this[_0x5fa4('0x8')]=_0x1e5378[_0x5fa4('0x8')];this[_0x5fa4('0x9')]=_0x1e5378[_0x5fa4('0x9')];this[_0x5fa4('0xa')]=_0x1e5378[_0x5fa4('0xa')];this[_0x5fa4('0xb')]=_0x1e5378[_0x5fa4('0xb')];this[_0x5fa4('0xc')]=_0x1e5378[_0x5fa4('0xc')];this[_0x5fa4('0xd')]=_0x1e5378['outboundCongestionCallsDay'];this[_0x5fa4('0xe')]=_0x1e5378['outboundNoAnswerCallsDay'];this[_0x5fa4('0xf')]=_0x1e5378[_0x5fa4('0xf')];this[_0x5fa4('0x2e')]=_0x1e5378['outboundReCallsDay'];this[_0x5fa4('0x10')]=_0x1e5378[_0x5fa4('0x10')];this[_0x5fa4('0x2f')]=_0x1e5378['outboundUnknownCallsDay'];this['sumBillable']=_0x1e5378[_0x5fa4('0x12')];this['sumDuration']=_0x1e5378[_0x5fa4('0x13')];this['total']=_0x1e5378['total'];if(this[_0x5fa4('0x4f')]===_0x5fa4('0x59')){this[_0x5fa4('0x11')]=_0x1e5378['pTalking'];}};module[_0x5fa4('0x5a')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 34aab07..5076316 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 _0x8149=['username','remoteUri','serverUrl','Configurations','name'];(function(_0x12350c,_0x1302f2){var _0x5aa27c=function(_0xe8a8b6){while(--_0xe8a8b6){_0x12350c['push'](_0x12350c['shift']());}};_0x5aa27c(++_0x1302f2);}(_0x8149,0x1a3));var _0x9814=function(_0x106766,_0x59c63f){_0x106766=_0x106766-0x0;var _0x594cbc=_0x8149[_0x106766];return _0x594cbc;};'use strict';function VtigerAccount(_0x2fab28){this['id']=_0x2fab28['id']||0x0;this[_0x9814('0x0')]=_0x2fab28['name']||'';this[_0x9814('0x1')]=_0x2fab28[_0x9814('0x1')]||'';this['accessKey']=_0x2fab28['accessKey']||'';this['remoteUri']=_0x2fab28[_0x9814('0x2')]||'';this[_0x9814('0x3')]=_0x2fab28['serverUrl']||'';this['Configurations']=_0x2fab28[_0x9814('0x4')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x18c9=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x1097d7,_0x1bf6df){var _0x140177=function(_0x5ea0c2){while(--_0x5ea0c2){_0x1097d7['push'](_0x1097d7['shift']());}};_0x140177(++_0x1bf6df);}(_0x18c9,0x72));var _0x918c=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x18c9[_0x50aa2e];return _0x5e07f0;};'use strict';function VtigerAccount(_0x50af68){this['id']=_0x50af68['id']||0x0;this[_0x918c('0x0')]=_0x50af68[_0x918c('0x0')]||'';this[_0x918c('0x1')]=_0x50af68[_0x918c('0x1')]||'';this['accessKey']=_0x50af68[_0x918c('0x2')]||'';this[_0x918c('0x3')]=_0x50af68[_0x918c('0x3')]||'';this[_0x918c('0x4')]=_0x50af68['serverUrl']||'';this[_0x918c('0x5')]=_0x50af68[_0x918c('0x5')]||{};}module[_0x918c('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 73a8865..0cd1efa 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 _0x8ddd=['authType','type','serverUrl','exports','name','password','token','remoteUri'];(function(_0x55fc1f,_0x9fe63a){var _0x4cddfd=function(_0x1b134e){while(--_0x1b134e){_0x55fc1f['push'](_0x55fc1f['shift']());}};_0x4cddfd(++_0x9fe63a);}(_0x8ddd,0xa4));var _0xd8dd=function(_0x28b155,_0x3d3a49){_0x28b155=_0x28b155-0x0;var _0x44f194=_0x8ddd[_0x28b155];return _0x44f194;};'use strict';function ZendeskAccount(_0x2fa699){this['id']=_0x2fa699['id']||0x0;this[_0xd8dd('0x0')]=_0x2fa699[_0xd8dd('0x0')]||'';this['username']=_0x2fa699['username']||'';this[_0xd8dd('0x1')]=_0x2fa699['password']||'';this[_0xd8dd('0x2')]=_0x2fa699[_0xd8dd('0x2')]||'';this[_0xd8dd('0x3')]=_0x2fa699[_0xd8dd('0x3')]||'';this[_0xd8dd('0x4')]=_0x2fa699[_0xd8dd('0x4')]||'';this[_0xd8dd('0x5')]=_0x2fa699[_0xd8dd('0x5')]||'integrationTab';this[_0xd8dd('0x6')]=_0x2fa699[_0xd8dd('0x6')]||'';this['Configurations']=_0x2fa699['Configurations']||{};}module[_0xd8dd('0x7')]=ZendeskAccount; \ No newline at end of file +var _0x5c24=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x5c24,0xe4));var _0x45c2=function(_0x503306,_0x356f2f){_0x503306=_0x503306-0x0;var _0x44a99d=_0x5c24[_0x503306];return _0x44a99d;};'use strict';function ZendeskAccount(_0x55c438){this['id']=_0x55c438['id']||0x0;this['name']=_0x55c438[_0x45c2('0x0')]||'';this[_0x45c2('0x1')]=_0x55c438[_0x45c2('0x1')]||'';this['password']=_0x55c438[_0x45c2('0x2')]||'';this[_0x45c2('0x3')]=_0x55c438['token']||'';this[_0x45c2('0x4')]=_0x55c438[_0x45c2('0x4')]||'';this[_0x45c2('0x5')]=_0x55c438[_0x45c2('0x5')]||'';this[_0x45c2('0x6')]=_0x55c438[_0x45c2('0x6')]||_0x45c2('0x7');this[_0x45c2('0x8')]=_0x55c438[_0x45c2('0x8')]||'';this[_0x45c2('0x9')]=_0x55c438['Configurations']||{};}module[_0x45c2('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 970d039..41bc712 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 _0x5885=['clientId','clientSecret','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x858438,_0x5dc8d7){var _0x580a3a=function(_0x3bce2d){while(--_0x3bce2d){_0x858438['push'](_0x858438['shift']());}};_0x580a3a(++_0x5dc8d7);}(_0x5885,0x1e6));var _0x5588=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5885[_0x3dd15e];return _0x231fd0;};'use strict';function ZohoAccount(_0x2d54c9){this['id']=_0x2d54c9['id']||0x0;this[_0x5588('0x0')]=_0x2d54c9[_0x5588('0x0')]||'';this['description']=_0x2d54c9[_0x5588('0x1')]||'';this[_0x5588('0x2')]=_0x2d54c9[_0x5588('0x2')]||'';this[_0x5588('0x3')]=_0x2d54c9[_0x5588('0x3')]||'';this['clientId']=_0x2d54c9[_0x5588('0x4')]||'';this[_0x5588('0x5')]=_0x2d54c9[_0x5588('0x5')]||'';this['serverUrl']=_0x2d54c9['serverUrl']||'';this['code']=_0x2d54c9[_0x5588('0x6')]||'';this[_0x5588('0x7')]=_0x2d54c9['refreshToken']||'';this[_0x5588('0x8')]=_0x2d54c9[_0x5588('0x8')]||{};}module[_0x5588('0x9')]=ZohoAccount; \ No newline at end of file +var _0x9555=['clientSecret','code','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x4048e8,_0xad9040){var _0x1c843d=function(_0x23480f){while(--_0x23480f){_0x4048e8['push'](_0x4048e8['shift']());}};_0x1c843d(++_0xad9040);}(_0x9555,0xe1));var _0x5955=function(_0x2d47a3,_0x483bb3){_0x2d47a3=_0x2d47a3-0x0;var _0x50a7f6=_0x9555[_0x2d47a3];return _0x50a7f6;};'use strict';function ZohoAccount(_0x5d4a8d){this['id']=_0x5d4a8d['id']||0x0;this[_0x5955('0x0')]=_0x5d4a8d['name']||'';this[_0x5955('0x1')]=_0x5d4a8d['description']||'';this['host']=_0x5d4a8d[_0x5955('0x2')]||'';this[_0x5955('0x3')]=_0x5d4a8d['zone']||'';this[_0x5955('0x4')]=_0x5d4a8d[_0x5955('0x4')]||'';this[_0x5955('0x5')]=_0x5d4a8d['clientSecret']||'';this['serverUrl']=_0x5d4a8d['serverUrl']||'';this[_0x5955('0x6')]=_0x5d4a8d['code']||'';this[_0x5955('0x7')]=_0x5d4a8d[_0x5955('0x7')]||'';this[_0x5955('0x8')]=_0x5d4a8d[_0x5955('0x8')]||{};}module[_0x5955('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 072031c..452fc84 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 _0x1eba=['channelAgent','format','SIP/%s','calleridname','Contact','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','getCaller','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','type','campaigntype','dialAnswer','Agent','name'];(function(_0xc67548,_0x50abda){var _0x83f4f5=function(_0x395e28){while(--_0x395e28){_0xc67548['push'](_0xc67548['shift']());}};_0x83f4f5(++_0x50abda);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x1eba[_0x3a6efd];return _0x487b9a;};'use strict';var util=require(_0xa1eb('0x0'));var _=require(_0xa1eb('0x1'));var moment=require(_0xa1eb('0x2'));function checkNameSurname(_0x2158d5,_0x3ef7ee,_0x5865fc){var _0x56c5f2='';if(!_[_0xa1eb('0x3')](_0x3ef7ee)&&_0xa1eb('0x4')===typeof _0x3ef7ee){_0x56c5f2+=_0x3ef7ee;}if(!_[_0xa1eb('0x3')](_0x5865fc)&&_0xa1eb('0x4')===typeof _0x5865fc){_0x56c5f2+='\x20'+_0x5865fc;}if(_0x56c5f2!==''){return _0x56c5f2;}return _0x2158d5;}function Action(_0x138789,_0x2933d0,_0x1d0d67,_0x2bfbb0,_0x39a5a3){this[_0xa1eb('0x5')]=_0x1d0d67||undefined;this[_0xa1eb('0x6')]=_0x138789['id'];this[_0xa1eb('0x7')]=_0x2933d0['name'];this[_0xa1eb('0x8')]=_0x2933d0['type'];this[_0xa1eb('0x9')]='queue';this[_0xa1eb('0xa')]=![];this['membername']=_[_0xa1eb('0x3')](_0x138789['Agent'])?undefined:_0x138789[_0xa1eb('0xb')][_0xa1eb('0xc')];this[_0xa1eb('0xd')]=this['membername']?util[_0xa1eb('0xe')](_0xa1eb('0xf'),this['membername']):_0x2bfbb0||undefined;this[_0xa1eb('0x10')]=checkNameSurname(_0x138789['Contact']['phone'],_0x138789[_0xa1eb('0x11')]['firstName'],_0x138789[_0xa1eb('0x11')][_0xa1eb('0x12')]);this[_0xa1eb('0x13')]=_0x138789[_0xa1eb('0x13')]||![];this[_0xa1eb('0x14')]=_0x138789[_0xa1eb('0x15')];this[_0xa1eb('0x16')]=_0x138789[_0xa1eb('0x16')];this[_0xa1eb('0x17')]=_0x138789['countbusyretry']||0x0;this[_0xa1eb('0x18')]=_0x138789['countcongestionretry']||0x0;this[_0xa1eb('0x19')]=_0x138789[_0xa1eb('0x19')]||0x0;this[_0xa1eb('0x1a')]=(_0x138789[_0xa1eb('0x17')]||0x0)+(_0x138789['countcongestionretry']||0x0)+(_0x138789[_0xa1eb('0x19')]||0x0)+(_0x138789[_0xa1eb('0x1b')]||0x0)+(_0x138789[_0xa1eb('0x1c')]||0x0)+(_0x138789[_0xa1eb('0x1d')]||0x0)+(_0x138789[_0xa1eb('0x1e')]||0x0)+(_0x138789[_0xa1eb('0x1f')]||0x0);this[_0xa1eb('0x1b')]=_0x138789[_0xa1eb('0x1b')]||0x0;this['countdropretry']=_0x138789[_0xa1eb('0x1c')]||0x0;this['countabandonedretry']=_0x138789[_0xa1eb('0x1d')]||0x0;this[_0xa1eb('0x1e')]=_0x138789[_0xa1eb('0x1e')]||0x0;this[_0xa1eb('0x1f')]=_0x138789['countagentrejectretry']||0x0;this['callback']=_0x138789[_0xa1eb('0x20')];this[_0xa1eb('0x21')]=_0x138789['callbackuniqueid'];this[_0xa1eb('0x22')]=_0x138789[_0xa1eb('0x22')];this[_0xa1eb('0x23')]=_0x138789[_0xa1eb('0x23')];this[_0xa1eb('0x24')]=_0x138789[_0xa1eb('0x24')];this[_0xa1eb('0x25')]=_0x138789[_0xa1eb('0x25')];this[_0xa1eb('0x26')]=_[_0xa1eb('0x3')](_0x138789[_0xa1eb('0xb')])?_0x138789[_0xa1eb('0x26')]:_0x138789['Agent']['id'];this[_0xa1eb('0x27')]=_0x138789[_0xa1eb('0x27')];this['originatecalleridnum']='';this[_0xa1eb('0x28')]='';}Action['prototype'][_0xa1eb('0x29')]=function(){return util[_0xa1eb('0xe')]('\x22%s\x22\x20<%s>',this[_0xa1eb('0x10')],this[_0xa1eb('0x2a')]);};module[_0xa1eb('0x2b')]=Action; \ No newline at end of file +var _0xa456=['originatecalleridnum','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','name','channelAgent','calleridname','Contact','phone','lastName','active','calleridnum','scheduledat','countcongestionretry','countnoanswerretry','countbusyretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','Agent','VoiceQueueId'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa456,0x142));var _0x6a45=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xa456[_0x2c7618];return _0x5ce3f0;};'use strict';var util=require(_0x6a45('0x0'));var _=require(_0x6a45('0x1'));var moment=require(_0x6a45('0x2'));function checkNameSurname(_0xd5464e,_0x587626,_0x3bfbe6){var _0x206f6b='';if(!_[_0x6a45('0x3')](_0x587626)&&'string'===typeof _0x587626){_0x206f6b+=_0x587626;}if(!_[_0x6a45('0x3')](_0x3bfbe6)&&_0x6a45('0x4')===typeof _0x3bfbe6){_0x206f6b+='\x20'+_0x3bfbe6;}if(_0x206f6b!==''){return _0x206f6b;}return _0xd5464e;}function Action(_0x1e5882,_0x14da6b,_0x4dfbfa,_0x25cf8d,_0x26bfc0){this[_0x6a45('0x5')]=_0x4dfbfa||undefined;this[_0x6a45('0x6')]=_0x1e5882['id'];this[_0x6a45('0x7')]=_0x14da6b['name'];this[_0x6a45('0x8')]=_0x14da6b['type'];this[_0x6a45('0x9')]=_0x6a45('0x7');this[_0x6a45('0xa')]=![];this[_0x6a45('0xb')]=_[_0x6a45('0x3')](_0x1e5882['Agent'])?undefined:_0x1e5882['Agent'][_0x6a45('0xc')];this[_0x6a45('0xd')]=this['membername']?util['format']('SIP/%s',this[_0x6a45('0xb')]):_0x25cf8d||undefined;this[_0x6a45('0xe')]=checkNameSurname(_0x1e5882[_0x6a45('0xf')][_0x6a45('0x10')],_0x1e5882[_0x6a45('0xf')]['firstName'],_0x1e5882['Contact'][_0x6a45('0x11')]);this[_0x6a45('0x12')]=_0x1e5882['active']||![];this[_0x6a45('0x13')]=_0x1e5882[_0x6a45('0x10')];this[_0x6a45('0x14')]=_0x1e5882[_0x6a45('0x14')];this['countbusyretry']=_0x1e5882['countbusyretry']||0x0;this['countcongestionretry']=_0x1e5882[_0x6a45('0x15')]||0x0;this[_0x6a45('0x16')]=_0x1e5882[_0x6a45('0x16')]||0x0;this['countglobal']=(_0x1e5882[_0x6a45('0x17')]||0x0)+(_0x1e5882[_0x6a45('0x15')]||0x0)+(_0x1e5882[_0x6a45('0x16')]||0x0)+(_0x1e5882['countnosuchnumberretry']||0x0)+(_0x1e5882['countdropretry']||0x0)+(_0x1e5882['countabandonedretry']||0x0)+(_0x1e5882[_0x6a45('0x18')]||0x0)+(_0x1e5882[_0x6a45('0x19')]||0x0);this['countnosuchnumberretry']=_0x1e5882[_0x6a45('0x1a')]||0x0;this[_0x6a45('0x1b')]=_0x1e5882['countdropretry']||0x0;this[_0x6a45('0x1c')]=_0x1e5882[_0x6a45('0x1c')]||0x0;this[_0x6a45('0x18')]=_0x1e5882[_0x6a45('0x18')]||0x0;this[_0x6a45('0x19')]=_0x1e5882['countagentrejectretry']||0x0;this['callback']=_0x1e5882[_0x6a45('0x1d')];this[_0x6a45('0x1e')]=_0x1e5882[_0x6a45('0x1e')];this[_0x6a45('0x1f')]=_0x1e5882[_0x6a45('0x1f')];this[_0x6a45('0x20')]=_0x1e5882[_0x6a45('0x20')];this[_0x6a45('0x21')]=_0x1e5882[_0x6a45('0x21')];this[_0x6a45('0x22')]=_0x1e5882[_0x6a45('0x22')];this[_0x6a45('0x23')]=_['isNil'](_0x1e5882[_0x6a45('0x24')])?_0x1e5882['UserId']:_0x1e5882[_0x6a45('0x24')]['id'];this[_0x6a45('0x25')]=_0x1e5882[_0x6a45('0x25')];this[_0x6a45('0x26')]='';this[_0x6a45('0x27')]='';}Action['prototype'][_0x6a45('0x28')]=function(){return util[_0x6a45('0x29')](_0x6a45('0x2a'),this[_0x6a45('0xe')],this[_0x6a45('0x2b')]);};module[_0x6a45('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 9cca3b0..102ae45 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x14df72,_0x1308f6){var _0x3da7c2=function(_0xa3e38a){while(--_0xa3e38a){_0x14df72['push'](_0x14df72['shift']());}};_0x3da7c2(++_0x1308f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x1c8640,_0xf43860){var _0x31cc47=function(_0x60c762){while(--_0x60c762){_0x1c8640['push'](_0x1c8640['shift']());}};_0x31cc47(++_0xf43860);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 1199742..a4a23e5 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 _0xfec3=['connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','createHistory','catch','[createHistory]\x20','resolve','then','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','queuecallercompleteAt'];(function(_0x5e9018,_0x5d3a28){var _0x2062e2=function(_0x4aa0d8){while(--_0x4aa0d8){_0x5e9018['push'](_0x5e9018['shift']());}};_0x2062e2(++_0x5d3a28);}(_0xfec3,0xd3));var _0x3fec=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xfec3[_0x167cc1];return _0x10bc4b;};'use strict';var util=require(_0x3fec('0x0'));var BPromise=require(_0x3fec('0x1'));var logger=require(_0x3fec('0x2'))('preview');var cmHopper=require(_0x3fec('0x3'));var cmHopperHistory=require(_0x3fec('0x4'));var cmHopperBlack=require(_0x3fec('0x5'));var agentReportPreview=require(_0x3fec('0x6'));var voiceQueueReport=require(_0x3fec('0x7'));function loggerCatch(_0x895ac9){return function(_0x1fc792){logger['error'](_0x895ac9,util['inspect'](_0x1fc792,{'showHidden':![],'depth':null}));};}function create(_0x2f03e9){return cmHopperHistory[_0x3fec('0x8')](_0x2f03e9)[_0x3fec('0x9')](loggerCatch(_0x3fec('0xa')));}function createAgent(_0x58f1ae){return BPromise[_0x3fec('0xb')]()[_0x3fec('0xc')](agentReportPreview[_0x3fec('0x8')](_0x58f1ae))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x57f2e4){return cmHopper['moveContactManagedDialer'](_0x57f2e4,!![])['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0x3fbe08){return cmHopperBlack['checkIsBlackList'](_0x3fbe08)[_0x3fec('0x9')](loggerCatch(_0x3fec('0xd')));};exports[_0x3fec('0xe')]=function(_0x38dd14){return BPromise[_0x3fec('0xb')]()[_0x3fec('0xc')](cmHopper[_0x3fec('0xe')](_0x38dd14))[_0x3fec('0x9')](loggerCatch(_0x3fec('0xf')));};exports['createHistory']=function(_0x2c49cc,_0x5a2282){create(_0x2c49cc)[_0x3fec('0x9')](loggerCatch(_0x5a2282));moveContact(_0x2c49cc)[_0x3fec('0x9')](loggerCatch(_0x5a2282));};exports[_0x3fec('0x10')]=function(_0x395cf8,_0x335197){createAgent(_0x395cf8)[_0x3fec('0x9')](loggerCatch(_0x335197));};exports['createCustomerHistory']=function(_0x3937bb,_0x47ded8){create(_0x3937bb)[_0x3fec('0x9')](loggerCatch(_0x47ded8));};exports[_0x3fec('0x11')]=function(_0x5c7059,_0x4d5fd2){moveContact(_0x5c7059)[_0x3fec('0x9')](loggerCatch(_0x4d5fd2));};exports[_0x3fec('0x12')]=function(_0x9fc1c9,_0x17f350,_0x3adc0a){if(_0x17f350){_0x9fc1c9[_0x3fec('0x13')]=null;}if(_0x3adc0a){_0x9fc1c9[_0x3fec('0x14')]=![];}return cmHopper[_0x3fec('0x12')](_0x9fc1c9)[_0x3fec('0x9')](loggerCatch(_0x3fec('0x15')));};exports[_0x3fec('0x16')]=function(_0xf46776){return cmHopper['countReScheduled'](_0xf46776)['catch'](loggerCatch(_0x3fec('0x17')));};exports[_0x3fec('0x18')]=function(_0x8f1b07){return cmHopper[_0x3fec('0x18')]({'UserId':null},_0x8f1b07,0x1)[_0x3fec('0x9')](loggerCatch('[unlockContact]\x20'));};exports[_0x3fec('0x19')]=function(_0x1a117e){return cmHopper['unlockContact']({'active':![]},_0x1a117e,0x1)['catch'](loggerCatch(_0x3fec('0x1a')));};exports['crateCustomerReportQueue']=function(_0x498598){var _0x1732c2={};_0x1732c2[_0x3fec('0x1b')]=_0x498598[_0x3fec('0x1b')];_0x1732c2['uniqueid']=_0x498598[_0x3fec('0x1c')];_0x1732c2[_0x3fec('0x1d')]=_0x498598[_0x3fec('0x1d')];_0x1732c2[_0x3fec('0x1e')]=_0x498598[_0x3fec('0x1e')];_0x1732c2[_0x3fec('0x1f')]=_0x498598[_0x3fec('0x1f')];_0x1732c2['queuecallerjoinAt']=_0x498598['answertime'];_0x1732c2[_0x3fec('0x20')]=_0x498598['answertime'];_0x1732c2['queuecallercomplete']=0x1;_0x1732c2[_0x3fec('0x21')]=_0x498598['endtime'];_0x1732c2[_0x3fec('0x22')]=_0x498598[_0x3fec('0x23')];_0x1732c2[_0x3fec('0x24')]=_0x3fec('0x25');_0x1732c2[_0x3fec('0x26')]=_0x3fec('0x27');_0x1732c2[_0x3fec('0x28')]=0x0;_0x1732c2[_0x3fec('0x29')]=0x1;_0x1732c2[_0x3fec('0x2a')]=_0x498598[_0x3fec('0x23')];_0x1732c2[_0x3fec('0x2b')]=_0x3fec('0x2c');return BPromise[_0x3fec('0xb')]()[_0x3fec('0xc')](voiceQueueReport['create'](_0x1732c2))[_0x3fec('0x9')](loggerCatch(_0x3fec('0x2d')));};exports['getContactRecallMe']=function(_0x38ceed,_0x271b6b){return BPromise[_0x3fec('0xb')]()[_0x3fec('0xc')](cmHopper[_0x3fec('0x2e')](_0x38ceed,_0x271b6b))[_0x3fec('0x9')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x3fec('0x2f')]=function(_0x534e85){return cmHopper['rescheduleContact'](_0x534e85,!![],!![])[_0x3fec('0x9')](loggerCatch(_0x3fec('0x30')));}; \ No newline at end of file +var _0x7d09=['getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','membername','context','from-sip','holdtime','assigned','lastAssignedTo','COMPLETED','getContactRecallMe','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20'];(function(_0x45a813,_0x13e302){var _0x41e082=function(_0x9488b5){while(--_0x9488b5){_0x45a813['push'](_0x45a813['shift']());}};_0x41e082(++_0x13e302);}(_0x7d09,0x142));var _0x97d0=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0x7d09[_0xd050c6];return _0x7278a;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x97d0('0x0'));var cmHopper=require(_0x97d0('0x1'));var cmHopperHistory=require(_0x97d0('0x2'));var cmHopperBlack=require(_0x97d0('0x3'));var agentReportPreview=require(_0x97d0('0x4'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x105ed){return function(_0x17eb74){logger['error'](_0x105ed,util[_0x97d0('0x5')](_0x17eb74,{'showHidden':![],'depth':null}));};}function create(_0x5f3d6c){return cmHopperHistory[_0x97d0('0x6')](_0x5f3d6c)[_0x97d0('0x7')](loggerCatch(_0x97d0('0x8')));}function createAgent(_0x2a5637){return BPromise[_0x97d0('0x9')]()[_0x97d0('0xa')](agentReportPreview[_0x97d0('0x6')](_0x2a5637))['catch'](loggerCatch(_0x97d0('0x8')));}function moveContact(_0x441023){return cmHopper[_0x97d0('0xb')](_0x441023,!![])[_0x97d0('0x7')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x97d0('0xc')]=function(_0x1e878b){return cmHopperBlack['checkIsBlackList'](_0x1e878b)[_0x97d0('0x7')](loggerCatch(_0x97d0('0xd')));};exports[_0x97d0('0xe')]=function(_0x1c04b1){return BPromise[_0x97d0('0x9')]()[_0x97d0('0xa')](cmHopper[_0x97d0('0xe')](_0x1c04b1))[_0x97d0('0x7')](loggerCatch('[getContactPreview]\x20'));};exports[_0x97d0('0x6')]=function(_0x3840ae,_0x4a2ff8){create(_0x3840ae)[_0x97d0('0x7')](loggerCatch(_0x4a2ff8));moveContact(_0x3840ae)[_0x97d0('0x7')](loggerCatch(_0x4a2ff8));};exports[_0x97d0('0xf')]=function(_0x3b500d,_0x200a57){createAgent(_0x3b500d)[_0x97d0('0x7')](loggerCatch(_0x200a57));};exports[_0x97d0('0x10')]=function(_0x2a38e3,_0x463e71){create(_0x2a38e3)[_0x97d0('0x7')](loggerCatch(_0x463e71));};exports[_0x97d0('0x11')]=function(_0x2a6fed,_0x146f84){moveContact(_0x2a6fed)[_0x97d0('0x7')](loggerCatch(_0x146f84));};exports['rescheduleContact']=function(_0x4be7dd,_0x3bfda3,_0x1d5e5a){if(_0x3bfda3){_0x4be7dd[_0x97d0('0x12')]=null;}if(_0x1d5e5a){_0x4be7dd[_0x97d0('0x13')]=![];}return cmHopper[_0x97d0('0x14')](_0x4be7dd)[_0x97d0('0x7')](loggerCatch(_0x97d0('0x15')));};exports['countReScheduled']=function(_0x483361){return cmHopper['countReScheduled'](_0x483361)[_0x97d0('0x7')](loggerCatch(_0x97d0('0x16')));};exports[_0x97d0('0x17')]=function(_0x4c495b){return cmHopper[_0x97d0('0x17')]({'UserId':null},_0x4c495b,0x1)[_0x97d0('0x7')](loggerCatch('[unlockContact]\x20'));};exports[_0x97d0('0x18')]=function(_0xdd1058){return cmHopper[_0x97d0('0x17')]({'active':![]},_0xdd1058,0x1)[_0x97d0('0x7')](loggerCatch(_0x97d0('0x19')));};exports['crateCustomerReportQueue']=function(_0xaa759f){var _0x412dce={};_0x412dce[_0x97d0('0x1a')]=_0xaa759f[_0x97d0('0x1a')];_0x412dce[_0x97d0('0x1b')]=_0xaa759f['uniqueid'];_0x412dce[_0x97d0('0x1c')]=_0xaa759f['calleridnum'];_0x412dce[_0x97d0('0x1d')]=_0xaa759f[_0x97d0('0x1d')];_0x412dce['queue']=_0xaa759f['queue'];_0x412dce[_0x97d0('0x1e')]=_0xaa759f[_0x97d0('0x1f')];_0x412dce['queuecallerleaveAt']=_0xaa759f[_0x97d0('0x1f')];_0x412dce[_0x97d0('0x20')]=0x1;_0x412dce[_0x97d0('0x21')]=_0xaa759f['endtime'];_0x412dce['connectedlinename']=_0xaa759f[_0x97d0('0x22')];_0x412dce[_0x97d0('0x23')]=_0x97d0('0x24');_0x412dce['exten']='xcally-motion-preview';_0x412dce[_0x97d0('0x25')]=0x0;_0x412dce[_0x97d0('0x26')]=0x1;_0x412dce[_0x97d0('0x27')]=_0xaa759f[_0x97d0('0x22')];_0x412dce['queuecallerexitreason']=_0x97d0('0x28');return BPromise[_0x97d0('0x9')]()[_0x97d0('0xa')](voiceQueueReport['create'](_0x412dce))[_0x97d0('0x7')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x97d0('0x29')]=function(_0x51fafb,_0x2ef64c){return BPromise[_0x97d0('0x9')]()['then'](cmHopper[_0x97d0('0x29')](_0x51fafb,_0x2ef64c))[_0x97d0('0x7')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x1d63f6){return cmHopper[_0x97d0('0x14')](_0x1d63f6,!![],!![])[_0x97d0('0x7')](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 dcd1da8..66af823 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 _0x93b9=['error','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','logAgent','state','ringtime','getSeconds','logLookAgent','UserId','logCustomer','endtime','answertime','isFailure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','reachable','push','getDiff','diff','seconds','CampaignId','filterKey','idContact','campaigntype','dialAnswer','membername','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','extractCalleridName','extractCalleridNumber','match','variables','forEach','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','inspect','logger','info','loggerError'];(function(_0x5679e5,_0x4e45c9){var _0x34a94=function(_0xda168c){while(--_0xda168c){_0x5679e5['push'](_0x5679e5['shift']());}};_0x34a94(++_0x4e45c9);}(_0x93b9,0x1a9));var _0x993b=function(_0x3a2118,_0x31fc3c){_0x3a2118=_0x3a2118-0x0;var _0x1d181d=_0x93b9[_0x3a2118];return _0x1d181d;};'use strict';var util=require(_0x993b('0x0'));var _=require(_0x993b('0x1'));var moment=require(_0x993b('0x2'));var logger=require(_0x993b('0x3'))(_0x993b('0x4'));var ipAgi=process[_0x993b('0x5')][_0x993b('0x6')]||_0x993b('0x7');var utils=require(_0x993b('0x8'));exports['loggerCatch']=function(_0x3343cc){return function(_0x3631e9){logger['error'](_0x3343cc,util[_0x993b('0x9')](_0x3631e9,{'showHidden':![],'depth':null}));};};exports[_0x993b('0xa')]=function(_0x5489ba,_0x2559a8){logger[_0x993b('0xb')](_0x5489ba,util[_0x993b('0x9')](_0x2559a8,{'showHidden':![],'depth':null}));};exports[_0x993b('0xc')]=function(_0x282ea8,_0x2f2017){logger[_0x993b('0xd')](_0x282ea8,util['inspect'](_0x2f2017,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x513cb6){return function(_0x1fbda3){logger['info'](_0x513cb6,util[_0x993b('0x9')](_0x1fbda3,{'showHidden':![],'depth':null}));};};exports[_0x993b('0xe')]=function(_0x3190ba,_0x56fab5,_0x5576cb){return{'message':_0x3190ba,'unlock':_0x56fab5,'active':_0x5576cb};};exports[_0x993b('0xf')]=function(_0x464693,_0x3674fb,_0x53adbb){if(!_[_0x993b('0x10')](_0x53adbb)&&_0x993b('0x11')===typeof _0x53adbb&&!_[_0x993b('0x12')](_0x53adbb)){if(!_[_0x993b('0x10')](_0x3674fb)&&_0x993b('0x11')===typeof _0x3674fb&&!_['isEmpty'](_0x3674fb)){return util[_0x993b('0x13')](_0x993b('0x14'),_0x3674fb,_0x53adbb);}return util['format']('\x22%s\x22\x20<%s>',_0x53adbb,_0x53adbb);}if(!_[_0x993b('0x10')](_0x464693)&&_0x993b('0x11')===typeof _0x464693&&!_[_0x993b('0x12')](_0x464693)){return _0x464693;}return _0x993b('0x15');};exports['isActive']=function(_0xefc3c4){if(_[_0x993b('0x16')](_0xefc3c4)){return![];}return _0xefc3c4;};exports[_0x993b('0x17')]=function(_0x29c46a,_0x44cdf7,_0x332b25,_0x47887e,_0x42a3e4,_0x12fbed){var _0x595577={'XMD-QUEUE':_0x44cdf7[_0x993b('0x18')]?_0x44cdf7['Queue'][_0x993b('0x19')]:'','XMD-CALLERID':_0x47887e,'XMD-CALLERID-PREVIEW':_0x12fbed?util[_0x993b('0x13')](_0x993b('0x14'),_0x12fbed['calleridname'],_0x12fbed[_0x993b('0x1a')]):_0x47887e,'XMD-DIALID':_0x42a3e4,'XMD-CONTACTID':_0x44cdf7[_0x993b('0x1b')],'XMD-CDRTYPE':_0x993b('0x1c'),'CALLERID(all)':_0x47887e,'XMD-VOICEQUEUEID':_0x44cdf7[_0x993b('0x1d')],'XMD-DIALCHANNEL':_0x332b25,'XMD-DIALTIMEOUT':_0x29c46a[_0x993b('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x993b('0x13')]('\x22rtTxX%s%s\x22',_0x29c46a[_0x993b('0x1f')]?'g':'',_[_0x993b('0x12')](_0x29c46a[_0x993b('0x20')])?'':_0x993b('0x21')),'XMD-DIALURL':_0x29c46a[_0x993b('0x22')]||'','XMD-AGI':_0x29c46a[_0x993b('0x23')]?util[_0x993b('0x13')](_0x993b('0x24'),ipAgi,_0x29c46a[_0x993b('0x23')]):_0x993b('0x25'),'XMD-AGIAFTER':_0x29c46a['dialQueueProject2']?util['format'](_0x993b('0x24'),ipAgi,_0x29c46a[_0x993b('0x1f')]):_0x993b('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x12fbed?_0x12fbed[_0x993b('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x12fbed?_0x12fbed['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x993b('0x27')};if(!_['isEmpty'](_0x29c46a[_0x993b('0x20')])){_0x595577[util[_0x993b('0x13')]('%s',_0x993b('0x28'))]=_0x29c46a['monitor_format'];_0x595577[util[_0x993b('0x13')]('%s',_0x993b('0x29'))]=_0x42a3e4;}return _0x595577;};exports[_0x993b('0x2a')]=function(_0x4209ae){var _0x2d7a2f={};for(var _0x41a04f in _0x4209ae){if(_0x4209ae[_0x993b('0x2b')](_0x41a04f)){_0x2d7a2f[util[_0x993b('0x13')]('%s',_[_0x993b('0x2c')](_0x41a04f))]=_0x4209ae[_0x41a04f];}}return{'variables':_0x2d7a2f};};exports[_0x993b('0x2d')]=function(_0x14c3eb,_0x56e755){if(!_['isNil'](_0x14c3eb)){if(_0x14c3eb[_0x993b('0x2b')](_0x993b('0x2e'))){if(_0x14c3eb[_0x993b('0x2e')]>0x0){_0x14c3eb[_0x993b('0x2e')]-=0x1;}else{logger['error'](_0x993b('0x2f'),_0x56e755);}}}else{logger[_0x993b('0xd')](_0x993b('0x30'),_0x56e755);}};exports[_0x993b('0x31')]=function(_0x4dd660){var _0x2f504d=moment()[_0x993b('0x13')](_0x993b('0x32'));_0x4dd660['state']=0xd;_0x4dd660[_0x993b('0x33')]=_0x993b('0x34');_0x4dd660[_0x993b('0x35')]=_0x2f504d;_0x4dd660[_0x993b('0x36')]=_0x2f504d;_0x4dd660['endtime']=_0x2f504d;};exports[_0x993b('0x37')]=function(_0x30dbe6,_0x278dff,_0x1561e7){var _0x294413=moment()[_0x993b('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x30dbe6[_0x993b('0x38')]=_0x278dff;_0x30dbe6[_0x993b('0x33')]=_0x1561e7;_0x30dbe6[_0x993b('0x36')]=_0x294413;_0x30dbe6[_0x993b('0x39')]=utils[_0x993b('0x3a')](_0x30dbe6[_0x993b('0x36')],_0x30dbe6[_0x993b('0x35')]);};exports[_0x993b('0x3b')]=function(_0x1e7754,_0x15dc5b,_0x57853f){_0x1e7754['membername']=_0x15dc5b;_0x1e7754[_0x993b('0x3c')]=_0x57853f;};exports[_0x993b('0x3d')]=function(_0x54981e,_0x5ffb1d,_0x430b24){var _0xa9de4c=moment()[_0x993b('0x13')](_0x993b('0x32'));_0x54981e[_0x993b('0x38')]=_0x5ffb1d;_0x54981e[_0x993b('0x33')]=_0x430b24;_0x54981e[_0x993b('0x36')]=_0x54981e['responsetime']?_0x54981e[_0x993b('0x36')]:_0xa9de4c;_0x54981e['endtime']=_0x54981e[_0x993b('0x3e')]?_0x54981e['endtime']:_0xa9de4c;_0x54981e[_0x993b('0x39')]=utils[_0x993b('0x3a')](_0x54981e[_0x993b('0x36')]||0x0,_0x54981e[_0x993b('0x35')]||0x0);_0x54981e['talktime']=_0x54981e[_0x993b('0x3f')]?utils[_0x993b('0x3a')](_0x54981e[_0x993b('0x3e')],_0x54981e['answertime']):0x0;};exports[_0x993b('0x40')]=function(_0x360b9d){return _0x360b9d==='Failure';};exports[_0x993b('0x41')]=function(_0x4a7a54,_0x29e774,_0xc0fe64,_0x129d18,_0x523d41){var _0x5819c4=_0x129d18?_0x993b('0x42'):_0x4a7a54['calleridname'];_0x5819c4=_0x523d41?_0x993b('0x43'):_0x5819c4;return{'actionid':_0x4a7a54[_0x993b('0x44')],'action':_0x993b('0x45'),'channel':_0x4a7a54[_0x993b('0x46')],'callerid':util[_0x993b('0x13')](_0x993b('0x14'),_0x5819c4,_0x4a7a54[_0x993b('0x1a')]),'Exten':_0x993b('0x47'),'Context':_0x993b('0x48'),'Priority':'1','variable':_0xc0fe64,'timeout':(_0x29e774['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x4a7a54['uniqueid']};};exports['totalGlobal']=function(_0x5d2ac7){return _0x5d2ac7[_0x993b('0x49')]+_0x5d2ac7[_0x993b('0x4a')]+_0x5d2ac7[_0x993b('0x4b')]+_0x5d2ac7['countagentrejectretry']+_0x5d2ac7[_0x993b('0x4c')];};exports[_0x993b('0x4d')]=function(_0x7c3b1e){var _0x2b3c02=_[_0x993b('0x4e')](_0x7c3b1e);_0x2b3c02[_0x993b('0x38')]=0xf;_0x2b3c02[_0x993b('0x33')]='Global';return _0x2b3c02;};exports[_0x993b('0x4f')]=function(_0x280eb7,_0x138547,_0x35f82d){var _0x4efc05={};_0x4efc05[_0x138547]=_0x280eb7[_0x138547];_0x4efc05['active']=![];_0x4efc05[_0x993b('0x50')]=moment()[_0x993b('0x51')](_0x35f82d,_0x993b('0x52'))[_0x993b('0x13')](_0x993b('0x32'));_0x4efc05[_0x993b('0x1b')]=_0x280eb7[_0x993b('0x1b')];_0x4efc05[_0x993b('0x53')]=_0x280eb7[_0x993b('0x53')];_0x4efc05[_0x993b('0x1d')]=_0x280eb7[_0x993b('0x1d')]||undefined;return _0x4efc05;};exports[_0x993b('0x54')]=function(_0x47eb53,_0x475d62){if(!_[_0x993b('0x16')](_0x47eb53)){if(_0x47eb53[_0x993b('0x55')]>0x0){_0x47eb53['pTalking']-=0x1;}else{logger['error'](_0x475d62,_0x993b('0x56'));}}else{logger[_0x993b('0xd')](_0x475d62,_0x993b('0x57'));}};exports[_0x993b('0x58')]=function(_0x1a7a84){if(_0x1a7a84<=0x0){return!![];}return![];};function buildObj(_0x192dac,_0x4e3cd1,_0x3130c1){_0x192dac['lastevent']=_0x4e3cd1;_0x192dac['name']=_0x192dac[_0x993b('0x59')];_0x192dac[_0x993b('0x5a')]=_0x192dac[_0x993b('0x46')];_0x192dac[_0x993b('0x5b')]=_0x993b('0x5c');if(_0x3130c1){_0x192dac[_0x993b('0x5d')]=_0x3130c1[_0x993b('0x5d')];}return _0x192dac;}exports[_0x993b('0x5e')]=buildObj;exports[_0x993b('0x5f')]=function(_0x3e375e){var _0x5a0a22=[];for(var _0x10dad1 in _0x3e375e){if(_0x3e375e[_0x993b('0x2b')](_0x10dad1)){if(!_[_0x993b('0x16')](_0x3e375e[_0x10dad1])&&_0x3e375e[_0x10dad1][_0x993b('0x38')]===_0x993b('0x60')&&_0x3e375e[_0x10dad1][_0x993b('0x61')]===_0x993b('0x62')){_0x5a0a22[_0x993b('0x63')](_0x3e375e[_0x10dad1]['id']);}}}return _0x5a0a22;};exports[_0x993b('0x64')]=function(_0x28d61a){var _0x6877a4=moment()['milliseconds'](0x0);var _0x4057cd=moment(_0x28d61a)['milliseconds'](0x0);return _0x6877a4[_0x993b('0x65')](_0x4057cd,_0x993b('0x66'));};exports['createBody']=function(_0x383977){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x383977['ContactId'],'ListId':_0x383977[_0x993b('0x53')],'VoiceQueueId':_0x383977[_0x993b('0x1d')]||undefined,'CampaignId':_0x383977[_0x993b('0x67')]||undefined};};exports[_0x993b('0x68')]=function(_0x437af0){if(_0x437af0==='uniqueid'||_0x437af0===_0x993b('0x69')||_0x437af0===_0x993b('0x59')||_0x437af0==='type'||_0x437af0===_0x993b('0x6a')||_0x437af0===_0x993b('0x6b')||_0x437af0===_0x993b('0x6c')||_0x437af0==='channelAgent'||_0x437af0==='calleridname'||_0x437af0==='active'||_0x437af0===_0x993b('0x1a')||_0x437af0===_0x993b('0x50')||_0x437af0===_0x993b('0x49')||_0x437af0===_0x993b('0x4a')||_0x437af0===_0x993b('0x4b')||_0x437af0===_0x993b('0x6d')||_0x437af0===_0x993b('0x6e')||_0x437af0===_0x993b('0x6f')||_0x437af0===_0x993b('0x70')||_0x437af0===_0x993b('0x71')||_0x437af0===_0x993b('0x1b')||_0x437af0===_0x993b('0x53')||_0x437af0===_0x993b('0x3c')||_0x437af0===_0x993b('0x1d')||_0x437af0===_0x993b('0x72')||_0x437af0===_0x993b('0x73')||_0x437af0===_0x993b('0x74')||_0x437af0===_0x993b('0x75')||_0x437af0==='xmd-listid'||_0x437af0==='xmd-dialurl'||_0x437af0===_0x993b('0x76')||_0x437af0===_0x993b('0x77')||_0x437af0===_0x993b('0x78')||_0x437af0===_0x993b('0x79')||_0x437af0===_0x993b('0x7a')||_0x437af0===_0x993b('0x7b')||_0x437af0===_0x993b('0x7c')||_0x437af0===_0x993b('0x7d')||_0x437af0===_0x993b('0x7e')||_0x437af0===_0x993b('0x7f')||_0x437af0==='rtpaudioqosbridged'||_0x437af0===_0x993b('0x80')||_0x437af0===_0x993b('0x81')||_0x437af0==='rtpaudioqosloss'||_0x437af0==='rtpaudioqoslossbridged'||_0x437af0===_0x993b('0x82')||_0x437af0==='rtpaudioqosrttbridged'||_0x437af0==='rtpaudioqos'||_0x437af0===_0x993b('0x83')||_0x437af0===_0x993b('0x80')||_0x437af0===_0x993b('0x81')||_0x437af0===_0x993b('0x84')||_0x437af0===_0x993b('0x85')||_0x437af0==='rtpaudioqosrtt'||_0x437af0===_0x993b('0x86')||_0x437af0===_0x993b('0x87')||_0x437af0===_0x993b('0x88')||_0x437af0===_0x993b('0x38')||_0x437af0===_0x993b('0x33')){return![];}return!![];};exports[_0x993b('0x89')]=function(_0xbcb6d,_0x3eb05b){var _0xb74e25,_0x949198,_0x25879c;if(_0x3eb05b<=0x0){_0x3eb05b=0x1;}_0xb74e25=new RegExp('\x5cw{0,'+_0x3eb05b+'}$');_0x949198=Math[_0x993b('0x8a')](0xa,_0x3eb05b-0x1);_0x25879c=Math[_0x993b('0x8a')](0xa,_0x3eb05b)-0x1;return util[_0x993b('0x13')]('%s',_[_0x993b('0x8b')](_0xbcb6d,_0xb74e25,_[_0x993b('0x8c')](_0x949198,_0x25879c)));};exports[_0x993b('0x8d')]=function(_0x13aa30){var _0x2fc557=_0x13aa30['match'](/"(.*?)"/);return _0x2fc557?_0x2fc557[0x1]:_0x13aa30;};exports[_0x993b('0x8e')]=function(_0x2e7aea){var _0xe923be=_0x2e7aea[_0x993b('0x8f')](/<(.*?)>/);return _0xe923be?_0xe923be[0x1]:_0x2e7aea;};function buildNoAnswerEventPayload(_0x4afa7b,_0x3b4efc){var _0x33bcc0=buildObj(_0x4afa7b,'noanswer');if(!_['isEmpty'](_0x3b4efc[_0x993b('0x90')])){Object['keys'](_0x3b4efc[_0x993b('0x90')])[_0x993b('0x91')](function(_0x2274ec){_0x33bcc0[_0x2274ec['toLowerCase']()]=_0x3b4efc[_0x993b('0x90')][_0x2274ec];});}return _0x33bcc0;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0x570f=['uniqueid','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','cloneAction','clone','scheduledAt','active','scheduledat','add','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','push','getDiff','milliseconds','diff','seconds','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','channelAgent','countglobal','callbackuniqueid','callbackat','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepeer','\x5cw{0,','pow','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','util','moment','../../../../config/logger','preview','env','127.0.0.1','../../dialer/utils','error','inspect','logger','info','loggerError','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','endtime','logAgent','ringtime','getSeconds','responsetime','logLookAgent','membername','UserId','talktime','answertime','isFailure','variablesAction','RECALL','BOOKED'];(function(_0x102881,_0x58d723){var _0x5c63d0=function(_0x955c59){while(--_0x955c59){_0x102881['push'](_0x102881['shift']());}};_0x5c63d0(++_0x58d723);}(_0x570f,0xd3));var _0xf570=function(_0xef5f0f,_0x35b798){_0xef5f0f=_0xef5f0f-0x0;var _0xd3b8d=_0x570f[_0xef5f0f];return _0xd3b8d;};'use strict';var util=require(_0xf570('0x0'));var _=require('lodash');var moment=require(_0xf570('0x1'));var logger=require(_0xf570('0x2'))(_0xf570('0x3'));var ipAgi=process[_0xf570('0x4')]['XCALLY_IP_AGI']||_0xf570('0x5');var utils=require(_0xf570('0x6'));exports['loggerCatch']=function(_0x145e38){return function(_0x36a984){logger[_0xf570('0x7')](_0x145e38,util[_0xf570('0x8')](_0x36a984,{'showHidden':![],'depth':null}));};};exports[_0xf570('0x9')]=function(_0x218013,_0x58fa14){logger[_0xf570('0xa')](_0x218013,util[_0xf570('0x8')](_0x58fa14,{'showHidden':![],'depth':null}));};exports[_0xf570('0xb')]=function(_0x240686,_0x16b907){logger[_0xf570('0x7')](_0x240686,util['inspect'](_0x16b907,{'showHidden':![],'depth':null}));};exports[_0xf570('0xc')]=function(_0x22caad){return function(_0x4566cd){logger[_0xf570('0xa')](_0x22caad,util[_0xf570('0x8')](_0x4566cd,{'showHidden':![],'depth':null}));};};exports[_0xf570('0xd')]=function(_0x5d474d,_0x5dc181,_0xf82263){return{'message':_0x5d474d,'unlock':_0x5dc181,'active':_0xf82263};};exports['getCallerId']=function(_0x2f1e64,_0x115030,_0x1023a3){if(!_[_0xf570('0xe')](_0x1023a3)&&_0xf570('0xf')===typeof _0x1023a3&&!_[_0xf570('0x10')](_0x1023a3)){if(!_['isUndefined'](_0x115030)&&_0xf570('0xf')===typeof _0x115030&&!_['isEmpty'](_0x115030)){return util[_0xf570('0x11')](_0xf570('0x12'),_0x115030,_0x1023a3);}return util[_0xf570('0x11')]('\x22%s\x22\x20<%s>',_0x1023a3,_0x1023a3);}if(!_[_0xf570('0xe')](_0x2f1e64)&&_0xf570('0xf')===typeof _0x2f1e64&&!_[_0xf570('0x10')](_0x2f1e64)){return _0x2f1e64;}return'\x22\x22\x20<>';};exports[_0xf570('0x13')]=function(_0x2e2464){if(_[_0xf570('0x14')](_0x2e2464)){return![];}return _0x2e2464;};exports[_0xf570('0x15')]=function(_0x13dc02,_0xbb1e96,_0x3cae1d,_0x5ce994,_0x3e857a,_0x3cf1e8){var _0x275183={'XMD-QUEUE':_0xbb1e96[_0xf570('0x16')]?_0xbb1e96[_0xf570('0x16')][_0xf570('0x17')]:'','XMD-CALLERID':_0x5ce994,'XMD-CALLERID-PREVIEW':_0x3cf1e8?util[_0xf570('0x11')](_0xf570('0x12'),_0x3cf1e8[_0xf570('0x18')],_0x3cf1e8[_0xf570('0x19')]):_0x5ce994,'XMD-DIALID':_0x3e857a,'XMD-CONTACTID':_0xbb1e96['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x5ce994,'XMD-VOICEQUEUEID':_0xbb1e96[_0xf570('0x1a')],'XMD-DIALCHANNEL':_0x3cae1d,'XMD-DIALTIMEOUT':_0x13dc02['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xf570('0x11')](_0xf570('0x1b'),_0x13dc02[_0xf570('0x1c')]?'g':'',_[_0xf570('0x10')](_0x13dc02['monitor_format'])?'':_0xf570('0x1d')),'XMD-DIALURL':_0x13dc02[_0xf570('0x1e')]||'','XMD-AGI':_0x13dc02[_0xf570('0x1f')]?util[_0xf570('0x11')]('\x22agi://%s/square,%s\x22',ipAgi,_0x13dc02[_0xf570('0x1f')]):_0xf570('0x20'),'XMD-AGIAFTER':_0x13dc02[_0xf570('0x1c')]?util[_0xf570('0x11')](_0xf570('0x21'),ipAgi,_0x13dc02['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x3cf1e8?_0x3cf1e8[_0xf570('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x3cf1e8?_0x3cf1e8[_0xf570('0x23')]:'','XMD-DESTINATION':_0xf570('0x24'),'SIPADDHEADER':_0xf570('0x25')};if(!_[_0xf570('0x10')](_0x13dc02[_0xf570('0x26')])){_0x275183[util[_0xf570('0x11')]('%s',_0xf570('0x27'))]=_0x13dc02[_0xf570('0x26')];_0x275183[util[_0xf570('0x11')]('%s',_0xf570('0x28'))]=_0x3e857a;}return _0x275183;};exports[_0xf570('0x29')]=function(_0x115786){var _0xdff8b7={};for(var _0x1da6fc in _0x115786){if(_0x115786[_0xf570('0x2a')](_0x1da6fc)){_0xdff8b7[util['format']('%s',_['toLower'](_0x1da6fc))]=_0x115786[_0x1da6fc];}}return{'variables':_0xdff8b7};};exports[_0xf570('0x2b')]=function(_0x4599b2,_0x546c24){if(!_[_0xf570('0x14')](_0x4599b2)){if(_0x4599b2[_0xf570('0x2a')](_0xf570('0x2c'))){if(_0x4599b2[_0xf570('0x2c')]>0x0){_0x4599b2[_0xf570('0x2c')]-=0x1;}else{logger[_0xf570('0x7')](_0xf570('0x2d'),_0x546c24);}}}else{logger[_0xf570('0x7')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x546c24);}};exports[_0xf570('0x2e')]=function(_0x4f46e0){var _0x2ab681=moment()[_0xf570('0x11')](_0xf570('0x2f'));_0x4f46e0[_0xf570('0x30')]=0xd;_0x4f46e0[_0xf570('0x31')]='Blacklist';_0x4f46e0[_0xf570('0x32')]=_0x2ab681;_0x4f46e0['responsetime']=_0x2ab681;_0x4f46e0[_0xf570('0x33')]=_0x2ab681;};exports[_0xf570('0x34')]=function(_0x472f3a,_0x2adfd0,_0x4e4e22){var _0x13b659=moment()['format'](_0xf570('0x2f'));_0x472f3a[_0xf570('0x30')]=_0x2adfd0;_0x472f3a[_0xf570('0x31')]=_0x4e4e22;_0x472f3a['responsetime']=_0x13b659;_0x472f3a[_0xf570('0x35')]=utils[_0xf570('0x36')](_0x472f3a[_0xf570('0x37')],_0x472f3a[_0xf570('0x32')]);};exports[_0xf570('0x38')]=function(_0x173cb6,_0x269c66,_0x27ae97){_0x173cb6[_0xf570('0x39')]=_0x269c66;_0x173cb6[_0xf570('0x3a')]=_0x27ae97;};exports['logCustomer']=function(_0x4f39ae,_0x473358,_0x3f2c8b){var _0x223041=moment()[_0xf570('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f39ae[_0xf570('0x30')]=_0x473358;_0x4f39ae[_0xf570('0x31')]=_0x3f2c8b;_0x4f39ae[_0xf570('0x37')]=_0x4f39ae[_0xf570('0x37')]?_0x4f39ae[_0xf570('0x37')]:_0x223041;_0x4f39ae[_0xf570('0x33')]=_0x4f39ae[_0xf570('0x33')]?_0x4f39ae['endtime']:_0x223041;_0x4f39ae[_0xf570('0x35')]=utils[_0xf570('0x36')](_0x4f39ae[_0xf570('0x37')]||0x0,_0x4f39ae[_0xf570('0x32')]||0x0);_0x4f39ae[_0xf570('0x3b')]=_0x4f39ae[_0xf570('0x3c')]?utils[_0xf570('0x36')](_0x4f39ae[_0xf570('0x33')],_0x4f39ae['answertime']):0x0;};exports[_0xf570('0x3d')]=function(_0x1c6ce7){return _0x1c6ce7==='Failure';};exports[_0xf570('0x3e')]=function(_0x2ee9f7,_0x564640,_0xa24024,_0x35b268,_0x44ba0c){var _0x5defb1=_0x35b268?_0xf570('0x3f'):_0x2ee9f7[_0xf570('0x18')];_0x5defb1=_0x44ba0c?_0xf570('0x40'):_0x5defb1;return{'actionid':_0x2ee9f7[_0xf570('0x41')],'action':'originate','channel':_0x2ee9f7['channelAgent'],'callerid':util['format'](_0xf570('0x12'),_0x5defb1,_0x2ee9f7[_0xf570('0x19')]),'Exten':_0xf570('0x24'),'Context':_0xf570('0x42'),'Priority':'1','variable':_0xa24024,'timeout':(_0x564640[_0xf570('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2ee9f7[_0xf570('0x41')]};};exports[_0xf570('0x44')]=function(_0x33574e){return _0x33574e[_0xf570('0x45')]+_0x33574e['countcongestionretry']+_0x33574e[_0xf570('0x46')]+_0x33574e['countagentrejectretry']+_0x33574e['countnosuchnumberretry'];};exports[_0xf570('0x47')]=function(_0x48ff37){var _0x2113d0=_[_0xf570('0x48')](_0x48ff37);_0x2113d0[_0xf570('0x30')]=0xf;_0x2113d0['statedesc']='Global';return _0x2113d0;};exports[_0xf570('0x49')]=function(_0x4a5cd9,_0x4553fc,_0x4c04b8){var _0x1847a1={};_0x1847a1[_0x4553fc]=_0x4a5cd9[_0x4553fc];_0x1847a1[_0xf570('0x4a')]=![];_0x1847a1[_0xf570('0x4b')]=moment()[_0xf570('0x4c')](_0x4c04b8,'minutes')[_0xf570('0x11')](_0xf570('0x2f'));_0x1847a1[_0xf570('0x4d')]=_0x4a5cd9['ContactId'];_0x1847a1[_0xf570('0x4e')]=_0x4a5cd9[_0xf570('0x4e')];_0x1847a1['VoiceQueueId']=_0x4a5cd9[_0xf570('0x1a')]||undefined;return _0x1847a1;};exports[_0xf570('0x4f')]=function(_0x4ea436,_0x5bb15b){if(!_['isNil'](_0x4ea436)){if(_0x4ea436[_0xf570('0x50')]>0x0){_0x4ea436[_0xf570('0x50')]-=0x1;}else{logger[_0xf570('0x7')](_0x5bb15b,_0xf570('0x51'));}}else{logger[_0xf570('0x7')](_0x5bb15b,_0xf570('0x52'));}};exports[_0xf570('0x53')]=function(_0x43ed0f){if(_0x43ed0f<=0x0){return!![];}return![];};function buildObj(_0x5d1009,_0x2fd858,_0x122cd7){_0x5d1009[_0xf570('0x54')]=_0x2fd858;_0x5d1009[_0xf570('0x17')]=_0x5d1009[_0xf570('0x55')];_0x5d1009[_0xf570('0x56')]=_0x5d1009['channelAgent'];_0x5d1009[_0xf570('0x57')]=_0xf570('0x58');if(_0x122cd7){_0x5d1009[_0xf570('0x59')]=_0x122cd7['mandatoryDisposition'];}return _0x5d1009;}exports[_0xf570('0x5a')]=buildObj;exports[_0xf570('0x5b')]=function(_0xee26ca){var _0x517702=[];for(var _0x1e4695 in _0xee26ca){if(_0xee26ca[_0xf570('0x2a')](_0x1e4695)){if(!_['isNil'](_0xee26ca[_0x1e4695])&&_0xee26ca[_0x1e4695][_0xf570('0x30')]===_0xf570('0x5c')&&_0xee26ca[_0x1e4695]['status']==='reachable'){_0x517702[_0xf570('0x5d')](_0xee26ca[_0x1e4695]['id']);}}}return _0x517702;};exports[_0xf570('0x5e')]=function(_0x526d29){var _0x524b27=moment()[_0xf570('0x5f')](0x0);var _0x2a619e=moment(_0x526d29)[_0xf570('0x5f')](0x0);return _0x524b27[_0xf570('0x60')](_0x2a619e,_0xf570('0x61'));};exports['createBody']=function(_0x4d55b3){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4d55b3['ContactId'],'ListId':_0x4d55b3['ListId'],'VoiceQueueId':_0x4d55b3[_0xf570('0x1a')]||undefined,'CampaignId':_0x4d55b3[_0xf570('0x62')]||undefined};};exports[_0xf570('0x63')]=function(_0x118988){if(_0x118988==='uniqueid'||_0x118988===_0xf570('0x64')||_0x118988===_0xf570('0x55')||_0x118988===_0xf570('0x65')||_0x118988===_0xf570('0x66')||_0x118988===_0xf570('0x67')||_0x118988==='membername'||_0x118988===_0xf570('0x68')||_0x118988===_0xf570('0x18')||_0x118988===_0xf570('0x4a')||_0x118988===_0xf570('0x19')||_0x118988==='scheduledat'||_0x118988===_0xf570('0x45')||_0x118988==='countcongestionretry'||_0x118988==='countnoanswerretry'||_0x118988===_0xf570('0x69')||_0x118988==='callback'||_0x118988===_0xf570('0x6a')||_0x118988===_0xf570('0x6b')||_0x118988==='recallme'||_0x118988===_0xf570('0x4d')||_0x118988===_0xf570('0x4e')||_0x118988==='UserId'||_0x118988===_0xf570('0x1a')||_0x118988==='sipcallid'||_0x118988===_0xf570('0x6c')||_0x118988===_0xf570('0x6d')||_0x118988==='xmd-phone'||_0x118988===_0xf570('0x6e')||_0x118988===_0xf570('0x6f')||_0x118988===_0xf570('0x70')||_0x118988===_0xf570('0x71')||_0x118988==='xmd-dialid'||_0x118988===_0xf570('0x72')||_0x118988===_0xf570('0x73')||_0x118988===_0xf570('0x74')||_0x118988===_0xf570('0x75')||_0x118988===_0xf570('0x76')||_0x118988==='xmd-agi'||_0x118988===_0xf570('0x77')||_0x118988===_0xf570('0x78')||_0x118988===_0xf570('0x79')||_0x118988===_0xf570('0x7a')||_0x118988==='rtpaudioqosloss'||_0x118988===_0xf570('0x7b')||_0x118988==='rtpaudioqosrtt'||_0x118988===_0xf570('0x7c')||_0x118988==='rtpaudioqos'||_0x118988===_0xf570('0x78')||_0x118988===_0xf570('0x79')||_0x118988===_0xf570('0x7a')||_0x118988===_0xf570('0x7d')||_0x118988==='rtpaudioqoslossbridged'||_0x118988==='rtpaudioqosrtt'||_0x118988==='rtpaudioqosrttbridged'||_0x118988===_0xf570('0x7e')||_0x118988==='bridgepvtcallid'||_0x118988===_0xf570('0x30')||_0x118988===_0xf570('0x31')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x33c904,_0x5261c0){var _0x528927,_0x6d5b82,_0x298751;if(_0x5261c0<=0x0){_0x5261c0=0x1;}_0x528927=new RegExp(_0xf570('0x7f')+_0x5261c0+'}$');_0x6d5b82=Math[_0xf570('0x80')](0xa,_0x5261c0-0x1);_0x298751=Math[_0xf570('0x80')](0xa,_0x5261c0)-0x1;return util[_0xf570('0x11')]('%s',_['replace'](_0x33c904,_0x528927,_[_0xf570('0x81')](_0x6d5b82,_0x298751)));};exports[_0xf570('0x82')]=function(_0x47a14c){var _0x21d023=_0x47a14c[_0xf570('0x83')](/"(.*?)"/);return _0x21d023?_0x21d023[0x1]:_0x47a14c;};exports[_0xf570('0x84')]=function(_0x25f7a9){var _0x23e15d=_0x25f7a9[_0xf570('0x83')](/<(.*?)>/);return _0x23e15d?_0x23e15d[0x1]:_0x25f7a9;};function buildNoAnswerEventPayload(_0xb2a035,_0x4e46b3){var _0x452de5=buildObj(_0xb2a035,_0xf570('0x85'));if(!_[_0xf570('0x10')](_0x4e46b3[_0xf570('0x86')])){Object[_0xf570('0x87')](_0x4e46b3[_0xf570('0x86')])[_0xf570('0x88')](function(_0x5b6b11){_0x452de5[_0x5b6b11[_0xf570('0x89')]()]=_0x4e46b3['variables'][_0x5b6b11];});}return _0x452de5;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index a47cb92..e477799 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 _0xf48b=['voicequeuechannelhangup','voicequeuechannelredirect','string','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel'];(function(_0x32f646,_0x4a2e8a){var _0x1554f1=function(_0x1a2a32){while(--_0x1a2a32){_0x32f646['push'](_0x32f646['shift']());}};_0x1554f1(++_0x4a2e8a);}(_0xf48b,0xb6));var _0xbf48=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf48b[_0x2c91e9];return _0x13f0ff;};'use strict';exports['queueadd']={'queue':{'type':_0xbf48('0x0'),'required':!![]},'interface':{'type':_0xbf48('0x0'),'required':!![]},'membername':{'type':_0xbf48('0x0'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xbf48('0x1'),'required':![]}};exports[_0xbf48('0x2')]={'queue':{'type':_0xbf48('0x0'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xbf48('0x3')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xbf48('0x1')},'reason':{'type':'string','required':![]}};exports[_0xbf48('0x4')]={'module':{'type':_0xbf48('0x0'),'required':![]}};exports[_0xbf48('0x5')]={'uniqueid':{'type':_0xbf48('0x0'),'required':!![]}};exports[_0xbf48('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xbf48('0x0')},'format':{'type':'string'},'mixmonitorid':{'type':_0xbf48('0x0')}};exports[_0xbf48('0x7')]={'uniqueid':{'type':_0xbf48('0x0'),'required':!![]}};exports[_0xbf48('0x8')]={'uniqueid':{'type':_0xbf48('0x0'),'required':!![]},'exten':{'type':_0xbf48('0x0'),'required':!![]},'context':{'type':_0xbf48('0x0')}}; \ No newline at end of file +var _0xf558=['string','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect'];(function(_0x127f73,_0xcdeb76){var _0x24c908=function(_0x492b24){while(--_0x492b24){_0x127f73['push'](_0x127f73['shift']());}};_0x24c908(++_0xcdeb76);}(_0xf558,0xe1));var _0x8f55=function(_0x105114,_0x213db9){_0x105114=_0x105114-0x0;var _0xea4357=_0xf558[_0x105114];return _0xea4357;};'use strict';exports['queueadd']={'queue':{'type':_0x8f55('0x0'),'required':!![]},'interface':{'type':_0x8f55('0x0'),'required':!![]},'membername':{'type':_0x8f55('0x0'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x8f55('0x1'),'required':![]}};exports[_0x8f55('0x2')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x8f55('0x0'),'required':!![]}};exports[_0x8f55('0x3')]={'interface':{'type':_0x8f55('0x0'),'required':!![]},'paused':{'type':_0x8f55('0x1')},'reason':{'type':_0x8f55('0x0'),'required':![]}};exports[_0x8f55('0x4')]={'module':{'type':_0x8f55('0x0'),'required':![]}};exports[_0x8f55('0x5')]={'uniqueid':{'type':_0x8f55('0x0'),'required':!![]}};exports[_0x8f55('0x6')]={'uniqueid':{'type':_0x8f55('0x0'),'required':!![]},'filename':{'type':_0x8f55('0x0')},'format':{'type':'string'},'mixmonitorid':{'type':_0x8f55('0x0')}};exports[_0x8f55('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x8f55('0x8')]={'uniqueid':{'type':_0x8f55('0x0'),'required':!![]},'exten':{'type':_0x8f55('0x0'),'required':!![]},'context':{'type':_0x8f55('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 4aaab6b..6df7395 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 _0x5f2f=['initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','name','isNil','interface','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','answered','unmanaged','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isUndefined','initTelephones','SIP/%s','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions'];(function(_0x56b466,_0x183434){var _0x1b3efb=function(_0x103996){while(--_0x103996){_0x56b466['push'](_0x56b466['shift']());}};_0x1b3efb(++_0x183434);}(_0x5f2f,0x73));var _0xf5f2=function(_0x22a137,_0x501be5){_0x22a137=_0x22a137-0x0;var _0x9dd30c=_0x5f2f[_0x22a137];return _0x9dd30c;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var Agent=require(_0xf5f2('0x3'));var Telephone=require(_0xf5f2('0x4'));var Trunk=require(_0xf5f2('0x5'));var VoiceQueue=require(_0xf5f2('0x6'));var Trigger=require(_0xf5f2('0x7'));var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0xf5f2('0x8'));var ZendeskAccount=require(_0xf5f2('0x9'));var SalesforceAccount=require(_0xf5f2('0xa'));var FreshdeskAccount=require(_0xf5f2('0xb'));var SugarcrmAccount=require(_0xf5f2('0xc'));var ZohoAccount=require(_0xf5f2('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xf5f2('0xe'));var ServicenowAccount=require(_0xf5f2('0xf'));var Dynamics365Account=require(_0xf5f2('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xf5f2('0x11'));function Realtime(){this[_0xf5f2('0x12')]={};this[_0xf5f2('0x13')]={};this['trunks']={};this[_0xf5f2('0x14')]={};this['triggers']={};this['campaigns']={};this[_0xf5f2('0x15')]={};this[_0xf5f2('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf5f2('0x17')]={};this[_0xf5f2('0x18')]={};this[_0xf5f2('0x19')]={};this[_0xf5f2('0x1a')]={};this[_0xf5f2('0x1b')]={};this[_0xf5f2('0x1c')]={};this['salesforceAccounts']={};this[_0xf5f2('0x1d')]={};this[_0xf5f2('0x1e')]={};this[_0xf5f2('0x1f')]={};this[_0xf5f2('0x20')]={};this[_0xf5f2('0x21')]={};this['servicenowAccounts']={};this[_0xf5f2('0x22')]={};this[_0xf5f2('0x23')]={};this[_0xf5f2('0x24')]={};}function freeIsNotKey(_0x1b6dd2,_0x23e23a,_0x3a9dbb){var _0xdb61b3=_[_0xf5f2('0x25')](_0x1b6dd2,function(_0x11f702){return _0x11f702[_0x3a9dbb];});for(var _0x228ace in _0x23e23a){if(_0x23e23a[_0xf5f2('0x26')](_0x228ace)){if(!_0xdb61b3[_0x228ace]){delete _0x23e23a[_0x228ace];}}}}function freeIsNotKeySip(_0x28e097,_0x4ff59b){var _0x3ee69=_[_0xf5f2('0x25')](_0x28e097,function(_0x626999){return util[_0xf5f2('0x27')]('SIP/%s',_0x626999[_0xf5f2('0x28')]);});for(var _0x47101e in _0x4ff59b){if(_0x4ff59b['hasOwnProperty'](_0x47101e)){if(!_0x3ee69[_0x47101e]){delete _0x4ff59b[_0x47101e];}}}}function freeIsNotKeyAgent(_0x47acfc,_0x2d2805){var _0x388e6c=_['mapKeys'](_0x47acfc,function(_0x45b74f){var _0x170042=_[_0xf5f2('0x29')](_0x45b74f[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x45b74f[_0xf5f2('0x28')]):_0x45b74f[_0xf5f2('0x2a')];return _0x170042;});for(var _0x4e8bda in _0x2d2805){if(_0x2d2805[_0xf5f2('0x26')](_0x4e8bda)){if(!_0x388e6c[_0x4e8bda]){delete _0x2d2805[_0x4e8bda];}}}}function clearVoiceCallReports(_0x287ad5){_0x287ad5['total']=0x0;_0x287ad5['answered']=0x0;_0x287ad5[_0xf5f2('0x2b')]=0x0;_0x287ad5[_0xf5f2('0x2c')]=0x0;_0x287ad5[_0xf5f2('0x2d')]=0x0;}function clearCampaigns(_0x1a5bb3){if(!_[_0xf5f2('0x2e')](_0x1a5bb3)){for(var _0x788a8d in _0x1a5bb3){if(_0x1a5bb3[_0xf5f2('0x26')](_0x788a8d)){_0x1a5bb3[_0x788a8d][_0xf5f2('0x2f')]=0x0;_0x1a5bb3[_0x788a8d][_0xf5f2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4ab014){if(!_[_0xf5f2('0x2e')](_0x4ab014)){for(var _0x102449 in _0x4ab014){if(_0x4ab014[_0xf5f2('0x26')](_0x102449)){_0x4ab014[_0x102449][_0xf5f2('0x31')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x32')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x33')]=0x0;_0x4ab014[_0x102449]['abandoned']=0x0;_0x4ab014[_0x102449]['sumHoldTime']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2c')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x2d')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundNoAnswerCallsDay']=0x0;_0x4ab014[_0x102449]['outboundBusyCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x35')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x36')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x37')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x38')]=0x0;_0x4ab014[_0x102449][_0xf5f2('0x39')]=0x0;_0x4ab014[_0x102449]['outboundBlacklistCallsDay']=0x0;_0x4ab014[_0x102449]['outboundOriginateFailureCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3a')]=0x0;_0x4ab014[_0x102449]['outboundReCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x34')]=0x0;_0x4ab014[_0x102449]['outboundAnswerCallsDay']=0x0;_0x4ab014[_0x102449][_0xf5f2('0x3b')]=!![];}}}}Realtime[_0xf5f2('0x3c')][_0xf5f2('0x3d')]=function(_0x428770,_0x256bd9){for(var _0x277eee in _0x256bd9){if(_0x428770[_0xf5f2('0x26')](_0x277eee)){_0x428770[_0x277eee]=_0x256bd9[_0x277eee];}}};Realtime[_0xf5f2('0x3c')]['initAgents']=function(){var _0x4149e6=this;return function(_0x43e4ff){if(_0x43e4ff){freeIsNotKeyAgent(_0x43e4ff,_0x4149e6[_0xf5f2('0x12')]);for(var _0x43c77d=0x0,_0x1408b9={};_0x43c77d<_0x43e4ff[_0xf5f2('0x3e')];_0x43c77d+=0x1){_0x1408b9=_0x43e4ff[_0x43c77d];var _0x297c0c=_['isNil'](_0x1408b9[_0xf5f2('0x2a')])?util[_0xf5f2('0x27')]('SIP/%s',_0x1408b9[_0xf5f2('0x28')]):_0x1408b9['interface'];if(_[_0xf5f2('0x3f')](_0x4149e6[_0xf5f2('0x12')][_0x297c0c])){_0x4149e6[_0xf5f2('0x12')][_0x297c0c]=new Agent(_0x1408b9);}else{_0x4149e6[_0xf5f2('0x3d')](_0x4149e6['agents'][_0x297c0c],_0x1408b9);}}}return _0x4149e6['agents'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x40')]=function(){var _0x20eb74=this;return function(_0x4ec8fb){if(_0x4ec8fb){freeIsNotKeySip(_0x4ec8fb,_0x20eb74[_0xf5f2('0x13')]);for(var _0x4f7f80=0x0,_0x9da533={};_0x4f7f80<_0x4ec8fb['length'];_0x4f7f80+=0x1){_0x9da533=_0x4ec8fb[_0x4f7f80];if(_[_0xf5f2('0x3f')](_0x20eb74[_0xf5f2('0x13')][util['format'](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])])){_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')]('SIP/%s',_0x9da533['name'])]=new Telephone(_0x9da533);}else{_0x20eb74[_0xf5f2('0x3d')](_0x20eb74[_0xf5f2('0x13')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x9da533[_0xf5f2('0x28')])],_0x9da533);}}}return _0x20eb74[_0xf5f2('0x13')];};};Realtime[_0xf5f2('0x3c')]['initTrunks']=function(){var _0x110fe5=this;return function(_0x3b4ea6){if(_0x3b4ea6){freeIsNotKeySip(_0x3b4ea6,_0x110fe5['trunks']);for(var _0xc6a1ae=0x0,_0x3f3895={};_0xc6a1ae<_0x3b4ea6[_0xf5f2('0x3e')];_0xc6a1ae+=0x1){_0x3f3895=_0x3b4ea6[_0xc6a1ae];if(_[_0xf5f2('0x3f')](_0x110fe5[_0xf5f2('0x42')][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])])){_0x110fe5['trunks'][util[_0xf5f2('0x27')](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])]=new Trunk(_0x3f3895);}else{_0x110fe5['mergeFromDatabase'](_0x110fe5['trunks'][util['format'](_0xf5f2('0x41'),_0x3f3895[_0xf5f2('0x28')])],_0x3f3895);}}}return _0x110fe5['trunks'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x43')]=function(){var _0x28e33f=this;return function(_0x31f86c){if(_0x31f86c){freeIsNotKey(_0x31f86c,_0x28e33f[_0xf5f2('0x44')],'id');for(var _0x2b3b1c=0x0,_0x1a6ec1={};_0x2b3b1c<_0x31f86c[_0xf5f2('0x3e')];_0x2b3b1c+=0x1){_0x1a6ec1=_0x31f86c[_0x2b3b1c];if(_[_0xf5f2('0x3f')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']])){_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']]=new Trigger(_0x1a6ec1);}else{_0x28e33f[_0xf5f2('0x3d')](_0x28e33f[_0xf5f2('0x44')][_0x1a6ec1['id']],_0x1a6ec1);}}}return _0x28e33f[_0xf5f2('0x44')];};};Realtime['prototype'][_0xf5f2('0x45')]=function(){var _0x578c93=this;return function(_0x3d62c1){if(_0x3d62c1){freeIsNotKey(_0x3d62c1,_0x578c93[_0xf5f2('0x15')],'id');for(var _0x218def=0x0,_0x36a4b0={};_0x218def<_0x3d62c1[_0xf5f2('0x3e')];_0x218def+=0x1){_0x36a4b0=_0x3d62c1[_0x218def];if(_[_0xf5f2('0x3f')](_0x578c93['templates'][_0x36a4b0['id']])){_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']]=new Template(_0x36a4b0);}else{_0x578c93[_0xf5f2('0x3d')](_0x578c93[_0xf5f2('0x15')][_0x36a4b0['id']],_0x36a4b0);}}}return _0x578c93[_0xf5f2('0x15')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x46')]=function(){var _0xf638ff=this;return function(_0x297f07){if(_0x297f07){freeIsNotKey(_0x297f07,_0xf638ff['zendeskAccounts'],'id');for(var _0x35dece=0x0,_0x33ec29={};_0x35dece<_0x297f07[_0xf5f2('0x3e')];_0x35dece+=0x1){_0x33ec29=_0x297f07[_0x35dece];if(_['isUndefined'](_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']])){_0xf638ff[_0xf5f2('0x1c')][_0x33ec29['id']]=new ZendeskAccount(_0x33ec29);}else{_0xf638ff[_0xf5f2('0x3d')](_0xf638ff['zendeskAccounts'][_0x33ec29['id']],_0x33ec29);}}}return _0xf638ff['zendeskAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x47')]=function(){var _0x5db519=this;return function(_0x14aa81){if(_0x14aa81){freeIsNotKey(_0x14aa81,_0x5db519['salesforceAccounts'],'id');for(var _0x740321=0x0,_0x497eb8={};_0x740321<_0x14aa81[_0xf5f2('0x3e')];_0x740321+=0x1){_0x497eb8=_0x14aa81[_0x740321];if(_['isUndefined'](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']])){_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']]=new SalesforceAccount(_0x497eb8);}else{_0x5db519[_0xf5f2('0x3d')](_0x5db519[_0xf5f2('0x48')][_0x497eb8['id']],_0x497eb8);}}}return _0x5db519['salesforceAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x49')]=function(){var _0x4f6b01=this;return function(_0x58213b){if(_0x58213b){freeIsNotKey(_0x58213b,_0x4f6b01[_0xf5f2('0x1e')],'id');for(var _0x3dc0c4=0x0,_0x57782c={};_0x3dc0c4<_0x58213b[_0xf5f2('0x3e')];_0x3dc0c4+=0x1){_0x57782c=_0x58213b[_0x3dc0c4];if(_[_0xf5f2('0x3f')](_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']])){_0x4f6b01[_0xf5f2('0x1e')][_0x57782c['id']]=new FreshdeskAccount(_0x57782c);}else{_0x4f6b01['mergeFromDatabase'](_0x4f6b01['freshdeskAccounts'][_0x57782c['id']],_0x57782c);}}}return _0x4f6b01[_0xf5f2('0x1e')];};};Realtime[_0xf5f2('0x3c')]['initZohoAccounts']=function(){var _0x40eef=this;return function(_0x43fc49){if(_0x43fc49){freeIsNotKey(_0x43fc49,_0x40eef[_0xf5f2('0x1f')],'id');for(var _0x14029e=0x0,_0x2b038e={};_0x14029e<_0x43fc49[_0xf5f2('0x3e')];_0x14029e+=0x1){_0x2b038e=_0x43fc49[_0x14029e];if(_[_0xf5f2('0x3f')](_0x40eef['zohoAccounts'][_0x2b038e['id']])){_0x40eef['zohoAccounts'][_0x2b038e['id']]=new ZohoAccount(_0x2b038e);}else{_0x40eef[_0xf5f2('0x3d')](_0x40eef[_0xf5f2('0x1f')][_0x2b038e['id']],_0x2b038e);}}}return _0x40eef[_0xf5f2('0x1f')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4a')]=function(){var _0x5a861d=this;return function(_0xdb1106){if(_0xdb1106){freeIsNotKey(_0xdb1106,_0x5a861d[_0xf5f2('0x20')],'id');for(var _0x18b124=0x0,_0x519c24={};_0x18b124<_0xdb1106[_0xf5f2('0x3e')];_0x18b124+=0x1){_0x519c24=_0xdb1106[_0x18b124];if(_['isUndefined'](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']])){_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']]=new DeskAccount(_0x519c24);}else{_0x5a861d[_0xf5f2('0x3d')](_0x5a861d[_0xf5f2('0x20')][_0x519c24['id']],_0x519c24);}}}return _0x5a861d['deskAccounts'];};};Realtime['prototype'][_0xf5f2('0x4b')]=function(){var _0x4de303=this;return function(_0xa39c65){if(_0xa39c65){freeIsNotKey(_0xa39c65,_0x4de303[_0xf5f2('0x1d')],'id');for(var _0x572ec1=0x0,_0x3f0579={};_0x572ec1<_0xa39c65[_0xf5f2('0x3e')];_0x572ec1+=0x1){_0x3f0579=_0xa39c65[_0x572ec1];if(_[_0xf5f2('0x3f')](_0x4de303['sugarcrmAccounts'][_0x3f0579['id']])){_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']]=new SugarcrmAccount(_0x3f0579);}else{_0x4de303[_0xf5f2('0x3d')](_0x4de303[_0xf5f2('0x1d')][_0x3f0579['id']],_0x3f0579);}}}return _0x4de303[_0xf5f2('0x1d')];};};Realtime['prototype'][_0xf5f2('0x4c')]=function(){var _0x506fe5=this;return function(_0x2cbe1e){if(_0x2cbe1e){freeIsNotKey(_0x2cbe1e,_0x506fe5[_0xf5f2('0x21')],'id');for(var _0x2e6f5d=0x0,_0x380c08={};_0x2e6f5d<_0x2cbe1e[_0xf5f2('0x3e')];_0x2e6f5d+=0x1){_0x380c08=_0x2cbe1e[_0x2e6f5d];if(_['isUndefined'](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']])){_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']]=new VtigerAccount(_0x380c08);}else{_0x506fe5[_0xf5f2('0x3d')](_0x506fe5[_0xf5f2('0x21')][_0x380c08['id']],_0x380c08);}}}return _0x506fe5[_0xf5f2('0x21')];};};Realtime['prototype'][_0xf5f2('0x4d')]=function(){var _0x5ee6bc=this;return function(_0x4c96ee){if(_0x4c96ee){freeIsNotKey(_0x4c96ee,_0x5ee6bc[_0xf5f2('0x4e')],'id');for(var _0x4802c5=0x0,_0x10f2b8={};_0x4802c5<_0x4c96ee[_0xf5f2('0x3e')];_0x4802c5+=0x1){_0x10f2b8=_0x4c96ee[_0x4802c5];if(_[_0xf5f2('0x3f')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']])){_0x5ee6bc['servicenowAccounts'][_0x10f2b8['id']]=new ServicenowAccount(_0x10f2b8);}else{_0x5ee6bc[_0xf5f2('0x3d')](_0x5ee6bc[_0xf5f2('0x4e')][_0x10f2b8['id']],_0x10f2b8);}}}return _0x5ee6bc[_0xf5f2('0x4e')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x4f')]=function(){var _0x35d868=this;return function(_0x158768){if(_0x158768){freeIsNotKey(_0x158768,_0x35d868['dynamics365Accounts'],'id');for(var _0x1f55af=0x0,_0x2d171d={};_0x1f55af<_0x158768[_0xf5f2('0x3e')];_0x1f55af+=0x1){_0x2d171d=_0x158768[_0x1f55af];if(_[_0xf5f2('0x3f')](_0x35d868['dynamics365Accounts'][_0x2d171d['id']])){_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']]=new Dynamics365Account(_0x2d171d);}else{_0x35d868['mergeFromDatabase'](_0x35d868[_0xf5f2('0x22')][_0x2d171d['id']],_0x2d171d);}}}return _0x35d868[_0xf5f2('0x22')];};};Realtime['prototype'][_0xf5f2('0x50')]=function(){var _0x975bd8=this;return function(_0xa0c139){if(_0xa0c139){freeIsNotKey(_0xa0c139,_0x975bd8[_0xf5f2('0x23')],'id');for(var _0x146462=0x0,_0x4bd113={};_0x146462<_0xa0c139[_0xf5f2('0x3e')];_0x146462+=0x1){_0x4bd113=_0xa0c139[_0x146462];if(_[_0xf5f2('0x3f')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']])){_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']]=new FreshsalesAccount(_0x4bd113);}else{_0x975bd8[_0xf5f2('0x3d')](_0x975bd8[_0xf5f2('0x23')][_0x4bd113['id']],_0x4bd113);}}}return _0x975bd8['freshsalesAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x51')]=function(){var _0x4800fe=this;return function(_0x3f677e){for(var _0x36503c=0x0;_0x36503c<_0x3f677e[_0xf5f2('0x3e')];_0x36503c+=0x1){_['merge'](_0x4800fe['voiceQueues'][_0x3f677e[_0x36503c]['name']],_0x3f677e[_0x36503c]);}return _0x4800fe[_0xf5f2('0x14')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x52')]=function(){var _0x450691=this;return function(_0x55da4d){clearVoiceQueues(_0x450691['voiceQueues']);if(_0x55da4d){_0x55da4d=_[_0xf5f2('0x53')](_0x55da4d,_0xf5f2('0x54'));for(var _0xc10cf3 in _0x55da4d){if(_0x55da4d[_0xf5f2('0x26')](_0xc10cf3)){for(var _0x794e0c=0x0;_0x794e0c<_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')];_0x794e0c+=0x1){var _0x11c302=_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x55')];if(_0x450691[_0xf5f2('0x14')][_0x11c302]){if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x56')]){_0x450691[_0xf5f2('0x14')][_0x11c302]['unmanaged']+=0x1;}if(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandon']){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x57')]+=0x1;}_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x58')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;if(_0x794e0c===_0x55da4d[_0xc10cf3][_0xf5f2('0x3e')]-0x1){_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')]||_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerabandonAt']||_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5c')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerjoinAt']),_0xf5f2('0x5a'))||0x0;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x31')]+=0x1;if(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5d')]){_0x450691['voiceQueues'][_0x11c302][_0xf5f2('0x32')]+=0x1;_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2d')]+=moment(_0x55da4d[_0xc10cf3][_0x794e0c][_0xf5f2('0x5b')])[_0xf5f2('0x59')](moment(_0x55da4d[_0xc10cf3][_0x794e0c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2c')]+=_0x450691[_0xf5f2('0x14')][_0x11c302][_0xf5f2('0x2b')]||0x0;}}}}}}return _0x450691['voiceQueues'];};};Realtime['prototype'][_0xf5f2('0x5e')]=function(){var _0x4f2fcc=this;return function(_0x4c4420){clearVoiceCallReports(_0x4f2fcc['outbound']);if(_0x4c4420){for(var _0x57cb18=0x0;_0x57cb18<_0x4c4420[_0xf5f2('0x3e')];_0x57cb18+=0x1){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x31')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2c')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')];if(_0x4c4420[_0x57cb18][_0xf5f2('0x60')]===_0xf5f2('0x61')){_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x32')]+=0x1;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2b')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x5f')]-_0x4c4420[_0x57cb18][_0xf5f2('0x62')]||0x0;_0x4f2fcc[_0xf5f2('0x16')][_0xf5f2('0x2d')]+=_0x4c4420[_0x57cb18][_0xf5f2('0x62')];}}}return _0x4f2fcc[_0xf5f2('0x16')];};};Realtime['prototype'][_0xf5f2('0x63')]=function(){var _0x35299d=this;return function(_0x21043b){if(_0x21043b){freeIsNotKey(_0x21043b,_0x35299d[_0xf5f2('0x64')],_0xf5f2('0x28'));for(var _0x308220=0x0,_0x16491c={};_0x308220<_0x21043b[_0xf5f2('0x3e')];_0x308220+=0x1){_0x16491c=_0x21043b[_0x308220];if(_['isUndefined'](_0x35299d[_0xf5f2('0x64')][_0x16491c['name']])){_0x35299d['campaigns'][_0x16491c['name']]=new Campaign(_0x16491c);}else{_0x35299d['mergeFromDatabase'](_0x35299d['campaigns'][_0x16491c['name']],_0x16491c);_0x35299d[_0xf5f2('0x64')][_0x16491c[_0xf5f2('0x28')]][_0xf5f2('0x65')]=_0x16491c[_0xf5f2('0x66')]?_0x16491c[_0xf5f2('0x66')][_0xf5f2('0x28')]:undefined;}}}return _0x35299d['campaigns'];};};Realtime['prototype'][_0xf5f2('0x67')]=function(){var _0x578a22=this;return function(_0x418ece){if(_0x418ece){freeIsNotKey(_0x418ece,_0x578a22[_0xf5f2('0x68')],'id');for(var _0x59161c=0x0,_0x4f3ad4={};_0x59161c<_0x418ece[_0xf5f2('0x3e')];_0x59161c+=0x1){_0x4f3ad4=_0x418ece[_0x59161c];if(_[_0xf5f2('0x3f')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']])){_0x578a22[_0xf5f2('0x68')][_0x4f3ad4['id']]=new VoiceExtension(_0x4f3ad4);}else{_0x578a22[_0xf5f2('0x3d')](_0x578a22['voiceExtensions'][_0x4f3ad4['id']],_0x4f3ad4);}}}return _0x578a22[_0xf5f2('0x68')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x69')]=function(){var _0x4c1678=this;return function(_0x33e9ad){clearCampaigns(_0x4c1678[_0xf5f2('0x64')]);for(var _0x14db86=0x0;_0x14db86<_0x33e9ad[_0xf5f2('0x3e')];_0x14db86+=0x1){_[_0xf5f2('0x6a')](_0x4c1678[_0xf5f2('0x64')][_0x33e9ad[_0x14db86][_0xf5f2('0x28')]],_0x33e9ad[_0x14db86]);}return _0x4c1678[_0xf5f2('0x64')];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6b')]=function(){var _0x191af3=this;return function(_0x2601aa){if(_0x2601aa){freeIsNotKey(_0x2601aa,_0x191af3[_0xf5f2('0x24')],'id');for(var _0x407dd8=0x0,_0xe900ea={};_0x407dd8<_0x2601aa[_0xf5f2('0x3e')];_0x407dd8+=0x1){_0xe900ea=_0x2601aa[_0x407dd8];if(_[_0xf5f2('0x3f')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']])){_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']]=new FaxAccount(_0xe900ea);}else{_0x191af3[_0xf5f2('0x3d')](_0x191af3[_0xf5f2('0x24')][_0xe900ea['id']],_0xe900ea);}}}return _0x191af3['faxAccounts'];};};Realtime[_0xf5f2('0x3c')][_0xf5f2('0x6c')]=function(){var _0x5d6c6e=this;return function(_0x2e49ce){if(_0x2e49ce){freeIsNotKey(_0x2e49ce,_0x5d6c6e[_0xf5f2('0x14')],'name');for(var _0xb56304=0x0,_0x2f54eb={};_0xb56304<_0x2e49ce[_0xf5f2('0x3e')];_0xb56304+=0x1){_0x2f54eb=_0x2e49ce[_0xb56304];if(_['isUndefined'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]])){_0x5d6c6e[_0xf5f2('0x14')][_0x2f54eb[_0xf5f2('0x28')]]=new VoiceQueue(_0x2f54eb);}else{_0x5d6c6e['mergeFromDatabase'](_0x5d6c6e['voiceQueues'][_0x2f54eb[_0xf5f2('0x28')]],_0x2f54eb);}}}return _0x5d6c6e[_0xf5f2('0x14')];};};module[_0xf5f2('0x6d')]=Realtime; \ No newline at end of file +var _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x540af5,_0x311efd){var _0x1d462a=function(_0x50b85f){while(--_0x50b85f){_0x540af5['push'](_0x540af5['shift']());}};_0x1d462a(++_0x311efd);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x5f66[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index dec78ae..029861c 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x23b0=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x23b0,0x10e));var _0x023b=function(_0x485473,_0x1930b7){_0x485473=_0x485473-0x0;var _0x331dff=_0x23b0[_0x485473];return _0x331dff;};'use strict';function mergeDBDataToRealtime(_0x4d84cd,_0x43c48f){var _0x45d3ca=Object[_0x023b('0x0')]({},_0x4d84cd);for(var _0x38c8ea in _0x43c48f){if(_0x45d3ca[_0x023b('0x1')](_0x38c8ea)){_0x45d3ca[_0x38c8ea]=_0x43c48f[_0x38c8ea];}}return _0x45d3ca;}exports[_0x023b('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xadd1=['mergeDBDataToRealtime'];(function(_0xc7ab24,_0x12c8af){var _0x19dcd9=function(_0x3c9432){while(--_0x3c9432){_0xc7ab24['push'](_0xc7ab24['shift']());}};_0x19dcd9(++_0x12c8af);}(_0xadd1,0xc4));var _0x1add=function(_0x3a3bcb,_0x37e5af){_0x3a3bcb=_0x3a3bcb-0x0;var _0x383775=_0xadd1[_0x3a3bcb];return _0x383775;};'use strict';function mergeDBDataToRealtime(_0x5f80cb,_0x2087b4){var _0x3e8dc8=Object['assign']({},_0x5f80cb);for(var _0xef4069 in _0x2087b4){if(_0x3e8dc8['hasOwnProperty'](_0xef4069)){_0x3e8dc8[_0xef4069]=_0x2087b4[_0xef4069];}}return _0x3e8dc8;}exports[_0x1add('0x0')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index ff6bf7f..33e4df5 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 _0x46da=['xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','prototype','find','accountcode','name','interface','findAgent','connectedlinenum','lastAssignedTo','isNil','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','format','create','match','getAgentByInternal','keys','getCallType','channel','split','outbound','internal','destination','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','transfereelinkedid','uniqueid','linkedid','UserId','membername','monitor','monitors','length','exten','connectedlinename','voiceAgentReport','isArray','voiceDialReport','startsWith','Local','substring','indexOf','mobile','phone','transfererlinkedid','exports','lodash','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones'];(function(_0x375d76,_0x44ecf3){var _0x1500a4=function(_0x568240){while(--_0x568240){_0x375d76['push'](_0x375d76['shift']());}};_0x1500a4(++_0x44ecf3);}(_0x46da,0x101));var _0xa46d=function(_0xce6529,_0x1dd9e4){_0xce6529=_0xce6529-0x0;var _0xea3241=_0x46da[_0xce6529];return _0xea3241;};'use strict';var _=require(_0xa46d('0x0'));var moment=require('moment');var util=require('util');var config=require(_0xa46d('0x1'));var ami=require(_0xa46d('0x2'));var RpcVoiceAgentReport=require(_0xa46d('0x3'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xa46d('0x4'));var RpcMemberReport=require(_0xa46d('0x5'));var RpcVoiceQueueReport=require(_0xa46d('0x6'));var RpcVoiceRecording=require(_0xa46d('0x7'));var RpcVoiceTransferReport=require(_0xa46d('0x8'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xa46d('0x9'));var VoiceAgentReport=require(_0xa46d('0xa'));var VoiceDialReport=require(_0xa46d('0xb'));var UserReport=require(_0xa46d('0xc'));function Report(_0x4cffa5){this[_0xa46d('0xd')]=_0x4cffa5;this[_0xa46d('0xe')]=_0x4cffa5[_0xa46d('0xe')];this[_0xa46d('0xf')]=_0x4cffa5[_0xa46d('0xf')];}Report['prototype']['sync']=function(_0x599bb5){var _0x50d263=new VoiceQueueReport(this[_0xa46d('0xd')]);var _0x48fac4=new VoiceAgentReport(this['realtime']);var _0x1caa72=new VoiceDialReport(this[_0xa46d('0xd')]);var _0x252290=new VoiceCallReport(this[_0xa46d('0xd')]);var _0x12f1ed=new UserReport(this[_0xa46d('0xd')]);if(config[_0xa46d('0x10')]&&config[_0xa46d('0x10')][_0xa46d('0x11')]){ami['on'](_0xa46d('0x12'),this[_0xa46d('0x13')][_0xa46d('0x14')](this));ami['on'](_0xa46d('0x15'),this[_0xa46d('0x16')][_0xa46d('0x14')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport'][_0xa46d('0x14')](this));ami['on'](_0xa46d('0x17'),this['voiceDialReport'][_0xa46d('0x14')](this));ami['on']('blindtransfer',this[_0xa46d('0x18')][_0xa46d('0x14')](this));ami['on'](_0xa46d('0x19'),this[_0xa46d('0x1a')][_0xa46d('0x14')](this));}};Report[_0xa46d('0x1b')]['findAgent']=function(_0x5340a9){var _0x1583d4;_0x1583d4=_[_0xa46d('0x1c')](this[_0xa46d('0xe')],function(_0x595884){return _0x595884['accountcode']==_0x5340a9||_0x595884['name']==_0x5340a9;});if(_['isNil'](_0x1583d4)){var _0x48b8f7=_[_0xa46d('0x1c')](this[_0xa46d('0xf')],function(_0x2d69bd){return _0x2d69bd[_0xa46d('0x1d')]==_0x5340a9||_0x2d69bd[_0xa46d('0x1e')]==_0x5340a9;});if(_0x48b8f7){_0x1583d4=_[_0xa46d('0x1c')](this['agents'],function(_0x390dd8){return _0x390dd8[_0xa46d('0x1f')]==util['format']('SIP/%s',_0x48b8f7[_0xa46d('0x1e')]);});}}return _0x1583d4;};Report['prototype']['voiceQueueReport']=function(_0x28147a){for(var _0x136cc8=0x0;_0x136cc8<_0x28147a['length'];_0x136cc8+=0x1){var _0x571fef=this[_0xa46d('0x20')](_0x28147a[_0x136cc8][_0xa46d('0x21')]);if(_0x571fef){_0x28147a[_0x136cc8][_0xa46d('0x1d')]=_0x571fef[_0xa46d('0x1d')];_0x28147a[_0x136cc8]['assigned']=!![];_0x28147a[_0x136cc8][_0xa46d('0x22')]=_0x571fef[_0xa46d('0x1e')];_0x28147a[_0x136cc8][_0xa46d('0x1f')]=_[_0xa46d('0x23')](_0x571fef[_0xa46d('0x1f')])?util['format'](_0xa46d('0x24'),_0x571fef['name']):_0x571fef[_0xa46d('0x1f')];if(_0x28147a[_0x136cc8][_0xa46d('0x25')]){_0x28147a[_0x136cc8][_0xa46d('0x26')]=moment()['format'](_0xa46d('0x27'));}if(_0x28147a[_0x136cc8][_0xa46d('0x28')]){_0x28147a[_0x136cc8]['queuecallerexitAt']=moment()[_0xa46d('0x29')](_0xa46d('0x27'));}RpcMemberReport[_0xa46d('0x13')](_0x28147a[_0x136cc8]);}RpcVoiceQueueReport[_0xa46d('0x2a')](_0x28147a[_0x136cc8]);}};function extractCalleridNumber(_0x4186d0){var _0x54c36c=_0x4186d0[_0xa46d('0x2b')](/<(.*?)>/);return _0x54c36c?_0x54c36c[0x1]:_0x4186d0;}Report[_0xa46d('0x1b')][_0xa46d('0x2c')]=function(_0xbd7356){for(var _0x39bbd3=0x0;_0x39bbd3','linkedid','transfers','transfereelinkedid','UserId','monitor','monitors','createdAt','calleridname','connectedlinename','membername','isArray','startsWith','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','realtime'];(function(_0x2a2794,_0x5540a8){var _0x5741ac=function(_0x5b581c){while(--_0x5b581c){_0x2a2794['push'](_0x2a2794['shift']());}};_0x5741ac(++_0x5540a8);}(_0x9ed4,0x162));var _0x49ed=function(_0x5c9cd1,_0x37ab0b){_0x5c9cd1=_0x5c9cd1-0x0;var _0x1b4d68=_0x9ed4[_0x5c9cd1];return _0x1b4d68;};'use strict';var _=require(_0x49ed('0x0'));var moment=require(_0x49ed('0x1'));var util=require(_0x49ed('0x2'));var config=require(_0x49ed('0x3'));var ami=require(_0x49ed('0x4'));var RpcVoiceAgentReport=require(_0x49ed('0x5'));var RpcVoiceCallReport=require(_0x49ed('0x6'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x49ed('0x7'));var RpcVoiceQueueReport=require(_0x49ed('0x8'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x49ed('0x9'));var VoiceQueueReport=require(_0x49ed('0xa'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x49ed('0xb'));var VoiceDialReport=require(_0x49ed('0xc'));var UserReport=require('./userReport');function Report(_0x27be57){this[_0x49ed('0xd')]=_0x27be57;this['agents']=_0x27be57[_0x49ed('0xe')];this[_0x49ed('0xf')]=_0x27be57['telephones'];}Report[_0x49ed('0x10')]['sync']=function(_0x4ac477){var _0x255c73=new VoiceQueueReport(this[_0x49ed('0xd')]);var _0x1494a8=new VoiceAgentReport(this['realtime']);var _0xa76ad=new VoiceDialReport(this[_0x49ed('0xd')]);var _0x142077=new VoiceCallReport(this[_0x49ed('0xd')]);var _0x32b80a=new UserReport(this[_0x49ed('0xd')]);if(config[_0x49ed('0x11')]&&config[_0x49ed('0x11')]['disabled']){ami['on']('custom:voiceQueueReport',this[_0x49ed('0x12')]['bind'](this));ami['on'](_0x49ed('0x13'),this['voiceCallReport'][_0x49ed('0x14')](this));ami['on'](_0x49ed('0x15'),this[_0x49ed('0x16')]['bind'](this));ami['on'](_0x49ed('0x17'),this[_0x49ed('0x18')]['bind'](this));ami['on'](_0x49ed('0x19'),this[_0x49ed('0x1a')]['bind'](this));ami['on'](_0x49ed('0x1b'),this[_0x49ed('0x1c')][_0x49ed('0x14')](this));}};Report[_0x49ed('0x10')][_0x49ed('0x1d')]=function(_0x5e2f97){var _0x8c18b8;_0x8c18b8=_[_0x49ed('0x1e')](this[_0x49ed('0xe')],function(_0x1d1f90){return _0x1d1f90[_0x49ed('0x1f')]==_0x5e2f97||_0x1d1f90[_0x49ed('0x20')]==_0x5e2f97;});if(_[_0x49ed('0x21')](_0x8c18b8)){var _0x51e87f=_[_0x49ed('0x1e')](this[_0x49ed('0xf')],function(_0x5e33d3){return _0x5e33d3['accountcode']==_0x5e2f97||_0x5e33d3[_0x49ed('0x20')]==_0x5e2f97;});if(_0x51e87f){_0x8c18b8=_[_0x49ed('0x1e')](this[_0x49ed('0xe')],function(_0x498e16){return _0x498e16[_0x49ed('0x22')]==util[_0x49ed('0x23')]('SIP/%s',_0x51e87f['name']);});}}return _0x8c18b8;};Report[_0x49ed('0x10')][_0x49ed('0x12')]=function(_0x381049){for(var _0xa0bf18=0x0;_0xa0bf18<_0x381049['length'];_0xa0bf18+=0x1){var _0x93d7c7=this[_0x49ed('0x1d')](_0x381049[_0xa0bf18][_0x49ed('0x24')]);if(_0x93d7c7){_0x381049[_0xa0bf18][_0x49ed('0x1f')]=_0x93d7c7['accountcode'];_0x381049[_0xa0bf18][_0x49ed('0x25')]=!![];_0x381049[_0xa0bf18][_0x49ed('0x26')]=_0x93d7c7[_0x49ed('0x20')];_0x381049[_0xa0bf18]['interface']=_[_0x49ed('0x21')](_0x93d7c7[_0x49ed('0x22')])?util[_0x49ed('0x23')](_0x49ed('0x27'),_0x93d7c7[_0x49ed('0x20')]):_0x93d7c7['interface'];if(_0x381049[_0xa0bf18][_0x49ed('0x28')]){_0x381049[_0xa0bf18][_0x49ed('0x29')]=moment()['format'](_0x49ed('0x2a'));}if(_0x381049[_0xa0bf18][_0x49ed('0x2b')]){_0x381049[_0xa0bf18][_0x49ed('0x2c')]=moment()[_0x49ed('0x23')](_0x49ed('0x2a'));}RpcMemberReport[_0x49ed('0x12')](_0x381049[_0xa0bf18]);}RpcVoiceQueueReport[_0x49ed('0x2d')](_0x381049[_0xa0bf18]);}};function extractCalleridNumber(_0xefadc6){var _0x49b97c=_0xefadc6[_0x49ed('0x2e')](/<(.*?)>/);return _0x49b97c?_0x49b97c[0x1]:_0xefadc6;}Report[_0x49ed('0x10')][_0x49ed('0x2f')]=function(_0xc78df7){for(var _0x5caa9d=0x0;_0x5caa9d{delete this[_0xb510('0x8')][_0x3360a0];},_0x369b19);}};module[_0xb510('0x9b')]=VoiceAgentReport; \ No newline at end of file +var _0x7ccc=['membername','destuniqueid','debug','uniqueid','inspect','interface','variables','format','mandatoryDisposition','type','inbound','assign','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','merge','queue','destconnectedlinenum','accountcode','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','YYYY-MM-DD\x20HH:mm:ss','rejected','reason','name','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','omit','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','[%s][voiceAgentReport][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','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','includes','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','custom:voiceAgentReport','deleteChannelAfterTimeout','[%s][voiceAgentReport][hangup]','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]','syncMusicOnHoldStart','channel','substring','lastIndexOf','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','ioredis','../../../config/logger','../ami','defaults','redis','localhost','socket.io-emitter','channels','voiceQueues','agents','bind','agentconnect','syncAgentConnect','agentringnoanswer','queuecallerabandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','emit','prototype','isUndefined','syncAgentCalled','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called'];(function(_0x54140d,_0x36bd06){var _0x9935df=function(_0x58deaa){while(--_0x58deaa){_0x54140d['push'](_0x54140d['shift']());}};_0x9935df(++_0x36bd06);}(_0x7ccc,0x1af));var _0xc7cc=function(_0x4e8299,_0x543e4d){_0x4e8299=_0x4e8299-0x0;var _0x522fcd=_0x7ccc[_0x4e8299];return _0x522fcd;};'use strict';var _=require(_0xc7cc('0x0'));var moment=require(_0xc7cc('0x1'));var util=require(_0xc7cc('0x2'));var Redis=require(_0xc7cc('0x3'));var config=require('../../../config/environment');var logger=require(_0xc7cc('0x4'))('ami');var ami=require(_0xc7cc('0x5'));config['redis']=_[_0xc7cc('0x6')](config[_0xc7cc('0x7')],{'host':_0xc7cc('0x8'),'port':0x18eb});var io=require(_0xc7cc('0x9'))(new Redis(config[_0xc7cc('0x7')]));function VoiceAgentReport(_0x33ed3e){this['channels']={};this['voiceChannels']=_0x33ed3e[_0xc7cc('0xa')];this[_0xc7cc('0xb')]=_0x33ed3e[_0xc7cc('0xb')];this[_0xc7cc('0xc')]=_0x33ed3e[_0xc7cc('0xc')];this['variables']={};ami['on']('agentcalled',this['syncAgentCalled'][_0xc7cc('0xd')](this));ami['on'](_0xc7cc('0xe'),this[_0xc7cc('0xf')][_0xc7cc('0xd')](this));ami['on'](_0xc7cc('0x10'),this['syncAgentRingNoAnswer'][_0xc7cc('0xd')](this));ami['on'](_0xc7cc('0x11'),this['syncQueueCallerAbandon'][_0xc7cc('0xd')](this));ami['on'](_0xc7cc('0x12'),this[_0xc7cc('0x13')][_0xc7cc('0xd')](this));ami['on'](_0xc7cc('0x14'),this[_0xc7cc('0x15')][_0xc7cc('0xd')](this));ami['on'](_0xc7cc('0x16'),this[_0xc7cc('0x17')][_0xc7cc('0xd')](this));ami['on'](_0xc7cc('0x18'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0xc7cc('0x19'),this[_0xc7cc('0x1a')][_0xc7cc('0xd')](this));ami['on'](_0xc7cc('0x1b'),this[_0xc7cc('0x1c')]['bind'](this));ami['on']('blindtransfer',this[_0xc7cc('0x1d')][_0xc7cc('0xd')](this));}VoiceAgentReport['prototype'][_0xc7cc('0x1e')]=function(_0x47a51a,_0xf404aa,_0x1bf3e8){io['to'](_0x47a51a)[_0xc7cc('0x1e')](_0xf404aa,_0x1bf3e8);};VoiceAgentReport[_0xc7cc('0x1f')]['isNotNull']=function(_0x58e813){return _0x58e813!==null&&!_[_0xc7cc('0x20')](_0x58e813);};VoiceAgentReport[_0xc7cc('0x1f')][_0xc7cc('0x21')]=function(_0x132aac){try{if(this[_0xc7cc('0x22')](_0x132aac)){logger[_0xc7cc('0x23')](_0xc7cc('0x24'),_0x132aac['uniqueid'],_0x132aac[_0xc7cc('0x25')],_0x132aac[_0xc7cc('0x26')]);logger[_0xc7cc('0x27')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x132aac[_0xc7cc('0x28')],util[_0xc7cc('0x29')](_0x132aac,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['channels'][_0x132aac[_0xc7cc('0x28')]])){this[_0xc7cc('0xa')][_0x132aac[_0xc7cc('0x28')]]={};}var _0x49ec0e=this[_0xc7cc('0xc')][_0x132aac[_0xc7cc('0x2a')]];var _0x41f7b5=this[_0xc7cc('0xa')][_0x132aac[_0xc7cc('0x28')]][_0x132aac[_0xc7cc('0x26')]];var _0x6fa8a3=this[_0xc7cc('0xb')][_0x132aac['queue']];var _0x104651=this[_0xc7cc('0x2b')][_0x132aac['uniqueid']];if(_[_0xc7cc('0x20')](_0x41f7b5)){_0x41f7b5={'agentcalledAt':moment()[_0xc7cc('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','mandatoryDisposition':_0x6fa8a3&&_0x6fa8a3[_0xc7cc('0x2d')]?_0x6fa8a3[_0xc7cc('0x2d')]:![],'type':_0x6fa8a3&&_0x6fa8a3[_0xc7cc('0x2e')]?_0x6fa8a3['type']:_0xc7cc('0x2f'),'variables':_0x104651,'motionChannel':'voice'};}Object[_0xc7cc('0x30')](_0x41f7b5,_['omit'](_0x132aac,[_0xc7cc('0x31'),_0xc7cc('0x32')]));this['channels'][_0x132aac[_0xc7cc('0x28')]][_0x132aac['destuniqueid']]=_0x41f7b5;logger[_0xc7cc('0x27')](_0xc7cc('0x33'),_0x132aac[_0xc7cc('0x28')],util['inspect'](_0x41f7b5,{'showHidden':![],'depth':null}));ami[_0xc7cc('0x1e')](_0xc7cc('0x34'),_0x41f7b5);var _0x368075={'id':_0x49ec0e['id'],'calleridnum':_0x41f7b5[_0xc7cc('0x35')],'queue':_0x41f7b5['queue'],'variables':_0x41f7b5[_0xc7cc('0x2b')],'uniqueid':_0x132aac[_0xc7cc('0x28')]};logger['debug'](_0xc7cc('0x36'),_0x132aac[_0xc7cc('0x28')],util['inspect'](_0x368075,{'showHidden':![],'depth':null}));this[_0xc7cc('0x1e')](util[_0xc7cc('0x2c')](_0xc7cc('0x37'),_0x132aac['membername']),_0xc7cc('0x38'),_0x368075);}}catch(_0x29aaf2){logger[_0xc7cc('0x39')](_0xc7cc('0x3a'),_0x132aac[_0xc7cc('0x28')],util[_0xc7cc('0x29')](_0x29aaf2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc7cc('0x1f')][_0xc7cc('0xf')]=function(_0x447868){try{if(this[_0xc7cc('0x22')](_0x447868)){if(this[_0xc7cc('0xa')][_0x447868[_0xc7cc('0x28')]]){for(var _0x40ac36 in this['channels'][_0x447868[_0xc7cc('0x28')]]){if(this[_0xc7cc('0xa')][_0x447868[_0xc7cc('0x28')]]['hasOwnProperty'](_0x40ac36)){if(_0x447868[_0xc7cc('0x26')]===_0x40ac36){logger[_0xc7cc('0x23')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x447868[_0xc7cc('0x28')],_0x447868[_0xc7cc('0x25')],_0x447868[_0xc7cc('0x26')]);this[_0xc7cc('0xa')][_0x447868[_0xc7cc('0x28')]][_0x40ac36][_0xc7cc('0x3b')]=moment()[_0xc7cc('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x447868[_0xc7cc('0x28')]][_0x40ac36][_0xc7cc('0x3c')]=_0x447868[_0xc7cc('0x3c')];this[_0xc7cc('0xa')][_0x447868[_0xc7cc('0x28')]][_0x40ac36][_0xc7cc('0x3d')]=_0x447868['connectedlinenum'];this[_0xc7cc('0xa')][_0x447868[_0xc7cc('0x28')]][_0x40ac36]['destchannelstate']=_0x447868[_0xc7cc('0x3e')];this[_0xc7cc('0xa')][_0x447868[_0xc7cc('0x28')]][_0x40ac36][_0xc7cc('0x3f')]=_0x447868[_0xc7cc('0x3f')];this['channels'][_0x447868[_0xc7cc('0x28')]][_0x40ac36]['holdtime']=_0x447868[_0xc7cc('0x40')];this[_0xc7cc('0xa')][_0x447868[_0xc7cc('0x28')]][_0x40ac36][_0xc7cc('0x41')]=_0xc7cc('0x42');_[_0xc7cc('0x43')](this[_0xc7cc('0xc')][_0x447868[_0xc7cc('0x2a')]],_['pick'](_0x447868,[_0xc7cc('0x44'),_0xc7cc('0x45')]));var _0x5e26c1=this['agents'][_0x447868['interface']];var _0xf7c9f9={'id':_0x5e26c1['id'],'name':_0x5e26c1['name'],'agentconnected':!![],'destaccountcode':_0x5e26c1[_0xc7cc('0x46')],'destconnectedlinenum':this[_0xc7cc('0xa')][_0x447868[_0xc7cc('0x28')]][_0x447868[_0xc7cc('0x26')]]['exten'],'queue':this[_0xc7cc('0xa')][_0x447868['uniqueid']][_0x447868[_0xc7cc('0x26')]][_0xc7cc('0x44')],'uniqueid':this[_0xc7cc('0xa')][_0x447868[_0xc7cc('0x28')]][_0x447868[_0xc7cc('0x26')]][_0xc7cc('0x28')]};ami[_0xc7cc('0x1e')](_0xc7cc('0x47'),this['channels'][_0x447868[_0xc7cc('0x28')]][_0x447868['destuniqueid']]);this[_0xc7cc('0x1e')](util[_0xc7cc('0x2c')]('user:%s',_0x447868[_0xc7cc('0x25')]),_0xc7cc('0x48'),_0xf7c9f9);}else if(!this['channels'][_0x447868[_0xc7cc('0x28')]][_0x40ac36][_0xc7cc('0x10')]&&!this['channels'][_0x447868[_0xc7cc('0x28')]][_0x40ac36]['agentcomplete']){logger[_0xc7cc('0x23')](_0xc7cc('0x49'),_0x447868[_0xc7cc('0x28')],this[_0xc7cc('0xa')][_0x447868[_0xc7cc('0x28')]][_0x40ac36][_0xc7cc('0x25')],_0x40ac36);this[_0xc7cc('0xa')][_0x447868[_0xc7cc('0x28')]][_0x40ac36][_0xc7cc('0x10')]=!![];this['channels'][_0x447868[_0xc7cc('0x28')]][_0x40ac36][_0xc7cc('0x4a')]=moment()[_0xc7cc('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xc7cc('0xa')][_0x447868[_0xc7cc('0x28')]][_0x40ac36][_0xc7cc('0x4b')]=_0x447868['destuniqueid'];this[_0xc7cc('0xa')][_0x447868['uniqueid']][_0x40ac36][_0xc7cc('0x4c')]=_0x447868[_0xc7cc('0x25')];this['channels'][_0x447868[_0xc7cc('0x28')]][_0x40ac36][_0xc7cc('0x41')]=_0xc7cc('0x4d');this[_0xc7cc('0xa')][_0x447868[_0xc7cc('0x28')]][_0x40ac36]['reason']=_0xc7cc('0x4d');logger['debug']('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x447868[_0xc7cc('0x28')],util[_0xc7cc('0x29')](this['channels'][_0x447868[_0xc7cc('0x28')]][_0x40ac36],{'showHidden':![],'depth':null}));ami[_0xc7cc('0x1e')](_0xc7cc('0x4e'),this[_0xc7cc('0xa')][_0x447868[_0xc7cc('0x28')]][_0x40ac36]);}else{logger[_0xc7cc('0x27')](_0xc7cc('0x4f'),_0x447868[_0xc7cc('0x28')]);}}}}}}catch(_0x29f194){logger['error']('[%s][voiceAgentReport][agentconnect]',_0x447868[_0xc7cc('0x28')],util[_0xc7cc('0x29')](_0x29f194,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc7cc('0x1f')][_0xc7cc('0x50')]=function(_0x49e2e4){try{if(this[_0xc7cc('0x22')](_0x49e2e4)){logger[_0xc7cc('0x27')](_0xc7cc('0x51'),_0x49e2e4[_0xc7cc('0x28')],util['inspect'](_0x49e2e4,{'showHidden':![],'depth':null}));if(this[_0xc7cc('0xa')][_0x49e2e4[_0xc7cc('0x28')]]&&this[_0xc7cc('0xa')][_0x49e2e4['uniqueid']][_0x49e2e4[_0xc7cc('0x26')]]){logger[_0xc7cc('0x23')](_0xc7cc('0x52'),_0x49e2e4[_0xc7cc('0x28')],_0x49e2e4[_0xc7cc('0x25')],_0x49e2e4[_0xc7cc('0x26')]);var _0x325c40=this['agents'][_0x49e2e4[_0xc7cc('0x2a')]];var _0x1d5947=this[_0xc7cc('0xa')][_0x49e2e4['uniqueid']][_0x49e2e4['destuniqueid']];_0x1d5947['agentringnoanswer']=!![];_0x1d5947[_0xc7cc('0x4a')]=moment()[_0xc7cc('0x2c')](_0xc7cc('0x53'));_0x1d5947['lastevent']=_0xc7cc('0x54');_0x1d5947[_0xc7cc('0x55')]=_0xc7cc('0x54');var _0x383b60={'id':_0x325c40['id'],'name':_0x325c40[_0xc7cc('0x56')],'queue':_0x1d5947['queue'],'uniqueid':_0x1d5947[_0xc7cc('0x28')]};logger[_0xc7cc('0x27')](_0xc7cc('0x57'),_0x49e2e4[_0xc7cc('0x28')],util[_0xc7cc('0x29')](_0x383b60,{'showHidden':![],'depth':null}));this[_0xc7cc('0x1e')](util[_0xc7cc('0x2c')](_0xc7cc('0x37'),_0x325c40[_0xc7cc('0x56')]),_0xc7cc('0x58'),_0x383b60);ami[_0xc7cc('0x1e')](_0xc7cc('0x59'),_0x1d5947);this[_0xc7cc('0xa')][_0x49e2e4[_0xc7cc('0x28')]][_0x49e2e4[_0xc7cc('0x26')]]=Object[_0xc7cc('0x30')]({},_0x1d5947);}}}catch(_0x130029){logger[_0xc7cc('0x39')](_0xc7cc('0x5a'),_0x49e2e4[_0xc7cc('0x28')],util['inspect'](_0x130029,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc7cc('0x1f')]['syncQueueCallerAbandon']=function(_0x50fc68){try{if(this[_0xc7cc('0x22')](_0x50fc68)){logger['debug']('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x50fc68['uniqueid'],util['inspect'](_0x50fc68,{'showHidden':![],'depth':null}));if(this[_0xc7cc('0xa')][_0x50fc68[_0xc7cc('0x28')]]){for(var _0x1bd88a in this[_0xc7cc('0xa')][_0x50fc68[_0xc7cc('0x28')]]){if(this[_0xc7cc('0xa')][_0x50fc68[_0xc7cc('0x28')]][_0xc7cc('0x5b')](_0x1bd88a)&&!this[_0xc7cc('0xa')][_0x50fc68[_0xc7cc('0x28')]][_0x1bd88a][_0xc7cc('0x10')]&&!this[_0xc7cc('0xa')][_0x50fc68[_0xc7cc('0x28')]][_0x1bd88a][_0xc7cc('0x12')]){logger[_0xc7cc('0x23')](_0xc7cc('0x5c'),_0x50fc68[_0xc7cc('0x28')],this[_0xc7cc('0xa')][_0x50fc68['uniqueid']][_0x1bd88a][_0xc7cc('0x25')],_0x1bd88a);this[_0xc7cc('0xa')][_0x50fc68['uniqueid']][_0x1bd88a][_0xc7cc('0x10')]=!![];this['channels'][_0x50fc68[_0xc7cc('0x28')]][_0x1bd88a][_0xc7cc('0x4a')]=moment()[_0xc7cc('0x2c')](_0xc7cc('0x53'));this[_0xc7cc('0xa')][_0x50fc68[_0xc7cc('0x28')]][_0x1bd88a][_0xc7cc('0x41')]=_0xc7cc('0x5d');this['channels'][_0x50fc68[_0xc7cc('0x28')]][_0x1bd88a][_0xc7cc('0x55')]=_0xc7cc('0x5d');logger[_0xc7cc('0x27')](_0xc7cc('0x5e'),_0x50fc68['uniqueid'],util['inspect'](this[_0xc7cc('0xa')][_0x50fc68['uniqueid']][_0x1bd88a],{'showHidden':![],'depth':null}));ami[_0xc7cc('0x1e')](_0xc7cc('0x5f'),this[_0xc7cc('0xa')][_0x50fc68['uniqueid']][_0x1bd88a]);}}}}}catch(_0x17acb4){logger[_0xc7cc('0x39')](_0xc7cc('0x60'),_0x50fc68[_0xc7cc('0x28')],util[_0xc7cc('0x29')](_0x17acb4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc7cc('0x1f')]['syncAgentComplete']=function(_0x4cff07){try{if(this[_0xc7cc('0x22')](_0x4cff07)){logger[_0xc7cc('0x27')](_0xc7cc('0x61'),_0x4cff07['uniqueid'],util['inspect'](_0x4cff07,{'showHidden':![],'depth':null}));if(this[_0xc7cc('0xa')][_0x4cff07['uniqueid']]){for(var _0x43e812 in this['channels'][_0x4cff07[_0xc7cc('0x28')]]){if(this[_0xc7cc('0xa')][_0x4cff07[_0xc7cc('0x28')]]['hasOwnProperty'](_0x43e812)){if(this[_0xc7cc('0xa')][_0x4cff07[_0xc7cc('0x28')]][_0x43e812][_0xc7cc('0x3b')]&&!this[_0xc7cc('0xa')][_0x4cff07[_0xc7cc('0x28')]][_0x43e812]['agentcomplete']){logger['info'](_0xc7cc('0x62'),_0x4cff07['uniqueid'],this[_0xc7cc('0xa')][_0x4cff07['uniqueid']][_0x43e812][_0xc7cc('0x25')],_0x43e812);this[_0xc7cc('0xa')][_0x4cff07['uniqueid']][_0x43e812][_0xc7cc('0x12')]=!![];this[_0xc7cc('0xa')][_0x4cff07[_0xc7cc('0x28')]][_0x43e812][_0xc7cc('0x63')]=moment()[_0xc7cc('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xc7cc('0xa')][_0x4cff07['uniqueid']][_0x43e812][_0xc7cc('0x41')]=_0xc7cc('0x64');this[_0xc7cc('0xa')][_0x4cff07[_0xc7cc('0x28')]][_0x43e812][_0xc7cc('0x55')]=_0x4cff07[_0xc7cc('0x55')]==_0xc7cc('0x65')?_0xc7cc('0x66'):_0x4cff07[_0xc7cc('0x55')];this[_0xc7cc('0xa')][_0x4cff07[_0xc7cc('0x28')]][_0x43e812][_0xc7cc('0x67')]=_0x4cff07[_0xc7cc('0x67')];if(this[_0xc7cc('0xb')][_0x4cff07['queue']]&&this[_0xc7cc('0xb')][_0x4cff07[_0xc7cc('0x44')]][_0xc7cc('0x68')]){this['channels'][_0x4cff07[_0xc7cc('0x28')]][_0x43e812]['acwtime']=this[_0xc7cc('0xb')][_0x4cff07['queue']]['acwTimeout'];this[_0xc7cc('0xa')][_0x4cff07['uniqueid']][_0x43e812]['agentacw']=!![];}this[_0xc7cc('0xc')][_0x4cff07[_0xc7cc('0x2a')]]=_[_0xc7cc('0x69')](this['agents'][_0x4cff07['interface']],['queue','destconnectedlinenum']);logger[_0xc7cc('0x27')](_0xc7cc('0x6a'),_0x4cff07[_0xc7cc('0x28')],util['inspect'](this['channels'][_0x4cff07['uniqueid']][_0x43e812],{'showHidden':![],'depth':null}));ami[_0xc7cc('0x1e')]('custom:agentcomplete',this[_0xc7cc('0xa')][_0x4cff07['uniqueid']][_0x43e812]);logger[_0xc7cc('0x27')](_0xc7cc('0x6b'),_0x4cff07['uniqueid'],util[_0xc7cc('0x29')]({'id':this[_0xc7cc('0xc')][_0x4cff07['interface']]['id'],'destaccountcode':_0x4cff07[_0xc7cc('0x6c')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xc7cc('0x2c')](_0xc7cc('0x37'),_0x4cff07[_0xc7cc('0x25')]),'user:agentcomplete',{'id':this[_0xc7cc('0xc')][_0x4cff07[_0xc7cc('0x2a')]]['id'],'destaccountcode':Number(_0x4cff07[_0xc7cc('0x6c')])});}}}}}}catch(_0x58106c){logger[_0xc7cc('0x39')](_0xc7cc('0x6d'),_0x4cff07[_0xc7cc('0x28')],util['inspect'](_0x58106c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc7cc('0x1f')]['syncVarSet']=function(_0x40d9c7){try{if(this[_0xc7cc('0x22')](_0x40d9c7)){logger[_0xc7cc('0x27')](_0xc7cc('0x6e'),_0x40d9c7[_0xc7cc('0x28')],util[_0xc7cc('0x29')](_0x40d9c7,{'showHidden':![],'depth':null}));this[_0xc7cc('0x6f')](_0x40d9c7[_0xc7cc('0x28')],_[_0xc7cc('0x70')](_0x40d9c7[_0xc7cc('0x71')])[0x0],_0x40d9c7[_0xc7cc('0x72')]);if(this[_0xc7cc('0xa')][_0x40d9c7[_0xc7cc('0x28')]]){for(var _0x1b1122 in this[_0xc7cc('0xa')][_0x40d9c7[_0xc7cc('0x28')]]){if(this['channels'][_0x40d9c7[_0xc7cc('0x28')]]['hasOwnProperty'](_0x1b1122)){logger[_0xc7cc('0x23')](_0xc7cc('0x73'),_0x40d9c7[_0xc7cc('0x28')],_0x1b1122,_['keys'](_0x40d9c7['variable'])[0x0],_0x40d9c7[_0xc7cc('0x72')]);if(_[_0xc7cc('0x20')](this[_0xc7cc('0xa')][_0x40d9c7[_0xc7cc('0x28')]][_0x1b1122][_0xc7cc('0x2b')])){this[_0xc7cc('0xa')][_0x40d9c7[_0xc7cc('0x28')]][_0x1b1122][_0xc7cc('0x2b')]={};}this[_0xc7cc('0xa')][_0x40d9c7[_0xc7cc('0x28')]][_0x1b1122][_0xc7cc('0x2b')]=this[_0xc7cc('0x2b')][_0x40d9c7[_0xc7cc('0x28')]];}}}}}catch(_0x160e32){logger['error'](_0xc7cc('0x74'),_0x40d9c7[_0xc7cc('0x28')],util['inspect'](_0x160e32,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc7cc('0x1f')][_0xc7cc('0x6f')]=function(_0x3244a1,_0x38ef3f,_0x29aff6){var _0x39b951=[_0xc7cc('0x75'),_0xc7cc('0x76'),_0xc7cc('0x77'),_0xc7cc('0x78'),'rtpaudioqosloss',_0xc7cc('0x79'),_0xc7cc('0x7a'),_0xc7cc('0x7b'),'sipcallid',_0xc7cc('0x7c'),_0xc7cc('0x7d'),_0xc7cc('0x7e'),_0xc7cc('0x7f'),_0xc7cc('0x80'),_0xc7cc('0x81'),_0xc7cc('0x82'),'membername','memberpenalty',_0xc7cc('0x83')];if(!_['isNil'](_0x38ef3f)&&!_[_0xc7cc('0x84')](_0x39b951,_0x38ef3f)){if(_['isUndefined'](this[_0xc7cc('0x2b')][_0x3244a1])){this[_0xc7cc('0x2b')][_0x3244a1]={};}this['variables'][_0x3244a1][_0x38ef3f]=_0x29aff6;}};VoiceAgentReport['prototype']['syncHangup']=function(_0x4548f8){try{if(this['isNotNull'](_0x4548f8)){logger[_0xc7cc('0x27')]('[%s][voiceAgentReport][hangup]\x20event:',_0x4548f8['uniqueid'],util['inspect'](_0x4548f8,{'showHidden':![],'depth':null}));if(this[_0xc7cc('0xa')][_0x4548f8[_0xc7cc('0x28')]]){for(var _0x51b02f in this[_0xc7cc('0xa')][_0x4548f8['uniqueid']]){if(this[_0xc7cc('0xa')][_0x4548f8[_0xc7cc('0x28')]]['hasOwnProperty'](_0x51b02f)){if(this[_0xc7cc('0xa')][_0x4548f8[_0xc7cc('0x28')]][_0x51b02f][_0xc7cc('0x55')]==_0xc7cc('0x65')&&this['channels'][_0x4548f8[_0xc7cc('0x28')]][_0x51b02f]['agentcomplete']){logger[_0xc7cc('0x23')](_0xc7cc('0x85'),_0x4548f8[_0xc7cc('0x28')],_0x51b02f);this[_0xc7cc('0xa')][_0x4548f8['uniqueid']][_0x51b02f][_0xc7cc('0x63')]=moment()[_0xc7cc('0x2c')](_0xc7cc('0x53'));}}}logger[_0xc7cc('0x27')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x4548f8[_0xc7cc('0x28')],util[_0xc7cc('0x29')](_['values'](this['channels'][_0x4548f8[_0xc7cc('0x28')]]),{'showHidden':![],'depth':null}));ami['emit'](_0xc7cc('0x86'),_['values'](this[_0xc7cc('0xa')][_0x4548f8['uniqueid']]));this[_0xc7cc('0x87')](_0x4548f8[_0xc7cc('0x28')]);}if(this[_0xc7cc('0x2b')][_0x4548f8[_0xc7cc('0x28')]]){delete this[_0xc7cc('0x2b')][_0x4548f8[_0xc7cc('0x28')]];}}}catch(_0x480cb3){logger[_0xc7cc('0x39')](_0xc7cc('0x88'),_0x4548f8['uniqueid'],util[_0xc7cc('0x29')](_0x480cb3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc7cc('0x1f')]['syncAttendedTransfer']=function(_0x764bd7){try{if(this['isNotNull'](_0x764bd7)){logger['debug']('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x764bd7['uniqueid'],util[_0xc7cc('0x29')](_0x764bd7,{'showHidden':![],'depth':null}));if(this[_0xc7cc('0xa')][_0x764bd7[_0xc7cc('0x89')]]){for(var _0x16c106 in this[_0xc7cc('0xa')][_0x764bd7[_0xc7cc('0x89')]]){if(this[_0xc7cc('0xa')][_0x764bd7[_0xc7cc('0x89')]][_0xc7cc('0x5b')](_0x16c106)){if(_0x764bd7[_0xc7cc('0x8a')]===_0x16c106){logger['info'](_0xc7cc('0x8b'),_0x764bd7['uniqueid'],this[_0xc7cc('0xa')][_0x764bd7[_0xc7cc('0x89')]][_0x16c106][_0xc7cc('0x25')],_0x16c106);var _0x340d15=moment();this[_0xc7cc('0xa')][_0x764bd7[_0xc7cc('0x89')]][_0x16c106][_0xc7cc('0x12')]=!![];this[_0xc7cc('0xa')][_0x764bd7[_0xc7cc('0x89')]][_0x16c106][_0xc7cc('0x63')]=moment()[_0xc7cc('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xc7cc('0xa')][_0x764bd7[_0xc7cc('0x89')]][_0x16c106][_0xc7cc('0x41')]=_0xc7cc('0x64');this[_0xc7cc('0xa')][_0x764bd7[_0xc7cc('0x89')]][_0x16c106][_0xc7cc('0x55')]='transfer';this[_0xc7cc('0xa')][_0x764bd7['transfereeuniqueid']][_0x16c106]['talktime']=_0x340d15[_0xc7cc('0x8c')](this[_0xc7cc('0xa')][_0x764bd7[_0xc7cc('0x89')]][_0x16c106][_0xc7cc('0x3b')],_0xc7cc('0x8d'));}}}}if(this[_0xc7cc('0xa')][_0x764bd7[_0xc7cc('0x8e')]]){var _0x12921e=this[_0xc7cc('0xa')][_0x764bd7[_0xc7cc('0x8e')]];this[_0xc7cc('0xa')][_0x764bd7[_0xc7cc('0x8e')]]=this[_0xc7cc('0xa')][_0x764bd7[_0xc7cc('0x89')]];this[_0xc7cc('0xa')][_0x764bd7[_0xc7cc('0x89')]]=_0x12921e;}}}catch(_0x42678d){logger['error'](_0xc7cc('0x8f'),_0x764bd7['uniqueid'],util[_0xc7cc('0x29')](_0x42678d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc7cc('0x1f')][_0xc7cc('0x1d')]=function(_0x148b68){try{if(this['isNotNull'](_0x148b68)){logger[_0xc7cc('0x27')](_0xc7cc('0x90'),_0x148b68[_0xc7cc('0x28')],util[_0xc7cc('0x29')](_0x148b68,{'showHidden':![],'depth':null}));if(this[_0xc7cc('0xa')][_0x148b68[_0xc7cc('0x89')]]){for(var _0x3f289a in this['channels'][_0x148b68[_0xc7cc('0x89')]]){if(this[_0xc7cc('0xa')][_0x148b68[_0xc7cc('0x89')]][_0xc7cc('0x5b')](_0x3f289a)){if(_0x148b68[_0xc7cc('0x91')]===_0x3f289a){logger['info']('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x148b68['uniqueid'],this['channels'][_0x148b68['transfereeuniqueid']][_0x3f289a][_0xc7cc('0x25')],_0x3f289a);var _0x50e313=moment();this[_0xc7cc('0xa')][_0x148b68['transfereeuniqueid']][_0x3f289a][_0xc7cc('0x12')]=!![];this[_0xc7cc('0xa')][_0x148b68[_0xc7cc('0x89')]][_0x3f289a][_0xc7cc('0x63')]=_0x50e313;this['channels'][_0x148b68[_0xc7cc('0x89')]][_0x3f289a][_0xc7cc('0x41')]=_0xc7cc('0x64');this[_0xc7cc('0xa')][_0x148b68[_0xc7cc('0x89')]][_0x3f289a][_0xc7cc('0x55')]=_0xc7cc('0x65');this[_0xc7cc('0xa')][_0x148b68[_0xc7cc('0x89')]][_0x3f289a][_0xc7cc('0x67')]=_0x50e313[_0xc7cc('0x8c')](this[_0xc7cc('0xa')][_0x148b68[_0xc7cc('0x89')]][_0x3f289a][_0xc7cc('0x3b')],_0xc7cc('0x8d'));}}}}}}catch(_0x57933d){logger['error'](_0xc7cc('0x92'),_0x148b68[_0xc7cc('0x28')],util['inspect'](_0x57933d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc7cc('0x1f')][_0xc7cc('0x93')]=function(_0x4980e8){var _0x81345c='';try{if(this[_0xc7cc('0x22')](_0x4980e8)){logger[_0xc7cc('0x27')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x4980e8[_0xc7cc('0x28')],util[_0xc7cc('0x29')](_0x4980e8,{'showHidden':![],'depth':null}));if(_0x4980e8[_0xc7cc('0x94')]){_0x81345c=_0x4980e8[_0xc7cc('0x94')][_0xc7cc('0x95')](0x0,_0x4980e8[_0xc7cc('0x94')][_0xc7cc('0x96')]('-'));if(this[_0xc7cc('0xc')][_0x81345c]){logger[_0xc7cc('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x4980e8[_0xc7cc('0x28')],_0x81345c);this[_0xc7cc('0xc')][_0x81345c][_0xc7cc('0x97')]=!![];}}}}catch(_0x32a520){logger[_0xc7cc('0x39')](_0xc7cc('0x98'),_0x4980e8[_0xc7cc('0x28')],util[_0xc7cc('0x29')](_0x32a520,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc7cc('0x1f')][_0xc7cc('0x1a')]=function(_0x1ee230){var _0x4e842a='';try{if(this[_0xc7cc('0x22')](_0x1ee230)){logger[_0xc7cc('0x27')](_0xc7cc('0x99'),_0x1ee230['uniqueid'],util[_0xc7cc('0x29')](_0x1ee230,{'showHidden':![],'depth':null}));if(_0x1ee230[_0xc7cc('0x94')]){_0x4e842a=_0x1ee230[_0xc7cc('0x94')]['substring'](0x0,_0x1ee230['channel'][_0xc7cc('0x96')]('-'));if(this['agents'][_0x4e842a]){logger[_0xc7cc('0x23')](_0xc7cc('0x9a'),_0x1ee230[_0xc7cc('0x28')],_0x4e842a);this[_0xc7cc('0xc')][_0x4e842a][_0xc7cc('0x97')]=![];}}}}catch(_0x44df26){logger[_0xc7cc('0x39')]('[%s][voiceAgentReport][musiconholdstop]',_0x1ee230[_0xc7cc('0x28')],util['inspect'](_0x44df26,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xc7cc('0x1f')][_0xc7cc('0x87')]=function(_0x211328,_0x4f0241=0x2710){if(this[_0xc7cc('0xa')][_0x211328]){setTimeout(()=>{delete this['channels'][_0x211328];},_0x4f0241);}};module[_0xc7cc('0x9b')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 036b46c..fbc08f5 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 _0xac87=['applicationdata','appdata','toLowerCase','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastdata','startsWith','cdr(','match','type','isNil','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','channelstate','answered','diff','destinationchannel','UserId','answertime','holdtime','connectedlinename','membername','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','replace','.WAV','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','calleridpreview','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','syncMixMonitorFilename','sipcalllinkedid','[%s][voiceCallReport][varset]','syncHangup','[%s][voiceCallReport][hangup]\x20event:','blindTransfers','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','length','transferType','resolve','isEmpty','getSettings','then','Action','StopMixMonitor','catch','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','transferToInternal','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]','exports','moment','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','set','queue','agi','dial','voicemail','FAILED','NO\x20ANSWER','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','varset','syncVarSet','hangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','inspect','merge','pick','keys','context','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','debug','[%s][voiceCallReport][newchannel]\x20event:','linkedid','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','disposition','toNumber','from-sip','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application'];(function(_0x4a1125,_0x26b222){var _0x17db49=function(_0x571e96){while(--_0x571e96){_0x4a1125['push'](_0x4a1125['shift']());}};_0x17db49(++_0x26b222);}(_0xac87,0x73));var _0x7ac8=function(_0x36c5d3,_0x176743){_0x36c5d3=_0x36c5d3-0x0;var _0xc9e680=_0xac87[_0x36c5d3];return _0xc9e680;};'use strict';var _=require('lodash');var moment=require(_0x7ac8('0x0'));var util=require('util');var path=require(_0x7ac8('0x1'));var Redis=require(_0x7ac8('0x2'));var config=require(_0x7ac8('0x3'));var logger=require(_0x7ac8('0x4'))(_0x7ac8('0x5'));var ami=require(_0x7ac8('0x6'));var Channel=require(_0x7ac8('0x7'));var RpcSetting=require(_0x7ac8('0x8'));var applications=[_0x7ac8('0x9'),_0x7ac8('0xa'),_0x7ac8('0xb'),_0x7ac8('0xc'),'playback',_0x7ac8('0xd')];var dispositions=['NO\x20ANSWER',_0x7ac8('0xe'),_0x7ac8('0xe'),'NO\x20ANSWER',_0x7ac8('0xf'),'NO\x20ANSWER','ANSWERED',_0x7ac8('0x10'),_0x7ac8('0xe'),_0x7ac8('0xe'),_0x7ac8('0xe')];config[_0x7ac8('0x11')]=_[_0x7ac8('0x12')](config[_0x7ac8('0x11')],{'host':_0x7ac8('0x13'),'port':0x18eb});var io=require(_0x7ac8('0x14'))(new Redis(config[_0x7ac8('0x11')]));function VoiceCallReport(_0x4cf952){this['channels']=_0x4cf952[_0x7ac8('0x15')];this[_0x7ac8('0x16')]=_0x4cf952['agents'];this['blindTransfers']={};ami['on'](_0x7ac8('0x17'),this[_0x7ac8('0x18')][_0x7ac8('0x19')](this));ami['on'](_0x7ac8('0x1a'),this[_0x7ac8('0x18')][_0x7ac8('0x19')](this));ami['on'](_0x7ac8('0x1b'),this[_0x7ac8('0x1c')][_0x7ac8('0x19')](this));ami['on'](_0x7ac8('0x1d'),this['syncNewState'][_0x7ac8('0x19')](this));ami['on'](_0x7ac8('0x1e'),this[_0x7ac8('0x1f')][_0x7ac8('0x19')](this));ami['on'](_0x7ac8('0x20'),this['syncHangup']['bind'](this));ami['on'](_0x7ac8('0x21'),this[_0x7ac8('0x22')]['bind'](this));ami['on'](_0x7ac8('0x23'),this[_0x7ac8('0x24')][_0x7ac8('0x19')](this));ami['on'](_0x7ac8('0x25'),this[_0x7ac8('0x26')][_0x7ac8('0x19')](this));ami['on'](_0x7ac8('0x27'),this[_0x7ac8('0x28')][_0x7ac8('0x19')](this));ami['on'](_0x7ac8('0x29'),this[_0x7ac8('0x2a')][_0x7ac8('0x19')](this));try{logger[_0x7ac8('0x2b')](_0x7ac8('0x2c'));ami['actionCoreShowChannels']();}catch(_0x4c15f6){logger[_0x7ac8('0x2d')](_0x7ac8('0x2e'),util['inspect'](_0x4c15f6,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x7ac8('0x2f')][_0x7ac8('0x30')]=function(_0x4e5adf){return _0x4e5adf!==null&&!_[_0x7ac8('0x31')](_0x4e5adf);};VoiceCallReport[_0x7ac8('0x2f')]['emit']=function(_0x1b1879,_0x512f22,_0x1d5fd5){io['to'](_0x1b1879)[_0x7ac8('0x32')](_0x512f22,_0x1d5fd5);};VoiceCallReport[_0x7ac8('0x2f')][_0x7ac8('0x22')]=function(_0x1555ea){try{if(this[_0x7ac8('0x30')](_0x1555ea)){logger['info'](_0x7ac8('0x33'),_0x1555ea[_0x7ac8('0x34')],_0x1555ea[_0x7ac8('0x35')],_0x1555ea[_0x7ac8('0x36')]);logger['debug']('[%s][voiceCallReport][newcallerid]\x20event:',_0x1555ea['uniqueid'],util[_0x7ac8('0x37')](_0x1555ea,{'showHidden':![],'depth':null}));if(_0x1555ea[_0x7ac8('0x34')]===_0x1555ea['linkedid']){if(!_[_0x7ac8('0x31')](this[_0x7ac8('0x15')][_0x1555ea[_0x7ac8('0x34')]])){_[_0x7ac8('0x38')](this[_0x7ac8('0x15')][_0x1555ea[_0x7ac8('0x34')]],_[_0x7ac8('0x39')](_0x1555ea,_[_0x7ac8('0x3a')](this['channels'][_0x1555ea[_0x7ac8('0x34')]])));}}if(_0x1555ea[_0x7ac8('0x3b')]==='from-sip'){var _0x14db18=this[_0x7ac8('0x16')][_0x1555ea[_0x7ac8('0x3c')][_0x7ac8('0x3d')]('-')[0x0]];if(_0x14db18){if(_0x1555ea[_0x7ac8('0x3e')]==_0x7ac8('0x3f')){_0x14db18[_0x7ac8('0x40')]=_0x1555ea[_0x7ac8('0x41')];this['emit'](util[_0x7ac8('0x42')](_0x7ac8('0x43'),_0x14db18[_0x7ac8('0x44')]),_0x7ac8('0x45'),{'id':_0x14db18['id'],'destaccountcode':_0x14db18[_0x7ac8('0x46')],'destconnectedlinenum':_0x1555ea['connectedlinenum']});}}}}}catch(_0x29cb91){logger[_0x7ac8('0x2d')](_0x7ac8('0x47'),_0x1555ea[_0x7ac8('0x34')],util['inspect'](_0x29cb91,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ac8('0x2f')][_0x7ac8('0x1c')]=function(_0x11178d){try{if(this[_0x7ac8('0x30')](_0x11178d)){logger[_0x7ac8('0x48')](_0x7ac8('0x49'),_0x11178d[_0x7ac8('0x34')],util[_0x7ac8('0x37')](_0x11178d,{'showHidden':![],'depth':null}));if(this[_0x7ac8('0x15')][_0x11178d[_0x7ac8('0x34')]]){return;}if(_0x11178d['channel']==='OutgoingSpoolFailed'){return;}if(_0x11178d[_0x7ac8('0x34')]!==_0x11178d[_0x7ac8('0x4a')]&&!this['blindTransfers'][_0x11178d[_0x7ac8('0x4a')]]){return;}logger[_0x7ac8('0x2b')](_0x7ac8('0x4b'),_0x11178d[_0x7ac8('0x34')],_0x11178d['context'],_0x11178d[_0x7ac8('0x3e')]);this[_0x7ac8('0x15')][_0x11178d[_0x7ac8('0x34')]]=new Channel();this[_0x7ac8('0x15')][_0x11178d[_0x7ac8('0x34')]][_0x7ac8('0x4c')]=moment()[_0x7ac8('0x42')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7ac8('0x15')][_0x11178d[_0x7ac8('0x34')]][_0x7ac8('0x4d')]=dispositions[_[_0x7ac8('0x4e')](_0x11178d['channelstate'])];_[_0x7ac8('0x38')](this[_0x7ac8('0x15')][_0x11178d['uniqueid']],_[_0x7ac8('0x39')](_0x11178d,_[_0x7ac8('0x3a')](this[_0x7ac8('0x15')][_0x11178d['uniqueid']])));if(_0x11178d[_0x7ac8('0x3b')]===_0x7ac8('0x4f')){var _0x14f60f=this[_0x7ac8('0x16')][_0x11178d[_0x7ac8('0x3c')]['split']('-')[0x0]];if(_0x14f60f&&typeof _0x14f60f['destconnectedlinenum']===_0x7ac8('0x50')){_0x14f60f[_0x7ac8('0x40')]=_0x11178d[_0x7ac8('0x3e')];logger[_0x7ac8('0x48')](_0x7ac8('0x51'),_0x11178d[_0x7ac8('0x34')],util[_0x7ac8('0x37')]({'id':_0x14f60f['id'],'destaccountcode':_0x14f60f[_0x7ac8('0x46')],'destconnectedlinenum':_0x11178d[_0x7ac8('0x3e')]},{'showHidden':![],'depth':null}));this['emit'](util['format']('user:%s',_0x14f60f['name']),_0x7ac8('0x45'),{'id':_0x14f60f['id'],'destaccountcode':_0x14f60f[_0x7ac8('0x46')],'destconnectedlinenum':_0x11178d[_0x7ac8('0x3e')]});}}}}catch(_0x332382){logger[_0x7ac8('0x2d')]('[%s][voiceCallReport][newchannel]',_0x11178d[_0x7ac8('0x34')],util[_0x7ac8('0x37')](_0x332382,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ac8('0x2f')][_0x7ac8('0x18')]=function(_0x54ecad){try{if(this[_0x7ac8('0x30')](_0x54ecad)){logger[_0x7ac8('0x48')](_0x7ac8('0x52'),_0x54ecad[_0x7ac8('0x34')],util['inspect'](_0x54ecad,{'showHidden':![],'depth':null}));if(_0x54ecad['channel']===_0x7ac8('0x53')||_0x54ecad[_0x7ac8('0x3e')]==='h')return;if(_0x54ecad['uniqueid']===_0x54ecad[_0x7ac8('0x4a')]||this['blindTransfers'][_0x54ecad[_0x7ac8('0x4a')]]){_0x54ecad['application']=_0x54ecad[_0x7ac8('0x54')]?_0x54ecad[_0x7ac8('0x54')]['toLowerCase']():undefined;_0x54ecad[_0x7ac8('0x55')]=_0x54ecad['appdata']||_0x54ecad['applicationdata'];if(_0x54ecad[_0x7ac8('0x56')]&&_0x54ecad[_0x7ac8('0x54')]!=='queue'){_0x54ecad[_0x7ac8('0x55')]=_0x54ecad[_0x7ac8('0x55')][_0x7ac8('0x57')]();}logger[_0x7ac8('0x2b')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x54ecad['uniqueid'],_0x54ecad[_0x7ac8('0x54')],_0x54ecad[_0x7ac8('0x55')]);if(_['isUndefined'](this[_0x7ac8('0x15')][_0x54ecad[_0x7ac8('0x34')]])){this[_0x7ac8('0x15')][_0x54ecad[_0x7ac8('0x34')]]=new Channel();this['channels'][_0x54ecad[_0x7ac8('0x34')]][_0x7ac8('0x4c')]=_0x54ecad[_0x7ac8('0x58')]?moment()['subtract'](moment[_0x7ac8('0x58')](_0x54ecad[_0x7ac8('0x58')])[_0x7ac8('0x59')](),_0x7ac8('0x59'))['format'](_0x7ac8('0x5a')):moment()[_0x7ac8('0x42')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7ac8('0x15')][_0x54ecad[_0x7ac8('0x34')]][_0x7ac8('0x4d')]=_0x7ac8('0xf');}_[_0x7ac8('0x38')](this[_0x7ac8('0x15')][_0x54ecad['uniqueid']],_[_0x7ac8('0x39')](_0x54ecad,_[_0x7ac8('0x3a')](this['channels'][_0x54ecad[_0x7ac8('0x34')]])));if(_[_0x7ac8('0x5b')](applications,_0x54ecad[_0x7ac8('0x54')])){this[_0x7ac8('0x15')][_0x54ecad[_0x7ac8('0x34')]]['lastapplication']=_0x54ecad[_0x7ac8('0x54')];this[_0x7ac8('0x15')][_0x54ecad['uniqueid']][_0x7ac8('0x5c')]=_0x54ecad[_0x7ac8('0x55')];if(_0x54ecad[_0x7ac8('0x54')]==='set'&&_[_0x7ac8('0x5d')](_0x54ecad['applicationdata'][_0x7ac8('0x57')](),_0x7ac8('0x5e'))){var _0x56ef70=_0x54ecad[_0x7ac8('0x55')]['split']('=');var _0x1520a3=_0x56ef70[0x0][_0x7ac8('0x57')]()[_0x7ac8('0x5f')](/cdr\((.*)\)/);if(_0x1520a3){if(_0x1520a3[0x1]===_0x7ac8('0x60')&&!_[_0x7ac8('0x61')](this[_0x7ac8('0x15')][_0x54ecad[_0x7ac8('0x34')]][_0x1520a3[0x1]]))return;this['channels'][_0x54ecad[_0x7ac8('0x34')]][_0x1520a3[0x1]]=_0x56ef70[0x1];}}else if(_0x54ecad['application']===_0x7ac8('0xa')){this[_0x7ac8('0x15')][_0x54ecad[_0x7ac8('0x34')]][_0x7ac8('0xa')]=_0x54ecad['applicationdata']['split'](',')[0x0];}}}}}catch(_0x381078){logger[_0x7ac8('0x2d')](_0x7ac8('0x62'),_0x54ecad[_0x7ac8('0x34')],util[_0x7ac8('0x37')](_0x381078,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x7ac8('0x63')]=function(_0x35506a){try{if(this['isNotNull'](_0x35506a)){logger[_0x7ac8('0x2b')](_0x7ac8('0x64'),_0x35506a[_0x7ac8('0x34')],_0x35506a[_0x7ac8('0x4a')],_0x35506a[_0x7ac8('0x35')],_0x35506a[_0x7ac8('0x36')]);logger[_0x7ac8('0x48')]('[%s][voiceCallReport][newstate]\x20event:',_0x35506a[_0x7ac8('0x34')],util[_0x7ac8('0x37')](_0x35506a,{'showHidden':![],'depth':null}));if(_0x35506a[_0x7ac8('0x65')]!=='6')return;var _0x342763=this[_0x7ac8('0x16')][_0x35506a[_0x7ac8('0x3c')][_0x7ac8('0x3d')]('-')[0x0]];if(_0x35506a[_0x7ac8('0x34')]!==_0x35506a[_0x7ac8('0x4a')]){var _0x246bdc=moment();if(this[_0x7ac8('0x15')][_0x35506a[_0x7ac8('0x4a')]]){if(!this[_0x7ac8('0x15')][_0x35506a[_0x7ac8('0x4a')]][_0x7ac8('0x66')]){this['channels'][_0x35506a['linkedid']][_0x7ac8('0x66')]=!![];this['channels'][_0x35506a[_0x7ac8('0x4a')]]['answertime']=_0x246bdc[_0x7ac8('0x42')](_0x7ac8('0x5a'));if(this[_0x7ac8('0x15')][_0x35506a[_0x7ac8('0x4a')]][_0x7ac8('0x4c')]){this['channels'][_0x35506a['linkedid']]['holdtime']=_0x246bdc[_0x7ac8('0x67')](this['channels'][_0x35506a[_0x7ac8('0x4a')]]['starttime'],'seconds');}}this[_0x7ac8('0x15')][_0x35506a[_0x7ac8('0x4a')]][_0x7ac8('0x4a')]=_0x35506a[_0x7ac8('0x34')];if(_0x35506a[_0x7ac8('0x36')]!=='xcally-motion-preview'){this[_0x7ac8('0x15')][_0x35506a[_0x7ac8('0x4a')]][_0x7ac8('0x41')]=_0x35506a[_0x7ac8('0x36')];}this[_0x7ac8('0x15')][_0x35506a[_0x7ac8('0x4a')]]['connectedlinename']=_0x35506a['calleridname'];this[_0x7ac8('0x15')][_0x35506a[_0x7ac8('0x4a')]][_0x7ac8('0x68')]=_0x35506a[_0x7ac8('0x3c')];this[_0x7ac8('0x15')][_0x35506a[_0x7ac8('0x4a')]][_0x7ac8('0x4d')]=dispositions[_[_0x7ac8('0x4e')](_0x35506a['channelstate'])];if(_0x342763){this[_0x7ac8('0x15')][_0x35506a[_0x7ac8('0x4a')]][_0x7ac8('0x69')]=_0x342763['id'];this[_0x7ac8('0x15')][_0x35506a[_0x7ac8('0x4a')]]['membername']=_0x342763[_0x7ac8('0x44')];}}if(this['channels'][_0x35506a[_0x7ac8('0x34')]]){if(!this[_0x7ac8('0x15')][_0x35506a[_0x7ac8('0x34')]][_0x7ac8('0x66')]){this[_0x7ac8('0x15')][_0x35506a[_0x7ac8('0x34')]]['answered']=!![];this[_0x7ac8('0x15')][_0x35506a[_0x7ac8('0x34')]][_0x7ac8('0x6a')]=_0x246bdc[_0x7ac8('0x42')](_0x7ac8('0x5a'));if(this['channels'][_0x35506a['uniqueid']][_0x7ac8('0x4c')]){this['channels'][_0x35506a[_0x7ac8('0x34')]][_0x7ac8('0x6b')]=_0x246bdc['diff'](this[_0x7ac8('0x15')][_0x35506a[_0x7ac8('0x34')]][_0x7ac8('0x4c')],_0x7ac8('0x59'));}}if(_0x35506a['calleridnum']!==_0x7ac8('0x3f')){this[_0x7ac8('0x15')][_0x35506a[_0x7ac8('0x34')]][_0x7ac8('0x41')]=_0x35506a[_0x7ac8('0x36')];}this[_0x7ac8('0x15')][_0x35506a[_0x7ac8('0x34')]][_0x7ac8('0x6c')]=_0x35506a[_0x7ac8('0x35')];this[_0x7ac8('0x15')][_0x35506a[_0x7ac8('0x34')]][_0x7ac8('0x68')]=_0x35506a['channel'];this[_0x7ac8('0x15')][_0x35506a[_0x7ac8('0x34')]][_0x7ac8('0x4d')]=dispositions[_['toNumber'](_0x35506a['channelstate'])];}}else{if(this[_0x7ac8('0x15')][_0x35506a[_0x7ac8('0x34')]]){if(_0x342763){this[_0x7ac8('0x15')][_0x35506a[_0x7ac8('0x34')]]['UserId']=_0x342763['id'];this['channels'][_0x35506a[_0x7ac8('0x34')]][_0x7ac8('0x6d')]=_0x342763[_0x7ac8('0x44')];}}}if(_0x35506a[_0x7ac8('0x3b')]===_0x7ac8('0x4f')){if(_0x342763){_0x342763[_0x7ac8('0x40')]=_0x35506a['exten'];var _0x51d2c9;if(this[_0x7ac8('0x15')][_0x35506a[_0x7ac8('0x34')]]){_0x51d2c9=this['channels'][_0x35506a['uniqueid']][_0x7ac8('0xa')];}else if(this[_0x7ac8('0x15')][_0x35506a[_0x7ac8('0x4a')]]){_0x51d2c9=this[_0x7ac8('0x15')][_0x35506a[_0x7ac8('0x4a')]]['queue'];}_0x342763[_0x7ac8('0xa')]=_0x51d2c9;var _0x6e2514={'id':_0x342763['id'],'name':_0x342763[_0x7ac8('0x44')],'agentconnected':!![],'destaccountcode':_0x342763['accountcode'],'destconnectedlinenum':_0x35506a[_0x7ac8('0x3e')],'queue':_0x51d2c9||undefined,'uniqueid':_0x35506a['linkedid']};logger[_0x7ac8('0x48')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x35506a[_0x7ac8('0x34')],util[_0x7ac8('0x37')](_0x6e2514,{'showHidden':![],'depth':null}));this[_0x7ac8('0x32')](util[_0x7ac8('0x42')](_0x7ac8('0x43'),_0x342763[_0x7ac8('0x44')]),_0x7ac8('0x45'),_0x6e2514);}}}}catch(_0x17d5c6){logger[_0x7ac8('0x2d')](_0x7ac8('0x6e'),_0x35506a['uniqueid'],util[_0x7ac8('0x37')](_0x17d5c6,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMixMonitorFilename']=function(_0x2bf0fc,_0x32f820){try{if(this['channels'][_0x2bf0fc]){logger['info'](_0x7ac8('0x6f'),_0x2bf0fc,_0x32f820);this[_0x7ac8('0x15')][_0x2bf0fc][_0x7ac8('0x70')]=!![];if(_['endsWith'](_0x32f820,_0x7ac8('0x71'))){_0x32f820=_0x32f820[_0x7ac8('0x72')](_0x7ac8('0x71'),_0x7ac8('0x73'));}this[_0x7ac8('0x15')][_0x2bf0fc][_0x7ac8('0x74')]=_0x32f820;var _0x31a510=_[_0x7ac8('0x75')](this[_0x7ac8('0x15')][_0x2bf0fc][_0x7ac8('0x76')],{'filename':_0x32f820});if(_[_0x7ac8('0x61')](_0x31a510)){this[_0x7ac8('0x15')][_0x2bf0fc][_0x7ac8('0x76')][_0x7ac8('0x77')]({'filename':_0x32f820,'createdAt':moment()[_0x7ac8('0x42')](_0x7ac8('0x5a')),'mixmonitorid':'','status':_0x7ac8('0x78')});}}}catch(_0x8efdca){logger[_0x7ac8('0x2d')](_0x7ac8('0x79'),_0x2bf0fc,util['inspect'](_0x8efdca,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x7ac8('0x1f')]=function(_0x4f8b67){try{if(this['isNotNull'](_0x4f8b67)){logger[_0x7ac8('0x48')](_0x7ac8('0x7a'),_0x4f8b67['uniqueid'],util[_0x7ac8('0x37')](_0x4f8b67,{'showHidden':![],'depth':null}));if(this[_0x7ac8('0x15')][_0x4f8b67['uniqueid']]&&_0x4f8b67[_0x7ac8('0x3c')]!=_0x7ac8('0x53')){if(this[_0x7ac8('0x30')](_0x4f8b67[_0x7ac8('0x7b')])){if(this[_0x7ac8('0x30')](_0x4f8b67[_0x7ac8('0x7b')][_0x7ac8('0x7c')])){logger[_0x7ac8('0x2b')](_0x7ac8('0x7d'),_0x4f8b67[_0x7ac8('0x34')],_0x4f8b67[_0x7ac8('0x7e')]);this['syncMixMonitorFilename'](_0x4f8b67['uniqueid'],_0x4f8b67[_0x7ac8('0x7e')]);}else if(this['isNotNull'](_0x4f8b67[_0x7ac8('0x7b')]['xmd-phone'])){logger[_0x7ac8('0x2b')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x4f8b67[_0x7ac8('0x34')],_0x4f8b67[_0x7ac8('0x7e')]);this[_0x7ac8('0x15')][_0x4f8b67[_0x7ac8('0x34')]][_0x7ac8('0x36')]=_0x4f8b67[_0x7ac8('0x7e')];}else if(this[_0x7ac8('0x30')](_0x4f8b67[_0x7ac8('0x7b')][_0x7ac8('0x7f')])){logger[_0x7ac8('0x2b')](_0x7ac8('0x80'),_0x4f8b67[_0x7ac8('0x34')],_0x4f8b67['value']);this['channels'][_0x4f8b67[_0x7ac8('0x34')]][_0x7ac8('0x81')]=_0x4f8b67[_0x7ac8('0x7e')];}else if(this[_0x7ac8('0x30')](_0x4f8b67['variable'][_0x7ac8('0x82')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x4f8b67['uniqueid'],_0x4f8b67[_0x7ac8('0x7e')]);this['channels'][_0x4f8b67[_0x7ac8('0x34')]]['type']=_0x4f8b67[_0x7ac8('0x7e')];}else if(this[_0x7ac8('0x30')](_0x4f8b67['variable'][_0x7ac8('0x83')])){logger[_0x7ac8('0x2b')](_0x7ac8('0x84'),_0x4f8b67['uniqueid'],_0x4f8b67['value'][_0x7ac8('0x3d')](',')[0x0]);this[_0x7ac8('0x15')][_0x4f8b67[_0x7ac8('0x34')]][_0x7ac8('0xa')]=_0x4f8b67[_0x7ac8('0x7e')]['split'](',')[0x0];}else if(this[_0x7ac8('0x30')](_0x4f8b67[_0x7ac8('0x7b')]['xmd-originatecalleridnum'])){logger[_0x7ac8('0x2b')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x4f8b67[_0x7ac8('0x34')],_0x4f8b67[_0x7ac8('0x7e')]);this[_0x7ac8('0x15')][_0x4f8b67[_0x7ac8('0x34')]][_0x7ac8('0x85')]=_0x4f8b67[_0x7ac8('0x7e')];}else if(this[_0x7ac8('0x30')](_0x4f8b67[_0x7ac8('0x7b')][_0x7ac8('0x86')])){logger[_0x7ac8('0x2b')](_0x7ac8('0x87'),_0x4f8b67[_0x7ac8('0x34')],_0x4f8b67[_0x7ac8('0x7e')]);this[_0x7ac8('0x15')][_0x4f8b67[_0x7ac8('0x34')]][_0x7ac8('0x88')]=_0x4f8b67[_0x7ac8('0x7e')];}else if(this[_0x7ac8('0x30')](_0x4f8b67[_0x7ac8('0x7b')][_0x7ac8('0x89')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x4f8b67[_0x7ac8('0x34')],_0x4f8b67['value']);this[_0x7ac8('0x15')][_0x4f8b67[_0x7ac8('0x34')]][_0x7ac8('0x8a')]=_0x4f8b67['value'];}else if(this[_0x7ac8('0x30')](_0x4f8b67[_0x7ac8('0x7b')]['xmcs-queue'])){logger[_0x7ac8('0x2b')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x4f8b67[_0x7ac8('0x34')],_0x4f8b67[_0x7ac8('0x7e')]);this[_0x7ac8('0x15')][_0x4f8b67[_0x7ac8('0x34')]][_0x7ac8('0xa')]=_0x4f8b67[_0x7ac8('0x7e')];}else if(this[_0x7ac8('0x30')](_0x4f8b67[_0x7ac8('0x7b')][_0x7ac8('0x8b')])){logger[_0x7ac8('0x2b')](_0x7ac8('0x8c'),_0x4f8b67[_0x7ac8('0x34')],_0x4f8b67[_0x7ac8('0x7e')]);this[_0x7ac8('0x15')][_0x4f8b67[_0x7ac8('0x34')]][_0x7ac8('0x8d')]=_0x4f8b67[_0x7ac8('0x7e')];}}}else if(this[_0x7ac8('0x30')](_0x4f8b67[_0x7ac8('0x7b')][_0x7ac8('0x7c')])){if(_0x4f8b67['value']){var _0x3a20f2=path['parse'](_0x4f8b67[_0x7ac8('0x7e')])[_0x7ac8('0x44')];logger[_0x7ac8('0x2b')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x3a20f2,_0x4f8b67[_0x7ac8('0x7e')]);this[_0x7ac8('0x8e')](_0x3a20f2,_0x4f8b67['value']);}}else if(this['channels'][_0x4f8b67['linkedid']]){if(this[_0x7ac8('0x30')](_0x4f8b67['variable'])){if(this[_0x7ac8('0x30')](_0x4f8b67[_0x7ac8('0x7b')][_0x7ac8('0x8b')])){logger[_0x7ac8('0x2b')](_0x7ac8('0x8c'),_0x4f8b67['linkedid'],_0x4f8b67[_0x7ac8('0x7e')]);this[_0x7ac8('0x15')][_0x4f8b67[_0x7ac8('0x4a')]][_0x7ac8('0x8f')]=_0x4f8b67[_0x7ac8('0x7e')];}}}}}catch(_0x43a6a6){logger[_0x7ac8('0x2d')](_0x7ac8('0x90'),_0x4f8b67['uniqueid'],util[_0x7ac8('0x37')](_0x43a6a6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ac8('0x2f')][_0x7ac8('0x91')]=function(_0x177735){try{if(this[_0x7ac8('0x30')](_0x177735)){logger['debug'](_0x7ac8('0x92'),_0x177735[_0x7ac8('0x34')],util[_0x7ac8('0x37')](_0x177735,{'showHidden':![],'depth':null}));if(this[_0x7ac8('0x93')][_0x177735[_0x7ac8('0x4a')]]){if(this[_0x7ac8('0x15')][this[_0x7ac8('0x93')][_0x177735[_0x7ac8('0x4a')]][_0x7ac8('0x4a')]]){this[_0x7ac8('0x15')][this['blindTransfers'][_0x177735['linkedid']][_0x7ac8('0x4a')]][_0x7ac8('0x34')]=_0x177735[_0x7ac8('0x34')];this[_0x7ac8('0x15')][this[_0x7ac8('0x93')][_0x177735[_0x7ac8('0x4a')]]['linkedid']][_0x7ac8('0x66')]=this[_0x7ac8('0x15')][_0x177735[_0x7ac8('0x34')]]['answered'];this[_0x7ac8('0x15')][this[_0x7ac8('0x93')][_0x177735[_0x7ac8('0x4a')]]['linkedid']][_0x7ac8('0x6a')]=this[_0x7ac8('0x15')][_0x177735[_0x7ac8('0x34')]][_0x7ac8('0x6a')];this[_0x7ac8('0x15')][this[_0x7ac8('0x93')][_0x177735[_0x7ac8('0x4a')]][_0x7ac8('0x4a')]][_0x7ac8('0x68')]=this[_0x7ac8('0x15')][this[_0x7ac8('0x93')][_0x177735['linkedid']][_0x7ac8('0x4a')]]['channel'];this[_0x7ac8('0x15')][this[_0x7ac8('0x93')][_0x177735['linkedid']][_0x7ac8('0x4a')]][_0x7ac8('0x4d')]=this[_0x7ac8('0x15')][_0x177735[_0x7ac8('0x34')]][_0x7ac8('0x4d')];this[_0x7ac8('0x15')][_0x177735[_0x7ac8('0x34')]]=this['channels'][this[_0x7ac8('0x93')][_0x177735['linkedid']]['linkedid']];this[_0x7ac8('0x94')](this[_0x7ac8('0x93')][_0x177735[_0x7ac8('0x4a')]][_0x7ac8('0x4a')]);}else if(this[_0x7ac8('0x15')][this[_0x7ac8('0x93')][_0x177735[_0x7ac8('0x4a')]][_0x7ac8('0x34')]]){this[_0x7ac8('0x15')][this[_0x7ac8('0x93')][_0x177735[_0x7ac8('0x4a')]][_0x7ac8('0x34')]][_0x7ac8('0x34')]=[this[_0x7ac8('0x15')][this[_0x7ac8('0x93')][_0x177735[_0x7ac8('0x4a')]][_0x7ac8('0x34')]][_0x7ac8('0x4a')],this[_0x7ac8('0x15')][this['blindTransfers'][_0x177735['linkedid']][_0x7ac8('0x34')]][_0x7ac8('0x4a')]=this['channels'][this[_0x7ac8('0x93')][_0x177735[_0x7ac8('0x4a')]][_0x7ac8('0x34')]][_0x7ac8('0x34')]][0x0];this[_0x7ac8('0x15')][this[_0x7ac8('0x93')][_0x177735[_0x7ac8('0x4a')]][_0x7ac8('0x34')]][_0x7ac8('0x66')]=this[_0x7ac8('0x15')][_0x177735[_0x7ac8('0x34')]][_0x7ac8('0x66')];this[_0x7ac8('0x15')][this['blindTransfers'][_0x177735[_0x7ac8('0x4a')]][_0x7ac8('0x34')]][_0x7ac8('0x6a')]=this['channels'][_0x177735[_0x7ac8('0x34')]][_0x7ac8('0x6a')];this[_0x7ac8('0x15')][this[_0x7ac8('0x93')][_0x177735[_0x7ac8('0x4a')]][_0x7ac8('0x34')]][_0x7ac8('0x68')]=this['channels'][this[_0x7ac8('0x93')][_0x177735['linkedid']][_0x7ac8('0x34')]][_0x7ac8('0x3c')];this['channels'][this['blindTransfers'][_0x177735[_0x7ac8('0x4a')]][_0x7ac8('0x34')]][_0x7ac8('0x4d')]=this[_0x7ac8('0x15')][_0x177735[_0x7ac8('0x34')]][_0x7ac8('0x4d')];this[_0x7ac8('0x15')][_0x177735[_0x7ac8('0x34')]]=this[_0x7ac8('0x15')][this[_0x7ac8('0x93')][_0x177735[_0x7ac8('0x4a')]][_0x7ac8('0x34')]];this['deleteChannelAfterTimeout'](this[_0x7ac8('0x93')][_0x177735[_0x7ac8('0x4a')]][_0x7ac8('0x34')]);}}if(this['channels'][_0x177735[_0x7ac8('0x34')]]){logger['info'](_0x7ac8('0x95'),_0x177735[_0x7ac8('0x34')],_0x177735[_0x7ac8('0x96')]);var _0x19c8d5=moment();this[_0x7ac8('0x15')][_0x177735[_0x7ac8('0x34')]][_0x7ac8('0x97')]=_0x19c8d5['format'](_0x7ac8('0x5a'));this[_0x7ac8('0x15')][_0x177735[_0x7ac8('0x34')]]['duration']=_0x19c8d5['diff'](this[_0x7ac8('0x15')][_0x177735['uniqueid']][_0x7ac8('0x4c')],_0x7ac8('0x59'));if(this[_0x7ac8('0x15')][_0x177735[_0x7ac8('0x34')]][_0x7ac8('0x66')]){this[_0x7ac8('0x15')][_0x177735[_0x7ac8('0x34')]][_0x7ac8('0x98')]=_0x19c8d5[_0x7ac8('0x67')](this[_0x7ac8('0x15')][_0x177735['uniqueid']][_0x7ac8('0x6a')],_0x7ac8('0x59'));this[_0x7ac8('0x15')][_0x177735[_0x7ac8('0x34')]][_0x7ac8('0x6b')]=this[_0x7ac8('0x15')][_0x177735[_0x7ac8('0x34')]][_0x7ac8('0x58')]-this[_0x7ac8('0x15')][_0x177735[_0x7ac8('0x34')]][_0x7ac8('0x98')];}if(_0x177735[_0x7ac8('0x3b')]==='from-sip'){if(this[_0x7ac8('0x16')][_0x177735[_0x7ac8('0x3c')]['split']('-')[0x0]]){this[_0x7ac8('0x16')][_0x177735[_0x7ac8('0x3c')][_0x7ac8('0x3d')]('-')[0x0]]=_['omit'](this[_0x7ac8('0x16')][_0x177735[_0x7ac8('0x3c')]['split']('-')[0x0]],['destconnectedlinenum']);logger[_0x7ac8('0x48')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x177735[_0x7ac8('0x34')],util[_0x7ac8('0x37')]({'id':this[_0x7ac8('0x16')][_0x177735[_0x7ac8('0x3c')][_0x7ac8('0x3d')]('-')[0x0]]['id'],'destaccountcode':this[_0x7ac8('0x16')][_0x177735[_0x7ac8('0x3c')][_0x7ac8('0x3d')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x7ac8('0x32')](util['format'](_0x7ac8('0x43'),this[_0x7ac8('0x16')][_0x177735['channel']['split']('-')[0x0]][_0x7ac8('0x44')]),'user:agentcomplete',{'id':this[_0x7ac8('0x16')][_0x177735[_0x7ac8('0x3c')][_0x7ac8('0x3d')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x177735[_0x7ac8('0x3c')][_0x7ac8('0x3d')]('-')[0x0]]['accountcode']});for(var _0x1c863e=0x0;_0x1c863e{delete this['channels'][_0x105b4e];},_0x73a34b);}};module[_0x7ac8('0xc7')]=VoiceCallReport; \ No newline at end of file +var _0x256e=['newchannel','syncNewChannel','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','isNotNull','isUndefined','prototype','emit','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','keys','context','from-sip','split','exten','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','pick','channel','undefined','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','appdata','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','merge','includes','lastapplication','lastdata','startsWith','match','type','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','answertime','holdtime','diff','connectedlinename','membername','destinationchannel','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','syncMixMonitorFilename','monitor','endsWith','.wav49','.WAV','monitorFilename','monitors','isNil','push','rec','[%s][voiceCallReport][varset]\x20event:','variable','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','mixmonitor_filename','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','resolve','then','getSettings','stopRecordingOnTransfer','Action','catch','finally','webbar:stopmonitors','BlindTransfer','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','origtransfererlinkedid','some','outbound','transferToInternal','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','exports','util','path','ioredis','../../../config/environment','ami','set','queue','agi','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','channels','agents','blindTransfers','coreshowchannel','bind','newexten','syncNewExten'];(function(_0x8b97b4,_0x382038){var _0x2ed10e=function(_0x21842e){while(--_0x21842e){_0x8b97b4['push'](_0x8b97b4['shift']());}};_0x2ed10e(++_0x382038);}(_0x256e,0xa7));var _0xe256=function(_0x17976a,_0x3171aa){_0x17976a=_0x17976a-0x0;var _0x19325b=_0x256e[_0x17976a];return _0x19325b;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xe256('0x0'));var path=require(_0xe256('0x1'));var Redis=require(_0xe256('0x2'));var config=require(_0xe256('0x3'));var logger=require('../../../config/logger')(_0xe256('0x4'));var ami=require('../ami');var Channel=require('../model/channel');var RpcSetting=require('../rpc/setting');var applications=[_0xe256('0x5'),_0xe256('0x6'),_0xe256('0x7'),'dial',_0xe256('0x8'),_0xe256('0x9')];var dispositions=[_0xe256('0xa'),_0xe256('0xb'),'FAILED',_0xe256('0xa'),_0xe256('0xa'),_0xe256('0xa'),_0xe256('0xc'),_0xe256('0xd'),_0xe256('0xb'),_0xe256('0xb'),_0xe256('0xb')];config[_0xe256('0xe')]=_[_0xe256('0xf')](config[_0xe256('0xe')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceCallReport(_0xaaf609){this[_0xe256('0x10')]=_0xaaf609[_0xe256('0x10')];this[_0xe256('0x11')]=_0xaaf609['agents'];this[_0xe256('0x12')]={};ami['on'](_0xe256('0x13'),this['syncNewExten'][_0xe256('0x14')](this));ami['on'](_0xe256('0x15'),this[_0xe256('0x16')][_0xe256('0x14')](this));ami['on'](_0xe256('0x17'),this[_0xe256('0x18')]['bind'](this));ami['on']('newstate',this[_0xe256('0x19')][_0xe256('0x14')](this));ami['on'](_0xe256('0x1a'),this[_0xe256('0x1b')][_0xe256('0x14')](this));ami['on'](_0xe256('0x1c'),this[_0xe256('0x1d')][_0xe256('0x14')](this));ami['on'](_0xe256('0x1e'),this[_0xe256('0x1f')][_0xe256('0x14')](this));ami['on'](_0xe256('0x20'),this['syncAttendedTransfer'][_0xe256('0x14')](this));ami['on'](_0xe256('0x21'),this[_0xe256('0x22')][_0xe256('0x14')](this));ami['on'](_0xe256('0x23'),this[_0xe256('0x24')]['bind'](this));ami['on']('musiconholdstop',this[_0xe256('0x25')][_0xe256('0x14')](this));try{logger[_0xe256('0x26')](_0xe256('0x27'));ami[_0xe256('0x28')]();}catch(_0x176ef1){logger[_0xe256('0x29')](_0xe256('0x2a'),util[_0xe256('0x2b')](_0x176ef1,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0xe256('0x2c')]=function(_0x2b2853){return _0x2b2853!==null&&!_[_0xe256('0x2d')](_0x2b2853);};VoiceCallReport[_0xe256('0x2e')][_0xe256('0x2f')]=function(_0x343d72,_0x59a46b,_0x2921b7){io['to'](_0x343d72)[_0xe256('0x2f')](_0x59a46b,_0x2921b7);};VoiceCallReport['prototype'][_0xe256('0x1f')]=function(_0x1dcef3){try{if(this['isNotNull'](_0x1dcef3)){logger['info']('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x1dcef3[_0xe256('0x30')],_0x1dcef3[_0xe256('0x31')],_0x1dcef3[_0xe256('0x32')]);logger[_0xe256('0x33')](_0xe256('0x34'),_0x1dcef3[_0xe256('0x30')],util[_0xe256('0x2b')](_0x1dcef3,{'showHidden':![],'depth':null}));if(_0x1dcef3[_0xe256('0x30')]===_0x1dcef3[_0xe256('0x35')]){if(!_['isUndefined'](this[_0xe256('0x10')][_0x1dcef3[_0xe256('0x30')]])){_['merge'](this[_0xe256('0x10')][_0x1dcef3[_0xe256('0x30')]],_['pick'](_0x1dcef3,_[_0xe256('0x36')](this['channels'][_0x1dcef3[_0xe256('0x30')]])));}}if(_0x1dcef3[_0xe256('0x37')]===_0xe256('0x38')){var _0x133cf5=this[_0xe256('0x11')][_0x1dcef3['channel'][_0xe256('0x39')]('-')[0x0]];if(_0x133cf5){if(_0x1dcef3[_0xe256('0x3a')]=='xcally-motion-preview'){_0x133cf5['destconnectedlinenum']=_0x1dcef3[_0xe256('0x3b')];this[_0xe256('0x2f')](util[_0xe256('0x3c')](_0xe256('0x3d'),_0x133cf5[_0xe256('0x3e')]),_0xe256('0x3f'),{'id':_0x133cf5['id'],'destaccountcode':_0x133cf5[_0xe256('0x40')],'destconnectedlinenum':_0x1dcef3['connectedlinenum']});}}}}}catch(_0x46e29e){logger[_0xe256('0x29')](_0xe256('0x41'),_0x1dcef3[_0xe256('0x30')],util[_0xe256('0x2b')](_0x46e29e,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewChannel']=function(_0x36a5b0){try{if(this[_0xe256('0x2c')](_0x36a5b0)){logger['debug'](_0xe256('0x42'),_0x36a5b0[_0xe256('0x30')],util[_0xe256('0x2b')](_0x36a5b0,{'showHidden':![],'depth':null}));if(this[_0xe256('0x10')][_0x36a5b0[_0xe256('0x30')]]){return;}if(_0x36a5b0['channel']===_0xe256('0x43')){return;}if(_0x36a5b0[_0xe256('0x30')]!==_0x36a5b0[_0xe256('0x35')]&&!this[_0xe256('0x12')][_0x36a5b0[_0xe256('0x35')]]){return;}logger[_0xe256('0x26')](_0xe256('0x44'),_0x36a5b0['uniqueid'],_0x36a5b0['context'],_0x36a5b0[_0xe256('0x3a')]);this['channels'][_0x36a5b0[_0xe256('0x30')]]=new Channel();this[_0xe256('0x10')][_0x36a5b0[_0xe256('0x30')]][_0xe256('0x45')]=moment()['format'](_0xe256('0x46'));this[_0xe256('0x10')][_0x36a5b0['uniqueid']][_0xe256('0x47')]=dispositions[_[_0xe256('0x48')](_0x36a5b0['channelstate'])];_['merge'](this[_0xe256('0x10')][_0x36a5b0[_0xe256('0x30')]],_[_0xe256('0x49')](_0x36a5b0,_[_0xe256('0x36')](this[_0xe256('0x10')][_0x36a5b0['uniqueid']])));if(_0x36a5b0['context']===_0xe256('0x38')){var _0x5c521f=this['agents'][_0x36a5b0[_0xe256('0x4a')][_0xe256('0x39')]('-')[0x0]];if(_0x5c521f&&typeof _0x5c521f['destconnectedlinenum']===_0xe256('0x4b')){_0x5c521f[_0xe256('0x4c')]=_0x36a5b0['exten'];logger[_0xe256('0x33')](_0xe256('0x4d'),_0x36a5b0[_0xe256('0x30')],util[_0xe256('0x2b')]({'id':_0x5c521f['id'],'destaccountcode':_0x5c521f[_0xe256('0x40')],'destconnectedlinenum':_0x36a5b0[_0xe256('0x3a')]},{'showHidden':![],'depth':null}));this[_0xe256('0x2f')](util[_0xe256('0x3c')](_0xe256('0x3d'),_0x5c521f[_0xe256('0x3e')]),_0xe256('0x3f'),{'id':_0x5c521f['id'],'destaccountcode':_0x5c521f[_0xe256('0x40')],'destconnectedlinenum':_0x36a5b0[_0xe256('0x3a')]});}}}}catch(_0x289935){logger['error'](_0xe256('0x4e'),_0x36a5b0[_0xe256('0x30')],util['inspect'](_0x289935,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xe256('0x16')]=function(_0xe5fb9f){try{if(this[_0xe256('0x2c')](_0xe5fb9f)){logger['debug'](_0xe256('0x4f'),_0xe5fb9f[_0xe256('0x30')],util[_0xe256('0x2b')](_0xe5fb9f,{'showHidden':![],'depth':null}));if(_0xe5fb9f[_0xe256('0x4a')]===_0xe256('0x43')||_0xe5fb9f[_0xe256('0x3a')]==='h')return;if(_0xe5fb9f[_0xe256('0x30')]===_0xe5fb9f[_0xe256('0x35')]||this['blindTransfers'][_0xe5fb9f[_0xe256('0x35')]]){_0xe5fb9f[_0xe256('0x50')]=_0xe5fb9f['application']?_0xe5fb9f[_0xe256('0x50')][_0xe256('0x51')]():undefined;_0xe5fb9f['applicationdata']=_0xe5fb9f[_0xe256('0x52')]||_0xe5fb9f[_0xe256('0x53')];if(_0xe5fb9f[_0xe256('0x52')]&&_0xe5fb9f['application']!==_0xe256('0x6')){_0xe5fb9f[_0xe256('0x53')]=_0xe5fb9f[_0xe256('0x53')][_0xe256('0x51')]();}logger[_0xe256('0x26')](_0xe256('0x54'),_0xe5fb9f[_0xe256('0x30')],_0xe5fb9f['application'],_0xe5fb9f[_0xe256('0x53')]);if(_[_0xe256('0x2d')](this[_0xe256('0x10')][_0xe5fb9f[_0xe256('0x30')]])){this[_0xe256('0x10')][_0xe5fb9f[_0xe256('0x30')]]=new Channel();this[_0xe256('0x10')][_0xe5fb9f[_0xe256('0x30')]][_0xe256('0x45')]=_0xe5fb9f[_0xe256('0x55')]?moment()[_0xe256('0x56')](moment[_0xe256('0x55')](_0xe5fb9f[_0xe256('0x55')])[_0xe256('0x57')](),_0xe256('0x57'))[_0xe256('0x3c')](_0xe256('0x46')):moment()[_0xe256('0x3c')](_0xe256('0x46'));this[_0xe256('0x10')][_0xe5fb9f['uniqueid']]['disposition']=_0xe256('0xa');}_[_0xe256('0x58')](this[_0xe256('0x10')][_0xe5fb9f[_0xe256('0x30')]],_[_0xe256('0x49')](_0xe5fb9f,_[_0xe256('0x36')](this[_0xe256('0x10')][_0xe5fb9f[_0xe256('0x30')]])));if(_[_0xe256('0x59')](applications,_0xe5fb9f[_0xe256('0x50')])){this[_0xe256('0x10')][_0xe5fb9f[_0xe256('0x30')]][_0xe256('0x5a')]=_0xe5fb9f[_0xe256('0x50')];this['channels'][_0xe5fb9f[_0xe256('0x30')]][_0xe256('0x5b')]=_0xe5fb9f[_0xe256('0x53')];if(_0xe5fb9f[_0xe256('0x50')]===_0xe256('0x5')&&_[_0xe256('0x5c')](_0xe5fb9f[_0xe256('0x53')][_0xe256('0x51')](),'cdr(')){var _0x3ca65e=_0xe5fb9f['applicationdata'][_0xe256('0x39')]('=');var _0x26094b=_0x3ca65e[0x0][_0xe256('0x51')]()[_0xe256('0x5d')](/cdr\((.*)\)/);if(_0x26094b){if(_0x26094b[0x1]===_0xe256('0x5e')&&!_['isNil'](this[_0xe256('0x10')][_0xe5fb9f[_0xe256('0x30')]][_0x26094b[0x1]]))return;this[_0xe256('0x10')][_0xe5fb9f['uniqueid']][_0x26094b[0x1]]=_0x3ca65e[0x1];}}else if(_0xe5fb9f[_0xe256('0x50')]===_0xe256('0x6')){this['channels'][_0xe5fb9f[_0xe256('0x30')]][_0xe256('0x6')]=_0xe5fb9f[_0xe256('0x53')][_0xe256('0x39')](',')[0x0];}}}}}catch(_0xd4fe8e){logger[_0xe256('0x29')]('[%s][voiceCallReport][newexten]',_0xe5fb9f[_0xe256('0x30')],util[_0xe256('0x2b')](_0xd4fe8e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe256('0x2e')]['syncNewState']=function(_0x4d5384){try{if(this[_0xe256('0x2c')](_0x4d5384)){logger[_0xe256('0x26')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x4d5384[_0xe256('0x30')],_0x4d5384[_0xe256('0x35')],_0x4d5384[_0xe256('0x31')],_0x4d5384[_0xe256('0x32')]);logger['debug'](_0xe256('0x5f'),_0x4d5384[_0xe256('0x30')],util[_0xe256('0x2b')](_0x4d5384,{'showHidden':![],'depth':null}));if(_0x4d5384[_0xe256('0x60')]!=='6')return;var _0x402429=this[_0xe256('0x11')][_0x4d5384[_0xe256('0x4a')]['split']('-')[0x0]];if(_0x4d5384[_0xe256('0x30')]!==_0x4d5384['linkedid']){var _0x185e74=moment();if(this['channels'][_0x4d5384['linkedid']]){if(!this['channels'][_0x4d5384['linkedid']][_0xe256('0x61')]){this[_0xe256('0x10')][_0x4d5384['linkedid']][_0xe256('0x61')]=!![];this[_0xe256('0x10')][_0x4d5384[_0xe256('0x35')]][_0xe256('0x62')]=_0x185e74['format'](_0xe256('0x46'));if(this[_0xe256('0x10')][_0x4d5384[_0xe256('0x35')]]['starttime']){this[_0xe256('0x10')][_0x4d5384[_0xe256('0x35')]][_0xe256('0x63')]=_0x185e74[_0xe256('0x64')](this[_0xe256('0x10')][_0x4d5384[_0xe256('0x35')]][_0xe256('0x45')],'seconds');}}this[_0xe256('0x10')][_0x4d5384['linkedid']][_0xe256('0x35')]=_0x4d5384['uniqueid'];if(_0x4d5384[_0xe256('0x32')]!=='xcally-motion-preview'){this[_0xe256('0x10')][_0x4d5384[_0xe256('0x35')]]['connectedlinenum']=_0x4d5384[_0xe256('0x32')];}this[_0xe256('0x10')][_0x4d5384['linkedid']][_0xe256('0x65')]=_0x4d5384[_0xe256('0x31')];this['channels'][_0x4d5384['linkedid']]['destinationchannel']=_0x4d5384['channel'];this[_0xe256('0x10')][_0x4d5384[_0xe256('0x35')]][_0xe256('0x47')]=dispositions[_[_0xe256('0x48')](_0x4d5384[_0xe256('0x60')])];if(_0x402429){this[_0xe256('0x10')][_0x4d5384['linkedid']]['UserId']=_0x402429['id'];this[_0xe256('0x10')][_0x4d5384[_0xe256('0x35')]][_0xe256('0x66')]=_0x402429['name'];}}if(this[_0xe256('0x10')][_0x4d5384[_0xe256('0x30')]]){if(!this[_0xe256('0x10')][_0x4d5384[_0xe256('0x30')]][_0xe256('0x61')]){this[_0xe256('0x10')][_0x4d5384[_0xe256('0x30')]][_0xe256('0x61')]=!![];this[_0xe256('0x10')][_0x4d5384[_0xe256('0x30')]][_0xe256('0x62')]=_0x185e74[_0xe256('0x3c')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xe256('0x10')][_0x4d5384[_0xe256('0x30')]][_0xe256('0x45')]){this[_0xe256('0x10')][_0x4d5384[_0xe256('0x30')]][_0xe256('0x63')]=_0x185e74[_0xe256('0x64')](this[_0xe256('0x10')][_0x4d5384['uniqueid']][_0xe256('0x45')],_0xe256('0x57'));}}if(_0x4d5384[_0xe256('0x32')]!=='xcally-motion-preview'){this[_0xe256('0x10')][_0x4d5384[_0xe256('0x30')]][_0xe256('0x3b')]=_0x4d5384[_0xe256('0x32')];}this[_0xe256('0x10')][_0x4d5384['uniqueid']][_0xe256('0x65')]=_0x4d5384[_0xe256('0x31')];this[_0xe256('0x10')][_0x4d5384[_0xe256('0x30')]][_0xe256('0x67')]=_0x4d5384[_0xe256('0x4a')];this[_0xe256('0x10')][_0x4d5384['uniqueid']]['disposition']=dispositions[_[_0xe256('0x48')](_0x4d5384['channelstate'])];}}else{if(this['channels'][_0x4d5384[_0xe256('0x30')]]){if(_0x402429){this[_0xe256('0x10')][_0x4d5384[_0xe256('0x30')]]['UserId']=_0x402429['id'];this[_0xe256('0x10')][_0x4d5384[_0xe256('0x30')]]['membername']=_0x402429[_0xe256('0x3e')];}}}if(_0x4d5384[_0xe256('0x37')]===_0xe256('0x38')){if(_0x402429){_0x402429[_0xe256('0x4c')]=_0x4d5384['exten'];var _0x81c771;if(this['channels'][_0x4d5384['uniqueid']]){_0x81c771=this[_0xe256('0x10')][_0x4d5384[_0xe256('0x30')]][_0xe256('0x6')];}else if(this[_0xe256('0x10')][_0x4d5384[_0xe256('0x35')]]){_0x81c771=this['channels'][_0x4d5384[_0xe256('0x35')]][_0xe256('0x6')];}_0x402429[_0xe256('0x6')]=_0x81c771;var _0x1632bc={'id':_0x402429['id'],'name':_0x402429[_0xe256('0x3e')],'agentconnected':!![],'destaccountcode':_0x402429[_0xe256('0x40')],'destconnectedlinenum':_0x4d5384['exten'],'queue':_0x81c771||undefined,'uniqueid':_0x4d5384[_0xe256('0x35')]};logger[_0xe256('0x33')](_0xe256('0x68'),_0x4d5384[_0xe256('0x30')],util[_0xe256('0x2b')](_0x1632bc,{'showHidden':![],'depth':null}));this['emit'](util[_0xe256('0x3c')](_0xe256('0x3d'),_0x402429['name']),_0xe256('0x3f'),_0x1632bc);}}}}catch(_0xd94c1c){logger['error']('[%s][voiceCallReport][newstate]',_0x4d5384['uniqueid'],util[_0xe256('0x2b')](_0xd94c1c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe256('0x2e')][_0xe256('0x69')]=function(_0x23cd2c,_0x4984f5){try{if(this[_0xe256('0x10')][_0x23cd2c]){logger[_0xe256('0x26')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x23cd2c,_0x4984f5);this['channels'][_0x23cd2c][_0xe256('0x6a')]=!![];if(_[_0xe256('0x6b')](_0x4984f5,'.wav49')){_0x4984f5=_0x4984f5['replace'](_0xe256('0x6c'),_0xe256('0x6d'));}this[_0xe256('0x10')][_0x23cd2c][_0xe256('0x6e')]=_0x4984f5;var _0x2d39c2=_['find'](this[_0xe256('0x10')][_0x23cd2c][_0xe256('0x6f')],{'filename':_0x4984f5});if(_[_0xe256('0x70')](_0x2d39c2)){this[_0xe256('0x10')][_0x23cd2c][_0xe256('0x6f')][_0xe256('0x71')]({'filename':_0x4984f5,'createdAt':moment()[_0xe256('0x3c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0xe256('0x72')});}}}catch(_0x3b009b){logger['error']('[%s][voiceCallReport][mixMonitorFilename]',_0x23cd2c,util['inspect'](_0x3b009b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xe256('0x2e')][_0xe256('0x1b')]=function(_0xcb2a17){try{if(this[_0xe256('0x2c')](_0xcb2a17)){logger[_0xe256('0x33')](_0xe256('0x73'),_0xcb2a17[_0xe256('0x30')],util[_0xe256('0x2b')](_0xcb2a17,{'showHidden':![],'depth':null}));if(this[_0xe256('0x10')][_0xcb2a17['uniqueid']]&&_0xcb2a17[_0xe256('0x4a')]!='OutgoingSpoolFailed'){if(this['isNotNull'](_0xcb2a17[_0xe256('0x74')])){if(this[_0xe256('0x2c')](_0xcb2a17['variable']['mixmonitor_filename'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0xcb2a17['uniqueid'],_0xcb2a17[_0xe256('0x75')]);this[_0xe256('0x69')](_0xcb2a17[_0xe256('0x30')],_0xcb2a17[_0xe256('0x75')]);}else if(this['isNotNull'](_0xcb2a17['variable']['xmd-phone'])){logger[_0xe256('0x26')](_0xe256('0x76'),_0xcb2a17['uniqueid'],_0xcb2a17[_0xe256('0x75')]);this[_0xe256('0x10')][_0xcb2a17[_0xe256('0x30')]][_0xe256('0x32')]=_0xcb2a17[_0xe256('0x75')];}else if(this[_0xe256('0x2c')](_0xcb2a17['variable'][_0xe256('0x77')])){logger[_0xe256('0x26')](_0xe256('0x78'),_0xcb2a17[_0xe256('0x30')],_0xcb2a17[_0xe256('0x75')]);this[_0xe256('0x10')][_0xcb2a17['uniqueid']]['callerid']=_0xcb2a17[_0xe256('0x75')];}else if(this['isNotNull'](_0xcb2a17['variable'][_0xe256('0x79')])){logger[_0xe256('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0xcb2a17[_0xe256('0x30')],_0xcb2a17[_0xe256('0x75')]);this['channels'][_0xcb2a17[_0xe256('0x30')]]['type']=_0xcb2a17[_0xe256('0x75')];}else if(this['isNotNull'](_0xcb2a17[_0xe256('0x74')][_0xe256('0x7a')])){logger[_0xe256('0x26')](_0xe256('0x7b'),_0xcb2a17[_0xe256('0x30')],_0xcb2a17[_0xe256('0x75')]['split'](',')[0x0]);this[_0xe256('0x10')][_0xcb2a17['uniqueid']][_0xe256('0x6')]=_0xcb2a17[_0xe256('0x75')][_0xe256('0x39')](',')[0x0];}else if(this[_0xe256('0x2c')](_0xcb2a17[_0xe256('0x74')][_0xe256('0x7c')])){logger[_0xe256('0x26')](_0xe256('0x7d'),_0xcb2a17['uniqueid'],_0xcb2a17['value']);this['channels'][_0xcb2a17[_0xe256('0x30')]][_0xe256('0x7e')]=_0xcb2a17[_0xe256('0x75')];}else if(this[_0xe256('0x2c')](_0xcb2a17[_0xe256('0x74')]['xmd-destination'])){logger[_0xe256('0x26')](_0xe256('0x7f'),_0xcb2a17[_0xe256('0x30')],_0xcb2a17[_0xe256('0x75')]);this[_0xe256('0x10')][_0xcb2a17[_0xe256('0x30')]][_0xe256('0x80')]=_0xcb2a17[_0xe256('0x75')];}else if(this[_0xe256('0x2c')](_0xcb2a17[_0xe256('0x74')][_0xe256('0x81')])){logger[_0xe256('0x26')](_0xe256('0x82'),_0xcb2a17[_0xe256('0x30')],_0xcb2a17[_0xe256('0x75')]);this[_0xe256('0x10')][_0xcb2a17[_0xe256('0x30')]][_0xe256('0x83')]=_0xcb2a17['value'];}else if(this['isNotNull'](_0xcb2a17[_0xe256('0x74')][_0xe256('0x84')])){logger['info'](_0xe256('0x85'),_0xcb2a17[_0xe256('0x30')],_0xcb2a17['value']);this[_0xe256('0x10')][_0xcb2a17['uniqueid']][_0xe256('0x6')]=_0xcb2a17['value'];}else if(this[_0xe256('0x2c')](_0xcb2a17[_0xe256('0x74')][_0xe256('0x86')])){logger[_0xe256('0x26')](_0xe256('0x87'),_0xcb2a17['uniqueid'],_0xcb2a17[_0xe256('0x75')]);this['channels'][_0xcb2a17[_0xe256('0x30')]]['sipcalluniqueid']=_0xcb2a17[_0xe256('0x75')];}}}else if(this['isNotNull'](_0xcb2a17['variable'][_0xe256('0x88')])){if(_0xcb2a17[_0xe256('0x75')]){var _0x57f7fd=path[_0xe256('0x89')](_0xcb2a17[_0xe256('0x75')])[_0xe256('0x3e')];logger['info'](_0xe256('0x8a'),_0x57f7fd,_0xcb2a17[_0xe256('0x75')]);this[_0xe256('0x69')](_0x57f7fd,_0xcb2a17[_0xe256('0x75')]);}}else if(this[_0xe256('0x10')][_0xcb2a17[_0xe256('0x35')]]){if(this[_0xe256('0x2c')](_0xcb2a17[_0xe256('0x74')])){if(this[_0xe256('0x2c')](_0xcb2a17[_0xe256('0x74')][_0xe256('0x86')])){logger['info'](_0xe256('0x87'),_0xcb2a17[_0xe256('0x35')],_0xcb2a17[_0xe256('0x75')]);this['channels'][_0xcb2a17[_0xe256('0x35')]][_0xe256('0x8b')]=_0xcb2a17[_0xe256('0x75')];}}}}}catch(_0x4950db){logger[_0xe256('0x29')]('[%s][voiceCallReport][varset]',_0xcb2a17[_0xe256('0x30')],util['inspect'](_0x4950db,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncHangup']=function(_0x36f3e7){try{if(this[_0xe256('0x2c')](_0x36f3e7)){logger[_0xe256('0x33')](_0xe256('0x8c'),_0x36f3e7[_0xe256('0x30')],util[_0xe256('0x2b')](_0x36f3e7,{'showHidden':![],'depth':null}));if(this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]]){if(this[_0xe256('0x10')][this['blindTransfers'][_0x36f3e7[_0xe256('0x35')]]['linkedid']]){this['channels'][this['blindTransfers'][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x35')]][_0xe256('0x30')]=_0x36f3e7['uniqueid'];this[_0xe256('0x10')][this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]]['linkedid']]['answered']=this[_0xe256('0x10')][_0x36f3e7[_0xe256('0x30')]][_0xe256('0x61')];this['channels'][this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x35')]][_0xe256('0x62')]=this[_0xe256('0x10')][_0x36f3e7['uniqueid']]['answertime'];this[_0xe256('0x10')][this['blindTransfers'][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x35')]][_0xe256('0x67')]=this['channels'][this[_0xe256('0x12')][_0x36f3e7['linkedid']][_0xe256('0x35')]][_0xe256('0x4a')];this[_0xe256('0x10')][this['blindTransfers'][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x35')]]['disposition']=this[_0xe256('0x10')][_0x36f3e7['uniqueid']][_0xe256('0x47')];this['channels'][_0x36f3e7[_0xe256('0x30')]]=this['channels'][this['blindTransfers'][_0x36f3e7['linkedid']]['linkedid']];this[_0xe256('0x8d')](this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]]['linkedid']);}else if(this[_0xe256('0x10')][this['blindTransfers'][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x30')]]){this[_0xe256('0x10')][this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x30')]][_0xe256('0x30')]=[this['channels'][this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x30')]][_0xe256('0x35')],this[_0xe256('0x10')][this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x30')]]['linkedid']=this[_0xe256('0x10')][this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x30')]][_0xe256('0x30')]][0x0];this[_0xe256('0x10')][this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x30')]][_0xe256('0x61')]=this[_0xe256('0x10')][_0x36f3e7[_0xe256('0x30')]][_0xe256('0x61')];this['channels'][this['blindTransfers'][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x30')]][_0xe256('0x62')]=this['channels'][_0x36f3e7[_0xe256('0x30')]]['answertime'];this[_0xe256('0x10')][this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x30')]][_0xe256('0x67')]=this['channels'][this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x30')]]['channel'];this[_0xe256('0x10')][this[_0xe256('0x12')][_0x36f3e7['linkedid']]['uniqueid']]['disposition']=this[_0xe256('0x10')][_0x36f3e7['uniqueid']][_0xe256('0x47')];this[_0xe256('0x10')][_0x36f3e7['uniqueid']]=this['channels'][this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]]['uniqueid']];this[_0xe256('0x8d')](this[_0xe256('0x12')][_0x36f3e7[_0xe256('0x35')]][_0xe256('0x30')]);}}if(this[_0xe256('0x10')][_0x36f3e7['uniqueid']]){logger[_0xe256('0x26')](_0xe256('0x8e'),_0x36f3e7[_0xe256('0x30')],_0x36f3e7['cause-txt']);var _0x3a8129=moment();this[_0xe256('0x10')][_0x36f3e7[_0xe256('0x30')]]['endtime']=_0x3a8129[_0xe256('0x3c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe256('0x10')][_0x36f3e7[_0xe256('0x30')]]['duration']=_0x3a8129[_0xe256('0x64')](this[_0xe256('0x10')][_0x36f3e7[_0xe256('0x30')]][_0xe256('0x45')],_0xe256('0x57'));if(this[_0xe256('0x10')][_0x36f3e7[_0xe256('0x30')]][_0xe256('0x61')]){this[_0xe256('0x10')][_0x36f3e7[_0xe256('0x30')]][_0xe256('0x8f')]=_0x3a8129[_0xe256('0x64')](this[_0xe256('0x10')][_0x36f3e7['uniqueid']]['answertime'],_0xe256('0x57'));this['channels'][_0x36f3e7[_0xe256('0x30')]][_0xe256('0x63')]=this[_0xe256('0x10')][_0x36f3e7[_0xe256('0x30')]][_0xe256('0x55')]-this[_0xe256('0x10')][_0x36f3e7[_0xe256('0x30')]][_0xe256('0x8f')];}if(_0x36f3e7[_0xe256('0x37')]===_0xe256('0x38')){if(this[_0xe256('0x11')][_0x36f3e7[_0xe256('0x4a')][_0xe256('0x39')]('-')[0x0]]){this[_0xe256('0x11')][_0x36f3e7[_0xe256('0x4a')][_0xe256('0x39')]('-')[0x0]]=_[_0xe256('0x90')](this[_0xe256('0x11')][_0x36f3e7['channel'][_0xe256('0x39')]('-')[0x0]],[_0xe256('0x4c')]);logger[_0xe256('0x33')](_0xe256('0x91'),_0x36f3e7[_0xe256('0x30')],util['inspect']({'id':this[_0xe256('0x11')][_0x36f3e7['channel'][_0xe256('0x39')]('-')[0x0]]['id'],'destaccountcode':this[_0xe256('0x11')][_0x36f3e7[_0xe256('0x4a')][_0xe256('0x39')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0xe256('0x2f')](util['format']('user:%s',this['agents'][_0x36f3e7[_0xe256('0x4a')][_0xe256('0x39')]('-')[0x0]][_0xe256('0x3e')]),_0xe256('0x92'),{'id':this[_0xe256('0x11')][_0x36f3e7['channel'][_0xe256('0x39')]('-')[0x0]]['id'],'destaccountcode':this[_0xe256('0x11')][_0x36f3e7[_0xe256('0x4a')][_0xe256('0x39')]('-')[0x0]][_0xe256('0x40')]});for(var _0x586324=0x0;_0x586324{delete this[_0xe256('0x10')][_0x42368d];},_0x4c0cef);}};module[_0xe256('0xbd')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 92e7690..1f964e4 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 _0x472e=['rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','membername','memberpenalty','memberrealtime','isNil','includes','syncHangup','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','diff','starttime','seconds','complete','answertime','answered','billableseconds','holdtime','sumBillable','sumDuration','duration','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','applicationdata','appdata','toLowerCase','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','exports','lodash','moment','util','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','outboundChannels','outbound','variables','bind','dialend','syncDialEnd','syncVarSet','hangup','prototype','isUndefined','emit','syncDialBegin','debug','[%s][voiceDialReport][dialbegin]\x20event:','inspect','channels','merge','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','applications','voice:outbound','voice_outbound_channel:save','custom:dialbegin','[%s][voiceDialReport][dialbegin]','isNotNull','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','error','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt'];(function(_0x209e12,_0x2ce907){var _0x3f5b89=function(_0x39cc7f){while(--_0x39cc7f){_0x209e12['push'](_0x209e12['shift']());}};_0x3f5b89(++_0x2ce907);}(_0x472e,0x17c));var _0xe472=function(_0x3c3698,_0xa0bf08){_0x3c3698=_0x3c3698-0x0;var _0x4e6637=_0x472e[_0x3c3698];return _0x4e6637;};'use strict';var _=require(_0xe472('0x0'));var moment=require(_0xe472('0x1'));var util=require(_0xe472('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xe472('0x3'))(_0xe472('0x4'));var ami=require('../ami');config[_0xe472('0x5')]=_[_0xe472('0x6')](config[_0xe472('0x5')],{'host':_0xe472('0x7'),'port':0x18eb});var io=require(_0xe472('0x8'))(new Redis(config[_0xe472('0x5')]));function VoiceDialReport(_0x599198){this['channels']=_0x599198[_0xe472('0x9')];this[_0xe472('0xa')]=_0x599198['outbound'];this['applications']={};this[_0xe472('0xb')]={};ami['on']('dialbegin',this['syncDialBegin'][_0xe472('0xc')](this));ami['on'](_0xe472('0xd'),this[_0xe472('0xe')][_0xe472('0xc')](this));ami['on']('varset',this[_0xe472('0xf')]['bind'](this));ami['on'](_0xe472('0x10'),this['syncHangup'][_0xe472('0xc')](this));}VoiceDialReport[_0xe472('0x11')]['isNotNull']=function(_0x3010c1){return _0x3010c1!==null&&!_[_0xe472('0x12')](_0x3010c1);};VoiceDialReport[_0xe472('0x11')][_0xe472('0x13')]=function(_0x57e3c2,_0x10bfc9,_0x43a4f2){io['to'](_0x57e3c2)[_0xe472('0x13')](_0x10bfc9,_0x43a4f2);};VoiceDialReport[_0xe472('0x11')][_0xe472('0x14')]=function(_0x4200fa){try{if(this['isNotNull'](_0x4200fa)){logger[_0xe472('0x15')](_0xe472('0x16'),_0x4200fa['uniqueid'],util[_0xe472('0x17')](_0x4200fa,{'showHidden':![],'depth':null}));if(this[_0xe472('0x18')][_0x4200fa['uniqueid']]){_[_0xe472('0x19')](this[_0xe472('0x18')][_0x4200fa[_0xe472('0x1a')]],{'starttime':moment()[_0xe472('0x1b')](_0xe472('0x1c')),'lastevent':_0xe472('0x1d'),'interface':_0x4200fa[_0xe472('0x1e')][_0xe472('0x1f')](0x0,_0x4200fa['channel']['lastIndexOf']('-')),'membername':_0x4200fa[_0xe472('0x1e')][_0xe472('0x1f')](_0x4200fa[_0xe472('0x1e')]['lastIndexOf']('/')+0x1,_0x4200fa[_0xe472('0x1e')][_0xe472('0x20')]('-'))},_[_0xe472('0x21')](_0x4200fa,['event','privilege']));logger[_0xe472('0x22')](_0xe472('0x23'),_0x4200fa[_0xe472('0x1a')],this[_0xe472('0x18')][_0x4200fa[_0xe472('0x1a')]]['membername'],this[_0xe472('0x18')][_0x4200fa[_0xe472('0x1a')]][_0xe472('0x24')]);logger[_0xe472('0x15')](_0xe472('0x25'),_0x4200fa[_0xe472('0x1a')],util[_0xe472('0x17')](this[_0xe472('0x18')][_0x4200fa[_0xe472('0x1a')]],{'showHidden':![],'depth':null}));if(this[_0xe472('0x26')][_0x4200fa['uniqueid']])_[_0xe472('0x19')](this[_0xe472('0x18')][_0x4200fa[_0xe472('0x1a')]],this['applications'][_0x4200fa[_0xe472('0x1a')]]);this[_0xe472('0x13')](_0xe472('0x27'),_0xe472('0x28'),this[_0xe472('0x18')][_0x4200fa[_0xe472('0x1a')]]);logger[_0xe472('0x15')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x4200fa[_0xe472('0x1a')],util[_0xe472('0x17')](this[_0xe472('0x18')][_0x4200fa['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xe472('0x13')](_0xe472('0x29'),this[_0xe472('0x18')][_0x4200fa[_0xe472('0x1a')]]);}}}catch(_0x17abdc){logger['error'](_0xe472('0x2a'),_0x4200fa[_0xe472('0x1a')],util[_0xe472('0x17')](_0x17abdc,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe472('0x11')][_0xe472('0xe')]=function(_0x59e74b){try{if(this[_0xe472('0x2b')](_0x59e74b)){logger[_0xe472('0x15')](_0xe472('0x2c'),_0x59e74b[_0xe472('0x1a')],util[_0xe472('0x17')](_0x59e74b,{'showHidden':![],'depth':null}));if(this[_0xe472('0x18')][_0x59e74b[_0xe472('0x1a')]]){this[_0xe472('0x18')][_0x59e74b['uniqueid']]['dialstatus']=_0x59e74b[_0xe472('0x2d')];if(_0x59e74b[_0xe472('0x2d')]===_0xe472('0x2e')){this[_0xe472('0x18')][_0x59e74b[_0xe472('0x1a')]][_0xe472('0x2f')]=_0x59e74b['connectedlinenum'];this[_0xe472('0x18')][_0x59e74b[_0xe472('0x1a')]][_0xe472('0x30')]=_0x59e74b[_0xe472('0x30')];this[_0xe472('0x18')][_0x59e74b[_0xe472('0x1a')]]['answertime']=moment()[_0xe472('0x1b')](_0xe472('0x1c'));this['channels'][_0x59e74b['uniqueid']][_0xe472('0x31')]='connect';logger[_0xe472('0x22')](_0xe472('0x32'),_0x59e74b[_0xe472('0x1a')],_0x59e74b[_0xe472('0x1e')]['substring'](_0x59e74b[_0xe472('0x1e')]['lastIndexOf']('/')+0x1,_0x59e74b[_0xe472('0x1e')][_0xe472('0x20')]('-')));logger[_0xe472('0x15')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x59e74b[_0xe472('0x1a')],util[_0xe472('0x17')](this['channels'][_0x59e74b[_0xe472('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xe472('0x13')]('custom:dialconnect',this[_0xe472('0x18')][_0x59e74b['uniqueid']]);}logger[_0xe472('0x15')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x59e74b['uniqueid'],util[_0xe472('0x17')](this[_0xe472('0x18')][_0x59e74b[_0xe472('0x1a')]],{'showHidden':![],'depth':null}));this[_0xe472('0x13')](_0xe472('0x27'),_0xe472('0x28'),this['channels'][_0x59e74b[_0xe472('0x1a')]]);}}}catch(_0x4eac30){logger[_0xe472('0x33')](_0xe472('0x34'),_0x59e74b[_0xe472('0x1a')],util['inspect'](_0x4eac30,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe472('0x11')]['syncVarSet']=function(_0x5bef6d){try{if(this['isNotNull'](_0x5bef6d)){logger[_0xe472('0x15')](_0xe472('0x35'),_0x5bef6d[_0xe472('0x1a')],util['inspect'](_0x5bef6d,{'showHidden':![],'depth':null}));this[_0xe472('0x36')](_0x5bef6d[_0xe472('0x1a')],_[_0xe472('0x37')](_0x5bef6d[_0xe472('0x38')])[0x0],_0x5bef6d[_0xe472('0x39')]);if(this['isNotNull'](_0x5bef6d['variable'])&&this[_0xe472('0x2b')](_0x5bef6d[_0xe472('0x38')][_0xe472('0x3a')])){if(_[_0xe472('0x12')](this[_0xe472('0x18')][_0x5bef6d[_0xe472('0x1a')]])){this[_0xe472('0x18')][_0x5bef6d[_0xe472('0x1a')]]={'routeId':_0x5bef6d[_0xe472('0x39')],'variables':this[_0xe472('0xb')][_0x5bef6d['uniqueid']],'motionChannel':_0xe472('0x3b')};logger[_0xe472('0x22')](_0xe472('0x3c'),_0x5bef6d[_0xe472('0x1a')],_0x5bef6d[_0xe472('0x38')][_0xe472('0x3a')],_[_0xe472('0x37')](_0x5bef6d[_0xe472('0x38')])[0x0],_0x5bef6d[_0xe472('0x39')]);logger[_0xe472('0x15')](_0xe472('0x3d'),_0x5bef6d[_0xe472('0x1a')],util[_0xe472('0x17')](this[_0xe472('0x18')][_0x5bef6d[_0xe472('0x1a')]],{'showHidden':![],'depth':null}));this[_0xe472('0x13')]('voice:outbound',_0xe472('0x28'),this[_0xe472('0x18')][_0x5bef6d[_0xe472('0x1a')]]);}}}}catch(_0x1ff6f7){logger[_0xe472('0x33')](_0xe472('0x3e'),_0x5bef6d[_0xe472('0x1a')],util[_0xe472('0x17')](_0x1ff6f7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe472('0x11')][_0xe472('0x36')]=function(_0x1f9a55,_0x5a4788,_0x8b6c9){var _0x5010d4=['rtpaudioqos','rtpaudioqosbridged',_0xe472('0x3f'),_0xe472('0x40'),_0xe472('0x41'),_0xe472('0x42'),_0xe472('0x43'),_0xe472('0x44'),'sipcallid',_0xe472('0x45'),_0xe472('0x46'),_0xe472('0x47'),_0xe472('0x48'),_0xe472('0x49'),_0xe472('0x4a'),'memberlastcall',_0xe472('0x4b'),_0xe472('0x4c'),_0xe472('0x4d')];if(!_[_0xe472('0x4e')](_0x5a4788)&&!_[_0xe472('0x4f')](_0x5010d4,_0x5a4788)){if(_[_0xe472('0x12')](this[_0xe472('0xb')][_0x1f9a55])){this[_0xe472('0xb')][_0x1f9a55]={};}this[_0xe472('0xb')][_0x1f9a55][_0x5a4788]=_0x8b6c9;}};VoiceDialReport['prototype'][_0xe472('0x50')]=function(_0x2672cd){try{if(this[_0xe472('0x2b')](_0x2672cd)){logger[_0xe472('0x15')](_0xe472('0x51'),_0x2672cd[_0xe472('0x1a')],util[_0xe472('0x17')](_0x2672cd,{'showHidden':![],'depth':null}));if(this[_0xe472('0x18')][_0x2672cd[_0xe472('0x1a')]]){logger[_0xe472('0x22')](_0xe472('0x52'),_0x2672cd[_0xe472('0x1a')],_0x2672cd[_0xe472('0x53')]);this['channels'][_0x2672cd['uniqueid']][_0xe472('0x54')]=moment()[_0xe472('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xe472('0x18')][_0x2672cd[_0xe472('0x1a')]]['duration']=moment(this[_0xe472('0x18')][_0x2672cd[_0xe472('0x1a')]][_0xe472('0x54')])[_0xe472('0x55')](this[_0xe472('0x18')][_0x2672cd[_0xe472('0x1a')]][_0xe472('0x56')],_0xe472('0x57'));this[_0xe472('0x18')][_0x2672cd[_0xe472('0x1a')]][_0xe472('0x31')]=_0xe472('0x58');this[_0xe472('0xa')]['total']+=0x1;if(this[_0xe472('0x18')][_0x2672cd[_0xe472('0x1a')]][_0xe472('0x59')]){this['outbound'][_0xe472('0x5a')]+=0x1;this[_0xe472('0x18')][_0x2672cd[_0xe472('0x1a')]]['holdtime']=moment(this[_0xe472('0x18')][_0x2672cd[_0xe472('0x1a')]][_0xe472('0x59')])[_0xe472('0x55')](this[_0xe472('0x18')][_0x2672cd[_0xe472('0x1a')]]['starttime'],_0xe472('0x57'));this[_0xe472('0x18')][_0x2672cd['uniqueid']][_0xe472('0x5b')]=moment(this[_0xe472('0x18')][_0x2672cd[_0xe472('0x1a')]][_0xe472('0x54')])['diff'](this[_0xe472('0x18')][_0x2672cd[_0xe472('0x1a')]][_0xe472('0x59')],_0xe472('0x57'));this[_0xe472('0xa')]['sumHoldTime']+=this['channels'][_0x2672cd[_0xe472('0x1a')]][_0xe472('0x5c')]||0x0;this[_0xe472('0xa')][_0xe472('0x5d')]+=this[_0xe472('0x18')][_0x2672cd[_0xe472('0x1a')]][_0xe472('0x5b')];}this['outbound'][_0xe472('0x5e')]+=this[_0xe472('0x18')][_0x2672cd[_0xe472('0x1a')]][_0xe472('0x5f')];logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x2672cd[_0xe472('0x1a')],util['inspect'](this[_0xe472('0x18')][_0x2672cd[_0xe472('0x1a')]],{'showHidden':![],'depth':null}));ami['emit'](_0xe472('0x60'),this[_0xe472('0x18')][_0x2672cd[_0xe472('0x1a')]]);logger[_0xe472('0x15')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x2672cd[_0xe472('0x1a')],util['inspect'](this[_0xe472('0x18')][_0x2672cd[_0xe472('0x1a')]],{'showHidden':![],'depth':null}));ami['emit'](_0xe472('0x61'),this[_0xe472('0x18')][_0x2672cd[_0xe472('0x1a')]]);logger[_0xe472('0x15')](_0xe472('0x62'),_0x2672cd[_0xe472('0x1a')],util['inspect'](this[_0xe472('0x18')][_0x2672cd[_0xe472('0x1a')]],{'showHidden':![],'depth':null}));this['emit'](_0xe472('0x27'),'voice_outbound:save',this['outbound']);logger[_0xe472('0x22')](_0xe472('0x63'),JSON['stringify'](this[_0xe472('0x18')][_0x2672cd[_0xe472('0x1a')]]));logger[_0xe472('0x15')](_0xe472('0x64'),_0x2672cd[_0xe472('0x1a')],util['inspect'](this[_0xe472('0x18')][_0x2672cd[_0xe472('0x1a')]],{'showHidden':![],'depth':null}));this['emit'](_0xe472('0x27'),_0xe472('0x65'),this[_0xe472('0x18')][_0x2672cd[_0xe472('0x1a')]]);this['deleteChannelAfterTimeout'](_0x2672cd[_0xe472('0x1a')]);}else if(this[_0xe472('0x18')][_0x2672cd['linkedid']]){this[_0xe472('0x18')][_0x2672cd[_0xe472('0x66')]][_0xe472('0x1a')]=this['channels'][_0x2672cd['linkedid']]['destuniqueid'];}if(this['variables'][_0x2672cd[_0xe472('0x1a')]]){delete this[_0xe472('0xb')][_0x2672cd['uniqueid']];}}}catch(_0x16de7a){logger[_0xe472('0x33')](_0xe472('0x67'),_0x2672cd[_0xe472('0x1a')],util[_0xe472('0x17')](_0x16de7a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe472('0x11')]['syncNewExten']=function(_0x22ae11){try{if(this[_0xe472('0x2b')](_0x22ae11)){logger[_0xe472('0x15')](_0xe472('0x68'),_0x22ae11['uniqueid'],util[_0xe472('0x17')](_0x22ae11,{'showHidden':![],'depth':null}));if(_0x22ae11['application']['toLowerCase']()==='set'){_0x22ae11[_0xe472('0x69')]=(_0x22ae11[_0xe472('0x6a')]||_0x22ae11['applicationdata'])[_0xe472('0x6b')]();if(_['startsWith'](_0x22ae11[_0xe472('0x69')],'cdr(')){if(_[_0xe472('0x12')](this[_0xe472('0x26')][_0x22ae11[_0xe472('0x1a')]]))this[_0xe472('0x26')][_0x22ae11[_0xe472('0x1a')]]={};logger[_0xe472('0x22')](_0xe472('0x6c'),_0x22ae11[_0xe472('0x1a')],_0x22ae11['application'],_0x22ae11[_0xe472('0x69')]);var _0x4a8bc4=_0x22ae11[_0xe472('0x69')][_0xe472('0x6d')]('=');var _0x171e61=_0x4a8bc4[0x0][_0xe472('0x6e')](/cdr\((.*)\)/);if(_0x171e61)this[_0xe472('0x26')][_0x22ae11[_0xe472('0x1a')]][_0x171e61[0x1]]=_0x4a8bc4[0x1];}}}}catch(_0x37976f){logger[_0xe472('0x33')]('[%s][voiceDialReport][newexten]',_0x22ae11[_0xe472('0x1a')],util['inspect'](_0x37976f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe472('0x11')]['deleteChannelAfterTimeout']=function(_0x18f32b,_0xe4af9f=0x2710){if(this[_0xe472('0x18')][_0x18f32b]){setTimeout(()=>{delete this[_0xe472('0x18')][_0x18f32b];},_0xe4af9f);}};module[_0xe472('0x6f')]=VoiceDialReport; \ No newline at end of file +var _0x34f3=['custom:dialbegin','error','syncDialEnd','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','voice_outbound_channel:save','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','variable','value','outboundrouteid','voice','keys','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberpenalty','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','format','duration','diff','starttime','seconds','complete','answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','toLowerCase','set','cdr(','application','applicationdata','split','match','[%s][voiceDialReport][newexten]','lodash','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','dialend','bind','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:'];(function(_0x375126,_0x514a8e){var _0x1f76bb=function(_0x22f2d0){while(--_0x22f2d0){_0x375126['push'](_0x375126['shift']());}};_0x1f76bb(++_0x514a8e);}(_0x34f3,0xbb));var _0x334f=function(_0x28f2dc,_0x1fff9d){_0x28f2dc=_0x28f2dc-0x0;var _0x5d471b=_0x34f3[_0x28f2dc];return _0x5d471b;};'use strict';var _=require(_0x334f('0x0'));var moment=require('moment');var util=require('util');var Redis=require('ioredis');var config=require(_0x334f('0x1'));var logger=require(_0x334f('0x2'))(_0x334f('0x3'));var ami=require(_0x334f('0x4'));config[_0x334f('0x5')]=_[_0x334f('0x6')](config[_0x334f('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x334f('0x7'))(new Redis(config['redis']));function VoiceDialReport(_0x4410fa){this[_0x334f('0x8')]=_0x4410fa[_0x334f('0x9')];this['outbound']=_0x4410fa[_0x334f('0xa')];this[_0x334f('0xb')]={};this[_0x334f('0xc')]={};ami['on'](_0x334f('0xd'),this[_0x334f('0xe')]['bind'](this));ami['on'](_0x334f('0xf'),this['syncDialEnd'][_0x334f('0x10')](this));ami['on']('varset',this[_0x334f('0x11')]['bind'](this));ami['on'](_0x334f('0x12'),this[_0x334f('0x13')][_0x334f('0x10')](this));}VoiceDialReport[_0x334f('0x14')][_0x334f('0x15')]=function(_0x4dc414){return _0x4dc414!==null&&!_[_0x334f('0x16')](_0x4dc414);};VoiceDialReport[_0x334f('0x14')][_0x334f('0x17')]=function(_0x3c1e9c,_0x20daae,_0x5a7f1e){io['to'](_0x3c1e9c)[_0x334f('0x17')](_0x20daae,_0x5a7f1e);};VoiceDialReport[_0x334f('0x14')][_0x334f('0xe')]=function(_0x20de84){try{if(this[_0x334f('0x15')](_0x20de84)){logger[_0x334f('0x18')](_0x334f('0x19'),_0x20de84[_0x334f('0x1a')],util[_0x334f('0x1b')](_0x20de84,{'showHidden':![],'depth':null}));if(this[_0x334f('0x8')][_0x20de84[_0x334f('0x1a')]]){_[_0x334f('0x1c')](this['channels'][_0x20de84[_0x334f('0x1a')]],{'starttime':moment()['format'](_0x334f('0x1d')),'lastevent':_0x334f('0x1e'),'interface':_0x20de84[_0x334f('0x1f')][_0x334f('0x20')](0x0,_0x20de84[_0x334f('0x1f')][_0x334f('0x21')]('-')),'membername':_0x20de84[_0x334f('0x1f')][_0x334f('0x20')](_0x20de84[_0x334f('0x1f')][_0x334f('0x21')]('/')+0x1,_0x20de84[_0x334f('0x1f')][_0x334f('0x21')]('-'))},_[_0x334f('0x22')](_0x20de84,[_0x334f('0x23'),_0x334f('0x24')]));logger[_0x334f('0x25')](_0x334f('0x26'),_0x20de84['uniqueid'],this[_0x334f('0x8')][_0x20de84[_0x334f('0x1a')]][_0x334f('0x27')],this['channels'][_0x20de84[_0x334f('0x1a')]]['interface']);logger['debug'](_0x334f('0x28'),_0x20de84[_0x334f('0x1a')],util['inspect'](this[_0x334f('0x8')][_0x20de84[_0x334f('0x1a')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x20de84[_0x334f('0x1a')]])_['merge'](this['channels'][_0x20de84[_0x334f('0x1a')]],this[_0x334f('0xb')][_0x20de84[_0x334f('0x1a')]]);this[_0x334f('0x17')](_0x334f('0x29'),'voice_outbound_channel:save',this['channels'][_0x20de84['uniqueid']]);logger['debug'](_0x334f('0x2a'),_0x20de84[_0x334f('0x1a')],util['inspect'](this['channels'][_0x20de84[_0x334f('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x334f('0x17')](_0x334f('0x2b'),this[_0x334f('0x8')][_0x20de84['uniqueid']]);}}}catch(_0x3b4f05){logger[_0x334f('0x2c')]('[%s][voiceDialReport][dialbegin]',_0x20de84[_0x334f('0x1a')],util[_0x334f('0x1b')](_0x3b4f05,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x334f('0x14')][_0x334f('0x2d')]=function(_0x22642d){try{if(this[_0x334f('0x15')](_0x22642d)){logger[_0x334f('0x18')]('[%s][voiceDialReport][dialend]\x20event:',_0x22642d[_0x334f('0x1a')],util[_0x334f('0x1b')](_0x22642d,{'showHidden':![],'depth':null}));if(this[_0x334f('0x8')][_0x22642d[_0x334f('0x1a')]]){this[_0x334f('0x8')][_0x22642d[_0x334f('0x1a')]]['dialstatus']=_0x22642d[_0x334f('0x2e')];if(_0x22642d[_0x334f('0x2e')]===_0x334f('0x2f')){this[_0x334f('0x8')][_0x22642d[_0x334f('0x1a')]][_0x334f('0x30')]=_0x22642d[_0x334f('0x30')];this['channels'][_0x22642d[_0x334f('0x1a')]][_0x334f('0x31')]=_0x22642d[_0x334f('0x31')];this[_0x334f('0x8')][_0x22642d[_0x334f('0x1a')]][_0x334f('0x32')]=moment()['format'](_0x334f('0x1d'));this['channels'][_0x22642d[_0x334f('0x1a')]][_0x334f('0x33')]='connect';logger[_0x334f('0x25')](_0x334f('0x34'),_0x22642d[_0x334f('0x1a')],_0x22642d[_0x334f('0x1f')]['substring'](_0x22642d[_0x334f('0x1f')][_0x334f('0x21')]('/')+0x1,_0x22642d['channel'][_0x334f('0x21')]('-')));logger[_0x334f('0x18')](_0x334f('0x35'),_0x22642d[_0x334f('0x1a')],util[_0x334f('0x1b')](this[_0x334f('0x8')][_0x22642d['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x334f('0x36'),this['channels'][_0x22642d[_0x334f('0x1a')]]);}logger[_0x334f('0x18')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x22642d[_0x334f('0x1a')],util[_0x334f('0x1b')](this[_0x334f('0x8')][_0x22642d['uniqueid']],{'showHidden':![],'depth':null}));this[_0x334f('0x17')](_0x334f('0x29'),_0x334f('0x37'),this[_0x334f('0x8')][_0x22642d[_0x334f('0x1a')]]);}}}catch(_0x3286b4){logger[_0x334f('0x2c')](_0x334f('0x38'),_0x22642d['uniqueid'],util[_0x334f('0x1b')](_0x3286b4,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x334f('0x14')][_0x334f('0x11')]=function(_0x854227){try{if(this[_0x334f('0x15')](_0x854227)){logger[_0x334f('0x18')](_0x334f('0x39'),_0x854227[_0x334f('0x1a')],util['inspect'](_0x854227,{'showHidden':![],'depth':null}));this[_0x334f('0x3a')](_0x854227[_0x334f('0x1a')],_['keys'](_0x854227[_0x334f('0x3b')])[0x0],_0x854227[_0x334f('0x3c')]);if(this[_0x334f('0x15')](_0x854227[_0x334f('0x3b')])&&this['isNotNull'](_0x854227[_0x334f('0x3b')][_0x334f('0x3d')])){if(_[_0x334f('0x16')](this[_0x334f('0x8')][_0x854227[_0x334f('0x1a')]])){this[_0x334f('0x8')][_0x854227[_0x334f('0x1a')]]={'routeId':_0x854227[_0x334f('0x3c')],'variables':this[_0x334f('0xc')][_0x854227['uniqueid']],'motionChannel':_0x334f('0x3e')};logger['info']('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x854227[_0x334f('0x1a')],_0x854227[_0x334f('0x3b')][_0x334f('0x3d')],_[_0x334f('0x3f')](_0x854227[_0x334f('0x3b')])[0x0],_0x854227['value']);logger[_0x334f('0x18')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x854227[_0x334f('0x1a')],util[_0x334f('0x1b')](this[_0x334f('0x8')][_0x854227[_0x334f('0x1a')]],{'showHidden':![],'depth':null}));this[_0x334f('0x17')](_0x334f('0x29'),_0x334f('0x37'),this[_0x334f('0x8')][_0x854227[_0x334f('0x1a')]]);}}}}catch(_0x319065){logger['error'](_0x334f('0x40'),_0x854227['uniqueid'],util['inspect'](_0x319065,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x334f('0x14')][_0x334f('0x3a')]=function(_0x13d3d2,_0x1e81ed,_0x5d525c){var _0x420a1e=[_0x334f('0x41'),_0x334f('0x42'),_0x334f('0x43'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0x334f('0x44'),_0x334f('0x45'),_0x334f('0x46'),'sipcallid',_0x334f('0x47'),_0x334f('0x48'),'bridgepvtcallid',_0x334f('0x49'),_0x334f('0x4a'),_0x334f('0x4b'),'memberlastcall',_0x334f('0x27'),_0x334f('0x4c'),'memberrealtime'];if(!_['isNil'](_0x1e81ed)&&!_[_0x334f('0x4d')](_0x420a1e,_0x1e81ed)){if(_[_0x334f('0x16')](this['variables'][_0x13d3d2])){this['variables'][_0x13d3d2]={};}this['variables'][_0x13d3d2][_0x1e81ed]=_0x5d525c;}};VoiceDialReport[_0x334f('0x14')][_0x334f('0x13')]=function(_0x13aaad){try{if(this[_0x334f('0x15')](_0x13aaad)){logger['debug']('[%s][voiceDialReport][hangup]\x20event:',_0x13aaad['uniqueid'],util[_0x334f('0x1b')](_0x13aaad,{'showHidden':![],'depth':null}));if(this['channels'][_0x13aaad[_0x334f('0x1a')]]){logger[_0x334f('0x25')](_0x334f('0x4e'),_0x13aaad[_0x334f('0x1a')],_0x13aaad[_0x334f('0x4f')]);this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]][_0x334f('0x50')]=moment()[_0x334f('0x51')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]][_0x334f('0x52')]=moment(this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]][_0x334f('0x50')])[_0x334f('0x53')](this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]][_0x334f('0x54')],_0x334f('0x55'));this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]][_0x334f('0x33')]=_0x334f('0x56');this[_0x334f('0xa')]['total']+=0x1;if(this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]][_0x334f('0x32')]){this[_0x334f('0xa')][_0x334f('0x57')]+=0x1;this['channels'][_0x13aaad['uniqueid']][_0x334f('0x58')]=moment(this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]][_0x334f('0x32')])[_0x334f('0x53')](this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]][_0x334f('0x54')],_0x334f('0x55'));this['channels'][_0x13aaad[_0x334f('0x1a')]][_0x334f('0x59')]=moment(this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]][_0x334f('0x50')])[_0x334f('0x53')](this['channels'][_0x13aaad[_0x334f('0x1a')]]['answertime'],_0x334f('0x55'));this[_0x334f('0xa')][_0x334f('0x5a')]+=this['channels'][_0x13aaad[_0x334f('0x1a')]]['holdtime']||0x0;this['outbound'][_0x334f('0x5b')]+=this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]]['billableseconds'];}this[_0x334f('0xa')][_0x334f('0x5c')]+=this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]][_0x334f('0x52')];logger[_0x334f('0x18')](_0x334f('0x5d'),_0x13aaad[_0x334f('0x1a')],util['inspect'](this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x334f('0x17')](_0x334f('0x5e'),this['channels'][_0x13aaad[_0x334f('0x1a')]]);logger['debug'](_0x334f('0x5f'),_0x13aaad[_0x334f('0x1a')],util[_0x334f('0x1b')](this['channels'][_0x13aaad[_0x334f('0x1a')]],{'showHidden':![],'depth':null}));ami['emit']('custom:dialend',this[_0x334f('0x8')][_0x13aaad[_0x334f('0x1a')]]);logger[_0x334f('0x18')](_0x334f('0x60'),_0x13aaad[_0x334f('0x1a')],util[_0x334f('0x1b')](this['channels'][_0x13aaad[_0x334f('0x1a')]],{'showHidden':![],'depth':null}));this['emit'](_0x334f('0x29'),_0x334f('0x61'),this[_0x334f('0xa')]);logger[_0x334f('0x25')](_0x334f('0x62'),JSON[_0x334f('0x63')](this[_0x334f('0x8')][_0x13aaad['uniqueid']]));logger[_0x334f('0x18')](_0x334f('0x64'),_0x13aaad['uniqueid'],util[_0x334f('0x1b')](this['channels'][_0x13aaad['uniqueid']],{'showHidden':![],'depth':null}));this[_0x334f('0x17')]('voice:outbound',_0x334f('0x65'),this['channels'][_0x13aaad['uniqueid']]);this[_0x334f('0x66')](_0x13aaad[_0x334f('0x1a')]);}else if(this[_0x334f('0x8')][_0x13aaad[_0x334f('0x67')]]){this['channels'][_0x13aaad['linkedid']][_0x334f('0x1a')]=this[_0x334f('0x8')][_0x13aaad[_0x334f('0x67')]]['destuniqueid'];}if(this[_0x334f('0xc')][_0x13aaad[_0x334f('0x1a')]]){delete this[_0x334f('0xc')][_0x13aaad['uniqueid']];}}}catch(_0x2dcdba){logger[_0x334f('0x2c')](_0x334f('0x68'),_0x13aaad[_0x334f('0x1a')],util[_0x334f('0x1b')](_0x2dcdba,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x334f('0x14')][_0x334f('0x69')]=function(_0x5a363a){try{if(this['isNotNull'](_0x5a363a)){logger[_0x334f('0x18')](_0x334f('0x6a'),_0x5a363a['uniqueid'],util['inspect'](_0x5a363a,{'showHidden':![],'depth':null}));if(_0x5a363a['application'][_0x334f('0x6b')]()===_0x334f('0x6c')){_0x5a363a['applicationdata']=(_0x5a363a['appdata']||_0x5a363a['applicationdata'])['toLowerCase']();if(_['startsWith'](_0x5a363a['applicationdata'],_0x334f('0x6d'))){if(_[_0x334f('0x16')](this[_0x334f('0xb')][_0x5a363a[_0x334f('0x1a')]]))this[_0x334f('0xb')][_0x5a363a[_0x334f('0x1a')]]={};logger[_0x334f('0x25')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x5a363a['uniqueid'],_0x5a363a[_0x334f('0x6e')],_0x5a363a[_0x334f('0x6f')]);var _0x2d543f=_0x5a363a['applicationdata'][_0x334f('0x70')]('=');var _0x4db970=_0x2d543f[0x0][_0x334f('0x71')](/cdr\((.*)\)/);if(_0x4db970)this[_0x334f('0xb')][_0x5a363a[_0x334f('0x1a')]][_0x4db970[0x1]]=_0x2d543f[0x1];}}}}catch(_0x1fc0c7){logger[_0x334f('0x2c')](_0x334f('0x72'),_0x5a363a['uniqueid'],util[_0x334f('0x1b')](_0x1fc0c7,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['deleteChannelAfterTimeout']=function(_0x2f763c,_0x25c649=0x2710){if(this[_0x334f('0x8')][_0x2f763c]){setTimeout(()=>{delete this[_0x334f('0x8')][_0x2f763c];},_0x25c649);}};module['exports']=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index ec5a1f6..40028a4 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 _0xd0d8=['info','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerabandon]','syncQueueCallerLeave','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','queuecallerexitAt','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','linkedid','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','COMPLETEDBY','reason','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','TIMEOUT','lastevent','custom:timeout','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','membername','memberrealtime','handleHangup','length','diff','seconds','milliseconds','total','answered','sumBillable','queuecallercompleteAt','unmanaged','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','sumDuration','sumHoldTime','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','assign','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','cause-txt','cause','[%s][voiceQueueReport][hangup]','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','switch','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transferid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','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]','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','mohtime','syncNewExten','application','set','applicationdata','appdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceQueueReport][newexten]','exports','lodash','util','ioredis','ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','localhost','prototype','tail','finally','sequence','queueReports','realtime','agents','queueChannels','voiceQueues','campaigns','summary','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','hasOwnProperty','isEmpty','waiting','queueStatusComplete','unlockRR','queuecallerexit','queuecallercomplete','clearZombieChannels','channels','isNil','Action','status','channel','catch','message','[%s][voiceQueueReport][checkChannel]','inspect','error','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','queue',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','voice_queue_channel:remove','voice_queue_presence:remove','type','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isUndefined','loopQueueShow','queues','[voiceQueueReport][queues]','isRunning','then','actionid','queuestatus','[voiceQueueReport][queuesummary]','createQueueSummaryReport','summaryEvent','handleInboundQueueSummaryReport','outbound','custom:queuesummary','statusRequests','syncQueueSummaryComplete','completeEvent','syncQueueMember','isNotNull','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','position','count','keys','emitVoiceQueueChannelSave','last','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','ABANDONED','lastAssignedTo'];(function(_0x5c9e86,_0x42e936){var _0x59c5da=function(_0x49ec30){while(--_0x49ec30){_0x5c9e86['push'](_0x5c9e86['shift']());}};_0x59c5da(++_0x42e936);}(_0xd0d8,0x15f));var _0x8d0d=function(_0x57d628,_0xda6747){_0x57d628=_0x57d628-0x0;var _0x2f8486=_0xd0d8[_0x57d628];return _0x2f8486;};'use strict';var _=require(_0x8d0d('0x0'));var moment=require('moment');var util=require(_0x8d0d('0x1'));var Redis=require(_0x8d0d('0x2'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x8d0d('0x3'));var ami=require('../ami');var QueueReport=require(_0x8d0d('0x4'));var VoiceQueueSummary=require(_0x8d0d('0x5'));config[_0x8d0d('0x6')]=_[_0x8d0d('0x7')](config[_0x8d0d('0x6')],{'host':_0x8d0d('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8d0d('0x6')]));var Sequence=function(){};Sequence[_0x8d0d('0x9')]['enqueue']=function(_0x78c813){this[_0x8d0d('0xa')]=this[_0x8d0d('0xa')]?this[_0x8d0d('0xa')][_0x8d0d('0xb')](_0x78c813):_0x78c813();};function VoiceQueueReport(_0x42e1a7){this[_0x8d0d('0xc')]=new Sequence();this[_0x8d0d('0xd')]={};this[_0x8d0d('0xe')]=_0x42e1a7;this[_0x8d0d('0xf')]=_0x42e1a7[_0x8d0d('0xf')];this['channels']=_0x42e1a7[_0x8d0d('0x10')];this[_0x8d0d('0x11')]=_0x42e1a7['voiceQueues'];this[_0x8d0d('0x12')]=_0x42e1a7[_0x8d0d('0x12')];this[_0x8d0d('0x13')]=initializeSummary();this[_0x8d0d('0x14')]={};ami['on'](_0x8d0d('0x15'),this[_0x8d0d('0x16')][_0x8d0d('0x17')](this));ami['on'](_0x8d0d('0x18'),this['syncQueueSummaryComplete']['bind'](this));ami['on']('queuemember',this['syncQueueMember'][_0x8d0d('0x17')](this));ami['on'](_0x8d0d('0x19'),this[_0x8d0d('0x1a')][_0x8d0d('0x17')](this));ami['on'](_0x8d0d('0x1b'),this[_0x8d0d('0x1c')][_0x8d0d('0x17')](this));ami['on'](_0x8d0d('0x1d'),this[_0x8d0d('0x1e')][_0x8d0d('0x17')](this));ami['on'](_0x8d0d('0x1f'),this['syncQueueCallerLeave'][_0x8d0d('0x17')](this));ami['on'](_0x8d0d('0x20'),this[_0x8d0d('0x21')][_0x8d0d('0x17')](this));ami['on'](_0x8d0d('0x22'),this[_0x8d0d('0x23')][_0x8d0d('0x17')](this));ami['on'](_0x8d0d('0x24'),this[_0x8d0d('0x25')][_0x8d0d('0x17')](this));ami['on'](_0x8d0d('0x26'),this[_0x8d0d('0x27')]['bind'](this));ami['on'](_0x8d0d('0x28'),this[_0x8d0d('0x29')][_0x8d0d('0x17')](this));ami['on'](_0x8d0d('0x2a'),this[_0x8d0d('0x2b')]['bind'](this));ami['on'](_0x8d0d('0x2c'),this[_0x8d0d('0x2d')][_0x8d0d('0x17')](this));ami['on'](_0x8d0d('0x2e'),this[_0x8d0d('0x2f')][_0x8d0d('0x17')](this));ami['on'](_0x8d0d('0x30'),this[_0x8d0d('0x31')][_0x8d0d('0x17')](this));this[_0x8d0d('0x32')]();this['loopQueueShow']();}function clearChannels(_0x47ee6b){if(!_['isEmpty'](_0x47ee6b)){for(var _0x3bbcdc in _0x47ee6b){if(_0x47ee6b[_0x8d0d('0x33')](_0x3bbcdc)){delete _0x47ee6b[_0x3bbcdc];}}}}function clearCampaigns(_0x1e83b){if(!_[_0x8d0d('0x34')](_0x1e83b)){for(var _0x6ba151 in _0x1e83b){if(_0x1e83b[_0x8d0d('0x33')](_0x6ba151)){_0x1e83b[_0x6ba151]['originated']=0x0;}}}}function clearVoiceQueues(_0x2a79de){if(!_[_0x8d0d('0x34')](_0x2a79de)){for(var _0x4ffe0a in _0x2a79de){if(_0x2a79de[_0x8d0d('0x33')](_0x4ffe0a)){_0x2a79de[_0x4ffe0a]['originated']=0x0;_0x2a79de[_0x4ffe0a]['talking']=0x0;_0x2a79de[_0x4ffe0a]['pTalking']=0x0;_0x2a79de[_0x4ffe0a][_0x8d0d('0x35')]=0x0;_0x2a79de[_0x4ffe0a][_0x8d0d('0x36')]=!![];}}}}function clearAgentBooked(_0x56496c){if(!_['isEmpty'](_0x56496c)){for(var _0xc7f7f4 in _0x56496c){if(_0x56496c['hasOwnProperty'](_0xc7f7f4)){_0x56496c[_0xc7f7f4][_0x8d0d('0x37')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x32ea10){return _0x32ea10[_0x8d0d('0x38')]||_0x32ea10['queuecallerabandon']||_0x32ea10[_0x8d0d('0x39')];}VoiceQueueReport[_0x8d0d('0x9')][_0x8d0d('0x3a')]=function(){var _0x38ec86=this;for(var _0x452439 in this[_0x8d0d('0x3b')]){if(this[_0x8d0d('0x3b')][_0x8d0d('0x33')](_0x452439)&&!this[_0x8d0d('0x3b')][_0x452439]['switch']){this['sequence']['enqueue'](function(){if(!_[_0x8d0d('0x3c')](_0x38ec86[_0x8d0d('0x3b')][_0x452439])){return ami[_0x8d0d('0x3d')]({'action':_0x8d0d('0x3e'),'channel':_0x38ec86['channels'][_0x452439][_0x8d0d('0x3f')]})[_0x8d0d('0x40')](function(_0x229ac5){if(_0x229ac5[_0x8d0d('0x41')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x38ec86['channels'][_0x452439]){delete _0x38ec86[_0x8d0d('0x3b')][_0x452439];logger['error'](_0x8d0d('0x42'),_0x452439,util[_0x8d0d('0x43')](_0x229ac5,{'showHidden':![],'depth':null}));}if(_0x38ec86['queueReports'][_0x452439]){delete _0x38ec86[_0x8d0d('0xd')][_0x452439];logger[_0x8d0d('0x44')](_0x8d0d('0x45'),_0x452439,util['inspect'](_0x229ac5,{'showHidden':![],'depth':null}));}if(_0x38ec86[_0x8d0d('0x14')][_0x452439]){delete _0x38ec86['variables'][_0x452439];logger['error'](_0x8d0d('0x46'),_0x452439,util['inspect'](_0x229ac5,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x8d0d('0x9')][_0x8d0d('0x29')]=function(){logger[_0x8d0d('0x44')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0x8d0d('0x3b')]);this[_0x8d0d('0x47')](this[_0x8d0d('0xd')]);clearAgentBooked(this[_0x8d0d('0xf')]);clearVoiceQueues(this[_0x8d0d('0x11')]);clearCampaigns(this[_0x8d0d('0x12')]);this[_0x8d0d('0x13')]=initializeSummary();};VoiceQueueReport[_0x8d0d('0x9')][_0x8d0d('0x47')]=function(_0x13afc4){var _0x2b9651=this;if(!_['isEmpty'](_0x13afc4)){for(var _0x38b932 in _0x13afc4){if(_0x13afc4[_0x8d0d('0x33')](_0x38b932)){_0x2b9651[_0x8d0d('0x48')](_0x13afc4[_0x38b932],_0x8d0d('0x49'));delete _0x13afc4[_0x38b932];}}}};VoiceQueueReport[_0x8d0d('0x9')][_0x8d0d('0x4a')]=function(_0x450ef8,_0x5bbd57,_0x47bab2){io['to'](_0x450ef8)[_0x8d0d('0x4a')](_0x5bbd57,_0x47bab2);};VoiceQueueReport['prototype']['emitVoiceQueueChannelSave']=function(_0x15efa3,_0x28c0b8){logger[_0x8d0d('0x4b')](_0x8d0d('0x4c')+_0x28c0b8+_0x8d0d('0x4d'),_0x15efa3[_0x8d0d('0x4e')],util[_0x8d0d('0x43')](_0x15efa3,{'showHidden':![],'depth':null}));this[_0x8d0d('0x4a')](util[_0x8d0d('0x4f')](_0x8d0d('0x50'),_0x15efa3[_0x8d0d('0x51')]),'voice_queue_channel:save',_0x15efa3);io[_0x8d0d('0x4a')]('voice_queue_presence:save',_0x15efa3);};VoiceQueueReport[_0x8d0d('0x9')][_0x8d0d('0x48')]=function(_0x22c030,_0x421b07){logger[_0x8d0d('0x4b')](_0x8d0d('0x4c')+_0x421b07+_0x8d0d('0x52'),_0x22c030[_0x8d0d('0x4e')],util[_0x8d0d('0x43')](_0x22c030,{'showHidden':![],'depth':null}));if(_0x22c030[_0x8d0d('0x53')]===_0x8d0d('0x54')){return;}this[_0x8d0d('0x4a')](util[_0x8d0d('0x4f')]('voice:queue:%s',_0x22c030[_0x8d0d('0x51')]),_0x8d0d('0x55'),_0x22c030);io[_0x8d0d('0x4a')](_0x8d0d('0x56'),_0x22c030);};VoiceQueueReport[_0x8d0d('0x9')]['emitInboundVoiceQueueSummary']=function(_0x2a1f0f){if(_0x2a1f0f[_0x8d0d('0x57')]===_0x8d0d('0x58')){logger[_0x8d0d('0x4b')](_0x8d0d('0x59'),util[_0x8d0d('0x43')](_0x2a1f0f,{'showHidden':![],'depth':null}));this[_0x8d0d('0x4a')](util['format'](_0x8d0d('0x50'),_0x2a1f0f[_0x8d0d('0x5a')]),_0x8d0d('0x5b'),_0x2a1f0f);}};VoiceQueueReport[_0x8d0d('0x9')]['isNotNull']=function(_0x41ac7d){return _0x41ac7d!==null&&!_[_0x8d0d('0x5c')](_0x41ac7d);};VoiceQueueReport[_0x8d0d('0x9')][_0x8d0d('0x5d')]=function(){var _0x34404d=this;setInterval(function(){_0x34404d[_0x8d0d('0x3a')]();ami['Action']({'action':_0x8d0d('0x5e')})[_0x8d0d('0x40')](function(_0x4a665e){logger['error'](_0x8d0d('0x5f'),util[_0x8d0d('0x43')](_0x4a665e,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x8d0d('0x9')][_0x8d0d('0x32')]=function(){var _0x5f14c6=this;setInterval(function(){if(!_0x5f14c6['summary'][_0x8d0d('0x60')]){return ami[_0x8d0d('0x3d')]({'action':_0x8d0d('0x15')})[_0x8d0d('0x61')](function(_0x1e8520){_0x5f14c6['summary']['id']=_0x1e8520[_0x8d0d('0x62')];_0x5f14c6[_0x8d0d('0x13')][_0x8d0d('0x60')]=!![];_0x5f14c6[_0x8d0d('0x13')][_0x8d0d('0x63')][_0x1e8520[_0x8d0d('0x62')]]={};})['catch'](function(_0xf438aa){logger[_0x8d0d('0x44')](_0x8d0d('0x64'),util['inspect'](_0xf438aa,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x8d0d('0x9')][_0x8d0d('0x65')]=function(_0x4ad063,_0x33063a){var _0x5b94d4;if(this[_0x8d0d('0x13')]&&this[_0x8d0d('0x13')][_0x8d0d('0x5e')]&&this[_0x8d0d('0x13')][_0x8d0d('0x5e')][_0x4ad063[_0x8d0d('0x5a')]]){_0x5b94d4=this[_0x8d0d('0x13')][_0x8d0d('0x5e')][_0x4ad063[_0x8d0d('0x5a')]][_0x8d0d('0x66')];}var _0x4426d3=new VoiceQueueSummary(_0x4ad063);return _0x4426d3['createReport'](_0x33063a[_0x8d0d('0xf')],this[_0x8d0d('0xf')],_0x5b94d4,this['realtime'][_0x8d0d('0x3b')]);};VoiceQueueReport['prototype'][_0x8d0d('0x67')]=function(_0x5cd730,_0x7326b4){var _0x53afeb=this['createQueueSummaryReport'](_0x5cd730,_0x7326b4);var _0xa3c171=![];_0xa3c171=_0x53afeb['compareToInboundQueue'](_0x5cd730);if(_0xa3c171){Object['assign'](_0x5cd730,_0x53afeb);this['realtime'][_0x8d0d('0x11')][_0x5cd730[_0x8d0d('0x5a')]]=_0x5cd730;this['emitInboundVoiceQueueSummary'](_0x53afeb);}};VoiceQueueReport[_0x8d0d('0x9')]['syncQueueStatusComplete']=function(_0x23ed54){var _0x3ce89d=null;var _0xcac091=this['summary']['id'];if(this[_0x8d0d('0x13')]['queuestatus'][_0xcac091]){_0x3ce89d=this['summary'][_0x8d0d('0x63')][_0xcac091][_0x23ed54[_0x8d0d('0x62')]];}if(!_0x3ce89d){this[_0x8d0d('0x13')]=initializeSummary();return;}var _0x59fff6=this[_0x8d0d('0x11')][_0x3ce89d[_0x8d0d('0x51')]];if(_0x59fff6[_0x8d0d('0x57')]==='inbound'){this[_0x8d0d('0x67')](_0x59fff6,_0x3ce89d);}else if(_0x59fff6[_0x8d0d('0x57')]===_0x8d0d('0x68')){var _0x4f850e=this[_0x8d0d('0x65')](_0x59fff6,_0x3ce89d);ami[_0x8d0d('0x4a')](_0x8d0d('0x69'),_0x4f850e);}this[_0x8d0d('0x13')][_0x8d0d('0x6a')]-=0x1;var _0x3a0f17=this[_0x8d0d('0x13')]['statusRequests']>0x0?!![]:![];if(!_0x3a0f17){return this[_0x8d0d('0x6b')](this[_0x8d0d('0x13')][_0x8d0d('0x6c')]);}};VoiceQueueReport[_0x8d0d('0x9')][_0x8d0d('0x6d')]=function(_0x4437b7){var _0x356e4d=this['summary']['id'];if(this[_0x8d0d('0x13')][_0x8d0d('0x63')][_0x356e4d]&&this[_0x8d0d('0x13')][_0x8d0d('0x63')][_0x356e4d][_0x4437b7[_0x8d0d('0x62')]]){this[_0x8d0d('0x13')][_0x8d0d('0x63')][_0x356e4d][_0x4437b7[_0x8d0d('0x62')]][_0x8d0d('0xf')]['push'](_0x4437b7);}};VoiceQueueReport[_0x8d0d('0x9')]['syncQueueSummary']=function(_0x1bf939){var _0x5664a3=this;try{if(this[_0x8d0d('0x6e')](_0x1bf939)&&this[_0x8d0d('0x6e')](_0x1bf939[_0x8d0d('0x51')])){logger[_0x8d0d('0x4b')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x8d0d('0x43')](_0x1bf939,{'showHidden':![],'depth':null}));var _0x368125=this[_0x8d0d('0x11')][_0x1bf939[_0x8d0d('0x51')]];if(_0x368125){logger['debug'](_0x8d0d('0x6f'),_0x368125[_0x8d0d('0x5a')]);this[_0x8d0d('0x13')][_0x8d0d('0x5e')][_0x368125[_0x8d0d('0x5a')]]={'summaryEvent':_0x1bf939};this['summary'][_0x8d0d('0x6a')]+=0x1;return ami[_0x8d0d('0x3d')]({'action':'queuestatus','queue':_0x368125['name']})['then'](function(_0x15298a){if(!_0x5664a3[_0x8d0d('0x13')][_0x8d0d('0x63')][_0x1bf939[_0x8d0d('0x62')]]){_0x5664a3['summary'][_0x8d0d('0x63')][_0x1bf939[_0x8d0d('0x62')]]={};}_0x5664a3[_0x8d0d('0x13')][_0x8d0d('0x63')][_0x1bf939[_0x8d0d('0x62')]][_0x15298a[_0x8d0d('0x62')]]={'queue':_0x368125[_0x8d0d('0x5a')],'agents':[]};})[_0x8d0d('0x40')](function(_0x3fb67b){throw _0x3fb67b;});}}}catch(_0x13502f){logger[_0x8d0d('0x44')](_0x8d0d('0x64'),util[_0x8d0d('0x43')](_0x13502f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8d0d('0x9')][_0x8d0d('0x6b')]=function(_0x402136){if(this[_0x8d0d('0x13')][_0x8d0d('0x6a')]>0x0){this[_0x8d0d('0x13')][_0x8d0d('0x6c')]=_0x402136;return;}logger['debug'](_0x8d0d('0x70'),util[_0x8d0d('0x43')](_0x402136,{'showHidden':![],'depth':null}));this[_0x8d0d('0x13')]=initializeSummary();ami[_0x8d0d('0x4a')](_0x8d0d('0x71'),{});};VoiceQueueReport[_0x8d0d('0x9')][_0x8d0d('0x1c')]=function(_0x4e7315){try{if(this['isNotNull'](_0x4e7315)){logger[_0x8d0d('0x4b')](_0x8d0d('0x72'),_0x4e7315['uniqueid'],util['inspect'](_0x4e7315,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x8d0d('0xd')][_0x4e7315[_0x8d0d('0x4e')]])){this[_0x8d0d('0xd')][_0x4e7315['uniqueid']]=[];}if(_['isUndefined'](this[_0x8d0d('0x3b')][_0x4e7315[_0x8d0d('0x4e')]])){this[_0x8d0d('0x3b')][_0x4e7315[_0x8d0d('0x4e')]]={};}var _0x1686f7=new QueueReport();_0x1686f7[_0x8d0d('0x51')]=_0x4e7315['queue'];_0x1686f7[_0x8d0d('0x57')]=this[_0x8d0d('0x11')][_0x1686f7[_0x8d0d('0x51')]]&&this[_0x8d0d('0x11')][_0x1686f7[_0x8d0d('0x51')]][_0x8d0d('0x57')]?this['voiceQueues'][_0x1686f7[_0x8d0d('0x51')]][_0x8d0d('0x57')]||_0x8d0d('0x58'):_0x8d0d('0x58');_0x1686f7[_0x8d0d('0x73')]=moment()[_0x8d0d('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x1686f7[_0x8d0d('0x74')]=_0x4e7315[_0x8d0d('0x74')];_0x1686f7[_0x8d0d('0x75')]=_0x4e7315[_0x8d0d('0x75')];_0x1686f7[_0x8d0d('0x4e')]=_0x4e7315['uniqueid'];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x1686f7[_0x8d0d('0x51')],_0x1686f7[_0x8d0d('0x57')]);Object['assign'](_0x1686f7,_['pick'](_0x4e7315,_[_0x8d0d('0x76')](_0x1686f7)));this[_0x8d0d('0xd')][_0x4e7315[_0x8d0d('0x4e')]]['push'](_0x1686f7);this[_0x8d0d('0x3b')][_0x4e7315['uniqueid']]=_0x1686f7;this[_0x8d0d('0x77')](_0x1686f7,_0x8d0d('0x1b'));}}catch(_0x194f85){logger[_0x8d0d('0x44')](_0x8d0d('0x72'),_0x4e7315['uniqueid'],util[_0x8d0d('0x43')](_0x194f85,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8d0d('0x9')][_0x8d0d('0x1e')]=function(_0x290650){try{if(this['isNotNull'](_0x290650)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x290650[_0x8d0d('0x4e')],util[_0x8d0d('0x43')](_0x290650,{'showHidden':![],'depth':null}));if(this[_0x8d0d('0xd')][_0x290650[_0x8d0d('0x4e')]]){var _0x1be1d7=_[_0x8d0d('0x78')](this['queueReports'][_0x290650['uniqueid']]);_0x1be1d7['queuecallercomplete']=![];_0x1be1d7['queuecallercompleteAt']=null;_0x1be1d7[_0x8d0d('0x79')]=_0x290650['holdtime'];_0x1be1d7[_0x8d0d('0x7a')]=_0x290650[_0x8d0d('0x7a')];_0x1be1d7[_0x8d0d('0x1d')]=!![];_0x1be1d7[_0x8d0d('0x7b')]=moment()[_0x8d0d('0x4f')](_0x8d0d('0x7c'));_0x1be1d7['queuecallerexitreason']=_0x8d0d('0x7d');_0x1be1d7[_0x8d0d('0x7e')]=null;logger[_0x8d0d('0x7f')](_0x8d0d('0x80'),_0x1be1d7['queue'],_0x1be1d7[_0x8d0d('0x57')]);this['channels'][_0x290650['uniqueid']]=_0x1be1d7;this['emitVoiceQueueChannelRemove'](_0x1be1d7,_0x8d0d('0x1d'));}}}catch(_0x45aa4d){logger[_0x8d0d('0x44')](_0x8d0d('0x81'),_0x290650[_0x8d0d('0x4e')],util[_0x8d0d('0x43')](_0x45aa4d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8d0d('0x9')][_0x8d0d('0x82')]=function(_0x11591f){try{if(this[_0x8d0d('0x6e')](_0x11591f)){logger[_0x8d0d('0x4b')](_0x8d0d('0x83'),_0x11591f['uniqueid'],util[_0x8d0d('0x43')](_0x11591f,{'showHidden':![],'depth':null}));if(this[_0x8d0d('0xd')][_0x11591f[_0x8d0d('0x4e')]]){var _0x582873=_[_0x8d0d('0x78')](this['queueReports'][_0x11591f[_0x8d0d('0x4e')]]);_0x582873[_0x8d0d('0x84')]=moment()[_0x8d0d('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x582873[_0x8d0d('0x85')]=_0x11591f['connectedlinenum'];_0x582873[_0x8d0d('0x86')]=_0x11591f[_0x8d0d('0x86')];logger[_0x8d0d('0x7f')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x582873[_0x8d0d('0x51')],_0x582873[_0x8d0d('0x57')],_0x11591f[_0x8d0d('0x85')],_0x11591f[_0x8d0d('0x86')]);this[_0x8d0d('0x3b')][_0x11591f[_0x8d0d('0x4e')]]=_0x582873;this[_0x8d0d('0x77')](_0x582873,'queuecallerleave');}}}catch(_0x482cde){logger[_0x8d0d('0x44')]('[%s][voiceQueueReport][queuecallerleave]',_0x11591f[_0x8d0d('0x4e')],util[_0x8d0d('0x43')](_0x482cde,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8d0d('0x9')][_0x8d0d('0x23')]=function(_0x3c5f93){try{if(this[_0x8d0d('0x6e')](_0x3c5f93)){logger[_0x8d0d('0x4b')](_0x8d0d('0x87'),_0x3c5f93[_0x8d0d('0x4e')],util[_0x8d0d('0x43')](_0x3c5f93,{'showHidden':![],'depth':null}));if(this[_0x8d0d('0xd')][_0x3c5f93[_0x8d0d('0x4e')]]){var _0x58ff5c=_[_0x8d0d('0x78')](this[_0x8d0d('0xd')][_0x3c5f93[_0x8d0d('0x4e')]]);_0x58ff5c[_0x8d0d('0x39')]=!![];_0x58ff5c[_0x8d0d('0x53')]=_0x8d0d('0x88');logger[_0x8d0d('0x7f')](_0x8d0d('0x89'),_0x58ff5c[_0x8d0d('0x51')],_0x58ff5c[_0x8d0d('0x57')]);}}}catch(_0x59ceab){logger[_0x8d0d('0x44')](_0x8d0d('0x87'),_0x3c5f93['uniqueid'],util[_0x8d0d('0x43')](_0x59ceab,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8d0d('0x9')][_0x8d0d('0x21')]=function(_0x2fe7d0){try{if(this['isNotNull'](_0x2fe7d0)){logger[_0x8d0d('0x4b')](_0x8d0d('0x8a'),_0x2fe7d0['uniqueid'],util[_0x8d0d('0x43')](_0x2fe7d0,{'showHidden':![],'depth':null}));if(this[_0x8d0d('0xd')][_0x2fe7d0[_0x8d0d('0x4e')]]){var _0x5f3905=_[_0x8d0d('0x78')](this[_0x8d0d('0xd')][_0x2fe7d0[_0x8d0d('0x4e')]]);_0x5f3905[_0x8d0d('0x1d')]=![];_0x5f3905[_0x8d0d('0x7b')]=null;_0x5f3905['assigned']=!![];_0x5f3905[_0x8d0d('0x7e')]=_0x2fe7d0['membername'];_0x5f3905[_0x8d0d('0x79')]=_0x2fe7d0['holdtime'];_0x5f3905['queuecallercomplete']=!![];_0x5f3905[_0x8d0d('0x38')]=![];_0x5f3905[_0x8d0d('0x8b')]=null;if(!_0x5f3905[_0x8d0d('0x8c')]){if(_0x2fe7d0['reason']=='transfer'){_0x5f3905[_0x8d0d('0x53')]=_0x8d0d('0x8d');logger[_0x8d0d('0x7f')](_0x8d0d('0x8e'),_0x5f3905[_0x8d0d('0x51')],_0x5f3905[_0x8d0d('0x57')]);}else{if(_[_0x8d0d('0x8f')](_0x2fe7d0['channel'][_0x8d0d('0x90')](),'local/')){if(this[_0x8d0d('0xd')][_0x2fe7d0[_0x8d0d('0x91')]]){var _0x37e296=_[_0x8d0d('0x78')](this[_0x8d0d('0xd')][_0x2fe7d0[_0x8d0d('0x91')]]);_0x37e296[_0x8d0d('0x39')]=![];_0x37e296[_0x8d0d('0x38')]=!![];_0x37e296[_0x8d0d('0x8b')]=moment(_0x5f3905[_0x8d0d('0x73')])['add'](_0x2fe7d0['holdtime'],'seconds')[_0x8d0d('0x4f')](_0x8d0d('0x7c'));_0x37e296[_0x8d0d('0x53')]=_0x8d0d('0x92');_0x37e296[_0x8d0d('0x8c')]=!![];_0x37e296[_0x8d0d('0x93')]=_0x8d0d('0x94');_0x37e296[_0x8d0d('0x95')]=_0x2fe7d0[_0x8d0d('0x96')];_0x37e296[_0x8d0d('0x97')]=_0x2fe7d0[_0x8d0d('0x4e')];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x37e296[_0x8d0d('0x51')],_0x37e296[_0x8d0d('0x57')]);var _0x3bfb50=this[_0x8d0d('0xd')][_0x2fe7d0['linkedid']];this[_0x8d0d('0xd')][_0x2fe7d0[_0x8d0d('0x91')]]=this[_0x8d0d('0xd')][_0x2fe7d0['uniqueid']];this[_0x8d0d('0xd')][_0x2fe7d0[_0x8d0d('0x4e')]]=_0x3bfb50;}}else{_0x5f3905['queuecallerexitreason']=_0x8d0d('0x98')+_0x2fe7d0[_0x8d0d('0x99')][_0x8d0d('0x9a')]();logger[_0x8d0d('0x7f')](_0x8d0d('0x9b'),_0x5f3905[_0x8d0d('0x51')],_0x5f3905[_0x8d0d('0x57')],_0x5f3905['queuecallerexitreason']);}}}this[_0x8d0d('0x3b')][_0x2fe7d0[_0x8d0d('0x4e')]]=_0x5f3905;}}}catch(_0x1c5112){logger[_0x8d0d('0x44')](_0x8d0d('0x8a'),_0x2fe7d0[_0x8d0d('0x4e')],util[_0x8d0d('0x43')](_0x1c5112,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8d0d('0x9')][_0x8d0d('0x25')]=function(_0x16c9a8){try{if(this[_0x8d0d('0x6e')](_0x16c9a8)){logger[_0x8d0d('0x4b')](_0x8d0d('0x9c'),_0x16c9a8['uniqueid'],util[_0x8d0d('0x43')](_0x16c9a8,{'showHidden':![],'depth':null}));this[_0x8d0d('0x9d')](_0x16c9a8[_0x8d0d('0x4e')],_[_0x8d0d('0x76')](_0x16c9a8[_0x8d0d('0x9e')])[0x0],_0x16c9a8[_0x8d0d('0x9f')]);if(this[_0x8d0d('0xd')][_0x16c9a8[_0x8d0d('0x4e')]]){var _0x5f401e=_[_0x8d0d('0x78')](this['queueReports'][_0x16c9a8[_0x8d0d('0x4e')]]);if(_0x5f401e){if(this[_0x8d0d('0x6e')](_0x16c9a8[_0x8d0d('0x9e')])&&this[_0x8d0d('0x6e')](_0x16c9a8['variable'][_0x8d0d('0x63')])){switch(_0x16c9a8[_0x8d0d('0x9f')]){case _0x8d0d('0xa0'):_0x5f401e[_0x8d0d('0x38')]=![];_0x5f401e[_0x8d0d('0x8b')]=null;break;case _0x8d0d('0xa1'):_0x5f401e[_0x8d0d('0xa2')]='timeout';_0x5f401e[_0x8d0d('0x38')]=!![];_0x5f401e[_0x8d0d('0x8b')]=moment()[_0x8d0d('0x4f')](_0x8d0d('0x7c'));_0x5f401e[_0x8d0d('0x84')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0x8d0d('0x4b')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x16c9a8[_0x8d0d('0x4e')],util[_0x8d0d('0x43')](_0x5f401e,{'showHidden':![],'depth':null}));ami['emit'](_0x8d0d('0xa3'),_0x5f401e);break;default:_0x5f401e[_0x8d0d('0x38')]=!![];_0x5f401e[_0x8d0d('0x8b')]=moment()[_0x8d0d('0x4f')](_0x8d0d('0x7c'));_0x5f401e[_0x8d0d('0x84')]=moment()[_0x8d0d('0x4f')](_0x8d0d('0x7c'));}_0x5f401e['queuecallerabandon']=![];_0x5f401e[_0x8d0d('0x7b')]=null;_0x5f401e['queuecallerexitreason']=_0x16c9a8[_0x8d0d('0x9f')];this['channels'][_0x16c9a8['uniqueid']]=_0x5f401e;this[_0x8d0d('0x48')](_0x5f401e,_0x8d0d('0x24'));}else if(this[_0x8d0d('0x6e')](_0x16c9a8['variable'])&&this['isNotNull'](_0x16c9a8[_0x8d0d('0x9e')]['queueposition'])){if(!_0x5f401e[_0x8d0d('0x1d')]){_0x5f401e[_0x8d0d('0x38')]=!![];_0x5f401e[_0x8d0d('0x8b')]=moment()[_0x8d0d('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x5f401e[_0x8d0d('0x53')]=_0x8d0d('0xa4');_0x5f401e['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x8d0d('0x3b')][_0x16c9a8[_0x8d0d('0x4e')]]=_0x5f401e;}}logger[_0x8d0d('0x7f')](_0x8d0d('0xa5'),_0x16c9a8[_0x8d0d('0x4e')],_0x5f401e[_0x8d0d('0x51')],_0x5f401e[_0x8d0d('0x57')],_[_0x8d0d('0x76')](_0x16c9a8[_0x8d0d('0x9e')])[0x0],_0x16c9a8['value']);_0x5f401e[_0x8d0d('0x14')]=this[_0x8d0d('0x14')][_0x16c9a8[_0x8d0d('0x4e')]];}}}}catch(_0x3e195b){logger[_0x8d0d('0x44')](_0x8d0d('0x9c'),_0x16c9a8[_0x8d0d('0x4e')],util[_0x8d0d('0x43')](_0x3e195b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8d0d('0x9')][_0x8d0d('0x9d')]=function(_0x408897,_0x5401d1,_0x5affcd){var _0x4903c1=[_0x8d0d('0xa6'),_0x8d0d('0xa7'),_0x8d0d('0xa8'),_0x8d0d('0xa9'),_0x8d0d('0xaa'),'rtpaudioqoslossbridged',_0x8d0d('0xab'),'rtpaudioqosrttbridged',_0x8d0d('0xac'),_0x8d0d('0xad'),_0x8d0d('0xae'),_0x8d0d('0xaf'),_0x8d0d('0xb0'),'memberdynamic',_0x8d0d('0xb1'),'memberlastcall',_0x8d0d('0xb2'),'memberpenalty',_0x8d0d('0xb3')];if(!_[_0x8d0d('0x3c')](_0x5401d1)&&!_['includes'](_0x4903c1,_0x5401d1)){if(_[_0x8d0d('0x5c')](this[_0x8d0d('0x14')][_0x408897])){this['variables'][_0x408897]={};}this[_0x8d0d('0x14')][_0x408897][_0x5401d1]=_0x5affcd;}};VoiceQueueReport[_0x8d0d('0x9')][_0x8d0d('0xb4')]=function(_0x2dacad,_0x3a6d6a,_0x363d91){try{var _0x1c44fe={};if(this[_0x8d0d('0xd')][_0x2dacad]){for(var _0x38734e=0x0;_0x38734e{delete this[_0x8d0d('0x3b')][_0x135149];},_0xab6286);}};module[_0x8d0d('0xee')]=VoiceQueueReport; \ No newline at end of file +var _0x19a6=['queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','last','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexitAt','transfer','reason','startsWith','local/','linkedid','seconds','FORWARDTRANSFER','transfertype','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','syncVarSet','addVariable','keys','variable','value','CONTINUE','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','handleHangup','length','diff','ATTENDEDTRANSFER','COMPLETEDBYAGENT','sumDuration','milliseconds','total','answered','sumBillable','unmanaged','lastevent','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumHoldTime','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','hangup','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','[%s][voiceQueueReport][handleHangup]','[%s][voiceQueueReport][hangup]','cause-txt','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','deleteChannelAfterTimeout','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transferuniqueid','transfertargetuniqueid','transferexten','origtransfererexten','ATTENDED','origtransfereruniqueid','transferid','syncBlindTransfer','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','mohstarttime','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceQueueReport][newexten]','exports','moment','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','realtime','agents','channels','queueChannels','voiceQueues','campaigns','summary','variables','syncQueueSummaryComplete','bind','queuemember','syncQueueMember','queuestatuscomplete','queuecallerjoin','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','syncHangup','syncFullyBooted','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','blindtransfer','loopQueueSummary','loopQueueShow','isEmpty','originated','pTalking','hasOwnProperty','unlockRR','queuecallerexit','queuecallerabandon','queuecallercomplete','clearZombieChannels','status','channel','catch','message','error','[%s][voiceQueueReport][checkChannel]','queueReports','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','inspect','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][','uniqueid','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','format','voice:queue:%s','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isNotNull','isUndefined','Action','queues','[voiceQueueReport][queues]','isRunning','queuesummary','then','actionid','[voiceQueueReport][queuesummary]','createQueueSummaryReport','createReport','handleInboundQueueSummaryReport','compareToInboundQueue','assign','syncQueueStatusComplete','queuestatus','queue','outbound','custom:queuesummary','statusRequests','completeEvent','push','syncQueueSummary','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','[%s][voiceQueueReport][queuecallerabandon]'];(function(_0x212d2a,_0x254b0a){var _0x207b05=function(_0x516b41){while(--_0x516b41){_0x212d2a['push'](_0x212d2a['shift']());}};_0x207b05(++_0x254b0a);}(_0x19a6,0x7a));var _0x619a=function(_0x292293,_0x522030){_0x292293=_0x292293-0x0;var _0x46db09=_0x19a6[_0x292293];return _0x46db09;};'use strict';var _=require('lodash');var moment=require(_0x619a('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0x619a('0x1'));var logger=require(_0x619a('0x2'))(_0x619a('0x3'));var ami=require(_0x619a('0x4'));var QueueReport=require(_0x619a('0x5'));var VoiceQueueSummary=require('../model/voiceQueueSummary');config[_0x619a('0x6')]=_[_0x619a('0x7')](config[_0x619a('0x6')],{'host':_0x619a('0x8'),'port':0x18eb});var io=require(_0x619a('0x9'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x619a('0xa')][_0x619a('0xb')]=function(_0x47d94c){this[_0x619a('0xc')]=this[_0x619a('0xc')]?this[_0x619a('0xc')][_0x619a('0xd')](_0x47d94c):_0x47d94c();};function VoiceQueueReport(_0x1ef7d9){this[_0x619a('0xe')]=new Sequence();this['queueReports']={};this[_0x619a('0xf')]=_0x1ef7d9;this['agents']=_0x1ef7d9[_0x619a('0x10')];this[_0x619a('0x11')]=_0x1ef7d9[_0x619a('0x12')];this[_0x619a('0x13')]=_0x1ef7d9[_0x619a('0x13')];this[_0x619a('0x14')]=_0x1ef7d9[_0x619a('0x14')];this[_0x619a('0x15')]=initializeSummary();this[_0x619a('0x16')]={};ami['on']('queuesummary',this['syncQueueSummary']['bind'](this));ami['on']('queuesummarycomplete',this[_0x619a('0x17')][_0x619a('0x18')](this));ami['on'](_0x619a('0x19'),this[_0x619a('0x1a')][_0x619a('0x18')](this));ami['on'](_0x619a('0x1b'),this['syncQueueStatusComplete'][_0x619a('0x18')](this));ami['on'](_0x619a('0x1c'),this['syncQueueCallerJoin'][_0x619a('0x18')](this));ami['on']('queuecallerabandon',this[_0x619a('0x1d')][_0x619a('0x18')](this));ami['on'](_0x619a('0x1e'),this[_0x619a('0x1f')][_0x619a('0x18')](this));ami['on'](_0x619a('0x20'),this[_0x619a('0x21')][_0x619a('0x18')](this));ami['on'](_0x619a('0x22'),this[_0x619a('0x23')][_0x619a('0x18')](this));ami['on']('varset',this['syncVarSet'][_0x619a('0x18')](this));ami['on']('hangup',this[_0x619a('0x24')]['bind'](this));ami['on']('fullybooted',this[_0x619a('0x25')][_0x619a('0x18')](this));ami['on']('musiconholdstart',this[_0x619a('0x26')][_0x619a('0x18')](this));ami['on']('musiconholdstop',this[_0x619a('0x27')][_0x619a('0x18')](this));ami['on'](_0x619a('0x28'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x619a('0x29'),this['syncBlindTransfer']['bind'](this));this[_0x619a('0x2a')]();this[_0x619a('0x2b')]();}function clearChannels(_0x556c96){if(!_[_0x619a('0x2c')](_0x556c96)){for(var _0x2e9d77 in _0x556c96){if(_0x556c96['hasOwnProperty'](_0x2e9d77)){delete _0x556c96[_0x2e9d77];}}}}function clearCampaigns(_0x27da56){if(!_[_0x619a('0x2c')](_0x27da56)){for(var _0x308a9b in _0x27da56){if(_0x27da56['hasOwnProperty'](_0x308a9b)){_0x27da56[_0x308a9b]['originated']=0x0;}}}}function clearVoiceQueues(_0x480231){if(!_['isEmpty'](_0x480231)){for(var _0x222960 in _0x480231){if(_0x480231['hasOwnProperty'](_0x222960)){_0x480231[_0x222960][_0x619a('0x2d')]=0x0;_0x480231[_0x222960]['talking']=0x0;_0x480231[_0x222960][_0x619a('0x2e')]=0x0;_0x480231[_0x222960]['waiting']=0x0;_0x480231[_0x222960]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x627163){if(!_[_0x619a('0x2c')](_0x627163)){for(var _0x2560b9 in _0x627163){if(_0x627163[_0x619a('0x2f')](_0x2560b9)){_0x627163[_0x2560b9][_0x619a('0x30')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x4898fb){return _0x4898fb[_0x619a('0x31')]||_0x4898fb[_0x619a('0x32')]||_0x4898fb[_0x619a('0x33')];}VoiceQueueReport[_0x619a('0xa')][_0x619a('0x34')]=function(){var _0x12d551=this;for(var _0x4a661d in this['channels']){if(this['channels'][_0x619a('0x2f')](_0x4a661d)&&!this[_0x619a('0x11')][_0x4a661d]['switch']){this['sequence'][_0x619a('0xb')](function(){if(!_['isNil'](_0x12d551[_0x619a('0x11')][_0x4a661d])){return ami['Action']({'action':_0x619a('0x35'),'channel':_0x12d551[_0x619a('0x11')][_0x4a661d][_0x619a('0x36')]})[_0x619a('0x37')](function(_0x3bfcce){if(_0x3bfcce[_0x619a('0x38')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x12d551[_0x619a('0x11')][_0x4a661d]){delete _0x12d551['channels'][_0x4a661d];logger[_0x619a('0x39')](_0x619a('0x3a'),_0x4a661d,util['inspect'](_0x3bfcce,{'showHidden':![],'depth':null}));}if(_0x12d551[_0x619a('0x3b')][_0x4a661d]){delete _0x12d551[_0x619a('0x3b')][_0x4a661d];logger[_0x619a('0x39')](_0x619a('0x3c'),_0x4a661d,util['inspect'](_0x3bfcce,{'showHidden':![],'depth':null}));}if(_0x12d551[_0x619a('0x16')][_0x4a661d]){delete _0x12d551['variables'][_0x4a661d];logger[_0x619a('0x39')](_0x619a('0x3d'),_0x4a661d,util[_0x619a('0x3e')](_0x3bfcce,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x619a('0xa')][_0x619a('0x25')]=function(){logger[_0x619a('0x39')](_0x619a('0x3f'));clearChannels(this[_0x619a('0x11')]);this[_0x619a('0x40')](this['queueReports']);clearAgentBooked(this[_0x619a('0x10')]);clearVoiceQueues(this[_0x619a('0x13')]);clearCampaigns(this[_0x619a('0x14')]);this[_0x619a('0x15')]=initializeSummary();};VoiceQueueReport['prototype']['clearQueueReport']=function(_0x3b9b2f){var _0x1e6970=this;if(!_['isEmpty'](_0x3b9b2f)){for(var _0x37d21e in _0x3b9b2f){if(_0x3b9b2f[_0x619a('0x2f')](_0x37d21e)){_0x1e6970[_0x619a('0x41')](_0x3b9b2f[_0x37d21e],_0x619a('0x42'));delete _0x3b9b2f[_0x37d21e];}}}};VoiceQueueReport['prototype'][_0x619a('0x43')]=function(_0x39b178,_0x30a5f8,_0xa3b4c6){io['to'](_0x39b178)[_0x619a('0x43')](_0x30a5f8,_0xa3b4c6);};VoiceQueueReport['prototype'][_0x619a('0x44')]=function(_0x2a8840,_0x3ed39a){logger[_0x619a('0x45')](_0x619a('0x46')+_0x3ed39a+']\x20sending\x20voice_queue_channel:save\x20event:',_0x2a8840[_0x619a('0x47')],util[_0x619a('0x3e')](_0x2a8840,{'showHidden':![],'depth':null}));this['emit'](util['format']('voice:queue:%s',_0x2a8840['queue']),_0x619a('0x48'),_0x2a8840);io[_0x619a('0x43')](_0x619a('0x49'),_0x2a8840);};VoiceQueueReport[_0x619a('0xa')][_0x619a('0x41')]=function(_0x4f8b4a,_0x12857c){logger[_0x619a('0x45')](_0x619a('0x46')+_0x12857c+_0x619a('0x4a'),_0x4f8b4a[_0x619a('0x47')],util['inspect'](_0x4f8b4a,{'showHidden':![],'depth':null}));if(_0x4f8b4a[_0x619a('0x4b')]==='ATTENDEDTRANSFER'){return;}this['emit'](util[_0x619a('0x4c')](_0x619a('0x4d'),_0x4f8b4a['queue']),'voice_queue_channel:remove',_0x4f8b4a);io['emit'](_0x619a('0x4e'),_0x4f8b4a);};VoiceQueueReport['prototype'][_0x619a('0x4f')]=function(_0x4bb6cc){if(_0x4bb6cc[_0x619a('0x50')]===_0x619a('0x51')){logger[_0x619a('0x45')](_0x619a('0x52'),util['inspect'](_0x4bb6cc,{'showHidden':![],'depth':null}));this[_0x619a('0x43')](util[_0x619a('0x4c')]('voice:queue:%s',_0x4bb6cc[_0x619a('0x53')]),_0x619a('0x54'),_0x4bb6cc);}};VoiceQueueReport['prototype'][_0x619a('0x55')]=function(_0x55ad5c){return _0x55ad5c!==null&&!_[_0x619a('0x56')](_0x55ad5c);};VoiceQueueReport[_0x619a('0xa')]['loopQueueShow']=function(){var _0x854270=this;setInterval(function(){_0x854270['clearZombieChannels']();ami[_0x619a('0x57')]({'action':_0x619a('0x58')})['catch'](function(_0x4f1b00){logger[_0x619a('0x39')](_0x619a('0x59'),util[_0x619a('0x3e')](_0x4f1b00,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x619a('0xa')]['loopQueueSummary']=function(){var _0x3d6763=this;setInterval(function(){if(!_0x3d6763['summary'][_0x619a('0x5a')]){return ami[_0x619a('0x57')]({'action':_0x619a('0x5b')})[_0x619a('0x5c')](function(_0x59cd4d){_0x3d6763[_0x619a('0x15')]['id']=_0x59cd4d[_0x619a('0x5d')];_0x3d6763[_0x619a('0x15')][_0x619a('0x5a')]=!![];_0x3d6763[_0x619a('0x15')]['queuestatus'][_0x59cd4d[_0x619a('0x5d')]]={};})[_0x619a('0x37')](function(_0x827bf5){logger['error'](_0x619a('0x5e'),util['inspect'](_0x827bf5,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x619a('0xa')][_0x619a('0x5f')]=function(_0x12184f,_0x169055){var _0x3eb50f;if(this[_0x619a('0x15')]&&this[_0x619a('0x15')][_0x619a('0x58')]&&this[_0x619a('0x15')][_0x619a('0x58')][_0x12184f[_0x619a('0x53')]]){_0x3eb50f=this[_0x619a('0x15')][_0x619a('0x58')][_0x12184f[_0x619a('0x53')]]['summaryEvent'];}var _0xef6bdc=new VoiceQueueSummary(_0x12184f);return _0xef6bdc[_0x619a('0x60')](_0x169055[_0x619a('0x10')],this[_0x619a('0x10')],_0x3eb50f,this[_0x619a('0xf')][_0x619a('0x11')]);};VoiceQueueReport[_0x619a('0xa')][_0x619a('0x61')]=function(_0x170ccf,_0x147e01){var _0x63cd2b=this[_0x619a('0x5f')](_0x170ccf,_0x147e01);var _0x23e676=![];_0x23e676=_0x63cd2b[_0x619a('0x62')](_0x170ccf);if(_0x23e676){Object[_0x619a('0x63')](_0x170ccf,_0x63cd2b);this[_0x619a('0xf')][_0x619a('0x13')][_0x170ccf[_0x619a('0x53')]]=_0x170ccf;this[_0x619a('0x4f')](_0x63cd2b);}};VoiceQueueReport[_0x619a('0xa')][_0x619a('0x64')]=function(_0x358670){var _0x3e8853=null;var _0x5a24c6=this[_0x619a('0x15')]['id'];if(this[_0x619a('0x15')][_0x619a('0x65')][_0x5a24c6]){_0x3e8853=this['summary'][_0x619a('0x65')][_0x5a24c6][_0x358670['actionid']];}if(!_0x3e8853){this[_0x619a('0x15')]=initializeSummary();return;}var _0x2515b5=this['voiceQueues'][_0x3e8853[_0x619a('0x66')]];if(_0x2515b5[_0x619a('0x50')]===_0x619a('0x51')){this[_0x619a('0x61')](_0x2515b5,_0x3e8853);}else if(_0x2515b5[_0x619a('0x50')]===_0x619a('0x67')){var _0x59cab6=this['createQueueSummaryReport'](_0x2515b5,_0x3e8853);ami['emit'](_0x619a('0x68'),_0x59cab6);}this[_0x619a('0x15')]['statusRequests']-=0x1;var _0x57a459=this[_0x619a('0x15')][_0x619a('0x69')]>0x0?!![]:![];if(!_0x57a459){return this[_0x619a('0x17')](this[_0x619a('0x15')][_0x619a('0x6a')]);}};VoiceQueueReport[_0x619a('0xa')][_0x619a('0x1a')]=function(_0x50d485){var _0x3dc013=this[_0x619a('0x15')]['id'];if(this[_0x619a('0x15')][_0x619a('0x65')][_0x3dc013]&&this[_0x619a('0x15')][_0x619a('0x65')][_0x3dc013][_0x50d485[_0x619a('0x5d')]]){this[_0x619a('0x15')][_0x619a('0x65')][_0x3dc013][_0x50d485[_0x619a('0x5d')]]['agents'][_0x619a('0x6b')](_0x50d485);}};VoiceQueueReport[_0x619a('0xa')][_0x619a('0x6c')]=function(_0x1bfad1){var _0x1af4f4=this;try{if(this[_0x619a('0x55')](_0x1bfad1)&&this['isNotNull'](_0x1bfad1['queue'])){logger[_0x619a('0x45')](_0x619a('0x6d'),util[_0x619a('0x3e')](_0x1bfad1,{'showHidden':![],'depth':null}));var _0x261e52=this[_0x619a('0x13')][_0x1bfad1[_0x619a('0x66')]];if(_0x261e52){logger[_0x619a('0x45')](_0x619a('0x6e'),_0x261e52[_0x619a('0x53')]);this[_0x619a('0x15')][_0x619a('0x58')][_0x261e52[_0x619a('0x53')]]={'summaryEvent':_0x1bfad1};this['summary'][_0x619a('0x69')]+=0x1;return ami['Action']({'action':_0x619a('0x65'),'queue':_0x261e52[_0x619a('0x53')]})['then'](function(_0x4305e1){if(!_0x1af4f4['summary']['queuestatus'][_0x1bfad1['actionid']]){_0x1af4f4[_0x619a('0x15')][_0x619a('0x65')][_0x1bfad1[_0x619a('0x5d')]]={};}_0x1af4f4['summary']['queuestatus'][_0x1bfad1[_0x619a('0x5d')]][_0x4305e1[_0x619a('0x5d')]]={'queue':_0x261e52['name'],'agents':[]};})[_0x619a('0x37')](function(_0x26680f){throw _0x26680f;});}}}catch(_0x1ae3ee){logger[_0x619a('0x39')]('[voiceQueueReport][queuesummary]',util[_0x619a('0x3e')](_0x1ae3ee,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x619a('0xa')]['syncQueueSummaryComplete']=function(_0x511aa9){if(this['summary'][_0x619a('0x69')]>0x0){this[_0x619a('0x15')]['completeEvent']=_0x511aa9;return;}logger[_0x619a('0x45')](_0x619a('0x6f'),util[_0x619a('0x3e')](_0x511aa9,{'showHidden':![],'depth':null}));this[_0x619a('0x15')]=initializeSummary();ami[_0x619a('0x43')]('custom:queuesummarycomplete',{});};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x1e1cb7){try{if(this[_0x619a('0x55')](_0x1e1cb7)){logger[_0x619a('0x45')](_0x619a('0x70'),_0x1e1cb7[_0x619a('0x47')],util[_0x619a('0x3e')](_0x1e1cb7,{'showHidden':![],'depth':null}));if(_[_0x619a('0x56')](this[_0x619a('0x3b')][_0x1e1cb7[_0x619a('0x47')]])){this['queueReports'][_0x1e1cb7['uniqueid']]=[];}if(_[_0x619a('0x56')](this[_0x619a('0x11')][_0x1e1cb7[_0x619a('0x47')]])){this[_0x619a('0x11')][_0x1e1cb7[_0x619a('0x47')]]={};}var _0x3aa819=new QueueReport();_0x3aa819['queue']=_0x1e1cb7[_0x619a('0x66')];_0x3aa819[_0x619a('0x50')]=this[_0x619a('0x13')][_0x3aa819[_0x619a('0x66')]]&&this[_0x619a('0x13')][_0x3aa819[_0x619a('0x66')]][_0x619a('0x50')]?this[_0x619a('0x13')][_0x3aa819[_0x619a('0x66')]]['type']||_0x619a('0x51'):_0x619a('0x51');_0x3aa819[_0x619a('0x71')]=moment()[_0x619a('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x3aa819['position']=_0x1e1cb7[_0x619a('0x72')];_0x3aa819[_0x619a('0x73')]=_0x1e1cb7['count'];_0x3aa819[_0x619a('0x47')]=_0x1e1cb7['uniqueid'];logger[_0x619a('0x74')](_0x619a('0x75'),_0x3aa819['queue'],_0x3aa819[_0x619a('0x50')]);Object[_0x619a('0x63')](_0x3aa819,_[_0x619a('0x76')](_0x1e1cb7,_['keys'](_0x3aa819)));this['queueReports'][_0x1e1cb7['uniqueid']][_0x619a('0x6b')](_0x3aa819);this[_0x619a('0x11')][_0x1e1cb7[_0x619a('0x47')]]=_0x3aa819;this[_0x619a('0x44')](_0x3aa819,_0x619a('0x1c'));}}catch(_0x37f47b){logger[_0x619a('0x39')](_0x619a('0x70'),_0x1e1cb7['uniqueid'],util[_0x619a('0x3e')](_0x37f47b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x619a('0x1d')]=function(_0x460d7e){try{if(this[_0x619a('0x55')](_0x460d7e)){logger[_0x619a('0x45')](_0x619a('0x77'),_0x460d7e[_0x619a('0x47')],util[_0x619a('0x3e')](_0x460d7e,{'showHidden':![],'depth':null}));if(this[_0x619a('0x3b')][_0x460d7e[_0x619a('0x47')]]){var _0x1461b6=_['last'](this[_0x619a('0x3b')][_0x460d7e[_0x619a('0x47')]]);_0x1461b6[_0x619a('0x33')]=![];_0x1461b6[_0x619a('0x78')]=null;_0x1461b6['holdtime']=_0x460d7e[_0x619a('0x79')];_0x1461b6['originalposition']=_0x460d7e[_0x619a('0x7a')];_0x1461b6[_0x619a('0x32')]=!![];_0x1461b6[_0x619a('0x7b')]=moment()[_0x619a('0x4c')](_0x619a('0x7c'));_0x1461b6[_0x619a('0x4b')]=_0x619a('0x7d');_0x1461b6[_0x619a('0x7e')]=null;logger[_0x619a('0x74')](_0x619a('0x7f'),_0x1461b6[_0x619a('0x66')],_0x1461b6[_0x619a('0x50')]);this[_0x619a('0x11')][_0x460d7e[_0x619a('0x47')]]=_0x1461b6;this['emitVoiceQueueChannelRemove'](_0x1461b6,'queuecallerabandon');}}}catch(_0x3717fd){logger[_0x619a('0x39')](_0x619a('0x77'),_0x460d7e[_0x619a('0x47')],util[_0x619a('0x3e')](_0x3717fd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x619a('0xa')]['syncQueueCallerLeave']=function(_0xf39fbd){try{if(this[_0x619a('0x55')](_0xf39fbd)){logger[_0x619a('0x45')](_0x619a('0x80'),_0xf39fbd[_0x619a('0x47')],util[_0x619a('0x3e')](_0xf39fbd,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xf39fbd['uniqueid']]){var _0x1305c4=_['last'](this['queueReports'][_0xf39fbd[_0x619a('0x47')]]);_0x1305c4[_0x619a('0x81')]=moment()[_0x619a('0x4c')](_0x619a('0x7c'));_0x1305c4['connectedlinenum']=_0xf39fbd[_0x619a('0x82')];_0x1305c4[_0x619a('0x83')]=_0xf39fbd['connectedlinename'];logger[_0x619a('0x74')](_0x619a('0x84'),_0x1305c4['queue'],_0x1305c4[_0x619a('0x50')],_0xf39fbd[_0x619a('0x82')],_0xf39fbd[_0x619a('0x83')]);this[_0x619a('0x11')][_0xf39fbd[_0x619a('0x47')]]=_0x1305c4;this[_0x619a('0x44')](_0x1305c4,_0x619a('0x1e'));}}}catch(_0x2e0097){logger[_0x619a('0x39')]('[%s][voiceQueueReport][queuecallerleave]',_0xf39fbd[_0x619a('0x47')],util['inspect'](_0x2e0097,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x23ea5d){try{if(this[_0x619a('0x55')](_0x23ea5d)){logger[_0x619a('0x45')](_0x619a('0x85'),_0x23ea5d['uniqueid'],util[_0x619a('0x3e')](_0x23ea5d,{'showHidden':![],'depth':null}));if(this[_0x619a('0x3b')][_0x23ea5d['uniqueid']]){var _0x115131=_[_0x619a('0x86')](this[_0x619a('0x3b')][_0x23ea5d['uniqueid']]);_0x115131[_0x619a('0x33')]=!![];_0x115131['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0x619a('0x74')](_0x619a('0x87'),_0x115131['queue'],_0x115131[_0x619a('0x50')]);}}}catch(_0x27f902){logger['error']('[%s][voiceQueueReport][agentconnect]',_0x23ea5d[_0x619a('0x47')],util[_0x619a('0x3e')](_0x27f902,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x361459){try{if(this[_0x619a('0x55')](_0x361459)){logger[_0x619a('0x45')](_0x619a('0x88'),_0x361459[_0x619a('0x47')],util[_0x619a('0x3e')](_0x361459,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x361459[_0x619a('0x47')]]){var _0x4a99a1=_[_0x619a('0x86')](this[_0x619a('0x3b')][_0x361459[_0x619a('0x47')]]);_0x4a99a1[_0x619a('0x32')]=![];_0x4a99a1[_0x619a('0x7b')]=null;_0x4a99a1[_0x619a('0x89')]=!![];_0x4a99a1['lastAssignedTo']=_0x361459[_0x619a('0x8a')];_0x4a99a1[_0x619a('0x79')]=_0x361459[_0x619a('0x79')];_0x4a99a1[_0x619a('0x33')]=!![];_0x4a99a1[_0x619a('0x31')]=![];_0x4a99a1[_0x619a('0x8b')]=null;if(!_0x4a99a1[_0x619a('0x8c')]){if(_0x361459[_0x619a('0x8d')]==_0x619a('0x8c')){_0x4a99a1['queuecallerexitreason']='COMPLETED';logger[_0x619a('0x74')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x4a99a1[_0x619a('0x66')],_0x4a99a1[_0x619a('0x50')]);}else{if(_[_0x619a('0x8e')](_0x361459[_0x619a('0x36')]['toLowerCase'](),_0x619a('0x8f'))){if(this['queueReports'][_0x361459[_0x619a('0x90')]]){var _0x4097ae=_[_0x619a('0x86')](this[_0x619a('0x3b')][_0x361459['linkedid']]);_0x4097ae['queuecallercomplete']=![];_0x4097ae['queuecallerexit']=!![];_0x4097ae['queuecallerexitAt']=moment(_0x4a99a1['queuecallerjoinAt'])['add'](_0x361459[_0x619a('0x79')],_0x619a('0x91'))[_0x619a('0x4c')](_0x619a('0x7c'));_0x4097ae[_0x619a('0x4b')]=_0x619a('0x92');_0x4097ae['transfer']=!![];_0x4097ae[_0x619a('0x93')]='FORWARD';_0x4097ae['transferexten']=_0x361459['destexten'];_0x4097ae['transferuniqueid']=_0x361459['uniqueid'];logger[_0x619a('0x74')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x4097ae[_0x619a('0x66')],_0x4097ae[_0x619a('0x50')]);var _0x18feb8=this['queueReports'][_0x361459[_0x619a('0x90')]];this[_0x619a('0x3b')][_0x361459[_0x619a('0x90')]]=this['queueReports'][_0x361459[_0x619a('0x47')]];this[_0x619a('0x3b')][_0x361459[_0x619a('0x47')]]=_0x18feb8;}}else{_0x4a99a1[_0x619a('0x4b')]=_0x619a('0x94')+_0x361459[_0x619a('0x8d')][_0x619a('0x95')]();logger[_0x619a('0x74')](_0x619a('0x96'),_0x4a99a1[_0x619a('0x66')],_0x4a99a1['type'],_0x4a99a1['queuecallerexitreason']);}}}this[_0x619a('0x11')][_0x361459[_0x619a('0x47')]]=_0x4a99a1;}}}catch(_0x3c28bd){logger['error'](_0x619a('0x88'),_0x361459[_0x619a('0x47')],util[_0x619a('0x3e')](_0x3c28bd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x619a('0xa')][_0x619a('0x97')]=function(_0x49b4aa){try{if(this[_0x619a('0x55')](_0x49b4aa)){logger[_0x619a('0x45')]('[%s][voiceQueueReport][varset]',_0x49b4aa[_0x619a('0x47')],util[_0x619a('0x3e')](_0x49b4aa,{'showHidden':![],'depth':null}));this[_0x619a('0x98')](_0x49b4aa['uniqueid'],_[_0x619a('0x99')](_0x49b4aa[_0x619a('0x9a')])[0x0],_0x49b4aa[_0x619a('0x9b')]);if(this['queueReports'][_0x49b4aa['uniqueid']]){var _0x23af52=_['last'](this[_0x619a('0x3b')][_0x49b4aa['uniqueid']]);if(_0x23af52){if(this[_0x619a('0x55')](_0x49b4aa[_0x619a('0x9a')])&&this[_0x619a('0x55')](_0x49b4aa[_0x619a('0x9a')][_0x619a('0x65')])){switch(_0x49b4aa['value']){case _0x619a('0x9c'):_0x23af52[_0x619a('0x31')]=![];_0x23af52[_0x619a('0x8b')]=null;break;case'TIMEOUT':_0x23af52['lastevent']=_0x619a('0x9d');_0x23af52[_0x619a('0x31')]=!![];_0x23af52[_0x619a('0x8b')]=moment()[_0x619a('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x23af52[_0x619a('0x81')]=moment()[_0x619a('0x4c')](_0x619a('0x7c'));logger[_0x619a('0x45')](_0x619a('0x9e'),_0x49b4aa['uniqueid'],util[_0x619a('0x3e')](_0x23af52,{'showHidden':![],'depth':null}));ami[_0x619a('0x43')](_0x619a('0x9f'),_0x23af52);break;default:_0x23af52[_0x619a('0x31')]=!![];_0x23af52[_0x619a('0x8b')]=moment()[_0x619a('0x4c')](_0x619a('0x7c'));_0x23af52[_0x619a('0x81')]=moment()[_0x619a('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');}_0x23af52['queuecallerabandon']=![];_0x23af52['queuecallerabandonAt']=null;_0x23af52[_0x619a('0x4b')]=_0x49b4aa[_0x619a('0x9b')];this[_0x619a('0x11')][_0x49b4aa[_0x619a('0x47')]]=_0x23af52;this[_0x619a('0x41')](_0x23af52,'varset');}else if(this[_0x619a('0x55')](_0x49b4aa[_0x619a('0x9a')])&&this[_0x619a('0x55')](_0x49b4aa[_0x619a('0x9a')][_0x619a('0xa0')])){if(!_0x23af52[_0x619a('0x32')]){_0x23af52[_0x619a('0x31')]=!![];_0x23af52[_0x619a('0x8b')]=moment()[_0x619a('0x4c')](_0x619a('0x7c'));_0x23af52[_0x619a('0x4b')]=_0x619a('0xa1');_0x23af52[_0x619a('0x81')]=moment()['format'](_0x619a('0x7c'));this['channels'][_0x49b4aa['uniqueid']]=_0x23af52;}}logger[_0x619a('0x74')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x49b4aa['uniqueid'],_0x23af52[_0x619a('0x66')],_0x23af52[_0x619a('0x50')],_[_0x619a('0x99')](_0x49b4aa['variable'])[0x0],_0x49b4aa['value']);_0x23af52[_0x619a('0x16')]=this[_0x619a('0x16')][_0x49b4aa[_0x619a('0x47')]];}}}}catch(_0x36b363){logger[_0x619a('0x39')](_0x619a('0xa2'),_0x49b4aa[_0x619a('0x47')],util[_0x619a('0x3e')](_0x36b363,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x619a('0xa')][_0x619a('0x98')]=function(_0x5c5d1c,_0x2ca5c8,_0x4a332c){var _0xe48e6=['rtpaudioqos',_0x619a('0xa3'),_0x619a('0xa4'),_0x619a('0xa5'),_0x619a('0xa6'),_0x619a('0xa7'),'rtpaudioqosrtt',_0x619a('0xa8'),_0x619a('0xa9'),'sipuri','bridgepeer',_0x619a('0xaa'),_0x619a('0xab'),_0x619a('0xac'),_0x619a('0xad'),'memberlastcall',_0x619a('0x8a'),_0x619a('0xae'),_0x619a('0xaf')];if(!_[_0x619a('0xb0')](_0x2ca5c8)&&!_[_0x619a('0xb1')](_0xe48e6,_0x2ca5c8)){if(_[_0x619a('0x56')](this[_0x619a('0x16')][_0x5c5d1c])){this['variables'][_0x5c5d1c]={};}this[_0x619a('0x16')][_0x5c5d1c][_0x2ca5c8]=_0x4a332c;}};VoiceQueueReport['prototype'][_0x619a('0xb2')]=function(_0x4061a9,_0x1651d4,_0x2805f1){try{var _0xf61a25={};if(this[_0x619a('0x3b')][_0x4061a9]){for(var _0x13a49b=0x0;_0x13a49b{delete this[_0x619a('0x11')][_0x2decc3];},_0xb57c6c);}};module[_0x619a('0xf1')]=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index 779e59e..83a4318 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf5a1=['CreateReportAgentPreview','../client','createHistory','campaign','queue'];(function(_0x1491df,_0x15edf3){var _0x45ea20=function(_0x5865f4){while(--_0x5865f4){_0x1491df['push'](_0x1491df['shift']());}};_0x45ea20(++_0x15edf3);}(_0xf5a1,0x88));var _0x1f5a=function(_0x3433b4,_0x2222c6){_0x3433b4=_0x3433b4-0x0;var _0x1e565f=_0xf5a1[_0x3433b4];return _0x1e565f;};'use strict';var client=require(_0x1f5a('0x0'));exports[_0x1f5a('0x1')]=function(_0x208b5a){return function(){_0x208b5a[_0x1f5a('0x2')]=_0x208b5a[_0x1f5a('0x3')];return client['Request']('CreateReportAgentPreview',{'body':_0x208b5a,'log':_0x1f5a('0x4')});};}; \ No newline at end of file +var _0x4e32=['campaign','Request','CreateReportAgentPreview','createHistory'];(function(_0x51d563,_0x59d225){var _0x3042f0=function(_0x3f1bf9){while(--_0x3f1bf9){_0x51d563['push'](_0x51d563['shift']());}};_0x3042f0(++_0x59d225);}(_0x4e32,0x183));var _0x24e3=function(_0x46fbea,_0x5a1b2f){_0x46fbea=_0x46fbea-0x0;var _0x44aec5=_0x4e32[_0x46fbea];return _0x44aec5;};'use strict';var client=require('../client');exports[_0x24e3('0x0')]=function(_0x55b358){return function(){_0x55b358[_0x24e3('0x1')]=_0x55b358['queue'];return client[_0x24e3('0x2')](_0x24e3('0x3'),{'body':_0x55b358,'log':_0x24e3('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index 9a36ce3..85388f8 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5bf9=['create','Request','CreateAttachment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x5bf9,0xa2));var _0x95bf=function(_0x318dda,_0x53fa85){_0x318dda=_0x318dda-0x0;var _0x57736e=_0x5bf9[_0x318dda];return _0x57736e;};'use strict';var client=require('../client');exports[_0x95bf('0x0')]=function(_0x19cbd4){return client[_0x95bf('0x1')]('CreateAttachment',{'body':_0x19cbd4,'log':_0x95bf('0x2')});}; \ No newline at end of file +var _0xcd3b=['CreateAttachment','../client','Request'];(function(_0x4c6831,_0x114a59){var _0x2a0365=function(_0x1d0a4d){while(--_0x1d0a4d){_0x4c6831['push'](_0x4c6831['shift']());}};_0x2a0365(++_0x114a59);}(_0xcd3b,0x19c));var _0xbcd3=function(_0x526b84,_0x4669a0){_0x526b84=_0x526b84-0x0;var _0x3bb8fa=_0xcd3b[_0x526b84];return _0x3bb8fa;};'use strict';var client=require(_0xbcd3('0x0'));exports['create']=function(_0x30db39){return client[_0xbcd3('0x1')](_0xbcd3('0x2'),{'body':_0x30db39,'log':_0xbcd3('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index e347ebb..493a958 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialCutDigit','Trunk','callerid','active','TrunkBackup','Interval','SquareProject','getCampaign','getCampaigns','GetCampaign','name','type','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength'];(function(_0x1dad18,_0x556b7f){var _0x2a98f4=function(_0x2fb7b1){while(--_0x2fb7b1){_0x1dad18['push'](_0x1dad18['shift']());}};_0x2a98f4(++_0x556b7f);}(_0xadb5,0xad));var _0x5adb=function(_0x4d1f10,_0x42144b){_0x4d1f10=_0x4d1f10-0x0;var _0x5c4771=_0xadb5[_0x4d1f10];return _0x5c4771;};'use strict';var client=require('../client');exports[_0x5adb('0x0')]=function(){return function(){return client['Request'](_0x5adb('0x1'),{'options':{'raw':![],'attributes':['id',_0x5adb('0x2'),_0x5adb('0x3'),'active',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'dialOriginateTimeout',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'dialAMDActive',_0x5adb('0x18'),'dialAMDGreeting',_0x5adb('0x19'),'dialAMDTotalAnalysisTime',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'dialAMDSilenceThreshold',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'dialRandomLastDigitCallerIdNumber',_0x5adb('0x20')],'include':[{'model':'Trunk','as':_0x5adb('0x21'),'attributes':['id',_0x5adb('0x2'),_0x5adb('0x22'),_0x5adb('0x23')]},{'model':_0x5adb('0x21'),'as':_0x5adb('0x24'),'attributes':['id',_0x5adb('0x2'),_0x5adb('0x22'),_0x5adb('0x23')]},{'model':'Interval','as':_0x5adb('0x25'),'attributes':['id','name'],'include':[{'model':_0x5adb('0x25'),'as':'Intervals','attributes':['id',_0x5adb('0x2'),'interval']}]},{'model':'SquareProject','as':_0x5adb('0x26'),'attributes':['id',_0x5adb('0x2')]}]},'log':_0x5adb('0x27')});};}; \ No newline at end of file +var _0xadb5=['dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialCutDigit','Trunk','callerid','active','TrunkBackup','Interval','SquareProject','getCampaign','getCampaigns','GetCampaign','name','type','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength'];(function(_0x12d2d1,_0x175120){var _0x1cb7b4=function(_0x11d432){while(--_0x11d432){_0x12d2d1['push'](_0x12d2d1['shift']());}};_0x1cb7b4(++_0x175120);}(_0xadb5,0xad));var _0x5adb=function(_0x524f31,_0x1a066b){_0x524f31=_0x524f31-0x0;var _0x35c729=_0xadb5[_0x524f31];return _0x35c729;};'use strict';var client=require('../client');exports[_0x5adb('0x0')]=function(){return function(){return client['Request'](_0x5adb('0x1'),{'options':{'raw':![],'attributes':['id',_0x5adb('0x2'),_0x5adb('0x3'),'active',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'dialOriginateTimeout',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'dialAMDActive',_0x5adb('0x18'),'dialAMDGreeting',_0x5adb('0x19'),'dialAMDTotalAnalysisTime',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'dialAMDSilenceThreshold',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'dialRandomLastDigitCallerIdNumber',_0x5adb('0x20')],'include':[{'model':'Trunk','as':_0x5adb('0x21'),'attributes':['id',_0x5adb('0x2'),_0x5adb('0x22'),_0x5adb('0x23')]},{'model':_0x5adb('0x21'),'as':_0x5adb('0x24'),'attributes':['id',_0x5adb('0x2'),_0x5adb('0x22'),_0x5adb('0x23')]},{'model':'Interval','as':_0x5adb('0x25'),'attributes':['id','name'],'include':[{'model':_0x5adb('0x25'),'as':'Intervals','attributes':['id',_0x5adb('0x2'),'interval']}]},{'model':'SquareProject','as':_0x5adb('0x26'),'attributes':['id',_0x5adb('0x2')]}]},'log':_0x5adb('0x27')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index fef4af2..b29a365 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac1f=['CreateCmContact','getContacts','GetCmContact','../client','createContact','Request'];(function(_0x22cd3a,_0x247c6d){var _0x54a645=function(_0x590d89){while(--_0x590d89){_0x22cd3a['push'](_0x22cd3a['shift']());}};_0x54a645(++_0x247c6d);}(_0xac1f,0x1a7));var _0xfac1=function(_0x306334,_0x482970){_0x306334=_0x306334-0x0;var _0x49e21a=_0xac1f[_0x306334];return _0x49e21a;};'use strict';var client=require(_0xfac1('0x0'));exports[_0xfac1('0x1')]=function(_0x2a6e2b){return function(){return client[_0xfac1('0x2')](_0xfac1('0x3'),{'body':_0x2a6e2b,'log':_0xfac1('0x3')});};};exports[_0xfac1('0x4')]=function(_0x3e8c82){return function(){return client['Request'](_0xfac1('0x5'),{'options':_0x3e8c82,'log':_0xfac1('0x5')});};}; \ No newline at end of file +var _0x8c54=['CreateCmContact','getContacts','GetCmContact','createContact','Request'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x8c54,0xe9));var _0x48c5=function(_0x1006c4,_0x300b60){_0x1006c4=_0x1006c4-0x0;var _0x196fa5=_0x8c54[_0x1006c4];return _0x196fa5;};'use strict';var client=require('../client');exports[_0x48c5('0x0')]=function(_0x2ee22c){return function(){return client[_0x48c5('0x1')](_0x48c5('0x2'),{'body':_0x2ee22c,'log':_0x48c5('0x2')});};};exports[_0x48c5('0x3')]=function(_0x3747fe){return function(){return client[_0x48c5('0x1')](_0x48c5('0x4'),{'options':_0x3747fe,'log':_0x48c5('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index f37c229..6c5a0b7 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x861a=['updateContacts','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','VoiceQueueId','destroyContact','DestroyCmHopper','getContactDialer','priority','DESC','ASC','GetContactDialer','Contact','scheduledat','GetContactDialerIvr','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','ContactId','CampaignId','countReScheduled','getContactPreview','GetCmHopperPreview','User','Agent','name','VoiceQueue','Queue','getContactRecallMe','voicePause','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','getContacts','Request','GetCmHopper','CmContact','getCmHopper'];(function(_0x3c756a,_0x3a2674){var _0x3afc3a=function(_0x3e132b){while(--_0x3e132b){_0x3c756a['push'](_0x3c756a['shift']());}};_0x3afc3a(++_0x3a2674);}(_0x861a,0x194));var _0xa861=function(_0x480603,_0xa406ed){_0x480603=_0x480603-0x0;var _0x41974b=_0x861a[_0x480603];return _0x41974b;};'use strict';var client=require(_0xa861('0x0'));var moment=require('moment');exports[_0xa861('0x1')]=function(_0x5ba173,_0x4765a3){return function(){return client[_0xa861('0x2')](_0xa861('0x3'),{'options':{'where':{'VoiceQueueId':_0x5ba173},'include':[{'model':_0xa861('0x4'),'as':'Contact'}],'limit':_0x4765a3,'raw':![]},'log':_0xa861('0x5')});};};exports[_0xa861('0x6')]=function(_0x51fc4f,_0x1a9322,_0x247b78){return function(){return client['Request'](_0xa861('0x7'),{'body':_0x51fc4f,'options':{'where':{'VoiceQueueId':_0x1a9322,'scheduledat':{'$lte':moment()[_0xa861('0x8')](_0xa861('0x9'))}},'limit':_0x247b78},'log':_0xa861('0x7')});};};exports[_0xa861('0xa')]=function(_0x2e3ad3){return client[_0xa861('0x2')](_0xa861('0x7'),{'body':_0x2e3ad3,'options':{'where':{'ContactId':_0x2e3ad3['ContactId'],'ListId':_0x2e3ad3['ListId'],'VoiceQueueId':_0x2e3ad3[_0xa861('0xb')],'CampaignId':_0x2e3ad3['CampaignId']}},'log':'rescheduleContact'});};exports[_0xa861('0xc')]=function(_0x4741bf,_0x1ff074,_0x5bfb9b){return function(){return client[_0xa861('0x2')](_0xa861('0xd'),{'options':{'where':{'VoiceQueueId':_0x4741bf,'ListId':_0x1ff074,'ContactId':_0x5bfb9b}},'log':_0xa861('0xd')});};};exports[_0xa861('0xe')]=function(_0x41af33,_0x4b6b2d,_0x553c6c,_0x8b05bd){return client['Request']('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x41af33,'active':![],'scheduledat':{'$lte':moment()[_0xa861('0x8')](_0xa861('0x9'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x4b6b2d}}]},'order':[[_0xa861('0xf'),_0xa861('0x10')],['scheduledat',_0x8b05bd],['id',_0xa861('0x11')]],'raw':!![],'limit':_0x553c6c},'log':'GetContactDialer'});};exports['getContactDialerIvr']=function(_0x5503fd,_0x12697d,_0x18c897){return client['Request'](_0xa861('0x12'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x5503fd,'active':![],'scheduledat':{'$lte':moment()[_0xa861('0x8')](_0xa861('0x9'))}},'include':[{'model':_0xa861('0x4'),'as':_0xa861('0x13')}],'order':[['priority',_0xa861('0x10')],[_0xa861('0x14'),_0x18c897],['id',_0xa861('0x11')]],'raw':!![],'limit':_0x12697d},'log':_0xa861('0x15')});};exports[_0xa861('0x16')]=function(_0x52ca65,_0x398e49){_0x52ca65[_0xa861('0x17')]=_0x52ca65[_0xa861('0x18')];return client['Request'](_0xa861('0x19'),{'body':_0x52ca65,'options':{'where':{'ContactId':_0x52ca65[_0xa861('0x1a')],'ListId':_0x52ca65['ListId'],'VoiceQueueId':_0x52ca65[_0xa861('0xb')],'CampaignId':_0x52ca65[_0xa861('0x1b')],'active':_0x398e49?undefined:!![]}},'log':_0xa861('0x19')});};exports['countReScheduled']=function(_0x3fd022){return client[_0xa861('0x2')]('CountReScheduled',{'options':{'where':{'VoiceQueueId':_0x3fd022['id']?_0x3fd022['id']||null:null}},'log':_0xa861('0x1c')});};exports[_0xa861('0x1d')]=function(_0x50439d){return function(){return client[_0xa861('0x2')](_0xa861('0x1e'),{'options':{'where':{'id':_0x50439d},'include':[{'model':_0xa861('0x4'),'as':'Contact'},{'model':_0xa861('0x1f'),'as':_0xa861('0x20'),'attributes':['id',_0xa861('0x21')]},{'model':_0xa861('0x22'),'as':_0xa861('0x23'),'attributes':['id',_0xa861('0x21')]}],'raw':!![]},'log':_0xa861('0x5')});};};exports['unlockContact']=function(_0x25eed9,_0x1aab60,_0x8c83a5){return client['Request'](_0xa861('0x7'),{'body':_0x25eed9,'options':{'where':{'id':_0x1aab60},'limit':_0x8c83a5},'log':_0xa861('0x7')});};exports[_0xa861('0x24')]=function(_0x276bb7,_0x34875d){return function(){return client[_0xa861('0x2')]('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x276bb7,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x34875d}},'order':[[_0xa861('0xf'),'DESC'],[_0xa861('0x14'),_0xa861('0x10')],['id',_0xa861('0x11')]],'include':[{'model':_0xa861('0x4'),'as':'Contact'},{'model':_0xa861('0x1f'),'as':_0xa861('0x20'),'attributes':['id',_0xa861('0x21'),_0xa861('0x25')]}],'group':'db.CmHopper.UserId','raw':!![]},'log':_0xa861('0x12')});};};exports['resetActiveCalls']=function(_0xe37c63,_0x1c6f15){return client[_0xa861('0x2')](_0xa861('0x26'),{'body':_0xe37c63,'options':_0x1c6f15||{},'log':_0xa861('0x26')});};exports[_0xa861('0x27')]=function(_0x50e59e,_0x42ad86,_0x11985f){return function(){return client[_0xa861('0x2')](_0xa861('0x28'),{'body':{'where':{'voiceQueueIds':_0x50e59e,'interval':_0x42ad86,'availableAgentsIds':_0x11985f}},'log':_0xa861('0x27')});};}; \ No newline at end of file +var _0x3714=['DESC','ASC','getContactDialerIvr','scheduledat','GetContactDialerIvr','moveContactManagedDialer','MoveContactManagedDialer','countReScheduled','CountReScheduled','getContactPreview','GetCmHopperPreview','User','name','VoiceQueue','Queue','unlockContact','getContactRecallMe','GetContactRecallMe','voicePause','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','Request','CmContact','Contact','getCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','UpdateCmHopper','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','priority'];(function(_0x53ee22,_0x4465c5){var _0x792275=function(_0xe0fbe4){while(--_0xe0fbe4){_0x53ee22['push'](_0x53ee22['shift']());}};_0x792275(++_0x4465c5);}(_0x3714,0x95));var _0x4371=function(_0x246898,_0x4e02fc){_0x246898=_0x246898-0x0;var _0x2e9ee4=_0x3714[_0x246898];return _0x2e9ee4;};'use strict';var client=require(_0x4371('0x0'));var moment=require(_0x4371('0x1'));exports['getContacts']=function(_0x1e969d,_0x3f7fa8){return function(){return client[_0x4371('0x2')]('GetCmHopper',{'options':{'where':{'VoiceQueueId':_0x1e969d},'include':[{'model':_0x4371('0x3'),'as':_0x4371('0x4')}],'limit':_0x3f7fa8,'raw':![]},'log':_0x4371('0x5')});};};exports['updateContacts']=function(_0x10028c,_0x5650a7,_0x349031){return function(){return client[_0x4371('0x2')]('UpdateCmHopper',{'body':_0x10028c,'options':{'where':{'VoiceQueueId':_0x5650a7,'scheduledat':{'$lte':moment()[_0x4371('0x6')](_0x4371('0x7'))}},'limit':_0x349031},'log':_0x4371('0x8')});};};exports[_0x4371('0x9')]=function(_0x4a2544){return client[_0x4371('0x2')]('UpdateCmHopper',{'body':_0x4a2544,'options':{'where':{'ContactId':_0x4a2544[_0x4371('0xa')],'ListId':_0x4a2544[_0x4371('0xb')],'VoiceQueueId':_0x4a2544[_0x4371('0xc')],'CampaignId':_0x4a2544[_0x4371('0xd')]}},'log':'rescheduleContact'});};exports[_0x4371('0xe')]=function(_0x263143,_0x48ef33,_0xe5b862){return function(){return client[_0x4371('0x2')](_0x4371('0xf'),{'options':{'where':{'VoiceQueueId':_0x263143,'ListId':_0x48ef33,'ContactId':_0xe5b862}},'log':_0x4371('0xf')});};};exports[_0x4371('0x10')]=function(_0x48f881,_0x447bad,_0x3ebaaa,_0x3decc7){return client[_0x4371('0x2')](_0x4371('0x11'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x48f881,'active':![],'scheduledat':{'$lte':moment()['format'](_0x4371('0x7'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x447bad}}]},'order':[[_0x4371('0x12'),_0x4371('0x13')],['scheduledat',_0x3decc7],['id',_0x4371('0x14')]],'raw':!![],'limit':_0x3ebaaa},'log':_0x4371('0x11')});};exports[_0x4371('0x15')]=function(_0xa229c4,_0xa5b63f,_0x41a55f){return client[_0x4371('0x2')](_0x4371('0x11'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0xa229c4,'active':![],'scheduledat':{'$lte':moment()[_0x4371('0x6')](_0x4371('0x7'))}},'include':[{'model':_0x4371('0x3'),'as':_0x4371('0x4')}],'order':[[_0x4371('0x12'),'DESC'],[_0x4371('0x16'),_0x41a55f],['id',_0x4371('0x14')]],'raw':!![],'limit':_0xa5b63f},'log':_0x4371('0x17')});};exports[_0x4371('0x18')]=function(_0x2ad3cf,_0x4c40fe){_0x2ad3cf['campaign']=_0x2ad3cf['queue'];return client[_0x4371('0x2')]('MoveContactManagedDialer',{'body':_0x2ad3cf,'options':{'where':{'ContactId':_0x2ad3cf[_0x4371('0xa')],'ListId':_0x2ad3cf[_0x4371('0xb')],'VoiceQueueId':_0x2ad3cf[_0x4371('0xc')],'CampaignId':_0x2ad3cf[_0x4371('0xd')],'active':_0x4c40fe?undefined:!![]}},'log':_0x4371('0x19')});};exports[_0x4371('0x1a')]=function(_0x1b245d){return client[_0x4371('0x2')](_0x4371('0x1b'),{'options':{'where':{'VoiceQueueId':_0x1b245d['id']?_0x1b245d['id']||null:null}},'log':_0x4371('0x1a')});};exports[_0x4371('0x1c')]=function(_0x6478bf){return function(){return client[_0x4371('0x2')](_0x4371('0x1d'),{'options':{'where':{'id':_0x6478bf},'include':[{'model':_0x4371('0x3'),'as':'Contact'},{'model':_0x4371('0x1e'),'as':'Agent','attributes':['id',_0x4371('0x1f')]},{'model':_0x4371('0x20'),'as':_0x4371('0x21'),'attributes':['id',_0x4371('0x1f')]}],'raw':!![]},'log':_0x4371('0x5')});};};exports[_0x4371('0x22')]=function(_0x479e2c,_0x54b4ec,_0x137d76){return client[_0x4371('0x2')]('UpdateCmHopper',{'body':_0x479e2c,'options':{'where':{'id':_0x54b4ec},'limit':_0x137d76},'log':_0x4371('0x8')});};exports[_0x4371('0x23')]=function(_0x2e7cd7,_0x3acddd){return function(){return client[_0x4371('0x2')](_0x4371('0x24'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x2e7cd7,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x4371('0x6')](_0x4371('0x7'))},'UserId':{'$in':_0x3acddd}},'order':[[_0x4371('0x12'),_0x4371('0x13')],[_0x4371('0x16'),_0x4371('0x13')],['id','ASC']],'include':[{'model':_0x4371('0x3'),'as':_0x4371('0x4')},{'model':_0x4371('0x1e'),'as':'Agent','attributes':['id','name',_0x4371('0x25')]}],'group':'db.CmHopper.UserId','raw':!![]},'log':_0x4371('0x11')});};};exports[_0x4371('0x26')]=function(_0x2fc70c,_0x899a78){return client[_0x4371('0x2')](_0x4371('0x27'),{'body':_0x2fc70c,'options':_0x899a78||{},'log':_0x4371('0x27')});};exports[_0x4371('0x28')]=function(_0x5775c8,_0x346a78,_0x1af2a1){return function(){return client[_0x4371('0x2')](_0x4371('0x29'),{'body':{'where':{'voiceQueueIds':_0x5775c8,'interval':_0x346a78,'availableAgentsIds':_0x1af2a1}},'log':'handlePreviewRecallNotifications'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index db381ae..9d7ed38 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2559=['incrementPreviewCounters','../client','verifyAdditionalPhones','Request','VerifyAdditionalPhones','SwapAdditionalPhones'];(function(_0x561771,_0x554760){var _0x54d16e=function(_0x381c1f){while(--_0x381c1f){_0x561771['push'](_0x561771['shift']());}};_0x54d16e(++_0x554760);}(_0x2559,0x11b));var _0x9255=function(_0x52b897,_0x54262c){_0x52b897=_0x52b897-0x0;var _0x21b3b1=_0x2559[_0x52b897];return _0x21b3b1;};'use strict';var client=require(_0x9255('0x0'));exports[_0x9255('0x1')]=function(_0x4160f1,_0x43f95e,_0xf56b02){return client[_0x9255('0x2')](_0x9255('0x3'),{'body':_0x4160f1,'reason':_0x43f95e,'entity':_0xf56b02,'log':_0x9255('0x3')});};exports['swapAdditionalPhones']=function(_0x1c3070,_0x26acd6,_0x31077f){return client[_0x9255('0x2')](_0x9255('0x4'),{'body':_0x1c3070,'duration':_0x26acd6,'waitTime':_0x31077f,'log':'SwapAdditionalPhones'});};exports[_0x9255('0x5')]=function(_0x4d3ebe){return function(){return client[_0x9255('0x2')]('IncrementPreviewCounters',{'body':_0x4d3ebe,'log':'IncrementPreviewCounters'});};}; \ No newline at end of file +var _0x6496=['SwapAdditionalPhones','incrementPreviewCounters','Request','IncrementPreviewCounters','../client','VerifyAdditionalPhones'];(function(_0x5dae73,_0x3c6ddb){var _0x518ddb=function(_0x4ab39f){while(--_0x4ab39f){_0x5dae73['push'](_0x5dae73['shift']());}};_0x518ddb(++_0x3c6ddb);}(_0x6496,0xe8));var _0x6649=function(_0x5674fc,_0x2b623b){_0x5674fc=_0x5674fc-0x0;var _0x2444a5=_0x6496[_0x5674fc];return _0x2444a5;};'use strict';var client=require(_0x6649('0x0'));exports['verifyAdditionalPhones']=function(_0x18f06d,_0x5a5b28,_0x2da1bb){return client['Request']('VerifyAdditionalPhones',{'body':_0x18f06d,'reason':_0x5a5b28,'entity':_0x2da1bb,'log':_0x6649('0x1')});};exports['swapAdditionalPhones']=function(_0x116cf0,_0x3a8d35,_0x3580d5){return client['Request'](_0x6649('0x2'),{'body':_0x116cf0,'duration':_0x3a8d35,'waitTime':_0x3580d5,'log':_0x6649('0x2')});};exports[_0x6649('0x3')]=function(_0xcadf18){return function(){return client[_0x6649('0x4')]('IncrementPreviewCounters',{'body':_0xcadf18,'log':_0x6649('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index 01a2ccb..501cbdc 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6e38=['VoiceQueueId','checkIsBlackListIvr','Request','GetCmHopperBlackIvr','../client','checkIsBlackList','GetCmHopperBlack'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6e38,0x82));var _0x86e3=function(_0x436c80,_0xcd24dc){_0x436c80=_0x436c80-0x0;var _0x18b1f5=_0x6e38[_0x436c80];return _0x18b1f5;};'use strict';var client=require(_0x86e3('0x0'));exports[_0x86e3('0x1')]=function(_0x8c057){return client['Request'](_0x86e3('0x2'),{'options':{'where':{'VoiceQueueId':_0x8c057[_0x86e3('0x3')],'phone':_0x8c057['phone']},'raw':![]},'log':'GetCmHopperBlack'});};exports[_0x86e3('0x4')]=function(_0x622b31){return client[_0x86e3('0x5')]('GetCmHopperBlack',{'options':{'where':{'CampaignId':_0x622b31['CampaignId'],'phone':_0x622b31['phone']},'raw':![]},'log':_0x86e3('0x6')});}; \ No newline at end of file +var _0x69aa=['phone','checkIsBlackListIvr','Request','CampaignId','GetCmHopperBlackIvr','../client','checkIsBlackList','VoiceQueueId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x69aa,0x1ed));var _0xa69a=function(_0x53901e,_0x46c63f){_0x53901e=_0x53901e-0x0;var _0x59460a=_0x69aa[_0x53901e];return _0x59460a;};'use strict';var client=require(_0xa69a('0x0'));exports[_0xa69a('0x1')]=function(_0x2d2123){return client['Request']('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x2d2123[_0xa69a('0x2')],'phone':_0x2d2123[_0xa69a('0x3')]},'raw':![]},'log':'GetCmHopperBlack'});};exports[_0xa69a('0x4')]=function(_0x2643a2){return client[_0xa69a('0x5')]('GetCmHopperBlack',{'options':{'where':{'CampaignId':_0x2643a2[_0xa69a('0x6')],'phone':_0x2643a2[_0xa69a('0x3')]},'raw':![]},'log':_0xa69a('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index 6ded100..7f31329 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7950=['createContact','CreateCmHopperFinal','../client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7950,0x1b2));var _0x0795=function(_0x3f613f,_0x16f198){_0x3f613f=_0x3f613f-0x0;var _0x23b8e3=_0x7950[_0x3f613f];return _0x23b8e3;};'use strict';var client=require(_0x0795('0x0'));exports[_0x0795('0x1')]=function(_0x38f0c2){return function(){_0x38f0c2['campaign']=_0x38f0c2['queue'];return client['Request'](_0x0795('0x2'),{'body':_0x38f0c2,'log':_0x0795('0x2')});};}; \ No newline at end of file +var _0x7ba9=['createContact','queue','CreateCmHopperFinal','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ba9,0xfb));var _0x97ba=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x7ba9[_0x38a7ac];return _0x53061a;};'use strict';var client=require(_0x97ba('0x0'));exports[_0x97ba('0x1')]=function(_0x353777){return function(){_0x353777['campaign']=_0x353777[_0x97ba('0x2')];return client['Request']('CreateCmHopperFinal',{'body':_0x353777,'log':_0x97ba('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index e7b8b0f..42c8821 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab9c=['queue','Request','CreateCmHopperHistory','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','startOf','endOf','day','getCampaignHopperHistory','GetCampaignHopperHistory','ivr','../client','moment','createHistory','campaign'];(function(_0x225fb4,_0x2a94cb){var _0x402023=function(_0x2960f3){while(--_0x2960f3){_0x225fb4['push'](_0x225fb4['shift']());}};_0x402023(++_0x2a94cb);}(_0xab9c,0x18c));var _0xcab9=function(_0x221983,_0x17c052){_0x221983=_0x221983-0x0;var _0x5d69cc=_0xab9c[_0x221983];return _0x5d69cc;};'use strict';var client=require(_0xcab9('0x0'));var moment=require(_0xcab9('0x1'));exports[_0xcab9('0x2')]=function(_0x734e89){_0x734e89[_0xcab9('0x3')]=_0x734e89[_0xcab9('0x4')];return client[_0xcab9('0x5')](_0xcab9('0x6'),{'body':_0x734e89,'log':_0xcab9('0x6')});};exports['avgHandleTime']=function(_0x416448){return client[_0xcab9('0x5')]('AvgHandleTime',{'options':{'where':{'endtime':{'$between':[moment()[_0xcab9('0x7')](_0x416448,_0xcab9('0x8'))[_0xcab9('0x9')](_0xcab9('0xa')),moment()[_0xcab9('0x9')]('YYYY-MM-DD\x20HH:mm:ss')]}},'raw':![]},'log':_0xcab9('0xb')});};exports[_0xcab9('0xc')]=function(){return function(){return client[_0xcab9('0x5')](_0xcab9('0xd'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xcab9('0xe')]('day')[_0xcab9('0x9')](_0xcab9('0xa')),moment()[_0xcab9('0xf')](_0xcab9('0x10'))['format'](_0xcab9('0xa'))]},'campaigntype':_0xcab9('0x4')},'raw':![]},'log':'GetVoiceQueueHopperHistory'});};};exports[_0xcab9('0x11')]=function(){return function(){return client['Request'](_0xcab9('0x12'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0xcab9('0x10'))[_0xcab9('0x9')](_0xcab9('0xa')),moment()[_0xcab9('0xf')](_0xcab9('0x10'))[_0xcab9('0x9')](_0xcab9('0xa'))]},'campaigntype':_0xcab9('0x13')},'raw':![]},'log':_0xcab9('0x12')});};}; \ No newline at end of file +var _0xd73e=['campaign','Request','CreateCmHopperHistory','avgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','startOf','day','ivr','GetCampaignHopperHistory','../client','moment','createHistory'];(function(_0x4de927,_0x3211aa){var _0x1813fa=function(_0x3b1479){while(--_0x3b1479){_0x4de927['push'](_0x4de927['shift']());}};_0x1813fa(++_0x3211aa);}(_0xd73e,0x165));var _0xed73=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd73e[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xed73('0x0'));var moment=require(_0xed73('0x1'));exports[_0xed73('0x2')]=function(_0x8238f4){_0x8238f4[_0xed73('0x3')]=_0x8238f4['queue'];return client[_0xed73('0x4')](_0xed73('0x5'),{'body':_0x8238f4,'log':_0xed73('0x5')});};exports[_0xed73('0x6')]=function(_0x2fbba7){return client[_0xed73('0x4')]('AvgHandleTime',{'options':{'where':{'endtime':{'$between':[moment()[_0xed73('0x7')](_0x2fbba7,_0xed73('0x8'))[_0xed73('0x9')](_0xed73('0xa')),moment()['format'](_0xed73('0xa'))]}},'raw':![]},'log':_0xed73('0xb')});};exports[_0xed73('0xc')]=function(){return function(){return client[_0xed73('0x4')](_0xed73('0xd'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xed73('0xe')]('day')[_0xed73('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xed73('0xf'))[_0xed73('0x9')](_0xed73('0xa'))]},'campaigntype':'queue'},'raw':![]},'log':_0xed73('0xd')});};};exports['getCampaignHopperHistory']=function(){return function(){return client[_0xed73('0x4')]('GetCampaignHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0xed73('0xe')](_0xed73('0xf'))[_0xed73('0x9')](_0xed73('0xa')),moment()['endOf']('day')['format']('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0xed73('0x10')},'raw':![]},'log':_0xed73('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index 9d08a55..8966fdf 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6c0=['tech','TrunkId','ListId','key','Trunk','callerid','active','getFaxAccount','notify','NotifyFaxAccount','../client','Request','GetFaxAccount','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','t38timeout'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xc6c0,0x13e));var _0x0c6c=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0xc6c0[_0x3e6d5d];return _0x238923;};'use strict';var client=require(_0x0c6c('0x0'));exports['getFaxAccounts']=function(){return function(){return client[_0x0c6c('0x1')](_0x0c6c('0x2'),{'options':{'raw':![],'attributes':['id',_0x0c6c('0x3'),_0x0c6c('0x4'),_0x0c6c('0x5'),_0x0c6c('0x6'),_0x0c6c('0x7'),_0x0c6c('0x8'),_0x0c6c('0x9'),_0x0c6c('0xa'),'gateway','faxdetect',_0x0c6c('0xb'),_0x0c6c('0xc'),_0x0c6c('0xd'),_0x0c6c('0xe'),_0x0c6c('0xf')],'include':[{'model':_0x0c6c('0x10'),'as':_0x0c6c('0x10'),'attributes':['id',_0x0c6c('0x3'),_0x0c6c('0x11'),_0x0c6c('0x12')]}]},'log':_0x0c6c('0x13')});};};exports[_0x0c6c('0x14')]=function(_0x238229,_0xa07974){return client[_0x0c6c('0x1')]('NotifyFaxAccount',{'account':{'id':_0x238229},'body':_0xa07974,'log':_0x0c6c('0x15')});}; \ No newline at end of file +var _0x5b12=['gateway','tech','TrunkId','ListId','key','Trunk','callerid','getFaxAccount','notify','NotifyFaxAccount','../client','getFaxAccounts','Request','name','ecm','headerinfo','minrate'];(function(_0xb15188,_0x120f18){var _0x3a685e=function(_0x1bdae3){while(--_0x1bdae3){_0xb15188['push'](_0xb15188['shift']());}};_0x3a685e(++_0x120f18);}(_0x5b12,0xa3));var _0x25b1=function(_0x5f202e,_0x270802){_0x5f202e=_0x5f202e-0x0;var _0x217ba4=_0x5b12[_0x5f202e];return _0x217ba4;};'use strict';var client=require(_0x25b1('0x0'));exports[_0x25b1('0x1')]=function(){return function(){return client[_0x25b1('0x2')]('GetFaxAccount',{'options':{'raw':![],'attributes':['id',_0x25b1('0x3'),'description',_0x25b1('0x4'),_0x25b1('0x5'),'localstationid',_0x25b1('0x6'),'maxrate','modem',_0x25b1('0x7'),'faxdetect','t38timeout',_0x25b1('0x8'),_0x25b1('0x9'),_0x25b1('0xa'),_0x25b1('0xb')],'include':[{'model':_0x25b1('0xc'),'as':_0x25b1('0xc'),'attributes':['id',_0x25b1('0x3'),_0x25b1('0xd'),'active']}]},'log':_0x25b1('0xe')});};};exports[_0x25b1('0xf')]=function(_0x2cee35,_0x34abe5){return client[_0x25b1('0x2')](_0x25b1('0x10'),{'account':{'id':_0x2cee35},'body':_0x34abe5,'log':_0x25b1('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index 1485c32..00a81da 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc4c=['UpdateFaxMessage','../client','Request'];(function(_0x1ba32d,_0x40fc84){var _0x2fb7f7=function(_0xbd136c){while(--_0xbd136c){_0x1ba32d['push'](_0x1ba32d['shift']());}};_0x2fb7f7(++_0x40fc84);}(_0xdc4c,0x94));var _0xcdc4=function(_0x473345,_0x2ed6c9){_0x473345=_0x473345-0x0;var _0x591aa4=_0xdc4c[_0x473345];return _0x591aa4;};'use strict';var client=require(_0xcdc4('0x0'));exports['update']=function(_0x5af7d3,_0x984969){return client[_0xcdc4('0x1')]('UpdateFaxMessage',{'body':_0x984969,'options':{'where':{'AttachmentId':_0x5af7d3}},'log':_0xcdc4('0x2')});}; \ No newline at end of file +var _0x73c4=['Request','UpdateFaxMessage','../client','update'];(function(_0xa483b6,_0xfcdf3b){var _0x563dc6=function(_0x598d43){while(--_0x598d43){_0xa483b6['push'](_0xa483b6['shift']());}};_0x563dc6(++_0xfcdf3b);}(_0x73c4,0xae));var _0x473c=function(_0x1aba25,_0x1faed1){_0x1aba25=_0x1aba25-0x0;var _0x47d997=_0x73c4[_0x1aba25];return _0x47d997;};'use strict';var client=require(_0x473c('0x0'));exports[_0x473c('0x1')]=function(_0x543d77,_0x2ee56f){return client[_0x473c('0x2')](_0x473c('0x3'),{'body':_0x2ee56f,'options':{'where':{'AttachmentId':_0x543d77}},'log':_0x473c('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index 1d6525d..5ea151a 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaed3=['getDeskAccounts','Request','GetDeskAccount','name','description','remoteUri','type','serverUrl','DeskField','content','variableName','Variable','Descriptions','key','keyContent','Fields','idField','nameField','customField','Tag'];(function(_0xe2cf38,_0x4fc284){var _0x1692cb=function(_0x3f44a5){while(--_0x3f44a5){_0xe2cf38['push'](_0xe2cf38['shift']());}};_0x1692cb(++_0x4fc284);}(_0xaed3,0xb4));var _0x3aed=function(_0x15cbce,_0xda8402){_0x15cbce=_0x15cbce-0x0;var _0x257f29=_0xaed3[_0x15cbce];return _0x257f29;};'use strict';var client=require('../../client');exports[_0x3aed('0x0')]=function(){return function(_0x7aed76){return client[_0x3aed('0x1')](_0x3aed('0x2'),{'options':{'raw':![],'attributes':['id',_0x3aed('0x3'),_0x3aed('0x4'),'username','password',_0x3aed('0x5'),'authType',_0x3aed('0x6'),_0x3aed('0x7')],'include':[{'model':'DeskConfiguration','as':'Configurations','attributes':['id','name'],'include':[{'model':_0x3aed('0x8'),'as':'Subjects','attributes':['id','type',_0x3aed('0x9'),_0x3aed('0xa')],'include':[{'model':'Variable','as':_0x3aed('0xb'),'attributes':['id','name']}]},{'model':_0x3aed('0x8'),'as':_0x3aed('0xc'),'attributes':['id',_0x3aed('0x6'),_0x3aed('0x9'),_0x3aed('0xd'),'keyType',_0x3aed('0xe'),'variableName'],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x3aed('0x3')]}]},{'model':_0x3aed('0x8'),'as':_0x3aed('0xf'),'attributes':['id',_0x3aed('0x6'),_0x3aed('0x9'),_0x3aed('0x10'),_0x3aed('0x11'),_0x3aed('0x12'),_0x3aed('0xa')],'include':[{'model':_0x3aed('0xb'),'as':_0x3aed('0xb'),'attributes':['id',_0x3aed('0x3')]}]},{'model':_0x3aed('0x13'),'as':'Tags','attributes':['id',_0x3aed('0x3')]}]}]},'log':_0x3aed('0x2')});};}; \ No newline at end of file +var _0xe600=['GetDeskAccount','getDeskAccounts','Request','name','username','password','remoteUri','type','serverUrl','DeskConfiguration','Subjects','content','variableName','Variable','DeskField','Descriptions','key','keyType','keyContent','Fields','idField','nameField','customField','Tag','Tags'];(function(_0x518901,_0x5722bf){var _0x168d76=function(_0x3ca87d){while(--_0x3ca87d){_0x518901['push'](_0x518901['shift']());}};_0x168d76(++_0x5722bf);}(_0xe600,0x65));var _0x0e60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe600[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../../client');exports[_0x0e60('0x0')]=function(){return function(_0x19b930){return client[_0x0e60('0x1')]('GetDeskAccount',{'options':{'raw':![],'attributes':['id',_0x0e60('0x2'),'description',_0x0e60('0x3'),_0x0e60('0x4'),_0x0e60('0x5'),'authType',_0x0e60('0x6'),_0x0e60('0x7')],'include':[{'model':_0x0e60('0x8'),'as':'Configurations','attributes':['id',_0x0e60('0x2')],'include':[{'model':'DeskField','as':_0x0e60('0x9'),'attributes':['id','type',_0x0e60('0xa'),_0x0e60('0xb')],'include':[{'model':_0x0e60('0xc'),'as':_0x0e60('0xc'),'attributes':['id',_0x0e60('0x2')]}]},{'model':_0x0e60('0xd'),'as':_0x0e60('0xe'),'attributes':['id',_0x0e60('0x6'),'content',_0x0e60('0xf'),_0x0e60('0x10'),_0x0e60('0x11'),_0x0e60('0xb')],'include':[{'model':'Variable','as':_0x0e60('0xc'),'attributes':['id',_0x0e60('0x2')]}]},{'model':_0x0e60('0xd'),'as':_0x0e60('0x12'),'attributes':['id',_0x0e60('0x6'),_0x0e60('0xa'),_0x0e60('0x13'),_0x0e60('0x14'),_0x0e60('0x15'),_0x0e60('0xb')],'include':[{'model':'Variable','as':_0x0e60('0xc'),'attributes':['id',_0x0e60('0x2')]}]},{'model':_0x0e60('0x16'),'as':_0x0e60('0x17'),'attributes':['id',_0x0e60('0x2')]}]}]},'log':_0x0e60('0x18')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index 708f990..93dadd0 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc06d=['Dynamics365Field','content','Variable','Descriptions','type','keyType','keyContent','variableName','Fields','idField','nameField','customField','CloudProvider','data2','data5','GetDynamics365Account','../../client','getDynamics365Accounts','Request','name','username','tenantId','clientSecret','serverUrl','Dynamics365Configuration','Configurations','ticketType','moduleCreate','additionalSearchContact','openNewTab'];(function(_0x7c18b3,_0x3cd707){var _0x36c353=function(_0x1b646d){while(--_0x1b646d){_0x7c18b3['push'](_0x7c18b3['shift']());}};_0x36c353(++_0x3cd707);}(_0xc06d,0x15a));var _0xdc06=function(_0x36296b,_0x3065e1){_0x36296b=_0x36296b-0x0;var _0x5e25b3=_0xc06d[_0x36296b];return _0x5e25b3;};'use strict';var client=require(_0xdc06('0x0'));exports[_0xdc06('0x1')]=function(){return function(_0x3d4a6a){return client[_0xdc06('0x2')]('GetDynamics365Account',{'options':{'raw':![],'attributes':['id',_0xdc06('0x3'),_0xdc06('0x4'),'password','remoteUri',_0xdc06('0x5'),'clientId',_0xdc06('0x6'),_0xdc06('0x7'),'description','modernAuthentication'],'include':[{'model':_0xdc06('0x8'),'as':_0xdc06('0x9'),'attributes':['id','name',_0xdc06('0xa'),_0xdc06('0xb'),_0xdc06('0xc'),_0xdc06('0xd')],'include':[{'model':_0xdc06('0xe'),'as':'Subjects','attributes':['id','type',_0xdc06('0xf'),'variableName'],'include':[{'model':_0xdc06('0x10'),'as':_0xdc06('0x10'),'attributes':['id',_0xdc06('0x3')]}]},{'model':_0xdc06('0xe'),'as':_0xdc06('0x11'),'attributes':['id',_0xdc06('0x12'),'content','key',_0xdc06('0x13'),_0xdc06('0x14'),_0xdc06('0x15')],'include':[{'model':'Variable','as':_0xdc06('0x10'),'attributes':['id',_0xdc06('0x3')]}]},{'model':_0xdc06('0xe'),'as':_0xdc06('0x16'),'attributes':['id',_0xdc06('0x12'),'content',_0xdc06('0x17'),_0xdc06('0x18'),_0xdc06('0x19'),_0xdc06('0x15')],'include':[{'model':_0xdc06('0x10'),'as':_0xdc06('0x10'),'attributes':['id',_0xdc06('0x3')]}]}]},{'model':'CloudProvider','as':_0xdc06('0x1a'),'attributes':['id',_0xdc06('0x1b'),_0xdc06('0x1c'),'data7']}]},'log':_0xdc06('0x1d')});};}; \ No newline at end of file +var _0xa2cb=['keyType','keyContent','Fields','idField','nameField','customField','CloudProvider','data5','data7','../../client','getDynamics365Accounts','Request','GetDynamics365Account','name','username','password','description','Dynamics365Configuration','ticketType','additionalSearchContact','openNewTab','Subjects','type','content','variableName','Variable','Dynamics365Field','Descriptions','key'];(function(_0x5e03c1,_0x55a077){var _0x1b3c3f=function(_0x1e2ed2){while(--_0x1e2ed2){_0x5e03c1['push'](_0x5e03c1['shift']());}};_0x1b3c3f(++_0x55a077);}(_0xa2cb,0x7d));var _0xba2c=function(_0x170d33,_0x278a5e){_0x170d33=_0x170d33-0x0;var _0x11328a=_0xa2cb[_0x170d33];return _0x11328a;};'use strict';var client=require(_0xba2c('0x0'));exports[_0xba2c('0x1')]=function(){return function(_0x48e37a){return client[_0xba2c('0x2')](_0xba2c('0x3'),{'options':{'raw':![],'attributes':['id',_0xba2c('0x4'),_0xba2c('0x5'),_0xba2c('0x6'),'remoteUri','tenantId','clientId','clientSecret','serverUrl',_0xba2c('0x7'),'modernAuthentication'],'include':[{'model':_0xba2c('0x8'),'as':'Configurations','attributes':['id',_0xba2c('0x4'),_0xba2c('0x9'),'moduleCreate',_0xba2c('0xa'),_0xba2c('0xb')],'include':[{'model':'Dynamics365Field','as':_0xba2c('0xc'),'attributes':['id',_0xba2c('0xd'),_0xba2c('0xe'),_0xba2c('0xf')],'include':[{'model':'Variable','as':_0xba2c('0x10'),'attributes':['id',_0xba2c('0x4')]}]},{'model':_0xba2c('0x11'),'as':_0xba2c('0x12'),'attributes':['id',_0xba2c('0xd'),_0xba2c('0xe'),_0xba2c('0x13'),_0xba2c('0x14'),_0xba2c('0x15'),_0xba2c('0xf')],'include':[{'model':'Variable','as':_0xba2c('0x10'),'attributes':['id',_0xba2c('0x4')]}]},{'model':_0xba2c('0x11'),'as':_0xba2c('0x16'),'attributes':['id',_0xba2c('0xd'),_0xba2c('0xe'),_0xba2c('0x17'),_0xba2c('0x18'),_0xba2c('0x19'),'variableName'],'include':[{'model':_0xba2c('0x10'),'as':_0xba2c('0x10'),'attributes':['id',_0xba2c('0x4')]}]}]},{'model':_0xba2c('0x1a'),'as':_0xba2c('0x1a'),'attributes':['id','data2',_0xba2c('0x1b'),_0xba2c('0x1c')]}]},'log':'GetDynamics365Account'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index 52cc779..eaa1a67 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a86=['remoteUri','serverUrl','FreshdeskConfiguration','Configurations','Tag','FreshdeskField','Subjects','type','content','Variable','Descriptions','key','keyType','keyContent','variableName','Fields','idField','nameField','../../client','getFreshdeskAccounts','Request','GetFreshdeskAccount','name','username','apiKey'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0x9a86,0x1ed));var _0x69a8=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x9a86[_0x5037ab];return _0x512adb;};'use strict';var client=require(_0x69a8('0x0'));exports[_0x69a8('0x1')]=function(){return function(_0x5bf581){return client[_0x69a8('0x2')](_0x69a8('0x3'),{'options':{'raw':![],'attributes':['id',_0x69a8('0x4'),_0x69a8('0x5'),_0x69a8('0x6'),_0x69a8('0x7'),_0x69a8('0x8')],'include':[{'model':_0x69a8('0x9'),'as':_0x69a8('0xa'),'attributes':['id',_0x69a8('0x4')],'include':[{'model':_0x69a8('0xb'),'attributes':['id',_0x69a8('0x4')]},{'model':_0x69a8('0xc'),'as':_0x69a8('0xd'),'attributes':['id',_0x69a8('0xe'),_0x69a8('0xf'),'variableName'],'include':[{'model':_0x69a8('0x10'),'as':_0x69a8('0x10'),'attributes':['id','name']}]},{'model':_0x69a8('0xc'),'as':_0x69a8('0x11'),'attributes':['id','type','content',_0x69a8('0x12'),_0x69a8('0x13'),_0x69a8('0x14'),_0x69a8('0x15')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x69a8('0x4')]}]},{'model':'FreshdeskField','as':_0x69a8('0x16'),'attributes':['id',_0x69a8('0xe'),_0x69a8('0xf'),_0x69a8('0x17'),_0x69a8('0x18'),'customField',_0x69a8('0x15')],'include':[{'model':'Variable','as':_0x69a8('0x10'),'attributes':['id',_0x69a8('0x4')]}]}]}]},'log':'GetFreshdeskAccount'});};}; \ No newline at end of file +var _0x9d62=['name','Tag','FreshdeskField','Subjects','type','variableName','Variable','Descriptions','content','keyType','keyContent','idField','nameField','customField','../../client','getFreshdeskAccounts','Request','GetFreshdeskAccount','username','apiKey','remoteUri','serverUrl','FreshdeskConfiguration'];(function(_0x5da63e,_0x4d3503){var _0x442aca=function(_0x6d5bca){while(--_0x6d5bca){_0x5da63e['push'](_0x5da63e['shift']());}};_0x442aca(++_0x4d3503);}(_0x9d62,0xaf));var _0x29d6=function(_0x1b1d27,_0x2e65a7){_0x1b1d27=_0x1b1d27-0x0;var _0x53f520=_0x9d62[_0x1b1d27];return _0x53f520;};'use strict';var client=require(_0x29d6('0x0'));exports[_0x29d6('0x1')]=function(){return function(_0x2eafa1){return client[_0x29d6('0x2')](_0x29d6('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x29d6('0x4'),_0x29d6('0x5'),_0x29d6('0x6'),_0x29d6('0x7')],'include':[{'model':_0x29d6('0x8'),'as':'Configurations','attributes':['id',_0x29d6('0x9')],'include':[{'model':_0x29d6('0xa'),'attributes':['id',_0x29d6('0x9')]},{'model':_0x29d6('0xb'),'as':_0x29d6('0xc'),'attributes':['id',_0x29d6('0xd'),'content',_0x29d6('0xe')],'include':[{'model':_0x29d6('0xf'),'as':_0x29d6('0xf'),'attributes':['id',_0x29d6('0x9')]}]},{'model':_0x29d6('0xb'),'as':_0x29d6('0x10'),'attributes':['id',_0x29d6('0xd'),_0x29d6('0x11'),'key',_0x29d6('0x12'),_0x29d6('0x13'),_0x29d6('0xe')],'include':[{'model':_0x29d6('0xf'),'as':_0x29d6('0xf'),'attributes':['id',_0x29d6('0x9')]}]},{'model':_0x29d6('0xb'),'as':'Fields','attributes':['id',_0x29d6('0xd'),'content',_0x29d6('0x14'),_0x29d6('0x15'),_0x29d6('0x16'),_0x29d6('0xe')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]}]}]},'log':_0x29d6('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index 2fc7a74..c8d720a 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bd8=['../../client','Request','GetFreshsalesAccount','name','username','apiKey','remoteUri','FreshsalesConfiguration','Configurations','Subjects','type','content','variableName','Variable','keyType','GetFreshsalesccount'];(function(_0x1254cf,_0x4c27a4){var _0x313442=function(_0x3faef5){while(--_0x3faef5){_0x1254cf['push'](_0x1254cf['shift']());}};_0x313442(++_0x4c27a4);}(_0x2bd8,0x130));var _0x82bd=function(_0xb83f94,_0x10b491){_0xb83f94=_0xb83f94-0x0;var _0x5030be=_0x2bd8[_0xb83f94];return _0x5030be;};'use strict';var client=require(_0x82bd('0x0'));exports['getFreshsalesAccounts']=function(){return function(_0x220cfa){return client[_0x82bd('0x1')](_0x82bd('0x2'),{'options':{'raw':![],'attributes':['id',_0x82bd('0x3'),_0x82bd('0x4'),_0x82bd('0x5'),_0x82bd('0x6'),'serverUrl'],'include':[{'model':_0x82bd('0x7'),'as':_0x82bd('0x8'),'attributes':['id',_0x82bd('0x3')],'include':[{'model':'FreshsalesField','as':_0x82bd('0x9'),'attributes':['id',_0x82bd('0xa'),_0x82bd('0xb'),_0x82bd('0xc')],'include':[{'model':'Variable','as':_0x82bd('0xd'),'attributes':['id','name']}]},{'model':'FreshsalesField','as':'Descriptions','attributes':['id',_0x82bd('0xa'),'content','key',_0x82bd('0xe'),'keyContent','variableName'],'include':[{'model':_0x82bd('0xd'),'as':_0x82bd('0xd'),'attributes':['id','name']}]}]}]},'log':_0x82bd('0xf')});};}; \ No newline at end of file +var _0x5d58=['username','remoteUri','serverUrl','Configurations','FreshsalesField','Subjects','content','variableName','Variable','Descriptions','type','keyContent','GetFreshsalesccount','name'];(function(_0x4ab766,_0xd65436){var _0x4ea49e=function(_0x3da8fc){while(--_0x3da8fc){_0x4ab766['push'](_0x4ab766['shift']());}};_0x4ea49e(++_0xd65436);}(_0x5d58,0x187));var _0x85d5=function(_0x30c919,_0x1361a3){_0x30c919=_0x30c919-0x0;var _0x31f8f2=_0x5d58[_0x30c919];return _0x31f8f2;};'use strict';var client=require('../../client');exports['getFreshsalesAccounts']=function(){return function(_0x5e2da7){return client['Request']('GetFreshsalesAccount',{'options':{'raw':![],'attributes':['id',_0x85d5('0x0'),_0x85d5('0x1'),'apiKey',_0x85d5('0x2'),_0x85d5('0x3')],'include':[{'model':'FreshsalesConfiguration','as':_0x85d5('0x4'),'attributes':['id',_0x85d5('0x0')],'include':[{'model':_0x85d5('0x5'),'as':_0x85d5('0x6'),'attributes':['id','type',_0x85d5('0x7'),_0x85d5('0x8')],'include':[{'model':'Variable','as':_0x85d5('0x9'),'attributes':['id','name']}]},{'model':_0x85d5('0x5'),'as':_0x85d5('0xa'),'attributes':['id',_0x85d5('0xb'),'content','key','keyType',_0x85d5('0xc'),_0x85d5('0x8')],'include':[{'model':_0x85d5('0x9'),'as':_0x85d5('0x9'),'attributes':['id',_0x85d5('0x0')]}]}]}]},'log':_0x85d5('0xd')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index e4e748f..d0ba6a7 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c82=['type','SalesforceConfiguration','Configurations','moduleSearch','additionalSearchAccount','additionalSearchLead','SalesforceField','Variable','../../client','getSalesforceAccounts','Request','GetSalesforceAccount','name','username','password','remoteUri','clientId','clientSecret','securityToken','serverUrl'];(function(_0x286819,_0x84199){var _0x29a0fe=function(_0x5b48b0){while(--_0x5b48b0){_0x286819['push'](_0x286819['shift']());}};_0x29a0fe(++_0x84199);}(_0x5c82,0x198));var _0x25c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c82[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x25c8('0x0'));exports[_0x25c8('0x1')]=function(){return function(_0x3c64df){return client[_0x25c8('0x2')](_0x25c8('0x3'),{'options':{'raw':![],'attributes':['id',_0x25c8('0x4'),_0x25c8('0x5'),_0x25c8('0x6'),_0x25c8('0x7'),_0x25c8('0x8'),_0x25c8('0x9'),_0x25c8('0xa'),_0x25c8('0xb'),_0x25c8('0xc')],'include':[{'model':_0x25c8('0xd'),'as':_0x25c8('0xe'),'attributes':['id',_0x25c8('0x4'),_0x25c8('0xf'),'moduleCreate','ticketType','leadId',_0x25c8('0x10'),'additionalSearchContact',_0x25c8('0x11')],'include':[{'model':_0x25c8('0x12'),'as':'Subjects','include':[{'model':_0x25c8('0x13'),'as':'Variable','attributes':['id',_0x25c8('0x4')]}]},{'model':_0x25c8('0x12'),'as':'Descriptions','include':[{'model':'Variable','as':_0x25c8('0x13'),'attributes':['id',_0x25c8('0x4')]}]},{'model':_0x25c8('0x12'),'as':'Fields','include':[{'model':_0x25c8('0x13'),'as':_0x25c8('0x13'),'attributes':['id',_0x25c8('0x4')]}]}]}]},'log':_0x25c8('0x3')});};}; \ No newline at end of file +var _0xbaf0=['Request','GetSalesforceAccount','name','username','remoteUri','clientId','clientSecret','securityToken','serverUrl','type','SalesforceConfiguration','Configurations','moduleCreate','leadId','additionalSearchAccount','additionalSearchContact','additionalSearchLead','SalesforceField','Subjects','Variable','Descriptions','Fields','getSalesforceAccounts'];(function(_0x25766f,_0x602740){var _0xc88ed1=function(_0x4b4f7f){while(--_0x4b4f7f){_0x25766f['push'](_0x25766f['shift']());}};_0xc88ed1(++_0x602740);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var client=require('../../client');exports[_0x0baf('0x0')]=function(){return function(_0x2a3620){return client[_0x0baf('0x1')](_0x0baf('0x2'),{'options':{'raw':![],'attributes':['id',_0x0baf('0x3'),_0x0baf('0x4'),'password',_0x0baf('0x5'),_0x0baf('0x6'),_0x0baf('0x7'),_0x0baf('0x8'),_0x0baf('0x9'),_0x0baf('0xa')],'include':[{'model':_0x0baf('0xb'),'as':_0x0baf('0xc'),'attributes':['id',_0x0baf('0x3'),'moduleSearch',_0x0baf('0xd'),'ticketType',_0x0baf('0xe'),_0x0baf('0xf'),_0x0baf('0x10'),_0x0baf('0x11')],'include':[{'model':_0x0baf('0x12'),'as':_0x0baf('0x13'),'include':[{'model':_0x0baf('0x14'),'as':_0x0baf('0x14'),'attributes':['id',_0x0baf('0x3')]}]},{'model':_0x0baf('0x12'),'as':_0x0baf('0x15'),'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x0baf('0x3')]}]},{'model':_0x0baf('0x12'),'as':_0x0baf('0x16'),'include':[{'model':_0x0baf('0x14'),'as':'Variable','attributes':['id',_0x0baf('0x3')]}]}]}]},'log':'GetSalesforceAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index 8cf13a0..8a78225 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4137=['Request','GetServicenowAccount','name','description','username','password','email','remoteUri','serverUrl','Configurations','ServicenowField','Subjects','content','variableName','Variable','Descriptions','type','key','keyType','Fields','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts'];(function(_0x234fb3,_0x1168ae){var _0x37d9c8=function(_0x3f56d3){while(--_0x3f56d3){_0x234fb3['push'](_0x234fb3['shift']());}};_0x37d9c8(++_0x1168ae);}(_0x4137,0xf8));var _0x7413=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x4137[_0x46e363];return _0x3fb059;};'use strict';var client=require(_0x7413('0x0'));exports[_0x7413('0x1')]=function(){return function(_0x370399){return client[_0x7413('0x2')](_0x7413('0x3'),{'options':{'raw':![],'attributes':['id',_0x7413('0x4'),_0x7413('0x5'),_0x7413('0x6'),_0x7413('0x7'),_0x7413('0x8'),_0x7413('0x9'),_0x7413('0xa')],'include':[{'model':'ServicenowConfiguration','as':_0x7413('0xb'),'attributes':['id',_0x7413('0x4')],'include':[{'model':_0x7413('0xc'),'as':_0x7413('0xd'),'attributes':['id','type',_0x7413('0xe'),_0x7413('0xf')],'include':[{'model':'Variable','as':_0x7413('0x10'),'attributes':['id',_0x7413('0x4')]}]},{'model':'ServicenowField','as':_0x7413('0x11'),'attributes':['id',_0x7413('0x12'),_0x7413('0xe'),_0x7413('0x13'),_0x7413('0x14'),'keyContent',_0x7413('0xf')],'include':[{'model':_0x7413('0x10'),'as':'Variable','attributes':['id',_0x7413('0x4')]}]},{'model':_0x7413('0xc'),'as':_0x7413('0x15'),'attributes':['id','type','content','idField',_0x7413('0x16'),_0x7413('0x17'),'variableName'],'include':[{'model':_0x7413('0x10'),'as':_0x7413('0x10'),'attributes':['id','name']}]}]}]},'log':_0x7413('0x18')});};}; \ No newline at end of file +var _0x2ef3=['Variable','key','keyType','keyContent','Fields','nameField','../../client','getServicenowAccounts','Request','GetServicenowAccount','name','username','password','remoteUri','serverUrl','ServicenowField','Subjects','type','content','variableName'];(function(_0x5390db,_0x53e0b9){var _0x4e8ddd=function(_0x4f7949){while(--_0x4f7949){_0x5390db['push'](_0x5390db['shift']());}};_0x4e8ddd(++_0x53e0b9);}(_0x2ef3,0xba));var _0x32ef=function(_0x4325c9,_0x50640e){_0x4325c9=_0x4325c9-0x0;var _0x18352b=_0x2ef3[_0x4325c9];return _0x18352b;};'use strict';var client=require(_0x32ef('0x0'));exports[_0x32ef('0x1')]=function(){return function(_0x47513a){return client[_0x32ef('0x2')](_0x32ef('0x3'),{'options':{'raw':![],'attributes':['id',_0x32ef('0x4'),'description',_0x32ef('0x5'),_0x32ef('0x6'),'email',_0x32ef('0x7'),_0x32ef('0x8')],'include':[{'model':'ServicenowConfiguration','as':'Configurations','attributes':['id',_0x32ef('0x4')],'include':[{'model':_0x32ef('0x9'),'as':_0x32ef('0xa'),'attributes':['id',_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd')],'include':[{'model':_0x32ef('0xe'),'as':_0x32ef('0xe'),'attributes':['id',_0x32ef('0x4')]}]},{'model':_0x32ef('0x9'),'as':'Descriptions','attributes':['id','type',_0x32ef('0xc'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),'variableName'],'include':[{'model':_0x32ef('0xe'),'as':'Variable','attributes':['id',_0x32ef('0x4')]}]},{'model':'ServicenowField','as':_0x32ef('0x12'),'attributes':['id',_0x32ef('0xb'),'content','idField',_0x32ef('0x13'),'customField',_0x32ef('0xd')],'include':[{'model':_0x32ef('0xe'),'as':_0x32ef('0xe'),'attributes':['id',_0x32ef('0x4')]}]}]}]},'log':'GetServicenowkAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index 4ca0da5..f73ddc3 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1967=['serverUrl','SugarcrmConfiguration','SugarcrmField','Subjects','type','content','variableName','Variable','Descriptions','keyType','keyContent','Fields','idField','customField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','username','password','remoteUri'];(function(_0x250d31,_0x47e58d){var _0x4f3a47=function(_0x15da6f){while(--_0x15da6f){_0x250d31['push'](_0x250d31['shift']());}};_0x4f3a47(++_0x47e58d);}(_0x1967,0x173));var _0x7196=function(_0x3a8eb4,_0x3bfe00){_0x3a8eb4=_0x3a8eb4-0x0;var _0x582b3b=_0x1967[_0x3a8eb4];return _0x582b3b;};'use strict';var client=require('../../client');exports[_0x7196('0x0')]=function(){return function(_0xdb72bb){return client[_0x7196('0x1')](_0x7196('0x2'),{'options':{'raw':![],'attributes':['id',_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7')],'include':[{'model':_0x7196('0x8'),'as':'Configurations','attributes':['id',_0x7196('0x3')],'include':[{'model':_0x7196('0x9'),'as':_0x7196('0xa'),'attributes':['id',_0x7196('0xb'),_0x7196('0xc'),_0x7196('0xd')],'include':[{'model':'Variable','as':_0x7196('0xe'),'attributes':['id',_0x7196('0x3')]}]},{'model':_0x7196('0x9'),'as':_0x7196('0xf'),'attributes':['id',_0x7196('0xb'),'content','key',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0xd')],'include':[{'model':_0x7196('0xe'),'as':_0x7196('0xe'),'attributes':['id',_0x7196('0x3')]}]},{'model':_0x7196('0x9'),'as':_0x7196('0x12'),'attributes':['id',_0x7196('0xb'),_0x7196('0xc'),_0x7196('0x13'),'nameField',_0x7196('0x14'),_0x7196('0xd')],'include':[{'model':_0x7196('0xe'),'as':_0x7196('0xe'),'attributes':['id','name']}]}]}]},'log':_0x7196('0x2')});};}; \ No newline at end of file +var _0xda2d=['Subjects','type','content','variableName','Variable','key','keyType','keyContent','idField','nameField','customField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','serverUrl','SugarcrmConfiguration','Configurations','SugarcrmField'];(function(_0x594ece,_0x2a1f27){var _0x471bc4=function(_0x31941c){while(--_0x31941c){_0x594ece['push'](_0x594ece['shift']());}};_0x471bc4(++_0x2a1f27);}(_0xda2d,0x102));var _0xdda2=function(_0xa2813c,_0x2352c6){_0xa2813c=_0xa2813c-0x0;var _0x15f6ce=_0xda2d[_0xa2813c];return _0x15f6ce;};'use strict';var client=require('../../client');exports[_0xdda2('0x0')]=function(){return function(_0x35f029){return client[_0xdda2('0x1')](_0xdda2('0x2'),{'options':{'raw':![],'attributes':['id',_0xdda2('0x3'),'username','password','remoteUri',_0xdda2('0x4')],'include':[{'model':_0xdda2('0x5'),'as':_0xdda2('0x6'),'attributes':['id',_0xdda2('0x3')],'include':[{'model':_0xdda2('0x7'),'as':_0xdda2('0x8'),'attributes':['id',_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xb')],'include':[{'model':_0xdda2('0xc'),'as':'Variable','attributes':['id',_0xdda2('0x3')]}]},{'model':_0xdda2('0x7'),'as':'Descriptions','attributes':['id',_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xd'),_0xdda2('0xe'),_0xdda2('0xf'),_0xdda2('0xb')],'include':[{'model':_0xdda2('0xc'),'as':_0xdda2('0xc'),'attributes':['id','name']}]},{'model':'SugarcrmField','as':'Fields','attributes':['id',_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0x10'),_0xdda2('0x11'),_0xdda2('0x12'),_0xdda2('0xb')],'include':[{'model':_0xdda2('0xc'),'as':'Variable','attributes':['id',_0xdda2('0x3')]}]}]}]},'log':'GetSugarcrmAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index 4bd39a8..e39c3cb 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0982=['serverUrl','VtigerConfiguration','Configurations','VtigerField','Subjects','type','content','variableName','Variable','Descriptions','keyType','keyContent','Fields','idField','nameField','../../client','getVtigerAccounts','Request','GetVtigerAccount','name','username','accessKey'];(function(_0x49d77b,_0x435c7f){var _0x35d22e=function(_0x2a4e5b){while(--_0x2a4e5b){_0x49d77b['push'](_0x49d77b['shift']());}};_0x35d22e(++_0x435c7f);}(_0x0982,0x117));var _0x2098=function(_0xfd6b4b,_0x5bfd53){_0xfd6b4b=_0xfd6b4b-0x0;var _0x1755d6=_0x0982[_0xfd6b4b];return _0x1755d6;};'use strict';var client=require(_0x2098('0x0'));exports[_0x2098('0x1')]=function(){return function(_0xb3a32b){return client[_0x2098('0x2')](_0x2098('0x3'),{'options':{'raw':![],'attributes':['id',_0x2098('0x4'),'description',_0x2098('0x5'),_0x2098('0x6'),'remoteUri',_0x2098('0x7')],'include':[{'model':_0x2098('0x8'),'as':_0x2098('0x9'),'attributes':['id',_0x2098('0x4')],'include':[{'model':_0x2098('0xa'),'as':_0x2098('0xb'),'attributes':['id',_0x2098('0xc'),_0x2098('0xd'),_0x2098('0xe')],'include':[{'model':_0x2098('0xf'),'as':_0x2098('0xf'),'attributes':['id',_0x2098('0x4')]}]},{'model':_0x2098('0xa'),'as':_0x2098('0x10'),'attributes':['id',_0x2098('0xc'),_0x2098('0xd'),'key',_0x2098('0x11'),_0x2098('0x12'),'variableName'],'include':[{'model':_0x2098('0xf'),'as':_0x2098('0xf'),'attributes':['id',_0x2098('0x4')]}]},{'model':_0x2098('0xa'),'as':_0x2098('0x13'),'attributes':['id',_0x2098('0xc'),_0x2098('0xd'),_0x2098('0x14'),_0x2098('0x15'),'customField',_0x2098('0xe')],'include':[{'model':_0x2098('0xf'),'as':'Variable','attributes':['id',_0x2098('0x4')]}]}]}]},'log':_0x2098('0x3')});};}; \ No newline at end of file +var _0x228c=['type','content','variableName','Variable','VtigerField','key','keyType','keyContent','Fields','customField','../../client','Request','GetVtigerAccount','name','serverUrl','VtigerConfiguration'];(function(_0x536371,_0xad2fec){var _0x2f27b4=function(_0x1a3d68){while(--_0x1a3d68){_0x536371['push'](_0x536371['shift']());}};_0x2f27b4(++_0xad2fec);}(_0x228c,0xba));var _0xc228=function(_0x1269f8,_0xf0b86b){_0x1269f8=_0x1269f8-0x0;var _0x441e03=_0x228c[_0x1269f8];return _0x441e03;};'use strict';var client=require(_0xc228('0x0'));exports['getVtigerAccounts']=function(){return function(_0x3c14e1){return client[_0xc228('0x1')](_0xc228('0x2'),{'options':{'raw':![],'attributes':['id',_0xc228('0x3'),'description','username','accessKey','remoteUri',_0xc228('0x4')],'include':[{'model':_0xc228('0x5'),'as':'Configurations','attributes':['id',_0xc228('0x3')],'include':[{'model':'VtigerField','as':'Subjects','attributes':['id',_0xc228('0x6'),_0xc228('0x7'),_0xc228('0x8')],'include':[{'model':_0xc228('0x9'),'as':_0xc228('0x9'),'attributes':['id',_0xc228('0x3')]}]},{'model':_0xc228('0xa'),'as':'Descriptions','attributes':['id','type',_0xc228('0x7'),_0xc228('0xb'),_0xc228('0xc'),_0xc228('0xd'),_0xc228('0x8')],'include':[{'model':_0xc228('0x9'),'as':_0xc228('0x9'),'attributes':['id',_0xc228('0x3')]}]},{'model':'VtigerField','as':_0xc228('0xe'),'attributes':['id',_0xc228('0x6'),'content','idField','nameField',_0xc228('0xf'),'variableName'],'include':[{'model':_0xc228('0x9'),'as':_0xc228('0x9'),'attributes':['id',_0xc228('0x3')]}]}]}]},'log':_0xc228('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index cbd9de5..b31413f 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb2b=['Subjects','content','variableName','Variable','Descriptions','type','keyType','keyContent','Fields','idField','nameField','customField','getZendeskAccounts','Request','GetZendeskAccount','name','password','token','remoteUri','authType','serverUrl','ZendeskConfiguration','Tag','ZendeskField'];(function(_0x4f42fe,_0x60e531){var _0xc3d232=function(_0x1cf038){while(--_0x1cf038){_0x4f42fe['push'](_0x4f42fe['shift']());}};_0xc3d232(++_0x60e531);}(_0xdb2b,0x6c));var _0xbdb2=function(_0x6a10fa,_0x1712fe){_0x6a10fa=_0x6a10fa-0x0;var _0x3b703a=_0xdb2b[_0x6a10fa];return _0x3b703a;};'use strict';var client=require('../../client');exports[_0xbdb2('0x0')]=function(){return function(_0x646a24){return client[_0xbdb2('0x1')](_0xbdb2('0x2'),{'options':{'raw':![],'attributes':['id',_0xbdb2('0x3'),'username',_0xbdb2('0x4'),_0xbdb2('0x5'),_0xbdb2('0x6'),_0xbdb2('0x7'),_0xbdb2('0x8'),'type'],'include':[{'model':_0xbdb2('0x9'),'as':'Configurations','attributes':['id',_0xbdb2('0x3')],'include':[{'model':_0xbdb2('0xa'),'attributes':['id','name']},{'model':_0xbdb2('0xb'),'as':_0xbdb2('0xc'),'attributes':['id','type',_0xbdb2('0xd'),_0xbdb2('0xe')],'include':[{'model':_0xbdb2('0xf'),'as':_0xbdb2('0xf'),'attributes':['id','name']}]},{'model':_0xbdb2('0xb'),'as':_0xbdb2('0x10'),'attributes':['id',_0xbdb2('0x11'),_0xbdb2('0xd'),'key',_0xbdb2('0x12'),_0xbdb2('0x13'),_0xbdb2('0xe')],'include':[{'model':'Variable','as':_0xbdb2('0xf'),'attributes':['id',_0xbdb2('0x3')]}]},{'model':_0xbdb2('0xb'),'as':_0xbdb2('0x14'),'attributes':['id',_0xbdb2('0x11'),_0xbdb2('0xd'),_0xbdb2('0x15'),_0xbdb2('0x16'),_0xbdb2('0x17'),_0xbdb2('0xe')],'include':[{'model':_0xbdb2('0xf'),'as':'Variable','attributes':['id',_0xbdb2('0x3')]}]}]}]},'log':_0xbdb2('0x2')});};}; \ No newline at end of file +var _0xd6f2=['Variable','Descriptions','key','keyType','keyContent','variableName','Fields','idField','nameField','customField','../../client','getZendeskAccounts','Request','GetZendeskAccount','name','username','token','serverUrl','type','ZendeskConfiguration','Configurations','Tag','ZendeskField','content'];(function(_0x241246,_0x2937ba){var _0x4d7043=function(_0x393fa6){while(--_0x393fa6){_0x241246['push'](_0x241246['shift']());}};_0x4d7043(++_0x2937ba);}(_0xd6f2,0x6a));var _0x2d6f=function(_0x28031b,_0x2dff75){_0x28031b=_0x28031b-0x0;var _0x20913d=_0xd6f2[_0x28031b];return _0x20913d;};'use strict';var client=require(_0x2d6f('0x0'));exports[_0x2d6f('0x1')]=function(){return function(_0x34d86b){return client[_0x2d6f('0x2')](_0x2d6f('0x3'),{'options':{'raw':![],'attributes':['id',_0x2d6f('0x4'),_0x2d6f('0x5'),'password',_0x2d6f('0x6'),'remoteUri','authType',_0x2d6f('0x7'),_0x2d6f('0x8')],'include':[{'model':_0x2d6f('0x9'),'as':_0x2d6f('0xa'),'attributes':['id','name'],'include':[{'model':_0x2d6f('0xb'),'attributes':['id',_0x2d6f('0x4')]},{'model':_0x2d6f('0xc'),'as':'Subjects','attributes':['id','type',_0x2d6f('0xd'),'variableName'],'include':[{'model':_0x2d6f('0xe'),'as':'Variable','attributes':['id',_0x2d6f('0x4')]}]},{'model':_0x2d6f('0xc'),'as':_0x2d6f('0xf'),'attributes':['id',_0x2d6f('0x8'),_0x2d6f('0xd'),_0x2d6f('0x10'),_0x2d6f('0x11'),_0x2d6f('0x12'),_0x2d6f('0x13')],'include':[{'model':_0x2d6f('0xe'),'as':_0x2d6f('0xe'),'attributes':['id',_0x2d6f('0x4')]}]},{'model':_0x2d6f('0xc'),'as':_0x2d6f('0x14'),'attributes':['id',_0x2d6f('0x8'),_0x2d6f('0xd'),_0x2d6f('0x15'),_0x2d6f('0x16'),_0x2d6f('0x17'),'variableName'],'include':[{'model':_0x2d6f('0xe'),'as':_0x2d6f('0xe'),'attributes':['id',_0x2d6f('0x4')]}]}]}]},'log':'GetZendeskAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index 8bcf900..9886903 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb87=['moduleCreate','moduleSearch','ZohoField','content','variableName','Variable','type','key','keyContent','Fields','../../client','GetZohoAccount','name','description','zone','clientId','clientSecret','serverUrl','refreshToken','ZohoConfiguration'];(function(_0x428029,_0x1a5eb3){var _0x52033a=function(_0x5d73a8){while(--_0x5d73a8){_0x428029['push'](_0x428029['shift']());}};_0x52033a(++_0x1a5eb3);}(_0xcb87,0xd2));var _0x7cb8=function(_0x4551f6,_0x48151b){_0x4551f6=_0x4551f6-0x0;var _0x581dc2=_0xcb87[_0x4551f6];return _0x581dc2;};'use strict';var client=require(_0x7cb8('0x0'));exports['getZohoAccounts']=function(){return function(_0x3c488f){return client['Request'](_0x7cb8('0x1'),{'options':{'raw':![],'attributes':['id',_0x7cb8('0x2'),_0x7cb8('0x3'),'host',_0x7cb8('0x4'),_0x7cb8('0x5'),_0x7cb8('0x6'),_0x7cb8('0x7'),'code',_0x7cb8('0x8')],'include':[{'model':_0x7cb8('0x9'),'as':'Configurations','attributes':['id',_0x7cb8('0x2'),_0x7cb8('0xa'),_0x7cb8('0xb'),_0x7cb8('0x3')],'include':[{'model':_0x7cb8('0xc'),'as':'Subjects','attributes':['id','type',_0x7cb8('0xd'),_0x7cb8('0xe')],'include':[{'model':'Variable','as':_0x7cb8('0xf'),'attributes':['id',_0x7cb8('0x2')]}]},{'model':_0x7cb8('0xc'),'as':'Descriptions','attributes':['id',_0x7cb8('0x10'),_0x7cb8('0xd'),_0x7cb8('0x11'),'keyType',_0x7cb8('0x12'),_0x7cb8('0xe')],'include':[{'model':_0x7cb8('0xf'),'as':_0x7cb8('0xf'),'attributes':['id','name']}]},{'model':_0x7cb8('0xc'),'as':_0x7cb8('0x13'),'attributes':['id',_0x7cb8('0x10'),'content','idField','nameField','customField',_0x7cb8('0xe')],'include':[{'model':_0x7cb8('0xf'),'as':_0x7cb8('0xf'),'attributes':['id','name']}]}]}]},'log':_0x7cb8('0x1')});};}; \ No newline at end of file +var _0x2c56=['nameField','customField','../../client','getZohoAccounts','Request','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','ZohoConfiguration','Configurations','name','moduleCreate','moduleSearch','ZohoField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','Fields','idField'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x2c56,0x124));var _0x62c5=function(_0x4d8536,_0x2acb73){_0x4d8536=_0x4d8536-0x0;var _0x496b14=_0x2c56[_0x4d8536];return _0x496b14;};'use strict';var client=require(_0x62c5('0x0'));exports[_0x62c5('0x1')]=function(){return function(_0xdbab23){return client[_0x62c5('0x2')]('GetZohoAccount',{'options':{'raw':![],'attributes':['id','name',_0x62c5('0x3'),_0x62c5('0x4'),_0x62c5('0x5'),_0x62c5('0x6'),_0x62c5('0x7'),_0x62c5('0x8'),_0x62c5('0x9'),_0x62c5('0xa')],'include':[{'model':_0x62c5('0xb'),'as':_0x62c5('0xc'),'attributes':['id',_0x62c5('0xd'),_0x62c5('0xe'),_0x62c5('0xf'),_0x62c5('0x3')],'include':[{'model':_0x62c5('0x10'),'as':_0x62c5('0x11'),'attributes':['id',_0x62c5('0x12'),_0x62c5('0x13'),_0x62c5('0x14')],'include':[{'model':_0x62c5('0x15'),'as':_0x62c5('0x15'),'attributes':['id','name']}]},{'model':_0x62c5('0x10'),'as':_0x62c5('0x16'),'attributes':['id',_0x62c5('0x12'),_0x62c5('0x13'),_0x62c5('0x17'),_0x62c5('0x18'),'keyContent',_0x62c5('0x14')],'include':[{'model':_0x62c5('0x15'),'as':_0x62c5('0x15'),'attributes':['id',_0x62c5('0xd')]}]},{'model':_0x62c5('0x10'),'as':_0x62c5('0x19'),'attributes':['id',_0x62c5('0x12'),'content',_0x62c5('0x1a'),_0x62c5('0x1b'),_0x62c5('0x1c'),'variableName'],'include':[{'model':'Variable','as':_0x62c5('0x15'),'attributes':['id',_0x62c5('0xd')]}]}]}]},'log':'GetZohoAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index 455cef6..2283bc7 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b21=['resolve','every','number','string','map','concat','Request','IntervalIftime','intervalIftime','../../../config/logger','dialer','../client','stack','replace','silly','length'];(function(_0x4692b7,_0x8853ad){var _0x76803d=function(_0x4f825d){while(--_0x4f825d){_0x4692b7['push'](_0x4692b7['shift']());}};_0x76803d(++_0x8853ad);}(_0x6b21,0x89));var _0x16b2=function(_0x578908,_0x4309e2){_0x578908=_0x578908-0x0;var _0x49ef17=_0x6b21[_0x578908];return _0x49ef17;};var logger=require(_0x16b2('0x0'))(_0x16b2('0x1'));var client=require(_0x16b2('0x2'));function intervalIftime(_0x3a6dca,_0xbb7b8){const _0x24712d=new Error()[_0x16b2('0x3')][_0x16b2('0x4')](/^Error/,'')['trim']();logger[_0x16b2('0x5')]('intervalIftime\x20called\x20with',_0x3a6dca,_0xbb7b8,_0x24712d);const _0x4e30ba=Array['isArray'](_0x3a6dca);if(!_0x3a6dca||_0x4e30ba&&_0x3a6dca[_0x16b2('0x6')]===0x0){return Promise[_0x16b2('0x7')](![]);}else{var _0x576b3e=[];var _0x56429c=[];var _0x2e1ba8=_0x4e30ba?_0x3a6dca:[_0x3a6dca];var _0xc95283=_0x2e1ba8[_0x16b2('0x8')](function(_0x51915c){return typeof _0x51915c===_0x16b2('0x9');});var _0x3ad2a3=_0x2e1ba8[_0x16b2('0x8')](function(_0x4cd5a1){return typeof _0x4cd5a1===_0x16b2('0xa');});if(!_0xc95283&&!_0x3ad2a3){_0x576b3e=_0x2e1ba8[_0x16b2('0xb')](function(_0x1bcef){return _0x1bcef['id'];});if(_0x576b3e[_0x16b2('0x6')]===0x0){_0x56429c=_0x2e1ba8[_0x16b2('0xb')](function(_0x3c5126){return _0x3c5126['interval'];});}}else{if(_0xc95283){_0x576b3e=_0x576b3e[_0x16b2('0xc')](_0x2e1ba8);}if(_0x3ad2a3){_0x56429c=_0x56429c['concat'](_0x2e1ba8);}}return client[_0x16b2('0xd')](_0x16b2('0xe'),{'intervalIds':_0x576b3e,'intervals':_0x56429c,'timezone':_0xbb7b8,'log':'IntervalIftime'});}}exports[_0x16b2('0xf')]=intervalIftime; \ No newline at end of file +var _0xa814=['concat','Request','IntervalIftime','intervalIftime','../../../config/logger','dialer','../client','replace','trim','silly','intervalIftime\x20called\x20with','every','number','string','length','map','interval'];(function(_0x495b26,_0x3a0338){var _0x1e6a0e=function(_0x3bd0d8){while(--_0x3bd0d8){_0x495b26['push'](_0x495b26['shift']());}};_0x1e6a0e(++_0x3a0338);}(_0xa814,0x9d));var _0x4a81=function(_0x36f5d0,_0x21f87f){_0x36f5d0=_0x36f5d0-0x0;var _0x2656c3=_0xa814[_0x36f5d0];return _0x2656c3;};var logger=require(_0x4a81('0x0'))(_0x4a81('0x1'));var client=require(_0x4a81('0x2'));function intervalIftime(_0x2e4b3a,_0x19eb87){const _0x4b4203=new Error()['stack'][_0x4a81('0x3')](/^Error/,'')[_0x4a81('0x4')]();logger[_0x4a81('0x5')](_0x4a81('0x6'),_0x2e4b3a,_0x19eb87,_0x4b4203);const _0x3bb213=Array['isArray'](_0x2e4b3a);if(!_0x2e4b3a||_0x3bb213&&_0x2e4b3a['length']===0x0){return Promise['resolve'](![]);}else{var _0x4104e0=[];var _0x27a579=[];var _0x4ffc46=_0x3bb213?_0x2e4b3a:[_0x2e4b3a];var _0x16b8dc=_0x4ffc46[_0x4a81('0x7')](function(_0x157429){return typeof _0x157429===_0x4a81('0x8');});var _0x444525=_0x4ffc46['every'](function(_0x5ce2e7){return typeof _0x5ce2e7===_0x4a81('0x9');});if(!_0x16b8dc&&!_0x444525){_0x4104e0=_0x4ffc46['map'](function(_0x2ac0a4){return _0x2ac0a4['id'];});if(_0x4104e0[_0x4a81('0xa')]===0x0){_0x27a579=_0x4ffc46[_0x4a81('0xb')](function(_0x216ed2){return _0x216ed2[_0x4a81('0xc')];});}}else{if(_0x16b8dc){_0x4104e0=_0x4104e0['concat'](_0x4ffc46);}if(_0x444525){_0x27a579=_0x27a579[_0x4a81('0xd')](_0x4ffc46);}}return client[_0x4a81('0xe')](_0x4a81('0xf'),{'intervalIds':_0x4104e0,'intervals':_0x27a579,'timezone':_0x19eb87,'log':_0x4a81('0xf')});}}exports[_0x4a81('0x10')]=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index 026f6a7..324a326 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafc4=['queuecallerexitAt','CreateMemberReport','voice','isNil','interface','format','SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','agent','toNumber','accountcode','uniqueid','Request','membername','starttime','endtime','outbound','dialstring','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt'];(function(_0x4fd9c0,_0x113c00){var _0x3388be=function(_0x4faca9){while(--_0x4faca9){_0x4fd9c0['push'](_0x4fd9c0['shift']());}};_0x3388be(++_0x113c00);}(_0xafc4,0x1da));var _0x4afc=function(_0x32cb60,_0x359e52){_0x32cb60=_0x32cb60-0x0;var _0x1cc8d5=_0xafc4[_0x32cb60];return _0x1cc8d5;};'use strict';var moment=require(_0x4afc('0x0'));var _=require(_0x4afc('0x1'));var util=require(_0x4afc('0x2'));var client=require(_0x4afc('0x3'));exports[_0x4afc('0x4')]=function(_0x3a5447){var _0x16826f=_0x3a5447[_0x4afc('0x5')]||_0x3a5447[_0x4afc('0x6')];return client['Request'](_0x4afc('0x7'),{'body':{'channel':_0x4afc('0x8'),'membername':_0x3a5447['lastAssignedTo'],'interface':_[_0x4afc('0x9')](_0x3a5447[_0x4afc('0xa')])?util[_0x4afc('0xb')](_0x4afc('0xc'),_0x3a5447[_0x4afc('0xd')]):_0x3a5447[_0x4afc('0xa')],'type':_0x4afc('0xe'),'enterAt':_0x3a5447[_0x4afc('0xf')],'exitAt':_0x16826f,'duration':moment(_0x16826f)[_0x4afc('0x10')](_0x3a5447[_0x4afc('0xf')],_0x4afc('0x11')),'data1':_0x4afc('0x12'),'data2':_0x3a5447[_0x4afc('0x13')],'data3':_0x3a5447['exten'],'data4':null,'data5':_0x3a5447['queue'],'role':_0x4afc('0x14'),'internal':_0x3a5447['accountcode']?_[_0x4afc('0x15')](_0x3a5447[_0x4afc('0x16')]):undefined,'uniqueid':_0x3a5447[_0x4afc('0x17')]},'log':_0x4afc('0x7')});};exports['voiceDialReport']=function(_0x27143e){return client[_0x4afc('0x18')](_0x4afc('0x7'),{'body':{'channel':_0x4afc('0x8'),'membername':_0x27143e[_0x4afc('0x19')],'interface':_0x27143e[_0x4afc('0xa')],'type':_0x4afc('0xe'),'enterAt':_0x27143e[_0x4afc('0x1a')],'exitAt':_0x27143e[_0x4afc('0x1b')],'duration':moment(_0x27143e[_0x4afc('0x1b')])[_0x4afc('0x10')](_0x27143e[_0x4afc('0x1a')],_0x4afc('0x11'))>=0x0?moment(_0x27143e['endtime'])['diff'](_0x27143e['starttime'],_0x4afc('0x11')):null,'data1':_0x4afc('0x1c'),'data2':_0x27143e[_0x4afc('0x16')],'data3':_0x27143e['exten'],'data4':_0x27143e[_0x4afc('0x1d')]||null,'role':_0x4afc('0x14'),'internal':_0x27143e[_0x4afc('0x16')]?_[_0x4afc('0x15')](_0x27143e['accountcode']):undefined,'uniqueid':_0x27143e[_0x4afc('0x17')]},'log':_0x4afc('0x7')});}; \ No newline at end of file +var _0x23ae=['queuecallerexitAt','CreateMemberReport','lastAssignedTo','isNil','format','SIP/%s','interface','TALKING','queuecallerleaveAt','diff','seconds','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','Request','voice','membername','endtime','starttime','outbound','dialstring','moment','../client','voiceQueueReport','queuecallercompleteAt'];(function(_0x3c34e8,_0xf4972a){var _0x336297=function(_0x44c400){while(--_0x44c400){_0x3c34e8['push'](_0x3c34e8['shift']());}};_0x336297(++_0xf4972a);}(_0x23ae,0xe4));var _0xe23a=function(_0x305b12,_0x5ecd09){_0x305b12=_0x305b12-0x0;var _0x4141de=_0x23ae[_0x305b12];return _0x4141de;};'use strict';var moment=require(_0xe23a('0x0'));var _=require('lodash');var util=require('util');var client=require(_0xe23a('0x1'));exports[_0xe23a('0x2')]=function(_0x4f9107){var _0x361e97=_0x4f9107[_0xe23a('0x3')]||_0x4f9107[_0xe23a('0x4')];return client['Request'](_0xe23a('0x5'),{'body':{'channel':'voice','membername':_0x4f9107[_0xe23a('0x6')],'interface':_[_0xe23a('0x7')](_0x4f9107['interface'])?util[_0xe23a('0x8')](_0xe23a('0x9'),_0x4f9107[_0xe23a('0x6')]):_0x4f9107[_0xe23a('0xa')],'type':_0xe23a('0xb'),'enterAt':_0x4f9107[_0xe23a('0xc')],'exitAt':_0x361e97,'duration':moment(_0x361e97)[_0xe23a('0xd')](_0x4f9107[_0xe23a('0xc')],_0xe23a('0xe')),'data1':'inbound','data2':_0x4f9107[_0xe23a('0xf')],'data3':_0x4f9107[_0xe23a('0x10')],'data4':null,'data5':_0x4f9107[_0xe23a('0x11')],'role':_0xe23a('0x12'),'internal':_0x4f9107[_0xe23a('0x13')]?_[_0xe23a('0x14')](_0x4f9107['accountcode']):undefined,'uniqueid':_0x4f9107[_0xe23a('0x15')]},'log':_0xe23a('0x5')});};exports['voiceDialReport']=function(_0x201674){return client[_0xe23a('0x16')](_0xe23a('0x5'),{'body':{'channel':_0xe23a('0x17'),'membername':_0x201674[_0xe23a('0x18')],'interface':_0x201674[_0xe23a('0xa')],'type':'TALKING','enterAt':_0x201674['starttime'],'exitAt':_0x201674[_0xe23a('0x19')],'duration':moment(_0x201674['endtime'])[_0xe23a('0xd')](_0x201674['starttime'],_0xe23a('0xe'))>=0x0?moment(_0x201674[_0xe23a('0x19')])[_0xe23a('0xd')](_0x201674[_0xe23a('0x1a')],_0xe23a('0xe')):null,'data1':_0xe23a('0x1b'),'data2':_0x201674[_0xe23a('0x13')],'data3':_0x201674[_0xe23a('0x10')],'data4':_0x201674[_0xe23a('0x1c')]||null,'role':_0xe23a('0x12'),'internal':_0x201674['accountcode']?_[_0xe23a('0x14')](_0x201674[_0xe23a('0x13')]):undefined,'uniqueid':_0x201674[_0xe23a('0x15')]},'log':_0xe23a('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index e637f4a..8b09525 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 _0x3c1a=['GetSettings','../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0xd93b26,_0x12bbf2){var _0x25f668=function(_0x133ff7){while(--_0x133ff7){_0xd93b26['push'](_0xd93b26['shift']());}};_0x25f668(++_0x12bbf2);}(_0x3c1a,0xda));var _0xa3c1=function(_0x459423,_0x3416a8){_0x459423=_0x459423-0x0;var _0x42ed14=_0x3c1a[_0x459423];return _0x42ed14;};'use strict';var client=require(_0xa3c1('0x0'));exports[_0xa3c1('0x1')]=function(){return client[_0xa3c1('0x2')](_0xa3c1('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xa3c1('0x4'),_0xa3c1('0x5')]},'log':_0xa3c1('0x6')});}; \ No newline at end of file +var _0x4628=['GetSettings','../client','getSettings','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x4628,0xd3));var _0x8462=function(_0x9b9234,_0x3b8f3b){_0x9b9234=_0x9b9234-0x0;var _0x89e7c2=_0x4628[_0x9b9234];return _0x89e7c2;};'use strict';var client=require(_0x8462('0x0'));exports[_0x8462('0x1')]=function(){return client['Request'](_0x8462('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x8462('0x3'),_0x8462('0x4')]},'log':_0x8462('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index e2b141a..db2d87c 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 _0x7f0a=['../client','Request','name','html','GetTemplate'];(function(_0x3f4bb3,_0x54f0de){var _0x1cb73a=function(_0x5bac64){while(--_0x5bac64){_0x3f4bb3['push'](_0x3f4bb3['shift']());}};_0x1cb73a(++_0x54f0de);}(_0x7f0a,0x82));var _0xa7f0=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x7f0a[_0x13e741];return _0x3f8bb3;};'use strict';var client=require(_0xa7f0('0x0'));exports['getTemplates']=function(_0x45ca0f){return function(_0x39e912){return client[_0xa7f0('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xa7f0('0x2'),_0xa7f0('0x3')]},'log':_0xa7f0('0x4')});};}; \ No newline at end of file +var _0xf44e=['html','../client','GetTemplate','name'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf44e,0x1d5));var _0xef44=function(_0xcb76eb,_0x165b2d){_0xcb76eb=_0xcb76eb-0x0;var _0x414ae8=_0xf44e[_0xcb76eb];return _0x414ae8;};'use strict';var client=require(_0xef44('0x0'));exports['getTemplates']=function(_0x1201e3){return function(_0x7f026a){return client['Request'](_0xef44('0x1'),{'options':{'raw':!![],'attributes':['id',_0xef44('0x2'),_0xef44('0x3')]},'log':_0xef44('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 09f2d40..29293e5 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 _0x40a1=['Request','GetTrigger','name','channel','status','Condition','AllConditions','field','AnyConditions','action','data3','data4','data6','../client','getTriggers'];(function(_0x2cf49c,_0x3c27fd){var _0x4f755c=function(_0x32bc99){while(--_0x32bc99){_0x2cf49c['push'](_0x2cf49c['shift']());}};_0x4f755c(++_0x3c27fd);}(_0x40a1,0x76));var _0x140a=function(_0x302714,_0x455277){_0x302714=_0x302714-0x0;var _0x4fd715=_0x40a1[_0x302714];return _0x4fd715;};'use strict';var client=require(_0x140a('0x0'));exports[_0x140a('0x1')]=function(_0x22da80){return function(_0x9c50b9){return client[_0x140a('0x2')](_0x140a('0x3'),{'options':{'raw':![],'attributes':['id',_0x140a('0x4'),_0x140a('0x5'),_0x140a('0x6')],'include':[{'model':_0x140a('0x7'),'as':_0x140a('0x8'),'attributes':['id',_0x140a('0x9'),'operator','value']},{'model':'Condition','as':_0x140a('0xa'),'attributes':['id','field','operator','value']},{'model':'Action','as':'Actions','attributes':['id',_0x140a('0xb'),'data1','data2',_0x140a('0xc'),_0x140a('0xd'),'data5',_0x140a('0xe'),'data7']}]},'log':_0x140a('0x3')});};}; \ No newline at end of file +var _0x0699=['channel','status','Condition','AllConditions','field','operator','value','AnyConditions','action','data2','data3','data4','data5','data6','../client','Request','GetTrigger','name'];(function(_0x5960f6,_0x3a8ce3){var _0x2019d6=function(_0x3d9cb2){while(--_0x3d9cb2){_0x5960f6['push'](_0x5960f6['shift']());}};_0x2019d6(++_0x3a8ce3);}(_0x0699,0x11c));var _0x9069=function(_0x14ce9f,_0x1dd05b){_0x14ce9f=_0x14ce9f-0x0;var _0x5237d8=_0x0699[_0x14ce9f];return _0x5237d8;};'use strict';var client=require(_0x9069('0x0'));exports['getTriggers']=function(_0x4924f9){return function(_0x122620){return client[_0x9069('0x1')](_0x9069('0x2'),{'options':{'raw':![],'attributes':['id',_0x9069('0x3'),_0x9069('0x4'),_0x9069('0x5')],'include':[{'model':_0x9069('0x6'),'as':_0x9069('0x7'),'attributes':['id',_0x9069('0x8'),_0x9069('0x9'),_0x9069('0xa')]},{'model':_0x9069('0x6'),'as':_0x9069('0xb'),'attributes':['id',_0x9069('0x8'),_0x9069('0x9'),_0x9069('0xa')]},{'model':'Action','as':'Actions','attributes':['id',_0x9069('0xc'),'data1',_0x9069('0xd'),_0x9069('0xe'),_0x9069('0xf'),_0x9069('0x10'),_0x9069('0x11'),'data7']}]},'log':_0x9069('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index d97247b..b6d7108 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 _0xf1b6=['Request','GetTrunk','name','registry','getTrunks'];(function(_0x3b7047,_0x167a8f){var _0x4af3eb=function(_0x5084a7){while(--_0x5084a7){_0x3b7047['push'](_0x3b7047['shift']());}};_0x4af3eb(++_0x167a8f);}(_0xf1b6,0xd1));var _0x6f1b=function(_0x3779b7,_0x517b77){_0x3779b7=_0x3779b7-0x0;var _0x535aa0=_0xf1b6[_0x3779b7];return _0x535aa0;};'use strict';var client=require('../client');exports[_0x6f1b('0x0')]=function(_0x482b94){return function(_0x5755fc){return client[_0x6f1b('0x1')](_0x6f1b('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x6f1b('0x3'),_0x6f1b('0x4'),'defaultuser']},'log':_0x6f1b('0x2')});};}; \ No newline at end of file +var _0xcfe5=['defaultuser','GetTrunk','../client','getTrunks','name'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xcfe5,0x1c9));var _0x5cfe=function(_0x12c0ea,_0x2ed696){_0x12c0ea=_0x12c0ea-0x0;var _0x276352=_0xcfe5[_0x12c0ea];return _0x276352;};'use strict';var client=require(_0x5cfe('0x0'));exports[_0x5cfe('0x1')]=function(_0x496735){return function(_0x5bae5d){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x5cfe('0x2'),'registry',_0x5cfe('0x3')]},'log':_0x5cfe('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 02ee9ab..ff2d3a2 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 _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x2b5e5f,_0x54c652){var _0x5c48d6=function(_0x57c3f7){while(--_0x57c3f7){_0x2b5e5f['push'](_0x2b5e5f['shift']());}};_0x5c48d6(++_0x54c652);}(_0x70e0,0x17b));var _0x070e=function(_0x172346,_0x3f48fa){_0x172346=_0x172346-0x0;var _0x114b79=_0x70e0[_0x172346];return _0x114b79;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file +var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x15b15f,_0x57a469){var _0x3b4a17=function(_0x3a1791){while(--_0x3a1791){_0x15b15f['push'](_0x15b15f['shift']());}};_0x3b4a17(++_0x57a469);}(_0xedd9,0xfc));var _0x9edd=function(_0x196f45,_0x359fa4){_0x196f45=_0x196f45-0x0;var _0x54eb34=_0xedd9[_0x196f45];return _0x54eb34;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 6ef6227..cd49ded 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 _0xf712=['CreateVoiceAgentReport','Request','UpdateVoiceAgentReport'];(function(_0x58d193,_0x354858){var _0x45033f=function(_0x1f4fc5){while(--_0x1f4fc5){_0x58d193['push'](_0x58d193['shift']());}};_0x45033f(++_0x354858);}(_0xf712,0x195));var _0x2f71=function(_0x4b7878,_0x413c6d){_0x4b7878=_0x4b7878-0x0;var _0x5c03de=_0xf712[_0x4b7878];return _0x5c03de;};'use strict';var client=require('../client');exports['create']=function(_0x396030){return client['Request']('CreateVoiceAgentReport',{'body':_0x396030,'log':_0x2f71('0x0')});};exports['update']=function(_0x38bfa5,_0x1fc97b,_0x13d3ce){return client[_0x2f71('0x1')](_0x2f71('0x2'),{'body':_0x38bfa5,'options':{'where':{'uniqueid':_0x1fc97b,'interface':_0x13d3ce,'agentcomplete':!![]}},'log':_0x2f71('0x2')});}; \ No newline at end of file +var _0x9df3=['Request','UpdateVoiceAgentReport','../client','CreateVoiceAgentReport','update'];(function(_0x10d52b,_0xc6a4f1){var _0x2bf44a=function(_0x286009){while(--_0x286009){_0x10d52b['push'](_0x10d52b['shift']());}};_0x2bf44a(++_0xc6a4f1);}(_0x9df3,0x1ab));var _0x39df=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9df3[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x39df('0x0'));exports['create']=function(_0x347531){return client['Request'](_0x39df('0x1'),{'body':_0x347531,'log':_0x39df('0x1')});};exports[_0x39df('0x2')]=function(_0x1aa933,_0x1965e3,_0x499273){return client[_0x39df('0x3')](_0x39df('0x4'),{'body':_0x1aa933,'options':{'where':{'uniqueid':_0x1965e3,'interface':_0x499273,'agentcomplete':!![]}},'log':_0x39df('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index b937ae1..f26ce67 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 _0x1d43=['getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','util','lodash','../client','create','Request','merge','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport'];(function(_0x5da8a7,_0xcf2661){var _0x194a7b=function(_0x271a56){while(--_0x271a56){_0x5da8a7['push'](_0x5da8a7['shift']());}};_0x194a7b(++_0xcf2661);}(_0x1d43,0x18d));var _0x31d4=function(_0x59c734,_0x3ad701){_0x59c734=_0x59c734-0x0;var _0x36f9de=_0x1d43[_0x59c734];return _0x36f9de;};'use strict';var moment=require('moment');var util=require(_0x31d4('0x0'));var _=require(_0x31d4('0x1'));var client=require(_0x31d4('0x2'));exports[_0x31d4('0x3')]=function(_0x3750e0){return client[_0x31d4('0x4')]('CreateVoiceCallReport',{'body':_[_0x31d4('0x5')](_0x3750e0,{'source':_0x3750e0[_0x31d4('0x6')],'destinationcontext':_0x3750e0[_0x31d4('0x7')],'callerid':_0x3750e0[_0x31d4('0x8')],'amaflags':_0x31d4('0x9')}),'log':_0x31d4('0xa')});};exports[_0x31d4('0xb')]=function(){return function(){return client[_0x31d4('0x4')](_0x31d4('0xc'),{'options':{'where':{'type':[_0x31d4('0xd')],'createdAt':{'$between':[moment()[_0x31d4('0xe')](_0x31d4('0xf'))[_0x31d4('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x31d4('0x11')](_0x31d4('0xf'))[_0x31d4('0x10')](_0x31d4('0x12'))]}},'attributes':[_0x31d4('0x13'),_0x31d4('0x14'),_0x31d4('0x15'),_0x31d4('0x16')]},'log':_0x31d4('0x17')});};}; \ No newline at end of file +var _0x8c78=['YYYY-MM-DD\x20HH:mm:ss','type','billableseconds','GetVoiceCallReports','moment','lodash','../client','create','Request','CreateVoiceCallReport','calleridnum','context','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','endOf'];(function(_0x4d78cc,_0x14c808){var _0x46dd44=function(_0x5b3f6e){while(--_0x5b3f6e){_0x4d78cc['push'](_0x4d78cc['shift']());}};_0x46dd44(++_0x14c808);}(_0x8c78,0x90));var _0x88c7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x8c78[_0x432682];return _0x463d05;};'use strict';var moment=require(_0x88c7('0x0'));var util=require('util');var _=require(_0x88c7('0x1'));var client=require(_0x88c7('0x2'));exports[_0x88c7('0x3')]=function(_0x1d52b7){return client[_0x88c7('0x4')](_0x88c7('0x5'),{'body':_['merge'](_0x1d52b7,{'source':_0x1d52b7[_0x88c7('0x6')],'destinationcontext':_0x1d52b7[_0x88c7('0x7')],'callerid':_0x1d52b7[_0x88c7('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0x88c7('0x5')});};exports[_0x88c7('0x9')]=function(){return function(){return client['Request'](_0x88c7('0xa'),{'options':{'where':{'type':[_0x88c7('0xb')],'createdAt':{'$between':[moment()[_0x88c7('0xc')](_0x88c7('0xd'))[_0x88c7('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x88c7('0xf')]('day')['format'](_0x88c7('0x10'))]}},'attributes':[_0x88c7('0x11'),'disposition','duration',_0x88c7('0x12')]},'log':_0x88c7('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 17920c5..2a2774b 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 _0x4507=['CreateVoiceDialReport','Request'];(function(_0x9f6c76,_0x32c8ca){var _0x8ebf7c=function(_0x3f1c8b){while(--_0x3f1c8b){_0x9f6c76['push'](_0x9f6c76['shift']());}};_0x8ebf7c(++_0x32c8ca);}(_0x4507,0x1b5));var _0x7450=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x4507[_0x199572];return _0x13cfa3;};'use strict';var client=require('../client');exports['create']=function(_0x115427){return client[_0x7450('0x0')](_0x7450('0x1'),{'body':_0x115427,'log':_0x7450('0x1')});}; \ No newline at end of file +var _0x7040=['CreateVoiceDialReport','create','Request'];(function(_0xdd2c1,_0x4afb4c){var _0x257c70=function(_0xb93bee){while(--_0xb93bee){_0xdd2c1['push'](_0xdd2c1['shift']());}};_0x257c70(++_0x4afb4c);}(_0x7040,0xfa));var _0x0704=function(_0x5a649c,_0x687bd2){_0x5a649c=_0x5a649c-0x0;var _0x2e6830=_0x7040[_0x5a649c];return _0x2e6830;};'use strict';var client=require('../client');exports[_0x0704('0x0')]=function(_0x18b051){return client[_0x0704('0x1')]('CreateVoiceDialReport',{'body':_0x18b051,'log':_0x0704('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 2899c99..aea2ac1 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 _0x574d=['../client','getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0x41fb98,_0x470189){var _0x4b0044=function(_0xf8b2ec){while(--_0xf8b2ec){_0x41fb98['push'](_0x41fb98['shift']());}};_0x4b0044(++_0x470189);}(_0x574d,0xc0));var _0xd574=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x574d[_0x1694f5];return _0x5b4321;};'use strict';var client=require(_0xd574('0x0'));exports[_0xd574('0x1')]=function(){return function(){return client[_0xd574('0x2')](_0xd574('0x3'),{'options':{'raw':!![],'attributes':['id',_0xd574('0x4'),_0xd574('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xd574('0x1')});};}; \ No newline at end of file +var _0x2dae=['exten','recordingFormat','getVoiceExtensions','../client','Request','GetVoiceExtension'];(function(_0x427205,_0x1839db){var _0x8da4f4=function(_0x343b11){while(--_0x343b11){_0x427205['push'](_0x427205['shift']());}};_0x8da4f4(++_0x1839db);}(_0x2dae,0xc3));var _0xe2da=function(_0xf44d98,_0x12a472){_0xf44d98=_0xf44d98-0x0;var _0x5ebb04=_0x2dae[_0xf44d98];return _0x5ebb04;};'use strict';var client=require(_0xe2da('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xe2da('0x1')](_0xe2da('0x2'),{'options':{'raw':!![],'attributes':['id',_0xe2da('0x3'),_0xe2da('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xe2da('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 8072ec0..b94ca4d 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 _0xaa19=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','name','active','Pause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x5a3069,_0xfca453){var _0x332ef0=function(_0x3a012c){while(--_0x3a012c){_0x5a3069['push'](_0x5a3069['shift']());}};_0x332ef0(++_0xfca453);}(_0xaa19,0x17c));var _0x9aa1=function(_0x3feb74,_0x5904bb){_0x3feb74=_0x3feb74-0x0;var _0x5c4174=_0xaa19[_0x3feb74];return _0x5c4174;};'use strict';var client=require(_0x9aa1('0x0'));exports[_0x9aa1('0x1')]=function(){return function(){return client[_0x9aa1('0x2')](_0x9aa1('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x9aa1('0x4'),'acwTimeout',_0x9aa1('0x5'),_0x9aa1('0x6'),_0x9aa1('0x7'),_0x9aa1('0x8'),_0x9aa1('0x9'),_0x9aa1('0xa'),'dialLimitQueue',_0x9aa1('0xb'),_0x9aa1('0xc'),'dialPredictiveOptimizationPercentage',_0x9aa1('0xd'),_0x9aa1('0xe'),_0x9aa1('0xf'),_0x9aa1('0x10'),'dialQueueOptions',_0x9aa1('0x11'),_0x9aa1('0x12'),_0x9aa1('0x13'),_0x9aa1('0x14'),_0x9aa1('0x15'),'dialBusyRetryFrequency',_0x9aa1('0x16'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry',_0x9aa1('0x17'),_0x9aa1('0x18'),'dialPrefix',_0x9aa1('0x19'),_0x9aa1('0x1a'),_0x9aa1('0x1b'),_0x9aa1('0x1c'),_0x9aa1('0x1d'),'dialAMDTotalAnalysisTime','dialAMDMinWordLength',_0x9aa1('0x1e'),_0x9aa1('0x1f'),_0x9aa1('0x20'),_0x9aa1('0x21'),_0x9aa1('0x22'),_0x9aa1('0x23'),'dialRecallInQueue','dialOrderByScheduledAt',_0x9aa1('0x24'),_0x9aa1('0x25'),_0x9aa1('0x26'),'monitor_format',_0x9aa1('0x27'),_0x9aa1('0x28'),_0x9aa1('0x29'),_0x9aa1('0x2a'),_0x9aa1('0x2b'),'dialDropMaxRetry',_0x9aa1('0x2c'),_0x9aa1('0x2d'),_0x9aa1('0x2e'),_0x9aa1('0x2f'),_0x9aa1('0x30'),'dialAgentRejectMaxRetry',_0x9aa1('0x31'),_0x9aa1('0x32'),_0x9aa1('0x33'),_0x9aa1('0x34'),'dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'],'include':[{'model':_0x9aa1('0x35'),'as':_0x9aa1('0x35'),'attributes':['id',_0x9aa1('0x36'),'callerid',_0x9aa1('0x37')]},{'model':_0x9aa1('0x38'),'as':'mandatoryDispositionPause','attributes':['id',_0x9aa1('0x36')]},{'model':_0x9aa1('0x35'),'as':_0x9aa1('0x39'),'attributes':['id',_0x9aa1('0x36'),'callerid',_0x9aa1('0x37')]},{'model':_0x9aa1('0x3a'),'as':_0x9aa1('0x3a'),'attributes':['id',_0x9aa1('0x36')],'include':[{'model':_0x9aa1('0x3a'),'as':_0x9aa1('0x3b'),'attributes':['id','name',_0x9aa1('0x3c')]}]}]},'log':_0x9aa1('0x1')});};}; \ No newline at end of file +var _0x9c1e=['dialQueueTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','TrunkBackup','Interval','GetVoiceQueue','name','acw','acwTimeout','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions'];(function(_0x8f86c7,_0x407bdd){var _0x5c3526=function(_0x487ba5){while(--_0x487ba5){_0x8f86c7['push'](_0x8f86c7['shift']());}};_0x5c3526(++_0x407bdd);}(_0x9c1e,0xd3));var _0xe9c1=function(_0x369d84,_0x33d80e){_0x369d84=_0x369d84-0x0;var _0x592bfd=_0x9c1e[_0x369d84];return _0x592bfd;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client['Request'](_0xe9c1('0x0'),{'options':{'raw':![],'attributes':['id',_0xe9c1('0x1'),_0xe9c1('0x2'),_0xe9c1('0x3'),'autopause',_0xe9c1('0x4'),_0xe9c1('0x5'),_0xe9c1('0x6'),'dialMethod',_0xe9c1('0x7'),_0xe9c1('0x8'),_0xe9c1('0x9'),_0xe9c1('0xa'),_0xe9c1('0xb'),_0xe9c1('0xc'),_0xe9c1('0xd'),_0xe9c1('0xe'),_0xe9c1('0xf'),_0xe9c1('0x10'),_0xe9c1('0x11'),'dialQueueProject',_0xe9c1('0x12'),'dialCongestionRetryFrequency',_0xe9c1('0x13'),'dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0xe9c1('0x14'),_0xe9c1('0x15'),_0xe9c1('0x16'),_0xe9c1('0x17'),'dialPrefix',_0xe9c1('0x18'),'dialAMDActive',_0xe9c1('0x19'),_0xe9c1('0x1a'),_0xe9c1('0x1b'),_0xe9c1('0x1c'),'dialAMDMinWordLength',_0xe9c1('0x1d'),_0xe9c1('0x1e'),_0xe9c1('0x1f'),_0xe9c1('0x20'),_0xe9c1('0x21'),_0xe9c1('0x22'),'dialRecallInQueue',_0xe9c1('0x23'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0xe9c1('0x24'),_0xe9c1('0x4'),_0xe9c1('0x25'),_0xe9c1('0x26'),_0xe9c1('0x27'),_0xe9c1('0x28'),'dialNoSuchNumberRetryFrequency',_0xe9c1('0x29'),_0xe9c1('0x2a'),_0xe9c1('0x2b'),_0xe9c1('0x2c'),_0xe9c1('0x2d'),_0xe9c1('0x2e'),_0xe9c1('0x2f'),_0xe9c1('0x30'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0xe9c1('0x31'),_0xe9c1('0x32'),'dialPreviewRecallmeReminder'],'include':[{'model':'Trunk','as':_0xe9c1('0x33'),'attributes':['id',_0xe9c1('0x1'),_0xe9c1('0x34'),_0xe9c1('0x35')]},{'model':_0xe9c1('0x36'),'as':'mandatoryDispositionPause','attributes':['id',_0xe9c1('0x1')]},{'model':_0xe9c1('0x33'),'as':_0xe9c1('0x37'),'attributes':['id','name',_0xe9c1('0x34'),_0xe9c1('0x35')]},{'model':_0xe9c1('0x38'),'as':_0xe9c1('0x38'),'attributes':['id',_0xe9c1('0x1')],'include':[{'model':_0xe9c1('0x38'),'as':'Intervals','attributes':['id',_0xe9c1('0x1'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 07e2bc0..1ab425e 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(_0x488ef9,_0x39bf4a){var _0x19bb12=function(_0x4325f9){while(--_0x4325f9){_0x488ef9['push'](_0x488ef9['shift']());}};_0x19bb12(++_0x39bf4a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0x54812d,_0x464538){var _0x29ec8b=function(_0x1de623){while(--_0x1de623){_0x54812d['push'](_0x54812d['shift']());}};_0x29ec8b(++_0x464538);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 c80f78c..d986bc2 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 _0xc969=['../client'];(function(_0x1f404a,_0x5088b2){var _0x2cdcd5=function(_0xe30d8c){while(--_0xe30d8c){_0x1f404a['push'](_0x1f404a['shift']());}};_0x2cdcd5(++_0x5088b2);}(_0xc969,0x117));var _0x9c96=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xc969[_0x28947d];return _0x12d2ee;};'use strict';var client=require(_0x9c96('0x0'));exports['getVoiceQueueRtPauses']=function(_0x3c4fe4){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x3c4fe4,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xb30b=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x1c8d7f,_0x21734c){var _0x380dcb=function(_0x337ae5){while(--_0x337ae5){_0x1c8d7f['push'](_0x1c8d7f['shift']());}};_0x380dcb(++_0x21734c);}(_0xb30b,0x151));var _0xbb30=function(_0x4724ba,_0x372142){_0x4724ba=_0x4724ba-0x0;var _0x3c2f63=_0xb30b[_0x4724ba];return _0x3c2f63;};'use strict';var client=require(_0xbb30('0x0'));exports[_0xbb30('0x1')]=function(_0x54a1b7){return function(){return client[_0xbb30('0x2')](_0xbb30('0x3'),{'options':{'where':{'VoiceQueueId':_0x54a1b7,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 9c8f75c..bcb83c6 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x10ee39,_0x11d880){var _0xaeb046=function(_0x5b8439){while(--_0x5b8439){_0x10ee39['push'](_0x10ee39['shift']());}};_0xaeb046(++_0x11d880);}(_0x7a54,0x106));var _0x47a5=function(_0x175276,_0x5b67e8){_0x175276=_0x175276-0x0;var _0x63d396=_0x7a54[_0x175276];return _0x63d396;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0xa1c7a5,_0x515dbc){var _0x2c4a9c=function(_0x31d933){while(--_0x31d933){_0xa1c7a5['push'](_0xa1c7a5['shift']());}};_0x2c4a9c(++_0x515dbc);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 2e36eb1..c0619a0 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 _0x8d4f=['origtransfererlinkedid','transfertargetchannel','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','transfers','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','blind','attendedTransfer','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten'];(function(_0x1fa0df,_0x122369){var _0x2106bc=function(_0x296e4c){while(--_0x296e4c){_0x1fa0df['push'](_0x1fa0df['shift']());}};_0x2106bc(++_0x122369);}(_0x8d4f,0x138));var _0xf8d4=function(_0x89100d,_0x59c43d){_0x89100d=_0x89100d-0x0;var _0x15974a=_0x8d4f[_0x89100d];return _0x15974a;};'use strict';var client=require(_0xf8d4('0x0'));exports[_0xf8d4('0x1')]={};exports['blindTransfer']=function(_0x3a17cb){return client[_0xf8d4('0x2')](_0xf8d4('0x3'),{'body':{'result':_0x3a17cb[_0xf8d4('0x4')],'transfererchannel':_0x3a17cb[_0xf8d4('0x5')],'transferercalleridnum':_0x3a17cb['transferercalleridnum'],'transferercalleridname':_0x3a17cb[_0xf8d4('0x6')],'transfererconnectedlinenum':_0x3a17cb[_0xf8d4('0x7')],'transfererconnectedlinename':_0x3a17cb[_0xf8d4('0x8')],'transfereraccountcode':_0x3a17cb['transfereraccountcode'],'transferercontext':_0x3a17cb[_0xf8d4('0x9')],'transfererexten':_0x3a17cb[_0xf8d4('0xa')],'transfererlinkedid':_0x3a17cb['transfererlinkedid'],'transfereechannel':_0x3a17cb[_0xf8d4('0xb')],'transfereecalleridnum':_0x3a17cb[_0xf8d4('0xc')],'transfereecalleridname':_0x3a17cb[_0xf8d4('0xd')],'transfereeconnectedlinenum':_0x3a17cb[_0xf8d4('0xe')],'transfereeconnectedlinename':_0x3a17cb[_0xf8d4('0xf')],'transfereeaccountcode':_0x3a17cb[_0xf8d4('0x10')],'transfereecontext':_0x3a17cb[_0xf8d4('0x11')],'transfereeexten':_0x3a17cb[_0xf8d4('0x12')],'transfereelinkedid':_0x3a17cb['transfereelinkedid'],'isexternal':_0x3a17cb[_0xf8d4('0x13')],'context':_0x3a17cb[_0xf8d4('0x14')],'extension':_0x3a17cb[_0xf8d4('0x15')],'type':_0xf8d4('0x16')},'log':'CreateVoiceTransferReport'});};exports[_0xf8d4('0x17')]=function(_0x5add83){return client[_0xf8d4('0x2')](_0xf8d4('0x3'),{'body':{'result':_0x5add83[_0xf8d4('0x4')],'transfererchannel':_0x5add83['origtransfererchannel'],'transferercalleridnum':_0x5add83['origtransferercalleridnum'],'transferercalleridname':_0x5add83[_0xf8d4('0x18')],'transfererconnectedlinenum':_0x5add83[_0xf8d4('0x19')],'transfererconnectedlinename':_0x5add83[_0xf8d4('0x1a')],'transfereraccountcode':_0x5add83[_0xf8d4('0x1b')],'transferercontext':_0x5add83[_0xf8d4('0x1c')],'transfererexten':_0x5add83[_0xf8d4('0x1d')],'transfererlinkedid':_0x5add83[_0xf8d4('0x1e')],'transfereechannel':_0x5add83[_0xf8d4('0x1f')],'transfereecalleridnum':_0x5add83['transfertargetcalleridnum'],'transfereecalleridname':_0x5add83['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x5add83['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x5add83['transfertargetconnectedlinename'],'transfereeaccountcode':_0x5add83[_0xf8d4('0x20')],'transfereecontext':_0x5add83[_0xf8d4('0x21')],'transfereeexten':_0x5add83[_0xf8d4('0x22')],'transfereelinkedid':_0x5add83[_0xf8d4('0x23')],'isexternal':_0x5add83['isexternal'],'context':_0x5add83['origtransferercontext'],'extension':_0x5add83[_0xf8d4('0x24')],'type':_0xf8d4('0x25')},'log':_0xf8d4('0x3')});}; \ No newline at end of file +var _0x6a95=['transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereecontext','transfereeexten','isexternal','context','blind','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a95,0x1b3));var _0x56a9=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x6a95[_0x45e98e];return _0x374dba;};'use strict';var client=require(_0x56a9('0x0'));exports[_0x56a9('0x1')]={};exports[_0x56a9('0x2')]=function(_0x28d820){return client[_0x56a9('0x3')](_0x56a9('0x4'),{'body':{'result':_0x28d820[_0x56a9('0x5')],'transfererchannel':_0x28d820[_0x56a9('0x6')],'transferercalleridnum':_0x28d820['transferercalleridnum'],'transferercalleridname':_0x28d820[_0x56a9('0x7')],'transfererconnectedlinenum':_0x28d820[_0x56a9('0x8')],'transfererconnectedlinename':_0x28d820[_0x56a9('0x9')],'transfereraccountcode':_0x28d820['transfereraccountcode'],'transferercontext':_0x28d820[_0x56a9('0xa')],'transfererexten':_0x28d820[_0x56a9('0xb')],'transfererlinkedid':_0x28d820[_0x56a9('0xc')],'transfereechannel':_0x28d820[_0x56a9('0xd')],'transfereecalleridnum':_0x28d820['transfereecalleridnum'],'transfereecalleridname':_0x28d820[_0x56a9('0xe')],'transfereeconnectedlinenum':_0x28d820[_0x56a9('0xf')],'transfereeconnectedlinename':_0x28d820['transfereeconnectedlinename'],'transfereeaccountcode':_0x28d820['transfereeaccountcode'],'transfereecontext':_0x28d820[_0x56a9('0x10')],'transfereeexten':_0x28d820[_0x56a9('0x11')],'transfereelinkedid':_0x28d820['transfereelinkedid'],'isexternal':_0x28d820[_0x56a9('0x12')],'context':_0x28d820[_0x56a9('0x13')],'extension':_0x28d820['extension'],'type':_0x56a9('0x14')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x406503){return client['Request'](_0x56a9('0x4'),{'body':{'result':_0x406503['result'],'transfererchannel':_0x406503[_0x56a9('0x15')],'transferercalleridnum':_0x406503[_0x56a9('0x16')],'transferercalleridname':_0x406503[_0x56a9('0x17')],'transfererconnectedlinenum':_0x406503[_0x56a9('0x18')],'transfererconnectedlinename':_0x406503[_0x56a9('0x19')],'transfereraccountcode':_0x406503['origtransfereraccountcode'],'transferercontext':_0x406503[_0x56a9('0x1a')],'transfererexten':_0x406503[_0x56a9('0x1b')],'transfererlinkedid':_0x406503[_0x56a9('0x1c')],'transfereechannel':_0x406503[_0x56a9('0x1d')],'transfereecalleridnum':_0x406503[_0x56a9('0x1e')],'transfereecalleridname':_0x406503[_0x56a9('0x1f')],'transfereeconnectedlinenum':_0x406503[_0x56a9('0x20')],'transfereeconnectedlinename':_0x406503[_0x56a9('0x21')],'transfereeaccountcode':_0x406503['transfertargetaccountcode'],'transfereecontext':_0x406503[_0x56a9('0x22')],'transfereeexten':_0x406503[_0x56a9('0x23')],'transfereelinkedid':_0x406503[_0x56a9('0x24')],'isexternal':_0x406503[_0x56a9('0x12')],'context':_0x406503['origtransferercontext'],'extension':_0x406503[_0x56a9('0x25')],'type':_0x56a9('0x26')},'log':_0x56a9('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 19e46ac..49b8f62 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 _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x5a51fc,_0x115da2){var _0x552033=function(_0x568387){while(--_0x568387){_0x5a51fc['push'](_0x5a51fc['shift']());}};_0x552033(++_0x115da2);}(_0xb10b,0x12a));var _0xbb10=function(_0x3f99a8,_0x160bf7){_0x3f99a8=_0x3f99a8-0x0;var _0x25c907=_0xb10b[_0x3f99a8];return _0x25c907;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x5189cf,_0x144c74){var _0x1ccf87=function(_0x1c4e0f){while(--_0x1c4e0f){_0x5189cf['push'](_0x5189cf['shift']());}};_0x1ccf87(++_0x144c74);}(_0xb10b,0x12a));var _0xbb10=function(_0x11afe7,_0x2dcbae){_0x11afe7=_0x11afe7-0x0;var _0x2967b5=_0xb10b[_0x11afe7];return _0x2967b5;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+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 640e66c..9c3950f 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 _0x1892=['mobile','fax','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','join','uniqueid','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','Unknown','','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','trigger:%s','toLowerCase','merge','lodash','ioredis','util','../../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName'];(function(_0x361364,_0x47866f){var _0x1ec3cf=function(_0x34a248){while(--_0x34a248){_0x361364['push'](_0x361364['shift']());}};_0x1ec3cf(++_0x47866f);}(_0x1892,0x8d));var _0x2189=function(_0x37a824,_0x537b7d){_0x37a824=_0x37a824-0x0;var _0x278232=_0x1892[_0x37a824];return _0x278232;};'use strict';var _=require(_0x2189('0x0'));var BPromise=require('bluebird');var Redis=require(_0x2189('0x1'));var util=require(_0x2189('0x2'));var config=require('../../../../config/environment');var logger=require(_0x2189('0x3'))(_0x2189('0x4'));var cmContactRpc=require('../../rpc/cmContact');config[_0x2189('0x5')]=_[_0x2189('0x6')](config[_0x2189('0x5')],{'host':_0x2189('0x7'),'port':0x18eb});var io=require(_0x2189('0x8'))(new Redis(config[_0x2189('0x5')]));function emit(_0x227990,_0x16982e,_0x11372b,_0x4ad91a,_0x43a9ee){logger[_0x2189('0x9')](_0x2189('0xa'),_0x227990,_0x16982e['id'],_0x11372b,_0x4ad91a,JSON[_0x2189('0xb')](_0x43a9ee));io['to'](_0x11372b)[_0x2189('0xc')](_0x4ad91a,_0x43a9ee);}exports[_0x2189('0xd')]=function(_0x570edb,_0x29f333,_0x37aa97,_0x49205d){var _0x57885b,_0x76a3e7;var _0x42a491={};var _0x278059;var _0x2c1344=Number(_0x37aa97[_0x2189('0xe')]);var _0x41ae03=_0x37aa97[_0x2189('0xf')]?Boolean(Number(_0x37aa97[_0x2189('0xf')])):![];var _0x261b1b;var _0x3dcf16=![];if(!_[_0x2189('0x10')](_0x37aa97[_0x2189('0x11')])){if(_0x37aa97[_0x2189('0x11')]=='1')_0x3dcf16=!![];}if(!_0x3dcf16){if(_0x49205d[_0x2189('0x12')]){_0x42a491['id']=_0x49205d['xmd-contactid'];}}if(!_0x42a491['id']){_0x42a491[_0x2189('0x13')]=_0x2c1344;_0x261b1b=_0x37aa97[_0x2189('0x14')]&&_0x37aa97['data3']!=='0'?_0x37aa97[_0x2189('0x14')][_0x2189('0x15')](','):[_0x2189('0x16')];_0x42a491[_0x2189('0x17')]=_[_0x2189('0x18')](_0x261b1b,function(_0x359dcf){var _0x2b55d8={};_0x2b55d8[_0x359dcf]=_0x49205d[_0x2189('0x19')]?_0x49205d[_0x2189('0x1a')]:_0x49205d[_0x2189('0x1b')];return _0x2b55d8;});_0x278059=_0x49205d[_0x2189('0x19')]?_0x49205d[_0x2189('0x1a')]:_0x49205d[_0x2189('0x1b')];}var _0x421ba8=['id',_0x2189('0x1c'),_0x2189('0x1d'),_0x2189('0x16'),_0x2189('0x1e'),_0x2189('0x1f'),_0x2189('0x13'),'createdAt',_0x2189('0x20'),_0x2189('0x21')];var _0x3025e5=_[_0x2189('0x22')](_0x421ba8,_0x261b1b);BPromise[_0x2189('0x23')]()[_0x2189('0x24')](cmContactRpc[_0x2189('0x25')]({'attributes':_0x3025e5,'where':_0x42a491,'phone':_0x278059}))['then'](function(_0x249a48){_0x76a3e7=_0x249a48;if(!_[_0x2189('0x26')](_0x76a3e7)){if(_0x76a3e7[_0x2189('0x27')]===0x1){_0x57885b=_0x76a3e7[0x0];logger[_0x2189('0x9')](_0x2189('0x28'),_0x49205d['uniqueid'],_0x29f333['id'],_0x57885b['id']);}else{logger[_0x2189('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x49205d['uniqueid'],_0x29f333['id'],_[_0x2189('0x18')](_0x76a3e7,'id')[_0x2189('0x29')](','));}return;}else{logger[_0x2189('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x49205d[_0x2189('0x2a')],_0x29f333['id']);var _0x7020bf={'ListId':_0x2c1344};var _0x2940d0=_0x37aa97[_0x2189('0x2b')]&&_0x37aa97[_0x2189('0x2b')]!=='0'?_0x37aa97[_0x2189('0x2b')]:_0x2189('0x16');if(_0x41ae03){logger[_0x2189('0x9')](_0x2189('0x2c'),_0x49205d[_0x2189('0x2a')],_0x29f333['id']);_0x7020bf[_0x2940d0]=_[_0x2189('0x10')](_0x49205d[_0x2189('0x19')])?_0x49205d[_0x2189('0x1b')]:_0x49205d['destcalleridnum'];if(_[_0x2189('0x10')](_0x49205d[_0x2189('0x19')])){_0x7020bf['firstName']=_0x49205d[_0x2189('0x2d')]&&_0x49205d['calleridname']!==''?_0x49205d[_0x2189('0x2d')]:_0x2189('0x2e');}else{_0x7020bf[_0x2189('0x1c')]=_0x49205d['destcalleridname']&&_0x49205d['destcalleridname']!==_0x2189('0x2f')?_0x49205d[_0x2189('0x30')]:'Unknown';}return BPromise[_0x2189('0x23')]()[_0x2189('0x24')](cmContactRpc[_0x2189('0x31')](_0x7020bf))[_0x2189('0x24')](function(_0x41703c){_0x57885b=_0x41703c;_0x76a3e7[_0x2189('0x32')](_0x41703c);if(_0x57885b){logger[_0x2189('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x49205d[_0x2189('0x2a')],_0x29f333['id'],_0x57885b['id']);}return;});}else{logger[_0x2189('0x9')](_0x2189('0x33'),_0x49205d[_0x2189('0x2a')],_0x29f333['id']);_0x7020bf[_0x2940d0]=_['isNil'](_0x49205d[_0x2189('0x19')])?_0x49205d[_0x2189('0x1b')]:_0x49205d[_0x2189('0x1a')];if(_[_0x2189('0x10')](_0x49205d[_0x2189('0x19')])){_0x7020bf[_0x2189('0x1c')]=_0x49205d[_0x2189('0x2d')]&&_0x49205d[_0x2189('0x2d')]!==''?_0x49205d[_0x2189('0x2d')]:_0x2189('0x2e');}else{_0x7020bf[_0x2189('0x1c')]=_0x49205d['destcalleridname']&&_0x49205d['destcalleridname']!==''?_0x49205d[_0x2189('0x30')]:_0x2189('0x2e');}_0x57885b=_0x7020bf;_0x76a3e7[_0x2189('0x32')](_0x7020bf);return;}}})[_0x2189('0x24')](function(){if(_0x570edb){emit(_0x49205d['uniqueid'],_0x29f333,util[_0x2189('0x34')](_0x2189('0x35'),_0x570edb['name']),util[_0x2189('0x34')](_0x2189('0x36'),_0x37aa97['action'][_0x2189('0x37')]()),{'evt':_[_0x2189('0x38')](_0x49205d,{'autoCreate':_0x41ae03}),'contact':_0x57885b===undefined?{}:_0x57885b,'contacts':_0x76a3e7['length']===0x0?undefined:_0x76a3e7});}});}; \ No newline at end of file +var _0x63e5=['util','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data2','isNil','data5','xmd-contactid','data3','split','$or','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','ListId','createdAt','scheduledAt','resolve','then','length','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash'];(function(_0x1ebb10,_0x156b3e){var _0x20d709=function(_0x4cc093){while(--_0x4cc093){_0x1ebb10['push'](_0x1ebb10['shift']());}};_0x20d709(++_0x156b3e);}(_0x63e5,0xd3));var _0x563e=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x63e5[_0x45783c];return _0x1161da;};'use strict';var _=require(_0x563e('0x0'));var BPromise=require('bluebird');var Redis=require('ioredis');var util=require(_0x563e('0x1'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x563e('0x2'));var cmContactRpc=require(_0x563e('0x3'));config[_0x563e('0x4')]=_[_0x563e('0x5')](config[_0x563e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x563e('0x6'))(new Redis(config[_0x563e('0x4')]));function emit(_0x3bfd3c,_0x5815ed,_0x60c6d,_0xed22f,_0x235db9){logger[_0x563e('0x7')](_0x563e('0x8'),_0x3bfd3c,_0x5815ed['id'],_0x60c6d,_0xed22f,JSON[_0x563e('0x9')](_0x235db9));io['to'](_0x60c6d)['emit'](_0xed22f,_0x235db9);}exports[_0x563e('0xa')]=function(_0xb6b2ad,_0x46050d,_0x21a8da,_0x2d161a){var _0x51e29f,_0x42e2e2;var _0x41a6b3={};var _0x47c97f;var _0x440530=Number(_0x21a8da['data1']);var _0x3eb726=_0x21a8da[_0x563e('0xb')]?Boolean(Number(_0x21a8da['data2'])):![];var _0x5bfdce;var _0x104550=![];if(!_[_0x563e('0xc')](_0x21a8da['data5'])){if(_0x21a8da[_0x563e('0xd')]=='1')_0x104550=!![];}if(!_0x104550){if(_0x2d161a[_0x563e('0xe')]){_0x41a6b3['id']=_0x2d161a[_0x563e('0xe')];}}if(!_0x41a6b3['id']){_0x41a6b3['ListId']=_0x440530;_0x5bfdce=_0x21a8da['data3']&&_0x21a8da[_0x563e('0xf')]!=='0'?_0x21a8da[_0x563e('0xf')][_0x563e('0x10')](','):['phone'];_0x41a6b3[_0x563e('0x11')]=_['map'](_0x5bfdce,function(_0x595bb8){var _0x419683={};_0x419683[_0x595bb8]=_0x2d161a[_0x563e('0x12')]?_0x2d161a[_0x563e('0x13')]:_0x2d161a[_0x563e('0x14')];return _0x419683;});_0x47c97f=_0x2d161a[_0x563e('0x12')]?_0x2d161a[_0x563e('0x13')]:_0x2d161a[_0x563e('0x14')];}var _0xd150a3=['id',_0x563e('0x15'),_0x563e('0x16'),'phone',_0x563e('0x17'),_0x563e('0x18'),_0x563e('0x19'),_0x563e('0x1a'),_0x563e('0x1b'),'updatedAt'];var _0x2ccd4c=_['union'](_0xd150a3,_0x5bfdce);BPromise[_0x563e('0x1c')]()['then'](cmContactRpc['getContacts']({'attributes':_0x2ccd4c,'where':_0x41a6b3,'phone':_0x47c97f}))[_0x563e('0x1d')](function(_0x5fa2c4){_0x42e2e2=_0x5fa2c4;if(!_['isEmpty'](_0x42e2e2)){if(_0x42e2e2[_0x563e('0x1e')]===0x1){_0x51e29f=_0x42e2e2[0x0];logger[_0x563e('0x7')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x2d161a['uniqueid'],_0x46050d['id'],_0x51e29f['id']);}else{logger['info'](_0x563e('0x1f'),_0x2d161a[_0x563e('0x20')],_0x46050d['id'],_[_0x563e('0x21')](_0x42e2e2,'id')[_0x563e('0x22')](','));}return;}else{logger[_0x563e('0x7')](_0x563e('0x23'),_0x2d161a['uniqueid'],_0x46050d['id']);var _0x4fcb90={'ListId':_0x440530};var _0x350744=_0x21a8da['data4']&&_0x21a8da[_0x563e('0x24')]!=='0'?_0x21a8da['data4']:_0x563e('0x25');if(_0x3eb726){logger[_0x563e('0x7')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x2d161a[_0x563e('0x20')],_0x46050d['id']);_0x4fcb90[_0x350744]=_[_0x563e('0xc')](_0x2d161a[_0x563e('0x12')])?_0x2d161a[_0x563e('0x14')]:_0x2d161a[_0x563e('0x13')];if(_['isNil'](_0x2d161a[_0x563e('0x12')])){_0x4fcb90[_0x563e('0x15')]=_0x2d161a['calleridname']&&_0x2d161a[_0x563e('0x26')]!==_0x563e('0x27')?_0x2d161a[_0x563e('0x26')]:_0x563e('0x28');}else{_0x4fcb90[_0x563e('0x15')]=_0x2d161a[_0x563e('0x29')]&&_0x2d161a[_0x563e('0x29')]!==_0x563e('0x27')?_0x2d161a[_0x563e('0x29')]:_0x563e('0x28');}return BPromise[_0x563e('0x1c')]()['then'](cmContactRpc[_0x563e('0x2a')](_0x4fcb90))[_0x563e('0x1d')](function(_0xed82cc){_0x51e29f=_0xed82cc;_0x42e2e2[_0x563e('0x2b')](_0xed82cc);if(_0x51e29f){logger[_0x563e('0x7')](_0x563e('0x2c'),_0x2d161a[_0x563e('0x20')],_0x46050d['id'],_0x51e29f['id']);}return;});}else{logger[_0x563e('0x7')](_0x563e('0x2d'),_0x2d161a[_0x563e('0x20')],_0x46050d['id']);_0x4fcb90[_0x350744]=_[_0x563e('0xc')](_0x2d161a[_0x563e('0x12')])?_0x2d161a[_0x563e('0x14')]:_0x2d161a[_0x563e('0x13')];if(_[_0x563e('0xc')](_0x2d161a[_0x563e('0x12')])){_0x4fcb90['firstName']=_0x2d161a['calleridname']&&_0x2d161a[_0x563e('0x26')]!==_0x563e('0x27')?_0x2d161a[_0x563e('0x26')]:'Unknown';}else{_0x4fcb90[_0x563e('0x15')]=_0x2d161a['destcalleridname']&&_0x2d161a['destcalleridname']!==_0x563e('0x27')?_0x2d161a['destcalleridname']:_0x563e('0x28');}_0x51e29f=_0x4fcb90;_0x42e2e2['push'](_0x4fcb90);return;}}})[_0x563e('0x1d')](function(){if(_0xb6b2ad){emit(_0x2d161a['uniqueid'],_0x46050d,util[_0x563e('0x2e')](_0x563e('0x2f'),_0xb6b2ad[_0x563e('0x30')]),util['format'](_0x563e('0x31'),_0x21a8da[_0x563e('0x32')][_0x563e('0x33')]()),{'evt':_[_0x563e('0x34')](_0x2d161a,{'autoCreate':_0x3eb726}),'contact':_0x51e29f===undefined?{}:_0x51e29f,'contacts':_0x42e2e2[_0x563e('0x1e')]===0x0?undefined:_0x42e2e2});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index fbe76b5..6bab087 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 _0xd957=['toLowerCase','contactmanager','motionbar','popup','TemplateId','data2','html','render','template\x20not\x20found','buildUri','data3','isNil','data4','location','uriLocation','data5','800','windowHeight','data6','600','winArguments','format','name','trigger:%s:%s','action','user:%s','trigger:%s','data1','exec','integration','queue','urlforward','script','search','replace','channel','AllConditions','every','checkConditions','AnyConditions','some','checkTrigger:\x20trigger','evt','field','account','operator','ChatWebsiteId','upperFirst','AccountId','interaction','message','membername','lastevent','value','routeId','mailSubstatus','null','substatus','offlineMessage','exports','util','mustache','ioredis','./urlforward','./integration','./script','../../../config/environment','../../../config/logger','trigger','redis','socket.io-emitter','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','zohoAccounts','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:queuecallerabandon','custom:timeout','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','undefined','motionChannel','voice','inspect','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xd957,0x1b6));var _0x7d95=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd957[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0x7d95('0x0'));var _=require('lodash');var url=require('url');var Mustache=require(_0x7d95('0x1'));var Redis=require(_0x7d95('0x2'));var urlforward=require(_0x7d95('0x3'));var integration=require(_0x7d95('0x4'));var cmContact=require('./cmContact');var script=require(_0x7d95('0x5'));var config=require(_0x7d95('0x6'));var logger=require(_0x7d95('0x7'))(_0x7d95('0x8'));var ami=require('../ami');config[_0x7d95('0x9')]=_['defaults'](config[_0x7d95('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x7d95('0xa'))(new Redis(config[_0x7d95('0x9')]));var operators={'equals':function(_0x462a80,_0x5f4198){return _0x462a80==_0x5f4198;},'not_equals':function(_0x310f49,_0x3c733c){return _0x310f49!=_0x3c733c;}};var barAndWebActions=['popup',_0x7d95('0xb'),_0x7d95('0xc')];function Trigger(_0xb36cc9){this[_0x7d95('0xd')]=_0xb36cc9[_0x7d95('0xd')];this[_0x7d95('0xe')]=_0xb36cc9[_0x7d95('0xe')];this[_0x7d95('0xf')]=_0xb36cc9[_0x7d95('0xf')];this[_0x7d95('0x10')]=_0xb36cc9[_0x7d95('0x10')];this[_0x7d95('0x11')]=_0xb36cc9[_0x7d95('0x11')];this['zendeskAccounts']=_0xb36cc9[_0x7d95('0x12')];this[_0x7d95('0x13')]=_0xb36cc9['freshdeskAccounts'];this[_0x7d95('0x14')]=_0xb36cc9[_0x7d95('0x14')];this['sugarcrmAccounts']=_0xb36cc9[_0x7d95('0x15')];this['zohoAccounts']=_0xb36cc9['zohoAccounts'];this[_0x7d95('0x16')]=_0xb36cc9[_0x7d95('0x16')];this['vtigerAccounts']=_0xb36cc9[_0x7d95('0x17')];this[_0x7d95('0x18')]=_0xb36cc9[_0x7d95('0x18')];this[_0x7d95('0x19')]=_0xb36cc9[_0x7d95('0x19')];this['freshsalesAccounts']=_0xb36cc9[_0x7d95('0x1a')];this[_0x7d95('0x1b')]={'zendesk':this[_0x7d95('0x12')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x7d95('0x13')],'sugarcrm':this[_0x7d95('0x15')],'zoho':this[_0x7d95('0x1c')],'desk':this['deskAccounts'],'vtiger':this[_0x7d95('0x17')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x7d95('0x1a')],'servicenow':this['servicenowAccounts']};ami['on']('custom:agentcalled',this[_0x7d95('0x1d')][_0x7d95('0x1e')](this));ami['on'](_0x7d95('0x1f'),this[_0x7d95('0x1d')]['bind'](this));ami['on'](_0x7d95('0x20'),this['syncCustomEvent']['bind'](this));ami['on'](_0x7d95('0x21'),this['syncCustomEvent'][_0x7d95('0x1e')](this));ami['on']('custom:agentnosuchnumber',this['syncCustomEvent'][_0x7d95('0x1e')](this));ami['on'](_0x7d95('0x22'),this[_0x7d95('0x1d')][_0x7d95('0x1e')](this));ami['on'](_0x7d95('0x23'),this[_0x7d95('0x1d')]['bind'](this));ami['on']('custom:agentcongestion',this[_0x7d95('0x1d')]['bind'](this));ami['on'](_0x7d95('0x24'),this[_0x7d95('0x1d')][_0x7d95('0x1e')](this));ami['on']('custom:amd',this[_0x7d95('0x1d')][_0x7d95('0x1e')](this));ami['on'](_0x7d95('0x25'),this[_0x7d95('0x1d')][_0x7d95('0x1e')](this));ami['on'](_0x7d95('0x26'),this[_0x7d95('0x1d')][_0x7d95('0x1e')](this));ami['on']('custom:dialbegin',this[_0x7d95('0x27')][_0x7d95('0x1e')](this));ami['on'](_0x7d95('0x28'),this[_0x7d95('0x27')][_0x7d95('0x1e')](this));ami['on'](_0x7d95('0x29'),this[_0x7d95('0x27')]['bind'](this));ami['on'](_0x7d95('0x2a'),this['syncCustomEvent'][_0x7d95('0x1e')](this));ami['on'](_0x7d95('0x2b'),this[_0x7d95('0x1d')]['bind'](this));ami['on'](_0x7d95('0x2c'),this['syncCustomEvent'][_0x7d95('0x1e')](this));ami['on'](_0x7d95('0x2d'),this[_0x7d95('0x1d')][_0x7d95('0x1e')](this));ami['on'](_0x7d95('0x2e'),this[_0x7d95('0x1d')][_0x7d95('0x1e')](this));ami['on']('custom:acceptmessage',this[_0x7d95('0x1d')]['bind'](this));ami['on'](_0x7d95('0x2f'),this[_0x7d95('0x1d')]['bind'](this));ami['on']('custom:offlineMessage',this[_0x7d95('0x1d')][_0x7d95('0x1e')](this));}Trigger[_0x7d95('0x30')][_0x7d95('0x31')]=function(_0x31bd52,_0x3914ca,_0x584736){logger[_0x7d95('0x32')](_0x31bd52,_0x3914ca,JSON[_0x7d95('0x33')](_0x584736));io['to'](_0x31bd52)['emit'](_0x3914ca,_0x584736);};Trigger[_0x7d95('0x30')][_0x7d95('0x1d')]=function(_0x49d0df){var _0x447e47=_[_0x7d95('0x34')](_0x49d0df);if(typeof _0x447e47['motionChannel']===_0x7d95('0x35')){_0x447e47[_0x7d95('0x36')]=_0x7d95('0x37');}logger['debug'](_0x7d95('0x1d'),util[_0x7d95('0x38')](_0x447e47,{'showHidden':!![],'depth':null}));this[_0x7d95('0x39')](_0x447e47);};Trigger[_0x7d95('0x30')][_0x7d95('0x27')]=function(_0x44fbea){if(this['agents'][_0x44fbea[_0x7d95('0x3a')]]){this['syncCustomEvent'](_0x44fbea);}};Trigger[_0x7d95('0x30')][_0x7d95('0x39')]=function(_0x2a151c){var _0x5b0ab5;for(var _0x1eee64 in this[_0x7d95('0xd')]){if(this['triggers'][_0x7d95('0x3b')](_0x1eee64)){if(this[_0x7d95('0xd')][_0x1eee64][_0x7d95('0x3c')]){_0x5b0ab5=this[_0x7d95('0x3d')](this['triggers'][_0x1eee64],_0x2a151c);if(_0x5b0ab5){_[_0x7d95('0x3e')](_0x2a151c,_0x2a151c[_0x7d95('0x3f')]);for(var _0x6b1182=0x0,_0x4535d0,_0x3e0e77,_0x40d40d;_0x6b11820x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file +var _0xe14b=['CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','%s/customers/%d/cases','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','integrationTab','newTab','catch','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','validateEmail','format','%s/users','then','total_entries','find','_embedded','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','%s/customers','remoteUri','POST','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variableName','custom_fields','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe14b,0x93));var _0xbe14=function(_0x36f756,_0x3029d9){_0x36f756=_0x36f756-0x0;var _0x1796b3=_0xe14b[_0x36f756];return _0x1796b3;};'use strict';var _=require(_0xbe14('0x0'));var rp=require(_0xbe14('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xbe14('0x2'));var intUtil=require(_0xbe14('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbe14('0x4'))('desk');config['redis']=_[_0xbe14('0x5')](config[_0xbe14('0x6')],{'host':_0xbe14('0x7'),'port':0x18eb});var io=require(_0xbe14('0x8'))(new Redis(config[_0xbe14('0x6')]));function emit(_0x39387e,_0x196fca,_0x566ae7){io['to'](_0x39387e)['emit'](_0x196fca,_0x566ae7);}var headers={'Content-Type':'application/json','Accept':_0xbe14('0x9')};function getUser(_0x6fceff,_0xd68cd7){if(intUtil[_0xbe14('0xa')](_0xd68cd7)===!![]){logger['info']('Getting\x20agent\x20with\x20email',_0xd68cd7);return request({'uri':util[_0xbe14('0xb')](_0xbe14('0xc'),_0x6fceff['remoteUri'])})[_0xbe14('0xd')](function(_0x35aa19){if(_0x35aa19[_0xbe14('0xe')]){return _[_0xbe14('0xf')](_0x35aa19[_0xbe14('0x10')][_0xbe14('0x11')],{'email':_0xd68cd7});}})[_0xbe14('0xd')](function(_0x2850cb){if(_0x2850cb){logger[_0xbe14('0x12')](_0xbe14('0x13'));return _0x2850cb;}else{logger[_0xbe14('0x12')](_0xbe14('0x14'));return request({'uri':util[_0xbe14('0xb')]('%s/users/me',_0x6fceff['remoteUri'])});}});}else{logger[_0xbe14('0x12')](_0xbe14('0x15'));return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x16'),_0x6fceff['remoteUri'])});}}function request(_0x21c789){logger[_0xbe14('0x17')](_0xbe14('0x18'),JSON[_0xbe14('0x19')](_0x21c789));return rp(_[_0xbe14('0x5')](_0x21c789,{'method':_0xbe14('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x17ae86){var _0x5ea1f8;if(_0x17ae86[_0xbe14('0x1b')]===_0xbe14('0x1c')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x1d'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x1f')]);}else if(_0x17ae86['authType']===_0xbe14('0x20')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x21'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x20')]);}return util['format'](_0xbe14('0x22'),new Buffer(_0x5ea1f8)['toString'](_0xbe14('0x23')));}function getEndUser(_0x56e80c,_0x32e8eb,_0x4a25fa){logger[_0xbe14('0x12')](_0xbe14('0x24'),_0x4a25fa);return request({'uri':util['format'](_0xbe14('0x25'),_0x56e80c['remoteUri']),'qs':{'phone':_0x4a25fa}})[_0xbe14('0xd')](function(_0x4851f8){if(_0x4851f8[_0xbe14('0xe')]){logger[_0xbe14('0x12')](_0xbe14('0x26'));return _0x4851f8[_0xbe14('0x10')][_0xbe14('0x11')][0x0];}else{logger[_0xbe14('0x12')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x27'),_0x56e80c[_0xbe14('0x28')]),'method':_0xbe14('0x29'),'body':{'first_name':_0x32e8eb,'title':_0x32e8eb,'phone_numbers':[{'type':'work','value':_0x4a25fa}]}});}});}function getTags(_0x16f884,_0x29fc64){var _0x59bf34=[];if(_0x16f884&&_0x16f884[_0xbe14('0x2a')]>0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index bdb94d0..ef8b5c9 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 _0x83df=['Fields','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','name','lodash','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','redis','defaults','modernAuthentication','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','remoteUri','username','password','clientSecret','then','catch','error','toUpperCase','message','GET','Bearer\x20','4.0','value','isNil','validateEmail','userEmail','length','internalemailaddress','email','isdisabled',']\x20Agent\x20found\x20','systemuserid','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','body','odata-entityid','substring','lastIndexOf','enduserId','telephone1','&$filter=','\x20eq\x20\x27','%2b','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incidents','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','callDirection','queue','phonecalls'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x83df,0x86));var _0xf83d=function(_0x1856e8,_0x4532d6){_0x1856e8=_0x1856e8-0x0;var _0x4ad341=_0x83df[_0x1856e8];return _0x4ad341;};'use strict';var _=require(_0xf83d('0x0'));var rp=require(_0xf83d('0x1'));var util=require(_0xf83d('0x2'));var intUtil=require('./util');var md5=require(_0xf83d('0x3'));var Redis=require(_0xf83d('0x4'));var logger=require(_0xf83d('0x5'))(_0xf83d('0x6'));var config=require('../../../../config/environment');config[_0xf83d('0x7')]=_[_0xf83d('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf83d('0x7')]));function getAuthToken(_0x385ed0,_0xa40968,_0x319df8){if(_0x385ed0[_0xf83d('0x9')]){_0x385ed0['remoteUri']=_0x385ed0[_0xf83d('0xa')][_0xf83d('0xb')];_0x385ed0[_0xf83d('0xc')]=_0x385ed0[_0xf83d('0xa')][_0xf83d('0xd')];return Promise[_0xf83d('0xe')](_0x385ed0[_0xf83d('0xa')][_0xf83d('0xf')]);}var _0x2b3db2={'method':_0xf83d('0x10'),'uri':_0xa40968,'form':{'client_id':_0x385ed0[_0xf83d('0x11')],'resource':_0x385ed0[_0xf83d('0x12')],'username':_0x385ed0[_0xf83d('0x13')],'password':_0x385ed0[_0xf83d('0x14')],'grant_type':_0xf83d('0x14'),'client_secret':_0x385ed0[_0xf83d('0x15')]},'json':!![]};return rp(_0x2b3db2)[_0xf83d('0x16')](function(_0x1456a2){return _0x1456a2['access_token'];})[_0xf83d('0x17')](function(_0x3faf01){logger[_0xf83d('0x18')]('['+[_0x319df8[_0xf83d('0x19')]()]+']\x20Wrong\x20credentials!');return _0x3faf01[_0xf83d('0x1a')];});}function getUser(_0x3ac650,_0x5ea3f8,_0x430cf5,_0x18f904,_0x15072e,_0x4f1d7b){return new Promise(function(_0x3cf80c,_0x1d4d9e){return getAuthToken(_0x5ea3f8,_0x18f904,_0x4f1d7b)[_0xf83d('0x16')](function(_0x528084){var _0x356af5={'method':_0xf83d('0x1b'),'uri':_0x15072e+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xf83d('0x1c')+_0x528084,'OData-Version':_0xf83d('0x1d')},'json':!![]};return rp(_0x356af5);})[_0xf83d('0x16')](function(_0x5c6dc5){var _0x388d22=_0x5c6dc5[_0xf83d('0x1e')];var _0x2f0f5e=![];var _0x27518e=null;if(!_[_0xf83d('0x1f')](_0x430cf5)){if(intUtil[_0xf83d('0x20')](_0x430cf5['email'])){_0x3ac650[_0xf83d('0x21')]=_0x430cf5['email'];for(_0x27518e=0x0;_0x27518e<_0x388d22[_0xf83d('0x22')];_0x27518e++){if(_0x388d22[_0x27518e][_0xf83d('0x23')]===_0x430cf5[_0xf83d('0x24')]&&!_0x388d22[_0x27518e][_0xf83d('0x25')]){_0x2f0f5e=!![];logger['info']('['+[_0x4f1d7b[_0xf83d('0x19')]()]+_0xf83d('0x26')+_0x388d22[_0x27518e][_0xf83d('0x27')]+'!');_0x3ac650['userId']=_0x388d22[_0x27518e][_0xf83d('0x27')];}}}}if(!_0x2f0f5e){logger[_0xf83d('0x28')]('['+[_0x4f1d7b[_0xf83d('0x19')]()]+_0xf83d('0x29'));_0x3ac650[_0xf83d('0x21')]=_0x5ea3f8[_0xf83d('0x13')];for(_0x27518e=0x0;_0x27518e<_0x388d22[_0xf83d('0x22')];_0x27518e++){if(_0x388d22[_0x27518e][_0xf83d('0x23')]===_0x5ea3f8[_0xf83d('0x13')]){_0x3ac650[_0xf83d('0x2a')]=_0x388d22[_0x27518e][_0xf83d('0x27')];}}}_0x3cf80c(_0x3ac650);})[_0xf83d('0x17')](function(_0x4cd8ca){_0x1d4d9e(_0x4cd8ca[_0xf83d('0x1a')]);});});}function createEndUser(_0x46657d,_0x4a04cd,_0x3c2489,_0xe2c6a,_0x5b0e0b,_0x3879d2,_0x48f999){return new Promise(function(_0x11a908,_0x2023d1){return getAuthToken(_0x4a04cd,_0x3c2489,_0x3879d2)[_0xf83d('0x16')](function(_0x28c460){var _0x49b5f2=_0x3879d2[_0xf83d('0x2b')]()===_0xf83d('0x2c')?_0x5b0e0b[_0xf83d('0x2d')]:_0x5b0e0b[_0xf83d('0x2e')];var _0x134f23={'method':_0xf83d('0x10'),'uri':_0xe2c6a+_0xf83d('0x2f'),'body':{'fullname':_0x49b5f2,'firstname':_0x49b5f2,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x46657d[_0xf83d('0x2a')]+')'},'headers':{'Authorization':_0xf83d('0x1c')+_0x28c460,'OData-Version':_0xf83d('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x134f23[_0xf83d('0x30')][_0x48f999]=_0x49b5f2;return rp(_0x134f23);})[_0xf83d('0x16')](function(_0x50a2e7){var _0x573103=_0x50a2e7['headers'][_0xf83d('0x31')];var _0x15b902=_0x573103[_0xf83d('0x32')](_0x573103[_0xf83d('0x33')]('(')+0x1,_0x573103[_0xf83d('0x33')](')'));_0x46657d[_0xf83d('0x34')]=_0x15b902;_0x11a908(_0x46657d);})['catch'](function(_0x49eedb){_0x2023d1(_0x49eedb['message']);});});}function getEndUser(_0x1dce63,_0x182018,_0x18c4a9,_0x40a524,_0x4402cd,_0x277b07,_0x441c2a,_0x27c940){var _0x1b8ea0=_0x277b07[_0xf83d('0x2b')]()===_0xf83d('0x2c')?_0x4402cd[_0xf83d('0x2d')]:_0x4402cd['calleridnum'];return getAuthToken(_0x182018,_0x18c4a9,_0x277b07)[_0xf83d('0x16')](function(_0xfa5c08){_0x27c940=_0x27c940?_0x27c940:_0xf83d('0x35');var _0x8eedcb={'method':_0xf83d('0x1b'),'uri':_0x40a524+'contacts?$select='+_0x27c940+_0xf83d('0x36')+_0x27c940+_0xf83d('0x37')+_0x1b8ea0['replace']('+',_0xf83d('0x38'))+'\x27','headers':{'Authorization':_0xf83d('0x1c')+_0xfa5c08,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x8eedcb);})[_0xf83d('0x16')](function(_0x2ae04e){var _0x344892=![];if(!_0x2ae04e)return _0x344892;var _0x675a14=_0x2ae04e[_0xf83d('0x1e')];for(var _0x5cd792=0x0;_0x5cd792<_0x675a14[_0xf83d('0x22')];_0x5cd792++){if(_0x675a14[_0x5cd792][_0x27c940]===_0x1b8ea0){_0x344892=!![];_0x1dce63['enduserId']=_0x675a14[_0x5cd792][_0xf83d('0x39')];}}return _0x344892;})[_0xf83d('0x16')](function(_0xcfeca8){if(_0xcfeca8)return _0x1dce63;if(_0x441c2a==='nothing'){logger['info']('['+[_0x277b07[_0xf83d('0x19')]()]+_0xf83d('0x3a'));return _0x1dce63;}return createEndUser(_0x1dce63,_0x182018,_0x18c4a9,_0x40a524,_0x4402cd,_0x277b07,_0x27c940)[_0xf83d('0x16')](function(_0x670958){logger[_0xf83d('0x28')]('['+[_0x277b07[_0xf83d('0x19')]()]+_0xf83d('0x3b'),_0x670958['enduserId']);return _0x670958;});});}function getCustomFields(_0x2d3999,_0x439a19,_0x52dbba){var _0x144bd5={};if(_0x2d3999[_0xf83d('0x22')]>0x0){_[_0xf83d('0x3c')](_0x2d3999,function(_0x1f6510){if(_[_0xf83d('0x3d')](['string',_0xf83d('0x3e')],_0x1f6510[_0xf83d('0x3f')])&&_0x1f6510[_0xf83d('0x40')]&&!_0x1f6510[_0xf83d('0x41')]){var _0x585fb4=_0x1f6510[_0xf83d('0x42')][_0xf83d('0x2b')]();var _0x39086c=_0x585fb4[_0xf83d('0x32')](0x0,_0x585fb4[_0xf83d('0x43')]('_'));var _0x500ec7=_0x585fb4[_0xf83d('0x32')](_0x585fb4[_0xf83d('0x43')]('_')+0x1);if(_0x39086c===_0x52dbba){_0x144bd5[_0x500ec7]=_0x1f6510[_0xf83d('0x44')];}}});}return _0x144bd5;}function getTicket(_0x400f79,_0x3bb0b4,_0x4f6d5d,_0x59a6ff,_0x192513,_0x2eb52f,_0x34f853){return new Promise(function(_0x32b2fa,_0x1d888f){var _0x165a26;return getAuthToken(_0x3bb0b4,_0x4f6d5d,_0x34f853)[_0xf83d('0x16')](function(_0x2a406d){if(_0x2eb52f[_0xf83d('0x45')]==='incident'){_0x165a26={'method':_0xf83d('0x10'),'uri':_0x59a6ff+_0xf83d('0x46'),'body':Object[_0xf83d('0x47')]({},{'title':intUtil[_0xf83d('0x48')](_0x2eb52f[_0xf83d('0x49')],_0x192513,'\x20'),'description':intUtil[_0xf83d('0x48')](_0x2eb52f[_0xf83d('0x4a')],_0x192513,'\x0a'),'customerid_contact@odata.bind':_0x400f79[_0xf83d('0x34')]?_0xf83d('0x4b')+_0x400f79[_0xf83d('0x34')]+')':undefined,'ownerid@odata.bind':_0xf83d('0x4c')+_0x400f79[_0xf83d('0x2a')]+')','caseorigincode':'1'},getCustomFields(_0x2eb52f['Fields'],_0x192513,_0x2eb52f['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x2a406d,'OData-Version':_0xf83d('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2eb52f[_0xf83d('0x45')]==='phonecall'){var _0x47f47e=_0x400f79[_0xf83d('0x34')]?[{'partyid_systemuser@odata.bind':_0xf83d('0x4c')+_0x400f79[_0xf83d('0x2a')]+')','participationtypemask':_0x400f79[_0xf83d('0x4d')]===_0xf83d('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':_0xf83d('0x4b')+_0x400f79[_0xf83d('0x34')]+')','participationtypemask':_0x400f79[_0xf83d('0x4d')]===_0xf83d('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x400f79[_0xf83d('0x2a')]+')','participationtypemask':_0x400f79[_0xf83d('0x4d')]===_0xf83d('0x4e')?0x2:0x1}];_0x165a26={'method':_0xf83d('0x10'),'uri':_0x59a6ff+_0xf83d('0x4f'),'body':Object[_0xf83d('0x47')]({},{'subject':intUtil[_0xf83d('0x48')](_0x2eb52f[_0xf83d('0x49')],_0x192513,'\x20'),'phonenumber':String(_0x192513[_0xf83d('0x2e')]),'description':intUtil[_0xf83d('0x48')](_0x2eb52f[_0xf83d('0x4a')],_0x192513,'\x0a'),'regardingobjectid_contact@odata.bind':_0x400f79[_0xf83d('0x34')]?_0xf83d('0x4b')+_0x400f79['enduserId']+')':undefined,'ownerid@odata.bind':_0xf83d('0x4c')+_0x400f79[_0xf83d('0x2a')]+')','directioncode':_0x400f79[_0xf83d('0x4d')]===_0xf83d('0x4e')?![]:!![],'phonecall_activity_parties':_0x47f47e},getCustomFields(_0x2eb52f[_0xf83d('0x50')],_0x192513,_0x2eb52f['ticketType'])),'headers':{'Authorization':_0xf83d('0x1c')+_0x2a406d,'OData-Version':_0xf83d('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x165a26);})[_0xf83d('0x16')](function(_0x3e966a){var _0x5ba837=_0x3e966a[_0xf83d('0x51')][_0xf83d('0x31')];var _0x4ea0eb=_0x5ba837[_0xf83d('0x32')](_0x5ba837['lastIndexOf']('(')+0x1,_0x5ba837[_0xf83d('0x33')](')'));_0x400f79[_0xf83d('0x52')]=_0x4ea0eb;_0x32b2fa(_0x400f79);})[_0xf83d('0x17')](function(_0x900869){_0x1d888f(_0x900869[_0xf83d('0x1a')]);});});}function emit(_0x2c8cc6,_0x39833b,_0xa3e6b9,_0x2506a3){var _0x472600={'uri':util[_0xf83d('0x53')](_0xf83d('0x54'),_0x2c8cc6,_0xa3e6b9,_0x2506a3)};io['to'](util[_0xf83d('0x53')](_0xf83d('0x55'),_0x39833b))[_0xf83d('0x56')](_0xf83d('0x57'),_0x472600);}exports['cs']=function(_0x2a5b54,_0x13676c,_0x5f51be,_0x3382f0,_0x22785b,_0x3c8bcd,_0x1dc241,_0x4e2acd){var _0x2b87f3={};_0x3c8bcd[_0xf83d('0x12')]=_0x3c8bcd[_0xf83d('0x9')]?intUtil[_0xf83d('0x58')](_0x3c8bcd[_0xf83d('0xa')][_0xf83d('0xb')]):intUtil[_0xf83d('0x58')](_0x3c8bcd[_0xf83d('0x12')]);_0x3c8bcd['serverUrl']=intUtil[_0xf83d('0x58')](_0x3c8bcd[_0xf83d('0x59')]);_0x2b87f3[_0xf83d('0x4d')]=_0x4e2acd==='queue'||_0x4e2acd==='unmanaged'?_0xf83d('0x4e'):'outbound';var _0x307956=_0x3c8bcd[_0xf83d('0x9')]?util[_0xf83d('0x53')](_0xf83d('0x5a'),_0x3c8bcd[_0xf83d('0xa')]['data7']):util[_0xf83d('0x53')](_0xf83d('0x5a'),_0x3c8bcd[_0xf83d('0x12')]);var _0x52d2b9=util[_0xf83d('0x53')]('https://login.microsoftonline.com/%s/oauth2/token',_0x3c8bcd['tenantId']);var _0x10d77e=util[_0xf83d('0x53')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c8bcd[_0xf83d('0x59')],_0x13676c[_0xf83d('0x5b')],md5(_0x13676c[_0xf83d('0x5b')]));if(_0x22785b&&_0x22785b[_0xf83d('0x5c')]){logger[_0xf83d('0x28')](_0xf83d('0x5d'),'Recording\x20is\x20enabled!');_0x13676c[_0xf83d('0x5e')]=_0x10d77e;}else if(_0x1dc241&&_0x1dc241[_0xf83d('0x5f')]&&_0x1dc241[_0xf83d('0x5f')]!=='none'){logger[_0xf83d('0x28')](_0xf83d('0x60'),'Recording\x20is\x20enabled!');_0x13676c[_0xf83d('0x5e')]=_0x10d77e;}else{_0x13676c[_0xf83d('0x5e')]='';}return getUser(_0x2b87f3,_0x3c8bcd,_0x3382f0,_0x52d2b9,_0x307956,_0x4e2acd)['then'](function(_0x3fcc2c){logger['info']('['+_0x4e2acd[_0xf83d('0x19')]()+_0xf83d('0x61'),_0x3fcc2c['userId']);logger[_0xf83d('0x28')]('['+_0x4e2acd[_0xf83d('0x19')]()+_0xf83d('0x62'),_0x3fcc2c['userEmail']);return getEndUser(_0x3fcc2c,_0x3c8bcd,_0x52d2b9,_0x307956,_0x13676c,_0x4e2acd,_0x5f51be[_0xf83d('0x63')],_0x5f51be[_0xf83d('0x64')]);})[_0xf83d('0x16')](function(_0x10d7e5){logger['info']('['+_0x4e2acd[_0xf83d('0x19')]()+_0xf83d('0x65'),_0x10d7e5[_0xf83d('0x34')]);logger[_0xf83d('0x28')]('['+_0x4e2acd[_0xf83d('0x19')]()+_0xf83d('0x66'),_0x13676c[_0xf83d('0x2e')]);return getTicket(_0x10d7e5,_0x3c8bcd,_0x52d2b9,_0x307956,_0x13676c,_0x5f51be,_0x4e2acd);})['then'](function(_0x31da77){logger['info'](util[_0xf83d('0x53')]('['+_0x4e2acd[_0xf83d('0x19')]()+_0xf83d('0x67'),_0x5f51be[_0xf83d('0x45')],_0x31da77[_0xf83d('0x52')]));logger[_0xf83d('0x28')](util['format']('['+_0x4e2acd['toUpperCase']()+_0xf83d('0x68'),_0x4e2acd));if(_0x4e2acd!==_0xf83d('0x69')&&_0x5f51be['openNewTab']){logger[_0xf83d('0x28')]('['+_0x4e2acd[_0xf83d('0x19')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x3c8bcd[_0xf83d('0x12')],_0x3382f0[_0xf83d('0x6a')],_0x5f51be[_0xf83d('0x45')],_0x31da77['ticketId']);}})[_0xf83d('0x17')](function(_0x372b5c){logger['error']('['+_0x4e2acd[_0xf83d('0x19')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x372b5c[_0xf83d('0x1a')]);console[_0xf83d('0x18')]('Error\x20running\x20Dynamics365\x20integration',_0x372b5c);});}; \ No newline at end of file +var _0x45b1=['unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:','ticketId',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','username','password','clientSecret','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','userEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','userId','systemuserid','catch','toLowerCase','calleridnum','odata-entityid','substring','lastIndexOf','message','outbound','destcalleridnum','telephone1','GET','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','enduserId','contactid','forEach','includes','string','picklist','nameField','idField','indexOf','content','ticketType','incident','incidents','getString','Subjects','Descriptions','/systemusers(','Fields','callDirection','queue','/contacts(','phonecalls','assign','headers','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','modernAuthentication','stripTrailingSlash','serverUrl'];(function(_0xab95a0,_0x12302a){var _0x17bbe8=function(_0x57adf5){while(--_0x57adf5){_0xab95a0['push'](_0xab95a0['shift']());}};_0x17bbe8(++_0x12302a);}(_0x45b1,0x163));var _0x145b=function(_0x1033d3,_0x4ed970){_0x1033d3=_0x1033d3-0x0;var _0x29516a=_0x45b1[_0x1033d3];return _0x29516a;};'use strict';var _=require(_0x145b('0x0'));var rp=require('request-promise');var util=require(_0x145b('0x1'));var intUtil=require('./util');var md5=require('md5');var Redis=require(_0x145b('0x2'));var logger=require(_0x145b('0x3'))(_0x145b('0x4'));var config=require(_0x145b('0x5'));config['redis']=_[_0x145b('0x6')](config[_0x145b('0x7')],{'host':_0x145b('0x8'),'port':0x18eb});var io=require(_0x145b('0x9'))(new Redis(config['redis']));function getAuthToken(_0x20e05e,_0x22ba8f,_0x394bf4){if(_0x20e05e['modernAuthentication']){_0x20e05e[_0x145b('0xa')]=_0x20e05e[_0x145b('0xb')][_0x145b('0xc')];_0x20e05e[_0x145b('0xd')]=_0x20e05e[_0x145b('0xb')][_0x145b('0xe')];return Promise[_0x145b('0xf')](_0x20e05e[_0x145b('0xb')][_0x145b('0x10')]);}var _0x26d77c={'method':_0x145b('0x11'),'uri':_0x22ba8f,'form':{'client_id':_0x20e05e[_0x145b('0x12')],'resource':_0x20e05e[_0x145b('0xa')],'username':_0x20e05e[_0x145b('0x13')],'password':_0x20e05e[_0x145b('0x14')],'grant_type':_0x145b('0x14'),'client_secret':_0x20e05e[_0x145b('0x15')]},'json':!![]};return rp(_0x26d77c)[_0x145b('0x16')](function(_0x236946){return _0x236946[_0x145b('0x17')];})['catch'](function(_0x4a972b){logger[_0x145b('0x18')]('['+[_0x394bf4[_0x145b('0x19')]()]+_0x145b('0x1a'));return _0x4a972b['message'];});}function getUser(_0xb00d69,_0x91b59a,_0x12ed27,_0x498bb2,_0xf79cad,_0x400b7d){return new Promise(function(_0x27af7f,_0x144a77){return getAuthToken(_0x91b59a,_0x498bb2,_0x400b7d)[_0x145b('0x16')](function(_0x231ba2){var _0x248fa9={'method':'GET','uri':_0xf79cad+_0x145b('0x1b'),'headers':{'Authorization':_0x145b('0x1c')+_0x231ba2,'OData-Version':_0x145b('0x1d')},'json':!![]};return rp(_0x248fa9);})[_0x145b('0x16')](function(_0x47f1fe){var _0x41789a=_0x47f1fe[_0x145b('0x1e')];var _0x6a6502=![];var _0x44ef8c=null;if(!_['isNil'](_0x12ed27)){if(intUtil[_0x145b('0x1f')](_0x12ed27['email'])){_0xb00d69[_0x145b('0x20')]=_0x12ed27[_0x145b('0x21')];for(_0x44ef8c=0x0;_0x44ef8c<_0x41789a[_0x145b('0x22')];_0x44ef8c++){if(_0x41789a[_0x44ef8c][_0x145b('0x23')]===_0x12ed27[_0x145b('0x21')]&&!_0x41789a[_0x44ef8c][_0x145b('0x24')]){_0x6a6502=!![];logger[_0x145b('0x25')]('['+[_0x400b7d[_0x145b('0x19')]()]+_0x145b('0x26')+_0x41789a[_0x44ef8c]['systemuserid']+'!');_0xb00d69[_0x145b('0x27')]=_0x41789a[_0x44ef8c][_0x145b('0x28')];}}}}if(!_0x6a6502){logger['info']('['+[_0x400b7d[_0x145b('0x19')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0xb00d69['userEmail']=_0x91b59a[_0x145b('0x13')];for(_0x44ef8c=0x0;_0x44ef8c<_0x41789a[_0x145b('0x22')];_0x44ef8c++){if(_0x41789a[_0x44ef8c][_0x145b('0x23')]===_0x91b59a[_0x145b('0x13')]){_0xb00d69[_0x145b('0x27')]=_0x41789a[_0x44ef8c]['systemuserid'];}}}_0x27af7f(_0xb00d69);})[_0x145b('0x29')](function(_0x51ca70){_0x144a77(_0x51ca70['message']);});});}function createEndUser(_0x2e4b8d,_0x12ae62,_0x298164,_0x4ab12f,_0x46f68f,_0x6d9c66,_0x386ab7){return new Promise(function(_0x5c00d0,_0x48b3f6){return getAuthToken(_0x12ae62,_0x298164,_0x6d9c66)[_0x145b('0x16')](function(_0x202e8f){var _0x27e845=_0x6d9c66[_0x145b('0x2a')]()==='outbound'?_0x46f68f['destcalleridnum']:_0x46f68f[_0x145b('0x2b')];var _0x1b9f99={'method':_0x145b('0x11'),'uri':_0x4ab12f+'contacts','body':{'fullname':_0x27e845,'firstname':_0x27e845,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x2e4b8d[_0x145b('0x27')]+')'},'headers':{'Authorization':_0x145b('0x1c')+_0x202e8f,'OData-Version':_0x145b('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x1b9f99['body'][_0x386ab7]=_0x27e845;return rp(_0x1b9f99);})[_0x145b('0x16')](function(_0x4b7b39){var _0x172ac8=_0x4b7b39['headers'][_0x145b('0x2c')];var _0x236d25=_0x172ac8[_0x145b('0x2d')](_0x172ac8[_0x145b('0x2e')]('(')+0x1,_0x172ac8['lastIndexOf'](')'));_0x2e4b8d['enduserId']=_0x236d25;_0x5c00d0(_0x2e4b8d);})[_0x145b('0x29')](function(_0x55e0fe){_0x48b3f6(_0x55e0fe[_0x145b('0x2f')]);});});}function getEndUser(_0x362141,_0x4ec7bd,_0x3484b6,_0xfac5f5,_0x25a9d4,_0x3f93a6,_0x443c55,_0x5250c4){var _0x1379a7=_0x3f93a6[_0x145b('0x2a')]()===_0x145b('0x30')?_0x25a9d4[_0x145b('0x31')]:_0x25a9d4[_0x145b('0x2b')];return getAuthToken(_0x4ec7bd,_0x3484b6,_0x3f93a6)[_0x145b('0x16')](function(_0x2c5ae3){_0x5250c4=_0x5250c4?_0x5250c4:_0x145b('0x32');var _0x3daabd={'method':_0x145b('0x33'),'uri':_0xfac5f5+_0x145b('0x34')+_0x5250c4+_0x145b('0x35')+_0x5250c4+_0x145b('0x36')+_0x1379a7[_0x145b('0x37')]('+',_0x145b('0x38'))+'\x27','headers':{'Authorization':_0x145b('0x1c')+_0x2c5ae3,'If-None-Match':null,'OData-Version':_0x145b('0x1d')},'json':!![]};return rp(_0x3daabd);})[_0x145b('0x16')](function(_0x168106){var _0x495b2c=![];if(!_0x168106)return _0x495b2c;var _0x499408=_0x168106[_0x145b('0x1e')];for(var _0x298865=0x0;_0x298865<_0x499408[_0x145b('0x22')];_0x298865++){if(_0x499408[_0x298865][_0x5250c4]===_0x1379a7){_0x495b2c=!![];_0x362141[_0x145b('0x39')]=_0x499408[_0x298865][_0x145b('0x3a')];}}return _0x495b2c;})[_0x145b('0x16')](function(_0xe6ca02){if(_0xe6ca02)return _0x362141;if(_0x443c55==='nothing'){logger[_0x145b('0x25')]('['+[_0x3f93a6[_0x145b('0x19')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x362141;}return createEndUser(_0x362141,_0x4ec7bd,_0x3484b6,_0xfac5f5,_0x25a9d4,_0x3f93a6,_0x5250c4)[_0x145b('0x16')](function(_0xd3b098){logger['info']('['+[_0x3f93a6[_0x145b('0x19')]()]+']\x20Enduser\x20created!',_0xd3b098['enduserId']);return _0xd3b098;});});}function getCustomFields(_0x4b0e5f,_0xd5fa1a,_0x3e3ba9){var _0x3d49c3={};if(_0x4b0e5f[_0x145b('0x22')]>0x0){_[_0x145b('0x3b')](_0x4b0e5f,function(_0x4eed74){if(_[_0x145b('0x3c')]([_0x145b('0x3d'),_0x145b('0x3e')],_0x4eed74['type'])&&_0x4eed74[_0x145b('0x3f')]&&!_0x4eed74['customField']){var _0x1c9964=_0x4eed74[_0x145b('0x40')][_0x145b('0x2a')]();var _0x5bea55=_0x1c9964[_0x145b('0x2d')](0x0,_0x1c9964[_0x145b('0x41')]('_'));var _0x21ceb0=_0x1c9964[_0x145b('0x2d')](_0x1c9964[_0x145b('0x41')]('_')+0x1);if(_0x5bea55===_0x3e3ba9){_0x3d49c3[_0x21ceb0]=_0x4eed74[_0x145b('0x42')];}}});}return _0x3d49c3;}function getTicket(_0x55133d,_0x156a2a,_0x6514dc,_0x4ef1ef,_0x597acd,_0x49d80a,_0x33844b){return new Promise(function(_0x26fd4d,_0x4f802f){var _0x1aa144;return getAuthToken(_0x156a2a,_0x6514dc,_0x33844b)[_0x145b('0x16')](function(_0x4d38ea){if(_0x49d80a[_0x145b('0x43')]===_0x145b('0x44')){_0x1aa144={'method':'POST','uri':_0x4ef1ef+_0x145b('0x45'),'body':Object['assign']({},{'title':intUtil[_0x145b('0x46')](_0x49d80a[_0x145b('0x47')],_0x597acd,'\x20'),'description':intUtil[_0x145b('0x46')](_0x49d80a[_0x145b('0x48')],_0x597acd,'\x0a'),'customerid_contact@odata.bind':_0x55133d['enduserId']?'/contacts('+_0x55133d[_0x145b('0x39')]+')':undefined,'ownerid@odata.bind':_0x145b('0x49')+_0x55133d[_0x145b('0x27')]+')','caseorigincode':'1'},getCustomFields(_0x49d80a[_0x145b('0x4a')],_0x597acd,_0x49d80a[_0x145b('0x43')])),'headers':{'Authorization':'Bearer\x20'+_0x4d38ea,'OData-Version':_0x145b('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x49d80a[_0x145b('0x43')]==='phonecall'){var _0x4d9684=_0x55133d['enduserId']?[{'partyid_systemuser@odata.bind':_0x145b('0x49')+_0x55133d[_0x145b('0x27')]+')','participationtypemask':_0x55133d[_0x145b('0x4b')]===_0x145b('0x4c')?0x2:0x1},{'partyid_contact@odata.bind':_0x145b('0x4d')+_0x55133d[_0x145b('0x39')]+')','participationtypemask':_0x55133d[_0x145b('0x4b')]===_0x145b('0x4c')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x145b('0x49')+_0x55133d[_0x145b('0x27')]+')','participationtypemask':_0x55133d[_0x145b('0x4b')]===_0x145b('0x4c')?0x2:0x1}];_0x1aa144={'method':_0x145b('0x11'),'uri':_0x4ef1ef+_0x145b('0x4e'),'body':Object[_0x145b('0x4f')]({},{'subject':intUtil[_0x145b('0x46')](_0x49d80a[_0x145b('0x47')],_0x597acd,'\x20'),'phonenumber':String(_0x597acd[_0x145b('0x2b')]),'description':intUtil['getString'](_0x49d80a[_0x145b('0x48')],_0x597acd,'\x0a'),'regardingobjectid_contact@odata.bind':_0x55133d[_0x145b('0x39')]?_0x145b('0x4d')+_0x55133d[_0x145b('0x39')]+')':undefined,'ownerid@odata.bind':_0x145b('0x49')+_0x55133d[_0x145b('0x27')]+')','directioncode':_0x55133d['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':_0x4d9684},getCustomFields(_0x49d80a[_0x145b('0x4a')],_0x597acd,_0x49d80a['ticketType'])),'headers':{'Authorization':_0x145b('0x1c')+_0x4d38ea,'OData-Version':_0x145b('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1aa144);})[_0x145b('0x16')](function(_0x26f060){var _0x1a5255=_0x26f060[_0x145b('0x50')][_0x145b('0x2c')];var _0x2c5cb7=_0x1a5255[_0x145b('0x2d')](_0x1a5255[_0x145b('0x2e')]('(')+0x1,_0x1a5255['lastIndexOf'](')'));_0x55133d['ticketId']=_0x2c5cb7;_0x26fd4d(_0x55133d);})[_0x145b('0x29')](function(_0x4513a0){_0x4f802f(_0x4513a0[_0x145b('0x2f')]);});});}function emit(_0x58aa39,_0x1eace6,_0x2cd26d,_0x3a8b59){var _0xb45088={'uri':util[_0x145b('0x51')](_0x145b('0x52'),_0x58aa39,_0x2cd26d,_0x3a8b59)};io['to'](util[_0x145b('0x51')](_0x145b('0x53'),_0x1eace6))[_0x145b('0x54')](_0x145b('0x55'),_0xb45088);}exports['cs']=function(_0xa1860c,_0x2c2acc,_0x81949e,_0x6a924e,_0x203f1e,_0x36f30d,_0x336b30,_0x271472){var _0xe85fba={};_0x36f30d[_0x145b('0xa')]=_0x36f30d[_0x145b('0x56')]?intUtil[_0x145b('0x57')](_0x36f30d[_0x145b('0xb')]['data7']):intUtil[_0x145b('0x57')](_0x36f30d[_0x145b('0xa')]);_0x36f30d[_0x145b('0x58')]=intUtil[_0x145b('0x57')](_0x36f30d[_0x145b('0x58')]);_0xe85fba[_0x145b('0x4b')]=_0x271472===_0x145b('0x4c')||_0x271472===_0x145b('0x59')?_0x145b('0x4c'):_0x145b('0x30');var _0x356b83=_0x36f30d[_0x145b('0x56')]?util['format']('%s/api/data/v9.0/',_0x36f30d[_0x145b('0xb')][_0x145b('0xc')]):util[_0x145b('0x51')](_0x145b('0x5a'),_0x36f30d['remoteUri']);var _0x4c30de=util['format'](_0x145b('0x5b'),_0x36f30d[_0x145b('0xd')]);var _0x4e3596=util[_0x145b('0x51')](_0x145b('0x5c'),_0x36f30d[_0x145b('0x58')],_0x2c2acc[_0x145b('0x5d')],md5(_0x2c2acc[_0x145b('0x5d')]));if(_0x203f1e&&_0x203f1e[_0x145b('0x5e')]){logger[_0x145b('0x25')](_0x145b('0x5f'),_0x145b('0x60'));_0x2c2acc[_0x145b('0x61')]=_0x4e3596;}else if(_0x336b30&&_0x336b30['recordingFormat']&&_0x336b30[_0x145b('0x62')]!=='none'){logger['info'](_0x145b('0x63'),_0x145b('0x60'));_0x2c2acc[_0x145b('0x61')]=_0x4e3596;}else{_0x2c2acc[_0x145b('0x61')]='';}return getUser(_0xe85fba,_0x36f30d,_0x6a924e,_0x4c30de,_0x356b83,_0x271472)['then'](function(_0x327357){logger[_0x145b('0x25')]('['+_0x271472[_0x145b('0x19')]()+_0x145b('0x64'),_0x327357['userId']);logger[_0x145b('0x25')]('['+_0x271472['toUpperCase']()+_0x145b('0x65'),_0x327357[_0x145b('0x20')]);return getEndUser(_0x327357,_0x36f30d,_0x4c30de,_0x356b83,_0x2c2acc,_0x271472,_0x81949e[_0x145b('0x66')],_0x81949e[_0x145b('0x67')]);})[_0x145b('0x16')](function(_0x540856){logger[_0x145b('0x25')]('['+_0x271472[_0x145b('0x19')]()+_0x145b('0x68'),_0x540856['enduserId']);logger[_0x145b('0x25')]('['+_0x271472[_0x145b('0x19')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x2c2acc[_0x145b('0x2b')]);return getTicket(_0x540856,_0x36f30d,_0x4c30de,_0x356b83,_0x2c2acc,_0x81949e,_0x271472);})[_0x145b('0x16')](function(_0x12d679){logger[_0x145b('0x25')](util[_0x145b('0x51')]('['+_0x271472[_0x145b('0x19')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x81949e['ticketType'],_0x12d679[_0x145b('0x69')]));logger['info'](util[_0x145b('0x51')]('['+_0x271472[_0x145b('0x19')]()+_0x145b('0x6a'),_0x271472));if(_0x271472!==_0x145b('0x59')&&_0x81949e[_0x145b('0x6b')]){logger[_0x145b('0x25')]('['+_0x271472[_0x145b('0x19')]()+']',_0x145b('0x6c'));emit(_0x36f30d[_0x145b('0xa')],_0x6a924e[_0x145b('0x6d')],_0x81949e[_0x145b('0x43')],_0x12d679[_0x145b('0x69')]);}})[_0x145b('0x29')](function(_0x1f5777){logger[_0x145b('0x18')]('['+_0x271472[_0x145b('0x19')]()+_0x145b('0x6e'),_0x1f5777['message']);console[_0x145b('0x18')]('Error\x20running\x20Dynamics365\x20integration',_0x1f5777);});}; \ 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 3681586..9bcb5a2 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 _0x0146=['Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]','defaults','GET','map','forEach','includes','string','customField','nameField','toLowerCase','picklist','type','idField','custom_fields','push','content','variable','variableName','customVariable','Variable','queue','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridname','destcalleridnum','unmanaged','stripTrailingSlash','lastevent','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','redis','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','keyBy','format','%s/api/v2/tickets','then','Ticket\x20created!','%s/api/v2/agents','length','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone'];(function(_0x720b3b,_0x2f2144){var _0x161561=function(_0x418e24){while(--_0x418e24){_0x720b3b['push'](_0x720b3b['shift']());}};_0x161561(++_0x2f2144);}(_0x0146,0x94));var _0x6014=function(_0x3ccdf8,_0x584ceb){_0x3ccdf8=_0x3ccdf8-0x0;var _0x243dab=_0x0146[_0x3ccdf8];return _0x243dab;};'use strict';var _=require(_0x6014('0x0'));var rp=require(_0x6014('0x1'));var md5=require(_0x6014('0x2'));var util=require(_0x6014('0x3'));var Redis=require(_0x6014('0x4'));var intUtil=require(_0x6014('0x5'));var config=require(_0x6014('0x6'));var logger=require('../../../../config/logger')('freshdesk');config['redis']=_['defaults'](config[_0x6014('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x6014('0x8'))(new Redis(config[_0x6014('0x7')]));var headers={'Content-Type':_0x6014('0x9'),'Accept':_0x6014('0x9')};function emit(_0x71e261,_0x205925,_0x22d00c){io['to'](_0x71e261)['emit'](_0x205925,_0x22d00c);}function getTicket(_0x2ed1b8,_0x4ce74d,_0x3ae1c1,_0x659b90,_0x1aa87a){logger[_0x6014('0xa')](_0x6014('0xb'));var _0xacf9a8=_['merge']({'responder_id':_0x4ce74d['id'],'requester_id':_0x3ae1c1['id'],'name':util['format'](_0x6014('0xc'),_0x1aa87a[_0x6014('0xd')]),'phone':_0x1aa87a[_0x6014('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x6014('0xf')](_0x659b90[_0x6014('0x10')],_0x1aa87a,'\x20'),'description':intUtil[_0x6014('0xf')](_0x659b90[_0x6014('0x11')],_0x1aa87a,_0x6014('0x12')),'tags':getTags(_0x659b90[_0x6014('0x13')],_0x6014('0x14'))},getCustomFields(_0x659b90['Fields'],_0x1aa87a));_0xacf9a8['custom_fields']=_['mapValues'](_[_0x6014('0x15')](_0xacf9a8['custom_fields'],'id'),'value');return request({'uri':util[_0x6014('0x16')](_0x6014('0x17'),_0x2ed1b8['remoteUri']),'method':'POST','body':_0xacf9a8})[_0x6014('0x18')](function(_0x316831){logger['info'](_0x6014('0x19'));return _0x316831;});}function getUser(_0x3d7634,_0x4ef91e){if(intUtil['validateEmail'](_0x4ef91e)){return request({'uri':util['format'](_0x6014('0x1a'),_0x3d7634['remoteUri']),'qs':{'email':_0x4ef91e}})['then'](function(_0x2d96f5){if(_0x2d96f5[_0x6014('0x1b')]){logger[_0x6014('0xa')]('Agent\x20found!');return _[_0x6014('0x1c')](_0x2d96f5,function(_0x426c80){return _0x426c80[_0x6014('0x1d')]['email']===_0x4ef91e;});}else{logger['info'](_0x6014('0x1e'));return request({'uri':util['format'](_0x6014('0x1f'),_0x3d7634[_0x6014('0x20')])})[_0x6014('0x18')](function(_0x58df67){logger[_0x6014('0xa')]('Admin\x20account\x20selected.');return _0x58df67;});}});}else{logger[_0x6014('0xa')](_0x6014('0x21'));return request({'uri':util[_0x6014('0x16')]('%s/api/v2/agents/me',_0x3d7634[_0x6014('0x20')])})[_0x6014('0x18')](function(_0x1e9336){logger[_0x6014('0xa')](_0x6014('0x22'));return _0x1e9336;});}}function getEndUser(_0x4aa265,_0xa920cb,_0x2d6fd4){logger[_0x6014('0xa')](_0x6014('0x23'),_0x2d6fd4);return request({'uri':util[_0x6014('0x16')]('%s/api/v2/contacts',_0x4aa265['remoteUri']),'qs':{'phone':_0x2d6fd4}})[_0x6014('0x18')](function(_0x451303){if(_0x451303[_0x6014('0x1b')]){logger[_0x6014('0xa')](_0x6014('0x24'));return _['find'](_0x451303,{'phone':_0x2d6fd4});}else{logger[_0x6014('0xa')](_0x6014('0x25'));return request({'uri':util[_0x6014('0x16')]('%s/api/v2/contacts',_0x4aa265['remoteUri']),'method':_0x6014('0x26'),'body':{'name':_0xa920cb,'phone':_0x2d6fd4}})[_0x6014('0x18')](function(_0x17a5bd){logger[_0x6014('0xa')](_0x6014('0x27'));return _0x17a5bd;});}});}function getAuth(_0x30f178){return util[_0x6014('0x16')]('Basic\x20%s',new Buffer(_0x30f178[_0x6014('0x28')]+':X')[_0x6014('0x29')](_0x6014('0x2a')));}function request(_0x5e30dc){logger[_0x6014('0x2b')](_0x6014('0x2c'),JSON['stringify'](_0x5e30dc));return rp(_[_0x6014('0x2d')](_0x5e30dc,{'method':_0x6014('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0x2a8d62,_0x1e5b31){var _0x426c1e=[];if(_0x2a8d62&&_0x2a8d62[_0x6014('0x1b')]>0x0){_0x426c1e=_[_0x6014('0x2f')](_0x2a8d62,_0x1e5b31);}return _0x426c1e;}function getCustomFields(_0x96b5d0,_0x10c4b8){var _0x507d41=[];var _0x3099aa={'custom_fields':[]};if(_0x96b5d0[_0x6014('0x1b')]>0x0){_[_0x6014('0x30')](_0x96b5d0,function(_0x2720bf){if(_[_0x6014('0x31')]([_0x6014('0x32'),'picklist'],_0x2720bf['type'])&&_0x2720bf['nameField']&&!_0x2720bf[_0x6014('0x33')]){_0x3099aa[_0x2720bf[_0x6014('0x34')][_0x6014('0x35')]()]=_0x2720bf['content'][_0x6014('0x29')]();}else if(_[_0x6014('0x31')]([_0x6014('0x32'),_0x6014('0x36')],_0x2720bf[_0x6014('0x37')])&&_0x2720bf[_0x6014('0x38')]&&_0x2720bf['customField']){_0x3099aa[_0x6014('0x39')][_0x6014('0x3a')]({'id':_0x2720bf[_0x6014('0x38')],'value':_0x2720bf[_0x6014('0x3b')][_0x6014('0x29')]()});}else if(_0x2720bf[_0x6014('0x37')]===_0x6014('0x3c')&&_0x2720bf[_0x6014('0x3d')]&&_0x2720bf[_0x6014('0x38')]&&_0x2720bf[_0x6014('0x33')]){_0x10c4b8[_0x2720bf[_0x6014('0x3d')]]&&_0x3099aa[_0x6014('0x39')][_0x6014('0x3a')]({'id':_0x2720bf[_0x6014('0x38')],'value':_0x10c4b8[_0x2720bf[_0x6014('0x3d')]][_0x6014('0x29')]()});}else if(_0x2720bf[_0x6014('0x37')]===_0x6014('0x3e')&&_0x2720bf[_0x6014('0x3f')]&&_0x2720bf[_0x6014('0x3f')]['name']&&_0x2720bf[_0x6014('0x38')]&&_0x2720bf[_0x6014('0x33')]){_0x10c4b8[_0x2720bf['Variable']['name']['toLowerCase']()]&&_0x3099aa[_0x6014('0x39')][_0x6014('0x3a')]({'id':_0x2720bf[_0x6014('0x38')],'value':_0x10c4b8[_0x2720bf[_0x6014('0x3f')][_0x6014('0x14')][_0x6014('0x35')]()][_0x6014('0x29')]()});}});}return _0x3099aa;}exports[_0x6014('0x40')]=function(_0x9e16ae,_0x5355fe,_0x16ab1e,_0x27b886,_0x5202e7,_0x3c2c91){var _0x341e64,_0x186226;_0x3c2c91[_0x6014('0x20')]=intUtil['stripTrailingSlash'](_0x3c2c91[_0x6014('0x20')]);_0x3c2c91['serverUrl']=intUtil['stripTrailingSlash'](_0x3c2c91[_0x6014('0x41')]);if(_0x5202e7&&_0x5202e7[_0x6014('0x42')]){logger[_0x6014('0xa')](_0x6014('0x43'),_0x6014('0x44'));_0x5355fe[_0x6014('0x45')]=util[_0x6014('0x16')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c2c91[_0x6014('0x41')],_0x5355fe[_0x6014('0x46')],md5(_0x5355fe[_0x6014('0x46')]));}else{_0x5355fe['recordingURL']='';}headers['Authorization']=getAuth(_0x3c2c91);return getUser(_0x3c2c91,_0x27b886[_0x6014('0x47')])[_0x6014('0x18')](function(_0x679621){_0x341e64=_0x679621;logger[_0x6014('0xa')](_0x6014('0x48'),_0x341e64['id']);return getEndUser(_0x3c2c91,_0x5355fe[_0x6014('0xd')],_0x5355fe[_0x6014('0xe')]);})['then'](function(_0x869803){_0x186226=_0x869803;logger[_0x6014('0xa')](_0x6014('0x49'),_0x186226['id']);return getTicket(_0x3c2c91,_0x341e64,_0x186226,_0x16ab1e,_0x5355fe);})[_0x6014('0x18')](function(_0x5c8977){if(_0x5c8977&&_0x5c8977['id']){logger[_0x6014('0xa')]('Ticket\x20created!');logger['info'](_0x6014('0x4a'),_0x5c8977['id']);logger[_0x6014('0xa')]('[QUEUE]',_0x6014('0x4b'));emit(util['format'](_0x6014('0x4c'),_0x27b886['name']),_0x6014('0x4d'),{'uri':util['format'](_0x6014('0x4e'),_0x3c2c91[_0x6014('0x20')],_0x5c8977['id'])});}})[_0x6014('0x4f')](function(_0x3d9699){logger[_0x6014('0x50')]('[QUEUE]',JSON[_0x6014('0x51')](_0x3d9699));});};exports[_0x6014('0x52')]=function(_0x3b4bb0,_0xaef8d2,_0x5a69e2,_0x30ed01,_0xd3cb69,_0x44cf66,_0x15fafd){var _0x4c6dd8,_0x1be4c0;_0x44cf66[_0x6014('0x20')]=intUtil['stripTrailingSlash'](_0x44cf66['remoteUri']);_0x44cf66[_0x6014('0x41')]=intUtil['stripTrailingSlash'](_0x44cf66[_0x6014('0x41')]);if(_0x15fafd&&_0x15fafd[_0x6014('0x53')]&&_0x15fafd['recordingFormat']!==_0x6014('0x54')){logger[_0x6014('0xa')]('[OUTBOUND]',_0x6014('0x44'));_0xaef8d2['recordingURL']=util[_0x6014('0x16')](_0x6014('0x55'),_0x44cf66[_0x6014('0x41')],_0xaef8d2['uniqueid'],md5(_0xaef8d2[_0x6014('0x46')]));}headers[_0x6014('0x56')]=getAuth(_0x44cf66);return getUser(_0x44cf66,_0x30ed01[_0x6014('0x47')])[_0x6014('0x18')](function(_0x48b701){_0x4c6dd8=_0x48b701;logger[_0x6014('0xa')](_0x6014('0x48'),_0x4c6dd8['id']);return getEndUser(_0x44cf66,_0xaef8d2[_0x6014('0x57')],_0xaef8d2[_0x6014('0x58')]);})[_0x6014('0x18')](function(_0x3bf58d){_0x1be4c0=_0x3bf58d;logger[_0x6014('0xa')]('The\x20Enduser\x20ID\x20is:',_0x1be4c0['id']);return getTicket(_0x44cf66,_0x4c6dd8,_0x1be4c0,_0x5a69e2,_0xaef8d2);})['then'](function(_0x1b9516){if(_0x1b9516&&_0x1b9516['id']){logger[_0x6014('0xa')]('Ticket\x20created!');logger[_0x6014('0xa')]('The\x20Ticket\x20ID\x20is:',_0x1b9516['id']);logger['info']('[OUTBOUND]',_0x6014('0x4b'));emit(util[_0x6014('0x16')](_0x6014('0x4c'),_0x30ed01['name']),_0x6014('0x4d'),{'uri':util['format'](_0x6014('0x4e'),_0x44cf66[_0x6014('0x20')],_0x1b9516['id'])});}})[_0x6014('0x4f')](function(_0x288930){logger['error']('[OUTBOUND]',JSON['stringify'](_0x288930));});};exports[_0x6014('0x59')]=function(_0x20c4b0,_0xfdeebd,_0x56914d,_0x1434e1,_0x16d0e5,_0x352ae9){var _0xb62be7,_0x4e9c12;_0x352ae9[_0x6014('0x20')]=intUtil[_0x6014('0x5a')](_0x352ae9['remoteUri']);_0x352ae9[_0x6014('0x41')]=intUtil[_0x6014('0x5a')](_0x352ae9['serverUrl']);if(_0x16d0e5&&_0x16d0e5['monitor_format']){logger[_0x6014('0xa')]('['+_0xfdeebd[_0x6014('0x5b')]['toUpperCase']()+']',_0x6014('0x44'));_0xfdeebd[_0x6014('0x45')]=util[_0x6014('0x16')](_0x6014('0x55'),_0x352ae9[_0x6014('0x41')],_0xfdeebd[_0x6014('0x46')],md5(_0xfdeebd[_0x6014('0x46')]));}else{_0xfdeebd[_0x6014('0x45')]='';}headers['Authorization']=getAuth(_0x352ae9);return getUser(_0x352ae9,'')[_0x6014('0x18')](function(_0x1aea13){_0xb62be7=_0x1aea13;logger['info'](_0x6014('0x48'),_0xb62be7['id']);return getEndUser(_0x352ae9,_0xfdeebd[_0x6014('0xd')],_0xfdeebd[_0x6014('0xe')]);})[_0x6014('0x18')](function(_0x430a1d){_0x4e9c12=_0x430a1d;logger[_0x6014('0xa')](_0x6014('0x49'),_0x4e9c12['id']);return getTicket(_0x352ae9,_0xb62be7,_0x4e9c12,_0x56914d,_0xfdeebd);})[_0x6014('0x18')](function(_0x4087a9){if(_0x4087a9){logger[_0x6014('0xa')](_0x6014('0x19'));logger[_0x6014('0xa')](_0x6014('0x4a'),_0x4087a9['id']);}})[_0x6014('0x4f')](function(_0x1983d9){logger['error']('['+_0xfdeebd[_0x6014('0x5b')]['toUpperCase']()+']',JSON['stringify'](_0x1983d9));});}; \ No newline at end of file +var _0x08d0=['%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','POST','Enduser\x20created.','apiKey','toString','base64','debug','stringify','defaults','GET','map','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','push','variableName','customVariable','name','Variable','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','unmanaged','lastevent','toUpperCase','error','lodash','request-promise','md5','ioredis','./util','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','
','Tags','Fields','custom_fields','mapValues','keyBy','value'];(function(_0x527fd3,_0x3c9671){var _0x399389=function(_0x31eb27){while(--_0x31eb27){_0x527fd3['push'](_0x527fd3['shift']());}};_0x399389(++_0x3c9671);}(_0x08d0,0x9c));var _0x008d=function(_0x2818d5,_0x5eea29){_0x2818d5=_0x2818d5-0x0;var _0xf68add=_0x08d0[_0x2818d5];return _0xf68add;};'use strict';var _=require(_0x008d('0x0'));var rp=require(_0x008d('0x1'));var md5=require(_0x008d('0x2'));var util=require('util');var Redis=require(_0x008d('0x3'));var intUtil=require(_0x008d('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x008d('0x5'));config[_0x008d('0x6')]=_['defaults'](config['redis'],{'host':_0x008d('0x7'),'port':0x18eb});var io=require(_0x008d('0x8'))(new Redis(config[_0x008d('0x6')]));var headers={'Content-Type':_0x008d('0x9'),'Accept':_0x008d('0x9')};function emit(_0x3b44c6,_0x58bce7,_0x413a21){io['to'](_0x3b44c6)[_0x008d('0xa')](_0x58bce7,_0x413a21);}function getTicket(_0x153975,_0x3c1a88,_0x8d7215,_0x3f652c,_0x36d6f6){logger[_0x008d('0xb')](_0x008d('0xc'));var _0x4a1854=_[_0x008d('0xd')]({'responder_id':_0x3c1a88['id'],'requester_id':_0x8d7215['id'],'name':util[_0x008d('0xe')](_0x008d('0xf'),_0x36d6f6[_0x008d('0x10')]),'phone':_0x36d6f6[_0x008d('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x008d('0x12')](_0x3f652c['Subjects'],_0x36d6f6,'\x20'),'description':intUtil[_0x008d('0x12')](_0x3f652c['Descriptions'],_0x36d6f6,_0x008d('0x13')),'tags':getTags(_0x3f652c[_0x008d('0x14')],'name')},getCustomFields(_0x3f652c[_0x008d('0x15')],_0x36d6f6));_0x4a1854[_0x008d('0x16')]=_[_0x008d('0x17')](_[_0x008d('0x18')](_0x4a1854['custom_fields'],'id'),_0x008d('0x19'));return request({'uri':util[_0x008d('0xe')](_0x008d('0x1a'),_0x153975[_0x008d('0x1b')]),'method':'POST','body':_0x4a1854})[_0x008d('0x1c')](function(_0x52fa42){logger[_0x008d('0xb')](_0x008d('0x1d'));return _0x52fa42;});}function getUser(_0x51a56b,_0x321655){if(intUtil[_0x008d('0x1e')](_0x321655)){return request({'uri':util[_0x008d('0xe')](_0x008d('0x1f'),_0x51a56b[_0x008d('0x1b')]),'qs':{'email':_0x321655}})[_0x008d('0x1c')](function(_0x361dac){if(_0x361dac[_0x008d('0x20')]){logger[_0x008d('0xb')](_0x008d('0x21'));return _[_0x008d('0x22')](_0x361dac,function(_0x505eb4){return _0x505eb4[_0x008d('0x23')][_0x008d('0x24')]===_0x321655;});}else{logger[_0x008d('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/api/v2/agents/me',_0x51a56b[_0x008d('0x1b')])})[_0x008d('0x1c')](function(_0x1c47c7){logger[_0x008d('0xb')](_0x008d('0x25'));return _0x1c47c7;});}});}else{logger[_0x008d('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x008d('0xe')]('%s/api/v2/agents/me',_0x51a56b[_0x008d('0x1b')])})[_0x008d('0x1c')](function(_0x74c51d){logger['info'](_0x008d('0x25'));return _0x74c51d;});}}function getEndUser(_0x3d4c21,_0x2df696,_0x5444c3){logger[_0x008d('0xb')]('Searching\x20enduser\x20with\x20phone',_0x5444c3);return request({'uri':util[_0x008d('0xe')](_0x008d('0x26'),_0x3d4c21[_0x008d('0x1b')]),'qs':{'phone':_0x5444c3}})[_0x008d('0x1c')](function(_0xdbda5d){if(_0xdbda5d['length']){logger[_0x008d('0xb')](_0x008d('0x27'));return _[_0x008d('0x22')](_0xdbda5d,{'phone':_0x5444c3});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x008d('0x26'),_0x3d4c21[_0x008d('0x1b')]),'method':_0x008d('0x28'),'body':{'name':_0x2df696,'phone':_0x5444c3}})[_0x008d('0x1c')](function(_0x56979a){logger['info'](_0x008d('0x29'));return _0x56979a;});}});}function getAuth(_0x478307){return util[_0x008d('0xe')]('Basic\x20%s',new Buffer(_0x478307[_0x008d('0x2a')]+':X')[_0x008d('0x2b')](_0x008d('0x2c')));}function request(_0x6f3e86){logger[_0x008d('0x2d')]('[HTTP]',JSON[_0x008d('0x2e')](_0x6f3e86));return rp(_[_0x008d('0x2f')](_0x6f3e86,{'method':_0x008d('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x545893,_0x613016){var _0x445365=[];if(_0x545893&&_0x545893[_0x008d('0x20')]>0x0){_0x445365=_[_0x008d('0x31')](_0x545893,_0x613016);}return _0x445365;}function getCustomFields(_0x418767,_0x590109){var _0x1a7bce=[];var _0x13726c={'custom_fields':[]};if(_0x418767[_0x008d('0x20')]>0x0){_['forEach'](_0x418767,function(_0x11ca5b){if(_[_0x008d('0x32')]([_0x008d('0x33'),_0x008d('0x34')],_0x11ca5b[_0x008d('0x35')])&&_0x11ca5b[_0x008d('0x36')]&&!_0x11ca5b[_0x008d('0x37')]){_0x13726c[_0x11ca5b['nameField'][_0x008d('0x38')]()]=_0x11ca5b[_0x008d('0x39')][_0x008d('0x2b')]();}else if(_[_0x008d('0x32')]([_0x008d('0x33'),_0x008d('0x34')],_0x11ca5b[_0x008d('0x35')])&&_0x11ca5b[_0x008d('0x3a')]&&_0x11ca5b['customField']){_0x13726c['custom_fields'][_0x008d('0x3b')]({'id':_0x11ca5b[_0x008d('0x3a')],'value':_0x11ca5b['content'][_0x008d('0x2b')]()});}else if(_0x11ca5b[_0x008d('0x35')]==='variable'&&_0x11ca5b[_0x008d('0x3c')]&&_0x11ca5b[_0x008d('0x3a')]&&_0x11ca5b[_0x008d('0x37')]){_0x590109[_0x11ca5b[_0x008d('0x3c')]]&&_0x13726c['custom_fields'][_0x008d('0x3b')]({'id':_0x11ca5b[_0x008d('0x3a')],'value':_0x590109[_0x11ca5b[_0x008d('0x3c')]][_0x008d('0x2b')]()});}else if(_0x11ca5b['type']===_0x008d('0x3d')&&_0x11ca5b['Variable']&&_0x11ca5b['Variable'][_0x008d('0x3e')]&&_0x11ca5b[_0x008d('0x3a')]&&_0x11ca5b[_0x008d('0x37')]){_0x590109[_0x11ca5b[_0x008d('0x3f')][_0x008d('0x3e')][_0x008d('0x38')]()]&&_0x13726c[_0x008d('0x16')][_0x008d('0x3b')]({'id':_0x11ca5b[_0x008d('0x3a')],'value':_0x590109[_0x11ca5b[_0x008d('0x3f')][_0x008d('0x3e')][_0x008d('0x38')]()][_0x008d('0x2b')]()});}});}return _0x13726c;}exports[_0x008d('0x40')]=function(_0x439bb8,_0x18345a,_0x1839ec,_0x3d225c,_0x94e6b0,_0x165929){var _0x4f6681,_0x2de7f6;_0x165929[_0x008d('0x1b')]=intUtil[_0x008d('0x41')](_0x165929[_0x008d('0x1b')]);_0x165929['serverUrl']=intUtil[_0x008d('0x41')](_0x165929['serverUrl']);if(_0x94e6b0&&_0x94e6b0[_0x008d('0x42')]){logger[_0x008d('0xb')](_0x008d('0x43'),_0x008d('0x44'));_0x18345a[_0x008d('0x45')]=util[_0x008d('0xe')](_0x008d('0x46'),_0x165929[_0x008d('0x47')],_0x18345a[_0x008d('0x48')],md5(_0x18345a['uniqueid']));}else{_0x18345a[_0x008d('0x45')]='';}headers[_0x008d('0x49')]=getAuth(_0x165929);return getUser(_0x165929,_0x3d225c[_0x008d('0x24')])[_0x008d('0x1c')](function(_0x384933){_0x4f6681=_0x384933;logger['info'](_0x008d('0x4a'),_0x4f6681['id']);return getEndUser(_0x165929,_0x18345a[_0x008d('0x10')],_0x18345a[_0x008d('0x11')]);})[_0x008d('0x1c')](function(_0x5c3dcd){_0x2de7f6=_0x5c3dcd;logger[_0x008d('0xb')](_0x008d('0x4b'),_0x2de7f6['id']);return getTicket(_0x165929,_0x4f6681,_0x2de7f6,_0x1839ec,_0x18345a);})['then'](function(_0x49f617){if(_0x49f617&&_0x49f617['id']){logger['info'](_0x008d('0x1d'));logger[_0x008d('0xb')](_0x008d('0x4c'),_0x49f617['id']);logger['info'](_0x008d('0x43'),_0x008d('0x4d'));emit(util[_0x008d('0xe')](_0x008d('0x4e'),_0x3d225c[_0x008d('0x3e')]),_0x008d('0x4f'),{'uri':util[_0x008d('0xe')](_0x008d('0x50'),_0x165929[_0x008d('0x1b')],_0x49f617['id'])});}})[_0x008d('0x51')](function(_0x1abeb2){logger['error']('[QUEUE]',JSON[_0x008d('0x2e')](_0x1abeb2));});};exports[_0x008d('0x52')]=function(_0x4dba3d,_0x142c58,_0x8bb4fd,_0x4bf7ed,_0x33d02b,_0x45dd07,_0x5444b5){var _0x32aae3,_0x4085b6;_0x45dd07['remoteUri']=intUtil[_0x008d('0x41')](_0x45dd07[_0x008d('0x1b')]);_0x45dd07[_0x008d('0x47')]=intUtil[_0x008d('0x41')](_0x45dd07[_0x008d('0x47')]);if(_0x5444b5&&_0x5444b5[_0x008d('0x53')]&&_0x5444b5['recordingFormat']!==_0x008d('0x54')){logger[_0x008d('0xb')](_0x008d('0x55'),_0x008d('0x44'));_0x142c58[_0x008d('0x45')]=util[_0x008d('0xe')](_0x008d('0x46'),_0x45dd07[_0x008d('0x47')],_0x142c58[_0x008d('0x48')],md5(_0x142c58[_0x008d('0x48')]));}headers[_0x008d('0x49')]=getAuth(_0x45dd07);return getUser(_0x45dd07,_0x4bf7ed['email'])[_0x008d('0x1c')](function(_0x13c45e){_0x32aae3=_0x13c45e;logger['info'](_0x008d('0x4a'),_0x32aae3['id']);return getEndUser(_0x45dd07,_0x142c58['destcalleridname'],_0x142c58[_0x008d('0x56')]);})[_0x008d('0x1c')](function(_0x104a2f){_0x4085b6=_0x104a2f;logger[_0x008d('0xb')]('The\x20Enduser\x20ID\x20is:',_0x4085b6['id']);return getTicket(_0x45dd07,_0x32aae3,_0x4085b6,_0x8bb4fd,_0x142c58);})[_0x008d('0x1c')](function(_0x28b98b){if(_0x28b98b&&_0x28b98b['id']){logger[_0x008d('0xb')](_0x008d('0x1d'));logger[_0x008d('0xb')](_0x008d('0x4c'),_0x28b98b['id']);logger['info']('[OUTBOUND]',_0x008d('0x4d'));emit(util['format']('user:%s',_0x4bf7ed[_0x008d('0x3e')]),_0x008d('0x4f'),{'uri':util[_0x008d('0xe')](_0x008d('0x50'),_0x45dd07[_0x008d('0x1b')],_0x28b98b['id'])});}})['catch'](function(_0x3e459c){logger['error'](_0x008d('0x55'),JSON[_0x008d('0x2e')](_0x3e459c));});};exports[_0x008d('0x57')]=function(_0x5e8032,_0x5a058f,_0x3153a1,_0x160200,_0x5c31fa,_0x2eb654){var _0x443348,_0xce4a59;_0x2eb654[_0x008d('0x1b')]=intUtil[_0x008d('0x41')](_0x2eb654[_0x008d('0x1b')]);_0x2eb654['serverUrl']=intUtil[_0x008d('0x41')](_0x2eb654[_0x008d('0x47')]);if(_0x5c31fa&&_0x5c31fa[_0x008d('0x42')]){logger[_0x008d('0xb')]('['+_0x5a058f[_0x008d('0x58')][_0x008d('0x59')]()+']','Recording\x20is\x20enabled!');_0x5a058f[_0x008d('0x45')]=util[_0x008d('0xe')](_0x008d('0x46'),_0x2eb654['serverUrl'],_0x5a058f[_0x008d('0x48')],md5(_0x5a058f[_0x008d('0x48')]));}else{_0x5a058f['recordingURL']='';}headers[_0x008d('0x49')]=getAuth(_0x2eb654);return getUser(_0x2eb654,'')[_0x008d('0x1c')](function(_0x12139b){_0x443348=_0x12139b;logger[_0x008d('0xb')](_0x008d('0x4a'),_0x443348['id']);return getEndUser(_0x2eb654,_0x5a058f[_0x008d('0x10')],_0x5a058f[_0x008d('0x11')]);})['then'](function(_0x27c8a6){_0xce4a59=_0x27c8a6;logger[_0x008d('0xb')](_0x008d('0x4b'),_0xce4a59['id']);return getTicket(_0x2eb654,_0x443348,_0xce4a59,_0x3153a1,_0x5a058f);})[_0x008d('0x1c')](function(_0x415100){if(_0x415100){logger[_0x008d('0xb')](_0x008d('0x1d'));logger[_0x008d('0xb')](_0x008d('0x4c'),_0x415100['id']);}})['catch'](function(_0x4fe905){logger[_0x008d('0x5a')]('['+_0x5a058f['lastevent'][_0x008d('0x59')]()+']',JSON['stringify'](_0x4fe905));});}; \ 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 fb64a1d..c5c785c 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 _0xde4f=['contactNumber','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','POST','/api/tasks','getString','Subjects','Descriptions','add','ticketId','Task\x20created:','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','toLowerCase','destcalleridnum','calleridnum','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','bluebird','./util','../../../../config/environment','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','then','users','length','email','adminEmail','adminId','info','Requested\x20Resource\x20not\x20Found','toUpperCase','message','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','catch','error','/api/lookup?q=','&f=','find','contacts','format','mobile_number','endUserId','work_number'];(function(_0x5985d4,_0x53ad38){var _0x891b09=function(_0x5fc0e7){while(--_0x5fc0e7){_0x5985d4['push'](_0x5985d4['shift']());}};_0x891b09(++_0x53ad38);}(_0xde4f,0xc2));var _0xfde4=function(_0x481502,_0x234bba){_0x481502=_0x481502-0x0;var _0x210cf0=_0xde4f[_0x481502];return _0x210cf0;};'use strict';var _=require(_0xfde4('0x0'));var rp=require(_0xfde4('0x1'));var md5=require('md5');var util=require(_0xfde4('0x2'));var moment=require('moment');var Promise=require(_0xfde4('0x3'));var Redis=require('ioredis');var intUtil=require(_0xfde4('0x4'));var config=require(_0xfde4('0x5'));var logger=require('../../../../config/logger')('freshsales');config[_0xfde4('0x6')]=_['defaults'](config[_0xfde4('0x6')],{'host':_0xfde4('0x7'),'port':0x18eb});var io=require(_0xfde4('0x8'))(new Redis(config[_0xfde4('0x6')]));function getAdminId(_0x4b737e,_0x39379d,_0x32f699,_0x1cf45d){return new Promise(function(_0x478652,_0x46f94a){var _0x1409a0=![];var _0xee8232={'method':_0xfde4('0x9'),'uri':_0x1cf45d+_0xfde4('0xa'),'json':!![]};_0xee8232[_0xfde4('0xb')]=_0x32f699;logger['info']('Getting\x20admin\x20information');return rp(_0xee8232)[_0xfde4('0xc')](function(_0x2b834f){if(_0x2b834f){var _0x275b28=_0x2b834f[_0xfde4('0xd')];var _0x4b7420=null;for(_0x4b7420=0x0;_0x4b7420<_0x275b28[_0xfde4('0xe')];_0x4b7420++){if(_0x275b28[_0x4b7420][_0xfde4('0xf')]===_0x4b737e[_0xfde4('0x10')]){_0x4b737e[_0xfde4('0x11')]=_0x275b28[_0x4b7420]['id'];_0x1409a0=!![];}}if(_0x1409a0){logger[_0xfde4('0x12')]('Admin\x20found:',_0x4b737e['adminId']);_0x478652(_0x4b737e);}else{_0x46f94a({'statusCode':0x194,'message':_0xfde4('0x13')});}}else{_0x46f94a({'statusCode':0x194,'message':_0xfde4('0x13')});}})['catch'](function(_0x3f4d2e){logger['error']('['+[_0x39379d[_0xfde4('0x14')]()]+']',_0x3f4d2e[_0xfde4('0x15')]);_0x46f94a(_0x3f4d2e);});});}function getUser(_0x3075b9,_0x29d1e2,_0x40cbc8){return function(_0xfdcb6b){return new Promise(function(_0x1bf3e5,_0x1084c5){var _0x7e25a7={'method':_0xfde4('0x9'),'uri':_0x40cbc8+'/api/selector/owners','json':!![]};_0x7e25a7['headers']=_0x29d1e2;logger['info']('Getting\x20user\x20list');return rp(_0x7e25a7)[_0xfde4('0xc')](function(_0x494b6a){if(_0x494b6a){var _0xbb8912=_0x494b6a[_0xfde4('0xd')];var _0xf84146=![];var _0x11cd61=null;if(_0xfdcb6b[_0xfde4('0x16')]!==null){logger[_0xfde4('0x12')](_0xfde4('0x17'),_0xfdcb6b[_0xfde4('0x16')]);_0xfdcb6b[_0xfde4('0x18')]=_0xfdcb6b[_0xfde4('0x16')];for(_0x11cd61=0x0;_0x11cd61<_0xbb8912[_0xfde4('0xe')];_0x11cd61++){if(_0xbb8912[_0x11cd61][_0xfde4('0xf')]===_0xfdcb6b[_0xfde4('0x16')]){_0xf84146=!![];_0xfdcb6b[_0xfde4('0x19')]=_0xbb8912[_0x11cd61]['id'];logger[_0xfde4('0x12')](_0xfde4('0x1a'),_0xfdcb6b['userId']);}}}if(!_0xf84146){logger[_0xfde4('0x12')]('Admin\x20selected');_0xfdcb6b['userEmail']=_0xfdcb6b[_0xfde4('0x10')];_0xfdcb6b[_0xfde4('0x19')]=_0xfdcb6b['adminId'];_0xf84146=!![];}if(_0xf84146){_0x1bf3e5(_0xfdcb6b);}else{_0x1084c5({'statusCode':0x194,'message':_0xfde4('0x13')});}}else{_0x1084c5({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xfde4('0x1b')](function(_0x381546){logger[_0xfde4('0x1c')]('['+[_0x3075b9[_0xfde4('0x14')]()]+']',_0x381546[_0xfde4('0x15')]);_0x1084c5(_0x381546);});});};}function searchContact(_0x3245d1,_0x23a8c6,_0x383c21,_0x3e1fa7){return new Promise(function(_0x38793c,_0x29cdc7){var _0x74b88d={'method':'GET','headers':_0x23a8c6,'uri':_0x3245d1+_0xfde4('0x1d')+_0x3e1fa7+_0xfde4('0x1e')+_0x383c21+'&entities=contact','json':!![]};rp(_0x74b88d)[_0xfde4('0xc')](function(_0x39576c){var _0x227321=_[_0xfde4('0x1f')](_0x39576c['contacts'][_0xfde4('0x20')],[_0x383c21,_0x3e1fa7]);_0x38793c(_0x227321);})[_0xfde4('0x1b')](function(_0x45544c){_0x29cdc7(_0x45544c);});});}function getEndUser(_0x2504c6,_0x256f87,_0x55743a){return function(_0x2ce08f){return new Promise(function(_0xcf5d6,_0x4c6071){logger[_0xfde4('0x12')](util[_0xfde4('0x21')]('Searching\x20contact\x20with\x20phone\x20%s',_0x2ce08f['contactNumber']));searchContact(_0x55743a,_0x256f87,_0xfde4('0x22'),_0x2ce08f['contactNumber'])[_0xfde4('0xc')](function(_0x199fdc){if(_0x199fdc){_0x2ce08f[_0xfde4('0x23')]=_0x199fdc['id'];logger['info']('Contact\x20found\x20mobile_number:',_0x2ce08f[_0xfde4('0x23')]);return _0xcf5d6(_0x2ce08f);}searchContact(_0x55743a,_0x256f87,_0xfde4('0x24'),_0x2ce08f[_0xfde4('0x25')])[_0xfde4('0xc')](function(_0x13e550){if(_0x13e550){_0x2ce08f['endUserId']=_0x13e550['id'];logger[_0xfde4('0x12')](_0xfde4('0x26'),_0x2ce08f[_0xfde4('0x23')]);return _0xcf5d6(_0x2ce08f);}createEndUser(_0x2ce08f,_0x2504c6,_0x256f87,_0x55743a)[_0xfde4('0xc')](function(_0x15f6ff){logger[_0xfde4('0x12')](_0xfde4('0x27'),_0x15f6ff[_0xfde4('0x23')]);return _0xcf5d6(_0x15f6ff);});});})[_0xfde4('0x1b')](function(_0x26fd25){_0x4c6071(_0x26fd25);});});};}function createEndUser(_0x2899e7,_0x5bef35,_0x3f078a,_0x1d96b1){return new Promise(function(_0x19b7e9,_0x43abd6){var _0xfaac56=moment();var _0x494525={'method':'POST','uri':_0x1d96b1+_0xfde4('0x28'),'body':{'contact':{'last_name':_0x2899e7[_0xfde4('0x25')],'work_number':_0x2899e7[_0xfde4('0x25')],'mobile_number':_0x2899e7['contactNumber'],'owner_id':_0x2899e7['userId'],'created_at':_0xfaac56[_0xfde4('0x21')](_0xfde4('0x29'))}},'json':!![]};_0x494525[_0xfde4('0xb')]=_0x3f078a;logger[_0xfde4('0x12')](_0xfde4('0x2a'));return rp(_0x494525)[_0xfde4('0xc')](function(_0x135124){_0x2899e7['endUserId']=_0x135124[_0xfde4('0x2b')]['id'];_0x19b7e9(_0x2899e7);})['catch'](function(_0x251f78){logger['error']('['+[_0x5bef35[_0xfde4('0x14')]()]+']',_0x251f78[_0xfde4('0x15')]);_0x43abd6(_0x251f78[_0xfde4('0x15')]);});});}function getTicket(_0x257d98,_0x1f3190,_0x1174eb,_0x449795,_0x1c9415){return function(_0xe9e14e){logger[_0xfde4('0x12')]('Creating\x20new\x20task');return new Promise(function(_0x3bad94,_0x3574c9){var _0x55c100=moment();var _0x4ce248={'method':_0xfde4('0x2c'),'uri':_0x1174eb+_0xfde4('0x2d'),'body':{'title':intUtil[_0xfde4('0x2e')](_0x449795[_0xfde4('0x2f')],_0x1c9415,'\x20'),'description':intUtil[_0xfde4('0x2e')](_0x449795[_0xfde4('0x30')],_0x1c9415,'\x0a'),'owner_id':_0xe9e14e[_0xfde4('0x19')],'creater_id':_0xe9e14e[_0xfde4('0x11')],'targetable_id':_0xe9e14e['endUserId'],'targetable_type':'Contact','created_at':_0x55c100[_0xfde4('0x21')](_0xfde4('0x29')),'due_date':_0x55c100[_0xfde4('0x31')](0x1e,'m')[_0xfde4('0x21')](_0xfde4('0x29'))},'json':!![]};_0x4ce248[_0xfde4('0xb')]=_0x1f3190;return rp(_0x4ce248)[_0xfde4('0xc')](function(_0x3dd168){_0xe9e14e[_0xfde4('0x32')]=_0x3dd168['task']['id'];logger[_0xfde4('0x12')](_0xfde4('0x33'),_0xe9e14e[_0xfde4('0x32')]);_0x3bad94(_0xe9e14e);})[_0xfde4('0x1b')](function(_0x1a23a3){logger[_0xfde4('0x1c')]('['+[_0x257d98[_0xfde4('0x14')]()]+']',_0x1a23a3[_0xfde4('0x15')]);_0x3574c9(_0x1a23a3['message']);});});};}function emit(_0xb30e47,_0x34d953,_0x1d36ef){var _0x3b6e4c={'uri':_0xb30e47+'/contacts/'+_0x1d36ef};io['to'](util[_0xfde4('0x21')]('user:%s',_0x34d953))[_0xfde4('0x34')](_0xfde4('0x35'),_0x3b6e4c);}exports['cs']=function(_0x29e000,_0x8f9353,_0x4a1e20,_0xa3da26,_0x5a504a,_0x3200b3,_0x52dc4a,_0x3d8f11){var _0x3d9192={};var _0x24db90={'Authorization':_0xfde4('0x36')+_0x3200b3[_0xfde4('0x37')]};_0x3200b3['remoteUri']=intUtil[_0xfde4('0x38')](_0x3200b3[_0xfde4('0x39')]);_0x3200b3['serverUrl']=intUtil[_0xfde4('0x38')](_0x3200b3[_0xfde4('0x3a')]);var _0x26b400=_0x3200b3[_0xfde4('0x39')];_0x3d9192[_0xfde4('0x10')]=_0x3200b3['username'];_0x3d9192[_0xfde4('0x25')]=_0x3d8f11[_0xfde4('0x3b')]()==='outbound'?_0x8f9353[_0xfde4('0x3c')]:_0x8f9353[_0xfde4('0x3d')];_0x3d9192['callDirection']=_0x3d8f11===_0xfde4('0x3e')||_0x3d8f11===_0xfde4('0x3f')?_0xfde4('0x3e'):_0xfde4('0x40');if(_0xa3da26){_0x3d9192[_0xfde4('0x16')]=_0xa3da26[_0xfde4('0xf')];}var _0x539c9a=util['format'](_0xfde4('0x41'),_0x3200b3[_0xfde4('0x3a')],_0x8f9353[_0xfde4('0x42')],md5(_0x8f9353[_0xfde4('0x42')]));if(_0x5a504a&&_0x5a504a['monitor_format']){logger[_0xfde4('0x12')](_0xfde4('0x43'),_0xfde4('0x44'));_0x8f9353[_0xfde4('0x45')]=_0x539c9a;}else if(_0x52dc4a&&_0x52dc4a['recordingFormat']&&_0x52dc4a['recordingFormat']!==_0xfde4('0x46')){logger[_0xfde4('0x12')](_0xfde4('0x47'),_0xfde4('0x44'));_0x8f9353[_0xfde4('0x45')]=_0x539c9a;}else{_0x8f9353['recordingURL']='';}return getAdminId(_0x3d9192,_0x3d8f11,_0x24db90,_0x26b400)['then'](getUser(_0x3d8f11,_0x24db90,_0x26b400))[_0xfde4('0xc')](getEndUser(_0x3d8f11,_0x24db90,_0x26b400))[_0xfde4('0xc')](getTicket(_0x3d8f11,_0x24db90,_0x26b400,_0x4a1e20,_0x8f9353))['then'](function(_0x485aa7){logger[_0xfde4('0x12')](util[_0xfde4('0x21')](_0xfde4('0x48'),_0x485aa7[_0xfde4('0x32')]));if(_0x3d8f11!==_0xfde4('0x3f')){logger['info']('['+[_0x3d8f11[_0xfde4('0x14')]()]+']',_0xfde4('0x49'));emit(_0x26b400,_0xa3da26[_0xfde4('0x4a')],_0x485aa7['endUserId']);}})[_0xfde4('0x1b')](function(_0x31859){logger[_0xfde4('0x1c')]('['+[_0x3d8f11[_0xfde4('0x14')]()]+_0xfde4('0x4b'),util[_0xfde4('0x4c')](_0x31859,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xad1b=['unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','then','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','Admin\x20selected','userEmail','adminEmail','userId','/api/lookup?q=','&entities=contact','contacts','format','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','/api/contacts','contactNumber','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','getString','Subjects','Descriptions','Contact','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','destcalleridnum','queue'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xad1b,0xb4));var _0xbad1=function(_0x1324f2,_0x54accc){_0x1324f2=_0x1324f2-0x0;var _0x5260b4=_0xad1b[_0x1324f2];return _0x5260b4;};'use strict';var _=require(_0xbad1('0x0'));var rp=require(_0xbad1('0x1'));var md5=require(_0xbad1('0x2'));var util=require(_0xbad1('0x3'));var moment=require(_0xbad1('0x4'));var Promise=require(_0xbad1('0x5'));var Redis=require(_0xbad1('0x6'));var intUtil=require(_0xbad1('0x7'));var config=require(_0xbad1('0x8'));var logger=require(_0xbad1('0x9'))(_0xbad1('0xa'));config['redis']=_[_0xbad1('0xb')](config[_0xbad1('0xc')],{'host':_0xbad1('0xd'),'port':0x18eb});var io=require(_0xbad1('0xe'))(new Redis(config['redis']));function getAdminId(_0x5be4ea,_0x8fdae2,_0x5ca00e,_0x3168d7){return new Promise(function(_0x4d6790,_0x5d1814){var _0x3ba214=![];var _0x2f4f54={'method':_0xbad1('0xf'),'uri':_0x3168d7+_0xbad1('0x10'),'json':!![]};_0x2f4f54[_0xbad1('0x11')]=_0x5ca00e;logger[_0xbad1('0x12')]('Getting\x20admin\x20information');return rp(_0x2f4f54)[_0xbad1('0x13')](function(_0x8dd568){if(_0x8dd568){var _0x443f15=_0x8dd568['users'];var _0x4202fc=null;for(_0x4202fc=0x0;_0x4202fc<_0x443f15[_0xbad1('0x14')];_0x4202fc++){if(_0x443f15[_0x4202fc][_0xbad1('0x15')]===_0x5be4ea['adminEmail']){_0x5be4ea[_0xbad1('0x16')]=_0x443f15[_0x4202fc]['id'];_0x3ba214=!![];}}if(_0x3ba214){logger['info'](_0xbad1('0x17'),_0x5be4ea[_0xbad1('0x16')]);_0x4d6790(_0x5be4ea);}else{_0x5d1814({'statusCode':0x194,'message':_0xbad1('0x18')});}}else{_0x5d1814({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xbad1('0x19')](function(_0x3674e3){logger[_0xbad1('0x1a')]('['+[_0x8fdae2[_0xbad1('0x1b')]()]+']',_0x3674e3[_0xbad1('0x1c')]);_0x5d1814(_0x3674e3);});});}function getUser(_0x2fd25e,_0x2edfbc,_0x58f65e){return function(_0x110498){return new Promise(function(_0x4ba6f9,_0x490ed0){var _0x4d57b5={'method':_0xbad1('0xf'),'uri':_0x58f65e+_0xbad1('0x10'),'json':!![]};_0x4d57b5['headers']=_0x2edfbc;logger[_0xbad1('0x12')](_0xbad1('0x1d'));return rp(_0x4d57b5)[_0xbad1('0x13')](function(_0xb569e8){if(_0xb569e8){var _0x1f2961=_0xb569e8['users'];var _0x429fbd=![];var _0x577e4b=null;if(_0x110498[_0xbad1('0x1e')]!==null){logger[_0xbad1('0x12')](_0xbad1('0x1f'),_0x110498[_0xbad1('0x1e')]);_0x110498['userEmail']=_0x110498[_0xbad1('0x1e')];for(_0x577e4b=0x0;_0x577e4b<_0x1f2961['length'];_0x577e4b++){if(_0x1f2961[_0x577e4b][_0xbad1('0x15')]===_0x110498[_0xbad1('0x1e')]){_0x429fbd=!![];_0x110498['userId']=_0x1f2961[_0x577e4b]['id'];logger['info']('User\x20found:',_0x110498['userId']);}}}if(!_0x429fbd){logger[_0xbad1('0x12')](_0xbad1('0x20'));_0x110498[_0xbad1('0x21')]=_0x110498[_0xbad1('0x22')];_0x110498[_0xbad1('0x23')]=_0x110498[_0xbad1('0x16')];_0x429fbd=!![];}if(_0x429fbd){_0x4ba6f9(_0x110498);}else{_0x490ed0({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x490ed0({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xbad1('0x19')](function(_0x148e9e){logger['error']('['+[_0x2fd25e[_0xbad1('0x1b')]()]+']',_0x148e9e[_0xbad1('0x1c')]);_0x490ed0(_0x148e9e);});});};}function searchContact(_0xa6e099,_0x32b332,_0x56b134,_0x20600c){return new Promise(function(_0x4f62d7,_0x338145){var _0x5a3bcb={'method':_0xbad1('0xf'),'headers':_0x32b332,'uri':_0xa6e099+_0xbad1('0x24')+_0x20600c+'&f='+_0x56b134+_0xbad1('0x25'),'json':!![]};rp(_0x5a3bcb)[_0xbad1('0x13')](function(_0x2f2533){var _0x72e740=_['find'](_0x2f2533[_0xbad1('0x26')][_0xbad1('0x26')],[_0x56b134,_0x20600c]);_0x4f62d7(_0x72e740);})[_0xbad1('0x19')](function(_0x521561){_0x338145(_0x521561);});});}function getEndUser(_0x51a1f5,_0x3a8f34,_0x3f9517){return function(_0x36e171){return new Promise(function(_0x155151,_0x2a0900){logger['info'](util[_0xbad1('0x27')]('Searching\x20contact\x20with\x20phone\x20%s',_0x36e171['contactNumber']));searchContact(_0x3f9517,_0x3a8f34,_0xbad1('0x28'),_0x36e171['contactNumber'])[_0xbad1('0x13')](function(_0x261da9){if(_0x261da9){_0x36e171[_0xbad1('0x29')]=_0x261da9['id'];logger['info'](_0xbad1('0x2a'),_0x36e171[_0xbad1('0x29')]);return _0x155151(_0x36e171);}searchContact(_0x3f9517,_0x3a8f34,_0xbad1('0x2b'),_0x36e171['contactNumber'])[_0xbad1('0x13')](function(_0x4c1bbd){if(_0x4c1bbd){_0x36e171[_0xbad1('0x29')]=_0x4c1bbd['id'];logger[_0xbad1('0x12')](_0xbad1('0x2c'),_0x36e171['endUserId']);return _0x155151(_0x36e171);}createEndUser(_0x36e171,_0x51a1f5,_0x3a8f34,_0x3f9517)['then'](function(_0x514c90){logger[_0xbad1('0x12')]('Contact\x20created:',_0x514c90[_0xbad1('0x29')]);return _0x155151(_0x514c90);});});})['catch'](function(_0x1d29be){_0x2a0900(_0x1d29be);});});};}function createEndUser(_0x27d50c,_0x145a9d,_0xb32871,_0x5ef217){return new Promise(function(_0x298356,_0x3dc2af){var _0x20d9d2=moment();var _0x169fb7={'method':'POST','uri':_0x5ef217+_0xbad1('0x2d'),'body':{'contact':{'last_name':_0x27d50c[_0xbad1('0x2e')],'work_number':_0x27d50c[_0xbad1('0x2e')],'mobile_number':_0x27d50c[_0xbad1('0x2e')],'owner_id':_0x27d50c['userId'],'created_at':_0x20d9d2[_0xbad1('0x27')](_0xbad1('0x2f'))}},'json':!![]};_0x169fb7[_0xbad1('0x11')]=_0xb32871;logger['info'](_0xbad1('0x30'));return rp(_0x169fb7)[_0xbad1('0x13')](function(_0x5a80f1){_0x27d50c[_0xbad1('0x29')]=_0x5a80f1[_0xbad1('0x31')]['id'];_0x298356(_0x27d50c);})[_0xbad1('0x19')](function(_0x1e0b85){logger[_0xbad1('0x1a')]('['+[_0x145a9d[_0xbad1('0x1b')]()]+']',_0x1e0b85[_0xbad1('0x1c')]);_0x3dc2af(_0x1e0b85[_0xbad1('0x1c')]);});});}function getTicket(_0x3bdbaf,_0x7deafc,_0xa30e0e,_0x13435b,_0x1f07a8){return function(_0x4b077e){logger[_0xbad1('0x12')](_0xbad1('0x32'));return new Promise(function(_0x12f99e,_0x4ce7da){var _0x361e5e=moment();var _0x1ff751={'method':_0xbad1('0x33'),'uri':_0xa30e0e+'/api/tasks','body':{'title':intUtil[_0xbad1('0x34')](_0x13435b[_0xbad1('0x35')],_0x1f07a8,'\x20'),'description':intUtil[_0xbad1('0x34')](_0x13435b[_0xbad1('0x36')],_0x1f07a8,'\x0a'),'owner_id':_0x4b077e['userId'],'creater_id':_0x4b077e[_0xbad1('0x16')],'targetable_id':_0x4b077e[_0xbad1('0x29')],'targetable_type':_0xbad1('0x37'),'created_at':_0x361e5e[_0xbad1('0x27')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x361e5e['add'](0x1e,'m')['format'](_0xbad1('0x2f'))},'json':!![]};_0x1ff751['headers']=_0x7deafc;return rp(_0x1ff751)[_0xbad1('0x13')](function(_0x2895bb){_0x4b077e[_0xbad1('0x38')]=_0x2895bb[_0xbad1('0x39')]['id'];logger[_0xbad1('0x12')](_0xbad1('0x3a'),_0x4b077e[_0xbad1('0x38')]);_0x12f99e(_0x4b077e);})[_0xbad1('0x19')](function(_0x3823a9){logger[_0xbad1('0x1a')]('['+[_0x3bdbaf[_0xbad1('0x1b')]()]+']',_0x3823a9[_0xbad1('0x1c')]);_0x4ce7da(_0x3823a9['message']);});});};}function emit(_0x2db740,_0x426de4,_0x19ff58){var _0x216796={'uri':_0x2db740+_0xbad1('0x3b')+_0x19ff58};io['to'](util[_0xbad1('0x27')](_0xbad1('0x3c'),_0x426de4))[_0xbad1('0x3d')]('trigger:browser:url',_0x216796);}exports['cs']=function(_0x4de449,_0x15dbaa,_0x591f3a,_0x5d86b7,_0x316dc0,_0x850326,_0x586c27,_0x145062){var _0x396856={};var _0x50313d={'Authorization':'Token\x20token='+_0x850326['apiKey']};_0x850326['remoteUri']=intUtil['stripTrailingSlash'](_0x850326[_0xbad1('0x3e')]);_0x850326[_0xbad1('0x3f')]=intUtil[_0xbad1('0x40')](_0x850326[_0xbad1('0x3f')]);var _0x390d02=_0x850326['remoteUri'];_0x396856[_0xbad1('0x22')]=_0x850326[_0xbad1('0x41')];_0x396856['contactNumber']=_0x145062[_0xbad1('0x42')]()==='outbound'?_0x15dbaa[_0xbad1('0x43')]:_0x15dbaa['calleridnum'];_0x396856['callDirection']=_0x145062===_0xbad1('0x44')||_0x145062===_0xbad1('0x45')?_0xbad1('0x44'):'outbound';if(_0x5d86b7){_0x396856[_0xbad1('0x1e')]=_0x5d86b7[_0xbad1('0x15')];}var _0x1bbf19=util['format'](_0xbad1('0x46'),_0x850326['serverUrl'],_0x15dbaa[_0xbad1('0x47')],md5(_0x15dbaa[_0xbad1('0x47')]));if(_0x316dc0&&_0x316dc0[_0xbad1('0x48')]){logger[_0xbad1('0x12')](_0xbad1('0x49'),_0xbad1('0x4a'));_0x15dbaa[_0xbad1('0x4b')]=_0x1bbf19;}else if(_0x586c27&&_0x586c27[_0xbad1('0x4c')]&&_0x586c27[_0xbad1('0x4c')]!==_0xbad1('0x4d')){logger[_0xbad1('0x12')](_0xbad1('0x4e'),_0xbad1('0x4a'));_0x15dbaa['recordingURL']=_0x1bbf19;}else{_0x15dbaa[_0xbad1('0x4b')]='';}return getAdminId(_0x396856,_0x145062,_0x50313d,_0x390d02)[_0xbad1('0x13')](getUser(_0x145062,_0x50313d,_0x390d02))[_0xbad1('0x13')](getEndUser(_0x145062,_0x50313d,_0x390d02))[_0xbad1('0x13')](getTicket(_0x145062,_0x50313d,_0x390d02,_0x591f3a,_0x15dbaa))[_0xbad1('0x13')](function(_0x202bd1){logger[_0xbad1('0x12')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x202bd1['ticketId']));if(_0x145062!==_0xbad1('0x45')){logger['info']('['+[_0x145062[_0xbad1('0x1b')]()]+']',_0xbad1('0x4f'));emit(_0x390d02,_0x5d86b7[_0xbad1('0x50')],_0x202bd1[_0xbad1('0x29')]);}})[_0xbad1('0x19')](function(_0x176112){logger['error']('['+[_0x145062['toUpperCase']()]+_0xbad1('0x51'),util[_0xbad1('0x52')](_0x176112,{'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 fde0356..161f078 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 _0x1250=['zoho','desk','vtiger','freshsales','exec','includes','data1','toLowerCase','data2','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','sugarcrm','servicenow','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','freshdesk'];(function(_0x4e309b,_0x451868){var _0x2e27a9=function(_0x30bc0a){while(--_0x30bc0a){_0x4e309b['push'](_0x4e309b['shift']());}};_0x2e27a9(++_0x451868);}(_0x1250,0xde));var _0x0125=function(_0x292128,_0x37badb){_0x292128=_0x292128-0x0;var _0x5d99ca=_0x1250[_0x292128];return _0x5d99ca;};'use strict';var _=require(_0x0125('0x0'));var util=require('util');var zendesk=require(_0x0125('0x1'));var salesforce=require(_0x0125('0x2'));var sugarcrm=require(_0x0125('0x3'));var freshdesk=require(_0x0125('0x4'));var zoho=require(_0x0125('0x5'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0x0125('0x6'));var dynamics365=require(_0x0125('0x7'));var freshsales=require(_0x0125('0x8'));var integrations=[_0x0125('0x9'),_0x0125('0xa'),'sugarcrm',_0x0125('0xb'),_0x0125('0xc'),_0x0125('0xd'),_0x0125('0xe'),'dynamics365',_0x0125('0xf'),'servicenow'];exports[_0x0125('0x10')]=function(_0xcac55c,_0x3547a3,_0x994735,_0x5a6f64,_0x48a70d,_0x5811d6){if(_0x994735){if(_[_0x0125('0x11')](integrations,_0xcac55c[_0x0125('0x12')][_0x0125('0x13')]())){try{var _0x346961=null;var _0x3f71d4='';var _0x4b4bdf=_0x994735[_0xcac55c['data1']['toLowerCase']()];if(_0x4b4bdf){var _0x35b121=_0x4b4bdf[_0xcac55c[_0x0125('0x14')]];if(_0x35b121){var _0x2a3bd2=_['find'](_0x35b121[_0x0125('0x15')],{'id':parseInt(_0xcac55c[_0x0125('0x16')],0xa)});if(_0x2a3bd2){if(_0x5a6f64){if(_0x48a70d&&_0x3547a3[_0x0125('0x17')]){_0x3f71d4='queue';}else if(_0x3547a3[_0x0125('0x18')]){_0x3f71d4=_0x0125('0x19');}else{console[_0x0125('0x1a')](_0x0125('0x1b'),_0x3547a3);}}else{_0x3f71d4=_0x0125('0x1c');}switch(_0xcac55c[_0x0125('0x12')][_0x0125('0x13')]()){case'zendesk':zendesk[_0x3f71d4](_0xcac55c,_0x3547a3,_0x2a3bd2,_0x5a6f64,_0x48a70d,_0x35b121,_0x5811d6);break;case _0x0125('0xa'):salesforce[_0x3f71d4](_0xcac55c,_0x3547a3,_0x2a3bd2,_0x5a6f64,_0x48a70d,_0x35b121,_0x5811d6);break;case _0x0125('0x1d'):sugarcrm[_0x3f71d4](_0xcac55c,_0x3547a3,_0x2a3bd2,_0x5a6f64,_0x48a70d,_0x35b121,_0x5811d6);break;case _0x0125('0xb'):freshdesk[_0x3f71d4](_0xcac55c,_0x3547a3,_0x2a3bd2,_0x5a6f64,_0x48a70d,_0x35b121,_0x5811d6);break;case _0x0125('0xc'):zoho[_0x3f71d4](_0xcac55c,_0x3547a3,_0x2a3bd2,_0x5a6f64,_0x48a70d,_0x35b121,_0x5811d6);break;case'desk':desk[_0x3f71d4](_0xcac55c,_0x3547a3,_0x2a3bd2,_0x5a6f64,_0x48a70d,_0x35b121,_0x5811d6);break;case _0x0125('0xe'):vtiger[_0x3f71d4](_0xcac55c,_0x3547a3,_0x2a3bd2,_0x5a6f64,_0x48a70d,_0x35b121,_0x5811d6);break;case _0x0125('0xf'):freshsales['cs'](_0xcac55c,_0x3547a3,_0x2a3bd2,_0x5a6f64,_0x48a70d,_0x35b121,_0x5811d6,_0x3f71d4);break;case _0x0125('0x1e'):servicenow['cs'](_0xcac55c,_0x3547a3,_0x2a3bd2,_0x5a6f64,_0x48a70d,_0x35b121,_0x5811d6,_0x3f71d4);break;case _0x0125('0x1f'):dynamics365['cs'](_0xcac55c,_0x3547a3,_0x2a3bd2,_0x5a6f64,_0x48a70d,_0x35b121,_0x5811d6,_0x3f71d4);break;default:console[_0x0125('0x1a')](_0x0125('0x20'));}}else{_0x346961=require(_0x0125('0x21'))(_0xcac55c['data1']['toLowerCase']());_0x346961[_0x0125('0x22')](_0x0125('0x23'),util[_0x0125('0x24')](_0x0125('0x25'),_0xcac55c['data1'][_0x0125('0x13')](),_0xcac55c['data3']));}}else{_0x346961=require(_0x0125('0x21'))(_0xcac55c['data1'][_0x0125('0x13')]());_0x346961[_0x0125('0x22')](_0x0125('0x23'),util[_0x0125('0x24')](_0x0125('0x26'),_0xcac55c[_0x0125('0x12')][_0x0125('0x13')](),_0xcac55c[_0x0125('0x14')]));}}else{}}catch(_0x4dc75d){console[_0x0125('0x22')](_0x4dc75d);}}}}; \ No newline at end of file +var _0xb58e=['vtiger','../../../../config/logger','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','data3','error','format','%s\x20account\x20#%s\x20not\x20found','lodash','./salesforce','./sugarcrm','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','zoho','dynamics365','freshsales','servicenow','includes','data1','toLowerCase','data2','find','queue','routeId','outbound','log','unmanaged','zendesk','desk'];(function(_0x351572,_0xfcedb8){var _0xb994ef=function(_0x378398){while(--_0x378398){_0x351572['push'](_0x351572['shift']());}};_0xb994ef(++_0xfcedb8);}(_0xb58e,0x94));var _0xeb58=function(_0x4c1ae3,_0x492c90){_0x4c1ae3=_0x4c1ae3-0x0;var _0x71158e=_0xb58e[_0x4c1ae3];return _0x71158e;};'use strict';var _=require(_0xeb58('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0xeb58('0x1'));var sugarcrm=require(_0xeb58('0x2'));var freshdesk=require('./freshdesk');var zoho=require(_0xeb58('0x3'));var desk=require('./desk');var vtiger=require(_0xeb58('0x4'));var servicenow=require(_0xeb58('0x5'));var dynamics365=require(_0xeb58('0x6'));var freshsales=require(_0xeb58('0x7'));var integrations=['zendesk',_0xeb58('0x8'),_0xeb58('0x9'),_0xeb58('0xa'),_0xeb58('0xb'),'desk','vtiger',_0xeb58('0xc'),_0xeb58('0xd'),_0xeb58('0xe')];exports['exec']=function(_0xe2f758,_0x17e006,_0x2cb972,_0x4dbdbd,_0x2a9a83,_0x4f47ee){if(_0x2cb972){if(_[_0xeb58('0xf')](integrations,_0xe2f758[_0xeb58('0x10')][_0xeb58('0x11')]())){try{var _0x39f8b4=null;var _0x133252='';var _0x27e2b7=_0x2cb972[_0xe2f758[_0xeb58('0x10')][_0xeb58('0x11')]()];if(_0x27e2b7){var _0x2cc9f5=_0x27e2b7[_0xe2f758[_0xeb58('0x12')]];if(_0x2cc9f5){var _0x2c699c=_[_0xeb58('0x13')](_0x2cc9f5['Configurations'],{'id':parseInt(_0xe2f758['data3'],0xa)});if(_0x2c699c){if(_0x4dbdbd){if(_0x2a9a83&&_0x17e006[_0xeb58('0x14')]){_0x133252=_0xeb58('0x14');}else if(_0x17e006[_0xeb58('0x15')]){_0x133252=_0xeb58('0x16');}else{console[_0xeb58('0x17')]('EVENT\x20UNKNOWN',_0x17e006);}}else{_0x133252=_0xeb58('0x18');}switch(_0xe2f758['data1'][_0xeb58('0x11')]()){case _0xeb58('0x19'):zendesk[_0x133252](_0xe2f758,_0x17e006,_0x2c699c,_0x4dbdbd,_0x2a9a83,_0x2cc9f5,_0x4f47ee);break;case _0xeb58('0x8'):salesforce[_0x133252](_0xe2f758,_0x17e006,_0x2c699c,_0x4dbdbd,_0x2a9a83,_0x2cc9f5,_0x4f47ee);break;case _0xeb58('0x9'):sugarcrm[_0x133252](_0xe2f758,_0x17e006,_0x2c699c,_0x4dbdbd,_0x2a9a83,_0x2cc9f5,_0x4f47ee);break;case _0xeb58('0xa'):freshdesk[_0x133252](_0xe2f758,_0x17e006,_0x2c699c,_0x4dbdbd,_0x2a9a83,_0x2cc9f5,_0x4f47ee);break;case _0xeb58('0xb'):zoho[_0x133252](_0xe2f758,_0x17e006,_0x2c699c,_0x4dbdbd,_0x2a9a83,_0x2cc9f5,_0x4f47ee);break;case _0xeb58('0x1a'):desk[_0x133252](_0xe2f758,_0x17e006,_0x2c699c,_0x4dbdbd,_0x2a9a83,_0x2cc9f5,_0x4f47ee);break;case _0xeb58('0x1b'):vtiger[_0x133252](_0xe2f758,_0x17e006,_0x2c699c,_0x4dbdbd,_0x2a9a83,_0x2cc9f5,_0x4f47ee);break;case'freshsales':freshsales['cs'](_0xe2f758,_0x17e006,_0x2c699c,_0x4dbdbd,_0x2a9a83,_0x2cc9f5,_0x4f47ee,_0x133252);break;case _0xeb58('0xe'):servicenow['cs'](_0xe2f758,_0x17e006,_0x2c699c,_0x4dbdbd,_0x2a9a83,_0x2cc9f5,_0x4f47ee,_0x133252);break;case'dynamics365':dynamics365['cs'](_0xe2f758,_0x17e006,_0x2c699c,_0x4dbdbd,_0x2a9a83,_0x2cc9f5,_0x4f47ee,_0x133252);break;default:console[_0xeb58('0x17')]('unknown\x20integration');}}else{_0x39f8b4=require(_0xeb58('0x1c'))(_0xe2f758['data1'][_0xeb58('0x11')]());_0x39f8b4['error'](_0xeb58('0x1d'),util['format'](_0xeb58('0x1e'),_0xe2f758[_0xeb58('0x10')]['toLowerCase'](),_0xe2f758[_0xeb58('0x1f')]));}}else{_0x39f8b4=require(_0xeb58('0x1c'))(_0xe2f758[_0xeb58('0x10')][_0xeb58('0x11')]());_0x39f8b4[_0xeb58('0x20')]('[EXEC]',util[_0xeb58('0x21')](_0xeb58('0x22'),_0xe2f758[_0xeb58('0x10')][_0xeb58('0x11')](),_0xe2f758[_0xeb58('0x12')]));}}else{}}catch(_0x1d9d4b){console['error'](_0x1d9d4b);}}}}; \ 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 a6b1b4d..2dabcfb 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 _0x839d=['lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','defaults','localhost','socket.io-emitter','assign','getString','Subjects','Descriptions','Task','ActivityDate','utc','IsRecurrence','endUserType','lead','account','WhatId','ticketType','Case','contact','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','length','Email','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','merge','$or','execute','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','additionalSearchContact','Contact','first','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','','Company','upperFirst','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','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.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged'];(function(_0x156313,_0x10da4e){var _0x16c38d=function(_0xf85df5){while(--_0xf85df5){_0x156313['push'](_0x156313['shift']());}};_0x16c38d(++_0x10da4e);}(_0x839d,0x10c));var _0xd839=function(_0x3f8336,_0x33d0cf){_0x3f8336=_0x3f8336-0x0;var _0x104162=_0x839d[_0x3f8336];return _0x104162;};'use strict';var _=require(_0xd839('0x0'));var rp=require(_0xd839('0x1'));var moment=require(_0xd839('0x2'));var BPromise=require(_0xd839('0x3'));var md5=require(_0xd839('0x4'));var jsforce=require(_0xd839('0x5'));var util=require(_0xd839('0x6'));var Redis=require(_0xd839('0x7'));var intUtil=require('./util');var config=require(_0xd839('0x8'));var logger=require(_0xd839('0x9'))(_0xd839('0xa'));config['redis']=_[_0xd839('0xb')](config['redis'],{'host':_0xd839('0xc'),'port':0x18eb});var io=require(_0xd839('0xd'))(new Redis(config['redis']));function emit(_0x207dcf,_0xeaa2a9,_0x1b0819){io['to'](_0x207dcf)['emit'](_0xeaa2a9,_0x1b0819);}function getTicket(_0x309078,_0x3ac9ef,_0x54ce0d,_0x2537cf,_0xab7cb3,_0x4df6c6,_0x250947,_0x1f3c07){var _0x3afd2d=Object[_0xd839('0xe')]({},{'OwnerId':_0x3ac9ef['id'],'Subject':intUtil[_0xd839('0xf')](_0x2537cf[_0xd839('0x10')],_0xab7cb3,'\x20'),'Description':intUtil[_0xd839('0xf')](_0x2537cf[_0xd839('0x11')],_0xab7cb3,'\x0a')},getCustomFields(_0x4df6c6,_0xab7cb3));if(_0x54ce0d){if(_0x2537cf['ticketType']===_0xd839('0x12')){_0x3afd2d[_0xd839('0x13')]=moment[_0xd839('0x14')]();_0x3afd2d['IsReminderSet']=![];_0x3afd2d[_0xd839('0x15')]=![];if(_0x54ce0d['endUserType']==='contact'||_0x54ce0d[_0xd839('0x16')]===_0xd839('0x17')){_0x3afd2d['WhoId']=_0x54ce0d['id'];}else if(_0x54ce0d['endUserType']===_0xd839('0x18')){_0x3afd2d[_0xd839('0x19')]=_0x54ce0d['id'];}}else if(_0x2537cf[_0xd839('0x1a')]===_0xd839('0x1b')){if(_0x54ce0d[_0xd839('0x16')]===_0xd839('0x1c')){_0x3afd2d[_0xd839('0x1d')]=_0x54ce0d['id'];}else if(_0x54ce0d['endUserType']===_0xd839('0x18')){_0x3afd2d[_0xd839('0x1e')]=_0x54ce0d['id'];}else if(_0x54ce0d[_0xd839('0x16')]===_0xd839('0x17')&&_0x2537cf[_0xd839('0x1f')]){_0x3afd2d[_0x2537cf[_0xd839('0x1f')]]=_0x54ce0d['id'];}else{logger[_0xd839('0x20')](_0xd839('0x21'));}}}return _0x250947[_0xd839('0x22')](_0x2537cf[_0xd839('0x1a')])['create'](_0x3afd2d);}function getUser(_0x22a1e8,_0x2ba3a0,_0x542c47){if(!_[_0xd839('0x23')](_0x2ba3a0)&&intUtil[_0xd839('0x24')](_0x2ba3a0)){var _0x54f312={'Email':_0x2ba3a0};var _0x34f923={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x542c47[_0xd839('0x22')](_0xd839('0x25'))[_0xd839('0x26')](_0x54f312,_0x34f923)['execute']()['then'](function(_0x584663){if(_0x584663[_0xd839('0x27')]){var _0x4ae48e=_[_0xd839('0x26')](_0x584663,function(_0x5a5eca){return _0x5a5eca[_0xd839('0x28')]===_0x2ba3a0;});if(_0x4ae48e){logger[_0xd839('0x20')](_0xd839('0x29'),_0x2ba3a0);return BPromise[_0xd839('0x2a')]({'id':_0x4ae48e['Id'],'name':_0x4ae48e['Name']});}}else{logger[_0xd839('0x20')](_0xd839('0x2b'),_0x2ba3a0);return _0x542c47[_0xd839('0x2c')]()[_0xd839('0x2d')](function(_0x48efd1){return BPromise[_0xd839('0x2a')]({'id':_0x48efd1[_0xd839('0x2e')],'name':_0x48efd1[_0xd839('0x2f')]});});}});}else{logger[_0xd839('0x20')](_0xd839('0x2b'),_0x2ba3a0);return _0x542c47['identity']()['then'](function(_0x34e789){return BPromise[_0xd839('0x2a')]({'id':_0x34e789[_0xd839('0x2e')],'name':_0x34e789['display_name']});});}}function getEndUser(_0x1758f5,_0x3e7929,_0x1e0459,_0x56d7aa,_0x1e6497){var _0x3bf535={'$or':{'Phone':_0x56d7aa}};var _0x5aae7f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xd839('0x2a')]()[_0xd839('0x2d')](function(){logger['info'](_0xd839('0x30'),_0x56d7aa,_0x3e7929[_0xd839('0x31')]);switch(_0x3e7929[_0xd839('0x31')]){case _0xd839('0x32'):var _0x8f0c06=_['cloneDeep'](_0x3bf535);if(_0x3e7929['additionalSearchContact']){var _0x3f7b81={};_0x3f7b81[_0x3e7929['additionalSearchContact']]=_0x56d7aa;_[_0xd839('0x33')](_0x8f0c06[_0xd839('0x34')],_0x3f7b81);}return _0x1e6497[_0xd839('0x22')]('Contact')[_0xd839('0x26')](_0x8f0c06,_0x5aae7f)[_0xd839('0x35')]()['then'](function(_0x37e451){if(_0x37e451&&_0x37e451[_0xd839('0x27')]){return _0x37e451;}else{var _0x43de5f=_[_0xd839('0x36')](_0x3bf535);if(_0x3e7929[_0xd839('0x37')]){var _0x4aabaf={};_0x4aabaf[_0x3e7929[_0xd839('0x37')]]=_0x56d7aa;_['merge'](_0x43de5f['$or'],_0x4aabaf);}return _0x1e6497[_0xd839('0x22')](_0xd839('0x38'))[_0xd839('0x26')](_0x43de5f,_0x5aae7f);}});case _0xd839('0x39'):var _0x227f29=_[_0xd839('0x36')](_0x3bf535);if(_0x3e7929[_0xd839('0x3a')]){var _0x3f7b81={};_0x3f7b81[_0x3e7929['additionalSearchAccount']]=_0x56d7aa;_[_0xd839('0x33')](_0x227f29[_0xd839('0x34')],_0x3f7b81);}return _0x1e6497[_0xd839('0x22')](_0xd839('0x3b'))[_0xd839('0x26')](_0x227f29,_0x5aae7f)[_0xd839('0x35')]()['then'](function(_0x5bafd9){if(_0x5bafd9&&_0x5bafd9[_0xd839('0x27')]){return _0x5bafd9;}else{var _0x522c2d=_['cloneDeep'](_0x3bf535);if(_0x3e7929[_0xd839('0x3c')]){var _0x55c403={};_0x55c403[_0x3e7929[_0xd839('0x3c')]]=_0x56d7aa;_[_0xd839('0x33')](_0x522c2d[_0xd839('0x34')],_0x55c403);}return _0x1e6497[_0xd839('0x22')](_0xd839('0x3d'))[_0xd839('0x26')](_0x522c2d,_0x5aae7f)[_0xd839('0x2d')](function(_0x51f828){if(_0x51f828&&_0x51f828[_0xd839('0x27')]){return _0x51f828;}else{var _0x5121f4=_['cloneDeep'](_0x3bf535);if(_0x3e7929['additionalSearchLead']){var _0x2bdacc={};_0x2bdacc[_0x3e7929[_0xd839('0x37')]]=_0x56d7aa;_[_0xd839('0x33')](_0x5121f4[_0xd839('0x34')],_0x2bdacc);}return _0x1e6497[_0xd839('0x22')](_0xd839('0x38'))[_0xd839('0x26')](_0x5121f4,_0x5aae7f);}});}});case _0xd839('0x1c'):var _0x8f0c06=_['cloneDeep'](_0x3bf535);if(_0x3e7929[_0xd839('0x3c')]){var _0x3f7b81={};_0x3f7b81[_0x3e7929[_0xd839('0x3c')]]=_0x56d7aa;_[_0xd839('0x33')](_0x8f0c06['$or'],_0x3f7b81);}return _0x1e6497['sobject'](_0xd839('0x3d'))[_0xd839('0x26')](_0x8f0c06,_0x5aae7f)[_0xd839('0x35')]();case _0xd839('0x17'):var _0x30206e=_[_0xd839('0x36')](_0x3bf535);if(_0x3e7929[_0xd839('0x37')]){var _0x3f7b81={};_0x3f7b81[_0x3e7929['additionalSearchLead']]=_0x56d7aa;_['merge'](_0x30206e[_0xd839('0x34')],_0x3f7b81);}return _0x1e6497[_0xd839('0x22')]('Lead')[_0xd839('0x26')](_0x30206e,_0x5aae7f);case _0xd839('0x18'):var _0x227f29=_[_0xd839('0x36')](_0x3bf535);if(_0x3e7929['additionalSearchAccount']){var _0x3f7b81={};_0x3f7b81[_0x3e7929[_0xd839('0x3a')]]=_0x56d7aa;_['merge'](_0x227f29[_0xd839('0x34')],_0x3f7b81);}return _0x1e6497[_0xd839('0x22')](_0xd839('0x3b'))[_0xd839('0x26')](_0x227f29,_0x5aae7f);default:return null;}})[_0xd839('0x2d')](function(_0x20da26){if(_0x20da26&&_0x20da26['length']){var _0xdfb509=_[_0xd839('0x3e')](_0x20da26);if(_0xdfb509){return BPromise[_0xd839('0x2a')]({'id':_0xdfb509['Id'],'name':_0xdfb509[_0xd839('0x3f')],'phone':_0xdfb509[_0xd839('0x40')],'endUserType':_0xdfb509[_0xd839('0x41')][_0xd839('0x42')][_0xd839('0x43')]()});}}})['then'](function(_0x14262a){if(_0x14262a){logger[_0xd839('0x20')](_0xd839('0x44'),_0x14262a[_0xd839('0x16')],_0x56d7aa);return BPromise[_0xd839('0x2a')](_0x14262a);}else{logger[_0xd839('0x20')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x56d7aa);var _0x300fdc={'Phone':_0x56d7aa};if(_0x3e7929[_0xd839('0x45')]){if(_0x3e7929[_0xd839('0x45')]===_0xd839('0x1c')){logger[_0xd839('0x20')](_0xd839('0x46'),_0x56d7aa,_0x3e7929[_0xd839('0x45')]);_0x300fdc[_0xd839('0x47')]=_0x1e0459!==''?_0x1e0459:util[_0xd839('0x48')](_0xd839('0x49'),_0x56d7aa);}else if(_0x3e7929[_0xd839('0x45')]===_0xd839('0x17')){logger['info'](_0xd839('0x46'),_0x56d7aa,_0x3e7929[_0xd839('0x45')]);_0x300fdc[_0xd839('0x47')]=_0x1e0459!==_0xd839('0x4a')?_0x1e0459:util['format']('Caller\x20-\x20%s',_0x56d7aa);_0x300fdc[_0xd839('0x4b')]='No\x20Company';}else if(_0x3e7929[_0xd839('0x45')]===_0xd839('0x18')){logger['info'](_0xd839('0x46'),_0x56d7aa,_0x3e7929['moduleCreate']);_0x300fdc[_0xd839('0x3f')]=_0x1e0459!==_0xd839('0x4a')?_0x1e0459:util[_0xd839('0x48')]('Caller\x20-\x20%s',_0x56d7aa);}else{return null;}}return _0x1e6497[_0xd839('0x22')](_[_0xd839('0x4c')](_0x3e7929['moduleCreate']))['create'](_0x300fdc)['then'](function(_0x955263){return BPromise[_0xd839('0x2a')]({'id':_0x955263['id'],'endUserType':_0x3e7929[_0xd839('0x45')]});});}});}function getCustomFields(_0x5b0ec1,_0x1a9907){var _0x5770cd={};if(_0x5b0ec1[_0xd839('0x27')]>0x0){_['forEach'](_0x5b0ec1,function(_0xc4242d){if(_[_0xd839('0x4d')]([_0xd839('0x4e'),_0xd839('0x4f')],_0xc4242d['type'])&&_0xc4242d[_0xd839('0x50')]){_0x5770cd[_0xc4242d[_0xd839('0x50')]]=_0xc4242d[_0xd839('0x51')][_0xd839('0x52')]();}else if(_0xc4242d[_0xd839('0x42')]===_0xd839('0x53')&&_0xc4242d[_0xd839('0x54')]&&_0xc4242d[_0xd839('0x50')]){_0x1a9907[_0xc4242d[_0xd839('0x54')]]&&(_0x5770cd[_0xc4242d['idField']]=_0x1a9907[_0xc4242d[_0xd839('0x54')]][_0xd839('0x52')]());}else if(_0xc4242d['type']===_0xd839('0x55')&&_0xc4242d['Variable']&&_0xc4242d[_0xd839('0x56')]['name']&&_0xc4242d['idField']){_0x1a9907[_0xc4242d[_0xd839('0x56')][_0xd839('0x57')][_0xd839('0x43')]()]&&(_0x5770cd[_0xc4242d[_0xd839('0x50')]]=_0x1a9907[_0xc4242d[_0xd839('0x56')][_0xd839('0x57')][_0xd839('0x43')]()]['toString']());}});}return _0x5770cd;}function getConnection(_0x5950ac){var _0x2c0b37=_0x5950ac['password']['concat'](_0x5950ac[_0xd839('0x58')]);var _0x508ebf=new jsforce[(_0xd839('0x59'))]({'oauth2':{'loginUrl':_0x5950ac[_0xd839('0x5a')]||_0xd839('0x5b'),'clientId':_0x5950ac[_0xd839('0x5c')],'clientSecret':_0x5950ac['clientSecret']}});return _0x508ebf[_0xd839('0x5d')](_0x5950ac['username'],_0x2c0b37)['then'](function(){logger[_0xd839('0x20')](_0xd839('0x5e'));return _0x508ebf;});}exports[_0xd839('0x5f')]=function(_0x51dacf,_0x3421dc,_0xf3e2b9,_0x488a4d,_0x21dc63,_0x4d1e13){var _0x9db7f,_0x107230,_0xb877a,_0x20b42c;_0x4d1e13[_0xd839('0x60')]=intUtil[_0xd839('0x61')](_0x4d1e13['serverUrl']);_0x4d1e13[_0xd839('0x5a')]=intUtil[_0xd839('0x61')](_0x4d1e13[_0xd839('0x5a')]);if(_0x21dc63&&_0x21dc63[_0xd839('0x62')]){logger[_0xd839('0x20')]('[QUEUE]',_0xd839('0x63'));_0x3421dc[_0xd839('0x64')]=util[_0xd839('0x48')](_0xd839('0x65'),_0x4d1e13[_0xd839('0x60')],_0x3421dc['uniqueid'],md5(_0x3421dc[_0xd839('0x66')]));}else{_0x3421dc[_0xd839('0x64')]='';}return getConnection(_0x4d1e13)['then'](function(_0x3c85a2){_0x20b42c=_0x3c85a2;return getUser(_0x4d1e13,_0x488a4d[_0xd839('0x67')],_0x20b42c);})[_0xd839('0x2d')](function(_0x4439a1){_0x9db7f=_0x4439a1;return getEndUser(_0x4d1e13,_0xf3e2b9,_0x3421dc[_0xd839('0x68')],_0x3421dc[_0xd839('0x69')],_0x20b42c);})['then'](function(_0x33d66f){_0x107230=_0x33d66f;return getTicket(_0x4d1e13,_0x9db7f,_0x107230,_0xf3e2b9,_0x3421dc,_0xf3e2b9[_0xd839('0x6a')],_0x20b42c,_0xd839('0x5f'));})[_0xd839('0x2d')](function(_0x2a0155){_0xb877a=_0x2a0155;logger[_0xd839('0x20')](_0xd839('0x6b'),_0xb877a['id']);logger[_0xd839('0x20')](_0xd839('0x6c'),_0xb877a['id'],_0x488a4d[_0xd839('0x57')],_0x4d1e13[_0xd839('0x42')]);switch(_0x4d1e13[_0xd839('0x42')]){case _0xd839('0x6d'):emit(util[_0xd839('0x48')](_0xd839('0x6e'),_0x488a4d['name']),_0xd839('0x6f'),{'recordId':_0xb877a['id']});break;case'newTab':emit(util[_0xd839('0x48')](_0xd839('0x6e'),_0x488a4d[_0xd839('0x57')]),_0xd839('0x70'),{'uri':util['format'](_0xd839('0x71'),_0x20b42c[_0xd839('0x72')],_0xb877a['id'])});break;default:logger[_0xd839('0x73')](_0xd839('0x74'));}})[_0xd839('0x75')](function(_0x1f5e76){logger['error'](_0xd839('0x76'),_0x1f5e76);});};exports[_0xd839('0x77')]=function(_0x46106f,_0x2a7f16,_0x222134,_0x213841,_0x1fcdc7,_0x3affa3,_0x2da6fa){var _0x2e04d9,_0x61ea74,_0x196b51,_0x23d7c7;_0x3affa3['serverUrl']=intUtil[_0xd839('0x61')](_0x3affa3['serverUrl']);_0x3affa3[_0xd839('0x5a')]=intUtil[_0xd839('0x61')](_0x3affa3[_0xd839('0x5a')]);if(_0x2da6fa&&_0x2da6fa[_0xd839('0x78')]&&_0x2da6fa[_0xd839('0x78')]!==_0xd839('0x79')){logger[_0xd839('0x20')](_0xd839('0x7a'),_0xd839('0x63'));_0x2a7f16[_0xd839('0x64')]=util[_0xd839('0x48')](_0xd839('0x65'),_0x3affa3[_0xd839('0x60')],_0x2a7f16['uniqueid'],md5(_0x2a7f16[_0xd839('0x66')]));}return getConnection(_0x3affa3)['then'](function(_0x2ea855){_0x23d7c7=_0x2ea855;return getUser(_0x3affa3,_0x213841[_0xd839('0x67')],_0x23d7c7);})[_0xd839('0x2d')](function(_0x1e70e9){_0x2e04d9=_0x1e70e9;return getEndUser(_0x3affa3,_0x222134,_0x2a7f16['destcalleridname'],_0x2a7f16['destcalleridnum'],_0x23d7c7);})[_0xd839('0x2d')](function(_0x1b58e0){_0x61ea74=_0x1b58e0;return getTicket(_0x3affa3,_0x2e04d9,_0x61ea74,_0x222134,_0x2a7f16,_0x222134['Fields'],_0x23d7c7,_0xd839('0x77'));})[_0xd839('0x2d')](function(_0x10c0d3){_0x196b51=_0x10c0d3;logger[_0xd839('0x20')](_0xd839('0x7b'),_0x196b51['id']);logger[_0xd839('0x20')](_0xd839('0x7c'),_0x196b51['id'],_0x213841[_0xd839('0x57')],_0x3affa3[_0xd839('0x42')]);switch(_0x3affa3['type']){case _0xd839('0x6d'):emit(util[_0xd839('0x48')](_0xd839('0x6e'),_0x213841[_0xd839('0x57')]),_0xd839('0x6f'),{'recordId':_0x196b51['id']});break;case _0xd839('0x7d'):emit(util['format'](_0xd839('0x6e'),_0x213841[_0xd839('0x57')]),_0xd839('0x70'),{'uri':util['format'](_0xd839('0x71'),_0x23d7c7['instanceUrl'],_0x196b51['id'])});break;default:logger['error'](_0xd839('0x7a'),_0xd839('0x7e'));}})['catch'](function(_0xe8d6ec){logger[_0xd839('0x73')](_0xd839('0x7a'),_0xe8d6ec);});};exports[_0xd839('0x7f')]=function(_0x185391,_0x52e921,_0x56278c,_0x6cf25e,_0x2aa672,_0x294e93){var _0x1de7a8,_0x440a23,_0x3f6178,_0x31cfa9;_0x294e93['serverUrl']=intUtil[_0xd839('0x61')](_0x294e93[_0xd839('0x60')]);_0x294e93[_0xd839('0x5a')]=intUtil['stripTrailingSlash'](_0x294e93[_0xd839('0x5a')]);if(_0x2aa672&&_0x2aa672[_0xd839('0x62')]){logger[_0xd839('0x20')]('['+_0x52e921[_0xd839('0x80')][_0xd839('0x81')]()+']',_0xd839('0x63'));_0x52e921[_0xd839('0x64')]=util[_0xd839('0x48')](_0xd839('0x65'),_0x294e93[_0xd839('0x60')],_0x52e921[_0xd839('0x66')],md5(_0x52e921[_0xd839('0x66')]));}else{_0x52e921['recordingURL']='';}return getConnection(_0x294e93)[_0xd839('0x2d')](function(_0x4c365c){_0x31cfa9=_0x4c365c;if(!_[_0xd839('0x23')](_0x6cf25e)){return getUser(_0x294e93,_0x6cf25e['name'],_0x31cfa9);}else{return getUser(_0x294e93,null,_0x31cfa9);}})[_0xd839('0x2d')](function(_0x1c3615){_0x1de7a8=_0x1c3615;return getEndUser(_0x294e93,_0x56278c,_0x52e921[_0xd839('0x68')],_0x52e921[_0xd839('0x69')],_0x31cfa9);})[_0xd839('0x2d')](function(_0xf690f6){_0x440a23=_0xf690f6;return getTicket(_0x294e93,_0x1de7a8,_0x440a23,_0x56278c,_0x52e921,_0x56278c[_0xd839('0x6a')],_0x31cfa9);})[_0xd839('0x2d')](function(_0x3399d5){_0x3f6178=_0x3399d5;logger[_0xd839('0x20')]('['+_0x52e921[_0xd839('0x80')][_0xd839('0x81')]()+_0xd839('0x82'),_0x3f6178['id']);logger[_0xd839('0x20')]('['+_0x52e921[_0xd839('0x80')][_0xd839('0x81')]()+_0xd839('0x83'),_0x294e93[_0xd839('0x42')]);})[_0xd839('0x75')](function(_0x5ebc52){logger[_0xd839('0x73')]('['+_0x52e921[_0xd839('0x80')][_0xd839('0x81')]()+']',_0x5ebc52);});}; \ No newline at end of file +var _0xde91=['first','Phone','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','','No\x20Company','upperFirst','create','forEach','string','picklist','idField','variable','variableName','Variable','name','toString','password','securityToken','Connection','remoteUri','https://login.salesforce.com','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase','isNil','calleridname',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','util','ioredis','../../../../config/environment','salesforce','redis','localhost','emit','assign','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','endUserType','contact','account','Case','ContactId','AccountId','lead','leadId','info','sobject','validateEmail','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','$or','Contact','find','additionalSearchLead','merge','Lead','additionalSearchAccount'];(function(_0x5b14a6,_0x1879eb){var _0x230da2=function(_0x861a3d){while(--_0x861a3d){_0x5b14a6['push'](_0x5b14a6['shift']());}};_0x230da2(++_0x1879eb);}(_0xde91,0x1a7));var _0x1de9=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xde91[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x1de9('0x0'));var rp=require(_0x1de9('0x1'));var moment=require(_0x1de9('0x2'));var BPromise=require(_0x1de9('0x3'));var md5=require(_0x1de9('0x4'));var jsforce=require('jsforce');var util=require(_0x1de9('0x5'));var Redis=require(_0x1de9('0x6'));var intUtil=require('./util');var config=require(_0x1de9('0x7'));var logger=require('../../../../config/logger')(_0x1de9('0x8'));config[_0x1de9('0x9')]=_['defaults'](config[_0x1de9('0x9')],{'host':_0x1de9('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1de9('0x9')]));function emit(_0x2fa2cc,_0x2d2f70,_0x399eda){io['to'](_0x2fa2cc)[_0x1de9('0xb')](_0x2d2f70,_0x399eda);}function getTicket(_0x3ae8ae,_0x1ebf8e,_0x16560d,_0x248d6f,_0x95ea45,_0x2d124b,_0x4301dc,_0x5e338e){var _0x157135=Object[_0x1de9('0xc')]({},{'OwnerId':_0x1ebf8e['id'],'Subject':intUtil[_0x1de9('0xd')](_0x248d6f['Subjects'],_0x95ea45,'\x20'),'Description':intUtil[_0x1de9('0xd')](_0x248d6f[_0x1de9('0xe')],_0x95ea45,'\x0a')},getCustomFields(_0x2d124b,_0x95ea45));if(_0x16560d){if(_0x248d6f[_0x1de9('0xf')]===_0x1de9('0x10')){_0x157135[_0x1de9('0x11')]=moment[_0x1de9('0x12')]();_0x157135[_0x1de9('0x13')]=![];_0x157135['IsRecurrence']=![];if(_0x16560d[_0x1de9('0x14')]===_0x1de9('0x15')||_0x16560d['endUserType']==='lead'){_0x157135['WhoId']=_0x16560d['id'];}else if(_0x16560d[_0x1de9('0x14')]===_0x1de9('0x16')){_0x157135['WhatId']=_0x16560d['id'];}}else if(_0x248d6f[_0x1de9('0xf')]===_0x1de9('0x17')){if(_0x16560d[_0x1de9('0x14')]===_0x1de9('0x15')){_0x157135[_0x1de9('0x18')]=_0x16560d['id'];}else if(_0x16560d[_0x1de9('0x14')]===_0x1de9('0x16')){_0x157135[_0x1de9('0x19')]=_0x16560d['id'];}else if(_0x16560d['endUserType']===_0x1de9('0x1a')&&_0x248d6f[_0x1de9('0x1b')]){_0x157135[_0x248d6f[_0x1de9('0x1b')]]=_0x16560d['id'];}else{logger[_0x1de9('0x1c')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x4301dc[_0x1de9('0x1d')](_0x248d6f[_0x1de9('0xf')])['create'](_0x157135);}function getUser(_0x4a69ee,_0x293152,_0x531d18){if(!_['isNil'](_0x293152)&&intUtil[_0x1de9('0x1e')](_0x293152)){var _0x3bdb75={'Email':_0x293152};var _0x3f5b82={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x531d18[_0x1de9('0x1d')]('User')['find'](_0x3bdb75,_0x3f5b82)[_0x1de9('0x1f')]()[_0x1de9('0x20')](function(_0x36a1f3){if(_0x36a1f3[_0x1de9('0x21')]){var _0x1e1077=_['find'](_0x36a1f3,function(_0xee90dd){return _0xee90dd[_0x1de9('0x22')]===_0x293152;});if(_0x1e1077){logger[_0x1de9('0x1c')](_0x1de9('0x23'),_0x293152);return BPromise[_0x1de9('0x24')]({'id':_0x1e1077['Id'],'name':_0x1e1077[_0x1de9('0x25')]});}}else{logger[_0x1de9('0x1c')](_0x1de9('0x26'),_0x293152);return _0x531d18[_0x1de9('0x27')]()[_0x1de9('0x20')](function(_0x561c27){return BPromise[_0x1de9('0x24')]({'id':_0x561c27[_0x1de9('0x28')],'name':_0x561c27[_0x1de9('0x29')]});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x293152);return _0x531d18[_0x1de9('0x27')]()[_0x1de9('0x20')](function(_0x24a799){return BPromise['resolve']({'id':_0x24a799[_0x1de9('0x28')],'name':_0x24a799[_0x1de9('0x29')]});});}}function getEndUser(_0x58ac17,_0x27ca28,_0x382449,_0x425624,_0x15a271){var _0x171b0b={'$or':{'Phone':_0x425624}};var _0x3ae319={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger['info'](_0x1de9('0x2a'),_0x425624,_0x27ca28[_0x1de9('0x2b')]);switch(_0x27ca28[_0x1de9('0x2b')]){case'contact_lead':var _0x185569=_[_0x1de9('0x2c')](_0x171b0b);if(_0x27ca28[_0x1de9('0x2d')]){var _0x20b6c7={};_0x20b6c7[_0x27ca28[_0x1de9('0x2d')]]=_0x425624;_['merge'](_0x185569[_0x1de9('0x2e')],_0x20b6c7);}return _0x15a271[_0x1de9('0x1d')](_0x1de9('0x2f'))[_0x1de9('0x30')](_0x185569,_0x3ae319)[_0x1de9('0x1f')]()[_0x1de9('0x20')](function(_0x219172){if(_0x219172&&_0x219172[_0x1de9('0x21')]){return _0x219172;}else{var _0xa9c2a0=_['cloneDeep'](_0x171b0b);if(_0x27ca28['additionalSearchLead']){var _0x36abf1={};_0x36abf1[_0x27ca28[_0x1de9('0x31')]]=_0x425624;_[_0x1de9('0x32')](_0xa9c2a0[_0x1de9('0x2e')],_0x36abf1);}return _0x15a271[_0x1de9('0x1d')](_0x1de9('0x33'))[_0x1de9('0x30')](_0xa9c2a0,_0x3ae319);}});case'account_contact_lead':var _0x7152c1=_[_0x1de9('0x2c')](_0x171b0b);if(_0x27ca28[_0x1de9('0x34')]){var _0x20b6c7={};_0x20b6c7[_0x27ca28['additionalSearchAccount']]=_0x425624;_[_0x1de9('0x32')](_0x7152c1['$or'],_0x20b6c7);}return _0x15a271[_0x1de9('0x1d')]('Account')['find'](_0x7152c1,_0x3ae319)[_0x1de9('0x1f')]()[_0x1de9('0x20')](function(_0x475e91){if(_0x475e91&&_0x475e91[_0x1de9('0x21')]){return _0x475e91;}else{var _0xd5bfe2=_[_0x1de9('0x2c')](_0x171b0b);if(_0x27ca28[_0x1de9('0x2d')]){var _0x16f0ea={};_0x16f0ea[_0x27ca28[_0x1de9('0x2d')]]=_0x425624;_[_0x1de9('0x32')](_0xd5bfe2['$or'],_0x16f0ea);}return _0x15a271['sobject'](_0x1de9('0x2f'))[_0x1de9('0x30')](_0xd5bfe2,_0x3ae319)[_0x1de9('0x20')](function(_0x483c83){if(_0x483c83&&_0x483c83[_0x1de9('0x21')]){return _0x483c83;}else{var _0x5840da=_['cloneDeep'](_0x171b0b);if(_0x27ca28[_0x1de9('0x31')]){var _0x2eb4cd={};_0x2eb4cd[_0x27ca28[_0x1de9('0x31')]]=_0x425624;_[_0x1de9('0x32')](_0x5840da['$or'],_0x2eb4cd);}return _0x15a271[_0x1de9('0x1d')](_0x1de9('0x33'))['find'](_0x5840da,_0x3ae319);}});}});case'contact':var _0x185569=_[_0x1de9('0x2c')](_0x171b0b);if(_0x27ca28['additionalSearchContact']){var _0x20b6c7={};_0x20b6c7[_0x27ca28[_0x1de9('0x2d')]]=_0x425624;_[_0x1de9('0x32')](_0x185569[_0x1de9('0x2e')],_0x20b6c7);}return _0x15a271[_0x1de9('0x1d')](_0x1de9('0x2f'))[_0x1de9('0x30')](_0x185569,_0x3ae319)[_0x1de9('0x1f')]();case _0x1de9('0x1a'):var _0x4a523d=_[_0x1de9('0x2c')](_0x171b0b);if(_0x27ca28['additionalSearchLead']){var _0x20b6c7={};_0x20b6c7[_0x27ca28['additionalSearchLead']]=_0x425624;_[_0x1de9('0x32')](_0x4a523d['$or'],_0x20b6c7);}return _0x15a271[_0x1de9('0x1d')]('Lead')[_0x1de9('0x30')](_0x4a523d,_0x3ae319);case _0x1de9('0x16'):var _0x7152c1=_[_0x1de9('0x2c')](_0x171b0b);if(_0x27ca28['additionalSearchAccount']){var _0x20b6c7={};_0x20b6c7[_0x27ca28[_0x1de9('0x34')]]=_0x425624;_[_0x1de9('0x32')](_0x7152c1[_0x1de9('0x2e')],_0x20b6c7);}return _0x15a271[_0x1de9('0x1d')]('Account')[_0x1de9('0x30')](_0x7152c1,_0x3ae319);default:return null;}})['then'](function(_0x571867){if(_0x571867&&_0x571867[_0x1de9('0x21')]){var _0xf9a451=_[_0x1de9('0x35')](_0x571867);if(_0xf9a451){return BPromise[_0x1de9('0x24')]({'id':_0xf9a451['Id'],'name':_0xf9a451[_0x1de9('0x25')],'phone':_0xf9a451[_0x1de9('0x36')],'endUserType':_0xf9a451['attributes'][_0x1de9('0x37')][_0x1de9('0x38')]()});}}})['then'](function(_0x247ba8){if(_0x247ba8){logger[_0x1de9('0x1c')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x247ba8['endUserType'],_0x425624);return BPromise[_0x1de9('0x24')](_0x247ba8);}else{logger[_0x1de9('0x1c')](_0x1de9('0x39'),_0x425624);var _0x35d351={'Phone':_0x425624};if(_0x27ca28[_0x1de9('0x3a')]){if(_0x27ca28[_0x1de9('0x3a')]==='contact'){logger[_0x1de9('0x1c')](_0x1de9('0x3b'),_0x425624,_0x27ca28[_0x1de9('0x3a')]);_0x35d351[_0x1de9('0x3c')]=_0x382449!==''?_0x382449:util[_0x1de9('0x3d')](_0x1de9('0x3e'),_0x425624);}else if(_0x27ca28[_0x1de9('0x3a')]===_0x1de9('0x1a')){logger[_0x1de9('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x425624,_0x27ca28['moduleCreate']);_0x35d351[_0x1de9('0x3c')]=_0x382449!==_0x1de9('0x3f')?_0x382449:util[_0x1de9('0x3d')](_0x1de9('0x3e'),_0x425624);_0x35d351['Company']=_0x1de9('0x40');}else if(_0x27ca28[_0x1de9('0x3a')]==='account'){logger[_0x1de9('0x1c')](_0x1de9('0x3b'),_0x425624,_0x27ca28['moduleCreate']);_0x35d351[_0x1de9('0x25')]=_0x382449!==_0x1de9('0x3f')?_0x382449:util['format'](_0x1de9('0x3e'),_0x425624);}else{return null;}}return _0x15a271[_0x1de9('0x1d')](_[_0x1de9('0x41')](_0x27ca28[_0x1de9('0x3a')]))[_0x1de9('0x42')](_0x35d351)[_0x1de9('0x20')](function(_0x31f203){return BPromise[_0x1de9('0x24')]({'id':_0x31f203['id'],'endUserType':_0x27ca28['moduleCreate']});});}});}function getCustomFields(_0x350994,_0x348aa1){var _0x54c439={};if(_0x350994[_0x1de9('0x21')]>0x0){_[_0x1de9('0x43')](_0x350994,function(_0x11e2ed){if(_['includes']([_0x1de9('0x44'),_0x1de9('0x45')],_0x11e2ed[_0x1de9('0x37')])&&_0x11e2ed[_0x1de9('0x46')]){_0x54c439[_0x11e2ed['idField']]=_0x11e2ed['content']['toString']();}else if(_0x11e2ed[_0x1de9('0x37')]===_0x1de9('0x47')&&_0x11e2ed[_0x1de9('0x48')]&&_0x11e2ed[_0x1de9('0x46')]){_0x348aa1[_0x11e2ed[_0x1de9('0x48')]]&&(_0x54c439[_0x11e2ed[_0x1de9('0x46')]]=_0x348aa1[_0x11e2ed[_0x1de9('0x48')]]['toString']());}else if(_0x11e2ed[_0x1de9('0x37')]==='customVariable'&&_0x11e2ed[_0x1de9('0x49')]&&_0x11e2ed[_0x1de9('0x49')][_0x1de9('0x4a')]&&_0x11e2ed[_0x1de9('0x46')]){_0x348aa1[_0x11e2ed[_0x1de9('0x49')]['name'][_0x1de9('0x38')]()]&&(_0x54c439[_0x11e2ed[_0x1de9('0x46')]]=_0x348aa1[_0x11e2ed['Variable'][_0x1de9('0x4a')]['toLowerCase']()][_0x1de9('0x4b')]());}});}return _0x54c439;}function getConnection(_0x1a940b){var _0x23d99e=_0x1a940b[_0x1de9('0x4c')]['concat'](_0x1a940b[_0x1de9('0x4d')]);var _0x2313b8=new jsforce[(_0x1de9('0x4e'))]({'oauth2':{'loginUrl':_0x1a940b[_0x1de9('0x4f')]||_0x1de9('0x50'),'clientId':_0x1a940b['clientId'],'clientSecret':_0x1a940b['clientSecret']}});return _0x2313b8[_0x1de9('0x51')](_0x1a940b[_0x1de9('0x52')],_0x23d99e)[_0x1de9('0x20')](function(){logger[_0x1de9('0x1c')](_0x1de9('0x53'));return _0x2313b8;});}exports[_0x1de9('0x54')]=function(_0x2c6512,_0x75298e,_0x1ed7c3,_0x599169,_0x226144,_0x321a81){var _0x63e88,_0x1d7077,_0x3cd602,_0xc1db9;_0x321a81[_0x1de9('0x55')]=intUtil[_0x1de9('0x56')](_0x321a81[_0x1de9('0x55')]);_0x321a81['remoteUri']=intUtil['stripTrailingSlash'](_0x321a81[_0x1de9('0x4f')]);if(_0x226144&&_0x226144[_0x1de9('0x57')]){logger[_0x1de9('0x1c')]('[QUEUE]',_0x1de9('0x58'));_0x75298e[_0x1de9('0x59')]=util['format'](_0x1de9('0x5a'),_0x321a81[_0x1de9('0x55')],_0x75298e['uniqueid'],md5(_0x75298e[_0x1de9('0x5b')]));}else{_0x75298e['recordingURL']='';}return getConnection(_0x321a81)[_0x1de9('0x20')](function(_0x509d62){_0xc1db9=_0x509d62;return getUser(_0x321a81,_0x599169[_0x1de9('0x5c')],_0xc1db9);})[_0x1de9('0x20')](function(_0xccb8f5){_0x63e88=_0xccb8f5;return getEndUser(_0x321a81,_0x1ed7c3,_0x75298e['calleridname'],_0x75298e[_0x1de9('0x5d')],_0xc1db9);})['then'](function(_0x177475){_0x1d7077=_0x177475;return getTicket(_0x321a81,_0x63e88,_0x1d7077,_0x1ed7c3,_0x75298e,_0x1ed7c3['Fields'],_0xc1db9,'queue');})[_0x1de9('0x20')](function(_0x805e50){_0x3cd602=_0x805e50;logger[_0x1de9('0x1c')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x3cd602['id']);logger[_0x1de9('0x1c')](_0x1de9('0x5e'),_0x3cd602['id'],_0x599169[_0x1de9('0x4a')],_0x321a81['type']);switch(_0x321a81[_0x1de9('0x37')]){case'integrationTab':emit(util[_0x1de9('0x3d')](_0x1de9('0x5f'),_0x599169[_0x1de9('0x4a')]),_0x1de9('0x60'),{'recordId':_0x3cd602['id']});break;case _0x1de9('0x61'):emit(util[_0x1de9('0x3d')](_0x1de9('0x5f'),_0x599169[_0x1de9('0x4a')]),_0x1de9('0x62'),{'uri':util[_0x1de9('0x3d')]('%s/%s/e',_0xc1db9[_0x1de9('0x63')],_0x3cd602['id'])});break;default:logger[_0x1de9('0x64')](_0x1de9('0x65'));}})[_0x1de9('0x66')](function(_0x26d8a9){logger[_0x1de9('0x64')](_0x1de9('0x67'),_0x26d8a9);});};exports[_0x1de9('0x68')]=function(_0x265aba,_0x38ee09,_0x45c4e7,_0x2022d0,_0x7b4994,_0x565a70,_0x556543){var _0x2049c7,_0x5e46fd,_0x39470c,_0x5aee20;_0x565a70[_0x1de9('0x55')]=intUtil[_0x1de9('0x56')](_0x565a70['serverUrl']);_0x565a70[_0x1de9('0x4f')]=intUtil[_0x1de9('0x56')](_0x565a70['remoteUri']);if(_0x556543&&_0x556543['recordingFormat']&&_0x556543['recordingFormat']!==_0x1de9('0x69')){logger[_0x1de9('0x1c')](_0x1de9('0x6a'),_0x1de9('0x58'));_0x38ee09[_0x1de9('0x59')]=util[_0x1de9('0x3d')](_0x1de9('0x5a'),_0x565a70[_0x1de9('0x55')],_0x38ee09[_0x1de9('0x5b')],md5(_0x38ee09[_0x1de9('0x5b')]));}return getConnection(_0x565a70)[_0x1de9('0x20')](function(_0x4fd8a3){_0x5aee20=_0x4fd8a3;return getUser(_0x565a70,_0x2022d0[_0x1de9('0x5c')],_0x5aee20);})[_0x1de9('0x20')](function(_0x3ed469){_0x2049c7=_0x3ed469;return getEndUser(_0x565a70,_0x45c4e7,_0x38ee09[_0x1de9('0x6b')],_0x38ee09[_0x1de9('0x6c')],_0x5aee20);})[_0x1de9('0x20')](function(_0x440a14){_0x5e46fd=_0x440a14;return getTicket(_0x565a70,_0x2049c7,_0x5e46fd,_0x45c4e7,_0x38ee09,_0x45c4e7[_0x1de9('0x6d')],_0x5aee20,_0x1de9('0x68'));})[_0x1de9('0x20')](function(_0x323d8b){_0x39470c=_0x323d8b;logger['info'](_0x1de9('0x6e'),_0x39470c['id']);logger[_0x1de9('0x1c')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x39470c['id'],_0x2022d0[_0x1de9('0x4a')],_0x565a70[_0x1de9('0x37')]);switch(_0x565a70[_0x1de9('0x37')]){case _0x1de9('0x6f'):emit(util['format'](_0x1de9('0x5f'),_0x2022d0[_0x1de9('0x4a')]),_0x1de9('0x60'),{'recordId':_0x39470c['id']});break;case'newTab':emit(util[_0x1de9('0x3d')](_0x1de9('0x5f'),_0x2022d0[_0x1de9('0x4a')]),_0x1de9('0x62'),{'uri':util['format']('%s/%s/e',_0x5aee20[_0x1de9('0x63')],_0x39470c['id'])});break;default:logger['error'](_0x1de9('0x6a'),_0x1de9('0x70'));}})[_0x1de9('0x66')](function(_0xad8cab){logger['error']('[OUTBOUND]',_0xad8cab);});};exports['unmanaged']=function(_0x418deb,_0x4a0dea,_0x393a33,_0x2f6251,_0x2ea5d6,_0x27cbce){var _0x67017c,_0x1afdd7,_0x5a76c4,_0x730589;_0x27cbce[_0x1de9('0x55')]=intUtil['stripTrailingSlash'](_0x27cbce[_0x1de9('0x55')]);_0x27cbce[_0x1de9('0x4f')]=intUtil[_0x1de9('0x56')](_0x27cbce[_0x1de9('0x4f')]);if(_0x2ea5d6&&_0x2ea5d6['monitor_format']){logger[_0x1de9('0x1c')]('['+_0x4a0dea[_0x1de9('0x71')][_0x1de9('0x72')]()+']',_0x1de9('0x58'));_0x4a0dea[_0x1de9('0x59')]=util['format'](_0x1de9('0x5a'),_0x27cbce[_0x1de9('0x55')],_0x4a0dea[_0x1de9('0x5b')],md5(_0x4a0dea['uniqueid']));}else{_0x4a0dea[_0x1de9('0x59')]='';}return getConnection(_0x27cbce)[_0x1de9('0x20')](function(_0x4701f2){_0x730589=_0x4701f2;if(!_[_0x1de9('0x73')](_0x2f6251)){return getUser(_0x27cbce,_0x2f6251[_0x1de9('0x4a')],_0x730589);}else{return getUser(_0x27cbce,null,_0x730589);}})[_0x1de9('0x20')](function(_0x227b21){_0x67017c=_0x227b21;return getEndUser(_0x27cbce,_0x393a33,_0x4a0dea[_0x1de9('0x74')],_0x4a0dea[_0x1de9('0x5d')],_0x730589);})['then'](function(_0x18313c){_0x1afdd7=_0x18313c;return getTicket(_0x27cbce,_0x67017c,_0x1afdd7,_0x393a33,_0x4a0dea,_0x393a33['Fields'],_0x730589);})['then'](function(_0x479cc2){_0x5a76c4=_0x479cc2;logger[_0x1de9('0x1c')]('['+_0x4a0dea[_0x1de9('0x71')][_0x1de9('0x72')]()+_0x1de9('0x75'),_0x5a76c4['id']);logger[_0x1de9('0x1c')]('['+_0x4a0dea['lastevent'][_0x1de9('0x72')]()+_0x1de9('0x76'),_0x27cbce[_0x1de9('0x37')]);})[_0x1de9('0x66')](function(_0x48e0d8){logger[_0x1de9('0x64')]('['+_0x4a0dea[_0x1de9('0x71')]['toUpperCase']()+']',_0x48e0d8);});}; \ 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 e9d734e..cb2a3b4 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 _0xf98a=['sys_id','toUpperCase','],\x20getAdminUser\x20crm','error','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm','catch','message',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','forEach','includes','string','type','nameField','customField','toLowerCase','toString','idField','content','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','ticketNumber',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','map','%26sysparm_record_target%3Dincident','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','stripTrailingSlash','serverUrl','remoteUri','isNil','email','destcalleridnum','queue','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','lodash','bluebird','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId'];(function(_0x254081,_0x20731a){var _0x5d1e2a=function(_0x597854){while(--_0x597854){_0x254081['push'](_0x254081['shift']());}};_0x5d1e2a(++_0x20731a);}(_0xf98a,0x184));var _0xaf98=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0xf98a[_0x11a55c];return _0x26c390;};'use strict';var _=require(_0xaf98('0x0'));var Promise=require(_0xaf98('0x1'));var rp=require(_0xaf98('0x2'));var util=require(_0xaf98('0x3'));var md5=require('md5');var Redis=require(_0xaf98('0x4'));var intUtil=require(_0xaf98('0x5'));var config=require(_0xaf98('0x6'));var logger=require(_0xaf98('0x7'))(_0xaf98('0x8'));config[_0xaf98('0x9')]=_['defaults'](config[_0xaf98('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaf98('0x9')]));function getAdminUser(_0x4a6278,_0x48a991,_0x59d1ca,_0x5db204,_0x35e34c,_0x5a2fc8){return new Promise(function(_0x971cb2,_0xdcb469){var _0x4b18fb={'method':_0xaf98('0xa'),'uri':_0x5db204+_0xaf98('0xb')+'&'+_0x35e34c+'&'+_0x5a2fc8,'auth':_0x48a991,'json':!![]};return rp(_0x4b18fb)[_0xaf98('0xc')](function(_0x1c8c77){if(_0x1c8c77[_0xaf98('0xd')][_0xaf98('0xe')]>0x0){_0x59d1ca[_0xaf98('0xf')]=_0x1c8c77[_0xaf98('0xd')][0x0][_0xaf98('0x10')];}logger['info']('['+[_0x4a6278[_0xaf98('0x11')]()]+_0xaf98('0x12'),_0x59d1ca);_0x971cb2(_0x59d1ca);})['catch'](function(_0x587d14){logger[_0xaf98('0x13')]('['+[_0x4a6278[_0xaf98('0x11')]()]+']',_0x587d14['message']);_0xdcb469(_0x587d14['message']);});});}function getUser(_0x576883,_0x390020,_0x136ff9,_0x51bb0,_0x273498){return function(_0x4dce21){logger[_0xaf98('0x14')]('['+[_0x576883[_0xaf98('0x11')]()]+_0xaf98('0x15'),_0x4dce21);return new Promise(function(_0x404a2b,_0x2274ff){if(intUtil[_0xaf98('0x16')](_0x4dce21[_0xaf98('0x17')])){var _0x30f13d={'method':'GET','uri':_0x136ff9+_0xaf98('0x18')+_0x4dce21['userEmail']+'&'+_0x51bb0+'&'+_0x273498,'auth':_0x390020,'json':!![]};logger[_0xaf98('0x14')]('['+[_0x576883[_0xaf98('0x11')]()]+'],\x20getUser\x20rp\x20obj',_0x30f13d);return rp(_0x30f13d)['then'](function(_0xaf3fdc){logger['info']('['+[_0x576883['toUpperCase']()]+_0xaf98('0x19'),_0xaf3fdc);if(_0xaf3fdc[_0xaf98('0xd')][_0xaf98('0xe')]>0x0&&String(_0xaf3fdc[_0xaf98('0xd')][0x0][_0xaf98('0x1a')])===_0xaf98('0x1b')){_0x4dce21[_0xaf98('0x1c')]=_0xaf3fdc['result'][0x0][_0xaf98('0x10')];}else{_0x4dce21[_0xaf98('0x1c')]=_0x4dce21[_0xaf98('0xf')];_0x4dce21[_0xaf98('0x17')]=_0x4dce21[_0xaf98('0x1d')];}logger[_0xaf98('0x14')]('['+[_0x576883['toUpperCase']()]+_0xaf98('0x1e'),_0x4dce21);_0x404a2b(_0x4dce21);})[_0xaf98('0x1f')](function(_0x4cb1a0){logger[_0xaf98('0x13')]('['+[_0x576883[_0xaf98('0x11')]()]+']',_0x4cb1a0[_0xaf98('0x20')]);_0x2274ff(_0x4cb1a0[_0xaf98('0x20')]);});}else{logger[_0xaf98('0x14')]('['+[_0x576883[_0xaf98('0x11')]()]+_0xaf98('0x21'));_0x4dce21[_0xaf98('0x1c')]=_0x4dce21[_0xaf98('0xf')];_0x4dce21[_0xaf98('0x17')]=_0x4dce21[_0xaf98('0x1d')];_0x404a2b(_0x4dce21);}});};}function createEndUser(_0x24a12b,_0x34b0fb,_0x472eb0,_0x3d54c8,_0xa5b73a){logger[_0xaf98('0x14')]('['+[_0x24a12b['toUpperCase']()]+_0xaf98('0x22'),_0x472eb0);return new Promise(function(_0x3e0915,_0x58c350){var _0x17b581={'method':'POST','uri':_0x3d54c8+'sys_user?'+_0xa5b73a,'body':{'user_name':_0x472eb0[_0xaf98('0x23')],'roles':_0xaf98('0x24'),'first_name':_0x472eb0[_0xaf98('0x23')],'active':_0xaf98('0x1b'),'date_format':_0xaf98('0x25'),'phone':_0x472eb0[_0xaf98('0x23')]},'auth':_0x34b0fb,'json':!![]};return rp(_0x17b581)['then'](function(_0xa7509a){logger[_0xaf98('0x14')]('['+[_0x24a12b['toUpperCase']()]+_0xaf98('0x26'),_0xa7509a[_0xaf98('0xd')]);_0x472eb0[_0xaf98('0x27')]=_0xa7509a[_0xaf98('0xd')]['sys_id'];_0x3e0915(_0x472eb0);})[_0xaf98('0x1f')](function(_0x1c508d){logger[_0xaf98('0x13')]('['+[_0x24a12b['toUpperCase']()]+']',_0x1c508d[_0xaf98('0x20')]);_0x58c350(_0x1c508d[_0xaf98('0x20')]);});});}function getEndUser(_0x4fc576,_0x584a6c,_0x374533,_0x5c3850,_0x18edda){return function(_0x1f99a5){logger[_0xaf98('0x14')]('['+[_0x4fc576[_0xaf98('0x11')]()]+_0xaf98('0x28'),_0x1f99a5);return new Promise(function(_0x2422cd,_0x5e6b93){var _0x2d647c={'method':_0xaf98('0xa'),'uri':_0x374533+_0xaf98('0x29')+_0x1f99a5['endUserNumber']+'&'+_0x5c3850+'&'+_0x18edda,'auth':_0x584a6c,'json':!![]};return rp(_0x2d647c)[_0xaf98('0xc')](function(_0x5b76bd){if(_0x5b76bd[_0xaf98('0xd')][_0xaf98('0xe')]>0x0){_0x1f99a5[_0xaf98('0x27')]=_0x5b76bd[_0xaf98('0xd')][0x0][_0xaf98('0x10')];logger[_0xaf98('0x14')]('['+[_0x4fc576[_0xaf98('0x11')]()]+'],\x20getEndUser\x20crm',_0x1f99a5);_0x2422cd(_0x1f99a5);}else{return createEndUser(_0x4fc576,_0x584a6c,_0x1f99a5,_0x374533,_0x5c3850)[_0xaf98('0xc')](function(_0xe0ee58){logger[_0xaf98('0x14')]('['+[_0x4fc576[_0xaf98('0x11')]()]+'],\x20createEndUser\x20crm',_0xe0ee58);_0x2422cd(_0xe0ee58);});}})[_0xaf98('0x1f')](function(_0x5cd370){logger[_0xaf98('0x13')]('['+[_0x4fc576['toUpperCase']()]+']',_0x5cd370[_0xaf98('0x20')]);_0x5e6b93(_0x5cd370[_0xaf98('0x20')]);});});};}function getCustomFields(_0x139bcc,_0x2c4ab3){var _0x526ca8={};if(_0x139bcc['length']>0x0){_[_0xaf98('0x2a')](_0x139bcc,function(_0x470fd0){if(_[_0xaf98('0x2b')]([_0xaf98('0x2c'),'picklist'],_0x470fd0[_0xaf98('0x2d')])&&_0x470fd0[_0xaf98('0x2e')]&&!_0x470fd0[_0xaf98('0x2f')]){_0x526ca8[_0x470fd0[_0xaf98('0x2e')][_0xaf98('0x30')]()]=_0x470fd0['content'][_0xaf98('0x31')]();}else if(_['includes']([_0xaf98('0x2c'),'picklist'],_0x470fd0[_0xaf98('0x2d')])&&_0x470fd0['idField']&&_0x470fd0[_0xaf98('0x2f')]){_0x526ca8[_0x470fd0[_0xaf98('0x32')][_0xaf98('0x30')]()]=_0x470fd0[_0xaf98('0x33')][_0xaf98('0x31')]();}else if(_0x470fd0['type']===_0xaf98('0x34')&&_0x470fd0[_0xaf98('0x35')]&&_0x470fd0[_0xaf98('0x32')]&&_0x470fd0['customField']){_0x526ca8[_0x470fd0[_0xaf98('0x32')][_0xaf98('0x30')]()]=_0x2c4ab3[_0x470fd0['variableName']][_0xaf98('0x31')]();}else if(_0x470fd0[_0xaf98('0x2d')]===_0xaf98('0x36')&&_0x470fd0[_0xaf98('0x37')]&&_0x470fd0[_0xaf98('0x37')]['name']&&_0x470fd0[_0xaf98('0x32')]&&_0x470fd0[_0xaf98('0x2f')]){_0x526ca8[_0x470fd0['idField'][_0xaf98('0x30')]()]=_0x2c4ab3[_0x470fd0[_0xaf98('0x37')][_0xaf98('0x38')]['toLowerCase']()][_0xaf98('0x31')]();}});}return _0x526ca8;}function getTicket(_0x7005f5,_0x4f0463,_0x2fec80,_0x2fa976,_0x3a1a5d,_0xcffc58){return function(_0x3f4f0e){logger['info']('['+[_0x7005f5[_0xaf98('0x11')]()]+_0xaf98('0x39'),_0x3f4f0e);return new Promise(function(_0x1f742f,_0x1b5c78){var _0x52a0e9=_0x7005f5[_0xaf98('0x30')]()===_0xaf98('0x3a')?_0x3f4f0e['userId']:_0x3f4f0e[_0xaf98('0x27')];var _0x271501={'method':_0xaf98('0x3b'),'uri':_0x2fec80+_0xaf98('0x3c')+'?'+_0xcffc58,'body':Object['assign']({},{'active':_0xaf98('0x1b'),'caller_id':_0x52a0e9,'assigned_to':_0x3f4f0e['userId'],'short_description':intUtil[_0xaf98('0x3d')](_0x2fa976['Subjects'],_0x3a1a5d,'\x20'),'description':intUtil[_0xaf98('0x3d')](_0x2fa976[_0xaf98('0x3e')],_0x3a1a5d,'\x0a')},getCustomFields(_0x2fa976[_0xaf98('0x3f')],_0x3a1a5d)),'auth':_0x4f0463,'json':!![]};return rp(_0x271501)[_0xaf98('0xc')](function(_0x525b2f){logger['info']('['+[_0x7005f5[_0xaf98('0x11')]()]+_0xaf98('0x40'),_0x525b2f[_0xaf98('0xd')]);_0x3f4f0e[_0xaf98('0x41')]=_0x525b2f[_0xaf98('0xd')][_0xaf98('0x10')];_0x3f4f0e['ticketNumber']=_0x525b2f[_0xaf98('0xd')][_0xaf98('0x42')];logger[_0xaf98('0x14')]('['+[_0x7005f5[_0xaf98('0x11')]()]+']\x20getTicket\x20crm',_0x3f4f0e);_0x1f742f(_0x3f4f0e);})['catch'](function(_0x7358d7){logger[_0xaf98('0x13')]('['+[_0x7005f5[_0xaf98('0x11')]()]+']',_0x7358d7[_0xaf98('0x20')]);_0x1b5c78(_0x7358d7[_0xaf98('0x20')]);});});};}function createRemoteTag(_0x481a13,_0x319bbb,_0x539885,_0xbadaa0){return new Promise(function(_0x6ce548,_0x270ab9){var _0x37be91={'method':_0xaf98('0x3b'),'uri':_0x539885+_0xaf98('0x43')+'?'+_0xbadaa0,'body':{'short_description':_0x481a13,'global':!![],'active':!![],'name':_0x481a13},'auth':_0x319bbb,'json':!![]};return rp(_0x37be91)[_0xaf98('0xc')](function(_0x213889){var _0x33613b=_0x213889['result'][_0xaf98('0x10')];_0x6ce548(_0x33613b);});});}function getRemoteTag(_0x415dc4,_0x28717a,_0x556984,_0x133fe7,_0x682854){return new Promise(function(_0x3be661,_0x126fa7){var _0x54d55b={'method':_0xaf98('0xa'),'uri':_0x556984+_0xaf98('0x43')+_0xaf98('0x44')+_0x415dc4+'&'+_0x133fe7,'auth':_0x28717a,'json':!![]};return rp(_0x54d55b)[_0xaf98('0xc')](function(_0x2b83a9){if(_0x2b83a9[_0xaf98('0xd')][_0xaf98('0xe')]>0x0){var _0x2ae0d5=_0x2b83a9['result'][0x0]['sys_id'];_0x3be661(_0x2ae0d5);}else{return createRemoteTag(_0x415dc4,_0x28717a,_0x556984,_0x133fe7)['then'](function(_0x21e856){_0x3be661(_0x21e856);});}});});}function assignTagToIncident(_0x507da8,_0x377b8c,_0x1983d5,_0x14a699,_0x22e4e5){return new Promise(function(_0x5e9f2f,_0x5ea97a){var _0x4a40f8={'method':'POST','uri':_0x1983d5+_0xaf98('0x45')+'?'+_0x22e4e5,'body':{'label':_0x507da8,'table':_0xaf98('0x3c'),'id_type':_0xaf98('0x46'),'table_key':_0x14a699['ticketId'],'title':_0xaf98('0x47')+_0x14a699[_0xaf98('0x48')],'id_display':_0x14a699['ticketNumber']},'auth':_0x377b8c,'json':!![]};return rp(_0x4a40f8)['then'](function(_0xb1faa2){_0x5e9f2f();})[_0xaf98('0x1f')](function(){_0x5e9f2f();});});}function manageTags(_0x21063b,_0x1e5028,_0x433a87,_0x5aa3c2,_0x48aea8,_0x3f399f,_0x4ccdc3){return new Promise(function(_0x330330,_0x2e1c53){var _0x5dc0a5=[];_0x1e5028[_0xaf98('0x2a')](function(_0x5b3e6b){_0x5dc0a5['push'](getRemoteTag(_0x5b3e6b,_0x433a87,_0x5aa3c2,_0x3f399f,_0x4ccdc3));});return Promise['all'](_0x5dc0a5)[_0xaf98('0xc')](function(_0x5d1f3b){if(_0x5d1f3b[_0xaf98('0xe')]){logger['info']('['+[_0x21063b[_0xaf98('0x11')]()]+_0xaf98('0x49'),_0x5d1f3b);var _0x3c3a60=[];_0x5d1f3b[_0xaf98('0x2a')](function(_0x4353dd){_0x3c3a60['push'](assignTagToIncident(_0x4353dd,_0x433a87,_0x5aa3c2,_0x48aea8,_0x3f399f));});return Promise[_0xaf98('0x4a')](_0x3c3a60)['then'](function(){_0x330330();})['catch'](function(){_0x330330();});}else{_0x330330();}});});}function getTags(_0x415f51,_0x20a8e4,_0x2355d5,_0x2285dd,_0x46ab28,_0x2dd8f9){return function(_0x5f5569){return new Promise(function(_0x19ee38,_0x5c4484){var _0x174f2d=[];var _0x21975e=_0x2285dd[_0xaf98('0x4b')];if(_0x21975e&&_0x21975e[_0xaf98('0xe')]>0x0){_0x174f2d=_[_0xaf98('0x4c')](_0x21975e,'name');}if(_0x174f2d[_0xaf98('0xe')]>0x0){return manageTags(_0x415f51,_0x174f2d,_0x20a8e4,_0x2355d5,_0x5f5569,_0x46ab28,_0x2dd8f9)[_0xaf98('0xc')](function(){_0x19ee38(_0x5f5569);});}else{_0x19ee38(_0x5f5569);}});};}function emit(_0x260b66,_0x5bf964,_0xa452d){var _0x3a4c1c=_0xaf98('0x4d')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xaf98('0x4e');var _0x379d92={'uri':_0x260b66+_0xaf98('0x4f')+_0xa452d+_0x3a4c1c};io['to'](util[_0xaf98('0x50')](_0xaf98('0x51'),_0x5bf964))[_0xaf98('0x52')](_0xaf98('0x53'),_0x379d92);}exports['cs']=function(_0x1c171a,_0x434f4e,_0x26f046,_0xed4989,_0x57b80b,_0x21594c,_0x1b197d,_0x1c26a4){var _0x34efe7={};var _0x2673ec={'user':_0x21594c[_0xaf98('0x54')],'pass':_0x21594c['password']};var _0x364b0c=_0xaf98('0x55');var _0x28bafe='sysparm_display_value=true';_0x21594c['remoteUri']=intUtil[_0xaf98('0x56')](_0x21594c['remoteUri']);_0x21594c[_0xaf98('0x57')]=intUtil['stripTrailingSlash'](_0x21594c[_0xaf98('0x57')]);var _0x1406ae=util[_0xaf98('0x50')]('%s/api/now/table/',_0x21594c[_0xaf98('0x58')]);_0x34efe7[_0xaf98('0x17')]=!_[_0xaf98('0x59')](_0xed4989)?_0xed4989[_0xaf98('0x5a')]:null;_0x34efe7[_0xaf98('0x1d')]=_0x21594c[_0xaf98('0x5a')];_0x34efe7[_0xaf98('0x23')]=_0x1c26a4[_0xaf98('0x30')]()==='outbound'?_0x434f4e[_0xaf98('0x5b')]:_0x434f4e['calleridnum'];_0x34efe7['callDirection']=_0x1c26a4===_0xaf98('0x5c')||_0x1c26a4==='unmanaged'?'queue':_0xaf98('0x3a');var _0x1b48b7=util[_0xaf98('0x50')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x21594c[_0xaf98('0x57')],_0x434f4e[_0xaf98('0x5d')],md5(_0x434f4e['uniqueid']));if(_0x57b80b&&_0x57b80b['monitor_format']){logger[_0xaf98('0x14')](_0xaf98('0x5e'),_0xaf98('0x5f'));_0x434f4e[_0xaf98('0x60')]=_0x1b48b7;}else if(_0x1b197d&&_0x1b197d[_0xaf98('0x61')]&&_0x1b197d[_0xaf98('0x61')]!=='none'){logger[_0xaf98('0x14')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x434f4e['recordingURL']=_0x1b48b7;}else{_0x434f4e['recordingURL']='';}return getAdminUser(_0x1c26a4,_0x2673ec,_0x34efe7,_0x1406ae,_0x28bafe,_0x364b0c)[_0xaf98('0xc')](getUser(_0x1c26a4,_0x2673ec,_0x1406ae,_0x28bafe,_0x364b0c))[_0xaf98('0xc')](getEndUser(_0x1c26a4,_0x2673ec,_0x1406ae,_0x28bafe,_0x364b0c))[_0xaf98('0xc')](getTicket(_0x1c26a4,_0x2673ec,_0x1406ae,_0x26f046,_0x434f4e,_0x28bafe))[_0xaf98('0xc')](function(_0x584d86){logger[_0xaf98('0x14')](util[_0xaf98('0x50')](_0xaf98('0x62'),_0x584d86[_0xaf98('0x41')]));logger[_0xaf98('0x14')](util['format'](_0xaf98('0x63'),_0x1c26a4));if(_0x1c26a4!==_0xaf98('0x64')){logger[_0xaf98('0x14')]('['+[_0x1c26a4[_0xaf98('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x21594c[_0xaf98('0x58')],_0xed4989[_0xaf98('0x38')],_0x584d86[_0xaf98('0x41')]);}})[_0xaf98('0x1f')](function(_0x19c0f1){logger[_0xaf98('0x13')]('['+[_0x1c26a4[_0xaf98('0x11')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util['inspect'](_0x19c0f1,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xcf32=['Variable','name',']\x20getTicket\x20input\x20crm','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','incident',']\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','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','ioredis','./util','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','active','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','content','idField','toLowerCase','toString','variableName','customVariable'];(function(_0x37358a,_0x4f1d21){var _0x511fbc=function(_0x5e6b75){while(--_0x5e6b75){_0x37358a['push'](_0x37358a['shift']());}};_0x511fbc(++_0x4f1d21);}(_0xcf32,0xa0));var _0x2cf3=function(_0xe2ebaa,_0x138483){_0xe2ebaa=_0xe2ebaa-0x0;var _0x563838=_0xcf32[_0xe2ebaa];return _0x563838;};'use strict';var _=require(_0x2cf3('0x0'));var Promise=require(_0x2cf3('0x1'));var rp=require(_0x2cf3('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0x2cf3('0x3'));var intUtil=require(_0x2cf3('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('servicenow');config[_0x2cf3('0x5')]=_[_0x2cf3('0x6')](config[_0x2cf3('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x2cf3('0x7'))(new Redis(config[_0x2cf3('0x5')]));function getAdminUser(_0x5aaccf,_0x483a35,_0x156b36,_0x4a110c,_0x3ed89e,_0x36d98b){return new Promise(function(_0x442a6b,_0xa611ba){var _0x50c0ba={'method':_0x2cf3('0x8'),'uri':_0x4a110c+_0x2cf3('0x9')+'&'+_0x3ed89e+'&'+_0x36d98b,'auth':_0x483a35,'json':!![]};return rp(_0x50c0ba)[_0x2cf3('0xa')](function(_0x2a72f9){if(_0x2a72f9[_0x2cf3('0xb')][_0x2cf3('0xc')]>0x0){_0x156b36[_0x2cf3('0xd')]=_0x2a72f9[_0x2cf3('0xb')][0x0][_0x2cf3('0xe')];}logger[_0x2cf3('0xf')]('['+[_0x5aaccf['toUpperCase']()]+'],\x20getAdminUser\x20crm',_0x156b36);_0x442a6b(_0x156b36);})[_0x2cf3('0x10')](function(_0x401eed){logger[_0x2cf3('0x11')]('['+[_0x5aaccf[_0x2cf3('0x12')]()]+']',_0x401eed[_0x2cf3('0x13')]);_0xa611ba(_0x401eed[_0x2cf3('0x13')]);});});}function getUser(_0x1587b9,_0x640792,_0x133f56,_0x12c230,_0x4c64fc){return function(_0x458c11){logger[_0x2cf3('0xf')]('['+[_0x1587b9[_0x2cf3('0x12')]()]+_0x2cf3('0x14'),_0x458c11);return new Promise(function(_0x31059a,_0x4a60c0){if(intUtil['validateEmail'](_0x458c11[_0x2cf3('0x15')])){var _0x4a7e35={'method':_0x2cf3('0x8'),'uri':_0x133f56+_0x2cf3('0x16')+_0x458c11[_0x2cf3('0x15')]+'&'+_0x12c230+'&'+_0x4c64fc,'auth':_0x640792,'json':!![]};logger[_0x2cf3('0xf')]('['+[_0x1587b9['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0x4a7e35);return rp(_0x4a7e35)['then'](function(_0x232533){logger[_0x2cf3('0xf')]('['+[_0x1587b9[_0x2cf3('0x12')]()]+_0x2cf3('0x17'),_0x232533);if(_0x232533[_0x2cf3('0xb')]['length']>0x0&&String(_0x232533[_0x2cf3('0xb')][0x0][_0x2cf3('0x18')])==='true'){_0x458c11[_0x2cf3('0x19')]=_0x232533[_0x2cf3('0xb')][0x0][_0x2cf3('0xe')];}else{_0x458c11['userId']=_0x458c11[_0x2cf3('0xd')];_0x458c11['userEmail']=_0x458c11[_0x2cf3('0x1a')];}logger['info']('['+[_0x1587b9[_0x2cf3('0x12')]()]+_0x2cf3('0x1b'),_0x458c11);_0x31059a(_0x458c11);})['catch'](function(_0x2930ef){logger[_0x2cf3('0x11')]('['+[_0x1587b9[_0x2cf3('0x12')]()]+']',_0x2930ef['message']);_0x4a60c0(_0x2930ef['message']);});}else{logger[_0x2cf3('0xf')]('['+[_0x1587b9[_0x2cf3('0x12')]()]+_0x2cf3('0x1c'));_0x458c11[_0x2cf3('0x19')]=_0x458c11['adminId'];_0x458c11[_0x2cf3('0x15')]=_0x458c11['adminEmail'];_0x31059a(_0x458c11);}});};}function createEndUser(_0x7711ff,_0x2f507d,_0x4096b8,_0x5a7470,_0x1fe902){logger[_0x2cf3('0xf')]('['+[_0x7711ff['toUpperCase']()]+_0x2cf3('0x1d'),_0x4096b8);return new Promise(function(_0x1215e1,_0x57f9a2){var _0x1bb6d2={'method':_0x2cf3('0x1e'),'uri':_0x5a7470+_0x2cf3('0x1f')+_0x1fe902,'body':{'user_name':_0x4096b8['endUserNumber'],'roles':_0x2cf3('0x20'),'first_name':_0x4096b8[_0x2cf3('0x21')],'active':_0x2cf3('0x22'),'date_format':_0x2cf3('0x23'),'phone':_0x4096b8['endUserNumber']},'auth':_0x2f507d,'json':!![]};return rp(_0x1bb6d2)[_0x2cf3('0xa')](function(_0x499fc1){logger[_0x2cf3('0xf')]('['+[_0x7711ff[_0x2cf3('0x12')]()]+_0x2cf3('0x24'),_0x499fc1[_0x2cf3('0xb')]);_0x4096b8[_0x2cf3('0x25')]=_0x499fc1['result'][_0x2cf3('0xe')];_0x1215e1(_0x4096b8);})['catch'](function(_0x3e0cfa){logger[_0x2cf3('0x11')]('['+[_0x7711ff[_0x2cf3('0x12')]()]+']',_0x3e0cfa[_0x2cf3('0x13')]);_0x57f9a2(_0x3e0cfa[_0x2cf3('0x13')]);});});}function getEndUser(_0x21a6b2,_0x270241,_0x47a3e7,_0x5dfcea,_0x58ac29){return function(_0x1d8b96){logger[_0x2cf3('0xf')]('['+[_0x21a6b2[_0x2cf3('0x12')]()]+_0x2cf3('0x26'),_0x1d8b96);return new Promise(function(_0x132318,_0x3472ae){var _0x5ebe5b={'method':_0x2cf3('0x8'),'uri':_0x47a3e7+'sys_user?sysparm_query=phone%3D'+_0x1d8b96['endUserNumber']+'&'+_0x5dfcea+'&'+_0x58ac29,'auth':_0x270241,'json':!![]};return rp(_0x5ebe5b)[_0x2cf3('0xa')](function(_0x182de8){if(_0x182de8[_0x2cf3('0xb')][_0x2cf3('0xc')]>0x0){_0x1d8b96['endUserId']=_0x182de8['result'][0x0][_0x2cf3('0xe')];logger[_0x2cf3('0xf')]('['+[_0x21a6b2[_0x2cf3('0x12')]()]+_0x2cf3('0x27'),_0x1d8b96);_0x132318(_0x1d8b96);}else{return createEndUser(_0x21a6b2,_0x270241,_0x1d8b96,_0x47a3e7,_0x5dfcea)[_0x2cf3('0xa')](function(_0x1ac252){logger[_0x2cf3('0xf')]('['+[_0x21a6b2[_0x2cf3('0x12')]()]+_0x2cf3('0x28'),_0x1ac252);_0x132318(_0x1ac252);});}})[_0x2cf3('0x10')](function(_0x37ece0){logger[_0x2cf3('0x11')]('['+[_0x21a6b2[_0x2cf3('0x12')]()]+']',_0x37ece0['message']);_0x3472ae(_0x37ece0['message']);});});};}function getCustomFields(_0x4607bc,_0x37e487){var _0x49efba={};if(_0x4607bc['length']>0x0){_[_0x2cf3('0x29')](_0x4607bc,function(_0x1b6846){if(_[_0x2cf3('0x2a')]([_0x2cf3('0x2b'),_0x2cf3('0x2c')],_0x1b6846[_0x2cf3('0x2d')])&&_0x1b6846[_0x2cf3('0x2e')]&&!_0x1b6846[_0x2cf3('0x2f')]){_0x49efba[_0x1b6846[_0x2cf3('0x2e')]['toLowerCase']()]=_0x1b6846[_0x2cf3('0x30')]['toString']();}else if(_[_0x2cf3('0x2a')]([_0x2cf3('0x2b'),_0x2cf3('0x2c')],_0x1b6846[_0x2cf3('0x2d')])&&_0x1b6846[_0x2cf3('0x31')]&&_0x1b6846['customField']){_0x49efba[_0x1b6846['idField'][_0x2cf3('0x32')]()]=_0x1b6846[_0x2cf3('0x30')][_0x2cf3('0x33')]();}else if(_0x1b6846[_0x2cf3('0x2d')]==='variable'&&_0x1b6846[_0x2cf3('0x34')]&&_0x1b6846[_0x2cf3('0x31')]&&_0x1b6846[_0x2cf3('0x2f')]){_0x49efba[_0x1b6846['idField'][_0x2cf3('0x32')]()]=_0x37e487[_0x1b6846[_0x2cf3('0x34')]][_0x2cf3('0x33')]();}else if(_0x1b6846['type']===_0x2cf3('0x35')&&_0x1b6846['Variable']&&_0x1b6846[_0x2cf3('0x36')][_0x2cf3('0x37')]&&_0x1b6846[_0x2cf3('0x31')]&&_0x1b6846[_0x2cf3('0x2f')]){_0x49efba[_0x1b6846['idField'][_0x2cf3('0x32')]()]=_0x37e487[_0x1b6846['Variable'][_0x2cf3('0x37')]['toLowerCase']()][_0x2cf3('0x33')]();}});}return _0x49efba;}function getTicket(_0x3b8642,_0x19dea3,_0x1aa90b,_0x1c5402,_0x31ef6e,_0x593ddd){return function(_0x596c31){logger[_0x2cf3('0xf')]('['+[_0x3b8642[_0x2cf3('0x12')]()]+_0x2cf3('0x38'),_0x596c31);return new Promise(function(_0x26010c,_0xee82f3){var _0x3c6775=_0x3b8642[_0x2cf3('0x32')]()==='outbound'?_0x596c31[_0x2cf3('0x19')]:_0x596c31[_0x2cf3('0x25')];var _0x5c19a6={'method':_0x2cf3('0x1e'),'uri':_0x1aa90b+'incident'+'?'+_0x593ddd,'body':Object[_0x2cf3('0x39')]({},{'active':_0x2cf3('0x22'),'caller_id':_0x3c6775,'assigned_to':_0x596c31[_0x2cf3('0x19')],'short_description':intUtil[_0x2cf3('0x3a')](_0x1c5402[_0x2cf3('0x3b')],_0x31ef6e,'\x20'),'description':intUtil[_0x2cf3('0x3a')](_0x1c5402[_0x2cf3('0x3c')],_0x31ef6e,'\x0a')},getCustomFields(_0x1c5402[_0x2cf3('0x3d')],_0x31ef6e)),'auth':_0x19dea3,'json':!![]};return rp(_0x5c19a6)[_0x2cf3('0xa')](function(_0x48ccb6){logger[_0x2cf3('0xf')]('['+[_0x3b8642['toUpperCase']()]+_0x2cf3('0x3e'),_0x48ccb6[_0x2cf3('0xb')]);_0x596c31[_0x2cf3('0x3f')]=_0x48ccb6['result']['sys_id'];_0x596c31[_0x2cf3('0x40')]=_0x48ccb6[_0x2cf3('0xb')][_0x2cf3('0x41')];logger['info']('['+[_0x3b8642[_0x2cf3('0x12')]()]+_0x2cf3('0x42'),_0x596c31);_0x26010c(_0x596c31);})['catch'](function(_0x1ab859){logger[_0x2cf3('0x11')]('['+[_0x3b8642['toUpperCase']()]+']',_0x1ab859[_0x2cf3('0x13')]);_0xee82f3(_0x1ab859['message']);});});};}function createRemoteTag(_0x2ac68c,_0x3e526a,_0x2ccb08,_0x28004f){return new Promise(function(_0x452079,_0xdf37ba){var _0x2e90c2={'method':_0x2cf3('0x1e'),'uri':_0x2ccb08+_0x2cf3('0x43')+'?'+_0x28004f,'body':{'short_description':_0x2ac68c,'global':!![],'active':!![],'name':_0x2ac68c},'auth':_0x3e526a,'json':!![]};return rp(_0x2e90c2)[_0x2cf3('0xa')](function(_0x5793ba){var _0x337e6b=_0x5793ba[_0x2cf3('0xb')][_0x2cf3('0xe')];_0x452079(_0x337e6b);});});}function getRemoteTag(_0x57ca19,_0x38e509,_0x50c448,_0x241b58,_0x9dac19){return new Promise(function(_0x51bb2e,_0x22e5e2){var _0x5e0ffc={'method':_0x2cf3('0x8'),'uri':_0x50c448+_0x2cf3('0x43')+'?sysparm_query=name%3D'+_0x57ca19+'&'+_0x241b58,'auth':_0x38e509,'json':!![]};return rp(_0x5e0ffc)[_0x2cf3('0xa')](function(_0x3f6ea3){if(_0x3f6ea3[_0x2cf3('0xb')][_0x2cf3('0xc')]>0x0){var _0x1bc72a=_0x3f6ea3[_0x2cf3('0xb')][0x0][_0x2cf3('0xe')];_0x51bb2e(_0x1bc72a);}else{return createRemoteTag(_0x57ca19,_0x38e509,_0x50c448,_0x241b58)['then'](function(_0x3ff504){_0x51bb2e(_0x3ff504);});}});});}function assignTagToIncident(_0x4ecaa0,_0x38559e,_0x5b561f,_0x2a4002,_0x3618aa){return new Promise(function(_0x2d7686,_0x5e6382){var _0x21bfc8={'method':_0x2cf3('0x1e'),'uri':_0x5b561f+_0x2cf3('0x44')+'?'+_0x3618aa,'body':{'label':_0x4ecaa0,'table':_0x2cf3('0x45'),'id_type':'Incident','table_key':_0x2a4002[_0x2cf3('0x3f')],'title':'Incident\x20-\x20'+_0x2a4002[_0x2cf3('0x40')],'id_display':_0x2a4002[_0x2cf3('0x40')]},'auth':_0x38559e,'json':!![]};return rp(_0x21bfc8)['then'](function(_0x3c63df){_0x2d7686();})[_0x2cf3('0x10')](function(){_0x2d7686();});});}function manageTags(_0x580cce,_0x449ab9,_0x278c6d,_0x535e1f,_0x59adbb,_0x5a2d6d,_0x5d19a5){return new Promise(function(_0x252f31,_0x2f22a7){var _0x19df39=[];_0x449ab9['forEach'](function(_0x2a09be){_0x19df39['push'](getRemoteTag(_0x2a09be,_0x278c6d,_0x535e1f,_0x5a2d6d,_0x5d19a5));});return Promise['all'](_0x19df39)[_0x2cf3('0xa')](function(_0x29f1f8){if(_0x29f1f8[_0x2cf3('0xc')]){logger[_0x2cf3('0xf')]('['+[_0x580cce[_0x2cf3('0x12')]()]+_0x2cf3('0x46'),_0x29f1f8);var _0xb80ac9=[];_0x29f1f8['forEach'](function(_0x43a0a8){_0xb80ac9['push'](assignTagToIncident(_0x43a0a8,_0x278c6d,_0x535e1f,_0x59adbb,_0x5a2d6d));});return Promise[_0x2cf3('0x47')](_0xb80ac9)['then'](function(){_0x252f31();})[_0x2cf3('0x10')](function(){_0x252f31();});}else{_0x252f31();}});});}function getTags(_0x4b3e44,_0x5c6aaf,_0x100d22,_0x59b9e6,_0x5ccb72,_0x56ae19){return function(_0xaaacc2){return new Promise(function(_0xa69414,_0x4ef29d){var _0x3c5a69=[];var _0x23c7f8=_0x59b9e6[_0x2cf3('0x48')];if(_0x23c7f8&&_0x23c7f8[_0x2cf3('0xc')]>0x0){_0x3c5a69=_[_0x2cf3('0x49')](_0x23c7f8,_0x2cf3('0x37'));}if(_0x3c5a69[_0x2cf3('0xc')]>0x0){return manageTags(_0x4b3e44,_0x3c5a69,_0x5c6aaf,_0x100d22,_0xaaacc2,_0x5ccb72,_0x56ae19)[_0x2cf3('0xa')](function(){_0xa69414(_0xaaacc2);});}else{_0xa69414(_0xaaacc2);}});};}function emit(_0x484d97,_0x275e9c,_0x521d59){var _0x584002=_0x2cf3('0x4a')+_0x2cf3('0x4b')+_0x2cf3('0x4c')+_0x2cf3('0x4d');var _0x51eb97={'uri':_0x484d97+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x521d59+_0x584002};io['to'](util[_0x2cf3('0x4e')]('user:%s',_0x275e9c))['emit'](_0x2cf3('0x4f'),_0x51eb97);}exports['cs']=function(_0x15af3e,_0x3e84b7,_0x3f97dd,_0x33964b,_0x27c45d,_0x1e9314,_0xebbad5,_0x30e9a0){var _0x12af2b={};var _0x5459b5={'user':_0x1e9314[_0x2cf3('0x50')],'pass':_0x1e9314[_0x2cf3('0x51')]};var _0x278038=_0x2cf3('0x52');var _0x1ceac4=_0x2cf3('0x53');_0x1e9314[_0x2cf3('0x54')]=intUtil[_0x2cf3('0x55')](_0x1e9314[_0x2cf3('0x54')]);_0x1e9314[_0x2cf3('0x56')]=intUtil[_0x2cf3('0x55')](_0x1e9314[_0x2cf3('0x56')]);var _0x2bc911=util['format'](_0x2cf3('0x57'),_0x1e9314[_0x2cf3('0x54')]);_0x12af2b[_0x2cf3('0x15')]=!_[_0x2cf3('0x58')](_0x33964b)?_0x33964b[_0x2cf3('0x59')]:null;_0x12af2b[_0x2cf3('0x1a')]=_0x1e9314[_0x2cf3('0x59')];_0x12af2b['endUserNumber']=_0x30e9a0[_0x2cf3('0x32')]()===_0x2cf3('0x5a')?_0x3e84b7[_0x2cf3('0x5b')]:_0x3e84b7[_0x2cf3('0x5c')];_0x12af2b[_0x2cf3('0x5d')]=_0x30e9a0===_0x2cf3('0x5e')||_0x30e9a0===_0x2cf3('0x5f')?_0x2cf3('0x5e'):_0x2cf3('0x5a');var _0x5c5b4c=util[_0x2cf3('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1e9314[_0x2cf3('0x56')],_0x3e84b7[_0x2cf3('0x60')],md5(_0x3e84b7[_0x2cf3('0x60')]));if(_0x27c45d&&_0x27c45d[_0x2cf3('0x61')]){logger[_0x2cf3('0xf')](_0x2cf3('0x62'),_0x2cf3('0x63'));_0x3e84b7[_0x2cf3('0x64')]=_0x5c5b4c;}else if(_0xebbad5&&_0xebbad5['recordingFormat']&&_0xebbad5[_0x2cf3('0x65')]!==_0x2cf3('0x66')){logger[_0x2cf3('0xf')]('[OUTBOUND]',_0x2cf3('0x63'));_0x3e84b7[_0x2cf3('0x64')]=_0x5c5b4c;}else{_0x3e84b7[_0x2cf3('0x64')]='';}return getAdminUser(_0x30e9a0,_0x5459b5,_0x12af2b,_0x2bc911,_0x1ceac4,_0x278038)[_0x2cf3('0xa')](getUser(_0x30e9a0,_0x5459b5,_0x2bc911,_0x1ceac4,_0x278038))[_0x2cf3('0xa')](getEndUser(_0x30e9a0,_0x5459b5,_0x2bc911,_0x1ceac4,_0x278038))[_0x2cf3('0xa')](getTicket(_0x30e9a0,_0x5459b5,_0x2bc911,_0x3f97dd,_0x3e84b7,_0x1ceac4))[_0x2cf3('0xa')](function(_0x3a694a){logger[_0x2cf3('0xf')](util[_0x2cf3('0x4e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x3a694a[_0x2cf3('0x3f')]));logger[_0x2cf3('0xf')](util['format'](_0x2cf3('0x67'),_0x30e9a0));if(_0x30e9a0!==_0x2cf3('0x5f')){logger[_0x2cf3('0xf')]('['+[_0x30e9a0[_0x2cf3('0x12')]()]+']',_0x2cf3('0x68'));emit(_0x1e9314['remoteUri'],_0x33964b[_0x2cf3('0x37')],_0x3a694a[_0x2cf3('0x3f')]);}})[_0x2cf3('0x10')](function(_0x160b84){logger[_0x2cf3('0x11')]('['+[_0x30e9a0[_0x2cf3('0x12')]()]+_0x2cf3('0x69'),util[_0x2cf3('0x6a')](_0x160b84,{'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 2cfe271..6ac0941 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 _0x51f2=['serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','monitor_format','lastevent','toUpperCase','lodash','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','POST','emit','name','getString','assigned_user_id','description','Descriptions','date_start','slice','replace','duration_hours','parent_type','parent_name','direction','forEach','variableName','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','then','entry_list','length','find','name_value_list','value','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','set_entry','first_name','','Enduser\x20created.','[HTTP]','merge','map','type','nameField','customField','toLowerCase','string','push','content','variable','idField','custom_fields','customVariable','Variable','username','password','xCALLY\x20Motion\x20integration','sessionID','set_relationship','Calls','queue','remoteUri','stripTrailingSlash'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x51f2,0x179));var _0x251f=function(_0x52d865,_0x527355){_0x52d865=_0x52d865-0x0;var _0x286b23=_0x51f2[_0x52d865];return _0x286b23;};'use strict';var _=require(_0x251f('0x0'));var rp=require('request-promise');var BPromise=require(_0x251f('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0x251f('0x2'));var intUtil=require(_0x251f('0x3'));var config=require(_0x251f('0x4'));var logger=require(_0x251f('0x5'))('sugarcrm');config[_0x251f('0x6')]=_[_0x251f('0x7')](config[_0x251f('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x251f('0x6')]));var def={'method':_0x251f('0x8'),'json':!![]};function emit(_0x32e0ea,_0x429787,_0x3399ba){io['to'](_0x32e0ea)[_0x251f('0x9')](_0x429787,_0x3399ba);}function getTicket(_0x2de8e4,_0x45ebcf,_0x2934eb,_0x1f9c12,_0x4f6d85,_0x564a67,_0x25b4a1,_0x16899c){logger['info']('Creating\x20new\x20ticket...');var _0x530e49=new Date();var _0x14ec87=[{'name':_0x251f('0xa'),'value':intUtil[_0x251f('0xb')](_0x1f9c12['Subjects'],_0x4f6d85,'\x20')},{'name':_0x251f('0xc'),'value':_0x45ebcf['id']},{'name':'created_by','value':_0x45ebcf['id']},{'name':_0x251f('0xd'),'value':intUtil['getString'](_0x1f9c12[_0x251f('0xe')],_0x4f6d85,'\x0a')},{'name':_0x251f('0xf'),'value':_0x530e49['toISOString']()[_0x251f('0x10')](0x0,0x13)[_0x251f('0x11')]('T','\x20')},{'name':_0x251f('0x12'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x2934eb['id']},{'name':_0x251f('0x13'),'value':'Contacts'},{'name':_0x251f('0x14'),'value':_0x2934eb[_0x251f('0xa')]},{'name':_0x251f('0x15'),'value':_0x16899c}];if(_0x564a67['length']){_[_0x251f('0x16')](_0x564a67,function(_0x1b78b1){if(_0x4f6d85[_0x1b78b1[_0x251f('0x17')]]){_0x14ec87['push']({'name':_0x1b78b1['idField'],'value':_0x4f6d85[_0x1b78b1['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x251f('0x18'),'rest_data':JSON[_0x251f('0x19')]({'session':_0x25b4a1['id'],'module_name':'Calls','name_value_list':_0x14ec87})}});}function getAuth(_0x37c490){return util[_0x251f('0x1a')](_0x251f('0x1b'),new Buffer(_0x37c490[_0x251f('0x1c')]+':X')[_0x251f('0x1d')](_0x251f('0x1e')));}function getServerInfo(_0xd7075a){return request({'form':{'method':_0x251f('0x1f'),'input_type':_0x251f('0x18'),'response_type':_0x251f('0x18'),'rest_data':JSON[_0x251f('0x19')]({'session':_0xd7075a['id']})}});}function getUser(_0x229f78,_0x415873,_0x2871b4){if(!_['isNil'](_0x415873)){logger['info'](_0x251f('0x20'),_0x415873);return request({'form':{'method':_0x251f('0x21'),'input_type':_0x251f('0x18'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x2871b4['id'],'module_name':_0x251f('0x22'),'query':util[_0x251f('0x1a')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x415873),'order_by':'','offset':'0','select_fields':['id',_0x251f('0xa'),_0x251f('0x23')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x251f('0x24')](function(_0xa698b0){if(_0xa698b0[_0x251f('0x25')][_0x251f('0x26')]){var _0xeee3cb=_[_0x251f('0x27')](_0xa698b0['entry_list'],function(_0x145f68){return _0x145f68[_0x251f('0x28')][_0x251f('0x23')][_0x251f('0x29')]===_0x415873;});if(_0xeee3cb){logger[_0x251f('0x2a')](_0x251f('0x2b'));return BPromise['resolve']({'id':_0xeee3cb[_0x251f('0x28')]['id'][_0x251f('0x29')],'name':_0xeee3cb[_0x251f('0x28')][_0x251f('0xa')][_0x251f('0x29')]});}}logger[_0x251f('0x2a')](_0x251f('0x2c'));return BPromise[_0x251f('0x2d')]({'id':_0x2871b4[_0x251f('0x28')][_0x251f('0x2e')][_0x251f('0x29')],'name':_0x2871b4['name_value_list']['user_name'][_0x251f('0x29')]});});}else{logger[_0x251f('0x2a')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x251f('0x2d')]({'id':_0x2871b4['name_value_list'][_0x251f('0x2e')][_0x251f('0x29')],'name':_0x2871b4[_0x251f('0x28')][_0x251f('0x23')]['value']});}}function getEndUser(_0xcc68fa,_0x3825d2,_0x480739,_0x76e9f){logger['info']('Searching\x20enduser\x20with\x20phone',_0x480739);return request({'form':{'method':_0x251f('0x21'),'input_type':_0x251f('0x18'),'response_type':_0x251f('0x18'),'rest_data':JSON[_0x251f('0x19')]({'session':_0x76e9f['id'],'module_name':_0x251f('0x2f'),'query':util['format'](_0x251f('0x30'),_0x480739),'order_by':'','offset':'0','select_fields':['id',_0x251f('0xa'),_0x251f('0x31')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x251f('0x24')](function(_0x1eca8d){if(_0x1eca8d[_0x251f('0x25')][_0x251f('0x26')]){var _0x84e203=_[_0x251f('0x27')](_0x1eca8d[_0x251f('0x25')],function(_0x46a970){return _0x46a970[_0x251f('0x28')][_0x251f('0x31')][_0x251f('0x29')]===_0x480739;});if(_0x84e203){logger[_0x251f('0x2a')](_0x251f('0x32'));return BPromise[_0x251f('0x2d')]({'id':_0x84e203['name_value_list']['id'][_0x251f('0x29')],'name':_0x84e203[_0x251f('0x28')]['name'][_0x251f('0x29')],'phone':_0x84e203[_0x251f('0x28')][_0x251f('0x31')]['value']});}}else{logger[_0x251f('0x2a')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x251f('0x33'),'input_type':_0x251f('0x18'),'response_type':_0x251f('0x18'),'rest_data':JSON[_0x251f('0x19')]({'session':_0x76e9f['id'],'module_name':_0x251f('0x2f'),'name_value_list':[{'name':_0x251f('0x34'),'value':_0x3825d2!==_0x251f('0x35')?_0x3825d2:util[_0x251f('0x1a')]('Caller\x20-\x20%s',_0x480739)},{'name':'phone_home','value':_0x480739}]})}})[_0x251f('0x24')](function(_0x29fc46){logger[_0x251f('0x2a')](_0x251f('0x36'));return BPromise['resolve']({'id':_0x29fc46['id'],'name':_0x29fc46['entry_list'][_0x251f('0x34')][_0x251f('0x29')],'phone':_0x29fc46['entry_list'][_0x251f('0x31')][_0x251f('0x29')]});});}});}function request(_0x51fd46){logger['debug'](_0x251f('0x37'),JSON['stringify'](_0x51fd46));return rp(_[_0x251f('0x38')](def,_0x51fd46));}function getTags(_0x30d38a,_0x23401a){var _0x1ba7f7=[];if(_0x30d38a&&_0x30d38a[_0x251f('0x26')]>0x0){_0x1ba7f7=_[_0x251f('0x39')](_0x30d38a,_0x23401a);}return _0x1ba7f7;}function getCustomFields(_0x7e9ca2,_0xeabbf7){var _0x133dfe=[];var _0x2f4099={'custom_fields':[]};if(_0x7e9ca2[_0x251f('0x26')]>0x0){_[_0x251f('0x16')](_0x7e9ca2,function(_0x296fc0){if(_0x296fc0[_0x251f('0x3a')]==='string'&&_0x296fc0[_0x251f('0x3b')]&&!_0x296fc0[_0x251f('0x3c')]){_0x2f4099[_0x296fc0[_0x251f('0x3b')][_0x251f('0x3d')]()]=_0x296fc0['content'][_0x251f('0x1d')]();}else if(_0x296fc0[_0x251f('0x3a')]===_0x251f('0x3e')&&_0x296fc0['idField']&&_0x296fc0[_0x251f('0x3c')]){_0x2f4099['custom_fields'][_0x251f('0x3f')]({'id':_0x296fc0['idField'],'value':_0x296fc0[_0x251f('0x40')]['toString']()});}else if(_0x296fc0[_0x251f('0x3a')]===_0x251f('0x41')&&_0x296fc0[_0x251f('0x17')]&&_0x296fc0[_0x251f('0x42')]&&_0x296fc0[_0x251f('0x3c')]){_0xeabbf7[_0x296fc0[_0x251f('0x17')]]&&_0x2f4099[_0x251f('0x43')][_0x251f('0x3f')]({'id':_0x296fc0[_0x251f('0x42')],'value':_0xeabbf7[_0x296fc0[_0x251f('0x17')]]['toString']()});}else if(_0x296fc0[_0x251f('0x3a')]===_0x251f('0x44')&&_0x296fc0[_0x251f('0x45')]&&_0x296fc0['Variable'][_0x251f('0xa')]&&_0x296fc0[_0x251f('0x42')]&&_0x296fc0[_0x251f('0x3c')]){_0xeabbf7[_0x296fc0[_0x251f('0x45')]['name']['toLowerCase']()]&&_0x2f4099[_0x251f('0x43')][_0x251f('0x3f')]({'id':_0x296fc0['idField'],'value':_0xeabbf7[_0x296fc0['Variable'][_0x251f('0xa')][_0x251f('0x3d')]()][_0x251f('0x1d')]()});}});}return _0x2f4099;}function getConnection(_0x2c7fa9){return request({'method':_0x251f('0x8'),'form':{'method':'login','input_type':_0x251f('0x18'),'response_type':_0x251f('0x18'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x2c7fa9[_0x251f('0x46')],'password':_0x2c7fa9[_0x251f('0x47')],'encryption':'PLAIN'},'application':_0x251f('0x48')})}})[_0x251f('0x24')](function(_0x1b6a10){var _0x1e91e3=_0x1b6a10;if(_0x1e91e3['id']){def[_0x251f('0x49')]=_0x1e91e3['id'];return BPromise['resolve'](_0x1e91e3);}else{throw new Error(util[_0x251f('0x1a')]('Account\x20%d\x20is\x20not\x20valid',_0x2c7fa9['id']));}});}function setRelationship(_0xfd8cb8,_0x2df6f2,_0x836ced,_0x153559){return request({'form':{'method':_0x251f('0x4a'),'input_type':_0x251f('0x18'),'response_type':_0x251f('0x18'),'rest_data':JSON[_0x251f('0x19')]({'session':_0xfd8cb8['id'],'module_name':_0x251f('0x4b'),'module_id':_0x836ced['id'],'link_field_name':_0x153559,'related_ids':[_0x2df6f2['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x251f('0x4c')]=function(_0x3b230e,_0x208bbb,_0x505d3e,_0x20c3d6,_0x4272eb,_0x248f70){var _0x1ded63,_0x49f587,_0xfc1feb,_0x40dd45;_0x248f70[_0x251f('0x4d')]=intUtil[_0x251f('0x4e')](_0x248f70[_0x251f('0x4d')]);_0x248f70[_0x251f('0x4f')]=intUtil['stripTrailingSlash'](_0x248f70['serverUrl']);def[_0x251f('0x50')]=util[_0x251f('0x1a')](_0x251f('0x51'),_0x248f70['remoteUri']);if(_0x4272eb&&_0x4272eb['monitor_format']){logger[_0x251f('0x2a')](_0x251f('0x52'),_0x251f('0x53'));_0x208bbb[_0x251f('0x54')]=util['format'](_0x251f('0x55'),_0x248f70['serverUrl'],_0x208bbb[_0x251f('0x56')],md5(_0x208bbb[_0x251f('0x56')]));}else{_0x208bbb[_0x251f('0x54')]='';}return getConnection(_0x248f70)[_0x251f('0x24')](function(_0x369a35){_0x40dd45=_0x369a35;return getUser(_0x248f70,_0x20c3d6[_0x251f('0xa')],_0x40dd45);})[_0x251f('0x24')](function(_0x35a68f){_0x1ded63=_0x35a68f;logger['info'](_0x251f('0x57'),_0x1ded63['id']);return getEndUser(_0x248f70,_0x208bbb[_0x251f('0x58')],_0x208bbb[_0x251f('0x59')],_0x40dd45);})[_0x251f('0x24')](function(_0x815566){_0x49f587=_0x815566;logger[_0x251f('0x2a')](_0x251f('0x5a'),_0x49f587['id']);return getTicket(_0x248f70,_0x1ded63,_0x49f587,_0x505d3e,_0x208bbb,_0x505d3e[_0x251f('0x5b')],_0x40dd45,_0x251f('0x5c'));})[_0x251f('0x24')](function(_0x4caddc){_0xfc1feb=_0x4caddc;logger['info'](_0x251f('0x5d'));logger[_0x251f('0x2a')](_0x251f('0x5e'),_0xfc1feb['id']);return setRelationship(_0x40dd45,_0x1ded63,_0xfc1feb,_0x251f('0x5f'));})[_0x251f('0x24')](function(){return setRelationship(_0x40dd45,_0x49f587,_0xfc1feb,_0x251f('0x60'));})[_0x251f('0x24')](function(){return getServerInfo(_0x40dd45);})[_0x251f('0x24')](function(_0x164ac5){var _0xfb6412=parseInt(_0x164ac5[_0x251f('0x61')][_0x251f('0x62')](0x0));var _0x207396=util['format'](_0x251f('0x63'),_0x248f70[_0x251f('0x4d')],_0xfc1feb['id']);if(_0xfb6412>0x6){_0x207396=util[_0x251f('0x1a')](_0x251f('0x64'),_0x248f70[_0x251f('0x4d')],_0xfc1feb['id']);}logger[_0x251f('0x2a')](_0x251f('0x52'),_0x251f('0x65'));emit(util['format'](_0x251f('0x66'),_0x20c3d6[_0x251f('0xa')]),'trigger:browser:url',{'uri':_0x207396});})[_0x251f('0x67')](function(_0x330574){logger[_0x251f('0x68')]('[QUEUE]',JSON[_0x251f('0x19')](_0x330574));});};exports['outbound']=function(_0xca473c,_0x28cd9f,_0x5bfbb7,_0x21978e,_0x47bef9,_0x285fc0,_0x1cf464){var _0x16b495,_0x53c99d,_0x1a9eb2,_0x38f376;_0x285fc0[_0x251f('0x4d')]=intUtil[_0x251f('0x4e')](_0x285fc0[_0x251f('0x4d')]);_0x285fc0[_0x251f('0x4f')]=intUtil['stripTrailingSlash'](_0x285fc0['serverUrl']);def[_0x251f('0x50')]=util['format']('%s/service/v4_1/rest.php',_0x285fc0[_0x251f('0x4d')]);if(_0x1cf464&&_0x1cf464[_0x251f('0x69')]&&_0x1cf464['recordingFormat']!==_0x251f('0x6a')){logger[_0x251f('0x2a')](_0x251f('0x6b'),_0x251f('0x53'));_0x28cd9f['recordingURL']=util[_0x251f('0x1a')](_0x251f('0x55'),_0x285fc0['serverUrl'],_0x28cd9f[_0x251f('0x56')],md5(_0x28cd9f[_0x251f('0x56')]));}return getConnection(_0x285fc0)['then'](function(_0x480eef){_0x38f376=_0x480eef;return getUser(_0x285fc0,_0x21978e[_0x251f('0xa')],_0x38f376);})[_0x251f('0x24')](function(_0x24c575){_0x16b495=_0x24c575;logger[_0x251f('0x2a')]('The\x20User\x20ID\x20is:',_0x16b495['id']);return getEndUser(_0x285fc0,_0x28cd9f[_0x251f('0x6c')],_0x28cd9f[_0x251f('0x6d')],_0x38f376);})['then'](function(_0x424504){_0x53c99d=_0x424504;logger[_0x251f('0x2a')](_0x251f('0x5a'),_0x53c99d['id']);return getTicket(_0x285fc0,_0x16b495,_0x53c99d,_0x5bfbb7,_0x28cd9f,_0x5bfbb7[_0x251f('0x5b')],_0x38f376,_0x251f('0x6e'));})[_0x251f('0x24')](function(_0x414264){_0x1a9eb2=_0x414264;logger[_0x251f('0x2a')](_0x251f('0x5d'));logger[_0x251f('0x2a')](_0x251f('0x5e'),_0x1a9eb2['id']);return setRelationship(_0x38f376,_0x16b495,_0x1a9eb2,_0x251f('0x5f'));})['then'](function(){return setRelationship(_0x38f376,_0x53c99d,_0x1a9eb2,'contacts');})[_0x251f('0x24')](function(){return getServerInfo(_0x38f376);})['then'](function(_0x5293d9){var _0x5b2496=parseInt(_0x5293d9['version'][_0x251f('0x62')](0x0));var _0xbbdc78=util[_0x251f('0x1a')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x285fc0['remoteUri'],_0x1a9eb2['id']);if(_0x5b2496>0x6){_0xbbdc78=util[_0x251f('0x1a')](_0x251f('0x64'),_0x285fc0[_0x251f('0x4d')],_0x1a9eb2['id']);}logger[_0x251f('0x2a')](_0x251f('0x6b'),_0x251f('0x65'));emit(util['format'](_0x251f('0x66'),_0x21978e[_0x251f('0xa')]),'trigger:browser:url',{'uri':_0xbbdc78});})[_0x251f('0x67')](function(_0x179fbc){logger[_0x251f('0x68')](_0x251f('0x6b'),JSON[_0x251f('0x19')](_0x179fbc));});};exports['unmanaged']=function(_0x45eff5,_0x47ffd7,_0x3eac2b,_0x2ffdf9,_0x386eb0,_0x2a96bb){var _0x26a01e,_0x4d5336,_0xed1e3b,_0x4eaa95;_0x2a96bb[_0x251f('0x4d')]=intUtil['stripTrailingSlash'](_0x2a96bb[_0x251f('0x4d')]);_0x2a96bb[_0x251f('0x4f')]=intUtil[_0x251f('0x4e')](_0x2a96bb[_0x251f('0x4f')]);def[_0x251f('0x50')]=util[_0x251f('0x1a')]('%s/service/v4_1/rest.php',_0x2a96bb[_0x251f('0x4d')]);if(_0x386eb0&&_0x386eb0[_0x251f('0x6f')]){logger[_0x251f('0x2a')]('['+_0x47ffd7[_0x251f('0x70')][_0x251f('0x71')]()+']',_0x251f('0x53'));_0x47ffd7[_0x251f('0x54')]=util[_0x251f('0x1a')](_0x251f('0x55'),_0x2a96bb[_0x251f('0x4f')],_0x47ffd7[_0x251f('0x56')],md5(_0x47ffd7[_0x251f('0x56')]));}else{_0x47ffd7[_0x251f('0x54')]='';}return getConnection(_0x2a96bb)[_0x251f('0x24')](function(_0x10119a){_0x4eaa95=_0x10119a;if(!_['isNil'](_0x2ffdf9)){return getUser(_0x2a96bb,_0x2ffdf9[_0x251f('0xa')],_0x4eaa95);}else{return getUser(_0x2a96bb,null,_0x4eaa95);}})[_0x251f('0x24')](function(_0x423098){_0x26a01e=_0x423098;logger[_0x251f('0x2a')](_0x251f('0x57'),_0x26a01e['id']);return getEndUser(_0x2a96bb,_0x47ffd7['calleridname'],_0x47ffd7[_0x251f('0x59')],_0x4eaa95);})['then'](function(_0x1cb5bd){_0x4d5336=_0x1cb5bd;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4d5336['id']);return getTicket(_0x2a96bb,_0x26a01e,_0x4d5336,_0x3eac2b,_0x47ffd7,_0x3eac2b[_0x251f('0x5b')],_0x4eaa95,'Inbound');})[_0x251f('0x24')](function(_0x501a82){_0xed1e3b=_0x501a82;logger[_0x251f('0x2a')](_0x251f('0x5d'));logger[_0x251f('0x2a')](_0x251f('0x5e'),_0xed1e3b['id']);return setRelationship(_0x4eaa95,_0x26a01e,_0xed1e3b,_0x251f('0x5f'));})[_0x251f('0x24')](function(){return setRelationship(_0x4eaa95,_0x4d5336,_0xed1e3b,'contacts');})[_0x251f('0x24')](function(){return getServerInfo(_0x4eaa95);})[_0x251f('0x67')](function(_0x822165){logger[_0x251f('0x68')]('['+_0x47ffd7['lastevent'][_0x251f('0x71')]()+']',JSON[_0x251f('0x19')](_0x822165));});}; \ No newline at end of file +var _0xea4c=['remoteUri','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','trigger:browser:url','catch','error','outbound','uri','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','users','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','Inbound','toUpperCase','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','POST','info','name','getString','Subjects','assigned_user_id','description','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','parent_name','direction','forEach','variableName','push','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','user_name','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','length','Enduser\x20found!','first_name','Caller\x20-\x20%s','debug','[HTTP]','merge','map','nameField','customField','toLowerCase','content','type','string','custom_fields','variable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','stripTrailingSlash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xea4c,0xa0));var _0xcea4=function(_0xd70e19,_0x4a5ba9){_0xd70e19=_0xd70e19-0x0;var _0x260155=_0xea4c[_0xd70e19];return _0x260155;};'use strict';var _=require(_0xcea4('0x0'));var rp=require(_0xcea4('0x1'));var BPromise=require(_0xcea4('0x2'));var md5=require(_0xcea4('0x3'));var util=require('util');var Redis=require(_0xcea4('0x4'));var intUtil=require(_0xcea4('0x5'));var config=require(_0xcea4('0x6'));var logger=require('../../../../config/logger')('sugarcrm');config[_0xcea4('0x7')]=_['defaults'](config[_0xcea4('0x7')],{'host':_0xcea4('0x8'),'port':0x18eb});var io=require(_0xcea4('0x9'))(new Redis(config[_0xcea4('0x7')]));var def={'method':_0xcea4('0xa'),'json':!![]};function emit(_0x3bad98,_0x423802,_0x4a00fd){io['to'](_0x3bad98)['emit'](_0x423802,_0x4a00fd);}function getTicket(_0x346d5e,_0x178dda,_0x59947c,_0x3c207d,_0x4ef21c,_0x467722,_0x276883,_0x412bb4){logger[_0xcea4('0xb')]('Creating\x20new\x20ticket...');var _0x47561d=new Date();var _0x1b76f9=[{'name':_0xcea4('0xc'),'value':intUtil[_0xcea4('0xd')](_0x3c207d[_0xcea4('0xe')],_0x4ef21c,'\x20')},{'name':_0xcea4('0xf'),'value':_0x178dda['id']},{'name':'created_by','value':_0x178dda['id']},{'name':_0xcea4('0x10'),'value':intUtil['getString'](_0x3c207d['Descriptions'],_0x4ef21c,'\x0a')},{'name':_0xcea4('0x11'),'value':_0x47561d[_0xcea4('0x12')]()[_0xcea4('0x13')](0x0,0x13)[_0xcea4('0x14')]('T','\x20')},{'name':_0xcea4('0x15'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xcea4('0x16'),'value':_0x59947c['id']},{'name':_0xcea4('0x17'),'value':'Contacts'},{'name':_0xcea4('0x18'),'value':_0x59947c[_0xcea4('0xc')]},{'name':_0xcea4('0x19'),'value':_0x412bb4}];if(_0x467722['length']){_[_0xcea4('0x1a')](_0x467722,function(_0x1b65a5){if(_0x4ef21c[_0x1b65a5[_0xcea4('0x1b')]]){_0x1b76f9[_0xcea4('0x1c')]({'name':_0x1b65a5[_0xcea4('0x1d')],'value':_0x4ef21c[_0x1b65a5[_0xcea4('0x1b')]]});}});}return request({'form':{'method':_0xcea4('0x1e'),'input_type':_0xcea4('0x1f'),'response_type':'JSON','rest_data':JSON[_0xcea4('0x20')]({'session':_0x276883['id'],'module_name':'Calls','name_value_list':_0x1b76f9})}});}function getAuth(_0x395bea){return util[_0xcea4('0x21')](_0xcea4('0x22'),new Buffer(_0x395bea[_0xcea4('0x23')]+':X')[_0xcea4('0x24')](_0xcea4('0x25')));}function getServerInfo(_0x265fc7){return request({'form':{'method':_0xcea4('0x26'),'input_type':_0xcea4('0x1f'),'response_type':'JSON','rest_data':JSON[_0xcea4('0x20')]({'session':_0x265fc7['id']})}});}function getUser(_0x1e0b8c,_0x5eaed4,_0xad0624){if(!_[_0xcea4('0x27')](_0x5eaed4)){logger['info'](_0xcea4('0x28'),_0x5eaed4);return request({'form':{'method':'get_entry_list','input_type':_0xcea4('0x1f'),'response_type':_0xcea4('0x1f'),'rest_data':JSON[_0xcea4('0x20')]({'session':_0xad0624['id'],'module_name':_0xcea4('0x29'),'query':util[_0xcea4('0x21')](_0xcea4('0x2a'),_0x5eaed4),'order_by':'','offset':'0','select_fields':['id',_0xcea4('0xc'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xcea4('0x2b')](function(_0x2a1a9a){if(_0x2a1a9a[_0xcea4('0x2c')]['length']){var _0x260fcf=_[_0xcea4('0x2d')](_0x2a1a9a[_0xcea4('0x2c')],function(_0x151599){return _0x151599[_0xcea4('0x2e')][_0xcea4('0x2f')][_0xcea4('0x30')]===_0x5eaed4;});if(_0x260fcf){logger[_0xcea4('0xb')](_0xcea4('0x31'));return BPromise['resolve']({'id':_0x260fcf[_0xcea4('0x2e')]['id'][_0xcea4('0x30')],'name':_0x260fcf[_0xcea4('0x2e')]['name']['value']});}}logger[_0xcea4('0xb')](_0xcea4('0x32'));return BPromise['resolve']({'id':_0xad0624[_0xcea4('0x2e')]['user_id']['value'],'name':_0xad0624[_0xcea4('0x2e')][_0xcea4('0x2f')][_0xcea4('0x30')]});});}else{logger[_0xcea4('0xb')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xcea4('0x33')]({'id':_0xad0624[_0xcea4('0x2e')][_0xcea4('0x34')][_0xcea4('0x30')],'name':_0xad0624[_0xcea4('0x2e')][_0xcea4('0x2f')][_0xcea4('0x30')]});}}function getEndUser(_0x5193f1,_0xdf2795,_0x2374c7,_0x405d6b){logger[_0xcea4('0xb')](_0xcea4('0x35'),_0x2374c7);return request({'form':{'method':_0xcea4('0x36'),'input_type':_0xcea4('0x1f'),'response_type':_0xcea4('0x1f'),'rest_data':JSON[_0xcea4('0x20')]({'session':_0x405d6b['id'],'module_name':_0xcea4('0x37'),'query':util['format'](_0xcea4('0x38'),_0x2374c7),'order_by':'','offset':'0','select_fields':['id',_0xcea4('0xc'),_0xcea4('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xcea4('0x2b')](function(_0x3dd997){if(_0x3dd997[_0xcea4('0x2c')][_0xcea4('0x3a')]){var _0x1f9d14=_[_0xcea4('0x2d')](_0x3dd997[_0xcea4('0x2c')],function(_0x4de619){return _0x4de619['name_value_list'][_0xcea4('0x39')][_0xcea4('0x30')]===_0x2374c7;});if(_0x1f9d14){logger['info'](_0xcea4('0x3b'));return BPromise[_0xcea4('0x33')]({'id':_0x1f9d14[_0xcea4('0x2e')]['id'][_0xcea4('0x30')],'name':_0x1f9d14[_0xcea4('0x2e')][_0xcea4('0xc')][_0xcea4('0x30')],'phone':_0x1f9d14[_0xcea4('0x2e')]['phone_home'][_0xcea4('0x30')]});}}else{logger[_0xcea4('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xcea4('0x1e'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xcea4('0x20')]({'session':_0x405d6b['id'],'module_name':_0xcea4('0x37'),'name_value_list':[{'name':_0xcea4('0x3c'),'value':_0xdf2795!==''?_0xdf2795:util[_0xcea4('0x21')](_0xcea4('0x3d'),_0x2374c7)},{'name':_0xcea4('0x39'),'value':_0x2374c7}]})}})[_0xcea4('0x2b')](function(_0x342f42){logger[_0xcea4('0xb')]('Enduser\x20created.');return BPromise[_0xcea4('0x33')]({'id':_0x342f42['id'],'name':_0x342f42['entry_list']['first_name'][_0xcea4('0x30')],'phone':_0x342f42[_0xcea4('0x2c')]['phone_home'][_0xcea4('0x30')]});});}});}function request(_0x590f4a){logger[_0xcea4('0x3e')](_0xcea4('0x3f'),JSON[_0xcea4('0x20')](_0x590f4a));return rp(_[_0xcea4('0x40')](def,_0x590f4a));}function getTags(_0x5eebfd,_0x22eb04){var _0x327df7=[];if(_0x5eebfd&&_0x5eebfd['length']>0x0){_0x327df7=_[_0xcea4('0x41')](_0x5eebfd,_0x22eb04);}return _0x327df7;}function getCustomFields(_0x45bb8f,_0x461c14){var _0x4658b4=[];var _0x349637={'custom_fields':[]};if(_0x45bb8f[_0xcea4('0x3a')]>0x0){_[_0xcea4('0x1a')](_0x45bb8f,function(_0x5cdf11){if(_0x5cdf11['type']==='string'&&_0x5cdf11[_0xcea4('0x42')]&&!_0x5cdf11[_0xcea4('0x43')]){_0x349637[_0x5cdf11[_0xcea4('0x42')][_0xcea4('0x44')]()]=_0x5cdf11[_0xcea4('0x45')][_0xcea4('0x24')]();}else if(_0x5cdf11[_0xcea4('0x46')]===_0xcea4('0x47')&&_0x5cdf11['idField']&&_0x5cdf11[_0xcea4('0x43')]){_0x349637[_0xcea4('0x48')][_0xcea4('0x1c')]({'id':_0x5cdf11['idField'],'value':_0x5cdf11[_0xcea4('0x45')][_0xcea4('0x24')]()});}else if(_0x5cdf11[_0xcea4('0x46')]===_0xcea4('0x49')&&_0x5cdf11['variableName']&&_0x5cdf11['idField']&&_0x5cdf11[_0xcea4('0x43')]){_0x461c14[_0x5cdf11['variableName']]&&_0x349637[_0xcea4('0x48')][_0xcea4('0x1c')]({'id':_0x5cdf11[_0xcea4('0x1d')],'value':_0x461c14[_0x5cdf11[_0xcea4('0x1b')]][_0xcea4('0x24')]()});}else if(_0x5cdf11[_0xcea4('0x46')]==='customVariable'&&_0x5cdf11['Variable']&&_0x5cdf11[_0xcea4('0x4a')][_0xcea4('0xc')]&&_0x5cdf11['idField']&&_0x5cdf11[_0xcea4('0x43')]){_0x461c14[_0x5cdf11['Variable'][_0xcea4('0xc')][_0xcea4('0x44')]()]&&_0x349637['custom_fields'][_0xcea4('0x1c')]({'id':_0x5cdf11[_0xcea4('0x1d')],'value':_0x461c14[_0x5cdf11[_0xcea4('0x4a')][_0xcea4('0xc')][_0xcea4('0x44')]()][_0xcea4('0x24')]()});}});}return _0x349637;}function getConnection(_0x4c1574){return request({'method':_0xcea4('0xa'),'form':{'method':_0xcea4('0x4b'),'input_type':_0xcea4('0x1f'),'response_type':'JSON','rest_data':JSON[_0xcea4('0x20')]({'user_auth':{'user_name':_0x4c1574[_0xcea4('0x4c')],'password':_0x4c1574[_0xcea4('0x4d')],'encryption':_0xcea4('0x4e')},'application':_0xcea4('0x4f')})}})[_0xcea4('0x2b')](function(_0x3ae1bc){var _0x2b5bee=_0x3ae1bc;if(_0x2b5bee['id']){def[_0xcea4('0x50')]=_0x2b5bee['id'];return BPromise[_0xcea4('0x33')](_0x2b5bee);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x4c1574['id']));}});}function setRelationship(_0x589a84,_0x259bbb,_0x4785a9,_0x46fb47){return request({'form':{'method':_0xcea4('0x51'),'input_type':_0xcea4('0x1f'),'response_type':_0xcea4('0x1f'),'rest_data':JSON[_0xcea4('0x20')]({'session':_0x589a84['id'],'module_name':'Calls','module_id':_0x4785a9['id'],'link_field_name':_0x46fb47,'related_ids':[_0x259bbb['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xcea4('0x52')]=function(_0x4ceae8,_0x569866,_0x1b9de4,_0x146be7,_0x113366,_0x11ba7c){var _0x575602,_0xbd23a1,_0x209355,_0x119d18;_0x11ba7c['remoteUri']=intUtil[_0xcea4('0x53')](_0x11ba7c[_0xcea4('0x54')]);_0x11ba7c[_0xcea4('0x55')]=intUtil['stripTrailingSlash'](_0x11ba7c[_0xcea4('0x55')]);def['uri']=util[_0xcea4('0x21')](_0xcea4('0x56'),_0x11ba7c[_0xcea4('0x54')]);if(_0x113366&&_0x113366[_0xcea4('0x57')]){logger[_0xcea4('0xb')](_0xcea4('0x58'),_0xcea4('0x59'));_0x569866[_0xcea4('0x5a')]=util['format'](_0xcea4('0x5b'),_0x11ba7c['serverUrl'],_0x569866[_0xcea4('0x5c')],md5(_0x569866[_0xcea4('0x5c')]));}else{_0x569866[_0xcea4('0x5a')]='';}return getConnection(_0x11ba7c)[_0xcea4('0x2b')](function(_0x6beeb5){_0x119d18=_0x6beeb5;return getUser(_0x11ba7c,_0x146be7[_0xcea4('0xc')],_0x119d18);})[_0xcea4('0x2b')](function(_0x33cd2c){_0x575602=_0x33cd2c;logger[_0xcea4('0xb')](_0xcea4('0x5d'),_0x575602['id']);return getEndUser(_0x11ba7c,_0x569866[_0xcea4('0x5e')],_0x569866[_0xcea4('0x5f')],_0x119d18);})[_0xcea4('0x2b')](function(_0x5ce810){_0xbd23a1=_0x5ce810;logger[_0xcea4('0xb')]('The\x20Enduser\x20ID\x20is:',_0xbd23a1['id']);return getTicket(_0x11ba7c,_0x575602,_0xbd23a1,_0x1b9de4,_0x569866,_0x1b9de4[_0xcea4('0x60')],_0x119d18,'Inbound');})[_0xcea4('0x2b')](function(_0x337477){_0x209355=_0x337477;logger[_0xcea4('0xb')](_0xcea4('0x61'));logger[_0xcea4('0xb')](_0xcea4('0x62'),_0x209355['id']);return setRelationship(_0x119d18,_0x575602,_0x209355,'users');})[_0xcea4('0x2b')](function(){return setRelationship(_0x119d18,_0xbd23a1,_0x209355,_0xcea4('0x63'));})[_0xcea4('0x2b')](function(){return getServerInfo(_0x119d18);})[_0xcea4('0x2b')](function(_0x83980d){var _0x264301=parseInt(_0x83980d[_0xcea4('0x64')]['charAt'](0x0));var _0x5459fb=util[_0xcea4('0x21')](_0xcea4('0x65'),_0x11ba7c[_0xcea4('0x54')],_0x209355['id']);if(_0x264301>0x6){_0x5459fb=util[_0xcea4('0x21')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x11ba7c[_0xcea4('0x54')],_0x209355['id']);}logger[_0xcea4('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xcea4('0x21')](_0xcea4('0x66'),_0x146be7[_0xcea4('0xc')]),_0xcea4('0x67'),{'uri':_0x5459fb});})[_0xcea4('0x68')](function(_0x5baabc){logger[_0xcea4('0x69')](_0xcea4('0x58'),JSON[_0xcea4('0x20')](_0x5baabc));});};exports[_0xcea4('0x6a')]=function(_0x50fc9b,_0x35b701,_0x3dfcb6,_0x30e422,_0x53e4ce,_0x588db7,_0x231e68){var _0x2cc782,_0x497678,_0x104f0d,_0x4f69ed;_0x588db7[_0xcea4('0x54')]=intUtil[_0xcea4('0x53')](_0x588db7['remoteUri']);_0x588db7[_0xcea4('0x55')]=intUtil[_0xcea4('0x53')](_0x588db7['serverUrl']);def[_0xcea4('0x6b')]=util[_0xcea4('0x21')](_0xcea4('0x56'),_0x588db7[_0xcea4('0x54')]);if(_0x231e68&&_0x231e68[_0xcea4('0x6c')]&&_0x231e68[_0xcea4('0x6c')]!==_0xcea4('0x6d')){logger[_0xcea4('0xb')](_0xcea4('0x6e'),_0xcea4('0x59'));_0x35b701[_0xcea4('0x5a')]=util[_0xcea4('0x21')](_0xcea4('0x5b'),_0x588db7[_0xcea4('0x55')],_0x35b701[_0xcea4('0x5c')],md5(_0x35b701['uniqueid']));}return getConnection(_0x588db7)['then'](function(_0x206817){_0x4f69ed=_0x206817;return getUser(_0x588db7,_0x30e422['name'],_0x4f69ed);})[_0xcea4('0x2b')](function(_0x2b4d8a){_0x2cc782=_0x2b4d8a;logger[_0xcea4('0xb')](_0xcea4('0x5d'),_0x2cc782['id']);return getEndUser(_0x588db7,_0x35b701[_0xcea4('0x6f')],_0x35b701[_0xcea4('0x70')],_0x4f69ed);})[_0xcea4('0x2b')](function(_0x24c7e2){_0x497678=_0x24c7e2;logger[_0xcea4('0xb')](_0xcea4('0x71'),_0x497678['id']);return getTicket(_0x588db7,_0x2cc782,_0x497678,_0x3dfcb6,_0x35b701,_0x3dfcb6[_0xcea4('0x60')],_0x4f69ed,'Outbound');})['then'](function(_0xbab465){_0x104f0d=_0xbab465;logger[_0xcea4('0xb')](_0xcea4('0x61'));logger['info'](_0xcea4('0x62'),_0x104f0d['id']);return setRelationship(_0x4f69ed,_0x2cc782,_0x104f0d,_0xcea4('0x72'));})[_0xcea4('0x2b')](function(){return setRelationship(_0x4f69ed,_0x497678,_0x104f0d,_0xcea4('0x63'));})[_0xcea4('0x2b')](function(){return getServerInfo(_0x4f69ed);})[_0xcea4('0x2b')](function(_0x2500de){var _0x38a42c=parseInt(_0x2500de[_0xcea4('0x64')][_0xcea4('0x73')](0x0));var _0x284ee7=util[_0xcea4('0x21')](_0xcea4('0x65'),_0x588db7[_0xcea4('0x54')],_0x104f0d['id']);if(_0x38a42c>0x6){_0x284ee7=util['format'](_0xcea4('0x74'),_0x588db7[_0xcea4('0x54')],_0x104f0d['id']);}logger[_0xcea4('0xb')](_0xcea4('0x6e'),_0xcea4('0x75'));emit(util[_0xcea4('0x21')](_0xcea4('0x66'),_0x30e422[_0xcea4('0xc')]),_0xcea4('0x67'),{'uri':_0x284ee7});})['catch'](function(_0x23251d){logger[_0xcea4('0x69')](_0xcea4('0x6e'),JSON['stringify'](_0x23251d));});};exports[_0xcea4('0x76')]=function(_0x2b6ac9,_0x54099d,_0x413398,_0x1f5a23,_0x883092,_0x166f76){var _0x522801,_0x5d2ff4,_0x323a5e,_0x4e5f82;_0x166f76[_0xcea4('0x54')]=intUtil[_0xcea4('0x53')](_0x166f76['remoteUri']);_0x166f76[_0xcea4('0x55')]=intUtil['stripTrailingSlash'](_0x166f76[_0xcea4('0x55')]);def[_0xcea4('0x6b')]=util['format'](_0xcea4('0x56'),_0x166f76['remoteUri']);if(_0x883092&&_0x883092[_0xcea4('0x57')]){logger['info']('['+_0x54099d[_0xcea4('0x77')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x54099d['recordingURL']=util[_0xcea4('0x21')](_0xcea4('0x5b'),_0x166f76[_0xcea4('0x55')],_0x54099d['uniqueid'],md5(_0x54099d[_0xcea4('0x5c')]));}else{_0x54099d[_0xcea4('0x5a')]='';}return getConnection(_0x166f76)[_0xcea4('0x2b')](function(_0x4a6c16){_0x4e5f82=_0x4a6c16;if(!_[_0xcea4('0x27')](_0x1f5a23)){return getUser(_0x166f76,_0x1f5a23[_0xcea4('0xc')],_0x4e5f82);}else{return getUser(_0x166f76,null,_0x4e5f82);}})[_0xcea4('0x2b')](function(_0x4a58b6){_0x522801=_0x4a58b6;logger[_0xcea4('0xb')](_0xcea4('0x5d'),_0x522801['id']);return getEndUser(_0x166f76,_0x54099d[_0xcea4('0x5e')],_0x54099d[_0xcea4('0x5f')],_0x4e5f82);})['then'](function(_0x1506cf){_0x5d2ff4=_0x1506cf;logger[_0xcea4('0xb')](_0xcea4('0x71'),_0x5d2ff4['id']);return getTicket(_0x166f76,_0x522801,_0x5d2ff4,_0x413398,_0x54099d,_0x413398[_0xcea4('0x60')],_0x4e5f82,_0xcea4('0x78'));})[_0xcea4('0x2b')](function(_0x1fa2ce){_0x323a5e=_0x1fa2ce;logger[_0xcea4('0xb')](_0xcea4('0x61'));logger['info'](_0xcea4('0x62'),_0x323a5e['id']);return setRelationship(_0x4e5f82,_0x522801,_0x323a5e,'users');})['then'](function(){return setRelationship(_0x4e5f82,_0x5d2ff4,_0x323a5e,_0xcea4('0x63'));})[_0xcea4('0x2b')](function(){return getServerInfo(_0x4e5f82);})[_0xcea4('0x68')](function(_0x22ffe1){logger[_0xcea4('0x69')]('['+_0x54099d['lastevent'][_0xcea4('0x79')]()+']',JSON['stringify'](_0x22ffe1));});}; \ 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 3eb8842..f2c4d66 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 _0x8ef6=['slice','substring','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','content','variable','variableName','push','toString','Variable','name','toLowerCase','keyValue','keyType','string','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x8ef6,0x1a9));var _0x68ef=function(_0x115513,_0x412f0a){_0x115513=_0x115513-0x0;var _0x236619=_0x8ef6[_0x115513];return _0x236619;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));exports[_0x68ef('0x2')]=function(_0x14785f,_0x440531,_0x5da1b6){var _0x4dc49c=[];if(_0x14785f[_0x68ef('0x3')]>0x0){var _0x45fba9=_[_0x68ef('0x4')](_0x14785f,['id']);for(var _0x2ac9e9=0x0;_0x2ac9e9<_0x45fba9['length'];_0x2ac9e9++){var _0x2b425c=_0x45fba9[_0x2ac9e9];if(_0x2b425c[_0x68ef('0x5')]==='string'){_0x4dc49c['push'](_0x2b425c[_0x68ef('0x6')]);}else if(_0x2b425c['type']===_0x68ef('0x7')&&_0x2b425c[_0x68ef('0x8')]){_0x440531[_0x2b425c[_0x68ef('0x8')]]&&_0x4dc49c[_0x68ef('0x9')](_0x440531[_0x2b425c[_0x68ef('0x8')]][_0x68ef('0xa')]());}else if(_0x2b425c[_0x68ef('0x5')]==='customVariable'&&_0x2b425c['Variable']&&_0x2b425c[_0x68ef('0xb')][_0x68ef('0xc')]){_0x440531[_0x2b425c[_0x68ef('0xb')][_0x68ef('0xc')][_0x68ef('0xd')]()]&&_0x4dc49c['push'](_0x440531[_0x2b425c[_0x68ef('0xb')][_0x68ef('0xc')][_0x68ef('0xd')]()][_0x68ef('0xa')]());}else if(_0x2b425c[_0x68ef('0x5')]===_0x68ef('0xe')){if(_0x2b425c[_0x68ef('0xf')]===_0x68ef('0x10')&&_0x2b425c[_0x68ef('0x11')]){_0x4dc49c[_0x68ef('0x9')](util[_0x68ef('0x12')](_0x68ef('0x13'),_0x2b425c[_0x68ef('0x11')],_0x2b425c[_0x68ef('0x14')]));}else if(_0x2b425c[_0x68ef('0xf')]===_0x68ef('0x7')&&_0x2b425c[_0x68ef('0x8')]&&_0x2b425c[_0x68ef('0x11')]){_0x440531[_0x2b425c['variableName']]&&_0x4dc49c[_0x68ef('0x9')](util['format'](_0x68ef('0x13'),_0x2b425c[_0x68ef('0x11')],_0x440531[_0x2b425c[_0x68ef('0x8')]]));}else if(_0x2b425c[_0x68ef('0xf')]==='customVariable'&&_0x2b425c[_0x68ef('0xb')]&&_0x2b425c[_0x68ef('0xb')][_0x68ef('0xc')]&&_0x2b425c[_0x68ef('0x11')]){_0x440531[_0x2b425c[_0x68ef('0xb')]['name'][_0x68ef('0xd')]()]&&_0x4dc49c['push'](util[_0x68ef('0x12')]('%s:\x20%s',_0x2b425c[_0x68ef('0x11')],_0x440531[_0x2b425c[_0x68ef('0xb')][_0x68ef('0xc')][_0x68ef('0xd')]()]));}}}}return _0x4dc49c[_0x68ef('0x15')](_0x5da1b6);};exports[_0x68ef('0x16')]=function(_0x68f6b4){var _0x8512cb=_0x68f6b4[_0x68ef('0x17')](-0x1);if(_0x8512cb==='/'){_0x68f6b4=_0x68f6b4[_0x68ef('0x18')](0x0,_0x68f6b4['lastIndexOf'](_0x8512cb));}return _0x68f6b4;};exports[_0x68ef('0x19')]=function(_0xa0b540){if(!_[_0x68ef('0x1a')](_0xa0b540)&&_0xa0b540!==''){var _0x27371c=/^(([^<>()\[\]\\.,;:\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 _0x27371c[_0x68ef('0x1b')](String(_0xa0b540)[_0x68ef('0xd')]());}else{return![];}}; \ No newline at end of file +var _0xeb8b=['string','content','type','variable','variableName','push','toString','customVariable','name','toLowerCase','Variable','keyValue','keyType','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','util','getString','length'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xeb8b,0x1e3));var _0xbeb8=function(_0x24e407,_0x461f2e){_0x24e407=_0x24e407-0x0;var _0x4ec6e7=_0xeb8b[_0x24e407];return _0x4ec6e7;};'use strict';var _=require('lodash');var util=require(_0xbeb8('0x0'));exports[_0xbeb8('0x1')]=function(_0x581679,_0x7d8f37,_0x16aa82){var _0x1e8c3f=[];if(_0x581679['length']>0x0){var _0x2a65d4=_['sortBy'](_0x581679,['id']);for(var _0x252fb3=0x0;_0x252fb3<_0x2a65d4[_0xbeb8('0x2')];_0x252fb3++){var _0x336bd7=_0x2a65d4[_0x252fb3];if(_0x336bd7['type']===_0xbeb8('0x3')){_0x1e8c3f['push'](_0x336bd7[_0xbeb8('0x4')]);}else if(_0x336bd7[_0xbeb8('0x5')]===_0xbeb8('0x6')&&_0x336bd7[_0xbeb8('0x7')]){_0x7d8f37[_0x336bd7[_0xbeb8('0x7')]]&&_0x1e8c3f[_0xbeb8('0x8')](_0x7d8f37[_0x336bd7[_0xbeb8('0x7')]][_0xbeb8('0x9')]());}else if(_0x336bd7['type']===_0xbeb8('0xa')&&_0x336bd7['Variable']&&_0x336bd7['Variable'][_0xbeb8('0xb')]){_0x7d8f37[_0x336bd7['Variable'][_0xbeb8('0xb')][_0xbeb8('0xc')]()]&&_0x1e8c3f[_0xbeb8('0x8')](_0x7d8f37[_0x336bd7[_0xbeb8('0xd')][_0xbeb8('0xb')][_0xbeb8('0xc')]()][_0xbeb8('0x9')]());}else if(_0x336bd7['type']===_0xbeb8('0xe')){if(_0x336bd7[_0xbeb8('0xf')]===_0xbeb8('0x3')&&_0x336bd7[_0xbeb8('0x10')]){_0x1e8c3f[_0xbeb8('0x8')](util[_0xbeb8('0x11')](_0xbeb8('0x12'),_0x336bd7['key'],_0x336bd7[_0xbeb8('0x13')]));}else if(_0x336bd7[_0xbeb8('0xf')]==='variable'&&_0x336bd7[_0xbeb8('0x7')]&&_0x336bd7['key']){_0x7d8f37[_0x336bd7[_0xbeb8('0x7')]]&&_0x1e8c3f[_0xbeb8('0x8')](util[_0xbeb8('0x11')](_0xbeb8('0x12'),_0x336bd7[_0xbeb8('0x10')],_0x7d8f37[_0x336bd7['variableName']]));}else if(_0x336bd7[_0xbeb8('0xf')]===_0xbeb8('0xa')&&_0x336bd7['Variable']&&_0x336bd7[_0xbeb8('0xd')][_0xbeb8('0xb')]&&_0x336bd7[_0xbeb8('0x10')]){_0x7d8f37[_0x336bd7[_0xbeb8('0xd')]['name']['toLowerCase']()]&&_0x1e8c3f[_0xbeb8('0x8')](util['format'](_0xbeb8('0x12'),_0x336bd7[_0xbeb8('0x10')],_0x7d8f37[_0x336bd7[_0xbeb8('0xd')]['name'][_0xbeb8('0xc')]()]));}}}}return _0x1e8c3f[_0xbeb8('0x14')](_0x16aa82);};exports[_0xbeb8('0x15')]=function(_0x31a44a){var _0x23bb2f=_0x31a44a[_0xbeb8('0x16')](-0x1);if(_0x23bb2f==='/'){_0x31a44a=_0x31a44a['substring'](0x0,_0x31a44a[_0xbeb8('0x17')](_0x23bb2f));}return _0x31a44a;};exports[_0xbeb8('0x18')]=function(_0xe9f7c0){if(!_[_0xbeb8('0x19')](_0xe9f7c0)&&_0xe9f7c0!==''){var _0x3137ae=/^(([^<>()\[\]\\.,;:\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 _0x3137ae[_0xbeb8('0x1a')](String(_0xe9f7c0)[_0xbeb8('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 6959922..82d8af2 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x402993,_0x541bca){var _0x566a37=function(_0x6fd4d1){while(--_0x6fd4d1){_0x402993['push'](_0x402993['shift']());}};_0x566a37(++_0x541bca);}(_0x34e8,0x12c));var _0x834e=function(_0x2c2dc7,_0x406404){_0x2c2dc7=_0x2c2dc7-0x0;var _0x147633=_0x34e8[_0x2c2dc7];return _0x147633;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x41fe3a,_0x18a8f5){var _0x4cb26e=function(_0x42a987){while(--_0x42a987){_0x41fe3a['push'](_0x41fe3a['shift']());}};_0x4cb26e(++_0x18a8f5);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'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 81ec0f5..4d3b1c3 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 _0xab4c=['merge','Tags','name','getString','Descriptions','Fields','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','results','end-user','first','Enduser\x20found!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','[HTTP]','stringify','GET','map','forEach','picklist','type','customField','toLowerCase','content','string','custom_fields','idField','toString','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','socket.io-emitter','emit','application/json','%s/tickets.json','remoteUri'];(function(_0x1e4b6f,_0x411bc6){var _0x48b08d=function(_0x6550c3){while(--_0x6550c3){_0x1e4b6f['push'](_0x1e4b6f['shift']());}};_0x48b08d(++_0x411bc6);}(_0xab4c,0x1b6));var _0xcab4=function(_0x1b0569,_0x1d4a6b){_0x1b0569=_0x1b0569-0x0;var _0x5df4c3=_0xab4c[_0x1b0569];return _0x5df4c3;};'use strict';var _=require(_0xcab4('0x0'));var rp=require(_0xcab4('0x1'));var md5=require('md5');var util=require(_0xcab4('0x2'));var Redis=require('ioredis');var intUtil=require(_0xcab4('0x3'));var config=require(_0xcab4('0x4'));var logger=require(_0xcab4('0x5'))(_0xcab4('0x6'));config['redis']=_[_0xcab4('0x7')](config[_0xcab4('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xcab4('0x9'))(new Redis(config[_0xcab4('0x8')]));function emit(_0xdf4348,_0x1087a0,_0x639fee){io['to'](_0xdf4348)[_0xcab4('0xa')](_0x1087a0,_0x639fee);}var headers={'Content-Type':_0xcab4('0xb'),'Accept':'application/json'};function getTicket(_0x59f56f,_0x18ae10,_0x28643b,_0x1b6c51,_0x109e47){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0xcab4('0xc'),_0x59f56f[_0xcab4('0xd')]),'method':'POST','body':{'ticket':_[_0xcab4('0xe')]({'requester_id':_0x28643b['id'],'submitter_id':_0x18ae10?_0x18ae10['id']:undefined,'assignee_id':_0x18ae10?_0x18ae10['id']:undefined,'tags':getTags(_0x1b6c51[_0xcab4('0xf')],_0xcab4('0x10')),'subject':intUtil[_0xcab4('0x11')](_0x1b6c51['Subjects'],_0x109e47,'\x20'),'description':intUtil[_0xcab4('0x11')](_0x1b6c51['Descriptions'],_0x109e47,'\x0a'),'comment':{'public':![],'body':intUtil[_0xcab4('0x11')](_0x1b6c51[_0xcab4('0x12')],_0x109e47,'\x0a')}},getCustomFields(_0x1b6c51[_0xcab4('0x13')],_0x109e47))}})[_0xcab4('0x14')](function(_0x144807){logger[_0xcab4('0x15')](_0xcab4('0x16'));return _0x144807[_0xcab4('0x17')];});}function getUser(_0x16852e,_0x49adb7){if(intUtil[_0xcab4('0x18')](_0x49adb7)){logger[_0xcab4('0x15')](_0xcab4('0x19'),_0x49adb7);return request({'uri':util[_0xcab4('0x1a')](_0xcab4('0x1b'),_0x16852e[_0xcab4('0xd')]),'qs':{'query':util['format'](_0xcab4('0x1c'),_0x49adb7)}})[_0xcab4('0x14')](function(_0x5ecd78){if(_0x5ecd78[_0xcab4('0x1d')]){logger[_0xcab4('0x15')](_0xcab4('0x1e'));return _[_0xcab4('0x1f')](_0x5ecd78['results'],{'email':_0x49adb7,'role':_0xcab4('0x20')});}else{logger[_0xcab4('0x15')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xcab4('0x1a')](_0xcab4('0x21'),_0x16852e[_0xcab4('0xd')])})[_0xcab4('0x14')](function(_0x73cfad){logger['info'](_0xcab4('0x22'));return _0x73cfad[_0xcab4('0x23')];});}});}else{logger['info'](_0xcab4('0x24'));return request({'uri':util[_0xcab4('0x1a')]('%s/users/me.json',_0x16852e[_0xcab4('0xd')])})[_0xcab4('0x14')](function(_0x48c60f){logger['info'](_0xcab4('0x22'));return _0x48c60f[_0xcab4('0x23')];});}}function getEndUser(_0x5c5426,_0x264c5f,_0x3253f2){logger['info'](_0xcab4('0x25'),_0x3253f2);return request({'uri':util[_0xcab4('0x1a')](_0xcab4('0x1b'),_0x5c5426[_0xcab4('0xd')]),'qs':{'query':util[_0xcab4('0x1a')](_0xcab4('0x26'),_0x3253f2)}})[_0xcab4('0x14')](function(_0x3a332e){var _0x43e31e;if(_0x3a332e['results'][_0xcab4('0x27')]){_0x3a332e['results']=_['filter'](_0x3a332e[_0xcab4('0x28')],{'suspended':![],'role':_0xcab4('0x29')});if(_0x3a332e[_0xcab4('0x28')][_0xcab4('0x27')]){_0x43e31e=_[_0xcab4('0x2a')](_0x3a332e[_0xcab4('0x28')]);}}if(_0x43e31e){logger[_0xcab4('0x15')](_0xcab4('0x2b'));return _0x43e31e;}else{logger[_0xcab4('0x15')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xcab4('0x1a')](_0xcab4('0x2c'),_0x5c5426[_0xcab4('0xd')]),'method':_0xcab4('0x2d'),'body':{'user':{'role':_0xcab4('0x29'),'name':util[_0xcab4('0x1a')](_0xcab4('0x2e'),_0x264c5f||_0x3253f2),'phone':_0x3253f2}}})['then'](function(_0x3d101b){logger[_0xcab4('0x15')](_0xcab4('0x2f'));return _0x3d101b['user'];});}});}function getAuth(_0x1640d2){var _0x2183f4;if(_0x1640d2[_0xcab4('0x30')]==='password'){_0x2183f4=util[_0xcab4('0x1a')](_0xcab4('0x31'),_0x1640d2[_0xcab4('0x32')],_0x1640d2[_0xcab4('0x33')]);}else if(_0x1640d2[_0xcab4('0x30')]===_0xcab4('0x34')){_0x2183f4=util['format'](_0xcab4('0x35'),_0x1640d2[_0xcab4('0x32')],_0x1640d2[_0xcab4('0x34')]);}return util[_0xcab4('0x1a')](_0xcab4('0x36'),new Buffer(_0x2183f4)['toString'](_0xcab4('0x37')));}function request(_0x28dd28){logger['debug'](_0xcab4('0x38'),JSON[_0xcab4('0x39')](_0x28dd28));return rp(_[_0xcab4('0x7')](_0x28dd28,{'method':_0xcab4('0x3a'),'headers':headers,'json':!![]}));}function getTags(_0x509a62,_0x159857){var _0x3b4ad6=[];if(_0x509a62&&_0x509a62[_0xcab4('0x27')]>0x0){_0x3b4ad6=_[_0xcab4('0x3b')](_0x509a62,_0x159857);}return _0x3b4ad6;}function getCustomFields(_0x32b7e7,_0x4ca598){var _0x230b5d=[];var _0x319403={'custom_fields':[]};if(_0x32b7e7[_0xcab4('0x27')]>0x0){_[_0xcab4('0x3c')](_0x32b7e7,function(_0x3b688a){if(_['includes'](['string',_0xcab4('0x3d')],_0x3b688a[_0xcab4('0x3e')])&&_0x3b688a['nameField']&&!_0x3b688a[_0xcab4('0x3f')]){_0x319403[_0x3b688a['nameField'][_0xcab4('0x40')]()]=_0x3b688a[_0xcab4('0x41')]['toString']();}else if(_['includes']([_0xcab4('0x42'),_0xcab4('0x3d')],_0x3b688a[_0xcab4('0x3e')])&&_0x3b688a['idField']&&_0x3b688a[_0xcab4('0x3f')]){_0x319403[_0xcab4('0x43')]['push']({'id':_0x3b688a[_0xcab4('0x44')],'value':_0x3b688a[_0xcab4('0x41')][_0xcab4('0x45')]()});}else if(_0x3b688a[_0xcab4('0x3e')]===_0xcab4('0x46')&&_0x3b688a[_0xcab4('0x47')]&&_0x3b688a[_0xcab4('0x44')]&&_0x3b688a[_0xcab4('0x3f')]){_0x4ca598[_0x3b688a[_0xcab4('0x47')]]&&_0x319403[_0xcab4('0x43')]['push']({'id':_0x3b688a[_0xcab4('0x44')],'value':_0x4ca598[_0x3b688a[_0xcab4('0x47')]][_0xcab4('0x45')]()});}else if(_0x3b688a[_0xcab4('0x3e')]===_0xcab4('0x48')&&_0x3b688a[_0xcab4('0x49')]&&_0x3b688a[_0xcab4('0x49')][_0xcab4('0x10')]&&_0x3b688a[_0xcab4('0x44')]&&_0x3b688a['customField']){_0x4ca598[_0x3b688a['Variable'][_0xcab4('0x10')]['toLowerCase']()]&&_0x319403['custom_fields']['push']({'id':_0x3b688a[_0xcab4('0x44')],'value':_0x4ca598[_0x3b688a['Variable']['name']['toLowerCase']()][_0xcab4('0x45')]()});}});}return _0x319403;}exports[_0xcab4('0x4a')]=function(_0x1e79b9,_0x576d1b,_0x5847c0,_0x267bdf,_0x1d1f64,_0x448e96){var _0x1e9e82,_0x2a0f86;_0x448e96['remoteUri']=intUtil[_0xcab4('0x4b')](_0x448e96[_0xcab4('0xd')]);_0x448e96[_0xcab4('0x4c')]=intUtil['stripTrailingSlash'](_0x448e96['serverUrl']);if(_0x1d1f64&&_0x1d1f64[_0xcab4('0x4d')]){logger[_0xcab4('0x15')](_0xcab4('0x4e'),_0xcab4('0x4f'));_0x576d1b[_0xcab4('0x50')]=util['format'](_0xcab4('0x51'),_0x448e96[_0xcab4('0x4c')],_0x576d1b[_0xcab4('0x52')],md5(_0x576d1b[_0xcab4('0x52')]));}else{_0x576d1b[_0xcab4('0x50')]='';}headers['Authorization']=getAuth(_0x448e96);return getUser(_0x448e96,_0x267bdf[_0xcab4('0x53')])['then'](function(_0x42fe70){_0x1e9e82=_0x42fe70;logger['info'](_0xcab4('0x54'),_0x1e9e82['id']);return getEndUser(_0x448e96,_0x576d1b[_0xcab4('0x55')],_0x576d1b[_0xcab4('0x56')]);})[_0xcab4('0x14')](function(_0x5ad534){_0x2a0f86=_0x5ad534;logger[_0xcab4('0x15')]('The\x20Enduser\x20ID\x20is:',_0x2a0f86['id']);return getTicket(_0x448e96,_0x1e9e82,_0x2a0f86,_0x5847c0,_0x576d1b);})[_0xcab4('0x14')](function(_0x17dc6a){if(_0x17dc6a){logger[_0xcab4('0x15')]('The\x20Ticket\x20ID\x20is:',_0x17dc6a['id']);switch(_0x448e96[_0xcab4('0x3e')]){case _0xcab4('0x57'):logger[_0xcab4('0x15')]('[QUEUE]',_0xcab4('0x58'));return request({'uri':util[_0xcab4('0x1a')](_0xcab4('0x59'),_0x448e96[_0xcab4('0xd')],_0x1e9e82['id'],_0x17dc6a['id']),'method':_0xcab4('0x2d')});case _0xcab4('0x5a'):logger[_0xcab4('0x15')](_0xcab4('0x4e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xcab4('0x1a')](_0xcab4('0x5b'),_0x267bdf[_0xcab4('0x10')]),_0xcab4('0x5c'),{'uri':util['format'](_0xcab4('0x5d'),_0x448e96[_0xcab4('0xd')][_0xcab4('0x5e')]('/api/v2',''),_0x17dc6a['id'])});break;default:logger[_0xcab4('0x5f')](_0xcab4('0x4e'),_0xcab4('0x60'));}}})['catch'](function(_0x41e731){logger[_0xcab4('0x5f')](_0xcab4('0x61'),util[_0xcab4('0x62')](_0x41e731,{'showHidden':!![],'depth':null}));});};exports[_0xcab4('0x63')]=function(_0x5c5735,_0x1b704c,_0xf80f5b,_0xc6d419,_0x582fb7,_0x8b1efc,_0x21d1c9){var _0x5f419c,_0x14f537;_0x8b1efc['remoteUri']=intUtil[_0xcab4('0x4b')](_0x8b1efc[_0xcab4('0xd')]);_0x8b1efc[_0xcab4('0x4c')]=intUtil[_0xcab4('0x4b')](_0x8b1efc[_0xcab4('0x4c')]);if(_0x21d1c9&&_0x21d1c9['recordingFormat']&&_0x21d1c9[_0xcab4('0x64')]!==_0xcab4('0x65')){logger[_0xcab4('0x15')](_0xcab4('0x66'),_0xcab4('0x4f'));_0x1b704c[_0xcab4('0x50')]=util[_0xcab4('0x1a')](_0xcab4('0x51'),_0x8b1efc[_0xcab4('0x4c')],_0x1b704c[_0xcab4('0x52')],md5(_0x1b704c['uniqueid']));}headers[_0xcab4('0x67')]=getAuth(_0x8b1efc);return getUser(_0x8b1efc,_0xc6d419[_0xcab4('0x53')])[_0xcab4('0x14')](function(_0x4476c3){_0x5f419c=_0x4476c3;logger[_0xcab4('0x15')](_0xcab4('0x54'),_0x5f419c['id']);return getEndUser(_0x8b1efc,_0x1b704c[_0xcab4('0x68')],_0x1b704c['destcalleridnum']);})[_0xcab4('0x14')](function(_0x2893cd){_0x14f537=_0x2893cd;logger[_0xcab4('0x15')](_0xcab4('0x69'),_0x14f537['id']);return getTicket(_0x8b1efc,_0x5f419c,_0x14f537,_0xf80f5b,_0x1b704c);})['then'](function(_0x44294e){if(_0x44294e){logger[_0xcab4('0x15')](_0xcab4('0x6a'),_0x44294e['id']);switch(_0x8b1efc[_0xcab4('0x3e')]){case _0xcab4('0x57'):logger[_0xcab4('0x15')](_0xcab4('0x66'),_0xcab4('0x58'));return request({'uri':util[_0xcab4('0x1a')](_0xcab4('0x59'),_0x8b1efc[_0xcab4('0xd')],_0x5f419c['id'],_0x44294e['id']),'method':'POST'});case _0xcab4('0x5a'):logger['info'](_0xcab4('0x66'),_0xcab4('0x6b'));emit(util[_0xcab4('0x1a')]('user:%s',_0xc6d419['name']),_0xcab4('0x5c'),{'uri':util[_0xcab4('0x1a')]('%s/agent/tickets/%s',_0x8b1efc['remoteUri']['replace']('/api/v2',''),_0x44294e['id'])});break;default:logger['error'](_0xcab4('0x66'),_0xcab4('0x60'));}}})[_0xcab4('0x6c')](function(_0x6e2436){logger[_0xcab4('0x5f')](_0xcab4('0x6d'),util[_0xcab4('0x62')](_0x6e2436,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x1d8bc4,_0xda9fef,_0x1d9eb1,_0x1438c7,_0x12ce3f,_0x6a1d7e){var _0x11904e,_0x131a8c;_0x6a1d7e['remoteUri']=intUtil[_0xcab4('0x4b')](_0x6a1d7e[_0xcab4('0xd')]);_0x6a1d7e[_0xcab4('0x4c')]=intUtil['stripTrailingSlash'](_0x6a1d7e[_0xcab4('0x4c')]);if(_0x12ce3f&&_0x12ce3f[_0xcab4('0x4d')]){logger['info']('['+_0xda9fef[_0xcab4('0x6e')][_0xcab4('0x6f')]()+']',_0xcab4('0x4f'));_0xda9fef[_0xcab4('0x50')]=util['format'](_0xcab4('0x51'),_0x6a1d7e[_0xcab4('0x4c')],_0xda9fef[_0xcab4('0x52')],md5(_0xda9fef['uniqueid']));}else{_0xda9fef['recordingURL']='';}headers[_0xcab4('0x67')]=getAuth(_0x6a1d7e);return getUser(_0x6a1d7e)[_0xcab4('0x14')](function(_0x2c3b4c){_0x11904e=_0x2c3b4c;logger['info'](_0xcab4('0x54'),_0x11904e['id']);return getEndUser(_0x6a1d7e,_0xda9fef[_0xcab4('0x55')],_0xda9fef[_0xcab4('0x56')]);})[_0xcab4('0x14')](function(_0x4dee08){_0x131a8c=_0x4dee08;logger['info'](_0xcab4('0x69'),_0x131a8c['id']);return getTicket(_0x6a1d7e,_0x11904e,_0x131a8c,_0x1d9eb1,_0xda9fef);})['then'](function(_0x5c3da8){if(_0x5c3da8){logger[_0xcab4('0x15')]('The\x20Ticket\x20ID\x20is:',_0x5c3da8['id']);}})[_0xcab4('0x6c')](function(_0x1ec979){logger[_0xcab4('0x5f')]('['+_0xda9fef[_0xcab4('0x6e')][_0xcab4('0x6f')]()+']'+_0xcab4('0x70'),util[_0xcab4('0x62')](_0x1ec979,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xbab5=['calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','end-user','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','forEach','includes','string','picklist','type','nameField','customField','idField','custom_fields','push','content','variable','variableName','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:'];(function(_0x359bfd,_0x47183f){var _0x3873ba=function(_0x104ddd){while(--_0x104ddd){_0x359bfd['push'](_0x359bfd['shift']());}};_0x3873ba(++_0x47183f);}(_0xbab5,0x10d));var _0x5bab=function(_0x1386c6,_0x114069){_0x1386c6=_0x1386c6-0x0;var _0x1e8fd8=_0xbab5[_0x1386c6];return _0x1e8fd8;};'use strict';var _=require(_0x5bab('0x0'));var rp=require(_0x5bab('0x1'));var md5=require(_0x5bab('0x2'));var util=require(_0x5bab('0x3'));var Redis=require(_0x5bab('0x4'));var intUtil=require(_0x5bab('0x5'));var config=require(_0x5bab('0x6'));var logger=require(_0x5bab('0x7'))(_0x5bab('0x8'));config[_0x5bab('0x9')]=_['defaults'](config[_0x5bab('0x9')],{'host':_0x5bab('0xa'),'port':0x18eb});var io=require(_0x5bab('0xb'))(new Redis(config[_0x5bab('0x9')]));function emit(_0x299c06,_0x51352d,_0x4d5e0d){io['to'](_0x299c06)[_0x5bab('0xc')](_0x51352d,_0x4d5e0d);}var headers={'Content-Type':_0x5bab('0xd'),'Accept':_0x5bab('0xd')};function getTicket(_0xd2af71,_0x31de5e,_0x43e88b,_0x554414,_0x3ec0d2){logger[_0x5bab('0xe')](_0x5bab('0xf'));return request({'uri':util[_0x5bab('0x10')](_0x5bab('0x11'),_0xd2af71[_0x5bab('0x12')]),'method':_0x5bab('0x13'),'body':{'ticket':_[_0x5bab('0x14')]({'requester_id':_0x43e88b['id'],'submitter_id':_0x31de5e?_0x31de5e['id']:undefined,'assignee_id':_0x31de5e?_0x31de5e['id']:undefined,'tags':getTags(_0x554414[_0x5bab('0x15')],_0x5bab('0x16')),'subject':intUtil[_0x5bab('0x17')](_0x554414[_0x5bab('0x18')],_0x3ec0d2,'\x20'),'description':intUtil[_0x5bab('0x17')](_0x554414[_0x5bab('0x19')],_0x3ec0d2,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x554414[_0x5bab('0x19')],_0x3ec0d2,'\x0a')}},getCustomFields(_0x554414[_0x5bab('0x1a')],_0x3ec0d2))}})[_0x5bab('0x1b')](function(_0x336374){logger[_0x5bab('0xe')](_0x5bab('0x1c'));return _0x336374[_0x5bab('0x1d')];});}function getUser(_0x46c96b,_0x40f1f8){if(intUtil[_0x5bab('0x1e')](_0x40f1f8)){logger[_0x5bab('0xe')](_0x5bab('0x1f'),_0x40f1f8);return request({'uri':util[_0x5bab('0x10')](_0x5bab('0x20'),_0x46c96b[_0x5bab('0x12')]),'qs':{'query':util[_0x5bab('0x10')](_0x5bab('0x21'),_0x40f1f8)}})[_0x5bab('0x1b')](function(_0x338bde){if(_0x338bde['count']){logger[_0x5bab('0xe')]('Agent\x20found!');return _[_0x5bab('0x22')](_0x338bde['results'],{'email':_0x40f1f8,'role':_0x5bab('0x23')});}else{logger[_0x5bab('0xe')](_0x5bab('0x24'));return request({'uri':util[_0x5bab('0x10')]('%s/users/me.json',_0x46c96b['remoteUri'])})[_0x5bab('0x1b')](function(_0x2671a6){logger['info'](_0x5bab('0x25'));return _0x2671a6[_0x5bab('0x26')];});}});}else{logger[_0x5bab('0xe')](_0x5bab('0x24'));return request({'uri':util[_0x5bab('0x10')](_0x5bab('0x27'),_0x46c96b[_0x5bab('0x12')])})['then'](function(_0x36c008){logger[_0x5bab('0xe')](_0x5bab('0x25'));return _0x36c008['user'];});}}function getEndUser(_0xacbe8a,_0x5ee520,_0x85e780){logger[_0x5bab('0xe')](_0x5bab('0x28'),_0x85e780);return request({'uri':util[_0x5bab('0x10')](_0x5bab('0x20'),_0xacbe8a[_0x5bab('0x12')]),'qs':{'query':util[_0x5bab('0x10')](_0x5bab('0x29'),_0x85e780)}})[_0x5bab('0x1b')](function(_0xae2605){var _0x2e4ec8;if(_0xae2605[_0x5bab('0x2a')][_0x5bab('0x2b')]){_0xae2605[_0x5bab('0x2a')]=_['filter'](_0xae2605['results'],{'suspended':![],'role':_0x5bab('0x2c')});if(_0xae2605[_0x5bab('0x2a')][_0x5bab('0x2b')]){_0x2e4ec8=_['first'](_0xae2605[_0x5bab('0x2a')]);}}if(_0x2e4ec8){logger['info']('Enduser\x20found!');return _0x2e4ec8;}else{logger['info'](_0x5bab('0x2d'));return request({'uri':util[_0x5bab('0x10')](_0x5bab('0x2e'),_0xacbe8a[_0x5bab('0x12')]),'method':'POST','body':{'user':{'role':_0x5bab('0x2c'),'name':util[_0x5bab('0x10')](_0x5bab('0x2f'),_0x5ee520||_0x85e780),'phone':_0x85e780}}})[_0x5bab('0x1b')](function(_0x296759){logger[_0x5bab('0xe')](_0x5bab('0x30'));return _0x296759[_0x5bab('0x26')];});}});}function getAuth(_0x387366){var _0x214636;if(_0x387366[_0x5bab('0x31')]===_0x5bab('0x32')){_0x214636=util[_0x5bab('0x10')](_0x5bab('0x33'),_0x387366['username'],_0x387366['password']);}else if(_0x387366['authType']===_0x5bab('0x34')){_0x214636=util[_0x5bab('0x10')](_0x5bab('0x35'),_0x387366['username'],_0x387366[_0x5bab('0x34')]);}return util['format'](_0x5bab('0x36'),new Buffer(_0x214636)[_0x5bab('0x37')](_0x5bab('0x38')));}function request(_0x3a74ab){logger[_0x5bab('0x39')](_0x5bab('0x3a'),JSON[_0x5bab('0x3b')](_0x3a74ab));return rp(_[_0x5bab('0x3c')](_0x3a74ab,{'method':_0x5bab('0x3d'),'headers':headers,'json':!![]}));}function getTags(_0x30927c,_0x32a125){var _0x4c13e1=[];if(_0x30927c&&_0x30927c[_0x5bab('0x2b')]>0x0){_0x4c13e1=_[_0x5bab('0x3e')](_0x30927c,_0x32a125);}return _0x4c13e1;}function getCustomFields(_0x38d387,_0x2b7ff4){var _0x317642=[];var _0x2a1950={'custom_fields':[]};if(_0x38d387[_0x5bab('0x2b')]>0x0){_[_0x5bab('0x3f')](_0x38d387,function(_0x2cf2ee){if(_[_0x5bab('0x40')]([_0x5bab('0x41'),_0x5bab('0x42')],_0x2cf2ee[_0x5bab('0x43')])&&_0x2cf2ee[_0x5bab('0x44')]&&!_0x2cf2ee[_0x5bab('0x45')]){_0x2a1950[_0x2cf2ee[_0x5bab('0x44')]['toLowerCase']()]=_0x2cf2ee['content'][_0x5bab('0x37')]();}else if(_['includes'](['string',_0x5bab('0x42')],_0x2cf2ee[_0x5bab('0x43')])&&_0x2cf2ee[_0x5bab('0x46')]&&_0x2cf2ee[_0x5bab('0x45')]){_0x2a1950[_0x5bab('0x47')][_0x5bab('0x48')]({'id':_0x2cf2ee[_0x5bab('0x46')],'value':_0x2cf2ee[_0x5bab('0x49')][_0x5bab('0x37')]()});}else if(_0x2cf2ee[_0x5bab('0x43')]===_0x5bab('0x4a')&&_0x2cf2ee['variableName']&&_0x2cf2ee[_0x5bab('0x46')]&&_0x2cf2ee[_0x5bab('0x45')]){_0x2b7ff4[_0x2cf2ee[_0x5bab('0x4b')]]&&_0x2a1950['custom_fields'][_0x5bab('0x48')]({'id':_0x2cf2ee['idField'],'value':_0x2b7ff4[_0x2cf2ee[_0x5bab('0x4b')]][_0x5bab('0x37')]()});}else if(_0x2cf2ee['type']==='customVariable'&&_0x2cf2ee['Variable']&&_0x2cf2ee['Variable'][_0x5bab('0x16')]&&_0x2cf2ee[_0x5bab('0x46')]&&_0x2cf2ee[_0x5bab('0x45')]){_0x2b7ff4[_0x2cf2ee[_0x5bab('0x4c')][_0x5bab('0x16')][_0x5bab('0x4d')]()]&&_0x2a1950['custom_fields'][_0x5bab('0x48')]({'id':_0x2cf2ee[_0x5bab('0x46')],'value':_0x2b7ff4[_0x2cf2ee[_0x5bab('0x4c')][_0x5bab('0x16')][_0x5bab('0x4d')]()][_0x5bab('0x37')]()});}});}return _0x2a1950;}exports[_0x5bab('0x4e')]=function(_0x4e21ef,_0x63d0d1,_0x138f9a,_0x59447e,_0x45ea86,_0x1eac06){var _0x135024,_0xd73945;_0x1eac06[_0x5bab('0x12')]=intUtil[_0x5bab('0x4f')](_0x1eac06[_0x5bab('0x12')]);_0x1eac06[_0x5bab('0x50')]=intUtil[_0x5bab('0x4f')](_0x1eac06['serverUrl']);if(_0x45ea86&&_0x45ea86['monitor_format']){logger[_0x5bab('0xe')](_0x5bab('0x51'),_0x5bab('0x52'));_0x63d0d1['recordingURL']=util[_0x5bab('0x10')](_0x5bab('0x53'),_0x1eac06['serverUrl'],_0x63d0d1[_0x5bab('0x54')],md5(_0x63d0d1[_0x5bab('0x54')]));}else{_0x63d0d1[_0x5bab('0x55')]='';}headers[_0x5bab('0x56')]=getAuth(_0x1eac06);return getUser(_0x1eac06,_0x59447e['email'])['then'](function(_0x39b8b7){_0x135024=_0x39b8b7;logger[_0x5bab('0xe')](_0x5bab('0x57'),_0x135024['id']);return getEndUser(_0x1eac06,_0x63d0d1[_0x5bab('0x58')],_0x63d0d1[_0x5bab('0x59')]);})['then'](function(_0x215ad6){_0xd73945=_0x215ad6;logger['info'](_0x5bab('0x5a'),_0xd73945['id']);return getTicket(_0x1eac06,_0x135024,_0xd73945,_0x138f9a,_0x63d0d1);})[_0x5bab('0x1b')](function(_0x248783){if(_0x248783){logger[_0x5bab('0xe')](_0x5bab('0x5b'),_0x248783['id']);switch(_0x1eac06['type']){case _0x5bab('0x5c'):logger[_0x5bab('0xe')](_0x5bab('0x51'),_0x5bab('0x5d'));return request({'uri':util[_0x5bab('0x10')](_0x5bab('0x5e'),_0x1eac06[_0x5bab('0x12')],_0x135024['id'],_0x248783['id']),'method':'POST'});case _0x5bab('0x5f'):logger[_0x5bab('0xe')](_0x5bab('0x51'),_0x5bab('0x60'));emit(util[_0x5bab('0x10')](_0x5bab('0x61'),_0x59447e[_0x5bab('0x16')]),_0x5bab('0x62'),{'uri':util[_0x5bab('0x10')](_0x5bab('0x63'),_0x1eac06['remoteUri'][_0x5bab('0x64')](_0x5bab('0x65'),''),_0x248783['id'])});break;default:logger[_0x5bab('0x66')](_0x5bab('0x51'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x5bab('0x67')](function(_0x5a44f3){logger[_0x5bab('0x66')](_0x5bab('0x68'),util[_0x5bab('0x69')](_0x5a44f3,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x4de7db,_0x15af9a,_0x45f759,_0x4a0814,_0x860563,_0x567cd0,_0x3a2782){var _0xfd687b,_0x3026be;_0x567cd0['remoteUri']=intUtil[_0x5bab('0x4f')](_0x567cd0[_0x5bab('0x12')]);_0x567cd0[_0x5bab('0x50')]=intUtil[_0x5bab('0x4f')](_0x567cd0[_0x5bab('0x50')]);if(_0x3a2782&&_0x3a2782[_0x5bab('0x6a')]&&_0x3a2782[_0x5bab('0x6a')]!==_0x5bab('0x6b')){logger[_0x5bab('0xe')](_0x5bab('0x6c'),_0x5bab('0x52'));_0x15af9a['recordingURL']=util[_0x5bab('0x10')](_0x5bab('0x53'),_0x567cd0['serverUrl'],_0x15af9a[_0x5bab('0x54')],md5(_0x15af9a[_0x5bab('0x54')]));}headers[_0x5bab('0x56')]=getAuth(_0x567cd0);return getUser(_0x567cd0,_0x4a0814[_0x5bab('0x6d')])[_0x5bab('0x1b')](function(_0x4436e5){_0xfd687b=_0x4436e5;logger[_0x5bab('0xe')](_0x5bab('0x57'),_0xfd687b['id']);return getEndUser(_0x567cd0,_0x15af9a[_0x5bab('0x6e')],_0x15af9a[_0x5bab('0x6f')]);})[_0x5bab('0x1b')](function(_0x4d59c5){_0x3026be=_0x4d59c5;logger['info'](_0x5bab('0x5a'),_0x3026be['id']);return getTicket(_0x567cd0,_0xfd687b,_0x3026be,_0x45f759,_0x15af9a);})[_0x5bab('0x1b')](function(_0x2ea735){if(_0x2ea735){logger['info'](_0x5bab('0x5b'),_0x2ea735['id']);switch(_0x567cd0[_0x5bab('0x43')]){case'integrationTab':logger['info'](_0x5bab('0x6c'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x5bab('0x10')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x567cd0[_0x5bab('0x12')],_0xfd687b['id'],_0x2ea735['id']),'method':_0x5bab('0x13')});case _0x5bab('0x5f'):logger[_0x5bab('0xe')](_0x5bab('0x6c'),_0x5bab('0x60'));emit(util[_0x5bab('0x10')]('user:%s',_0x4a0814[_0x5bab('0x16')]),'trigger:browser:url',{'uri':util['format'](_0x5bab('0x63'),_0x567cd0[_0x5bab('0x12')]['replace'](_0x5bab('0x65'),''),_0x2ea735['id'])});break;default:logger[_0x5bab('0x66')]('[OUTBOUND]',_0x5bab('0x70'));}}})['catch'](function(_0x2c3f8e){logger[_0x5bab('0x66')](_0x5bab('0x71'),util[_0x5bab('0x69')](_0x2c3f8e,{'showHidden':!![],'depth':null}));});};exports[_0x5bab('0x72')]=function(_0x30e882,_0x6f1574,_0x675479,_0x56b50d,_0xa56e7f,_0x473271){var _0x2f875d,_0x12a0a0;_0x473271['remoteUri']=intUtil[_0x5bab('0x4f')](_0x473271[_0x5bab('0x12')]);_0x473271[_0x5bab('0x50')]=intUtil[_0x5bab('0x4f')](_0x473271['serverUrl']);if(_0xa56e7f&&_0xa56e7f[_0x5bab('0x73')]){logger[_0x5bab('0xe')]('['+_0x6f1574[_0x5bab('0x74')][_0x5bab('0x75')]()+']',_0x5bab('0x52'));_0x6f1574[_0x5bab('0x55')]=util[_0x5bab('0x10')](_0x5bab('0x53'),_0x473271[_0x5bab('0x50')],_0x6f1574['uniqueid'],md5(_0x6f1574['uniqueid']));}else{_0x6f1574[_0x5bab('0x55')]='';}headers[_0x5bab('0x56')]=getAuth(_0x473271);return getUser(_0x473271)['then'](function(_0x4b34f4){_0x2f875d=_0x4b34f4;logger[_0x5bab('0xe')](_0x5bab('0x57'),_0x2f875d['id']);return getEndUser(_0x473271,_0x6f1574[_0x5bab('0x58')],_0x6f1574[_0x5bab('0x59')]);})[_0x5bab('0x1b')](function(_0x295712){_0x12a0a0=_0x295712;logger[_0x5bab('0xe')](_0x5bab('0x5a'),_0x12a0a0['id']);return getTicket(_0x473271,_0x2f875d,_0x12a0a0,_0x675479,_0x6f1574);})[_0x5bab('0x1b')](function(_0x1aa465){if(_0x1aa465){logger[_0x5bab('0xe')](_0x5bab('0x5b'),_0x1aa465['id']);}})[_0x5bab('0x67')](function(_0x24b230){logger['error']('['+_0x6f1574[_0x5bab('0x74')][_0x5bab('0x75')]()+']'+_0x5bab('0x76'),util[_0x5bab('0x69')](_0x24b230,{'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 1cc472d..0f54493 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 _0x01e7=['destcalleridname','[OUTBOUND]','trigger:browser:url','unmanaged','toUpperCase','Recording\x20is\x20enabled!','lodash','util','ioredis','bluebird','../../../../config/environment','zoho','redis','defaults','socket.io-emitter','[HTTP]','length','includes','string','picklist','idField','content','toString','variable','variableName','type','customVariable','Variable','name','toLowerCase','isNil','access_token','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','seconds','catch','error','stack','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','POST','https://www.zohoapis.','/crm/v2/','role','first_name','last_name','code','SUCCESS','enduserType','startCase','log','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','moduleCreate','nothing','contact','uri','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','format','mm:ss','answertime','Call_Duration','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Call_Result','Called','connect','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','details','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','zoho.eu'];(function(_0x7ccb75,_0x235565){var _0x3e1ab3=function(_0x40d14c){while(--_0x40d14c){_0x7ccb75['push'](_0x7ccb75['shift']());}};_0x3e1ab3(++_0x235565);}(_0x01e7,0x134));var _0x701e=function(_0x3fe328,_0x2defaa){_0x3fe328=_0x3fe328-0x0;var _0x2007aa=_0x01e7[_0x3fe328];return _0x2007aa;};'use strict';var _=require(_0x701e('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x701e('0x1'));var intUtil=require('./util');var moment=require('moment');var Redis=require(_0x701e('0x2'));var BPromise=require(_0x701e('0x3'));var config=require(_0x701e('0x4'));var logger=require('../../../../config/logger')(_0x701e('0x5'));config[_0x701e('0x6')]=_[_0x701e('0x7')](config[_0x701e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x701e('0x8'))(new Redis(config[_0x701e('0x6')]));function emit(_0x4f4d6c,_0x43a118,_0x52168e){io['to'](_0x4f4d6c)['emit'](_0x43a118,_0x52168e);}function request(_0x37171){logger['debug'](_0x701e('0x9'),JSON['stringify'](_0x37171));return rp(_0x37171);}function getCustomFields(_0x2236d5,_0x2ef2b1){var _0x5998fd={};if(_0x2236d5[_0x701e('0xa')]>0x0){_['forEach'](_0x2236d5,function(_0x557b3a){if(_[_0x701e('0xb')]([_0x701e('0xc'),_0x701e('0xd')],_0x557b3a['type'])&&_0x557b3a[_0x701e('0xe')]){_0x5998fd[_0x557b3a[_0x701e('0xe')]]=_0x557b3a[_0x701e('0xf')][_0x701e('0x10')]();}else if(_0x557b3a['type']===_0x701e('0x11')&&_0x557b3a[_0x701e('0x12')]&&_0x557b3a[_0x701e('0xe')]&&_0x2ef2b1[_0x557b3a[_0x701e('0x12')]]){_0x5998fd[_0x557b3a[_0x701e('0xe')]]=_0x2ef2b1[_0x557b3a[_0x701e('0x12')]][_0x701e('0x10')]();}else if(_0x557b3a[_0x701e('0x13')]===_0x701e('0x14')&&_0x557b3a[_0x701e('0x15')]&&_0x557b3a[_0x701e('0x15')][_0x701e('0x16')]&&_0x557b3a[_0x701e('0xe')]&&_0x2ef2b1[_0x557b3a[_0x701e('0x15')][_0x701e('0x16')]['toLowerCase']()]){_0x5998fd[_0x557b3a[_0x701e('0xe')]]=_0x2ef2b1[_0x557b3a[_0x701e('0x15')][_0x701e('0x16')][_0x701e('0x17')]()]['toString']();}});}return _0x5998fd;}function getName(_0x44f80d){if(_0x44f80d['indexOf']('\x20')>0x0){var _0x3a3760=_0x44f80d['split'](/ (.+)/);if(_0x3a3760[0x1]){return _0x3a3760;}}return[_0x44f80d,_0x44f80d];}var accountsTokens={};function getAccessToken(_0x277d2e){return new Promise(function(_0x56fb69,_0x567442){if(!_[_0x701e('0x18')](accountsTokens[_0x277d2e['id']])&&!_[_0x701e('0x18')](accountsTokens[_0x277d2e['id']][_0x701e('0x19')])){if(moment()['isBefore'](accountsTokens[_0x277d2e['id']][_0x701e('0x1a')])){_0x56fb69(accountsTokens[_0x277d2e['id']][_0x701e('0x19')]);}}var _0x3b18d3;switch(_0x277d2e[_0x701e('0x1b')]){case'US':_0x3b18d3='https://accounts.zoho.com';break;case'AU':_0x3b18d3=_0x701e('0x1c');break;case'EU':_0x3b18d3=_0x701e('0x1d');break;case'IN':_0x3b18d3=_0x701e('0x1e');break;case'CN':_0x3b18d3='https://accounts.zoho.com.cn';break;default:_0x3b18d3=_0x701e('0x1d');break;}var _0x454bca={'method':'POST','uri':_0x3b18d3+_0x701e('0x1f'),'qs':{'refresh_token':_0x277d2e[_0x701e('0x20')],'client_id':_0x277d2e[_0x701e('0x21')],'client_secret':_0x277d2e[_0x701e('0x22')],'grant_type':_0x701e('0x23')},'json':!![]};return rp(_0x454bca)[_0x701e('0x24')](function(_0x583209){accountsTokens[_0x277d2e['id']]={'access_token':_0x583209['access_token'],'expires_in':moment()['add'](_0x583209[_0x701e('0x1a')],_0x701e('0x25'))};_0x56fb69(_0x583209[_0x701e('0x19')]);})[_0x701e('0x26')](function(_0x429c71){logger[_0x701e('0x27')]('Failing\x20creating\x20the\x20access_token',_0x429c71[_0x701e('0x28')]);_0x567442(_0x429c71);});});}function getUser(_0x170fc2,_0x152570,_0x183517,_0x4ab73d){logger['info'](_0x701e('0x29'));return request({'method':_0x701e('0x2a'),'uri':util['format'](_0x701e('0x2b'),_0x152570),'qs':{'type':_0x701e('0x2c')},'headers':{'Authorization':_0x701e('0x2d')+_0x170fc2},'json':!![]})['then'](function(_0x530fa1){if(_0x530fa1[_0x701e('0x2e')]){var _0x19bba4=-0x1;if(_[_0x701e('0x2f')](_0x530fa1[_0x701e('0x2e')])){if(!_[_0x701e('0x18')](_0x4ab73d)){_0x19bba4=_['findIndex'](_0x530fa1['users'],function(_0x202443){return _0x202443[_0x701e('0x30')]===_0x4ab73d;});}if(_0x19bba4>=0x0){logger[_0x701e('0x31')](_0x701e('0x32'));}else{logger[_0x701e('0x31')](_0x701e('0x33'));_0x19bba4=_['findIndex'](_0x530fa1[_0x701e('0x2e')],function(_0x51efdd){return _0x51efdd[_0x701e('0x34')][_0x701e('0x16')]===_0x701e('0x35');});}return _0x530fa1[_0x701e('0x2e')][_0x19bba4];}else{if(_0x530fa1[_0x701e('0x36')][_0x701e('0x34')][_0x701e('0x16')]==='Administrator'){logger[_0x701e('0x31')]('Using\x20the\x20admin\x20account!');user=_0x530fa1[_0x701e('0x36')];return user;}else{logger['error'](_0x701e('0x37'),JSON[_0x701e('0x38')](_0x530fa1));throw new Error(_0x701e('0x39')+JSON[_0x701e('0x38')](_0x530fa1));}}}else{logger['error'](_0x701e('0x37'),JSON[_0x701e('0x38')](_0x530fa1));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x701e('0x38')](_0x530fa1));}})[_0x701e('0x26')](function(_0x19c9fa){console[_0x701e('0x27')](_0x19c9fa);});}function getZohoUser(_0x394ce5,_0xe1b24){return new BPromise(function(_0x366501,_0x1cada1){request(_0x394ce5)[_0x701e('0x24')](function(_0x1bed8d){var _0x503b67=null;if(_0x1bed8d){_0x503b67=_0x1bed8d[_0x701e('0x3a')][0x0];_0x503b67['enduserType']=_0xe1b24;}_0x366501(_0x503b67);})['catch'](function(_0x434d2c){_0x1cada1(_0x434d2c);});});}function createEndUser(_0x3cd9b8,_0x375ae8,_0x4bdf82,_0x10dc64,_0x2354c9,_0x52b30c){var _0x4bdf82=getName(_0x4bdf82);return request({'method':_0x701e('0x3b'),'uri':_0x701e('0x3c')+_0x375ae8+_0x701e('0x3d')+_['startCase'](_0x52b30c['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x4bdf82[0x1],'First_Name':_0x4bdf82[0x0],'Phone':_0x10dc64,'Owner':{'name':!_['isNil'](_0x2354c9[_0x701e('0x3e')][_0x701e('0x16')])?_0x2354c9[_0x701e('0x3e')][_0x701e('0x16')]:!_['isNil'](_0x2354c9[_0x701e('0x3f')])?_0x2354c9['first_name']+'\x20'+_0x2354c9[_0x701e('0x40')]:_0x2354c9['last_name'],'id':_0x2354c9['id']}}]},'headers':{'Authorization':_0x701e('0x2d')+_0x3cd9b8},'json':!![]})[_0x701e('0x24')](function(_0x3b56a4){if(_0x3b56a4&&_0x3b56a4['data'][0x0][_0x701e('0x41')]===_0x701e('0x42')){var _0x228813=_0x3b56a4[_0x701e('0x3a')][0x0]['details'];_0x228813[_0x701e('0x43')]=_[_0x701e('0x44')](_0x52b30c['moduleCreate'])+'s';return _0x228813;}logger[_0x701e('0x27')](_0x701e('0x37'),JSON[_0x701e('0x38')](data));throw new Error('Error:\x20'+JSON[_0x701e('0x38')](data));})[_0x701e('0x26')](function(_0x26596d){console[_0x701e('0x45')](_0x701e('0x46'),_0x26596d);});}function getEndUser(_0x3c454d,_0x403213,_0x193c67,_0x183ff8,_0x25d4fe,_0x2103cd,_0x5bf532){var _0x5eb256={'method':_0x701e('0x2a'),'uri':'','headers':{'Authorization':_0x701e('0x2d')+_0x3c454d},'json':!![]};switch(_0x5bf532[_0x701e('0x47')]){case _0x701e('0x48'):_0x5eb256['uri']=_0x701e('0x3c')+_0x403213+_0x701e('0x49')+_0x25d4fe+'))';return getZohoUser(_0x5eb256,_0x701e('0x4a'))[_0x701e('0x24')](function(_0x4a4d7e){if(_0x4a4d7e)return _0x4a4d7e;_0x5eb256['uri']=_0x701e('0x3c')+_0x403213+_0x701e('0x4b')+_0x25d4fe+'))';return getZohoUser(_0x5eb256,_0x701e('0x4c'))['then'](function(_0x532b19){if(_0x532b19)return _0x532b19;if(_0x5bf532[_0x701e('0x4d')]!=_0x701e('0x4e')){return createEndUser(_0x3c454d,_0x403213,_0x183ff8,_0x25d4fe,_0x2103cd,_0x5bf532);}else{return{};}});});break;case _0x701e('0x4f'):_0x5eb256[_0x701e('0x50')]=_0x701e('0x3c')+_0x403213+_0x701e('0x49')+_0x25d4fe+'))';return getZohoUser(_0x5eb256,_0x701e('0x4a'))[_0x701e('0x24')](function(_0x46f781){if(_0x46f781)return _0x46f781;if(_0x5bf532[_0x701e('0x4d')]!=_0x701e('0x4e')){return createEndUser(_0x3c454d,_0x403213,_0x183ff8,_0x25d4fe,_0x2103cd,_0x5bf532);}else{return{};}});break;case _0x701e('0x51'):_0x5eb256[_0x701e('0x50')]='https://www.zohoapis.'+_0x403213+_0x701e('0x4b')+_0x25d4fe+'))';return getZohoUser(_0x5eb256,_0x701e('0x4c'))[_0x701e('0x24')](function(_0x21fddd){if(_0x21fddd)return _0x21fddd;if(_0x5bf532[_0x701e('0x4d')]!='nothing'){return createEndUser(_0x3c454d,_0x403213,_0x183ff8,_0x25d4fe,_0x2103cd,_0x5bf532);}else{return{};}});break;}}function getCall(_0x47873b,_0x24199f,_0x181a19,_0x243251,_0x4f88f0,_0x220ef4,_0x15921a,_0x194102){logger['info'](_0x701e('0x52'));var _0x4ac437={};_0x4ac437[_0x701e('0x53')]={'name':!_[_0x701e('0x18')](_0x243251['role'][_0x701e('0x16')])&&!_['isNil'](_0x243251[_0x701e('0x34')][_0x701e('0x16')])&&_0x243251[_0x701e('0x34')][_0x701e('0x16')]===_0x701e('0x54')?_0x243251['role'][_0x701e('0x16')]:!_[_0x701e('0x18')](_0x243251[_0x701e('0x3f')])?_0x243251[_0x701e('0x3f')]+'\x20'+_0x243251['last_name']:_0x243251[_0x701e('0x40')],'id':_0x243251['id']};_0x4ac437[_0x701e('0x55')]=intUtil[_0x701e('0x56')](_0x220ef4[_0x701e('0x57')],_0x15921a,'\x20');_0x4ac437['Description']=intUtil[_0x701e('0x56')](_0x220ef4['Descriptions'],_0x15921a,'\x0a');if(_0x4f88f0[_0x701e('0x43')]==='Contacts'){_0x4ac437['Who_Id']={'name':!_[_0x701e('0x18')](_0x4f88f0[_0x701e('0x58')])?_0x4f88f0[_0x701e('0x58')]:!_[_0x701e('0x18')](_0x4f88f0[_0x701e('0x59')])?_0x4f88f0[_0x701e('0x59')]+'\x20'+_0x4f88f0[_0x701e('0x5a')]:_0x4f88f0['Last_Name'],'id':_0x4f88f0['id']};}if(_0x4f88f0['enduserType']==='Leads'){_0x4ac437[_0x701e('0x5b')]={'name':!_[_0x701e('0x18')](_0x4f88f0[_0x701e('0x58')])?_0x4f88f0[_0x701e('0x58')]:!_[_0x701e('0x18')](_0x4f88f0['First_Name'])?_0x4f88f0[_0x701e('0x59')]+'\x20'+_0x4f88f0[_0x701e('0x5a')]:_0x4f88f0[_0x701e('0x5a')],'id':_0x4f88f0['id']};_0x4ac437[_0x701e('0x5c')]=_[_0x701e('0x44')](_0x4f88f0[_0x701e('0x43')]);}if(_0x15921a[_0x701e('0x5d')]){_0x4ac437['Call_Duration']=moment[_0x701e('0x5e')](parseInt(_0x15921a[_0x701e('0x5d')])*0x3e8)[_0x701e('0x5f')](_0x701e('0x60'));}else if(_0x15921a[_0x701e('0x61')]&&_0x15921a['endtime']){_0x4ac437[_0x701e('0x62')]=moment[_0x701e('0x5e')](moment(_0x15921a[_0x701e('0x63')],_0x701e('0x64'))[_0x701e('0x65')](moment(_0x15921a[_0x701e('0x66')],_0x701e('0x64'))))['format'](_0x701e('0x60'));}switch(_0x15921a[_0x701e('0x67')]){case'called':_0x4ac437[_0x701e('0x68')]=_0x701e('0x69');break;case'complete':case _0x701e('0x6a'):_0x4ac437[_0x701e('0x68')]='Answered';break;case _0x701e('0x6b'):_0x4ac437[_0x701e('0x68')]=_0x701e('0x6c');break;case _0x701e('0x6d'):_0x4ac437[_0x701e('0x68')]=_0x701e('0x6e');break;case _0x701e('0x6f'):_0x4ac437[_0x701e('0x68')]=_0x701e('0x70');default:}_0x4ac437[_0x701e('0x71')]=(_0x194102===_0x701e('0x72')?moment(_0x15921a['starttime'])[_0x701e('0x5f')](_0x701e('0x64')):moment(_0x15921a['agentcalledAt'])[_0x701e('0x5f')](_0x701e('0x64')))||moment()['format'](_0x701e('0x64'));_0x4ac437[_0x701e('0x73')]=_0x194102||_0x701e('0x74');_0x4ac437=_[_0x701e('0x75')](_0x4ac437,getCustomFields(_0x220ef4[_0x701e('0x76')],_0x15921a));return request({'method':_0x701e('0x3b'),'uri':_0x701e('0x3c')+_0x24199f+_0x701e('0x77'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x47873b},'body':{'data':[_0x4ac437]},'json':!![]})[_0x701e('0x24')](function(_0x204897){if(_0x204897&&_0x204897[_0x701e('0x3a')][0x0][_0x701e('0x41')]==='SUCCESS'){logger[_0x701e('0x31')](_0x701e('0x78'));return{'id':_0x204897['data'][0x0][_0x701e('0x79')]['id']};}})['catch'](function(_0x30e65c){logger[_0x701e('0x31')](_0x701e('0x7a'),_0x30e65c[_0x701e('0x28')]);console['log']('err',_0x30e65c);});}exports[_0x701e('0x7b')]=function(_0x1293e4,_0xf3eee0,_0x44f627,_0x50f6b2,_0x7e1e75,_0x1fda92){var _0x49d19d,_0x39985e,_0x44f98c;_0x1fda92['host']=intUtil['stripTrailingSlash'](_0x1fda92[_0x701e('0x7c')]);_0x1fda92[_0x701e('0x7d')]=intUtil[_0x701e('0x7e')](_0x1fda92[_0x701e('0x7d')]);if(_0x7e1e75&&_0x7e1e75[_0x701e('0x7f')]){logger[_0x701e('0x31')](_0x701e('0x80'),'Recording\x20is\x20enabled!');_0xf3eee0[_0x701e('0x81')]=_0x1fda92[_0x701e('0x7d')]+_0x701e('0x82')+_0xf3eee0[_0x701e('0x83')]+_0x701e('0x84')+md5(_0xf3eee0['uniqueid']);}else{_0xf3eee0[_0x701e('0x81')]='';}var _0x19f42e=_0x1fda92['host']==='zoho.eu'?'eu':_0x701e('0x85');return getAccessToken(_0x1fda92)[_0x701e('0x24')](function(_0x5f503e){_0x44f98c=_0x5f503e;return getUser(_0x44f98c,_0x19f42e,_0x1fda92,_0x50f6b2[_0x701e('0x30')]);})[_0x701e('0x24')](function(_0x3a469a){_0x49d19d=_0x3a469a;logger[_0x701e('0x31')](_0x701e('0x86'),_0x49d19d['id']);return getEndUser(_0x44f98c,_0x19f42e,_0x1fda92,_0xf3eee0[_0x701e('0x87')],_0xf3eee0[_0x701e('0x88')],_0x49d19d,_0x44f627);})[_0x701e('0x24')](function(_0x353d19){_0x39985e=_0x353d19;return getCall(_0x44f98c,_0x19f42e,_0x1fda92,_0x49d19d,_0x39985e,_0x44f627,_0xf3eee0,_0x701e('0x74'));})[_0x701e('0x24')](function(_0x9b1ea0){if(_0x9b1ea0){logger[_0x701e('0x31')](_0x701e('0x89'),_0x9b1ea0['id']);logger[_0x701e('0x31')]('[QUEUE]',_0x701e('0x8a'));emit(util[_0x701e('0x5f')](_0x701e('0x8b'),_0x50f6b2['name']),'trigger:browser:url',{'uri':_0x701e('0x8c')+_0x1fda92[_0x701e('0x7c')]+_0x701e('0x8d')+_0x9b1ea0['id']});}})[_0x701e('0x26')](function(_0x128240){logger['error'](_0x701e('0x80'),JSON[_0x701e('0x38')](_0x128240));});};exports[_0x701e('0x72')]=function(_0x28561f,_0x282063,_0x3858bc,_0x34c264,_0x33ec01,_0x3832ba,_0x3a8907){var _0x201332,_0x5dafee,_0x52b024;_0x3832ba['host']=intUtil[_0x701e('0x7e')](_0x3832ba['host']);_0x3832ba[_0x701e('0x7d')]=intUtil[_0x701e('0x7e')](_0x3832ba['serverUrl']);if(_0x3a8907&&_0x3a8907['recordingFormat']&&_0x3a8907[_0x701e('0x8e')]!==_0x701e('0x8f')){logger[_0x701e('0x31')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x282063[_0x701e('0x81')]=_0x3832ba[_0x701e('0x7d')]+_0x701e('0x82')+_0x282063[_0x701e('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x282063['uniqueid']);}var _0x575b1d=_0x3832ba[_0x701e('0x7c')]===_0x701e('0x90')?'eu':_0x701e('0x85');return getAccessToken(_0x3832ba)[_0x701e('0x24')](function(_0x478ef4){_0x52b024=_0x478ef4;return getUser(_0x52b024,_0x575b1d,_0x3832ba,_0x34c264[_0x701e('0x30')]);})['then'](function(_0x528d04){_0x201332=_0x528d04;logger[_0x701e('0x31')]('The\x20User\x20ID\x20is:',_0x201332['id']);return getEndUser(_0x52b024,_0x575b1d,_0x3832ba,_0x282063[_0x701e('0x91')],_0x282063['destcalleridnum'],_0x201332,_0x3858bc);})[_0x701e('0x24')](function(_0x150898){_0x5dafee=_0x150898;return getCall(_0x52b024,_0x575b1d,_0x3832ba,_0x201332,_0x5dafee,_0x3858bc,_0x282063,'Outbound');})[_0x701e('0x24')](function(_0x124e55){if(_0x124e55){logger[_0x701e('0x31')]('The\x20Call\x20ID\x20is:',_0x124e55['id']);logger['info'](_0x701e('0x92'),_0x701e('0x8a'));emit(util['format']('user:%s',_0x34c264['name']),_0x701e('0x93'),{'uri':_0x701e('0x8c')+_0x3832ba[_0x701e('0x7c')]+_0x701e('0x8d')+_0x124e55['id']});}})[_0x701e('0x26')](function(_0x144e2d){logger[_0x701e('0x27')](_0x701e('0x92'),JSON['stringify'](_0x144e2d));});};exports[_0x701e('0x94')]=function(_0x3268ae,_0x3ebce3,_0x27a2e3,_0x4278a1,_0x109d50,_0x446400){var _0x364fc2,_0x2ee337,_0x1ea4b6;_0x446400['host']=intUtil[_0x701e('0x7e')](_0x446400[_0x701e('0x7c')]);_0x446400[_0x701e('0x7d')]=intUtil[_0x701e('0x7e')](_0x446400[_0x701e('0x7d')]);if(_0x109d50&&_0x109d50['monitor_format']){logger[_0x701e('0x31')]('['+_0x3ebce3[_0x701e('0x67')][_0x701e('0x95')]()+']',_0x701e('0x96'));_0x3ebce3[_0x701e('0x81')]=_0x446400[_0x701e('0x7d')]+'/api/voice/recordings/'+_0x3ebce3[_0x701e('0x83')]+_0x701e('0x84')+md5(_0x3ebce3[_0x701e('0x83')]);}else{_0x3ebce3['recordingURL']='';}var _0x3f9ae8=_0x446400[_0x701e('0x7c')]===_0x701e('0x90')?'eu':_0x701e('0x85');return getAccessToken(_0x446400)[_0x701e('0x24')](function(_0x285abb){_0x1ea4b6=_0x285abb;return getUser(_0x1ea4b6,_0x3f9ae8,_0x446400);})[_0x701e('0x24')](function(_0x59bc5a){_0x364fc2=_0x59bc5a;logger[_0x701e('0x31')](_0x701e('0x86'),_0x364fc2['id']);return getEndUser(_0x1ea4b6,_0x3f9ae8,_0x446400,_0x3ebce3['calleridname'],_0x3ebce3[_0x701e('0x88')],_0x364fc2,_0x27a2e3);})['then'](function(_0x32e648){_0x2ee337=_0x32e648;return getCall(_0x1ea4b6,_0x3f9ae8,_0x446400,_0x364fc2,_0x2ee337,_0x27a2e3,_0x3ebce3,'Inbound');})[_0x701e('0x24')](function(_0x44e23a){if(_0x44e23a){logger[_0x701e('0x31')](_0x701e('0x89'),_0x44e23a['id']);}})[_0x701e('0x26')](function(_0x5c27a5){logger[_0x701e('0x27')]('['+_0x3ebce3['lastevent'][_0x701e('0x95')]()+']',JSON[_0x701e('0x38')](_0x5c27a5));});}; \ No newline at end of file +var _0x672d=['enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','SUCCESS','details','moduleCreate','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','uri','lead','Creating\x20new\x20call...','Owner','Subject','Description','getString','Descriptions','Contacts','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','Call_Result','Called','complete','connect','rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','POST','/crm/v2/Calls','Call\x20created!','err','log','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','zoho.eu','email','destcalleridname','destcalleridnum','Outbound','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','lodash','request-promise','md5','util','./util','ioredis','bluebird','../../../../config/logger','redis','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','includes','string','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','isBefore','access_token','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','catch','data'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x672d,0x191));var _0xd672=function(_0x5e1fe9,_0x33eb86){_0x5e1fe9=_0x5e1fe9-0x0;var _0x1c5461=_0x672d[_0x5e1fe9];return _0x1c5461;};'use strict';var _=require(_0xd672('0x0'));var rp=require(_0xd672('0x1'));var md5=require(_0xd672('0x2'));var util=require(_0xd672('0x3'));var intUtil=require(_0xd672('0x4'));var moment=require('moment');var Redis=require(_0xd672('0x5'));var BPromise=require(_0xd672('0x6'));var config=require('../../../../config/environment');var logger=require(_0xd672('0x7'))('zoho');config[_0xd672('0x8')]=_['defaults'](config[_0xd672('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xd672('0x9'))(new Redis(config['redis']));function emit(_0x50545d,_0x2f92fc,_0x323b52){io['to'](_0x50545d)[_0xd672('0xa')](_0x2f92fc,_0x323b52);}function request(_0x5845bf){logger['debug'](_0xd672('0xb'),JSON[_0xd672('0xc')](_0x5845bf));return rp(_0x5845bf);}function getCustomFields(_0x164020,_0x160a6a){var _0x26de94={};if(_0x164020[_0xd672('0xd')]>0x0){_[_0xd672('0xe')](_0x164020,function(_0x56c393){if(_[_0xd672('0xf')]([_0xd672('0x10'),'picklist'],_0x56c393[_0xd672('0x11')])&&_0x56c393[_0xd672('0x12')]){_0x26de94[_0x56c393[_0xd672('0x12')]]=_0x56c393[_0xd672('0x13')][_0xd672('0x14')]();}else if(_0x56c393['type']===_0xd672('0x15')&&_0x56c393['variableName']&&_0x56c393['idField']&&_0x160a6a[_0x56c393[_0xd672('0x16')]]){_0x26de94[_0x56c393[_0xd672('0x12')]]=_0x160a6a[_0x56c393[_0xd672('0x16')]][_0xd672('0x14')]();}else if(_0x56c393['type']===_0xd672('0x17')&&_0x56c393['Variable']&&_0x56c393[_0xd672('0x18')][_0xd672('0x19')]&&_0x56c393[_0xd672('0x12')]&&_0x160a6a[_0x56c393[_0xd672('0x18')][_0xd672('0x19')][_0xd672('0x1a')]()]){_0x26de94[_0x56c393[_0xd672('0x12')]]=_0x160a6a[_0x56c393['Variable'][_0xd672('0x19')][_0xd672('0x1a')]()][_0xd672('0x14')]();}});}return _0x26de94;}function getName(_0x167613){if(_0x167613['indexOf']('\x20')>0x0){var _0x2bd57f=_0x167613[_0xd672('0x1b')](/ (.+)/);if(_0x2bd57f[0x1]){return _0x2bd57f;}}return[_0x167613,_0x167613];}var accountsTokens={};function getAccessToken(_0xfeab9b){return new Promise(function(_0xf938d3,_0x54cbfd){if(!_['isNil'](accountsTokens[_0xfeab9b['id']])&&!_[_0xd672('0x1c')](accountsTokens[_0xfeab9b['id']]['access_token'])){if(moment()[_0xd672('0x1d')](accountsTokens[_0xfeab9b['id']]['expires_in'])){_0xf938d3(accountsTokens[_0xfeab9b['id']][_0xd672('0x1e')]);}}var _0x21b697;switch(_0xfeab9b[_0xd672('0x1f')]){case'US':_0x21b697='https://accounts.zoho.com';break;case'AU':_0x21b697=_0xd672('0x20');break;case'EU':_0x21b697='https://accounts.zoho.eu';break;case'IN':_0x21b697=_0xd672('0x21');break;case'CN':_0x21b697=_0xd672('0x22');break;default:_0x21b697=_0xd672('0x23');break;}var _0x5cd2eb={'method':'POST','uri':_0x21b697+_0xd672('0x24'),'qs':{'refresh_token':_0xfeab9b[_0xd672('0x25')],'client_id':_0xfeab9b[_0xd672('0x26')],'client_secret':_0xfeab9b[_0xd672('0x27')],'grant_type':_0xd672('0x28')},'json':!![]};return rp(_0x5cd2eb)[_0xd672('0x29')](function(_0x119909){accountsTokens[_0xfeab9b['id']]={'access_token':_0x119909[_0xd672('0x1e')],'expires_in':moment()[_0xd672('0x2a')](_0x119909['expires_in'],_0xd672('0x2b'))};_0xf938d3(_0x119909[_0xd672('0x1e')]);})['catch'](function(_0x95f48c){logger[_0xd672('0x2c')](_0xd672('0x2d'),_0x95f48c[_0xd672('0x2e')]);_0x54cbfd(_0x95f48c);});});}function getUser(_0x3b02d7,_0x261284,_0x452f70,_0x386f05){logger[_0xd672('0x2f')]('Search\x20user');return request({'method':_0xd672('0x30'),'uri':util[_0xd672('0x31')](_0xd672('0x32'),_0x261284),'qs':{'type':_0xd672('0x33')},'headers':{'Authorization':_0xd672('0x34')+_0x3b02d7},'json':!![]})[_0xd672('0x29')](function(_0x19bc3a){if(_0x19bc3a[_0xd672('0x35')]){var _0x2f78a9=-0x1;if(_[_0xd672('0x36')](_0x19bc3a['users'])){if(!_[_0xd672('0x1c')](_0x386f05)){_0x2f78a9=_[_0xd672('0x37')](_0x19bc3a[_0xd672('0x35')],function(_0x12feb2){return _0x12feb2['email']===_0x386f05;});}if(_0x2f78a9>=0x0){logger[_0xd672('0x2f')](_0xd672('0x38'));}else{logger[_0xd672('0x2f')](_0xd672('0x39'));_0x2f78a9=_[_0xd672('0x37')](_0x19bc3a['users'],function(_0x1804a4){return _0x1804a4[_0xd672('0x3a')][_0xd672('0x19')]===_0xd672('0x3b');});}return _0x19bc3a['users'][_0x2f78a9];}else{if(_0x19bc3a[_0xd672('0x3c')][_0xd672('0x3a')][_0xd672('0x19')]==='Administrator'){logger[_0xd672('0x2f')](_0xd672('0x39'));user=_0x19bc3a['user'];return user;}else{logger[_0xd672('0x2c')](_0xd672('0x3d'),JSON['stringify'](_0x19bc3a));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x19bc3a));}}}else{logger[_0xd672('0x2c')]('The\x20failing\x20result\x20is',JSON[_0xd672('0xc')](_0x19bc3a));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xd672('0xc')](_0x19bc3a));}})[_0xd672('0x3e')](function(_0x329296){console['error'](_0x329296);});}function getZohoUser(_0xf20d0b,_0x25a8d8){return new BPromise(function(_0x2e9c79,_0x48a90b){request(_0xf20d0b)['then'](function(_0x212c64){var _0x34a1e0=null;if(_0x212c64){_0x34a1e0=_0x212c64[_0xd672('0x3f')][0x0];_0x34a1e0[_0xd672('0x40')]=_0x25a8d8;}_0x2e9c79(_0x34a1e0);})[_0xd672('0x3e')](function(_0x28997b){_0x48a90b(_0x28997b);});});}function createEndUser(_0x27a542,_0x5e94fb,_0x1c23a6,_0x2144ec,_0x427f21,_0x3bd482){var _0x1c23a6=getName(_0x1c23a6);return request({'method':'POST','uri':_0xd672('0x41')+_0x5e94fb+_0xd672('0x42')+_[_0xd672('0x43')](_0x3bd482['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x1c23a6[0x1],'First_Name':_0x1c23a6[0x0],'Phone':_0x2144ec,'Owner':{'name':!_['isNil'](_0x427f21['role'][_0xd672('0x19')])?_0x427f21[_0xd672('0x44')][_0xd672('0x19')]:!_[_0xd672('0x1c')](_0x427f21[_0xd672('0x45')])?_0x427f21[_0xd672('0x45')]+'\x20'+_0x427f21[_0xd672('0x46')]:_0x427f21['last_name'],'id':_0x427f21['id']}}]},'headers':{'Authorization':_0xd672('0x34')+_0x27a542},'json':!![]})[_0xd672('0x29')](function(_0x39251f){if(_0x39251f&&_0x39251f[_0xd672('0x3f')][0x0][_0xd672('0x47')]===_0xd672('0x48')){var _0xb7185=_0x39251f['data'][0x0][_0xd672('0x49')];_0xb7185[_0xd672('0x40')]=_[_0xd672('0x43')](_0x3bd482[_0xd672('0x4a')])+'s';return _0xb7185;}logger[_0xd672('0x2c')](_0xd672('0x3d'),JSON[_0xd672('0xc')](data));throw new Error('Error:\x20'+JSON[_0xd672('0xc')](data));})[_0xd672('0x3e')](function(_0x5d2ac3){console['log']('CREATE\x20ERROR',_0x5d2ac3);});}function getEndUser(_0x956bf0,_0x1a4793,_0x25b0b3,_0x4edc34,_0x10bf26,_0x3ee964,_0x2ce1a6){var _0x1793f3={'method':_0xd672('0x30'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x956bf0},'json':!![]};switch(_0x2ce1a6[_0xd672('0x4b')]){case _0xd672('0x4c'):_0x1793f3['uri']=_0xd672('0x41')+_0x1a4793+_0xd672('0x4d')+_0x10bf26+'))';return getZohoUser(_0x1793f3,'Contacts')[_0xd672('0x29')](function(_0x36499b){if(_0x36499b)return _0x36499b;_0x1793f3['uri']='https://www.zohoapis.'+_0x1a4793+_0xd672('0x4e')+_0x10bf26+'))';return getZohoUser(_0x1793f3,_0xd672('0x4f'))[_0xd672('0x29')](function(_0x22a90c){if(_0x22a90c)return _0x22a90c;if(_0x2ce1a6[_0xd672('0x4a')]!=_0xd672('0x50')){return createEndUser(_0x956bf0,_0x1a4793,_0x4edc34,_0x10bf26,_0x3ee964,_0x2ce1a6);}else{return{};}});});break;case _0xd672('0x51'):_0x1793f3[_0xd672('0x52')]='https://www.zohoapis.'+_0x1a4793+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x10bf26+'))';return getZohoUser(_0x1793f3,'Contacts')[_0xd672('0x29')](function(_0x3e2b93){if(_0x3e2b93)return _0x3e2b93;if(_0x2ce1a6[_0xd672('0x4a')]!='nothing'){return createEndUser(_0x956bf0,_0x1a4793,_0x4edc34,_0x10bf26,_0x3ee964,_0x2ce1a6);}else{return{};}});break;case _0xd672('0x53'):_0x1793f3[_0xd672('0x52')]=_0xd672('0x41')+_0x1a4793+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x10bf26+'))';return getZohoUser(_0x1793f3,_0xd672('0x4f'))[_0xd672('0x29')](function(_0x1e401e){if(_0x1e401e)return _0x1e401e;if(_0x2ce1a6[_0xd672('0x4a')]!=_0xd672('0x50')){return createEndUser(_0x956bf0,_0x1a4793,_0x4edc34,_0x10bf26,_0x3ee964,_0x2ce1a6);}else{return{};}});break;}}function getCall(_0x5bf36c,_0x3a63b1,_0x4a7d2b,_0x154a24,_0x124436,_0x31dfb4,_0x344fae,_0x5aeaf1){logger['info'](_0xd672('0x54'));var _0x4c6370={};_0x4c6370[_0xd672('0x55')]={'name':!_['isNil'](_0x154a24[_0xd672('0x44')][_0xd672('0x19')])&&!_['isNil'](_0x154a24[_0xd672('0x3a')][_0xd672('0x19')])&&_0x154a24['profile']['name']==='administrator'?_0x154a24[_0xd672('0x44')][_0xd672('0x19')]:!_[_0xd672('0x1c')](_0x154a24[_0xd672('0x45')])?_0x154a24[_0xd672('0x45')]+'\x20'+_0x154a24[_0xd672('0x46')]:_0x154a24[_0xd672('0x46')],'id':_0x154a24['id']};_0x4c6370[_0xd672('0x56')]=intUtil['getString'](_0x31dfb4['Subjects'],_0x344fae,'\x20');_0x4c6370[_0xd672('0x57')]=intUtil[_0xd672('0x58')](_0x31dfb4[_0xd672('0x59')],_0x344fae,'\x0a');if(_0x124436['enduserType']===_0xd672('0x5a')){_0x4c6370[_0xd672('0x5b')]={'name':!_['isNil'](_0x124436['Full_Name'])?_0x124436[_0xd672('0x5c')]:!_['isNil'](_0x124436[_0xd672('0x5d')])?_0x124436[_0xd672('0x5d')]+'\x20'+_0x124436[_0xd672('0x5e')]:_0x124436['Last_Name'],'id':_0x124436['id']};}if(_0x124436['enduserType']==='Leads'){_0x4c6370['What_Id']={'name':!_[_0xd672('0x1c')](_0x124436[_0xd672('0x5c')])?_0x124436[_0xd672('0x5c')]:!_[_0xd672('0x1c')](_0x124436['First_Name'])?_0x124436['First_Name']+'\x20'+_0x124436[_0xd672('0x5e')]:_0x124436[_0xd672('0x5e')],'id':_0x124436['id']};_0x4c6370[_0xd672('0x5f')]=_[_0xd672('0x43')](_0x124436[_0xd672('0x40')]);}if(_0x344fae[_0xd672('0x60')]){_0x4c6370[_0xd672('0x61')]=moment[_0xd672('0x62')](parseInt(_0x344fae[_0xd672('0x60')])*0x3e8)[_0xd672('0x31')](_0xd672('0x63'));}else if(_0x344fae['answertime']&&_0x344fae['endtime']){_0x4c6370[_0xd672('0x61')]=moment[_0xd672('0x62')](moment(_0x344fae[_0xd672('0x64')],_0xd672('0x65'))[_0xd672('0x66')](moment(_0x344fae[_0xd672('0x67')],'YYYY-MM-DDTHH:mm:ss')))[_0xd672('0x31')]('mm:ss');}switch(_0x344fae['lastevent']){case _0xd672('0x68'):_0x4c6370[_0xd672('0x69')]=_0xd672('0x6a');break;case _0xd672('0x6b'):case _0xd672('0x6c'):_0x4c6370[_0xd672('0x69')]='Answered';break;case _0xd672('0x6d'):_0x4c6370[_0xd672('0x69')]='Rejected';break;case _0xd672('0x6e'):_0x4c6370[_0xd672('0x69')]=_0xd672('0x6f');break;case _0xd672('0x70'):_0x4c6370[_0xd672('0x69')]=_0xd672('0x71');default:}_0x4c6370[_0xd672('0x72')]=(_0x5aeaf1===_0xd672('0x73')?moment(_0x344fae[_0xd672('0x67')])[_0xd672('0x31')](_0xd672('0x65')):moment(_0x344fae[_0xd672('0x74')])[_0xd672('0x31')](_0xd672('0x65')))||moment()['format'](_0xd672('0x65'));_0x4c6370[_0xd672('0x75')]=_0x5aeaf1||_0xd672('0x76');_0x4c6370=_['merge'](_0x4c6370,getCustomFields(_0x31dfb4['Fields'],_0x344fae));return request({'method':_0xd672('0x77'),'uri':'https://www.zohoapis.'+_0x3a63b1+_0xd672('0x78'),'headers':{'Authorization':_0xd672('0x34')+_0x5bf36c},'body':{'data':[_0x4c6370]},'json':!![]})[_0xd672('0x29')](function(_0x16057d){if(_0x16057d&&_0x16057d[_0xd672('0x3f')][0x0][_0xd672('0x47')]===_0xd672('0x48')){logger['info'](_0xd672('0x79'));return{'id':_0x16057d['data'][0x0][_0xd672('0x49')]['id']};}})[_0xd672('0x3e')](function(_0x55ed8c){logger[_0xd672('0x2f')](_0xd672('0x7a'),_0x55ed8c[_0xd672('0x2e')]);console[_0xd672('0x7b')](_0xd672('0x7a'),_0x55ed8c);});}exports['queue']=function(_0x16ebec,_0x32fdb3,_0x58611c,_0x350121,_0x3afba7,_0x214be4){var _0x2e6516,_0x104788,_0x347cc5;_0x214be4[_0xd672('0x7c')]=intUtil[_0xd672('0x7d')](_0x214be4[_0xd672('0x7c')]);_0x214be4[_0xd672('0x7e')]=intUtil[_0xd672('0x7d')](_0x214be4[_0xd672('0x7e')]);if(_0x3afba7&&_0x3afba7[_0xd672('0x7f')]){logger[_0xd672('0x2f')](_0xd672('0x80'),_0xd672('0x81'));_0x32fdb3[_0xd672('0x82')]=_0x214be4[_0xd672('0x7e')]+_0xd672('0x83')+_0x32fdb3[_0xd672('0x84')]+_0xd672('0x85')+md5(_0x32fdb3[_0xd672('0x84')]);}else{_0x32fdb3['recordingURL']='';}var _0xd3c225=_0x214be4[_0xd672('0x7c')]==='zoho.eu'?'eu':_0xd672('0x86');return getAccessToken(_0x214be4)['then'](function(_0x30296f){_0x347cc5=_0x30296f;return getUser(_0x347cc5,_0xd3c225,_0x214be4,_0x350121['email']);})[_0xd672('0x29')](function(_0x50af2a){_0x2e6516=_0x50af2a;logger[_0xd672('0x2f')]('The\x20User\x20ID\x20is:',_0x2e6516['id']);return getEndUser(_0x347cc5,_0xd3c225,_0x214be4,_0x32fdb3[_0xd672('0x87')],_0x32fdb3[_0xd672('0x88')],_0x2e6516,_0x58611c);})[_0xd672('0x29')](function(_0x176d3e){_0x104788=_0x176d3e;return getCall(_0x347cc5,_0xd3c225,_0x214be4,_0x2e6516,_0x104788,_0x58611c,_0x32fdb3,_0xd672('0x76'));})[_0xd672('0x29')](function(_0x1d2ba1){if(_0x1d2ba1){logger[_0xd672('0x2f')](_0xd672('0x89'),_0x1d2ba1['id']);logger[_0xd672('0x2f')](_0xd672('0x80'),_0xd672('0x8a'));emit(util[_0xd672('0x31')](_0xd672('0x8b'),_0x350121[_0xd672('0x19')]),_0xd672('0x8c'),{'uri':_0xd672('0x8d')+_0x214be4['host']+_0xd672('0x8e')+_0x1d2ba1['id']});}})['catch'](function(_0x298039){logger[_0xd672('0x2c')]('[QUEUE]',JSON['stringify'](_0x298039));});};exports[_0xd672('0x73')]=function(_0x514a46,_0xc467d9,_0xdda9e7,_0x3c7e66,_0x2151ba,_0x2c8a30,_0x2716f8){var _0x15a69e,_0xe89fb9,_0x2a0df3;_0x2c8a30[_0xd672('0x7c')]=intUtil['stripTrailingSlash'](_0x2c8a30[_0xd672('0x7c')]);_0x2c8a30[_0xd672('0x7e')]=intUtil[_0xd672('0x7d')](_0x2c8a30[_0xd672('0x7e')]);if(_0x2716f8&&_0x2716f8[_0xd672('0x8f')]&&_0x2716f8[_0xd672('0x8f')]!==_0xd672('0x90')){logger[_0xd672('0x2f')](_0xd672('0x91'),_0xd672('0x81'));_0xc467d9[_0xd672('0x82')]=_0x2c8a30['serverUrl']+_0xd672('0x83')+_0xc467d9[_0xd672('0x84')]+_0xd672('0x85')+md5(_0xc467d9[_0xd672('0x84')]);}var _0x2d6469=_0x2c8a30[_0xd672('0x7c')]===_0xd672('0x92')?'eu':_0xd672('0x86');return getAccessToken(_0x2c8a30)[_0xd672('0x29')](function(_0x26e5d7){_0x2a0df3=_0x26e5d7;return getUser(_0x2a0df3,_0x2d6469,_0x2c8a30,_0x3c7e66[_0xd672('0x93')]);})['then'](function(_0x1af26d){_0x15a69e=_0x1af26d;logger[_0xd672('0x2f')]('The\x20User\x20ID\x20is:',_0x15a69e['id']);return getEndUser(_0x2a0df3,_0x2d6469,_0x2c8a30,_0xc467d9[_0xd672('0x94')],_0xc467d9[_0xd672('0x95')],_0x15a69e,_0xdda9e7);})['then'](function(_0x3e5b9d){_0xe89fb9=_0x3e5b9d;return getCall(_0x2a0df3,_0x2d6469,_0x2c8a30,_0x15a69e,_0xe89fb9,_0xdda9e7,_0xc467d9,_0xd672('0x96'));})[_0xd672('0x29')](function(_0x2a8d6a){if(_0x2a8d6a){logger['info'](_0xd672('0x89'),_0x2a8d6a['id']);logger[_0xd672('0x2f')](_0xd672('0x91'),_0xd672('0x8a'));emit(util[_0xd672('0x31')](_0xd672('0x8b'),_0x3c7e66['name']),_0xd672('0x8c'),{'uri':_0xd672('0x8d')+_0x2c8a30[_0xd672('0x7c')]+_0xd672('0x8e')+_0x2a8d6a['id']});}})[_0xd672('0x3e')](function(_0x4bff7f){logger[_0xd672('0x2c')](_0xd672('0x91'),JSON[_0xd672('0xc')](_0x4bff7f));});};exports[_0xd672('0x97')]=function(_0x105b4e,_0x429531,_0x104e79,_0x47c580,_0x46121d,_0x271699){var _0x423aea,_0x1b79ee,_0x12a068;_0x271699['host']=intUtil['stripTrailingSlash'](_0x271699[_0xd672('0x7c')]);_0x271699[_0xd672('0x7e')]=intUtil[_0xd672('0x7d')](_0x271699[_0xd672('0x7e')]);if(_0x46121d&&_0x46121d[_0xd672('0x7f')]){logger[_0xd672('0x2f')]('['+_0x429531[_0xd672('0x98')][_0xd672('0x99')]()+']',_0xd672('0x81'));_0x429531['recordingURL']=_0x271699[_0xd672('0x7e')]+_0xd672('0x83')+_0x429531['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x429531[_0xd672('0x84')]);}else{_0x429531[_0xd672('0x82')]='';}var _0x15caf1=_0x271699[_0xd672('0x7c')]===_0xd672('0x92')?'eu':_0xd672('0x86');return getAccessToken(_0x271699)[_0xd672('0x29')](function(_0xeec9d6){_0x12a068=_0xeec9d6;return getUser(_0x12a068,_0x15caf1,_0x271699);})[_0xd672('0x29')](function(_0x68ae31){_0x423aea=_0x68ae31;logger[_0xd672('0x2f')](_0xd672('0x9a'),_0x423aea['id']);return getEndUser(_0x12a068,_0x15caf1,_0x271699,_0x429531[_0xd672('0x87')],_0x429531['calleridnum'],_0x423aea,_0x104e79);})[_0xd672('0x29')](function(_0x3d5038){_0x1b79ee=_0x3d5038;return getCall(_0x12a068,_0x15caf1,_0x271699,_0x423aea,_0x1b79ee,_0x104e79,_0x429531,_0xd672('0x76'));})[_0xd672('0x29')](function(_0x5afaab){if(_0x5afaab){logger['info']('The\x20Call\x20ID\x20is:',_0x5afaab['id']);}})[_0xd672('0x3e')](function(_0x274ae7){logger['error']('['+_0x429531[_0xd672('0x98')]['toUpperCase']()+']',JSON[_0xd672('0xc')](_0x274ae7));});}; \ 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 e66cdad..595db03 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 _0x853a=['Script','data3','render','exec','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','data2'];(function(_0x1d7bc8,_0x572f88){var _0x8e7a9f=function(_0x51b094){while(--_0x51b094){_0x1d7bc8['push'](_0x1d7bc8['shift']());}};_0x8e7a9f(++_0x572f88);}(_0x853a,0x1cf));var _0xa853=function(_0x2a71d2,_0x35bcda){_0x2a71d2=_0x2a71d2-0x0;var _0x200112=_0x853a[_0x2a71d2];return _0x200112;};'use strict';var util=require(_0xa853('0x0'));var sh=require(_0xa853('0x1'));var Mustache=require(_0xa853('0x2'));var logger=require(_0xa853('0x3'))('trigger');exports['exec']=function(_0x5425e3,_0x3c7a29){var _0x56eeae=_0x5425e3['data2']?_0x5425e3[_0xa853('0x4')]:_0xa853('0x5');var _0x1aefe0=_0x5425e3[_0xa853('0x6')]?Mustache[_0xa853('0x7')](_0x5425e3[_0xa853('0x6')],_0x3c7a29):_0x3c7a29;sh[_0xa853('0x8')](_0x1aefe0,function(_0x594d8d,_0x38e845,_0x2c9502){if(_0x594d8d!==0x0){logger[_0xa853('0x9')](util[_0xa853('0xa')](_0xa853('0xb'),_0x56eeae,_0x1aefe0,_0x594d8d,_0x2c9502));}else{logger['info'](util[_0xa853('0xa')](_0xa853('0xc'),_0x56eeae,_0x1aefe0,_0x38e845));}});}; \ No newline at end of file +var _0xd742=['data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','exec','data2','Script','render'];(function(_0x1c5f93,_0x35de09){var _0x464e11=function(_0x425844){while(--_0x425844){_0x1c5f93['push'](_0x1c5f93['shift']());}};_0x464e11(++_0x35de09);}(_0xd742,0xa1));var _0x2d74=function(_0x2790e4,_0x115b27){_0x2790e4=_0x2790e4-0x0;var _0x3d001d=_0xd742[_0x2790e4];return _0x3d001d;};'use strict';var util=require(_0x2d74('0x0'));var sh=require(_0x2d74('0x1'));var Mustache=require(_0x2d74('0x2'));var logger=require(_0x2d74('0x3'))('trigger');exports[_0x2d74('0x4')]=function(_0x16bdd0,_0x27bb55){var _0x5b5328=_0x16bdd0[_0x2d74('0x5')]?_0x16bdd0['data2']:_0x2d74('0x6');var _0x252937=_0x16bdd0['data3']?Mustache[_0x2d74('0x7')](_0x16bdd0[_0x2d74('0x8')],_0x27bb55):_0x27bb55;sh[_0x2d74('0x4')](_0x252937,function(_0x47fd30,_0x575df1,_0x151104){if(_0x47fd30!==0x0){logger['error'](util['format'](_0x2d74('0x9'),_0x5b5328,_0x252937,_0x47fd30,_0x151104));}else{logger[_0x2d74('0xa')](util[_0x2d74('0xb')](_0x2d74('0xc'),_0x5b5328,_0x252937,_0x575df1));}});}; \ 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 2950eae..4736df1 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 _0xbe46=['isNil',',\x20request\x20body:\x20','object','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data2','statusCode','catch','name','request-promise','util','lodash','mustache','../../../../config/logger','exec','data1','toUpperCase','render','data5','number','headers','data6','parse','error','GET','PUT','data7','body','stack','info','stringify'];(function(_0x1b87a6,_0x4b11a0){var _0x3f2b76=function(_0xb685ec){while(--_0xb685ec){_0x1b87a6['push'](_0x1b87a6['shift']());}};_0x3f2b76(++_0x4b11a0);}(_0xbe46,0xa4));var _0x6be4=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xbe46[_0x187ee1];return _0x388160;};'use strict';var rp=require(_0x6be4('0x0'));var util=require(_0x6be4('0x1'));var _=require(_0x6be4('0x2'));var Mustache=require(_0x6be4('0x3'));var logger=require(_0x6be4('0x4'))('trigger');exports[_0x6be4('0x5')]=function(_0x7bdc42,_0x40abd3){var _0x1e20aa,_0x4b8005;var _0x405a17={'method':_0x7bdc42[_0x6be4('0x6')][_0x6be4('0x7')](),'uri':Mustache[_0x6be4('0x8')](_0x7bdc42['data2'],_0x40abd3),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x7bdc42[_0x6be4('0x9')])===_0x6be4('0xa')&&parseInt(_0x7bdc42[_0x6be4('0x9')])>=0x1&&parseInt(_0x7bdc42[_0x6be4('0x9')])<=0xa?parseInt(_0x7bdc42[_0x6be4('0x9')])*0x3e8:0x5*0x3e8};try{_0x405a17[_0x6be4('0xb')]=_0x7bdc42[_0x6be4('0xc')]?JSON[_0x6be4('0xd')](Mustache[_0x6be4('0x8')](_0x7bdc42[_0x6be4('0xc')],_0x40abd3)):{};}catch(_0x249280){logger[_0x6be4('0xe')](_0x249280['stack']);}switch(_0x7bdc42[_0x6be4('0x6')][_0x6be4('0x7')]()){case _0x6be4('0xf'):case'DELETE':_0x1e20aa=null;_0x405a17['qs']=_0x40abd3;break;case'POST':case _0x6be4('0x10'):if(_0x7bdc42[_0x6be4('0x11')]){try{_0x1e20aa=JSON[_0x6be4('0xd')](Mustache[_0x6be4('0x8')](_0x7bdc42['data7'],_0x40abd3));_0x405a17[_0x6be4('0x12')]=_0x1e20aa;}catch(_0x48822b){logger[_0x6be4('0xe')](_0x48822b[_0x6be4('0x13')]);logger[_0x6be4('0xe')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x1e20aa=_0x40abd3;_0x405a17[_0x6be4('0x12')]=_0x1e20aa;}break;}logger[_0x6be4('0x14')](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x7bdc42[_0x6be4('0x6')],_0x7bdc42['data2'],JSON[_0x6be4('0x15')](_0x405a17)));rp(_0x405a17)['then'](function(_0x3a7717){_0x1e20aa=!_[_0x6be4('0x16')](_0x1e20aa)?_0x6be4('0x17')+_0x1e20aa:'';_0x4b8005=typeof _0x3a7717[_0x6be4('0x12')]===_0x6be4('0x18')?JSON[_0x6be4('0x15')](_0x3a7717['body']):_0x3a7717[_0x6be4('0x12')];logger[_0x6be4('0x14')](util[_0x6be4('0x19')](_0x6be4('0x1a'),_0x7bdc42['data1'],_0x7bdc42[_0x6be4('0x1b')],_0x3a7717[_0x6be4('0x1c')],_0x4b8005));})[_0x6be4('0x1d')](function(_0x35e690){logger[_0x6be4('0xe')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x7bdc42[_0x6be4('0x6')],_0x7bdc42[_0x6be4('0x1b')],_0x35e690[_0x6be4('0x1c')],_0x35e690[_0x6be4('0x1e')],_0x35e690['message']));});}; \ No newline at end of file +var _0xa07d=['object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','message','request-promise','util','lodash','mustache','../../../../config/logger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','error','stack','GET','DELETE','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','stringify','then','isNil'];(function(_0x9da788,_0x783e33){var _0x3dbaee=function(_0x535920){while(--_0x535920){_0x9da788['push'](_0x9da788['shift']());}};_0x3dbaee(++_0x783e33);}(_0xa07d,0x138));var _0xda07=function(_0x44210e,_0x1c76d6){_0x44210e=_0x44210e-0x0;var _0x2c6399=_0xa07d[_0x44210e];return _0x2c6399;};'use strict';var rp=require(_0xda07('0x0'));var util=require(_0xda07('0x1'));var _=require(_0xda07('0x2'));var Mustache=require(_0xda07('0x3'));var logger=require(_0xda07('0x4'))('trigger');exports[_0xda07('0x5')]=function(_0x2af6c0,_0x5b940d){var _0x32ffb7,_0x459f5d;var _0x569fe1={'method':_0x2af6c0[_0xda07('0x6')][_0xda07('0x7')](),'uri':Mustache[_0xda07('0x8')](_0x2af6c0[_0xda07('0x9')],_0x5b940d),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2af6c0['data5'])===_0xda07('0xa')&&parseInt(_0x2af6c0['data5'])>=0x1&&parseInt(_0x2af6c0[_0xda07('0xb')])<=0xa?parseInt(_0x2af6c0[_0xda07('0xb')])*0x3e8:0x5*0x3e8};try{_0x569fe1[_0xda07('0xc')]=_0x2af6c0[_0xda07('0xd')]?JSON[_0xda07('0xe')](Mustache[_0xda07('0x8')](_0x2af6c0[_0xda07('0xd')],_0x5b940d)):{};}catch(_0x1486a6){logger[_0xda07('0xf')](_0x1486a6[_0xda07('0x10')]);}switch(_0x2af6c0[_0xda07('0x6')][_0xda07('0x7')]()){case _0xda07('0x11'):case _0xda07('0x12'):_0x32ffb7=null;_0x569fe1['qs']=_0x5b940d;break;case'POST':case _0xda07('0x13'):if(_0x2af6c0[_0xda07('0x14')]){try{_0x32ffb7=JSON['parse'](Mustache['render'](_0x2af6c0[_0xda07('0x14')],_0x5b940d));_0x569fe1[_0xda07('0x15')]=_0x32ffb7;}catch(_0x408456){logger['error'](_0x408456[_0xda07('0x10')]);logger[_0xda07('0xf')](_0xda07('0x16'));}}else{_0x32ffb7=_0x5b940d;_0x569fe1[_0xda07('0x15')]=_0x32ffb7;}break;}logger[_0xda07('0x17')](util[_0xda07('0x18')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x2af6c0['data1'],_0x2af6c0['data2'],JSON[_0xda07('0x19')](_0x569fe1)));rp(_0x569fe1)[_0xda07('0x1a')](function(_0x33dd90){_0x32ffb7=!_[_0xda07('0x1b')](_0x32ffb7)?',\x20request\x20body:\x20'+_0x32ffb7:'';_0x459f5d=typeof _0x33dd90['body']===_0xda07('0x1c')?JSON[_0xda07('0x19')](_0x33dd90[_0xda07('0x15')]):_0x33dd90['body'];logger[_0xda07('0x17')](util['format'](_0xda07('0x1d'),_0x2af6c0[_0xda07('0x6')],_0x2af6c0[_0xda07('0x9')],_0x33dd90[_0xda07('0x1e')],_0x459f5d));})[_0xda07('0x1f')](function(_0x1e9973){logger[_0xda07('0xf')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x2af6c0[_0xda07('0x6')],_0x2af6c0[_0xda07('0x9')],_0x1e9973['statusCode'],_0x1e9973[_0xda07('0x20')],_0x1e9973[_0xda07('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 26aa61b..3e1e995 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 _0xa899=['exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','debug','rpc','error','message','catch'];(function(_0x324645,_0xdc9c60){var _0x518909=function(_0x48a9f9){while(--_0x48a9f9){_0x324645['push'](_0x324645['shift']());}};_0x518909(++_0xdc9c60);}(_0xa899,0x10f));var _0x9a89=function(_0x5a4400,_0xfae3b6){_0x5a4400=_0x5a4400-0x0;var _0xf9b532=_0xa899[_0x5a4400];return _0xf9b532;};'use strict';var jayson=require(_0x9a89('0x0'));var BPromise=require(_0x9a89('0x1'));var logger=require(_0x9a89('0x2'))(_0x9a89('0x3'));var client=jayson[_0x9a89('0x4')][_0x9a89('0x5')]({'port':0x2329});client[_0x9a89('0x6')]=function(_0x1d7570,_0x3a1b18){return new BPromise(function(_0xd8ec5e,_0x157c04){return client[_0x9a89('0x7')](_0x1d7570,_0x3a1b18)[_0x9a89('0x8')](function(_0x2947c4){logger[_0x9a89('0x9')](_0x9a89('0xa'),_0x9a89('0x3'),_0x1d7570,_0x3a1b18,_0x2947c4);if(_0x2947c4[_0x9a89('0xb')]){logger[_0x9a89('0xb')](_0x9a89('0xa'),'routing',_0x1d7570,_0x2947c4['error'][_0x9a89('0xc')],_0x3a1b18);return _0x157c04(_0x2947c4['error']['message']);}else{return _0xd8ec5e(_0x2947c4['result']);}})[_0x9a89('0xd')](function(_0x4c1822){logger[_0x9a89('0xb')]('rpc',_0x9a89('0x3'),_0x1d7570,_0x4c1822,_0x3a1b18);return _0x157c04(_0x4c1822);});});};module[_0x9a89('0xe')]=client; \ No newline at end of file +var _0x87e7=['error','message','jayson/promise','../../config/logger','routing','http','Request','request','then','debug','rpc'];(function(_0x364957,_0xd58db3){var _0x431ac6=function(_0x13a90a){while(--_0x13a90a){_0x364957['push'](_0x364957['shift']());}};_0x431ac6(++_0xd58db3);}(_0x87e7,0x1e6));var _0x787e=function(_0x45806b,_0x53eeae){_0x45806b=_0x45806b-0x0;var _0x3e228e=_0x87e7[_0x45806b];return _0x3e228e;};'use strict';var jayson=require(_0x787e('0x0'));var BPromise=require('bluebird');var logger=require(_0x787e('0x1'))(_0x787e('0x2'));var client=jayson['client'][_0x787e('0x3')]({'port':0x2329});client[_0x787e('0x4')]=function(_0x26f5a6,_0x57baaf){return new BPromise(function(_0x4e5e56,_0x5e049c){return client[_0x787e('0x5')](_0x26f5a6,_0x57baaf)[_0x787e('0x6')](function(_0x5a0240){logger[_0x787e('0x7')](_0x787e('0x8'),'routing',_0x26f5a6,_0x57baaf,_0x5a0240);if(_0x5a0240[_0x787e('0x9')]){logger[_0x787e('0x9')](_0x787e('0x8'),_0x787e('0x2'),_0x26f5a6,_0x5a0240[_0x787e('0x9')][_0x787e('0xa')],_0x57baaf);return _0x5e049c(_0x5a0240['error'][_0x787e('0xa')]);}else{return _0x4e5e56(_0x5a0240['result']);}})['catch'](function(_0x2fbbef){logger['error'](_0x787e('0x8'),_0x787e('0x2'),_0x26f5a6,_0x2fbbef,_0x57baaf);return _0x5e049c(_0x2fbbef);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index db2d1ee..e8723be 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 _0x0a8e=['./rpc/setting','email','resolve','then','getMailAccounts','initMailAccounts','mailAccounts','getSettings','catch','error','Email\x20service\x20initialization','./server','./rpc/mailAccount'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x0a8e,0x73));var _0xe0a8=function(_0x3a58b1,_0x84f437){_0x3a58b1=_0x3a58b1-0x0;var _0x24a95d=_0x0a8e[_0x3a58b1];return _0x24a95d;};'use strict';var server=require(_0xe0a8('0x0'));var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require(_0xe0a8('0x1'));var setting=require(_0xe0a8('0x2'));var logger=require('../../config/logger')(_0xe0a8('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xe0a8('0x4')]()[_0xe0a8('0x5')](mailAccount[_0xe0a8('0x6')]())[_0xe0a8('0x5')](realtime[_0xe0a8('0x7')]())['then'](function(){email['refresh'](realtime[_0xe0a8('0x8')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})[_0xe0a8('0x5')](function(){return setting[_0xe0a8('0x9')]();})[_0xe0a8('0x5')](function(_0x664236){return setInterval(initRealtime,_0x664236['loginMailFrequency']*0x3e8);})[_0xe0a8('0xa')](function(_0x414a76){logger[_0xe0a8('0xb')](_0xe0a8('0xc'),_0x414a76);});}main(); \ No newline at end of file +var _0xae28=['then','mailAccounts','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','../../config/logger','email'];(function(_0x421183,_0x2ea9ea){var _0x2d97cf=function(_0x285f29){while(--_0x285f29){_0x421183['push'](_0x421183['shift']());}};_0x2d97cf(++_0x2ea9ea);}(_0xae28,0x96));var _0x8ae2=function(_0x494444,_0x104f0a){_0x494444=_0x494444-0x0;var _0x291f1f=_0xae28[_0x494444];return _0x291f1f;};'use strict';var server=require(_0x8ae2('0x0'));var Realtime=require(_0x8ae2('0x1'));var EmailChannel=require(_0x8ae2('0x2'));var mailAccount=require(_0x8ae2('0x3'));var setting=require('./rpc/setting');var logger=require(_0x8ae2('0x4'))(_0x8ae2('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x8ae2('0x6')](mailAccount['getMailAccounts']())[_0x8ae2('0x6')](realtime['initMailAccounts']())[_0x8ae2('0x6')](function(){email['refresh'](realtime[_0x8ae2('0x7')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x8ae2('0x6')](function(){return initRealtime();})[_0x8ae2('0x6')](function(){return setting[_0x8ae2('0x8')]();})['then'](function(_0x28b4a7){return setInterval(initRealtime,_0x28b4a7[_0x8ae2('0x9')]*0x3e8);})[_0x8ae2('0xa')](function(_0x2f157a){logger[_0x8ae2('0xb')](_0x8ae2('0xc'),_0x2f157a);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index b0cf2c1..846893d 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 _0xe088=['connected','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','error','smtp','verifySmtp','Smtp','verify','then','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','./smtp','mailAccounts','imapAccounts','prototype','name','Imap','messageStatus','total','isNil','emit','hasOwnProperty','service','provider','custom','bind','handleImapEmail','end','handleImapEnd','handleImapError','disabled','handleImapBox','status'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xe088,0x83));var _0x8e08=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0xe088[_0x3b5ad9];return _0x611ae9;};'use strict';var _=require(_0x8e08('0x0'));var moment=require(_0x8e08('0x1'));var BPromise=require(_0x8e08('0x2'));var md5=require(_0x8e08('0x3'));var Redis=require(_0x8e08('0x4'));var config=require(_0x8e08('0x5'));var logger=require(_0x8e08('0x6'))(_0x8e08('0x7'));config[_0x8e08('0x8')]=_[_0x8e08('0x9')](config[_0x8e08('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x8e08('0xa'))(new Redis(config[_0x8e08('0x8')]));var EmailImap=require(_0x8e08('0xb'));var EmailSmtp=require(_0x8e08('0xc'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x52022c){logger['info']('start\x20email\x20channel');this['mailAccounts']=_0x52022c[_0x8e08('0xd')];this[_0x8e08('0xe')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x8e08('0xf')]['emit']=function(_0x46c844){var _0x301a2a=this[_0x8e08('0xd')][_0x46c844];var _0x317337={'id':_0x301a2a['id'],'name':_0x301a2a[_0x8e08('0x10')],'key':_0x301a2a['key'],'active':_0x301a2a['active'],'Imap':{'status':_0x301a2a[_0x8e08('0x11')]['status'],'messageStatus':_0x301a2a[_0x8e08('0x11')][_0x8e08('0x12')],'total':_0x301a2a['Imap'][_0x8e08('0x13')]}};if(_[_0x8e08('0x14')](md5Accounts[_0x46c844])){md5Accounts[_0x46c844]={};}var _0x38831c=md5(JSON['stringify'](_0x317337));if(md5Accounts[_0x46c844][_0x8e08('0x3')]!==_0x38831c){md5Accounts[_0x46c844]['md5']=_0x38831c;io[_0x8e08('0x15')]('mailAccount:update',_0x317337);}};EmailChannel[_0x8e08('0xf')]['refresh']=function(_0x5ab0f2){for(var _0x3fd0db in _0x5ab0f2){if(_0x5ab0f2[_0x8e08('0x16')](_0x3fd0db)){if(_0x5ab0f2[_0x3fd0db][_0x8e08('0x11')]&&_0x5ab0f2[_0x3fd0db]['active']){var _0x1b446e=_0x5ab0f2[_0x3fd0db][_0x8e08('0x11')];if(!_0x1b446e[_0x8e08('0x17')]&&_0x5ab0f2[_0x3fd0db][_0x8e08('0x18')]!==_0x8e08('0x19'))_0x1b446e[_0x8e08('0x17')]=_0x5ab0f2[_0x3fd0db][_0x8e08('0x18')];if(!this['imapAccounts'][_0x8e08('0x16')](_0x1b446e['id'])){this['imapAccounts'][_0x1b446e['id']]=new EmailImap(_0x1b446e,_0x5ab0f2[_0x3fd0db][_0x8e08('0x7')]);this['imapAccounts'][_0x1b446e['id']]['on']('box',this['handleImapBox'][_0x8e08('0x1a')](this,_0x3fd0db));this[_0x8e08('0xe')][_0x1b446e['id']]['on'](_0x8e08('0x7'),this[_0x8e08('0x1b')]['bind'](this,_0x3fd0db));this[_0x8e08('0xe')][_0x1b446e['id']]['on'](_0x8e08('0x1c'),this[_0x8e08('0x1d')][_0x8e08('0x1a')](this,_0x3fd0db));this[_0x8e08('0xe')][_0x1b446e['id']]['on']('error',this[_0x8e08('0x1e')][_0x8e08('0x1a')](this,_0x3fd0db));}}else{if(_['isNil'](this[_0x8e08('0xd')][_0x3fd0db][_0x8e08('0x11')])){this[_0x8e08('0xd')][_0x3fd0db]['Imap']={};}this['mailAccounts'][_0x3fd0db][_0x8e08('0x11')]['status']=_0x8e08('0x1f');this[_0x8e08('0xd')][_0x3fd0db][_0x8e08('0x11')][_0x8e08('0x12')]='';this[_0x8e08('0x15')](_0x3fd0db);}}}};EmailChannel[_0x8e08('0xf')][_0x8e08('0x20')]=function(_0x472ca1,_0x39ac60){if(this[_0x8e08('0xd')][_0x472ca1]){this['mailAccounts'][_0x472ca1][_0x8e08('0x11')][_0x8e08('0x21')]=_0x8e08('0x22');this['mailAccounts'][_0x472ca1][_0x8e08('0x11')][_0x8e08('0x12')]=_0x39ac60[_0x8e08('0x10')];if(_0x39ac60[_0x8e08('0x23')]){this[_0x8e08('0xd')][_0x472ca1][_0x8e08('0x11')][_0x8e08('0x13')]=_0x39ac60[_0x8e08('0x23')][_0x8e08('0x13')];}return this[_0x8e08('0x15')](_0x472ca1);}};EmailChannel[_0x8e08('0xf')][_0x8e08('0x1b')]=function(_0x2465f7,_0x7f464d){logger[_0x8e08('0x24')](_0x8e08('0x25'),_0x7f464d[_0x8e08('0x26')],_0x7f464d[_0x8e08('0x27')],_0x7f464d[_0x8e08('0x28')],_0x2465f7);if(this[_0x8e08('0xd')][_0x2465f7]){return mailAccount[_0x8e08('0x29')](_0x2465f7,_0x7f464d)['then'](function(_0x5a2f7a){if(_0x5a2f7a){logger['info'](_0x8e08('0x2a'));}})[_0x8e08('0x2b')](function(_0x52044d){logger['error'](_0x8e08('0x2c'),JSON[_0x8e08('0x2d')](_0x52044d));});}};EmailChannel['prototype'][_0x8e08('0x1d')]=function(_0x597891){if(this['mailAccounts'][_0x597891]&&this[_0x8e08('0xd')][_0x597891][_0x8e08('0x11')]){if(this['imapAccounts'][this[_0x8e08('0xd')][_0x597891][_0x8e08('0x11')]['id']]){delete this[_0x8e08('0xe')][this['mailAccounts'][_0x597891][_0x8e08('0x11')]['id']];}this[_0x8e08('0xd')][_0x597891][_0x8e08('0x11')][_0x8e08('0x2e')]=moment();this[_0x8e08('0x15')](_0x597891);}};EmailChannel[_0x8e08('0xf')][_0x8e08('0x1e')]=function(_0xc86578,_0xc6bb12){if(this[_0x8e08('0xd')][_0xc86578]){this[_0x8e08('0xd')][_0xc86578]['Imap'][_0x8e08('0x21')]=_0x8e08('0x2f');this[_0x8e08('0xd')][_0xc86578]['Imap'][_0x8e08('0x12')]=_0xc6bb12;return this['emit'](_0xc86578);}};EmailChannel[_0x8e08('0xf')]['sendMail']=function(_0x42c447,_0x38f4bc){return this[_0x8e08('0x30')]['send'](_0x42c447,_0x38f4bc);};EmailChannel[_0x8e08('0xf')][_0x8e08('0x31')]=function(_0x534b92){var _0x41c692=this;if(this[_0x8e08('0xd')][_0x534b92['id']]){if(_[_0x8e08('0x14')](this[_0x8e08('0xd')][_0x534b92['id']]['Smtp'])){this['mailAccounts'][_0x534b92['id']][_0x8e08('0x32')]={};}this[_0x8e08('0xd')][_0x534b92['id']]['Smtp'][_0x8e08('0x2e')]=moment();return new BPromise(function(_0x53462e,_0x235d9c){return _0x41c692[_0x8e08('0x30')][_0x8e08('0x33')](_0x534b92)[_0x8e08('0x34')](function(_0x17bac0){_0x41c692[_0x8e08('0xd')][_0x534b92['id']][_0x8e08('0x32')][_0x8e08('0x21')]=_0x8e08('0x35');_0x41c692[_0x8e08('0xd')][_0x534b92['id']][_0x8e08('0x32')]['messageStatus']='';_0x41c692[_0x8e08('0x15')](_0x534b92['id']);_0x53462e(_0x17bac0);})['catch'](function(_0x590407){_0x41c692[_0x8e08('0xd')][_0x534b92['id']][_0x8e08('0x32')][_0x8e08('0x21')]='error';_0x41c692[_0x8e08('0xd')][_0x534b92['id']][_0x8e08('0x32')][_0x8e08('0x12')]=_0x590407;_0x41c692['emit'](_0x534b92['id']);_0x235d9c(_0x590407);});});}return this['smtp'][_0x8e08('0x33')](_0x534b92);};module[_0x8e08('0x36')]=EmailChannel; \ No newline at end of file +var _0x3ba3=['from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','handleImapError','send','Smtp','smtp','verify','verified','exports','lodash','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','name','key','status','messageStatus','Imap','total','isNil','stringify','md5','emit','mailAccount:update','hasOwnProperty','active','service','provider','custom','box','handleImapBox','handleImapEmail','bind','end','error','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName'];(function(_0x2e6d8e,_0x3360a1){var _0x16c0f9=function(_0x589c99){while(--_0x589c99){_0x2e6d8e['push'](_0x2e6d8e['shift']());}};_0x16c0f9(++_0x3360a1);}(_0x3ba3,0xfb));var _0x33ba=function(_0x282613,_0x5ac10d){_0x282613=_0x282613-0x0;var _0x31fb48=_0x3ba3[_0x282613];return _0x31fb48;};'use strict';var _=require(_0x33ba('0x0'));var moment=require('moment');var BPromise=require(_0x33ba('0x1'));var md5=require('md5');var Redis=require(_0x33ba('0x2'));var config=require(_0x33ba('0x3'));var logger=require(_0x33ba('0x4'))(_0x33ba('0x5'));config[_0x33ba('0x6')]=_[_0x33ba('0x7')](config['redis'],{'host':_0x33ba('0x8'),'port':0x18eb});var io=require(_0x33ba('0x9'))(new Redis(config[_0x33ba('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x33ba('0xa'));var mailAccount=require(_0x33ba('0xb'));var md5Accounts={};function EmailChannel(_0x35a248){logger[_0x33ba('0xc')](_0x33ba('0xd'));this[_0x33ba('0xe')]=_0x35a248[_0x33ba('0xe')];this[_0x33ba('0xf')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x33ba('0x10')]['emit']=function(_0x44588f){var _0x3dcc43=this[_0x33ba('0xe')][_0x44588f];var _0x14eee9={'id':_0x3dcc43['id'],'name':_0x3dcc43[_0x33ba('0x11')],'key':_0x3dcc43[_0x33ba('0x12')],'active':_0x3dcc43['active'],'Imap':{'status':_0x3dcc43['Imap'][_0x33ba('0x13')],'messageStatus':_0x3dcc43['Imap'][_0x33ba('0x14')],'total':_0x3dcc43[_0x33ba('0x15')][_0x33ba('0x16')]}};if(_[_0x33ba('0x17')](md5Accounts[_0x44588f])){md5Accounts[_0x44588f]={};}var _0x192933=md5(JSON[_0x33ba('0x18')](_0x14eee9));if(md5Accounts[_0x44588f][_0x33ba('0x19')]!==_0x192933){md5Accounts[_0x44588f][_0x33ba('0x19')]=_0x192933;io[_0x33ba('0x1a')](_0x33ba('0x1b'),_0x14eee9);}};EmailChannel['prototype']['refresh']=function(_0x474341){for(var _0x5f4d50 in _0x474341){if(_0x474341[_0x33ba('0x1c')](_0x5f4d50)){if(_0x474341[_0x5f4d50]['Imap']&&_0x474341[_0x5f4d50][_0x33ba('0x1d')]){var _0x208197=_0x474341[_0x5f4d50][_0x33ba('0x15')];if(!_0x208197[_0x33ba('0x1e')]&&_0x474341[_0x5f4d50][_0x33ba('0x1f')]!==_0x33ba('0x20'))_0x208197[_0x33ba('0x1e')]=_0x474341[_0x5f4d50][_0x33ba('0x1f')];if(!this['imapAccounts'][_0x33ba('0x1c')](_0x208197['id'])){this[_0x33ba('0xf')][_0x208197['id']]=new EmailImap(_0x208197,_0x474341[_0x5f4d50][_0x33ba('0x5')]);this[_0x33ba('0xf')][_0x208197['id']]['on'](_0x33ba('0x21'),this[_0x33ba('0x22')]['bind'](this,_0x5f4d50));this['imapAccounts'][_0x208197['id']]['on'](_0x33ba('0x5'),this[_0x33ba('0x23')][_0x33ba('0x24')](this,_0x5f4d50));this[_0x33ba('0xf')][_0x208197['id']]['on'](_0x33ba('0x25'),this['handleImapEnd']['bind'](this,_0x5f4d50));this['imapAccounts'][_0x208197['id']]['on'](_0x33ba('0x26'),this['handleImapError'][_0x33ba('0x24')](this,_0x5f4d50));}}else{if(_[_0x33ba('0x17')](this['mailAccounts'][_0x5f4d50][_0x33ba('0x15')])){this[_0x33ba('0xe')][_0x5f4d50][_0x33ba('0x15')]={};}this[_0x33ba('0xe')][_0x5f4d50][_0x33ba('0x15')][_0x33ba('0x13')]='disabled';this['mailAccounts'][_0x5f4d50][_0x33ba('0x15')][_0x33ba('0x14')]='';this['emit'](_0x5f4d50);}}}};EmailChannel['prototype'][_0x33ba('0x22')]=function(_0x3c8b7d,_0x52389f){if(this[_0x33ba('0xe')][_0x3c8b7d]){this[_0x33ba('0xe')][_0x3c8b7d][_0x33ba('0x15')][_0x33ba('0x13')]=_0x33ba('0x27');this[_0x33ba('0xe')][_0x3c8b7d][_0x33ba('0x15')][_0x33ba('0x14')]=_0x52389f[_0x33ba('0x11')];if(_0x52389f[_0x33ba('0x28')]){this[_0x33ba('0xe')][_0x3c8b7d]['Imap'][_0x33ba('0x16')]=_0x52389f[_0x33ba('0x28')][_0x33ba('0x16')];}return this[_0x33ba('0x1a')](_0x3c8b7d);}};EmailChannel[_0x33ba('0x10')]['handleImapEmail']=function(_0x528b8d,_0xc27f81){logger[_0x33ba('0xc')](_0x33ba('0x29'),_0xc27f81[_0x33ba('0x2a')],_0xc27f81[_0x33ba('0x2b')],_0xc27f81[_0x33ba('0x2c')],_0x528b8d);if(this['mailAccounts'][_0x528b8d]){return mailAccount[_0x33ba('0x2d')](_0x528b8d,_0xc27f81)[_0x33ba('0x2e')](function(_0x284145){if(_0x284145){logger[_0x33ba('0xc')](_0x33ba('0x2f'));}})[_0x33ba('0x30')](function(_0x72da3f){logger[_0x33ba('0x26')](_0x33ba('0x31'),JSON[_0x33ba('0x18')](_0x72da3f));});}};EmailChannel[_0x33ba('0x10')][_0x33ba('0x32')]=function(_0x3316c7){if(this[_0x33ba('0xe')][_0x3316c7]&&this[_0x33ba('0xe')][_0x3316c7][_0x33ba('0x15')]){if(this[_0x33ba('0xf')][this['mailAccounts'][_0x3316c7][_0x33ba('0x15')]['id']]){delete this['imapAccounts'][this['mailAccounts'][_0x3316c7][_0x33ba('0x15')]['id']];}this[_0x33ba('0xe')][_0x3316c7][_0x33ba('0x15')][_0x33ba('0x33')]=moment();this[_0x33ba('0x1a')](_0x3316c7);}};EmailChannel[_0x33ba('0x10')][_0x33ba('0x34')]=function(_0x44ca73,_0x52fa51){if(this[_0x33ba('0xe')][_0x44ca73]){this['mailAccounts'][_0x44ca73][_0x33ba('0x15')][_0x33ba('0x13')]=_0x33ba('0x26');this[_0x33ba('0xe')][_0x44ca73][_0x33ba('0x15')][_0x33ba('0x14')]=_0x52fa51;return this[_0x33ba('0x1a')](_0x44ca73);}};EmailChannel[_0x33ba('0x10')]['sendMail']=function(_0x881bb,_0x21d3d1){return this['smtp'][_0x33ba('0x35')](_0x881bb,_0x21d3d1);};EmailChannel[_0x33ba('0x10')]['verifySmtp']=function(_0x21b166){var _0x3b5d5d=this;if(this[_0x33ba('0xe')][_0x21b166['id']]){if(_[_0x33ba('0x17')](this[_0x33ba('0xe')][_0x21b166['id']][_0x33ba('0x36')])){this[_0x33ba('0xe')][_0x21b166['id']]['Smtp']={};}this[_0x33ba('0xe')][_0x21b166['id']][_0x33ba('0x36')][_0x33ba('0x33')]=moment();return new BPromise(function(_0x54678d,_0x40c59a){return _0x3b5d5d[_0x33ba('0x37')][_0x33ba('0x38')](_0x21b166)[_0x33ba('0x2e')](function(_0x3d4ba8){_0x3b5d5d[_0x33ba('0xe')][_0x21b166['id']][_0x33ba('0x36')]['status']=_0x33ba('0x39');_0x3b5d5d[_0x33ba('0xe')][_0x21b166['id']]['Smtp'][_0x33ba('0x14')]='';_0x3b5d5d[_0x33ba('0x1a')](_0x21b166['id']);_0x54678d(_0x3d4ba8);})[_0x33ba('0x30')](function(_0x421ffe){_0x3b5d5d[_0x33ba('0xe')][_0x21b166['id']][_0x33ba('0x36')]['status']=_0x33ba('0x26');_0x3b5d5d[_0x33ba('0xe')][_0x21b166['id']][_0x33ba('0x36')]['messageStatus']=_0x421ffe;_0x3b5d5d[_0x33ba('0x1a')](_0x21b166['id']);_0x40c59a(_0x421ffe);});});}return this[_0x33ba('0x37')]['verify'](_0x21b166);};module[_0x33ba('0x3a')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 0f0b6bc..a7a35f9 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 _0x925d=['password','authentication','anonymous@xcally.com','port','tls','required','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','fetch','slice','message','handleFetchMessage','handleFetchError','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','simpleParser','iconv','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','handleError','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5'];(function(_0x2da402,_0x14a691){var _0x31a57d=function(_0x3cfb60){while(--_0x3cfb60){_0x2da402['push'](_0x2da402['shift']());}};_0x31a57d(++_0x14a691);}(_0x925d,0x1a7));var _0xd925=function(_0x1d6980,_0x21d25a){_0x1d6980=_0x1d6980-0x0;var _0x417fdd=_0x925d[_0x1d6980];return _0x417fdd;};'use strict';var _=require(_0xd925('0x0'));var util=require(_0xd925('0x1'));var Imap=require(_0xd925('0x2'));var simpleParser=require('mailparser')[_0xd925('0x3')];var Iconv=require(_0xd925('0x4'))[_0xd925('0x5')];var EventEmitter=require(_0xd925('0x6'))[_0xd925('0x7')];var utils=require('./utils');var logger=require(_0xd925('0x8'))(_0xd925('0x9'));function EmailImap(_0x48fecb,_0x4c6202){this[_0xd925('0xa')]=_0x48fecb[_0xd925('0xa')];this[_0xd925('0xb')]=this[_0xd925('0xc')](_0x48fecb,_0x4c6202);this[_0xd925('0x2')]=new Imap(this['account']);this['imap'][_0xd925('0xd')](_0xd925('0xe'),this[_0xd925('0xf')][_0xd925('0x10')](this));this[_0xd925('0x2')][_0xd925('0xd')](_0xd925('0x11'),this[_0xd925('0x12')][_0xd925('0x10')](this));this[_0xd925('0x2')]['on'](_0xd925('0x13'),this[_0xd925('0x14')][_0xd925('0x10')](this));this[_0xd925('0x2')]['connect']();}util[_0xd925('0x15')](EmailImap,EventEmitter);EmailImap[_0xd925('0x16')]['getAccount']=function(_0x31a23a,_0x141f60){var _0x596786={'connTimeout':_0x31a23a[_0xd925('0x17')]?_0x31a23a[_0xd925('0x17')]*0x3e8:0x2710,'authTimeout':_0x31a23a[_0xd925('0x18')]?_0x31a23a['authTimeout']*0x3e8:0x1388};if(_0x31a23a[_0xd925('0x19')]){_0x596786[_0xd925('0x1a')]=_0x31a23a[_0xd925('0x1a')];if(_0x31a23a[_0xd925('0x1b')]){_0x596786[_0xd925('0x1c')]=utils[_0xd925('0x1d')](_0x31a23a[_0xd925('0x1e')][_0xd925('0x1f')],_0x31a23a[_0xd925('0x1a')]);}else{_0x596786[_0xd925('0x20')]=_0x31a23a[_0xd925('0x20')];}}else{if(_0x31a23a[_0xd925('0x21')]){_0x596786[_0xd925('0x1a')]=_0x31a23a[_0xd925('0x1a')];_0x596786[_0xd925('0x20')]=_0x31a23a[_0xd925('0x20')];}}_0x596786['email']=_0x141f60||_0x31a23a[_0xd925('0x1a')]||_0xd925('0x22');_0x596786['host']=_0x31a23a['host'];_0x596786['port']=_0x31a23a[_0xd925('0x23')]||0x3e1;if(_0x31a23a['tls']){_0x596786[_0xd925('0x24')]=!![];}else{_0x596786['tls']=![];_0x596786['autotls']=_0xd925('0x25');}return _0x596786;};EmailImap[_0xd925('0x16')][_0xd925('0xf')]=function(){this[_0xd925('0x2')][_0xd925('0x26')](this['mailbox'],![],this['handleOpenBox'][_0xd925('0x10')](this));};EmailImap['prototype'][_0xd925('0x27')]=function(_0xf6273b,_0x19caed){if(_0xf6273b){this[_0xd925('0x14')](_0xf6273b,!![]);}else{this[_0xd925('0x28')](_0xd925('0x29'),_0x19caed);this[_0xd925('0x2a')]();}};EmailImap[_0xd925('0x16')][_0xd925('0x2b')]=function(_0x74e7dd){if(_0x74e7dd){this[_0xd925('0x14')](_0x74e7dd,!![]);}else{this[_0xd925('0x2')][_0xd925('0x11')]();}};EmailImap[_0xd925('0x16')][_0xd925('0x2a')]=function(){this[_0xd925('0x2')]['search']([_0xd925('0x2c')],this['handleReadUnseen']['bind'](this));};EmailImap[_0xd925('0x16')][_0xd925('0x2d')]=function(_0x5f44ca,_0x2260b6){if(_0x5f44ca){this[_0xd925('0x14')](_0x5f44ca,!![]);}else{if(_0x2260b6['length']){try{var _0x1f21ca=this[_0xd925('0x2')][_0xd925('0x2e')](_0x2260b6[_0xd925('0x2f')](0x0,0xa),{'bodies':'','markSeen':!![]});_0x1f21ca['on'](_0xd925('0x30'),this[_0xd925('0x31')][_0xd925('0x10')](this));_0x1f21ca[_0xd925('0xd')](_0xd925('0x13'),this[_0xd925('0x32')][_0xd925('0x10')](this));_0x1f21ca[_0xd925('0xd')](_0xd925('0x11'),this['handleFetchEnd'][_0xd925('0x10')](this));}catch(_0x356787){logger[_0xd925('0x13')](_0x356787);}}else{this['imap'][_0xd925('0x33')](!![],this[_0xd925('0x2b')][_0xd925('0x10')](this));}}};EmailImap['prototype'][_0xd925('0x31')]=function(_0x47e488){_0x47e488['on'](_0xd925('0x34'),this[_0xd925('0x35')][_0xd925('0x10')](this));_0x47e488['once'](_0xd925('0x36'),this[_0xd925('0x37')][_0xd925('0x10')](this));_0x47e488['once'](_0xd925('0x11'),this[_0xd925('0x38')][_0xd925('0x10')](this));};EmailImap['prototype']['handleMessageBody']=function(_0x2dcfb6){simpleParser(_0x2dcfb6,{'Iconv':Iconv},this[_0xd925('0x39')][_0xd925('0x10')](this));};EmailImap[_0xd925('0x16')]['handleMessageAttributes']=function(){};EmailImap[_0xd925('0x16')][_0xd925('0x38')]=function(){};EmailImap[_0xd925('0x16')][_0xd925('0x39')]=function(_0x42a533,_0x1f1d15){if(_0x42a533){logger[_0xd925('0x13')](_0x42a533);}else{var _0x17a15f=this;utils[_0xd925('0x3a')](this[_0xd925('0xb')],_0x1f1d15,function(_0x22c926){_0x17a15f['emit'](_0xd925('0x9'),_0x22c926);});}};EmailImap[_0xd925('0x16')][_0xd925('0x3b')]=function(){this['imap']['closeBox'](!![],this[_0xd925('0x2b')]['bind'](this));};EmailImap[_0xd925('0x16')]['handleFetchError']=function(_0x5764f3){this['handleError'](_0x5764f3);this['imap'][_0xd925('0x33')](!![],this[_0xd925('0x2b')][_0xd925('0x10')](this));};EmailImap['prototype'][_0xd925('0x12')]=function(){this[_0xd925('0x28')](_0xd925('0x11'));};EmailImap['prototype'][_0xd925('0x14')]=function(_0x2c93fa,_0x2ea028){logger[_0xd925('0x13')]('handleError',this[_0xd925('0xb')][_0xd925('0x9')],JSON[_0xd925('0x3c')](_0x2c93fa));var _0x546136='';if(_0x2c93fa){if(_0x2c93fa[_0xd925('0x3d')]){_0x546136=_0x2c93fa[_0xd925('0x3d')];}else{for(var _0x37264a in _0x2c93fa){if(_0x2c93fa[_0xd925('0x3e')](_0x37264a)){_0x546136+=_[_0xd925('0x3f')](_0x37264a)+':\x20'+_0x2c93fa[_0x37264a]+'\x0a';}}}}if(_0x2ea028){this['imap'][_0xd925('0x11')]();}else{this[_0xd925('0x28')](_0xd925('0x13'),_0x546136);this[_0xd925('0x28')](_0xd925('0x11'));}};module[_0xd925('0x40')]=EmailImap; \ No newline at end of file +var _0x8769=['simpleParser','iconv','Iconv','events','EventEmitter','./utils','email','mailbox','account','getAccount','ready','handleReady','bind','once','end','handleEnd','error','handleError','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','openBox','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','handleFetchError','stringify','textCode','hasOwnProperty','exports','util','imap','mailparser'];(function(_0x4896cd,_0x5d5055){var _0x339b5c=function(_0x4994c2){while(--_0x4994c2){_0x4896cd['push'](_0x4896cd['shift']());}};_0x339b5c(++_0x5d5055);}(_0x8769,0x142));var _0x9876=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x8769[_0x31a371];return _0x2a5bd6;};'use strict';var _=require('lodash');var util=require(_0x9876('0x0'));var Imap=require(_0x9876('0x1'));var simpleParser=require(_0x9876('0x2'))[_0x9876('0x3')];var Iconv=require(_0x9876('0x4'))[_0x9876('0x5')];var EventEmitter=require(_0x9876('0x6'))[_0x9876('0x7')];var utils=require(_0x9876('0x8'));var logger=require('../../../config/logger')(_0x9876('0x9'));function EmailImap(_0x340df9,_0x2f2b5d){this[_0x9876('0xa')]=_0x340df9[_0x9876('0xa')];this[_0x9876('0xb')]=this[_0x9876('0xc')](_0x340df9,_0x2f2b5d);this[_0x9876('0x1')]=new Imap(this[_0x9876('0xb')]);this[_0x9876('0x1')]['once'](_0x9876('0xd'),this[_0x9876('0xe')][_0x9876('0xf')](this));this[_0x9876('0x1')][_0x9876('0x10')](_0x9876('0x11'),this[_0x9876('0x12')]['bind'](this));this['imap']['on'](_0x9876('0x13'),this[_0x9876('0x14')]['bind'](this));this[_0x9876('0x1')]['connect']();}util[_0x9876('0x15')](EmailImap,EventEmitter);EmailImap[_0x9876('0x16')][_0x9876('0xc')]=function(_0x4a741a,_0x5825c9){var _0x4d3451={'connTimeout':_0x4a741a[_0x9876('0x17')]?_0x4a741a[_0x9876('0x17')]*0x3e8:0x2710,'authTimeout':_0x4a741a[_0x9876('0x18')]?_0x4a741a[_0x9876('0x18')]*0x3e8:0x1388};if(_0x4a741a[_0x9876('0x19')]){_0x4d3451[_0x9876('0x1a')]=_0x4a741a[_0x9876('0x1a')];if(_0x4a741a[_0x9876('0x1b')]){_0x4d3451[_0x9876('0x1c')]=utils[_0x9876('0x1d')](_0x4a741a[_0x9876('0x1e')][_0x9876('0x1f')],_0x4a741a[_0x9876('0x1a')]);}else{_0x4d3451['password']=_0x4a741a[_0x9876('0x20')];}}else{if(_0x4a741a[_0x9876('0x21')]){_0x4d3451[_0x9876('0x1a')]=_0x4a741a['user'];_0x4d3451[_0x9876('0x20')]=_0x4a741a[_0x9876('0x20')];}}_0x4d3451['email']=_0x5825c9||_0x4a741a[_0x9876('0x1a')]||'anonymous@xcally.com';_0x4d3451[_0x9876('0x22')]=_0x4a741a['host'];_0x4d3451[_0x9876('0x23')]=_0x4a741a['port']||0x3e1;if(_0x4a741a[_0x9876('0x24')]){_0x4d3451[_0x9876('0x24')]=!![];}else{_0x4d3451['tls']=![];_0x4d3451[_0x9876('0x25')]='required';}return _0x4d3451;};EmailImap[_0x9876('0x16')][_0x9876('0xe')]=function(){this['imap'][_0x9876('0x26')](this['mailbox'],![],this[_0x9876('0x27')][_0x9876('0xf')](this));};EmailImap['prototype'][_0x9876('0x27')]=function(_0xf90ecd,_0xffaa50){if(_0xf90ecd){this[_0x9876('0x14')](_0xf90ecd,!![]);}else{this[_0x9876('0x28')](_0x9876('0x29'),_0xffaa50);this[_0x9876('0x2a')]();}};EmailImap[_0x9876('0x16')]['handleCloseBox']=function(_0x19b95d){if(_0x19b95d){this[_0x9876('0x14')](_0x19b95d,!![]);}else{this[_0x9876('0x1')][_0x9876('0x11')]();}};EmailImap[_0x9876('0x16')][_0x9876('0x2a')]=function(){this[_0x9876('0x1')][_0x9876('0x2b')]([_0x9876('0x2c')],this[_0x9876('0x2d')][_0x9876('0xf')](this));};EmailImap[_0x9876('0x16')][_0x9876('0x2d')]=function(_0x22d24a,_0x139cad){if(_0x22d24a){this[_0x9876('0x14')](_0x22d24a,!![]);}else{if(_0x139cad[_0x9876('0x2e')]){try{var _0x2999d2=this[_0x9876('0x1')][_0x9876('0x2f')](_0x139cad['slice'](0x0,0xa),{'bodies':'','markSeen':!![]});_0x2999d2['on'](_0x9876('0x30'),this[_0x9876('0x31')][_0x9876('0xf')](this));_0x2999d2['once'](_0x9876('0x13'),this['handleFetchError'][_0x9876('0xf')](this));_0x2999d2['once'](_0x9876('0x11'),this['handleFetchEnd']['bind'](this));}catch(_0xe0dd56){logger[_0x9876('0x13')](_0xe0dd56);}}else{this['imap'][_0x9876('0x32')](!![],this[_0x9876('0x33')]['bind'](this));}}};EmailImap[_0x9876('0x16')][_0x9876('0x31')]=function(_0x311741){_0x311741['on'](_0x9876('0x34'),this[_0x9876('0x35')][_0x9876('0xf')](this));_0x311741[_0x9876('0x10')](_0x9876('0x36'),this[_0x9876('0x37')][_0x9876('0xf')](this));_0x311741[_0x9876('0x10')](_0x9876('0x11'),this[_0x9876('0x38')][_0x9876('0xf')](this));};EmailImap[_0x9876('0x16')][_0x9876('0x35')]=function(_0x10344d){simpleParser(_0x10344d,{'Iconv':Iconv},this[_0x9876('0x39')][_0x9876('0xf')](this));};EmailImap[_0x9876('0x16')][_0x9876('0x37')]=function(){};EmailImap[_0x9876('0x16')][_0x9876('0x38')]=function(){};EmailImap['prototype'][_0x9876('0x39')]=function(_0x1d569a,_0x16bec0){if(_0x1d569a){logger[_0x9876('0x13')](_0x1d569a);}else{var _0x3dd70c=this;utils[_0x9876('0x3a')](this[_0x9876('0xb')],_0x16bec0,function(_0x847e08){_0x3dd70c[_0x9876('0x28')](_0x9876('0x9'),_0x847e08);});}};EmailImap[_0x9876('0x16')][_0x9876('0x3b')]=function(){this[_0x9876('0x1')][_0x9876('0x32')](!![],this[_0x9876('0x33')][_0x9876('0xf')](this));};EmailImap[_0x9876('0x16')][_0x9876('0x3c')]=function(_0x4fd4ae){this['handleError'](_0x4fd4ae);this[_0x9876('0x1')]['closeBox'](!![],this['handleCloseBox'][_0x9876('0xf')](this));};EmailImap[_0x9876('0x16')][_0x9876('0x12')]=function(){this[_0x9876('0x28')](_0x9876('0x11'));};EmailImap['prototype'][_0x9876('0x14')]=function(_0x2a9242,_0x3cc443){logger[_0x9876('0x13')](_0x9876('0x14'),this[_0x9876('0xb')][_0x9876('0x9')],JSON[_0x9876('0x3d')](_0x2a9242));var _0x527976='';if(_0x2a9242){if(_0x2a9242['textCode']){_0x527976=_0x2a9242[_0x9876('0x3e')];}else{for(var _0x2e9c7d in _0x2a9242){if(_0x2a9242[_0x9876('0x3f')](_0x2e9c7d)){_0x527976+=_['upperFirst'](_0x2e9c7d)+':\x20'+_0x2a9242[_0x2e9c7d]+'\x0a';}}}}if(_0x3cc443){this[_0x9876('0x1')]['end']();}else{this['emit'](_0x9876('0x13'),_0x527976);this[_0x9876('0x28')]('end');}};module[_0x9876('0x40')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 4162754..fc0019f 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 _0xc7e6=['createTransport','Not\x20verifired','exports','nodemailer-plugin-inline-base64','prototype','send','use','compile','sendMail','toString'];(function(_0x4e033b,_0x5de4ea){var _0x49cab5=function(_0x46c0cc){while(--_0x46c0cc){_0x4e033b['push'](_0x4e033b['shift']());}};_0x49cab5(++_0x5de4ea);}(_0xc7e6,0xd5));var _0x6c7e=function(_0x4f89ff,_0x5e466b){_0x4f89ff=_0x4f89ff-0x0;var _0x42f34c=_0xc7e6[_0x4f89ff];return _0x42f34c;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x6c7e('0x0'));function EmailSmtp(){}EmailSmtp[_0x6c7e('0x1')][_0x6c7e('0x2')]=function(_0xd26ca1,_0x39ad18){return new Promise(function(_0x502e6a,_0xc84d4c){var _0x588035=nodemailer['createTransport'](_0xd26ca1);_0x588035[_0x6c7e('0x3')](_0x6c7e('0x4'),inlineBase64());_0x588035[_0x6c7e('0x5')](_0x39ad18,function(_0x3476aa,_0x1f72cf){if(_0x3476aa){_0xc84d4c(_0x3476aa[_0x6c7e('0x6')]());}else{_0x502e6a(_0x1f72cf);}});});};EmailSmtp['prototype']['verify']=function(_0x2cd3f8){return new Promise(function(_0x2f802b,_0x4e5249){var _0x3f2643=nodemailer[_0x6c7e('0x7')](_0x2cd3f8);_0x3f2643['verify'](function(_0x2c5ad7,_0x52a7c4){if(_0x2c5ad7){_0x4e5249(_0x2c5ad7['toString']());}else{if(_0x52a7c4){_0x2f802b(_0x52a7c4);}else{_0x4e5249(_0x6c7e('0x8'));}}});});};module[_0x6c7e('0x9')]=EmailSmtp; \ No newline at end of file +var _0x4991=['sendMail','verify','toString','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport','use','compile'];(function(_0x4ff5a2,_0xb33150){var _0xe162f6=function(_0x321cbd){while(--_0x321cbd){_0x4ff5a2['push'](_0x4ff5a2['shift']());}};_0xe162f6(++_0xb33150);}(_0x4991,0x186));var _0x1499=function(_0x3e00ca,_0xe4824b){_0x3e00ca=_0x3e00ca-0x0;var _0xe1bcdc=_0x4991[_0x3e00ca];return _0xe1bcdc;};'use strict';var nodemailer=require(_0x1499('0x0'));var inlineBase64=require(_0x1499('0x1'));function EmailSmtp(){}EmailSmtp[_0x1499('0x2')]['send']=function(_0x40bc06,_0x3105fd){return new Promise(function(_0x14c442,_0x4e6eb6){var _0x46ce84=nodemailer[_0x1499('0x3')](_0x40bc06);_0x46ce84[_0x1499('0x4')](_0x1499('0x5'),inlineBase64());_0x46ce84[_0x1499('0x6')](_0x3105fd,function(_0x49b1a0,_0x53fccd){if(_0x49b1a0){_0x4e6eb6(_0x49b1a0['toString']());}else{_0x14c442(_0x53fccd);}});});};EmailSmtp[_0x1499('0x2')][_0x1499('0x7')]=function(_0x52d87e){return new Promise(function(_0x3eaf86,_0x3335f3){var _0x4cf5d3=nodemailer[_0x1499('0x3')](_0x52d87e);_0x4cf5d3[_0x1499('0x7')](function(_0x19fe9f,_0x353931){if(_0x19fe9f){_0x3335f3(_0x19fe9f[_0x1499('0x8')]());}else{if(_0x353931){_0x3eaf86(_0x353931);}else{_0x3335f3(_0x1499('0x9'));}}});});};module[_0x1499('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index f419861..3c3afc4 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 _0xbe52=['format','%s-%s','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','Precedence:\x20auto_reply','line','isAutoreply','from','subject','messageId','inReplyTo','date','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','

Empty\x20message

','Attachments','generateXOAuth2Token','user=','utf-8','toString','base64','lodash','moment','path','util','../../../config/logger','head','address','anonymous','generate','@xcally.com','value','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','html','test','replace','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x26998b[_0x2be5('0x10')](0x0,-0x1)[_0x2be5('0x11')]('\x20'):_0x1b961a['name'];}return _0x2be5('0x12');}function getLastName(_0x36df0e){var _0xabc63f=_[_0x2be5('0x5')](_0x36df0e['value']);if(_0xabc63f&&_0xabc63f[_0x2be5('0xb')]){var _0x153b9c=_0xabc63f['name'][_0x2be5('0xe')](/\s+/);return _0x153b9c['length']>0x1?_0x153b9c[_0x2be5('0x13')]():'';}return'';}function getMails(_0x1a07a9,_0x1d90e2){var _0x1aebe1='';for(var _0x59420a=0x0;_0x59420a<_0x1d90e2[_0x2be5('0xa')][_0x2be5('0xf')];_0x59420a+=0x1){if(_0x1d90e2[_0x2be5('0xa')][_0x59420a]['address']!==_0x1a07a9){if(!_[_0x2be5('0x14')](_0x1aebe1)){_0x1aebe1+=',';}_0x1aebe1+=_0x1d90e2['value'][_0x59420a]['name']||_0x1d90e2[_0x2be5('0xa')][_0x59420a]['address']||'';_0x1aebe1+='\x20<';_0x1aebe1+=_0x1d90e2[_0x2be5('0xa')][_0x59420a][_0x2be5('0x6')]?_0x1d90e2[_0x2be5('0xa')][_0x59420a][_0x2be5('0x6')]:_0x2be5('0x7')+random[_0x2be5('0x8')](0x6)+_0x2be5('0x9');_0x1aebe1+='>';}}return _0x1aebe1;}function parseEmail(_0x106640,_0x4113ef,_0x413068){if(_0x4113ef[_0x2be5('0x15')]){var _0x1ff599=/)<[^<]*)*<\/script>/gi;while(_0x1ff599[_0x2be5('0x16')](_0x4113ef['html'])){_0x4113ef[_0x2be5('0x15')]=_0x4113ef['html'][_0x2be5('0x17')](_0x1ff599,'');}if(_0x4113ef['html']['includes'](_0x2be5('0x18'))){var _0x35c407=[];_0x4113ef['attachments']['forEach'](_0x1fee5a=>{_0x35c407[_0x2be5('0x19')](_0x1fee5a[_0x2be5('0x1a')]);});var _0x503a5f=/]+>/g;var _0x5637c5=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x48443e=_0x4113ef[_0x2be5('0x15')]['replace'](_0x5637c5,_0x2be5('0x1b'));var _0x89ed88=_0x48443e[_0x2be5('0x17')](_0x503a5f,_0x2be5('0x1c'));for(let _0x266e41=0x0;_0x266e41<_0x35c407['length'];_0x266e41++){var _0x4d0a6f=_0x89ed88['replace'](_0x2be5('0x1c'),_0x2be5('0x1d')+_0x35c407[_0x266e41]+_0x2be5('0x1e'));_0x89ed88=_0x4d0a6f;}_0x4113ef[_0x2be5('0x15')]=_0x89ed88;}_0x413068[_0x2be5('0x1f')]=_0x4113ef[_0x2be5('0x15')];}else{_0x413068[_0x2be5('0x1f')]=_0x4113ef[_0x2be5('0x20')];}if(_0x413068[_0x2be5('0x1f')]){_0x413068[_0x2be5('0x1f')]=_0x413068[_0x2be5('0x1f')][_0x2be5('0x17')](/0x0){var _0x113514=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All',_0x2be5('0x33')];for(var _0x3a0b09=0x0;_0x3a0b09<_0x4113ef[_0x2be5('0x32')][_0x2be5('0xf')];_0x3a0b09++){var _0x4918bf=_[_0x2be5('0xd')](_0x113514,_0x4113ef[_0x2be5('0x32')][_0x3a0b09][_0x2be5('0x34')]);if(_0x4918bf>=0x0){_0x413068[_0x2be5('0x35')]=!![];}}}return _0x413068;}exports['parser']=function(_0x55667d,_0x1d0931,_0x54abc2){var _0x1a4280={'from':getAddress(_0x1d0931[_0x2be5('0x36')]),'firstName':getFirstName(_0x1d0931['from']),'lastName':getLastName(_0x1d0931[_0x2be5('0x36')]),'mapKey':_0x2be5('0x24'),'message':{'from':getMails(_0x55667d['email'],_0x1d0931[_0x2be5('0x36')]),'to':_0x55667d[_0x2be5('0x24')],'cc':'','subject':_0x1d0931[_0x2be5('0x37')]||'','messageId':_0x1d0931[_0x2be5('0x38')],'inReplyTo':_0x1d0931[_0x2be5('0x39')],'sentAt':moment(_0x1d0931[_0x2be5('0x3a')])[_0x2be5('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x1d0931['html']&&!_0x1d0931[_0x2be5('0x20')]){var _0x5e5cf2=_['filter'](_0x1d0931[_0x2be5('0x28')],{'contentType':_0x2be5('0x3b')});if(_0x5e5cf2['length']){logger[_0x2be5('0x3c')](util[_0x2be5('0x2b')](_0x2be5('0x3d'),_0x1d0931['messageId']));tnef[_0x2be5('0x3e')](_['first'](_0x5e5cf2)['content'],function(_0x1037ba,_0x5bcf20){if(_0x5bcf20){_0x1d0931['html']=_0x5bcf20['BodyHTML']||_0x2be5('0x3f');if(_0x5bcf20['Attachments']){for(var _0x1b0eea=0x0;_0x1b0eea<_0x5bcf20[_0x2be5('0x40')][_0x2be5('0xf')];_0x1b0eea++){var _0x325bcf=_0x5bcf20[_0x2be5('0x40')][_0x1b0eea];_0x1a4280['message'][_0x2be5('0x28')][_0x2be5('0x19')]({'filename':_0x325bcf['Title'],'content':Buffer[_0x2be5('0x36')](_0x325bcf['Data'])});}}}_0x54abc2(parseEmail(_0x55667d,_0x1d0931,_0x1a4280));});}else{_0x1d0931[_0x2be5('0x15')]='

Empty\x20message

';_0x54abc2(parseEmail(_0x55667d,_0x1d0931,_0x1a4280));}}else{_0x54abc2(parseEmail(_0x55667d,_0x1d0931,_0x1a4280));}};exports[_0x2be5('0x41')]=function(_0x593087,_0x134050){var _0xa24084=[_0x2be5('0x42')+(_0x134050||''),'auth=Bearer\x20'+_0x593087,'',''];return Buffer[_0x2be5('0x36')](_0xa24084['join'](''),_0x2be5('0x43'))[_0x2be5('0x44')](_0x2be5('0x45'));}; \ No newline at end of file +var _0xc1c1=['substring','split','length','slice','pop','isEmpty','generate','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','path','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','name'];(function(_0x23e61e,_0x4e9cbb){var _0x734dba=function(_0x7e951d){while(--_0x7e951d){_0x23e61e['push'](_0x23e61e['shift']());}};_0x734dba(++_0x4e9cbb);}(_0xc1c1,0xd4));var _0x1c1c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc1c1[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x1c1c('0x0'));var moment=require('moment');var random=require('randomstring');var fs=require('fs');var path=require(_0x1c1c('0x1'));var util=require('util');var tnef=require(_0x1c1c('0x2'));var logger=require(_0x1c1c('0x3'))(_0x1c1c('0x4'));var config=require(_0x1c1c('0x5'));function getAddress(_0x1046ca){var _0x2078e1=_[_0x1c1c('0x6')](_0x1046ca[_0x1c1c('0x7')]);return _0x2078e1&&_0x2078e1[_0x1c1c('0x8')]?_0x2078e1[_0x1c1c('0x8')]:'anonymous'+random['generate'](0x6)+'@xcally.com';}function getFirstName(_0x216d01){var _0x38e2eb=_['head'](_0x216d01[_0x1c1c('0x7')]);if(_0x38e2eb&&_0x38e2eb[_0x1c1c('0x9')]){if(_0x38e2eb['name']==_0x38e2eb[_0x1c1c('0x8')]){return _0x38e2eb[_0x1c1c('0x9')][_0x1c1c('0xa')](0x0,_0x38e2eb['name']['indexOf']('@'));}var _0x205fb5=_0x38e2eb['name'][_0x1c1c('0xb')](/\s+/);return _0x205fb5[_0x1c1c('0xc')]>0x1?_0x205fb5[_0x1c1c('0xd')](0x0,-0x1)['join']('\x20'):_0x38e2eb[_0x1c1c('0x9')];}return'Anonymous';}function getLastName(_0x1f9fc2){var _0x47d850=_['head'](_0x1f9fc2[_0x1c1c('0x7')]);if(_0x47d850&&_0x47d850['name']){var _0x57d113=_0x47d850[_0x1c1c('0x9')]['split'](/\s+/);return _0x57d113[_0x1c1c('0xc')]>0x1?_0x57d113[_0x1c1c('0xe')]():'';}return'';}function getMails(_0x50aa87,_0x18962d){var _0x5013a0='';for(var _0x10a759=0x0;_0x10a759<_0x18962d['value']['length'];_0x10a759+=0x1){if(_0x18962d['value'][_0x10a759][_0x1c1c('0x8')]!==_0x50aa87){if(!_[_0x1c1c('0xf')](_0x5013a0)){_0x5013a0+=',';}_0x5013a0+=_0x18962d[_0x1c1c('0x7')][_0x10a759][_0x1c1c('0x9')]||_0x18962d[_0x1c1c('0x7')][_0x10a759][_0x1c1c('0x8')]||'';_0x5013a0+='\x20<';_0x5013a0+=_0x18962d[_0x1c1c('0x7')][_0x10a759][_0x1c1c('0x8')]?_0x18962d[_0x1c1c('0x7')][_0x10a759]['address']:'anonymous'+random[_0x1c1c('0x10')](0x6)+'@xcally.com';_0x5013a0+='>';}}return _0x5013a0;}function parseEmail(_0x241c80,_0x1d6028,_0x30624d){if(_0x1d6028[_0x1c1c('0x11')]){var _0x417ccb=/)<[^<]*)*<\/script>/gi;while(_0x417ccb[_0x1c1c('0x12')](_0x1d6028[_0x1c1c('0x11')])){_0x1d6028[_0x1c1c('0x11')]=_0x1d6028[_0x1c1c('0x11')][_0x1c1c('0x13')](_0x417ccb,'');}if(_0x1d6028[_0x1c1c('0x11')][_0x1c1c('0x14')](_0x1c1c('0x15'))){var _0x22bed0=[];_0x1d6028[_0x1c1c('0x16')]['forEach'](_0x12ee4e=>{_0x22bed0[_0x1c1c('0x17')](_0x12ee4e[_0x1c1c('0x18')]);});var _0x450f99=/]+>/g;var _0x593824=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0xa7936a=_0x1d6028[_0x1c1c('0x11')][_0x1c1c('0x13')](_0x593824,_0x1c1c('0x19'));var _0x29b04f=_0xa7936a['replace'](_0x450f99,'_IMG');for(let _0x423ee9=0x0;_0x423ee9<_0x22bed0['length'];_0x423ee9++){var _0x2215a4=_0x29b04f[_0x1c1c('0x13')](_0x1c1c('0x1a'),_0x1c1c('0x1b')+_0x22bed0[_0x423ee9]+_0x1c1c('0x1c'));_0x29b04f=_0x2215a4;}_0x1d6028[_0x1c1c('0x11')]=_0x29b04f;}_0x30624d['body']=_0x1d6028[_0x1c1c('0x11')];}else{_0x30624d[_0x1c1c('0x1d')]=_0x1d6028[_0x1c1c('0x1e')];}if(_0x30624d['body']){_0x30624d['body']=_0x30624d[_0x1c1c('0x1d')][_0x1c1c('0x13')](/0x0){var _0x17925b=[_0x1c1c('0x30'),'X-Auto-Response-Suppress:\x20All',_0x1c1c('0x31')];for(var _0x166953=0x0;_0x166953<_0x1d6028['headerLines'][_0x1c1c('0xc')];_0x166953++){var _0x562291=_[_0x1c1c('0x32')](_0x17925b,_0x1d6028['headerLines'][_0x166953][_0x1c1c('0x33')]);if(_0x562291>=0x0){_0x30624d[_0x1c1c('0x34')]=!![];}}}return _0x30624d;}exports['parser']=function(_0x5805a8,_0x4d5985,_0xbf53c8){var _0x59ff32={'from':getAddress(_0x4d5985['from']),'firstName':getFirstName(_0x4d5985[_0x1c1c('0x35')]),'lastName':getLastName(_0x4d5985[_0x1c1c('0x35')]),'mapKey':_0x1c1c('0x4'),'message':{'from':getMails(_0x5805a8[_0x1c1c('0x4')],_0x4d5985[_0x1c1c('0x35')]),'to':_0x5805a8[_0x1c1c('0x4')],'cc':'','subject':_0x4d5985[_0x1c1c('0x36')]||'','messageId':_0x4d5985[_0x1c1c('0x37')],'inReplyTo':_0x4d5985[_0x1c1c('0x38')],'sentAt':moment(_0x4d5985[_0x1c1c('0x39')])['format'](_0x1c1c('0x3a')),'attach':![],'attachments':[]}};if(!_0x4d5985[_0x1c1c('0x11')]&&!_0x4d5985[_0x1c1c('0x1e')]){var _0x40bc37=_['filter'](_0x4d5985[_0x1c1c('0x16')],{'contentType':_0x1c1c('0x3b')});if(_0x40bc37['length']){logger[_0x1c1c('0x3c')](util[_0x1c1c('0x26')](_0x1c1c('0x3d'),_0x4d5985['messageId']));tnef[_0x1c1c('0x3e')](_['first'](_0x40bc37)[_0x1c1c('0x2d')],function(_0x2e2e35,_0xfbc093){if(_0xfbc093){_0x4d5985[_0x1c1c('0x11')]=_0xfbc093[_0x1c1c('0x3f')]||'

Empty\x20message

';if(_0xfbc093[_0x1c1c('0x40')]){for(var _0x4d7c25=0x0;_0x4d7c25<_0xfbc093[_0x1c1c('0x40')][_0x1c1c('0xc')];_0x4d7c25++){var _0x456d08=_0xfbc093[_0x1c1c('0x40')][_0x4d7c25];_0x59ff32[_0x1c1c('0x20')]['attachments'][_0x1c1c('0x17')]({'filename':_0x456d08[_0x1c1c('0x41')],'content':Buffer[_0x1c1c('0x35')](_0x456d08[_0x1c1c('0x42')])});}}}_0xbf53c8(parseEmail(_0x5805a8,_0x4d5985,_0x59ff32));});}else{_0x4d5985[_0x1c1c('0x11')]=_0x1c1c('0x43');_0xbf53c8(parseEmail(_0x5805a8,_0x4d5985,_0x59ff32));}}else{_0xbf53c8(parseEmail(_0x5805a8,_0x4d5985,_0x59ff32));}};exports[_0x1c1c('0x44')]=function(_0x23d0ef,_0x7ebd68){var _0x4881c9=[_0x1c1c('0x45')+(_0x7ebd68||''),_0x1c1c('0x46')+_0x23d0ef,'',''];return Buffer[_0x1c1c('0x35')](_0x4881c9['join'](''),_0x1c1c('0x47'))[_0x1c1c('0x48')](_0x1c1c('0x49'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index ce8433b..e4255f4 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ef3=['SERV','active','Imap','Smtp','exports','lodash','name','key'];(function(_0x18196b,_0x4bb354){var _0x54dc09=function(_0x135245){while(--_0x135245){_0x18196b['push'](_0x18196b['shift']());}};_0x54dc09(++_0x4bb354);}(_0x6ef3,0xa5));var _0x36ef=function(_0x3e0b82,_0x123fd2){_0x3e0b82=_0x3e0b82-0x0;var _0xb6808=_0x6ef3[_0x3e0b82];return _0xb6808;};'use strict';var _=require(_0x36ef('0x0'));function MailAccount(_0xa9c6c5){this['id']=_0xa9c6c5['id']||0x0;this[_0x36ef('0x1')]=_0xa9c6c5[_0x36ef('0x1')]||'Service';this[_0x36ef('0x2')]=_0xa9c6c5[_0x36ef('0x2')]||_0x36ef('0x3');this[_0x36ef('0x4')]=_0xa9c6c5[_0x36ef('0x4')]||![];this[_0x36ef('0x5')]=_0xa9c6c5[_0x36ef('0x5')]||[];this[_0x36ef('0x6')]=_0xa9c6c5[_0x36ef('0x6')]||[];}module[_0x36ef('0x7')]=MailAccount; \ No newline at end of file +var _0x3ae6=['SERV','active','Imap','Smtp','exports','lodash','name','Service','key'];(function(_0x3ceaf3,_0x35dc90){var _0x2ea965=function(_0x4b181a){while(--_0x4b181a){_0x3ceaf3['push'](_0x3ceaf3['shift']());}};_0x2ea965(++_0x35dc90);}(_0x3ae6,0x95));var _0x63ae=function(_0x5aaf3d,_0x129743){_0x5aaf3d=_0x5aaf3d-0x0;var _0x3b7120=_0x3ae6[_0x5aaf3d];return _0x3b7120;};'use strict';var _=require(_0x63ae('0x0'));function MailAccount(_0xf98779){this['id']=_0xf98779['id']||0x0;this[_0x63ae('0x1')]=_0xf98779[_0x63ae('0x1')]||_0x63ae('0x2');this[_0x63ae('0x3')]=_0xf98779[_0x63ae('0x3')]||_0x63ae('0x4');this[_0x63ae('0x5')]=_0xf98779[_0x63ae('0x5')]||![];this[_0x63ae('0x6')]=_0xf98779[_0x63ae('0x6')]||[];this['Smtp']=_0xf98779[_0x63ae('0x7')]||[];}module[_0x63ae('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 95b8aaf..b1b1ac1 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2df=['hasOwnProperty','prototype','mergeFromDatabase','exports','lodash','../model/mailAccount','mailAccounts','mapKeys'];(function(_0x4f13a9,_0x47445b){var _0x299155=function(_0x33fc2c){while(--_0x33fc2c){_0x4f13a9['push'](_0x4f13a9['shift']());}};_0x299155(++_0x47445b);}(_0xb2df,0x74));var _0xfb2d=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xb2df[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0xfb2d('0x0'));var MailAccount=require(_0xfb2d('0x1'));var Realtime=function(){this[_0xfb2d('0x2')]={};};function freeIsNotKey(_0xe765f4,_0x6fae20,_0x483624){var _0x5ad4b7=_[_0xfb2d('0x3')](_0xe765f4,function(_0x52cdb9,_0x260b63){return _0x52cdb9[_0x483624];});for(var _0x47bcba in _0x6fae20){if(_0x6fae20[_0xfb2d('0x4')](_0x47bcba)){if(!_0x5ad4b7[_0x47bcba]){delete _0x6fae20[_0x47bcba];}}}}Realtime[_0xfb2d('0x5')][_0xfb2d('0x6')]=function(_0x14c5b8,_0x367c8f){for(var _0x2ccfdd in _0x367c8f){if(_0x14c5b8[_0xfb2d('0x4')](_0x2ccfdd)){_0x14c5b8[_0x2ccfdd]=_0x367c8f[_0x2ccfdd];}}};Realtime['prototype']['initMailAccounts']=function(){var _0xb557bd=this;return function(_0x12492f){if(_0x12492f){freeIsNotKey(_0x12492f,_0xb557bd[_0xfb2d('0x2')],'id');for(var _0x1ea67a=0x0,_0x438859={},_0x1a0137={};_0x1ea67a<_0x12492f['length'];_0x1ea67a+=0x1){_0x438859=_0x12492f[_0x1ea67a];if(_['isUndefined'](_0xb557bd['mailAccounts'][_0x438859['id']])){_0xb557bd[_0xfb2d('0x2')][_0x438859['id']]=new MailAccount(_0x438859);}else{_['merge'](_0xb557bd[_0xfb2d('0x2')][_0x438859['id']],_0x438859);}}}return _0xb557bd['mailAccounts'];};};module[_0xfb2d('0x7')]=Realtime; \ No newline at end of file +var _0x6701=['lodash','../model/mailAccount','mapKeys','prototype','hasOwnProperty','mailAccounts','length','isUndefined','exports'];(function(_0x53b8e0,_0x55d46e){var _0x10630c=function(_0x3189aa){while(--_0x3189aa){_0x53b8e0['push'](_0x53b8e0['shift']());}};_0x10630c(++_0x55d46e);}(_0x6701,0x17a));var _0x1670=function(_0x420fdd,_0x127224){_0x420fdd=_0x420fdd-0x0;var _0x116df3=_0x6701[_0x420fdd];return _0x116df3;};'use strict';var _=require(_0x1670('0x0'));var MailAccount=require(_0x1670('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x814fa3,_0x1ae5cd,_0x4f52ac){var _0x2c2dc4=_[_0x1670('0x2')](_0x814fa3,function(_0x3f9751,_0x487cf0){return _0x3f9751[_0x4f52ac];});for(var _0x4577b5 in _0x1ae5cd){if(_0x1ae5cd['hasOwnProperty'](_0x4577b5)){if(!_0x2c2dc4[_0x4577b5]){delete _0x1ae5cd[_0x4577b5];}}}}Realtime[_0x1670('0x3')]['mergeFromDatabase']=function(_0x5d3fba,_0x3f2077){for(var _0x1f5c76 in _0x3f2077){if(_0x5d3fba[_0x1670('0x4')](_0x1f5c76)){_0x5d3fba[_0x1f5c76]=_0x3f2077[_0x1f5c76];}}};Realtime[_0x1670('0x3')]['initMailAccounts']=function(){var _0x47d433=this;return function(_0x5d52cf){if(_0x5d52cf){freeIsNotKey(_0x5d52cf,_0x47d433[_0x1670('0x5')],'id');for(var _0x5eb8e6=0x0,_0x455f2d={},_0x4725c3={};_0x5eb8e6<_0x5d52cf[_0x1670('0x6')];_0x5eb8e6+=0x1){_0x455f2d=_0x5d52cf[_0x5eb8e6];if(_[_0x1670('0x7')](_0x47d433['mailAccounts'][_0x455f2d['id']])){_0x47d433[_0x1670('0x5')][_0x455f2d['id']]=new MailAccount(_0x455f2d);}else{_['merge'](_0x47d433[_0x1670('0x5')][_0x455f2d['id']],_0x455f2d);}}}return _0x47d433[_0x1670('0x5')];};};module[_0x1670('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 7694db4..e33ccd1 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad1b=['notify','../client','getMailAccounts','Request','GetMailAccount','provider','service','email','key','TemplateId','Imap','CloudProvider','name','type','data5','getMailAccount'];(function(_0x21eacf,_0x1d1f5b){var _0xbae3e=function(_0x17ed68){while(--_0x17ed68){_0x21eacf['push'](_0x21eacf['shift']());}};_0xbae3e(++_0x1d1f5b);}(_0xad1b,0x131));var _0xbad1=function(_0x154c64,_0x48a72e){_0x154c64=_0x154c64-0x0;var _0x1d966c=_0xad1b[_0x154c64];return _0x1d966c;};'use strict';var client=require(_0xbad1('0x0'));exports[_0xbad1('0x1')]=function(){return function(){return client[_0xbad1('0x2')](_0xbad1('0x3'),{'options':{'attributes':['id','name',_0xbad1('0x4'),_0xbad1('0x5'),_0xbad1('0x6'),'active',_0xbad1('0x7'),'ListId',_0xbad1('0x8')],'raw':![],'include':[{'model':'MailServerIn','as':_0xbad1('0x9'),'include':[{'model':_0xbad1('0xa'),'attributes':['id','name','service','type','data5'],'as':_0xbad1('0xa')}]},{'model':'MailServerOut','as':'Smtp','include':[{'model':_0xbad1('0xa'),'attributes':['id',_0xbad1('0xb'),_0xbad1('0x5'),_0xbad1('0xc'),_0xbad1('0xd')],'as':'CloudProvider'}]}]},'log':_0xbad1('0xe')});};};exports[_0xbad1('0xf')]=function(_0x3aeaf6,_0x5bf7a9){return client[_0xbad1('0x2')]('NotifyMailAccount',{'account':{'id':_0x3aeaf6},'body':_0x5bf7a9,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0xe740=['name','service','type','MailServerOut','Smtp','data5','notify','NotifyMailAccount','../client','Request','GetMailAccount','provider','email','key','ListId','MailServerIn','CloudProvider'];(function(_0x19a734,_0x213f46){var _0x2397f2=function(_0x858373){while(--_0x858373){_0x19a734['push'](_0x19a734['shift']());}};_0x2397f2(++_0x213f46);}(_0xe740,0x14b));var _0x0e74=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xe740[_0x3fba9f];return _0x192cf1;};'use strict';var client=require(_0x0e74('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x0e74('0x1')](_0x0e74('0x2'),{'options':{'attributes':['id','name',_0x0e74('0x3'),'service',_0x0e74('0x4'),'active',_0x0e74('0x5'),_0x0e74('0x6'),'TemplateId'],'raw':![],'include':[{'model':_0x0e74('0x7'),'as':'Imap','include':[{'model':_0x0e74('0x8'),'attributes':['id',_0x0e74('0x9'),_0x0e74('0xa'),_0x0e74('0xb'),'data5'],'as':_0x0e74('0x8')}]},{'model':_0x0e74('0xc'),'as':_0x0e74('0xd'),'include':[{'model':_0x0e74('0x8'),'attributes':['id','name',_0x0e74('0xa'),'type',_0x0e74('0xe')],'as':'CloudProvider'}]}]},'log':'getMailAccount'});};};exports[_0x0e74('0xf')]=function(_0x41cdf6,_0x249331){return client[_0x0e74('0x1')]('NotifyMailAccount',{'account':{'id':_0x41cdf6},'body':_0x249331,'log':_0x0e74('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 577d2cc..5bd308e 100644 --- a/server/services/email/rpc/setting.js +++ b/server/services/email/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x223a=['GetSettings','../client','getSettings','ShowSetting','loginMailFrequency'];(function(_0x4d54fe,_0x43e0e2){var _0x511419=function(_0x2338d8){while(--_0x2338d8){_0x4d54fe['push'](_0x4d54fe['shift']());}};_0x511419(++_0x43e0e2);}(_0x223a,0x9c));var _0xa223=function(_0x4946cd,_0x13f560){_0x4946cd=_0x4946cd-0x0;var _0x17624f=_0x223a[_0x4946cd];return _0x17624f;};'use strict';var client=require(_0xa223('0x0'));exports[_0xa223('0x1')]=function(){return client['Request'](_0xa223('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xa223('0x3')]},'log':_0xa223('0x4')});}; \ No newline at end of file +var _0x529e=['loginMailFrequency','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x529e,0xb6));var _0xe529=function(_0x5b4ebc,_0x521d33){_0x5b4ebc=_0x5b4ebc-0x0;var _0x1154ab=_0x529e[_0x5b4ebc];return _0x1154ab;};'use strict';var client=require(_0xe529('0x0'));exports[_0xe529('0x1')]=function(){return client[_0xe529('0x2')](_0xe529('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe529('0x4')]},'log':_0xe529('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index bd0ebbb..4e448f9 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index ef92231..de48da7 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf590=['default','../../config/express','once','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','listen','socket.io','polling','defaults','redis','localhost','adapter','../../config/triggers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf590,0x84));var _0x0f59=function(_0xadf6b6,_0xd8c1){_0xadf6b6=_0xadf6b6-0x0;var _0x525870=_0xf590[_0xadf6b6];return _0x525870;};'use strict';var _=require(_0x0f59('0x0'));var http=require(_0x0f59('0x1'));var express=require(_0x0f59('0x2'));var sticky=require(_0x0f59('0x3'));var Redis=require(_0x0f59('0x4'));var config=require(_0x0f59('0x5'));var app=express();var server=http[_0x0f59('0x6')](app);server['timeout']=0xdbba0;if(sticky[_0x0f59('0x7')](server,config['port'])){var socketio=require(_0x0f59('0x8'))(server,{'transports':['websocket',_0x0f59('0x9')]});config['redis']=_[_0x0f59('0xa')](config[_0x0f59('0xb')],{'host':_0x0f59('0xc'),'port':0x18eb});socketio[_0x0f59('0xd')](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require(_0x0f59('0xe'))[_0x0f59('0xf')]();require('../../config/socketio')['default'](socketio);require(_0x0f59('0x10'))[_0x0f59('0xf')](app);require('../../routes')['default'](app);}else{server[_0x0f59('0x11')]('listening',function(){console['log'](_0x0f59('0x12'),config[_0x0f59('0x13')]);});}exports=module[_0x0f59('0x14')]=app; \ No newline at end of file +var _0xe9a6=['../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','sticky-session','ioredis','../../config/environment','createServer','listen','port','socket.io','websocket','redis','defaults','localhost','adapter','../../config/triggers','default'];(function(_0x2b5c43,_0x5a150c){var _0xbd3c4a=function(_0x49ebb3){while(--_0x49ebb3){_0x2b5c43['push'](_0x2b5c43['shift']());}};_0xbd3c4a(++_0x5a150c);}(_0xe9a6,0xc8));var _0x6e9a=function(_0x585820,_0x191ba2){_0x585820=_0x585820-0x0;var _0x5319bd=_0xe9a6[_0x585820];return _0x5319bd;};'use strict';var _=require(_0x6e9a('0x0'));var http=require(_0x6e9a('0x1'));var express=require('express');var sticky=require(_0x6e9a('0x2'));var Redis=require(_0x6e9a('0x3'));var config=require(_0x6e9a('0x4'));var app=express();var server=http[_0x6e9a('0x5')](app);server['timeout']=0xdbba0;if(sticky[_0x6e9a('0x6')](server,config[_0x6e9a('0x7')])){var socketio=require(_0x6e9a('0x8'))(server,{'transports':[_0x6e9a('0x9'),'polling']});config[_0x6e9a('0xa')]=_[_0x6e9a('0xb')](config[_0x6e9a('0xa')],{'host':_0x6e9a('0xc'),'port':0x18eb});socketio[_0x6e9a('0xd')](require('socket.io-redis')({'pubClient':new Redis(config[_0x6e9a('0xa')]),'subClient':new Redis(config[_0x6e9a('0xa')])}));require(_0x6e9a('0xe'))[_0x6e9a('0xf')]();require(_0x6e9a('0x10'))['default'](socketio);require(_0x6e9a('0x11'))['default'](app);require(_0x6e9a('0x12'))[_0x6e9a('0xf')](app);}else{server[_0x6e9a('0x13')](_0x6e9a('0x14'),function(){console[_0x6e9a('0x15')](_0x6e9a('0x16'),config['port']);});}exports=module[_0x6e9a('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index e57e177..2d97552 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x18fd=['debug','error','rpc','message','catch','bluebird','../../config/logger','routing','http','Request','request'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x18fd,0x1f4));var _0xd18f=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x18fd[_0xd1d19a];return _0x52a79d;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xd18f('0x0'));var logger=require(_0xd18f('0x1'))(_0xd18f('0x2'));var client=jayson['client'][_0xd18f('0x3')]({'port':0x2329});client[_0xd18f('0x4')]=function(_0x767ec5,_0x42cbf1){return new BPromise(function(_0x3fec7f,_0x303ca3){return client[_0xd18f('0x5')](_0x767ec5,_0x42cbf1)['then'](function(_0x2195e9){logger[_0xd18f('0x6')]('rpc',_0xd18f('0x2'),_0x767ec5,_0x42cbf1,_0x2195e9);if(_0x2195e9[_0xd18f('0x7')]){logger[_0xd18f('0x7')](_0xd18f('0x8'),_0xd18f('0x2'),_0x767ec5,_0x2195e9[_0xd18f('0x7')][_0xd18f('0x9')],_0x42cbf1);return _0x303ca3(_0x2195e9[_0xd18f('0x7')][_0xd18f('0x9')]);}else{return _0x3fec7f(_0x2195e9['result']);}})[_0xd18f('0xa')](function(_0x3e8258){logger['error'](_0xd18f('0x8'),_0xd18f('0x2'),_0x767ec5,_0x3e8258,_0x42cbf1);return _0x303ca3(_0x3e8258);});});};module['exports']=client; \ No newline at end of file +var _0x3e1a=['catch','exports','jayson/promise','../../config/logger','routing','client','http','Request','request','then','debug','rpc','error','message','result'];(function(_0x10e5bf,_0xffa569){var _0x675420=function(_0x4d58ef){while(--_0x4d58ef){_0x10e5bf['push'](_0x10e5bf['shift']());}};_0x675420(++_0xffa569);}(_0x3e1a,0x6b));var _0xa3e1=function(_0x30d1c0,_0x3941a1){_0x30d1c0=_0x30d1c0-0x0;var _0x5268af=_0x3e1a[_0x30d1c0];return _0x5268af;};'use strict';var jayson=require(_0xa3e1('0x0'));var BPromise=require('bluebird');var logger=require(_0xa3e1('0x1'))(_0xa3e1('0x2'));var client=jayson[_0xa3e1('0x3')][_0xa3e1('0x4')]({'port':0x2329});client[_0xa3e1('0x5')]=function(_0x190ef1,_0x4f7dc1){return new BPromise(function(_0x2c09ea,_0x342580){return client[_0xa3e1('0x6')](_0x190ef1,_0x4f7dc1)[_0xa3e1('0x7')](function(_0x2449de){logger[_0xa3e1('0x8')](_0xa3e1('0x9'),_0xa3e1('0x2'),_0x190ef1,_0x4f7dc1,_0x2449de);if(_0x2449de[_0xa3e1('0xa')]){logger[_0xa3e1('0xa')](_0xa3e1('0x9'),_0xa3e1('0x2'),_0x190ef1,_0x2449de[_0xa3e1('0xa')][_0xa3e1('0xb')],_0x4f7dc1);return _0x342580(_0x2449de[_0xa3e1('0xa')]['message']);}else{return _0x2c09ea(_0x2449de[_0xa3e1('0xc')]);}})[_0xa3e1('0xd')](function(_0x389403){logger[_0xa3e1('0xa')](_0xa3e1('0x9'),_0xa3e1('0x2'),_0x190ef1,_0x389403,_0x4f7dc1);return _0x342580(_0x389403);});});};module[_0xa3e1('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 7125fc2..04854d8 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfbf4=['getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initFaxQueues','initWhatsappQueues','listen','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getIntervals','getOpenchannelQueues','initOpenchannelQueues'];(function(_0x18055c,_0x26e917){var _0x44c418=function(_0x1c5421){while(--_0x1c5421){_0x18055c['push'](_0x18055c['shift']());}};_0x44c418(++_0x26e917);}(_0xfbf4,0x111));var _0x4fbf=function(_0x41ec81,_0x214c81){_0x41ec81=_0x41ec81-0x0;var _0x1a71ab=_0xfbf4[_0x41ec81];return _0x1a71ab;};'use strict';var BPromise=require(_0x4fbf('0x0'));var server=require(_0x4fbf('0x1'));var Realtime=require(_0x4fbf('0x2'));var user=require(_0x4fbf('0x3'));var interval=require(_0x4fbf('0x4'));var openchannelQueue=require(_0x4fbf('0x5'));var chatQueue=require(_0x4fbf('0x6'));var smsQueue=require(_0x4fbf('0x7'));var mailQueue=require(_0x4fbf('0x8'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x4fbf('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x4fbf('0xa')]()[_0x4fbf('0xb')](user['getAgents']())[_0x4fbf('0xb')](realtime['initAgents']())[_0x4fbf('0xb')](interval[_0x4fbf('0xc')]())[_0x4fbf('0xb')](realtime['initIntervals']())[_0x4fbf('0xb')](openchannelQueue[_0x4fbf('0xd')]())['then'](realtime[_0x4fbf('0xe')]())[_0x4fbf('0xb')](chatQueue[_0x4fbf('0xf')]())[_0x4fbf('0xb')](realtime[_0x4fbf('0x10')]())[_0x4fbf('0xb')](smsQueue[_0x4fbf('0x11')]())[_0x4fbf('0xb')](realtime[_0x4fbf('0x12')]())[_0x4fbf('0xb')](mailQueue[_0x4fbf('0x13')]())[_0x4fbf('0xb')](realtime['initMailQueues']())['then'](faxQueue['getFaxQueues']())[_0x4fbf('0xb')](realtime[_0x4fbf('0x14')]())['then'](whatsappQueue['getWhatsappQueues']())[_0x4fbf('0xb')](realtime[_0x4fbf('0x15')]())[_0x4fbf('0xb')](function(){return realtime;});}function main(){return server[_0x4fbf('0x16')](realtime)[_0x4fbf('0xb')](function(_0x324bff){return initRealtime();})['then'](function(_0x552019){return setInterval(initRealtime,0x1388);})['catch'](function(_0x6032c0){console[_0x4fbf('0x17')](_0x6032c0);});}main(); \ No newline at end of file +var _0xea32=['initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues'];(function(_0x55decc,_0x112aa4){var _0x10ec8a=function(_0x4b50c2){while(--_0x4b50c2){_0x55decc['push'](_0x55decc['shift']());}};_0x10ec8a(++_0x112aa4);}(_0xea32,0x19c));var _0x2ea3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xea32[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x2ea3('0x0'));var server=require(_0x2ea3('0x1'));var Realtime=require(_0x2ea3('0x2'));var user=require(_0x2ea3('0x3'));var interval=require(_0x2ea3('0x4'));var openchannelQueue=require(_0x2ea3('0x5'));var chatQueue=require(_0x2ea3('0x6'));var smsQueue=require(_0x2ea3('0x7'));var mailQueue=require(_0x2ea3('0x8'));var faxQueue=require(_0x2ea3('0x9'));var whatsappQueue=require(_0x2ea3('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x2ea3('0xb')]()['then'](user[_0x2ea3('0xc')]())[_0x2ea3('0xd')](realtime[_0x2ea3('0xe')]())['then'](interval[_0x2ea3('0xf')]())[_0x2ea3('0xd')](realtime[_0x2ea3('0x10')]())[_0x2ea3('0xd')](openchannelQueue[_0x2ea3('0x11')]())[_0x2ea3('0xd')](realtime[_0x2ea3('0x12')]())[_0x2ea3('0xd')](chatQueue[_0x2ea3('0x13')]())[_0x2ea3('0xd')](realtime[_0x2ea3('0x14')]())['then'](smsQueue[_0x2ea3('0x15')]())[_0x2ea3('0xd')](realtime['initSmsQueues']())[_0x2ea3('0xd')](mailQueue[_0x2ea3('0x16')]())[_0x2ea3('0xd')](realtime[_0x2ea3('0x17')]())[_0x2ea3('0xd')](faxQueue[_0x2ea3('0x18')]())[_0x2ea3('0xd')](realtime[_0x2ea3('0x19')]())[_0x2ea3('0xd')](whatsappQueue['getWhatsappQueues']())[_0x2ea3('0xd')](realtime[_0x2ea3('0x1a')]())[_0x2ea3('0xd')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x2ea3('0xd')](function(_0x590950){return initRealtime();})['then'](function(_0x2b93da){return setInterval(initRealtime,0x1388);})[_0x2ea3('0x1b')](function(_0x81d63a){console[_0x2ea3('0x1c')](_0x81d63a);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index 130d627..770da70 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x409237,_0xe36701){var _0x2b3e72=function(_0x9c719f){while(--_0x9c719f){_0x409237['push'](_0x409237['shift']());}};_0x2b3e72(++_0xe36701);}(_0x5fc3,0xa8));var _0x35fc=function(_0x511b76,_0x4727fa){_0x511b76=_0x511b76-0x0;var _0x5424ff=_0x5fc3[_0x511b76];return _0x5424ff;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file +var _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x2ef60e,_0x35c32c){var _0x3be207=function(_0x25377d){while(--_0x25377d){_0x2ef60e['push'](_0x2ef60e['shift']());}};_0x3be207(++_0x35c32c);}(_0x814b,0x1a2));var _0xb814=function(_0x15fc3c,_0x35665b){_0x15fc3c=_0x15fc3c-0x0;var _0x94c5c8=_0x814b[_0x15fc3c];return _0x94c5c8;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 6a0b228..77ffcdb 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa2d7=['bluebird','jayson/promise','client','http','request','then','error','message','catch','sendMailMessage'];(function(_0xcbace3,_0x4ae461){var _0x37f93e=function(_0x2b13e6){while(--_0x2b13e6){_0xcbace3['push'](_0xcbace3['shift']());}};_0x37f93e(++_0x4ae461);}(_0xa2d7,0x1a4));var _0x7a2d=function(_0x4a7a95,_0x19ae9f){_0x4a7a95=_0x4a7a95-0x0;var _0x480b47=_0xa2d7[_0x4a7a95];return _0x480b47;};'use strict';var BPromise=require(_0x7a2d('0x0'));var jayson=require(_0x7a2d('0x1'));var client=jayson[_0x7a2d('0x2')][_0x7a2d('0x3')]({'port':0x232b});function request(_0x23ce8f,_0x57b64d){return new BPromise(function(_0x4b3c21,_0x272599){return client[_0x7a2d('0x4')](_0x23ce8f,_0x57b64d)[_0x7a2d('0x5')](function(_0x35fd6d){if(_0x35fd6d[_0x7a2d('0x6')]){return _0x272599(_0x35fd6d['error'][_0x7a2d('0x7')]);}else{return _0x4b3c21(_0x35fd6d['result']);}})[_0x7a2d('0x8')](function(_0x492eb8){return _0x272599(_0x492eb8);});});}exports[_0x7a2d('0x9')]=function(_0x5c2b35,_0x343189){return request('SendMail',{'account':_0x5c2b35,'message':_0x343189});}; \ No newline at end of file +var _0xea4c=['sendMailMessage','SendMail','client','request','then','result','catch'];(function(_0x57e278,_0xc85ade){var _0x5598e4=function(_0x3665a0){while(--_0x3665a0){_0x57e278['push'](_0x57e278['shift']());}};_0x5598e4(++_0xc85ade);}(_0xea4c,0x80));var _0xcea4=function(_0x40fbd7,_0x2035c0){_0x40fbd7=_0x40fbd7-0x0;var _0x112085=_0xea4c[_0x40fbd7];return _0x112085;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0xcea4('0x0')]['http']({'port':0x232b});function request(_0x6ca763,_0x194fc8){return new BPromise(function(_0x179b22,_0x26771b){return client[_0xcea4('0x1')](_0x6ca763,_0x194fc8)[_0xcea4('0x2')](function(_0x1ab82d){if(_0x1ab82d['error']){return _0x26771b(_0x1ab82d['error']['message']);}else{return _0x179b22(_0x1ab82d[_0xcea4('0x3')]);}})[_0xcea4('0x4')](function(_0x39ee40){return _0x26771b(_0x39ee40);});});}exports[_0xcea4('0x5')]=function(_0x12e305,_0x36ef35){return request(_0xcea4('0x6'),{'account':_0x12e305,'message':_0x36ef35});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 14a4309..271706e 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fdc=['sms','whatsapp','length','Status','StatusTime','toNumber','voicePause','faxPause','chatCurrentCapacity','faxStatusTime','smsStatusTime','smsCurrentCapacity','busyQueue','openchannelWaitingInteractions','smsWaitingInteractions','stringify','emit','omit','exports','lodash','md5','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','chatPause','mailPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','openchannel','fax'];(function(_0x4f0102,_0x402640){var _0x307654=function(_0x24268f){while(--_0x24268f){_0x4f0102['push'](_0x4f0102['shift']());}};_0x307654(++_0x402640);}(_0x5fdc,0x127));var _0xc5fd=function(_0x10a819,_0x27fe14){_0x10a819=_0x10a819-0x0;var _0x4294a7=_0x5fdc[_0x10a819];return _0x4294a7;};'use strict';var _=require(_0xc5fd('0x0'));var md5=require(_0xc5fd('0x1'));var moment=require(_0xc5fd('0x2'));var Redis=require(_0xc5fd('0x3'));var config=require(_0xc5fd('0x4'));config[_0xc5fd('0x5')]=_[_0xc5fd('0x6')](config[_0xc5fd('0x5')],{'host':_0xc5fd('0x7'),'port':0x18eb});var io=require(_0xc5fd('0x8'))(new Redis(config[_0xc5fd('0x5')]));function Agent(_0xea5748){this['id']=_0xea5748['id']||0x0;this[_0xc5fd('0x9')]=_0xea5748[_0xc5fd('0x9')]||'';this[_0xc5fd('0xa')]=_0xea5748['online']||!![];this['voicePause']=_0xea5748['voicePause']||![];this[_0xc5fd('0xb')]=_0xea5748[_0xc5fd('0xb')]||![];this[_0xc5fd('0xc')]=_0xea5748[_0xc5fd('0xc')]||![];this['faxPause']=_0xea5748['faxPause']||![];this[_0xc5fd('0xd')]=_0xea5748[_0xc5fd('0xd')]||![];this[_0xc5fd('0xe')]=_0xea5748[_0xc5fd('0xe')]||![];this[_0xc5fd('0xf')]=_0xc5fd('0x10');this['chatStatusTime']=0x0;this[_0xc5fd('0x11')]=_0xea5748['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0xc5fd('0x12')]=_0xc5fd('0x10');this[_0xc5fd('0x13')]=0x0;this[_0xc5fd('0x14')]=_0xea5748[_0xc5fd('0x14')]||0x0;this[_0xc5fd('0x15')]=0x0;this[_0xc5fd('0x16')]=_0xc5fd('0x10');this['faxStatusTime']=0x0;this[_0xc5fd('0x17')]=_0xea5748[_0xc5fd('0x17')]||0x0;this[_0xc5fd('0x18')]=0x0;this[_0xc5fd('0x19')]='unknown';this['smsStatusTime']=0x0;this['smsCapacity']=_0xea5748['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0xc5fd('0x1a')]=_0xc5fd('0x10');this[_0xc5fd('0x1b')]=0x0;this[_0xc5fd('0x1c')]=_0xea5748[_0xc5fd('0x1c')]||0x0;this[_0xc5fd('0x1d')]=0x0;this[_0xc5fd('0x1e')]='unknown';this[_0xc5fd('0x1f')]=0x0;this[_0xc5fd('0x20')]=_0xea5748[_0xc5fd('0x20')]||0x0;this[_0xc5fd('0x21')]=0x0;this[_0xc5fd('0x22')]=![];this['busyQueue']=undefined;this[_0xc5fd('0x1')]='';this[_0xc5fd('0x23')]={};this[_0xc5fd('0x24')]={};this[_0xc5fd('0x25')]={};this['openchannelWaitingInteractions']={};this['smsWaitingInteractions']={};this[_0xc5fd('0x26')]={};this[_0xc5fd('0x27')]();}Agent[_0xc5fd('0x28')][_0xc5fd('0x29')]=function(_0x334401){if(this[_0x334401+_0xc5fd('0x2a')]>0x0){if(this[_0x334401+'Capacity']>0x0&&this[_0x334401+_0xc5fd('0x2a')]>=this[_0x334401+_0xc5fd('0x2b')]){return _0xc5fd('0x2c');}else{return _0xc5fd('0x2d');}}else{return _0xc5fd('0x2e');}};Agent[_0xc5fd('0x28')][_0xc5fd('0x27')]=function(){var _0x527018=[_0xc5fd('0x2f'),'chat',_0xc5fd('0x30'),_0xc5fd('0x31'),_0xc5fd('0x32'),_0xc5fd('0x33')];for(var _0x5cafd3=0x0;_0x5cafd3<_0x527018[_0xc5fd('0x34')];_0x5cafd3+=0x1){var _0x1bbdc4=this[_0xc5fd('0x29')](_0x527018[_0x5cafd3]);if(this[_0x527018[_0x5cafd3]+_0xc5fd('0x35')]!==_0x1bbdc4){this[_0x527018[_0x5cafd3]+_0xc5fd('0x36')]=_[_0xc5fd('0x37')](moment()['format']('x'));}this[_0x527018[_0x5cafd3]+_0xc5fd('0x35')]=_0x1bbdc4;}var _0x5d4f70={'id':this['id'],'name':this['name'],'online':this[_0xc5fd('0xa')],'voicePause':this[_0xc5fd('0x38')],'chatPause':this[_0xc5fd('0xb')],'mailPause':this[_0xc5fd('0xc')],'smsPause':this[_0xc5fd('0xd')],'faxPause':this[_0xc5fd('0x39')],'openchannelPause':this[_0xc5fd('0xe')],'chatStatus':this[_0xc5fd('0xf')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xc5fd('0x11')],'chatCurrentCapacity':this[_0xc5fd('0x3a')],'mailStatus':this[_0xc5fd('0x12')],'mailStatusTime':this[_0xc5fd('0x13')],'mailCapacity':this[_0xc5fd('0x14')],'mailCurrentCapacity':this[_0xc5fd('0x15')],'faxStatus':this[_0xc5fd('0x16')],'faxStatusTime':this[_0xc5fd('0x3b')],'faxCapacity':this[_0xc5fd('0x17')],'faxCurrentCapacity':this[_0xc5fd('0x18')],'smsStatus':this[_0xc5fd('0x19')],'smsStatusTime':this[_0xc5fd('0x3c')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xc5fd('0x3d')],'whatsappStatus':this[_0xc5fd('0x1a')],'whatsappStatusTime':this[_0xc5fd('0x1b')],'whatsappCapacity':this[_0xc5fd('0x1c')],'whatsappCurrentCapacity':this[_0xc5fd('0x1d')],'openchannelStatus':this[_0xc5fd('0x1e')],'openchannelStatusTime':this[_0xc5fd('0x1f')],'openchannelCapacity':this[_0xc5fd('0x20')],'openchannelCurrentCapacity':this[_0xc5fd('0x21')],'busy':this['busy'],'busyQueue':this[_0xc5fd('0x3e')],'chatWaitingInteractions':this[_0xc5fd('0x23')],'faxWaitingInteractions':this[_0xc5fd('0x24')],'mailWaitingInteractions':this[_0xc5fd('0x25')],'openchannelWaitingInteractions':this[_0xc5fd('0x3f')],'smsWaitingInteractions':this[_0xc5fd('0x40')],'whatsappWaitingInteractions':this[_0xc5fd('0x26')]};var _0x50f1bf=md5(JSON[_0xc5fd('0x41')](_0x5d4f70));if(this[_0xc5fd('0x1')]!==_0x50f1bf){this['md5']=_0x50f1bf;io[_0xc5fd('0x42')]('user:routing:update',_[_0xc5fd('0x43')](_0x5d4f70,[_0xc5fd('0xa')]));}};module[_0xc5fd('0x44')]=Agent; \ No newline at end of file +var _0xc2c7=['chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','Capacity','maxcapacity','working','mail','chat','openchannel','fax','sms','length','getChannelStatus','Status','StatusTime','toNumber','format','online','mailCurrentCapacity','faxStatus','smsCurrentCapacity','busy','chatWaitingInteractions','exports','md5','moment','ioredis','../../../config/environment','redis','defaults','localhost','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime'];(function(_0x4ebbf4,_0x549430){var _0x290bbe=function(_0x240cac){while(--_0x240cac){_0x4ebbf4['push'](_0x4ebbf4['shift']());}};_0x290bbe(++_0x549430);}(_0xc2c7,0x134));var _0x7c2c=function(_0x442a55,_0x4a7286){_0x442a55=_0x442a55-0x0;var _0x1fe3d5=_0xc2c7[_0x442a55];return _0x1fe3d5;};'use strict';var _=require('lodash');var md5=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var Redis=require(_0x7c2c('0x2'));var config=require(_0x7c2c('0x3'));config[_0x7c2c('0x4')]=_[_0x7c2c('0x5')](config[_0x7c2c('0x4')],{'host':_0x7c2c('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x31dc4e){this['id']=_0x31dc4e['id']||0x0;this[_0x7c2c('0x7')]=_0x31dc4e[_0x7c2c('0x7')]||'';this['online']=_0x31dc4e['online']||!![];this['voicePause']=_0x31dc4e[_0x7c2c('0x8')]||![];this[_0x7c2c('0x9')]=_0x31dc4e[_0x7c2c('0x9')]||![];this[_0x7c2c('0xa')]=_0x31dc4e[_0x7c2c('0xa')]||![];this['faxPause']=_0x31dc4e[_0x7c2c('0xb')]||![];this[_0x7c2c('0xc')]=_0x31dc4e[_0x7c2c('0xc')]||![];this[_0x7c2c('0xd')]=_0x31dc4e[_0x7c2c('0xd')]||![];this[_0x7c2c('0xe')]=_0x7c2c('0xf');this[_0x7c2c('0x10')]=0x0;this[_0x7c2c('0x11')]=_0x31dc4e[_0x7c2c('0x11')]||0x0;this[_0x7c2c('0x12')]=0x0;this[_0x7c2c('0x13')]=_0x7c2c('0xf');this[_0x7c2c('0x14')]=0x0;this[_0x7c2c('0x15')]=_0x31dc4e[_0x7c2c('0x15')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0x7c2c('0xf');this[_0x7c2c('0x16')]=0x0;this[_0x7c2c('0x17')]=_0x31dc4e['faxCapacity']||0x0;this[_0x7c2c('0x18')]=0x0;this[_0x7c2c('0x19')]='unknown';this[_0x7c2c('0x1a')]=0x0;this['smsCapacity']=_0x31dc4e[_0x7c2c('0x1b')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x7c2c('0x1c')]=_0x7c2c('0xf');this[_0x7c2c('0x1d')]=0x0;this[_0x7c2c('0x1e')]=_0x31dc4e[_0x7c2c('0x1e')]||0x0;this[_0x7c2c('0x1f')]=0x0;this[_0x7c2c('0x20')]=_0x7c2c('0xf');this[_0x7c2c('0x21')]=0x0;this[_0x7c2c('0x22')]=_0x31dc4e[_0x7c2c('0x22')]||0x0;this[_0x7c2c('0x23')]=0x0;this['busy']=![];this[_0x7c2c('0x24')]=undefined;this['md5']='';this['chatWaitingInteractions']={};this[_0x7c2c('0x25')]={};this[_0x7c2c('0x26')]={};this[_0x7c2c('0x27')]={};this[_0x7c2c('0x28')]={};this[_0x7c2c('0x29')]={};this[_0x7c2c('0x2a')]();}Agent[_0x7c2c('0x2b')]['getChannelStatus']=function(_0x10c356){if(this[_0x10c356+'CurrentCapacity']>0x0){if(this[_0x10c356+_0x7c2c('0x2c')]>0x0&&this[_0x10c356+'CurrentCapacity']>=this[_0x10c356+_0x7c2c('0x2c')]){return _0x7c2c('0x2d');}else{return _0x7c2c('0x2e');}}else{return'idle';}};Agent['prototype'][_0x7c2c('0x2a')]=function(){var _0x30c53e=[_0x7c2c('0x2f'),_0x7c2c('0x30'),_0x7c2c('0x31'),_0x7c2c('0x32'),_0x7c2c('0x33'),'whatsapp'];for(var _0x358c67=0x0;_0x358c67<_0x30c53e[_0x7c2c('0x34')];_0x358c67+=0x1){var _0x3b2652=this[_0x7c2c('0x35')](_0x30c53e[_0x358c67]);if(this[_0x30c53e[_0x358c67]+_0x7c2c('0x36')]!==_0x3b2652){this[_0x30c53e[_0x358c67]+_0x7c2c('0x37')]=_[_0x7c2c('0x38')](moment()[_0x7c2c('0x39')]('x'));}this[_0x30c53e[_0x358c67]+_0x7c2c('0x36')]=_0x3b2652;}var _0x5769ec={'id':this['id'],'name':this[_0x7c2c('0x7')],'online':this[_0x7c2c('0x3a')],'voicePause':this[_0x7c2c('0x8')],'chatPause':this[_0x7c2c('0x9')],'mailPause':this['mailPause'],'smsPause':this[_0x7c2c('0xc')],'faxPause':this[_0x7c2c('0xb')],'openchannelPause':this[_0x7c2c('0xd')],'chatStatus':this[_0x7c2c('0xe')],'chatStatusTime':this[_0x7c2c('0x10')],'chatCapacity':this[_0x7c2c('0x11')],'chatCurrentCapacity':this[_0x7c2c('0x12')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x7c2c('0x14')],'mailCapacity':this[_0x7c2c('0x15')],'mailCurrentCapacity':this[_0x7c2c('0x3b')],'faxStatus':this[_0x7c2c('0x3c')],'faxStatusTime':this[_0x7c2c('0x16')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x7c2c('0x19')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x7c2c('0x3d')],'whatsappStatus':this[_0x7c2c('0x1c')],'whatsappStatusTime':this[_0x7c2c('0x1d')],'whatsappCapacity':this[_0x7c2c('0x1e')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x7c2c('0x20')],'openchannelStatusTime':this[_0x7c2c('0x21')],'openchannelCapacity':this[_0x7c2c('0x22')],'openchannelCurrentCapacity':this[_0x7c2c('0x23')],'busy':this[_0x7c2c('0x3e')],'busyQueue':this[_0x7c2c('0x24')],'chatWaitingInteractions':this[_0x7c2c('0x3f')],'faxWaitingInteractions':this[_0x7c2c('0x25')],'mailWaitingInteractions':this[_0x7c2c('0x26')],'openchannelWaitingInteractions':this[_0x7c2c('0x27')],'smsWaitingInteractions':this[_0x7c2c('0x28')],'whatsappWaitingInteractions':this[_0x7c2c('0x29')]};var _0x2b6a7d=md5(JSON['stringify'](_0x5769ec));if(this['md5']!==_0x2b6a7d){this[_0x7c2c('0x0')]=_0x2b6a7d;io['emit']('user:routing:update',_['omit'](_0x5769ec,[_0x7c2c('0x3a')]));}};module[_0x7c2c('0x40')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 1ea8777..52fb634 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 _0x703f=['md5','updateRouting','_rr','map','loggedIn','length','chatPause','paused','available','stringify','format','chat:queue:%s','chat_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x47e4c2,_0x2544d2){var _0x15b451=function(_0x266867){while(--_0x266867){_0x47e4c2['push'](_0x47e4c2['shift']());}};_0x15b451(++_0x2544d2);}(_0x703f,0x196));var _0xf703=function(_0x1d4fbc,_0xc8ee19){_0x1d4fbc=_0x1d4fbc-0x0;var _0x2a9b95=_0x703f[_0x1d4fbc];return _0x2a9b95;};'use strict';var _=require(_0xf703('0x0'));var md5=require('md5');var util=require(_0xf703('0x1'));var Redis=require(_0xf703('0x2'));var config=require(_0xf703('0x3'));config[_0xf703('0x4')]=_[_0xf703('0x5')](config[_0xf703('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xf703('0x6'))(new Redis(config[_0xf703('0x4')]));function ChatQueue(_0xadca2){this['id']=_0xadca2['id']||0x0;this[_0xf703('0x7')]=_0xadca2[_0xf703('0x7')]||'';this[_0xf703('0x8')]=_0xadca2[_0xf703('0x8')]||0xa;this[_0xf703('0x9')]=_0xadca2[_0xf703('0x9')]||_0xf703('0xa');this[_0xf703('0xb')]=_0xadca2[_0xf703('0xb')];this[_0xf703('0xc')]={};this[_0xf703('0xd')]=0x0;this[_0xf703('0xe')]='';this[_0xf703('0xf')]();this['updateRealtime']();}ChatQueue['prototype']['updateRouting']=function(){var _0x129a21=this[_0xf703('0xc')][_0xf703('0x10')];this[_0xf703('0xc')]=_[_0xf703('0x11')](this[_0xf703('0xb')],'id');this[_0xf703('0xc')][_0xf703('0x10')]=_0x129a21;};ChatQueue['prototype']['updateRealtime']=function(){this[_0xf703('0x12')]=0x0;this['paused']=0x0;for(var _0x27e5cc=0x0;_0x27e5cc=0x0?this['available']:0x0;var _0x2e0bbd={'id':this['id'],'available':this[_0xf703('0x16')],'loggedIn':this[_0xf703('0x12')],'name':this[_0xf703('0x7')],'paused':this['paused'],'waiting':this[_0xf703('0xd')]};var _0x33e6f8=md5(JSON[_0xf703('0x17')](_0x2e0bbd));if(this[_0xf703('0xe')]!==_0x33e6f8){this['md5']=_0x33e6f8;io['to'](util[_0xf703('0x18')](_0xf703('0x19'),_0x2e0bbd[_0xf703('0x7')]))['emit'](_0xf703('0x1a'),_0x2e0bbd);}};module[_0xf703('0x1b')]=ChatQueue; \ No newline at end of file +var _0x666a=['format','chat:queue:%s','emit','chat_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','available','stringify'];(function(_0x1939bf,_0x3ebd03){var _0x4f1ec7=function(_0x15bd6c){while(--_0x15bd6c){_0x1939bf['push'](_0x1939bf['shift']());}};_0x4f1ec7(++_0x3ebd03);}(_0x666a,0x100));var _0xa666=function(_0x5ebdce,_0x5e102e){_0x5ebdce=_0x5ebdce-0x0;var _0x1264b1=_0x666a[_0x5ebdce];return _0x1264b1;};'use strict';var _=require(_0xa666('0x0'));var md5=require(_0xa666('0x1'));var util=require(_0xa666('0x2'));var Redis=require(_0xa666('0x3'));var config=require(_0xa666('0x4'));config[_0xa666('0x5')]=_['defaults'](config[_0xa666('0x5')],{'host':_0xa666('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x2ac23b){this['id']=_0x2ac23b['id']||0x0;this[_0xa666('0x7')]=_0x2ac23b[_0xa666('0x7')]||'';this[_0xa666('0x8')]=_0x2ac23b[_0xa666('0x8')]||0xa;this[_0xa666('0x9')]=_0x2ac23b['strategy']||_0xa666('0xa');this[_0xa666('0xb')]=_0x2ac23b[_0xa666('0xb')];this[_0xa666('0xc')]={};this[_0xa666('0xd')]=0x0;this[_0xa666('0x1')]='';this[_0xa666('0xe')]();this[_0xa666('0xf')]();}ChatQueue[_0xa666('0x10')]['updateRouting']=function(){var _0x24aa95=this[_0xa666('0xc')][_0xa666('0x11')];this[_0xa666('0xc')]=_['map'](this[_0xa666('0xb')],'id');this[_0xa666('0xc')][_0xa666('0x11')]=_0x24aa95;};ChatQueue[_0xa666('0x10')]['updateRealtime']=function(){this[_0xa666('0x12')]=0x0;this[_0xa666('0x13')]=0x0;for(var _0x51ef05=0x0;_0x51ef05=0x0?this['available']:0x0;var _0x5b18f4={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xa666('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x5b1402=md5(JSON[_0xa666('0x17')](_0x5b18f4));if(this['md5']!==_0x5b1402){this[_0xa666('0x1')]=_0x5b1402;io['to'](util[_0xa666('0x18')](_0xa666('0x19'),_0x5b18f4[_0xa666('0x7')]))[_0xa666('0x1a')](_0xa666('0x1b'),_0x5b18f4);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 865b870..5fda3f2 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 _0x0c16=['available','paused','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','length','online','faxPause'];(function(_0x2cdf7b,_0x5c2075){var _0x1b25f9=function(_0x5cd30d){while(--_0x5cd30d){_0x2cdf7b['push'](_0x2cdf7b['shift']());}};_0x1b25f9(++_0x5c2075);}(_0x0c16,0x164));var _0x60c1=function(_0x49fe8d,_0x44ab0f){_0x49fe8d=_0x49fe8d-0x0;var _0x23e887=_0x0c16[_0x49fe8d];return _0x23e887;};'use strict';var _=require(_0x60c1('0x0'));var md5=require(_0x60c1('0x1'));var util=require('util');var Redis=require(_0x60c1('0x2'));var config=require(_0x60c1('0x3'));config[_0x60c1('0x4')]=_[_0x60c1('0x5')](config['redis'],{'host':_0x60c1('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x902132){this['id']=_0x902132['id']||0x0;this['name']=_0x902132[_0x60c1('0x7')]||'';this[_0x60c1('0x8')]=_0x902132[_0x60c1('0x8')]||0xa;this[_0x60c1('0x9')]=_0x902132['strategy']||_0x60c1('0xa');this[_0x60c1('0xb')]=_0x902132[_0x60c1('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x60c1('0x1')]='';this[_0x60c1('0xc')]();this[_0x60c1('0xd')]();}FaxQueue[_0x60c1('0xe')]['updateRouting']=function(){var _0x41cec6=this[_0x60c1('0xf')][_0x60c1('0x10')];this['mapAgentsId']=_['map'](this[_0x60c1('0xb')],'id');this[_0x60c1('0xf')][_0x60c1('0x10')]=_0x41cec6;};FaxQueue[_0x60c1('0xe')][_0x60c1('0xd')]=function(){this[_0x60c1('0x11')]=0x0;this['paused']=0x0;for(var _0x502649=0x0;_0x502649=0x0?this[_0x60c1('0x15')]:0x0;var _0x1e8756={'id':this['id'],'available':this[_0x60c1('0x15')],'loggedIn':this[_0x60c1('0x11')],'name':this[_0x60c1('0x7')],'paused':this[_0x60c1('0x16')],'waiting':this['waiting']};var _0x43876a=md5(JSON[_0x60c1('0x17')](_0x1e8756));if(this['md5']!==_0x43876a){this[_0x60c1('0x1')]=_0x43876a;io['to'](util[_0x60c1('0x18')](_0x60c1('0x19'),_0x1e8756[_0x60c1('0x7')]))[_0x60c1('0x1a')](_0x60c1('0x1b'),_0x1e8756);}};module[_0x60c1('0x1c')]=FaxQueue; \ No newline at end of file +var _0xff2d=['Agents','waiting','md5','updateRouting','mapAgentsId','_rr','map','prototype','updateRealtime','loggedIn','paused','online','available','stringify','fax:queue:%s','emit','fax_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xff2d,0xa3));var _0xdff2=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xff2d[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0xdff2('0x0'));var md5=require('md5');var util=require(_0xdff2('0x1'));var Redis=require(_0xdff2('0x2'));var config=require(_0xdff2('0x3'));config[_0xdff2('0x4')]=_[_0xdff2('0x5')](config[_0xdff2('0x4')],{'host':_0xdff2('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdff2('0x4')]));function FaxQueue(_0x4cd7d9){this['id']=_0x4cd7d9['id']||0x0;this[_0xdff2('0x7')]=_0x4cd7d9[_0xdff2('0x7')]||'';this[_0xdff2('0x8')]=_0x4cd7d9['timeout']||0xa;this[_0xdff2('0x9')]=_0x4cd7d9[_0xdff2('0x9')]||_0xdff2('0xa');this[_0xdff2('0xb')]=_0x4cd7d9[_0xdff2('0xb')];this['mapAgentsId']={};this[_0xdff2('0xc')]=0x0;this[_0xdff2('0xd')]='';this[_0xdff2('0xe')]();this['updateRealtime']();}FaxQueue['prototype'][_0xdff2('0xe')]=function(){var _0x528717=this[_0xdff2('0xf')][_0xdff2('0x10')];this['mapAgentsId']=_[_0xdff2('0x11')](this[_0xdff2('0xb')],'id');this[_0xdff2('0xf')][_0xdff2('0x10')]=_0x528717;};FaxQueue[_0xdff2('0x12')][_0xdff2('0x13')]=function(){this[_0xdff2('0x14')]=0x0;this[_0xdff2('0x15')]=0x0;for(var _0x28dcc6=0x0;_0x28dcc6=0x0?this[_0xdff2('0x17')]:0x0;var _0x243a45={'id':this['id'],'available':this[_0xdff2('0x17')],'loggedIn':this[_0xdff2('0x14')],'name':this[_0xdff2('0x7')],'paused':this[_0xdff2('0x15')],'waiting':this[_0xdff2('0xc')]};var _0x1fb513=md5(JSON[_0xdff2('0x18')](_0x243a45));if(this[_0xdff2('0xd')]!==_0x1fb513){this[_0xdff2('0xd')]=_0x1fb513;io['to'](util['format'](_0xdff2('0x19'),_0x243a45[_0xdff2('0x7')]))[_0xdff2('0x1a')](_0xdff2('0x1b'),_0x243a45);}};module[_0xdff2('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 5ac3448..1aaa32d 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 _0x161c=['exports','name','Intervals'];(function(_0x157fa2,_0x341149){var _0x47b0cc=function(_0x2d53fc){while(--_0x2d53fc){_0x157fa2['push'](_0x157fa2['shift']());}};_0x47b0cc(++_0x341149);}(_0x161c,0xbb));var _0xc161=function(_0x1df7f4,_0x227f80){_0x1df7f4=_0x1df7f4-0x0;var _0x34705f=_0x161c[_0x1df7f4];return _0x34705f;};'use strict';function Interval(_0x3fd8a0){this['id']=_0x3fd8a0['id']||0x0;this[_0xc161('0x0')]=_0x3fd8a0[_0xc161('0x0')]||'';this['Intervals']=_0x3fd8a0[_0xc161('0x1')]||{};}module[_0xc161('0x2')]=Interval; \ No newline at end of file +var _0xbf49=['name','Intervals','exports'];(function(_0x1f0a8c,_0x1449da){var _0x47b96d=function(_0x2f7e42){while(--_0x2f7e42){_0x1f0a8c['push'](_0x1f0a8c['shift']());}};_0x47b96d(++_0x1449da);}(_0xbf49,0xd8));var _0x9bf4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf49[_0x3dd15e];return _0x231fd0;};'use strict';function Interval(_0x470d17){this['id']=_0x470d17['id']||0x0;this[_0x9bf4('0x0')]=_0x470d17[_0x9bf4('0x0')]||'';this[_0x9bf4('0x1')]=_0x470d17[_0x9bf4('0x1')]||{};}module[_0x9bf4('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 be82ff5..8d5e776 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 _0x9d81=['Agents','mapAgentsId','waiting','updateRouting','prototype','map','_rr','loggedIn','paused','length','mailPause','available','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','../../../config/environment','redis','localhost','name','timeout','strategy','beepall'];(function(_0x454480,_0x5d3795){var _0x461892=function(_0x1a5090){while(--_0x1a5090){_0x454480['push'](_0x454480['shift']());}};_0x461892(++_0x5d3795);}(_0x9d81,0x162));var _0x19d8=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x9d81[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x19d8('0x0'));var md5=require(_0x19d8('0x1'));var util=require(_0x19d8('0x2'));var Redis=require('ioredis');var config=require(_0x19d8('0x3'));config[_0x19d8('0x4')]=_['defaults'](config[_0x19d8('0x4')],{'host':_0x19d8('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x19d8('0x4')]));function MailQueue(_0x2ea0a6){this['id']=_0x2ea0a6['id']||0x0;this[_0x19d8('0x6')]=_0x2ea0a6[_0x19d8('0x6')]||'';this[_0x19d8('0x7')]=_0x2ea0a6['timeout']||0xa;this[_0x19d8('0x8')]=_0x2ea0a6[_0x19d8('0x8')]||_0x19d8('0x9');this[_0x19d8('0xa')]=_0x2ea0a6[_0x19d8('0xa')];this[_0x19d8('0xb')]={};this[_0x19d8('0xc')]=0x0;this[_0x19d8('0x1')]='';this[_0x19d8('0xd')]();this['updateRealtime']();}MailQueue[_0x19d8('0xe')][_0x19d8('0xd')]=function(){var _0x5b2bc4=this[_0x19d8('0xb')]['_rr'];this['mapAgentsId']=_[_0x19d8('0xf')](this['Agents'],'id');this[_0x19d8('0xb')][_0x19d8('0x10')]=_0x5b2bc4;};MailQueue[_0x19d8('0xe')]['updateRealtime']=function(){this[_0x19d8('0x11')]=0x0;this[_0x19d8('0x12')]=0x0;for(var _0x3a3282=0x0;_0x3a3282=0x0?this[_0x19d8('0x15')]:0x0;var _0x25feee={'id':this['id'],'available':this[_0x19d8('0x15')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x19d8('0x12')],'waiting':this['waiting']};var _0x13dd0c=md5(JSON['stringify'](_0x25feee));if(this[_0x19d8('0x1')]!==_0x13dd0c){this[_0x19d8('0x1')]=_0x13dd0c;io['to'](util['format'](_0x19d8('0x16'),_0x25feee[_0x19d8('0x6')]))[_0x19d8('0x17')](_0x19d8('0x18'),_0x25feee);}};module[_0x19d8('0x19')]=MailQueue; \ No newline at end of file +var _0x942e=['prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','available','mail:queue:%s','emit','mail_queue:save','util','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRealtime'];(function(_0x29ae80,_0x3579f1){var _0x5d6d71=function(_0xfaffe2){while(--_0xfaffe2){_0x29ae80['push'](_0x29ae80['shift']());}};_0x5d6d71(++_0x3579f1);}(_0x942e,0x15e));var _0xe942=function(_0x136d50,_0x4acf87){_0x136d50=_0x136d50-0x0;var _0x13af0e=_0x942e[_0x136d50];return _0x13af0e;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xe942('0x0'));var Redis=require(_0xe942('0x1'));var config=require(_0xe942('0x2'));config['redis']=_[_0xe942('0x3')](config[_0xe942('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xe942('0x5'))(new Redis(config[_0xe942('0x4')]));function MailQueue(_0x486277){this['id']=_0x486277['id']||0x0;this[_0xe942('0x6')]=_0x486277[_0xe942('0x6')]||'';this[_0xe942('0x7')]=_0x486277[_0xe942('0x7')]||0xa;this[_0xe942('0x8')]=_0x486277[_0xe942('0x8')]||_0xe942('0x9');this['Agents']=_0x486277[_0xe942('0xa')];this['mapAgentsId']={};this[_0xe942('0xb')]=0x0;this[_0xe942('0xc')]='';this['updateRouting']();this[_0xe942('0xd')]();}MailQueue[_0xe942('0xe')]['updateRouting']=function(){var _0x155c89=this[_0xe942('0xf')][_0xe942('0x10')];this[_0xe942('0xf')]=_[_0xe942('0x11')](this['Agents'],'id');this[_0xe942('0xf')]['_rr']=_0x155c89;};MailQueue[_0xe942('0xe')][_0xe942('0xd')]=function(){this[_0xe942('0x12')]=0x0;this[_0xe942('0x13')]=0x0;for(var _0x2cb1b8=0x0;_0x2cb1b8=0x0?this[_0xe942('0x16')]:0x0;var _0x1e2ea1={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xe942('0x6')],'paused':this['paused'],'waiting':this[_0xe942('0xb')]};var _0x3ff2e5=md5(JSON['stringify'](_0x1e2ea1));if(this[_0xe942('0xc')]!==_0x3ff2e5){this[_0xe942('0xc')]=_0x3ff2e5;io['to'](util['format'](_0xe942('0x17'),_0x1e2ea1[_0xe942('0x6')]))[_0xe942('0x18')](_0xe942('0x19'),_0x1e2ea1);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 4a7d191..e4b62eb 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 _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xc4aa[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x326f,0xd1));var _0xf326=function(_0x3dfe71,_0x4d6529){_0x3dfe71=_0x3dfe71-0x0;var _0x233faa=_0x326f[_0x3dfe71];return _0x233faa;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 570e187..a6bf456 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 _0x130d=['name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','map','_rr','length','online','smsPause','paused','available','loggedIn','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x130d,0x125));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd130('0x0'));var md5=require('md5');var util=require(_0xd130('0x1'));var Redis=require('ioredis');var config=require(_0xd130('0x2'));config[_0xd130('0x3')]=_[_0xd130('0x4')](config[_0xd130('0x3')],{'host':_0xd130('0x5'),'port':0x18eb});var io=require(_0xd130('0x6'))(new Redis(config[_0xd130('0x3')]));function SmsQueue(_0x1c314b){this['id']=_0x1c314b['id']||0x0;this[_0xd130('0x7')]=_0x1c314b[_0xd130('0x7')]||'';this[_0xd130('0x8')]=_0x1c314b[_0xd130('0x8')]||0xa;this[_0xd130('0x9')]=_0x1c314b[_0xd130('0x9')]||'beepall';this[_0xd130('0xa')]=_0x1c314b['Agents'];this[_0xd130('0xb')]={};this[_0xd130('0xc')]=0x0;this[_0xd130('0xd')]='';this['updateRouting']();this[_0xd130('0xe')]();}SmsQueue[_0xd130('0xf')]['updateRouting']=function(){var _0x587638=this[_0xd130('0xb')]['_rr'];this[_0xd130('0xb')]=_[_0xd130('0x10')](this['Agents'],'id');this[_0xd130('0xb')][_0xd130('0x11')]=_0x587638;};SmsQueue[_0xd130('0xf')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x1f56b7=0x0;_0x1f56b7=0x0?this[_0xd130('0x16')]:0x0;var _0x342eb2={'id':this['id'],'available':this[_0xd130('0x16')],'loggedIn':this[_0xd130('0x17')],'name':this[_0xd130('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x5638c3=md5(JSON[_0xd130('0x18')](_0x342eb2));if(this[_0xd130('0xd')]!==_0x5638c3){this['md5']=_0x5638c3;io['to'](util[_0xd130('0x19')](_0xd130('0x1a'),_0x342eb2[_0xd130('0x7')]))[_0xd130('0x1b')](_0xd130('0x1c'),_0x342eb2);}};module[_0xd130('0x1d')]=SmsQueue; \ No newline at end of file +var _0x9335=['strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','smsPause','paused','available','name','stringify','sms:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout'];(function(_0x8cb2f9,_0x2b8706){var _0x164887=function(_0x1812cc){while(--_0x1812cc){_0x8cb2f9['push'](_0x8cb2f9['shift']());}};_0x164887(++_0x2b8706);}(_0x9335,0xab));var _0x5933=function(_0x399c69,_0x165296){_0x399c69=_0x399c69-0x0;var _0x2ec571=_0x9335[_0x399c69];return _0x2ec571;};'use strict';var _=require(_0x5933('0x0'));var md5=require(_0x5933('0x1'));var util=require('util');var Redis=require(_0x5933('0x2'));var config=require(_0x5933('0x3'));config[_0x5933('0x4')]=_[_0x5933('0x5')](config[_0x5933('0x4')],{'host':_0x5933('0x6'),'port':0x18eb});var io=require(_0x5933('0x7'))(new Redis(config['redis']));function SmsQueue(_0x29979f){this['id']=_0x29979f['id']||0x0;this['name']=_0x29979f['name']||'';this[_0x5933('0x8')]=_0x29979f[_0x5933('0x8')]||0xa;this[_0x5933('0x9')]=_0x29979f['strategy']||_0x5933('0xa');this[_0x5933('0xb')]=_0x29979f[_0x5933('0xb')];this[_0x5933('0xc')]={};this[_0x5933('0xd')]=0x0;this[_0x5933('0x1')]='';this[_0x5933('0xe')]();this[_0x5933('0xf')]();}SmsQueue[_0x5933('0x10')][_0x5933('0xe')]=function(){var _0x27b823=this[_0x5933('0xc')][_0x5933('0x11')];this['mapAgentsId']=_[_0x5933('0x12')](this['Agents'],'id');this[_0x5933('0xc')][_0x5933('0x11')]=_0x27b823;};SmsQueue[_0x5933('0x10')]['updateRealtime']=function(){this[_0x5933('0x13')]=0x0;this['paused']=0x0;for(var _0x1ab3d0=0x0;_0x1ab3d0=0x0?this['available']:0x0;var _0x4a4d3f={'id':this['id'],'available':this[_0x5933('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x5933('0x19')],'paused':this[_0x5933('0x17')],'waiting':this[_0x5933('0xd')]};var _0x501065=md5(JSON[_0x5933('0x1a')](_0x4a4d3f));if(this[_0x5933('0x1')]!==_0x501065){this[_0x5933('0x1')]=_0x501065;io['to'](util['format'](_0x5933('0x1b'),_0x4a4d3f['name']))[_0x5933('0x1c')]('sms_queue:save',_0x4a4d3f);}};module[_0x5933('0x1d')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index add9c97..646e3f9 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 _0xe1dd=['Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','available','stringify','whatsapp:queue:%s','whatsapp_queue:save','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x9f303f,_0x130e64){var _0x1d64bd=function(_0x5b475f){while(--_0x5b475f){_0x9f303f['push'](_0x9f303f['shift']());}};_0x1d64bd(++_0x130e64);}(_0xe1dd,0x1a6));var _0xde1d=function(_0x3c6dd7,_0x25d9f2){_0x3c6dd7=_0x3c6dd7-0x0;var _0x51dea3=_0xe1dd[_0x3c6dd7];return _0x51dea3;};'use strict';var _=require('lodash');var md5=require(_0xde1d('0x0'));var util=require(_0xde1d('0x1'));var Redis=require(_0xde1d('0x2'));var config=require(_0xde1d('0x3'));config[_0xde1d('0x4')]=_['defaults'](config[_0xde1d('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xde1d('0x5'))(new Redis(config[_0xde1d('0x4')]));function WhatsappQueue(_0x2ad1b7){this['id']=_0x2ad1b7['id']||0x0;this[_0xde1d('0x6')]=_0x2ad1b7[_0xde1d('0x6')]||'';this[_0xde1d('0x7')]=_0x2ad1b7['timeout']||0xa;this[_0xde1d('0x8')]=_0x2ad1b7['strategy']||_0xde1d('0x9');this[_0xde1d('0xa')]=_0x2ad1b7[_0xde1d('0xa')];this[_0xde1d('0xb')]={};this[_0xde1d('0xc')]=0x0;this[_0xde1d('0x0')]='';this['updateRouting']();this[_0xde1d('0xd')]();}WhatsappQueue[_0xde1d('0xe')]['updateRouting']=function(){var _0x33ea05=this['mapAgentsId'][_0xde1d('0xf')];this[_0xde1d('0xb')]=_['map'](this[_0xde1d('0xa')],'id');this[_0xde1d('0xb')][_0xde1d('0xf')]=_0x33ea05;};WhatsappQueue[_0xde1d('0xe')][_0xde1d('0xd')]=function(){this[_0xde1d('0x10')]=0x0;this[_0xde1d('0x11')]=0x0;for(var _0x1cc996=0x0;_0x1cc996=0x0?this['available']:0x0;var _0x333f56={'id':this['id'],'available':this[_0xde1d('0x14')],'loggedIn':this[_0xde1d('0x10')],'name':this[_0xde1d('0x6')],'paused':this[_0xde1d('0x11')],'waiting':this[_0xde1d('0xc')]};var _0x2d5595=md5(JSON[_0xde1d('0x15')](_0x333f56));if(this[_0xde1d('0x0')]!==_0x2d5595){this[_0xde1d('0x0')]=_0x2d5595;io['to'](util['format'](_0xde1d('0x16'),_0x333f56[_0xde1d('0x6')]))['emit'](_0xde1d('0x17'),_0x333f56);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x8590=['defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRealtime','_rr','prototype','loggedIn','paused','length','online','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','ioredis','../../../config/environment'];(function(_0x30be39,_0xfb49ad){var _0x4d99d6=function(_0x1e7665){while(--_0x1e7665){_0x30be39['push'](_0x30be39['shift']());}};_0x4d99d6(++_0xfb49ad);}(_0x8590,0xde));var _0x0859=function(_0x3b0ac2,_0x16b916){_0x3b0ac2=_0x3b0ac2-0x0;var _0x505790=_0x8590[_0x3b0ac2];return _0x505790;};'use strict';var _=require('lodash');var md5=require(_0x0859('0x0'));var util=require('util');var Redis=require(_0x0859('0x1'));var config=require(_0x0859('0x2'));config['redis']=_[_0x0859('0x3')](config['redis'],{'host':_0x0859('0x4'),'port':0x18eb});var io=require(_0x0859('0x5'))(new Redis(config['redis']));function WhatsappQueue(_0x287b48){this['id']=_0x287b48['id']||0x0;this[_0x0859('0x6')]=_0x287b48[_0x0859('0x6')]||'';this[_0x0859('0x7')]=_0x287b48[_0x0859('0x7')]||0xa;this['strategy']=_0x287b48['strategy']||_0x0859('0x8');this[_0x0859('0x9')]=_0x287b48[_0x0859('0x9')];this[_0x0859('0xa')]={};this[_0x0859('0xb')]=0x0;this[_0x0859('0x0')]='';this['updateRouting']();this[_0x0859('0xc')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x3da68a=this[_0x0859('0xa')]['_rr'];this['mapAgentsId']=_['map'](this[_0x0859('0x9')],'id');this[_0x0859('0xa')][_0x0859('0xd')]=_0x3da68a;};WhatsappQueue[_0x0859('0xe')]['updateRealtime']=function(){this[_0x0859('0xf')]=0x0;this[_0x0859('0x10')]=0x0;for(var _0x47fc27=0x0;_0x47fc27=0x0?this[_0x0859('0x13')]:0x0;var _0x11cd3b={'id':this['id'],'available':this[_0x0859('0x13')],'loggedIn':this[_0x0859('0xf')],'name':this['name'],'paused':this[_0x0859('0x10')],'waiting':this[_0x0859('0xb')]};var _0x35e83e=md5(JSON[_0x0859('0x14')](_0x11cd3b));if(this[_0x0859('0x0')]!==_0x35e83e){this[_0x0859('0x0')]=_0x35e83e;io['to'](util['format'](_0x0859('0x15'),_0x11cd3b[_0x0859('0x6')]))[_0x0859('0x16')](_0x0859('0x17'),_0x11cd3b);}};module[_0x0859('0x18')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index c4b99cd..5ede22e 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x6822db,_0x25a0d3){var _0x50ef0f=function(_0x4feb72){while(--_0x4feb72){_0x6822db['push'](_0x6822db['shift']());}};_0x50ef0f(++_0x25a0d3);}(_0xb10b,0x12a));var _0xbb10=function(_0xea17a7,_0x3f7d93){_0xea17a7=_0xea17a7-0x0;var _0x247ed5=_0xb10b[_0xea17a7];return _0x247ed5;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _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(_0xea852e,_0x19f732){var _0x283afa=function(_0x176bbc){while(--_0x176bbc){_0xea852e['push'](_0xea852e['shift']());}};_0x283afa(++_0x19f732);}(_0xb10b,0x12a));var _0xbb10=function(_0x4c89cd,_0x2c57e2){_0x4c89cd=_0x4c89cd-0x0;var _0x1090d2=_0xb10b[_0x4c89cd];return _0x1090d2;};'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 bdccaf8..3ca2288 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 _0x9685=['AddTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0xfd36cc,_0x49d5e8){var _0x47bc47=function(_0x45943c){while(--_0x45943c){_0xfd36cc['push'](_0xfd36cc['shift']());}};_0x47bc47(++_0x49d5e8);}(_0x9685,0x14a));var _0x5968=function(_0x214087,_0x5128b3){_0x214087=_0x214087-0x0;var _0xeb96dd=_0x9685[_0x214087];return _0xeb96dd;};'use strict';var client=require(_0x5968('0x0'));exports[_0x5968('0x1')]=function(_0xa9bf5,_0x407355){return client[_0x5968('0x2')](_0x5968('0x3'),{'body':_0x407355,'options':{'where':{'id':_0xa9bf5}},'log':_0x5968('0x4')});};exports[_0x5968('0x5')]=function(_0x399101,_0x598ef3){return client[_0x5968('0x2')](_0x5968('0x6'),{'body':_0x598ef3,'options':{'where':{'id':_0x399101}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xd002=['update','Request','UpdateChatInteraction','addTags','addTagsToChatInteraction','../client'];(function(_0x324915,_0x5ec142){var _0x569bad=function(_0x589650){while(--_0x589650){_0x324915['push'](_0x324915['shift']());}};_0x569bad(++_0x5ec142);}(_0xd002,0x1df));var _0x2d00=function(_0xd577cd,_0x3c470f){_0xd577cd=_0xd577cd-0x0;var _0x255207=_0xd002[_0xd577cd];return _0x255207;};'use strict';var client=require(_0x2d00('0x0'));exports[_0x2d00('0x1')]=function(_0x283e55,_0x31233f){return client[_0x2d00('0x2')](_0x2d00('0x3'),{'body':_0x31233f,'options':{'where':{'id':_0x283e55}},'log':'updateChatInteraction'});};exports[_0x2d00('0x4')]=function(_0x4b9e31,_0xec3856){return client[_0x2d00('0x2')]('AddTagsToChatInteraction',{'body':_0xec3856,'options':{'where':{'id':_0x4b9e31}},'log':_0x2d00('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index e528f65..a826484 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 _0xd48f=['CreateChatMessage','createChatMessage'];(function(_0x4dabb1,_0x304306){var _0x4ab072=function(_0x2ac396){while(--_0x2ac396){_0x4dabb1['push'](_0x4dabb1['shift']());}};_0x4ab072(++_0x304306);}(_0xd48f,0x90));var _0xfd48=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xd48f[_0x11c573];return _0x6b72de;};'use strict';var client=require('../client');exports['create']=function(_0x1422bb){return client['Request'](_0xfd48('0x0'),{'body':_0x1422bb,'log':_0xfd48('0x1')});}; \ No newline at end of file +var _0xdb9c=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xdb9c,0xdb));var _0xcdb9=function(_0x14ceed,_0x1dc1fd){_0x14ceed=_0x14ceed-0x0;var _0x212673=_0xdb9c[_0x14ceed];return _0x212673;};'use strict';var client=require(_0xcdb9('0x0'));exports[_0xcdb9('0x1')]=function(_0x52d55f){return client[_0xcdb9('0x2')](_0xcdb9('0x3'),{'body':_0x52d55f,'log':_0xcdb9('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 965f275..e12cb27 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 _0xc21e=['Request','GetChatQueue','name','timeout','strategy','Agents','online','chatPause','getChatQueues'];(function(_0x2d09b2,_0x5044ca){var _0x4a9efc=function(_0x55727d){while(--_0x55727d){_0x2d09b2['push'](_0x2d09b2['shift']());}};_0x4a9efc(++_0x5044ca);}(_0xc21e,0x1ca));var _0xec21=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc21e[_0x4a9fb1];return _0x348672;};'use strict';var client=require('../client');exports[_0xec21('0x0')]=function(){return function(){return client[_0xec21('0x1')](_0xec21('0x2'),{'options':{'raw':![],'attributes':['id',_0xec21('0x3'),_0xec21('0x4'),_0xec21('0x5')],'include':[{'model':'User','as':_0xec21('0x6'),'attributes':['id',_0xec21('0x3'),_0xec21('0x7'),_0xec21('0x8')]}]},'log':_0xec21('0x0')});};}; \ No newline at end of file +var _0x165d=['strategy','Agents','../client','getChatQueues','Request','GetChatQueue','name','timeout'];(function(_0x34425b,_0x398983){var _0x292d44=function(_0x33169d){while(--_0x33169d){_0x34425b['push'](_0x34425b['shift']());}};_0x292d44(++_0x398983);}(_0x165d,0x14a));var _0xd165=function(_0xdfd3c5,_0x1902af){_0xdfd3c5=_0xdfd3c5-0x0;var _0xb7802b=_0x165d[_0xdfd3c5];return _0xb7802b;};'use strict';var client=require(_0xd165('0x0'));exports[_0xd165('0x1')]=function(){return function(){return client[_0xd165('0x2')](_0xd165('0x3'),{'options':{'raw':![],'attributes':['id',_0xd165('0x4'),_0xd165('0x5'),_0xd165('0x6')],'include':[{'model':'User','as':_0xd165('0x7'),'attributes':['id',_0xd165('0x4'),'online','chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 146bd85..925b691 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 _0x76a3=['update','UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport'];(function(_0x2b5d3e,_0x58e7e9){var _0x46a9e8=function(_0x8e4e48){while(--_0x8e4e48){_0x2b5d3e['push'](_0x2b5d3e['shift']());}};_0x46a9e8(++_0x58e7e9);}(_0x76a3,0xf8));var _0x376a=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0x76a3[_0x3e25c1];return _0x52e7f2;};'use strict';var client=require(_0x376a('0x0'));exports[_0x376a('0x1')]=function(_0x376352){return client[_0x376a('0x2')](_0x376a('0x3'),{'body':_0x376352,'log':_0x376a('0x3')});};exports[_0x376a('0x4')]=function(_0x433678,_0x8bdd7f){return client[_0x376a('0x2')]('UpdateChatQueueReport',{'body':_0x8bdd7f,'options':{'where':{'uniqueid':_0x433678},'order':[['id','DESC']],'limit':0x1},'log':_0x376a('0x5')});}; \ No newline at end of file +var _0x0434=['CreateChatQueueReport','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0x5fcb09,_0x5155bd){var _0x508f62=function(_0x318163){while(--_0x318163){_0x5fcb09['push'](_0x5fcb09['shift']());}};_0x508f62(++_0x5155bd);}(_0x0434,0x1ad));var _0x4043=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0x0434[_0x173452];return _0xee3fd0;};'use strict';var client=require(_0x4043('0x0'));exports[_0x4043('0x1')]=function(_0x4cb6b5){return client[_0x4043('0x2')](_0x4043('0x3'),{'body':_0x4cb6b5,'log':'CreateChatQueueReport'});};exports['update']=function(_0x2e6bdf,_0xfa9ae8){return client[_0x4043('0x2')](_0x4043('0x4'),{'body':_0xfa9ae8,'options':{'where':{'uniqueid':_0x2e6bdf},'order':[['id',_0x4043('0x5')]],'limit':0x1},'log':_0x4043('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 6cad9bd..443be6a 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(_0x4e90e3,_0x570a1d){var _0x295e5b=function(_0x754043){while(--_0x754043){_0x4e90e3['push'](_0x4e90e3['shift']());}};_0x295e5b(++_0x570a1d);}(_0x7a54,0x106));var _0x47a5=function(_0xc3a94c,_0xcb792){_0xc3a94c=_0xc3a94c-0x0;var _0x3fb56c=_0x7a54[_0xc3a94c];return _0x3fb56c;};'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(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x7a54,0x106));var _0x47a5=function(_0x2b102b,_0x2aad1f){_0x2b102b=_0x2b102b-0x0;var _0x3f22a8=_0x7a54[_0x2b102b];return _0x3f22a8;};'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 2fa0cb7..6bb5c20 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 _0x535c=['createFaxMessage','create'];(function(_0x1aef65,_0x521e60){var _0x4a4594=function(_0x120020){while(--_0x120020){_0x1aef65['push'](_0x1aef65['shift']());}};_0x4a4594(++_0x521e60);}(_0x535c,0x183));var _0xc535=function(_0x237aab,_0x523604){_0x237aab=_0x237aab-0x0;var _0x55b525=_0x535c[_0x237aab];return _0x55b525;};'use strict';var client=require('../client');exports[_0xc535('0x0')]=function(_0x75e2db){return client['Request']('CreateFaxMessage',{'body':_0x75e2db,'log':_0xc535('0x1')});}; \ No newline at end of file +var _0x33a8=['createFaxMessage','../client','Request','CreateFaxMessage'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x33a8,0x115));var _0x833a=function(_0x368141,_0x5a4e63){_0x368141=_0x368141-0x0;var _0x10afeb=_0x33a8[_0x368141];return _0x10afeb;};'use strict';var client=require(_0x833a('0x0'));exports['create']=function(_0x4fca5a){return client[_0x833a('0x1')](_0x833a('0x2'),{'body':_0x4fca5a,'log':_0x833a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 5a81a39..733c2f8 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 _0x3b83=['../client','getFaxQueues','Request','GetFaxQueue','strategy','Agents','name','online','faxPause'];(function(_0x55c76f,_0x13b7f4){var _0x1571ff=function(_0x4082ce){while(--_0x4082ce){_0x55c76f['push'](_0x55c76f['shift']());}};_0x1571ff(++_0x13b7f4);}(_0x3b83,0x87));var _0x33b8=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x3b83[_0x9cd4c3];return _0x4c9025;};'use strict';var client=require(_0x33b8('0x0'));exports[_0x33b8('0x1')]=function(){return function(){return client[_0x33b8('0x2')](_0x33b8('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x33b8('0x4')],'include':[{'model':'User','as':_0x33b8('0x5'),'attributes':['id',_0x33b8('0x6'),_0x33b8('0x7'),_0x33b8('0x8')]}]},'log':_0x33b8('0x1')});};}; \ No newline at end of file +var _0x8130=['getFaxQueues','Request','User','Agents','online','faxPause'];(function(_0x4586e2,_0x3a6940){var _0x2fdfd8=function(_0x4ea375){while(--_0x4ea375){_0x4586e2['push'](_0x4586e2['shift']());}};_0x2fdfd8(++_0x3a6940);}(_0x8130,0xeb));var _0x0813=function(_0x4c89f3,_0x2ca618){_0x4c89f3=_0x4c89f3-0x0;var _0x558a55=_0x8130[_0x4c89f3];return _0x558a55;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x0813('0x0')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name','timeout','strategy'],'include':[{'model':_0x0813('0x1'),'as':_0x0813('0x2'),'attributes':['id','name',_0x0813('0x3'),_0x0813('0x4')]}]},'log':_0x0813('0x5')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 1b36db6..ed7f2e1 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 _0x31dc=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x31dc,0xeb));var _0xc31d=function(_0x2b6b53,_0x50e903){_0x2b6b53=_0x2b6b53-0x0;var _0x1c1241=_0x31dc[_0x2b6b53];return _0x1c1241;};'use strict';var client=require('../client');exports[_0xc31d('0x0')]=function(_0x33288d){return client[_0xc31d('0x1')](_0xc31d('0x2'),{'body':_0x33288d,'log':_0xc31d('0x2')});};exports[_0xc31d('0x3')]=function(_0x5dc837,_0x5219ca){return client[_0xc31d('0x1')]('UpdateFaxQueueReport',{'body':_0x5219ca,'options':{'where':{'uniqueid':_0x5dc837},'order':[['id','DESC']],'limit':0x1},'log':_0xc31d('0x4')});}; \ No newline at end of file +var _0xa9e9=['../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC'];(function(_0x5d0290,_0x477acd){var _0x3581b6=function(_0x266c22){while(--_0x266c22){_0x5d0290['push'](_0x5d0290['shift']());}};_0x3581b6(++_0x477acd);}(_0xa9e9,0x118));var _0x9a9e=function(_0x4c1100,_0x11721c){_0x4c1100=_0x4c1100-0x0;var _0xd6c59e=_0xa9e9[_0x4c1100];return _0xd6c59e;};'use strict';var client=require(_0x9a9e('0x0'));exports[_0x9a9e('0x1')]=function(_0x355f11){return client[_0x9a9e('0x2')](_0x9a9e('0x3'),{'body':_0x355f11,'log':'CreateFaxQueueReport'});};exports[_0x9a9e('0x4')]=function(_0x211e9d,_0x5edc05){return client[_0x9a9e('0x2')](_0x9a9e('0x5'),{'body':_0x5edc05,'options':{'where':{'uniqueid':_0x211e9d},'order':[['id',_0x9a9e('0x6')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 2699c61..81ff4f0 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 _0x0680=['../client','getIntervals','Request','GetInterval','name','Interval','Intervals','interval'];(function(_0x5d225a,_0x2debe9){var _0x1e7761=function(_0x491dc2){while(--_0x491dc2){_0x5d225a['push'](_0x5d225a['shift']());}};_0x1e7761(++_0x2debe9);}(_0x0680,0x170));var _0x0068=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0680[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x0068('0x0'));exports[_0x0068('0x1')]=function(){return function(){return client[_0x0068('0x2')](_0x0068('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x0068('0x4')],'include':[{'model':_0x0068('0x5'),'as':_0x0068('0x6'),'attributes':['id','name',_0x0068('0x7')]}]},'log':_0x0068('0x1')});};}; \ No newline at end of file +var _0x2471=['Intervals','name','../client','getIntervals','Request','GetInterval'];(function(_0x3320f4,_0x38148a){var _0x7cadc3=function(_0x554799){while(--_0x554799){_0x3320f4['push'](_0x3320f4['shift']());}};_0x7cadc3(++_0x38148a);}(_0x2471,0xaa));var _0x1247=function(_0x197b85,_0x54bac8){_0x197b85=_0x197b85-0x0;var _0x229fcf=_0x2471[_0x197b85];return _0x229fcf;};'use strict';var client=require(_0x1247('0x0'));exports[_0x1247('0x1')]=function(){return function(){return client[_0x1247('0x2')](_0x1247('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x1247('0x4'),'attributes':['id',_0x1247('0x5'),'interval']}]},'log':_0x1247('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 8a6855c..f9e525e 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 _0xef0f=['../client','Request','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xef0f,0x168));var _0xfef0=function(_0xd562fc,_0x3b70ff){_0xd562fc=_0xd562fc-0x0;var _0xa1e4da=_0xef0f[_0xd562fc];return _0xa1e4da;};'use strict';var client=require(_0xfef0('0x0'));exports['update']=function(_0x74fc2,_0x22a6a3){return client[_0xfef0('0x1')]('UpdateMailInteraction',{'body':_0x22a6a3,'options':{'where':{'id':_0x74fc2}},'log':_0xfef0('0x2')});};exports[_0xfef0('0x3')]=function(_0x4618fb,_0x4e1af6){return client[_0xfef0('0x1')](_0xfef0('0x4'),{'body':_0x4e1af6,'options':{'where':{'id':_0x4618fb}},'log':_0xfef0('0x5')});}; \ No newline at end of file +var _0x4bd3=['../client','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x588bf2,_0xe6fb8){var _0x571db3=function(_0x4cdac8){while(--_0x4cdac8){_0x588bf2['push'](_0x588bf2['shift']());}};_0x571db3(++_0xe6fb8);}(_0x4bd3,0x174));var _0x34bd=function(_0x263929,_0x38961d){_0x263929=_0x263929-0x0;var _0x46f561=_0x4bd3[_0x263929];return _0x46f561;};'use strict';var client=require(_0x34bd('0x0'));exports['update']=function(_0x415bd3,_0x22a9f9){return client['Request']('UpdateMailInteraction',{'body':_0x22a9f9,'options':{'where':{'id':_0x415bd3}},'log':'updateMailInteraction'});};exports[_0x34bd('0x1')]=function(_0x44854a,_0x1fc8eb){return client['Request'](_0x34bd('0x2'),{'body':_0x1fc8eb,'options':{'where':{'id':_0x44854a}},'log':_0x34bd('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index d38f2ef..bac0484 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 _0x47cf=['createMailMessage','../client','create'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x47cf,0x13f));var _0xf47c=function(_0x54e914,_0x2def52){_0x54e914=_0x54e914-0x0;var _0x3d2e40=_0x47cf[_0x54e914];return _0x3d2e40;};'use strict';var client=require(_0xf47c('0x0'));exports[_0xf47c('0x1')]=function(_0x81b437){return client['Request']('CreateMailMessage',{'body':_0x81b437,'log':_0xf47c('0x2')});}; \ No newline at end of file +var _0x81d4=['Request','CreateMailMessage','../client','create'];(function(_0x3ca869,_0x2df7fe){var _0x3af4c=function(_0x4eff3c){while(--_0x4eff3c){_0x3ca869['push'](_0x3ca869['shift']());}};_0x3af4c(++_0x2df7fe);}(_0x81d4,0x72));var _0x481d=function(_0x29478a,_0x32fe56){_0x29478a=_0x29478a-0x0;var _0x2c23af=_0x81d4[_0x29478a];return _0x2c23af;};'use strict';var client=require(_0x481d('0x0'));exports[_0x481d('0x1')]=function(_0xc53b3f){return client[_0x481d('0x2')](_0x481d('0x3'),{'body':_0xc53b3f,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index e8087fb..9ce908d 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 _0xc0fb=['name','timeout','User','Agents','online','mailPause','../client','getMailQueues','Request','GetMailQueue'];(function(_0xd713e3,_0x2f14f1){var _0x1f5670=function(_0x5edf18){while(--_0x5edf18){_0xd713e3['push'](_0xd713e3['shift']());}};_0x1f5670(++_0x2f14f1);}(_0xc0fb,0xec));var _0xbc0f=function(_0x541237,_0x66f157){_0x541237=_0x541237-0x0;var _0xf886f7=_0xc0fb[_0x541237];return _0xf886f7;};'use strict';var client=require(_0xbc0f('0x0'));exports[_0xbc0f('0x1')]=function(){return function(){return client[_0xbc0f('0x2')](_0xbc0f('0x3'),{'options':{'raw':![],'attributes':['id',_0xbc0f('0x4'),_0xbc0f('0x5'),'strategy'],'include':[{'model':_0xbc0f('0x6'),'as':_0xbc0f('0x7'),'attributes':['id','name',_0xbc0f('0x8'),_0xbc0f('0x9')]}]},'log':_0xbc0f('0x1')});};}; \ No newline at end of file +var _0x5ff5=['getMailQueues','GetMailQueue','name','timeout','strategy','User','online','mailPause','../client'];(function(_0x6b07a7,_0x2546ee){var _0x1649b4=function(_0xb93d84){while(--_0xb93d84){_0x6b07a7['push'](_0x6b07a7['shift']());}};_0x1649b4(++_0x2546ee);}(_0x5ff5,0xfb));var _0x55ff=function(_0x1ef644,_0x3ccd82){_0x1ef644=_0x1ef644-0x0;var _0x13a0e3=_0x5ff5[_0x1ef644];return _0x13a0e3;};'use strict';var client=require(_0x55ff('0x0'));exports[_0x55ff('0x1')]=function(){return function(){return client['Request'](_0x55ff('0x2'),{'options':{'raw':![],'attributes':['id',_0x55ff('0x3'),_0x55ff('0x4'),_0x55ff('0x5')],'include':[{'model':_0x55ff('0x6'),'as':'Agents','attributes':['id','name',_0x55ff('0x7'),_0x55ff('0x8')]}]},'log':_0x55ff('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 24a698c..751ddb6 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 _0xdcd9=['UpdateMailQueueReport','Request','CreateMailQueueReport','update'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xdcd9,0xcd));var _0x9dcd=function(_0x485714,_0x26a87d){_0x485714=_0x485714-0x0;var _0x2b922c=_0xdcd9[_0x485714];return _0x2b922c;};'use strict';var client=require('../client');exports['create']=function(_0x5960b7){return client[_0x9dcd('0x0')](_0x9dcd('0x1'),{'body':_0x5960b7,'log':_0x9dcd('0x1')});};exports[_0x9dcd('0x2')]=function(_0x58436d,_0x130c4b){return client[_0x9dcd('0x0')](_0x9dcd('0x3'),{'body':_0x130c4b,'options':{'where':{'uniqueid':_0x58436d},'order':[['id','DESC']],'limit':0x1},'log':_0x9dcd('0x3')});}; \ No newline at end of file +var _0x8efd=['update','Request','DESC','UpdateMailQueueReport','../client','create','CreateMailQueueReport'];(function(_0x54035e,_0x291ff6){var _0x5c6202=function(_0x585ee8){while(--_0x585ee8){_0x54035e['push'](_0x54035e['shift']());}};_0x5c6202(++_0x291ff6);}(_0x8efd,0x123));var _0xd8ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8efd[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xd8ef('0x0'));exports[_0xd8ef('0x1')]=function(_0x20ac1f){return client['Request'](_0xd8ef('0x2'),{'body':_0x20ac1f,'log':_0xd8ef('0x2')});};exports[_0xd8ef('0x3')]=function(_0x49d6c9,_0x52f008){return client[_0xd8ef('0x4')]('UpdateMailQueueReport',{'body':_0x52f008,'options':{'where':{'uniqueid':_0x49d6c9},'order':[['id',_0xd8ef('0x5')]],'limit':0x1},'log':_0xd8ef('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index df454b7..38c6d1a 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 _0x71b4=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x457bc6,_0x431adc){var _0x337f06=function(_0x158788){while(--_0x158788){_0x457bc6['push'](_0x457bc6['shift']());}};_0x337f06(++_0x431adc);}(_0x71b4,0x156));var _0x471b=function(_0x5a18fc,_0xb1a4aa){_0x5a18fc=_0x5a18fc-0x0;var _0x57b441=_0x71b4[_0x5a18fc];return _0x57b441;};'use strict';var client=require(_0x471b('0x0'));exports['update']=function(_0xef2ef5,_0x135fce){return client[_0x471b('0x1')](_0x471b('0x2'),{'body':_0x135fce,'options':{'where':{'id':_0xef2ef5}},'log':_0x471b('0x3')});};exports[_0x471b('0x4')]=function(_0x25edcf,_0x93fd1a){return client[_0x471b('0x1')](_0x471b('0x5'),{'body':_0x93fd1a,'options':{'where':{'id':_0x25edcf}},'log':_0x471b('0x6')});}; \ No newline at end of file +var _0x3f2e=['addTagsToChatInteraction','../client','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction'];(function(_0x51f271,_0x3f44d2){var _0x51b2e6=function(_0x1b9585){while(--_0x1b9585){_0x51f271['push'](_0x51f271['shift']());}};_0x51b2e6(++_0x3f44d2);}(_0x3f2e,0xbe));var _0xe3f2=function(_0x504f15,_0x23a1ca){_0x504f15=_0x504f15-0x0;var _0x2a92c1=_0x3f2e[_0x504f15];return _0x2a92c1;};'use strict';var client=require(_0xe3f2('0x0'));exports['update']=function(_0x4ba54d,_0x40b12d){return client['Request'](_0xe3f2('0x1'),{'body':_0x40b12d,'options':{'where':{'id':_0x4ba54d}},'log':_0xe3f2('0x2')});};exports[_0xe3f2('0x3')]=function(_0x5341dd,_0xbe8638){return client[_0xe3f2('0x4')](_0xe3f2('0x5'),{'body':_0xbe8638,'options':{'where':{'id':_0x5341dd}},'log':_0xe3f2('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 8f4cb0b..13df46e 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 _0x252c=['../client','Request','CreateOpenchannelMessage'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0x252c,0x17d));var _0xc252=function(_0x4f5780,_0xe26c1f){_0x4f5780=_0x4f5780-0x0;var _0x1e3804=_0x252c[_0x4f5780];return _0x1e3804;};'use strict';var client=require(_0xc252('0x0'));exports['create']=function(_0x197f3d){return client[_0xc252('0x1')](_0xc252('0x2'),{'body':_0x197f3d,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0xe296=['Request','../client','create'];(function(_0x4f192e,_0x4d1756){var _0x49294d=function(_0x580ab3){while(--_0x580ab3){_0x4f192e['push'](_0x4f192e['shift']());}};_0x49294d(++_0x4d1756);}(_0xe296,0x163));var _0x6e29=function(_0x2c6120,_0x1f3e60){_0x2c6120=_0x2c6120-0x0;var _0x5fb114=_0xe296[_0x2c6120];return _0x5fb114;};'use strict';var client=require(_0x6e29('0x0'));exports[_0x6e29('0x1')]=function(_0x302933){return client[_0x6e29('0x2')]('CreateOpenchannelMessage',{'body':_0x302933,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index c3c1066..838dc48 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 _0x02d8=['name','timeout','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x02d8,0x7f));var _0x802d=function(_0x2513a7,_0x1dd94c){_0x2513a7=_0x2513a7-0x0;var _0x4cca5e=_0x02d8[_0x2513a7];return _0x4cca5e;};'use strict';var client=require(_0x802d('0x0'));exports[_0x802d('0x1')]=function(){return function(){return client['Request'](_0x802d('0x2'),{'options':{'raw':![],'attributes':['id',_0x802d('0x3'),_0x802d('0x4'),_0x802d('0x5')],'include':[{'model':_0x802d('0x6'),'as':_0x802d('0x7'),'attributes':['id','name',_0x802d('0x8'),_0x802d('0x9')]}]},'log':_0x802d('0x1')});};}; \ No newline at end of file +var _0x447e=['openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy','online'];(function(_0x53e6a4,_0x2b327e){var _0x111449=function(_0x56be5e){while(--_0x56be5e){_0x53e6a4['push'](_0x53e6a4['shift']());}};_0x111449(++_0x2b327e);}(_0x447e,0x10c));var _0xe447=function(_0x5bc613,_0x5326cf){_0x5bc613=_0x5bc613-0x0;var _0x55a924=_0x447e[_0x5bc613];return _0x55a924;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client[_0xe447('0x0')](_0xe447('0x1'),{'options':{'raw':![],'attributes':['id',_0xe447('0x2'),'timeout',_0xe447('0x3')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0xe447('0x4'),_0xe447('0x5')]}]},'log':_0xe447('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index c44a701..d8bbca4 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 _0x720c=['../client','Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x720c,0x154));var _0xc720=function(_0x30d64e,_0x2ade78){_0x30d64e=_0x30d64e-0x0;var _0x53590c=_0x720c[_0x30d64e];return _0x53590c;};'use strict';var client=require(_0xc720('0x0'));exports['create']=function(_0x389111){return client[_0xc720('0x1')](_0xc720('0x2'),{'body':_0x389111,'log':_0xc720('0x2')});};exports['update']=function(_0x3863fa,_0x2336e6){return client[_0xc720('0x1')](_0xc720('0x3'),{'body':_0x2336e6,'options':{'where':{'uniqueid':_0x3863fa},'order':[['id',_0xc720('0x4')]],'limit':0x1},'log':_0xc720('0x3')});}; \ No newline at end of file +var _0xb47c=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','Request'];(function(_0x6cc896,_0x4e0d9b){var _0x3e8aa6=function(_0x11c661){while(--_0x11c661){_0x6cc896['push'](_0x6cc896['shift']());}};_0x3e8aa6(++_0x4e0d9b);}(_0xb47c,0x1b4));var _0xcb47=function(_0x59f0dc,_0x1e2497){_0x59f0dc=_0x59f0dc-0x0;var _0x5b5445=_0xb47c[_0x59f0dc];return _0x5b5445;};'use strict';var client=require(_0xcb47('0x0'));exports['create']=function(_0xa2c9a9){return client[_0xcb47('0x1')](_0xcb47('0x2'),{'body':_0xa2c9a9,'log':_0xcb47('0x2')});};exports[_0xcb47('0x3')]=function(_0x411ec3,_0x356919){return client['Request'](_0xcb47('0x4'),{'body':_0x356919,'options':{'where':{'uniqueid':_0x411ec3},'order':[['id',_0xcb47('0x5')]],'limit':0x1},'log':_0xcb47('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 65a215f..7ef7169 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 _0x3eea=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x50e4f6,_0xbf79e9){var _0x3f7789=function(_0x258c8f){while(--_0x258c8f){_0x50e4f6['push'](_0x50e4f6['shift']());}};_0x3f7789(++_0xbf79e9);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x1e47ed,_0x38f06e){_0x1e47ed=_0x1e47ed-0x0;var _0x5d5c45=_0x3eea[_0x1e47ed];return _0x5d5c45;};'use strict';var client=require(_0xa3ee('0x0'));exports['update']=function(_0x8d10d0,_0x2abe9e){return client[_0xa3ee('0x1')](_0xa3ee('0x2'),{'body':_0x2abe9e,'options':{'where':{'id':_0x8d10d0}},'log':_0xa3ee('0x3')});};exports[_0xa3ee('0x4')]=function(_0x104913,_0x35ed7d){return client[_0xa3ee('0x1')](_0xa3ee('0x5'),{'body':_0x35ed7d,'options':{'where':{'id':_0x104913}},'log':_0xa3ee('0x6')});}; \ No newline at end of file +var _0x8ff9=['../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','addTagsToSmsInteraction'];(function(_0x4406cf,_0x4adbbc){var _0x5b02f3=function(_0x86a7ba){while(--_0x86a7ba){_0x4406cf['push'](_0x4406cf['shift']());}};_0x5b02f3(++_0x4adbbc);}(_0x8ff9,0x188));var _0x98ff=function(_0x346866,_0x45f040){_0x346866=_0x346866-0x0;var _0xc49cab=_0x8ff9[_0x346866];return _0xc49cab;};'use strict';var client=require(_0x98ff('0x0'));exports[_0x98ff('0x1')]=function(_0x3dbe95,_0x51e89c){return client[_0x98ff('0x2')](_0x98ff('0x3'),{'body':_0x51e89c,'options':{'where':{'id':_0x3dbe95}},'log':_0x98ff('0x4')});};exports[_0x98ff('0x5')]=function(_0x1619f1,_0x1448fc){return client[_0x98ff('0x2')]('AddTagsToSmsInteraction',{'body':_0x1448fc,'options':{'where':{'id':_0x1619f1}},'log':_0x98ff('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 48f7348..7725903 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 _0xa975=['create','CreateSmsMessage'];(function(_0x4164ac,_0x176fee){var _0x710f85=function(_0x1c231f){while(--_0x1c231f){_0x4164ac['push'](_0x4164ac['shift']());}};_0x710f85(++_0x176fee);}(_0xa975,0x19c));var _0x5a97=function(_0xd7e81c,_0x4da503){_0xd7e81c=_0xd7e81c-0x0;var _0x3ce6dd=_0xa975[_0xd7e81c];return _0x3ce6dd;};'use strict';var client=require('../client');exports[_0x5a97('0x0')]=function(_0x411cce){return client['Request'](_0x5a97('0x1'),{'body':_0x411cce,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x5d55=['create','Request','CreateSmsMessage'];(function(_0x46428c,_0x20ab75){var _0x16a677=function(_0x2b0817){while(--_0x2b0817){_0x46428c['push'](_0x46428c['shift']());}};_0x16a677(++_0x20ab75);}(_0x5d55,0x1a4));var _0x55d5=function(_0x3671ed,_0x5a9da8){_0x3671ed=_0x3671ed-0x0;var _0x55ee47=_0x5d55[_0x3671ed];return _0x55ee47;};'use strict';var client=require('../client');exports[_0x55d5('0x0')]=function(_0x4cd0e2){return client[_0x55d5('0x1')](_0x55d5('0x2'),{'body':_0x4cd0e2,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index a8b1a0c..b53e9ef 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 _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0xe8a19f,_0x6d5b4){var _0x58c8ed=function(_0x454e36){while(--_0x454e36){_0xe8a19f['push'](_0xe8a19f['shift']());}};_0x58c8ed(++_0x6d5b4);}(_0xe706,0xa3));var _0x6e70=function(_0x1de841,_0x278c7c){_0x1de841=_0x1de841-0x0;var _0x19bce4=_0xe706[_0x1de841];return _0x19bce4;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x4bd5e1,_0x4b4658){var _0x5e3abb=function(_0x5e2cd7){while(--_0x5e2cd7){_0x4bd5e1['push'](_0x4bd5e1['shift']());}};_0x5e3abb(++_0x4b4658);}(_0xb7e7,0x121));var _0x7b7e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xb7e7[_0x298ed3];return _0x5aad28;};'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 795c465..5304b6a 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 _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x46e574,_0x53d722){var _0x223f77=function(_0xd8df90){while(--_0xd8df90){_0x46e574['push'](_0x46e574['shift']());}};_0x223f77(++_0x53d722);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file +var _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x397446,_0x54c3c4){var _0xd98896=function(_0x2203b1){while(--_0x2203b1){_0x397446['push'](_0x397446['shift']());}};_0xd98896(++_0x54c3c4);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 591e650..aafd115 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(_0x2c4703,_0x1e9129){var _0x28d44d=function(_0x16f133){while(--_0x16f133){_0x2c4703['push'](_0x2c4703['shift']());}};_0x28d44d(++_0x1e9129);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x103232,_0x2bed77){var _0x3b4595=function(_0x1aad57){while(--_0x1aad57){_0x103232['push'](_0x103232['shift']());}};_0x3b4595(++_0x2bed77);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 24d6d92..4196315 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 _0x2d2c=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','addTags'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2d2c,0x1d7));var _0xc2d2=function(_0x41c49e,_0x4e9e2c){_0x41c49e=_0x41c49e-0x0;var _0x648a67=_0x2d2c[_0x41c49e];return _0x648a67;};'use strict';var client=require(_0xc2d2('0x0'));exports[_0xc2d2('0x1')]=function(_0x131341,_0x382b15){return client[_0xc2d2('0x2')](_0xc2d2('0x3'),{'body':_0x382b15,'options':{'where':{'id':_0x131341}},'log':'updateWhatsappInteraction'});};exports[_0xc2d2('0x4')]=function(_0x4ea94c,_0x22d836){return client[_0xc2d2('0x2')](_0xc2d2('0x5'),{'body':_0x22d836,'options':{'where':{'id':_0x4ea94c}},'log':_0xc2d2('0x6')});}; \ No newline at end of file +var _0x002d=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','Request'];(function(_0x768f02,_0x2e177f){var _0x6b845c=function(_0x1e6bb2){while(--_0x1e6bb2){_0x768f02['push'](_0x768f02['shift']());}};_0x6b845c(++_0x2e177f);}(_0x002d,0xca));var _0xd002=function(_0x2b777e,_0x219836){_0x2b777e=_0x2b777e-0x0;var _0x2bfa68=_0x002d[_0x2b777e];return _0x2bfa68;};'use strict';var client=require(_0xd002('0x0'));exports[_0xd002('0x1')]=function(_0x229c27,_0x58b453){return client['Request'](_0xd002('0x2'),{'body':_0x58b453,'options':{'where':{'id':_0x229c27}},'log':_0xd002('0x3')});};exports[_0xd002('0x4')]=function(_0x24ff42,_0x1323f0){return client[_0xd002('0x5')](_0xd002('0x6'),{'body':_0x1323f0,'options':{'where':{'id':_0x24ff42}},'log':_0xd002('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 4363407..8a2eb12 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 _0x5ffc=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x5b1c50,_0x56e694){var _0x2d379b=function(_0x981b9c){while(--_0x981b9c){_0x5b1c50['push'](_0x5b1c50['shift']());}};_0x2d379b(++_0x56e694);}(_0x5ffc,0x83));var _0xc5ff=function(_0x57c380,_0x4cdaae){_0x57c380=_0x57c380-0x0;var _0x201cbf=_0x5ffc[_0x57c380];return _0x201cbf;};'use strict';var client=require(_0xc5ff('0x0'));exports[_0xc5ff('0x1')]=function(_0x24fb5a){return client[_0xc5ff('0x2')](_0xc5ff('0x3'),{'body':_0x24fb5a,'log':_0xc5ff('0x4')});}; \ No newline at end of file +var _0x9cbe=['create','Request','createWhatsappMessage'];(function(_0x46e2c7,_0x316828){var _0x20b3b5=function(_0x223fcd){while(--_0x223fcd){_0x46e2c7['push'](_0x46e2c7['shift']());}};_0x20b3b5(++_0x316828);}(_0x9cbe,0x99));var _0xe9cb=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x9cbe[_0x40220a];return _0x3903cc;};'use strict';var client=require('../client');exports[_0xe9cb('0x0')]=function(_0x123771){return client[_0xe9cb('0x1')]('CreateWhatsappMessage',{'body':_0x123771,'log':_0xe9cb('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 113c34b..d65f244 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 _0xa2e7=['timeout','Agents','online','whatsappPause','../client','Request','GetWhatsappQueue','name'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xa2e7,0xd4));var _0x7a2e=function(_0x28c3f9,_0x2607b7){_0x28c3f9=_0x28c3f9-0x0;var _0x31cf06=_0xa2e7[_0x28c3f9];return _0x31cf06;};'use strict';var client=require(_0x7a2e('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x7a2e('0x1')](_0x7a2e('0x2'),{'options':{'raw':![],'attributes':['id',_0x7a2e('0x3'),_0x7a2e('0x4'),'strategy'],'include':[{'model':'User','as':_0x7a2e('0x5'),'attributes':['id',_0x7a2e('0x3'),_0x7a2e('0x6'),_0x7a2e('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0xad3b=['online','whatsappPause','../client','getWhatsappQueues','name','strategy','User','Agents'];(function(_0x5c7a85,_0x41dd19){var _0x35290f=function(_0x26215b){while(--_0x26215b){_0x5c7a85['push'](_0x5c7a85['shift']());}};_0x35290f(++_0x41dd19);}(_0xad3b,0x1d2));var _0xbad3=function(_0x2a8c21,_0x163576){_0x2a8c21=_0x2a8c21-0x0;var _0x5f3061=_0xad3b[_0x2a8c21];return _0x5f3061;};'use strict';var client=require(_0xbad3('0x0'));exports[_0xbad3('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xbad3('0x2'),'timeout',_0xbad3('0x3')],'include':[{'model':_0xbad3('0x4'),'as':_0xbad3('0x5'),'attributes':['id',_0xbad3('0x2'),_0xbad3('0x6'),_0xbad3('0x7')]}]},'log':_0xbad3('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 0d4e05a..133d978 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 _0x2619=['DESC','UpdateWhatsappQueueReport','Request','CreateWhatsappQueueReport'];(function(_0x5c956b,_0xa87d11){var _0xaff46a=function(_0x463d89){while(--_0x463d89){_0x5c956b['push'](_0x5c956b['shift']());}};_0xaff46a(++_0xa87d11);}(_0x2619,0x1be));var _0x9261=function(_0x232c3a,_0x894221){_0x232c3a=_0x232c3a-0x0;var _0x4fed82=_0x2619[_0x232c3a];return _0x4fed82;};'use strict';var client=require('../client');exports['create']=function(_0x34b98b){return client[_0x9261('0x0')]('CreateWhatsappQueueReport',{'body':_0x34b98b,'log':_0x9261('0x1')});};exports['update']=function(_0x5d8d37,_0x4bf9bb){return client[_0x9261('0x0')]('UpdateWhatsappQueueReport',{'body':_0x4bf9bb,'options':{'where':{'uniqueid':_0x5d8d37},'order':[['id',_0x9261('0x2')]],'limit':0x1},'log':_0x9261('0x3')});}; \ No newline at end of file +var _0xcb0c=['UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xcb0c,0x80));var _0xccb0=function(_0x241eb9,_0x5ccc3f){_0x241eb9=_0x241eb9-0x0;var _0x4f916b=_0xcb0c[_0x241eb9];return _0x4f916b;};'use strict';var client=require(_0xccb0('0x0'));exports[_0xccb0('0x1')]=function(_0x3a8571){return client[_0xccb0('0x2')](_0xccb0('0x3'),{'body':_0x3a8571,'log':_0xccb0('0x3')});};exports['update']=function(_0x5f2e95,_0x3ac62f){return client[_0xccb0('0x2')](_0xccb0('0x4'),{'body':_0x3ac62f,'options':{'where':{'uniqueid':_0x5f2e95},'order':[['id',_0xccb0('0x5')]],'limit':0x1},'log':_0xccb0('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index e1c869b..bf0cc15 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 _0xdef5=['name','toLowerCase','consequence','validate','length','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','channel','format','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','[%s][AGENT]\x20ROUTING\x20END','close','next','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]'];(function(_0x22207c,_0x4ce9f6){var _0x1ff704=function(_0x50f2f7){while(--_0x50f2f7){_0x22207c['push'](_0x22207c['shift']());}};_0x1ff704(++_0x4ce9f6);}(_0xdef5,0x8c));var _0x5def=function(_0x112d78,_0x12563a){_0x112d78=_0x112d78-0x0;var _0xf7c8c2=_0xdef5[_0x112d78];return _0xf7c8c2;};'use strict';var schema=require('validate');var _=require(_0x5def('0x0'));var util=require(_0x5def('0x1'));var seqqueue=require(_0x5def('0x2'));var logger=require(_0x5def('0x3'))(_0x5def('0x4'));var strategy=require(_0x5def('0x5'));var queue=schema({'name':{'type':_0x5def('0x6'),'required':!![],'message':_0x5def('0x7')},'timeout':{'type':_0x5def('0x8'),'message':_0x5def('0x9')}});function writeLog(_0x48fe2c,_0x400984,_0x19ce57){return logger[_0x5def('0xa')](util['format'](_0x5def('0xb'),_0x48fe2c,_0x400984[_0x5def('0xc')],_0x19ce57));}function handleFindAgent(_0x43f6fd){return function(_0x17a4f1){return _0x17a4f1[_0x5def('0xc')]['toLowerCase']()===_0x43f6fd[_0x5def('0xd')]();};}exports[_0x5def('0xe')]=function(_0x13cb84,_0x3d2069,_0x4433c0,_0x52b6c6){return function(_0x304ac9){try{var _0x298a8b={'name':_0x3d2069[0x0],'timeout':_0x3d2069[0x1]};var _0x429a33=queue[_0x5def('0xf')](_0x298a8b,{'typecast':!![]});if(_0x429a33[_0x5def('0x10')]){logger['error'](_0x5def('0x11'),_0x13cb84,_[_0x5def('0x12')](_0x429a33,_0x5def('0x13'))[_0x5def('0x14')](',\x20'));_0x304ac9[_0x5def('0x15')]();}else{var _0x7fd0f5=_[_0x5def('0x16')](_0x4433c0[_0x5def('0x17')],handleFindAgent(_0x298a8b[_0x5def('0xc')]));if(_0x7fd0f5){var _0x1a26b3=(_0x298a8b[_0x5def('0x18')]||0xa)*0x3e8;var _0x28bf24,_0x53c0b5;var _0x1a2886=seqqueue[_0x5def('0x19')](_0x1a26b3);_0x1a2886['id']=_0x13cb84;_0x1a2886['atimeout']=_0x1a26b3;_0x1a2886['channel']=_0x52b6c6[_0x5def('0x1a')];writeLog(_0x13cb84,_0x7fd0f5,util[_0x5def('0x1b')](_0x5def('0x1c'),_0x1a26b3));_0x4433c0[_0x5def('0x1d')][_0x13cb84]['on']('end',function(){logger['info'](_0x5def('0x1e'),_0x13cb84);clearTimeout(_0x53c0b5);_0x53c0b5=undefined;_0x1a2886['close']();if(_0x4433c0[_0x5def('0x1d')][_0x13cb84]){delete _0x4433c0[_0x5def('0x1d')][_0x13cb84];}_0x304ac9[_0x5def('0x15')]();});_0x4433c0[_0x5def('0x1d')][_0x13cb84]['on']('complete',function(){if(_0x4433c0['rules'][_0x13cb84]){delete _0x4433c0[_0x5def('0x1d')][_0x13cb84];}});_0x53c0b5=setTimeout(function(){logger[_0x5def('0xa')](_0x5def('0x1f'),_0x13cb84);clearTimeout(_0x53c0b5);_0x1a2886[_0x5def('0x20')]();_0x304ac9[_0x5def('0x21')]();},_0x1a26b3);strategy['agent'](_0x1a2886,_0x7fd0f5,_0x4433c0,_0x52b6c6);}else{logger[_0x5def('0x22')](_0x5def('0x23'),_0x13cb84,_0x298a8b['name']);_0x304ac9[_0x5def('0x15')]();}}}catch(_0x35607a){console[_0x5def('0x24')](_0x35607a);logger['error'](_0x5def('0x25'),_0x13cb84,_0x35607a['stack']);_0x304ac9[_0x5def('0x15')]();}};}; \ No newline at end of file +var _0x18ff=['string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','[%s][AGENT]\x20%s','map','message','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','util','../../../../config/logger','routing','./strategy'];(function(_0x127c1c,_0x5596d5){var _0x2ca5d5=function(_0x3560b9){while(--_0x3560b9){_0x127c1c['push'](_0x127c1c['shift']());}};_0x2ca5d5(++_0x5596d5);}(_0x18ff,0x113));var _0xf18f=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x18ff[_0x4baae2];return _0x1a2285;};'use strict';var schema=require(_0xf18f('0x0'));var _=require('lodash');var util=require(_0xf18f('0x1'));var seqqueue=require('seq-queue');var logger=require(_0xf18f('0x2'))(_0xf18f('0x3'));var strategy=require(_0xf18f('0x4'));var queue=schema({'name':{'type':_0xf18f('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xf18f('0x6'),'message':_0xf18f('0x7')}});function writeLog(_0x34911f,_0x3da6fd,_0x38e240){return logger[_0xf18f('0x8')](util[_0xf18f('0x9')](_0xf18f('0xa'),_0x34911f,_0x3da6fd[_0xf18f('0xb')],_0x38e240));}function handleFindAgent(_0x5e2fcc){return function(_0x1ad39a){return _0x1ad39a[_0xf18f('0xb')][_0xf18f('0xc')]()===_0x5e2fcc[_0xf18f('0xc')]();};}exports[_0xf18f('0xd')]=function(_0x2f37e2,_0x592f5f,_0x107354,_0x45beb2){return function(_0x23cb31){try{var _0x2e24c2={'name':_0x592f5f[0x0],'timeout':_0x592f5f[0x1]};var _0x3f3b07=queue[_0xf18f('0x0')](_0x2e24c2,{'typecast':!![]});if(_0x3f3b07['length']){logger['error'](_0xf18f('0xe'),_0x2f37e2,_[_0xf18f('0xf')](_0x3f3b07,_0xf18f('0x10'))['join'](',\x20'));_0x23cb31[_0xf18f('0x11')]();}else{var _0x2bb8e6=_[_0xf18f('0x12')](_0x107354[_0xf18f('0x13')],handleFindAgent(_0x2e24c2[_0xf18f('0xb')]));if(_0x2bb8e6){var _0x467bbb=(_0x2e24c2[_0xf18f('0x14')]||0xa)*0x3e8;var _0x3066ab,_0x311638;var _0x853cdf=seqqueue[_0xf18f('0x15')](_0x467bbb);_0x853cdf['id']=_0x2f37e2;_0x853cdf[_0xf18f('0x16')]=_0x467bbb;_0x853cdf[_0xf18f('0x17')]=_0x45beb2[_0xf18f('0x17')];writeLog(_0x2f37e2,_0x2bb8e6,util[_0xf18f('0x9')](_0xf18f('0x18'),_0x467bbb));_0x107354[_0xf18f('0x19')][_0x2f37e2]['on']('end',function(){logger[_0xf18f('0x8')](_0xf18f('0x1a'),_0x2f37e2);clearTimeout(_0x311638);_0x311638=undefined;_0x853cdf[_0xf18f('0x1b')]();if(_0x107354['rules'][_0x2f37e2]){delete _0x107354[_0xf18f('0x19')][_0x2f37e2];}_0x23cb31[_0xf18f('0x11')]();});_0x107354[_0xf18f('0x19')][_0x2f37e2]['on'](_0xf18f('0x1c'),function(){if(_0x107354[_0xf18f('0x19')][_0x2f37e2]){delete _0x107354[_0xf18f('0x19')][_0x2f37e2];}});_0x311638=setTimeout(function(){logger[_0xf18f('0x8')](_0xf18f('0x1d'),_0x2f37e2);clearTimeout(_0x311638);_0x853cdf[_0xf18f('0x1b')]();_0x23cb31[_0xf18f('0x1e')]();},_0x467bbb);strategy['agent'](_0x853cdf,_0x2bb8e6,_0x107354,_0x45beb2);}else{logger[_0xf18f('0x1f')](_0xf18f('0x20'),_0x2f37e2,_0x2e24c2[_0xf18f('0xb')]);_0x23cb31[_0xf18f('0x11')]();}}}catch(_0x14a854){console[_0xf18f('0x21')](_0x14a854);logger[_0xf18f('0x1f')](_0xf18f('0x22'),_0x2f37e2,_0x14a854['stack']);_0x23cb31[_0xf18f('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index f039adf..4ae59e7 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 _0x0686=['whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','create','then','catch','error','stringify','finally','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','channel','toString','postText','next','amazonlex','dialogState','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','[%s][AMAZONLEX]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x0686,0xad));var _0x6068=function(_0x2fd585,_0x138f9c){_0x2fd585=_0x2fd585-0x0;var _0x43c3d9=_0x0686[_0x2fd585];return _0x43c3d9;};'use strict';var _=require(_0x6068('0x0'));var moment=require(_0x6068('0x1'));var AWS=require(_0x6068('0x2'));var utils=require(_0x6068('0x3'));var logger=require(_0x6068('0x4'))(_0x6068('0x5'));var rpc={'chatMessage':require(_0x6068('0x6')),'openchannelMessage':require(_0x6068('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x6068('0x8')),'faxMessage':require(_0x6068('0x9')),'whatsappMessage':require(_0x6068('0xa'))};exports[_0x6068('0xb')]=function(_0x2846dc,_0x356cd1){return function(_0x3cc101){try{if(!_['isNil'](this[_0x6068('0xc')][_0x6068('0xd')])){logger['info'](_0x6068('0xe'),_0x2846dc,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x3cc101['next']();}var _0x3eb6c9={'ContactId':this[_0x6068('0xf')]['id'],'sentAt':moment()[_0x6068('0x10')](_0x6068('0x11')),'direction':_0x6068('0x12')};if(this['channel']==='sms'||this['channel']===_0x6068('0x13')){_0x3eb6c9['phone']=this['interaction'][_0x6068('0x14')];}var _0x4c0549=this['channel'];if(_0x4c0549===_0x6068('0x15')){_0x3eb6c9[_0x6068('0x16')]=this[_0x6068('0x17')]['id'];}else{_0x3eb6c9[_[_0x6068('0x18')](_0x4c0549)+_0x6068('0x19')]=this[_0x6068('0x17')]['id'];}_0x3eb6c9[_[_0x6068('0x18')](_0x4c0549)+_0x6068('0x1a')]=this['interaction']['id'];if(this['interaction'][_0x6068('0x1b')]){var _0x23b856=_0x356cd1[0x4];if(!_[_0x6068('0x1c')](_0x23b856)){_0x3eb6c9[_0x6068('0x1d')]=utils['getMustacheRender'](_0x23b856,this);return rpc[_0x4c0549+'Message'][_0x6068('0x1e')](_0x3eb6c9)[_0x6068('0x1f')](function(_0x39dd21){logger['info'](_0x6068('0xe'),_0x2846dc,_0x3eb6c9[_0x6068('0x1d')]);})[_0x6068('0x20')](function(_0x3c1713){logger[_0x6068('0x21')]('[%s][AMAZONLEX]\x20%s',_0x2846dc,JSON[_0x6068('0x22')](_0x3c1713));})[_0x6068('0x23')](function(){logger[_0x6068('0x24')](_0x6068('0x25'),_0x2846dc);_0x3cc101[_0x6068('0x26')]();});}else{logger[_0x6068('0x24')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2846dc);_0x3cc101[_0x6068('0x26')]();}}else{var _0x48b3b7=this;var _0x98581c=new AWS[(_0x6068('0x27'))]({'accessKeyId':_0x356cd1[0x0],'secretAccessKey':_0x356cd1[0x1],'region':_0x356cd1[0x2]});var _0x1b72b1={'botAlias':_0x6068('0x28'),'botName':_0x356cd1[0x3],'inputText':this[_0x6068('0x29')][_0x6068('0x1d')],'userId':this[_0x6068('0x2a')]+':'+this['interaction']['id'][_0x6068('0x2b')]()};_0x98581c[_0x6068('0x2c')](_0x1b72b1,function(_0x50f5cd,_0x5ade41){if(_0x50f5cd){logger[_0x6068('0x21')](_0x6068('0xe'),_0x2846dc,_0x50f5cd['message']);_0x3cc101[_0x6068('0x2d')]();}else if(_0x5ade41&&_0x5ade41[_0x6068('0x29')]){_0x48b3b7[_0x6068('0x1d')][_0x6068('0x2e')]=_0x5ade41;_0x3eb6c9[_0x6068('0x1d')]=_0x5ade41[_0x6068('0x29')];_0x3eb6c9['providerName']=_0x6068('0x2e');_0x3eb6c9['providerResponse']=JSON[_0x6068('0x22')](_0x5ade41);return rpc[_0x4c0549+'Message'][_0x6068('0x1e')](_0x3eb6c9)[_0x6068('0x1f')](function(_0x5ab8d2){logger[_0x6068('0x24')](_0x6068('0xe'),_0x2846dc,_0x3eb6c9[_0x6068('0x1d')]);if(_0x5ade41[_0x6068('0x2f')]=='Failed'){_0x3cc101[_0x6068('0x2d')]();}else{_0x3cc101[_0x6068('0x26')]();}})['catch'](function(_0x3c10bb){logger['error'](_0x6068('0xe'),_0x2846dc,JSON[_0x6068('0x22')](_0x3c10bb));_0x3cc101['next']();});}else{_0x3cc101[_0x6068('0x2d')]();}});}}catch(_0x562260){logger[_0x6068('0x21')](_0x6068('0xe'),_0x2846dc,JSON[_0x6068('0x22')](_0x562260));_0x3cc101['stop']();}};}; \ No newline at end of file +var _0x192b=['../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','isEmpty','body','getMustacheRender','Message','create','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','amazonlex','providerResponse','then','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0x5760f7,_0x47f093){var _0x4a8aa0=function(_0x22fbea){while(--_0x22fbea){_0x5760f7['push'](_0x5760f7['shift']());}};_0x4a8aa0(++_0x47f093);}(_0x192b,0x8c));var _0xb192=function(_0x49e3ff,_0x8661e3){_0x49e3ff=_0x49e3ff-0x0;var _0x59953f=_0x192b[_0x49e3ff];return _0x59953f;};'use strict';var _=require(_0xb192('0x0'));var moment=require(_0xb192('0x1'));var AWS=require(_0xb192('0x2'));var utils=require(_0xb192('0x3'));var logger=require(_0xb192('0x4'))(_0xb192('0x5'));var rpc={'chatMessage':require(_0xb192('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xb192('0x7')),'faxMessage':require(_0xb192('0x8')),'whatsappMessage':require(_0xb192('0x9'))};exports['consequence']=function(_0x21eb53,_0x3c481a){return function(_0x7e6efd){try{if(!_[_0xb192('0xa')](this['interaction'][_0xb192('0xb')])){logger[_0xb192('0xc')](_0xb192('0xd'),_0x21eb53,_0xb192('0xe'));return _0x7e6efd[_0xb192('0xf')]();}var _0xe2cfa={'ContactId':this[_0xb192('0x10')]['id'],'sentAt':moment()[_0xb192('0x11')](_0xb192('0x12')),'direction':'out'};if(this[_0xb192('0x13')]===_0xb192('0x14')||this[_0xb192('0x13')]==='whatsapp'){_0xe2cfa[_0xb192('0x15')]=this[_0xb192('0x16')]['phone'];}var _0x5175da=this['channel'];if(_0x5175da===_0xb192('0x17')){_0xe2cfa[_0xb192('0x18')]=this[_0xb192('0x19')]['id'];}else{_0xe2cfa[_[_0xb192('0x1a')](_0x5175da)+_0xb192('0x1b')]=this[_0xb192('0x19')]['id'];}_0xe2cfa[_['upperFirst'](_0x5175da)+'InteractionId']=this[_0xb192('0x16')]['id'];if(this['interaction']['created']){var _0x434096=_0x3c481a[0x4];if(!_[_0xb192('0x1c')](_0x434096)){_0xe2cfa[_0xb192('0x1d')]=utils[_0xb192('0x1e')](_0x434096,this);return rpc[_0x5175da+_0xb192('0x1f')][_0xb192('0x20')](_0xe2cfa)['then'](function(_0x51ac9a){logger['info'](_0xb192('0xd'),_0x21eb53,_0xe2cfa['body']);})[_0xb192('0x21')](function(_0x3bcd4b){logger[_0xb192('0x22')](_0xb192('0xd'),_0x21eb53,JSON[_0xb192('0x23')](_0x3bcd4b));})[_0xb192('0x24')](function(){logger[_0xb192('0xc')](_0xb192('0x25'),_0x21eb53);_0x7e6efd[_0xb192('0x26')]();});}else{logger[_0xb192('0xc')](_0xb192('0x27'),_0x21eb53);_0x7e6efd[_0xb192('0x26')]();}}else{var _0xdf3b7c=this;var _0x1a451a=new AWS[(_0xb192('0x28'))]({'accessKeyId':_0x3c481a[0x0],'secretAccessKey':_0x3c481a[0x1],'region':_0x3c481a[0x2]});var _0x1bfabc={'botAlias':_0xb192('0x29'),'botName':_0x3c481a[0x3],'inputText':this[_0xb192('0x2a')][_0xb192('0x1d')],'userId':this[_0xb192('0x13')]+':'+this[_0xb192('0x16')]['id'][_0xb192('0x2b')]()};_0x1a451a['postText'](_0x1bfabc,function(_0x350155,_0x1c9a2a){if(_0x350155){logger[_0xb192('0x22')](_0xb192('0xd'),_0x21eb53,_0x350155[_0xb192('0x2a')]);_0x7e6efd['next']();}else if(_0x1c9a2a&&_0x1c9a2a[_0xb192('0x2a')]){_0xdf3b7c[_0xb192('0x1d')][_0xb192('0x2c')]=_0x1c9a2a;_0xe2cfa['body']=_0x1c9a2a[_0xb192('0x2a')];_0xe2cfa['providerName']=_0xb192('0x2c');_0xe2cfa[_0xb192('0x2d')]=JSON[_0xb192('0x23')](_0x1c9a2a);return rpc[_0x5175da+_0xb192('0x1f')]['create'](_0xe2cfa)[_0xb192('0x2e')](function(_0x1f7206){logger[_0xb192('0xc')](_0xb192('0xd'),_0x21eb53,_0xe2cfa[_0xb192('0x1d')]);if(_0x1c9a2a[_0xb192('0x2f')]==_0xb192('0x30')){_0x7e6efd[_0xb192('0xf')]();}else{_0x7e6efd[_0xb192('0x26')]();}})[_0xb192('0x21')](function(_0x51ab1c){logger[_0xb192('0x22')](_0xb192('0xd'),_0x21eb53,JSON['stringify'](_0x51ab1c));_0x7e6efd[_0xb192('0xf')]();});}else{_0x7e6efd[_0xb192('0xf')]();}});}}catch(_0x278e7f){logger[_0xb192('0x22')](_0xb192('0xd'),_0x21eb53,JSON['stringify'](_0x278e7f));_0x7e6efd['stop']();}};}; \ 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 57016ec..3e48ad2 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 _0x7465=['consequence','channel','mail','isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','created','interaction','next','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','body','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','messageId','html','replace','','headers','auto-replied','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','[%s][AUTOREPLY]\x20%s','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','Interaction','update','catch','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc'];(function(_0x4b83b9,_0x57768f){var _0x4810f9=function(_0x1026e4){while(--_0x1026e4){_0x4b83b9['push'](_0x4b83b9['shift']());}};_0x4810f9(++_0x57768f);}(_0x7465,0x1da));var _0x5746=function(_0x4ff27a,_0x18605a){_0x4ff27a=_0x4ff27a-0x0;var _0x1793e1=_0x7465[_0x4ff27a];return _0x1793e1;};'use strict';var _=require(_0x5746('0x0'));var moment=require(_0x5746('0x1'));var utils=require(_0x5746('0x2'));var logger=require(_0x5746('0x3'))(_0x5746('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x5746('0x5')),'mailMessage':require(_0x5746('0x6')),'smsMessage':require(_0x5746('0x7')),'faxMessage':require(_0x5746('0x8')),'whatsappMessage':require(_0x5746('0x9')),'chatInteraction':require(_0x5746('0xa')),'openchannelInteraction':require(_0x5746('0xb')),'mailInteraction':require(_0x5746('0xc')),'smsInteraction':require(_0x5746('0xd')),'faxInteraction':require(_0x5746('0xe')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x5746('0xf'));exports[_0x5746('0x10')]=function(_0x3b1baf,_0x2a2e2d,_0xa1f8db,_0x946bc3){return function(_0x3bcd0c){try{var _0x14d5c5=this[_0x5746('0x11')];if(_0x14d5c5===_0x5746('0x12')&&_0x946bc3['body'][_0x5746('0x13')]){logger[_0x5746('0x14')]('[%s][AUTOREPLY]\x20%s',_0x3b1baf,_0x5746('0x15'));return _0x3bcd0c['next']();}if(_0x2a2e2d[0x0]==='1'&&(_[_0x5746('0x16')](this['interaction'][_0x5746('0x17')])||!this[_0x5746('0x18')]['created'])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x3b1baf,'Autoreply\x20already\x20sent');return _0x3bcd0c[_0x5746('0x19')]();}if(_0x2a2e2d[0x0]==='2'&&this[_0x5746('0x18')]['autoreplyExecuted']){logger[_0x5746('0x14')](_0x5746('0x1a'),_0x3b1baf,_0x5746('0x1b'));return _0x3bcd0c['next']();}var _0x308ec4={'ContactId':this[_0x5746('0x1c')]['id'],'sentAt':moment()[_0x5746('0x1d')](_0x5746('0x1e')),'direction':'out'};if(this[_0x5746('0x11')]===_0x5746('0x12')){_0x308ec4[_0x5746('0x1f')]=utils[_0x5746('0x20')](_0x2a2e2d[0x2],this);}else{_0x308ec4[_0x5746('0x1f')]=utils[_0x5746('0x20')](_0x2a2e2d[0x1],this);}if(this[_0x5746('0x21')]){_0x308ec4['to']=this[_0x5746('0x21')]['from']||'';if(this[_0x5746('0x11')]===_0x5746('0x12')&&_0x2a2e2d[0x1]==='1'){_0x308ec4['cc']=this[_0x5746('0x21')]['cc']||'';}_0x308ec4[_0x5746('0x22')]=this[_0x5746('0x21')]['to']||'';_0x308ec4['phone']=this[_0x5746('0x21')][_0x5746('0x23')]||'';_0x308ec4[_0x5746('0x24')]=!![];if(this['message'][_0x5746('0x25')]){_0x308ec4[_0x5746('0x25')]='';_0x308ec4[_0x5746('0x25')]+=_['startsWith'](this[_0x5746('0x21')][_0x5746('0x25')],_0x5746('0x26'))?'':_0x5746('0x27');_0x308ec4[_0x5746('0x25')]+=this[_0x5746('0x21')][_0x5746('0x25')];}}if(this['channel']===_0x5746('0x28')){_0x308ec4[_0x5746('0x29')]=this['account']['id'];}else{_0x308ec4[_[_0x5746('0x2a')](this['channel'])+_0x5746('0x2b')]=this[_0x5746('0x2c')]['id'];}_0x308ec4[_['upperFirst'](this[_0x5746('0x11')])+_0x5746('0x2d')]=this['interaction']['id'];var _0x261d9f=this[_0x5746('0x18')];if(rpc[this[_0x5746('0x11')]+_0x5746('0x2e')]){if(this['channel']===_0x5746('0x12')){_0x308ec4['inReplyTo']=this[_0x5746('0x21')][_0x5746('0x2f')];_0x308ec4[_0x5746('0x30')]=''+_[_0x5746('0x31')](_0x308ec4[_0x5746('0x1f')],'','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','error','finally','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','catch','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','isNil','interaction','created'];(function(_0x3c85aa,_0x4b0e61){var _0x433013=function(_0x13aa0b){while(--_0x13aa0b){_0x3c85aa['push'](_0x3c85aa['shift']());}};_0x433013(++_0x4b0e61);}(_0xb871,0x77));var _0x1b87=function(_0x5b82e9,_0x382fe1){_0x5b82e9=_0x5b82e9-0x0;var _0x204239=_0xb871[_0x5b82e9];return _0x204239;};'use strict';var _=require(_0x1b87('0x0'));var moment=require(_0x1b87('0x1'));var utils=require(_0x1b87('0x2'));var logger=require(_0x1b87('0x3'))('routing');var rpc={'chatMessage':require(_0x1b87('0x4')),'openchannelMessage':require(_0x1b87('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x1b87('0x6')),'faxMessage':require(_0x1b87('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x1b87('0x8')),'openchannelInteraction':require(_0x1b87('0x9')),'mailInteraction':require(_0x1b87('0xa')),'smsInteraction':require(_0x1b87('0xb')),'faxInteraction':require(_0x1b87('0xc')),'whatsappInteraction':require(_0x1b87('0xd'))};var mailRpc=require(_0x1b87('0xe'));exports[_0x1b87('0xf')]=function(_0x481eb8,_0x4ae738,_0x343361,_0xfad155){return function(_0x2f3eeb){try{var _0x20337a=this[_0x1b87('0x10')];if(_0x20337a===_0x1b87('0x11')&&_0xfad155[_0x1b87('0x12')][_0x1b87('0x13')]){logger['info']('[%s][AUTOREPLY]\x20%s',_0x481eb8,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x2f3eeb['next']();}if(_0x4ae738[0x0]==='1'&&(_[_0x1b87('0x14')](this[_0x1b87('0x15')][_0x1b87('0x16')])||!this['interaction'][_0x1b87('0x16')])){logger[_0x1b87('0x17')](_0x1b87('0x18'),_0x481eb8,_0x1b87('0x19'));return _0x2f3eeb[_0x1b87('0x1a')]();}if(_0x4ae738[0x0]==='2'&&this[_0x1b87('0x15')][_0x1b87('0x1b')]){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x481eb8,_0x1b87('0x1c'));return _0x2f3eeb[_0x1b87('0x1a')]();}var _0x455018={'ContactId':this[_0x1b87('0x1d')]['id'],'sentAt':moment()[_0x1b87('0x1e')](_0x1b87('0x1f')),'direction':'out'};if(this['channel']===_0x1b87('0x11')){_0x455018[_0x1b87('0x12')]=utils['getMustacheRender'](_0x4ae738[0x2],this);}else{_0x455018[_0x1b87('0x12')]=utils[_0x1b87('0x20')](_0x4ae738[0x1],this);}if(this[_0x1b87('0x21')]){_0x455018['to']=this[_0x1b87('0x21')][_0x1b87('0x22')]||'';if(this['channel']==='mail'&&_0x4ae738[0x1]==='1'){_0x455018['cc']=this[_0x1b87('0x21')]['cc']||'';}_0x455018['from']=this[_0x1b87('0x21')]['to']||'';_0x455018['phone']=this[_0x1b87('0x21')][_0x1b87('0x23')]||'';_0x455018[_0x1b87('0x24')]=!![];if(this[_0x1b87('0x21')][_0x1b87('0x25')]){_0x455018[_0x1b87('0x25')]='';_0x455018[_0x1b87('0x25')]+=_[_0x1b87('0x26')](this[_0x1b87('0x21')]['subject'],_0x1b87('0x27'))?'':_0x1b87('0x28');_0x455018[_0x1b87('0x25')]+=this['message'][_0x1b87('0x25')];}}if(this[_0x1b87('0x10')]===_0x1b87('0x29')){_0x455018[_0x1b87('0x2a')]=this[_0x1b87('0x2b')]['id'];}else{_0x455018[_[_0x1b87('0x2c')](this['channel'])+_0x1b87('0x2d')]=this[_0x1b87('0x2b')]['id'];}_0x455018[_[_0x1b87('0x2c')](this[_0x1b87('0x10')])+_0x1b87('0x2e')]=this['interaction']['id'];var _0x3c271e=this[_0x1b87('0x15')];if(rpc[this[_0x1b87('0x10')]+_0x1b87('0x2f')]){if(this[_0x1b87('0x10')]==='mail'){_0x455018['inReplyTo']=this['message'][_0x1b87('0x30')];_0x455018['html']=''+_[_0x1b87('0x31')](_0x455018[_0x1b87('0x12')],_0x1b87('0x32'),_0x1b87('0x33'))+_0x1b87('0x34');_0x455018[_0x1b87('0x35')]={'Auto-Submitted':_0x1b87('0x36'),'X-Auto-Response-Suppress':_0x1b87('0x37'),'Precedence':_0x1b87('0x38')};return mailRpc[_0x1b87('0x39')](this['account'][_0x1b87('0x3a')],_0x455018)[_0x1b87('0x3b')](function(_0x4ca0b8){logger[_0x1b87('0x17')](_0x1b87('0x3c'),_0x481eb8);_0x455018[_0x1b87('0x30')]=_0x4ca0b8[_0x1b87('0x21')][_0x1b87('0x30')];return rpc[_0x20337a+_0x1b87('0x2f')][_0x1b87('0x3d')](_0x455018);})[_0x1b87('0x3b')](function(_0x5767cb){logger['info']('[%s][AUTOREPLY]\x20%s',_0x481eb8,JSON[_0x1b87('0x3e')](_0x5767cb));})['catch'](function(_0x45a8d1){logger[_0x1b87('0x3f')]('[RPC][%s][AUTOREPLY]\x20%s',_0x481eb8,JSON['stringify'](_0x45a8d1));})[_0x1b87('0x40')](function(){Promise['resolve']()[_0x1b87('0x3b')](function(){if(_0x4ae738[0x0]!=='2'||_0x3c271e[_0x1b87('0x1b')])return;return rpc[_0x20337a+_0x1b87('0x41')][_0x1b87('0x42')](_0x3c271e['id'],{'autoreplyExecuted':!![]})[_0x1b87('0x3b')](function(_0x1bb8a8){logger[_0x1b87('0x17')](_0x1b87('0x43'),_0x481eb8,JSON[_0x1b87('0x3e')](_0x1bb8a8));})['catch'](function(_0x3a143e){logger[_0x1b87('0x3f')](_0x1b87('0x44'),_0x481eb8,JSON['stringify'](_0x3a143e));});})[_0x1b87('0x3b')](function(){_0x2f3eeb[_0x1b87('0x1a')]();});});}else{return rpc[this[_0x1b87('0x10')]+'Message'][_0x1b87('0x3d')](_0x455018)['then'](function(){logger[_0x1b87('0x17')](_0x1b87('0x18'),_0x481eb8,_0x455018['body']);})[_0x1b87('0x45')](function(_0x365221){logger[_0x1b87('0x3f')]('[%s][AUTOREPLY]\x20%s',_0x481eb8,JSON[_0x1b87('0x3e')](_0x365221));})[_0x1b87('0x40')](function(){Promise['resolve']()[_0x1b87('0x3b')](function(){if(_0x4ae738[0x0]!=='2'||_0x3c271e['autoreplyExecuted'])return;return rpc[_0x20337a+'Interaction']['update'](_0x3c271e['id'],{'autoreplyExecuted':!![]})[_0x1b87('0x3b')](function(_0x5dfc72){logger[_0x1b87('0x17')](_0x1b87('0x43'),_0x481eb8,JSON[_0x1b87('0x3e')](_0x5dfc72));})[_0x1b87('0x45')](function(_0x255449){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x481eb8,JSON[_0x1b87('0x3e')](_0x255449));});})[_0x1b87('0x3b')](function(){_0x2f3eeb[_0x1b87('0x1a')]();});});}}}catch(_0x3b350d){logger[_0x1b87('0x3f')](_0x1b87('0x18'),_0x481eb8,JSON[_0x1b87('0x3e')](_0x3b350d));_0x2f3eeb[_0x1b87('0x46')]();}};}; \ 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 f2d3440..8e22f11 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 _0xc27f=['../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','stringify','finally','stop','moment','routing','../../rpc/chatInteraction'];(function(_0x5ecef2,_0x5d85e2){var _0x3466c8=function(_0x30efb1){while(--_0x30efb1){_0x5ecef2['push'](_0x5ecef2['shift']());}};_0x3466c8(++_0x5d85e2);}(_0xc27f,0x1dd));var _0xfc27=function(_0x51deaa,_0x138057){_0x51deaa=_0x51deaa-0x0;var _0x3f2ceb=_0xc27f[_0x51deaa];return _0x3f2ceb;};'use strict';var moment=require(_0xfc27('0x0'));var logger=require('../../../../config/logger')(_0xfc27('0x1'));var rpc={'chatInteraction':require(_0xfc27('0x2')),'openchannelInteraction':require(_0xfc27('0x3')),'smsInteraction':require(_0xfc27('0x4')),'mailInteraction':require(_0xfc27('0x5')),'faxInteraction':require(_0xfc27('0x6')),'whatsappInteraction':require(_0xfc27('0x7'))};exports[_0xfc27('0x8')]=function(_0x1a15fb,_0x54a32e,_0x54d989,_0x28dc62){return function(_0x991cff){try{logger[_0xfc27('0x9')](_0xfc27('0xa'),_0x1a15fb,_0x54a32e[0x0]);var _0x404a3a={'closed':0x1,'closedAt':moment()['format'](_0xfc27('0xb')),'closeReason':_0xfc27('0xc'),'disposition':_0x54a32e[0x0]};if(rpc[_0x28dc62[_0xfc27('0xd')]+'Interaction']){rpc[_0x28dc62[_0xfc27('0xd')]+_0xfc27('0xe')][_0xfc27('0xf')](_0x28dc62[_0xfc27('0x10')]['id'],_0x404a3a)[_0xfc27('0x11')](function(_0x4afa20){logger[_0xfc27('0x9')](_0xfc27('0x12'),_0x1a15fb,_0x28dc62[_0xfc27('0x10')]['id']);})[_0xfc27('0x13')](function(_0x20b557){logger[_0xfc27('0x14')]('[%s][CLOSE]\x20%s',_0x1a15fb,JSON[_0xfc27('0x15')](_0x20b557));})[_0xfc27('0x16')](function(){_0x991cff[_0xfc27('0x17')]();});}}catch(_0x1efecc){logger['error']('[%s][CLOSE]\x20%s',_0x1a15fb,JSON[_0xfc27('0x15')](_0x1efecc));_0x991cff['stop']();}};}; \ No newline at end of file +var _0x770a=['stop','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0x770a,0xdd));var _0xa770=function(_0x442228,_0x56ac25){_0x442228=_0x442228-0x0;var _0xb0a0bd=_0x770a[_0x442228];return _0xb0a0bd;};'use strict';var moment=require('moment');var logger=require(_0xa770('0x0'))(_0xa770('0x1'));var rpc={'chatInteraction':require(_0xa770('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xa770('0x3')),'mailInteraction':require(_0xa770('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xa770('0x5'))};exports['consequence']=function(_0x4f9817,_0x5e1e75,_0x50b4b9,_0x318f27){return function(_0x258d80){try{logger[_0xa770('0x6')](_0xa770('0x7'),_0x4f9817,_0x5e1e75[0x0]);var _0x2c0904={'closed':0x1,'closedAt':moment()[_0xa770('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xa770('0x9'),'disposition':_0x5e1e75[0x0]};if(rpc[_0x318f27[_0xa770('0xa')]+'Interaction']){rpc[_0x318f27['channel']+_0xa770('0xb')][_0xa770('0xc')](_0x318f27[_0xa770('0xd')]['id'],_0x2c0904)[_0xa770('0xe')](function(_0x11a8a4){logger[_0xa770('0x6')](_0xa770('0xf'),_0x4f9817,_0x318f27[_0xa770('0xd')]['id']);})[_0xa770('0x10')](function(_0x30279e){logger[_0xa770('0x11')](_0xa770('0x12'),_0x4f9817,JSON[_0xa770('0x13')](_0x30279e));})[_0xa770('0x14')](function(){_0x258d80[_0xa770('0x15')]();});}}catch(_0x1104aa){logger['error'](_0xa770('0x12'),_0x4f9817,JSON[_0xa770('0x13')](_0x1104aa));_0x258d80['stop']();}};}; \ 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 454adde..98f5498 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 _0xc627=['dialogflow','result','fulfillment','speech','providerName','providerResponse','stringify','Message','create','metadata','endConversation','next','moment','apiai-promise','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','out','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','then','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','message'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xc627,0x14a));var _0x7c62=function(_0x46cb73,_0x2d7c66){_0x46cb73=_0x46cb73-0x0;var _0x49fd1a=_0xc627[_0x46cb73];return _0x49fd1a;};'use strict';var _=require('lodash');var moment=require(_0x7c62('0x0'));var apiai=require(_0x7c62('0x1'));var md5=require(_0x7c62('0x2'));var utils=require('./utils');var logger=require(_0x7c62('0x3'))(_0x7c62('0x4'));var rpc={'chatMessage':require(_0x7c62('0x5')),'openchannelMessage':require(_0x7c62('0x6')),'mailMessage':require(_0x7c62('0x7')),'smsMessage':require(_0x7c62('0x8')),'faxMessage':require(_0x7c62('0x9')),'whatsappMessage':require(_0x7c62('0xa'))};exports[_0x7c62('0xb')]=function(_0x43f964,_0x110f39){return function(_0x29705f){try{if(!_['isNil'](this['interaction'][_0x7c62('0xc')])){logger[_0x7c62('0xd')](_0x7c62('0xe'),_0x43f964,_0x7c62('0xf'));return _0x29705f['next']();}var _0x598a4a={'ContactId':this['contact']['id'],'sentAt':moment()[_0x7c62('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x7c62('0x11')};if(this[_0x7c62('0x12')]===_0x7c62('0x13')||this[_0x7c62('0x12')]===_0x7c62('0x14')){_0x598a4a[_0x7c62('0x15')]=this[_0x7c62('0x16')][_0x7c62('0x15')];}var _0x396162=this[_0x7c62('0x12')];if(_0x396162===_0x7c62('0x17')){_0x598a4a[_0x7c62('0x18')]=this[_0x7c62('0x19')]['id'];}else{_0x598a4a[_[_0x7c62('0x1a')](_0x396162)+_0x7c62('0x1b')]=this['account']['id'];}_0x598a4a[_[_0x7c62('0x1a')](_0x396162)+'InteractionId']=this[_0x7c62('0x16')]['id'];if(this['interaction'][_0x7c62('0x1c')]){var _0x88c410=_0x110f39[0x2];if(!_[_0x7c62('0x1d')](_0x88c410)){_0x598a4a[_0x7c62('0x1e')]=utils[_0x7c62('0x1f')](_0x88c410,this);return rpc[_0x396162+'Message']['create'](_0x598a4a)[_0x7c62('0x20')](function(_0x4841b8){logger[_0x7c62('0xd')](_0x7c62('0xe'),_0x43f964,_0x598a4a[_0x7c62('0x1e')]);})[_0x7c62('0x21')](function(_0x30bdea){logger[_0x7c62('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x43f964,JSON['stringify'](_0x30bdea));})[_0x7c62('0x23')](function(){logger[_0x7c62('0xd')](_0x7c62('0x24'),_0x43f964);_0x29705f['stop']();});}else{logger[_0x7c62('0xd')](_0x7c62('0x25'),_0x43f964);_0x29705f[_0x7c62('0x26')]();}}else{var _0x43c0fb=this;var _0xd49d53=apiai(_0x110f39[0x0],{'language':_0x110f39[0x1]||'en'});return _0xd49d53[_0x7c62('0x27')](this[_0x7c62('0x28')]['body'],{'sessionId':md5(this[_0x7c62('0x16')]['id'])})[_0x7c62('0x20')](function(_0x37d960){_0x43c0fb[_0x7c62('0x1e')][_0x7c62('0x29')]=_0x37d960;_0x598a4a[_0x7c62('0x1e')]=_0x37d960[_0x7c62('0x2a')][_0x7c62('0x2b')][_0x7c62('0x2c')];_0x598a4a[_0x7c62('0x2d')]=_0x7c62('0x29');_0x598a4a[_0x7c62('0x2e')]=JSON[_0x7c62('0x2f')](_0x37d960);return rpc[_0x396162+_0x7c62('0x30')][_0x7c62('0x31')](_0x598a4a)[_0x7c62('0x20')](function(_0x364971){logger[_0x7c62('0xd')](_0x7c62('0xe'),_0x43f964,_0x598a4a['body']);if(_0x37d960[_0x7c62('0x2a')][_0x7c62('0x32')][_0x7c62('0x33')]){_0x29705f[_0x7c62('0x34')]();}else{_0x29705f[_0x7c62('0x26')]();}})[_0x7c62('0x21')](function(_0x984d3e){logger[_0x7c62('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x43f964,JSON[_0x7c62('0x2f')](_0x984d3e));_0x29705f['next']();});})[_0x7c62('0x21')](function(_0x31996c){logger[_0x7c62('0x22')](_0x7c62('0xe'),_0x43f964,_0x31996c['message']);_0x29705f[_0x7c62('0x34')]();});}}catch(_0x2b4c11){logger[_0x7c62('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x43f964,JSON['stringify'](_0x2b4c11));_0x29705f[_0x7c62('0x26')]();}};}; \ No newline at end of file +var _0x804d=['whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','create','then','[%s][DIALOGFLOW]\x20%s','body','catch','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','result','fulfillment','speech','dialogflow','providerResponse','Message','endConversation','stringify','message','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','channel'];(function(_0x2ef3f4,_0x21406c){var _0x501ecd=function(_0x519c7c){while(--_0x519c7c){_0x2ef3f4['push'](_0x2ef3f4['shift']());}};_0x501ecd(++_0x21406c);}(_0x804d,0x116));var _0xd804=function(_0x491d95,_0x6e0c5b){_0x491d95=_0x491d95-0x0;var _0x446ebd=_0x804d[_0x491d95];return _0x446ebd;};'use strict';var _=require(_0xd804('0x0'));var moment=require(_0xd804('0x1'));var apiai=require(_0xd804('0x2'));var md5=require(_0xd804('0x3'));var utils=require(_0xd804('0x4'));var logger=require(_0xd804('0x5'))(_0xd804('0x6'));var rpc={'chatMessage':require(_0xd804('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xd804('0x8')),'smsMessage':require(_0xd804('0x9')),'faxMessage':require(_0xd804('0xa')),'whatsappMessage':require(_0xd804('0xb'))};exports[_0xd804('0xc')]=function(_0xf52871,_0x465695){return function(_0x391e2b){try{if(!_[_0xd804('0xd')](this[_0xd804('0xe')][_0xd804('0xf')])){logger[_0xd804('0x10')]('[%s][DIALOGFLOW]\x20%s',_0xf52871,_0xd804('0x11'));return _0x391e2b[_0xd804('0x12')]();}var _0x46730f={'ContactId':this[_0xd804('0x13')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xd804('0x14')};if(this[_0xd804('0x15')]==='sms'||this[_0xd804('0x15')]===_0xd804('0x16')){_0x46730f['phone']=this[_0xd804('0xe')][_0xd804('0x17')];}var _0xce756=this['channel'];if(_0xce756==='chat'){_0x46730f[_0xd804('0x18')]=this[_0xd804('0x19')]['id'];}else{_0x46730f[_[_0xd804('0x1a')](_0xce756)+_0xd804('0x1b')]=this[_0xd804('0x19')]['id'];}_0x46730f[_['upperFirst'](_0xce756)+_0xd804('0x1c')]=this[_0xd804('0xe')]['id'];if(this['interaction'][_0xd804('0x1d')]){var _0x1a10c7=_0x465695[0x2];if(!_[_0xd804('0x1e')](_0x1a10c7)){_0x46730f['body']=utils[_0xd804('0x1f')](_0x1a10c7,this);return rpc[_0xce756+'Message'][_0xd804('0x20')](_0x46730f)[_0xd804('0x21')](function(_0x13fa46){logger['info'](_0xd804('0x22'),_0xf52871,_0x46730f[_0xd804('0x23')]);})[_0xd804('0x24')](function(_0x2d881a){logger[_0xd804('0x25')]('[%s][DIALOGFLOW]\x20%s',_0xf52871,JSON['stringify'](_0x2d881a));})[_0xd804('0x26')](function(){logger['info'](_0xd804('0x27'),_0xf52871);_0x391e2b[_0xd804('0x28')]();});}else{logger[_0xd804('0x10')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xf52871);_0x391e2b[_0xd804('0x28')]();}}else{var _0x5dd939=this;var _0x18d28c=apiai(_0x465695[0x0],{'language':_0x465695[0x1]||'en'});return _0x18d28c['textRequest'](this['message']['body'],{'sessionId':md5(this['interaction']['id'])})[_0xd804('0x21')](function(_0x2fc18b){_0x5dd939[_0xd804('0x23')]['dialogflow']=_0x2fc18b;_0x46730f[_0xd804('0x23')]=_0x2fc18b[_0xd804('0x29')][_0xd804('0x2a')][_0xd804('0x2b')];_0x46730f['providerName']=_0xd804('0x2c');_0x46730f[_0xd804('0x2d')]=JSON['stringify'](_0x2fc18b);return rpc[_0xce756+_0xd804('0x2e')][_0xd804('0x20')](_0x46730f)['then'](function(_0x5287eb){logger['info'](_0xd804('0x22'),_0xf52871,_0x46730f[_0xd804('0x23')]);if(_0x2fc18b[_0xd804('0x29')]['metadata'][_0xd804('0x2f')]){_0x391e2b[_0xd804('0x12')]();}else{_0x391e2b[_0xd804('0x28')]();}})[_0xd804('0x24')](function(_0x473588){logger[_0xd804('0x25')](_0xd804('0x22'),_0xf52871,JSON[_0xd804('0x30')](_0x473588));_0x391e2b['next']();});})[_0xd804('0x24')](function(_0x251e5e){logger[_0xd804('0x25')](_0xd804('0x22'),_0xf52871,_0x251e5e[_0xd804('0x31')]);_0x391e2b[_0xd804('0x12')]();});}}catch(_0x3aefde){logger[_0xd804('0x25')](_0xd804('0x22'),_0xf52871,JSON[_0xd804('0x30')](_0x3aefde));_0x391e2b['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index cae9446..ef5e4a3 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 _0x73df=['dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','queryText','intentDetectionConfidence','providerName','providerResponse','length','fulfillmentText','push','all','stack','lodash','dialogflow','md5','moment','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','Message','create','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','stringify','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','isEmpty','getMustacheRender','then','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','SessionsClient','sessionPath','message'];(function(_0x55839a,_0x5220e3){var _0x211553=function(_0x54b98d){while(--_0x54b98d){_0x55839a['push'](_0x55839a['shift']());}};_0x211553(++_0x5220e3);}(_0x73df,0x67));var _0xf73d=function(_0x21c2f7,_0x786ff){_0x21c2f7=_0x21c2f7-0x0;var _0x2c3878=_0x73df[_0x21c2f7];return _0x2c3878;};'use strict';var _=require(_0xf73d('0x0'));var dialogflow=require(_0xf73d('0x1'));var md5=require(_0xf73d('0x2'));var moment=require(_0xf73d('0x3'));var Promise=require(_0xf73d('0x4'));var logger=require('../../../../config/logger')(_0xf73d('0x5'));var utils=require(_0xf73d('0x6'));var rpc={'chatMessage':require(_0xf73d('0x7')),'openchannelMessage':require(_0xf73d('0x8')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xf73d('0x9')),'faxMessage':require(_0xf73d('0xa')),'whatsappMessage':require(_0xf73d('0xb'))};function createMessage(_0x3a0ad7,_0x3f667a,_0x2fe387,_0x202209){return new Promise(function(_0x253041,_0x23778f){var _0x554a93=_[_0xf73d('0xc')](_0x2fe387);_0x554a93['body']=_0x202209;return rpc[_0x3f667a+_0xf73d('0xd')][_0xf73d('0xe')](_0x554a93)['then'](function(){logger['info'](_0xf73d('0xf'),_0x3a0ad7,_0x554a93[_0xf73d('0x10')]);_0x253041();})[_0xf73d('0x11')](function(_0x3eefb4){logger[_0xf73d('0x12')](_0xf73d('0xf'),_0x3a0ad7,JSON[_0xf73d('0x13')](_0x3eefb4));_0x23778f(_0x3eefb4);});});}exports[_0xf73d('0x14')]=function(_0x298c48,_0x19a565){return function(_0x4ef7f1){try{if(!_[_0xf73d('0x15')](this[_0xf73d('0x16')][_0xf73d('0x17')])){logger[_0xf73d('0x18')]('[%s][DIALOGFLOWV2]\x20%s',_0x298c48,_0xf73d('0x19'));return _0x4ef7f1[_0xf73d('0x1a')]();}var _0x2db73c={'ContactId':this['contact']['id'],'sentAt':moment()[_0xf73d('0x1b')](_0xf73d('0x1c')),'direction':_0xf73d('0x1d')};if(this[_0xf73d('0x1e')]===_0xf73d('0x1f')||this['channel']===_0xf73d('0x20')){_0x2db73c[_0xf73d('0x21')]=this[_0xf73d('0x16')]['phone'];}var _0x1aa4d4=this[_0xf73d('0x1e')];if(_0x1aa4d4===_0xf73d('0x22')){_0x2db73c[_0xf73d('0x23')]=this[_0xf73d('0x24')]['id'];}else{_0x2db73c[_['upperFirst'](_0x1aa4d4)+_0xf73d('0x25')]=this[_0xf73d('0x24')]['id'];}_0x2db73c[_[_0xf73d('0x26')](_0x1aa4d4)+_0xf73d('0x27')]=this[_0xf73d('0x16')]['id'];if(this['interaction']['created']){var _0x5d08d4=_0x19a565[0x4];if(!_[_0xf73d('0x28')](_0x5d08d4)){_0x2db73c['body']=utils[_0xf73d('0x29')](_0x5d08d4,this);return rpc[_0x1aa4d4+_0xf73d('0xd')][_0xf73d('0xe')](_0x2db73c)[_0xf73d('0x2a')](function(_0x2a816a){logger[_0xf73d('0x18')]('[%s][DIALOGFLOWV2]\x20%s',_0x298c48,_0x2db73c[_0xf73d('0x10')]);})[_0xf73d('0x11')](function(_0x22115f){logger[_0xf73d('0x12')](_0xf73d('0xf'),_0x298c48,JSON[_0xf73d('0x13')](_0x22115f));})['finally'](function(){logger[_0xf73d('0x18')](_0xf73d('0x2b'),_0x298c48);_0x4ef7f1['stop']();});}else{logger['info'](_0xf73d('0x2c'),_0x298c48);_0x4ef7f1[_0xf73d('0x2d')]();}}else{var _0x2964dc=this;var _0x34cb96=_0x19a565[0x2]['replace'](/\\n/g,'\x0a');var _0x4b6891={'credentials':{'private_key':_0x34cb96,'client_email':_0x19a565[0x1]}};var _0x3b19b2=new dialogflow[(_0xf73d('0x2e'))](_0x4b6891);var _0x42f254=_0x3b19b2[_0xf73d('0x2f')](_0x19a565[0x0],md5(_0x2964dc[_0xf73d('0x16')]['id']));var _0x326d56={'session':_0x42f254,'queryInput':{'text':{'text':_0x2964dc[_0xf73d('0x30')][_0xf73d('0x10')],'languageCode':_0x19a565[0x3]||'en'}}};return _0x3b19b2['detectIntent'](_0x326d56)['then'](function(_0x53adaa){if(_0x53adaa&&_0x53adaa['length']){_0x2964dc[_0xf73d('0x10')][_0xf73d('0x31')]=_0x53adaa;var _0x1a15c4=_0x53adaa[0x0];var _0x22b130=_0x1a15c4[_0xf73d('0x32')][_0xf73d('0x33')]&&_0x1a15c4[_0xf73d('0x32')]['diagnosticInfo'][_0xf73d('0x34')]?_0x1a15c4[_0xf73d('0x32')][_0xf73d('0x33')]['fields']['end_conversation'][_0xf73d('0x35')]:![];_0x2964dc[_0xf73d('0x10')][_0xf73d('0x36')]=_0x1a15c4[_0xf73d('0x32')][_0xf73d('0x37')];_0x2964dc['body'][_0xf73d('0x38')]=_0x1a15c4[_0xf73d('0x32')][_0xf73d('0x39')];_0x2964dc[_0xf73d('0x10')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x1a15c4[_0xf73d('0x32')]['diagnosticInfo']&&_0x1a15c4[_0xf73d('0x32')]['diagnosticInfo'][_0xf73d('0x34')]?_0x1a15c4[_0xf73d('0x32')][_0xf73d('0x33')]['fields'][_0xf73d('0x3a')][_0xf73d('0x35')]:![];_0x2964dc[_0xf73d('0x10')][_0xf73d('0x3b')]=_0x1a15c4[_0xf73d('0x32')][_0xf73d('0x3c')][_0xf73d('0x3d')];_0x2964dc['body'][_0xf73d('0x3e')]=_0x1a15c4[_0xf73d('0x32')]['intent'][_0xf73d('0x3f')];_0x2964dc[_0xf73d('0x10')][_0xf73d('0x40')]=_0x1a15c4[_0xf73d('0x32')][_0xf73d('0x3c')][_0xf73d('0x41')];_0x2964dc['body']['DIALOGFLOWV2_LANGUAGECODE']=_0x1a15c4[_0xf73d('0x32')][_0xf73d('0x42')];_0x2964dc['body']['DIALOGFLOWV2_QUERYTEXT']=_0x1a15c4[_0xf73d('0x32')][_0xf73d('0x43')];_0x2964dc[_0xf73d('0x10')]['DIALOGFLOWV2_SCORE']=_0x1a15c4[_0xf73d('0x32')][_0xf73d('0x44')];_0x2db73c[_0xf73d('0x45')]=_0xf73d('0x31');_0x2db73c[_0xf73d('0x46')]=JSON[_0xf73d('0x13')](_0x53adaa);var _0xda1922=[];for(var _0xb356c9=0x0;_0xb356c9<_0x53adaa[_0xf73d('0x47')];_0xb356c9++){var _0x40b047=_0x53adaa[_0xb356c9];if(_0x40b047&&_0x40b047[_0xf73d('0x32')]&&_0x40b047['queryResult'][_0xf73d('0x48')]){_0xda1922[_0xf73d('0x49')](createMessage(_0x298c48,_0x1aa4d4,_0x2db73c,_0x40b047[_0xf73d('0x32')][_0xf73d('0x48')]));}}return Promise[_0xf73d('0x4a')](_0xda1922)[_0xf73d('0x2a')](function(){if(_0x22b130){_0x4ef7f1['next']();}else{_0x4ef7f1[_0xf73d('0x2d')]();}})[_0xf73d('0x11')](function(_0x506ee6){logger[_0xf73d('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x298c48,JSON['stringify'](_0x506ee6));_0x4ef7f1[_0xf73d('0x1a')]();});}})[_0xf73d('0x11')](function(_0x4bf7de){logger['error'](_0xf73d('0xf'),_0x298c48,_0x4bf7de[_0xf73d('0x30')],_0x4bf7de[_0xf73d('0x4b')]);_0x4ef7f1[_0xf73d('0x1a')]();});}}catch(_0x555b27){logger[_0xf73d('0x12')](_0xf73d('0xf'),_0x298c48,JSON['stringify'](_0x555b27));_0x4ef7f1[_0xf73d('0x2d')]();}};}; \ No newline at end of file +var _0xb325=['isEmpty','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerResponse','fulfillmentText','push','all','next','lodash','md5','moment','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','body','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','UserId','contact','format','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction'];(function(_0x5bac50,_0x540d00){var _0x28afd5=function(_0x25b25d){while(--_0x25b25d){_0x5bac50['push'](_0x5bac50['shift']());}};_0x28afd5(++_0x540d00);}(_0xb325,0x1e2));var _0x5b32=function(_0x393b30,_0x222fed){_0x393b30=_0x393b30-0x0;var _0x348e7d=_0xb325[_0x393b30];return _0x348e7d;};'use strict';var _=require(_0x5b32('0x0'));var dialogflow=require('dialogflow');var md5=require(_0x5b32('0x1'));var moment=require(_0x5b32('0x2'));var Promise=require(_0x5b32('0x3'));var logger=require('../../../../config/logger')(_0x5b32('0x4'));var utils=require(_0x5b32('0x5'));var rpc={'chatMessage':require(_0x5b32('0x6')),'openchannelMessage':require(_0x5b32('0x7')),'mailMessage':require(_0x5b32('0x8')),'smsMessage':require(_0x5b32('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x5b32('0xa'))};function createMessage(_0x173815,_0x3111e1,_0x4e3f44,_0x4529a5){return new Promise(function(_0x24feb7,_0x232938){var _0x368a4d=_[_0x5b32('0xb')](_0x4e3f44);_0x368a4d[_0x5b32('0xc')]=_0x4529a5;return rpc[_0x3111e1+'Message'][_0x5b32('0xd')](_0x368a4d)[_0x5b32('0xe')](function(){logger[_0x5b32('0xf')](_0x5b32('0x10'),_0x173815,_0x368a4d['body']);_0x24feb7();})[_0x5b32('0x11')](function(_0x4fa19c){logger[_0x5b32('0x12')](_0x5b32('0x10'),_0x173815,JSON[_0x5b32('0x13')](_0x4fa19c));_0x232938(_0x4fa19c);});});}exports[_0x5b32('0x14')]=function(_0x5b09d1,_0x13330b){return function(_0xc2a4c2){try{if(!_[_0x5b32('0x15')](this['interaction'][_0x5b32('0x16')])){logger['info'](_0x5b32('0x10'),_0x5b09d1,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0xc2a4c2['next']();}var _0x163339={'ContactId':this[_0x5b32('0x17')]['id'],'sentAt':moment()[_0x5b32('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x5b32('0x19')};if(this[_0x5b32('0x1a')]===_0x5b32('0x1b')||this[_0x5b32('0x1a')]===_0x5b32('0x1c')){_0x163339[_0x5b32('0x1d')]=this['interaction'][_0x5b32('0x1d')];}var _0x3f57d5=this[_0x5b32('0x1a')];if(_0x3f57d5===_0x5b32('0x1e')){_0x163339[_0x5b32('0x1f')]=this[_0x5b32('0x20')]['id'];}else{_0x163339[_[_0x5b32('0x21')](_0x3f57d5)+_0x5b32('0x22')]=this[_0x5b32('0x20')]['id'];}_0x163339[_['upperFirst'](_0x3f57d5)+'InteractionId']=this[_0x5b32('0x23')]['id'];if(this[_0x5b32('0x23')]['created']){var _0xf01aee=_0x13330b[0x4];if(!_[_0x5b32('0x24')](_0xf01aee)){_0x163339[_0x5b32('0xc')]=utils[_0x5b32('0x25')](_0xf01aee,this);return rpc[_0x3f57d5+'Message'][_0x5b32('0xd')](_0x163339)[_0x5b32('0xe')](function(_0x3e07ff){logger['info'](_0x5b32('0x10'),_0x5b09d1,_0x163339['body']);})[_0x5b32('0x11')](function(_0x460cc5){logger[_0x5b32('0x12')](_0x5b32('0x10'),_0x5b09d1,JSON[_0x5b32('0x13')](_0x460cc5));})[_0x5b32('0x26')](function(){logger[_0x5b32('0xf')](_0x5b32('0x27'),_0x5b09d1);_0xc2a4c2[_0x5b32('0x28')]();});}else{logger[_0x5b32('0xf')](_0x5b32('0x29'),_0x5b09d1);_0xc2a4c2[_0x5b32('0x28')]();}}else{var _0x344514=this;var _0x5d7b17=_0x13330b[0x2]['replace'](/\\n/g,'\x0a');var _0xc12e74={'credentials':{'private_key':_0x5d7b17,'client_email':_0x13330b[0x1]}};var _0x1f9189=new dialogflow[(_0x5b32('0x2a'))](_0xc12e74);var _0x280d11=_0x1f9189[_0x5b32('0x2b')](_0x13330b[0x0],md5(_0x344514[_0x5b32('0x23')]['id']));var _0x38a293={'session':_0x280d11,'queryInput':{'text':{'text':_0x344514[_0x5b32('0x2c')][_0x5b32('0xc')],'languageCode':_0x13330b[0x3]||'en'}}};return _0x1f9189[_0x5b32('0x2d')](_0x38a293)[_0x5b32('0xe')](function(_0x23d649){if(_0x23d649&&_0x23d649[_0x5b32('0x2e')]){_0x344514[_0x5b32('0xc')][_0x5b32('0x2f')]=_0x23d649;var _0x3fc99d=_0x23d649[0x0];var _0x186111=_0x3fc99d['queryResult']['diagnosticInfo']&&_0x3fc99d[_0x5b32('0x30')][_0x5b32('0x31')][_0x5b32('0x32')]?_0x3fc99d[_0x5b32('0x30')]['diagnosticInfo']['fields'][_0x5b32('0x33')][_0x5b32('0x34')]:![];_0x344514[_0x5b32('0xc')][_0x5b32('0x35')]=_0x3fc99d['queryResult'][_0x5b32('0x36')];_0x344514[_0x5b32('0xc')][_0x5b32('0x37')]=_0x3fc99d['queryResult'][_0x5b32('0x38')];_0x344514[_0x5b32('0xc')][_0x5b32('0x39')]=_0x3fc99d['queryResult']['diagnosticInfo']&&_0x3fc99d[_0x5b32('0x30')]['diagnosticInfo'][_0x5b32('0x32')]?_0x3fc99d[_0x5b32('0x30')]['diagnosticInfo']['fields'][_0x5b32('0x33')][_0x5b32('0x34')]:![];_0x344514[_0x5b32('0xc')][_0x5b32('0x3a')]=_0x3fc99d[_0x5b32('0x30')][_0x5b32('0x3b')][_0x5b32('0x3c')];_0x344514[_0x5b32('0xc')][_0x5b32('0x3d')]=_0x3fc99d[_0x5b32('0x30')]['intent'][_0x5b32('0x3e')];_0x344514[_0x5b32('0xc')][_0x5b32('0x3f')]=_0x3fc99d[_0x5b32('0x30')][_0x5b32('0x3b')][_0x5b32('0x40')];_0x344514['body']['DIALOGFLOWV2_LANGUAGECODE']=_0x3fc99d[_0x5b32('0x30')][_0x5b32('0x41')];_0x344514[_0x5b32('0xc')][_0x5b32('0x42')]=_0x3fc99d[_0x5b32('0x30')][_0x5b32('0x43')];_0x344514[_0x5b32('0xc')]['DIALOGFLOWV2_SCORE']=_0x3fc99d[_0x5b32('0x30')][_0x5b32('0x44')];_0x163339['providerName']=_0x5b32('0x2f');_0x163339[_0x5b32('0x45')]=JSON['stringify'](_0x23d649);var _0x2e2c84=[];for(var _0x314aaf=0x0;_0x314aaf<_0x23d649[_0x5b32('0x2e')];_0x314aaf++){var _0x491f9c=_0x23d649[_0x314aaf];if(_0x491f9c&&_0x491f9c[_0x5b32('0x30')]&&_0x491f9c[_0x5b32('0x30')][_0x5b32('0x46')]){_0x2e2c84[_0x5b32('0x47')](createMessage(_0x5b09d1,_0x3f57d5,_0x163339,_0x491f9c[_0x5b32('0x30')][_0x5b32('0x46')]));}}return Promise[_0x5b32('0x48')](_0x2e2c84)[_0x5b32('0xe')](function(){if(_0x186111){_0xc2a4c2[_0x5b32('0x49')]();}else{_0xc2a4c2[_0x5b32('0x28')]();}})['catch'](function(_0x5468db){logger['error'](_0x5b32('0x10'),_0x5b09d1,JSON['stringify'](_0x5468db));_0xc2a4c2[_0x5b32('0x49')]();});}})[_0x5b32('0x11')](function(_0x1fd532){logger[_0x5b32('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x5b09d1,_0x1fd532['message'],_0x1fd532['stack']);_0xc2a4c2['next']();});}}catch(_0x77160e){logger[_0x5b32('0x12')](_0x5b32('0x10'),_0x5b09d1,JSON[_0x5b32('0x13')](_0x77160e));_0xc2a4c2['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 71d5645..357166f 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 _0x9276=['findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','message','join','stop','priorityFalse','info','next'];(function(_0x5c1449,_0x2af4b4){var _0x270473=function(_0x1461b6){while(--_0x1461b6){_0x5c1449['push'](_0x5c1449['shift']());}};_0x270473(++_0x2af4b4);}(_0x9276,0x1a5));var _0x6927=function(_0x1f05bf,_0x24bdfd){_0x1f05bf=_0x1f05bf-0x0;var _0x47ce0d=_0x9276[_0x1f05bf];return _0x47ce0d;};'use strict';var schema=require(_0x6927('0x0'));var _=require(_0x6927('0x1'));var htmlToText=require(_0x6927('0x2'));var utils=require('./utils');var logger=require(_0x6927('0x3'))(_0x6927('0x4'));var gotoif=schema({'condition':{'type':_0x6927('0x5'),'required':!![],'message':_0x6927('0x6')},'priorityTrue':{'type':_0x6927('0x7'),'message':_0x6927('0x8')},'priorityFalse':{'type':_0x6927('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0x56a7e1,_0x1df5e5){return function(_0x4195b5){try{var _0x314d31={'condition':htmlToText[_0x6927('0x9')](utils[_0x6927('0xa')](_0x1df5e5[0x0],this),{'wordwrap':![]})[_0x6927('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1df5e5[0x1],'priorityFalse':_0x1df5e5[0x2]};var _0x6979ee=gotoif[_0x6927('0x0')](_0x314d31,{'typecast':!![]});if(_0x6979ee[_0x6927('0xc')]){logger['error'](_0x6927('0xd'),_0x56a7e1,_[_0x6927('0xe')](_0x6979ee,_0x6927('0xf'))[_0x6927('0x10')](',\x20'));_0x4195b5[_0x6927('0x11')]();}else{try{var _0x2fc17a=eval('('+_0x314d31['condition']+')');var _0xa95931=_0x2fc17a?_0x314d31['priorityTrue']:_0x314d31[_0x6927('0x12')];logger[_0x6927('0x13')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x56a7e1,_0x314d31['condition'],_0x2fc17a,_0xa95931||_0x6927('0x14'));if(_0xa95931){var _0x3fb90d=_[_0x6927('0x15')](_0x4195b5['rules'](),{'p':_0xa95931});if(_0x3fb90d>=0x0){logger[_0x6927('0x13')](_0x6927('0x16'),_0x56a7e1,_0xa95931||_0x6927('0x14'),_0x3fb90d);_0x4195b5[_0x6927('0x14')](_0x3fb90d);}else{logger[_0x6927('0x13')](_0x6927('0x17'),_0x56a7e1,_0xa95931||_0x6927('0x14'));_0x4195b5[_0x6927('0x11')]();}}else{_0x4195b5[_0x6927('0x14')]();}}catch(_0x2b59c1){logger[_0x6927('0x18')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x56a7e1,_0x2b59c1[_0x6927('0xf')]);_0x4195b5[_0x6927('0x11')]();}}}catch(_0x2f271d){logger[_0x6927('0x18')](_0x6927('0xd'),_0x56a7e1,JSON[_0x6927('0x19')](_0x2f271d));_0x4195b5[_0x6927('0x11')]();}};}; \ No newline at end of file +var _0x1b40=['priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','validate','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','consequence','fromString','getMustacheRender','replace','length','map','message','join','stop','condition'];(function(_0x1e72f6,_0x1ed2b2){var _0x1ff183=function(_0x2b645e){while(--_0x2b645e){_0x1e72f6['push'](_0x1e72f6['shift']());}};_0x1ff183(++_0x1ed2b2);}(_0x1b40,0x105));var _0x01b4=function(_0x446208,_0xb483fb){_0x446208=_0x446208-0x0;var _0xe49563=_0x1b40[_0x446208];return _0xe49563;};'use strict';var schema=require(_0x01b4('0x0'));var _=require('lodash');var htmlToText=require(_0x01b4('0x1'));var utils=require(_0x01b4('0x2'));var logger=require(_0x01b4('0x3'))(_0x01b4('0x4'));var gotoif=schema({'condition':{'type':_0x01b4('0x5'),'required':!![],'message':_0x01b4('0x6')},'priorityTrue':{'type':_0x01b4('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x01b4('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x01b4('0x8')]=function(_0x5af89a,_0xd17ad4){return function(_0x44fc66){try{var _0x5bffd3={'condition':htmlToText[_0x01b4('0x9')](utils[_0x01b4('0xa')](_0xd17ad4[0x0],this),{'wordwrap':![]})[_0x01b4('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xd17ad4[0x1],'priorityFalse':_0xd17ad4[0x2]};var _0x101dfa=gotoif[_0x01b4('0x0')](_0x5bffd3,{'typecast':!![]});if(_0x101dfa[_0x01b4('0xc')]){logger['error']('[%s][GOTOIF]\x20%s',_0x5af89a,_[_0x01b4('0xd')](_0x101dfa,_0x01b4('0xe'))[_0x01b4('0xf')](',\x20'));_0x44fc66[_0x01b4('0x10')]();}else{try{var _0x40c144=eval('('+_0x5bffd3[_0x01b4('0x11')]+')');var _0x11d63e=_0x40c144?_0x5bffd3[_0x01b4('0x12')]:_0x5bffd3[_0x01b4('0x13')];logger['info'](_0x01b4('0x14'),_0x5af89a,_0x5bffd3[_0x01b4('0x11')],_0x40c144,_0x11d63e||'next');if(_0x11d63e){var _0x999837=_[_0x01b4('0x15')](_0x44fc66[_0x01b4('0x16')](),{'p':_0x11d63e});if(_0x999837>=0x0){logger[_0x01b4('0x17')](_0x01b4('0x18'),_0x5af89a,_0x11d63e||_0x01b4('0x19'),_0x999837);_0x44fc66['next'](_0x999837);}else{logger[_0x01b4('0x17')](_0x01b4('0x1a'),_0x5af89a,_0x11d63e||_0x01b4('0x19'));_0x44fc66['stop']();}}else{_0x44fc66['next']();}}catch(_0x3ea05b){logger[_0x01b4('0x1b')](_0x01b4('0x1c'),_0x5af89a,_0x3ea05b[_0x01b4('0xe')]);_0x44fc66[_0x01b4('0x10')]();}}}catch(_0x2aa90d){logger[_0x01b4('0x1b')](_0x01b4('0x1d'),_0x5af89a,JSON[_0x01b4('0x1e')](_0x2aa90d));_0x44fc66[_0x01b4('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index d06a3f2..d5d6d73 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 _0x8b46=['[%s][GOTOP]\x20%s','map','message','info','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','priority','stop','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error'];(function(_0x3df84f,_0xcfa89a){var _0x1d9163=function(_0x1d82f1){while(--_0x1d82f1){_0x3df84f['push'](_0x3df84f['shift']());}};_0x1d9163(++_0xcfa89a);}(_0x8b46,0x7d));var _0x68b4=function(_0x541916,_0x4f30de){_0x541916=_0x541916-0x0;var _0x1e1ae9=_0x8b46[_0x541916];return _0x1e1ae9;};'use strict';var schema=require(_0x68b4('0x0'));var _=require(_0x68b4('0x1'));var logger=require(_0x68b4('0x2'))(_0x68b4('0x3'));var gotop=schema({'priority':{'type':_0x68b4('0x4'),'required':!![],'message':_0x68b4('0x5')}});exports[_0x68b4('0x6')]=function(_0x4587c8,_0x41fe27){return function(_0x3f6903){try{var _0x169212={'priority':_0x41fe27[0x0]};var _0x41c265=gotop[_0x68b4('0x0')](_0x169212,{'typecast':!![]});if(_0x41c265['length']){logger[_0x68b4('0x7')](_0x68b4('0x8'),_0x4587c8,_[_0x68b4('0x9')](_0x41c265,_0x68b4('0xa'))['join'](',\x20'));_0x3f6903['stop']();}else{logger[_0x68b4('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x4587c8,_0x169212['priority']);if(_0x169212['priority']){var _0x1a5ba5=_[_0x68b4('0xc')](_0x3f6903['rules'](),{'p':_0x169212['priority']});if(_0x1a5ba5>=0x0){logger[_0x68b4('0xb')](_0x68b4('0xd'),_0x4587c8,_0x169212['priority']||_0x68b4('0xe'),_0x1a5ba5);_0x3f6903[_0x68b4('0xe')](_0x1a5ba5);}else{logger['info'](_0x68b4('0xf'),_0x4587c8,_0x169212[_0x68b4('0x10')]||_0x68b4('0xe'));_0x3f6903[_0x68b4('0x11')]();}}else{_0x3f6903['next']();}}}catch(_0x4d9ac5){logger['error'](_0x68b4('0x8'),_0x4587c8,JSON[_0x68b4('0x12')](_0x4d9ac5));_0x3f6903['stop']();}};}; \ No newline at end of file +var _0xcacc=['validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','map','message','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOP]\x20%s','stringify'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xcacc,0x12c));var _0xccac=function(_0x3572fb,_0x58be24){_0x3572fb=_0x3572fb-0x0;var _0x15b36b=_0xcacc[_0x3572fb];return _0x15b36b;};'use strict';var schema=require(_0xccac('0x0'));var _=require('lodash');var logger=require(_0xccac('0x1'))(_0xccac('0x2'));var gotop=schema({'priority':{'type':_0xccac('0x3'),'required':!![],'message':_0xccac('0x4')}});exports['consequence']=function(_0x3467d2,_0x3ebc6d){return function(_0x25c132){try{var _0x299edd={'priority':_0x3ebc6d[0x0]};var _0x10ac2a=gotop[_0xccac('0x0')](_0x299edd,{'typecast':!![]});if(_0x10ac2a[_0xccac('0x5')]){logger[_0xccac('0x6')]('[%s][GOTOP]\x20%s',_0x3467d2,_[_0xccac('0x7')](_0x10ac2a,_0xccac('0x8'))['join'](',\x20'));_0x25c132['stop']();}else{logger[_0xccac('0x9')](_0xccac('0xa'),_0x3467d2,_0x299edd[_0xccac('0xb')]);if(_0x299edd['priority']){var _0x5add39=_[_0xccac('0xc')](_0x25c132[_0xccac('0xd')](),{'p':_0x299edd['priority']});if(_0x5add39>=0x0){logger[_0xccac('0x9')](_0xccac('0xe'),_0x3467d2,_0x299edd[_0xccac('0xb')]||_0xccac('0xf'),_0x5add39);_0x25c132[_0xccac('0xf')](_0x5add39);}else{logger[_0xccac('0x9')](_0xccac('0x10'),_0x3467d2,_0x299edd['priority']||_0xccac('0xf'));_0x25c132[_0xccac('0x11')]();}}else{_0x25c132[_0xccac('0xf')]();}}}catch(_0x1a5fda){logger[_0xccac('0x6')](_0xccac('0x12'),_0x3467d2,JSON[_0xccac('0x13')](_0x1a5fda));_0x25c132[_0xccac('0x11')]();}};}; \ 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 1b649a0..12b8fc8 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 _0xb133=['Message','create','then','info','[%s][MESSAGE]\x20%s','next','error','stringify','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','channel','ChatWebsiteId','upperFirst','InteractionId','interaction'];(function(_0x4f66,_0x4c4a2e){var _0x4e3d42=function(_0xcbd4b0){while(--_0xcbd4b0){_0x4f66['push'](_0x4f66['shift']());}};_0x4e3d42(++_0x4c4a2e);}(_0xb133,0x134));var _0x3b13=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xb133[_0x29d94e];return _0x106237;};'use strict';var _=require(_0x3b13('0x0'));var utils=require(_0x3b13('0x1'));var logger=require('../../../../config/logger')(_0x3b13('0x2'));var rpc={'chatMessage':require(_0x3b13('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x3b13('0x4')),'smsMessage':require(_0x3b13('0x5')),'faxMessage':require(_0x3b13('0x6')),'whatsappMessage':require(_0x3b13('0x7'))};exports[_0x3b13('0x8')]=function(_0x23b197,_0x369c66){return function(_0xcf62b8){try{var _0x1f5dde={'body':utils['getMustacheRender'](_0x369c66[0x0],this),'ContactId':this['contact']['id']};if(this[_0x3b13('0x9')]==='chat'){_0x1f5dde[_0x3b13('0xa')]=this['account']['id'];}else{_0x1f5dde[_[_0x3b13('0xb')](this[_0x3b13('0x9')])+'AccountId']=this['account']['id'];}_0x1f5dde[_[_0x3b13('0xb')](this[_0x3b13('0x9')])+_0x3b13('0xc')]=this[_0x3b13('0xd')]['id'];if(rpc[this[_0x3b13('0x9')]+_0x3b13('0xe')]){return rpc[this[_0x3b13('0x9')]+'Message'][_0x3b13('0xf')](_0x1f5dde)[_0x3b13('0x10')](function(_0x5b2d68){logger[_0x3b13('0x11')](_0x3b13('0x12'),_0x23b197,_0x1f5dde['body']);_0xcf62b8[_0x3b13('0x13')]();})['catch'](function(_0x990e1a){logger[_0x3b13('0x14')](_0x3b13('0x12'),_0x23b197,JSON['stringify'](_0x990e1a));_0xcf62b8['stop']();});}}catch(_0x68917a){logger[_0x3b13('0x14')]('[%s][MESSAGE]\x20%s',_0x23b197,JSON[_0x3b13('0x15')](_0x68917a));_0xcf62b8[_0x3b13('0x16')]();}};}; \ No newline at end of file +var _0xb4e2=['stop','lodash','routing','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify'];(function(_0x1a8bdf,_0x35e8d4){var _0x175d62=function(_0x30e7e0){while(--_0x30e7e0){_0x1a8bdf['push'](_0x1a8bdf['shift']());}};_0x175d62(++_0x35e8d4);}(_0xb4e2,0x1aa));var _0x2b4e=function(_0x5f0430,_0x4245b0){_0x5f0430=_0x5f0430-0x0;var _0x5be551=_0xb4e2[_0x5f0430];return _0x5be551;};'use strict';var _=require(_0x2b4e('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x2b4e('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2b4e('0x2')),'faxMessage':require(_0x2b4e('0x3')),'whatsappMessage':require(_0x2b4e('0x4'))};exports[_0x2b4e('0x5')]=function(_0xf07f95,_0x1a77ed){return function(_0x10f028){try{var _0x4a84a9={'body':utils[_0x2b4e('0x6')](_0x1a77ed[0x0],this),'ContactId':this[_0x2b4e('0x7')]['id']};if(this[_0x2b4e('0x8')]===_0x2b4e('0x9')){_0x4a84a9[_0x2b4e('0xa')]=this[_0x2b4e('0xb')]['id'];}else{_0x4a84a9[_[_0x2b4e('0xc')](this[_0x2b4e('0x8')])+_0x2b4e('0xd')]=this[_0x2b4e('0xb')]['id'];}_0x4a84a9[_[_0x2b4e('0xc')](this[_0x2b4e('0x8')])+_0x2b4e('0xe')]=this[_0x2b4e('0xf')]['id'];if(rpc[this['channel']+_0x2b4e('0x10')]){return rpc[this[_0x2b4e('0x8')]+_0x2b4e('0x10')][_0x2b4e('0x11')](_0x4a84a9)['then'](function(_0x8531ed){logger['info'](_0x2b4e('0x12'),_0xf07f95,_0x4a84a9[_0x2b4e('0x13')]);_0x10f028[_0x2b4e('0x14')]();})[_0x2b4e('0x15')](function(_0x161666){logger[_0x2b4e('0x16')]('[%s][MESSAGE]\x20%s',_0xf07f95,JSON[_0x2b4e('0x17')](_0x161666));_0x10f028[_0x2b4e('0x18')]();});}}catch(_0x38f5ae){logger['error'](_0x2b4e('0x12'),_0xf07f95,JSON[_0x2b4e('0x17')](_0x38f5ae));_0x10f028['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 d06aff4..926d0e9 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 _0xc4b2=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','stringify','./utils','routing'];(function(_0x181d02,_0x3afce3){var _0x5f204d=function(_0xf79c67){while(--_0xf79c67){_0x181d02['push'](_0x181d02['shift']());}};_0x5f204d(++_0x3afce3);}(_0xc4b2,0x1ce));var _0x2c4b=function(_0xcfe8cc,_0xb83aeb){_0xcfe8cc=_0xcfe8cc-0x0;var _0x55ac53=_0xc4b2[_0xcfe8cc];return _0x55ac53;};'use strict';var utils=require(_0x2c4b('0x0'));var logger=require('../../../../config/logger')(_0x2c4b('0x1'));exports[_0x2c4b('0x2')]=function(_0x43976e,_0x328e44){return function(_0x4a5947){try{logger[_0x2c4b('0x3')](_0x2c4b('0x4'),_0x43976e,utils[_0x2c4b('0x5')](_0x328e44[0x0],this));_0x4a5947[_0x2c4b('0x6')]();}catch(_0x1a716e){logger['error']('[%s][NOOP]\x20%s',_0x43976e,JSON[_0x2c4b('0x7')](_0x1a716e));_0x4a5947['stop']();}};}; \ No newline at end of file +var _0x2a3e=['./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop'];(function(_0x579a5a,_0x48be20){var _0xb61335=function(_0x38316b){while(--_0x38316b){_0x579a5a['push'](_0x579a5a['shift']());}};_0xb61335(++_0x48be20);}(_0x2a3e,0x8f));var _0xe2a3=function(_0x3946e6,_0xcffb16){_0x3946e6=_0x3946e6-0x0;var _0x266778=_0x2a3e[_0x3946e6];return _0x266778;};'use strict';var utils=require(_0xe2a3('0x0'));var logger=require(_0xe2a3('0x1'))(_0xe2a3('0x2'));exports[_0xe2a3('0x3')]=function(_0x4bde02,_0x554721){return function(_0x3d7ed2){try{logger[_0xe2a3('0x4')](_0xe2a3('0x5'),_0x4bde02,utils[_0xe2a3('0x6')](_0x554721[0x0],this));_0x3d7ed2[_0xe2a3('0x7')]();}catch(_0x3dfa8c){logger[_0xe2a3('0x8')](_0xe2a3('0x5'),_0x4bde02,JSON[_0xe2a3('0x9')](_0x3dfa8c));_0x3d7ed2[_0xe2a3('0xa')]();}};}; \ 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 ddc7a40..05ce0cf 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 _0xe5d0=['queue_id','queue','joinAt','emit','account','push','InteractionId','pick','format','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/faxQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','then','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','validate','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','stack','lodash','util','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','redis','localhost'];(function(_0x57834a,_0xfac574){var _0x5788d9=function(_0x290392){while(--_0x290392){_0x57834a['push'](_0x57834a['shift']());}};_0x5788d9(++_0xfac574);}(_0xe5d0,0x19e));var _0x0e5d=function(_0x49eed8,_0x9aa73c){_0x49eed8=_0x49eed8-0x0;var _0x1b2667=_0xe5d0[_0x49eed8];return _0x1b2667;};'use strict';var schema=require('validate');var _=require(_0x0e5d('0x0'));var util=require(_0x0e5d('0x1'));var seqqueue=require('seq-queue');var moment=require(_0x0e5d('0x2'));var Redis=require(_0x0e5d('0x3'));var config=require(_0x0e5d('0x4'));var logger=require(_0x0e5d('0x5'))(_0x0e5d('0x6'));var strategy=require(_0x0e5d('0x7'));config['redis']=_[_0x0e5d('0x8')](config[_0x0e5d('0x9')],{'host':_0x0e5d('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0e5d('0x9')]));var attributes=['id',_0x0e5d('0xb'),'account',_0x0e5d('0xc'),'from',_0x0e5d('0xd')];function emit(_0x359e04,_0x2f6ff1,_0x271a58){io['to'](_0x359e04)[_0x0e5d('0xe')](_0x2f6ff1,_0x271a58);}function emitChannelQueueInteraction(_0x27612d,_0x1f4aef,_0xea4cf8,_0x5504ff,_0x108147,_0x363a93,_0x31d044,_0x5c45eb){var _0x23f491=_['clone'](_0xea4cf8);_0x23f491[_0x0e5d('0xb')]=_0x5c45eb;_0x23f491[_0x0e5d('0xc')]=_0x1f4aef;_0x23f491[_0x0e5d('0xf')]=_0x5504ff;_0x23f491['id']=_0x108147;if(_0x363a93){attributes[_0x0e5d('0x10')](_['capitalize'](_0x27612d)+_0x0e5d('0x11'));_0x31d044[util['format']('%sQueuesWaitingInteractions',_0x27612d)][_0x108147]=_[_0x0e5d('0x12')](_0x23f491,attributes);}else{delete _0x31d044[util[_0x0e5d('0x13')](_0x0e5d('0x14'),_0x27612d)][_0x108147];}emit(util['format']('%s:queue:%s',_0x27612d,_0x1f4aef),util[_0x0e5d('0x13')](_0x0e5d('0x15'),_0x27612d,_0x363a93?'save':'remove'),_[_0x0e5d('0x12')](_0x23f491,attributes));}var rpc={'openchannelQueueReport':require(_0x0e5d('0x16')),'mailQueueReport':require(_0x0e5d('0x17')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x0e5d('0x18')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require(_0x0e5d('0x19')),'faxInteraction':require(_0x0e5d('0x1a')),'mailInteraction':require(_0x0e5d('0x1b')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x0e5d('0x1c')),'whatsappInteraction':require(_0x0e5d('0x1d'))};var queue=schema({'name':{'type':_0x0e5d('0x1e'),'required':!![],'message':_0x0e5d('0x1f')},'timeout':{'type':_0x0e5d('0x20'),'message':_0x0e5d('0x21')}});function startRouting(_0x5c2c73,_0x4c9ae6,_0x5a3760,_0x2ed63c){if(_0x5c2c73&&_0x4c9ae6&&_0x5a3760){_0x4c9ae6['waiting']+=0x1;var _0x404c0d={'uniqueid':_0x5c2c73,'from':_0x5a3760[_0x0e5d('0x22')]?_0x5a3760[_0x0e5d('0x22')]['from']:'','joinAt':moment()[_0x0e5d('0x13')](_0x0e5d('0x23')),'ContactId':_0x5a3760[_0x0e5d('0x24')]?_0x5a3760[_0x0e5d('0x24')]['id']:null,'ListId':_0x5a3760['list']?_0x5a3760[_0x0e5d('0x25')]['id']:null};_0x404c0d[_[_0x0e5d('0x26')](_0x5a3760[_0x0e5d('0x27')])+_0x0e5d('0x28')]=_0x4c9ae6['id']||null;_0x404c0d[_[_0x0e5d('0x26')](_0x5a3760['channel'])+'InteractionId']=_0x5a3760[_0x0e5d('0x29')]?_0x5a3760[_0x0e5d('0x29')]['id']:null;_0x404c0d[_[_0x0e5d('0x26')](_0x5a3760['channel'])+_0x0e5d('0x2a')]=_0x5a3760[_0x0e5d('0x2b')]?_0x5a3760['message']['id']:null;_0x404c0d[_[_0x0e5d('0x26')](_0x5a3760[_0x0e5d('0x27')])+(_0x5a3760['channel']!==_0x0e5d('0x2c')?_0x0e5d('0x2d'):'WebsiteId')]=_0x5a3760[_0x0e5d('0xf')]?_0x5a3760['account']['id']:null;logger[_0x0e5d('0x2e')](util[_0x0e5d('0x13')](_0x0e5d('0x2f'),_0x5c2c73,_0x4c9ae6[_0x0e5d('0x30')]));emitChannelQueueInteraction(_0x5a3760[_0x0e5d('0x27')],_0x4c9ae6['name'],_0x404c0d,_0x5a3760[_0x0e5d('0xf')][_0x0e5d('0x30')],_0x5a3760[_0x0e5d('0x2b')]['id'],!![],_0x2ed63c,_0x4c9ae6['id']);if(rpc[_0x5a3760['channel']+_0x0e5d('0x31')]){return rpc[_0x5a3760[_0x0e5d('0x27')]+_0x0e5d('0x31')][_0x0e5d('0x32')](_0x404c0d)[_0x0e5d('0x33')](function(_0x2290ff){logger[_0x0e5d('0x34')](_0x0e5d('0x35'),_0x2290ff);});}}}function stopRouting(_0x589113,_0x40400e,_0x404db8,_0x1a0c9a){if(_0x589113&&_0x40400e){_0x40400e[_0x0e5d('0x36')]-=0x1;var _0x482d7d={'leaveAt':moment()[_0x0e5d('0x13')](_0x0e5d('0x23')),'acceptAt':moment()[_0x0e5d('0x13')](_0x0e5d('0x23')),'reason':_0x0e5d('0x37')};logger[_0x0e5d('0x2e')](util[_0x0e5d('0x13')](_0x0e5d('0x38'),_0x589113,_0x40400e[_0x0e5d('0x30')]));emitChannelQueueInteraction(_0x404db8[_0x0e5d('0x27')],_0x40400e[_0x0e5d('0x30')],_0x404db8[_0x0e5d('0x22')],_0x404db8[_0x0e5d('0xf')][_0x0e5d('0x30')],_0x404db8[_0x0e5d('0x2b')]['id'],![],_0x1a0c9a,_0x40400e['id']);return rpc[_0x404db8[_0x0e5d('0x27')]+_0x0e5d('0x39')]['update'](_0x404db8[_0x0e5d('0x29')]['id'],{'queueId':_0x40400e['id']})[_0x0e5d('0x3a')](function(){if(rpc[_0x404db8['channel']+_0x0e5d('0x31')]){return rpc[_0x404db8[_0x0e5d('0x27')]+_0x0e5d('0x31')][_0x0e5d('0x3b')](_0x589113,_0x482d7d)[_0x0e5d('0x33')](function(_0x53eb35){logger[_0x0e5d('0x34')](_0x0e5d('0x3c'),_0x53eb35);});}});}}function endRouting(_0xdb9974,_0x3fc3b,_0x40ea9c,_0x2948c4){if(_0xdb9974&&_0x3fc3b){_0x3fc3b[_0x0e5d('0x36')]-=0x1;var _0xadd1e3={'leaveAt':moment()[_0x0e5d('0x13')](_0x0e5d('0x23')),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x0e5d('0x3d')};logger['info'](util['format'](_0x0e5d('0x3e'),_0xdb9974,_0x3fc3b[_0x0e5d('0x30')]));emitChannelQueueInteraction(_0x40ea9c[_0x0e5d('0x27')],_0x3fc3b[_0x0e5d('0x30')],_0x40ea9c['body'],_0x40ea9c[_0x0e5d('0xf')][_0x0e5d('0x30')],_0x40ea9c['message']['id'],![],_0x2948c4);if(rpc[_0x40ea9c['channel']+_0x0e5d('0x31')]){return rpc[_0x40ea9c[_0x0e5d('0x27')]+_0x0e5d('0x31')][_0x0e5d('0x3b')](_0xdb9974,_0xadd1e3)[_0x0e5d('0x33')](function(_0x262734){logger[_0x0e5d('0x34')](_0x0e5d('0x3c'),_0x262734);});}}}function handleFindQueue(_0x37b544){return function(_0x58d524){return _0x58d524[_0x0e5d('0x30')][_0x0e5d('0x3f')]()===_0x37b544[_0x0e5d('0x3f')]();};}exports['consequence']=function(_0x418f2a,_0x30d699,_0x58f689,_0xcdec19){return function(_0x325fd1){try{var _0x930820={'name':_0x30d699[0x0],'timeout':_0x30d699[0x1]};var _0x339f08=queue[_0x0e5d('0x40')](_0x930820,{'typecast':!![]});if(_0x339f08[_0x0e5d('0x41')]){logger[_0x0e5d('0x34')](_0x0e5d('0x42'),_0x418f2a,_[_0x0e5d('0x43')](_0x339f08,'message')[_0x0e5d('0x44')](',\x20'));_0x325fd1[_0x0e5d('0x45')]();}else{var _0x317e0d=_[_0x0e5d('0x46')](_0x58f689[_0xcdec19[_0x0e5d('0x27')]+_0x0e5d('0x47')],handleFindQueue(_0x930820['name']));if(_0x317e0d){startRouting(_0x418f2a,_0x317e0d,_0xcdec19,_0x58f689);var _0x34ba40=(_0x317e0d[_0x0e5d('0x3d')]||0xa)*0x3e8;var _0x46b992=(_0x930820[_0x0e5d('0x3d')]||0x14)*0x3e8;var _0xa63146;if(_0x34ba40>_0x46b992){_0x46b992=_0x34ba40;}var _0x946c46=seqqueue[_0x0e5d('0x48')](_0x34ba40);_0x946c46['id']=_0x418f2a;_0x946c46[_0x0e5d('0x49')]=_0x34ba40;_0x946c46[_0x0e5d('0x4a')]=_0x46b992;_0x946c46[_0x0e5d('0x27')]=_0xcdec19[_0x0e5d('0x27')];_0x58f689['rules'][_0x418f2a]['on'](_0x0e5d('0x4b'),function(){logger['info'](_0x0e5d('0x4c'),_0x418f2a);stopRouting(_0x418f2a,_0x317e0d,_0xcdec19,_0x58f689);clearTimeout(_0xa63146);_0xa63146=undefined;_0x946c46[_0x0e5d('0x4d')](!![]);if(_0x58f689[_0x0e5d('0x4e')][_0x418f2a]){delete _0x58f689[_0x0e5d('0x4e')][_0x418f2a];}_0x325fd1[_0x0e5d('0x45')]();});_0x58f689[_0x0e5d('0x4e')][_0x418f2a]['on'](_0x0e5d('0x4f'),function(){if(_0x58f689[_0x0e5d('0x4e')][_0x418f2a]){delete _0x58f689['rules'][_0x418f2a];}});_0xa63146=setTimeout(function(){logger[_0x0e5d('0x2e')](_0x0e5d('0x50'),_0x418f2a);endRouting(_0x418f2a,_0x317e0d,_0xcdec19,_0x58f689);clearTimeout(_0xa63146);_0x946c46[_0x0e5d('0x4d')](!![]);_0x325fd1[_0x0e5d('0x51')]();},_0x46b992);switch(_0x317e0d['strategy']){case _0x0e5d('0x52'):strategy['rrmemory'](_0x946c46,_0x317e0d,_0x58f689,_0xcdec19);break;default:strategy[_0x0e5d('0x53')](_0x946c46,_0x317e0d,_0x58f689,_0xcdec19);}}else{logger[_0x0e5d('0x34')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x418f2a,_0x930820[_0x0e5d('0x30')]);_0x325fd1[_0x0e5d('0x45')]();}}}catch(_0x15be9a){logger[_0x0e5d('0x34')]('[%s][QUEUE]\x20%s',_0x418f2a,_0x15be9a[_0x0e5d('0x54')]);_0x325fd1[_0x0e5d('0x45')]();}};}; \ No newline at end of file +var _0x825f=['validate','length','map','stop','find','Queues','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20%s','stack','lodash','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','queue_id','account','queue','from','joinAt','clone','push','capitalize','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','string','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','InteractionId','interaction','MessageId','message','chat','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','timeout','info','[%s][END:QUEUE][NAME:%s]','toLowerCase'];(function(_0x21c6b8,_0x16d6f6){var _0x39d474=function(_0x27dbf5){while(--_0x27dbf5){_0x21c6b8['push'](_0x21c6b8['shift']());}};_0x39d474(++_0x16d6f6);}(_0x825f,0xbc));var _0xf825=function(_0x10f6b7,_0x1abfcd){_0x10f6b7=_0x10f6b7-0x0;var _0x507c6e=_0x825f[_0x10f6b7];return _0x507c6e;};'use strict';var schema=require('validate');var _=require(_0xf825('0x0'));var util=require('util');var seqqueue=require(_0xf825('0x1'));var moment=require(_0xf825('0x2'));var Redis=require(_0xf825('0x3'));var config=require(_0xf825('0x4'));var logger=require(_0xf825('0x5'))(_0xf825('0x6'));var strategy=require('./strategy');config[_0xf825('0x7')]=_[_0xf825('0x8')](config[_0xf825('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id',_0xf825('0x9'),_0xf825('0xa'),_0xf825('0xb'),_0xf825('0xc'),_0xf825('0xd')];function emit(_0x555857,_0x1f026a,_0x4e5b53){io['to'](_0x555857)['emit'](_0x1f026a,_0x4e5b53);}function emitChannelQueueInteraction(_0x58cb5b,_0x19ce5a,_0x458f43,_0x3f1f2f,_0x1266de,_0x3245a1,_0x14b5e6,_0x5a838c){var _0x339de9=_[_0xf825('0xe')](_0x458f43);_0x339de9[_0xf825('0x9')]=_0x5a838c;_0x339de9[_0xf825('0xb')]=_0x19ce5a;_0x339de9[_0xf825('0xa')]=_0x3f1f2f;_0x339de9['id']=_0x1266de;if(_0x3245a1){attributes[_0xf825('0xf')](_[_0xf825('0x10')](_0x58cb5b)+'InteractionId');_0x14b5e6[util[_0xf825('0x11')](_0xf825('0x12'),_0x58cb5b)][_0x1266de]=_['pick'](_0x339de9,attributes);}else{delete _0x14b5e6[util[_0xf825('0x11')](_0xf825('0x12'),_0x58cb5b)][_0x1266de];}emit(util[_0xf825('0x11')](_0xf825('0x13'),_0x58cb5b,_0x19ce5a),util[_0xf825('0x11')](_0xf825('0x14'),_0x58cb5b,_0x3245a1?_0xf825('0x15'):_0xf825('0x16')),_[_0xf825('0x17')](_0x339de9,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xf825('0x18')),'chatQueueReport':require(_0xf825('0x19')),'smsQueueReport':require(_0xf825('0x1a')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xf825('0x1b')),'chatInteraction':require(_0xf825('0x1c')),'faxInteraction':require(_0xf825('0x1d')),'mailInteraction':require(_0xf825('0x1e')),'openchannelInteraction':require(_0xf825('0x1f')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0xf825('0x20'))};var queue=schema({'name':{'type':_0xf825('0x21'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x46ff04,_0x54169d,_0x279f6a,_0x5b2263){if(_0x46ff04&&_0x54169d&&_0x279f6a){_0x54169d[_0xf825('0x22')]+=0x1;var _0x227e47={'uniqueid':_0x46ff04,'from':_0x279f6a['body']?_0x279f6a[_0xf825('0x23')][_0xf825('0xc')]:'','joinAt':moment()[_0xf825('0x11')](_0xf825('0x24')),'ContactId':_0x279f6a[_0xf825('0x25')]?_0x279f6a[_0xf825('0x25')]['id']:null,'ListId':_0x279f6a[_0xf825('0x26')]?_0x279f6a[_0xf825('0x26')]['id']:null};_0x227e47[_[_0xf825('0x27')](_0x279f6a['channel'])+_0xf825('0x28')]=_0x54169d['id']||null;_0x227e47[_[_0xf825('0x27')](_0x279f6a[_0xf825('0x29')])+_0xf825('0x2a')]=_0x279f6a['interaction']?_0x279f6a[_0xf825('0x2b')]['id']:null;_0x227e47[_[_0xf825('0x27')](_0x279f6a[_0xf825('0x29')])+_0xf825('0x2c')]=_0x279f6a[_0xf825('0x2d')]?_0x279f6a[_0xf825('0x2d')]['id']:null;_0x227e47[_[_0xf825('0x27')](_0x279f6a[_0xf825('0x29')])+(_0x279f6a[_0xf825('0x29')]!==_0xf825('0x2e')?'AccountId':_0xf825('0x2f'))]=_0x279f6a['account']?_0x279f6a[_0xf825('0xa')]['id']:null;logger['info'](util['format'](_0xf825('0x30'),_0x46ff04,_0x54169d[_0xf825('0x31')]));emitChannelQueueInteraction(_0x279f6a['channel'],_0x54169d[_0xf825('0x31')],_0x227e47,_0x279f6a[_0xf825('0xa')][_0xf825('0x31')],_0x279f6a[_0xf825('0x2d')]['id'],!![],_0x5b2263,_0x54169d['id']);if(rpc[_0x279f6a[_0xf825('0x29')]+_0xf825('0x32')]){return rpc[_0x279f6a[_0xf825('0x29')]+'QueueReport'][_0xf825('0x33')](_0x227e47)[_0xf825('0x34')](function(_0x3ceaf7){logger[_0xf825('0x35')]('create\x20queue\x20report',_0x3ceaf7);});}}}function stopRouting(_0x3a7880,_0x24b7b8,_0x120c8d,_0x138c38){if(_0x3a7880&&_0x24b7b8){_0x24b7b8['waiting']-=0x1;var _0x1f8c03={'leaveAt':moment()[_0xf825('0x11')](_0xf825('0x24')),'acceptAt':moment()[_0xf825('0x11')](_0xf825('0x24')),'reason':_0xf825('0x36')};logger['info'](util[_0xf825('0x11')](_0xf825('0x37'),_0x3a7880,_0x24b7b8[_0xf825('0x31')]));emitChannelQueueInteraction(_0x120c8d['channel'],_0x24b7b8[_0xf825('0x31')],_0x120c8d[_0xf825('0x23')],_0x120c8d['account'][_0xf825('0x31')],_0x120c8d['message']['id'],![],_0x138c38,_0x24b7b8['id']);return rpc[_0x120c8d['channel']+_0xf825('0x38')][_0xf825('0x39')](_0x120c8d[_0xf825('0x2b')]['id'],{'queueId':_0x24b7b8['id']})[_0xf825('0x3a')](function(){if(rpc[_0x120c8d[_0xf825('0x29')]+_0xf825('0x32')]){return rpc[_0x120c8d['channel']+_0xf825('0x32')][_0xf825('0x39')](_0x3a7880,_0x1f8c03)[_0xf825('0x34')](function(_0x1cbdeb){logger['error'](_0xf825('0x3b'),_0x1cbdeb);});}});}}function endRouting(_0x3a971f,_0x4ccf9e,_0x5e6097,_0x4101e8){if(_0x3a971f&&_0x4ccf9e){_0x4ccf9e['waiting']-=0x1;var _0x43dec4={'leaveAt':moment()[_0xf825('0x11')](_0xf825('0x24')),'exitAt':moment()[_0xf825('0x11')](_0xf825('0x24')),'reason':_0xf825('0x3c')};logger[_0xf825('0x3d')](util['format'](_0xf825('0x3e'),_0x3a971f,_0x4ccf9e[_0xf825('0x31')]));emitChannelQueueInteraction(_0x5e6097['channel'],_0x4ccf9e[_0xf825('0x31')],_0x5e6097[_0xf825('0x23')],_0x5e6097['account'][_0xf825('0x31')],_0x5e6097[_0xf825('0x2d')]['id'],![],_0x4101e8);if(rpc[_0x5e6097[_0xf825('0x29')]+_0xf825('0x32')]){return rpc[_0x5e6097['channel']+_0xf825('0x32')][_0xf825('0x39')](_0x3a971f,_0x43dec4)[_0xf825('0x34')](function(_0x231ddb){logger['error'](_0xf825('0x3b'),_0x231ddb);});}}}function handleFindQueue(_0x543bb3){return function(_0x229e56){return _0x229e56[_0xf825('0x31')][_0xf825('0x3f')]()===_0x543bb3[_0xf825('0x3f')]();};}exports['consequence']=function(_0x2b2ba7,_0x368a94,_0x7b934d,_0x58b61a){return function(_0x368429){try{var _0x370b65={'name':_0x368a94[0x0],'timeout':_0x368a94[0x1]};var _0x31b0f3=queue[_0xf825('0x40')](_0x370b65,{'typecast':!![]});if(_0x31b0f3[_0xf825('0x41')]){logger[_0xf825('0x35')]('[%s][QUEUE]\x20%s',_0x2b2ba7,_[_0xf825('0x42')](_0x31b0f3,'message')['join'](',\x20'));_0x368429[_0xf825('0x43')]();}else{var _0x481cfd=_[_0xf825('0x44')](_0x7b934d[_0x58b61a[_0xf825('0x29')]+_0xf825('0x45')],handleFindQueue(_0x370b65[_0xf825('0x31')]));if(_0x481cfd){startRouting(_0x2b2ba7,_0x481cfd,_0x58b61a,_0x7b934d);var _0x32eac7=(_0x481cfd['timeout']||0xa)*0x3e8;var _0xdb82d0=(_0x370b65[_0xf825('0x3c')]||0x14)*0x3e8;var _0x5f25c6;if(_0x32eac7>_0xdb82d0){_0xdb82d0=_0x32eac7;}var _0x157778=seqqueue['createQueue'](_0x32eac7);_0x157778['id']=_0x2b2ba7;_0x157778[_0xf825('0x46')]=_0x32eac7;_0x157778[_0xf825('0x47')]=_0xdb82d0;_0x157778['channel']=_0x58b61a[_0xf825('0x29')];_0x7b934d[_0xf825('0x48')][_0x2b2ba7]['on'](_0xf825('0x49'),function(){logger[_0xf825('0x3d')](_0xf825('0x4a'),_0x2b2ba7);stopRouting(_0x2b2ba7,_0x481cfd,_0x58b61a,_0x7b934d);clearTimeout(_0x5f25c6);_0x5f25c6=undefined;_0x157778[_0xf825('0x4b')](!![]);if(_0x7b934d[_0xf825('0x48')][_0x2b2ba7]){delete _0x7b934d[_0xf825('0x48')][_0x2b2ba7];}_0x368429[_0xf825('0x43')]();});_0x7b934d[_0xf825('0x48')][_0x2b2ba7]['on'](_0xf825('0x4c'),function(){if(_0x7b934d['rules'][_0x2b2ba7]){delete _0x7b934d[_0xf825('0x48')][_0x2b2ba7];}});_0x5f25c6=setTimeout(function(){logger[_0xf825('0x3d')](_0xf825('0x4d'),_0x2b2ba7);endRouting(_0x2b2ba7,_0x481cfd,_0x58b61a,_0x7b934d);clearTimeout(_0x5f25c6);_0x157778['close'](!![]);_0x368429[_0xf825('0x4e')]();},_0xdb82d0);switch(_0x481cfd[_0xf825('0x4f')]){case _0xf825('0x50'):strategy[_0xf825('0x50')](_0x157778,_0x481cfd,_0x7b934d,_0x58b61a);break;default:strategy[_0xf825('0x51')](_0x157778,_0x481cfd,_0x7b934d,_0x58b61a);}}else{logger[_0xf825('0x35')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x2b2ba7,_0x370b65[_0xf825('0x31')]);_0x368429['stop']();}}}catch(_0xb084b6){logger[_0xf825('0x35')](_0xf825('0x52'),_0x2b2ba7,_0xb084b6[_0xf825('0x53')]);_0x368429[_0xf825('0x43')]();}};}; \ 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 6630f62..d0d5500 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 _0x0a9a=['writeLog','STOP','exports','uuid','../../../../../config/logger','routing','notificationId','agent','realtime','squeue','handleRun','handleTimeout','bind','timeout','prototype','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','push','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','removeWaitingNotification'];(function(_0xb5c1e6,_0x14e1ec){var _0x5a90aa=function(_0x5305ed){while(--_0x5305ed){_0xb5c1e6['push'](_0xb5c1e6['shift']());}};_0x5a90aa(++_0x14e1ec);}(_0x0a9a,0x183));var _0xa0a9=function(_0x413759,_0x1dddfe){_0x413759=_0x413759-0x0;var _0x54287d=_0x0a9a[_0x413759];return _0x54287d;};'use strict';var _=require('lodash');var uuid=require(_0xa0a9('0x0'));var util=require('./util');var logger=require(_0xa0a9('0x1'))(_0xa0a9('0x2'));var Agent=function(_0x34801b,_0x49162f,_0x4ba993,_0x317a94){this[_0xa0a9('0x3')]=uuid['v4']();this['squeue']=_0x34801b;this[_0xa0a9('0x4')]=_0x49162f;this[_0xa0a9('0x5')]=_0x4ba993;this[_0xa0a9('0x2')]=_0x317a94;this[_0xa0a9('0x6')]['push'](this[_0xa0a9('0x7')]['bind'](this),this[_0xa0a9('0x8')][_0xa0a9('0x9')](this));this[_0xa0a9('0x6')]['on'](_0xa0a9('0xa'),this['handleTimeout'][_0xa0a9('0x9')](this));this[_0xa0a9('0x6')]['on']('drained',this['handleDrained'][_0xa0a9('0x9')](this));};Agent[_0xa0a9('0xb')]['push']=function(){this[_0xa0a9('0x6')]['push'](this[_0xa0a9('0x7')]['bind'](this),this[_0xa0a9('0x8')][_0xa0a9('0x9')](this));};Agent[_0xa0a9('0xb')][_0xa0a9('0xc')]=function(){this[_0xa0a9('0x8')](!![]);};Agent['prototype'][_0xa0a9('0x7')]=function(){logger[_0xa0a9('0xd')](_0xa0a9('0xe'),this[_0xa0a9('0x6')]['id'],this[_0xa0a9('0x4')]['id']);if(_[_0xa0a9('0xf')](this['realtime'][_0xa0a9('0x10')][this['agent']['id']])){logger['debug'](_0xa0a9('0x11'),this[_0xa0a9('0x6')]['id'],this[_0xa0a9('0x4')]['id']);setTimeout(this[_0xa0a9('0x12')]['bind'](this),0x3e8);}else{if(this[_0xa0a9('0x2')][_0xa0a9('0x13')]||util[_0xa0a9('0x14')](this[_0xa0a9('0x6')]['id'],this[_0xa0a9('0x5')][_0xa0a9('0x10')][this['agent']['id']],this[_0xa0a9('0x6')][_0xa0a9('0x15')],![])){this['realtime']['agents'][this[_0xa0a9('0x4')]['id']][_0xa0a9('0x16')]=!![];this[_0xa0a9('0x5')]['agents'][this[_0xa0a9('0x4')]['id']]['busyQueue']=undefined;util[_0xa0a9('0x17')](this['realtime'],this[_0xa0a9('0x2')],this[_0xa0a9('0x4')],this[_0xa0a9('0x6')][_0xa0a9('0x15')]);util['showNotification'](this[_0xa0a9('0x3')],this['squeue']['id'],this[_0xa0a9('0x5')][_0xa0a9('0x10')][this[_0xa0a9('0x4')]['id']],null,this[_0xa0a9('0x2')]);util['writeLog'](this[_0xa0a9('0x6')]['id'],this[_0xa0a9('0x5')][_0xa0a9('0x10')][this[_0xa0a9('0x4')]['id']],'RINGING'+(this[_0xa0a9('0x2')][_0xa0a9('0x13')]?_0xa0a9('0x18'):''));}else{logger['debug']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xa0a9('0x6')]['id'],this[_0xa0a9('0x4')]['id']);setTimeout(this[_0xa0a9('0x12')][_0xa0a9('0x9')](this),0x3e8);}}};Agent[_0xa0a9('0xb')][_0xa0a9('0x8')]=function(_0x2386c9){if(_[_0xa0a9('0xf')](this[_0xa0a9('0x5')][_0xa0a9('0x10')][this[_0xa0a9('0x4')]['id']])){return logger['debug'](_0xa0a9('0x11'),this[_0xa0a9('0x6')]['id'],this['agent']['id']);}else{logger[_0xa0a9('0xd')](_0xa0a9('0x19'),this['squeue']['id'],this['agent']['id']);util[_0xa0a9('0x1a')](this['notificationId'],this['squeue']['id'],this[_0xa0a9('0x5')][_0xa0a9('0x10')][this[_0xa0a9('0x4')]['id']],null,this[_0xa0a9('0x2')]);this[_0xa0a9('0x5')][_0xa0a9('0x10')][this[_0xa0a9('0x4')]['id']]['busy']=![];this[_0xa0a9('0x5')][_0xa0a9('0x10')][this['agent']['id']][_0xa0a9('0x1b')]=undefined;util[_0xa0a9('0x1c')](this[_0xa0a9('0x5')],this['routing'],this['agent'],this[_0xa0a9('0x6')][_0xa0a9('0x15')]);util[_0xa0a9('0x1d')](this[_0xa0a9('0x6')]['id'],this['realtime'][_0xa0a9('0x10')][this[_0xa0a9('0x4')]['id']],_0x2386c9?_0xa0a9('0x1e'):'TIMEOUT');}if(!_0x2386c9){setTimeout(this[_0xa0a9('0x12')][_0xa0a9('0x9')](this),0x3e8);}};function agent(_0x4e121e,_0x53dfd1,_0x3ae735,_0x2ed673){return new Agent(_0x4e121e,_0x53dfd1,_0x3ae735,_0x2ed673);}module[_0xa0a9('0x1f')]=agent; \ No newline at end of file +var _0x3eea=['STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','bind','timeout','drained','prototype','handleRun','handleTimeout','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','channel','busy','busyQueue','saveWaitingNotification','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification'];(function(_0x2b8a92,_0x192f64){var _0x31f0da=function(_0x208455){while(--_0x208455){_0x2b8a92['push'](_0x2b8a92['shift']());}};_0x31f0da(++_0x192f64);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x15635c,_0x396341){_0x15635c=_0x15635c-0x0;var _0x3f391e=_0x3eea[_0x15635c];return _0x3f391e;};'use strict';var _=require(_0xa3ee('0x0'));var uuid=require('uuid');var util=require(_0xa3ee('0x1'));var logger=require(_0xa3ee('0x2'))(_0xa3ee('0x3'));var Agent=function(_0x1c6a49,_0x46acfa,_0x269141,_0x104913){this[_0xa3ee('0x4')]=uuid['v4']();this[_0xa3ee('0x5')]=_0x1c6a49;this[_0xa3ee('0x6')]=_0x46acfa;this[_0xa3ee('0x7')]=_0x269141;this['routing']=_0x104913;this['squeue'][_0xa3ee('0x8')](this['handleRun'][_0xa3ee('0x9')](this),this['handleTimeout'][_0xa3ee('0x9')](this));this['squeue']['on'](_0xa3ee('0xa'),this['handleTimeout'][_0xa3ee('0x9')](this));this[_0xa3ee('0x5')]['on'](_0xa3ee('0xb'),this['handleDrained'][_0xa3ee('0x9')](this));};Agent[_0xa3ee('0xc')]['push']=function(){this['squeue'][_0xa3ee('0x8')](this[_0xa3ee('0xd')][_0xa3ee('0x9')](this),this[_0xa3ee('0xe')]['bind'](this));};Agent[_0xa3ee('0xc')]['handleDrained']=function(){this[_0xa3ee('0xe')](!![]);};Agent[_0xa3ee('0xc')][_0xa3ee('0xd')]=function(){logger[_0xa3ee('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xa3ee('0x5')]['id'],this[_0xa3ee('0x6')]['id']);if(_['isNil'](this['realtime']['agents'][this[_0xa3ee('0x6')]['id']])){logger[_0xa3ee('0xf')](_0xa3ee('0x10'),this[_0xa3ee('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xa3ee('0x8')][_0xa3ee('0x9')](this),0x3e8);}else{if(this[_0xa3ee('0x3')][_0xa3ee('0x11')]||util[_0xa3ee('0x12')](this['squeue']['id'],this[_0xa3ee('0x7')][_0xa3ee('0x13')][this[_0xa3ee('0x6')]['id']],this[_0xa3ee('0x5')][_0xa3ee('0x14')],![])){this[_0xa3ee('0x7')]['agents'][this[_0xa3ee('0x6')]['id']][_0xa3ee('0x15')]=!![];this['realtime'][_0xa3ee('0x13')][this['agent']['id']][_0xa3ee('0x16')]=undefined;util[_0xa3ee('0x17')](this[_0xa3ee('0x7')],this[_0xa3ee('0x3')],this[_0xa3ee('0x6')],this[_0xa3ee('0x5')][_0xa3ee('0x14')]);util[_0xa3ee('0x18')](this[_0xa3ee('0x4')],this[_0xa3ee('0x5')]['id'],this['realtime'][_0xa3ee('0x13')][this[_0xa3ee('0x6')]['id']],null,this[_0xa3ee('0x3')]);util[_0xa3ee('0x19')](this[_0xa3ee('0x5')]['id'],this['realtime'][_0xa3ee('0x13')][this[_0xa3ee('0x6')]['id']],_0xa3ee('0x1a')+(this[_0xa3ee('0x3')][_0xa3ee('0x11')]?_0xa3ee('0x1b'):''));}else{logger[_0xa3ee('0xf')](_0xa3ee('0x1c'),this[_0xa3ee('0x5')]['id'],this[_0xa3ee('0x6')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent['prototype'][_0xa3ee('0xe')]=function(_0x481358){if(_[_0xa3ee('0x1d')](this[_0xa3ee('0x7')][_0xa3ee('0x13')][this[_0xa3ee('0x6')]['id']])){return logger[_0xa3ee('0xf')](_0xa3ee('0x10'),this[_0xa3ee('0x5')]['id'],this[_0xa3ee('0x6')]['id']);}else{logger[_0xa3ee('0xf')](_0xa3ee('0x1e'),this['squeue']['id'],this[_0xa3ee('0x6')]['id']);util['hideNotification'](this[_0xa3ee('0x4')],this[_0xa3ee('0x5')]['id'],this['realtime'][_0xa3ee('0x13')][this['agent']['id']],null,this[_0xa3ee('0x3')]);this['realtime'][_0xa3ee('0x13')][this[_0xa3ee('0x6')]['id']][_0xa3ee('0x15')]=![];this[_0xa3ee('0x7')][_0xa3ee('0x13')][this['agent']['id']][_0xa3ee('0x16')]=undefined;util[_0xa3ee('0x1f')](this[_0xa3ee('0x7')],this['routing'],this[_0xa3ee('0x6')],this['squeue'][_0xa3ee('0x14')]);util['writeLog'](this[_0xa3ee('0x5')]['id'],this['realtime'][_0xa3ee('0x13')][this[_0xa3ee('0x6')]['id']],_0x481358?_0xa3ee('0x20'):_0xa3ee('0x21'));}if(!_0x481358){setTimeout(this[_0xa3ee('0x8')][_0xa3ee('0x9')](this),0x3e8);}};function agent(_0xcc8e71,_0x42c66f,_0x256c63,_0x218317){return new Agent(_0xcc8e71,_0x42c66f,_0x256c63,_0x218317);}module[_0xa3ee('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 35bc19a..090491a 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 _0xf523=['channel','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','busyQueue','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','queue','routing','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','isNil','length','Agents','realtime','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','writeLog','RINGING','name','saveWaitingNotification'];(function(_0x1be486,_0x142902){var _0xf1e0e0=function(_0x34e946){while(--_0x34e946){_0x1be486['push'](_0x1be486['shift']());}};_0xf1e0e0(++_0x142902);}(_0xf523,0x1c5));var _0x3f52=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf523[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3f52('0x0'));var uuid=require(_0x3f52('0x1'));var util=require(_0x3f52('0x2'));var logger=require(_0x3f52('0x3'))('routing');var Beepall=function(_0x2d92b0,_0x271e6a,_0xe77637,_0x16cb8d){this[_0x3f52('0x4')]=uuid['v4']();this[_0x3f52('0x5')]=_0x2d92b0;this[_0x3f52('0x6')]=_0x271e6a;this['realtime']=_0xe77637;this[_0x3f52('0x7')]=_0x16cb8d;this[_0x3f52('0x5')][_0x3f52('0x8')](this[_0x3f52('0x9')][_0x3f52('0xa')](this),this[_0x3f52('0xb')][_0x3f52('0xa')](this));this[_0x3f52('0x5')]['on'](_0x3f52('0xc'),this[_0x3f52('0xb')][_0x3f52('0xa')](this));this[_0x3f52('0x5')]['on'](_0x3f52('0xd'),this[_0x3f52('0xe')][_0x3f52('0xa')](this));};Beepall['prototype'][_0x3f52('0x8')]=function(){this[_0x3f52('0x5')][_0x3f52('0x8')](this[_0x3f52('0x9')][_0x3f52('0xa')](this),this[_0x3f52('0xb')][_0x3f52('0xa')](this));};Beepall[_0x3f52('0xf')][_0x3f52('0xe')]=function(){this[_0x3f52('0xb')](!![]);};Beepall[_0x3f52('0xf')][_0x3f52('0x9')]=function(){var _0x16ef1b=!![];if(!_[_0x3f52('0x10')](this[_0x3f52('0x6')])&&!_[_0x3f52('0x10')](this[_0x3f52('0x6')]['Agents'])&&this['queue']['Agents'][_0x3f52('0x11')]>0x0){for(var _0x5b0f91=0x0,_0x442070;_0x5b0f910x0){for(var _0x207ea7=0x0,_0x261078;_0x207ea70x0&&_0x3a544d[_0x4d706e+'CurrentCapacity']>=_0x3a544d[_0x4d706e+_0x7479('0x21')]){writeLog(_0x44cc8a,_0x3a544d,_0x4d706e[_0x7479('0x22')]()+_0x7479('0x23'));return![];}}return!![];};exports[_0x7479('0x24')]=function(_0x5ee81f,_0xfa9c5b,_0x3a6cc9,_0x1a12ea,_0x42725d){return sendNotification(!![],_0x5ee81f,_0xfa9c5b,_0x3a6cc9,_0x1a12ea,_0x42725d);};exports[_0x7479('0x25')]=function(_0x2eec15,_0xa3f65b,_0x3c9eab,_0x12a514,_0x276556){return sendNotification(![],_0x2eec15,_0xa3f65b,_0x3c9eab,_0x12a514,_0x276556);};exports['checkWaitingNotifications']=function(_0x20a78f,_0x2618b8,_0x5b073c){var _0x1fae91=_0x2618b8['interaction'][_0x7479('0x26')];if(!_0x1fae91&&_0x5b073c){_0x1fae91=_0x5b073c['id'];}var _0x4db967=_[_0x7479('0x27')](_0x20a78f[_0x2618b8['channel']+_0x7479('0x28')],function(_0x2e97b0){var _0x4338ed=_[_0x7479('0x29')](_0x2618b8[_0x7479('0x2a')])+_0x7479('0x2b');return _0x2e97b0[_0x4338ed]===_0x2618b8[_0x7479('0x2c')]['id'];});if(!_0x4db967&&_0x1fae91&&_0x20a78f[_0x7479('0x2d')][_0x1fae91]){_0x4db967=_[_0x7479('0x27')](_0x20a78f[_0x7479('0x2d')][_0x1fae91][_0x2618b8[_0x7479('0x2a')]+_0x7479('0x2e')],function(_0x7c39b5){return _0x7c39b5['id']===_0x2618b8['interaction']['id'];});}return _0x4db967;};exports[_0x7479('0x2f')]=function(_0x186423,_0x7f6a28,_0x29ee7d,_0x156a61){if(_0x29ee7d&&_0x29ee7d['id']&&_0x186423[_0x7479('0x2d')]&&_0x186423[_0x7479('0x2d')][_0x29ee7d['id']]){_0x186423[_0x7479('0x2d')][_0x29ee7d['id']][_0x156a61+_0x7479('0x2e')][_0x7f6a28['message']['id']]={'id':_0x7f6a28[_0x7479('0x2c')]['id']};}};exports[_0x7479('0x30')]=function(_0xc4aa3d,_0x38efa7,_0x505f9a,_0x36b91c){if(_0x505f9a&&_0x505f9a['id']&&_0xc4aa3d[_0x7479('0x2d')]&&_0xc4aa3d['agents'][_0x505f9a['id']]){delete _0xc4aa3d[_0x7479('0x2d')][_0x505f9a['id']][_0x36b91c+_0x7479('0x2e')][_0x38efa7[_0x7479('0x13')]['id']];}};exports[_0x7479('0x31')]=writeLog; \ No newline at end of file +var _0xecf5=['\x20interaction','name','account','notificationSound','body','queue','msg','getMustacheRender','notificationTemplate','error','[%s][QUEUE]\x20%s','format','user:%s','emit','notification:%s','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','online','OFFLINE','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','some','channel','capitalize','InteractionId','interaction','agents','WaitingInteractions','message','removeWaitingNotification','util','../utils','../../../../../config/environment','../../../../../config/logger','redis','localhost','socket.io-emitter'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xecf5,0x1c5));var _0x5ecf=function(_0x40ea4b,_0x2c6a87){_0x40ea4b=_0x40ea4b-0x0;var _0x41a42b=_0xecf5[_0x40ea4b];return _0x41a42b;};'use strict';var _=require('lodash');var util=require(_0x5ecf('0x0'));var utils=require(_0x5ecf('0x1'));var Redis=require('ioredis');var config=require(_0x5ecf('0x2'));var logger=require(_0x5ecf('0x3'))('routing');config['redis']=_['defaults'](config[_0x5ecf('0x4')],{'host':_0x5ecf('0x5'),'port':0x18eb});var io=require(_0x5ecf('0x6'))(new Redis(config[_0x5ecf('0x4')]));function sendNotification(_0x22a122,_0x2d5a17,_0x4af53e,_0x4972e3,_0x5d89af,_0x99e0d1){var _0x1d4cad=_0x99e0d1||{};var _0x3111c1=_0x4af53e['split']('.');var _0x28257a={'uniqueid':_0x2d5a17,'channel':_0x3111c1[0x0],'id':_0x3111c1[0x1],'title':_0x3111c1[0x0]+_0x5ecf('0x7'),'interactionId':_0x3111c1[0x2],'queue':_0x5d89af?_0x5d89af[_0x5ecf('0x8')]:null,'sound':_0x1d4cad[_0x5ecf('0x9')][_0x5ecf('0xa')],'shake':_0x1d4cad['account']['notificationShake']};try{if(!_0x1d4cad[_0x5ecf('0xb')]){_0x1d4cad[_0x5ecf('0xb')]={};}if(_0x5d89af){_0x1d4cad[_0x5ecf('0xb')][_0x5ecf('0xc')]=_0x5d89af;}else if(_0x1d4cad[_0x5ecf('0xb')]['queue']){delete _0x1d4cad['body'][_0x5ecf('0xc')];}_0x28257a[_0x5ecf('0xd')]=utils[_0x5ecf('0xe')](_0x1d4cad['account'][_0x5ecf('0xf')],_0x1d4cad);}catch(_0x9ead61){_0x28257a['msg']='I\x20can\x27t\x20render\x20your\x20template';logger[_0x5ecf('0x10')](util['format'](_0x5ecf('0x11'),_0x2d5a17,_0x9ead61['message']));}io['to'](util[_0x5ecf('0x12')](_0x5ecf('0x13'),_0x4972e3[_0x5ecf('0x8')]))[_0x5ecf('0x14')](util['format'](_0x5ecf('0x15'),_0x22a122?'save':'remove'),_0x28257a);}function writeLog(_0x190f90,_0x2e408e,_0x2b5ad9){return logger[_0x5ecf('0x16')](util[_0x5ecf('0x12')](_0x5ecf('0x17'),_0x190f90,_0x2e408e[_0x5ecf('0x8')],_0x2b5ad9));}exports['isAgentAvailable']=function(_0x59fe12,_0x35a74a,_0x49fff9,_0x13d928){if(_0x35a74a[_0x5ecf('0x18')]){writeLog(_0x59fe12,_0x35a74a,'BUSY');return![];}if(!_0x35a74a[_0x5ecf('0x19')]){writeLog(_0x59fe12,_0x35a74a,_0x5ecf('0x1a'));return![];}if(_0x35a74a[_0x49fff9+_0x5ecf('0x1b')]){writeLog(_0x59fe12,_0x35a74a,_0x5ecf('0x1c'));return![];}if(_0x13d928&&_0x35a74a['hasOwnProperty'](_0x49fff9+'Capacity')&&_0x35a74a[_0x5ecf('0x1d')](_0x49fff9+_0x5ecf('0x1e'))){if(_0x35a74a[_0x49fff9+_0x5ecf('0x1f')]>0x0&&_0x35a74a[_0x49fff9+'CurrentCapacity']>=_0x35a74a[_0x49fff9+_0x5ecf('0x1f')]){writeLog(_0x59fe12,_0x35a74a,_0x49fff9[_0x5ecf('0x20')]()+_0x5ecf('0x21'));return![];}}return!![];};exports[_0x5ecf('0x22')]=function(_0x3b6390,_0x44f18d,_0x15b163,_0x137e90,_0x11d12a){return sendNotification(!![],_0x3b6390,_0x44f18d,_0x15b163,_0x137e90,_0x11d12a);};exports[_0x5ecf('0x23')]=function(_0x1786c7,_0x1a4f14,_0x133738,_0x302562,_0x1273ce){return sendNotification(![],_0x1786c7,_0x1a4f14,_0x133738,_0x302562,_0x1273ce);};exports[_0x5ecf('0x24')]=function(_0x6dd7b4,_0x50597b,_0x1a2677){var _0x5831f8=_0x50597b['interaction']['UserId'];if(!_0x5831f8&&_0x1a2677){_0x5831f8=_0x1a2677['id'];}var _0x460bb2=_[_0x5ecf('0x25')](_0x6dd7b4[_0x50597b[_0x5ecf('0x26')]+'QueuesWaitingInteractions'],function(_0x1bf9e7){var _0x131531=_[_0x5ecf('0x27')](_0x50597b[_0x5ecf('0x26')])+_0x5ecf('0x28');return _0x1bf9e7[_0x131531]===_0x50597b[_0x5ecf('0x29')]['id'];});if(!_0x460bb2&&_0x5831f8&&_0x6dd7b4['agents'][_0x5831f8]){_0x460bb2=_[_0x5ecf('0x25')](_0x6dd7b4[_0x5ecf('0x2a')][_0x5831f8][_0x50597b[_0x5ecf('0x26')]+'WaitingInteractions'],function(_0x232586){return _0x232586['id']===_0x50597b['interaction']['id'];});}return _0x460bb2;};exports['saveWaitingNotification']=function(_0x256f79,_0x17c38b,_0x43685d,_0x57953b){if(_0x43685d&&_0x43685d['id']&&_0x256f79[_0x5ecf('0x2a')]&&_0x256f79[_0x5ecf('0x2a')][_0x43685d['id']]){_0x256f79['agents'][_0x43685d['id']][_0x57953b+_0x5ecf('0x2b')][_0x17c38b[_0x5ecf('0x2c')]['id']]={'id':_0x17c38b[_0x5ecf('0x29')]['id']};}};exports[_0x5ecf('0x2d')]=function(_0x59e1c2,_0x300da7,_0x16b3de,_0x4f66ff){if(_0x16b3de&&_0x16b3de['id']&&_0x59e1c2[_0x5ecf('0x2a')]&&_0x59e1c2[_0x5ecf('0x2a')][_0x16b3de['id']]){delete _0x59e1c2['agents'][_0x16b3de['id']][_0x4f66ff+_0x5ecf('0x2b')][_0x300da7[_0x5ecf('0x2c')]['id']];}};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 6b6948c..c0a7007 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 _0x219a=['validate','length','error','map','message','join','info','next','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','shelljs','lodash','./utils','routing','consequence'];(function(_0x3e6b2f,_0x1ffa07){var _0x323215=function(_0x5c4d82){while(--_0x5c4d82){_0x3e6b2f['push'](_0x3e6b2f['shift']());}};_0x323215(++_0x1ffa07);}(_0x219a,0x1c7));var _0xa219=function(_0x5ac766,_0x4cd100){_0x5ac766=_0x5ac766-0x0;var _0x4feec8=_0x219a[_0x5ac766];return _0x4feec8;};'use strict';var schema=require('validate');var sh=require(_0xa219('0x0'));var _=require(_0xa219('0x1'));var utils=require(_0xa219('0x2'));var logger=require('../../../../config/logger')(_0xa219('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xa219('0x4')]=function(_0x54e78b,_0x2deb1c){return function(_0x5207ee){try{var _0x171c6f={'command':_0x2deb1c[0x0]};var _0xe48973=system[_0xa219('0x5')](_0x171c6f,{'typecast':!![]});if(_0xe48973[_0xa219('0x6')]){logger[_0xa219('0x7')]('[%s][SYSTEM]\x20%s',_0x54e78b,_[_0xa219('0x8')](_0xe48973,_0xa219('0x9'))[_0xa219('0xa')](',\x20'));logger[_0xa219('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x54e78b);_0x5207ee[_0xa219('0xc')]();}else{var _0x5f602f=this;var _0x598b22=utils['getMustacheRender'](_0x2deb1c[0x0],this);logger[_0xa219('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x54e78b,_0x598b22);sh[_0xa219('0xd')](_['trim'](_0x598b22),function(_0x578e2a,_0x6064f7){logger['info'](_0xa219('0xe'),_0x54e78b,_0x578e2a);if(_0x578e2a==0x0){var _0x2f6eed=_0x6064f7['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xa219('0xf')](_0x2deb1c[0x1])||_[_0xa219('0x10')](_0x2deb1c[0x1])){logger['info'](_0xa219('0x11'),_0x54e78b);_0x5f602f[_0xa219('0x12')][_0x2deb1c[0x1]]=_0x2f6eed;}else{logger[_0xa219('0xb')](_0xa219('0x13'),_0x54e78b,_0x2deb1c[0x1],_0x2f6eed);_0x5f602f[_0xa219('0x12')][_0x2deb1c[0x1]]=_0x2f6eed;}}_0x5207ee[_0xa219('0xc')]();});}}catch(_0x434864){logger[_0xa219('0x7')]('[%s][SYSTEM]\x20%s',_0x54e78b,_[_0xa219('0x14')](_0x434864)?JSON[_0xa219('0x15')](_0x434864):_0x434864);logger[_0xa219('0xb')](_0xa219('0x16'),_0x54e78b);_0x5207ee[_0xa219('0xc')]();}};}; \ No newline at end of file +var _0x04f4=['trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','getMustacheRender','exec'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x04f4,0xfc));var _0x404f=function(_0x1d3186,_0x1cea9c){_0x1d3186=_0x1d3186-0x0;var _0x2e07e7=_0x04f4[_0x1d3186];return _0x2e07e7;};'use strict';var schema=require('validate');var sh=require(_0x404f('0x0'));var _=require(_0x404f('0x1'));var utils=require(_0x404f('0x2'));var logger=require(_0x404f('0x3'))(_0x404f('0x4'));var system=schema({'command':{'type':_0x404f('0x5'),'required':!![],'message':_0x404f('0x6')}});exports[_0x404f('0x7')]=function(_0x5f282c,_0x195358){return function(_0x399c2f){try{var _0x2ca357={'command':_0x195358[0x0]};var _0x42c7ea=system['validate'](_0x2ca357,{'typecast':!![]});if(_0x42c7ea[_0x404f('0x8')]){logger[_0x404f('0x9')](_0x404f('0xa'),_0x5f282c,_[_0x404f('0xb')](_0x42c7ea,_0x404f('0xc'))[_0x404f('0xd')](',\x20'));logger[_0x404f('0xe')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x5f282c);_0x399c2f[_0x404f('0xf')]();}else{var _0x599c1a=this;var _0x47c522=utils[_0x404f('0x10')](_0x195358[0x0],this);logger[_0x404f('0xe')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x5f282c,_0x47c522);sh[_0x404f('0x11')](_[_0x404f('0x12')](_0x47c522),function(_0x3d5b0e,_0x5803a9){logger[_0x404f('0xe')](_0x404f('0x13'),_0x5f282c,_0x3d5b0e);if(_0x3d5b0e==0x0){var _0xb57871=_0x5803a9[_0x404f('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0x404f('0x15')](_0x195358[0x1])||_['isEmpty'](_0x195358[0x1])){logger['info'](_0x404f('0x16'),_0x5f282c);_0x599c1a[_0x404f('0x17')][_0x195358[0x1]]=_0xb57871;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x5f282c,_0x195358[0x1],_0xb57871);_0x599c1a['body'][_0x195358[0x1]]=_0xb57871;}}_0x399c2f['next']();});}}catch(_0x4b3946){logger[_0x404f('0x9')](_0x404f('0xa'),_0x5f282c,_[_0x404f('0x18')](_0x4b3946)?JSON[_0x404f('0x19')](_0x4b3946):_0x4b3946);logger[_0x404f('0xe')](_0x404f('0x1a'),_0x5f282c);_0x399c2f[_0x404f('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 459dc54..e0b6ed6 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 _0x6490=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','join','info'];(function(_0x1a9f21,_0x4285ce){var _0x4b6bc0=function(_0x457805){while(--_0x457805){_0x1a9f21['push'](_0x1a9f21['shift']());}};_0x4b6bc0(++_0x4285ce);}(_0x6490,0x1cb));var _0x0649=function(_0x188c88,_0x210793){_0x188c88=_0x188c88-0x0;var _0x4e4c38=_0x6490[_0x188c88];return _0x4e4c38;};'use strict';var schema=require(_0x0649('0x0'));var _=require(_0x0649('0x1'));var rpc={'chatInteraction':require(_0x0649('0x2')),'openchannelInteraction':require(_0x0649('0x3')),'smsInteraction':require(_0x0649('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x0649('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x0649('0x6'))(_0x0649('0x7'));var tag=schema({'tag':{'type':_0x0649('0x8'),'required':!![],'message':_0x0649('0x9')}});exports[_0x0649('0xa')]=function(_0x59253f,_0x420c8e,_0x10e5d6,_0x8383dd){return function(_0x41748a){try{var _0x39b3d5={'tag':_0x420c8e[0x0]};var _0x12e938=tag[_0x0649('0x0')](_0x39b3d5,{'typecast':!![]});if(_0x12e938[_0x0649('0xb')]){logger[_0x0649('0xc')](_0x0649('0xd'),_0x59253f,_[_0x0649('0xe')](_0x12e938,'message')[_0x0649('0xf')](',\x20'));logger[_0x0649('0x10')](_0x0649('0x11'),_0x59253f);_0x41748a[_0x0649('0x12')]();}else{var _0x102b85={'ids':[_0x420c8e[0x0]]};if(rpc[_0x8383dd[_0x0649('0x13')]+_0x0649('0x14')]){rpc[_0x8383dd[_0x0649('0x13')]+_0x0649('0x14')]['addTags'](_0x8383dd[_0x0649('0x15')]['id'],_0x102b85)[_0x0649('0x16')](function(_0x103ab3){logger['info'](_0x0649('0x17'),_0x59253f,_0x420c8e[0x1],_0x8383dd[_0x0649('0x13')],_0x8383dd[_0x0649('0x15')]['id']);})[_0x0649('0x18')](function(_0x4f2e76){logger[_0x0649('0xc')](_0x0649('0xd'),_0x59253f,JSON[_0x0649('0x19')](_0x4f2e76));logger[_0x0649('0x10')](_0x0649('0x11'),_0x59253f);})[_0x0649('0x1a')](function(){_0x41748a[_0x0649('0x12')]();});}}}catch(_0x39b810){logger['error'](_0x0649('0xd'),_0x59253f,_[_0x0649('0x1b')](_0x39b810)?JSON[_0x0649('0x19')](_0x39b810):_0x39b810);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x59253f);_0x41748a[_0x0649('0x12')]();}};}; \ No newline at end of file +var _0x93de=['../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','catch','error','[%s][TAG]\x20%s','stringify','finally','next','isObject','validate','../../rpc/chatInteraction'];(function(_0x2a2166,_0x3a077f){var _0x3bcf50=function(_0x3f0300){while(--_0x3f0300){_0x2a2166['push'](_0x2a2166['shift']());}};_0x3bcf50(++_0x3a077f);}(_0x93de,0xfa));var _0xe93d=function(_0x4231c9,_0x5793ee){_0x4231c9=_0x4231c9-0x0;var _0x4843f9=_0x93de[_0x4231c9];return _0x4843f9;};'use strict';var schema=require(_0xe93d('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xe93d('0x1')),'openchannelInteraction':require(_0xe93d('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xe93d('0x3')),'faxInteraction':require(_0xe93d('0x4')),'whatsappInteraction':require(_0xe93d('0x5'))};var logger=require(_0xe93d('0x6'))(_0xe93d('0x7'));var tag=schema({'tag':{'type':_0xe93d('0x8'),'required':!![],'message':_0xe93d('0x9')}});exports['consequence']=function(_0x2f07ae,_0x5d334e,_0x9b966a,_0x419015){return function(_0x1f4ade){try{var _0x14a545={'tag':_0x5d334e[0x0]};var _0x13228b=tag['validate'](_0x14a545,{'typecast':!![]});if(_0x13228b[_0xe93d('0xa')]){logger['error']('[%s][TAG]\x20%s',_0x2f07ae,_[_0xe93d('0xb')](_0x13228b,_0xe93d('0xc'))[_0xe93d('0xd')](',\x20'));logger[_0xe93d('0xe')](_0xe93d('0xf'),_0x2f07ae);_0x1f4ade['next']();}else{var _0x55266b={'ids':[_0x5d334e[0x0]]};if(rpc[_0x419015[_0xe93d('0x10')]+_0xe93d('0x11')]){rpc[_0x419015[_0xe93d('0x10')]+_0xe93d('0x11')][_0xe93d('0x12')](_0x419015[_0xe93d('0x13')]['id'],_0x55266b)[_0xe93d('0x14')](function(_0x4e8328){logger[_0xe93d('0xe')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x2f07ae,_0x5d334e[0x1],_0x419015[_0xe93d('0x10')],_0x419015[_0xe93d('0x13')]['id']);})[_0xe93d('0x15')](function(_0x53d4cc){logger[_0xe93d('0x16')](_0xe93d('0x17'),_0x2f07ae,JSON[_0xe93d('0x18')](_0x53d4cc));logger[_0xe93d('0xe')](_0xe93d('0xf'),_0x2f07ae);})[_0xe93d('0x19')](function(){_0x1f4ade[_0xe93d('0x1a')]();});}}}catch(_0x2018e1){logger[_0xe93d('0x16')](_0xe93d('0x17'),_0x2f07ae,_[_0xe93d('0x1b')](_0x2018e1)?JSON[_0xe93d('0x18')](_0x2018e1):_0x2018e1);logger[_0xe93d('0xe')](_0xe93d('0xf'),_0x2f07ae);_0x1f4ade[_0xe93d('0x1a')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 3c74de1..883cdb4 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa203=['stringify','utf8','application/json-rpc','then','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','2.0','method','login','params'];(function(_0x42da23,_0x369213){var _0x468d46=function(_0x456711){while(--_0x456711){_0x42da23['push'](_0x42da23['shift']());}};_0x468d46(++_0x369213);}(_0xa203,0x1f1));var _0x3a20=function(_0x2127ad,_0xcc8eb0){_0x2127ad=_0x2127ad-0x0;var _0x3e4485=_0xa203[_0x2127ad];return _0x3e4485;};'use strict';var rp=require('request-promise');var logger=require(_0x3a20('0x0'))('routing');var _=require(_0x3a20('0x1'));var arr=[];exports[_0x3a20('0x2')]=function(_0x5d28dd,_0x586ba5){return function(_0x285fb4){var _0x50584e=_0x586ba5[0xa];var _0x5448c6=_0x586ba5[0xb];var _0x5d84da=_0x586ba5[0xc];var _0x1e9112=_0x586ba5[0xd];var _0x188649=_0x586ba5[0xe];var _0x4a1a8b=_0x586ba5[0xf][_0x3a20('0x3')](/\n/g,_0x3a20('0x4'));var _0x544ba7=_0x586ba5[0x10][_0x3a20('0x3')](/\n/g,'\x20');if(!arr[_0x3a20('0x5')](_0x5448c6)){arr[_0x3a20('0x6')](_0x5448c6);var _0x20a6f9=_0x586ba5[0x3];var _0x1c84c8=_0x586ba5[0x4];var _0x18c654=_0x586ba5[0x1];var _0x5d3d6c=_0x586ba5[0x0];var _0x198afb={};_0x198afb[_0x3a20('0x7')]=_0x586ba5[0x8]+_0x3a20('0x8')+_0x5d84da+'|'+_0x50584e+'|'+_0x1e9112+'|'+_0x5448c6+'|'+_0x188649;_0x198afb[_0x3a20('0x9')]=_0x586ba5[0x7]+_0x3a20('0x8')+_0x5d84da+'|'+_0x50584e+'|'+_0x1e9112+'|'+_0x5448c6+'|'+_0x188649+'|'+_0x4a1a8b+'|'+_0x544ba7;_0x198afb[_0x3a20('0xa')]=_0x586ba5[0x9];var _0x274d9f={};_0x274d9f['jsonrpc']=_0x3a20('0xb');_0x274d9f[_0x3a20('0xc')]=_0x3a20('0xd');var _0xc525a6=[];_0xc525a6[_0x3a20('0x6')](_0x586ba5[0x2]);_0xc525a6[_0x3a20('0x6')](_0x586ba5[0x5]);_0xc525a6[_0x3a20('0x6')](_0x586ba5[0x6]);_0x274d9f[_0x3a20('0xe')]=_0xc525a6;_0x274d9f['id']=0x1;var _0x4ce8b0=JSON[_0x3a20('0xf')](_0x274d9f);var _0x17d24c={'encoding':_0x3a20('0x10'),'method':'POST','timeout':0x2710,'url':_0x20a6f9,'headers':{'Content-Type':_0x3a20('0x11')},'body':_0x4ce8b0};return rp(_0x17d24c)[_0x3a20('0x12')](function(_0x4239cf){const _0x2304c7=JSON['parse'](_0x4239cf);if(!_0x2304c7[_0x3a20('0x13')]['logged']){throw new Error(_0x3a20('0x14'));}var _0x388c7a=_0x5448c6;var _0x5bbca1=_0x3a20('0x15')+_0x18c654+_0x3a20('0x16')+_0x5d3d6c+'&sessionId='+_0x388c7a+_0x3a20('0x17')+JSON[_0x3a20('0xf')](_0x198afb);var _0x1104a2=_0x1c84c8+'?'+_0x5bbca1;return rp(_0x1104a2);})[_0x3a20('0x12')](function(_0x575456){logger['info'](_0x3a20('0x18'),_0x5d28dd,_0x575456);_0x285fb4[_0x3a20('0x19')]();})[_0x3a20('0x1a')](function(_0x1e228f){logger[_0x3a20('0x1b')](_0x3a20('0x1c'),_0x5d28dd,_[_0x3a20('0x1d')](_0x1e228f)?JSON['stringify'](_0x1e228f):_0x1e228f);_0x285fb4[_0x3a20('0x19')]();});}else{logger['info'](_0x3a20('0x1e'),_0x5d28dd);_0x285fb4[_0x3a20('0x1f')]();}};}; \ No newline at end of file +var _0x616c=['[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','login','stringify','utf8','POST','application/json-rpc','then','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop'];(function(_0x547388,_0x519ad5){var _0x546c9a=function(_0x40797c){while(--_0x40797c){_0x547388['push'](_0x547388['shift']());}};_0x546c9a(++_0x519ad5);}(_0x616c,0x162));var _0xc616=function(_0x43ea46,_0xd00853){_0x43ea46=_0x43ea46-0x0;var _0x4ac26a=_0x616c[_0x43ea46];return _0x4ac26a;};'use strict';var rp=require(_0xc616('0x0'));var logger=require(_0xc616('0x1'))(_0xc616('0x2'));var _=require(_0xc616('0x3'));var arr=[];exports['consequence']=function(_0x201e8a,_0x29e8a3){return function(_0x290068){var _0x268788=_0x29e8a3[0xa];var _0x369acd=_0x29e8a3[0xb];var _0x9f3470=_0x29e8a3[0xc];var _0xc939a6=_0x29e8a3[0xd];var _0x488591=_0x29e8a3[0xe];var _0x4b11b3=_0x29e8a3[0xf][_0xc616('0x4')](/\n/g,_0xc616('0x5'));var _0x150d9e=_0x29e8a3[0x10][_0xc616('0x4')](/\n/g,'\x20');if(!arr[_0xc616('0x6')](_0x369acd)){arr[_0xc616('0x7')](_0x369acd);var _0x3452f5=_0x29e8a3[0x3];var _0x52e7af=_0x29e8a3[0x4];var _0x1eb485=_0x29e8a3[0x1];var _0x1ac7d3=_0x29e8a3[0x0];var _0x245215={};_0x245215[_0xc616('0x8')]=_0x29e8a3[0x8]+_0xc616('0x9')+_0x9f3470+'|'+_0x268788+'|'+_0xc939a6+'|'+_0x369acd+'|'+_0x488591;_0x245215[_0xc616('0xa')]=_0x29e8a3[0x7]+_0xc616('0x9')+_0x9f3470+'|'+_0x268788+'|'+_0xc939a6+'|'+_0x369acd+'|'+_0x488591+'|'+_0x4b11b3+'|'+_0x150d9e;_0x245215[_0xc616('0xb')]=_0x29e8a3[0x9];var _0x2263f8={};_0x2263f8[_0xc616('0xc')]=_0xc616('0xd');_0x2263f8[_0xc616('0xe')]=_0xc616('0xf');var _0x36fa29=[];_0x36fa29[_0xc616('0x7')](_0x29e8a3[0x2]);_0x36fa29[_0xc616('0x7')](_0x29e8a3[0x5]);_0x36fa29[_0xc616('0x7')](_0x29e8a3[0x6]);_0x2263f8['params']=_0x36fa29;_0x2263f8['id']=0x1;var _0x5d72a7=JSON[_0xc616('0x10')](_0x2263f8);var _0x23ceb0={'encoding':_0xc616('0x11'),'method':_0xc616('0x12'),'timeout':0x2710,'url':_0x3452f5,'headers':{'Content-Type':_0xc616('0x13')},'body':_0x5d72a7};return rp(_0x23ceb0)[_0xc616('0x14')](function(_0x39b014){const _0x4655d9=JSON[_0xc616('0x15')](_0x39b014);if(!_0x4655d9[_0xc616('0x16')]['logged']){throw new Error(_0xc616('0x17'));}var _0x11b1c7=_0x369acd;var _0x371394=_0xc616('0x18')+_0x1eb485+_0xc616('0x19')+_0x1ac7d3+_0xc616('0x1a')+_0x11b1c7+_0xc616('0x1b')+JSON[_0xc616('0x10')](_0x245215);var _0x402afc=_0x52e7af+'?'+_0x371394;return rp(_0x402afc);})[_0xc616('0x14')](function(_0x3693c9){logger[_0xc616('0x1c')](_0xc616('0x1d'),_0x201e8a,_0x3693c9);_0x290068[_0xc616('0x1e')]();})['catch'](function(_0x1bd50d){logger['error'](_0xc616('0x1f'),_0x201e8a,_[_0xc616('0x20')](_0x1bd50d)?JSON[_0xc616('0x10')](_0x1bd50d):_0x1bd50d);_0x290068[_0xc616('0x1e')]();});}else{logger[_0xc616('0x1c')](_0xc616('0x21'),_0x201e8a);_0x290068[_0xc616('0x22')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index b6d33aa..0372781 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x12421e,_0x5d9437){var _0x1f16d6=function(_0x14b4fc){while(--_0x14b4fc){_0x12421e['push'](_0x12421e['shift']());}};_0x1f16d6(++_0x5d9437);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x3ae1ab,_0x2a40e2){var _0x2615a4=function(_0x4ea995){while(--_0x4ea995){_0x3ae1ab['push'](_0x3ae1ab['shift']());}};_0x2615a4(++_0x2a40e2);}(_0xe706,0xa3));var _0x6e70=function(_0x501099,_0x223250){_0x501099=_0x501099-0x0;var _0x555ebf=_0xe706[_0x501099];return _0x555ebf;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 3f79035..6044082 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 _0xc137=['Applications\x20executed','stringify','matchPath','emit','Skipped\x20routing\x20for\x20%s','stack','agent','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','find','chatQueues','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','available','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','./applications/utils','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','isNil','IntervalId','Intervals','map','interval','listen','rules','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','.js','app','toLowerCase','autoreply','appdata','split','channel','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','execute'];(function(_0x194f60,_0x1697f3){var _0x249ce9=function(_0x488f2c){while(--_0x488f2c){_0x194f60['push'](_0x194f60['shift']());}};_0x249ce9(++_0x1697f3);}(_0xc137,0xff));var _0x7c13=function(_0x2edb9f,_0x36fad0){_0x2edb9f=_0x2edb9f-0x0;var _0x4e5979=_0xc137[_0x2edb9f];return _0x4e5979;};'use strict';var _=require(_0x7c13('0x0'));var util=require(_0x7c13('0x1'));var path=require(_0x7c13('0x2'));var fs=require('fs');var jayson=require(_0x7c13('0x3'));var BPromise=require(_0x7c13('0x4'));var utils=require(_0x7c13('0x5'));var sUtils=require('./applications/strategy/util');var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require(_0x7c13('0x6')),'mailQueueReport':require(_0x7c13('0x7')),'chatQueueReport':require(_0x7c13('0x8')),'smsQueueReport':require(_0x7c13('0x9')),'faxQueueReport':require(_0x7c13('0xa')),'whatsappQueueReport':require(_0x7c13('0xb'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x545ca9,_0x52215d,_0xa48b2b){return util[_0x7c13('0xc')]('%s.%s.%s',_0x545ca9,_0x52215d||0x0,_0xa48b2b||0x0);}function getIntervals(_0x9cb550,_0x221636){var _0x563daa=[];if(!_[_0x7c13('0xd')](_0x221636[_0x7c13('0xe')])&&!_[_0x7c13('0xd')](_0x9cb550[_0x221636[_0x7c13('0xe')]])&&!_[_0x7c13('0xd')](_0x9cb550[_0x221636[_0x7c13('0xe')]][_0x7c13('0xf')])){_0x563daa=_[_0x7c13('0x10')](_0x9cb550[_0x221636[_0x7c13('0xe')]][_0x7c13('0xf')],_0x7c13('0x11'));}else if(!_[_0x7c13('0xd')](_0x221636[_0x7c13('0x11')])){_0x563daa=[_0x221636['interval']];}return _0x563daa;}exports[_0x7c13('0x12')]=function(_0x52565c){_0x52565c[_0x7c13('0x13')]={};return new BPromise(function(_0x2b4b46,_0x19e4fb){var _0x2b9d75={'Start':function(_0xf634f8){var _0x3f9cf4=this;return new Promise(function(_0x2b9855,_0x4d32db){if(_0xf634f8){try{var _0x3c77ea=[];var _0x3d1433=getId(_0xf634f8['channel'],_0xf634f8[_0x7c13('0x14')]?_0xf634f8[_0x7c13('0x14')]['id']:0x0,_0xf634f8['interaction']?_0xf634f8[_0x7c13('0x15')]['id']:0x0);var _0x45202b=sUtils[_0x7c13('0x16')](_0x52565c,_0xf634f8);if(_0xf634f8[_0x7c13('0x17')]||!_0x45202b&&_0xf634f8[_0x7c13('0x18')]&&_[_0x7c13('0x19')](_0xf634f8[_0x7c13('0x18')])&&_0xf634f8[_0x7c13('0x18')][_0x7c13('0x1a')]){for(var _0x5bd671=0x0;_0x5bd671<_0xf634f8[_0x7c13('0x18')][_0x7c13('0x1a')];_0x5bd671+=0x1){var _0x4f3846=_0xf634f8['applications'][_0x5bd671];if(fs[_0x7c13('0x1b')](path[_0x7c13('0x1c')](__dirname,_0x7c13('0x18'),_0x4f3846['app']+_0x7c13('0x1d')))){var _0x3be527=[];switch(_0x4f3846[_0x7c13('0x1e')][_0x7c13('0x1f')]()){case _0x7c13('0x20'):var _0xc5bc98=_0x4f3846[_0x7c13('0x21')][_0x7c13('0x22')](',');if(_0xf634f8[_0x7c13('0x23')]===_0x7c13('0x24')){_0x3be527[_0x7c13('0x25')](_0xc5bc98[0x0]);_0x3be527[_0x7c13('0x25')](_0xc5bc98[0x1]);_0x3be527[_0x7c13('0x25')](_0xc5bc98['slice'](0x2,_0xc5bc98[_0x7c13('0x1a')])[_0x7c13('0x1c')](','));}else{_0x3be527['push'](_0xc5bc98[0x0]);_0x3be527['push'](_0xc5bc98[_0x7c13('0x26')](0x1,_0xc5bc98['length'])[_0x7c13('0x1c')](','));}break;case _0x7c13('0x27'):var _0x2263f3=_0x4f3846['appdata'][_0x7c13('0x22')](',');_0x3be527[_0x7c13('0x25')](_0x2263f3[0x0]);_0x3be527['push'](_0x2263f3[0x1]);_0x3be527[_0x7c13('0x25')](_0x2263f3[_0x7c13('0x26')](0x2,_0x2263f3[_0x7c13('0x1a')])[_0x7c13('0x1c')](','));break;case _0x7c13('0x28'):var _0x730705=_0x4f3846[_0x7c13('0x21')][_0x7c13('0x22')](',');_0x3be527[_0x7c13('0x25')](_0x730705[0x0]);_0x3be527[_0x7c13('0x25')](_0x730705[0x1]);_0x3be527[_0x7c13('0x25')](_0x730705[0x2]);_0x3be527[_0x7c13('0x25')](_0x730705[0x3]);_0x3be527['push'](_0x730705[_0x7c13('0x26')](0x4,_0x730705[_0x7c13('0x1a')])[_0x7c13('0x1c')](','));break;case _0x7c13('0x29'):var _0x1c98a4=_0x4f3846['appdata'][_0x7c13('0x22')](',');_0x3be527[_0x7c13('0x25')](_0x1c98a4[0x0]);_0x3be527[_0x7c13('0x25')](_0x1c98a4[0x1]);_0x3be527[_0x7c13('0x25')](_0x1c98a4[0x2]);_0x3be527[_0x7c13('0x25')](_0x1c98a4[0x3]);_0x3be527[_0x7c13('0x25')](_0x1c98a4[_0x7c13('0x26')](0x4,_0x1c98a4[_0x7c13('0x1a')])[_0x7c13('0x1c')](','));break;case _0x7c13('0x14'):_0x3be527[_0x7c13('0x25')](_0x4f3846[_0x7c13('0x21')]);break;case _0x7c13('0x2a'):_0x3be527[_0x7c13('0x25')](_0x4f3846[_0x7c13('0x2b')]);_0x3be527[_0x7c13('0x25')](_0x4f3846[_0x7c13('0x21')]);break;case _0x7c13('0x2c'):var _0x2b2763=utils['getMustacheRender'](_0xf634f8[_0x7c13('0x2d')][_0x7c13('0x2e')],_0xf634f8);var _0x526477=_0x4f3846[_0x7c13('0x21')][_0x7c13('0x22')](',');_0x3be527[_0x7c13('0x25')](_0x526477[0x0]);_0x3be527['push'](_0x526477[0x1]);_0x3be527['push'](_0x526477[0x2]);_0x3be527[_0x7c13('0x25')](_0x526477[0x3]);_0x3be527[_0x7c13('0x25')](_0x526477[0x4]);_0x3be527['push'](_0x526477[0x5]);_0x3be527['push'](_0x526477[0x6]);_0x3be527[_0x7c13('0x25')](_0x526477[0x7]);_0x3be527[_0x7c13('0x25')](_0x526477[0x8]);_0x3be527['push'](_0x526477[0x9]);_0x3be527[_0x7c13('0x25')](_0x526477[0xa]);_0x3be527[_0x7c13('0x25')](_0xf634f8[_0x7c13('0x15')]['id']);_0x3be527[_0x7c13('0x25')](_0xf634f8[_0x7c13('0x14')]['id']);_0x3be527[_0x7c13('0x25')](_0x4f3846[_0x7c13('0x2f')]);_0x3be527[_0x7c13('0x25')](_0xf634f8[_0x7c13('0x15')][_0x7c13('0x30')]);_0x3be527['push'](_0xf634f8[_0x7c13('0x31')][_0x7c13('0x31')]);_0x3be527['push'](_0x2b2763);break;default:_0x3be527=_[_0x7c13('0xd')](_0x4f3846[_0x7c13('0x21')])?[]:_0x4f3846[_0x7c13('0x21')][_0x7c13('0x22')](',');}var _0x2e9309={'id':util['format'](_0x7c13('0x32'),_0x3d1433,_0x4f3846['id'],_0x4f3846[_0x7c13('0x1e')]),'condition':require(_0x7c13('0x33'))[_0x7c13('0x34')](_0x3d1433,getIntervals(_0x52565c[_0x7c13('0x35')],_0x4f3846),_0x52565c),'consequence':require(_0x7c13('0x36')+_0x4f3846['app'])[_0x7c13('0x37')](_0x3d1433,_0x3be527,_0x52565c,_0xf634f8),'p':_0x4f3846[_0x7c13('0x38')]||0x0};logger[_0x7c13('0x39')](_0x7c13('0x3a'),_0x2e9309['id'],_0x7c13('0x3b'),getIntervals(_0x52565c[_0x7c13('0x35')],_0x4f3846)[_0x7c13('0x1c')]('\x20|\x20'));_0x3c77ea[_0x7c13('0x25')](_0x2e9309);}else{logger[_0x7c13('0x3c')](_0x7c13('0x3d'),path[_0x7c13('0x1c')](__dirname,'applications',_0x4f3846[_0x7c13('0x1e')]+_0x7c13('0x1d')));}}_0x52565c[_0x7c13('0x13')][_0x3d1433]=new RuleEngine(_0x3c77ea);_0x52565c[_0x7c13('0x13')][_0x3d1433][_0x7c13('0x3e')](_0xf634f8,function(_0x4123f7){logger[_0x7c13('0x39')](_0x7c13('0x3f'),JSON[_0x7c13('0x40')](_0x4123f7[_0x7c13('0x41')]));if(_0x52565c[_0x7c13('0x13')][_0x3d1433]){_0x52565c[_0x7c13('0x13')][_0x3d1433][_0x7c13('0x42')]('complete');}});return _0x2b9855({'code':0xc8,'message':_0xf634f8});}else{if(_0x45202b){logger[_0x7c13('0x39')](util[_0x7c13('0xc')](_0x7c13('0x43'),_0x3d1433));}else{logger[_0x7c13('0x39')]('No\x20applications\x20to\x20execute');}return _0x2b9855({'code':0xc8,'message':_0xf634f8});}}catch(_0x1ebc75){logger[_0x7c13('0x3c')](_0x1ebc75[_0x7c13('0x44')]);return _0x4d32db(_0x3f9cf4[_0x7c13('0x3c')](0x1f4,_0x1ebc75));}}return _0x4d32db('routing\x20is\x20empty');});},'AcceptMessage':function(_0x47796b){var _0x324077=this;return new Promise(function(_0x488c36,_0x22f37e){if(_0x47796b[_0x7c13('0x45')]&&_0x47796b['agent']['id']){if(_0x52565c['agents'][_0x47796b[_0x7c13('0x45')]['id']]){_0x52565c[_0x7c13('0x46')][_0x47796b[_0x7c13('0x45')]['id']]['busy']=![];_0x52565c[_0x7c13('0x46')][_0x47796b[_0x7c13('0x45')]['id']][_0x7c13('0x47')]=undefined;}}if(_0x47796b[_0x7c13('0x14')]&&_0x47796b[_0x7c13('0x14')]['id']){try{var _0x9125b4=getId(_0x47796b[_0x7c13('0x23')],_0x47796b[_0x7c13('0x14')]?_0x47796b[_0x7c13('0x14')]['id']:0x0,_0x47796b['interaction']?_0x47796b[_0x7c13('0x15')]['id']:0x0);if(_0x52565c[_0x7c13('0x13')][_0x9125b4]){_0x52565c['rules'][_0x9125b4][_0x7c13('0x42')](_0x7c13('0x48'));if(rpc[_0x47796b[_0x7c13('0x23')]+_0x7c13('0x49')]){rpc[_0x47796b[_0x7c13('0x23')]+'QueueReport'][_0x7c13('0x4a')](_0x9125b4,{'UserId':_0x47796b['message'][_0x7c13('0x4b')]})[_0x7c13('0x4c')](function(){logger[_0x7c13('0x3c')](_0x7c13('0x4d'));});}}return _0x488c36({'code':0xc8,'message':_0x47796b});}catch(_0x25acfb){logger[_0x7c13('0x3c')](_0x25acfb[_0x7c13('0x44')]);return _0x22f37e(_0x324077[_0x7c13('0x3c')](0x1f4,_0x25acfb));}}logger[_0x7c13('0x3c')](_0x7c13('0x4e'));return _0x22f37e(_0x324077[_0x7c13('0x3c')](0x1f4,_0x7c13('0x4e')));});},'RejectMessage':function(_0x388101){var _0xd5d3b7=this;return new Promise(function(_0x139e45,_0x56ba53){if(_0x388101[_0x7c13('0x45')]&&_0x388101[_0x7c13('0x45')]['id']){try{if(_0x52565c['agents'][_0x388101[_0x7c13('0x45')]['id']]){_0x52565c[_0x7c13('0x46')][_0x388101[_0x7c13('0x45')]['id']]['busy']=![];_0x52565c[_0x7c13('0x46')][_0x388101[_0x7c13('0x45')]['id']]['busyQueue']=undefined;}return _0x139e45({'code':0xc8,'message':_0x388101});}catch(_0x444809){logger[_0x7c13('0x3c')](_0x444809['stack']);return _0x56ba53(_0xd5d3b7[_0x7c13('0x3c')](0x1f4,_0x444809));}}logger[_0x7c13('0x3c')](_0x7c13('0x4e'));return _0x56ba53(_0xd5d3b7[_0x7c13('0x3c')](0x1f4,_0x7c13('0x4e')));});},'AbandonInteraction':function(_0x122740){var _0x15ac02=this;return new Promise(function(_0x4320e0,_0x5f4132){if(_0x122740[_0x7c13('0x23')]&&_0x122740[_0x7c13('0x15')]&&_0x122740['interaction']['id']){try{var _0x10c939=getId(_0x122740[_0x7c13('0x23')],_0x122740[_0x7c13('0x14')]?_0x122740[_0x7c13('0x14')]['id']:0x0,_0x122740[_0x7c13('0x15')]?_0x122740[_0x7c13('0x15')]['id']:0x0);if(_0x52565c[_0x7c13('0x13')][_0x10c939]){_0x52565c[_0x7c13('0x13')][_0x10c939][_0x7c13('0x42')]('end');}return _0x4320e0({'code':0xc8,'message':_0x122740});}catch(_0x57d4bf){logger['error'](_0x57d4bf['stack']);return _0x5f4132(_0x15ac02['error'](0x1f4,_0x57d4bf));}}logger[_0x7c13('0x3c')](_0x7c13('0x4e'));return _0x5f4132(_0x15ac02[_0x7c13('0x3c')](0x1f4,_0x7c13('0x4e')));});},'AgentCapacity':function(_0x127acd){var _0x2c22fa=this;return new Promise(function(_0xffad9b,_0x157b19){if(_0x52565c['agents'][_0x7c13('0x4f')](_0x127acd['id'])){for(var _0x29d50b in _0x127acd['capacity']){if(_0x127acd[_0x7c13('0x50')][_0x7c13('0x4f')](_0x29d50b)){if(_0x52565c[_0x7c13('0x46')][_0x127acd['id']][_0x7c13('0x4f')](_0x29d50b+_0x7c13('0x51'))){_0x52565c[_0x7c13('0x46')][_0x127acd['id']][_0x29d50b+'CurrentCapacity']=parseInt(_0x127acd[_0x7c13('0x50')][_0x29d50b],0xa);}}}_0x52565c[_0x7c13('0x46')][_0x127acd['id']]['updateRealtime']();return _0xffad9b({'code':0xc8,'message':_0x52565c['agents'][_0x127acd['id']]});}else{return _0x157b19(_0x2c22fa[_0x7c13('0x3c')](0x1f4,_0x7c13('0x52')));}});},'Agents':function(_0x3fdfe1){return new Promise(function(_0x2456f6){var _0x1ab3b0=_['values'](_0x52565c[_0x7c13('0x46')]);if(_0x3fdfe1&&_0x3fdfe1['id']){var _0x4babb5=_[_0x7c13('0x53')](_0x1ab3b0,function(_0x236c8d){return _0x236c8d['id']===_0x3fdfe1['id'];});_0x2456f6(_0x4babb5);}else{_0x2456f6({'count':_0x1ab3b0[_0x7c13('0x1a')],'rows':_0x1ab3b0});}});},'ChatQueues':function(){return new Promise(function(_0x49b9c8){var _0xf9b0b8=[];for(var _0x5be379 in _0x52565c[_0x7c13('0x54')]){if(_0x52565c['chatQueues'][_0x7c13('0x4f')](_0x5be379)){var _0x250d05=_0x52565c[_0x7c13('0x54')][_0x5be379];var _0x535fd7={'id':_0x250d05['id'],'available':_0x250d05['available'],'loggedIn':_0x250d05[_0x7c13('0x55')],'name':_0x250d05[_0x7c13('0x56')],'paused':_0x250d05[_0x7c13('0x57')],'waiting':_0x250d05[_0x7c13('0x58')]};_0xf9b0b8[_0x7c13('0x25')](_0x535fd7);}}_0x49b9c8({'count':_0xf9b0b8[_0x7c13('0x1a')],'rows':_0xf9b0b8});});},'MailQueues':function(){return new Promise(function(_0x91d39f){var _0x117aaf=[];for(var _0x3f2d37 in _0x52565c[_0x7c13('0x59')]){if(_0x52565c['mailQueues'][_0x7c13('0x4f')](_0x3f2d37)){var _0x27230c=_0x52565c[_0x7c13('0x59')][_0x3f2d37];var _0x363700={'id':_0x27230c['id'],'available':_0x27230c['available'],'loggedIn':_0x27230c['loggedIn'],'name':_0x27230c['name'],'paused':_0x27230c[_0x7c13('0x57')],'waiting':_0x27230c[_0x7c13('0x58')]};_0x117aaf[_0x7c13('0x25')](_0x363700);}}_0x91d39f({'count':_0x117aaf['length'],'rows':_0x117aaf});});},'OpenchannelQueues':function(){return new Promise(function(_0x108e62){var _0x37fa64=[];for(var _0x10c40e in _0x52565c[_0x7c13('0x5a')]){if(_0x52565c['openchannelQueues'][_0x7c13('0x4f')](_0x10c40e)){var _0x2c1152=_0x52565c[_0x7c13('0x5a')][_0x10c40e];var _0x5b316c={'id':_0x2c1152['id'],'available':_0x2c1152['available'],'loggedIn':_0x2c1152[_0x7c13('0x55')],'name':_0x2c1152['name'],'paused':_0x2c1152[_0x7c13('0x57')],'waiting':_0x2c1152[_0x7c13('0x58')]};_0x37fa64['push'](_0x5b316c);}}_0x108e62({'count':_0x37fa64[_0x7c13('0x1a')],'rows':_0x37fa64});});},'SmsQueues':function(){return new Promise(function(_0x5cc0b1){var _0x4d7e5a=[];for(var _0x5cb396 in _0x52565c[_0x7c13('0x5b')]){if(_0x52565c[_0x7c13('0x5b')][_0x7c13('0x4f')](_0x5cb396)){var _0x4c732d=_0x52565c[_0x7c13('0x5b')][_0x5cb396];var _0x421adf={'id':_0x4c732d['id'],'available':_0x4c732d[_0x7c13('0x5c')],'loggedIn':_0x4c732d[_0x7c13('0x55')],'name':_0x4c732d[_0x7c13('0x56')],'paused':_0x4c732d['paused'],'waiting':_0x4c732d[_0x7c13('0x58')]};_0x4d7e5a[_0x7c13('0x25')](_0x421adf);}}_0x5cc0b1({'count':_0x4d7e5a['length'],'rows':_0x4d7e5a});});},'FaxQueues':function(){return new Promise(function(_0x262a50){var _0x15d06f=[];for(var _0x4c163e in _0x52565c[_0x7c13('0x5d')]){if(_0x52565c['faxQueues'][_0x7c13('0x4f')](_0x4c163e)){var _0x17de42=_0x52565c['faxQueues'][_0x4c163e];var _0xaa599b={'id':_0x17de42['id'],'available':_0x17de42[_0x7c13('0x5c')],'loggedIn':_0x17de42[_0x7c13('0x55')],'name':_0x17de42[_0x7c13('0x56')],'paused':_0x17de42['paused'],'waiting':_0x17de42[_0x7c13('0x58')]};_0x15d06f[_0x7c13('0x25')](_0xaa599b);}}_0x262a50({'count':_0x15d06f['length'],'rows':_0x15d06f});});},'WhatsappQueues':function(){return new Promise(function(_0x944be7){var _0x3cab18=[];for(var _0x402989 in _0x52565c['whatsappQueues']){if(_0x52565c[_0x7c13('0x5e')][_0x7c13('0x4f')](_0x402989)){var _0x10442b=_0x52565c[_0x7c13('0x5e')][_0x402989];var _0x5e76af={'id':_0x10442b['id'],'available':_0x10442b[_0x7c13('0x5c')],'loggedIn':_0x10442b[_0x7c13('0x55')],'name':_0x10442b[_0x7c13('0x56')],'paused':_0x10442b[_0x7c13('0x57')],'waiting':_0x10442b[_0x7c13('0x58')]};_0x3cab18['push'](_0x5e76af);}}_0x944be7({'count':_0x3cab18['length'],'rows':_0x3cab18});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x13b178){var _0x894c89=_[_0x7c13('0x5f')](_0x52565c[_0x7c13('0x60')]);_0x13b178({'count':_0x894c89[_0x7c13('0x1a')],'rows':_0x894c89});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0xa29c4f){var _0x3de065=_[_0x7c13('0x5f')](_0x52565c[_0x7c13('0x61')]);_0xa29c4f({'count':_0x3de065[_0x7c13('0x1a')],'rows':_0x3de065});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x9f3633){var _0x93caac=_['values'](_0x52565c[_0x7c13('0x62')]);_0x9f3633({'count':_0x93caac[_0x7c13('0x1a')],'rows':_0x93caac});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x412bff){var _0x24702d=_[_0x7c13('0x5f')](_0x52565c[_0x7c13('0x63')]);_0x412bff({'count':_0x24702d['length'],'rows':_0x24702d});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4cb49e){var _0x47860e=_[_0x7c13('0x5f')](_0x52565c[_0x7c13('0x64')]);_0x4cb49e({'count':_0x47860e['length'],'rows':_0x47860e});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x177568){var _0x205c5c=_['values'](_0x52565c[_0x7c13('0x65')]);_0x177568({'count':_0x205c5c['length'],'rows':_0x205c5c});});}};var _0x3d0a33=jayson[_0x7c13('0x66')](_0x2b9d75)[_0x7c13('0x67')]();_0x3d0a33['on'](_0x7c13('0x3c'),function(_0x781f68){logger[_0x7c13('0x3c')](JSON[_0x7c13('0x40')](_0x781f68));return _0x19e4fb(_0x781f68);});_0x3d0a33[_0x7c13('0x12')](0x232c,'127.0.0.1',function(){console[_0x7c13('0x68')](_0x7c13('0x69'),0x232c);return _0x2b4b46('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xdec3=['stack','agent','agents','end','QueueReport','update','UserId','catch','message\x20is\x20empty','busy','capacity','hasOwnProperty','CurrentCapacity','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','listen','127.0.0.1','lodash','path','jayson/promise','bluebird','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','map','Intervals','interval','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','toLowerCase','autoreply','appdata','split','channel','mail','push','slice','dialogflow','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','app','./interval','condition','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','.js','rules','execute','Applications\x20executed','stringify','matchPath','emit','Skipped\x20routing\x20for\x20%s','error'];(function(_0x35edb4,_0x3423a3){var _0x2bd540=function(_0x306f13){while(--_0x306f13){_0x35edb4['push'](_0x35edb4['shift']());}};_0x2bd540(++_0x3423a3);}(_0xdec3,0x89));var _0x3dec=function(_0x32fb5a,_0x565a38){_0x32fb5a=_0x32fb5a-0x0;var _0x2f212c=_0xdec3[_0x32fb5a];return _0x2f212c;};'use strict';var _=require(_0x3dec('0x0'));var util=require('util');var path=require(_0x3dec('0x1'));var fs=require('fs');var jayson=require(_0x3dec('0x2'));var BPromise=require(_0x3dec('0x3'));var utils=require('./applications/utils');var sUtils=require(_0x3dec('0x4'));var logger=require(_0x3dec('0x5'))(_0x3dec('0x6'));var rpc={'openchannelQueueReport':require(_0x3dec('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x3dec('0x8')),'smsQueueReport':require(_0x3dec('0x9')),'faxQueueReport':require(_0x3dec('0xa')),'whatsappQueueReport':require(_0x3dec('0xb'))};var RuleEngine=require(_0x3dec('0xc'));function getId(_0x311a74,_0x207dcf,_0x4b32d2){return util[_0x3dec('0xd')](_0x3dec('0xe'),_0x311a74,_0x207dcf||0x0,_0x4b32d2||0x0);}function getIntervals(_0x599552,_0x26a604){var _0x4c5748=[];if(!_['isNil'](_0x26a604[_0x3dec('0xf')])&&!_[_0x3dec('0x10')](_0x599552[_0x26a604['IntervalId']])&&!_[_0x3dec('0x10')](_0x599552[_0x26a604[_0x3dec('0xf')]]['Intervals'])){_0x4c5748=_[_0x3dec('0x11')](_0x599552[_0x26a604[_0x3dec('0xf')]][_0x3dec('0x12')],_0x3dec('0x13'));}else if(!_[_0x3dec('0x10')](_0x26a604[_0x3dec('0x13')])){_0x4c5748=[_0x26a604['interval']];}return _0x4c5748;}exports['listen']=function(_0x3d4759){_0x3d4759['rules']={};return new BPromise(function(_0x41ab02,_0xed2beb){var _0x5702f2={'Start':function(_0x5605b8){var _0x1daae8=this;return new Promise(function(_0x480e08,_0x1fdf82){if(_0x5605b8){try{var _0x4b5ae2=[];var _0x3858ee=getId(_0x5605b8['channel'],_0x5605b8[_0x3dec('0x14')]?_0x5605b8[_0x3dec('0x14')]['id']:0x0,_0x5605b8['interaction']?_0x5605b8[_0x3dec('0x15')]['id']:0x0);var _0x249bc2=sUtils[_0x3dec('0x16')](_0x3d4759,_0x5605b8);if(_0x5605b8[_0x3dec('0x17')]||!_0x249bc2&&_0x5605b8[_0x3dec('0x18')]&&_[_0x3dec('0x19')](_0x5605b8[_0x3dec('0x18')])&&_0x5605b8[_0x3dec('0x18')][_0x3dec('0x1a')]){for(var _0x331c8f=0x0;_0x331c8f<_0x5605b8[_0x3dec('0x18')][_0x3dec('0x1a')];_0x331c8f+=0x1){var _0x41acfb=_0x5605b8[_0x3dec('0x18')][_0x331c8f];if(fs[_0x3dec('0x1b')](path[_0x3dec('0x1c')](__dirname,_0x3dec('0x18'),_0x41acfb['app']+'.js'))){var _0x5de683=[];switch(_0x41acfb['app'][_0x3dec('0x1d')]()){case _0x3dec('0x1e'):var _0x2399dc=_0x41acfb[_0x3dec('0x1f')][_0x3dec('0x20')](',');if(_0x5605b8[_0x3dec('0x21')]===_0x3dec('0x22')){_0x5de683[_0x3dec('0x23')](_0x2399dc[0x0]);_0x5de683[_0x3dec('0x23')](_0x2399dc[0x1]);_0x5de683['push'](_0x2399dc[_0x3dec('0x24')](0x2,_0x2399dc[_0x3dec('0x1a')])[_0x3dec('0x1c')](','));}else{_0x5de683['push'](_0x2399dc[0x0]);_0x5de683[_0x3dec('0x23')](_0x2399dc[_0x3dec('0x24')](0x1,_0x2399dc['length'])[_0x3dec('0x1c')](','));}break;case _0x3dec('0x25'):var _0x5a578f=_0x41acfb[_0x3dec('0x1f')][_0x3dec('0x20')](',');_0x5de683[_0x3dec('0x23')](_0x5a578f[0x0]);_0x5de683[_0x3dec('0x23')](_0x5a578f[0x1]);_0x5de683[_0x3dec('0x23')](_0x5a578f['slice'](0x2,_0x5a578f[_0x3dec('0x1a')])['join'](','));break;case'dialogflowv2':var _0x1b1e2e=_0x41acfb['appdata']['split'](',');_0x5de683[_0x3dec('0x23')](_0x1b1e2e[0x0]);_0x5de683[_0x3dec('0x23')](_0x1b1e2e[0x1]);_0x5de683[_0x3dec('0x23')](_0x1b1e2e[0x2]);_0x5de683[_0x3dec('0x23')](_0x1b1e2e[0x3]);_0x5de683['push'](_0x1b1e2e[_0x3dec('0x24')](0x4,_0x1b1e2e[_0x3dec('0x1a')])[_0x3dec('0x1c')](','));break;case _0x3dec('0x26'):var _0x49c658=_0x41acfb[_0x3dec('0x1f')]['split'](',');_0x5de683['push'](_0x49c658[0x0]);_0x5de683[_0x3dec('0x23')](_0x49c658[0x1]);_0x5de683[_0x3dec('0x23')](_0x49c658[0x2]);_0x5de683[_0x3dec('0x23')](_0x49c658[0x3]);_0x5de683[_0x3dec('0x23')](_0x49c658[_0x3dec('0x24')](0x4,_0x49c658[_0x3dec('0x1a')])['join'](','));break;case'message':_0x5de683[_0x3dec('0x23')](_0x41acfb['appdata']);break;case _0x3dec('0x27'):_0x5de683[_0x3dec('0x23')](_0x41acfb[_0x3dec('0x28')]);_0x5de683[_0x3dec('0x23')](_0x41acfb['appdata']);break;case _0x3dec('0x29'):var _0x4993bc=utils[_0x3dec('0x2a')](_0x5605b8[_0x3dec('0x2b')][_0x3dec('0x2c')],_0x5605b8);var _0x1dfc04=_0x41acfb['appdata']['split'](',');_0x5de683[_0x3dec('0x23')](_0x1dfc04[0x0]);_0x5de683[_0x3dec('0x23')](_0x1dfc04[0x1]);_0x5de683[_0x3dec('0x23')](_0x1dfc04[0x2]);_0x5de683[_0x3dec('0x23')](_0x1dfc04[0x3]);_0x5de683[_0x3dec('0x23')](_0x1dfc04[0x4]);_0x5de683[_0x3dec('0x23')](_0x1dfc04[0x5]);_0x5de683[_0x3dec('0x23')](_0x1dfc04[0x6]);_0x5de683[_0x3dec('0x23')](_0x1dfc04[0x7]);_0x5de683['push'](_0x1dfc04[0x8]);_0x5de683['push'](_0x1dfc04[0x9]);_0x5de683[_0x3dec('0x23')](_0x1dfc04[0xa]);_0x5de683[_0x3dec('0x23')](_0x5605b8[_0x3dec('0x15')]['id']);_0x5de683[_0x3dec('0x23')](_0x5605b8[_0x3dec('0x14')]['id']);_0x5de683['push'](_0x41acfb[_0x3dec('0x2d')]);_0x5de683[_0x3dec('0x23')](_0x5605b8['interaction'][_0x3dec('0x2e')]);_0x5de683[_0x3dec('0x23')](_0x5605b8[_0x3dec('0x2f')]['body']);_0x5de683[_0x3dec('0x23')](_0x4993bc);break;default:_0x5de683=_[_0x3dec('0x10')](_0x41acfb[_0x3dec('0x1f')])?[]:_0x41acfb[_0x3dec('0x1f')][_0x3dec('0x20')](',');}var _0x5ad9af={'id':util[_0x3dec('0xd')](_0x3dec('0x30'),_0x3858ee,_0x41acfb['id'],_0x41acfb[_0x3dec('0x31')]),'condition':require(_0x3dec('0x32'))[_0x3dec('0x33')](_0x3858ee,getIntervals(_0x3d4759[_0x3dec('0x34')],_0x41acfb),_0x3d4759),'consequence':require('./applications/'+_0x41acfb[_0x3dec('0x31')])[_0x3dec('0x35')](_0x3858ee,_0x5de683,_0x3d4759,_0x5605b8),'p':_0x41acfb[_0x3dec('0x36')]||0x0};logger[_0x3dec('0x37')](_0x3dec('0x38'),_0x5ad9af['id'],_0x3dec('0x39'),getIntervals(_0x3d4759['intervals'],_0x41acfb)[_0x3dec('0x1c')](_0x3dec('0x3a')));_0x4b5ae2['push'](_0x5ad9af);}else{logger['error'](_0x3dec('0x3b'),path['join'](__dirname,_0x3dec('0x18'),_0x41acfb[_0x3dec('0x31')]+_0x3dec('0x3c')));}}_0x3d4759[_0x3dec('0x3d')][_0x3858ee]=new RuleEngine(_0x4b5ae2);_0x3d4759['rules'][_0x3858ee][_0x3dec('0x3e')](_0x5605b8,function(_0x58e416){logger['info'](_0x3dec('0x3f'),JSON[_0x3dec('0x40')](_0x58e416[_0x3dec('0x41')]));if(_0x3d4759[_0x3dec('0x3d')][_0x3858ee]){_0x3d4759[_0x3dec('0x3d')][_0x3858ee][_0x3dec('0x42')]('complete');}});return _0x480e08({'code':0xc8,'message':_0x5605b8});}else{if(_0x249bc2){logger[_0x3dec('0x37')](util[_0x3dec('0xd')](_0x3dec('0x43'),_0x3858ee));}else{logger[_0x3dec('0x37')]('No\x20applications\x20to\x20execute');}return _0x480e08({'code':0xc8,'message':_0x5605b8});}}catch(_0x5bcdd3){logger[_0x3dec('0x44')](_0x5bcdd3[_0x3dec('0x45')]);return _0x1fdf82(_0x1daae8['error'](0x1f4,_0x5bcdd3));}}return _0x1fdf82('routing\x20is\x20empty');});},'AcceptMessage':function(_0x283323){var _0x590863=this;return new Promise(function(_0x2ad046,_0x553d85){if(_0x283323['agent']&&_0x283323[_0x3dec('0x46')]['id']){if(_0x3d4759[_0x3dec('0x47')][_0x283323['agent']['id']]){_0x3d4759[_0x3dec('0x47')][_0x283323[_0x3dec('0x46')]['id']]['busy']=![];_0x3d4759[_0x3dec('0x47')][_0x283323[_0x3dec('0x46')]['id']]['busyQueue']=undefined;}}if(_0x283323[_0x3dec('0x14')]&&_0x283323[_0x3dec('0x14')]['id']){try{var _0x2cf703=getId(_0x283323[_0x3dec('0x21')],_0x283323[_0x3dec('0x14')]?_0x283323['message']['id']:0x0,_0x283323[_0x3dec('0x15')]?_0x283323[_0x3dec('0x15')]['id']:0x0);if(_0x3d4759[_0x3dec('0x3d')][_0x2cf703]){_0x3d4759[_0x3dec('0x3d')][_0x2cf703][_0x3dec('0x42')](_0x3dec('0x48'));if(rpc[_0x283323['channel']+_0x3dec('0x49')]){rpc[_0x283323[_0x3dec('0x21')]+_0x3dec('0x49')][_0x3dec('0x4a')](_0x2cf703,{'UserId':_0x283323[_0x3dec('0x14')][_0x3dec('0x4b')]})[_0x3dec('0x4c')](function(){logger[_0x3dec('0x44')]('error\x20update\x20queue\x20report');});}}return _0x2ad046({'code':0xc8,'message':_0x283323});}catch(_0x1ab93d){logger[_0x3dec('0x44')](_0x1ab93d[_0x3dec('0x45')]);return _0x553d85(_0x590863[_0x3dec('0x44')](0x1f4,_0x1ab93d));}}logger['error'](_0x3dec('0x4d'));return _0x553d85(_0x590863[_0x3dec('0x44')](0x1f4,_0x3dec('0x4d')));});},'RejectMessage':function(_0xb48fdd){var _0x5148be=this;return new Promise(function(_0x56782a,_0x313f56){if(_0xb48fdd[_0x3dec('0x46')]&&_0xb48fdd[_0x3dec('0x46')]['id']){try{if(_0x3d4759[_0x3dec('0x47')][_0xb48fdd['agent']['id']]){_0x3d4759['agents'][_0xb48fdd['agent']['id']][_0x3dec('0x4e')]=![];_0x3d4759['agents'][_0xb48fdd[_0x3dec('0x46')]['id']]['busyQueue']=undefined;}return _0x56782a({'code':0xc8,'message':_0xb48fdd});}catch(_0x568fa0){logger[_0x3dec('0x44')](_0x568fa0[_0x3dec('0x45')]);return _0x313f56(_0x5148be['error'](0x1f4,_0x568fa0));}}logger[_0x3dec('0x44')](_0x3dec('0x4d'));return _0x313f56(_0x5148be[_0x3dec('0x44')](0x1f4,_0x3dec('0x4d')));});},'AbandonInteraction':function(_0x2f269e){var _0x3dd362=this;return new Promise(function(_0x3822ee,_0x4aba80){if(_0x2f269e[_0x3dec('0x21')]&&_0x2f269e['interaction']&&_0x2f269e[_0x3dec('0x15')]['id']){try{var _0x46ffe7=getId(_0x2f269e['channel'],_0x2f269e['message']?_0x2f269e['message']['id']:0x0,_0x2f269e[_0x3dec('0x15')]?_0x2f269e[_0x3dec('0x15')]['id']:0x0);if(_0x3d4759[_0x3dec('0x3d')][_0x46ffe7]){_0x3d4759['rules'][_0x46ffe7][_0x3dec('0x42')](_0x3dec('0x48'));}return _0x3822ee({'code':0xc8,'message':_0x2f269e});}catch(_0x142a05){logger[_0x3dec('0x44')](_0x142a05['stack']);return _0x4aba80(_0x3dd362[_0x3dec('0x44')](0x1f4,_0x142a05));}}logger['error'](_0x3dec('0x4d'));return _0x4aba80(_0x3dd362[_0x3dec('0x44')](0x1f4,_0x3dec('0x4d')));});},'AgentCapacity':function(_0x1fe45b){var _0x4f303d=this;return new Promise(function(_0x2bce00,_0x56bc3b){if(_0x3d4759[_0x3dec('0x47')]['hasOwnProperty'](_0x1fe45b['id'])){for(var _0x424728 in _0x1fe45b['capacity']){if(_0x1fe45b[_0x3dec('0x4f')][_0x3dec('0x50')](_0x424728)){if(_0x3d4759[_0x3dec('0x47')][_0x1fe45b['id']]['hasOwnProperty'](_0x424728+_0x3dec('0x51'))){_0x3d4759[_0x3dec('0x47')][_0x1fe45b['id']][_0x424728+_0x3dec('0x51')]=parseInt(_0x1fe45b[_0x3dec('0x4f')][_0x424728],0xa);}}}_0x3d4759[_0x3dec('0x47')][_0x1fe45b['id']]['updateRealtime']();return _0x2bce00({'code':0xc8,'message':_0x3d4759[_0x3dec('0x47')][_0x1fe45b['id']]});}else{return _0x56bc3b(_0x4f303d[_0x3dec('0x44')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x2dc225){return new Promise(function(_0x564c16){var _0x5b42d1=_[_0x3dec('0x52')](_0x3d4759[_0x3dec('0x47')]);if(_0x2dc225&&_0x2dc225['id']){var _0x3d978d=_[_0x3dec('0x53')](_0x5b42d1,function(_0x810c11){return _0x810c11['id']===_0x2dc225['id'];});_0x564c16(_0x3d978d);}else{_0x564c16({'count':_0x5b42d1['length'],'rows':_0x5b42d1});}});},'ChatQueues':function(){return new Promise(function(_0x1dacd7){var _0x2e5eb=[];for(var _0x261bae in _0x3d4759[_0x3dec('0x54')]){if(_0x3d4759[_0x3dec('0x54')][_0x3dec('0x50')](_0x261bae)){var _0x54f9ba=_0x3d4759[_0x3dec('0x54')][_0x261bae];var _0x1b0270={'id':_0x54f9ba['id'],'available':_0x54f9ba[_0x3dec('0x55')],'loggedIn':_0x54f9ba[_0x3dec('0x56')],'name':_0x54f9ba[_0x3dec('0x57')],'paused':_0x54f9ba[_0x3dec('0x58')],'waiting':_0x54f9ba[_0x3dec('0x59')]};_0x2e5eb[_0x3dec('0x23')](_0x1b0270);}}_0x1dacd7({'count':_0x2e5eb[_0x3dec('0x1a')],'rows':_0x2e5eb});});},'MailQueues':function(){return new Promise(function(_0x1162a0){var _0x4f90ea=[];for(var _0x16e8f0 in _0x3d4759[_0x3dec('0x5a')]){if(_0x3d4759['mailQueues']['hasOwnProperty'](_0x16e8f0)){var _0x42d6a4=_0x3d4759['mailQueues'][_0x16e8f0];var _0x2acd8d={'id':_0x42d6a4['id'],'available':_0x42d6a4[_0x3dec('0x55')],'loggedIn':_0x42d6a4[_0x3dec('0x56')],'name':_0x42d6a4[_0x3dec('0x57')],'paused':_0x42d6a4[_0x3dec('0x58')],'waiting':_0x42d6a4[_0x3dec('0x59')]};_0x4f90ea[_0x3dec('0x23')](_0x2acd8d);}}_0x1162a0({'count':_0x4f90ea['length'],'rows':_0x4f90ea});});},'OpenchannelQueues':function(){return new Promise(function(_0x460f62){var _0x904e=[];for(var _0x21cc28 in _0x3d4759[_0x3dec('0x5b')]){if(_0x3d4759['openchannelQueues'][_0x3dec('0x50')](_0x21cc28)){var _0x2c71ce=_0x3d4759[_0x3dec('0x5b')][_0x21cc28];var _0x3af8ac={'id':_0x2c71ce['id'],'available':_0x2c71ce['available'],'loggedIn':_0x2c71ce[_0x3dec('0x56')],'name':_0x2c71ce[_0x3dec('0x57')],'paused':_0x2c71ce[_0x3dec('0x58')],'waiting':_0x2c71ce['waiting']};_0x904e[_0x3dec('0x23')](_0x3af8ac);}}_0x460f62({'count':_0x904e[_0x3dec('0x1a')],'rows':_0x904e});});},'SmsQueues':function(){return new Promise(function(_0x9c04ed){var _0x35adbd=[];for(var _0x2e4cd2 in _0x3d4759[_0x3dec('0x5c')]){if(_0x3d4759[_0x3dec('0x5c')][_0x3dec('0x50')](_0x2e4cd2)){var _0x396447=_0x3d4759[_0x3dec('0x5c')][_0x2e4cd2];var _0x59404c={'id':_0x396447['id'],'available':_0x396447[_0x3dec('0x55')],'loggedIn':_0x396447[_0x3dec('0x56')],'name':_0x396447['name'],'paused':_0x396447['paused'],'waiting':_0x396447[_0x3dec('0x59')]};_0x35adbd['push'](_0x59404c);}}_0x9c04ed({'count':_0x35adbd[_0x3dec('0x1a')],'rows':_0x35adbd});});},'FaxQueues':function(){return new Promise(function(_0x5afb58){var _0x867d11=[];for(var _0x2471f9 in _0x3d4759[_0x3dec('0x5d')]){if(_0x3d4759[_0x3dec('0x5d')][_0x3dec('0x50')](_0x2471f9)){var _0xf56bbe=_0x3d4759[_0x3dec('0x5d')][_0x2471f9];var _0xffb65e={'id':_0xf56bbe['id'],'available':_0xf56bbe['available'],'loggedIn':_0xf56bbe[_0x3dec('0x56')],'name':_0xf56bbe[_0x3dec('0x57')],'paused':_0xf56bbe[_0x3dec('0x58')],'waiting':_0xf56bbe[_0x3dec('0x59')]};_0x867d11[_0x3dec('0x23')](_0xffb65e);}}_0x5afb58({'count':_0x867d11[_0x3dec('0x1a')],'rows':_0x867d11});});},'WhatsappQueues':function(){return new Promise(function(_0x11e543){var _0x53d336=[];for(var _0xfe75cf in _0x3d4759[_0x3dec('0x5e')]){if(_0x3d4759[_0x3dec('0x5e')][_0x3dec('0x50')](_0xfe75cf)){var _0x5f4746=_0x3d4759[_0x3dec('0x5e')][_0xfe75cf];var _0x2d9b8f={'id':_0x5f4746['id'],'available':_0x5f4746[_0x3dec('0x55')],'loggedIn':_0x5f4746[_0x3dec('0x56')],'name':_0x5f4746[_0x3dec('0x57')],'paused':_0x5f4746[_0x3dec('0x58')],'waiting':_0x5f4746['waiting']};_0x53d336[_0x3dec('0x23')](_0x2d9b8f);}}_0x11e543({'count':_0x53d336[_0x3dec('0x1a')],'rows':_0x53d336});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x7bb412){var _0x5031d3=_[_0x3dec('0x52')](_0x3d4759[_0x3dec('0x5f')]);_0x7bb412({'count':_0x5031d3[_0x3dec('0x1a')],'rows':_0x5031d3});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x4f377d){var _0x262d71=_['values'](_0x3d4759[_0x3dec('0x60')]);_0x4f377d({'count':_0x262d71[_0x3dec('0x1a')],'rows':_0x262d71});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x5cc051){var _0x39ce21=_[_0x3dec('0x52')](_0x3d4759[_0x3dec('0x61')]);_0x5cc051({'count':_0x39ce21[_0x3dec('0x1a')],'rows':_0x39ce21});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x165b98){var _0x534465=_[_0x3dec('0x52')](_0x3d4759[_0x3dec('0x62')]);_0x165b98({'count':_0x534465[_0x3dec('0x1a')],'rows':_0x534465});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x578af6){var _0x4cec9e=_[_0x3dec('0x52')](_0x3d4759['faxQueuesWaitingInteractions']);_0x578af6({'count':_0x4cec9e[_0x3dec('0x1a')],'rows':_0x4cec9e});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x199f6f){var _0x4e7a8a=_['values'](_0x3d4759[_0x3dec('0x63')]);_0x199f6f({'count':_0x4e7a8a['length'],'rows':_0x4e7a8a});});}};var _0x10c23a=jayson['server'](_0x5702f2)[_0x3dec('0x64')]();_0x10c23a['on']('error',function(_0x1a8d18){logger[_0x3dec('0x44')](JSON[_0x3dec('0x40')](_0x1a8d18));return _0xed2beb(_0x1a8d18);});_0x10c23a[_0x3dec('0x65')](0x232c,_0x3dec('0x66'),function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x41ab02('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 1b9bc57..b25e67d 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 _0x50ab=['format','iftime\x20%s','message','indexOf','true','all','info','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','stack','bluebird','lodash','../../../config/logger','routing','client','http','then','error','result','catch','condition','rules','stop','push'];(function(_0x385e5d,_0x37526f){var _0x4745d7=function(_0x596fe8){while(--_0x596fe8){_0x385e5d['push'](_0x385e5d['shift']());}};_0x4745d7(++_0x37526f);}(_0x50ab,0x6f));var _0xb50a=function(_0x441ff7,_0x3f8a12){_0x441ff7=_0x441ff7-0x0;var _0x12eff2=_0x50ab[_0x441ff7];return _0x12eff2;};'use strict';var util=require('util');var BPromise=require(_0xb50a('0x0'));var jayson=require('jayson/promise');var _=require(_0xb50a('0x1'));var logger=require(_0xb50a('0x2'))(_0xb50a('0x3'));var client=jayson[_0xb50a('0x4')][_0xb50a('0x5')]({'port':0x232a});function request(_0x1988ae,_0x4d0d02){return new BPromise(function(_0x3a359d,_0x428d69){return client['request'](_0x1988ae,_0x4d0d02)[_0xb50a('0x6')](function(_0x584ab7){if(_0x584ab7[_0xb50a('0x7')]){return _0x428d69(_0x584ab7[_0xb50a('0x7')]['message']);}else{return _0x3a359d(_0x584ab7[_0xb50a('0x8')]);}})[_0xb50a('0x9')](function(_0x1fb4fe){return _0x428d69(_0x1fb4fe);});});}exports[_0xb50a('0xa')]=function(_0x45e82f,_0x4b35e5,_0x3be313){return function(_0x4e4e7e){if(_0x3be313['rules']&&!_0x3be313[_0xb50a('0xb')][_0x45e82f]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x45e82f);return _0x4e4e7e[_0xb50a('0xc')]();}var _0x20ae4d=[];for(var _0x3c94b1=0x0;_0x3c94b1<_0x4b35e5['length'];_0x3c94b1+=0x1){_0x20ae4d[_0xb50a('0xd')](request('Command',{'command':util[_0xb50a('0xe')](_0xb50a('0xf'),_0x4b35e5[_0x3c94b1])})[_0xb50a('0x6')](function(_0x4f2ec5){return _0x4f2ec5&&_0x4f2ec5[_0xb50a('0x10')]&&_0x4f2ec5[_0xb50a('0x10')][_0xb50a('0x11')](_0xb50a('0x12'))>=0x0?!![]:![];})[_0xb50a('0x9')](function(){logger[_0xb50a('0x7')]('[%s][INTERVAL]\x20%s',_0x45e82f,_0x4b35e5[_0x3c94b1]);}));}BPromise[_0xb50a('0x13')](_0x20ae4d)[_0xb50a('0x6')](function(_0x1a688e){var _0x16badf=_['some'](_0x1a688e);logger[_0xb50a('0x14')](_0xb50a('0x15'),_0x45e82f,_0x4b35e5['join'](_0xb50a('0x16')),_0x16badf);_0x4e4e7e[_0xb50a('0x17')](_0x16badf);})[_0xb50a('0x9')](function(_0x39471c){logger[_0xb50a('0x7')](_0xb50a('0x15'),_0x45e82f,_0x4b35e5['join'](_0xb50a('0x16')),_0x39471c[_0xb50a('0x18')]);_0x4e4e7e['stop']();});};}; \ No newline at end of file +var _0x016e=['message','true','[%s][INTERVAL]\x20%s','all','then','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','join','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','error','result','catch','rules','info','stop','length','push','Command','iftime\x20%s'];(function(_0x1fb428,_0x5586db){var _0x4961c8=function(_0x2b0c29){while(--_0x2b0c29){_0x1fb428['push'](_0x1fb428['shift']());}};_0x4961c8(++_0x5586db);}(_0x016e,0xc7));var _0xe016=function(_0x5b4b09,_0x3ef12e){_0x5b4b09=_0x5b4b09-0x0;var _0x59ec36=_0x016e[_0x5b4b09];return _0x59ec36;};'use strict';var util=require(_0xe016('0x0'));var BPromise=require(_0xe016('0x1'));var jayson=require(_0xe016('0x2'));var _=require(_0xe016('0x3'));var logger=require(_0xe016('0x4'))(_0xe016('0x5'));var client=jayson[_0xe016('0x6')]['http']({'port':0x232a});function request(_0x2cba50,_0x3c43b5){return new BPromise(function(_0x3c51eb,_0x5e2f88){return client['request'](_0x2cba50,_0x3c43b5)['then'](function(_0x10abbf){if(_0x10abbf[_0xe016('0x7')]){return _0x5e2f88(_0x10abbf['error']['message']);}else{return _0x3c51eb(_0x10abbf[_0xe016('0x8')]);}})[_0xe016('0x9')](function(_0x556049){return _0x5e2f88(_0x556049);});});}exports['condition']=function(_0x16d773,_0x2e6e5f,_0x35e12f){return function(_0x754987){if(_0x35e12f[_0xe016('0xa')]&&!_0x35e12f[_0xe016('0xa')][_0x16d773]){logger[_0xe016('0xb')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x16d773);return _0x754987[_0xe016('0xc')]();}var _0x13cb72=[];for(var _0x1b1e96=0x0;_0x1b1e96<_0x2e6e5f[_0xe016('0xd')];_0x1b1e96+=0x1){_0x13cb72[_0xe016('0xe')](request(_0xe016('0xf'),{'command':util['format'](_0xe016('0x10'),_0x2e6e5f[_0x1b1e96])})['then'](function(_0x1b1480){return _0x1b1480&&_0x1b1480[_0xe016('0x11')]&&_0x1b1480[_0xe016('0x11')]['indexOf'](_0xe016('0x12'))>=0x0?!![]:![];})['catch'](function(){logger['error'](_0xe016('0x13'),_0x16d773,_0x2e6e5f[_0x1b1e96]);}));}BPromise[_0xe016('0x14')](_0x13cb72)[_0xe016('0x15')](function(_0x51d90a){var _0x2586c0=_[_0xe016('0x16')](_0x51d90a);logger[_0xe016('0xb')](_0xe016('0x17'),_0x16d773,_0x2e6e5f['join'](_0xe016('0x18')),_0x2586c0);_0x754987['when'](_0x2586c0);})['catch'](function(_0x2bba2f){logger[_0xe016('0x7')](_0xe016('0x17'),_0x16d773,_0x2e6e5f[_0xe016('0x19')](_0xe016('0x18')),_0x2bba2f[_0xe016('0x1a')]);_0x754987['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 58d2e56..db53c00 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 _0x6cb4=['[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','interface','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete','acw','agentacw','acwTimeout','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','agentcompleteAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','transfer','blind','transferexten','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','transfertype','secondtransfererexten','transfertargetuniqueid','hangup','cause'];(function(_0x5ba5df,_0xef28e7){var _0x3c2aa1=function(_0x11a192){while(--_0x11a192){_0x5ba5df['push'](_0x5ba5df['shift']());}};_0x3c2aa1(++_0xef28e7);}(_0x6cb4,0xff));var _0x46cb=function(_0x2cd402,_0x55a1c3){_0x2cd402=_0x2cd402-0x0;var _0x342af4=_0x6cb4[_0x2cd402];return _0x342af4;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var utils=require(_0x46cb('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3403fc,_0x375bef){utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x5'),_0x3403fc[_0x46cb('0x6')],_0x3403fc['channel'],_0x3403fc[_0x46cb('0x7')],_0x3403fc['membername'],_0x3403fc[_0x46cb('0x8')],_0x3403fc['calleridnum'],_0x3403fc[_0x46cb('0x9')],_0x3403fc[_0x46cb('0xa')]));if(_0x3403fc[_0x46cb('0x7')]){utils[_0x46cb('0xb')](_0x3403fc[_0x46cb('0x7')])[_0x46cb('0xc')](function(_0x56258a){if(_0x56258a){_0x3403fc[_0x46cb('0xd')]=_0x56258a[_0x46cb('0xd')];_0x3403fc['agentacw']=_0x3403fc[_0x46cb('0xe')]?_0x56258a[_0x46cb('0xf')]:![];_0x3403fc['acwtime']=_0x3403fc[_0x46cb('0x10')]?_0x56258a[_0x46cb('0x11')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x3403fc);});}else{utils['request'](_0x46cb('0x12'),_0x3403fc);}if(_0x375bef){delete transfers[_0x3403fc[_0x46cb('0x6')]];}else{delete agents[_0x3403fc[_0x46cb('0x13')]];}}exports[_0x46cb('0x14')]=function(_0x553440){try{utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x16'),_0x553440[_0x46cb('0x6')]),_0x553440);agents[_0x553440[_0x46cb('0x13')]]=_0x553440;agents[_0x553440[_0x46cb('0x13')]][_0x46cb('0x17')]=utils[_0x46cb('0x18')]();agents[_0x553440[_0x46cb('0x13')]][_0x46cb('0xa')]=_0x46cb('0x19');agents[_0x553440['destuniqueid']][_0x46cb('0x9')]=null;agents[_0x553440['destuniqueid']][_0x46cb('0x1a')]=null;utils['info'](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x553440[_0x46cb('0x6')],agents[_0x553440[_0x46cb('0x13')]][_0x46cb('0x1b')],_0x553440[_0x46cb('0x13')]));}catch(_0xbd488f){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x16'),_0x553440[_0x46cb('0x6')]),_0xbd488f);}};exports[_0x46cb('0x1d')]=function(_0x149483){try{if(!_[_0x46cb('0x1e')](agents[_0x149483[_0x46cb('0x13')]])){utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x1f'),_0x149483[_0x46cb('0x6')]),_0x149483);utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x20'),_0x149483[_0x46cb('0x6')],agents[_0x149483[_0x46cb('0x13')]][_0x46cb('0x1b')],_0x149483[_0x46cb('0x13')]));agents[_0x149483[_0x46cb('0x13')]]['agentringnoanswer']=!![];agents[_0x149483['destuniqueid']][_0x46cb('0x21')]=utils[_0x46cb('0x18')]();agents[_0x149483[_0x46cb('0x13')]][_0x46cb('0xa')]=_0x46cb('0x22');agents[_0x149483['destuniqueid']][_0x46cb('0x23')]='timeout';agents[_0x149483['destuniqueid']]['holdtime']=_0x149483[_0x46cb('0x24')]?parseInt(_0x149483[_0x46cb('0x24')])/0x3e8:0x0;agents[_0x149483[_0x46cb('0x13')]][_0x46cb('0x25')]=0x0;unanswered[_0x46cb('0x26')](_0x149483[_0x46cb('0x13')]);}}catch(_0x378dc7){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x1f'),_0x149483[_0x46cb('0x6')]),_0x378dc7);}};exports['queuecallerabandon']=function(_0x1ce88f){try{_[_0x46cb('0x27')](agents,function(_0x4c73bd,_0x49e0bc){if(_0x4c73bd[_0x46cb('0x6')]==_0x1ce88f['uniqueid']&&!_[_0x46cb('0x28')](unanswered,_0x4c73bd[_0x46cb('0x13')])){utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x29'),_0x1ce88f[_0x46cb('0x6')]),_0x1ce88f);utils['info'](util[_0x46cb('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x1ce88f[_0x46cb('0x6')],_0x4c73bd[_0x46cb('0x1b')],_0x4c73bd['destuniqueid']));_0x4c73bd[_0x46cb('0x1d')]=!![];_0x4c73bd[_0x46cb('0x21')]=utils[_0x46cb('0x18')]();_0x4c73bd[_0x46cb('0xa')]=_0x46cb('0x2a');_0x4c73bd['reason']=_0x46cb('0x2a');_0x4c73bd['holdtime']=_0x1ce88f[_0x46cb('0x2b')];_0x4c73bd[_0x46cb('0x25')]=0x0;writeDB(_0x4c73bd);}});}catch(_0x2630e0){utils['error'](util[_0x46cb('0x4')](_0x46cb('0x29'),_0x1ce88f['uniqueid']),_0x2630e0);}};exports[_0x46cb('0x2c')]=function(_0xf8be9){try{if(agents[_0xf8be9[_0x46cb('0x13')]]){utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x2d'),_0xf8be9[_0x46cb('0x6')]),_0xf8be9);utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x2e'),_0xf8be9[_0x46cb('0x6')],agents[_0xf8be9['destuniqueid']]['membername'],_0xf8be9['destuniqueid']));agents[_0xf8be9[_0x46cb('0x13')]][_0x46cb('0x2f')]=utils[_0x46cb('0x18')]();agents[_0xf8be9[_0x46cb('0x13')]][_0x46cb('0x9')]=_0xf8be9[_0x46cb('0x9')];agents[_0xf8be9['destuniqueid']][_0x46cb('0x1a')]=_0xf8be9['connectedlinename'];agents[_0xf8be9['destuniqueid']][_0x46cb('0x2b')]=_0xf8be9['ringtime'];agents[_0xf8be9['destuniqueid']][_0x46cb('0xa')]='connect';_['forIn'](agents,function(_0x67bd14,_0x10017d){if(_0x67bd14[_0x46cb('0x13')]!=_0xf8be9[_0x46cb('0x13')]&&_0x67bd14[_0x46cb('0x6')]==_0xf8be9[_0x46cb('0x6')]){_0x67bd14[_0x46cb('0x25')]=0x0;_0x67bd14['holdtime']=_0xf8be9[_0x46cb('0x24')];_0x67bd14['agentringnoanswer']=!![];_0x67bd14[_0x46cb('0x21')]=utils['now']();_0x67bd14[_0x46cb('0xa')]=_0x46cb('0x30');_0x67bd14[_0x46cb('0x23')]='answered_elsewhere';_0x67bd14[_0x46cb('0x31')]=_0xf8be9[_0x46cb('0x13')];_0x67bd14['answeredelsewheremembername']=_0xf8be9[_0x46cb('0x1b')];writeDB(_0x67bd14);}});}}catch(_0x3d0b83){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x2d'),_0xf8be9['uniqueid']),_0x3d0b83);}};exports['agentcomplete']=function(_0x10bada){try{if(!_['isNil'](agents[_0x10bada[_0x46cb('0x13')]])){utils[_0x46cb('0x15')](util['format'](_0x46cb('0x32'),_0x10bada[_0x46cb('0x6')]),_0x10bada);utils[_0x46cb('0x3')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x10bada['uniqueid'],agents[_0x10bada['destuniqueid']][_0x46cb('0x1b')],_0x10bada[_0x46cb('0x13')]));agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0xe')]=!![];agents[_0x10bada[_0x46cb('0x13')]]['agentcompleteAt']=utils['now']();agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0x25')]=utils['diffTime'](agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0x33')],agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0x2f')]);agents[_0x10bada[_0x46cb('0x13')]][_0x46cb('0x23')]=_0x10bada[_0x46cb('0x23')];agents[_0x10bada['destuniqueid']]['lastevent']=_0x46cb('0x34');writeDB(agents[_0x10bada['destuniqueid']]);}}catch(_0x2c4ecb){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')]('[%s][agents][agentcomplete]',_0x10bada[_0x46cb('0x6')]),_0x2c4ecb);}};exports['blindtransfer']=function(_0x5c02c9){try{if(!_[_0x46cb('0x1e')](agents[_0x5c02c9[_0x46cb('0x35')]])){utils[_0x46cb('0x15')](util[_0x46cb('0x4')](_0x46cb('0x36'),_0x5c02c9[_0x46cb('0x6')]),_0x5c02c9);utils[_0x46cb('0x3')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x5c02c9[_0x46cb('0x6')],agents[_0x5c02c9[_0x46cb('0x35')]]['membername'],agents[_0x5c02c9[_0x46cb('0x35')]][_0x46cb('0x6')]));agents[_0x5c02c9[_0x46cb('0x35')]][_0x46cb('0x37')]=!![];agents[_0x5c02c9[_0x46cb('0x35')]]['transfertype']=_0x46cb('0x38');agents[_0x5c02c9[_0x46cb('0x35')]][_0x46cb('0x39')]=_0x5c02c9['extension'];agents[_0x5c02c9[_0x46cb('0x35')]]['transferuniqueid']=agents[_0x5c02c9['transfereruniqueid']][_0x46cb('0x6')];}}catch(_0x2cfe6f){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x36'),_0x5c02c9['uniqueid']),_0x2cfe6f);}};exports[_0x46cb('0x3a')]=function(_0xd51a75){try{utils['debug'](util['format'](_0x46cb('0x3b'),_0xd51a75[_0x46cb('0x3c')]),_0xd51a75);if(_0xd51a75[_0x46cb('0x3c')]==_0xd51a75['origtransfererlinkedid']){if(!_[_0x46cb('0x1e')](agents[_0xd51a75[_0x46cb('0x3d')]])){utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x3e'),_0xd51a75[_0x46cb('0x3c')],agents[_0xd51a75[_0x46cb('0x3d')]][_0x46cb('0x1b')]));agents[_0xd51a75[_0x46cb('0x3d')]]['transfer']=!![];agents[_0xd51a75[_0x46cb('0x3d')]]['transfertype']=_0x46cb('0x3f');agents[_0xd51a75[_0x46cb('0x3d')]][_0x46cb('0x39')]=_0xd51a75[_0x46cb('0x40')];agents[_0xd51a75['secondtransfereruniqueid']][_0x46cb('0x41')]=_0xd51a75[_0x46cb('0x3c')];}if(_0xd51a75[_0x46cb('0x42')]&&agents[_0xd51a75[_0x46cb('0x42')]]){agents[_0xd51a75[_0x46cb('0x42')]][_0x46cb('0x43')]=0x1;transfers[_0xd51a75[_0x46cb('0x42')]]=_[_0x46cb('0x44')](agents[_0xd51a75['transfereeuniqueid']]);transfers[_0xd51a75['transfereeuniqueid']]['calleridnum']=agents[_0xd51a75['secondtransfereruniqueid']][_0x46cb('0x45')];transfers[_0xd51a75[_0x46cb('0x42')]]['calleridname']=agents[_0xd51a75[_0x46cb('0x3d')]][_0x46cb('0x46')];transfers[_0xd51a75[_0x46cb('0x42')]]['agentcalledAt']=utils['now']();transfers[_0xd51a75[_0x46cb('0x42')]]['agentconnectAt']=utils[_0x46cb('0x18')]();transfers[_0xd51a75[_0x46cb('0x42')]][_0x46cb('0x2b')]=0x0;transfers[_0xd51a75[_0x46cb('0x42')]][_0x46cb('0x43')]=0x2;}}else if(_0xd51a75[_0x46cb('0x3d')]==_0xd51a75[_0x46cb('0x47')]){if(!_[_0x46cb('0x1e')](agents[_0xd51a75[_0x46cb('0x3c')]])){utils[_0x46cb('0x3')](util[_0x46cb('0x4')](_0x46cb('0x3e'),_0xd51a75[_0x46cb('0x3c')],agents[_0xd51a75['origtransfereruniqueid']][_0x46cb('0x1b')]));agents[_0xd51a75['origtransfereruniqueid']][_0x46cb('0x37')]=!![];agents[_0xd51a75[_0x46cb('0x3c')]][_0x46cb('0x48')]=_0x46cb('0x3f');agents[_0xd51a75[_0x46cb('0x3c')]][_0x46cb('0x39')]=_0xd51a75[_0x46cb('0x49')];agents[_0xd51a75['origtransfereruniqueid']][_0x46cb('0x41')]=_0xd51a75[_0x46cb('0x3d')];}if(_0xd51a75[_0x46cb('0x4a')]&&agents[_0xd51a75[_0x46cb('0x4a')]]){agents[_0xd51a75['transfertargetuniqueid']][_0x46cb('0x43')]=0x1;transfers[_0xd51a75[_0x46cb('0x4a')]]=_[_0x46cb('0x44')](agents[_0xd51a75[_0x46cb('0x4a')]]);transfers[_0xd51a75[_0x46cb('0x4a')]]['calleridnum']=agents[_0xd51a75[_0x46cb('0x3c')]][_0x46cb('0x45')];transfers[_0xd51a75[_0x46cb('0x4a')]][_0x46cb('0x46')]=agents[_0xd51a75[_0x46cb('0x3c')]][_0x46cb('0x46')];transfers[_0xd51a75[_0x46cb('0x4a')]][_0x46cb('0x17')]=utils['now']();transfers[_0xd51a75['transfertargetuniqueid']]['agentconnectAt']=utils[_0x46cb('0x18')]();transfers[_0xd51a75[_0x46cb('0x4a')]][_0x46cb('0x2b')]=0x0;transfers[_0xd51a75[_0x46cb('0x4a')]][_0x46cb('0x43')]=0x2;}}}catch(_0x1e3dca){utils[_0x46cb('0x1c')](util[_0x46cb('0x4')](_0x46cb('0x3b'),_0xd51a75[_0x46cb('0x3c')]),_0x1e3dca);}};exports[_0x46cb('0x4b')]=function(_0x199dc0){try{utils[_0x46cb('0x15')](util[_0x46cb('0x4')]('[%s][agents][hangup]',_0x199dc0[_0x46cb('0x6')]),_0x199dc0);if(agents[_0x199dc0['uniqueid']]&&agents[_0x199dc0[_0x46cb('0x6')]]['reason']===_0x46cb('0x22')){if(_0x199dc0[_0x46cb('0x4c')]==='21'){agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x23')]='rejected';agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]='rejected';}utils['info'](util[_0x46cb('0x4')](_0x46cb('0x4d'),_0x199dc0[_0x46cb('0x6')],agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x1b')],agents[_0x199dc0['uniqueid']]['reason'],agents[_0x199dc0['uniqueid']][_0x46cb('0xa')]));writeDB(agents[_0x199dc0[_0x46cb('0x6')]]);var _0x30b303=unanswered[_0x46cb('0x4e')](_0x199dc0[_0x46cb('0x6')]);if(_0x30b303>-0x1){unanswered[_0x46cb('0x4f')](_0x30b303,0x1);}}if(transfers[_0x199dc0[_0x46cb('0x6')]]){transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xe')]=!![];transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x33')]=utils['now']();transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x25')]=utils[_0x46cb('0x50')](transfers[_0x199dc0[_0x46cb('0x6')]]['agentcompleteAt'],transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x2f')]);transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x23')]='agent';transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]=_0x46cb('0x34');utils[_0x46cb('0x3')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x199dc0['uniqueid'],transfers[_0x199dc0[_0x46cb('0x6')]]['membername'],transfers[_0x199dc0[_0x46cb('0x6')]]['reason'],transfers[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]));writeDB(transfers[_0x199dc0[_0x46cb('0x6')]],!![]);}if(agents[_0x199dc0[_0x46cb('0x6')]]&&agents[_0x199dc0['uniqueid']][_0x46cb('0x2f')]){agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xe')]=!![];agents[_0x199dc0[_0x46cb('0x6')]]['agentcompleteAt']=utils['now']();agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x25')]=utils[_0x46cb('0x50')](agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x33')],agents[_0x199dc0[_0x46cb('0x6')]]['agentconnectAt']);agents[_0x199dc0['uniqueid']][_0x46cb('0x23')]=agents[_0x199dc0[_0x46cb('0x6')]]['transfer']?_0x46cb('0x37'):_0x46cb('0x51');agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]=_0x46cb('0x34');utils[_0x46cb('0x3')](util[_0x46cb('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x199dc0[_0x46cb('0x6')],agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x1b')],agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0x23')],agents[_0x199dc0[_0x46cb('0x6')]][_0x46cb('0xa')]));writeDB(agents[_0x199dc0[_0x46cb('0x6')]]);}}catch(_0x5567cc){utils['error'](util[_0x46cb('0x4')](_0x46cb('0x52'),_0x199dc0[_0x46cb('0x6')]),_0x5567cc);}}; \ No newline at end of file +var _0x750a=['interface','calleridnum','connectedlinenum','lastevent','then','type','agentcomplete','acw','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','now','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','[%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','connectedlinename','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','agentconnectAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','blind','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfertype','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','agentcalledAt','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','secondtransfererexten','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername'];(function(_0xae55e6,_0x2a5419){var _0x539768=function(_0x416bf8){while(--_0x416bf8){_0xae55e6['push'](_0xae55e6['shift']());}};_0x539768(++_0x2a5419);}(_0x750a,0x140));var _0xa750=function(_0x41d549,_0x13592d){_0x41d549=_0x41d549-0x0;var _0x1fc61e=_0x750a[_0x41d549];return _0x1fc61e;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x499583,_0x139fa5){utils[_0xa750('0x1')](util[_0xa750('0x2')](_0xa750('0x3'),_0x499583[_0xa750('0x4')],_0x499583[_0xa750('0x5')],_0x499583[_0xa750('0x6')],_0x499583[_0xa750('0x7')],_0x499583[_0xa750('0x8')],_0x499583[_0xa750('0x9')],_0x499583[_0xa750('0xa')],_0x499583[_0xa750('0xb')]));if(_0x499583[_0xa750('0x6')]){utils['getVoiceQueueByName'](_0x499583['queue'])[_0xa750('0xc')](function(_0x5b684e){if(_0x5b684e){_0x499583[_0xa750('0xd')]=_0x5b684e[_0xa750('0xd')];_0x499583['agentacw']=_0x499583[_0xa750('0xe')]?_0x5b684e[_0xa750('0xf')]:![];_0x499583['acwtime']=_0x499583['agentacw']?_0x5b684e[_0xa750('0x10')]:0x0;}utils['request'](_0xa750('0x11'),_0x499583);});}else{utils[_0xa750('0x12')]('CreateVoiceAgentReport',_0x499583);}if(_0x139fa5){delete transfers[_0x499583[_0xa750('0x4')]];}else{delete agents[_0x499583[_0xa750('0x13')]];}}exports[_0xa750('0x14')]=function(_0x567c51){try{utils[_0xa750('0x15')](util[_0xa750('0x2')](_0xa750('0x16'),_0x567c51[_0xa750('0x4')]),_0x567c51);agents[_0x567c51[_0xa750('0x13')]]=_0x567c51;agents[_0x567c51[_0xa750('0x13')]]['agentcalledAt']=utils[_0xa750('0x17')]();agents[_0x567c51[_0xa750('0x13')]][_0xa750('0xb')]='called';agents[_0x567c51[_0xa750('0x13')]][_0xa750('0xa')]=null;agents[_0x567c51['destuniqueid']]['connectedlinename']=null;utils[_0xa750('0x1')](util['format'](_0xa750('0x18'),_0x567c51[_0xa750('0x4')],agents[_0x567c51['destuniqueid']][_0xa750('0x7')],_0x567c51['destuniqueid']));}catch(_0x5f28f4){utils[_0xa750('0x19')](util['format'](_0xa750('0x16'),_0x567c51['uniqueid']),_0x5f28f4);}};exports[_0xa750('0x1a')]=function(_0x4a007d){try{if(!_[_0xa750('0x1b')](agents[_0x4a007d['destuniqueid']])){utils[_0xa750('0x15')](util['format']('[%s][agents][agentringnoanswer]',_0x4a007d[_0xa750('0x4')]),_0x4a007d);utils['info'](util[_0xa750('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x4a007d['uniqueid'],agents[_0x4a007d['destuniqueid']]['membername'],_0x4a007d[_0xa750('0x13')]));agents[_0x4a007d[_0xa750('0x13')]][_0xa750('0x1a')]=!![];agents[_0x4a007d[_0xa750('0x13')]][_0xa750('0x1c')]=utils[_0xa750('0x17')]();agents[_0x4a007d[_0xa750('0x13')]][_0xa750('0xb')]=_0xa750('0x1d');agents[_0x4a007d[_0xa750('0x13')]][_0xa750('0x1e')]=_0xa750('0x1d');agents[_0x4a007d[_0xa750('0x13')]][_0xa750('0x1f')]=_0x4a007d[_0xa750('0x20')]?parseInt(_0x4a007d['ringtime'])/0x3e8:0x0;agents[_0x4a007d[_0xa750('0x13')]][_0xa750('0x21')]=0x0;unanswered[_0xa750('0x22')](_0x4a007d['destuniqueid']);}}catch(_0x35ab53){utils[_0xa750('0x19')](util[_0xa750('0x2')](_0xa750('0x23'),_0x4a007d['uniqueid']),_0x35ab53);}};exports[_0xa750('0x24')]=function(_0x34d5e9){try{_[_0xa750('0x25')](agents,function(_0x2aef3a,_0x2c5253){if(_0x2aef3a['uniqueid']==_0x34d5e9[_0xa750('0x4')]&&!_['includes'](unanswered,_0x2aef3a[_0xa750('0x13')])){utils[_0xa750('0x15')](util['format'](_0xa750('0x26'),_0x34d5e9[_0xa750('0x4')]),_0x34d5e9);utils[_0xa750('0x1')](util[_0xa750('0x2')](_0xa750('0x27'),_0x34d5e9[_0xa750('0x4')],_0x2aef3a[_0xa750('0x7')],_0x2aef3a[_0xa750('0x13')]));_0x2aef3a['agentringnoanswer']=!![];_0x2aef3a[_0xa750('0x1c')]=utils['now']();_0x2aef3a[_0xa750('0xb')]=_0xa750('0x28');_0x2aef3a[_0xa750('0x1e')]=_0xa750('0x28');_0x2aef3a['holdtime']=_0x34d5e9[_0xa750('0x1f')];_0x2aef3a[_0xa750('0x21')]=0x0;writeDB(_0x2aef3a);}});}catch(_0x5c2e02){utils[_0xa750('0x19')](util[_0xa750('0x2')](_0xa750('0x26'),_0x34d5e9[_0xa750('0x4')]),_0x5c2e02);}};exports['agentconnect']=function(_0xf60128){try{if(agents[_0xf60128['destuniqueid']]){utils['debug'](util[_0xa750('0x2')](_0xa750('0x29'),_0xf60128[_0xa750('0x4')]),_0xf60128);utils['info'](util[_0xa750('0x2')](_0xa750('0x2a'),_0xf60128[_0xa750('0x4')],agents[_0xf60128['destuniqueid']][_0xa750('0x7')],_0xf60128[_0xa750('0x13')]));agents[_0xf60128[_0xa750('0x13')]]['agentconnectAt']=utils[_0xa750('0x17')]();agents[_0xf60128[_0xa750('0x13')]][_0xa750('0xa')]=_0xf60128['connectedlinenum'];agents[_0xf60128[_0xa750('0x13')]][_0xa750('0x2b')]=_0xf60128[_0xa750('0x2b')];agents[_0xf60128[_0xa750('0x13')]]['holdtime']=_0xf60128['ringtime'];agents[_0xf60128[_0xa750('0x13')]][_0xa750('0xb')]='connect';_[_0xa750('0x25')](agents,function(_0x2f57e9,_0x15d35a){if(_0x2f57e9[_0xa750('0x13')]!=_0xf60128[_0xa750('0x13')]&&_0x2f57e9['uniqueid']==_0xf60128[_0xa750('0x4')]){_0x2f57e9[_0xa750('0x21')]=0x0;_0x2f57e9[_0xa750('0x1f')]=_0xf60128[_0xa750('0x20')];_0x2f57e9[_0xa750('0x1a')]=!![];_0x2f57e9[_0xa750('0x1c')]=utils[_0xa750('0x17')]();_0x2f57e9['lastevent']=_0xa750('0x2c');_0x2f57e9['reason']=_0xa750('0x2c');_0x2f57e9['answeredelsewheredestinationuniqueid']=_0xf60128[_0xa750('0x13')];_0x2f57e9[_0xa750('0x2d')]=_0xf60128[_0xa750('0x7')];writeDB(_0x2f57e9);}});}}catch(_0x1be24e){utils[_0xa750('0x19')](util[_0xa750('0x2')](_0xa750('0x29'),_0xf60128[_0xa750('0x4')]),_0x1be24e);}};exports[_0xa750('0xe')]=function(_0x108a1a){try{if(!_[_0xa750('0x1b')](agents[_0x108a1a[_0xa750('0x13')]])){utils[_0xa750('0x15')](util[_0xa750('0x2')](_0xa750('0x2e'),_0x108a1a[_0xa750('0x4')]),_0x108a1a);utils[_0xa750('0x1')](util[_0xa750('0x2')](_0xa750('0x2f'),_0x108a1a[_0xa750('0x4')],agents[_0x108a1a['destuniqueid']][_0xa750('0x7')],_0x108a1a[_0xa750('0x13')]));agents[_0x108a1a[_0xa750('0x13')]][_0xa750('0xe')]=!![];agents[_0x108a1a[_0xa750('0x13')]][_0xa750('0x30')]=utils[_0xa750('0x17')]();agents[_0x108a1a[_0xa750('0x13')]][_0xa750('0x21')]=utils['diffTime'](agents[_0x108a1a[_0xa750('0x13')]][_0xa750('0x30')],agents[_0x108a1a['destuniqueid']][_0xa750('0x31')]);agents[_0x108a1a[_0xa750('0x13')]][_0xa750('0x1e')]=_0x108a1a[_0xa750('0x1e')];agents[_0x108a1a[_0xa750('0x13')]][_0xa750('0xb')]=_0xa750('0x32');writeDB(agents[_0x108a1a[_0xa750('0x13')]]);}}catch(_0x3faf01){utils[_0xa750('0x19')](util['format'](_0xa750('0x2e'),_0x108a1a[_0xa750('0x4')]),_0x3faf01);}};exports['blindtransfer']=function(_0x93e49f){try{if(!_[_0xa750('0x1b')](agents[_0x93e49f[_0xa750('0x33')]])){utils['debug'](util[_0xa750('0x2')](_0xa750('0x34'),_0x93e49f[_0xa750('0x4')]),_0x93e49f);utils[_0xa750('0x1')](util['format'](_0xa750('0x35'),_0x93e49f[_0xa750('0x4')],agents[_0x93e49f[_0xa750('0x33')]][_0xa750('0x7')],agents[_0x93e49f['transfereruniqueid']][_0xa750('0x4')]));agents[_0x93e49f[_0xa750('0x33')]]['transfer']=!![];agents[_0x93e49f[_0xa750('0x33')]]['transfertype']=_0xa750('0x36');agents[_0x93e49f[_0xa750('0x33')]]['transferexten']=_0x93e49f['extension'];agents[_0x93e49f['transfereruniqueid']][_0xa750('0x37')]=agents[_0x93e49f[_0xa750('0x33')]]['uniqueid'];}}catch(_0xe88dc){utils[_0xa750('0x19')](util[_0xa750('0x2')]('[%s][agents][blindtransfer]',_0x93e49f['uniqueid']),_0xe88dc);}};exports['attendedtransfer']=function(_0x5d8dd2){try{utils[_0xa750('0x15')](util['format'](_0xa750('0x38'),_0x5d8dd2[_0xa750('0x39')]),_0x5d8dd2);if(_0x5d8dd2['origtransfereruniqueid']==_0x5d8dd2[_0xa750('0x3a')]){if(!_['isNil'](agents[_0x5d8dd2[_0xa750('0x3b')]])){utils['info'](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x5d8dd2['origtransfereruniqueid'],agents[_0x5d8dd2[_0xa750('0x3b')]][_0xa750('0x7')]));agents[_0x5d8dd2['secondtransfereruniqueid']]['transfer']=!![];agents[_0x5d8dd2['secondtransfereruniqueid']][_0xa750('0x3c')]=_0xa750('0x3d');agents[_0x5d8dd2[_0xa750('0x3b')]][_0xa750('0x3e')]=_0x5d8dd2[_0xa750('0x3f')];agents[_0x5d8dd2[_0xa750('0x3b')]]['transferuniqueid']=_0x5d8dd2['origtransfereruniqueid'];}if(_0x5d8dd2[_0xa750('0x40')]&&agents[_0x5d8dd2[_0xa750('0x40')]]){agents[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x41')]=0x1;transfers[_0x5d8dd2[_0xa750('0x40')]]=_['clone'](agents[_0x5d8dd2[_0xa750('0x40')]]);transfers[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x9')]=agents[_0x5d8dd2[_0xa750('0x3b')]][_0xa750('0x9')];transfers[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x42')]=agents[_0x5d8dd2[_0xa750('0x3b')]]['calleridname'];transfers[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x43')]=utils[_0xa750('0x17')]();transfers[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x31')]=utils['now']();transfers[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x1f')]=0x0;transfers[_0x5d8dd2[_0xa750('0x40')]][_0xa750('0x41')]=0x2;}}else if(_0x5d8dd2[_0xa750('0x3b')]==_0x5d8dd2[_0xa750('0x44')]){if(!_[_0xa750('0x1b')](agents[_0x5d8dd2[_0xa750('0x39')]])){utils[_0xa750('0x1')](util[_0xa750('0x2')](_0xa750('0x45'),_0x5d8dd2[_0xa750('0x39')],agents[_0x5d8dd2[_0xa750('0x39')]][_0xa750('0x7')]));agents[_0x5d8dd2[_0xa750('0x39')]][_0xa750('0x46')]=!![];agents[_0x5d8dd2['origtransfereruniqueid']][_0xa750('0x3c')]='ATTENDED';agents[_0x5d8dd2[_0xa750('0x39')]][_0xa750('0x3e')]=_0x5d8dd2[_0xa750('0x47')];agents[_0x5d8dd2['origtransfereruniqueid']][_0xa750('0x37')]=_0x5d8dd2[_0xa750('0x3b')];}if(_0x5d8dd2[_0xa750('0x48')]&&agents[_0x5d8dd2[_0xa750('0x48')]]){agents[_0x5d8dd2[_0xa750('0x48')]][_0xa750('0x41')]=0x1;transfers[_0x5d8dd2['transfertargetuniqueid']]=_[_0xa750('0x49')](agents[_0x5d8dd2[_0xa750('0x48')]]);transfers[_0x5d8dd2['transfertargetuniqueid']][_0xa750('0x9')]=agents[_0x5d8dd2[_0xa750('0x39')]][_0xa750('0x9')];transfers[_0x5d8dd2[_0xa750('0x48')]][_0xa750('0x42')]=agents[_0x5d8dd2[_0xa750('0x39')]][_0xa750('0x42')];transfers[_0x5d8dd2[_0xa750('0x48')]][_0xa750('0x43')]=utils[_0xa750('0x17')]();transfers[_0x5d8dd2[_0xa750('0x48')]]['agentconnectAt']=utils['now']();transfers[_0x5d8dd2[_0xa750('0x48')]][_0xa750('0x1f')]=0x0;transfers[_0x5d8dd2[_0xa750('0x48')]][_0xa750('0x41')]=0x2;}}}catch(_0x5e17a0){utils[_0xa750('0x19')](util[_0xa750('0x2')](_0xa750('0x38'),_0x5d8dd2[_0xa750('0x39')]),_0x5e17a0);}};exports[_0xa750('0x4a')]=function(_0x473188){try{utils[_0xa750('0x15')](util[_0xa750('0x2')](_0xa750('0x4b'),_0x473188[_0xa750('0x4')]),_0x473188);if(agents[_0x473188[_0xa750('0x4')]]&&agents[_0x473188['uniqueid']]['reason']===_0xa750('0x1d')){if(_0x473188['cause']==='21'){agents[_0x473188['uniqueid']][_0xa750('0x1e')]=_0xa750('0x4c');agents[_0x473188[_0xa750('0x4')]][_0xa750('0xb')]=_0xa750('0x4c');}utils['info'](util[_0xa750('0x2')](_0xa750('0x4d'),_0x473188[_0xa750('0x4')],agents[_0x473188[_0xa750('0x4')]][_0xa750('0x7')],agents[_0x473188[_0xa750('0x4')]]['reason'],agents[_0x473188['uniqueid']][_0xa750('0xb')]));writeDB(agents[_0x473188[_0xa750('0x4')]]);var _0x30a371=unanswered[_0xa750('0x4e')](_0x473188[_0xa750('0x4')]);if(_0x30a371>-0x1){unanswered[_0xa750('0x4f')](_0x30a371,0x1);}}if(transfers[_0x473188[_0xa750('0x4')]]){transfers[_0x473188[_0xa750('0x4')]]['agentcomplete']=!![];transfers[_0x473188[_0xa750('0x4')]]['agentcompleteAt']=utils['now']();transfers[_0x473188[_0xa750('0x4')]][_0xa750('0x21')]=utils[_0xa750('0x50')](transfers[_0x473188[_0xa750('0x4')]]['agentcompleteAt'],transfers[_0x473188[_0xa750('0x4')]][_0xa750('0x31')]);transfers[_0x473188[_0xa750('0x4')]][_0xa750('0x1e')]='agent';transfers[_0x473188[_0xa750('0x4')]][_0xa750('0xb')]=_0xa750('0x32');utils[_0xa750('0x1')](util[_0xa750('0x2')](_0xa750('0x4d'),_0x473188[_0xa750('0x4')],transfers[_0x473188[_0xa750('0x4')]]['membername'],transfers[_0x473188['uniqueid']][_0xa750('0x1e')],transfers[_0x473188['uniqueid']][_0xa750('0xb')]));writeDB(transfers[_0x473188[_0xa750('0x4')]],!![]);}if(agents[_0x473188['uniqueid']]&&agents[_0x473188[_0xa750('0x4')]]['agentconnectAt']){agents[_0x473188[_0xa750('0x4')]][_0xa750('0xe')]=!![];agents[_0x473188[_0xa750('0x4')]]['agentcompleteAt']=utils[_0xa750('0x17')]();agents[_0x473188[_0xa750('0x4')]][_0xa750('0x21')]=utils[_0xa750('0x50')](agents[_0x473188['uniqueid']]['agentcompleteAt'],agents[_0x473188['uniqueid']][_0xa750('0x31')]);agents[_0x473188[_0xa750('0x4')]]['reason']=agents[_0x473188[_0xa750('0x4')]][_0xa750('0x46')]?_0xa750('0x46'):_0xa750('0x51');agents[_0x473188[_0xa750('0x4')]][_0xa750('0xb')]='complete';utils[_0xa750('0x1')](util[_0xa750('0x2')](_0xa750('0x4d'),_0x473188['uniqueid'],agents[_0x473188[_0xa750('0x4')]][_0xa750('0x7')],agents[_0x473188[_0xa750('0x4')]][_0xa750('0x1e')],agents[_0x473188['uniqueid']][_0xa750('0xb')]));writeDB(agents[_0x473188[_0xa750('0x4')]]);}}catch(_0x32b8e7){utils['error'](util[_0xa750('0x2')]('[%s][agents][hangup]',_0x473188[_0xa750('0x4')]),_0x32b8e7);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 9c61e49..829171a 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 _0x029e=['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','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','substring','lastIndexOf','includes','noop','set','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','interface','calleridnum','connectedlinenum','lastevent','accountcode','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','now','DOCUMENTATION','error','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','context','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','[%s][calls][newstate]','hangup','[%s][calls][hangup]','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','callerid','endtime','duration','diffTime','attendedtransfer','localtwolinkedid','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','transfertargetchannel','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','variable','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','lastdata'];(function(_0x3f6e26,_0x811a34){var _0x474345=function(_0x4a0cbe){while(--_0x4a0cbe){_0x3f6e26['push'](_0x3f6e26['shift']());}};_0x474345(++_0x811a34);}(_0x029e,0x1c3));var _0xe029=function(_0xce09ef,_0x45a02f){_0xce09ef=_0xce09ef-0x0;var _0x53d14d=_0x029e[_0xce09ef];return _0x53d14d;};'use strict';var _=require(_0xe029('0x0'));var util=require(_0xe029('0x1'));var utils=require(_0xe029('0x2'));var dispositions=[_0xe029('0x3'),'FAILED',_0xe029('0x4'),_0xe029('0x3'),_0xe029('0x3'),_0xe029('0x3'),_0xe029('0x5'),_0xe029('0x6'),'FAILED',_0xe029('0x4'),_0xe029('0x4')];var channels={};function writeDB(_0x171934){utils[_0xe029('0x7')](util[_0xe029('0x8')](_0xe029('0x9'),_0x171934[_0xe029('0xa')],_0x171934[_0xe029('0xb')],_0x171934[_0xe029('0xc')],_0x171934['membername'],_0x171934[_0xe029('0xd')],_0x171934[_0xe029('0xe')],_0x171934[_0xe029('0xf')],_0x171934[_0xe029('0x10')]));if(_0x171934[_0xe029('0x11')]){utils['getUserByInternal'](_0x171934[_0xe029('0x11')])['then'](function(_0x11dea6){if(_0x11dea6){_0x171934[_0xe029('0x12')]=_0x11dea6['id'];}utils[_0xe029('0x13')](_0xe029('0x14'),_0x171934);});}else{utils['request'](_0xe029('0x14'),_0x171934);}if(channels[_0x171934['uniqueid']]){delete channels[_0x171934['uniqueid']];}}exports[_0xe029('0x15')]=function(_0x8a5aae){try{utils[_0xe029('0x16')](util[_0xe029('0x8')](_0xe029('0x17'),_0x8a5aae['uniqueid']),_0x8a5aae);if(_0x8a5aae['uniqueid']==_0x8a5aae[_0xe029('0x18')]&&_0x8a5aae[_0xe029('0xb')]!='OutgoingSpoolFailed'){utils['info'](util[_0xe029('0x8')](_0xe029('0x19'),_0x8a5aae[_0xe029('0xa')],_0x8a5aae['context'],_0x8a5aae[_0xe029('0x1a')]));channels[_0x8a5aae['uniqueid']]={'uniqueid':_0x8a5aae[_0xe029('0xa')],'accountcode':_0x8a5aae[_0xe029('0x11')],'source':_0x8a5aae[_0xe029('0xe')],'destination':_0x8a5aae[_0xe029('0x1a')],'destinationcontext':_0x8a5aae['context'],'channel':_0x8a5aae[_0xe029('0xb')],'starttime':utils[_0xe029('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xe029('0x3'),'amaflags':_0xe029('0x1c')};}}catch(_0xbf5612){utils[_0xe029('0x1d')](util[_0xe029('0x8')](_0xe029('0x17'),_0x8a5aae['uniqueid']),_0xbf5612);}};exports[_0xe029('0x1e')]=function(_0x572815){try{utils[_0xe029('0x16')](util[_0xe029('0x8')]('[%s][calls][newstate]',_0x572815[_0xe029('0xa')]),_0x572815);if(!_[_0xe029('0x1f')](channels[_0x572815[_0xe029('0xa')]])&&_0x572815[_0xe029('0x20')]==0x6){utils['info'](util[_0xe029('0x8')](_0xe029('0x21'),_0x572815[_0xe029('0xa')],_0x572815[_0xe029('0x22')],_0x572815['channel']));if(_['isNil'](channels[_0x572815['uniqueid']][_0xe029('0x23')])){channels[_0x572815[_0xe029('0xa')]][_0xe029('0x23')]=utils[_0xe029('0x1b')]();}}else if(!_[_0xe029('0x1f')](channels[_0x572815[_0xe029('0x18')]])&&_0x572815[_0xe029('0x20')]==0x6&&_0x572815['context']!=_0xe029('0x24')){utils[_0xe029('0x7')](util[_0xe029('0x8')](_0xe029('0x25'),_0x572815[_0xe029('0xa')],_0x572815[_0xe029('0x18')],_0x572815['context'],_0x572815[_0xe029('0xb')]));channels[_0x572815[_0xe029('0x18')]][_0xe029('0x11')]=_0x572815['accountcode'];channels[_0x572815['linkedid']][_0xe029('0x26')]=_0x572815['channel'];if(_[_0xe029('0x1f')](channels[_0x572815[_0xe029('0x18')]][_0xe029('0x27')])){channels[_0x572815['linkedid']][_0xe029('0x27')]=utils[_0xe029('0x1b')]();}channels[_0x572815[_0xe029('0x18')]][_0xe029('0x28')]=dispositions[_[_0xe029('0x29')](_0x572815['channelstate'])]||_0xe029('0x5');}}catch(_0x213f5b){utils[_0xe029('0x1d')](util[_0xe029('0x8')](_0xe029('0x2a'),_0x572815['uniqueid']),_0x213f5b);}};exports[_0xe029('0x2b')]=function(_0x304a84){try{if(!_['isNil'](channels[_0x304a84[_0xe029('0xa')]])){utils['debug'](util[_0xe029('0x8')](_0xe029('0x2c'),_0x304a84[_0xe029('0xa')]),_0x304a84);if(_[_0xe029('0x1f')](channels[_0x304a84[_0xe029('0xa')]]['callerid'])){channels[_0x304a84[_0xe029('0xa')]]['callerid']=_0x304a84[_0xe029('0x2d')]+'\x20<'+_0x304a84[_0xe029('0xe')]+'>';}utils[_0xe029('0x7')](util['format'](_0xe029('0x2e'),_0x304a84[_0xe029('0xa')],channels[_0x304a84['uniqueid']][_0xe029('0x2f')],_0x304a84['cause-txt']));channels[_0x304a84[_0xe029('0xa')]][_0xe029('0x30')]=utils[_0xe029('0x1b')]();channels[_0x304a84[_0xe029('0xa')]][_0xe029('0x31')]=utils[_0xe029('0x32')](channels[_0x304a84[_0xe029('0xa')]]['endtime'],channels[_0x304a84[_0xe029('0xa')]]['starttime']);channels[_0x304a84[_0xe029('0xa')]]['billableseconds']=channels[_0x304a84[_0xe029('0xa')]][_0xe029('0x27')]?utils[_0xe029('0x32')](channels[_0x304a84[_0xe029('0xa')]][_0xe029('0x30')],channels[_0x304a84[_0xe029('0xa')]][_0xe029('0x27')]):0x0;writeDB(channels[_0x304a84['uniqueid']]);}}catch(_0x219a87){utils[_0xe029('0x1d')](util[_0xe029('0x8')](_0xe029('0x2c'),_0x304a84[_0xe029('0xa')]),_0x219a87);}};exports[_0xe029('0x33')]=function(_0x9a7ccb){try{if(!_[_0xe029('0x1f')](channels[_0x9a7ccb[_0xe029('0x34')]])){utils['debug'](util[_0xe029('0x8')]('[%s][calls][attendedtransfer]',_0x9a7ccb[_0xe029('0x35')]),_0x9a7ccb);if(channels[_0x9a7ccb['localtwolinkedid']][_0xe029('0xb')]==_0x9a7ccb['transfereechannel']){utils[_0xe029('0x7')](util[_0xe029('0x8')](_0xe029('0x36'),_0x9a7ccb[_0xe029('0x35')],_0x9a7ccb[_0xe029('0x34')],_0x9a7ccb[_0xe029('0x37')]));channels[_0x9a7ccb[_0xe029('0x34')]][_0xe029('0x26')]=_0x9a7ccb[_0xe029('0x37')];channels[_0x9a7ccb[_0xe029('0x34')]][_0xe029('0x38')]='_attended';}else if(channels[_0x9a7ccb[_0xe029('0x34')]][_0xe029('0xb')]=_0x9a7ccb[_0xe029('0x39')]){utils[_0xe029('0x7')](util['format'](_0xe029('0x36'),_0x9a7ccb['origtransfereruniqueid'],_0x9a7ccb['localtwolinkedid'],_0x9a7ccb[_0xe029('0x3a')]));channels[_0x9a7ccb[_0xe029('0x34')]]['destinationchannel']=_0x9a7ccb[_0xe029('0x3a')];channels[_0x9a7ccb[_0xe029('0x34')]]['userfield']=_0xe029('0x3b');}}}catch(_0x4676fd){utils[_0xe029('0x1d')](util[_0xe029('0x8')]('[%s][calls][attendedtransfer]',_0x9a7ccb[_0xe029('0x35')]),_0x4676fd);}};exports[_0xe029('0x3c')]=function(_0x41b661){try{if(!_['isNil'](channels[_0x41b661[_0xe029('0xa')]])){utils[_0xe029('0x16')](util[_0xe029('0x8')](_0xe029('0x3d'),_0x41b661[_0xe029('0xa')]),_0x41b661);channels[_0x41b661[_0xe029('0xa')]][_0xe029('0x3e')]=utils[_0xe029('0x1b')]();utils['info'](util[_0xe029('0x8')](_0xe029('0x3f'),_0x41b661[_0xe029('0xa')],channels[_0x41b661[_0xe029('0xa')]][_0xe029('0x3e')]));}}catch(_0x2d9d63){utils[_0xe029('0x1d')](util[_0xe029('0x8')](_0xe029('0x3d'),_0x41b661[_0xe029('0xa')]),_0x2d9d63);}};exports[_0xe029('0x40')]=function(_0x1457d4){try{if(!_[_0xe029('0x1f')](channels[_0x1457d4['uniqueid']])){utils[_0xe029('0x16')](util['format']('[%s][calls][musiconholdstop]',_0x1457d4[_0xe029('0xa')]),_0x1457d4);if(!_[_0xe029('0x1f')](channels[_0x1457d4['uniqueid']][_0xe029('0x3e')])){channels[_0x1457d4['uniqueid']][_0xe029('0x41')]+=utils['diffTime'](utils[_0xe029('0x1b')](),channels[_0x1457d4[_0xe029('0xa')]][_0xe029('0x3e')]);utils[_0xe029('0x7')](util[_0xe029('0x8')](_0xe029('0x42'),_0x1457d4[_0xe029('0xa')],channels[_0x1457d4[_0xe029('0xa')]][_0xe029('0x41')]));delete channels[_0x1457d4[_0xe029('0xa')]]['musiconholdstartAt'];}}}catch(_0x26b0d3){utils[_0xe029('0x1d')](util['format'](_0xe029('0x43'),_0x1457d4['uniqueid']),_0x26b0d3);}};exports[_0xe029('0x44')]=function(_0x232113){try{if(!_['isNil'](channels[_0x232113[_0xe029('0xa')]])){utils[_0xe029('0x16')](util[_0xe029('0x8')](_0xe029('0x45'),_0x232113[_0xe029('0xa')]),_0x232113);if(!_[_0xe029('0x1f')](_0x232113['variable']['xmd-originatecalleridnum'])){utils[_0xe029('0x7')](util[_0xe029('0x8')](_0xe029('0x46'),_0x232113[_0xe029('0xa')],_0x232113[_0xe029('0x47')]));channels[_0x232113[_0xe029('0xa')]][_0xe029('0x48')]=_0x232113[_0xe029('0x47')];}if(!_['isNil'](_0x232113['variable'][_0xe029('0x49')])){utils[_0xe029('0x7')](util[_0xe029('0x8')](_0xe029('0x4a'),_0x232113[_0xe029('0xa')],_0x232113[_0xe029('0x47')]));channels[_0x232113[_0xe029('0xa')]][_0xe029('0x4b')]=_0x232113[_0xe029('0x47')];channels[_0x232113[_0xe029('0xa')]][_0xe029('0x2f')]='\x22'+_0x232113[_0xe029('0x47')]+'\x22\x20<'+_0x232113[_0xe029('0x47')]+'>';}if(!_['isNil'](_0x232113[_0xe029('0x4c')]['xmd-callerid-preview'])||!_['isNil'](_0x232113[_0xe029('0x4c')][_0xe029('0x4d')])){utils[_0xe029('0x7')](util[_0xe029('0x8')](_0xe029('0x4e'),_0x232113[_0xe029('0xa')],!_[_0xe029('0x1f')](_0x232113[_0xe029('0x4c')]['xmd-callerid-preview'])?_0xe029('0x4f'):_0xe029('0x4d'),_0x232113[_0xe029('0x47')]));channels[_0x232113[_0xe029('0xa')]]['callerid']=_0x232113[_0xe029('0x47')];}if(!_[_0xe029('0x1f')](_0x232113[_0xe029('0x4c')][_0xe029('0x50')])||!_['isNil'](_0x232113[_0xe029('0x4c')]['xmcs-queue'])){utils['info'](util[_0xe029('0x8')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x232113[_0xe029('0xa')],!_['isNil'](_0x232113['variable'][_0xe029('0x50')])?_0xe029('0x50'):_0xe029('0x51'),_0x232113[_0xe029('0x47')]));channels[_0x232113[_0xe029('0xa')]][_0xe029('0x52')]='Queue';channels[_0x232113[_0xe029('0xa')]][_0xe029('0x53')]=_0x232113[_0xe029('0x47')];channels[_0x232113[_0xe029('0xa')]][_0xe029('0xc')]=!![];}if(!_['isNil'](_0x232113['variable'][_0xe029('0x54')])){utils['info'](util[_0xe029('0x8')](_0xe029('0x55'),_0x232113[_0xe029('0xa')],_0x232113['value']));channels[_0x232113[_0xe029('0xa')]][_0xe029('0x56')]=_0x232113[_0xe029('0x47')];}if(!_[_0xe029('0x1f')](_0x232113[_0xe029('0x4c')][_0xe029('0x57')])){utils[_0xe029('0x7')](util['format'](_0xe029('0x58'),_0x232113['uniqueid'],_0x232113[_0xe029('0x47')]));channels[_0x232113['uniqueid']][_0xe029('0x59')]=_0x232113[_0xe029('0x47')];}if(!_['isNil'](_0x232113[_0xe029('0x4c')][_0xe029('0x5a')])){utils['info'](util['format'](_0xe029('0x5b'),_0x232113[_0xe029('0xa')],_0x232113[_0xe029('0x47')]));channels[_0x232113['uniqueid']][_0xe029('0x5c')]=_0x232113[_0xe029('0x47')];}if(!_[_0xe029('0x1f')](_0x232113[_0xe029('0x4c')]['sipcallid'])){utils['info'](util['format'](_0xe029('0x5d'),_0x232113[_0xe029('0xa')],_0x232113[_0xe029('0x47')]));channels[_0x232113[_0xe029('0xa')]]['sipcallid']=_0x232113['value'];}}}catch(_0xb75c82){utils[_0xe029('0x1d')](util[_0xe029('0x8')]('[%s][calls][varset]',_0x232113[_0xe029('0xa')]),_0xb75c82);}};exports[_0xe029('0x5e')]=function(_0x27a17e){try{if(!_[_0xe029('0x1f')](channels[_0x27a17e[_0xe029('0xa')]])){utils[_0xe029('0x16')](util[_0xe029('0x8')](_0xe029('0x5f'),_0x27a17e[_0xe029('0xa')]),_0x27a17e);utils['info'](util[_0xe029('0x8')](_0xe029('0x60'),_0x27a17e[_0xe029('0xa')],_0x27a17e[_0xe029('0x61')],_0x27a17e[_0xe029('0x62')]));if(_0x27a17e[_0xe029('0x61')][_0xe029('0x63')]()=='set'&&_[_0xe029('0x64')](_0x27a17e[_0xe029('0x62')][_0xe029('0x63')](),_0xe029('0x65'))){var _0x1c4ce2=_0x27a17e[_0xe029('0x62')]['split']('=');var _0x15bf3d=_0x1c4ce2[0x0][_0xe029('0x66')](_0x1c4ce2[0x0][_0xe029('0x67')]('(')+0x1,_0x1c4ce2[0x0][_0xe029('0x67')](')'));var _0x37ecb1=_0x1c4ce2[0x1];channels[_0x27a17e[_0xe029('0xa')]][_0x15bf3d]=_0x37ecb1;}if(!_[_0xe029('0x68')]([_0xe029('0x2b'),_0xe029('0x69'),'execif',_0xe029('0x6a'),'gotoif'],_0x27a17e[_0xe029('0x61')][_0xe029('0x63')]())){channels[_0x27a17e[_0xe029('0xa')]][_0xe029('0x52')]=_0x27a17e[_0xe029('0x61')];channels[_0x27a17e['uniqueid']][_0xe029('0x53')]=_0x27a17e[_0xe029('0x62')];}}}catch(_0x4217f9){utils[_0xe029('0x1d')](util[_0xe029('0x8')]('[%s][calls][newexten]',_0x27a17e['uniqueid']),_0x4217f9);}}; \ No newline at end of file +var _0xb049=['[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lastapplication','lodash','util','./utils','NO\x20ANSWER','FAILED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','DOCUMENTATION','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','toNumber','ANSWERED','error','hangup','[%s][calls][hangup]','callerid','calleridnum','cause-txt','endtime','duration','diffTime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfereruniqueid','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','musiconholdstartAt','mohtime','varset','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','variable'];(function(_0x236a36,_0x374403){var _0x1125fe=function(_0x2fd65a){while(--_0x2fd65a){_0x236a36['push'](_0x236a36['shift']());}};_0x1125fe(++_0x374403);}(_0xb049,0xf0));var _0x9b04=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb049[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x9b04('0x0'));var util=require(_0x9b04('0x1'));var utils=require(_0x9b04('0x2'));var dispositions=[_0x9b04('0x3'),'FAILED',_0x9b04('0x4'),_0x9b04('0x3'),'NO\x20ANSWER',_0x9b04('0x3'),'ANSWERED','BUSY',_0x9b04('0x4'),'FAILED',_0x9b04('0x4')];var channels={};function writeDB(_0xc6900b){utils[_0x9b04('0x5')](util[_0x9b04('0x6')](_0x9b04('0x7'),_0xc6900b[_0x9b04('0x8')],_0xc6900b['channel'],_0xc6900b[_0x9b04('0x9')],_0xc6900b[_0x9b04('0xa')],_0xc6900b[_0x9b04('0xb')],_0xc6900b['calleridnum'],_0xc6900b[_0x9b04('0xc')],_0xc6900b[_0x9b04('0xd')]));if(_0xc6900b[_0x9b04('0xe')]){utils[_0x9b04('0xf')](_0xc6900b[_0x9b04('0xe')])[_0x9b04('0x10')](function(_0x2953f4){if(_0x2953f4){_0xc6900b[_0x9b04('0x11')]=_0x2953f4['id'];}utils[_0x9b04('0x12')](_0x9b04('0x13'),_0xc6900b);});}else{utils['request'](_0x9b04('0x13'),_0xc6900b);}if(channels[_0xc6900b['uniqueid']]){delete channels[_0xc6900b[_0x9b04('0x8')]];}}exports['newchannel']=function(_0x5c5557){try{utils[_0x9b04('0x14')](util[_0x9b04('0x6')](_0x9b04('0x15'),_0x5c5557[_0x9b04('0x8')]),_0x5c5557);if(_0x5c5557['uniqueid']==_0x5c5557[_0x9b04('0x16')]&&_0x5c5557['channel']!='OutgoingSpoolFailed'){utils[_0x9b04('0x5')](util[_0x9b04('0x6')](_0x9b04('0x17'),_0x5c5557[_0x9b04('0x8')],_0x5c5557['context'],_0x5c5557['exten']));channels[_0x5c5557[_0x9b04('0x8')]]={'uniqueid':_0x5c5557[_0x9b04('0x8')],'accountcode':_0x5c5557[_0x9b04('0xe')],'source':_0x5c5557['calleridnum'],'destination':_0x5c5557[_0x9b04('0x18')],'destinationcontext':_0x5c5557[_0x9b04('0x19')],'channel':_0x5c5557[_0x9b04('0x1a')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9b04('0x3'),'amaflags':_0x9b04('0x1b')};}}catch(_0x302f85){utils['error'](util['format'](_0x9b04('0x15'),_0x5c5557[_0x9b04('0x8')]),_0x302f85);}};exports['newstate']=function(_0x42d3ba){try{utils['debug'](util[_0x9b04('0x6')]('[%s][calls][newstate]',_0x42d3ba[_0x9b04('0x8')]),_0x42d3ba);if(!_['isNil'](channels[_0x42d3ba[_0x9b04('0x8')]])&&_0x42d3ba[_0x9b04('0x1c')]==0x6){utils[_0x9b04('0x5')](util['format'](_0x9b04('0x1d'),_0x42d3ba[_0x9b04('0x8')],_0x42d3ba['context'],_0x42d3ba[_0x9b04('0x1a')]));if(_[_0x9b04('0x1e')](channels[_0x42d3ba[_0x9b04('0x8')]]['systemanswertime'])){channels[_0x42d3ba[_0x9b04('0x8')]][_0x9b04('0x1f')]=utils[_0x9b04('0x20')]();}}else if(!_[_0x9b04('0x1e')](channels[_0x42d3ba[_0x9b04('0x16')]])&&_0x42d3ba['channelstate']==0x6&&_0x42d3ba[_0x9b04('0x19')]!=_0x9b04('0x21')){utils[_0x9b04('0x5')](util[_0x9b04('0x6')](_0x9b04('0x22'),_0x42d3ba[_0x9b04('0x8')],_0x42d3ba['linkedid'],_0x42d3ba[_0x9b04('0x19')],_0x42d3ba['channel']));channels[_0x42d3ba['linkedid']][_0x9b04('0xe')]=_0x42d3ba[_0x9b04('0xe')];channels[_0x42d3ba[_0x9b04('0x16')]]['destinationchannel']=_0x42d3ba[_0x9b04('0x1a')];if(_[_0x9b04('0x1e')](channels[_0x42d3ba['linkedid']][_0x9b04('0x23')])){channels[_0x42d3ba[_0x9b04('0x16')]][_0x9b04('0x23')]=utils[_0x9b04('0x20')]();}channels[_0x42d3ba[_0x9b04('0x16')]]['disposition']=dispositions[_[_0x9b04('0x24')](_0x42d3ba[_0x9b04('0x1c')])]||_0x9b04('0x25');}}catch(_0x37de70){utils[_0x9b04('0x26')](util['format']('[%s][calls][newstate]',_0x42d3ba[_0x9b04('0x8')]),_0x37de70);}};exports[_0x9b04('0x27')]=function(_0x106c93){try{if(!_[_0x9b04('0x1e')](channels[_0x106c93[_0x9b04('0x8')]])){utils[_0x9b04('0x14')](util['format'](_0x9b04('0x28'),_0x106c93[_0x9b04('0x8')]),_0x106c93);if(_[_0x9b04('0x1e')](channels[_0x106c93[_0x9b04('0x8')]][_0x9b04('0x29')])){channels[_0x106c93[_0x9b04('0x8')]]['callerid']=_0x106c93['calleridname']+'\x20<'+_0x106c93[_0x9b04('0x2a')]+'>';}utils[_0x9b04('0x5')](util[_0x9b04('0x6')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x106c93[_0x9b04('0x8')],channels[_0x106c93[_0x9b04('0x8')]][_0x9b04('0x29')],_0x106c93[_0x9b04('0x2b')]));channels[_0x106c93[_0x9b04('0x8')]][_0x9b04('0x2c')]=utils['now']();channels[_0x106c93[_0x9b04('0x8')]][_0x9b04('0x2d')]=utils[_0x9b04('0x2e')](channels[_0x106c93[_0x9b04('0x8')]]['endtime'],channels[_0x106c93['uniqueid']]['starttime']);channels[_0x106c93[_0x9b04('0x8')]][_0x9b04('0x2f')]=channels[_0x106c93[_0x9b04('0x8')]][_0x9b04('0x23')]?utils[_0x9b04('0x2e')](channels[_0x106c93[_0x9b04('0x8')]][_0x9b04('0x2c')],channels[_0x106c93[_0x9b04('0x8')]][_0x9b04('0x23')]):0x0;writeDB(channels[_0x106c93[_0x9b04('0x8')]]);}}catch(_0x553cb6){utils[_0x9b04('0x26')](util[_0x9b04('0x6')](_0x9b04('0x28'),_0x106c93[_0x9b04('0x8')]),_0x553cb6);}};exports['attendedtransfer']=function(_0x534743){try{if(!_[_0x9b04('0x1e')](channels[_0x534743[_0x9b04('0x30')]])){utils['debug'](util['format'](_0x9b04('0x31'),_0x534743['origtransfereruniqueid']),_0x534743);if(channels[_0x534743[_0x9b04('0x30')]][_0x9b04('0x1a')]==_0x534743['transfereechannel']){utils['info'](util[_0x9b04('0x6')](_0x9b04('0x32'),_0x534743['origtransfereruniqueid'],_0x534743[_0x9b04('0x30')],_0x534743[_0x9b04('0x33')]));channels[_0x534743[_0x9b04('0x30')]][_0x9b04('0x34')]=_0x534743['secondtransfererchannel'];channels[_0x534743[_0x9b04('0x30')]][_0x9b04('0x35')]=_0x9b04('0x36');}else if(channels[_0x534743[_0x9b04('0x30')]][_0x9b04('0x1a')]=_0x534743[_0x9b04('0x37')]){utils[_0x9b04('0x5')](util[_0x9b04('0x6')](_0x9b04('0x32'),_0x534743[_0x9b04('0x38')],_0x534743[_0x9b04('0x30')],_0x534743[_0x9b04('0x39')]));channels[_0x534743['localtwolinkedid']][_0x9b04('0x34')]=_0x534743[_0x9b04('0x39')];channels[_0x534743[_0x9b04('0x30')]]['userfield']='_attended';}}}catch(_0xf9cced){utils[_0x9b04('0x26')](util[_0x9b04('0x6')](_0x9b04('0x31'),_0x534743['origtransfereruniqueid']),_0xf9cced);}};exports['musiconholdstart']=function(_0x1cd7f4){try{if(!_[_0x9b04('0x1e')](channels[_0x1cd7f4[_0x9b04('0x8')]])){utils['debug'](util[_0x9b04('0x6')](_0x9b04('0x3a'),_0x1cd7f4['uniqueid']),_0x1cd7f4);channels[_0x1cd7f4[_0x9b04('0x8')]]['musiconholdstartAt']=utils['now']();utils[_0x9b04('0x5')](util[_0x9b04('0x6')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x1cd7f4['uniqueid'],channels[_0x1cd7f4[_0x9b04('0x8')]]['musiconholdstartAt']));}}catch(_0x599078){utils['error'](util[_0x9b04('0x6')]('[%s][calls][musiconholdstart]',_0x1cd7f4[_0x9b04('0x8')]),_0x599078);}};exports[_0x9b04('0x3b')]=function(_0x2c9e23){try{if(!_[_0x9b04('0x1e')](channels[_0x2c9e23[_0x9b04('0x8')]])){utils[_0x9b04('0x14')](util[_0x9b04('0x6')](_0x9b04('0x3c'),_0x2c9e23[_0x9b04('0x8')]),_0x2c9e23);if(!_['isNil'](channels[_0x2c9e23[_0x9b04('0x8')]][_0x9b04('0x3d')])){channels[_0x2c9e23[_0x9b04('0x8')]][_0x9b04('0x3e')]+=utils[_0x9b04('0x2e')](utils['now'](),channels[_0x2c9e23[_0x9b04('0x8')]][_0x9b04('0x3d')]);utils[_0x9b04('0x5')](util[_0x9b04('0x6')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x2c9e23[_0x9b04('0x8')],channels[_0x2c9e23[_0x9b04('0x8')]][_0x9b04('0x3e')]));delete channels[_0x2c9e23[_0x9b04('0x8')]][_0x9b04('0x3d')];}}}catch(_0x60bd35){utils[_0x9b04('0x26')](util['format'](_0x9b04('0x3c'),_0x2c9e23[_0x9b04('0x8')]),_0x60bd35);}};exports[_0x9b04('0x3f')]=function(_0x43f9d8){try{if(!_[_0x9b04('0x1e')](channels[_0x43f9d8['uniqueid']])){utils[_0x9b04('0x14')](util['format']('[%s][calls][varset]',_0x43f9d8[_0x9b04('0x8')]),_0x43f9d8);if(!_[_0x9b04('0x1e')](_0x43f9d8['variable'][_0x9b04('0x40')])){utils[_0x9b04('0x5')](util[_0x9b04('0x6')](_0x9b04('0x41'),_0x43f9d8[_0x9b04('0x8')],_0x43f9d8['value']));channels[_0x43f9d8['uniqueid']][_0x9b04('0x42')]=_0x43f9d8[_0x9b04('0x43')];}if(!_['isNil'](_0x43f9d8[_0x9b04('0x44')]['xmd-phone'])){utils['info'](util[_0x9b04('0x6')](_0x9b04('0x45'),_0x43f9d8['uniqueid'],_0x43f9d8[_0x9b04('0x43')]));channels[_0x43f9d8[_0x9b04('0x8')]][_0x9b04('0x46')]=_0x43f9d8['value'];channels[_0x43f9d8['uniqueid']][_0x9b04('0x29')]='\x22'+_0x43f9d8['value']+'\x22\x20<'+_0x43f9d8[_0x9b04('0x43')]+'>';}if(!_[_0x9b04('0x1e')](_0x43f9d8[_0x9b04('0x44')]['xmd-callerid-preview'])||!_[_0x9b04('0x1e')](_0x43f9d8['variable'][_0x9b04('0x47')])){utils[_0x9b04('0x5')](util['format'](_0x9b04('0x48'),_0x43f9d8[_0x9b04('0x8')],!_[_0x9b04('0x1e')](_0x43f9d8[_0x9b04('0x44')]['xmd-callerid-preview'])?_0x9b04('0x49'):_0x9b04('0x47'),_0x43f9d8[_0x9b04('0x43')]));channels[_0x43f9d8['uniqueid']][_0x9b04('0x29')]=_0x43f9d8[_0x9b04('0x43')];}if(!_[_0x9b04('0x1e')](_0x43f9d8[_0x9b04('0x44')][_0x9b04('0x4a')])||!_[_0x9b04('0x1e')](_0x43f9d8[_0x9b04('0x44')]['xmcs-queue'])){utils[_0x9b04('0x5')](util['format'](_0x9b04('0x48'),_0x43f9d8[_0x9b04('0x8')],!_[_0x9b04('0x1e')](_0x43f9d8[_0x9b04('0x44')][_0x9b04('0x4a')])?'xmd-queue':_0x9b04('0x4b'),_0x43f9d8[_0x9b04('0x43')]));channels[_0x43f9d8[_0x9b04('0x8')]]['lastapplication']=_0x9b04('0x4c');channels[_0x43f9d8['uniqueid']][_0x9b04('0x4d')]=_0x43f9d8[_0x9b04('0x43')];channels[_0x43f9d8[_0x9b04('0x8')]]['queue']=!![];}if(!_[_0x9b04('0x1e')](_0x43f9d8[_0x9b04('0x44')][_0x9b04('0x4e')])){utils[_0x9b04('0x5')](util['format'](_0x9b04('0x4f'),_0x43f9d8[_0x9b04('0x8')],_0x43f9d8[_0x9b04('0x43')]));channels[_0x43f9d8[_0x9b04('0x8')]][_0x9b04('0x50')]=_0x43f9d8['value'];}if(!_[_0x9b04('0x1e')](_0x43f9d8[_0x9b04('0x44')][_0x9b04('0x51')])){utils[_0x9b04('0x5')](util[_0x9b04('0x6')](_0x9b04('0x52'),_0x43f9d8[_0x9b04('0x8')],_0x43f9d8[_0x9b04('0x43')]));channels[_0x43f9d8['uniqueid']][_0x9b04('0x53')]=_0x43f9d8[_0x9b04('0x43')];}if(!_[_0x9b04('0x1e')](_0x43f9d8[_0x9b04('0x44')]['outboundrouteid'])){utils[_0x9b04('0x5')](util[_0x9b04('0x6')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x43f9d8[_0x9b04('0x8')],_0x43f9d8['value']));channels[_0x43f9d8['uniqueid']][_0x9b04('0x54')]=_0x43f9d8[_0x9b04('0x43')];}if(!_[_0x9b04('0x1e')](_0x43f9d8['variable'][_0x9b04('0x55')])){utils[_0x9b04('0x5')](util['format'](_0x9b04('0x56'),_0x43f9d8[_0x9b04('0x8')],_0x43f9d8[_0x9b04('0x43')]));channels[_0x43f9d8[_0x9b04('0x8')]][_0x9b04('0x55')]=_0x43f9d8[_0x9b04('0x43')];}}}catch(_0x91902){utils[_0x9b04('0x26')](util[_0x9b04('0x6')]('[%s][calls][varset]',_0x43f9d8['uniqueid']),_0x91902);}};exports[_0x9b04('0x57')]=function(_0x1aa144){try{if(!_['isNil'](channels[_0x1aa144[_0x9b04('0x8')]])){utils['debug'](util['format'](_0x9b04('0x58'),_0x1aa144[_0x9b04('0x8')]),_0x1aa144);utils['info'](util[_0x9b04('0x6')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x1aa144['uniqueid'],_0x1aa144[_0x9b04('0x59')],_0x1aa144[_0x9b04('0x5a')]));if(_0x1aa144[_0x9b04('0x59')][_0x9b04('0x5b')]()==_0x9b04('0x5c')&&_[_0x9b04('0x5d')](_0x1aa144[_0x9b04('0x5a')][_0x9b04('0x5b')](),_0x9b04('0x5e'))){var _0x14d9dd=_0x1aa144[_0x9b04('0x5a')][_0x9b04('0x5f')]('=');var _0x22fb28=_0x14d9dd[0x0][_0x9b04('0x60')](_0x14d9dd[0x0][_0x9b04('0x61')]('(')+0x1,_0x14d9dd[0x0][_0x9b04('0x61')](')'));var _0x3cc776=_0x14d9dd[0x1];channels[_0x1aa144['uniqueid']][_0x22fb28]=_0x3cc776;}if(!_[_0x9b04('0x62')]([_0x9b04('0x27'),_0x9b04('0x63'),_0x9b04('0x64'),_0x9b04('0x5c'),_0x9b04('0x65')],_0x1aa144[_0x9b04('0x59')][_0x9b04('0x5b')]())){channels[_0x1aa144[_0x9b04('0x8')]][_0x9b04('0x66')]=_0x1aa144[_0x9b04('0x59')];channels[_0x1aa144['uniqueid']][_0x9b04('0x4d')]=_0x1aa144[_0x9b04('0x5a')];}}}catch(_0x4acc66){utils[_0x9b04('0x26')](util[_0x9b04('0x6')](_0x9b04('0x58'),_0x1aa144[_0x9b04('0x8')]),_0x4acc66);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 135be3c..ed72fd4 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 _0x6e1d=['error','[core]\x20error','close','[core]\x20close','managerevent','connect','info','[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted'];(function(_0x3395e8,_0x32e2a9){var _0x3bf8c2=function(_0x1223d0){while(--_0x1223d0){_0x3395e8['push'](_0x3395e8['shift']());}};_0x3bf8c2(++_0x32e2a9);}(_0x6e1d,0x191));var _0xd6e1=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0x6e1d[_0x5cb97e];return _0x1714b4;};'use strict';var utils=require('./utils');exports[_0xd6e1('0x0')]=function(){utils[_0xd6e1('0x1')](_0xd6e1('0x2'));};exports['shutdown']=function(){utils[_0xd6e1('0x1')](_0xd6e1('0x3'));};exports[_0xd6e1('0x4')]=function(){utils[_0xd6e1('0x1')](_0xd6e1('0x5'));};exports['error']=function(_0x5b2682){utils[_0xd6e1('0x6')](_0xd6e1('0x7'),_0x5b2682);};exports[_0xd6e1('0x8')]=function(){utils[_0xd6e1('0x1')](_0xd6e1('0x9'));};exports[_0xd6e1('0xa')]=function(_0x3ab894){}; \ No newline at end of file +var _0x133b=['[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x133b,0x101));var _0xb133=function(_0x3748ab,_0x13059e){_0x3748ab=_0x3748ab-0x0;var _0x3aca73=_0x133b[_0x3748ab];return _0x3aca73;};'use strict';var utils=require(_0xb133('0x0'));exports[_0xb133('0x1')]=function(){utils[_0xb133('0x2')]('[core]\x20connected');};exports['shutdown']=function(){utils[_0xb133('0x2')](_0xb133('0x3'));};exports[_0xb133('0x4')]=function(){utils['info'](_0xb133('0x5'));};exports[_0xb133('0x6')]=function(_0x3d1afe){utils['error'](_0xb133('0x7'),_0x3d1afe);};exports[_0xb133('0x8')]=function(){utils[_0xb133('0x2')](_0xb133('0x9'));};exports[_0xb133('0xa')]=function(_0x5380f6){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 895d70e..b68c153 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 _0x5fc7=['starttime','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','ANSWER','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','duration','endtime','holdtime','diffTime','lodash','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]','format','appdata','application','toLowerCase','set','error','varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','assign'];(function(_0xd0baae,_0x3020f4){var _0x538549=function(_0x57a0e3){while(--_0x57a0e3){_0xd0baae['push'](_0xd0baae['shift']());}};_0x538549(++_0x3020f4);}(_0x5fc7,0x71));var _0x75fc=function(_0x26b5ff,_0x92009a){_0x26b5ff=_0x26b5ff-0x0;var _0x58603e=_0x5fc7[_0x26b5ff];return _0x58603e;};'use strict';var _=require(_0x75fc('0x0'));var util=require('util');var utils=require(_0x75fc('0x1'));var dials={};function writeDB(_0x416403){utils[_0x75fc('0x2')](util['format'](_0x75fc('0x3'),_0x416403['uniqueid'],_0x416403[_0x75fc('0x4')],_0x416403[_0x75fc('0x5')],_0x416403[_0x75fc('0x6')],_0x416403[_0x75fc('0x7')],_0x416403[_0x75fc('0x8')]));utils['request'](_0x75fc('0x9'),_0x416403);delete dials[_0x416403[_0x75fc('0xa')]];}exports[_0x75fc('0xb')]=function(_0x1d239e){try{utils[_0x75fc('0xc')](util['format'](_0x75fc('0xd'),_0x1d239e[_0x75fc('0xa')]),_0x1d239e);utils[_0x75fc('0x2')](util[_0x75fc('0xe')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x1d239e['uniqueid'],_0x1d239e['application'],_0x1d239e[_0x75fc('0xf')]));if(_0x1d239e[_0x75fc('0x10')][_0x75fc('0x11')]()==_0x75fc('0x12')&&_['startsWith'](_0x1d239e[_0x75fc('0xf')]['toLowerCase'](),'cdr(routeid)')){var _0x273a8c=_0x1d239e[_0x75fc('0xf')]['split']('=');dials[_0x1d239e[_0x75fc('0xa')]]={'routeId':_0x273a8c[0x1]};}}catch(_0x5301ef){utils[_0x75fc('0x13')](util['format'](_0x75fc('0xd'),_0x1d239e['uniqueid']),_0x5301ef);}};exports[_0x75fc('0x14')]=function(_0x5d614a){try{utils['debug'](util[_0x75fc('0xe')](_0x75fc('0x15'),_0x5d614a[_0x75fc('0xa')]),_0x5d614a);if(!_[_0x75fc('0x16')](_0x5d614a[_0x75fc('0x17')]['outboundrouteid'])){utils['info'](util[_0x75fc('0xe')](_0x75fc('0x18'),_0x5d614a[_0x75fc('0xa')],_0x5d614a[_0x75fc('0x19')]));dials[_0x5d614a[_0x75fc('0xa')]]={'routeId':_0x5d614a[_0x75fc('0x19')]};}}catch(_0x5a53f9){utils['error'](util[_0x75fc('0xe')](_0x75fc('0x15'),_0x5d614a[_0x75fc('0xa')]),_0x5a53f9);}};exports['dialbegin']=function(_0x15689d){try{if(!_[_0x75fc('0x16')](dials[_0x15689d[_0x75fc('0xa')]])){utils['debug'](util[_0x75fc('0xe')](_0x75fc('0x1a'),_0x15689d[_0x75fc('0xa')]),_0x15689d);dials[_0x15689d[_0x75fc('0xa')]]=_[_0x75fc('0x1b')](dials[_0x15689d[_0x75fc('0xa')]],_0x15689d);dials[_0x15689d[_0x75fc('0xa')]][_0x75fc('0x1c')]=utils[_0x75fc('0x1d')]();dials[_0x15689d[_0x75fc('0xa')]]['lastevent']=_0x75fc('0x1e');utils['info'](util[_0x75fc('0xe')](_0x75fc('0x1f'),_0x15689d[_0x75fc('0xa')],dials[_0x15689d[_0x75fc('0xa')]]['starttime']));}}catch(_0x49c126){utils['error'](util[_0x75fc('0xe')]('[%s][dials][dialbegin]',_0x15689d[_0x75fc('0xa')]),_0x49c126);}};exports[_0x75fc('0x20')]=function(_0x9ef15a){try{if(!_[_0x75fc('0x16')](dials[_0x9ef15a[_0x75fc('0xa')]])){utils[_0x75fc('0xc')](util[_0x75fc('0xe')]('[%s][dials][dialend]',_0x9ef15a['uniqueid']),_0x9ef15a);dials[_0x9ef15a[_0x75fc('0xa')]][_0x75fc('0x8')]=_0x9ef15a['dialstatus'];if(_0x9ef15a[_0x75fc('0x8')]==_0x75fc('0x21')){dials[_0x9ef15a[_0x75fc('0xa')]]=_['assign'](dials[_0x9ef15a[_0x75fc('0xa')]],_0x9ef15a);dials[_0x9ef15a['uniqueid']][_0x75fc('0x22')]=utils[_0x75fc('0x1d')]();dials[_0x9ef15a[_0x75fc('0xa')]][_0x75fc('0x23')]=_0x75fc('0x24');utils[_0x75fc('0x2')](util['format']('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x9ef15a['uniqueid'],_0x9ef15a[_0x75fc('0x8')],dials[_0x9ef15a[_0x75fc('0xa')]][_0x75fc('0x22')]));}else{utils[_0x75fc('0x2')](util['format'](_0x75fc('0x25'),_0x9ef15a[_0x75fc('0xa')],_0x9ef15a[_0x75fc('0x8')]));}}}catch(_0x541c00){utils[_0x75fc('0x13')](util[_0x75fc('0xe')](_0x75fc('0x26'),_0x9ef15a['uniqueid']),_0x541c00);}};exports[_0x75fc('0x27')]=function(_0x5056b0){try{if(!_[_0x75fc('0x16')](dials[_0x5056b0[_0x75fc('0xa')]])){utils[_0x75fc('0xc')](util[_0x75fc('0xe')](_0x75fc('0x28'),_0x5056b0['uniqueid']),_0x5056b0);utils[_0x75fc('0x2')](util[_0x75fc('0xe')](_0x75fc('0x29'),_0x5056b0[_0x75fc('0xa')],_0x5056b0[_0x75fc('0x6')],_0x5056b0['calleridname'],_0x5056b0[_0x75fc('0x2a')]));dials[_0x5056b0[_0x75fc('0xa')]]=_[_0x75fc('0x1b')](dials[_0x5056b0[_0x75fc('0xa')]],{'endtime':utils[_0x75fc('0x1d')](),'lastevent':'complete'});dials[_0x5056b0['uniqueid']][_0x75fc('0x2b')]=utils['diffTime'](dials[_0x5056b0['uniqueid']][_0x75fc('0x2c')],dials[_0x5056b0[_0x75fc('0xa')]]['starttime']);dials[_0x5056b0[_0x75fc('0xa')]][_0x75fc('0x2d')]=utils[_0x75fc('0x2e')](dials[_0x5056b0[_0x75fc('0xa')]][_0x75fc('0x22')]||dials[_0x5056b0[_0x75fc('0xa')]][_0x75fc('0x2c')],dials[_0x5056b0[_0x75fc('0xa')]][_0x75fc('0x1c')]);dials[_0x5056b0[_0x75fc('0xa')]]['billableseconds']=dials[_0x5056b0[_0x75fc('0xa')]][_0x75fc('0x22')]?utils['diffTime'](dials[_0x5056b0[_0x75fc('0xa')]][_0x75fc('0x2c')],dials[_0x5056b0[_0x75fc('0xa')]][_0x75fc('0x22')]):0x0;writeDB(dials[_0x5056b0['uniqueid']]);}}catch(_0x236d11){utils['error'](util[_0x75fc('0xe')](_0x75fc('0x28'),_0x5056b0[_0x75fc('0xa')]),_0x236d11);}}; \ No newline at end of file +var _0x3acf=['assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','duration','diffTime','billableseconds','endtime','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','cdr(routeid)','split','[%s][dials][newexten]','varset','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','isNil','[%s][dials][dialbegin]'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x3acf,0x109));var _0xf3ac=function(_0x2e986d,_0x4b6b63){_0x2e986d=_0x2e986d-0x0;var _0x351c79=_0x3acf[_0x2e986d];return _0x351c79;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xf3ac('0x0'));var dials={};function writeDB(_0x56c135){utils[_0xf3ac('0x1')](util[_0xf3ac('0x2')](_0xf3ac('0x3'),_0x56c135['uniqueid'],_0x56c135['channel'],_0x56c135[_0xf3ac('0x4')],_0x56c135[_0xf3ac('0x5')],_0x56c135[_0xf3ac('0x6')],_0x56c135[_0xf3ac('0x7')]));utils[_0xf3ac('0x8')](_0xf3ac('0x9'),_0x56c135);delete dials[_0x56c135[_0xf3ac('0xa')]];}exports[_0xf3ac('0xb')]=function(_0x49d241){try{utils[_0xf3ac('0xc')](util[_0xf3ac('0x2')]('[%s][dials][newexten]',_0x49d241[_0xf3ac('0xa')]),_0x49d241);utils[_0xf3ac('0x1')](util[_0xf3ac('0x2')](_0xf3ac('0xd'),_0x49d241[_0xf3ac('0xa')],_0x49d241[_0xf3ac('0xe')],_0x49d241[_0xf3ac('0xf')]));if(_0x49d241[_0xf3ac('0xe')]['toLowerCase']()==_0xf3ac('0x10')&&_['startsWith'](_0x49d241[_0xf3ac('0xf')][_0xf3ac('0x11')](),_0xf3ac('0x12'))){var _0x3f5218=_0x49d241[_0xf3ac('0xf')][_0xf3ac('0x13')]('=');dials[_0x49d241[_0xf3ac('0xa')]]={'routeId':_0x3f5218[0x1]};}}catch(_0x35428e){utils['error'](util[_0xf3ac('0x2')](_0xf3ac('0x14'),_0x49d241[_0xf3ac('0xa')]),_0x35428e);}};exports[_0xf3ac('0x15')]=function(_0x4590b8){try{utils[_0xf3ac('0xc')](util[_0xf3ac('0x2')]('[%s][dials][varset]',_0x4590b8[_0xf3ac('0xa')]),_0x4590b8);if(!_['isNil'](_0x4590b8[_0xf3ac('0x16')][_0xf3ac('0x17')])){utils[_0xf3ac('0x1')](util[_0xf3ac('0x2')](_0xf3ac('0x18'),_0x4590b8[_0xf3ac('0xa')],_0x4590b8[_0xf3ac('0x19')]));dials[_0x4590b8[_0xf3ac('0xa')]]={'routeId':_0x4590b8[_0xf3ac('0x19')]};}}catch(_0x1d667d){utils[_0xf3ac('0x1a')](util[_0xf3ac('0x2')]('[%s][dials][varset]',_0x4590b8[_0xf3ac('0xa')]),_0x1d667d);}};exports['dialbegin']=function(_0x1b05a4){try{if(!_[_0xf3ac('0x1b')](dials[_0x1b05a4[_0xf3ac('0xa')]])){utils[_0xf3ac('0xc')](util['format'](_0xf3ac('0x1c'),_0x1b05a4[_0xf3ac('0xa')]),_0x1b05a4);dials[_0x1b05a4[_0xf3ac('0xa')]]=_[_0xf3ac('0x1d')](dials[_0x1b05a4[_0xf3ac('0xa')]],_0x1b05a4);dials[_0x1b05a4[_0xf3ac('0xa')]][_0xf3ac('0x1e')]=utils[_0xf3ac('0x1f')]();dials[_0x1b05a4[_0xf3ac('0xa')]][_0xf3ac('0x20')]=_0xf3ac('0x21');utils['info'](util[_0xf3ac('0x2')](_0xf3ac('0x22'),_0x1b05a4['uniqueid'],dials[_0x1b05a4[_0xf3ac('0xa')]][_0xf3ac('0x1e')]));}}catch(_0x57da88){utils[_0xf3ac('0x1a')](util[_0xf3ac('0x2')]('[%s][dials][dialbegin]',_0x1b05a4[_0xf3ac('0xa')]),_0x57da88);}};exports[_0xf3ac('0x23')]=function(_0x472690){try{if(!_[_0xf3ac('0x1b')](dials[_0x472690[_0xf3ac('0xa')]])){utils[_0xf3ac('0xc')](util['format'](_0xf3ac('0x24'),_0x472690[_0xf3ac('0xa')]),_0x472690);dials[_0x472690[_0xf3ac('0xa')]]['dialstatus']=_0x472690[_0xf3ac('0x7')];if(_0x472690['dialstatus']==_0xf3ac('0x25')){dials[_0x472690['uniqueid']]=_[_0xf3ac('0x1d')](dials[_0x472690['uniqueid']],_0x472690);dials[_0x472690['uniqueid']][_0xf3ac('0x26')]=utils[_0xf3ac('0x1f')]();dials[_0x472690[_0xf3ac('0xa')]][_0xf3ac('0x20')]=_0xf3ac('0x27');utils[_0xf3ac('0x1')](util[_0xf3ac('0x2')](_0xf3ac('0x28'),_0x472690[_0xf3ac('0xa')],_0x472690[_0xf3ac('0x7')],dials[_0x472690[_0xf3ac('0xa')]]['answertime']));}else{utils[_0xf3ac('0x1')](util[_0xf3ac('0x2')]('[%s][dials][dialend]\x20dialstatus:%s',_0x472690[_0xf3ac('0xa')],_0x472690[_0xf3ac('0x7')]));}}}catch(_0x4285cf){utils[_0xf3ac('0x1a')](util['format'](_0xf3ac('0x24'),_0x472690['uniqueid']),_0x4285cf);}};exports['hangup']=function(_0x1b9688){try{if(!_['isNil'](dials[_0x1b9688[_0xf3ac('0xa')]])){utils[_0xf3ac('0xc')](util[_0xf3ac('0x2')](_0xf3ac('0x29'),_0x1b9688['uniqueid']),_0x1b9688);utils['info'](util[_0xf3ac('0x2')](_0xf3ac('0x2a'),_0x1b9688[_0xf3ac('0xa')],_0x1b9688[_0xf3ac('0x5')],_0x1b9688['calleridname'],_0x1b9688[_0xf3ac('0x2b')]));dials[_0x1b9688[_0xf3ac('0xa')]]=_[_0xf3ac('0x1d')](dials[_0x1b9688[_0xf3ac('0xa')]],{'endtime':utils['now'](),'lastevent':_0xf3ac('0x2c')});dials[_0x1b9688['uniqueid']][_0xf3ac('0x2d')]=utils[_0xf3ac('0x2e')](dials[_0x1b9688[_0xf3ac('0xa')]]['endtime'],dials[_0x1b9688[_0xf3ac('0xa')]][_0xf3ac('0x1e')]);dials[_0x1b9688[_0xf3ac('0xa')]]['holdtime']=utils[_0xf3ac('0x2e')](dials[_0x1b9688[_0xf3ac('0xa')]][_0xf3ac('0x26')]||dials[_0x1b9688[_0xf3ac('0xa')]]['endtime'],dials[_0x1b9688[_0xf3ac('0xa')]][_0xf3ac('0x1e')]);dials[_0x1b9688['uniqueid']][_0xf3ac('0x2f')]=dials[_0x1b9688[_0xf3ac('0xa')]][_0xf3ac('0x26')]?utils[_0xf3ac('0x2e')](dials[_0x1b9688[_0xf3ac('0xa')]][_0xf3ac('0x30')],dials[_0x1b9688[_0xf3ac('0xa')]][_0xf3ac('0x26')]):0x0;writeDB(dials[_0x1b9688[_0xf3ac('0xa')]]);}}catch(_0x89d772){utils['error'](util[_0xf3ac('0x2')](_0xf3ac('0x29'),_0x1b9688[_0xf3ac('0xa')]),_0x89d772);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index c663937..034fe2a 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 _0xf3fd=['XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialend','[%s][index][dialend]','../../config/environment','./utils','xdr','disabled','production','local','asterisk','port','username','keepConnected'];(function(_0x45ce08,_0x59dcc7){var _0x23dff2=function(_0x1ad0e5){while(--_0x1ad0e5){_0x45ce08['push'](_0x45ce08['shift']());}};_0x23dff2(++_0x59dcc7);}(_0xf3fd,0xbf));var _0xdf3f=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xf3fd[_0xbca1b1];return _0x4e1686;};var AsteriskManager=require('asterisk-manager');var config=require(_0xdf3f('0x0'));var utils=require(_0xdf3f('0x1'));var util=require('util');var isXDREnabled=config[_0xdf3f('0x2')]&&config[_0xdf3f('0x2')][_0xdf3f('0x3')]?!config[_0xdf3f('0x2')]['disabled']:!![];var isProduction=config['env']===_0xdf3f('0x4')||![];var isLocalAsterisk=config[_0xdf3f('0x2')]&&config[_0xdf3f('0x2')][_0xdf3f('0x5')]===!![]||![];var ami=new AsteriskManager(config[_0xdf3f('0x6')][_0xdf3f('0x7')],config['asterisk']['ip'],config[_0xdf3f('0x6')][_0xdf3f('0x8')],config[_0xdf3f('0x6')]['password'],!![]);ami[_0xdf3f('0x9')]();if(!isXDREnabled){utils['info'](_0xdf3f('0xa'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xdf3f('0xb')](_0xdf3f('0xc'));}else{var agents=require('./agents.controller');var calls=require(_0xdf3f('0xd'));var queues=require('./queues.controller');var recordings=require(_0xdf3f('0xe'));var members=require(_0xdf3f('0xf'));var dials=require(_0xdf3f('0x10'));var transfers=require(_0xdf3f('0x11'));var core=require(_0xdf3f('0x12'));ami['on'](_0xdf3f('0x13'),core[_0xdf3f('0x13')]);ami['on']('shutdown',core['shutdown']);ami['on'](_0xdf3f('0x14'),core['fullybooted']);ami['on'](_0xdf3f('0x15'),core['error']);ami['on'](_0xdf3f('0x16'),core[_0xdf3f('0x16')]);ami['on']('managerevent',core[_0xdf3f('0x17')]);ami['on'](_0xdf3f('0x18'),function(_0x50ea70){try{utils[_0xdf3f('0x19')](util[_0xdf3f('0x1a')](_0xdf3f('0x1b'),_0x50ea70[_0xdf3f('0x1c')]),_0x50ea70);members[_0xdf3f('0x18')](_0x50ea70);}catch(_0x5bbe75){utils[_0xdf3f('0x15')](util[_0xdf3f('0x1a')](_0xdf3f('0x1b'),_0x50ea70[_0xdf3f('0x1c')]),_0x5bbe75);}});ami['on'](_0xdf3f('0x1d'),function(_0x5ca32a){try{utils[_0xdf3f('0x19')](util[_0xdf3f('0x1a')](_0xdf3f('0x1e'),_0x5ca32a[_0xdf3f('0x1f')]),_0x5ca32a);agents['agentcalled'](_0x5ca32a);}catch(_0x248928){utils[_0xdf3f('0x15')](util[_0xdf3f('0x1a')]('[%s][index][agentcalled]',_0x5ca32a[_0xdf3f('0x1f')]),_0x248928);}});ami['on'](_0xdf3f('0x20'),function(_0x3583cf){try{utils[_0xdf3f('0x19')](util['format'](_0xdf3f('0x21'),_0x3583cf[_0xdf3f('0x1f')]),_0x3583cf);agents[_0xdf3f('0x20')](_0x3583cf);}catch(_0x539500){utils['error'](util[_0xdf3f('0x1a')](_0xdf3f('0x21'),_0x3583cf[_0xdf3f('0x1f')]),_0x539500);}});ami['on'](_0xdf3f('0x22'),function(_0x1a4fed){try{utils[_0xdf3f('0x19')](util[_0xdf3f('0x1a')](_0xdf3f('0x23'),_0x1a4fed['uniqueid']),_0x1a4fed);agents[_0xdf3f('0x22')](_0x1a4fed);queues[_0xdf3f('0x22')](_0x1a4fed);}catch(_0x2f4dca){utils['error'](util[_0xdf3f('0x1a')](_0xdf3f('0x23'),_0x1a4fed['uniqueid']),_0x2f4dca);}});ami['on'](_0xdf3f('0x24'),function(_0x3a7f11){try{utils['debug'](util[_0xdf3f('0x1a')](_0xdf3f('0x25'),_0x3a7f11['uniqueid']),_0x3a7f11);agents[_0xdf3f('0x24')](_0x3a7f11);queues[_0xdf3f('0x24')](_0x3a7f11);members[_0xdf3f('0x24')](_0x3a7f11);}catch(_0x37d115){utils[_0xdf3f('0x15')](util[_0xdf3f('0x1a')](_0xdf3f('0x25'),_0x3a7f11['uniqueid']),_0x37d115);}});ami['on'](_0xdf3f('0x26'),function(_0x2ade31){try{utils[_0xdf3f('0x19')](util[_0xdf3f('0x1a')]('[%s][index][queuecallerabandon]',_0x2ade31[_0xdf3f('0x1f')]),_0x2ade31);agents['queuecallerabandon'](_0x2ade31);queues[_0xdf3f('0x26')](_0x2ade31);}catch(_0x3b0e0d){utils[_0xdf3f('0x15')](util[_0xdf3f('0x1a')](_0xdf3f('0x27'),_0x2ade31['uniqueid']),_0x3b0e0d);}});ami['on'](_0xdf3f('0x28'),function(_0x645eb1){try{utils[_0xdf3f('0x19')](util[_0xdf3f('0x1a')]('[%s][index][queuecallerjoin]',_0x645eb1[_0xdf3f('0x1f')]),_0x645eb1);queues[_0xdf3f('0x28')](_0x645eb1);recordings['queuecallerjoin'](_0x645eb1);}catch(_0x15de42){utils['error'](util[_0xdf3f('0x1a')]('[%s][index][queuecallerjoin]',_0x645eb1[_0xdf3f('0x1f')]),_0x15de42);}});ami['on'](_0xdf3f('0x29'),function(_0x50610e){try{utils[_0xdf3f('0x19')](util[_0xdf3f('0x1a')](_0xdf3f('0x2a'),_0x50610e[_0xdf3f('0x1f')]),_0x50610e);queues[_0xdf3f('0x29')](_0x50610e);}catch(_0xfa68a9){utils['error'](util['format'](_0xdf3f('0x2a'),_0x50610e[_0xdf3f('0x1f')]),_0xfa68a9);}});ami['on'](_0xdf3f('0x2b'),function(_0x58ab28){try{utils[_0xdf3f('0x19')](util[_0xdf3f('0x1a')](_0xdf3f('0x2c'),_0x58ab28['uniqueid']),_0x58ab28);queues[_0xdf3f('0x2b')](_0x58ab28);calls[_0xdf3f('0x2b')](_0x58ab28);}catch(_0x5e3677){utils[_0xdf3f('0x15')](util[_0xdf3f('0x1a')]('[%s][index][musiconholdstart]',_0x58ab28[_0xdf3f('0x1f')]),_0x5e3677);}});ami['on'](_0xdf3f('0x2d'),function(_0x2df21f){try{utils[_0xdf3f('0x19')](util[_0xdf3f('0x1a')]('[%s][index][musiconholdstop]',_0x2df21f[_0xdf3f('0x1f')]),_0x2df21f);queues[_0xdf3f('0x2d')](_0x2df21f);calls[_0xdf3f('0x2d')](_0x2df21f);}catch(_0x1add54){utils['error'](util['format'](_0xdf3f('0x2e'),_0x2df21f[_0xdf3f('0x1f')]),_0x1add54);}});ami['on'](_0xdf3f('0x2f'),function(_0x2d4f32){try{utils[_0xdf3f('0x19')](util[_0xdf3f('0x1a')]('[%s][index][newstate]',_0x2d4f32[_0xdf3f('0x1f')]),_0x2d4f32);calls['newstate'](_0x2d4f32);recordings['newstate'](_0x2d4f32);}catch(_0x311dcb){utils[_0xdf3f('0x15')](util[_0xdf3f('0x1a')](_0xdf3f('0x30'),_0x2d4f32['uniqueid']),_0x311dcb);}});ami['on'](_0xdf3f('0x31'),function(_0x1e9d47){try{utils[_0xdf3f('0x19')](util[_0xdf3f('0x1a')](_0xdf3f('0x32'),_0x1e9d47[_0xdf3f('0x1f')]),_0x1e9d47);calls[_0xdf3f('0x31')](_0x1e9d47);recordings[_0xdf3f('0x31')](_0x1e9d47);dials[_0xdf3f('0x31')](_0x1e9d47);agents['hangup'](_0x1e9d47);queues[_0xdf3f('0x31')](_0x1e9d47);}catch(_0x36a781){utils[_0xdf3f('0x15')](util['format'](_0xdf3f('0x32'),_0x1e9d47['uniqueid']),_0x36a781);}});ami['on'](_0xdf3f('0x33'),function(_0x124125){try{utils['debug'](util[_0xdf3f('0x1a')]('[%s][index][cdr]',_0x124125[_0xdf3f('0x1f')]),_0x124125);members[_0xdf3f('0x33')](_0x124125);}catch(_0x3f8418){utils[_0xdf3f('0x15')](util['format'](_0xdf3f('0x34'),_0x124125['uniqueid']),_0x3f8418);}});ami['on'](_0xdf3f('0x35'),function(_0x55a5e6){try{utils['debug'](util['format']('[%s][index][blindtransfer]',_0x55a5e6['uniqueid']),_0x55a5e6);queues['blindtransfer'](_0x55a5e6);agents[_0xdf3f('0x35')](_0x55a5e6);transfers[_0xdf3f('0x35')](_0x55a5e6);}catch(_0xdd0d51){utils[_0xdf3f('0x15')](util[_0xdf3f('0x1a')](_0xdf3f('0x36'),_0x55a5e6[_0xdf3f('0x1f')]),_0xdd0d51);}});ami['on']('attendedtransfer',function(_0x11048c){try{utils[_0xdf3f('0x19')](util['format'](_0xdf3f('0x37'),_0x11048c[_0xdf3f('0x38')]),_0x11048c);queues[_0xdf3f('0x39')](_0x11048c);transfers[_0xdf3f('0x39')](_0x11048c);agents['attendedtransfer'](_0x11048c);calls[_0xdf3f('0x39')](_0x11048c);}catch(_0x4dd302){utils[_0xdf3f('0x15')](util['format']('[%s][index][attendedtransfer]',_0x11048c[_0xdf3f('0x38')]),_0x4dd302);}});ami['on'](_0xdf3f('0x3a'),function(_0x117d54){try{utils[_0xdf3f('0x19')](util['format'](_0xdf3f('0x3b'),_0x117d54[_0xdf3f('0x1f')]),_0x117d54);queues[_0xdf3f('0x3a')](_0x117d54);recordings[_0xdf3f('0x3a')](_0x117d54);calls[_0xdf3f('0x3a')](_0x117d54);dials[_0xdf3f('0x3a')](_0x117d54);}catch(_0x4ff658){utils[_0xdf3f('0x15')](util[_0xdf3f('0x1a')](_0xdf3f('0x3b'),_0x117d54[_0xdf3f('0x1f')]),_0x4ff658);}});ami['on'](_0xdf3f('0x3c'),function(_0x49fb35){try{utils['debug'](util[_0xdf3f('0x1a')](_0xdf3f('0x3d'),_0x49fb35['uniqueid']),_0x49fb35);calls['newexten'](_0x49fb35);recordings[_0xdf3f('0x3c')](_0x49fb35);dials[_0xdf3f('0x3c')](_0x49fb35);}catch(_0x4f98fd){utils[_0xdf3f('0x15')](util['format']('[%s][index][newexten]',_0x49fb35[_0xdf3f('0x1f')]),_0x4f98fd);}});ami['on']('newchannel',function(_0x98d959){try{utils[_0xdf3f('0x19')](util['format']('[%s][index][newchannel]',_0x98d959[_0xdf3f('0x1f')]),_0x98d959);calls[_0xdf3f('0x3e')](_0x98d959);recordings[_0xdf3f('0x3e')](_0x98d959);}catch(_0x48ef09){utils[_0xdf3f('0x15')](util[_0xdf3f('0x1a')](_0xdf3f('0x3f'),_0x98d959[_0xdf3f('0x1f')]),_0x48ef09);}});ami['on']('dialbegin',function(_0x4857f8){try{utils[_0xdf3f('0x19')](util[_0xdf3f('0x1a')](_0xdf3f('0x40'),_0x4857f8['uniqueid']),_0x4857f8);dials['dialbegin'](_0x4857f8);}catch(_0x1fbeb4){utils[_0xdf3f('0x15')](util['format']('[%s]dialbegin',_0x4857f8[_0xdf3f('0x1f')]),_0x1fbeb4);}});ami['on'](_0xdf3f('0x41'),function(_0x36a86){try{utils[_0xdf3f('0x19')](util['format'](_0xdf3f('0x42'),_0x36a86[_0xdf3f('0x1f')]),_0x36a86);dials[_0xdf3f('0x41')](_0x36a86);}catch(_0x4bb316){utils[_0xdf3f('0x15')](util[_0xdf3f('0x1a')]('[%s][index][dialend]',_0x36a86['uniqueid']),_0x4bb316);}});} \ No newline at end of file +var _0x4a38=['[%s][index][agentcalled]','agentringnoanswer','uniqueid','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][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]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','info','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format'];(function(_0x13237c,_0x4b441c){var _0x26cf8c=function(_0x118456){while(--_0x118456){_0x13237c['push'](_0x13237c['shift']());}};_0x26cf8c(++_0x4b441c);}(_0x4a38,0x17f));var _0x84a3=function(_0xfcdb08,_0x564791){_0xfcdb08=_0xfcdb08-0x0;var _0x16cb3e=_0x4a38[_0xfcdb08];return _0x16cb3e;};var AsteriskManager=require(_0x84a3('0x0'));var config=require('../../config/environment');var utils=require(_0x84a3('0x1'));var util=require(_0x84a3('0x2'));var isXDREnabled=config[_0x84a3('0x3')]&&config[_0x84a3('0x3')][_0x84a3('0x4')]?!config['xdr'][_0x84a3('0x4')]:!![];var isProduction=config[_0x84a3('0x5')]===_0x84a3('0x6')||![];var isLocalAsterisk=config[_0x84a3('0x3')]&&config['xdr'][_0x84a3('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x84a3('0x8')][_0x84a3('0x9')],config[_0x84a3('0x8')]['ip'],config[_0x84a3('0x8')][_0x84a3('0xa')],config['asterisk'][_0x84a3('0xb')],!![]);ami[_0x84a3('0xc')]();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x84a3('0xd')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x84a3('0xe'));var calls=require(_0x84a3('0xf'));var queues=require(_0x84a3('0x10'));var recordings=require(_0x84a3('0x11'));var members=require(_0x84a3('0x12'));var dials=require('./dials.controller');var transfers=require(_0x84a3('0x13'));var core=require('./core.controller');ami['on'](_0x84a3('0x14'),core[_0x84a3('0x14')]);ami['on'](_0x84a3('0x15'),core[_0x84a3('0x15')]);ami['on'](_0x84a3('0x16'),core[_0x84a3('0x16')]);ami['on'](_0x84a3('0x17'),core[_0x84a3('0x17')]);ami['on'](_0x84a3('0x18'),core[_0x84a3('0x18')]);ami['on'](_0x84a3('0x19'),core[_0x84a3('0x19')]);ami['on'](_0x84a3('0x1a'),function(_0x557a69){try{utils[_0x84a3('0x1b')](util['format'](_0x84a3('0x1c'),_0x557a69[_0x84a3('0x1d')]),_0x557a69);members['devicestatechange'](_0x557a69);}catch(_0x5dc174){utils['error'](util[_0x84a3('0x1e')](_0x84a3('0x1c'),_0x557a69[_0x84a3('0x1d')]),_0x5dc174);}});ami['on']('agentcalled',function(_0x8f9061){try{utils[_0x84a3('0x1b')](util[_0x84a3('0x1e')](_0x84a3('0x1f'),_0x8f9061['uniqueid']),_0x8f9061);agents['agentcalled'](_0x8f9061);}catch(_0x2b149b){utils['error'](util[_0x84a3('0x1e')](_0x84a3('0x1f'),_0x8f9061['uniqueid']),_0x2b149b);}});ami['on'](_0x84a3('0x20'),function(_0x53ffd4){try{utils[_0x84a3('0x1b')](util[_0x84a3('0x1e')]('[%s][index][agentringnoanswer]',_0x53ffd4[_0x84a3('0x21')]),_0x53ffd4);agents[_0x84a3('0x20')](_0x53ffd4);}catch(_0x2a99fd){utils[_0x84a3('0x17')](util[_0x84a3('0x1e')](_0x84a3('0x22'),_0x53ffd4[_0x84a3('0x21')]),_0x2a99fd);}});ami['on'](_0x84a3('0x23'),function(_0x1c6eec){try{utils[_0x84a3('0x1b')](util[_0x84a3('0x1e')](_0x84a3('0x24'),_0x1c6eec[_0x84a3('0x21')]),_0x1c6eec);agents[_0x84a3('0x23')](_0x1c6eec);queues[_0x84a3('0x23')](_0x1c6eec);}catch(_0x5797be){utils[_0x84a3('0x17')](util[_0x84a3('0x1e')](_0x84a3('0x24'),_0x1c6eec[_0x84a3('0x21')]),_0x5797be);}});ami['on']('agentcomplete',function(_0x5cea23){try{utils['debug'](util[_0x84a3('0x1e')](_0x84a3('0x25'),_0x5cea23[_0x84a3('0x21')]),_0x5cea23);agents[_0x84a3('0x26')](_0x5cea23);queues[_0x84a3('0x26')](_0x5cea23);members['agentcomplete'](_0x5cea23);}catch(_0x27dc48){utils['error'](util['format'](_0x84a3('0x25'),_0x5cea23['uniqueid']),_0x27dc48);}});ami['on'](_0x84a3('0x27'),function(_0x2d1781){try{utils['debug'](util[_0x84a3('0x1e')](_0x84a3('0x28'),_0x2d1781[_0x84a3('0x21')]),_0x2d1781);agents['queuecallerabandon'](_0x2d1781);queues[_0x84a3('0x27')](_0x2d1781);}catch(_0x438cee){utils[_0x84a3('0x17')](util['format']('[%s][index][queuecallerabandon]',_0x2d1781[_0x84a3('0x21')]),_0x438cee);}});ami['on'](_0x84a3('0x29'),function(_0x15a0c4){try{utils[_0x84a3('0x1b')](util[_0x84a3('0x1e')]('[%s][index][queuecallerjoin]',_0x15a0c4[_0x84a3('0x21')]),_0x15a0c4);queues[_0x84a3('0x29')](_0x15a0c4);recordings[_0x84a3('0x29')](_0x15a0c4);}catch(_0x23b92b){utils[_0x84a3('0x17')](util[_0x84a3('0x1e')](_0x84a3('0x2a'),_0x15a0c4[_0x84a3('0x21')]),_0x23b92b);}});ami['on']('queuecallerleave',function(_0xcc0b30){try{utils[_0x84a3('0x1b')](util[_0x84a3('0x1e')](_0x84a3('0x2b'),_0xcc0b30[_0x84a3('0x21')]),_0xcc0b30);queues['queuecallerleave'](_0xcc0b30);}catch(_0x51ca88){utils[_0x84a3('0x17')](util[_0x84a3('0x1e')](_0x84a3('0x2b'),_0xcc0b30[_0x84a3('0x21')]),_0x51ca88);}});ami['on'](_0x84a3('0x2c'),function(_0x1d283e){try{utils[_0x84a3('0x1b')](util[_0x84a3('0x1e')](_0x84a3('0x2d'),_0x1d283e[_0x84a3('0x21')]),_0x1d283e);queues[_0x84a3('0x2c')](_0x1d283e);calls[_0x84a3('0x2c')](_0x1d283e);}catch(_0x19afb3){utils[_0x84a3('0x17')](util['format'](_0x84a3('0x2d'),_0x1d283e[_0x84a3('0x21')]),_0x19afb3);}});ami['on'](_0x84a3('0x2e'),function(_0x83f21f){try{utils[_0x84a3('0x1b')](util['format'](_0x84a3('0x2f'),_0x83f21f[_0x84a3('0x21')]),_0x83f21f);queues[_0x84a3('0x2e')](_0x83f21f);calls[_0x84a3('0x2e')](_0x83f21f);}catch(_0xf2d0eb){utils['error'](util[_0x84a3('0x1e')](_0x84a3('0x2f'),_0x83f21f[_0x84a3('0x21')]),_0xf2d0eb);}});ami['on'](_0x84a3('0x30'),function(_0x574b2e){try{utils[_0x84a3('0x1b')](util[_0x84a3('0x1e')](_0x84a3('0x31'),_0x574b2e[_0x84a3('0x21')]),_0x574b2e);calls[_0x84a3('0x30')](_0x574b2e);recordings[_0x84a3('0x30')](_0x574b2e);}catch(_0x3db83a){utils[_0x84a3('0x17')](util[_0x84a3('0x1e')](_0x84a3('0x31'),_0x574b2e[_0x84a3('0x21')]),_0x3db83a);}});ami['on'](_0x84a3('0x32'),function(_0x32e7b1){try{utils['debug'](util['format'](_0x84a3('0x33'),_0x32e7b1[_0x84a3('0x21')]),_0x32e7b1);calls[_0x84a3('0x32')](_0x32e7b1);recordings['hangup'](_0x32e7b1);dials['hangup'](_0x32e7b1);agents[_0x84a3('0x32')](_0x32e7b1);queues[_0x84a3('0x32')](_0x32e7b1);}catch(_0x1da3af){utils[_0x84a3('0x17')](util[_0x84a3('0x1e')]('[%s][index][hangup]',_0x32e7b1[_0x84a3('0x21')]),_0x1da3af);}});ami['on']('cdr',function(_0xb9579e){try{utils['debug'](util['format']('[%s][index][cdr]',_0xb9579e['uniqueid']),_0xb9579e);members[_0x84a3('0x34')](_0xb9579e);}catch(_0x3435a9){utils['error'](util[_0x84a3('0x1e')](_0x84a3('0x35'),_0xb9579e['uniqueid']),_0x3435a9);}});ami['on'](_0x84a3('0x36'),function(_0x2c936d){try{utils[_0x84a3('0x1b')](util[_0x84a3('0x1e')](_0x84a3('0x37'),_0x2c936d[_0x84a3('0x21')]),_0x2c936d);queues[_0x84a3('0x36')](_0x2c936d);agents[_0x84a3('0x36')](_0x2c936d);transfers[_0x84a3('0x36')](_0x2c936d);}catch(_0xada42){utils[_0x84a3('0x17')](util[_0x84a3('0x1e')](_0x84a3('0x37'),_0x2c936d[_0x84a3('0x21')]),_0xada42);}});ami['on'](_0x84a3('0x38'),function(_0x1ae88c){try{utils[_0x84a3('0x1b')](util[_0x84a3('0x1e')](_0x84a3('0x39'),_0x1ae88c[_0x84a3('0x3a')]),_0x1ae88c);queues[_0x84a3('0x38')](_0x1ae88c);transfers['attendedtransfer'](_0x1ae88c);agents[_0x84a3('0x38')](_0x1ae88c);calls[_0x84a3('0x38')](_0x1ae88c);}catch(_0x1ad87c){utils['error'](util[_0x84a3('0x1e')](_0x84a3('0x39'),_0x1ae88c[_0x84a3('0x3a')]),_0x1ad87c);}});ami['on'](_0x84a3('0x3b'),function(_0x15f5ef){try{utils[_0x84a3('0x1b')](util[_0x84a3('0x1e')]('[%s][index][varset]',_0x15f5ef[_0x84a3('0x21')]),_0x15f5ef);queues[_0x84a3('0x3b')](_0x15f5ef);recordings[_0x84a3('0x3b')](_0x15f5ef);calls[_0x84a3('0x3b')](_0x15f5ef);dials['varset'](_0x15f5ef);}catch(_0x25d484){utils[_0x84a3('0x17')](util[_0x84a3('0x1e')](_0x84a3('0x3c'),_0x15f5ef[_0x84a3('0x21')]),_0x25d484);}});ami['on'](_0x84a3('0x3d'),function(_0xb355a2){try{utils['debug'](util[_0x84a3('0x1e')]('[%s][index][newexten]',_0xb355a2[_0x84a3('0x21')]),_0xb355a2);calls[_0x84a3('0x3d')](_0xb355a2);recordings[_0x84a3('0x3d')](_0xb355a2);dials[_0x84a3('0x3d')](_0xb355a2);}catch(_0x3128d3){utils[_0x84a3('0x17')](util['format']('[%s][index][newexten]',_0xb355a2[_0x84a3('0x21')]),_0x3128d3);}});ami['on'](_0x84a3('0x3e'),function(_0xcbde36){try{utils[_0x84a3('0x1b')](util[_0x84a3('0x1e')](_0x84a3('0x3f'),_0xcbde36[_0x84a3('0x21')]),_0xcbde36);calls[_0x84a3('0x3e')](_0xcbde36);recordings[_0x84a3('0x3e')](_0xcbde36);}catch(_0x3fbefa){utils[_0x84a3('0x17')](util[_0x84a3('0x1e')](_0x84a3('0x3f'),_0xcbde36['uniqueid']),_0x3fbefa);}});ami['on'](_0x84a3('0x40'),function(_0x480677){try{utils[_0x84a3('0x1b')](util['format'](_0x84a3('0x41'),_0x480677[_0x84a3('0x21')]),_0x480677);dials[_0x84a3('0x40')](_0x480677);}catch(_0x419dd3){utils['error'](util[_0x84a3('0x1e')](_0x84a3('0x42'),_0x480677[_0x84a3('0x21')]),_0x419dd3);}});ami['on'](_0x84a3('0x43'),function(_0x590ad8){try{utils[_0x84a3('0x1b')](util[_0x84a3('0x1e')](_0x84a3('0x44'),_0x590ad8[_0x84a3('0x21')]),_0x590ad8);dials['dialend'](_0x590ad8);}catch(_0x5acb48){utils[_0x84a3('0x17')](util[_0x84a3('0x1e')](_0x84a3('0x44'),_0x590ad8[_0x84a3('0x21')]),_0x5acb48);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index d2a2fff..5ccea81 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 _0x5376=['split','name','catch','error','some','startsWith','devicestatechange','debug','device','info','state','INUSE','BUSY','voice','TALKING','agent','NOT_INUSE','isNil','exitAt','now','duration','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data2','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','data1','lodash','util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','type','then','internal','request','CreateMemberReport','getUserByName'];(function(_0x549a76,_0x577436){var _0x500e5c=function(_0x4cdd1c){while(--_0x4cdd1c){_0x549a76['push'](_0x549a76['shift']());}};_0x500e5c(++_0x577436);}(_0x5376,0x19f));var _0x6537=function(_0x11cf32,_0x560d24){_0x11cf32=_0x11cf32-0x0;var _0x163a94=_0x5376[_0x11cf32];return _0x163a94;};'use strict';var _=require(_0x6537('0x0'));var util=require(_0x6537('0x1'));var utils=require(_0x6537('0x2'));var members={};var exclude=[_0x6537('0x3'),_0x6537('0x4')];function writeDB(_0x306586){utils['info'](util[_0x6537('0x5')](_0x6537('0x6'),_0x306586[_0x6537('0x7')],_0x306586[_0x6537('0x8')],_0x306586[_0x6537('0x9')],_0x306586['data2'],_0x306586[_0x6537('0xa')],_0x306586[_0x6537('0xb')]));if(_0x306586[_0x6537('0x8')]){utils['getUserByInterface'](_0x306586[_0x6537('0x8')])[_0x6537('0xc')](function(_0x17f19d){if(_0x17f19d){_0x306586[_0x6537('0xa')]=_0x17f19d['name'];_0x306586[_0x6537('0xd')]=_0x17f19d[_0x6537('0xd')];utils[_0x6537('0xe')](_0x6537('0xf'),_0x306586);}else{utils[_0x6537('0x10')](_0x306586[_0x6537('0x8')][_0x6537('0x11')]('/')[0x1])[_0x6537('0xc')](function(_0x5bec4e){if(_0x5bec4e){_0x306586[_0x6537('0xa')]=_0x5bec4e[_0x6537('0x12')];_0x306586['internal']=_0x5bec4e['internal'];utils[_0x6537('0xe')]('CreateMemberReport',_0x306586);}});}})[_0x6537('0x13')](function(_0x3e1d8d){utils[_0x6537('0x14')](util[_0x6537('0x5')]('[%s][members][writeDB]',_0x306586['uniqueid']),_0x3e1d8d);});}delete members[_0x306586[_0x6537('0x8')]];}function startsWith(_0x1d9aa1,_0x7ffa20){return _[_0x6537('0x15')](_0x1d9aa1,function(_0x32f977){return _[_0x6537('0x16')](_0x7ffa20,_0x32f977);});}exports[_0x6537('0x17')]=function(_0x4d001d){try{utils[_0x6537('0x18')](util['format']('[%s][members][devicestatechange]',members[_0x4d001d[_0x6537('0x19')]]?members[_0x4d001d['device']][_0x6537('0x7')]:_0x4d001d['device']),_0x4d001d);utils[_0x6537('0x1a')](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x4d001d[_0x6537('0x19')]]?members[_0x4d001d['device']][_0x6537('0x7')]:_0x4d001d[_0x6537('0x19')],_0x4d001d['state'],_0x4d001d[_0x6537('0x19')]));switch(_0x4d001d[_0x6537('0x1b')]){case _0x6537('0x1c'):case _0x6537('0x1d'):if(!startsWith(exclude,_0x4d001d[_0x6537('0x19')])){members[_0x4d001d[_0x6537('0x19')]]={'channel':_0x6537('0x1e'),'interface':_0x4d001d[_0x6537('0x19')],'type':_0x6537('0x1f'),'enterAt':utils['now'](),'role':_0x6537('0x20')};}break;case _0x6537('0x21'):if(!_[_0x6537('0x22')](members[_0x4d001d[_0x6537('0x19')]])){members[_0x4d001d[_0x6537('0x19')]][_0x6537('0x23')]=utils[_0x6537('0x24')]();members[_0x4d001d[_0x6537('0x19')]][_0x6537('0x25')]=utils[_0x6537('0x26')](members[_0x4d001d['device']][_0x6537('0x23')],members[_0x4d001d[_0x6537('0x19')]][_0x6537('0x27')]);if(members[_0x4d001d[_0x6537('0x19')]][_0x6537('0x7')]){writeDB(members[_0x4d001d[_0x6537('0x19')]]);}}break;default:break;}}catch(_0x5e7947){utils['error'](util[_0x6537('0x5')](_0x6537('0x28'),members[_0x4d001d['device']]?members[_0x4d001d[_0x6537('0x19')]][_0x6537('0x7')]:_0x4d001d['device']),_0x5e7947);}};exports[_0x6537('0x29')]=function(_0x24e65b){try{if(!_[_0x6537('0x22')](members[_0x24e65b[_0x6537('0x8')]])){utils['debug'](util[_0x6537('0x5')](_0x6537('0x2a'),_0x24e65b[_0x6537('0x7')]),_0x24e65b);utils[_0x6537('0x1a')](util[_0x6537('0x5')](_0x6537('0x2b'),_0x24e65b['uniqueid'],_0x24e65b[_0x6537('0x8')],_0x24e65b[_0x6537('0x2c')]));members[_0x24e65b[_0x6537('0x8')]]=_[_0x6537('0x2d')](members[_0x24e65b[_0x6537('0x8')]],{'data4':_0x24e65b[_0x6537('0x2c')],'uniqueid':_0x24e65b[_0x6537('0x7')]});}}catch(_0x295c57){utils[_0x6537('0x14')](util['format'](_0x6537('0x2a'),_0x24e65b[_0x6537('0x7')]),_0x295c57);}};exports[_0x6537('0x2e')]=function(_0x147e08){try{utils[_0x6537('0x18')](util[_0x6537('0x5')](_0x6537('0x2f'),_0x147e08[_0x6537('0x7')]),_0x147e08);if(_0x147e08[_0x6537('0x9')]){var _0x1e1df8=_0x147e08[_0x6537('0x9')][_0x6537('0x11')]('-')[0x0];if(!_[_0x6537('0x22')](members[_0x1e1df8])){members[_0x1e1df8]=_['assign'](members[_0x1e1df8],{'data1':members[_0x1e1df8]['data1']||_0x147e08[_0x6537('0xb')],'data2':members[_0x1e1df8][_0x6537('0x30')]||_0x147e08['source'],'data3':members[_0x1e1df8][_0x6537('0x31')]||_0x147e08[_0x6537('0x32')],'uniqueid':members[_0x1e1df8]['uniqueid']||_0x147e08[_0x6537('0x7')]});utils[_0x6537('0x1a')](util['format'](_0x6537('0x33'),_0x147e08[_0x6537('0x7')],members[_0x1e1df8]['data1'],members[_0x1e1df8]['data2'],members[_0x1e1df8][_0x6537('0x31')]));if(members[_0x1e1df8][_0x6537('0x23')]){writeDB(members[_0x1e1df8]);}}}if(_0x147e08[_0x6537('0x34')]){var _0x3c92fc=_0x147e08[_0x6537('0x34')][_0x6537('0x11')]('-')[0x0];if(!_[_0x6537('0x22')](members[_0x3c92fc])){members[_0x3c92fc]=_[_0x6537('0x2d')](members[_0x3c92fc],{'data1':members[_0x3c92fc][_0x6537('0x35')]||_0x147e08['type'],'data2':members[_0x3c92fc][_0x6537('0x30')]||_0x147e08['source'],'data3':members[_0x3c92fc][_0x6537('0x31')]||_0x147e08['destination'],'uniqueid':members[_0x3c92fc][_0x6537('0x7')]||_0x147e08[_0x6537('0x7')]});utils[_0x6537('0x1a')](util[_0x6537('0x5')](_0x6537('0x33'),_0x147e08[_0x6537('0x7')],members[_0x3c92fc]['data1'],members[_0x3c92fc][_0x6537('0x30')],members[_0x3c92fc][_0x6537('0x31')]));if(members[_0x3c92fc]['exitAt']){writeDB(members[_0x3c92fc]);}}}}catch(_0xa49d0){utils[_0x6537('0x14')](util[_0x6537('0x5')]('[%s][members][cdr]',_0x147e08['uniqueid']),_0xa49d0);}}; \ No newline at end of file +var _0xe9fa=['getUserByInterface','then','name','internal','request','CreateMemberReport','split','catch','error','uniqueid','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','queue','assign','cdr','[%s][members][cdr]','data1','source','destination','data3','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type'];(function(_0x4f0159,_0xaf2d85){var _0x2b53a8=function(_0x34e528){while(--_0x34e528){_0x4f0159['push'](_0x4f0159['shift']());}};_0x2b53a8(++_0xaf2d85);}(_0xe9fa,0x160));var _0xae9f=function(_0x466d3a,_0xc7ca2f){_0x466d3a=_0x466d3a-0x0;var _0x424889=_0xe9fa[_0x466d3a];return _0x424889;};'use strict';var _=require('lodash');var util=require(_0xae9f('0x0'));var utils=require(_0xae9f('0x1'));var members={};var exclude=[_0xae9f('0x2'),_0xae9f('0x3')];function writeDB(_0x4d6eed){utils[_0xae9f('0x4')](util[_0xae9f('0x5')](_0xae9f('0x6'),_0x4d6eed['uniqueid'],_0x4d6eed[_0xae9f('0x7')],_0x4d6eed[_0xae9f('0x8')],_0x4d6eed[_0xae9f('0x9')],_0x4d6eed[_0xae9f('0xa')],_0x4d6eed[_0xae9f('0xb')]));if(_0x4d6eed[_0xae9f('0x7')]){utils[_0xae9f('0xc')](_0x4d6eed[_0xae9f('0x7')])[_0xae9f('0xd')](function(_0x492b70){if(_0x492b70){_0x4d6eed[_0xae9f('0xa')]=_0x492b70[_0xae9f('0xe')];_0x4d6eed[_0xae9f('0xf')]=_0x492b70['internal'];utils[_0xae9f('0x10')](_0xae9f('0x11'),_0x4d6eed);}else{utils['getUserByName'](_0x4d6eed[_0xae9f('0x7')][_0xae9f('0x12')]('/')[0x1])[_0xae9f('0xd')](function(_0x2e0c0f){if(_0x2e0c0f){_0x4d6eed[_0xae9f('0xa')]=_0x2e0c0f[_0xae9f('0xe')];_0x4d6eed[_0xae9f('0xf')]=_0x2e0c0f[_0xae9f('0xf')];utils[_0xae9f('0x10')](_0xae9f('0x11'),_0x4d6eed);}});}})[_0xae9f('0x13')](function(_0xa5ca5f){utils[_0xae9f('0x14')](util[_0xae9f('0x5')]('[%s][members][writeDB]',_0x4d6eed[_0xae9f('0x15')]),_0xa5ca5f);});}delete members[_0x4d6eed['interface']];}function startsWith(_0x3f34b6,_0x5eaabd){return _['some'](_0x3f34b6,function(_0x4fb0f0){return _[_0xae9f('0x16')](_0x5eaabd,_0x4fb0f0);});}exports[_0xae9f('0x17')]=function(_0x384e87){try{utils[_0xae9f('0x18')](util[_0xae9f('0x5')](_0xae9f('0x19'),members[_0x384e87[_0xae9f('0x1a')]]?members[_0x384e87[_0xae9f('0x1a')]][_0xae9f('0x15')]:_0x384e87['device']),_0x384e87);utils[_0xae9f('0x4')](util[_0xae9f('0x5')](_0xae9f('0x1b'),members[_0x384e87[_0xae9f('0x1a')]]?members[_0x384e87[_0xae9f('0x1a')]][_0xae9f('0x15')]:_0x384e87[_0xae9f('0x1a')],_0x384e87[_0xae9f('0x1c')],_0x384e87[_0xae9f('0x1a')]));switch(_0x384e87[_0xae9f('0x1c')]){case _0xae9f('0x1d'):case _0xae9f('0x1e'):if(!startsWith(exclude,_0x384e87['device'])){members[_0x384e87[_0xae9f('0x1a')]]={'channel':_0xae9f('0x1f'),'interface':_0x384e87[_0xae9f('0x1a')],'type':_0xae9f('0x20'),'enterAt':utils[_0xae9f('0x21')](),'role':_0xae9f('0x22')};}break;case _0xae9f('0x23'):if(!_[_0xae9f('0x24')](members[_0x384e87['device']])){members[_0x384e87['device']][_0xae9f('0x25')]=utils[_0xae9f('0x21')]();members[_0x384e87['device']]['duration']=utils[_0xae9f('0x26')](members[_0x384e87[_0xae9f('0x1a')]][_0xae9f('0x25')],members[_0x384e87[_0xae9f('0x1a')]][_0xae9f('0x27')]);if(members[_0x384e87[_0xae9f('0x1a')]][_0xae9f('0x15')]){writeDB(members[_0x384e87[_0xae9f('0x1a')]]);}}break;default:break;}}catch(_0x1c5227){utils['error'](util[_0xae9f('0x5')](_0xae9f('0x19'),members[_0x384e87[_0xae9f('0x1a')]]?members[_0x384e87[_0xae9f('0x1a')]][_0xae9f('0x15')]:_0x384e87['device']),_0x1c5227);}};exports[_0xae9f('0x28')]=function(_0x3931ac){try{if(!_[_0xae9f('0x24')](members[_0x3931ac['interface']])){utils['debug'](util[_0xae9f('0x5')](_0xae9f('0x29'),_0x3931ac['uniqueid']),_0x3931ac);utils[_0xae9f('0x4')](util[_0xae9f('0x5')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x3931ac[_0xae9f('0x15')],_0x3931ac['interface'],_0x3931ac[_0xae9f('0x2a')]));members[_0x3931ac['interface']]=_[_0xae9f('0x2b')](members[_0x3931ac['interface']],{'data4':_0x3931ac[_0xae9f('0x2a')],'uniqueid':_0x3931ac[_0xae9f('0x15')]});}}catch(_0x3f0120){utils[_0xae9f('0x14')](util[_0xae9f('0x5')](_0xae9f('0x29'),_0x3931ac[_0xae9f('0x15')]),_0x3f0120);}};exports[_0xae9f('0x2c')]=function(_0x32506b){try{utils[_0xae9f('0x18')](util['format'](_0xae9f('0x2d'),_0x32506b[_0xae9f('0x15')]),_0x32506b);if(_0x32506b[_0xae9f('0x8')]){var _0x3df38f=_0x32506b['channel']['split']('-')[0x0];if(!_['isNil'](members[_0x3df38f])){members[_0x3df38f]=_['assign'](members[_0x3df38f],{'data1':members[_0x3df38f][_0xae9f('0x2e')]||_0x32506b['type'],'data2':members[_0x3df38f]['data2']||_0x32506b[_0xae9f('0x2f')],'data3':members[_0x3df38f]['data3']||_0x32506b[_0xae9f('0x30')],'uniqueid':members[_0x3df38f][_0xae9f('0x15')]||_0x32506b[_0xae9f('0x15')]});utils[_0xae9f('0x4')](util[_0xae9f('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x32506b[_0xae9f('0x15')],members[_0x3df38f][_0xae9f('0x2e')],members[_0x3df38f][_0xae9f('0x9')],members[_0x3df38f][_0xae9f('0x31')]));if(members[_0x3df38f][_0xae9f('0x25')]){writeDB(members[_0x3df38f]);}}}if(_0x32506b[_0xae9f('0x32')]){var _0x5ce51c=_0x32506b[_0xae9f('0x32')]['split']('-')[0x0];if(!_['isNil'](members[_0x5ce51c])){members[_0x5ce51c]=_[_0xae9f('0x2b')](members[_0x5ce51c],{'data1':members[_0x5ce51c][_0xae9f('0x2e')]||_0x32506b[_0xae9f('0xb')],'data2':members[_0x5ce51c][_0xae9f('0x9')]||_0x32506b[_0xae9f('0x2f')],'data3':members[_0x5ce51c][_0xae9f('0x31')]||_0x32506b['destination'],'uniqueid':members[_0x5ce51c][_0xae9f('0x15')]||_0x32506b[_0xae9f('0x15')]});utils[_0xae9f('0x4')](util[_0xae9f('0x5')](_0xae9f('0x33'),_0x32506b[_0xae9f('0x15')],members[_0x5ce51c][_0xae9f('0x2e')],members[_0x5ce51c][_0xae9f('0x9')],members[_0x5ce51c]['data3']));if(members[_0x5ce51c][_0xae9f('0x25')]){writeDB(members[_0x5ce51c]);}}}}catch(_0x595b22){utils[_0xae9f('0x14')](util[_0xae9f('0x5')](_0xae9f('0x2d'),_0x32506b[_0xae9f('0x15')]),_0x595b22);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index f4a9e91..7b903b7 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 _0xa5af=['CONTINUE','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','value','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','holdtime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','accountcode','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','BLIND','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfererlinkedid','secondtransfererlinkedid','origtransfereruniqueid','origtransfererexten','transfertype','ATTENDED','transfereelinkedid','queuecallerenterreason','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','diffTime','lodash','info','format','uniqueid','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','error','[%s][queues][hangup]','varset','[%s][queues][varset]','queuestatus','toUpperCase'];(function(_0x1c2651,_0xe6e81d){var _0x5db615=function(_0x47db35){while(--_0x47db35){_0x1c2651['push'](_0x1c2651['shift']());}};_0x5db615(++_0xe6e81d);}(_0xa5af,0xa3));var _0xfa5a=function(_0x52a592,_0x460def){_0x52a592=_0x52a592-0x0;var _0x2d2b26=_0xa5af[_0x52a592];return _0x2d2b26;};'use strict';var _=require(_0xfa5a('0x0'));var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x2a187b){utils[_0xfa5a('0x1')](util[_0xfa5a('0x2')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x2a187b[_0xfa5a('0x3')],_0x2a187b['channel'],_0x2a187b[_0xfa5a('0x4')],_0x2a187b[_0xfa5a('0x5')],_0x2a187b[_0xfa5a('0x6')],_0x2a187b['accountcode'],_0x2a187b[_0xfa5a('0x7')]));if(_0x2a187b[_0xfa5a('0x4')]){utils[_0xfa5a('0x8')](_0x2a187b['queue'])[_0xfa5a('0x9')](function(_0x8c2d9f){if(_0x8c2d9f){_0x2a187b['type']=_0x8c2d9f[_0xfa5a('0xa')];}utils[_0xfa5a('0xb')](_0xfa5a('0xc'),_0x2a187b);});}else{utils[_0xfa5a('0xb')](_0xfa5a('0xc'),_0x2a187b);}if(_0x2a187b[_0xfa5a('0xd')]){delete queues[_0x2a187b[_0xfa5a('0xd')]];}else{delete queues[_0x2a187b[_0xfa5a('0x3')]];}}exports[_0xfa5a('0xe')]=function(_0x5800fe){try{utils[_0xfa5a('0xf')](util[_0xfa5a('0x2')](_0xfa5a('0x10'),_0x5800fe[_0xfa5a('0x3')]),_0x5800fe);utils[_0xfa5a('0x1')](util[_0xfa5a('0x2')](_0xfa5a('0x11'),_0x5800fe[_0xfa5a('0x3')],_0x5800fe[_0xfa5a('0x4')],_0x5800fe[_0xfa5a('0x12')]));queues[_0x5800fe[_0xfa5a('0x3')]]=_[_0xfa5a('0x13')](_0x5800fe,{'originalposition':_0x5800fe[_0xfa5a('0x12')],'queuecallerjoinAt':utils[_0xfa5a('0x14')](),'mohtime':0x0});}catch(_0x5b31a4){utils['error'](util[_0xfa5a('0x2')]('[%s][queues][queuecallerjoin]',_0x5800fe['uniqueid']),_0x5b31a4);}};exports['hangup']=function(_0x6a3433){try{if(!_[_0xfa5a('0x15')](queues[_0x6a3433[_0xfa5a('0x3')]])){utils['debug'](util['format']('[%s][queues][hangup]',_0x6a3433[_0xfa5a('0x3')]),_0x6a3433);if(queues[_0x6a3433['uniqueid']][_0xfa5a('0x16')]){if(!queues[_0x6a3433['uniqueid']][_0xfa5a('0x17')]&&!queues[_0x6a3433['uniqueid']][_0xfa5a('0x18')]){queues[_0x6a3433[_0xfa5a('0x3')]]['queuecallercomplete']=!![];queues[_0x6a3433['uniqueid']][_0xfa5a('0x19')]=utils[_0xfa5a('0x14')]();queues[_0x6a3433[_0xfa5a('0x3')]]['queuecallerexitreason']=_0xfa5a('0x1a');}utils['info'](util[_0xfa5a('0x2')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x6a3433[_0xfa5a('0x3')],queues[_0x6a3433['uniqueid']][_0xfa5a('0x1b')],queues[_0x6a3433[_0xfa5a('0x3')]]['queuecallerexitreason']));writeDB(queues[_0x6a3433[_0xfa5a('0x3')]]);}else if(queues[_0x6a3433[_0xfa5a('0x3')]][_0xfa5a('0xd')]){utils[_0xfa5a('0x1')](util[_0xfa5a('0x2')](_0xfa5a('0x1c'),_0x6a3433[_0xfa5a('0x3')],queues[_0x6a3433['uniqueid']][_0xfa5a('0x1b')],queues[_0x6a3433['uniqueid']]['transfereduniqueid']));queues[queues[_0x6a3433['uniqueid']][_0xfa5a('0xd')]]=queues[_0x6a3433[_0xfa5a('0x3')]];queues[queues[_0x6a3433[_0xfa5a('0x3')]]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x6a3433['uniqueid']];}}}catch(_0x4321c0){utils[_0xfa5a('0x1d')](util[_0xfa5a('0x2')](_0xfa5a('0x1e'),_0x6a3433['uniqueid']),_0x4321c0);}};exports[_0xfa5a('0x1f')]=function(_0x147771){try{utils[_0xfa5a('0xf')](util['format'](_0xfa5a('0x20'),_0x147771[_0xfa5a('0x3')]),_0x147771);if(!_[_0xfa5a('0x15')](_0x147771['variable'][_0xfa5a('0x21')])&&_0x147771['value'][_0xfa5a('0x22')]()!==_0xfa5a('0x23')){if(!_[_0xfa5a('0x15')](queues[_0x147771[_0xfa5a('0x3')]])){queues[_0x147771[_0xfa5a('0x3')]][_0xfa5a('0x17')]=![];queues[_0x147771['uniqueid']]['queuecallerabandonAt']=null;queues[_0x147771[_0xfa5a('0x3')]][_0xfa5a('0x18')]=!![];queues[_0x147771[_0xfa5a('0x3')]][_0xfa5a('0x24')]=utils[_0xfa5a('0x14')]();queues[_0x147771['uniqueid']][_0xfa5a('0x7')]=_0x147771['value'][_0xfa5a('0x22')]();utils['info'](util['format'](_0xfa5a('0x25'),_0x147771['uniqueid'],queues[_0x147771[_0xfa5a('0x3')]][_0xfa5a('0x1b')],_0x147771[_0xfa5a('0x26')],queues[_0x147771[_0xfa5a('0x3')]][_0xfa5a('0x7')]));writeDB(queues[_0x147771['uniqueid']]);}}else if(!_[_0xfa5a('0x15')](_0x147771['variable']['queueposition'])){if(!_['isNil'](queues[_0x147771[_0xfa5a('0x3')]])&&!queues[_0x147771[_0xfa5a('0x3')]]['queuecallerabandon']){queues[_0x147771['uniqueid']][_0xfa5a('0x17')]=![];queues[_0x147771[_0xfa5a('0x3')]][_0xfa5a('0x27')]=null;queues[_0x147771[_0xfa5a('0x3')]][_0xfa5a('0x18')]=!![];queues[_0x147771[_0xfa5a('0x3')]]['queuecallerexitAt']=utils['now']();queues[_0x147771[_0xfa5a('0x3')]]['queuecallerexitreason']=_0xfa5a('0x28');utils[_0xfa5a('0x1')](util[_0xfa5a('0x2')](_0xfa5a('0x29'),_0x147771[_0xfa5a('0x3')],queues[_0x147771[_0xfa5a('0x3')]]['name'],_0x147771['value'],queues[_0x147771['uniqueid']][_0xfa5a('0x7')]));}}}catch(_0x296f05){utils[_0xfa5a('0x1d')](util[_0xfa5a('0x2')](_0xfa5a('0x20'),_0x147771[_0xfa5a('0x3')]),_0x296f05);}};exports[_0xfa5a('0x17')]=function(_0x47260b){try{if(!_[_0xfa5a('0x15')](queues[_0x47260b[_0xfa5a('0x3')]])){utils[_0xfa5a('0xf')](util[_0xfa5a('0x2')]('[%s][queues][queuecallerabandon]',_0x47260b[_0xfa5a('0x3')]),_0x47260b);queues[_0x47260b[_0xfa5a('0x3')]][_0xfa5a('0x18')]=![];queues[_0x47260b[_0xfa5a('0x3')]][_0xfa5a('0x24')]=null;queues[_0x47260b[_0xfa5a('0x3')]][_0xfa5a('0x17')]=!![];queues[_0x47260b[_0xfa5a('0x3')]][_0xfa5a('0x27')]=utils[_0xfa5a('0x14')]();queues[_0x47260b[_0xfa5a('0x3')]][_0xfa5a('0x7')]=_0xfa5a('0x2a');utils['info'](util[_0xfa5a('0x2')](_0xfa5a('0x2b'),_0x47260b['uniqueid'],queues[_0x47260b[_0xfa5a('0x3')]][_0xfa5a('0x1b')],queues[_0x47260b[_0xfa5a('0x3')]]['queuecallerexitreason']));}}catch(_0x5ae769){utils[_0xfa5a('0x1d')](util[_0xfa5a('0x2')](_0xfa5a('0x2c'),_0x47260b[_0xfa5a('0x3')]),_0x5ae769);}};exports['queuecallerleave']=function(_0x768bbe){try{if(!_[_0xfa5a('0x15')](queues[_0x768bbe[_0xfa5a('0x3')]])){utils[_0xfa5a('0xf')](util[_0xfa5a('0x2')](_0xfa5a('0x2d'),_0x768bbe['uniqueid']),_0x768bbe);utils[_0xfa5a('0x1')](util[_0xfa5a('0x2')](_0xfa5a('0x2e'),_0x768bbe[_0xfa5a('0x3')],queues[_0x768bbe[_0xfa5a('0x3')]][_0xfa5a('0x1b')],_0x768bbe['connectedlinenum'],_0x768bbe[_0xfa5a('0x2f')]));queues[_0x768bbe[_0xfa5a('0x3')]]['queuecallerleave']=!![];queues[_0x768bbe[_0xfa5a('0x3')]][_0xfa5a('0x16')]=utils[_0xfa5a('0x14')]();queues[_0x768bbe[_0xfa5a('0x3')]][_0xfa5a('0x30')]=utils['diffTime'](queues[_0x768bbe[_0xfa5a('0x3')]][_0xfa5a('0x16')],queues[_0x768bbe[_0xfa5a('0x3')]][_0xfa5a('0x31')]);queues[_0x768bbe['uniqueid']]['position']=_0x768bbe[_0xfa5a('0x12')];queues[_0x768bbe[_0xfa5a('0x3')]][_0xfa5a('0x32')]=_0x768bbe['count'];queues[_0x768bbe[_0xfa5a('0x3')]][_0xfa5a('0x33')]=_0x768bbe[_0xfa5a('0x33')];queues[_0x768bbe[_0xfa5a('0x3')]]['connectedlinename']=_0x768bbe['connectedlinename'];}}catch(_0x54c676){utils['error'](util['format'](_0xfa5a('0x2d'),_0x768bbe[_0xfa5a('0x3')]),_0x54c676);}};exports[_0xfa5a('0x34')]=function(_0x4f7577){try{if(!_['isNil'](queues[_0x4f7577['uniqueid']])){utils[_0xfa5a('0xf')](util[_0xfa5a('0x2')](_0xfa5a('0x35'),_0x4f7577[_0xfa5a('0x3')]),_0x4f7577);utils[_0xfa5a('0x1')](util[_0xfa5a('0x2')](_0xfa5a('0x36'),_0x4f7577[_0xfa5a('0x3')],queues[_0x4f7577[_0xfa5a('0x3')]][_0xfa5a('0x1b')],_0x4f7577[_0xfa5a('0x37')],_0x4f7577['destaccountcode']));queues[_0x4f7577[_0xfa5a('0x3')]][_0xfa5a('0x17')]=![];queues[_0x4f7577[_0xfa5a('0x3')]]['queuecallerabandon']=![];queues[_0x4f7577[_0xfa5a('0x3')]][_0xfa5a('0x27')]=null;queues[_0x4f7577[_0xfa5a('0x3')]][_0xfa5a('0x18')]=![];queues[_0x4f7577['uniqueid']][_0xfa5a('0x7')]=null;queues[_0x4f7577[_0xfa5a('0x3')]][_0xfa5a('0x24')]=null;queues[_0x4f7577[_0xfa5a('0x3')]][_0xfa5a('0x38')]=!![];queues[_0x4f7577[_0xfa5a('0x3')]][_0xfa5a('0x39')]=_0x4f7577['destaccountcode'];queues[_0x4f7577['uniqueid']]['lastAssignedTo']=_0x4f7577[_0xfa5a('0x37')];}}catch(_0x219d62){utils['error'](util[_0xfa5a('0x2')](_0xfa5a('0x35'),_0x4f7577[_0xfa5a('0x3')]),_0x219d62);}};exports[_0xfa5a('0x3a')]=function(_0x51655a){try{if(!_[_0xfa5a('0x15')](queues[_0x51655a[_0xfa5a('0x3')]])){if(queues[_0x51655a[_0xfa5a('0x3')]][_0xfa5a('0x16')]){utils[_0xfa5a('0xf')](util[_0xfa5a('0x2')](_0xfa5a('0x3b'),_0x51655a[_0xfa5a('0x3')]),_0x51655a);queues[_0x51655a[_0xfa5a('0x3')]]['queuecallerabandon']=![];queues[_0x51655a[_0xfa5a('0x3')]][_0xfa5a('0x17')]=![];queues[_0x51655a['uniqueid']][_0xfa5a('0x27')]=null;queues[_0x51655a[_0xfa5a('0x3')]][_0xfa5a('0x18')]=![];queues[_0x51655a[_0xfa5a('0x3')]][_0xfa5a('0x24')]=null;queues[_0x51655a[_0xfa5a('0x3')]][_0xfa5a('0x38')]=!![];queues[_0x51655a[_0xfa5a('0x3')]][_0xfa5a('0x5')]=_0x51655a[_0xfa5a('0x37')];queues[_0x51655a[_0xfa5a('0x3')]][_0xfa5a('0x3c')]=!![];queues[_0x51655a[_0xfa5a('0x3')]][_0xfa5a('0x19')]=utils[_0xfa5a('0x14')]();if(_0x51655a['reason']==_0xfa5a('0x3d')){if(!queues[_0x51655a['uniqueid']][_0xfa5a('0x3d')]){queues[_0x51655a[_0xfa5a('0x3')]][_0xfa5a('0x7')]=_0xfa5a('0x3e');}}else{queues[_0x51655a[_0xfa5a('0x3')]][_0xfa5a('0x7')]=_0xfa5a('0x3f')+_0x51655a[_0xfa5a('0x40')]['toUpperCase']();}utils['info'](util[_0xfa5a('0x2')](_0xfa5a('0x41'),_0x51655a['uniqueid'],queues[_0x51655a[_0xfa5a('0x3')]][_0xfa5a('0x1b')],_0x51655a[_0xfa5a('0x37')],queues[_0x51655a['uniqueid']][_0xfa5a('0x7')]));writeDB(queues[_0x51655a[_0xfa5a('0x3')]]);}}}catch(_0x218388){utils[_0xfa5a('0x1d')](util[_0xfa5a('0x2')](_0xfa5a('0x3b'),_0x51655a[_0xfa5a('0x3')]),_0x218388);}};exports['blindtransfer']=function(_0x161fe2){try{if(!_[_0xfa5a('0x15')](queues[_0x161fe2[_0xfa5a('0x42')]])){utils['debug'](util[_0xfa5a('0x2')](_0xfa5a('0x43'),_0x161fe2[_0xfa5a('0x3')]),_0x161fe2);queues[_0x161fe2[_0xfa5a('0x42')]][_0xfa5a('0x3d')]=!![];queues[_0x161fe2[_0xfa5a('0x42')]]['transfertype']=_0xfa5a('0x44');queues[_0x161fe2[_0xfa5a('0x42')]][_0xfa5a('0x45')]=_0x161fe2[_0xfa5a('0x46')];queues[_0x161fe2[_0xfa5a('0x42')]][_0xfa5a('0x47')]=_0x161fe2[_0xfa5a('0x42')];queues[_0x161fe2[_0xfa5a('0x42')]][_0xfa5a('0x7')]='BLINDTRANSFER';utils[_0xfa5a('0x1')](util[_0xfa5a('0x2')](_0xfa5a('0x48'),_0x161fe2['uniqueid'],queues[_0x161fe2['transfereeuniqueid']][_0xfa5a('0x1b')],_0x161fe2[_0xfa5a('0x42')],_0x161fe2['extension']));}}catch(_0x2c3b7f){utils[_0xfa5a('0x1d')](util['format'](_0xfa5a('0x43'),_0x161fe2[_0xfa5a('0x3')]),_0x2c3b7f);}};exports[_0xfa5a('0x49')]=function(_0x57c2f7){try{utils[_0xfa5a('0xf')](util[_0xfa5a('0x2')](_0xfa5a('0x4a'),_0x57c2f7['origtransfereruniqueid']),_0x57c2f7);if(_0x57c2f7['origtransfereruniqueid']==_0x57c2f7[_0xfa5a('0x4b')]){if(!_['isNil'](queues[_0x57c2f7[_0xfa5a('0x4c')]])){utils[_0xfa5a('0x1')](util[_0xfa5a('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x57c2f7[_0xfa5a('0x4d')],queues[_0x57c2f7[_0xfa5a('0x4c')]][_0xfa5a('0x1b')],_0x57c2f7[_0xfa5a('0x4e')]));queues[_0x57c2f7['secondtransfererlinkedid']][_0xfa5a('0x3d')]=!![];queues[_0x57c2f7['secondtransfererlinkedid']][_0xfa5a('0x4f')]=_0xfa5a('0x50');queues[_0x57c2f7[_0xfa5a('0x4c')]][_0xfa5a('0x45')]=_0x57c2f7['origtransfererexten'];queues[_0x57c2f7[_0xfa5a('0x4c')]]['transferuniqueid']=_0x57c2f7[_0xfa5a('0x4d')];queues[_0x57c2f7['secondtransfererlinkedid']][_0xfa5a('0x7')]='ATTENDEDTRANSFER';}if(!_[_0xfa5a('0x15')](queues[_0x57c2f7['origtransfererlinkedid']])){if(_0x57c2f7['transfereelinkedid']&&queues[_0x57c2f7[_0xfa5a('0x51')]]){queues[_0x57c2f7['transfereelinkedid']][_0xfa5a('0x52')]=0x1;queues[_0x57c2f7[_0xfa5a('0x42')]]=_['clone'](queues[_0x57c2f7['transfereelinkedid']]);queues[_0x57c2f7[_0xfa5a('0x42')]][_0xfa5a('0xd')]=_0x57c2f7['transfertargetuniqueid'];queues[_0x57c2f7[_0xfa5a('0x42')]][_0xfa5a('0x52')]=0x2;queues[_0x57c2f7['transfereeuniqueid']][_0xfa5a('0x6')]=queues[_0x57c2f7[_0xfa5a('0x4c')]][_0xfa5a('0x6')];queues[_0x57c2f7['transfereeuniqueid']][_0xfa5a('0x53')]=queues[_0x57c2f7[_0xfa5a('0x4c')]]['calleridname'];queues[_0x57c2f7[_0xfa5a('0x42')]]['queuecallerjoinAt']=utils['now']();queues[_0x57c2f7[_0xfa5a('0x42')]]['queuecallerleaveAt']=utils[_0xfa5a('0x14')]();queues[_0x57c2f7[_0xfa5a('0x42')]]['holdtime']=0x0;queues[_0x57c2f7[_0xfa5a('0x42')]][_0xfa5a('0x54')]=0x0;utils[_0xfa5a('0x1')](util[_0xfa5a('0x2')](_0xfa5a('0x55'),_0x57c2f7['origtransfereruniqueid'],queues[_0x57c2f7[_0xfa5a('0x42')]]['name'],queues[_0x57c2f7[_0xfa5a('0x42')]]['calleridnum'],queues[_0x57c2f7[_0xfa5a('0x42')]][_0xfa5a('0x53')]));}else{utils[_0xfa5a('0x1')](util[_0xfa5a('0x2')](_0xfa5a('0x56'),_0x57c2f7[_0xfa5a('0x4d')],queues[_0x57c2f7['origtransfererlinkedid']]['name'],_0x57c2f7['secondtransfererlinkedid']));queues[_0x57c2f7['origtransfererlinkedid']][_0xfa5a('0xd')]=_0x57c2f7[_0xfa5a('0x4c')];}}}else if(_0x57c2f7[_0xfa5a('0x57')]==_0x57c2f7[_0xfa5a('0x4c')]){if(!_['isNil'](queues[_0x57c2f7[_0xfa5a('0x4b')]])){utils[_0xfa5a('0x1')](util[_0xfa5a('0x2')](_0xfa5a('0x58'),_0x57c2f7['origtransfereruniqueid'],queues[_0x57c2f7[_0xfa5a('0x4b')]][_0xfa5a('0x1b')],_0x57c2f7[_0xfa5a('0x57')],_0x57c2f7[_0xfa5a('0x59')]));queues[_0x57c2f7['origtransfererlinkedid']]['transfer']=!![];queues[_0x57c2f7[_0xfa5a('0x4b')]][_0xfa5a('0x4f')]=_0xfa5a('0x50');queues[_0x57c2f7[_0xfa5a('0x4b')]][_0xfa5a('0x45')]=_0x57c2f7['secondtransfererexten'];queues[_0x57c2f7[_0xfa5a('0x4b')]]['transferuniqueid']=_0x57c2f7[_0xfa5a('0x57')];queues[_0x57c2f7[_0xfa5a('0x4b')]][_0xfa5a('0x7')]='ATTENDEDTRANSFER';}if(!_[_0xfa5a('0x15')](queues[_0x57c2f7[_0xfa5a('0x4c')]])){if(_0x57c2f7['transfertargetlinkedid']&&queues[_0x57c2f7[_0xfa5a('0x5a')]]){queues[_0x57c2f7[_0xfa5a('0x5a')]]['queuecallerenterreason']=0x1;queues[_0x57c2f7[_0xfa5a('0x5b')]]=_[_0xfa5a('0x5c')](queues[_0x57c2f7['transfertargetlinkedid']]);queues[_0x57c2f7['transfertargetuniqueid']][_0xfa5a('0xd')]=_0x57c2f7[_0xfa5a('0x5b')];queues[_0x57c2f7[_0xfa5a('0x5b')]]['queuecallerenterreason']=0x2;queues[_0x57c2f7[_0xfa5a('0x5b')]][_0xfa5a('0x6')]=queues[_0x57c2f7['origtransfererlinkedid']][_0xfa5a('0x6')];queues[_0x57c2f7['transfertargetuniqueid']][_0xfa5a('0x53')]=queues[_0x57c2f7[_0xfa5a('0x4b')]][_0xfa5a('0x53')];queues[_0x57c2f7['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0xfa5a('0x14')]();queues[_0x57c2f7['transfertargetuniqueid']][_0xfa5a('0x16')]=utils[_0xfa5a('0x14')]();queues[_0x57c2f7[_0xfa5a('0x5b')]][_0xfa5a('0x30')]=0x0;queues[_0x57c2f7[_0xfa5a('0x5b')]][_0xfa5a('0x54')]=0x0;utils[_0xfa5a('0x1')](util[_0xfa5a('0x2')](_0xfa5a('0x5d'),_0x57c2f7['origtransfereruniqueid'],queues[_0x57c2f7[_0xfa5a('0x5b')]]['name'],queues[_0x57c2f7['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x57c2f7[_0xfa5a('0x5b')]]['calleridnum'],queues[_0x57c2f7[_0xfa5a('0x5b')]]['calleridname']));}else{utils[_0xfa5a('0x1')](util[_0xfa5a('0x2')](_0xfa5a('0x56'),_0x57c2f7[_0xfa5a('0x4d')],queues[_0x57c2f7[_0xfa5a('0x4c')]][_0xfa5a('0x1b')],_0x57c2f7[_0xfa5a('0x4b')]));queues[_0x57c2f7[_0xfa5a('0x4c')]][_0xfa5a('0xd')]=_0x57c2f7['origtransfererlinkedid'];}}}}catch(_0x40338d){utils[_0xfa5a('0x1d')](util[_0xfa5a('0x2')]('[%s][queues][attendedtransfer]',_0x57c2f7['origtransfereruniqueid']),_0x40338d);}};exports[_0xfa5a('0x5e')]=function(_0x255e3c){try{if(!_['isNil'](queues[_0x255e3c[_0xfa5a('0x3')]])){utils['debug'](util[_0xfa5a('0x2')](_0xfa5a('0x5f'),_0x255e3c[_0xfa5a('0x3')]),_0x255e3c);queues[_0x255e3c['uniqueid']]['musiconholdstartAt']=utils[_0xfa5a('0x14')]();utils['info'](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x255e3c[_0xfa5a('0x3')],queues[_0x255e3c[_0xfa5a('0x3')]][_0xfa5a('0x1b')],queues[_0x255e3c[_0xfa5a('0x3')]][_0xfa5a('0x60')]));}}catch(_0x23f02a){utils['error'](util['format']('[%s][queues][musiconholdstart]',_0x255e3c[_0xfa5a('0x3')]),_0x23f02a);}};exports[_0xfa5a('0x61')]=function(_0xd26141){try{if(!_[_0xfa5a('0x15')](queues[_0xd26141[_0xfa5a('0x3')]])){if(!_['isNil'](queues[_0xd26141[_0xfa5a('0x3')]][_0xfa5a('0x60')])){utils['debug'](util[_0xfa5a('0x2')]('[%s][queues][musiconholdstop]',_0xd26141[_0xfa5a('0x3')]),_0xd26141);queues[_0xd26141[_0xfa5a('0x3')]][_0xfa5a('0x54')]+=utils[_0xfa5a('0x62')](utils[_0xfa5a('0x14')](),queues[_0xd26141[_0xfa5a('0x3')]][_0xfa5a('0x60')]);utils['info'](util[_0xfa5a('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0xd26141['uniqueid'],queues[_0xd26141[_0xfa5a('0x3')]][_0xfa5a('0x1b')],queues[_0xd26141[_0xfa5a('0x3')]][_0xfa5a('0x54')]));delete queues[_0xd26141[_0xfa5a('0x3')]][_0xfa5a('0x60')];}}}catch(_0x47f267){utils[_0xfa5a('0x1d')](util[_0xfa5a('0x2')]('[%s][queues][musiconholdstop]',_0xd26141[_0xfa5a('0x3')]),_0x47f267);}}; \ No newline at end of file +var _0x0338=['[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','origtransfererlinkedid','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','format','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','request','CreateVoiceQueueReport','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','transfereduniqueid','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerexit','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','ATTENDED','origtransfererexten','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime'];(function(_0x535654,_0x53147d){var _0x400739=function(_0x236308){while(--_0x236308){_0x535654['push'](_0x535654['shift']());}};_0x400739(++_0x53147d);}(_0x0338,0x14b));var _0x8033=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x0338[_0x39e84d];return _0x1991bc;};'use strict';var _=require(_0x8033('0x0'));var util=require(_0x8033('0x1'));var utils=require(_0x8033('0x2'));var queues={};function writeDB(_0x643649){utils['info'](util[_0x8033('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x643649['uniqueid'],_0x643649[_0x8033('0x4')],_0x643649[_0x8033('0x5')],_0x643649[_0x8033('0x6')],_0x643649[_0x8033('0x7')],_0x643649['accountcode'],_0x643649[_0x8033('0x8')]));if(_0x643649[_0x8033('0x5')]){utils[_0x8033('0x9')](_0x643649[_0x8033('0x5')])[_0x8033('0xa')](function(_0x49c5ba){if(_0x49c5ba){_0x643649['type']=_0x49c5ba['type'];}utils[_0x8033('0xb')](_0x8033('0xc'),_0x643649);});}else{utils['request'](_0x8033('0xc'),_0x643649);}if(_0x643649['transfereduniqueid']){delete queues[_0x643649['transfereduniqueid']];}else{delete queues[_0x643649[_0x8033('0xd')]];}}exports[_0x8033('0xe')]=function(_0xb3f19d){try{utils[_0x8033('0xf')](util[_0x8033('0x3')](_0x8033('0x10'),_0xb3f19d[_0x8033('0xd')]),_0xb3f19d);utils[_0x8033('0x11')](util[_0x8033('0x3')](_0x8033('0x12'),_0xb3f19d['uniqueid'],_0xb3f19d[_0x8033('0x5')],_0xb3f19d[_0x8033('0x13')]));queues[_0xb3f19d['uniqueid']]=_[_0x8033('0x14')](_0xb3f19d,{'originalposition':_0xb3f19d[_0x8033('0x13')],'queuecallerjoinAt':utils[_0x8033('0x15')](),'mohtime':0x0});}catch(_0x271bd8){utils['error'](util[_0x8033('0x3')](_0x8033('0x10'),_0xb3f19d['uniqueid']),_0x271bd8);}};exports[_0x8033('0x16')]=function(_0x337a09){try{if(!_[_0x8033('0x17')](queues[_0x337a09[_0x8033('0xd')]])){utils[_0x8033('0xf')](util[_0x8033('0x3')](_0x8033('0x18'),_0x337a09[_0x8033('0xd')]),_0x337a09);if(queues[_0x337a09[_0x8033('0xd')]][_0x8033('0x19')]){if(!queues[_0x337a09['uniqueid']][_0x8033('0x1a')]&&!queues[_0x337a09[_0x8033('0xd')]]['queuecallerexit']){queues[_0x337a09['uniqueid']]['queuecallercomplete']=!![];queues[_0x337a09[_0x8033('0xd')]][_0x8033('0x1b')]=utils[_0x8033('0x15')]();queues[_0x337a09[_0x8033('0xd')]][_0x8033('0x8')]=_0x8033('0x1c');}utils[_0x8033('0x11')](util[_0x8033('0x3')](_0x8033('0x1d'),_0x337a09[_0x8033('0xd')],queues[_0x337a09[_0x8033('0xd')]][_0x8033('0x1e')],queues[_0x337a09[_0x8033('0xd')]]['queuecallerexitreason']));writeDB(queues[_0x337a09[_0x8033('0xd')]]);}else if(queues[_0x337a09[_0x8033('0xd')]][_0x8033('0x1f')]){utils[_0x8033('0x11')](util[_0x8033('0x3')](_0x8033('0x20'),_0x337a09['uniqueid'],queues[_0x337a09['uniqueid']][_0x8033('0x1e')],queues[_0x337a09[_0x8033('0xd')]]['transfereduniqueid']));queues[queues[_0x337a09['uniqueid']][_0x8033('0x1f')]]=queues[_0x337a09['uniqueid']];queues[queues[_0x337a09[_0x8033('0xd')]][_0x8033('0x1f')]][_0x8033('0x21')]=0x2;delete queues[_0x337a09[_0x8033('0xd')]];}}}catch(_0x42235d){utils[_0x8033('0x22')](util[_0x8033('0x3')](_0x8033('0x18'),_0x337a09[_0x8033('0xd')]),_0x42235d);}};exports['varset']=function(_0x4e11e5){try{utils[_0x8033('0xf')](util[_0x8033('0x3')](_0x8033('0x23'),_0x4e11e5[_0x8033('0xd')]),_0x4e11e5);if(!_[_0x8033('0x17')](_0x4e11e5[_0x8033('0x24')][_0x8033('0x25')])&&_0x4e11e5[_0x8033('0x26')][_0x8033('0x27')]()!==_0x8033('0x28')){if(!_[_0x8033('0x17')](queues[_0x4e11e5['uniqueid']])){queues[_0x4e11e5[_0x8033('0xd')]][_0x8033('0x1a')]=![];queues[_0x4e11e5[_0x8033('0xd')]][_0x8033('0x29')]=null;queues[_0x4e11e5['uniqueid']]['queuecallerexit']=!![];queues[_0x4e11e5['uniqueid']][_0x8033('0x2a')]=utils[_0x8033('0x15')]();queues[_0x4e11e5[_0x8033('0xd')]][_0x8033('0x8')]=_0x4e11e5['value'][_0x8033('0x27')]();utils[_0x8033('0x11')](util[_0x8033('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x4e11e5['uniqueid'],queues[_0x4e11e5['uniqueid']][_0x8033('0x1e')],_0x4e11e5[_0x8033('0x26')],queues[_0x4e11e5[_0x8033('0xd')]]['queuecallerexitreason']));writeDB(queues[_0x4e11e5[_0x8033('0xd')]]);}}else if(!_['isNil'](_0x4e11e5[_0x8033('0x24')][_0x8033('0x2b')])){if(!_[_0x8033('0x17')](queues[_0x4e11e5[_0x8033('0xd')]])&&!queues[_0x4e11e5[_0x8033('0xd')]]['queuecallerabandon']){queues[_0x4e11e5[_0x8033('0xd')]][_0x8033('0x1a')]=![];queues[_0x4e11e5[_0x8033('0xd')]][_0x8033('0x29')]=null;queues[_0x4e11e5[_0x8033('0xd')]]['queuecallerexit']=!![];queues[_0x4e11e5[_0x8033('0xd')]][_0x8033('0x2a')]=utils[_0x8033('0x15')]();queues[_0x4e11e5['uniqueid']][_0x8033('0x8')]=_0x8033('0x2c');utils[_0x8033('0x11')](util[_0x8033('0x3')](_0x8033('0x2d'),_0x4e11e5[_0x8033('0xd')],queues[_0x4e11e5['uniqueid']][_0x8033('0x1e')],_0x4e11e5[_0x8033('0x26')],queues[_0x4e11e5[_0x8033('0xd')]]['queuecallerexitreason']));}}}catch(_0xc00205){utils[_0x8033('0x22')](util[_0x8033('0x3')](_0x8033('0x23'),_0x4e11e5[_0x8033('0xd')]),_0xc00205);}};exports[_0x8033('0x1a')]=function(_0x177771){try{if(!_[_0x8033('0x17')](queues[_0x177771['uniqueid']])){utils['debug'](util[_0x8033('0x3')](_0x8033('0x2e'),_0x177771[_0x8033('0xd')]),_0x177771);queues[_0x177771[_0x8033('0xd')]][_0x8033('0x2f')]=![];queues[_0x177771[_0x8033('0xd')]][_0x8033('0x2a')]=null;queues[_0x177771['uniqueid']]['queuecallerabandon']=!![];queues[_0x177771[_0x8033('0xd')]]['queuecallerabandonAt']=utils[_0x8033('0x15')]();queues[_0x177771['uniqueid']][_0x8033('0x8')]=_0x8033('0x30');utils[_0x8033('0x11')](util[_0x8033('0x3')](_0x8033('0x31'),_0x177771[_0x8033('0xd')],queues[_0x177771['uniqueid']][_0x8033('0x1e')],queues[_0x177771[_0x8033('0xd')]][_0x8033('0x8')]));}}catch(_0x502693){utils[_0x8033('0x22')](util['format'](_0x8033('0x2e'),_0x177771[_0x8033('0xd')]),_0x502693);}};exports['queuecallerleave']=function(_0x358fea){try{if(!_['isNil'](queues[_0x358fea[_0x8033('0xd')]])){utils[_0x8033('0xf')](util[_0x8033('0x3')](_0x8033('0x32'),_0x358fea['uniqueid']),_0x358fea);utils[_0x8033('0x11')](util[_0x8033('0x3')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x358fea[_0x8033('0xd')],queues[_0x358fea[_0x8033('0xd')]]['name'],_0x358fea[_0x8033('0x33')],_0x358fea[_0x8033('0x34')]));queues[_0x358fea[_0x8033('0xd')]][_0x8033('0x35')]=!![];queues[_0x358fea['uniqueid']][_0x8033('0x19')]=utils['now']();queues[_0x358fea[_0x8033('0xd')]][_0x8033('0x36')]=utils[_0x8033('0x37')](queues[_0x358fea[_0x8033('0xd')]][_0x8033('0x19')],queues[_0x358fea[_0x8033('0xd')]][_0x8033('0x38')]);queues[_0x358fea[_0x8033('0xd')]]['position']=_0x358fea[_0x8033('0x13')];queues[_0x358fea['uniqueid']][_0x8033('0x39')]=_0x358fea['count'];queues[_0x358fea['uniqueid']][_0x8033('0x33')]=_0x358fea[_0x8033('0x33')];queues[_0x358fea[_0x8033('0xd')]][_0x8033('0x34')]=_0x358fea[_0x8033('0x34')];}}catch(_0x31e588){utils[_0x8033('0x22')](util[_0x8033('0x3')](_0x8033('0x32'),_0x358fea[_0x8033('0xd')]),_0x31e588);}};exports['agentconnect']=function(_0x34b991){try{if(!_['isNil'](queues[_0x34b991[_0x8033('0xd')]])){utils[_0x8033('0xf')](util[_0x8033('0x3')](_0x8033('0x3a'),_0x34b991[_0x8033('0xd')]),_0x34b991);utils[_0x8033('0x11')](util[_0x8033('0x3')](_0x8033('0x3b'),_0x34b991['uniqueid'],queues[_0x34b991[_0x8033('0xd')]][_0x8033('0x1e')],_0x34b991[_0x8033('0x3c')],_0x34b991[_0x8033('0x3d')]));queues[_0x34b991[_0x8033('0xd')]]['queuecallerabandon']=![];queues[_0x34b991[_0x8033('0xd')]]['queuecallerabandon']=![];queues[_0x34b991[_0x8033('0xd')]]['queuecallerabandonAt']=null;queues[_0x34b991['uniqueid']]['queuecallerexit']=![];queues[_0x34b991[_0x8033('0xd')]][_0x8033('0x8')]=null;queues[_0x34b991[_0x8033('0xd')]][_0x8033('0x2a')]=null;queues[_0x34b991[_0x8033('0xd')]][_0x8033('0x3e')]=!![];queues[_0x34b991['uniqueid']][_0x8033('0x3f')]=_0x34b991[_0x8033('0x3d')];queues[_0x34b991['uniqueid']][_0x8033('0x6')]=_0x34b991[_0x8033('0x3c')];}}catch(_0x27425c){utils[_0x8033('0x22')](util[_0x8033('0x3')](_0x8033('0x3a'),_0x34b991[_0x8033('0xd')]),_0x27425c);}};exports['agentcomplete']=function(_0xbfe7bb){try{if(!_[_0x8033('0x17')](queues[_0xbfe7bb[_0x8033('0xd')]])){if(queues[_0xbfe7bb[_0x8033('0xd')]][_0x8033('0x19')]){utils[_0x8033('0xf')](util[_0x8033('0x3')](_0x8033('0x40'),_0xbfe7bb[_0x8033('0xd')]),_0xbfe7bb);queues[_0xbfe7bb[_0x8033('0xd')]][_0x8033('0x1a')]=![];queues[_0xbfe7bb[_0x8033('0xd')]][_0x8033('0x1a')]=![];queues[_0xbfe7bb[_0x8033('0xd')]][_0x8033('0x29')]=null;queues[_0xbfe7bb['uniqueid']][_0x8033('0x2f')]=![];queues[_0xbfe7bb[_0x8033('0xd')]]['queuecallerexitAt']=null;queues[_0xbfe7bb[_0x8033('0xd')]][_0x8033('0x3e')]=!![];queues[_0xbfe7bb[_0x8033('0xd')]][_0x8033('0x6')]=_0xbfe7bb[_0x8033('0x3c')];queues[_0xbfe7bb[_0x8033('0xd')]][_0x8033('0x41')]=!![];queues[_0xbfe7bb[_0x8033('0xd')]][_0x8033('0x1b')]=utils[_0x8033('0x15')]();if(_0xbfe7bb[_0x8033('0x42')]==_0x8033('0x43')){if(!queues[_0xbfe7bb['uniqueid']][_0x8033('0x43')]){queues[_0xbfe7bb[_0x8033('0xd')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0xbfe7bb['uniqueid']][_0x8033('0x8')]=_0x8033('0x44')+_0xbfe7bb[_0x8033('0x42')][_0x8033('0x27')]();}utils[_0x8033('0x11')](util[_0x8033('0x3')](_0x8033('0x45'),_0xbfe7bb[_0x8033('0xd')],queues[_0xbfe7bb[_0x8033('0xd')]][_0x8033('0x1e')],_0xbfe7bb[_0x8033('0x3c')],queues[_0xbfe7bb[_0x8033('0xd')]][_0x8033('0x8')]));writeDB(queues[_0xbfe7bb[_0x8033('0xd')]]);}}}catch(_0x302b8a){utils[_0x8033('0x22')](util['format'](_0x8033('0x40'),_0xbfe7bb[_0x8033('0xd')]),_0x302b8a);}};exports[_0x8033('0x46')]=function(_0x17284b){try{if(!_['isNil'](queues[_0x17284b[_0x8033('0x47')]])){utils[_0x8033('0xf')](util['format']('[%s][queues][blindtransfer]',_0x17284b[_0x8033('0xd')]),_0x17284b);queues[_0x17284b[_0x8033('0x47')]][_0x8033('0x43')]=!![];queues[_0x17284b['transfereeuniqueid']][_0x8033('0x48')]='BLIND';queues[_0x17284b['transfereeuniqueid']][_0x8033('0x49')]=_0x17284b[_0x8033('0x4a')];queues[_0x17284b[_0x8033('0x47')]][_0x8033('0x4b')]=_0x17284b[_0x8033('0x47')];queues[_0x17284b[_0x8033('0x47')]]['queuecallerexitreason']=_0x8033('0x4c');utils[_0x8033('0x11')](util[_0x8033('0x3')](_0x8033('0x4d'),_0x17284b[_0x8033('0xd')],queues[_0x17284b['transfereeuniqueid']][_0x8033('0x1e')],_0x17284b['transfereeuniqueid'],_0x17284b[_0x8033('0x4a')]));}}catch(_0x51604d){utils[_0x8033('0x22')](util[_0x8033('0x3')](_0x8033('0x4e'),_0x17284b[_0x8033('0xd')]),_0x51604d);}};exports['attendedtransfer']=function(_0x39767d){try{utils['debug'](util[_0x8033('0x3')](_0x8033('0x4f'),_0x39767d[_0x8033('0x50')]),_0x39767d);if(_0x39767d[_0x8033('0x50')]==_0x39767d['origtransfererlinkedid']){if(!_['isNil'](queues[_0x39767d[_0x8033('0x51')]])){utils[_0x8033('0x11')](util[_0x8033('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x39767d[_0x8033('0x50')],queues[_0x39767d['secondtransfererlinkedid']][_0x8033('0x1e')],_0x39767d['origtransfererexten']));queues[_0x39767d[_0x8033('0x51')]][_0x8033('0x43')]=!![];queues[_0x39767d['secondtransfererlinkedid']][_0x8033('0x48')]=_0x8033('0x52');queues[_0x39767d[_0x8033('0x51')]][_0x8033('0x49')]=_0x39767d[_0x8033('0x53')];queues[_0x39767d['secondtransfererlinkedid']][_0x8033('0x4b')]=_0x39767d[_0x8033('0x50')];queues[_0x39767d['secondtransfererlinkedid']][_0x8033('0x8')]='ATTENDEDTRANSFER';}if(!_[_0x8033('0x17')](queues[_0x39767d['origtransfererlinkedid']])){if(_0x39767d['transfereelinkedid']&&queues[_0x39767d[_0x8033('0x54')]]){queues[_0x39767d[_0x8033('0x54')]][_0x8033('0x21')]=0x1;queues[_0x39767d[_0x8033('0x47')]]=_[_0x8033('0x55')](queues[_0x39767d[_0x8033('0x54')]]);queues[_0x39767d['transfereeuniqueid']][_0x8033('0x1f')]=_0x39767d[_0x8033('0x56')];queues[_0x39767d[_0x8033('0x47')]][_0x8033('0x21')]=0x2;queues[_0x39767d[_0x8033('0x47')]]['calleridnum']=queues[_0x39767d[_0x8033('0x51')]]['calleridnum'];queues[_0x39767d[_0x8033('0x47')]][_0x8033('0x57')]=queues[_0x39767d[_0x8033('0x51')]][_0x8033('0x57')];queues[_0x39767d['transfereeuniqueid']][_0x8033('0x38')]=utils[_0x8033('0x15')]();queues[_0x39767d[_0x8033('0x47')]][_0x8033('0x19')]=utils[_0x8033('0x15')]();queues[_0x39767d[_0x8033('0x47')]]['holdtime']=0x0;queues[_0x39767d[_0x8033('0x47')]][_0x8033('0x58')]=0x0;utils[_0x8033('0x11')](util['format'](_0x8033('0x59'),_0x39767d[_0x8033('0x50')],queues[_0x39767d[_0x8033('0x47')]][_0x8033('0x1e')],queues[_0x39767d[_0x8033('0x47')]][_0x8033('0x7')],queues[_0x39767d[_0x8033('0x47')]][_0x8033('0x57')]));}else{utils[_0x8033('0x11')](util[_0x8033('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x39767d[_0x8033('0x50')],queues[_0x39767d[_0x8033('0x5a')]][_0x8033('0x1e')],_0x39767d['secondtransfererlinkedid']));queues[_0x39767d[_0x8033('0x5a')]][_0x8033('0x1f')]=_0x39767d[_0x8033('0x51')];}}}else if(_0x39767d[_0x8033('0x5b')]==_0x39767d[_0x8033('0x51')]){if(!_[_0x8033('0x17')](queues[_0x39767d['origtransfererlinkedid']])){utils[_0x8033('0x11')](util[_0x8033('0x3')](_0x8033('0x5c'),_0x39767d['origtransfereruniqueid'],queues[_0x39767d[_0x8033('0x5a')]][_0x8033('0x1e')],_0x39767d[_0x8033('0x5b')],_0x39767d[_0x8033('0x5d')]));queues[_0x39767d[_0x8033('0x5a')]][_0x8033('0x43')]=!![];queues[_0x39767d[_0x8033('0x5a')]][_0x8033('0x48')]='ATTENDED';queues[_0x39767d[_0x8033('0x5a')]][_0x8033('0x49')]=_0x39767d[_0x8033('0x5d')];queues[_0x39767d['origtransfererlinkedid']]['transferuniqueid']=_0x39767d[_0x8033('0x5b')];queues[_0x39767d[_0x8033('0x5a')]][_0x8033('0x8')]=_0x8033('0x5e');}if(!_['isNil'](queues[_0x39767d['secondtransfererlinkedid']])){if(_0x39767d[_0x8033('0x5f')]&&queues[_0x39767d[_0x8033('0x5f')]]){queues[_0x39767d[_0x8033('0x5f')]][_0x8033('0x21')]=0x1;queues[_0x39767d[_0x8033('0x56')]]=_[_0x8033('0x55')](queues[_0x39767d[_0x8033('0x5f')]]);queues[_0x39767d[_0x8033('0x56')]]['transfereduniqueid']=_0x39767d[_0x8033('0x56')];queues[_0x39767d[_0x8033('0x56')]]['queuecallerenterreason']=0x2;queues[_0x39767d['transfertargetuniqueid']][_0x8033('0x7')]=queues[_0x39767d[_0x8033('0x5a')]][_0x8033('0x7')];queues[_0x39767d['transfertargetuniqueid']][_0x8033('0x57')]=queues[_0x39767d[_0x8033('0x5a')]][_0x8033('0x57')];queues[_0x39767d['transfertargetuniqueid']][_0x8033('0x38')]=utils['now']();queues[_0x39767d[_0x8033('0x56')]]['queuecallerleaveAt']=utils['now']();queues[_0x39767d[_0x8033('0x56')]]['holdtime']=0x0;queues[_0x39767d['transfertargetuniqueid']][_0x8033('0x58')]=0x0;utils[_0x8033('0x11')](util[_0x8033('0x3')](_0x8033('0x60'),_0x39767d[_0x8033('0x50')],queues[_0x39767d[_0x8033('0x56')]]['name'],queues[_0x39767d[_0x8033('0x56')]][_0x8033('0x1f')],queues[_0x39767d[_0x8033('0x56')]][_0x8033('0x7')],queues[_0x39767d['transfertargetuniqueid']][_0x8033('0x57')]));}else{utils[_0x8033('0x11')](util['format'](_0x8033('0x61'),_0x39767d[_0x8033('0x50')],queues[_0x39767d[_0x8033('0x51')]][_0x8033('0x1e')],_0x39767d[_0x8033('0x5a')]));queues[_0x39767d[_0x8033('0x51')]]['transfereduniqueid']=_0x39767d[_0x8033('0x5a')];}}}}catch(_0x18a090){utils[_0x8033('0x22')](util[_0x8033('0x3')](_0x8033('0x4f'),_0x39767d[_0x8033('0x50')]),_0x18a090);}};exports[_0x8033('0x62')]=function(_0xde7f0e){try{if(!_['isNil'](queues[_0xde7f0e[_0x8033('0xd')]])){utils[_0x8033('0xf')](util[_0x8033('0x3')](_0x8033('0x63'),_0xde7f0e[_0x8033('0xd')]),_0xde7f0e);queues[_0xde7f0e['uniqueid']][_0x8033('0x64')]=utils[_0x8033('0x15')]();utils[_0x8033('0x11')](util['format'](_0x8033('0x65'),_0xde7f0e[_0x8033('0xd')],queues[_0xde7f0e[_0x8033('0xd')]][_0x8033('0x1e')],queues[_0xde7f0e['uniqueid']][_0x8033('0x64')]));}}catch(_0x32e2ab){utils['error'](util['format']('[%s][queues][musiconholdstart]',_0xde7f0e[_0x8033('0xd')]),_0x32e2ab);}};exports[_0x8033('0x66')]=function(_0x4c385d){try{if(!_[_0x8033('0x17')](queues[_0x4c385d[_0x8033('0xd')]])){if(!_['isNil'](queues[_0x4c385d[_0x8033('0xd')]]['musiconholdstartAt'])){utils[_0x8033('0xf')](util[_0x8033('0x3')](_0x8033('0x67'),_0x4c385d[_0x8033('0xd')]),_0x4c385d);queues[_0x4c385d[_0x8033('0xd')]][_0x8033('0x58')]+=utils[_0x8033('0x37')](utils[_0x8033('0x15')](),queues[_0x4c385d[_0x8033('0xd')]][_0x8033('0x64')]);utils[_0x8033('0x11')](util[_0x8033('0x3')](_0x8033('0x68'),_0x4c385d[_0x8033('0xd')],queues[_0x4c385d[_0x8033('0xd')]][_0x8033('0x1e')],queues[_0x4c385d[_0x8033('0xd')]][_0x8033('0x58')]));delete queues[_0x4c385d['uniqueid']][_0x8033('0x64')];}}}catch(_0x4dc1d2){utils[_0x8033('0x22')](util['format']('[%s][queues][musiconholdstop]',_0x4c385d[_0x8033('0xd')]),_0x4dc1d2);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 863126a..c5123f0 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 _0xf3df=['forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','getUserByInternal','accountcode','name','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','debug','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf3df,0x1ee));var _0xff3d=function(_0x3aff64,_0x55b017){_0x3aff64=_0x3aff64-0x0;var _0x1343d9=_0xf3df[_0x3aff64];return _0x1343d9;};'use strict';var _=require(_0xff3d('0x0'));var util=require(_0xff3d('0x1'));var utils=require(_0xff3d('0x2'));var recordings={};function writeDB(_0x2a511f){utils[_0xff3d('0x3')](util[_0xff3d('0x4')](_0xff3d('0x5'),_0x2a511f[_0xff3d('0x6')]));if(_0x2a511f['accountcode']){utils[_0xff3d('0x7')](_0x2a511f[_0xff3d('0x8')])['then'](function(_0x3dd3e5){if(_0x3dd3e5){_0x2a511f['membername']=_0x3dd3e5[_0xff3d('0x9')];_0x2a511f[_0xff3d('0xa')]=_0x3dd3e5['id'];}utils['request']('CreateVoiceRecording',_0x2a511f);});}else{utils[_0xff3d('0xb')](_0xff3d('0xc'),_0x2a511f);}}exports[_0xff3d('0xd')]=function(_0x2b09e9){try{utils['debug'](util[_0xff3d('0x4')](_0xff3d('0xe'),_0x2b09e9[_0xff3d('0x6')]),_0x2b09e9);if(_0x2b09e9[_0xff3d('0x6')]==_0x2b09e9[_0xff3d('0xf')]){utils[_0xff3d('0x3')](util[_0xff3d('0x4')](_0xff3d('0x10'),_0x2b09e9[_0xff3d('0x6')],_0x2b09e9[_0xff3d('0x11')],_0x2b09e9[_0xff3d('0x12')]));recordings[_0x2b09e9[_0xff3d('0x6')]]={'uniqueid':_0x2b09e9[_0xff3d('0x6')],'accountcode':_0x2b09e9[_0xff3d('0x8')],'exten':_0x2b09e9[_0xff3d('0x12')],'context':_0x2b09e9['context'],'channel':_0x2b09e9['channel'],'monitors':[]};}}catch(_0x7da90a){utils['error'](util['format']('[%s][recordings][newchannel]',_0x2b09e9[_0xff3d('0x6')]),_0x7da90a);}};exports['newstate']=function(_0x549296){try{utils[_0xff3d('0x13')](util[_0xff3d('0x4')](_0xff3d('0x14'),_0x549296[_0xff3d('0x6')]),_0x549296);if(!_[_0xff3d('0x15')](recordings[_0x549296[_0xff3d('0x6')]])&&_0x549296['channelstate']==0x6){utils[_0xff3d('0x3')](util[_0xff3d('0x4')](_0xff3d('0x16'),_0x549296[_0xff3d('0x6')],_0x549296[_0xff3d('0x11')],_0x549296[_0xff3d('0x17')]));}else if(!_[_0xff3d('0x15')](recordings[_0x549296[_0xff3d('0xf')]])&&_0x549296['channelstate']==0x6&&_0x549296[_0xff3d('0x11')]!=_0xff3d('0x18')){utils[_0xff3d('0x3')](util['format'](_0xff3d('0x19'),_0x549296['uniqueid'],_0x549296['linkedid'],_0x549296[_0xff3d('0x11')],_0x549296[_0xff3d('0x17')]));recordings[_0x549296[_0xff3d('0xf')]][_0xff3d('0x8')]=_0x549296['accountcode'];}}catch(_0x2a2117){utils[_0xff3d('0x1a')](util['format'](_0xff3d('0x14'),_0x549296['uniqueid']),_0x2a2117);}};exports[_0xff3d('0x1b')]=function(_0x23e182){try{if(!_['isNil'](_0x23e182[_0xff3d('0x1c')])&&!_[_0xff3d('0x15')](_0x23e182[_0xff3d('0x1c')]['mixmonitor_filename'])){utils[_0xff3d('0x13')](util[_0xff3d('0x4')]('[%s][recordings][varset]',_0x23e182['uniqueid']),_0x23e182);utils[_0xff3d('0x3')](util[_0xff3d('0x4')](_0xff3d('0x1d'),_0x23e182[_0xff3d('0x6')],_0x23e182[_0xff3d('0x1c')],_0x23e182['value']));if(_['endsWith'](_0x23e182[_0xff3d('0x1e')],_0xff3d('0x1f'))){_0x23e182['value']=_0x23e182[_0xff3d('0x1e')][_0xff3d('0x20')](_0xff3d('0x1f'),'.WAV');}if(recordings[_0x23e182[_0xff3d('0xf')]]){var _0x41f233=_[_0xff3d('0x21')](recordings[_0x23e182[_0xff3d('0xf')]][_0xff3d('0x22')],{'value':_0x23e182[_0xff3d('0x1e')]});if(_['isNil'](_0x41f233)){recordings[_0x23e182[_0xff3d('0xf')]][_0xff3d('0x22')][_0xff3d('0x23')]({'value':_0x23e182['value']});}}}}catch(_0x41ff26){utils[_0xff3d('0x1a')](util[_0xff3d('0x4')]('[%s][recordings][varset]',_0x23e182[_0xff3d('0x6')]),_0x41ff26);}};exports[_0xff3d('0x24')]=function(_0x46afd2){try{if(!_[_0xff3d('0x15')](recordings[_0x46afd2[_0xff3d('0x6')]])){utils[_0xff3d('0x13')](util['format'](_0xff3d('0x25'),_0x46afd2['uniqueid']),_0x46afd2);utils['info'](util['format'](_0xff3d('0x26'),_0x46afd2['uniqueid'],_0x46afd2['calleridnum'],_0x46afd2[_0xff3d('0x27')],_0x46afd2[_0xff3d('0x28')]));recordings[_0x46afd2[_0xff3d('0x6')]][_0xff3d('0x29')]=_0x46afd2[_0xff3d('0x29')];recordings[_0x46afd2[_0xff3d('0x6')]]['calleridname']=_0x46afd2[_0xff3d('0x27')];recordings[_0x46afd2['uniqueid']][_0xff3d('0x2a')]=_0x46afd2[_0xff3d('0x2a')];recordings[_0x46afd2[_0xff3d('0x6')]][_0xff3d('0x2b')]=_0x46afd2['connectedlinename'];if(recordings[_0x46afd2['uniqueid']][_0xff3d('0x2c')]==_0xff3d('0x2d')&&recordings[_0x46afd2[_0xff3d('0x6')]][_0xff3d('0x8')]){recordings[_0x46afd2[_0xff3d('0x6')]][_0xff3d('0x2a')]=recordings[_0x46afd2[_0xff3d('0x6')]][_0xff3d('0x8')];recordings[_0x46afd2[_0xff3d('0x6')]][_0xff3d('0x2b')]='';}recordings[_0x46afd2[_0xff3d('0x6')]][_0xff3d('0x22')][_0xff3d('0x2e')](function(_0x190b9){var _0x1b9f10=_[_0xff3d('0x2f')](recordings[_0x46afd2['uniqueid']]);_0x1b9f10['value']=_0x190b9[_0xff3d('0x1e')];writeDB(_0x1b9f10);});delete recordings[_0x46afd2[_0xff3d('0x6')]];}}catch(_0x1a7525){utils[_0xff3d('0x1a')](util['format'](_0xff3d('0x25'),_0x46afd2[_0xff3d('0x6')]),_0x1a7525);}};exports['newexten']=function(_0x447d1c){try{if(!_[_0xff3d('0x15')](recordings[_0x447d1c['uniqueid']])){utils[_0xff3d('0x13')](util[_0xff3d('0x4')](_0xff3d('0x30'),_0x447d1c[_0xff3d('0x6')]),_0x447d1c);utils['info'](util[_0xff3d('0x4')](_0xff3d('0x31'),_0x447d1c[_0xff3d('0x6')],_0x447d1c[_0xff3d('0x32')],_0x447d1c[_0xff3d('0x33')]));if(_0x447d1c[_0xff3d('0x32')]['toLowerCase']()==_0xff3d('0x34')&&_['startsWith'](_0x447d1c[_0xff3d('0x33')]['toLowerCase'](),_0xff3d('0x35'))){var _0x3f1194=_0x447d1c[_0xff3d('0x33')]['split']('=');var _0x2b5f86=_0x3f1194[0x0][_0xff3d('0x36')](_0x3f1194[0x0][_0xff3d('0x37')]('(')+0x1,_0x3f1194[0x0]['lastIndexOf'](')'));var _0x28a88e=_0x3f1194[0x1];recordings[_0x447d1c['uniqueid']][_0x2b5f86]=_0x28a88e;}}}catch(_0x401d28){utils[_0xff3d('0x1a')](util[_0xff3d('0x4')](_0xff3d('0x30'),_0x447d1c['uniqueid']),_0x401d28);}};exports[_0xff3d('0x38')]=function(_0x1bb820){try{if(!_[_0xff3d('0x15')](recordings[_0x1bb820[_0xff3d('0x6')]])){utils[_0xff3d('0x13')](util[_0xff3d('0x4')](_0xff3d('0x39'),_0x1bb820[_0xff3d('0x6')]),_0x1bb820);utils['info'](util[_0xff3d('0x4')](_0xff3d('0x3a'),_0x1bb820[_0xff3d('0x6')],_0x1bb820[_0xff3d('0x3b')]));recordings[_0x1bb820[_0xff3d('0x6')]]['queue']=_0x1bb820[_0xff3d('0x3b')];}}catch(_0x2d7f2f){utils[_0xff3d('0x1a')](util[_0xff3d('0x4')](_0xff3d('0x39'),_0x1bb820[_0xff3d('0x6')]),_0x2d7f2f);}}; \ No newline at end of file +var _0x4b04=['exten','channel','error','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','newexten','[%s][recordings][newexten]','application','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x4b04,0x14f));var _0x44b0=function(_0x12c66e,_0xea7b4){_0x12c66e=_0x12c66e-0x0;var _0x19481a=_0x4b04[_0x12c66e];return _0x19481a;};'use strict';var _=require(_0x44b0('0x0'));var util=require('util');var utils=require(_0x44b0('0x1'));var recordings={};function writeDB(_0x32d688){utils[_0x44b0('0x2')](util[_0x44b0('0x3')](_0x44b0('0x4'),_0x32d688[_0x44b0('0x5')]));if(_0x32d688[_0x44b0('0x6')]){utils[_0x44b0('0x7')](_0x32d688['accountcode'])[_0x44b0('0x8')](function(_0x11574d){if(_0x11574d){_0x32d688[_0x44b0('0x9')]=_0x11574d[_0x44b0('0xa')];_0x32d688['UserId']=_0x11574d['id'];}utils[_0x44b0('0xb')](_0x44b0('0xc'),_0x32d688);});}else{utils[_0x44b0('0xb')]('CreateVoiceRecording',_0x32d688);}}exports[_0x44b0('0xd')]=function(_0x3287dd){try{utils[_0x44b0('0xe')](util['format'](_0x44b0('0xf'),_0x3287dd[_0x44b0('0x5')]),_0x3287dd);if(_0x3287dd[_0x44b0('0x5')]==_0x3287dd[_0x44b0('0x10')]){utils[_0x44b0('0x2')](util['format'](_0x44b0('0x11'),_0x3287dd[_0x44b0('0x5')],_0x3287dd[_0x44b0('0x12')],_0x3287dd[_0x44b0('0x13')]));recordings[_0x3287dd[_0x44b0('0x5')]]={'uniqueid':_0x3287dd[_0x44b0('0x5')],'accountcode':_0x3287dd[_0x44b0('0x6')],'exten':_0x3287dd[_0x44b0('0x13')],'context':_0x3287dd['context'],'channel':_0x3287dd[_0x44b0('0x14')],'monitors':[]};}}catch(_0x4060ce){utils[_0x44b0('0x15')](util[_0x44b0('0x3')](_0x44b0('0xf'),_0x3287dd['uniqueid']),_0x4060ce);}};exports[_0x44b0('0x16')]=function(_0x33240b){try{utils[_0x44b0('0xe')](util[_0x44b0('0x3')]('[%s][recordings][newstate]',_0x33240b[_0x44b0('0x5')]),_0x33240b);if(!_[_0x44b0('0x17')](recordings[_0x33240b['uniqueid']])&&_0x33240b[_0x44b0('0x18')]==0x6){utils['info'](util[_0x44b0('0x3')](_0x44b0('0x19'),_0x33240b[_0x44b0('0x5')],_0x33240b[_0x44b0('0x12')],_0x33240b[_0x44b0('0x14')]));}else if(!_[_0x44b0('0x17')](recordings[_0x33240b[_0x44b0('0x10')]])&&_0x33240b[_0x44b0('0x18')]==0x6&&_0x33240b['context']!='transfer'){utils['info'](util[_0x44b0('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x33240b['uniqueid'],_0x33240b[_0x44b0('0x10')],_0x33240b[_0x44b0('0x12')],_0x33240b[_0x44b0('0x14')]));recordings[_0x33240b['linkedid']][_0x44b0('0x6')]=_0x33240b[_0x44b0('0x6')];}}catch(_0x5a558a){utils[_0x44b0('0x15')](util[_0x44b0('0x3')](_0x44b0('0x1a'),_0x33240b[_0x44b0('0x5')]),_0x5a558a);}};exports[_0x44b0('0x1b')]=function(_0xe35cc6){try{if(!_[_0x44b0('0x17')](_0xe35cc6[_0x44b0('0x1c')])&&!_[_0x44b0('0x17')](_0xe35cc6[_0x44b0('0x1c')]['mixmonitor_filename'])){utils['debug'](util[_0x44b0('0x3')](_0x44b0('0x1d'),_0xe35cc6['uniqueid']),_0xe35cc6);utils[_0x44b0('0x2')](util[_0x44b0('0x3')](_0x44b0('0x1e'),_0xe35cc6[_0x44b0('0x5')],_0xe35cc6[_0x44b0('0x1c')],_0xe35cc6[_0x44b0('0x1f')]));if(_[_0x44b0('0x20')](_0xe35cc6[_0x44b0('0x1f')],_0x44b0('0x21'))){_0xe35cc6['value']=_0xe35cc6['value'][_0x44b0('0x22')](_0x44b0('0x21'),'.WAV');}if(recordings[_0xe35cc6[_0x44b0('0x10')]]){var _0x571376=_['find'](recordings[_0xe35cc6[_0x44b0('0x10')]][_0x44b0('0x23')],{'value':_0xe35cc6[_0x44b0('0x1f')]});if(_[_0x44b0('0x17')](_0x571376)){recordings[_0xe35cc6[_0x44b0('0x10')]]['monitors'][_0x44b0('0x24')]({'value':_0xe35cc6[_0x44b0('0x1f')]});}}}}catch(_0x4f1487){utils['error'](util[_0x44b0('0x3')](_0x44b0('0x1d'),_0xe35cc6['uniqueid']),_0x4f1487);}};exports[_0x44b0('0x25')]=function(_0x481e24){try{if(!_[_0x44b0('0x17')](recordings[_0x481e24['uniqueid']])){utils[_0x44b0('0xe')](util[_0x44b0('0x3')]('[%s][recordings][hangup]',_0x481e24[_0x44b0('0x5')]),_0x481e24);utils[_0x44b0('0x2')](util[_0x44b0('0x3')](_0x44b0('0x26'),_0x481e24['uniqueid'],_0x481e24[_0x44b0('0x27')],_0x481e24[_0x44b0('0x28')],_0x481e24[_0x44b0('0x29')]));recordings[_0x481e24[_0x44b0('0x5')]][_0x44b0('0x27')]=_0x481e24[_0x44b0('0x27')];recordings[_0x481e24['uniqueid']][_0x44b0('0x28')]=_0x481e24[_0x44b0('0x28')];recordings[_0x481e24[_0x44b0('0x5')]]['connectedlinenum']=_0x481e24[_0x44b0('0x2a')];recordings[_0x481e24[_0x44b0('0x5')]][_0x44b0('0x2b')]=_0x481e24[_0x44b0('0x2b')];if(recordings[_0x481e24['uniqueid']]['type']==_0x44b0('0x2c')&&recordings[_0x481e24[_0x44b0('0x5')]][_0x44b0('0x6')]){recordings[_0x481e24[_0x44b0('0x5')]][_0x44b0('0x2a')]=recordings[_0x481e24[_0x44b0('0x5')]]['accountcode'];recordings[_0x481e24[_0x44b0('0x5')]]['connectedlinename']='';}recordings[_0x481e24[_0x44b0('0x5')]]['monitors']['forEach'](function(_0x41daa9){var _0xe1724e=_['clone'](recordings[_0x481e24[_0x44b0('0x5')]]);_0xe1724e[_0x44b0('0x1f')]=_0x41daa9['value'];writeDB(_0xe1724e);});delete recordings[_0x481e24[_0x44b0('0x5')]];}}catch(_0x35326c){utils[_0x44b0('0x15')](util['format']('[%s][recordings][hangup]',_0x481e24[_0x44b0('0x5')]),_0x35326c);}};exports[_0x44b0('0x2d')]=function(_0x801f40){try{if(!_['isNil'](recordings[_0x801f40[_0x44b0('0x5')]])){utils[_0x44b0('0xe')](util[_0x44b0('0x3')](_0x44b0('0x2e'),_0x801f40[_0x44b0('0x5')]),_0x801f40);utils[_0x44b0('0x2')](util[_0x44b0('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x801f40[_0x44b0('0x5')],_0x801f40[_0x44b0('0x2f')],_0x801f40['appdata']));if(_0x801f40[_0x44b0('0x2f')][_0x44b0('0x30')]()==_0x44b0('0x31')&&_[_0x44b0('0x32')](_0x801f40['appdata'][_0x44b0('0x30')](),'cdr')){var _0x728fd4=_0x801f40[_0x44b0('0x33')][_0x44b0('0x34')]('=');var _0x41a02b=_0x728fd4[0x0][_0x44b0('0x35')](_0x728fd4[0x0][_0x44b0('0x36')]('(')+0x1,_0x728fd4[0x0][_0x44b0('0x36')](')'));var _0x58e047=_0x728fd4[0x1];recordings[_0x801f40[_0x44b0('0x5')]][_0x41a02b]=_0x58e047;}}}catch(_0x1aacfb){utils[_0x44b0('0x15')](util['format'](_0x44b0('0x2e'),_0x801f40['uniqueid']),_0x1aacfb);}};exports[_0x44b0('0x37')]=function(_0x134efb){try{if(!_['isNil'](recordings[_0x134efb['uniqueid']])){utils[_0x44b0('0xe')](util[_0x44b0('0x3')](_0x44b0('0x38'),_0x134efb[_0x44b0('0x5')]),_0x134efb);utils['info'](util[_0x44b0('0x3')](_0x44b0('0x39'),_0x134efb['uniqueid'],_0x134efb[_0x44b0('0x3a')]));recordings[_0x134efb[_0x44b0('0x5')]][_0x44b0('0x3a')]=_0x134efb['queue'];}}catch(_0x3ff81b){utils['error'](util[_0x44b0('0x3')](_0x44b0('0x38'),_0x134efb['uniqueid']),_0x3ff81b);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 2a43ffc..f514c84 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 _0xed73=['blind','error','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','assign','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','format','[%s][transfers][writeDB]\x20type:%s','uniqueid','type','request','CreateVoiceTransferReport','blindtransfer','debug','info','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname'];(function(_0xd17bf8,_0xf93eb){var _0x51db95=function(_0x33678c){while(--_0x33678c){_0xd17bf8['push'](_0xd17bf8['shift']());}};_0x51db95(++_0xf93eb);}(_0xed73,0x132));var _0x3ed7=function(_0x3f060c,_0x449d2f){_0x3f060c=_0x3f060c-0x0;var _0x4695f9=_0xed73[_0x3f060c];return _0x4695f9;};'use strict';var _=require(_0x3ed7('0x0'));var util=require('util');var utils=require('./utils');function writeDB(_0x4013d8){utils['info'](util[_0x3ed7('0x1')](_0x3ed7('0x2'),_0x4013d8['type']==='attended'?_0x4013d8['origtransfereruniqueid']:_0x4013d8[_0x3ed7('0x3')],_0x4013d8[_0x3ed7('0x4')]));utils[_0x3ed7('0x5')](_0x3ed7('0x6'),_0x4013d8);}exports[_0x3ed7('0x7')]=function(_0xb78a14){try{utils[_0x3ed7('0x8')](util['format']('[%s][transfers][blindtransfer]',_0xb78a14[_0x3ed7('0x3')]),_0xb78a14);utils[_0x3ed7('0x9')](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0xb78a14['uniqueid'],_0xb78a14[_0x3ed7('0xa')],_0xb78a14[_0x3ed7('0xb')],_0xb78a14[_0x3ed7('0xc')],_0xb78a14[_0x3ed7('0xd')]));_0xb78a14[_0x3ed7('0x4')]=_0x3ed7('0xe');writeDB(_0xb78a14);}catch(_0x1959ee){utils[_0x3ed7('0xf')](util[_0x3ed7('0x1')](_0x3ed7('0x10'),_0xb78a14[_0x3ed7('0x3')]),_0x1959ee);}};exports[_0x3ed7('0x11')]=function(_0x1b93c3){try{utils[_0x3ed7('0x8')](util['format'](_0x3ed7('0x12'),_0x1b93c3[_0x3ed7('0x13')]),_0x1b93c3);utils['info'](util['format'](_0x3ed7('0x14'),_0x1b93c3[_0x3ed7('0x13')],_0x1b93c3[_0x3ed7('0x15')],_0x1b93c3['origtransferercalleridname'],_0x1b93c3[_0x3ed7('0x16')],_0x1b93c3['transfertargetcalleridname']));_0x1b93c3=_[_0x3ed7('0x17')](_0x1b93c3,{'transfererchannel':_0x1b93c3['origtransfererchannel'],'transferercalleridnum':_0x1b93c3[_0x3ed7('0x15')],'transferercalleridname':_0x1b93c3[_0x3ed7('0x18')],'transfererconnectedlinenum':_0x1b93c3[_0x3ed7('0x19')],'transfererconnectedlinename':_0x1b93c3[_0x3ed7('0x1a')],'transfereraccountcode':_0x1b93c3[_0x3ed7('0x1b')],'transferercontext':_0x1b93c3['secondtransferercontext'],'transfererexten':_0x1b93c3[_0x3ed7('0x1c')],'transfererlinkedid':_0x1b93c3[_0x3ed7('0x1d')],'context':_0x1b93c3[_0x3ed7('0x1e')],'extension':_0x1b93c3[_0x3ed7('0x1f')],'type':_0x3ed7('0x20')});if(_[_0x3ed7('0x21')](_0x1b93c3['transfereechannel'])){_0x1b93c3=_[_0x3ed7('0x17')](_0x1b93c3,{'transfereechannel':_0x1b93c3[_0x3ed7('0x22')],'transfereecalleridnum':_0x1b93c3[_0x3ed7('0x16')],'transfereecalleridname':_0x1b93c3[_0x3ed7('0x23')],'transfereeconnectedlinenum':_0x1b93c3['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x1b93c3[_0x3ed7('0x24')],'transfereeaccountcode':_0x1b93c3['transfertargetaccountcode'],'transfereecontext':_0x1b93c3[_0x3ed7('0x25')],'transfereeexten':_0x1b93c3[_0x3ed7('0x26')],'transfereelinkedid':_0x1b93c3[_0x3ed7('0x27')]});}writeDB(_0x1b93c3);}catch(_0x663639){utils[_0x3ed7('0xf')](util[_0x3ed7('0x1')](_0x3ed7('0x12'),_0x1b93c3['origtransfereruniqueid']),_0x663639);}}; \ No newline at end of file +var _0xc49b=['transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','lodash','./utils','info','format','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','error','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum'];(function(_0x16e931,_0x1fdf36){var _0x4e07eb=function(_0x2cfeb8){while(--_0x2cfeb8){_0x16e931['push'](_0x16e931['shift']());}};_0x4e07eb(++_0x1fdf36);}(_0xc49b,0x114));var _0xbc49=function(_0x4f90c4,_0x3bc9d4){_0x4f90c4=_0x4f90c4-0x0;var _0x44c184=_0xc49b[_0x4f90c4];return _0x44c184;};'use strict';var _=require(_0xbc49('0x0'));var util=require('util');var utils=require(_0xbc49('0x1'));function writeDB(_0x27d296){utils[_0xbc49('0x2')](util[_0xbc49('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x27d296[_0xbc49('0x4')]===_0xbc49('0x5')?_0x27d296[_0xbc49('0x6')]:_0x27d296[_0xbc49('0x7')],_0x27d296['type']));utils[_0xbc49('0x8')](_0xbc49('0x9'),_0x27d296);}exports[_0xbc49('0xa')]=function(_0x22f86c){try{utils[_0xbc49('0xb')](util[_0xbc49('0x3')]('[%s][transfers][blindtransfer]',_0x22f86c['uniqueid']),_0x22f86c);utils[_0xbc49('0x2')](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x22f86c[_0xbc49('0x7')],_0x22f86c[_0xbc49('0xc')],_0x22f86c[_0xbc49('0xd')],_0x22f86c[_0xbc49('0xe')],_0x22f86c['transfereecalleridname']));_0x22f86c[_0xbc49('0x4')]=_0xbc49('0xf');writeDB(_0x22f86c);}catch(_0x493beb){utils[_0xbc49('0x10')](util[_0xbc49('0x3')]('[%s][transfers][blindtransfer]',_0x22f86c[_0xbc49('0x7')]),_0x493beb);}};exports['attendedtransfer']=function(_0x1f8c68){try{utils[_0xbc49('0xb')](util[_0xbc49('0x3')]('[%s][transfers][attendedtransfer]',_0x1f8c68[_0xbc49('0x6')]),_0x1f8c68);utils[_0xbc49('0x2')](util[_0xbc49('0x3')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x1f8c68[_0xbc49('0x6')],_0x1f8c68[_0xbc49('0x11')],_0x1f8c68[_0xbc49('0x12')],_0x1f8c68[_0xbc49('0x13')],_0x1f8c68[_0xbc49('0x14')]));_0x1f8c68=_[_0xbc49('0x15')](_0x1f8c68,{'transfererchannel':_0x1f8c68[_0xbc49('0x16')],'transferercalleridnum':_0x1f8c68[_0xbc49('0x11')],'transferercalleridname':_0x1f8c68[_0xbc49('0x12')],'transfererconnectedlinenum':_0x1f8c68[_0xbc49('0x17')],'transfererconnectedlinename':_0x1f8c68[_0xbc49('0x18')],'transfereraccountcode':_0x1f8c68[_0xbc49('0x19')],'transferercontext':_0x1f8c68[_0xbc49('0x1a')],'transfererexten':_0x1f8c68[_0xbc49('0x1b')],'transfererlinkedid':_0x1f8c68[_0xbc49('0x1c')],'context':_0x1f8c68[_0xbc49('0x1d')],'extension':_0x1f8c68['origtransfererexten'],'type':_0xbc49('0x5')});if(_[_0xbc49('0x1e')](_0x1f8c68[_0xbc49('0x1f')])){_0x1f8c68=_['assign'](_0x1f8c68,{'transfereechannel':_0x1f8c68[_0xbc49('0x20')],'transfereecalleridnum':_0x1f8c68[_0xbc49('0x13')],'transfereecalleridname':_0x1f8c68['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x1f8c68[_0xbc49('0x21')],'transfereeconnectedlinename':_0x1f8c68['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1f8c68[_0xbc49('0x22')],'transfereecontext':_0x1f8c68[_0xbc49('0x23')],'transfereeexten':_0x1f8c68['transfertargetexten'],'transfereelinkedid':_0x1f8c68[_0xbc49('0x24')]});}writeDB(_0x1f8c68);}catch(_0x5f60bc){utils['error'](util[_0xbc49('0x3')]('[%s][transfers][attendedtransfer]',_0x1f8c68[_0xbc49('0x6')]),_0x5f60bc);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index cd25e44..f01f0d9 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 _0x60b1=['interface','then','[utils][getUser]\x20where:%s','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diffTime','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','../../config/logger','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','GetUser','internal','name'];(function(_0x2c7598,_0x2d8ab0){var _0x4501b4=function(_0x18369f){while(--_0x18369f){_0x2c7598['push'](_0x2c7598['shift']());}};_0x4501b4(++_0x2d8ab0);}(_0x60b1,0x116));var _0x160b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x60b1[_0x1facfa];return _0x9ec701;};'use strict';var BPromise=require(_0x160b('0x0'));var jayson=require(_0x160b('0x1'));var moment=require(_0x160b('0x2'));var util=require('util');var client=jayson[_0x160b('0x3')]['http']({'port':0x2329});var logger=require(_0x160b('0x4'))(_0x160b('0x5'));exports['info']=function(_0x3f8e31,_0x242394){logger[_0x160b('0x6')](_0x3f8e31,_0x242394?util[_0x160b('0x7')](_0x242394,{'showHidden':![],'depth':null}):'');};exports[_0x160b('0x8')]=function(_0xbd88cc,_0x5af5e4){logger[_0x160b('0x8')](_0xbd88cc,_0x5af5e4?util['inspect'](_0x5af5e4,{'showHidden':![],'depth':null}):'');};exports[_0x160b('0x9')]=function(_0x5065f5,_0x1b0c98){logger[_0x160b('0x9')](_0x5065f5,_0x1b0c98?util[_0x160b('0x7')](_0x1b0c98,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x14646f,_0x5b06e7){return client[_0x160b('0xa')](_0x14646f,{'body':_0x5b06e7})['then'](function(_0x4b896a){logger[_0x160b('0x8')](_0x160b('0xb'),_0x14646f,_0x4b896a?util[_0x160b('0x7')](_0x4b896a,{'showHidden':![],'depth':null}):'');})[_0x160b('0xc')](function(_0x318935){logger[_0x160b('0x9')]('[utils][request]\x20name:%s',_0x14646f,_0x318935?util[_0x160b('0x7')](_0x318935,{'showHidden':![],'depth':null}):'');});};function getUser(_0x376863){return client[_0x160b('0xa')](_0x160b('0xd'),{'options':{'raw':!![],'attributes':['id',_0x160b('0xe'),_0x160b('0xf'),_0x160b('0x10')],'where':_0x376863,'limit':0x1}})[_0x160b('0x11')](function(_0x1264ae){logger[_0x160b('0x8')](_0x160b('0x12'),JSON['stringify'](_0x376863),_0x1264ae?util[_0x160b('0x7')](_0x1264ae,{'showHidden':![],'depth':null}):'');return _0x1264ae[_0x160b('0x13')][_0x160b('0x14')]?_0x1264ae[_0x160b('0x13')][0x0]:null;});}exports[_0x160b('0x15')]=function(_0x4fa270){return new BPromise(function(_0x54e580,_0x4b542c){if(_0x4fa270){return getUser({'internal':_0x4fa270})[_0x160b('0x11')](function(_0x564174){logger[_0x160b('0x6')](_0x160b('0x16'),_0x4fa270,_0x564174?_0x160b('0x17'):'notfound');return _0x54e580(_0x564174);})[_0x160b('0xc')](function(_0x36f992){logger[_0x160b('0x9')](_0x160b('0x18'),_0x36f992?util[_0x160b('0x7')](_0x36f992,{'showHidden':![],'depth':null}):'');return _0x54e580(null);});}return _0x54e580(null);});};exports[_0x160b('0x19')]=function(_0x1d601e){return new BPromise(function(_0xcaaca7,_0x3d410d){if(_0x1d601e){return getUser({'interface':_0x1d601e})['then'](function(_0x3e842d){logger[_0x160b('0x6')](_0x160b('0x1a'),_0x1d601e,_0x3e842d?_0x160b('0x17'):_0x160b('0x1b'));return _0xcaaca7(_0x3e842d);})[_0x160b('0xc')](function(_0x2c059){logger[_0x160b('0x9')]('[utils][getUserByInterface]',_0x2c059?util['inspect'](_0x2c059,{'showHidden':![],'depth':null}):'');return _0xcaaca7(null);});}return _0xcaaca7(null);});};exports[_0x160b('0x1c')]=function(_0x4d0a54){return new BPromise(function(_0x3a7e11,_0x13807f){if(_0x4d0a54){return getUser({'name':_0x4d0a54})[_0x160b('0x11')](function(_0x23ba0c){logger[_0x160b('0x6')](_0x160b('0x1d'),_0x4d0a54,_0x23ba0c?_0x160b('0x17'):_0x160b('0x1b'));return _0x3a7e11(_0x23ba0c);})[_0x160b('0xc')](function(_0x32d8b7){logger[_0x160b('0x9')]('[utils][getUserByName]',_0x32d8b7?util['inspect'](_0x32d8b7,{'showHidden':![],'depth':null}):'');return _0x3a7e11(null);});}return _0x3a7e11(null);});};exports[_0x160b('0x1e')]=function(_0x3938de){return new BPromise(function(_0x41f10a,_0x35a28b){if(_0x3938de){return client[_0x160b('0xa')](_0x160b('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x160b('0xf'),_0x160b('0x20'),_0x160b('0x21'),'acwTimeout'],'where':{'name':_0x3938de},'limit':0x1}})[_0x160b('0x11')](function(_0x17f0eb){logger[_0x160b('0x8')](_0x160b('0x22'),_0x3938de,_0x17f0eb?util['inspect'](_0x17f0eb,{'showHidden':![],'depth':null}):'');logger[_0x160b('0x6')](_0x160b('0x23'),_0x3938de,_0x17f0eb?_0x160b('0x17'):_0x160b('0x1b'));return _0x41f10a(_0x17f0eb[_0x160b('0x13')][_0x160b('0x14')]?_0x17f0eb[_0x160b('0x13')][0x0]:null);})['catch'](function(_0x37cd00){logger[_0x160b('0x9')](_0x160b('0x24'),_0x37cd00?util[_0x160b('0x7')](_0x37cd00,{'showHidden':![],'depth':null}):'');return _0x41f10a(null);});}return _0x41f10a(null);});};exports[_0x160b('0x25')]=function(_0x1ba857,_0x29ede8){return moment(_0x1ba857)[_0x160b('0x26')](_0x29ede8,'seconds')[_0x160b('0x27')](_0x160b('0x28'));};exports[_0x160b('0x29')]=function(_0x13444f,_0x138889){return moment(_0x13444f)[_0x160b('0x2a')](_0x138889,_0x160b('0x2b'))[_0x160b('0x27')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x160b('0x2c')]=function(_0x469c8a,_0x432271){return moment(_0x469c8a)['diff'](moment(_0x432271),'seconds');};exports[_0x160b('0x2d')]=function(_0x472b3b,_0x27e0a3){return parseInt(_0x472b3b,0xa)+parseInt(_0x27e0a3,0xa);};exports[_0x160b('0x2e')]=function(){return moment()['format'](_0x160b('0x28'));};exports[_0x160b('0x2f')]=function(_0x158deb,_0xdd0ddc){if(_0xdd0ddc){return moment(_0x158deb)[_0x160b('0x2f')](_0xdd0ddc);}return!![];};exports[_0x160b('0x30')]=function(_0x49bf0f,_0xee7435){if(_0xee7435){return moment(_0x49bf0f)['isBefore'](_0xee7435);}else if(_0x49bf0f){return!![];}return![];}; \ No newline at end of file +var _0x1b94=['format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','jayson/promise','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','internal','name','interface','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','type','acw','acwTimeout','addTime','seconds'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x1b94,0x169));var _0x41b9=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x1b94[_0x344a3f];return _0x264712;};'use strict';var BPromise=require(_0x41b9('0x0'));var jayson=require(_0x41b9('0x1'));var moment=require('moment');var util=require(_0x41b9('0x2'));var client=jayson[_0x41b9('0x3')][_0x41b9('0x4')]({'port':0x2329});var logger=require(_0x41b9('0x5'))(_0x41b9('0x6'));exports[_0x41b9('0x7')]=function(_0x20d891,_0x4b9d90){logger[_0x41b9('0x7')](_0x20d891,_0x4b9d90?util[_0x41b9('0x8')](_0x4b9d90,{'showHidden':![],'depth':null}):'');};exports[_0x41b9('0x9')]=function(_0x26e742,_0x4d5a46){logger[_0x41b9('0x9')](_0x26e742,_0x4d5a46?util[_0x41b9('0x8')](_0x4d5a46,{'showHidden':![],'depth':null}):'');};exports[_0x41b9('0xa')]=function(_0x3bfb4b,_0x5c5dee){logger[_0x41b9('0xa')](_0x3bfb4b,_0x5c5dee?util[_0x41b9('0x8')](_0x5c5dee,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x3d5354,_0x324671){return client[_0x41b9('0xb')](_0x3d5354,{'body':_0x324671})[_0x41b9('0xc')](function(_0x94094d){logger['debug'](_0x41b9('0xd'),_0x3d5354,_0x94094d?util['inspect'](_0x94094d,{'showHidden':![],'depth':null}):'');})[_0x41b9('0xe')](function(_0x506583){logger[_0x41b9('0xa')](_0x41b9('0xd'),_0x3d5354,_0x506583?util['inspect'](_0x506583,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2842fb){return client[_0x41b9('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x41b9('0xf'),_0x41b9('0x10'),_0x41b9('0x11')],'where':_0x2842fb,'limit':0x1}})['then'](function(_0x1e8088){logger[_0x41b9('0x9')]('[utils][getUser]\x20where:%s',JSON[_0x41b9('0x12')](_0x2842fb),_0x1e8088?util[_0x41b9('0x8')](_0x1e8088,{'showHidden':![],'depth':null}):'');return _0x1e8088['result'][_0x41b9('0x13')]?_0x1e8088[_0x41b9('0x14')][0x0]:null;});}exports[_0x41b9('0x15')]=function(_0x5675a7){return new BPromise(function(_0x1fba01,_0x151e7a){if(_0x5675a7){return getUser({'internal':_0x5675a7})[_0x41b9('0xc')](function(_0x568a32){logger[_0x41b9('0x7')](_0x41b9('0x16'),_0x5675a7,_0x568a32?_0x41b9('0x17'):_0x41b9('0x18'));return _0x1fba01(_0x568a32);})[_0x41b9('0xe')](function(_0x2e91dc){logger[_0x41b9('0xa')](_0x41b9('0x19'),_0x2e91dc?util[_0x41b9('0x8')](_0x2e91dc,{'showHidden':![],'depth':null}):'');return _0x1fba01(null);});}return _0x1fba01(null);});};exports[_0x41b9('0x1a')]=function(_0x4134cb){return new BPromise(function(_0x3b3082,_0x160199){if(_0x4134cb){return getUser({'interface':_0x4134cb})[_0x41b9('0xc')](function(_0xea5803){logger[_0x41b9('0x7')](_0x41b9('0x1b'),_0x4134cb,_0xea5803?_0x41b9('0x17'):'notfound');return _0x3b3082(_0xea5803);})[_0x41b9('0xe')](function(_0x341916){logger[_0x41b9('0xa')](_0x41b9('0x1c'),_0x341916?util[_0x41b9('0x8')](_0x341916,{'showHidden':![],'depth':null}):'');return _0x3b3082(null);});}return _0x3b3082(null);});};exports['getUserByName']=function(_0x2bbfa4){return new BPromise(function(_0x2c8deb,_0x2718c7){if(_0x2bbfa4){return getUser({'name':_0x2bbfa4})[_0x41b9('0xc')](function(_0x5f598e){logger[_0x41b9('0x7')](_0x41b9('0x1d'),_0x2bbfa4,_0x5f598e?_0x41b9('0x17'):'notfound');return _0x2c8deb(_0x5f598e);})[_0x41b9('0xe')](function(_0x1c98a6){logger['error']('[utils][getUserByName]',_0x1c98a6?util[_0x41b9('0x8')](_0x1c98a6,{'showHidden':![],'depth':null}):'');return _0x2c8deb(null);});}return _0x2c8deb(null);});};exports['getVoiceQueueByName']=function(_0x40c663){return new BPromise(function(_0x39b0e7,_0x3c8179){if(_0x40c663){return client[_0x41b9('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x41b9('0x10'),_0x41b9('0x1e'),_0x41b9('0x1f'),_0x41b9('0x20')],'where':{'name':_0x40c663},'limit':0x1}})['then'](function(_0x3db537){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x40c663,_0x3db537?util[_0x41b9('0x8')](_0x3db537,{'showHidden':![],'depth':null}):'');logger[_0x41b9('0x7')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x40c663,_0x3db537?_0x41b9('0x17'):_0x41b9('0x18'));return _0x39b0e7(_0x3db537['result'][_0x41b9('0x13')]?_0x3db537[_0x41b9('0x14')][0x0]:null);})['catch'](function(_0x5ea6f0){logger[_0x41b9('0xa')]('[utils][getVoiceQueueByName]',_0x5ea6f0?util[_0x41b9('0x8')](_0x5ea6f0,{'showHidden':![],'depth':null}):'');return _0x39b0e7(null);});}return _0x39b0e7(null);});};exports[_0x41b9('0x21')]=function(_0x13d873,_0xda8cb3){return moment(_0x13d873)['add'](_0xda8cb3,_0x41b9('0x22'))[_0x41b9('0x23')](_0x41b9('0x24'));};exports[_0x41b9('0x25')]=function(_0x29a9bb,_0x306c40){return moment(_0x29a9bb)[_0x41b9('0x26')](_0x306c40,'seconds')[_0x41b9('0x23')](_0x41b9('0x24'));};exports[_0x41b9('0x27')]=function(_0x3710a8,_0x54cd85){return moment(_0x3710a8)[_0x41b9('0x28')](moment(_0x54cd85),_0x41b9('0x22'));};exports['sumTime']=function(_0x257be3,_0x54253c){return parseInt(_0x257be3,0xa)+parseInt(_0x54253c,0xa);};exports[_0x41b9('0x29')]=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x41b9('0x2a')]=function(_0x1f247c,_0x500353){if(_0x500353){return moment(_0x1f247c)['isAfter'](_0x500353);}return!![];};exports[_0x41b9('0x2b')]=function(_0x5ad039,_0x5bf37e){if(_0x5bf37e){return moment(_0x5ad039)[_0x41b9('0x2b')](_0x5bf37e);}else if(_0x5ad039){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 653c35d..8fe4351 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x631c=['lodash','express-winston','path','./loggers','fileLogger','./safe-template','./mask-sensitive-data','log','join','client','ensureDir','then','catch','user','no-user','data','timestamp','error','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','\x20body=%s','body','format','method','headers','x-forwarded-for','remoteAddress','url','responseTime','role','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','statusCode','name','device','other','agent_id','agent_name','test','setupLoggers','fs-extra'];(function(_0x39cd3c,_0xa21102){var _0x47a0ae=function(_0x330b05){while(--_0x330b05){_0x39cd3c['push'](_0x39cd3c['shift']());}};_0x47a0ae(++_0xa21102);}(_0x631c,0xab));var _0xc631=function(_0x4fad5d,_0x1b4d0c){_0x4fad5d=_0x4fad5d-0x0;var _0x5bbdd7=_0x631c[_0x4fad5d];return _0x5bbdd7;};var fs=require(_0xc631('0x0'));var _=require(_0xc631('0x1'));var ewinston=require(_0xc631('0x2'));var path=require(_0xc631('0x3'));var util=require('util');var fileLogger=require(_0xc631('0x4'))[_0xc631('0x5')];var safeTemplate=require(_0xc631('0x6'))['safeTemplate'];var maskSensitiveData=require(_0xc631('0x7'))['maskSensitiveData'];function ClientSideLogger(){function _0x76c674(_0x68fa24){var _0x4cde14=path['join']('/var',_0xc631('0x8'),'xcally');var _0x27a993=path[_0xc631('0x9')](_0xc631('0xa'),_0x68fa24['role']+'-'+_0x68fa24['name']);return fs[_0xc631('0xb')](path['join'](_0x4cde14,_0x27a993))[_0xc631('0xc')](function(){var _0x4012a8=fileLogger('client',path[_0xc631('0x9')](_0x4cde14,_0x27a993));return _0x4012a8;})[_0xc631('0xd')](function(_0x5e4b2d){throw _0x5e4b2d;});}this[_0xc631('0x8')]=function(_0x53bd33,_0x4ec575,_0x267723,_0x4dd3d6){return _0x76c674(_0x53bd33[_0xc631('0xe')])['then'](function(_0xbec9ac){var _0xe7bca0=_0xbec9ac[_0x4ec575];return _0xe7bca0;})[_0xc631('0xc')](function(_0x3bae5d){var _0x734a23=_0x53bd33[_0xc631('0xe')]?_0x53bd33[_0xc631('0xe')]['id']:_0xc631('0xf');var _0x1b7721=_0x4dd3d6[_0xc631('0x10')];var _0x566fa2=_0x4dd3d6[_0xc631('0x11')];var _0x4ccae2=new Date(Number(_0x566fa2));return _0x3bae5d(_0x734a23,_0x4ccae2,_0x267723,_0x1b7721);})[_0xc631('0xd')](function(_0x3a4691){fileLogger('client')[_0xc631('0x12')](_0x3a4691);});};}function setupLoggers(_0x109e41){return new Promise(function(_0x32daf4){var _0x100dd6=new ClientSideLogger();var _0x5c74a3=fileLogger('api');var _0xb5c664=fileLogger('auth');_0x109e41['set'](_0xc631('0x13'),_0x100dd6);_0x109e41['use'](ewinston[_0xc631('0x14')]({'winstonInstance':_0x5c74a3,'meta':![],'statusLevels':!![],'msg':function(_0x6d3a2d,_0x598e12){var _0x5c7205=_0xc631('0x15');if(!_['isEmpty'](_0x6d3a2d['body'])){_0x5c7205+=_0xc631('0x16');var _0x333545=_0x6d3a2d[_0xc631('0x17')];maskSensitiveData(_0x333545);}return safeTemplate(util[_0xc631('0x18')](_0x5c7205,_0x6d3a2d[_0xc631('0x19')],_0x6d3a2d[_0xc631('0x1a')][_0xc631('0x1b')]?_0x6d3a2d['headers'][_0xc631('0x1b')]:_0x6d3a2d['connection'][_0xc631('0x1c')]||_0x6d3a2d['ip'],_0x6d3a2d[_0xc631('0x1d')],_0x598e12['statusCode'],_0x598e12[_0xc631('0x1e')],_0x6d3a2d['user']?_0x6d3a2d[_0xc631('0xe')]['id']:null,_0x6d3a2d[_0xc631('0xe')]?_0x6d3a2d[_0xc631('0xe')]['name']:null,_0x6d3a2d[_0xc631('0xe')]?_0x6d3a2d[_0xc631('0xe')][_0xc631('0x1f')]:null,_0x333545?util[_0xc631('0x20')](_0x333545,![],null):''));}}));_0x109e41[_0xc631('0x21')](ewinston[_0xc631('0x14')]({'winstonInstance':_0xb5c664,'meta':![],'statusLevels':!![],'msg':function(_0x607ede,_0x4d6beb){var _0x4b9606=_0xc631('0x22');if(_0x607ede['body']&&_0x607ede[_0xc631('0x17')]['device']&&_0x607ede[_0xc631('0x17')]['agent_id']){_0x4b9606='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xc631('0x18')](_0x4b9606,_0x607ede['method'],_0x607ede[_0xc631('0x1a')][_0xc631('0x1b')]?_0x607ede[_0xc631('0x1a')][_0xc631('0x1b')]:_0x607ede['connection'][_0xc631('0x1c')]||_0x607ede['ip'],_0x607ede[_0xc631('0x1d')],_0x4d6beb[_0xc631('0x23')],_0x4d6beb[_0xc631('0x1e')],_0x607ede[_0xc631('0xe')]?_0x607ede[_0xc631('0xe')]['id']:null,_0x607ede[_0xc631('0xe')]?_0x607ede[_0xc631('0xe')][_0xc631('0x24')]:null,_0x607ede[_0xc631('0xe')]?_0x607ede['user']['role']:null,_0x607ede['body']&&_0x607ede[_0xc631('0x17')][_0xc631('0x25')]?_0x607ede[_0xc631('0x17')][_0xc631('0x25')]:_0xc631('0x26'),_0x607ede[_0xc631('0x17')]&&_0x607ede[_0xc631('0x17')][_0xc631('0x27')]?_0x607ede[_0xc631('0x17')]['agent_id']:'',_0x607ede[_0xc631('0x17')]&&_0x607ede[_0xc631('0x17')][_0xc631('0x28')]?_0x607ede[_0xc631('0x17')][_0xc631('0x28')]:'');},'ignoreRoute':function(_0x24b400){var _0x3a46c8=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3a46c8[_0xc631('0x29')](_0x24b400[_0xc631('0x1d')]);}}));return _0x32daf4();});}exports[_0xc631('0x2a')]=setupLoggers; \ No newline at end of file +var _0xe718=['%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','remoteAddress','url','statusCode','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)','other','agent_name','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','join','/var','log','xcally','client','role','name','ensureDir','then','user','data','timestamp','api','auth','client-side-logger','use','logger'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe718,0x14d));var _0x8e71=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0xe718[_0x1a89a1];return _0x3d5b46;};var fs=require(_0x8e71('0x0'));var _=require(_0x8e71('0x1'));var ewinston=require(_0x8e71('0x2'));var path=require(_0x8e71('0x3'));var util=require(_0x8e71('0x4'));var fileLogger=require(_0x8e71('0x5'))[_0x8e71('0x6')];var safeTemplate=require(_0x8e71('0x7'))[_0x8e71('0x8')];var maskSensitiveData=require(_0x8e71('0x9'))['maskSensitiveData'];function ClientSideLogger(){function _0x240901(_0x1358e8){var _0x43e89a=path[_0x8e71('0xa')](_0x8e71('0xb'),_0x8e71('0xc'),_0x8e71('0xd'));var _0x3131c9=path[_0x8e71('0xa')](_0x8e71('0xe'),_0x1358e8[_0x8e71('0xf')]+'-'+_0x1358e8[_0x8e71('0x10')]);return fs[_0x8e71('0x11')](path['join'](_0x43e89a,_0x3131c9))[_0x8e71('0x12')](function(){var _0x4bc712=fileLogger(_0x8e71('0xe'),path['join'](_0x43e89a,_0x3131c9));return _0x4bc712;})['catch'](function(_0x515a19){throw _0x515a19;});}this['log']=function(_0xd8193,_0x1deded,_0x7348dc,_0x5d16e1){return _0x240901(_0xd8193['user'])[_0x8e71('0x12')](function(_0x15aedd){var _0x5ca48d=_0x15aedd[_0x1deded];return _0x5ca48d;})[_0x8e71('0x12')](function(_0x11a8df){var _0x5628a6=_0xd8193[_0x8e71('0x13')]?_0xd8193[_0x8e71('0x13')]['id']:'no-user';var _0x4043e9=_0x5d16e1[_0x8e71('0x14')];var _0x368978=_0x5d16e1[_0x8e71('0x15')];var _0x2b4e5c=new Date(Number(_0x368978));return _0x11a8df(_0x5628a6,_0x2b4e5c,_0x7348dc,_0x4043e9);})['catch'](function(_0x323788){fileLogger(_0x8e71('0xe'))['error'](_0x323788);});};}function setupLoggers(_0x166896){return new Promise(function(_0x2d8b61){var _0x18a774=new ClientSideLogger();var _0x153a2c=fileLogger(_0x8e71('0x16'));var _0x513838=fileLogger(_0x8e71('0x17'));_0x166896['set'](_0x8e71('0x18'),_0x18a774);_0x166896[_0x8e71('0x19')](ewinston[_0x8e71('0x1a')]({'winstonInstance':_0x153a2c,'meta':![],'statusLevels':!![],'msg':function(_0x319d9f,_0xe5a046){var _0x5c23d9=_0x8e71('0x1b');if(!_[_0x8e71('0x1c')](_0x319d9f[_0x8e71('0x1d')])){_0x5c23d9+='\x20body=%s';var _0x340c29=_0x319d9f['body'];maskSensitiveData(_0x340c29);}return safeTemplate(util[_0x8e71('0x1e')](_0x5c23d9,_0x319d9f[_0x8e71('0x1f')],_0x319d9f[_0x8e71('0x20')][_0x8e71('0x21')]?_0x319d9f[_0x8e71('0x20')][_0x8e71('0x21')]:_0x319d9f['connection'][_0x8e71('0x22')]||_0x319d9f['ip'],_0x319d9f[_0x8e71('0x23')],_0xe5a046[_0x8e71('0x24')],_0xe5a046['responseTime'],_0x319d9f['user']?_0x319d9f[_0x8e71('0x13')]['id']:null,_0x319d9f['user']?_0x319d9f[_0x8e71('0x13')]['name']:null,_0x319d9f[_0x8e71('0x13')]?_0x319d9f[_0x8e71('0x13')][_0x8e71('0xf')]:null,_0x340c29?util[_0x8e71('0x25')](_0x340c29,![],null):''));}}));_0x166896[_0x8e71('0x19')](ewinston[_0x8e71('0x1a')]({'winstonInstance':_0x513838,'meta':![],'statusLevels':!![],'msg':function(_0xe623cb,_0x24fa27){var _0x246cba=_0x8e71('0x26');if(_0xe623cb[_0x8e71('0x1d')]&&_0xe623cb[_0x8e71('0x1d')][_0x8e71('0x27')]&&_0xe623cb[_0x8e71('0x1d')][_0x8e71('0x28')]){_0x246cba=_0x8e71('0x29');}return util[_0x8e71('0x1e')](_0x246cba,_0xe623cb[_0x8e71('0x1f')],_0xe623cb[_0x8e71('0x20')][_0x8e71('0x21')]?_0xe623cb['headers'][_0x8e71('0x21')]:_0xe623cb['connection'][_0x8e71('0x22')]||_0xe623cb['ip'],_0xe623cb[_0x8e71('0x23')],_0x24fa27[_0x8e71('0x24')],_0x24fa27['responseTime'],_0xe623cb[_0x8e71('0x13')]?_0xe623cb[_0x8e71('0x13')]['id']:null,_0xe623cb[_0x8e71('0x13')]?_0xe623cb['user']['name']:null,_0xe623cb[_0x8e71('0x13')]?_0xe623cb[_0x8e71('0x13')][_0x8e71('0xf')]:null,_0xe623cb[_0x8e71('0x1d')]&&_0xe623cb[_0x8e71('0x1d')][_0x8e71('0x27')]?_0xe623cb[_0x8e71('0x1d')]['device']:_0x8e71('0x2a'),_0xe623cb[_0x8e71('0x1d')]&&_0xe623cb[_0x8e71('0x1d')][_0x8e71('0x28')]?_0xe623cb[_0x8e71('0x1d')][_0x8e71('0x28')]:'',_0xe623cb[_0x8e71('0x1d')]&&_0xe623cb[_0x8e71('0x1d')][_0x8e71('0x2b')]?_0xe623cb[_0x8e71('0x1d')][_0x8e71('0x2b')]:'');},'ignoreRoute':function(_0x78f5a5){var _0x26f600=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x26f600['test'](_0x78f5a5[_0x8e71('0x23')]);}}));return _0x2d8b61();});}exports[_0x8e71('0x2c')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index fbef8b7..9d21bc7 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb0a=['map','source','join','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','monthsShort','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','isBetween','timeCompare','format','ddd','includes','date','daysInMonth','max','domCompare','MMM','monthCompare','length','padStart','lodash','moment-timezone'];(function(_0x4db7a9,_0x58c9cf){var _0x506132=function(_0x2e389f){while(--_0x2e389f){_0x4db7a9['push'](_0x4db7a9['shift']());}};_0x506132(++_0x58c9cf);}(_0xeb0a,0xad));var _0xaeb0=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0xeb0a[_0x27bd2c];return _0x3784ea;};var _=require(_0xaeb0('0x0'));var moment=require(_0xaeb0('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xaeb0('0x2')](function(_0x2f9e61){return _0x2f9e61[_0xaeb0('0x3')];})[_0xaeb0('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x38b065){if(!_0x38b065[_0xaeb0('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x389b66){var _0x4b1713=_0x389b66[_0xaeb0('0x6')](':')[_0xaeb0('0x2')](function(_0x8fcf6c){return parseInt(_0x8fcf6c,0xa);});var _0x4d10c1=_0x4b1713[0x0];var _0x2c8c59=_0x4b1713[0x1];if(_0x4d10c1<0x0||_0x4d10c1>0x17||_0x2c8c59<0x0||_0x2c8c59>0x3b){throw new Error(EINVALID_DATE);}return[_0x4d10c1,_0x2c8c59];}function circularDoWInterval(_0x5c5cdb,_0x2deb34){if(_0x5c5cdb===_0x2deb34){return[_0x5c5cdb];}else{var _0x1c15a2=moment['locale']();moment[_0xaeb0('0x7')]('en');var _0x1423d1=moment[_0xaeb0('0x8')]()['map'](function(_0x5bf4e6){return _0x5bf4e6[_0xaeb0('0x9')]();});moment[_0xaeb0('0x7')](_0x1c15a2);var _0x8dae8b=_0x1423d1['indexOf'](_0x5c5cdb);var _0x4c9cbe=_0x1423d1[_0xaeb0('0xa')](_0x2deb34);if(_0x4c9cbe>_0x8dae8b){return _0x1423d1[_0xaeb0('0xb')](_0x8dae8b,_0x4c9cbe+0x1);}else{var _0x4c3ba1=_0x1423d1[_0xaeb0('0xb')](0x0,_0x4c9cbe+0x1);var _0x3c2954=_0x1423d1[_0xaeb0('0xb')](_0x8dae8b);return _0x3c2954[_0xaeb0('0xc')](_0x4c3ba1);}}}module[_0xaeb0('0xd')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0xeb574b,_0x82b97d){if(_0xeb574b===_0x82b97d){return[_0xeb574b];}else{var _0x5dc5a5=moment['locale']();moment[_0xaeb0('0x7')]('en');var _0x2cad52=moment[_0xaeb0('0xe')]()['map'](function(_0x2b84c9){return _0x2b84c9[_0xaeb0('0x9')]();});moment[_0xaeb0('0x7')](_0x5dc5a5);var _0x226386=_0x2cad52[_0xaeb0('0xa')](_0xeb574b);var _0xf297fa=_0x2cad52['indexOf'](_0x82b97d);if(_0xf297fa>_0x226386){return _0x2cad52[_0xaeb0('0xb')](_0x226386,_0xf297fa+0x1);}else{var _0x478501=_0x2cad52[_0xaeb0('0xb')](0x0,_0xf297fa+0x1);var _0x33d591=_0x2cad52[_0xaeb0('0xb')](_0x226386);return _0x33d591[_0xaeb0('0xc')](_0x478501);}}}module[_0xaeb0('0xd')][_0xaeb0('0xf')]=circularMonthInterval;function parseDom(_0x912400){var _0xd045e0=parseInt(_0x912400,0xa);if(_0xd045e0<0x1||_0xd045e0>0x1f){throw new Error(EINVALID_DATE);}return _0xd045e0;}function timeCompare(_0x314e85,_0x1e4643,_0x542605){var _0x1bc458=_0x314e85['clone']();var _0x401973=extractTime(_0x1e4643);var _0x27a38c=_0x401973[0x0];var _0x25c6f8=_0x401973[0x1];var _0xcb3d6f=_0x314e85[_0xaeb0('0x10')]()[_0xaeb0('0x11')](_0x27a38c)[_0xaeb0('0x12')](_0x25c6f8);throwIfDateNotValid(_0xcb3d6f);var _0xc7b00d=extractTime(_0x542605);var _0x29d6c2=_0xc7b00d[0x0];var _0x32309f=_0xc7b00d[0x1];var _0x40d3f7=_0x314e85[_0xaeb0('0x10')]()[_0xaeb0('0x11')](_0x29d6c2)[_0xaeb0('0x12')](_0x32309f);throwIfDateNotValid(_0x40d3f7);if(_0x40d3f7[_0xaeb0('0x13')](_0xcb3d6f)){var _0x198341=_0x1bc458[_0xaeb0('0x10')]()[_0xaeb0('0x14')](_0xaeb0('0x15'));var _0x258bd0=_0x1bc458['clone']()['endOf']('day');return _0x1bc458[_0xaeb0('0x16')](_0xcb3d6f,_0x258bd0,undefined,'[]')||_0x1bc458[_0xaeb0('0x16')](_0x198341,_0x40d3f7,undefined,'[]');}else{return _0x1bc458[_0xaeb0('0x16')](_0xcb3d6f,_0x40d3f7,undefined,'[]');}}module[_0xaeb0('0xd')][_0xaeb0('0x17')]=timeCompare;function dowCompare(_0x360ae5,_0x449c39,_0x3aabb2){var _0x20ba71=_0x360ae5[_0xaeb0('0x7')]('en')[_0xaeb0('0x18')](_0xaeb0('0x19'))[_0xaeb0('0x9')]();return circularDoWInterval(_0x449c39,_0x3aabb2)[_0xaeb0('0x1a')](_0x20ba71);}module['exports']['dowCompare']=dowCompare;function domCompare(_0x3fe080,_0x50d593,_0x1544d7){var _0x1046aa=_0x3fe080[_0xaeb0('0x1b')]();if(_0x50d593===_0x1544d7){return _0x1046aa===_0x50d593;}else{var _0x55aca3=_0x3fe080[_0xaeb0('0x1c')]();var _0x318a4b=_0x50d593<_0x1544d7;let _0x18f6e2=![];var _0x58c8c1=0x0;var _0x5ed809=0x0;if(_0x318a4b){_0x58c8c1=Math[_0xaeb0('0x1d')](0x1,_0x50d593);_0x5ed809=Math['min'](_0x1544d7,_0x55aca3);_0x18f6e2=_0x1046aa>=_0x58c8c1&&_0x1046aa<=_0x5ed809;}else{_0x58c8c1=Math['min'](_0x50d593,_0x55aca3);_0x5ed809=Math[_0xaeb0('0x1d')](0x1,_0x1544d7);_0x18f6e2=_0x1046aa>=_0x58c8c1||_0x1046aa<=_0x5ed809;}return _0x18f6e2;}}module[_0xaeb0('0xd')][_0xaeb0('0x1e')]=domCompare;function monthCompare(_0x17acbc,_0x313413,_0x4c73bd){var _0x55a6a1=_0x17acbc[_0xaeb0('0x7')]('en')[_0xaeb0('0x18')](_0xaeb0('0x1f'))['toLowerCase']();return circularMonthInterval(_0x313413,_0x4c73bd)[_0xaeb0('0x1a')](_0x55a6a1);}module[_0xaeb0('0xd')][_0xaeb0('0x20')]=monthCompare;function iftime(_0x5160c4,_0x4acf96=moment['tz']['guess'](),_0x2be230=moment()){if(!validateRx['test'](_0x5160c4)){throw new Error(EINVALID_STRING);}else{var _0x5dba01=(moment['isMoment'](_0x2be230)?_0x2be230[_0xaeb0('0x10')]():moment(_0x2be230))['tz'](_0x4acf96)[_0xaeb0('0x7')]('en');throwIfDateNotValid(_0x5dba01);var _0x59baa9=_0x5160c4[_0xaeb0('0x6')](',');var _0x2c174e=_0x59baa9[0x0];var _0x11a28c=_0x59baa9[0x1];var _0x3ab108=_0x59baa9[0x2];var _0x50f7f3=_0x59baa9[0x3];let _0x53bda7=!![];if(_0x2c174e!=='*'){var _0x2a47c8=_0x2c174e['split']('-');var _0x9acf17=_['padStart'](_0x2a47c8[0x0],0x5,'0');var _0x627c2=_0x2a47c8[_0xaeb0('0x21')]===0x2?_[_0xaeb0('0x22')](_0x2a47c8[0x1],0x5,'0'):_0x9acf17;_0x53bda7=timeCompare(_0x5dba01,_0x9acf17,_0x627c2);}let _0x4d16e2=!![];if(_0x11a28c!=='*'){var _0x17b729=_0x11a28c['split']('-');var _0x3b4015=_0x17b729[0x0];var _0x2cc965=_0x17b729[_0xaeb0('0x21')]===0x2?_0x17b729[0x1]:_0x3b4015;_0x4d16e2=dowCompare(_0x5dba01,_0x3b4015,_0x2cc965);}let _0x56fb45=!![];if(_0x3ab108!=='*'){var _0x5eb6c9=_0x3ab108[_0xaeb0('0x6')]('-');var _0x5c1f3e=parseDom(_0x5eb6c9[0x0]);var _0x5c6022=_0x5eb6c9['length']===0x2?parseDom(_0x5eb6c9[0x1]):_0x5c1f3e;_0x56fb45=domCompare(_0x5dba01,_0x5c1f3e,_0x5c6022);}let _0x1c3458=!![];if(_0x50f7f3!=='*'){var _0x21c8a2=_0x50f7f3[_0xaeb0('0x6')]('-');var _0x14db7e=_0x21c8a2[0x0];var _0x4f0184=_0x21c8a2[_0xaeb0('0x21')]===0x2?_0x21c8a2[0x1]:_0x21c8a2[0x0];_0x1c3458=monthCompare(_0x5dba01,_0x14db7e,_0x4f0184);}return _0x53bda7&&_0x4d16e2&&_0x56fb45&&_0x1c3458;}}module['exports']['iftime']=iftime; \ No newline at end of file +var _0xe2c9=['date','min','max','domCompare','MMM','monthCompare','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','join','Interval\x20string\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','includes','dowCompare'];(function(_0x2dc7c9,_0x3a15f8){var _0x3e6536=function(_0x312829){while(--_0x312829){_0x2dc7c9['push'](_0x2dc7c9['shift']());}};_0x3e6536(++_0x3a15f8);}(_0xe2c9,0x83));var _0x9e2c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2c9[_0x14add3];return _0x4a174f;};var _=require(_0x9e2c('0x0'));var moment=require(_0x9e2c('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x9e2c('0x2')](function(_0x1e5f8b){return _0x1e5f8b['source'];})[_0x9e2c('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x9e2c('0x4');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x5a60de){if(!_0x5a60de[_0x9e2c('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x535b49){var _0x206108=_0x535b49[_0x9e2c('0x6')](':')[_0x9e2c('0x2')](function(_0x352857){return parseInt(_0x352857,0xa);});var _0x5b7e95=_0x206108[0x0];var _0x749972=_0x206108[0x1];if(_0x5b7e95<0x0||_0x5b7e95>0x17||_0x749972<0x0||_0x749972>0x3b){throw new Error(EINVALID_DATE);}return[_0x5b7e95,_0x749972];}function circularDoWInterval(_0xae079,_0x1624c3){if(_0xae079===_0x1624c3){return[_0xae079];}else{var _0x4bcbee=moment['locale']();moment[_0x9e2c('0x7')]('en');var _0x3e12ce=moment[_0x9e2c('0x8')]()[_0x9e2c('0x2')](function(_0x3aa7c9){return _0x3aa7c9[_0x9e2c('0x9')]();});moment[_0x9e2c('0x7')](_0x4bcbee);var _0x576e53=_0x3e12ce[_0x9e2c('0xa')](_0xae079);var _0x42e20b=_0x3e12ce[_0x9e2c('0xa')](_0x1624c3);if(_0x42e20b>_0x576e53){return _0x3e12ce[_0x9e2c('0xb')](_0x576e53,_0x42e20b+0x1);}else{var _0x1ff79a=_0x3e12ce['slice'](0x0,_0x42e20b+0x1);var _0x5ded2a=_0x3e12ce[_0x9e2c('0xb')](_0x576e53);return _0x5ded2a[_0x9e2c('0xc')](_0x1ff79a);}}}module[_0x9e2c('0xd')][_0x9e2c('0xe')]=circularDoWInterval;function circularMonthInterval(_0x335d93,_0xc0c555){if(_0x335d93===_0xc0c555){return[_0x335d93];}else{var _0xcdb1c4=moment[_0x9e2c('0x7')]();moment['locale']('en');var _0x369056=moment[_0x9e2c('0xf')]()['map'](function(_0x27727c){return _0x27727c[_0x9e2c('0x9')]();});moment['locale'](_0xcdb1c4);var _0x34f283=_0x369056['indexOf'](_0x335d93);var _0x18c940=_0x369056['indexOf'](_0xc0c555);if(_0x18c940>_0x34f283){return _0x369056[_0x9e2c('0xb')](_0x34f283,_0x18c940+0x1);}else{var _0x3c793f=_0x369056[_0x9e2c('0xb')](0x0,_0x18c940+0x1);var _0x20b803=_0x369056[_0x9e2c('0xb')](_0x34f283);return _0x20b803[_0x9e2c('0xc')](_0x3c793f);}}}module['exports']['circularMonthInterval']=circularMonthInterval;function parseDom(_0x108092){var _0x37abd3=parseInt(_0x108092,0xa);if(_0x37abd3<0x1||_0x37abd3>0x1f){throw new Error(EINVALID_DATE);}return _0x37abd3;}function timeCompare(_0x1416f2,_0x2aa83d,_0x4720a7){var _0x217c1d=_0x1416f2[_0x9e2c('0x10')]();var _0x2cbb05=extractTime(_0x2aa83d);var _0x3941b8=_0x2cbb05[0x0];var _0x1932f5=_0x2cbb05[0x1];var _0x4167d2=_0x1416f2[_0x9e2c('0x10')]()[_0x9e2c('0x11')](_0x3941b8)[_0x9e2c('0x12')](_0x1932f5);throwIfDateNotValid(_0x4167d2);var _0x7f1a1c=extractTime(_0x4720a7);var _0x8c23e4=_0x7f1a1c[0x0];var _0x1341d2=_0x7f1a1c[0x1];var _0x12d10f=_0x1416f2['clone']()[_0x9e2c('0x11')](_0x8c23e4)[_0x9e2c('0x12')](_0x1341d2);throwIfDateNotValid(_0x12d10f);if(_0x12d10f[_0x9e2c('0x13')](_0x4167d2)){var _0x25274e=_0x217c1d[_0x9e2c('0x10')]()[_0x9e2c('0x14')](_0x9e2c('0x15'));var _0x4b9487=_0x217c1d['clone']()[_0x9e2c('0x16')](_0x9e2c('0x15'));return _0x217c1d[_0x9e2c('0x17')](_0x4167d2,_0x4b9487,undefined,'[]')||_0x217c1d[_0x9e2c('0x17')](_0x25274e,_0x12d10f,undefined,'[]');}else{return _0x217c1d[_0x9e2c('0x17')](_0x4167d2,_0x12d10f,undefined,'[]');}}module[_0x9e2c('0xd')][_0x9e2c('0x18')]=timeCompare;function dowCompare(_0x537cc3,_0xa35a9c,_0x5596a6){var _0x3a5b3b=_0x537cc3['locale']('en')[_0x9e2c('0x19')](_0x9e2c('0x1a'))[_0x9e2c('0x9')]();return circularDoWInterval(_0xa35a9c,_0x5596a6)[_0x9e2c('0x1b')](_0x3a5b3b);}module[_0x9e2c('0xd')][_0x9e2c('0x1c')]=dowCompare;function domCompare(_0x1b8cfa,_0xfb412d,_0x17c9ac){var _0x498437=_0x1b8cfa[_0x9e2c('0x1d')]();if(_0xfb412d===_0x17c9ac){return _0x498437===_0xfb412d;}else{var _0x142b9c=_0x1b8cfa['daysInMonth']();var _0x1fb91f=_0xfb412d<_0x17c9ac;let _0x521215=![];var _0x43ecec=0x0;var _0x1dc051=0x0;if(_0x1fb91f){_0x43ecec=Math['max'](0x1,_0xfb412d);_0x1dc051=Math['min'](_0x17c9ac,_0x142b9c);_0x521215=_0x498437>=_0x43ecec&&_0x498437<=_0x1dc051;}else{_0x43ecec=Math[_0x9e2c('0x1e')](_0xfb412d,_0x142b9c);_0x1dc051=Math[_0x9e2c('0x1f')](0x1,_0x17c9ac);_0x521215=_0x498437>=_0x43ecec||_0x498437<=_0x1dc051;}return _0x521215;}}module[_0x9e2c('0xd')][_0x9e2c('0x20')]=domCompare;function monthCompare(_0x4a472c,_0x2316a8,_0x325a71){var _0x43fea7=_0x4a472c[_0x9e2c('0x7')]('en')[_0x9e2c('0x19')](_0x9e2c('0x21'))[_0x9e2c('0x9')]();return circularMonthInterval(_0x2316a8,_0x325a71)[_0x9e2c('0x1b')](_0x43fea7);}module[_0x9e2c('0xd')][_0x9e2c('0x22')]=monthCompare;function iftime(_0x2393aa,_0x11444e=moment['tz']['guess'](),_0x5da0ba=moment()){if(!validateRx[_0x9e2c('0x23')](_0x2393aa)){throw new Error(EINVALID_STRING);}else{var _0xa804ba=(moment[_0x9e2c('0x24')](_0x5da0ba)?_0x5da0ba[_0x9e2c('0x10')]():moment(_0x5da0ba))['tz'](_0x11444e)['locale']('en');throwIfDateNotValid(_0xa804ba);var _0x33bac8=_0x2393aa[_0x9e2c('0x6')](',');var _0x3ffbe2=_0x33bac8[0x0];var _0x5cf801=_0x33bac8[0x1];var _0x8f8d84=_0x33bac8[0x2];var _0x554094=_0x33bac8[0x3];let _0x2bf5a1=!![];if(_0x3ffbe2!=='*'){var _0x4fd7be=_0x3ffbe2[_0x9e2c('0x6')]('-');var _0x3db490=_[_0x9e2c('0x25')](_0x4fd7be[0x0],0x5,'0');var _0x8910c4=_0x4fd7be[_0x9e2c('0x26')]===0x2?_['padStart'](_0x4fd7be[0x1],0x5,'0'):_0x3db490;_0x2bf5a1=timeCompare(_0xa804ba,_0x3db490,_0x8910c4);}let _0x2f6d02=!![];if(_0x5cf801!=='*'){var _0x2991aa=_0x5cf801[_0x9e2c('0x6')]('-');var _0x5a0e80=_0x2991aa[0x0];var _0x537fb8=_0x2991aa[_0x9e2c('0x26')]===0x2?_0x2991aa[0x1]:_0x5a0e80;_0x2f6d02=dowCompare(_0xa804ba,_0x5a0e80,_0x537fb8);}let _0x4b76e4=!![];if(_0x8f8d84!=='*'){var _0x2bf087=_0x8f8d84[_0x9e2c('0x6')]('-');var _0x576152=parseDom(_0x2bf087[0x0]);var _0x43b0e3=_0x2bf087[_0x9e2c('0x26')]===0x2?parseDom(_0x2bf087[0x1]):_0x576152;_0x4b76e4=domCompare(_0xa804ba,_0x576152,_0x43b0e3);}let _0x56d29c=!![];if(_0x554094!=='*'){var _0x321bb7=_0x554094[_0x9e2c('0x6')]('-');var _0x559feb=_0x321bb7[0x0];var _0x2a909d=_0x321bb7[_0x9e2c('0x26')]===0x2?_0x321bb7[0x1]:_0x321bb7[0x0];_0x56d29c=monthCompare(_0xa804ba,_0x559feb,_0x2a909d);}return _0x2bf5a1&&_0x2f6d02&&_0x4b76e4&&_0x56d29c;}}module[_0x9e2c('0xd')][_0x9e2c('0x27')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 713aa18..1d1932e 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7c0=['warn','File','%s-%s','error','consoleLogger','fileLogger','path','util','moment','debugLevel','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','/var/log/xcally','%s-%s.log','message','replace','}}}','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','{{{','keys','length','meta','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console'];(function(_0x48717a,_0xc7773d){var _0x1f773d=function(_0x31107c){while(--_0x31107c){_0x48717a['push'](_0x48717a['shift']());}};_0x1f773d(++_0xc7773d);}(_0xb7c0,0xea));var _0x0b7c=function(_0x23898c,_0x25d8a2){_0x23898c=_0x23898c-0x0;var _0xcf58ac=_0xb7c0[_0x23898c];return _0xcf58ac;};'use strict';var path=require(_0x0b7c('0x0'));var util=require(_0x0b7c('0x1'));var moment=require(_0x0b7c('0x2'));var winston=require('winston');var config=require('../config/environment');var debugLevel=config[_0x0b7c('0x3')]?config[_0x0b7c('0x3')]['toLowerCase']():_0x0b7c('0x4');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x0b7c('0x5'),'error':_0x0b7c('0x6'),'warn':_0x0b7c('0x7'),'info':_0x0b7c('0x8'),'print':_0x0b7c('0x9'),'success':_0x0b7c('0xa'),'http':_0x0b7c('0xb'),'verbose':_0x0b7c('0xc'),'debug':_0x0b7c('0xd'),'silly':_0x0b7c('0xe')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x32571d,_0x35ba25,_0x1bef9e){var _0x4d3d42=_0x32571d||_0x0b7c('0xf');return path['join'](_0x4d3d42,util['format'](_0x0b7c('0x10'),_0x35ba25,_0x1bef9e));}function formatter(_0xf501f7,_0x48b156){_0x48b156[_0x0b7c('0x11')]=_0x48b156[_0x0b7c('0x11')][_0x0b7c('0x12')](/@@{/g,'{{{')[_0x0b7c('0x12')](/}@@/g,_0x0b7c('0x13'))[_0x0b7c('0x12')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x0b7c('0x14')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x0b7c('0x14')](_0x0b7c('0x15')),_0x48b156[_0x0b7c('0x16')][_0x0b7c('0x17')](),_0xf501f7,_0x48b156[_0x0b7c('0x11')]);}function fileFormat(_0xc50ce3,_0x179f85){_0x179f85[_0x0b7c('0x11')]=_0x179f85['message']['replace'](/@@{/g,_0x0b7c('0x18'))[_0x0b7c('0x12')](/}@@/g,_0x0b7c('0x13'))[_0x0b7c('0x12')](/@{/g,'{{')[_0x0b7c('0x12')](/}@/g,'}}');var _0x5775f0=_0x179f85['meta']&&Object[_0x0b7c('0x19')](_0x179f85['meta'])[_0x0b7c('0x1a')]?'\x0a\x09'+JSON['stringify'](_0x179f85[_0x0b7c('0x1b')]):'';return util['format'](_0x0b7c('0x1c'),moment()[_0x0b7c('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),_0x179f85[_0x0b7c('0x16')][_0x0b7c('0x17')](),_0xc50ce3,_0x179f85['message'],_0x5775f0);}function consoleLogger(){var _0x2db828=new winston[(_0x0b7c('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x0b7c('0x1e'))][(_0x0b7c('0x1f'))]({'level':_0x0b7c('0x20'),'json':![],'formatter':function(_0x25b0fe){return formatter('',_0x25b0fe);}})]});return _0x2db828;}function fileLogger(_0x21eaab,_0x2dd745){var _0x2a5bc3=new winston[(_0x0b7c('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x0b7c('0x1e'))][(_0x0b7c('0x21'))]({'name':util[_0x0b7c('0x14')](_0x0b7c('0x22'),_0x21eaab,_0x0b7c('0x23')),'filename':getLogFileName(_0x2dd745,_0x21eaab,_0x0b7c('0x23')),'level':_0x0b7c('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x53318d){return fileFormat(_0x21eaab,_0x53318d);}}),new winston[(_0x0b7c('0x1e'))][(_0x0b7c('0x21'))]({'name':util[_0x0b7c('0x14')](_0x0b7c('0x22'),_0x21eaab,debugLevel),'filename':getLogFileName(_0x2dd745,_0x21eaab,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x388002){return fileFormat(_0x21eaab,_0x388002);}}),new winston[(_0x0b7c('0x1e'))][(_0x0b7c('0x1f'))]({'level':_0x0b7c('0x20'),'json':![],'formatter':function(_0x5e4d9d){return fileFormat(_0x21eaab,_0x5e4d9d);}})]});return _0x2a5bc3;}exports[_0x0b7c('0x24')]=consoleLogger;exports[_0x0b7c('0x25')]=fileLogger; \ No newline at end of file +var _0xa7a7=['replace','{{{','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','format','Logger','Console','transports','File','%s-%s','error','warn','consoleLogger','fileLogger','path','util','winston','../config/environment','debugLevel','toLowerCase','info','red','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','%s-%s.log','message'];(function(_0x34d5bc,_0x17a6f9){var _0x43d060=function(_0x5c5a3d){while(--_0x5c5a3d){_0x34d5bc['push'](_0x34d5bc['shift']());}};_0x43d060(++_0x17a6f9);}(_0xa7a7,0x1a4));var _0x7a7a=function(_0x741683,_0x1f20d4){_0x741683=_0x741683-0x0;var _0x1c4788=_0xa7a7[_0x741683];return _0x1c4788;};'use strict';var path=require(_0x7a7a('0x0'));var util=require(_0x7a7a('0x1'));var moment=require('moment');var winston=require(_0x7a7a('0x2'));var config=require(_0x7a7a('0x3'));var debugLevel=config[_0x7a7a('0x4')]?config[_0x7a7a('0x4')][_0x7a7a('0x5')]():_0x7a7a('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0x7a7a('0x7'),'warn':_0x7a7a('0x8'),'info':_0x7a7a('0x9'),'print':_0x7a7a('0xa'),'success':_0x7a7a('0xb'),'http':'gray','verbose':_0x7a7a('0xc'),'debug':_0x7a7a('0xd'),'silly':_0x7a7a('0xe')};winston[_0x7a7a('0xf')](XC_LOG_COLORS);function getLogFileName(_0x3d079b,_0x121c22,_0x44ca61){var _0xedd7d8=_0x3d079b||_0x7a7a('0x10');return path[_0x7a7a('0x11')](_0xedd7d8,util['format'](_0x7a7a('0x12'),_0x121c22,_0x44ca61));}function formatter(_0x56d067,_0x26a220){_0x26a220[_0x7a7a('0x13')]=_0x26a220[_0x7a7a('0x13')][_0x7a7a('0x14')](/@@{/g,_0x7a7a('0x15'))[_0x7a7a('0x14')](/}@@/g,_0x7a7a('0x16'))[_0x7a7a('0x14')](/@{/g,'{{')[_0x7a7a('0x14')](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()['format'](_0x7a7a('0x17')),_0x26a220[_0x7a7a('0x18')][_0x7a7a('0x19')](),_0x56d067,_0x26a220[_0x7a7a('0x13')]);}function fileFormat(_0x50c05a,_0x5b55d1){_0x5b55d1['message']=_0x5b55d1['message'][_0x7a7a('0x14')](/@@{/g,_0x7a7a('0x15'))[_0x7a7a('0x14')](/}@@/g,_0x7a7a('0x16'))[_0x7a7a('0x14')](/@{/g,'{{')[_0x7a7a('0x14')](/}@/g,'}}');var _0x18ad9e=_0x5b55d1[_0x7a7a('0x1a')]&&Object['keys'](_0x5b55d1[_0x7a7a('0x1a')])[_0x7a7a('0x1b')]?'\x0a\x09'+JSON[_0x7a7a('0x1c')](_0x5b55d1['meta']):'';return util['format'](_0x7a7a('0x1d'),moment()[_0x7a7a('0x1e')](_0x7a7a('0x17')),_0x5b55d1[_0x7a7a('0x18')][_0x7a7a('0x19')](),_0x50c05a,_0x5b55d1[_0x7a7a('0x13')],_0x18ad9e);}function consoleLogger(){var _0x1ba299=new winston[(_0x7a7a('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x7a7a('0x20'))]({'level':'warn','json':![],'formatter':function(_0x3056fb){return formatter('',_0x3056fb);}})]});return _0x1ba299;}function fileLogger(_0x32623f,_0x1b3444){var _0x56b15b=new winston[(_0x7a7a('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x7a7a('0x21'))][(_0x7a7a('0x22'))]({'name':util[_0x7a7a('0x1e')](_0x7a7a('0x23'),_0x32623f,_0x7a7a('0x24')),'filename':getLogFileName(_0x1b3444,_0x32623f,'error'),'level':_0x7a7a('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x578f27){return fileFormat(_0x32623f,_0x578f27);}}),new winston[(_0x7a7a('0x21'))][(_0x7a7a('0x22'))]({'name':util[_0x7a7a('0x1e')]('%s-%s',_0x32623f,debugLevel),'filename':getLogFileName(_0x1b3444,_0x32623f,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1b3909){return fileFormat(_0x32623f,_0x1b3909);}}),new winston[(_0x7a7a('0x21'))]['Console']({'level':_0x7a7a('0x25'),'json':![],'formatter':function(_0x43859e){return fileFormat(_0x32623f,_0x43859e);}})]});return _0x56b15b;}exports[_0x7a7a('0x26')]=consoleLogger;exports[_0x7a7a('0x27')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 06ba203..f580452 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x3f2a90,_0x50baf1){var _0xb46279=function(_0x5e47b5){while(--_0x5e47b5){_0x3f2a90['push'](_0x3f2a90['shift']());}};_0xb46279(++_0x50baf1);}(_0x0295,0x1f0));var _0x5029=function(_0x7b544a,_0x33c45a){_0x7b544a=_0x7b544a-0x0;var _0x33dcb4=_0x0295[_0x7b544a];return _0x33dcb4;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x66fa=['calleridnum','vidaooApiKey','privateKey','secretaccesskey','key','user','localstationid','oldPassword','isPlainObject','length','isString','replace','includes','exports','maskSensitiveData','lodash','username','newPassword','apiKey','firstName','lastName','street','phone','mobile','clientId','clientSecret','securityToken','code','accessKey','token','accessToken','authToken','calleridname'];(function(_0x7f6fab,_0x3f87b5){var _0x218a4c=function(_0x3eefb4){while(--_0x3eefb4){_0x7f6fab['push'](_0x7f6fab['shift']());}};_0x218a4c(++_0x3f87b5);}(_0x66fa,0x117));var _0xa66f=function(_0x222692,_0x324916){_0x222692=_0x222692-0x0;var _0x3e33dd=_0x66fa[_0x222692];return _0x3e33dd;};var _=require(_0xa66f('0x0'));var sensitiveFields=[_0xa66f('0x1'),'password',_0xa66f('0x2'),_0xa66f('0x3'),_0xa66f('0x4'),_0xa66f('0x5'),_0xa66f('0x6'),_0xa66f('0x7'),_0xa66f('0x8'),'fax','email',_0xa66f('0x9'),_0xa66f('0xa'),_0xa66f('0xb'),_0xa66f('0xc'),_0xa66f('0xd'),'tenantId',_0xa66f('0xe'),'channelSecret',_0xa66f('0xf'),'accessTokenSecret',_0xa66f('0x10'),'consumerKey','consumerSecret','membername',_0xa66f('0x11'),_0xa66f('0x12'),'exten',_0xa66f('0x13'),'clientEmail',_0xa66f('0x14'),'accesskeyid',_0xa66f('0x15'),_0xa66f('0x16'),_0xa66f('0x17'),'pass','accountSid',_0xa66f('0x18'),'dsn','secret','registry',_0xa66f('0x19')];function maskSensitiveData(_0x452c37){const _0x267129=/(?!^)[\s\S](?!$)/g;if(_[_0xa66f('0x1a')](_0x452c37)){for(const _0xd348f9 in _0x452c37){if(_['isArray'](_0x452c37[_0xd348f9])){for(let _0x5510dc=0x0;_0x5510dc<_0x452c37[_0xd348f9][_0xa66f('0x1b')];_0x5510dc++){maskSensitiveData(_0x452c37[_0xd348f9][_0x5510dc]);}}else if(_[_0xa66f('0x1a')](_0x452c37[_0xd348f9])){maskSensitiveData(_0x452c37[_0xd348f9]);}else if(_[_0xa66f('0x1c')](_0x452c37[_0xd348f9])){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](/{{{/g,'@@{')[_0xa66f('0x1d')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xa66f('0x1d')](/}}/g,'}@');if(_[_0xa66f('0x1e')](sensitiveFields,_0xd348f9)){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](_0x267129,'*');}}}}}module[_0xa66f('0x1f')][_0xa66f('0x20')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index 7b7082b..07b61e1 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['replace','\x5c$&','exports'];(function(_0x51f7f0,_0x4be78b){var _0x5e1e85=function(_0x3dfdb0){while(--_0x3dfdb0){_0x51f7f0['push'](_0x51f7f0['shift']());}};_0x5e1e85(++_0x4be78b);}(_0x4975,0x86));var _0x5497=function(_0x584dd3,_0x4f44f0){_0x584dd3=_0x584dd3-0x0;var _0x2fe0ee=_0x4975[_0x584dd3];return _0x2fe0ee;};module[_0x5497('0x0')]={'escapeRegExp'(_0x4db539,_0x474989=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x4db539[_0x5497('0x1')](_0x474989,_0x5497('0x2'));}}; \ No newline at end of file +var _0x0295=['exports','replace'];(function(_0x3d5351,_0x27bc80){var _0x1db4db=function(_0x3f572b){while(--_0x3f572b){_0x3d5351['push'](_0x3d5351['shift']());}};_0x1db4db(++_0x27bc80);}(_0x0295,0x1f0));var _0x5029=function(_0x57ede0,_0x2c5e8c){_0x57ede0=_0x57ede0-0x0;var _0x60056=_0x0295[_0x57ede0];return _0x60056;};module[_0x5029('0x0')]={'escapeRegExp'(_0x4e737b,_0x5e71d0=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x4e737b[_0x5029('0x1')](_0x5e71d0,'\x5c$&');}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 626f7ea..fef758b 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed3c=['{\x20{\x20','\x20}\x20}','string','replace','isPlainObject','keys','reduce','safeTemplate','lodash'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xed3c,0x1a6));var _0xced3=function(_0x499a43,_0x3cbee7){_0x499a43=_0x499a43-0x0;var _0x4e607e=_0xed3c[_0x499a43];return _0x4e607e;};var _=require(_0xced3('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x408853){return _0x408853==='{{'?_0xced3('0x1'):_0xced3('0x2');}function safeTemplate(_0x558ee8){var _0xfdc1ed=_0x558ee8;if(typeof _0x558ee8===_0xced3('0x3')){_0xfdc1ed=_0x558ee8[_0xced3('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x558ee8)){_0xfdc1ed=_0x558ee8['map'](function(_0x3d3aa0){return safeTemplate(_0x3d3aa0);});}else if(_[_0xced3('0x5')](_0x558ee8)){_0xfdc1ed=Object[_0xced3('0x6')](_0x558ee8)[_0xced3('0x7')](function(_0x4795cd,_0x510164){_0x4795cd[_0x510164]=safeTemplate(_0x558ee8[_0x510164]);return _0x4795cd;},{});}return _0xfdc1ed;}module['exports'][_0xced3('0x8')]=safeTemplate; \ No newline at end of file +var _0x6cb4=['keys','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray'];(function(_0x248067,_0x2cf85a){var _0x5bbad4=function(_0x30abfb){while(--_0x30abfb){_0x248067['push'](_0x248067['shift']());}};_0x5bbad4(++_0x2cf85a);}(_0x6cb4,0xff));var _0x46cb=function(_0x44c3f6,_0x29892d){_0x44c3f6=_0x44c3f6-0x0;var _0x3856a9=_0x6cb4[_0x44c3f6];return _0x3856a9;};var _=require(_0x46cb('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x338f2b){return _0x338f2b==='{{'?_0x46cb('0x1'):_0x46cb('0x2');}function safeTemplate(_0x375bef){var _0x36add6=_0x375bef;if(typeof _0x375bef===_0x46cb('0x3')){_0x36add6=_0x375bef[_0x46cb('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x46cb('0x5')](_0x375bef)){_0x36add6=_0x375bef['map'](function(_0x1a3fe4){return safeTemplate(_0x1a3fe4);});}else if(_['isPlainObject'](_0x375bef)){_0x36add6=Object[_0x46cb('0x6')](_0x375bef)['reduce'](function(_0x11262d,_0x148d0f){_0x11262d[_0x148d0f]=safeTemplate(_0x375bef[_0x148d0f]);return _0x11262d;},{});}return _0x36add6;}module[_0x46cb('0x7')][_0x46cb('0x8')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index eeb486c..f39e8be 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4ba=['findIndex','motion2','env','NODE_PATH','pathExists','then','readJSON','updated','info','Updating\x20app.json','exports','fs-extra','path','../config/environment','root','server/app.json','resolve','legacy-libs','apps'];(function(_0x2ba614,_0x4705b4){var _0x4d1f1a=function(_0x318f45){while(--_0x318f45){_0x2ba614['push'](_0x2ba614['shift']());}};_0x4d1f1a(++_0x4705b4);}(_0xd4ba,0x115));var _0xad4b=function(_0x50ed73,_0x56d3ad){_0x50ed73=_0x50ed73-0x0;var _0x3b8d24=_0xd4ba[_0x50ed73];return _0x3b8d24;};var fs=require(_0xad4b('0x0'));var path=require(_0xad4b('0x1'));var config=require(_0xad4b('0x2'));var root=config[_0xad4b('0x3')];var APP_JSON_PATH=path['resolve'](root,_0xad4b('0x4'));var NODEPATH=path[_0xad4b('0x5')](root,_0xad4b('0x6'));function setLegacyLibsNodeEnvPath(_0x136e60){let _0x261ecd=![];if(Array['isArray'](_0x136e60[_0xad4b('0x7')])){var _0x5e9c27=_0x136e60[_0xad4b('0x7')][_0xad4b('0x8')](function(_0x277223){return _0x277223['name']===_0xad4b('0x9');});if(_0x5e9c27>-0x1){var _0x37dcb5=_0x136e60[_0xad4b('0x7')][_0x5e9c27];if(typeof _0x37dcb5[_0xad4b('0xa')][_0xad4b('0xb')]!=='string'){_0x37dcb5[_0xad4b('0xa')][_0xad4b('0xb')]=NODEPATH;_0x261ecd=!![];}}return{'appConfig':_0x136e60,'updated':_0x261ecd};}}function updateAppConfig(_0x49fec0){return fs[_0xad4b('0xc')](APP_JSON_PATH)[_0xad4b('0xd')](function(_0x4d2fba){if(_0x4d2fba){return fs[_0xad4b('0xe')](APP_JSON_PATH)[_0xad4b('0xd')](function(_0x1ba451){var _0x459ebe=setLegacyLibsNodeEnvPath(_0x1ba451);if(_0x459ebe[_0xad4b('0xf')]){_0x49fec0[_0xad4b('0x10')](_0xad4b('0x11'));return fs['writeJSON'](APP_JSON_PATH,_0x1ba451,{'spaces':0x2});}else{return Promise[_0xad4b('0x5')]();}});}else{return Promise[_0xad4b('0x5')]();}});}module[_0xad4b('0x12')]=updateAppConfig; \ No newline at end of file +var _0xd415=['pathExists','then','readJSON','updated','info','writeJSON','exports','../config/environment','resolve','server/app.json','legacy-libs','apps','findIndex','name','motion2','env','NODE_PATH','string'];(function(_0x3805e9,_0x33a4ed){var _0x207e20=function(_0x293840){while(--_0x293840){_0x3805e9['push'](_0x3805e9['shift']());}};_0x207e20(++_0x33a4ed);}(_0xd415,0x1a5));var _0x5d41=function(_0x1d18cf,_0x17a11f){_0x1d18cf=_0x1d18cf-0x0;var _0x3caae8=_0xd415[_0x1d18cf];return _0x3caae8;};var fs=require('fs-extra');var path=require('path');var config=require(_0x5d41('0x0'));var root=config['root'];var APP_JSON_PATH=path[_0x5d41('0x1')](root,_0x5d41('0x2'));var NODEPATH=path[_0x5d41('0x1')](root,_0x5d41('0x3'));function setLegacyLibsNodeEnvPath(_0x31f927){let _0x4450ba=![];if(Array['isArray'](_0x31f927[_0x5d41('0x4')])){var _0x5f2dfa=_0x31f927['apps'][_0x5d41('0x5')](function(_0x1f97ad){return _0x1f97ad[_0x5d41('0x6')]===_0x5d41('0x7');});if(_0x5f2dfa>-0x1){var _0x109064=_0x31f927['apps'][_0x5f2dfa];if(typeof _0x109064[_0x5d41('0x8')][_0x5d41('0x9')]!==_0x5d41('0xa')){_0x109064[_0x5d41('0x8')][_0x5d41('0x9')]=NODEPATH;_0x4450ba=!![];}}return{'appConfig':_0x31f927,'updated':_0x4450ba};}}function updateAppConfig(_0x388bea){return fs[_0x5d41('0xb')](APP_JSON_PATH)[_0x5d41('0xc')](function(_0x40ef94){if(_0x40ef94){return fs[_0x5d41('0xd')](APP_JSON_PATH)[_0x5d41('0xc')](function(_0x364965){var _0x355209=setLegacyLibsNodeEnvPath(_0x364965);if(_0x355209[_0x5d41('0xe')]){_0x388bea[_0x5d41('0xf')]('Updating\x20app.json');return fs[_0x5d41('0x10')](APP_JSON_PATH,_0x364965,{'spaces':0x2});}else{return Promise[_0x5d41('0x1')]();}});}else{return Promise[_0x5d41('0x1')]();}});}module[_0x5d41('0x11')]=updateAppConfig; \ No newline at end of file